summaryrefslogtreecommitdiff
path: root/ReferenceCode
diff options
context:
space:
mode:
Diffstat (limited to 'ReferenceCode')
-rw-r--r--ReferenceCode/AcpiTables/AcpiFvi/AcpiFvi.c67
-rw-r--r--ReferenceCode/AcpiTables/AcpiFvi/AcpiFvi.cif13
-rw-r--r--ReferenceCode/AcpiTables/AcpiFvi/AcpiFvi.dxs41
-rw-r--r--ReferenceCode/AcpiTables/AcpiFvi/AcpiFvi.h28
-rw-r--r--ReferenceCode/AcpiTables/AcpiFvi/AcpiFvi.inf80
-rw-r--r--ReferenceCode/AcpiTables/AcpiFvi/AcpiFvi.mak56
-rw-r--r--ReferenceCode/AcpiTables/AcpiFvi/AcpiFvi.sdl24
-rw-r--r--ReferenceCode/AcpiTables/Cppc/AcpiTables/Cpc.asl298
-rw-r--r--ReferenceCode/AcpiTables/Cppc/AcpiTables/Cppc.asl319
-rw-r--r--ReferenceCode/AcpiTables/Cppc/AcpiTables/CppcAcpiTables.cif13
-rw-r--r--ReferenceCode/AcpiTables/Cppc/AcpiTables/CppcAcpiTables.inf69
-rw-r--r--ReferenceCode/AcpiTables/Cppc/AcpiTables/CppcAcpiTables.mak92
-rw-r--r--ReferenceCode/AcpiTables/Cppc/AcpiTables/CppcAcpiTables.sdl53
-rw-r--r--ReferenceCode/AcpiTables/Cppc/AcpiTables/Pcct.asl54
-rw-r--r--ReferenceCode/AcpiTables/Cppc/Cppc.cif14
-rw-r--r--ReferenceCode/AcpiTables/Cppc/Cppc.sdl26
-rw-r--r--ReferenceCode/AcpiTables/Cppc/Dxe/Cppc.c863
-rw-r--r--ReferenceCode/AcpiTables/Cppc/Dxe/Cppc.dxs35
-rw-r--r--ReferenceCode/AcpiTables/Cppc/Dxe/Cppc.h245
-rw-r--r--ReferenceCode/AcpiTables/Cppc/Dxe/Cppc.inf91
-rw-r--r--ReferenceCode/AcpiTables/Cppc/Dxe/CppcDxe.cif13
-rw-r--r--ReferenceCode/AcpiTables/Cppc/Dxe/CppcDxe.mak96
-rw-r--r--ReferenceCode/AcpiTables/Cppc/Dxe/CppcDxe.sdl30
-rw-r--r--ReferenceCode/AcpiTables/Cppc/Guid/AcpiTableStorage/CppcAcpiTableStorage.c33
-rw-r--r--ReferenceCode/AcpiTables/Cppc/Guid/AcpiTableStorage/CppcAcpiTableStorage.h30
-rw-r--r--ReferenceCode/AcpiTables/Cppc/Guid/CppcGuidLib.cif12
-rw-r--r--ReferenceCode/AcpiTables/Cppc/Guid/CppcGuidLib.inf55
-rw-r--r--ReferenceCode/AcpiTables/Cppc/Guid/CppcGuidLib.mak55
-rw-r--r--ReferenceCode/AcpiTables/Cppc/Guid/CppcGuidLib.sdl37
-rw-r--r--ReferenceCode/AcpiTables/Cppc/ReleaseNotes.chmbin0 -> 51521 bytes
-rw-r--r--ReferenceCode/AcpiTables/Cppc/iasl.exebin0 -> 693248 bytes
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/Art.asl91
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/B0d4CtdpPolicy.asl376
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/B0d4DppmPolicy.asl177
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/B0d4LpmPolicy.asl64
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/B0d4Participant.asl931
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/DplyParticipant.asl176
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/Dppm.asl66
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/Dptf.asl852
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/DptfAcpiTables.cif41
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/DptfAcpiTables.inf67
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/DptfAcpiTables.mak106
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/DptfAcpiTables.sdl31
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/Ertm.asl55
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/Art.asl81
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/B0d4DppmPolicy.asl192
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/DptfAcpiTablesFfrd.cif25
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/DptfAcpiTablesFfrd.inf68
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/DptfAcpiTablesFfrd.mak81
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/DptfAcpiTablesFfrd.sdl25
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/DptfFfrd.asl874
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/Ertm.asl53
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/TAmbParticipant.asl184
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/TEfnParticipant.asl184
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/TFN1Participant.asl172
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/TFN2Participant.asl166
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/TInlDppmPolicy.asl140
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/TInlParticipant.asl186
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/TMemDppmPolicy.asl188
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/TMemParticipant.asl252
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/TSknDppmPolicy.asl190
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/TSknParticipant.asl183
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/Trt.asl86
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/TAmbDppmPolicy.asl140
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/TAmbParticipant.asl184
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/TEfnDppmPolicy.asl179
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/TEfnParticipant.asl184
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/TFN1Participant.asl170
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/TFN2Participant.asl167
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/TMemDppmPolicy.asl173
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/TMemParticipant.asl264
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/TPwrParticipant.asl260
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/TSknDppmPolicy.asl172
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/TSknParticipant.asl183
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/T_VRDppmPolicy.asl140
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/T_VRParticipant.asl184
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/TcpuDppmPolicy.asl304
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/TcpuParticipant.asl423
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/TpchDppmPolicy.asl175
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/TpchParticipant.asl113
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/Trt.asl757
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/WWANDppmPolicy.asl140
-rw-r--r--ReferenceCode/AcpiTables/Dptf/AcpiTables/WWANParticipant.asl104
-rw-r--r--ReferenceCode/AcpiTables/Dptf/Dptf.cif13
-rw-r--r--ReferenceCode/AcpiTables/Dptf/Dptf.sdl26
-rw-r--r--ReferenceCode/AcpiTables/Dptf/Dxe/Dptf.c440
-rw-r--r--ReferenceCode/AcpiTables/Dptf/Dxe/Dptf.dxs33
-rw-r--r--ReferenceCode/AcpiTables/Dptf/Dxe/Dptf.h196
-rw-r--r--ReferenceCode/AcpiTables/Dptf/Dxe/Dptf.inf83
-rw-r--r--ReferenceCode/AcpiTables/Dptf/Dxe/DptfDxe.cif13
-rw-r--r--ReferenceCode/AcpiTables/Dptf/Dxe/DptfDxe.mak106
-rw-r--r--ReferenceCode/AcpiTables/Dptf/Dxe/DptfDxe.sdl30
-rw-r--r--ReferenceCode/AcpiTables/Dptf/Guid/AcpiTableStorage/DptfAcpiTableStorage.c34
-rw-r--r--ReferenceCode/AcpiTables/Dptf/Guid/AcpiTableStorage/DptfAcpiTableStorage.h35
-rw-r--r--ReferenceCode/AcpiTables/Dptf/Guid/DptfGuidLib.cif12
-rw-r--r--ReferenceCode/AcpiTables/Dptf/Guid/DptfGuidLib.inf55
-rw-r--r--ReferenceCode/AcpiTables/Dptf/Guid/DptfGuidLib.mak69
-rw-r--r--ReferenceCode/AcpiTables/Dptf/Guid/DptfGuidLib.sdl37
-rw-r--r--ReferenceCode/AcpiTables/Dptf/ReleaseNotes.chmbin0 -> 73375 bytes
-rw-r--r--ReferenceCode/AcpiTables/Dsdt/98_LINK.ASL628
-rw-r--r--ReferenceCode/AcpiTables/Dsdt/ALS.ASL57
-rw-r--r--ReferenceCode/AcpiTables/Dsdt/AcpiAsl.cif43
-rw-r--r--ReferenceCode/AcpiTables/Dsdt/AcpiAsl.mak39
-rw-r--r--ReferenceCode/AcpiTables/Dsdt/AcpiAsl.sdl417
-rw-r--r--ReferenceCode/AcpiTables/Dsdt/Bat0Virt.asl322
-rw-r--r--ReferenceCode/AcpiTables/Dsdt/Bat1Real.asl198
-rw-r--r--ReferenceCode/AcpiTables/Dsdt/Bat2Real.asl182
-rw-r--r--ReferenceCode/AcpiTables/Dsdt/CPU.asl171
-rw-r--r--ReferenceCode/AcpiTables/Dsdt/DSDT.ASL96
-rw-r--r--ReferenceCode/AcpiTables/Dsdt/EC.ASL1893
-rw-r--r--ReferenceCode/AcpiTables/Dsdt/GloblNvs.asl560
-rw-r--r--ReferenceCode/AcpiTables/Dsdt/Gpe.asl947
-rw-r--r--ReferenceCode/AcpiTables/Dsdt/H8S2113_SIO.ASL134
-rw-r--r--ReferenceCode/AcpiTables/Dsdt/LPC_DEV.ASL302
-rw-r--r--ReferenceCode/AcpiTables/Dsdt/LpcB.asl178
-rw-r--r--ReferenceCode/AcpiTables/Dsdt/NAT_COM.ASL481
-rw-r--r--ReferenceCode/AcpiTables/Dsdt/NAT_LPT.ASL942
-rw-r--r--ReferenceCode/AcpiTables/Dsdt/NAT_SIO.ASL96
-rw-r--r--ReferenceCode/AcpiTables/Dsdt/Nfc.asl93
-rw-r--r--ReferenceCode/AcpiTables/Dsdt/PCIEDOCK.ASL89
-rw-r--r--ReferenceCode/AcpiTables/Dsdt/PCI_DRC.ASL138
-rw-r--r--ReferenceCode/AcpiTables/Dsdt/Platform.asl1880
-rw-r--r--ReferenceCode/AcpiTables/Dsdt/SMSC1000_COM.asl574
-rw-r--r--ReferenceCode/AcpiTables/Dsdt/SMSC1000_LPT.asl226
-rw-r--r--ReferenceCode/AcpiTables/Dsdt/SMSC1000_SIO.asl92
-rw-r--r--ReferenceCode/AcpiTables/Dsdt/SMSC1007_COM.ASL593
-rw-r--r--ReferenceCode/AcpiTables/Dsdt/SMSC1007_SIO.ASL149
-rw-r--r--ReferenceCode/AcpiTables/Dsdt/THERMAL.ASL681
-rw-r--r--ReferenceCode/AcpiTables/Dsdt/Video.asl48
-rw-r--r--ReferenceCode/AcpiTables/Dsdt/WPCN381U_COM.asl775
-rw-r--r--ReferenceCode/AcpiTables/Dsdt/WPCN381U_LPT.ASL988
-rw-r--r--ReferenceCode/AcpiTables/Dsdt/WPCN381U_SIO.asl98
-rw-r--r--ReferenceCode/AcpiTables/Dsdt/token.asl145
-rw-r--r--ReferenceCode/AcpiTables/Dsdt/wcam.asl21
-rw-r--r--ReferenceCode/AcpiTables/Protocol/AcpiInfo/AcpiInfo.c42
-rw-r--r--ReferenceCode/AcpiTables/Protocol/AcpiInfo/AcpiInfo.h68
-rw-r--r--ReferenceCode/AcpiTables/Protocol/AcpiPlatformPolicy/AcpiPlatformPolicy.c38
-rw-r--r--ReferenceCode/AcpiTables/Protocol/AcpiPlatformPolicy/AcpiPlatformPolicy.h59
-rw-r--r--ReferenceCode/AcpiTables/Protocol/AcpiProtocolLib.cif14
-rw-r--r--ReferenceCode/AcpiTables/Protocol/AcpiProtocolLib.inf56
-rw-r--r--ReferenceCode/AcpiTables/Protocol/AcpiProtocolLib.mak55
-rw-r--r--ReferenceCode/AcpiTables/Protocol/AcpiProtocolLib.sdl36
-rw-r--r--ReferenceCode/AcpiTables/SampleCode/Lpit/LowPowerIdleTable.h68
-rw-r--r--ReferenceCode/AcpiTables/SampleCode/Lpit/lpit.act110
-rw-r--r--ReferenceCode/AcpiTables/SampleCode/Lpit/lpit.cif12
-rw-r--r--ReferenceCode/AcpiTables/SampleCode/Lpit/lpit.h114
-rw-r--r--ReferenceCode/AcpiTables/SampleCode/Lpit/lpit.mak75
-rw-r--r--ReferenceCode/AcpiTables/SampleCode/Lpit/lpit.sdl38
-rw-r--r--ReferenceCode/AcpiTables/SampleCode/SsdtRtd3/BRRtd3.asl1250
-rw-r--r--ReferenceCode/AcpiTables/SampleCode/SsdtRtd3/RTD3Common.asl178
-rw-r--r--ReferenceCode/AcpiTables/SampleCode/SsdtRtd3/RTD3Pcie.asl165
-rw-r--r--ReferenceCode/AcpiTables/SampleCode/SsdtRtd3/Rtd3FFRD.asl1049
-rw-r--r--ReferenceCode/AcpiTables/SampleCode/SsdtRtd3/SsdtRtd3.cif14
-rw-r--r--ReferenceCode/AcpiTables/SampleCode/SsdtRtd3/SsdtRtd3.mak82
-rw-r--r--ReferenceCode/AcpiTables/SampleCode/SsdtRtd3/SsdtRtd3.sdl93
-rw-r--r--ReferenceCode/AcpiTables/SampleCode/SsdtRtd3/Ult0Rtd3.asl1718
-rw-r--r--ReferenceCode/AcpiTables/SampleCode/SsdtZpOdd/SsdtZpOdd.asl134
-rw-r--r--ReferenceCode/AcpiTables/SampleCode/SsdtZpOdd/SsdtZpOdd.cif11
-rw-r--r--ReferenceCode/AcpiTables/SampleCode/SsdtZpOdd/SsdtZpOdd.mak89
-rw-r--r--ReferenceCode/AcpiTables/SampleCode/SsdtZpOdd/SsdtZpOdd.sdl59
-rw-r--r--ReferenceCode/AcpiTables/SampleCode/SsdtZpOdd/SsdtZpOddULT.asl110
-rw-r--r--ReferenceCode/AcpiTables/SsdtIRMT/IntelRMT.asl108
-rw-r--r--ReferenceCode/AcpiTables/SsdtIRMT/SsdtIRMT.cif10
-rw-r--r--ReferenceCode/AcpiTables/SsdtIRMT/SsdtIRMT.mak80
-rw-r--r--ReferenceCode/AcpiTables/SsdtIRMT/SsdtIRMT.sdl31
-rw-r--r--ReferenceCode/AcpiTables/SsdtPtid/Ptid.asl534
-rw-r--r--ReferenceCode/AcpiTables/SsdtPtid/SsdtPtid.cif10
-rw-r--r--ReferenceCode/AcpiTables/SsdtPtid/SsdtPtid.mak80
-rw-r--r--ReferenceCode/AcpiTables/SsdtPtid/SsdtPtid.sdl32
-rw-r--r--ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/Pch.asl977
-rw-r--r--ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchAcpiTables.cif19
-rw-r--r--ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchAcpiTables.inf53
-rw-r--r--ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchAcpiTables.sdl735
-rw-r--r--ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchAudio.asl44
-rw-r--r--ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchAudioDsp.asl133
-rw-r--r--ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchEhci1.asl238
-rw-r--r--ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchEhci2.asl199
-rw-r--r--ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchPcie.asl288
-rw-r--r--ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchSerialIo.asl1029
-rw-r--r--ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchSmb.asl605
-rw-r--r--ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchXhci.asl1229
-rw-r--r--ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/UsbSbd.asl92
-rw-r--r--ReferenceCode/Chipset/LynxPoint/ActiveBios/Dxe/ActiveBios.c292
-rw-r--r--ReferenceCode/Chipset/LynxPoint/ActiveBios/Dxe/ActiveBios.cif14
-rw-r--r--ReferenceCode/Chipset/LynxPoint/ActiveBios/Dxe/ActiveBios.h104
-rw-r--r--ReferenceCode/Chipset/LynxPoint/ActiveBios/Dxe/ActiveBios.inf77
-rw-r--r--ReferenceCode/Chipset/LynxPoint/ActiveBios/Dxe/ActiveBios.mak96
-rw-r--r--ReferenceCode/Chipset/LynxPoint/ActiveBios/Dxe/ActiveBios.sdl67
-rw-r--r--ReferenceCode/Chipset/LynxPoint/ActiveBios/Dxe/ActiveBiosDepex.dxs39
-rw-r--r--ReferenceCode/Chipset/LynxPoint/ActiveBios/Dxe/ActiveBiosMain.c73
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Guid/ChipsetInitHob/ChipsetInitHob.c28
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Guid/ChipsetInitHob/ChipsetInitHob.h62
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Guid/PchGuidLib.cif14
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Guid/PchGuidLib.inf48
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Guid/PchGuidLib.mak21
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Guid/PchGuidLib.sdl43
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Guid/S3SupportHob/S3SupportHob.c30
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Guid/S3SupportHob/S3SupportHob.h73
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Include/IntelPchDxe.dsc58
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Include/IntelPchDxeLib.dsc30
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Include/IntelPchInclude.cif33
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Include/IntelPchInclude.sdl56
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Include/IntelPchPei.dsc38
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Include/IntelPchPeiLib.dsc28
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Include/IobpDefinitions.h51
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Include/Library/DxeRuntimePciLibPciExpress.h61
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Include/Library/PchPciExpressHelpersLib.h296
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Include/Library/PchPlatformLib.h385
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Include/Library/PchSmbusLibrary.h44
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Include/Library/RcFviDxeLib.h175
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Include/PchAccess.h509
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Include/PchRegs.h474
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsAdsp.h109
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsHda.h399
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsLan.h196
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsLpc.h1018
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsPcie.h548
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsRcrb.h483
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsSata.h703
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsSerialIo.h169
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsSmbus.h172
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsSpi.h380
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsThermal.h100
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsUsb.h563
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Include/PchUsbConfig.h178
-rw-r--r--ReferenceCode/Chipset/LynxPoint/IoTrap/Smm/IoTrap.c884
-rw-r--r--ReferenceCode/Chipset/LynxPoint/IoTrap/Smm/IoTrap.cif13
-rw-r--r--ReferenceCode/Chipset/LynxPoint/IoTrap/Smm/IoTrap.h221
-rw-r--r--ReferenceCode/Chipset/LynxPoint/IoTrap/Smm/IoTrap.inf92
-rw-r--r--ReferenceCode/Chipset/LynxPoint/IoTrap/Smm/IoTrap.mak118
-rw-r--r--ReferenceCode/Chipset/LynxPoint/IoTrap/Smm/IoTrap.sdl67
-rw-r--r--ReferenceCode/Chipset/LynxPoint/IoTrap/Smm/IoTrapDepex.dxs43
-rw-r--r--ReferenceCode/Chipset/LynxPoint/LegacyInterrupt/Dxe/IntelLegacyInterrupt.cif12
-rw-r--r--ReferenceCode/Chipset/LynxPoint/LegacyInterrupt/Dxe/IntelLegacyInterrupt.mak91
-rw-r--r--ReferenceCode/Chipset/LynxPoint/LegacyInterrupt/Dxe/IntelLegacyInterrupt.sdl67
-rw-r--r--ReferenceCode/Chipset/LynxPoint/LegacyInterrupt/Dxe/LegacyInterrupt.c204
-rw-r--r--ReferenceCode/Chipset/LynxPoint/LegacyInterrupt/Dxe/LegacyInterrupt.h119
-rw-r--r--ReferenceCode/Chipset/LynxPoint/LegacyInterrupt/Dxe/LegacyInterrupt.inf73
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Library/DxeRuntimePciLibPciExpress/DxeRuntimePciLibPciExpress.c2148
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Library/DxeRuntimePciLibPciExpress/DxeRuntimePciLibPciExpress.cif11
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Library/DxeRuntimePciLibPciExpress/DxeRuntimePciLibPciExpress.inf78
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Library/DxeRuntimePciLibPciExpress/DxeRuntimePciLibPciExpress.mak76
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Library/DxeRuntimePciLibPciExpress/DxeRuntimePciLibPciExpress.sdl72
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Library/PchLib.cif14
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Library/PchLib.sdl55
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Library/PchPciExpressHelpersLib/PchPciExpressHelpersLib.cif12
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Library/PchPciExpressHelpersLib/PchPciExpressHelpersLib.inf66
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Library/PchPciExpressHelpersLib/PchPciExpressHelpersLib.mak88
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Library/PchPciExpressHelpersLib/PchPciExpressHelpersLib.sdl83
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Library/PchPciExpressHelpersLib/PchPciExpressHelpersLibrary.c2201
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Library/PchPciExpressHelpersLib/PchPciExpressHelpersLibrary.h42
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Library/PchPlatformLib/IobpAccess.c295
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Library/PchPlatformLib/PchPlatformLib.cif13
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Library/PchPlatformLib/PchPlatformLib.inf67
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Library/PchPlatformLib/PchPlatformLib.mak112
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Library/PchPlatformLib/PchPlatformLib.sdl93
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Library/PchPlatformLib/PchPlatformLibrary.c831
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Library/PchPlatformLib/PchPlatformLibrary.h29
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/Common/PchSmbusComLib.cif8
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/Common/PchSmbusLib.c54
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/Dxe/PchSmbusDxeLib.cif9
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/Dxe/PchSmbusLib.h25
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/Dxe/PchSmbusLibDxe.inf63
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/PchSmbusLib.cif14
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/PchSmbusLib.mak74
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/PchSmbusLib.sdl59
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/Pei/PchSmbusLib.h25
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/Pei/PchSmbusLibPei.inf64
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/Pei/PchSmbusPeiLib.cif9
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Library/RcFviDxeLib/CreateFviLibrary.c225
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Library/RcFviDxeLib/RcFviDxeLib.cif12
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Library/RcFviDxeLib/RcFviDxeLib.inf67
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Library/RcFviDxeLib/RcFviDxeLib.mak69
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Library/RcFviDxeLib/RcFviDxeLib.sdl73
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Library/RcFviDxeLib/RcFviLib.h49
-rw-r--r--ReferenceCode/Chipset/LynxPoint/LynxPoint.cif47
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Pch.sdl485
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchHSIO.c48
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchHSIO.h47
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchHSIOLptHB0.c295
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchHSIOLptHB0.h44
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchHsioLptHCx.c326
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchHsioLptHCx.h47
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchHsioLptLpBx.c239
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchHsioLptLpBx.h42
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchInitVar.c31
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchInitVar.h65
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchUsbCommon.c3032
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchUsbCommon.h360
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchUsbCommonLib.cif21
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchUsbCommonLib.mak127
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchUsbCommonLib.sdl81
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchAudioDsp.c602
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchAzalia.c915
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchDebugDump.c330
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchFvi.c137
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchInit.c2469
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchInit.dxs48
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchInit.h653
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchInitCommon.h110
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchInitDxe.cif28
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchInitDxe.inf134
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchInitDxe.mak150
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchInitDxe.sdl66
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchIoApic.c134
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchLan.c152
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchMisc.c395
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchPm.c3389
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchRootPorts.c2154
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchSata.c1547
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchSerialIo.c997
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchUsb.c439
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchUsbPrecondition.c522
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchUsbPrecondition.h54
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchDmiPeim.c831
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchInitCommon.h73
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchInitPeim.c2232
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchInitPeim.cif17
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchInitPeim.dxs39
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchInitPeim.h253
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchInitPeim.inf108
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchInitPeim.mak117
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchInitPeim.sdl67
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchUsbInit.c198
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchUsbPreconditionPeim.c105
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Smm/PchLateInitSmm.c753
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Smm/PchLateInitSmm.cif13
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Smm/PchLateInitSmm.dxs46
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Smm/PchLateInitSmm.h106
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Smm/PchLateInitSmm.inf88
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Smm/PchLateInitSmm.mak97
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchInit/Smm/PchLateInitSmm.sdl71
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmiDispatcher.cif24
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmiDispatcher.dxs43
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmiDispatcher.inf104
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmiDispatcher.mak115
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmiDispatcher.sdl102
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmm.h727
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmmCore.c891
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmmGpi.c101
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmmHelpers.c317
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmmHelpers.h155
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmmIchn.c2425
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmmPeriodicTimer.c519
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmmPowerButton.c104
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmmSw.c87
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmmSx.c975
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmmUsb.c300
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchxSmmHelpers.c820
-rw-r--r--ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchxSmmHelpers.h128
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Pcie/Smm/PchPcieSmm.c388
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Pcie/Smm/PchPcieSmm.cif13
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Pcie/Smm/PchPcieSmm.dxs52
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Pcie/Smm/PchPcieSmm.h99
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Pcie/Smm/PchPcieSmm.inf86
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Pcie/Smm/PchPcieSmm.mak100
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Pcie/Smm/PchPcieSmm.sdl69
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Ppi/IntelPchPpiLib.cif28
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Ppi/IntelPchPpiLib.inf68
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Ppi/IntelPchPpiLib.mak63
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Ppi/IntelPchPpiLib.sdl72
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Ppi/PchDmiTcVcMap/PchDmiTcVcMap.c43
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Ppi/PchDmiTcVcMap/PchDmiTcVcMap.h80
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Ppi/PchInit/PchInit.c43
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Ppi/PchInit/PchInit.h153
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Ppi/PchPeiInitDone/PchPeiInitDone.c47
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Ppi/PchPeiInitDone/PchPeiInitDone.h53
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Ppi/PchPlatformPolicy/PchPlatformPolicy.c43
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Ppi/PchPlatformPolicy/PchPlatformPolicy.h263
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Ppi/PchReset/PchReset.c42
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Ppi/PchReset/PchReset.h68
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Ppi/PchUsbPolicy/PchUsbPolicy.c45
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Ppi/PchUsbPolicy/PchUsbPolicy.h126
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Ppi/SmmControl/SmmControl.c26
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Ppi/SmmControl/SmmControl.h72
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Ppi/Spi/Spi.c44
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Ppi/Spi/Spi.h57
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Ppi/Wdt/Wdt.c32
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Ppi/Wdt/Wdt.h53
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Protocol/ActiveBios/ActiveBios.c47
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Protocol/ActiveBios/ActiveBios.h136
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Protocol/IntelPchProtocolLib.cif33
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Protocol/IntelPchProtocolLib.inf70
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Protocol/IntelPchProtocolLib.mak62
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Protocol/IntelPchProtocolLib.sdl71
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Protocol/PchInfo/PchInfo.c41
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Protocol/PchInfo/PchInfo.h121
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Protocol/PchInfo/UsbHcPortPrecondition.h53
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Protocol/PchPlatformPolicy/PchPlatformPolicy.c44
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Protocol/PchPlatformPolicy/PchPlatformPolicy.h1061
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Protocol/PchReset/PchReset.c44
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Protocol/PchReset/PchReset.h139
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Protocol/PchS3Support/PchS3Support.c43
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Protocol/PchS3Support/PchS3Support.h218
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Protocol/PchSmmIoTrapControl/PchSmmIoTrapControl.c42
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Protocol/PchSmmIoTrapControl/PchSmmIoTrapControl.h90
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Protocol/SerialGpio/SerialGpio.c34
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Protocol/SerialGpio/SerialGpio.h166
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Protocol/SmmIchnDispatchEx/SmmIchnDispatchEx.c46
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Protocol/SmmIchnDispatchEx/SmmIchnDispatchEx.h177
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Protocol/SmmIoTrapDispatch/SmmIoTrapDispatch.c42
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Protocol/SmmIoTrapDispatch/SmmIoTrapDispatch.h182
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Protocol/Spi/Spi.c48
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Protocol/Spi/Spi.h346
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Protocol/Wdt/Wdt.c34
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Protocol/Wdt/Wdt.h157
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Reset/Common/PchResetCommon.c254
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Reset/Common/PchResetCommon.h86
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Reset/Common/PchResetCommonLib.cif11
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Reset/Common/PchResetCommonLib.mak124
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Reset/Common/PchResetCommonLib.sdl97
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Reset/Pei/PchReset.c134
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Reset/Pei/PchReset.dxs39
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Reset/Pei/PchReset.h65
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Reset/Pei/PchResetPeim.cif13
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Reset/Pei/PchResetPeim.inf84
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Reset/Pei/PchResetPeim.mak99
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Reset/Pei/PchResetPeim.sdl67
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Reset/RuntimeDxe/PchReset.c496
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Reset/RuntimeDxe/PchReset.cif13
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Reset/RuntimeDxe/PchReset.dxs39
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Reset/RuntimeDxe/PchReset.h83
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Reset/RuntimeDxe/PchReset.mak117
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Reset/RuntimeDxe/PchReset.sdl67
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Reset/RuntimeDxe/PchResetRuntime.inf90
-rw-r--r--ReferenceCode/Chipset/LynxPoint/S3Support/Dxe/PchS3Support.c369
-rw-r--r--ReferenceCode/Chipset/LynxPoint/S3Support/Dxe/PchS3Support.cif13
-rw-r--r--ReferenceCode/Chipset/LynxPoint/S3Support/Dxe/PchS3Support.dxs45
-rw-r--r--ReferenceCode/Chipset/LynxPoint/S3Support/Dxe/PchS3Support.h126
-rw-r--r--ReferenceCode/Chipset/LynxPoint/S3Support/Dxe/PchS3Support.inf103
-rw-r--r--ReferenceCode/Chipset/LynxPoint/S3Support/Dxe/PchS3Support.mak115
-rw-r--r--ReferenceCode/Chipset/LynxPoint/S3Support/Dxe/PchS3Support.sdl75
-rw-r--r--ReferenceCode/Chipset/LynxPoint/S3Support/Pei/PchS3Peim.c563
-rw-r--r--ReferenceCode/Chipset/LynxPoint/S3Support/Pei/PchS3Peim.cif13
-rw-r--r--ReferenceCode/Chipset/LynxPoint/S3Support/Pei/PchS3Peim.dxs41
-rw-r--r--ReferenceCode/Chipset/LynxPoint/S3Support/Pei/PchS3Peim.h106
-rw-r--r--ReferenceCode/Chipset/LynxPoint/S3Support/Pei/PchS3Peim.inf100
-rw-r--r--ReferenceCode/Chipset/LynxPoint/S3Support/Pei/PchS3Peim.mak52
-rw-r--r--ReferenceCode/Chipset/LynxPoint/S3Support/Pei/PchS3Peim.sdl75
-rw-r--r--ReferenceCode/Chipset/LynxPoint/S3Support/Smm/S3SupportSmm.c156
-rw-r--r--ReferenceCode/Chipset/LynxPoint/S3Support/Smm/S3SupportSmm.cif13
-rw-r--r--ReferenceCode/Chipset/LynxPoint/S3Support/Smm/S3SupportSmm.dxs46
-rw-r--r--ReferenceCode/Chipset/LynxPoint/S3Support/Smm/S3SupportSmm.h60
-rw-r--r--ReferenceCode/Chipset/LynxPoint/S3Support/Smm/S3SupportSmm.inf95
-rw-r--r--ReferenceCode/Chipset/LynxPoint/S3Support/Smm/S3SupportSmm.mak94
-rw-r--r--ReferenceCode/Chipset/LynxPoint/S3Support/Smm/S3SupportSmm.sdl57
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SampleCode/AcpiTables/Dsdt/Sensor.asl103
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SampleCode/AcpiTables/Dsdt/SerialIoDevices.asl1527
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SampleCode/BiosWriteProtect/Smm/PchBiosWriteProtect.c188
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SampleCode/BiosWriteProtect/Smm/PchBiosWriteProtect.dxs48
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SampleCode/BiosWriteProtect/Smm/PchBiosWriteProtect.h36
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SampleCode/BiosWriteProtect/Smm/PchBiosWriteProtect.inf94
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SampleCode/Guid/SmbusArpMap/SmbusArpMap.h29
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SampleCode/Include/Acpi3_0.h681
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SampleCode/Include/PchAslUpdateLib.h166
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SampleCode/Library/AslUpdate/Dxe/PchAslUpdateLib.c474
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SampleCode/Library/AslUpdate/Dxe/PchAslUpdateLib.cif11
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SampleCode/Library/AslUpdate/Dxe/PchAslUpdateLib.inf66
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SampleCode/Library/AslUpdate/Dxe/PchAslUpdateLib.mak83
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SampleCode/Library/AslUpdate/Dxe/PchAslUpdateLib.sdl29
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SampleCode/PchPolicyInit/Common/PchPolicyInitCommon.c427
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SampleCode/PchPolicyInit/Common/PchPolicyInitCommon.h33
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SampleCode/PchPolicyInit/Dxe/PchPolicyInitDxe.c490
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SampleCode/PchPolicyInit/Dxe/PchPolicyInitDxe.dxs44
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SampleCode/PchPolicyInit/Dxe/PchPolicyInitDxe.h56
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SampleCode/PchPolicyInit/Dxe/PchPolicyInitDxe.inf82
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SampleCode/PchPolicyInit/Pei/PchPolicyInitPei.c250
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SampleCode/PchPolicyInit/Pei/PchPolicyInitPei.dxs40
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SampleCode/PchPolicyInit/Pei/PchPolicyInitPei.h60
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SampleCode/PchPolicyInit/Pei/PchPolicyInitPei.inf87
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SampleCode/PchSampleCode.cif34
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SampleCode/Ppi/IntelPchSampleCodePpiLib.inf45
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SampleCode/Ppi/SmbusPolicy/SmbusPolicy.h38
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SampleCode/Ppi/SmmAccess/SmmAccess.c25
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SampleCode/Ppi/SmmAccess/SmmAccess.h136
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SampleCode/Ppi/UsbController/UsbController.h49
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SampleCode/Protocol/SmmSmbus/SmmSmbus.h50
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SataController/Dxe/SataController.c943
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SataController/Dxe/SataController.cif13
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SataController/Dxe/SataController.h323
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SataController/Dxe/SataController.inf94
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SataController/Dxe/SataController.mak116
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SataController/Dxe/SataController.sdl67
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SataController/Dxe/SataControllerName.c173
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SerialGpio/Dxe/PchSerialGpio.c516
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SerialGpio/Dxe/PchSerialGpio.cif13
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SerialGpio/Dxe/PchSerialGpio.dxs39
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SerialGpio/Dxe/PchSerialGpio.h193
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SerialGpio/Dxe/PchSerialGpio.inf79
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SerialGpio/Dxe/PchSerialGpio.mak96
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SerialGpio/Dxe/PchSerialGpio.sdl67
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SmartTimer/Dxe/SmartTimer.c523
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SmartTimer/Dxe/SmartTimer.cif13
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SmartTimer/Dxe/SmartTimer.dxs42
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SmartTimer/Dxe/SmartTimer.h178
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SmartTimer/Dxe/SmartTimer.inf77
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SmartTimer/Dxe/SmartTimer.mak100
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SmartTimer/Dxe/SmartTimer.sdl76
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Smbus/Common/PchSmbusCommon.h190
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Smbus/Common/PchSmbusCommonLib.cif11
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Smbus/Common/PchSmbusCommonLib.mak124
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Smbus/Common/PchSmbusCommonLib.sdl92
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Smbus/Common/PchSmbusExec.c661
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Smbus/Dxe/PchSmbus.dxs40
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Smbus/Dxe/PchSmbus.h360
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Smbus/Dxe/PchSmbusArp.c681
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Smbus/Dxe/PchSmbusDxe.cif14
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Smbus/Dxe/PchSmbusDxe.inf93
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Smbus/Dxe/PchSmbusDxe.mak103
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Smbus/Dxe/PchSmbusDxe.sdl67
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Smbus/Dxe/PchSmbusEntry.c149
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbus.dxs44
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbus.h409
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArp.c444
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArpDisabled.cif14
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArpDisabled.inf88
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArpDisabled.mak97
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArpDisabled.sdl67
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArpEnabled.c291
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArpEnabled.cif15
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArpEnabled.inf91
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArpEnabled.mak97
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArpEnabled.sdl67
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArpdisabled.c117
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusEntry.c241
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Smbus/Smm/PchSmbus.dxs41
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Smbus/Smm/PchSmbus.h183
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Smbus/Smm/PchSmbusArpDisabled.c103
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Smbus/Smm/PchSmbusEntry.c128
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Smbus/Smm/PchSmbusSmm.cif14
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Smbus/Smm/PchSmbusSmm.inf95
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Smbus/Smm/PchSmbusSmm.mak105
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Smbus/Smm/PchSmbusSmm.sdl67
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SmmControl/Pei/PeiSmmControl.cif13
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SmmControl/Pei/PeiSmmControl.mak93
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SmmControl/Pei/PeiSmmControl.sdl24
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SmmControl/Pei/SmmControl.dxs35
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SmmControl/Pei/SmmControl.inf76
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SmmControl/Pei/SmmControlDriver.c282
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SmmControl/Pei/SmmControlDriver.h95
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SmmControl/RuntimeDxe/SmmControl.cif13
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SmmControl/RuntimeDxe/SmmControl.dxs36
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SmmControl/RuntimeDxe/SmmControl.inf85
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SmmControl/RuntimeDxe/SmmControl.mak105
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SmmControl/RuntimeDxe/SmmControl.sdl67
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SmmControl/RuntimeDxe/SmmControlDriver.c478
-rw-r--r--ReferenceCode/Chipset/LynxPoint/SmmControl/RuntimeDxe/SmmControlDriver.h164
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Spi/Common/PchSpiCommonLib.cif11
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Spi/Common/PchSpiCommonLib.mak125
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Spi/Common/PchSpiCommonLib.sdl92
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Spi/Common/SpiCommon.c1425
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Spi/Common/SpiCommon.h300
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Spi/Pei/PchSpi.c133
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Spi/Pei/PchSpi.dxs39
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Spi/Pei/PchSpi.h74
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Spi/Pei/PchSpiPeim.cif13
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Spi/Pei/PchSpiPeim.inf83
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Spi/Pei/PchSpiPeim.mak99
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Spi/Pei/PchSpiPeim.sdl67
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Spi/RuntimeDxe/PchSpi.c322
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Spi/RuntimeDxe/PchSpi.dxs39
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Spi/RuntimeDxe/PchSpi.h92
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Spi/RuntimeDxe/PchSpiRuntime.cif13
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Spi/RuntimeDxe/PchSpiRuntime.inf91
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Spi/RuntimeDxe/PchSpiRuntime.mak113
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Spi/RuntimeDxe/PchSpiRuntime.sdl66
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Spi/Smm/PchSpi.c244
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Spi/Smm/PchSpi.dxs45
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Spi/Smm/PchSpi.h76
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Spi/Smm/PchSpiSmm.cif13
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Spi/Smm/PchSpiSmm.inf92
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Spi/Smm/PchSpiSmm.mak112
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Spi/Smm/PchSpiSmm.sdl66
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Usb/Pei/PchEhci.c229
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Usb/Pei/PchEhci.h82
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Usb/Pei/PchUsb.c77
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Usb/Pei/PchUsb.cif15
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Usb/Pei/PchUsb.dxs45
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Usb/Pei/PchUsb.h47
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Usb/Pei/PchUsb.inf87
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Usb/Pei/PchUsb.mak111
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Usb/Pei/PchUsb.sdl66
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Wdt/Common/WdtCommon.c246
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Wdt/Common/WdtCommon.h166
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Wdt/Common/WdtCommonLib.cif11
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Wdt/Common/WdtCommonLib.mak103
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Wdt/Common/WdtCommonLib.sdl92
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Wdt/Dxe/WdtDxe.c218
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Wdt/Dxe/WdtDxe.cif12
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Wdt/Dxe/WdtDxe.dxs30
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Wdt/Dxe/WdtDxe.inf87
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Wdt/Dxe/WdtDxe.mak102
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Wdt/Dxe/WdtDxe.sdl68
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Wdt/Pei/WdtPei.c280
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Wdt/Pei/WdtPei.cif12
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Wdt/Pei/WdtPei.dxs31
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Wdt/Pei/WdtPei.mak94
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Wdt/Pei/WdtPei.sdl78
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Wdt/Pei/WdtPeim.inf87
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Wdt/Wdt.cif12
-rw-r--r--ReferenceCode/Chipset/LynxPoint/Wdt/Wdt.sdl73
-rw-r--r--ReferenceCode/Chipset/SystemAgent/AcpiTables/Dmar/Dmar.act340
-rw-r--r--ReferenceCode/Chipset/SystemAgent/AcpiTables/Dmar/Dmar.h39
-rw-r--r--ReferenceCode/Chipset/SystemAgent/AcpiTables/HOST_BUS.ASL770
-rw-r--r--ReferenceCode/Chipset/SystemAgent/AcpiTables/SaAcpiTables.cif18
-rw-r--r--ReferenceCode/Chipset/SystemAgent/AcpiTables/SaAcpiTables.inf54
-rw-r--r--ReferenceCode/Chipset/SystemAgent/AcpiTables/SaAcpiTables.mak41
-rw-r--r--ReferenceCode/Chipset/SystemAgent/AcpiTables/SaAcpiTables.sdl41
-rw-r--r--ReferenceCode/Chipset/SystemAgent/AcpiTables/SaAcpiTables_Edk.inf54
-rw-r--r--ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/INTELGFX.ASL1731
-rw-r--r--ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/IgdOGBDA.ASL164
-rw-r--r--ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/IgdOMOBF.ASL560
-rw-r--r--ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/IgdOSBCB.ASL335
-rw-r--r--ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/IgdOpRn.ASL342
-rw-r--r--ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/Sa.asl495
-rw-r--r--ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/SaPcieDsm.asl119
-rw-r--r--ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/SaSsdt.asl172
-rw-r--r--ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/SaSsdt.inf69
-rw-r--r--ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/SaSsdtTables.cif19
-rw-r--r--ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/SaSsdtTables.mak57
-rw-r--r--ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/SaSsdtTables.sdl104
-rw-r--r--ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/SaSsdt_Edk.inf76
-rw-r--r--ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Pch/SgAcpiTablesPch.cif12
-rw-r--r--ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Pch/SgAcpiTablesPch.inf69
-rw-r--r--ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Pch/SgAcpiTablesPch.mak62
-rw-r--r--ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Pch/SgAcpiTablesPch.sdl113
-rw-r--r--ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Pch/SgDgpuPch.asl847
-rw-r--r--ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Pch/SgSsdtPch.asl43
-rw-r--r--ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Peg/SgAcpiTables.inf69
-rw-r--r--ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Peg/SgAcpiTablesPeg.cif12
-rw-r--r--ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Peg/SgAcpiTablesPeg.mak63
-rw-r--r--ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Peg/SgAcpiTablesPeg.sdl25
-rw-r--r--ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Peg/SgDgpu.asl1693
-rw-r--r--ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Peg/SgSsdt.asl45
-rw-r--r--ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.c75
-rw-r--r--ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.cif15
-rw-r--r--ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.dxs37
-rw-r--r--ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.h80
-rw-r--r--ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.inf99
-rw-r--r--ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.mak58
-rw-r--r--ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.sdl26
-rw-r--r--ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatRmtHandler.c152
-rw-r--r--ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatRmtHandler.h33
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Guid/AcpiVariable/AcpiVariable.h80
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Guid/SaAcpiTableStorage/SaAcpiTableStorage.c27
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Guid/SaAcpiTableStorage/SaAcpiTableStorage.h31
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Guid/SaDataHob/SaDataHob.c27
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Guid/SaDataHob/SaDataHob.h122
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Guid/SaGuidLib.cif19
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Guid/SaGuidLib.inf49
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Guid/SaGuidLib.mak21
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Guid/SaGuidLib.sdl37
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Guid/SaSsdtTableStorage/SaSsdtTableStorage.c27
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Guid/SaSsdtTableStorage/SaSsdtTableStorage.h31
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Guid/SgAcpiTableStorage/SgAcpiTableStorage.c45
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Guid/SgAcpiTableStorage/SgAcpiTableStorage.h50
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Include/DmaRemappingTable.h115
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Include/IntelSaAcpiTables.dsc62
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Include/IntelSaDxe.dsc35
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Include/IntelSaDxeLib.dsc31
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Include/IntelSaPei.dsc24
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Include/IntelSaPeiLib.dsc29
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Include/IntelSaSsdtAcpiTables.dsc67
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Include/SaAccess.h290
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Include/SaBuildFlags.h37
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Include/SaCommonDefinitions.h424
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Include/SaInclude.cif21
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Include/SaInclude.sdl15
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Include/SaPciExpressLib.h38
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Include/SaPcieVersion.h30
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Include/SaRegs.h1510
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Common/SaPcieLib.c1780
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Common/SaPcieLib.cif11
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Common/SaPcieLib.h273
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Common/SaPcieLib.mak54
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Common/SaPcieLib.sdl29
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Dxe/SaPcieDxeLib.c99
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Dxe/SaPcieDxeLib.cif11
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Dxe/SaPcieDxeLib.inf63
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Dxe/SaPcieDxeLib.mak46
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Dxe/SaPcieDxeLib.sdl33
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Smm/SaPcieSmmLib.c94
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Smm/SaPcieSmmLib.cif11
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Smm/SaPcieSmmLib.inf63
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Smm/SaPcieSmmLib.mak50
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Smm/SaPcieSmmLib.sdl34
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MemInfoHob.h103
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MemoryInit.c2722
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MemoryInit.cif102
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MemoryInit.dxs78
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MemoryInit.h388
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MemoryInit.inf234
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MemoryInit.mak110
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MemoryInit.sdl273
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcDebugHook.h210
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemAddrDecode.c232
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemAddrDecode.h79
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemDebugPrint.c470
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemDebugPrint.h261
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemIo.c480
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemIo.h353
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemMemory.c198
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemMemory.h171
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemMmio.c302
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemMmio.h192
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemPlatform.c2780
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemPlatform.h357
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemSmbus.c188
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemSmbus.h119
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcSpdDriver.c291
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcSpdDriver.h50
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcSsaServices.c2338
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcSsaServices.h761
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/AddrDecode/MrcHswMcAddrDecode.c1326
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/AddrDecode/MrcHswMcAddrDecode.h129
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcApi.h280
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcBdat.c529
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcBdat.h45
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcGeneral.c1577
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcGeneral.h303
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcMemoryScrub.c678
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcMemoryScrub.h78
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcSaveRestore.c481
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcSaveRestore.h117
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcStartMemoryConfiguration.c236
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcStartMemoryConfiguration.h74
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/McAddress.h131
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcCommandTraining.h302
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcCommon.h1836
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcCrosser.h1329
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcDdr3.h449
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcDdr3Registers.h249
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcGlobal.h993
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcIoControl.h44
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcMcConfiguration.h114
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcMemoryMap.h97
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcOem.h464
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/McGdxcbar.h2849
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/McIoCkeCtl.h2594
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/McIoClk.h988
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/McIoCmd.h2002
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/McIoComp.h648
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/McIoData.h31196
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/McMain.h19761
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/McScramble.h148
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/Msa.h6827
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/Pci000.h970
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/PttHciRegs.h101
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcReset.h127
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRmtData.h226
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcSpdData.h671
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcTypes.h175
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcVersion.h24
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/McConfiguration/MrcAddressDecodeConfiguration.c368
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/McConfiguration/MrcAddressDecodeConfiguration.h78
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/McConfiguration/MrcPowerModes.c1034
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/McConfiguration/MrcPowerModes.h174
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/McConfiguration/MrcRefreshConfiguration.c453
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/McConfiguration/MrcRefreshConfiguration.h173
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/McConfiguration/MrcSchedulerParameters.c109
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/McConfiguration/MrcSchedulerParameters.h49
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/McConfiguration/MrcTimingConfiguration.c921
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/McConfiguration/MrcTimingConfiguration.h167
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/ReadTraining/MrcReadDqDqs.c1207
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/ReadTraining/MrcReadDqDqs.h97
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/ReadTraining/MrcReadReceiveEnable.c1155
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/ReadTraining/MrcReadReceiveEnable.h120
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Services/MrcCommandTraining.c4743
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Services/MrcCommon.c8010
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Services/MrcCrosser.c9860
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Services/MrcDdr3.c1572
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Services/MrcIoControl.c62
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Services/MrcMcConfiguration.c1405
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Services/MrcMemoryMap.c528
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Services/MrcReset.c629
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/SpdProcessing/MrcSpdProcessing.c4275
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/SpdProcessing/MrcSpdProcessing.h231
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/WriteTraining/MrcWriteDqDqs.c703
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/WriteTraining/MrcWriteDqDqs.h108
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/WriteTraining/MrcWriteLeveling.c1079
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/WriteTraining/MrcWriteLeveling.h85
-rw-r--r--ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/SsaCallbackPeim.h56
-rw-r--r--ReferenceCode/Chipset/SystemAgent/PciHostBridge/Dxe/PciHostBridge.c1414
-rw-r--r--ReferenceCode/Chipset/SystemAgent/PciHostBridge/Dxe/PciHostBridge.cif15
-rw-r--r--ReferenceCode/Chipset/SystemAgent/PciHostBridge/Dxe/PciHostBridge.dxs43
-rw-r--r--ReferenceCode/Chipset/SystemAgent/PciHostBridge/Dxe/PciHostBridge.h234
-rw-r--r--ReferenceCode/Chipset/SystemAgent/PciHostBridge/Dxe/PciHostBridge.inf86
-rw-r--r--ReferenceCode/Chipset/SystemAgent/PciHostBridge/Dxe/PciHostBridge.mak67
-rw-r--r--ReferenceCode/Chipset/SystemAgent/PciHostBridge/Dxe/PciHostBridge.sdl41
-rw-r--r--ReferenceCode/Chipset/SystemAgent/PciHostBridge/Dxe/PciRootBridge.h156
-rw-r--r--ReferenceCode/Chipset/SystemAgent/PciHostBridge/Dxe/PciRootBridgeIo.c1515
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Ppi/IntelSaPpiLib.inf53
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Ppi/SaPeiInit/SaPeiInit.c40
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Ppi/SaPeiInit/SaPeiInit.h37
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Ppi/SaPlatformPolicy/SaPlatformPolicy.c32
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Ppi/SaPlatformPolicy/SaPlatformPolicy.h698
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Ppi/SaPpiLib.cif16
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Ppi/SaPpiLib.mak20
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Ppi/SaPpiLib.sdl42
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Ppi/SsaPeiInit/SsaPeiInit.c47
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Ppi/SsaPeiInit/SsaPeiInit.h40
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Protocol/BdatAccess/BdatAccess.c29
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Protocol/BdatAccess/BdatAccess.h36
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Protocol/GopComponentName2/GopComponentName2.c37
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Protocol/GopComponentName2/GopComponentName2.h72
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Protocol/IgdOpRegion/IgdOpRegion.c35
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Protocol/IgdOpRegion/IgdOpRegion.h210
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Protocol/IntelSaProtocolLib.inf59
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Protocol/MemInfo/MemInfo.c33
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Protocol/MemInfo/MemInfo.h99
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Protocol/PlatformGopPolicy/PlatformGopPolicy.c36
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Protocol/PlatformGopPolicy/PlatformGopPolicy.h58
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Protocol/SaGlobalNvsArea/SaGlobalNvsArea.c31
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Protocol/SaGlobalNvsArea/SaGlobalNvsArea.h197
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Protocol/SaInfo/SaInfo.c41
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Protocol/SaInfo/SaInfo.h70
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Protocol/SaPlatformPolicy/SaPlatformPolicy.c37
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Protocol/SaPlatformPolicy/SaPlatformPolicy.h366
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Protocol/SaProtocolLib.cif26
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Protocol/SaProtocolLib.mak20
-rw-r--r--ReferenceCode/Chipset/SystemAgent/Protocol/SaProtocolLib.sdl35
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/AudioInit.c849
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/AudioInit.h66
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/LegacyRegion.c368
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/LegacyRegion.h76
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/PciExpressInit.c483
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/PciExpressInit.h224
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/PcieComplex.c1371
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/PcieComplex.h43
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/SaFvi.c105
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/SaInit.c842
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/SaInit.dxs65
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/SaInit.h194
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/SaInit.inf137
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/SaInitDxe.cif30
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/SaInitDxe.mak86
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/SaInitDxe.sdl24
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/SwitchableGraphicsInit.c958
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/SwitchableGraphicsInit.h267
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/VTd.c934
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/VTd.h70
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/graphicsinit.c1094
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/graphicsinit.h132
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/igdopregion.c955
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/igdopregion.h281
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Pei/GraphicsInit.c929
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Pei/GraphicsInit.h219
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Pei/PciExpressInit.c2987
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Pei/PciExpressInit.h452
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Pei/PcieTraining.c628
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Pei/PcieTraining.h425
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Pei/PcieTrainingEqSettings.c166
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Pei/PcieTrainingErrorCount.c195
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Pei/PcieTrainingLinkRecovery.c721
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Pei/PcieTrainingMargining.c223
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Pei/PcieTrainingPhase3.c657
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaDmiPeim.c450
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaDmiPeim.h94
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaInitPeim.c689
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaInitPeim.cif30
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaInitPeim.dxs49
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaInitPeim.h260
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaInitPeim.inf132
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaInitPeim.mak72
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaInitPeim.sdl39
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaOcInit.c189
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaOcInit.h56
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SwitchableGraphicsInit.c288
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SwitchableGraphicsInit.h93
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Smm/SaLateInitSmm.c204
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Smm/SaLateInitSmm.cif13
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Smm/SaLateInitSmm.dxs45
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Smm/SaLateInitSmm.h39
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Smm/SaLateInitSmm.inf97
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Smm/SaLateInitSmm.mak96
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SaInit/Smm/SaLateInitSmm.sdl26
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/Include/AcpiBuild.dsc96
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/Include/Cpu.h66
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/Capsule/Capsule.c27
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/Capsule/Capsule.h60
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/IntelSaSampleCodePpiLib.cif18
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/IntelSaSampleCodePpiLib.inf51
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/IntelSaSampleCodePpiLib.mak64
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/IntelSaSampleCodePpiLib.sdl28
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/PlatformMemoryRange/PlatformMemoryRange.c25
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/PlatformMemoryRange/PlatformMemoryRange.h145
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/PlatformMemorySize/PlatformMemorySize.c25
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/PlatformMemorySize/PlatformMemorySize.h45
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/SmmAccess/SmmAccess.c25
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/SmmAccess/SmmAccess.h136
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/Protocol/IntelSaSampleCodeProtocolLib.inf42
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/Protocol/PciEnumerationComplete.h30
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Dxe/SaDxePolicyInit.c247
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Dxe/SaDxePolicyInit.dxs31
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Dxe/SaDxePolicyInit.h59
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Dxe/SaDxePolicyInit.inf84
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Pei/SaPeiPolicyInit.c548
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Pei/SaPeiPolicyInit.dxs42
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Pei/SaPeiPolicyInit.h57
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Pei/SaPeiPolicyInit.inf95
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/SaSampleCode.cif22
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/Tools/GenAcpiTable.exebin0 -> 69632 bytes
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SmbiosMemory/Dxe/SmBiosMemory.cif14
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SmbiosMemory/Dxe/SmBiosMemory.inf98
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SmbiosMemory/Dxe/SmBiosMemory.mak85
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SmbiosMemory/Dxe/SmBiosMemory.sdl32
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SmbiosMemory/Dxe/SmbiosMemory.c745
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SmbiosMemory/Dxe/SmbiosMemory.dxs58
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SmbiosMemory/Dxe/SmbiosMemory.h127
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SmbiosMemory/Dxe/SmbiosMemoryStrings.unibin0 -> 4068 bytes
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SmmAccess/Dxe/SmmAccess.cif13
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SmmAccess/Dxe/SmmAccess.dxs40
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SmmAccess/Dxe/SmmAccess.inf82
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SmmAccess/Dxe/SmmAccess.mak63
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SmmAccess/Dxe/SmmAccess.sdl30
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SmmAccess/Dxe/SmmAccessDriver.c457
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SmmAccess/Dxe/SmmAccessDriver.h178
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SmmAccess/Pei/SmmAccess.inf91
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SmmAccess/Pei/SmmAccessPeim.c407
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SmmAccess/Pei/SmmAccessPeim.cif13
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SmmAccess/Pei/SmmAccessPeim.dxs29
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SmmAccess/Pei/SmmAccessPeim.h186
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SmmAccess/Pei/SmmAccessPeim.mak55
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SmmAccess/Pei/SmmAccessPeim.sdl30
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SystemAgent.cif27
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SystemAgent.sdl337
-rw-r--r--ReferenceCode/Haswell/CpuInit/Dxe/CacheData.c515
-rw-r--r--ReferenceCode/Haswell/CpuInit/Dxe/CacheData.h91
-rw-r--r--ReferenceCode/Haswell/CpuInit/Dxe/CpuFvi.c62
-rw-r--r--ReferenceCode/Haswell/CpuInit/Dxe/CpuInitDxe.c1085
-rw-r--r--ReferenceCode/Haswell/CpuInit/Dxe/CpuInitDxe.cif46
-rw-r--r--ReferenceCode/Haswell/CpuInit/Dxe/CpuInitDxe.dxs57
-rw-r--r--ReferenceCode/Haswell/CpuInit/Dxe/CpuInitDxe.h546
-rw-r--r--ReferenceCode/Haswell/CpuInit/Dxe/CpuInitDxe.inf171
-rw-r--r--ReferenceCode/Haswell/CpuInit/Dxe/CpuInitDxe.mak140
-rw-r--r--ReferenceCode/Haswell/CpuInit/Dxe/CpuInitDxe.sdl45
-rw-r--r--ReferenceCode/Haswell/CpuInit/Dxe/CpuInitDxeDbgr.c1112
-rw-r--r--ReferenceCode/Haswell/CpuInit/Dxe/CpuInitDxeDbgr.h602
-rw-r--r--ReferenceCode/Haswell/CpuInit/Dxe/CpuInitDxeStrings.unibin0 -> 2418 bytes
-rw-r--r--ReferenceCode/Haswell/CpuInit/Dxe/Exception.h92
-rw-r--r--ReferenceCode/Haswell/CpuInit/Dxe/Features.c1093
-rw-r--r--ReferenceCode/Haswell/CpuInit/Dxe/Features.h145
-rw-r--r--ReferenceCode/Haswell/CpuInit/Dxe/MachineCheck.c133
-rw-r--r--ReferenceCode/Haswell/CpuInit/Dxe/MachineCheck.h109
-rw-r--r--ReferenceCode/Haswell/CpuInit/Dxe/MemoryAttribute.c895
-rw-r--r--ReferenceCode/Haswell/CpuInit/Dxe/MemoryAttribute.h259
-rw-r--r--ReferenceCode/Haswell/CpuInit/Dxe/Microcode.c547
-rw-r--r--ReferenceCode/Haswell/CpuInit/Dxe/MpCommon.c1186
-rw-r--r--ReferenceCode/Haswell/CpuInit/Dxe/MpCommon.h606
-rw-r--r--ReferenceCode/Haswell/CpuInit/Dxe/MpService.c2194
-rw-r--r--ReferenceCode/Haswell/CpuInit/Dxe/MpService.h670
-rw-r--r--ReferenceCode/Haswell/CpuInit/Dxe/MtrrSync.c338
-rw-r--r--ReferenceCode/Haswell/CpuInit/Dxe/PiMpService.c957
-rw-r--r--ReferenceCode/Haswell/CpuInit/Dxe/PiMpService.h242
-rw-r--r--ReferenceCode/Haswell/CpuInit/Dxe/ProcessorData.c795
-rw-r--r--ReferenceCode/Haswell/CpuInit/Dxe/ProcessorData.h136
-rw-r--r--ReferenceCode/Haswell/CpuInit/Dxe/x64/Cpu.asm626
-rw-r--r--ReferenceCode/Haswell/CpuInit/Dxe/x64/CpuLib.h168
-rw-r--r--ReferenceCode/Haswell/CpuInit/Dxe/x64/Exception.c372
-rw-r--r--ReferenceCode/Haswell/CpuInit/Dxe/x64/MemoryOperation.c729
-rw-r--r--ReferenceCode/Haswell/CpuInit/Dxe/x64/MemoryOperationDbgr.c749
-rw-r--r--ReferenceCode/Haswell/CpuInit/Dxe/x64/MpCpu.c89
-rw-r--r--ReferenceCode/Haswell/CpuInit/Dxe/x64/MpEqu.inc51
-rw-r--r--ReferenceCode/Haswell/CpuInit/Dxe/x64/MpFuncs.asm618
-rw-r--r--ReferenceCode/Haswell/CpuInit/Dxe/x64/ProcessorDef.h57
-rw-r--r--ReferenceCode/Haswell/CpuInit/Dxe/x64/VirtualMemory.h145
-rw-r--r--ReferenceCode/Haswell/CpuInit/Pei/BootGuardInit.c111
-rw-r--r--ReferenceCode/Haswell/CpuInit/Pei/CachePeim.c1045
-rw-r--r--ReferenceCode/Haswell/CpuInit/Pei/CpuInitPei.cif20
-rw-r--r--ReferenceCode/Haswell/CpuInit/Pei/CpuInitPei.mak76
-rw-r--r--ReferenceCode/Haswell/CpuInit/Pei/CpuInitPei.sdl37
-rw-r--r--ReferenceCode/Haswell/CpuInit/Pei/CpuInitPeim.c1404
-rw-r--r--ReferenceCode/Haswell/CpuInit/Pei/CpuInitPeim.dxs42
-rw-r--r--ReferenceCode/Haswell/CpuInit/Pei/CpuInitPeim.h212
-rw-r--r--ReferenceCode/Haswell/CpuInit/Pei/CpuInitPeim.inf124
-rw-r--r--ReferenceCode/Haswell/CpuInit/Pei/CpuOcInit.c292
-rw-r--r--ReferenceCode/Haswell/CpuInit/Pei/CpuOcInit.h55
-rw-r--r--ReferenceCode/Haswell/CpuInit/Pei/Ia32/Cpu.asm77
-rw-r--r--ReferenceCode/Haswell/CpuInit/Pei/PfatInit.c191
-rw-r--r--ReferenceCode/Haswell/CpuInit/Pei/PfatInit.h42
-rw-r--r--ReferenceCode/Haswell/CpuS3/Pei/CpuAsm.asm147
-rw-r--r--ReferenceCode/Haswell/CpuS3/Pei/CpuS3Peim.c1035
-rw-r--r--ReferenceCode/Haswell/CpuS3/Pei/CpuS3Peim.cif18
-rw-r--r--ReferenceCode/Haswell/CpuS3/Pei/CpuS3Peim.dxs31
-rw-r--r--ReferenceCode/Haswell/CpuS3/Pei/CpuS3Peim.inf102
-rw-r--r--ReferenceCode/Haswell/CpuS3/Pei/CpuS3Peim.mak76
-rw-r--r--ReferenceCode/Haswell/CpuS3/Pei/CpuS3Peim.sdl37
-rw-r--r--ReferenceCode/Haswell/CpuS3/Pei/Microcode.c472
-rw-r--r--ReferenceCode/Haswell/CpuS3/Pei/MpCommon.h275
-rw-r--r--ReferenceCode/Haswell/CpuS3/Pei/MpEqu.inc51
-rw-r--r--ReferenceCode/Haswell/CpuS3/Pei/MpFuncs.asm196
-rw-r--r--ReferenceCode/Haswell/CpuS3/Pei/MtrrSync.c288
-rw-r--r--ReferenceCode/Haswell/DTS/Smm/DigitalThermalSensorInitStatus.h46
-rw-r--r--ReferenceCode/Haswell/DTS/Smm/DigitalThermalSensorLib.h62
-rw-r--r--ReferenceCode/Haswell/DTS/Smm/DigitalThermalSensorSmm.c1536
-rw-r--r--ReferenceCode/Haswell/DTS/Smm/DigitalThermalSensorSmm.cif15
-rw-r--r--ReferenceCode/Haswell/DTS/Smm/DigitalThermalSensorSmm.dxs52
-rw-r--r--ReferenceCode/Haswell/DTS/Smm/DigitalThermalSensorSmm.h477
-rw-r--r--ReferenceCode/Haswell/DTS/Smm/DigitalThermalSensorSmm.inf106
-rw-r--r--ReferenceCode/Haswell/DTS/Smm/DigitalThermalSensorSmm.mak77
-rw-r--r--ReferenceCode/Haswell/DTS/Smm/DigitalThermalSensorSmm.sdl25
-rw-r--r--ReferenceCode/Haswell/Docs/Haswell_CPU_RC_ReleaseNotes.pdfbin0 -> 221096 bytes
-rw-r--r--ReferenceCode/Haswell/Docs/Intel Haswell Processor Reference Code Specification_1.9.0.pdfbin0 -> 1266451 bytes
-rw-r--r--ReferenceCode/Haswell/Docs/RcCpuApi.chmbin0 -> 1175704 bytes
-rw-r--r--ReferenceCode/Haswell/Docs/ReleaseNotes.txt54
-rw-r--r--ReferenceCode/Haswell/Guid/CpuGuidLib.cif24
-rw-r--r--ReferenceCode/Haswell/Guid/CpuGuidLib.inf68
-rw-r--r--ReferenceCode/Haswell/Guid/CpuGuidLib.mak19
-rw-r--r--ReferenceCode/Haswell/Guid/CpuGuidLib.sdl26
-rw-r--r--ReferenceCode/Haswell/Guid/HtBistHob/HtBistHob.c24
-rw-r--r--ReferenceCode/Haswell/Guid/HtBistHob/HtBistHob.h29
-rw-r--r--ReferenceCode/Haswell/Guid/PowerMgmtAcpiTableStorage/PowerMgmtAcpiTableStorage.c40
-rw-r--r--ReferenceCode/Haswell/Guid/PowerMgmtAcpiTableStorage/PowerMgmtAcpiTableStorage.h35
-rw-r--r--ReferenceCode/Haswell/Guid/PoweronHob/PoweronHob.c24
-rw-r--r--ReferenceCode/Haswell/Guid/PoweronHob/PoweronHob.h29
-rw-r--r--ReferenceCode/Haswell/Guid/SmramCpuDataHeader/SmramCpuDataHeader.c24
-rw-r--r--ReferenceCode/Haswell/Guid/SmramCpuDataHeader/SmramCpuDataHeader.h32
-rw-r--r--ReferenceCode/Haswell/Guid/SmramCpuDataVariable/SmramCpuDataVariable.c24
-rw-r--r--ReferenceCode/Haswell/Guid/SmramCpuDataVariable/SmramCpuDataVariable.h46
-rw-r--r--ReferenceCode/Haswell/Guid/TxtInfoHob/TxtInfoHob.c33
-rw-r--r--ReferenceCode/Haswell/Guid/TxtInfoHob/TxtInfoHob.h65
-rw-r--r--ReferenceCode/Haswell/Guid/TxtOneTouch/TxtOneTouch.c33
-rw-r--r--ReferenceCode/Haswell/Guid/TxtOneTouch/TxtOneTouch.h53
-rw-r--r--ReferenceCode/Haswell/Haswell.chmbin0 -> 178384 bytes
-rw-r--r--ReferenceCode/Haswell/HaswellPkg.cif12
-rw-r--r--ReferenceCode/Haswell/HaswellPkg.sdl10
-rw-r--r--ReferenceCode/Haswell/HaswellRcPkg.cif46
-rw-r--r--ReferenceCode/Haswell/HaswellRcPkg.sdl206
-rw-r--r--ReferenceCode/Haswell/Include/CommonIncludes.h120
-rw-r--r--ReferenceCode/Haswell/Include/CpuAccess.h28
-rw-r--r--ReferenceCode/Haswell/Include/CpuBaseLib.h193
-rw-r--r--ReferenceCode/Haswell/Include/CpuDataStruct.h142
-rw-r--r--ReferenceCode/Haswell/Include/CpuPowerMgmt.dsc145
-rw-r--r--ReferenceCode/Haswell/Include/CpuRcInclude.cif27
-rw-r--r--ReferenceCode/Haswell/Include/CpuRegs.h582
-rw-r--r--ReferenceCode/Haswell/Include/IntelCpuDxe.dsc53
-rw-r--r--ReferenceCode/Haswell/Include/IntelCpuDxeLib.dsc41
-rw-r--r--ReferenceCode/Haswell/Include/IntelCpuPei.dsc35
-rw-r--r--ReferenceCode/Haswell/Include/IntelCpuPeiLib.dsc30
-rw-r--r--ReferenceCode/Haswell/Include/Library/BootGuardLibrary.h46
-rw-r--r--ReferenceCode/Haswell/Include/Library/CpuPlatformLib.h221
-rw-r--r--ReferenceCode/Haswell/Include/Library/TxtLibrary.h44
-rw-r--r--ReferenceCode/Haswell/Include/PfatDefinitions.h328
-rw-r--r--ReferenceCode/Haswell/Include/PowerMgmtDefinitions.h145
-rw-r--r--ReferenceCode/Haswell/Include/ThunkLib.h154
-rw-r--r--ReferenceCode/Haswell/Include/TisPc.h71
-rw-r--r--ReferenceCode/Haswell/Include/Txt.h160
-rw-r--r--ReferenceCode/Haswell/Include/Txt.inc442
-rw-r--r--ReferenceCode/Haswell/Library/BootGuardLib.cif11
-rw-r--r--ReferenceCode/Haswell/Library/BootGuardLib.mak20
-rw-r--r--ReferenceCode/Haswell/Library/BootGuardLib.sdl32
-rw-r--r--ReferenceCode/Haswell/Library/BootGuardLib/BootGuardLib.inf64
-rw-r--r--ReferenceCode/Haswell/Library/BootGuardLib/BootGuardLibrary.c121
-rw-r--r--ReferenceCode/Haswell/Library/CpuPlatformLib.cif12
-rw-r--r--ReferenceCode/Haswell/Library/CpuPlatformLib.mak28
-rw-r--r--ReferenceCode/Haswell/Library/CpuPlatformLib.sdl31
-rw-r--r--ReferenceCode/Haswell/Library/CpuPlatformLib/CpuPlatformLib.inf66
-rw-r--r--ReferenceCode/Haswell/Library/CpuPlatformLib/CpuPlatformLibrary.c476
-rw-r--r--ReferenceCode/Haswell/Library/CpuPlatformLib/CpuPlatformLibrary.h31
-rw-r--r--ReferenceCode/Haswell/Library/OcPlatformLib.cif12
-rw-r--r--ReferenceCode/Haswell/Library/OcPlatformLib.mak20
-rw-r--r--ReferenceCode/Haswell/Library/OcPlatformLib.sdl32
-rw-r--r--ReferenceCode/Haswell/Library/OverclockingLib/OverclockingLib.inf69
-rw-r--r--ReferenceCode/Haswell/Library/OverclockingLib/OverclockingLibrary.c621
-rw-r--r--ReferenceCode/Haswell/Library/OverclockingLib/OverclockingLibrary.h352
-rw-r--r--ReferenceCode/Haswell/Library/ThunkLib.cif13
-rw-r--r--ReferenceCode/Haswell/Library/ThunkLib.mak40
-rw-r--r--ReferenceCode/Haswell/Library/ThunkLib.sdl26
-rw-r--r--ReferenceCode/Haswell/Library/ThunkLib/Ia32/Thunk16.asm238
-rw-r--r--ReferenceCode/Haswell/Library/ThunkLib/Ia32/ThunkLibIa32.cif9
-rw-r--r--ReferenceCode/Haswell/Library/ThunkLib/Ia32/x86Thunk.c245
-rw-r--r--ReferenceCode/Haswell/Library/ThunkLib/ThunkLib.inf67
-rw-r--r--ReferenceCode/Haswell/Library/ThunkLib/x64/FxRestore.asm45
-rw-r--r--ReferenceCode/Haswell/Library/ThunkLib/x64/FxSave.asm45
-rw-r--r--ReferenceCode/Haswell/Library/ThunkLib/x64/Thunk16.asm216
-rw-r--r--ReferenceCode/Haswell/Library/ThunkLib/x64/ThunkLibx64.cif11
-rw-r--r--ReferenceCode/Haswell/Library/ThunkLib/x64/x86Thunk.c272
-rw-r--r--ReferenceCode/Haswell/Library/TxtLib.cif11
-rw-r--r--ReferenceCode/Haswell/Library/TxtLib.mak16
-rw-r--r--ReferenceCode/Haswell/Library/TxtLib.sdl32
-rw-r--r--ReferenceCode/Haswell/Library/TxtLib/Ia32/TxtPeiLib.asm99
-rw-r--r--ReferenceCode/Haswell/Library/TxtLib/TxtLib.inf60
-rw-r--r--ReferenceCode/Haswell/PowerManagement/AcpiTables/PowerMgmtAcpiTables.cif19
-rw-r--r--ReferenceCode/Haswell/PowerManagement/AcpiTables/PowerMgmtAcpiTables.inf77
-rw-r--r--ReferenceCode/Haswell/PowerManagement/AcpiTables/PowerMgmtAcpiTables.mak168
-rw-r--r--ReferenceCode/Haswell/PowerManagement/AcpiTables/PowerMgmtAcpiTables.sdl87
-rw-r--r--ReferenceCode/Haswell/PowerManagement/AcpiTables/Ssdt/ApCst.asl146
-rw-r--r--ReferenceCode/Haswell/PowerManagement/AcpiTables/Ssdt/ApIst.asl408
-rw-r--r--ReferenceCode/Haswell/PowerManagement/AcpiTables/Ssdt/ApTst.asl481
-rw-r--r--ReferenceCode/Haswell/PowerManagement/AcpiTables/Ssdt/Cpu0Cst.asl319
-rw-r--r--ReferenceCode/Haswell/PowerManagement/AcpiTables/Ssdt/Cpu0Ist.asl163
-rw-r--r--ReferenceCode/Haswell/PowerManagement/AcpiTables/Ssdt/Cpu0Tst.asl258
-rw-r--r--ReferenceCode/Haswell/PowerManagement/AcpiTables/Ssdt/CpuPm.asl1061
-rw-r--r--ReferenceCode/Haswell/PowerManagement/AcpiTables/Ssdt/Ctdp.asl310
-rw-r--r--ReferenceCode/Haswell/PowerManagement/AcpiTables/Ssdt/LakeTiny.asl157
-rw-r--r--ReferenceCode/Haswell/PowerManagement/Dxe/IdleStates.c918
-rw-r--r--ReferenceCode/Haswell/PowerManagement/Dxe/MiscFunctions.c853
-rw-r--r--ReferenceCode/Haswell/PowerManagement/Dxe/PerformanceStates.c930
-rw-r--r--ReferenceCode/Haswell/PowerManagement/Dxe/PowerLimits.c1302
-rw-r--r--ReferenceCode/Haswell/PowerManagement/Dxe/PowerMgmtCommon.h877
-rw-r--r--ReferenceCode/Haswell/PowerManagement/Dxe/PowerMgmtDxe.cif19
-rw-r--r--ReferenceCode/Haswell/PowerManagement/Dxe/PowerMgmtDxe.dxs38
-rw-r--r--ReferenceCode/Haswell/PowerManagement/Dxe/PowerMgmtDxe.inf114
-rw-r--r--ReferenceCode/Haswell/PowerManagement/Dxe/PowerMgmtDxe.mak82
-rw-r--r--ReferenceCode/Haswell/PowerManagement/Dxe/PowerMgmtDxe.sdl25
-rw-r--r--ReferenceCode/Haswell/PowerManagement/Dxe/PowerMgmtInit.c840
-rw-r--r--ReferenceCode/Haswell/PowerManagement/Dxe/PowerMgmtInit.h127
-rw-r--r--ReferenceCode/Haswell/PowerManagement/Dxe/Thermal.c301
-rw-r--r--ReferenceCode/Haswell/PowerManagement/Smm/PowerMgmtS3.c333
-rw-r--r--ReferenceCode/Haswell/PowerManagement/Smm/PowerMgmtS3.cif13
-rw-r--r--ReferenceCode/Haswell/PowerManagement/Smm/PowerMgmtS3.dxs45
-rw-r--r--ReferenceCode/Haswell/PowerManagement/Smm/PowerMgmtS3.h68
-rw-r--r--ReferenceCode/Haswell/PowerManagement/Smm/PowerMgmtS3.inf97
-rw-r--r--ReferenceCode/Haswell/PowerManagement/Smm/PowerMgmtS3.mak64
-rw-r--r--ReferenceCode/Haswell/PowerManagement/Smm/PowerMgmtS3.sdl25
-rw-r--r--ReferenceCode/Haswell/Ppi/Cache/Cache.c25
-rw-r--r--ReferenceCode/Haswell/Ppi/Cache/Cache.h86
-rw-r--r--ReferenceCode/Haswell/Ppi/CpuPlatformPolicy/CpuPlatformPolicy.c43
-rw-r--r--ReferenceCode/Haswell/Ppi/CpuPlatformPolicy/CpuPlatformPolicy.h358
-rw-r--r--ReferenceCode/Haswell/Ppi/CpuPpiLib.cif18
-rw-r--r--ReferenceCode/Haswell/Ppi/CpuPpiLib.inf65
-rw-r--r--ReferenceCode/Haswell/Ppi/CpuPpiLib.mak21
-rw-r--r--ReferenceCode/Haswell/Ppi/CpuPpiLib.sdl31
-rw-r--r--ReferenceCode/Haswell/Ppi/TpmInitialized/TpmInitialized.c24
-rw-r--r--ReferenceCode/Haswell/Ppi/TpmInitialized/TpmInitialized.h29
-rw-r--r--ReferenceCode/Haswell/Ppi/TxtMemoryUnlocked/TxtMemoryUnlocked.c33
-rw-r--r--ReferenceCode/Haswell/Ppi/TxtMemoryUnlocked/TxtMemoryUnlocked.h32
-rw-r--r--ReferenceCode/Haswell/Protocol/CpuInfo/CpuInfo.c25
-rw-r--r--ReferenceCode/Haswell/Protocol/CpuInfo/CpuInfo.h79
-rw-r--r--ReferenceCode/Haswell/Protocol/CpuPlatformPolicy/CpuPlatformPolicy.c26
-rw-r--r--ReferenceCode/Haswell/Protocol/CpuPlatformPolicy/CpuPlatformPolicy.h329
-rw-r--r--ReferenceCode/Haswell/Protocol/CpuPlatformPolicy/CpuPmConfig.h302
-rw-r--r--ReferenceCode/Haswell/Protocol/CpuProtocolLib.cif27
-rw-r--r--ReferenceCode/Haswell/Protocol/CpuProtocolLib.inf75
-rw-r--r--ReferenceCode/Haswell/Protocol/CpuProtocolLib.mak28
-rw-r--r--ReferenceCode/Haswell/Protocol/CpuProtocolLib.sdl29
-rw-r--r--ReferenceCode/Haswell/Protocol/MpService/MpService.c24
-rw-r--r--ReferenceCode/Haswell/Protocol/MpService/MpService.h216
-rw-r--r--ReferenceCode/Haswell/Protocol/Pfat/Pfat.c45
-rw-r--r--ReferenceCode/Haswell/Protocol/Pfat/Pfat.h129
-rw-r--r--ReferenceCode/Haswell/Protocol/PiMpService/PiMpService.c24
-rw-r--r--ReferenceCode/Haswell/Protocol/PiMpService/PiMpService.h500
-rw-r--r--ReferenceCode/Haswell/Protocol/PowerMgmtInitDone/PowerMgmtInitDone.c42
-rw-r--r--ReferenceCode/Haswell/Protocol/PowerMgmtInitDone/PowerMgmtInitDone.h52
-rw-r--r--ReferenceCode/Haswell/Protocol/PpmGlobalNvsArea/PpmGlobalNvsArea.c31
-rw-r--r--ReferenceCode/Haswell/Protocol/PpmGlobalNvsArea/PpmGlobalNvsArea.h129
-rw-r--r--ReferenceCode/Haswell/Protocol/SmmThunk/SmmThunk.c25
-rw-r--r--ReferenceCode/Haswell/Protocol/SmmThunk/SmmThunk.h64
-rw-r--r--ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Dxe/CpuPolicyDxe.cif13
-rw-r--r--ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Dxe/CpuPolicyDxe.mak92
-rw-r--r--ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Dxe/CpuPolicyDxe.sdl58
-rw-r--r--ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Dxe/CpuPolicyInitDxe.c461
-rw-r--r--ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Dxe/CpuPolicyInitDxe.dxs42
-rw-r--r--ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Dxe/CpuPolicyInitDxe.h50
-rw-r--r--ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Dxe/CpuPolicyInitDxe.inf93
-rw-r--r--ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Pei/CpuPolicyInitPei.c268
-rw-r--r--ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Pei/CpuPolicyInitPei.dxs41
-rw-r--r--ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Pei/CpuPolicyInitPei.h55
-rw-r--r--ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Pei/CpuPolicyInitPei.inf87
-rw-r--r--ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Pei/CpuPolicyPei.cif13
-rw-r--r--ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Pei/CpuPolicyPei.mak139
-rw-r--r--ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Pei/CpuPolicyPei.sdl58
-rw-r--r--ReferenceCode/Haswell/SampleCode/CpuSampleCode.cif15
-rw-r--r--ReferenceCode/Haswell/SampleCode/Include/AslUpdateLib.h178
-rw-r--r--ReferenceCode/Haswell/SampleCode/Include/BootGuardRevocationLib.h35
-rw-r--r--ReferenceCode/Haswell/SampleCode/Include/Cpu.h63
-rw-r--r--ReferenceCode/Haswell/SampleCode/Include/FlashMap.h27
-rw-r--r--ReferenceCode/Haswell/SampleCode/Include/KscLib.h232
-rw-r--r--ReferenceCode/Haswell/SampleCode/Include/PeiKscLib.h224
-rw-r--r--ReferenceCode/Haswell/SampleCode/Include/SmmIoLib.h265
-rw-r--r--ReferenceCode/Haswell/SampleCode/Include/acpibuild.dsc96
-rw-r--r--ReferenceCode/Haswell/SampleCode/Library/AslUpdate/Dxe/DxeAslUpdateLib.c333
-rw-r--r--ReferenceCode/Haswell/SampleCode/Library/AslUpdate/Dxe/DxeAslUpdateLib.inf46
-rw-r--r--ReferenceCode/Haswell/SampleCode/Library/AslUpdate/Dxe/PpmAslUpdateLib.cif11
-rw-r--r--ReferenceCode/Haswell/SampleCode/Library/AslUpdate/Dxe/PpmAslUpdateLib.mak31
-rw-r--r--ReferenceCode/Haswell/SampleCode/Library/AslUpdate/Dxe/PpmAslUpdateLib.sdl29
-rw-r--r--ReferenceCode/Haswell/SampleCode/Library/BootGuardRevocationLib/Dxe/BootGuardRevocationLib.c34
-rw-r--r--ReferenceCode/Haswell/SampleCode/Library/BootGuardRevocationLib/Dxe/BootGuardRevocationLib.cif11
-rw-r--r--ReferenceCode/Haswell/SampleCode/Library/BootGuardRevocationLib/Dxe/BootGuardRevocationLib.inf73
-rw-r--r--ReferenceCode/Haswell/SampleCode/Library/BootGuardRevocationLib/Dxe/BootGuardRevocationLib.mak31
-rw-r--r--ReferenceCode/Haswell/SampleCode/Library/BootGuardRevocationLib/Dxe/BootGuardRevocationLib.sdl29
-rw-r--r--ReferenceCode/Haswell/SampleCode/Library/BootGuardTpmEventLogLib/BootGuardTpmEventLogLib.c838
-rw-r--r--ReferenceCode/Haswell/SampleCode/Library/BootGuardTpmEventLogLib/BootGuardTpmEventLogLib.cif11
-rw-r--r--ReferenceCode/Haswell/SampleCode/Library/BootGuardTpmEventLogLib/BootGuardTpmEventLogLib.h33
-rw-r--r--ReferenceCode/Haswell/SampleCode/Library/BootGuardTpmEventLogLib/BootGuardTpmEventLogLib.mak31
-rw-r--r--ReferenceCode/Haswell/SampleCode/Library/BootGuardTpmEventLogLib/BootGuardTpmEventLogLib.sdl29
-rw-r--r--ReferenceCode/Haswell/SampleCode/Library/DTSHookLib/Smm/DTSHookLib.c71
-rw-r--r--ReferenceCode/Haswell/SampleCode/Library/DTSHookLib/Smm/DTSHookLib.cif12
-rw-r--r--ReferenceCode/Haswell/SampleCode/Library/DTSHookLib/Smm/DTSHookLib.h27
-rw-r--r--ReferenceCode/Haswell/SampleCode/Library/DTSHookLib/Smm/DTSHookLib.inf49
-rw-r--r--ReferenceCode/Haswell/SampleCode/Library/DTSHookLib/Smm/DTSHookLib.mak15
-rw-r--r--ReferenceCode/Haswell/SampleCode/Library/DTSHookLib/Smm/DTSHookLib.sdl25
-rw-r--r--ReferenceCode/Haswell/SampleCode/Library/Ksc/Smm/SmmKscLib.c228
-rw-r--r--ReferenceCode/Haswell/SampleCode/Library/Ksc/Smm/SmmKscLib.cif11
-rw-r--r--ReferenceCode/Haswell/SampleCode/Library/Ksc/Smm/SmmKscLib.inf51
-rw-r--r--ReferenceCode/Haswell/SampleCode/Library/Ksc/Smm/SmmKscLib.mak15
-rw-r--r--ReferenceCode/Haswell/SampleCode/Library/Ksc/Smm/SmmKscLib.sdl25
-rw-r--r--ReferenceCode/Haswell/SampleCode/Library/SmmIo/SmmIo.c169
-rw-r--r--ReferenceCode/Haswell/SampleCode/Library/SmmIo/SmmIoLib.cif12
-rw-r--r--ReferenceCode/Haswell/SampleCode/Library/SmmIo/SmmIoLib.inf48
-rw-r--r--ReferenceCode/Haswell/SampleCode/Library/SmmIo/SmmIoLib.mak15
-rw-r--r--ReferenceCode/Haswell/SampleCode/Library/SmmIo/SmmIoLib.sdl25
-rw-r--r--ReferenceCode/Haswell/SampleCode/Library/SmmIo/SmmPciIo.c161
-rw-r--r--ReferenceCode/Haswell/SampleCode/Protocol/CpuSampleCodeProtocolLib.cif11
-rw-r--r--ReferenceCode/Haswell/SampleCode/Protocol/CpuSampleCodeProtocolLib.mak25
-rw-r--r--ReferenceCode/Haswell/SampleCode/Protocol/CpuSampleCodeProtocolLib.sdl24
-rw-r--r--ReferenceCode/Haswell/SampleCode/Protocol/TxtOneTouchOp/TxtOneTouchOp.c32
-rw-r--r--ReferenceCode/Haswell/SampleCode/Protocol/TxtOneTouchOp/TxtOneTouchOp.h106
-rw-r--r--ReferenceCode/Haswell/SampleCode/SecCore/CpuRcSec.cif20
-rw-r--r--ReferenceCode/Haswell/SampleCode/SecCore/CpuRcSec.mak27
-rw-r--r--ReferenceCode/Haswell/SampleCode/SecCore/CpuRcSec.sdl40
-rw-r--r--ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/Chipset.inc107
-rw-r--r--ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/CpuRcSec.asm38
-rw-r--r--ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/CrcSecPpi.c233
-rw-r--r--ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/Flat32.asm1490
-rw-r--r--ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/Ia32.inc164
-rw-r--r--ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/Platform.inc196
-rw-r--r--ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/ResetVec.asm108
-rw-r--r--ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/ResetVec.rawbin0 -> 64 bytes
-rw-r--r--ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/SecCore.inc56
-rw-r--r--ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/SecFlat32.inc1024
-rw-r--r--ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/SecStartup.c136
-rw-r--r--ReferenceCode/Haswell/SampleCode/TxtOneTouch/Dxe/TxtOneTouchDxe.c631
-rw-r--r--ReferenceCode/Haswell/SampleCode/TxtOneTouch/Dxe/TxtOneTouchDxe.cif14
-rw-r--r--ReferenceCode/Haswell/SampleCode/TxtOneTouch/Dxe/TxtOneTouchDxe.dxs42
-rw-r--r--ReferenceCode/Haswell/SampleCode/TxtOneTouch/Dxe/TxtOneTouchDxe.h158
-rw-r--r--ReferenceCode/Haswell/SampleCode/TxtOneTouch/Dxe/TxtOneTouchDxe.inf113
-rw-r--r--ReferenceCode/Haswell/SampleCode/TxtOneTouch/Dxe/TxtOneTouchDxe.mak88
-rw-r--r--ReferenceCode/Haswell/SampleCode/TxtOneTouch/Dxe/TxtOneTouchDxe.sdl28
-rw-r--r--ReferenceCode/Haswell/SampleCode/TxtOneTouch/Dxe/TxtOneTouchOp.c178
-rw-r--r--ReferenceCode/Haswell/Txt/BiosAcm/HSW_BIOSAC_DBG_Rev1_5.BINbin0 -> 64576 bytes
-rw-r--r--ReferenceCode/Haswell/Txt/BiosAcm/HSW_BIOSAC_PRO_NPW_Rev1_5.BINbin0 -> 64576 bytes
-rw-r--r--ReferenceCode/Haswell/Txt/BiosAcm/HSW_BIOSAC_PRO_Rev1_5.BINbin0 -> 64576 bytes
-rw-r--r--ReferenceCode/Haswell/Txt/BiosAcm/TxtBiosAcm.cif14
-rw-r--r--ReferenceCode/Haswell/Txt/BiosAcm/TxtBiosAcm.inf33
-rw-r--r--ReferenceCode/Haswell/Txt/BiosAcm/TxtBiosAcm.mak13
-rw-r--r--ReferenceCode/Haswell/Txt/BiosAcm/TxtBiosAcm.sdl39
-rw-r--r--ReferenceCode/Haswell/Txt/BiosAcm/makefile.new63
-rw-r--r--ReferenceCode/Haswell/Txt/Tools/Apfixup.txt33
-rw-r--r--ReferenceCode/Haswell/Txt/Tools/Stafixup.exebin0 -> 20992 bytes
-rw-r--r--ReferenceCode/Haswell/Txt/Tools/TxtTools.cif10
-rw-r--r--ReferenceCode/Haswell/Txt/Tools/TxtTools.sdl23
-rw-r--r--ReferenceCode/Haswell/Txt/TxtInit/Dxe/TxtDxe.c171
-rw-r--r--ReferenceCode/Haswell/Txt/TxtInit/Dxe/TxtDxe.cif18
-rw-r--r--ReferenceCode/Haswell/Txt/TxtInit/Dxe/TxtDxe.dxs50
-rw-r--r--ReferenceCode/Haswell/Txt/TxtInit/Dxe/TxtDxe.inf117
-rw-r--r--ReferenceCode/Haswell/Txt/TxtInit/Dxe/TxtDxe.mak72
-rw-r--r--ReferenceCode/Haswell/Txt/TxtInit/Dxe/TxtDxe.sdl27
-rw-r--r--ReferenceCode/Haswell/Txt/TxtInit/Dxe/TxtDxeLib.c1080
-rw-r--r--ReferenceCode/Haswell/Txt/TxtInit/Dxe/TxtDxeLib.h289
-rw-r--r--ReferenceCode/Haswell/Txt/TxtInit/Dxe/TxtDxeOem.c78
-rw-r--r--ReferenceCode/Haswell/Txt/TxtInit/Dxe/x64/Mmx64.inc494
-rw-r--r--ReferenceCode/Haswell/Txt/TxtInit/Dxe/x64/TxtDxeAp.asm364
-rw-r--r--ReferenceCode/Haswell/Txt/TxtInit/Dxe/x64/TxtDxeBsp.asm712
-rw-r--r--ReferenceCode/Haswell/Txt/TxtInit/Pei/Ia32/TxtPeiAp.asm16305
-rw-r--r--ReferenceCode/Haswell/Txt/TxtInit/Pei/Ia32/TxtPeiAp.inf35
-rw-r--r--ReferenceCode/Haswell/Txt/TxtInit/Pei/Ia32/TxtPeiApV7.inf35
-rw-r--r--ReferenceCode/Haswell/Txt/TxtInit/Pei/Ia32/TxtPeiBsp.asm1387
-rw-r--r--ReferenceCode/Haswell/Txt/TxtInit/Pei/Ia32/makefile.new69
-rw-r--r--ReferenceCode/Haswell/Txt/TxtInit/Pei/TxtPei.c241
-rw-r--r--ReferenceCode/Haswell/Txt/TxtInit/Pei/TxtPei.dxs49
-rw-r--r--ReferenceCode/Haswell/Txt/TxtInit/Pei/TxtPei.inf104
-rw-r--r--ReferenceCode/Haswell/Txt/TxtInit/Pei/TxtPei.mak105
-rw-r--r--ReferenceCode/Haswell/Txt/TxtInit/Pei/TxtPei.sdl86
-rw-r--r--ReferenceCode/Haswell/Txt/TxtInit/Pei/TxtPeiLib.c1045
-rw-r--r--ReferenceCode/Haswell/Txt/TxtInit/Pei/TxtPeiLib.h560
-rw-r--r--ReferenceCode/Haswell/Txt/TxtInit/Pei/Txtpei.cif19
-rw-r--r--ReferenceCode/ME/AcpiTables/MeSsdt/MeSsdt.asl56
-rw-r--r--ReferenceCode/ME/AcpiTables/MeSsdt/MeSsdt.cif12
-rw-r--r--ReferenceCode/ME/AcpiTables/MeSsdt/MeSsdt.inf69
-rw-r--r--ReferenceCode/ME/AcpiTables/MeSsdt/MeSsdt.mak64
-rw-r--r--ReferenceCode/ME/AcpiTables/MeSsdt/MeSsdt.sdl31
-rw-r--r--ReferenceCode/ME/AcpiTables/MeSsdt/MeSsdt_Edk.inf69
-rw-r--r--ReferenceCode/ME/ActiveManagement/ActiveManagement.cif14
-rw-r--r--ReferenceCode/ME/ActiveManagement/ActiveManagement.sdl16
-rw-r--r--ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/AlertStandardFormat.cif12
-rw-r--r--ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/AlertStandardFormat.sdl19
-rw-r--r--ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Common/AlertStandardFormatCommon.c1561
-rw-r--r--ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Common/AlertStandardFormatCommon.cif10
-rw-r--r--ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Common/AlertStandardFormatCommon.h397
-rw-r--r--ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Common/AlertStandardFormatCommon.sdl10
-rw-r--r--ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Dxe/AlertStandardFormatDxe.c1234
-rw-r--r--ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Dxe/AlertStandardFormatDxe.cif13
-rw-r--r--ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Dxe/AlertStandardFormatDxe.dxs47
-rw-r--r--ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Dxe/AlertStandardFormatDxe.h340
-rw-r--r--ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Dxe/AlertStandardFormatDxe.inf99
-rw-r--r--ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Dxe/AlertStandardFormatDxe.mak59
-rw-r--r--ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Dxe/AlertStandardFormatDxe.sdl25
-rw-r--r--ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Pei/AlertStandardFormatPei.c437
-rw-r--r--ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Pei/AlertStandardFormatPei.cif13
-rw-r--r--ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Pei/AlertStandardFormatPei.dxs29
-rw-r--r--ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Pei/AlertStandardFormatPei.h204
-rw-r--r--ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Pei/AlertStandardFormatPei.inf93
-rw-r--r--ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Pei/AlertStandardFormatPei.mak50
-rw-r--r--ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Pei/AlertStandardFormatPei.sdl25
-rw-r--r--ReferenceCode/ME/ActiveManagement/AmtBootOptions/AmtBootOptions.cif10
-rw-r--r--ReferenceCode/ME/ActiveManagement/AmtBootOptions/AmtBootOptions.sdl21
-rw-r--r--ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/AMTDxe.cif13
-rw-r--r--ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/AMTDxe.mak58
-rw-r--r--ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/AMTDxe.sdl29
-rw-r--r--ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/ActiveManagement.c553
-rw-r--r--ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/ActiveManagement.dxs45
-rw-r--r--ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/ActiveManagement.h272
-rw-r--r--ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/ActiveManagement.inf100
-rw-r--r--ReferenceCode/ME/ActiveManagement/IdeR/Dxe/IdeRController.c927
-rw-r--r--ReferenceCode/ME/ActiveManagement/IdeR/Dxe/IdeRController.cif13
-rw-r--r--ReferenceCode/ME/ActiveManagement/IdeR/Dxe/IdeRController.h422
-rw-r--r--ReferenceCode/ME/ActiveManagement/IdeR/Dxe/IdeRController.inf86
-rw-r--r--ReferenceCode/ME/ActiveManagement/IdeR/Dxe/IdeRController.mak55
-rw-r--r--ReferenceCode/ME/ActiveManagement/IdeR/Dxe/IdeRController.sdl24
-rw-r--r--ReferenceCode/ME/ActiveManagement/IdeR/Dxe/IdeRControllerName.c172
-rw-r--r--ReferenceCode/ME/ActiveManagement/Sol/Dxe/ComponentName.c187
-rw-r--r--ReferenceCode/ME/ActiveManagement/Sol/Dxe/PciSerial.c1807
-rw-r--r--ReferenceCode/ME/ActiveManagement/Sol/Dxe/PciSerial.cif13
-rw-r--r--ReferenceCode/ME/ActiveManagement/Sol/Dxe/PciSerial.h787
-rw-r--r--ReferenceCode/ME/ActiveManagement/Sol/Dxe/PciSerial.inf87
-rw-r--r--ReferenceCode/ME/ActiveManagement/Sol/Dxe/PciSerial.mak55
-rw-r--r--ReferenceCode/ME/ActiveManagement/Sol/Dxe/PciSerial.sdl24
-rw-r--r--ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.c96
-rw-r--r--ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.cif13
-rw-r--r--ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.dxs47
-rw-r--r--ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.h49
-rw-r--r--ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.inf74
-rw-r--r--ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.mak52
-rw-r--r--ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.sdl25
-rw-r--r--ReferenceCode/ME/At/At.cif10
-rw-r--r--ReferenceCode/ME/At/At.sdl25
-rw-r--r--ReferenceCode/ME/At/AtAm/Dxe/At.c1015
-rw-r--r--ReferenceCode/ME/At/AtAm/Dxe/At.h280
-rw-r--r--ReferenceCode/ME/At/AtAm/Dxe/AtAm.c694
-rw-r--r--ReferenceCode/ME/At/AtAm/Dxe/AtAm.dxs41
-rw-r--r--ReferenceCode/ME/At/AtAm/Dxe/AtAm.h239
-rw-r--r--ReferenceCode/ME/At/AtAm/Dxe/AtAm.inf95
-rw-r--r--ReferenceCode/ME/At/AtAm/Dxe/AtAmDxe.cif18
-rw-r--r--ReferenceCode/ME/At/AtAm/Dxe/AtAmDxe.mak81
-rw-r--r--ReferenceCode/ME/At/AtAm/Dxe/AtAmDxe.sdl33
-rw-r--r--ReferenceCode/ME/At/AtAm/Dxe/AtHi.h1275
-rw-r--r--ReferenceCode/ME/BiosExtension/BiosExtension.cif9
-rw-r--r--ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/BiosExtensionLoader.c1273
-rw-r--r--ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/BiosExtensionLoader.cif18
-rw-r--r--ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/BiosExtensionLoader.dxs52
-rw-r--r--ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/BiosExtensionLoader.h440
-rw-r--r--ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/BiosExtensionLoader.inf116
-rw-r--r--ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/BiosExtensionLoader.mak80
-rw-r--r--ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/BiosExtensionLoader.sdl32
-rw-r--r--ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/Inventory.c828
-rw-r--r--ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/Inventory.h159
-rw-r--r--ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/MebxBiosParamsDebugDumpDxe.c55
-rw-r--r--ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/UsbProvision.c753
-rw-r--r--ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/UsbProvision.h249
-rw-r--r--ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/EfiMEBx.cif9
-rw-r--r--ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/Mebx/MEBx.cif12
-rw-r--r--ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/Mebx/Mebx.dxs29
-rw-r--r--ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/Mebx/Mebx.efibin0 -> 122592 bytes
-rw-r--r--ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/Mebx/Mebx.inf38
-rw-r--r--ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/Mebx/Mebx.mak91
-rw-r--r--ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/Mebx/Mebx.sdl34
-rw-r--r--ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/MebxSetupBrowser/MebxSetupBrowser.cif12
-rw-r--r--ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/MebxSetupBrowser/MebxSetupBrowser.dxs33
-rw-r--r--ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/MebxSetupBrowser/MebxSetupBrowser.efibin0 -> 65120 bytes
-rw-r--r--ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/MebxSetupBrowser/MebxSetupBrowser.inf38
-rw-r--r--ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/MebxSetupBrowser/MebxSetupBrowser.mak92
-rw-r--r--ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/MebxSetupBrowser/MebxSetupBrowser.sdl34
-rw-r--r--ReferenceCode/ME/FwUpdate/MeFwDowngrade/Dxe/MeFwDowngrade.c261
-rw-r--r--ReferenceCode/ME/FwUpdate/MeFwDowngrade/Dxe/MeFwDowngrade.cif12
-rw-r--r--ReferenceCode/ME/FwUpdate/MeFwDowngrade/Dxe/MeFwDowngrade.dxs45
-rw-r--r--ReferenceCode/ME/FwUpdate/MeFwDowngrade/Dxe/MeFwDowngrade.inf85
-rw-r--r--ReferenceCode/ME/FwUpdate/MeFwDowngrade/Dxe/MeFwDowngrade.mak56
-rw-r--r--ReferenceCode/ME/FwUpdate/MeFwDowngrade/Dxe/MeFwDowngrade.sdl35
-rw-r--r--ReferenceCode/ME/Guid/AmtForcePushPetPolicy/AmtForcePushPetPolicy.c33
-rw-r--r--ReferenceCode/ME/Guid/AmtForcePushPetPolicy/AmtForcePushPetPolicy.h36
-rw-r--r--ReferenceCode/ME/Guid/ConsoleLock/ConsoleLock.c35
-rw-r--r--ReferenceCode/ME/Guid/ConsoleLock/ConsoleLock.h39
-rw-r--r--ReferenceCode/ME/Guid/MeBiosExtensionSetup/MeBiosExtensionSetup.c35
-rw-r--r--ReferenceCode/ME/Guid/MeBiosExtensionSetup/MeBiosExtensionSetup.h95
-rw-r--r--ReferenceCode/ME/Guid/MeDataHob/MeDataHob.c27
-rw-r--r--ReferenceCode/ME/Guid/MeDataHob/MeDataHob.h55
-rw-r--r--ReferenceCode/ME/Guid/MeGuidLib.cif22
-rw-r--r--ReferenceCode/ME/Guid/MeGuidLib.inf55
-rw-r--r--ReferenceCode/ME/Guid/MeGuidLib.mak49
-rw-r--r--ReferenceCode/ME/Guid/MeGuidLib.sdl24
-rw-r--r--ReferenceCode/ME/Guid/MePlatformReadyToBoot/MePlatformReadyToBoot.c33
-rw-r--r--ReferenceCode/ME/Guid/MePlatformReadyToBoot/MePlatformReadyToBoot.h31
-rw-r--r--ReferenceCode/ME/Guid/MeSsdtTableStorage/MeSsdtTableStorage.c27
-rw-r--r--ReferenceCode/ME/Guid/MeSsdtTableStorage/MeSsdtTableStorage.h31
-rw-r--r--ReferenceCode/ME/Heci/Dxe/HeciDxe.cif18
-rw-r--r--ReferenceCode/ME/Heci/Dxe/HeciDxe.mak65
-rw-r--r--ReferenceCode/ME/Heci/Dxe/HeciDxe.sdl24
-rw-r--r--ReferenceCode/ME/Heci/Dxe/HeciHpet.c168
-rw-r--r--ReferenceCode/ME/Heci/Dxe/HeciHpet.h115
-rw-r--r--ReferenceCode/ME/Heci/Dxe/Hecicore.c1461
-rw-r--r--ReferenceCode/ME/Heci/Dxe/Hecicore.h342
-rw-r--r--ReferenceCode/ME/Heci/Dxe/Hecidrv.c1540
-rw-r--r--ReferenceCode/ME/Heci/Dxe/Hecidrv.dxs43
-rw-r--r--ReferenceCode/ME/Heci/Dxe/Hecidrv.h70
-rw-r--r--ReferenceCode/ME/Heci/Dxe/Hecidrv.inf99
-rw-r--r--ReferenceCode/ME/Heci/Dxe/MeFvi.c49
-rw-r--r--ReferenceCode/ME/Heci/Include/HeciInclude.cif9
-rw-r--r--ReferenceCode/ME/Heci/Include/HeciInclude.sdl9
-rw-r--r--ReferenceCode/ME/Heci/Include/HeciRegs.h275
-rw-r--r--ReferenceCode/ME/Heci/MeHeci.cif13
-rw-r--r--ReferenceCode/ME/Heci/MeHeci.sdl19
-rw-r--r--ReferenceCode/ME/Heci/Pei/HeciCore.c1247
-rw-r--r--ReferenceCode/ME/Heci/Pei/HeciInit.c182
-rw-r--r--ReferenceCode/ME/Heci/Pei/HeciInit.dxs45
-rw-r--r--ReferenceCode/ME/Heci/Pei/HeciInit.h390
-rw-r--r--ReferenceCode/ME/Heci/Pei/HeciInit.inf82
-rw-r--r--ReferenceCode/ME/Heci/Pei/HeciPei.cif14
-rw-r--r--ReferenceCode/ME/Heci/Pei/HeciPei.mak48
-rw-r--r--ReferenceCode/ME/Heci/Pei/HeciPei.sdl24
-rw-r--r--ReferenceCode/ME/Heci/Smm/HeciHpet.c282
-rw-r--r--ReferenceCode/ME/Heci/Smm/HeciHpet.h197
-rw-r--r--ReferenceCode/ME/Heci/Smm/HeciSmm.c228
-rw-r--r--ReferenceCode/ME/Heci/Smm/HeciSmm.cif16
-rw-r--r--ReferenceCode/ME/Heci/Smm/HeciSmm.dxs51
-rw-r--r--ReferenceCode/ME/Heci/Smm/HeciSmm.inf102
-rw-r--r--ReferenceCode/ME/Heci/Smm/HeciSmm.mak64
-rw-r--r--ReferenceCode/ME/Heci/Smm/HeciSmm.sdl25
-rw-r--r--ReferenceCode/ME/Heci/Smm/Hecicore.c1585
-rw-r--r--ReferenceCode/ME/Heci/Smm/Hecicore.h512
-rw-r--r--ReferenceCode/ME/Include/IntelMeSsdtAcpiTables.dsc67
-rw-r--r--ReferenceCode/ME/Include/MeDxe.dsc41
-rw-r--r--ReferenceCode/ME/Include/MeDxeLib.dsc31
-rw-r--r--ReferenceCode/ME/Include/MeInclude.cif13
-rw-r--r--ReferenceCode/ME/Include/MeInclude.sdl9
-rw-r--r--ReferenceCode/ME/Include/MePei.dsc25
-rw-r--r--ReferenceCode/ME/Include/MePeiLib.dsc30
-rw-r--r--ReferenceCode/ME/Library/AMT/AmtLibrary.cif11
-rw-r--r--ReferenceCode/ME/Library/AMT/AmtLibrary.sdl20
-rw-r--r--ReferenceCode/ME/Library/AMT/Dxe/AmtLib.c526
-rw-r--r--ReferenceCode/ME/Library/AMT/Dxe/AmtLib.h257
-rw-r--r--ReferenceCode/ME/Library/AMT/Dxe/AmtLib.inf75
-rw-r--r--ReferenceCode/ME/Library/AMT/Dxe/AmtLibDxe.cif16
-rw-r--r--ReferenceCode/ME/Library/AMT/Dxe/AmtLibDxe.mak54
-rw-r--r--ReferenceCode/ME/Library/AMT/Dxe/AmtLibDxe.sdl36
-rw-r--r--ReferenceCode/ME/Library/AMT/Dxe/AmtPolicyDebugDumpDxe.c115
-rw-r--r--ReferenceCode/ME/Library/AMT/Dxe/AmtPolicyLib.c547
-rw-r--r--ReferenceCode/ME/Library/AMT/Dxe/AmtPolicyLib.h298
-rw-r--r--ReferenceCode/ME/Library/AMT/Dxe/MebxSetupDebugDumpDxe.c75
-rw-r--r--ReferenceCode/ME/Library/AMT/Include/Amt.h59
-rw-r--r--ReferenceCode/ME/Library/AMT/Pei/AmtLibPei.cif13
-rw-r--r--ReferenceCode/ME/Library/AMT/Pei/AmtLibPei.h26
-rw-r--r--ReferenceCode/ME/Library/AMT/Pei/AmtLibPei.inf51
-rw-r--r--ReferenceCode/ME/Library/AMT/Pei/AmtLibPei.mak50
-rw-r--r--ReferenceCode/ME/Library/AMT/Pei/AmtLibPei.sdl36
-rw-r--r--ReferenceCode/ME/Library/AMT/Pei/AmtPolicyLibPei.c241
-rw-r--r--ReferenceCode/ME/Library/AMT/Pei/AmtPolicyLibPei.h126
-rw-r--r--ReferenceCode/ME/Library/AtLibrary/AtLibrary.cif10
-rw-r--r--ReferenceCode/ME/Library/AtLibrary/AtLibrary.sdl20
-rw-r--r--ReferenceCode/ME/Library/AtLibrary/Dxe/AtAmHelper.c630
-rw-r--r--ReferenceCode/ME/Library/AtLibrary/Dxe/AtAmHelper.h119
-rw-r--r--ReferenceCode/ME/Library/AtLibrary/Dxe/AtDxeLib.cif14
-rw-r--r--ReferenceCode/ME/Library/AtLibrary/Dxe/AtDxeLib.inf69
-rw-r--r--ReferenceCode/ME/Library/AtLibrary/Dxe/AtDxeLib.mak54
-rw-r--r--ReferenceCode/ME/Library/AtLibrary/Dxe/AtDxeLib.sdl36
-rw-r--r--ReferenceCode/ME/Library/AtLibrary/Dxe/AtPolicyDebugDumpDxe.c51
-rw-r--r--ReferenceCode/ME/Library/AtLibrary/Dxe/AtPolicyLib.h39
-rw-r--r--ReferenceCode/ME/Library/MeKernel/Common/MeChipsetLib/MeChipsetLib.c112
-rw-r--r--ReferenceCode/ME/Library/MeKernel/Common/MeChipsetLib/MeChipsetLib.cif11
-rw-r--r--ReferenceCode/ME/Library/MeKernel/Common/MeChipsetLib/MeChipsetLib.inf61
-rw-r--r--ReferenceCode/ME/Library/MeKernel/Common/MeChipsetLib/MeChipsetLib.mak53
-rw-r--r--ReferenceCode/ME/Library/MeKernel/Common/MeChipsetLib/MeChipsetLib.sdl70
-rw-r--r--ReferenceCode/ME/Library/MeKernel/Dxe/HeciMsgLib.c2702
-rw-r--r--ReferenceCode/ME/Library/MeKernel/Dxe/HeciMsgLib.h782
-rw-r--r--ReferenceCode/ME/Library/MeKernel/Dxe/MbpDebugDumpDxe.c150
-rw-r--r--ReferenceCode/ME/Library/MeKernel/Dxe/MeLib.c712
-rw-r--r--ReferenceCode/ME/Library/MeKernel/Dxe/MeLib.h203
-rw-r--r--ReferenceCode/ME/Library/MeKernel/Dxe/MeLib.inf68
-rw-r--r--ReferenceCode/ME/Library/MeKernel/Dxe/MeLibDxe.cif18
-rw-r--r--ReferenceCode/ME/Library/MeKernel/Dxe/MeLibDxe.mak60
-rw-r--r--ReferenceCode/ME/Library/MeKernel/Dxe/MeLibDxe.sdl36
-rw-r--r--ReferenceCode/ME/Library/MeKernel/Dxe/MePolicyDebugDumpDxe.c72
-rw-r--r--ReferenceCode/ME/Library/MeKernel/Dxe/MePolicyLib.c182
-rw-r--r--ReferenceCode/ME/Library/MeKernel/Dxe/MePolicyLib.h95
-rw-r--r--ReferenceCode/ME/Library/MeKernel/MeKernelLibrary.cif12
-rw-r--r--ReferenceCode/ME/Library/MeKernel/MeKernelLibrary.sdl20
-rw-r--r--ReferenceCode/ME/Library/MeKernel/Pei/HeciMsgLibPei.c185
-rw-r--r--ReferenceCode/ME/Library/MeKernel/Pei/HeciMsgLibPei.h86
-rw-r--r--ReferenceCode/ME/Library/MeKernel/Pei/MeLibPei.cif15
-rw-r--r--ReferenceCode/ME/Library/MeKernel/Pei/MeLibPei.h27
-rw-r--r--ReferenceCode/ME/Library/MeKernel/Pei/MeLibPei.inf56
-rw-r--r--ReferenceCode/ME/Library/MeKernel/Pei/MeLibPei.mak53
-rw-r--r--ReferenceCode/ME/Library/MeKernel/Pei/MeLibPei.sdl36
-rw-r--r--ReferenceCode/ME/Library/MeKernel/Pei/MePolicyLibPei.c59
-rw-r--r--ReferenceCode/ME/Library/MeKernel/Pei/MePolicyLibPei.h42
-rw-r--r--ReferenceCode/ME/Library/MeKernel/include/CoreBiosMsg.h625
-rw-r--r--ReferenceCode/ME/Library/MeKernel/include/MeAccess.h338
-rw-r--r--ReferenceCode/ME/Library/MeKernel/include/MeChipset.h196
-rw-r--r--ReferenceCode/ME/Library/MeKernel/include/MeChipsetLib.h54
-rw-r--r--ReferenceCode/ME/Library/MeKernel/include/MeState.h67
-rw-r--r--ReferenceCode/ME/Library/MeKernel/include/MkhiMsgs.h533
-rw-r--r--ReferenceCode/ME/Library/MeLibrary.cif22
-rw-r--r--ReferenceCode/ME/Library/MeLibrary.sdl32
-rw-r--r--ReferenceCode/ME/Library/Ptt/Common/PttHciDeviceLib.c606
-rw-r--r--ReferenceCode/ME/Library/Ptt/Common/PttHciDeviceLib.cif8
-rw-r--r--ReferenceCode/ME/Library/Ptt/Dxe/PttHciDeviceDxeLib.cif9
-rw-r--r--ReferenceCode/ME/Library/Ptt/Dxe/PttHciDeviceDxeLib.h37
-rw-r--r--ReferenceCode/ME/Library/Ptt/Dxe/PttHciDeviceDxeLib.inf73
-rw-r--r--ReferenceCode/ME/Library/Ptt/Include/PttHciDeviceLib.h175
-rw-r--r--ReferenceCode/ME/Library/Ptt/Include/PttHciRegs.h100
-rw-r--r--ReferenceCode/ME/Library/Ptt/Include/PttLibInc.cif9
-rw-r--r--ReferenceCode/ME/Library/Ptt/Pei/PttHciDeviceLib.c590
-rw-r--r--ReferenceCode/ME/Library/Ptt/Pei/PttHciDevicePeiLib.cif12
-rw-r--r--ReferenceCode/ME/Library/Ptt/Pei/PttHciDevicePeiLib.h37
-rw-r--r--ReferenceCode/ME/Library/Ptt/Pei/PttHciDevicePeiLib.inf71
-rw-r--r--ReferenceCode/ME/Library/Ptt/Pei/PttHciDevicePeiLib.mak80
-rw-r--r--ReferenceCode/ME/Library/Ptt/Pei/PttHciDevicePeiLib.sdl36
-rw-r--r--ReferenceCode/ME/Library/Ptt/PttLibrary.cif14
-rw-r--r--ReferenceCode/ME/Library/Ptt/PttLibrary.mak101
-rw-r--r--ReferenceCode/ME/Library/Ptt/PttLibrary.sdl59
-rw-r--r--ReferenceCode/ME/Library/PttHeci/Dxe/PttHeciDxeLib.c145
-rw-r--r--ReferenceCode/ME/Library/PttHeci/Dxe/PttHeciDxeLib.cif12
-rw-r--r--ReferenceCode/ME/Library/PttHeci/Dxe/PttHeciDxeLib.h37
-rw-r--r--ReferenceCode/ME/Library/PttHeci/Dxe/PttHeciDxeLib.inf68
-rw-r--r--ReferenceCode/ME/Library/PttHeci/Dxe/PttHeciDxeLib.mak40
-rw-r--r--ReferenceCode/ME/Library/PttHeci/Dxe/PttHeciDxeLib.sdl36
-rw-r--r--ReferenceCode/ME/Library/PttHeci/Include/PttHeciLib.h73
-rw-r--r--ReferenceCode/ME/ME.cif25
-rw-r--r--ReferenceCode/ME/ME.sdl50
-rw-r--r--ReferenceCode/ME/PchMeUma/PchMeUma.c765
-rw-r--r--ReferenceCode/ME/PchMeUma/PchMeUma.cif13
-rw-r--r--ReferenceCode/ME/PchMeUma/PchMeUma.dxs50
-rw-r--r--ReferenceCode/ME/PchMeUma/PchMeUma.h178
-rw-r--r--ReferenceCode/ME/PchMeUma/PchMeUma.inf88
-rw-r--r--ReferenceCode/ME/PchMeUma/PchMeUma.mak62
-rw-r--r--ReferenceCode/ME/PchMeUma/PchMeUma.sdl41
-rw-r--r--ReferenceCode/ME/Ppi/AmtPlatformPolicyPei/AmtPlatformPolicyPei.c31
-rw-r--r--ReferenceCode/ME/Ppi/AmtPlatformPolicyPei/AmtPlatformPolicyPei.h77
-rw-r--r--ReferenceCode/ME/Ppi/AmtStatusCode/AmtStatusCode.c30
-rw-r--r--ReferenceCode/ME/Ppi/AmtStatusCode/AmtStatusCode.h120
-rw-r--r--ReferenceCode/ME/Ppi/Heci/Heci.c31
-rw-r--r--ReferenceCode/ME/Ppi/Heci/Heci.h201
-rw-r--r--ReferenceCode/ME/Ppi/MeLibPpi.cif22
-rw-r--r--ReferenceCode/ME/Ppi/MeLibPpi.inf59
-rw-r--r--ReferenceCode/ME/Ppi/MeLibPpi.mak43
-rw-r--r--ReferenceCode/ME/Ppi/MeLibPpi.sdl34
-rw-r--r--ReferenceCode/ME/Ppi/MePlatformPolicyPei/MePlatformPolicyPei.c31
-rw-r--r--ReferenceCode/ME/Ppi/MePlatformPolicyPei/MePlatformPolicyPei.h58
-rw-r--r--ReferenceCode/ME/Ppi/PchMeUma/PchMeUma.c42
-rw-r--r--ReferenceCode/ME/Ppi/PchMeUma/PchMeUma.h159
-rw-r--r--ReferenceCode/ME/Ppi/PlatformMeHook/PlatformMeHook.c42
-rw-r--r--ReferenceCode/ME/Ppi/PlatformMeHook/PlatformMeHook.h70
-rw-r--r--ReferenceCode/ME/Protocol/ActiveManagement/ActiveManagement.c46
-rw-r--r--ReferenceCode/ME/Protocol/ActiveManagement/ActiveManagement.h140
-rw-r--r--ReferenceCode/ME/Protocol/AlertStandardFormat/AlertStandardFormat.c32
-rw-r--r--ReferenceCode/ME/Protocol/AlertStandardFormat/AlertStandardFormat.h185
-rw-r--r--ReferenceCode/ME/Protocol/AmtPlatformPolicy/AmtPlatformPolicy.c44
-rw-r--r--ReferenceCode/ME/Protocol/AmtPlatformPolicy/AmtPlatformPolicy.h111
-rw-r--r--ReferenceCode/ME/Protocol/AmtReadyToBoot/AmtReadyToBoot.c31
-rw-r--r--ReferenceCode/ME/Protocol/AmtReadyToBoot/AmtReadyToBoot.h56
-rw-r--r--ReferenceCode/ME/Protocol/At/At.c39
-rw-r--r--ReferenceCode/ME/Protocol/At/At.h247
-rw-r--r--ReferenceCode/ME/Protocol/AtAm/ATAM.c40
-rw-r--r--ReferenceCode/ME/Protocol/AtAm/ATAM.h249
-rw-r--r--ReferenceCode/ME/Protocol/AtAm/AtAm.cif9
-rw-r--r--ReferenceCode/ME/Protocol/AtPlatformPolicy/AtPlatformPolicy.c43
-rw-r--r--ReferenceCode/ME/Protocol/AtPlatformPolicy/AtPlatformPolicy.h57
-rw-r--r--ReferenceCode/ME/Protocol/Heci/Heci.c31
-rw-r--r--ReferenceCode/ME/Protocol/Heci/Heci.h243
-rw-r--r--ReferenceCode/ME/Protocol/HeciSmm/HeciSmm.c40
-rw-r--r--ReferenceCode/ME/Protocol/HeciSmm/HeciSmm.h122
-rw-r--r--ReferenceCode/ME/Protocol/IderControllerDriver/IderControllerDriver.c31
-rw-r--r--ReferenceCode/ME/Protocol/IderControllerDriver/IderControllerDriver.h34
-rw-r--r--ReferenceCode/ME/Protocol/MeBiosPayloadData/MeBiosPayloadData.c43
-rw-r--r--ReferenceCode/ME/Protocol/MeBiosPayloadData/MeBiosPayloadData.h138
-rw-r--r--ReferenceCode/ME/Protocol/MeGlobalNvsArea/MeGlobalNvsArea.c31
-rw-r--r--ReferenceCode/ME/Protocol/MeGlobalNvsArea/MeGlobalNvsArea.h72
-rw-r--r--ReferenceCode/ME/Protocol/MePlatformPolicy/MePlatformPolicy.c44
-rw-r--r--ReferenceCode/ME/Protocol/MePlatformPolicy/MePlatformPolicy.h134
-rw-r--r--ReferenceCode/ME/Protocol/MeProtocolLib.cif40
-rw-r--r--ReferenceCode/ME/Protocol/MeProtocolLib.inf73
-rw-r--r--ReferenceCode/ME/Protocol/MeProtocolLib.mak43
-rw-r--r--ReferenceCode/ME/Protocol/MeProtocolLib.sdl28
-rw-r--r--ReferenceCode/ME/Protocol/MeRcInfo/MeRcInfo.c43
-rw-r--r--ReferenceCode/ME/Protocol/MeRcInfo/MeRcInfo.h88
-rw-r--r--ReferenceCode/ME/Protocol/MebxProtocol/MebxProtocol.c31
-rw-r--r--ReferenceCode/ME/Protocol/MebxProtocol/MebxProtocol.h72
-rw-r--r--ReferenceCode/ME/Protocol/PlatformMeHook/PlatformMeHook.c43
-rw-r--r--ReferenceCode/ME/Protocol/PlatformMeHook/PlatformMeHook.h64
-rw-r--r--ReferenceCode/ME/Ptt/Smm/Ftpm.asl447
-rw-r--r--ReferenceCode/ME/Ptt/Smm/PttHciSmm.c847
-rw-r--r--ReferenceCode/ME/Ptt/Smm/PttHciSmm.cif13
-rw-r--r--ReferenceCode/ME/Ptt/Smm/PttHciSmm.dxs48
-rw-r--r--ReferenceCode/ME/Ptt/Smm/PttHciSmm.h158
-rw-r--r--ReferenceCode/ME/Ptt/Smm/PttHciSmm.inf106
-rw-r--r--ReferenceCode/ME/Ptt/Smm/PttHciSmm.mak69
-rw-r--r--ReferenceCode/ME/Ptt/Smm/PttHciSmm.sdl32
-rw-r--r--ReferenceCode/ME/Ptt/Smm/PttSmm.cif9
-rw-r--r--ReferenceCode/ME/Ptt/Smm/PttSmmAcpi.cif12
-rw-r--r--ReferenceCode/ME/Ptt/Smm/PttSmmAcpi.mak44
-rw-r--r--ReferenceCode/ME/Ptt/Smm/PttSmmAcpi.sdl33
-rw-r--r--ReferenceCode/ME/Ptt/Smm/Tpm2AcpiTableStorage.h31
-rw-r--r--ReferenceCode/ME/Ptt/Smm/Tpm2AcpiTables.inf38
-rw-r--r--ReferenceCode/ME/SampleCode/AsfSupport/AsfSupport.c1517
-rw-r--r--ReferenceCode/ME/SampleCode/AsfSupport/AsfSupport.h162
-rw-r--r--ReferenceCode/ME/SampleCode/Include/Acpi1_0.h297
-rw-r--r--ReferenceCode/ME/SampleCode/Include/Acpi2_0.h533
-rw-r--r--ReferenceCode/ME/SampleCode/Include/Acpi3_0.h682
-rw-r--r--ReferenceCode/ME/SampleCode/Include/AlertStandardFormatTable.h119
-rw-r--r--ReferenceCode/ME/SampleCode/Include/AslUpdateLib.h167
-rw-r--r--ReferenceCode/ME/SampleCode/Include/Guid/MemoryOverwriteControl/MemoryOverwriteControl.h81
-rw-r--r--ReferenceCode/ME/SampleCode/Include/Guid/TrEEPhysicalPresenceData/TrEEPhysicalPresenceData.h62
-rw-r--r--ReferenceCode/ME/SampleCode/Include/IndustryStandard/AcpiAml.h180
-rw-r--r--ReferenceCode/ME/SampleCode/Include/IndustryStandard/Tpm20.h1872
-rw-r--r--ReferenceCode/ME/SampleCode/Include/IndustryStandard/Tpm20Implementation.h259
-rw-r--r--ReferenceCode/ME/SampleCode/Include/IndustryStandard/Tpm2Acpi.h53
-rw-r--r--ReferenceCode/ME/SampleCode/Include/IndustryStandard/Tpm2DeviceLib.h112
-rw-r--r--ReferenceCode/ME/SampleCode/Include/MeDxeLibSampleCode.dsc26
-rw-r--r--ReferenceCode/ME/SampleCode/Library/AslUpdate/Dxe/AslUpdateLib.inf66
-rw-r--r--ReferenceCode/ME/SampleCode/Library/AslUpdate/Dxe/DxeAslUpdateLib.c333
-rw-r--r--ReferenceCode/ME/SampleCode/Library/AslUpdate/Dxe/MeAslUpdateLib.cif11
-rw-r--r--ReferenceCode/ME/SampleCode/Library/AslUpdate/Dxe/MeAslUpdateLib.mak32
-rw-r--r--ReferenceCode/ME/SampleCode/Library/AslUpdate/Dxe/MeAslUpdateLib.sdl29
-rw-r--r--ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.c122
-rw-r--r--ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.cif13
-rw-r--r--ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.dxs39
-rw-r--r--ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.h59
-rw-r--r--ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.inf82
-rw-r--r--ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.mak142
-rw-r--r--ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.sdl25
-rw-r--r--ReferenceCode/ME/SampleCode/MeSampleCode.cif28
-rw-r--r--ReferenceCode/ME/SampleCode/PlatformReset/RuntimeDxe/PlatformReset.c168
-rw-r--r--ReferenceCode/ME/SampleCode/PlatformReset/RuntimeDxe/PlatformReset.cif12
-rw-r--r--ReferenceCode/ME/SampleCode/PlatformReset/RuntimeDxe/PlatformReset.dxs41
-rw-r--r--ReferenceCode/ME/SampleCode/PlatformReset/RuntimeDxe/PlatformReset.h29
-rw-r--r--ReferenceCode/ME/SampleCode/PlatformReset/RuntimeDxe/PlatformReset.mak67
-rw-r--r--ReferenceCode/ME/SampleCode/PlatformReset/RuntimeDxe/PlatformReset.sdl26
-rw-r--r--ReferenceCode/ME/SampleCode/Protocol/MePlatformGetResetType/MePlatformGetResetType.c42
-rw-r--r--ReferenceCode/ME/SampleCode/Protocol/MePlatformGetResetType/MePlatformGetResetType.h57
-rw-r--r--ReferenceCode/ME/SampleCode/Protocol/MePlatformGetResetType/MePlatformGetResetTypeProtocolLib.cif11
-rw-r--r--ReferenceCode/ME/SampleCode/Protocol/MePlatformGetResetType/MePlatformGetResetTypeProtocolLib.mak67
-rw-r--r--ReferenceCode/ME/SampleCode/Protocol/MePlatformGetResetType/MePlatformGetResetTypeProtocolLib.sdl34
-rw-r--r--ReferenceCode/ME/SampleCode/Protocol/SmmVariable/SmmVariable.h52
-rw-r--r--ReferenceCode/Pfat/PfatBinary/PfatBinary.binbin0 -> 32644 bytes
-rw-r--r--ReferenceCode/Pfat/PfatBinary/PfatBinary.cif10
-rw-r--r--ReferenceCode/Pfat/PfatBinary/PfatBinary.mak76
-rw-r--r--ReferenceCode/Pfat/PfatBinary/PfatBinary.sdl32
-rw-r--r--ReferenceCode/Pfat/PfatFlashLib/PfatFlashLib.c710
-rw-r--r--ReferenceCode/Pfat/PfatFlashLib/PfatFlashLib.cif12
-rw-r--r--ReferenceCode/Pfat/PfatFlashLib/PfatFlashLib.mak86
-rw-r--r--ReferenceCode/Pfat/PfatFlashLib/PfatFlashLib.sdl95
-rw-r--r--ReferenceCode/Pfat/Smm/Pfat.chmbin0 -> 54097 bytes
-rw-r--r--ReferenceCode/Pfat/Smm/PfatServices.c759
-rw-r--r--ReferenceCode/Pfat/Smm/PfatServices.cif22
-rw-r--r--ReferenceCode/Pfat/Smm/PfatServices.dxs60
-rw-r--r--ReferenceCode/Pfat/Smm/PfatServices.h207
-rw-r--r--ReferenceCode/Pfat/Smm/PfatServices.inf115
-rw-r--r--ReferenceCode/Pfat/Smm/PfatServices.mak127
-rw-r--r--ReferenceCode/Pfat/Smm/PfatServices.sdl37
-rw-r--r--ReferenceCode/RapidStart/AcpiTables/RapidStartAcpiTables.cif11
-rw-r--r--ReferenceCode/RapidStart/AcpiTables/RapidStartAcpiTables.inf66
-rw-r--r--ReferenceCode/RapidStart/AcpiTables/RapidStartAcpiTables.mak105
-rw-r--r--ReferenceCode/RapidStart/AcpiTables/RapidStartAcpiTables.sdl91
-rw-r--r--ReferenceCode/RapidStart/AcpiTables/Ssdt/RapidStart.asl80
-rw-r--r--ReferenceCode/RapidStart/Dxe/RapidStartDxe.c935
-rw-r--r--ReferenceCode/RapidStart/Dxe/RapidStartDxe.cif12
-rw-r--r--ReferenceCode/RapidStart/Dxe/RapidStartDxe.dxs56
-rw-r--r--ReferenceCode/RapidStart/Dxe/RapidStartDxe.inf102
-rw-r--r--ReferenceCode/RapidStart/Dxe/RapidStartDxe.mak130
-rw-r--r--ReferenceCode/RapidStart/Dxe/RapidStartDxe.sdl68
-rw-r--r--ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Dxe/DxeFfsGfxDriver.cif11
-rw-r--r--ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Dxe/DxeFfsGfxDriver.efibin0 -> 2880 bytes
-rw-r--r--ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Dxe/DxeFfsGfxDriver.inf36
-rw-r--r--ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Dxe/DxeFfsGfxDriver.mak72
-rw-r--r--ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Dxe/DxeFfsGfxDriver.sdl85
-rw-r--r--ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Pei/PeiGfxDriver.cif12
-rw-r--r--ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Pei/PeiGfxDriver.dxs32
-rw-r--r--ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Pei/PeiGfxDriver.efibin0 -> 32256 bytes
-rw-r--r--ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Pei/PeiGfxDriver.inf40
-rw-r--r--ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Pei/PeiGfxDriver.mak79
-rw-r--r--ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Pei/PeiGfxDriver.sdl84
-rw-r--r--ReferenceCode/RapidStart/GfxDisplay/Library/Dxe/GfxDisplayLibDxe.c141
-rw-r--r--ReferenceCode/RapidStart/GfxDisplay/Library/Dxe/GfxDisplayLibDxe.cif12
-rw-r--r--ReferenceCode/RapidStart/GfxDisplay/Library/Dxe/GfxDisplayLibDxe.h29
-rw-r--r--ReferenceCode/RapidStart/GfxDisplay/Library/Dxe/GfxDisplayLibDxe.inf58
-rw-r--r--ReferenceCode/RapidStart/GfxDisplay/Library/Dxe/GfxDisplayLibDxe.mak76
-rw-r--r--ReferenceCode/RapidStart/GfxDisplay/Library/Dxe/GfxDisplayLibDxe.sdl77
-rw-r--r--ReferenceCode/RapidStart/GfxDisplay/Library/Pei/GfxDisplayLibPei.c55
-rw-r--r--ReferenceCode/RapidStart/GfxDisplay/Library/Pei/GfxDisplayLibPei.cif12
-rw-r--r--ReferenceCode/RapidStart/GfxDisplay/Library/Pei/GfxDisplayLibPei.h35
-rw-r--r--ReferenceCode/RapidStart/GfxDisplay/Library/Pei/GfxDisplayLibPei.inf51
-rw-r--r--ReferenceCode/RapidStart/GfxDisplay/Library/Pei/GfxDisplayLibPei.mak75
-rw-r--r--ReferenceCode/RapidStart/GfxDisplay/Library/Pei/GfxDisplayLibPei.sdl77
-rw-r--r--ReferenceCode/RapidStart/Guid/RapidStartAcpiTableStorage/RapidStartAcpiTableStorage.c40
-rw-r--r--ReferenceCode/RapidStart/Guid/RapidStartAcpiTableStorage/RapidStartAcpiTableStorage.h31
-rw-r--r--ReferenceCode/RapidStart/Guid/RapidStartGuidLib.cif16
-rw-r--r--ReferenceCode/RapidStart/Guid/RapidStartGuidLib.inf60
-rw-r--r--ReferenceCode/RapidStart/Guid/RapidStartGuidLib.mak82
-rw-r--r--ReferenceCode/RapidStart/Guid/RapidStartGuidLib.sdl68
-rw-r--r--ReferenceCode/RapidStart/Guid/RapidStartPersistentData/RapidStartPersistentData.c27
-rw-r--r--ReferenceCode/RapidStart/Guid/RapidStartPersistentData/RapidStartPersistentData.h41
-rw-r--r--ReferenceCode/RapidStart/Guid/RapidStartTransition/RapidStartTransition.c40
-rw-r--r--ReferenceCode/RapidStart/Guid/RapidStartTransition/RapidStartTransition.h31
-rw-r--r--ReferenceCode/RapidStart/Include/RapidStartAcpi.dsc69
-rw-r--r--ReferenceCode/RapidStart/Include/RapidStartAhciReg.h163
-rw-r--r--ReferenceCode/RapidStart/Include/RapidStartConfig.h70
-rw-r--r--ReferenceCode/RapidStart/Include/RapidStartData.h144
-rw-r--r--ReferenceCode/RapidStart/Include/RapidStartDxe.dsc26
-rw-r--r--ReferenceCode/RapidStart/Include/RapidStartDxeLib.dsc24
-rw-r--r--ReferenceCode/RapidStart/Include/RapidStartInclude.cif16
-rw-r--r--ReferenceCode/RapidStart/Include/RapidStartInclude.sdl68
-rw-r--r--ReferenceCode/RapidStart/Include/RapidStartPei.dsc25
-rw-r--r--ReferenceCode/RapidStart/Include/RapidStartPeiLib.dsc24
-rw-r--r--ReferenceCode/RapidStart/Pei/RapidStartAhci.c1211
-rw-r--r--ReferenceCode/RapidStart/Pei/RapidStartAhci.h344
-rw-r--r--ReferenceCode/RapidStart/Pei/RapidStartPei.c2379
-rw-r--r--ReferenceCode/RapidStart/Pei/RapidStartPei.cif14
-rw-r--r--ReferenceCode/RapidStart/Pei/RapidStartPei.dxs41
-rw-r--r--ReferenceCode/RapidStart/Pei/RapidStartPei.inf119
-rw-r--r--ReferenceCode/RapidStart/Pei/RapidStartPei.mak151
-rw-r--r--ReferenceCode/RapidStart/Pei/RapidStartPei.sdl68
-rw-r--r--ReferenceCode/RapidStart/Ppi/PeiGfxPpi/PeiGfxPpi.c33
-rw-r--r--ReferenceCode/RapidStart/Ppi/PeiGfxPpi/PeiGfxPpi.h89
-rw-r--r--ReferenceCode/RapidStart/Ppi/RapidStart/RapidStart.c35
-rw-r--r--ReferenceCode/RapidStart/Ppi/RapidStart/RapidStart.h190
-rw-r--r--ReferenceCode/RapidStart/Ppi/RapidStartPpiLib.cif14
-rw-r--r--ReferenceCode/RapidStart/Ppi/RapidStartPpiLib.inf51
-rw-r--r--ReferenceCode/RapidStart/Ppi/RapidStartPpiLib.mak60
-rw-r--r--ReferenceCode/RapidStart/Ppi/RapidStartPpiLib.sdl72
-rw-r--r--ReferenceCode/RapidStart/Protocol/DxeGfxProtocol/DxeGfxProtocol.c30
-rw-r--r--ReferenceCode/RapidStart/Protocol/DxeGfxProtocol/DxeGfxProtocol.h63
-rw-r--r--ReferenceCode/RapidStart/Protocol/RapidStartGlobalNvsArea/RapidStartGlobalNvsArea.c31
-rw-r--r--ReferenceCode/RapidStart/Protocol/RapidStartGlobalNvsArea/RapidStartGlobalNvsArea.h100
-rw-r--r--ReferenceCode/RapidStart/Protocol/RapidStartInfo/RapidStartInfo.c40
-rw-r--r--ReferenceCode/RapidStart/Protocol/RapidStartInfo/RapidStartInfo.h93
-rw-r--r--ReferenceCode/RapidStart/Protocol/RapidStartPlatformPolicy/RapidStartPlatformPolicy.c46
-rw-r--r--ReferenceCode/RapidStart/Protocol/RapidStartPlatformPolicy/RapidStartPlatformPolicy.h162
-rw-r--r--ReferenceCode/RapidStart/Protocol/RapidStartProtocolLib.cif18
-rw-r--r--ReferenceCode/RapidStart/Protocol/RapidStartProtocolLib.inf61
-rw-r--r--ReferenceCode/RapidStart/Protocol/RapidStartProtocolLib.mak58
-rw-r--r--ReferenceCode/RapidStart/Protocol/RapidStartProtocolLib.sdl71
-rw-r--r--ReferenceCode/RapidStart/RapidStart.cif23
-rw-r--r--ReferenceCode/RapidStart/RapidStart.sdl237
-rw-r--r--ReferenceCode/RapidStart/ReleaseNotes.chmbin0 -> 87046 bytes
-rw-r--r--ReferenceCode/RapidStart/Smm/RapidStartSmm.c836
-rw-r--r--ReferenceCode/RapidStart/Smm/RapidStartSmm.cif14
-rw-r--r--ReferenceCode/RapidStart/Smm/RapidStartSmm.dxs47
-rw-r--r--ReferenceCode/RapidStart/Smm/RapidStartSmm.h47
-rw-r--r--ReferenceCode/RapidStart/Smm/RapidStartSmm.inf104
-rw-r--r--ReferenceCode/RapidStart/Smm/RapidStartSmm.mak130
-rw-r--r--ReferenceCode/RapidStart/Smm/RapidStartSmm.sdl97
-rw-r--r--ReferenceCode/RapidStart/Smm/x64/RapidStartAsm.asm56
1742 files changed, 445573 insertions, 0 deletions
diff --git a/ReferenceCode/AcpiTables/AcpiFvi/AcpiFvi.c b/ReferenceCode/AcpiTables/AcpiFvi/AcpiFvi.c
new file mode 100644
index 0000000..94d2a90
--- /dev/null
+++ b/ReferenceCode/AcpiTables/AcpiFvi/AcpiFvi.c
@@ -0,0 +1,67 @@
+/** @file
+ ACPI RC FVI DXE driver
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+///
+/// External include files do NOT need to be explicitly specified in real EDKII
+/// environment
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "AcpiFvi.h"
+#endif /// EDK_RELEASE_VERSION
+
+FVI_ELEMENT_AND_FUNCTION mAcpiFviElementsData[] = {
+ {
+ DEFAULT_FVI_ELEMENT_DATA (ACPI),
+ NULL
+ }
+};
+
+FVI_DATA_HUB_CALLBACK_CONTEXT mAcpiFviVersionData = {
+ MISC_SUBCLASS_FVI_HEADER_ENTRY (ACPI),
+ mAcpiFviElementsData,
+};
+
+UINTN mAcpiFviElements = sizeof (mAcpiFviElementsData) / sizeof (FVI_ELEMENT_AND_FUNCTION);
+
+EFI_STATUS
+AcpiFviEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+/**
+@brief
+ The entry-point of ACPI RC FVI DXE driver
+
+ @param[in] ImageHandle - Standard entry point parameter.
+ @param[in] SystemTable - Standard entry point parameter.
+
+ @retval EFI_STATUS
+**/
+{
+
+ InitFviDataHubCbContext (
+ ACPI_FVI_SMBIOS_TYPE,
+ (UINT8) mAcpiFviElements,
+ &mAcpiFviVersionData
+ );
+
+ CreateRcFviDatahub (&mAcpiFviVersionData);
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/AcpiTables/AcpiFvi/AcpiFvi.cif b/ReferenceCode/AcpiTables/AcpiFvi/AcpiFvi.cif
new file mode 100644
index 0000000..54efa3d
--- /dev/null
+++ b/ReferenceCode/AcpiTables/AcpiFvi/AcpiFvi.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "AcpiFvi"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\AcpiTables\AcpiFvi\"
+ RefName = "AcpiFvi"
+[files]
+"AcpiFvi.sdl"
+"AcpiFvi.mak"
+"AcpiFvi.c"
+"AcpiFvi.dxs"
+"AcpiFvi.h"
+"AcpiFvi.inf"
+<endComponent>
diff --git a/ReferenceCode/AcpiTables/AcpiFvi/AcpiFvi.dxs b/ReferenceCode/AcpiTables/AcpiFvi/AcpiFvi.dxs
new file mode 100644
index 0000000..3b352ff
--- /dev/null
+++ b/ReferenceCode/AcpiTables/AcpiFvi/AcpiFvi.dxs
@@ -0,0 +1,41 @@
+/** @file
+ Dependency expression source file.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "DxeDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+#include EFI_PROTOCOL_DEFINITION (DataHub)
+#endif
+
+DEPENDENCY_START
+ EFI_DATA_HUB_PROTOCOL_GUID
+DEPENDENCY_END
+
diff --git a/ReferenceCode/AcpiTables/AcpiFvi/AcpiFvi.h b/ReferenceCode/AcpiTables/AcpiFvi/AcpiFvi.h
new file mode 100644
index 0000000..09e38e6
--- /dev/null
+++ b/ReferenceCode/AcpiTables/AcpiFvi/AcpiFvi.h
@@ -0,0 +1,28 @@
+/** @file
+ Definitions for ACPI RC FVI DXE driver
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _ACPI_RC_FVI_H_
+#define _ACPI_RC_FVI_H_
+#include "EdkIIGlueDxe.h"
+#include "RcFviDxeLib.h"
+#include EFI_PROTOCOL_PRODUCER (AcpiInfo)
+
+#define ACPI_FVI_STRING "Reference Code - ACPI"
+#define ACPI_FVI_SMBIOS_TYPE 0xDD ///< Default value
+#define ACPI_FVI_SMBIOS_INSTANCE 0x01
+#endif
diff --git a/ReferenceCode/AcpiTables/AcpiFvi/AcpiFvi.inf b/ReferenceCode/AcpiTables/AcpiFvi/AcpiFvi.inf
new file mode 100644
index 0000000..21873da
--- /dev/null
+++ b/ReferenceCode/AcpiTables/AcpiFvi/AcpiFvi.inf
@@ -0,0 +1,80 @@
+## @file
+# Component description file for ACPI RC FVI DXE driver
+#
+#@copyright
+# Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = AcpiFvi
+FILE_GUID = D7E31ECB-0A17-4529-9B84-C529DE8E1C0E
+COMPONENT_TYPE = BS_DRIVER
+
+[sources.common]
+ AcpiFvi.c
+ AcpiFvi.h
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueDxeDriverEntryPoint.c
+
+[includes.common]
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+ $(EFI_SOURCE)/$(PROJECT_ACPI_ROOT)
+
+[libraries.common]
+ EfiProtocolLib
+ EdkProtocolLib
+ EdkFrameworkProtocolLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueDxeReportStatusCodeLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueUefiLib
+ EdkIIGlueBasePciLibPciExpress
+ EdkIIGlueBasePciExpressLib
+ EdkIIGlueDxeServicesTableLib
+ RcFviDxeLib
+ AcpiProtocolLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT=_ModuleEntryPoint
+ DPX_SOURCE=AcpiFvi.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=AcpiFviEntryPoint
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_LIB__ \
+ -D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__
diff --git a/ReferenceCode/AcpiTables/AcpiFvi/AcpiFvi.mak b/ReferenceCode/AcpiTables/AcpiFvi/AcpiFvi.mak
new file mode 100644
index 0000000..ce67b84
--- /dev/null
+++ b/ReferenceCode/AcpiTables/AcpiFvi/AcpiFvi.mak
@@ -0,0 +1,56 @@
+#---------------------------------------------------------------------------
+# Create AcpiFvi Driver
+#---------------------------------------------------------------------------
+EDK : AcpiFvi
+
+AcpiFvi: $(BUILD_DIR)\AcpiFvi.mak AcpiFviBin
+
+$(BUILD_DIR)\AcpiFvi.mak : $(AcpiFvi_DIR)\$(@B).cif $(AcpiFvi_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(AcpiFvi_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+
+AcpiFvi_DEFINES =$(MY_DEFINES)\
+ /D "__EDKII_GLUE_MODULE_ENTRY_POINT__=AcpiFviEntryPoint" \
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__\
+ /D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_UEFI_LIB__\
+ /D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+
+
+AcpiFvi_LIB_LINKS =\
+ $(EFIPROTOCOLLIB)\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueUefiRuntimeServicesTableLib_LIB)\
+ $(EdkIIGlueDxeServicesTableLib_LIB)\
+ $(EdkIIGlueUefiLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(EdkIIGlueBasePciExpressLib_LIB)\
+ $(RcFviDxeLib_LIB)\
+ $(EDKPROTOCOLLIB)\
+ $(AcpiProtocolLib_LIB)\
+
+AcpiFvi_INCLUDES=\
+ /I ReferenceCode\AcpiTables\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+
+AcpiFviBin: $(AcpiFvi_LIB_LINKS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\AcpiFvi.mak all \
+ "MY_INCLUDES=$(AcpiFvi_INCLUDES)"\
+ "MY_DEFINES=$(AcpiFvi_DEFINES)"\
+ GUID=D7E31ECB-0A17-4529-9B84-C529DE8E1C0E\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=BS_DRIVER\
+ EDKIIModule=DXEDRIVER\
+ DEPEX1=$(AcpiFvi_DIR)\AcpiFvi.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX\
+ COMPRESS=1
diff --git a/ReferenceCode/AcpiTables/AcpiFvi/AcpiFvi.sdl b/ReferenceCode/AcpiTables/AcpiFvi/AcpiFvi.sdl
new file mode 100644
index 0000000..2fd8ad0
--- /dev/null
+++ b/ReferenceCode/AcpiTables/AcpiFvi/AcpiFvi.sdl
@@ -0,0 +1,24 @@
+TOKEN
+ Name = "AcpiFvi_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable AcpiFvi support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "AcpiFvi_DIR"
+End
+
+MODULE
+ File = "AcpiFvi.mak"
+ Help = "Includes AcpiFvi.mak to Project"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\AcpiFvi.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End \ No newline at end of file
diff --git a/ReferenceCode/AcpiTables/Cppc/AcpiTables/Cpc.asl b/ReferenceCode/AcpiTables/Cppc/AcpiTables/Cpc.asl
new file mode 100644
index 0000000..2099515
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Cppc/AcpiTables/Cpc.asl
@@ -0,0 +1,298 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ Cpc.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for ACPI 5.0 Collaborative Processor Performance Control (CPPC)
+
+--*/
+
+DefinitionBlock (
+ "Cpc.aml",
+ "SSDT",
+ 1,
+ "Cpc_Tabl",
+ "Cpc_Tabl",
+ 0x1000 )
+{
+
+External(\_PR.CPU0, ProcessorObj)
+External(\_PR.CPU1, ProcessorObj)
+External(\_PR.CPU2, ProcessorObj)
+External(\_PR.CPU3, ProcessorObj)
+External(\_PR.CPU4, ProcessorObj)
+External(\_PR.CPU5, ProcessorObj)
+External(\_PR.CPU6, ProcessorObj)
+External(\_PR.CPU7, ProcessorObj)
+
+// _CPC (Continuous Performance Control)
+// _CPC is a per-processor ACPI object that declares an interface for OSPM to
+// transition the processor into a performance state based on a continuous range
+// of allowable values. Each CPPC register is described in a Generic Register
+// Descriptor format and maps to an unique PCC shared memory
+// location. For a complete description of _CPC object, refer to ACPI 5.0
+// specification, section 8.4.5.1.
+// Arguments: (0)
+// None
+// Return Value:
+// A Package of elements in the following format
+//
+// Package
+// {
+// NumEntries, // Integer
+// Revision, // Integer
+// HighestPerformance, // Generic Register Descriptor
+// NominalPerformance, // Generic Register Descriptor
+// LowestNonlinearPerformance, // Generic Register Descriptor
+// LowestPerformance, // Generic Register Descriptor
+// GuaranteedPerformanceRegister, // Generic Register Descriptor
+// DesiredPerformanceRegister, // Generic Register Descriptor
+// MinimumPerformanceRegister, // Generic Register Descriptor
+// MaximumPerformanceRegister, // Generic Register Descriptor
+// PerformanceReductionToleranceRegister,// Generic Register Descriptor
+// TimeWindowRegister, // Generic Register Descriptor
+// CounterWraparoundTime, // Generic Register Descriptor
+// NominalCounterRegister, // Generic Register Descriptor
+// DeliveredCounterRegister, // Generic Register Descriptor
+// PerformanceLimitedRegister, // Generic Register Descriptor
+// EnableRegister // Generic Register Descriptor
+// }
+
+Scope(\_PR.CPU0)
+{
+ Name(_CPC, Package()
+ {
+ 17, // Number of entries
+ 1, // Revision
+ //
+ // Describe processor capabilities
+ //
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0000, 0)}, // HighestPerformance
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0004, 0)}, // NominalPerformance
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0008, 0)}, // LowestNonlinearPerformance
+ ResourceTemplate() {Register(PCC, 32, 0, 0x000C, 0)}, // LowestPerformance
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0010, 0)}, // GuaranteedPerformanceRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0014, 0)}, // DesiredPerformanceRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0018, 0)}, // MinimumPerformanceRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x001C, 0)}, // MaximumPerformanceRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0020, 0)}, // PerformanceReductionToleranceRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0024, 0)}, // TimeWindowRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0028, 0)}, // CounterWraparoundTime
+ ResourceTemplate() {Register(FFixedHW, 64, 0, 0xE7, 4)}, // NominalCounterRegister
+ ResourceTemplate() {Register(FFixedHW, 64, 0, 0xE8, 4)}, // DeliveredCounterRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x003C, 0)}, // PerformanceLimitedRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0040, 0)} // EnableRegister
+ })
+}// end Scope(\_PR.CPU0)
+
+Scope(\_PR.CPU1)
+{
+ Name(_CPC, Package()
+ {
+ 17, // Number of entries
+ 1, // Revision
+ //
+ // Describe processor capabilities
+ //
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0064, 0)}, // HighestPerformance
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0068, 0)}, // NominalPerformance
+ ResourceTemplate() {Register(PCC, 32, 0, 0x006C, 0)}, // LowestNonlinearPerformance
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0070, 0)}, // LowestPerformance
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0074, 0)}, // GuaranteedPerformanceRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0078, 0)}, // DesiredPerformanceRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x007C, 0)}, // MinimumPerformanceRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0080, 0)}, // MaximumPerformanceRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0084, 0)}, // PerformanceReductionToleranceRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0088, 0)}, // TimeWindowRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x008C, 0)}, // CounterWraparoundTime
+ ResourceTemplate() {Register(FFixedHW, 64, 0, 0xE7, 4)}, // NominalCounterRegister
+ ResourceTemplate() {Register(FFixedHW, 64, 0, 0xE8, 4)}, // DeliveredCounterRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x00A0, 0)}, // PerformanceLimitedRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x00A4, 0)} // EnableRegister
+ })
+}// end Scope(\_PR.CPU1)
+
+Scope(\_PR.CPU2)
+{
+ Name(_CPC, Package()
+ {
+ 17, // Number of entries
+ 1, // Revision
+ //
+ // Describe processor capabilities
+ //
+ ResourceTemplate() {Register(PCC, 32, 0, 0x00C8, 0)}, // HighestPerformance
+ ResourceTemplate() {Register(PCC, 32, 0, 0x00CC, 0)}, // NominalPerformance
+ ResourceTemplate() {Register(PCC, 32, 0, 0x00D0, 0)}, // LowestNonlinearPerformance
+ ResourceTemplate() {Register(PCC, 32, 0, 0x00D4, 0)}, // LowestPerformance
+ ResourceTemplate() {Register(PCC, 32, 0, 0x00D8, 0)}, // GuaranteedPerformanceRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x00DC, 0)}, // DesiredPerformanceRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x00E0, 0)}, // MinimumPerformanceRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x00E4, 0)}, // MaximumPerformanceRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x00E8, 0)}, // PerformanceReductionToleranceRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x00EC, 0)}, // TimeWindowRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x00F0, 0)}, // CounterWraparoundTime
+ ResourceTemplate() {Register(FFixedHW, 64, 0, 0xE7, 4)}, // NominalCounterRegister
+ ResourceTemplate() {Register(FFixedHW, 64, 0, 0xE8, 4)}, // DeliveredCounterRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0104, 0)}, // PerformanceLimitedRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0108, 0)} // EnableRegister
+ })
+}// end Scope(\_PR.CPU2)
+
+Scope(\_PR.CPU3)
+{
+ Name(_CPC, Package()
+ {
+ 17, // Number of entries
+ 1, // Revision
+ //
+ // Describe processor capabilities
+ //
+ ResourceTemplate() {Register(PCC, 32, 0, 0x012C, 0)}, // HighestPerformance
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0130, 0)}, // NominalPerformance
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0134, 0)}, // LowestNonlinearPerformance
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0138, 0)}, // LowestPerformance
+ ResourceTemplate() {Register(PCC, 32, 0, 0x013C, 0)}, // GuaranteedPerformanceRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0140, 0)}, // DesiredPerformanceRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0144, 0)}, // MinimumPerformanceRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0148, 0)}, // MaximumPerformanceRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x014C, 0)}, // PerformanceReductionToleranceRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0150, 0)}, // TimeWindowRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0154, 0)}, // CounterWraparoundTime
+ ResourceTemplate() {Register(FFixedHW, 64, 0, 0xE7, 4)}, // NominalCounterRegister
+ ResourceTemplate() {Register(FFixedHW, 64, 0, 0xE8, 4)}, // DeliveredCounterRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0168, 0)}, // PerformanceLimitedRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x016C, 0)} // EnableRegister
+ })
+}// end Scope(\_PR.CPU3)
+
+Scope(\_PR.CPU4)
+{
+ Name(_CPC, Package()
+ {
+ 17, // Number of entries
+ 1, // Revision
+ //
+ // Describe processor capabilities
+ //
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0190, 0)}, // HighestPerformance
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0194, 0)}, // NominalPerformance
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0198, 0)}, // LowestNonlinearPerformance
+ ResourceTemplate() {Register(PCC, 32, 0, 0x019C, 0)}, // LowestPerformance
+ ResourceTemplate() {Register(PCC, 32, 0, 0x01A0, 0)}, // GuaranteedPerformanceRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x01A4, 0)}, // DesiredPerformanceRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x01A8, 0)}, // MinimumPerformanceRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x01AC, 0)}, // MaximumPerformanceRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x01B0, 0)}, // PerformanceReductionToleranceRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x01B4, 0)}, // TimeWindowRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x01B8, 0)}, // CounterWraparoundTime
+ ResourceTemplate() {Register(FFixedHW, 64, 0, 0xE7, 4)}, // NominalCounterRegister
+ ResourceTemplate() {Register(FFixedHW, 64, 0, 0xE8, 4)}, // DeliveredCounterRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x01CC, 0)}, // PerformanceLimitedRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x01D0, 0)} // EnableRegister
+ })
+}// end Scope(\_PR.CPU4)
+
+Scope(\_PR.CPU5)
+{
+ Name(_CPC, Package()
+ {
+ 17, // Number of entries
+ 1, // Revision
+ //
+ // Describe processor capabilities
+ //
+ ResourceTemplate() {Register(PCC, 32, 0, 0x01F4, 0)}, // HighestPerformance
+ ResourceTemplate() {Register(PCC, 32, 0, 0x01F8, 0)}, // NominalPerformance
+ ResourceTemplate() {Register(PCC, 32, 0, 0x01FC, 0)}, // LowestNonlinearPerformance
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0200, 0)}, // LowestPerformance
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0204, 0)}, // GuaranteedPerformanceRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0208, 0)}, // DesiredPerformanceRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x020C, 0)}, // MinimumPerformanceRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0210, 0)}, // MaximumPerformanceRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0214, 0)}, // PerformanceReductionToleranceRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0218, 0)}, // TimeWindowRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x021C, 0)}, // CounterWraparoundTime
+ ResourceTemplate() {Register(FFixedHW, 64, 0, 0xE7, 4)}, // NominalCounterRegister
+ ResourceTemplate() {Register(FFixedHW, 64, 0, 0xE8, 4)}, // DeliveredCounterRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0230, 0)}, // PerformanceLimitedRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0234, 0)} // EnableRegister
+ })
+}// end Scope(\_PR.CPU5)
+
+Scope(\_PR.CPU6)
+{
+ Name(_CPC, Package()
+ {
+ 17, // Number of entries
+ 1, // Revision
+ //
+ // Describe processor capabilities
+ //
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0258, 0)}, // HighestPerformance
+ ResourceTemplate() {Register(PCC, 32, 0, 0x025C, 0)}, // NominalPerformance
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0260, 0)}, // LowestNonlinearPerformance
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0264, 0)}, // LowestPerformance
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0268, 0)}, // GuaranteedPerformanceRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x026C, 0)}, // DesiredPerformanceRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0270, 0)}, // MinimumPerformanceRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0274, 0)}, // MaximumPerformanceRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0278, 0)}, // PerformanceReductionToleranceRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x027C, 0)}, // TimeWindowRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0280, 0)}, // CounterWraparoundTime
+ ResourceTemplate() {Register(FFixedHW, 64, 0, 0xE7, 4)}, // NominalCounterRegister
+ ResourceTemplate() {Register(FFixedHW, 64, 0, 0xE8, 4)}, // DeliveredCounterRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0294, 0)}, // PerformanceLimitedRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x0298, 0)} // EnableRegister
+ })
+}// end Scope(\_PR.CPU6)
+
+Scope(\_PR.CPU7)
+{
+ Name(_CPC, Package()
+ {
+ 17, // Number of entries
+ 1, // Revision
+ //
+ // Describe processor capabilities
+ //
+ ResourceTemplate() {Register(PCC, 32, 0, 0x02BC, 0)}, // HighestPerformance
+ ResourceTemplate() {Register(PCC, 32, 0, 0x02C0, 0)}, // NominalPerformance
+ ResourceTemplate() {Register(PCC, 32, 0, 0x02C4, 0)}, // LowestNonlinearPerformance
+ ResourceTemplate() {Register(PCC, 32, 0, 0x02C8, 0)}, // LowestPerformance
+ ResourceTemplate() {Register(PCC, 32, 0, 0x02CC, 0)}, // GuaranteedPerformanceRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x02D0, 0)}, // DesiredPerformanceRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x02D4, 0)}, // MinimumPerformanceRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x02D8, 0)}, // MaximumPerformanceRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x02DC, 0)}, // PerformanceReductionToleranceRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x02E0, 0)}, // TimeWindowRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x02E4, 0)}, // CounterWraparoundTime
+ ResourceTemplate() {Register(FFixedHW, 64, 0, 0xE7, 4)}, // NominalCounterRegister
+ ResourceTemplate() {Register(FFixedHW, 64, 0, 0xE8, 4)}, // DeliveredCounterRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x02F8, 0)}, // PerformanceLimitedRegister
+ ResourceTemplate() {Register(PCC, 32, 0, 0x02FC, 0)} // EnableRegister
+ })
+}// end Scope(\_PR.CPU7)
+
+}// end of definition block
diff --git a/ReferenceCode/AcpiTables/Cppc/AcpiTables/Cppc.asl b/ReferenceCode/AcpiTables/Cppc/AcpiTables/Cppc.asl
new file mode 100644
index 0000000..ce2bc49
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Cppc/AcpiTables/Cppc.asl
@@ -0,0 +1,319 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ Cppc.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for ACPI 5.0 Collaborative Processor Performance Control (CPPC)
+
+--*/
+
+#include "PowerMgmtDefinitions.h"
+
+DefinitionBlock (
+ "Cppc.aml",
+ "SSDT",
+ 1,
+ "CppcTabl",
+ "CppcTabl",
+ 0x1000 )
+{
+
+External(TCNT, IntObj)
+External(OSYS, IntObj)
+External(\PDC0, IntObj)
+External(\_PR.CPU0, ProcessorObj)
+External(\_PR.CPU0._PSS, MethodObj)
+External(\_PR.CPU0._PPC, IntObj)
+External(\_PR.CPU0._CPC, MethodObj)
+External(\_PR.CPU0._TSS, MethodObj)
+External(\_PR.CPU1, ProcessorObj)
+External(\_PR.CPU2, ProcessorObj)
+External(\_PR.CPU3, ProcessorObj)
+External(\_PR.CPU4, ProcessorObj)
+External(\_PR.CPU5, ProcessorObj)
+External(\_PR.CPU6, ProcessorObj)
+External(\_PR.CPU7, ProcessorObj)
+
+Scope(\_SB)
+{
+// Define PCCD device so that we can load CPPC driver against this
+// device. This driver will process PCC commands from OSPM in
+// PCC Shared memory region.
+Device(PCCD)
+{
+
+//
+// These objects are patched during POST.
+//
+Name(PCCA, 0x80000000) // Address of PCC shared memory buffer, fixed up during POST
+Name(PCCS, 0x80000000) // PCCA buffer size
+Name(PENB, 0x80000000) // REQUIRED object. CPCC Enable/Disable. 1 = Enable, 0 = Disable. Also used by _OSC evaluation of CPPC support.
+
+Name(_HID, EISAID("INT340F"))
+Name(_STR, Unicode ("Collaborative Processor Performance Control (CPPC)"))
+
+ // _STA (Status)
+ //
+ // This object returns the current status of a device.
+ // Checks if Win8 or later is present.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing a device status bitmap:
+ // Bit 0 - Set if the device is present.
+ // Bit 1 - Set if the device is enabled and decoding its resources.
+ // Bit 2 - Set if the device should be shown in the UI.
+ // Bit 3 - Set if the device is functioning properly (cleared if device failed its diagnostics).
+ // Bit 4 - Set if the battery is present.
+ // Bits 5-31 - Reserved (must be cleared).
+ //
+ Method(_STA)
+ {
+ If(LGreaterEqual(OSYS,2012)){
+ Return(0x0F)
+ } Else {
+ Return(0x00)
+ }
+ }
+
+ Name (TMPP, Package (){0x80000000,0x80000000})
+
+ // PADR (Pcc shared memory ADRess)
+ //
+ // This ACPI object evaluates to a package, containing the PCC Shared Memory 32-bit address and its size in bytes.
+ // This object will be evaluated by the Intel CPPC driver during its initialization. This object is REQUIRED.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // A package of 2 Integer (DWORD) elements: PCC Shared Memory Address and PCC Shared Memory Length.
+ //
+ Method(PADR)
+ {
+ Store(PCCA,Index (TMPP, 0))
+ Store(PCCS,Index (TMPP, 1))
+ Return(TMPP)
+ }
+
+ // GPRN (Guaranteed Performance Register Notification)
+ //
+ // The purpose of this object is to notify OSPM on changes to CPPC Guaranteed Performance register. This object is REQUIRED.
+ // This object is evaluated by the CPPC driver dynamically whenever the CPPC driver changes the CPPC Guaranteed Performance register value.
+ // Upon evaluation, GPRN control method issues an ACPI notification on each processor device with notify code = 0x83 and
+ // OSPM processes the ACPI notification.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // None
+ //
+ Method(GPRN,0,Serialized)
+ {
+ Switch(ToInteger(TCNT)){
+ Case(8){
+ Notify(\_PR.CPU0, 0x83)
+ Notify(\_PR.CPU1, 0x83)
+ Notify(\_PR.CPU2, 0x83)
+ Notify(\_PR.CPU3, 0x83)
+ Notify(\_PR.CPU4, 0x83)
+ Notify(\_PR.CPU5, 0x83)
+ Notify(\_PR.CPU6, 0x83)
+ Notify(\_PR.CPU7, 0x83)
+ }
+ Case(4){
+ Notify(\_PR.CPU0, 0x83)
+ Notify(\_PR.CPU1, 0x83)
+ Notify(\_PR.CPU2, 0x83)
+ Notify(\_PR.CPU3, 0x83)
+ }
+ Case(2){
+ Notify(\_PR.CPU0, 0x83)
+ Notify(\_PR.CPU1, 0x83)
+ }
+ Default{
+ Notify(\_PR.CPU0, 0x83)
+ }
+ }
+ }
+
+ // PCFG (Platform Configuration)
+ //
+ // The purpose of this object is for platform to enable or disable EE P-States selection of frequency below P1.
+ // This method is REQUIRED if platform issues ACPI notification code 0x81 on CPPC device.
+ // This object is evaluated by the CPPC driver once during boot (to get boot-time selection) and dynamically
+ // whenever platform issues an ACPI notification (notify code = 0x81) to change optimization selection.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing CPPC optimization enables bitmap:
+ // Bit Value Description
+ // [0] 0 CPPC driver determines (based on OS power plan settings) when to enable EE P-States selection of frequency below P1.
+ // [0] 1 Disable EE P-States selection of frequency below P1.
+ // [31:1] 0 Reserved for future use
+ //
+ Name(PCFG,0)
+
+ // _PTC (Processor Throttling Control)
+ //
+ // _PTC defines the processor throttling control interface.
+ //
+ // PDC0[2] = ACPI object indicating if OSPM is capable of direct access to On Demand throttling MSR
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // A Package as described below
+ //
+ // Return Value Information
+ // Package {
+ // ControlRegister // Buffer (Resource Descriptor)
+ // StatusRegister // Buffer (Resource Descriptor)
+ // }
+ //
+ Method(_PTC,,,,PkgObj)
+ {
+ If(LAnd(CondRefOf(\PDC0),LNotEqual(\PDC0,0x80000000))) // is object present and initialized?
+ {
+ If(And(\PDC0, 0x0004)) { // does OS support MSR interface?
+ Return(Package() {
+ ResourceTemplate(){Register(FFixedHW, 0, 0, 0)},
+ ResourceTemplate(){Register(FFixedHW, 0, 0, 0)} }) // if OS supports MSR interface
+ } Else {
+ Return(Package() {
+ ResourceTemplate(){Register(SystemIO, 5, 0, PCH_ACPI_PBLK)},
+ ResourceTemplate(){Register(SystemIO, 5, 0, PCH_ACPI_PBLK)} }) // if OS support IO based interface
+ }
+ } Else {
+ Return(Package() {
+ ResourceTemplate(){Register(FFixedHW, 0, 0, 0)},
+ ResourceTemplate(){Register(FFixedHW, 0, 0, 0)} }) // if object is not present or not initialized then return MSR interface
+ }
+ }
+
+ // _PSS (Performance Supported States)
+ //
+ // This optional object indicates to OSPM the number of supported processor performance states that any given system can support.
+ //
+ // Arguments: (1)
+ // None
+ // Return Value:
+ // A variable-length Package containing a list of Pstate sub-packages as described below
+ //
+ // Return Value Information
+ // Package {
+ // PState [0] // Package - Performance state 0
+ // ....
+ // PState [n] // Package - Performance state n
+ // }
+ //
+ // Each Pstate sub-Package contains the elements described below:
+ // Package {
+ // CoreFrequency // Integer (DWORD)
+ // Power // Integer (DWORD)
+ // Latency // Integer (DWORD)
+ // BusMasterLatency // Integer (DWORD)
+ // Control // Integer (DWORD)
+ // Status // Integer (DWORD)
+ // }
+ //
+ // Stub for the Actual CPU _PSS method.
+ //
+ Method(_PSS,,,,PkgObj)
+ {
+ If(CondRefOf(\_PR.CPU0._PSS))
+ { // Ensure _PSS is present
+ Return(\_PR.CPU0._PSS())
+ } Else {
+ Return(Package(){
+ Package(){0,0,0,0,0,0},
+ Package(){0,0,0,0,0,0}})
+ }
+ }
+
+ // _PPC (Performance Present Capabilities)
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the range of states supported
+ // 0 - States 0 through nth state are available (all states available)
+ // 1 - States 1 through nth state are available
+ // 2 - States 2 through nth state are available
+ // ...
+ // n - State n is available only
+ //
+ Method(_PPC)
+ {
+ If(CondRefOf(\_PR.CPU0._PPC))
+ { // Ensure _PPC is present
+ Return(\_PR.CPU0._PPC)
+ } Else {
+ Return(0)
+ }
+ }
+
+ // _TSS (Throttling Supported States)
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // A variable-length Package containing a list of Tstate sub-packages as described below
+ //
+ // Return Value Information
+ // Package {
+ // TState [0] // Package - Throttling state 0
+ // ....
+ // TState [n] // Package - Throttling state n
+ // }
+ //
+ // Each Tstate sub-Package contains the elements described below:
+ // Package {
+ // Percent // Integer (DWORD)
+ // Power // Integer (DWORD)
+ // Latency // Integer (DWORD)
+ // Control // Integer (DWORD)
+ // Status // Integer (DWORD)
+ // }
+ //
+ // Stub for the Actual CPU _TSS method.
+ //
+ Method(_TSS,,,,PkgObj)
+ {
+ If(CondRefOf(\_PR.CPU0._TSS))
+ { // Ensure _TSS is present
+ Return(\_PR.CPU0._TSS())
+ } Else {
+ Return(Package(){
+ Package(){0,0,0,0,0},
+ Package(){0,0,0,0,0}})
+ }
+ }
+
+
+} // End Device(PCCD)
+} // End Scope(_SB)
+
+}
diff --git a/ReferenceCode/AcpiTables/Cppc/AcpiTables/CppcAcpiTables.cif b/ReferenceCode/AcpiTables/Cppc/AcpiTables/CppcAcpiTables.cif
new file mode 100644
index 0000000..54ee1aa
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Cppc/AcpiTables/CppcAcpiTables.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "CppcAcpiTables"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\AcpiTables\Cppc\AcpiTables\"
+ RefName = "CppcAcpiTables"
+[files]
+"CppcAcpiTables.sdl"
+"CppcAcpiTables.mak"
+"Cppc.asl"
+"CppcAcpiTables.inf"
+"Pcct.asl"
+"Cpc.asl"
+<endComponent>
diff --git a/ReferenceCode/AcpiTables/Cppc/AcpiTables/CppcAcpiTables.inf b/ReferenceCode/AcpiTables/Cppc/AcpiTables/CppcAcpiTables.inf
new file mode 100644
index 0000000..f0333c7
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Cppc/AcpiTables/CppcAcpiTables.inf
@@ -0,0 +1,69 @@
+## @file
+# Component description file for the ACPI tables
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains an 'Intel Peripheral Driver' and uniquely
+# identified as "Intel Reference Module" and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+
+
+[defines]
+BASE_NAME = CppcAcpiTables
+#
+# If the value of this GUID is changed then make sure to change the corresponding GUID (CPPC_ACPI_TABLE_STORAGE_GUID)
+# in CppcAcpiTableStorage.h.
+#
+FILE_GUID = 60E31DE1-03EC-492a-9598-65A3C50E0F6B
+COMPONENT_TYPE = ACPITABLE
+FFS_EXT = .ffs
+
+[sources.common]
+ Cppc.ASL
+ Pcct.ASL
+ Cpc.ASL
+
+[libraries.common]
+
+[includes.common]
+ .
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Include
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include
+
+#
+# Edk II Glue Library, some header are not included by R9 header so have to include
+#
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Framework
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include/Library
+
+[nmake.common]
diff --git a/ReferenceCode/AcpiTables/Cppc/AcpiTables/CppcAcpiTables.mak b/ReferenceCode/AcpiTables/Cppc/AcpiTables/CppcAcpiTables.mak
new file mode 100644
index 0000000..53c14cc
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Cppc/AcpiTables/CppcAcpiTables.mak
@@ -0,0 +1,92 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2012, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#**********************************************************************
+#<AMI_FHDR_START>
+#
+# Name: CppcAcpiTables.mak
+#
+# Description: MAke file to build Intel CPPC ACPI ASL components
+#
+#<AMI_FHDR_END>
+#**********************************************************************
+#-----------------------------------------------------------------------
+# ASL compiler definition
+#-----------------------------------------------------------------------
+!IF "$(ACPIPLATFORM_ASL_COMPILER)"==""
+!ERROR It is an invalid path, please check your ASL compiler path.
+!ENDIF
+
+IASL = $(ACPIPLATFORM_ASL_COMPILER)
+#-----------------------------------------------------------------------
+EDK : CPPCACPI
+
+ALLCPPCSEC = $(BUILD_DIR)\Cpc.sec\
+ $(BUILD_DIR)\Cppc.sec\
+ $(BUILD_DIR)\Pcct.sec
+
+CPPCACPI : $(BUILD_DIR)\CppcAcpiTables.ffs
+
+$(BUILD_DIR)\Cpc.aml : $(INTEL_CPC_ASL_FILE)
+ @cl /C /EP $(INTEL_CPC_ASL_FILE) > $(BUILD_DIR)\Cpc.asl
+ $(IASL) -p $(BUILD_DIR)\Cpc.aml $(BUILD_DIR)\Cpc.asl
+
+$(BUILD_DIR)\Cppc.aml : $(INTEL_CPPC_ASL_FILE)
+ @cl /C /EP $(PROJECT_CPU_INCLUDES) $(INTEL_CPPC_ASL_FILE) > $(BUILD_DIR)\Cppc.asl
+ $(IASL) -p $(BUILD_DIR)\Cppc.aml $(BUILD_DIR)\Cppc.asl
+
+$(BUILD_DIR)\Pcct.aml : $(INTEL_PCCT_ASL_FILE)
+ @cl /C /EP $(INTEL_PCCT_ASL_FILE) > $(BUILD_DIR)\Pcct.asl
+ $(IASL) -p $(BUILD_DIR)\Pcct.aml $(BUILD_DIR)\Pcct.asl
+
+$(BUILD_DIR)\Cpc.sec: $(BUILD_DIR)\Cpc.aml
+ $(GENSECTION) -I $** -O $@ -S EFI_SECTION_RAW
+
+$(BUILD_DIR)\Cppc.sec: $(BUILD_DIR)\Cppc.aml
+ $(GENSECTION) -I $** -O $@ -S EFI_SECTION_RAW
+
+$(BUILD_DIR)\Pcct.sec: $(BUILD_DIR)\Pcct.aml
+ $(GENSECTION) -I $** -O $@ -S EFI_SECTION_RAW
+
+$(BUILD_DIR)\CppcAcpiTables.ffs: $(ALLCPPCSEC) $(INTEL_CPPC_ACPI_TABLE_DIR)\CppcAcpiTables.mak
+ $(GENFFSFILE) -B $(BUILD_DIR) -V -o $@ -P1 <<$(BUILD_DIR)\CppcAcpiTables.pkg
+PACKAGE.INF
+[.]
+BASE_NAME = CppcAcpiTables
+FFS_FILEGUID = 60E31DE1-03EC-492a-9598-65A3C50E0F6B
+FFS_FILETYPE = EFI_FV_FILETYPE_FREEFORM
+FFS_ATTRIB_CHECKSUM = TRUE
+
+IMAGE_SCRIPT =
+{
+ Compress (dummy) {
+ $(PROJECT_DIR)\$(BUILD_DIR)\Cpc.sec
+ $(PROJECT_DIR)\$(BUILD_DIR)\Cppc.sec
+ $(PROJECT_DIR)\$(BUILD_DIR)\Pcct.sec
+ }
+}
+<<KEEP
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2012, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/AcpiTables/Cppc/AcpiTables/CppcAcpiTables.sdl b/ReferenceCode/AcpiTables/Cppc/AcpiTables/CppcAcpiTables.sdl
new file mode 100644
index 0000000..a67daec
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Cppc/AcpiTables/CppcAcpiTables.sdl
@@ -0,0 +1,53 @@
+TOKEN
+ Name = "CppcAcpiTables_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable CppcAcpiTables support in Project"
+End
+
+MODULE
+ Help = "Includes CppcAcpiTables.mak to Project"
+ File = "CppcAcpiTables.mak"
+End
+
+PATH
+ Name = "INTEL_CPPC_ACPI_TABLE_DIR"
+End
+
+TOKEN
+ Name = "INTEL_CPC_ASL_FILE"
+ Value = "$(INTEL_CPPC_ACPI_TABLE_DIR)\Cpc.asl"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+TOKEN
+ Name = "INTEL_CPPC_ASL_FILE"
+ Value = "$(INTEL_CPPC_ACPI_TABLE_DIR)\Cppc.asl"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+TOKEN
+ Name = "INTEL_PCCT_ASL_FILE"
+ Value = "$(INTEL_CPPC_ACPI_TABLE_DIR)\Pcct.asl"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+TOKEN
+ Name = "CPPC_ASL_COMPILER"
+ Value = "$(INTEL_CPPC_DIR)\iasl.exe"
+ Help = "ASL Optimizing Compiler version 20120711-32 [Jul 11 2012]"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\CppcAcpiTables.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End \ No newline at end of file
diff --git a/ReferenceCode/AcpiTables/Cppc/AcpiTables/Pcct.asl b/ReferenceCode/AcpiTables/Cppc/AcpiTables/Pcct.asl
new file mode 100644
index 0000000..d7ea368
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Cppc/AcpiTables/Pcct.asl
@@ -0,0 +1,54 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ Pcct.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for ACPI 5.0 Platform Communications Channel Table (PCCT)
+
+--*/
+
+DefinitionBlock (
+ "Pcct.aml",
+ "PCCT",
+ 5,
+ "PcctTa",
+ "PcctTabl",
+ 0x1000 )
+{
+
+/// The 12 byte EFI_ACPI_5_0_PLATFORM_COMMUNICATION_CHANNEL_TABLE_HEADER structure is patched during POST.
+/// The 62 byte EFI_ACPI_5_0_PCCT_SUBSPACE_GENERIC structure is patched during POST.
+/// Allocate a buffer of 64 bytes plus the size of the 10 byte Name structure for a total of 74 bytes.
+///
+Name(PCCT,Buffer() {
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 10
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 20
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 30
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 40
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 50
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 60
+0x00, 0x00, 0x00, 0x00 // 64
+})
+
+}// end DefinitionBlock
diff --git a/ReferenceCode/AcpiTables/Cppc/Cppc.cif b/ReferenceCode/AcpiTables/Cppc/Cppc.cif
new file mode 100644
index 0000000..846f7ed
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Cppc/Cppc.cif
@@ -0,0 +1,14 @@
+<component>
+ name = "Intel CPPC"
+ category = eModule
+ LocalRoot = "ReferenceCode\AcpiTables\Cppc\"
+ RefName = "Intel CPPC"
+[files]
+"Cppc.sdl"
+"ReleaseNotes.chm"
+"iasl.exe"
+[parts]
+"CppcDxe"
+"CppcAcpiTables"
+"CppcGuidLib"
+<endComponent>
diff --git a/ReferenceCode/AcpiTables/Cppc/Cppc.sdl b/ReferenceCode/AcpiTables/Cppc/Cppc.sdl
new file mode 100644
index 0000000..f9413eb
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Cppc/Cppc.sdl
@@ -0,0 +1,26 @@
+TOKEN
+ Name = "CPPC_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+ Help = "Main switch to enable CPPC supppory in Project"
+End
+
+PATH
+ Name = "INTEL_CPPC_DIR"
+ Help = "Intel DPTF source directory"
+End
+
+ELINK
+ Name = "CPPC_INCLUDES"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "/I$(INTEL_CPPC_DIR)"
+ Parent = "CPPC_INCLUDES"
+ InvokeOrder = AfterParent
+End \ No newline at end of file
diff --git a/ReferenceCode/AcpiTables/Cppc/Dxe/Cppc.c b/ReferenceCode/AcpiTables/Cppc/Dxe/Cppc.c
new file mode 100644
index 0000000..9da9b1a
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Cppc/Dxe/Cppc.c
@@ -0,0 +1,863 @@
+/** @file
+ This DXE driver configures and supports Collaborative Processor Performance Control (CPPC).
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "Cppc.h"
+
+ACPI_PLATFORM_POLICY_PROTOCOL *mAcpiPlatformPolicyProtocol;
+
+extern EFI_RUNTIME_SERVICES *gRT;
+extern EFI_BOOT_SERVICES *gBS;
+
+EFI_PHYSICAL_ADDRESS mCppcBaseAddressMem = 0;
+
+///
+/// Driver entry point
+///
+EFI_DRIVER_ENTRY_POINT (InitializeCppc)
+
+EFI_STATUS
+InitializeCppc (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+/**
+@brief
+ Cppc DXE support.
+
+ @param[in] ImageHandle - Pointer to the loaded image protocol for this driver
+ @param[in] SystemTable - Pointer to the EFI System Table
+
+ @retval EFI_SUCCESS - The driver installed/initialized correctly.
+**/
+{
+ EFI_STATUS Status;
+ VOID *MemoryPointer;
+ UINT64 MsrValue;
+
+ gRT = SystemTable->RuntimeServices;
+ gBS = SystemTable->BootServices;
+
+ ///
+ /// Initialize the EFI Runtime Library
+ ///
+ DxeInitializeDriverLib (ImageHandle, SystemTable);
+
+ ///
+ /// S3 boot script
+ ///
+ INITIALIZE_SCRIPT (ImageHandle, SystemTable);
+
+ ///
+ /// Locate platform configuration information and copy it to a global variable.
+ ///
+ Status = gBS->LocateProtocol (
+ &gAcpiPlatformPolicyProtocolGuid,
+ NULL,
+ (VOID **) &mAcpiPlatformPolicyProtocol
+ );
+ if (EFI_ERROR(Status)) {
+ DEBUG ((EFI_D_ERROR, "CPPC: No Platform Policy Protocol available.\n"));
+ ASSERT_EFI_ERROR(Status);
+ return Status;
+ } else {
+ DEBUG ((EFI_D_ERROR, "CPPC: Platform Policy Protocol is loaded.\n"));
+ }
+
+ ///
+ /// Enable or disable CPPC depending on platform policy.
+ ///
+ if (mAcpiPlatformPolicyProtocol->EnableCppc == 0) {
+ DEBUG ((EFI_D_ERROR, "CPPC is disabled by platform policy. \n"));
+ return EFI_SUCCESS;
+ }
+
+ ///
+ /// Check if Haswell traditional, Haswell ULT or Crystal Well CPU.
+ ///
+ if(!(IsCpuSupported())){
+ DEBUG ((EFI_D_ERROR, "CPPC not supported in this CPU. \n"));
+ return EFI_SUCCESS;
+ }
+
+ ///
+ /// Check if Mobile CPU.
+ ///
+ if(!(IS_SA_DEVICE_ID_MOBILE (McD0PciCfg16 (R_SA_MC_DEVICE_ID)))) {
+ DEBUG ((EFI_D_ERROR, "CPPC not supported in this CPU. (not mobile) \n"));
+ return EFI_SUCCESS;
+ }
+
+ ///
+ /// Check if processor supports EE Policy capability.
+ ///
+ MsrValue = EfiReadMsr (EFI_MSR_POWER_CTL);
+ if (((UINT32)MsrValue & BIT18) != BIT18) {
+ DEBUG ((EFI_D_ERROR, "CPPC not supported in this CPU. (no Energy Efficient Policy capability) \n"));
+ return EFI_SUCCESS;
+ }
+
+ gST = SystemTable;
+ gDS = NULL;
+ Status = EfiGetSystemConfigurationTable (&gEfiDxeServicesTableGuid, (VOID**) &gDS);
+
+ ///
+ /// Allocate 4kb of runtime memory.
+ ///
+ Status = (gBS->AllocatePool) (EfiACPIMemoryNVS, CPPC_SIZE, &MemoryPointer);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "CPPC: No Memory Buffer available.\n"));
+ ASSERT_EFI_ERROR(Status);
+ return Status;
+ } else {
+ mCppcBaseAddressMem = (EFI_PHYSICAL_ADDRESS) MemoryPointer;
+ ZeroMem ((VOID *)(UINTN)mCppcBaseAddressMem, CPPC_SIZE);
+ DEBUG((EFI_D_ERROR, "CPPC: PCCA memory buffer address: %x\n", mCppcBaseAddressMem));
+ }
+
+ ///
+ /// Add the Platform Communications Channel Table signature.
+ ///
+ CopyMem ((VOID *)(UINTN)mCppcBaseAddressMem, "PCC" , 3);
+
+ ///
+ /// Load the SSDT Table for the CPPC ACPI objects.
+ ///
+ LoadAcpiTables ();
+
+ ///
+ /// Load the ACPI 5.0 PCC Table.
+ ///
+ LoadAcpiTablesPcct ();
+
+ ///
+ /// Load the ACPI 5.0 _CPC objects.
+ ///
+ LoadAcpiTablesCpc ();
+
+ return EFI_SUCCESS;
+}
+
+VOID
+LoadAcpiTables(
+ VOID
+ )
+/**
+@brief
+ This procedure loads the CPPC SSDT table.
+
+ @param[in] None
+
+ @retval None
+
+**/
+{
+ EFI_STATUS Status;
+ EFI_HANDLE *HandleBuffer;
+ UINTN NumberOfHandles;
+ UINTN Index;
+ EFI_FIRMWARE_VOLUME_PROTOCOL *FwVol;
+ EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
+ INTN Instance;
+ EFI_ACPI_COMMON_HEADER *Table;
+ UINTN Size;
+ EFI_FV_FILETYPE FileType;
+ EFI_FV_FILE_ATTRIBUTES Attributes;
+ UINT32 FvStatus;
+ EFI_ACPI_DESCRIPTION_HEADER *TableHeader;
+ UINTN TableHandle;
+ EFI_ACPI_TABLE_VERSION Version;
+ BOOLEAN LoadTable;
+ NAME_LAYOUT *NamePtr;
+ UINT8 *CurrPtr;
+ UINT32 *Signature;
+ UINT8 UpdateCounter;
+
+ FwVol = NULL;
+ Table = NULL;
+
+ ///
+ /// Locate FV protocol.
+ ///
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiFirmwareVolumeProtocolGuid,
+ NULL,
+ &NumberOfHandles,
+ &HandleBuffer
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Look for FV with ACPI storage file
+ ///
+ for (Index = 0; Index < NumberOfHandles; Index++) {
+
+ ///
+ /// Get the protocol on this handle
+ /// This should not fail because of LocateHandleBuffer
+ ///
+ Status = gBS->HandleProtocol (
+ HandleBuffer[Index],
+ &gEfiFirmwareVolumeProtocolGuid,
+ (VOID **) &FwVol
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ if ((Status == EFI_SUCCESS) && (FwVol != NULL)) {
+ ///
+ /// See if it has the ACPI storage file
+ ///
+ Size = 0;
+ FvStatus = 0;
+ Status = FwVol->ReadFile (
+ FwVol,
+ &gCppcAcpiTableStorageGuid,
+ NULL,
+ &Size,
+ &FileType,
+ &Attributes,
+ &FvStatus
+ );
+
+ ///
+ /// If we found it, then we are done
+ ///
+ if (Status == EFI_SUCCESS) {
+ break;
+ }
+ }
+ }
+
+ ///
+ /// Our exit status is determined by the success of the previous operations
+ /// If the protocol was found, Instance already points to it.
+ ///
+ /// Free any allocated buffers
+ ///
+ FreePool (HandleBuffer);
+
+ ///
+ /// Sanity check that we found our data file
+ ///
+ ASSERT (FwVol);
+ if (FwVol == NULL) {
+ return;
+ }
+
+ ///
+ /// By default, a table belongs in all ACPI table versions published.
+ ///
+ Version = EFI_ACPI_TABLE_VERSION_1_0B | EFI_ACPI_TABLE_VERSION_2_0 | EFI_ACPI_TABLE_VERSION_3_0;
+
+ ///
+ /// Find the Table protocol
+ ///
+ Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **) &AcpiTable);
+
+ ///
+ /// Read tables from the storage file.
+ ///
+ Instance = 0;
+
+ while (Status == EFI_SUCCESS) {
+ ///
+ /// Read the ACPI tables
+ ///
+ Status = FwVol->ReadSection (
+ FwVol,
+ &gCppcAcpiTableStorageGuid,
+ EFI_SECTION_RAW,
+ Instance,
+ (VOID **) &Table,
+ &Size,
+ &FvStatus
+ );
+
+ if (!EFI_ERROR (Status)) {
+
+ LoadTable = FALSE;
+ TableHeader = (EFI_ACPI_DESCRIPTION_HEADER *) Table;
+
+ switch (((EFI_ACPI_DESCRIPTION_HEADER*) TableHeader)->OemTableId) {
+
+ case EFI_SIGNATURE_64 ('C', 'p', 'p', 'c', 'T', 'a', 'b', 'l'):
+ ///
+ /// This is Cppc SSDT. Cppc should be enabled if we reach here so load the table.
+ ///
+ LoadTable = TRUE;
+ DEBUG ((EFI_D_ERROR, "CPPC: Found Cppc SSDT signature.\n"));
+
+ UpdateCounter = 3; // Number of objects to initialize.
+ for (CurrPtr = (UINT8 *) TableHeader; ((CurrPtr <= ((UINT8 *) TableHeader + TableHeader->Length))) && UpdateCounter !=0; CurrPtr++) {
+ Signature = (UINT32 *) (CurrPtr + 1);
+ ///
+ /// Patch PCCA with the address of the CPPC shared memory buffer.
+ ///
+ if ((*CurrPtr == AML_NAME_OP) && (*Signature == EFI_SIGNATURE_32 ('P', 'C', 'C', 'A'))) {
+ NamePtr = (NAME_LAYOUT *) CurrPtr;
+ if (mCppcBaseAddressMem != 0){
+ NamePtr->Value = (UINT32) mCppcBaseAddressMem;
+ }
+ UpdateCounter--;
+ DEBUG((EFI_D_ERROR, "CPPC: PCCA pointer updated in SSDT: %x\n", mCppcBaseAddressMem));
+ }
+ ///
+ /// Patch PCCS with the size of the CPPC shared memory buffer.
+ ///
+ if ((*CurrPtr == AML_NAME_OP) && (*Signature == EFI_SIGNATURE_32 ('P', 'C', 'C', 'S'))) {
+ NamePtr = (NAME_LAYOUT *) CurrPtr;
+ NamePtr->Value = (UINT32) CPPC_SIZE;
+ UpdateCounter--;
+ DEBUG((EFI_D_ERROR, "CPPC: PCCS length updated in SSDT: %x\n", CPPC_SIZE));
+ }
+ ///
+ /// Patch PENB with the CPPC Enable/Disable Flag.
+ ///
+ if ((*CurrPtr == AML_NAME_OP) && (*Signature == EFI_SIGNATURE_32 ('P', 'E', 'N', 'B'))) {
+ NamePtr = (NAME_LAYOUT *) CurrPtr;
+ NamePtr->Value = (UINT32) mAcpiPlatformPolicyProtocol->EnableCppc;
+ UpdateCounter--;
+ DEBUG((EFI_D_ERROR, "CPPC: PENB updated in SSDT: %x\n", (UINT32) mAcpiPlatformPolicyProtocol->EnableCppc));
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ ///
+ /// Add the table
+ ///
+ if (LoadTable) {
+ TableHandle = 0;
+ Status = AcpiTable->InstallAcpiTable (
+ AcpiTable,
+ Table,
+ Table->Length,
+ &TableHandle
+ );
+ }
+
+ ///
+ /// Increment the instance
+ ///
+ Instance++;
+ Table = NULL;
+ }
+ }
+}
+
+VOID
+LoadAcpiTablesPcct(
+ VOID
+ )
+/**
+@brief
+ This procedure loads the ACPI 5.0 PCCT table.
+
+ @param[in] None
+
+ @retval None
+
+**/
+{
+ EFI_STATUS Status;
+ EFI_HANDLE *HandleBuffer;
+ UINTN NumberOfHandles;
+ UINTN Index;
+ EFI_FIRMWARE_VOLUME_PROTOCOL *FwVol;
+ EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
+ INTN Instance;
+ EFI_ACPI_COMMON_HEADER *Table;
+ UINTN Size;
+ EFI_FV_FILETYPE FileType;
+ EFI_FV_FILE_ATTRIBUTES Attributes;
+ UINT32 FvStatus;
+ EFI_ACPI_DESCRIPTION_HEADER *TableHeader;
+ UINTN TableHandle;
+ EFI_ACPI_TABLE_VERSION Version;
+ BOOLEAN LoadTable;
+ EFI_ACPI_5_0_PLATFORM_COMMUNICATION_CHANNEL_TABLE_HEADER *PcctHeaderPtr;
+ EFI_ACPI_5_0_PCCT_SUBSPACE_GENERIC *PcctPtr;
+ UINT8 *CurrPtr;
+ UINT32 *Signature;
+ UINT8 UpdateCounter;
+
+ FwVol = NULL;
+ Table = NULL;
+
+ ///
+ /// Locate FV protocol.
+ ///
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiFirmwareVolumeProtocolGuid,
+ NULL,
+ &NumberOfHandles,
+ &HandleBuffer
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Look for FV with ACPI storage file
+ ///
+ for (Index = 0; Index < NumberOfHandles; Index++) {
+
+ ///
+ /// Get the protocol on this handle
+ /// This should not fail because of LocateHandleBuffer
+ ///
+ Status = gBS->HandleProtocol (
+ HandleBuffer[Index],
+ &gEfiFirmwareVolumeProtocolGuid,
+ (VOID **) &FwVol
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ if ((Status == EFI_SUCCESS) && (FwVol != NULL)) {
+ ///
+ /// See if it has the ACPI storage file
+ ///
+ Size = 0;
+ FvStatus = 0;
+ Status = FwVol->ReadFile (
+ FwVol,
+ &gCppcAcpiTableStorageGuid,
+ NULL,
+ &Size,
+ &FileType,
+ &Attributes,
+ &FvStatus
+ );
+
+ ///
+ /// If we found it, then we are done
+ ///
+ if (Status == EFI_SUCCESS) {
+ break;
+ }
+ }
+ }
+
+ ///
+ /// Our exit status is determined by the success of the previous operations
+ /// If the protocol was found, Instance already points to it.
+ ///
+ /// Free any allocated buffers
+ ///
+ FreePool (HandleBuffer);
+
+ ///
+ /// Sanity check that we found our data file
+ ///
+ ASSERT (FwVol);
+ if (FwVol == NULL) {
+ return;
+ }
+
+ ///
+ /// By default, a table belongs in all ACPI table versions published.
+ ///
+ Version = EFI_ACPI_TABLE_VERSION_1_0B | EFI_ACPI_TABLE_VERSION_2_0 | EFI_ACPI_TABLE_VERSION_3_0;
+
+ ///
+ /// Find the Table protocol
+ ///
+ Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **) &AcpiTable);
+
+ ///
+ /// Read tables from the storage file.
+ ///
+ Instance = 0;
+
+ while (Status == EFI_SUCCESS) {
+ ///
+ /// Read the ACPI tables
+ ///
+ Status = FwVol->ReadSection (
+ FwVol,
+ &gCppcAcpiTableStorageGuid,
+ EFI_SECTION_RAW,
+ Instance,
+ (VOID **) &Table,
+ &Size,
+ &FvStatus
+ );
+
+ if (!EFI_ERROR (Status)) {
+
+ LoadTable = FALSE;
+ TableHeader = (EFI_ACPI_DESCRIPTION_HEADER *) Table;
+
+ switch (((EFI_ACPI_DESCRIPTION_HEADER*) TableHeader)->OemTableId) {
+
+ case EFI_SIGNATURE_64 ('P', 'c', 'c', 't', 'T', 'a', 'b', 'l'):
+ ///
+ /// This is PCCT. Cppc should be enabled if we reach here so load the table.
+ ///
+ LoadTable = TRUE;
+ DEBUG ((EFI_D_ERROR, "PCCT: Found PCCT signature.\n"));
+
+ UpdateCounter = 1; /// Number of objects to initialize.
+ for (CurrPtr = (UINT8 *) TableHeader; ((CurrPtr <= ((UINT8 *) TableHeader + TableHeader->Length))) && UpdateCounter !=0; CurrPtr++) {
+ Signature = (UINT32 *) (CurrPtr + 1);
+ ///
+ /// Patch the EFI_ACPI_5_0_PCCT_SUBSPACE_GENERIC structure.
+ ///
+ if ((*CurrPtr == AML_NAME_OP) && (*Signature == EFI_SIGNATURE_32 ('P', 'C', 'C', 'T'))) {
+ CurrPtr -= sizeof (EFI_ACPI_DESCRIPTION_HEADER); // backup the current pointer in order to use the PCCT header structure
+ PcctHeaderPtr = (EFI_ACPI_5_0_PLATFORM_COMMUNICATION_CHANNEL_TABLE_HEADER *) CurrPtr;
+ PcctHeaderPtr->Flags = (UINT32) mAcpiPlatformPolicyProtocol->EnableCppcPlatformSCI;
+ PcctHeaderPtr->Reserved = 0;
+
+ CurrPtr += sizeof (EFI_ACPI_5_0_PLATFORM_COMMUNICATION_CHANNEL_TABLE_HEADER);
+ PcctPtr = (EFI_ACPI_5_0_PCCT_SUBSPACE_GENERIC *) CurrPtr;
+ PcctPtr->Type = 0x0;
+ PcctPtr->Length = 62;
+ PcctPtr->BaseAddress = mCppcBaseAddressMem; /// Shared memory address
+ PcctPtr->AddressLength = CPPC_SIZE; /// sizeof(Shared memory) in bytes
+
+ PcctPtr->DoorbellRegister.AddressSpaceId = 1; /// IO address type
+ PcctPtr->DoorbellRegister.RegisterBitWidth = 8; /// byte
+ PcctPtr->DoorbellRegister.RegisterBitOffset = 0x0; /// offset=0
+ PcctPtr->DoorbellRegister.AccessSize = 1; /// byte access
+ PcctPtr->DoorbellRegister.Address = MmioRead16 (MmPciExpressAddress (0,0, PCI_DEV_NUM_ICH_LPC, 0, R_ACPI_BAR)) &~BIT0;
+ PcctPtr->DoorbellRegister.Address += R_ACPI_GPE_CNTL; /// PMBASE + GPE_CNTL register offset
+ PcctPtr->DoorbellPreserve = 0xFD; /// preserve all bits except bit 1
+ PcctPtr->DoorbellWrite = 2; /// write bit 1 = 1 to trigger GPE
+ PcctPtr->NominalLatency = 5000; /// 5ms
+ PcctPtr->MaximumPeriodicAccessRate = 0x0;
+ PcctPtr->MinimumRequestTurnaroundTime = 0x0;
+
+ UpdateCounter--;
+ DEBUG((EFI_D_ERROR, "PCCT: Patch the EFI_ACPI_5_0_PCCT_SUBSPACE_GENERIC structure.\n"));
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ ///
+ /// Add the table
+ ///
+ if (LoadTable) {
+ TableHandle = 0;
+ Status = AcpiTable->InstallAcpiTable (
+ AcpiTable,
+ Table,
+ Table->Length,
+ &TableHandle
+ );
+ }
+
+ ///
+ /// Increment the instance
+ ///
+ Instance++;
+ Table = NULL;
+ }
+ }
+}
+
+VOID
+LoadAcpiTablesCpc(
+ VOID
+ )
+/**
+@brief
+ Load ACPI SSDT tables.
+
+ @param[in] None
+
+ @retval None
+
+**/
+{
+ EFI_STATUS Status;
+ EFI_HANDLE *HandleBuffer;
+ UINTN NumberOfHandles;
+ UINTN Index;
+ EFI_FIRMWARE_VOLUME_PROTOCOL *FwVol;
+ EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
+ INTN Instance;
+ EFI_ACPI_COMMON_HEADER *Table;
+ UINTN Size;
+ EFI_FV_FILETYPE FileType;
+ EFI_FV_FILE_ATTRIBUTES Attributes;
+ UINT32 FvStatus;
+ EFI_ACPI_DESCRIPTION_HEADER *TableHeader;
+ UINTN TableHandle;
+ EFI_ACPI_TABLE_VERSION Version;
+ BOOLEAN LoadTable;
+
+ FwVol = NULL;
+ Table = NULL;
+
+ ///
+ /// Locate FV protocol.
+ ///
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiFirmwareVolumeProtocolGuid,
+ NULL,
+ &NumberOfHandles,
+ &HandleBuffer
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Look for FV with ACPI storage file
+ ///
+ for (Index = 0; Index < NumberOfHandles; Index++) {
+
+ ///
+ /// Get the protocol on this handle
+ /// This should not fail because of LocateHandleBuffer
+ ///
+ Status = gBS->HandleProtocol (
+ HandleBuffer[Index],
+ &gEfiFirmwareVolumeProtocolGuid,
+ (VOID **) &FwVol
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ if ((Status == EFI_SUCCESS) && (FwVol != NULL)) {
+ ///
+ /// See if it has the ACPI storage file
+ ///
+ Size = 0;
+ FvStatus = 0;
+ Status = FwVol->ReadFile (
+ FwVol,
+ &gCppcAcpiTableStorageGuid,
+ NULL,
+ &Size,
+ &FileType,
+ &Attributes,
+ &FvStatus
+ );
+
+ ///
+ /// If we found it, then we are done
+ ///
+ if (Status == EFI_SUCCESS) {
+ break;
+ }
+ }
+ }
+
+ ///
+ /// Our exit status is determined by the success of the previous operations
+ /// If the protocol was found, Instance already points to it.
+ ///
+ /// Free any allocated buffers
+ ///
+ FreePool (HandleBuffer);
+
+ ///
+ /// Sanity check that we found our data file
+ ///
+ ASSERT (FwVol);
+ if (FwVol == NULL) {
+ return;
+ }
+
+ ///
+ /// By default, a table belongs in all ACPI table versions published.
+ ///
+ Version = EFI_ACPI_TABLE_VERSION_1_0B | EFI_ACPI_TABLE_VERSION_2_0 | EFI_ACPI_TABLE_VERSION_3_0;
+
+ ///
+ /// Find the Table protocol
+ ///
+ Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **) &AcpiTable);
+
+ ///
+ /// Read tables from the storage file.
+ ///
+ Instance = 0;
+
+ while (Status == EFI_SUCCESS) {
+ ///
+ /// Read the ACPI tables
+ ///
+ Status = FwVol->ReadSection (
+ FwVol,
+ &gCppcAcpiTableStorageGuid,
+ EFI_SECTION_RAW,
+ Instance,
+ (VOID **) &Table,
+ &Size,
+ &FvStatus
+ );
+
+ if (!EFI_ERROR (Status)) {
+
+ LoadTable = FALSE;
+ TableHeader = (EFI_ACPI_DESCRIPTION_HEADER *) Table;
+
+ switch (((EFI_ACPI_DESCRIPTION_HEADER*) TableHeader)->OemTableId) {
+
+ case EFI_SIGNATURE_64 ('C', 'p', 'c', '_', 'T', 'a', 'b', 'l'):
+ ///
+ /// This is the _CPC SSDT. Cppc should be enabled if we reach here so load the table.
+ ///
+ LoadTable = TRUE;
+ DEBUG ((EFI_D_ERROR, "CPPC: Found _CPC SSDT signature.\n"));
+ break;
+
+ default:
+ break;
+ }
+
+ ///
+ /// Add the table
+ ///
+ if (LoadTable) {
+ TableHandle = 0;
+ Status = AcpiTable->InstallAcpiTable (
+ AcpiTable,
+ Table,
+ Table->Length,
+ &TableHandle
+ );
+ }
+
+ ///
+ /// Increment the instance
+ ///
+ Instance++;
+ Table = NULL;
+ }
+ }
+}
+
+EFI_STATUS
+LocateSupportProtocol (
+ IN EFI_GUID *Protocol,
+ OUT VOID **Instance,
+ IN BOOLEAN Type
+ )
+/**
+ @brief
+ Locate the first instance of a protocol. If the protocol requested is an
+ FV protocol, then it will return the first FV that contains the ACPI table
+ storage file.
+
+ @param[in] The protocol to find.
+ @param[in] Return pointer to the first instance of the protocol
+ @param[in] TRUE if the desired protocol is a FV protocol
+
+ @retval EFI_SUCCESS - The function completed successfully.
+ @retval EFI_NOT_FOUND - The protocol could not be located.
+ @retval EFI_OUT_OF_RESOURCES - There are not enough resources to find the protocol.
+**/
+{
+ EFI_STATUS Status;
+ EFI_HANDLE *HandleBuffer;
+ UINTN NumberOfHandles;
+ EFI_FV_FILETYPE FileType;
+ UINT32 FvStatus;
+ EFI_FV_FILE_ATTRIBUTES Attributes;
+ UINTN Size;
+ UINTN i;
+
+ ///
+ /// Locate protocol.
+ ///
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ Protocol,
+ NULL,
+ &NumberOfHandles,
+ &HandleBuffer
+ );
+ if (EFI_ERROR (Status)) {
+
+ ///
+ /// Defined errors at this time are not found and out of resources.
+ ///
+ return Status;
+ }
+
+ ///
+ /// Looking for FV with ACPI storage file
+ ///
+ for (i = 0; i < NumberOfHandles; i++) {
+
+ ///
+ /// Get the protocol on this handle
+ /// This should not fail because of LocateHandleBuffer
+ ///
+ Status = gBS->HandleProtocol (
+ HandleBuffer[i],
+ Protocol,
+ Instance
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ if (!Type) {
+
+ ///
+ /// Not looking for the FV protocol, so find the first instance of the
+ /// protocol. There should not be any errors because our handle buffer
+ /// should always contain at least one or LocateHandleBuffer would have
+ /// returned not found.
+ ///
+ break;
+ }
+
+ ///
+ /// See if it has the ACPI storage file
+ ///
+ Size = 0;
+ FvStatus = 0;
+ Status = ((EFI_FIRMWARE_VOLUME_PROTOCOL *) (*Instance))->ReadFile (
+ *Instance,
+ &gCppcAcpiTableStorageGuid,
+ NULL,
+ &Size,
+ &FileType,
+ &Attributes,
+ &FvStatus
+ );
+
+ ///
+ /// If we found it, then we are done
+ ///
+ if (Status == EFI_SUCCESS) {
+ break;
+ }
+ }
+
+ ///
+ /// Our exit status is determined by the success of the previous operations
+ /// If the protocol was found, Instance already points to it.
+ ///
+ /// Free any allocated buffers
+ ///
+ FreePool (HandleBuffer);
+
+ return Status;
+}
diff --git a/ReferenceCode/AcpiTables/Cppc/Dxe/Cppc.dxs b/ReferenceCode/AcpiTables/Cppc/Dxe/Cppc.dxs
new file mode 100644
index 0000000..d1df44e
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Cppc/Dxe/Cppc.dxs
@@ -0,0 +1,35 @@
+/** @file
+ Dependency expression source file.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+
+#include "EfiDepex.h"
+#include EFI_PROTOCOL_DEPENDENCY (CpuIo)
+#include EFI_PROTOCOL_DEPENDENCY (AcpiSupport)
+#include EFI_PROTOCOL_DEPENDENCY (AcpiPlatformPolicy)
+#include EFI_PROTOCOL_DEPENDENCY (PowerMgmtInitDone)
+
+DEPENDENCY_START
+ EFI_CPU_IO_PROTOCOL_GUID AND
+ EFI_ACPI_SUPPORT_GUID AND
+ ACPI_PLATFORM_POLICY_PROTOCOL_GUID AND
+ EFI_POWER_MGMT_INIT_DONE_PROTOCOL_GUID
+DEPENDENCY_END
diff --git a/ReferenceCode/AcpiTables/Cppc/Dxe/Cppc.h b/ReferenceCode/AcpiTables/Cppc/Dxe/Cppc.h
new file mode 100644
index 0000000..289fe93
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Cppc/Dxe/Cppc.h
@@ -0,0 +1,245 @@
+/** @file
+ Header file for the Collaborative Processor Performance Control (CPPC) driver.
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+#ifndef _CPPC_H_
+#define _CPPC_H_
+
+#include "EdkIIGlueBase.h"
+#include "EdkIIGlueDxe.h"
+#include "EfiScriptLib.h"
+#include "Acpi.h"
+#include "SaAccess.h"
+#include "CpuAccess.h"
+#include "CpuPlatformLib.h"
+///
+/// Consumed protocols
+///
+#include EFI_PROTOCOL_DEPENDENCY (AcpiTable)
+#include EFI_PROTOCOL_DEPENDENCY (FirmwareVolume)
+#include EFI_PROTOCOL_CONSUMER (PciRootBridgeIo)
+#include EFI_PROTOCOL_DEFINITION (AcpiPlatformPolicy)
+
+#define CPPC_SIZE 0x1000 /// 4kb of runtime memory for CPPC shared memory buffer
+#define PCI_DEV_NUM_ICH_LPC 31 /// ICH is Device 31
+#define R_ACPI_BAR 0x40 /// ACPI Base Address Register
+#define R_ACPI_GPE_CNTL 0x42 /// GPE control register offset
+#define CPUID_FULL_FAMILY_MODEL_HASWELL 0x000306C0
+#define EFI_MSR_POWER_CTL 0x000001FC
+
+///
+/// SSDT data storage file
+///
+#include "CppcAcpiTableStorage.h"
+
+///
+/// AML parsing definitions
+///
+#define AML_NAME_OP 0x08
+
+///
+/// ASL NAME structure
+///
+#pragma pack(1)
+typedef struct {
+ UINT8 NameOp; // Byte [0]=0x08:NameOp.
+ UINT32 NameString; // Byte [4:1]=Name of object.
+ UINT8 DWordPrefix; // Byte [5]=0x0C:DWord Prefix.
+ UINT32 Value; // Byte [9:6] ; Value of named object.
+} NAME_LAYOUT;
+#pragma pack()
+
+///
+/// ACPI 5.0 Generic Address Space definition
+///
+#pragma pack(1)
+typedef struct {
+ UINT8 AddressSpaceId;
+ UINT8 RegisterBitWidth;
+ UINT8 RegisterBitOffset;
+ UINT8 AccessSize;
+ UINT64 Address;
+} EFI_ACPI_5_0_GENERIC_ADDRESS_STRUCTURE;
+#pragma pack()
+
+///
+/// Platform Communications Channel Table (PCCT)
+///
+#pragma pack(1)
+typedef struct {
+ EFI_ACPI_DESCRIPTION_HEADER Header;
+ UINT32 Flags;
+ UINT64 Reserved;
+} EFI_ACPI_5_0_PLATFORM_COMMUNICATION_CHANNEL_TABLE_HEADER;
+#pragma pack()
+
+///
+/// Generic Communications Subspace Structure
+///
+#pragma pack(1)
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 Reserved[6];
+ UINT64 BaseAddress;
+ UINT64 AddressLength;
+ EFI_ACPI_5_0_GENERIC_ADDRESS_STRUCTURE DoorbellRegister;
+ UINT64 DoorbellPreserve;
+ UINT64 DoorbellWrite;
+ UINT32 NominalLatency;
+ UINT32 MaximumPeriodicAccessRate;
+ UINT16 MinimumRequestTurnaroundTime;
+} EFI_ACPI_5_0_PCCT_SUBSPACE_GENERIC;
+#pragma pack()
+
+///
+/// UINT64 workaround
+///
+/// The MS compiler doesn't handle QWORDs very well. I'm breaking
+/// them into DWORDs to circumvent the problems. Converting back
+/// shouldn't be a big deal.
+///
+#pragma pack(1)
+typedef union _MSR_REGISTER {
+ UINT64 Qword;
+
+ struct _DWORDS {
+ UINT32 Low;
+ UINT32 High;
+ } Dwords;
+
+ struct _BYTES {
+ UINT8 FirstByte;
+ UINT8 SecondByte;
+ UINT8 ThirdByte;
+ UINT8 FouthByte;
+ UINT8 FifthByte;
+ UINT8 SixthByte;
+ UINT8 SeventhByte;
+ UINT8 EighthByte;
+ } Bytes;
+
+} MSR_REGISTER;
+#pragma pack()
+
+#ifndef BIT63
+#define BIT0 0x0001
+#define BIT1 0x0002
+#define BIT2 0x0004
+#define BIT3 0x0008
+#define BIT4 0x0010
+#define BIT5 0x0020
+#define BIT6 0x0040
+#define BIT7 0x0080
+#define BIT8 0x0100
+#define BIT9 0x0200
+#define BIT10 0x0400
+#define BIT11 0x0800
+#define BIT12 0x1000
+#define BIT13 0x2000
+#define BIT14 0x4000
+#define BIT15 0x8000
+#define BIT16 0x00010000
+#define BIT17 0x00020000
+#define BIT18 0x00040000
+#define BIT19 0x00080000
+#define BIT20 0x00100000
+#define BIT21 0x00200000
+#define BIT22 0x00400000
+#define BIT23 0x00800000
+#define BIT24 0x01000000
+#define BIT25 0x02000000
+#define BIT26 0x04000000
+#define BIT27 0x08000000
+#define BIT28 0x10000000
+#define BIT29 0x20000000
+#define BIT30 0x40000000
+#define BIT31 0x80000000
+#define BIT32 0x100000000
+#define BIT33 0x200000000
+#define BIT34 0x400000000
+#define BIT35 0x800000000
+#define BIT36 0x1000000000
+#define BIT37 0x2000000000
+#define BIT38 0x4000000000
+#define BIT39 0x8000000000
+#define BIT40 0x10000000000
+#define BIT41 0x20000000000
+#define BIT42 0x40000000000
+#define BIT43 0x80000000000
+#define BIT44 0x100000000000
+#define BIT45 0x200000000000
+#define BIT46 0x400000000000
+#define BIT47 0x800000000000
+#define BIT48 0x1000000000000
+#define BIT49 0x2000000000000
+#define BIT50 0x4000000000000
+#define BIT51 0x8000000000000
+#define BIT52 0x10000000000000
+#define BIT53 0x20000000000000
+#define BIT54 0x40000000000000
+#define BIT55 0x80000000000000
+#define BIT56 0x100000000000000
+#define BIT57 0x200000000000000
+#define BIT58 0x400000000000000
+#define BIT59 0x800000000000000
+#define BIT60 0x1000000000000000
+#define BIT61 0x2000000000000000
+#define BIT62 0x4000000000000000
+#define BIT63 0x8000000000000000
+#endif
+
+#define MmPciExpressAddress(Segment, Bus, Device, Function, Register) \
+ ( (UINTN) (PciRead32 (PCI_LIB_ADDRESS (0,0,0,0x60)) & 0xFC000000) + \
+ (UINTN) (Bus << 20) + \
+ (UINTN) (Device << 15) + \
+ (UINTN) (Function << 12) + \
+ (UINTN) (Register) \
+ )
+
+EFI_STATUS
+InitializeCppc (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ );
+
+VOID
+LoadAcpiTables(
+ VOID
+ );
+
+VOID
+LoadAcpiTablesPcct(
+ VOID
+ );
+
+VOID
+LoadAcpiTablesCpc(
+ VOID
+ );
+
+EFI_STATUS
+LocateSupportProtocol (
+ IN EFI_GUID *Protocol,
+ OUT VOID **Instance,
+ IN BOOLEAN Type
+ );
+
+#endif
diff --git a/ReferenceCode/AcpiTables/Cppc/Dxe/Cppc.inf b/ReferenceCode/AcpiTables/Cppc/Dxe/Cppc.inf
new file mode 100644
index 0000000..731cf82
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Cppc/Dxe/Cppc.inf
@@ -0,0 +1,91 @@
+## @file
+# Component description file for Cppc module
+#
+#@copyright
+# Copyright (c) 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains an 'Intel Peripheral Driver' and uniquely
+# identified as "Intel Reference Module" and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+
+
+[defines]
+BASE_NAME = Cppc
+FILE_GUID = C07A1EB5-5C04-4100-817B-0A11BB5F15DC
+COMPONENT_TYPE = RT_DRIVER
+
+[sources.common]
+ Cppc.h
+ Cppc.c
+
+[includes.common]
+ $(EFI_SOURCE)/$(PROJECT_ACPI_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_ACPI_ROOT)/Cppc
+ $(EFI_SOURCE)/$(PROJECT_ACPI_ROOT)/Cppc/Guid/AcpiTableStorage
+ .
+ $(EDK_SOURCE)/Sample/Chipset/PcCompatible
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Core/Dxe/ArchProtocol/Cpu
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Framework
+ $(EFI_SOURCE)/Include
+ $(EFI_SOURCE)/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include/Pcd
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include/Library
+ $(EDK_SOURCE)/Foundation/Cpu/Pentium/Include
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include/Library
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Library/CpuPlatformLib
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Include
+
+[libraries.common]
+ EdkIIGlueDxeMemoryAllocationLib
+ EdkIIGlueBaseLib
+ EdkIIGlueDxeReportStatusCodeLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkProtocolLib
+ EfiProtocolLib
+ EfiDriverLib
+ ArchProtocolLib
+ EdkFrameworkProtocolLib
+ EdkIIGlueBasePciExpressLib
+ EdkIIGlueUefiLib
+ EfiScriptLib
+ AcpiProtocolLib
+ CpuProtocolLib
+ CpuPlatformLib
+ CppcGuidLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = InitializeCppc
+ DPX_SOURCE = Cppc.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D"__EDKII_GLUE_MODULE_ENTRY_POINT__=InitializeCppc" \
+ -D __EDKII_GLUE_BASE_LIB__ \
+ -D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__
+
diff --git a/ReferenceCode/AcpiTables/Cppc/Dxe/CppcDxe.cif b/ReferenceCode/AcpiTables/Cppc/Dxe/CppcDxe.cif
new file mode 100644
index 0000000..5379e0e
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Cppc/Dxe/CppcDxe.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "CppcDxe"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\AcpiTables\Cppc\Dxe\"
+ RefName = "CppcDxe"
+[files]
+"CppcDxe.sdl"
+"CppcDxe.mak"
+"Cppc.c"
+"Cppc.dxs"
+"Cppc.h"
+"Cppc.inf"
+<endComponent>
diff --git a/ReferenceCode/AcpiTables/Cppc/Dxe/CppcDxe.mak b/ReferenceCode/AcpiTables/Cppc/Dxe/CppcDxe.mak
new file mode 100644
index 0000000..a318f31
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Cppc/Dxe/CppcDxe.mak
@@ -0,0 +1,96 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2012, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+#<AMI_FHDR_START>
+#
+# Name: CppcDxe.mak
+#
+# Description: Make file to build Intel CPPC components
+#
+#<AMI_FHDR_END>
+#*************************************************************************
+EDK : CppcDxe
+
+CppcDxe : $(BUILD_DIR)\CppcDxe.mak CppcDxeBin
+
+CppcDxe_OBJECTS = \
+$(BUILD_DIR)\$(INTEL_CPPC_DXE_DIR)\Cppc.obj
+
+$(BUILD_DIR)\CppcDxe.mak : $(INTEL_CPPC_DXE_DIR)\$(@B).cif $(INTEL_CPPC_DXE_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(INTEL_CPPC_DXE_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+CppcDxe_LIBS =\
+ $(EdkIIGlueDxeMemoryAllocationLib_LIB)\
+ $(EDKPROTOCOLLIB)\
+ $(EFIPROTOCOLLIB)\
+ $(ARCHPROTOCOLLIB)\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(EFISCRIPTLIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EdkIIGlueBasePciExpressLib_LIB)\
+ $(EdkIIGlueUefiLib_LIB)\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueDxeServicesTableLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueDxeHobLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(EFIDRIVERLIB)\
+ $(AcpiProtocolLib_LIB)\
+ $(CppcGuidLib_LIB)\
+ $(CpuProtocolLib_LIB)\
+ $(CpuPlatformLib_LIB)\
+ $(PchPlatformDxeLib_LIB)\
+
+CppcDxe_INCLUDES= $(EDK_INCLUDES)\
+ $(IndustryStandard_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(CPPC_INCLUDES)\
+ /I ReferenceCode\AcpiTables\
+ /I$(ArchProtocolLib_DIR)\Cpu\
+ $(PROJECT_CPU_INCLUDES)\
+ /I$(PROJECT_CPU_ROOT)\Library\CpuPlatformLib\
+ /I$(INTEL_SYSTEM_AGENT_DIR)\Include\
+
+CppcDxeBin: $(CppcDxe_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\CppcDxe.mak all \
+ NAME=CppcDxe\
+ MAKEFILE=$(BUILD_DIR)\CppcDxe.mak \
+ "MY_INCLUDES=$(CppcDxe_INCLUDES)"\
+ GUID=C07A1EB5-5C04-4100-817B-0A11BB5F15DC\
+ ENTRY_POINT=InitializeCppc \
+ TYPE=RT_DRIVER\
+ "OBJECTS=$(CppcDxe_OBJECTS)"\
+ DEPEX1=$(INTEL_CPPC_DXE_DIR)\Cppc.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX\
+ COMPRESS=1
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2012, 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/ReferenceCode/AcpiTables/Cppc/Dxe/CppcDxe.sdl b/ReferenceCode/AcpiTables/Cppc/Dxe/CppcDxe.sdl
new file mode 100644
index 0000000..164ab26
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Cppc/Dxe/CppcDxe.sdl
@@ -0,0 +1,30 @@
+TOKEN
+ Name = "CppcDxe_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable CppcDxe support in Project"
+End
+
+MODULE
+ Help = "Includes CppcDxe.mak to Project"
+ File = "CppcDxe.mak"
+End
+
+PATH
+ Name = "INTEL_CPPC_DXE_DIR"
+End
+
+ELINK
+ Name = "/I$(INTEL_CPPC_DXE_DIR)"
+ Parent = "CPPC_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\CppcDxe.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/AcpiTables/Cppc/Guid/AcpiTableStorage/CppcAcpiTableStorage.c b/ReferenceCode/AcpiTables/Cppc/Guid/AcpiTableStorage/CppcAcpiTableStorage.c
new file mode 100644
index 0000000..af25bc6
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Cppc/Guid/AcpiTableStorage/CppcAcpiTableStorage.c
@@ -0,0 +1,33 @@
+/** @file
+ The GUID definition for Cppc ACPI table storage file name
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+#include "EdkIIGlueDxe.h"
+#include "CppcAcpiTableStorage.h"
+
+///
+/// Protocol GUID definition
+///
+EFI_GUID gCppcAcpiTableStorageGuid = CPPC_ACPI_TABLE_STORAGE_GUID;
+
+///
+/// Protocol description string
+///
+EFI_GUID_STRING (&gCppcAcpiTableStorageGuid, "Collaborative Processor Performance Control ACPI Table Storage File Name", "Collaborative Processor Performance Control ACPI Table Storage file name GUID");
diff --git a/ReferenceCode/AcpiTables/Cppc/Guid/AcpiTableStorage/CppcAcpiTableStorage.h b/ReferenceCode/AcpiTables/Cppc/Guid/AcpiTableStorage/CppcAcpiTableStorage.h
new file mode 100644
index 0000000..417ad64
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Cppc/Guid/AcpiTableStorage/CppcAcpiTableStorage.h
@@ -0,0 +1,30 @@
+/** @file
+ GUID definition for the Cppc ACPI table storage file name
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+#ifndef _CPPC_ACPI_TABLE_STORAGE_H_
+#define _CPPC_ACPI_TABLE_STORAGE_H_
+
+#define CPPC_ACPI_TABLE_STORAGE_GUID \
+ { 0x60e31de1, 0x3ec, 0x492a, 0x95, 0x98, 0x65, 0xa3, 0xc5, 0xe, 0xf, 0x6b }
+
+extern EFI_GUID gCppcAcpiTableStorageGuid;
+
+#endif
diff --git a/ReferenceCode/AcpiTables/Cppc/Guid/CppcGuidLib.cif b/ReferenceCode/AcpiTables/Cppc/Guid/CppcGuidLib.cif
new file mode 100644
index 0000000..fa8673e
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Cppc/Guid/CppcGuidLib.cif
@@ -0,0 +1,12 @@
+<component>
+ name = "CppcGuidLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\AcpiTables\Cppc\Guid\"
+ RefName = "CppcGuidLib"
+[files]
+"CppcGuidLib.sdl"
+"CppcGuidLib.mak"
+"CppcGuidLib.inf"
+"AcpiTableStorage\CppcAcpiTableStorage.c"
+"AcpiTableStorage\CppcAcpiTableStorage.h"
+<endComponent>
diff --git a/ReferenceCode/AcpiTables/Cppc/Guid/CppcGuidLib.inf b/ReferenceCode/AcpiTables/Cppc/Guid/CppcGuidLib.inf
new file mode 100644
index 0000000..23131aa
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Cppc/Guid/CppcGuidLib.inf
@@ -0,0 +1,55 @@
+## @file
+# Component description file.
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains an 'Intel Peripheral Driver' and uniquely
+# identified as "Intel Reference Module" and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+
+[defines]
+BASE_NAME = CppcGuidLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ AcpiTableStorage/CppcAcpiTableStorage.c
+ AcpiTableStorage/CppcAcpiTableStorage.h
+
+[includes.common]
+ .
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EFI_SOURCE)/$(PROJECT_ACPI_ROOT)/Cppc
+#
+# Edk II Glue Library, some hearder are included by R9 header so have to include
+#
+
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Framework
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[nmake.common]
diff --git a/ReferenceCode/AcpiTables/Cppc/Guid/CppcGuidLib.mak b/ReferenceCode/AcpiTables/Cppc/Guid/CppcGuidLib.mak
new file mode 100644
index 0000000..86fed09
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Cppc/Guid/CppcGuidLib.mak
@@ -0,0 +1,55 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2012, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+#<AMI_FHDR_START>
+#
+# Name: CppcGuidLib.mak
+#
+# Description: Make file to build Intel CPPC GuidLib components
+#
+#<AMI_FHDR_END>
+#*************************************************************************
+all : CppcGuidLib
+
+$(CppcGuidLib_LIB) : CppcGuidLib
+
+CppcGuidLib : $(BUILD_DIR)\CppcGuidLib.mak CppcGuidLibBin
+
+$(BUILD_DIR)\CppcGuidLib.mak : $(INTEL_CPPC_GUIDLIB_DIR)\$(@B).cif $(INTEL_CPPC_GUIDLIB_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(INTEL_CPPC_GUIDLIB_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+CppcGuidLib_INCLUDES=\
+ $(EDK_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)
+
+CppcGuidLibBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\CppcGuidLib.mak all\
+ "MY_INCLUDES=$(CppcGuidLib_INCLUDES)" \
+ TYPE=LIBRARY
+
+#**********************************************************************
+#**********************************************************************
+#** **
+#** (C)Copyright 1985-2012, 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/ReferenceCode/AcpiTables/Cppc/Guid/CppcGuidLib.sdl b/ReferenceCode/AcpiTables/Cppc/Guid/CppcGuidLib.sdl
new file mode 100644
index 0000000..7e03f5e
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Cppc/Guid/CppcGuidLib.sdl
@@ -0,0 +1,37 @@
+TOKEN
+ Name = "CppcGuidLib_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable CppcGuidLib support in Project"
+End
+
+MODULE
+ Help = "Includes CppcGuidLib.mak to Project"
+ File = "CppcGuidLib.mak"
+End
+
+PATH
+ Name = "INTEL_CPPC_GUIDLIB_DIR"
+End
+
+TOKEN
+ Name = "CppcGuidLib_LIB"
+ Value = "$(BUILD_DIR)\CppcGuidLib.lib"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+ELINK
+ Name = "/I$(INTEL_CPPC_GUIDLIB_DIR)"
+ Parent = "CPPC_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(INTEL_CPPC_GUIDLIB_DIR)\AcpiTableStorage"
+ Parent = "CPPC_INCLUDES"
+ InvokeOrder = AfterParent
+End \ No newline at end of file
diff --git a/ReferenceCode/AcpiTables/Cppc/ReleaseNotes.chm b/ReferenceCode/AcpiTables/Cppc/ReleaseNotes.chm
new file mode 100644
index 0000000..34332db
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Cppc/ReleaseNotes.chm
Binary files differ
diff --git a/ReferenceCode/AcpiTables/Cppc/iasl.exe b/ReferenceCode/AcpiTables/Cppc/iasl.exe
new file mode 100644
index 0000000..b10ef96
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Cppc/iasl.exe
Binary files differ
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/Art.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Art.asl
new file mode 100644
index 0000000..03831ac
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Art.asl
@@ -0,0 +1,91 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ Art.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Intel Dynamic Power Performance Management
+
+--*/
+
+ Scope(\_SB.IETM)
+ {
+
+ Name(ART1, Package() // ART package when in Quiet Mode / Passive Cooling Mode
+ {
+ 0, // Revision
+ // Source Target Weight, AC0MaxLevel, AC1MaxLevel, AC21MaxLevel, AC31MaxLevel, AC41MaxLevel, AC51MaxLevel, AC61MaxLevel, AC71MaxLevel, AC81MaxLevel, AC91MaxLevel
+ Package(){\_SB.PCI0.LPCB.H_EC.TFN1, \_SB.PCI0.TPCH, 100, 55, 45, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF},
+ Package(){\_SB.PCI0.LPCB.H_EC.TFN1, \_SB.PCI0.TMEM, 100, 60, 50, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF},
+ Package(){\_SB.PCI0.LPCB.H_EC.TFN1, \_SB.PCI0.LPCB.H_EC.TSKN, 100, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 60, 50, 40, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF},
+ Package(){\_SB.PCI0.LPCB.H_EC.TFN1, \_SB.PCI0.LPCB.H_EC.TAMB, 100, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF},
+ Package(){\_SB.PCI0.LPCB.H_EC.TFN1, \_SB.PCI0.LPCB.H_EC.T_VR, 100, 70, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF},
+ Package(){\_SB.PCI0.LPCB.H_EC.TFN1, \_SB.PCI0.LPCB.H_EC.TEFN, 100, 40, 35, 30, 25, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF},
+ Package(){\_SB.PCI0.LPCB.H_EC.TFN1, \_SB.PCI0.B0D4, 100, 70, 50, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF},
+ Package(){\_SB.PCI0.LPCB.H_EC.TFN2, \_SB.PCI0.LPCB.H_EC.T_VR, 100, 65, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF},
+ Package(){\_SB.PCI0.LPCB.H_EC.TFN2, \_SB.PCI0.B0D4, 100, 75, 20, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF},
+ })
+
+ Name(ART0, Package() // ART package when in Performance Mode / Active Cooling Mode
+ {
+ 0, // Revision
+ // Source Target Weight, AC0MaxLevel, AC1MaxLevel, AC21MaxLevel, AC31MaxLevel, AC41MaxLevel, AC51MaxLevel, AC61MaxLevel, AC71MaxLevel, AC81MaxLevel, AC91MaxLevel
+ Package(){\_SB.PCI0.LPCB.H_EC.TFN1, \_SB.PCI0.TPCH, 100, 70, 50, 40, 30, 20, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF},
+ Package(){\_SB.PCI0.LPCB.H_EC.TFN1, \_SB.PCI0.TMEM, 100, 80, 60, 50, 30, 10, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF},
+ Package(){\_SB.PCI0.LPCB.H_EC.TFN1, \_SB.PCI0.LPCB.H_EC.TSKN, 100, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 90, 75, 50, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF},
+ Package(){\_SB.PCI0.LPCB.H_EC.TFN1, \_SB.PCI0.LPCB.H_EC.TAMB, 100, 75, 55, 35, 15, 5, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF},
+ Package(){\_SB.PCI0.LPCB.H_EC.TFN1, \_SB.PCI0.LPCB.H_EC.T_VR, 100, 90, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF},
+ Package(){\_SB.PCI0.LPCB.H_EC.TFN1, \_SB.PCI0.LPCB.H_EC.TEFN, 100, 60, 50, 40, 30, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF},
+ Package(){\_SB.PCI0.LPCB.H_EC.TFN1, \_SB.PCI0.B0D4, 100, 100, 80, 65, 45, 25, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF},
+ Package(){\_SB.PCI0.LPCB.H_EC.TFN2, \_SB.PCI0.LPCB.H_EC.T_VR, 100, 95, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF},
+ Package(){\_SB.PCI0.LPCB.H_EC.TFN2, \_SB.PCI0.B0D4, 100, 100, 50, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF},
+ })
+
+ // _ART (Active Cooling Relationship Table)
+ //
+ // Arguments:
+ // None
+ // Return Value:
+ // A variable-length Package containing a Revision ID and a list of Active Relationship Packages as described below:
+ //
+ // Return Value Information
+ // Package {
+ // Revision, // Integer - Current revision is: 0
+ // ActiveRelationship[0] // Package
+ // ...
+ // ActiveRelationship[n] // Package
+ // }
+ //
+ Method(_ART,,,,PkgObj)
+ { // TODO: Add system-specific _ART code here
+ If(\ECON)
+ {
+ If(\_SB.PCI0.LPCB.H_EC.TSKN.CTYP)
+ {
+ Return(ART1)
+ } Else {
+ Return(ART0)
+ }
+ }
+ } // End _ART
+}
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/B0d4CtdpPolicy.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/B0d4CtdpPolicy.asl
new file mode 100644
index 0000000..553612f
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/B0d4CtdpPolicy.asl
@@ -0,0 +1,376 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2013Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ B0d4CtdpPolicy.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Intel Configurable TDP
+
+--*/
+
+
+Scope(\_SB.IETM)
+{
+ Name (CTSP, Package ()
+ {
+ //
+ // ConfigTDP Policy
+ //
+ ToUUID("E145970A-E4C1-4d73-900E-C9C5A69DD067")
+ })
+}
+
+Scope(\_SB.PCI0.B0D4)
+{
+ // TDPL (Thermal Design Power List)
+ //
+ // Returns the list of all supported Configurable TDP points available for the participant device.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // Package () // Zeroth TDP State
+ // {
+ // TDPPower, // DWordConst
+ // Frequency, // DWordConst
+ // TDPControl, // DWordConst
+ // FrequencyControl, // DWordConst
+ // Reserved1, // DWordConst
+ // },
+ // .
+ // .
+ // .
+ // Package () // Last TDP State
+ // {
+ // TDPPower, // DWordConst
+ // Frequency, // DWordConst
+ // TDPControl, // DWordConst
+ // FrequencyControl, // DWordConst
+ // Reserved1, // DWordConst
+ // }
+ //
+ Method(TDPL,,,,PkgObj)
+ {
+ Name(AAAA,0) // PACKAGE_POWER_SKU
+ Name(BBBB,0) // CONFIG_TDP_LEVEL1
+ Name(CCCC,0) // CONFIG_TDP_LEVEL2
+ Name(PPUU,0) // PACKAGE_POWER_SKU_UNIT
+
+ Store(CTNL, Local0) // CONFIG_TDP_NUM_LEVELS
+ If(LOr(LEqual(Local0,1),LEqual(Local0,2))){ // check for CTDP support
+ Store(\_PR.CLVL,Local0) // use PPM supplied value for CTDP level
+ }
+ Else{
+ Return(Package (){0}) // no CTDP support
+ }
+
+ If(LEqual(CLCK,1)){ // check the CONFIG_TDP_LOCK bit
+ Store(1,Local0)
+ }
+
+ Store(CPNU(\_PR.PL10,1),AAAA) // convert Custom 0 Power Limit1 to milliwatts
+ Store(CPNU(\_PR.PL11,1),BBBB) // convert Custom 1 Power Limit1 to milliwatts
+ Store(CPNU(\_PR.PL12,1),CCCC) // convert Custom 2 Power Limit1 to milliwatts
+
+ //
+ // Define a package of packages that contain 5 DWords.
+ //
+ Name (TMP1, Package (1){
+ Package (){0x80000000,0x80000000,0x80000000,0x80000000,0x80000000}
+ })
+ Name (TMP2, Package (2){
+ Package (){0x80000000,0x80000000,0x80000000,0x80000000,0x80000000},
+ Package (){0x80000000,0x80000000,0x80000000,0x80000000,0x80000000}
+ })
+ Name (TMP3, Package (3){
+ Package (){0x80000000,0x80000000,0x80000000,0x80000000,0x80000000},
+ Package (){0x80000000,0x80000000,0x80000000,0x80000000,0x80000000},
+ Package (){0x80000000,0x80000000,0x80000000,0x80000000,0x80000000}
+ })
+
+ //
+ // if 3 TDP's, use PL0, PL1 and PL2 values
+ //
+ If(LEqual(Local0,3)){
+ If (LGreater(AAAA,BBBB)){
+ If (LGreater(AAAA,CCCC)){
+ If (LGreater(BBBB,CCCC)){
+ // abc
+ Store(0,Local3)
+ Store(0,LEV0)
+ Store(1,Local4)
+ Store(1,LEV1)
+ Store(2,Local5)
+ Store(2,LEV2)
+ }Else{
+ // acb
+ Store(0,Local3)
+ Store(0,LEV0)
+ Store(1,Local5)
+ Store(2,LEV1)
+ Store(2,Local4)
+ Store(1,LEV2)
+ }
+ }Else{
+ // cab
+ Store(0,Local5)
+ Store(2,LEV0)
+ Store(1,Local3)
+ Store(0,LEV1)
+ Store(2,Local4)
+ Store(1,LEV2)
+ }
+ }Else{ // b > a here
+ If(LGreater(BBBB,CCCC)){
+ If(LGreater(AAAA,CCCC)){
+ // bac
+ Store(0,Local4)
+ Store(1,LEV0)
+ Store(1,Local3)
+ Store(0,LEV1)
+ Store(2,Local5)
+ Store(2,LEV2)
+ }Else{
+ // bca
+ Store(0,Local4)
+ Store(1,LEV0)
+ Store(1,Local5)
+ Store(2,LEV1)
+ Store(2,Local3)
+ Store(0,LEV2)
+ }
+ }Else{
+ // cba
+ Store(0,Local5)
+ Store(2,LEV0)
+ Store(1,Local4)
+ Store(1,LEV1)
+ Store(2,Local3)
+ Store(0,LEV2)
+ }
+ }
+
+ // copy for PL0
+ Store(Add(\_PR.TAR0,1),Local1)
+ Multiply(Local1,100,Local2)
+ Store(AAAA,Index(DeRefOf(Index(TMP3, Local3)),0))
+ Store(Local2,Index(DeRefOf(Index(TMP3, Local3)),1))
+ Store(\_PR.CTC0,Index(DeRefOf(Index(TMP3, Local3)),2))
+ Store(Local1,Index(DeRefOf(Index(TMP3, Local3)),3))
+ Store(0,Index(DeRefOf(Index(TMP3, Local3)),4))
+
+ // copy for PL1
+ Store(Add(\_PR.TAR1,1),Local1)
+ Multiply(Local1,100,Local2)
+ Store(BBBB,Index(DeRefOf(Index(TMP3, Local4)),0))
+ Store(Local2,Index(DeRefOf(Index(TMP3, Local4)),1))
+ Store(\_PR.CTC1,Index(DeRefOf(Index(TMP3, Local4)),2))
+ Store(Local1,Index(DeRefOf(Index(TMP3, Local4)),3))
+ Store(0,Index(DeRefOf(Index(TMP3, Local4)),4))
+
+ // copy for PL2
+ Store(Add(\_PR.TAR2,1),Local1)
+ Multiply(Local1,100,Local2)
+ Store(CCCC,Index(DeRefOf(Index(TMP3, Local5)),0))
+ Store(Local2,Index(DeRefOf(Index(TMP3, Local5)),1))
+ Store(\_PR.CTC2,Index(DeRefOf(Index(TMP3, Local5)),2))
+ Store(Local1,Index(DeRefOf(Index(TMP3, Local5)),3))
+ Store(0,Index(DeRefOf(Index(TMP3, Local5)),4))
+
+ Return(TMP3)
+ }
+
+ //
+ // if 2 TDP's, use PL0 and PL1 values
+ //
+ If(LEqual(Local0,2)){
+ If(LGreater(AAAA,BBBB)){
+ Store(0,Local3) // store PL0 in Zeroth package
+ Store(1,Local4) // store PL1 in next package
+ Store(0,LEV0)
+ Store(1,LEV1)
+ Store(0,LEV2) // level 2 is not used so put 0 for safety
+ }Else{
+ Store(0,Local4) // store PL1 in Zeroth package
+ Store(1,Local3) // store PL0 in next package
+ Store(1,LEV0)
+ Store(0,LEV1)
+ Store(0,LEV2) // level 2 is not used so put 0 for safety
+ }
+
+ // copy for PL0
+ Store(Add(\_PR.TAR0,1),Local1)
+ Multiply(Local1,100,Local2)
+ Store(AAAA,Index(DeRefOf(Index(TMP2, Local3)),0))
+ Store(Local2,Index(DeRefOf(Index(TMP2, Local3)),1))
+ Store(\_PR.CTC0,Index(DeRefOf(Index(TMP2, Local3)),2))
+ Store(Local1,Index(DeRefOf(Index(TMP2, Local3)),3))
+ Store(0,Index(DeRefOf(Index(TMP2, Local3)),4))
+
+ // copy for PL1
+ Store(Add(\_PR.TAR1,1),Local1)
+ Multiply(Local1,100,Local2)
+ Store(BBBB,Index(DeRefOf(Index(TMP2, Local4)),0))
+ Store(Local2,Index(DeRefOf(Index(TMP2, Local4)),1))
+ Store(\_PR.CTC1,Index(DeRefOf(Index(TMP2, Local4)),2))
+ Store(Local1,Index(DeRefOf(Index(TMP2, Local4)),3))
+ Store(0,Index(DeRefOf(Index(TMP2, Local4)),4))
+
+ Return(TMP2)
+ }
+
+ //
+ // if 1 TDP, return one PL based on boot index
+ //
+ If(LEqual(Local0,1)){
+ Switch(ToInteger(\_PR.CBMI)){
+ case(0){
+ // copy for PL0
+ Store(Add(\_PR.TAR0,1),Local1)
+ Multiply(Local1,100,Local2)
+ Store(AAAA,Index(DeRefOf(Index(TMP1, 0)),0))
+ Store(Local2,Index(DeRefOf(Index(TMP1, 0)),1))
+ Store(\_PR.CTC0,Index(DeRefOf(Index(TMP1, 0)),2))
+ Store(Local1,Index(DeRefOf(Index(TMP1, 0)),3))
+ Store(0,Index(DeRefOf(Index(TMP1, 0)),4))
+ Store(0,LEV0)
+ Store(0,LEV1)
+ Store(0,LEV2)
+ }
+
+ case(1){
+ // copy for PL1
+ Store(Add(\_PR.TAR1,1),Local1)
+ Multiply(Local1,100,Local2)
+ Store(BBBB,Index(DeRefOf(Index(TMP1, 0)),0))
+ Store(Local2,Index(DeRefOf(Index(TMP1, 0)),1))
+ Store(\_PR.CTC1,Index(DeRefOf(Index(TMP1, 0)),2))
+ Store(Local1,Index(DeRefOf(Index(TMP1, 0)),3))
+ Store(0,Index(DeRefOf(Index(TMP1, 0)),4))
+ Store(1,LEV0)
+ Store(1,LEV1)
+ Store(1,LEV2)
+ }
+
+ case(2){
+ // copy for PL2
+ Store(Add(\_PR.TAR2,1),Local1)
+ Multiply(Local1,100,Local2)
+ Store(CCCC,Index(DeRefOf(Index(TMP1, 0)),0))
+ Store(Local2,Index(DeRefOf(Index(TMP1, 0)),1))
+ Store(\_PR.CTC2,Index(DeRefOf(Index(TMP1, 0)),2))
+ Store(Local1,Index(DeRefOf(Index(TMP1, 0)),3))
+ Store(0,Index(DeRefOf(Index(TMP1, 0)),4))
+ Store(2,LEV0)
+ Store(2,LEV1)
+ Store(2,LEV2)
+ }
+ }
+
+ Return(TMP1)
+ }
+
+ Return(0) // we should never get here, this eliminates a compiler warning
+ } // End of TDPL object
+
+ //
+ // Returns the max TDP configurable for the platform.
+ //
+ Name(MAXT,0)
+
+ // TDPC (Thermal Design Power Capabilities)
+ //
+ // The TDPC object evaluates to an integer that identifies the maximum usable TDP point
+ // from the table returned by the TDPL object at any given time.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // This value is the zero based index into the TDPL object's entries.
+ //
+ Method(TDPC) // For CRB, please return 0.
+ {
+ Return(MAXT) // Return valid TDP point.
+ }//end Method(TDPC)
+
+ Name(LEV0,0)
+ Name(LEV1,0)
+ Name(LEV2,0)
+
+ // STDP (Set current operating TDP Point)
+ //
+ // The STDP object communicates to the platform BIOS the current operating TDP point whenever it is changed due to any reason.
+ // In response to this object evaluation, the platform BIOS modifies the packages returned in PPCC object and notifies the driver of
+ // a change in power limit capabilities as appropriate.
+ //
+ // Arguments: (1)
+ // Arg0 = Config TDP level selected
+ // 0 = Highest Level values from MSR
+ // 1 = Middle Level values from MSR
+ // 2 = Lowest Level values from MSR
+ // 3 = reserved
+ // Return Value:
+ // None
+ //
+ // Currently we are using hard coded values for the PPCC values.
+ // A future reference code release will use PPCC values from the PPM reference code.
+ // This will allow PPCC values to be selected from SETUP options.
+ //
+ Method(STDP,1,Serialized)
+ {
+ If (LGreaterEqual(Arg0,\_PR.CLVL)){ // bounds check the input
+ Return() // invalid input
+ }
+
+ //
+ // translate requested index value to the correct PL using the sorted TDPL value.
+ //
+ Switch (ToInteger(Arg0)){
+ Case (0) {
+ Store(LEV0,Local0)
+ }
+ Case (1) {
+ Store(LEV1,Local0)
+ }
+ Case (2) {
+ Store(LEV2,Local0)
+ }
+ }
+
+ Switch (ToInteger(Local0)){
+ Case (0) {
+ CPL0() // copy PL0 values to PPCC
+ }
+ Case (1) {
+ CPL1() // copy PL1 values to PPCC
+ }
+ Case (2) {
+ CPL2() // copy PL2 values to PPCC
+ }
+ }
+
+ Notify (\_SB.PCI0.B0D4, 0x83) // Send a Power Capabilities Changed notification to self
+ }//end Method(STDP)
+
+}//end Scope(\_SB.PCI0.B0D4)
+
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/B0d4DppmPolicy.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/B0d4DppmPolicy.asl
new file mode 100644
index 0000000..1967ea4
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/B0d4DppmPolicy.asl
@@ -0,0 +1,177 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ B0d4DppmPolicy.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Dynamic Platform & Thermal Framework
+
+--*/
+
+
+Scope(\_SB.PCI0.B0D4)
+{
+ Name(CTYP,0) // Device-specific cooling policy preference
+
+ // _ACx (Active Cooling)
+ //
+ // This optional object, if present under a thermal zone, returns the
+ // temperature trip point at which OSPM must start or stop Active cooling,
+ // where x is a value between 0 and 9 that designates multiple active cooling levels of the thermal zone.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the active cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_AC0)
+ {
+ If(CTYP)
+ {
+ Store(\_SB.IETM.CTOK(PTMC),Local1) // Passive Cooling Policy
+ }
+ Else
+ {
+ Store(\_SB.IETM.CTOK(ATMC),Local1) // Active Cooling Policy
+ }
+ If(LGreaterEqual(LSTM,Local1))
+ {
+ Return(Subtract(Local1,20)) // subtract 2 degrees which is the Hysteresis
+ }
+ Else
+ {
+ Return(Local1)
+ }
+ }
+
+ // _ACx (Active Cooling)
+ //
+ // This optional object, if present under a thermal zone, returns the
+ // temperature trip point at which OSPM must start or stop Active cooling,
+ // where x is a value between 0 and 9 that designates multiple active cooling levels of the thermal zone.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the active cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_AC1)
+ {
+ If(CTYP)
+ {
+ Store(\_SB.IETM.CTOK(PTMC),Local0) // Passive Cooling Policy
+ }
+ Else
+ {
+ Store(\_SB.IETM.CTOK(ATMC),Local0) // Active Cooling Policy
+ }
+ Subtract(Local0, 50, Local0)
+
+ If(LGreaterEqual(LSTM,Local0))
+ {
+ Return(Subtract(Local0,20)) // subtract 2 degrees which is the Hysteresis
+ }
+ Else
+ {
+ Return(Local0)
+ }
+ }
+
+ // _CRT (Critical Temperature)
+ //
+ // This object, when defined under a thermal zone, returns the critical temperature at which OSPM must shutdown the system.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the critical temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_CRT,0,Serialized)
+ {
+ Return(\_SB.IETM.CTOK(SACR))
+ }
+
+ // _HOT (Hot Temperature)
+ //
+ // This optional object, when defined under a thermal zone, returns the critical temperature
+ // at which OSPM may choose to transition the system into the S4 sleeping state.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // The return value is an integer that represents the critical sleep threshold tenths of degrees Kelvin.
+ //
+ Method(_HOT,0,Serialized)
+ {
+ Return(\_SB.IETM.CTOK(SAHT))
+ }
+
+ // _PSV (Passive)
+ //
+ // This optional object, if present under a thermal zone, evaluates to the temperature
+ // at which OSPM must activate passive cooling policy.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the passive cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_PSV,0,Serialized)
+ {
+ If(CTYP)
+ {
+ Return(\_SB.IETM.CTOK(ATMC)) // Passive Cooling Policy
+ } Else {
+ Return(\_SB.IETM.CTOK(PTMC)) // Active Cooling Policy
+ }
+ }
+
+ // _SCP (Set Cooling Policy)
+ //
+ // Arguments: (3)
+ // Arg0 - Mode An Integer containing the cooling mode policy code
+ // Arg1 - AcousticLimit An Integer containing the acoustic limit
+ // Arg2 - PowerLimit An Integer containing the power limit
+ // Return Value:
+ // None
+ //
+ // Argument Information:
+ // Mode - 0 = Active, 1 = Passive
+ // Acoustic Limit - Specifies the maximum acceptable acoustic level that active cooling devices may generate.
+ // Values are 1 to 5 where 1 means no acoustic tolerance and 5 means maximum acoustic tolerance.
+ // Power Limit - Specifies the maximum acceptable power level that active cooling devices may consume.
+ // Values are from 1 to 5 where 1 means no power may be used to cool and 5 means maximum power may be used to cool.
+ //
+ Method(_SCP,3,Serialized)
+ {
+ If(LOr(LEqual(Arg0,0),LEqual(Arg0,1)))
+ {
+ Store(Arg0, CTYP)
+ P8XH(0, Arg1)
+ P8XH(1, Arg2)
+ Notify(B0D4, 0x91)
+ }
+ }
+
+} // End Scope(\_SB.PCI0.B0D4)
+
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/B0d4LpmPolicy.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/B0d4LpmPolicy.asl
new file mode 100644
index 0000000..331b322
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/B0d4LpmPolicy.asl
@@ -0,0 +1,64 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ B0d4LpmPolicy.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Intel Low Power Mode
+
+--*/
+
+
+Scope(\_SB.IETM)
+{
+ Name (LPSP, Package ()
+ {
+ //
+ // LPM Policy
+ //
+ ToUUID("B9455B06-7949-40c6-ABF2-363A70C8706C")
+ })
+
+ // CLPM (Current Low Power Mode Setting)
+ //
+ // This object evaluates to an integer that indicates the current platform desired LPM mode setting.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // 0 - Disable LPM
+ // 1 - Enable LPM
+ // 2 - Application Specific LPM
+ // 3 - Use the LPM setting as requested by the OS level interfaces either through the OS Power Plan settings or
+ // through the LPM API exposed to OS software.
+ //
+ Method (CLPM)
+ {
+ If(LEqual(\_SB.PCI0.B0D4.LPMS,0)){ // check LPM support in CPU
+ Return (0)
+ }
+ Return (LPMV) // Update LPMV based on current platform desire.
+ } // End of CLPM object
+
+}//end Scope(\_SB.IETM)
+
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/B0d4Participant.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/B0d4Participant.asl
new file mode 100644
index 0000000..69d69d6
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/B0d4Participant.asl
@@ -0,0 +1,931 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ B0d4Participant.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Dynamic Platform & Thermal Framework
+
+--*/
+
+//AMI override for fix BSOD issue
+Scope(\_SB.PCI0.B0D4)
+{
+/*
+Scope(\_SB.PCI0)
+{
+ Device(B0D4) // SA Thermal Device
+ {
+ Name(_ADR, 0x00040000)
+*/
+//AMI override for fix BSOD issue
+
+ // _STA (Status)
+ //
+ // This object returns the current status of a device.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing a device status bitmap:
+ // Bit 0 - Set if the device is present.
+ // Bit 1 - Set if the device is enabled and decoding its resources.
+ // Bit 2 - Set if the device should be shown in the UI.
+ // Bit 3 - Set if the device is functioning properly (cleared if device failed its diagnostics).
+ // Bit 4 - Set if the battery is present.
+ // Bits 5-31 - Reserved (must be cleared).
+ //
+ Method(_STA)
+ {
+ If (LEqual(SADE,1)){
+ Return(0x0F)
+ } Else {
+ Return(0x00)
+ }
+ }
+
+ //
+ // Define an OpRegion for the DPTF MSR's accessed via MCHBAR+0x5000
+ //
+ OperationRegion (MBAR, SystemMemory, Add(ShiftLeft(MHBR,15),0x5000), 0x1000)
+ Field (MBAR, ByteAcc, NoLock, Preserve)
+ {
+ Offset (0x930), // PACKAGE_POWER_SKU (MCHBAR+0x5930)
+ PTDP, 15, // TDP Package Power [14:0]
+ , 1, // reserved [15]
+ PMIN, 15, // Minimal Package Power [30:16]
+ , 1, // Reserved [31]
+ PMAX, 15, // Maximal Package Power [46:32]
+ , 1, // Reserved [47]
+ TMAX, 7, // Maximal Time Window [54:48]
+ Offset (0x938), // PACKAGE_POWER_SKU_UNIT (MCHBAR+0x5938)
+ PWRU, 4, // Power Units [3:0]
+ , 4, // Reserved [7:4]
+ EGYU, 5, // Energy Units [12:8]
+ , 3, // Reserved [15:13]
+ TIMU, 4, // Time Units [19:16]
+ Offset (0x958), // PLATFORM_INFO (MCHBAR+0x5958)
+ , 32, // [31:0]
+ LPMS, 1, // LPM Support [32]
+ CTNL, 2, // CONFIG_TDP_NUM_LEVELS [34:33]
+ Offset (0x998), // RP_STATE_CAP_0_0_0_MCHBAR_PCU (MCHBAR+0x5998)
+ RP0C, 8, // [7:0] RP0_CAP, These fields indicate the maximum RPx base frequency capability for the Integrated GFX Engine (GT).
+ RP1C, 8, // [15:8] RP1_CAP, Values are in units of 100 MHz.
+ RPNC, 8, // [23:16] RPN_CAP
+ Offset (0xF3C), // CONFIG_TDP_NOMINAL (MCHBAR+0x5F3C)
+ TRAT, 8, // TDP Ratio [7:0]
+ Offset (0xF40), // CONFIG_TDP_LEVEL1 (MCHBAR+0x5F40)
+ PTD1, 15, // Package TDP [14:0]
+ , 1, // reserved [15]
+ TRA1, 8, // TDP Ratio [23:16]
+ , 8, // reserved [31:24]
+ PMX1, 15, // Package MAX Power [46:32]
+ , 1, // reserved [47]
+ PMN1, 15, // Package MIN Power [62:48]
+ Offset (0xF48), // CONFIG_TDP_LEVEL2 (MCHBAR+0x5F48)
+ PTD2, 15, // Package TDP [14:0]
+ , 1, // reserved [15]
+ TRA2, 8, // TDP Ratio [23:16]
+ , 8, // reserved [31:24]
+ PMX2, 15, // Package MAX Power [46:32]
+ , 1, // reserved [47]
+ PMN2, 15, // Package MIN Power [62:48]
+ Offset (0xF50), // CONFIG_TDP_CONTROL (MCHBAR+0x5F50)
+ CTCL, 2, // TDP Level [1:0]
+ , 29, // reserved [30:2]
+ CLCK, 1, // Config TDP Lock [31]
+ Offset (0xF54), // TURBO_ACTIVATION_RATIO (MCHBAR+0x5F54)
+ MNTR, 8, // Max Non Turbo Ratio [7:0]
+ }
+
+ Name(XPCC,0) // semaphore to record when PPCC gets called for the first time
+
+ // PPCC (Participant Power Control Capabilities)
+ //
+ // The PPCC object evaluates to a package of packages that indicates to DPTF processor
+ // participant the power control capabilities.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // PPCC package of packages
+ //
+ Method(PPCC,0,Serialized,,PkgObj)
+ {
+ If(LAnd(LEqual(XPCC,0),CondRefOf(\_PR.CBMI))){
+ Switch(ToInteger(\_PR.CBMI)){ // use the boot index from PPM to choose the PL for PPCC
+ case(0){
+ If(LAnd(LGreaterEqual(\_PR.CLVL,1),LLessEqual(\_PR.CLVL,3))){
+ CPL0() // copy PL0 values to PPCC
+ Store(1,XPCC)
+ }
+ }
+ case(1){
+ If(LOr(LEqual(\_PR.CLVL,2),LEqual(\_PR.CLVL,3))){
+ CPL1() // copy PL1 values to PPCC
+ Store(1,XPCC)
+ }
+ }
+ case(2){
+ If(LEqual(\_PR.CLVL,3)){
+ CPL2() // copy PL2 values to PPCC
+ Store(1,XPCC)
+ }
+ }
+ }
+ }
+ Return(NPCC)
+ }
+
+ // PPCC (Participant Power Control Capabilities)
+ //
+ // The PPCC object evaluates to a package of packages that indicates to DPTF processor
+ // participant the power control capabilities.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // PPCC package of packages
+ //
+ // PPCC will be initialized by the _INI method with power on default values from the PPM code.
+ //
+ Name (NPCC, Package()
+ { // Field Name : Field Type
+ 2, // Revision : DWordConst
+
+ Package () // Power Limit 1
+ {
+ 0, // PowerLimitIndex : DWordConst = 0
+ 35000, // PowerLimitMinimum : DWordConst
+ 45000, // PowerLimitMaximum : DWordConst
+ 28, // TimeWindowMinimum : DWordConst
+ 32, // TimeWindowMaximum : DWordConst
+ 1000, // StepSize : DWordConst
+ },
+ Package () // Power Limit 2
+ {
+ 1, // PowerLimitIndex : DWordConst = 1
+ 56250, // PowerLimitMinimum : DWordConst
+ 56250, // PowerLimitMaximum : DWordConst
+ 0, // TimeWindowMinimum : DWordConst
+ 0, // TimeWindowMaximum : DWordConst
+ 1000, // StepSize : DWordConst
+ }
+ }) // End of PPCC object
+
+
+ // CPNU (Convert Power Number from MMIO register to correct Units)
+ //
+ // Arguments: (1)
+ // Arg0 = Number to be converted
+ // Arg1 = Units desired
+ // 0 = Watts
+ // 1 = MilliWatts
+ // Return Value:
+ // Converted integer
+ //
+ Method(CPNU,2,Serialized,,IntObj)
+ {
+ Name(CNVT,0) // converted number
+ Name(PPUU,0) // units
+ Name(RMDR,0) // remainder
+
+ if (LEqual(PWRU,0)) { // use PACKAGE_POWER_SKU_UNIT - Power Units[3:0]
+ Store(1,PPUU)
+ } else {
+ ShiftLeft(Decrement(PWRU),2,PPUU) // get units
+ }
+ Divide(Arg0,PPUU,RMDR,CNVT) // convert Arg0 to Watts
+
+ if(LEqual(Arg1,0)){
+ Return(CNVT) // return in watts
+ } else {
+ Multiply(CNVT,1000,CNVT) // convert to milliwatts
+ Multiply(RMDR,1000,RMDR) // convert remainder to a useful integer
+ Divide(RMDR,PPUU,Local0,RMDR) // convert remainder to watts
+ Add(CNVT,RMDR,CNVT) // add the integer part and the fraction part together
+ Return(CNVT) // return in milliwatts
+ }
+ }
+
+ // MIN4 (find next lower rounded multiple of 4)
+ //
+ // Arguments: (1)
+ // Number to be converted
+ // Return Value:
+ // Converted integer
+ //
+ Method(MIN4,1,Serialized,,IntObj)
+ {
+ Name(RMDR,0) // remainder
+ Name(DIVD,0) // dividend
+
+ Store(CPNU(Arg0,0),DIVD) // to convert Arg0 to Watts
+
+ Subtract(DIVD,1,DIVD)
+ If(LOr(LLess(DIVD,4),LEqual(DIVD,0))){
+ Return(1)
+ } Else{
+ Divide(DIVD,4,RMDR)
+ }
+
+ While(LNotEqual(RMDR,0)){
+ Subtract(DIVD,1,DIVD)
+ If(LNotEqual(DIVD,0)){
+ Divide(DIVD,4,RMDR)
+ }
+ }
+
+ Return(Multiply(DIVD,1000)) // return in milliwatts
+ }
+
+ // MAX4 (find next higher rounded multiple of 4)
+ //
+ // Arguments: (1)
+ // Number to be converted
+ // Return Value:
+ // Converted integer
+ //
+ Method(MAX4,1,Serialized,,IntObj)
+ {
+ Name(RMDR,0) // remainder
+ Name(DIVD,0) // dividend
+
+ Store(CPNU(Arg0,0),DIVD) // to convert Arg0 to Watts
+
+ Add(DIVD,1,DIVD)
+ Divide(DIVD,4,RMDR)
+
+ While(LNotEqual(RMDR,0)){
+ Add(DIVD,1,DIVD)
+ Divide(DIVD,4,RMDR)
+ }
+
+ Return(Multiply(DIVD,1000)) // return in milliwatts
+ }
+
+ // CPL0 (Copy PL0 power limits to PPCC)
+ //
+ // Arguments:
+ // None
+ // Return Value:
+ // None
+ //
+ Method(CPL0,0)
+ {
+ Store (2,Index(\_SB.PCI0.B0D4.NPCC,0)) // Revision
+ Store (0,Index(DerefOf(Index(\_SB.PCI0.B0D4.NPCC,1)),0)) // PowerLimitIndex
+ If (LEqual(\MPLT, 0)){
+ Store (MIN4(\_PR.PL10),Index(DerefOf(Index(\_SB.PCI0.B0D4.NPCC,1)),1)) // PowerLimitMinimum
+ } Else {
+ Store (\MPLT,Index(DerefOf(Index(\_SB.PCI0.B0D4.NPCC,1)),1)) // PowerLimitMinimum
+ }
+ Store (CPNU(\_PR.PL10,1),Index(DerefOf(Index(\_SB.PCI0.B0D4.NPCC,1)),2)) // PowerLimitMaximum
+ Store (\_PR.PLW0,Index(DerefOf(Index(\_SB.PCI0.B0D4.NPCC,1)),3)) // TimeWindowMinimum
+ Add (\_PR.PLW0,4,Index(DerefOf(Index(\_SB.PCI0.B0D4.NPCC,1)),4)) // TimeWindowMaximum
+ Store (PPSZ,Index(DerefOf(Index(\_SB.PCI0.B0D4.NPCC,1)),5)) // StepSize
+ Store (1,Index(DerefOf(Index(\_SB.PCI0.B0D4.NPCC,2)),0)) // PowerLimitIndex
+ Store (CPNU(\_PR.PL20,1),Index(DerefOf(Index(\_SB.PCI0.B0D4.NPCC,2)),1)) // PowerLimitMinimum
+ Store (CPNU(\_PR.PL20,1),Index(DerefOf(Index(\_SB.PCI0.B0D4.NPCC,2)),2)) // PowerLimitMaximum
+ Store (0,Index(DerefOf(Index(\_SB.PCI0.B0D4.NPCC,2)),3)) // TimeWindowMinimum
+ Store (0,Index(DerefOf(Index(\_SB.PCI0.B0D4.NPCC,2)),4)) // TimeWindowMaximum
+ Store (PPSZ,Index(DerefOf(Index(\_SB.PCI0.B0D4.NPCC,2)),5)) // StepSize
+ }
+
+ // CPL1 (Copy PL1 power limits to PPCC)
+ //
+ // Arguments:
+ // None
+ // Return Value:
+ // None
+ //
+ Method(CPL1,0)
+ {
+ Store (2,Index(\_SB.PCI0.B0D4.NPCC,0)) // Revision
+ Store (0,Index(DerefOf(Index(\_SB.PCI0.B0D4.NPCC,1)),0)) // PowerLimitIndex
+ If (LEqual(\MPLT, 0)){
+ Store (MIN4(\_PR.PL11),Index(DerefOf(Index(\_SB.PCI0.B0D4.NPCC,1)),1)) // PowerLimitMinimum
+ } Else {
+ Store (\MPLT,Index(DerefOf(Index(\_SB.PCI0.B0D4.NPCC,1)),1)) // PowerLimitMinimum
+ }
+ Store (CPNU(\_PR.PL11,1),Index(DerefOf(Index(\_SB.PCI0.B0D4.NPCC,1)),2)) // PowerLimitMaximum
+ Store (\_PR.PLW1,Index(DerefOf(Index(\_SB.PCI0.B0D4.NPCC,1)),3)) // TimeWindowMinimum
+ Add (\_PR.PLW1,4,Index(DerefOf(Index(\_SB.PCI0.B0D4.NPCC,1)),4)) // TimeWindowMaximum
+ Store (PPSZ,Index(DerefOf(Index(\_SB.PCI0.B0D4.NPCC,1)),5)) // StepSize
+ Store (1,Index(DerefOf(Index(\_SB.PCI0.B0D4.NPCC,2)),0)) // PowerLimitIndex
+ Store (CPNU(\_PR.PL21,1),Index(DerefOf(Index(\_SB.PCI0.B0D4.NPCC,2)),1)) // PowerLimitMinimum
+ Store (CPNU(\_PR.PL21,1),Index(DerefOf(Index(\_SB.PCI0.B0D4.NPCC,2)),2)) // PowerLimitMaximum
+ Store (0,Index(DerefOf(Index(\_SB.PCI0.B0D4.NPCC,2)),3)) // TimeWindowMinimum
+ Store (0,Index(DerefOf(Index(\_SB.PCI0.B0D4.NPCC,2)),4)) // TimeWindowMaximum
+ Store (PPSZ,Index(DerefOf(Index(\_SB.PCI0.B0D4.NPCC,2)),5)) // StepSize
+ }
+
+ // CPL2 (Copy PL2 power limits to PPCC)
+ //
+ // Arguments:
+ // None
+ // Return Value:
+ // None
+ //
+ Method(CPL2,0)
+ {
+ Store (2,Index(\_SB.PCI0.B0D4.NPCC,0)) // Revision
+ Store (0,Index(DerefOf(Index(\_SB.PCI0.B0D4.NPCC,1)),0)) // PowerLimitIndex
+ If (LEqual(\MPLT, 0)){
+ Store (MIN4(\_PR.PL12),Index(DerefOf(Index(\_SB.PCI0.B0D4.NPCC,1)),1)) // PowerLimitMinimum
+ } Else {
+ Store (\MPLT,Index(DerefOf(Index(\_SB.PCI0.B0D4.NPCC,1)),1)) // PowerLimitMinimum
+ }
+ Store (CPNU(\_PR.PL12,1),Index(DerefOf(Index(\_SB.PCI0.B0D4.NPCC,1)),2)) // PowerLimitMaximum
+ Store (\_PR.PLW2,Index(DerefOf(Index(\_SB.PCI0.B0D4.NPCC,1)),3)) // TimeWindowMinimum
+ Add (\_PR.PLW2,4,Index(DerefOf(Index(\_SB.PCI0.B0D4.NPCC,1)),4)) // TimeWindowMaximum
+ Store (PPSZ,Index(DerefOf(Index(\_SB.PCI0.B0D4.NPCC,1)),5)) // StepSize
+ Store (1,Index(DerefOf(Index(\_SB.PCI0.B0D4.NPCC,2)),0)) // PowerLimitIndex
+ Store (CPNU(\_PR.PL22,1),Index(DerefOf(Index(\_SB.PCI0.B0D4.NPCC,2)),1)) // PowerLimitMinimum
+ Store (CPNU(\_PR.PL22,1),Index(DerefOf(Index(\_SB.PCI0.B0D4.NPCC,2)),2)) // PowerLimitMaximum
+ Store (0,Index(DerefOf(Index(\_SB.PCI0.B0D4.NPCC,2)),3)) // TimeWindowMinimum
+ Store (0,Index(DerefOf(Index(\_SB.PCI0.B0D4.NPCC,2)),4)) // TimeWindowMaximum
+ Store (PPSZ,Index(DerefOf(Index(\_SB.PCI0.B0D4.NPCC,2)),5)) // StepSize
+ }
+
+ Name (LSTM,0) // Last temperature reported
+
+ // _PPC (Performance Present Capabilities)
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the range of states supported
+ // 0 - States 0 through nth state are available (all states available)
+ // 1 - States 1 through nth state are available
+ // 2 - States 2 through nth state are available
+ // ...
+ // n - State n is available only
+ //
+ Name(_PPC,0)
+
+ // SPPC (Set Participant Performance Capability)
+ //
+ // SPPC is a control method object that takes one integer parameter that will indicate the maximum allowable
+ // P-State for OSPM to use at any given time.
+ //
+ // Arguments: (1)
+ // Arg0 - integer
+ // Return Value:
+ // None
+ //
+ Method(SPPC,1,Serialized)
+ {
+ Store(Arg0, \_PR.CPU0._PPC) // Note: CPU0._PPC is an Integer not a Method
+
+ If(CondRefOf(\_SB.PCCD.PENB)) { // is CPPC enabled in SETUP?
+ Notify(\_SB.PCCD,0x82) // CPPC notify
+ } Else {
+ Switch(ToInteger(TCNT)){
+ Case(8){
+ Notify(\_PR.CPU0, 0x80) // Tell CPU0 driver to re-eval _PPC
+ Notify(\_PR.CPU1, 0x80) // Tell CPU1 driver to re-eval _PPC
+ Notify(\_PR.CPU2, 0x80) // Tell CPU2 driver to re-eval _PPC
+ Notify(\_PR.CPU3, 0x80) // Tell CPU3 driver to re-eval _PPC
+ Notify(\_PR.CPU4, 0x80) // Tell CPU4 driver to re-eval _PPC
+ Notify(\_PR.CPU5, 0x80) // Tell CPU5 driver to re-eval _PPC
+ Notify(\_PR.CPU6, 0x80) // Tell CPU6 driver to re-eval _PPC
+ Notify(\_PR.CPU7, 0x80) // Tell CPU7 driver to re-eval _PPC
+ }
+ Case(4){
+ Notify(\_PR.CPU0, 0x80) // Tell CPU0 driver to re-eval _PPC
+ Notify(\_PR.CPU1, 0x80) // Tell CPU1 driver to re-eval _PPC
+ Notify(\_PR.CPU2, 0x80) // Tell CPU2 driver to re-eval _PPC
+ Notify(\_PR.CPU3, 0x80) // Tell CPU3 driver to re-eval _PPC
+ }
+ Case(2){
+ Notify(\_PR.CPU0, 0x80) // Tell CPU0 driver to re-eval _PPC
+ Notify(\_PR.CPU1, 0x80) // Tell CPU1 driver to re-eval _PPC
+ }
+ Default{
+ Notify(\_PR.CPU0, 0x80) // Tell CPU0 driver to re-eval _PPC
+ }
+ }
+ }
+ }
+
+ Name (TLPO, Package()
+ {
+ 1, // Revision, DwordConst
+ 1, // LPOEnable, DwordConst
+ 0, // LPOStartPState, DwordConst
+ 1, // LPOStepSize, DwordConst
+ 1, // LPOPowerControlSetting, DwordConst
+ 2 // LPOPerformanceControlSetting, DwordConst
+ })
+
+ // CLPO (Current Logical Processor Off lining Setting)
+ //
+ // This object is utilized only by DPPM Passive policy. It is not required to implement this object for LPM.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // This object evaluates to a package that indicates the LPO Control preferences.
+ //
+ Method(CLPO,,,,PkgObj)
+ {
+ Store (LPOE,Index(TLPO,1)) // LPOEnable
+
+ If(CondRefOf(\_PR.CPU0._PSS)){ // LPOStartPState
+ Store(SizeOf(\_PR.CPU0._PSS()),Local1) // bounds check with _PSS
+ } //
+ Else //
+ { //
+ Store (0,Local1) //
+ } //
+ If(LLess(LPOP,Local1)){ //
+ Store (LPOP,Index(TLPO,2)) //
+ } //
+ Else //
+ { //
+ Decrement(Local1) // Index of LFM entry in _PSS
+ Store (Local1,Index(TLPO,2)) //
+ } //
+
+ Store (LPOS,Index(TLPO,3)) // LPOStepSize
+ Store (LPOW,Index(TLPO,4)) // LPOPowerControlSetting
+ Store (LPER,Index(TLPO,5)) // LPOPerformanceControlSetting
+
+ Return(TLPO)
+ }
+
+ // AEXL (Application Exclusion List)
+ //
+ // There is a limit of 256 strings for this package. If the list is a bigger number than the limit, it is not effective to use LPO.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // This object evaluates to a package of strings representing the application names that the DPTF processor participant
+ // will exclude from core off lining when LPO is triggered.
+ //
+ Name (AEXL, Package()
+ {
+ "svchost.exe", "dllhost.exe", "smss.exe", "WinSAT.exe"
+ })
+
+ // PCCC (Participant Current Control Capabilities)
+ //
+ // The PCCC object evaluates to a package of packages that indicates to DPTF processor participant the Icc control capabilities.
+ //
+ // Arguments: (0)
+ // None
+ //
+ // Return Value:
+ // A package of packages as described below:
+ //
+ // Package()
+ // {
+ // 0x80000000, // DWordConst, Revision
+ // Package ()
+ // {
+ // 0x80000000, // DWordConst, CurrentLimitMinimum in milli Amps
+ // 0x80000000, // DWordConst, CurrentLimitMaximum in milli Amps
+ // }
+ // }
+ Method(PCCC,0,Serialized,,PkgObj)
+ {
+ Store (1,Index(PCCX,0)) // Revision
+ Switch(ToInteger(CPNU(PTDP,0))){ // SKU check
+ case(57){
+ Store (43000,Index(DerefOf(Index(PCCX,1)),0)) // CurrentLimitMinimum
+ Store (95000,Index(DerefOf(Index(PCCX,1)),1)) // CurrentLimitMaximum
+ }
+ case(47){
+ Store (39000,Index(DerefOf(Index(PCCX,1)),0)) // CurrentLimitMinimum
+ Store (85000,Index(DerefOf(Index(PCCX,1)),1)) // CurrentLimitMaximum
+ }
+ case(37){
+ Store (29000,Index(DerefOf(Index(PCCX,1)),0)) // CurrentLimitMinimum
+ Store (55000,Index(DerefOf(Index(PCCX,1)),1)) // CurrentLimitMaximum
+ }
+ case(25){
+ Store (16000,Index(DerefOf(Index(PCCX,1)),0)) // CurrentLimitMinimum
+ Store (32000,Index(DerefOf(Index(PCCX,1)),1)) // CurrentLimitMaximum
+ }
+ case(15){
+ Store (14000,Index(DerefOf(Index(PCCX,1)),0)) // CurrentLimitMinimum
+ Store (32000,Index(DerefOf(Index(PCCX,1)),1)) // CurrentLimitMaximum
+ }
+ case(11){
+ Store (14000,Index(DerefOf(Index(PCCX,1)),0)) // CurrentLimitMinimum
+ Store (25000,Index(DerefOf(Index(PCCX,1)),1)) // CurrentLimitMaximum
+ }
+ Default{ // UNKNOWN SKU
+ Store (0xFF,Index(DerefOf(Index(PCCX,1)),0)) // CurrentLimitMinimum
+ Store (0xFF,Index(DerefOf(Index(PCCX,1)),1)) // CurrentLimitMaximum
+ }
+ } // End of Switch(PTDP)
+
+ Return(PCCX)
+ } // End of PCCC object
+
+ // PCCX (Participant Current Control Capabilities temp structure)
+ //
+ // This is used to pass data from the PCCC object to the PDRT object.
+ //
+ Name (PCCX, Package()
+ {
+ 0x80000000, // DWordConst, Revision
+
+ Package ()
+ {
+ 0x80000000, // DWordConst, CurrentLimitMinimum
+ 0x80000000, // DWordConst, CurrentLimitMaximum
+ }
+ }) // End of PCCC object
+
+ // KEFF (VR efficiency Table)
+ //
+ // This object evaluates to a package of packages that indicates the VR efficiency factor for various processor power.
+ //
+ // Arguments: (0)
+ // None
+ //
+ // Return Value:
+ // A package of packages.
+ //
+ Name(KEFF, Package()
+ {
+ // Processor PMAX, Efficiency
+ Package () {444, 0},
+ Package () {463, 39},
+ Package () {481, 75},
+ Package () {499, 108},
+ Package () {518, 139},
+ Package () {536, 168},
+ Package () {554, 195},
+ Package () {573, 221},
+ Package () {591, 244},
+ Package () {609, 267},
+ Package () {628, 287},
+ Package () {812, 445},
+ Package () {983, 551},
+ Package () {1163, 621},
+ Package () {1342, 673},
+ Package () {1527, 710},
+ Package () {1704, 742},
+ Package () {1885, 767},
+ Package () {2072, 785},
+ Package () {2255, 802},
+ Package () {6044, 897},
+ Package () {11740, 924},
+ Package () {17576, 926},
+ Package () {23605, 919},
+ Package () {29821, 909},
+ Package () {36223, 898},
+ Package () {42856, 886},
+ Package () {49723, 873},
+ Package () {56870, 858},
+ Package () {64380, 842}
+ })
+
+ Name (CEUP, Package()
+ {
+ 0x80000000,
+ 0x80000000,
+ 0x80000000,
+ 0x80000000,
+ 0x80000000,
+ 0x80000000
+ })
+
+ // CEUC (Current Execution Unit Configuration)
+ //
+ // This object evaluates to a package that indicates the Execution Unit Control preferences.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // Package {
+ // Revision // DWordConst - 0x1 for Sharkbay and Clovertrail platform.
+ // EUEnable // DwordConst - If this option is 0 then policy does not use any active core controls for graphics.
+ // TargetGfxFreq // DwordConst - Returns graphics frequency in MHz.
+ // MaxActiveEUs // DwordConst - Provides the max limit for the number of EUs that driver can request while in passive control.
+ // MinActiveEUs // DwordConst - Provides the min limit for the number of EUs that driver can request while in passive control.
+ // StepSize // DwordConst - Instructs the policy to take away EU in the specified percentage steps. E.g. if StepSize is 50% then policy would take away 1/2 of EUs at a time.
+ // }
+ //
+ Method(CEUC,,,,PkgObj)
+ {
+ Store(0x1, Index(CEUP,0)) // Revision
+ Store(ECEU, Index(CEUP,1)) // Enable/disable
+ Store(TGFG, Index(CEUP,2)) // Gfx frequency
+ Store(40, Index(CEUP,3)) // Max
+ Store(20, Index(CEUP,4)) // Min
+ Store(20, Index(CEUP,5)) // step size
+
+ Return(CEUP)
+ } // end of CEUC object
+
+ // _TMP (Temperature)
+ //
+ // This control method returns the thermal zone's current operating temperature.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the current temperature of the thermal zone (in tenths of degrees Kelvin)
+ //
+ //AMI override begin
+ //Method(_TMP)
+ Method(TMPX)
+ //AMI override end
+ {
+ // Return the temperature to the OS if EC access is enabled.
+ If(\ECON)
+ {
+ Return(\_SB.IETM.CTOK(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PMAX))))
+ }
+ Else
+ {
+ // Return a static value if EC access is disabled.
+ Return(3000)
+ }
+ }
+
+ // _DTI (Device Temperature Indication)
+ //
+ // Conveys the temperature of a device's internal temperature sensor to the platform when a temperature trip point
+ // is crossed or when a meaningful temperature change occurs.
+ //
+ // Arguments: (1)
+ // Arg0 - An Integer containing the current value of the temperature sensor (in tenths Kelvin)
+ // Return Value:
+ // None
+ //
+ Method(_DTI, 1)
+ {
+ Store(Arg0,LSTM)
+ Notify(B0D4, 0x91) // notify the participant of a trip point change event
+ }
+
+ // _NTT (Notification Temperature Threshold)
+ //
+ // Returns the temperature change threshold for devices containing native temperature sensors to cause
+ // evaluation of the _DTI object
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the temperature threshold in tenths of degrees Kelvin.
+ //
+ Method(_NTT, 0)
+ {
+ Return(2782) // 5 degree Celcius, this could be a platform policy with setup item
+ }
+
+ // _PSS (Performance Supported States)
+ //
+ // This optional object indicates to OSPM the number of supported processor performance states that any given system can support.
+ //
+ // Arguments: (1)
+ // None
+ // Return Value:
+ // A variable-length Package containing a list of Pstate sub-packages as described below
+ //
+ // Return Value Information
+ // Package {
+ // PState [0] // Package - Performance state 0
+ // ....
+ // PState [n] // Package - Performance state n
+ // }
+ //
+ // Each Pstate sub-Package contains the elements described below:
+ // Package {
+ // CoreFrequency // Integer (DWORD)
+ // Power // Integer (DWORD)
+ // Latency // Integer (DWORD)
+ // BusMasterLatency // Integer (DWORD)
+ // Control // Integer (DWORD)
+ // Status // Integer (DWORD)
+ // }
+ //
+ // Stub for the Actual CPU _PSS method.
+ //
+ Method(_PSS,,,,PkgObj)
+ {
+ If(CondRefOf(\_PR.CPU0._PSS))
+ { // Ensure _PSS is present
+ Return(\_PR.CPU0._PSS())
+ } Else {
+ Return(Package(){
+ Package(){0,0,0,0,0,0},
+ Package(){0,0,0,0,0,0}})
+ }
+ }
+
+ // _TSS (Throttling Supported States)
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // A variable-length Package containing a list of Tstate sub-packages as described below
+ //
+ // Return Value Information
+ // Package {
+ // TState [0] // Package - Throttling state 0
+ // ....
+ // TState [n] // Package - Throttling state n
+ // }
+ //
+ // Each Tstate sub-Package contains the elements described below:
+ // Package {
+ // Percent // Integer (DWORD)
+ // Power // Integer (DWORD)
+ // Latency // Integer (DWORD)
+ // Control // Integer (DWORD)
+ // Status // Integer (DWORD)
+ // }
+ //
+ // Stub for the Actual CPU _TSS method.
+ //
+ Method(_TSS,,,,PkgObj)
+ {
+ If(CondRefOf(\_PR.CPU0._TSS))
+ { // Ensure _TSS is present
+ Return(\_PR.CPU0._TSS())
+ } Else {
+ Return(Package(){
+ Package(){0,0,0,0,0},
+ Package(){0,0,0,0,0}})
+ }
+ }
+
+ // _TPC (Throttling Present Capabilities)
+ //
+ // This optional object is a method that dynamically indicates to OSPM the number of throttling states currently supported by the platform.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the number of states supported:
+ // 0 - states 0 .. nth state available (all states available)
+ // 1 - state 1 .. nth state available
+ // 2 - state 2 .. nth state available
+ // ...
+ // n - state n available only
+ //
+ Method(_TPC)
+ {
+ If(CondRefOf(\_PR.CPU0._TPC))
+ { // Ensure _TPC is present
+ Return(\_PR.CPU0._TPC)
+ } Else {
+ Return(0)
+ }
+ }
+
+ // _PTC (Processor Throttling Control)
+ //
+ // _PTC is an optional object that defines a processor throttling control interface alternative to the I/O address spaced-based P_BLK throttling control register (P_CNT)
+ //
+ // PDC0[2] = ACPI object indicating if OSPM is capable of direct access to On Demand throttling MSR
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // A Package as described below
+ //
+ // Return Value Information
+ // Package {
+ // ControlRegister // Buffer (Resource Descriptor)
+ // StatusRegister // Buffer (Resource Descriptor)
+ // }
+ //
+ Method(_PTC,,,,PkgObj)
+ {
+ If(LAnd(CondRefOf(\PDC0),LNotEqual(\PDC0,0x80000000))) // is object present and initialized?
+ {
+ If(And(\PDC0, 0x0004)) { // does OS support MSR interface?
+ Return(Package() {
+ ResourceTemplate(){Register(FFixedHW, 0, 0, 0)},
+ ResourceTemplate(){Register(FFixedHW, 0, 0, 0)} }) // if OS supports MSR interface
+ } Else {
+ Return(Package() {
+ ResourceTemplate(){Register(SystemIO, 5, 0, PCH_ACPI_PBLK)},
+ ResourceTemplate(){Register(SystemIO, 5, 0, PCH_ACPI_PBLK)} }) // if OS support IO based interface
+ }
+ } Else {
+ Return(Package() {
+ ResourceTemplate(){Register(FFixedHW, 0, 0, 0)},
+ ResourceTemplate(){Register(FFixedHW, 0, 0, 0)} }) // if object is not present or not initialized then return MSR interface
+ }
+ }
+
+ // _TSD (T-State Dependency)
+ //
+ // This optional object provides T-state control cross logical processor dependency information to OSPM.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // A variable-length Package containing a list of T-state dependency Packages as described below.
+ //
+ // Return Value Information
+ // Package {
+ // NumEntries // Integer
+ // Revision // Integer (BYTE)
+ // Domain // Integer (DWORD)
+ // CoordType // Integer (DWORD)
+ // NumProcessors // Integer (DWORD)
+ // }
+ //
+ Method(_TSD,,,,PkgObj)
+ {
+ If(CondRefOf(\_PR.CPU0._TSD))
+ { // Ensure _TSD is present
+ Return(\_PR.CPU0._TSD())
+ } Else {
+ Return(Package(){
+ Package(){5,0,0,0,0},
+ Package(){5,0,0,0,0}})
+ }
+ }
+
+ // _TDL (T-state Depth Limit)
+ //
+ // This optional object evaluates to the _TSS entry number of the lowest power throttling state that OSPM may use.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the Throttling Depth Limit _TSS entry number:
+ // 0 - throttling disabled.
+ // 1 - state 1 is the lowest power T-state available.
+ // 2 - state 2 is the lowest power T-state available.
+ // ...
+ // n - state n is the lowest power T-state available.
+ //
+ Method(_TDL)
+ {
+ If(LAnd(CondRefOf(\_PR.CPU0._TSS),CondRefOf(\_PR.CFGD)))
+ { // Ensure _TSS is present
+ If(And(\_PR.CFGD, PPM_TSTATE_FINE_GRAINED))
+ {
+ Return(Subtract(SizeOf(\_PR.CPU0.TSMF),1))
+ } Else {
+ Return(Subtract(SizeOf(\_PR.CPU0.TSMC),1))
+ }
+ } Else {
+ Return(0)
+ }
+ }
+
+ // _PDL (P-state Depth Limit)
+ //
+ // This optional object evaluates to the _PSS entry number of the lowest performance P-state that OSPM may use when performing passive thermal control.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the P-state Depth Limit _PSS entry number:
+ // Integer containing the P-state Depth Limit _PSS entry number:
+ // 0 - P0 is the only P-state available for OSPM use
+ // 1 - state 1 is the lowest power P-state available
+ // 2 - state 2 is the lowest power P-state available
+ // ...
+ // n - state n is the lowest power P-state available
+ //
+ Method(_PDL)
+ {
+ If(CondRefOf(\_PR.CPU0._PSS))
+ { // Ensure _PSS is present
+ Return(Subtract(SizeOf(\_PR.CPU0._PSS),1))
+ } Else {
+ Return(0)
+ }
+ }
+//AMI override for BSOD issue
+} // End Scope(\_SB.PCI0.B0D4)
+/*
+ }// End Device(B0D4)
+} // End Scope(\_SB.PCI0)
+*/
+//AMI override for BSOD issue \ No newline at end of file
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/DplyParticipant.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/DplyParticipant.asl
new file mode 100644
index 0000000..d27182c
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/DplyParticipant.asl
@@ -0,0 +1,176 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ DplyParticipant.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Dynamic Platform & Thermal Framework
+
+--*/
+Scope(\_SB.PCI0)
+{
+
+ Device(DPLY) // Display participant
+ {
+ Name(_HID, EISAID("INT3406"))
+ Name(_UID, 0)
+
+ Name(BDLI, 32) // Brightness depth limit index corresponding to 30%
+ Name(BDHI, 82) // Brightness peformance/power ceiling limit index corresponding to 80%
+
+
+ // _STA (Status)
+ //
+ // This object returns the current status of a device.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing a device status bitmap:
+ // Bit 0 - Set if the device is present.
+ // Bit 1 - Set if the device is enabled and decoding its resources.
+ // Bit 2 - Set if the device should be shown in the UI.
+ // Bit 3 - Set if the device is functioning properly (cleared if device failed its diagnostics).
+ // Bit 4 - Set if the battery is present.
+ // Bits 5-31 - Reserved (must be cleared).
+ //
+ Method(_STA)
+ {
+ If (LEqual(DISE,1)){
+ Return(0x0F)
+ } Else {
+ Return(0x00)
+ }
+ }
+
+ // DDDL ( Dptf Display Depth Limit)
+ //
+ // The DDDL object indicates dynamically a lower limit on the brightness control levels currently supported by the platform
+ // for the participant. Value returned indicates a Power/Percentage value that is in the _BCL brightness list.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // Index in Brightness level list
+ //
+ Method(DDDL, 0)
+ {
+ Return(BDLI)
+ }
+
+ // DDPC ( Dptf Display Power/performance Control)
+ //
+ // The DDPC object indicates dynamically a higher limit (ceiling) on the brightness control levels currently supported by
+ // the platform for the participant.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // Index in Brightness level list
+ //
+ Method(DDPC, 0)
+ {
+ Return(BDHI)
+ }
+
+ // _BCL (Query List of Brightness Control Levels Supported)
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // A variable-length Package containing a list of Integers representing the supported brightness levels.
+ // Each integer has 8 bits of significant data.
+ // List of supported brightness levels in the following sequence:
+ // Level when machine has full power.
+ // Level when machine is on batteries.
+ // Other supported levels.
+ // Package(){80, 50, 0, 1, 2, 3, 4, 5, ..., 96, 97, 98, 99, 100}
+ //
+ Method(_BCL,,,,PkgObj)
+ {
+ If(CondRefOf(\_SB.PCI0.GFX0.DD1F._BCL))
+ {
+ Return(\_SB.PCI0.GFX0.DD1F._BCL())
+ } Else {
+ Return(Package(){0})
+ }
+ }
+
+ // _BCM (Set the Brightness Level)
+ //
+ // Arguments: (1)
+ // Arg0 - An Integer containing the new brightness level
+ // Return Value:
+ // None
+ //
+ Method(_BCM,1)
+ {
+ If(CondRefOf(\_SB.PCI0.GFX0.DD1F._BCM))
+ {
+ \_SB.PCI0.GFX0.DD1F._BCM(Arg0)
+ }
+ }
+
+ // _BQC (Brightness Query Current level)
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the current brightness level (must be one of the values returned from the _BCL method)
+ //
+ Method(_BQC,0)
+ {
+ If(CondRefOf(\_SB.PCI0.GFX0.DD1F._BQC))
+ {
+ Return(\_SB.PCI0.GFX0.DD1F._BQC())
+ } Else {
+ Return(0x00)
+ }
+ }
+
+ // _DCS (Return the Status of Output Device)
+ //
+ //Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the device status (32 bits)
+ // Bit Definitions
+ // [0] - Output connector exists in the system now
+ // [1] - Output is activated
+ // [2] - Output is ready to switch
+ // [3] - Output is not defective (it is functioning properly)
+ // [4] - Device is attached (this is optional)
+ // [31:5] Reserved (must be zero)
+ //
+ Method(_DCS,0)
+ {
+ If(CondRefOf(\_SB.PCI0.GFX0.DD1F._DCS))
+ {
+ Return(\_SB.PCI0.GFX0.DD1F._DCS())
+ } Else {
+ Return(0x00)
+ }
+ }
+
+ } // End DPLY Device
+}// end Scope(\_SB.PCI0)
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/Dppm.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Dppm.asl
new file mode 100644
index 0000000..f912020
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Dppm.asl
@@ -0,0 +1,66 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ Dppm.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Intel Dynamic Power Performance Management
+
+--*/
+
+
+Scope(\_SB.IETM)
+{
+
+ //
+ // DPPM Passive Policy
+ //
+ Name (DPSP, Package ()
+ {
+ ToUUID("42A441D6-AE6A-462B-A84B-4A8CE79027D3"),
+ })
+
+ //
+ // DPPM Active Policy
+ //
+ Name (DASP, Package ()
+ {
+ ToUUID("3A95C389-E4B8-4629-A526-C52C88626BAE"),
+ })
+
+ //
+ // DPPM Crtical Policy
+ //
+ Name (DCSP, Package ()
+ {
+ ToUUID("97C68AE7-15FA-499c-B8C9-5DA81D606E0A"),
+ })
+
+ //
+ // DPPM Cooling Mode Policy
+ //
+ Name (DMSP, Package ()
+ {
+ ToUUID("16CAF1B7-DD38-40ed-B1C1-1B8A1913D531")
+ })
+} // End Scope(\_SB.IETM)
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/Dptf.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Dptf.asl
new file mode 100644
index 0000000..38244b1
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Dptf.asl
@@ -0,0 +1,852 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ Dptf.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Dynamic Platform & Thermal Framework
+
+--*/
+
+#include "PowerMgmtDefinitions.h"
+
+DefinitionBlock (
+ "Dptf.aml",
+ "SSDT",
+ 1,
+ "DptfTabl",
+ "DptfTabl",
+ 0x1000
+ )
+{
+
+
+External(P8XH, MethodObj)
+External(ECON, IntObj)
+External(TSOD, IntObj)
+External(PNHM, IntObj)
+External(TCNT, IntObj)
+External(\MPLT, IntObj)
+External(\PWRS, Intobj)
+External(LPMV, IntObj)
+External(CRTT, IntObj)
+External(ATMC, IntObj)
+External(PTMC, IntObj)
+External(ATRA, IntObj)
+External(PTRA, IntObj)
+External(ACTT, IntObj)
+External(PSVT, IntObj)
+External(ATPC, IntObj)
+External(PTPC, IntObj)
+
+External(DPTF, IntObj) // EnableDptf
+External(SADE, IntObj) // EnableSaDevice
+External(SACR, IntObj) // CriticalThermalTripPointSa
+External(SAHT, IntObj) // HotThermalTripPointSa
+
+External(PCHD, IntObj) // EnablePchDevice
+External(PCHC, IntObj) // CriticalThermalTripPointPch
+External(PCHH, IntObj) // HotThermalTripPointPch
+
+External(MEMD, IntObj) // EnableMemoryDevice
+External(MEMC, IntObj) // CriticalThermalTripPointTMEM
+External(MEMH, IntObj) // HotThermalTripPointTMEM
+
+External(FND1, IntObj) // EnableFan1Device
+External(FND2, IntObj) // EnableFan2Device
+
+External(AMBD, IntObj) // EnableAmbientDevice
+External(AMAT, IntObj) // ActiveThermalTripPointAmbient
+External(AMPT, IntObj) // PassiveThermalTripPointAmbient
+External(AMCT, IntObj) // CriticalThermalTripPointAmbient
+External(AMHT, IntObj) // HotThermalTripPointAmbient
+
+External(SKDE, IntObj) // EnableSkinDevice
+External(SKAT, IntObj) // ActiveThermalTripPointSkin
+External(SKPT, IntObj) // PassiveThermalTripPointSkin
+External(SKCT, IntObj) // CriticalThermalTripPointSkin
+External(SKHT, IntObj) // HotThermalTripPointSkin
+
+External(EFDE, IntObj) // EnableExhaustFanDevice
+External(EFAT, IntObj) // ActiveThermalTripPointExhaustFan
+External(EFPT, IntObj) // PassiveThermalTripPointExhaustFan
+External(EFCT, IntObj) // CriticalThermalTripPointExhaustFan
+External(EFHT, IntObj) // HotThermalTripPointExhaustFan
+
+External(VRDE, IntObj) // EnableVRDevice
+External(VRAT, IntObj) // ActiveThermalTripPointVR
+External(VRPT, IntObj) // PassiveThermalTripPointVR
+External(VRCT, IntObj) // CriticalThermalTripPointVR
+External(VRHT, IntObj) // HotThermalTripPointVR
+
+External(WIFD, IntObj) // EnableWifiDevice
+External(WFAT, IntObj) // ActiveThermalTripPointWifi
+External(WFPT, IntObj) // PassiveThermalTripPointWifi
+External(WFCT, IntObj) // CriticalThermalTripPointWifi
+External(WFHT, IntObj) // ActiveHotThermalTripPointWifi
+
+External(WAND, IntObj) // EnableWWANDevice
+External(WWAT, IntObj) // ActiveThermalTripPointWWAN
+External(WWPT, IntObj) // PassiveThermalTripPointWWAN
+External(WWCT, IntObj) // CriticalThermalTripPointWWAN
+External(WWHT, IntObj) // ActiveHotThermalTripPointWWAN
+
+External(WGID, IntObj) // EnableWGigDevice
+External(WGAT, IntObj) // ActiveThermalTripPointWGig
+External(WGPT, IntObj) // PassiveThermalTripPointWGig
+External(WGCT, IntObj) // CriticalThermalTripPointWGig
+External(WGHT, IntObj) // ActiveHotThermalTripPointWGig
+
+External(CTDP, IntObj) // EnableCtdpPolicy
+External(LPMP, IntObj) // EnableLpmPolicy
+External(DPAP, IntObj) // EnableActivePolicy
+External(DPPP, IntObj) // EnablePassivePolicy
+External(DPCP, IntObj) // EnableCriticalPolicy
+External(DCMP, IntObj) // EnableCoolingModePolicy
+External(ECEU, IntObj) // EnableCurrentExecutionUnit
+External(TGFG, IntObj) // TargetGfxFreq
+External(TRTV, IntObj) // TrtRevision
+External(PWRE, IntObj) // EnablePowerDevice
+External(PWRP, IntObj) // EnablePowerPolicy
+
+External(LPOE, IntObj) // LPOEnable
+External(LPOP, IntObj) // LPOStartPState
+External(LPOS, IntObj) // LPOStepSize
+External(LPOW, IntObj) // LPOPowerControlSetting
+External(LPER, IntObj) // LPOPerformanceControlSetting
+
+External(PPSZ, IntObj) // PPCC Step Size
+External(\PDC0, IntObj) // CPU0 _PDC Flags
+
+External(\_TZ.ETMD, IntObj)
+External(\_TZ.TZ00, ThermalZoneObj)
+External(\_TZ.TZ01, ThermalZoneObj)
+
+External(\_SB.PCI0, DeviceObj)
+External(\_SB.PCI0.B0D4, DeviceObj)
+External(\_SB.PCI0.MHBR, FieldUnitObj)
+
+External(\_SB.PCI0.LPCB.H_EC, DeviceObj)
+External(\_SB.PCI0.LPCB.H_EC.ECAV, IntObj)
+External(\_SB.PCI0.LPCB.H_EC.ECMD, MethodObj)
+External(\_SB.PCI0.LPCB.H_EC.ECRD, MethodObj) // EC Read Method
+External(\_SB.PCI0.LPCB.H_EC.ECWT, MethodObj) // EC Write Method
+External(\_SB.PCI0.LPCB.H_EC.ECF2, OpRegionObj)
+External(\_SB.PCI0.LPCB.H_EC.SKNT, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.CVRT, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.FANT, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.AMBT, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.PPSL, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.PPSH, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.PINV, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.PENV, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.PSTP, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.CMDR, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.TSD0, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.TSD1, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.DIM0, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.DIM1, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.CFSP, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.CPUP, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.CPAP, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.PMAX, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.PECH, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.CFAN, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.TSI, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.HYST, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.TSHT, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.TSLT, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.TSSR, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.B1RC, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.B1FC, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.BAT1._BST, MethodObj)
+External(\_SB.PCI0.LPCB.H_EC.B1ML, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.B1MH, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.PPWR, FieldUnitObj)
+
+External(\_PR.CPU0, ProcessorObj)
+External(\_PR.CPU0._PSS, MethodObj)
+External(\_PR.CPU0._PPC, IntObj)
+External(\_PR.CPU0._TSS, MethodObj)
+External(\_PR.CFGD, FieldUnitObj)
+External(\_PR.CPU0.TSMF, PkgObj)
+External(\_PR.CPU0.TSMC, PkgObj)
+External(\_PR.CPU0._PTC, MethodObj)
+External(\_PR.CPU0._TSD, MethodObj)
+External(\_PR.CPU0._TPC, IntObj)
+External(\_PR.CPU1, ProcessorObj)
+External(\_PR.CPU2, ProcessorObj)
+External(\_PR.CPU3, ProcessorObj)
+External(\_PR.CPU4, ProcessorObj)
+External(\_PR.CPU5, ProcessorObj)
+External(\_PR.CPU6, ProcessorObj)
+External(\_PR.CPU7, ProcessorObj)
+
+External(\_PR.CLVL, FieldUnitObj)
+External(\_PR.CBMI, FieldUnitObj)
+External(\_PR.PL10, FieldUnitObj)
+External(\_PR.PL20, FieldUnitObj)
+External(\_PR.PLW0, FieldUnitObj)
+External(\_PR.CTC0, FieldUnitObj)
+External(\_PR.TAR0, FieldUnitObj)
+External(\_PR.PL11, FieldUnitObj)
+External(\_PR.PL21, FieldUnitObj)
+External(\_PR.PLW1, FieldUnitObj)
+External(\_PR.CTC1, FieldUnitObj)
+External(\_PR.TAR1, FieldUnitObj)
+External(\_PR.PL12, FieldUnitObj)
+External(\_PR.PL22, FieldUnitObj)
+External(\_PR.PLW2, FieldUnitObj)
+External(\_PR.CTC2, FieldUnitObj)
+External(\_PR.TAR2, FieldUnitObj)
+
+External(\_PR.APSV, FieldUnitObj)
+External(\_PR.AAC0, FieldUnitObj)
+External(\_PR.ACRT, FieldUnitObj)
+
+External(\_SB.PCCD.PENB, IntObj)
+
+// Display participant externals
+External(DISE, IntObj) // EnableDisplayParticipant
+External(\_SB.PCI0.GFX0.DD1F._BCL, MethodObj)
+External(\_SB.PCI0.GFX0.DD1F._BCM, MethodObj)
+External(\_SB.PCI0.GFX0.DD1F._BQC, MethodObj)
+External(\_SB.PCI0.GFX0.DD1F._DCS, MethodObj)
+
+Scope(\_SB)
+{
+ //
+ // DPTF Thermal Zone Device
+ //
+ //
+ Device(IETM)
+ {
+ //
+ // Intel DPTF Thermal Framework Device
+ //
+ Name(_HID, EISAID("INT3400"))
+
+ // _STA (Status)
+ //
+ // This object returns the current status of a device.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing a device status bitmap:
+ // Bit 0 - Set if the device is present.
+ // Bit 1 - Set if the device is enabled and decoding its resources.
+ // Bit 2 - Set if the device should be shown in the UI.
+ // Bit 3 - Set if the device is functioning properly (cleared if device failed its diagnostics).
+ // Bit 4 - Set if the battery is present.
+ // Bits 5-31 - Reserved (must be cleared).
+ //
+ Method(_STA)
+ {
+ If (LEqual(DPTF,1)){
+ Return(0x0F)
+ } Else {
+ Return(0x00)
+ }
+ }
+
+ //
+ // Note: there are seven GUID packages in TMPP and up to seven matching store statements in IDSP.
+ // The store statements must never exceed the number of package elements to prevent an overrun.
+ //
+ Name(TMPP,Package()
+ {
+ ToUUID("00000000-0000-0000-0000-000000000000"),
+ ToUUID("00000000-0000-0000-0000-000000000000"),
+ ToUUID("00000000-0000-0000-0000-000000000000"),
+ ToUUID("00000000-0000-0000-0000-000000000000"),
+ ToUUID("00000000-0000-0000-0000-000000000000"),
+ ToUUID("00000000-0000-0000-0000-000000000000"),
+ ToUUID("00000000-0000-0000-0000-000000000000")
+ })
+
+ //
+ // Save original trip points so _OSC method can enable/disable Legacy thermal policies by manipulating trip points.
+ //
+ Name (PTRP,0) // Passive trip point
+ Name (PSEM,0) // Passive semaphore
+ Name (ATRP,0) // Active trip point
+ Name (ASEM,0) // Active semaphore
+ Name (YTRP,0) // Critical trip point
+ Name (YSEM,0) // Critical semaphore
+
+ // IDSP (Intel DPTF Supported Policies)
+ //
+ // This object evaluates to a package of packages, with each package containing the UUID
+ // values to represent a policy implemented and supported by the Intel DPTF software stack.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // Package of Guid packages
+ //
+ Method(IDSP,0,Serialized,,PkgObj)
+ {
+ Name(TMPI,0)
+
+ // Passive Policy GUID
+ If(LAnd(LEqual(DPPP,1),CondRefOf(DPSP))){
+ Store(DeRefOf(Index(DPSP,0)), Index(TMPP,TMPI))
+ Increment(TMPI)
+ }
+
+ // Active Policy GUID
+ If(LAnd(LEqual(DPAP,1),CondRefOf(DASP))){
+ Store(DeRefOf(Index(DASP,0)), Index(TMPP,TMPI))
+ Increment(TMPI)
+ }
+
+ // Critical Policy GUID
+ If(LAnd(LEqual(DPCP,1),CondRefOf(DCSP))){
+ Store(DeRefOf(Index(DCSP,0)), Index(TMPP,TMPI))
+ Increment(TMPI)
+ }
+
+ // Cooling Mode Policy GUID
+ If(LAnd(LEqual(DCMP,1),CondRefOf(DMSP))){
+ Store(DeRefOf(Index(DMSP,0)), Index(TMPP,TMPI))
+ Increment(TMPI)
+ }
+
+ // LPM policy GUID
+ If(LAnd(LEqual(LPMP,1),CondRefOf(LPSP))){
+ Store(DeRefOf(Index(LPSP,0)), Index(TMPP,TMPI))
+ Increment(TMPI)
+ }
+
+ // CTDP Policy GUID
+ If(LAnd(LEqual(CTDP,1),CondRefOf(CTSP))){
+ Store(DeRefOf(Index(CTSP,0)), Index(TMPP,TMPI))
+ Increment(TMPI)
+ }
+
+ //Power Policy GUID
+ If(LAnd(LEqual(PWRP,1),CondRefOf(WPSP))){
+ Store(DeRefOf(Index(WPSP,0)), Index(TMPP,TMPI))
+ }
+
+ Return(TMPP)
+ }
+
+ // _OSC (Operating System Capabilities)
+ //
+ // This object is evaluated by each DPTF policy implementation to communicate to the platform of the existence and/or control transfer.
+ //
+ // Arguments: (4)
+ // Arg0 - A Buffer containing a UUID
+ // Arg1 - An Integer containing a Revision ID of the buffer format
+ // Arg2 - An Integer containing a count of entries in Arg3
+ // Arg3 - A Buffer containing a list of DWORD capabilities
+ // Return Value:
+ // A Buffer containing a list of capabilities
+ //
+ Method(_OSC, 4,Serialized,,BuffObj,{BuffObj,IntObj,IntObj,BuffObj})
+ {
+ Name(NUMP,0)
+ Name (UID2,ToUUID("FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF"))
+
+ // Point to Status DWORD in the Arg3 buffer (STATUS)
+ CreateDWordField(Arg3, 0, STS1)
+
+ // Point to Caps DWORDs of the Arg3 buffer (CAPABILITIES)
+ CreateDWordField(Arg3, 4, CAP1)
+
+ //
+ // _OSC needs to validate the UUID and Revision.
+ //
+ // IF Unrecognized UUID
+ // Return Unrecognized UUID _OSC Failure
+ // IF Unsupported Revision
+ // Return Unsupported Revision _OSC Failure
+ //
+ // STS0[0] = Reserved
+ // STS0[1] = _OSC Failure
+ // STS0[2] = Unrecognized UUID
+ // STS0[3] = Unsupported Revision
+ // STS0[4] = Capabilities masked
+ //
+ // Get the platform UUID's that are available, this will be a package of packages.
+ //
+ IDSP() // initialize TMPP with GUID's
+ Store(SizeOf(TMPP),NUMP) // how many GUID's in the package?
+
+ // Note: The comparison method used is necessary due to
+ // limitations of certain OSes which cannot perform direct
+ // buffer comparisons.
+ //
+ // Create a set of "Input" UUID fields.
+ //
+ CreateDWordField(Arg0, 0x0, IID0)
+ CreateDWordField(Arg0, 0x4, IID1)
+ CreateDWordField(Arg0, 0x8, IID2)
+ CreateDWordField(Arg0, 0xC, IID3)
+ //
+ // Create a set of "Expected" UUID fields.
+ //
+ CreateDWordField(UID2, 0x0, EID0)
+ CreateDWordField(UID2, 0x4, EID1)
+ CreateDWordField(UID2, 0x8, EID2)
+ CreateDWordField(UID2, 0xC, EID3)
+ //
+ // Compare the input UUID to the list of UUID's in the system.
+ //
+ While(NUMP){
+ //
+ // copy one uuid from TMPP to UID2
+ //
+ Store(DeRefOf (Index (TMPP, Subtract(NUMP,1))),UID2)
+ //
+ // Verify the input UUID matches the expected UUID.
+ //
+ If(LAnd(LAnd(LEqual(IID0, EID0), LEqual(IID1, EID1)), LAnd(LEqual(IID2, EID2), LEqual(IID3, EID3)))){
+ Break // break out of while loop when matching UUID is found
+ }
+ Decrement(NUMP)
+ }
+
+ If(LEqual(NUMP,0)){
+ //
+ // Return Unrecognized UUID _OSC Failure
+ //
+ And(STS1,0xFFFFFF00,STS1)
+ Or(STS1,0x6,STS1)
+ Return(Arg3)
+ }
+
+ If(LNot(LEqual(Arg1, 1)))
+ {
+ //
+ // Return Unsupported Revision _OSC Failure
+ //
+ And(STS1,0xFFFFFF00,STS1)
+ Or(STS1,0xA,STS1)
+ Return(Arg3)
+ }
+
+ If(LNot(LEqual(Arg2, 2)))
+ {
+ //
+ // Return Argument 3 Buffer Count not sufficient
+ //
+ And(STS1,0xFFFFFF00,STS1)
+ Or(STS1,0x2,STS1)
+ Return(Arg3)
+ }
+
+ //
+ // Passive Policy GUID
+ //
+ If(LAnd(LEqual(DPPP,1),CondRefOf(\_PR.APSV))){
+ If(LEqual(PSEM,0)){
+ Store(1,PSEM)
+ Store(\_PR.APSV,PTRP) // use semaphore so variable is only initialized once
+ }
+ //
+ // copy the GUID to UID2
+ //
+ If(CondRefOf(DPSP)){
+ Store(DeRefOf (Index (DPSP, 0)),UID2)
+ }
+ //
+ // Verify the test UUID matches the input UUID.
+ //
+ If(LAnd(LAnd(LEqual(IID0, EID0), LEqual(IID1, EID1)), LAnd(LEqual(IID2, EID2), LEqual(IID3, EID3)))){
+ // do passive notify
+ If(Not(And(STS1, 0x01))) // Test Query Flag
+ { // Not a query operation, so process the request
+ If(And(CAP1, 0x01))
+ { // Enable DPTF
+ // Nullify the legacy thermal zone.
+ Store(110,\_PR.APSV)
+ } Else { // Passive unloading, re-enable legacy thermal zone
+ Store(PTRP,\_PR.APSV)
+ }
+ // Send notification to legacy thermal zone for legacy policy to be enabled/disabled
+ Notify(\_TZ.TZ00, 0x80)
+ Notify(\_TZ.TZ01, 0x80)
+ }
+ Return(Arg3)
+ }
+ }
+
+ //
+ // Active Policy GUID
+ //
+ If(LAnd(LEqual(DPAP,1),CondRefOf(\_PR.AAC0))){
+ If(LEqual(ASEM,0)){
+ Store(1,ASEM)
+ Store(\_PR.AAC0,ATRP) // use semaphore so variable is only initialized once
+ }
+ //
+ // copy the GUID to UID2
+ //
+ If(CondRefOf(DASP)){
+ Store(DeRefOf (Index (DASP, 0)),UID2)
+ }
+ //
+ // Verify the test UUID matches the input UUID.
+ //
+ If(LAnd(LAnd(LEqual(IID0, EID0), LEqual(IID1, EID1)), LAnd(LEqual(IID2, EID2), LEqual(IID3, EID3)))){
+ // do active notify
+ If(Not(And(STS1, 0x01))) // Test Query Flag
+ { // Not a query operation, so process the request
+ If(And(CAP1, 0x01))
+ { // Enable DPTF
+ // Nullify the legacy thermal zone.
+ Store(110,\_PR.AAC0)
+ } Else { // Passive unloading, re-enable legacy thermal zone
+ Store(ATRP,\_PR.AAC0)
+ }
+ // Send notification to legacy thermal zone for legacy policy to be enabled/disabled
+ Notify(\_TZ.TZ00, 0x80)
+ Notify(\_TZ.TZ01, 0x80)
+ }
+ Return(Arg3)
+ }
+ }
+
+ //
+ // Critical Policy GUID
+ //
+ If(LAnd(LEqual(DPCP,1),CondRefOf(\_PR.ACRT))){
+ If(LEqual(YSEM,0)){
+ Store(1,YSEM)
+ Store(\_PR.ACRT,YTRP) // use semaphore so variable is only initialized once
+ }
+ //
+ // copy the GUID to UID2
+ //
+ If(CondRefOf(DCSP)){
+ Store(DeRefOf (Index (DCSP, 0)),UID2)
+ }
+ //
+ // Verify the test UUID matches the input UUID.
+ //
+ If(LAnd(LAnd(LEqual(IID0, EID0), LEqual(IID1, EID1)), LAnd(LEqual(IID2, EID2), LEqual(IID3, EID3)))){
+ // do critical notify
+ If(Not(And(STS1, 0x01))) // Test Query Flag
+ { // Not a query operation, so process the request
+ If(And(CAP1, 0x01))
+ { // Enable DPTF
+ // Nullify the legacy thermal zone.
+ Store(210,\_PR.ACRT)
+ } Else { // Passive unloading, re-enable legacy thermal zone
+ Store(YTRP,\_PR.ACRT)
+ }
+ // Send notification to legacy thermal zone for legacy policy to be enabled/disabled
+ Notify(\_TZ.TZ00, 0x80)
+ Notify(\_TZ.TZ01, 0x80)
+ }
+ Return(Arg3)
+ }
+ }
+
+ Return(Arg3)
+ }
+ // KTOC (Kelvin to Celsius)
+ //
+ // This control method converts from 10ths of degree Kelvin to Celsius.
+ //
+ // Arguments: (1)
+ // Arg0 - Temperature in 10ths of degree Kelvin
+ // Return Value:
+ // Temperature in Celsius
+ //
+ Method(KTOC,1)
+ {
+ Subtract(Arg0, 2732, Local1)
+ If(LGreater(Local1,0)) // make sure we don't have a negative number
+ {
+ Return(Divide(Local1, 10))
+ }
+ Else
+ {
+ Return(0)
+ }
+ }
+
+ // CTOK (Celsius to Kelvin)
+ //
+ // This control method converts from Celsius to 10ths of degree Kelvin.
+ //
+ // Arguments: (1)
+ // Arg0 - Temperature in Celsius
+ // Return Value:
+ // Temperature in 10ths of degree Kelvin
+ //
+ Method(CTOK, 1)
+ {
+ If(And(Arg0, 0x1000)) // Round negative values up to Zero
+ {
+ Return(2372)
+ }
+ Multiply(Arg0,10,Local0)
+ And(Local0, 0x0FFF, Local1)
+ Add(Local1, 2732, Local2)
+ Return(Local2)
+ }
+
+ // PDRT (power device relation table)
+ //
+ // This object evaluates to a package of packages that indicates the relation between charge rates and target devices.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // A variable-length package of packages as described below.
+ //
+ // Return Value Information
+ // Package {
+ // Package [0] // Package
+ // ....
+ // Package [n] // Package
+ // }
+ //
+ // Each sub-Package contains the elements described below:
+ // Package {
+ // ChargeRate // Integer (DWORD)
+ // TargetDevice // Integer (DWORD)
+ // PTYP // Integer (DWORD)
+ // ControlBuffer // Package
+ // }
+ //
+ Method(PDRT,,,,PkgObj)
+ {
+ \_SB.PCI0.B0D4.PCCC() // init global variable PCCX
+ If (\PWRS){ // check power source
+ PDAC() // AC table
+ } Else {
+ PDDC() // DC table
+ }
+ } // end Method(PDRT)
+
+ Method(PDDC,,,,PkgObj)
+ {
+ Name(TMPD,Package()
+ {
+ Package() {80, \_SB.PCI0.B0D4, 0x09, Package () {0x00010001,0x80000000}}, // Package domain, PL2, target power from CPU PPM
+ Package() {60, \_SB.PCI0.B0D4, 0x09, Package () {0x00010000,0x80000000}}, // Package domain, PL1, target power from CPU PPM
+ Package() {55, \_SB.PCI0.B0D4, 0x09, Package () {0x00070000,1}}, // Package domain, Power Control Turbo Disable
+ Package() {50, \_SB.PCI0.B0D4, 0x09, Package () {0x00030000,0x80000000}}, // Imax Controls - 30A
+ Package() {50, \_SB.PCI0.B0D4, 0x00, Package () {0x00040000,2}}, // Core control - 2 cores
+ Package() {40, \_SB.PCI0.DPLY, 0x0A, Package () {0x00050000,60}}, // Display brightness - 60
+ Package() {40, \_SB.PCI0.TMEM, 0x02, Package () {0x00010000,1000}}, // Memory domain, PL1, target power from TMEM.PPCC
+ Package() {30, \_SB.PCI0.B0D4, 0x00, Package () {0x00020000,80}}, // System Agent Thermal Device, target frequency - P State 80%
+ Package() {20, \_SB.PCI0.B0D4, 0x00, Package () {0x00020001,50}} // System Agent Thermal Device, target frequency - T State 50%
+ })
+
+ If(CondRefOf(\_PR.CBMI)){
+ Switch(ToInteger(\_PR.CBMI)){ // use the boot index from PPM to choose the Power Limit values and copy them to local variables
+ case(0){
+ If(LAnd(LGreaterEqual(\_PR.CLVL,1),LLessEqual(\_PR.CLVL,3))){ // copy PL0 values
+ Store (\_SB.PCI0.B0D4.CPNU(\_PR.PL20,1),Local0) // PL2 minimum power
+ Store (\_SB.PCI0.B0D4.MIN4(\_PR.PL10),Local1) // PL1 minimum power
+ }
+ }
+ case(1){
+ If(LOr(LEqual(\_PR.CLVL,2),LEqual(\_PR.CLVL,3))){ // copy PL1 values
+ Store (\_SB.PCI0.B0D4.CPNU(\_PR.PL21,1),Local0) // PL2 minimum power
+ Store (\_SB.PCI0.B0D4.MIN4(\_PR.PL11),Local1) // PL1 minimum power
+ }
+ }
+ case(2){
+ If(LEqual(\_PR.CLVL,3)){ // copy PL2 values
+ Store (\_SB.PCI0.B0D4.CPNU(\_PR.PL22,1),Local0) // PL2 minimum power
+ Store (\_SB.PCI0.B0D4.MIN4(\_PR.PL12),Local1) // PL1 minimum power
+ }
+ }
+ }
+ }
+
+ // get the iMax value from the PCCC object and copy it to a local variable
+ Store (DerefOf(Index(DerefOf(Index(\_SB.PCI0.B0D4.PCCX,1)),0)),Local2) // CurrentLimitMinimum
+
+ // update the first three packages with the values that we had to dynamically determine
+ // this section might have to be updated any time the PDRT is changed
+ Store(Local0,Index(DeRefOf(Index (DeRefOf (Index (TMPD, 0)),3)),1)) // Package domain, PL2, target power from CPU PPM
+ Store(Local1,Index(DeRefOf(Index (DeRefOf (Index (TMPD, 1)),3)),1)) // Package domain, PL1, target power from CPU PPM
+ Store(Local2,Index(DeRefOf(Index (DeRefOf (Index (TMPD, 3)),3)),1)) // Imax Controls - 30A
+
+ Return(TMPD)
+ } // Method(PDDC)
+
+ Method(PDAC,,,,PkgObj)
+ {
+ Name(TMPD,Package()
+ {
+ Package() {100, \_SB.PCI0.B0D4, 0x09, Package () {0x00010001,0x80000000}}, // Package domain, PL2, target power from CPU PPM
+ Package() {100, \_SB.PCI0.B0D4, 0x09, Package () {0x00010000,0x80000000}}, // Package domain, PL1, target power from CPU PPM
+ Package() {100, \_SB.PCI0.B0D4, 0x09, Package () {0x00070000,0}}, // Package domain, Power Control Turbo Enable
+ Package() {100, \_SB.PCI0.B0D4, 0x09, Package () {0x00030000,0x80000000}}, // Imax Controls - 30A
+ Package() {100, \_SB.PCI0.B0D4, 0x00, Package () {0x00040000,0x80000000}}, // Core control - cores from TCNT
+ Package() {100, \_SB.PCI0.DPLY, 0x0A, Package () {0x00050000,100}}, // Display brightness - 100%
+ Package() {100, \_SB.PCI0.TMEM, 0x02, Package () {0x00010000,5000}}, // Memory domain, PL1, target power from TMEM.PPCC
+ Package() {100, \_SB.PCI0.B0D4, 0x00, Package () {0x00020000,100}} // System Agent Thermal Device, target frequency - P State 0%
+ })
+
+ If(CondRefOf(\_PR.CBMI)){
+ Switch(ToInteger(\_PR.CBMI)){ // use the boot index from PPM to choose the Power Limit values and copy them to local variables
+ case(0){
+ If(LAnd(LGreaterEqual(\_PR.CLVL,1),LLessEqual(\_PR.CLVL,3))){ // copy PL0 values
+ Store (\_SB.PCI0.B0D4.CPNU(\_PR.PL20,1),Local0) // PL2 maximum power
+ Store (\_SB.PCI0.B0D4.CPNU(\_PR.PL10,1),Local1) // PL1 maximum power
+ }
+ }
+ case(1){
+ If(LOr(LEqual(\_PR.CLVL,2),LEqual(\_PR.CLVL,3))){ // copy PL1 values
+ Store (\_SB.PCI0.B0D4.CPNU(\_PR.PL21,1),Local0) // PL2 maximum power
+ Store (\_SB.PCI0.B0D4.CPNU(\_PR.PL11,1),Local1) // PL1 maximum power
+ }
+ }
+ case(2){
+ If(LEqual(\_PR.CLVL,3)){ // copy PL2 values
+ Store (\_SB.PCI0.B0D4.CPNU(\_PR.PL22,1),Local0) // PL2 maximum power
+ Store (\_SB.PCI0.B0D4.CPNU(\_PR.PL12,1),Local1) // PL1 maximum power
+ }
+ }
+ }
+ }
+
+ // get the iMax value from the PCCC object and copy it to a local variable
+ Store (DerefOf(Index(DerefOf(Index(\_SB.PCI0.B0D4.PCCX,1)),1)),Local2) // CurrentLimitMaximum
+
+ // update the first four packages with the values that we had to dynamically determine
+ // this section might have to be updated any time the PDRT is changed
+ Store(Local0,Index(DeRefOf(Index (DeRefOf (Index (TMPD, 0)),3)),1)) // Package domain, PL2, target power from CPU PPM
+ Store(Local1,Index(DeRefOf(Index (DeRefOf (Index (TMPD, 1)),3)),1)) // Package domain, PL1, target power from CPU PPM
+ Store(Local2,Index(DeRefOf(Index (DeRefOf (Index (TMPD, 3)),3)),1)) // Imax Controls - 30A
+ Store(TCNT,Index(DeRefOf(Index (DeRefOf (Index (TMPD, 4)),3)),1)) // Core control - cores from TCNT
+
+ Return(TMPD)
+ } // Method(PDAC)
+
+ } // End IETM Device
+} // End \_SB Scope
+
+//
+// EC support code
+//
+Scope(\_SB.PCI0.LPCB.H_EC) // Open scope to Embedded Controller
+{
+ //
+ // Create a Mutex for PATx methods to prevent Sx resume race condition problems asscociated with EC commands.
+ //
+ Mutex(PATM, 0)
+
+ // _QF1 (Query - Embedded Controller Query F1)
+ //
+ // Handler for EC generated SCI number F1.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // None
+ //
+ Method(_QF1)
+ { // Thermal sensor threshold crossing event handler
+ P8XH(0, 0xf1)
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.TSSR)), Local0)
+ While(Local0) // Ensure that events occuring during execution
+ { // of this handler are not dropped
+ \_SB.PCI0.LPCB.H_EC.ECWT(0, RefOf(\_SB.PCI0.LPCB.H_EC.TSSR)) // clear all status bits
+ If(And(Local0, 0x10, Local1))
+ { // Memory temp threshold crossed
+ Notify(\_SB.PCI0.TMEM, 0x90)
+ }
+ If(And(Local0, 0x8, Local1))
+ { // Ambient temp threshold crossed
+ Notify(\_SB.PCI0.LPCB.H_EC.TAMB, 0x90)
+ }
+ If(And(Local0, 0x4, Local1))
+ { // Skin temp threshold crossed
+ Notify(\_SB.PCI0.LPCB.H_EC.TSKN, 0x90)
+ }
+ If(And(Local0, 0x2, Local1))
+ { // Fan temp threshold crossed
+ Notify(\_SB.PCI0.LPCB.H_EC.TEFN, 0x90)
+ }
+ If(And(Local0, 0x01, Local1))
+ { // VR temp threshold crossed
+ Notify(\_SB.PCI0.LPCB.H_EC.T_VR, 0x90)
+ }
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.TSSR)), Local0)
+ }
+ }
+} // End \_SB.PCI0.LPCB.H_EC Scope
+
+//
+// Processor files.
+//
+ Include("B0d4Participant.asl")
+ Include("B0d4DppmPolicy.asl")
+ Include("B0d4CtdpPolicy.asl")
+ Include("B0d4LpmPolicy.asl")
+
+//
+// CPU files
+//
+ Include("TcpuParticipant.asl")
+ Include("TcpuDppmPolicy.asl")
+
+//
+// PCH files
+//
+ Include("TpchParticipant.asl")
+ Include("TpchDppmPolicy.asl")
+
+//
+// These participants, TAMB, TEFN, TFN1, TFN2, TMEM, TSKN, T_VR, are currently used by DPPM policies only.
+// Refer to the specific technology BIOS specification.
+//
+ Include("TAmbParticipant.asl")
+ Include("TAmbDppmPolicy.asl")
+ Include("TEfnParticipant.asl")
+ Include("TEfnDppmPolicy.asl")
+ Include("TFN1Participant.asl")
+ Include("TFN2Participant.asl")
+ Include("TMemParticipant.asl")
+ Include("TMemDppmPolicy.asl")
+ Include("TSknParticipant.asl")
+ Include("TSknDppmPolicy.asl")
+ Include("T_VRParticipant.asl")
+ Include("T_VRDppmPolicy.asl")
+ Include("DplyParticipant.asl")
+ Include("TPwrParticipant.asl")
+ Include("WWANParticipant.asl")
+ Include("WWANDppmPolicy.asl")
+
+//
+// DPPM support files
+//
+ Include("Ertm.asl")
+ Include("Trt.asl")
+ Include("Art.asl")
+ Include("Dppm.asl")
+
+
+} // End SSDT
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/DptfAcpiTables.cif b/ReferenceCode/AcpiTables/Dptf/AcpiTables/DptfAcpiTables.cif
new file mode 100644
index 0000000..a374599
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/DptfAcpiTables.cif
@@ -0,0 +1,41 @@
+<component>
+ name = "DptfAcpiTables"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\AcpiTables\Dptf\AcpiTables\"
+ RefName = "DptfAcpiTables"
+[files]
+"DptfAcpiTables.sdl"
+"DptfAcpiTables.mak"
+"Art.asl"
+"B0d4CtdpPolicy.asl"
+"B0d4DppmPolicy.asl"
+"B0d4LpmPolicy.asl"
+"B0d4Participant.asl"
+"Dppm.asl"
+"Dptf.asl"
+"DplyParticipant.asl"
+"DptfAcpiTables.inf"
+"Ertm.asl"
+"T_VRDppmPolicy.asl"
+"T_VRParticipant.asl"
+"TAmbDppmPolicy.asl"
+"TAmbParticipant.asl"
+"TcpuDppmPolicy.asl"
+"TcpuParticipant.asl"
+"TEfnDppmPolicy.asl"
+"TEfnParticipant.asl"
+"TFN1Participant.asl"
+"TFN2Participant.asl"
+"TMemDppmPolicy.asl"
+"TMemParticipant.asl"
+"TpchDppmPolicy.asl"
+"TpchParticipant.asl"
+"Trt.asl"
+"TSknDppmPolicy.asl"
+"TSknParticipant.asl"
+"TPwrParticipant.asl"
+"WWANParticipant.asl"
+"WWANDppmPolicy.asl"
+[parts]
+"DptfAcpiTablesFfrd"
+<endComponent>
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/DptfAcpiTables.inf b/ReferenceCode/AcpiTables/Dptf/AcpiTables/DptfAcpiTables.inf
new file mode 100644
index 0000000..dd03937
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/DptfAcpiTables.inf
@@ -0,0 +1,67 @@
+## @file
+# Component description file for the ACPI tables
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains an 'Intel Peripheral Driver' and uniquely
+# identified as "Intel Reference Module" and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+
+
+[defines]
+BASE_NAME = DptfAcpiTables
+#
+# If the value of this GUID is changed then make sure to change the corresponding GUID (DPTF_ACPI_TABLE_STORAGE_GUID)
+# in DptfAcpiTableStorage.h.
+#
+FILE_GUID = EA139578-FEA0-4dd2-91B5-6953819EF1E4
+COMPONENT_TYPE = ACPITABLE
+FFS_EXT = .ffs
+
+[sources.common]
+ Dptf.ASL
+
+[libraries.common]
+
+[includes.common]
+ .
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Include
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include
+
+#
+# Edk II Glue Library, some header are not included by R9 header so have to include
+#
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Framework
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include/Library
+
+[nmake.common]
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/DptfAcpiTables.mak b/ReferenceCode/AcpiTables/Dptf/AcpiTables/DptfAcpiTables.mak
new file mode 100644
index 0000000..f5dbc7e
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/DptfAcpiTables.mak
@@ -0,0 +1,106 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2012, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#**********************************************************************
+# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/DPTF/DptfAcpiTables/DptfAcpiTables.mak 5 6/02/13 8:18a Joshchou $
+#
+# $Revision: 5 $
+#
+# $Date: 6/02/13 8:18a $
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/DPTF/DptfAcpiTables/DptfAcpiTables.mak $
+#
+# 5 6/02/13 8:18a Joshchou
+# [TAG] None
+# [Category] Improvement
+# [Description] Change IASL compiler path to
+# $(ACPIPLATFORM_ASL_COMPILER) in SharkBay project.
+#
+# 4 1/28/13 10:02p Joshchou
+# [TAG] None
+# [Category] Improvement
+# [Description] Change the build tool path.
+#
+# 3 11/20/12 4:24a Joshchou
+# [TAG] None
+# [Category] Improvement
+# [Description] Create Token for OEM clone
+#
+# 2 9/26/12 1:58a Victortu
+#
+# 1 4/24/12 9:25a Victortu
+# Intel DPTF initialization.
+#
+#**********************************************************************
+#<AMI_FHDR_START>
+#
+# Name: DptfAcpiTables.mak
+#
+# Description: MAke file to build Intel DPTF ACPI ASL components
+#
+#<AMI_FHDR_END>
+#**********************************************************************
+#-----------------------------------------------------------------------
+# ASL compiler definition
+#-----------------------------------------------------------------------
+!IF "$(ACPIPLATFORM_ASL_COMPILER)"==""
+!ERROR It is an invalid path, please check your ASL compiler path.
+!ENDIF
+
+IASL = $(ACPIPLATFORM_ASL_COMPILER)
+#-----------------------------------------------------------------------
+EDK : DPTFACPI
+
+ALLDPTFSEC = $(BUILD_DIR)\Dptf.sec
+
+DPTFACPI : $(BUILD_DIR)\DptfAcpiTables.ffs
+
+$(BUILD_DIR)\Dptf.aml : $(INTEL_DPTF_ASL_FILE)
+ $(ASLEXPANDER) $(INTEL_DPTF_ASL_FILE) $(BUILD_DIR)\Dptf.asl $(PROJECT_CPU_ROOT)\Include
+ $(IASL) -p $(BUILD_DIR)\Dptf.aml $(BUILD_DIR)\Dptf.asl
+
+$(BUILD_DIR)\Dptf.sec: $(BUILD_DIR)\Dptf.aml
+ $(GENSECTION) -I $** -O $@ -S EFI_SECTION_RAW
+
+$(BUILD_DIR)\DptfAcpiTables.ffs: $(ALLDPTFSEC) $(INTEL_DPTF_ACPI_TABLE_DIR)\DptfAcpiTables.mak
+ $(GENFFSFILE) -B $(BUILD_DIR) -V -o $@ -P1 <<$(BUILD_DIR)\DptfAcpiTables.pkg
+PACKAGE.INF
+[.]
+BASE_NAME = DptfAcpiTables
+FFS_FILEGUID = EA139578-FEA0-4dd2-91B5-6953819EF1E4
+FFS_FILETYPE = EFI_FV_FILETYPE_FREEFORM
+FFS_ATTRIB_CHECKSUM = TRUE
+
+IMAGE_SCRIPT =
+{
+ Compress (dummy) {
+ $(PROJECT_DIR)\$(BUILD_DIR)\Dptf.sec
+ }
+}
+<<KEEP
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2012, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/DptfAcpiTables.sdl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/DptfAcpiTables.sdl
new file mode 100644
index 0000000..50d6780
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/DptfAcpiTables.sdl
@@ -0,0 +1,31 @@
+TOKEN
+ Name = DptfAcpiTables_SUPPORT
+ Value = 1
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable DptfAcpiTables support in Project"
+End
+
+MODULE
+ Help = "Includes DptfAcpiTables.mak to Project"
+ File = "DptfAcpiTables.mak"
+End
+
+PATH
+ Name = "INTEL_DPTF_ACPI_TABLE_DIR"
+End
+
+TOKEN
+ Name = "INTEL_DPTF_ASL_FILE"
+ Value = "$(INTEL_DPTF_ACPI_TABLE_DIR)\Dptf.asl"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\DptfAcpiTables.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End \ No newline at end of file
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ertm.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ertm.asl
new file mode 100644
index 0000000..a2f0a50
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ertm.asl
@@ -0,0 +1,55 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ Ertm.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Dynamic Platform & Thermal Framework
+
+--*/
+
+Scope(\_SB.IETM)
+{
+ // ETRM (Intel DPTF Participant List)
+ //
+ // The ETRM object evaluates to a package of packages each of which describes one participant device.
+ //
+ Name(ETRM, Package()
+ { // TODO: Replace with system-specific ETRM data here
+ Package() {\_SB.TCPU, "INT3401", 0x06, "0"}, // Processor Device
+ Package() {\_SB.PCI0.TMEM, "INT3402", 0x06, "0"}, // Memory Device
+ Package() {\_SB.PCI0.LPCB.H_EC.TSKN, "INT3403", 0x06, "0"}, // Skin Temperature Sensor
+ Package() {\_SB.PCI0.LPCB.H_EC.TAMB, "INT3403", 0x06, "1"}, // Ambient Temperature Sensor
+ Package() {\_SB.PCI0.LPCB.H_EC.T_VR, "INT3403", 0x06, "2"}, // VR Temperature Sensor
+ Package() {\_SB.PCI0.LPCB.H_EC.TEFN, "INT3403", 0x06, "3"}, // Exhaust Fan Temperature Sensor
+ Package() {\_SB.PCI0.WWAN, "INT3408", 0x06, "1"}, // Wireless WWAN temperature sensor Device
+ Package() {\_SB.PCI0.LPCB.H_EC.TFN1, "INT3404", 0x06, "0"}, // Fan Control Device
+ Package() {\_SB.PCI0.LPCB.H_EC.TFN2, "INT3404", 0x06, "1"}, // Fan Control Device
+ Package() {\_SB.PCI0.DPLY, "INT3406", 0x06, "0"}, // Display Participant Device
+ Package() {\_SB.PCI0.B0D4, "8086_0C03", 0x00, "0x00040000"}, // HSW SA Thermal Device
+ Package() {\_SB.PCI0.TPCH, "8086_8C24", 0x00, "0x001F0006"}, // LPT PCH Thermal Device
+ Package() {\_SB.PCI0.B0D4, "8086_0A03", 0x00, "0x00040000"}, // HSW ULT SA Thermal Device
+ Package() {\_SB.PCI0.TPCH, "8086_9C24", 0x00, "0x001F0006"}, // LPT ULT PCH Thermal Device
+ Package() {\_SB.PCI0.B0D4, "8086_0D03", 0x00, "0x00040000"} // CRW SA Thermal Device
+ })
+}
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/Art.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/Art.asl
new file mode 100644
index 0000000..54c7fa0
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/Art.asl
@@ -0,0 +1,81 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ Art.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Intel Dynamic Power Performance Management
+
+--*/
+
+ Scope(\_SB.IETM)
+ {
+
+ Name(ART1, Package() // ART package when in Quiet Mode / Passive Cooling Mode
+ {
+ 0, // Revision
+ // Source Target Weight, AC0MaxLevel, AC1MaxLevel, AC21MaxLevel, AC31MaxLevel, AC41MaxLevel, AC51MaxLevel, AC61MaxLevel, AC71MaxLevel, AC81MaxLevel, AC91MaxLevel
+ Package(){\_SB.PCI0.LPCB.H_EC.TFN1, \_SB.PCI0.LPCB.H_EC.TSKN, 100, 65, 50, 30, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF},
+ Package(){\_SB.PCI0.LPCB.H_EC.TFN2, \_SB.PCI0.LPCB.H_EC.TSKN, 100, 65, 50, 30, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF},
+ Package(){\_SB.PCI0.LPCB.H_EC.TFN1, \_SB.PCI0.B0D4, 100, 65, 50, 30, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF},
+ Package(){\_SB.PCI0.LPCB.H_EC.TFN2, \_SB.PCI0.B0D4, 100, 65, 50, 30, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF},
+ })
+
+ Name(ART0, Package() // ART package when in Performance Mode / Active Cooling Mode
+ {
+ 0, // Revision
+ // Source Target Weight, AC0MaxLevel, AC1MaxLevel, AC21MaxLevel, AC31MaxLevel, AC41MaxLevel, AC51MaxLevel, AC61MaxLevel, AC71MaxLevel, AC81MaxLevel, AC91MaxLevel
+ Package(){\_SB.PCI0.LPCB.H_EC.TFN1, \_SB.PCI0.LPCB.H_EC.TSKN, 100, 65, 50, 30, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF},
+ Package(){\_SB.PCI0.LPCB.H_EC.TFN2, \_SB.PCI0.LPCB.H_EC.TSKN, 100, 65, 50, 30, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF},
+ Package(){\_SB.PCI0.LPCB.H_EC.TFN1, \_SB.PCI0.B0D4, 100, 65, 50, 30, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF},
+ Package(){\_SB.PCI0.LPCB.H_EC.TFN2, \_SB.PCI0.B0D4, 100, 65, 50, 30, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF},
+ })
+
+ // _ART (Active Cooling Relationship Table)
+ //
+ // Arguments:
+ // None
+ // Return Value:
+ // A variable-length Package containing a Revision ID and a list of Active Relationship Packages as described below:
+ //
+ // Return Value Information
+ // Package {
+ // Revision, // Integer - Current revision is: 0
+ // ActiveRelationship[0] // Package
+ // ...
+ // ActiveRelationship[n] // Package
+ // }
+ //
+ Method(_ART,,,,PkgObj)
+ { // TODO: Add system-specific _ART code here
+ If(\ECON)
+ {
+ If(\_SB.PCI0.LPCB.H_EC.TSKN.CTYP)
+ {
+ Return(ART1)
+ } Else {
+ Return(ART0)
+ }
+ }
+ } // End _ART
+}
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/B0d4DppmPolicy.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/B0d4DppmPolicy.asl
new file mode 100644
index 0000000..d46e240
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/B0d4DppmPolicy.asl
@@ -0,0 +1,192 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ B0d4DppmPolicy.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Dynamic Platform & Thermal Framework
+
+--*/
+
+
+Scope(\_SB.PCI0.B0D4)
+{
+ Name(CTYP,0) // Device-specific cooling policy preference
+ Name(AHYS,60) // Active Cooling Hysteresis configuration. Use this in conjuction with GTSH to define _ACx hysteresis points. (in 1/10 of K)
+ Name(AC1D,40) // _AC1 Delta from _AC0 (in 1/10 of K)
+ Name(AC2D,80) // _AC2 Delta from _AC0 (in 1/10 of K)
+ Name(GTSH, 0) // No HW Hysteresis for B0D4
+
+ // _ACx (Active Cooling)
+ //
+ // This optional object, if present under a thermal zone, returns the
+ // temperature trip point at which OSPM must start or stop Active cooling,
+ // where x is a value between 0 and 9 that designates multiple active cooling levels of the thermal zone.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the active cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_AC0)
+ {
+ Store(\_SB.IETM.CTOK(ATMC),Local1)
+ If(LGreaterEqual(LSTM,Local1))
+ {
+ Subtract(AHYS, GTSH, Local2)
+ Subtract(Local1, Local2, Local3) // Include Hysteresis
+ Return(Local3)
+ }
+ Else
+ {
+ Return(Local1)
+ }
+ }
+
+ // _ACx (Active Cooling)
+ //
+ // This optional object, if present under a thermal zone, returns the
+ // temperature trip point at which OSPM must start or stop Active cooling,
+ // where x is a value between 0 and 9 that designates multiple active cooling levels of the thermal zone.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the active cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_AC1)
+ {
+ Store(\_SB.IETM.CTOK(ATMC),Local0) // Active Cooling Policy
+ Subtract(Local0, AC1D, Local1)
+ If(LGreaterEqual(LSTM,Local1))
+ {
+ Subtract(AHYS, GTSH, Local2)
+ Subtract(Local1, Local2, Local3) // Include Hysteresis
+ Return(Local3)
+ }
+ Else
+ {
+ Return(Local1)
+ }
+ }
+
+ // _ACx (Active Cooling)
+ //
+ // This optional object, if present under a thermal zone, returns the
+ // temperature trip point at which OSPM must start or stop Active cooling,
+ // where x is a value between 0 and 9 that designates multiple active cooling levels of the thermal zone.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the active cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_AC2)
+ {
+ Store(\_SB.IETM.CTOK(ATMC),Local0) // Active Cooling Policy
+ Subtract(Local0, AC2D, Local1)
+ If(LGreaterEqual(LSTM,Local1))
+ {
+ Subtract(AHYS, GTSH, Local2)
+ Subtract(Local1, Local2, Local3) // Include Hysteresis
+ Return(Local3)
+ }
+ Else
+ {
+ Return(Local1)
+ }
+ }
+
+ // _CRT (Critical Temperature)
+ //
+ // This object, when defined under a thermal zone, returns the critical temperature at which OSPM must shutdown the system.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the critical temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_CRT,0,Serialized)
+ {
+ Return(\_SB.IETM.CTOK(SACR))
+ }
+
+ // _HOT (Hot Temperature)
+ //
+ // This optional object, when defined under a thermal zone, returns the critical temperature
+ // at which OSPM may choose to transition the system into the S4 sleeping state.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // The return value is an integer that represents the critical sleep threshold tenths of degrees Kelvin.
+ //
+ Method(_HOT,0,Serialized)
+ {
+ Return(\_SB.IETM.CTOK(SAHT))
+ }
+
+ // _PSV (Passive)
+ //
+ // This optional object, if present under a thermal zone, evaluates to the temperature
+ // at which OSPM must activate passive cooling policy.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the passive cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_PSV,0,Serialized)
+ {
+ Return(\_SB.IETM.CTOK(PTMC))
+ }
+
+ // _SCP (Set Cooling Policy)
+ //
+ // Arguments: (3)
+ // Arg0 - Mode An Integer containing the cooling mode policy code
+ // Arg1 - AcousticLimit An Integer containing the acoustic limit
+ // Arg2 - PowerLimit An Integer containing the power limit
+ // Return Value:
+ // None
+ //
+ // Argument Information:
+ // Mode - 0 = Active, 1 = Passive
+ // Acoustic Limit - Specifies the maximum acceptable acoustic level that active cooling devices may generate.
+ // Values are 1 to 5 where 1 means no acoustic tolerance and 5 means maximum acoustic tolerance.
+ // Power Limit - Specifies the maximum acceptable power level that active cooling devices may consume.
+ // Values are from 1 to 5 where 1 means no power may be used to cool and 5 means maximum power may be used to cool.
+ //
+ Method(_SCP,3,Serialized)
+ {
+ If(LOr(LEqual(Arg0,0),LEqual(Arg0,1)))
+ {
+ Store(Arg0, CTYP)
+ P8XH(0, Arg1)
+ P8XH(1, Arg2)
+ Notify(B0D4, 0x91)
+ }
+ }
+
+} // End Scope(\_SB.PCI0.B0D4)
+
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/DptfAcpiTablesFfrd.cif b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/DptfAcpiTablesFfrd.cif
new file mode 100644
index 0000000..9d67abb
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/DptfAcpiTablesFfrd.cif
@@ -0,0 +1,25 @@
+<component>
+ name = "DptfAcpiTablesFfrd"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\AcpiTables\Dptf\AcpiTables\Ffrd\"
+ RefName = "DptfAcpiTablesFfrd"
+[files]
+"DptfAcpiTablesFfrd.sdl"
+"DptfAcpiTablesFfrd.mak"
+"DptfAcpiTablesFfrd.inf"
+"B0d4DppmPolicy.asl"
+"Art.asl"
+"DptfFfrd.asl"
+"Ertm.asl"
+"TAmbParticipant.asl"
+"TEfnParticipant.asl"
+"TFN1Participant.asl"
+"TFN2Participant.asl"
+"TMemDppmPolicy.asl"
+"TInlDppmPolicy.asl"
+"TInlParticipant.asl"
+"TMemParticipant.asl"
+"Trt.asl"
+"TSknParticipant.asl"
+"TSknDppmPolicy.asl"
+<endComponent>
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/DptfAcpiTablesFfrd.inf b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/DptfAcpiTablesFfrd.inf
new file mode 100644
index 0000000..6a73ca0
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/DptfAcpiTablesFfrd.inf
@@ -0,0 +1,68 @@
+## @file
+# Component description file for the ACPI tables
+#
+#@copyright
+# Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains an 'Intel Peripheral Driver' and uniquely
+# identified as "Intel Reference Module" and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+
+
+[defines]
+BASE_NAME = DptfAcpiTablesFfrd
+#
+# If the value of this GUID is changed then make sure to change the corresponding GUID (DPTF_ACPI_TABLE_STORAGE_GUID)
+# in DptfAcpiTableStorage.h.
+#
+FILE_GUID = 2820908B-87F6-446b-A100-74EEE36E2918
+COMPONENT_TYPE = ACPITABLE
+FFS_EXT = .ffs
+
+[sources.common]
+ DptfFfrd.ASL
+
+[libraries.common]
+
+[includes.common]
+ .
+ ..
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Include
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include
+
+#
+# Edk II Glue Library, some header are not included by R9 header so have to include
+#
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Framework
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include/Library
+
+[nmake.common]
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/DptfAcpiTablesFfrd.mak b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/DptfAcpiTablesFfrd.mak
new file mode 100644
index 0000000..7fa30fa
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/DptfAcpiTablesFfrd.mak
@@ -0,0 +1,81 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2013, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+#<AMI_FHDR_START>
+#
+# Name: DptfAcpiTablesFfrd.mak
+#
+# Description: MAke file to build Aptio ACPI ASL components
+#
+#
+#<AMI_FHDR_END>
+#*************************************************************************
+all : BuildDptfAcpiTablesFfrd
+
+BuildDptfAcpiTablesFfrd : $(BUILD_DIR)\DptfAcpiTablesFfrd.ffs
+
+#-----------------------------------------------------------------------
+# ASL compiler definition
+#-----------------------------------------------------------------------
+!IF "$(ACPIPLATFORM_ASL_COMPILER)"==""
+!ERROR It is an invalid path, please check your ASL compiler path.
+!ENDIF
+
+IASL = $(ACPIPLATFORM_ASL_COMPILER)
+#-----------------------------------------------------------------------
+
+$(BUILD_DIR)\DptfAcpiTablesFfrd.aml : $(INTEL_DptfAcpiTablesFfrd_DIR)\DptfFfrd.asl
+ $(ASLEXPANDER) $(INTEL_DptfAcpiTablesFfrd_DIR)\DptfFfrd.asl $(BUILD_DIR)\DptfFfrd.asl $(PROJECT_CPU_ROOT)\Include
+ $(IASL) -p $(BUILD_DIR)\DptfAcpiTablesFfrd.aml $(BUILD_DIR)\DptfFfrd.asl
+
+$(BUILD_DIR)\DptfAcpiTablesFfrd.sec: $(BUILD_DIR)\DptfAcpiTablesFfrd.aml
+ $(GENSECTION) -I $*.aml -O $@ -S EFI_SECTION_RAW
+
+#Note. Expand the package with DptfAcpiTablesFfrd tables.
+# DXE phase will load the tables
+# and update Aml contents if provided in Acpiplatform.c
+
+$(BUILD_DIR)\DptfAcpiTablesFfrd.ffs: $(BUILD_DIR)\DptfAcpiTablesFfrd.sec
+ $(GENFFSFILE) -B $(BUILD_DIR) -V -o $@ -P1 <<$(BUILD_DIR)\DptfAcpiTablesFfrd.pkg
+
+PACKAGE.INF
+[.]
+BASE_NAME = DptfAcpiTablesFfrd
+FFS_FILEGUID = 2820908B-87F6-446b-A100-74EEE36E2918
+FFS_FILETYPE = EFI_FV_FILETYPE_FREEFORM
+FFS_ATTRIB_CHECKSUM = TRUE
+
+IMAGE_SCRIPT =
+{
+ Compress (dummy) {
+ $(PROJECT_DIR)\$(BUILD_DIR)\DptfAcpiTablesFfrd.sec
+ }
+}
+<<KEEP
+
+
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2013, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/DptfAcpiTablesFfrd.sdl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/DptfAcpiTablesFfrd.sdl
new file mode 100644
index 0000000..5285e7e
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/DptfAcpiTablesFfrd.sdl
@@ -0,0 +1,25 @@
+TOKEN
+ Name = "DptfAcpiTablesFfrd_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable DptfAcpiTablesFfrd support in Project"
+ TokenType = Boolean
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "INTEL_DptfAcpiTablesFfrd_DIR"
+End
+
+MODULE
+ Help = "Includes DptfAcpiTablesFfrd.mak to Project"
+ File = "DptfAcpiTablesFfrd.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\DptfAcpiTablesFfrd.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+ Token = "DptfAcpiTablesFfrd_SUPPORT" "=" "1"
+End
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/DptfFfrd.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/DptfFfrd.asl
new file mode 100644
index 0000000..0afa8d7
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/DptfFfrd.asl
@@ -0,0 +1,874 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ DptfFfrd.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Dynamic Platform & Thermal Framework
+
+--*/
+
+#include "PowerMgmtDefinitions.h"
+
+DefinitionBlock (
+ "DptfFfrd.aml",
+ "SSDT",
+ 1,
+ "DptfFf",
+ "DptfFfrd",
+ 0x1000
+ )
+{
+
+
+External(P8XH, MethodObj)
+External(ECON, IntObj)
+External(TSOD, IntObj)
+External(PNHM, IntObj)
+External(TCNT, IntObj)
+External(\MPLT, IntObj)
+External(\PWRS, Intobj)
+External(LPMV, IntObj)
+External(CRTT, IntObj)
+External(ATMC, IntObj)
+External(PTMC, IntObj)
+External(ATRA, IntObj)
+External(PTRA, IntObj)
+External(ACTT, IntObj)
+External(PSVT, IntObj)
+External(ATPC, IntObj)
+External(PTPC, IntObj)
+
+External(DPTF, IntObj) // EnableDptf
+External(SADE, IntObj) // EnableSaDevice
+External(SACR, IntObj) // CriticalThermalTripPointSa
+External(SAHT, IntObj) // HotThermalTripPointSa
+
+External(PCHD, IntObj) // EnablePchDevice
+External(PCHC, IntObj) // CriticalThermalTripPointPch
+External(PCHH, IntObj) // HotThermalTripPointPch
+
+External(MEMD, IntObj) // EnableMemoryDevice
+External(MEMC, IntObj) // CriticalThermalTripPointTMEM
+External(MEMH, IntObj) // HotThermalTripPointTMEM
+
+External(FND1, IntObj) // EnableFan1Device
+External(FND2, IntObj) // EnableFan2Device
+
+External(AMBD, IntObj) // EnableAmbientDevice
+External(AMAT, IntObj) // ActiveThermalTripPointAmbient
+External(AMPT, IntObj) // PassiveThermalTripPointAmbient
+External(AMCT, IntObj) // CriticalThermalTripPointAmbient
+External(AMHT, IntObj) // HotThermalTripPointAmbient
+
+External(SKDE, IntObj) // EnableSkinDevice
+External(SKAT, IntObj) // ActiveThermalTripPointSkin
+External(SKPT, IntObj) // PassiveThermalTripPointSkin
+External(SKCT, IntObj) // CriticalThermalTripPointSkin
+External(SKHT, IntObj) // HotThermalTripPointSkin
+
+External(EFDE, IntObj) // EnableExhaustFanDevice
+External(EFAT, IntObj) // ActiveThermalTripPointExhaustFan
+External(EFPT, IntObj) // PassiveThermalTripPointExhaustFan
+External(EFCT, IntObj) // CriticalThermalTripPointExhaustFan
+External(EFHT, IntObj) // HotThermalTripPointExhaustFan
+
+External(VRDE, IntObj) // EnableVRDevice
+External(VRAT, IntObj) // ActiveThermalTripPointVR
+External(VRPT, IntObj) // PassiveThermalTripPointVR
+External(VRCT, IntObj) // CriticalThermalTripPointVR
+External(VRHT, IntObj) // HotThermalTripPointVR
+
+External(WIFD, IntObj) // EnableWifiDevice
+External(WFAT, IntObj) // ActiveThermalTripPointWifi
+External(WFPT, IntObj) // PassiveThermalTripPointWifi
+External(WFCT, IntObj) // CriticalThermalTripPointWifi
+External(WFHT, IntObj) // ActiveHotThermalTripPointWifi
+
+External(WAND, IntObj) // EnableWWANDevice
+External(WWAT, IntObj) // ActiveThermalTripPointWWAN
+External(WWPT, IntObj) // PassiveThermalTripPointWWAN
+External(WWCT, IntObj) // CriticalThermalTripPointWWAN
+External(WWHT, IntObj) // ActiveHotThermalTripPointWWAN
+
+External(CTDP, IntObj) // EnableCtdpPolicy
+External(LPMP, IntObj) // EnableLpmPolicy
+External(DPAP, IntObj) // EnableActivePolicy
+External(DPPP, IntObj) // EnablePassivePolicy
+External(DPCP, IntObj) // EnableCriticalPolicy
+External(DCMP, IntObj) // EnableCoolingModePolicy
+External(ECEU, IntObj) // EnableCurrentExecutionUnit
+External(TGFG, IntObj) // TargetGfxFreq
+External(TRTV, IntObj) // TrtRevision
+External(PWRE, IntObj) // EnablePowerDevice
+External(PWRP, IntObj) // EnablePowerPolicy
+
+External(LPOE, IntObj) // LPOEnable
+External(LPOP, IntObj) // LPOStartPState
+External(LPOS, IntObj) // LPOStepSize
+External(LPOW, IntObj) // LPOPowerControlSetting
+External(LPER, IntObj) // LPOPerformanceControlSetting
+
+External(PPSZ, IntObj) // PPCC Step Size
+External(\PDC0, IntObj) // CPU0 _PDC Flags
+
+External(WWSD,IntObj) // EnableWwanTempSensorDevice
+External(CVSD,IntObj) // EnableCpuVrTempSensorDevice
+External(SSDD,IntObj) // EnableSsdTempSensorDevice
+External(INLD,IntObj) // EnableInletFanTempSensorDevice
+External(IFAT,IntObj) // ActiveThermalTripPointInletFan
+External(IFPT,IntObj) // PassiveThermalTripPointInletFan
+External(IFCT,IntObj) // CriticalThermalTripPointInletFan
+External(IFHT,IntObj) // HotThermalTripPointInletFan
+
+External(\_TZ.ETMD, IntObj)
+External(\_TZ.TZ00, ThermalZoneObj)
+External(\_TZ.FAN0, DeviceObj)
+External(\_TZ.FAN0._FST, PkgObj)
+
+External(\_SB.PCI0, DeviceObj)
+External(\_SB.PCI0.B0D4, DeviceObj)
+External(\_SB.PCI0.MHBR, FieldUnitObj)
+
+External(\_SB.PCI0.LPCB.H_EC, DeviceObj)
+External(\_SB.PCI0.LPCB.H_EC.ECAV, IntObj)
+External(\_SB.PCI0.LPCB.H_EC.ECMD, MethodObj)
+External(\_SB.PCI0.LPCB.H_EC.ECRD, MethodObj) // EC Read Method
+External(\_SB.PCI0.LPCB.H_EC.ECWT, MethodObj) // EC Write Method
+External(\_SB.PCI0.LPCB.H_EC.ECF2, OpRegionObj)
+External(\_SB.PCI0.LPCB.H_EC.SKNT, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.CVRT, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.FANT, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.AMBT, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.PPSL, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.PPSH, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.PINV, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.PENV, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.PSTP, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.CMDR, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.TSD0, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.TSD1, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.DIM0, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.DIM1, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.CFSP, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.CFS2, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.CPUP, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.CPAP, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.PMAX, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.PECH, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.CFAN, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.TSI, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.HYST, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.TSHT, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.TSLT, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.TSSR, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.B1RC, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.B1FC, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.BAT1._BST, MethodObj)
+External(\_SB.PCI0.LPCB.H_EC.B1ML, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.B1MH, FieldUnitObj)
+External(\_SB.PCI0.LPCB.H_EC.PPWR, FieldUnitObj)
+
+External(\_PR.CPU0, ProcessorObj)
+External(\_PR.CPU0._PSS, MethodObj)
+External(\_PR.CPU0._PPC, IntObj)
+External(\_PR.CPU0._TSS, MethodObj)
+External(\_PR.CFGD, FieldUnitObj)
+External(\_PR.CPU0.TSMF, PkgObj)
+External(\_PR.CPU0.TSMC, PkgObj)
+External(\_PR.CPU0._PTC, MethodObj)
+External(\_PR.CPU0._TSD, MethodObj)
+External(\_PR.CPU0._TPC, IntObj)
+External(\_PR.CPU1, ProcessorObj)
+External(\_PR.CPU2, ProcessorObj)
+External(\_PR.CPU3, ProcessorObj)
+External(\_PR.CPU4, ProcessorObj)
+External(\_PR.CPU5, ProcessorObj)
+External(\_PR.CPU6, ProcessorObj)
+External(\_PR.CPU7, ProcessorObj)
+
+External(\_PR.CLVL, FieldUnitObj)
+External(\_PR.CBMI, FieldUnitObj)
+External(\_PR.PL10, FieldUnitObj)
+External(\_PR.PL20, FieldUnitObj)
+External(\_PR.PLW0, FieldUnitObj)
+External(\_PR.CTC0, FieldUnitObj)
+External(\_PR.TAR0, FieldUnitObj)
+External(\_PR.PL11, FieldUnitObj)
+External(\_PR.PL21, FieldUnitObj)
+External(\_PR.PLW1, FieldUnitObj)
+External(\_PR.CTC1, FieldUnitObj)
+External(\_PR.TAR1, FieldUnitObj)
+External(\_PR.PL12, FieldUnitObj)
+External(\_PR.PL22, FieldUnitObj)
+External(\_PR.PLW2, FieldUnitObj)
+External(\_PR.CTC2, FieldUnitObj)
+External(\_PR.TAR2, FieldUnitObj)
+
+External(\_PR.APSV, FieldUnitObj)
+External(\_PR.AAC0, FieldUnitObj)
+External(\_PR.ACRT, FieldUnitObj)
+
+External(\_SB.PCCD.PENB, IntObj)
+
+// Display participant externals
+External(DISE, IntObj) // EnableDisplayParticipant
+External(\_SB.PCI0.GFX0.DD1F._BCL, MethodObj)
+External(\_SB.PCI0.GFX0.DD1F._BCM, MethodObj)
+External(\_SB.PCI0.GFX0.DD1F._BQC, MethodObj)
+External(\_SB.PCI0.GFX0.DD1F._DCS, MethodObj)
+
+Scope(\_SB)
+{
+ //
+ // DPTF Thermal Zone Device
+ //
+ //
+ Device(IETM)
+ {
+ //
+ // Intel DPTF Thermal Framework Device
+ //
+ Name(_HID, EISAID("INT3400"))
+
+ // _STA (Status)
+ //
+ // This object returns the current status of a device.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing a device status bitmap:
+ // Bit 0 - Set if the device is present.
+ // Bit 1 - Set if the device is enabled and decoding its resources.
+ // Bit 2 - Set if the device should be shown in the UI.
+ // Bit 3 - Set if the device is functioning properly (cleared if device failed its diagnostics).
+ // Bit 4 - Set if the battery is present.
+ // Bits 5-31 - Reserved (must be cleared).
+ //
+ Method(_STA)
+ {
+ If (LEqual(DPTF,1)){
+ Return(0x0F)
+ } Else {
+ Return(0x00)
+ }
+ }
+
+ //
+ // Note: there are seven GUID packages in TMPP and up to seven matching store statements in IDSP.
+ // The store statements must never exceed the number of package elements to prevent an overrun.
+ //
+ Name(TMPP,Package()
+ {
+ ToUUID("00000000-0000-0000-0000-000000000000"),
+ ToUUID("00000000-0000-0000-0000-000000000000"),
+ ToUUID("00000000-0000-0000-0000-000000000000"),
+ ToUUID("00000000-0000-0000-0000-000000000000"),
+ ToUUID("00000000-0000-0000-0000-000000000000"),
+ ToUUID("00000000-0000-0000-0000-000000000000"),
+ ToUUID("00000000-0000-0000-0000-000000000000")
+ })
+
+ //
+ // Save original trip points so _OSC method can enable/disable Legacy thermal policies by manipulating trip points.
+ //
+ Name (PTRP,0) // Passive trip point
+ Name (PSEM,0) // Passive semaphore
+ Name (ATRP,0) // Active trip point
+ Name (ASEM,0) // Active semaphore
+ Name (YTRP,0) // Critical trip point
+ Name (YSEM,0) // Critical semaphore
+
+ // IDSP (Intel DPTF Supported Policies)
+ //
+ // This object evaluates to a package of packages, with each package containing the UUID
+ // values to represent a policy implemented and supported by the Intel DPTF software stack.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // Package of Guid packages
+ //
+ Method(IDSP,0,Serialized,,PkgObj)
+ {
+ Name(TMPI,0)
+
+ // Passive Policy GUID
+ If(LAnd(LEqual(DPPP,1),CondRefOf(DPSP))){
+ Store(DeRefOf(Index(DPSP,0)), Index(TMPP,TMPI))
+ Increment(TMPI)
+ }
+
+ // Active Policy GUID
+ If(LAnd(LEqual(DPAP,1),CondRefOf(DASP))){
+ Store(DeRefOf(Index(DASP,0)), Index(TMPP,TMPI))
+ Increment(TMPI)
+ }
+
+ // Critical Policy GUID
+ If(LAnd(LEqual(DPCP,1),CondRefOf(DCSP))){
+ Store(DeRefOf(Index(DCSP,0)), Index(TMPP,TMPI))
+ Increment(TMPI)
+ }
+
+ // Cooling Mode Policy GUID
+ If(LAnd(LEqual(DCMP,1),CondRefOf(DMSP))){
+ Store(DeRefOf(Index(DMSP,0)), Index(TMPP,TMPI))
+ Increment(TMPI)
+ }
+
+ // LPM policy GUID
+ If(LAnd(LEqual(LPMP,1),CondRefOf(LPSP))){
+ Store(DeRefOf(Index(LPSP,0)), Index(TMPP,TMPI))
+ Increment(TMPI)
+ }
+
+ // CTDP Policy GUID
+ If(LAnd(LEqual(CTDP,1),CondRefOf(CTSP))){
+ Store(DeRefOf(Index(CTSP,0)), Index(TMPP,TMPI))
+ Increment(TMPI)
+ }
+
+ //Power Policy GUID
+ If(LAnd(LEqual(PWRP,1),CondRefOf(WPSP))){
+ Store(DeRefOf(Index(WPSP,0)), Index(TMPP,TMPI))
+ }
+
+ Return(TMPP)
+ }
+
+ // _OSC (Operating System Capabilities)
+ //
+ // This object is evaluated by each DPTF policy implementation to communicate to the platform of the existence and/or control transfer.
+ //
+ // Arguments: (4)
+ // Arg0 - A Buffer containing a UUID
+ // Arg1 - An Integer containing a Revision ID of the buffer format
+ // Arg2 - An Integer containing a count of entries in Arg3
+ // Arg3 - A Buffer containing a list of DWORD capabilities
+ // Return Value:
+ // A Buffer containing a list of capabilities
+ //
+ Method(_OSC, 4,Serialized,,BuffObj,{BuffObj,IntObj,IntObj,BuffObj})
+ {
+ Name(NUMP,0)
+ Name (UID2,ToUUID("FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF"))
+
+ // Point to Status DWORD in the Arg3 buffer (STATUS)
+ CreateDWordField(Arg3, 0, STS1)
+
+ // Point to Caps DWORDs of the Arg3 buffer (CAPABILITIES)
+ CreateDWordField(Arg3, 4, CAP1)
+
+ //
+ // _OSC needs to validate the UUID and Revision.
+ //
+ // IF Unrecognized UUID
+ // Return Unrecognized UUID _OSC Failure
+ // IF Unsupported Revision
+ // Return Unsupported Revision _OSC Failure
+ //
+ // STS0[0] = Reserved
+ // STS0[1] = _OSC Failure
+ // STS0[2] = Unrecognized UUID
+ // STS0[3] = Unsupported Revision
+ // STS0[4] = Capabilities masked
+ //
+ // Get the platform UUID's that are available, this will be a package of packages.
+ //
+ IDSP() // initialize TMPP with GUID's
+ Store(SizeOf(TMPP),NUMP) // how many GUID's in the package?
+
+ // Note: The comparison method used is necessary due to
+ // limitations of certain OSes which cannot perform direct
+ // buffer comparisons.
+ //
+ // Create a set of "Input" UUID fields.
+ //
+ CreateDWordField(Arg0, 0x0, IID0)
+ CreateDWordField(Arg0, 0x4, IID1)
+ CreateDWordField(Arg0, 0x8, IID2)
+ CreateDWordField(Arg0, 0xC, IID3)
+ //
+ // Create a set of "Expected" UUID fields.
+ //
+ CreateDWordField(UID2, 0x0, EID0)
+ CreateDWordField(UID2, 0x4, EID1)
+ CreateDWordField(UID2, 0x8, EID2)
+ CreateDWordField(UID2, 0xC, EID3)
+ //
+ // Compare the input UUID to the list of UUID's in the system.
+ //
+ While(NUMP){
+ //
+ // copy one uuid from TMPP to UID2
+ //
+ Store(DeRefOf (Index (TMPP, Subtract(NUMP,1))),UID2)
+ //
+ // Verify the input UUID matches the expected UUID.
+ //
+ If(LAnd(LAnd(LEqual(IID0, EID0), LEqual(IID1, EID1)), LAnd(LEqual(IID2, EID2), LEqual(IID3, EID3)))){
+ Break // break out of while loop when matching UUID is found
+ }
+ Decrement(NUMP)
+ }
+
+ If(LEqual(NUMP,0)){
+ //
+ // Return Unrecognized UUID _OSC Failure
+ //
+ And(STS1,0xFFFFFF00,STS1)
+ Or(STS1,0x6,STS1)
+ Return(Arg3)
+ }
+
+ If(LNot(LEqual(Arg1, 1)))
+ {
+ //
+ // Return Unsupported Revision _OSC Failure
+ //
+ And(STS1,0xFFFFFF00,STS1)
+ Or(STS1,0xA,STS1)
+ Return(Arg3)
+ }
+
+ If(LNot(LEqual(Arg2, 2)))
+ {
+ //
+ // Return Argument 3 Buffer Count not sufficient
+ //
+ And(STS1,0xFFFFFF00,STS1)
+ Or(STS1,0x2,STS1)
+ Return(Arg3)
+ }
+
+ //
+ // Passive Policy GUID
+ //
+ If(LAnd(LEqual(DPPP,1),CondRefOf(\_PR.APSV))){
+ If(LEqual(PSEM,0)){
+ Store(1,PSEM)
+ Store(\_PR.APSV,PTRP) // use semaphore so variable is only initialized once
+ }
+ //
+ // copy the GUID to UID2
+ //
+ If(CondRefOf(DPSP)){
+ Store(DeRefOf (Index (DPSP, 0)),UID2)
+ }
+ //
+ // Verify the test UUID matches the input UUID.
+ //
+ If(LAnd(LAnd(LEqual(IID0, EID0), LEqual(IID1, EID1)), LAnd(LEqual(IID2, EID2), LEqual(IID3, EID3)))){
+ // do passive notify
+ If(Not(And(STS1, 0x01))) // Test Query Flag
+ { // Not a query operation, so process the request
+ If(And(CAP1, 0x01))
+ { // Enable DPTF
+ // Nullify the legacy thermal zone.
+ Store(110,\_PR.APSV)
+ } Else { // Passive unloading, re-enable legacy thermal zone
+ Store(PTRP,\_PR.APSV)
+ }
+ // Send notification to legacy thermal zone for legacy policy to be enabled/disabled
+ Notify(\_TZ.TZ00, 0x80)
+ }
+ Return(Arg3)
+ }
+ }
+
+ //
+ // Active Policy GUID
+ //
+ If(LAnd(LEqual(DPAP,1),CondRefOf(\_PR.AAC0))){
+ If(LEqual(ASEM,0)){
+ Store(1,ASEM)
+ Store(\_PR.AAC0,ATRP) // use semaphore so variable is only initialized once
+ }
+ //
+ // copy the GUID to UID2
+ //
+ If(CondRefOf(DASP)){
+ Store(DeRefOf (Index (DASP, 0)),UID2)
+ }
+ //
+ // Verify the test UUID matches the input UUID.
+ //
+ If(LAnd(LAnd(LEqual(IID0, EID0), LEqual(IID1, EID1)), LAnd(LEqual(IID2, EID2), LEqual(IID3, EID3)))){
+ // do active notify
+ If(Not(And(STS1, 0x01))) // Test Query Flag
+ { // Not a query operation, so process the request
+ If(And(CAP1, 0x01))
+ { // Enable DPTF
+ // Nullify the legacy thermal zone.
+ Store(110,\_PR.AAC0)
+ Store(0, \_TZ.ETMD) // Legacy Active TM Management relies on this variable.
+ } Else { // Passive unloading, re-enable legacy thermal zone
+ Store(ATRP,\_PR.AAC0)
+ Store(1, \_TZ.ETMD)
+ }
+ // Send notification to legacy thermal zone for legacy policy to be enabled/disabled
+ Notify(\_TZ.TZ00, 0x80)
+ }
+ Return(Arg3)
+ }
+ }
+
+ //
+ // Critical Policy GUID
+ //
+ If(LAnd(LEqual(DPCP,1),CondRefOf(\_PR.ACRT))){
+ If(LEqual(YSEM,0)){
+ Store(1,YSEM)
+ Store(\_PR.ACRT,YTRP) // use semaphore so variable is only initialized once
+ }
+ //
+ // copy the GUID to UID2
+ //
+ If(CondRefOf(DCSP)){
+ Store(DeRefOf (Index (DCSP, 0)),UID2)
+ }
+ //
+ // Verify the test UUID matches the input UUID.
+ //
+ If(LAnd(LAnd(LEqual(IID0, EID0), LEqual(IID1, EID1)), LAnd(LEqual(IID2, EID2), LEqual(IID3, EID3)))){
+ // do critical notify
+ If(Not(And(STS1, 0x01))) // Test Query Flag
+ { // Not a query operation, so process the request
+ If(And(CAP1, 0x01))
+ { // Enable DPTF
+ // Nullify the legacy thermal zone.
+ Store(210,\_PR.ACRT)
+ } Else { // Passive unloading, re-enable legacy thermal zone
+ Store(YTRP,\_PR.ACRT)
+ }
+ // Send notification to legacy thermal zone for legacy policy to be enabled/disabled
+ Notify(\_TZ.TZ00, 0x80)
+ }
+ Return(Arg3)
+ }
+ }
+
+ Return(Arg3)
+ }
+ // KTOC (Kelvin to Celsius)
+ //
+ // This control method converts from 10ths of degree Kelvin to Celsius.
+ //
+ // Arguments: (1)
+ // Arg0 - Temperature in 10ths of degree Kelvin
+ // Return Value:
+ // Temperature in Celsius
+ //
+ Method(KTOC,1)
+ {
+ Subtract(Arg0, 2732, Local1)
+ If(LGreater(Local1,0)) // make sure we don't have a negative number
+ {
+ Return(Divide(Local1, 10))
+ }
+ Else
+ {
+ Return(0)
+ }
+ }
+
+ // CTOK (Celsius to Kelvin)
+ //
+ // This control method converts from Celsius to 10ths of degree Kelvin.
+ //
+ // Arguments: (1)
+ // Arg0 - Temperature in Celsius
+ // Return Value:
+ // Temperature in 10ths of degree Kelvin
+ //
+ Method(CTOK, 1)
+ {
+ If(And(Arg0, 0x1000)) // Round negative values up to Zero
+ {
+ Return(2372)
+ }
+ Multiply(Arg0,10,Local0)
+ And(Local0, 0x0FFF, Local1)
+ Add(Local1, 2732, Local2)
+ Return(Local2)
+ }
+
+ // PDRT (power device relation table)
+ //
+ // This object evaluates to a package of packages that indicates the relation between charge rates and target devices.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // A variable-length package of packages as described below.
+ //
+ // Return Value Information
+ // Package {
+ // Package [0] // Package
+ // ....
+ // Package [n] // Package
+ // }
+ //
+ // Each sub-Package contains the elements described below:
+ // Package {
+ // ChargeRate // Integer (DWORD)
+ // TargetDevice // Integer (DWORD)
+ // PTYP // Integer (DWORD)
+ // ControlBuffer // Package
+ // }
+ //
+ Method(PDRT,,,,PkgObj)
+ {
+ \_SB.PCI0.B0D4.PCCC() // init global variable PCCX
+ If (\PWRS){ // check power source
+ PDAC() // AC table
+ } Else {
+ PDDC() // DC table
+ }
+ } // end Method(PDRT)
+
+ Method(PDDC,,,,PkgObj)
+ {
+ Name(TMPD,Package()
+ {
+ Package() {80, \_SB.PCI0.B0D4, 0x09, Package () {0x00010001,0x80000000}}, // Package domain, PL2, target power from CPU PPM
+ Package() {60, \_SB.PCI0.B0D4, 0x09, Package () {0x00010000,0x80000000}}, // Package domain, PL1, target power from CPU PPM
+ Package() {55, \_SB.PCI0.B0D4, 0x09, Package () {0x00070000,1}}, // Package domain, Power Control Turbo Disable
+ Package() {50, \_SB.PCI0.B0D4, 0x09, Package () {0x00030000,0x80000000}}, // Imax Controls - 30A
+ Package() {50, \_SB.PCI0.B0D4, 0x00, Package () {0x00040000,2}}, // Core control - 2 cores
+ Package() {40, \_SB.PCI0.DPLY, 0x0A, Package () {0x00050000,60}}, // Display brightness - 60
+ Package() {40, \_SB.PCI0.TMEM, 0x02, Package () {0x00010000,1000}}, // Memory domain, PL1, target power from TMEM.PPCC
+ Package() {30, \_SB.PCI0.B0D4, 0x00, Package () {0x00020000,80}}, // System Agent Thermal Device, target frequency - P State 80%
+ Package() {20, \_SB.PCI0.B0D4, 0x00, Package () {0x00020001,50}} // System Agent Thermal Device, target frequency - T State 50%
+ })
+
+ If(CondRefOf(\_PR.CBMI)){
+ Switch(ToInteger(\_PR.CBMI)){ // use the boot index from PPM to choose the Power Limit values and copy them to local variables
+ case(0){
+ If(LAnd(LGreaterEqual(\_PR.CLVL,1),LLessEqual(\_PR.CLVL,3))){ // copy PL0 values
+ Store (\_SB.PCI0.B0D4.CPNU(\_PR.PL20,1),Local0) // PL2 minimum power
+ Store (\_SB.PCI0.B0D4.MIN4(\_PR.PL10),Local1) // PL1 minimum power
+ }
+ }
+ case(1){
+ If(LOr(LEqual(\_PR.CLVL,2),LEqual(\_PR.CLVL,3))){ // copy PL1 values
+ Store (\_SB.PCI0.B0D4.CPNU(\_PR.PL21,1),Local0) // PL2 minimum power
+ Store (\_SB.PCI0.B0D4.MIN4(\_PR.PL11),Local1) // PL1 minimum power
+ }
+ }
+ case(2){
+ If(LEqual(\_PR.CLVL,3)){ // copy PL2 values
+ Store (\_SB.PCI0.B0D4.CPNU(\_PR.PL22,1),Local0) // PL2 minimum power
+ Store (\_SB.PCI0.B0D4.MIN4(\_PR.PL12),Local1) // PL1 minimum power
+ }
+ }
+ }
+ }
+
+ // get the iMax value from the PCCC object and copy it to a local variable
+ Store (DerefOf(Index(DerefOf(Index(\_SB.PCI0.B0D4.PCCX,1)),0)),Local2) // CurrentLimitMinimum
+
+ // update the first three packages with the values that we had to dynamically determine
+ // this section might have to be updated any time the PDRT is changed
+ Store(Local0,Index(DeRefOf(Index (DeRefOf (Index (TMPD, 0)),3)),1)) // Package domain, PL2, target power from CPU PPM
+ Store(Local1,Index(DeRefOf(Index (DeRefOf (Index (TMPD, 1)),3)),1)) // Package domain, PL1, target power from CPU PPM
+ Store(Local2,Index(DeRefOf(Index (DeRefOf (Index (TMPD, 3)),3)),1)) // Imax Controls - 30A
+
+ Return(TMPD)
+ } // Method(PDDC)
+
+ Method(PDAC,,,,PkgObj)
+ {
+ Name(TMPD,Package()
+ {
+ Package() {100, \_SB.PCI0.B0D4, 0x09, Package () {0x00010001,0x80000000}}, // Package domain, PL2, target power from CPU PPM
+ Package() {100, \_SB.PCI0.B0D4, 0x09, Package () {0x00010000,0x80000000}}, // Package domain, PL1, target power from CPU PPM
+ Package() {100, \_SB.PCI0.B0D4, 0x09, Package () {0x00070000,0}}, // Package domain, Power Control Turbo Enable
+ Package() {100, \_SB.PCI0.B0D4, 0x09, Package () {0x00030000,0x80000000}}, // Imax Controls - 30A
+ Package() {100, \_SB.PCI0.B0D4, 0x00, Package () {0x00040000,0x80000000}}, // Core control - cores from TCNT
+ Package() {100, \_SB.PCI0.DPLY, 0x0A, Package () {0x00050000,100}}, // Display brightness - 100%
+ Package() {100, \_SB.PCI0.TMEM, 0x02, Package () {0x00010000,5000}}, // Memory domain, PL1, target power from TMEM.PPCC
+ Package() {100, \_SB.PCI0.B0D4, 0x00, Package () {0x00020000,100}} // System Agent Thermal Device, target frequency - P State 0%
+ })
+
+ If(CondRefOf(\_PR.CBMI)){
+ Switch(ToInteger(\_PR.CBMI)){ // use the boot index from PPM to choose the Power Limit values and copy them to local variables
+ case(0){
+ If(LAnd(LGreaterEqual(\_PR.CLVL,1),LLessEqual(\_PR.CLVL,3))){ // copy PL0 values
+ Store (\_SB.PCI0.B0D4.CPNU(\_PR.PL20,1),Local0) // PL2 maximum power
+ Store (\_SB.PCI0.B0D4.CPNU(\_PR.PL10,1),Local1) // PL1 maximum power
+ }
+ }
+ case(1){
+ If(LOr(LEqual(\_PR.CLVL,2),LEqual(\_PR.CLVL,3))){ // copy PL1 values
+ Store (\_SB.PCI0.B0D4.CPNU(\_PR.PL21,1),Local0) // PL2 maximum power
+ Store (\_SB.PCI0.B0D4.CPNU(\_PR.PL11,1),Local1) // PL1 maximum power
+ }
+ }
+ case(2){
+ If(LEqual(\_PR.CLVL,3)){ // copy PL2 values
+ Store (\_SB.PCI0.B0D4.CPNU(\_PR.PL22,1),Local0) // PL2 maximum power
+ Store (\_SB.PCI0.B0D4.CPNU(\_PR.PL12,1),Local1) // PL1 maximum power
+ }
+ }
+ }
+ }
+
+ // get the iMax value from the PCCC object and copy it to a local variable
+ Store (DerefOf(Index(DerefOf(Index(\_SB.PCI0.B0D4.PCCX,1)),1)),Local2) // CurrentLimitMaximum
+
+ // update the first four packages with the values that we had to dynamically determine
+ // this section might have to be updated any time the PDRT is changed
+ Store(Local0,Index(DeRefOf(Index (DeRefOf (Index (TMPD, 0)),3)),1)) // Package domain, PL2, target power from CPU PPM
+ Store(Local1,Index(DeRefOf(Index (DeRefOf (Index (TMPD, 1)),3)),1)) // Package domain, PL1, target power from CPU PPM
+ Store(Local2,Index(DeRefOf(Index (DeRefOf (Index (TMPD, 3)),3)),1)) // Imax Controls - 30A
+ Store(TCNT,Index(DeRefOf(Index (DeRefOf (Index (TMPD, 4)),3)),1)) // Core control - cores from TCNT
+
+ Return(TMPD)
+ } // Method(PDAC)
+
+ } // End IETM Device
+} // End \_SB Scope
+
+//
+// EC support code
+//
+Scope(\_SB.PCI0.LPCB.H_EC) // Open scope to Embedded Controller
+{
+ //
+ // Create a Mutex for PATx methods to prevent Sx resume race condition problems asscociated with EC commands.
+ //
+ Mutex(PATM, 0)
+
+ // _QF1 (Query - Embedded Controller Query F1)
+ //
+ // Handler for EC generated SCI number F1.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // None
+ //
+ Method(_QF1)
+ { // Thermal sensor threshold crossing event handler
+ P8XH(0, 0xf1)
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.TSSR)), Local0)
+ While(Local0) // Ensure that events occuring during execution
+ { // of this handler are not dropped
+ \_SB.PCI0.LPCB.H_EC.ECWT(0, RefOf(\_SB.PCI0.LPCB.H_EC.TSSR)) // clear all status bits
+ If(And(Local0, 0x20, Local1))
+ { // BIT5: Board Fan Inlet Temperature Sensor Threshold Crossed
+ Notify(\_SB.PCI0.LPCB.H_EC.TINL, 0x90)
+ }
+ If(And(Local0, 0x10, Local1))
+ { // BIT4: Memory Temperature Sensor Threshold Crossed
+ Notify(\_SB.PCI0.TMEM, 0x90)
+ }
+ If(And(Local0, 0x8, Local1))
+ { // BIT3: WWAN Board Temperature Sensor Threshold Crossed
+ Notify(\_SB.PCI0.LPCB.H_EC.TAMB, 0x90)
+ }
+ If(And(Local0, 0x4, Local1))
+ { // BIT2: CPU VR Board Temperature Sensor Threshold Crossed
+ Notify(\_SB.PCI0.LPCB.H_EC.TSKN, 0x90)
+ }
+ If(And(Local0, 0x2, Local1))
+ { // BIT1: SSD Board Temperature Sensor Threshold Crossed.
+ Notify(\_SB.PCI0.LPCB.H_EC.TEFN, 0x90)
+ }
+ // BIT0: Not used on Harris Beach.
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.TSSR)), Local0)
+ }
+ }
+} // End \_SB.PCI0.LPCB.H_EC Scope
+
+//
+// Processor files.
+//
+// AMI MODIFY BEGIN
+ //Include("B0d4Participant.asl")
+ Include("B0d4DppmPolicy.asl")
+ //Include("B0d4CtdpPolicy.asl")
+ //Include("B0d4LpmPolicy.asl")
+ #Include "../B0d4Participant.asl"
+ #Include "../B0d4CtdpPolicy.asl"
+ #Include "../B0d4LpmPolicy.asl"
+// AMI MODIFY END
+
+//
+// PCH files
+//
+// AMI MODIFY BEGIN
+ //Include("TpchParticipant.asl")
+ //Include("TpchDppmPolicy.asl")
+ #Include "../TpchParticipant.asl"
+ #Include "../TpchDppmPolicy.asl"
+// AMI MODIFY END
+
+//
+// These participants are used by DPPM policies.
+//
+ Include("TAmbParticipant.asl")
+ // AMI MODIFY BEGIN
+ //Include("TAmbDppmPolicy.asl")
+ #Include "../TAmbDppmPolicy.asl"
+ // AMI MODIFY END
+ Include("TEfnParticipant.asl")
+ // AMI MODIFY BEGIN
+ //Include("TEfnDppmPolicy.asl")
+ #Include "../TEfnDppmPolicy.asl"
+ // AMI MODIFY END
+ Include("TFN1Participant.asl")
+ Include("TFN2Participant.asl")
+ Include("TMemParticipant.asl")
+ Include("TMemDppmPolicy.asl")
+ Include("TSknParticipant.asl")
+ Include("TSknDppmPolicy.asl")
+ // AMI MODIFY BEGIN
+ //Include("DplyParticipant.asl")
+ //Include("TPwrParticipant.asl")
+ #Include "../DplyParticipant.asl"
+ #Include "../TPwrParticipant.asl"
+ // AMI MODIFY END
+ Include("TInlParticipant.asl")
+ Include("TInlDppmPolicy.asl")
+ // AMI MODIFY BEGIN
+ //Include("WWANParticipant.asl")
+ //Include("WWANDppmPolicy.asl")
+ #Include "../WWANParticipant.asl"
+ #Include "../WWANDppmPolicy.asl"
+ // AMI MODIFY END
+//
+// DPPM support files
+//
+ Include("Ertm.asl")
+ Include("Trt.asl")
+ Include("Art.asl")
+ // AMI MODIFY BEGIN
+ //Include("Dppm.asl")
+ #Include "../Dppm.asl"
+ // AMI MODIFY END
+
+} // End SSDT
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/Ertm.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/Ertm.asl
new file mode 100644
index 0000000..d92ce41
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/Ertm.asl
@@ -0,0 +1,53 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ Ertm.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Dynamic Platform & Thermal Framework
+
+--*/
+
+Scope(\_SB.IETM)
+{
+ // ETRM (Intel DPTF Participant List)
+ //
+ // The ETRM object evaluates to a package of packages each of which describes one participant device.
+ //
+ Name(ETRM, Package()
+ { // TODO: Replace with system-specific ETRM data here
+ Package() {\_SB.PCI0.TMEM, "INT3402", 0x06, "0"}, // Memory Device
+ Package() {\_SB.PCI0.LPCB.H_EC.TSKN, "INT3403", 0x06, "0"}, // CPU VR Temperature Sensor
+ Package() {\_SB.PCI0.LPCB.H_EC.TAMB, "INT3403", 0x06, "1"}, // WWAN Temperature Sensor
+ Package() {\_SB.PCI0.LPCB.H_EC.TEFN, "INT3403", 0x06, "3"}, // SSD Board Temperature Sensor
+ Package() {\_SB.PCI0.LPCB.H_EC.TINL, "INT3403", 0x06, "5"}, // Board Fan Inlet Temperature Sensor
+ Package() {\_SB.PCI0.LPCB.H_EC.TPWR, "INT3407", 0x06, "0"}, // Platform Power Device
+ Package() {\_SB.PCI0.LPCB.H_EC.TFN1, "INT3404", 0x06, "0"}, // Fan Control Device
+ Package() {\_SB.PCI0.LPCB.H_EC.TFN2, "INT3404", 0x06, "1"}, // Fan Control Device
+ Package() {\_SB.PCI0.DPLY, "INT3406", 0x06, "0"}, // Display Participant Device
+ Package() {\_SB.PCI0.B0D4, "8086_0A03", 0x00, "0x00040000"}, // HSW ULT SA Thermal Device
+ Package() {\_SB.PCI0.TPCH, "8086_9C24", 0x00, "0x001F0006"}, // LPT ULT PCH Thermal Device
+ Package() {\_SB.PCI0.B0D4, "8086_0D03", 0x00, "0x00040000"} // CRW SA Thermal Device
+ })
+}
+
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/TAmbParticipant.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/TAmbParticipant.asl
new file mode 100644
index 0000000..c9bb332
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/TAmbParticipant.asl
@@ -0,0 +1,184 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ TambParticipant.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Dynamic Platform & Thermal Framework
+
+--*/
+
+Scope(\_SB.PCI0.LPCB.H_EC)
+{
+
+ Device(TAMB) // Ambient temperature sensor
+ {
+ Name(_HID, EISAID("INT3403")) // Intel DPTF Temperature Sensor Device
+ Name(_UID, 1)
+
+ Name(HITP, 0x64)
+ Name(AAUX, 0x10)
+ Name(_STR, Unicode ("WWAN Board Temperature Sensor"))
+ Name(PTYP, 0x03)
+
+ // _STA (Status)
+ //
+ // This object returns the current status of a device.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing a device status bitmap:
+ // Bit 0 - Set if the device is present.
+ // Bit 1 - Set if the device is enabled and decoding its resources.
+ // Bit 2 - Set if the device should be shown in the UI.
+ // Bit 3 - Set if the device is functioning properly (cleared if device failed its diagnostics).
+ // Bit 4 - Set if the battery is present.
+ // Bits 5-31 - Reserved (must be cleared).
+ //
+ Method(_STA)
+ {
+ If (LEqual(WWSD,1)){
+ Return(0x0F)
+ } Else {
+ Return(0x00)
+ }
+ }
+
+ // _TMP (Temperature)
+ //
+ // This control method returns the thermal zone's current operating temperature.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the current temperature of the thermal zone (in tenths of degrees Kelvin)
+ //
+ Method(_TMP,0,Serialized)
+ {
+ If(\ECON)
+ {
+ // Get the Ambient Temperature.
+ Return(\_SB.IETM.CTOK(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.AMBT))))
+ } Else {
+ Return(3000)
+ }
+ }
+
+ // Returns Number of Aux Trips available
+ Name(PATC, 2)
+
+ // PATx (Participant Programmable Auxiliary Trip) - Sets Aux Trip Point
+ //
+ // The PATx objects shall take a single integer parameter, in tenths of degree Kelvin, which
+ // represents the temperature at which the device should notify the participant driver of
+ // an auxiliary trip event. A PATx control method returns no value.
+ //
+ // Arguments: (1)
+ // Arg0 - temperature in tenths of degree Kelvin
+ // Return Value:
+ // None
+ //
+ Method(PAT0, 1, Serialized)
+ {
+ If (\ECON)
+ {
+ Store (Acquire(\_SB.PCI0.LPCB.H_EC.PATM, 100),Local0) // save Acquire result so we can check for Mutex acquired
+ If (LEqual(Local0, Zero)) // check for Mutex acquired
+ {
+ Store(\_SB.IETM.KTOC(Arg0),AAUX)
+ \_SB.PCI0.LPCB.H_EC.ECWT(0x3, RefOf(\_SB.PCI0.LPCB.H_EC.TSI))
+ \_SB.PCI0.LPCB.H_EC.ECWT(0x2, RefOf(\_SB.PCI0.LPCB.H_EC.HYST))
+ \_SB.PCI0.LPCB.H_EC.ECWT(AAUX, RefOf(\_SB.PCI0.LPCB.H_EC.TSLT))
+ \_SB.PCI0.LPCB.H_EC.ECMD(0x4A) //Set Trip point.
+ Release(\_SB.PCI0.LPCB.H_EC.PATM)
+ }
+ }
+ }
+
+ // PATx (Participant Programmable Auxiliary Trip) - Sets Aux Trip Point
+ //
+ // The PATx objects shall take a single integer parameter, in tenths of degree Kelvin, which
+ // represents the temperature at which the device should notify the participant driver of
+ // an auxiliary trip event. A PATx control method returns no value.
+ //
+ // Arguments: (1)
+ // Arg0 - temperature in tenths of degree Kelvin
+ // Return Value:
+ // None
+ //
+ Method(PAT1, 1, Serialized)
+ {
+ If (\ECON)
+ {
+ Store (Acquire(\_SB.PCI0.LPCB.H_EC.PATM, 100),Local0) // save Acquire result so we can check for Mutex acquired
+ If (LEqual(Local0, Zero)) // check for Mutex acquired
+ {
+ Store(\_SB.IETM.KTOC(Arg0),HITP)
+ \_SB.PCI0.LPCB.H_EC.ECWT(0x3, RefOf(\_SB.PCI0.LPCB.H_EC.TSI))
+ \_SB.PCI0.LPCB.H_EC.ECWT(0x2, RefOf(\_SB.PCI0.LPCB.H_EC.HYST))
+ \_SB.PCI0.LPCB.H_EC.ECWT(HITP, RefOf(\_SB.PCI0.LPCB.H_EC.TSHT))
+ \_SB.PCI0.LPCB.H_EC.ECMD(0x4A) //Set Trip point.
+ Release(\_SB.PCI0.LPCB.H_EC.PATM)
+ }
+ }
+ }
+
+ // Thermal Sensor Hysteresis, 2 degrees
+ Name(GTSH, 20)
+
+ Name(LSTM,0) // Last temperature reported
+
+ // _DTI (Device Temperature Indication)
+ //
+ // Conveys the temperature of a device's internal temperature sensor to the platform when a temperature trip point
+ // is crossed or when a meaningful temperature change occurs.
+ //
+ // Arguments: (1)
+ // Arg0 - An Integer containing the current value of the temperature sensor (in tenths Kelvin)
+ // Return Value:
+ // None
+ //
+ Method(_DTI, 1)
+ {
+ Store(Arg0,LSTM)
+ Notify(TAMB, 0x91) // notify the participant of a trip point change event
+ }
+
+ // _NTT (Notification Temperature Threshold)
+ //
+ // Returns the temperature change threshold for devices containing native temperature sensors to cause
+ // evaluation of the _DTI object
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the temperature threshold in tenths of degrees Kelvin.
+ //
+ Method(_NTT, 0)
+ {
+ Return(2782) // 5 degree Celcius, this could be a platform policy with setup item
+ }
+
+ } // End TAMB Device
+}// end Scope(\_SB.PCI0.LPCB.H_EC)
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/TEfnParticipant.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/TEfnParticipant.asl
new file mode 100644
index 0000000..2907303
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/TEfnParticipant.asl
@@ -0,0 +1,184 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ TEFNParticipant.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Dynamic Platform & Thermal Framework
+
+--*/
+
+Scope(\_SB.PCI0.LPCB.H_EC)
+{
+
+ Device(TEFN)
+ {
+ Name(_HID, EISAID("INT3403")) // Intel DPTF Temperature Sensor Device
+ Name(_UID, 3)
+
+ Name(HITP, 0x64)
+ Name(EAUX, 0x10)
+ Name(_STR, Unicode ("SSD Board Temperature Sensor"))
+ Name(PTYP, 0x03)
+
+ // _STA (Status)
+ //
+ // This object returns the current status of a device.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing a device status bitmap:
+ // Bit 0 - Set if the device is present.
+ // Bit 1 - Set if the device is enabled and decoding its resources.
+ // Bit 2 - Set if the device should be shown in the UI.
+ // Bit 3 - Set if the device is functioning properly (cleared if device failed its diagnostics).
+ // Bit 4 - Set if the battery is present.
+ // Bits 5-31 - Reserved (must be cleared).
+ //
+ Method(_STA)
+ {
+ If (LEqual(SSDD,1)){
+ Return(0x0F)
+ } Else {
+ Return(0x00)
+ }
+ }
+
+ // _TMP (Temperature)
+ //
+ // This control method returns the thermal zone's current operating temperature.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the current temperature of the thermal zone (in tenths of degrees Kelvin)
+ //
+ Method(_TMP, 0, Serialized)
+ {
+ If(\ECON)
+ {
+ // Get the Exhaust Fan Temperature.
+ Return(\_SB.IETM.CTOK(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.FANT))))
+ } Else {
+ Return(3000)
+ }
+ }
+
+ // Number of Aux Trips available
+ Name(PATC, 2)
+
+ // PATx (Participant Programmable Auxiliary Trip) - Sets Aux Trip Point
+ //
+ // The PATx objects shall take a single integer parameter, in tenths of degree Kelvin, which
+ // represents the temperature at which the device should notify the participant driver of
+ // an auxiliary trip event. A PATx control method returns no value.
+ //
+ // Arguments: (1)
+ // Arg0 - temperature in tenths of degree Kelvin
+ // Return Value:
+ // None
+ //
+ Method(PAT0, 1, Serialized)
+ {
+ If (\ECON)
+ {
+ Store (Acquire(\_SB.PCI0.LPCB.H_EC.PATM, 100),Local0) // save Acquire result so we can check for Mutex acquired
+ If (LEqual(Local0, Zero)) // check for Mutex acquired
+ {
+ Store(\_SB.IETM.KTOC(Arg0),EAUX)
+ \_SB.PCI0.LPCB.H_EC.ECWT(0x1, RefOf(\_SB.PCI0.LPCB.H_EC.TSI))
+ \_SB.PCI0.LPCB.H_EC.ECWT(0x2, RefOf(\_SB.PCI0.LPCB.H_EC.HYST))
+ \_SB.PCI0.LPCB.H_EC.ECWT(EAUX, RefOf(\_SB.PCI0.LPCB.H_EC.TSLT))
+ \_SB.PCI0.LPCB.H_EC.ECMD(0x4A) //Set Trip point.
+ Release(\_SB.PCI0.LPCB.H_EC.PATM)
+ }
+ }
+ }
+
+ // PATx (Participant Programmable Auxiliary Trip) - Sets Aux Trip Point
+ //
+ // The PATx objects shall take a single integer parameter, in tenths of degree Kelvin, which
+ // represents the temperature at which the device should notify the participant driver of
+ // an auxiliary trip event. A PATx control method returns no value.
+ //
+ // Arguments: (1)
+ // Arg0 - temperature in tenths of degree Kelvin
+ // Return Value:
+ // None
+ //
+ Method(PAT1, 1, Serialized)
+ {
+ If (\ECON)
+ {
+ Store (Acquire(\_SB.PCI0.LPCB.H_EC.PATM, 100),Local0) // save Acquire result so we can check for Mutex acquired
+ If (LEqual(Local0, Zero)) // check for Mutex acquired
+ {
+ Store(\_SB.IETM.KTOC(Arg0),HITP)
+ \_SB.PCI0.LPCB.H_EC.ECWT(0x1, RefOf(\_SB.PCI0.LPCB.H_EC.TSI))
+ \_SB.PCI0.LPCB.H_EC.ECWT(0x2, RefOf(\_SB.PCI0.LPCB.H_EC.HYST))
+ \_SB.PCI0.LPCB.H_EC.ECWT(HITP, RefOf(\_SB.PCI0.LPCB.H_EC.TSHT))
+ \_SB.PCI0.LPCB.H_EC.ECMD(0x4A) //Set Trip point.
+ Release(\_SB.PCI0.LPCB.H_EC.PATM)
+ }
+ }
+ }
+
+ // Thermal Sensor Hysteresis, 2 degrees
+ Name(GTSH, 20)
+
+ Name(LSTM,0) // Last temperature reported
+
+ // _DTI (Device Temperature Indication)
+ //
+ // Conveys the temperature of a device's internal temperature sensor to the platform when a temperature trip point
+ // is crossed or when a meaningful temperature change occurs.
+ //
+ // Arguments: (1)
+ // Arg0 - An Integer containing the current value of the temperature sensor (in tenths Kelvin)
+ // Return Value:
+ // None
+ //
+ Method(_DTI, 1)
+ {
+ Store(Arg0,LSTM)
+ Notify(TEFN, 0x91) // notify the participant of a trip point change event
+ }
+
+ // _NTT (Notification Temperature Threshold)
+ //
+ // Returns the temperature change threshold for devices containing native temperature sensors to cause
+ // evaluation of the _DTI object
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the temperature threshold in tenths of degrees Kelvin.
+ //
+ Method(_NTT, 0)
+ {
+ Return(2782) // 5 degree Celcius, this could be a platform policy with setup item
+ }
+
+ } // End TEFN Device
+}// end Scope(\_SB.PCI0.LPCB.H_EC)
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/TFN1Participant.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/TFN1Participant.asl
new file mode 100644
index 0000000..b76893e
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/TFN1Participant.asl
@@ -0,0 +1,172 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ TFN1Participant.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Dynamic Platform & Thermal Framework
+
+--*/
+
+Scope(\_SB.PCI0.LPCB.H_EC)
+{
+
+ Device(TFN1)
+ {
+ Name(_HID, EISAID("INT3404")) // Intel DPTF Fan Device
+ Name(_UID, 0)
+ Name(_STR, Unicode ("CPU Fan #1"))
+
+ Name(FON, 1) // Indicates if Fan is ON Currently
+
+ // _STA (Status)
+ //
+ // This object returns the current status of a device.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing a device status bitmap:
+ // Bit 0 - Set if the device is present.
+ // Bit 1 - Set if the device is enabled and decoding its resources.
+ // Bit 2 - Set if the device should be shown in the UI.
+ // Bit 3 - Set if the device is functioning properly (cleared if device failed its diagnostics).
+ // Bit 4 - Set if the battery is present.
+ // Bits 5-31 - Reserved (must be cleared).
+ //
+ Method(_STA)
+ {
+ If (LEqual(FND1,1)){
+ Return(0x0F)
+ } Else {
+ Return(0x00)
+ }
+ }
+
+ // _FIF (Fan Information)
+ //
+ // The optional _FIF object provides OSPM with fan device capability information.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // A Package containing the fan device parameters.
+ //
+ Method(_FIF)
+ {
+ Return (Package (){
+ 0, // Revision:Integer
+ 1, // FineGrainControl:Integer Boolean
+ 2, // StepSize:Integer DWORD
+ 0 // LowSpeedNotificationSupport:Integer Boolean
+ })
+ }
+
+ // _FPS (Fan Performance States)
+ //
+ // Evaluates to a variable-length package containing a list of packages that describe the fan device's performance states.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // A variable-length Package containing a Revision ID and a list of Packages that describe the fan device's performance states.
+ //
+ Method(_FPS,,,,PkgObj)
+ {
+ Return (Package()
+ {
+ 0, // Revision:Integer
+ // Control, TripPoint, Speed, NoiseLevel, Power
+ Package(){100, 0xFFFFFFFF, 7000, 500, 5000},
+ Package(){ 95, 0xFFFFFFFF, 6650, 475, 4750},
+ Package(){ 90, 0xFFFFFFFF, 6300, 450, 4500},
+ Package(){ 85, 0xFFFFFFFF, 5950, 425, 4250},
+ Package(){ 80, 0xFFFFFFFF, 5600, 400, 4000},
+ Package(){ 75, 0xFFFFFFFF, 5250, 375, 3750},
+ Package(){ 70, 0xFFFFFFFF, 4900, 350, 3500},
+ Package(){ 60, 0xFFFFFFFF, 4200, 300, 3000},
+ Package(){ 50, 0xFFFFFFFF, 3500, 250, 2500},
+ Package(){ 40, 0xFFFFFFFF, 2800, 200, 2000},
+ Package(){ 25, 0xFFFFFFFF, 1750, 125, 1250},
+ Package(){ 0, 0xFFFFFFFF, 0, 0, 0} // OFF
+ })
+ }
+
+ // _FSL (Fan Set Level)
+ //
+ // The optional _FSL object is a control method that OSPM evaluates to set a fan device's speed (performance state) to a specific level.
+ //
+ // Arguments: (1)
+ // Arg0 - Level (Integer): conveys to the platform the fan speed level to be set.
+ // Return Value:
+ // None
+ //
+ // Argument Information
+ // Arg0: Level. If the fan supports fine-grained control, Level is a percentage of maximum level (0-100)
+ // that the platform is to engage the fan. If the fan does not support fine-grained control,
+ // Level is a Control field value from a package in the _FPS object's package list.
+ // A Level value of zero causes the platform to turn off the fan.
+ //
+ Method(_FSL,1,Serialized)
+ {
+ If(\ECON)
+ {
+ \_SB.PCI0.LPCB.H_EC.ECWT(1, RefOf(\_SB.PCI0.LPCB.H_EC.PPSL))
+ \_SB.PCI0.LPCB.H_EC.ECWT(0, RefOf(\_SB.PCI0.LPCB.H_EC.PPSH))
+ \_SB.PCI0.LPCB.H_EC.ECWT(ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PENV)), RefOf(\_SB.PCI0.LPCB.H_EC.PINV))
+ \_SB.PCI0.LPCB.H_EC.ECWT(Arg0, RefOf(\_SB.PCI0.LPCB.H_EC.PENV))
+ \_SB.PCI0.LPCB.H_EC.ECWT(100, RefOf(\_SB.PCI0.LPCB.H_EC.PSTP))
+ \_SB.PCI0.LPCB.H_EC.ECMD(0x1a) // Command to turn the fan on
+ Notify(\_SB.IETM, 0x83) // Notify DPTF TZ that fan speed has changed
+
+ // Notify OSPM on Fan Speed Changes via DPTF
+ Store(Arg0, Index(\_TZ.FAN0._FST, 1))
+ Notify(\_TZ.FAN0, 0x80)
+ }
+ }
+
+ Name(TFST, Package()
+ {
+ 0, // Revision:Integer
+ 0xFFFFFFFF, // Control:Integer DWORD
+ 0xFFFFFFFF // Speed:Integer DWORD
+ })
+
+ //_FST (Fan Status)
+ //
+ // The optional _FST object provides status information for the fan device.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // A Package containing fan device status information
+ //
+ Method(_FST,,,,PkgObj)
+ {
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PENV)), Index(TFST, 1))
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.CFSP)), Index(TFST, 2))
+ Return(TFST)
+ }
+
+ } // End TFN1 Device
+}// end Scope(\_SB.PCI0.LPCB.H_EC)
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/TFN2Participant.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/TFN2Participant.asl
new file mode 100644
index 0000000..82a36d4
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/TFN2Participant.asl
@@ -0,0 +1,166 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ TFN2Participant.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Dynamic Platform & Thermal Framework
+
+--*/
+
+Scope(\_SB.PCI0.LPCB.H_EC)
+{
+
+ Device(TFN2)
+ {
+ Name(_HID, EISAID("INT3404")) // Intel DPTF Fan Device
+ Name(_UID, 1)
+ Name(_STR, Unicode ("CPU Fan #2"))
+
+ // _STA (Status)
+ //
+ // This object returns the current status of a device.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing a device status bitmap:
+ // Bit 0 - Set if the device is present.
+ // Bit 1 - Set if the device is enabled and decoding its resources.
+ // Bit 2 - Set if the device should be shown in the UI.
+ // Bit 3 - Set if the device is functioning properly (cleared if device failed its diagnostics).
+ // Bit 4 - Set if the battery is present.
+ // Bits 5-31 - Reserved (must be cleared).
+ //
+ Method(_STA)
+ {
+ If (LEqual(FND2,1)){
+ Return(0x0F)
+ } Else {
+ Return(0x00)
+ }
+ }
+
+ // _FIF (Fan Information)
+ //
+ // The optional _FIF object provides OSPM with fan device capability information.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // A Package containing the fan device parameters.
+ //
+ Method(_FIF)
+ {
+ Return (Package (){
+ 0, // Revision:Integer
+ 1, // FineGrainControl:Integer Boolean
+ 2, // StepSize:Integer DWORD
+ 0 // LowSpeedNotificationSupport:Integer Boolean
+ })
+ }
+
+ // _FPS (Fan Performance States)
+ //
+ // Evaluates to a variable-length package containing a list of packages that describe the fan device's performance states.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // A variable-length Package containing a Revision ID and a list of Packages that describe the fan device's performance states.
+ //
+ Method(_FPS,,,,PkgObj)
+ {
+ Return (Package()
+ {
+ 0, // Revision:Integer
+ // Control, TripPoint, Speed, NoiseLevel, Power
+ Package(){100, 0xFFFFFFFF, 7000, 500, 5000},
+ Package(){ 95, 0xFFFFFFFF, 6650, 475, 4750},
+ Package(){ 90, 0xFFFFFFFF, 6300, 450, 4500},
+ Package(){ 85, 0xFFFFFFFF, 5950, 425, 4250},
+ Package(){ 80, 0xFFFFFFFF, 5600, 400, 4000},
+ Package(){ 75, 0xFFFFFFFF, 5250, 375, 3750},
+ Package(){ 70, 0xFFFFFFFF, 4900, 350, 3500},
+ Package(){ 60, 0xFFFFFFFF, 4200, 300, 3000},
+ Package(){ 50, 0xFFFFFFFF, 3500, 250, 2500},
+ Package(){ 40, 0xFFFFFFFF, 2800, 200, 2000},
+ Package(){ 25, 0xFFFFFFFF, 1750, 125, 1250},
+ Package(){ 0, 0xFFFFFFFF, 0, 0, 0} // OFF
+ })
+ }
+
+ // _FSL (Fan Set Level)
+ //
+ // The optional _FSL object is a control method that OSPM evaluates to set a fan device's speed (performance state) to a specific level.
+ //
+ // Arguments: (1)
+ // Arg0 - Level (Integer): conveys to the platform the fan speed level to be set.
+ // Return Value:
+ // None
+ //
+ // Argument Information
+ // Arg0: Level. If the fan supports fine-grained control, Level is a percentage of maximum level (0-100)
+ // that the platform is to engage the fan. If the fan does not support fine-grained control,
+ // Level is a Control field value from a package in the _FPS object's package list.
+ // A Level value of zero causes the platform to turn off the fan.
+ //
+ Method(_FSL,1,Serialized)
+ {
+ If(\ECON)
+ {
+ \_SB.PCI0.LPCB.H_EC.ECWT(2, RefOf(\_SB.PCI0.LPCB.H_EC.PPSL))
+ \_SB.PCI0.LPCB.H_EC.ECWT(0, RefOf(\_SB.PCI0.LPCB.H_EC.PPSH))
+ \_SB.PCI0.LPCB.H_EC.ECWT(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PENV)), RefOf(\_SB.PCI0.LPCB.H_EC.PINV))
+ \_SB.PCI0.LPCB.H_EC.ECWT(Arg0, RefOf(\_SB.PCI0.LPCB.H_EC.PENV))
+ \_SB.PCI0.LPCB.H_EC.ECWT(100, RefOf(\_SB.PCI0.LPCB.H_EC.PSTP))
+ \_SB.PCI0.LPCB.H_EC.ECMD(0x1a) // Command to turn the fan on
+ Notify(\_SB.IETM, 0x83) // Notify DPTF TZ that fan speed has changed
+ }
+ }
+
+ Name(TFST, Package()
+ {
+ 0, // Revision:Integer
+ 0xFFFFFFFF, // Control:Integer DWORD
+ 0xFFFFFFFF // Speed:Integer DWORD
+ })
+
+ //_FST (Fan Status)
+ //
+ // The optional _FST object provides status information for the fan device.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // A Package containing fan device status information
+ //
+ Method(_FST,,,,PkgObj)
+ {
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PENV)), Index(TFST, 1))
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.CFS2)), Index(TFST, 2))
+ Return(TFST)
+ }
+
+ } // End TFN2 Device
+}// end Scope(\_SB.PCI0.LPCB.H_EC)
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/TInlDppmPolicy.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/TInlDppmPolicy.asl
new file mode 100644
index 0000000..b4d1db3
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/TInlDppmPolicy.asl
@@ -0,0 +1,140 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ TInlDppmPolicy.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Dynamic Platform & Thermal Framework
+
+--*/
+
+Scope(\_SB.PCI0.LPCB.H_EC.TINL)
+{
+ Name(CTYP,0) // Device-specific cooling policy preference
+
+ // _SCP (Set Cooling Policy)
+ //
+ // Arguments: (3)
+ // Arg0 - Mode An Integer containing the cooling mode policy code
+ // Arg1 - AcousticLimit An Integer containing the acoustic limit
+ // Arg2 - PowerLimit An Integer containing the power limit
+ // Return Value:
+ // None
+ //
+ // Argument Information:
+ // Mode - 0 = Active, 1 = Passive
+ // Acoustic Limit - Specifies the maximum acceptable acoustic level that active cooling devices may generate.
+ // Values are 1 to 5 where 1 means no acoustic tolerance and 5 means maximum acoustic tolerance.
+ // Power Limit - Specifies the maximum acceptable power level that active cooling devices may consume.
+ // Values are from 1 to 5 where 1 means no power may be used to cool and 5 means maximum power may be used to cool.
+ //
+ Method(_SCP, 3, Serialized)
+ {
+ If(LOr(LEqual(Arg0,0),LEqual(Arg0,1)))
+ {
+ Store(Arg0, CTYP)
+ P8XH(0, Arg1)
+ P8XH(1, Arg2)
+ Notify(\_SB.PCI0.LPCB.H_EC.TINL, 0x91)
+ }
+ }
+
+ // _ACx (Active Cooling)
+ //
+ // This optional object, if present under a thermal zone, returns the
+ // temperature trip point at which OSPM must start or stop Active cooling,
+ // where x is a value between 0 and 9 that designates multiple active cooling levels of the thermal zone.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the active cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_AC0)
+ {
+ If(CTYP)
+ {
+ Store(\_SB.IETM.CTOK(IFPT),Local1) // Passive Cooling Policy
+ } Else {
+ Store(\_SB.IETM.CTOK(IFAT),Local1) // Active Cooling Policy
+ }
+ If(LGreaterEqual(LSTM,Local1))
+ {
+ Return(Subtract(Local1,20)) // subtract 2 degrees which is the Hysteresis
+ }
+ Else
+ {
+ Return(Local1)
+ }
+ }
+
+ // _CRT (Critical Temperature)
+ //
+ // This object, when defined under a thermal zone, returns the critical temperature at which OSPM must shutdown the system.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the critical temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_CRT, 0, Serialized)
+ {
+ Return(\_SB.IETM.CTOK(IFCT))
+ }
+
+ // _HOT (Hot Temperature)
+ //
+ // This optional object, when defined under a thermal zone, returns the critical temperature
+ // at which OSPM may choose to transition the system into the S4 sleeping state.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // The return value is an integer that represents the critical sleep threshold tenths of degrees Kelvin.
+ //
+ Method(_HOT,0,Serialized)
+ {
+ Return(\_SB.IETM.CTOK(IFHT))
+ }
+
+ // _PSV (Passive)
+ //
+ // This optional object, if present under a thermal zone, evaluates to the temperature
+ // at which OSPM must activate passive cooling policy.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the passive cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_PSV, 0, Serialized)
+ {
+ If(CTYP)
+ {
+ Return(\_SB.IETM.CTOK(IFAT)) // Active Cooling Policy
+ } Else {
+ Return(\_SB.IETM.CTOK(IFPT)) // Passive Cooling Policy
+ }
+ }
+
+} // End Scope(\_SB.PCI0.LPCB.H_EC.TINL)
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/TInlParticipant.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/TInlParticipant.asl
new file mode 100644
index 0000000..45b85eb
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/TInlParticipant.asl
@@ -0,0 +1,186 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ InltParticipant.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Dynamic Platform & Thermal Framework
+
+--*/
+
+Scope(\_SB.PCI0.LPCB.H_EC)
+{
+
+ Device(TINL)
+ {
+ Name(_HID, EISAID("INT3403")) // Intel DPTF Temperature Sensor Device
+ Name(_UID, 5)
+
+ Name(HITP, 0x64)
+ Name(SAUX, 0x10)
+ Name(_STR, Unicode ("Board Fan Inlet Temperature Sensor"))
+ Name(PTYP, 0x03)
+
+ // _STA (Status)
+ //
+ // This object returns the current status of a device.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing a device status bitmap:
+ // Bit 0 - Set if the device is present.
+ // Bit 1 - Set if the device is enabled and decoding its resources.
+ // Bit 2 - Set if the device should be shown in the UI.
+ // Bit 3 - Set if the device is functioning properly (cleared if device failed its diagnostics).
+ // Bit 4 - Set if the battery is present.
+ // Bits 5-31 - Reserved (must be cleared).
+ //
+ Method(_STA)
+ {
+ If (LEqual(INLD,1)){
+ Return(0x0F)
+ } Else {
+ Return(0x00)
+ }
+ }
+
+ // _TMP (Temperature)
+ //
+ // This control method returns the thermal zone's current operating temperature.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the current temperature of the thermal zone (in tenths of degrees Kelvin)
+ //
+ Method(_TMP)
+ {
+ If(\ECON)
+ {
+ Store(\_SB.PCI0.LPCB.H_EC.DIM1,Local1) // DIMM1 temperature
+ Return(\_SB.IETM.CTOK(Local1)) // EC reports in Celcius, convert to 10ths of degree Kelvin
+ }
+ Else
+ {
+ Return(3000)
+ }
+ }
+
+ Name(PATC, 2)
+
+ // PATx (Participant Programmable Auxiliary Trip) - Sets Aux Trip Point
+ //
+ // The PATx objects shall take a single integer parameter, in tenths of degree Kelvin, which
+ // represents the temperature at which the device should notify the participant driver of
+ // an auxiliary trip event. A PATx control method returns no value.
+ //
+ // Arguments: (1)
+ // Arg0 - temperature in tenths of degree Kelvin
+ // Return Value:
+ // None
+ //
+ Method(PAT0, 1, Serialized)
+ {
+ If (\ECON)
+ {
+ Store (Acquire(\_SB.PCI0.LPCB.H_EC.PATM, 100),Local0) // save Acquire result so we can check for Mutex acquired
+ If (LEqual(Local0, Zero)) // check for Mutex acquired
+ {
+ Store(\_SB.IETM.KTOC(Arg0),SAUX)
+ \_SB.PCI0.LPCB.H_EC.ECWT(0x5, RefOf(\_SB.PCI0.LPCB.H_EC.TSI))
+ \_SB.PCI0.LPCB.H_EC.ECWT(0x2, RefOf(\_SB.PCI0.LPCB.H_EC.HYST))
+ \_SB.PCI0.LPCB.H_EC.ECWT(SAUX, RefOf(\_SB.PCI0.LPCB.H_EC.TSLT))
+ \_SB.PCI0.LPCB.H_EC.ECMD(0x4A) //Set Trip point.
+ Release(\_SB.PCI0.LPCB.H_EC.PATM)
+ }
+ }
+ }
+
+ // PATx (Participant Programmable Auxiliary Trip) - Sets Aux Trip Point
+ //
+ // The PATx objects shall take a single integer parameter, in tenths of degree Kelvin, which
+ // represents the temperature at which the device should notify the participant driver of
+ // an auxiliary trip event. A PATx control method returns no value.
+ //
+ // Arguments: (1)
+ // Arg0 - temperature in tenths of degree Kelvin
+ // Return Value:
+ // None
+ //
+ Method(PAT1, 1, Serialized)
+ {
+ If (\ECON)
+ {
+ Store (Acquire(\_SB.PCI0.LPCB.H_EC.PATM, 100),Local0) // save Acquire result so we can check for Mutex acquired
+ If (LEqual(Local0, Zero)) // check for Mutex acquired
+ {
+ Store(\_SB.IETM.KTOC(Arg0),HITP)
+ \_SB.PCI0.LPCB.H_EC.ECWT(0x5, RefOf(\_SB.PCI0.LPCB.H_EC.TSI))
+ \_SB.PCI0.LPCB.H_EC.ECWT(0x2, RefOf(\_SB.PCI0.LPCB.H_EC.HYST))
+ \_SB.PCI0.LPCB.H_EC.ECWT(HITP, RefOf(\_SB.PCI0.LPCB.H_EC.TSHT))
+ \_SB.PCI0.LPCB.H_EC.ECMD(0x4A) //Set Trip point.
+ Release(\_SB.PCI0.LPCB.H_EC.PATM)
+ }
+ }
+ }
+
+ // Thermal Sensor Hysteresis, 2 degrees
+ Name(GTSH, 20)
+
+ Name(LSTM,0) // Last temperature reported
+
+ // _DTI (Device Temperature Indication)
+ //
+ // Conveys the temperature of a device's internal temperature sensor to the platform when a temperature trip point
+ // is crossed or when a meaningful temperature change occurs.
+ //
+ // Arguments: (1)
+ // Arg0 - An Integer containing the current value of the temperature sensor (in tenths Kelvin)
+ // Return Value:
+ // None
+ //
+ Method(_DTI, 1)
+ {
+ Store(Arg0,LSTM)
+ Notify(TINL, 0x91) // notify the participant of a trip point change event
+ }
+
+ // _NTT (Notification Temperature Threshold)
+ //
+ // Returns the temperature change threshold for devices containing native temperature sensors to cause
+ // evaluation of the _DTI object
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the temperature threshold in tenths of degrees Kelvin.
+ //
+ Method(_NTT, 0)
+ {
+ Return(2782) // 5 degree Celcius, this could be a platform policy with setup item
+ }
+
+ } // End TINL Device
+
+}// end Scope(\_SB.PCI0.LPCB.H_EC)
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/TMemDppmPolicy.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/TMemDppmPolicy.asl
new file mode 100644
index 0000000..440107c
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/TMemDppmPolicy.asl
@@ -0,0 +1,188 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ TMemDppmPolicy.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Dynamic Platform & Thermal Framework
+
+--*/
+
+Scope(\_SB.PCI0.TMEM)
+{
+ Name(CTYP,0) // Device-specific cooling policy preference
+ Name(AHYS,50) // Active Cooling Hysteresis configuration. Use this in conjuction with GTSH to define _ACx hysteresis points. (in 1/10 of K)
+ Name(AC1D,30) // _AC1 Delta from _AC0 (in 1/10 of K)
+ Name(AC2D,60) // _AC2 Delta from _AC0 (in 1/10 of K)
+
+ // _CRT (Critical Temperature)
+ //
+ // This object, when defined under a thermal zone, returns the critical temperature at which OSPM must shutdown the system.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the critical temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_CRT)
+ {
+ Return(\_SB.IETM.CTOK(MEMC))
+ }
+
+ // _HOT (Hot Temperature)
+ //
+ // This optional object, when defined under a thermal zone, returns the critical temperature
+ // at which OSPM may choose to transition the system into the S4 sleeping state.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // The return value is an integer that represents the critical sleep threshold tenths of degrees Kelvin.
+ //
+ Method(_HOT,0,Serialized)
+ {
+ Return(\_SB.IETM.CTOK(MEMH))
+ }
+
+ // _PSV (Passive)
+ //
+ // This optional object, if present under a thermal zone, evaluates to the temperature
+ // at which OSPM must activate passive cooling policy.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the passive cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_PSV)
+ {
+ Return(\_SB.IETM.CTOK(PTRA))
+ }
+
+ // _SCP (Set Cooling Policy)
+ //
+ // Arguments: (3)
+ // Arg0 - Mode An Integer containing the cooling mode policy code
+ // Arg1 - AcousticLimit An Integer containing the acoustic limit
+ // Arg2 - PowerLimit An Integer containing the power limit
+ // Return Value:
+ // None
+ //
+ // Argument Information:
+ // Mode - 0 = Active, 1 = Passive
+ // Acoustic Limit - Specifies the maximum acceptable acoustic level that active cooling devices may generate.
+ // Values are 1 to 5 where 1 means no acoustic tolerance and 5 means maximum acoustic tolerance.
+ // Power Limit - Specifies the maximum acceptable power level that active cooling devices may consume.
+ // Values are from 1 to 5 where 1 means no power may be used to cool and 5 means maximum power may be used to cool.
+ //
+ Method(_SCP, 3, Serialized)
+ {
+ If(LOr(LEqual(Arg0,0),LEqual(Arg0,1)))
+ {
+ Store(Arg0, CTYP)
+ P8XH(0, Arg1)
+ P8XH(1, Arg2)
+ }
+ }
+
+ // _ACx (Active Cooling)
+ //
+ // This optional object, if present under a thermal zone, returns the
+ // temperature trip point at which OSPM must start or stop Active cooling,
+ // where x is a value between 0 and 9 that designates multiple active cooling levels of the thermal zone.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the active cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_AC0)
+ {
+ Store(\_SB.IETM.CTOK(ATRA),Local1)
+
+ If(LGreaterEqual(LSTM,Local1))
+ {
+ Subtract(AHYS, GTSH, Local2)
+ Subtract(Local1, Local2, Local3) // Include Hysteresis
+ Return(Local3)
+ }
+ Else
+ {
+ Return(Local1)
+ }
+ }
+
+ // _ACx (Active Cooling)
+ //
+ // This optional object, if present under a thermal zone, returns the
+ // temperature trip point at which OSPM must start or stop Active cooling,
+ // where x is a value between 0 and 9 that designates multiple active cooling levels of the thermal zone.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the active cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_AC1)
+ {
+ Store(\_SB.IETM.CTOK(ATRA),Local0) // Active Cooling Policy
+ Subtract(Local0, AC1D, Local1)
+ If(LGreaterEqual(LSTM,Local1))
+ {
+ Subtract(AHYS, GTSH, Local2)
+ Subtract(Local1, Local2, Local3) // Include Hysteresis
+ Return(Local3)
+ }
+ Else
+ {
+ Return(Local1)
+ }
+ }
+
+ // _ACx (Active Cooling)
+ //
+ // This optional object, if present under a thermal zone, returns the
+ // temperature trip point at which OSPM must start or stop Active cooling,
+ // where x is a value between 0 and 9 that designates multiple active cooling levels of the thermal zone.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the active cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_AC2)
+ {
+ Store(\_SB.IETM.CTOK(ATRA),Local0) // Active Cooling Policy
+ Subtract(Local0, AC2D, Local1)
+ If(LGreaterEqual(LSTM,Local1))
+ {
+ Subtract(AHYS, GTSH, Local2)
+ Subtract(Local1, Local2, Local3) // Include Hysteresis
+ Return(Local3)
+ }
+ Else
+ {
+ Return(Local1)
+ }
+ }
+} // End Scope(\_SB.PCI0.TMEM)
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/TMemParticipant.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/TMemParticipant.asl
new file mode 100644
index 0000000..7ed96cd
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/TMemParticipant.asl
@@ -0,0 +1,252 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ TMemParticipant.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Dynamic Platform & Thermal Framework
+
+--*/
+
+Scope(\_SB.PCI0)
+{
+
+ Device(TMEM)
+ {
+ Name(_HID, EISAID("INT3402")) // Intel DPTF Memory Device
+ Name(_UID, 0)
+
+ Name(HITP, 0x64)
+ Name(SAUX, 0x10)
+ Name(_STR, Unicode ("Memory Participant"))
+ Name(LSTM,0) // Last temperature reported
+
+ // _STA (Status)
+ //
+ // This object returns the current status of a device.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing a device status bitmap:
+ // Bit 0 - Set if the device is present.
+ // Bit 1 - Set if the device is enabled and decoding its resources.
+ // Bit 2 - Set if the device should be shown in the UI.
+ // Bit 3 - Set if the device is functioning properly (cleared if device failed its diagnostics).
+ // Bit 4 - Set if the battery is present.
+ // Bits 5-31 - Reserved (must be cleared).
+ //
+ Method(_STA)
+ {
+ If (LEqual(MEMD,1)){
+ Return(0x0F)
+ } Else {
+ Return(0x00)
+ }
+ }
+
+ // PPCC (Participant Power Control Capabilities)
+ //
+ // The PPCC object evaluates to a package of packages that indicates to DPTF processor
+ // participant the power control capabilities.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // PPCC package of packages
+ //
+ Method(PPCC,0,Serialized,,PkgObj)
+ {
+ Return(NPCC)
+ }
+
+ Name (NPCC, Package()
+ { // Field Name : Field Type
+ 2, // Revision : DWordConst
+
+ Package () // Power Limit 1
+ {
+ 0, // PowerLimitIndex : DWordConst = 0
+ 1000, // PowerLimitMinimum : DWordConst
+ 5000, // PowerLimitMaximum : DWordConst
+ 1, // TimeWindowMinimum : DWordConst
+ 28, // TimeWindowMaximum : DWordConst
+ 1000, // StepSize : DWordConst
+ },
+ Package () // Power Limit 2
+ {
+ 1, // PowerLimitIndex : DWordConst = 1
+ 1000, // PowerLimitMinimum : DWordConst
+ 10000, // PowerLimitMaximum : DWordConst
+ 0, // TimeWindowMinimum : DWordConst
+ 0, // TimeWindowMaximum : DWordConst
+ 1000, // StepSize : DWordConst
+ }
+ }) // End of PPCC object
+
+ // _TMP (Temperature)
+ //
+ // This control method returns the thermal zone's current operating temperature.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the current temperature of the thermal zone (in tenths of degrees Kelvin)
+ //
+ Method(_TMP)
+ {
+ If(\ECON)
+ {
+ If(\TSOD) // if TS-on-DIMM sensor present and selected in BIOS SETUP return higher temp
+ {
+ If(LGreater(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.TSD0)),\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.TSD1))))
+ {
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.TSD0)),Local1) // TS-on-DIMM0 temperature
+ }
+ Else
+ {
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.TSD1)),Local1) // TS-on-DIMM1 temperature
+ }
+ }
+ Else // else return higher On-Board DDR Thermal Sensor temp
+ {
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.DIM0)),Local1) // DIMM0 temperature
+ }
+ Return(\_SB.IETM.CTOK(Local1)) // EC reports in Celcius, convert to 10ths of degree Kelvin
+ }
+ Else
+ {
+ Return(3000)
+ }
+ }
+
+ Name(PATC, 2)
+
+ // PATx (Participant Programmable Auxiliary Trip) - Sets Aux Trip Point
+ //
+ // The PATx objects shall take a single integer parameter, in tenths of degree Kelvin, which
+ // represents the temperature at which the device should notify the participant driver of
+ // an auxiliary trip event. A PATx control method returns no value.
+ //
+ // Arguments: (1)
+ // Arg0 - temperature in tenths of degree Kelvin
+ // Return Value:
+ // None
+ //
+ Method(PAT0, 1, Serialized)
+ {
+ If (\ECON)
+ {
+ Store (Acquire(\_SB.PCI0.LPCB.H_EC.PATM, 100),Local0) // save Acquire result so we can check for Mutex acquired
+ If (LEqual(Local0, Zero)) // check for Mutex acquired
+ {
+ Store(\_SB.IETM.KTOC(Arg0),SAUX)
+ \_SB.PCI0.LPCB.H_EC.ECWT(0x4, RefOf(\_SB.PCI0.LPCB.H_EC.TSI))
+ \_SB.PCI0.LPCB.H_EC.ECWT(0x2, RefOf(\_SB.PCI0.LPCB.H_EC.HYST))
+ \_SB.PCI0.LPCB.H_EC.ECWT(SAUX, RefOf(\_SB.PCI0.LPCB.H_EC.TSLT))
+ \_SB.PCI0.LPCB.H_EC.ECMD(0x4A) //Set Trip point.
+ Release(\_SB.PCI0.LPCB.H_EC.PATM)
+ }
+ }
+ }
+
+ // PATx (Participant Programmable Auxiliary Trip) - Sets Aux Trip Point
+ //
+ // The PATx objects shall take a single integer parameter, in tenths of degree Kelvin, which
+ // represents the temperature at which the device should notify the participant driver of
+ // an auxiliary trip event. A PATx control method returns no value.
+ //
+ // Arguments: (1)
+ // Arg0 - temperature in tenths of degree Kelvin
+ // Return Value:
+ // None
+ //
+ Method(PAT1, 1, Serialized)
+ {
+ If (\ECON)
+ {
+ Store (Acquire(\_SB.PCI0.LPCB.H_EC.PATM, 100),Local0) // save Acquire result so we can check for Mutex acquired
+ If (LEqual(Local0, Zero)) // check for Mutex acquired
+ {
+ Store(\_SB.IETM.KTOC(Arg0),HITP)
+ \_SB.PCI0.LPCB.H_EC.ECWT(0x4, RefOf(\_SB.PCI0.LPCB.H_EC.TSI))
+ \_SB.PCI0.LPCB.H_EC.ECWT(0x2, RefOf(\_SB.PCI0.LPCB.H_EC.HYST))
+ \_SB.PCI0.LPCB.H_EC.ECWT(HITP, RefOf(\_SB.PCI0.LPCB.H_EC.TSHT))
+ \_SB.PCI0.LPCB.H_EC.ECMD(0x4A) //Set Trip point.
+ Release(\_SB.PCI0.LPCB.H_EC.PATM)
+ }
+ }
+ }
+
+ // Thermal Sensor Hysteresis, 2 degrees
+ Name(GTSH, 20)
+
+ // _DTI (Device Temperature Indication)
+ //
+ // Conveys the temperature of a device's internal temperature sensor to the platform when a temperature trip point
+ // is crossed or when a meaningful temperature change occurs.
+ //
+ // Arguments: (1)
+ // Arg0 - An Integer containing the current value of the temperature sensor (in tenths Kelvin)
+ // Return Value:
+ // None
+ //
+ Method(_DTI, 1)
+ {
+ Store(Arg0,LSTM)
+ Notify(TMEM, 0x91) // notify the participant of a trip point change event
+ }
+
+ // _NTT (Notification Temperature Threshold)
+ //
+ // Returns the temperature change threshold for devices containing native temperature sensors to cause
+ // evaluation of the _DTI object
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the temperature threshold in tenths of degrees Kelvin.
+ //
+ Method(_NTT, 0)
+ {
+ Return(2782) // 5 degree Celcius, this could be a platform policy with setup item
+ }
+
+ // PGMB (Pci GMch Bar)
+ //
+ // This object is required to be implemented on platforms supporting Intel code name Sandy Bridge processor.
+ // This object is not required for platforms supporting Intel code name Ivy Bridge processor.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // Return MCH Bar value.
+ //
+ Method(PGMB, 0)
+ {
+ Return(\_SB.PCI0.MHBR) // Return MCH Bar value
+ }
+
+ } // End TMEM Device
+
+}// end Scope(\_SB.PCI0)
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/TSknDppmPolicy.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/TSknDppmPolicy.asl
new file mode 100644
index 0000000..f1fccab
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/TSknDppmPolicy.asl
@@ -0,0 +1,190 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ TSknDppmPolicy.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Dynamic Platform & Thermal Framework
+
+--*/
+
+Scope(\_SB.PCI0.LPCB.H_EC.TSKN)
+{
+ Name(CTYP,0) // Device-specific cooling policy preference
+ Name(AHYS,30) // Active Cooling Hysteresis configuration. Use this in conjuction with GTSH to define _ACx hysteresis points. (in 1/10 of K)
+ Name(AC1D,30) // _AC1 Delta from _AC0 (in 1/10 of K)
+ Name(AC2D,60) // _AC2 Delta from _AC0 (in 1/10 of K)
+
+ // _SCP (Set Cooling Policy)
+ //
+ // Arguments: (3)
+ // Arg0 - Mode An Integer containing the cooling mode policy code
+ // Arg1 - AcousticLimit An Integer containing the acoustic limit
+ // Arg2 - PowerLimit An Integer containing the power limit
+ // Return Value:
+ // None
+ //
+ // Argument Information:
+ // Mode - 0 = Active, 1 = Passive
+ // Acoustic Limit - Specifies the maximum acceptable acoustic level that active cooling devices may generate.
+ // Values are 1 to 5 where 1 means no acoustic tolerance and 5 means maximum acoustic tolerance.
+ // Power Limit - Specifies the maximum acceptable power level that active cooling devices may consume.
+ // Values are from 1 to 5 where 1 means no power may be used to cool and 5 means maximum power may be used to cool.
+ //
+ Method(_SCP,3,Serialized)
+ {
+ If(LOr(LEqual(Arg0,0),LEqual(Arg0,1)))
+ {
+ Store(Arg0, CTYP)
+ P8XH(0, Arg1)
+ P8XH(1, Arg2)
+ Notify(\_SB.PCI0.LPCB.H_EC.TSKN, 0x91)
+ }
+ }
+
+ // _ACx (Active Cooling)
+ //
+ // This optional object, if present under a thermal zone, returns the
+ // temperature trip point at which OSPM must start or stop Active cooling,
+ // where x is a value between 0 and 9 that designates multiple active cooling levels of the thermal zone.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the active cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_AC0)
+ {
+ Store(\_SB.IETM.CTOK(SKAT),Local1)
+
+ If(LGreaterEqual(LSTM,Local1))
+ {
+ Subtract(AHYS, GTSH, Local2)
+ Subtract(Local1, Local2, Local3) // Include Hysteresis
+ Return(Local3)
+ }
+ Else
+ {
+ Return(Local1)
+ }
+ }
+
+ // _ACx (Active Cooling)
+ //
+ // This optional object, if present under a thermal zone, returns the
+ // temperature trip point at which OSPM must start or stop Active cooling,
+ // where x is a value between 0 and 9 that designates multiple active cooling levels of the thermal zone.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the active cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_AC1)
+ {
+ Store(\_SB.IETM.CTOK(SKAT),Local0) // Active Cooling Policy
+ Subtract(Local0, AC1D, Local1)
+ If(LGreaterEqual(LSTM,Local1))
+ {
+ Subtract(AHYS, GTSH, Local2)
+ Subtract(Local1, Local2, Local3) // Include Hysteresis
+ Return(Local3)
+ }
+ Else
+ {
+ Return(Local1)
+ }
+ }
+
+ // _ACx (Active Cooling)
+ //
+ // This optional object, if present under a thermal zone, returns the
+ // temperature trip point at which OSPM must start or stop Active cooling,
+ // where x is a value between 0 and 9 that designates multiple active cooling levels of the thermal zone.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the active cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_AC2)
+ {
+ Store(\_SB.IETM.CTOK(SKAT),Local0) // Active Cooling Policy
+ Subtract(Local0, AC2D, Local1)
+ If(LGreaterEqual(LSTM,Local1))
+ {
+ Subtract(AHYS, GTSH, Local2)
+ Subtract(Local1, Local2, Local3) // Include Hysteresis
+ Return(Local3)
+ }
+ Else
+ {
+ Return(Local1)
+ }
+ }
+
+ // _CRT (Critical Temperature)
+ //
+ // This object, when defined under a thermal zone, returns the critical temperature at which OSPM must shutdown the system.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the critical temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_CRT)
+ {
+ Return(\_SB.IETM.CTOK(SKCT))
+ }
+
+ // _HOT (Hot Temperature)
+ //
+ // This optional object, when defined under a thermal zone, returns the critical temperature
+ // at which OSPM may choose to transition the system into the S4 sleeping state.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // The return value is an integer that represents the critical sleep threshold tenths of degrees Kelvin.
+ //
+ Method(_HOT,0,Serialized)
+ {
+ Return(\_SB.IETM.CTOK(SKHT) )
+ }
+
+ // _PSV (Passive)
+ //
+ // This optional object, if present under a thermal zone, evaluates to the temperature
+ // at which OSPM must activate passive cooling policy.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the passive cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_PSV)
+ {
+ Return(\_SB.IETM.CTOK(SKPT)) // Passive Cooling Policy
+ }
+
+} // End Scope(\_SB.PCI0.LPCB.H_EC.TSKN)
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/TSknParticipant.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/TSknParticipant.asl
new file mode 100644
index 0000000..b2c2859
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/TSknParticipant.asl
@@ -0,0 +1,183 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ TSknParticipant.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Dynamic Platform & Thermal Framework
+
+--*/
+
+Scope(\_SB.PCI0.LPCB.H_EC)
+{
+
+ Device(TSKN) // Skin temperature sensor
+ {
+ Name(_HID, EISAID("INT3403")) // Intel DPTF Temperature Sensor Device
+ Name(_UID, 0)
+
+ Name(HITP, 0x64)
+ Name(SAUX, 0x10)
+ Name(_STR, Unicode ("CPU VR Board Temperature Sensor"))
+ Name(PTYP, 0x03)
+
+ // _STA (Status)
+ //
+ // This object returns the current status of a device.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing a device status bitmap:
+ // Bit 0 - Set if the device is present.
+ // Bit 1 - Set if the device is enabled and decoding its resources.
+ // Bit 2 - Set if the device should be shown in the UI.
+ // Bit 3 - Set if the device is functioning properly (cleared if device failed its diagnostics).
+ // Bit 4 - Set if the battery is present.
+ // Bits 5-31 - Reserved (must be cleared).
+ //
+ Method(_STA)
+ {
+ If (LEqual(CVSD,1)){
+ Return(0x0F)
+ } Else {
+ Return(0x00)
+ }
+ }
+ // _TMP (Temperature)
+ //
+ // This control method returns the thermal zone's current operating temperature.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the current temperature of the thermal zone (in tenths of degrees Kelvin)
+ //
+ Method(_TMP,0,Serialized)
+ {
+ If(\ECON)
+ { // Get the Skin Temperature.
+ Return(\_SB.IETM.CTOK(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.SKNT))))
+ } Else {
+ Return(3000)
+ }
+ }
+
+ // Number of Aux Trips available
+ Name(PATC, 2)
+
+ // PATx (Participant Programmable Auxiliary Trip) - Sets Aux Trip Point
+ //
+ // The PATx objects shall take a single integer parameter, in tenths of degree Kelvin, which
+ // represents the temperature at which the device should notify the participant driver of
+ // an auxiliary trip event. A PATx control method returns no value.
+ //
+ // Arguments: (1)
+ // Arg0 - temperature in tenths of degree Kelvin
+ // Return Value:
+ // None
+ //
+ Method(PAT0, 1, Serialized)
+ {
+ If (\ECON)
+ {
+ Store (Acquire(\_SB.PCI0.LPCB.H_EC.PATM, 100),Local0) // save Acquire result so we can check for Mutex acquired
+ If (LEqual(Local0, Zero)) // check for Mutex acquired
+ {
+ Store(\_SB.IETM.KTOC(Arg0),SAUX)
+ \_SB.PCI0.LPCB.H_EC.ECWT(0x2, RefOf(\_SB.PCI0.LPCB.H_EC.TSI))
+ \_SB.PCI0.LPCB.H_EC.ECWT(0x2, RefOf(\_SB.PCI0.LPCB.H_EC.HYST))
+ \_SB.PCI0.LPCB.H_EC.ECWT(SAUX, RefOf(\_SB.PCI0.LPCB.H_EC.TSLT))
+ \_SB.PCI0.LPCB.H_EC.ECMD(0x4A) // Set Trip point
+ Release(\_SB.PCI0.LPCB.H_EC.PATM)
+ }
+ }
+ }
+
+ // PATx (Participant Programmable Auxiliary Trip) - Sets Aux Trip Point
+ //
+ // The PATx objects shall take a single integer parameter, in tenths of degree Kelvin, which
+ // represents the temperature at which the device should notify the participant driver of
+ // an auxiliary trip event. A PATx control method returns no value.
+ //
+ // Arguments: (1)
+ // Arg0 - temperature in tenths of degree Kelvin
+ // Return Value:
+ // None
+ //
+ Method(PAT1, 1, Serialized)
+ {
+ If (\ECON)
+ {
+ Store (Acquire(\_SB.PCI0.LPCB.H_EC.PATM, 100),Local0) // save Acquire result so we can check for Mutex acquired
+ If (LEqual(Local0, Zero)) // check for Mutex acquired
+ {
+ Store(\_SB.IETM.KTOC(Arg0),HITP)
+ \_SB.PCI0.LPCB.H_EC.ECWT(0x2, RefOf(\_SB.PCI0.LPCB.H_EC.TSI))
+ \_SB.PCI0.LPCB.H_EC.ECWT(0x2, RefOf(\_SB.PCI0.LPCB.H_EC.HYST))
+ // Set High Trip to PSV or ACT
+ \_SB.PCI0.LPCB.H_EC.ECWT(HITP, RefOf(\_SB.PCI0.LPCB.H_EC.TSHT))
+ \_SB.PCI0.LPCB.H_EC.ECMD(0x4A) //Set Trip point.
+ Release(\_SB.PCI0.LPCB.H_EC.PATM)
+ }
+ }
+ }
+
+ // Thermal Sensor Hysteresis, 2 degrees
+ Name(GTSH, 20)
+
+ Name(LSTM,0) // Last temperature reported
+
+ // _DTI (Device Temperature Indication)
+ //
+ // Conveys the temperature of a device's internal temperature sensor to the platform when a temperature trip point
+ // is crossed or when a meaningful temperature change occurs.
+ //
+ // Arguments: (1)
+ // Arg0 - An Integer containing the current value of the temperature sensor (in tenths Kelvin)
+ // Return Value:
+ // None
+ //
+ Method(_DTI, 1)
+ {
+ Store(Arg0,LSTM)
+ Notify(TSKN, 0x91) // notify the participant of a trip point change event
+ }
+
+ // _NTT (Notification Temperature Threshold)
+ //
+ // Returns the temperature change threshold for devices containing native temperature sensors to cause
+ // evaluation of the _DTI object
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the temperature threshold in tenths of degrees Kelvin.
+ //
+ Method(_NTT, 0)
+ {
+ Return(2782) // 5 degree Celcius, this could be a platform policy with setup item
+ }
+
+ } // End TSKN Device
+}// end Scope(\_SB.PCI0.LPCB.H_EC)
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/Trt.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/Trt.asl
new file mode 100644
index 0000000..6dcd130
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Ffrd/Trt.asl
@@ -0,0 +1,86 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ Trt.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Intel Dynamic Power Performance Management
+
+--*/
+
+Scope(\_SB.IETM)
+{
+
+ Name(TRT0, Package()
+ {
+ // Source Target Influence Period Reserved
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.B0D4, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.B0D4, 10, 100, 0, 0, 0, 0},
+
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.TPCH, 30, 50, 0, 0, 0, 0},
+
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 300, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TSKN, 1, 300, 0, 0, 0, 0},
+
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TAMB, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TAMB, 1, 200, 0, 0, 0, 0},
+
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TINL, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.LPCB.H_EC.TINL, 20, 200, 0, 0, 0, 0}
+ })
+
+ // TRTR (Thermal Relationship Table Revision)
+ //
+ // This object evaluates to an integer value that defines the revision of the _TRT object.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // 0: Traditional TRT as defined by the ACPI Specification.
+ // 1: Priority based TRT
+ //
+ Method(TRTR)
+ {
+ Return(TRTV)
+ }
+
+ // _TRT (Thermal Relationship Table)
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // A variable-length Package containing a list of Thermal Relationship Packages as described below.
+ //
+ // Return Value Information
+ // Package {
+ // ThermalRelationship[0] // Package
+ // ...
+ // ThermalRelationship[n] // Package
+ // }
+ //
+ Method(_TRT,,,,PkgObj)
+ {
+ Return(TRT0)
+ } // End _TRT
+}
+
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/TAmbDppmPolicy.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/TAmbDppmPolicy.asl
new file mode 100644
index 0000000..8546d23
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/TAmbDppmPolicy.asl
@@ -0,0 +1,140 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ TamdDppmPolicy.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Dynamic Platform & Thermal Framework
+
+--*/
+
+Scope(\_SB.PCI0.LPCB.H_EC.TAMB)
+{
+ Name(CTYP,0) // Device-specific cooling policy preference
+
+ // _SCP (Set Cooling Policy)
+ //
+ // Arguments: (3)
+ // Arg0 - Mode An Integer containing the cooling mode policy code
+ // Arg1 - AcousticLimit An Integer containing the acoustic limit
+ // Arg2 - PowerLimit An Integer containing the power limit
+ // Return Value:
+ // None
+ //
+ // Argument Information:
+ // Mode - 0 = Active, 1 = Passive
+ // Acoustic Limit - Specifies the maximum acceptable acoustic level that active cooling devices may generate.
+ // Values are 1 to 5 where 1 means no acoustic tolerance and 5 means maximum acoustic tolerance.
+ // Power Limit - Specifies the maximum acceptable power level that active cooling devices may consume.
+ // Values are from 1 to 5 where 1 means no power may be used to cool and 5 means maximum power may be used to cool.
+ //
+ Method(_SCP, 3, Serialized)
+ {
+ If(LOr(LEqual(Arg0,0),LEqual(Arg0,1)))
+ {
+ Store(Arg0, CTYP)
+ P8XH(0, Arg1)
+ P8XH(1, Arg2)
+ Notify(\_SB.PCI0.LPCB.H_EC.TAMB, 0x91)
+ }
+ }
+
+ // _ACx (Active Cooling)
+ //
+ // This optional object, if present under a thermal zone, returns the
+ // temperature trip point at which OSPM must start or stop Active cooling,
+ // where x is a value between 0 and 9 that designates multiple active cooling levels of the thermal zone.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the active cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_AC0)
+ {
+ If(CTYP)
+ {
+ Store(\_SB.IETM.CTOK(AMPT),Local1) // Passive Cooling Policy
+ } Else {
+ Store(\_SB.IETM.CTOK(AMAT),Local1) // Active Cooling Policy
+ }
+ If(LGreaterEqual(LSTM,Local1))
+ {
+ Return(Subtract(Local1,20)) // subtract 2 degrees which is the Hysteresis
+ }
+ Else
+ {
+ Return(Local1)
+ }
+ }
+
+ // _CRT (Critical Temperature)
+ //
+ // This object, when defined under a thermal zone, returns the critical temperature at which OSPM must shutdown the system.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the critical temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_CRT, 0, Serialized)
+ {
+ Return(\_SB.IETM.CTOK(AMCT))
+ }
+
+ // _HOT (Hot Temperature)
+ //
+ // This optional object, when defined under a thermal zone, returns the critical temperature
+ // at which OSPM may choose to transition the system into the S4 sleeping state.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // The return value is an integer that represents the critical sleep threshold tenths of degrees Kelvin.
+ //
+ Method(_HOT,0,Serialized)
+ {
+ Return(\_SB.IETM.CTOK(AMHT))
+ }
+
+ // _PSV (Passive)
+ //
+ // This optional object, if present under a thermal zone, evaluates to the temperature
+ // at which OSPM must activate passive cooling policy.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the passive cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_PSV, 0, Serialized)
+ {
+ If(CTYP)
+ {
+ Return(\_SB.IETM.CTOK(AMAT)) // Active Cooling Policy
+ } Else {
+ Return(\_SB.IETM.CTOK(AMPT)) // Passive Cooling Policy
+ }
+ }
+
+} // End Scope(\_SB.PCI0.LPCB.H_EC.TAMB)
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/TAmbParticipant.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/TAmbParticipant.asl
new file mode 100644
index 0000000..f7a91b9
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/TAmbParticipant.asl
@@ -0,0 +1,184 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ TambParticipant.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Dynamic Platform & Thermal Framework
+
+--*/
+
+Scope(\_SB.PCI0.LPCB.H_EC)
+{
+
+ Device(TAMB) // Ambient temperature sensor
+ {
+ Name(_HID, EISAID("INT3403")) // Intel DPTF Temperature Sensor Device
+ Name(_UID, 1)
+
+ Name(HITP, 0x64)
+ Name(AAUX, 0x10)
+ Name(_STR, Unicode ("Ambience Temperature Sensor"))
+ Name(PTYP, 0x03)
+
+ // _STA (Status)
+ //
+ // This object returns the current status of a device.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing a device status bitmap:
+ // Bit 0 - Set if the device is present.
+ // Bit 1 - Set if the device is enabled and decoding its resources.
+ // Bit 2 - Set if the device should be shown in the UI.
+ // Bit 3 - Set if the device is functioning properly (cleared if device failed its diagnostics).
+ // Bit 4 - Set if the battery is present.
+ // Bits 5-31 - Reserved (must be cleared).
+ //
+ Method(_STA)
+ {
+ If (LEqual(AMBD,1)){
+ Return(0x0F)
+ } Else {
+ Return(0x00)
+ }
+ }
+
+ // _TMP (Temperature)
+ //
+ // This control method returns the thermal zone's current operating temperature.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the current temperature of the thermal zone (in tenths of degrees Kelvin)
+ //
+ Method(_TMP,0,Serialized)
+ {
+ If(\ECON)
+ {
+ // Get the Ambient Temperature.
+ Return(\_SB.IETM.CTOK(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.AMBT))))
+ } Else {
+ Return(3000)
+ }
+ }
+
+ // Returns Number of Aux Trips available
+ Name(PATC, 2)
+
+ // PATx (Participant Programmable Auxiliary Trip) - Sets Aux Trip Point
+ //
+ // The PATx objects shall take a single integer parameter, in tenths of degree Kelvin, which
+ // represents the temperature at which the device should notify the participant driver of
+ // an auxiliary trip event. A PATx control method returns no value.
+ //
+ // Arguments: (1)
+ // Arg0 - temperature in tenths of degree Kelvin
+ // Return Value:
+ // None
+ //
+ Method(PAT0, 1, Serialized)
+ {
+ If (\ECON)
+ {
+ Store (Acquire(\_SB.PCI0.LPCB.H_EC.PATM, 100),Local0) // save Acquire result so we can check for Mutex acquired
+ If (LEqual(Local0, Zero)) // check for Mutex acquired
+ {
+ Store(\_SB.IETM.KTOC(Arg0),AAUX)
+ \_SB.PCI0.LPCB.H_EC.ECWT(0x3, RefOf(\_SB.PCI0.LPCB.H_EC.TSI))
+ \_SB.PCI0.LPCB.H_EC.ECWT(0x2, RefOf(\_SB.PCI0.LPCB.H_EC.HYST))
+ \_SB.PCI0.LPCB.H_EC.ECWT(AAUX, RefOf(\_SB.PCI0.LPCB.H_EC.TSLT))
+ \_SB.PCI0.LPCB.H_EC.ECMD(0x4A) //Set Trip point.
+ Release(\_SB.PCI0.LPCB.H_EC.PATM)
+ }
+ }
+ }
+
+ // PATx (Participant Programmable Auxiliary Trip) - Sets Aux Trip Point
+ //
+ // The PATx objects shall take a single integer parameter, in tenths of degree Kelvin, which
+ // represents the temperature at which the device should notify the participant driver of
+ // an auxiliary trip event. A PATx control method returns no value.
+ //
+ // Arguments: (1)
+ // Arg0 - temperature in tenths of degree Kelvin
+ // Return Value:
+ // None
+ //
+ Method(PAT1, 1, Serialized)
+ {
+ If (\ECON)
+ {
+ Store (Acquire(\_SB.PCI0.LPCB.H_EC.PATM, 100),Local0) // save Acquire result so we can check for Mutex acquired
+ If (LEqual(Local0, Zero)) // check for Mutex acquired
+ {
+ Store(\_SB.IETM.KTOC(Arg0),HITP)
+ \_SB.PCI0.LPCB.H_EC.ECWT(0x3, RefOf(\_SB.PCI0.LPCB.H_EC.TSI))
+ \_SB.PCI0.LPCB.H_EC.ECWT(0x2, RefOf(\_SB.PCI0.LPCB.H_EC.HYST))
+ \_SB.PCI0.LPCB.H_EC.ECWT(HITP, RefOf(\_SB.PCI0.LPCB.H_EC.TSHT))
+ \_SB.PCI0.LPCB.H_EC.ECMD(0x4A) //Set Trip point.
+ Release(\_SB.PCI0.LPCB.H_EC.PATM)
+ }
+ }
+ }
+
+ // Thermal Sensor Hysteresis, 2 degrees
+ Name(GTSH, 20)
+
+ Name(LSTM,0) // Last temperature reported
+
+ // _DTI (Device Temperature Indication)
+ //
+ // Conveys the temperature of a device's internal temperature sensor to the platform when a temperature trip point
+ // is crossed or when a meaningful temperature change occurs.
+ //
+ // Arguments: (1)
+ // Arg0 - An Integer containing the current value of the temperature sensor (in tenths Kelvin)
+ // Return Value:
+ // None
+ //
+ Method(_DTI, 1)
+ {
+ Store(Arg0,LSTM)
+ Notify(TAMB, 0x91) // notify the participant of a trip point change event
+ }
+
+ // _NTT (Notification Temperature Threshold)
+ //
+ // Returns the temperature change threshold for devices containing native temperature sensors to cause
+ // evaluation of the _DTI object
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the temperature threshold in tenths of degrees Kelvin.
+ //
+ Method(_NTT, 0)
+ {
+ Return(2782) // 5 degree Celcius, this could be a platform policy with setup item
+ }
+
+ } // End TAMB Device
+}// end Scope(\_SB.PCI0.LPCB.H_EC)
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/TEfnDppmPolicy.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/TEfnDppmPolicy.asl
new file mode 100644
index 0000000..9f696d1
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/TEfnDppmPolicy.asl
@@ -0,0 +1,179 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ TEFNDppmPolicy.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Dynamic Platform & Thermal Framework
+
+--*/
+
+Scope(\_SB.PCI0.LPCB.H_EC.TEFN)
+{
+ Name(CTYP,0) // Device-specific cooling policy preference
+
+ // _SCP (Set Cooling Policy)
+ //
+ // Arguments: (3)
+ // Arg0 - Mode An Integer containing the cooling mode policy code
+ // Arg1 - AcousticLimit An Integer containing the acoustic limit
+ // Arg2 - PowerLimit An Integer containing the power limit
+ // Return Value:
+ // None
+ //
+ // Argument Information:
+ // Mode - 0 = Active, 1 = Passive
+ // Acoustic Limit - Specifies the maximum acceptable acoustic level that active cooling devices may generate.
+ // Values are 1 to 5 where 1 means no acoustic tolerance and 5 means maximum acoustic tolerance.
+ // Power Limit - Specifies the maximum acceptable power level that active cooling devices may consume.
+ // Values are from 1 to 5 where 1 means no power may be used to cool and 5 means maximum power may be used to cool.
+ //
+ Method(_SCP, 3, Serialized)
+ {
+ If(LOr(LEqual(Arg0,0),LEqual(Arg0,1)))
+ {
+ Store(Arg0, CTYP)
+ P8XH(0, Arg1)
+ P8XH(1, Arg2)
+ Notify(\_SB.PCI0.LPCB.H_EC.TEFN, 0x91)
+ }
+ }
+
+ // Returns the value at which the OS initiates Active
+ // cooling.
+ Method(_AC0)
+ {
+ If(CTYP)
+ {
+ Store(\_SB.IETM.CTOK(EFPT),Local1) // Passive Cooling Policy
+ } Else {
+ Store(\_SB.IETM.CTOK(EFAT),Local1) // Active Cooling Policy
+ }
+ If(LGreaterEqual(LSTM,Local1))
+ {
+ Return(Subtract(Local1,20)) // subtract 2 degrees which is the Hysteresis
+ }
+ Else
+ {
+ Return(Local1)
+ }
+ }
+
+ // _ACx (Active Cooling)
+ //
+ // This optional object, if present under a thermal zone, returns the
+ // temperature trip point at which OSPM must start or stop Active cooling,
+ // where x is a value between 0 and 9 that designates multiple active cooling levels of the thermal zone.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the active cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_AC1)
+ {
+ Return(Subtract(_AC0(), 50))
+ }
+
+ // _ACx (Active Cooling)
+ //
+ // This optional object, if present under a thermal zone, returns the
+ // temperature trip point at which OSPM must start or stop Active cooling,
+ // where x is a value between 0 and 9 that designates multiple active cooling levels of the thermal zone.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the active cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_AC2)
+ {
+ Return(Subtract(_AC1(), 50))
+ }
+
+ // _ACx (Active Cooling)
+ //
+ // This optional object, if present under a thermal zone, returns the
+ // temperature trip point at which OSPM must start or stop Active cooling,
+ // where x is a value between 0 and 9 that designates multiple active cooling levels of the thermal zone.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the active cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_AC3)
+ {
+ Return(Subtract(_AC2(), 50))
+ }
+
+ // _CRT (Critical Temperature)
+ //
+ // This object, when defined under a thermal zone, returns the critical temperature at which OSPM must shutdown the system.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the critical temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_CRT, 0, Serialized)
+ {
+ Return(\_SB.IETM.CTOK(EFCT))
+ }
+
+ // _HOT (Hot Temperature)
+ //
+ // This optional object, when defined under a thermal zone, returns the critical temperature
+ // at which OSPM may choose to transition the system into the S4 sleeping state.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // The return value is an integer that represents the critical sleep threshold tenths of degrees Kelvin.
+ //
+ Method(_HOT,0,Serialized)
+ {
+ Return(\_SB.IETM.CTOK(EFHT))
+ }
+
+ // _PSV (Passive)
+ //
+ // This optional object, if present under a thermal zone, evaluates to the temperature
+ // at which OSPM must activate passive cooling policy.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the passive cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_PSV, 0, Serialized)
+ {
+ If(CTYP)
+ {
+ Return(\_SB.IETM.CTOK(EFAT)) // Active Cooling Policy
+ } Else {
+ Return(\_SB.IETM.CTOK(EFPT)) // Passive Cooling Policy
+ }
+ }
+
+} // End Scope(\_SB.PCI0.LPCB.H_EC.TEFN)
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/TEfnParticipant.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/TEfnParticipant.asl
new file mode 100644
index 0000000..ad61fdb
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/TEfnParticipant.asl
@@ -0,0 +1,184 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ TEFNParticipant.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Dynamic Platform & Thermal Framework
+
+--*/
+
+Scope(\_SB.PCI0.LPCB.H_EC)
+{
+
+ Device(TEFN)
+ {
+ Name(_HID, EISAID("INT3403")) // Intel DPTF Temperature Sensor Device
+ Name(_UID, 3)
+
+ Name(HITP, 0x64)
+ Name(EAUX, 0x10)
+ Name(_STR, Unicode ("Exhaust Fan Temperature Sensor"))
+ Name(PTYP, 0x03)
+
+ // _STA (Status)
+ //
+ // This object returns the current status of a device.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing a device status bitmap:
+ // Bit 0 - Set if the device is present.
+ // Bit 1 - Set if the device is enabled and decoding its resources.
+ // Bit 2 - Set if the device should be shown in the UI.
+ // Bit 3 - Set if the device is functioning properly (cleared if device failed its diagnostics).
+ // Bit 4 - Set if the battery is present.
+ // Bits 5-31 - Reserved (must be cleared).
+ //
+ Method(_STA)
+ {
+ If (LEqual(EFDE,1)){
+ Return(0x0F)
+ } Else {
+ Return(0x00)
+ }
+ }
+
+ // _TMP (Temperature)
+ //
+ // This control method returns the thermal zone's current operating temperature.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the current temperature of the thermal zone (in tenths of degrees Kelvin)
+ //
+ Method(_TMP, 0, Serialized)
+ {
+ If(\ECON)
+ {
+ // Get the Exhaust Fan Temperature.
+ Return(\_SB.IETM.CTOK(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.FANT))))
+ } Else {
+ Return(3000)
+ }
+ }
+
+ // Number of Aux Trips available
+ Name(PATC, 2)
+
+ // PATx (Participant Programmable Auxiliary Trip) - Sets Aux Trip Point
+ //
+ // The PATx objects shall take a single integer parameter, in tenths of degree Kelvin, which
+ // represents the temperature at which the device should notify the participant driver of
+ // an auxiliary trip event. A PATx control method returns no value.
+ //
+ // Arguments: (1)
+ // Arg0 - temperature in tenths of degree Kelvin
+ // Return Value:
+ // None
+ //
+ Method(PAT0, 1, Serialized)
+ {
+ If (\ECON)
+ {
+ Store (Acquire(\_SB.PCI0.LPCB.H_EC.PATM, 100),Local0) // save Acquire result so we can check for Mutex acquired
+ If (LEqual(Local0, Zero)) // check for Mutex acquired
+ {
+ Store(\_SB.IETM.KTOC(Arg0),EAUX)
+ \_SB.PCI0.LPCB.H_EC.ECWT(0x1, RefOf(\_SB.PCI0.LPCB.H_EC.TSI))
+ \_SB.PCI0.LPCB.H_EC.ECWT(0x2, RefOf(\_SB.PCI0.LPCB.H_EC.HYST))
+ \_SB.PCI0.LPCB.H_EC.ECWT(EAUX, RefOf(\_SB.PCI0.LPCB.H_EC.TSLT))
+ \_SB.PCI0.LPCB.H_EC.ECMD(0x4A) //Set Trip point.
+ Release(\_SB.PCI0.LPCB.H_EC.PATM)
+ }
+ }
+ }
+
+ // PATx (Participant Programmable Auxiliary Trip) - Sets Aux Trip Point
+ //
+ // The PATx objects shall take a single integer parameter, in tenths of degree Kelvin, which
+ // represents the temperature at which the device should notify the participant driver of
+ // an auxiliary trip event. A PATx control method returns no value.
+ //
+ // Arguments: (1)
+ // Arg0 - temperature in tenths of degree Kelvin
+ // Return Value:
+ // None
+ //
+ Method(PAT1, 1, Serialized)
+ {
+ If (\ECON)
+ {
+ Store (Acquire(\_SB.PCI0.LPCB.H_EC.PATM, 100),Local0) // save Acquire result so we can check for Mutex acquired
+ If (LEqual(Local0, Zero)) // check for Mutex acquired
+ {
+ Store(\_SB.IETM.KTOC(Arg0),HITP)
+ \_SB.PCI0.LPCB.H_EC.ECWT(0x1, RefOf(\_SB.PCI0.LPCB.H_EC.TSI))
+ \_SB.PCI0.LPCB.H_EC.ECWT(0x2, RefOf(\_SB.PCI0.LPCB.H_EC.HYST))
+ \_SB.PCI0.LPCB.H_EC.ECWT(HITP, RefOf(\_SB.PCI0.LPCB.H_EC.TSHT))
+ \_SB.PCI0.LPCB.H_EC.ECMD(0x4A) //Set Trip point.
+ Release(\_SB.PCI0.LPCB.H_EC.PATM)
+ }
+ }
+ }
+
+ // Thermal Sensor Hysteresis, 2 degrees
+ Name(GTSH, 20)
+
+ Name(LSTM,0) // Last temperature reported
+
+ // _DTI (Device Temperature Indication)
+ //
+ // Conveys the temperature of a device's internal temperature sensor to the platform when a temperature trip point
+ // is crossed or when a meaningful temperature change occurs.
+ //
+ // Arguments: (1)
+ // Arg0 - An Integer containing the current value of the temperature sensor (in tenths Kelvin)
+ // Return Value:
+ // None
+ //
+ Method(_DTI, 1)
+ {
+ Store(Arg0,LSTM)
+ Notify(TEFN, 0x91) // notify the participant of a trip point change event
+ }
+
+ // _NTT (Notification Temperature Threshold)
+ //
+ // Returns the temperature change threshold for devices containing native temperature sensors to cause
+ // evaluation of the _DTI object
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the temperature threshold in tenths of degrees Kelvin.
+ //
+ Method(_NTT, 0)
+ {
+ Return(2782) // 5 degree Celcius, this could be a platform policy with setup item
+ }
+
+ } // End TEFN Device
+}// end Scope(\_SB.PCI0.LPCB.H_EC)
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/TFN1Participant.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/TFN1Participant.asl
new file mode 100644
index 0000000..a119363
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/TFN1Participant.asl
@@ -0,0 +1,170 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ TFN1Participant.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Dynamic Platform & Thermal Framework
+
+--*/
+
+Scope(\_SB.PCI0.LPCB.H_EC)
+{
+
+ Device(TFN1)
+ {
+ Name(_HID, EISAID("INT3404")) // Intel DPTF Fan Device
+ Name(_UID, 0)
+
+ Name(FON, 1) // Indicates if Fan is ON Currently
+
+ // _STA (Status)
+ //
+ // This object returns the current status of a device.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing a device status bitmap:
+ // Bit 0 - Set if the device is present.
+ // Bit 1 - Set if the device is enabled and decoding its resources.
+ // Bit 2 - Set if the device should be shown in the UI.
+ // Bit 3 - Set if the device is functioning properly (cleared if device failed its diagnostics).
+ // Bit 4 - Set if the battery is present.
+ // Bits 5-31 - Reserved (must be cleared).
+ //
+ Method(_STA)
+ {
+ If (LEqual(FND1,1)){
+ Return(0x0F)
+ } Else {
+ Return(0x00)
+ }
+ }
+
+ // _FIF (Fan Information)
+ //
+ // The optional _FIF object provides OSPM with fan device capability information.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // A Package containing the fan device parameters.
+ //
+ Method(_FIF)
+ {
+ Return (Package (){
+ 0, // Revision:Integer
+ 1, // FineGrainControl:Integer Boolean
+ 2, // StepSize:Integer DWORD
+ 0 // LowSpeedNotificationSupport:Integer Boolean
+ })
+ }
+
+ // _FPS (Fan Performance States)
+ //
+ // Evaluates to a variable-length package containing a list of packages that describe the fan device's performance states.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // A variable-length Package containing a Revision ID and a list of Packages that describe the fan device's performance states.
+ //
+ Method(_FPS,,,,PkgObj)
+ {
+ Return (Package()
+ {
+ 0, // Revision:Integer
+ // Control, TripPoint, Speed, NoiseLevel, Power
+ Package(){100, 0xFFFFFFFF, 7000, 500, 5000},
+ Package(){ 95, 0xFFFFFFFF, 6650, 475, 4750},
+ Package(){ 90, 0xFFFFFFFF, 6300, 450, 4500},
+ Package(){ 85, 0xFFFFFFFF, 5950, 425, 4250},
+ Package(){ 80, 0xFFFFFFFF, 5600, 400, 4000},
+ Package(){ 75, 0xFFFFFFFF, 5250, 375, 3750},
+ Package(){ 70, 0xFFFFFFFF, 4900, 350, 3500},
+ Package(){ 60, 0xFFFFFFFF, 4200, 300, 3000},
+ Package(){ 50, 0xFFFFFFFF, 3500, 250, 2500},
+ Package(){ 40, 0xFFFFFFFF, 2800, 200, 2000},
+ Package(){ 25, 0xFFFFFFFF, 1750, 125, 1250},
+ Package(){ 0, 0xFFFFFFFF, 0, 0, 0} // OFF
+ })
+ }
+
+ // _FSL (Fan Set Level)
+ //
+ // The optional _FSL object is a control method that OSPM evaluates to set a fan device's speed (performance state) to a specific level.
+ //
+ // Arguments: (1)
+ // Arg0 - Level (Integer): conveys to the platform the fan speed level to be set.
+ // Return Value:
+ // None
+ //
+ // Argument Information
+ // Arg0: Level. If the fan supports fine-grained control, Level is a percentage of maximum level (0-100)
+ // that the platform is to engage the fan. If the fan does not support fine-grained control,
+ // Level is a Control field value from a package in the _FPS object's package list.
+ // A Level value of zero causes the platform to turn off the fan.
+ //
+ Method(_FSL,1,Serialized)
+ {
+ If(\ECON)
+ {
+ If(LNot(LEqual(Arg0,\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PENV)))))
+ { // EC implementation-sepcific PWM port control
+ \_SB.PCI0.LPCB.H_EC.ECWT(1, RefOf(\_SB.PCI0.LPCB.H_EC.PPSL))
+ \_SB.PCI0.LPCB.H_EC.ECWT(0, RefOf(\_SB.PCI0.LPCB.H_EC.PPSH))
+ \_SB.PCI0.LPCB.H_EC.ECWT(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PENV)), RefOf(\_SB.PCI0.LPCB.H_EC.PINV))
+ \_SB.PCI0.LPCB.H_EC.ECWT(Arg0, RefOf(\_SB.PCI0.LPCB.H_EC.PENV))
+ \_SB.PCI0.LPCB.H_EC.ECWT(100, RefOf(\_SB.PCI0.LPCB.H_EC.PSTP))
+ \_SB.PCI0.LPCB.H_EC.ECMD(0x1a) // Command to turn the fan on
+ Notify(\_SB.IETM, 0x83) // Notify DPTF TZ that fan speed has changed
+ }
+ }
+ }
+
+ Name(TFST, Package()
+ {
+ 0, // Revision:Integer
+ 0xFFFFFFFF, // Control:Integer DWORD
+ 0xFFFFFFFF // Speed:Integer DWORD
+ })
+
+ //_FST (Fan Status)
+ //
+ // The optional _FST object provides status information for the fan device.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // A Package containing fan device status information
+ //
+ Method(_FST,,,,PkgObj)
+ {
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PENV)), Index(TFST, 1))
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.CFSP)), Index(TFST, 2))
+ Return(TFST)
+ }
+
+ } // End TFN1 Device
+}// end Scope(\_SB.PCI0.LPCB.H_EC)
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/TFN2Participant.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/TFN2Participant.asl
new file mode 100644
index 0000000..c585e72
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/TFN2Participant.asl
@@ -0,0 +1,167 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ TFN2Participant.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Dynamic Platform & Thermal Framework
+
+--*/
+
+Scope(\_SB.PCI0.LPCB.H_EC)
+{
+
+ Device(TFN2)
+ {
+ Name(_HID, EISAID("INT3404")) // Intel DPPM Fan Device 2 DUMMY DEVICE
+ Name(_UID, 1)
+
+ Name(FCTL, 100)
+ Name(FSPD, 200)
+
+ // _STA (Status)
+ //
+ // This object returns the current status of a device.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing a device status bitmap:
+ // Bit 0 - Set if the device is present.
+ // Bit 1 - Set if the device is enabled and decoding its resources.
+ // Bit 2 - Set if the device should be shown in the UI.
+ // Bit 3 - Set if the device is functioning properly (cleared if device failed its diagnostics).
+ // Bit 4 - Set if the battery is present.
+ // Bits 5-31 - Reserved (must be cleared).
+ //
+ Method(_STA)
+ {
+ If (LEqual(FND2,1)){
+ Return(0x0F)
+ } Else {
+ Return(0x00)
+ }
+ }
+
+ // _FIF (Fan Information)
+ //
+ // The optional _FIF object provides OSPM with fan device capability information.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // A Package containing the fan device parameters.
+ //
+ Name(_FIF, Package()
+ {
+ 0,
+ 1,
+ 50,
+ 0
+ })
+
+ // _FPS (Fan Performance States)
+ //
+ // Evaluates to a variable-length package containing a list of packages that describe the fan device's performance states.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // A variable-length Package containing a Revision ID and a list of Packages that describe the fan device's performance states.
+ //
+ Method(_FPS,,,,PkgObj) // Get Fan P-States
+ {
+ // Get Fan Device Data default as CRB
+ Return (Package()
+ {
+ 0, // Revision
+ //
+ // Control Trip Point Speed NoiseLevel Power
+ Package(){100, 0xFFFFFFFF, 200, 700, 7000},
+ Package(){ 50, 0xFFFFFFFF, 100, 350, 3500},
+ Package(){ 0, 0xFFFFFFFF, 0, 0, 0} // OFF
+ })
+ }
+
+ // _FSL (Fan Set Level)
+ //
+ // The optional _FSL object is a control method that OSPM evaluates to set a fan device's speed (performance state) to a specific level.
+ //
+ // Arguments: (1)
+ // Arg0 - Level (Integer): conveys to the platform the fan speed level to be set.
+ // Return Value:
+ // None
+ //
+ // Argument Information
+ // Arg0: Level. If the fan supports fine-grained control, Level is a percentage of maximum level (0-100)
+ // that the platform is to engage the fan. If the fan does not support fine-grained control,
+ // Level is a Control field value from a package in the _FPS object's package list.
+ // A Level value of zero causes the platform to turn off the fan.
+ //
+ Method(_FSL, 1, Serialized)
+ {
+ If(\ECON)
+ {
+ If(LNot(LEqual(Arg0, FCTL)))
+ {
+ Store(Arg0, FCTL)
+ If (LGreaterEqual(Arg0, 51))
+ {
+ Store(200, FSPD)
+ }
+ If (LGreaterEqual(Arg0, 1))
+ {
+ Store(100, FSPD)
+ }
+ Else
+ {
+ Store(0, FSPD)
+ }
+ }
+ }
+ }
+
+ Name(TFST, Package()
+ {
+ 0, // Revision
+ 0xFFFFFFFF, // Control
+ 0xFFFFFFFF // Speed
+ })
+
+ //_FST (Fan Status)
+ //
+ // The optional _FST object provides status information for the fan device.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // A Package containing fan device status information
+ //
+ Method(_FST,,,,PkgObj)
+ {
+ Store(FCTL, Index(TFST, 1))
+ Store(FSPD, Index(TFST, 2))
+ Return(TFST)
+ }
+ } // End TFN2 Device
+}// end Scope(\_SB.PCI0.LPCB.H_EC)
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/TMemDppmPolicy.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/TMemDppmPolicy.asl
new file mode 100644
index 0000000..c01d155
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/TMemDppmPolicy.asl
@@ -0,0 +1,173 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ TMemDppmPolicy.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Dynamic Platform & Thermal Framework
+
+--*/
+
+Scope(\_SB.PCI0.TMEM)
+{
+ Name(CTYP,0) // Device-specific cooling policy preference
+
+ // _CRT (Critical Temperature)
+ //
+ // This object, when defined under a thermal zone, returns the critical temperature at which OSPM must shutdown the system.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the critical temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_CRT)
+ {
+ Return(\_SB.IETM.CTOK(MEMC))
+ }
+
+ // _HOT (Hot Temperature)
+ //
+ // This optional object, when defined under a thermal zone, returns the critical temperature
+ // at which OSPM may choose to transition the system into the S4 sleeping state.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // The return value is an integer that represents the critical sleep threshold tenths of degrees Kelvin.
+ //
+ Method(_HOT,0,Serialized)
+ {
+ Return(\_SB.IETM.CTOK(MEMH))
+ }
+
+ // _PSV (Passive)
+ //
+ // This optional object, if present under a thermal zone, evaluates to the temperature
+ // at which OSPM must activate passive cooling policy.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the passive cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_PSV)
+ {
+ If(CTYP)
+ {
+ Return(\_SB.IETM.CTOK(ATRA)) // Passive Cooling Policy
+ } Else {
+ Return(\_SB.IETM.CTOK(PTRA)) // Active Cooling Policy
+ }
+ }
+
+ // _SCP (Set Cooling Policy)
+ //
+ // Arguments: (3)
+ // Arg0 - Mode An Integer containing the cooling mode policy code
+ // Arg1 - AcousticLimit An Integer containing the acoustic limit
+ // Arg2 - PowerLimit An Integer containing the power limit
+ // Return Value:
+ // None
+ //
+ // Argument Information:
+ // Mode - 0 = Active, 1 = Passive
+ // Acoustic Limit - Specifies the maximum acceptable acoustic level that active cooling devices may generate.
+ // Values are 1 to 5 where 1 means no acoustic tolerance and 5 means maximum acoustic tolerance.
+ // Power Limit - Specifies the maximum acceptable power level that active cooling devices may consume.
+ // Values are from 1 to 5 where 1 means no power may be used to cool and 5 means maximum power may be used to cool.
+ //
+ Method(_SCP, 3, Serialized)
+ {
+ If(LOr(LEqual(Arg0,0),LEqual(Arg0,1)))
+ {
+ Store(Arg0, CTYP)
+ P8XH(0, Arg1)
+ P8XH(1, Arg2)
+ Notify(TMEM, 0x91)
+ }
+ }
+
+ // _ACx (Active Cooling)
+ //
+ // This optional object, if present under a thermal zone, returns the
+ // temperature trip point at which OSPM must start or stop Active cooling,
+ // where x is a value between 0 and 9 that designates multiple active cooling levels of the thermal zone.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the active cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_AC0)
+ {
+ If(CTYP)
+ {
+ Store(\_SB.IETM.CTOK(PTRA),Local1) // Passive Cooling Policy
+ }
+ Else
+ {
+ Store(\_SB.IETM.CTOK(ATRA),Local1) // Active Cooling Policy
+ }
+ If(LGreaterEqual(LSTM,Local1))
+ {
+ Return(Subtract(Local1,20)) // subtract 2 degrees which is the Hysteresis
+ }
+ Else
+ {
+ Return(Local1)
+ }
+ }
+
+ // _ACx (Active Cooling)
+ //
+ // This optional object, if present under a thermal zone, returns the
+ // temperature trip point at which OSPM must start or stop Active cooling,
+ // where x is a value between 0 and 9 that designates multiple active cooling levels of the thermal zone.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the active cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_AC1)
+ {
+ If(CTYP)
+ {
+ Store(\_SB.IETM.CTOK(PTRA),Local0) // Passive Cooling Policy
+ }
+ Else
+ {
+ Store(\_SB.IETM.CTOK(ATRA),Local0) // Active Cooling Policy
+ }
+ Subtract(Local0, 50, Local0)
+ If(LGreaterEqual(LSTM,Local0))
+ {
+ Return(Subtract(Local0,20)) // subtract 2 degrees which is the Hysteresis
+ }
+ Else
+ {
+ Return(Local0)
+ }
+ }
+} // End Scope(\_SB.PCI0.TMEM)
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/TMemParticipant.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/TMemParticipant.asl
new file mode 100644
index 0000000..0520b32
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/TMemParticipant.asl
@@ -0,0 +1,264 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ TMemParticipant.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Dynamic Platform & Thermal Framework
+
+--*/
+
+Scope(\_SB.PCI0)
+{
+
+ Device(TMEM)
+ {
+ Name(_HID, EISAID("INT3402")) // Intel DPTF Memory Device
+ Name(_UID, 0)
+
+ Name(SAUX, 0x10)
+ Name(LSTM,0) // Last temperature reported
+
+ // _STA (Status)
+ //
+ // This object returns the current status of a device.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing a device status bitmap:
+ // Bit 0 - Set if the device is present.
+ // Bit 1 - Set if the device is enabled and decoding its resources.
+ // Bit 2 - Set if the device should be shown in the UI.
+ // Bit 3 - Set if the device is functioning properly (cleared if device failed its diagnostics).
+ // Bit 4 - Set if the battery is present.
+ // Bits 5-31 - Reserved (must be cleared).
+ //
+ Method(_STA)
+ {
+ If (LEqual(MEMD,1)){
+ Return(0x0F)
+ } Else {
+ Return(0x00)
+ }
+ }
+
+ // PPCC (Participant Power Control Capabilities)
+ //
+ // The PPCC object evaluates to a package of packages that indicates to DPTF processor
+ // participant the power control capabilities.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // PPCC package of packages
+ //
+ Method(PPCC,0,Serialized,,PkgObj)
+ {
+ Return(NPCC)
+ }
+
+ Name (NPCC, Package()
+ { // Field Name : Field Type
+ 2, // Revision : DWordConst
+
+ Package () // Power Limit 1
+ {
+ 0, // PowerLimitIndex : DWordConst = 0
+ 1000, // PowerLimitMinimum : DWordConst
+ 5000, // PowerLimitMaximum : DWordConst
+ 1, // TimeWindowMinimum : DWordConst
+ 28, // TimeWindowMaximum : DWordConst
+ 1000, // StepSize : DWordConst
+ },
+ Package () // Power Limit 2
+ {
+ 1, // PowerLimitIndex : DWordConst = 1
+ 1000, // PowerLimitMinimum : DWordConst
+ 10000, // PowerLimitMaximum : DWordConst
+ 0, // TimeWindowMinimum : DWordConst
+ 0, // TimeWindowMaximum : DWordConst
+ 1000, // StepSize : DWordConst
+ }
+ }) // End of PPCC object
+
+ // _TMP (Temperature)
+ //
+ // This control method returns the thermal zone's current operating temperature.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the current temperature of the thermal zone (in tenths of degrees Kelvin)
+ //
+ Method(_TMP)
+ {
+ If(\ECON)
+ {
+ If(\TSOD) // if TS-on-DIMM sensor present and selected in BIOS SETUP return higher temp
+ {
+ If(LGreater(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.TSD0)),\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.TSD1))))
+ {
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.TSD0)),Local1) // TS-on-DIMM0 temperature
+ }
+ Else
+ {
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.TSD1)),Local1) // TS-on-DIMM1 temperature
+ }
+ }
+ Else // else return higher On-Board DDR Thermal Sensor temp
+ {
+ If(LGreater(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.DIM0)),\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.DIM1))))
+ {
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.DIM0)),Local1) // DIMM0 temperature
+ }
+ Else
+ {
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.DIM1)),Local1) // DIMM1 temperature
+ }
+ }
+ Return(\_SB.IETM.CTOK(Local1)) // EC reports in Celcius, convert to 10ths of degree Kelvin
+ }
+ Else
+ {
+ Return(3000)
+ }
+ }
+
+ Name(PATC, 2)
+
+ Name(AT0, Ones)
+
+ // PATx (Participant Programmable Auxiliary Trip) - Sets Aux Trip Point
+ //
+ // The PATx objects shall take a single integer parameter, in tenths of degree Kelvin, which
+ // represents the temperature at which the device should notify the participant driver of
+ // an auxiliary trip event. A PATx control method returns no value.
+ //
+ // Arguments: (1)
+ // Arg0 - temperature in tenths of degree Kelvin
+ // Return Value:
+ // None
+ //
+ Method(PAT0, 1) // send Arg0 to EC as Programmable Auxiliary Trip Point 0
+ {
+ If (\ECON)
+ {
+ Store (Acquire(\_SB.PCI0.LPCB.H_EC.PATM, 100),Local0) // save Acquire result so we can check for Mutex acquired
+ If (LEqual(Local0, Zero)) // check for Mutex acquired
+ {
+ Store(Arg0, AT0) // used for debugging
+ Store(\_SB.IETM.KTOC(Arg0),SAUX)
+ \_SB.PCI0.LPCB.H_EC.ECWT(0x4, RefOf(\_SB.PCI0.LPCB.H_EC.TSI))
+ \_SB.PCI0.LPCB.H_EC.ECWT(0x2, RefOf(\_SB.PCI0.LPCB.H_EC.HYST)) // Thermal Sensor Hysteresis, 2 degrees
+ \_SB.PCI0.LPCB.H_EC.ECWT(SAUX, RefOf(\_SB.PCI0.LPCB.H_EC.TSLT))
+ \_SB.PCI0.LPCB.H_EC.ECMD(0x4A) // Set Trip point
+ Release(\_SB.PCI0.LPCB.H_EC.PATM)
+ }
+ }
+ }
+
+ Name(AT1, Ones)
+
+ // PATx (Participant Programmable Auxiliary Trip) - Sets Aux Trip Point
+ //
+ // The PATx objects shall take a single integer parameter, in tenths of degree Kelvin, which
+ // represents the temperature at which the device should notify the participant driver of
+ // an auxiliary trip event. A PATx control method returns no value.
+ //
+ // Arguments: (1)
+ // Arg0 - temperature in tenths of degree Kelvin
+ // Return Value:
+ // None
+ //
+ Method(PAT1, 1) // send Arg0 to EC as Programmable Auxiliary Trip Point 1
+ {
+ If (\ECON)
+ {
+ Store (Acquire(\_SB.PCI0.LPCB.H_EC.PATM, 100),Local0) // save Acquire result so we can check for Mutex acquired
+ If (LEqual(Local0, Zero)) // check for Mutex acquired
+ {
+ Store(Arg0, AT1) // used for debugging
+ Store(\_SB.IETM.KTOC(Arg0),SAUX)
+ \_SB.PCI0.LPCB.H_EC.ECWT(0x4, RefOf(\_SB.PCI0.LPCB.H_EC.TSI))
+ \_SB.PCI0.LPCB.H_EC.ECWT(0x2, RefOf(\_SB.PCI0.LPCB.H_EC.HYST)) // Thermal Sensor Hysteresis, 2 degrees
+ \_SB.PCI0.LPCB.H_EC.ECWT(SAUX, RefOf(\_SB.PCI0.LPCB.H_EC.TSHT))
+ \_SB.PCI0.LPCB.H_EC.ECMD(0x4A) // Set Trip point
+ Release(\_SB.PCI0.LPCB.H_EC.PATM)
+ }
+ }
+ }
+
+
+ // Thermal Sensor Hysteresis, 2 degrees
+ Name(GTSH, 20)
+
+ // _DTI (Device Temperature Indication)
+ //
+ // Conveys the temperature of a device's internal temperature sensor to the platform when a temperature trip point
+ // is crossed or when a meaningful temperature change occurs.
+ //
+ // Arguments: (1)
+ // Arg0 - An Integer containing the current value of the temperature sensor (in tenths Kelvin)
+ // Return Value:
+ // None
+ //
+ Method(_DTI, 1)
+ {
+ Store(Arg0,LSTM)
+ Notify(TMEM, 0x91) // notify the participant of a trip point change event
+ }
+
+ // _NTT (Notification Temperature Threshold)
+ //
+ // Returns the temperature change threshold for devices containing native temperature sensors to cause
+ // evaluation of the _DTI object
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the temperature threshold in tenths of degrees Kelvin.
+ //
+ Method(_NTT, 0)
+ {
+ Return(2782) // 5 degree Celcius, this could be a platform policy with setup item
+ }
+
+ // PGMB (Pci GMch Bar)
+ //
+ // This object is required to be implemented on platforms supporting Intel code name Sandy Bridge processor.
+ // This object is not required for platforms supporting Intel code name Ivy Bridge processor.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // Return MCH Bar value.
+ //
+ Method(PGMB, 0)
+ {
+ Return(\_SB.PCI0.MHBR) // Return MCH Bar value
+ }
+
+ } // End TMEM Device
+
+}// end Scope(\_SB.PCI0)
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/TPwrParticipant.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/TPwrParticipant.asl
new file mode 100644
index 0000000..07532b8
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/TPwrParticipant.asl
@@ -0,0 +1,260 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ TPwrParticipant.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Dynamic Platform & Thermal Framework
+
+--*/
+
+
+Scope(\_SB.IETM)
+{
+ //
+ // Power Policy
+ //
+ Name (WPSP, Package ()
+ {
+ ToUUID("64568CCD-6597-4BFC-B9D6-9D33854013CE")
+ })
+}
+
+Scope(\_SB.PCI0.LPCB.H_EC)
+{
+
+ Device(TPWR) // Power participant
+ {
+ Name(_HID, EISAID("INT3407")) //Intel DPTF platform power device
+ Name(_UID, 0)
+ Name(_STR, Unicode ("Platform Power"))
+ Name(PTYP, 0x11)
+
+
+ // _STA (Status)
+ //
+ // This object returns the current status of a device.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing a device status bitmap:
+ // Bit 0 - Set if the device is present.
+ // Bit 1 - Set if the device is enabled and decoding its resources.
+ // Bit 2 - Set if the device should be shown in the UI.
+ // Bit 3 - Set if the device is functioning properly (cleared if device failed its diagnostics).
+ // Bit 4 - Set if the battery is present.
+ // Bits 5-31 - Reserved (must be cleared).
+ //
+ Method(_STA)
+ {
+ If (LEqual(PWRE,1)){
+ Return(0x0F)
+ } Else {
+ Return(0x00)
+ }
+ }
+
+ // _BST (Battery Status)
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // A Package containing the battery status in the format below:
+ // Package {
+ // Battery State
+ // Battery Present Rate
+ // Battery Remaining Capacity
+ // Battery Present Voltage
+ // }
+ //
+ Method(_BST,,,,PkgObj)
+ {
+ If(CondRefOf(\_SB.PCI0.LPCB.H_EC.BAT1._BST))
+ {
+ Return(\_SB.PCI0.LPCB.H_EC.BAT1._BST())
+ } Else {
+ Return(Package(){0,0,0,0})
+ }
+ }
+
+ // PSOC (Platform State of Charge)
+ //
+ // This object evaluates to the remaining battery state of charge in %.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // remaining battery charge in %
+ //
+ Method(PSOC)
+ {
+ If(LEqual(\_SB.PCI0.LPCB.H_EC.ECAV,0)) // check EC opregion available
+ {
+ Return (0) // EC not available
+ }
+ If(LEqual(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.B1FC)),0)) // prevent divide by zero
+ {
+ Return (0) // Full charge cannot be 0, indicate malfunction in battery
+ }
+ If(LGreater(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.B1RC)),\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.B1FC)))) // remaining charge > full charge
+ {
+ Return(0) // Remaining Charge cannot be greater than Full Charge, this illegal value indicates the battery is malfunctioning
+ }
+ If(LEqual(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.B1RC)),\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.B1FC)))) // remaining charge == full charge
+ {
+ Return(100) // indicate battery is fully charged
+ }
+ If(LLess(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.B1RC)),\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.B1FC)))) // (RC*100)/FC=percent
+ {
+ Multiply(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.B1RC)),100,Local0) // RC*100
+ Divide(Local0,\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.B1FC)),Local2,Local1) // divide by FC
+ Divide(Local2,100,,Local2) // account for the remainder in percent
+ Divide(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.B1FC)),200,,Local3) // what number is 0.5%?
+ If(LGreaterEqual(Local2,Local3)){ // round up if the remainder is equal or above .5
+ Add(Local1,1,Local1)
+ }
+ Return(Local1) // current charge in percent
+ }
+ }
+
+ // PMAX (Platform MAXimum)
+ //
+ // The PMAX object provides maximum power that can be supported by the battery in mW.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // maximum power in mW
+ //
+ Method(PMAX,0,Serialized)
+ {
+ If(LEqual(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.ECAV)),1)) // Check If EC opregion is available
+ {
+ // convert PMAX from signed to unsigned integer
+ // PMAX Value = (NOT(OR(FFFF0000, ECValue))+1) * 10.
+ Add(ShiftLeft(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.B1MH)), 8),\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.B1ML)),Local0) // Get high and low byte from EC.
+ If(Local0){ // don't convert a zero
+ Not(Or(0xFFFF0000,Local0,Local0),Local0) // make it a 32 bit value before inverting the bits
+ Multiply(Add(1,Local0,Local0),10,Local0) // add 1 and multiply by 10
+ }
+ Return(Local0)
+ } Else {
+ Return(0) // EC not available
+ }
+ }
+
+
+ // APWR (Adapter PoWeR)
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // AC Adapter supplied power in mW.
+ //
+ Method(APWR)
+ {
+ If (LEqual(PSRC(),0))
+ {
+ Return(0) // EC unavailable or AC unavailable
+ } Else {
+ Return(Multiply(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PPWR)),10))
+ }
+ }
+
+
+ // PSRC (Power SouRCe)
+ //
+ // The PSRC object provides power source type.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // 0x00 = DC
+ // 0x01 = AC
+ // 0x02 = USB
+ //
+ Method(PSRC)
+ {
+ If(LEqual(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.ECAV)),1)) // Check If EC opregion is available
+ {
+ Return(\PWRS) // currently supports DC/AC only
+ } Else {
+ Return(0) // EC not available, default to battery
+ }
+ }
+
+ // ARTG (Adapter RaTinG)
+ //
+ // The ARTG object provides AC adapter rating in mW.
+ // ARTG should return 0 if PSRC is DC (0).
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // AC adapter rating in mW
+ //
+ Method(ARTG)
+ {
+ If (LEqual(PSRC(),0))
+ {
+ Return(0)
+ } Else {
+// TODO: setup option to choose adapter rating
+ Return(45000) // 45 watts
+ }
+ }
+
+
+ // CTYP (Charger TYPe)
+ //
+ // The CTYP object provides charger type.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // 0x01 = Traditional
+ // 0x02 = Hybrid
+ //
+ Method(CTYP)
+ {
+ Return(2)
+ }
+
+ // PROP (Platform Rest Of worst case Power)
+ //
+ // The PROP object provides maximum worst case platform rest of power.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // power in mW
+ //
+ Method(PROP)
+ {
+ Return(15000) // 15 watts
+ }
+
+ } // End TPWR Device
+}// end Scope(\_SB.PCI0.LPCB.H_EC)
+
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/TSknDppmPolicy.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/TSknDppmPolicy.asl
new file mode 100644
index 0000000..1187bf8
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/TSknDppmPolicy.asl
@@ -0,0 +1,172 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ TSknDppmPolicy.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Dynamic Platform & Thermal Framework
+
+--*/
+
+Scope(\_SB.PCI0.LPCB.H_EC.TSKN)
+{
+ Name(CTYP,0) // Device-specific cooling policy preference
+
+ // _SCP (Set Cooling Policy)
+ //
+ // Arguments: (3)
+ // Arg0 - Mode An Integer containing the cooling mode policy code
+ // Arg1 - AcousticLimit An Integer containing the acoustic limit
+ // Arg2 - PowerLimit An Integer containing the power limit
+ // Return Value:
+ // None
+ //
+ // Argument Information:
+ // Mode - 0 = Active, 1 = Passive
+ // Acoustic Limit - Specifies the maximum acceptable acoustic level that active cooling devices may generate.
+ // Values are 1 to 5 where 1 means no acoustic tolerance and 5 means maximum acoustic tolerance.
+ // Power Limit - Specifies the maximum acceptable power level that active cooling devices may consume.
+ // Values are from 1 to 5 where 1 means no power may be used to cool and 5 means maximum power may be used to cool.
+ //
+ Method(_SCP,3,Serialized)
+ {
+ If(LOr(LEqual(Arg0,0),LEqual(Arg0,1)))
+ {
+ Store(Arg0, CTYP)
+ P8XH(0, Arg1)
+ P8XH(1, Arg2)
+ Notify(\_SB.PCI0.LPCB.H_EC.TSKN, 0x91)
+ }
+ }
+
+ // _ACx (Active Cooling)
+ //
+ // This optional object, if present under a thermal zone, returns the
+ // temperature trip point at which OSPM must start or stop Active cooling,
+ // where x is a value between 0 and 9 that designates multiple active cooling levels of the thermal zone.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the active cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_AC3)
+ {
+ If(CTYP)
+ {
+ Store(\_SB.IETM.CTOK(SKPT),Local1) // Passive Cooling Policy
+ } Else {
+ Store(\_SB.IETM.CTOK(SKAT),Local1) // Active Cooling Policy
+ }
+ If(LGreaterEqual(LSTM,Local1))
+ {
+ Return(Subtract(Local1,20)) // subtract 2 degrees which is the Hysteresis
+ }
+ Else
+ {
+ Return(Local1)
+ }
+ }
+
+ // _ACx (Active Cooling)
+ //
+ // This optional object, if present under a thermal zone, returns the
+ // temperature trip point at which OSPM must start or stop Active cooling,
+ // where x is a value between 0 and 9 that designates multiple active cooling levels of the thermal zone.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the active cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_AC4)
+ {
+ Return(Subtract(_AC3(), 50))
+ }
+
+ // _ACx (Active Cooling)
+ //
+ // This optional object, if present under a thermal zone, returns the
+ // temperature trip point at which OSPM must start or stop Active cooling,
+ // where x is a value between 0 and 9 that designates multiple active cooling levels of the thermal zone.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the active cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_AC5)
+ {
+ Return(Subtract(_AC3(), 100))
+ }
+
+ // _CRT (Critical Temperature)
+ //
+ // This object, when defined under a thermal zone, returns the critical temperature at which OSPM must shutdown the system.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the critical temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_CRT)
+ {
+ Return(\_SB.IETM.CTOK(SKCT))
+ }
+
+ // _HOT (Hot Temperature)
+ //
+ // This optional object, when defined under a thermal zone, returns the critical temperature
+ // at which OSPM may choose to transition the system into the S4 sleeping state.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // The return value is an integer that represents the critical sleep threshold tenths of degrees Kelvin.
+ //
+ Method(_HOT,0,Serialized)
+ {
+ Return(\_SB.IETM.CTOK(SKHT) )
+ }
+
+ // _PSV (Passive)
+ //
+ // This optional object, if present under a thermal zone, evaluates to the temperature
+ // at which OSPM must activate passive cooling policy.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the passive cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_PSV)
+ {
+ If(CTYP)
+ {
+ Return(\_SB.IETM.CTOK(SKAT)) // Active Cooling Policy
+ } Else {
+ Return(\_SB.IETM.CTOK(SKPT)) // Passive Cooling Policy
+ }
+ }
+
+} // End Scope(\_SB.PCI0.LPCB.H_EC.TSKN)
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/TSknParticipant.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/TSknParticipant.asl
new file mode 100644
index 0000000..bb6586c
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/TSknParticipant.asl
@@ -0,0 +1,183 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ TSknParticipant.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Dynamic Platform & Thermal Framework
+
+--*/
+
+Scope(\_SB.PCI0.LPCB.H_EC)
+{
+
+ Device(TSKN) // Skin temperature sensor
+ {
+ Name(_HID, EISAID("INT3403")) // Intel DPTF Temperature Sensor Device
+ Name(_UID, 0)
+
+ Name(HITP, 0x64)
+ Name(SAUX, 0x10)
+ Name(_STR, Unicode ("Skin Temperature Sensor"))
+ Name(PTYP, 0x03)
+
+ // _STA (Status)
+ //
+ // This object returns the current status of a device.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing a device status bitmap:
+ // Bit 0 - Set if the device is present.
+ // Bit 1 - Set if the device is enabled and decoding its resources.
+ // Bit 2 - Set if the device should be shown in the UI.
+ // Bit 3 - Set if the device is functioning properly (cleared if device failed its diagnostics).
+ // Bit 4 - Set if the battery is present.
+ // Bits 5-31 - Reserved (must be cleared).
+ //
+ Method(_STA)
+ {
+ If (LEqual(SKDE,1)){
+ Return(0x0F)
+ } Else {
+ Return(0x00)
+ }
+ }
+ // _TMP (Temperature)
+ //
+ // This control method returns the thermal zone's current operating temperature.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the current temperature of the thermal zone (in tenths of degrees Kelvin)
+ //
+ Method(_TMP,0,Serialized)
+ {
+ If(\ECON)
+ { // Get the Skin Temperature.
+ Return(\_SB.IETM.CTOK(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.SKNT))))
+ } Else {
+ Return(3000)
+ }
+ }
+
+ // Number of Aux Trips available
+ Name(PATC, 2)
+
+ // PATx (Participant Programmable Auxiliary Trip) - Sets Aux Trip Point
+ //
+ // The PATx objects shall take a single integer parameter, in tenths of degree Kelvin, which
+ // represents the temperature at which the device should notify the participant driver of
+ // an auxiliary trip event. A PATx control method returns no value.
+ //
+ // Arguments: (1)
+ // Arg0 - temperature in tenths of degree Kelvin
+ // Return Value:
+ // None
+ //
+ Method(PAT0, 1, Serialized)
+ {
+ If (\ECON)
+ {
+ Store (Acquire(\_SB.PCI0.LPCB.H_EC.PATM, 100),Local0) // save Acquire result so we can check for Mutex acquired
+ If (LEqual(Local0, Zero)) // check for Mutex acquired
+ {
+ Store(\_SB.IETM.KTOC(Arg0),SAUX)
+ \_SB.PCI0.LPCB.H_EC.ECWT(0x2, RefOf(\_SB.PCI0.LPCB.H_EC.TSI))
+ \_SB.PCI0.LPCB.H_EC.ECWT(0x2, RefOf(\_SB.PCI0.LPCB.H_EC.HYST))
+ \_SB.PCI0.LPCB.H_EC.ECWT(SAUX, RefOf(\_SB.PCI0.LPCB.H_EC.TSLT))
+ \_SB.PCI0.LPCB.H_EC.ECMD(0x4A) // Set Trip point
+ Release(\_SB.PCI0.LPCB.H_EC.PATM)
+ }
+ }
+ }
+
+ // PATx (Participant Programmable Auxiliary Trip) - Sets Aux Trip Point
+ //
+ // The PATx objects shall take a single integer parameter, in tenths of degree Kelvin, which
+ // represents the temperature at which the device should notify the participant driver of
+ // an auxiliary trip event. A PATx control method returns no value.
+ //
+ // Arguments: (1)
+ // Arg0 - temperature in tenths of degree Kelvin
+ // Return Value:
+ // None
+ //
+ Method(PAT1, 1, Serialized)
+ {
+ If (\ECON)
+ {
+ Store (Acquire(\_SB.PCI0.LPCB.H_EC.PATM, 100),Local0) // save Acquire result so we can check for Mutex acquired
+ If (LEqual(Local0, Zero)) // check for Mutex acquired
+ {
+ Store(\_SB.IETM.KTOC(Arg0),HITP)
+ \_SB.PCI0.LPCB.H_EC.ECWT(0x2, RefOf(\_SB.PCI0.LPCB.H_EC.TSI))
+ \_SB.PCI0.LPCB.H_EC.ECWT(0x2, RefOf(\_SB.PCI0.LPCB.H_EC.HYST))
+ // Set High Trip to PSV or ACT
+ \_SB.PCI0.LPCB.H_EC.ECWT(HITP, RefOf(\_SB.PCI0.LPCB.H_EC.TSHT))
+ \_SB.PCI0.LPCB.H_EC.ECMD(0x4A) //Set Trip point.
+ Release(\_SB.PCI0.LPCB.H_EC.PATM)
+ }
+ }
+ }
+
+ // Thermal Sensor Hysteresis, 2 degrees
+ Name(GTSH, 20)
+
+ Name(LSTM,0) // Last temperature reported
+
+ // _DTI (Device Temperature Indication)
+ //
+ // Conveys the temperature of a device's internal temperature sensor to the platform when a temperature trip point
+ // is crossed or when a meaningful temperature change occurs.
+ //
+ // Arguments: (1)
+ // Arg0 - An Integer containing the current value of the temperature sensor (in tenths Kelvin)
+ // Return Value:
+ // None
+ //
+ Method(_DTI, 1)
+ {
+ Store(Arg0,LSTM)
+ Notify(TSKN, 0x91) // notify the participant of a trip point change event
+ }
+
+ // _NTT (Notification Temperature Threshold)
+ //
+ // Returns the temperature change threshold for devices containing native temperature sensors to cause
+ // evaluation of the _DTI object
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the temperature threshold in tenths of degrees Kelvin.
+ //
+ Method(_NTT, 0)
+ {
+ Return(2782) // 5 degree Celcius, this could be a platform policy with setup item
+ }
+
+ } // End TSKN Device
+}// end Scope(\_SB.PCI0.LPCB.H_EC)
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/T_VRDppmPolicy.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/T_VRDppmPolicy.asl
new file mode 100644
index 0000000..d022df7
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/T_VRDppmPolicy.asl
@@ -0,0 +1,140 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ T_VRDppmPolicy.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Dynamic Platform & Thermal Framework
+
+--*/
+
+Scope(\_SB.PCI0.LPCB.H_EC.T_VR)
+{
+ Name(CTYP,0) // Device-specific cooling policy preference
+
+ // _SCP (Set Cooling Policy)
+ //
+ // Arguments: (3)
+ // Arg0 - Mode An Integer containing the cooling mode policy code
+ // Arg1 - AcousticLimit An Integer containing the acoustic limit
+ // Arg2 - PowerLimit An Integer containing the power limit
+ // Return Value:
+ // None
+ //
+ // Argument Information:
+ // Mode - 0 = Active, 1 = Passive
+ // Acoustic Limit - Specifies the maximum acceptable acoustic level that active cooling devices may generate.
+ // Values are 1 to 5 where 1 means no acoustic tolerance and 5 means maximum acoustic tolerance.
+ // Power Limit - Specifies the maximum acceptable power level that active cooling devices may consume.
+ // Values are from 1 to 5 where 1 means no power may be used to cool and 5 means maximum power may be used to cool.
+ //
+ Method(_SCP, 3, Serialized)
+ {
+ If(LOr(LEqual(Arg0,0),LEqual(Arg0,1)))
+ {
+ Store(Arg0, CTYP)
+ P8XH(0, Arg1)
+ P8XH(1, Arg2)
+ Notify(\_SB.PCI0.LPCB.H_EC.T_VR, 0x91)
+ }
+ }
+
+ // _ACx (Active Cooling)
+ //
+ // This optional object, if present under a thermal zone, returns the
+ // temperature trip point at which OSPM must start or stop Active cooling,
+ // where x is a value between 0 and 9 that designates multiple active cooling levels of the thermal zone.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the active cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_AC0)
+ {
+ If(CTYP)
+ {
+ Store(\_SB.IETM.CTOK(VRPT),Local1) // Passive Cooling Policy
+ } Else {
+ Store(\_SB.IETM.CTOK(VRAT),Local1) // Active Cooling Policy
+ }
+ If(LGreaterEqual(LSTM,Local1))
+ {
+ Return(Subtract(Local1,20)) // subtract 2 degrees which is the Hysteresis
+ }
+ Else
+ {
+ Return(Local1)
+ }
+ }
+
+ // _CRT (Critical Temperature)
+ //
+ // This object, when defined under a thermal zone, returns the critical temperature at which OSPM must shutdown the system.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the critical temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_CRT, 0, Serialized)
+ {
+ Return(\_SB.IETM.CTOK(VRCT))
+ }
+
+ // _HOT (Hot Temperature)
+ //
+ // This optional object, when defined under a thermal zone, returns the critical temperature
+ // at which OSPM may choose to transition the system into the S4 sleeping state.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // The return value is an integer that represents the critical sleep threshold tenths of degrees Kelvin.
+ //
+ Method(_HOT,0,Serialized)
+ {
+ Return(\_SB.IETM.CTOK(VRHT))
+ }
+
+ // _PSV (Passive)
+ //
+ // This optional object, if present under a thermal zone, evaluates to the temperature
+ // at which OSPM must activate passive cooling policy.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the passive cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_PSV, 0, Serialized)
+ {
+ If(CTYP)
+ {
+ Return(\_SB.IETM.CTOK(VRAT)) // Active Cooling Policy
+ } Else {
+ Return(\_SB.IETM.CTOK(VRPT)) // Passive Cooling Policy
+ }
+ }
+
+} // End Scope(\_SB.PCI0.LPCB.H_EC.T_VR)
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/T_VRParticipant.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/T_VRParticipant.asl
new file mode 100644
index 0000000..6ade5f0
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/T_VRParticipant.asl
@@ -0,0 +1,184 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ T_VRParticipant.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Dynamic Platform & Thermal Framework
+
+--*/
+
+Scope(\_SB.PCI0.LPCB.H_EC)
+{
+
+ Device(T_VR) // VR temperature sensor
+ {
+ Name(_HID, EISAID("INT3403")) // Intel DPTF Temperature Sensor Device
+ Name(_UID, 2)
+
+ Name(HITP, 0x64)
+ Name(VAUX, 0x10)
+ Name(_STR, Unicode ("VR Temperature Sensor"))
+ Name(PTYP, 0x03)
+
+ // _STA (Status)
+ //
+ // This object returns the current status of a device.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing a device status bitmap:
+ // Bit 0 - Set if the device is present.
+ // Bit 1 - Set if the device is enabled and decoding its resources.
+ // Bit 2 - Set if the device should be shown in the UI.
+ // Bit 3 - Set if the device is functioning properly (cleared if device failed its diagnostics).
+ // Bit 4 - Set if the battery is present.
+ // Bits 5-31 - Reserved (must be cleared).
+ //
+ Method(_STA)
+ {
+ If (LEqual(VRDE,1)){
+ Return(0x0F)
+ } Else {
+ Return(0x00)
+ }
+ }
+
+ // _TMP (Temperature)
+ //
+ // This control method returns the thermal zone's current operating temperature.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the current temperature of the thermal zone (in tenths of degrees Kelvin)
+ //
+ Method(_TMP, 0, Serialized)
+ {
+ If(\ECON)
+ {
+ // Get the CPU VR Temperature.
+ Return(\_SB.IETM.CTOK(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.CVRT))))
+ } Else {
+ Return(3000)
+ }
+ }
+
+ // Returns Number of Aux Trips available
+ Name(PATC, 2)
+
+ // PATx (Participant Programmable Auxiliary Trip) - Sets Aux Trip Point
+ //
+ // The PATx objects shall take a single integer parameter, in tenths of degree Kelvin, which
+ // represents the temperature at which the device should notify the participant driver of
+ // an auxiliary trip event. A PATx control method returns no value.
+ //
+ // Arguments: (1)
+ // Arg0 - temperature in tenths of degree Kelvin
+ // Return Value:
+ // None
+ //
+ Method(PAT0, 1, Serialized)
+ {
+ If (\ECON)
+ {
+ Store (Acquire(\_SB.PCI0.LPCB.H_EC.PATM, 100),Local0) // save Acquire result so we can check for Mutex acquired
+ If (LEqual(Local0, Zero)) // check for Mutex acquired
+ {
+ Store(\_SB.IETM.KTOC(Arg0),VAUX)
+ \_SB.PCI0.LPCB.H_EC.ECWT(0x0, RefOf(\_SB.PCI0.LPCB.H_EC.TSI))
+ \_SB.PCI0.LPCB.H_EC.ECWT(0x2, RefOf(\_SB.PCI0.LPCB.H_EC.HYST))
+ \_SB.PCI0.LPCB.H_EC.ECWT(VAUX, RefOf(\_SB.PCI0.LPCB.H_EC.TSLT))
+ \_SB.PCI0.LPCB.H_EC.ECMD(0x4A) // Set Trip point.
+ Release(\_SB.PCI0.LPCB.H_EC.PATM)
+ }
+ }
+ }
+
+ // PATx (Participant Programmable Auxiliary Trip) - Sets Aux Trip Point
+ //
+ // The PATx objects shall take a single integer parameter, in tenths of degree Kelvin, which
+ // represents the temperature at which the device should notify the participant driver of
+ // an auxiliary trip event. A PATx control method returns no value.
+ //
+ // Arguments: (1)
+ // Arg0 - temperature in tenths of degree Kelvin
+ // Return Value:
+ // None
+ //
+ Method(PAT1, 1, Serialized)
+ {
+ If (\ECON)
+ {
+ Store (Acquire(\_SB.PCI0.LPCB.H_EC.PATM, 100),Local0) // save Acquire result so we can check for Mutex acquired
+ If (LEqual(Local0, Zero)) // check for Mutex acquired
+ {
+ Store(\_SB.IETM.KTOC(Arg0),HITP)
+ \_SB.PCI0.LPCB.H_EC.ECWT(0x0, RefOf(\_SB.PCI0.LPCB.H_EC.TSI))
+ \_SB.PCI0.LPCB.H_EC.ECWT(0x2, RefOf(\_SB.PCI0.LPCB.H_EC.HYST))
+ \_SB.PCI0.LPCB.H_EC.ECWT(HITP, RefOf(\_SB.PCI0.LPCB.H_EC.TSHT))
+ \_SB.PCI0.LPCB.H_EC.ECMD(0x4A) // Set Trip point.
+ Release(\_SB.PCI0.LPCB.H_EC.PATM)
+ }
+ }
+ }
+
+ // Thermal Sensor Hysteresis, 2 degrees
+ Name(GTSH, 20)
+
+ Name(LSTM,0) // Last temperature reported
+
+ // _DTI (Device Temperature Indication)
+ //
+ // Conveys the temperature of a device's internal temperature sensor to the platform when a temperature trip point
+ // is crossed or when a meaningful temperature change occurs.
+ //
+ // Arguments: (1)
+ // Arg0 - An Integer containing the current value of the temperature sensor (in tenths Kelvin)
+ // Return Value:
+ // None
+ //
+ Method(_DTI, 1)
+ {
+ Store(Arg0,LSTM)
+ Notify(T_VR, 0x91) // notify the participant of a trip point change event
+ }
+
+ // _NTT (Notification Temperature Threshold)
+ //
+ // Returns the temperature change threshold for devices containing native temperature sensors to cause
+ // evaluation of the _DTI object
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the temperature threshold in tenths of degrees Kelvin.
+ //
+ Method(_NTT, 0)
+ {
+ Return(2782) // 5 degree Celcius, this could be a platform policy with setup item
+ }
+
+ } // End T_VR Device
+}// end Scope(\_SB.PCI0.LPCB.H_EC)
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/TcpuDppmPolicy.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/TcpuDppmPolicy.asl
new file mode 100644
index 0000000..2561099
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/TcpuDppmPolicy.asl
@@ -0,0 +1,304 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ TcpuDppmPolicy.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Dynamic Platform & Thermal Framework
+
+--*/
+
+Scope(\_SB.TCPU)
+{
+ Name(CTYP,0) // Device-specific cooling policy preference
+
+ // _ACx (Active Cooling)
+ //
+ // This optional object, if present under a thermal zone, returns the
+ // temperature trip point at which OSPM must start or stop Active cooling,
+ // where x is a value between 0 and 9 that designates multiple active cooling levels of the thermal zone.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the active cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_AC0)
+ {
+ If(CTYP)
+ {
+ Store(\_SB.IETM.CTOK(PSVT),Local1) // Passive Cooling Policy
+ }
+ Else
+ {
+ Store(\_SB.IETM.CTOK(ACTT),Local1) // Active Cooling Policy
+ }
+ If(LGreaterEqual(LSTM,Local1))
+ {
+ Return(Subtract(Local1,Multiply(2, 10)))
+ }
+ Else
+ {
+ Return(Local1)
+ }
+ }
+
+ // _ACx (Active Cooling)
+ //
+ // This optional object, if present under a thermal zone, returns the
+ // temperature trip point at which OSPM must start or stop Active cooling,
+ // where x is a value between 0 and 9 that designates multiple active cooling levels of the thermal zone.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the active cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_AC1)
+ {
+ If(CTYP)
+ {
+ Store(\_SB.IETM.CTOK(PSVT),Local0) // Passive Cooling Policy
+ }
+ Else
+ {
+ Store(\_SB.IETM.CTOK(ACTT),Local0) // Active Cooling Policy
+ }
+ Subtract(Local0, 50, Local0)
+
+ If(LGreaterEqual(LSTM,Local0))
+ {
+ Return (Subtract(Local0, Multiply(2, 10)))
+ }
+ Else
+ {
+ Return(Local0)
+ }
+ }
+
+ // _ACx (Active Cooling)
+ //
+ // This optional object, if present under a thermal zone, returns the
+ // temperature trip point at which OSPM must start or stop Active cooling,
+ // where x is a value between 0 and 9 that designates multiple active cooling levels of the thermal zone.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the active cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_AC2)
+ {
+ If(CTYP)
+ {
+ Store(\_SB.IETM.CTOK(PSVT),Local0) // Passive Cooling Policy
+ }
+ Else
+ {
+ Store(\_SB.IETM.CTOK(ACTT),Local0) // Active Cooling Policy
+ }
+ Subtract(Local0, 100, Local0)
+ If(LGreaterEqual(LSTM,Local0))
+ {
+ Return (Subtract(Local0, Multiply(2, 10)))
+ }
+ Else
+ {
+ Return(Local0)
+ }
+ }
+
+ // _ACx (Active Cooling)
+ //
+ // This optional object, if present under a thermal zone, returns the
+ // temperature trip point at which OSPM must start or stop Active cooling,
+ // where x is a value between 0 and 9 that designates multiple active cooling levels of the thermal zone.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the active cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_AC3)
+ {
+ If(CTYP)
+ {
+ Store(\_SB.IETM.CTOK(PSVT),Local0) // Passive Cooling Policy
+ }
+ Else
+ {
+ Store(\_SB.IETM.CTOK(ACTT),Local0) // Active Cooling Policy
+ }
+ Subtract(Local0, 150, Local0)
+ If(LGreaterEqual(LSTM,Local0))
+ {
+ Return (Subtract(Local0, Multiply(2, 10)))
+ }
+ Else
+ {
+ Return(Local0)
+ }
+ }
+
+ // _ACx (Active Cooling)
+ //
+ // This optional object, if present under a thermal zone, returns the
+ // temperature trip point at which OSPM must start or stop Active cooling,
+ // where x is a value between 0 and 9 that designates multiple active cooling levels of the thermal zone.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the active cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_AC4)
+ {
+ If(CTYP)
+ {
+ Store(\_SB.IETM.CTOK(PSVT),Local0) // Passive Cooling Policy
+ }
+ Else
+ {
+ Store(\_SB.IETM.CTOK(ACTT),Local0) // Active Cooling Policy
+ }
+ Subtract(Local0, 200, Local0)
+ If(LGreaterEqual(LSTM,Local0))
+ {
+ Return (Subtract(Local0, Multiply(2, 10)))
+ }
+ Else
+ {
+ Return(Local0)
+ }
+ }
+
+ // _ACx (Active Cooling)
+ //
+ // This optional object, if present under a thermal zone, returns the
+ // temperature trip point at which OSPM must start or stop Active cooling,
+ // where x is a value between 0 and 9 that designates multiple active cooling levels of the thermal zone.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the active cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_AC5)
+ {
+ If(CTYP)
+ {
+ Store(\_SB.IETM.CTOK(PSVT),Local0) // Passive Cooling Policy
+ }
+ Else
+ {
+ Store(\_SB.IETM.CTOK(ACTT),Local0) // Active Cooling Policy
+ }
+ Subtract(Local0, 250, Local0)
+ If(LGreaterEqual(LSTM,Local0))
+ {
+ Return (Subtract(Local0, Multiply(2, 10)))
+ }
+ Else
+ {
+ Return(Local0)
+ }
+ }
+
+ // _CRT (Critical Temperature)
+ //
+ // This object, when defined under a thermal zone, returns the critical temperature at which OSPM must shutdown the system.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the critical temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_CRT,0,Serialized)
+ {
+ Return(\_SB.IETM.CTOK(CRTT))
+ }
+
+ // _HOT (Hot Temperature)
+ //
+ // This optional object, when defined under a thermal zone, returns the critical temperature
+ // at which OSPM may choose to transition the system into the S4 sleeping state.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // The return value is an integer that represents the critical sleep threshold tenths of degrees Kelvin.
+ //
+ Method(_HOT,0,Serialized)
+ {
+ Return(\_SB.IETM.CTOK(Subtract(CRTT, 3)))
+ }
+
+ // _PSV (Passive)
+ //
+ // This optional object, if present under a thermal zone, evaluates to the temperature
+ // at which OSPM must activate passive cooling policy.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the passive cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_PSV,0,Serialized)
+ {
+ If(CTYP)
+ {
+ Return(\_SB.IETM.CTOK(ACTT)) // Passive Cooling Policy
+ } Else {
+ Return(\_SB.IETM.CTOK(PSVT)) // Active Cooling Policy
+ }
+ }
+
+ // _SCP (Set Cooling Policy)
+ //
+ // Arguments: (3)
+ // Arg0 - Mode An Integer containing the cooling mode policy code
+ // Arg1 - AcousticLimit An Integer containing the acoustic limit
+ // Arg2 - PowerLimit An Integer containing the power limit
+ // Return Value:
+ // None
+ //
+ // Argument Information:
+ // Mode - 0 = Active, 1 = Passive
+ // Acoustic Limit - Specifies the maximum acceptable acoustic level that active cooling devices may generate.
+ // Values are 1 to 5 where 1 means no acoustic tolerance and 5 means maximum acoustic tolerance.
+ // Power Limit - Specifies the maximum acceptable power level that active cooling devices may consume.
+ // Values are from 1 to 5 where 1 means no power may be used to cool and 5 means maximum power may be used to cool.
+ //
+ Method(_SCP, 3, Serialized)
+ {
+ If(LOr(LEqual(Arg0,0),LEqual(Arg0,1)))
+ {
+ Store(Arg0, CTYP)
+ P8XH(0, Arg1)
+ P8XH(1, Arg2)
+ Notify(\_SB.TCPU, 0x91)
+ }
+ }
+
+} // End Scope(\_SB.TCPU)
+
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/TcpuParticipant.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/TcpuParticipant.asl
new file mode 100644
index 0000000..ac6e1cb
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/TcpuParticipant.asl
@@ -0,0 +1,423 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ TcpuParticipant.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Dynamic Platform & Thermal Framework
+
+--*/
+
+
+Scope(\_SB)
+{
+ Device(TCPU)
+ {
+ External (PPCS)
+
+ Name(_HID, EISAID("INT3401")) // Intel Dptf Processor Device, 1 per package
+ Name(_UID,0)
+
+ Name(CINT,1)
+ Name(LSTM,0) // Last temperature reported
+
+ // _STA (Status)
+ //
+ // This object returns the current status of a device.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing a device status bitmap:
+ // Bit 0 - Set if the device is present.
+ // Bit 1 - Set if the device is enabled and decoding its resources.
+ // Bit 2 - Set if the device should be shown in the UI.
+ // Bit 3 - Set if the device is functioning properly (cleared if device failed its diagnostics).
+ // Bit 4 - Set if the battery is present.
+ // Bits 5-31 - Reserved (must be cleared).
+ //
+ Method(_STA)
+ {
+ If (LEqual(SADE,2)){
+ Return(0x0F)
+ } Else {
+ Return(0x00)
+ }
+ }
+
+ // PGMB (Pci GMch Bar)
+ //
+ // This object is required to be implemented on platforms supporting Intel code name Sandy Bridge processor.
+ // This object is not required for platforms supporting Intel code name Ivy Bridge processor.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // Return MCH Bar value.
+ //
+ Method(PGMB, 0)
+ {
+ Return(\_SB.PCI0.MHBR) // Return MCH Bar value
+ }
+
+ // _PPC (Performance Present Capabilities)
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the range of states supported
+ // 0 - States 0 through nth state are available (all states available)
+ // 1 - States 1 through nth state are available
+ // 2 - States 2 through nth state are available
+ // ...
+ // n - State n is available only
+ //
+ Name(_PPC,0)
+
+ // SPPC (Set Participant Performance Capability)
+ //
+ // SPPC is a control method object that takes one integer parameter that will indicate the maximum allowable
+ // P-State for OSPM to use at any given time.
+ //
+ // Arguments: (1)
+ // Arg0 - integer
+ // Return Value:
+ // None
+ //
+ Method(SPPC,1,Serialized)
+ {
+ Store(Arg0, \_PR.CPU0._PPC) // Note: CPU0._PPC is an Integer not a Method
+
+ If(CondRefOf(\_SB.PCCD.PENB)) { // is CPPC enabled in SETUP?
+ Notify(\_SB.PCCD,0x82) // CPPC notify
+ } Else {
+ Switch(ToInteger(TCNT)){
+ Case(8){
+ Notify(\_PR.CPU0, 0x80) // Tell CPU0 driver to re-eval _PPC
+ Notify(\_PR.CPU1, 0x80) // Tell CPU1 driver to re-eval _PPC
+ Notify(\_PR.CPU2, 0x80) // Tell CPU2 driver to re-eval _PPC
+ Notify(\_PR.CPU3, 0x80) // Tell CPU3 driver to re-eval _PPC
+ Notify(\_PR.CPU4, 0x80) // Tell CPU4 driver to re-eval _PPC
+ Notify(\_PR.CPU5, 0x80) // Tell CPU5 driver to re-eval _PPC
+ Notify(\_PR.CPU6, 0x80) // Tell CPU6 driver to re-eval _PPC
+ Notify(\_PR.CPU7, 0x80) // Tell CPU7 driver to re-eval _PPC
+ }
+ Case(4){
+ Notify(\_PR.CPU0, 0x80) // Tell CPU0 driver to re-eval _PPC
+ Notify(\_PR.CPU1, 0x80) // Tell CPU1 driver to re-eval _PPC
+ Notify(\_PR.CPU2, 0x80) // Tell CPU2 driver to re-eval _PPC
+ Notify(\_PR.CPU3, 0x80) // Tell CPU3 driver to re-eval _PPC
+ }
+ Case(2){
+ Notify(\_PR.CPU0, 0x80) // Tell CPU0 driver to re-eval _PPC
+ Notify(\_PR.CPU1, 0x80) // Tell CPU1 driver to re-eval _PPC
+ }
+ Default{
+ Notify(\_PR.CPU0, 0x80) // Tell CPU0 driver to re-eval _PPC
+ }
+ }
+ }
+ }
+
+ // _TMP (Temperature)
+ //
+ // This control method returns the thermal zone's current operating temperature.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the current temperature of the thermal zone (in tenths of degrees Kelvin)
+ //
+ //AMI override begin
+ //Method(_TMP)
+ Method(TMPX)
+ //AMI override end
+ {
+ // Return the temperature to the OS if EC access is enabled.
+ If(\ECON)
+ {
+ Return(\_SB.IETM.CTOK(\_SB.PCI0.LPCB.H_EC.PECH))
+ }
+ Else
+ {
+ // Return a static value as EC access is disabled or DPTF is active.
+ Return(3000)
+ }
+ }
+
+ // _DTI (Device Temperature Indication)
+ //
+ // Conveys the temperature of a device's internal temperature sensor to the platform when a temperature trip point
+ // is crossed or when a meaningful temperature change occurs.
+ //
+ // Arguments: (1)
+ // Arg0 - An Integer containing the current value of the temperature sensor (in tenths Kelvin)
+ // Return Value:
+ // None
+ //
+ Method(_DTI, 1)
+ {
+ Store(Arg0,LSTM)
+ Notify(TCPU, 0x91) // notify the participant of a trip point change event
+ }
+
+ // _NTT (Notification Temperature Threshold)
+ //
+ // Returns the temperature change threshold for devices containing native temperature sensors to cause
+ // evaluation of the _DTI object
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the temperature threshold in tenths of degrees Kelvin.
+ //
+ Method(_NTT, 0)
+ {
+ Return(2782) // 5 degree Celcius, this could be a platform policy with setup item
+ }
+
+ // _PSS (Performance Supported States)
+ //
+ // This optional object indicates to OSPM the number of supported processor performance states that any given system can support.
+ //
+ // Arguments: (1)
+ // None
+ // Return Value:
+ // A variable-length Package containing a list of Pstate sub-packages as described below
+ //
+ // Return Value Information
+ // Package {
+ // PState [0] // Package - Performance state 0
+ // ....
+ // PState [n] // Package - Performance state n
+ // }
+ //
+ // Each Pstate sub-Package contains the elements described below:
+ // Package {
+ // CoreFrequency // Integer (DWORD)
+ // Power // Integer (DWORD)
+ // Latency // Integer (DWORD)
+ // BusMasterLatency // Integer (DWORD)
+ // Control // Integer (DWORD)
+ // Status // Integer (DWORD)
+ // }
+ //
+ // Stub for the Actual CPU _PSS method.
+ //
+ Method(_PSS,,,,PkgObj)
+ {
+ If(CondRefOf(\_PR.CPU0._PSS))
+ { // Ensure _PSS is present
+ Return(\_PR.CPU0._PSS())
+ } Else {
+ Return(Package(){
+ Package(){0,0,0,0,0,0},
+ Package(){0,0,0,0,0,0}})
+ }
+ }
+
+ // _TSS (Throttling Supported States)
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // A variable-length Package containing a list of Tstate sub-packages as described below
+ //
+ // Return Value Information
+ // Package {
+ // TState [0] // Package - Throttling state 0
+ // ....
+ // TState [n] // Package - Throttling state n
+ // }
+ //
+ // Each Tstate sub-Package contains the elements described below:
+ // Package {
+ // Percent // Integer (DWORD)
+ // Power // Integer (DWORD)
+ // Latency // Integer (DWORD)
+ // Control // Integer (DWORD)
+ // Status // Integer (DWORD)
+ // }
+ //
+ // Stub for the Actual CPU _TSS method.
+ //
+ Method(_TSS,,,,PkgObj)
+ {
+ If(CondRefOf(\_PR.CPU0._TSS))
+ { // Ensure _TSS is present
+ Return(\_PR.CPU0._TSS())
+ } Else {
+ Return(Package(){
+ Package(){0,0,0,0,0},
+ Package(){0,0,0,0,0}})
+ }
+ }
+
+ // _TPC (Throttling Present Capabilities)
+ //
+ // This optional object is a method that dynamically indicates to OSPM the number of throttling states currently supported by the platform.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the number of states supported:
+ // 0 - states 0 .. nth state available (all states available)
+ // 1 - state 1 .. nth state available
+ // 2 - state 2 .. nth state available
+ // ...
+ // n - state n available only
+ //
+ Method(_TPC)
+ {
+ If(CondRefOf(\_PR.CPU0._TPC))
+ { // Ensure _TPC is present
+ Return(\_PR.CPU0._TPC)
+ } Else {
+ Return(0)
+ }
+ }
+
+ // _PTC (Processor Throttling Control)
+ //
+ // _PTC is an optional object that defines a processor throttling control interface alternative to the I/O address spaced-based P_BLK throttling control register (P_CNT)
+ //
+ // PDC0[2] = ACPI object indicating if OSPM is capable of direct access to On Demand throttling MSR
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // A Package as described below
+ //
+ // Return Value Information
+ // Package {
+ // ControlRegister // Buffer (Resource Descriptor)
+ // StatusRegister // Buffer (Resource Descriptor)
+ // }
+ //
+ Method(_PTC,,,,PkgObj)
+ {
+ If(LAnd(CondRefOf(\PDC0),LNotEqual(\PDC0,0x80000000))) // is object present and initialized?
+ {
+ If(And(\PDC0, 0x0004)) { // does OS support MSR interface?
+ Return(Package() {
+ ResourceTemplate(){Register(FFixedHW, 0, 0, 0)},
+ ResourceTemplate(){Register(FFixedHW, 0, 0, 0)} }) // if OS supports MSR interface
+ } Else {
+ Return(Package() {
+ ResourceTemplate(){Register(SystemIO, 5, 0, PCH_ACPI_PBLK)},
+ ResourceTemplate(){Register(SystemIO, 5, 0, PCH_ACPI_PBLK)} }) // if OS support IO based interface
+ }
+ } Else {
+ Return(Package() {
+ ResourceTemplate(){Register(FFixedHW, 0, 0, 0)},
+ ResourceTemplate(){Register(FFixedHW, 0, 0, 0)} }) // if object is not present or not initialized then return MSR interface
+ }
+ }
+
+ // _TSD (T-State Dependency)
+ //
+ // This optional object provides T-state control cross logical processor dependency information to OSPM.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // A variable-length Package containing a list of T-state dependency Packages as described below.
+ //
+ // Return Value Information
+ // Package {
+ // NumEntries // Integer
+ // Revision // Integer (BYTE)
+ // Domain // Integer (DWORD)
+ // CoordType // Integer (DWORD)
+ // NumProcessors // Integer (DWORD)
+ // }
+ //
+ Method(_TSD,,,,PkgObj)
+ {
+ If(CondRefOf(\_PR.CPU0._TSD))
+ { // Ensure _TSD is present
+ Return(\_PR.CPU0._TSD())
+ } Else {
+ Return(Package(){
+ Package(){5,0,0,0,0},
+ Package(){5,0,0,0,0}})
+ }
+ }
+
+ // _TDL (T-state Depth Limit)
+ //
+ // This optional object evaluates to the _TSS entry number of the lowest power throttling state that OSPM may use.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the Throttling Depth Limit _TSS entry number:
+ // 0 - throttling disabled.
+ // 1 - state 1 is the lowest power T-state available.
+ // 2 - state 2 is the lowest power T-state available.
+ // ...
+ // n - state n is the lowest power T-state available.
+ //
+ Method(_TDL)
+ {
+ If(LAnd(CondRefOf(\_PR.CPU0._TSS),CondRefOf(\_PR.CFGD)))
+ { // Ensure _TSS is present
+ If(And(\_PR.CFGD, PPM_TSTATE_FINE_GRAINED))
+ {
+ Return(Subtract(SizeOf(\_PR.CPU0.TSMF),1))
+ } Else {
+ Return(Subtract(SizeOf(\_PR.CPU0.TSMC),1))
+ }
+ } Else {
+ Return(0)
+ }
+ }
+
+ // _PDL (P-state Depth Limit)
+ //
+ // This optional object evaluates to the _PSS entry number of the lowest performance P-state that OSPM may use when performing passive thermal control.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the P-state Depth Limit _PSS entry number:
+ // Integer containing the P-state Depth Limit _PSS entry number:
+ // 0 - P0 is the only P-state available for OSPM use
+ // 1 - state 1 is the lowest power P-state available
+ // 2 - state 2 is the lowest power P-state available
+ // ...
+ // n - state n is the lowest power P-state available
+ //
+ Method(_PDL)
+ {
+ If(CondRefOf(\_PR.CPU0._PSS))
+ { // Ensure _PSS is present
+ Return(Subtract(SizeOf(\_PR.CPU0._PSS),1))
+ } Else {
+ Return(0)
+ }
+ }
+
+ } // End Device(TCPU)
+} // End Scope(\_SB)
+
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/TpchDppmPolicy.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/TpchDppmPolicy.asl
new file mode 100644
index 0000000..affa078
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/TpchDppmPolicy.asl
@@ -0,0 +1,175 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ TpchDppmPolicy.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Dynamic Platform & Thermal Framework
+
+--*/
+
+Scope(\_SB.PCI0.TPCH)
+{
+ Name (CTYP, 0) // Device-specific cooling policy preference
+
+ // _SCP (Set Cooling Policy)
+ //
+ // Arguments: (3)
+ // Arg0 - Mode An Integer containing the cooling mode policy code
+ // Arg1 - AcousticLimit An Integer containing the acoustic limit
+ // Arg2 - PowerLimit An Integer containing the power limit
+ // Return Value:
+ // None
+ //
+ // Argument Information:
+ // Mode - 0 = Active, 1 = Passive
+ // Acoustic Limit - Specifies the maximum acceptable acoustic level that active cooling devices may generate.
+ // Values are 1 to 5 where 1 means no acoustic tolerance and 5 means maximum acoustic tolerance.
+ // Power Limit - Specifies the maximum acceptable power level that active cooling devices may consume.
+ // Values are from 1 to 5 where 1 means no power may be used to cool and 5 means maximum power may be used to cool.
+ //
+ Method(_SCP,3,Serialized)
+ {
+ If(LOr(LEqual(Arg0,0),LEqual(Arg0,1)))
+ {
+ Store(Arg0, CTYP)
+ P8XH(0, Arg1)
+ P8XH(1, Arg2)
+ Notify(\_SB.PCI0.TPCH, 0x91)
+ }
+ }
+
+ // _CRT (Critical Temperature)
+ //
+ // This object, when defined under a thermal zone, returns the critical temperature at which OSPM must shutdown the system.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the critical temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_CRT,0,Serialized)
+ {
+ Return(\_SB.IETM.CTOK(PCHC))
+ }
+
+ // _HOT (Hot Temperature)
+ //
+ // This optional object, when defined under a thermal zone, returns the critical temperature
+ // at which OSPM may choose to transition the system into the S4 sleeping state.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // The return value is an integer that represents the critical sleep threshold tenths of degrees Kelvin.
+ //
+ Method(_HOT,0,Serialized)
+ {
+ Return(\_SB.IETM.CTOK(PCHH))
+ }
+
+ // _PSV (Passive)
+ //
+ // This optional object, if present under a thermal zone, evaluates to the temperature
+ // at which OSPM must activate passive cooling policy.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the passive cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_PSV,0,Serialized)
+ {
+ If(CTYP)
+ {
+ Return(\_SB.IETM.CTOK(ATPC)) // Passive Cooling Policy
+ } Else {
+ Return(\_SB.IETM.CTOK(PTPC)) // Active Cooling Policy
+ }
+ }
+
+ // _ACx (Active Cooling)
+ //
+ // This optional object, if present under a thermal zone, returns the
+ // temperature trip point at which OSPM must start or stop Active cooling,
+ // where x is a value between 0 and 9 that designates multiple active cooling levels of the thermal zone.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the active cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_AC0)
+ {
+ If(CTYP)
+ {
+ Store(\_SB.IETM.CTOK(PTPC),Local1) // Passive Cooling Policy
+ }
+ Else
+ {
+ Store(\_SB.IETM.CTOK(ATPC),Local1) // Active Cooling Policy
+ }
+ If(LGreaterEqual(LSTM,Local1))
+ {
+ Return(Subtract(Local1,20)) // subtract 2 degrees which is the Hysteresis
+ }
+ Else
+ {
+ Return(Local1)
+ }
+ }
+
+ // _ACx (Active Cooling)
+ //
+ // This optional object, if present under a thermal zone, returns the
+ // temperature trip point at which OSPM must start or stop Active cooling,
+ // where x is a value between 0 and 9 that designates multiple active cooling levels of the thermal zone.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the active cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_AC1)
+ {
+ If(CTYP)
+ {
+ Store(\_SB.IETM.CTOK(PTPC),Local0) // Passive Cooling Policy
+ }
+ Else
+ {
+ Store(\_SB.IETM.CTOK(ATPC),Local0) // Active Cooling Policy
+ }
+ Subtract(Local0, 50, Local0)
+ If(LGreaterEqual(LSTM,Local0))
+ {
+ Return(Subtract(Local0,20)) // subtract 2 degrees which is the Hysteresis
+ }
+ Else
+ {
+ Return(Local0)
+ }
+ }
+
+} // End Scope(\_SB.PCI0.TPCH)
+
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/TpchParticipant.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/TpchParticipant.asl
new file mode 100644
index 0000000..c8b816b
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/TpchParticipant.asl
@@ -0,0 +1,113 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ TpchParticipant.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Dynamic Platform & Thermal Framework
+
+--*/
+
+
+Scope(\_SB.PCI0)
+{
+ //
+ // This device is currently used by DPPM policies only.
+ // Refer to the specific technology BIOS specification.
+ //
+ Device (TPCH)
+ {
+ Name (_ADR,0x001F0006) // Device 31, Function 6
+ Name (LSTM,0) // Last temperature reported
+
+ // _STA (Status)
+ //
+ // This object returns the current status of a device.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing a device status bitmap:
+ // Bit 0 - Set if the device is present.
+ // Bit 1 - Set if the device is enabled and decoding its resources.
+ // Bit 2 - Set if the device should be shown in the UI.
+ // Bit 3 - Set if the device is functioning properly (cleared if device failed its diagnostics).
+ // Bit 4 - Set if the battery is present.
+ // Bits 5-31 - Reserved (must be cleared).
+ //
+ Method(_STA)
+ {
+ If (LEqual(PCHD,1)){
+ Return(0x0F)
+ } Else {
+ Return(0x00)
+ }
+ }
+
+ OperationRegion(PCHT,PCI_Config,0x10,0x08) // PCH Thermal BAR
+ Field(PCHT,DWordAcc,NoLock,Preserve)
+ {
+ Offset(0x0), // EPBAR (Offset 10h)
+ STYP, 1, // Space type
+ ADRG, 2, // Address Range
+ PREF, 1, // Prefetchable
+ , 8, // hardwired to 0
+ TBAR, 52 // Thermal BAR
+ }
+
+ // Thermal Sensor Hysteresis, 3 degree Centigrade
+ Name(GTSH, 30)
+
+ // _DTI (Device Temperature Indication)
+ //
+ // Conveys the temperature of a device's internal temperature sensor to the platform when a temperature trip point
+ // is crossed or when a meaningful temperature change occurs.
+ //
+ // Arguments: (1)
+ // Arg0 - An Integer containing the current value of the temperature sensor (in tenths Kelvin)
+ // Return Value:
+ // None
+ //
+ Method(_DTI, 1)
+ {
+ Store(Arg0,LSTM)
+ Notify(TPCH, 0x91) // notify the participant of a trip point change event
+ }
+
+ // _NTT (Notification Temperature Threshold)
+ //
+ // Returns the temperature change threshold for devices containing native temperature sensors to cause
+ // evaluation of the _DTI object
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the temperature threshold in tenths of degrees Kelvin.
+ //
+ Method(_NTT, 0)
+ {
+ Return(2782) // 5 degree Celcius, this could be a platform policy with setup item
+ }
+
+ } // End Device(TPCH)
+} // End Scope(\_SB.PCI0)
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/Trt.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Trt.asl
new file mode 100644
index 0000000..b3f6e37
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/Trt.asl
@@ -0,0 +1,757 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ Trt.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Intel Dynamic Power Performance Management
+
+--*/
+
+Scope(\_SB.IETM)
+{
+
+ Name(TRTI, Package() // TRT package when TFN1 is at 0% speed
+ {
+ // Source Target Influence Period Reserved
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.TPCH, 30, 20, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.TCPU, 28, 50, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.TMEM, 10, 100, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TAMB, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.T_VR, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TEFN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.B0D4, 28, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.TMEM, 30, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TAMB, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.T_VR, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TEFN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.TCPU, 03, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.B0D4, 30, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.TMEM, 44, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TSKN, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TAMB, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.T_VR, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TEFN, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.TMEM, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.TCPU, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.WWAN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.WWAN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.WWAN, 20, 50, 0, 0, 0, 0}
+ })
+
+ Name(TRTH, Package() // TRT package when TFN1 is at 15% speed
+ {
+ // Source Target Influence Period Reserved
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.TPCH, 30, 20, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.TCPU, 36, 50, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.TMEM, 10, 100, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TAMB, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.T_VR, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TEFN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.B0D4, 36, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.TMEM, 30, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TAMB, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.T_VR, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TEFN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.TCPU, 3, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.B0D4, 30, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.TMEM, 44, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TSKN, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TAMB, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.T_VR, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TEFN, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.TMEM, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.TCPU, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.WWAN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.WWAN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.WWAN, 20, 50, 0, 0, 0, 0}
+ })
+
+ Name(TRTG, Package() // TRT package when TFN1 is at 20% speed
+ {
+ // Source Target Influence Period Reserved
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.TPCH, 30, 20, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.TCPU, 36, 50, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.TMEM, 10, 100, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TAMB, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.T_VR, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TEFN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.B0D4, 36, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.TMEM, 30, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TAMB, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.T_VR, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TEFN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.TCPU, 3, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.B0D4, 30, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.TMEM, 44, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TSKN, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TAMB, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.T_VR, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TEFN, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.TMEM, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.TCPU, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.WWAN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.WWAN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.WWAN, 20, 50, 0, 0, 0, 0}
+ })
+
+ Name(TRTF, Package() // TRT package when TFN1 is at 25% speed
+ {
+ // Source Target Influence Period Reserved
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.TPCH, 30, 20, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.TCPU, 36, 50, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.TMEM, 10, 100, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TAMB, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.T_VR, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TEFN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.B0D4, 36, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.TMEM, 30, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TAMB, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.T_VR, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TEFN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.TCPU, 3, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.B0D4, 30, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.TMEM, 44, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TSKN, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TAMB, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.T_VR, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TEFN, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.TMEM, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.TCPU, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.WWAN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.WWAN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.WWAN, 20, 50, 0, 0, 0, 0}
+ })
+
+ Name(TRTE, Package() // TRT package when TFN1 is at 30% speed
+ {
+ // Source Target Influence Period Reserved
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.TPCH, 30, 20, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.TCPU, 36, 50, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.TMEM, 10, 100, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TAMB, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.T_VR, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TEFN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.B0D4, 36, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.TMEM, 30, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TAMB, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.T_VR, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TEFN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.TCPU, 3, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.B0D4, 30, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.TMEM, 44, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TSKN, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TAMB, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.T_VR, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TEFN, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.TMEM, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.TCPU, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.WWAN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.WWAN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.WWAN, 20, 50, 0, 0, 0, 0}
+ })
+
+ Name(TRTD, Package() // TRT package when TFN1 is at 35% speed
+ {
+ // Source Target Influence Period Reserved
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.TPCH, 30, 20, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.TCPU, 36, 50, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.TMEM, 10, 100, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TAMB, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.T_VR, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TEFN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.B0D4, 36, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.TMEM, 30, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TAMB, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.T_VR, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TEFN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.TCPU, 3, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.B0D4, 30, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.TMEM, 44, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TSKN, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TAMB, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.T_VR, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TEFN, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.TMEM, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.TCPU, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.WWAN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.WWAN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.WWAN, 20, 50, 0, 0, 0, 0}
+ })
+
+ Name(TRTC, Package() // TRT package when TFN1 is at 40% speed
+ {
+ // Source Target Influence Period Reserved
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.TPCH, 30, 20, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.TCPU, 36, 50, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.TMEM, 10, 100, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TAMB, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.T_VR, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TEFN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.B0D4, 36, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.TMEM, 30, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TAMB, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.T_VR, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TEFN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.TCPU, 3, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.B0D4, 30, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.TMEM, 44, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TSKN, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TAMB, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.T_VR, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TEFN, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.TMEM, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.TCPU, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.WWAN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.WWAN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.WWAN, 20, 50, 0, 0, 0, 0}
+ })
+
+ Name(TRTB, Package() // TRT package when TFN1 is at 45% speed
+ {
+ // Source Target Influence Period Reserved
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.TPCH, 30, 20, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.TCPU, 36, 50, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.TMEM, 10, 100, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TAMB, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.T_VR, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TEFN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.B0D4, 36, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.TMEM, 30, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TAMB, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.T_VR, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TEFN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.TCPU, 3, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.B0D4, 30, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.TMEM, 44, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TSKN, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TAMB, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.T_VR, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TEFN, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.TMEM, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.TCPU, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.WWAN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.WWAN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.WWAN, 20, 50, 0, 0, 0, 0}
+ })
+
+ Name(TRTA, Package() // TRT package when TFN1 is at 50% speed
+ {
+ // Source Target Influence Period Reserved
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.TPCH, 30, 20, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.TCPU, 36, 50, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.TMEM, 10, 100, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TAMB, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.T_VR, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TEFN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.B0D4, 36, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.TMEM, 30, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TAMB, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.T_VR, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TEFN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.TCPU, 3, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.B0D4, 30, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.TMEM, 44, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TSKN, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TAMB, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.T_VR, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TEFN, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.TMEM, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.TCPU, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.WWAN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.WWAN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.WWAN, 20, 50, 0, 0, 0, 0}
+ })
+
+ Name(TRT9, Package() // TRT package when TFN1 is at 55% speed
+ {
+ // Source Target Influence Period Reserved
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.TPCH, 30, 20, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.TCPU, 34, 50, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.TMEM, 10, 100, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TAMB, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.T_VR, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TEFN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.B0D4, 34, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.TMEM, 30, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TAMB, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.T_VR, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TEFN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.TCPU, 3, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.B0D4, 30, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.TMEM, 44, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TSKN, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TAMB, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.T_VR, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TEFN, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.TMEM, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.TCPU, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.WWAN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.WWAN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.WWAN, 20, 50, 0, 0, 0, 0}
+ })
+
+ Name(TRT8, Package() // TRT package when TFN1 is at 60% speed
+ {
+ // Source Target Influence Period Reserved
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.TPCH, 30, 20, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.TCPU, 32, 50, 8, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.TMEM, 10, 100, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TAMB, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.T_VR, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TEFN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.B0D4, 32, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.TMEM, 30, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TAMB, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.T_VR, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TEFN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.TCPU, 3, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.B0D4, 30, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.TMEM, 44, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TSKN, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TAMB, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.T_VR, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TEFN, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.TMEM, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.TCPU, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.WWAN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.WWAN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.WWAN, 20, 50, 0, 0, 0, 0}
+ })
+
+ Name(TRT7, Package() // TRT package when TFN1 is at 65% speed
+ {
+ // Source Target Influence Period Reserved
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.TPCH, 30, 20, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.TCPU, 30, 50, 7, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.TMEM, 10, 100, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TAMB, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.T_VR, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TEFN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.B0D4, 30, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.TMEM, 30, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TAMB, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.T_VR, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TEFN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.TCPU, 3, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.B0D4, 30, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.TMEM, 44, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TSKN, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TAMB, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.T_VR, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TEFN, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.TMEM, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.TCPU, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.WWAN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.WWAN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.WWAN, 20, 50, 0, 0, 0, 0}
+ })
+
+ Name(TRT6, Package() // TRT package when TFN1 is at 70% speed
+ {
+ // Source Target Influence Period Reserved
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.TPCH, 30, 20, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.TCPU, 28, 50, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.TMEM, 10, 100, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TAMB, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.T_VR, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TEFN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.B0D4, 28, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.TMEM, 30, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TAMB, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.T_VR, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TEFN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.TCPU, 3, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.B0D4, 30, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.TMEM, 44, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TSKN, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TAMB, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.T_VR, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TEFN, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.TMEM, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.TCPU, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.WWAN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.WWAN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.WWAN, 20, 50, 0, 0, 0, 0}
+ })
+
+ Name(TRT5, Package() // TRT package when TFN1 is at 75% speed
+ {
+ // Source Target Influence Period Reserved
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.TPCH, 30, 20, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.TCPU, 26, 50, 5, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.TMEM, 10, 100, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TAMB, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.T_VR, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TEFN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.B0D4, 26, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.TMEM, 30, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TAMB, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.T_VR, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TEFN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.TCPU, 3, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.B0D4, 30, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.TMEM, 44, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TSKN, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TAMB, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.T_VR, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TEFN, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.TMEM, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.TCPU, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.WWAN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.WWAN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.WWAN, 20, 50, 0, 0, 0, 0}
+ })
+
+ Name(TRT4, Package() // TRT package when TFN1 is at 80% speed
+ {
+ // Source Target Influence Period Reserved
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.TPCH, 30, 20, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.TCPU, 24, 50, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.TMEM, 10, 100, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TAMB, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.T_VR, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TEFN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.B0D4, 24, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.TMEM, 30, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TAMB, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.T_VR, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TEFN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.TCPU, 3, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.B0D4, 30, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.TMEM, 44, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TSKN, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TAMB, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.T_VR, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TEFN, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.TMEM, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.TCPU, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.WWAN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.WWAN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.WWAN, 20, 50, 0, 0, 0, 0}
+ })
+
+ Name(TRT3, Package() // TRT package when TFN1 is at 85% speed
+ {
+ // Source Target Influence Period Reserved
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.TPCH, 30, 20, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.TCPU, 22, 50, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.TMEM, 10, 100, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TAMB, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.T_VR, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TEFN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.B0D4, 22, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.TMEM, 30, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TAMB, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.T_VR, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TEFN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.TCPU, 3, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.B0D4, 30, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.TMEM, 44, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TSKN, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TAMB, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.T_VR, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TEFN, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.TMEM, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.TCPU, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.WWAN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.WWAN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.WWAN, 20, 50, 0, 0, 0, 0}
+ })
+
+ Name(TRT2, Package() // TRT package when TFN1 is at 90% speed
+ {
+ // Source Target Influence Period Reserved
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.TPCH, 30, 20, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.TCPU, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.TMEM, 10, 100, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TAMB, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.T_VR, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TEFN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.B0D4, 21, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.TMEM, 30, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TAMB, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.T_VR, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TEFN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.TCPU, 3, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.B0D4, 30, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.TMEM, 44, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TSKN, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TAMB, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.T_VR, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TEFN, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.TMEM, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.TCPU, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.WWAN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.WWAN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.WWAN, 20, 50, 0, 0, 0, 0}
+ })
+
+ Name(TRT1, Package() // TRT package when TFN1 is at 95% speed
+ {
+ // Source Target Influence Period Reserved
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.TPCH, 30, 20, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.TCPU, 18, 50, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.TMEM, 10, 100, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TAMB, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.T_VR, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TEFN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.B0D4, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.TMEM, 30, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TAMB, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.T_VR, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TEFN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.TCPU, 3, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.B0D4, 30, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.TMEM, 44, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TSKN, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TAMB, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.T_VR, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TEFN, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.TMEM, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.TCPU, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.WWAN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.WWAN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.WWAN, 20, 50, 0, 0, 0, 0}
+ })
+
+ Name(TRT0, Package() // TRT package when TFN1 is at 100% speed
+ {
+ // Source Target Influence Period Reserved
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.TPCH, 30, 20, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.TCPU, 16, 50, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.TMEM, 10, 100, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TAMB, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.T_VR, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.TCPU, \_SB.PCI0.LPCB.H_EC.TEFN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.B0D4, 18, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.TMEM, 30, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TAMB, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.T_VR, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.LPCB.H_EC.TEFN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.TCPU, 3, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.B0D4, 30, 100, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.TMEM, 44, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TSKN, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TAMB, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.T_VR, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.LPCB.H_EC.TEFN, 1, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.TMEM, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.TCPU, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.LPCB.H_EC.TSKN, 20, 50, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.B0D4, \_SB.PCI0.WWAN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.TMEM, \_SB.PCI0.WWAN, 20, 200, 0, 0, 0, 0},
+ Package(){\_SB.PCI0.DPLY, \_SB.PCI0.WWAN, 20, 50, 0, 0, 0, 0}
+ })
+
+ // TRTR (Thermal Relationship Table Revision)
+ //
+ // This object evaluates to an integer value that defines the revision of the _TRT object.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // 0: Traditional TRT as defined by the ACPI Specification.
+ // 1: Priority based TRT
+ //
+ Method(TRTR)
+ {
+ Return(TRTV)
+ }
+
+ // _TRT (Thermal Relationship Table)
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // A variable-length Package containing a list of Thermal Relationship Packages as described below.
+ //
+ // Return Value Information
+ // Package {
+ // ThermalRelationship[0] // Package
+ // ...
+ // ThermalRelationship[n] // Package
+ // }
+ //
+ Method(_TRT,,,,PkgObj)
+ {
+ If(\ECON)
+ {
+ If(\_SB.PCI0.LPCB.H_EC.CFAN) // CFAN Holds On/Off information
+ {
+ If(LEqual(\_SB.PCI0.LPCB.H_EC.PENV, 0)) // PENV holds duty cycle in percent
+ {
+ Return(TRTI)
+ }
+
+ If(LLessEqual(\_SB.PCI0.LPCB.H_EC.PENV, 15)) // PENV holds duty cycle in percent
+ {
+ Return(TRTH)
+ }
+
+ If(LLessEqual(\_SB.PCI0.LPCB.H_EC.PENV, 20))
+ {
+ Return(TRTG)
+ }
+
+ If(LLessEqual(\_SB.PCI0.LPCB.H_EC.PENV, 25))
+ {
+ Return(TRTF)
+ }
+
+ If(LLessEqual(\_SB.PCI0.LPCB.H_EC.PENV, 30))
+ {
+ Return(TRTE)
+ }
+
+ If(LLessEqual(\_SB.PCI0.LPCB.H_EC.PENV, 35))
+ {
+ Return(TRTD)
+ }
+
+ If(LLessEqual(\_SB.PCI0.LPCB.H_EC.PENV, 40))
+ {
+ Return(TRTC)
+ }
+
+ If(LLessEqual(\_SB.PCI0.LPCB.H_EC.PENV, 45))
+ {
+ Return(TRTB)
+ }
+
+ If(LLessEqual(\_SB.PCI0.LPCB.H_EC.PENV, 50))
+ {
+ Return(TRTA)
+ }
+
+ If(LLessEqual(\_SB.PCI0.LPCB.H_EC.PENV, 55))
+ {
+ Return(TRT9)
+ }
+
+ If(LLessEqual(\_SB.PCI0.LPCB.H_EC.PENV, 60))
+ {
+ Return(TRT8)
+ }
+
+ If(LLessEqual(\_SB.PCI0.LPCB.H_EC.PENV, 65))
+ {
+ Return(TRT7)
+ }
+
+ If(LLessEqual(\_SB.PCI0.LPCB.H_EC.PENV, 70))
+ {
+ Return(TRT6)
+ }
+
+ If(LLessEqual(\_SB.PCI0.LPCB.H_EC.PENV, 75))
+ {
+ Return(TRT5)
+ }
+
+ If(LLessEqual(\_SB.PCI0.LPCB.H_EC.PENV, 80))
+ {
+ Return(TRT4)
+ }
+
+ If(LLessEqual(\_SB.PCI0.LPCB.H_EC.PENV, 85))
+ {
+ Return(TRT3)
+ }
+
+ If(LLessEqual(\_SB.PCI0.LPCB.H_EC.PENV, 90))
+ {
+ Return(TRT2)
+ }
+
+ If(LLessEqual(\_SB.PCI0.LPCB.H_EC.PENV, 95))
+ {
+ Return(TRT1)
+ }
+
+ If(LLessEqual(\_SB.PCI0.LPCB.H_EC.PENV, 100))
+ {
+ Return(TRT0)
+ }
+ }
+ }
+
+ Return(TRTI) // Return 0% State TRT by default
+ } // End _TRT
+}
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/WWANDppmPolicy.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/WWANDppmPolicy.asl
new file mode 100644
index 0000000..d827eed
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/WWANDppmPolicy.asl
@@ -0,0 +1,140 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ WWANDppmPolicy.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Dynamic Platform & Thermal Framework
+
+--*/
+
+Scope(\_SB.PCI0.WWAN)
+{
+ Name(CTYP,0) // Device-specific cooling policy preference
+
+ // _SCP (Set Cooling Policy)
+ //
+ // Arguments: (3)
+ // Arg0 - Mode An Integer containing the cooling mode policy code
+ // Arg1 - AcousticLimit An Integer containing the acoustic limit
+ // Arg2 - PowerLimit An Integer containing the power limit
+ // Return Value:
+ // None
+ //
+ // Argument Information:
+ // Mode - 0 = Active, 1 = Passive
+ // Acoustic Limit - Specifies the maximum acceptable acoustic level that active cooling devices may generate.
+ // Values are 1 to 5 where 1 means no acoustic tolerance and 5 means maximum acoustic tolerance.
+ // Power Limit - Specifies the maximum acceptable power level that active cooling devices may consume.
+ // Values are from 1 to 5 where 1 means no power may be used to cool and 5 means maximum power may be used to cool.
+ //
+ Method(_SCP, 3, Serialized)
+ {
+ If(LOr(LEqual(Arg0,0),LEqual(Arg0,1)))
+ {
+ Store(Arg0, CTYP)
+ P8XH(0, Arg1)
+ P8XH(1, Arg2)
+ Notify(\_SB.PCI0.WWAN, 0x91)
+ }
+ }
+
+ // _ACx (Active Cooling)
+ //
+ // This optional object, if present under a thermal zone, returns the
+ // temperature trip point at which OSPM must start or stop Active cooling,
+ // where x is a value between 0 and 9 that designates multiple active cooling levels of the thermal zone.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the active cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_AC0)
+ {
+ If(CTYP)
+ {
+ Store(\_SB.IETM.CTOK(WWPT),Local1) // Passive Cooling Policy
+ } Else {
+ Store(\_SB.IETM.CTOK(WWAT),Local1) // Active Cooling Policy
+ }
+ If(LGreater(LSTM,Local1))
+ {
+ Return(Subtract(Local1,GTSH)) // subtract 2 degrees which is the Hysteresis
+ }
+ Else
+ {
+ Return(Local1)
+ }
+ }
+
+ // _CRT (Critical Temperature)
+ //
+ // This object, when defined under a thermal zone, returns the critical temperature at which OSPM must shutdown the system.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the critical temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_CRT, 0, Serialized)
+ {
+ Return(\_SB.IETM.CTOK(WWCT))
+ }
+
+ // _HOT (Hot Temperature)
+ //
+ // This optional object, when defined under a thermal zone, returns the critical temperature
+ // at which OSPM may choose to transition the system into the S4 sleeping state.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // The return value is an integer that represents the critical sleep threshold tenths of degrees Kelvin.
+ //
+ Method(_HOT,0,Serialized)
+ {
+ Return(\_SB.IETM.CTOK(WWHT))
+ }
+
+ // _PSV (Passive)
+ //
+ // This optional object, if present under a thermal zone, evaluates to the temperature
+ // at which OSPM must activate passive cooling policy.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the passive cooling temperature threshold in tenths of degrees Kelvin
+ //
+ Method(_PSV, 0, Serialized)
+ {
+ If(CTYP)
+ {
+ Return(\_SB.IETM.CTOK(WWAT)) // Active Cooling Policy
+ } Else {
+ Return(\_SB.IETM.CTOK(WWPT)) // Passive Cooling Policy
+ }
+ }
+
+} // End Scope(\_SB.PCI0.WWAN)
diff --git a/ReferenceCode/AcpiTables/Dptf/AcpiTables/WWANParticipant.asl b/ReferenceCode/AcpiTables/Dptf/AcpiTables/WWANParticipant.asl
new file mode 100644
index 0000000..600939a
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/AcpiTables/WWANParticipant.asl
@@ -0,0 +1,104 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ WWANParticipant.asl
+
+Abstract:
+
+ Intel ACPI Reference Code for Dynamic Platform & Thermal Framework
+
+--*/
+
+Scope(\_SB.PCI0)
+{
+
+ Device(WWAN) // WWAN temperature sensor
+ {
+ Name(_HID, EISAID("INT3408"))
+ Name(_UID, 1)
+ Name(_STR, Unicode("Intel DPTF WWAN Participant"))
+ Name(PTYP, 0x0F)
+
+
+ // _STA (Status)
+ //
+ // This object returns the current status of a device.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing a device status bitmap:
+ // Bit 0 - Set if the device is present.
+ // Bit 1 - Set if the device is enabled and decoding its resources.
+ // Bit 2 - Set if the device should be shown in the UI.
+ // Bit 3 - Set if the device is functioning properly (cleared if device failed its diagnostics).
+ // Bit 4 - Set if the battery is present.
+ // Bits 5-31 - Reserved (must be cleared).
+ //
+ Method(_STA)
+ {
+ If (LEqual(WAND,1)){
+ Return(0x0F)
+ } Else {
+ Return(0x00)
+ }
+ }
+
+ // Thermal Sensor Hysteresis, 2 degrees
+ Name(GTSH, 20)
+
+ Name(LSTM,0) // Last temperature reported
+
+ // _DTI (Device Temperature Indication)
+ //
+ // Conveys the temperature of a device's internal temperature sensor to the platform when a temperature trip point
+ // is crossed or when a meaningful temperature change occurs.
+ //
+ // Arguments: (1)
+ // Arg0 - An Integer containing the current value of the temperature sensor (in tenths Kelvin)
+ // Return Value:
+ // None
+ //
+ Method(_DTI, 1)
+ {
+ Store(Arg0,LSTM)
+ Notify(WWAN, 0x91) // notify the participant of a trip point change event
+ }
+
+ // _NTT (Notification Temperature Threshold)
+ //
+ // Returns the temperature change threshold for devices containing native temperature sensors to cause
+ // evaluation of the _DTI object
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // An Integer containing the temperature threshold in tenths of degrees Kelvin.
+ //
+ Method(_NTT, 0)
+ {
+ Return(2782) // 5 degree Celcius, this could be a platform policy with setup item
+ }
+
+ } // end of Device(WWAN)
+} // end of Scope(\_SB.PCI0)
+
diff --git a/ReferenceCode/AcpiTables/Dptf/Dptf.cif b/ReferenceCode/AcpiTables/Dptf/Dptf.cif
new file mode 100644
index 0000000..6bdc49c
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/Dptf.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "Intel DPTF"
+ category = eModule
+ LocalRoot = "ReferenceCode\AcpiTables\Dptf\"
+ RefName = "Dptf"
+[files]
+"Dptf.sdl"
+"ReleaseNotes.chm"
+[parts]
+"DptfDxe"
+"DptfAcpiTables"
+"DptfGuidLib"
+<endComponent>
diff --git a/ReferenceCode/AcpiTables/Dptf/Dptf.sdl b/ReferenceCode/AcpiTables/Dptf/Dptf.sdl
new file mode 100644
index 0000000..9786c10
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/Dptf.sdl
@@ -0,0 +1,26 @@
+TOKEN
+ Name = Dptf_SUPPORT
+ Value = 1
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+ Help = "Main switch to enable Dptf support in Project"
+End
+
+PATH
+ Name = "INTEL_DPTF_DIR"
+ Help = "Intel DPTF source directory"
+End
+
+ELINK
+ Name = "DPTF_INCLUDES"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "/I$(INTEL_DPTF_DIR)"
+ Parent = "DPTF_INCLUDES"
+ InvokeOrder = AfterParent
+End \ No newline at end of file
diff --git a/ReferenceCode/AcpiTables/Dptf/Dxe/Dptf.c b/ReferenceCode/AcpiTables/Dptf/Dxe/Dptf.c
new file mode 100644
index 0000000..caee0a7
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/Dxe/Dptf.c
@@ -0,0 +1,440 @@
+/** @file
+ This DXE driver configures and supports Dptf.
+
+@copyright
+ Copyright (c) 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "Dptf.h"
+
+ACPI_PLATFORM_POLICY_PROTOCOL *mAcpiPlatformPolicyProtocol;
+
+EFI_RUNTIME_SERVICES *gRT;
+
+///
+/// Driver entry point
+///
+EFI_DRIVER_ENTRY_POINT (InitializeDptf)
+
+EFI_STATUS
+InitializeDptf (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+/**
+@brief
+ This procedure does all the DPTF initialization and loads the ACPI tables.
+
+ @param[in] ImageHandle - The firmware allocated handle to the Driver Image
+ @param[in] SystemTable - Pointer to the EFI System Table
+
+ @retval EFI_SUCCESS - The driver installed/initialized correctly.
+**/
+{
+ EFI_STATUS Status;
+
+ gRT = SystemTable->RuntimeServices;
+
+ ///
+ /// Initialize the EFI Runtime Library
+ ///
+ DxeInitializeDriverLib (ImageHandle, SystemTable);
+
+ ///
+ /// S3 boot script
+ ///
+ INITIALIZE_SCRIPT (ImageHandle, SystemTable);
+
+ ///
+ /// Locate platform configuration information and copy it to a global variable.
+ ///
+ Status = gBS->LocateProtocol (
+ &gAcpiPlatformPolicyProtocolGuid,
+ NULL,
+ (VOID**) &mAcpiPlatformPolicyProtocol
+ );
+ if (EFI_ERROR(Status)) {
+ DEBUG ((EFI_D_ERROR, "No ACPI Platform Policy Protocol available."));
+ } else {
+ DEBUG ((EFI_D_INFO, "ACPI Platform Policy Protocol is loaded."));
+ }
+ ASSERT_EFI_ERROR(Status);
+
+ ///
+ /// Check if Dptf is enabled and load the ACPI SSDT.
+ ///
+ if (mAcpiPlatformPolicyProtocol->EnableDptf == 1) {
+ ///
+ /// Load the SSDT ACPI Tables.
+ ///
+ switch (mAcpiPlatformPolicyProtocol->BoardId) {
+ case 0x30: // BoardId for Ffrd
+ LoadAcpiTablesFfrd ();
+ break;
+ default:
+ LoadAcpiTables ();
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+VOID
+LoadAcpiTables(
+ VOID
+ )
+/**
+@brief
+ This procedure loads the ACPI SSDT tables.
+
+ @param[in] None
+
+ @retval None
+
+**/
+{
+ EFI_STATUS Status;
+ EFI_HANDLE *HandleBuffer;
+ UINTN NumberOfHandles;
+ UINTN Index;
+ EFI_FIRMWARE_VOLUME_PROTOCOL *FwVol;
+ EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
+ INTN Instance;
+ EFI_ACPI_COMMON_HEADER *Table;
+ UINTN Size;
+ EFI_FV_FILETYPE FileType;
+ EFI_FV_FILE_ATTRIBUTES Attributes;
+ UINT32 FvStatus;
+ EFI_ACPI_DESCRIPTION_HEADER *TableHeader;
+ UINTN TableHandle;
+ EFI_ACPI_TABLE_VERSION Version;
+ BOOLEAN LoadTable;
+
+ FwVol = NULL;
+ Table = NULL;
+
+ ///
+ /// Locate FV protocol.
+ ///
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiFirmwareVolumeProtocolGuid,
+ NULL,
+ &NumberOfHandles,
+ &HandleBuffer
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Look for FV with ACPI storage file
+ ///
+ for (Index = 0; Index < NumberOfHandles; Index++) {
+
+ ///
+ /// Get the protocol on this handle
+ /// This should not fail because of LocateHandleBuffer
+ ///
+ Status = gBS->HandleProtocol (
+ HandleBuffer[Index],
+ &gEfiFirmwareVolumeProtocolGuid,
+ (VOID **) &FwVol
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ if ((Status == EFI_SUCCESS) && (FwVol != NULL)) {
+ ///
+ /// See if it has the ACPI storage file
+ ///
+ Size = 0;
+ FvStatus = 0;
+ Status = FwVol->ReadFile (
+ FwVol,
+ &gDptfAcpiTableStorageGuid,
+ NULL,
+ &Size,
+ &FileType,
+ &Attributes,
+ &FvStatus
+ );
+
+ ///
+ /// If we found it, then we are done
+ ///
+ if (Status == EFI_SUCCESS) {
+ break;
+ }
+ }
+ }
+
+ ///
+ /// Our exit status is determined by the success of the previous operations
+ /// If the protocol was found, Instance already points to it.
+ ///
+ /// Free any allocated buffers
+ ///
+ FreePool (HandleBuffer);
+
+ ///
+ /// Sanity check that we found our data file
+ ///
+ ASSERT (FwVol);
+ if (FwVol == NULL) {
+ return;
+ }
+
+ ///
+ /// By default, a table belongs in all ACPI table versions published.
+ ///
+ Version = EFI_ACPI_TABLE_VERSION_1_0B | EFI_ACPI_TABLE_VERSION_2_0 | EFI_ACPI_TABLE_VERSION_3_0;
+
+ ///
+ /// Find the Table protocol
+ ///
+ Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **) &AcpiTable);
+
+ ///
+ /// Read tables from the storage file.
+ ///
+ Instance = 0;
+
+ while (Status == EFI_SUCCESS) {
+ ///
+ /// Read the ACPI tables
+ ///
+ Status = FwVol->ReadSection (
+ FwVol,
+ &gDptfAcpiTableStorageGuid,
+ EFI_SECTION_RAW,
+ Instance,
+ (VOID **) &Table,
+ &Size,
+ &FvStatus
+ );
+
+ if (!EFI_ERROR (Status)) {
+
+ LoadTable = FALSE;
+ TableHeader = (EFI_ACPI_DESCRIPTION_HEADER *) Table;
+
+ switch (((EFI_ACPI_DESCRIPTION_HEADER*) TableHeader)->OemTableId) {
+
+ case EFI_SIGNATURE_64 ('D', 'p', 't', 'f', 'T', 'a', 'b', 'l'):
+ ///
+ /// This is Dptf SSDT. Dptf should be enabled if we reach here so load the table.
+ ///
+ LoadTable = TRUE;
+ DEBUG ((EFI_D_INFO, "Found Dptf SSDT signature."));
+ break;
+
+ default:
+ break;
+ }
+
+ ///
+ /// Add the table
+ ///
+ if (LoadTable) {
+ TableHandle = 0;
+ Status = AcpiTable->InstallAcpiTable (
+ AcpiTable,
+ Table,
+ Table->Length,
+ &TableHandle
+ );
+ }
+
+ ///
+ /// Increment the instance
+ ///
+ Instance++;
+ Table = NULL;
+ }
+ }
+}
+
+VOID
+LoadAcpiTablesFfrd(
+ VOID
+ )
+/**
+@brief
+ This procedure loads the ACPI SSDT tables.
+
+ @param[in] None
+
+ @retval None
+
+**/
+{
+ EFI_STATUS Status;
+ EFI_HANDLE *HandleBuffer;
+ UINTN NumberOfHandles;
+ UINTN Index;
+ EFI_FIRMWARE_VOLUME_PROTOCOL *FwVol;
+ EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
+ INTN Instance;
+ EFI_ACPI_COMMON_HEADER *Table;
+ UINTN Size;
+ EFI_FV_FILETYPE FileType;
+ EFI_FV_FILE_ATTRIBUTES Attributes;
+ UINT32 FvStatus;
+ EFI_ACPI_DESCRIPTION_HEADER *TableHeader;
+ UINTN TableHandle;
+ EFI_ACPI_TABLE_VERSION Version;
+ BOOLEAN LoadTable;
+
+ FwVol = NULL;
+ Table = NULL;
+
+ ///
+ /// Locate FV protocol.
+ ///
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiFirmwareVolumeProtocolGuid,
+ NULL,
+ &NumberOfHandles,
+ &HandleBuffer
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Look for FV with ACPI storage file
+ ///
+ for (Index = 0; Index < NumberOfHandles; Index++) {
+
+ ///
+ /// Get the protocol on this handle
+ /// This should not fail because of LocateHandleBuffer
+ ///
+ Status = gBS->HandleProtocol (
+ HandleBuffer[Index],
+ &gEfiFirmwareVolumeProtocolGuid,
+ (VOID **) &FwVol
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ if ((Status == EFI_SUCCESS) && (FwVol != NULL)) {
+ ///
+ /// See if it has the ACPI storage file
+ ///
+ Size = 0;
+ FvStatus = 0;
+ Status = FwVol->ReadFile (
+ FwVol,
+ &gDptfAcpiTableStorageGuidFfrd,
+ NULL,
+ &Size,
+ &FileType,
+ &Attributes,
+ &FvStatus
+ );
+
+ ///
+ /// If we found it, then we are done
+ ///
+ if (Status == EFI_SUCCESS) {
+ break;
+ }
+ }
+ }
+
+ ///
+ /// Our exit status is determined by the success of the previous operations
+ /// If the protocol was found, Instance already points to it.
+ ///
+ /// Free any allocated buffers
+ ///
+ FreePool (HandleBuffer);
+
+ ///
+ /// Sanity check that we found our data file
+ ///
+ ASSERT (FwVol);
+ if (FwVol == NULL) {
+ return;
+ }
+
+ ///
+ /// By default, a table belongs in all ACPI table versions published.
+ ///
+ Version = EFI_ACPI_TABLE_VERSION_1_0B | EFI_ACPI_TABLE_VERSION_2_0 | EFI_ACPI_TABLE_VERSION_3_0;
+
+ ///
+ /// Find the Table protocol
+ ///
+ Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **) &AcpiTable);
+
+ ///
+ /// Read tables from the storage file.
+ ///
+ Instance = 0;
+
+ while (Status == EFI_SUCCESS) {
+ ///
+ /// Read the ACPI tables
+ ///
+ Status = FwVol->ReadSection (
+ FwVol,
+ &gDptfAcpiTableStorageGuidFfrd,
+ EFI_SECTION_RAW,
+ Instance,
+ (VOID **) &Table,
+ &Size,
+ &FvStatus
+ );
+
+ if (!EFI_ERROR (Status)) {
+
+ LoadTable = FALSE;
+ TableHeader = (EFI_ACPI_DESCRIPTION_HEADER *) Table;
+
+ switch (((EFI_ACPI_DESCRIPTION_HEADER*) TableHeader)->OemTableId) {
+
+ case EFI_SIGNATURE_64 ('D', 'p', 't', 'f', 'F', 'f', 'r', 'd'):
+ ///
+ /// This is Dptf SSDT. Dptf should be enabled if we reach here so load the table.
+ ///
+ LoadTable = TRUE;
+ DEBUG ((EFI_D_INFO, "Found Dptf SSDT signature."));
+ break;
+
+ default:
+ break;
+ }
+
+ ///
+ /// Add the table
+ ///
+ if (LoadTable) {
+ TableHandle = 0;
+ Status = AcpiTable->InstallAcpiTable (
+ AcpiTable,
+ Table,
+ Table->Length,
+ &TableHandle
+ );
+ }
+
+ ///
+ /// Increment the instance
+ ///
+ Instance++;
+ Table = NULL;
+ }
+ }
+}
diff --git a/ReferenceCode/AcpiTables/Dptf/Dxe/Dptf.dxs b/ReferenceCode/AcpiTables/Dptf/Dxe/Dptf.dxs
new file mode 100644
index 0000000..3804c02
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/Dxe/Dptf.dxs
@@ -0,0 +1,33 @@
+/** @file
+ Dependency expression source file.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+
+#include "EfiDepex.h"
+#include EFI_PROTOCOL_DEPENDENCY (CpuIo)
+#include EFI_PROTOCOL_DEPENDENCY (AcpiSupport)
+#include EFI_PROTOCOL_DEPENDENCY (AcpiPlatformPolicy)
+
+DEPENDENCY_START
+ EFI_CPU_IO_PROTOCOL_GUID AND
+ EFI_ACPI_SUPPORT_GUID AND
+ ACPI_PLATFORM_POLICY_PROTOCOL_GUID
+DEPENDENCY_END
diff --git a/ReferenceCode/AcpiTables/Dptf/Dxe/Dptf.h b/ReferenceCode/AcpiTables/Dptf/Dxe/Dptf.h
new file mode 100644
index 0000000..8f66020
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/Dxe/Dptf.h
@@ -0,0 +1,196 @@
+/** @file
+ Header file for the Dptf driver.
+
+@copyright
+ Copyright (c) 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+#ifndef _DPTF_H_
+#define _DPTF_H_
+
+#include "EdkIIGlueBase.h"
+#include "EdkIIGlueDxe.h"
+#include "EdkIIGluePcd.h"
+#include "Acpi.h"
+#include "CpuIA32.h"
+#include "EfiScriptLib.h"
+#include "SaAccess.h"
+
+///
+/// Consumed protocols
+///
+#include EFI_PROTOCOL_DEPENDENCY (AcpiTable)
+#include EFI_PROTOCOL_DEPENDENCY (FirmwareVolume)
+#include EFI_PROTOCOL_CONSUMER (PciRootBridgeIo)
+#include EFI_PROTOCOL_DEFINITION (AcpiPlatformPolicy)
+
+#ifndef DPTF_BASE_ADDRESS
+#define DPTF_BASE_ADDRESS 0xFED98000
+#endif
+#ifndef DPTF_LENGTH
+#define DPTF_LENGTH 0x8000
+#endif
+
+///
+/// SSDT data storage file
+///
+#include "DptfAcpiTableStorage.h"
+
+///
+/// AML parsing definitions
+///
+#define AML_METHOD_OP 0x14
+
+///
+/// MSR definitions
+///
+#define MSR_PLATFORM_INFO 0xCE
+ #define CONFIG_TDP_NUM_LEVELS_OFFSET 33
+ #define CONFIG_TDP_NUM_LEVELS_MASK (0x3 << 1) // Bits 34:33
+ #define LOW_POWER_MODE_OFFSET 32
+ #define LOW_POWER_MODE_MASK 0x1
+
+///
+/// UINT64 workaround
+///
+/// The MS compiler doesn't handle QWORDs very well. I'm breaking
+/// them into DWORDs to circumvent the problems. Converting back
+/// shouldn't be a big deal.
+///
+#pragma pack(1)
+typedef union _MSR_REGISTER {
+ UINT64 Qword;
+
+ struct _DWORDS {
+ UINT32 Low;
+ UINT32 High;
+ } Dwords;
+
+ struct _BYTES {
+ UINT8 FirstByte;
+ UINT8 SecondByte;
+ UINT8 ThirdByte;
+ UINT8 FouthByte;
+ UINT8 FifthByte;
+ UINT8 SixthByte;
+ UINT8 SeventhByte;
+ UINT8 EighthByte;
+ } Bytes;
+
+} MSR_REGISTER;
+#pragma pack()
+
+///
+/// register definitions
+///
+#define MCHBAR (0x48)
+#define MCHBAR_MCHBAR_MASK 0x7fffff8000
+
+#define TMBAR (0x10)
+
+#ifndef BIT63
+#define BIT0 0x0001
+#define BIT1 0x0002
+#define BIT2 0x0004
+#define BIT3 0x0008
+#define BIT4 0x0010
+#define BIT5 0x0020
+#define BIT6 0x0040
+#define BIT7 0x0080
+#define BIT8 0x0100
+#define BIT9 0x0200
+#define BIT10 0x0400
+#define BIT11 0x0800
+#define BIT12 0x1000
+#define BIT13 0x2000
+#define BIT14 0x4000
+#define BIT15 0x8000
+#define BIT16 0x00010000
+#define BIT17 0x00020000
+#define BIT18 0x00040000
+#define BIT19 0x00080000
+#define BIT20 0x00100000
+#define BIT21 0x00200000
+#define BIT22 0x00400000
+#define BIT23 0x00800000
+#define BIT24 0x01000000
+#define BIT25 0x02000000
+#define BIT26 0x04000000
+#define BIT27 0x08000000
+#define BIT28 0x10000000
+#define BIT29 0x20000000
+#define BIT30 0x40000000
+#define BIT31 0x80000000
+#define BIT32 0x100000000
+#define BIT33 0x200000000
+#define BIT34 0x400000000
+#define BIT35 0x800000000
+#define BIT36 0x1000000000
+#define BIT37 0x2000000000
+#define BIT38 0x4000000000
+#define BIT39 0x8000000000
+#define BIT40 0x10000000000
+#define BIT41 0x20000000000
+#define BIT42 0x40000000000
+#define BIT43 0x80000000000
+#define BIT44 0x100000000000
+#define BIT45 0x200000000000
+#define BIT46 0x400000000000
+#define BIT47 0x800000000000
+#define BIT48 0x1000000000000
+#define BIT49 0x2000000000000
+#define BIT50 0x4000000000000
+#define BIT51 0x8000000000000
+#define BIT52 0x10000000000000
+#define BIT53 0x20000000000000
+#define BIT54 0x40000000000000
+#define BIT55 0x80000000000000
+#define BIT56 0x100000000000000
+#define BIT57 0x200000000000000
+#define BIT58 0x400000000000000
+#define BIT59 0x800000000000000
+#define BIT60 0x1000000000000000
+#define BIT61 0x2000000000000000
+#define BIT62 0x4000000000000000
+#define BIT63 0x8000000000000000
+#endif
+
+#define MmPciExpressAddress(Segment, Bus, Device, Function, Register) \
+ ( (UINTN) (PciRead32 (PCI_LIB_ADDRESS (0,0,0,0x60)) & 0xFC000000) + \
+ (UINTN) (Bus << 20) + \
+ (UINTN) (Device << 15) + \
+ (UINTN) (Function << 12) + \
+ (UINTN) (Register) \
+ )
+
+EFI_STATUS
+InitializeDptf (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ );
+
+VOID
+LoadAcpiTables(
+ VOID
+ );
+
+VOID
+LoadAcpiTablesFfrd(
+ VOID
+ );
+
+#endif
diff --git a/ReferenceCode/AcpiTables/Dptf/Dxe/Dptf.inf b/ReferenceCode/AcpiTables/Dptf/Dxe/Dptf.inf
new file mode 100644
index 0000000..1de1ee6
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/Dxe/Dptf.inf
@@ -0,0 +1,83 @@
+## @file
+# Component description file for Dptf module
+#
+#@copyright
+# Copyright (c) 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains an 'Intel Peripheral Driver' and uniquely
+# identified as "Intel Reference Module" and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+
+
+[defines]
+BASE_NAME = Dptf
+FILE_GUID = 918ABA30-3D8D-4bb5-B849-45CC4FC7DE7C
+COMPONENT_TYPE = RT_DRIVER
+
+[sources.common]
+ Dptf.h
+ Dptf.c
+
+[includes.common]
+ $(EFI_SOURCE)/$(PROJECT_ACPI_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_ACPI_ROOT)/Dptf
+ $(EFI_SOURCE)/$(PROJECT_ACPI_ROOT)/Dptf/Guid/AcpiTableStorage
+ .
+ $(EDK_SOURCE)/Sample/Chipset/PcCompatible
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Core/Dxe/ArchProtocol/Cpu
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Framework
+ $(EFI_SOURCE)/Include
+ $(EFI_SOURCE)/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include/Pcd
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include/Library
+ $(EDK_SOURCE)/Foundation/Cpu/Pentium/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Include
+
+[libraries.common]
+ EdkIIGlueDxeReportStatusCodeLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkProtocolLib
+ EfiProtocolLib
+ EfiDriverLib
+ ArchProtocolLib
+ EdkFrameworkProtocolLib
+ EdkIIGlueBasePciExpressLib
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiLib
+ EdkIIGlueBaseLib
+ EfiScriptLib
+ AcpiProtocolLib
+ DptfGuidLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = InitializeDptf
+ DPX_SOURCE = Dptf.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D"__EDKII_GLUE_MODULE_ENTRY_POINT__=InitializeDptf" \
+ -D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__
diff --git a/ReferenceCode/AcpiTables/Dptf/Dxe/DptfDxe.cif b/ReferenceCode/AcpiTables/Dptf/Dxe/DptfDxe.cif
new file mode 100644
index 0000000..78cbeda
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/Dxe/DptfDxe.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "DptfDxe"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\AcpiTables\Dptf\Dxe\"
+ RefName = "DptfDxe"
+[files]
+"DptfDxe.sdl"
+"DptfDxe.mak"
+"Dptf.c"
+"Dptf.dxs"
+"Dptf.h"
+"Dptf.inf"
+<endComponent>
diff --git a/ReferenceCode/AcpiTables/Dptf/Dxe/DptfDxe.mak b/ReferenceCode/AcpiTables/Dptf/Dxe/DptfDxe.mak
new file mode 100644
index 0000000..1a0ac0a
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/Dxe/DptfDxe.mak
@@ -0,0 +1,106 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2012, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/DPTF/DptfDxe/DptfDxe.mak 2 9/26/12 2:00a Victortu $
+#
+# $Revision: 2 $
+#
+# $Date: 9/26/12 2:00a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/DPTF/DptfDxe/DptfDxe.mak $
+#
+# 2 9/26/12 2:00a Victortu
+#
+# 1 4/24/12 9:25a Victortu
+# Intel DPTF initialization.
+#
+#*************************************************************************
+#<AMI_FHDR_START>
+#
+# Name: DptfDxe.mak
+#
+# Description: MAke file to build Intel DPTF components
+#
+#<AMI_FHDR_END>
+#*************************************************************************
+EDK : DptfDxe
+
+DptfDxe : $(BUILD_DIR)\DptfDxe.mak DptfDxeBin
+
+DptfDxe_OBJECTS = \
+$(BUILD_DIR)\$(INTEL_DPTF_DXE_DIR)\Dptf.obj
+
+$(BUILD_DIR)\DptfDxe.mak : $(INTEL_DPTF_DXE_DIR)\$(@B).cif $(INTEL_DPTF_DXE_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(INTEL_DPTF_DXE_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+DptfDxe_LIBS =\
+ $(EDKPROTOCOLLIB)\
+ $(EFIPROTOCOLLIB)\
+ $(ARCHPROTOCOLLIB)\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(EFISCRIPTLIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EdkIIGlueBasePciExpressLib_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueUefiLib_LIB)\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueDxeServicesTableLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueDxeHobLib_LIB)\
+ $(EFIDRIVERLIB)\
+ $(AcpiProtocolLib_LIB)\
+ $(DptfGuidLib_LIB)\
+
+DptfDxe_INCLUDES= $(EDK_INCLUDES)\
+ $(IndustryStandard_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(DPTF_INCLUDES)\
+ /I ReferenceCode\AcpiTables\
+ /I$(ArchProtocolLib_DIR)\Cpu\
+ /I$(INTEL_SYSTEM_AGENT_DIR)\Include\
+
+DptfDxeBin: $(DptfDxe_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\DptfDxe.mak all \
+ NAME=DptfDxe\
+ MAKEFILE=$(BUILD_DIR)\DptfDxe.mak \
+ "MY_INCLUDES=$(DptfDxe_INCLUDES)"\
+ GUID=918ABA30-3D8D-4bb5-B849-45CC4FC7DE7C\
+ ENTRY_POINT=InitializeDptf \
+ TYPE=RT_DRIVER\
+ "OBJECTS=$(DptfDxe_OBJECTS)"\
+ DEPEX1=$(INTEL_DPTF_DXE_DIR)\Dptf.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX\
+ COMPRESS=1
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2012, 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/ReferenceCode/AcpiTables/Dptf/Dxe/DptfDxe.sdl b/ReferenceCode/AcpiTables/Dptf/Dxe/DptfDxe.sdl
new file mode 100644
index 0000000..03960e9
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/Dxe/DptfDxe.sdl
@@ -0,0 +1,30 @@
+TOKEN
+ Name = DptfDxe_SUPPORT
+ Value = 1
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable DptfDxe support in Project"
+End
+
+MODULE
+ Help = "Includes DptfDxe.mak to Project"
+ File = "DptfDxe.mak"
+End
+
+PATH
+ Name = "INTEL_DPTF_DXE_DIR"
+End
+
+ELINK
+ Name = "/I$(INTEL_DPTF_DXE_DIR)"
+ Parent = "DPTF_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\DptfDxe.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/AcpiTables/Dptf/Guid/AcpiTableStorage/DptfAcpiTableStorage.c b/ReferenceCode/AcpiTables/Dptf/Guid/AcpiTableStorage/DptfAcpiTableStorage.c
new file mode 100644
index 0000000..35552e2
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/Guid/AcpiTableStorage/DptfAcpiTableStorage.c
@@ -0,0 +1,34 @@
+/** @file
+ The GUID definition for Dptf ACPI table storage file name
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+#include "EdkIIGlueDxe.h"
+#include "DptfAcpiTableStorage.h"
+
+///
+/// Protocol GUID definition
+///
+EFI_GUID gDptfAcpiTableStorageGuid = DPTF_ACPI_TABLE_STORAGE_GUID;
+EFI_GUID gDptfAcpiTableStorageGuidFfrd = DPTF_ACPI_TABLE_STORAGE_GUID_FFRD;
+
+///
+/// Protocol description string
+///
+EFI_GUID_STRING (&gDptfAcpiTableStorageGuid, "Dynamic Platform Thermal Framework ACPI Table Storage File Name", "Dynamic Platform Thermal Framework ACPI Table Storage file name GUID");
diff --git a/ReferenceCode/AcpiTables/Dptf/Guid/AcpiTableStorage/DptfAcpiTableStorage.h b/ReferenceCode/AcpiTables/Dptf/Guid/AcpiTableStorage/DptfAcpiTableStorage.h
new file mode 100644
index 0000000..a5330a0
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/Guid/AcpiTableStorage/DptfAcpiTableStorage.h
@@ -0,0 +1,35 @@
+/** @file
+ GUID definition for the Dptf ACPI table storage file name
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+#ifndef _DPTF_ACPI_TABLE_STORAGE_H_
+#define _DPTF_ACPI_TABLE_STORAGE_H_
+
+#define DPTF_ACPI_TABLE_STORAGE_GUID \
+ { 0xea139578, 0xfea0, 0x4dd2, 0x91, 0xb5, 0x69, 0x53, 0x81, 0x9e, 0xf1, 0xe4 }
+
+extern EFI_GUID gDptfAcpiTableStorageGuid;
+
+#define DPTF_ACPI_TABLE_STORAGE_GUID_FFRD \
+ { 0x2820908b, 0x87f6, 0x446b, 0xa1, 0x0, 0x74, 0xee, 0xe3, 0x6e, 0x29, 0x18 }
+
+extern EFI_GUID gDptfAcpiTableStorageGuidFfrd;
+
+#endif
diff --git a/ReferenceCode/AcpiTables/Dptf/Guid/DptfGuidLib.cif b/ReferenceCode/AcpiTables/Dptf/Guid/DptfGuidLib.cif
new file mode 100644
index 0000000..f888fb6
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/Guid/DptfGuidLib.cif
@@ -0,0 +1,12 @@
+<component>
+ name = "DptfGuidLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\AcpiTables\Dptf\Guid\"
+ RefName = "DptfGuidLib"
+[files]
+"DptfGuidLib.sdl"
+"DptfGuidLib.mak"
+"DptfGuidLib.inf"
+"AcpiTableStorage\DptfAcpiTableStorage.c"
+"AcpiTableStorage\DptfAcpiTableStorage.h"
+<endComponent>
diff --git a/ReferenceCode/AcpiTables/Dptf/Guid/DptfGuidLib.inf b/ReferenceCode/AcpiTables/Dptf/Guid/DptfGuidLib.inf
new file mode 100644
index 0000000..7d800c8
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/Guid/DptfGuidLib.inf
@@ -0,0 +1,55 @@
+## @file
+# Component description file.
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains an 'Intel Peripheral Driver' and uniquely
+# identified as "Intel Reference Module" and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+
+[defines]
+BASE_NAME = DptfGuidLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ AcpiTableStorage/DptfAcpiTableStorage.c
+ AcpiTableStorage/DptfAcpiTableStorage.h
+
+[includes.common]
+ .
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EFI_SOURCE)/$(PROJECT_ACPI_ROOT)-Dptf
+#
+# Edk II Glue Library, some hearder are included by R9 header so have to include
+#
+
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Framework
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[nmake.common]
diff --git a/ReferenceCode/AcpiTables/Dptf/Guid/DptfGuidLib.mak b/ReferenceCode/AcpiTables/Dptf/Guid/DptfGuidLib.mak
new file mode 100644
index 0000000..f1a7a22
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/Guid/DptfGuidLib.mak
@@ -0,0 +1,69 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2012, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+
+# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/DPTF/DptfGuidLib/DptfGuidLib.mak 1 4/24/12 9:27a Victortu $
+#
+# $Revision: 1 $
+#
+# $Date: 4/24/12 9:27a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/DPTF/DptfGuidLib/DptfGuidLib.mak $
+#
+# 1 4/24/12 9:27a Victortu
+#
+#*************************************************************************
+#<AMI_FHDR_START>
+#
+# Name: DptfGuidLib.mak
+#
+# Description: MAke file to build Intel DPTF GuidLib components
+#
+#<AMI_FHDR_END>
+#*************************************************************************
+all : DptfGuidLib
+
+$(DptfGuidLib_LIB) : DptfGuidLib
+
+DptfGuidLib : $(BUILD_DIR)\DptfGuidLib.mak DptfGuidLibBin
+
+$(BUILD_DIR)\DptfGuidLib.mak : $(INTEL_DPTF_GUIDLIB_DIR)\$(@B).cif $(INTEL_DPTF_GUIDLIB_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(INTEL_DPTF_GUIDLIB_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+DptfGuidLib_INCLUDES=\
+ $(EDK_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)
+
+DptfGuidLibBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\DptfGuidLib.mak all\
+ "MY_INCLUDES=$(DptfGuidLib_INCLUDES)" \
+ TYPE=LIBRARY
+
+#**********************************************************************
+#**********************************************************************
+#** **
+#** (C)Copyright 1985-2012, 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/ReferenceCode/AcpiTables/Dptf/Guid/DptfGuidLib.sdl b/ReferenceCode/AcpiTables/Dptf/Guid/DptfGuidLib.sdl
new file mode 100644
index 0000000..ffd5a8b
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/Guid/DptfGuidLib.sdl
@@ -0,0 +1,37 @@
+TOKEN
+ Name = DptfGuidLib_SUPPORT
+ Value = 1
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable DptfGuidLib support in Project"
+End
+
+MODULE
+ Help = "Includes DptfGuidLib.mak to Project"
+ File = "DptfGuidLib.mak"
+End
+
+PATH
+ Name = "INTEL_DPTF_GUIDLIB_DIR"
+End
+
+TOKEN
+ Name = "DptfGuidLib_LIB"
+ Value = "$(BUILD_DIR)\DptfGuidLib.lib"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+ELINK
+ Name = "/I$(INTEL_DPTF_GUIDLIB_DIR)"
+ Parent = "DPTF_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(INTEL_DPTF_GUIDLIB_DIR)\AcpiTableStorage"
+ Parent = "DPTF_INCLUDES"
+ InvokeOrder = AfterParent
+End \ No newline at end of file
diff --git a/ReferenceCode/AcpiTables/Dptf/ReleaseNotes.chm b/ReferenceCode/AcpiTables/Dptf/ReleaseNotes.chm
new file mode 100644
index 0000000..20ed9ac
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dptf/ReleaseNotes.chm
Binary files differ
diff --git a/ReferenceCode/AcpiTables/Dsdt/98_LINK.ASL b/ReferenceCode/AcpiTables/Dsdt/98_LINK.ASL
new file mode 100644
index 0000000..b4b67be
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dsdt/98_LINK.ASL
@@ -0,0 +1,628 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Haswell *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+
+
+
+// Use this information when determining the Possible IRQs that can be
+// used in a given system.
+//
+// The following IRQs are always in use by legacy devices:
+// 0 = System Timer
+// 2 = 8259 PIC
+// 8 = RTC
+// 9 = SCI Interrupt (It may be used, we choose not to)
+// 13 = Co-processor Error
+//
+// The following may be in use by legacy devices:
+// 1 = If using PS/2 Keyboard
+// 3 = If COMx Port Enabled and IRQ = 3
+// 4 = If COMx Port Enabled and IRQ = 4
+// 5 = If LPT Port Enabled and IRQ = 5
+// 6 = If FDC Enabled
+// 7 = If LPT Port Enabled and IRQ = 7
+// 12 = If using PS/2 Mouse
+// 14 = Primary IDE (If populated and in Compatibility Mode)
+// 15 = Secondary IDE (If populated and in Compatibility Mode)
+//
+// The following will never be in use by legacy devices:
+// 10 = Assign to PARC, PCRC, PERC, PGRC
+// 11 = Assign to PBRC, PDRC, PFRC, PHRC
+
+Device(LNKA) // PARC Routing Resource
+{
+ Name(_HID,EISAID("PNP0C0F")) // PCI Interrupt Link Device
+
+ Name(_UID,1) // Unique to other Link Devices
+
+ // Disable the PCI IRQ.
+
+ Method(_DIS,0,Serialized)
+ {
+ Or(PARC,0x80,PARC)
+ }
+
+ // Possible IRQ Resource Setting.
+
+ Method (_PRS, 0, Serialized)
+ {
+ return (PRSA)
+ }
+
+ // Current IRQ Resource Setting.
+
+ Method(_CRS,0,Serialized)
+ {
+ Name(RTLA,ResourceTemplate()
+ {
+ IRQ(Level,ActiveLow,Shared) {}
+ })
+
+ // Point to specific byte.
+
+ CreateWordField(RTLA,1,IRQ0)
+
+ // Zero out IRQ mask bits 0-15
+
+ Store(Zero,IRQ0)
+
+ ShiftLeft(1,And(PARC,0x0F),IRQ0)
+
+ Return(RTLA)
+ }
+
+ // Set IRQ Resource Setting.
+
+ Method(_SRS,1,Serialized)
+ {
+ // Point to the specific byte passed in
+
+ CreateWordField(Arg0,1,IRQ0)
+
+ // Determine the IRQ bit to set and store it
+
+ FindSetRightBit(IRQ0,Local0)
+ Decrement(Local0)
+ Store(Local0,PARC)
+ }
+
+ // PCI IRQ Status.
+
+ Method(_STA,0,Serialized)
+ {
+ If(And(PARC,0x80))
+ {
+ Return(0x0009)
+ }
+ Else
+ {
+ Return(0x000B)
+ }
+ }
+}
+
+Device(LNKB) // PBRC Routing Resource
+{
+ Name(_HID,EISAID("PNP0C0F"))
+
+ Name(_UID,2)
+
+ // Disable the PCI IRQ.
+
+ Method(_DIS,0,Serialized)
+ {
+ Or(PBRC,0x80,PBRC)
+ }
+
+ // Possible IRQ Resource Setting.
+
+ Method (_PRS, 0, Serialized)
+ {
+ return (PRSB)
+ }
+
+ // Current IRQ Resource Setting.
+
+ Method(_CRS,0,Serialized)
+ {
+ Name(RTLB,ResourceTemplate()
+ {
+ IRQ(Level,ActiveLow,Shared) {}
+ })
+
+ // Point to specific byte.
+
+ CreateWordField(RTLB,1,IRQ0)
+
+ // Zero out IRQ mask bits 0-15
+
+ Store(Zero,IRQ0)
+
+ ShiftLeft(1,And(PBRC,0x0F),IRQ0)
+
+ Return(RTLB)
+ }
+
+ // Set IRQ Resource Setting.
+
+ Method(_SRS,1,Serialized)
+ {
+ // Point to the specific byte passed in.
+
+ CreateWordField(Arg0,1,IRQ0)
+
+ // Determine the IRQ bit to set and store it,
+
+ FindSetRightBit(IRQ0,Local0)
+ Decrement(Local0)
+ Store(Local0,PBRC)
+ }
+
+ // PCI IRQ Status.
+
+ Method(_STA,0,Serialized)
+ {
+ If(And(PBRC,0x80))
+ {
+ Return(0x0009)
+ }
+ Else
+ {
+ Return(0x000B)
+ }
+ }
+}
+
+Device(LNKC) // PCRC Routing Resource
+{
+ Name(_HID,EISAID("PNP0C0F"))
+
+ Name(_UID,3)
+
+ // Disable the PCI IRQ.
+
+ Method(_DIS,0,Serialized)
+ {
+ Or(PCRC,0x80,PCRC)
+ }
+
+ // Possible IRQ Resource Setting.
+
+ Method (_PRS, 0, Serialized)
+ {
+ return (PRSC)
+ }
+
+ // Current IRQ Resource Setting.
+
+ Method(_CRS,0,Serialized)
+ {
+ Name(RTLC,ResourceTemplate()
+ {
+ IRQ(Level,ActiveLow,Shared) {}
+ })
+
+ // Point to specific byte.
+
+ CreateWordField(RTLC,1,IRQ0)
+
+ // Zero out IRQ mask bits 0-15
+
+ Store(Zero,IRQ0)
+
+ ShiftLeft(1,And(PCRC,0x0F),IRQ0)
+
+ Return(RTLC)
+ }
+
+ // Set IRQ Resource Setting.
+
+ Method(_SRS,1,Serialized)
+ {
+ // Point to the specific byte passed in.
+
+ CreateWordField(Arg0,1,IRQ0)
+
+ // Determine the IRQ bit to set and store it,
+
+ FindSetRightBit(IRQ0,Local0)
+ Decrement(Local0)
+ Store(Local0,PCRC)
+ }
+
+ // PCI IRQ Status.
+
+ Method(_STA,0,Serialized)
+ {
+ If(And(PCRC,0x80))
+ {
+ Return(0x0009)
+ }
+ Else
+ {
+ Return(0x000B)
+ }
+ }
+}
+
+Device(LNKD) // PDRC Routing Resource
+{
+ Name(_HID,EISAID("PNP0C0F"))
+
+ Name(_UID,4)
+
+ // Disable the PCI IRQ.
+
+ Method(_DIS,0,Serialized)
+ {
+ Or(PDRC,0x80,PDRC)
+ }
+
+ // Possible IRQ Resource Setting.
+
+ Method (_PRS, 0, Serialized)
+ {
+ return (PRSD)
+ }
+
+ // Current IRQ Resource Setting.
+
+ Method(_CRS,0,Serialized)
+ {
+ Name(RTLD,ResourceTemplate()
+ {
+ IRQ(Level,ActiveLow,Shared) {}
+ })
+
+ // Point to specific byte.
+
+ CreateWordField(RTLD,1,IRQ0)
+
+ // Zero out IRQ mask bits 0-15
+
+ Store(Zero,IRQ0)
+
+ ShiftLeft(1,And(PDRC,0x0F),IRQ0)
+
+ Return(RTLD)
+ }
+
+ // Set IRQ Resource Setting.
+
+ Method(_SRS,1,Serialized)
+ {
+ // Point to the specific byte passed in.
+
+ CreateWordField(Arg0,1,IRQ0)
+
+ // Determine the IRQ bit to set and store it,
+
+ FindSetRightBit(IRQ0,Local0)
+ Decrement(Local0)
+ Store(Local0,PDRC)
+ }
+
+ // PCI IRQ Status.
+
+ Method(_STA,0,Serialized)
+ {
+ If(And(PDRC,0x80))
+ {
+ Return(0x0009)
+ }
+ Else
+ {
+ Return(0x000B)
+ }
+ }
+}
+
+Device(LNKE) // PERC Routing Resource
+{
+ Name(_HID,EISAID("PNP0C0F"))
+
+ Name(_UID,5)
+
+ // Disable the PCI IRQ.
+
+ Method(_DIS,0,Serialized)
+ {
+ Or(PERC,0x80,PERC)
+ }
+
+ // Possible IRQ Resource Setting.
+
+ Method (_PRS, 0, Serialized)
+ {
+ return (PRSE)
+ }
+
+ // Current IRQ Resource Setting.
+
+ Method(_CRS,0,Serialized)
+ {
+ Name(RTLE,ResourceTemplate()
+ {
+ IRQ(Level,ActiveLow,Shared) {}
+ })
+
+ // Point to specific byte.
+
+ CreateWordField(RTLE,1,IRQ0)
+
+ // Zero out IRQ mask bits 0-15
+
+ Store(Zero,IRQ0)
+
+ ShiftLeft(1,And(PERC,0x0F),IRQ0)
+
+ Return(RTLE)
+ }
+
+ // Set IRQ Resource Setting.
+
+ Method(_SRS,1,Serialized)
+ {
+ // Point to the specific byte passed in
+
+ CreateWordField(Arg0,1,IRQ0)
+
+ // Determine the IRQ bit to set and store it
+
+ FindSetRightBit(IRQ0,Local0)
+ Decrement(Local0)
+ Store(Local0,PERC)
+ }
+
+ // PCI IRQ Status.
+
+ Method(_STA,0,Serialized)
+ {
+ If(And(PERC,0x80))
+ {
+ Return(0x0009)
+ }
+ Else
+ {
+ Return(0x000B)
+ }
+ }
+}
+
+Device(LNKF) // PFRC Routing Resource
+{
+ Name(_HID,EISAID("PNP0C0F"))
+
+ Name(_UID,6)
+
+ // Disable the PCI IRQ.
+
+ Method(_DIS,0,Serialized)
+ {
+ Or(PFRC,0x80,PFRC)
+ }
+
+ // Possible IRQ Resource Setting.
+
+ Method (_PRS, 0, Serialized)
+ {
+ return (PRSF)
+ }
+
+ // Current IRQ Resource Setting.
+
+ Method(_CRS,0,Serialized)
+ {
+ Name(RTLF,ResourceTemplate()
+ {
+ IRQ(Level,ActiveLow,Shared) {}
+ })
+
+ // Point to specific byte.
+
+ CreateWordField(RTLF,1,IRQ0)
+
+ // Zero out IRQ mask bits 0-15
+
+ Store(Zero,IRQ0)
+
+ ShiftLeft(1,And(PFRC,0x0F),IRQ0)
+
+ Return(RTLF)
+ }
+
+ // Set IRQ Resource Setting.
+
+ Method(_SRS,1,Serialized)
+ {
+ // Point to the specific byte passed in.
+
+ CreateWordField(Arg0,1,IRQ0)
+
+ // Determine the IRQ bit to set and store it,
+
+ FindSetRightBit(IRQ0,Local0)
+ Decrement(Local0)
+ Store(Local0,PFRC)
+ }
+
+ // PCI IRQ Status.
+
+ Method(_STA,0,Serialized)
+ {
+ If(And(PFRC,0x80))
+ {
+ Return(0x0009)
+ }
+ Else
+ {
+ Return(0x000B)
+ }
+ }
+}
+
+Device(LNKG) // PGRC Routing Resource
+{
+ Name(_HID,EISAID("PNP0C0F"))
+
+ Name(_UID,7)
+
+ // Disable the PCI IRQ.
+
+ Method(_DIS,0,Serialized)
+ {
+ Or(PGRC,0x80,PGRC)
+ }
+
+ // Possible IRQ Resource Setting.
+
+ Method (_PRS, 0, Serialized)
+ {
+ return (PRSG)
+ }
+
+ // Current IRQ Resource Setting.
+
+ Method(_CRS,0,Serialized)
+ {
+ Name(RTLG,ResourceTemplate()
+ {
+ IRQ(Level,ActiveLow,Shared) {}
+ })
+
+ // Point to specific byte.
+
+ CreateWordField(RTLG,1,IRQ0)
+
+ // Zero out IRQ mask bits 0-15
+
+ Store(Zero,IRQ0)
+
+ ShiftLeft(1,And(PGRC,0x0F),IRQ0)
+
+ Return(RTLG)
+ }
+
+ // Set IRQ Resource Setting.
+
+ Method(_SRS,1,Serialized)
+ {
+ // Point to the specific byte passed in.
+
+ CreateWordField(Arg0,1,IRQ0)
+
+ // Determine the IRQ bit to set and store it,
+
+ FindSetRightBit(IRQ0,Local0)
+ Decrement(Local0)
+ Store(Local0,PGRC)
+ }
+
+ // PCI IRQ Status.
+
+ Method(_STA,0,Serialized)
+ {
+ If(And(PGRC,0x80))
+ {
+ Return(0x0009)
+ }
+ Else
+ {
+ Return(0x000B)
+ }
+ }
+}
+
+Device(LNKH) // PHRC Routing Resource
+{
+ Name(_HID,EISAID("PNP0C0F"))
+
+ Name(_UID,8)
+
+ // Disable the PCI IRQ.
+
+ Method(_DIS,0,Serialized)
+ {
+ Or(PHRC,0x80,PHRC)
+ }
+
+ // Possible IRQ Resource Setting.
+
+ Method (_PRS, 0, Serialized)
+ {
+ return (PRSH)
+ }
+
+ // Current IRQ Resource Setting.
+
+ Method(_CRS,0,Serialized)
+ {
+ Name(RTLH,ResourceTemplate()
+ {
+ IRQ(Level,ActiveLow,Shared) {}
+ })
+
+ // Point to specific byte.
+
+ CreateWordField(RTLH,1,IRQ0)
+
+ // Zero out IRQ mask bits 0-15
+
+ Store(Zero,IRQ0)
+
+ ShiftLeft(1,And(PHRC,0x0F),IRQ0)
+
+ Return(RTLH)
+ }
+
+ // Set IRQ Resource Setting.
+
+ Method(_SRS,1,Serialized)
+ {
+ // Point to the specific byte passed in.
+
+ CreateWordField(Arg0,1,IRQ0)
+
+ // Determine the IRQ bit to set and store it,
+
+ FindSetRightBit(IRQ0,Local0)
+ Decrement(Local0)
+ Store(Local0,PHRC)
+ }
+
+ // PCI IRQ Status.
+
+ Method(_STA,0,Serialized)
+ {
+ If(And(PHRC,0x80))
+ {
+ Return(0x0009)
+ }
+ Else
+ {
+ Return(0x000B)
+ }
+ }
+}
diff --git a/ReferenceCode/AcpiTables/Dsdt/ALS.ASL b/ReferenceCode/AcpiTables/Dsdt/ALS.ASL
new file mode 100644
index 0000000..517aa49
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dsdt/ALS.ASL
@@ -0,0 +1,57 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Haswell *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+
+
+
+Device(ALSD)
+{
+ Name(_HID,"ACPI0008")
+
+ Method(_STA,0)
+ {
+ If(LEqual(ALSE,2))
+ {
+ Return(0x000B) // ALS Enabled. Don't show it in UI.
+ }
+
+ Return(0x0000) // ALS Disabled. Hide it.
+ }
+
+ Method(_ALI)
+ {
+ Return (Or(ShiftLeft(LHIH,8),LLOW))
+ }
+
+ Name(_ALR, Package()
+ {
+ Package() {70, 0},
+ Package() {73, 10},
+ Package() {85, 80},
+ Package() {100, 300},
+ Package() {150, 1000}
+ })
+
+}
diff --git a/ReferenceCode/AcpiTables/Dsdt/AcpiAsl.cif b/ReferenceCode/AcpiTables/Dsdt/AcpiAsl.cif
new file mode 100644
index 0000000..4dfcbd6
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dsdt/AcpiAsl.cif
@@ -0,0 +1,43 @@
+<component>
+ name = "AcpiAsl"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\AcpiTables\Dsdt\"
+ RefName = "AcpiAsl"
+[files]
+"AcpiAsl.sdl"
+"AcpiAsl.mak"
+"Platform.asl"
+"GloblNvs.asl"
+"CPU.asl"
+"THERMAL.ASL"
+"PCI_DRC.ASL"
+"Video.asl"
+"PCIEDOCK.ASL"
+"LpcB.asl"
+"98_LINK.ASL"
+"EC.ASL"
+"ALS.ASL"
+"Bat0Virt.asl"
+"Bat1Real.asl"
+"Bat2Real.asl"
+"LPC_DEV.ASL"
+"NAT_SIO.ASL"
+"NAT_LPT.ASL"
+"NAT_COM.ASL"
+"SMSC1007_SIO.ASL"
+"SMSC1007_COM.ASL"
+"Gpe.asl"
+"WPCN381U_SIO.asl"
+"WPCN381U_COM.asl"
+"WPCN381U_LPT.ASL"
+"SMSC1000_SIO.asl"
+"SMSC1000_COM.asl"
+"SMSC1000_LPT.asl"
+"DSDT.ASL"
+"token.asl"
+"H8S2113_SIO.ASL"
+"Nfc.asl"
+"wcam.asl"
+[parts]
+"AcpiAslWrap"
+<endComponent>
diff --git a/ReferenceCode/AcpiTables/Dsdt/AcpiAsl.mak b/ReferenceCode/AcpiTables/Dsdt/AcpiAsl.mak
new file mode 100644
index 0000000..72b2e84
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dsdt/AcpiAsl.mak
@@ -0,0 +1,39 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+#<AMI_FHDR_START>
+#
+# Name: AcpiAsl.mak
+#
+# Description: MAke file to build Aptio ACPI ASL components
+#
+#
+#<AMI_FHDR_END>
+#*************************************************************************
+
+
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/AcpiTables/Dsdt/AcpiAsl.sdl b/ReferenceCode/AcpiTables/Dsdt/AcpiAsl.sdl
new file mode 100644
index 0000000..a75ed2e
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dsdt/AcpiAsl.sdl
@@ -0,0 +1,417 @@
+IODEVICE
+ Name = "System PS2 Keyboard Controller"
+ ASLfile = "core\em\acpi\PS2KB.asl"
+ ASLdeviceName = "PS2K"
+ GPEbit = 01dh
+ SleepNum = 03h
+ Token = "PCH_SKU" "=" "1"
+ Token = "CRB_SIO_SUPPORT" "=" "0"
+ Token = "VirtualSerial_SUPPORT" "=" "1"
+End
+
+IODEVICE
+ Name = "System PS2 Mouse Controller"
+ ASLfile = "core\em\acpi\PS2MS.asl"
+ ASLdeviceName = "PS2M"
+ GPEbit = 01dh
+ SleepNum = 03h
+ Token = "PCH_SKU" "=" "1"
+ Token = "CRB_SIO_SUPPORT" "=" "0"
+ Token = "VirtualSerial_SUPPORT" "=" "1"
+End
+
+IODEVICE
+ Name = "System PS2 Keyboard Controller"
+ ASLfile = "core\em\acpi\PS2KB.asl"
+ ASLdeviceName = "PS2K"
+ GPEbit = 01dh
+ SleepNum = 03h
+ Token = "PCH_SKU" "=" "1"
+ Token = "EC_H8SMC" "=" "1"
+ Token = "CRB_EC_SUPPORT" "=" "1"
+End
+
+IODEVICE
+ Name = "System PS2 Mouse Controller"
+ ASLfile = "core\em\acpi\PS2MS.asl"
+ ASLdeviceName = "PS2M"
+ GPEbit = 01dh
+ SleepNum = 03h
+ Token = "PCH_SKU" "=" "1"
+ Token = "EC_H8SMC" "=" "1"
+ Token = "CRB_EC_SUPPORT" "=" "1"
+End
+
+TOKEN
+ Name = "PlatformAcpiTables_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable SaAcpiTables support in Project"
+ TokenType = Boolean
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+End
+
+TOKEN
+ Name = "TRTP"
+ Value = "0x01"
+ Help = "TRAP_TYPE_PPM"
+ TokenType = Integer
+ TargetASL = Yes
+ Range = "16-bit IO register"
+End
+
+TOKEN
+ Name = "WDTE"
+ Value = "0x01"
+ Help = "WDT enabled"
+ TokenType = Integer
+ TargetASL = Yes
+ Token = "CougarPoint_SUPPORT" "=" "1"
+End
+
+TOKEN
+ Name = "WDTE"
+ Value = "0x00"
+ Help = "WDT enabled"
+ TokenType = Integer
+ TargetASL = Yes
+ Token = "Ibexpeak_SUPPORT" "=" "1"
+End
+
+TOKEN
+ Name = "TRTD"
+ Value = "0x02"
+ Help = "TRAP_TYPE_DTS"
+ TokenType = Integer
+ TargetASL = Yes
+ Range = "16-bit IO register"
+End
+
+TOKEN
+ Name = "TRTI"
+ Value = "0x03"
+ Help = "TRAP_TYPE_IGD"
+ TokenType = Integer
+ TargetASL = Yes
+ Range = "16-bit IO register"
+End
+
+TOKEN
+ Name = "PFTI"
+ Value = "0x04"
+ Help = "PFAT IO Trap flag"
+ TokenType = Integer
+ TargetASL = Yes
+ Range = "16-bit IO register"
+End
+
+TOKEN
+ Name = "GCDD"
+ Value = "0x01"
+ Help = "SW_SMI_GET_CURRENT_DISPLAY_DEVICE"
+ TokenType = Integer
+ TargetASL = Yes
+ Range = "16-bit IO register"
+End
+
+TOKEN
+ Name = "DSTA"
+ Value = "0x0A"
+ Help = "SW_SMI_DISPLAY_SWITCH_TOGGLE_ACPI"
+ TokenType = Integer
+ TargetASL = Yes
+ Range = "16-bit IO register"
+End
+
+TOKEN
+ Name = "DSLO"
+ Value = "0x0C"
+ Help = "SW_SMI_DISPLAY_SWITCH_LID_OPEN_ACPI"
+ TokenType = Integer
+ TargetASL = Yes
+ Range = "16-bit IO register"
+End
+
+TOKEN
+ Name = "DSLC"
+ Value = "0x0E"
+ Help = "SW_SMI_DISPLAY_SWITCH_LID_CLOSE_ACPI"
+ TokenType = Integer
+ TargetASL = Yes
+ Range = "16-bit IO register"
+End
+
+TOKEN
+ Name = "PITS"
+ Value = "0x10"
+ Help = "SW_SMI_POPUP_ICON_TOGGLE"
+ TokenType = Integer
+ TargetASL = Yes
+ Range = "16-bit IO register"
+End
+
+TOKEN
+ Name = "SBCS"
+ Value = "0x12"
+ Help = "SW_SMI_SET_BACKLIGHT_CONTROL"
+ TokenType = Integer
+ TargetASL = Yes
+ Range = "16-bit IO register"
+End
+
+TOKEN
+ Name = "SALS"
+ Value = "0x13"
+ Help = "SW_SMI_SET_ALI_LEVEL"
+ TokenType = Integer
+ TargetASL = Yes
+ Range = "16-bit IO register"
+End
+
+TOKEN
+ Name = "LSSS"
+ Value = "0x2A"
+ Help = "SW_SMI_LID_STATE_SWITCH"
+ TokenType = Integer
+ TargetASL = Yes
+ Range = "16-bit IO register"
+End
+
+TOKEN
+ Name = "SOOT"
+ Value = "0x35"
+ Help = "SW_SMI_SAVE_OSB_OS_TYPE"
+ TokenType = Integer
+ TargetASL = Yes
+ Range = "16-bit IO register"
+End
+
+TOKEN
+ Name = "PDBR"
+ Value = "0x4D"
+ Help = "SW_SMI_PCIE_DOCK_BRIDGE_RESOURCE_PATCH"
+ TokenType = Integer
+ TargetASL = Yes
+End
+
+TOKEN
+ Name = "BW1P"
+ Value = "0x21"
+ Help = "Haswell - WhiteTip Mountain1 PPV Board ID for ASL code."
+ TokenType = Integer
+ TargetASL = Yes
+ Range = "16-bit IO register"
+End
+
+TOKEN
+ Name = "BW2C"
+ Value = "0x22"
+ Help = "Haswell - WhiteTip Mountain2 Board ID for ASL code."
+ TokenType = Integer
+ TargetASL = Yes
+ Range = "16-bit IO register"
+End
+
+TOKEN
+ Name = "BW2P"
+ Value = "0x23"
+ Help = "Haswell - WhiteTip Mountain2 PPV Board ID for ASL code."
+ TokenType = Integer
+ TargetASL = Yes
+ Range = "16-bit IO register"
+End
+
+TOKEN
+ Name = "BSPC"
+ Value = "0x24"
+ Help = "Haswell - Sawtooth Peak Board ID for ASL code."
+ TokenType = Integer
+ TargetASL = Yes
+ Range = "16-bit IO register"
+End
+
+TOKEN
+ Name = "BSPP"
+ Value = "0x25"
+ Help = "Haswell - Sawtooth Peak PPV Board ID for ASL code."
+ TokenType = Integer
+ TargetASL = Yes
+ Range = "16-bit IO register"
+End
+
+TOKEN
+ Name = "BICO"
+ Value = "0x27"
+ Help = "Haswell - WhiteTip Mountain2 CDK Open Chasis Board ID for ASL code."
+ TokenType = Integer
+ TargetASL = Yes
+ Range = "16-bit IO register"
+End
+
+TOKEN
+ Name = "BICC"
+ Value = "0x28"
+ Help = "Haswell - WhiteTip Mountain2 CDK Close Chasis Board ID for ASL code."
+ TokenType = Integer
+ TargetASL = Yes
+ Range = "16-bit IO register"
+End
+
+TOKEN
+ Name = "BHB"
+ Value = "0x30"
+ Help = "Haswell - Harris Beach FFRD Board ID for ASL code."
+ TokenType = Integer
+ TargetASL = Yes
+ Range = "16-bit IO register"
+End
+
+TOKEN
+ Name = "BFS2"
+ Value = "0x31"
+ Help = "Haswell - FFRD SKU2 Board ID for ASL code."
+ TokenType = Integer
+ TargetASL = Yes
+ Range = "16-bit IO register"
+End
+
+TOKEN
+ Name = "BFS3"
+ Value = "0x32"
+ Help = "Haswell - FFRD SKU3 Board ID for ASL code."
+ TokenType = Integer
+ TargetASL = Yes
+ Range = "16-bit IO register"
+End
+
+TOKEN
+ Name = "BFS4"
+ Value = "0x33"
+ Help = "Haswell - FFRD SKU4 Board ID for ASL code."
+ TokenType = Integer
+ TargetASL = Yes
+ Range = "16-bit IO register"
+End
+
+TOKEN
+ Name = "BRH"
+ Value = "0x35"
+ Help = "Haswell - Reed Harbor TDV Board ID for ASL code."
+ TokenType = Integer
+ TargetASL = Yes
+ Range = "16-bit IO register"
+End
+
+PATH
+ Name = "INTEL_ACPI_ASL_DIR"
+End
+
+MODULE
+ Help = "Includes AcpiAsl.mak to Project"
+ File = "AcpiAsl.mak"
+End
+
+ELINK
+ Name = "INTEL_EC_ASL"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "INTEL_GENERIC_ASL"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(INTEL_GENERIC_ASL)"
+ Parent = "GENERIC_ASL"
+ Priority = 10
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\Cpu.asl"
+ Parent = "GENERIC_ASL"
+ Disable = Yes
+ InvokeOrder = AfterParent
+ Lock = Yes
+End
+
+ELINK
+ Name = "Board\Em\Acpi\oemdsdt.asl"
+ Parent = "GENERIC_ASL"
+ Disable = Yes
+ InvokeOrder = AfterParent
+ Lock = Yes
+End
+
+ELINK
+ Name = "Board\Em\Acpi\OEMRMISC.asl"
+ Parent = "GENERIC_ASL"
+ Disable = Yes
+ InvokeOrder = AfterParent
+ Lock = Yes
+End
+
+ELINK
+ Name = "$(SB_CHIPSET_DIR)\IRQLink.asl"
+ Parent = "GENERIC_ASL"
+ Token = "PlatformAcpiTables_SUPPORT" "=" "0"
+ InvokeOrder = BeforeParent
+End
+
+ELINK
+ Name = "$(INTEL_ACPI_ASL_DIR)\GloblNvs.asl"
+ Parent = "GENERIC_ASL_BEFORE_PCITREE"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(INTEL_ACPI_ASL_DIR)\CPU.asl"
+ Parent = "INTEL_GENERIC_ASL"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(INTEL_ACPI_ASL_DIR)\Platform.asl"
+ Parent = "INTEL_GENERIC_ASL"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(INTEL_ACPI_ASL_DIR)\PCI_DRC.asl"
+ Parent = "INTEL_GENERIC_ASL"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(INTEL_ACPI_ASL_DIR)\Video.asl"
+ Parent = "INTEL_GENERIC_ASL"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(INTEL_ACPI_ASL_DIR)\Gpe.asl"
+ Parent = "INTEL_GENERIC_ASL"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(INTEL_ACPI_ASL_DIR)\PCIEDOCK.asl"
+ Parent = "INTEL_GENERIC_ASL"
+ InvokeOrder = AfterParent
+ Token = "FACP_FLAG_DCK_CAP" "=" "1"
+ Token = "CRB_EC_SUPPORT" "=" "1"
+End
+
+ELINK
+ Name = "$(INTEL_ACPI_ASL_DIR)\Thermal.asl"
+ Parent = "INTEL_GENERIC_ASL"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(INTEL_ACPI_ASL_DIR)\wcam.asl"
+ Parent = "INTEL_GENERIC_ASL"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/AcpiTables/Dsdt/Bat0Virt.asl b/ReferenceCode/AcpiTables/Dsdt/Bat0Virt.asl
new file mode 100644
index 0000000..a87232c
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dsdt/Bat0Virt.asl
@@ -0,0 +1,322 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Haswell *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+
+
+Scope(\)
+{
+ // these fields come from the Global NVS area
+ Field(GNVS,AnyAcc,Lock,Preserve)
+ {
+ Offset(31),
+ B0SC, 8, // (31) Battery 0 Stored Capacity
+ Offset(34),
+ B0SS, 8, // (34) Battery 0 Stored Status
+ }
+}
+
+
+Method(_Q53)
+{
+ P8XH(0,0x53) // show query number on Port 80
+ VBSE() // Virtual Battery Switch Event, remove if not needed.
+}
+
+
+// Virtual Battery Switch Event:
+// This method handles the Virtual Battery switch on the CRB.
+//
+// Arguments:
+// None
+//
+// Return Value:
+// None
+Method(VBSE,0,Serialized) // called from EC.asl
+{
+ // Check for Virtual Battery Mode. If the CRB is
+ // running on real batteries, skip this whole section.
+
+ If(LEqual(BNUM,0))
+ {
+ // Check that the current and NVS Power States
+ // are different. The 2 may be out of sync due to
+ // Virtual Battery hot-key support.
+
+ If(LNotEqual(ECRD(RefOf(VPWR)),PWRS))
+ {
+ // Update NVS Power State.
+
+ Store(ECRD(RefOf(VPWR)),PWRS)
+
+
+ // Perform needed ACPI Notifications.
+
+ PNOT()
+ }
+ }
+}
+
+
+//
+// called from EC.asl _Q52 method
+//
+// Virtual Battery Hot Keys:
+// This method passes the hot key scan code to the BTTM method.
+//
+// Arguments:
+// None
+//
+// Return Value:
+// None
+Method(VBHK,0,Serialized)
+{
+ // 1/! Scan Code = 0x02
+
+ Store(ECRD(RefOf(SCAN)), Local0)
+
+ If(LEqual(Local0,0x02)) // Battery = 10%.
+ {
+ BTTM(10)
+ }
+
+ // 2/@ Scan Code = 0x03
+
+ If(LEqual(Local0,0x03)) // Battery = 20%.
+ {
+ BTTM(20)
+ }
+
+ // 3/# Scan Code = 0x04
+
+ If(LEqual(Local0,0x04)) // Battery = 30%.
+ {
+ BTTM(30)
+ }
+
+ // 4/$ Scan Code = 0x05
+
+ If(LEqual(Local0,0x05)) // Battery = 40%.
+ {
+ BTTM(40)
+ }
+
+ // 5/% Scan Code = 0x06
+
+ If(LEqual(Local0,0x06)) // Battery = 50%.
+ {
+ BTTM(50)
+ }
+
+ // 6/^ Scan Code = 0x07
+
+ If(LEqual(Local0,0x07)) // Battery = 60%.
+ {
+ BTTM(60)
+ }
+
+ // 7/& Scan Code = 0x08
+
+ If(LEqual(Local0,0x08)) // Battery = 70%.
+ {
+ BTTM(70)
+ }
+
+ // 8/* Scan Code = 0x09
+
+ If(LEqual(Local0,0x09)) // Battery = 80%.
+ {
+ BTTM(80)
+ }
+
+ // 9/( Scan Code = 0x0A
+
+ If(LEqual(Local0,0x0A)) // Battery = 90%.
+ {
+ BTTM(90)
+ }
+
+ // 0/) Scan Code = 0x0B
+
+ If(LEqual(Local0,0x0B)) // Battery = 100%.
+ {
+ BTTM(100)
+ }
+
+ // _/- Scan Code = 0x0C
+
+ If(LEqual(Local0,0x0C)) // Battery = Battery - 2%.
+ {
+ If(LGreaterEqual(B0SC,2))
+ {
+ BTTM(Subtract(B0SC,2))
+ }
+ }
+
+ // +/= Scan Code = 0x0D
+
+ If(LEqual(Local0,0x0D)) // Battery = Battery + 2%.
+ {
+ If(LLessEqual(B0SC,98))
+ {
+ BTTM(Add(B0SC,2))
+ }
+ }
+
+ // F5 Scan Code = 0x3F
+
+ If(LEqual(Local0,0x3F)) // Virtual Power State Change.
+ {
+ // Check for Virtual Battery Mode. If the CRB is
+ // running on real batteries, skip this whole section.
+
+ If(LEqual(BNUM,0))
+ {
+ // Toggle the Virtual Power State.
+ Xor(PWRS,1,PWRS)
+
+
+ // Perform needed ACPI Notifications.
+ PNOT()
+ }
+ }
+}
+
+
+// Battery Test Method:
+// This method updates the Virtual Battery percentages and
+// notifies the OS of these changes.
+//
+// Arguments:
+// Arg0: The desired Virtual Battery Percentage.
+//
+// Return Value:
+// None
+
+Method(BTTM,1,Serialized)
+{
+ If(PWRS)
+ {
+ If(LGreaterEqual(Arg0,B0SC))
+ {
+ Store(Arg0,B0SC)
+ Notify(BAT0,0x80)
+ }
+ }
+ Else
+ {
+ If(LLessEqual(Arg0,B0SC))
+ {
+ Store(Arg0,B0SC)
+ Notify(BAT0,0x80)
+ }
+ }
+}
+
+ // Define the Virtual Battery 0 Control Method.
+
+ Device(BAT0)
+ {
+ Name(_HID,EISAID("PNP0C0A"))
+
+ Name(_UID,0)
+
+ Method(_STA,0)
+ {
+ If(LOr(LOr(LEqual(BID,BHB), LEqual(BID,BFS2)), LOr(LEqual(BID,BFS3), LEqual(BID,BFS4)))) //BoardIdHarrisBeachFfrd, BoardIdFfrdSku2, BoardIdFfrdSku3, BoardIdFfrdSku4
+ {
+ Return(0x0000) // Yes. Hide Virtual.
+ }
+ If(LEqual(BID,BRH)) // BoardIdReedHarborTdv
+ {
+ Return(0x0000) // Yes. Hide it.
+ }
+
+ If(And(BNUM,3)) // Battery 1 or 2 present?
+ {
+ If(LLessEqual(OSYS,2002))
+ {
+ Return(0x000A) // Yes. Hide Virtual for Win XP
+ }
+
+ Return(0x000B) // Yes. Hide Virtual.
+ }
+
+ Return(0x001F) // No. Show Virtual.
+ }
+
+ Method(_BIF,0)
+ {
+ Return(Package() {
+ 0x00000000, // Power Unit = mWh.
+ 0x00002710, // 10000 mWh Design Capacity.
+ 0x00002710, // 10000 mWh Last Full Charge.
+ 0x00000001, // Secondary Battery Technology.
+ 0xFFFFFFFF, // Unknown Design Voltage.
+ 0x000003E8, // 10% Warning Level.
+ 0x00000190, // 4% Low Level.
+ 0x00000064, // 1% Granularity Level 1.
+ 0x00000064, // 1% Granularity Level 2.
+ "CRB Battery 0",
+ "Battery 0",
+ "Fake",
+ "-Virtual Battery 0-"})
+ }
+
+ Method(_BST,0)
+ {
+ Name(PKG0,Package() {
+ 0xFFFFFFFF, // Battery State.
+ 0xFFFFFFFF, // Battery Present Rate.
+ 0xFFFFFFFF, // Battery Remaining Capacity.
+ 0xFFFFFFFF // Battery Present Voltage.
+ })
+
+ // Virtual AC/Battery Check.
+
+ If(PWRS)
+ {
+ // Return Charging.
+
+ Store(2,Index(PKG0,0))
+ }
+ Else
+ {
+ // Return Discharging.
+
+ Store(1,Index(PKG0,0))
+ }
+ Store(0x7FFFFFFF,Index(PKG0,1))
+ Store(Multiply(B0SC,100),Index(PKG0,2))
+ Return(PKG0)
+ }
+
+ // Return that everything runs off Battery.
+
+ Method(_PCL,0)
+ {
+ Return(\_SB)
+ }
+ }
+
diff --git a/ReferenceCode/AcpiTables/Dsdt/Bat1Real.asl b/ReferenceCode/AcpiTables/Dsdt/Bat1Real.asl
new file mode 100644
index 0000000..500d1d4
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dsdt/Bat1Real.asl
@@ -0,0 +1,198 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Haswell *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+
+
+Scope(\)
+{
+ // these fields come from the Global NVS area
+ Field(GNVS,AnyAcc,Lock,Preserve)
+ {
+ Offset(30), // Battery Support Registers:
+ BNUM, 8, // (30) Battery Number Present
+ Offset(32),
+ B1SC, 8, // (32) Battery 1 Stored Capacity
+ Offset(35),
+ B1SS, 8, // (35) Battery 1 Stored Status
+ }
+}
+
+ // Define the Real Battery 1 Control Method.
+
+ Device(BAT1)
+ {
+ Name(_HID,EISAID("PNP0C0A"))
+
+ Name(_UID,1)
+
+ Method(_STA,0)
+ {
+ If(And(BNUM,1)) // Battery 1 present?
+ {
+ Return(0x001F) // Yes. Show it.
+ }
+
+ If(LLessEqual(OSYS,2002))
+ {
+ Return(0x000A) // hide it for Win XP support
+ }
+
+ Return(0x000B) // No. Hide it.
+ }
+
+ Method(_BIF,0)
+ {
+ Name(BPKG, Package() {
+ 0x00000000, // Power Unit = mWh.
+ 0xFFFFFFFF, // Unknown Design Capacity.
+ 0xFFFFFFFF, // Unknown Last Full Charge.
+ 0x00000001, // Secondary Battery Technology.
+ 0xFFFFFFFF, // Unknown Design Voltage.
+ 0x00000000, // 10% Warning Level.
+ 0x00000000, // 4% Low Level.
+ 0x00000064, // 1% Granularity Level 1.
+ 0x00000000, // 1% Granularity Level 2.
+ "SR Real Battery",
+ "123456789",
+ "Real",
+ "Intel SR 1"
+ })
+
+ If (LAnd(LAnd(ECRD(RefOf(B1DV)),ECRD(RefOf(B1FC))),ECRD(RefOf(B1DC))))
+ {
+ // Convert mAh and mV to mWh
+ Store(Divide(Multiply(ECRD(RefOf(B1DC)), ECRD(RefOf(B1DV))),1000), Index(BPKG,1))
+ Store(Divide(Multiply(ECRD(RefOf(B1FC)), ECRD(RefOf(B1DV))),1000), Index(BPKG,2))
+ Store(B1DV, Index(BPKG,4))
+ Store(Divide(Multiply(ECRD(RefOf(B1FC)), ECRD(RefOf(B1DV))),10000), Index(BPKG,5))
+ Store(Divide(Multiply(ECRD(RefOf(B1FC)), ECRD(RefOf(B1DV))),25000), Index(BPKG,6))
+ Store(Divide(Multiply(ECRD(RefOf(B1DC)), ECRD(RefOf(B1DV))),100000), Index(BPKG,7))
+ }
+
+ Return (BPKG)
+ }
+
+ Method(_BST,0, Serialized)
+ {
+ Name(PKG1,Package() {
+ 0xFFFFFFFF, // Battery State.
+ 0xFFFFFFFF, // Battery Present Rate. (in mWh)
+ 0xFFFFFFFF, // Battery Remaining Capacity. (in mWh)
+ 0xFFFFFFFF // Battery Present Voltage. (in mV)
+ })
+
+ // Optimization for EC Low Power Mode due to many EC accesses in this method
+ // Wake EC for whole _BST method
+ Store(Zero, Local1)
+ if (LGreaterEqual(OSYS, 2013)) {
+ if (LEqual(ECLP, 0x1)) {
+ Store (Acquire(\EHLD, 100), Local2)
+ if (LEqual(Local2, Zero)) { // check for Mutex acquired, if Mutex not acquired _BST could take longer than expected to execute
+ if (LEqual(\ECUP,Zero)) {
+ Store(One, Local1)
+ \_SB.WTGP(88,1)
+ Sleep(8)
+ Store(One, \ECUP)
+ \_SB.PCI0.LPCB.H_EC.ECMD (0x2D) // Notify EC of CS exit
+ } else {
+ Release(\EHLD)
+ }
+ }
+ }
+ }
+
+ // Fix up the Battery Status.
+ Store(And(ECRD(RefOf(B1ST)), 0x07),Index(PKG1,0))
+ If(And(ECRD(RefOf(B1ST)), 0x01))
+ {
+ // Calculate discharge rate
+ // Return Rate in mW since we report _BIF data in mW
+ Store(Multiply(ECRD(RefOf(B1DI)), ECRD(RefOf(B1FV))), Local0)
+ Store(Divide(Local0, 1000), Local0)
+ Store(Local0, Index(PKG1,1))
+ }
+ Else
+ {
+ // Calculate charge rate
+ // Return Rate in mW since we report _BIF data in mW
+ Store(Multiply(ECRD(RefOf(B1CI)), ECRD(RefOf(B1FV))), Local0)
+ Store(Divide(Local0, 1000), Local0)
+ Store(Local0, Index(PKG1,1))
+ }
+
+ // Calculate Remaining Capacity in mWh =
+ // (Remaininng Capacity (mAh) * Design Voltage (mV))/1000
+ // Use Remaininng Capacity in mAh multiply with a fixed Design Voltage
+ // for Remaininng Capacity in mWh
+ Store(Divide(Multiply(ECRD(RefOf(B1RC)), ECRD(RefOf(B1DV))),1000),Index(PKG1,2))
+
+ // Report Battery Present Voltage (mV)
+ Store(ECRD(RefOf(B1FV)), Index(PKG1,3))
+
+ // Optimization for EC Low Power Mode due to many EC accesses in this method
+ // Put EC back into Low Power Mode
+ if (LGreaterEqual(OSYS, 2013)) {
+ if (LEqual(ECLP, 0x1)) {
+ if (LEqual(Local1, One)) {
+ \_SB.WTGP(88,0)
+ \_SB.PCI0.LPCB.H_EC.ECMD (0x2C) // Notify EC of CS entry
+ Store(Zero, \ECUP)
+ Release(\EHLD)
+ }
+ }
+ }
+
+ Return(PKG1)
+ }
+
+ Method(_BTP,1)
+ {
+ // arg0 = Trip Point, sent to EC as Threshold.
+ // transfer input value from mWh to %
+ If(LAnd(LNotEqual(ECRD(RefOf(B1FC)),0),LNotEqual(ECRD(RefOf(B1FV)),0)))
+ {
+ Store(Divide(Multiply(Arg0, 100), Divide(Multiply(ECRD(RefOf(B1FC)), ECRD(RefOf(B1FV))),1000)),Local0)
+
+ // adjust offset between OS & EC
+ Add(Local0,1,Local0)
+
+ // store TP value in EC name space offset 219
+ Store(Local0, ECRD(RefOf(BTP1)))
+
+ // Send EC Battery Threshold Update Command - 0x34
+ ECMD(0x34)
+ }
+
+ Return()
+
+ }
+ // Return that everything runs off Battery.
+
+ Method(_PCL,0)
+ {
+ Return(\_SB)
+ }
+ }
+
diff --git a/ReferenceCode/AcpiTables/Dsdt/Bat2Real.asl b/ReferenceCode/AcpiTables/Dsdt/Bat2Real.asl
new file mode 100644
index 0000000..13ad9d4
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dsdt/Bat2Real.asl
@@ -0,0 +1,182 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Haswell *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+
+
+Scope(\)
+{
+ // these fields come from the Global NVS area
+ Field(GNVS,AnyAcc,Lock,Preserve)
+ {
+ Offset(33),
+ B2SC, 8, // (33) Battery 2 Stored Capacity
+ Offset(36),
+ B2SS, 8 // (36) Battery 2 Stored Status
+ }
+}
+
+ // Define the Real Battery 2 Control Method.
+
+ Device(BAT2)
+ {
+ Name(_HID,EISAID("PNP0C0A"))
+ Name(_UID,2)
+
+ Method(_STA,0)
+ {
+ If(LOr(LOr(LEqual(BID,BHB), LEqual(BID,BFS2)), LOr(LEqual(BID,BFS3), LEqual(BID,BFS4)))) //BoardIdHarrisBeachFfrd, BoardIdFfrdSku2, BoardIdFfrdSku3, BoardIdFfrdSku4
+ {
+ Return(0x0000) // Yes. Hide it.
+ }
+ If(LEqual(BID,BRH)) // BoardIdReedHarborTdv
+ {
+ Return(0x0000) // Yes. Hide it.
+ }
+
+ If(And(BNUM,2)) // Battery 2 present?
+ {
+ Return(0x001F) // Yes. Show it.
+ }
+
+ If(LLessEqual(OSYS,2002))
+ {
+ Return(0x000A) // hide it for Win XP support
+ }
+
+ Return(0x000B) // No. Hide it.
+ }
+
+ Method(_BIF,0)
+ {
+ Name(BPK2, Package() {
+ 0x00000000, // Power Unit = mWh.
+ 0xFFFFFFFF, // Unknown Design Capacity.
+ 0xFFFFFFFF, // Unknown Last Full Charge.
+ 0x00000001, // Secondary Battery Technology.
+ 0xFFFFFFFF, // Unknown Design Voltage.
+ 0x00000000, // 10% Warning Level.
+ 0x00000000, // 4% Low Level.
+ 0x00000064, // 1% Granularity Level 1.
+ 0x00000000, // 1% Granularity Level 2.
+ "SR Real Battery",
+ "123456789",
+ "Real",
+ "Intel SR 2"
+ })
+
+ If (LAnd(LAnd(ECRD(RefOf(B1DV)),ECRD(RefOf(B2FC))),ECRD(RefOf(B1DC))))
+ {
+ // Convert mAh and mV to mWh
+ Store(Divide(Multiply(ECRD(RefOf(B1DC)), ECRD(RefOf(B1DV))),1000), Index(BPK2,1))
+ Store(Divide(Multiply(ECRD(RefOf(B2FC)), ECRD(RefOf(B1DV))),1000), Index(BPK2,2))
+ Store(B1DV, Index(BPK2,4))
+ Store(Divide(Multiply(ECRD(RefOf(B2FC)), ECRD(RefOf(B1DV))),10000), Index(BPK2,5))
+ Store(Divide(Multiply(ECRD(RefOf(B2FC)), ECRD(RefOf(B1DV))),25000), Index(BPK2,6))
+ Store(Divide(Multiply(ECRD(RefOf(B1DC)), ECRD(RefOf(B1DV))),100000), Index(BPK2,7))
+ }
+
+ Return (BPK2)
+ }
+
+ Method(_BST,0, Serialized)
+ {
+ Name(PKG2,Package() {
+ 0xFFFFFFFF, // Battery State.
+ 0xFFFFFFFF, // Battery Present Rate. (in mWh)
+ 0xFFFFFFFF, // Battery Remaining Capacity. (in mWh)
+ 0xFFFFFFFF // Battery Present Voltage. (in mV)
+ })
+
+ // Optimization for EC Low Power Mode due to many EC accesses in this method
+ // Wake EC for whole _BST method
+ Store(Zero, Local1)
+ if (LGreaterEqual(OSYS, 2013)) {
+ if (LEqual(ECLP, 0x1)) {
+ Store (Acquire(\EHLD, 100), Local2)
+ if (LEqual(Local2, Zero)) { // check for Mutex acquired, if Mutex not acquired _BST could take longer than expected to execute
+ if (LEqual(\ECUP,Zero)) {
+ Store(One, Local1)
+ \_SB.WTGP(88,1)
+ Sleep(8)
+ Store(One, \ECUP)
+ \_SB.PCI0.LPCB.H_EC.ECMD (0x2D) // Notify EC of CS exit
+ } else {
+ Release(\EHLD)
+ }
+ }
+ }
+ }
+
+ // Fix up the Battery Status.
+ Store(And(ECRD(RefOf(B2ST)), 0x07),Index(PKG2,0))
+ If(And(ECRD(RefOf(B2ST)), 0x01))
+ {
+ // Calculate discharge rate
+ // Return Rate in mW since we report _BIF data in mW
+ Store(Multiply(ECRD(RefOf(B2DI)), ECRD(RefOf(B2FV))), Local0)
+ Store(Divide(Local0, 1000), Local0)
+ Store(Local0, Index(PKG2,1))
+ }
+ Else
+ {
+ // Calculate charge rate
+ // Return Rate in mW since we report _BIF data in mW
+ Store(Multiply(ECRD(RefOf(B2CI)), ECRD(RefOf(B2FV))), Local0)
+ Store(Divide(Local0, 1000), Local0)
+ Store(Local0, Index(PKG2,1))
+ }
+
+ // Calculate Remaining Capacity in mWh =
+ // (Remaininng Charge (mAh) * Present Voltage (mV))/1000
+ Store(Divide(Multiply(ECRD(RefOf(B2RC)), ECRD(RefOf(B2FV))),1000),Index(PKG2,2))
+
+ // Report Battery Present Voltage (mV)
+ Store(ECRD(RefOf(B2FV)), Index(PKG2,3))
+
+ // Optimization for EC Low Power Mode due to many EC accesses in this method
+ // Put EC back into Low Power Mode
+ if (LGreaterEqual(OSYS, 2013)) {
+ if (LEqual(ECLP, 0x1)) {
+ if (LEqual(Local1, One)) {
+ \_SB.WTGP(88,0)
+ \_SB.PCI0.LPCB.H_EC.ECMD (0x2C) // Notify EC of CS entry
+ Store(Zero, \ECUP)
+ Release(\EHLD)
+ }
+ }
+ }
+
+ Return(PKG2)
+ }
+
+ // Return that everything runs off Battery.
+
+ Method(_PCL,0)
+ {
+ Return(\_SB)
+ }
+ }
+
+
diff --git a/ReferenceCode/AcpiTables/Dsdt/CPU.asl b/ReferenceCode/AcpiTables/Dsdt/CPU.asl
new file mode 100644
index 0000000..7e6f6aa
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dsdt/CPU.asl
@@ -0,0 +1,171 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Haswell *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+
+
+
+ // NOTE: The _PDC Implementation is out of the scope of this
+ // reference code. Please see the latest Hyper-Threading Technology
+ // Reference Code for complete implementation details.
+
+ Scope(\_PR)
+ {
+ Processor(CPU0, // Unique name for Processor 0.
+ 1, // Unique ID for Processor 0.
+ 0x1810, // CPU0 ACPI P_BLK address = ACPIBASE + 10h.
+ 6) // CPU0 P_BLK length = 6 bytes.
+ {
+ Method(_DEP){
+ ADBG("CPU0 DEP Call")
+ If(LEqual(S0ID, 1)){
+ ADBG("CPU0 DEP")
+ Return(Package() {\_SB.PEPD})
+ }Else{
+ ADBG("CPU0 DEP NULL")
+ Return(Package() {})
+ }
+ }
+ }
+
+ Processor(CPU1, // Unique name for Processor 1.
+ 2, // Unique ID for Processor 1.
+ 0x1810,
+ 6) // CPU1 P_BLK length = 6 bytes.
+ {
+ Method(_DEP){
+ ADBG("CPU1 DEP Call")
+ If(LEqual(S0ID, 1)){
+ ADBG("CPU1 DEP")
+ Return(Package() {\_SB.PEPD})
+ }Else{
+ ADBG("CPU1 DEP NULL")
+ Return(Package() {})
+ }
+ }
+ }
+
+ Processor(CPU2, // Unique name for Processor 2.
+ 3, // Unique ID for Processor 2.
+ 0x1810,
+ 6) // CPU2 P_BLK length = 6 bytes.
+ {
+ Method(_DEP){
+ ADBG("CPU2 DEP Call")
+ If(LEqual(S0ID, 1)){
+ ADBG("CPU2 DEP")
+ Return(Package() {\_SB.PEPD})
+ }Else{
+ ADBG("CPU2 DEP NULL")
+ Return(Package() {})
+ }
+ }
+ }
+
+ Processor(CPU3, // Unique name for Processor 3.
+ 4, // Unique ID for Processor 3.
+ 0x1810,
+ 6) // CPU3 P_BLK length = 6 bytes.
+ {
+ Method(_DEP){
+ ADBG("CPU3 DEP Call")
+ If(LEqual(S0ID, 1)){
+ ADBG("CPU3 DEP")
+ Return(Package() {\_SB.PEPD})
+ }Else{
+ ADBG("CPU3 DEP NULL")
+ Return(Package() {})
+ }
+ }
+ }
+ Processor(CPU4, // Unique name for Processor 4.
+ 5, // Unique ID for Processor 4.
+ 0x1810,
+ 6) // CPU4 P_BLK length = 6 bytes.
+ {
+ Method(_DEP){
+ ADBG("CPU4 DEP Call")
+ If(LEqual(S0ID, 1)){
+ ADBG("CPU4 DEP")
+ Return(Package() {\_SB.PEPD})
+ }Else{
+ ADBG("CPU4 DEP NULL")
+ Return(Package() {})
+ }
+ }
+ }
+
+ Processor(CPU5, // Unique name for Processor 5.
+ 6, // Unique ID for Processor 5.
+ 0x1810,
+ 6) // CPU5 P_BLK length = 6 bytes.
+ {
+ Method(_DEP){
+ ADBG("CPU5 DEP Call")
+ If(LEqual(S0ID, 1)){
+ ADBG("CPU5 DEP")
+ Return(Package() {\_SB.PEPD})
+ }Else{
+ ADBG("CPU5 DEP NULL")
+ Return(Package() {})
+ }
+ }
+ }
+ Processor(CPU6, // Unique name for Processor 6.
+ 7, // Unique ID for Processor 6.
+ 0x1810,
+ 6) // CPU6 P_BLK length = 6 bytes.
+ {
+ Method(_DEP){
+ ADBG("CPU6 DEP Call")
+ If(LEqual(S0ID, 1)){
+ ADBG("CPU6 DEP")
+ Return(Package() {\_SB.PEPD})
+ }Else{
+ ADBG("CPU6 DEP NULL")
+ Return(Package() {})
+ }
+ }
+ }
+
+ Processor(CPU7, // Unique name for Processor 7.
+ 8, // Unique ID for Processor 7.
+ 0x1810,
+ 6) // CPU7 P_BLK length = 6 bytes.
+ {
+ Method(_DEP){
+ ADBG("CPU7 DEP Call")
+ If(LEqual(S0ID, 1)){
+ ADBG("CPU7 DEP")
+ Return(Package() {\_SB.PEPD})
+ }Else{
+ ADBG("CPU7 DEP NULL")
+ Return(Package() {})
+ }
+ }
+ }
+
+ } // End _PR
+
+
diff --git a/ReferenceCode/AcpiTables/Dsdt/DSDT.ASL b/ReferenceCode/AcpiTables/Dsdt/DSDT.ASL
new file mode 100644
index 0000000..748996f
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dsdt/DSDT.ASL
@@ -0,0 +1,96 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Haswell *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+
+
+DefinitionBlock (
+ "DSDT.aml",
+ "DSDT",
+ 0x02, // DSDT revision.
+ // 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
+ "INTEL", // OEM ID (6 byte string)
+ "HSW-LPT", // OEM table ID (8 byte string)
+ 0x0 // OEM version of DSDT table (4 byte Integer)
+ )
+
+// BEGIN OF ASL SCOPE
+{
+
+External(LHIH)
+External(LLOW)
+External(IGDS)
+External(LIDS)
+External(BRTL)
+External(ALSE)
+External(GSMI)
+External(\_SB.PCI0.GFX0.ALSI)
+External(\_SB.PCI0.GFX0.CDCK)
+External(\_SB.PCI0.GFX0.CBLV)
+External(\_SB.PCI0.GFX0.GSSE)
+External(\_SB.PCI0.PEG0, DeviceObj)
+External(\_SB.PCI0.PEG0.PEGP, DeviceObj)
+External(\_SB.PCI0.PEG1, DeviceObj)
+External(\_SB.PCI0.PEG2, DeviceObj)
+External(\_SB.PCI0.GFX0.DD1F, DeviceObj)
+External(\_SB.PCI0.GFX0.GDCK, MethodObj)
+External(\_SB.PCI0.GFX0.GHDS, MethodObj)
+External(\_SB.PCI0.GFX0.AINT, MethodObj)
+External(\_SB.PCI0.GFX0.GLID, MethodObj)
+External(\_SB.PCI0.GFX0.GSCI, MethodObj)
+External(\_PR.CPU0, DeviceObj)
+External(\_PR.CPU0._PSS, MethodObj)
+External(\_PR.CPU0._PPC, IntObj)
+
+
+// Miscellaneous services enabled in Project
+ include ("amlupd.asl")
+ include ("token.asl")
+ include ("GloblNvs.asl")
+ include ("PCItree.asl")
+ include ("Platform.asl")
+ include ("CPU.asl")
+ include ("Thermal.asl")
+ include ("PCI_DRC.asl")
+ include ("Video.asl")
+ include ("Gpe.asl")
+ include ("PCIEDOCK.asl")
+ include ("Pch.asl") // Not in this package. Refer to the PCH Reference Code accordingly
+//----------------------------------------------------------------------
+ Name(\_S0, Package(4){0x0,0x0,0,0}) // mandatory System state
+ if(SS1) { Name(\_S1, Package(4){0x1,0x0,0,0})}
+ if(SS3) { Name(\_S3, Package(4){0x5,0x0,0,0})}
+ if(SS4) { Name(\_S4, Package(4){0x6,0x0,0,0})}
+ Name(\_S5, Package(4){0x7,0x0,0,0}) // mandatory System state
+
+ Method(PTS, 1) { // METHOD CALLED FROM _PTS PRIOR TO ENTER ANY SLEEP STATE
+ If(Arg0) // entering any sleep state
+ {
+ }
+ }
+ Method(WAK, 1) { // METHOD CALLED FROM _WAK RIGHT AFTER WAKE UP
+ }
+}// End of ASL File
+
diff --git a/ReferenceCode/AcpiTables/Dsdt/EC.ASL b/ReferenceCode/AcpiTables/Dsdt/EC.ASL
new file mode 100644
index 0000000..b223a9a
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dsdt/EC.ASL
@@ -0,0 +1,1893 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Haswell *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+
+
+External(\_SB.IETM, DeviceObj)
+
+External(TBAB)
+External(RTIP)
+External(HGAS, MethodObj)
+External(HPFS, MethodObj)
+External(HBRT, MethodObj)
+External(CHPS, MethodObj)
+External(UP1D)
+External(UPRW)
+External(SVRF, MethodObj)
+External(\_SB.PCI0.CTCU, MethodObj)
+External(\_SB.PCI0.CTCN, MethodObj)
+External(\_SB.PCI0.CTCD, MethodObj)
+#if !defined(ASL_Remove_SaSsdt_Data_To_Dsdt) || (ASL_Remove_SaSsdt_Data_To_Dsdt == 0)
+External(\_SB.PCI0.GFX0.CLID)
+External(\_SB.PCI0.GFX0.IUEH, MethodObj)
+External(\_SB.PCI0.GFX0.IUER, DeviceObj)
+#endif
+#define POWER_BUTTON 0
+#define WINDOWS_BUTTON 1
+#define VOLUME_UP_BUTTON 2
+#define VOLUME_DOWN_BUTTON 3
+#define ROTATION_LOCK_BUTTON 4
+#define CONVERTIBLE_BUTTON 6
+#define DOCK_INDICATOR 7
+
+Device(H_EC) // Hitachi Embedded Controller
+{
+ Name(_HID, EISAID("PNP0C09"))
+
+ Name(_UID,1)
+
+ Name(ECAV, Zero) // OS Bug Checks if EC OpRegion accessed before Embedded Controller Driver loaded
+
+ Method(_CRS,0)
+ {
+ Name(BFFR, ResourceTemplate()
+ {
+ IO(Decode16,0x62,0x62,0,1) // DIN/DOUT
+ IO(Decode16,0x66,0x66,0,1) // CMD/STS
+ })
+
+ Return(BFFR)
+ }
+
+ Method(_STA)
+ {
+ If (LEqual(ECON,1)){
+ Return(0x0F)
+ }
+ Return(0x00)
+ }
+
+ OperationRegion(ECF2,EmbeddedControl,0,0xFF)
+ Field(ECF2,ByteAcc,Lock,Preserve)
+ {
+ Offset(1),
+ PLMX, 8, // 1 Max Platform temprature
+ LTMP, 8, // 2 Sensor Temperature
+ RPWR, 1, // 3.0 Real AC Power (AC Present = 1)
+ , 2, // 3.2:1 Reserved
+ CFAN, 1, // 3.3 CPU Fan (Fan On = 1)
+ , 2, // 3.5:4 Reserved
+ LSTE, 1, // 3.6 Lid State (Lid Open = 1)
+ , 1, // 3.7 Reserved
+ SPTR, 8, // 4 SMBus Protocol Register
+ SSTS, 8, // 5 SMBus Status Register
+ SADR, 8, // 6 SMBus Address Register
+ SCMD, 8, // 7 SMBus Command Register
+ SBFR, 256, // 8 SMBus Block Buffer
+ SCNT, 8, // 40 SMBus Block Count
+ Offset(47),
+ CTMP, 8, // 47 EC Critical Temperature
+ DOCK, 1, // 48.0 Docking state (docked = 1)
+ EJET, 1, // 48.1 Eject switch state (Eject (Q-Switch off) = 1)
+ , 1, // 48.2 Reserved
+ PBNS, 1, // 48.3 Power Button State (0 = Pressed)
+ VPWR, 1, // 48.4 Virtual AC Power (AC Present = 1)
+ , 3, // 48.7:5 Reserved
+ SCAN, 8, // 49 Hot-Key Scan Code
+ B1ST, 8, // 50 Battery 1 Status
+ B1CR, 8, // 51 Battery 1 Current Rate
+ B1CC, 8, // 52 Battery 1 Current Capacity
+ B1VT, 8, // 53 Battery 1 Voltage
+ B2ST, 8, // 54 Battery 2 Status
+ B2CR, 8, // 55 Battery 2 Current Rate
+ B2CC, 8, // 56 Battery 2 Current Capacity
+ B2VT, 8, // 57 Battery 2 Voltage
+ CMDR, 8, // 58 KSC command register
+ LUXL, 8, // 59 LUX - Low Byte
+ LUXH, 8, // 60 LUX - High Byte
+ ACH0, 8, // 61 Channel 0 RAW Value
+ ACH1, 8, // 62 Channel 1 RAW Value
+ Offset(65),
+ PPSL, 8, // 65 PWM Port Select low byte
+ PPSH, 8, // 66 PWM Port Select high byte
+ PINV, 8, // 67 PWM initial value
+ PENV, 8, // 68 PWM ending value
+ PSTP, 8, // 69 PWM ms delay between steps
+ Offset(71),
+ CPUP, 16, // 71 CPU Power mW
+ BPWR, 16, // 73 Brick Power cW(100ths)
+ PPWR, 16, // 75 Platform Power cW(100ths)
+ CVRT, 8, // 77 CPU VR (IMVP) Temp
+ FANT, 8, // 78 Heat exchanger fan temp
+ SKNT, 8, // 79 Skin temp
+ AMBT, 8, // 80 Ambient temp
+ Offset(82), // 82-85 DPTF fields
+ TSI, 4, // Hysteresis selection is global and meant for all four sensors.
+ // # 0 = CPU VR (IMVP) temperature sensor
+ // # 1 = Heat Exchanger temperature sensor
+ // # 2 = Skin temperature sensor
+ // # 3 = Ambient temperature sensor
+ // # 4 = DIMM temperature sensor
+ // # Above 4 invalid
+ HYST, 4, // 82.4-7 Hysteresis in deg C
+ TSHT, 8, // 83 Thermal Sensor (N) high trip point
+ TSLT, 8, // 84 Thermal Sensor (N) low trip point
+ TSSR, 8, // 85 TSSR- thermal sensor status register:
+ // TSSR bits defined:
+ // BIT0: CPU VR Temp Sensor Trip Flag
+ // BIT1: Fan Temp Sensor Trip Flag
+ // BIT2: Skin Temp Sensor Trip Flag
+ // BIT3: Ambient Temp Sensor Trip Flag
+ // BIT4: DIMM Trip Point Flag
+ // BIT[7:5] Reserved
+ Offset(86),
+ B1CM, 8, // 86 Battery 1 Command (Place holder for now)
+ B1DC, 16, // 87 Battery 1 Design Capacity (mWh)
+ B1RC, 16, // 89 Battery 1 Remaining Capacity (mWh)
+ B1FC, 16, // 91 Battery 1 Full Charge Capacity (mWh)
+ B1FV, 16, // 93 Battery 1 Full Resolution Voltage (mV)
+ B1DI, 16, // 95 Battery 1 Full Resolution Discharge Current (mA)
+ B1CI, 16, // 97 Battery 1 Full Resolution Charge Current (mA)
+ B2RC, 16, // 99 Battery 2 Remaining Capacity (mWh)
+ B2FC, 16, // 101 Battery 2 Full Charge Capacity (mWh)
+ B2FV, 16, // 103 Battery 2 Full Resolution Voltage (mV)
+ B2DI, 16, // 105 Battery 2 Full Resolution Discharge Current (mA)
+ B2CI, 16, // 107 Battery 2 Full Resolution Charge Current (mA)
+ CPAP, 16, // 109 CPU average power in mW
+ BKAP, 16, // 111 Brick average power in cW(0.01)
+ PLAP, 16, // 113 Platform average power in cW(0.01)
+ CFSP, 16, // 115 CPU Fan speed in rpm
+ BRTV, 8, // 117 Brightness value for San Rafael second panel
+ , 8, // 118 reserved
+ SLPC, 8, // 119 Select Performance Counters
+ DLED, 1, // 120.0 EC Connected Standby Debug LED (CAPS LOCK)
+ PB10, 1, // 120.1 10 Second Power Button Control
+ Offset(124),
+ PTIM, 8, // 124 CPU,GFX pwr sample timer
+ DHPD, 8, // 125 Digital display hot-plug detect
+ DIM0, 8, // 126 DIMM0 temperature
+ DIM1, 8, // 127 DIMM1 temperature
+ PMAX, 8, // 128 CPU,MCH & PCH Max temp
+ PPDT, 8, // 129 PCH DTS reading from PCH
+ PECL, 8, // 130 CPU PECI reading fractional value (1/64 Celcius)
+ PECH, 8, // 131 CPU PECI reading integer value (unit Celicus)
+ PMDT, 8, // 132 MCH DTS reading from PCH
+ TSD0, 8, // 133 TS-on-DIMM0 temperature
+ TSD1, 8, // 134 TS-on-DIMM1 temperature
+ TSD2, 8, // 135 TS-on-DIMM2 temperature
+ TSD3, 8, // 136 TS-on-DIMM3 temperature
+ PAKN, 8, // 137 Packet sequence number
+ CPUE, 32, // 138 CPU energy
+ Offset(155),
+ PRCL, 8, // 155 Repeat cycle (LSB)
+ PRC0, 8, // 156 Repeat cycle
+ PRC1, 8, // 157 Repeat cycle
+ PRCM, 8, // 158 Repeat cycle (MSB)
+ PRIN, 8, // 159 Repear Intervel
+ PSTE, 8, // 160 Stop on Error
+ PCAD, 8, // 161 Peci Clinet Addess
+ PEWL, 8, // 162 Write Length
+ PWRL, 8, // 163 Read lenght
+ PECD, 8, // 164 Command Code
+ PEHI, 8, // 165 Host ID
+ PECI, 8, // 166 Index
+ PEPL, 8, // 167 Parameter (LSB)
+ PEPM, 8, // 168 Parameter (MSB)
+ PWFC, 8, // 169 Write FCS
+ PECC, 8, // 170 Completion code
+ PDT0, 8, // 171 Data 0
+ PDT1, 8, // 172 Data 1
+ PDT2, 8, // 173 Data 2
+ PDT3, 8, // 174 Data 3
+ PRFC, 8, // 175 Read FCS
+ PRS0, 8, // 176 Reserved
+ PRS1, 8, // 177 Reserved
+ PRS2, 8, // 178 Reserved
+ PRS3, 8, // 179 Reserved
+ PRS4, 8, // 180 Reserved
+ Offset(187),
+ PRCS, 8, // 187 Peci Repeat Command Status
+ PEC0, 8, // 188 Peci Error Count(LSB)
+ PEC1, 8, // 189 Peci Error Count
+ PEC2, 8, // 190 Peci Error Count
+ PEC3, 8, // 191 Peci Error Count(MSB)
+ GTVR, 8, // 192 CPU GT VR temp
+ MCRT, 8, // 193 Minicard Region Temp
+ Offset(194),
+ IBT1, 8, // 194 ISCT Byte 1
+ // 194.0 Enable/Disable ISCT - SAOS bit
+ // 194.1 WLAN powered in S3
+ // 194.2 WLAN powered in S4
+ // 194.3 WLAN powered in S5
+ // 194.4 WWAN powered in S3
+ // 194.5 WWAN powered in S4
+ // 194.6 WWAN powered in S5
+ // 194.7 Reserved
+ IBT2, 8, // 195 ISCT Byte 2
+ // 195.0 WLAN Wireless Status (0 = Disabled, 1 = Enabled)
+ // 195.1 WWAN Wireless Status (0 = Disabled, 1 = Enabled)
+ // 195.2:7 Reserved
+ WTMS, 8, // 196 Wake timer Settings
+ // 196.0 Timer Enabled in S3
+ // 196.1 Timer Enabled in S4
+ // 196.2 Timer Enabled in S5
+ // 196.3:6 Reserved
+ // 196.7 Enable/Disable EC Timer
+ AWT2, 8, // 197 ACPIWakeTmrByte2 - Wake timer value (BIT23-16)
+ AWT1, 8, // 198 ACPIWakeTmrByte1 - Wake timer value (BIT15-8)
+ AWT0, 8, // 199 ACPIWakeTmrByte0 - Wake timer value (BIT7-0)
+ SPT2, 1, // 200.0 SATA Por2 - Cable connect power control. 1=ON;0=OFF
+ ,7, // 200.7-1 Reserved
+ Offset(211),
+ B1DV, 16, // 211 Battery 1 Design Voltage (mV)
+ Offset(215),
+ B1ML, 8, // 215 BattAPmaxL - Battery Pack A maximum low byte
+ B1MH, 8, // 216 BattAPmaxH - Battery Pack A maximum high byte
+ B2ML, 8, // 217 BattBPmaxL - Battery Pack B maximum low byte
+ B2MH, 8, // 218 BattBPmaxH - Battery Pack B maximum high byte
+ BTP1, 8, // 219 Battery 1 Trip Point in %
+ }
+
+
+ // ECRD (Embedded Read Method)
+ //
+ // Handle all commands sent to EC by BIOS
+ //
+ // Arguments: (1)
+ // Arg0 - Object to Read
+ // Return Value:
+ // Read Value
+ //
+ Method(ECRD,1,Serialized, 0, IntObj, FieldUnitObj)
+ {
+ If(LAnd(LEqual(\ECUP,Zero),LEqual(\_SB.RDGP(88),0)))
+ {
+ \_SB.WTGP(88,1)
+ Sleep(16)
+ }
+ Store(DerefOf (Arg0), Local0)
+ Return(Local0)
+ }
+
+ // ECWT (Embedded Write Method)
+ //
+ // Handle all commands sent to EC by BIOS
+ //
+ // Arguments: (2)
+ // Arg0 - Value to Write
+ // Arg1 - Object to Write to
+ //
+ Method(ECWT,2,Serialized,,,{IntObj, FieldUnitObj})
+ {
+ If(LAnd(LEqual(\ECUP,Zero),LEqual(\_SB.RDGP(88),0)))
+ {
+ \_SB.WTGP(88,1)
+ Sleep(16)
+ }
+ Store(Arg0,Arg1)
+ }
+
+ // ECMD (Embedded Controller Command)
+ //
+ // Handle all commands sent to EC by BIOS
+ //
+ // Arguments: (1)
+ // Arg0 - EC command
+ // Return Value:
+ // 0x00 = Success
+ // 0xFF = Failure
+ //
+ Method(ECMD,1,Serialized)
+ {
+ While(ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.CMDR))){Stall(20)} // make sure no command is currently being processed so we don't overwrite it
+ ECWT(Arg0, RefOf(\_SB.PCI0.LPCB.H_EC.CMDR))
+ Return (0x00)
+ }
+
+ Include("ALS.ASL")
+
+
+ // Virtual battery code
+ //
+ Include("Bat0Virt.asl")
+
+ // Real battery code
+ //
+ Include("Bat1Real.asl")
+ Include("Bat2Real.asl")
+
+ // The _REG Method is needed because communication with the EC
+ // before the driver is loaded is prohibited in WIN2000/WINXP.
+
+ Method(_REG,2)
+ {
+ If(LAnd(LEqual(Arg0,3),LEqual(Arg1,1)))
+ {
+ // Must be running NT 5.0 OS.
+ // Update ECAV Object. ASL should check for this value to be One before accessing EC OpRegion.
+ Store(One, ECAV)
+
+ // Turn off the CPU Fan if Active Cooling
+ // is disabled.
+
+ If(LEqual(0,ACTT))
+ {
+ ECWT(0,RefOf(CFAN))
+ }
+
+ // Turn off pwm fan so it starts in a known state
+ If(LEqual(1, THOF))
+ {
+ \_TZ.FN00._OFF()
+ }
+
+ // Update the Ambiant Light Illuminence Values.
+
+ Store(ECRD(RefOf(LUXH)),LHIH)
+ Store(ECRD(RefOf(LUXL)),LLOW)
+
+ If(LAnd(LEqual(ALSE,2),IGDS))
+ {
+ Store(ECRD(RefOf(LUXH)), Local0)
+ Or(ShiftLeft(Local0, 8), ECRD(RefOf(LUXL)), \_SB.PCI0.GFX0.ALSI)
+ }
+
+ // Save the Lid State in global NVS and IGD OpRegion.
+ //Store(LSTE,\_SB.PCI0.GFX0.CLID)
+ If (LEqual(ECRD(RefOf(LSTE)), 0))
+ {
+ Store(0,\_SB.PCI0.GFX0.CLID)
+ }
+ If (LEqual(ECRD(RefOf(LSTE)), 1))
+ {
+ Store(3,\_SB.PCI0.GFX0.CLID)
+ }
+ Store(ECRD(RefOf(LSTE)),LIDS)
+
+ // Update the Dock Status
+ Store(\DSTS,\_SB.PCI0.GFX0.CDCK)
+
+ // Unconditionally fix up the Battery and Power State.
+
+ // Initialize the Number of Present Batteries.
+ // 1 = Real Battery 1 is present
+ // 2 = Real Battery 2 is present
+ // 3 = Real Battery 1 and 2 are present
+
+ Store(0,BNUM)
+ Or(BNUM,ShiftRight(And(ECRD(RefOf(B1ST)),0x08),3),BNUM)
+ Or(BNUM,ShiftRight(And(ECRD(RefOf(B2ST)),0x08),2),BNUM)
+
+ // Save the current Power State for later.
+
+ Store(PWRS,Local0)
+
+ // Initialize the Power State.
+ // BNUM = 0 = Virtual Power State
+ // BNUM > 0 = Real Power State
+
+ If(LEqual(BNUM,0))
+ {
+ Store(ECRD(RefOf(VPWR)),PWRS)
+ }
+ Else
+ {
+ Store(ECRD(RefOf(RPWR)),PWRS)
+ }
+
+ // Perform needed ACPI Notifications.
+
+ PNOT()
+
+ //
+ // Call Power button init method for 10sec PB OVR
+ //
+ ^VGBI.PBIN()
+ }
+ }
+
+ Method(_GPE)
+ {
+ Store (23, Local0) // GPI7 for other boards
+
+ If(LOr(LOr(LEqual(BID,BWT1), LEqual(BID,BW1P)), LOr(LEqual(BID,BW2C), LEqual(BID,BW2P)))) // BoardIdWhiteTipMountain1, BoardIdWhiteTipMountain1Ppv, BoardIdWhiteTipMountain2, BoardIdWhiteTipMountain2Ppv
+ {
+ Store(10, Local0) // GPI10
+ }
+
+ If(LOr(LOr(LEqual(BID,BSPC), LEqual(BID,BSPP)), LEqual(BID,BRH))) // BoardIdSawToothPeak, BoardIdSawToothPeakPpv, BoardIdReedHarborTdv
+ {
+ Store(10, Local0) // GPI10
+ }
+
+ return (Local0)
+ }
+
+ // For the below _Qxx Methods, The Runtime SCI has been asserted,
+ // the EC Driver performed it's query, and the value returned from
+ // the Query = xx.
+
+ Method(_Q30) // Real Battery AC Insertion Event.
+ {
+ P8XH(0,0x30)
+
+ // Set Global Power State = AC Mode.
+
+ Store(1,PWRS)
+
+ // Perform needed ACPI Notifications.
+
+ PNOT()
+ }
+
+ Method(_Q31) // Real Battery AC Removal Event.
+ {
+ P8XH(0,0x31)
+
+ // Set Global Power State = Battery Mode.
+
+ Store(0,PWRS)
+
+ // Perform needed ACPI Notifications.
+
+ PNOT()
+ }
+
+ Method(_Q32) // Real Battery Capacity Change.
+ {
+ P8XH(0,0x32)
+
+ // Perform needed ACPI Notifications.
+
+ PNOT()
+ }
+
+ Method(_Q33) // Real Battery Insertion/Removal Event.
+ {
+ P8XH(0,0x33)
+
+ // Initialize the Number of Present Batteries.
+ // 1 = Real Battery 1 is present
+ // 2 = Real Battery 2 is present
+ // 3 = Real Battery 1 and 2 are present
+
+ Store(0,BNUM)
+ Or(BNUM,ShiftRight(And(ECRD(RefOf(B1ST)),0x08),3),BNUM)
+ Or(BNUM,ShiftRight(And(ECRD(RefOf(B2ST)),0x08),2),BNUM)
+
+ // Perform needed ACPI Notifications.
+
+ PNOT()
+ }
+
+ Method(_Q40, 0, Serialized) // Dock complete Event
+ {
+ P8XH(0,0x40)
+ If(LEqual(\_SB.PCI0.HDEF.DCKS, 1))
+ {
+ If(LEqual(\_SB.PCI0.HDEF.DCKM, 0))
+ {
+ Store(1, \_SB.PCI0.HDEF.DCKA)
+ Stall(50)
+ While(LNotEqual(\_SB.PCI0.HDEF.DCKM, 1))
+ {
+ Stall(50)
+ }
+ }
+ }
+
+ Sleep(1000) // Delay 1 second for hot docking stability
+ Store(\PDBR, \SSMP)
+ Store(1, \DSTS)
+ Sleep(1000) // Delay 1 second for hot docking stability
+ Notify(\_SB.PCI0.DOCK, 0x00)
+
+ If(LAnd(CondRefOf(^VGBI._STA),LEqual(And(^VGBI._STA(),One),One))) // VirtualButton driver is loaded(means it is Winblue)
+ {
+ Or(PB1E, 0x10, PB1E) // Set Dock status
+ ^VGBI.UPBT(DOCK_INDICATOR, One)
+ ADBG("Notify 0xCA")
+ Notify(^VGBI, 0xCA) // Notify Virtual GPIO driver that Docking event happens.
+ }
+
+ If(IGDS)
+ {
+ \_SB.PCI0.GFX0.GDCK(1)
+ }
+ }
+
+ Method(_Q41) // Surprise Removal
+ {
+ P8XH(0,0x41)
+ If(LEqual(\_SB.PCI0.HDEF.DCKS, 1))
+ {
+ If(LEqual(\_SB.PCI0.HDEF.DCKM, 1))
+ {
+ Store(0, \_SB.PCI0.HDEF.DCKA)
+ }
+ }
+ Store(0, \DSTS)
+ Notify(\_SB.PCI0.DOCK, 0x01)
+
+ If(LAnd(CondRefOf(^VGBI._STA),LEqual(And(^VGBI._STA(),One),One))) // VirtualButton driver is loaded(means it is Winblue)
+ {
+ And(PB1E, Not(0x10), PB1E) // Clear Dock Status
+ ^VGBI.UPBT(DOCK_INDICATOR, Zero)
+ ADBG("Notify 0xCB")
+ Notify(^VGBI, 0xCB) // Notify Virtual GPIO driver that Undocking event happens.
+ } Else {
+ If(IGDS)
+ {
+ \_SB.PCI0.GFX0.GDCK(0)
+ }
+ }
+ }
+
+ Method(_Q42) // Undocking request Event
+ {
+ P8XH(0,0x42)
+ If(LAnd(\_SB.PCI0.HDEF.DCKS, 1))
+ {
+ Store(0, \_SB.PCI0.HDEF.DCKA)
+ }
+ Notify(\_SB.PCI0.DOCK, 0x01)
+
+ If(LAnd(CondRefOf(^VGBI._STA),LEqual(And(^VGBI._STA(),One),One))) // VirtualButton driver is loaded(means it is Winblue)
+ {
+ And(PB1E, Not(0x10), PB1E) // Clear Dock Status
+ ^VGBI.UPBT(DOCK_INDICATOR, Zero)
+ If(CondRefOf(\_SB.PCI0.GFX0.IUER))
+ {
+ Store(\_SB.PCI0.GFX0.IUER, Local0)
+ And(Local0, Not(0x80), \_SB.PCI0.GFX0.IUER)
+ }
+ ADBG("Notify 0xCB")
+ Notify(^VGBI, 0xCB) // Notify Virtual GPIO driver that Undocking event happens.
+ } Else {
+ If(IGDS)
+ {
+ \_SB.PCI0.GFX0.GDCK(0)
+ }
+ }
+ }
+
+ Method(_Q43) // Express Card Presence Changed on Saddlestring (Docking)
+ {
+ P8XH(0,0x43)
+
+ Notify(\_SB.PCI0.RP07, 0x0)
+ }
+
+ Method(_Q44) // Virtual Dock Presence Changed
+ {
+ If(\DSTS)
+ {
+ Notify(\_SB.PCI0.DOCK, 1) //UnDocked
+ Store(0, \DSTS)
+ }
+ Else
+ {
+ Notify(\_SB.PCI0.DOCK, 0) //Docked
+ Store(1, \DSTS)
+ }
+ }
+
+ Method(_Q51) // Lid Switch Event.
+ {
+ P8XH(0,0x51)
+
+ // Update Lid NVS State.
+
+ Store(ECRD(RefOf(LSTE)),LIDS)
+
+ \_SB.PCI0.GFX0.GLID(LIDS)
+
+ // If ETM is not disabled, notify IETM device
+ If (LEqual(\_TZ.ETMD, 0))
+ {
+ If(CondRefOf(\_SB.IETM))
+ {
+ Notify(\_SB.IETM,0x83)
+ }
+ }
+ Notify(\_SB.LID0,0x80)
+ }
+
+
+ Method(_Q52) // Hot-Key Event.
+ {
+ P8XH(0,0x52)
+
+ // This event will be generated whenever a
+ // CRTL+ALT+SHIFT+"Next Key" is hit. This event handler
+ // will base code execution on the "Next Key" Scan Code
+ // stored in the EC Memory Space.
+
+ Store(ECRD(RefOf(SCAN)),Local2)
+ P8XH(1,Local2)
+
+
+ // "D" Scan Code = 0x20
+
+ If(LEqual(SCAN,0x20))
+ {
+ ADBG("CAS+D")
+ If(LAnd(CondRefOf(^VGBI._STA),LEqual(And(^VGBI._STA(),One),One))) // VirtualButton driver is loaded(means it is Winblue)
+ {
+ //
+ // CAS+D test emulation mode
+ // 1. Windows press notify 0xC2
+ // 2. Volume up press notify 0xC4
+ // 3. Volume up release notify 0xC5
+ // 4. Windows release notify 0xC3
+ //
+
+ Sleep(1000) // 1sec delay is needed for Powerbutton and Windows Home button.
+
+ ^VGBI.UPBT(WINDOWS_BUTTON, One) // Update VBDS
+ ADBG("Notify 0xC2")
+ Notify(^VGBI, 0xC2) // Notify Virtual GPIO driver that Windows Home button is pressed.
+
+ ^VGBI.UPBT(VOLUME_UP_BUTTON, One)
+ ADBG("Notify 0xC4")
+ Notify(^VGBI, 0xC4) // Notify Virtual GPIO driver that Vol up button is pressed.
+
+ ^VGBI.UPBT(VOLUME_UP_BUTTON, Zero)
+ ADBG("Notify 0xC5")
+ Notify(^VGBI, 0xC5) // Notify Virtual GPIO driver that Vol up button is released.
+
+ ^VGBI.UPBT(WINDOWS_BUTTON, Zero)
+ ADBG("Notify 0xC3")
+ Notify(^VGBI, 0xC3) // Notify Virtual GPIO driver that Windows Home button is released.
+ }
+ }
+
+ // "F" Scan Code = 0x21
+
+ If(LEqual(SCAN,0x21))
+ {
+ ADBG("CAS+F")
+ If(LAnd(CondRefOf(^VGBI._STA),LEqual(And(^VGBI._STA(),One),One))) // VirtualButton driver is loaded(means it is Winblue)
+ {
+ //
+ // CAS+F test emulation mode
+ // 1. Windows press notify 0xC2
+ // 2. Volume down press notify 0xC6
+ // 3. Volume down release notify 0xC7
+ // 4. Windows release notify 0xC3
+ //
+
+ Sleep(1000) // 1sec delay is needed for Powerbutton and Windows Home button
+
+ ^VGBI.UPBT(WINDOWS_BUTTON, One) // Update VBDS
+ ADBG("Notify 0xC2")
+ Notify(^VGBI, 0xC2) // Notify Virtual GPIO driver that Windows Home button is pressed.
+
+ ^VGBI.UPBT(VOLUME_DOWN_BUTTON, One)
+ ADBG("Notify 0xC6")
+ Notify(^VGBI, 0xC6) // Notify Virtual GPIO driver that Vol down button is pressed.
+
+ ^VGBI.UPBT(VOLUME_DOWN_BUTTON, Zero)
+ ADBG("Notify 0xC7")
+ Notify(^VGBI, 0xC7) // Notify Virtual GPIO driver that Vol down button is released.
+
+ ^VGBI.UPBT(WINDOWS_BUTTON, Zero) // Update VBDS
+ ADBG("Notify 0xC3")
+ Notify(^VGBI, 0xC3) // Notify Virtual GPIO driver that Windows Home button is released.
+ }
+ }
+
+ // Intel Ultrabook Event Handlers.
+
+ // "G" Scan Code = 0x22
+
+ If(LEqual(Local2,0x22))
+ {
+ ADBG("CAS+G")
+ If(LAnd(CondRefOf(^VGBI._STA),LEqual(And(^VGBI._STA(),One),One))) // VirtualButton driver is loaded(means it is Winblue)
+ {
+ //
+ // CAS+G test emulation mode
+ // 1. Windows press notify 0xC2
+ // 2. Powerbutton press notify 0xC0
+ // 3. Powerbutton release notify 0xC1
+ // 4. Windows release notify 0xC3
+ //
+
+ Sleep(1000) // 1sec delay is needed for Powerbutton and Windows Home button
+
+ ^VGBI.UPBT(WINDOWS_BUTTON, One)
+ ADBG("Notify 0xC2")
+ Notify(^VGBI, 0xC2) // Notify Virtual GPIO driver that Windows Home button is pressed.
+ If(And(PB1E, 1))
+ {
+ ^VGBI.UPBT(POWER_BUTTON, One)
+ ADBG("Notify 0xC0")
+ Notify(^VGBI, 0xC0) // Notify Virtual GPIO driver that Power button is pressed.
+
+ ^VGBI.UPBT(POWER_BUTTON, Zero)
+ ADBG("Notify 0xC1")
+ Notify(^VGBI, 0xC1) // Notify Virtual GPIO driver that Power button is released.
+ }
+
+ ^VGBI.UPBT(WINDOWS_BUTTON, Zero)
+ ADBG("Notify 0xC3")
+ Notify(^VGBI, 0xC3) // Notify Virtual GPIO driver that Windows Home button is released.
+ } Else {
+ // Power Button. If HID Event Driver loaded, use it. Otherwise, use GFX Driver.
+ If(LEqual(\_SB.HIDD.HRDY, 1))
+ {
+ \_SB.HIDD.HPEM(9)
+ } Else {
+ ADBG("IUEH")
+ \_SB.PCI0.GFX0.IUEH(0)
+ }
+ }
+ }
+
+ // "H" Scan Code = 0x23
+
+ If(LEqual(Local2,0x23))
+ {
+ ADBG("CAS+H")
+ // Windows Button. If HID Event Driver loaded, use it. Otherwise, use GFX Driver.
+ Sleep(1000)
+
+ If(LAnd(CondRefOf(^VGBI._STA),LEqual(And(^VGBI._STA(),One),One))) // VirtualButton driver is loaded(means it is Winblue)
+ {
+ ^VGBI.UPBT(WINDOWS_BUTTON, One)
+ ADBG("Notify 0xC2")
+ Notify(^VGBI, 0xC2) // Notify Virtual GPIO driver that Windows Home button is pressed.
+ ^VGBI.UPBT(WINDOWS_BUTTON, Zero)
+ ADBG("Notify 0xC3")
+ Notify(^VGBI, 0xC3) // Notify Virtual GPIO driver that Windows Home button is released.
+ } Else {
+ If(LEqual(\_SB.HIDD.HRDY, 1))
+ {
+ \_SB.HIDD.HPEM(1)
+ } Else {
+ ADBG("IUEH")
+ \_SB.PCI0.GFX0.IUEH(1)
+ }
+ }
+ }
+
+ // "J" Scan Code = 0x24
+ If(LEqual(Local2,0x24))
+ {
+ ADBG("CAS+J")
+ // Volume Up. If HID Event Driver loaded, use it. Otherwise, use GFX Driver.
+
+ If(LAnd(CondRefOf(^VGBI._STA),LEqual(And(^VGBI._STA(),One),One))) // VirtualButton driver is loaded(means it is Winblue)
+ {
+ ^VGBI.UPBT(VOLUME_UP_BUTTON, One)
+ ADBG("Notify 0xC4")
+ Notify(^VGBI, 0xC4) // Notify Virtual GPIO driver that Volume UP button is pressed.
+
+ ^VGBI.UPBT(VOLUME_UP_BUTTON, Zero)
+ ADBG("Notify 0xC5")
+ Notify(^VGBI, 0xC5) // Notify Virtual GPIO driver that Volume UP button is released.
+ } Else {
+ If(LEqual(\_SB.HIDD.HRDY, 1))
+ {
+ \_SB.HIDD.HPEM(17)
+ } Else {
+ ADBG("IUEH")
+ \_SB.PCI0.GFX0.IUEH(2)
+ }// End of If(LEqual(\_SB.HIDD.HRDY, 1))
+ } // If(LAnd(CondRefOf(^VGBI._STA)),(LEqual(And(^VGBI._STA(),One),One)))
+ }
+
+ // "K" Scan Code = 0x25
+
+ If(LEqual(Local2,0x25))
+ {
+ ADBG("CAS+K")
+ // Volume Down. If HID Event Driver loaded, use it. Otherwise, use GFX Driver.
+
+ If(LAnd(CondRefOf(^VGBI._STA),LEqual(And(^VGBI._STA(),One),One))) // VirtualButton driver is loaded(means it is Winblue)
+ {
+ ^VGBI.UPBT(VOLUME_DOWN_BUTTON, One)
+ ADBG("Notify 0xC6")
+ Notify(^VGBI, 0xC6) // Notify Virtual GPIO driver that Volue Down button is pressed.
+
+ ^VGBI.UPBT(VOLUME_DOWN_BUTTON, Zero)
+ ADBG("Notify 0xC7")
+ Notify(^VGBI, 0xC7) // Notify Virtual GPIO driver that Volue Down button is released.
+ } Else {
+ If(LEqual(\_SB.HIDD.HRDY, 1))
+ {
+ \_SB.HIDD.HPEM(18)
+ } Else {
+ ADBG("IUEH")
+ \_SB.PCI0.GFX0.IUEH(3)
+ }
+ }
+ }
+
+ // "L" Scan Code = 0x26
+
+ If(LEqual(Local2,0x26))
+ {
+ ADBG("CAS+L")
+ // Rotation Lock. If HID Event Driver loaded, use it. Otherwise, use GFX Driver.
+ Sleep(1000)
+
+ If(LAnd(CondRefOf(^VGBI._STA),LEqual(And(^VGBI._STA(),One),One))) // VirtualButton driver is loaded(means it is Winblue)
+ {
+ Xor(PB1E, 0x04, PB1E) // Toggle Rotation Lock Status (bit2 of PB1E)
+ ^VGBI.UPBT(ROTATION_LOCK_BUTTON, One)
+ ADBG("Notify 0xC8")
+ Notify(^VGBI, 0xC8) // Notify Virtual GPIO driver that Rotation Lock button is pressed.
+
+ ^VGBI.UPBT(ROTATION_LOCK_BUTTON, Zero)
+ ADBG("Notify 0xC9")
+ Notify(^VGBI, 0xC9) // Notify Virtual GPIO driver that Rotation Lock button is released.
+ } Else {
+ If(LEqual(\_SB.HIDD.HRDY, 1))
+ {
+ \_SB.HIDD.HPEM(2)
+ } Else {
+ ADBG("IUEH")
+ \_SB.PCI0.GFX0.IUEH(4)
+ }
+ }
+ }
+
+ // ";" Scan Code = 0x27
+ If(LEqual(Local2,0x27))
+ {
+ ADBG("CAS+;")
+
+ If(LAnd(CondRefOf(^VGBI._STA),LEqual(And(^VGBI._STA(),One),One))) // VirtualButton driver is loaded(means it is Winblue)
+ {
+ Xor(PB1E, 0x08, PB1E) // Toggle Slate/Laptop Lock Status
+ If(And(PB1E, 0x08)) // Slave/Laptop Mode changed 0 -> 1 Laptop mode
+ {
+ ^VGBI.UPBT(CONVERTIBLE_BUTTON, One)
+ ADBG("Notify 0xCD")
+ Notify(^VGBI, 0xCD) // Notify Virtual GPIO driver that the system is now in Laptop mode.
+ } Else { // Slave/Laptop Mode Changed 1 -> 0 Slate/Tablet Mode
+ ^VGBI.UPBT(CONVERTIBLE_BUTTON, Zero)
+ ADBG("Notify 0xCC")
+ Notify(^VGBI, 0xCC) // Notify Virtual GPIO driver that the system is now in Slate/Tablet mode.
+ }
+ } Else {
+ \_SB.PCI0.GFX0.IUEH(6) // Convertible Indicator lock
+ }
+ }
+
+ // "'" Scan Code = 0x28
+ If(LEqual(Local2,0x28))
+ {
+ ADBG("CAS+'")
+
+ If(LAnd(CondRefOf(^VGBI._STA),LEqual(And(^VGBI._STA(),One),One))) // VirtualButton driver is loaded(means it is Winblue)
+ {
+ Xor(PB1E, 0x10, PB1E) // Toggle Dock/Undock Status
+ If(And(PB1E, 0x10)) // Dock/Undock status changed 0 -> 1 Dock mode
+ {
+ ^VGBI.UPBT(DOCK_INDICATOR, One)
+ ADBG("Notify 0xCA")
+ Notify(^VGBI, 0xCA) // Notify Virtual GPIO driver that the system is now in Dock mode.
+ } Else { // Dock/Undock status Changed 1 -> 0 Undock mode
+ ^VGBI.UPBT(DOCK_INDICATOR, Zero)
+ ADBG("Notify 0xCB")
+ Notify(^VGBI, 0xCB) // Notify Virtual GPIO driver that the system is now in Undock mode.
+ }
+ } Else {
+ \_SB.PCI0.GFX0.IUEH(7) // Docking Indicator lock
+ }
+ }
+
+ // F1 Scan Code = 0x3B
+ If(LEqual(Local2,0x3B)) // EC passes directly to kbd buffer, Windows handles this
+ {
+ ADBG("FN+F1") // Sleep
+ If(LEqual(BID,BRH)) // BoardIdReedHarborTdv
+ {
+ ADBG("Sleep")
+ } Else {
+ If(IGDS)
+ {
+ \_SB.PCI0.GFX0.GHDS(0) // GMCH SCI hotkey display switch, table index 0
+ }
+ }
+ }
+
+ // F2 Scan Code = 0x3C
+ If(LEqual(Local2,0x3C))
+ {
+ ADBG("FN+F2")
+ If(LEqual(BID,BRH)){ // BoardIdReedHarborTdv
+// TODO: Display Sleep for Reed Harbor
+ ADBG("Display Sleep")
+ } Else {
+ If(IGDS) // all other boards
+ {
+ \_SB.PCI0.GFX0.GHDS(1) // GMCH SCI hotkey display switch, table index 1
+ }
+ }
+ }
+
+ // F3 Scan Code = 0x3D
+ If(LEqual(Local2,0x3D))
+ {
+ ADBG("FN+F3")
+ If(LEqual(BID,BRH)){ // BoardIdReedHarborTdv
+// TODO: GPIO_57 RFKILL for WiFi for Reed Harbor
+ ADBG("RFKILL")
+ } Else {
+ If(IGDS) // all other boards
+ {
+ \_SB.PCI0.GFX0.GHDS(2) // GMCH SCI hotkey display switch, table index 2
+ }
+ }
+ }
+
+ // F4 Scan Code = 0x3E
+ If(LEqual(Local2,0x3E))
+ {
+ ADBG("FN+F4")
+ // BoardIdReedHarborTdv
+ If(LEqual(BID,BRH)) // Hot Key decrease brightness.
+ {
+ If(And(4,DSEN))
+ {
+ BRTN(0x87)
+ } Else {
+ Store(BRTL, Local0)
+ // Current brightness is a percentage.
+ // This must be done if ALS if enabled, as the driver will change the brightness based on ambient light.
+ Store(\_SB.PCI0.GFX0.CBLV, BRTL)
+ // 1 % will be lost in the conversion so need to make sure we account for it.
+ AND(Add(BRTL, 1),0xFE, BRTL)
+ If(LGreaterEqual(BRTL, 10))
+ {
+ Subtract(BRTL, 10, BRTL)
+ }
+ \_SB.PCI0.GFX0.AINT(1, BRTL)
+ }
+ } Else { // Hot Key Display Switch for all other boards.
+ If(IGDS)
+ {
+ \_SB.PCI0.GFX0.GHDS(3) // GMCH SCI hotkey display switch, table index 3
+ }
+ }
+ }
+
+ If(LEqual(BID,BRH)) // BoardIdReedHarborTdv
+ {
+ // F5 Scan Code = 0x3F
+ If(LEqual(Local2,0x3F))
+ {
+ ADBG("FN+F5") // brightness up
+ If(And(4,DSEN))
+ {
+ BRTN(0x86)
+ } Else {
+ Store(BRTL, Local0)
+ // Current brightness is a percentage.
+ // This must be done if ALS if enabled, as the driver will change the brightness based on ambient light.
+ Store(\_SB.PCI0.GFX0.CBLV, BRTL)
+ // 1 % will be lost in the conversion so need to make sure we account for it.
+ AND(Add(BRTL, 1),0xFE, BRTL)
+ If(LLessEqual(BRTL, 90))
+ {
+ Add(BRTL, 10, BRTL)
+ }
+ \_SB.PCI0.GFX0.AINT(1, BRTL)
+ }
+ } // end If(LEqual(Local2,0x3E))
+ } Else { // all other boards
+ // Virtual Battery Hot Keys(VBHK) - VBHK uses keys 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, -, + and F5.
+ If(LEqual(BNUM,0)) // Check for Virtual Battery Mode before testing the hot-keys specific to Virtual Battery Support.
+ {
+ VBHK() // remove this call if no virtual battery is needed.
+ }
+ }
+
+ // F6 Scan Code = 0x40
+ If(LEqual(Local2,0x40))
+ {
+ ADBG("FN+F6")
+ If(LEqual(BID,BRH)) // BoardIdReedHarborTdv
+ {
+ If(IGDS) // toggle display
+ {
+ \_SB.PCI0.GFX0.GHDS(0) // GMCH SCI hotkey display switch, table index 0
+ }
+ } Else {
+ If(IGDS) // Cycle Brightness for all other boards
+ {
+ If(CondRefOf(HGAS))
+ {
+ HGAS()
+ } Else {
+ If(And(4,DSEN))
+ {
+ BRTN(0x85)
+ }
+ }
+ }
+ }
+ }
+
+ // Disable these Function keys for Reed Harbor.
+ If(LEqual(BID,BRH)) // BoardIdReedHarborTdv
+ {
+ // F7 Scan Code = 0x41
+ If(LEqual(Local2,0x41)) // EC passes directly to kbd buffer
+ {
+ ADBG("FN+F7") // mute
+ }
+ // F8 Scan Code = 0x42
+ If(LEqual(Local2,0x42)) // EC passes directly to kbd buffer
+ {
+ ADBG("FN+F8") // volume down
+ }
+ // F9 Scan Code = 0x43
+ If(LEqual(Local2,0x43)) // EC passes directly to kbd buffer
+ {
+ ADBG("FN+F9") // volume up
+ }
+ // F10 Scan Code = 0x44
+ If(LEqual(Local2,0x44)) // blank
+ {
+ ADBG("FN+10")
+ }
+ } Else {
+
+ // F7 Scan Code = 0x41
+ If(LEqual(Local2,0x41)) // Zero Brightness
+ {
+ If(IGDS)
+ {
+ If(CondRefOf(CHPS))
+ {
+ CHPS() //Display the current hybrid policy on Port 80 header
+ } Else {
+ If(And(4,DSEN))
+ {
+ BRTN(0x88)
+ }
+ }
+ }
+ }
+
+ // F8 Scan Code = 0x42
+ If(LEqual(Local2,0x42)) // Panel Fitting Hot Key.
+ {
+ If(IGDS)
+ {
+ If(CondRefOf(HPFS))
+ {
+ HPFS()
+ } Else {
+ \_SB.PCI0.GFX0.AINT(2, 0)
+ }
+ }
+ }
+
+ // F9 Scan Code = 0x43
+ If(LEqual(Local2,0x43)) // Decrease Brightness Level.
+ {
+ If(CondRefOf(HBRT))
+ {
+ HBRT(4)
+ }
+ If(IGDS)
+ {
+ If(And(4,DSEN))
+ {
+ BRTN(0x87)
+ } Else {
+ Store(BRTL, Local0)
+ // Current brightness is a percentage.
+ // This must be done if ALS if enabled, as the driver will change the brightness based on ambient light.
+ Store(\_SB.PCI0.GFX0.CBLV, BRTL)
+ // 1 % will be lost in the conversion so need to make sure we account for it.
+ AND(Add(BRTL, 1),0xFE, BRTL)
+ If(LGreaterEqual(BRTL, 10))
+ {
+ Subtract(BRTL, 10, BRTL)
+ }
+ \_SB.PCI0.GFX0.AINT(1, BRTL)
+ }
+ }
+ }
+
+ // F10 Scan Code = 0x44
+ If(LEqual(Local2,0x44)) // Increase Brightness Level.
+ {
+ If(CondRefOf(HBRT))
+ {
+ HBRT(3)
+ }
+ If(IGDS)
+ {
+ If(And(4,DSEN))
+ {
+ BRTN(0x86)
+ } Else {
+ Store(BRTL, Local0)
+ // Current brightness is a percentage.
+ // This must be done if ALS if enabled, as the driver will change the brightness based on ambient light.
+ Store(\_SB.PCI0.GFX0.CBLV, BRTL)
+ // 1 % will be lost in the conversion so need to make sure we account for it.
+ AND(Add(BRTL, 1),0xFE, BRTL)
+ If(LLessEqual(BRTL, 90))
+ {
+ Add(BRTL, 10, BRTL)
+ }
+ \_SB.PCI0.GFX0.AINT(1, BRTL)
+ }
+ }
+ }
+ } // end If(LEqual(BID,BRH))
+
+ // "F12" Scan Code = 0x58
+ If(LEqual(Local2,0x58))
+ {
+ // Airplane Mode toggle.
+ If(\_SB.HIDD.HRDY)
+ {
+ \_SB.HIDD.HPEM(8)
+ }
+ }
+
+ // Calculator (-) Key = 0x4A
+
+ If(LEqual(Local2,0x4A)) // ACPI Debug Mode is Off.
+ {
+ Store(0,DBGS)
+ }
+
+ // Calculator (+) Key = 0x4E
+
+ If(LEqual(Local2,0x4E)) // ACPI Debug Mode is On.
+ {
+ Store(1,DBGS)
+ }
+
+ // Calculator (Enter) Key = 0x1C
+ If(LEqual(Local2,0x1C)) // Set ACPI Break Point.
+ {
+ BreakPoint
+ }
+
+
+ // "D" Scan Code = 0x20
+ If(LEqual(Local2,0x20)) // Virtual Dock
+ {
+ \_SB.PCI0.GFX0.GDCK(1)
+ }
+
+ // "U" Scan Code = 0x16
+ If(LEqual(Local2,0x16)) // Virtual Undock
+ {
+ \_SB.PCI0.GFX0.GDCK(0)
+ }
+
+ // "0" Scan Code = 0x01
+ If(LEqual(Local2,0x01)) // Toggle Wireless On/Off state.
+ {
+
+ }
+
+
+
+ // HK: "O" Scan Code = 0x18
+ If(LEqual(Local2,0x18)) // CTDP Up
+ {
+ If(LAnd(CondRefOf(\_SB.PCI0.CTCU),LEqual(CTDB,1))){ // only allow this feature if it is enabled in SETUP
+ \_SB.PCI0.CTCU()
+ }
+ }
+
+ // HK: "[" Scan Code = 0x1A
+ If(LEqual(Local2,0x1A)) // CTDP Nominal
+ {
+ If(LAnd(CondRefOf(\_SB.PCI0.CTCN),LEqual(CTDB,1))){ // only allow this feature if it is enabled in SETUP
+ \_SB.PCI0.CTCN()
+ }
+ }
+
+ // HK: "]" Scan Code = 0x1B
+ If(LEqual(Local2,0x1B)) // CTDP Down
+ {
+ If(LAnd(CondRefOf(\_SB.PCI0.CTCD),LEqual(CTDB,1))){ // only allow this feature if it is enabled in SETUP
+ \_SB.PCI0.CTCD()
+ }
+ }
+
+ // "Fn+F12" Scan Code = 0x62
+ If(LEqual(Local2,0x62)) // Web-Cam power control
+ {
+ P8XH(0, 0x62)
+ }
+
+ } // end Method(_Q52) hot key event
+
+ Method(_Q54) // Power Button Event for iSCT and Control method Power Button(10sec PB Override without V-GPIO driver)
+ {
+
+ P8XH(0,0x54)
+
+ //
+ // iSCT and 10Sec PB Override are now mutual exclusive at least for this event.
+ // Make sure iSCT is enabled before notifying IAOE.
+ //
+ If(And(ICNF, 1))
+ {
+ Notify(IAOE,0x80)
+ }
+
+ //
+ // Check if 10sec PB Override and EC 10sec mode.
+ // If 10sec PB OVR is enabled but EC 10sec mode is not enabled, then BIOS has to handle
+ // Power button event.
+ // PB1E Bit0 -> Setup setting for 10sec PB OVR
+ // PB10 -> EC setting for 10sec PB OVR
+ //
+ If(LAnd(And(PB1E, 1), LNot(ECRD(RefOf(PB10))))){
+
+ //
+ // Check UAMS(User Absent Mode State) to notify the power button event.
+ //
+ If(UAMS){ // UAMS has a non-Zero value, means the system is under User Absent Mode. Send Wake up event.
+ ADBG("PB Wake up 0x02")
+ If(CondRefOf(\_SB.PWRB)){
+ Notify(\_SB.PWRB, 0x02)
+ }
+ } Else { // UAMS is Zero, means the system is ON. Send Sleep event.
+ ADBG("PB Sleep 0x80")
+ If(CondRefOf(\_SB.PWRB)){
+ Notify(\_SB.PWRB, 0x80)
+ }
+ }
+ }
+ } // end Method(_Q54) Power button event.
+
+ Method (_Q70) // ALS "Light Intensity" event
+ {
+ P8XH(0,0x70)
+
+ // Update the LUX Values.
+
+ Store(ECRD(RefOf(LUXH)),LHIH)
+ Store(ECRD(RefOf(LUXL)),LLOW)
+
+ If(LAnd(LEqual(ALSE,2),IGDS))
+ {
+ // Handle the ALS event via the OpRegion method
+
+ Store(ECRD(RefOf(LUXH)), Local0)
+ Or(ShiftLeft(Local0, 8), ECRD(RefOf(LUXL)), Local0)
+ \_SB.PCI0.GFX0.AINT(0, Local0)
+ Notify(ALSD,0x80) // notify MS driver of change
+ }
+ }
+
+ Method(_QD5) // 10 second power button press.
+ {
+ If(LAnd(CondRefOf(^VGBI._STA),LEqual(And(^VGBI._STA(),One),One))) // VirtualButton driver is loaded(means it is Winblue)
+ {
+ ^VGBI.UPBT(POWER_BUTTON, One)
+ ADBG("Notify 0xC0")
+ ECMD (0x2D) // Wake up EC first. This is needed to get the release event immediately after press event.
+ Notify(^VGBI, 0xC0) // Notify Virtual GPIO driver that the power button is pressed.
+ } Else {
+ If(CondRefOf(\_SB.PCI0.GFX0.IUER))
+ {
+ Store(\_SB.PCI0.GFX0.IUER, Local0)
+ And(Local0, 0xC0, \_SB.PCI0.GFX0.IUER) // Clear 4:0 button events on entry.
+ Store(\_SB.PCI0.GFX0.IUER, Local0)
+ Or(Local0, 0x01, \_SB.PCI0.GFX0.IUER) // Set Power Button Status = pressed.
+ }
+ } // End IF
+ }// End of Method
+
+ Method(_QD6) // 10 second power button de-press.
+ {
+ If(LAnd(CondRefOf(^VGBI._STA),LEqual(And(^VGBI._STA(),One),One))) // VirtualButton driver is loaded(means it is Winblue)
+ {
+ ^VGBI.UPBT(POWER_BUTTON, Zero)
+ ADBG("Notify 0xC1")
+ Notify(^VGBI, 0xC1) // Notify Virtual GPIO driver that the power button is released.
+ } Else {
+ If(CondRefOf(\_SB.PCI0.GFX0.IUER))
+ {
+ Store(\_SB.PCI0.GFX0.IUER, Local0)
+ And(Local0, 0xC0, \_SB.PCI0.GFX0.IUER) // Clear 4:0 button events on entry.
+ }
+ }
+ }
+//
+// Reed Harbor hardware buttons.
+//
+ Method(_Q80) // Volume Up
+ {
+ If(LEqual(BID,BRH)){ // BoardIdReedHarborTdv
+ADBG("Volume Up")
+ \_SB.PCI0.GFX0.IUEH(2)
+ }
+ }
+ Method(_Q81) // Volume Down
+ {
+ If(LEqual(BID,BRH)){ // BoardIdReedHarborTdv
+ADBG("Volume Down")
+ \_SB.PCI0.GFX0.IUEH(3)
+ }
+ }
+ Method(_Q85) // Windows Home button
+ {
+ If(LEqual(BID,BRH)){ // BoardIdReedHarborTdv
+ADBG("Windows Home")
+ Sleep(1000)
+ \_SB.PCI0.GFX0.IUEH(1)
+ }
+ }
+
+ Method(_QF0) // Thermal Event.
+ {
+ If(LEqual(DBGS,0))
+ {
+ // Only handle the numerous Thermal Events if
+ // we are NOT doing ACPI Debugging.
+ Notify(\_TZ.TZ00,0x80)
+ Notify(\_TZ.TZ01,0x80)
+ }
+ }
+
+Device(WDT0) // WDT Device Resource Consumption
+{
+ Name(_HID,EISAID("PNP0C02"))
+
+ Name(_UID,3)
+
+ Name(_CRS,ResourceTemplate()
+ {
+ IO(Decode16,0x6A4,0x6A4,0x1,0x1) // 1 Byte EC Prv Intfc.
+ IO(Decode16,0x6A0,0x6A0,0x1,0x1) // 1 Byte EC Prv Intfc.
+ })
+}
+
+/************************************************************************;
+;*
+;* Name: CHDK
+;*
+;* Description: Check DOCK status, returen True if Dock status equal Arg0
+;*
+;************************************************************************/
+
+ Method(CHDK, 1)
+ {
+ // If not Mobile Platform then skip the code and return 0
+ If(LEqual(ECON,1)){
+ If(LEqual(ECRD(RefOf(DOCK)), Arg0))
+ { // If not docked then it's hot plug
+ Return(1)
+ }
+ }
+ Return(0)
+ }
+
+ //
+ // Hardware Button Array support
+ //
+
+ Device(BIND) // Button Indicators.
+ {
+ Name(_HID, "INT33D2")
+ Name(_CID, "PNP0C40")
+
+ Method(_STA, 0,Serialized)
+ {
+ If(LAnd(And(IUBE,1), LGreaterEqual(OSYS, 2012)))
+ {
+ Return(0x000F)
+ }
+ Return(0x00)
+ }
+ //
+ // _DSM : Device Specific Method for the Windows Compatible Button Array.
+ //
+ // Arg0: UUID Unique function identifier
+ // Arg1: Integer Revision Level
+ // Arg2: Integer Function Index
+ // Arg3: Package Parameters
+ //
+ Method (_DSM, 4, Serialized, 0, UnknownObj, {BuffObj, IntObj, IntObj, PkgObj})
+ {
+ // Compare passed in UUID to supported UUID.
+
+ If (LEqual(Arg0, ToUUID ("DFBCF3C5-E7A5-44E6-9C1F-29C76F6E059C")))
+ {
+ If (LEqual(0,ToInteger(Arg1))) // Revision 0.
+ {
+ Switch (ToInteger(Arg2)) // Switch to Function Index.
+ {
+ //
+ // Function 0, Query of supported functions.
+ //
+
+ Case (0)
+ {
+ Return (Buffer() {0x03})
+ }
+
+ //
+ // Function 1, Windows Compatible Button Array Power Button Properties.
+ //
+
+ Case (1)
+ {
+ // Only return support if platform enabled via setup.
+ // PB1E's Bit0 is set only when both CS and 10s PB OVR are enabled.
+ If(LEqual(And(PB1E, 1), 1))
+ {
+ Return (0x07)
+ }
+
+ Return(0x00)
+
+ }
+ } // End Switch statement
+ } // End Revision check
+ } // End UUID check
+
+ // If the code falls through to this point, just return a buffer of 0.
+
+ Return (Buffer() {0x00})
+
+ } // End _DSM Method
+ }
+
+ Device(CIND) // Convertible Indicators.
+ {
+ Name(_HID, "INT33D3")
+ Name(_CID, "PNP0C60")
+
+ Method(_STA, 0,Serialized)
+ {
+ If(LAnd(And(IUCE,1), LGreaterEqual(OSYS, 2012)))
+ {
+ Return(0x000F)
+ }
+ Return(0x00)
+ }
+ }
+
+ Device(DIND) // Docking Indicators.
+ {
+ Name(_HID, "INT33D4")
+ Name(_CID, "PNP0C70")
+ Method(_STA, 0,Serialized)
+ {
+ If(LAnd(And(IUDE,1), LGreaterEqual(OSYS, 2012)))
+ {
+ Return(0x000F)
+ }
+ Return(0x00)
+ }
+ }
+
+ Device(VGBI) // Virtual GPIO Button "Interface."
+ {
+
+ Name(_HID, EISAID("INT33D6")) // HID for Intel Virtual GPIO Button Interface.
+ Name(VBDS,0)
+ Name(ONTM,0) // Temporary variable to initialise VBDS only once in the boot
+
+ Method(_STA,0,Serialized)
+ {
+ If(LGreaterEqual(OSYS,2013)) // Virtual Button applicable for Winblue and higher version of WinOS
+ {
+ ADBG("WinB VGBI STA")
+ Return(0x0F) // Device present,enabled and should be shown in UI.
+ } Else {
+ Return(0x00) // Device NOT present
+ }
+ }// End of _STA
+
+ Method(VBDL,0,Serialized) // Virtual Button Driver Load - Refer Bios Arch Spec
+ {
+ ADBG("VBDL")
+ If(LEqual(And(PB1E,One),One)){ // 10 Sec Power Button Enabled in setup?
+ ADBG("VBDL EN")
+
+ //
+ // Clear PBST so that we can hide the default power button.
+ //
+ If(CondRefOf(\_SB.PWRB.PBST))
+ {
+ Store(0, \_SB.PWRB.PBST)
+ Notify(\_SB.PWRB, 1) // Device check
+ }
+
+ // First send 0x74 to EC to disable _Q54 event for Power button.
+ If(CondRefOf(ECMD)){
+ ADBG("Disable _Q54")
+ ECMD(0x74)
+ }
+
+ // Set EC 10s enable bit.
+ ECWT(1, RefOf(PB10))
+
+ } Else {
+ // 10s power button disabled, clear EC 10s enable bit.
+ ADBG("VBDL DIS")
+ ECWT(0, RefOf(PB10))
+
+ //
+ // Here we know V-GPIO driver is loaded but 10s PB is disabled.
+ // Set PBST so that the default power button can handle the request.
+ //
+ If(CondRefOf(\_SB.PWRB.PBST))
+ {
+ Store(1, \_SB.PWRB.PBST)
+ Notify(\_SB.PWRB, 1) // Device check
+ }
+ }
+ }
+
+ Method(VGBS,0,Serialized) // Virtual GPIO Button Status - Refer Bios Arch Spec
+ {
+ // Bit[7] : Docking Indicatory Status
+ // Bit[6] : Convertible/Slate Indicator Status
+ // Bit[5] : Reserved
+ // Bit[4] : Rotation Lock Button Status
+ // Bit[3] : Volume Down Button Status
+ // Bit[2] : Volume Up Button Status
+ // Bit[1] : Windows Home Button Status
+ // Bit[0] : Power Button Status
+
+ ADBG("VGBS")
+ If(LEqual(ONTM,0))
+ {
+ // Initial setup option on VBDS and thereafter hotkeys should be updating the VBDS
+ if(LEqual(And(PB1E,0x04),0x04)) // Rotation Lock
+ {
+ UPBT(ROTATION_LOCK_BUTTON,One)
+ }
+
+ if(LEqual(And(PB1E,0x08),0x08)) // Slate/Laptop
+ {
+ UPBT(CONVERTIBLE_BUTTON,One)
+ }
+
+ if(LEqual(And(PB1E,0x10),0x10)) // Undock/Dock
+ {
+ UPBT(DOCK_INDICATOR,One)
+ }
+ Store(One,ONTM)
+ }
+ Return(VBDS)
+ }// End of Method
+
+ //
+ // UPBT Update Button Status
+ //
+ // Arg0: Bit location of the target button
+ // 0: Power Button
+ // 1: Windows Button
+ // 2: Volume up Button
+ // 3: Volume down Button
+ // 4: Rotation Lock Button
+ // 5: Reserved
+ // 6: Convertible state 0 - Slate, 1 - Notebook
+ // 7: Dock Indicator 0 - Undock, 1 - Dock
+ //
+ // Arg1: On/Off state, 0 - Clear the target bit, 1 - Set the target bit.
+ //
+ Method(UPBT,2,Serialized) // Update Button Status
+ {
+ ShiftLeft(One, Arg0, Local0)
+ if(Arg1){ // Button Press/ON
+ Or(VBDS, Local0, VBDS)
+ } Else { // Button Press/OFF
+ And(VBDS, Not(Local0),VBDS)
+ }
+ } // End of UPBT
+
+ Method(PBIN, 0, Serialized)
+ {
+ ADBG("VGBI PB INIT")
+ //
+ // Send EC 0x73 command to make 0x54 Power button notification is available.
+ // This is needed to support no Virtual GPIO driver case.
+ // Once the driver calls VBDL, VBDL sends 0x74(disable PB 0x54) to EC.
+ //
+ If(LAnd(And(PB1E, 1), LNot(ECRD(RefOf(PB10)))))
+ {
+ If(CondRefOf(\_SB.PWRB.PBST))
+ {
+ Store(1, \_SB.PWRB.PBST)
+ Notify(\_SB.PWRB, 1) // Device check
+ }
+ If(CondRefOf(ECMD)){
+ ADBG("Enable _Q54")
+ ECMD(0x73) // Enable Power Button 0x54 Notification
+ }
+ }
+ }
+ } // End of VGBI
+
+} // End H_EC
+
+ // System Bus
+
+Scope(\_SB)
+{
+
+ // Define an AC Device.
+
+ Device(ADP1)
+ {
+ Name(_HID,"ACPI0003")
+
+ Method(_STA)
+ {
+ If (LEqual(ECON,1)){
+ Return(0x0F)
+ }
+ Return(0x00)
+ }
+
+ // Return the value that determines if running
+ // from AC or not.
+
+ Method(_PSR,0)
+ {
+ Return(PWRS)
+ }
+
+ // Return that everything runs off of AC.
+
+ Method(_PCL,0)
+ {
+ Return(\_SB)
+ }
+ }
+
+ // Define a Lid Switch.
+
+ Device(LID0)
+ {
+ Name(_HID,EISAID("PNP0C0D"))
+
+ Method(_STA)
+ {
+ If(LEqual(ECON,1)){
+ Return(0x0F)
+ }
+ Return(0x00)
+ }
+
+ Method(_LID,0)
+ {
+ // 0 = Closed, 1 = Open.
+
+ Return(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.LSTE)))
+ }
+ }
+
+ // Define a (Control Method) Power Button.
+
+ Device(PWRB)
+ {
+ Name(_HID,EISAID("PNP0C0C"))
+
+ // The PRW isn't working when
+ // placed in any of the logical locations ( PS2K, PS2M,
+ // H_EC ), so a Power Button Device was created specifically
+ // for the WAKETIME_SCI PRW.
+
+ //
+ // Power button status flag used to communicate H_EC.VBDL
+ //
+ Name(PBST, 1)
+
+ Method(_PRW, 0) {
+ If(LEqual(LANP,1)){
+ //
+ // When LAN is present, GPIO27 becomes ME GPIO(HSD 4834440). Remove PBT.
+ //
+ Return(Package(){0,0})
+ }
+ If(LEqual(BID, BWT1))
+ {
+ Return(Package(){27,4}) // GPI027 = GPE27 for WhiteTipMountain1
+ }
+ If(LEqual(BID, BW1P))
+ {
+ Return(Package(){27,4}) // GPI027 = GPE27 for WhiteTipMountain1 PPV
+ }
+ If(LEqual(BID, BW2C))
+ {
+ Return(Package(){27,4}) // GPI027 = GPE27 for WhiteTipMountain2
+ }
+ If(LEqual(BID, BW2P))
+ {
+ Return(Package(){27,4}) // GPI027 = GPE27 for WhiteTipMountain2 PPV
+ }
+ If(LEqual(BID, BSPC))
+ {
+ Return(Package(){27,4}) // GPI027 = GPE27 for SawToothPeak
+ }
+ If(LEqual(BID, BSPP))
+ {
+ Return(Package(){27,4}) // GPI027 = GPE27 for SawToothPeak PPV
+ }
+
+ Return(Package(){30,4}) //GPI14 = GPE30 = Waketime SCI for Haswell Traditional boards
+ }
+
+ Method(_STA, 0)
+ {
+ If(LAnd(LEqual(ECON,1), PBST)){
+ Return(0x0F)
+ }
+ Return(0x00)
+ }
+
+ }//end device PWRB
+
+ Device(HIDD) // HID Device.
+ {
+ Name(_HID,"INT33D5") // Intel Ultrabook HID Platform Event Driver.
+ Name(_CID,"PNP0C02") // Generic Motherboard Resources.
+
+ Name (HBSY, 0) // HID Busy
+ Name (HIDX, 0) // HID Index
+ Name (HMDE, 0) // HID Mode
+ Name (HRDY, 0) // HID Ready
+
+ Method(_STA,0,Serialized) // Status Method.
+ {
+ If(LEqual(BID, BHB)) // Hide device for HarrisBeach
+ {
+ Return(0x00)
+ }
+ Else
+ {
+ Return(0x0F)
+ }
+ }
+
+ //
+ // HID Driver Descriptor Method - Called by HID Driver during initialization
+ // to obtain HID Descriptor information.
+ //
+ // Input: None
+ //
+ // Output: Package containing a complete HID Descriptor information.
+ //
+ Method(HDDM,0,Serialized)
+ {
+ // Placeholder.
+ Name(DPKG, Package(4) {0x11111111, 0x22222222, 0x33333333, 0x44444444})
+ Return(DPKG)
+ }
+
+ //
+ // HID Driver Event Method - Called by HID Driver to get the specific
+ // platform event.
+ //
+ // Input: None
+ //
+ // Output: Plastform HID Event.
+ // Mode 0 = Index of HID Input Report, per pre-defined Table.
+ // Mode 1 = Package containing a complete HID Input Report.
+ //
+ Method(HDEM,0,Serialized)
+ {
+ Store(0,HBSY) // Clear HID Busy.
+ // Simple Mode is hardcoded for now. Return Simple Mode HID Index Value.
+ If(LEqual(HMDE,0))
+ {
+ Return(HIDX)
+ }
+ Return(HMDE)
+ }
+
+ //
+ // HID Driver Mode Method - Called by HID Driver during initialization to get
+ // the platform mode of operation.
+ //
+ // Input: None
+ //
+ // Output: Mode the platform is running in.
+ // 0 = Simple Mode.
+ // 1 = Advanced Mode.
+ //
+ Method(HDMM,0,Serialized)
+ {
+ Return(HMDE) // Return Mode of operation.
+ }
+
+ //
+ // HID Driver Status Method - called by HID Driver to report platform readiness status.
+ // Input: Driver Status.
+ // 0 = Driver Unloaded.
+ // 1 = Driver Loaded and Ready.
+ //
+ // Output: None
+ //
+ Method(HDSM,1,Serialized)
+ {
+ Store(Arg0,HRDY) // Store HID Ready Status.
+ // Eventually code will communicate to platform the Driver status (enabled/disabled).
+ }
+
+ //
+ // HID Platform Event Method - called by Platform to communicate HID Event to Driver.
+ // Input:
+ // Mode 0 = Index of HID Event.
+ // Mode 1 = Package containing a complete HID Report.
+ //
+ Method(HPEM,1,Serialized) // HID Platform Event Method.
+ {
+ Store(1,HBSY) // Set HID Busy.
+ // Simple Mode is hardcoded for now. Simply store HID Index value.
+ If(LEqual(HMDE,0))
+ {
+ Store(Arg0,HIDX)
+ } Else {
+ Store(Arg0,HIDX)
+ }
+ Notify(\_SB.HIDD,0xC0) // Notify Driver to get HID Event.
+ Store(0,Local0) // Initialize Local0 as a timeout counter.
+ While(LAnd(LLess(Local0,250),HBSY)) // Wait <= 1 second for Driver to ACK success.
+ {
+ Sleep(4) // Delay 4 ms.
+ Increment(Local0) // Increment Timeout.
+ }
+ If(LEqual(HBSY,1)) // Failure?
+ {
+ Store(0,HBSY) // Yes. Clear HID Busy Flag.
+ Store(0,HIDX) // Set HID Simple Mode Index = 0 = Undefined.
+ Return(1) // Return Failure.
+ } Else {
+ Return(0) // Return Success.
+ }
+ }
+ }
+
+
+}//end scope _SB
+
+
diff --git a/ReferenceCode/AcpiTables/Dsdt/GloblNvs.asl b/ReferenceCode/AcpiTables/Dsdt/GloblNvs.asl
new file mode 100644
index 0000000..07f4381
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dsdt/GloblNvs.asl
@@ -0,0 +1,560 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Haswell *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+
+
+
+ // Define a Global region of ACPI NVS Region that may be used for any
+ // type of implementation. The starting offset and size will be fixed
+ // up by the System BIOS during POST. Note that the Size must be a word
+ // in size to be fixed up correctly.
+
+ OperationRegion(GNVS,SystemMemory,0xFFFF0000,0xAA55)
+ Field(GNVS,AnyAcc,Lock,Preserve)
+ {
+ Offset(0), // Miscellaneous Dynamic Registers:
+ OSYS, 16, // (000) Operating System
+ SMIF, 8, // (002) SMI Function Call (ASL to SMI via I/O Trap)
+ PRM0, 8, // (003) SMIF - Parameter 0
+ PRM1, 8, // (004) SMIF - Parameter 1
+ SCIF, 8, // (005) SCI Function Call (SMI to ASL via _L00)
+ PRM2, 8, // (006) SCIF - Parameter 0
+ PRM3, 8, // (007) SCIF - Parameter 1
+ LCKF, 8, // (008) Global Lock Function Call (EC Communication)
+ PRM4, 8, // (009) LCKF - Parameter 0
+ PRM5, 8, // (010) LCKF - Parameter 1
+ P80D, 32, // (011) Port 80 Debug Port Value
+ PWRS, 8, // (015) Power State (AC Mode = 1)
+ DBGS, 8, // (016) Debug State
+ Offset(17), // Thermal Policy Registers:
+ THOF, 8, // (017) Enable Thermal Offset for KSC
+ ACT1, 8, // (018) Active Trip Point 1
+ ACTT, 8, // (019) Active Trip Point
+ PSVT, 8, // (020) Passive Trip Point
+ TC1V, 8, // (021) Passive Trip Point TC1 Value
+ TC2V, 8, // (022) Passive Trip Point TC2 Value
+ TSPV, 8, // (023) Passive Trip Point TSP Value
+ CRTT, 8, // (024) Critical Trip Point
+ DTSE, 8, // (025) Digital Thermal Sensor Enable
+ DTS1, 8, // (026) Digital Thermal Sensor 1 Reading
+ DTS2, 8, // (027) Digital Thermal Sensor 2 Reading
+ DTSF, 8, // (028) DTS SMI Function Call
+ Offset(30), // Battery Support Registers: (Moved outside this ASL code but still in used)
+// BNUM, 8, // (030) Battery Number Present
+// B0SC, 8, // (031) Battery 0 Stored Capacity
+// B1SC, 8, // (032) Battery 1 Stored Capacity
+// B2SC, 8, // (033) Battery 2 Stored Capacity
+// B0SS, 8, // (034) Battery 0 Stored Status
+// B1SS, 8, // (035) Battery 1 Stored Status
+// B2SS, 8, // (036) Battery 2 Stored Status
+ Offset(37), // Revision Field:
+ REVN, 8, // (037) Revison of GlobalNvsArea
+ Offset(40), // CPU Identification Registers:
+ APIC, 8, // (040) APIC Enabled by SBIOS (APIC Enabled = 1)
+ TCNT, 8, // (041) Number of Enabled Threads
+ PCP0, 8, // (042) PDC Settings, Processor 0
+ PCP1, 8, // (043) PDC Settings, Processor 1
+ PPCM, 8, // (044) Maximum PPC state
+ PPMF, 32, // (045) PPM Flags (Same as CFGD)
+ C67L, 8, // (049) C6/C7 Entry/Exit latency
+ Offset(50), // SIO CMOS Configuration Registers:
+ NATP, 8, // (050) National SIO Present
+ CMAP, 8, // (051) COM A Port
+ CMBP, 8, // (052) COM B Port
+ LPTP, 8, // (053) LPT Port
+ FDCP, 8, // (054) FDC Port
+ CMCP, 8, // (055) SMSC Com Port
+ CIRP, 8, // (056) SMSC Com CIR Port
+ SMSC, 8, // (057) SMSC1007 SIO Present
+ W381, 8, // (058) WPCN381U SIO Present
+ SMC1, 8, // (059) SMSC1000 SIO Present
+ EMAE, 8, // (060) EMA Enable
+ EMAP, 16, // (061) EMA Pointer
+ EMAL, 16, // (063) EMA Length
+ Offset(66), // MEF Registers:
+ MEFE, 8, // (066) MEF Enable
+ Offset(67), // PCIe Dock:
+ DSTS, 8, // (067) PCIe Dock Status
+ Offset(72), // TPM Registers:
+ MORD, 8, // (072) Memory Overwrite Request Data
+ TCGP, 8, // (073) Used for save the Mor and/or physical presence paramter
+ PPRP, 32, // (074) Physical Presence request operation response
+ PPRQ, 8, // (078) Physical Presence request operation
+ LPPR, 8, // (079) Last Physical Presence request operation
+ Offset(80), // SATA Registers:
+ GTF0, 56, // (080) GTF Task File Buffer for Port 0
+ GTF2, 56, // (087) GTF Task File Buffer for Port 2
+ IDEM, 8, // (094) IDE Mode (Compatible\Enhanced)
+ GTF1, 56, // (095) GTF Task File Buffer for Port 1
+ BID, 16, // (102) Platform board id
+ PLID, 8, // (104) Platform id
+ ECTG, 8, // (105) Toggle EC
+ Offset(112),
+ OSCC, 8, // (112) PCIE OSC Control
+ NEXP, 8, // (113) Native PCIE Setup Value
+ Offset(114),
+ SBV1, 8, // (114) USB Sideband Deferring GPE Vector (HOST_ALERT#1)
+ SBV2, 8, // (115) USB Sideband Deferring GPE Vector (HOST_ALERT#2)
+ Offset(122), // Global Variables
+ DSEN, 8, // (122) _DOS Display Support Flag.
+ ECON, 8, // (123) Embedded Controller Availability Flag.
+ GPIC, 8, // (124) Global IOAPIC/8259 Interrupt Mode Flag.
+ CTYP, 8, // (125) Global Cooling Type Flag.
+ L01C, 8, // (126) Global L01 Counter.
+ VFN0, 8, // (127) Virtual Fan0 Status.
+ VFN1, 8, // (128) Virtual Fan1 Status.
+ VFN2, 8, // (129) Virtual Fan2 Status.
+ VFN3, 8, // (130) Virtual Fan3 Status.
+ VFN4, 8, // (131) Virtual Fan4 Status.
+ VFN5, 8, // (132) Virtual Fan5 Status.
+ VFN6, 8, // (133) Virtual Fan6 Status.
+ VFN7, 8, // (134) Virtual Fan7 Status.
+ VFN8, 8, // (135) Virtual Fan8 Status.
+ VFN9, 8, // (136) Virtual Fan9 Status.
+
+ Offset(143),
+ ATMC, 8, // (143) Active Trip Point for MCH
+ PTMC, 8, // (144) Passive Trip Point for MCH
+ ATRA, 8, // (145) Active Trip Point for TMEM
+ PTRA, 8, // (146) Passive Trip Point for TMEM
+ PNHM, 32, // (147) CPUID Feature Information [EAX]
+ TBAB, 32, // (151) Thermal Base Low Address for BIOS
+ TBAH, 32, // (155) Thermal Base High Address for BIOS
+ RTIP, 8, // (159) Run Time Interface for Intelligent Power Savings
+ TSOD, 8, // (160) TS-on-DIMM is chosen in SETUP and present on the DIMM
+ ATPC, 8, // (161) Active Trip Point for PCH
+ PTPC, 8, // (162) Passive Trip Point for PCH
+ PFLV, 8, // (163) Platform Flavor
+ BREV, 8, // (164) Board Rev
+ Offset(165),
+ PDTS, 8, // (165) Package Temperature
+ PKGA, 8, // (166) Package Temperature MSR available
+ PAMT, 8, // (167) Peci Access Method
+ AC0F, 8, // (168) _AC0 Fan Speed
+ AC1F, 8, // (169) _AC1 Fan Speed
+ DTS3, 8, // (170) Digital Thermal Sensor 3 Reading
+ DTS4, 8, // (171) Digital Thermal Sensor 4 Reading
+ Offset(176), // (172):(175) are reserved for future use
+ LTR1, 8, // (176) Latency Tolerance Reporting Enable
+ LTR2, 8, // (177) Latency Tolerance Reporting Enable
+ LTR3, 8, // (178) Latency Tolerance Reporting Enable
+ LTR4, 8, // (179) Latency Tolerance Reporting Enable
+ LTR5, 8, // (180) Latency Tolerance Reporting Enable
+ LTR6, 8, // (181) Latency Tolerance Reporting Enable
+ LTR7, 8, // (182) Latency Tolerance Reporting Enable
+ LTR8, 8, // (183) Latency Tolerance Reporting Enable
+ Offset(184),
+ OBF1, 8, // (184) Optimized Buffer Flush and Fill
+ OBF2, 8, // (185) Optimized Buffer Flush and Fill
+ OBF3, 8, // (186) Optimized Buffer Flush and Fill
+ OBF4, 8, // (187) Optimized Buffer Flush and Fill
+ OBF5, 8, // (188) Optimized Buffer Flush and Fill
+ OBF6, 8, // (189) Optimized Buffer Flush and Fill
+ OBF7, 8, // (190) Optimized Buffer Flush and Fill
+ OBF8, 8, // (191) Optimized Buffer Flush and Fill
+ Offset (192),
+ XHCI, 8, // (192) xHCI controller mode
+ XTUB, 32, // (193) XTU Continous structure Base Address
+ XTUS, 32, // (197) XMP Size
+ XMPB, 32, // (201) XMP Base Address
+ DDRF, 8, // (205) DDR Reference Frequency
+
+ RTD3, 8, // (206) Runtime D3 support.
+ PEP0, 8, // (207) User selctable Delay for Device D0 transition.
+ PEP3, 8, // (208) User selctable Delay for Device D3 transition.
+ //
+ // DPTF Devices and trip points
+ //
+ DPTF, 8, // (209) EnableDptf
+
+ SADE, 8, // (210) EnableSaDevice
+ SACR, 8, // (211) CriticalThermalTripPointSa
+ SAHT, 8, // (212) HotThermalTripPointSa
+
+ PCHD, 8, // (213) EnablePchDevice
+ PCHC, 8, // (214) CriticalThermalTripPointPch
+ PCHH, 8, // (215) HotThermalTripPointPch
+ //
+ // DPTF Policies
+ //
+ CTDP, 8, // (216) EnableCtdpPolicy
+ LPMP, 8, // (217) EnableLpmPolicy
+ LPMV, 8, // (218) CurrentLowPowerMode for LPM
+ ECEU, 8, // (219) EnableCurrentExecutionUnit
+ TGFG, 16, // (220) TargetGfxFreq
+ //
+ // DPPM Devices and trip points
+ //
+ MEMD, 8, // (222) EnableMemoryDevice
+ MEMC, 8, // (223) CriticalThermalTripPointTMEM
+ MEMH, 8, // (224) HotThermalTripPointTMEM
+
+ FND1, 8, // (225) EnableFan1Device
+ FND2, 8, // (226) EnableFan2Device
+
+ AMBD, 8, // (227) EnableAmbientDevice
+ AMAT, 8, // (228) ActiveThermalTripPointAmbient
+ AMPT, 8, // (229) PassiveThermalTripPointAmbient
+ AMCT, 8, // (230) CriticalThermalTripPointAmbient
+ AMHT, 8, // (231) HotThermalTripPointAmbient
+
+ SKDE, 8, // (232) EnableSkinDevice
+ SKAT, 8, // (233) ActiveThermalTripPointSkin
+ SKPT, 8, // (234) PassiveThermalTripPointSkin
+ SKCT, 8, // (235) CriticalThermalTripPointSkin
+ SKHT, 8, // (236) HotThermalTripPointSkin
+
+ EFDE, 8, // (237) EnableExhaustFanDevice
+ EFAT, 8, // (238) ActiveThermalTripPointExhaustFan
+ EFPT, 8, // (239) PassiveThermalTripPointExhaustFan
+ EFCT, 8, // (240) CriticalThermalTripPointExhaustFan
+ EFHT, 8, // (241) HotThermalTripPointExhaustFan
+
+ VRDE, 8, // (242) EnableVRDevice
+ VRAT, 8, // (243) ActiveThermalTripPointVR
+ VRPT, 8, // (244) PassiveThermalTripPointVR
+ VRCT, 8, // (245) CriticalThermalTripPointVR
+ VRHT, 8, // (246) HotThermalTripPointVR
+ //
+ // DPPM Policies
+ //
+ DPAP, 8, // (247) EnableActivePolicy
+ DPPP, 8, // (248) EnablePassivePolicy
+ DPCP, 8, // (249) EnableCriticalPolicy
+ DCMP, 8, // (250) EnableCoolingModePolicy
+ TRTV, 8, // (251) TrtRevision
+ //
+ // CLPO (Current Logical Processor Off lining Setting)
+ //
+ LPOE, 8, // (252) LPOEnable
+ LPOP, 8, // (253) LPOStartPState
+ LPOS, 8, // (254) LPOStepSize
+ LPOW, 8, // (255) LPOPowerControlSetting
+ LPER, 8, // (256) LPOPerformanceControlSetting
+ //
+ // Miscellaneous DPTF
+ //
+ PPSZ, 32, // (257) PPCC Step Size
+ DISE, 8, // (261) EnableDisplayParticipant
+ //
+ // PFAT
+ //
+ PFMA, 64, // (262) PFAT Memory Address for Tool Interface
+ PFMS, 8, // (270) PFAT Memory Size for Tool Interface
+ PFIA, 16, // (271) PFAT IoTrap Address for Tool Interface
+ //
+ // ISCT
+ //
+ ICNF, 8, // (273) Isct Configuration
+ //
+ // ADSP
+ //
+ DSP0, 32, // (274) Audio DSP BAR0
+ DSP1, 32, // (278) Audio DSP BAR1
+ //
+ // NFC
+ //
+ NFCE, 8, // (282) NFC module selection
+ //
+ // ADSP Codec Selection
+ //
+ CODS, 8, // (283) Audio Codec selection
+ //
+ // Sensor Hub Enable
+ //
+ SNHE, 8, // (284) Sensor Hub Enable
+
+ S0ID, 8, // (285) Low Power S0 Idle Enable
+
+ //
+ // BIOS only version of Config TDP
+ //
+ CTDB, 8, // (286) enable/disable BIOS only version of Config TDP
+
+ Offset(519),
+ PWRE, 8, // (519) EnablePowerDevice
+ PWRP, 8, // (520) EnablePowerPolicy
+ XHPR, 8, // (521) RTD3 USB Power Resource config
+ //
+ // Intel Serial(R) IO Sensor Device Selection
+ //
+ SDS0, 8, // (522) I2C0 Sensor Device Selection
+ SDS1, 16, // (523) I2C1 Sensor Device Selection
+ SDS2, 8, // (525) SPI0 Sensor Device Selection
+ SDS3, 8, // (526) SPI1 Sensor Device Selection
+ SDS4, 8, // (527) UART0 Sensor Device Selection
+ SDS5, 8, // (528) UART1 Sensor Device Selection
+ Offset(530), // 529 no longer used
+ RIC0, 8, // (530) RTD3 support for I2C0 SH
+ PEPY, 8, // (531) RTD3 PEP support list(BIT0 - GFx , BIT1 - Sata, BIT2 - UART, BIT3 - SDHC, Bit4 - I2C0, BIT5 - I2C1, Bit6 - XHCI, Bit7 - Audio)
+ DVS0, 8, // (532) Port0 DevSlp Enable
+ DVS1, 8, // (533) Port1 DevSlp Enable
+ DVS2, 8, // (534) Port2 DevSlp Enable
+ DVS3, 8, // (535) Port3 DevSlp Enable
+ GBSX, 8, // (536) Virtual GPIO button Notify Sleep State Change
+ IUBE, 8, // (537) IUER Button Enable
+ IUCE, 8, // (538) IUER Convertible Enable
+ IUDE, 8, // (539) IUER Dock Enable
+ ECNO, 8, // (540) EC Notification of Low Power S0 Idle State
+ AUDD, 16, // (541) RTD3 Audio Codec device delay
+ DSPD, 16, // (543) RTD3 ADSP device delay
+ IC0D, 16, // (545) RTD3 SensorHub delay time after applying power to device
+ IC1D, 16, // (547) RTD3 TouchPanel delay time after applying power to device
+ IC1S, 16, // (549) RTD3 TouchPad delay time after applying power to device
+ VRRD, 16, // (551) VR Ramp up delay
+ PSCP, 8, // (553) P-state Capping
+ RWAG, 8, // (554) Rtd3 W/A Gpio, allow W/A for port 1 and 6 to use GPIO from SDHC device
+ I20D, 16, // (555) Delay in _PS0 after powering up I2C0 Controller
+ I21D, 16, // (557) Delay in _PS0 after powering up I2C1 Controller
+
+ Offset(561),
+ RCG0, 8 , // (561) RTD3 Config Setting(BIT0:ZPODD,BIT1:USB Camera Port4, BIT2/3:SATA Port3)
+ ECDB, 8, // (562) EC Debug Light (CAPS LOCK) for when in Low Power S0 Idle State
+ P2ME, 8, // (563) Ps2 Mouse Enable
+
+ SSH0, 16, // (564) SSCN-LOW for I2C0
+ SSL0, 16, // (566) SSCN-HIGH for I2C0
+ SSD0, 16, // (568) SSCN-HOLD for I2C0
+ FMH0, 16, // (570) FMCN-LOW for I2C0
+ FML0, 16, // (572) FMCN-HIGH for I2C0
+ FMD0, 16, // (574) FMCN-HOLD for I2C0
+ FPH0, 16, // (576) FPCN-LOW for I2C0
+ FPL0, 16, // (578) FPCN-HIGH for I2C0
+ FPD0, 16, // (580) FPCN-HOLD for I2C0
+ SSH1, 16, // (582) SSCN-LOW for I2C1
+ SSL1, 16, // (584) SSCN-HIGH for I2C1
+ SSD1, 16, // (586) SSCN-HOLD for I2C1
+ FMH1, 16, // (588) FMCN-LOW for I2C1
+ FML1, 16, // (590) FMCN-HIGH for I2C1
+ FMD1, 16, // (592) FMCN-HOLD for I2C1
+ FPH1, 16, // (594) FPCN-LOW for I2C1
+ FPL1, 16, // (596) FPCN-HIGH for I2C1
+ FPD1, 16, // (598) FPCN-HOLD for I2C1
+ M0C0, 16, // (600) M0D3 for I2C0
+ M1C0, 16, // (602) M1D3 for I2C0
+ M2C0, 16, // (604) M0D0 for I2C0
+ M0C1, 16, // (606) M0D3 for I2C1
+ M1C1, 16, // (608) M1D3 for I2C1
+ M2C1, 16, // (610) M0D0 for I2C1
+ M0C2, 16, // (612) M0D3 for SPI0
+ M1C2, 16, // (614) M1D3 for SPI0
+ M0C3, 16, // (616) M0D3 for SPI1
+ M1C3, 16, // (618) M1D3 for SPI1
+ M0C4, 16, // (620) M0D3 for UA00
+ M1C4, 16, // (622) M1D3 for UA00
+ M0C5, 16, // (624) M0D3 for UA01
+ M1C5, 16, // (626) M1D3 for UA01
+ TBSF, 8, // (628) ThunderBolt SMI Function Number
+ GIRQ, 32, // (629) GPIO IRQ
+ DMTP, 8, // (633) PIRQS 34,50(GPIO)
+ DMTD, 8, // (634) PIRQX 39,55(GPIO)
+ DMSH, 8, // (635) PIRQM 28,14(GPIO)
+ LANP, 8, // (636) LAN PHY Status 0 = Not Present, 1 = Present
+ Offset(638), // 637 no longer used.
+ SHSB, 8, // (638) Sensor Standby mode
+ PLCS, 8, // (639) set PL1 limit when entering CS
+ PLVL, 16, // (640) PL1 limit value
+ GN1E, 8, // (642) EnableGen1Participant
+ G1AT, 8, // (643) ActiveThermalTripPointGen1
+ G1PT, 8, // (644) PassiveThermalTripPointGen1
+ G1CT, 8, // (645) CriticalThermalTripPointGen1
+ G1HT, 8, // (646) HotThermalTripPointGen1
+ GN2E, 8, // (647) EnableGen2Participant
+ G2AT, 8, // (648) ActiveThermalTripPointGen2
+ G2PT, 8, // (649) PassiveThermalTripPointGen2
+ G2CT, 8, // (650) CriticalThermalTripPointGen2
+ G2HT, 8, // (651) HotThermalTripPointGen2
+ WWSD, 8, // (652) EnableWwanTempSensorDevice
+ CVSD, 8, // (653) EnableCpuVrTempSensorDevice
+ SSDD, 8, // (654) EnableSsdTempSensorDevice
+ INLD, 8, // (655) EnableInletFanTempSensorDevice
+ IFAT, 8, // (656) ActiveThermalTripPointInletFan
+ IFPT, 8, // (657) PassiveThermalTripPointInletFan
+ IFCT, 8, // (658) CriticalThermalTripPointInletFan
+ IFHT, 8, // (659) HotThermalTripPointInletFan
+ DOSD, 8, // (660) DMA OS detection, 1 = check for OS version when enabling DMA, 0 = don't care about OS
+ USBH, 8, // (661) USB Sensor Hub Enable/Disable
+ BCV4, 8, // (662) Broadcom's Bluetooth adapter's revision
+ WTV0, 8, // (663) I2C0/WITT devices version
+ WTV1, 8, // (664) I2C1/WITT devices version
+ APFU, 8, // (665) Atmel panel FW update Enable/Disable
+ SOHP, 8, // (666) SMI on Hot Plug for TBT devices
+ NOHP, 8, // (667) Notify on Hot Plug for TBT devices
+ TBSE, 8, // (668) ThunderBolt Root port selector
+ WKFN, 8, // (669) WAK Finished
+ PEPC, 16, // (670) PEP Constraints
+ VRSD, 16, // (672) VR Staggering delay
+ PB1E, 8, // (674) 10sec Power button support Bit0: 10 sec P-button Enable/Disable
+ // Bit1: Internal Flag
+ // Bit2: Rotation Lock flag, 0:unlock, 1:lock
+ // Bit3: Slate/Laptop Mode Flag, 0: Slate, 1: Laptop
+ // Bit4: Undock / Dock Flag, 0: Undock, 1: Dock
+ // Bit5, 6: reserved for future use.
+ // Bit7: EC 10sec PB Override state for S3/S4 wake up.
+ WAND, 8, // (675) EnableWWANParticipant
+ WWAT, 8, // (676) ActiveThermalTripPointWWAN
+ WWPT, 8, // (677) PassiveThermalTripPointWWAN
+ WWCT, 8, // (678) CriticalThermalTripPointWWAN
+ WWHT, 8, // (679) HotThermalTripPointWWAN
+ Offset(685),
+ MPLT, 16, // (685) Minimum Power Limit for DPTF use via PPCC Object
+ GR13, 8, // (687) GPIO13 Rework for Sawtooth Peak
+ SPST, 8, // (688) SATA port state, Bit0 - Port0, Bit1 - Port1, Bit2 - Port2, Bit3 - Port3
+ ECLP, 8, // (689) EC Low Power Mode: 1 - Enabled, 0 - Disabled
+ INSC, 8, // (690) Intel RMT Configuration
+ }
+
+#if defined(ASL_Remove_SaSsdt_Data_To_Dsdt) && (ASL_Remove_SaSsdt_Data_To_Dsdt == 1)
+///
+/// Below Data structure is copy from SaSsdt.asl
+///
+ OperationRegion(SANV,SystemMemory,0xFFFF0000,0xAA55)
+ Field(SANV,AnyAcc,Lock,Preserve)
+ {
+ SARV, 32, /// (000) SA RC Revision
+ ASLB, 32, /// (004) IGD OpRegion base address
+ IMON, 8, /// (008) IMON Current Value
+ IGDS, 8, /// (009) IGD State (Primary Display = 1)
+ CADL, 8, /// (010) Current Attached Device List
+ PADL, 8, /// (011) Previous Attached Device List
+ CSTE, 16, /// (012) Current Display State
+ NSTE, 16, /// (014) Next Display State
+ DID9, 32, /// (016) Device Id 9
+ DIDA, 32, /// (020) Device Id 10
+ DIDB, 32, /// (024) Device Id 11
+ IBTT, 8, /// (028) IGD Boot Display Device
+ IPAT, 8, /// (029) IGD Panel Type CMOs option
+ IPSC, 8, /// (030) IGD Panel Scaling
+ IBLC, 8, /// (031) IGD BLC Configuration
+ IBIA, 8, /// (032) IGD BIA Configuration
+ ISSC, 8, /// (033) IGD SSC Configuration
+ IPCF, 8, /// (034) IGD Power Conservation Feature Flag
+ IDMS, 8, /// (035) IGD DVMT Memory Size
+ IF1E, 8, /// (036) IGD Function 1 Enable
+ HVCO, 8, /// (037) HPLL VCO
+ NXD1, 32, /// (038) Next state DID1 for _DGS
+ NXD2, 32, /// (042) Next state DID2 for _DGS
+ NXD3, 32, /// (046) Next state DID3 for _DGS
+ NXD4, 32, /// (050) Next state DID4 for _DGS
+ NXD5, 32, /// (054) Next state DID5 for _DGS
+ NXD6, 32, /// (058) Next state DID6 for _DGS
+ NXD7, 32, /// (062) Next state DID7 for _DGS
+ NXD8, 32, /// (066) Next state DID8 for _DGS
+ GSMI, 8, /// (070) GMCH SMI/SCI mode (0=SCI)
+ PAVP, 8, /// (071) IGD PAVP data
+ LIDS, 8, /// (072) Lid State (Lid Open = 1)
+ KSV0, 32, /// (073) First four bytes of AKSV (mannufacturing mode)
+ KSV1, 8, /// (077) Fifth byte of AKSV (mannufacturing mode)
+ BBAR, 32, /// (078) IGFX Audio (D3F0) MMIO BAR Address
+ BLCS, 8, /// (082) Backlight Control Support
+ BRTL, 8, /// (083) Brightness Level Percentage
+ ALSE, 8, /// (084) ALS Enable
+ ALAF, 8, /// (085) Ambient Light Adjusment Factor
+ LLOW, 8, /// (086) LUX Low Value
+ LHIH, 8, /// (087) LUX High Value
+ ALFP, 8, /// (088) Active LFP
+ AUDA, 32, /// (089) Audio MMIO WA 1
+ AUDB, 32, /// (093) Audio MMIO WA 2
+ AUDC, 32, /// (097) Audio MMIO WA 3
+ DIDC, 32, /// (101) Device Id 12
+ DIDD, 32, /// (105) Device Id 13
+ DIDE, 32, /// (109) Device Id 14
+ DIDF, 32, /// (113) Device Id 15
+//AMI_OVERRIDE --- Change name from CADR to CCSA to fix that the system has BsOD issue. It is due to the name(CADR) is conflict with AMI Aptio definition name. >>
+ CCSA, 32, /// (117) Codec Save Address
+ CCNT, 32, /// (121) Codec Save Count
+//CADR, 32, /// (117) Codec Save Address
+//CCNT, 8, /// (121) Codec Save Count
+//AMI_OVERRIDE --- <<
+ ///
+ /// Switchable Graphics Info
+ ///
+ Offset(200),
+ SGMD, 8, /// (200) SG Mode (0=Disabled, 1=SG Muxed, 2=SG Muxless, 3=DGPU Only)
+ SGFL, 8, /// (201) SG Feature List
+ PWOK, 8, /// (202) dGPU PWROK GPIO assigned
+ HLRS, 8, /// (203) dGPU HLD RST GPIO assigned
+ PWEN, 8, /// (204) dGPU PWR Enable GPIO assigned
+ PRST, 8, /// (205) dGPU Present Detect GPIO assigned
+ CPSP, 32, /// (206) PEG Endpoint Capability Structure Presence (Bit 0: Virtual Channel Capability)
+ EECP, 8, /// (210) PEG Endpoint PCIe Capability Structure Offset
+ EVCP, 16, /// (211) PEG Endpoint Virtual Channel Capability Structure Offset
+ XBAS, 32, /// (213) Any Device's PCIe Config Space Base Address
+ GBAS, 16, /// (217) GPIO Base Address
+ SGGP, 8, /// (219) SG GPIO Support
+ NVGA, 32, /// (220) NVIG opregion address
+ NVHA, 32, /// (224) NVHM opregion address
+ AMDA, 32, /// (228) AMDA opregion address
+ NDID, 8, /// (232) Number of Valid Device IDs
+ DID1, 32, /// (233) Device ID 1
+ DID2, 32, /// (237) Device ID 2
+ DID3, 32, /// (241) Device ID 3
+ DID4, 32, /// (245) Device ID 4
+ DID5, 32, /// (249) Device ID 5
+ DID6, 32, /// (253) Device ID 6
+ DID7, 32, /// (257) Device ID 7
+ DID8, 32, /// (261) Device ID 8
+ OBS1, 32, /// (265) Occupied Buses - from 0 to 31
+ OBS2, 32, /// (269) Occupied Buses - from 32 to 63
+ OBS3, 32, /// (273) Occupied Buses - from 64 to 95
+ OBS4, 32, /// (277) Occupied Buses - from 96 to 127
+ OBS5, 32, /// (281) Occupied Buses - from 128 to 159
+ OBS6, 32, /// (285) Occupied Buses - from 160 to 191
+ OBS7, 32, /// (289) Occupied Buses - from 192 to 223
+ OBS8, 32, /// (293) Occupied Buses - from 224 to 255
+ LTRA, 8, /// (297) Latency Tolerance Reporting Enable
+ OBFA, 8, /// (298) Optimized Buffer Flush and Fill
+ LTRB, 8, /// (299) Latency Tolerance Reporting Enable
+ OBFB, 8, /// (300) Optimized Buffer Flush and Fill
+ LTRC, 8, /// (301) Latency Tolerance Reporting Enable
+ OBFC, 8, /// (302) Optimized Buffer Flush and Fill
+ SMSL, 16, /// (303) SA Peg Latency Tolerance Reporting Max Snoop Latency
+ SNSL, 16, /// (305) SA Peg Latency Tolerance Reporting Max No Snoop Latency
+ P0UB, 8, /// (307) Peg0 Unused Bundle Control
+ P1UB, 8, /// (308) Peg1 Unused Bundle Control
+ P2UB, 8, /// (309) Peg2 Unused Bundle Control
+ EDPV, 8, /// (310) Check for eDP display device
+ NXDX, 32, /// (311) Next state DID for eDP
+ DIDX, 32, /// (315) Device ID for eDP device
+ PCSL, 8, /// (319) The lowest C-state for the package
+ SC7A, 8, /// (316) Run-time C7 Allowed feature (0=Disabled, 1=Enabled)
+// AMI_OVERRIDE...
+ DSEL, 8, /// (319) dGPU Display Select GPIO assigned
+ ESEL, 8, /// (320) dGPU EDID Select GPIO assigned
+ PSEL, 8, /// (321) dGPU PWM Select GPIO assigned
+ MXD1, 32, /// (322) DID1 Mux Setting
+ MXD2, 32, /// (326) DID2 Mux Setting
+ MXD3, 32, /// (330) DID3 Mux Setting
+ MXD4, 32, /// (334) DID4 Mux Setting
+ MXD5, 32, /// (338) DID5 Mux Setting
+ MXD6, 32, /// (342) DID6 Mux Setting
+ MXD7, 32, /// (346) DID7 Mux Setting
+ MXD8, 32, /// (350) DID8 Mux Setting
+ PXFD, 8, /// (354) ATI 5.0 Fixed/Dynamic ATI 5.0 Fixed/Dynamic
+ EBAS, 32, /// (355) Endpoint PCIe Base Address
+ HYSS, 32, /// (359) dGPU SSID for MSHyBrid restore
+// AMI_OVERRIDE...end.
+ }
+#endif
diff --git a/ReferenceCode/AcpiTables/Dsdt/Gpe.asl b/ReferenceCode/AcpiTables/Dsdt/Gpe.asl
new file mode 100644
index 0000000..5a0b222
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dsdt/Gpe.asl
@@ -0,0 +1,947 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Haswell *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+
+
+ // General Purpose Events. This Scope handles the Run-time and
+ // Wake-time SCIs. The specific method called will be determined by
+ // the _Lxx value, where xx equals the bit location in the General
+ // Purpose Event register(s).
+
+ //AMI_OVERRIDE Fixed EIP115617 Lan wake issue >>
+ //External(D1F0)
+ //External(D1F1)
+ //External(D1F2)
+ //AMI_OVERRIDE Fixed EIP115617 Lan wake issue <<
+#if !defined(ASL_Remove_SaSsdt_Data_To_Dsdt) || (ASL_Remove_SaSsdt_Data_To_Dsdt == 0)
+ External(\_SB.PCI0.PEG0.HPME, MethodObj)
+ External(\_SB.PCI0.PEG1.HPME, MethodObj)
+ External(\_SB.PCI0.PEG2.HPME, MethodObj)
+#endif
+
+ Scope(\_GPE)
+ {
+ // Note:
+ // Originally, the two GPE methods below are automatically generated, but, for ASL code restructuring,
+ // disabled the automatic generation and declare the ASL code here.
+ //
+
+#if 0 //AMI_OVERRIDE --- PciTree.asl has this Gpe event. >>
+ Method(XL0B, 0) {
+ Notify(\_SB.PCI0.P0P1, 0x02)
+ }
+#endif //AMI_OVERRIDE --- PciTree.asl has this Gpe event. <<
+
+
+ //
+ // This PME event (PCH's GPE #9) is received on one or more of the PCI Express* ports or
+ // an assert PMEGPE message received via DMI
+ //
+ Method(XL09, 0) {
+ //
+ // If the Root Port is enabled, run PCI_EXP_STS handler
+ //
+#if defined(ASL_RC_PORT_0) && (ASL_RC_PORT_0==1)
+ If(LAnd(LEqual(RP1D,0), LEqual(\_SB.PCI0.RP01.RPAV,1)))
+ {
+ \_SB.PCI0.RP01.HPME()
+ Notify(\_SB.PCI0.RP01, 0x02)
+ }
+#endif // ASL_RC_PORT_0
+
+#if defined(ASL_RC_PORT_1) && (ASL_RC_PORT_1==1)
+ If(LAnd(LEqual(RP2D,0), LEqual(\_SB.PCI0.RP02.RPAV,1)))
+ {
+ \_SB.PCI0.RP02.HPME()
+ Notify(\_SB.PCI0.RP02, 0x02)
+ }
+#endif // ASL_RC_PORT_1
+
+#if defined(ASL_RC_PORT_2) && (ASL_RC_PORT_2==1)
+ If(LAnd(LEqual(RP3D,0), LEqual(\_SB.PCI0.RP03.RPAV,1)))
+ {
+ \_SB.PCI0.RP03.HPME()
+ Notify(\_SB.PCI0.RP03, 0x02)
+ }
+#endif // ASL_RC_PORT_2
+
+#if defined(ASL_RC_PORT_3) && (ASL_RC_PORT_3==1)
+ If(LAnd(LEqual(RP4D,0), LEqual(\_SB.PCI0.RP04.RPAV,1)))
+ {
+ \_SB.PCI0.RP04.HPME()
+ Notify(\_SB.PCI0.RP04, 0x02)
+ }
+#endif // ASL_RC_PORT_3
+
+#if defined(ASL_RC_PORT_4) && (ASL_RC_PORT_4==1)
+ If(LAnd(LEqual(RP5D,0), LEqual(\_SB.PCI0.RP05.RPAV,1)))
+ {
+ \_SB.PCI0.RP05.HPME()
+ Notify(\_SB.PCI0.RP05, 0x02)
+ }
+#endif // ASL_RC_PORT_4
+
+#if defined(ASL_RC_PORT_5) && (ASL_RC_PORT_5==1)
+ If(LAnd(LEqual(RP6D,0), LEqual(\_SB.PCI0.RP06.RPAV,1)))
+ {
+ \_SB.PCI0.RP06.HPME()
+ Notify(\_SB.PCI0.RP06, 0x02)
+ }
+#endif // ASL_RC_PORT_5
+
+#if defined(ASL_RC_PORT_6) && (ASL_RC_PORT_6==1)
+ If(LAnd(LEqual(RP7D,0), LEqual(\_SB.PCI0.RP07.RPAV,1)))
+ {
+ \_SB.PCI0.RP07.HPME()
+ Notify(\_SB.PCI0.RP07, 0x02)
+ }
+#endif // ASL_RC_PORT_6
+
+#if defined(ASL_RC_PORT_7) && (ASL_RC_PORT_7==1)
+ If(LAnd(LEqual(RP8D,0), LEqual(\_SB.PCI0.RP08.RPAV,1)))
+ {
+ \_SB.PCI0.RP08.HPME()
+ Notify(\_SB.PCI0.RP08, 0x02)
+ }
+#endif // ASL_RC_PORT_7
+
+#if defined(ASL_RC_PEG_0) && (ASL_RC_PEG_0 == 1)
+ //AMI_OVERRIDE Fixed EIP115617 Lan wake issue >>
+ If(LEqual(\_SB.PCI0.D1F0,1))
+ //AMI_OVERRIDE Fixed EIP115617 Lan wake issue <<
+ {
+ \_SB.PCI0.PEG0.HPME()
+ Notify(\_SB.PCI0.PEG0, 0x02)
+ Notify(\_SB.PCI0.PEG0.PEGP, 0x02)
+ }
+#if defined(ASL_RC_PEG_1) && (ASL_RC_PEG_1 == 1)
+ //AMI_OVERRIDE Fixed EIP115617 Lan wake issue >>
+ If(LEqual(\_SB.PCI0.D1F1,1))
+ //AMI_OVERRIDE Fixed EIP115617 Lan wake issue <<
+ {
+ \_SB.PCI0.PEG1.HPME()
+ Notify(\_SB.PCI0.PEG1, 0x02)
+ }
+#if defined(ASL_RC_PEG_2) && (ASL_RC_PEG_2 == 1)
+ //AMI_OVERRIDE Fixed EIP115617 Lan wake issue >>
+ If(LEqual(\_SB.PCI0.D1F2,1))
+ //AMI_OVERRIDE Fixed EIP115617 Lan wake issue <<
+ {
+ \_SB.PCI0.PEG2.HPME()
+ Notify(\_SB.PCI0.PEG2, 0x02)
+ }
+#endif // ASL_RC_PEG_2
+#endif // ASL_RC_PEG_1
+#endif // ASL_RC_PEG_0
+ }
+
+ //
+ // This PME event (PCH's GPE #13) is received when any PCH internal device with PCI Power Management capabilities
+ // on bus 0 asserts the equivalent of the PME# signal.
+ //
+ Method(XL0D, 0) {
+ If(LAnd(\_SB.PCI0.EHC1.PMEE, \_SB.PCI0.EHC1.PMES)){
+ Notify(\_SB.PCI0.EHC1, 0x02)
+ }
+ If(LAnd(\_SB.PCI0.EHC2.PMEE, \_SB.PCI0.EHC2.PMES)){
+ Notify(\_SB.PCI0.EHC2, 0x02)
+ }
+ If(LAnd(\_SB.PCI0.XHC.PMEE, \_SB.PCI0.XHC.PMES)){
+ Notify(\_SB.PCI0.XHC, 0x02)
+ }
+ ElseIf(LEqual(\_SB.PCI0.XHC.PMEE, 0)) {
+ Store(1, \_SB.PCI0.XHC.PMES) // Clear PMES Bit because an SCI is occurring when PMEE bit is not set
+ }
+ If(LAnd(\_SB.PCI0.HDEF.PMEE, \_SB.PCI0.HDEF.PMES)){
+ Notify(\_SB.PCI0.HDEF, 0x02)
+ }
+ Notify(\_SB.PCI0.GLAN, 0x02)
+ }
+
+ // PCI Express Hot-Plug caused the wake event.
+
+ Method(XL01)
+ {
+ Add(L01C,1,L01C) // Increment L01 Entry Count.
+
+ P8XH(0,0x01) // Output information to Port 80h.
+ P8XH(1,L01C)
+
+
+ // Check Root Port 1 for a Hot Plug Event if the Port is
+ // enabled.
+
+#if defined(ASL_RC_PORT_0) && (ASL_RC_PORT_0==1)
+ If(LAnd(LEqual(RP1D,0),\_SB.PCI0.RP01.HPSX))
+ {
+ // Delay for 100ms to meet the timing requirements
+ // of the PCI Express Base Specification, Revision
+ // 1.0A, Section 6.6 ("...software must wait at
+ // least 100ms from the end of reset of one or more
+ // device before it is permitted to issue
+ // Configuration Requests to those devices").
+#if defined(ASL_Thunderbolt_SUPPORT) && (ASL_Thunderbolt_SUPPORT == 1)
+ If(LNotEqual(\TBRP,0x1)){
+ Sleep(100)
+ }
+#else
+ Sleep(100)
+#endif
+
+ If(\_SB.PCI0.RP01.PDCX)
+ {
+ // Clear all status bits first.
+
+ Store(1,\_SB.PCI0.RP01.PDCX)
+ Store(1,\_SB.PCI0.RP01.HPSX)
+
+ //
+ // PCH BIOS Spec Update Rev 1.03, Section 8.9 PCI Express* Hot-Plug BIOS Support
+ // In addition, BIOS should intercept Presence Detect Changed interrupt, enable L0s on
+ // hot plug and disable L0s on hot unplug. BIOS should also make sure the L0s is
+ // disabled on empty slots prior booting to OS.
+ //
+ If(LNot(\_SB.PCI0.RP01.PDSX)) {
+ // The PCI Express slot is empty, so disable L0s on hot unplug
+ //
+ Store(0,\_SB.PCI0.RP01.L0SE)
+
+ }
+
+ // Perform proper notification
+ // to the OS.
+#if defined(ASL_Thunderbolt_SUPPORT) && (ASL_Thunderbolt_SUPPORT == 1)
+ If(LNotEqual(\TBRP,0x1)){
+ Notify(\_SB.PCI0.RP01,0)
+ }
+#else
+ Notify(\_SB.PCI0.RP01,0)
+#endif
+ }
+ Else
+ {
+ // False event. Clear Hot-Plug Status
+ // then exit.
+
+ Store(1,\_SB.PCI0.RP01.HPSX)
+ }
+ }
+#endif // ASL_RC_PORT_0
+
+ // Check Root Port 2 for a Hot Plug Event if the Port is
+ // enabled.
+
+#if defined(ASL_RC_PORT_1) && (ASL_RC_PORT_1==1)
+ If(LAnd(LEqual(RP2D,0),\_SB.PCI0.RP02.HPSX))
+ {
+#if defined(ASL_Thunderbolt_SUPPORT) && (ASL_Thunderbolt_SUPPORT == 1)
+ If(LNotEqual(\TBRP,0x2)){
+ Sleep(100)
+ }
+#else
+ Sleep(100)
+#endif
+
+ If(\_SB.PCI0.RP02.PDCX)
+ {
+ Store(1,\_SB.PCI0.RP02.PDCX)
+ Store(1,\_SB.PCI0.RP02.HPSX)
+
+ If(LNot(\_SB.PCI0.RP02.PDSX)) {
+ Store(0,\_SB.PCI0.RP02.L0SE)
+ }
+
+#if defined(ASL_Thunderbolt_SUPPORT) && (ASL_Thunderbolt_SUPPORT == 1)
+ If(LNotEqual(\TBRP,0x2)){
+ Notify(\_SB.PCI0.RP02,0)
+ }
+#else
+ Notify(\_SB.PCI0.RP02,0)
+#endif
+ }
+ Else
+ {
+ Store(1,\_SB.PCI0.RP02.HPSX)
+ }
+ }
+#endif // ASL_RC_PORT_1
+
+ // Check Root Port 3 for a Hot Plug Event if the Port is
+ // enabled.
+
+#if defined(ASL_RC_PORT_2) && (ASL_RC_PORT_2==1)
+ If(LAnd(LEqual(RP3D,0),\_SB.PCI0.RP03.HPSX))
+ {
+#if defined(ASL_Thunderbolt_SUPPORT) && (ASL_Thunderbolt_SUPPORT == 1)
+ If(LNotEqual(\TBRP,0x3)){
+ Sleep(100)
+ }
+#else
+ If(LAnd(LNotEqual(BID, BICO),LNotEqual(BID, BICC))) {
+ Sleep(100)
+ }
+#endif
+
+ If(\_SB.PCI0.RP03.PDCX)
+ {
+ Store(1,\_SB.PCI0.RP03.PDCX)
+ Store(1,\_SB.PCI0.RP03.HPSX)
+
+ If(LNot(\_SB.PCI0.RP03.PDSX)) {
+ Store(0,\_SB.PCI0.RP03.L0SE)
+ }
+
+#if defined(ASL_Thunderbolt_SUPPORT) && (ASL_Thunderbolt_SUPPORT == 1)
+ If(LNotEqual(\TBRP,0x3)){
+ Notify(\_SB.PCI0.RP03,0)
+ }
+#else
+ If(LAnd(LNotEqual(BID, BICO),LNotEqual(BID, BICC))) {
+ Notify(\_SB.PCI0.RP03,0)
+ }
+#endif
+ }
+ Else
+ {
+ Store(1,\_SB.PCI0.RP03.HPSX)
+ }
+ }
+#endif // ASL_RC_PORT_2
+
+ // Check Root Port 4 for a Hot Plug Event if the Port is
+ // enabled.
+
+#if defined(ASL_RC_PORT_3) && (ASL_RC_PORT_3==1)
+ If(LAnd(LEqual(RP4D,0),\_SB.PCI0.RP04.HPSX))
+ {
+#if defined(ASL_Thunderbolt_SUPPORT) && (ASL_Thunderbolt_SUPPORT == 1)
+ If(LNotEqual(\TBRP,0x4)){
+ Sleep(100)
+ }
+#else
+ Sleep(100)
+#endif
+
+ If(\_SB.PCI0.RP04.PDCX)
+ {
+ Store(1,\_SB.PCI0.RP04.PDCX)
+ Store(1,\_SB.PCI0.RP04.HPSX)
+
+ If(LNot(\_SB.PCI0.RP04.PDSX)) {
+ Store(0,\_SB.PCI0.RP04.L0SE)
+ }
+
+#if defined(ASL_Thunderbolt_SUPPORT) && (ASL_Thunderbolt_SUPPORT == 1)
+ If(LNotEqual(\TBRP,0x4)){
+ Notify(\_SB.PCI0.RP04,0)
+ }
+#else
+ Notify(\_SB.PCI0.RP04,0)
+#endif
+ }
+ Else
+ {
+ Store(1,\_SB.PCI0.RP04.HPSX)
+ }
+ }
+#endif // ASL_RC_PORT_3
+
+ // Check Root Port 5 for a Hot Plug Event if the Port is
+ // enabled.
+
+#if defined(ASL_RC_PORT_4) && (ASL_RC_PORT_4==1)
+ If(LAnd(LEqual(RP5D,0),\_SB.PCI0.RP05.HPSX))
+ {
+#if defined(ASL_Thunderbolt_SUPPORT) && (ASL_Thunderbolt_SUPPORT == 1)
+ If(LNotEqual(\TBRP,0x5)){
+ Sleep(100)
+ }
+#else
+ If(LAnd(LNotEqual(BID, BICO),LNotEqual(BID, BICC))) {
+ Sleep(100)
+ }
+#endif
+
+ If(\_SB.PCI0.RP05.PDCX)
+ {
+ Store(1,\_SB.PCI0.RP05.PDCX)
+ Store(1,\_SB.PCI0.RP05.HPSX)
+
+ If(LNot(\_SB.PCI0.RP05.PDSX)) {
+ Store(0,\_SB.PCI0.RP05.L0SE)
+ }
+
+#if defined(ASL_Thunderbolt_SUPPORT) && (ASL_Thunderbolt_SUPPORT == 1)
+ If(LNotEqual(\TBRP,0x5)){
+ Notify(\_SB.PCI0.RP05,0)
+ }
+#else
+ If(LAnd(LNotEqual(BID, BICO),LNotEqual(BID, BICC))) {
+ Notify(\_SB.PCI0.RP05,0)
+ }
+#endif
+ }
+ Else
+ {
+ Store(1,\_SB.PCI0.RP05.HPSX)
+ }
+ }
+#endif // ASL_RC_PORT_4
+
+ // Check Root Port 6 for a Hot Plug Event if the Port is
+ // enabled.
+
+#if defined(ASL_RC_PORT_5) && (ASL_RC_PORT_5==1)
+ If(LAnd(LEqual(RP6D,0),\_SB.PCI0.RP06.HPSX))
+ {
+#if defined(ASL_Thunderbolt_SUPPORT) && (ASL_Thunderbolt_SUPPORT == 1)
+ If(LNotEqual(\TBRP,0x6)){
+ Sleep(100)
+ }
+#else
+ Sleep(100)
+#endif
+
+ If(\_SB.PCI0.RP06.PDCX)
+ {
+ Store(1,\_SB.PCI0.RP06.PDCX)
+ Store(1,\_SB.PCI0.RP06.HPSX)
+
+ If(LNot(\_SB.PCI0.RP06.PDSX)) {
+ Store(0,\_SB.PCI0.RP06.L0SE)
+ }
+
+#if defined(ASL_Thunderbolt_SUPPORT) && (ASL_Thunderbolt_SUPPORT == 1)
+ If(LNotEqual(\TBRP,0x6)){
+ Notify(\_SB.PCI0.RP06,0)
+ }
+#else
+ Notify(\_SB.PCI0.RP06,0)
+#endif
+ }
+ Else
+ {
+ Store(1,\_SB.PCI0.RP06.HPSX)
+ }
+ }
+#endif // ASL_RC_PORT_5
+
+ // Check Root Port 7 for a Hot Plug Event if the Port is
+ // enabled.
+
+#if defined(ASL_RC_PORT_6) && (ASL_RC_PORT_6==1)
+ If(LAnd(LEqual(RP7D,0),\_SB.PCI0.RP07.HPSX))
+ {
+#if defined(ASL_Thunderbolt_SUPPORT) && (ASL_Thunderbolt_SUPPORT == 1)
+ If(LNotEqual(\TBRP,0x7)){
+ Sleep(100)
+ }
+#else
+ Sleep(100)
+#endif
+
+ If(\_SB.PCI0.RP07.PDCX)
+ {
+ Store(1,\_SB.PCI0.RP07.PDCX)
+ Store(1,\_SB.PCI0.RP07.HPSX)
+
+ If(LNot(\_SB.PCI0.RP07.PDSX)) {
+ Store(0,\_SB.PCI0.RP07.L0SE)
+ }
+
+ If(LEqual(PFLV,FDTP))
+ {
+#if defined(ASL_Thunderbolt_SUPPORT) && (ASL_Thunderbolt_SUPPORT == 1)
+ If(LNotEqual(\TBRP,0x7)){
+ Notify(\_SB.PCI0.RP07,0)
+ }
+#else
+ Notify(\_SB.PCI0.RP07,0)
+#endif
+ }
+ Else
+ {
+#if defined(ASL_Thunderbolt_SUPPORT) && (ASL_Thunderbolt_SUPPORT == 1)
+ If (LAnd(LNotEqual(\TBRP,0x7), \ECON))
+#else
+ If (\ECON)
+#endif
+ {
+ If(LEqual(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.DOCK)), 0))
+ { // If not docked then it's hot plug
+ Notify(\_SB.PCI0.RP07,0)
+ }
+ }
+ }
+ }
+ Else
+ {
+ Store(1,\_SB.PCI0.RP07.HPSX)
+ }
+ }
+#endif // ASL_RC_PORT_6
+
+ // Check Root Port 8 for a Hot Plug Event if the Port is
+ // enabled.
+
+#if defined(ASL_RC_PORT_7) && (ASL_RC_PORT_7==1)
+ If(LAnd(LEqual(RP8D,0),\_SB.PCI0.RP08.HPSX))
+ {
+#if defined(ASL_Thunderbolt_SUPPORT) && (ASL_Thunderbolt_SUPPORT == 1)
+ If(LNotEqual(\TBRP,0x8)){
+ Sleep(100)
+ }
+#else
+ Sleep(100)
+#endif
+
+ If(\_SB.PCI0.RP08.PDCX)
+ {
+ Store(1,\_SB.PCI0.RP08.PDCX)
+ Store(1,\_SB.PCI0.RP08.HPSX)
+
+ If(LNot(\_SB.PCI0.RP08.PDSX)) {
+ Store(0,\_SB.PCI0.RP08.L0SE)
+ }
+
+ If(LEqual(PFLV,FDTP))
+ {
+#if defined(ASL_Thunderbolt_SUPPORT) && (ASL_Thunderbolt_SUPPORT == 1)
+ If(LNotEqual(\TBRP,0x8)){
+ Notify(\_SB.PCI0.RP08,0)
+ }
+#else
+ Notify(\_SB.PCI0.RP08,0)
+#endif
+ }
+ Else
+ {
+#if defined(ASL_Thunderbolt_SUPPORT) && (ASL_Thunderbolt_SUPPORT == 1)
+ If (LAnd(LNotEqual(\TBRP,0x8), \ECON))
+#else
+ If (\ECON)
+#endif
+ {
+ If(LEqual(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.DOCK)), 0))
+ { // If not docked then it's hot plug
+ Notify(\_SB.PCI0.RP08,0)
+ }
+ }
+ }
+ }
+ Else
+ {
+ Store(1,\_SB.PCI0.RP08.HPSX)
+ }
+ }
+#endif // ASL_RC_PORT_7
+ }
+
+ //
+ // Software GPE caused the event.
+ //
+ Method(XL02)
+ {
+ // Clear GPE status bit.
+ Store(0,GPEC)
+
+ //
+ // Handle DTS Thermal Events.
+ //
+ External(DTSE, IntObj)
+ If(CondRefOf(DTSE)){
+ If(LGreaterEqual(DTSE, 0x01)){
+ Notify(\_TZ.TZ00,0x80)
+ Notify(\_TZ.TZ01,0x80)
+ }
+ }
+ //
+ // CPPC Begin
+ //
+ // If GPE was asserted on doorbell ring, notify CPPC driver. If GPE was asserted by CPPC to signal
+ // command completion, clear internal flag. This method is required for CPPC driver to function.
+ //
+ External(\_SB.PCCD.PENB, IntObj)
+ If(CondRefOf(\_SB.PCCD.PENB)){
+ If(LEqual(\_SB.PCCD.PENB, 1)) // If CPPC is enabled in BIOS setup, then process command.
+ {
+ Notify(\_SB.PCCD, 0x80)
+ }
+ }
+ //
+ // CPPC End
+ //
+ }
+
+ // IGD OpRegion SCI event (see IGD OpRegion/Software SCI BIOS SPEC).
+ Method(XL06)
+ {
+ If(LAnd(\_SB.PCI0.GFX0.GSSE, LNot(GSMI))) // Graphics software SCI event?
+ {
+ \_SB.PCI0.GFX0.GSCI() // Handle the SWSCI
+ }
+ }
+
+ // SMBus Alert caused the wake event
+ Method(XL07)
+ {
+ Store(0x20,\_SB.PCI0.SBUS.HSTS)
+ }
+
+#if 0 //AMI_OVERRIDE --- It is for CRB SIO using,OEM doesn't need to it. >>
+ // RI# caused the wake event (COMA).
+
+ Method(XL08)
+ {
+ Notify(\_SB.PCI0.LPCB.SM17.UAR1,0x02)
+ }
+#endif //AMI_OVERRIDE --- It is for CRB SIO using,OEM doesn't need to it. <<
+
+#if define ASL_CRB_EC_SUPPORT && ASL_CRB_EC_SUPPORT = 1 //AMI_OVERRIDE
+ //
+ // GPI014 = EC WAKETIME SCI
+ //
+ Method(XL1E)
+ {
+ // Do nothing if Desktop platform
+ If (LEqual(\ECON,0))
+ {
+ Return ()
+ }
+
+ // If the wake event is not a Virtual Lid or Battery, then
+ // it must be a Wake from either the Keyboard or Mouse. A
+ // Power Button Event will be sent for both events such
+ // that the video turns back on for these "attended wake"
+ // events.
+
+ // Check for Virtual Lid Event.
+
+ If(LNotEqual(LIDS,\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.LSTE))))
+ {
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.LSTE)),LIDS)
+
+ If(IGDS)
+ {
+ // Upon waking a lid event may fail if driver is not ready.
+ // If it does, set the high bit of the variable to indicate that
+ // another notification is required during system callbacks.
+ If(\_SB.PCI0.GFX0.GLID(LIDS))
+ {
+ Or(0x80000000,\_SB.PCI0.GFX0.CLID, \_SB.PCI0.GFX0.CLID)
+ }
+ }
+ Notify(\_SB.LID0,0x80)
+ }
+ Else
+ {
+ // Check for Virtual Power Event.
+
+ If(LEqual(BNUM,0))
+ {
+ If(LNotEqual(PWRS,\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.VPWR))))
+ {
+ // Update NVS Power State.
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.VPWR)),PWRS)
+
+ // Perform needed ACPI Notifications.
+ PNOT()
+ }
+ }
+
+ // Make it an attended wake event, no matter what.
+ Notify(\_SB.PWRB,0x02)
+ }
+ Return ()
+ }
+#endif //AMI_OVERRIDE
+
+#if 0 //AMI_OVERRIDE --- Below ASL code is for Thunderbolt, AMI thunderbolt module has taken care it already.>>
+ //
+ //OS up handshake procedure to host router upstream port each time
+ //exiting from Sx State .Avoids intermediate
+ //PCIe Scan by OS during resorce allocation
+ //
+ Method(OSUP, 1)
+ {
+ Add(Arg0, 0x548, Local0)
+ OperationRegion(PXVD,SystemMemory,Local0,0x08)
+ Field(PXVD,DWordAcc, NoLock, Preserve)
+ {
+ TB2P, 32,
+ P2TB, 32
+ }
+
+ Store(100, Local1)
+ Store(0x0D, P2TB) // Write OS_Up to PCIe2TBT
+ While(LGreater(Local1, 0))
+ {
+ Store(Subtract(Local1, 1), Local1)
+ Store(TB2P, Local2)
+ If(LEqual(Local2, 0xFFFFFFFF))// Device gone
+ {
+ Return(2)
+ }
+ If(And(Local2, 1)) // Done
+ {
+ break
+ }
+ Sleep(50)
+ }
+ Store(0x00, P2TB) // Write 0 to PCIe2TBT
+ Return(1)
+ }
+
+ Method(MMTB)
+ {
+ ADBG("MMTB")
+ Store(PEBS, Local0) // MMIO Base address
+
+ Add(Local0, 0xE0000, Local0) // RP01
+ Subtract(ToInteger(TBSE), 1, Local1)
+ Multiply(Local1, 0x1000, Local1)
+ Add(Local0, Local1, Local0) // RP0x
+
+ OperationRegion (MMMM, SystemMemory, Local0, 0x1A)
+ Field (MMMM, AnyAcc, NoLock, Preserve)
+ {
+ Offset(0x19),
+ SBUS, 8
+ }
+ Store(SBUS, Local2)
+ Store(PEBS, Local0)
+ Multiply(Local2, 0x100000, Local2)
+ Add(Local2, Local0, Local0) // TBT HR US port
+ Return(Local0)
+ }
+
+ //
+ //OS up handshake Method ,invokes OSUP based on
+ //Vendor/Device ID Check
+ //
+ Method(OSUW)
+ {
+ ADBG("OSUW")
+ Store(MMTB(), Local0)
+ OperationRegion(PXVD,SystemMemory,Local0,0x4)
+ Field(PXVD,DWordAcc, NoLock, Preserve)
+ {
+ VEDI, 32 // Vendor/Device ID
+ }
+ Store(VEDI, Local1)
+
+ If(LNotEqual(Local1, 0xFFFFFFFF))
+ {
+ Return (OSUP(Local0))
+ }
+ Else
+ {
+ Return (0)
+ }
+ }
+
+ Method(TBFF)// Check for FFFF in TBT
+ {
+ ADBG("TBFF")
+ Store(MMTB(), Local0)
+ OperationRegion(PXVD,SystemMemory,Local0,0x4)
+ Field(PXVD,DWordAcc, NoLock, Preserve)
+ {
+ VEDI, 32 // Vendor/Device ID
+ }
+ Store(VEDI, Local1)
+
+ If(LEqual(Local1, 0xFFFFFFFF))
+ {
+ Return (OSUP(Local0))
+ }
+ Else
+ {
+ Return (0)
+ }
+ }
+
+ // Subordinate bus of TBT RP
+ Method(TSUB)
+ {
+ Store(PEBS, Local0) // MMIO Base address
+
+ Add(Local0, 0xE0000, Local0) // RP01
+ Subtract(ToInteger(TBSE), 1, Local1)
+ Multiply(Local1, 0x1000, Local1)
+ Add(Local0, Local1, Local0) // RP0x
+
+ OperationRegion (MMMM, SystemMemory, Local0, 0x1A)
+ Field (MMMM, AnyAcc, NoLock, Preserve)
+ {
+ Offset(0x19),
+ SBUS, 8
+ }
+ Return(SBUS)
+ }
+
+ // Wait for subordinate bus in TBT RP
+ Method(WSUB)
+ {
+ Store(0, Local0)
+ Store(0, Local1)
+ While(1)
+ {
+ Store(TSUB(), Local1)
+ If(Local1)
+ {
+ Break
+ }
+ Else
+ {
+ Add(Local0, 1, Local0)
+ If(LGreater(Local0, 1000))
+ {
+ Sleep(1000)
+ ADBG("WSUB Deadlock")
+ }
+ Else
+ {
+ Sleep(16)
+ }
+ }
+ }
+ }
+
+ // Wait for _WAK finished
+ Method(WWAK)
+ {
+ Store(0, Local0)
+ Store(0, Local1)
+ While(1)
+ {
+ Acquire(WFDM, 0xFFFF)
+ Store(WKFN, Local0)
+ Release(WFDM)
+
+ If(Local0)
+ {
+ Break
+ }
+ Else
+ {
+ Add(Local1, 1, Local1)
+ If(LGreater(Local1, 1000))
+ {
+ Sleep(1000)
+ ADBG("WWAK Deadlock")
+ }
+ Else
+ {
+ Sleep(16)
+ }
+ }
+ }
+ Return(Local1)
+ }
+ //
+ // Method to Handle enumerate PCIe structure through
+ // SMI for Thunderbolt devices
+ //
+ Method(_E2A)
+ {
+
+ WWAK()
+ WSUB()
+ OperationRegion(SPRT,SystemIO, 0xB2,2)
+ Field (SPRT, ByteAcc, Lock, Preserve)
+ {
+ SSMP, 8
+ }
+
+ ADBG("_E2A")
+ Acquire(OSUM, 0xFFFF)
+ Store(TBFF(), Local0)
+ If(LEqual(Local0, 1))// Only HR
+ {
+ Sleep(16)
+ Release(OSUM)
+ Return ()
+ }
+ If(LEqual(Local0, 2)) // Disconnect
+ {
+ If(NOHP)
+ {
+ ADBG("_E2A Ntfy")
+ If(LEqual(TBSE, 5))
+ {
+ Notify(\_SB.PCI0.RP05,0)
+ }
+ If(LEqual(TBSE, 3))
+ {
+ Notify(\_SB.PCI0.RP03,0)
+ }
+ }
+ Sleep(16)
+ Release(OSUM)
+ Return ()
+ }
+
+ // HR and EP
+ If(LEqual(SOHP, 1))
+ {
+ // Trigger SMI to enumerate PCIe Structure
+ ADBG("_E2A SMI")
+ Store(21, TBSF)
+ Store(0xF7, SSMP)
+ }
+ If(LEqual(NOHP, 1))
+ {
+ //Notify Rootports
+ ADBG("_E2A Ntfy")
+ If(LEqual(TBSE, 5))
+ {
+ Notify(\_SB.PCI0.RP05,0)
+ }
+ If(LEqual(TBSE, 3))
+ {
+ Notify(\_SB.PCI0.RP03,0)
+ }
+ }
+ Sleep(16)
+ Release(OSUM)
+ }
+#endif //AMI_OVERRIDE --- it is for Thunderbolt, AMI thunderbolt module has taken care it already. <<
+
+
+// For Reed Harbor only: Rotation Lock button is connected to GPI00.
+#if define ASL_RHT_BOARD && ASL_RHT_BOARD = 1 //AMI_OVERRIDE
+ Method(_L00)
+ {
+ If(LEqual(BID,BRH)) // BoardIdReedHarborTdv
+ {
+ ADBG("Rotation Lock")
+ Sleep(1000)
+ \_SB.PCI0.GFX0.IUEH(4) // Rotation lock
+ }
+ }
+#endif //AMI_OVERRIDE
+
+}
diff --git a/ReferenceCode/AcpiTables/Dsdt/H8S2113_SIO.ASL b/ReferenceCode/AcpiTables/Dsdt/H8S2113_SIO.ASL
new file mode 100644
index 0000000..e3bbd80
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dsdt/H8S2113_SIO.ASL
@@ -0,0 +1,134 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Haswell *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+Device(H8S2)
+{
+ Name(_HID,EISAID("PNP0A05"))
+
+ Name(_UID, 5)
+
+ Method(_STA,0,Serialized)
+ {
+ If(LEqual(PFLV,FMBL))
+ {
+ Return(0x000F)
+ }
+
+ Return(0x0000)
+ }
+
+ Device(UAR9) // Serial Port UART 9
+ {
+ Name(_HID, EISAID("PNP0501"))
+
+ Name(_UID, 1)
+
+ //
+ // Status Method for UART 9.
+ //
+ Method(_STA, 0, Serialized)
+ {
+ If(LAnd(LEqual(PFLV,FMBL), LNotEqual(BID, BHB)))
+ {
+ Return(0x000F)
+ }
+
+ Return(0x0000)
+ }
+
+ //
+ // Disable Method for UART 9.
+ //
+ //
+ // Current Resource Setting Method for UART 9.
+ //
+ Method(_CRS, 0, Serialized)
+ {
+ //
+ // Create the Buffer that stores the resources to be returned.
+ //
+ Name(BUF0, ResourceTemplate()
+ {
+ IO(Decode16,0x03F8,0x03F8,0x01,0x08)
+ IRQNoFlags(){4}
+ })
+
+ //
+ // TO-DO: Need to implement the code updating BUF0 (I/O 0x3F8~0x3FF and IRQ 4 are the default setting)
+ // according to the real resources assigned when the EC commands are available.
+ //
+
+ Return(BUF0)
+ }
+
+
+ //
+ // Set Resource Setting Method for UART 9.
+ //
+ Method(_SRS,1,Serialized)
+ {
+ CreateByteField(Arg0, 0x02, IOLO)
+ CreateByteField(Arg0, 0x03, IOHI)
+ CreateWordField(Arg0, 0x09, IRQW)
+
+ If(LEqual(IOHI, 0x03))
+ {
+ If(LEqual(IOLO, 0xF8))
+ {
+ If(LEqual(IRQW, 4))
+ {
+ Store(1, HSCS)
+ }
+ }
+ }
+
+ //
+ // TO-DO: Need to implement the code setting the resources based on the arguments when the EC commands are available.
+ //
+ }
+
+ //
+ // D0 Method for COM Port.
+ //
+ Method(_PS0,0,Serialized)
+ {
+ //
+ // TO-DO: Need to implement the code put the device on D0 state when the EC commands are available.
+ //
+ }
+
+ //
+ // D3 Method for COM Port.
+ //
+ Method(_PS3,0,Serialized)
+ {
+ //
+ // TO-DO: Need to implement the code putting the device on D3 state when the EC commands are available.
+ //
+ }
+ }
+}
+
+ \ No newline at end of file
diff --git a/ReferenceCode/AcpiTables/Dsdt/LPC_DEV.ASL b/ReferenceCode/AcpiTables/Dsdt/LPC_DEV.ASL
new file mode 100644
index 0000000..6908a3e
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dsdt/LPC_DEV.ASL
@@ -0,0 +1,302 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Haswell *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+
+Device(DMAC) // DMA Controller
+{
+ Name(_HID,EISAID("PNP0200"))
+
+ Name(_CRS,ResourceTemplate()
+ {
+ IO(Decode16,0x00,0x00,0x01,0x20)
+ IO(Decode16,0x81,0x81,0x01,0x11)
+ IO(Decode16,0x93,0x93,0x01,0x0D)
+ IO(Decode16,0xC0,0xC0,0x01,0x20)
+ DMA(Compatibility,NotBusMaster,Transfer8_16) {4}
+ })
+}
+
+Device(FWHD) // Firmware Hub Device
+{
+ Name(_HID,EISAID("INT0800"))
+
+ Name(_CRS,ResourceTemplate()
+ {
+ Memory32Fixed(ReadOnly,0xFF000000,0x1000000)
+ })
+}
+
+
+Device(HPET) // High Performance Event Timer
+{
+ Name(_HID,EISAID("PNP0103"))
+ Name(_UID, 0)
+
+ Name(BUF0,ResourceTemplate()
+ {
+ Memory32Fixed(ReadWrite,0xFED00000,0x400,FED0)
+ })
+
+ Method(_STA,0)
+ {
+ // Show this Device only if the OS is WINXP or beyond.
+
+ If(LGreaterEqual(OSYS,2001))
+ {
+ If(HPAE)
+ {
+ Return(0x000F) // Enabled, do Display.
+ }
+ }
+ Else
+ {
+ // OS = WIN98, WINME, or WIN2000.
+
+ If(HPAE)
+ {
+ Return(0x000B) // Enabled, don't Display.
+ }
+ }
+
+ Return(0x0000) // Return Nothing.
+ }
+
+ Method(_CRS,0,Serialized)
+ {
+ If(HPAE)
+ {
+ // Check if HPETimer Base should be modified.
+
+ CreateDwordField(BUF0,^FED0._BAS,HPT0)
+
+ If(LEqual(HPAS,1))
+ {
+ Store(0xFED01000,HPT0)
+ }
+
+ If(LEqual(HPAS,2))
+ {
+ Store(0xFED02000,HPT0)
+ }
+
+ If(LEqual(HPAS,3))
+ {
+ Store(0xFED03000,HPT0)
+ }
+ }
+
+ Return(BUF0)
+ }
+}
+
+Device(IPIC) // 8259 PIC
+{
+ Name(_HID,EISAID("PNP0000"))
+
+ Name(_CRS,ResourceTemplate()
+ {
+ IO(Decode16,0x20,0x20,0x01,0x02)
+ IO(Decode16,0x24,0x24,0x01,0x02)
+ IO(Decode16,0x28,0x28,0x01,0x02)
+ IO(Decode16,0x2C,0x2C,0x01,0x02)
+ IO(Decode16,0x30,0x30,0x01,0x02)
+ IO(Decode16,0x34,0x34,0x01,0x02)
+ IO(Decode16,0x38,0x38,0x01,0x02)
+ IO(Decode16,0x3C,0x3C,0x01,0x02)
+ IO(Decode16,0xA0,0xA0,0x01,0x02)
+ IO(Decode16,0xA4,0xA4,0x01,0x02)
+ IO(Decode16,0xA8,0xA8,0x01,0x02)
+ IO(Decode16,0xAC,0xAC,0x01,0x02)
+ IO(Decode16,0xB0,0xB0,0x01,0x02)
+ IO(Decode16,0xB4,0xB4,0x01,0x02)
+ IO(Decode16,0xB8,0xB8,0x01,0x02)
+ IO(Decode16,0xBC,0xBC,0x01,0x02)
+ IO(Decode16,0x4D0,0x4D0,0x01,0x02)
+ IRQNoFlags() {2}
+ })
+}
+
+#ifdef TRAD_FLAG
+Device(MATH) // Math Co-Processor
+{
+ Name(_HID,EISAID("PNP0C04"))
+
+ Name(_CRS,ResourceTemplate()
+ {
+ IO(Decode16,0xF0,0xF0,0x01,0x01)
+ IRQNoFlags() {13}
+ })
+
+ //
+ // Report device present for LPT-H.
+ //
+ Method (_STA, 0x0, NotSerialized)
+ {
+ // LPT-H Chipset DID start with 0x8xxx while LPT-LP start with 0x9xxx
+ If(LEqual(And(CDID,0xF000), 0x8000)) {
+ Return(0x1F)
+ } else {
+ Return(0x0)
+ }
+ }
+}
+#endif // TRAD_FLAG
+
+Device(LDRC) // LPC Device Resource Consumption
+{
+ Name(_HID,EISAID("PNP0C02"))
+
+ Name(_UID,2)
+
+#if 0
+ Name(_CRS,ResourceTemplate() // This is for Cougar Point
+ {
+ IO(Decode16,0x2E,0x2E,0x1,0x02) // SIO Access.
+ IO(Decode16,0x4E,0x4E,0x1,0x02) // LPC Slot Access.
+ IO(Decode16,0x61,0x61,0x1,0x1) // NMI Status.
+ IO(Decode16,0x63,0x63,0x1,0x1) // Processor I/F.
+ IO(Decode16,0x65,0x65,0x1,0x1) // Processor I/F.
+ IO(Decode16,0x67,0x67,0x1,0x1) // Processor I/F.
+ IO(Decode16,0x70,0x70,0x1,0x1) // NMI Enable.
+ IO(Decode16,0x80,0x80,0x1,0x1) // Port 80h.
+ IO(Decode16,0x92,0x92,0x1,0x1) // Processor I/F.
+ IO(Decode16,0xB2,0xB2,0x01,0x02) // Software SMI.
+ IO(Decode16,0x680,0x680,0x1,0x20) // 32 Byte I/O.
+ IO(Decode16,0xFFFF,0xFFFF,0x1,0x1) // ACPI IO Trap.
+ IO(Decode16,0xFFFF,0xFFFF,0x1,0x1) // DTS IO Trap.
+ IO(Decode16,0xFFFF,0xFFFF,0x1,0x1) // HotKey IO Trap.
+
+ IO(Decode16, 0x800,0x800,0x1,0xFF) // PCH GPIO Base.
+ IO(Decode16, 0x900,0x900,0x1,0xFF) // PCH GPIO Base.
+ IO(Decode16, 0xA00,0xA00,0x1,0xFF) // PCH GPIO Base.
+ IO(Decode16, 0xB00,0xB00,0x1,0xFF) // PCH GPIO Base.
+ IO(Decode16, 0x1800,0x1800,0x1,0xFF) // PCH ACPI Base
+
+ IO(Decode16,0x164e,0x164e,0x1,0x02) // 16 Byte I/O.
+ })
+#else
+ Name(BUF0,ResourceTemplate() // This is for Cougar Point
+ {
+ IO(Decode16,0x2E,0x2E,0x1,0x02) // SIO Access.
+ IO(Decode16,0x4E,0x4E,0x1,0x02) // LPC Slot Access.
+ IO(Decode16,0x61,0x61,0x1,0x1) // NMI Status.
+ IO(Decode16,0x63,0x63,0x1,0x1) // Processor I/F.
+ IO(Decode16,0x65,0x65,0x1,0x1) // Processor I/F.
+ IO(Decode16,0x67,0x67,0x1,0x1) // Processor I/F.
+ IO(Decode16,0x70,0x70,0x1,0x1) // NMI Enable.
+ IO(Decode16,0x80,0x80,0x1,0x1) // Port 80h.
+ IO(Decode16,0x92,0x92,0x1,0x1) // Processor I/F.
+ IO(Decode16,0xB2,0xB2,0x01,0x02) // Software SMI.
+ IO(Decode16,0x680,0x680,0x1,0x20) // 32 Byte I/O.
+ IO(Decode16,0xFFFF,0xFFFF,0x1,0x1) // ACPI IO Trap.
+ IO(Decode16,0xFFFF,0xFFFF,0x1,0x1) // DTS IO Trap.
+ IO(Decode16,0xFFFF,0xFFFF,0x1,0x1) // HotKey IO Trap.
+
+ IO(Decode16, 0x800,0x800,0x1,0xFF, GIO0) // PCH GPIO Base.
+ IO(Decode16, 0x900,0x900,0x1,0xFF, GIO1) // PCH GPIO Base.
+ IO(Decode16, 0xA00,0xA00,0x1,0xFF, GIO2) // PCH GPIO Base.
+ IO(Decode16, 0xB00,0xB00,0x1,0xFF, GIO3) // PCH GPIO Base.
+ IO(Decode16, 0x1800,0x1800,0x1,0xFF) // PCH ACPI Base
+
+ IO(Decode16,0x164e,0x164e,0x1,0x02) // 16 Byte I/O.
+ })
+
+ Method(_CRS,0)
+ {
+ CreateWordField(BUF0, ^GIO0._MIN, IO0M)
+ CreateWordField(BUF0, ^GIO0._MAX, IO0X)
+ Store(GPBS, IO0M)
+ Store(GPBS, IO0X)
+
+ CreateWordField(BUF0, ^GIO1._MIN, IO1M)
+ CreateWordField(BUF0, ^GIO1._MAX, IO1X)
+ Store(Add(GPBS, 0x100), IO1M)
+ Store(Add(GPBS, 0x100), IO1X)
+
+ CreateWordField(BUF0, ^GIO2._MIN, IO2M)
+ CreateWordField(BUF0, ^GIO2._MAX, IO2X)
+ Store(Add(GPBS, 0x200), IO2M)
+ Store(Add(GPBS, 0x200), IO2X)
+
+ CreateWordField(BUF0, ^GIO3._MIN, IO3M)
+ CreateWordField(BUF0, ^GIO3._MAX, IO3X)
+ Store(Add(GPBS, 0x300), IO3M)
+ Store(Add(GPBS, 0x300), IO3X)
+
+ Return(BUF0)
+ }
+#endif
+}
+
+Device(RTC) // RTC
+{
+ Name(_HID,EISAID("PNP0B00"))
+
+ Name(_CRS,ResourceTemplate()
+ {
+ IO(Decode16,0x70,0x70,0x01,0x08)
+ IRQNoFlags() {8}
+ })
+}
+
+Device(TIMR) // 8254 Timer
+{
+ Name(_HID,EISAID("PNP0100"))
+
+ Name(_CRS,ResourceTemplate()
+ {
+ IO(Decode16,0x40,0x40,0x01,0x04)
+ IO(Decode16,0x50,0x50,0x10,0x04)
+ IRQNoFlags() {0}
+ })
+}
+
+Device(CWDT)
+{
+ Name(_HID,EISAID("INT3F0D"))
+ Name(_CID,EISAID("PNP0C02"))
+ Name(BUF0,ResourceTemplate()
+ {
+ IO(Decode16, 0x1854, 0x1854, 0x4, 0x4) // PMBS 0x1800 + Offset 0x54
+ }
+ )
+
+ Method(_STA,0,Serialized)
+ {
+ If(LEqual(WDTE,1))
+ {
+ Return(0x0F)
+ }
+ Else
+ {
+ Return(0x00)
+ }
+ }
+
+ Method(_CRS,0,Serialized)
+ {
+ Return(BUF0)
+ }
+}
diff --git a/ReferenceCode/AcpiTables/Dsdt/LpcB.asl b/ReferenceCode/AcpiTables/Dsdt/LpcB.asl
new file mode 100644
index 0000000..647a34d
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dsdt/LpcB.asl
@@ -0,0 +1,178 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Haswell *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+
+
+// LPC Bridge - Device 31, Function 0
+// Define the needed LPC registers used by ASL.
+
+scope(\_SB){
+ OperationRegion(\_SB.PCI0.LPCB.LPC1, PCI_Config, 0x00, 0x100)
+ Field(\_SB.PCI0.LPCB.LPC1, AnyAcc, NoLock, Preserve)
+ {
+ Offset(0x02),
+ CDID,16,
+ Offset(0x08),
+ CRID, 8,
+ Offset(0x60),
+ PARC, 8,
+ PBRC, 8,
+ PCRC, 8,
+ PDRC, 8,
+ Offset(0x68),
+ PERC, 8,
+ PFRC, 8,
+ PGRC, 8,
+ PHRC, 8,
+ Offset(0xAC),
+ , 8,
+ , 8,
+ XUSB, 1
+ }
+
+ Include ("98_LINK.ASL")
+}
+ OperationRegion(LPC0, PCI_Config, 0x40, 0xC0)
+ Field(LPC0, AnyAcc, NoLock, Preserve)
+ {
+ Offset(0x40), // 0x80h
+ IOD0, 8,
+ IOD1, 8,
+ Offset(0x78), // 0xB8h
+ , 6,
+ GR03, 2,
+ , 8,
+ GR08, 2,
+ GR09, 2,
+ GR0A, 2,
+ GR0B, 2,
+ , 8,
+ Offset(0x7C), // 0xBCh
+ , 2,
+ GR19, 2,
+ , 28,
+ Offset(0x0B0), // 0xF0h
+ RAEN, 1,
+ , 13,
+ RCBA, 18
+ }
+
+#if 0 //AMI_OVERRIDE --- Include EC.ASL in EC module. >>
+ Include ("EC.ASL")
+#endif //AMI_OVERRIDE --- Include EC.ASL in EC module. <<
+ Include ("LPC_DEV.ASL")
+#if 0 //AMI_OVERRIDE --- Using AMI SIO module. >>
+ Include ("NAT_SIO.ASL")
+ Include ("SMSC1007_SIO.ASL")
+ Include ("WPCN381U_SIO.ASL")
+ Include ("SMSC1000_SIO.ASL")
+ Include ("H8S2113_SIO.ASL")
+#endif //AMI_OVERRIDE --- Using AMI SIO module. <<
+
+ // Define the KBC_COMMAND_REG-64, KBC_DATA_REG-60 Registers as an ACPI Operating
+ // Region. These registers will be used to skip kbd mouse
+ // resource settings if not present.
+#if 0 //AMI_OVERRIDE --- Using AMI ACPI ASL code and SIO module. >>
+ OperationRegion(PKBS, SystemIO, 0x60, 0x05)
+ Field(PKBS, ByteAcc, Lock, Preserve)
+ {
+ PKBD, 8,
+ , 8,
+ , 8,
+ , 8,
+ PKBC, 8
+ }
+ Device(PS2K) // PS2 Keyboard
+ {
+ Name(_HID,"MSFT0001")
+ Name(_CID,EISAID("PNP0303"))
+
+ Method(_STA)
+ {
+ If(LEqual(BID, BHB))
+ {
+ Return(0x000F)
+ }
+ // Only report resources to the OS if the Keyboard is present
+ If(LOr(And(LEqual(PKBD,0xFF), LEqual(PKBC, 0xFF)), LEqual(BID, BFCC)))
+ {
+ Return(0x0000)
+ }
+ Return(0x000F)
+ }
+
+ Name(_CRS,ResourceTemplate()
+ {
+ IO(Decode16,0x60,0x60,0x01,0x01)
+ IO(Decode16,0x64,0x64,0x01,0x01)
+ IRQ(Edge,ActiveHigh,Exclusive){0x01}
+ })
+
+ Name(_PRS, ResourceTemplate(){
+ StartDependentFn(0, 0) {
+ FixedIO(0x60,0x01)
+ FixedIO(0x64,0x01)
+ IRQNoFlags(){1}
+ }
+ EndDependentFn()
+ })
+
+ }
+
+ Device(PS2M) // PS/2 Mouse
+ {
+ Name(_HID,"MSFT0003")
+ Name(_CID,EISAID("PNP0F03"))
+
+ Method(_STA)
+ {
+ If(LOr(LEqual(BID, BHB), LEqual(BID, BFCC)))
+ {
+ Return(0x0000)
+ }
+
+ If (P2ME)
+ {
+ Return(0x000F)
+ }
+
+ Return(0x0000)
+ }
+
+ Name(_CRS,ResourceTemplate()
+ {
+ IRQ(Edge,ActiveHigh,Exclusive){0x0C}
+ })
+
+ Name(_PRS, ResourceTemplate(){
+ StartDependentFn(0, 0) {
+ IRQNoFlags(){12}
+ }
+ EndDependentFn()
+ })
+ }
+#endif //AMI_OVERRIDE --- Using AMI ACPI ASL code and SIO module. <<
+
+
diff --git a/ReferenceCode/AcpiTables/Dsdt/NAT_COM.ASL b/ReferenceCode/AcpiTables/Dsdt/NAT_COM.ASL
new file mode 100644
index 0000000..6a1b9c5
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dsdt/NAT_COM.ASL
@@ -0,0 +1,481 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Haswell *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+
+
+
+Device(UAR3) // Serial Port A
+{
+ Name(_HID, EISAID("PNP0501"))
+
+ Name(_UID,2)
+
+ // Status Method for COM A.
+
+ Method(_STA,0,Serialized)
+ {
+ // Only report resources to the OS if the SIO Device is
+ // not set to Disabled in BIOS Setup.
+
+ If(LAnd(NATP,CMAP))
+ {
+ // Set the SIO to COM A.
+
+ Store(3,R07H)
+
+ // Display COMA and return status.
+
+ If(R30H)
+ {
+ Return(0x000F)
+ }
+
+ Return(0x000D)
+ }
+
+ Return(0x0000)
+ }
+
+ // Disable Method for COM A.
+
+ Method(_DIS,0,Serialized)
+ {
+ Store(3,R07H)
+ Store(0,R30H)
+ }
+
+ // Current Resource Setting Method for COM A.
+
+ Method(_CRS,0,Serialized)
+ {
+ // Create the Buffer that stores the Resources to
+ // be returned.
+
+ Name(BUF0,ResourceTemplate()
+ {
+ IO(Decode16,0x03F8,0x03F8,0x01,0x08)
+ IRQNoFlags(){4}
+ })
+
+ // Set SIO to COM A.
+
+ Store(3,R07H)
+
+ // Skip this sequence if the COMA Port is Disabled
+ // in BIOS Setup.
+
+ If(LAnd(NATP,CMAP))
+ {
+ // Create pointers to the specific byte.
+
+ CreateByteField(BUF0,0x02,IOL0)
+ CreateByteField(BUF0,0x03,IOH0)
+ CreateByteField(BUF0,0x04,IOL1)
+ CreateByteField(BUF0,0x05,IOH1)
+ CreateByteField(BUF0,0x07,LEN0)
+ CreateWordField(BUF0,0x09,IRQW)
+
+ // Write IO and Length values into the Buffer.
+
+ Store(R60H,IOH0)
+ Store(R61H,IOL0)
+ Store(R60H,IOH1)
+ Store(R61H,IOL1)
+ Store(8,LEN0)
+
+ // Write the IRQ value into the Buffer.
+
+ And(R70H,0x0F,Local0)
+ If(Local0)
+ {
+ ShiftLeft(One,Local0,IRQW)
+ }
+ Else
+ {
+ Store(Zero,IRQW)
+ }
+ }
+
+ Return(BUF0)
+ }
+
+ // Possible Resource Setting Method for COM A.
+
+ // Build a Buffer with all valid COM Port Resources.
+
+ Name(_PRS,ResourceTemplate()
+ {
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x2E8,0x2E8,0x01,0x08)
+ IRQNoFlags(){3}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x3F8,0x3F8,0x01,0x08)
+ IRQNoFlags(){3,4,5,6,7,10,11,12}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x2F8,0x2F8,0x01,0x08)
+ IRQNoFlags(){3,4,5,6,7,10,11,12}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x3E8,0x3E8,0x01,0x08)
+ IRQNoFlags(){3,4,5,6,7,10,11,12}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x2E8,0x2E8,0x01,0x08)
+ IRQNoFlags(){3,4,5,6,7,10,11,12}
+ }
+
+ EndDependentFn()
+ })
+
+
+ // Set Resource Setting Method for COM A.
+
+ Method(_SRS,1,Serialized)
+ {
+ // Point to the specific information in the passed
+ // in Buffer.
+
+ CreateByteField(Arg0,0x02,IOLO)
+ CreateByteField(Arg0,0x03,IOHI)
+ CreateWordField(Arg0,0x09,IRQW)
+
+ // Set the SIO to COM A.
+
+ Store(3,R07H)
+
+ // Disable the device.
+
+ Store(0,R30H)
+
+ // Set the Base IO Address.
+
+ Store(IOLO,R61H)
+ Store(IOHI,R60H)
+
+ // Set the IRQ.
+
+ FindSetRightBit(IRQW,Local0)
+ If(LNotEqual(IRQW,Zero))
+ {
+ Decrement(Local0)
+ }
+ Store(Local0,R70H)
+
+ // Set the Decode Range so COM A works on ICH7 and
+ // future platforms.
+
+ AND(IOD0,0xF8,IOD0) // Clear all bits.
+
+ If(LEqual(IOHI,0x03)) // Address = 0x3xx
+ {
+ If(LEqual(IOLO,0xF8)) // Address = 0x3F8
+ {
+ Or(IOD0,0x00,IOD0)
+ }
+ Else // Address = 0x3E8
+ {
+ Or(IOD0,0x07,IOD0)
+ }
+ }
+ Else // Address = 0x2xx
+ {
+ If(LEqual(IOLO,0xF8)) // Address = 0x2F8
+ {
+ Or(IOD0,0x01,IOD0)
+ }
+ Else // Address = 0x2E8
+ {
+ Or(IOD0,0x05,IOD0)
+ }
+ }
+
+ // Enable the device.
+
+ Store(1,R30H)
+ }
+
+ // D0 Method for COM Port.
+
+ Method(_PS0,0,Serialized)
+ {
+ Store(3,R07H)
+ Store(1,R30H)
+ }
+
+ // D3 Method for COM Port.
+
+ Method(_PS3,0,Serialized)
+ {
+ Store(3,R07H)
+ Store(0,R30H)
+ }
+}
+
+Device(UAR4) // Serial Port B
+{
+ Name(_HID, EISAID("PNP0501"))
+
+ Name(_UID,3)
+
+ // Status Method for COM B.
+
+ Method(_STA,0,Serialized)
+ {
+ // Only report resources to the OS if the SIO Device is
+ // not set to Disabled in BIOS Setup.
+
+ If(LAnd(NATP,CMBP))
+ {
+ // Set the SIO to COM B.
+
+ Store(2,R07H)
+
+ // Display COM B and return status.
+
+ If(R30H)
+ {
+ Return(0x000F)
+ }
+
+ Return(0x000D)
+ }
+
+ Return(0x0000)
+ }
+
+ // Disable Method for COM B.
+
+ Method(_DIS,0,Serialized)
+ {
+ Store(2,R07H)
+ Store(0,R30H)
+ }
+
+ // Current Resource Setting Method for COM B.
+
+ Method(_CRS,0,Serialized)
+ {
+ // Create the Buffer that stores the Resources to
+ // be returned.
+
+ Name(BUF0,ResourceTemplate()
+ {
+ IO(Decode16,0x02F8,0x02F8,0x01,0x08)
+ IRQNoFlags(){3}
+ })
+
+ // Set SIO to COM B.
+
+ Store(2,R07H)
+
+ // Skip this sequence if the COM B Port is Disabled
+ // in BIOS Setup.
+
+ If(LAnd(NATP,CMBP))
+ {
+ // Create pointers to the specific byte.
+
+ CreateByteField(BUF0,0x02,IOL0)
+ CreateByteField(BUF0,0x03,IOH0)
+ CreateByteField(BUF0,0x04,IOL1)
+ CreateByteField(BUF0,0x05,IOH1)
+ CreateByteField(BUF0,0x07,LEN0)
+ CreateWordField(BUF0,0x09,IRQW)
+
+ // Write IO and Length values into the Buffer.
+
+ Store(R60H,IOH0)
+ Store(R61H,IOL0)
+ Store(R60H,IOH1)
+ Store(R61H,IOL1)
+ Store(8,LEN0)
+
+ // Write the IRQ value into the Buffer.
+
+ And(R70H,0x0F,Local0)
+ If(Local0)
+ {
+ ShiftLeft(One,Local0,IRQW)
+ }
+ Else
+ {
+ Store(Zero,IRQW)
+ }
+ }
+
+ Return(BUF0)
+ }
+
+ // Possible Resource Setting Method for COM B.
+
+ // Build a Buffer with all valid COM B Port Resources.
+
+ Name(_PRS,ResourceTemplate()
+ {
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x2E8,0x2E8,0x01,0x08)
+ IRQNoFlags(){3}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x2F8,0x2F8,0x01,0x08)
+ IRQNoFlags(){3}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x3E8,0x3E8,0x01,0x08)
+ IRQNoFlags(){3}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x3F8,0x3F8,0x01,0x08)
+ IRQNoFlags(){3}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x2E8,0x2E8,0x01,0x08)
+ IRQNoFlags(){4}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x2F8,0x2F8,0x01,0x08)
+ IRQNoFlags(){4}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x3E8,0x3E8,0x01,0x08)
+ IRQNoFlags(){4}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x3F8,0x3F8,0x01,0x08)
+ IRQNoFlags(){4}
+ }
+
+ EndDependentFn()
+ })
+
+
+ // Set Resource Setting Method for COM B.
+
+ Method(_SRS,1,Serialized)
+ {
+ // Point to the specific information in the passed
+ // in Buffer.
+
+ CreateByteField(Arg0,0x02,IOLO)
+ CreateByteField(Arg0,0x03,IOHI)
+ CreateWordField(Arg0,0x09,IRQW)
+
+ // Set the SIO to COM B.
+
+ Store(2,R07H)
+
+ // Disable the device.
+
+ Store(0,R30H)
+
+ // Set the Base IO Address.
+
+ Store(IOLO,R61H)
+ Store(IOHI,R60H)
+
+ // Set the IRQ.
+
+ FindSetRightBit(IRQW,Local0)
+ If(LNotEqual(IRQW,Zero))
+ {
+ Decrement(Local0)
+ }
+ Store(Local0,R70H)
+
+ // Set the Decode Range so COM B works on ICH7 and
+ // future platforms.
+
+ AND(IOD0,0x8F,IOD0) // Clear all bits.
+
+ If(LEqual(IOHI,0x03)) // Address = 0x3xx
+ {
+ If(LEqual(IOLO,0xF8)) // Address = 0x3F8
+ {
+ Or(IOD0,0x00,IOD0)
+ }
+ Else // Address = 0x3E8
+ {
+ Or(IOD0,0x70,IOD0)
+ }
+ }
+ Else // Address = 0x2xx
+ {
+ If(LEqual(IOLO,0xF8)) // Address = 0x2F8
+ {
+ Or(IOD0,0x10,IOD0)
+ }
+ Else // Address = 0x2E8
+ {
+ Or(IOD0,0x50,IOD0)
+ }
+ }
+
+ // Enable the device.
+
+ Store(1,R30H)
+ }
+
+ // D0 Method for COM B Port.
+
+ Method(_PS0,0,Serialized)
+ {
+ Store(2,R07H)
+ Store(1,R30H)
+ }
+
+ // D3 Method for COM B Port.
+
+ Method(_PS3,0,Serialized)
+ {
+ Store(2,R07H)
+ Store(0,R30H)
+ }
+}
diff --git a/ReferenceCode/AcpiTables/Dsdt/NAT_LPT.ASL b/ReferenceCode/AcpiTables/Dsdt/NAT_LPT.ASL
new file mode 100644
index 0000000..72b2208
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dsdt/NAT_LPT.ASL
@@ -0,0 +1,942 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Haswell *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+
+
+
+// This ASL file will support the LPT in Output, BiDirectional, EPP,
+// & ECP mode. Only 1 of these devices will be shown by the OS at any
+// given time, and that one will depend on the BIOS configuration.
+
+Device(LPT1) // Printer, Output Mode
+{
+ Name(_HID,EISAID("PNP0400"))
+ Name(_UID,1)
+
+ // Status Method for LPT-Output Mode.
+
+ Method(_STA,0,Serialized)
+ {
+ // Output mode = 000xxxxxb - check that no bits are set.
+ Store(1,R07H)
+ If(LEqual(And(RF0H,0xE0),0x00))
+ {
+ // LPT is in Output Mode. Only report resources
+ // to the OS if the SIO Device is not set to
+ // Disabled in BIOS Setup.
+
+ If(LAnd(NATP,LPTP))
+ {
+ // Set SIO to LPT.
+
+
+ // Display POUT and return Status.
+
+ If(R30H)
+ {
+ Return(0x000F)
+ }
+
+ Return(0x000D)
+ }
+ }
+
+ Return(0x0000)
+ }
+
+ // Disable Method for LPT-Output Mode.
+
+ Method(_DIS,0,Serialized)
+ {
+ // Set SIO to LPT.
+
+ Store(1,R07H)
+
+ If(LEqual(And(RF0H,0xE0),0x00))
+ {
+ Store(0,R30H)
+ }
+ }
+
+ // Current Resource Setting Method for LPT-Output Mode.
+
+ Method(_CRS,0,Serialized)
+ {
+ // Create a buffer to return to OS.
+
+ Name(BUF0,ResourceTemplate()
+ {
+ IO(Decode16,0x0378,0x0378,0x01,0x04)
+ IRQNoFlags(){7}
+ })
+
+ // Skip this sequence if the LPT Device is not set
+ // to Output Mode.
+
+ If(LEqual(And(RF0H,0xE0),0x00))
+ {
+ // Create pointers to the specific byte.
+
+ CreateByteField(BUF0,0x02,IOL0)
+ CreateByteField(BUF0,0x03,IOH0)
+ CreateByteField(BUF0,0x04,IOL1)
+ CreateByteField(BUF0,0x05,IOH1)
+ CreateByteField(BUF0,0x07,LEN0)
+ CreateWordField(BUF0,0x09,IRQW)
+
+ // Set SIO to LPT.
+
+ Store(1,R07H)
+
+ // Write IO and Length values into the Buffer.
+
+ Store(R61H,IOL0)
+ Store(R60H,IOH0)
+ Store(IOL0,IOL1)
+ Store(IOH0,IOH1)
+ Store(4,LEN0)
+
+ // Write the IRQ value into the Buffer.
+
+ If(And(R70H,0x0F))
+ {
+ ShiftLeft(One,And(R70H,0x0F),IRQW)
+ }
+ Else
+ {
+ Store(Zero,IRQW)
+ }
+ }
+
+ Return(BUF0)
+ }
+
+ // Possible Resource Setting Method for LPT-Output Mode.
+
+ // Build a Buffer with all valid LPT Port Resources.
+
+ Name(_PRS,ResourceTemplate()
+ {
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x378,0x378,0x01,0x04)
+ IRQNoFlags(){7}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x278,0x278,0x01,0x04)
+ IRQNoFlags(){7}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x3BC,0x3BC,0x01,0x04)
+ IRQNoFlags(){7}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x378,0x378,0x01,0x04)
+ IRQNoFlags(){5}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x278,0x278,0x01,0x04)
+ IRQNoFlags(){5}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x3BC,0x3BC,0x01,0x04)
+ IRQNoFlags(){5}
+ }
+
+ EndDependentFn()
+ })
+
+
+ // Set Resource Setting Method for LPT-Output Mode.
+
+ Method(_SRS,1,Serialized)
+ {
+ // Point to the specific information in the passed
+ // in Buffer.
+
+ CreateByteField(Arg0,0x02,IOL0)
+ CreateByteField(Arg0,0x03,IOH0)
+ CreateWordField(Arg0,0x09,IRQW)
+
+ // Set SIO to LPT.
+
+ Store(1,R07H)
+
+ // Disable the LPT.
+
+ Store(0,R30H)
+
+ // Set to Output Mode.
+
+ And(RF0H,0x0F,RF0H)
+
+ // Disable the DMA channels.
+
+ Store(4,R74H)
+
+ // Set the Base IO Address.
+
+ Store(IOL0,R61H)
+ Store(IOH0,R60H)
+
+ // Set the IRQ.
+
+ FindSetRightBit(IRQW,Local0)
+ If (LNotEqual(IRQW,Zero))
+ {
+ Decrement(Local0)
+ }
+ Store(Local0,R70H)
+
+ // Set the Decode Range so POUT works when docked.
+
+ And(IOD1,0xFC,IOD1) // Decode all bits.
+
+ If(LEqual(IOH0,0x03)) // Address = 0x3xx
+ {
+ If(LEqual(IOL0,0x78)) // Address = 0x378
+ {
+ Or(IOD1,0x00,IOD1)
+ }
+ Else
+ {
+ Or(IOD1,0x02,IOD1) // Address = 0x3BC
+ }
+ }
+ Else // Address = 0x278
+ {
+ Or(IOD1,0x01,IOD1)
+ }
+
+ // Enable the LPT.
+
+ Store(1,R30H)
+ }
+
+ // D0 Method for LPT-Output Mode.
+
+ Method(_PS0,0,Serialized)
+ {
+ Store(1,R07H)
+ Store(1,R30H)
+ }
+
+ // D3 Method for LPT-Output Mode.
+
+ Method(_PS3,0,Serialized)
+ {
+ Store(1,R07H)
+ Store(0,R30H)
+ }
+}
+
+Device(PBI1) // Printer, BiDirectional Mode
+{
+ Name(_HID,EISAID("PNP0400"))
+ Name(_UID,2)
+
+ // Status Method for LPT-BiDirectional Mode.
+
+ Method(_STA,0,Serialized)
+ {
+ // BiDirectional mode = 001xxxxxb, so check that only
+ // bit 5 is set.
+
+ Store(1,R07H)
+ If(LEqual(And(RF0H,0xE0),0x20))
+ {
+ // LPT is in BiDirectional Mode. Only report
+ // resources to the OS if the SIO Device is not
+ // set to Disabled in BIOS Setup.
+
+ If(LAnd(NATP,LPTP))
+ {
+ // Display PBID and return Status.
+
+ If(R30H)
+ {
+ Return(0x000F)
+ }
+
+ Return(0x000D)
+ }
+ }
+
+ Return(0x0000)
+ }
+
+ // Disable Method for LPT-BiDirectional Mode.
+
+ Method(_DIS,0,Serialized)
+ {
+ // Set SIO to LPT.
+
+ Store(1,R07H)
+
+ If(LEqual(And(RF0H,0xE0),0x20))
+ {
+ Store(0,R30H)
+ }
+ }
+
+ // Current Resource Setting Method for LPT-BiDirectional Mode.
+
+ Method(_CRS,0,Serialized)
+ {
+ // Create a buffer to return to OS.
+
+ Name(BUF0,ResourceTemplate()
+ {
+ IO(Decode16,0x0378,0x0378,0x01,0x04)
+ IRQNoFlags(){7}
+ })
+
+ // Skip this sequence if the LPT Device is not set
+ // to BiDirectional Mode.
+
+ If(LEqual(And(RF0H,0xE0),0x20))
+ {
+ // Create pointers to the specific byte.
+
+ CreateByteField(BUF0,0x02,IOL0)
+ CreateByteField(BUF0,0x03,IOH0)
+ CreateByteField(BUF0,0x04,IOL1)
+ CreateByteField(BUF0,0x05,IOH1)
+ CreateByteField(BUF0,0x07,LEN0)
+ CreateWordField(BUF0,0x09,IRQW)
+
+ // Set SIO to LPT.
+
+ Store(1,R07H)
+
+ // Write IO and Length values into the Buffer.
+
+ Store(R61H,IOL0)
+ Store(R60H,IOH0)
+ Store(IOL0,IOL1)
+ Store(IOH0,IOH1)
+ Store(4,LEN0)
+
+ // Write the IRQ value into the Buffer.
+
+ If(And(R70H,0x0F))
+ {
+ ShiftLeft(One,And(R70H,0x0F),IRQW)
+ }
+ Else
+ {
+ Store(Zero, IRQW)
+ }
+ }
+
+ Return(BUF0)
+ }
+
+ // Possible Resource Setting Method for LPT-BiDirectional Mode.
+
+ Name(_PRS,ResourceTemplate()
+ {
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x378,0x378,0x01,0x04)
+ IRQNoFlags(){7}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x278,0x278,0x01,0x04)
+ IRQNoFlags(){7}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x3BC,0x3BC,0x01,0x04)
+ IRQNoFlags(){7}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x378,0x378,0x01,0x04)
+ IRQNoFlags(){5}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x278,0x278,0x01,0x04)
+ IRQNoFlags(){5}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x3BC,0x3BC,0x01,0x04)
+ IRQNoFlags(){5}
+ }
+
+ EndDependentFn()
+ })
+
+
+ // Set Resource Setting Method for LPT-BiDirectional Mode.
+
+ Method(_SRS,1,Serialized)
+ {
+ // Arg0 passed into _SRS is the buffer identical to BUF0.
+
+ CreateByteField(Arg0,0x02,IOL0)
+ CreateByteField(Arg0,0x03,IOH0)
+ CreateWordField(Arg0,0x09,IRQW)
+
+ Store(1,R07H)
+
+ // Disable the LPT.
+
+ Store(0,R30H)
+
+ // Set to Bi-Directional Mode.
+
+ Or(And(RF0H,0x0F),0x20,RF0H)
+
+ // Disable the DMA channels.
+
+ Store(4,R74H)
+
+ // Set the Base IO Address.
+
+ Store(IOL0,R61H)
+ Store(IOH0,R60H)
+
+ // Set the IRQ.
+
+ FindSetRightBit(IRQW,Local0)
+ If (LNotEqual(IRQW,Zero))
+ {
+ Decrement(Local0)
+ }
+ Store(Local0,R70H)
+
+ // Set the Decode Range so PBID works when docked.
+
+ And(IOD1,0xFC,IOD1) // Decode all bits.
+
+ If(LEqual(IOH0,0x03)) // Address = 0x3xx
+ {
+ If(LEqual(IOL0,0x78)) // Address = 0x378
+ {
+ Or(IOD1,0x00,IOD1)
+ }
+ Else
+ {
+ Or(IOD1,0x02,IOD1) // Address = 0x3BC
+ }
+ }
+ Else // Address = 0x278
+ {
+ Or(IOD1,0x01,IOD1)
+ }
+
+ // Enable the LPT.
+
+ Store(1,R30H)
+ }
+
+ // D0 Method for LPT-BiDirectional Mode.
+
+ Method(_PS0,0,Serialized)
+ {
+ Store(1,R07H)
+ Store(1,R30H)
+ }
+
+ // D3 Method for LPT-BiDirectional Mode.
+
+ Method(_PS3,0,Serialized)
+ {
+ Store(1,R07H)
+ Store(0,R30H)
+ }
+}
+
+Device(PEP1) // Printer, EPP Mode
+{
+ Name(_HID,EISAID("PNP0400"))
+ Name(_UID,3)
+
+ // Status Method for LPT-EPP Mode.
+
+ Method(_STA,0,Serialized)
+ {
+ // EPP 1.9 mode = 011xxxxxb.
+
+ Store(1,R07H)
+ If(LOr(LEqual(And(RF0H,0xE0),0x60), LEqual(And(RF0H,0xE0),0x40)))
+ {
+ // LPT is in EPP Mode. Only report resources
+ // to the OS if the SIO Device is not set to
+ // Disabled in BIOS Setup.
+
+ If(LAnd(NATP,LPTP))
+ {
+ // Display PEPP and return Status.
+
+ If(R30H)
+ {
+ Return(0x000F)
+ }
+ Else
+ {
+ Return(0x000D)
+ }
+ }
+ }
+
+ Return(0x0000)
+ }
+
+ // Disable Method for LPT-EPP Mode.
+
+ Method(_DIS,0,Serialized)
+ {
+ // Set SIO to LPT.
+
+ Store(1,R07H)
+
+ If(LOr(LEqual(And(RF0H,0xE0),0x60), LEqual(And(RF0H,0xE0),0x40)))
+ {
+ Store(0,R30H)
+ }
+ }
+
+ // Current Resource Setting Method for LPT-EPP Mode.
+
+ Method(_CRS,0,Serialized)
+ {
+ // Create a buffer to return to OS.
+
+ Name(BUF0,ResourceTemplate()
+ {
+ IO(Decode16,0x0378,0x0378,0x01,0x08)
+ IRQNoFlags(){7}
+ })
+
+ // Skip this sequence if the LPT Device is not set
+ // to EPP Mode.
+
+ If(LOr(LEqual(And(RF0H,0xE0),0x60), LEqual(And(RF0H,0xE0),0x40)))
+ {
+ // Create pointers to the specific byte.
+
+ CreateByteField(BUF0,0x02,IOL0)
+ CreateByteField(BUF0,0x03,IOH0)
+ CreateByteField(BUF0,0x04,IOL1)
+ CreateByteField(BUF0,0x05,IOH1)
+ CreateByteField(BUF0,0x07,LEN0)
+ CreateWordField(BUF0,0x09,IRQW)
+
+ // Set SIO to LPT.
+
+ Store(1,R07H)
+
+ // Write IO and Length values into the Buffer.
+
+ Store(R61H,IOL0)
+ Store(R60H,IOH0)
+ Store(IOL0,IOL1)
+ Store(IOH0,IOH1)
+ Store(8,LEN0)
+
+ // Write the IRQ value into the Buffer.
+
+ If(And(R70H,0x0F))
+ {
+ ShiftLeft(One,And(R70H,0x0F),IRQW)
+ }
+ Else
+ {
+ Store(Zero, IRQW)
+ }
+ }
+
+ Return(BUF0)
+ }
+
+ // Possible Resource Setting Method for LPT-EPP Mode.
+
+ Name(_PRS,ResourceTemplate()
+ {
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x378,0x378,0x01,0x08)
+ IRQNoFlags(){7}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x278,0x278,0x01,0x08)
+ IRQNoFlags(){7}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x378,0x378,0x01,0x08)
+ IRQNoFlags(){5}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x278,0x278,0x01,0x08)
+ IRQNoFlags(){5}
+ }
+
+ EndDependentFn()
+ })
+
+
+ // Set Resource Setting Method for LPT-EPP Mode.
+
+ Method(_SRS,1,Serialized)
+ {
+ // Arg0 passed into _SRS is the buffer identical to BUF0.
+
+ CreateByteField(Arg0,0x02,IOL0)
+ CreateByteField(Arg0,0x03,IOH0)
+ CreateWordField(Arg0,0x09,IRQW)
+
+ Store(1,R07H)
+
+ // Disable the LPT.
+
+ Store(0,R30H)
+
+ // Set to EPP 1.9 Mode.
+
+ Or(And(RF0H,0x0F),0x60,RF0H)
+
+ // Disable the DMA channels.
+
+ Store(4,R74H)
+
+ // Set the Base IO Address.
+
+ Store(IOL0,R61H)
+ Store(IOH0,R60H)
+
+ // Set the IRQ.
+
+ FindSetRightBit(IRQW,Local0)
+ If (LNotEqual(IRQW,Zero))
+ {
+ Decrement(Local0)
+ }
+ Store(Local0,R70H)
+
+ // Set the Decode Range so PEPP works when docked.
+
+ And(IOD1,0xFC,IOD1) // Decode all bits.
+
+ If(LEqual(IOH0,0x03)) // Address = 0x378
+ {
+ Or(IOD1,0x00,IOD1)
+ }
+ Else // Address = 0x278
+ {
+ Or(IOD1,0x01,IOD1)
+ }
+
+ // Enable the LPT.
+
+ Store(1,R30H)
+ }
+
+ // D0 Method for LPT-EPP Mode.
+
+ Method(_PS0,0,Serialized)
+ {
+ Store(1,R07H)
+ Store(1,R30H)
+ }
+
+ // D3 Method for LPT-EPP Mode.
+
+ Method(_PS3,0,Serialized)
+ {
+ Store(1,R07H)
+ Store(0,R30H)
+ }
+}
+
+Device(PEC1) // Printer, ECP Mode
+{
+ Name(_HID,EISAID("PNP0401"))
+ Name(_UID,4)
+
+ // Status Method for LPT-ECP Mode.
+
+ Method(_STA,0,Serialized)
+ {
+ // ECP mode = 1111xxxxxb.
+
+ Store(1,R07H)
+ If(LOr(LEqual(And(RF0H,0xE0),0xE0), LEqual(And(RF0H,0xE0),0x80)))
+ {
+ // LPT is in ECP Mode. Only report resources
+ // to the OS if the SIO Device is not set to
+ // Disabled in BIOS Setup.
+
+ If(LAnd(NATP,LPTP))
+ {
+ // Display PECP and return Status.
+
+ If(R30H)
+ {
+ Return(0x000F)
+ }
+ Else
+ {
+ Return(0x000D)
+ }
+ }
+ }
+
+ Return(0x0000)
+ }
+
+ // Disable Method for LPT-ECP Mode.
+
+ Method(_DIS,0,Serialized)
+ {
+ // Set SIO to LPT.
+
+ Store(1,R07H)
+
+ If(LOr(LEqual(And(RF0H,0xE0),0xE0), LEqual(And(RF0H,0xE0),0x80)))
+ {
+ Store(0,R30H)
+ }
+ }
+
+ // Current Resource Setting Method for LPT-ECP Mode.
+
+ Method(_CRS,0,Serialized)
+ {
+ // Create a buffer to return to OS.
+
+ Name(BUF0,ResourceTemplate()
+ {
+ IO(Decode16,0x0378,0x0378,0x01,0x08)
+ IO(Decode16,0x0778,0x0778,0x01,0x08)
+ IRQNoFlags(){7}
+ DMA(Compatibility,NotBusMaster,Transfer8_16,){1}
+ })
+
+ // Skip this sequence if the LPT Device is not set
+ // to ECP Mode.
+
+ If(LOr(LEqual(And(RF0H,0xE0),0xE0), LEqual(And(RF0H,0xE0),0x80)))
+ {
+ // Create pointers to the specific byte.
+
+ CreateByteField(BUF0,0x02,IOL0)
+ CreateByteField(BUF0,0x03,IOH0)
+ CreateByteField(BUF0,0x04,IOL1)
+ CreateByteField(BUF0,0x05,IOH1)
+ CreateByteField(BUF0,0x07,LEN0)
+ CreateByteField(BUF0,0x0A,IOL2)
+ CreateByteField(BUF0,0x0B,IOH2)
+ CreateByteField(BUF0,0x0C,IOL3)
+ CreateByteField(BUF0,0x0D,IOH3)
+ CreateByteField(BUF0,0x0F,LEN1)
+ CreateWordField(BUF0,0x11,IRQW)
+ CreateByteField(BUF0,0x14,DMA0)
+
+ // Set SIO to LPT.
+
+ Store(1,R07H)
+
+ // Write IO and Length values into the Buffer.
+
+ Store(R61H,IOL0)
+ Store(R60H,IOH0)
+ Store(IOL0,IOL1)
+ Store(IOH0,IOH1)
+ Store(IOL0,IOL2)
+ Store(Add(0x4,IOH0),IOH2)
+ Store(IOL0,IOL3)
+ Store(Add(0x4,IOH0),IOH3)
+ Store(8,LEN0)
+ Store(8,LEN1)
+
+ // Write the IRQ value into the Buffer.
+
+ And(R70H,0x0F,Local0)
+ If(Local0)
+ {
+ ShiftLeft(One,Local0,IRQW)
+ }
+ Else
+ {
+ Store(Zero,IRQW)
+ }
+
+ // Write the DMA value into the Buffer.
+
+ Store(R74H,Local0)
+ If(LEqual(Local0,0x04))
+ {
+ Store(Zero,DMA0)
+ }
+ Else
+ {
+ ShiftLeft(One,Local0,DMA0)
+ }
+ }
+
+ Return(BUF0)
+ }
+
+ // Possible Resource Setting Method for LPT-ECP Mode.
+
+ Name(_PRS,ResourceTemplate()
+ {
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x378,0x378,0x01,0x08)
+ IO(Decode16,0x778,0x778,0x01,0x08)
+ IRQNoFlags(){7}
+ DMA(Compatibility,NotBusMaster,Transfer8_16){3}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x278,0x278,0x01,0x08)
+ IO(Decode16,0x678,0x678,0x01,0x08)
+ IRQNoFlags(){7}
+ DMA(Compatibility,NotBusMaster,Transfer8_16){1,2,3}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x378,0x378,0x01,0x08)
+ IO(Decode16,0x778,0x778,0x01,0x08)
+ IRQNoFlags(){5}
+ DMA(Compatibility,NotBusMaster,Transfer8_16){1,2,3}
+
+
+
+
+
+ }
+
+ EndDependentFn()
+ })
+
+
+ // Set Resource Setting Method for LPT-ECP Mode.
+
+ Method(_SRS,1,Serialized)
+ {
+ // Arg0 passed into _SRS is the buffer identical to BUF0.
+
+ CreateByteField(Arg0,0x02,IOL0)
+ CreateByteField(Arg0,0x03,IOH0)
+ CreateWordField(Arg0,0x11,IRQW)
+ CreateByteField(Arg0,0x14,DMA0)
+
+ Store(1,R07H)
+
+ // Disable the LPT.
+
+ Store(0,R30H)
+
+ // Set to ECP Mode with EPP Mode 4 support.
+
+ Or(RF0H,0xF0,RF0H)
+
+ // Set the Base I/O Address
+
+ Store(IOL0,R61H)
+ Store(IOH0,R60H)
+
+ // Set the IRQ
+
+ FindSetRightBit(IRQW,Local0)
+ If (LNotEqual(IRQW,Zero))
+ {
+ Decrement(Local0)
+ }
+ Store(Local0,R70H)
+
+ // Set the DMA Channel
+
+ FindSetRightBit(DMA0,Local0)
+ If (LNotEqual(DMA0,Zero))
+ {
+ Decrement(Local0)
+ }
+ Store(Local0,R74H)
+
+ // Set the Decode Range so PECP works when docked.
+
+ And(IOD1,0xFC,IOD1) // Decode all bits.
+
+ If(LEqual(IOH0,0x03)) // Address = 0x378
+ {
+ Or(IOD1,0x00,IOD1)
+ }
+ Else // Address = 0x278
+ {
+ Or(IOD1,0x01,IOD1)
+ }
+
+ // Enable the LPT.
+
+ Store(1,R30H)
+ }
+
+ // D0 Method for LPT-ECP Mode.
+
+ Method(_PS0,0,Serialized)
+ {
+ Store(1,R07H)
+ Store(1,R30H)
+ }
+
+ // D3 Method for LPT-ECP Mode.
+
+ Method(_PS3,0,Serialized)
+ {
+ Store(1,R07H)
+ Store(0,R30H)
+ }
+}
diff --git a/ReferenceCode/AcpiTables/Dsdt/NAT_SIO.ASL b/ReferenceCode/AcpiTables/Dsdt/NAT_SIO.ASL
new file mode 100644
index 0000000..a09b4c8
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dsdt/NAT_SIO.ASL
@@ -0,0 +1,96 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Haswell *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+
+
+Device(N393)
+{
+ Name(_HID,EISAID("PNP0A05"))
+
+ Name(_UID,1)
+
+ // Status Method for the National SIO.
+
+ Method(_STA,0,Serialized)
+ {
+ // Only report resources to the OS if the SIO Device is
+ // present on the Docking Board.
+
+ If(NATP)
+ {
+ Return(0x000F)
+ }
+
+ Return(0x0000)
+ }
+
+ // Define the SIO Index/Data Registers as an ACPI Operating
+ // Region. These registers will be used communicate to the SIO.
+
+ OperationRegion(N393, SystemIO, 0x02E, 0x02)
+ Field(N393, ByteAcc, Lock, Preserve)
+ {
+ INDX, 8,
+ DATA, 8
+ }
+
+ // Use ACPI Defined IndexField so consecutive Index/Data I/Os are
+ // assured to be uninterrupted.
+
+ IndexField(INDX, DATA, ByteAcc, Lock, Preserve)
+ {
+ Offset(0x07), // Logical Device Number.
+ R07H, 8,
+ Offset(0x20), // SIO Configuration and ID.
+ R20H, 8,
+ R21H, 8,
+ R22H, 8,
+ R23H, 8,
+ R24H, 8,
+ R25H, 8,
+ R26H, 8,
+ R27H, 8,
+ R28H, 8,
+ R29H, 8,
+ R2AH, 8,
+ Offset(0x30), // Logical Device Activate.
+ R30H, 8,
+ Offset(0x60), // I/O Space Configuration.
+ R60H, 8,
+ R61H, 8,
+ Offset(0x70), // Interrupt Configuration.
+ R70H, 8,
+ R71H, 8,
+ Offset(0x74), // DMA Configuration.
+ R74H, 8,
+ R75H, 8,
+ Offset(0xF0), // Special Logical Device Configuration.
+ RF0H, 8,
+ RF1H, 8
+ }
+
+ Include ("NAT_COM.ASL")
+ Include ("NAT_LPT.ASL")
+}
diff --git a/ReferenceCode/AcpiTables/Dsdt/Nfc.asl b/ReferenceCode/AcpiTables/Dsdt/Nfc.asl
new file mode 100644
index 0000000..c828ac7
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dsdt/Nfc.asl
@@ -0,0 +1,93 @@
+ /**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Ivy Bridge *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+
+//
+// NFC modules definitions.
+//
+
+scope (\)
+{
+ //
+ // Magnetics Peak NFC module
+ //
+ Device(NFC1)
+ {
+ Name(_HID, EISAID("SKTD000"))
+
+ Method(_STA)
+ {
+ If(LEqual(NFCE, 3))
+ {
+ Return(0x0F) // NFC enabled, show it
+ }
+ Else
+ {
+ Return(0x00) // NFC disabled, hide it
+ }
+ }
+ }
+
+ //
+ // NXP NFC module
+ //
+ Device(NFC2)
+ {
+ Name(_HID, EISAID("NXP5442"))
+
+ Method(_STA)
+ {
+ If(LEqual(NFCE, 2))
+ {
+ Return(0x0F) // NFC enabled, show it
+ }
+ Else
+ {
+ Return(0x00) // NFC disabled, hide it
+ }
+ }
+ }
+
+ //
+ // Magnetics Peak 2 NFC module
+ //
+ Device(NFC3)
+ {
+ Name(_HID, EISAID("ICV0A12"))
+
+ Method(_STA)
+ {
+ If(LEqual(NFCE, 1))
+ {
+ Return(0x0F) // NFC enabled, show it
+ }
+ Else
+ {
+ Return(0x00) // NFC disabled, hide it
+ }
+ }
+ }
+}
+
diff --git a/ReferenceCode/AcpiTables/Dsdt/PCIEDOCK.ASL b/ReferenceCode/AcpiTables/Dsdt/PCIEDOCK.ASL
new file mode 100644
index 0000000..6c2c18b
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dsdt/PCIEDOCK.ASL
@@ -0,0 +1,89 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Haswell *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+
+
+Device (\_SB.PCI0.DOCK)
+{
+
+ Name(_HID, "ABCD0000")
+ Name(_CID, EISAID("PNP0C15"))
+ Name(_UID,"SADDLESTRING")
+
+ Method(_EJ0, 1) {
+ P8XH(0,0xED)
+ If(LEqual(ECON,1))
+ {
+ \_SB.PCI0.LPCB.H_EC.ECWT(1, RefOf(\_SB.PCI0.LPCB.H_EC.EJET))
+ }
+ Return ()
+ }
+
+ Method(_STA, 0) {
+ If(LEqual(ECON,0))
+ {
+ Return(0x0)
+ }
+ If(LEqual(S0ID,1))
+ {
+ Return(0x0)
+ }
+ if(\DSTS) {
+ P8XH(1,0x13)
+ P8XH(0,0x13)
+ Return(0x0F)
+ } else {
+ P8XH(1,0x14)
+ P8XH(0,0x14)
+ Return(0x0)
+ }
+ }
+
+ Method(_DCK, 1) {
+ P8XH(0,0xD3)
+
+ If (Arg0) {
+ Return (1)
+ }
+ Else {
+ Store(0, \DSTS)
+ If(LEqual(ECON,1))
+ {
+ \_SB.PCI0.LPCB.H_EC.ECWT(0, RefOf(\_SB.PCI0.LPCB.H_EC.EJET))
+ }
+ Return (1)
+ }
+ }
+
+
+ Name(_EDL, Package( ) { // DOCK1 has several dependent devices
+ \_SB.PCI0.RP07.PXSX,
+ \_SB.PCI0.RP08.PXSX,
+ \_SB.PCI0.EHC1,
+ \_SB.PCI0.SAT0,
+ \_SB.PCI0.HDEF,
+ })
+
+}
diff --git a/ReferenceCode/AcpiTables/Dsdt/PCI_DRC.ASL b/ReferenceCode/AcpiTables/Dsdt/PCI_DRC.ASL
new file mode 100644
index 0000000..a461e59
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dsdt/PCI_DRC.ASL
@@ -0,0 +1,138 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Haswell *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+
+
+Scope (\_SB.PCI0){
+
+ Device(PDRC)
+ {
+ //
+ // PCI Device Resource Consumption
+ //
+
+ Name(_HID,EISAID("PNP0C02"))
+
+ Name(_UID,1)
+
+ Name(BUF0,ResourceTemplate()
+ {
+ //
+ // RCRB BAR _BAS will be updated in _CRS below according to B0:D31:F0:Reg.F0
+ //
+ Memory32Fixed(ReadWrite,0,0x04000,RCRB)
+ //
+ // MCH BAR _BAS will be updated in _CRS below according to B0:D0:F0:Reg.48h
+ //
+ Memory32Fixed(ReadWrite,0,0x08000,MCHB)
+ //
+ // DMI BAR _BAS will be updated in _CRS below according to B0:D0:F0:Reg.68h
+ //
+ Memory32Fixed(ReadWrite,0,0x01000,DMIB)
+ //
+ // EP BAR _BAS will be updated in _CRS below according to B0:D0:F0:Reg.40h
+ //
+ Memory32Fixed(ReadWrite,0,0x01000,EGPB)
+ //
+ // PCI Express BAR _BAS and _LEN will be updated in _CRS below according to B0:D0:F0:Reg.60h
+ //
+ Memory32Fixed(ReadWrite,0,0,PCIX)
+
+ //
+ // MISC ICH TTT base address reserved for the TxT module use. Check if the hard code meets the real configuration.
+ // If not, dynamically update it like the _CRS method below.
+ //
+ Memory32Fixed(ReadWrite,0xFED20000,0x20000)
+
+ //
+ // VTD engine memory range. Check if the hard code meets the real configuration.
+ // If not, dynamically update it like the _CRS method below.
+ //
+ Memory32Fixed(ReadOnly, 0xFED90000, 0x00004000)
+
+ //
+ // MISC ICH. Check if the hard code meets the real configuration.
+ // If not, dynamically update it like the _CRS method below.
+ //
+ Memory32Fixed(ReadWrite,0xFED45000,0x4B000,TPMM)
+
+ //
+ // FLASH range
+ //
+ Memory32Fixed (ReadOnly, 0xFF000000, 0x1000000, FIOH) //16MB as per IOH spec
+
+ //
+ // Local APIC range(0xFEE0_0000 to 0xFEEF_FFFF)
+ //
+ Memory32Fixed (ReadOnly, 0xFEE00000, 0x100000, LIOH)
+
+ //
+ // Thermal Base Address. TBAR _BAS and _LEN will be updated in _CRS below according to B0:D31:F6:Reg.40h
+ //
+ Memory32Fixed (ReadWrite, 0, 0x01000, TBAR)
+
+ //
+ // S3 Save And Restore temporay memory bar
+ //
+ Memory32Fixed (ReadWrite, 0, 0x10000, SNRB)
+
+ })
+
+
+ Method(_CRS,0,Serialized)
+ {
+ CreateDwordField(BUF0,^RCRB._BAS,RBR0)
+ ShiftLeft(\_SB.PCI0.LPCB.RCBA,14,RBR0)
+
+ CreateDwordField(BUF0,^TBAR._BAS,TBR0)
+ Store(TBAB,TBR0)
+ CreateDwordField(BUF0,^TBAR._LEN,TBLN)
+ If(LEqual(TBAB,0)){
+ Store(0,TBLN)
+ }
+
+ CreateDwordField(BUF0,^SNRB._BAS,SNR0)
+ Store(\SRMB,SNR0) // SRMB is defined in PCH.asl
+
+
+ CreateDwordField(BUF0,^MCHB._BAS,MBR0)
+ ShiftLeft(\_SB.PCI0.MHBR,15,MBR0)
+
+ CreateDwordField(BUF0,^DMIB._BAS,DBR0)
+ ShiftLeft(\_SB.PCI0.DIBR,12,DBR0)
+
+ CreateDwordField(BUF0,^EGPB._BAS,EBR0)
+ ShiftLeft(\_SB.PCI0.EPBR,12,EBR0)
+
+ CreateDwordField(BUF0,^PCIX._BAS,XBR0)
+ ShiftLeft(\_SB.PCI0.PXBR,26,XBR0)
+
+ CreateDwordField(BUF0,^PCIX._LEN,XSZ0)
+ ShiftRight(0x10000000, \_SB.PCI0.PXSZ,XSZ0)
+
+ Return(BUF0)
+ }
+ } //end of PDRC
+} // end of SB
diff --git a/ReferenceCode/AcpiTables/Dsdt/Platform.asl b/ReferenceCode/AcpiTables/Dsdt/Platform.asl
new file mode 100644
index 0000000..401f94a
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dsdt/Platform.asl
@@ -0,0 +1,1880 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Haswell *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+
+
+// Define the following External variables to prevent a WARNING when
+// using ASL.EXE and an ERROR when using IASL.EXE.
+
+External(PDC0)
+External(PDC1)
+External(PDC2)
+External(PDC3)
+External(PDC4)
+External(PDC5)
+External(PDC6)
+External(PDC7)
+External(\_PR.CFGD)
+
+External(\_SB.IAOE.PTSL)
+External(\_SB.IAOE.ECTM)
+External(\_SB.IAOE.RCTM)
+External(\_SB.IAOE.ITMR)
+External(\_SB.IAOE.FFSE)
+External(\_SB.IFFS.FFSS)
+External(\_SB.IAOE.PCIS)
+
+External(\_SB.IAOE.IBT1) // Isct Byte1 for EC
+External(\_SB.IAOE.WKRS) // ISCT Wake Reason
+#if !defined(ASL_Remove_SaSsdt_Data_To_Dsdt) || (ASL_Remove_SaSsdt_Data_To_Dsdt == 0)
+External(\_SB.PCI0.GFX0.TCHE) // Technology enabled indicator
+External(\_SB.PCI0.GFX0.STAT) // State Indicator
+External(\_SB.PCI0.B0D3.ABAR)
+External(\_SB.PCI0.B0D3.BARA)
+External(\SGMD)
+#endif
+
+External(\_SB.TPM.PTS, MethodObj)
+External(\_SB.PCI0.I2C0.SHUB.PI2C.PUAM, MethodObj) //DUAM - Device User Absent Mode
+External(\_SB.PCI0.PAUD.PUAM, MethodObj) //PUAM - PowerResource User Absent Mode
+External(\_SB.PCI0.XHC.DUAM, MethodObj) //DUAM - Device User Absent Mode for XHCI controller
+#ifndef AMI_OVERRIDE_FOR_ACPI_DEBUG
+External(\MDBG, MethodObj)
+#endif // AMI_OVERRIDE_FOR_ACPI_DEBUG
+
+External(\_SB.PCI0.PEG0.PEGP.EPON, MethodObj)
+External(\_SB.PCI0.RP05.PEGP.EPON, MethodObj)
+
+#define CONVERTIBLE_BUTTON 6
+#define DOCK_INDICATOR 7
+
+Name(ECUP, 1) // EC State indicator: 1- Normal Mode 0- Low Power Mode
+Mutex(EHLD, 0) // EC Hold indicator: 0- No one accessing the EC Power State 1- Someone else is accessing the EC Power State
+
+// NFC module support
+include("Nfc.asl")
+
+// Create a Global MUTEX.
+
+Mutex(MUTX,0)
+
+//AMI_OVERRIDE --- Debug output registers. >>
+//------------------------------------------------------------------------
+// Procedure: DBG8
+// Procedure: DBG9
+// Description: Logical names for Debug ports 0x80(byte) and 0x90(word).
+// If such debug ports exist in the System, the value, stored
+// into the Port will be displayed to LED
+// Input: Nothing
+// Output: Nothing
+//-------------------------------------------------------------------------
+
+OperationRegion (DEB0, SystemIO, 0x80, 1)
+Field (DEB0, ByteAcc, NoLock, Preserve)
+{ DBG8, 8 }
+
+OperationRegion (DEB1, SystemIO, 0x90, 2)
+Field (DEB1, WordAcc, NoLock, Preserve)
+{ DBG9, 16 }
+//AMI_OVERRIDE --- Debug output registers. <<
+
+#if 0 //AMI_OVERRIDE --- Below ASL code is for Thunderbolt, AMI thunderbolt module has taken care it already.>>
+// OS Up mutex
+Mutex(OSUM, 0)
+// WAK Finished mutex
+Mutex(WFDM, 0)
+#endif //AMI_OVERRIDE --- it is for Thunderbolt, AMI thunderbolt module has taken care it already. <<
+
+// Define Port 80 as an ACPI Operating Region to use for debugging. Please
+// note that the Intel CRBs have the ability to ouput an entire DWord to
+// Port 80h for debugging purposes, so the model implemented here may not be
+// able to be used on OEM Designs.
+
+OperationRegion(PRT0,SystemIO,0x80,4)
+Field(PRT0,DwordAcc,Lock,Preserve)
+{
+ P80H, 32
+}
+
+
+// Port 80h Update:
+// Update 8 bits of the 32-bit Port 80h.
+//
+// Arguments:
+// Arg0: 0 = Write Port 80h, Bits 7:0 Only.
+// 1 = Write Port 80h, Bits 15:8 Only.
+// 2 = Write Port 80h, Bits 23:16 Only.
+// 3 = Write Port 80h, Bits 31:24 Only.
+// Arg1: 8-bit Value to write
+//
+// Return Value:
+// None
+
+Method(P8XH,2,Serialized)
+{
+ If(LEqual(Arg0,0)) // Write Port 80h, Bits 7:0.
+ {
+ Store(Or(And(P80D,0xFFFFFF00),Arg1),P80D)
+ }
+
+ If(LEqual(Arg0,1)) // Write Port 80h, Bits 15:8.
+ {
+ Store(Or(And(P80D,0xFFFF00FF),ShiftLeft(Arg1,8)),P80D)
+ }
+
+ If(LEqual(Arg0,2)) // Write Port 80h, Bits 23:16.
+ {
+ Store(Or(And(P80D,0xFF00FFFF),ShiftLeft(Arg1,16)),P80D)
+ }
+
+ If(LEqual(Arg0,3)) // Write Port 80h, Bits 31:24.
+ {
+ Store(Or(And(P80D,0x00FFFFFF),ShiftLeft(Arg1,24)),P80D)
+ }
+
+ Store(P80D,P80H)
+}
+
+Method(ADBG,1,Serialized)
+{
+#ifndef AMI_OVERRIDE_FOR_ACPI_DEBUG
+ If(CondRefOf(MDBG))
+ {
+ Return(MDBG(Arg0))
+ }
+ Return(0)
+#endif // AMI_OVERRIDE_FOR_ACPI_DEBUG
+}
+
+//
+// Define SW SMI port as an ACPI Operating Region to use for generate SW SMI.
+//
+OperationRegion(SPRT,SystemIO, 0xB2,2)
+Field (SPRT, ByteAcc, Lock, Preserve) {
+ SSMP, 8
+}
+
+// The _PIC Control Method is optional for ACPI design. It allows the
+// OS to inform the ASL code which interrupt controller is being used,
+// the 8259 or APIC. The reference code in this document will address
+// PCI IRQ Routing and resource allocation for both cases.
+//
+// The values passed into _PIC are:
+// 0 = 8259
+// 1 = IOAPIC
+
+Method(\_PIC,1)
+{
+ Store(Arg0,GPIC)
+ Store(Arg0,PICM)
+}
+
+// Prepare to Sleep. The hook is called when the OS is about to
+// enter a sleep state. The argument passed is the numeric value of
+// the Sx state.
+
+Method(_PTS,1)
+{
+ Store(0,P80D) // Zero out the entire Port 80h DWord.
+ P8XH(0,Arg0) // Output Sleep State to Port 80h, Byte 0.
+
+ PTS(Arg0) //AMI_OVERRIDE --- Invoke PTS Method PRIOR TO ENTER ANY SLEEP STATE
+ ADBG(Concatenate("_PTS=",ToHexString(Arg0)))
+#if 0 //AMI_OVERRIDE --- Below ASL code is for Thunderbolt, AMI thunderbolt module has taken care it already.>>
+ If(LOr(LEqual(BID, BICO),LEqual(BID, BICC))) {
+ Acquire(WFDM, 0xFFFF)
+ Store(0, WKFN)
+ Release(WFDM)
+ }
+
+#endif //AMI_OVERRIDE --- it is for Thunderbolt, AMI thunderbolt module has taken care it already. <<
+ //
+ // Save Sleep state if iSCT is present
+ //
+ If(And(ICNF, 0x10))
+ {
+ If(CondRefOf(\_SB.IAOE.PTSL))
+ {
+ Store(Arg0, \_SB.IAOE.PTSL)
+ }
+ }
+
+ // If code is executed, Wake from RI# via Serial Modem will be
+ // enabled. If code is not executed, COM Port Debugging throughout
+ // all Sx states will be enabled.
+
+ If(LEqual(Arg0,3))
+ {
+ //
+ // Disable update DTS temperature and threshold value in every SMI
+ //
+ If(LAnd(DTSE, LGreater(TCNT, 1)))
+ {
+ TRAP(\TRTD,30)
+ }
+
+ //
+ // Set EC timer if iSCT enabled and EC timer is being used
+ //
+#ifndef AMI_OVERRIDE_FOR_EC_SUPPORT
+ If(LEqual(\ECON,1))
+ {
+#endif // AMI_OVERRIDE_FOR_EC_SUPPORT
+ If(And(ICNF, 0x01))
+ {
+ //
+ // ISCT SASD - Set EC based timer.
+ //
+ If(LAnd(And(ICNF, 0x10), LEqual(\_SB.IAOE.ITMR, 0)))
+ {
+ If (LAnd(CondRefOf(\_SB.PCI0.LPCB.H_EC.AWT0), CondRefOf(\_SB.IAOE.ECTM)))
+ {
+ If (LGreater(\_SB.IAOE.ECTM, 0))
+ {
+ \_SB.PCI0.LPCB.H_EC.ECWT(And(\_SB.IAOE.ECTM, 0xFF), RefOf(\_SB.PCI0.LPCB.H_EC.AWT0))
+ \_SB.PCI0.LPCB.H_EC.ECWT(ShiftRight(And(\_SB.IAOE.ECTM, 0xFF00), 8), RefOf(\_SB.PCI0.LPCB.H_EC.AWT1))
+ \_SB.PCI0.LPCB.H_EC.ECWT(ShiftRight(And(\_SB.IAOE.ECTM, 0xFF0000), 16), RefOf(\_SB.PCI0.LPCB.H_EC.AWT2))
+ //
+ // Enable EC timer - BIT7
+ // Enable wake from S3 on timer exiry - BIT0
+ //
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.WTMS)), Local0)
+ \_SB.PCI0.LPCB.H_EC.ECWT(Or(0x81,Local0), RefOf(\_SB.PCI0.LPCB.H_EC.WTMS))
+ }
+ }
+ }
+
+ //
+ // ISCT - Check if RapidStart service exist or not
+ // If RapidStart then enable EC timer wake from S4.
+ //
+ If(LAnd(And(ICNF, 0x10), CondRefOf(\_SB.IFFS.FFSS)))
+ {
+ If (And(\_SB.IFFS.FFSS, 0x01))
+ {
+ Store(1, \_SB.IAOE.FFSE)
+ If (LAnd(CondRefOf(\_SB.PCI0.LPCB.H_EC.WTMS), LEqual(\_SB.IAOE.PTSL, 0x03)))
+ {
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.WTMS)), Local0)
+ //
+ // Enable wake from S4 on timer exiry - BIT1
+ //
+ \_SB.PCI0.LPCB.H_EC.ECWT(Or(0x02,Local0), RefOf(\_SB.PCI0.LPCB.H_EC.WTMS))
+ }
+ }
+ Else
+ {
+ Store(0, \_SB.IAOE.FFSE)
+ }
+ }
+ }
+#ifndef AMI_OVERRIDE_FOR_EC_SUPPORT
+ }
+#endif // AMI_OVERRIDE_FOR_EC_SUPPORT
+
+ }
+ //
+ // Save EC 10Sec mode to NVS data PB1E Bit7 at S3/S4 entry
+ //
+ If(LOr(LEqual(Arg0,3), LEqual(Arg0,4)))
+ {
+ If(LAnd(CondRefOf(\_SB.PCI0.LPCB.H_EC.PB10), \ECON)){
+ //
+ // Check EC 10sec PB mode is enabled.(H_EC.PB10)
+ // PB10 is cleared at every boot so we need to keep the state before entering S3/S4.
+ //
+ If(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PB10)))
+ {
+ //
+ // EC 10sec PB mode is enabled. Save the state in PB1E bit7
+ //
+ Or(PB1E, 0x80, PB1E)
+ }
+ Else
+ {
+ //
+ // EC 10sec PB mode is not enabled. Clear PB1E bit7.
+ //
+ And(PB1E, 0x7F, PB1E)
+ }
+ }
+ }
+
+
+#if 0 //AMI_OVERRIDE --- It is for CRB SIO using, OEM doesn't need to it. >>
+ If(LEqual(DBGS,0))
+ {
+ Store(0,RT10) // Set MAXIM Transceiver = FORCEOFF.
+ Store(0x20,PME1) // Set SMSC GPI15 = Wake Event.
+ Store(1,PME0) // Set SMSC PME Enable.
+ Store(0x20,PMS1) // Clear GPI15 Status.
+ Store(1,PMS0) // Clear PME Status.
+ }
+#endif //AMI_OVERRIDE --- It is for CRB SIO using, OEM doesn't need to it. <<
+
+ // Generate a SW SMI trap to save some NVRAM data back to CMOS.
+
+ // Don't enable IGD OpRegion support yet.
+ // TRAP(1, 81)
+ //
+ // Call TPM.PTS
+ //
+ If(CondRefOf(\_SB.TPM.PTS))
+ {
+ //
+ // Call TPM PTS method
+ //
+ \_SB.TPM.PTS (Arg0)
+ }
+
+ // StandBy LED Drive. Program High for sleep state s3, s4 and s5 only fro desktop.
+ If(LOr(LOr(LEqual(Arg0,3), LEqual(Arg0,4)), LEqual(Arg0,5))){
+ If(LEqual(PFLV,FDTP)){
+ Store(1, \GP27)
+ }
+ }
+}
+
+#if 0 //AMI_OVERRIDE --- Below ASL code is for Thunderbolt, AMI thunderbolt module has taken care it already.>>
+External(\_GPE.OSUP, MethodObj)
+External(\_GPE.MMTB, MethodObj)
+
+ Method(MMRP)
+ {
+ Store(PEBS, Local0) // MMIO Base address
+ Add(Local0, 0xE0000, Local0) // RP01
+ Subtract(ToInteger(TBSE), 1, Local1)
+ Multiply(Local1, 0x1000, Local1)
+ Add(Local0, Local1, Local0) // RP0x
+
+ Return(Local0)
+ }
+#endif //AMI_OVERRIDE --- It is for CRB SIO using, OEM doesn't need to it. <<
+
+// Wake. This hook is called when the OS is about to wake from a
+// sleep state. The argument passed is the numeric value of the
+// sleep state the system is waking from.
+
+Method(_WAK,1,Serialized)
+{
+ P8XH(1,0xAB) // Beginning of _WAK.
+
+ WAK(Arg0) //AMI_OVERRIDE --- Invoke WAK Method WHILE WAKE FROM ANY SLEEP STATE
+
+ ADBG("_WAK")
+
+ If(LOr(LEqual(Arg0,3), LEqual(Arg0,4))) // If S3 or S4 Resume
+ {
+ //
+ // During S3/S4 wake add indicator for 'Switchable/Hybrid Graphics endpoint device is on'
+ //
+ If(CondRefOf(\_SB.PCI0.PEG0.PEGP.EPON))
+ {
+ \_SB.PCI0.PEG0.PEGP.EPON()
+ }
+
+ If(CondRefOf(\_SB.PCI0.RP05.PEGP.EPON))
+ {
+ \_SB.PCI0.RP05.PEGP.EPON()
+ }
+ }
+
+ //
+ // Save a valid Audio BAR for the ABWA W/A
+ //
+ If (LAnd (LNotEqual (And(\_SB.PCI0.B0D3.ABAR, 0xFFFFC004), 0xFFFFC004), LNotEqual (And (\_SB.PCI0.B0D3.ABAR, 0xFFFFC000), 0))) {
+ Store (\_SB.PCI0.B0D3.ABAR, \_SB.PCI0.B0D3.BARA)
+ }
+
+ //
+ // Clear iSCT timers and sleep settings if iSCT is present
+ //
+ If(And(ICNF, 0x10))
+ {
+ //
+ // If Graphics Driver supports disable display notification in ISCT mode
+ //
+ If (And(\_SB.PCI0.GFX0.TCHE, 0x100))
+ {
+ //
+ // Notify Gfx driver that the platform is in Isct Mode
+ //
+ If (LEqual(\_SB.IAOE.ITMR, 1))
+ {
+ //
+ // If ISCT Mode and Wake Reason is ISCT wake (RTC Timer or Network PME)
+ // Then notify graphics driver to turn off display
+ //
+ If (LAnd(And(\_SB.IAOE.IBT1, 0x01), LOr(And(\_SB.IAOE.WKRS, 0x02), And(\_SB.IAOE.WKRS, 0x10)))) {
+ Store(Or(And(\_SB.PCI0.GFX0.STAT, Not(0x03)), 0x01), \_SB.PCI0.GFX0.STAT) // BITS[1:0] = 01, ISCT Resume
+ } else {
+ Store(And(\_SB.PCI0.GFX0.STAT, Not(0x03)), \_SB.PCI0.GFX0.STAT) // BITS[1:0] = 00, Normal Resume to S0
+ }
+ } else {
+ If(LEqual(\ECON,1)) {
+ If(CondRefOf(\_SB.PCI0.LPCB.H_EC.IBT1)) {
+ //
+ // If ISCT Mode and Wake Reason is ISCT wake (EC Timer or Network PME)
+ // Then notify graphics driver to turn off display
+ //
+ If (LAnd(And(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.IBT1)), 0x01), LOr(And(\_SB.IAOE.WKRS, 0x02), And(\_SB.IAOE.WKRS, 0x10)))) {
+ Store(Or(And(\_SB.PCI0.GFX0.STAT, Not(0x03)), 0x01), \_SB.PCI0.GFX0.STAT) // BITS[1:0] = 01, ISCT Resume
+ } else {
+ Store(And(\_SB.PCI0.GFX0.STAT, Not(0x03)), \_SB.PCI0.GFX0.STAT) // BITS[1:0] = 00, Normal Resume to S0
+ }
+ }
+ } // (LEqual(\ECON,1))
+ }
+ }
+
+ If(CondRefOf(\_SB.IAOE.PTSL))
+ {
+ Store(0, \_SB.IAOE.PTSL)
+ }
+ If (LEqual(\_SB.IAOE.ITMR, 0)) {
+ If(CondRefOf(\_SB.PCI0.LPCB.H_EC.WTMS))
+ {
+ \_SB.PCI0.LPCB.H_EC.ECWT(0, RefOf(\_SB.PCI0.LPCB.H_EC.WTMS))
+ }
+ }
+ If (CondRefOf(\_SB.IAOE.ECTM))
+ {
+ Store(0, \_SB.IAOE.ECTM)
+ }
+ If (CondRefOf(\_SB.IAOE.RCTM))
+ {
+ Store(0, \_SB.IAOE.RCTM)
+ }
+ }
+
+ If(NEXP)
+ {
+ // Reinitialize the Native PCI Express after resume
+
+ If(And(OSCC,0x02))
+ {
+ \_SB.PCI0.NHPG()
+ }
+ If(And(OSCC,0x04)) // PME control granted?
+ {
+ \_SB.PCI0.NPME()
+ }
+ }
+
+ If(LEqual(Arg0,3))
+ {
+ // Turn off the CPU Fan for all OSes if Active Cooling
+ // is disabled.
+
+ If(LEqual(0,ACTT))
+ {
+ If(LEqual(\ECON,1))
+ {
+ \_SB.PCI0.LPCB.H_EC.ECWT(0, RefOf(\_SB.PCI0.LPCB.H_EC.CFAN))
+ }
+ }
+ }
+
+ If(LOr(LEqual(Arg0,3), LEqual(Arg0,4))) // If S3 or S4 Resume
+ {
+
+ //
+ // Restore EC 10sec PB override mode
+ //
+ If(LAnd(CondRefOf(\_SB.PCI0.LPCB.H_EC.PB10), \ECON)){
+ If(And(PB1E, 0x80))
+ {
+ \_SB.PCI0.LPCB.H_EC.ECWT(1, RefOf(\_SB.PCI0.LPCB.H_EC.PB10))
+ }
+ }
+
+ // Check to send Convertible/Dock state changes upon resume from Sx.
+
+ If(And(GBSX,0x40))
+ {
+ \_SB.PCI0.GFX0.IUEH(6)
+
+ //
+ // Do the same thing for Virtul Button device.
+ // Toggle Bit3 of PB1E(Slate/Notebook status)
+ //
+#if defined(ASL_CRB_EC_SUPPORT) && (ASL_CRB_EC_SUPPORT == 1)
+ Xor(PB1E, 0x08, PB1E)
+
+ //
+ // Update VGBS(V-GPIO Button state) accordingly.
+ //
+ If(And(PB1E, 0x08)){
+ If(LAnd(CondRefOf(\_SB.PCI0.LPCB.H_EC.VGBI), \ECON))
+ {
+ \_SB.PCI0.LPCB.H_EC.VGBI.UPBT(CONVERTIBLE_BUTTON, One)
+ }
+ }
+ Else
+ {
+ If(LAnd(CondRefOf(\_SB.PCI0.LPCB.H_EC.VGBI), \ECON))
+ {
+ \_SB.PCI0.LPCB.H_EC.VGBI.UPBT(CONVERTIBLE_BUTTON, Zero)
+ }
+ }
+#endif //#ifdef ASL_CRB_EC_SUPPORT
+ }
+
+ If(And(GBSX,0x80))
+ {
+ \_SB.PCI0.GFX0.IUEH(7)
+
+ //
+ // Do the same thing for Virtul Button device.
+ // Toggle Bit4 of PB1E (Dock/Undock status)
+ //
+#if defined(ASL_CRB_EC_SUPPORT) && (ASL_CRB_EC_SUPPORT == 1)
+ Xor(PB1E, 0x10, PB1E)
+
+ //
+ // Update VGBS(Virtual Button state) accordingly.
+ //
+ If(And(PB1E, 0x10))
+ {
+ If(LAnd(CondRefOf(\_SB.PCI0.LPCB.H_EC.VGBI), \ECON))
+ {
+ \_SB.PCI0.LPCB.H_EC.VGBI.UPBT(DOCK_INDICATOR, One)
+ }
+ }
+ Else
+ {
+ If(LAnd(CondRefOf(\_SB.PCI0.LPCB.H_EC.VGBI), \ECON))
+ {
+ \_SB.PCI0.LPCB.H_EC.VGBI.UPBT(DOCK_INDICATOR, Zero)
+ }
+ }
+
+#endif //#ifdef ASL_CRB_EC_SUPPORT
+ }
+
+
+#if defined(ASL_CRB_EC_SUPPORT) && (ASL_CRB_EC_SUPPORT == 1)
+ //
+ // Prevent reinitializing Virtual GPIO Button status
+ //
+ If(CondRefOf(\_SB.PCI0.LPCB.H_EC.VGBI.ONTM))
+ {
+ Store(1, \_SB.PCI0.LPCB.H_EC.VGBI.ONTM)
+ }
+#endif //#ifdef ASL_CRB_EC_SUPPORT
+ If(LAnd(DTSE, LGreater(TCNT, 1)))
+ {
+ TRAP(\TRTD, 20)
+ }
+
+ // Windows XP SP2 does not properly restore the P-State
+ // upon resume from S4 or S3 with degrade modes enabled.
+ // Use the existing _PPC methods to cycle the available
+ // P-States such that the processor ends up running at
+ // the proper P-State.
+ //
+ // Note: For S4, another possible W/A is to always boot
+ // the system in LFM.
+ //
+
+ If(LEqual(OSYS,2002))
+ {
+ If(And(\_PR.CFGD,0x01))
+ {
+ If(LGreater(\_PR.CPU0._PPC,0))
+ {
+ Subtract(\_PR.CPU0._PPC,1,\_PR.CPU0._PPC)
+ PNOT()
+ Add(\_PR.CPU0._PPC,1,\_PR.CPU0._PPC)
+ PNOT()
+ }
+ Else
+ {
+ Add(\_PR.CPU0._PPC,1,\_PR.CPU0._PPC)
+ PNOT()
+ Subtract(\_PR.CPU0._PPC,1,\_PR.CPU0._PPC)
+ PNOT()
+ }
+ }
+ }
+
+ If(LEqual(\ECON,1))
+ {
+ // Update Lid state after S3 or S4 resume
+ If(LOr(LEqual(Arg0,3), LEqual(Arg0,4))) // If S3 or S4 Resume
+ {
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.LSTE)), LIDS)
+
+ If(IGDS)
+ {
+ If (LEqual(LIDS, 0))
+ {
+ Store(0x80000000,\_SB.PCI0.GFX0.CLID)
+ }
+ If (LEqual(LIDS, 1))
+ {
+ Store(0x80000003,\_SB.PCI0.GFX0.CLID)
+ }
+ }
+ Notify(\_SB.LID0,0x80)
+ }
+
+ // Detect the change of Dock state
+ If(LNotEqual(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.DOCK)), \DSTS))
+ {
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.DOCK)), \DSTS)
+ If(LAnd(\_SB.PCI0.HDEF.DCKS, 1))
+ {
+ Store(\DSTS, \_SB.PCI0.HDEF.DCKA)
+ }
+ If(LEqual(\DSTS, 1)) // Docked.
+ {
+ If(LEqual(Arg0,3))
+ {
+ Sleep(1000) // Delay 1 second for hot docking stability
+ Store(\PDBR, \SSMP)
+ Sleep(1000) // Delay 1 second for hot docking stability
+ }
+ Notify(\_SB.PCI0.DOCK, 0)
+ }
+ Else // Undocked.
+ {
+ Notify(\_SB.PCI0.DOCK, 1)
+ }
+ }
+
+ // Detect the change of Power State.
+ If(LEqual(BNUM,0))
+ {
+ If(LNotEqual(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.VPWR)),PWRS))
+ {
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.VPWR)),PWRS)
+ // Perform needed ACPI Notifications.
+ PNOT()
+ }
+ }
+ Else
+ {
+ If(LNotEqual(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.RPWR)),PWRS))
+ {
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.RPWR)),PWRS)
+ // Perform needed ACPI Notifications.
+ PNOT()
+ }
+ }
+ }
+
+#if 0 //AMI_OVERRIDE --- Below ASL code is for Thunderbolt, AMI thunderbolt module has taken care it already.>>
+ If(LOr(LEqual(BID, BICO),LEqual(BID, BICC))) {
+ Acquire(OSUM, 0xFFFF)
+ Store(MMRP(), Local0)
+ OperationRegion(RP_X,SystemMemory,Local0,0x20)
+ Field(RP_X,DWordAcc, NoLock, Preserve)
+ {
+ REG0, 32,
+ REG1, 32,
+ REG2, 32,
+ REG3, 32,
+ REG4, 32,
+ REG5, 32,
+ REG6, 32,
+ REG7, 32
+ }
+ Store(REG6, Local1)
+ Store(0x00F0F000, REG6)
+ Store(\_GPE.MMTB(), Local2)
+ \_GPE.OSUP(Local2)
+ Store(Local1, REG6)
+ Release(OSUM)
+ }
+#endif //AMI_OVERRIDE --- it is for Thunderbolt, AMI thunderbolt module has taken care it already. <<
+
+ // For PCI Express Express Cards, it is possible a device was
+ // either inserted or removed during an Sx State. The problem
+ // is that no wake event will occur for a given warm inseration
+ // or removal, so the OS will not become aware of any change.
+ // To get around this, re-enumerate all Express Card slots.
+ //
+ // If the Root Port is enabled, it may be assumed to be hot-pluggable.
+
+#if defined(ASL_RC_PORT_0) && (ASL_RC_PORT_0==1)
+ If(LEqual(RP1D,0))
+ {
+ Notify (\_SB.PCI0.RP01,0)
+ }
+#endif // ASL_RC_PORT_0
+
+#if defined(ASL_RC_PORT_1) && (ASL_RC_PORT_1==1)
+ If(LEqual(RP2D,0))
+ {
+ Notify (\_SB.PCI0.RP02,0)
+ }
+#endif // ASL_RC_PORT_1
+
+#if defined(ASL_RC_PORT_2) && (ASL_RC_PORT_2==1)
+ If(LEqual(RP3D,0))
+ {
+ Notify (\_SB.PCI0.RP03,0)
+ }
+#endif // ASL_RC_PORT_2
+
+#if defined(ASL_RC_PORT_3) && (ASL_RC_PORT_3==1)
+ If(LEqual(RP4D,0))
+ {
+ Notify (\_SB.PCI0.RP04,0)
+ }
+#endif // ASL_RC_PORT_3
+
+#if defined(ASL_RC_PORT_4) && (ASL_RC_PORT_4==1)
+ If(LEqual(RP5D,0))
+ {
+ Notify (\_SB.PCI0.RP05,0)
+ }
+#endif // ASL_RC_PORT_4
+
+#if defined(ASL_RC_PORT_5) && (ASL_RC_PORT_5==1)
+ If(LEqual(\RP6D,0))
+ {
+ Notify (\_SB.PCI0.RP06,0)
+ }
+#endif // ASL_RC_PORT_5
+
+#if defined(ASL_RC_PORT_6) && (ASL_RC_PORT_6==1)
+ If(LEqual(RP7D,0))
+ {
+ If(LEqual(\DSTS,0)) // UnDocked.
+ {
+ Notify (\_SB.PCI0.RP07,0)
+ }
+ }
+#endif // ASL_RC_PORT_6
+
+#if defined(ASL_RC_PORT_7) && (ASL_RC_PORT_7==1)
+ If(LEqual(RP8D,0))
+ {
+ If(LEqual(\DSTS,0)) // UnDocked.
+ {
+ Notify (\_SB.PCI0.RP08,0)
+ }
+ }
+#endif // ASL_RC_PORT_7
+ }
+
+ If(LOr(LEqual(Arg0,3), LEqual(Arg0,4))) // If S3 or S4 Resume
+ {
+ //
+ // To support Win8, RapidStart resume from G3 and resume from DeepSx state
+ //
+ \_SB.PCI0.XHC.XWAK()
+ }
+#if 0 //AMI_OVERRIDE --- Below ASL code is for Thunderbolt, AMI thunderbolt module has taken care it already.>>
+ If(LOr(LEqual(BID, BICO),LEqual(BID, BICC))) {
+ Acquire(WFDM, 0xFFFF)
+ Store(1, WKFN)
+ Release(WFDM)
+ ADBG(Concatenate("_WAK=", ToHexString(Timer)))
+ }
+#endif //AMI_OVERRIDE --- it is for Thunderbolt, AMI thunderbolt module has taken care it already. <<
+ Return(Package(){0,0})
+}
+
+// Get Buffer:
+// This method will take a buffer passed into the method and
+// create then return a smaller buffer based on the pointer
+// and size parameters passed in.
+//
+// Arguments:
+// Arg0: Pointer to start of new Buffer in passed in Buffer.
+// Arg1: Size of Buffer to create.
+// Arg2: Original Buffer
+//
+// Return Value:
+// Newly created buffer.
+
+Method(GETB,3,Serialized)
+{
+ Multiply(Arg0,8,Local0) // Convert Index.
+ Multiply(Arg1,8,Local1) // Convert Size.
+ CreateField(Arg2,Local0,Local1,TBF3) // Create Buffer.
+
+ Return(TBF3) // Return Buffer.
+}
+
+// Power Notification:
+// Perform all needed OS notifications during a
+// Power Switch.
+//
+// Arguments:
+// None
+//
+// Return Value:
+// None
+
+Method(PNOT,0,Serialized)
+{
+ //
+ // If MP enabled and driver support is present, notify all
+ // processors.
+ //
+ If(CondRefOf(\_SB.PCCD.PENB)) { // is CPPC enabled in SETUP?
+ Notify(\_SB.PCCD,0x82) // CPPC notify
+ } Else {
+ If(LGreater(TCNT, 1))
+ {
+ If(And(PDC0,0x0008)){
+ Notify(\_PR.CPU0,0x80) // Eval CPU0 _PPC.
+ }
+ If(And(PDC1,0x0008)){
+ Notify(\_PR.CPU1,0x80) // Eval CPU1 _PPC.
+ }
+ If(And(PDC2,0x0008)){
+ Notify(\_PR.CPU2,0x80) // Eval CPU2 _PPC.
+ }
+ If(And(PDC3,0x0008)){
+ Notify(\_PR.CPU3,0x80) // Eval CPU3 _PPC.
+ }
+ If(And(PDC4,0x0008)){
+ Notify(\_PR.CPU4,0x80) // Eval CPU4 _PPC.
+ }
+ If(And(PDC5,0x0008)){
+ Notify(\_PR.CPU5,0x80) // Eval CPU5 _PPC.
+ }
+ If(And(PDC6,0x0008)){
+ Notify(\_PR.CPU6,0x80) // Eval CPU6 _PPC.
+ }
+ If(And(PDC7,0x0008)){
+ Notify(\_PR.CPU7,0x80) // Eval CPU7 _PPC.
+ }
+ }Else{
+ Notify(\_PR.CPU0,0x80) // Eval _PPC.
+ }
+ }
+
+ If(LGreater(TCNT, 1)){
+ If(LAnd(And(PDC0,0x0008),And(PDC0,0x0010))){
+ Notify(\_PR.CPU0,0x81) // Eval CPU0 _CST.
+ }
+ If(LAnd(And(PDC1,0x0008),And(PDC1,0x0010))){
+ Notify(\_PR.CPU1,0x81) // Eval CPU1 _CST.
+ }
+ If(LAnd(And(PDC2,0x0008),And(PDC2,0x0010))){
+ Notify(\_PR.CPU2,0x81) // Eval CPU2 _CST.
+ }
+ If(LAnd(And(PDC3,0x0008),And(PDC3,0x0010))){
+ Notify(\_PR.CPU3,0x81) // Eval CPU3 _CST.
+ }
+ If(LAnd(And(PDC4,0x0008),And(PDC4,0x0010))){
+ Notify(\_PR.CPU4,0x81) // Eval CPU4 _CST.
+ }
+ If(LAnd(And(PDC5,0x0008),And(PDC5,0x0010))){
+ Notify(\_PR.CPU5,0x81) // Eval CPU5 _CST.
+ }
+ If(LAnd(And(PDC6,0x0008),And(PDC6,0x0010))){
+ Notify(\_PR.CPU6,0x81) // Eval CPU6 _CST.
+ }
+ If(LAnd(And(PDC7,0x0008),And(PDC7,0x0010))){
+ Notify(\_PR.CPU7,0x81) // Eval CPU7 _CST.
+ }
+ }Else{
+ Notify(\_PR.CPU0,0x81) // Eval _CST.
+ }
+
+ // Update the Battery 1 and 2 Stored Capacity and
+ // Stored Status. Battery 0 information is always accurrate.
+
+ If(LEqual(\ECON,1))
+ {
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.B1CC)),B1SC)
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.B1ST)),B1SS)
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.B2CC)),B2SC)
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.B2ST)),B2SS)
+
+ // Perform update to all Batteries in the System.
+ If(LGreaterEqual(OSYS,2006)) // Vista and Win7 later on OS
+ {
+ Notify(\_SB.PCI0.LPCB.H_EC.BAT0,0x81) // Eval BAT0 _BST.
+ Notify(\_SB.PCI0.LPCB.H_EC.BAT1,0x81) // Eval BAT1 _BST.
+ Notify(\_SB.PCI0.LPCB.H_EC.BAT2,0x81) // Eval BAT2 _BST.
+ }
+ Else
+ {
+ Notify(\_SB.PCI0.LPCB.H_EC.BAT0,0x80) // Eval BAT0 _BST.
+ Notify(\_SB.PCI0.LPCB.H_EC.BAT1,0x80) // Eval BAT1 _BST.
+ Notify(\_SB.PCI0.LPCB.H_EC.BAT2,0x80) // Eval BAT2 _BST.
+ }
+ }
+
+ If (LEqual(DPTF,1)){
+ Notify(\_SB.IETM, 0x86) // Notification sent to DPTF driver (Policy) for PDRT reevaluation after AC/DC transtion has occurred.
+ }
+}
+
+//
+// Memory window to the CTDP registers starting at MCHBAR+5000h.
+//
+OperationRegion (MBAR, SystemMemory, Add(ShiftLeft(\_SB.PCI0.MHBR,15),0x5000), 0x1000)
+ Field (MBAR, ByteAcc, NoLock, Preserve)
+ {
+ Offset (0x938), // PACKAGE_POWER_SKU_UNIT (MCHBAR+0x5938)
+ PWRU, 4, // Power Units [3:0] unit value is calculated by 1 W / Power(2,PWR_UNIT). The default value of 0011b corresponds to 1/8 W.
+ Offset (0x9A0), // TURBO_POWER_LIMIT1 (MCHBAR+0x59A0)
+ PPL1, 15, // PKG_PWR_LIM_1 [14:0]
+ PL1E,1, // PKG_PWR_LIM1_EN [15]
+ CLP1,1, // Package Clamping Limitation 1
+ }
+Name(CLMP, 0) // save the clamp bit
+Name(PLEN,0) // save the power limit enable bit
+Name(PLSV,0x8000) // save value of PL1 upon entering CS
+Name(CSEM, 0) //semaphore to avoid multiple calls to SPL1. SPL1/RPL1 must always be called in pairs, like push/pop off a stack
+//
+// SPL1 (Set PL1 to 4.5 watts with clamp bit set)
+// Per Legacy Thermal management CS requirements, we would like to set the PL1 limit when entering CS to 4.5W with clamp bit set via MMIO.
+// This can be done in the ACPI object which gets called by graphics driver during CS Entry.
+// Likewise, during CS exit, the BIOS must reset the PL1 value to the previous value prior to CS entry and reset the clamp bit.
+//
+// Arguments:
+// None
+//
+// Return Value:
+// None
+Method(SPL1,0,Serialized)
+{
+ Name(PPUU,0) // units
+ If (LEqual(CSEM, 1))
+ {
+ Return() // we have already been called, must have CS exit before calling again
+ }
+ Store(1, CSEM) // record first call
+
+ Store (PPL1, PLSV) // save PL1 value upon entering CS
+ Store (PL1E, PLEN) // save PL1 Enable bit upon entering CS
+ Store (CLP1, CLMP) // save PL1 Clamp bit upon entering CS
+
+ If (LEqual(PWRU,0)) { // use PACKAGE_POWER_SKU_UNIT - Power Units[3:0]
+ Store(1,PPUU)
+ } Else {
+ ShiftLeft(Decrement(PWRU),2,PPUU) // get units
+ }
+
+ Multiply(PLVL,PPUU,Local0) // convert SETUP value to power units in milli-watts
+ Divide(Local0,1000,,Local1) // convert SETUP value to power units in watts
+ Store(Local1, PPL1) // copy value to PL1
+ Store(1, PL1E) // set Enable bit
+ Store(1, CLP1) // set Clamp bit
+}
+//
+// RPL1 (Restore the PL1 register to the values prior to CS entry)
+//
+// Arguments:
+// None
+//
+// Return Value:
+// None
+Method(RPL1,0,Serialized)
+{
+ Store (PLSV, PPL1) // restore value of PL1 upon exiting CS
+ Store(PLEN, PL1E) // restore the PL1 enable bit
+ Store(CLMP, CLP1) // restore the PL1 Clamp bit
+ Store(0, CSEM) // restore semaphore
+}
+
+Name(DDPS, 0) // Current Display Power Status. 0= D0; non-zero = Dx state;. Initial value is zero.
+Name(UAMS, 0) // User Absent Mode state, Zero - User Present; non-Zero - User not present
+// GUAM - Global User Absent Mode
+// Run when a change to User Absent mode is made, e.g. screen/display on/off events.
+// Any device that needs notifications of these events includes its own UAMN Control Method.
+//
+// Arguments:
+// Power State:
+// 00h = On
+// 01h = Standby
+// 02h = Suspend
+// 04h = Off
+// 08h = Reduced On
+//
+// Return Value:
+// None
+//
+Method(GUAM,1,Serialized)
+{
+ If(LNotEqual(Arg0, DDPS)){ // Display controller D-State changed?
+ Store(Arg0, DDPS) //Update DDPS to current state
+ Store(LAnd(Arg0, Not(PWRS)), UAMS) // UAMS: User Absent Mode state, Zero - User Present; non-Zero - User not present
+
+ //Port 80 code for CS
+ If(Arg0){
+ if(LEqual(ECNO,0x01)){ // Check EC notification enabled in Setup
+ ADBG("EC Notify")
+ if(LEqual(ECDB,0x01)){
+ ADBG("EC Debug")
+ \_SB.PCI0.LPCB.H_EC.ECWT(1, RefOf(\_SB.PCI0.LPCB.H_EC.DLED)) //Set EC CS Debug Light (CAPS LOCK)
+ }
+ \_SB.PCI0.LPCB.H_EC.ECMD (0x2C) // Notify EC of CS entry
+ If(LEqual(ECLP, 0x1)) {
+ Store(Zero,\ECUP)
+ }
+ }
+ P8XH(0, 0xC5)
+ P8XH(1, 00)
+ ADBG("Enter CS")
+ If(PSCP){
+ // if P-state Capping is enabled
+ If (LAnd(CondRefOf(\_PR.CPU0._PSS), CondRefOf(\_PR.CPU0._PPC)))
+ {
+ Subtract(SizeOf(\_PR.CPU0._PSS), One, \_PR.CPU0._PPC)
+ PNOT()
+ }
+ }
+ If(PLCS){
+ SPL1() // set PL1 to low value upon CS entry
+ }
+ } Else {
+ if(LEqual(ECNO,0x01)){ // Check EC notification enabled in Setup
+ ADBG("EC Notify")
+ Store (Acquire(\EHLD, 0xFFFF), Local0) // Wait for Mutex for telling EC to exit Low Power Mode
+ if (LEqual(Local0, Zero)) {
+ \_SB.PCI0.LPCB.H_EC.ECMD (0x2D) // Notify EC of CS exit
+ If(LEqual(ECLP, 0x1)) {
+ Store(One,\ECUP)
+ }
+ Release(\EHLD)
+ }
+ ADBG("EC Debug")
+ \_SB.PCI0.LPCB.H_EC.ECWT(0, RefOf(\_SB.PCI0.LPCB.H_EC.DLED)) //Clear EC CS Debug Light (CAPS LOCK)
+ }
+ P8XH(0, 0xC5)
+ P8XH(1, 0xAB)
+ ADBG("Exit CS")
+ If(PSCP){
+ // if P-state Capping s enabled
+ If (CondRefOf(\_PR.CPU0._PPC))
+ {
+ Store(Zero, \_PR.CPU0._PPC)
+ PNOT()
+ }
+ }
+ If(PLCS){
+ RPL1() // restore PL1 to pre-CS value upon exiting CS
+ }
+ }
+
+ P_CS() // Powergating during CS
+ }
+}
+
+// Power CS Powergated Devices:
+// Method to enable/disable power during CS
+Method(P_CS,0,Serialized)
+{
+ // NOTE: Do not turn ON Touch devices from here. Touch does not have PUAM
+ If(CondRefOf(\_SB.PCI0.PAUD.PUAM)){ // Notify Codec(HD-A/ADSP)
+ \_SB.PCI0.PAUD.PUAM()
+ }
+ // Adding back USB powergating (ONLY for Win8) until RTD3 walkup port setup implementation is complete */
+ If(LEqual(OSYS,2012)){ // ONLY for Win8 OS
+ If(CondRefOf(\_SB.PCI0.XHC.DUAM)){ // Notify USB port- RVP
+ \_SB.PCI0.XHC.DUAM()
+ }
+ }
+ // TODO: Add calls to UAMN methods for
+ // * USB controller(s)
+ // * Embedded Controller
+ // * Sensor devices
+ // * Audio DSP?
+ // * Any other devices dependent on User Absent mode for power controls
+}
+
+// SMI I/O Trap:
+// Generate a Mutex protected SMI I/O Trap.
+//
+// Arguments:
+// Arg0: I/O Trap type.
+// 2 - For DTS
+// 3 - For IGD
+// 4 - For Pfat Tools
+// Arg1: SMI I/O Trap Function to call.
+//
+// Return Value:
+// SMI I/O Trap Return value.
+// 0 = Success. Non-zero = Failure.
+
+Method(TRAP,2,Serialized)
+{
+ Store(Arg1,SMIF) // Store SMI Function.
+
+ If(LEqual(Arg0,\TRTD)) // Is DTS IO Trap?
+ {
+ Store(Arg1,DTSF) // Store the function number global NVS
+ Store(0,TRPD) // Generate IO Trap.
+ Return(DTSF) // Return status from SMI handler
+ }
+
+ If(LEqual(Arg0,\TRTI)) // Is IGD IO Trap?
+ {
+ Store(0,TRPH) // Generate IO Trap.
+ }
+
+ If(LEqual(Arg0,\PFTI)) // Is PFAT TOOLS IO Trap?
+ {
+ Store(0,TRPF) // Generate IO Trap
+ }
+
+ Return(SMIF) // Return SMIF. 0 = Success.
+}
+
+// Note: Only add the indicator device needed by the platform.
+
+//
+// System Bus
+//
+Scope(\_SB.PCI0)
+{
+
+ Method(PTMA)
+ {
+ Return(PFMA)
+ }
+
+ Method(PTMS)
+ {
+ Return(PFMS)
+ }
+
+ Method(PTIA)
+ {
+ Return(PFIA)
+ }
+
+ Method(_INI,0)
+ {
+ // Determine the OS and store the value, where:
+ //
+ // OSYS = 1000 = Linux.
+ // OSYS = 2000 = WIN2000.
+ // OSYS = 2001 = WINXP, RTM or SP1.
+ // OSYS = 2002 = WINXP SP2.
+ // OSYS = 2006 = Vista.
+ // OSYS = 2009 = Windows 7 and Windows Server 2008 R2.
+ // OSYS = 2012 = Windows 8 and Windows Server 2012.
+ // OSYS = 2013 = Windows Blue.
+ //
+ // Assume Windows 2000 at a minimum.
+
+ Store(2000,OSYS)
+
+ // Check for a specific OS which supports _OSI.
+
+ If(CondRefOf(\_OSI,Local0))
+ {
+ If(\_OSI("Linux"))
+ {
+ Store(1000,OSYS)
+ }
+
+ If(\_OSI("Windows 2001"))
+ {
+ Store(2001,OSYS)
+ }
+
+ If(\_OSI("Windows 2001 SP1"))
+ {
+ Store(2001,OSYS)
+ }
+
+ If(\_OSI("Windows 2001 SP2"))
+ {
+ Store(2002,OSYS)
+ }
+
+ If (\_OSI( "Windows 2001.1"))
+ {
+ Store (2003, OSYS)
+ }
+
+ If(\_OSI("Windows 2006"))
+ {
+ Store(2006,OSYS)
+ }
+
+ If(\_OSI("Windows 2009"))
+ {
+ Store(2009,OSYS)
+ }
+
+ If(\_OSI("Windows 2012"))
+ {
+ Store(2012,OSYS)
+ }
+
+ If(\_OSI("Windows 2013"))
+ {
+ Store(2013,OSYS)
+ }
+ }
+#if 0 //AMI_OVERRIDE --- Below ASL code is for Thunderbolt, AMI thunderbolt module has taken care it already.>>
+ If(LOr(LEqual(BID, BICO),LEqual(BID, BICC))) {
+ Acquire(OSUM, 0xFFFF)
+ Store(MMRP(), Local1)
+ OperationRegion(RP_X,SystemMemory,Local1,0x20)
+ Field(RP_X,DWordAcc, NoLock, Preserve)
+ {
+ REG0, 32,
+ REG1, 32,
+ REG2, 32,
+ REG3, 32,
+ REG4, 32,
+ REG5, 32,
+ REG6, 32,
+ REG7, 32
+ }
+ Store(REG6, Local2)
+ Store(0x00F0F000, REG6)
+ Store(\_GPE.MMTB(), Local3)
+ \_GPE.OSUP(Local3)
+ Store(Local2, REG6)
+ Release(OSUM)
+ Acquire(WFDM, 0xFFFF)
+ Store(1, WKFN)
+
+ Release(WFDM)
+ }
+#endif //AMI_OVERRIDE --- it is for Thunderbolt, AMI thunderbolt module has taken care it already. <<
+ PINI()
+ }
+
+ Method(NHPG,0,Serialized)
+ {
+#if defined(ASL_RC_PORT_0) && (ASL_RC_PORT_0==1)
+ Store(0,^RP01.HPEX) // clear the hot plug SCI enable bit
+#endif // ASL_RC_PORT_0
+#if defined(ASL_RC_PORT_1) && (ASL_RC_PORT_1==1)
+ Store(0,^RP02.HPEX) // clear the hot plug SCI enable bit
+#endif // ASL_RC_PORT_1
+#if defined(ASL_RC_PORT_2) && (ASL_RC_PORT_2==1)
+ Store(0,^RP03.HPEX) // clear the hot plug SCI enable bit
+#endif // ASL_RC_PORT_2
+#if defined(ASL_RC_PORT_3) && (ASL_RC_PORT_3==1)
+ Store(0,^RP04.HPEX) // clear the hot plug SCI enable bit
+#endif // ASL_RC_PORT_3
+#if defined(ASL_RC_PORT_4) && (ASL_RC_PORT_4==1)
+ Store(0,^RP05.HPEX) // clear the hot plug SCI enable bit
+#endif // ASL_RC_PORT_4
+#if defined(ASL_RC_PORT_5) && (ASL_RC_PORT_5==1)
+ Store(0,^RP06.HPEX) // clear the hot plug SCI enable bit
+#endif // ASL_RC_PORT_5
+#if defined(ASL_RC_PORT_6) && (ASL_RC_PORT_6==1)
+ Store(0,^RP07.HPEX) // clear the hot plug SCI enable bit
+#endif // ASL_RC_PORT_6
+#if defined(ASL_RC_PORT_7) && (ASL_RC_PORT_7==1)
+ Store(0,^RP08.HPEX) // clear the hot plug SCI enable bit
+#endif // ASL_RC_PORT_7
+#if defined(ASL_RC_PORT_0) && (ASL_RC_PORT_0==1)
+ Store(1,^RP01.HPSX) // clear the hot plug SCI status bit
+#endif // ASL_RC_PORT_0
+#if defined(ASL_RC_PORT_1) && (ASL_RC_PORT_1==1)
+ Store(1,^RP02.HPSX) // clear the hot plug SCI status bit
+#endif // ASL_RC_PORT_1
+#if defined(ASL_RC_PORT_2) && (ASL_RC_PORT_2==1)
+ Store(1,^RP03.HPSX) // clear the hot plug SCI status bit
+#endif // ASL_RC_PORT_2
+#if defined(ASL_RC_PORT_3) && (ASL_RC_PORT_3==1)
+ Store(1,^RP04.HPSX) // clear the hot plug SCI status bit
+#endif // ASL_RC_PORT_3
+#if defined(ASL_RC_PORT_4) && (ASL_RC_PORT_4==1)
+ Store(1,^RP05.HPSX) // clear the hot plug SCI status bit
+#endif // ASL_RC_PORT_4
+#if defined(ASL_RC_PORT_5) && (ASL_RC_PORT_5==1)
+ Store(1,^RP06.HPSX) // clear the hot plug SCI status bit
+#endif // ASL_RC_PORT_5
+#if defined(ASL_RC_PORT_6) && (ASL_RC_PORT_6==1)
+ Store(1,^RP07.HPSX) // clear the hot plug SCI status bit
+#endif // ASL_RC_PORT_6
+#if defined(ASL_RC_PORT_7) && (ASL_RC_PORT_7==1)
+ Store(1,^RP08.HPSX) // clear the hot plug SCI status bit
+#endif // ASL_RC_PORT_7
+ }
+
+ Method(NPME,0,Serialized)
+ {
+#if defined(ASL_RC_PORT_0) && (ASL_RC_PORT_0==1)
+ Store(0,^RP01.PMEX) // clear the PME SCI enable bit
+#endif
+#if defined(ASL_RC_PORT_1) && (ASL_RC_PORT_1==1)
+ Store(0,^RP02.PMEX) // clear the PME SCI enable bit
+#endif
+#if defined(ASL_RC_PORT_2) && (ASL_RC_PORT_2==1)
+ Store(0,^RP03.PMEX) // clear the PME SCI enable bit
+#endif
+#if defined(ASL_RC_PORT_3) && (ASL_RC_PORT_3==1)
+ Store(0,^RP04.PMEX) // clear the PME SCI enable bit
+#endif
+#if defined(ASL_RC_PORT_4) && (ASL_RC_PORT_4==1)
+ Store(0,^RP05.PMEX) // clear the PME SCI enable bit
+#endif
+#if defined(ASL_RC_PORT_5) && (ASL_RC_PORT_5==1)
+ Store(0,^RP06.PMEX) // clear the PME SCI enable bit
+#endif
+#if defined(ASL_RC_PORT_6) && (ASL_RC_PORT_6==1)
+ Store(0,^RP07.PMEX) // clear the PME SCI enable bit
+#endif
+#if defined(ASL_RC_PORT_7) && (ASL_RC_PORT_7==1)
+ Store(0,^RP08.PMEX) // clear the PME SCI enable bit
+#endif
+#if defined(ASL_RC_PORT_0) && (ASL_RC_PORT_0==1)
+ Store(1,^RP01.PMSX) // clear the PME SCI status bit
+#endif
+#if defined(ASL_RC_PORT_1) && (ASL_RC_PORT_1==1)
+ Store(1,^RP02.PMSX) // clear the PME SCI status bit
+#endif
+#if defined(ASL_RC_PORT_2) && (ASL_RC_PORT_2==1)
+ Store(1,^RP03.PMSX) // clear the PME SCI status bit
+#endif
+#if defined(ASL_RC_PORT_3) && (ASL_RC_PORT_3==1)
+ Store(1,^RP04.PMSX) // clear the PME SCI status bit
+#endif
+#if defined(ASL_RC_PORT_4) && (ASL_RC_PORT_4==1)
+ Store(1,^RP05.PMSX) // clear the PME SCI status bit
+#endif
+#if defined(ASL_RC_PORT_5) && (ASL_RC_PORT_5==1)
+ Store(1,^RP06.PMSX) // clear the PME SCI enable bit
+#endif
+#if defined(ASL_RC_PORT_6) && (ASL_RC_PORT_6==1)
+ Store(1,^RP07.PMSX) // clear the PME SCI status bit
+#endif
+#if defined(ASL_RC_PORT_7) && (ASL_RC_PORT_7==1)
+ Store(1,^RP08.PMSX) // clear the PME SCI status bit
+#endif
+ }
+}
+
+Scope (\)
+{
+ //
+ // Global Name, returns current Interrupt controller mode;
+ // updated from _PIC control method
+ //
+ Name(PICM, 0)
+
+ //
+ // Procedure: GPRW
+ //
+ // Description: Generic Wake up Control Method ("Big brother")
+ // to detect the Max Sleep State available in ASL Name scope
+ // and Return the Package compatible with _PRW format.
+ // Input: Arg0 = bit offset within GPE register space device event will be triggered to.
+ // Arg1 = Max Sleep state, device can resume the System from.
+ // If Arg1 = 0, Update Arg1 with Max _Sx state enabled in the System.
+ // Output: _PRW package
+ //
+ Name(PRWP, Package(){Zero, Zero}) // _PRW Package
+
+ Method(GPRW, 2)
+ {
+ Store(Arg0, Index(PRWP, 0)) // copy GPE#
+ //
+ // SS1-SS4 - enabled in BIOS Setup Sleep states
+ //
+ Store(ShiftLeft(SS1,1),Local0) // S1 ?
+ Or(Local0,ShiftLeft(SS2,2),Local0) // S2 ?
+ Or(Local0,ShiftLeft(SS3,3),Local0) // S3 ?
+ Or(Local0,ShiftLeft(SS4,4),Local0) // S4 ?
+ //
+ // Local0 has a bit mask of enabled Sx(1 based)
+ // bit mask of enabled in BIOS Setup Sleep states(1 based)
+ //
+ If(And(ShiftLeft(1, Arg1), Local0))
+ {
+ //
+ // Requested wake up value (Arg1) is present in Sx list of available Sleep states
+ //
+ Store(Arg1, Index(PRWP, 1)) // copy Sx#
+ }
+ Else
+ {
+ //
+ // Not available -> match Wake up value to the higher Sx state
+ //
+ ShiftRight(Local0, 1, Local0)
+ // If(LOr(LEqual(OSFL, 1), LEqual(OSFL, 2))) { // ??? Win9x
+ // FindSetLeftBit(Local0, Index(PRWP,1)) // Arg1 == Max Sx
+ // } Else { // ??? Win2k / XP
+ FindSetLeftBit(Local0, Index(PRWP,1)) // Arg1 == Min Sx
+ // }
+ }
+
+ Return(PRWP)
+ }
+}
+
+
+Scope (\_SB)
+{
+ Name(OSCI, 0) // \_SB._OSC DWORD2 input
+ Name(OSCO, 0) // \_SB._OSC DWORD2 output
+ // _OSC (Operating System Capabilities)
+ // _OSC under \_SB scope is used to convey platform wide OSPM capabilities.
+ // ACPI 5.0 specification enables OSPM to query for Platform CPPC support
+ // through _OSC evaluation. Upon _OSC evaluation, platform can indicate
+ // support/non-support for CPPC through the return buffer. For a complete
+ // description of _OSC ACPI Control Method, refer to ACPI 5.0
+ // specification, section 6.2.10.
+ // Arguments: (4)
+ // Arg0 - A Buffer containing the UUID "0811B06E-4A27-44F9-8D60-3CBBC22E7B48"
+ // Arg1 - An Integer containing the Revision ID of the buffer format
+ // Arg2 - An Integer containing a count of entries in Arg3
+ // Arg3 - A Buffer containing a list of DWORD capabilities
+ // Return Value:
+ // A Buffer containing the list of capabilities
+ //
+ Method(_OSC,4,Serialized)
+ {
+
+//ami override
+ If(LNotEqual(OSCM(Arg0,Arg1,Arg2,Arg3),0))
+ {
+ Return(Arg3)
+ }
+//ami override
+
+ //
+ // Point to Status DWORD in the Arg3 buffer (STATUS)
+ //
+ CreateDWordField(Arg3, 0, STS0)
+ //
+ // Point to Caps DWORDs of the Arg3 buffer (CAPABILITIES)
+ //
+ CreateDwordField(Arg3, 4, CAP0)
+
+ //
+ // Check UUID
+ //
+ If(LEqual(Arg0,ToUUID("0811B06E-4A27-44F9-8D60-3CBBC22E7B48")))
+ {
+ //
+ // Check Revision
+ //
+ If(LEqual(Arg1,One))
+ {
+ If(And(CAP0,0x04)) // Check _PR3 Support(BIT2)
+ {
+ Store(0x04, OSCO)
+ If(LNotEqual(And(SGMD,0x0F),2)) // Check Switchable/Hybrid graphics is not enabled in bios setup [SgModeMuxless]?
+ {
+ If(LEqual(RTD3,0)) // Is RTD3 support disabled in Bios Setup?
+ {
+ // RTD3 is disabled via BIOS Setup.
+ And(CAP0, 0x3B, CAP0) // Clear _PR3 capability
+ Or(STS0, 0x10, STS0) // Indicate capability bit is cleared
+ }
+ }
+ }
+
+ // Process command. Regardless of query or control, we do the same thing.
+ If(And(CAP0,0x20)) // Check CPC Support
+ {
+ If(CondRefOf(\_SB.PCCD.PENB)){
+ If(LEqual(\_SB.PCCD.PENB, 0)){
+ // PENB = 0 => CPPC is disabled via BIOS Setup.
+ And(CAP0, 0x1F, CAP0) // Clear _CPC capability
+ Or(STS0, 0x10, STS0) // Indicate capability bit is cleared
+ }
+ } Else {
+ // PENB object not found in namespace => CPPC is disabled via BIOS Setup.
+ And(CAP0, 0x1F, CAP0) // Clear _CPC capability
+ Or(STS0, 0x10, STS0) // Indicate capability bit is cleared
+ }
+ }
+ } Else{
+ And(STS0,0xFFFFFF00,STS0)
+ Or(STS0,0xA, STS0) // Unrecognised Revision and report OSC failure
+ }
+ } Else {
+ And(STS0,0xFFFFFF00,STS0)
+ Or (STS0,0x6, STS0) // Unrecognised UUID and report OSC failure
+ }
+
+ Return(Arg3)
+ } // End _OSC
+
+ Device (PEPD)
+ {
+ Name (_HID, "INT33A1")
+ Name (_CID, EISAID ("PNP0D80"))
+ Name (_UID, 0x1)
+
+ Name(PEPP, Zero)
+ Name (DEVS, Package()
+ {
+ 2,
+ Package() {"\\_SB.PCI0.GFX0"},
+ Package() {"\\_SB.PCI0.SAT0.PRT1"}
+ })
+
+ Name (DEVX, Package()
+ {
+ Package() {"\\_SB.PCI0.GFX0",0xffffffff},
+ Package() {"\\_SB.PCI0.SAT0.PRT1",0xffffffff},
+ Package() {"\\_SB.PCI0.UA01", 0xffffffff},
+ Package() {"\\_SB.PCI0.SDHC", 0xffffffff },
+ Package() {"\\_SB.PCI0.I2C0", 0xffffffff },
+ Package() {"\\_SB.PCI0.I2C1", 0xffffffff },
+ Package() {"\\_SB.PCI0.XHC", 0xffffffff },
+ Package() {"HDAUDIO\\FUNC_01&VEN_10EC&DEV_0282&SUBSYS_00000000&REV_1000\\4&a02b74b&0&0001", 0xffffffff },
+ })
+
+ Name(DEVY, Package() // uPEP Device List
+ {
+ //
+ // 1: ACPI Device Descriptor: Fully Qualified namestring
+ // 2: Enabled/Disabled Field
+ // 0 = This device is disabled and applies no constraints
+ // >0 = This device is enabled and applies constraints
+ // 3: Constraint Package: entry per LPI state in LPIT
+ // a. Associated LPI State UID
+ // ID == 0xFF: same constraints apply to all states in LPIT
+ // b: minimum Dx state as pre-condition
+ // c: (optional) OEM specific OEM may provide an additional encoding
+ // which further defines the D-state Constraint
+ // 0x0-0x7F - Reserved
+ // 0x80-0xFF - OEM defined
+ //
+ Package() {"\\_PR.CPU0", 0x1, Package() {0, Package(){0xFF, 0}}},
+ Package() {"\\_PR.CPU1", 0x1, Package() {0, Package(){0xFF, 0}}},
+ Package() {"\\_PR.CPU2", 0x1, Package() {0, Package(){0xFF, 0}}},
+ Package() {"\\_PR.CPU3", 0x1, Package() {0, Package(){0xFF, 0}}},
+ Package() {"\\_SB.PCI0.GFX0", 0x1, Package() {0, Package(){0xFF, 3}}},
+ Package() {"\\_SB.PCI0.SAT0", 0x1, Package() {0, Package(){0xFF, 3}}},
+ Package() {"\\_SB.PCI0.SAT0.PRT0", 0x1, Package() {0, Package(){0xFF, 0, 0x81}}},
+ Package() {"\\_SB.PCI0.SAT0.PRT1", 0x1, Package() {0, Package(){0xFF, 0, 0x81}}},
+ Package() {"\\_SB.PCI0.SAT0.PRT2", 0x1, Package() {0, Package(){0xFF, 0, 0x81}}},
+ Package() {"\\_SB.PCI0.SAT0.PRT3", 0x1, Package() {0, Package(){0xFF, 0, 0x81}}},
+ Package() {"\\_SB.PCI0.UA00", 0x1, Package() {0, Package(){0xFF, 3}}},
+ Package() {"\\_SB.PCI0.UA01", 0x1, Package() {0, Package(){0xFF, 3}}},
+ Package() {"\\_SB.PCI0.SDHC", 0x1, Package() {0, Package(){0xFF, 3}}},
+ Package() {"\\_SB.PCI0.I2C0", 0x1, Package() {0, Package(){0xFF, 3}}},
+ Package() {"\\_SB.PCI0.I2C1", 0x1, Package() {0, Package(){0xFF, 3}}},
+ Package() {"\\_SB.PCI0.XHC", 0x1, Package() {0, Package(){0xFF, 3}}},
+ Package() {"HDAUDIO\\FUNC_01&VEN_10EC&DEV_0282*", 0x1, Package() {0, Package(){0x0, 0}, Package(){0x1, 3}}},
+ Package() {"\\_SB.PCI0.ADSP", 0x1, Package() {0, Package(){0x0, 0}, Package(){0x1, 3}}},
+ })
+
+ Name(BCCD, Package() // Bugcheck Critical Device(s)
+ {
+ //
+ // 1: ACPI Device Descriptor: Fully Qualified name string
+ // 2: Package of packages: 1 or more specific commands to power up critical device
+ // 2a: Package: GAS-structure describing location of PEP accessible power control
+ // Refer to ACPI 5.0 spec section 5.2.3.1 for details
+ // a: Address Space ID (0 = System Memory)
+ // NOTE: A GAS Address Space of 0x7F (FFH) indicates remaining package
+ // elements are Intel defined
+ // b: Register bit width (32 = DWORD)
+ // c: Register bit offset
+ // d: Access size (3 = DWORD Access)
+ // e: Address (for System Memory = 64-bit physical address)
+ // 2b: Package containing:
+ // a: AND mask - not applicable for all Trigger Types
+ // b: Value (bits required to power up the critical device)
+ // c: Trigger Type:
+ // 0 = Read
+ // 1 = Write
+ // 2 = Write followed by Read
+ // 3 = Read Modify Write
+ // 4 = Read Modify Write followed by Read
+ // 2c: Power up delay: Time delay before next operation in uSec
+ //
+ Package() {"\\_SB.PCI0.SAT0", Package() {
+ Package() {Package() {1, 8, 0, 1, 0xB2}, // GAS Structure 8-bit IO Port
+ Package() {0x0, 0xCD, 0x1}, // Write 0xCD
+ 16000} // Power up delay = 16ms
+ }
+ },
+ Package() {"\\_SB.PCI0.SAT0.PRT0", Package(){
+ Package() {Package() {1, 8, 0, 1, 0xB2}, // GAS Structure 8-bit IO Port
+ Package() {0x0, 0xCD, 0x1}, // Write 0xCD
+ 16000} // Power up delay = 16ms
+ }
+ },
+ Package() {"\\_SB.PCI0.SAT0.PRT1", Package(){
+ Package() {Package() {1, 8, 0, 1, 0xB2}, // GAS Structure 8-bit IO Port
+ Package() {0x0, 0xCD, 0x1}, // Write 0xCD
+ 16000} // Power up delay = 16ms
+ }
+ },
+ Package() {"\\_SB.PCI0.SAT0.PRT2", Package(){
+ Package() {Package() {1, 8, 0, 1, 0xB2}, // GAS Structure 8-bit IO Port
+ Package() {0x0, 0xCD, 0x1}, // Write 0xCD
+ 16000} // Power up delay = 16ms
+ }
+ },
+ Package() {"\\_SB.PCI0.SAT0.PRT3", Package(){
+ Package() {Package() {1, 8, 0, 1, 0xB2}, // GAS Structure 8-bit IO Port
+ Package() {0x0, 0xCD, 0x1}, // Write 0xCD
+ 16000} // Power up delay = 16ms
+ }
+ },
+ })
+
+ Method(_STA, 0x0, NotSerialized)
+ {
+ If(LGreaterEqual(OSYS,2012))
+ {
+ If(LEqual(And(CDID,0xF000), 0x9000)) // LPT-H Chipset DID start with 0x8xxx while LPT-LP start with 0x9xxx
+ {
+ If(LEqual(S0ID, 1))
+ {
+ Return(0xf)
+ }
+ }
+ }
+ Return(0)
+ }
+
+ Method(_DSM, 0x4, Serialized)
+ {
+ If(LEqual(Arg0,ToUUID("B8FEBFE0-BAF8-454b-AECD-49FB91137B21"))) //PEP driver should use same UUID
+ {
+ If(LEqual(Arg2, Zero))
+ {
+ Return(Buffer(One)
+ {
+ 0x07
+ })
+ }
+ If(LEqual(Arg2, One))
+ {
+ Store(0x1, PEPP)
+ Return(0xf)
+ }
+ If(LEqual(Arg2, 2))
+ {
+ If(LEqual(Arg1, Zero)) { // Revision ID is Zero
+ // TBD Needs to find a better logic here....
+ Switch(PEPY){
+ Case(1){ // Grpahics alone enabled
+ Return(Package(){1,Package() {"\\_SB.PCI0.GFX0"}})
+ }
+ Case(2){ // SATA alone enabled
+ Return(Package(){1,Package() {"\\_SB.PCI0.SAT0.PRT1"}})
+ }
+ Case(3){ // Both SATA and Gfx enabled
+ Return(DEVS)
+ }
+ Default{ // All devices are disabled
+ Return(Package(){0})
+ }
+ } // End of Switch(PEPY)
+ }
+
+ If(LEqual(Arg1, One)) { // Revision ID is One
+ If(LNot(And(PEPY,0x01))){ // Check if PEP GFx disabled in Setup
+ Store (0x00, Index (DeRefOf(Index (DEVX, 0)), 1)) // Disable Gfx
+ }
+ If(LNot(And(PEPY,0x02))){ // Check if PEP Sata disabled in Setup
+ Store (0x00, Index (DeRefOf(Index (DEVX, 1)), 1)) // Disable Sata
+ }
+ If(LNot(And(PEPY,0x04))){ // Check if PEP UART disabled in Setup
+ Store (0x00, Index (DeRefOf(Index (DEVX, 2)), 1)) // Disable UART
+ }
+ If(LNot(And(PEPY,0x08))){ // Check if PEP SDHC disabled in Setup
+ Store (0x00, Index (DeRefOf(Index (DEVX, 3)), 1)) // Disable SDHC
+ }
+ If(LNot(And(PEPY,0x10))){ // Check if PEP I2C0 disabled in Setup
+ Store (0x00, Index (DeRefOf(Index (DEVX, 4)), 1)) // Disable I2C0
+ }
+ If(LNot(And(PEPY,0x20))){ // Check if PEP I2C1 disabled in Setup
+ Store (0x00, Index (DeRefOf(Index (DEVX, 5)), 1)) // Disable I2C1
+ }
+ If(LNot(And(PEPY,0x40))){ // Check if PEP XHCI disabled in Setup
+ Store (0x00, Index (DeRefOf(Index (DEVX, 6)), 1)) // Disable XHCI
+ }
+ If(LNot(And(PEPY,0x80))){ // Check if PEP audio disabled in Setup
+ Store (0x00, Index (DeRefOf(Index (DEVX, 7)), 1)) // Disable Audio
+ }
+ Return(DEVX)
+ }
+ } //If(LEqual(Arg2, 2))
+ }// If(LEqual(Arg0,ToUUID("B8FEBFE0-BAF8-454b-AECD-49FB91137B21")))
+
+ If(LEqual(Arg0,ToUUID("c4eb40a0-6cd2-11e2-bcfd-0800200c9a66")))
+ {
+ // Number of Functions (including this one)
+ If(LEqual(Arg2, Zero))
+ {
+ Return(Buffer(One){0x07})
+ }
+ // Device Constraints Enumeration
+ If(LEqual(Arg2, One))
+ {
+ // Update uPEP device list based on PEPC (Low Power S0 Constraint)
+ // Bit[1:0] - SATA (0:None, 1:SATA Ports[all], 2:SATA Controller)
+ // [2] - En/Dis UART 0
+ // [3] - UART 1
+ // [4] - SDIO
+ // [5] - I2C 0
+ // [6] - I2C 1
+ // [7] - XHCI
+ // [8] - Azalia
+ // [9] - ADSP
+
+ If(LNotEqual(And(PEPC, 0x0003), 1)) // PEPC Bit[1:0] - SATA (0:None, 1:SATA Ports[all], 2:SATA Controller)
+ {
+ // No Constraint for SATA Ports (SAT0.PRT0, PRT1, PRT2, PRT3)
+ Store (0x00, Index (DeRefOf(Index (DEVY, 6)), 1)) // SAT0.PRT0
+ Store (0x00, Index (DeRefOf(Index (DEVY, 7)), 1)) // SAT0.PRT1
+ Store (0x00, Index (DeRefOf(Index (DEVY, 8)), 1)) // SAT0.PRT2
+ Store (0x00, Index (DeRefOf(Index (DEVY, 9)), 1)) // SAT0.PRT3
+ }
+
+ If(LNotEqual(And(PEPC, 0x0003), 2)) // PEPC Bit[1:0] - SATA (0:None, 1:SATA Ports[all], 2:SATA Controller)
+ {
+ // No Constraint for SATA Controller (SAT0)
+ Store (0x00, Index (DeRefOf(Index (DEVY, 5)), 1)) // SAT0
+
+ // Disable SATA Ports if no drive is connected
+ If(LNot(And(SPST,1)))
+ {
+ // Disable SATA Ports 0
+ Store (0x00, Index (DeRefOf(Index (DEVY, 6)), 1)) // SAT0.PRT0
+ }
+ If(LNot(And(SPST, 2)))
+ {
+ // Disable SATA Ports 1
+ Store (0x00, Index (DeRefOf(Index (DEVY, 7)), 1)) // SAT0.PRT1
+ }
+ If(LNot(And(SPST, 4)))
+ {
+ // Disable SATA Ports 2
+ Store (0x00, Index (DeRefOf(Index (DEVY, 8)), 1)) // SAT0.PRT2
+ }
+ If(LNot(And(SPST, 8)))
+ {
+ // Disable SATA Ports 3
+ Store (0x00, Index (DeRefOf(Index (DEVY, 9)), 1)) // SAT0.PRT3
+ }
+ }
+
+ If(LEqual(And(PEPC,0x0004),0)) // PEPC Bit[2] - En/Dis UART 0
+ {
+ // Disabled UA00
+ Store (0x00, Index (DeRefOf(Index (DEVY, 10)), 1)) // UA00
+ }
+
+ If(LEqual(And(PEPC,0x0008),0)) // PEPC Bit[3] - En/Dis UART 1
+ {
+ // Disabled UA01
+ Store (0x00, Index (DeRefOf(Index (DEVY, 11)), 1)) // UA01
+ }
+
+ If(LEqual(And(PEPC,0x0010),0)) // PEPC Bit[4] - En/Dis SDIO
+ {
+ // Disabled SDHC
+ Store (0x00, Index (DeRefOf(Index (DEVY, 12)), 1)) // SDHC
+ }
+
+ If(LEqual(And(PEPC,0x0020),0)) // PEPC Bit[5] - En/Dis I2C 0
+ {
+ // Disabled I2C0
+ Store (0x00, Index (DeRefOf(Index (DEVY, 13)), 1)) // I2C0
+ }
+
+ If(LEqual(And(PEPC,0x0040),0)) // PEPC Bit[6] - En/Dis I2C 1
+ {
+ // Disabled I2C1
+ Store (0x00, Index (DeRefOf(Index (DEVY, 14)), 1)) // I2C1
+ }
+
+ If(LEqual(And(PEPC,0x0080),0)) // PEPC Bit[7] - En/Dis XHCI
+ {
+ // Disabled XHCI
+ Store (0x00, Index (DeRefOf(Index (DEVY, 15)), 1)) // XHC
+ }
+
+ If(LEqual(And(PEPC,0x0100),0)) // PEPC Bit[9] - En/Dis Azalia
+ {
+ // Disabled Azalia
+ Store (0x00, Index (DeRefOf(Index (DEVY, 16)), 1)) // Azalia
+ }
+
+ If(LEqual(And(PEPC,0x0200),0)) // PEPC Bit[10] - En/Dis ADSP
+ {
+ // Disabled ADSP
+ Store (0x00, Index (DeRefOf(Index (DEVY, 17)), 1)) // ADSP
+ }
+
+ Return(DEVY)
+ }
+ // BCCD
+ If(LEqual(Arg2, 2))
+ {
+ Return(BCCD)
+ }
+ }// If(LEqual(Arg0,ToUUID("c4eb40a0-6cd2-11e2-bcfd-0800200c9a66")))
+ Return(One)
+ } // Method(_DSM)
+ } //device (PEPD)
+
+} // End Scope(\_SB)
+
+Scope (\_SB)
+{
+ //
+ // define a BT RF-Kill device.
+ //
+ Device (BTKL)
+ {
+ Name(_HID, "INT3420")
+
+ Method (_STA, 0x0, NotSerialized)
+ {
+ If (\_OSI ("Windows 2012")) { // WIN8?
+ If (LEqual(BID, BW2C)) { // WTM2?
+ Return(0x0F)
+ }
+ }
+ Return(0x00) // not support BT RF-Kill, device hide.
+ }
+
+ // D0 Method for BTKL
+ Method(_PS0,0,Serialized)
+ {
+ // de-assert GPIO87
+ And(\GL0A, 0x7F, \GL0A)
+ }
+
+ // D3 Method for BTKL
+ Method(_PS3,0,Serialized)
+ {
+ // assert GPIO87
+ Or(\GL0A, 0x80, \GL0A)
+ }
+
+ // detect GPIO pin status
+ Method(PSTS)
+ {
+ Return(RDGP(87))
+ }
+ }
+} // End Scope(\_SB)
diff --git a/ReferenceCode/AcpiTables/Dsdt/SMSC1000_COM.asl b/ReferenceCode/AcpiTables/Dsdt/SMSC1000_COM.asl
new file mode 100644
index 0000000..0de4c73
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dsdt/SMSC1000_COM.asl
@@ -0,0 +1,574 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Haswell *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+
+
+Device(UAR6) // SMSC1000 UART 1.
+{
+ // Identify UART 2 as a COM Port.
+
+ Name(_HID, EISAID("PNP0501"))
+
+ Name(_UID,5)
+
+ // Status Method for UART 1.
+
+ Method(_STA,0,Serialized)
+ {
+ // Only report resources to the OS if the SIO Device is
+ // not set to Disabled in BIOS Setup.
+
+ If(SMC1)
+ {
+ // Display UART 1 and return status.
+
+ Store(0,CR55)
+ Store(CR02,Local0)
+ Store(0,CRAA)
+
+ If(And(Local0,0x08))
+ {
+ Return(0x000F)
+ }
+
+ Return(0x000D)
+ }
+
+ Return(0x0000)
+ }
+
+ // Disable Method for UART 1.
+
+ Method(_DIS,0,Serialized)
+ {
+ Store(0,CR55)
+ Store(And(CR02,0xF0),CR02)
+ Store(0,CRAA)
+ }
+
+ // Current Resource Setting Method for UART 1.
+ Method(_CRS,0,Serialized)
+ {
+ // Create the Buffer that stores the Resources to
+ // be returned.
+
+ Name(BUF0,ResourceTemplate()
+ {
+ IO(Decode16,0x03F8,0x03F8,0x01,0x08)
+ IRQNoFlags(){4}
+ })
+
+ // Skip this sequence if SIO device is not connected
+
+ If(SMC1)
+ {
+ // Create pointers to the specific byte.
+
+ CreateByteField(BUF0,0x02,IOL0)
+ CreateByteField(BUF0,0x03,IOH0)
+ CreateByteField(BUF0,0x04,IOL1)
+ CreateByteField(BUF0,0x05,IOH1)
+ CreateByteField(BUF0,0x07,LEN0)
+ CreateWordField(BUF0,0x09,IRQW)
+
+ // Write the base address into the Buffer.
+
+ Store(0,CR55)
+
+ ShiftLeft(CR24,2,IOL0) // Low Byte.
+ ShiftLeft(CR24,2,IOL1)
+
+ ShiftRight(CR24,6,IOH0) // High Byte.
+ ShiftRight(CR24,6,IOH1)
+
+ // Write the length into the Buffer.
+
+ Store(8,LEN0)
+
+ // Write the IRQ value into the Buffer.
+
+ ShiftLeft(One,ShiftRight(And(CR28,0xF0),4),IRQW)
+
+ Store(0,CRAA)
+ }
+
+ Return(BUF0)
+ }
+
+ // Possible Resource Setting Method for UART 1.
+ Name(_PRS,ResourceTemplate()
+ {
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x2E8,0x2E8,0x01,0x08)
+ IRQNoFlags(){7}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x2F8,0x2F8,0x01,0x08)
+ IRQNoFlags(){7}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x3E8,0x3E8,0x01,0x08)
+ IRQNoFlags(){7}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x3F8,0x3F8,0x01,0x08)
+ IRQNoFlags(){7}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x2E8,0x2E8,0x01,0x08)
+ IRQNoFlags(){4}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x2F8,0x2F8,0x01,0x08)
+ IRQNoFlags(){4}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x3E8,0x3E8,0x01,0x08)
+ IRQNoFlags(){4}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x3F8,0x3F8,0x01,0x08)
+ IRQNoFlags(){4}
+ }
+ EndDependentFn()
+ })
+
+
+ // Set Resource Setting Method for UART 1.
+ Method(_SRS,1,Serialized)
+ {
+ // Point to the specific information in the passed
+ // in Buffer.
+
+ CreateByteField(Arg0,0x02,IOLO)
+ CreateByteField(Arg0,0x03,IOHI)
+ CreateWordField(Arg0,0x09,IRQW)
+
+ // Disable the device.
+
+ Store(0,CR55)
+ Store(And(CR02,0xF0),CR02)
+
+ // Set the Base IO Address.
+
+ Store(ShiftRight(IOLO,2),CR24)
+ Or(CR24,ShiftLeft(IOHI,6),CR24)
+
+ // Set the IRQ.
+
+ And(CR28,0x0F,CR28)
+ Or(CR28,ShiftLeft(Subtract(FindSetRightBit(IRQW),1),4),CR28)
+
+ // Set the Decode Range so UART 1 works with ICH7 and
+ // future platforms.
+
+ AND(IOD0,0xF8,IOD0) // Clear all bits.
+
+ If(LEqual(IOHI,0x03)) // Address = 0x3xx
+ {
+ If(LEqual(IOLO,0xF8)) // Address = 0x3F8
+ {
+ Or(IOD0,0x00,IOD0)
+ }
+ Else // Address = 0x3E8
+ {
+ Or(IOD0,0x07,IOD0)
+ }
+ }
+ Else // Address = 0x2xx
+ {
+ If(LEqual(IOLO,0xF8)) // Address = 0x2F8
+ {
+ Or(IOD0,0x01,IOD0)
+ }
+ Else // Address = 0x2E8
+ {
+ Or(IOD0,0x05,IOD0)
+ }
+ }
+
+ // Enable the device.
+
+ Store(Or(CR02,0x08),CR02)
+ Store(0,CRAA)
+ }
+
+ // D0 Method for UART 1.
+
+ Method(_PS0,0,Serialized)
+ {
+ Store(0,CR55)
+ Store(Or(CR02,0x08),CR02)
+ Store(0,CRAA)
+ }
+
+ // D3 Method for UART 1.
+
+ Method(_PS3,0,Serialized)
+ {
+ Store(0,CR55)
+ Store(And(CR02,0xF0),CR02)
+ Store(0,CRAA)
+ }
+}
+
+Device(UAR7) // SMSC1000 UART 2.
+{
+ // Identify UART 2 as an IR Device.
+
+ Name(_HID, EISAID("PNP0510"))
+
+ Name(_UID,1)
+
+ // Status Method for UART 2.
+ Method(_STA,0,Serialized)
+ {
+ //
+ //Check SIO Device is Present or not.
+ //
+ If (SMC1)
+ {
+ Store(0,CR55)
+ Store(CR02,Local0)
+ Store(0,CRAA)
+ If (And(Local0,0x80))
+ {
+ Return (0x000F)
+ }
+ Return (0x000D) // Not present
+ }
+ Return (0x0000)
+ }
+
+ // Disable Method for UART 2.
+ Method(_DIS,0,Serialized)
+ {
+ Store(0,CR55)
+ Store(And(CR02,0x0F),CR02)
+ //
+ // Disable IR on Logical Device Activate Register
+ //
+ Store(And(CR3A,0xFA),CR02)
+ Store(0,CRAA)
+ }
+
+
+ //
+ // Current Resource Setting Method for UART 2.
+ //
+ Method(_CRS,0,Serialized)
+ {
+ // Create the FIR Buffer that stores the Resources to
+ // be returned.
+ Name(BUF0,ResourceTemplate()
+ {
+ IO(Decode16, 0x0000, 0x0000, 0x01, 0x08)
+ IO(Decode16, 0x0000, 0x0000, 0x01, 0x08)
+ IRQNoFlags() {6}
+ DMA(Compatibility, NotBusMaster, Transfer8, ) {2}
+ })
+
+ If(SMC1)
+ {
+ // Create pointers to the specific byte.
+ //
+ CreateByteField(BUF0,0x02,IO10)
+ CreateByteField(BUF0,0x03,IO11)
+ CreateByteField(BUF0,0x04,IO12)
+ CreateByteField(BUF0,0x05,IO13)
+ CreateByteField(BUF0,0x0a,IO20)
+ CreateByteField(BUF0,0x0b,IO21)
+ CreateByteField(BUF0,0x0c,IO22)
+ CreateByteField(BUF0,0x0d,IO23)
+ CreateWordField(BUF0,0x11,IRQW)
+ CreateByteField(BUF0,0x14,DMA0)
+
+ Store(0,CR55)
+
+ //
+ // Write the Base Address into the Buffer.
+ //
+ ShiftLeft(CR25,2,IO10) // Low Byte.
+ ShiftRight(And(CR25,0xC0), 6, IO11)
+ Store(IO10, IO12)
+ Store(IO11, IO13)
+
+ ShiftLeft(CR2B,3,IO20) // Low Byte.
+ ShiftRight(And(CR2B,0xE0), 5, IO21)
+ Store(IO20, IO22)
+ Store(IO21, IO23)
+
+ //
+ // Write the IRQ value into the Buffer.
+ //
+ Store(0x0,Local1)
+ And(CR28,0x0F,Local1)
+ ShiftLeft(1, Local1, IRQW)
+
+ // Write DMA value into buffer
+ Store(0x0,Local1)
+ And(CR2C,0x0F,Local1)
+
+ If(LEqual(Local1, 0x0F)){
+ Store(0, DMA0) //No DMA
+ }
+ Else{
+ ShiftLeft(1, Local1, DMA0)
+ }
+ Store(0,CRAA)
+ }
+ Return(BUF0)
+ }
+
+ //
+ // Possible Resource Setting Method for UART 2.
+ //
+
+ Name(_PRS, ResourceTemplate() {
+ StartDependentFn(0, 0) {
+ IO(Decode16,0x2f8,0x2f8,0x01,0x08)
+ IO(Decode16,0x7E0,0x7E0,0x01,0x08)
+ IRQNoFlags(){6}
+ DMA(Compatibility, NotBusMaster, Transfer8_16) {1}
+ }
+ StartDependentFnNoPri() {
+ IO(Decode16, 0x3F8, 0x3F8, 1, 8)
+ IO(Decode16,0x7E0,0x7E0,0x01,0x08)
+ IRQNoFlags() {3,4,5,6,7,10,11,12}
+ DMA(Compatibility, NotBusMaster, Transfer8_16) {1,2,3}
+ }
+ StartDependentFnNoPri() {
+ IO(Decode16, 0x2F8, 0x3F8, 1, 8)
+ IO(Decode16,0x7E0,0x7E0,0x01,0x08)
+ IRQNoFlags() {3,4,5,6,7,10,11,12}
+ DMA(Compatibility, NotBusMaster, Transfer8_16) {1,2,3}
+ }
+ StartDependentFnNoPri() {
+ IO(Decode16, 0x3E8, 0x3E8, 1, 8)
+ IO(Decode16,0x7E0,0x7E0,0x01,0x08)
+ IRQNoFlags() {3,4,5,6,7,10,11,12}
+ DMA(Compatibility, NotBusMaster, Transfer8_16) {1,2,3}
+ }
+ StartDependentFnNoPri() {
+ IO(Decode16, 0x2E8, 0x3E8, 1, 8)
+ IO(Decode16,0x7E0,0x7E0,0x01,0x08)
+ IRQNoFlags() {3,4,5,6,7,10,11,12}
+ DMA(Compatibility, NotBusMaster, Transfer8_16) {1,2,3}
+ }
+ EndDependentFn()
+ })
+
+
+ // Set Resource Setting Method for UART 2.
+ // Set Resource Setting Method for UART 2.
+ Method(_SRS,1,Serialized)
+ {
+ Store(0,CR55)
+ Store(CR2B, Local0)
+ Store(0,CRAA)
+ If(Local0)
+ {
+ // Point to the specific information in the passed
+ // in Buffer.
+ CreateByteField(Arg0,0x02,IO10)
+ CreateByteField(Arg0,0x03,IO11)
+ CreateByteField(Arg0,0x0a,IO20)
+ CreateByteField(Arg0,0x0b,IO21)
+ CreateWordField(Arg0,0x11,IRQW)
+ CreateByteField(Arg0,0x14,DMA0)
+
+ Store(0,CR55)
+
+ //
+ // Disable the device.
+ //
+ And(CR02,0x0F,CR02)
+
+ //
+ // Set the Base IO Address.
+ //
+ Store(ShiftRight(IO10,2),CR25)
+ Or(CR25,ShiftLeft(IO11,6),CR25)
+ If(IO20){
+ Store(ShiftRight(IO20,3),CR2B)
+ Or(CR2B,ShiftLeft(IO21,5),CR2B)
+ }
+
+ //
+ // Set the IRQ.
+ //
+ And(CR28,0xF0,CR28)
+ Or(CR28,Subtract(FindSetRightBit(IRQW),1),CR28)
+
+ // Set DMA
+ And(CR2C,0xF0,CR2C)
+ If(DMA0)
+ {
+ Or(CR2C,Subtract(FindSetRightBit(DMA0),1),CR2C)
+ }
+ Else
+ {
+ Or(CR2C,0x0F,CR2C) // No DMA
+ }
+
+ //
+ // Set the Decode Range so UART 2 works with ICH7 and
+ // future platforms.
+ //
+ AND(IOD0,0x8F,IOD0) // Clear all bits.
+ If(LEqual(IO11,0x03)) // Address = 0x3xx
+ {
+ If(LEqual(IO10,0xF8)) // Address = 0x3F8
+ {
+ Or(IOD0,0x00,IOD0)
+ }
+ Else // Address = 0x3E8
+ {
+ Or(IOD0,0x070,IOD0)
+ }
+ }
+ Else // Address = 0x2xx
+ {
+ If(LEqual(IO10,0xF8)) // Address = 0x2F8
+ {
+ Or(IOD0,0x010,IOD0)
+ }
+ Else // Address = 0x2E8
+ {
+ Or(IOD0,0x050,IOD0)
+ }
+ }
+
+ //
+ // Enable the device.
+ //
+ Or(CR02,0x80,CR02)
+
+ Store(0,CRAA)
+
+ }
+ Else
+ {
+ // Point to the specific information in the passed
+ // in Buffer.
+ CreateByteField(Arg0,0x02,IOLO)
+ CreateByteField(Arg0,0x03,IOHI)
+ CreateWordField(Arg0,0x09,IRQR)
+
+ Store(0,CR55)
+
+ //
+ // Disable the device.
+ //
+ And(CR02,0x0F,CR02)
+
+ //
+ // Set the Base IO Address.
+ //
+ Store(ShiftRight(IOLO,2),CR25)
+ Or(CR25,ShiftLeft(IOHI,6),CR25)
+
+ //
+ // Set the IRQ.
+ //
+ And(CR28,0xF0,CR28)
+ Or(CR28,Subtract(FindSetRightBit(IRQR),1),CR28)
+
+ //
+ // Set the Decode Range so UART 2 works with ICH7 and
+ // future platforms.
+ //
+ AND(IOD0,0x8F,IOD0) // Clear all bits.
+
+ If(LEqual(IOHI,0x03)) // Address = 0x3xx
+ {
+ If(LEqual(IOLO,0xF8)) // Address = 0x3F8
+ {
+ Or(IOD0,0x00,IOD0)
+ }
+ Else // Address = 0x3E8
+ {
+ Or(IOD0,0x070,IOD0)
+ }
+ }
+ Else // Address = 0x2xx
+ {
+ If(LEqual(IOLO,0xF8)) // Address = 0x2F8
+ {
+ Or(IOD0,0x010,IOD0)
+ }
+ Else // Address = 0x2E8
+ {
+ Or(IOD0,0x050,IOD0)
+ }
+ }
+
+ //
+ // Enable the device.
+ //
+ Or(CR02,0x80,CR02)
+
+ Store(0,CRAA)
+ }
+ }
+
+ //
+ // D0 Method for UART 2.
+ //
+ Method(_PS0,0,Serialized)
+ {
+ Store(0,CR55)
+ Store(Or(CR02,0x80),CR02)
+ Store(0,CRAA)
+
+ }
+
+ //
+ // D3 Method for UART 2.
+ //
+ Method(_PS3,0,Serialized)
+ {
+ Store(0,CR55)
+ Store(And(CR02,0x0F),CR02)
+ Store(0,CRAA)
+
+ }
+}
diff --git a/ReferenceCode/AcpiTables/Dsdt/SMSC1000_LPT.asl b/ReferenceCode/AcpiTables/Dsdt/SMSC1000_LPT.asl
new file mode 100644
index 0000000..235a714
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dsdt/SMSC1000_LPT.asl
@@ -0,0 +1,226 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Haswell *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+
+
+Device(LPT1) // Printer, Output Mode
+{
+ Name(_HID,EISAID("PNP0400"))
+ Name(_UID,5)
+
+ // Status Method for LPT-Output Mode.
+
+ Method(_STA,0,Serialized)
+ {
+ If(SMC1)
+ {
+ // Check if SIO Device is Present & Display LPT1 and return status.
+
+ Store(0,CR55)
+ Store(CR01,Local0)
+ Store(0,CRAA)
+
+ If(And(Local0,0x0C))
+ {
+ Return(0x000F)
+ }
+
+ Return(0x000D)
+ }
+
+ Return(0x0000)
+ }
+
+
+ // Disable Method for LPT-Output Mode.
+
+ Method(_DIS,0,Serialized)
+ {
+ // Set SIO to LPT.
+ Store(0,CR55)
+ Store(And(CR01,0x0FB),CR01)
+ Store(0,CRAA)
+ }
+
+ // Current Resource Setting Method for LPT-Output Mode.
+
+ Method(_CRS,0,Serialized)
+ {
+ // Create a buffer to return to OS.
+
+ Name(BUF0,ResourceTemplate()
+ {
+ IO(Decode16,0x0378,0x0378,0x01,0x04)
+ IRQNoFlags(){5}
+ })
+
+ If(SMC1)
+ {
+ // Create pointers to the specific byte.
+
+ CreateByteField(BUF0,0x02,IOL0)
+ CreateByteField(BUF0,0x03,IOH0)
+ CreateByteField(BUF0,0x04,IOL1)
+ CreateByteField(BUF0,0x05,IOH1)
+ CreateByteField(BUF0,0x07,LEN0)
+ CreateWordField(BUF0,0x09,IRQW)
+
+ Store(0,CR55)
+
+ ShiftLeft(CR23,2,IOL0) // Low Byte.
+ ShiftLeft(CR23,2,IOL1)
+
+ ShiftRight(CR23,6,IOH0) // High Byte.
+ ShiftRight(CR23,6,IOH1)
+
+ // Write the length into the Buffer.
+
+ Store(4,LEN0)
+
+ // Write the IRQ value into the Buffer.
+
+ Store(0x0,Local1)
+ And(CR27,0x0F,Local1)
+ ShiftLeft(1, Local1, IRQW)
+ Store(0,CRAA)
+ }
+
+ Return(BUF0)
+ }
+
+ // Possible Resource Setting Method for LPT-Output Mode.
+ // Build a Buffer with all valid LPT Port Resources.
+
+ Name(_PRS,ResourceTemplate()
+ {
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x378,0x378,0x01,0x04)
+ IRQNoFlags(){5}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x278,0x278,0x01,0x04)
+ IRQNoFlags(){5}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x3BC,0x3BC,0x01,0x04)
+ IRQNoFlags(){5}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x378,0x378,0x01,0x04)
+ IRQNoFlags(){7}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x278,0x278,0x01,0x04)
+ IRQNoFlags(){7}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x3BC,0x3BC,0x01,0x04)
+ IRQNoFlags(){7}
+ }
+
+ EndDependentFn()
+ })
+
+
+ // Set Resource Setting Method for LPT-Output Mode.
+ Method(_SRS,1,Serialized)
+ {
+ // Point to the specific information in the passed
+ // in Buffer.
+
+ CreateByteField(Arg0,0x02,IOL0)
+ CreateByteField(Arg0,0x03,IOH0)
+ CreateWordField(Arg0,0x09,IRQW)
+
+ // Disable the device.
+ Store(0,CR55)
+ Store(And(CR01,0x0FB),CR01)
+
+ // Set the Base IO Address.
+ Store(ShiftRight(IOL0,2),CR23)
+ Or(CR23,ShiftLeft(IOH0,6),CR23)
+
+ // Set the IRQ.
+ FindSetRightBit(IRQW,Local0)
+ If (LNotEqual(IRQW,Zero))
+ {
+ Decrement(Local0)
+ }
+ Store(Local0,CR27)
+
+ // Set the Decode Range so POUT works when docked.
+ And(IOD1,0xFC,IOD1) // Decode all bits.
+
+ If(LEqual(IOH0,0x03)) // Address = 0x3xx
+ {
+ If(LEqual(IOL0,0x78)) // Address = 0x378
+ {
+ Or(IOD1,0x00,IOD1)
+ }
+ Else
+ {
+ Or(IOD1,0x02,IOD1) // Address = 0x3BC
+ }
+ }
+ Else // Address = 0x278
+ {
+ Or(IOD1,0x01,IOD1)
+ }
+
+ // Enable the LPT.
+
+ Or(CR01,0x04,CR01)
+ Store(0,CRAA)
+ }
+
+ // D0 Method for LPT-Output Mode.
+
+ Method(_PS0,0,Serialized)
+ {
+ Store(0,CR55)
+ Store(Or(CR01,0x04),CR01)
+ Store(0,CRAA)
+ }
+
+ // D3 Method for LPT-Output Mode.
+
+ Method(_PS3,0,Serialized)
+ {
+ Store(0,CR55)
+ Store(And(CR01,0x0FB),CR01)
+ Store(0,CRAA)
+ }
+}
diff --git a/ReferenceCode/AcpiTables/Dsdt/SMSC1000_SIO.asl b/ReferenceCode/AcpiTables/Dsdt/SMSC1000_SIO.asl
new file mode 100644
index 0000000..8ba11dc
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dsdt/SMSC1000_SIO.asl
@@ -0,0 +1,92 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Haswell *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+
+
+Device(SM10)
+{
+ Name(_HID,EISAID("PNP0A05"))
+
+ Name(_UID,4)
+
+ Method(_STA,0,Serialized)
+ {
+ // Only report resources to the OS if the SIO Device is
+ // present on the Docking Board.
+
+ If(SMC1)
+ {
+ Return(0x000F)
+ }
+
+ Return(0x0000)
+ }
+
+ // Define the SMSC1000 Reduced SIO Index/Data Registers as an ACPI
+ // Operating Region. These registers will be used communicate
+ // to the SIO.
+
+ OperationRegion(SM10,SystemIO,\SP2O,0x02)
+ Field(SM10, ByteAcc, Lock, Preserve)
+ {
+ INDX, 8,
+ DATA, 8
+ }
+
+ // Use ACPI Defined IndexField so consecutive Index/Data I/Os are
+ // assured to be uninterrupted.
+
+ IndexField(INDX,DATA,ByteAcc,Lock,Preserve)
+ {
+ CR00,8,
+ CR01,8,
+ Offset(0x02),
+ CR02, 8, // UART Power Management
+ Offset(0x0C),
+ CR0C, 8, // UARTMODE
+ Offset(0x23),
+ CR23,8,
+ Offset(0x24),
+ CR24, 8, // UART 1 Base Address
+ CR25, 8, // UART 2 Base Address
+ Offset(0x27),
+ CR27, 8,
+ Offset(0x28),
+ CR28, 8, // UART IRQ Select
+ Offset(0x2B),
+ CR2B, 8, //SCE (FIR) Base Address
+ CR2C, 8, //SCE (FIR) DMA Select
+ Offset(0x3A),
+ CR3A, 8, // LPC Docking Activate
+ CR3B, 8, // LPC Docking Base (High)
+ CR3C, 8, // LPC Docking Base (Low)
+ Offset(0x55),
+ CR55, 8, // Configuration Enable Key
+ Offset(0xAA),
+ CRAA, 8 // Configuration Disable Key
+ }
+ Include("SMSC1000_COM.ASL")
+ Include("SMSC1000_LPT.ASL")
+} \ No newline at end of file
diff --git a/ReferenceCode/AcpiTables/Dsdt/SMSC1007_COM.ASL b/ReferenceCode/AcpiTables/Dsdt/SMSC1007_COM.ASL
new file mode 100644
index 0000000..c2c820f
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dsdt/SMSC1007_COM.ASL
@@ -0,0 +1,593 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Haswell *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+
+
+Device(UAR1) // SMSC 1007 UART 1.
+{
+ // Identify UART 2 as a COM Port.
+
+ Name(_HID, EISAID("PNP0501"))
+
+ Name(_UID,0)
+
+ // Enable Wake on Ring through a Serial Modem.
+
+ Method(_PRW, 0) { Return(GPRW(0x08, 3)) } // can wakeup from S3 state
+
+ // Status Method for UART 1.
+
+ Method(_STA,0,Serialized)
+ {
+ // Only report resources to the OS if the SIO Device is
+ // not set to Disabled in BIOS Setup.
+
+ If(LAnd(SMSC,CMCP))
+ {
+ // Display UART 1 and return status.
+
+ Store(0,CR55)
+ Store(CR02,Local0)
+ Store(0,CRAA)
+
+ If(And(Local0,0x08))
+ {
+ Return(0x000F)
+ }
+
+ Return(0x000D)
+ }
+
+ Return(0x0000)
+ }
+
+ // Disable Method for UART 1.
+
+ Method(_DIS,0,Serialized)
+ {
+ Store(0,CR55)
+ Store(And(CR02,0xF0),CR02)
+ Store(0,CRAA)
+ }
+
+ // Current Resource Setting Method for UART 1.
+
+ Method(_CRS,0,Serialized)
+ {
+ // Create the Buffer that stores the Resources to
+ // be returned.
+
+ Name(BUF0,ResourceTemplate()
+ {
+ IO(Decode16,0x03F8,0x03F8,0x01,0x08)
+ IRQNoFlags(){4}
+ })
+
+ // Skip this sequence if UART 1 is Disabled
+ // in BIOS Setup.
+
+ If(LAnd(SMSC,CMCP))
+ {
+ // Create pointers to the specific byte.
+
+ CreateByteField(BUF0,0x02,IOL0)
+ CreateByteField(BUF0,0x03,IOH0)
+ CreateByteField(BUF0,0x04,IOL1)
+ CreateByteField(BUF0,0x05,IOH1)
+ CreateByteField(BUF0,0x07,LEN0)
+ CreateWordField(BUF0,0x09,IRQW)
+
+ // Write the base address into the Buffer.
+
+ Store(0,CR55)
+
+ ShiftLeft(CR24,2,IOL0) // Low Byte.
+ ShiftLeft(CR24,2,IOL1)
+
+ ShiftRight(CR24,6,IOH0) // High Byte.
+ ShiftRight(CR24,6,IOH1)
+
+ // Write the length into the Buffer.
+
+ Store(8,LEN0)
+
+ // Write the IRQ value into the Buffer.
+
+ ShiftLeft(One,ShiftRight(And(CR28,0xF0),4),IRQW)
+
+ Store(0,CRAA)
+ }
+
+ Return(BUF0)
+ }
+
+ // Possible Resource Setting Method for UART 1.
+
+
+ Name(_PRS,ResourceTemplate()
+ {
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x3F8,0x3F8,0x01,0x08)
+ IRQNoFlags(){4}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x3F8,0x3F8,0x01,0x08)
+ IRQNoFlags(){4,5,6,7,10,11,12}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x2F8,0x2F8,0x01,0x08)
+ IRQNoFlags(){4,5,6,7,10,11,12}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x3E8,0x3E8,0x01,0x08)
+ IRQNoFlags(){4,5,6,7,10,11,12}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x2E8,0x2E8,0x01,0x08)
+ IRQNoFlags(){4,5,6,7,10,11,12}
+ }
+
+ EndDependentFn()
+ })
+
+
+ // Set Resource Setting Method for UART 1.
+
+ Method(_SRS,1,Serialized)
+ {
+ // Point to the specific information in the passed
+ // in Buffer.
+
+ CreateByteField(Arg0,0x02,IOLO)
+ CreateByteField(Arg0,0x03,IOHI)
+ CreateWordField(Arg0,0x09,IRQW)
+
+ // Disable the device.
+
+ Store(0,CR55)
+ Store(And(CR02,0xF0),CR02)
+
+ // Set the Base IO Address.
+
+ Store(ShiftRight(IOLO,2),CR24)
+ Or(CR24,ShiftLeft(IOHI,6),CR24)
+
+ // Set the IRQ.
+
+ And(CR28,0x0F,CR28)
+ Or(CR28,ShiftLeft(Subtract(FindSetRightBit(IRQW),1),4),CR28)
+
+ // Set the Decode Range so UART 1 works with ICH7 and
+ // future platforms.
+
+ AND(IOD0,0xF8,IOD0) // Clear all bits.
+
+ If(LEqual(IOHI,0x03)) // Address = 0x3xx
+ {
+ If(LEqual(IOLO,0xF8)) // Address = 0x3F8
+ {
+ Or(IOD0,0x00,IOD0)
+ }
+ Else // Address = 0x3E8
+ {
+ Or(IOD0,0x07,IOD0)
+ }
+ }
+ Else // Address = 0x2xx
+ {
+ If(LEqual(IOLO,0xF8)) // Address = 0x2F8
+ {
+ Or(IOD0,0x01,IOD0)
+ }
+ Else // Address = 0x2E8
+ {
+ Or(IOD0,0x05,IOD0)
+ }
+ }
+
+ // Enable the device.
+
+ Store(Or(CR02,0x08),CR02)
+ Store(0,CRAA)
+ }
+
+ // D0 Method for UART 1.
+
+ Method(_PS0,0,Serialized)
+ {
+ Store(0,CR55)
+ Store(Or(CR02,0x08),CR02)
+ Store(0,CRAA)
+ }
+
+ // D3 Method for UART 1.
+
+ Method(_PS3,0,Serialized)
+ {
+ Store(0,CR55)
+ Store(And(CR02,0xF0),CR02)
+ Store(0,CRAA)
+ }
+}
+
+Device(UAR2) // SMSC 1007 UART 2.
+{
+ // Identify UART 2 as an IR Device.
+
+ Name(_HID, EISAID("PNP0510"))
+
+ Name(_UID,0)
+
+ // Status Method for UART 2.
+
+ Method(_STA,0,Serialized)
+ {
+ //
+ //Check SIR Base Address, If ADR9 and ADR8 are 0, SIR disabled.
+ //
+ If (LAnd(SMSC,CIRP))
+ {
+ Store(0,CR55)
+ Store(CR02,Local0)
+ Store(0,CRAA)
+ If (And(Local0,0x80))
+ {
+ Return (0x000F)
+ }
+ Return (0x000D) // Not present
+ }
+ Return (0x0000)
+ }
+ // Disable Method for UART 2.
+
+ Method(_DIS,0,Serialized)
+ {
+ Store(0,CR55)
+
+ Store(And(CR02,0x0F),CR02)
+
+ //
+ // Disable IR on Logical Device Activate Register
+ //
+ Store(And(CR3A,0xFA),CR02)
+
+ Store(0,CRAA)
+ }
+
+
+ //
+ // Current Resource Setting Method for UART 2.
+ //
+ Method(_CRS,0,Serialized)
+ {
+
+ // Create the FIR Buffer that stores the Resources to
+ // be returned.
+ Name(BUF0,ResourceTemplate()
+ {
+ IO(Decode16, 0x0000, 0x0000, 0x01, 0x08)
+ IO(Decode16, 0x0000, 0x0000, 0x01, 0x08)
+ IRQNoFlags() {7}
+ DMA(Compatibility, NotBusMaster, Transfer8, ) {2}
+ })
+
+ // Skip this sequence if UART 2 is Disabled
+ // in BIOS Setup.
+
+ If (LAnd(SMSC,CIRP))
+ {
+ //
+ // Create pointers to the specific byte.
+ //
+ CreateByteField(BUF0,0x02,IO10)
+ CreateByteField(BUF0,0x03,IO11)
+ CreateByteField(BUF0,0x04,IO12)
+ CreateByteField(BUF0,0x05,IO13)
+ CreateByteField(BUF0,0x0a,IO20)
+ CreateByteField(BUF0,0x0b,IO21)
+ CreateByteField(BUF0,0x0c,IO22)
+ CreateByteField(BUF0,0x0d,IO23)
+ CreateWordField(BUF0,0x11,IRQW)
+ CreateByteField(BUF0,0x14,DMA0)
+
+ Store(0,CR55)
+
+ //
+ // Write the Base Address into the Buffer.
+ //
+ ShiftLeft(CR25,2,IO10) // Low Byte.
+ ShiftRight(And(CR25,0xC0), 6, IO11)
+ Store(IO10, IO12)
+ Store(IO11, IO13)
+
+ ShiftLeft(CR2B,3,IO20) // Low Byte.
+ ShiftRight(And(CR2B,0xE0), 5, IO21)
+ Store(IO20, IO22)
+ Store(IO21, IO23)
+
+ //
+ // Write the IRQ value into the Buffer.
+ //
+ Store(0x0,Local1)
+ And(CR28,0x0F,Local1)
+ ShiftLeft(1, Local1, IRQW)
+
+ // Write DMA value into buffer
+ Store(0x0,Local1)
+ And(CR2C,0x0F,Local1)
+ If(LEqual(Local1, 0x0F)){
+ Store(0, DMA0) //No DMA
+ }Else{
+ ShiftLeft(1, Local1, DMA0)
+ }
+
+ Store(0,CRAA)
+ }
+
+ Return(BUF0)
+ }
+
+ //
+ // Possible Resource Setting Method for UART 2.
+ //
+ // Build a Buffer with all valid UART 2 Resources.
+
+ Name(_PRS, ResourceTemplate() {
+// IRQ, No DMA
+StartDependentFn(0, 0) {
+ IO(Decode16,0x3E8,0x3E8,0x01,0x08)
+ IO(Decode16,0x7E8,0x7E8,0x01,0x08)
+ IRQNoFlags(){3}
+ DMA(Compatibility, NotBusMaster, Transfer8_16) {3}
+ }
+ StartDependentFnNoPri() {
+ IO(Decode16, 0x3F8, 0x3F8, 1, 8)
+ IO(Decode16,0x7E8,0x7E8,0x01,0x08)
+ IRQNoFlags() {3,4,5,6,7,10,11,12}
+ DMA(Compatibility, NotBusMaster, Transfer8_16) {1,2,3}
+ }
+ StartDependentFnNoPri() {
+ IO(Decode16, 0x2F8, 0x3F8, 1, 8)
+ IO(Decode16,0x7E8,0x7E8,0x01,0x08)
+ IRQNoFlags() {3,4,5,6,7,10,11,12}
+ DMA(Compatibility, NotBusMaster, Transfer8_16) {1,2,3}
+ }
+ StartDependentFnNoPri() {
+ IO(Decode16, 0x3E8, 0x3E8, 1, 8)
+ IO(Decode16,0x7E8,0x7E8,0x01,0x08)
+ IRQNoFlags() {3,4,5,6,7,10,11,12}
+ DMA(Compatibility, NotBusMaster, Transfer8_16) {1,2,3}
+ }
+ StartDependentFnNoPri() {
+ IO(Decode16, 0x2E8, 0x3E8, 1, 8)
+ IO(Decode16,0x7E8,0x7E8,0x01,0x08)
+ IRQNoFlags() {3,4,5,6,7,10,11,12}
+ DMA(Compatibility, NotBusMaster, Transfer8_16) {1,2,3}
+ }
+ EndDependentFn()
+
+ })
+
+
+ // Set Resource Setting Method for UART 2.
+ // Set Resource Setting Method for UART 2.
+ Method(_SRS,1,Serialized)
+ {
+ Store(0,CR55)
+ Store(CR2B, Local0)
+ Store(0,CRAA)
+ If(Local0)
+ {
+ // Point to the specific information in the passed
+ // in Buffer.
+ CreateByteField(Arg0,0x02,IO10)
+ CreateByteField(Arg0,0x03,IO11)
+ CreateByteField(Arg0,0x0a,IO20)
+ CreateByteField(Arg0,0x0b,IO21)
+ CreateWordField(Arg0,0x11,IRQW)
+ CreateByteField(Arg0,0x14,DMA0)
+
+ Store(0,CR55)
+
+ //
+ // Disable the device.
+ //
+ And(CR02,0x0F,CR02)
+
+ //
+ // If UART2 mode has not already been configured, set it here.
+ //
+// Store(0x0B, CR0C)
+// Store(0x40, CR0A)
+// Store(0x0C, CR0C)
+
+ //
+ // Set the Base IO Address.
+ //
+ Store(ShiftRight(IO10,2),CR25)
+ Or(CR25,ShiftLeft(IO11,6),CR25)
+ If(IO20){
+ Store(ShiftRight(IO20,3),CR2B)
+ Or(CR2B,ShiftLeft(IO21,5),CR2B)
+ }
+
+
+ //
+ // Set the IRQ.
+ //
+ And(CR28,0xF0,CR28)
+ Or(CR28,Subtract(FindSetRightBit(IRQW),1),CR28)
+
+ // Set DMA
+ And(CR2C,0xF0,CR2C)
+ If(DMA0)
+ {
+ Or(CR2C,Subtract(FindSetRightBit(DMA0),1),CR2C)
+ }
+ Else
+ {
+ Or(CR2C,0x0F,CR2C) // No DMA
+ }
+
+ //
+ // Set the Decode Range so UART 2 works with ICH7 and
+ // future platforms.
+ //
+ AND(IOD0,0x8F,IOD0) // Clear all bits.
+ If(LEqual(IO11,0x03)) // Address = 0x3xx
+ {
+ If(LEqual(IO10,0xF8)) // Address = 0x3F8
+ {
+ Or(IOD0,0x00,IOD0)
+ }
+ Else // Address = 0x3E8
+ {
+ Or(IOD0,0x070,IOD0)
+ }
+ }
+ Else // Address = 0x2xx
+ {
+ If(LEqual(IO10,0xF8)) // Address = 0x2F8
+ {
+ Or(IOD0,0x010,IOD0)
+ }
+ Else // Address = 0x2E8
+ {
+ Or(IOD0,0x050,IOD0)
+ }
+ }
+
+ //
+ // Enable the device.
+ //
+ Or(CR02,0x80,CR02)
+
+ Store(0,CRAA)
+
+ }
+ Else
+ {
+ // Point to the specific information in the passed
+ // in Buffer.
+ CreateByteField(Arg0,0x02,IOLO)
+ CreateByteField(Arg0,0x03,IOHI)
+ CreateWordField(Arg0,0x09,IRQR)
+
+ Store(0,CR55)
+
+ //
+ // Disable the device.
+ //
+ And(CR02,0x0F,CR02)
+
+ //
+ // If UART2 mode has not already been configured, set it here.
+ //
+// Store(0x0B, CR0C)
+// Store(0x40, CR0A)
+// Store(0x0C, CR0C)
+
+ //
+ // Set the Base IO Address.
+ //
+ Store(ShiftRight(IOLO,2),CR25)
+ Or(CR25,ShiftLeft(IOHI,6),CR25)
+
+ //
+ // Set the IRQ.
+ //
+ And(CR28,0xF0,CR28)
+ Or(CR28,Subtract(FindSetRightBit(IRQR),1),CR28)
+
+ //
+ // Set the Decode Range so UART 2 works with ICH7 and
+ // future platforms.
+ //
+ AND(IOD0,0x8F,IOD0) // Clear all bits.
+
+ If(LEqual(IOHI,0x03)) // Address = 0x3xx
+ {
+ If(LEqual(IOLO,0xF8)) // Address = 0x3F8
+ {
+ Or(IOD0,0x00,IOD0)
+ }
+ Else // Address = 0x3E8
+ {
+ Or(IOD0,0x070,IOD0)
+ }
+ }
+ Else // Address = 0x2xx
+ {
+ If(LEqual(IOLO,0xF8)) // Address = 0x2F8
+ {
+ Or(IOD0,0x010,IOD0)
+ }
+ Else // Address = 0x2E8
+ {
+ Or(IOD0,0x050,IOD0)
+ }
+ }
+
+ //
+ // Enable the device.
+ //
+ Or(CR02,0x80,CR02)
+
+ Store(0,CRAA)
+ }
+ }
+
+ //
+ // D0 Method for UART 2.
+ //
+ Method(_PS0,0,Serialized)
+ {
+ Store(0,CR55)
+ Store(Or(CR02,0x80),CR02)
+ Store(0,CRAA)
+
+ }
+
+ //
+ // D3 Method for UART 2.
+ //
+ Method(_PS3,0,Serialized)
+ {
+ Store(0,CR55)
+ Store(And(CR02,0x0F),CR02)
+ Store(0,CRAA)
+
+ }
+}
diff --git a/ReferenceCode/AcpiTables/Dsdt/SMSC1007_SIO.ASL b/ReferenceCode/AcpiTables/Dsdt/SMSC1007_SIO.ASL
new file mode 100644
index 0000000..6874fe6
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dsdt/SMSC1007_SIO.ASL
@@ -0,0 +1,149 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Haswell *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+
+
+ // Define the SMSC Runtime I/O Registers and the LPC Docking I/O Register
+ // as an ACPI Operating Region. The base address for both can be found
+ // in the SMSC 1007 Configuration Registers, specfically at CR30 for the
+ // Runtime I/O Base and CR3B and CR3C for the LPC Docking Base.
+ //
+Scope(\)
+{
+ OperationRegion(S_IO,SystemIo,\IO2B,0x11)
+ Field(S_IO, ByteAcc, NoLock, Preserve)
+ {
+ PMS0, 8,
+ PME0, 8,
+ PMS1, 8,
+ PMS2, 8,
+ PMS3, 8,
+ PME1, 8,
+ PME2, 8,
+ PME3, 8,
+ Offset(0x08),
+ SS10, 1,
+ SS11, 1,
+ SS12, 1,
+ SS13, 1,
+ SS14, 1,
+ SS15, 1,
+ SS16, 1,
+ SS17, 1,
+ SMS2, 8,
+ Offset(0x0A),
+ SE10, 1,
+ SE11, 1,
+ SE12, 1,
+ SE13, 1,
+ SE14, 1,
+ SE15, 1,
+ SE16, 1,
+ SE17, 1,
+ SME2, 8,
+ Offset(0x0C),
+ RT10, 1, // GP10 = 1 = SMSC COM Port On, 0 = Off, in Wake Mode.
+ RT11, 1, // GP11
+ RT12, 1, // GP12
+ RT13, 1, // GP13
+ RT14, 1, // GP14
+ RT15, 1, // GP15
+ RT16, 1, // GP16
+ RT17, 1, // GP17
+ Offset(0x0E),
+ RT30, 1, // GP30
+ RT31, 1, // GP31
+ RT32, 1, // GP32
+ RT33, 1, // GP33
+ RT34, 1, // GP34
+ RT35, 1, // GP35
+ RT36, 1, // GP36
+ RT37, 1, // GP37
+ Offset(0x10),
+ DLPC, 1, // DLPC Switch
+ CK33, 1, // 33MHz Clock
+ CK14, 1 // 14MHz Clock
+ }
+}
+
+Device(SM17)
+{
+ Name(_HID,EISAID("PNP0A05"))
+
+ Name(_UID,2)
+
+ Method(_STA,0,Serialized)
+ {
+ // Only report resources to the OS if the SIO Device is
+ // present on the Docking Board.
+
+ If(SMSC)
+ {
+ Return(0x000F)
+ }
+
+ Return(0x0000)
+ }
+
+ // Define the SM17 Reduced SIO Index/Data Registers as an ACPI
+ // Operating Region. These registers will be used communicate
+ // to the SIO.
+
+ OperationRegion(SM17,SystemIO,\SP1O,0x02)
+ Field(SM17, ByteAcc, Lock, Preserve)
+ {
+ INDX, 8,
+ DATA, 8
+ }
+
+ // Use ACPI Defined IndexField so consecutive Index/Data I/Os are
+ // assured to be uninterrupted.
+
+ IndexField(INDX,DATA,ByteAcc,Lock,Preserve)
+ {
+ Offset(0x02),
+ CR02, 8, // UART Power Management
+ Offset(0x0C),
+ CR0C, 8, // UARTMODE
+ Offset(0x24),
+ CR24, 8, // UART 1 Base Address
+ CR25, 8, // UART 2 Base Address
+ Offset(0x28),
+ CR28, 8, // UART IRQ Select
+ Offset(0x2B),
+ CR2B, 8, //SCE (FIR) Base Address
+ CR2C, 8, //SCE (FIR) DMA Select
+ Offset(0x3A),
+ CR3A, 8, // LPC Docking Activate
+ CR3B, 8, // LPC Docking Base (High)
+ CR3C, 8, // LPC Docking Base (Low)
+ Offset(0x55),
+ CR55, 8, // Configuration Enable Key
+ Offset(0xAA),
+ CRAA, 8 // Configuration Disable Key
+ }
+
+ Include("SMSC1007_COM.ASL")
+}
diff --git a/ReferenceCode/AcpiTables/Dsdt/THERMAL.ASL b/ReferenceCode/AcpiTables/Dsdt/THERMAL.ASL
new file mode 100644
index 0000000..f38392f
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dsdt/THERMAL.ASL
@@ -0,0 +1,681 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Haswell *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+External(\_PR.APSV)
+External(\_PR.ACRT)
+External(\_PR.AAC0)
+
+// THERMAL.ASL represents a Thermal Zone to be used for testing on the
+// Customer Reference Boards.
+Scope(\_TZ)
+{
+
+ // Notes:
+ // 1) WIN2K strictly uses interrupt driven thermal events.
+ // 2) Temperature values are stored in tenths of Kelvin to
+ // eliminate the decimal place.
+ // 3) Kelvin = Celsius + 273.2.
+ // 4) All temperature must be >= 289K.
+
+ Name(ETMD, 1)
+
+ // Temprature Threshold in Celsius, used to guard against hardware returning bad temprature readings
+ Name(THLD, 120)
+
+ //
+ // YBTx -- _ACx Thermal Trip Points for YellowBluff platform
+ //
+ // Matrix of Thermal Trip points & Fan Control (YellowBluff Platform)
+ // T('C) PWM Duty Cycle
+ Name(YBT4, 55) // 35
+ Name(YBT3, 64) // 55
+ Name(YBT2, 73) // 75
+ Name(YBT1, 80) // 90
+ Name(YBT0, 91) // 100
+
+ // Fan 0 = Package Processor Fan - Maximum speed
+ PowerResource(FN00, 0, 0)
+ {
+ Method(_STA, 0, Serialized)
+ {
+ // Return Virtual Fan 0 status.
+ Return(VFN0)
+ }
+
+ // This method is called when the temprature goes above _AC0.
+ // Regardless of other FAN states, set to ACF0 since this is max cooling state: temp > _AC0
+ Method(_ON, 0, Serialized)
+ {
+ // Set Virtual Fan 0 On.
+ Store(1,VFN0)
+
+ // If EC access is enabled.
+ If(LAnd(ECON, ETMD))
+ {
+ \_SB.PCI0.LPCB.H_EC.ECWT(AC0F, RefOf(\_SB.PCI0.LPCB.H_EC.PENV))
+ \_SB.PCI0.LPCB.H_EC.ECMD(0x1a)
+ }
+ }
+
+ // This method is called when the temprature goes below _AC0.
+ // If FAN1 is on, use its value (AC1F): _AC0 > temp > _AC1
+ // If FAN1 is off, use FAN2 value (AC2F): _AC0 > _AC1 > temp
+ Method(_OFF, 0, Serialized)
+ {
+ // Set Virtual Fan 0 Off.
+ Store(0,VFN0)
+
+ // If EC access is enabled.
+ If(LAnd(ECON, ETMD))
+ {
+ If(LNotEqual(VFN1,0))
+ {
+ \_SB.PCI0.LPCB.H_EC.ECWT(AC1F, RefOf(\_SB.PCI0.LPCB.H_EC.PENV)) // AC1F
+ }
+ Else
+ {
+ \_SB.PCI0.LPCB.H_EC.ECWT(0, RefOf(\_SB.PCI0.LPCB.H_EC.PENV)) // AC2F = 0
+ }
+ \_SB.PCI0.LPCB.H_EC.ECMD(0x1a)
+ }
+ }
+ }
+
+ // Associate Virtual Fan 0 Power Resource with the FAN0 Device.
+ Device(FAN0)
+ {
+ Name(_HID, EISAID("PNP0C0B"))
+ Name(_UID, 0)
+ Name(_PR0, Package(1){FN00})
+#if defined(ASL_CRB_EC_SUPPORT) && (ASL_CRB_EC_SUPPORT == 1)
+ Method(_DEP) // Fan method depends on EC Wrapper Op Region to be available
+ {
+ Return(Package() {\_SB.PCI0.LPCB.H_EC})
+ }
+#endif
+ }
+
+ // Fan 1 = Package Processor Fan.
+ PowerResource(FN01,0,0)
+ {
+ Method(_STA,0,Serialized)
+ {
+ // Return Virtual Fan 1 status.
+ Return(VFN1)
+ }
+
+ // This method is called when the temprature goes above _AC1.
+ // If FAN0 is on, do nothing since we're already at AC0F: temp > _AC0 > _AC1
+ // If FAN0 is off, use FAN1 value (AC1F): _AC0 > temp > _AC1
+ Method(_ON,0,Serialized)
+ {
+ // Set Virtual Fan 1 On.
+ Store(1,VFN1)
+
+ // If EC access is enabled.
+ If(LAnd(ECON, ETMD))
+ {
+ If(LEqual(VFN0,0))
+ {
+ \_SB.PCI0.LPCB.H_EC.ECWT(AC1F, RefOf(\_SB.PCI0.LPCB.H_EC.PENV)) // AC1F
+ \_SB.PCI0.LPCB.H_EC.ECMD(0x1a)
+ }
+ }
+ }
+
+ // This method is called when the temprature goes below _AC1.
+ // If FAN2 is on, use its value (AC2F): _AC1 > temp > _AC2
+ // If FAN2 is off, use FAN3 value (AC3F): _AC1 > _AC2 > temp
+ Method(_OFF,0,Serialized)
+ {
+ // Set Virtual Fan 1 Off.
+ Store(0,VFN1)
+
+ // If EC access is enabled.
+ If(LAnd(ECON, ETMD))
+ {
+ If(LNotEqual(VFN2,0))
+ {
+ \_SB.PCI0.LPCB.H_EC.ECWT(0, RefOf(\_SB.PCI0.LPCB.H_EC.PENV)) // AC2F = 0
+ }
+ Else
+ {
+ \_SB.PCI0.LPCB.H_EC.ECWT(0, RefOf(\_SB.PCI0.LPCB.H_EC.PENV)) // AC3F = 0
+ }
+ \_SB.PCI0.LPCB.H_EC.ECMD(0x1a)
+ }
+ }
+ }
+
+ // Associate Virtual Fan 1 Power Resource with the FAN1 Device.
+ Device(FAN1)
+ {
+ Name(_HID, EISAID("PNP0C0B"))
+ Name(_UID, 1)
+ Name(_PR0, Package(1){FN01})
+#if defined(ASL_CRB_EC_SUPPORT) && (ASL_CRB_EC_SUPPORT == 1)
+ Method(_DEP) // Fan method depends on EC Wrapper Op Region to be available
+ {
+ Return(Package() {\_SB.PCI0.LPCB.H_EC})
+ }
+#endif
+ }
+
+
+ // Fan 2 = Package Processor Fan.
+ PowerResource(FN02,0,0)
+ {
+ Method(_STA,0,Serialized)
+ {
+ // Return Virtual Fan 2 status.
+ Return(VFN2)
+ }
+
+ // This method is called when the temprature goes above _AC2.
+ // If FAN1 is on, do nothing since we're already at AC1F or greater: temp > _AC1 > _AC2
+ // If FAN1 is off, use FAN2 value (AC2F): _AC1 > temp > _AC2
+ Method(_ON,0,Serialized)
+ {
+ // Set Virtual Fan 2 On.
+ Store(1,VFN2)
+
+ // If EC access is enabled.
+ If(LAnd(ECON, ETMD))
+ {
+ If(LEqual(VFN1,0))
+ {
+ \_SB.PCI0.LPCB.H_EC.ECWT(0, RefOf(\_SB.PCI0.LPCB.H_EC.PENV)) // AC2F = 0
+ \_SB.PCI0.LPCB.H_EC.ECMD(0x1a)
+ }
+ }
+ }
+
+ // This method is called when the temprature goes below _AC2.
+ // If FAN3 is on, use its value (AC3F): _AC2 > temp > _AC3
+ // If FAN3 is off, use FAN4 value (AC4F): _AC2 > _AC3 > temp
+ Method(_OFF,0,Serialized)
+ {
+ // Set Virtual Fan 2 Off.
+ Store(0,VFN2)
+
+ // If EC access is enabled.
+ If(LAnd(ECON, ETMD))
+ {
+ If(LNotEqual(VFN3,0))
+ {
+ \_SB.PCI0.LPCB.H_EC.ECWT(0, RefOf(\_SB.PCI0.LPCB.H_EC.PENV)) // AC3F = 0
+ }
+ Else
+ {
+ \_SB.PCI0.LPCB.H_EC.ECWT(0, RefOf(\_SB.PCI0.LPCB.H_EC.PENV)) // AC4F = 0
+ }
+ \_SB.PCI0.LPCB.H_EC.ECMD(0x1a)
+ }
+ }
+ }
+
+ // Associate Virtual Fan 2 Power Resource with the FAN0 Device.
+ Device(FAN2)
+ {
+ Name(_HID, EISAID("PNP0C0B"))
+ Name(_UID, 2)
+ Name(_PR0, Package(1){FN02})
+#if defined(ASL_CRB_EC_SUPPORT) && (ASL_CRB_EC_SUPPORT == 1)
+ Method(_DEP) // Fan method depends on EC Wrapper Op Region to be available
+ {
+ Return(Package() {\_SB.PCI0.LPCB.H_EC})
+ }
+#endif
+ }
+
+ // Fan 3 = Package Processor Fan.
+ PowerResource(FN03,0,0)
+ {
+ Method(_STA,0,Serialized)
+ {
+ // Return Virtual Fan 3 status.
+ Return(VFN3)
+ }
+
+ // This method is called when the temprature goes above _AC3.
+ // If FAN2 is on, do nothing since we're already at AC2F or greater: temp > _AC2 > _AC3
+ // If FAN2 is off, use FAN3 value (AC3F): _AC2 > temp > _AC3
+ Method(_ON,0,Serialized)
+ {
+ // Set Virtual Fan 3 On.
+ Store(1,VFN3)
+
+ // If EC access is enabled.
+ If(LAnd(ECON, ETMD))
+ {
+ If(LEqual(VFN2,0))
+ {
+ \_SB.PCI0.LPCB.H_EC.ECWT(0, RefOf(\_SB.PCI0.LPCB.H_EC.PENV)) // AC3F = 0
+ \_SB.PCI0.LPCB.H_EC.ECMD(0x1a)
+ }
+ }
+ }
+
+ // This method is called when the temprature goes below _AC3.
+ // If FAN4 is on, use its value (AC4F): _AC3 > temp > _AC4
+ // If FAN4 is off, use FAN5 value (AC5F): _AC3 > _AC4 > temp
+ Method(_OFF,0,Serialized)
+ {
+ // Set Virtual Fan 3 Off.
+ Store(0,VFN3)
+
+ // If EC access is enabled.
+ If(LAnd(ECON, ETMD))
+ {
+ If(LNotEqual(VFN4,0))
+ {
+ \_SB.PCI0.LPCB.H_EC.ECWT(0, RefOf(\_SB.PCI0.LPCB.H_EC.PENV)) // AC4F = 0
+ }
+ Else
+ {
+ \_SB.PCI0.LPCB.H_EC.ECWT(0, RefOf(\_SB.PCI0.LPCB.H_EC.PENV)) // AC5F = 0
+ }
+ \_SB.PCI0.LPCB.H_EC.ECMD(0x1a)
+ }
+ }
+ }
+
+ // Associate Virtual Fan 3 Power Resource with the FAN3 Device.
+ Device(FAN3)
+ {
+ Name(_HID, EISAID("PNP0C0B"))
+ Name(_UID, 3)
+ Name(_PR0, Package(1){FN03})
+#if defined(ASL_CRB_EC_SUPPORT) && (ASL_CRB_EC_SUPPORT == 1)
+ Method(_DEP) // Fan method depends on EC Wrapper Op Region to be available
+ {
+ Return(Package() {\_SB.PCI0.LPCB.H_EC})
+ }
+#endif
+ }
+
+ // Fan 4 = Package Processor Fan - Lowest Fan Speed
+ PowerResource(FN04,0,0)
+ {
+ Method(_STA,0,Serialized)
+ {
+ // Return Virtual Fan 4 status.
+ Return(VFN4)
+ }
+
+ // This method is called when the temprature goes above _AC4.
+ // If FAN3 is on, do nothing since we're already at AC3F or greater: temp > _AC3 > _AC4
+ // If FAN3 is off, use FAN4 value (AC4F): _AC3 > temp > _AC4
+ Method(_ON,0,Serialized)
+ {
+ // Set Virtual Fan 4 On.
+ Store(1,VFN4)
+
+ // If EC access is enabled.
+ If(LAnd(ECON, ETMD))
+ {
+ If(LEqual(VFN3,0))
+ {
+ \_SB.PCI0.LPCB.H_EC.ECWT(0, RefOf(\_SB.PCI0.LPCB.H_EC.PENV)) // AC4F = 0
+ \_SB.PCI0.LPCB.H_EC.ECMD(0x1a)
+ }
+ }
+ }
+
+ // This method is called when the temprature goes below _AC4.
+ // FAN4 is the lowest FAN state defined, so we simply go to AC4F
+ Method(_OFF,0,Serialized)
+ {
+ // Set Virtual Fan 4 Off.
+ Store(0,VFN4)
+
+ // If EC access is enabled.
+ If(LAnd(ECON, ETMD))
+ {
+ \_SB.PCI0.LPCB.H_EC.ECWT(0, RefOf(\_SB.PCI0.LPCB.H_EC.PENV)) // AC4F = 0
+ \_SB.PCI0.LPCB.H_EC.ECMD(0x1a)
+ }
+ }
+ }
+
+ // Associate Virtual Fan 4 Power Resource with the FAN4 Device.
+ Device(FAN4)
+ {
+ Name(_HID, EISAID("PNP0C0B"))
+ Name(_UID, 4)
+ Name(_PR0, Package(1){FN04})
+#if defined(ASL_CRB_EC_SUPPORT) && (ASL_CRB_EC_SUPPORT == 1)
+ Method(_DEP) // Fan method depends on EC Wrapper Op Region to be available
+ {
+ Return(Package() {\_SB.PCI0.LPCB.H_EC})
+ }
+#endif
+ }
+
+ // Thermal Zone 0 = Package Thermal Zone.
+ // Package Thermal Zone is used for Active and Critical Policy Control
+ // Package Thermal Zone returns the maximum temperature
+ // of all components within the package
+ ThermalZone(TZ00)
+ {
+ // Temporary variable for holding the current temprature reading
+ Name(PTMP,3000)
+
+ // Notifies ASL Code the current cooling mode.
+ // 0 - Active cooling
+ // 1 - Passive cooling
+ Method(_SCP, 1, Serialized)
+ {
+ Store(Arg0, CTYP)
+ }
+
+ // Return the temperature at which the OS performs Critical Shutdown
+ Method(_CRT, 0, Serialized)
+ {
+ // Returns automatic thermal reporting temperature for CPU throttling if available and valid.
+ If(CondRefOf(\_PR.ACRT))
+ {
+ If(LNotEqual(\_PR.ACRT,0))
+ {
+ Return(Add(2732, Multiply(\_PR.ACRT, 10)))
+ }
+ }
+
+ Return(Add(2732, Multiply(CRTT, 10)))
+ }
+
+ // Return the temperature(s) at which the OS initiates Active Cooling.
+ Method(_AC0, 0, Serialized)
+ {
+ // Returns automatic thermal reporting temperature for CPU throttling if available and valid.
+ If(CondRefOf(\_PR.AAC0))
+ {
+ If(LNotEqual(\_PR.AAC0,0))
+ {
+ Return(Add(2732, Multiply(\_PR.AAC0, 10)))
+ }
+ }
+ Return(Add(2732, Multiply(ACTT, 10)))
+
+ }
+
+ Method(_AC1, 0, Serialized)
+ {
+ Return(Add(2732, Multiply(ACT1, 10)))
+ }
+
+ Method(_AC2, 0, Serialized)
+ {
+ Return(Add(2732, Multiply(0, 10)))
+
+ }
+
+ Method(_AC3, 0, Serialized)
+ {
+ Return(Add(2732, Multiply(0, 10)))
+
+ }
+
+ Method(_AC4, 0, Serialized)
+ {
+ Return(Add(2732, Multiply(0, 10)))
+
+ }
+
+ // Return the device(s) to turn on when _ACx is exceeded.
+ Name(_AL0, Package(){FAN0})
+ Name(_AL1, Package(){FAN1})
+ Name(_AL2, Package(){FAN2})
+ Name(_AL3, Package(){FAN3})
+ Name(_AL4, Package(){FAN4})
+
+ // Return the Package Temperature.
+ // Source 1: CPU DTS temperature
+ // Source 2: Max Platform temprature returned by EC
+ Method(_TMP, 0, Serialized)
+ {
+
+ If (LNot(ETMD)) // If Legacy TM is disabled, return static value
+ {
+ Return (3000)
+ }
+
+ If (LEqual(DTSE, 0x3)) //Out Of Spec Condition occurred. Return critical temperature for OS shutdown
+ {
+ Return(Add(2832,Multiply(CRTT,10)))
+ }
+
+ // Source 1: If DTS SMM enabled
+ //
+ // If Package Temp MSR is available, then send Package DTS Temp
+ // otherwise send Core DTS Temp
+ If(LEqual(DTSE, 0x01))
+ {
+ If(LEqual(PKGA, 0x01))
+ {
+ Store(PDTS, Local0)
+ Return(Add(2732, Multiply(Local0, 10)))
+ }
+ //
+ // Package DTS not support. Report MAX temperature between all cores to OS.
+ //
+ Store(DTS1,Local0)
+ If(LGreater(DTS2, Local0))
+ {
+ Store(DTS2,Local0)
+ }
+ If(LGreater(DTS3, Local0))
+ {
+ Store(DTS3,Local0)
+ }
+ If(LGreater(DTS4, Local0))
+ {
+ Store(DTS4,Local0)
+ }
+ Return(Add(2732, Multiply(Local0, 10)))
+ }
+
+ // Source 2: Max Platform temprature returned by EC
+ // If EC enabled/avaialable
+ If(ECON)
+ {
+ // Store current reading in temporary variable
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PLMX)), Local0) // Max Platform temprature
+ Add(2732, Multiply(Local0, 10), Local0 )
+ Store(Local0, PTMP)
+ Return(Local0)
+ }
+
+
+ // Return a static value if no source is available.
+ Return(3010)
+ }
+ }
+
+ // Thermal Zone 1 = CPU Thermal Zone.
+ // CPU Thermal Zone is used for Passive Policy Control
+ // Since Passive Control implies reducing CPU IA core performance states,
+ // Only CPU's temperature must be used for that purpose.
+ ThermalZone(TZ01)
+ {
+
+ // Temporary variable for holding the current temprature reading
+ Name(PTMP,3000)
+
+ // Notifies ASL Code the current cooling mode.
+ // 0 - Active cooling
+ // 1 - Passive cooling
+ Method(_SCP, 1, Serialized)
+ {
+ Store(Arg0,CTYP)
+ }
+
+ // Return the temperature at which the OS performs Critical Shutdown
+ Method(_CRT, 0, Serialized)
+ {
+ // Returns automatic thermal reporting temperature for CPU throttling if available and valid.
+ If(CondRefOf(\_PR.ACRT))
+ {
+ If(LNotEqual(\_PR.ACRT,0))
+ {
+ Return(Add(2732, Multiply(\_PR.ACRT, 10)))
+ }
+ }
+
+ Return(Add(2732, Multiply(CRTT, 10)))
+ }
+
+ // Return the CPU Temperature to the OS.
+ // CPU Temperature is the maximum temperature of all CPU IA cores
+ // Source 1: CPU temprature reported by DTS SMM
+ // Source 2: CPU temprature reported by EC via PECI
+ Method(_TMP,0,Serialized)
+ {
+
+ If (LNot(ETMD)) // If Legacy TM is disabled, return static value
+ {
+ Return (3020)
+ }
+
+ If (LEqual(DTSE, 0x3)) //Out Of Spec Condition occurred. Return critical temperature for OS shutdown
+ {
+ Return(Add(2832,Multiply(CRTT,10)))
+ }
+
+ // Source 1: If DTS SMM enabled
+ // If Package Temp MSR is available, then send Package DTS Temp
+ // otherwise send Core DTS Temp
+ If(LEqual(DTSE, 0x01))
+ {
+ If(LEqual(PKGA, 0x01))
+ {
+ Store(PDTS, Local0)
+ Return(Add(2732, Multiply(Local0, 10)))
+ }
+ //
+ // Package DTS not support. Report MAX temperature between all cores to OS.
+ //
+ Store(DTS1,Local0)
+ If(LGreater(DTS2, Local0))
+ {
+ Store(DTS2,Local0)
+ }
+ If(LGreater(DTS3, Local0))
+ {
+ Store(DTS3,Local0)
+ }
+ If(LGreater(DTS4, Local0))
+ {
+ Store(DTS4,Local0)
+ }
+ Return(Add(2732, Multiply(Local0, 10)))
+ }
+
+ // If EC avialable/enabled
+ If(ECON)
+ {
+
+ // Source 2: CPU temprature reported by EC via PECI
+ // Store current Integer part of reading in temporary variable
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PECH)), Local0)
+ Multiply(Local0, 10, Local0)
+
+ // Fractional part of temprature
+ // Fractional part is in 1/64C, Fractional value = (PECL >> 2 ) * 1/64
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PECL)), Local1)
+ ShiftRight(Local1, 2, Local1)
+ Store(Divide( Multiply(Local1, 10), 64), Local1)
+
+ // Add fractional part to decimal part
+ Add( Local0, Local1, Local0)
+
+ Add(2732, Local0, Local0 )
+ Store(Local0, PTMP)
+ Return(Local0)
+ }
+
+
+ // Return a static value if no source is available.
+ Return(3030)
+ }
+
+ // Return the Processor(s) used for Passive Cooling.
+ Method(_PSL, 0, Serialized)
+ {
+ If(LEqual(TCNT, 8))
+ {
+ // CMP - Throttling controls eight logical CPUs.
+ Return(Package(){\_PR.CPU0,\_PR.CPU1,\_PR.CPU2,\_PR.CPU3,\_PR.CPU4,\_PR.CPU5,\_PR.CPU6,\_PR.CPU7})
+ }
+
+ If(LEqual(TCNT, 4))
+ {
+ // CMP - Throttling controls four logical CPUs.
+ Return(Package(){\_PR.CPU0,\_PR.CPU1,\_PR.CPU2,\_PR.CPU3})
+ }
+
+ If(LEqual(TCNT, 2))
+ {
+ // CMP - Throttling controls both CPUs.
+ Return(Package(){\_PR.CPU0,\_PR.CPU1})
+ }
+
+ Return(Package(){\_PR.CPU0})
+ }
+
+ // Returns the temperature at which the OS initiates CPU throttling.
+ Method(_PSV, 0, Serialized)
+ {
+ // Returns automatic thermal reporting temperature for CPU throttling if available and valid.
+ If(CondRefOf(\_PR.APSV))
+ {
+ If(LNotEqual(\_PR.APSV,0))
+ {
+ Return(Add(2732, Multiply(\_PR.APSV, 10)))
+ }
+ }
+
+ Return(Add(2732, Multiply(PSVT, 10)))
+ }
+
+ // Returns TC1 value used in the passive cooling formula.
+ Method(_TC1, 0, Serialized)
+ {
+ Return(TC1V)
+ }
+
+ // Returns TC2 value used in the passive cooling formula.
+ Method(_TC2, 0, Serialized)
+ {
+ Return(TC2V)
+ }
+
+ // Returns the sampling period used in the passive cooling formula.
+ Method(_TSP, 0, Serialized)
+ {
+ Return(TSPV)
+ }
+ }
+}
diff --git a/ReferenceCode/AcpiTables/Dsdt/Video.asl b/ReferenceCode/AcpiTables/Dsdt/Video.asl
new file mode 100644
index 0000000..41a33b1
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dsdt/Video.asl
@@ -0,0 +1,48 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Haswell *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+
+
+#if !defined(ASL_Remove_SaSsdt_Data_To_Dsdt) || (ASL_Remove_SaSsdt_Data_To_Dsdt == 0)
+External(DIDX)
+#endif
+
+// Brightness Notification:
+// Generate a brightness related notification
+// to the LFP if its populated.
+//
+// Arguments:
+// Arg0: Notification value.
+//
+// Return Value:
+// None
+
+Method(BRTN,1,Serialized)
+{
+ If(LEqual(And(DIDX,0x0F00),0x400))
+ {
+ Notify(\_SB.PCI0.GFX0.DD1F,Arg0)
+ }
+}
diff --git a/ReferenceCode/AcpiTables/Dsdt/WPCN381U_COM.asl b/ReferenceCode/AcpiTables/Dsdt/WPCN381U_COM.asl
new file mode 100644
index 0000000..494f25e
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dsdt/WPCN381U_COM.asl
@@ -0,0 +1,775 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Haswell *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+
+
+Device(UAR5) // Serial Port UART 5
+{
+ Name(_HID, EISAID("PNP0501"))
+
+ Name(_UID,3)
+
+ // Status Method for UART 5.
+
+ Method(_STA,0,Serialized)
+ {
+ // Only report resources to the OS if the SIO Device is
+ // not set to Disabled in BIOS Setup.
+
+ If(W381)
+ {
+ // Set the SIO to UART 5.
+
+ Store(3,WR07)
+
+ // Display UART 5 and return status.
+
+ If(WR30)
+ {
+ Return(0x000F)
+ }
+
+ Return(0x000D)
+ }
+
+ Return(0x0000)
+ }
+
+ // Disable Method for UART 5.
+
+ Method(_DIS,0,Serialized)
+ {
+ Store(3,WR07)
+ Store(0,WR30)
+ }
+
+ // Current Resource Setting Method for UART 5.
+
+ Method(_CRS,0,Serialized)
+ {
+ // Create the Buffer that stores the Resources to
+ // be returned.
+
+ Name(BUF0,ResourceTemplate()
+ {
+ IO(Decode16,0x03F8,0x03F8,0x01,0x08)
+ IRQNoFlags(){4}
+ })
+
+ // Set SIO to UART 5.
+
+ Store(3,WR07)
+
+ // Skip this sequence if the UART 5 Port is Disabled
+ // in BIOS Setup.
+
+ If(W381)
+ {
+ // Create pointers to the specific byte.
+
+ CreateByteField(BUF0,0x02,IOL0)
+ CreateByteField(BUF0,0x03,IOH0)
+ CreateByteField(BUF0,0x04,IOL1)
+ CreateByteField(BUF0,0x05,IOH1)
+ CreateByteField(BUF0,0x07,LEN0)
+ CreateWordField(BUF0,0x09,IRQW)
+
+ // Write IO and Length values into the Buffer.
+
+ Store(WR60,IOH0)
+ Store(WR61,IOL0)
+ Store(WR60,IOH1)
+ Store(WR61,IOL1)
+ Store(8,LEN0)
+
+ // Write the IRQ value into the Buffer.
+
+ And(WR70,0x0F,Local0)
+ If(Local0)
+ {
+ ShiftLeft(One,Local0,IRQW)
+ }
+ Else
+ {
+ Store(Zero,IRQW)
+ }
+ }
+
+ Return(BUF0)
+ }
+
+ // Possible Resource Setting Method for UART 5.
+
+ // Build a Buffer with all valid COM Port Resources.
+
+ Name(_PRS,ResourceTemplate()
+ {
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x3F8,0x3F8,0x01,0x08)
+ IRQNoFlags(){4}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x3F8,0x3F8,0x01,0x08)
+ IRQNoFlags(){4,5,6,7,10,11,12}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x2F8,0x2F8,0x01,0x08)
+ IRQNoFlags(){4,5,6,7,10,11,12}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x3E8,0x3E8,0x01,0x08)
+ IRQNoFlags(){4,5,6,7,10,11,12}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x2E8,0x2E8,0x01,0x08)
+ IRQNoFlags(){4,5,6,7,10,11,12}
+ }
+
+ EndDependentFn()
+ })
+
+
+ // Set Resource Setting Method for UART 5.
+
+ Method(_SRS,1,Serialized)
+ {
+ // Point to the specific information in the passed
+ // in Buffer.
+
+ CreateByteField(Arg0,0x02,IOLO)
+ CreateByteField(Arg0,0x03,IOHI)
+ CreateWordField(Arg0,0x09,IRQW)
+
+ // Set the SIO to UART 5.
+
+ Store(3,WR07)
+
+ // Disable the device.
+
+ Store(0,WR30)
+
+ // Set the Base IO Address.
+
+ Store(IOLO,WR61)
+ Store(IOHI,WR60)
+
+ // Set the IRQ.
+
+ FindSetRightBit(IRQW,Local0)
+ If(LNotEqual(IRQW,Zero))
+ {
+ Decrement(Local0)
+ }
+ Store(Local0,WR70)
+
+ // Set the Decode Range so UART 5 works on ICH7 and
+ // future platforms.
+
+ AND(IOD0,0xF8,IOD0) // Clear all bits.
+
+ If(LEqual(IOHI,0x03)) // Address = 0x3xx
+ {
+ If(LEqual(IOLO,0xF8)) // Address = 0x3F8
+ {
+ Or(IOD0,0x00,IOD0)
+ }
+ Else // Address = 0x3E8
+ {
+ Or(IOD0,0x07,IOD0)
+ }
+ }
+ Else // Address = 0x2xx
+ {
+ If(LEqual(IOLO,0xF8)) // Address = 0x2F8
+ {
+ Or(IOD0,0x01,IOD0)
+ }
+ Else // Address = 0x2E8
+ {
+ Or(IOD0,0x05,IOD0)
+ }
+ }
+
+ // Enable the device.
+
+ Store(1,WR30)
+ }
+
+ // D0 Method for COM Port.
+
+ Method(_PS0,0,Serialized)
+ {
+ Store(3,WR07)
+ Store(1,WR30)
+ }
+
+ // D3 Method for COM Port.
+
+ Method(_PS3,0,Serialized)
+ {
+ Store(3,WR07)
+ Store(0,WR30)
+ }
+}
+
+Device(UAR8) // Serial Port UART 8
+{
+ Name(_HID, EISAID("PNP0501"))
+
+ Name(_UID,4)
+
+ // Status Method for UART 8.
+
+ Method(_STA,0,Serialized)
+ {
+ // Only report resources to the OS if the SIO Device is
+ // not set to Disabled in BIOS Setup.
+
+ If(W381)
+ {
+ And(WR27,0x0E0,Local0)
+ If (LEqual (Local0, 0x00)) //SIORevID == 000x xxxxb => 374L(LDC2 card)
+ {
+ Store(0x2,WR07)
+ // Check if Serial port 2 is enabled
+ If(WR30)
+ {
+ Return(0x000F)
+ }
+ Return(0x000D)
+ }
+ }
+ Return(Zero)
+ }
+
+ // Disable Method for UART 8.
+
+ Method(_DIS,0,Serialized)
+ {
+ Store(2,WR07)
+ Store(0,WR30)
+ }
+
+ // Current Resource Setting Method for UART 8.
+
+ Method(_CRS,0,Serialized)
+ {
+ // Create the Buffer that stores the Resources to
+ // be returned.
+
+ Name(BUF0,ResourceTemplate()
+ {
+ IO(Decode16,0x02F8,0x02F8,0x01,0x08)
+ IRQNoFlags(){3}
+ })
+
+ // Set SIO to UART 8.
+
+ Store(2,WR07)
+
+ // Skip this sequence if the UART 8 Port is Disabled
+ // in BIOS Setup.
+
+ If(W381)
+ {
+ // Create pointers to the specific byte.
+
+ CreateByteField(BUF0,0x02,IOL0)
+ CreateByteField(BUF0,0x03,IOH0)
+ CreateByteField(BUF0,0x04,IOL1)
+ CreateByteField(BUF0,0x05,IOH1)
+ CreateByteField(BUF0,0x07,LEN0)
+ CreateWordField(BUF0,0x09,IRQW)
+
+ // Write IO and Length values into the Buffer.
+
+ Store(WR60,IOH0)
+ Store(WR61,IOL0)
+ Store(WR60,IOH1)
+ Store(WR61,IOL1)
+ Store(8,LEN0)
+
+ // Write the IRQ value into the Buffer.
+
+ And(WR70,0x0F,Local0)
+ If(Local0)
+ {
+ ShiftLeft(One,Local0,IRQW)
+ }
+ Else
+ {
+ Store(Zero,IRQW)
+ }
+ }
+
+ Return(BUF0)
+ }
+
+ // Possible Resource Setting Method for UART 8.
+
+ // Build a Buffer with all valid UART 8 Port Resources.
+
+ Name(_PRS,ResourceTemplate()
+ {
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x2F8,0x2F8,0x01,0x08)
+ IRQNoFlags(){3}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x3F8,0x3F8,0x01,0x08)
+ IRQNoFlags(){4,5,6,7,10,11,12}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x2F8,0x2F8,0x01,0x08)
+ IRQNoFlags(){4,5,6,7,10,11,12}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x3E8,0x3E8,0x01,0x08)
+ IRQNoFlags(){4,5,6,7,10,11,12}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x2E8,0x2E8,0x01,0x08)
+ IRQNoFlags(){4,5,6,7,10,11,12}
+ }
+
+ EndDependentFn()
+ })
+
+
+ // Set Resource Setting Method for UART 8.
+
+ Method(_SRS,1,Serialized)
+ {
+ // Point to the specific information in the passed
+ // in Buffer.
+
+ CreateByteField(Arg0,0x02,IOLO)
+ CreateByteField(Arg0,0x03,IOHI)
+ CreateWordField(Arg0,0x09,IRQW)
+
+ // Set the SIO to UART 8.
+
+ Store(2,WR07)
+
+ // Disable the device.
+
+ Store(0,WR30)
+
+ // Set the Base IO Address.
+
+ Store(IOLO,WR61)
+ Store(IOHI,WR60)
+
+ // Set the IRQ.
+
+ FindSetRightBit(IRQW,Local0)
+ If(LNotEqual(IRQW,Zero))
+ {
+ Decrement(Local0)
+ }
+ Store(Local0,WR70)
+
+ // Set the Decode Range so UART 8 works on PCH and
+ // future platforms.
+
+ AND(IOD0,0x8F,IOD0) // Clear all bits.
+
+ If(LEqual(IOHI,0x03)) // Address = 0x3xx
+ {
+ If(LEqual(IOLO,0xF8)) // Address = 0x3F8
+ {
+ Or(IOD0,0x00,IOD0)
+ }
+ Else // Address = 0x3E8
+ {
+ Or(IOD0,0x70,IOD0)
+ }
+ }
+ Else // Address = 0x2xx
+ {
+ If(LEqual(IOLO,0xF8)) // Address = 0x2F8
+ {
+ Or(IOD0,0x10,IOD0)
+ }
+ Else // Address = 0x2E8
+ {
+ Or(IOD0,0x50,IOD0)
+ }
+ }
+
+ // Enable the device.
+
+ Store(1,WR30)
+ }
+
+ // D0 Method for UART 8 Port.
+
+ Method(_PS0,0,Serialized)
+ {
+ Store(2,WR07)
+ Store(1,WR30)
+ }
+
+ // D3 Method for UART 8 Port.
+
+ Method(_PS3,0,Serialized)
+ {
+ Store(2,WR07)
+ Store(0,WR30)
+ }
+}
+//Resource for WPCD376I SP3 Device(LDN 0x16)
+Device(LD16) // LDN 0x16
+{
+ Name(_HID, EISAID("PNP0501"))
+ Name(_UID,5)
+
+ // Status Method for LDN 0x16. Keep it Disabled as this LDN is part of Consumer IR device
+ Method(_STA,0,Serialized)
+ {
+ Return(0x0000)
+ }
+
+ // Possible Resource Setting Method for LDN 0x16.
+ Name(_PRS,ResourceTemplate()
+ {
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x2F8,0x2F8,0x01,0x08)
+ IRQNoFlags(){3}
+ }
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x3F8,0x3F8,0x01,0x08)
+ IRQNoFlags(){4,5,6,7,10,11,12}
+ }
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x2F8,0x2F8,0x01,0x08)
+ IRQNoFlags(){4,5,6,7,10,11,12}
+ }
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x3E8,0x3E8,0x01,0x08)
+ IRQNoFlags(){4,5,6,7,10,11,12}
+ }
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x2E8,0x2E8,0x01,0x08)
+ IRQNoFlags(){4,5,6,7,10,11,12}
+ }
+ EndDependentFn()
+ })
+}
+//Resource for WPCD376I CIR Device(LDN 0x15)
+Device(LD15) // LDN 0x15
+{
+ Name(_HID, EISAID("WEC0001"))
+ Name(_UID,6)
+
+ // Status Method for LDN 0x15. Keep it Disabled as this LDN is part of Consumer IR device
+ Method(_STA,0,Serialized)
+ {
+ Return(0x0000)
+ }
+
+ // Possible Resource Setting Method for CIR.
+ Name(_PRS,ResourceTemplate()
+ {
+ StartDependentFn(0,2)
+ {
+ IO (Decode16, 0x07D0, 0x07D0, 0x01, 0x10)
+ IO (Decode16, 0x07C0, 0x07C0, 0x01, 0x10)
+ }
+ EndDependentFn()
+ })
+}
+
+//WPCD376I Consumer IR device
+Device (ECIR)
+{
+ Name (_HID, EISAID("WEC1022"))
+ Name (_UID, One)
+
+ OperationRegion(CIRR,SystemIO,0x7C0,0x20)
+ Field(CIRR,ByteAcc,NoLock,Preserve)
+ {
+ Offset(0x15), //CIR wake up base address offset 5 [0x7D0 + 5]
+ RXEE, 3,
+ , 5,
+ }
+
+ Method (_STA, 0, NotSerialized)
+ {
+ If(W381)
+ {
+ And(WR27,0x0E0,Local0)
+ Store(0x15,WR07)
+ If (LAnd(LEqual (Local0, 0x80), LOr(WR60,WR61))) //SIORevID == 100x xxxxb => 376I and Resource allocated
+ {
+ If (WR30) //Check if CIR device is enabled.
+ {
+ Return(0x000F)
+ }
+ Return(0x000D)
+ }
+ }
+ Return(Zero)
+ }
+
+ Method (_DIS, 0, NotSerialized)
+ {
+ Store (0x15, WR07)
+ Store (Zero, WR30)
+ Store (0x16, WR07)
+ Store (Zero, WR30)
+ }
+
+ Method(_CRS,0,Serialized)
+ {
+ // Create the Buffer that stores the Resources to
+ // be returned.
+
+ Name(BUF0,ResourceTemplate()
+ {
+ IO (Decode16, 0x0, 0x0, 0x01, 0x10)
+ IO (Decode16, 0x0, 0x0, 0x01, 0x10)
+ IO (Decode16, 0x0, 0x0, 0x08, 0x08)
+ IRQNoFlags (){0}
+ })
+
+ CreateByteField(BUF0,0x02,IO00)
+ CreateByteField(BUF0,0x03,IO01)
+ CreateByteField(BUF0,0x04,IO10)
+ CreateByteField(BUF0,0x05,IO11)
+ CreateByteField(BUF0,0x0a,IO20)
+ CreateByteField(BUF0,0x0b,IO21)
+ CreateByteField(BUF0,0x0c,IO30)
+ CreateByteField(BUF0,0x0d,IO31)
+ CreateByteField(BUF0,0x12,IO40)
+ CreateByteField(BUF0,0x13,IO41)
+ CreateByteField(BUF0,0x14,IO50)
+ CreateByteField(BUF0,0x15,IO51)
+ CreateWordField(BUF0,0x19,IRQW)
+
+ // Set the SIO to SP3.
+ Store(0x16,WR07)
+ // Set the Base IO Address.
+ Store(WR61,IO40)
+ Store(WR60,IO41)
+ Store(WR61,IO50)
+ Store(WR60,IO51)
+ // Write the IRQ value into the Buffer.
+ And(WR70,0x0F,Local0)
+ If(Local0)
+ {
+ ShiftLeft(One,Local0,IRQW)
+ }
+ Else
+ {
+ Store(Zero,IRQW)
+ }
+
+ //set resource for CIr device
+ // Set the SIO to SP3.
+ Store(0x15,WR07)
+ // Set the Base IO Address.
+ Store(WR61,IO00)
+ Store(WR60,IO01)
+ Store(WR61,IO10)
+ Store(WR60,IO11)
+
+ Store(WR63,IO20)
+ Store(WR62,IO21)
+ Store(WR63,IO30)
+ Store(WR62,IO31)
+
+ Return(BUF0)
+ }
+
+
+ Name(_PRS,ResourceTemplate()
+ {
+ StartDependentFn(0,2)
+ {
+ IO (Decode16, 0x07D0, 0x07D0, 0x01, 0x10)
+ IO (Decode16, 0x07C0, 0x07C0, 0x01, 0x10)
+ IO (Decode16, 0x02F8, 0x02F8, 0x08, 0x08)
+ IRQNoFlags(){3}
+ }
+ StartDependentFn(0,2)
+ {
+ IO (Decode16, 0x07D0, 0x07D0, 0x01, 0x10)
+ IO (Decode16, 0x07C0, 0x07C0, 0x01, 0x10)
+ IO (Decode16, 0x03F8, 0x03F8, 0x08, 0x08)
+ IRQNoFlags(){4,5,6,7,10,11,12}
+ }
+ StartDependentFn(0,2)
+ {
+ IO (Decode16, 0x07D0, 0x07D0, 0x01, 0x10)
+ IO (Decode16, 0x07C0, 0x07C0, 0x01, 0x10)
+ IO (Decode16, 0x02F8, 0x02F8, 0x08, 0x08)
+ IRQNoFlags(){4,5,6,7,10,11,12}
+ }
+ StartDependentFn(0,2)
+ {
+ IO (Decode16, 0x07D0, 0x07D0, 0x01, 0x10)
+ IO (Decode16, 0x07C0, 0x07C0, 0x01, 0x10)
+ IO (Decode16, 0x03E8, 0x03E8, 0x08, 0x08)
+ IRQNoFlags(){4,5,6,7,10,11,12}
+ }
+ StartDependentFn(0,2)
+ {
+ IO (Decode16, 0x07D0, 0x07D0, 0x01, 0x10)
+ IO (Decode16, 0x07C0, 0x07C0, 0x01, 0x10)
+ IO (Decode16, 0x02E8, 0x02E8, 0x08, 0x08)
+ IRQNoFlags(){4,5,6,7,10,11,12}
+ }
+ EndDependentFn ()
+ })
+
+ Method (_SRS, 1, NotSerialized)
+ {
+ CreateByteField(Arg0,0x02,IO00)
+ CreateByteField(Arg0,0x03,IO01)
+ CreateByteField(Arg0,0x0a,IO20)
+ CreateByteField(Arg0,0x0b,IO21)
+ CreateByteField(Arg0,0x12,IO40)
+ CreateByteField(Arg0,0x13,IO41)
+ CreateWordField(Arg0,0x19,IRQW)
+
+ // Set the SIO to SP3.
+ Store(0x16,WR07)
+ // Set the Base IO Address.
+ Store(IO40, WR61)
+ Store(IO41, WR60)
+ // Set the IRQ.
+ FindSetRightBit(IRQW,Local0)
+ If(LNotEqual(IRQW,Zero))
+ {
+ Decrement(Local0)
+ }
+ Store(Local0,WR70)
+
+ AND(IOD0,0x8F,IOD0) // Clear all bits.
+ If(LEqual(IO41,0x03)) // Address = 0x3xx
+ {
+ If(LEqual(IO40,0xF8)) // Address = 0x3F8
+ {
+ Or(IOD0,0x00,IOD0)
+ }
+ Else // Address = 0x3E8
+ {
+ Or(IOD0,0x70,IOD0)
+ }
+ }
+ Else // Address = 0x2xx
+ {
+ If(LEqual(IO40,0xF8)) // Address = 0x2F8
+ {
+ Or(IOD0,0x10,IOD0)
+ }
+ Else // Address = 0x2E8
+ {
+ Or(IOD0,0x50,IOD0)
+ }
+ }
+
+ //set resource for CIr device
+ // Set the SIO to SP3.
+ Store(0x15,WR07)
+ // Set the Base IO Address.
+ Store(IO00, WR61)
+ Store(IO01, WR60)
+ Store(IO20, WR63)
+ Store(IO21, WR62)
+ Store (0x15, WR07)
+ Store (One, WR30)
+ Store (0x16, WR07)
+ Store (0x82, WRF0)
+ Store (One, WR30)
+ }
+
+ Method (_S3D, 0, NotSerialized)
+ {
+ Return (0x02)
+ }
+
+ Method (_S4D, 0, NotSerialized)
+ {
+ Return (0x02)
+ }
+
+ Method (_S3W, 0, NotSerialized)
+ {
+ Return (0x02)
+ }
+
+ Method (_S4W, 0, NotSerialized)
+ {
+ Return (0x02)
+ }
+
+ Name (CPS4, Package (0x02)
+ {
+ 0x1D,
+ 0x04
+ })
+ Method (_PRW, 0, NotSerialized)
+ {
+ Return (CPS4)
+ }
+
+ Method (_PSW, 1, NotSerialized)
+ {
+ If (LEqual (Arg0, Zero))
+ {
+ Store (Zero, RXEE)
+ }
+ If (LEqual (Arg0, One))
+ {
+ Store (0x07, RXEE)
+ }
+ }
+}
diff --git a/ReferenceCode/AcpiTables/Dsdt/WPCN381U_LPT.ASL b/ReferenceCode/AcpiTables/Dsdt/WPCN381U_LPT.ASL
new file mode 100644
index 0000000..2a2cb9e
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dsdt/WPCN381U_LPT.ASL
@@ -0,0 +1,988 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Haswell *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+
+
+
+// This ASL file will support the LPT in Output, BiDirectional, EPP,
+// & ECP mode. Only 1 of these devices will be shown by the OS at any
+// given time, and that one will depend on the BIOS configuration.
+Scope(\_SB.PCI0.LPCB.WPCN){
+
+Device(LPT2) // Printer, Output Mode
+{
+ Name(_HID,EISAID("PNP0400"))
+ Name(_UID,2)
+
+ // Status Method for LPT-Output Mode.
+
+ Method(_STA,0,Serialized)
+ {
+ // Output mode = 000x xxxxb - check that no bits are set.
+
+ Store(1,WR07)
+ If(LEqual(And(WRF0,0xE0),0x00))
+ {
+ // LPT is in Output Mode. Only report resources
+ // to the OS if the SIO Device is not set to
+ // Disabled in BIOS Setup.
+
+ If(W381)
+ {
+ // Set SIO to LPT.
+
+ Store(1,WR07)
+
+ // Display POUT and return Status.
+
+ If(WR30)
+ {
+ Return(0x000F)
+ }
+
+ Return(0x000D)
+ }
+ }
+
+ Return(0x0000)
+ }
+
+ // Disable Method for LPT-Output Mode.
+
+ Method(_DIS,0,Serialized)
+ {
+ // Set SIO to LPT.
+
+ Store(1,WR07)
+
+ If(LEqual(And(WRF0,0xE0),0x00))
+ {
+ Store(0,WR30)
+ }
+
+ }
+
+ // Current Resource Setting Method for LPT-Output Mode.
+
+ Method(_CRS,0,Serialized)
+ {
+ // Create a buffer to return to OS.
+
+ Name(BUF0,ResourceTemplate()
+ {
+ IO(Decode16,0x0378,0x0378,0x01,0x04)
+ IRQNoFlags(){7}
+ })
+
+ // Skip this sequence if the LPT Device is not set
+ // to Output Mode.
+
+ If(LEqual(And(WRF0,0xE0),0x00))
+ {
+ // Create pointers to the specific byte.
+
+ CreateByteField(BUF0,0x02,IOL0)
+ CreateByteField(BUF0,0x03,IOH0)
+ CreateByteField(BUF0,0x04,IOL1)
+ CreateByteField(BUF0,0x05,IOH1)
+ CreateByteField(BUF0,0x07,LEN0)
+ CreateWordField(BUF0,0x09,IRQW)
+
+ // Set SIO to LPT.
+ Store(1,WR07)
+
+ // Write IO and Length values into the Buffer.
+
+ Store(WR61,IOL0)
+ Store(WR60,IOH0)
+ Store(IOL0,IOL1)
+ Store(IOH0,IOH1)
+ Store(4,LEN0)
+
+ // Write the IRQ value into the Buffer.
+
+ If(And(WR70,0x0F))
+ {
+ ShiftLeft(One,And(WR70,0x0F),IRQW)
+ }
+ Else
+ {
+ Store(Zero,IRQW)
+ }
+ }
+
+ Return(BUF0)
+ }
+
+ // Possible Resource Setting Method for LPT-Output Mode.
+ // Build a Buffer with all valid LPT Port Resources.
+
+ Name(_PRS,ResourceTemplate()
+ {
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x378,0x378,0x01,0x04)
+ IRQNoFlags(){7}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x278,0x278,0x01,0x04)
+ IRQNoFlags(){7}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x3BC,0x3BC,0x01,0x04)
+ IRQNoFlags(){7}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x378,0x378,0x01,0x04)
+ IRQNoFlags(){5}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x278,0x278,0x01,0x04)
+ IRQNoFlags(){5}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x3BC,0x3BC,0x01,0x04)
+ IRQNoFlags(){5}
+ }
+
+ EndDependentFn()
+ })
+
+
+ // Set Resource Setting Method for LPT-Output Mode.
+
+ Method(_SRS,1,Serialized)
+ {
+ // Point to the specific information in the passed
+ // in Buffer.
+
+ CreateByteField(Arg0,0x02,IOL0)
+ CreateByteField(Arg0,0x03,IOH0)
+ CreateWordField(Arg0,0x09,IRQW)
+
+ // Set SIO to LPT.
+
+ Store(1,WR07)
+
+ // Disable the LPT.
+
+ Store(0,WR30)
+
+ // Disable the DMA channels.
+
+ Store(4,WR74)
+
+ // Set the Base IO Address.
+
+ Store(IOL0,WR61)
+ Store(IOH0,WR60)
+
+ // Set the IRQ.
+
+ FindSetRightBit(IRQW,Local0)
+ If (LNotEqual(IRQW,Zero))
+ {
+ Decrement(Local0)
+ }
+ Store(Local0,WR70)
+
+ // Set the Decode Range so POUT works when docked.
+
+ And(IOD1,0xFC,IOD1) // Decode all bits.
+
+ If(LEqual(IOH0,0x03)) // Address = 0x3xx
+ {
+ If(LEqual(IOL0,0x78)) // Address = 0x378
+ {
+ Or(IOD1,0x00,IOD1)
+ }
+ Else
+ {
+ Or(IOD1,0x02,IOD1) // Address = 0x3BC
+ }
+ }
+ Else // Address = 0x278
+ {
+ Or(IOD1,0x01,IOD1)
+ }
+
+ // Enable the LPT.
+ Store(1,WR30)
+
+ // Set to Output Mode.
+ And(WRF0,0x0F,WRF0)
+
+
+
+ }
+
+ // D0 Method for LPT-Output Mode.
+
+ Method(_PS0,0,Serialized)
+ {
+ Store(1,WR07)
+ Store(1,WR30)
+
+ }
+
+ // D3 Method for LPT-Output Mode.
+
+ Method(_PS3,0,Serialized)
+ {
+ Store(1,WR07)
+ Store(0,WR30)
+
+ }
+}
+
+Device(PBI2) // Printer, BiDirectional Mode
+{
+ Name(_HID,EISAID("PNP0400"))
+ Name(_UID,2)
+
+ // Status Method for LPT-BiDirectional Mode.
+
+ Method(_STA,0,Serialized)
+ {
+ // BiDirectional mode = 001x xxxxb, so check that only
+ // bit 5 is set.
+ Store(1,WR07)
+
+ If(LEqual(And(WRF0,0xE0),0x20))
+ {
+ // LPT is in BiDirectional Mode. Only report
+ // resources to the OS if the SIO Device is not
+ // set to Disabled in BIOS Setup.
+
+ If(W381)
+ {
+ // Display PBID and return Status.
+
+ If(WR30)
+ {
+ Return(0x000F)
+ }
+
+ Return(0x000D)
+ }
+ }
+
+ Return(0x0000)
+ }
+
+ // Disable Method for LPT-BiDirectional Mode.
+
+ Method(_DIS,0,Serialized)
+ {
+ // Set SIO to LPT.
+
+ Store(1,WR07)
+
+ If(LEqual(And(WRF0,0xE0),0x20))
+ {
+ Store(0,WR30)
+ }
+ }
+
+ // Current Resource Setting Method for LPT-BiDirectional Mode.
+
+ Method(_CRS,0,Serialized)
+ {
+ // Create a buffer to return to OS.
+
+ Name(BUF0,ResourceTemplate()
+ {
+ IO(Decode16,0x0378,0x0378,0x01,0x04)
+ IRQNoFlags(){7}
+ })
+
+ // Skip this sequence if the LPT Device is not set
+ // to BiDirectional Mode.
+
+ If(LEqual(And(WRF0,0xE0),0x20))
+ {
+ // Create pointers to the specific byte.
+
+ CreateByteField(BUF0,0x02,IOL0)
+ CreateByteField(BUF0,0x03,IOH0)
+ CreateByteField(BUF0,0x04,IOL1)
+ CreateByteField(BUF0,0x05,IOH1)
+ CreateByteField(BUF0,0x07,LEN0)
+ CreateWordField(BUF0,0x09,IRQW)
+
+ // Set SIO to LPT.
+
+ Store(1,WR07)
+
+ // Write IO and Length values into the Buffer.
+
+ Store(WR61,IOL0)
+ Store(WR60,IOH0)
+ Store(IOL0,IOL1)
+ Store(IOH0,IOH1)
+ Store(4,LEN0)
+
+ // Write the IRQ value into the Buffer.
+
+ If(And(WR70,0x0F))
+ {
+ ShiftLeft(One,And(WR70,0x0F),IRQW)
+ }
+ Else
+ {
+ Store(Zero, IRQW)
+ }
+ }
+
+ Return(BUF0)
+ }
+
+ // Possible Resource Setting Method for LPT-BiDirectional Mode.
+
+ Name(_PRS,ResourceTemplate()
+ {
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x378,0x378,0x01,0x04)
+ IRQNoFlags(){7}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x278,0x278,0x01,0x04)
+ IRQNoFlags(){7}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x3BC,0x3BC,0x01,0x04)
+ IRQNoFlags(){7}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x378,0x378,0x01,0x04)
+ IRQNoFlags(){5}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x278,0x278,0x01,0x04)
+ IRQNoFlags(){5}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x3BC,0x3BC,0x01,0x04)
+ IRQNoFlags(){5}
+ }
+
+ EndDependentFn()
+ })
+
+
+ // Set Resource Setting Method for LPT-BiDirectional Mode.
+
+ Method(_SRS,1,Serialized)
+ {
+ // Arg0 passed into _SRS is the buffer identical to BUF0.
+
+ CreateByteField(Arg0,0x02,IOL0)
+ CreateByteField(Arg0,0x03,IOH0)
+ CreateWordField(Arg0,0x09,IRQW)
+
+ Store(1,WR07)
+
+ // Disable the LPT.
+
+ Store(0,WR30)
+
+ // Disable the DMA channels.
+
+ Store(4,WR74)
+
+ // Set the Base IO Address.
+
+ Store(IOL0,WR61)
+ Store(IOH0,WR60)
+
+ // Set the IRQ.
+
+ FindSetRightBit(IRQW,Local0)
+ If (LNotEqual(IRQW,Zero))
+ {
+ Decrement(Local0)
+ }
+ Store(Local0,WR70)
+
+ // Set the Decode Range so PBID works when docked.
+
+ And(IOD1,0xFC,IOD1) // Decode all bits.
+
+ If(LEqual(IOH0,0x03)) // Address = 0x3xx
+ {
+ If(LEqual(IOL0,0x78)) // Address = 0x378
+ {
+ Or(IOD1,0x00,IOD1)
+ }
+ Else
+ {
+ Or(IOD1,0x02,IOD1) // Address = 0x3BC
+ }
+ }
+ Else // Address = 0x278
+ {
+ Or(IOD1,0x01,IOD1)
+ }
+
+ // Enable the LPT.
+
+ Store(1,WR30)
+
+ // Set to Bi-Directional Mode.
+
+ Or(And(WRF0,0x0F),0x20,WRF0)
+
+
+ }
+
+ // D0 Method for LPT-BiDirectional Mode.
+
+ Method(_PS0,0,Serialized)
+ {
+ Store(1,WR07)
+ Store(1,WR30)
+
+ }
+
+ // D3 Method for LPT-BiDirectional Mode.
+
+ Method(_PS3,0,Serialized)
+ {
+ Store(1,WR07)
+ Store(0,WR30)
+ }
+}
+
+Device(PEP2) // Printer, EPP Mode
+{
+ Name(_HID,EISAID("PNP0400"))
+ Name(_UID,2)
+
+ // Status Method for LPT-EPP Mode.
+
+ Method(_STA,0,Serialized)
+ {
+ // EPP 1.9 mode = 011x xxxxb.
+
+ Store(1,WR07)
+ If(LOr(LEqual(And(WRF0,0xE0),0x60), LEqual(And(WRF0,0xE0),0x40)))
+ {
+ // LPT is in EPP Mode. Only report resources
+ // to the OS if the SIO Device is not set to
+ // Disabled in BIOS Setup.
+
+ // Display PEPP and return Status.
+
+ If(WR30)
+ {
+ Return(0x000F)
+ }
+ Else
+ {
+ Return(0x000D)
+ }
+ }
+
+
+ Return(0x0000)
+ }
+
+ // Disable Method for LPT-EPP Mode.
+
+ Method(_DIS,0,Serialized)
+ {
+ // Set SIO to LPT.
+
+ Store(1,WR07)
+
+ If(LOr(LEqual(And(WRF0,0xE0),0x60), LEqual(And(WRF0,0xE0),0x40)))
+ {
+ Store(0,WR30)
+ }
+ }
+
+ // Current Resource Setting Method for LPT-EPP Mode.
+
+ Method(_CRS,0,Serialized)
+ {
+ // Create a buffer to return to OS.
+
+ Name(BUF0,ResourceTemplate()
+ {
+ IO(Decode16,0x0378,0x0378,0x01,0x08)
+ IRQNoFlags(){7}
+ })
+
+ // Skip this sequence if the LPT Device is not set
+ // to EPP Mode.
+
+ If(LOr(LEqual(And(WRF0,0xE0),0x60), LEqual(And(WRF0,0xE0),0x40)))
+ {
+ // Create pointers to the specific byte.
+
+ CreateByteField(BUF0,0x02,IOL0)
+ CreateByteField(BUF0,0x03,IOH0)
+ CreateByteField(BUF0,0x04,IOL1)
+ CreateByteField(BUF0,0x05,IOH1)
+ CreateByteField(BUF0,0x07,LEN0)
+ CreateWordField(BUF0,0x09,IRQW)
+
+ // Set SIO to LPT.
+
+ Store(1,WR07)
+
+ // Write IO and Length values into the Buffer.
+
+ Store(WR61,IOL0)
+ Store(WR60,IOH0)
+ Store(IOL0,IOL1)
+ Store(IOH0,IOH1)
+ Store(8,LEN0)
+
+ // Write the IRQ value into the Buffer.
+
+ If(And(WR70,0x0F))
+ {
+ ShiftLeft(One,And(WR70,0x0F),IRQW)
+ }
+ Else
+ {
+ Store(Zero, IRQW)
+ }
+ }
+
+ Return(BUF0)
+ }
+
+ // Possible Resource Setting Method for LPT-EPP Mode.
+
+ Name(_PRS,ResourceTemplate()
+ {
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x378,0x378,0x01,0x08)
+ IRQNoFlags(){7}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x278,0x278,0x01,0x08)
+ IRQNoFlags(){7}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x378,0x378,0x01,0x08)
+ IRQNoFlags(){5}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x278,0x278,0x01,0x08)
+ IRQNoFlags(){5}
+ }
+
+ EndDependentFn()
+ })
+
+
+ // Set Resource Setting Method for LPT-EPP Mode.
+
+ Method(_SRS,1,Serialized)
+ {
+ // Arg0 passed into _SRS is the buffer identical to BUF0.
+
+ CreateByteField(Arg0,0x02,IOL0)
+ CreateByteField(Arg0,0x03,IOH0)
+ CreateWordField(Arg0,0x09,IRQW)
+
+ Store(1,WR07)
+
+ // Disable the LPT.
+
+ Store(0,WR30)
+
+ // Disable the DMA channels.
+
+ Store(4,WR74)
+
+ // Set the Base IO Address.
+
+ Store(IOL0,WR61)
+ Store(IOH0,WR60)
+
+ // Set the IRQ.
+
+ FindSetRightBit(IRQW,Local0)
+ If (LNotEqual(IRQW,Zero))
+ {
+ Decrement(Local0)
+ }
+ Store(Local0,WR70)
+
+ // Set the Decode Range so PEPP works when docked.
+
+ And(IOD1,0xFC,IOD1) // Decode all bits.
+
+ If(LEqual(IOH0,0x03)) // Address = 0x378
+ {
+ Or(IOD1,0x00,IOD1)
+ }
+ Else // Address = 0x278
+ {
+ Or(IOD1,0x01,IOD1)
+ }
+
+ // Enable the LPT.
+
+ Store(1,WR30)
+
+ // Set to SPP + EPP 1.9 Mode.
+
+ Or(And(WRF0,0x0F),0x60,WRF0)
+
+ }
+
+ // D0 Method for LPT-EPP Mode.
+
+ Method(_PS0,0,Serialized)
+ {
+ Store(1,WR07)
+ Store(1,WR30)
+ }
+
+ // D3 Method for LPT-EPP Mode.
+
+ Method(_PS3,0,Serialized)
+ {
+ Store(1,WR07)
+ Store(0,WR30)
+ }
+}
+
+Device(PEC2) // Printer, ECP Mode
+{
+ Name(_HID,EISAID("PNP0401"))
+ Name(_UID,2)
+
+ // Status Method for LPT-ECP Mode.
+
+ Method(_STA,0,Serialized)
+ {
+ // ECP mode = 111x xxxxb.
+
+ Store(1,WR07)
+ If(LOr(LEqual(And(WRF0,0xE0),0xE0), LEqual(And(WRF0,0xE0),0x80)))
+ {
+ // LPT is in ECP Mode. Only report resources
+ // to the OS if the SIO Device is not set to
+ // Disabled in BIOS Setup.
+
+
+
+ // Display PECP and return Status.
+
+ If(WR30)
+ {
+ Return(0x000F)
+ }
+ Else
+ {
+ Return(0x000D)
+ }
+
+ }
+
+ Return(0x0000)
+ }
+
+ // Disable Method for LPT-ECP Mode.
+
+ Method(_DIS,0,Serialized)
+ {
+ // Set SIO to LPT.
+
+ Store(1,WR07)
+
+ If(LOr(LEqual(And(WRF0,0xE0),0xE0), LEqual(And(WRF0,0xE0),0x80)))
+ {
+ Store(0,WR30)
+ }
+ }
+
+ // Current Resource Setting Method for LPT-ECP Mode.
+
+ Method(_CRS,0,Serialized)
+ {
+ // Create a buffer to return to OS.
+
+ Name(BUF0,ResourceTemplate()
+ {
+ IO(Decode16,0x0378,0x0378,0x01,0x08)
+ IO(Decode16,0x0778,0x0778,0x01,0x08)
+ IRQNoFlags(){7}
+ DMA(Compatibility,NotBusMaster,Transfer8_16,){1}
+ })
+
+ // Skip this sequence if the LPT Device is not set
+ // to ECP Mode.
+
+ If(LOr(LEqual(And(WRF0,0xE0),0xE0), LEqual(And(WRF0,0xE0),0x80)))
+ {
+ // Create pointers to the specific byte.
+
+ CreateByteField(BUF0,0x02,IOL0)
+ CreateByteField(BUF0,0x03,IOH0)
+ CreateByteField(BUF0,0x04,IOL1)
+ CreateByteField(BUF0,0x05,IOH1)
+ CreateByteField(BUF0,0x07,LEN0)
+ CreateByteField(BUF0,0x0A,IOL2)
+ CreateByteField(BUF0,0x0B,IOH2)
+ CreateByteField(BUF0,0x0C,IOL3)
+ CreateByteField(BUF0,0x0D,IOH3)
+ CreateByteField(BUF0,0x0F,LEN1)
+ CreateWordField(BUF0,0x11,IRQW)
+ CreateByteField(BUF0,0x14,DMA0)
+
+ // Set SIO to LPT.
+
+ Store(1,WR07)
+
+ // Write IO and Length values into the Buffer.
+
+ Store(WR61,IOL0)
+ Store(WR60,IOH0)
+ Store(IOL0,IOL1)
+ Store(IOH0,IOH1)
+ Store(IOL0,IOL2)
+ Store(Add(0x4,IOH0),IOH2)
+ Store(IOL0,IOL3)
+ Store(Add(0x4,IOH0),IOH3)
+ Store(8,LEN0)
+ Store(8,LEN1)
+
+ // Write the IRQ value into the Buffer.
+
+ And(WR70,0x0F,Local0)
+ If(Local0)
+ {
+ ShiftLeft(One,Local0,IRQW)
+ }
+ Else
+ {
+ Store(Zero,IRQW)
+ }
+
+ // Write the DMA value into the Buffer.
+
+ Store(WR74,Local0)
+ If(LEqual(Local0,0x04))
+ {
+ Store(Zero,DMA0)
+ }
+ Else
+ {
+ ShiftLeft(One,Local0,DMA0)
+ }
+ }
+
+ Return(BUF0)
+ }
+
+ // Possible Resource Setting Method for LPT-ECP Mode.
+
+ Name(_PRS,ResourceTemplate()
+ {
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x378,0x378,0x01,0x08)
+ IO(Decode16,0x778,0x778,0x01,0x08)
+ IRQNoFlags(){7}
+ DMA(Compatibility,NotBusMaster,Transfer8_16){3}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x278,0x278,0x01,0x08)
+ IO(Decode16,0x678,0x678,0x01,0x08)
+ IRQNoFlags(){7}
+ DMA(Compatibility,NotBusMaster,Transfer8_16){3}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x378,0x378,0x01,0x08)
+ IO(Decode16,0x778,0x778,0x01,0x08)
+ IRQNoFlags(){5}
+ DMA(Compatibility,NotBusMaster,Transfer8_16){3}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x278,0x278,0x01,0x08)
+ IO(Decode16,0x678,0x678,0x01,0x08)
+ IRQNoFlags(){5}
+ DMA(Compatibility,NotBusMaster,Transfer8_16){3}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x378,0x378,0x01,0x08)
+ IO(Decode16,0x778,0x778,0x01,0x08)
+ IRQNoFlags(){7}
+ DMA(Compatibility,NotBusMaster,Transfer8_16){1}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x278,0x278,0x01,0x08)
+ IO(Decode16,0x678,0x678,0x01,0x08)
+ IRQNoFlags(){7}
+ DMA(Compatibility,NotBusMaster,Transfer8_16){1}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x378,0x378,0x01,0x08)
+ IO(Decode16,0x778,0x778,0x01,0x08)
+ IRQNoFlags(){5}
+ DMA(Compatibility,NotBusMaster,Transfer8_16){1}
+ }
+
+ StartDependentFn(0,2)
+ {
+ IO(Decode16,0x278,0x278,0x01,0x08)
+ IO(Decode16,0x678,0x678,0x01,0x08)
+ IRQNoFlags(){5}
+ DMA(Compatibility,NotBusMaster,Transfer8_16){1}
+ }
+
+ EndDependentFn()
+ })
+
+
+ // Set Resource Setting Method for LPT-ECP Mode.
+
+ Method(_SRS,1,Serialized)
+ {
+ // Arg0 passed into _SRS is the buffer identical to BUF0.
+
+ CreateByteField(Arg0,0x02,IOL0)
+ CreateByteField(Arg0,0x03,IOH0)
+ CreateWordField(Arg0,0x11,IRQW)
+ CreateByteField(Arg0,0x14,DMA0)
+
+ Store(1,WR07)
+
+ // Disable the LPT.
+
+ Store(0,WR30)
+
+
+ // Set the Base I/O Address
+
+ Store(IOL0,WR61)
+ Store(IOH0,WR60)
+
+ // Set the IRQ
+
+ FindSetRightBit(IRQW,Local0)
+ If (LNotEqual(IRQW,Zero))
+ {
+ Decrement(Local0)
+ }
+ Store(Local0,WR70)
+
+ // Set the DMA Channel
+
+ FindSetRightBit(DMA0,Local0)
+ If (LNotEqual(DMA0,Zero))
+ {
+ Decrement(Local0)
+ }
+ Store(Local0,WR74)
+
+ // Set the Decode Range so PECP works when docked.
+
+ And(IOD1,0xFC,IOD1) // Decode all bits.
+
+ If(LEqual(IOH0,0x03)) // Address = 0x378
+ {
+ Or(IOD1,0x00,IOD1)
+ }
+ Else // Address = 0x278
+ {
+ Or(IOD1,0x01,IOD1)
+ }
+
+ // Enable the LPT.
+
+ Store(1,WR30)
+
+ // Set to ECP Mode with EPP Mode 4 support.
+
+ Or(WRF0,0xF0,WRF0)
+
+ }
+
+ // D0 Method for LPT-ECP Mode.
+
+ Method(_PS0,0,Serialized)
+ {
+ Store(1,WR07)
+ Store(1,WR30)
+ }
+
+ // D3 Method for LPT-ECP Mode.
+
+ Method(_PS3,0,Serialized)
+ {
+ Store(1,WR07)
+ Store(0,WR30)
+ }
+}
+
+} // End of Scope()
diff --git a/ReferenceCode/AcpiTables/Dsdt/WPCN381U_SIO.asl b/ReferenceCode/AcpiTables/Dsdt/WPCN381U_SIO.asl
new file mode 100644
index 0000000..9bf40f5
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dsdt/WPCN381U_SIO.asl
@@ -0,0 +1,98 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Haswell *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+
+
+Device(WPCN)
+{
+ Name(_HID,EISAID("PNP0A05"))
+
+ Name(_UID,3)
+
+ // Status Method for the National SIO.
+
+ Method(_STA,0,Serialized)
+ {
+ // Only report resources to the OS if the SIO Device is
+ // present on the Docking Board.
+
+ If(W381)
+ {
+ Return(0x000F)
+ }
+
+ Return(0x0000)
+ }
+
+ // Define the SIO Index/Data Registers as an ACPI Operating
+ // Region. These registers will be used communicate to the SIO.
+
+ OperationRegion(WPCN, SystemIO, 0x02E, 0x02)
+ Field(WPCN, ByteAcc, Lock, Preserve)
+ {
+ INDX, 8,
+ DATA, 8
+ }
+
+ // Use ACPI Defined IndexField so consecutive Index/Data I/Os are
+ // assured to be uninterrupted.
+
+ IndexField(INDX, DATA, ByteAcc, Lock, Preserve)
+ {
+ Offset(0x07), // Logical Device Number.
+ WR07, 8,
+ Offset(0x20), // SIO Configuration and ID.
+ WR20, 8,
+ WR21, 8,
+ WR22, 8,
+ WR23, 8,
+ WR24, 8,
+ WR25, 8,
+ WR26, 8,
+ WR27, 8,
+ WR28, 8,
+ WR29, 8,
+ WR2A, 8,
+ Offset(0x30), // Logical Device Activate.
+ WR30, 8,
+ Offset(0x60), // I/O Space Configuration.
+ WR60, 8,
+ WR61, 8,
+ WR62, 8,
+ WR63, 8,
+ Offset(0x70), // Interrupt Configuration.
+ WR70, 8,
+ WR71, 8,
+ Offset(0x74), // DMA Configuration.
+ WR74, 8,
+ WR75, 8,
+ Offset(0xF0), // Special Logical Device Configuration.
+ WRF0, 8,
+ WRF1, 8
+ }
+
+ Include ("WPCN381U_COM.ASL")
+ Include ("WPCN381U_LPT.ASL")
+}
diff --git a/ReferenceCode/AcpiTables/Dsdt/token.asl b/ReferenceCode/AcpiTables/Dsdt/token.asl
new file mode 100644
index 0000000..d62a151
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dsdt/token.asl
@@ -0,0 +1,145 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Haswell *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+
+
+Name(SP2O, 0x4e) // Super I/O (SMSC 1007) Index/Data configuration port for ASL.
+Name(SP1O, 0x164e) // Super I/O (SMSC 1007) Index/Data configuration port for ASL.
+Name(IO1B, 0x600) // Super I/O (SMSC 1007) GPIO base address
+Name(IO1L, 0x70) // Super I/O (SMSC 1007) GPIO base address length
+Name(IO2B, 0x680) // Super I/O (SMSC 1007) PME base address
+Name(IO2L, 0x20) // Super I/O (SMSC 1007) PME base address length
+Name(IO3B, 0x290) // Super I/O (SMSC 1007) HHM Base Address
+Name(IO3L, 0x10) // Super I/O (SMSC 1007) HHM base address length
+Name(SP3O, 0x2e) // Super I/O (Winbond 3xx) Index/Data configuration port for ASL.
+Name(IO4B, 0xa20) // Super I/O (Winbond 3xx) GPIO base address length
+Name(IO4L, 0x20) // Super I/O (Winbond 3xx) GPIO base address length
+Name(HSCS, 0x1) // Hitachi H8S2113D Super I/O COM port status.
+Name(MCHB, 0xfed10000) // MCH BAR address
+Name(MCHL, 0x8000) // MCH BAR length
+Name(EGPB, 0xfed19000) // EP BAR address
+Name(EGPL, 0x1000) // EP BAR length
+Name(DMIB, 0xfed18000) // DMI BAR address
+Name(DMIL, 0x1000) // DMI BAR length
+Name(IFPB, 0xfed14000) // Base addrerss of 4K MMIO Window any write to which will FLUSH GMCH Global Write Buffer to let software
+ // guarantee coherency between writes from an isochronous agent and writes from the CPU.
+Name(IFPL, 0x1000) // Length of the MMIO region above.
+Name(PEBS, EDKII_GLUE_PciExpressBaseAddress) // PCI Express BAR address
+Name(PELN, PLATFORM_PCIEXPRESS_LENGTH) // PCI Express BAR length
+Name(TTTB, 0xfed20000) //
+Name(TTTL, 0x20000) //
+Name(SMBS, 0xefa0) // SMBus I/O Registes Base Address
+Name(SMBL, 0x10) // SMBus I/O Registes Range
+Name(PBLK, 0x1810) // Boot-strap CPU Control Block register address. Use return value of PM_BASE_ADDRESS with proper offset.
+Name(PMBS, 0x1800) // ASL alias for ACPI I/O base address.
+Name(PMLN, 0x100) // Power Management registers block length
+Name(LVL2, 0x1814) // Processor LVL2 register I/O address.
+Name(LVL3, 0x1815) // Processor LVL3 register I/O address.
+Name(LVL4, 0x1816) // Processor LVL4 register I/O address.
+Name(SMIP, 0xb2) // I/O port to triggle SMI
+Name(GPBS, 0x800) // GPIO Register Block address
+Name(GPLN, 0x400) // GPIO Register Block length
+Name(APCB, 0xfec00000) // Default I/O APIC(s) memory start address, 0x0FEC00000 - default, 0 - I/O APIC's disabled
+Name(APCL, 0x1000) // I/O APIC(s) memory decoded range, 0x1000 - default, 0 - I/O APIC's not decoded
+Name(PM30, 0x1830) // SMI Control Register
+Name(SRCB, 0xfed1c000) // RCBA (Root Complex Base Address)
+Name(SRCL, 0x4000) // RCBA length
+Name(HPTB, 0xfed00000) // Same as HPET_BASE_ADDRESS for ASL use
+Name(HPTC, 0xfed1f404) // High Precision Event Timer Configuration Register
+Name(ACPH, 0xde) // North Bridge Scratchpad Data Register for patch ACPI.
+Name(ASSB, 0x0) // ACPI Sleep State Buffer for BIOS Usage.
+Name(AOTB, 0x0) // ACPI OS Type Buffer for BIOS Usage.
+Name(AAXB, 0x0) // ACPI Auxiliary Buffer for BIOS Usage.
+Name(PEHP, 0x1) // _OSC: Pci Express Native Hot Plug Control
+Name(SHPC, 0x1) // _OSC: Standard Hot Plug Controller (SHPC) Native Hot Plug control
+Name(PEPM, 0x1) // _OSC: Pci Express Native Power Management Events control
+Name(PEER, 0x1) // _OSC: Pci Express Advanced Error Reporting control
+Name(PECS, 0x1) // _OSC: Pci Express Capability Structure control
+Name(ITKE, 0x0) // This will be overridden by the ITK module.
+Name(DSSP, 0x0) // ON - Disable SATA Software Setting Preservation feature so that it will not preserve the state after hardware reset. i.e. After a hardware reset HDD will change security state as power-on. OFF - Do not change it in POST, leave it as default (enabled).
+Name(FHPP, 0x0) // Set to 1 to always prompt for HDD password (in AHCI mode).
+Name(FMBL, 0x1) // Platform Flavor - Mobile flavor for ASL code.
+Name(FDTP, 0x2) // Platform Flavor - Desktop flavor for ASL code.
+Name(FUPS, 0x3) // Platform Flavor - UP Server flavor for ASL code.
+Name(FEMD, 0x4) // Platform Flavor - Embedded flavor for ASL code.
+Name(BGR, 0x1) // Haswell - Grays Reef Board ID for ASL code.
+Name(BFR, 0x2) // Haswell - Flathead Rock Board ID for ASL code.
+Name(BBR, 0x3) // Haswell - Basking Ridge Board ID for ASL code.
+Name(BWC, 0x4) // Haswell - Walnut Canyon Board ID for ASL code.
+Name(BGRP, 0x9) // Haswell - Grays Reef PPV Board ID for ASL code.
+Name(BGRC, 0xa) // Haswell - Grays Reef CPV Board ID for ASL code.
+Name(BFRP, 0xb) // Haswell - Flathead Rock PPV Board ID for ASL code.
+Name(BBRP, 0xc) // Haswell - Basking Ridge PPV Board ID for ASL code.
+Name(BRPS, 0x10) // Haswell - STHIPPVRSVD1 Board ID for ASL code.
+Name(BRCS, 0x11) // Haswell - STHICPVRSVD2 Board ID for ASL code.
+Name(BRDS, 0x12) // Haswell - STHIDOERSVD3 Board ID for ASL code.
+Name(BR4S, 0x13) // Haswell - STHIPPVRSVD4 Board ID for ASL code.
+Name(BR5S, 0x14) // Haswell - STHIPPVRSVD5 Board ID for ASL code.
+Name(BWT1, 0x20) // Haswell - WhiteTip Mountain1 Board ID for ASL code.
+Name(BW1P, 0x21) // Haswell - WhiteTip Mountain1 PPV Board ID for ASL code.
+Name(BW2C, 0x22) // Haswell - WhiteTip Mountain2 Board ID for ASL code.
+Name(BW2P, 0x23) // Haswell - WhiteTip Mountain2 PPV Board ID for ASL code.
+Name(BSPC, 0x24) // Haswell - Sawtooth Peak Board ID for ASL code.
+Name(BSPP, 0x25) // Haswell - Sawtooth Peak PPV Board ID for ASL code.
+Name(BTS, 0x26) // Haswell - TopSham Board ID for ASL code.
+Name(BICO, 0x27) // Haswell - WhiteTip Mountain2 CDK Open Chasis Board ID for ASL code.
+Name(BICC, 0x28) // Haswell - WhiteTip Mountain2 CDK Closed Chasis Board ID for ASL code.
+Name(BHB, 0x30) // Haswell - Harris Beach FFRD Board ID for ASL code.
+Name(BFS2, 0x31) // Haswell - FFRD SKU2 Board ID for ASL code.
+Name(BFS3, 0x32) // Haswell - FFRD SKU3 Board ID for ASL code.
+Name(BFS4, 0x33) // Haswell - FFRD SKU4 Board ID for ASL code.
+Name(BRH, 0x35) // Haswell - Reed Harbor TDV Board ID for ASL code.
+
+Name(BFHC, 0x40) // Haswell - Flathead Creek Board ID for ASL code
+Name(BFD1, 0x41) // Haswell - Flathead Creek DOE1 Board ID for ASL code.
+Name(BFD2, 0x42) // Haswell - Flathead Creek DOE2 Board ID for ASL code.
+Name(BFCC, 0x43) // Haswell - Flathead Creek CRB Board ID for ASL code.
+Name(BHCP, 0x44) // Haswell - Haddock Creek Board ID for ASL code.
+Name(BCOC, 0x45) // Haswell - CRB OC Board ID for ASL code.
+Name(BFHP, 0x46) // Haswell - Flathead Creek PPV Board ID for ASL code.
+Name(BFCP, 0x47) // Haswell - Flathead Creek CPV Board ID for ASL code.
+Name(BTDT, 0x50) // BidwellBar - TumaloFalls DT Board ID for ASL code.
+Name(BTMB, 0x51) // BidwellBar - TumaloFalls MB Board ID for ASL code.
+Name(BBGB, 0x52) // Big Creek MB Board ID for ASL code.
+Name(BHC2, 0x53) // Haswell - Haddock Creek Fab2 Board ID for ASL code.
+
+Name(TCGM, 0x1) // Flag to check TCG Module support in platform.asl
+Name(TRTP, 0x1) // PPM IO Trap flag
+Name(WDTE, 0x1) // Flag for WDT enabled/disabled
+Name(TRTD, 0x2) // DTS IO Trap flag
+Name(TRTI, 0x3) // IGD IO Trap flag
+Name(PFTI, 0x4) // PFAT IO Trap flag
+Name(GCDD, 0x1) // SW_SMI_GET_CURRENT_DISPLAY_DEVICE
+Name(DSTA, 0xa) // SW_SMI_DISPLAY_SWITCH_TOGGLE_ACPI
+Name(DSLO, 0xc) // SW_SMI_DISPLAY_SWITCH_LID_OPEN_ACPI
+Name(DSLC, 0xe) // SW_SMI_DISPLAY_SWITCH_LID_CLOSE_ACPI
+Name(PITS, 0x10) // SW_SMI_POPUP_ICON_TOGGLE
+Name(SBCS, 0x12) // SW_SMI_SET_BACKLIGHT_CONTROL
+Name(SALS, 0x13) // SW_SMI_SET_ALI_LEVEL
+Name(LSSS, 0x2a) // SW_SMI_LID_STATE_SWITCH
+Name(SOOT, 0x35) // SW_SMI_SAVE_OSB_OS_TYPE
+Name(PDBR, 0x4d) // SW_SMI_PCIE_DOCK_BRIDGE_RESOURCE_PATCH
+Name(DPPB, 0xfed98000) // Thermal Solution Resource Base Address
+Name(DPPL, 0x8000) // Length of Thermal Solution Resource Base Address
diff --git a/ReferenceCode/AcpiTables/Dsdt/wcam.asl b/ReferenceCode/AcpiTables/Dsdt/wcam.asl
new file mode 100644
index 0000000..8d75b2d
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Dsdt/wcam.asl
@@ -0,0 +1,21 @@
+Device(WCAM)
+{
+ Name(_ADR, 0x05)
+ Method(_UPC, 0, Serialized) {
+ Name(UPCP, Package() { 0x00,0xFF,0x00,0x00 }) // Not connectable, Proprietary connector
+ Return(UPCP)
+ }
+
+ Method(_PLD, 0, Serialized) {
+ Name(PLDP, Package(1)
+ {
+ Buffer(0x14)
+ {
+ 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Revision 2
+ 0x24, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Not visible, Center
+ 0xC8, 0x00, 0xA0, 0x00
+ }
+ })
+ Return (PLDP)
+ }
+} \ No newline at end of file
diff --git a/ReferenceCode/AcpiTables/Protocol/AcpiInfo/AcpiInfo.c b/ReferenceCode/AcpiTables/Protocol/AcpiInfo/AcpiInfo.c
new file mode 100644
index 0000000..615e5cc
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Protocol/AcpiInfo/AcpiInfo.c
@@ -0,0 +1,42 @@
+/** @file
+
+@brief
+ This file defines the Acpi Info Protocol.
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+///
+/// Statements that include other files
+///
+///
+/// External include files do NOT need to be explicitly specified in real EDKII environment
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#endif
+
+#include "AcpiInfo.h"
+
+///
+/// Protocol GUID definition
+///
+EFI_GUID gEfiAcpiInfoProtocolGuid = EFI_ACPI_INFO_PROTOCOL_GUID;
+
+///
+/// Protocol description string
+///
+EFI_GUID_STRING(&gEfiAcpiInfoProtocolGuid, "Acpi Info Protocol", "Acpi Information Protocol");
diff --git a/ReferenceCode/AcpiTables/Protocol/AcpiInfo/AcpiInfo.h b/ReferenceCode/AcpiTables/Protocol/AcpiInfo/AcpiInfo.h
new file mode 100644
index 0000000..9454f7d
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Protocol/AcpiInfo/AcpiInfo.h
@@ -0,0 +1,68 @@
+/** @file
+ This file defines the ACPI Info Protocol.
+
+@copyright
+ Copyright (c) 2012 - 2014 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _ACPI_INFO_H_
+#define _ACPI_INFO_H_
+
+///
+/// Define ACPI INFO protocol GUID (EDK and EDKII have different GUID formats)
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#define EFI_ACPI_INFO_PROTOCOL_GUID \
+ { \
+ 0xfcdc1aa3, 0x1f1e, 0x4d47, 0xbf, 0x61, 0x3c, 0x3b, 0xd2, 0x65, 0x5d, 0x1e \
+ }
+#else
+#define EFI_ACPI_INFO_PROTOCOL_GUID \
+ { \
+ 0xfcdc1aa3, 0x1f1e, 0x4d47, \
+ { \
+ 0xbf, 0x61, 0x3c, 0x3b, 0xd2, 0x65, 0x5d, 0x1e \
+ } \
+ }
+#endif
+
+///
+/// Extern the GUID for protocol users.
+///
+extern EFI_GUID gEfiAcpiInfoProtocolGuid;
+
+//
+// Forward reference for ANSI C compatibility
+//
+typedef struct _EFI_ACPI_INFO_PROTOCOL EFI_ACPI_INFO_PROTOCOL;
+
+///
+/// Protocol revision number
+/// Any backwards compatible changes to this protocol will result in an update in the revision number
+/// Major changes will require publication of a new protocol
+///
+/// Revision 1: Original version
+///
+#define ACPI_INFO_PROTOCOL_REVISION_1 1
+#define ACPI_RC_VERSION 0x01090000
+
+///
+/// Protocol definition
+///
+struct _EFI_ACPI_INFO_PROTOCOL {
+ UINT8 Revision;
+ UINT32 RCVersion;
+};
+
+#endif
diff --git a/ReferenceCode/AcpiTables/Protocol/AcpiPlatformPolicy/AcpiPlatformPolicy.c b/ReferenceCode/AcpiTables/Protocol/AcpiPlatformPolicy/AcpiPlatformPolicy.c
new file mode 100644
index 0000000..8a9b683
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Protocol/AcpiPlatformPolicy/AcpiPlatformPolicy.c
@@ -0,0 +1,38 @@
+/** @file
+
+@brief
+ This file defines the ACPI Policy Protocol.
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+///
+/// Statements that include other files
+///
+#include "EdkIIGlueDxe.h"
+#include "AcpiPlatformPolicy.h"
+
+///
+/// Protocol GUID definition
+///
+EFI_GUID gAcpiPlatformPolicyProtocolGuid = ACPI_PLATFORM_POLICY_PROTOCOL_GUID;
+
+///
+/// Protocol description string
+///
+EFI_GUID_STRING (&gAcpiPlatformPolicyProtocolGuid, "AcpiPlatformPolicy Protocol", "Intel(R) DXE Phase ACPI Platform Policy Protocol");
diff --git a/ReferenceCode/AcpiTables/Protocol/AcpiPlatformPolicy/AcpiPlatformPolicy.h b/ReferenceCode/AcpiTables/Protocol/AcpiPlatformPolicy/AcpiPlatformPolicy.h
new file mode 100644
index 0000000..5dc7727
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Protocol/AcpiPlatformPolicy/AcpiPlatformPolicy.h
@@ -0,0 +1,59 @@
+/** @file
+ Interface definition details between ACPI and platform drivers during DXE phase.
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+#ifndef _ACPI_PLATFORM_POLICY_H_
+#define _ACPI_PLATFORM_POLICY_H_
+
+///
+/// ACPI policy provided by platform for DXE phase
+///
+#define ACPI_PLATFORM_POLICY_PROTOCOL_GUID \
+ { 0xe9a6ca5a, 0x85bc, 0x4840, 0x87, 0x84, 0x94, 0xcf, 0xc9, 0xed, 0x67, 0x66 }
+
+///
+/// Extern the GUID for protocol users.
+///
+extern EFI_GUID gAcpiPlatformPolicyProtocolGuid;
+
+//
+// Forward reference for ANSI C compatibility
+//
+EFI_FORWARD_DECLARATION (ACPI_PLATFORM_POLICY_PROTOCOL);
+
+///
+/// Protocol revision number
+///
+#define ACPI_PLATFORM_POLICY_PROTOCOL_REVISION_1 1
+
+///
+/// ACPI DXE Platform Policy
+///
+struct _ACPI_PLATFORM_POLICY_PROTOCOL {
+ UINT8 Revision;
+ UINT16 BoardId;
+ UINT8 EnableDptf; ///< 0=Disable; 1=Enable; DEFAULT=0
+ UINT8 EnableCppc; ///< 0=Disable; 1=Enable; DEFAULT=0
+ UINT8 EnableCppcPlatformSCI; ///< 0=Disable; 1=Enable; DEFAULT=0
+ UINT8 EnableRtD3; ///< 0=Disable; 1=Enable; DEFAULT=0
+ UINT8 EnableAcpiDebug; ///< 0=Disable; 1=Enable; DEFAULT=0
+};
+
+#endif
diff --git a/ReferenceCode/AcpiTables/Protocol/AcpiProtocolLib.cif b/ReferenceCode/AcpiTables/Protocol/AcpiProtocolLib.cif
new file mode 100644
index 0000000..59b6e4e
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Protocol/AcpiProtocolLib.cif
@@ -0,0 +1,14 @@
+<component>
+ name = "AcpiProtocolLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\AcpiTables\Protocol\"
+ RefName = "AcpiProtocolLib"
+[files]
+"AcpiProtocolLib.sdl"
+"AcpiProtocolLib.mak"
+"AcpiProtocolLib.inf"
+"AcpiInfo\AcpiInfo.c"
+"AcpiInfo\AcpiInfo.h"
+"AcpiPlatformPolicy\AcpiPlatformPolicy.c"
+"AcpiPlatformPolicy\AcpiPlatformPolicy.h"
+<endComponent>
diff --git a/ReferenceCode/AcpiTables/Protocol/AcpiProtocolLib.inf b/ReferenceCode/AcpiTables/Protocol/AcpiProtocolLib.inf
new file mode 100644
index 0000000..a4ed178
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Protocol/AcpiProtocolLib.inf
@@ -0,0 +1,56 @@
+## @file
+# Component description file for Acpi protocol module
+#
+#@copyright
+# Copyright (c) 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains an 'Intel Peripheral Driver' and uniquely
+# identified as "Intel Reference Module" and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+
+
+[defines]
+BASE_NAME = AcpiProtocolLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ AcpiPlatformPolicy/AcpiPlatformPolicy.h
+ AcpiPlatformPolicy/AcpiPlatformPolicy.c
+ AcpiInfo/AcpiInfo.h
+ AcpiInfo/AcpiInfo.c
+
+[includes.common]
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/$(PROJECT_ACPI_ROOT)
+
+#
+# Edk II Glue Library, some header are included by R9 header so have to include
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[libraries.common]
+ EdkFrameworkProtocolLib
+
+[nmake.common]
+C_STD_INCLUDE=
diff --git a/ReferenceCode/AcpiTables/Protocol/AcpiProtocolLib.mak b/ReferenceCode/AcpiTables/Protocol/AcpiProtocolLib.mak
new file mode 100644
index 0000000..5e84a5e
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Protocol/AcpiProtocolLib.mak
@@ -0,0 +1,55 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+#<AMI_FHDR_START>
+#
+# Name: AcpiProtocolLib.mak
+#
+# Description:
+#
+#<AMI_FHDR_END>
+#*************************************************************************
+all : AcpiProtocolLib
+
+$(AcpiProtocolLib_LIB) : AcpiProtocolLib
+
+AcpiProtocolLib : $(BUILD_DIR)\AcpiProtocolLib.mak AcpiProtocolLibBin
+
+$(BUILD_DIR)\AcpiProtocolLib.mak : $(AcpiProtocolLib_DIR)\$(@B).cif $(AcpiProtocolLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(AcpiProtocolLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+AcpiProtocolLib_INCLUDES =\
+ $(EDK_INCLUDES) \
+ $(EdkIIGlueLib_INCLUDES)
+
+AcpiProtocolLibBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\AcpiProtocolLib.mak all\
+ "MY_INCLUDES=$(AcpiProtocolLib_INCLUDES)" \
+ TYPE=LIBRARY
+
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/AcpiTables/Protocol/AcpiProtocolLib.sdl b/ReferenceCode/AcpiTables/Protocol/AcpiProtocolLib.sdl
new file mode 100644
index 0000000..14f9503
--- /dev/null
+++ b/ReferenceCode/AcpiTables/Protocol/AcpiProtocolLib.sdl
@@ -0,0 +1,36 @@
+TOKEN
+ Name = "AcpiProtocolLib_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable AcpiProtocolLib support in Project"
+End
+
+MODULE
+ Help = "Includes AcpiProtocolLib.mak to Project"
+ File = "AcpiProtocolLib.mak"
+End
+
+PATH
+ Name = "AcpiProtocolLib_DIR"
+End
+
+TOKEN
+ Name = "AcpiProtocolLib_LIB"
+ Value = "$(BUILD_DIR)\AcpiProtocolLib.lib"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+ELINK
+ Name = "AcpiProtocolLib_INCLUDES"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "/I$(AcpiProtocolLib_DIR)"
+ Parent = "AcpiProtocolLib_INCLUDES"
+ InvokeOrder = AfterParent
+End \ No newline at end of file
diff --git a/ReferenceCode/AcpiTables/SampleCode/Lpit/LowPowerIdleTable.h b/ReferenceCode/AcpiTables/SampleCode/Lpit/LowPowerIdleTable.h
new file mode 100644
index 0000000..9ef102b
--- /dev/null
+++ b/ReferenceCode/AcpiTables/SampleCode/Lpit/LowPowerIdleTable.h
@@ -0,0 +1,68 @@
+/** @file
+
+This file defines the Low Power Idle Table definition, defined by
+Intel IA-PC LPIT (Low Power Idle Table) Specification draft.
+
+@copyright
+Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+This file contains an 'Intel Peripheral Driver' and is
+licensed for Intel CPUs and chipsets under the terms of your
+license agreement with Intel or your vendor. This file may
+be modified by the user, subject to additional terms of the
+license agreement
+
+**/
+
+#ifndef _LOW_POWER_IDLE_TABLE_H_
+#define _LOW_POWER_IDLE_TABLE_H_
+
+//
+// Include files
+//
+#include "Acpi2_0.h"
+
+//
+// LPIT Definitions
+//
+
+#define EFI_ACPI_LOW_POWER_IDLE_TABLE_REVISION 0x1
+
+//
+// Ensure proper structure formats
+//
+#pragma pack(1)
+
+typedef union _EFI_ACPI_LPI_STATE_FLAGS {
+ struct {
+ UINT32 Disabled :1;
+ UINT32 CounterUnavailable :1;
+ UINT32 Reserved :30;
+ };
+ UINT32 AsUlong;
+} EFI_ACPI_LPI_STATE_FLAGS, *PEFI_ACPI_LPI_STATE_FLAGS;
+
+// Only Mwait LPI here:
+
+typedef struct _EFI_ACPI_MWAIT_LPI_STATE_DESCRIPTOR {
+ UINT32 Type; // offset: 0
+ UINT32 Length; // offset: 4
+ UINT16 UniqueId; // offset: 8
+ UINT8 Reserved[2]; // offset: 10
+ EFI_ACPI_LPI_STATE_FLAGS Flags; // offset: 12
+ EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE EntryTrigger; // offset: 16
+ UINT32 Residency; // offset: 28
+ UINT32 Latency; // offset: 32
+ EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE ResidencyCounter; // offset: 36
+ UINT64 ResidencyCounterFrequency; //offset: 48
+} EFI_ACPI_MWAIT_LPI_STATE_DESCRIPTOR;
+
+#pragma pack()
+
+#endif //_LOW_POWER_IDLE_TABLE_H_
diff --git a/ReferenceCode/AcpiTables/SampleCode/Lpit/lpit.act b/ReferenceCode/AcpiTables/SampleCode/Lpit/lpit.act
new file mode 100644
index 0000000..82849de
--- /dev/null
+++ b/ReferenceCode/AcpiTables/SampleCode/Lpit/lpit.act
@@ -0,0 +1,110 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+ --*/
+/*++
+
+Copyright (c) 2013 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+
+Module Name:
+
+Lpit.act
+
+Abstract:
+
+This file contains a structure definition for the ACPI Low Power Idle Table
+(LPIT). The contents of this file should only be modified
+for bug fixes, no porting is required. The table layout is defined in
+LowPowerIdleTable.h and the table contents are defined in Lpit.h.
+
+--*/
+
+ //
+ // Statements that include other files
+ //
+
+#include "Lpit.h"
+
+ //
+ // Low Power Idle Table
+ // Please modify all values in Lpit.h only.
+ //
+
+EFI_ACPI_LOW_POWER_IDLE_TABLE Lpit = {
+
+ //
+ // Header
+ //
+
+
+ EFI_ACPI_LOW_POWER_IDLE_TABLE_SIGNATURE,
+ sizeof (EFI_ACPI_LOW_POWER_IDLE_TABLE),
+ EFI_ACPI_LOW_POWER_IDLE_TABLE_REVISION ,
+
+ //
+ // Checksum will be updated at runtime
+ //
+ 0x00,
+
+ //
+ // It is expected that these values will be updated at runtime
+ //
+ 'A', 'L', 'A', 'S', 'K', 'A',
+
+ 0,
+ EFI_ACPI_OEM_LPIT_REVISION,
+ EFI_ACPI_CREATER_ID,
+ EFI_ACPI_CREATER_REVISION,
+
+
+
+ //
+ // Descriptor
+ //
+ {
+ {
+ EFI_ACPI_LOW_POWER_IDLE_MWAIT_TYPE,
+ sizeof(EFI_ACPI_MWAIT_LPI_STATE_DESCRIPTOR),
+ EFI_ACPI_HSW_LPI_AUDIO_ID,
+ {0,0},
+ {EFI_ACPI_LOW_POWER_IDLE_DEFAULT_FLAG}, // Flags
+ EFI_ACPI_HSW_LPI_TRIGGER, //EntryTrigger
+ EFI_ACPI_HSW_LPI_MIN_RES, //Residency
+ EFI_ACPI_HSW_LPI_LATENCY, //Latency
+ EFI_ACPI_HSW_LPI_RES_COUNTER, //ResidencyCounter
+ EFI_ACPI_LOW_POWER_IDLE_RES_FREQ_TSC //Residency counter frequency
+ },
+ {
+ EFI_ACPI_LOW_POWER_IDLE_MWAIT_TYPE,
+ sizeof(EFI_ACPI_MWAIT_LPI_STATE_DESCRIPTOR),
+ EFI_ACPI_HSW_LPI_CS_ID,
+ {0,0},
+ {EFI_ACPI_LOW_POWER_IDLE_DEFAULT_FLAG}, // Flags
+ EFI_ACPI_HSW_LPI_TRIGGER, //EntryTrigger
+ EFI_ACPI_HSW_LPI_MIN_RES, //Residency
+ EFI_ACPI_HSW_LPI_LATENCY, //Latency
+ EFI_ACPI_HSW_LPI_RES_COUNTER, //ResidencyCounter
+ EFI_ACPI_LOW_POWER_IDLE_RES_FREQ_TSC //Residency counter frequency
+ }
+ }
+
+};
+
+VOID
+main (
+ VOID
+ )
+
+{
+} \ No newline at end of file
diff --git a/ReferenceCode/AcpiTables/SampleCode/Lpit/lpit.cif b/ReferenceCode/AcpiTables/SampleCode/Lpit/lpit.cif
new file mode 100644
index 0000000..b9f6d91
--- /dev/null
+++ b/ReferenceCode/AcpiTables/SampleCode/Lpit/lpit.cif
@@ -0,0 +1,12 @@
+<component>
+ name = "lpit"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\AcpiTables\SampleCode\Lpit\"
+ RefName = "lpit"
+[files]
+"LowPowerIdleTable.h"
+"lpit.act"
+"lpit.h"
+"lpit.mak"
+"lpit.sdl"
+<endComponent>
diff --git a/ReferenceCode/AcpiTables/SampleCode/Lpit/lpit.h b/ReferenceCode/AcpiTables/SampleCode/Lpit/lpit.h
new file mode 100644
index 0000000..17e6eed
--- /dev/null
+++ b/ReferenceCode/AcpiTables/SampleCode/Lpit/lpit.h
@@ -0,0 +1,114 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+ --*/
+/*++
+
+Copyright (c) 2013 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+
+Module Name:
+
+Lpit.h
+
+Abstract:
+
+This file describes the contents of the ACPI Low Power Idle Table (LPIT).
+All changes to the LPIT contents should be done in this file.
+
+
+
+--*/
+
+#ifndef _LPIT_H_
+#define _LPIT_H_
+
+//
+// Statements that include other files
+//
+
+#include "LowPowerIdleTable.h"
+
+//
+// Defines for LPIT table, some are HSW ULT specific
+//
+
+
+// signature "LPIT"
+#define EFI_ACPI_LOW_POWER_IDLE_TABLE_SIGNATURE 0x5449504c
+
+#define EFI_ACPI_OEM_LPIT_REVISION 0x00000000
+#define EFI_ACPI_CREATER_ID 0x2e494d41 //"AMI."
+#define EFI_ACPI_CREATER_REVISION 0x5
+#define EFI_ACPI_LOW_POWER_IDLE_MWAIT_TYPE 0x0
+#define EFI_ACPI_LOW_POWER_IDLE_DEFAULT_FLAG 0x0
+#define EFI_ACPI_LOW_POWER_IDLE_NO_RES_COUNTER_FLAG 0x2
+#define EFI_ACPI_LOW_POWER_IDLE_RES_FREQ_TSC 0x0
+
+//
+// LPI state count (only 1 on HSW ULT)
+//
+
+#define EFI_ACPI_HSW_LPI_STATE_COUNT 2
+
+//
+// LPI TRIGGER (HW C10 on HSW ULT)
+//
+#define EFI_ACPI_HSW_LPI_TRIGGER {0x7F,0x1,0x2,0x0,0x60}
+
+//
+// LPI residency counter (HW C10 on HSW ULT)
+//
+#define EFI_ACPI_HSW_LPI_RES_COUNTER {0x7F,64,0x0,0x0,0x632}
+
+//
+// LPI DUMMY COUNTER
+//
+#define EFI_ACPI_HSW_DUMMY_RES_COUNTER {0x0,0,0x0,0x0,0x0}
+
+
+//
+// LPI break-even residency in us (HW C10 on HSW ULT)
+//
+#define EFI_ACPI_HSW_LPI_MIN_RES 30000
+
+//
+// LPI latency in us (HW C10 on HSW ULT)
+//
+#define EFI_ACPI_HSW_LPI_LATENCY 3000
+
+//
+// LPI ID (HW C10 on HSW ULT)
+//
+#define EFI_ACPI_HSW_LPI_AUDIO_ID 0
+
+//
+// LPI ID (HW C10 on HSW ULT)
+//
+#define EFI_ACPI_HSW_LPI_CS_ID 1
+
+//
+// LPI ACPI table header
+//
+
+#pragma pack(1)
+
+typedef struct _EFI_ACPI_LOW_POWER_IDLE_TABLE {
+ EFI_ACPI_DESCRIPTION_HEADER Header;
+ EFI_ACPI_MWAIT_LPI_STATE_DESCRIPTOR LpiStates[EFI_ACPI_HSW_LPI_STATE_COUNT];
+} EFI_ACPI_LOW_POWER_IDLE_TABLE;
+
+#pragma pack()
+
+
+#endif //_LPIT_H_
diff --git a/ReferenceCode/AcpiTables/SampleCode/Lpit/lpit.mak b/ReferenceCode/AcpiTables/SampleCode/Lpit/lpit.mak
new file mode 100644
index 0000000..5c78da2
--- /dev/null
+++ b/ReferenceCode/AcpiTables/SampleCode/Lpit/lpit.mak
@@ -0,0 +1,75 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2013, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+#<AMI_FHDR_START>
+#
+# Name: lpit.mak
+#
+# Description: MAke file to build Aptio ACPI ASL components
+#
+#
+#<AMI_FHDR_END>
+#*************************************************************************
+all : Lpit
+
+Lpit : $(BUILD_DIR)\Lpit.ffS
+
+Lpit_Includes = \
+ $(EDK_INCLUDES)\
+
+Lpit_Defines = \
+ /D"TIANO_RELEASE_VERSION=0x00080006"\
+
+Lpit_ACPIS = \
+ $(BUILD_DIR)\Lpit.acpi\
+
+$(BUILD_DIR)\Lpit.asl: $(BUILD_DIR)\token.mak $(LPIT_DIR)\lpit.mak
+ copy << $@
+<<
+
+$(BUILD_DIR)\Lpit.exe : $(LPIT_DIR)\lpit.act $(LPIT_DIR)\lpit.h
+ @CL $(CFLAGS) $(Lpit_Defines) /Fo$(BUILD_DIR)\ $(Lpit_Includes) /TC $(LPIT_DIR)\lpit.act
+ @Link /OUT:$(BUILD_DIR)\Lpit.exe /NODEFAULTLIB /ENTRY:main $(BUILD_DIR)\Lpit.obj
+
+$(BUILD_DIR)\Lpit.acpi : $(BUILD_DIR)\Lpit.exe
+ $(GENACPI) $(BUILD_DIR)\Lpit.exe $(BUILD_DIR)\Lpit.acpi
+
+$(BUILD_DIR)\Lpit.sec : $(Lpit_ACPIS)
+ $(GENSECTION) -I $** -O $@ -S EFI_SECTION_RAW
+
+$(BUILD_DIR)\Lpit.ffs: $(BUILD_DIR)\Lpit.sec $(LPIT_DIR)\lpit.mak
+ $(MAKE) /f Core\FFS.mak \
+ BUILD_DIR=$(BUILD_DIR) \
+ GUID=9DD795EB-41E8-4591-8E63-5EF4AA33B908\
+ TYPE=EFI_FV_FILETYPE_FREEFORM \
+ FFS_CHECKSUM=1\
+ RAWFILE=$(BUILD_DIR)\Lpit.sec FFSFILE=$(BUILD_DIR)\Lpit.ffs COMPRESS=0 NAME=Lpit
+
+
+
+
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/AcpiTables/SampleCode/Lpit/lpit.sdl b/ReferenceCode/AcpiTables/SampleCode/Lpit/lpit.sdl
new file mode 100644
index 0000000..188ddd8
--- /dev/null
+++ b/ReferenceCode/AcpiTables/SampleCode/Lpit/lpit.sdl
@@ -0,0 +1,38 @@
+TOKEN
+ Name = "LPIT_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable LPIT support in Project"
+ TokenType = Boolean
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "LPIT_DIR"
+End
+
+MODULE
+ Help = "Includes LPIT.mak to Project"
+ File = "lpit.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\Lpit.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\Lpit.asl"
+ Parent = "GENERIC_ASL"
+ InvokeOrder = AfterParent
+End
+
+TOKEN
+ Name = "LPIT_GUID"
+ Value = "{0x9dd795eb, 0x41e8, 0x4591, 0x8e, 0x63, 0x5e, 0xf4, 0xaa, 0x33, 0xb9, 0x8}"
+ Help = "lpit Acpi Package"
+ TokenType = Expression
+ TargetH = Yes
+End \ No newline at end of file
diff --git a/ReferenceCode/AcpiTables/SampleCode/SsdtRtd3/BRRtd3.asl b/ReferenceCode/AcpiTables/SampleCode/SsdtRtd3/BRRtd3.asl
new file mode 100644
index 0000000..fd364d6
--- /dev/null
+++ b/ReferenceCode/AcpiTables/SampleCode/SsdtRtd3/BRRtd3.asl
@@ -0,0 +1,1250 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Sandy Bridge *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+
+DefinitionBlock (
+ "Rtd3.aml",
+ "SSDT",
+ 1,
+ "AcpiRef",
+ "BR0_Rtd3",
+ 0x1000
+ )
+{
+#define BRRTD3 1
+Include("RTD3Common.asl")
+#undef BRRTD3
+
+External(BBR, IntObj) // BaskinRidge
+External(BWC, IntObj) // Walnut Canyon
+External(\_SB.PCI0.EHC2.HUBN.PR01.PR11, DeviceObj)
+External(\_SB.PCI0.EHC2.HUBN.PR01.PR12, DeviceObj)
+External(\_SB.PCI0.LPCB.GR19)
+External(\_SB.PCI0.LPCB.GR0B)
+External(\RT14)
+External(\RT16)
+External(\RT17)
+External(\RT32)
+External(\RT35)
+External(\GL01)
+External(\GIV1)
+External(\GL00)
+External(\GL04)
+External(\GL05)
+External(\GL06)
+External(\GL08)
+External(\SS11)
+External(\SE11)
+External(\SS13)
+External(\SE13)
+External(PFLV)
+External(FDTP)
+
+
+If(LOr(LAnd(LEqual(BID,BBR),LEqual(RTD3,1)),LAnd(LEqual(BID,BWC),LEqual(RTD3,1)))) {
+
+
+//
+// PCIe RTD3 - for slot#3
+//
+
+Scope (\_SB.PCI0.RP03)
+{
+ Name(WC, 0)
+}
+
+Scope (\_SB.PCI0.RP03)
+{
+ Name(_PR0, Package(){PXP3})
+ Name(_PR3, Package(){PXP3})
+ Name(WKEN, 0)
+
+ Method(_S0W, 0)
+ { // PMEs can be generated from D3cold
+ If(And(\_SB.OSCO, 0x04))
+ { // OS comprehends D3cold, as described via \_SB._OSC
+ Return(4)
+ } Else {
+ Return(3)
+ }
+ } // End _S0W
+
+ Method(_DSW, 3)
+ {
+ If(Arg1)
+ { // Entering Sx, need to disable WAKE# from generating runtime PME
+ Store(0, WKEN)
+ } Else { // Staying in S0
+ If(LAnd(Arg0, Arg2)) // Exiting D0 and arming for wake
+ { // Set PME
+ Store(1, WKEN)
+ } Else { // Disable runtime PME, either because staying in D0 or disabling wake
+ Store(0, WKEN)
+ }
+ }
+ } // End _DSW
+
+
+ // Define a power resource for PCIe RP3 D0-D3hot
+ PowerResource(PXP3, 0, 0)
+ {
+ Name(OFFC, 0) // _OFF Counter
+ Name(ONC, 0) // _ON Counter
+ Name(PWRS, 0xFF) // current power status
+
+ Method(_STA, 0)
+ {
+ If(LAnd(NAnd(GL00, 0x40), And(GL06, 0x80))){
+ Return (1)
+ } Else {
+ Return (0)
+ }
+
+ }
+ Method(_ON) // Turn on core power to PCIe Slot3
+ {
+ Increment(ONC)
+ //Power ON for Slot3
+ And(\GL00, 0x0BF, \GL00)
+ Sleep(PEP0) // Sleep for programmable delay
+ Store(1, PWRS)
+ Or(\GL06, 0x80, \GL06)
+ }
+
+ Method(_OFF) // Turn off core power to PCIe Slot1
+ {
+ Increment(OFFC)
+ //Power OFF for Slot3
+ And(\GL06, 0x7F, \GL06)
+ Or(\GL00, 0x40, \GL00)
+ Store(1, \_SB.PCI0.RP03.LDIS) //Not required as power not removed at this time
+ Store(0, \_SB.PCI0.RP03.LDIS) //toggle link disable
+
+ If(\_SB.PCI0.RP03.WKEN) {
+ Store(0, PWRS)
+ }
+ }
+ } // End PXP3
+} // End RP03
+/*
+Scope(\_SB.PCI0.RP03.PXSX)
+{ // PCIe Device beneath RP03
+ Method(_S0W, 0)
+ { // PMEs can be generated from D3cold
+ If(And(\_SB.OSCO, 0x04))
+ { // OS comprehends D3cold, as described via \_SB._OSC
+ Return(4)
+ } Else {
+ Return(3)
+ }
+ } // End _S0W
+} // End PXSX
+*/
+//
+// PCIe RTD3 - for slot#4
+//
+Scope (\_SB.PCI0.RP04)
+{
+ Name(_PR0, Package(){PXP4})
+ Name(_PR3, Package(){PXP4})
+ Name(WKEN, 0)
+
+ Method(_S0W, 0)
+ { // PMEs can be generated from D3cold
+ If(And(\_SB.OSCO, 0x04))
+ { // OS comprehends D3cold, as described via \_SB._OSC
+ Return(4)
+ } Else {
+ Return(3)
+ }
+ } // End _S0W
+
+ Method(_DSW, 3)
+ {
+ If(Arg1)
+ { // Entering Sx, need to disable WAKE# from generating runtime PME
+ Store(0, WKEN)
+ } Else { // Staying in S0
+ If(LAnd(Arg0, Arg2)) // Exiting D0 and arming for wake
+ { // Set PME
+ Store(1, WKEN)
+ } Else { // Disable runtime PME, either because staying in D0 or disabling wake
+ Store(0, WKEN)
+ }
+ }
+ } // End _DSW
+
+
+ // Define a power resource for PCIe RP4 D0-D3hot
+ PowerResource(PXP4, 0, 0)
+ {
+ Name(OFFC, 0) // _OFF Counter
+ Name(ONC, 0) // _ON Counter
+ Name(PWRS, 0xFF) // current power status
+
+ Method(_STA, 0)
+ {
+ If(LAnd(NAnd(RT16, 1), And(RT17, 1))){
+ Return (1) //
+ } else {
+ Return (0)
+ }
+ }
+ Method(_ON) // Turn on core power to PCIe Slot4
+ {
+ Increment(ONC)
+ //Power ON for Slot4
+ And(\RT16, 0x0, \RT16) //Apply power
+ Sleep(PEP0) // Sleep for programmable delay
+ Or(\RT17, 0x1, \RT17) //De-assert PERST#
+ Store(1, PWRS)
+ }
+
+ Method(_OFF) // Turn off core power to PCIe Slot1
+ {
+ Increment(OFFC)
+ //Power OFF for Slot4
+ And(\RT17, 0x0, \RT17)
+ Or(\RT16, 0x1, \RT16)
+ Store(1, \_SB.PCI0.RP04.LDIS)
+ Store(0, \_SB.PCI0.RP04.LDIS) //toggle link disable
+
+ If(\_SB.PCI0.RP04.WKEN) {
+ Store(0, PWRS)
+ Store(1, \SS11) //Clear SMI status
+ Store(1, \SE11) //Enable SMI
+ }
+ }
+ } // End PXP4
+
+} // End RP04
+/*
+Scope(\_SB.PCI0.RP04.PXSX)
+{ // PCIe Device beneath RP04
+ Method(_S0W, 0)
+ { // PMEs can be generated from D3cold
+ If(And(\_SB.OSCO, 0x04))
+ { // OS comprehends D3cold, as described via \_SB._OSC
+ Return(4)
+ } Else {
+ Return(3)
+ }
+ } // End _S0W
+} // End PXSX
+*/
+
+//
+// PCIe RTD3 - for slot#5
+//
+Scope (\_SB.PCI0.RP05)
+{
+ Name(_PR0, Package(){PXP5})
+ Name(_PR3, Package(){PXP5})
+ Name(WKEN, 0)
+
+ Method(_S0W, 0)
+ { // PMEs can be generated from D3cold
+ If(And(\_SB.OSCO, 0x04))
+ { // OS comprehends D3cold, as described via \_SB._OSC
+ Return(4)
+ } Else {
+ Return(3)
+ }
+ } // End _S0W
+
+ Method(_DSW, 3)
+ {
+ If(Arg1)
+ { // Entering Sx, need to disable WAKE# from generating runtime PME
+ Store(0, WKEN)
+ } Else { // Staying in S0
+ If(LAnd(Arg0, Arg2)) // Exiting D0 and arming for wake
+ { // Set PME
+ Store(1, WKEN)
+ } Else { // Disable runtime PME, either because staying in D0 or disabling wake
+ Store(0, WKEN)
+ }
+ }
+ } // End _DSW
+
+
+ // Define a power resource for PCIe RP5 D0-D3hot
+ PowerResource(PXP5, 0, 0)
+ {
+ Name(OFFC, 0) // _OFF Counter
+ Name(ONC, 0) // _ON Counter
+ Name(PWRS, 0xFF) // current power status
+
+ Method(_STA, 0)
+ {
+ If(LAnd(NAnd(RT32, 1), And(RT35, 1))){
+ Return (1)
+ } else {
+ Return (0)
+ }
+
+ }
+ Method(_ON) // Turn on core power to PCIe Slot1
+ {
+ P8XH(0,0x11)
+ P8XH(1,0x50)
+ Increment(ONC)
+ //Power ON for Slot5
+ And(\RT32, 0x0, \RT32)
+ Store(1, PWRS)
+ Sleep(PEP0) // Sleep for programmable delay
+ Or(\RT35, 0x1, \RT35)
+ }
+
+ Method(_OFF) // Turn off core power to PCIe Slot5
+ {
+ Increment(OFFC)
+ //Power OFF for Slot5
+ And(\RT35, 0x0, \RT35)
+ Or(\RT32, 0x1, \RT32)
+
+ Store(1, \_SB.PCI0.RP05.LDIS)
+ Store(0, \_SB.PCI0.RP05.LDIS) //toggle link disable
+ Store(0, PWRS)
+ Sleep(PEP3) // user selectable delay
+ If(\_SB.PCI0.RP05.WKEN) {
+ Store(1, \SS13) //Clear SMI status
+ Store(1, \SE13) //Enable SMI
+ }
+ }
+ } // End PXP5
+
+} // End RP05
+/* For Debug
+Scope(\_SB.PCI0.RP05.PXSX)
+{ // PCIe Device beneath RP05
+ Method(_S0W, 0)
+ { // PMEs can be generated from D3cold
+ If(And(\_SB.OSCO, 0x04))
+ { // OS comprehends D3cold, as described via \_SB._OSC
+ Return(4)
+ } Else {
+ Return(3)
+ }
+ } // End _S0W
+} // End PXSX
+*/
+
+//
+// GPE Event Handler
+//
+
+Scope(\_GPE) {
+ //
+ // GPIO19 routed to GPE0b[25] => 32+25 = 57(0x39) = PCIE slot 3 wake event
+ //
+
+ Method(_L39) {
+ // PCIe WAKE#
+ Increment(\_SB.PCI0.RP03.WC)
+ If(\_SB.PCI0.RP03.WKEN){
+ Store(0, \_SB.PCI0.LPCB.GR19) //Mask SCI - to stop SCI flooding
+ Notify(\_SB.PCI0.RP03, 0x02) // DeviceWake
+ }
+ }
+
+ //
+ // GPI03 = SMSC 1007 nIO_SMI routed to PCH GPIO 3
+ //
+ Method(_L13) {
+ /*
+ If(LAnd(\_SB.PCI0.RP04.WKEN, SS11)){
+ Store(0, SE11)
+ Store(1, SS11)
+ Notify(\_SB.PCI0.RP04, 0x02) // DeviceWake
+ }
+ If(LAnd(\_SB.PCI0.RP05.WKEN, SS13)){
+ Store(0, SE13)
+ Store(1, SS13)
+ Notify(\_SB.PCI0.RP05, 0x02) // DeviceWake
+ }
+ */
+ }
+ //
+ // GPIO11 - ZPODD DA
+ //
+ Method(_L1B){
+ //
+ // Do nothing if Desktop platform
+ //
+ If(LEqual(PFLV,FDTP)) {
+ Return ()
+ }
+
+ //
+ // Toggle GPI invert
+ //
+ If(LEqual(And(\GL01, 0x08),0x08)) { // GPI11 is high
+ Or(\GIV1, 0x08, \GIV1) //GP_INV should be set to trigger low
+ }Else {
+ And(\GIV1, 0xF7, \GIV1) //GP_INV should be set to trigger high
+ }
+
+ // Only do this if ZPODD not under _DSM control
+ If(LEqual(\_SB.PCI0.SAT0.UDSM, Zero)) {
+ //
+ // Notify OSPM
+ //
+ //If(WKEN) { // _DSW called to enable ODD to generate a wake event
+ //send notification for Port 2
+ Notify(\_SB.PCI0.SAT0.PRT2, 2) // Device Wake to Device (Windows)
+ //}
+ } Else {
+
+ // Drive GPIO68 to High to power on device.
+ //
+ Or(\GL08, 0x10, \GL08)
+ //
+ // Notify the OSPM
+ //
+ Notify(\_SB.PCI0.SAT0, 0x82)
+ } // \_SB.PCI0.SAT0.UDSM
+ Return ()
+ }
+}
+
+//
+// AHCI RTD3
+//
+Scope(\_SB.PCI0.SAT0) {
+ //
+ // _DSM Device Specific Method supporting AHCI LPM/DEVSLP
+ //
+ // Arg0: UUID Unique function identifier
+ // Arg1: Integer Revision Level
+ // Arg2: Integer Function Index
+ // Arg3: Package Parameters
+ //
+ Name(DRV, 0) // Storage for _DSM Arg3 parameter 0
+ Name(PWR, 0) // Storage for _DSM Arg3 parameter 1
+ Name(UDSM, 0) // Use _DSM for ZPODD control. 0 = Disabled; 1 = Enabled
+
+ Method (_DSM, 4, Serialized, 0, UnknownObj, {BuffObj, IntObj, IntObj, PkgObj}) {
+ If (LEqual(Arg0, ToUUID ("E4DB149B-FCFE-425b-A6D8-92357D78FC7F"))) {
+ //
+ // Switch by function index
+ //
+ Switch (Arg2) {
+ Case (0) {
+ // Standard query - A bitmask of functions supported
+ // Supports function 0-3
+ Name(RBUF, Buffer(1){0x00})
+ CreateByteField (RBUF, 0, SFUN)
+ Store (0x0F, SFUN)
+ Return (RBUF)
+ }
+ Case (1) {
+ // Query Device IDs (Addresses) of children where drive power and/or PHYSLP are supported
+ //Return (Package(){0x0000FFFF, 0x0001FFFF, 0x0002FFFF}) //Debug - All Ports supports Link control
+ Return (Package(){0x0000FFFF}) //Only Port0 in MintSpring supports Link control
+
+ }
+ //
+ // Control power to device.
+ //
+ Case (2) {
+ Store(ToInteger(DerefOf(Index(Arg3, Zero))), DRV)
+ Store(ToInteger(DerefOf(Index(Arg3, One))), PWR)
+
+ Switch(DRV){
+ Case (0x0000FFFF){
+ If(PWR){ // Applying Power
+ // Turn on drive and link power to drive at Port 0
+ Store(1, RT14) // De assert physlp -> Link ON, LED ON
+ ^PRT0.P0PR._ON()
+ } Else { // Remove Link Power
+ Store(0, RT14) // Assert physlp -> Link OFF, LED OFF
+ }
+ }
+ //We don't have Link power control in Mintspring. so the code below can be removed.
+ Case (0x0001FFFF){
+ If(PWR){ // Applying Power
+ // Turn on drive and link power to drive at Port 1
+ \_SB.PCI0.SAT0.PRT1.P1PR._ON()
+ } Else { // Remove Link Power
+ NoOp // No link power control on these ports.
+ }
+ }
+ Case (0x0002FFFF){
+ // Turn on drive and link power to drive at Port 2
+ If(PWR){ // Applying Power
+ // Turn on drive and link power to drive at Port 2
+ //^PRT2.P2PR._ON()
+ } Else { // Remove Link Power
+ NoOp // No link power control on these ports
+ }
+ }
+ Case (Ones){
+ // Turn on drive and link power to all drives
+ If(PWR){ // Applying Power
+ Store(1, RT14) // De assert physlp -> Link ON, LED ON (Link might be disabled)
+ ^PRT0.P0PR._ON()
+ \_SB.PCI0.SAT0.PRT1.P1PR._ON()
+ ^PRT2.P2PR._ON()
+ }
+ }
+ }
+ Return (0)
+ }
+ //
+ // Current status of Device/Link of Port
+ //
+ Case (3){
+ Store(ToInteger(DerefOf(Index(Arg3, Zero))), DRV)
+ Switch(DRV){
+ Case (0x0000FFFF){
+ Store(ShiftRight(NAnd(GL04, 0x04), 2), Local0) // Bit0 => Device power state
+ If(LEqual(RT14,1)){ //If Link ON
+ Or(Local0, 2, Local0) //Bit1 => Link power state
+ }
+ Return (Local0)
+ }
+
+ Case (0x0001FFFF){
+ Store(ShiftRight(NAnd(GL04, 0x08), 2), Local0) // Bit0 => Device power state
+ Or(Local0, 2, Local0) //Bit1 => Link power state
+ Return (Local0)
+ }
+
+ Case (0x0002FFFF){
+ Store(ShiftRight(And(GL08, 0x010), 2), Local0) // Bit0 => Device power state
+ Or(Local0, 2, Local0) //Bit1 => Link power state
+ Return (Local0)
+ }
+
+ Default {
+ Return (Ones)
+ }
+ }
+ }
+ Default {
+ Return (0)
+ }
+ } //Switch (Arg2)
+ } Else {
+ Return (0)
+ }
+ }
+
+ // D0 Method for SATA HBA(for debug)
+ Method(_PS0,0,Serialized)
+ {
+ }
+
+ // D3 Method for SATA HBA(for debug)
+ Method(_PS3,0,Serialized)
+ {
+ }
+
+ Scope(PRT0) {
+ Name(_PR0, Package(){P0PR})
+ Name(_PR3, Package(){P0PR})
+
+
+ PowerResource(P0PR, 0, 0){ // SATA_PWR_EN#0 is PCH GPIO34
+ Method(_STA){
+ If(And(GL04, 0x04)) {
+ Return(0x00)
+ } Else {
+ Return(0x01)
+ }
+ }
+
+ Method(_ON, 0)
+ { // Turn on the PFET
+ And(GL04, 0xfb, GL04)
+ // Delay for power ramp
+ Sleep(16)
+ }
+
+ Method(_OFF, 0)
+ { // Turn off the PFET
+ // TODO: when removing power, need to ensure DEVSLP is either deasserted or reverts to an input
+ //(safer, no need to keep track if it was asserted before)
+ Store(1, RT14) // De assert physlp -> Link ON, LED ON
+ Or(GL04, 0x04, GL04)
+ }
+ } // End P0PR
+ } // End PRT0
+
+ Scope(PRT1) {
+
+ Name(_PR0, Package(){P1PR})
+ Name(_PR3, Package(){P1PR})
+
+
+ PowerResource(P1PR, 0, 0){ // SATA_PWR_EN#0 is PCH GPIO35 on Emerald Lake
+ Method(_STA){
+// Or(GU04, 8, GU04) // GPIO init code incorrect- make this GPIO non-native
+ If(And(GL04, 0x08)) {
+ Return(0x00)
+ } Else {
+ Return(0x01)
+ }
+ }
+
+ Method(_ON, 0)
+ { // Turn on the PFET
+ And(GL04, 0xf7, GL04)
+ // Delay for power ramp
+ Sleep(16)
+ }
+
+ Method(_OFF, 0)
+ { // Turn off the PFET
+ Or(GL04, 8, GL04)
+ }
+ } // End P1PR
+ } //End PRT1
+
+ Scope(PRT2) { // Port 2- Cable Connect power
+ //
+ // _DSM Device Specific Method supporting SATA ZPODD function
+ //
+ // Arg0: UUID Unique function identifier
+ // Arg1: Integer Revision Level
+ // Arg2: Integer Function Index
+ // Arg3: Package Parameters
+ //
+ Method (_DSM, 4, NotSerialized, 0, UnknownObj, {BuffObj, IntObj, IntObj, PkgObj}) {
+ If (LEqual(Arg0, ToUUID ("bdfaef30-aebb-11de-8a39-0800200c9a66"))) {
+ //
+ // Switch by function index
+ //
+ Switch (ToInteger(Arg2)) {
+ //
+ // Standard query - A bitmask of functions supported
+ // Supports function 0-5
+ //
+ Case (0) {
+ switch(ToInteger(Arg1)) {
+ case(1) {
+ //
+ // Return - 0 (No Functions supported) for Desktop Platforms
+ //
+ If(LEqual(PFLV,FDTP)) {
+ Return (Buffer () {0})
+ }
+ Return (Buffer () {0xF})
+ }
+ Default {Return (Buffer () {0})}
+ }
+ }
+ //
+ // Enable ZPODD feature
+ //
+ Case (1) {
+ //
+ // Enable Power ON/OFF
+ //
+ // Function 1: Enable Power OFF/ON. Enables the Power Off/ON hardware in the system.
+ // When called, the BIOS is informed that the host software is using this interface.
+ If(LEqual(\_SB.PCI0.SAT0.UDSM, Zero)){ //if Ownership not acquired
+ Store (1, \_SB.PCI0.SAT0.UDSM) // Indicate ZPODD _DSM control enabled
+ }
+ Store(2, \_SB.PCI0.LPCB.GR0B) // Enable SCI (for ZPODD wake) in LPC register
+ Return (1)
+ }
+ //
+ // Power Off Device
+ //
+ Case (2) {
+ //
+ // Drive GPIO68 to low to power off device.
+ //
+ And(\GL08, 0xEF, \GL08)
+ Return (1)
+ }
+ //
+ // Power ON Device
+ //
+ Case (3) {
+ Or(\GL08, 0x10, \GL08)
+ Sleep(16) // To turn the FET
+ Return (1)
+ }
+ Default {
+ Return (0)
+ }
+ }
+ } Else {
+ Return (0)
+ }
+ }
+ Name(_PR0, Package(){P2PR})
+ Name(_PR3, Package(){P2PR})
+
+ Name(WKEN, 0) // Device on this port wake enabled?
+
+ Method(_S0W, 0)
+ { // PMEs can be generated from D3cold
+ Store(2, \_SB.PCI0.LPCB.GR0B) // Enable SCI (for ZPODD wake) in LPC register
+ If(And(\_SB.OSCO, 0x04))
+ { // OS comprehends D3cold, as described via \_SB._OSC
+ Return(4)
+ } Else {
+ Return(3)
+ }
+ } // End _S0W
+
+ Method(_DSW, 3)
+ {
+ If(Arg1)
+ { // Entering Sx, need to disable DA from generating runtime PME
+ Store(0, WKEN)
+ } Else { // Staying in S0
+ If(LAnd(Arg0, Arg2)) // Exiting D0 and arming for wake
+ { // Set WKEN to allow _OFF to enable the wake event
+ Store(1, WKEN)
+ } Else { // Clear WKEN to allow _OFF to enable the wake event,
+ // either because staying in D0 or disabling wake
+ Store(0, WKEN)
+ }
+ }
+ } // End _DSW
+
+ Method(_PRW, 0) { Return(GPRW(0x13, 4)) } // can wakeup from S4 state
+
+ PowerResource(P2PR, 0, 0){
+ Name(_STA, 0x01)
+
+ Method(_ON, 0)
+ {
+ Store(0x01, _STA)
+ Or(GL08, 0x10, GL08)
+ Sleep(16) // To turn the FET
+ }
+
+ Method(_OFF, 0)
+ {
+ //
+ // Drive GPIO68 to low to power off device.
+ //
+ And(GL08, 0xEF, GL08)
+ Store(0, _STA)
+ }
+ } // End P2PR
+ } //End PRT2
+
+ PowerResource(V0PR, 0, 0)
+ { // Power Resource Aggregate for RAID volume 0
+ Name(_STA, 0x01)
+ Name(PMAP, 0)
+
+ Method(_ON, 0)
+ { // Turn on the PFET
+ If(Not(_STA)){
+ Store(0x01, _STA)
+ If(And(PMAP, 0x01))
+ { // Turn On Port 0 Power
+ And(GL04, 0xfb, GL04)
+ }
+ If(And(PMAP, 0x02))
+ { // Turn On Port 1 Power
+ And(GL04, 0xf7, GL04)
+ }
+ If(And(PMAP, 0x04))
+ { // Turn On Port 2 Power
+ Or(GL08, 0x10, GL08)
+ }
+ // Delay for power ramp
+ Sleep(16)
+ }
+ }
+
+ Method(_OFF, 0)
+ { // Turn off the PFET
+ If(_STA){
+ Store(0x01, _STA)
+ If(And(PMAP, 1))
+ { // Turn Off Port 0 Power
+ Or(GL04, 0x04, GL04)
+ }
+ If(And(PMAP, 2))
+ { // Turn Off Port 1 Power
+ Or(GL04, 0x08, GL04)
+ }
+ If(And(PMAP, 4))
+ { // Turn Off Port 2 Power
+ And(GL08, 0xEF, GL08)
+ }
+ }
+ }
+ } // End V0PR
+
+ PowerResource(V1PR, 0, 0)
+ { // Power Resource Aggregate for RAID volume 1
+ Name(_STA, 0x01)
+ Name(PMAP, 0)
+
+ Method(_ON, 0)
+ { // Turn on the PFET
+ If(Not(_STA)){
+ Store(0x01, _STA)
+ If(And(PMAP, 0x01))
+ { // Turn On Port 0 Power
+ And(GL04, 0xfb, GL04)
+ }
+ If(And(PMAP, 0x02))
+ { // Turn On Port 1 Power
+ And(GL04, 0xf7, GL04)
+ }
+ If(And(PMAP, 0x04))
+ { // Turn On Port 2 Power
+ Or(GL08, 0x10, GL08)
+ }
+ // Delay for power ramp
+ Sleep(16)
+ }
+ }
+
+ Method(_OFF, 0)
+ { // Turn off the PFET
+ If(_STA){
+ Store(0x01, _STA)
+ If(And(PMAP, 1))
+ { // Turn Off Port 0 Power
+ Or(GL04, 0x04, GL04)
+ }
+ If(And(PMAP, 2))
+ { // Turn Off Port 1 Power
+ Or(GL04, 0x08, GL04)
+ }
+ If(And(PMAP, 4))
+ { // Turn Off Port 2 Power
+ And(GL08, 0xEF, GL08)
+ }
+ }
+ }
+ } // End V1PR
+
+ PowerResource(V2PR, 0, 0)
+ { // Power Resource Aggregate for RAID volume 2
+ Name(_STA, 0x01)
+ Name(PMAP, 0)
+
+ Method(_ON, 0)
+ { // Turn on the PFET
+ If(Not(_STA)){
+ Store(0x01, _STA)
+ If(And(PMAP, 0x01))
+ { // Turn On Port 0 Power
+ And(GL04, 0xfb, GL04)
+ }
+ If(And(PMAP, 0x02))
+ { // Turn On Port 1 Power
+ And(GL04, 0xf7, GL04)
+ }
+ If(And(PMAP, 0x04))
+ { // Turn On Port 2 Power
+ Or(GL08, 0x10, GL08)
+ }
+ // Delay for power ramp
+ Sleep(16)
+ }
+ }
+
+ Method(_OFF, 0)
+ { // Turn off the PFET
+ If(_STA){
+ Store(0x01, _STA)
+ If(And(PMAP, 1))
+ { // Turn Off Port 0 Power
+ Or(GL04, 0x04, GL04)
+ }
+ If(And(PMAP, 2))
+ { // Turn Off Port 1 Power
+ Or(GL04, 0x08, GL04)
+ }
+ If(And(PMAP, 4))
+ { // Turn Off Port 2 Power
+ And(GL08, 0xEF, GL08)
+ }
+ }
+ }
+ } // End V2PR
+
+ Device(VOL0) {
+ Name(_ADR,0x0080FFFF) // RAID Volume 0
+
+ Name(_PR0, Package(){V0PR})
+ Name(_PR3, Package(){V0PR})
+
+ Method (_DSM, 4, Serialized, 0, UnknownObj, {BuffObj, IntObj, IntObj, PkgObj}) {
+ If (LEqual(Arg0, ToUUID ("E03E3431-E510-4fa2-ABC0-2D7E901245FE"))) {
+ //
+ // Switch by function index
+ //
+ Switch (Arg2) {
+
+ Case (0) {
+ // Standard query - A bitmask of functions supported
+ // Supports function 0-3
+ Name(RBUF, Buffer(1){0x00})
+ CreateByteField (RBUF, 0, SFUN)
+ Store (0x03, SFUN)
+ Return (RBUF)
+ }
+
+ Case (1) {// Assign ports to this RAID volume
+ Store(DeRefOf(Index(Arg3,0)), ^^V0PR.PMAP) // Assign port mapping to the volume's power resource
+ Return(Package(0){})
+ }
+ Default {
+ Return (0)
+ }
+ } //Switch (Arg2)
+ } Else {
+ Return (0)
+ }
+ }
+ }
+
+ Device(VOL1) {
+ Name(_ADR,0x0081FFFF) // RAID Volume 1
+
+ Name(_PR0, Package(){V1PR})
+ Name(_PR3, Package(){V1PR})
+
+ Method (_DSM, 4, Serialized, 0, UnknownObj, {BuffObj, IntObj, IntObj, PkgObj}) {
+ If (LEqual(Arg0, ToUUID ("E03E3431-E510-4fa2-ABC0-2D7E901245FE"))) {
+ //
+ // Switch by function index
+ //
+ Switch (Arg2) {
+
+ Case (0) {
+ // Standard query - A bitmask of functions supported
+ // Supports function 0-3
+ Name(RBUF, Buffer(1){0x00})
+ CreateByteField (RBUF, 0, SFUN)
+ Store (0x03, SFUN)
+ Return (RBUF)
+ }
+
+ Case (1) {// Assign ports to this RAID volume
+ Store(DeRefOf(Index(Arg3,0)), ^^V1PR.PMAP) // Assign port mapping to the volume's power resource
+ Return(Package(0){})
+ }
+ Default {
+ Return (0)
+ }
+ } //Switch (Arg2)
+ } Else {
+ Return (0)
+ }
+ }
+ }
+
+ Device(VOL2) {
+ Name(_ADR,0x0082FFFF) // RAID Volume 2
+
+ Name(_PR0, Package(){V2PR})
+ Name(_PR3, Package(){V2PR})
+
+ Method (_DSM, 4, Serialized, 0, UnknownObj, {BuffObj, IntObj, IntObj, PkgObj}) {
+ If (LEqual(Arg0, ToUUID ("E03E3431-E510-4fa2-ABC0-2D7E901245FE"))) {
+ //
+ // Switch by function index
+ //
+ Switch (Arg2) {
+
+ Case (0) {
+ // Standard query - A bitmask of functions supported
+ // Supports function 0-3
+ Name(RBUF, Buffer(1){0x00})
+ CreateByteField (RBUF, 0, SFUN)
+ Store (0x03, SFUN)
+ Return (RBUF)
+ }
+
+ Case (1) {// Assign ports to this RAID volume
+ Store(DeRefOf(Index(Arg3,0)), ^^V2PR.PMAP) // Assign port mapping to the volume's power resource
+ Return(Package(0){})
+ }
+ Default {
+ Return (0)
+ }
+ } //Switch (Arg2)
+ } Else {
+ Return (0)
+ }
+ }
+ }
+}
+
+ Scope(\_SB.PCI0.EHC2){
+ Method(_S0W, 0)
+ { // PMEs can be generated from D3(hot)
+ Return(3)
+ } // End _S0W
+
+ // D0 Method for EHCI2 Host Controller
+ Method(_PS0,0,Serialized)
+ {
+ }
+
+ // D3 Method for EHCI2 Host Controller
+ Method(_PS3,0,Serialized)
+ {
+ Store(1, \_SB.PCI0.EHC2.PMES) //Clear PME status
+ Store(1, \_SB.PCI0.EHC2.PMEE) //Enable PME
+ }
+ }
+
+ Scope(\_SB.PCI0.XHC){
+ Method(_S0W, 0)
+ { // PMEs can be generated from D3(hot)
+ Return(3)
+ } // End _S0W
+
+ // D0 Method for xHCI Host Controller
+ Method(_PS0,0,Serialized)
+ {
+ }
+
+ // D3 Method for xHCI Host Controller
+ Method(_PS3,0,Serialized)
+ {
+ Store(1, \_SB.PCI0.XHC.PMES) //Clear PME status
+ Store(1, \_SB.PCI0.XHC.PMEE) //Enable PME
+ }
+ }
+
+ Scope(\_SB.PCI0.XHC.RHUB.HS01){
+ Method(_PR0, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(LEqual(And(XHPR,0xF),0x01))
+ {
+ Return(Package(){\PX01})
+ }
+ Else
+ {
+ Return(Package() {})
+ }
+ } // End of Method _PR0
+ Method(_PR2, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(LEqual(And(XHPR,0xF),0x01))
+ {
+ Return(Package(){\PX01})
+ }
+ Else
+ {
+ Return(Package() {})
+ }
+ } // End of Method _PR2
+ Method(_PR3, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(LEqual(And(XHPR,0xF),0x01))
+ {
+ Return(Package(){\PX01})
+ }
+ Else
+ {
+ Return (Package() {})
+ }
+ } // End of Method _PR3
+ }
+
+ Scope(\_SB.PCI0.XHC.RHUB.HS02){
+ Method(_PR0, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(LEqual(And(XHPR,0xF0),0x10))
+ {
+ Return(Package(){\PX01})
+ }
+ Else
+ {
+ Return(Package() {})
+ }
+ } // End of Method _PR0
+ Method(_PR2, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(LEqual(And(XHPR,0xF0),0x10))
+ {
+ Return(Package(){\PX01})
+ }
+ Else
+ {
+ Return(Package() {})
+ }
+ } // End of Method _PR2
+ Method(_PR3, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(LEqual(And(XHPR,0xF0),0x10))
+ {
+ Return(Package(){\PX01})
+ }
+ Else
+ {
+ Return (Package() {})
+ }
+ } // End of Method _PR3
+
+ }
+
+ Scope(\_SB.PCI0.XHC.RHUB.SSP1){
+ Method(_PR0, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(LEqual(And(XHPR,0xF),0x02))
+ {
+ Return(Package(){\PX01})
+ }
+ Else
+ {
+ Return(Package() {})
+ }
+ }
+ Method(_PR2, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(LEqual(And(XHPR,0xF),0x02))
+ {
+ Return(Package(){\PX01})
+ }
+ Else
+ {
+ Return(Package() {})
+ }
+ }
+ Method(_PR3, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(LEqual(And(XHPR,0xF),0x02))
+ {
+ Return(Package(){\PX01})
+ }
+ Else
+ {
+ Return (Package() {})
+ }
+ }// End of method _PR3
+ } // End of Scope(\_SB.PCI0.XHC.RHUB.SSP1)
+
+ Scope(\_SB.PCI0.XHC.RHUB.SSP2){
+
+ Method(_PR0, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(LEqual(And(XHPR,0xF0),0x20))
+ {
+ Return(Package(){\PX01})
+ }
+ Else
+ {
+ Return(Package() {})
+ }
+ }
+ Method(_PR2, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(LEqual(And(XHPR,0xF0),0x20))
+ {
+ Return(Package(){\PX01})
+ }
+ Else
+ {
+ Return(Package() {})
+ }
+ }
+ Method(_PR3, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(LEqual(And(XHPR,0xF0),0x20))
+ {
+ Return(Package(){\PX01})
+ }
+ Else
+ {
+ Return (Package() {})
+ }
+ }// End of method _PR3
+ }//Scope(\_SB.PCI0.XHC.RHUB.SSP2)
+
+ Scope(\_SB.PCI0.EHC2.HUBN.PR01.PR11){
+ Name(_PR0, Package(){\PX89})
+ Name(_PR2, Package(){\PX89})
+ Name(_PR3, Package(){\PX89})
+
+ }
+
+ Scope(\_SB.PCI0.EHC2.HUBN.PR01.PR12){
+ Name(_PR0, Package(){\PX89})
+ Name(_PR2, Package(){\PX89})
+ Name(_PR3, Package(){\PX89})
+
+ }
+
+ Scope(\) {
+ PowerResource(PX01, 0, 0){ //Common power rail for USB2.0 ports 0,1 /USB3.0 ports 1,2 - GPIO 40
+ Method(_STA){
+ If(And(GL05, 0x02)) { //GPIO41 => GL05 BIT0
+ Return(0x01)
+ } Else {
+ Return(0x00)
+ }
+ }
+
+ Method(_ON, 0)
+ { // Turn on
+ Or(GL05, 2, GL05)
+ // Delay for power ramp
+ Sleep(16)
+ }
+
+ Method(_OFF, 0)
+ { // Turn off
+ And(GL05, 0xfd, GL05)
+ }
+ } // End PX01
+
+ PowerResource(PX89, 0, 0){ //Common power rail for USB2.0 ports 8, 9 (stacked with LAN conn; EHCI) - GPIO 14
+ Method(_STA){
+ If(And(GL01, 0x40)) { //GPI14 => GL01 BIT6
+ Return(0x01)
+ } Else {
+ Return(0x00)
+ }
+ }
+
+ Method(_ON, 0)
+ { // Turn on
+ Or(GL01, 0x40, GL01)
+ // Delay for power ramp
+ Sleep(16)
+ }
+
+ Method(_OFF, 0)
+ { // Turn off
+ And(GL01, 0x0bf, GL01)
+ }
+ } // End PX89
+
+} //Scope(\)
+
+} //If(LAnd(LEqual(BID,BBR),LEqual(RTD3,1)))
+
+} // End SSDT \ No newline at end of file
diff --git a/ReferenceCode/AcpiTables/SampleCode/SsdtRtd3/RTD3Common.asl b/ReferenceCode/AcpiTables/SampleCode/SsdtRtd3/RTD3Common.asl
new file mode 100644
index 0000000..9f8857e
--- /dev/null
+++ b/ReferenceCode/AcpiTables/SampleCode/SsdtRtd3/RTD3Common.asl
@@ -0,0 +1,178 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Sandy Bridge *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+
+External(\_SB.OSCO)
+External(\_SB.PCI0,DeviceObj)
+External(\_SB.PCI0.SAT0, DeviceObj)
+External(\_SB.PCI0.SAT0.PRT0, DeviceObj)
+External(\_SB.PCI0.SAT0.PRT1, DeviceObj)
+External(\_SB.PCI0.SAT0.PRT2, DeviceObj)
+
+External(\_SB.PCI0.RP01, DeviceObj)
+External(\_SB.PCI0.RP03, DeviceObj)
+External(\_SB.PCI0.RP04, DeviceObj)
+External(\_SB.PCI0.RP05, DeviceObj)
+External(\_SB.PCI0.RP06, DeviceObj)
+External(\_SB.PCI0.RP01.LDIS)
+External(\_SB.PCI0.RP03.LDIS)
+External(\_SB.PCI0.RP04.LDIS)
+External(\_SB.PCI0.RP05.LDIS)
+External(\_SB.PCI0.RP06.LDIS)
+External(\_SB.PCI0.RP01.L23E)
+External(\_SB.PCI0.RP03.L23E)
+External(\_SB.PCI0.RP04.L23E)
+External(\_SB.PCI0.RP05.L23E)
+External(\_SB.PCI0.RP06.L23E)
+External(\_SB.PCI0.RP01.L23R)
+External(\_SB.PCI0.RP03.L23R)
+External(\_SB.PCI0.RP04.L23R)
+External(\_SB.PCI0.RP05.L23R)
+External(\_SB.PCI0.RP06.L23R)
+External(\_SB.PCI0.RP01.LEDM)
+External(\_SB.PCI0.RP03.LEDM)
+External(\_SB.PCI0.RP04.LEDM)
+External(\_SB.PCI0.RP05.LEDM)
+External(\_SB.PCI0.RP06.LEDM)
+External(\_SB.PCI0.RP01.LASX)
+External(\_SB.PCI0.RP03.LASX)
+External(\_SB.PCI0.RP04.LASX)
+External(\_SB.PCI0.RP05.LASX)
+External(\_SB.PCI0.RP06.LASX)
+External(\CKEN)
+External(\PMFS)
+
+External(\_SB.PCI0.XHC, DeviceObj)
+External(\_SB.PCI0.XHC.PMES)
+External(\_SB.PCI0.XHC.PMEE)
+External(\_SB.PCI0.XHC.MEMB)
+External(\_SB.PCI0.EHC2, DeviceObj)
+External(\_SB.PCI0.EHC2.PMES)
+External(\_SB.PCI0.EHC2.PMEE)
+External(\_SB.PCI0.XHC.RHUB, DeviceObj)
+External(\_SB.PCI0.XHC.RHUB.SSP1, DeviceObj)
+External(\_SB.PCI0.XHC.RHUB.SSP2, DeviceObj)
+External(\_SB.PCI0.XHC.RHUB.HS01, DeviceObj) //xHCI HSP port 1
+External(\_SB.PCI0.XHC.RHUB.HS02, DeviceObj) //xHCI HSP port 2
+External(\_SB.PCI0.I2C0, DeviceObj) //I2C Controller
+External(\_SB.PCI0.I2C0.SHUB, DeviceObj) // Sensor hub
+
+External(PEP0)
+External(PEP3)
+External(XHPR)
+External(RCG0, IntObj) // RTD3 Config Setting(BIT0:ZPODD,BIT1:USB Camera Port4, BIT2/3:SATA Port3)
+External(\GPRW, MethodObj)
+External(P8XH, MethodObj)
+External(BID, IntObj) // BoardId
+External(RTD3, IntObj)
+//AMI_OVERRIDE --- Change name from XDST to XHDS to fix that the system has BsOD issue. It is due to the name(XDST) is conflict with AMI Aptio definition name. >>
+//External(XHDS, IntObj)
+//External(XDST, IntObj)
+//AMI_OVERRIDE --- <<
+//
+// Externs common to ULT0RTD3.asl and FFRDRTD3.asl and exclude for BRRTD3.asl
+//
+#ifndef BRRTD3
+External(\_SB.GP2A, MethodObj)
+External(\_SB.GP2B, MethodObj)
+External(\_SB.GP2N, MethodObj)
+External(\_SB.RDGP, MethodObj)
+External(\_SB.WTGP, MethodObj)
+External(\_SB.WTIN, MethodObj)
+External(\_SB.RDGI, MethodObj)
+
+External(\_SB.PCI0.HDEF, DeviceObj)
+External(\_SB.PCI0.ADSP, DeviceObj)
+External(\_SB.PCI0.I2C1, DeviceObj) //I2C1 Controller
+External(\_SB.PCI0.I2C1.TPD1, DeviceObj) // Touch pad
+External(\_SB.PCI0.I2C1.TPL0, DeviceObj) // Touch panel
+External(\_SB.PCI0.I2C1.TPD0, DeviceObj) // Touch pad
+External(\_SB.PCI0.LPCB.H_EC.SPT2) // SATA_CABLE_PWR_EN bit in EC
+External(\_SB.PCI0.LPCB.H_EC.ECMD, MethodObj) // EC Command method
+External(\_SB.PCI0.LPCB.H_EC.ECAV, IntObj) // EC Driver loaded flag
+External(\_SB.PCI0.LPCB.H_EC.ECRD, MethodObj) // EC Read Method
+External(\_SB.PCI0.LPCB.H_EC.ECWT, MethodObj) // EC Write Method
+External(\_SB.PCI0.SAT0.PRT3, DeviceObj)
+
+External(\UAMS)
+External(RIC0,FieldUnitObj)
+External(SDS0,FieldUnitObj)
+External(SDS1,FieldUnitObj)
+External(IC1D,FieldUnitObj)
+External(IC1S,FieldUnitObj)
+External(IC0D,FieldUnitObj)
+External(I20D,FieldUnitObj)
+External(I21D,FieldUnitObj)
+External(AUDD,FieldUnitObj)
+External(HDAD,FieldUnitObj)
+External(SHSB,FieldUnitObj)
+External(VRSD,FieldUnitObj)
+External(VRRD,FieldUnitObj)
+
+External(\GO08)
+External(\GO45)
+External(\GO51)
+External(\GS08)
+External(\GS45)
+External(\GS51)
+
+Name(LONT, 0) // Last ON Timestamp: The time stamp of the last RTDpower resource _ON method evaluation
+
+//
+// SGON - Staggering ON Method with VR Staggering delay
+// Staggering ON Method with VR Staggering (VRSD) delay. Sleep the extra remaining amount of time if necessary.
+// Update the global running timer of LONT (Last ON mehtod timestamp)
+//
+// Arguments:
+// Arg0 - GPIO Pin number to toggle power on
+// Arg1 - GPIO Value, 0: Active Low, 1: Active High
+//
+// Return Value:
+// Zero - VR staggering is skipped
+// One - VR staggering is performed
+//
+Method(SGON, 2, Serialized)
+{
+ // Check if device is already driven to power on
+ If(LNotEqual(\_SB.RDGP(Arg0), Arg1)) {
+ // Check for VR staggering
+ Divide(Subtract(Timer(), \LONT), 10000, , Local0) //Store Elapsed time in ms, ignore remainder
+ If(LLess(Local0, \VRSD)) { //Do not sleep if already past the delay requirement
+ // Delay for power ramp using Timer Based Sleep
+ Sleep(Subtract(\VRSD, Local0))
+ }
+
+ \_SB.WTGP(Arg0, Arg1) // Drive GPIO to power on device
+
+ Store(Timer(), \LONT) // Update the global Last ON Method Timer
+
+ Return(One) // VR staggering is performed
+ } Else {
+ Return(Zero) // VR staggering is skipped
+ }
+}
+
+#endif
+
diff --git a/ReferenceCode/AcpiTables/SampleCode/SsdtRtd3/RTD3Pcie.asl b/ReferenceCode/AcpiTables/SampleCode/SsdtRtd3/RTD3Pcie.asl
new file mode 100644
index 0000000..d560c2c
--- /dev/null
+++ b/ReferenceCode/AcpiTables/SampleCode/SsdtRtd3/RTD3Pcie.asl
@@ -0,0 +1,165 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Sandy Bridge *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+
+ Name(WKEN, 0)
+
+ Method(_S0W, 0)
+ { // PMEs can be generated from D3hot
+ Return(3) //For ULT
+ } // End _S0W
+
+ Method(_DSW, 3)
+ {
+ If(Arg1)
+ { // Entering Sx, need to disable WAKE# from generating runtime PME
+ Store(0, WKEN)
+ } Else { // Staying in S0
+ If(LAnd(Arg0, Arg2)) // Exiting D0 and arming for wake
+ { // Set PME
+ Store(1, WKEN)
+ } Else { // Disable runtime PME, either because staying in D0 or disabling wake
+ Store(0, WKEN)
+ }
+ }
+ } // End _DSW
+
+ // Define a power resource for PCIe RP D0-D3hot
+ PowerResource(PXP, 0, 0)
+ {
+ Method(_STA, 0)
+ {
+ if(LAND(LEqual(\_SB.RDGP(PWRG),PONP), LEqual(\_SB.RDGP(RSTG),RONP))){
+ Return (1)
+ } Else {
+ Return (0)
+ }
+ }
+ Method(_ON) // Turn on core power to PCIe Slot
+ {
+
+ // Power ON for Slot
+ // Dont enable power for NGFF because NGFF only has AUX power
+ If(LNot(NGFF)) {
+ \_SB.WTGP(PWRG,PONP)
+ Sleep(PEP0) // Sleep for programmable delay
+ }
+
+ // Enable PCIe Src Clock
+ While(LEqual(PMFS,1)){ // PMC message serviced?
+ Stall(10)
+ }
+ Store(Or(ShiftLeft(SCLK, 24), ShiftLeft(SCLK, 16)), Local1) // Set Bit and Mask
+ Or(Local1, 4, Local1) // OCKEN command
+ Store(Local1, \CKEN) // Enable Source Clock
+ While(LEqual(PMFS,1)){ // PMC message serviced?
+ Stall(10)
+ }
+
+ \_SB.WTGP(RSTG,RONP) // De-Assert Reset Pin
+ Store(1, L23R) // Set L23_Rdy to Detect Transition (L23R2DT)
+ Sleep(16)
+ Store(0, Local0)
+ // Wait up to 12 ms for transition to Detect
+ While(L23R) {
+ If(Lgreater(Local0, 4)) // Debug - Wait for 5 ms
+ {
+ Break
+ }
+ Sleep(16)
+ Increment(Local0)
+ }
+ // Once in Detect, wait up to 124 ms for Link Active (typically happens in under 70ms)
+ // Worst case per PCIe spec from Detect to Link Active is:
+ // 24ms in Detect (12+12), 72ms in Polling (24+48), 28ms in Config (24+2+2+2+2)
+ Store(0, Local0)
+ While(LEqual(LASX,0)) {
+ If(Lgreater(Local0, 123))
+ {
+ Break
+ }
+ Sleep(16)
+ Increment(Local0)
+ }
+ // ADBG(Local0) // uncomment to print the timeout value for debugging
+ Store(0, LEDM) // PCIEDBG.DMIL1EDM (324[3]) = 0
+ }
+ Method(_OFF) // Turn off core power to PCIe Slot
+ {
+ // Set L23_Rdy Entry Request (L23ER)
+ Store(1, L23E)
+ Sleep(16)
+ Store(0, Local0)
+ While(L23E) {
+ If(Lgreater(Local0, 4)){ // Debug - Wait for 5 ms
+ Break
+ }
+ Sleep(16)
+ Increment(Local0)
+ }
+ Store(1, LEDM) // PCIEDBG.DMIL1EDM (324[3]) = 1
+
+ While(LEqual(PMFS,1)){ // PMC message serviced?
+ Stall(10)
+ }
+ // Disable PCIe Src Clock
+ Store(Or(ShiftLeft(SCLK, 24), 4), Local1) // Set Mask, OCKEN command
+ Store(Local1, \CKEN) // Disable Source Clock
+ While(LEqual(PMFS,1)){ // PMC message serviced?
+ Stall(10)
+ }
+
+ \_SB.WTGP(RSTG,Not(RONP)) // Assert Reset Pin
+
+ If(LNot(NGFF)) { // Dont disable power for NGFF because NGFF only has AUX power
+ \_SB.WTGP(PWRG,Not(PONP)) //Power OFF for Slot
+ }
+
+ Store(1, LDIS)
+ Store(0, LDIS) //toggle link disable
+
+ If(WKEN) {
+ Switch(SLOT){
+ Case(0x3){ // Root Port 3
+ Store(1, \GS08) //Clear GPE STATUS
+ Store(0, \GO08) //GPIO_OWN to ACPI Driver
+ }
+ Case(0x4){ // Root Port 4
+ Store(1, \GS45) //Clear GPE STATUS
+ Store(0, \GO45) //GPIO_OWN to ACPI Driver
+ }
+ Case(0x5){ // Root Port 5
+ Store(1, \GS51) //Clear GPE STATUS
+ Store(0, \GO51) //GPIO_OWN to ACPI Driver
+ }
+ Default{
+ }
+ }
+ }
+ } // End of Method_OFF
+ } // End PXP
+
+ Name(_PR0, Package(){PXP})
+
diff --git a/ReferenceCode/AcpiTables/SampleCode/SsdtRtd3/Rtd3FFRD.asl b/ReferenceCode/AcpiTables/SampleCode/SsdtRtd3/Rtd3FFRD.asl
new file mode 100644
index 0000000..a00d8e0
--- /dev/null
+++ b/ReferenceCode/AcpiTables/SampleCode/SsdtRtd3/Rtd3FFRD.asl
@@ -0,0 +1,1049 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Sandy Bridge *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+
+DefinitionBlock (
+ "Rtd3.aml",
+ "SSDT",
+ 1,
+ "AcpiRef",
+ "HSW-FFRD",
+ 0x1000
+ )
+{
+#define FFRDRTD3 1
+Include ("RTD3Common.asl")
+#undef FFRDRTD3
+
+External(PEBS, IntObj) // PCI Express BAR address
+External(BHB, IntObj) // Harris Beach FFRD Board
+External(\_SB.PCI0.XHC.RHUB.HS05, DeviceObj)
+External(\_SB.PCI0.XHC.RHUB.HS06, DeviceObj)
+External(\_SB.PCI0.SDHC, DeviceObj) //SDIO
+External(\_SB.PCI0.SDHC.WI01, DeviceObj) //SDIO Wifi
+External(\_SB.PCI0.I2C1.TPD7, DeviceObj) // Precision Elantech touchpad
+External(\_SB.PCI0.I2C1.TPD8, DeviceObj) // Precision Synaptics touchpad
+
+If(LAnd(LEqual(BID,BHB),LEqual(RTD3,1))) {
+//
+// PCIe RTD3 - for slot#1
+//
+Scope(\_SB.PCI0.RP01)
+{
+ Name(SLOT, 1)
+ Name(RSTG, 77) // reset GPIO NGFF_WIFI_RST_N
+ Name(PWRG, 83) // power GPIO
+ Name(RONP, 1) // reset on polarity (DE-ASSERT)
+ Name(PONP, 1) // power on polarity
+ Name(NGFF, 1) // Is Slot NGFF form factor 1- Yes 0- No
+ Name(SCLK, 0x1) // Source Clock Enable Bit Location(BIT0)
+ Include("Rtd3Pcie.asl")
+}
+
+//SATA - START
+ Scope(\_SB.PCI0.SAT0) {
+
+ // D0 Method for SATA HBA
+ Method(_PS0,0,Serialized)
+ {
+ }
+
+ // D3 Method for SATA HBA
+ Method(_PS3,0,Serialized)
+ {
+ }
+
+ OperationRegion(SMIO,PCI_Config,0x24,4)
+ Field(SMIO,AnyAcc, NoLock, Preserve) {
+ Offset(0x00), // SATA MABR6
+ MBR6, 32, // SATA ABAR
+ }
+
+ OperationRegion(ST93,PCI_Config,0x93,1)
+ Field(ST93,AnyAcc, NoLock, Preserve) {
+ Offset(0x00),
+ P0P, 1, // Port 0 Present
+ P1P, 1, // Port 1 Present
+ P2P, 1, // Port 2 Present
+ P3P, 1, // Port 3 Present
+ }
+
+ Scope(PRT1) {
+ // Store boot drive connection status
+ // Initialize to drive connected, value updated in _INI
+ Name(CONN, 1)
+
+ Method (_INI, 0)
+ {
+ // If no drive connected on boot, update connection status and power gate the port
+ If(LEqual(P1P, 0))
+ {
+ Store (0, CONN)
+ \_SB.WTGP (90, 1)
+ }
+ }
+
+ PowerResource(P1PR, 0, 0){
+ Name(OFTM, Zero) // Time returned by Timer() when the Power resource was turned OFF
+
+ Method(_STA){
+ If(LEqual(\_SB.RDGP(90),1)) { //GPIO90
+ Return(0x00)
+ } Else {
+ Return(0x01)
+ }
+ }
+ Method(_ON, 0)
+ {
+ if(And(RCG0,0x10)) // RTD3Config0/RCG0 BIT 4 - Setup option to powergate Port 1
+ {
+ // If there was a device present on boot, power on device
+ If(LEqual(CONN, 1))
+ {
+ If(LNotEqual(^OFTM, Zero)) { // if OFTM != 0 => Disk as turned OFF by asl
+ Divide(Subtract(Timer(), ^OFTM), 10000, , Local0) //Store Elapsed time in ms
+ Store(Zero, ^OFTM) // Reset OFTM to zero to indicate minimum 50ms requirement does not apply when _ON called next time
+ If(LLess(Local0, 50)) // Do not sleep if already past the delay requirement
+ {
+ Sleep(Subtract(50, Local0)) // Sleep 100ms - time elapsed
+ }
+ }
+
+ SGON(90, Zero) // VR stagger GPIO90 to low to power on device
+ }
+ } // if(And(RCG0,0x10))
+ } // End of ON Method
+ Method(_OFF, 0)
+ {
+ if(And(RCG0,0x10)) // RTD3Config0/RCG0 BIT 4 - Setup option to powergate Port 1
+ {
+ Add(\_SB.PCI0.SAT0.MBR6,0x198 ,Local0)
+ OperationRegion(PSTS, SystemMemory, Local0, 0x18)
+ Field(PSTS, DWordAcc, NoLock, Preserve) {
+ Offset(0x0),
+ CMST, 1, //PxCMD.ST
+ CSUD, 1, //PxCMD.SUD
+ , 2,
+ CFRE, 1, //PxCMD.FRE
+ Offset(0x10),
+ SDET, 4, //PxSSTS.DET
+ Offset(0x14),
+ CDET, 4 //PxSCTL.DET
+ }
+ If(LOr(LEqual(SDET, 1), LEqual(SDET, 3))){ //Offline flow only if Device detected and Phy not offline
+ //Clear ST (PxCMD.ST) 198[0]
+ Store(0, CMST)
+ //Clear FRE 198[4]
+ Store(0, CFRE)
+ //Clear SUD (PxCMD.SUD) 198[1]
+ Store(0, CSUD)
+ //Set DET to 4 (PxSCTL.DET) 1ac[3:0]
+ Store(4, CDET)
+ Sleep(16)
+ //Wait until PxSSTS.DET == 4
+ While(LNotEqual(SDET, 4)){
+ Sleep(16)
+ }
+ }
+ // Drive GPIO90 to High to power off device
+ \_SB.WTGP(90,1)
+ Store(Timer(), ^OFTM) // Store time when Disk turned OFF(non-zero OFTM indicate minimum 50ms requirement does apply when _ON called next time)
+ } // if(And(RCG0,0x10))
+ } // End of OFF method
+ } // End P1PR
+
+ Name(_PR0, Package(){P1PR})
+ Name(_PR3, Package(){P1PR})
+
+ } //End PRT1
+
+ // PRT2 . Controlled by EC pin (PF6/PWMU4A/ExCTS).
+ Scope(PRT2) {
+ // Store boot drive connection status
+ // Initialize to drive connected, value updated in _INI
+ Name(CONN, 1)
+
+ Method (_INI, 0)
+ {
+ // If no drive connected on boot, update connection status and power gate the port
+ If(LEqual(P2P, 0))
+ {
+ Store (0, CONN)
+ \_SB.WTGP (86, 1)
+ }
+ }
+
+ PowerResource(P2PR, 0, 0){
+ Name(OFTM, Zero) // Time returned by Timer() when the Power resource was turned OFF
+
+ Method(_STA){
+ If(LEqual(\_SB.RDGP(86),1)) { // GPIO86
+ Return(0x00)
+ } Else {
+ Return(0x01)
+ }
+
+ }
+ Method(_ON, 0)
+ {
+ if(And(RCG0,0x20)) // RTD3Config0/RCG0 BIT 5 - Setup option to powergate Port 2
+ {
+ // If there was a device present on boot, power on device
+ If(LEqual(CONN, 1))
+ {
+ If(LNotEqual(^OFTM, Zero)) { // if OFTM != 0 => Disk as turned OFF by asl
+ Divide(Subtract(Timer(), ^OFTM), 10000, , Local0) // Store Elapsed time in ms
+ Store(Zero, ^OFTM) // Reset OFTM to zero to indicate minimum 50ms requirement does not apply when _ON called next time
+ If(LLess(Local0, 50)) // Do not sleep if already past the delay requirement
+ {
+ Sleep(Subtract(50, Local0)) //Sleep 100ms - time elapsed
+ }
+ }
+
+ SGON(86, Zero) // VR stagger GPIO86 to low to power on device
+ }
+ } // if(And(RCG0,0x20))
+ } // End of ON Method
+ Method(_OFF, 0)
+ {
+ if(And(RCG0,0x20)) // RTD3Config0/RCG0 BIT 5 - Setup option to powergate Port 2
+ {
+ Add(\_SB.PCI0.SAT0.MBR6,0x218 ,Local0)
+ OperationRegion(PSTS, SystemMemory, Local0, 0x18)
+ Field(PSTS, DWordAcc, NoLock, Preserve) {
+ Offset(0x0),
+ CMST, 1, //PxCMD.ST
+ CSUD, 1, //PxCMD.SUD
+ , 2,
+ CFRE, 1, //PxCMD.FRE
+ Offset(0x10),
+ SDET, 4,
+ Offset(0x14),
+ CDET, 4 //PxSCTL.DET
+ }
+ If(LOr(LEqual(SDET, 1), LEqual(SDET, 3))){ //Offline flow only if Device detected and Phy not offline
+ //Clear ST (PxCMD.ST)
+ Store(0, CMST)
+ //Clear FRE
+ Store(0, CFRE)
+ //Clear SUD (PxCMD.SUD)
+ Store(0, CSUD)
+ //Set DET to 4 (PxSCTL.DET)
+ Store(4, CDET)
+ Sleep(16)
+ //Wait until PxSSTS.DET == 4
+ While(LNotEqual(SDET, 4)){
+ Sleep(16)
+ }
+ }
+ // Drive GPIO86 to High to power off device
+ \_SB.WTGP(86,1)
+ Store(Timer(), ^OFTM) // Store time when Disk turned OFF(non-zero OFTM indicate minimum 50ms requirement does apply when _ON called next time)
+ } // if(And(RCG0,0x20))
+ } // End of OFF method
+ } // End P2PR
+
+ Name(_PR0, Package(){P2PR})
+ Name(_PR3, Package(){P2PR})
+
+ } //End PRT2
+
+
+ //
+ // _DSM Device Specific Method supporting AHCI DEVSLP
+ //
+ // Arg0: UUID Unique function identifier
+ // Arg1: Integer Revision Level
+ // Arg2: Integer Function Index
+ // Arg3: Package Parameters
+ //
+ Name(DRV, 0) // Storage for _DSM Arg3 parameter 0
+ Name(PWR, 0) // Storage for _DSM Arg3 parameter 1
+
+ Method (_DSM, 4, Serialized, 0, UnknownObj, {BuffObj, IntObj, IntObj, PkgObj}) {
+ If (LEqual(Arg0, ToUUID ("E4DB149B-FCFE-425b-A6D8-92357D78FC7F"))) {
+ //
+ // Switch by function index
+ //
+ Switch (Arg2) {
+ Case (0) {
+ // Standard query - A bitmask of functions supported
+ // Supports function 0-3
+ Return(0x0f)
+ }
+ Case (1) {
+ // Query Device IDs (Addresses) of children where drive power and/or DevSleep are supported.
+ // LPT-LP SATA HBA provides autonomous link (DevSleep) support, return a package of 0 elements
+ Return( Package(){}) // SATA HBA provides native DevSleep
+ }
+ //
+ // Control power to device.
+ //
+ Case (2) {
+ Store(ToInteger(DerefOf(Index(Arg3, Zero))), DRV)
+ Store(ToInteger(DerefOf(Index(Arg3, One))), PWR)
+
+ Switch(DRV){
+ Case (Ones){
+ // Turn on drive and link power to all drives. Note that even though
+ If(PWR){ // Applying Power
+ //^PRT0.P0PR._ON() // apply power to port 0
+ \_SB.PCI0.SAT0.PRT1.P1PR._ON() // apply power to port 1
+ \_SB.PCI0.SAT0.PRT2.P2PR._ON() // apply power to port 2
+ }
+ }
+ } //Switch(DRV)
+ Return (0)
+ } //Case (2)
+ //
+ // Current status of Device/Link of Port
+ //
+ Case (3){
+ Store(ToInteger(DerefOf(Index(Arg3, Zero))), DRV)
+ Switch(DRV){
+ Case (0x0000FFFF){ // SATA Port 0
+ // Bit0 => Device power state
+ Store(1, Local0) // always ON
+ Return (Local0)
+ }
+ Case (0x0001FFFF){ // SATA Port 1
+ // Bit0 => Device power state
+ If(LEqual(\_SB.PCI0.SAT0.PRT1.P1PR._STA(), 0)){
+ Store(0, Local0)
+ }Else{
+ Store(1, Local0)
+ }
+ Return (Local0)
+ }
+ Case (0x0002FFFF){ // SATA Port 2
+ // Bit0 => Device power state
+ If(LEqual(\_SB.PCI0.SAT0.PRT2.P2PR._STA(), 0)){
+ Store(0, Local0)
+ }Else{
+ Store(1, Local0)
+ }
+ Return (Local0)
+ }
+ Default { // Invalid SATA Port - error
+ Return (Ones)
+ }
+ }
+ }
+ Default {
+ Return (0)
+ }
+ }
+ } Else { // UUID does not match
+ Return (0)
+ }
+ } //Method(_DSM)
+
+ } //Scope(\_SB.PCI0.SAT0)
+
+// SATA - END
+
+//USB - START
+ Scope(\_SB.PCI0.XHC){
+ Name(_S0W, 3)
+ }
+
+ Scope(\_SB.PCI0.XHC.RHUB){ //USB XHCI RHUB
+ Method(_PS0,0,Serialized)
+ {
+ Store(0x00,USPP)
+ }
+ Method(_PS2,0,Serialized)
+ {
+
+ OperationRegion (XHCM, SystemMemory, And(\_SB.PCI0.XHC.MEMB,0xFFFF0000), 0x600)
+ Field (XHCM, DWordAcc, NoLock, Preserve)
+ {
+ Offset(0x2),
+ XHCV,16,
+ Offset(0x480),
+ HP01, 1, // HS port 1
+ Offset(0x490),
+ HP02, 1, // HS port 2
+ Offset(0x4F0),
+ HP08, 1, // HS port 8
+ Offset(0x510),
+ SP00, 1, // SS port 0
+ Offset(0x520),
+ SP01, 1, // SS port 1
+ Offset(0x540),
+ SP03 , 1, // SS port 3
+ }
+ If(LEqual(XHCV,0xFFFF)) // Controller in D3Hot(MEM_BASE not decoded)
+ {
+ Return()
+ }
+ If(LAnd(LEqual(HP08,0x00),LEqual(SP03,0x00))) // SD Card reader
+ {
+ Or(USPP,0x01, USPP)
+ }
+ If(LAnd(LEqual(HP01,0x00),LEqual(SP00,0x00))) // USB(HS1 : 0x480 /SS0 : 0x510)
+ {
+ Or(USPP,0x02, USPP)
+ }
+ If(LAnd(LEqual(HP02,0x00),LEqual(SP01,0x00))) // USB(HS2 : 0x490 / SS1 : 0x520)
+ {
+ Or(USPP,0x04, USPP)
+ }
+ } // End of PS2 method
+ Method(_PS3,0,Serialized)
+ {
+ } // End of _PS3 method
+ }
+
+Scope(\_SB.PCI0.XHC.RHUB.HS06){
+
+ PowerResource(PX06, 0, 0){ // power rail for USB3.0 ports 6 - GPIO 84
+ Method(_STA){
+ If(LEqual(\_SB.RDGP(84),1)) { //GPIO84
+ Return(0x01)
+ } Else {
+ Return(0x00)
+ }
+ }
+ Method(_ON, 0)
+ { // Turn on
+ SGON(84, One) // VR stagger GPIO84 to high to power on device
+ }
+
+ Method(_OFF, 0)
+ { // Turn off
+ \_SB.WTGP(84,0)
+ }
+ } // End PX06
+ Name(_S0W,2) // Indicate WWAN can wake from D2 while in S0 using selective suspend
+ Name(_PR0,Package(){\_SB.PCI0.XHC.RHUB.HS06.PX06}) // Power Resource required to support D0
+ Name(_PR2,Package(){\_SB.PCI0.XHC.RHUB.HS06.PX06}) // Power Resource required to support D2
+ Name(_PR3,Package(){\_SB.PCI0.XHC.RHUB.HS06.PX06}) // Power Resource required to support D3
+}
+
+ Scope(\_SB.PCI0.XHC.RHUB.HS05){
+ PowerResource(PX05, 0, 0){ // power rail for USB2.0 ports 5 - GPIO 25
+ Method(_STA){
+ If(LEqual(\_SB.RDGP(25),1)) { //GPIO25
+ Return(0x01)
+ } Else {
+ Return(0x00)
+ }
+ }
+ Method(_ON, 0)
+ { // Turn on
+ SGON(25, One) // VR stagger GPIO25 to high to power on device
+ }
+
+ Method(_OFF, 0)
+ { // Turn off
+ \_SB.WTGP(25,0)
+ }
+ } // End PX05
+ Name(_PR0,Package(){\_SB.PCI0.XHC.RHUB.HS05.PX05}) // Power Resource required to support D0
+ Name(_PR2,Package(){\_SB.PCI0.XHC.RHUB.HS05.PX05}) // Power Resource required to support D2
+ Name(_PR3,Package(){\_SB.PCI0.XHC.RHUB.HS05.PX05}) // Power Resource required to support D3
+ }
+ Scope(\_SB.PCI0.XHC){ //USB XHCI
+
+ Name(UPWR,0)
+ Name(USPP,0)
+ // Bit 0 : USB SD Card Reader
+ // Bit 1 : USB(HS1 : 0x480 /SS0 : 0x510)
+ // BIT 2 : USB(HS2 : 0x490 / SS1 : 0x520)
+
+
+ Method(DUAM,0,Serialized)
+ {
+
+ OperationRegion (XHCM, SystemMemory, And(\_SB.PCI0.XHC.MEMB,0xFFFF0000), 0x600)
+ Field (XHCM, DWordAcc, NoLock, Preserve)
+ {
+ Offset(0x2),
+ XHCV,16,
+ Offset(0x480),
+ HP01, 1, // HS port 1
+ Offset(0x490),
+ HP02, 1, // HS port 2
+ Offset(0x4F0),
+ HP08, 1, // HS port 8
+ Offset(0x510),
+ SP00, 1, // SS port 0
+ Offset(0x520),
+ SP01, 1, // SS port 1
+ Offset(0x540),
+ SP03 , 1, // SS port 3
+ }
+
+ if(LNotEqual(\UAMS,0x00)) // User not present
+ {
+ Store(0x00,UPWR)
+ // Enterng CS, Remove power if SD card not present
+
+ If(LEqual(XHCV,0xFFFF)) // Controller in D3Hot(MEM_BASE not decoded)
+ {
+ If(And(USPP,0x01)) // SD Card reader
+ {
+ \_SB.WTGP(60,0)
+ Or(UPWR,0x01, UPWR)
+ }
+ If(And(USPP,0x06)) // USB(HS1 : 0x480 /SS0 : 0x510) & USB(HS2 : 0x490 / SS1 : 0x520)
+ {
+ \_SB.GP2N(40,1) // Mask OC#(Switch to GPIO mode)
+ \_SB.WTGP(13,0) // Power gate GPIO13/43 at same time
+ \_SB.WTGP(43,0)
+ Or(UPWR,0x02, UPWR)
+ Or(UPWR,0x04, UPWR)
+ }
+ }Else{ // If(Lequal(XHCV,0xFFFF))
+ If(LAnd(LEqual(HP08,0x00),LEqual(SP03,0x00))) // SD Card reader
+ {
+ \_SB.WTGP(60,0)
+ Or(UPWR,0x01, UPWR)
+ }
+ If(LAnd(LAnd(LEqual(HP01,0x00),LEqual(SP00,0x00)), LAnd(LEqual(HP02,0x00),LEqual(SP01,0x00)))) // USB(HS1 : 0x480 /SS0 : 0x510) &USB(HS2 : 0x490 / SS1 : 0x520)
+ {
+ \_SB.GP2N(40,1) // Mask OC#(switch to GPIO mode)
+ \_SB.WTGP(13,0) // Power gate GPIO13/43 at same time
+ \_SB.WTGP(43,0)
+ Or(UPWR,0x02, UPWR)
+ Or(UPWR,0x04, UPWR)
+ }
+ }// If(Lequal(XHCV,0xFFFF))
+ }Else{ //if(LNotEqual(\UAMS,0x00))
+
+ // Exiting CS , Apply power if power removed
+ if(And(UPWR,0x01)) // SD Card reader
+ {
+ \_SB.WTGP(60,1)
+ }
+ if(And(UPWR,0x02)) // USB(HS1 : 0x480 /SS0 : 0x510)
+ {
+ \_SB.GP2N(40,0) // Un-mask OC#
+ \_SB.WTGP(13,1)
+ }
+ if(And(UPWR,0x04)) // USB(HS2 : 0x490 / SS1 : 0x520)
+ {
+ \_SB.GP2N(40,0) // Un-mask OC#
+ \_SB.WTGP(43,1)
+ }
+ } //if(LNotEqual(\UAMS,0x00)) // User not present
+ } // End of DUAM
+ }
+
+//USB - END
+
+
+
+// Serial IO Start
+
+ //Power Resource for Audio Codec
+Scope(\_SB.PCI0)
+{
+ PowerResource(PAUD, 0, 0) {
+
+ Name(PSTA, One) // Physical Power Status of Codec 0 - OFF; 1-ON
+ Name(ONTM, Zero) // 0 - Not in Speculative ON ; Non-Zero - elapsed time in Nanosecs after Physical ON
+
+ Name(_STA, One) // PowerResource Logical Status 0 - OFF; 1-ON
+
+ Method(_ON, 0){
+ Store(One, _STA) // Set Logocal power state
+ PUAM() // Tansition Physical state to match current logical state
+ } // End _ON
+
+ Method(_OFF, 0){
+ Store(Zero, _STA) // Set the current power state
+ PUAM() // Tansition Physical state to match current logical state
+ } // End _OFF
+
+ // PUAM - Power Resource User Absent Mode for onboard Audio CODEC
+ // Arguments:
+ //
+ // Uses:
+ // _STA - Variable updated by Power Resource _ON/_OFF methods
+ // \UAMS - Variable updated by GUAM method to show User absent/Present
+ // ONTM - Local variable to store ON time during Speculative ON
+ // ______________________________
+ // | Inputs | Outputs |
+ // ______________________________
+ // | _STA | \UAMS | GPIO | ONTM |
+ // ______________________________
+ // | 1 | 0 | ON | !0 |
+ // | 1 | !0 | ON | !0 |
+ // | 0 | 0 | ON | !0 |
+ // | 0 | !0 | OFF | 0 |
+ // ______________________________
+
+ Method(PUAM, 0, Serialized)
+ {
+ If (LAnd(LEqual(^_STA, Zero), LNotEqual(\UAMS, Zero))) { //New state = OFF (_STA ==0 && \UAMS != 0)
+ If(LEqual(\_SB.RDGP(76), One)) { //skip if Power Resource is already in OFF
+ //Device OFF
+ // Drive GPIO 76 to Low
+ \_SB.WTGP(76, Zero) // Remove CODEC Power
+ Store(Zero, ^PSTA)
+ Store(Zero, ^ONTM)
+ }
+ } Else { // New state = ON (_STA=1) or (_STA=0 and \UAMS=0)
+ If(LNotEqual(^PSTA, One)) { //skip if Power Resource is already in ON
+ SGON(76, One) // VR stagger GPIO76 to high to power on device
+ Store(One, ^PSTA)
+ Store(Timer(), ^ONTM) // Start the timer for this PR
+ }
+ } // Turn power on
+ } //PUAM
+ } //PAUD
+} //Scope(\_SB.PCI0)
+
+If(LNot(HDAD)) { // Check Funtion disable register that gets updated depending on setup option
+ Scope(\_SB.PCI0.HDEF) {
+
+ Method(_PS0,0,Serialized) // D0 Method for HD-A Controller
+ {
+ If(LEqual(\_SB.PCI0.PAUD.ONTM, Zero)){
+ Return()
+ }
+
+ //
+ // Make sure "D0 delay" (AUDD) delay is elapsed before returning _PS0
+ // Local0: Elapse time since the _ON method
+ // VRRD: VR Rampup Delay
+ // AUDD: Time required for device to be ready after power on
+ // Local1 = AUDD + VRRD: Need to incorporate VRRD since the _ON method no longer has VR Rampup Delay
+ // So only need sleep for (Local1 - Local0), the amount of time remaining since the _ON method
+ //
+ Divide(Subtract(Timer(), \_SB.PCI0.PAUD.ONTM), 10000, , Local0) //Store Elapsed time in ms, ignore remainder
+ Add(AUDD, VRRD, Local1) // Incorporate VR Rampup Delay
+ If(LLess(Local0, Local1)) { //Do not sleep if already past the delay requirement audio
+ // Delay for power ramp
+ Sleep(Subtract(Local1, Local0)) //Sleep (AUDD + VRRD - time elapsed)
+ }
+ }
+ Method(_PS3,0,Serialized) // D3 Method for HD-A Controller(Dummy routine to support D3 state)
+ {
+ }
+
+ Name(_PR0, Package(){\_SB.PCI0.PAUD})
+ }
+}// IF(HDAD)
+
+// I2C0
+Scope(\_SB.PCI0.I2C0) { // I2C0
+
+ Method(_PR0, Zero, NotSerialized, 0, PkgObj)
+ {
+ Store(0, Local0) // BIT0 : ADSP Disabled BIT1 : SHUB Disabled
+ If(LEqual(And(SDS0,0x01), 0x00)) { // Update Local0 BIT1 if SHUB disabled in setup
+ Or(0x02,Local0,Local0)
+ }
+
+ If(LEqual(Local0,0x01)){ // Only SHUB enabled
+ Return(Package(){\_SB.PCI0.I2C0.SHUB.PSEN,\_SB.PCI0.I2C1.PXTC})
+ }
+ Return(Package(){}) // Both SHUB and ADSP codec disabled
+ }
+ // D0 Method for I2C0 Controller(Called by _PS0)
+ Method(PS0X,0,Serialized)
+ {
+ Sleep(I20D) // If required add delay in controller to gurantee longest delaying device have time
+ If(And(LEqual(RIC0,1),LEqual(\_SB.RDGP(44), 0x01))) { // Enabled in Setup and not in DFU mode
+ // Drive GIO49 High - routed to Sensor HUB STOP mode
+ \_SB.WTGP(49,1)
+ Sleep(16)
+ }
+ }
+
+ // D3 Method for I2C0 Controller(Called by _PS3)
+ Method(PS3X,0,Serialized)
+ {
+ If(And(LEqual(RIC0,1),LEqual(\_SB.RDGP(44), 0x01))) { // Enabled in Setup and not in DFU mode
+ // Drive GIO49 Low - routed to Sensor HUB STOP mode
+ \_SB.WTGP(49,0)
+ Sleep(16)
+ }
+ }
+} // \_SB.PCI0.I2C0
+Scope(\_SB.PCI0.I2C0.SHUB)
+{
+ // D0 Method Hook for I2C1 Controller(Called by _PS0)
+ Method(_PS0,0,Serialized)
+ {
+ If(LEqual(\_SB.PCI0.I2C0.SHUB.PSEN.ONTM,Zero)){
+ Return()
+ }
+
+ //
+ // Make sure "D0 delay" (IC0D) delay is elapsed before returning _PS0
+ // Local0: Elapse time since the _ON method
+ // VRRD: VR Rampup Delay
+ // IC0D: Time required for device to be ready after power on
+ // Local1 = IC0D + VRRD: Need to incorporate VRRD since the _ON method no longer has VR Rampup Delay
+ // So only need sleep for (Local1 - Local0), the amount of time remaining since the _ON method
+ //
+ Divide(Subtract(Timer(), \_SB.PCI0.I2C0.SHUB.PSEN.ONTM), 10000, , Local0) //Store Elapsed time in ms, ignore remainder
+ Add(IC0D, VRRD, Local1) // Incorporate VR Rampup Delay
+ If(LLess(Local0, Local1)) //Do not sleep if already past the delay requirement 100ms for SensorHub
+ {
+ // Delay for power ramp
+ Sleep(Subtract(Local1, Local0)) //Sleep (IC0D + VRRD - time elapsed)
+ }
+ }
+ Method(_PS3,0,Serialized)
+ {
+ }
+ Method(_PR0, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(And(LEqual(RIC0,1),LEqual(\_SB.RDGP(44), 0x01))) { // Enabled in Setup and not in DFU mode
+ Return(Package(){PSEN,\_SB.PCI0.I2C1.PXTC})
+ } Else {
+ Return(Package(){})
+ }
+ }
+ Method(_PR3, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(And(LEqual(RIC0,1),LEqual(\_SB.RDGP(44), 0x01))) { // Enabled in Setup and not in DFU mode
+ Return(Package(){PSEN,\_SB.PCI0.I2C1.PXTC})
+ } Else {
+ Return(Package(){})
+ }
+ }
+
+ PowerResource(PSEN, 0, 0) {
+ Name(ONTM, Zero) // On Timer
+
+ Method(_STA){
+ If(LEqual(SHSB, 0)){
+ If(LEqual(\_SB.RDGP(46),1)) { //GPIO46 NOTE: 1=> ON; 0=> OFF
+ Return(0x01)
+ }
+ }Else{
+ If(LEqual(\_SB.RDGP(70),1)) { //GPIO70 NOTE: 1=> ON; 0=> OFF
+ Return(0x01)
+ }
+ }
+ Return(0x00)
+ }
+
+ Method(_ON, 0){
+ If(And(LEqual(RIC0,1),LEqual(\_SB.RDGP(44), 0x01))) { // Enabled in Setup and not in DFU mode
+ // Drive GPIO 46 High
+ If(LEqual(SHSB, 0)){
+ If(LEqual(SGON(46, One), One)) { // VR stagger GPIO46 to high to power on device
+ Store(Timer(), ^ONTM) // Start the timer
+ \_SB.GP2B(14, One) // Enable int line from sensor hub. GPIO14 is PIRQM(IOAPIC ln28)
+ }
+ }Else{
+ If(LEqual(SGON(70, One), One)) { // VR stagger GPIO70 to high to power on device
+ Store(Timer(), ^ONTM) // Start the timer
+ \_SB.GP2B(14, One) // Enable int line from sensor hub. GPIO14 is PIRQM(IOAPIC ln28)
+ }
+ }
+ } // End if - Enabled in Setup and not in DFU mode
+ } // End _ON
+
+ Method(_OFF, 0){
+ If(And(LEqual(RIC0,1),LEqual(\_SB.RDGP(44), 0x01))) { // Enabled in Setup and not in DFU mode
+ // Mask interrupt from Sensorhub GPIPIRQ2IOXAPIC: GPI PIRQ[X:I] to IOxAPIC[39:24] Enable
+ \_SB.GP2B(14, Zero) // GPIO14 is PIRQM(IOAPIC ln28)
+ If(LEqual(SHSB, 0)){
+ \_SB.WTGP(46, Zero) // Remove Device Power
+ }Else{
+ \_SB.WTGP(70, Zero)
+ }
+ Store(Zero, ^ONTM)
+ Store(Zero , ^ONTM)
+ }// End if - Enabled in Setup and not in DFU mode
+ } // End _OFF
+ } //PSEN
+} // Scope(SHUB)
+
+ //Merge TouchPanel/Touch Pad Power control - I2C Sensors Need to Turn ON/OFF at same time
+ Scope(\_SB.PCI0.I2C1){
+
+ Method(PS0X,0,Serialized)
+ {
+ // If required add delay in controller to gurantee longest delaying device have time
+ Sleep(I21D)
+ }
+
+ Method(PS3X,0,Serialized)
+ {
+ }
+
+ PowerResource(PXTC, 0, 0){ // power rail for Touch Panel and Touchpad GPIO 89
+
+ Name(ONTM, 0) // 0 - Not in Speculative ON ; Non-Zero - elapsed time in Nanosecs after Physical ON
+ Method(_STA){
+ If(LEqual(\_SB.RDGP(89),1)) { //GPIO89 NOTE: 1=> ON; 0=> OFF
+ Return(0x01)
+ } Else {
+ Return(0x00)
+ }
+ }
+ Method(_ON, 0)
+ {
+ If(LOr(LEqual(\_SB.RDGP(89),0), LEqual(\_SB.RDGP(52),0))) { //GPIO89 NOTE: 1=> ON; 0=> OFF
+ \_SB.WTGP(52,1) //DeAssert GPIO RST
+ SGON(89, One) // VR stagger GPIO89 to high to power on device
+ Store(Timer(), ^ONTM)
+ //Enable int line from touch screen and Touch pad
+ \_SB.GP2A(50, One) //TPL0
+ If(LAnd(LNotEqual(And(SDS1,0x0800), 0x0800),LNotEqual(And(SDS1,0x1000), 0x1000))) { //Precision Enabled
+ \_SB.GP2A(55, One) //TPD0/1
+ }
+ }
+ }// End _ON
+
+ Method(_OFF, 0)
+ {
+ //mask interrupt from Touch Screen and Touch Pad GPIPIRQ2IOXAPIC: GPI PIRQ[X:I] to IOxAPIC[39:24] Enable
+ \_SB.GP2A(50, Zero) //TPL0
+ If(LAnd(LNotEqual(And(SDS1,0x0800), 0x0800),LNotEqual(And(SDS1,0x1000), 0x1000))) { //Precision Enabled
+ \_SB.GP2A(55, Zero) //TPD0/1
+ }
+ \_SB.WTGP(89,0) // Drive GPIO89 to remove power for Touchpad and TouchPanel
+ \_SB.WTGP(52,0) //GPIO RST to Touch Panel
+ Store(Zero , ^ONTM)
+ }// End _OFF
+ } // End PXTC
+
+ Scope(TPL0){
+ Method(_PS0,0,Serialized)
+ {
+ If(LEqual(\_SB.PCI0.I2C1.PXTC.ONTM,Zero)) {
+ Return()
+ }
+
+ //
+ // Make sure "D0 delay" (IC1D) delay is elapsed before returning _PS0
+ // Local0: Elapse time since the _ON method
+ // VRRD: VR Rampup Delay
+ // IC1D: Time required for device to be ready after power on
+ // Local1 = IC1D + VRRD: Need to incorporate VRRD since the _ON method no longer has VR Rampup Delay
+ // So only need sleep for (Local1 - Local0), the amount of time remaining since the _ON method
+ //
+ Divide(Subtract(Timer(), \_SB.PCI0.I2C1.PXTC.ONTM), 10000, , Local0) //Store Elapsed time in ms, ignore remainder
+ Add(IC1D, VRRD, Local1) // Incorporate VR Rampup Delay
+ If(LLess(Local0, Local1)) //Do not sleep if already past the delay requirement 100ms for Touchpanel
+ {
+ // Delay for power ramp
+ Sleep(Subtract(Local1, Local0)) //Sleep (IC1D + VRRD - time elapsed)
+ }
+ }
+ Method(_PS3,0,Serialized)
+ {
+ }
+ Method(_PR0, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(LEqual(And(SDS1,0x01), 0x01))
+ {
+ Return(Package(){\_SB.PCI0.I2C0.SHUB.PSEN,PXTC})
+ } Else {
+ Return(Package() {})
+ }
+ }
+ Method(_PR3, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(LEqual(And(SDS1,0x01), 0x01))
+ {
+ Return(Package(){\_SB.PCI0.I2C0.SHUB.PSEN,PXTC})
+ } Else {
+ Return(Package() {})
+ }
+ }
+ } // End of Scope(TPL0)
+ Scope(TPD1){
+ Method(_PS0,0,Serialized)
+ {
+ If(LEqual(\_SB.PCI0.I2C1.PXTC.ONTM,Zero)) {
+ Return()
+ }
+ //
+ // Make sure "D0 delay" (IC1S) delay is elapsed before returning _PS0
+ // Local0: Elapse time since the _ON method
+ // VRRD: VR Rampup Delay
+ // IC1S: Time required for device to be ready after power on
+ // Local1 = IC1S + VRRD: Need to incorporate VRRD since the _ON method no longer has VR Rampup Delay
+ // So only need sleep for (Local1 - Local0), the amount of time remaining since the _ON method
+ //
+ Divide(Subtract(Timer(), \_SB.PCI0.I2C1.PXTC.ONTM), 10000, , Local0) //Store Elapsed time in ms, ignore remainder
+ Add(IC1S, VRRD, Local1) // Incorporate VR Rampup Delay
+ If(LLess(Local0, Local1)) //Do not sleep if already past the delay requirement 100ms for Touchpanel
+ {
+ // Delay for power ramp
+ Sleep(Subtract(Local1, Local0)) //Sleep (IC1S + VRRD - time elapsed)
+ }
+ }
+ Method(_PS3,0,Serialized)
+ {
+ }
+ Method(_PR0, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(LEqual(And(SDS1,0x08), 0x08)) {
+ Return(Package(){\_SB.PCI0.I2C0.SHUB.PSEN,PXTC})
+ } Else {
+ Return(Package() {})
+ }
+ }
+ Method(_PR3, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(LEqual(And(SDS1,0x08), 0x08)) {
+ Return(Package(){\_SB.PCI0.I2C0.SHUB.PSEN,PXTC})
+ } Else {
+ Return(Package() {})
+ }
+ }
+ }// End of Scope(TPD1)
+
+ //------------------------
+ // Elantech Precision touchpad
+ //------------------------
+ Scope(TPD7){
+
+ //
+ // Delay for Touchpanel & TouchPad - Both share same I2C bus
+ //
+ Method(PS0X,0,Serialized)
+ {
+ If(LEqual(\_SB.PCI0.I2C1.PXTC.ONTM,Zero)) {
+ Return()
+ }
+ //
+ // Make sure "D0 delay" (IC1S) delay is elapsed before returning _PS0
+ // Local0: Elapse time since the _ON method
+ // VRRD: VR Rampup Delay
+ // IC1S: Time required for device to be ready after power on
+ // Local1 = IC1S + VRRD: Need to incorporate VRRD since the _ON method no longer has VR Rampup Delay
+ // So only need sleep for (Local1 - Local0), the amount of time remaining since the _ON method
+ //
+ Divide(Subtract(Timer(), \_SB.PCI0.I2C1.PXTC.ONTM), 10000, , Local0) //Store Elapsed time in ms, ignore remainder
+ Add(IC1S, VRRD, Local1) // Incorporate VR Rampup Delay
+ If(LLess(Local0, Local1)) //Do not sleep if already past the delay requirement 100ms for Touchpanel
+ {
+ // Delay for power ramp
+ Sleep(Subtract(Local1, Local0)) //Sleep (IC1S + VRRD - time elapsed)
+ }
+ }
+
+ Method(_PR0, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(LEqual(And(SDS1,0x0800), 0x0800)) {
+ Return(Package(){PXTC})
+ }Else{
+ Return(Package(){})
+ }
+ }
+ Method(_PR3, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(LEqual(And(SDS1,0x0800), 0x0800)) {
+ Return(Package(){PXTC})
+ }Else{
+ Return(Package(){})
+ }
+ }
+ }// End of Scope(TPD7)
+
+ //------------------------
+ // Synaptics Precision touchpad
+ //------------------------
+ Scope(TPD8){
+
+ //
+ // Delay for Touchpanel & TouchPad - Both share same I2C bus
+ //
+ Method(PS0X,0,Serialized)
+ {
+ If(LEqual(\_SB.PCI0.I2C1.PXTC.ONTM,Zero)) {
+ Return()
+ }
+ //
+ // Make sure "D0 delay" (IC1S) delay is elapsed before returning _PS0
+ // Local0: Elapse time since the _ON method
+ // VRRD: VR Rampup Delay
+ // IC1S: Time required for device to be ready after power on
+ // Local1 = IC1S + VRRD: Need to incorporate VRRD since the _ON method no longer has VR Rampup Delay
+ // So only need sleep for (Local1 - Local0), the amount of time remaining since the _ON method
+ //
+ Divide(Subtract(Timer(), \_SB.PCI0.I2C1.PXTC.ONTM), 10000, , Local0) //Store Elapsed time in ms, ignore remainder
+ Add(IC1S, VRRD, Local1) // Incorporate VR Rampup Delay
+ If(LLess(Local0, Local1)) //Do not sleep if already past the delay requirement 100ms for Touchpanel
+ {
+ // Delay for power ramp
+ Sleep(Subtract(Local1, Local0)) //Sleep (IC1S + VRRD - time elapsed)
+ }
+ }
+
+ Method(_PR0, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(LEqual(And(SDS1,0x1000), 0x1000)) {
+ Return(Package(){PXTC})
+ }Else{
+ Return(Package(){})
+ }
+ }
+ Method(_PR3, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(LEqual(And(SDS1,0x1000), 0x1000)) {
+ Return(Package(){PXTC})
+ }Else{
+ Return(Package(){})
+ }
+ }
+ }// End of Scope(TPD8)
+ }// Scope(\_SB.PCI0.I2C1)
+
+//Serial IO End
+
+ //SDIO Reset support
+ Scope(\_SB.PCI0.SDHC)
+ {
+ // D0 Method for SDHC
+ Method(PS0X,0,Serialized)
+ {
+ // Drive GPIO77 High - 1: No GPIO RST to on board mPCIe/NGFF_WIFI
+ \_SB.WTGP(77,1)
+ }
+ }
+
+ Scope(\_SB.PCI0.SDHC.WI01)
+ {
+ // D0 Method for WiFi
+ Method(PS0X,0,Serialized)
+ {
+ // Drive GPIO77 High - 1: No GPIO RST to on board mPCIe/NGFF_WIFI
+ \_SB.WTGP(77,1)
+ }
+
+ // D3 Method for WiFi
+ Method(PS3X,0,Serialized)
+ {
+ // Drive GPIO77 Low - 0: GPIO RST to on board mPCIe/NGFF_WIFI
+ \_SB.WTGP(77,0)
+ }
+ } //\_SB.PCI0.SDHC.WI01
+
+} //If(LAnd(LEqual(BID,BHB),LEqual(RTD3,1)))
+} // End SSDT
diff --git a/ReferenceCode/AcpiTables/SampleCode/SsdtRtd3/SsdtRtd3.cif b/ReferenceCode/AcpiTables/SampleCode/SsdtRtd3/SsdtRtd3.cif
new file mode 100644
index 0000000..841f0f9
--- /dev/null
+++ b/ReferenceCode/AcpiTables/SampleCode/SsdtRtd3/SsdtRtd3.cif
@@ -0,0 +1,14 @@
+<component>
+ name = "SsdtRtd3"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\AcpiTables\SampleCode\SsdtRtd3\"
+ RefName = "SsdtRtd3"
+[files]
+"SsdtRtd3.sdl"
+"SsdtRtd3.mak"
+"Ult0Rtd3.asl"
+"BRRtd3.asl"
+"Rtd3FFRD.asl"
+"RTD3Common.asl"
+"RTD3Pcie.asl"
+<endComponent>
diff --git a/ReferenceCode/AcpiTables/SampleCode/SsdtRtd3/SsdtRtd3.mak b/ReferenceCode/AcpiTables/SampleCode/SsdtRtd3/SsdtRtd3.mak
new file mode 100644
index 0000000..aaa91eb
--- /dev/null
+++ b/ReferenceCode/AcpiTables/SampleCode/SsdtRtd3/SsdtRtd3.mak
@@ -0,0 +1,82 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2013, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+#<AMI_FHDR_START>
+#
+# Name: SsdtRtd3.mak
+#
+# Description: MAke file to build Aptio ACPI ASL components
+#
+#
+#<AMI_FHDR_END>
+#*************************************************************************
+all : BuildRTD3
+
+BuildRTD3 : $(BUILD_DIR)\Ult0Rtd3.ffs
+
+#-----------------------------------------------------------------------
+# ASL compiler definition
+#-----------------------------------------------------------------------
+!IF "$(ACPIPLATFORM_ASL_COMPILER)"==""
+!ERROR It is an invalid path, please check your ASL compiler path.
+!ENDIF
+
+IASL = $(ACPIPLATFORM_ASL_COMPILER)
+#-----------------------------------------------------------------------
+$(BUILD_DIR)\Ult0Rtd3.aml : $(INTEL_RTD3_ASL_FILE)
+ @cl /C /EP $(INTEL_RTD3_ASL_FILE) > $(BUILD_DIR)\Ult0Rtd3.asl
+ @cl /C /EP $(INTEL_RTD3_COMMON_ASL_FILE) > $(BUILD_DIR)\RTD3Common.asl
+ @cl /C /EP $(INTEL_RTD3_PCIE_ASL_FILE) > $(BUILD_DIR)\RTD3Pcie.asl
+ $(IASL) -p $(BUILD_DIR)\Ult0Rtd3.aml $(BUILD_DIR)\Ult0Rtd3.asl
+
+$(BUILD_DIR)\Ult0Rtd3.sec: $(BUILD_DIR)\Ult0Rtd3.aml
+ $(GENSECTION) -I $*.aml -O $@ -S EFI_SECTION_RAW
+
+#Note. Expand the package with RTD3 tables.
+# DXE phase will load the tables
+# and update Aml contents if provided in Acpiplatform.c
+
+$(BUILD_DIR)\Ult0Rtd3.ffs: $(BUILD_DIR)\Ult0Rtd3.sec
+ $(GENFFSFILE) -B $(BUILD_DIR) -V -o $@ -P1 <<$(BUILD_DIR)\Ult0Rtd3.pkg
+
+PACKAGE.INF
+[.]
+BASE_NAME = Ult0Rtd3
+FFS_FILEGUID = 7FFC3536-0A8A-448B-95F4-39F5B9F09ADD
+FFS_FILETYPE = EFI_FV_FILETYPE_FREEFORM
+FFS_ATTRIB_CHECKSUM = TRUE
+
+IMAGE_SCRIPT =
+{
+ Compress (dummy) {
+ $(PROJECT_DIR)\$(BUILD_DIR)\Ult0Rtd3.sec
+ }
+}
+<<KEEP
+
+
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/AcpiTables/SampleCode/SsdtRtd3/SsdtRtd3.sdl b/ReferenceCode/AcpiTables/SampleCode/SsdtRtd3/SsdtRtd3.sdl
new file mode 100644
index 0000000..db8df2a
--- /dev/null
+++ b/ReferenceCode/AcpiTables/SampleCode/SsdtRtd3/SsdtRtd3.sdl
@@ -0,0 +1,93 @@
+TOKEN
+ Name = "RTD3_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable RTD3 support in Project"
+ TokenType = Boolean
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+End
+
+TOKEN
+ Name = "ULT0RTD3_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable RTD3 support for Whitetip Mountain or Sawtooth Peak CRB"
+ TokenType = Boolean
+ TargetMAK = Yes
+ TargetH = Yes
+ Token = "RTD3_SUPPORT" "=" "1"
+End
+
+TOKEN
+ Name = "BRRTD3_SUPPORT"
+ Value = "0"
+ Help = "Main switch to enable RTD3 support for Basking Ridge CRB"
+ TokenType = Boolean
+ TargetMAK = Yes
+ TargetH = Yes
+ Token = "RTD3_SUPPORT" "=" "1"
+End
+
+TOKEN
+ Name = "RTD3FFRD_SUPPORT"
+ Value = "0"
+ Help = "Main switch to enable RTD3 support for FFRD SKU CRB"
+ TokenType = Boolean
+ TargetMAK = Yes
+ TargetH = Yes
+ Token = "RTD3_SUPPORT" "=" "1"
+End
+
+PATH
+ Name = "INTEL_SSDTRTD3_DIR"
+End
+
+TOKEN
+ Name = "INTEL_RTD3_ASL_FILE"
+ Value = "$(INTEL_SSDTRTD3_DIR)\Ult0Rtd3.asl"
+ TokenType = Expression
+ TargetMAK = Yes
+ Token = "ULT0RTD3_SUPPORT" "=" "1"
+End
+
+TOKEN
+ Name = "INTEL_RTD3_ASL_FILE"
+ Value = "$(INTEL_SSDTRTD3_DIR)\BRRtd3.asl"
+ TokenType = Expression
+ TargetMAK = Yes
+ Token = "BRRTD3_SUPPORT" "=" "1"
+End
+
+TOKEN
+ Name = "INTEL_RTD3_ASL_FILE"
+ Value = "$(INTEL_SSDTRTD3_DIR)\Rtd3FFRD.asl"
+ TokenType = Expression
+ TargetMAK = Yes
+ Token = "RTD3FFRD_SUPPORT" "=" "1"
+End
+
+TOKEN
+ Name = "INTEL_RTD3_COMMON_ASL_FILE"
+ Value = "$(INTEL_SSDTRTD3_DIR)\RTD3Common.asl"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+TOKEN
+ Name = "INTEL_RTD3_PCIE_ASL_FILE"
+ Value = "$(INTEL_SSDTRTD3_DIR)\RTD3Pcie.asl"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+MODULE
+ Help = "Includes SsdtRtd3.mak to Project"
+ File = "SsdtRtd3.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\Ult0Rtd3.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+ Token = "RTD3_SUPPORT" "=" "1"
+End
diff --git a/ReferenceCode/AcpiTables/SampleCode/SsdtRtd3/Ult0Rtd3.asl b/ReferenceCode/AcpiTables/SampleCode/SsdtRtd3/Ult0Rtd3.asl
new file mode 100644
index 0000000..e55ac2f
--- /dev/null
+++ b/ReferenceCode/AcpiTables/SampleCode/SsdtRtd3/Ult0Rtd3.asl
@@ -0,0 +1,1718 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Sandy Bridge *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+
+DefinitionBlock (
+ "Rtd3.aml",
+ "SSDT",
+ 1,
+ "AcpiRef",
+ "Ult0Rtd3",
+ 0x1000
+ )
+{
+#define ULT0RTD3 1
+Include ("RTD3Common.asl")
+#undef ULT0RTD3
+
+External(PEBS, IntObj) // PCI Express BAR address
+External(BWT1, IntObj) // WhitTipMountain1
+External(BSPC, IntObj) // SawToothPeak
+
+External(\_SB.PCI0.I2C0.ACD0, DeviceObj)
+External(\_SB.PCI0.I2C0.ACD1, DeviceObj)
+External(\_SB.PCI0.I2C0.ACD2, DeviceObj)
+External(\_SB.PCI0.I2C1.TPL1, DeviceObj) // Touch panel
+External(\_SB.PCI0.I2C1.TPL2, DeviceObj) // NTRIG Digitizer Touch Panel
+External(\_SB.PCI0.I2C1.TPD2, DeviceObj) // Alps touchpad
+External(\_SB.PCI0.I2C1.TPL3, DeviceObj) // EETI Touch Panel
+External(\_SB.PCI0.I2C1.TPD3, DeviceObj) // Cypress touchpad
+External(\_SB.PCI0.I2C1.TPD7, DeviceObj) // Precision Elantech touchpad
+External(\_SB.PCI0.I2C1.TPD8, DeviceObj) // Precision Synaptics touchpad
+External(\_SB.PCI0.SDHC, DeviceObj) //SDIO
+External(\_SB.PCI0.SDHC.WI01, DeviceObj) //SDIO Wifi
+External(\_SB.PCI0.XHC.RHUB.HS10, DeviceObj) //xHCI SSP port 1
+External(S0ID)
+External(\_SB.PCI0.XHC.RHUB.HS11, DeviceObj) //xHCI SSP port 2
+External(\_SB.PCI0.XHC.RHUB.HS04, DeviceObj) //EHCI HSP port 4
+
+External(ADSD, FieldUnitObj)
+External(CODS, IntObj)
+External(\GO17)
+
+
+External(DSPD)
+External(RWAG, IntObj)
+
+If(LAnd(LOr(LEqual(BID,BWT1), LEqual(BID,BSPC)),LEqual(RTD3,1))) {
+
+If(LEqual(RWAG,1)) { // this enables board W/A for RTD3 on slot 1
+ //
+ // PCIe RTD3 - for slot#1
+ //
+ Scope(\_SB.PCI0.RP01)
+ {
+ Name(SLOT, 1)
+ Name(RSTG, 77) // reset GPIO
+ Name(PWRG, 83) // power GPIO
+ Name(RONP, 1) // reset on polarity
+ Name(PONP, 0) // power on polarity
+ Name(NGFF, 1) // Is Slot NGFF form factor 1- Yes 0- No
+ Name(SCLK, 0x1) // Source Clock Enable Bit Location(BIT0)
+ Include("Rtd3Pcie.asl")
+ }
+}
+
+If(LEqual(RWAG,6)) { // this enables board W/A for RTD3 on slot 6
+ //
+ // PCIe RTD3 - for slot#6
+ //
+ Scope(\_SB.PCI0.RP06)
+ {
+ Name(SLOT, 6)
+ Name(RSTG, 77) // reset GPIO
+ Name(PWRG, 83) // power GPIO
+ Name(RONP, 1) // reset on polarity
+ Name(PONP, 0) // power on polarity
+ Name(NGFF, 0) // Is Slot NGFF form factor 1- Yes 0- No
+ Name(SCLK, 0x2) // Source Clock Enable Bit Location(BIT1)
+ Include("Rtd3Pcie.asl")
+ }
+}
+
+ //
+ // PCIe RTD3 - for slot#3
+ //
+ Scope(\_SB.PCI0.RP03)
+ {
+ Name(SLOT, 3)
+ Name(RSTG, 59) // reset GPIO
+ Name(PWRG, 60) // power GPIO
+ Name(RONP, 1) // reset on polarity
+ Name(PONP, 0) // power on polarity
+ Name(NGFF, 0) // Is Slot NGFF form factor 1- Yes 0- No
+ Name(SCLK, 0x4) // Source Clock Enable Bit Location(BIT2)
+ Include("Rtd3Pcie.asl")
+ }
+
+ //
+ // PCIe RTD3 - for slot#4
+ //
+ Scope(\_SB.PCI0.RP04)
+ {
+ Name(SLOT, 4)
+ Name(RSTG, 56) // reset GPIO
+ Name(PWRG, 57) // power GPIO
+ Name(RONP, 1) // reset on polarity
+ Name(PONP, 0) // power on polarity
+ Name(NGFF, 0) // Is Slot NGFF form factor 1- Yes 0- No
+ Name(SCLK, 0x8) // Source Clock Enable Bit Location(BIT3)
+ Include("Rtd3Pcie.asl")
+ }
+
+ //
+ // PCIe RTD3 - for slot#5
+ //
+ Scope(\_SB.PCI0.RP05)
+ {
+ Name(SLOT, 5)
+ Name(RSTG, 48) // reset GPIO
+ Name(PWRG, 84) // power GPIO
+ Name(RONP, 1) // reset on polarity
+ Name(PONP, 0) // power on polarity
+ Name(NGFF, 0) // Is Slot NGFF form factor 1- Yes 0- No
+ Name(SCLK, 0x10) // Source Clock Enable Bit Location(BIT4)
+ Include("Rtd3Pcie.asl")
+ }
+
+//SATA - START
+ Scope(\_SB.PCI0.SAT0) {
+
+ // D0 Method for SATA HBA
+ Method(_PS0,0,Serialized)
+ {
+ }
+
+ // D3 Method for SATA HBA
+ Method(_PS3,0,Serialized)
+ {
+ }
+
+ OperationRegion(SMIO,PCI_Config,0x24,4)
+ Field(SMIO,AnyAcc, NoLock, Preserve) {
+ Offset(0x00), // SATA MABR6
+ MBR6, 32, // SATA ABAR
+ }
+
+ Scope(PRT1) {
+ Name(UDSM, 0) // Use _DSM for ZPODD control. 0 = Disabled; 1 = Enabled
+
+ //
+ // _DSM Device Specific Method supporting SATA ZPODD function
+ //
+ // Arg0: UUID Unique function identifier
+ // Arg1: Integer Revision Level
+ // Arg2: Integer Function Index
+ // Arg3: Package Parameters
+ //
+ Method (_DSM, 4, NotSerialized, 0, UnknownObj, {BuffObj, IntObj, IntObj, PkgObj}) {
+ if(LNot(And(RCG0,1))){
+ Return(0) // HDD do nothing
+ }
+ If (LEqual(Arg0, ToUUID ("bdfaef30-aebb-11de-8a39-0800200c9a66"))) {
+ //
+ // Switch by function index
+ //
+ Switch (ToInteger(Arg2)) {
+ //
+ // Standard query - A bitmask of functions supported
+ // Supports function 0-5
+ //
+ Case (0) {
+ if(LEqual(ToInteger(Arg1),1)){ // Check Revision
+ Return (Buffer () {0xF})
+ }
+ }
+ Case (1) { // Enable ZPODD feature
+ // Function 1: Enable Power OFF/ON. Enables the Power Off/ON hardware in the system.
+ // When called, the BIOS is informed that the host software is using this interface.
+ If(LEqual(\_SB.PCI0.SAT0.PRT1.UDSM, Zero)){ //if Ownership not acquired
+ Store (1, \_SB.PCI0.SAT0.PRT1.UDSM) // Indicate ZPODD _DSM control enabled
+ }
+ Return (1) // Enable Power ON/OFF
+ }
+ Case (2) {
+ \_SB.WTGP(86,1) // Power Off the device
+ Store(0,\GO17) // Enable GPIO86
+ Return (1)
+ }
+ Case (3) {
+ \_SB.WTGP(86,0) // Power ON Device
+ Sleep(16) // To turn the FET
+
+ Return (1)
+ }
+ Default {
+ Return (0)
+ }
+ }
+ } Else {
+ Return (0)
+ }
+ }
+
+ Name(_PR0, Package(){P1PR})
+ Name(_PR3, Package(){P1PR})
+
+ Name(WKEN, 0) // Device on this port wake enabled?
+
+ Method(_S0W, 0)
+ {
+ if(LNot(And(RCG0,1))){
+ }Else{
+ // PMEs can be generated from D3cold
+ If(And(\_SB.OSCO, 0x04))
+ {
+ Return(4) // OS comprehends D3cold, as described via \_SB._OSC
+ }Else{
+ Return(3)
+ }
+ }
+ } // End _S0W
+
+ Method(_DSW, 3)
+ {
+ if(LNot(And(RCG0,1))){
+ Return()
+ }
+ If(Arg1)
+ {
+ Store(1,\GO17)
+ Store(0, WKEN)
+ }Else{ // Staying in S0
+ If(LAnd(Arg0, Arg2)) // Exiting D0 and arming for wake
+ { // Set WKEN to allow _OFF to enable the wake event
+ Store(1, WKEN)
+ } Else { // Clear WKEN to allow _OFF to enable the wake event,
+ // either because staying in D0 or disabling wake
+ Store(0, WKEN)
+ }
+ }
+ } // End _DSW
+
+
+ PowerResource(P1PR, 0, 0)
+ {
+ Name(OFTM, Zero) // Time returned by Timer() when the Power resource was turned OFF
+
+ Method(_STA)
+ {
+ if(LNot(And(RCG0,1))){
+ If(LEqual(\_SB.RDGP(90),1)) { //GPIO90
+ Return(0x00)
+ } Else {
+ Return(0x01)
+ }
+ }Else{
+ // Read ZPODD Status
+ if(LEqual(RDGP(86),0)){
+ Return(0x01)
+ }Else{
+ Return(0x00)
+ }
+ }
+ }
+
+ Method(_ON, 0)
+ {
+ If(LNotEqual(^OFTM, Zero)) { // if OFTM != 0 => Disk was turned OFF by asl
+ Divide(Subtract(Timer(), ^OFTM), 10000, , Local0) //Store Elapsed time in ms
+ Store(Zero, ^OFTM) // Reset OFTM to zero to indicate minimum 50ms requirement does not apply when _ON called next time
+ If(LLess(Local0, 50)) // Do not sleep if already past the delay requirement
+ {
+ Sleep(Subtract(50, Local0)) // Sleep 50ms - time elapsed
+ }
+ }
+
+ if(LNot(And(RCG0,1))){
+ SGON(90, Zero) // VR stagger GPIO90 to low to power on device
+ }Else{
+
+ SGON(86, Zero) // VR stagger GPIO86 to low to power on device
+ }
+ }
+
+
+ Method(_OFF, 0)
+ {
+ If(LNot(And(RCG0,1))){
+ Add(\_SB.PCI0.SAT0.MBR6,0x198 ,Local0)
+ OperationRegion(PSTS, SystemMemory, Local0, 0x18)
+ Field(PSTS, DWordAcc, NoLock, Preserve)
+ {
+ Offset(0x0),
+ CMST, 1, //PxCMD.ST
+ CSUD, 1, //PxCMD.SUD
+ , 2,
+ CFRE, 1, //PxCMD.FRE
+ Offset(0x10),
+ SDET, 4, //PxSSTS.DET
+ Offset(0x14),
+ CDET, 4 //PxSCTL.DET
+ }
+ // if S0Ix enabled
+ If(LEqual(S0ID, 1))
+ {
+ If(LOr(LEqual(SDET, 1), LEqual(SDET, 3))) //Offline flow only if Device detected and Phy not offline
+ {
+ //Clear ST (PxCMD.ST) 198[0]
+ Store(0, CMST)
+ //Clear FRE 198[4]
+ Store(0, CFRE)
+ //Clear SUD (PxCMD.SUD) 198[1]
+ Store(0, CSUD)
+ //Set DET to 4 (PxSCTL.DET) 1ac[3:0]
+ Store(4, CDET)
+ Sleep(16)
+ //Wait until PxSSTS.DET == 4
+ While(LNotEqual(SDET, 4)){
+ Sleep(16)
+ }
+ }
+ // Drive GPIO90 to High to power off device
+ \_SB.WTGP(90,1)
+ } // if S0Ix enabled
+ }Else{
+
+ \_SB.WTGP(86,1) // Drive GPIO86 to low to power off device.
+ Store(0,\GO17) // Enable ZPODD SATA_ODD_DA_N to generate SCI
+ }
+
+ Store(Timer(), ^OFTM) // Store time when Disk turned OFF(non-zero OFTM indicate minimum 50ms requirement does apply when _ON called next time)
+ }
+ } // End P1PR
+ } //End PRT1
+
+ // PRT2 . Controlled by EC pin (PF6/PWMU4A/ExCTS).
+ Scope(PRT2) { // Port 2- Cable Connect power
+
+ PowerResource(P2PR, 0, 0){
+ Name(OFTM, Zero) // Time returned by Timer() when the Power resource was turned OFF
+
+ Method(_STA){
+ If(LEqual(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.ECAV)),1)) { // Read SATA_CABLE_PWR_EN from EC
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.SPT2)), Local0)
+ } Else {
+ Store(1, Local0) //This FET is ON during POST. It cannot be turned OFF until EC driver is loaded
+ }
+ If(LEqual(Local0,0)) { // Read SATA_CABLE_PWR_EN from EC
+ Return(0x00)
+ } Else {
+ Return(0x01)
+ }
+
+ Return(0x01)
+ }
+ Method(_ON, 0)
+ {
+ If(LNotEqual(^OFTM, Zero)) { // if OFTM != 0 => Disk as turned OFF by asl
+ Divide(Subtract(Timer(), ^OFTM), 10000, , Local0) //Store Elapsed time in ms
+ Store(Zero, ^OFTM) // Reset OFTM to zero to indicate minimum 50ms requirement does not apply when _ON called next time
+ If(LLess(Local0, 50)) // Do not sleep if already past the delay requirement
+ {
+ Sleep(Subtract(50, Local0)) // Sleep 50ms - time elapsed
+ }
+ }
+
+ //SET SATA_CABLE_PWR_EN and Send EC UpdateDevPwr - 0x2C
+ If(LEqual(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.ECAV)),1)) { // Check If EC driver loaded
+ //
+ // Special case for EC driven device power on using VR staggering (SGON is for GPIO driven device power on)
+ // Marked with "//VR Staggering" at the end of line.
+ // //VR Staggering
+ // Check for VR staggering //VR Staggering
+ // //VR Staggering
+ Divide(Subtract(Timer(), \LONT), 10000, , Local0) //Store Elapsed time in ms, ignore remainder //VR Staggering
+ If(LLess(Local0, \VRSD)) { //Do not sleep if already past the delay requirement //VR Staggering
+ // Delay for power ramp using Timer Based Sleep //VR Staggering
+ Sleep(Subtract(\VRSD, Local0)) //VR Staggering
+ } //VR Staggering
+
+ \_SB.PCI0.LPCB.H_EC.ECWT(One, RefOf(\_SB.PCI0.LPCB.H_EC.SPT2))
+ \_SB.PCI0.LPCB.H_EC.ECMD (0x2E)
+
+ Store(Timer(), \LONT) // Update the global Last ON Method Timer //VR Staggering
+ }
+ }
+ Method(_OFF, 0)
+ {
+ If(LEqual(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.ECAV)),1)) { // Check If EC driver loaded
+ Add(\_SB.PCI0.SAT0.MBR6,0x218 ,Local0)
+ OperationRegion(PSTS, SystemMemory, Local0, 0x18)
+ Field(PSTS, DWordAcc, NoLock, Preserve) {
+ Offset(0x0),
+ CMST, 1, //PxCMD.ST
+ CSUD, 1, //PxCMD.SUD
+ , 2,
+ CFRE, 1, //PxCMD.FRE
+ Offset(0x10),
+ SDET, 4,
+ Offset(0x14),
+ CDET, 4 //PxSCTL.DET
+ }
+ If(LOr(LEqual(SDET, 1), LEqual(SDET, 3))){ //Offline flow only if Device detected and Phy not offline
+ //Clear ST (PxCMD.ST)
+ Store(0, CMST)
+ //Clear FRE
+ Store(0, CFRE)
+ //Clear SUD (PxCMD.SUD)
+ Store(0, CSUD)
+ //Set DET to 4 (PxSCTL.DET)
+ Store(4, CDET)
+ Sleep(16)
+ //Wait until PxSSTS.DET == 4
+ While(LNotEqual(SDET, 4)){
+ Sleep(16)
+ }
+ }
+ //Clear SATA_CABLE_PWR_EN and Send EC UpdateDevPwr - 0x2C
+ \_SB.PCI0.LPCB.H_EC.ECWT(Zero, RefOf(\_SB.PCI0.LPCB.H_EC.SPT2))
+ \_SB.PCI0.LPCB.H_EC.ECMD (0x2E)
+ }
+ Store(Timer(), ^OFTM) // Store time when Disk turned OFF(non-zero OFTM indicate minimum 50ms requirement does apply when _ON called next time)
+ }
+ } // End P2PR
+
+ Name(_PR0, Package(){P2PR})
+ Name(_PR3, Package(){P2PR})
+
+ } //End PRT2
+
+ // PRT3
+ Scope(PRT3) {
+
+// RCG0 : BIT2BIT3 : 00 - Disabled 01 - 1.5Minicard(GPIO83) 10:3.3Minicard(GPIO85)
+ PowerResource(P3PR, 0, 0){
+ Method(_STA){
+ if(LEqual(And(RCG0,0xC),0x04)){ // 1.5Minicard GPIO83
+ Return(\_SB.RDGP(83))
+ }
+ if(LEqual(And(RCG0,0xC),0x08)){ // 3.3Minicard GPIO85
+ Return(\_SB.RDGP(85))
+ }
+ Return(0x00) // Disabled
+ }
+ Method(_ON, 0)
+ {
+ if(LEqual(And(RCG0,0xC),0x04)){ // 1.5Minicard GPIO83
+ SGON(83, One) // VR stagger GPIO83 to high to power on device
+ }
+ if(LEqual(And(RCG0,0xC),0x08)){ // 3.3Minicard GPIO85
+ SGON(85, One) // VR stagger GPIO85 to high to power on device
+ }
+ }
+ Method(_OFF, 0)
+ {
+ Add(\_SB.PCI0.SAT0.MBR6,0x298 ,Local0)
+ OperationRegion(PSTS, SystemMemory, Local0, 0x18)
+ Field(PSTS, DWordAcc, NoLock, Preserve) {
+ Offset(0x0),
+ CMST, 1, //PxCMD.ST
+ CSUD, 1, //PxCMD.SUD
+ , 2,
+ CFRE, 1, //PxCMD.FRE
+ Offset(0x10),
+ SDET, 4,
+ Offset(0x14),
+ CDET, 4 //PxSCTL.DET
+ }
+ If(LOr(LEqual(SDET, 1), LEqual(SDET, 3))){ //Offline flow only if Device detected and Phy not offline
+ //Clear ST (PxCMD.ST)
+ Store(0, CMST)
+ //Clear FRE
+ Store(0, CFRE)
+ //Clear SUD (PxCMD.SUD)
+ Store(0, CSUD)
+ //Set DET to 4 (PxSCTL.DET)
+ Store(4, CDET)
+ Sleep(16)
+ //Wait until PxSSTS.DET == 4
+ While(LNotEqual(SDET, 4)){
+ Sleep(16)
+ }
+ }
+
+ if(LEqual(And(RCG0,0xC),0x04)){ // 1.5Minicard GPIO83
+ \_SB.WTGP(83,0)
+ Sleep(16) // Delay for power ramp
+ }
+ if(LEqual(And(RCG0,0xC),0x08)){ // 3.3Minicard GPIO85
+ \_SB.WTGP(85,0)
+ Sleep(16) // Delay for power ramp
+ }
+ }
+ } // End P2PR
+
+ Name(_PR0, Package(){P3PR})
+ Name(_PR3, Package(){P3PR})
+
+ } //End PRT3
+
+
+ //
+ // _DSM Device Specific Method supporting AHCI DEVSLP
+ //
+ // Arg0: UUID Unique function identifier
+ // Arg1: Integer Revision Level
+ // Arg2: Integer Function Index
+ // Arg3: Package Parameters
+ //
+ Name(DRV, 0) // Storage for _DSM Arg3 parameter 0
+ Name(PWR, 0) // Storage for _DSM Arg3 parameter 1
+
+ Method (_DSM, 4, Serialized, 0, UnknownObj, {BuffObj, IntObj, IntObj, PkgObj}) {
+ If (LEqual(Arg0, ToUUID ("E4DB149B-FCFE-425b-A6D8-92357D78FC7F"))) {
+ //
+ // Switch by function index
+ //
+ Switch (Arg2) {
+ Case (0) {
+ // Standard query - A bitmask of functions supported
+ // Supports function 0-3
+ Return(0x0f)
+ }
+ Case (1) {
+ // Query Device IDs (Addresses) of children where drive power and/or DevSleep are supported.
+ // LPT-LP SATA HBA provides autonomous link (DevSleep) support, return a package of 0 elements
+ Return( Package(){}) // SATA HBA provides native DevSleep
+ }
+ //
+ // Control power to device.
+ //
+ Case (2) {
+ Store(ToInteger(DerefOf(Index(Arg3, Zero))), DRV)
+ Store(ToInteger(DerefOf(Index(Arg3, One))), PWR)
+
+ Switch(DRV){
+ Case (Ones){
+ // Turn on drive and link power to all drives. Note that even though
+ If(PWR){ // Applying Power
+ //^PRT0.P0PR._ON() // apply power to port 0
+ \_SB.PCI0.SAT0.PRT1.P1PR._ON() // apply power to port 1
+ \_SB.PCI0.SAT0.PRT2.P2PR._ON() // apply power to port 2
+ }
+ }
+ } //Switch(DRV)
+ Return (0)
+ } //Case (2)
+ //
+ // Current status of Device/Link of Port
+ //
+ Case (3){
+ Store(ToInteger(DerefOf(Index(Arg3, Zero))), DRV)
+ Switch(DRV){
+ Case (0x0000FFFF){ // SATA Port 0
+ // Bit0 => Device power state
+ Store(1, Local0) // always ON
+ Return (Local0)
+ }
+ Case (0x0001FFFF){ // SATA Port 1
+ // Bit0 => Device power state
+ If(LEqual(\_SB.PCI0.SAT0.PRT1.P1PR._STA(), 0)){
+ Store(0, Local0)
+ }Else{
+ Store(1, Local0)
+ }
+ Return (Local0)
+ }
+ Case (0x0002FFFF){ // SATA Port 2
+ // Bit0 => Device power state
+ If(LEqual(\_SB.PCI0.SAT0.PRT2.P2PR._STA(), 0)){
+ Store(0, Local0)
+ }Else{
+ Store(1, Local0)
+ }
+ Return (Local0)
+ }
+ Default { // Invalid SATA Port - error
+ Return (Ones)
+ }
+ }
+ }
+ Default {
+ Return (0)
+ }
+ }
+ } Else { // UUID does not match
+ Return (0)
+ }
+ } //Method(_DSM)
+
+ } //Scope(\_SB.PCI0.SAT0)
+
+// SATA - END
+
+//USB - START
+ Scope(\_SB.PCI0.XHC){
+
+ Method(_S0W, 0)
+ { // PMEs can be generated from D3(hot)
+ Return(3)
+ } // End _S0W
+ }
+
+ Scope(\_SB.PCI0.XHC.RHUB){ //USB XHCI RHUB
+ Method(_PS0,0,Serialized)
+ {
+ Store(0x00,USPP)
+ }
+ Method(_PS2,0,Serialized)
+ {
+
+ OperationRegion (XHCM, SystemMemory, And(MEMB,0xFFFF0000), 0x600)
+ Field (XHCM, DWordAcc, NoLock, Preserve)
+ {
+ Offset(0x2),
+ XHCV,16,
+ Offset(0x480),
+ HP01, 1, // HS port 1
+ Offset(0x490),
+ HP02, 1, // HS port 2
+ Offset(0x510),
+ SP00, 1, // SS port 0
+ Offset(0x520),
+ SP01, 1, // SS port 1
+ }
+ If(LEqual(XHCV,0xFFFF)) // Controller in D3Hot(MEM_BASE not decoded)
+ {
+ Return()
+ }
+ If(LAnd(LEqual(HP01,0x00),LEqual(SP00,0x00))) // USB(HS1 : 0x480 /SS0 : 0x510)
+ {
+ Or(USPP,0x02, USPP)
+ }
+ If(LAnd(LEqual(HP02,0x00),LEqual(SP01,0x00))) // USB(HS2 : 0x490 / SS1 : 0x520)
+ {
+ Or(USPP,0x04, USPP)
+ }
+ } // End of PS2 method
+ Method(_PS3,0,Serialized)
+ {
+ } // End of PS3 method
+ }
+
+If(LNotEqual(And(XHPR,0xF),0x0)){
+ Scope(\) {
+ PowerResource(PX01, 0, 0){ // power rail for USB3.0 ports 1 - GPIO 13
+ Method(_STA){
+ If(LEqual(\_SB.RDGP(13),1)) { //GPIO13
+ Return(0x01)
+ } Else {
+ Return(0x00)
+ }
+ }
+ Method(_ON, 0)
+ { // Turn on
+ SGON(13, One) // VR stagger GPIO13 to high to power on device
+ }
+
+ Method(_OFF, 0)
+ { // Turn off
+ \_SB.WTGP(13,0)
+ }
+ } // End PX01
+ }
+}
+If(LNotEqual(And(XHPR,0xF0),0x0)){
+ Scope(\) {
+ PowerResource(PX02, 0, 0){ // power rail for USB3.0 ports 2 - GPIO 43
+ Method(_STA){
+ If(LEqual(\_SB.RDGP(43),1)) { //GPIO43
+ Return(0x01)
+ } Else {
+ Return(0x00)
+ }
+ }
+ Method(_ON, 0)
+ { // Turn on
+ SGON(43, One) // VR stagger GPIO43 to high to power on device
+ }
+
+ Method(_OFF, 0)
+ { // Turn off
+ \_SB.WTGP(43,0)
+ }
+ } // End PX02
+
+ }
+}
+
+if(LEqual(And(RCG0,2),2))
+{
+ // USB Camera RTD3 support is enabled
+ Scope(\_SB.PCI0.XHC.RHUB.HS04){
+ PowerResource(PX04, 0, 0){ // power rail for USB2.0 Port 4 - GPIO 25
+ Method(_STA){
+ If(LEqual(\_SB.RDGP(25),1)) { //GPIO25
+ Return(0x01)
+ } Else {
+ Return(0x00)
+ }
+ }
+ Method(_ON, 0)
+ { // Turn on
+ SGON(25, One) // VR stagger GPIO25 to high to power on device
+ }
+
+ Method(_OFF, 0)
+ { // Turn off
+ \_SB.WTGP(25,0)
+ }
+ } // End PX04
+
+ Method(_PR0, Zero, NotSerialized, 0, PkgObj)
+ {
+ Return(Package(){\_SB.PCI0.XHC.RHUB.HS04.PX04})
+ } // End of Method _PR0
+ Method(_PR2, Zero, NotSerialized, 0, PkgObj)
+ {
+ Return(Package(){\_SB.PCI0.XHC.RHUB.HS04.PX04})
+ } // End of Method _PR2
+ Method(_PR3, Zero, NotSerialized, 0, PkgObj)
+ {
+ Return(Package(){\_SB.PCI0.XHC.RHUB.HS04.PX04})
+ } // End of Method _PR3
+ } // Scope(\_SB.PCI0.XHC.RHUB.HS04)
+}
+
+If(LEqual(And(XHPR,0xF),0x01))
+{
+ Scope(\_SB.PCI0.XHC.RHUB.HS01){
+ Name(_PR0, Package(){\PX01})
+ Name(_PR2, Package(){\PX01})
+ Name(_PR3, Package(){\PX01})
+ }
+}
+
+If(LEqual(And(XHPR,0xF0),0x10)){
+ Scope(\_SB.PCI0.XHC.RHUB.HS02){
+ Name(_PR0, Package(){\PX02})
+ Name(_PR2, Package(){\PX02})
+ Name(_PR3, Package(){\PX02})
+ }
+}
+
+If(LEqual(And(XHPR,0xF),0x02)){
+ Scope(\_SB.PCI0.XHC.RHUB.SSP1){
+ Name(_PR0, Package(){\PX01})
+ Name(_PR2, Package(){\PX01})
+ Name(_PR3, Package(){\PX01})
+ } // End of Scope(\_SB.PCI0.XHC.RHUB.SSP1)
+}
+
+If(LEqual(And(XHPR,0xF0),0x20)){
+ Scope(\_SB.PCI0.XHC.RHUB.SSP2){
+ Name(_PR0, Package(){\PX02})
+ Name(_PR2, Package(){\PX02})
+ Name(_PR3, Package(){\PX02})
+ } // End of Scope(\_SB.PCI0.XHC.RHUB.SSP2)
+}
+//USB - END
+// Serial IO Start
+
+//Power Resource for Audio Codec
+Scope(\_SB.PCI0)
+{
+ PowerResource(PAUD, 0, 0) {
+
+ Name(PSTA, One) // Physical Power Status of Codec 0 - OFF; 1-ON
+ Name(ONTM, Zero) // 0 - Not in Speculative ON ; Non-Zero - elapsed time in Nanosecs after Physical ON
+
+ Name(_STA, One) // PowerResource Logical Status 0 - OFF; 1-ON
+
+ Method(_ON, 0){
+ Store(One, _STA) // Set Logocal power state
+ PUAM() // Tansition Physical state to match current logical state
+ } // End _ON
+
+ Method(_OFF, 0){
+ Store(Zero, _STA) // Set the current power state
+ PUAM() // Tansition Physical state to match current logical state
+ } // End _OFF
+
+ // PUAM - Power Resource User Absent Mode for onboard Audio CODEC
+ // Arguments:
+ //
+ // Uses:
+ // _STA - Variable updated by Power Resource _ON/_OFF methods
+ // \UAMS - Variable updated by GUAM method to show User absent/Present
+ // ONTM - Local variable to store ON time during Speculative ON
+ // ______________________________
+ // | Inputs | Outputs |
+ // ______________________________
+ // | _STA | \UAMS | GPIO | ONTM |
+ // ______________________________
+ // | 1 | 0 | ON | !0 |
+ // | 1 | !0 | ON | !0 |
+ // | 0 | 0 | ON | !0 |
+ // | 0 | !0 | OFF | 0 |
+ // ______________________________
+
+ Method(PUAM, 0, Serialized)
+ {
+ If (LAnd(LEqual(^_STA, Zero), LNotEqual(\UAMS, Zero))) { //New state = OFF (_STA ==0 && \UAMS != 0)
+ If(LEqual(\_SB.RDGP(76), One)) { //skip if Power Resource is already in OFF
+ //Device OFF
+ // Drive GPIO 76 to Low
+ \_SB.WTGP(76, Zero) // Remove CODEC Power
+ Store(Zero, ^PSTA)
+ Store(Zero, ^ONTM)
+ }
+ } Else { // New state = ON (_STA=1) or (_STA=0 and \UAMS=0)
+ If(LNotEqual(^PSTA, One)) { //skip if Power Resource is already in ON
+ SGON(76, One) // VR stagger GPIO76 to High to power on device
+ Store(One, ^PSTA)
+ Store(Timer(), ^ONTM) // Start the timer for this PR
+ }
+ } // Turn power on
+ } //PUAM
+ } //PAUD
+} //Scope(\_SB.PCI0)
+
+If(LNot(HDAD)) { // Check Funtion disable register that gets updated depending on setup option
+ Scope(\_SB.PCI0.HDEF) {
+
+ Method(_PS0,0,Serialized) // D0 Method for HD-A Controller
+ {
+ If(LEqual(\_SB.PCI0.PAUD.ONTM, Zero)){
+ Return()
+ }
+
+ //
+ // Make sure "D0 delay" (AUDD) delay is elapsed before returning _PS0
+ // Local0: Elapse time since the _ON method
+ // VRRD: VR Rampup Delay
+ // AUDD: Time required for device to be ready after power on
+ // Local1 = AUDD + VRRD: Need to incorporate VRRD since the _ON method no longer has VR Rampup Delay
+ // So only need sleep for (Local1 - Local0), the amount of time remaining since the _ON method
+ //
+ Divide(Subtract(Timer(), \_SB.PCI0.PAUD.ONTM), 10000, , Local0) //Store Elapsed time in ms, ignore remainder
+ Add(AUDD, VRRD, Local1) // Incorporate VR Rampup Delay
+ If(LLess(Local0, Local1)) { //Do not sleep if already past the delay requirement audio
+ // Delay for device init
+ Sleep(Subtract(Local1, Local0)) //Sleep (AUDD + VRRD - time elapsed)
+ }
+ }
+ Method(_PS3,0,Serialized) // D3 Method for HD-A Controller(Dummy routine to support D3 state)
+ {
+ }
+
+ Name(_PR0, Package(){\_SB.PCI0.PAUD})
+ }
+ }// IF(HDAD)
+
+// ADSP device
+if(LNot(ADSD)){ // Check Funtion disable register that gets updated depending on setup option
+ Scope(\_SB.PCI0.ADSP) {
+
+ // D0 Method for ADSP Controller
+ Method(_PS0,0,Serialized) // D0 Method for ADSP Controller
+ {
+
+ If(LEqual(\_SB.PCI0.PAUD.ONTM, Zero)) {
+ Return()
+ }
+
+ //
+ // Make sure "D0 delay" (DSPD) delay is elapsed before returning _PS0
+ // Local0: Elapse time since the _ON method
+ // VRRD: VR Rampup Delay
+ // DSPD: Time required for device to be ready after power on
+ // Local1 = DSPD + VRRD: Need to incorporate VRRD since the _ON method no longer has VR Rampup Delay
+ // So only need sleep for (Local1 - Local0), the amount of time remaining since the _ON method
+ //
+ Divide(Subtract(Timer(), \_SB.PCI0.PAUD.ONTM), 10000, , Local0) //Store Elapsed time in ms, ignore remainder
+ Add(DSPD, VRRD, Local1) // Incorporate VR Rampup Delay
+ If(LLess(Local0, Local1)) { //Do not sleep if already past the delay requirement audio
+ // Delay for device init
+ Sleep(Subtract(Local1, Local0)) //Sleep (DSPD + VRRD - time elapsed)
+ }
+ }
+ Method(_PS3,0,Serialized) // D3 Method for ADSP Controller(Dummy routine to support D3 state)
+ {
+ }
+
+ Name(_PR0, Package(){\_SB.PCI0.PAUD})
+ }
+}// if(ADSD)
+
+// I2C0
+Scope(\_SB.PCI0.I2C0) { // I2C0
+
+ Method(_PR0, Zero, NotSerialized, 0, PkgObj)
+ {
+ Store(0, Local0) // BIT0 : ADSP Disabled BIT1 : SHUB Disabled
+ If (LEqual(ADSD,1)){ // Update Local0 BIT0 if ADSP disabled in RCBA function disable register(implies disabled in setup)
+ Or(0x01,Local0,Local0)
+ }
+ If(LEqual(And(SDS0,0x01), 0x00)) { // Update Local0 BIT1 if SHUB disabled in setup
+ Or(0x02,Local0,Local0)
+ }
+
+ If(LEqual(Local0,0x0)){ // Both SHUB and ADSP enabled
+ Return(Package(){\_SB.PCI0.I2C0.SHUB.PSEN,\_SB.PCI0.I2C1.PXTC,\_SB.PCI0.PAUD})
+ }
+ If(LEqual(Local0,0x01)){ // Only SHUB enabled
+ Return(Package(){\_SB.PCI0.I2C0.SHUB.PSEN,\_SB.PCI0.I2C1.PXTC})
+ }
+ If(LEqual(Local0,0x02)){ // Only ADSP codec enabled
+ Return(Package(){\_SB.PCI0.PAUD})
+ }
+ Return(Package(){}) // Both SHUB and ADSP codec disabled
+ }
+ // D0 Method for I2C0 Controller(Called by _PS0)
+ Method(PS0X,0,Serialized)
+ {
+ Sleep(I20D) // If required add delay in controller to gurantee longest delaying device have time
+ // Drive GIO49 High - routed to Sensor HUB STOP mode
+ \_SB.WTGP(49,1)
+ Sleep(16)
+ }
+
+ // D3 Method for I2C0 Controller(Called by _PS3)
+ Method(PS3X,0,Serialized)
+ {
+
+ // Drive GIO49 Low - routed to Sensor HUB STOP mode
+ \_SB.WTGP(49,0)
+ Sleep(16)
+ }
+} // \_SB.PCI0.I2C0
+
+If (AND(LEqual(CODS, 0),LNot(ADSD))){ // CODEC 0 : RealTek
+ Scope(\_SB.PCI0.I2C0.ACD0)
+ {
+ Name(_PR0,Package(){\_SB.PCI0.PAUD})
+ }
+}
+
+If (AND(LEqual(CODS, 1),LNot(ADSD))){ // CODEC 1 : Cirrus
+ Scope(\_SB.PCI0.I2C0.ACD1)
+ {
+ Name(_PR0,Package(){\_SB.PCI0.PAUD})
+ }
+}
+
+If (AND(LEqual(CODS, 2),LNot(ADSD))){ // CODEC 2 : Idt
+ Scope(\_SB.PCI0.I2C0.ACD2)
+ {
+ Name(_PR0,Package(){\_SB.PCI0.PAUD})
+ }
+}
+
+Scope(\_SB.PCI0.I2C0.SHUB)
+{
+ // D0 Method Hook for I2C1 Controller(Called by _PS0)
+ Method(_PS0,0,Serialized)
+ {
+ If(LEqual(\_SB.PCI0.I2C0.SHUB.PSEN.ONTM,Zero)) {
+ Return()
+ }
+
+ // Make sure "D0 delay" (IC0D) delay is elapsed before returning _PS0
+ Divide(Subtract(Timer(), \_SB.PCI0.I2C0.SHUB.PSEN.ONTM), 10000, , Local0) //Store Elapsed time in ms, ignore remainder
+ If(LLess(Local0, IC0D)) //Do not sleep if already past the delay requirement 100ms for SensorHub
+ {
+ // Delay for power ramp
+ Sleep(Subtract(IC0D, Local0)) //Sleep (100 - time elapsed)
+ }
+ }
+ Method(_PS3,0,Serialized)
+ {
+ }
+ Method(_PR0, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(And(LEqual(RIC0,1),LEqual(\_SB.RDGP(44), 0x01))) { // Enabled in Setup and not in DFU mode
+ Return(Package(){PSEN,\_SB.PCI0.I2C1.PXTC})
+ } Else {
+ Return(Package(){})
+ }
+ }
+ Method(_PR3, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(And(LEqual(RIC0,1),LEqual(\_SB.RDGP(44), 0x01))) { // Enabled in Setup and not in DFU mode
+ Return(Package(){PSEN,\_SB.PCI0.I2C1.PXTC})
+ } Else {
+ Return(Package(){})
+ }
+ }
+
+ PowerResource(PSEN, 0, 0) {
+ Name(ONTM, Zero) // On Timer
+
+ Method(_STA){
+ If(LEqual(SHSB, 0)){
+ If(LEqual(\_SB.RDGP(46),1)) { //GPIO89 NOTE: 1=> ON; 0=> OFF
+ Return(0x01)
+ }
+ }Else{
+ If(LEqual(\_SB.RDGP(70),1)) { //GPIO89 NOTE: 1=> ON; 0=> OFF
+ Return(0x01)
+ }
+ }
+ Return(0x00)
+ }
+
+ Method(_ON, 0){
+ If(And(LEqual(RIC0,1),LEqual(\_SB.RDGP(44), 0x01))) { // Enabled in Setup and not in DFU mode
+ // Drive GPIO 46 High
+ If(LEqual(SHSB, 0)){
+ If(LEqual(SGON(46, One), One)) { // VR stagger GPIO46 to high to power on device
+ Store(Timer(), ^ONTM) // Start the timer
+ \_SB.GP2B(14, One) // Enable int line from sensor hub. GPIO14 is PIRQM(IOAPIC ln28)
+ }
+ }Else{
+ If(LEqual(SGON(70, One), One)) { // VR stagger GPIO70 to high to power on device
+ Store(Timer(), ^ONTM) // Start the timer
+ \_SB.GP2B(14, One) // Enable int line from sensor hub. GPIO14 is PIRQM(IOAPIC ln28)
+ }
+ }
+ } // End if - Enabled in Setup and not in DFU mode
+ } // End _ON
+
+ Method(_OFF, 0){
+ If(And(LEqual(RIC0,1),LEqual(\_SB.RDGP(44), 0x01))) { // Enabled in Setup and not in DFU mode
+ // Mask interrupt from Sensorhub GPIPIRQ2IOXAPIC: GPI PIRQ[X:I] to IOxAPIC[39:24] Enable
+ \_SB.GP2B(14, Zero) // GPIO14 is PIRQM(IOAPIC ln28)
+ If(LEqual(SHSB, 0)){
+ \_SB.WTGP(46, Zero) // Remove Device Power
+ }Else{
+ \_SB.WTGP(70, Zero)
+ }
+ Store(Zero, ^ONTM)
+ Store(Zero , ^ONTM)
+ } // End if - Enabled in Setup and not in DFU mode
+ } // End _OFF
+ } //PSEN
+} // Scope(SHUB)
+
+ //Merge TouchPanel/Touch Pad Power control - I2C Sensors Need to Turn ON/OFF at same time
+ Scope(\_SB.PCI0.I2C1){
+
+ Method(PS0X,0,Serialized)
+ {
+ // If required add delay in controller to gurantee longest delaying device have time
+ Sleep(I21D)
+ }
+
+ Method(PS3X,0,Serialized)
+ {
+ }
+
+ PowerResource(PXTC, 0, 0){ // power rail for Touch Panel and Touchpad GPIO 89
+
+ Name(ONTM, 0) // 0 - Not in Speculative ON ; Non-Zero - elapsed time in Nanosecs after Physical ON
+
+ Method(_STA){
+ If(LOr(LEqual(And(SDS1,0x0800), 0x0800),LEqual(And(SDS1,0x1000), 0x1000))){ //Precision Enabled
+ If(LEqual(\_SB.RDGP(89),1)) { //GPIO89 NOTE: 1=> ON; 0=> OFF
+ Return(0x01)
+ } Else {
+ Return(0x00)
+ }
+ } Else{
+ If(LAnd(LEqual(\_SB.RDGP(88),1), LEqual(\_SB.RDGP(89),1))) { //GPIO88/89 NOTE: 1=> ON; 0=> OFF
+ Return(0x01)
+ } Else {
+ Return(0x00)
+ }
+ }
+ }
+ Method(_ON, 0)
+ { // Turn on
+ If(LOr(LEqual(And(SDS1,0x0800), 0x0800),LEqual(And(SDS1,0x1000), 0x1000))){ //Precision Enabled
+ If(LOr(LEqual(\_SB.RDGP(89),0), LEqual(\_SB.RDGP(52),0))) { //GPIO88 NOTE: 1=> ON; 0=> OFF
+ \_SB.WTGP(52,1) //DeAssert GPIO RST
+ SGON(89, One) // VR stagger GPIO89 to high to power on device
+ Store(Timer(), ONTM)
+ //Enable int line from touch screen
+ \_SB.GP2A(50, One) //TPL0
+ }
+ }Else {
+ If(LOr(LOr(LEqual(\_SB.RDGP(88),0), LEqual(\_SB.RDGP(89),0)), LEqual(\_SB.RDGP(52),0))) { //GPIO88/89 NOTE: 1=> ON; 0=> OFF
+ \_SB.WTGP(52,1) //DeAssert GPIO RST
+ SGON(88, One) // VR stagger GPIO88 to high to power on device
+ SGON(89, One) // VR stagger GPIO89 to high to power on device
+ Store(Timer(), ONTM)
+ //Enable int line from touch screen and Touch pad
+ \_SB.GP2A(50, One) //TPL0
+ \_SB.GP2A(55, One) //TPD0/1
+ }
+ }
+ }
+
+ Method(_OFF, 0)
+ { // Turn off
+ If(LOr(LEqual(And(SDS1,0x0800), 0x0800),LEqual(And(SDS1,0x1000), 0x1000))){ //Precision Enabled
+ //mask interrupt from Touch Screen GPIPIRQ2IOXAPIC: GPI PIRQ[X:I] to IOxAPIC[39:24] Enable
+ \_SB.GP2A(50, Zero) //TPL0
+ \_SB.WTGP(89,0)
+ \_SB.WTGP(52,0) //GPIO RST to Touch Panel
+ Store(Zero , ^ONTM)
+ }
+ Else{
+ //mask interrupt from Touch Screen and Touch Pad GPIPIRQ2IOXAPIC: GPI PIRQ[X:I] to IOxAPIC[39:24] Enable
+ \_SB.GP2A(50, Zero) //TPL0
+ \_SB.GP2A(55, Zero) //TPD0/1
+ \_SB.WTGP(88,0)
+ \_SB.WTGP(89,0)
+ \_SB.WTGP(52,0) //GPIO RST to Touch Panel
+ Store(Zero , ^ONTM)
+ }
+ }
+ } // End PXTC
+
+ Scope(TPL0){
+ Method(_PS0,0,Serialized)
+ {
+ If(LEqual(\_SB.PCI0.I2C1.PXTC.ONTM,Zero)) {
+ Return()
+ }
+
+ //
+ // Make sure "D0 delay" (IC1D) delay is elapsed before returning _PS0
+ // Local0: Elapse time since the _ON method
+ // VRRD: VR Rampup Delay
+ // IC1D: Time required for device to be ready after power on
+ // Local1 = IC1D + VRRD: Need to incorporate VRRD since the _ON method no longer has VR Rampup Delay
+ // So only need sleep for (Local1 - Local0), the amount of time remaining since the _ON method
+ //
+ Divide(Subtract(Timer(), \_SB.PCI0.I2C1.PXTC.ONTM), 10000, , Local0) //Store Elapsed time in ms, ignore remainder
+ Add(IC1D, VRRD, Local1) // Incorporate VR Rampup Delay
+ If(LLess(Local0, Local1)) //Do not sleep if already past the delay requirement 100ms for Touchpanel
+ {
+ // Delay for power ramp
+ Sleep(Subtract(Local1, Local0)) //Sleep (IC1D + VRRD - time elapsed)
+ }
+ }
+
+ Method(_PS3,0,Serialized)
+ {
+ }
+ Method(_PR0, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(LEqual(And(SDS1,0x01), 0x01))
+ {
+ Return(Package(){\_SB.PCI0.I2C0.SHUB.PSEN,PXTC})
+ } Else {
+ Return(Package() {})
+ }
+ }
+ Method(_PR3, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(LEqual(And(SDS1,0x01), 0x01))
+ {
+ Return(Package(){\_SB.PCI0.I2C0.SHUB.PSEN,PXTC})
+ } Else {
+ Return(Package() {})
+ }
+ }
+ } // End of Scope(TPL0)
+
+ Scope(TPD0){
+ Method(_PR0, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(LEqual(And(SDS1,0x04), 0x04))
+ {
+ Return(Package(){PXTC})
+ }Else{
+ Return(Package(){})
+ }
+ }
+ Method(_PR3, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(LEqual(And(SDS1,0x0004), 0x0004))
+ {
+ Return(Package(){PXTC})
+ }Else{
+ Return(Package(){})
+ }
+ }
+ }
+
+ Scope(TPL1){
+ Method(_PS0,0,Serialized)
+ {
+ If(LEqual(\_SB.PCI0.I2C1.PXTC.ONTM,Zero)) {
+ Return()
+ }
+ // Make sure "D0 delay" (IC1D) delay is elapsed before returning _PS0
+ Divide(Subtract(Timer(), \_SB.PCI0.I2C1.PXTC.ONTM), 10000, , Local0) //Store Elapsed time in ms, ignore remainder
+ If(LLess(Local0, IC1D)) //Do not sleep if already past the delay requirement 100ms for Touchpanel
+ {
+ // Delay for power ramp
+ Sleep(Subtract(IC1D, Local0)) //Sleep (IC1D - time elapsed)
+ }
+ }
+
+ Method(_PS3,0,Serialized)
+ {
+ }
+
+ Method(_PR0, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(LEqual(And(SDS1,0x0002), 0x0002))
+ {
+ Return(Package(){\_SB.PCI0.I2C0.SHUB.PSEN,PXTC})
+ }Else{
+ Return(Package(){})
+ }
+ }
+ Method(_PR3, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(LEqual(And(SDS1,0x0002), 0x0002))
+ {
+ Return(Package(){\_SB.PCI0.I2C0.SHUB.PSEN,PXTC})
+ }Else{
+ Return(Package(){})
+ }
+ }
+ }
+
+ Scope(TPD1){
+ Method(_PS0,0,Serialized)
+ {
+ If(LEqual(\_SB.PCI0.I2C1.PXTC.ONTM,Zero)) {
+ Return()
+ }
+ //
+ // Make sure "D0 delay" (IC1S) delay is elapsed before returning _PS0
+ // Local0: Elapse time since the _ON method
+ // VRRD: VR Rampup Delay
+ // IC1S: Time required for device to be ready after power on
+ // Local1 = IC1S + VRRD: Need to incorporate VRRD since the _ON method no longer has VR Rampup Delay
+ // So only need sleep for (Local1 - Local0), the amount of time remaining since the _ON method
+ //
+ Divide(Subtract(Timer(), \_SB.PCI0.I2C1.PXTC.ONTM), 10000, , Local0) //Store Elapsed time in ms, ignore remainder
+ Add(IC1S, VRRD, Local1) // Incorporate VR Rampup Delay
+ If(LLess(Local0, Local1)) //Do not sleep if already past the delay requirement 100ms for Touchpanel
+ {
+ // Delay for power ramp
+ Sleep(Subtract(Local1, Local0)) //Sleep (IC1S + VRRD - time elapsed)
+ }
+ }
+
+ Method(_PS3,0,Serialized)
+ {
+ }
+
+ Method(_PR0, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(LEqual(And(SDS1,0x08), 0x08)) {
+ Return(Package(){PXTC})
+ } Else {
+ Return(Package() {})
+ }
+ }
+ Method(_PR3, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(LEqual(And(SDS1,0x08), 0x08)) {
+ Return(Package(){PXTC})
+ } Else {
+ Return(Package() {})
+ }
+ }
+ }// End of Scope(TPD1)
+
+ //------------------------------
+ // NTRIG Digitizer Touch Panel
+ //------------------------------
+ Scope(TPL2){
+ Method(_PS0,0,Serialized)
+ {
+ If(LEqual(\_SB.PCI0.I2C1.PXTC.ONTM,Zero)) {
+ Return()
+ }
+ //
+ // Make sure "D0 delay" (IC1D) delay is elapsed before returning _PS0
+ // Local0: Elapse time since the _ON method
+ // VRRD: VR Rampup Delay
+ // IC1D: Time required for device to be ready after power on
+ // Local1 = IC1D + VRRD: Need to incorporate VRRD since the _ON method no longer has VR Rampup Delay
+ // So only need sleep for (Local1 - Local0), the amount of time remaining since the _ON method
+ //
+ Divide(Subtract(Timer(), \_SB.PCI0.I2C1.PXTC.ONTM), 10000, , Local0) //Store Elapsed time in ms, ignore remainder
+ Add(IC1D, VRRD, Local1) // Incorporate VR Rampup Delay
+ If(LLess(Local0, Local1)) //Do not sleep if already past the delay requirement 100ms for Touchpanel
+ {
+ // Delay for power ramp
+ Sleep(Subtract(Local1, Local0)) //Sleep (IC1D + VRRD - time elapsed)
+ }
+ }
+
+ Method(_PS3,0,Serialized)
+ {
+ }
+
+ Method(_PR0, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(LEqual(And(SDS1,0x0020), 0x0020)) {
+ Return(Package(){PXTC})
+ }Else{
+ Return(Package(){})
+ }
+ }
+ Method(_PR3, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(LEqual(And(SDS1,0x0020), 0x0020)) {
+ Return(Package(){PXTC})
+ }Else{
+ Return(Package(){})
+ }
+ }
+ }// End of Scope(TPL2)
+
+ //------------------------
+ // EETI Touch Panel
+ //------------------------
+ Scope(TPL3){
+ Method(_PS0,0,Serialized)
+ {
+ If(LEqual(\_SB.PCI0.I2C1.PXTC.ONTM,Zero)) {
+ Return()
+ }
+ // Make sure "D0 delay" (IC1D) delay is elapsed before returning _PS0
+ Divide(Subtract(Timer(), \_SB.PCI0.I2C1.PXTC.ONTM), 10000, , Local0) //Store Elapsed time in ms, ignore remainder
+ If(LLess(Local0, IC1D)) //Do not sleep if already past the delay requirement 100ms for Touchpanel
+ {
+ // Delay for power ramp
+ Sleep(Subtract(IC1D, Local0)) //Sleep (IC1D - time elapsed)
+ }
+ }
+
+ Method(_PS3,0,Serialized)
+ {
+ }
+
+ Method(_PR0, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(LEqual(And(SDS1,0x0040), 0x0040)) {
+ Return(Package(){PXTC})
+ }Else{
+ Return(Package(){})
+ }
+ }
+ Method(_PR3, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(LEqual(And(SDS1,0x0040), 0x0040)) {
+ Return(Package(){PXTC})
+ }Else{
+ Return(Package(){})
+ }
+ }
+ }// End of Scope(TPL3)
+
+
+ //------------------------
+ // Alps touchpad
+ //------------------------
+ Scope(TPD2){
+ Method(_PS0,0,Serialized)
+ {
+ If(LEqual(\_SB.PCI0.I2C1.PXTC.ONTM,Zero)) {
+ Return()
+ }
+ //
+ // Make sure "D0 delay" (IC1S) delay is elapsed before returning _PS0
+ // Local0: Elapse time since the _ON method
+ // VRRD: VR Rampup Delay
+ // IC1S: Time required for device to be ready after power on
+ // Local1 = IC1S + VRRD: Need to incorporate VRRD since the _ON method no longer has VR Rampup Delay
+ // So only need sleep for (Local1 - Local0), the amount of time remaining since the _ON method
+ //
+ Divide(Subtract(Timer(), \_SB.PCI0.I2C1.PXTC.ONTM), 10000, , Local0) //Store Elapsed time in ms, ignore remainder
+ Add(IC1S, VRRD, Local1) // Incorporate VR Rampup Delay
+ If(LLess(Local0, Local1)) //Do not sleep if already past the delay requirement 100ms for Touchpanel
+ {
+ // Delay for power ramp
+ Sleep(Subtract(Local1, Local0)) //Sleep (IC1S + VRRD - time elapsed)
+ }
+ }
+
+ Method(_PS3,0,Serialized)
+ {
+ }
+
+ Method(_PR0, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(LEqual(And(SDS1,0x0080), 0x0080)) {
+ Return(Package(){PXTC})
+ }Else{
+ Return(Package(){})
+ }
+ }
+ Method(_PR3, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(LEqual(And(SDS1,0x0080), 0x0080)) {
+ Return(Package(){PXTC})
+ }Else{
+ Return(Package(){})
+ }
+ }
+ }// End of Scope(TPD2)
+
+ //------------------------
+ // Cypress touchpad
+ //------------------------
+ Scope(TPD3){
+ Method(_PS0,0,Serialized)
+ {
+ If(LEqual(\_SB.PCI0.I2C1.PXTC.ONTM,Zero)) {
+ Return()
+ }
+ //
+ // Make sure "D0 delay" (IC1S) delay is elapsed before returning _PS0
+ // Local0: Elapse time since the _ON method
+ // VRRD: VR Rampup Delay
+ // IC1S: Time required for device to be ready after power on
+ // Local1 = IC1S + VRRD: Need to incorporate VRRD since the _ON method no longer has VR Rampup Delay
+ // So only need sleep for (Local1 - Local0), the amount of time remaining since the _ON method
+ //
+ Divide(Subtract(Timer(), \_SB.PCI0.I2C1.PXTC.ONTM), 10000, , Local0) //Store Elapsed time in ms, ignore remainder
+ Add(IC1S, VRRD, Local1) // Incorporate VR Rampup Delay
+ If(LLess(Local0, Local1)) //Do not sleep if already past the delay requirement 100ms for Touchpanel
+ {
+ // Delay for power ramp
+ Sleep(Subtract(Local1, Local0)) //Sleep (IC1S + VRRD - time elapsed)
+ }
+ }
+
+ Method(_PS3,0,Serialized)
+ {
+ }
+
+ Method(_PR0, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(LEqual(And(SDS1,0x0100), 0x0100)) {
+ Return(Package(){PXTC})
+ }Else{
+ Return(Package(){})
+ }
+ }
+ Method(_PR3, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(LEqual(And(SDS1,0x0100), 0x0100)) {
+ Return(Package(){PXTC})
+ }Else{
+ Return(Package(){})
+ }
+ }
+ }// End of Scope(TPD3)
+
+ //------------------------
+ // Elantech Precision touchpad
+ //------------------------
+ Scope(TPD7){
+
+ //
+ // Delay for Touchpanel & TouchPad - Both share same I2C bus
+ //
+ Method(PS0X,0,Serialized)
+ {
+ If(LEqual(\_SB.PCI0.I2C1.PXTC.ONTM,Zero)) {
+ Return()
+ }
+ //
+ // Make sure "D0 delay" (IC1S) delay is elapsed before returning _PS0
+ // Local0: Elapse time since the _ON method
+ // VRRD: VR Rampup Delay
+ // IC1S: Time required for device to be ready after power on
+ // Local1 = IC1S + VRRD: Need to incorporate VRRD since the _ON method no longer has VR Rampup Delay
+ // So only need sleep for (Local1 - Local0), the amount of time remaining since the _ON method
+ //
+ Divide(Subtract(Timer(), \_SB.PCI0.I2C1.PXTC.ONTM), 10000, , Local0) //Store Elapsed time in ms, ignore remainder
+ Add(IC1S, VRRD, Local1) // Incorporate VR Rampup Delay
+ If(LLess(Local0, Local1)) //Do not sleep if already past the delay requirement 100ms for Touchpanel
+ {
+ // Delay for power ramp
+ Sleep(Subtract(Local1, Local0)) //Sleep (IC1S + VRRD - time elapsed)
+ }
+ }
+
+ Method(_PR0, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(LEqual(And(SDS1,0x0800), 0x0800)) {
+ Return(Package(){PXTC})
+ }Else{
+ Return(Package(){})
+ }
+ }
+ Method(_PR3, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(LEqual(And(SDS1,0x0800), 0x0800)) {
+ Return(Package(){PXTC})
+ }Else{
+ Return(Package(){})
+ }
+ }
+ }// End of Scope(TPD7)
+
+ //------------------------
+ // Synaptics Precision touchpad
+ //------------------------
+ Scope(TPD8){
+
+ //
+ // Delay for Touchpanel & TouchPad - Both share same I2C bus
+ //
+ Method(PS0X,0,Serialized)
+ {
+ If(LEqual(\_SB.PCI0.I2C1.PXTC.ONTM,Zero)) {
+ Return()
+ }
+ //
+ // Make sure "D0 delay" (IC1S) delay is elapsed before returning _PS0
+ // Local0: Elapse time since the _ON method
+ // VRRD: VR Rampup Delay
+ // IC1S: Time required for device to be ready after power on
+ // Local1 = IC1S + VRRD: Need to incorporate VRRD since the _ON method no longer has VR Rampup Delay
+ // So only need sleep for (Local1 - Local0), the amount of time remaining since the _ON method
+ //
+ Divide(Subtract(Timer(), \_SB.PCI0.I2C1.PXTC.ONTM), 10000, , Local0) //Store Elapsed time in ms, ignore remainder
+ Add(IC1S, VRRD, Local1) // Incorporate VR Rampup Delay
+ If(LLess(Local0, Local1)) //Do not sleep if already past the delay requirement 100ms for Touchpanel
+ {
+ // Delay for power ramp
+ Sleep(Subtract(Local1, Local0)) //Sleep (IC1S + VRRD - time elapsed)
+ }
+ }
+
+ Method(_PR0, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(LEqual(And(SDS1,0x1000), 0x1000)) {
+ Return(Package(){PXTC})
+ }Else{
+ Return(Package(){})
+ }
+ }
+ Method(_PR3, Zero, NotSerialized, 0, PkgObj)
+ {
+ If(LEqual(And(SDS1,0x1000), 0x1000)) {
+ Return(Package(){PXTC})
+ }Else{
+ Return(Package(){})
+ }
+ }
+ }// End of Scope(TPD8)
+ }// Scope(\_SB.PCI0.I2C1)
+
+//Serial IO End
+ //GPE Event handling - Start
+ Scope(\_GPE) {
+
+ Method(_L11) { // Zpodd GPIO handler
+ Store(1,\GO17) // Clear GPI ownership to stop SCI flooding
+ If(LEqual(\_SB.PCI0.SAT0.PRT1.UDSM, Zero)) {
+ Notify(\_SB.PCI0.SAT0.PRT1, 2) // Device Wake to Device (Windows)
+ }Else{
+ Notify(\_SB.PCI0.SAT0, 0x81) //Notify Port 1 to wake from DSM method
+ } // \_SB.PCI0.SAT0.UDSM
+ }
+ //
+ // GPIO8 PCIE slot 3 wake event
+ //
+ Method(_L08) {
+ // PCIe WAKE#
+ If(\_SB.PCI0.RP03.WKEN){
+ //GPIO_OWN to GPIO Driver to stop SCI flooding
+ Store(1, \GO08)
+ Notify(\_SB.PCI0.RP03, 0x02) // DeviceWake
+ }
+ }
+ //
+ // GPIO45(0x2D) PCIE slot 4 wake event
+ //
+ Method(_L2D) {
+ // PCIe WAKE#
+ If(\_SB.PCI0.RP04.WKEN){
+ //GPIO_OWN to GPIO Driver to stop SCI flooding
+ Store(1, \GO45)
+ Notify(\_SB.PCI0.RP04, 0x02) // DeviceWake
+ }
+ }
+
+ //
+ // GPIO51(0x33) PCIE slot 5 wake event
+ //
+ Method(_L33) {
+ // PCIe WAKE#
+ If(\_SB.PCI0.RP05.WKEN){
+ //GPIO_OWN to GPIO Driver to stop SCI flooding
+ Store(1, \GO51)
+ Notify(\_SB.PCI0.RP05, 0x02) // DeviceWake
+ }
+ }
+ } //Scope(\_GPE)
+
+If(LEqual(RWAG,0)) {// standard board configuration, no W/A bue wires for slot 1 or 6
+ //SDIO Reset support
+ Scope(\_SB.PCI0.SDHC) {
+ // D0 Method for SDHC
+ Method(PS0X,0,Serialized)
+ {
+ // Drive GPIO77 High - 1: No GPIO RST to on board mPCIe/NGFF_WIFI
+ \_SB.WTGP(77,1)
+ }
+ }
+
+ Scope(\_SB.PCI0.SDHC.WI01) {
+ // D0 Method for WiFi
+ Method(PS0X,0,Serialized)
+ {
+ // Drive GPIO77 High - 1: No GPIO RST to on board mPCIe/NGFF_WIFI
+ \_SB.WTGP(77,1)
+ }
+ // D3 Method for WiFi
+ Method(PS3X,0,Serialized)
+ {
+ // Drive GPIO77 Low - 0: GPIO RST to on board mPCIe/NGFF_WIFI
+ \_SB.WTGP(77,0)
+ }
+ } //\_SB.PCI0.SDHC.WI01
+}
+
+ Scope(\_SB.PCI0.XHC){ //USB XHCI
+
+ Name(UPWR,0)
+ Name(USPP,0)
+ // Bit 0 : USB SD Card Reader
+ // Bit 1 : USB(HS1 : 0x480 /SS0 : 0x510)
+ // BIT 2 : USB(HS2 : 0x490 / SS1 : 0x520)
+
+
+ Method(DUAM,0,Serialized)
+ {
+
+ OperationRegion (XHCM, SystemMemory, And(MEMB,0xFFFF0000), 0x600)
+ Field (XHCM, DWordAcc, NoLock, Preserve)
+ {
+ Offset(0x2),
+ XHCV,16,
+ Offset(0x480),
+ HP01, 1, // HS port 1
+ Offset(0x490),
+ HP02, 1, // HS port 2
+ Offset(0x510),
+ SP00, 1, // SS port 0
+ Offset(0x520),
+ SP01, 1, // SS port 1
+ }
+
+ if(LNotEqual(\UAMS,0x00)) // User not present
+ {
+ Store(0x00,UPWR)
+ // Enterng CS, Remove power if SD card not present
+
+ If(LEqual(XHCV,0xFFFF)) // Controller in D3Hot(MEM_BASE not decoded)
+ {
+ If(And(USPP,0x02)) // USB(HS1 : 0x480 /SS0 : 0x510)
+ {
+ \_SB.WTGP(13,0)
+ Or(UPWR,0x02, UPWR)
+ }
+ If(And(USPP,0x04)) // USB(HS2 : 0x490 / SS1 : 0x520)
+ {
+ \_SB.WTGP(43,0)
+ Or(UPWR,0x04, UPWR)
+ }
+ }Else{ // If(Lequal(XHCV,0xFFFF))
+ If(LAnd(LEqual(HP01,0x00),LEqual(SP00,0x00))) // USB(HS1 : 0x480 /SS0 : 0x510)
+ {
+ \_SB.WTGP(13,0)
+ Or(UPWR,0x02, UPWR)
+ }
+ If(LAnd(LEqual(HP02,0x00),LEqual(SP01,0x00))) // USB(HS2 : 0x490 / SS1 : 0x520)
+ {
+ \_SB.WTGP(43,0)
+ Or(UPWR,0x04, UPWR)
+ }
+ }// If(Lequal(XHCV,0xFFFF))
+ }Else{ //if(LNotEqual(\UAMS,0x00))
+
+ // Exiting CS , Apply power if power removed
+ if(And(UPWR,0x02)) // USB(HS1 : 0x480 /SS0 : 0x510)
+ {
+ \_SB.WTGP(13,1)
+ }
+ if(And(UPWR,0x04)) // USB(HS2 : 0x490 / SS1 : 0x520)
+ {
+ \_SB.WTGP(43,1)
+ }
+ } //if(LNotEqual(\UAMS,0x00)) // User not present
+ } // End of DUAM
+ }
+} //If(LAnd(LEqual(BID,BWT1),LEqual(RTD3,1)))
+} // End SSDT
+
diff --git a/ReferenceCode/AcpiTables/SampleCode/SsdtZpOdd/SsdtZpOdd.asl b/ReferenceCode/AcpiTables/SampleCode/SsdtZpOdd/SsdtZpOdd.asl
new file mode 100644
index 0000000..bd69431
--- /dev/null
+++ b/ReferenceCode/AcpiTables/SampleCode/SsdtZpOdd/SsdtZpOdd.asl
@@ -0,0 +1,134 @@
+
+DefinitionBlock (
+ "SsdtZpOdd.aml",
+ "SSDT",
+ 1,
+ "Intel",
+ "zpodd",
+ 0x1000
+ )
+{
+External(PFLV)
+External(FDTP)
+External(GPE3)
+External(\GL00)
+External(\GL08)
+External(GPS3)
+External(\_SB.PCI0.SAT0.PRT2, DeviceObj)
+External(\GIV0)
+External(RTD3, IntObj)
+
+ If(LEqual(RTD3, Zero))
+ {
+ Scope(\_SB.PCI0.SAT0.PRT2)
+ {
+
+ //
+ // _DSM Device Specific Method supporting SATA ZPODD function
+ //
+ // Arg0: UUID Unique function identifier
+ // Arg1: Integer Revision Level
+ // Arg2: Integer Function Index
+ // Arg3: Package Parameters
+ //
+ Method (_DSM, 4, NotSerialized, 0, UnknownObj, {BuffObj, IntObj, IntObj, PkgObj}) {
+ If (LEqual(Arg0, ToUUID ("bdfaef30-aebb-11de-8a39-0800200c9a66"))) {
+ //
+ // Switch by function index
+ //
+ Switch (ToInteger(Arg2)) {
+ //
+ // Standard query - A bitmask of functions supported
+ // Supports function 0-5
+ //
+ Case (0) {
+ switch(ToInteger(Arg1)) {
+ case(1) {
+ //
+ // Return - 0 (No Functions supported) for Desktop Platforms
+ //
+ If(LEqual(PFLV,FDTP)) {
+ Return (Buffer () {0})
+ }
+ Return (Buffer () {0xF})
+ }
+ Default {Return (Buffer () {0})}
+ }
+ } // Case (0)
+ //
+ // Enable ZPODD feature
+ //
+ Case (1) {
+ Return (1)
+ } // Case (1)
+ //
+ // Power Off Device
+ //
+ Case (2) {
+ //
+ // Drive GPIO to low to power off device.
+ //
+ Store(0,GPE3)
+ If(LEqual(And(\GL00, 0x08), 0x08))
+ {
+ Or(\GIV0, 0x08, \GIV0)
+ } Else {
+ And(\GIV0, 0xF7, \GIV0)
+ }
+ And(\GL08, 0xEF, \GL08)
+ Sleep(0xC8)
+ Store(1,GPS3)
+ Store(1,GPE3)
+ Return (1)
+ } // Case (2)
+ //
+ // Power ON Device
+ //
+ Case (3) {
+ Store(0,GPE3)
+ Store(1,GPS3)
+ Or(\GL08, 0x10, \GL08)
+ Return (1)
+ } // Case (3)
+
+ Default {
+ Return (0)
+ }
+ } // Switch (ToInteger(Arg2))
+ } Else {
+ Return (0)
+ } // bdfaef30-aebb-11de-8a39-0800200c9a66
+ } // _DSM
+ } // (\_SB.PCI0.SAT0)
+//
+// GPE Event Handler
+//
+Scope(\_GPE) {
+ //
+ // SATA_ODD_DA
+ //
+ Method(_L13) {
+ //
+ // Do nothing if Desktop platform
+ //
+ If(LEqual(PFLV,FDTP)) {
+ Return ()
+ }
+ //
+ // Power on drive, disable SCI on GPI
+ // Disable SCI on GPIO3 (PMBASE+0x28 - BIT19)
+ //
+ Store(0,GPE3)
+ //
+ // Drive GPIO68 to High to power on device.
+ //
+ Or(\GL08, 0x10, \GL08)
+ //
+ // Notify the OSPM
+ //
+ Notify(\_SB.PCI0.SAT0, 0x82)
+ Return ()
+ }
+} // \_GPE
+} // If(LEqual(RTD3, Zero))
+} // End SSDT
diff --git a/ReferenceCode/AcpiTables/SampleCode/SsdtZpOdd/SsdtZpOdd.cif b/ReferenceCode/AcpiTables/SampleCode/SsdtZpOdd/SsdtZpOdd.cif
new file mode 100644
index 0000000..02be8d2
--- /dev/null
+++ b/ReferenceCode/AcpiTables/SampleCode/SsdtZpOdd/SsdtZpOdd.cif
@@ -0,0 +1,11 @@
+<component>
+ name = "SsdtZpOdd"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\AcpiTables\SampleCode\SsdtZpOdd\"
+ RefName = "SsdtZpOdd"
+[files]
+"SsdtZpOdd.sdl"
+"SsdtZpOdd.mak"
+"SsdtZpOdd.asl"
+"SsdtZpOddULT.asl"
+<endComponent>
diff --git a/ReferenceCode/AcpiTables/SampleCode/SsdtZpOdd/SsdtZpOdd.mak b/ReferenceCode/AcpiTables/SampleCode/SsdtZpOdd/SsdtZpOdd.mak
new file mode 100644
index 0000000..81eb0d1
--- /dev/null
+++ b/ReferenceCode/AcpiTables/SampleCode/SsdtZpOdd/SsdtZpOdd.mak
@@ -0,0 +1,89 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+#<AMI_FHDR_START>
+#
+# Name: SsdtZpOdd.mak
+#
+# Description: MAke file to build Aptio ACPI ASL components
+#
+#
+#<AMI_FHDR_END>
+#*************************************************************************
+all : BuildZPODD
+
+BuildZPODD : $(BUILD_DIR)\SsdtZpOdd.ffs
+
+#-----------------------------------------------------------------------
+# ASL compiler definition
+#-----------------------------------------------------------------------
+!IF "$(ACPIPLATFORM_ASL_COMPILER)"==""
+!ERROR It is an invalid path, please check your ASL compiler path.
+!ENDIF
+
+IASL = $(ACPIPLATFORM_ASL_COMPILER)
+#-----------------------------------------------------------------------
+$(BUILD_DIR)\SsdtZpOdd.aml $(BUILD_DIR)\SsdtZpOddult.aml: $(BUILD_DIR)\SsdtZpOdd.asl $(BUILD_DIR)\SsdtZpOddult.asl
+ $(SILENT)$(IASL) -p $@ $*.asl
+
+$(BUILD_DIR)\SsdtZpOdd.sec $(BUILD_DIR)\SsdtZpOddult.sec: $(BUILD_DIR)\SsdtZpOdd.aml $(BUILD_DIR)\SsdtZpOddult.aml
+ $(GENSECTION) -I $*.aml -O $@ -S EFI_SECTION_RAW
+
+#Note. Expand the package with ZpOdd tables.
+# DXE phase will load the tables
+# and update Aml contents if provided in Acpiplatform.c
+
+$(BUILD_DIR)\SsdtZpOdd.ffs: $(BUILD_DIR)\SsdtZpOdd.sec $(BUILD_DIR)\SsdtZpOddult.sec
+ $(GENFFSFILE) -B $(BUILD_DIR) -V -o $@ -P1 <<$(BUILD_DIR)\SsdtZpOdd.pkg
+
+PACKAGE.INF
+[.]
+BASE_NAME = ZpOdd
+FFS_FILEGUID = E42A76A1-D4B3-4c26-A1BB-84A3502A779F
+ FFS_FILETYPE = EFI_FV_FILETYPE_FREEFORM
+FFS_ATTRIB_CHECKSUM = TRUE
+
+IMAGE_SCRIPT =
+{
+ Compress (dummy) {
+ $(PROJECT_DIR)\$(BUILD_DIR)\SsdtZpOdd.sec
+ $(PROJECT_DIR)\$(BUILD_DIR)\SsdtZpOddult.sec
+ }
+}
+<<KEEP
+
+#-----------------------------------------------------------------------#
+# Process SG asl files
+#-----------------------------------------------------------------------#
+$(BUILD_DIR)\SsdtZpOdd.asl : $(INTEL_ZPODD_ASL_FILE)
+ $(CP) /I$(INTEL_SSDTZPODD_DIR) /FItoken.h /C $(INTEL_ZPODD_ASL_FILE) > $(BUILD_DIR)\SsdtZpOdd.asl
+
+$(BUILD_DIR)\SsdtZpOddult.asl : $(INTEL_ZPODDULT_ASL_FILE)
+ $(CP) /I$(INTEL_SSDTZPODD_DIR) /FItoken.h /C $(INTEL_ZPODDULT_ASL_FILE) > $(BUILD_DIR)\SsdtZpOddult.asl
+
+
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/AcpiTables/SampleCode/SsdtZpOdd/SsdtZpOdd.sdl b/ReferenceCode/AcpiTables/SampleCode/SsdtZpOdd/SsdtZpOdd.sdl
new file mode 100644
index 0000000..98dbe92
--- /dev/null
+++ b/ReferenceCode/AcpiTables/SampleCode/SsdtZpOdd/SsdtZpOdd.sdl
@@ -0,0 +1,59 @@
+TOKEN
+ Name = "ZPODD_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable ZpODD support in Project"
+ TokenType = Boolean
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+ Token = "PCH_SKU" "=" "1"
+End
+
+TOKEN
+ Name = "STD_ZPODD_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable Stand ZpODD support in Project"
+ TokenType = Boolean
+ TargetMAK = Yes
+ TargetH = Yes
+ Token = "ZPODD_SUPPORT" "=" "1"
+End
+
+TOKEN
+ Name = "ULT_ZPODD_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable ULT ZpODD support in Project"
+ TokenType = Boolean
+ TargetMAK = Yes
+ TargetH = Yes
+ Token = "ZPODD_SUPPORT" "=" "1"
+End
+
+PATH
+ Name = "INTEL_SSDTZPODD_DIR"
+End
+
+TOKEN
+ Name = "INTEL_ZPODD_ASL_FILE"
+ Value = "$(INTEL_SSDTZPODD_DIR)\SsdtZpOdd.asl"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+TOKEN
+ Name = "INTEL_ZPODDULT_ASL_FILE"
+ Value = "$(INTEL_SSDTZPODD_DIR)\SsdtZpOddult.asl"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+MODULE
+ Help = "Includes SsdtZpOdd.mak to Project"
+ File = "SsdtZpOdd.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\SsdtZpOdd.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/AcpiTables/SampleCode/SsdtZpOdd/SsdtZpOddULT.asl b/ReferenceCode/AcpiTables/SampleCode/SsdtZpOdd/SsdtZpOddULT.asl
new file mode 100644
index 0000000..dd393d4
--- /dev/null
+++ b/ReferenceCode/AcpiTables/SampleCode/SsdtZpOdd/SsdtZpOddULT.asl
@@ -0,0 +1,110 @@
+
+DefinitionBlock (
+ "SsdtZpOddult.aml",
+ "SSDT",
+ 1,
+ "Intel",
+ "zpoddult",
+ 0x1000
+ )
+{
+External(\GO17)
+External(\_SB.PCI0.SAT0.PRT1, DeviceObj)
+External(RTD3, IntObj)
+External(ECON, IntObj)
+External(\_SB.WTGP, MethodObj)
+
+
+ If(LEqual(RTD3, Zero))
+ {
+ Scope(\_SB.PCI0.SAT0.PRT1)
+ {
+
+ //
+ // _DSM Device Specific Method supporting SATA ZPODD function
+ //
+ // Arg0: UUID Unique function identifier
+ // Arg1: Integer Revision Level
+ // Arg2: Integer Function Index
+ // Arg3: Package Parameters
+ //
+ Method (_DSM, 4, NotSerialized, 0, UnknownObj, {BuffObj, IntObj, IntObj, PkgObj}) {
+ If (LEqual(Arg0, ToUUID ("bdfaef30-aebb-11de-8a39-0800200c9a66"))) {
+ //
+ // Switch by function index
+ //
+ Switch (ToInteger(Arg2)) {
+ //
+ // Standard query - A bitmask of functions supported
+ // Supports function 0-5
+ //
+ Case (0) {
+ switch(ToInteger(Arg1)) {
+ case(1) {
+ //
+ // Return - 0 (No Functions supported) for Desktop Platforms
+ //
+ If(LEqual(ECON, Zero)) {
+ Return (Buffer () {0})
+ }
+ Return (Buffer () {0xF})
+ }
+ Default {Return (Buffer () {0})}
+ }
+ } // Case (0)
+ //
+ // Enable ZPODD feature
+ //
+ Case (1) {
+ Return (1)
+ } // Case (1)
+ //
+ // Power Off Device
+ //
+ Case (2) {
+ //
+ // Drive GPIO to low to power off device.
+ //
+ \_SB.WTGP(86,1) // Power Off the device
+ Store(0,\GO17) // Enable GPIO86
+ Return (1)
+ } // Case (2)
+ //
+ // Power ON Device
+ //
+ Case (3) {
+ \_SB.WTGP(86,0) // Power ON Device
+ Store(1,\GO17) // Enable GPIO86
+ Sleep(0x0A) // To turn the FET
+ Return (1)
+ } // Case (3)
+
+ Default {
+ Return (0)
+ }
+ } // Switch (ToInteger(Arg2))
+ } Else {
+ Return (0)
+ } // bdfaef30-aebb-11de-8a39-0800200c9a66
+ } // _DSM
+ } // (\_SB.PCI0.SAT0)
+
+//
+// GPE Event Handler
+//
+Scope(\_GPE) {
+ //
+ // GPI03 = SATA_ODD_DA
+ //
+ Method(_L11) {
+ If(LEqual(ECON, Zero)) {
+ Return ()
+ }
+
+ Store(1,\GO17) // Enable GPIO86
+ Notify(\_SB.PCI0.SAT0, 0x81)
+ Return ()
+ }
+} // \_GPE
+} // If(LEqual(RTD3, Zero))
+} // End SSDT
diff --git a/ReferenceCode/AcpiTables/SsdtIRMT/IntelRMT.asl b/ReferenceCode/AcpiTables/SsdtIRMT/IntelRMT.asl
new file mode 100644
index 0000000..a37c052
--- /dev/null
+++ b/ReferenceCode/AcpiTables/SsdtIRMT/IntelRMT.asl
@@ -0,0 +1,108 @@
+//
+// Defined as an SSDT to be able to dynamically load based on BIOS
+// setup options
+//
+DefinitionBlock (
+ "IntelRMT.aml",
+ "SSDT",
+ 0x01,
+ "Intel",
+ "IntelRMT",
+ 0x1000
+ )
+
+
+{
+External(\ADBG, MethodObj)
+External(P8XH, MethodObj)
+External(INSC, IntObj)
+
+
+ Scope(\_SB)
+ {
+ Device (INSD)
+ {
+ Name (_HID, "INT3398")
+ Name (_CID, EISAID("PNP0C02"))
+ Name (_UID, 0x00)
+
+ Name (NBT1, 0) // Intel Intelr RMT Technology local variable
+ // Intelr RMT Modes
+ // 0: Exit Intelr RMT
+ // 1: Enter Intelr RMT Active State
+ // 2: Enter Intelr RMT Idle State
+ // 3: Enter Intelr RMT Do Not Disturb State
+ // 4: Enter Suspend
+
+ Method(GNSC, 0, NotSerialized)
+ {
+ // DEBUG START //
+ Store(INSC, Local0)
+ P8XH(0,0xAA)
+ ADBG("GNSC: ")
+ ADBG(ToHexString(Local0))
+ // DEBUG END //
+ return (INSC)
+ }
+
+ Method(GNSM, 0, Serialized)
+ {
+ Store(NBT1, Local0)
+ // DEBUG START //
+ P8XH(0,0x71)
+ ADBG("GNSM: ")
+ ADBG(ToHexString(Local0))
+ // DEBUG END //
+ Return (Local0)
+ }
+
+ Method(SNSM, 1, Serialized)
+ {
+ Store(Arg0, NBT1)
+ Store(NBT1, Local0)
+ Switch(ToInteger(Local0))
+ {
+ Case (0)
+ {
+ ADBG("case 0: ")
+ // 0: Exit Intelr RMT
+ // TODO: Add platform specific code here
+ }
+ Case (1)
+ {
+ ADBG("case 1: ")
+ // 1: Enter Intelr RMT Active State
+ // TODO: Add platform specific code here
+ }
+ Case (2)
+ {
+ ADBG("case 2: ")
+ // 2: Enter Intelr RMT Idle State
+ // TODO: Add platform specific code here
+ }
+ Case (3)
+ {
+ ADBG("case 3: ")
+ // 3: Enter Intelr RMT Do Not Disturb State
+ // TODO: Add platform specific code here
+ }
+ Case (4)
+ {
+ ADBG("case 4: ")
+ // 4: Enter Suspend
+ // TODO: Add platform specific code here
+ }
+
+ }
+
+ // DEBUG START //
+ P8XH(0,0x72)
+ ADBG("SNSM: ")
+ ADBG(ToHexString(Local0))
+ // DEBUG END //
+ }
+
+ } // Device (INSD)
+
+ } // end \_SB scope
+} // end SSDT
diff --git a/ReferenceCode/AcpiTables/SsdtIRMT/SsdtIRMT.cif b/ReferenceCode/AcpiTables/SsdtIRMT/SsdtIRMT.cif
new file mode 100644
index 0000000..38a2bd1
--- /dev/null
+++ b/ReferenceCode/AcpiTables/SsdtIRMT/SsdtIRMT.cif
@@ -0,0 +1,10 @@
+<component>
+ name = "SsdtIRMT"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\AcpiTables\SsdtIRMT\"
+ RefName = "SsdtIRMT"
+[files]
+"SsdtIRMT.sdl"
+"SsdtIRMT.mak"
+"IntelRMT.asl"
+<endComponent>
diff --git a/ReferenceCode/AcpiTables/SsdtIRMT/SsdtIRMT.mak b/ReferenceCode/AcpiTables/SsdtIRMT/SsdtIRMT.mak
new file mode 100644
index 0000000..9f2b6b7
--- /dev/null
+++ b/ReferenceCode/AcpiTables/SsdtIRMT/SsdtIRMT.mak
@@ -0,0 +1,80 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2014, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+#<AMI_FHDR_START>
+#
+# Name: SsdtIRMT.mak
+#
+# Description: MAke file to build Aptio ACPI ASL components
+#
+#
+#<AMI_FHDR_END>
+#*************************************************************************
+all : BuildIRMT
+
+BuildIRMT : $(BUILD_DIR)\IntelRMT.ffs
+
+#-----------------------------------------------------------------------
+# ASL compiler definition
+#-----------------------------------------------------------------------
+!IF "$(ACPIPLATFORM_ASL_COMPILER)"==""
+!ERROR It is an invalid path, please check your ASL compiler path.
+!ENDIF
+
+IASL = $(ACPIPLATFORM_ASL_COMPILER)
+#-----------------------------------------------------------------------
+$(BUILD_DIR)\IntelRMT.aml : $(INTEL_IRMT_ASL_FILE)
+ @cl /C /EP $(INTEL_IRMT_ASL_FILE) > $(BUILD_DIR)\IntelRMT.asl
+ $(IASL) -p $(BUILD_DIR)\IntelRMT.aml $(BUILD_DIR)\IntelRMT.asl
+
+$(BUILD_DIR)\IntelRMT.sec: $(BUILD_DIR)\IntelRMT.aml
+ $(GENSECTION) -I $*.aml -O $@ -S EFI_SECTION_RAW
+
+#Note. Expand the package with PTID tables.
+# DXE phase will load the tables
+# and update Aml contents if provided in Acpiplatform.c
+
+$(BUILD_DIR)\IntelRMT.ffs: $(BUILD_DIR)\IntelRMT.sec
+ $(GENFFSFILE) -B $(BUILD_DIR) -V -o $@ -P1 <<$(BUILD_DIR)\IntelRMT.pkg
+
+PACKAGE.INF
+[.]
+BASE_NAME = IntelRMT
+FFS_FILEGUID = CE2007C7-B389-49c5-84E3-DB36A1F0993B
+FFS_FILETYPE = EFI_FV_FILETYPE_FREEFORM
+FFS_ATTRIB_CHECKSUM = TRUE
+
+IMAGE_SCRIPT =
+{
+ Compress (dummy) {
+ $(PROJECT_DIR)\$(BUILD_DIR)\IntelRMT.sec
+ }
+}
+<<KEEP
+
+
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2014, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/AcpiTables/SsdtIRMT/SsdtIRMT.sdl b/ReferenceCode/AcpiTables/SsdtIRMT/SsdtIRMT.sdl
new file mode 100644
index 0000000..62458f6
--- /dev/null
+++ b/ReferenceCode/AcpiTables/SsdtIRMT/SsdtIRMT.sdl
@@ -0,0 +1,31 @@
+TOKEN
+ Name = "IntelRMT_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable Intel Ready Mode Technology support in Project"
+ TokenType = Boolean
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "INTEL_SSDTIRMT_DIR"
+End
+
+TOKEN
+ Name = "INTEL_IRMT_ASL_FILE"
+ Value = "$(INTEL_SSDTIRMT_DIR)\IntelRMT.asl"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+MODULE
+ Help = "Includes SsdtIRMT.mak to Project"
+ File = "SsdtIRMT.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\IntelRMT.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/AcpiTables/SsdtPtid/Ptid.asl b/ReferenceCode/AcpiTables/SsdtPtid/Ptid.asl
new file mode 100644
index 0000000..c05a9c3
--- /dev/null
+++ b/ReferenceCode/AcpiTables/SsdtPtid/Ptid.asl
@@ -0,0 +1,534 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Haswell *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+
+
+//
+// Defined as an SSDT to be able to dynamically load based on BIOS
+// setup options
+//
+DefinitionBlock (
+ "PTID.aml",
+ "SSDT",
+ 0x01,
+ "TrmRef",
+ "PtidDevc",
+ 0x1000
+ )
+
+
+{
+ Scope(\_SB)
+ {
+ // External References to the actual data locations that stores
+ // various temperature and power values (either from EC or by
+ // other means)
+ //
+
+ // Embedded Controller Availability Flag
+ External(\_SB.PCI0.LPCB.H_EC.ECAV, IntObj)
+ // Board id checks
+ External(\BID, IntObj)
+ External(\BHB, IntObj)
+ External(\BFS2, IntObj)
+ External(\BFS3, IntObj)
+ External(\BFS4, IntObj)
+
+ // externs for TSDD
+ External(DTS1) // DTS Core 0 Temp
+ External(DTS2) // DTS Core 1 Temp
+ External(DTS3) // DTS Core 2 Temp
+ External(DTS4) // DTS Core 3 Temp
+ External(PDTS) // Package DTS Core Temp
+ External(\_SB.PCI0.LPCB.H_EC.CVRT) // CPU Core VR (IMVP) Temperature
+ External(\_SB.PCI0.LPCB.H_EC.GTVR) // CPU GT VR (IMVP) Temperature
+ External(\_SB.PCI0.LPCB.H_EC.FANT) // Heat Exchanger Fan Temperature
+ External(\_SB.PCI0.LPCB.H_EC.SKNT) // Skin Temperature
+ External(\_SB.PCI0.LPCB.H_EC.AMBT) // Ambient Temperature
+ External(\_SB.PCI0.LPCB.H_EC.DIM0) // Channel 0 DIMM Temperature
+ External(\_SB.PCI0.LPCB.H_EC.DIM1) // Channel 1 DIMM Temperature
+ External(\_SB.PCI0.LPCB.H_EC.PMAX) // CPU, MCH & PCH Max Temperature
+ External(\_SB.PCI0.LPCB.H_EC.PPDT) // PCH DTS Temperature from PCH
+ External(\_SB.PCI0.LPCB.H_EC.PECH) // CPU PECI reading
+ External(\_SB.PCI0.LPCB.H_EC.PMDT) // MCH DTS Temperature from PCH
+ External(\_SB.PCI0.LPCB.H_EC.TSD0) // TS-on-DIMM0 Temperature
+ External(\_SB.PCI0.LPCB.H_EC.TSD1) // TS-on-DIMM1 Temperature
+ External(\_SB.PCI0.LPCB.H_EC.TSD2) // TS-on-DIMM2 Temperature
+ External(\_SB.PCI0.LPCB.H_EC.TSD3) // TS-on-DIMM3 Temperature
+ External(\_TZ.TZ00._TMP) // Thermal Zone 00 Temperature
+ External(\_TZ.TZ01._TMP) // Thermal Zone 01 Temperature
+
+ // externs for PSDD
+ External(\_SB.PCI0.LPCB.H_EC.CPUP) // Platform Power mW
+ External(\_SB.PCI0.LPCB.H_EC.BPWR) // Brick Power cW(100ths)
+ External(\_SB.PCI0.LPCB.H_EC.PPWR) // Platform Power cW(100ths)
+ External(\_SB.PCI0.LPCB.H_EC.CPAP) // Platform Average Power mW
+ External(\_SB.PCI0.LPCB.H_EC.BKAP) // Brick average power in cW(0.01)
+ External(\_SB.PCI0.LPCB.H_EC.PLAP) // Platform average power in cW(0.01)
+ External(\_SB.PCI0.LPCB.H_EC.B1DC) // Battery 1 Design Capacity (mWh)
+ External(\_SB.PCI0.LPCB.H_EC.B1RC) // Battery 1 Remaining Capacity (mWh)
+ External(\_SB.PCI0.LPCB.H_EC.B1FC) // Battery 1 Full Charge Capacity (mWh)
+ External(\_SB.PCI0.LPCB.H_EC.B1FV) // Battery 1 Full Resolution Voltage (mV)
+ External(\_SB.PCI0.LPCB.H_EC.B1DI) // Battery 1 Full Resolution Discharge Current (mA)
+ External(\_SB.PCI0.LPCB.H_EC.B1CI) // Battery 1 Full Resolution Charge Current (mA)
+ External(\_SB.PCI0.LPCB.H_EC.B2RC) // Battery 2 Remaining Capacity (mWh)
+ External(\_SB.PCI0.LPCB.H_EC.B2FC) // Battery 2 Full Charge Capacity (mWh)
+ External(\_SB.PCI0.LPCB.H_EC.B2FV) // Battery 2 Full Resolution Voltage (mV)
+ External(\_SB.PCI0.LPCB.H_EC.B2DI) // Battery 2 Full Resolution Discharge Current (mA)
+ External(\_SB.PCI0.LPCB.H_EC.B2CI) // Battery 2 Full Resolution Charge Current (mA)
+ External(\_SB.PCI0.LPCB.H_EC.B1ML) // Battery Pack A maximum low byte
+ External(\_SB.PCI0.LPCB.H_EC.B1MH) // Battery Pack A maximum high byte
+ External(\_SB.PCI0.LPCB.H_EC.B2ML) // Battery Pack B maximum low byte
+ External(\_SB.PCI0.LPCB.H_EC.B2MH) // Battery Pack B maximum high byte
+
+ // externs for OSDD
+ External(\_SB.PCI0.LPCB.H_EC.CFSP) // CPU Fan #1 speed
+ External(\_SB.PCI0.LPCB.H_EC.CFS2) // CPU Fan #2 speed
+ External(\_SB.PCI0.LPCB.H_EC.MFSP) // GMCH Fan speed
+ External(\_SB.PCI0.LPCB.H_EC.PAKN) // Packet sequence number
+ External(\_SB.PCI0.LPCB.H_EC.CPUE) // CPU energy
+ // STS - SMBus Turbo Status (48 bits) from EC name space
+ External(\_SB.PCI0.LPCB.H_EC.SMTL) // MCP Temperature Limit(MTL)
+ External(\_SB.PCI0.LPCB.H_EC.SGTD) // GMCH Turbo Disabled(GTD)
+ External(\_SB.PCI0.LPCB.H_EC.SCTD) // CPU Turbo Disabled(CTD)
+ External(\_SB.PCI0.LPCB.H_EC.SPOL) // Policy Preference(PP)
+ External(\_SB.PCI0.LPCB.H_EC.SGPL) // GMCH Power Limit(GPL)
+ External(\_SB.PCI0.LPCB.H_EC.SCPL) // CPU Power Limit(CPL)
+ External(\_SB.PCI0.LPCB.H_EC.SMPL) // MPC Power Limit(MPL)
+ // HTS - Host Turbo Status(TBARB offset 50h) from MMIO
+ External(\_SB.PCI0.LPCB.H_EC.MMTL) // MCP Temperature Limit(MTL)
+ External(\_SB.PCI0.LPCB.H_EC.MGTD) // GMCH Turbo Disabled(GTD)
+ External(\_SB.PCI0.LPCB.H_EC.MCTD) // CPU Turbo Disabled(CTD)
+ External(\_SB.PCI0.LPCB.H_EC.MPOL) // Policy Preference(PP)
+ External(\_SB.PCI0.LPCB.H_EC.MGPL) // GMCH Power Limit(GPL)
+ External(\_SB.PCI0.LPCB.H_EC.MCPL) // CPU Power Limit(CPL)
+ External(\_SB.PCI0.LPCB.H_EC.MMPL) // MPC Power Limit(MPL)
+ // STS - SMBus Turbo Status(TBARB offset 98h) from MMIO
+ External(\_SB.PCI0.LPCB.H_EC.NMTL) // MCP Temperature Limit(MTL)
+ External(\_SB.PCI0.LPCB.H_EC.NGTD) // GMCH Turbo Disabled(GTD)
+ External(\_SB.PCI0.LPCB.H_EC.NCTD) // CPU Turbo Disabled(CTD)
+ External(\_SB.PCI0.LPCB.H_EC.NPOL) // Policy Preference(PP)
+ External(\_SB.PCI0.LPCB.H_EC.NGPL) // GMCH Power Limit(GPL)
+ External(\_SB.PCI0.LPCB.H_EC.NCPL) // CPU Power Limit(CPL)
+ // TC1 - Thermal Compares 1(TBARB offset A8h) from MMIO
+ External(\_SB.PCI0.LPCB.H_EC.TMPL) // MPC Power Limit(MPL)
+ // HTS - Host Turbo Status (48 bits) from EC name space
+ External(\_SB.PCI0.LPCB.H_EC.HMTL)
+ External(\_SB.PCI0.LPCB.H_EC.HGTD)
+ External(\_SB.PCI0.LPCB.H_EC.HCTD)
+ External(\_SB.PCI0.LPCB.H_EC.HPOL)
+ External(\_SB.PCI0.LPCB.H_EC.HGPL)
+ External(\_SB.PCI0.LPCB.H_EC.HCPL)
+ External(\_SB.PCI0.LPCB.H_EC.HMPL)
+ // Thermal Device Base Address Register for BIOS use.
+ External(TBAB)
+ // EC Data Buffer for ME SMBus Write Commands
+ External(\_SB.PCI0.LPCB.H_EC.MPCT)
+ External(\_SB.PCI0.LPCB.H_EC.MDT0)
+ // EC Command register
+ External(\_SB.PCI0.LPCB.H_EC.CMDR)
+ // EC Buffer to for ACPIPECIPacket
+ External(\_SB.PCI0.LPCB.H_EC.PRCL)
+ External(\_SB.PCI0.LPCB.H_EC.PRC0)
+ External(\_SB.PCI0.LPCB.H_EC.PRC1)
+ External(\_SB.PCI0.LPCB.H_EC.PRCM)
+ External(\_SB.PCI0.LPCB.H_EC.PRIN)
+ External(\_SB.PCI0.LPCB.H_EC.PSTE)
+ External(\_SB.PCI0.LPCB.H_EC.PCAD)
+ External(\_SB.PCI0.LPCB.H_EC.PEWL)
+ External(\_SB.PCI0.LPCB.H_EC.PWRL)
+ External(\_SB.PCI0.LPCB.H_EC.PECD)
+ External(\_SB.PCI0.LPCB.H_EC.PEHI)
+ External(\_SB.PCI0.LPCB.H_EC.PECI)
+ External(\_SB.PCI0.LPCB.H_EC.PEPL)
+ External(\_SB.PCI0.LPCB.H_EC.PEPM)
+ External(\_SB.PCI0.LPCB.H_EC.PWFC)
+ External(\_SB.PCI0.LPCB.H_EC.PECC)
+ External(\_SB.PCI0.LPCB.H_EC.PDT0)
+ External(\_SB.PCI0.LPCB.H_EC.PDT1)
+ External(\_SB.PCI0.LPCB.H_EC.PDT2)
+ External(\_SB.PCI0.LPCB.H_EC.PDT3)
+ External(\_SB.PCI0.LPCB.H_EC.PRFC)
+ External(\_SB.PCI0.LPCB.H_EC.PRS0)
+ External(\_SB.PCI0.LPCB.H_EC.PRS1)
+ External(\_SB.PCI0.LPCB.H_EC.PRS2)
+ External(\_SB.PCI0.LPCB.H_EC.PRS3)
+ External(\_SB.PCI0.LPCB.H_EC.PRS4)
+ External(\_SB.PCI0.LPCB.H_EC.PRCS)
+ External(\_SB.PCI0.LPCB.H_EC.PEC0)
+ External(\_SB.PCI0.LPCB.H_EC.PEC1)
+ External(\_SB.PCI0.LPCB.H_EC.PEC2)
+ External(\_SB.PCI0.LPCB.H_EC.PEC3)
+ External(\_SB.PCI0.LPCB.H_EC.TER1)
+ External(\_SB.PCI0.LPCB.H_EC.TER2)
+
+ External(\_SB.PCI0.LPCB.H_EC.ECMD, MethodObj)
+ External(\_SB.PCI0.LPCB.H_EC.ECRD, MethodObj)
+ External(\_SB.PCI0.LPCB.H_EC.ECWT, MethodObj)
+
+ External(\PAMT)
+
+
+ Device(PTID)
+ {
+ Name(_HID, EISAID("INT340E"))
+ Name(_CID, EISAID("PNP0C02"))
+
+ Name(IVER, 0x00030000) // Version 3
+
+ Method (_STA)
+ {
+ Return (0x0F)
+ }
+
+ Name(TSDL, Package()
+ { //Device Class //Name of Temperature Value
+ 0x00000000, "CPU Core 0 DTS", //not from ec
+ 0x00000000, "CPU Core 1 DTS", //not from ec
+ 0x00000000, "CPU Core 2 DTS", //not from ec
+ 0x00000000, "CPU Core 3 DTS", //not from ec
+ 0x00000000, "CPU Core Package DTS", //not from ec
+ 0x00000003, "CPU Core VR (IMVP) Temperature",
+ 0x00000003, "Heat Exchanger Fan Temperature",
+ 0x00000003, "Skin Temperature",
+ 0x00000003, "Ambient Temperature",
+ 0x00000002, "Channel 0 DIMM Temperature",
+ 0x00000002, "Channel 1 DIMM Temperature",
+ 0x00000000, "CPU Package Temperature",
+ 0x00000005, "PCH DTS Temperature from PCH",
+ 0x00000000, "CPU PECI reading",
+ 0x00000005, "SA DTS Temperature from PCH",
+ 0x00000002, "TS-on-DIMM0 Temperature",
+ 0x00000002, "TS-on-DIMM1 Temperature",
+ 0x00000002, "TS-on-DIMM2 Temperature",
+ 0x00000002, "TS-on-DIMM3 Temperature",
+ 0x00000002, "TZ00 _TMP", // not from EC
+ 0x00000002, "TZ01 _TMP" // not from EC
+ })
+
+ Name(PSDL, Package()
+ { // Device Class //Name of Power Value
+ 0x0000000B, "Platform Power (mW)",
+ 0x0000000B, "Brick Power cW(100ths)",
+ 0x0000000B, "Battery Discharge Power cW(100ths)",
+ 0x0000000B, "Platform Average Power (mW)",
+ 0x0000000B, "Brick Average Power cW(0.01)",
+ 0x0000000B, "Battery Discharge Average Power cW(0.01)",
+ 0x0000000C, "Battery 1 Design Capacity (mWh)",
+ 0x0000000C, "Battery 1 Remaining Capacity (mWh)",
+ 0x0000000C, "Battery 1 Full Charge Capacity (mWh)",
+ 0x0000000C, "Battery 1 Full Resolution Voltage (mV)",
+ 0x0000000C, "Battery 1 Full Resolution Discharge Current (mA)",
+ 0x0000000C, "Battery 1 Full Resolution Charge Current (mA)",
+ 0x0000000C, "Battery 2 Remaining Capacity (mWh)",
+ 0x0000000C, "Battery 2 Full Charge Capacity (mWh)",
+ 0x0000000C, "Battery 2 Full Resolution Voltage (mV)",
+ 0x0000000C, "Battery 2 Full Resolution Discharge Current (mA)",
+ 0x0000000C, "Battery 2 Full Resolution Charge Current (mA)",
+ 0x0000000C, "Battery Pack 1 maximum power (mW)",
+ 0x0000000C, "Battery Pack 2 maximum power (mW)"
+ })
+
+ Name(OSDL, Package()
+ { // Device Class // Descriptive Name //Unit
+ 0x00000000, "CPU Fan #1 Speed", "RPM",
+ 0x00000000, "CPU Fan #2 Speed", "RPM",
+ 0x00000003, "Skin Temp 0", "RAW",
+ 0x00000003, "Thermistor 1 ", "RAW",
+ 0x00000003, "Thermistor 2 ", "RAW",
+ })
+
+ Method(TSDD, 0)
+ {
+ Name (TMPV, Package() {
+ 0x80000000, 0x80000000,0x80000000, 0x80000000,
+ 0x80000000, 0x80000000,0x80000000, 0x80000000,
+ 0x80000000, 0x80000000,0x80000000, 0x80000000,
+ 0x80000000, 0x80000000,0x80000000, 0x80000000,
+ 0x80000000, 0x80000000,0x80000000, 0x80000000,
+ 0x80000000 })
+
+ Store(Add(Multiply(DTS1, 10), 2732), Index(TMPV, 0))
+ Store(Add(Multiply(DTS2, 10), 2732), Index(TMPV, 1))
+ Store(Add(Multiply(DTS3, 10), 2732), Index(TMPV, 2))
+ Store(Add(Multiply(DTS4, 10), 2732), Index(TMPV, 3))
+ Store(Add(Multiply(PDTS, 10), 2732), Index(TMPV, 4))
+ If(LEqual(\_SB.PCI0.LPCB.H_EC.ECAV,1)) // check EC opregion available
+ {
+ Store(Add(Multiply(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.CVRT)), 10), 2732), Index(TMPV, 5))
+ Store(Add(Multiply(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.FANT)), 10), 2732), Index(TMPV, 6))
+ Store(Add(Multiply(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.SKNT)), 10), 2732), Index(TMPV, 7))
+ Store(Add(Multiply(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.AMBT)), 10), 2732), Index(TMPV, 8))
+ Store(Add(Multiply(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.DIM0)), 10), 2732), Index(TMPV, 9))
+ Store(Add(Multiply(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.DIM1)), 10), 2732), Index(TMPV, 10))
+ Store(Add(Multiply(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PMAX)), 10), 2732), Index(TMPV, 11))
+ Store(Add(Multiply(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PPDT)), 10), 2732), Index(TMPV, 12))
+ Store(Add(Multiply(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PECH)), 10), 2732), Index(TMPV, 13))
+ Store(Add(Multiply(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PMDT)), 10), 2732), Index(TMPV, 14))
+ Store(Add(Multiply(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.TSD0)), 10), 2732), Index(TMPV, 15))
+ Store(Add(Multiply(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.TSD1)), 10), 2732), Index(TMPV, 16))
+ Store(Add(Multiply(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.TSD2)), 10), 2732), Index(TMPV, 17))
+ Store(Add(Multiply(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.TSD3)), 10), 2732), Index(TMPV, 18))
+ }
+ Store(\_TZ.TZ00._TMP, Index(TMPV, 19))
+ If(CondRefOf(\_TZ.TZ01)){
+ Store(\_TZ.TZ01._TMP, Index(TMPV, 20))
+ }
+ Return(TMPV)
+ }
+
+ Method(PSDD, 0, Serialized)
+ {
+ Name (PWRV, Package() {
+ 0x80000000,0x80000000,0x80000000,0x80000000,0x80000000,0x80000000,
+ 0x80000000,0x80000000,0x80000000,0x80000000,0x80000000,0x80000000,
+ 0x80000000,0x80000000,0x80000000,0x80000000,0x80000000,0x80000000,0x80000000
+ })
+ If(LEqual(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.ECAV)),1)) // check EC opregion available
+ {
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.CPUP)), Index(PWRV, 0))
+ Multiply(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.BPWR)), 10, Index(PWRV, 1))
+ Multiply(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PPWR)), 10, Index(PWRV, 2))
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.CPAP)), Index(PWRV, 3))
+ Multiply(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.BKAP)), 10, Index(PWRV, 4))
+ Multiply(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PLAP)), 10, Index(PWRV, 5))
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.B1DC)), Index(PWRV, 6))
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.B1RC)), Index(PWRV, 7))
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.B1FC)), Index(PWRV, 8))
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.B1FV)), Index(PWRV, 9))
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.B1DI)), Index(PWRV, 10))
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.B1CI)), Index(PWRV, 11))
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.B2RC)), Index(PWRV, 12))
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.B2FC)), Index(PWRV, 13))
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.B2FV)), Index(PWRV, 14))
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.B2DI)), Index(PWRV, 15))
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.B2CI)), Index(PWRV, 16))
+ // convert PMAX from signed to unsigned integer
+ // PMAX Value = (NOT(OR(FFFF0000, ECValue))+1) * 10.
+ Add(ShiftLeft(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.B1MH)), 8), \_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.B1ML)),Local0) // Get high and low byte from EC.
+ If(Local0){ // don't convert a zero
+ Not(Or(0xFFFF0000,Local0,Local0),Local0) // make it a 32 bit value before inverting the bits
+ Multiply(Add(1,Local0,Local0),10,Local0) // add 1 and multiply by 10
+ }
+ Store(Local0,Index(PWRV, 17))
+ // PMAX Value = (NOT(OR(FFFF0000, ECValue))+1) * 10.
+ Add(ShiftLeft(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.B2MH)), 8),\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.B2ML)),Local0) // Get high and low byte from EC.
+ If(Local0){ // don't convert a zero
+ Not(Or(0xFFFF0000,Local0,Local0),Local0) // make it a 32 bit value before inverting the bits
+ Multiply(Add(1,Local0,Local0),10,Local0) // add 1 and multiply by 10
+ }
+ Store(Local0,Index(PWRV, 18))
+ }
+ Return (PWRV)
+ }
+
+ Method(OSDD, 0)
+ {
+ Name (OSDV, Package () {0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000})
+ If(LEqual(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.ECAV)),1)) // check EC opregion available
+ {
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.CFSP)), Index(OSDV, 0))
+ If(LOr(LOr(LEqual(BID,BHB), LEqual(BID,BFS2)), LOr(LEqual(BID,BFS3), LEqual(BID,BFS4)))) //BoardIdHarrisBeachFfrd, BoardIdFfrdSku2, BoardIdFfrdSku3, BoardIdFfrdSku4
+ {
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.CFS2)), Index(OSDV, 1))
+ }
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.SKNT)), Index(OSDV, 2))
+ If(LOr(LOr(LEqual(BID,BHB), LEqual(BID,BFS2)), LOr(LEqual(BID,BFS3), LEqual(BID,BFS4)))) //BoardIdHarrisBeachFfrd, BoardIdFfrdSku2, BoardIdFfrdSku3, BoardIdFfrdSku4
+ {
+ // Thermistor values are 10 bit but EC only exposes the high 8 bits. Shift left 2 gives the real number.
+ Store(ShiftLeft(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.TER1)),2), Index(OSDV, 3))
+ Store(ShiftLeft(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.TER2)),2), Index(OSDV, 4))
+ }
+ }
+ Return(OSDV)
+ }
+
+ Method (SDSP)
+ {
+ Return(10) // Sampling period .
+ }
+
+ // PECI ACPI Access method
+ Name(PADA, Package()
+ {
+ 0x01, // Access Mode -ACPI
+ 0xFFFFFFFF, // Command Status port
+ 0xFFFFFFFF, // Data port
+ 26, // MailBox length
+ 0xFFFFFFFF, // WritePECIMailBoxDataCommand
+ 0xFFFFFFFF, // ReadPECIMailBoxDataCommand
+ 0xFFFFFFFF, // IssuePECIcommand
+ 0xFFFFFFFF, // EndPECICommand
+ 0xFFFFFFFF, // ReadStatusCommand
+ 0xFFFFFFFF // ReadErrorCountCommand
+ })
+
+ // PECI Direct I/O Access method
+ Name(PADD, Package()
+ {
+ 0x02, // Access Mode
+ 0x6A4, // Command Status port
+ 0x6A0, // Data port
+ 26, // MailBox length
+ 0x62, // WritePECIMailBoxDataCommand
+ 0x63, // ReadPECIMailBoxDataCommand
+ 0x60, // IssuePECIcommand
+ 0x61, // EndPECICommand
+ 0x65, // ReadStatusCommand
+ 0x64 // ReadErrorCountCommand
+ })
+
+ Method (PADT)
+ {
+ If(PAMT) {
+ Return (PADA)
+ }
+ Return (PADD)
+ }
+
+ Method (RPMD)
+ {
+ Name (MTMP, Buffer(26) {})
+ If(LEqual(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.ECAV)),1)) // check EC opregion available
+ {
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PRCL)), Index(MTMP,0))
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PRC0)), Index(MTMP,1))
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PRC1)), Index(MTMP,2))
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PRCM)), Index(MTMP,3))
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PRIN)), Index(MTMP,4))
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PSTE)), Index(MTMP,5))
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PCAD)), Index(MTMP,6))
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PEWL)), Index(MTMP,7))
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PWRL)), Index(MTMP,8))
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PECD)), Index(MTMP,9))
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PEHI)), Index(MTMP,10))
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PECI)), Index(MTMP,11))
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PEPL)), Index(MTMP,12))
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PEPM)), Index(MTMP,13))
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PWFC)), Index(MTMP,14))
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PECC)), Index(MTMP,15))
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PDT0)), Index(MTMP,16))
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PDT1)), Index(MTMP,17))
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PDT2)), Index(MTMP,18))
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PDT3)), Index(MTMP,19))
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PRFC)), Index(MTMP,20))
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PRS0)), Index(MTMP,21))
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PRS1)), Index(MTMP,22))
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PRS2)), Index(MTMP,23))
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PRS3)), Index(MTMP,24))
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PRS4)), Index(MTMP,25))
+ }
+ Return (MTMP)
+ }
+
+ Method (WPMD,1)
+ {
+ If (LNotEqual(Sizeof(Arg0), 26)) {
+ Return (0xFFFFFFFF)
+ }
+
+ If(LEqual(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.ECAV)),1)) // check EC opregion available
+ {
+ \_SB.PCI0.LPCB.H_EC.ECWT(DeRefOf(Index(Arg0,0)), RefOf(\_SB.PCI0.LPCB.H_EC.PRCL))
+ \_SB.PCI0.LPCB.H_EC.ECWT(DeRefOf(Index(Arg0,1)), RefOf(\_SB.PCI0.LPCB.H_EC.PRC0))
+ \_SB.PCI0.LPCB.H_EC.ECWT(DeRefOf(Index(Arg0,2)), RefOf(\_SB.PCI0.LPCB.H_EC.PRC1))
+ \_SB.PCI0.LPCB.H_EC.ECWT(DeRefOf(Index(Arg0,3)), RefOf(\_SB.PCI0.LPCB.H_EC.PRCM))
+ \_SB.PCI0.LPCB.H_EC.ECWT(DeRefOf(Index(Arg0,4)), RefOf(\_SB.PCI0.LPCB.H_EC.PRIN))
+ \_SB.PCI0.LPCB.H_EC.ECWT(DeRefOf(Index(Arg0,5)), RefOf(\_SB.PCI0.LPCB.H_EC.PSTE))
+ \_SB.PCI0.LPCB.H_EC.ECWT(DeRefOf(Index(Arg0,6)), RefOf(\_SB.PCI0.LPCB.H_EC.PCAD))
+ \_SB.PCI0.LPCB.H_EC.ECWT(DeRefOf(Index(Arg0,7)), RefOf(\_SB.PCI0.LPCB.H_EC.PEWL))
+ \_SB.PCI0.LPCB.H_EC.ECWT(DeRefOf(Index(Arg0,8)), RefOf(\_SB.PCI0.LPCB.H_EC.PWRL))
+ \_SB.PCI0.LPCB.H_EC.ECWT(DeRefOf(Index(Arg0,9)), RefOf(\_SB.PCI0.LPCB.H_EC.PECD))
+ \_SB.PCI0.LPCB.H_EC.ECWT(DeRefOf(Index(Arg0,10)), RefOf(\_SB.PCI0.LPCB.H_EC.PEHI))
+ \_SB.PCI0.LPCB.H_EC.ECWT(DeRefOf(Index(Arg0,11)), RefOf(\_SB.PCI0.LPCB.H_EC.PECI))
+ \_SB.PCI0.LPCB.H_EC.ECWT(DeRefOf(Index(Arg0,12)), RefOf(\_SB.PCI0.LPCB.H_EC.PEPL))
+ \_SB.PCI0.LPCB.H_EC.ECWT(DeRefOf(Index(Arg0,13)), RefOf(\_SB.PCI0.LPCB.H_EC.PEPM))
+ \_SB.PCI0.LPCB.H_EC.ECWT(DeRefOf(Index(Arg0,14)), RefOf(\_SB.PCI0.LPCB.H_EC.PWFC))
+ \_SB.PCI0.LPCB.H_EC.ECWT(DeRefOf(Index(Arg0,15)), RefOf(\_SB.PCI0.LPCB.H_EC.PECC))
+ \_SB.PCI0.LPCB.H_EC.ECWT(DeRefOf(Index(Arg0,16)), RefOf(\_SB.PCI0.LPCB.H_EC.PDT0))
+ \_SB.PCI0.LPCB.H_EC.ECWT(DeRefOf(Index(Arg0,17)), RefOf(\_SB.PCI0.LPCB.H_EC.PDT1))
+ \_SB.PCI0.LPCB.H_EC.ECWT(DeRefOf(Index(Arg0,18)), RefOf(\_SB.PCI0.LPCB.H_EC.PDT2))
+ \_SB.PCI0.LPCB.H_EC.ECWT(DeRefOf(Index(Arg0,19)), RefOf(\_SB.PCI0.LPCB.H_EC.PDT3))
+ \_SB.PCI0.LPCB.H_EC.ECWT(DeRefOf(Index(Arg0,20)), RefOf(\_SB.PCI0.LPCB.H_EC.PRFC))
+ \_SB.PCI0.LPCB.H_EC.ECWT(DeRefOf(Index(Arg0,21)), RefOf(\_SB.PCI0.LPCB.H_EC.PRS0))
+ \_SB.PCI0.LPCB.H_EC.ECWT(DeRefOf(Index(Arg0,22)), RefOf(\_SB.PCI0.LPCB.H_EC.PRS1))
+ \_SB.PCI0.LPCB.H_EC.ECWT(DeRefOf(Index(Arg0,23)), RefOf(\_SB.PCI0.LPCB.H_EC.PRS2))
+ \_SB.PCI0.LPCB.H_EC.ECWT(DeRefOf(Index(Arg0,24)), RefOf(\_SB.PCI0.LPCB.H_EC.PRS3))
+ \_SB.PCI0.LPCB.H_EC.ECWT(DeRefOf(Index(Arg0,25)), RefOf(\_SB.PCI0.LPCB.H_EC.PRS4))
+ \_SB.PCI0.LPCB.H_EC.ECMD (0x67)
+ }
+ Return (0)
+ }
+
+ Method (ISPC)
+ {
+ If(LEqual(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.ECAV)),1)) // check EC opregion available
+ {
+ \_SB.PCI0.LPCB.H_EC.ECMD (0x65)
+ }
+ Return (0)
+ }
+
+ Method (ENPC)
+ {
+ If(LEqual(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.ECAV)),1)) // check EC opregion available
+ {
+ \_SB.PCI0.LPCB.H_EC.ECMD (0x66)
+ }
+ Return (0)
+ }
+
+ Method (RPCS)
+ {
+ If(LEqual(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.ECAV)),1)) // check EC opregion available
+ {
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PRCS)), Local0)
+ }
+ Return (Local0)
+ }
+
+ Method (RPEC)
+ {
+ Store(0,Local0)
+ If(LEqual(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.ECAV)),1)) // check EC opregion available
+ {
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PEC0)), Local1)
+ Or(Local0,Local1,Local0)
+
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PEC1)), Local1)
+ Or(Local0,ShiftLeft(Local1,8),Local0)
+
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PEC2)), Local1)
+ Or(Local0,ShiftLeft(Local1,16),Local0)
+
+ Store(\_SB.PCI0.LPCB.H_EC.ECRD(RefOf(\_SB.PCI0.LPCB.H_EC.PEC3)), Local1)
+ Or(Local0,ShiftLeft(Local1,24),Local0)
+ }
+ return (Local0)
+ }
+
+ }
+ } // end \_SB scope
+} // end SSDT
diff --git a/ReferenceCode/AcpiTables/SsdtPtid/SsdtPtid.cif b/ReferenceCode/AcpiTables/SsdtPtid/SsdtPtid.cif
new file mode 100644
index 0000000..348199f
--- /dev/null
+++ b/ReferenceCode/AcpiTables/SsdtPtid/SsdtPtid.cif
@@ -0,0 +1,10 @@
+<component>
+ name = "SsdtPtid"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\AcpiTables\SsdtPtid\"
+ RefName = "SsdtPtid"
+[files]
+"SsdtPtid.sdl"
+"SsdtPtid.mak"
+"Ptid.asl"
+<endComponent>
diff --git a/ReferenceCode/AcpiTables/SsdtPtid/SsdtPtid.mak b/ReferenceCode/AcpiTables/SsdtPtid/SsdtPtid.mak
new file mode 100644
index 0000000..b9d48fe
--- /dev/null
+++ b/ReferenceCode/AcpiTables/SsdtPtid/SsdtPtid.mak
@@ -0,0 +1,80 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+#<AMI_FHDR_START>
+#
+# Name: SsdtPtid.mak
+#
+# Description: MAke file to build Aptio ACPI ASL components
+#
+#
+#<AMI_FHDR_END>
+#*************************************************************************
+all : BuildPTID
+
+BuildPTID : $(BUILD_DIR)\PTID.ffs
+
+#-----------------------------------------------------------------------
+# ASL compiler definition
+#-----------------------------------------------------------------------
+!IF "$(ACPIPLATFORM_ASL_COMPILER)"==""
+!ERROR It is an invalid path, please check your ASL compiler path.
+!ENDIF
+
+IASL = $(ACPIPLATFORM_ASL_COMPILER)
+#-----------------------------------------------------------------------
+$(BUILD_DIR)\ptid.aml : $(INTEL_PTID_ASL_FILE)
+ @cl /C /EP $(INTEL_PTID_ASL_FILE) > $(BUILD_DIR)\ptid.asl
+ $(IASL) -p $(BUILD_DIR)\ptid.aml $(BUILD_DIR)\ptid.asl
+
+$(BUILD_DIR)\ptid.sec: $(BUILD_DIR)\ptid.aml
+ $(GENSECTION) -I $*.aml -O $@ -S EFI_SECTION_RAW
+
+#Note. Expand the package with PTID tables.
+# DXE phase will load the tables
+# and update Aml contents if provided in Acpiplatform.c
+
+$(BUILD_DIR)\PTID.ffs: $(BUILD_DIR)\ptid.sec
+ $(GENFFSFILE) -B $(BUILD_DIR) -V -o $@ -P1 <<$(BUILD_DIR)\ptid.pkg
+
+PACKAGE.INF
+[.]
+BASE_NAME = PTID
+FFS_FILEGUID = 95DFCAE5-BB28-4d6b-B1E2-3AF3A6BF434F
+FFS_FILETYPE = EFI_FV_FILETYPE_FREEFORM
+FFS_ATTRIB_CHECKSUM = TRUE
+
+IMAGE_SCRIPT =
+{
+ Compress (dummy) {
+ $(PROJECT_DIR)\$(BUILD_DIR)\ptid.sec
+ }
+}
+<<KEEP
+
+
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/AcpiTables/SsdtPtid/SsdtPtid.sdl b/ReferenceCode/AcpiTables/SsdtPtid/SsdtPtid.sdl
new file mode 100644
index 0000000..d1d3a87
--- /dev/null
+++ b/ReferenceCode/AcpiTables/SsdtPtid/SsdtPtid.sdl
@@ -0,0 +1,32 @@
+TOKEN
+ Name = "PTID_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable SsdtPtid support in Project"
+ TokenType = Boolean
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "INTEL_SSDTPTID_DIR"
+End
+
+TOKEN
+ Name = "INTEL_PTID_ASL_FILE"
+ Value = "$(INTEL_SSDTPTID_DIR)\ptid.asl"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+MODULE
+ Help = "Includes SsdtPtid.mak to Project"
+ File = "SsdtPtid.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PTID.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+ Token = "PTID_SUPPORT" "=" "1"
+End
diff --git a/ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/Pch.asl b/ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/Pch.asl
new file mode 100644
index 0000000..2b95557
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/Pch.asl
@@ -0,0 +1,977 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Haswell *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+ //
+ // RPAx is root port addresses, which are updated when post to reflect
+ // the root port function number swapping.
+ //
+ Name (RPA0, 0x001C0000)
+ Name (RPA1, 0x001C0001)
+ Name (RPA2, 0x001C0002)
+ Name (RPA3, 0x001C0003)
+ Name (RPA4, 0x001C0004)
+ Name (RPA5, 0x001C0005)
+ Name (RPA6, 0x001C0006)
+ Name (RPA7, 0x001C0007)
+
+ //
+ // PCHS stands for PCH series. This will be updated when post.
+ // 1: PchH
+ // 2: PchLp
+ // others: unknown
+ //
+ Name (PCHS, 0xFFFFFFFF)
+
+ //
+ // Reserved MEM range for S3 Save/restore with 64K in size.
+ // This will be updated when post.
+ //
+ Name (SRMB, 0xFFFFFFFF)
+
+ //
+ // Maximum Snoop Latency and Maximum No-Snoop Latency values for PCIE.
+ // This will be updated when post.
+ //
+ Name (PML1, 0xFFFFFFFF)
+ Name (PML2, 0xFFFFFFFF)
+ Name (PML3, 0xFFFFFFFF)
+ Name (PML4, 0xFFFFFFFF)
+ Name (PML5, 0xFFFFFFFF)
+ Name (PML6, 0xFFFFFFFF)
+ Name (PML7, 0xFFFFFFFF)
+ Name (PML8, 0xFFFFFFFF)
+ Name (PNL1, 0xFFFFFFFF)
+ Name (PNL2, 0xFFFFFFFF)
+ Name (PNL3, 0xFFFFFFFF)
+ Name (PNL4, 0xFFFFFFFF)
+ Name (PNL5, 0xFFFFFFFF)
+ Name (PNL6, 0xFFFFFFFF)
+ Name (PNL7, 0xFFFFFFFF)
+ Name (PNL8, 0xFFFFFFFF)
+
+Scope(\)
+{
+ //
+ // Define the IO Address 0810h-0813h as an ACPI Operating Region first, and
+ // then it will be dynamically updated during initialization of DTS code.
+ // The address presented here may not be the actual address used.
+ // This address range is used as a DTS I/O Trap SMI so that ASL and SMI
+ // can communicate when needed.
+ //
+ OperationRegion(IO_D,SystemIO,0x810,0x4)
+ Field(IO_D,ByteAcc,NoLock,Preserve) {
+ TRPD, 8 // 0x810 = DTS I/O Trap
+ }
+ //
+ // The IO address in this ACPI Operating Region will be updated during POST.
+ // This address range is used as a HotKey I/O Trap SMI so that ASL and SMI can
+ // communicate when needed.
+ //
+ OperationRegion(IO_H,SystemIO,0x1000,0x4)
+ Field(IO_H,ByteAcc,NoLock,Preserve) {
+ TRPH, 8
+ }
+ //
+ // Define PCH PMBASE I/O as an ACPI operating region. The base address
+ // can be found in Device 31, Registers 40-43h.
+ //
+ OperationRegion(PMIO, SystemIo, \PMBS, 0x80)
+ Field(PMIO, ByteAcc, NoLock, Preserve) {
+ Offset(0x28), // GPE0 Enable
+ , 16,
+ , 3, // GPE for 0-2 GPIO's
+ GPE3, 1,
+ , 7, // GPE for 4-0xA GPIO's
+ GPEB, 1,
+ Offset(0x3c), // UPRWC - USB Per-Port registers write control
+ , 1,
+ UPRW, 1, // USB Per-Port registers write enable
+ Offset(0x42), // General Purpose Control
+ , 1,
+ GPEC, 1
+ }
+ Field(PMIO, ByteAcc, NoLock, WriteAsZeros) {
+ Offset(0x20), // GPE0 Status
+ , 16,
+ , 3, // GPS for 0-2 GPIO's
+ GPS3, 1,
+ , 7, // GPS for 4-0xa GPIO's
+ GPSB, 1,
+ Offset(0x64), // TCO status register
+ , 9,
+ SCIS, 1, // TCO DMI SCI status
+ , 6
+ }
+
+ //
+ // Define PCH PMBASE I/O as an ACPI operating region. The base address
+ // can be found in Device 31, Registers 40-43h.
+ //
+ OperationRegion(PMLP, SystemIo, Add(\PMBS,0x80), 0x20)
+ Field(PMLP, ByteAcc, NoLock, Preserve) {
+ Offset(0x10), // GPE0 Enable
+ , 8,
+ GE08, 1,
+ , 8,
+ GE17, 1,
+ , 27,
+ GE45, 1,
+ , 5,
+ GE51, 1,
+ , 76,
+ }
+ Field(PMLP, ByteAcc, NoLock, WriteAsZeros) {
+ Offset(0x00), // GPE0 Status
+ , 8,
+ GS08, 1,
+ , 8,
+ GS17, 1,
+ , 27,
+ GS45, 1,
+ , 5,
+ GS51, 1,
+ , 76,
+ }
+
+ //
+ // Define PCH GPIO I/O as an ACPI operating region.
+ // The base address can be found in Device 31, Registers 48-4Bh.
+ //
+
+ OperationRegion(GPR, SystemIo, \GPBS, 0x400)
+ Field(GPR, ByteAcc, NoLock, Preserve) {
+ Offset(0x00), // GPIO, Use Select, Bank 0
+ GU00, 8,
+ GU01, 8,
+ GU02, 8,
+ GU03, 8,
+ Offset(0x04), // GPIO, I/O Select, Bank 0
+ GIO0, 8,
+ GIO1, 8,
+ GIO2, 8,
+ GIO3, 8,
+ Offset(0x0C), // GPIO, Level, Bank 0
+ GL00, 8,
+ GL01, 8,
+ GL02, 8,
+ GP24, 1,
+ , 2,
+ GP27, 1, // SATA_PWR_EN#0
+ GP28, 1, // SATA_PWR_EN#1 (SATA Ports 1 and 2)
+ , 3,
+ Offset(0x18),
+ GB00, 8, // GPIO, Blink, Bank 0
+ GB01, 8,
+ GB02, 8,
+ GB03, 8,
+ Offset(0x2C),
+ GIV0, 8, // GPIO, Invert, Bank 0
+ GIV1, 8,
+ GIV2, 8,
+ GIV3, 8,
+ Offset(0x30), // GPIO, Use Select, Bank 1
+ GU04, 8,
+ GU05, 8,
+ GU06, 8,
+ GU07, 8,
+ Offset(0x34), // GPIO, I/O Select, Bank 1
+ GIO4, 8,
+ GIO5, 8,
+ GIO6, 8,
+ GIO7, 8,
+ Offset(0x38), // GPIO, Level, Bank 1
+ GL04, 8,
+ GL05, 8,
+ GL06, 8,
+ GL07, 8,
+ Offset(0x40), // GPIO, Use Select, Bank 2
+ GU08, 8,
+ GU09, 8,
+ GU0A, 8,
+ GU0B, 8,
+ Offset(0x44), // GPIO, I/O Select, Bank 2
+ GIO8, 8,
+ GIO9, 8,
+ GIOA, 8,
+ GIOB, 8,
+ Offset(0x48), // GPIO, Level, Bank 2
+ GL08, 8,
+ GL09, 8,
+ GL0A, 8,
+ GL0B, 8
+ }
+
+ //
+ // Define PCH GPIO I/O as an ACPI operating region.
+ // The base address can be found in Device 31, Registers 48-4Bh.
+ //
+ OperationRegion(GPRL, SystemIo, \GPBS, 0x40)
+ Field(GPRL, ByteAcc, NoLock, Preserve) {
+ Offset(0x00), // GPI_OWN, 0 => ACPI driver owned
+ , 8,
+ GO08, 1,
+ GO09, 1,
+ , 3,
+ GO13, 1,
+ GO14, 1,
+ , 2,
+ GO17, 1,
+ , 27,
+ GO45, 1,
+ , 5,
+ GO51, 1,
+ , 76,
+ Offset(0x30), // GPI_ROUT, 0 => SCI
+ GR00, 32,
+ GR01, 32,
+ GR02, 32
+ }
+
+ //
+ // Define a Memory Region that will allow access to the Root Complex
+ // Register Block. Note that in the Intel Reference Solution, the RCBA
+ // will get fixed up dynamically during POST.
+ //
+ OperationRegion(RCRB,SystemMemory,\SRCB,0x4000)
+ Field(RCRB,DWordAcc,Lock,Preserve) {
+ Offset(0x0000), // Backbone Related Registers
+ Offset(0x1000), // Other Chipset Registers
+#ifdef TRAD_FLAG
+ Offset(0x2330), // SBI AFE Address
+ AFEA, 32,
+ Offset(0x2334), // SBI AFE Data
+ AFED, 32,
+ Offset(0x2338), // SBI AFE Status
+ AFES, 16,
+ Offset(0x233A), // SBI AFE Routing Id
+ AFER, 16,
+#endif // TRAD_FLAG
+ Offset(0x3000), // Legacy\Other Chipset Configuration Registers
+ Offset(0x331c),
+ , 24,
+ PMFS, 1, // PCIe Source Clock Request Status
+ Offset(0x3320),
+ CKEN, 32, // PCIe Source Clock Enable Register
+ Offset(0x3404), // High Performance Timer Configuration
+ HPAS, 2, // (1:0) High Performance Address Select
+ , 5, // (6:2) Reserved
+ HPAE, 1, // (7) High Performance Address Enable
+ Offset(0x3418), // Function Disable Register
+ , 1, // (0) Reserved
+ ADSD, 1, // (1) Audio DSP Disable
+ SATD, 1, // (2) Serial ATA Disable
+ SMBD, 1, // (3) SMBus Disable
+ HDAD, 1, // (4) High Definition Audio Disable
+ , 11, // (15:5) Skip for now
+ RP1D, 1, // (16) Root Port 1 Disable
+ RP2D, 1, // (17) Root Port 2 Disable
+ RP3D, 1, // (18) Root Port 3 Disable
+ RP4D, 1, // (19) Root Port 4 Disable
+ RP5D, 1, // (20) Root Port 5 Disable
+ RP6D, 1, // (21) Root Port 6 Disable
+ RP7D, 1, // (22) Root Port 7 Disable
+ RP8D, 1, // (23) Root Port 8 Disable
+ Offset(0x359c), // Usb Port Disable Override Register
+ UP0D, 1, // (0) Usb Port 0 disable
+ UP1D, 1, // (1) Usb Port 1 disable
+ UP2D, 1, // (2) Usb Port 2 disable
+ UP3D, 1, // (3) Usb Port 3 disable
+ UP4D, 1, // (4) Usb Port 4 disable
+ UP5D, 1, // (5) Usb Port 5 disable
+ UP6D, 1, // (6) Usb Port 6 disable
+ UP7D, 1, // (7) Usb Port 7 disable
+ UP8D, 1, // (8) Usb Port 8 disable
+ UP9D, 1, // (9) Usb Port 9 disable
+ UPAD, 1, // (10) Usb Port 10 disable
+ UPBD, 1, // (11) Usb Port 11 disable
+ UPCD, 1, // (12) Usb Port 12 disable
+ UPDD, 1, // (13) Usb Port 13 disable
+ , 1, // (14) Reserved
+ , 1 // (15) Reserved
+ }
+ //
+ // Support S0, S3, S4, and S5. The proper bits to be set when
+ // entering a given sleep state are found in the Power Management
+ // 1 Control ( PM1_CNT ) register, located at ACPIBASE + 04h,
+ // bits 10d - 12d.
+ //
+
+ //
+ // Define the IO Address 1000h-1003h as an ACPI Operating Region first, and
+ // then it will be dynamically updated during initialization of PFAT code.
+ // The address presented here may not be the actual address used.
+ // This address range is used as a PFAT Tools Interface I/O Trap so that the
+ // update tool can trigger bios code to update the flash using the pfat flow.
+ //
+ OperationRegion (IO_P, SystemIO, 0x1000, 0x4)
+ Field (IO_P, ByteAcc, NoLock, Preserve) {
+ TRPF, 8 // 0x1000 = PFAT I/O Trap
+ }
+
+} //end Scope(\)
+
+ Scope (\_SB)
+ {
+
+ Method(RDGI,1,Serialized) //Read the value of Input GPIO Line
+ {
+ // Function to Read GPIO
+ //
+ // Arg0 : GPIn : GPIO Pin number to be read(Zero based)
+ //
+ If(LLessEqual(Arg0, 94)){
+ // GPBS - GPIO Base Address - 0x800
+ // Local0 = GPIOBASE + 100h + (GPIn * 0x08)
+ Store( Add(Add(GPBS,0x100) , Multiply(Arg0,0x08)),Local0)
+ OperationRegion(LGPI, SystemIo, Local0, 4)
+ Field(LGPI, AnyAcc, NoLock, Preserve) {
+ Offset(0x0),
+ ,30,
+ TEMP, 1
+ }
+ Return(TEMP)
+ }
+ //AMI_OVERRIDE ---- Fixed for Ubuntu Firmware Test >>
+ Return(0)
+ //AMI_OVERRIDE ---- Fixed for Ubuntu Firmware Test <<
+ } // End of Method(RDGI,1)
+
+ Method(RDGP,1,Serialized)
+ {
+ // Function to Read GPIO
+ //
+ // Arg0 : GPIn : GPIO Pin number to be read(Zero based)
+ //
+ If(LLessEqual(Arg0, 94)){
+ // GPBS - GPIO Base Address - 0x800
+ // Local0 = GPIOBASE + 100h + (GPIn * 0x08)
+ Store( Add(Add(GPBS,0x100) , Multiply(Arg0,0x08)),Local0)
+ OperationRegion(LGPI, SystemIo, Local0, 4)
+ Field(LGPI, AnyAcc, NoLock, Preserve) {
+ Offset(0x0),
+ ,31,
+ TEMP, 1
+ }
+ Return(TEMP)
+ }
+ //AMI_OVERRIDE ---- Fixed for Ubuntu Firmware Test >>
+ Return(0)
+ //AMI_OVERRIDE ---- Fixed for Ubuntu Firmware Test <<
+ } // End of Method(RDGP,1)
+
+ Method(WTGP,2,Serialized)
+ {
+ // Function to write GPIO
+ // Arg0 - GPIn : GPIO Pin number to write
+ // Arg1 - Value to be written
+ //
+ If(LLessEqual(Arg0, 94)){
+ Store( Add(Add(GPBS,0x100) , Multiply(Arg0,0x08)),Local0)
+ OperationRegion(LGPI, SystemIo, Local0, 4)
+ Field(LGPI, AnyAcc, NoLock, Preserve) {
+ Offset(0x0),
+ , 31,
+ TEMP, 1
+ }
+ Store(Arg1,TEMP)
+ }
+ }
+ Method(WTIN,2,Serialized)
+ {
+ // Function to write GPIO
+ // Arg0 - GPIn : GPIO Pin number to write
+ // Arg1 - Value to be written
+ //
+ If(LLessEqual(Arg0, 94)){
+ Store( Add(Add(GPBS,0x100) , Multiply(Arg0,0x08)),Local0)
+ OperationRegion(LGPI, SystemIo, Local0, 4)
+ Field(LGPI, ByteAcc, NoLock, Preserve) {
+ Offset(0x0),
+ , 3,
+ TEMP, 1
+ }
+ Store(Arg1,TEMP)
+ }
+ }
+
+ Method(WPGP,2,Serialized) //GP Weak pull
+ {
+ // Function to write GPIO
+ // Arg0 - GPIn : GPIO Pin number to write
+ // Arg1 - 00 = none 01 = down 10 = up
+ //
+ If(LLessEqual(Arg0, 94)){
+ Store( Add(Add(GPBS,0x104) , Multiply(Arg0,0x08)),Local0)
+ OperationRegion(LGPI, SystemIo, Local0, 4)
+ Field(LGPI, AnyAcc, NoLock, Preserve) {
+ Offset(0x0),
+ TEMP, 2
+ }
+ Store(Arg1,TEMP)
+ }
+ }
+
+ Method(GP2N,2,Serialized) //GPIO to Native
+ {
+ // Function to write GPIO
+ // Arg0 - GPIn : GPIO Pin number to write
+ // Arg1 - 0 = Native 1 = GPIO
+ //
+ If(LLessEqual(Arg0, 94)){
+ Store( Add(Add(GPBS,0x100) , Multiply(Arg0,0x08)),Local0)
+ OperationRegion(LGPI, SystemIo, Local0, 4)
+ Field(LGPI, AnyAcc, NoLock, Preserve) {
+ Offset(0x0),
+ TEMP, 1
+ }
+ Store(Arg1,TEMP)
+ }
+ }
+
+ Method(GP2A,2,Serialized) //GP to APIC
+ {
+ // Function to write GPIO
+ // Arg0 - GPIn : GPIO Pin number to write
+ // Arg1 - 00 = mask 01 = route to IOxAPIC and also Pull UP/NONE the GPIO mode Sensing weak pull
+ //
+ If(LLessEqual(Arg0, 94)){
+ Store( Add(Add(GPBS,0x104) , Multiply(Arg0,0x08)),Local0)
+ OperationRegion(LGP2, SystemIo, Local0, 4)
+ Field(LGP2, AnyAcc, NoLock, Preserve) {
+ Offset(0x0),
+ GPWP, 2,
+ GPIS, 1
+ }
+ if(LEqual(Arg1,1))
+ {
+ Store(0,GPIS)
+ Store(0,GPWP)
+ }Else{
+ Store(2,GPWP)
+ Store(1,GPIS)
+ }
+
+ Store(Add(GPBS, 0x10), Local0)
+ OperationRegion(LGPI, SystemIo, Local0, 2)
+ Field(LGPI, AnyAcc, NoLock, Preserve) {
+ Offset(0x0),
+ TEMP, 16
+ }
+
+ // GPI PIRQ to IOxAPIC enable bit map
+ // GPI[55:45] to IOxAPIC enable bit[15:5], Subtract 40 from GPI to get ACPI bit
+ // GPI[14:13] to IOxAPIC enable bit[4:3], Subtract 10 from GPI to get ACPI bit
+ // GPI[10:8] to IOxAPIC enable bit[2:0], Subtract 8 from GPI to get ACPI bit
+ If(LGreaterEqual(Arg0, 45))
+ {
+ Subtract(Arg0, 40, Local1) // GPI[55:45] map to APIC[15:5]
+ }Else{
+ If(LLessEqual(Arg0, 10))
+ {
+ Subtract(Arg0, 8, Local1) // GPI[10:8] map to APIC[2:0]
+ }Else{
+ Subtract(Arg0, 10, Local1) // GPI[14:13] map to APIC[4:3]
+ }
+ }
+
+ Store(ShiftLeft(1, Local1), Local2)
+ If(Arg1){ //Enable GP to IOAPIC
+ Or(TEMP, Local2, TEMP)
+ } Else{ //mask
+ And(TEMP, Not(Local2), TEMP)
+ }
+ }
+ }
+
+ Method(GP2B,2,Serialized) //GP to APIC
+ {
+ // Function to write GPIO
+ // Arg0 - GPIn : GPIO Pin number to write
+ // Arg1 - 00 = mask 01 = route to IOxAPIC
+ //
+ If(LLessEqual(Arg0, 94)){
+ Store(Add(GPBS, 0x10), Local0)
+ OperationRegion(LGPI, SystemIo, Local0, 2)
+ Field(LGPI, AnyAcc, NoLock, Preserve) {
+ Offset(0x0),
+ TEMP, 16
+ }
+
+ // GPI PIRQ to IOxAPIC enable bit map
+ // GPI[55:45] to IOxAPIC enable bit[15:5], Subtract 40 from GPI to get ACPI bit
+ // GPI[14:13] to IOxAPIC enable bit[4:3], Subtract 10 from GPI to get ACPI bit
+ // GPI[10:8] to IOxAPIC enable bit[2:0], Subtract 8 from GPI to get ACPI bit
+ If(LGreaterEqual(Arg0, 45))
+ {
+ Subtract(Arg0, 40, Local1) // GPI[55:45] map to APIC[15:5]
+ }Else{
+ If(LLessEqual(Arg0, 10))
+ {
+ Subtract(Arg0, 8, Local1) // GPI[10:8] map to APIC[2:0]
+ }Else{
+ Subtract(Arg0, 10, Local1) // GPI[14:13] map to APIC[4:3]
+ }
+ }
+
+ Store(ShiftLeft(1, Local1), Local2)
+ If(Arg1){ //Enable GP to IOAPIC
+ Or(TEMP, Local2, TEMP)
+ } Else{ //mask
+ And(TEMP, Not(Local2), TEMP)
+ }
+ }
+ }
+
+ } // End of Scope SB
+
+scope (\_SB.PCI0) {
+ Name(LTRE, 0)
+ Name(OBFF, 0)
+
+ Name(LMSL, 0)
+ Name(LNSL, 0)
+ //
+ // LAN Controller - Device 25, Function 0
+ //
+ Device(GLAN) { // GbE Controller
+ Name(_ADR, 0x00190000)
+ Method(_PRW, 0) { Return(GPRW(0x0D, 4)) } // can wakeup from S4 state
+ } // end "GbE Controller"
+
+ //
+ // EHCI Controller #1 - Device 29, Function 0
+ //
+ Device(EHC1) {
+ Name(_ADR, 0x001D0000)
+ include("PchEhci1.asl")
+ Method(_PRW, 0) { Return(GPRW(0x0D, 4)) } // can wakeup from S4 state
+ } // end "EHCI Controller #1"
+
+ //
+ // EHCI Controller #2 - Device 26, Function 0
+ //
+ Device(EHC2) {
+ Name(_ADR, 0x001A0000)
+ include("PchEhci2.asl")
+ Method(_PRW, 0) { Return(GPRW(0x0D, 4)) } // can wakeup from S4 state
+ } // end "EHCI Controller #2"
+
+ //
+ // xHCI Controller - Device 20, Function 0
+ //
+ Device(XHC) {
+ Name(_ADR, 0x00140000)
+ include("PchXhci.asl")
+ Method(_PRW, 0) { Return(GPRW(0x0D, 4)) } // can wakeup from S4 state
+ } // end "xHCI Controller"
+
+ //
+ // High Definition Audio Controller - Device 27, Function 0
+ //
+ Device(HDEF) {
+ Name(_ADR, 0x001B0000)
+ include("PchAudio.asl")
+ Method(_PRW, 0) { Return(GPRW(0x0D, 4)) } // can wakeup from S4 state
+ } // end "High Definition Audio Controller"
+
+#ifdef SERIAL_IO_FLAG
+ //
+ // Serial IO Controllers definitions
+ //
+ include ("PchSerialIo.asl")
+ include ("ReferenceCode\\Chipset\\LynxPoint\\SampleCode\\AcpiTables\\Dsdt\\SerialIoDevices.asl")
+#endif // SERIAL_IO_FLAG
+
+#ifdef ADSP_FLAG
+ //
+ // Audio DSP Device definition - Device 19, Function 0
+ //
+ Device(ADSP) {
+ Name(_ADR, 0)
+ include("PchAudioDsp.asl")
+ }
+#endif // ADSP_FLAG
+
+#if 0
+ //
+ // PCIE Root Port #1
+ //
+ Device(RP01) {
+ Method (_ADR, 0) { Return (RPA0) }
+ //
+ // Pass LTRx to LTRE so PchPcie.asl can be reused for PCIes.
+ //
+ Method(_INI)
+ {
+ Store (LTR1, LTRE)
+ Store (PML1, LMSL)
+ Store (PNL1, LNSL)
+ Store (OBF1, OBFF)
+ }
+ include("PchPcie.asl")
+ Method(_PRW, 0) { Return(GPRW(0x09, 4)) } // can wakeup from S4 state
+ Method(_PRT,0) {
+ If(PICM) { Return(AR04) }// APIC mode
+ Return (PR04) // PIC Mode
+ } // end _PRT
+
+ } // end "PCIE Root Port #1"
+#endif
+
+#if 0
+ //
+ // PCIE Root Port #2
+ //
+ Device(RP02) {
+ Method (_ADR, 0) { Return (RPA1) }
+ //
+ // Pass LTRx to LTRE so PchPcie.asl can be reused for PCIes.
+ //
+ Method(_INI)
+ {
+ Store (LTR2, LTRE)
+ Store (PML2, LMSL)
+ Store (PNL2, LNSL)
+ Store (OBF2, OBFF)
+ }
+ include("PchPcie.asl")
+ Method(_PRW, 0) { Return(GPRW(0x09, 4)) } // can wakeup from S4 state
+ Method(_PRT,0) {
+ If(PICM) { Return(AR05) }// APIC mode
+ Return (PR05) // PIC Mode
+ } // end _PRT
+
+ } // end "PCIE Root Port #2"
+#endif
+
+#if 0
+ //
+ // PCIE Root Port #3
+ //
+ Device(RP03) {
+ Method (_ADR, 0) { Return (RPA2) }
+ //
+ // Pass LTRx to LTRE so PchPcie.asl can be reused for PCIes.
+ //
+ Method(_INI)
+ {
+ Store (LTR3, LTRE)
+ Store (PML3, LMSL)
+ Store (PNL3, LNSL)
+ Store (OBF3, OBFF)
+ }
+ include("PchPcie.asl")
+ Method(_PRW, 0) { Return(GPRW(0x09, 4)) } // can wakeup from S4 state
+ Method(_PRT,0) {
+ If(PICM) { Return(AR06) }// APIC mode
+ Return (PR06) // PIC Mode
+ } // end _PRT
+
+ } // end "PCIE Root Port #3"
+#endif
+
+#if 0
+ //
+ // PCIE Root Port #4
+ //
+ Device(RP04) {
+ Method (_ADR, 0) { Return (RPA3) }
+ //
+ // Pass LTRx to LTRE so PchPcie.asl can be reused for PCIes.
+ //
+ Method(_INI)
+ {
+ Store (LTR4, LTRE)
+ Store (PML4, LMSL)
+ Store (PNL4, LNSL)
+ Store (OBF4, OBFF)
+ }
+ include("PchPcie.asl")
+ Method(_PRW, 0) { Return(GPRW(0x09, 4)) } // can wakeup from S4 state
+ Method(_PRT,0) {
+ If(PICM) { Return(AR07) }// APIC mode
+ Return (PR07) // PIC Mode
+ } // end _PRT
+
+ } // end "PCIE Root Port #4"
+#endif
+
+#if 0
+ //
+ // PCIE Root Port #5
+ //
+ Device(RP05) {
+ Method (_ADR, 0) { Return (RPA4) }
+ //
+ // Pass LTRx to LTRE so PchPcie.asl can be reused for PCIes.
+ //
+ Method(_INI)
+ {
+ Store (LTR5, LTRE)
+ Store (PML5, LMSL)
+ Store (PNL5, LNSL)
+ Store (OBF5, OBFF)
+ }
+ include("PchPcie.asl")
+ Method(_PRW, 0) { Return(GPRW(0x09, 4)) } // can wakeup from S4 state
+ Method(_PRT,0) {
+ If(PICM) { Return(AR08) }// APIC mode
+ Return (PR08) // PIC Mode
+ } // end _PRT
+
+ } // end "PCIE Root Port #5"
+#endif
+
+#if 0
+ //
+ // PCIE Root Port #6
+ //
+ Device(RP06) {
+ Method (_ADR, 0) { Return (RPA5) }
+ //
+ // Pass LTRx to LTRE so PchPcie.asl can be reused for PCIes.
+ //
+ Method(_INI)
+ {
+ Store (LTR6, LTRE)
+ Store (PML6, LMSL)
+ Store (PNL6, LNSL)
+ Store (OBF6, OBFF)
+ }
+ include("PchPcie.asl")
+ Method(_PRW, 0) { Return(GPRW(0x09, 4)) } // can wakeup from S4 state
+ Method(_PRT,0) {
+ If (LEqual(And(CDID,0xF000), 0x8000)) { // LPT-H
+ If(PICM) { Return(AR09) }// APIC mode
+ Return (PR09) // PIC Mode
+ } Else { // ULT
+ If(PICM) { Return(AR08) }// APIC mode
+ Return (PR08) // PIC Mode
+ }
+ } // end _PRT
+
+ } // end "PCIE Root Port #6"
+#endif
+
+#if 0
+ //
+ // PCIE Root Port #7
+ //
+ Device(RP07) {
+ Method (_ADR, 0) { Return (RPA6) }
+ //
+ // Pass LTRx to LTRE so PchPcie.asl can be reused for PCIes.
+ //
+ Method(_INI)
+ {
+ Store (LTR7, LTRE)
+ Store (PML7, LMSL)
+ Store (PNL7, LNSL)
+ Store (OBF7, OBFF)
+ }
+ include("PchPcie.asl")
+ Method(_PRW, 0) { Return(GPRW(0x09, 4)) } // can wakeup from S4 state
+ Method(_PRT,0) {
+ If(PICM) { Return(AR0E) } // APIC mode
+ Return (PR0E) // PIC Mode
+ } // end _PRT
+
+ } // end "PCIE Root Port #7"
+#endif
+
+#if 0
+ //
+ // PCIE Root Port #8
+ //
+ Device(RP08) {
+ Method (_ADR, 0) { Return (RPA7) }
+ //
+ // Pass LTRx to LTRE so PchPcie.asl can be reused for PCIes.
+ //
+ Method(_INI)
+ {
+ Store (LTR8, LTRE)
+ Store (PML8, LMSL)
+ Store (PNL8, LNSL)
+ Store (OBF8, OBFF)
+ }
+ include("PchPcie.asl")
+ Method(_PRW, 0) { Return(GPRW(0x09, 4)) } // can wakeup from S4 state
+ Method(_PRT,0) {
+ If(PICM) { Return(AR0F) }// APIC mode
+ Return (PR0F) // PIC Mode
+ } // end _PRT
+
+ } // end "PCIE Root Port #8"
+#endif
+
+ //
+ // Serial ATA Host Controller - Device 31, Function 2
+ //
+
+ // PCH SATA Controller
+ Device (SAT0)
+ {
+ //Bus 0x00, Device 0x1F, Function 0x02
+ Name(_ADR, 0x001F0002)
+ Name(FDEV, Zero)
+ Name(FDRP, Zero)
+
+ Method(_DEP){
+ ADBG("SAT0 DEP Call")
+
+ If(LGreaterEqual(OSYS,2013)) { // PEP SATA Constraint for WinBlue and newer version of WinOS
+ If(LAnd (LEqual(S0ID, 1), LNotEqual(And(PEPC, 0x03), 0))){ // PEPC Bit[1:0] - SATA (0:None, 1:SATA Ports[all], 2:SATA Controller)
+ // SATA PEP not set to No Constraint
+ ADBG("SAT0 DEP")
+ Return(Package() {\_SB.PEPD})
+ }
+ }
+
+ ADBG("SAT0 DEP NULL")
+ Return(Package() {}) // No dependency for other OS (non-WinBlue)
+ }
+
+ Device(PRT0)
+ {
+ Name(_ADR,0x0000FFFF) // Port 0
+ Method(_SDD,1, Serialized)
+ {
+ CreateByteField(Arg0, 157, BFDS)
+ ToInteger(BFDS, FDEV)
+ CreateByteField(Arg0, 154, BFRP)
+ ToInteger(BFRP, FDRP)
+ }
+ //Get Task File
+ Method(_GTF,0,Serialized)
+ {
+ //Set Feature Command to enable DevSlp
+ If (LAnd(LAnd(LEqual(DVS0, 1), LEqual(And(FDEV, 0x01), 0x01)), LEqual(And(FDRP, 0x80), 0x80))) {
+ Name(PIB1, Buffer(7)
+ {0x10, 0x09, 0x00, 0x00, 0x00, 0xB0, 0xEF })
+ Return (PIB1)
+ }
+ Name(PIB2, Buffer(7)
+ {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 })
+ Return (PIB2)
+ }
+ }
+ Device(PRT1)
+ {
+ Name(_ADR,0x0001FFFF) // Port 1
+ Name(FDEV, Zero)
+ Name(FDRP, Zero)
+ Method(_SDD,1, Serialized)
+ {
+ CreateByteField(Arg0, 157, BFDS)
+ ToInteger(BFDS, FDEV)
+ CreateByteField(Arg0, 154, BFRP)
+ ToInteger(BFRP, FDRP)
+ }
+ // Get Task File
+ Method(_GTF,0,Serialized)
+ {
+ //Set Feature Command to enable DevSlp
+ If (LAnd(LAnd(LEqual(DVS1, 1), LEqual(And(FDEV, 0x01), 0x01)), LEqual(And(FDRP, 0x80), 0x80))) {
+ Name(PIB1, Buffer(7)
+ {0x10, 0x09, 0x00, 0x00, 0x00, 0xB0, 0xEF })
+ Return (PIB1)
+ }
+ Name(PIB2, Buffer(7)
+ {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 })
+ Return (PIB2)
+ }
+ }
+ Device(PRT2)
+ {
+ Name(_ADR,0x0002FFFF) // Port 1
+ Name(FDEV, Zero)
+ Name(FDRP, Zero)
+ Method(_SDD,1, Serialized)
+ {
+ CreateByteField(Arg0, 157, BFDS)
+ ToInteger(BFDS, FDEV)
+ CreateByteField(Arg0, 154, BFRP)
+ ToInteger(BFRP, FDRP)
+ }
+ // Get Task File
+ Method(_GTF,0,Serialized)
+ {
+ //Set Feature Command to enable DevSlp
+ If (LAnd(LAnd(LEqual(DVS2, 1), LEqual(And(FDEV, 0x01), 0x01)), LEqual(And(FDRP, 0x80), 0x80))) {
+ Name(PIB1, Buffer(7)
+ {0x10, 0x09, 0x00, 0x00, 0x00, 0xB0, 0xEF })
+ Return (PIB1)
+ }
+ Name(PIB2, Buffer(7)
+ {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 })
+ Return (PIB2)
+ }
+ }
+ Device(PRT3)
+ {
+ Name(_ADR,0x0003FFFF) // Port 3
+ Name(FDEV, Zero)
+ Name(FDRP, Zero)
+ Method(_SDD,1, Serialized)
+ {
+ CreateByteField(Arg0, 157, BFDS)
+ ToInteger(BFDS, FDEV)
+ CreateByteField(Arg0, 154, BFRP)
+ ToInteger(BFRP, FDRP)
+ }
+ // Get Task File
+ Method(_GTF,0,Serialized)
+ {
+ //Set Feature Command to enable DevSlp
+ If (LAnd(LAnd(LEqual(DVS3, 1), LEqual(And(FDEV, 0x01), 0x01)), LEqual(And(FDRP, 0x80), 0x80))) {
+ Name(PIB1, Buffer(7)
+ {0x10, 0x09, 0x00, 0x00, 0x00, 0xB0, 0xEF })
+ Return (PIB1)
+ }
+ Name(PIB2, Buffer(7)
+ {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 })
+ Return (PIB2)
+ }
+ }
+ }
+
+ Device(SAT1) {
+ Name(_ADR,0x001F0005)
+ //
+ // SATA Methods pulled in via SSDT.
+ //
+ }
+
+ //
+ // SMBus Controller - Device 31, Function 3
+ //
+ Device(SBUS) {
+ Name(_ADR,0x001F0003)
+ Include("PchSmb.asl")
+ }
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchAcpiTables.cif b/ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchAcpiTables.cif
new file mode 100644
index 0000000..e1bbbb9
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchAcpiTables.cif
@@ -0,0 +1,19 @@
+<component>
+ name = "PchAcpiTables"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\AcpiTables\Dsdt"
+ RefName = "PchAcpiTables"
+[files]
+"PchAcpiTables.sdl"
+"PchAcpiTables.inf"
+"Pch.asl"
+"PchAudio.asl"
+"PchPcie.asl"
+"PchSmb.asl"
+"PchEhci1.asl"
+"PchEhci2.asl"
+"UsbSbd.asl"
+"PchXhci.asl"
+"PchAudioDsp.asl"
+"PchSerialIo.asl"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchAcpiTables.inf b/ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchAcpiTables.inf
new file mode 100644
index 0000000..0cce4b9
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchAcpiTables.inf
@@ -0,0 +1,53 @@
+## @file
+# Component description file for the ACPI tables
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains an 'Intel Peripheral Driver' and uniquely
+# identified as "Intel Reference Module" and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+
+
+[defines]
+BASE_NAME = PchAcpiTables
+FILE_GUID = 31401EE7-1600-437c-A11C-B1035D8E6070
+COMPONENT_TYPE = PCH_ACPI_TABLES
+FFS_EXT = .ffs
+
+[sources.common]
+ Pch.asl
+ PchAudio.asl
+ PchAudioDsp.asl
+ PchSerialIo.asl
+ PchPcie.asl
+ PchSmb.asl
+ PchEhci1.asl
+ PchEhci2.asl
+ UsbSbd.asl
+ PchXhci.asl
+
+[libraries.common]
+
+[includes.common]
+ .
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+
+[nmake.common]
diff --git a/ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchAcpiTables.sdl b/ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchAcpiTables.sdl
new file mode 100644
index 0000000..56ded8a
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchAcpiTables.sdl
@@ -0,0 +1,735 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchAcpiTables/PchAcpiTables.sdl 5 11/07/13 3:10a Littleyan $
+#
+# $Revision: 5 $
+#
+# $Date: 11/07/13 3:10a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchAcpiTables/PchAcpiTables.sdl $
+#
+# 5 11/07/13 3:10a Littleyan
+# [TAG] EIP142529
+# [Category] SPEC Update
+# [Description] PCH RC update to 1.7.0
+# [Files] PchAcpiTables.sdl PchXhci.asl PchPciExpressHelpersLib.h
+# PchRegsThermal.h PchPciExpressHelpersLibrary.c
+# PchPm.c PchRootPorts.c PchInitPeim.c
+# PchSmmSx.c PchPcieSmm.c PchInfo.h
+# PchS3Peim.c SerialIoDevices.asl Sensor.asl
+#
+# 4 9/13/13 9:03a Barretlin
+# [TAG] EIP132976
+# [Category] Improvement
+# [Description] fix after plugging USB key on Rear USB3_1(TOP)
+# port(HS03) , there's no remove and save item in bot right corner
+# [Files] PchAcpiTables.sdl PchXhci.asl
+#
+# 3 5/24/13 2:48a Scottyang
+# [TAG] None
+# [Category] Improvement
+# [Description] Set token for OEM to change PchEhxi1.asl and
+# PchEhxi2.asl.
+# [Files] PchAcpiTables.sdl, PchEhci1.asl, PchEhci2.asl
+#
+# 2 5/06/13 8:14a Scottyang
+# [TAG] None
+# [Category] Improvement
+# [Description] Set token for OEM easy to modify.
+# [Files] PchAcpiTables.sdl
+# PchXhci.asl
+#
+# 1 2/08/12 8:39a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+TOKEN
+ Name = PchAcpiTables_SUPPORT
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable PchAcpiTables support in Project"
+End
+
+TOKEN
+ Name = "EHC1_PR01_UPC"
+ Value = "0xFF,0x00,0x00,0x00"
+ Help = "HS01's Usb Port Capabilities"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "EHC1_PR01_PLD"
+ Value = "0x81, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x30, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00"
+ Help = "HS01's Physical Location Description"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "EHC1_PR11_UPC"
+ Value = "0xFF,0xFF,0x00,0x00"
+ Help = "HS01's Usb Port Capabilities"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "EHC1_PR11_PLD"
+ Value = "0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE1, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00"
+ Help = "HS01's Physical Location Description"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "EHC1_PR12_UPC"
+ Value = "0xFF,0xFF,0x00,0x00"
+ Help = "HS01's Usb Port Capabilities"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "EHC1_PR12_PLD"
+ Value = "0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE1, 0x1D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00"
+ Help = "HS01's Physical Location Description"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "EHC1_PR13_UPC"
+ Value = "0xFF,0xFF,0x00,0x00"
+ Help = "HS01's Usb Port Capabilities"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "EHC1_PR13_PLD"
+ Value = "0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE1, 0x1D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00"
+ Help = "HS01's Physical Location Description"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "EHC1_PR14_UPC"
+ Value = "0xFF,0xFF,0x00,0x00"
+ Help = "HS01's Usb Port Capabilities"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "EHC1_PR14_PLD"
+ Value = "0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE1, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00"
+ Help = "HS01's Physical Location Description"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "EHC1_PR15_UPC"
+ Value = "0xFF,0xFF,0x00,0x00"
+ Help = "HS01's Usb Port Capabilities"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "EHC1_PR15_PLD"
+ Value = "0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB1, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00"
+ Help = "HS01's Physical Location Description"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "EHC1_PR16_UPC"
+ Value = "0xFF,0xFF,0x00,0x00"
+ Help = "HS01's Usb Port Capabilities"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "EHC1_PR16_PLD"
+ Value = "0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB1, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00"
+ Help = "HS01's Physical Location Description"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "EHC1_PR17_UPC"
+ Value = "0xFF,0xFF,0x00,0x00"
+ Help = "HS01's Usb Port Capabilities"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "EHC1_PR17_PLD"
+ Value = "0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB1, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00"
+ Help = "HS01's Physical Location Description"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "EHC1_PR18_UPC"
+ Value = "0xFF,0xFF,0x00,0x00"
+ Help = "HS01's Usb Port Capabilities"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "EHC1_PR18_PLD"
+ Value = "0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB1, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00"
+ Help = "HS01's Physical Location Description"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "EHC2_PR01_UPC"
+ Value = "0xFF,0x00,0x00,0x00"
+ Help = "HS01's Usb Port Capabilities"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "EHC2_PR01_PLD"
+ Value = "0x81, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x30, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00"
+ Help = "HS01's Physical Location Description"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "EHC2_PR11_UPC"
+ Value = "0xFF,0xFF,0x00,0x00"
+ Help = "HS01's Usb Port Capabilities"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "EHC2_PR11_PLD"
+ Value = "0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE1, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00"
+ Help = "HS01's Physical Location Description"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "EHC2_PR12_UPC"
+ Value = "0xFF,0xFF,0x00,0x00"
+ Help = "HS01's Usb Port Capabilities"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "EHC2_PR12_PLD"
+ Value = "0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE1, 0x1D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00"
+ Help = "HS01's Physical Location Description"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "EHC2_PR13_UPC"
+ Value = "0xFF,0xFF,0x00,0x00"
+ Help = "HS01's Usb Port Capabilities"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "EHC2_PR13_PLD"
+ Value = "0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE1, 0x1D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00"
+ Help = "HS01's Physical Location Description"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "EHC2_PR14_UPC"
+ Value = "0xFF,0xFF,0x00,0x00"
+ Help = "HS01's Usb Port Capabilities"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "EHC2_PR14_PLD"
+ Value = "0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE1, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00"
+ Help = "HS01's Physical Location Description"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "EHC2_PR15_UPC"
+ Value = "0xFF,0xFF,0x00,0x00"
+ Help = "HS01's Usb Port Capabilities"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "EHC2_PR15_PLD"
+ Value = "0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB1, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00"
+ Help = "HS01's Physical Location Description"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "EHC2_PR16_UPC"
+ Value = "0xFF,0xFF,0x00,0x00"
+ Help = "HS01's Usb Port Capabilities"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "EHC2_PR16_PLD"
+ Value = "0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB1, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00"
+ Help = "HS01's Physical Location Description"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "HS01_UPC"
+ Value = "0xFF,0x03,0x00,0x00"
+ Help = "HS01's Usb Port Capabilities"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "HS01_PLD"
+ Value = "0x01, 0xC6, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0x0C, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00"
+ Help = "HS01's Physical Location Description"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "HS02_UPC"
+ Value = "0xFF,0x03,0x00,0x00"
+ Help = "HS02's Usb Port Capabilities"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "HS02_PLD"
+ Value = "0x01, 0xC6, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0x0C, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00"
+ Help = "HS02's Physical Location Description"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "HS03_INTERNAL"
+ Value = "1"
+ TokenType = Boolean
+ TargetH = Yes
+ Help = "1: HS03 is internal port./0: HS03 is external port."
+End
+
+TOKEN
+ Name = "HS03_UPC"
+ Value = "0xFF,0x03,0x00,0x00"
+ Help = "HS03's Usb Port Capabilities"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "HS03_PLD"
+ Value = "0x01, 0xC6, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71, 0x0C, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00"
+ Help = "HS03's Physical Location Description"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "HS04_UPC"
+ Value = "0xFF,0x03,0x00,0x00"
+ Help = "HS04's Usb Port Capabilities"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "HS04_PLD"
+ Value = "0x01, 0xC6, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71, 0x0C, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00"
+ Help = "HS04's Physical Location Description"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "HS05_UPC"
+ Value = "0xFF,0x00,0x00,0x00"
+ Help = "HS05's Usb Port Capabilities"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "HS05_PLD"
+ Value = "0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0x0C, 0x80, 0x02, 0x00, 0x00, 0x00, 0x00"
+ Help = "HS05's Physical Location Description"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "HS06_UPC"
+ Value = "0xFF,0x00,0x00,0x00"
+ Help = "HS06's Usb Port Capabilities"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "HS06_PLD"
+ Value = "0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0x0C, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00"
+ Help = "HS06's Physical Location Description"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "HS07_UPC"
+ Value = "0xFF,0x00,0x00,0x00"
+ Help = "HS07's Usb Port Capabilities"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "HS07_PLD"
+ Value = "0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71, 0x0C, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00"
+ Help = "HS07's Physical Location Description"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "HS08_UPC"
+ Value = "0xFF,0x00,0x00,0x00"
+ Help = "HS08's Usb Port Capabilities"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "HS08_PLD"
+ Value = "0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71, 0x0C, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00"
+ Help = "HS08's Physical Location Description"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "HS09_UPC"
+ Value = "0xFF,0x03,0x00,0x00"
+ Help = "HS09's Usb Port Capabilities"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "HS09_PLD"
+ Value = "0x01, 0xC6, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71, 0x0C, 0x80, 0x04, 0x00, 0x00, 0x00, 0x00"
+ Help = "HS09's Physical Location Description"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "HS10_UPC"
+ Value = "0xFF,0x03,0x00,0x00"
+ Help = "HS10's Usb Port Capabilities"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "HS10_PLD"
+ Value = "0x01, 0xC6, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71, 0x0C, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00"
+ Help = "HS10's Physical Location Description"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "HS11_UPC"
+ Value = "0xFF,0xFF,0x00,0x00"
+ Help = "HS11's Usb Port Capabilities"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "HS11_PLD"
+ Value = "0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00"
+ Help = "HS11's Physical Location Description"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "HS12_UPC"
+ Value = "0xFF,0xFF,0x00,0x00"
+ Help = "HS12's Usb Port Capabilities"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "HS12_PLD"
+ Value = "0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00"
+ Help = "HS12's Physical Location Description"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "HS13_UPC"
+ Value = "0xFF,0xFF,0x00,0x00"
+ Help = "HS13's Usb Port Capabilities"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "HS13_PLD"
+ Value = "0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00"
+ Help = "HS13's Physical Location Description"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "HS14_UPC"
+ Value = "0xFF,0xFF,0x00,0x00"
+ Help = "HS14's Usb Port Capabilities"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "HS14_PLD"
+ Value = "0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00"
+ Help = "HS14's Physical Location Description"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "HS15_UPC"
+ Value = "0x00,0x00,0x00,0x00"
+ Help = "HS15's Usb Port Capabilities"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "HS15_PLD"
+ Value = "0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00"
+ Help = "HS15's Physical Location Description"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "SSP1_UPC"
+ Value = "0xFF,0x03,0x00,0x00"
+ Help = "SSP1's Usb Port Capabilities"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "SSP1_PLD"
+ Value = "0x01, 0xC6, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0x0C, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00"
+ Help = "SSP1's Physical Location Description"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "SSP1_PR3"
+ Value = "0x01"
+ TokenType = Integer
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "SSP2_UPC"
+ Value = "0xFF,0x03,0x00,0x00"
+ Help = "SSP2's Usb Port Capabilities"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "SSP2_PLD"
+ Value = "0x01, 0xC6, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0x0C, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00"
+ Help = "SSP2's Physical Location Description"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "SSP2_PR3"
+ Value = "0x02"
+ TokenType = Integer
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "SSP3_UPC"
+ Value = "0xFF,0x03,0x00,0x00"
+ Help = "SSP3's Usb Port Capabilities"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "SSP3_PLD"
+ Value = "0x01, 0xC6, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71, 0x0C, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00"
+ Help = "SSP3's Physical Location Description"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "SSP3_PR3"
+ Value = "0x04"
+ TokenType = Integer
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "SSP4_UPC"
+ Value = "0xFF,0x03,0x00,0x00"
+ Help = "SSP4's Usb Port Capabilities"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "SSP4_PLD"
+ Value = "0x01, 0xC6, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71, 0x0C, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00"
+ Help = "SSP4's Physical Location Description"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "SSP4_PR3"
+ Value = "0x08"
+ TokenType = Integer
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "SSP5_UPC"
+ Value = "0xFF,0x03,0x00,0x00"
+ Help = "SSP5's Usb Port Capabilities"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "SSP5_PLD"
+ Value = "0x01, 0xC6, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71, 0x0C, 0x80, 0x04, 0x00, 0x00, 0x00, 0x00"
+ Help = "SSP5's Physical Location Description"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "SSP5_PR3"
+ Value = "0x10"
+ TokenType = Integer
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "SSP6_UPC"
+ Value = "0xFF,0x03,0x00,0x00"
+ Help = "SSP6's Usb Port Capabilities"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "SSP6_PLD"
+ Value = "0x01, 0xC6, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71, 0x0C, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00"
+ Help = "SSP6's Physical Location Description"
+ TokenType = Expression
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "SSP6_PR3"
+ Value = "0x20"
+ TokenType = Integer
+ TargetH = Yes
+End
+
+PATH
+ Name = "PchAcpiTables_DIR"
+End
+
+ELINK
+ Name = "$(PchAcpiTables_DIR)\Pch.asl"
+ Parent = "INTEL_GENERIC_ASL"
+ Priority = 1
+ InvokeOrder = AfterParent
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchAudio.asl b/ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchAudio.asl
new file mode 100644
index 0000000..df64da3
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchAudio.asl
@@ -0,0 +1,44 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Haswell *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+ //
+ // High Definition Audio - Device 27, Function 0
+ //
+ OperationRegion(HDAR, PCI_Config, 0x4C,0x10)
+ Field(HDAR,WordAcc,NoLock,Preserve) {
+ Offset(0), // 0x4C, Dock Control Register
+ DCKA,1, // Dock Attach
+ ,7,
+ Offset(1), // 04Dh, Dock Status Register
+ DCKM,1, // Dock Mated
+ ,6,
+ DCKS,1, // Docking Supported
+ Offset(8), // 0x54, Power Management Control and Status Register
+ , 8,
+ PMEE,1,
+ , 6,
+ PMES,1 // PME Status
+ }
diff --git a/ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchAudioDsp.asl b/ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchAudioDsp.asl
new file mode 100644
index 0000000..159179b
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchAudioDsp.asl
@@ -0,0 +1,133 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Haswell *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 2012 - 2013 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+ Name (_HID, "INT33C8")
+ Name (_CID, "INT33C8")
+ Name (_DDN, "Intel(R) Smart Sound Technology Host Controller - INT33C8" )
+ Name (_UID, 1)
+
+ Method(_DEP){
+ ADBG("ADSP DEP Call")
+ If(LEqual(S0ID, 1)){
+ ADBG("ADSP DEP")
+ Return(Package() {\_SB.PEPD})
+ }Else{
+ ADBG("ADSP DEP NULL")
+ Return(Package() {})
+ }
+ }
+
+ // Default parameters values for Realtek codec
+ Name (MCLK, Zero)
+ Name (SCLK, 0x9)
+ Name (SSPM, Zero)
+
+ // Bluetooth support
+ Name (ABTH, Zero)
+
+ Name (RBUF, ResourceTemplate ()
+ {
+ Memory32Fixed (ReadWrite, 0x00000000, 0x00100000, BAR0) // MMIO 1 - Audio DSP MMIO
+ Memory32Fixed (ReadWrite, 0x00000000, 0x00001000, BAR1) // MMIO 2 - Shadowed PCI Config Space
+ Interrupt (ResourceConsumer, Level, ActiveLow, Exclusive, , , ) {3} // Audio DSP IRQ
+ })
+
+ Name (EOD, 1)
+ Method (_CRS, 0x0, NotSerialized)
+ {
+ Switch (ToInteger(CODS))
+ {
+ Case (0) {
+ // Realtek param values
+ Store (\_SB.PCI0.I2C0.ACD0.MCLK, \_SB.PCI0.ADSP.MCLK)
+ Store (\_SB.PCI0.I2C0.ACD0.SCLK, \_SB.PCI0.ADSP.SCLK)
+ Store (\_SB.PCI0.I2C0.ACD0.SSPM, \_SB.PCI0.ADSP.SSPM)
+ }
+ Case (1) {
+ // Cirrus param values
+ Store (\_SB.PCI0.I2C0.ACD1.MCLK, \_SB.PCI0.ADSP.MCLK)
+ Store (\_SB.PCI0.I2C0.ACD1.SCLK, \_SB.PCI0.ADSP.SCLK)
+ Store (\_SB.PCI0.I2C0.ACD1.SSPM, \_SB.PCI0.ADSP.SSPM)
+ }
+ Case (2) {
+ // IDT param values
+ Store (\_SB.PCI0.I2C0.ACD2.MCLK, \_SB.PCI0.ADSP.MCLK)
+ Store (\_SB.PCI0.I2C0.ACD2.SCLK, \_SB.PCI0.ADSP.SCLK)
+ Store (\_SB.PCI0.I2C0.ACD2.SSPM, \_SB.PCI0.ADSP.SSPM)
+ }
+ Default {
+ // Realtek params as default
+ Store (\_SB.PCI0.I2C0.ACD0.MCLK, \_SB.PCI0.ADSP.MCLK)
+ Store (\_SB.PCI0.I2C0.ACD0.SCLK, \_SB.PCI0.ADSP.SCLK)
+ Store (\_SB.PCI0.I2C0.ACD0.SSPM, \_SB.PCI0.ADSP.SSPM)
+ }
+ }
+ Return (RBUF)
+ }
+
+ Method (_SRS, 0x1, Serialized)
+ {
+ Store (1, EOD)
+ }
+
+ Method (_STA, 0x0, NotSerialized)
+ {
+ If(LGreaterEqual(OSYS,2012))
+ {
+ If(LEqual(S0ID, 1))
+ {
+ CreateDWordField (^RBUF,^BAR0._BAS,BVAL)
+ If (LEqual(BVAL, 0))
+ {
+ Return (0x0)
+ }
+ If (And (EOD, 0x1, EOD))
+ {
+ Return (0xf) // Enabled 1111
+ }
+ Else
+ {
+ Return (0xd) // Disabled 1101
+ }
+ }
+ }
+ Return (0x0)
+ }
+
+ Method (_DIS, 0x0, NotSerialized)
+ {
+ Store (0, EOD)
+ }
+
+ Device (I2S0)
+ { // I2S Port 0
+ Name (_ADR, 0)
+ }
+ Device (I2S1)
+ { // I2S Port 1
+ Name (_ADR, 1)
+ } \ No newline at end of file
diff --git a/ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchEhci1.asl b/ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchEhci1.asl
new file mode 100644
index 0000000..327b5c2
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchEhci1.asl
@@ -0,0 +1,238 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Haswell *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+ OperationRegion(PWKE,PCI_Config,0x54,0x12)
+
+ Field(PWKE,DWordAcc,NoLock,Preserve)
+ {
+ , 8,
+ PMEE, 1, // PWR_CNTL_STS.PME_En
+ , 6,
+ PMES, 1, // PWR_CNTL_STS.PME_Sts
+ Offset (0x0E),
+ , 1,
+ PWUC, 8 // Port Wake Up Capability Mask
+ }
+
+ Method(_PSW,1)
+ {
+ If(Arg0)
+ {
+ Store(Ones,PWUC)
+ }
+ Else
+ {
+ Store(0,PWUC)
+ }
+ }
+
+ // The CRB leaves the USB ports on in S3/S4 to allow
+ // the ability to Wake from USB. Therefore, define
+ // the below control methods to state D2 entry during
+ // the given S-State.
+
+ Method(_S3D,0)
+ {
+ Return(2)
+ }
+
+ Method(_S4D,0)
+ {
+ Return(2)
+ }
+
+ Device(HUBN)
+ {
+ Name(_ADR, Zero)
+
+ Device(PR01)
+ {
+ Name(_ADR, One)
+
+ //
+ // There will have "Generic USB Hub" existed at Port 1 of each EHCI controller
+ // in Windows "Device Manager" while RMH is enabled, so need to add _UPC
+ // and _PLD to report OS that it's not user visible to pass WHQL: Single Computer
+ // Display Object test in Win7
+ //
+ Method(_UPC,0,Serialized) {
+ Name(UPCA, Package() { ASL_EHC1_PR01_UPC })
+ Return(UPCA)
+ }
+
+ Method(_PLD,0,Serialized) {
+ Name(PLDP, Package() {
+ Buffer (0x10) {
+ ASL_EHC1_PR01_PLD}
+ })
+
+ Return (PLDP)
+ }
+
+ Device(PR11)
+ {
+ Name(_ADR, One)
+ Method(_UPC,0,Serialized) {
+ Name(UPCP, Package() { ASL_EHC1_PR11_UPC })
+ Return(UPCP)
+ }
+
+ Method(_PLD,0,Serialized) {
+ Name(PLDP, Package() {
+ Buffer (0x10) {
+ ASL_EHC1_PR11_PLD}
+ })
+ Return (PLDP)
+ }
+ }
+
+ Device(PR12)
+ {
+ Name(_ADR, 0x02)
+ Method(_UPC,0,Serialized) {
+ Name(UPCP, Package() { ASL_EHC1_PR12_UPC })
+ Return(UPCP)
+ }
+ Method(_PLD,0,Serialized) {
+ Name(PLDP, Package() {
+ Buffer (0x10) {
+ ASL_EHC1_PR12_PLD}
+ })
+ Return (PLDP)
+ }
+ }
+
+ Device(PR13)
+ {
+ Name(_ADR, 0x03)
+ Method(_UPC,0,Serialized) {
+ Name(UPCP, Package() { ASL_EHC1_PR13_UPC })
+ Return(UPCP)
+ }
+
+ Method(_PLD,0,Serialized) {
+ Name(PLDP, Package() {
+ Buffer (0x10) {
+ ASL_EHC1_PR13_PLD}
+ })
+ CreateBitField(DeRefOf(Index(PLDP,0)),64,VIS)
+ If(LEqual(And(CDID,0xF000), 0x9000)) { // on LPT-LP platforms this port is internal
+ And(VIS,0,VIS)
+ }
+ Return (PLDP)
+ }
+ }
+
+ Device(PR14)
+ {
+ Name(_ADR, 0x04)
+ Method(_UPC,0,Serialized) {
+ Name(UPCP, Package() { ASL_EHC1_PR14_UPC })
+ Return(UPCP)
+ }
+ Method(_PLD,0,Serialized) {
+ Name(PLDP, Package() {
+ Buffer (0x10) {
+ ASL_EHC1_PR14_PLD}
+ })
+ Return (PLDP)
+ }
+ Alias(SBV1,SDGV) // copy USB Sideband Deferring GPE Vector (HOST_ALERT#1) to DSM method
+ Include("UsbSBD.ASL")
+ }
+
+ Device(PR15)
+ {
+ Name(_ADR, 0x05)
+ Method(_UPC,0,Serialized) {
+ Name(UPCP, Package() { ASL_EHC1_PR15_UPC })
+ Return(UPCP)
+ }
+ Method(_PLD,0,Serialized) {
+ Name(PLDP, Package() {
+ Buffer (0x10) {
+ ASL_EHC1_PR15_PLD}
+ })
+ Return (PLDP)
+ }
+ Alias(SBV2,SDGV) // copy USB Sideband Deferring GPE Vector (HOST_ALERT#2) to DSM method
+ Include("UsbSBD.ASL")
+ }
+
+ Device(PR16)
+ {
+ Name(_ADR, 0x06)
+ Method(_UPC,0,Serialized) {
+ Name(UPCP, Package() { ASL_EHC1_PR16_UPC })
+ Return(UPCP)
+ }
+ Method(_PLD,0,Serialized) {
+ Name(PLDP, Package() {
+ Buffer (0x10) {
+ ASL_EHC1_PR16_PLD}
+ })
+ Return (PLDP)
+ }
+ Alias(SBV1,SDGV) // copy USB Sideband Deferring GPE Vector (HOST_ALERT#1) to DSM method
+ Include("UsbSBD.ASL")
+ }
+
+ Device(PR17)
+ {
+ Name(_ADR, 0x07)
+ Method(_UPC,0,Serialized) {
+ Name(UPCP, Package() { ASL_EHC1_PR17_UPC })
+ Return(UPCP)
+ }
+ Method(_PLD,0,Serialized) {
+ Name(PLDP, Package() {
+ Buffer (0x10) {
+ ASL_EHC1_PR17_PLD}
+ })
+ Return (PLDP)
+ }
+ Alias(SBV2,SDGV) // copy USB Sideband Deferring GPE Vector (HOST_ALERT#2) to DSM method
+ Include("UsbSBD.ASL")
+ }
+
+ Device(PR18)
+ {
+ Name(_ADR, 0x08)
+ Method(_UPC,0,Serialized) {
+ Name(UPCP, Package() { ASL_EHC1_PR18_UPC })
+ Return(UPCP)
+ }
+ Method(_PLD,0,Serialized) {
+ Name(PLDP, Package() {
+ Buffer (0x10) {
+ ASL_EHC1_PR18_PLD}
+ })
+ Return (PLDP)
+ }
+ }
+ } // End of PR01
+ } // End of HUBN
diff --git a/ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchEhci2.asl b/ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchEhci2.asl
new file mode 100644
index 0000000..0449f59
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchEhci2.asl
@@ -0,0 +1,199 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Haswell *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+ OperationRegion(PWKE,PCI_Config,0x54,0x12)
+
+ Field(PWKE,DWordAcc,NoLock,Preserve)
+ {
+ , 8,
+ PMEE, 1, // PWR_CNTL_STS.PME_En
+ , 6,
+ PMES, 1, // PWR_CNTL_STS.PME_Sts
+ Offset (0x0E),
+ , 1,
+ PWUC, 6 // Port Wake Up Capability Mask
+ }
+
+ Method(_PSW,1)
+ {
+ If(Arg0)
+ {
+ Store(Ones,PWUC)
+ }
+ Else
+ {
+ Store(0,PWUC)
+ }
+ }
+
+ // The CRB leaves the USB ports on in S3/S4 to allow
+ // the ability to Wake from USB. Therefore, define
+ // the below control methods to state D2 entry during
+ // the given S-State.
+
+ Method(_S3D,0)
+ {
+ Return(2)
+ }
+
+ Method(_S4D,0)
+ {
+ Return(2)
+ }
+
+ Device(HUBN)
+ {
+ Name(_ADR, Zero)
+
+ Device(PR01)
+ {
+ Name(_ADR, One)
+
+ //
+ // There will have "Generic USB Hub" existed at Port 1 of each EHCI controller
+ // in Windows "Device Manager" while RMH is enabled, so need to add _UPC
+ // and _PLD to report OS that it's not user visible to pass WHQL: Single Computer
+ // Display Object test in Win7
+ //
+ Method(_UPC,0,Serialized) {
+ Name(UPCA, Package() { ASL_EHC2_PR01_UPC })
+ Return(UPCA)
+ }
+ Method(_PLD,0,Serialized) {
+ Name(PLDP, Package() {
+ Buffer (0x10) {
+ ASL_EHC2_PR01_PLD}
+ })
+ Return (PLDP)
+ }
+
+ Device(PR11)
+ {
+ Name(_ADR, One)
+ Method(_UPC,0,Serialized) {
+ Name(UPCP, Package() { ASL_EHC2_PR11_UPC })
+ Return(UPCP)
+ }
+ Method(_PLD,0,Serialized) {
+ Name(PLDP, Package() {
+ Buffer (0x10) {
+ ASL_EHC2_PR11_PLD}
+ })
+ Return (PLDP)
+ }
+ }
+
+ Device(PR12)
+ {
+ Name(_ADR, 0x02)
+ Method(_UPC,0,Serialized) {
+ Name(UPCP, Package() { ASL_EHC2_PR12_UPC })
+ Return(UPCP)
+ }
+ Method(_PLD,0,Serialized) {
+ Name(PLDP, Package() {
+ Buffer (0x10) {
+ ASL_EHC2_PR12_PLD}
+ })
+ Return (PLDP)
+ }
+ Alias(SBV1,SDGV) // copy USB Sideband Deferring GPE Vector (HOST_ALERT#1) to DSM method
+ Include("UsbSBD.ASL")
+ }
+
+ Device(PR13)
+ {
+ Name(_ADR, 0x03)
+ Method(_UPC,0,Serialized) {
+ Name(UPCP, Package() { ASL_EHC2_PR13_UPC })
+ Return(UPCP)
+ }
+ Method(_PLD,0,Serialized) {
+ Name(PLDP, Package() {
+ Buffer (0x10) {
+ ASL_EHC2_PR13_PLD}
+ })
+ CreateBitField(DeRefOf(Index(PLDP,0)),64,VIS)
+ If(LEqual(And(CDID,0xF000), 0x9000)) { // on LPT-LP platforms this port is internal
+ And(VIS,0,VIS)
+ }
+ Return (PLDP)
+ }
+ Alias(SBV2,SDGV) // copy USB Sideband Deferring GPE Vector (HOST_ALERT#2) to DSM method
+ Include("UsbSBD.ASL")
+ }
+
+ Device(PR14)
+ {
+ Name(_ADR, 0x04)
+ Method(_UPC,0,Serialized) {
+ Name(UPCP, Package() { ASL_EHC2_PR14_UPC })
+ Return(UPCP)
+ }
+ Method(_PLD,0,Serialized) {
+ Name(PLDP, Package() {
+ Buffer (0x10) {
+ ASL_EHC2_PR14_PLD}
+ })
+ Return (PLDP)
+ }
+ }
+
+ Device(PR15)
+ {
+ Name(_ADR, 0x05)
+ Method(_UPC,0,Serialized) {
+ Name(UPCP, Package() { ASL_EHC2_PR15_UPC })
+ Return(UPCP)
+ }
+ Method(_PLD,0,Serialized) {
+ Name(PLDP, Package() {
+ Buffer (0x10) {
+ ASL_EHC2_PR15_PLD}
+ })
+ Return (PLDP)
+ }
+ }
+
+ Device(PR16)
+ {
+ Name(_ADR, 0x06)
+ Method(_UPC,0,Serialized) {
+ Name(UPCP, Package() { ASL_EHC2_PR16_UPC })
+ Return(UPCP)
+ }
+ Method(_PLD,0,Serialized) {
+ Name(PLDP, Package() {
+ Buffer (0x10) {
+ ASL_EHC2_PR16_PLD}
+ })
+ Return (PLDP)
+ }
+ }
+
+ } // End of PR01
+ } // End of HUBN
diff --git a/ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchPcie.asl b/ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchPcie.asl
new file mode 100644
index 0000000..5a64ec9
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchPcie.asl
@@ -0,0 +1,288 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Haswell *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+
+ OperationRegion(PXCS,PCI_Config,0x00,0x380)
+ Field(PXCS,AnyAcc, NoLock, Preserve)
+ {
+ Offset(0),
+ VDID, 32,
+ Offset(0x19), // BNUM - Bus Number Register
+ SCBN, 8, // Secondary Bus Number
+ Offset(0x50), // LCTL - Link Control Register
+ L0SE, 1, // 0, L0s Entry Enabled
+ , 3,
+ LDIS, 1,
+ , 3,
+ Offset(0x52), // LSTS - Link Status Register
+ , 13,
+ LASX, 1, // 0, Link Active Status
+// AMI_OVERRIDE, [EIP84720]>
+ Offset(0x54), // SLCAP - Slot Capabilities Register
+ , 6,
+ HPCE, 1, // 6, Hot Plug Capable
+// AMI_OVERRIDE, [EIP84720]<
+ Offset(0x5A), // SLSTS[7:0] - Slot Status Register
+ ABPX, 1, // 0, Attention Button Pressed
+ , 2,
+ PDCX, 1, // 3, Presence Detect Changed
+ , 2,
+ PDSX, 1, // 6, Presence Detect State
+ , 1,
+ Offset(0x60), // RSTS - Root Status Register
+ , 16,
+ PSPX, 1, // 16, PME Status
+// AMI_OVERRIDE, [EIP121262]>
+ PMEP, 1, // 17, PME Pending
+// AMI_OVERRIDE, [EIP121262]<
+ Offset(0xA4),
+ D3HT, 2, // Power State
+ Offset(0xD8), // MPC - Miscellaneous Port Configuration Register
+ , 30,
+ HPEX, 1, // 30, Hot Plug SCI Enable
+ PMEX, 1, // 31, Power Management SCI Enable
+ Offset(0xE2), // RPPGEN - Root Port Power Gating Enable
+ , 2,
+ L23E, 1, // 2, L23_Rdy Entry Request (L23ER)
+ L23R, 1, // 3, L23_Rdy to Detect Transition (L23R2DT)
+ Offset(0x324),
+ , 3,
+ LEDM, 1 // PCIEDBG.DMIL1EDM
+ }
+ Field(PXCS,AnyAcc, NoLock, WriteAsZeros)
+ {
+ Offset(0xDC), // SMSCS - SMI/SCI Status Register
+ , 30,
+ HPSX, 1, // 30, Hot Plug SCI Status
+ PMSX, 1 // 31, Power Management SCI Status
+ }
+
+ Method(_STA, 0x0, NotSerialized)
+ {
+ If(LEqual(VDID, 0xFFFFFFFF)){
+ Return(0x00)
+ } Else {
+ Return(0x0F)
+ }
+ }
+
+ Name(LTRV, Package(){0,0,0,0})
+ Name(OPTS, 0) // PCH SETUP options for LTR and OBFF
+// AMI_OVERRIDE, [EIP121262]>
+ Name(RPAV, 0)
+// AMI_OVERRIDE, [EIP121262]<
+ //
+ // _DSM Device Specific Method
+ //
+ // Arg0: UUID Unique function identifier
+ // Arg1: Integer Revision Level
+ // Arg2: Integer Function Index (0 = Return Supported Functions)
+ // Arg3: Package Parameters
+ Method(_DSM, 4, Serialized) {
+ //
+ // Switch based on which unique function identifier was passed in
+ //
+ Switch(ToInteger(Arg0)) {
+ //
+ // _DSM Definitions for Latency Tolerance Reporting
+ //
+ // Arguments:
+ // Arg0: UUID: E5C937D0-3553-4d7a-9117-EA4D19C3434D
+ // Arg1: Revision ID: 2
+ // Arg2: Function Index: 1, 4 or 6
+ // Arg3: Empty Package
+ //
+ // Return:
+ // A Package of four integers corresponding with the LTR encoding defined
+ // in the PCI Express Base Specification, as follows:
+ // Integer 0: Maximum Snoop Latency Scale
+ // Integer 1: Maximum Snoop Latency Value
+ // Integer 2: Maximum No-Snoop Latency Scale
+ // Integer 3: Maximum No-Snoop Latency Value
+ // These values correspond directly to the LTR Extended Capability Structure
+ // fields described in the PCI Express Base Specification.
+ //
+ Case(ToUUID("E5C937D0-3553-4d7a-9117-EA4D19C3434D")) {
+ //
+ // Switch by function index
+ //
+ Switch(ToInteger(Arg2)) {
+ //
+ // Function Index:0
+ // Standard query - A bitmask of functions supported
+ //
+ Case (0)
+ {
+ if (LEqual(Arg1, 2)){ // test Arg1 for Revision ID: 2
+ Store(1, OPTS) // function 0
+ if (LTRE){
+ Or(OPTS,0x40,OPTS) // function 6
+ }
+ if (OBFF){
+ Or(OPTS,0x10,OPTS) // function 4
+ }
+ Return (OPTS) // bitmask of supported functions: 6, 4, 0.
+ } else {
+ Return (0)
+ }
+ }
+ //
+ // Function Index: 4
+ //
+ Case(4) {
+ if (LEqual(Arg1, 2)){ // test Arg1 for Revision ID: 2
+ if (OBFF){
+ Return (Buffer () {0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0}) // OBFF capable, offset 4[08h]
+ } else {
+ Return (Buffer () {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0})
+ }
+ }
+ }
+ //
+ // Function Index: 6
+ // LTR Extended Capability Structure
+ //
+ Case(6) {
+ if (LEqual(Arg1, 2)){ // test Arg1 for Revision ID: 2
+ if (LTRE){
+ if (LOr(LEqual(LMSL, 0xFFFFFFFF),LEqual(LNSL, 0xFFFFFFFF)))
+ {
+ if (LEqual (PCHS, 1)) {
+ //PCH-H
+ Store (0x0846, LMSL)
+ Store (0x0846, LNSL)
+ } elseif (LEqual (PCHS, 2)) {
+ //PCH-LP
+ Store (0x1003, LMSL)
+ Store (0x1003, LNSL)
+ }
+ }
+ Store(And(ShiftRight(LMSL,10),7), Index(LTRV, 0))
+ Store(And(LMSL,0x3FF), Index(LTRV, 1))
+ Store(And(ShiftRight(LNSL,10),7), Index(LTRV, 2))
+ Store(And(LNSL,0x3FF), Index(LTRV, 3))
+
+ Return (LTRV)
+ } else {
+ Return (0)
+ }
+ }
+ }
+ } // End of switch(Arg2)
+ } // End of case(ToUUID("E5C937D0-3553-4d7a-9117-EA4D19C3434D"))
+ } // End of switch(Arg0)
+ return (Buffer() {0x00})
+ } // End of _DSM
+
+ Device(PXSX)
+ {
+ Name(_ADR, 0x00000000)
+
+ // NOTE: Any PCIE Hot-Plug dependency for this port is
+ // specific to the CRB. Please modify the code based on
+ // your platform requirements.
+
+ Method(_PRW, 0) { Return(GPRW(0x09, 4)) } // can wakeup from S4 state
+// AMI_OVERRIDE, [EIP84720]>
+ Method(_RMV, 0, NotSerialized){
+#if defined ASL_Thunderbolt_SUPPORT && ASL_Thunderbolt_SUPPORT == 1 && ASL_TBT_RC_VERSION > 17
+ If(LEqual(\TBUS, SCBN))
+ {
+#if defined ASL_DEFAULT_TBT_RMV_RETURN_VALUE && ASL_DEFAULT_TBT_RMV_RETURN_VALUE == 1
+ Return(TBMV)
+#else
+ Return(0)
+#endif
+ }
+ Else
+ {
+ Return(HPCE) //0:device cannot be removed 1:device can be removed
+ }
+#else
+ Return(HPCE) //0:device cannot be removed 1:device can be removed
+#endif
+ }
+// AMI_OVERRIDE, [EIP84720]<
+
+ }
+
+// AMI_OVERRIDE, [EIP121262]>
+ Method(_REG,2)
+ {
+ If(LAnd(LEqual(Arg0,2),LEqual(Arg1,1)))
+ {
+ Store(One, RPAV)
+ }
+ }
+// AMI_OVERRIDE, [EIP121262]<
+
+ //
+ // PCI_EXP_STS Handler for PCIE Root Port
+ //
+ Method(HPME,0,Serialized)
+ {
+// AMI_OVERRIDE, [EIP105657]>
+ If(LOr(PSPX, PMEP)){
+ Store(PMEX, Local1)
+ Store(0, PMEX)
+ Sleep(50)
+ Store(1, PSPX)
+ Sleep(50)
+ If(PSPX){
+ Store(1, PSPX)
+ Sleep(50)
+ }
+ Store(Local1, PMEX)
+ }
+// AMI_OVERRIDE, [EIP105657]<
+
+ If(PMSX) {
+ //
+ // Clear the PME SCI status bit with timout
+ //
+ Store(200,Local0)
+ While(Local0) {
+ //
+ // Clear PME SCI Status
+ //
+ Store(1, PMSX)
+ //
+ // If PME SCI Status is still set, keep clearing it.
+ // Otherwise, break the while loop.
+ //
+ If(PMSX) {
+ Decrement(Local0)
+ } else {
+ Store(0,Local0)
+ }
+ }
+ //
+ // Notify PCIE Endpoint Devices
+ //
+ Notify(PXSX, 0x02)
+ }
+ }
diff --git a/ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchSerialIo.asl b/ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchSerialIo.asl
new file mode 100644
index 0000000..1142148
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchSerialIo.asl
@@ -0,0 +1,1029 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the SandyBridge *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+ //
+ // System Bus
+ //
+ Scope (\_SB.PCI0)
+ {
+
+ External(BID)
+ External(\_SB.PCI0.I2C0.PS0X, MethodObj)
+ External(\_SB.PCI0.I2C0.PS3X, MethodObj)
+ External(\_SB.PCI0.I2C1.PS0X, MethodObj)
+ External(\_SB.PCI0.SDHC.PS0X, MethodObj)
+
+ Device(SIRC)
+ {
+ //
+ // Serial IO devices occupy 2 address ranges each: BAR0 and BAR1.
+ // Each device claims its BAR0 addresses in its own _CRS method
+ // BAR1 addresses are not defined inside devices; instead, they are gathered in SIRC device
+ // SIRC also contains about half of BAR0 for SDIO - upper half except 0xC bytes which are clamed by WiFi device
+ //
+ Name(_HID,EISAID("PNP0C02"))
+
+ Name(_UID,4)
+
+ Method(_STA)
+ {
+ If(LLess(OSYS,2012)) { Return(0x0) } // check for Win7 or older
+ If(LEqual(And(CDID,0xF000), 0x8000)) { Return(0x0) } // check for LPT-H chipset
+ Return (0xF)
+ }
+
+ //
+ // Base address of the below memory ranges will be updated with actual addresses during BIOS execution.
+ //
+ Name(BUF1,ResourceTemplate() { Memory32Fixed (ReadWrite, 0x00000000, 0x00001000, BU01) }) // Serial IO SDMA BAR1
+ Name(BUF2,ResourceTemplate() { Memory32Fixed (ReadWrite, 0x00000000, 0x00001000, BU02) }) // Serial IO I2C0 BAR1
+ Name(BUF3,ResourceTemplate() { Memory32Fixed (ReadWrite, 0x00000000, 0x00001000, BU03) }) // Serial IO I2C1 BAR1
+ Name(BUF4,ResourceTemplate() { Memory32Fixed (ReadWrite, 0x00000000, 0x00001000, BU04) }) // Serial IO SPI0 BAR1
+ Name(BUF5,ResourceTemplate() { Memory32Fixed (ReadWrite, 0x00000000, 0x00001000, BU05) }) // Serial IO SPI1 BAR1
+ Name(BUF6,ResourceTemplate() { Memory32Fixed (ReadWrite, 0x00000000, 0x00001000, BU06) }) // Serial IO UA00 BAR1
+ Name(BUF7,ResourceTemplate() { Memory32Fixed (ReadWrite, 0x00000000, 0x00001000, BU07) }) // Serial IO UA01 BAR1
+ Name(BUF8,ResourceTemplate() { Memory32Fixed (ReadWrite, 0x00000000, 0x00001000, BU08) }) // Serial IO SDIO BAR1
+ Name(BUFL,ResourceTemplate() { Memory32Fixed (ReadWrite, 0x00000000, 0x00000008, SDLO) }) // Serial IO SDIO BAR0 lower part
+ Name(BUFH,ResourceTemplate() { Memory32Fixed (ReadWrite, 0x00000000, 0x00000FEC, SDHI) }) // Serial IO SDIO BAR0 upper part
+
+ Method (_CRS, 0x0, NotSerialized)
+ {
+ Store(ResourceTemplate() { }, Local0) // placeholder for concatenated buffers
+ CreateDWordField(BUF1, ^BU01._BAS, BR01)
+ CreateDWordField(BUF2, ^BU02._BAS, BR02)
+ CreateDWordField(BUF3, ^BU03._BAS, BR03)
+ CreateDWordField(BUF4, ^BU04._BAS, BR04)
+ CreateDWordField(BUF5, ^BU05._BAS, BR05)
+ CreateDWordField(BUF6, ^BU06._BAS, BR06)
+ CreateDWordField(BUF7, ^BU07._BAS, BR07)
+ CreateDWordField(BUF8, ^BU08._BAS, BR08)
+ //
+ // concatenate all buffers with non-zero address into Local0
+ //
+ If(LNotEqual(BR01, 0)) { ConcatenateResTemplate(Local0, BUF1, Local0) }
+ If(LNotEqual(BR02, 0)) { ConcatenateResTemplate(Local0, BUF2, Local0) }
+ If(LNotEqual(BR03, 0)) { ConcatenateResTemplate(Local0, BUF3, Local0) }
+ If(LNotEqual(BR04, 0)) { ConcatenateResTemplate(Local0, BUF4, Local0) }
+ If(LNotEqual(BR05, 0)) { ConcatenateResTemplate(Local0, BUF5, Local0) }
+ If(LNotEqual(BR06, 0)) { ConcatenateResTemplate(Local0, BUF6, Local0) }
+ If(LNotEqual(BR07, 0)) { ConcatenateResTemplate(Local0, BUF7, Local0) }
+
+ If(LNotEqual(BR08, 0)) {
+ ConcatenateResTemplate(Local0, ^BUF8, Local0)
+ //
+ // Calculate regions occupied by SDIO's BAR0
+ //
+ OperationRegion(SDCH, SystemMemory, BR08, 0x40) // SDHC PCI Config Header
+ Field(SDCH, DWordAcc, NoLock, Preserve) {
+ Offset(0x10),
+ BAR0, 32
+ }
+
+ CreateDWordField(^BUFL, ^SDLO._BAS, LBAS)
+ CreateDWordField(^BUFH, ^SDHI._BAS, HBAS)
+ Add(BAR0, 0x1000, LBAS)
+ Add(BAR0, 0x1014, HBAS)
+
+ ConcatenateResTemplate(Local0, BUFL, Local0)
+ ConcatenateResTemplate(Local0, BUFH, Local0)
+ }
+
+ Return (Local0)
+ } //end _CRS
+
+ Method(CNTR,1,Serialized)
+ {
+ Switch (ToInteger(Arg0))
+ {
+ Case (1) { CreateDWordField(^BUF1,^BU01._BAS, BAR1); Return(BAR1) }
+ Case (2) { CreateDWordField(^BUF2,^BU02._BAS, BAR2); Return(BAR2) }
+ Case (3) { CreateDWordField(^BUF3,^BU03._BAS, BAR3); Return(BAR3) }
+ Case (4) { CreateDWordField(^BUF4,^BU04._BAS, BAR4); Return(BAR4) }
+ Case (5) { CreateDWordField(^BUF5,^BU05._BAS, BAR5); Return(BAR5) }
+ Case (6) { CreateDWordField(^BUF6,^BU06._BAS, BAR6); Return(BAR6) }
+ Case (7) { CreateDWordField(^BUF7,^BU07._BAS, BAR7); Return(BAR7) }
+ Case (8) { CreateDWordField(^BUF8,^BU08._BAS, BAR8); Return(BAR8) }
+ Default { Return (0xFFFFFFFF) }
+ }
+ } //end CNTR
+
+ } // end of SIRC
+
+ //----------------------------
+ // Serial IO GPIO Controller
+ //----------------------------
+ Device (GPI0)
+ {
+ Name (_HID, "INT33C7")
+ Name (_CID, "INT33C7")
+ Name (_UID, 1)
+
+ Name (RBUF, ResourceTemplate ()
+ {
+ //
+ // BIOS specific change.
+ // Provide Min & Max IO range addresses
+ // BIOS to update AddressMinimum & AddressMaximum fields
+ // dynamically after PCI enumeration.
+ //
+ DWordIo (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
+ 0x0000, 0x0000, 0x03FF, 0x0000, 0x0400,,, BAR0)
+ })
+
+
+ Method (_CRS, 0x0, NotSerialized)
+ {
+
+ Return (RBUF)
+ }
+
+ Method (_HRV)
+ {
+ //
+ // Report LPC Revision Id
+ //
+ Return (CRID)
+ }
+
+ CreateDWordField(RBUF,BAR0._MIN,BVAL)
+
+ Method (_STA, 0x0, NotSerialized)
+ {
+ If(LEqual(BVAL, 0)) { Return(0x0) } // has BAR for this device been programmed by the OS?
+ If(LLess(OSYS,2012)) { Return(0x0) } // Win 8 or above?
+ If(LEqual(S0ID, 1)) { Return(0xF) } // CS enabled in SETUP?
+ Return(0x0)
+ }
+ } // Device (GPI0)
+
+ //---------------------------
+ // Serial IO DMA Controller
+ //---------------------------
+ Device (SDMA)
+ {
+ Name (_HID, "INTL9C60")
+ Name (_UID, 1)
+ Name (_ADR, 0x00150000)
+
+ Name (RBUF, ResourceTemplate ()
+ {
+ //
+ // Resource settings will be overwritten after PCI enumeration
+ //
+ Memory32Fixed (ReadWrite, 0x00000000, 0x00001000, BAR0)
+ Interrupt(ResourceConsumer, Level, ActiveLow, Exclusive, , , ) {20}
+ })
+
+ Method (_CRS, 0x0, NotSerialized)
+ {
+ Return (RBUF)
+ }
+
+ Method (_HRV)
+ {
+ //
+ // Report LPC Revision Id
+ //
+ Return (CRID)
+ }
+
+ Method (PTD3, 0x0, NotSerialized) {
+ //
+ // put DMA hardware in D3
+ //
+ If(LNotEqual(\_SB.PCI0.SIRC.CNTR(1), 0)) {
+ Add(\_SB.PCI0.SIRC.CNTR(1),0x84 ,Local0)
+ OperationRegion(DMB1, SystemMemory, Local0, 4)
+ Field(DMB1, DWordAcc, NoLock, Preserve) { TEMP, 32 }
+ Or(TEMP, 0x3, TEMP)
+ }
+ }
+
+ CreateDWordField(RBUF,BAR0._BAS,BVAL)
+
+ Method (_STA, 0x0, NotSerialized)
+ {
+ If(LEqual(BVAL, 0)) { Return(0x0) } // has BAR for this device been programmed by the OS?
+ If(LLess(OSYS,2012)) { Return(0x0) } // OS older than Win 8? hide the device
+ If(LAnd(LEqual(DOSD, 2), LEqual(OSYS,2012))) { PTD3(); Return(0x0) } // "auto" mode & Win8? hide the device
+ If(LEqual(S0ID, 1)) { Return(0xF) } // CS enabled in SETUP?
+ Return(0x0)
+ }
+
+ } // Device (SDMA)
+
+
+ //----------------------------
+ // Serial IO I2C0 Controller
+ //----------------------------
+ Device (I2C0)
+ {
+ Name (_HID, "INT33C2")
+ Name (_CID, "INT33C2")
+ Name (_UID, 1)
+ Name (_ADR, 0x00150001)
+
+ Method(_DEP){
+ ADBG("I2C0 DEP Call")
+ If(LEqual(S0ID, 1)){
+ ADBG("I2C0 DEP")
+ Return(Package() {\_SB.PEPD})
+ }Else{
+ ADBG("I2C0 DEP NULL")
+ Return(Package() {})
+ }
+ }
+
+ Method (SSCN, 0x0, NotSerialized)
+ {
+ Name (PKG, Package(3) { 432, 507, 9 })
+ Store(SSH0, Index(PKG,0))
+ Store(SSL0, Index(PKG,1))
+ Store(SSD0, Index(PKG,2))
+ Return (PKG)
+ }
+ Method (FMCN, 0x0, NotSerialized)
+ {
+ Name (PKG, Package(3) { 72, 160, 9 })
+ Store(FMH0, Index(PKG,0))
+ Store(FML0, Index(PKG,1))
+ Store(FMD0, Index(PKG,2))
+ Return (PKG)
+ }
+ Method (FPCN, 0x0, NotSerialized)
+ {
+ Name (PKG, Package(3) { 26, 50, 5 })
+ Store(FPH0, Index(PKG,0))
+ Store(FPL0, Index(PKG,1))
+ Store(FPD0, Index(PKG,2))
+ Return (PKG)
+ }
+ Method (M0D3, 0x0, Notserialized)
+ {
+ Name (PKG, Package(1) { 200 })
+ Store(M0C0, Index(PKG,0))
+ Return (PKG)
+ }
+ Method (M1D3, 0x0, Notserialized)
+ {
+ Name (PKG, Package(1) { 2000 })
+ Store(M1C0, Index(PKG,0))
+ Return (PKG)
+ }
+ Method (M0D0, 0x0, Notserialized)
+ {
+ Name (PKG, Package(1) { 0 })
+ Store(M2C0, Index(PKG,0))
+ Return (PKG)
+ }
+
+ Name (RBUF, ResourceTemplate ()
+ {
+ //
+ // Resource settings will be overwritten after PCI enumeration
+ //
+ Memory32Fixed (ReadWrite, 0x00000000, 0x00001000, BAR0)
+ Interrupt(ResourceConsumer, Level, ActiveLow, Shared, , , ) {21}
+ })
+
+ Method (_CRS, 0x0, NotSerialized)
+ {
+ Name (DBUF, ResourceTemplate ()
+ {
+ //
+ // Provide Serial IO DMA channels used by the I2C0 controller
+ //
+ FixedDMA(0x18, 4, Width32Bit, DMA1) //Tx
+ FixedDMA(0x19, 5, Width32Bit, DMA2) //Rx
+ })
+ If(LNotEqual(\_SB_.PCI0.SDMA._STA, 0x0)) {
+ Return (ConcatenateResTemplate(RBUF, DBUF))
+ } Else {
+ Return (RBUF)
+ }
+ }
+
+ Method (_HRV)
+ {
+ //
+ // Report LPC Revision Id
+ //
+ Return (CRID)
+ }
+
+ CreateDWordField(RBUF,BAR0._BAS,BVAL)
+
+ Method (_STA, 0x0, NotSerialized)
+ {
+ If(LEqual(BVAL, 0)) { Return(0x0) } // has BAR for this device been programmed by the OS?
+ If(LLess(OSYS,2012)) { Return(0x0) } // Win 8 or above?
+ If(LEqual(S0ID, 1)) { Return(0xF) } // CS enabled in SETUP?
+ Return(0x0)
+ }
+
+ // D0 Method for I2C0
+ Method(_PS0,0,Serialized)
+ {
+ ADBG("I2C0 Ctrlr D0")
+ If(LNotEqual(\_SB.PCI0.SIRC.CNTR(2), 0)) {
+ Add(\_SB.PCI0.SIRC.CNTR(2),0x84 ,Local0)
+ OperationRegion(ICB1, SystemMemory, Local0, 4)
+ Field(ICB1, DWordAcc, NoLock, Preserve) {
+ Offset(0x0),
+ TEMP, 32
+ }
+ And(TEMP, 0xFFFFFFFC, TEMP)
+ Store(TEMP, Local0)
+ }
+ If(CondRefOf(\_SB.PCI0.I2C0.PS0X))
+ {
+ \_SB.PCI0.I2C0.PS0X()
+ }
+ }
+
+ // D3 Method for I2C0
+ Method(_PS3,0,Serialized)
+ {
+ ADBG("I2C0 Ctrlr D3")
+
+ If(LNotEqual(\_SB.PCI0.SIRC.CNTR(2), 0)) {
+ Add(\_SB.PCI0.SIRC.CNTR(2),0x84 ,Local0)
+ OperationRegion(ICB1, SystemMemory, Local0, 4)
+ Field(ICB1, DWordAcc, NoLock, Preserve) {
+ Offset(0x0),
+ TEMP, 32
+ }
+ Or(TEMP, 0x3, TEMP)
+ Store(TEMP, Local0)
+ }
+ If(CondRefOf(\_SB.PCI0.I2C0.PS3X))
+ {
+ \_SB.PCI0.I2C0.PS3X()
+ }
+
+ }
+
+ } // Device (I2C0)
+
+ //----------------------------
+ // Serial IO I2C1 Controller
+ //----------------------------
+ Device (I2C1)
+ {
+ Name (_HID, "INT33C3")
+ Name (_CID, "INT33C3")
+ Name (_UID, 2)
+ Name (_ADR, 0x00150002)
+
+ Method(_DEP){
+ ADBG("I2C1 DEP Call")
+ If(LEqual(S0ID, 1)){
+ ADBG("I2C1 DEP")
+ Return(Package() {\_SB.PEPD})
+ }Else{
+ ADBG("I2C1 DEP NULL")
+ Return(Package() {})
+ }
+ }
+
+ Method (SSCN, 0x0, NotSerialized)
+ {
+ Name (PKG, Package(3) { 432, 507, 9 })
+ Store(SSH1, Index(PKG,0))
+ Store(SSL1, Index(PKG,1))
+ Store(SSD1, Index(PKG,2))
+ Return (PKG)
+ }
+ Method (FMCN, 0x0, NotSerialized)
+ {
+ Name (PKG, Package(3) { 72, 160, 9 })
+ Store(FMH1, Index(PKG,0))
+ Store(FML1, Index(PKG,1))
+ Store(FMD1, Index(PKG,2))
+ Return (PKG)
+ }
+ Method (FPCN, 0x0, NotSerialized)
+ {
+ Name (PKG, Package(3) { 26, 50, 5 })
+ Store(FPH1, Index(PKG,0))
+ Store(FPL1, Index(PKG,1))
+ Store(FPD1, Index(PKG,2))
+ Return (PKG)
+ }
+ Method (M0D3, 0x0, Notserialized)
+ {
+ Name (PKG, Package(1) { 200 })
+ Store(M0C1, Index(PKG,0))
+ Return (PKG)
+ }
+ Method (M1D3, 0x0, Notserialized)
+ {
+ Name (PKG, Package(1) { 2000 })
+ Store(M1C1, Index(PKG,0))
+ Return (PKG)
+ }
+ Method (M0D0, 0x0, Notserialized)
+ {
+ Name (PKG, Package(1) { 0 })
+ Store(M2C1, Index(PKG,0))
+ Return (PKG)
+ }
+
+ Name (RBUF, ResourceTemplate ()
+ {
+ //
+ // Resource settings will be overwritten after PCI enumeration
+ //
+ Memory32Fixed (ReadWrite, 0x00000000, 0x00001000, BAR0)
+ Interrupt(ResourceConsumer, Level, ActiveLow, Shared, , , ) {21}
+ })
+
+ Method (_CRS, 0x0, NotSerialized)
+ {
+ Name (DBUF, ResourceTemplate ()
+ {
+ FixedDMA(0x1A, 6, Width32Bit, DMA1) //Tx
+ FixedDMA(0x1B, 7, Width32Bit, DMA2) //Rx
+ })
+
+ If(LNotEqual(\_SB_.PCI0.SDMA._STA, 0x0)) {
+ Return (ConcatenateResTemplate(RBUF, DBUF))
+ } Else {
+ Return (RBUF)
+ }
+ }
+
+ Method (_HRV)
+ {
+ //
+ // Report LPC Revision Id
+ //
+ Return (CRID)
+ }
+
+ CreateDWordField(RBUF,BAR0._BAS,BVAL)
+
+ Method (_STA, 0x0, NotSerialized)
+ {
+ If(LEqual(BVAL, 0)) { Return(0x0) } // has BAR for this device been programmed by the OS?
+ If(LLess(OSYS,2012)) { Return(0x0) } // Win 8 or above?
+ If(LEqual(S0ID, 1)) { Return(0xF) } // CS enabled in SETUP?
+ Return(0x0)
+ }
+
+ // D0 Method for I2C1
+ Method(_PS0,0,Serialized)
+ {
+ ADBG("I2C1 Ctrlr D0")
+
+ If(LNotEqual(\_SB.PCI0.SIRC.CNTR(3), 0)) {
+ If(CondRefOf(\_SB.PCI0.I2C1.PS0X))
+ {
+ \_SB.PCI0.I2C1.PS0X()
+ }
+ Add(\_SB.PCI0.SIRC.CNTR(3),0x84 ,Local0)
+ OperationRegion(ICB1, SystemMemory, Local0, 4)
+ Field(ICB1, DWordAcc, NoLock, Preserve) {
+ Offset(0x0),
+ TEMP, 32
+ }
+ And(TEMP, 0xFFFFFFFC, TEMP)
+ Store(TEMP, Local0)
+ }
+ }
+
+ // D3 Method for I2C1
+ Method(_PS3,0,Serialized)
+ {
+ ADBG("I2C1 Ctrlr D3")
+
+ If(LNotEqual(\_SB.PCI0.SIRC.CNTR(3), 0)) {
+ Add(\_SB.PCI0.SIRC.CNTR(3),0x84 ,Local0)
+ OperationRegion(ICB1, SystemMemory, Local0, 4)
+ Field(ICB1, DWordAcc, NoLock, Preserve) {
+ Offset(0x0),
+ TEMP, 32
+ }
+ Or(TEMP, 0x3, TEMP)
+ Store(TEMP, Local0)
+ }
+ }
+ } // Device (I2C1)
+
+ //----------------------------
+ // Serial IO SPI0 Controller
+ //----------------------------
+ Device (SPI0)
+ {
+ Name (_HID, "INT33C0")
+ Name (_CID, "INT33C0")
+ Name (_UID, 1)
+ Name (_ADR, 0x00150003)
+
+ Method (M0D3, 0x0, Notserialized)
+ {
+ Name (PKG, Package(1) { 200 })
+ Store(M0C2, Index(PKG,0))
+ Return (PKG)
+ }
+ Method (M1D3, 0x0, Notserialized)
+ {
+ Name (PKG, Package(1) { 2000 })
+ Store(M1C2, Index(PKG,0))
+ Return (PKG)
+ }
+
+ Name (RBUF, ResourceTemplate ()
+ {
+ //
+ // Resource settings will be overwritten after PCI enumeration
+ //
+ Memory32Fixed (ReadWrite, 0x00000000, 0x00001000, BAR0)
+ Interrupt(ResourceConsumer, Level, ActiveLow, Shared, , , ) {21}
+ })
+
+ Method (_CRS, 0x0, NotSerialized)
+ {
+ Return (RBUF)
+ }
+
+ Method (_HRV)
+ {
+ //
+ // Report LPC Revision Id
+ //
+ Return (CRID)
+ }
+
+ CreateDWordField(RBUF,BAR0._BAS,BVAL)
+
+ Method (_STA, 0x0, NotSerialized)
+ {
+ If(LEqual(BVAL, 0)) { Return(0x0) } // has BAR for this device been programmed by the OS?
+ If(LLess(OSYS,2012)) { Return(0x0) } // Win 8 or above?
+ If(LEqual(S0ID, 1)) { Return(0xF) } // CS enabled in SETUP?
+ Return(0x0)
+
+ }
+
+ // D0 Method for SPI0
+ Method(_PS0,0,Serialized)
+ {
+ ADBG("SPI0 Ctrlr D0")
+
+ If(LNotEqual(\_SB.PCI0.SIRC.CNTR(4), 0)) {
+ Add(\_SB.PCI0.SIRC.CNTR(4),0x84 ,Local0)
+ OperationRegion(ICB1, SystemMemory, Local0, 4)
+ Field(ICB1, DWordAcc, NoLock, Preserve) {
+ Offset(0x0),
+ TEMP, 32
+ }
+ And(TEMP, 0xFFFFFFFC, TEMP)
+ Store(TEMP, Local0)
+ }
+ }
+
+ // D3 Method for SPI0
+ Method(_PS3,0,Serialized)
+ {
+ ADBG("SPI0 Ctrlr D3")
+
+ If(LNotEqual(\_SB.PCI0.SIRC.CNTR(4), 0)) {
+ Add(\_SB.PCI0.SIRC.CNTR(4),0x84 ,Local0)
+ OperationRegion(ICB1, SystemMemory, Local0, 4)
+ Field(ICB1, DWordAcc, NoLock, Preserve) {
+ Offset(0x0),
+ TEMP, 32
+ }
+ Or(TEMP, 0x3, TEMP)
+ Store(TEMP, Local0)
+ }
+ }
+ } // Device (SPI0)
+
+ //----------------------------
+ // Serial IO SPI1 Controller
+ //----------------------------
+ Device (SPI1)
+ {
+ Name (_HID, "INT33C1")
+ Name (_CID, "INT33C1")
+ Name (_UID, 2)
+ Name (_ADR, 0x00150004)
+
+
+ Method (M0D3, 0x0, Notserialized)
+ {
+ Name (PKG, Package(1) { 200 })
+ Store(M0C3, Index(PKG,0))
+ Return (PKG)
+ }
+ Method (M1D3, 0x0, Notserialized)
+ {
+ Name (PKG, Package(1) { 2000 })
+ Store(M1C3, Index(PKG,0))
+ Return (PKG)
+ }
+
+ Name (RBUF, ResourceTemplate ()
+ {
+ //
+ // Resource settings will be overwritten after PCI enumeration
+ //
+ Memory32Fixed (ReadWrite, 0x00000000, 0x00001000, BAR0)
+ Interrupt(ResourceConsumer, Level, ActiveLow, Shared, , , ) {21}
+ })
+
+ Method (_CRS, 0x0, NotSerialized)
+ {
+ Name (DBUF, ResourceTemplate ()
+ {
+ FixedDMA(0x10, 0, Width32Bit, DMA1) //Tx
+ FixedDMA(0x11, 1, Width32Bit, DMA2) //Rx
+ })
+
+ If(LNotEqual(\_SB_.PCI0.SDMA._STA, 0x0)) {
+ Return (ConcatenateResTemplate(RBUF, DBUF))
+ } Else {
+ Return (RBUF)
+ }
+ }
+
+ Method (_HRV)
+ {
+ //
+ // Report LPC Revision Id
+ //
+ Return (CRID)
+ }
+
+ CreateDWordField(RBUF,BAR0._BAS,BVAL)
+
+ Method (_STA, 0x0, NotSerialized)
+ {
+ If(LEqual(BVAL, 0)) { Return(0x0) } // has BAR for this device been programmed by the OS?
+ If(LLess(OSYS,2012)) { Return(0x0) } // Win 8 or above?
+ If(LEqual(S0ID, 1)) { Return(0xF) } // CS enabled in SETUP?
+ Return(0x0)
+ }
+
+ // D0 Method for SPI1
+ Method(_PS0,0,Serialized)
+ {
+ ADBG("SPI1 Ctrlr D0")
+
+ If(LNotEqual(\_SB.PCI0.SIRC.CNTR(5), 0)) {
+ Add(\_SB.PCI0.SIRC.CNTR(5),0x84 ,Local0)
+ OperationRegion(ICB1, SystemMemory, Local0, 4)
+ Field(ICB1, DWordAcc, NoLock, Preserve) {
+ Offset(0x0),
+ TEMP, 32
+ }
+ And(TEMP, 0xFFFFFFFC, TEMP)
+ Store(TEMP, Local0)
+ }
+ }
+
+ // D3 Method for SPI1
+ Method(_PS3,0,Serialized)
+ {
+ ADBG("SPI1 Ctrlr D3")
+
+ If(LNotEqual(\_SB.PCI0.SIRC.CNTR(5), 0)) {
+ Add(\_SB.PCI0.SIRC.CNTR(5),0x84 ,Local0)
+ OperationRegion(ICB1, SystemMemory, Local0, 4)
+ Field(ICB1, DWordAcc, NoLock, Preserve) {
+ Offset(0x0),
+ TEMP, 32
+ }
+ Or(TEMP, 0x3, TEMP)
+ Store(TEMP, Local0)
+ }
+ }
+ } // Device (SPI1)
+
+ //-----------------------------
+ // Serial IO UART0 Controller
+ //-----------------------------
+ Device (UA00)
+ {
+ Name (_HID, "INT33C4")
+ Name (_CID, "INT33C4")
+ Name (_UID, 1)
+ Name (_ADR, 0x00150005)
+
+ Method(_DEP){
+ ADBG("UA00 DEP Call")
+ If(LEqual(S0ID, 1)){
+ ADBG("UA00 DEP")
+ Return(Package() {\_SB.PEPD})
+ }Else{
+ ADBG("UA00 DEP NULL")
+ Return(Package() {})
+ }
+ }
+
+ Method (M0D3, 0x0, Notserialized)
+ {
+ Name (PKG, Package(1) { 200 })
+ Store(M0C4, Index(PKG,0))
+ Return (PKG)
+ }
+ Method (M1D3, 0x0, Notserialized)
+ {
+ Name (PKG, Package(1) { 200 })
+ Store(M1C4, Index(PKG,0))
+ Return (PKG)
+ }
+
+ Name (RBUF, ResourceTemplate ()
+ {
+ //
+ // Resource settings will be overwritten after PCI enumeration
+ //
+ Memory32Fixed (ReadWrite, 0x00000000, 0x0001000, BAR0)
+ Interrupt(ResourceConsumer, Level, ActiveLow, Shared, , , ) {21}
+ })
+
+ Method (_CRS, 0x0, NotSerialized)
+ {
+ Return (RBUF)
+ }
+
+ Method (_HRV)
+ {
+ //
+ // Report LPC Revision Id
+ //
+ Return (CRID)
+ }
+
+ CreateDWordField(RBUF,BAR0._BAS,BVAL)
+
+ Method (_STA, 0x0, NotSerialized)
+ {
+ If(LEqual(BVAL, 0)) { Return(0x0) } // has BAR for this device been programmed by the OS?
+ If(LLess(OSYS,2012)) { Return(0x0) } // Win 8 or above?
+ If(LEqual(S0ID, 1)) { Return(0xF) } // CS enabled in SETUP?
+ Return(0x0)
+ }
+
+ // D0 Method for UAR0
+ Method(_PS0,0,Serialized)
+ {
+ ADBG("UAR0 Ctrlr D0")
+
+ If(LNotEqual(\_SB.PCI0.SIRC.CNTR(6), 0)) {
+ Add(\_SB.PCI0.SIRC.CNTR(6),0x84 ,Local0)
+ OperationRegion(ICB1, SystemMemory, Local0, 4)
+ Field(ICB1, DWordAcc, NoLock, Preserve) {
+ Offset(0x0),
+ TEMP, 32
+ }
+ And(TEMP, 0xFFFFFFFC, TEMP)
+ Store(TEMP, Local0)
+ }
+ }
+
+ // D3 Method for UAR0
+ Method(_PS3,0,Serialized)
+ {
+ ADBG("UAR0 Ctrlr D3")
+
+ If(LNotEqual(\_SB.PCI0.SIRC.CNTR(6), 0)) {
+ Add(\_SB.PCI0.SIRC.CNTR(6),0x84 ,Local0)
+ OperationRegion(ICB1, SystemMemory, Local0, 4)
+ Field(ICB1, DWordAcc, NoLock, Preserve) {
+ Offset(0x0),
+ TEMP, 32
+ }
+ Or(TEMP, 0x3, TEMP)
+ Store(TEMP, Local0)
+ }
+ }
+
+
+ } // Device (UART0)
+
+ //-----------------------------
+ // Serial IO UART1 Controller
+ //-----------------------------
+ Device (UA01)
+ {
+ Name (_HID, "INT33C5")
+ Name (_CID, "INT33C5")
+ Name (_UID, 2)
+ Name (_ADR, 0x00150006)
+
+ Method(_DEP){
+ ADBG("UA01 DEP Call")
+ If(LEqual(S0ID, 1)){
+ ADBG("UA01 DEP")
+ Return(Package() {\_SB.PEPD})
+ }Else{
+ ADBG("UA01 DEP NULL")
+ Return(Package() {})
+ }
+ }
+
+ Method (M0D3, 0x0, Notserialized)
+ {
+ Name (PKG, Package(1) { 200 })
+ Store(M0C5, Index(PKG,0))
+ Return (PKG)
+ }
+ Method (M1D3, 0x0, Notserialized)
+ {
+ Name (PKG, Package(1) { 200 })
+ Store(M1C5, Index(PKG,0))
+ Return (PKG)
+ }
+
+ Name (RBUF, ResourceTemplate ()
+ {
+ //
+ // Resource settings will be overwritten after PCI enumeration
+ //
+ Memory32Fixed (ReadWrite, 0x00000000, 0x0001000, BAR0)
+ Interrupt(ResourceConsumer, Level, ActiveLow, Shared, , , ) {21}
+ })
+
+ Method (_CRS, 0x0, NotSerialized)
+ {
+ Name (DBUF, ResourceTemplate ()
+ {
+ FixedDMA(0x16, 2, Width32Bit, DMA1) //Tx
+ FixedDMA(0x17, 3, Width32Bit, DMA2) //Rx
+ })
+
+ If(LNotEqual(\_SB_.PCI0.SDMA._STA, 0x0)) {
+ Return (ConcatenateResTemplate(RBUF, DBUF))
+ } Else {
+ Return (RBUF)
+ }
+ }
+
+ Method (_HRV)
+ {
+ //
+ // Report LPC Revision Id
+ //
+ Return (CRID)
+ }
+
+ CreateDWordField(RBUF,BAR0._BAS,BVAL)
+
+ Method (_STA, 0x0, NotSerialized)
+ {
+ If(LEqual(BVAL, 0)) { Return(0x0) } // has BAR for this device been programmed by the OS?
+ If(LLess(OSYS,2012)) { Return(0x0) } // Win 8 or above?
+ If(LEqual(S0ID, 1)) { Return(0xF) } // CS enabled in SETUP?
+ Return(0x0)
+ }
+
+ // D0 Method for UAR1
+ Method(_PS0,0,Serialized)
+ {
+ ADBG("UAR1 Ctrlr D0")
+
+ If(LNotEqual(\_SB.PCI0.SIRC.CNTR(7), 0)) {
+ Add(\_SB.PCI0.SIRC.CNTR(7),0x84 ,Local0)
+ OperationRegion(ICB1, SystemMemory, Local0, 4)
+ Field(ICB1, DWordAcc, NoLock, Preserve) {
+ Offset(0x0),
+ TEMP, 32
+ }
+ And(TEMP, 0xFFFFFFFC, TEMP)
+ Store(TEMP, Local0)
+ }
+ }
+
+ // D3 Method for UAR1
+ Method(_PS3,0,Serialized)
+ {
+ ADBG("UAR1 Ctrlr D3")
+
+ If(LNotEqual(\_SB.PCI0.SIRC.CNTR(7), 0)) {
+ Add(\_SB.PCI0.SIRC.CNTR(7),0x84 ,Local0)
+ OperationRegion(ICB1, SystemMemory, Local0, 4)
+ Field(ICB1, DWordAcc, NoLock, Preserve) {
+ Offset(0x0),
+ TEMP, 32
+ }
+ Or(TEMP, 0x3, TEMP)
+ Store(TEMP, Local0)
+ }
+ }
+ } // Device (UART1)
+
+ //--------------------------------
+ // Serial IO SDIO Host Controller
+ //--------------------------------
+ Device (SDHC)
+ {
+ Name (_HID, "INT33C6")
+ Name (_CID, "PNP0D40")
+ Name (_UID, 1)
+ Name (_ADR, 0x00170000)
+
+ Method(_DEP){
+ ADBG("SDHC DEP Call")
+ If(LEqual(S0ID, 1)){
+ ADBG("SDHC DEP")
+ Return(Package() {\_SB.PEPD})
+ }Else{
+ ADBG("SDHC DEP NULL")
+ Return(Package() {})
+ }
+ }
+
+ Name (RBUF, ResourceTemplate ()
+ {
+ //
+ // Resource settings will be overwritten after PCI enumeration
+ //
+ Memory32Fixed (ReadWrite, 0x00000000, 0x00001000, BARA) // BAR0 Range
+ Interrupt(ResourceConsumer, Level, ActiveLow, Shared, , , ) {22}
+ })
+
+ Method (_CRS, 0x0, NotSerialized)
+ {
+ Return (RBUF)
+ }
+
+ CreateDWordField(RBUF,BARA._BAS,BVAL)
+
+ Method (_STA, 0x0, NotSerialized)
+ {
+ If(LEqual(BVAL, 0)) { Return(0x0) } // has BAR for this device been programmed by the OS?
+ If(LLess(OSYS,2012)) { Return(0x0) } // Win 8 or above?
+ If(LEqual(S0ID, 1)) { Return(0xF) } // CS enabled in SETUP?
+ Return(0x0)
+ }
+
+ // D0 Method for SDHC
+ Method(_PS0,0,Serialized)
+ {
+ ADBG("SDHC Ctrlr D0")
+
+ If(LNotEqual(\_SB.PCI0.SIRC.CNTR(8), 0)) {
+ Add(\_SB.PCI0.SIRC.CNTR(8),0x84 ,Local0)
+ OperationRegion(ICB1, SystemMemory, Local0, 4)
+ Field(ICB1, DWordAcc, NoLock, Preserve) {
+ Offset(0x0),
+ TEMP, 32
+ }
+ And(TEMP, 0xFFFFFFFC, TEMP)
+ Store(TEMP, Local0)
+ }
+
+ If(CondRefOf(\_SB.PCI0.SDHC.PS0X))
+ {
+ \_SB.PCI0.SDHC.PS0X()
+ }
+ }
+
+ // D3 Method for SDHC
+ Method(_PS3,0,Serialized)
+ {
+ ADBG("SDHC Ctrlr D3")
+
+ If(LNotEqual(\_SB.PCI0.SIRC.CNTR(8), 0)) {
+ Add(\_SB.PCI0.SIRC.CNTR(8),0x84 ,Local0)
+ OperationRegion(ICB1, SystemMemory, Local0, 4)
+ Field(ICB1, DWordAcc, NoLock, Preserve) {
+ Offset(0x0),
+ TEMP, 32
+ }
+ Or(TEMP, 0x3, TEMP)
+ Store(TEMP, Local0)
+ }
+ }
+
+ } // Device (SDHC)
+
+ } // Scope (\_SB.PCI0)
diff --git a/ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchSmb.asl b/ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchSmb.asl
new file mode 100644
index 0000000..6356e3c
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchSmb.asl
@@ -0,0 +1,605 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Haswell *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2011 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+
+// Define various SMBus PCI Configuration Space Registers.
+
+OperationRegion(SMBP,PCI_Config,0x40,0xC0)
+Field(SMBP,DWordAcc,NoLock,Preserve)
+{
+ , 2,
+ I2CE, 1
+}
+
+OperationRegion(SMPB,PCI_Config,0x20,4)
+Field(SMPB,DWordAcc,NoLock,Preserve)
+{
+ , 5,
+ SBAR, 11
+}
+
+// Define various SMBus IO Mapped Registers.
+
+OperationRegion(SMBI,SystemIO,ShiftLeft(SBAR,5),0x10)
+Field(SMBI,ByteAcc,NoLock,Preserve)
+{
+ HSTS, 8, // 0 - Host Status Register
+ Offset(0x02),
+ HCON, 8, // 2 - Host Control
+ HCOM, 8, // 3 - Host Command
+ TXSA, 8, // 4 - Transmit Slave Address
+ DAT0, 8, // 5 - Host Data 0
+ DAT1, 8, // 6 - Host Data 1
+ HBDR, 8, // 7 - Host Block Data
+ PECR, 8, // 8 - Packer Error Check
+ RXSA, 8, // 9 - Receive Slave Address
+ SDAT, 16, // A - Slave Data
+}
+
+// SMBus Send Byte - This function will write a single byte of
+// data to a specific Slave Device per SMBus Send Byte Protocol.
+// Arg0 = Address
+// Arg1 = Data
+// Return: Success = 1
+// Failure = 0
+
+Method(SSXB,2,Serialized)
+{
+ // Step 1: Confirm the ICHx SMBus is ready to perform
+ // communication.
+
+ If(STRT())
+ {
+ Return(0)
+ }
+
+ // Step 2: Initiate a Send Byte.
+
+ Store(0,I2CE) // Ensure SMbus Mode.
+ Store(0xBF,HSTS) // Clear all but INUSE_STS.
+ Store(Arg0,TXSA) // Write Address in TXSA.
+ Store(Arg1,HCOM) // Data in HCOM.
+
+ // Set the SMBus Host control register to 0x48.
+ // Bit 7: = 0 = reserved
+ // Bit 6: = 1 = start
+ // Bit 5: = 0 = disregard, I2C related bit
+ // Bits 4:2: = 001 = Byte Protocol
+ // Bit 1: = 0 = Normal Function
+ // Bit 0: = 0 = Disable interrupt generation
+
+ Store(0x48,HCON)
+
+ // Step 3: Exit the Method correctly.
+
+ If(COMP)
+ {
+ Or(HSTS,0xFF,HSTS) // Clear INUSE_STS and others..
+ Return(1) // Return Success.
+ }
+
+ Return(0)
+}
+
+// SMBus Receive Byte - This function will write a single byte
+// of data to a specific Slave Device per SMBus Receive Byte
+// Protocol.
+// Arg0 = Address
+// Return: Success = Byte-Size Value
+// Failure = Word-Size Value = FFFFh.
+
+Method(SRXB,1,Serialized)
+{
+ // Step 1: Confirm the ICHx SMBus is ready to perform
+ // communication.
+
+ If(STRT())
+ {
+ Return(0xFFFF)
+ }
+
+ // Step 2: Initiate a Receive Byte.
+
+ Store(0,I2CE) // Ensure SMbus Mode.
+ Store(0xBF,HSTS) // Clear all but INUSE_STS.
+ Store(Or(Arg0,1),TXSA) // Read Address in TXSA.
+
+ // Set the SMBus Host control register to 0x48.
+ // Bit 7: = 0 = reserved
+ // Bit 6: = 1 = start
+ // Bit 5: = 0 = disregard, I2C related bit
+ // Bits 4:2: = 001 = Byte Protocol
+ // Bit 1: = 0 = Normal Function
+ // Bit 0: = 0 = Disable interrupt generation
+
+ Store(0x44,HCON)
+
+ // Step 3: Exit the Method correctly.
+
+ If(COMP)
+ {
+ Or(HSTS,0xFF,HSTS) // Clear INUSE_STS and others..
+ Return(DAT0) // Return Success.
+ }
+
+ Return(0xFFFF) // Return Failure.
+}
+
+// SMBus Write Byte - This function will write a single byte
+// of data to a specific Slave Device per SMBus Write Byte
+// Protocol.
+// Arg0 = Address
+// Arg1 = Command
+// Arg2 = Data
+// Return: Success = 1
+// Failure = 0
+
+Method(SWRB,3,Serialized)
+{
+ // Step 1: Confirm the ICHx SMBus is ready to perform communication.
+
+ If(STRT())
+ {
+ Return(0)
+ }
+
+ // Step 2: Initiate a Write Byte.
+
+ Store(0,I2CE) // Ensure SMbus Mode.
+ Store(0xBF,HSTS) // Clear all but INUSE_STS.
+ Store(Arg0,TXSA) // Write Address in TXSA.
+ Store(Arg1,HCOM) // Command in HCOM.
+ Store(Arg2,DAT0) // Data in DAT0.
+
+ // Set the SMBus Host control register to 0x48.
+ // Bit 7: = 0 = reserved
+ // Bit 6: = 1 = start
+ // Bit 5: = 0 = disregard, I2C related bit
+ // Bits 4:2: = 010 = Byte Data Protocol
+ // Bit 1: = 0 = Normal Function
+ // Bit 0: = 0 = Disable interrupt generation
+
+ Store(0x48,HCON)
+
+ // Step 3: Exit the Method correctly.
+
+ If(COMP)
+ {
+ Or(HSTS,0xFF,HSTS) // Clear INUSE_STS and others..
+ Return(1) // Return Success.
+ }
+
+ Return(0) // Return Failure.
+}
+
+// SMBus Read Byte - This function will read a single byte of data
+// from a specific slave device per SMBus Read Byte Protocol.
+// Arg0 = Address
+// Arg1 = Command
+// Return: Success = Byte-Size Value
+// Failure = Word-Size Value
+
+Method(SRDB,2,Serialized)
+{
+ // Step 1: Confirm the ICHx SMBus is ready to perform communication.
+
+ If(STRT())
+ {
+ Return(0xFFFF)
+ }
+
+ // Step 2: Initiate a Read Byte.
+
+ Store(0,I2CE) // Ensure SMbus Mode.
+ Store(0xBF,HSTS) // Clear all but INUSE_STS.
+ Store(Or(Arg0,1),TXSA) // Read Address in TXSA.
+ Store(Arg1,HCOM) // Command in HCOM.
+
+ // Set the SMBus Host control register to 0x48.
+ // Bit 7: = 0 = reserved
+ // Bit 6: = 1 = start
+ // Bit 5: = 0 = disregard, I2C related bit
+ // Bits 4:2: = 010 = Byte Data Protocol
+ // Bit 1: = 0 = Normal Function
+ // Bit 0: = 0 = Disable interrupt generation
+
+ Store(0x48,HCON)
+
+ // Step 3: Exit the Method correctly.
+
+ If(COMP)
+ {
+ Or(HSTS,0xFF,HSTS) // Clear INUSE_STS and others..
+ Return(DAT0) // Return Success.
+ }
+
+ Return(0xFFFF) // Return Failure.
+}
+
+// SMBus Write Word - This function will write a single word
+// of data to a specific Slave Device per SMBus Write Word
+// Protocol.
+// Arg0 = Address
+// Arg1 = Command
+// Arg2 = Data (16 bits in size)
+// Return: Success = 1
+// Failure = 0
+
+Method(SWRW,3,Serialized)
+{
+ // Step 1: Confirm the ICHx SMBus is ready to perform communication.
+
+ If(STRT())
+ {
+ Return(0)
+ }
+
+ // Step 2: Initiate a Write Word.
+
+ Store(0,I2CE) // Ensure SMbus Mode.
+ Store(0xBF,HSTS) // Clear all but INUSE_STS.
+ Store(Arg0,TXSA) // Write Address in TXSA.
+ Store(Arg1,HCOM) // Command in HCOM.
+ And(Arg2,0xFF,DAT1) // Low byte Data in DAT1.
+ And(ShiftRight(Arg2,8),0xFF,DAT0) // High byte Data in DAT0.
+
+ // Set the SMBus Host control register to 0x4C.
+ // Bit 7: = 0 = reserved
+ // Bit 6: = 1 = start
+ // Bit 5: = 0 = disregard, I2C related bit
+ // Bits 4:2: = 011 = Word Data Protocol
+ // Bit 1: = 0 = Normal Function
+ // Bit 0: = 0 = Disable interrupt generation
+
+ Store(0x4C,HCON)
+
+ // Step 3: Exit the Method correctly.
+
+ If(COMP())
+ {
+ Or(HSTS,0xFF,HSTS) // Clear INUSE_STS and others.
+ Return(1) // Return Success.
+ }
+
+ Return(0) // Return Failure.
+}
+
+// SMBus Read Word - This function will read a single byte of data
+// from a specific slave device per SMBus Read Word Protocol.
+// Arg0 = Address
+// Arg1 = Command
+// Return: Success = Word-Size Value
+// Failure = Dword-Size Value
+
+Method(SRDW,2,Serialized)
+{
+ // Step 1: Confirm the ICHx SMBus is ready to perform communication.
+
+ If(STRT())
+ {
+ Return(0xFFFF)
+ }
+
+ // Step 2: Initiate a Read Word.
+
+ Store(0,I2CE) // Ensure SMbus Mode.
+ Store(0xBF,HSTS) // Clear all but INUSE_STS.
+ Store(Or(Arg0,1),TXSA) // Read Address in TXSA.
+ Store(Arg1,HCOM) // Command in HCOM.
+
+ // Set the SMBus Host control register to 0x4C.
+ // Bit 7: = 0 = reserved
+ // Bit 6: = 1 = start
+ // Bit 5: = 0 = disregard, I2C related bit
+ // Bits 4:2: = 011 = Word Data Protocol
+ // Bit 1: = 0 = Normal Function
+ // Bit 0: = 0 = Disable interrupt generation
+
+ Store(0x4C,HCON)
+
+ // Step 3: Exit the Method correctly.
+
+ If(COMP())
+ {
+ Or(HSTS,0xFF,HSTS) // Clear INUSE_STS and others.
+ Return(Or(ShiftLeft(DAT0,8),DAT1)) // Return Success.
+ }
+
+ Return(0xFFFFFFFF) // Return Failure.
+}
+
+// SMBus Block Write - This function will write an entire block of data
+// to a specific slave device per SMBus Block Write Protocol.
+// Arg0 = Address
+// Arg1 = Command
+// Arg2 = Buffer of Data to Write
+// Arg3 = 1 = I2C Block Write, 0 = SMBus Block Write
+// Return: Success = 1
+// Failure = 0
+
+Method(SBLW,4,Serialized)
+{
+ // Step 1: Confirm the ICHx SMBus is ready to perform communication.
+
+ If(STRT())
+ {
+ Return(0)
+ }
+
+ // Step 2: Initiate a Block Write.
+
+ Store(Arg3,I2CE) // Select the proper protocol.
+ Store(0xBF,HSTS) // Clear all but INUSE_STS.
+ Store(Arg0,TXSA) // Write Address in TXSA.
+ Store(Arg1,HCOM) // Command in HCOM.
+ Store(Sizeof(Arg2),DAT0) // Count in DAT0.
+ Store(0,Local1) // Init Pointer to Buffer.
+ Store(DerefOf(Index(Arg2,0)),HBDR) // First Byte in HBD Register.
+
+ // Set the SMBus Host control register to 0x48.
+ // Bit 7: = 0 = reserved
+ // Bit 6: = 1 = start
+ // Bit 5: = 0 = disregard, I2C related bit
+ // Bits 4:2: = 101 = Block Protocol
+ // Bit 1: = 0 = Normal Function
+ // Bit 0: = 0 = Disable interrupt generation
+
+ Store(0x54,HCON)
+
+ // Step 3: Send the entire Block of Data.
+
+ While(LGreater(Sizeof(Arg2),Local1))
+ {
+ // Wait up to 200ms for Host Status to get set.
+
+ Store(4000,Local0) // 4000 * 50us = 200ms.
+
+ While(LAnd(LNot(And(HSTS,0x80)),Local0))
+ {
+ Decrement(Local0) // Decrement Count.
+ Stall(50) // Delay = 50us.
+ }
+
+ If(LNot(Local0)) // Timeout?
+ {
+ KILL() // Yes. Kill Communication.
+ Return(0) // Return failure.
+ }
+
+ Store(0x80,HSTS) // Clear Host Status.
+ Increment(Local1) // Point to Next Byte.
+
+ // Place next byte in HBDR if last byte has not been sent.
+
+ If(LGreater(Sizeof(Arg2),Local1))
+ {
+ Store(DerefOf(Index(Arg2,Local1)),HBDR)
+ }
+ }
+
+ // Step 4: Exit the Method correctly.
+
+ If(COMP())
+ {
+ Or(HSTS,0xFF,HSTS) // Clear all status bits.
+ Return(1) // Return Success.
+ }
+
+ Return(0) // Return Failure.
+}
+
+// SMBus Block Read - This function will read a block of data from
+// a specific slave device per SMBus Block Read Protocol.
+// Arg0 = Address
+// Arg1 = Command
+// Arg2 = 1 = I2C Block Write, 0 = SMBus Block Write
+// Return: Success = Data Buffer (First Byte = length)
+// Failure = 0
+
+Method(SBLR,3,Serialized)
+{
+ Name(TBUF, Buffer(256) {})
+
+ // Step 1: Confirm the ICHx SMBus is ready to perform communication.
+
+ If(STRT())
+ {
+ Return(0)
+ }
+
+ // Step 2: Initiate a Block Read.
+
+ Store(Arg2,I2CE) // Select the proper protocol.
+ Store(0xBF,HSTS) // Clear all but INUSE_STS.
+ Store(Or(Arg0,1),TXSA) // Read Address in TXSA.
+ Store(Arg1,HCOM) // Command in HCOM.
+
+ // Set the SMBus Host control register to 0x48.
+ // Bit 7: = 0 = reserved
+ // Bit 6: = 1 = start
+ // Bit 5: = 0 = disregard, I2C related bit
+ // Bits 4:2: = 101 = Block Protocol
+ // Bit 1: = 0 = Normal Function
+ // Bit 0: = 0 = Disable interrupt generation
+
+ Store(0x54,HCON)
+
+ // Step 3: Wait up to 200ms to get the Data Count.
+
+ Store(4000,Local0) // 4000 * 50us = 200ms.
+
+ While(LAnd(LNot(And(HSTS,0x80)),Local0))
+ {
+ Decrement(Local0) // Decrement Count.
+ Stall(50) // Delay = 50us.
+ }
+
+ If(LNot(Local0)) // Timeout?
+ {
+ KILL() // Yes. Kill Communication.
+ Return(0) // Return failure.
+ }
+
+ Store(DAT0,Index(TBUF,0)) // Get the Data Count.
+ Store(0x80,HSTS) // Clear Host Status.
+ Store(1,Local1) // Local1 = Buffer Pointer.
+
+ // Step 4: Get the Block Data and store it.
+
+ While(LLess(Local1,DerefOf(Index(TBUF,0))))
+ {
+ // Wait up to 200ms for Host Status to get set.
+
+ Store(4000,Local0) // 4000 * 50us = 200ms.
+
+ While(LAnd(LNot(And(HSTS,0x80)),Local0))
+ {
+ Decrement(Local0) // Decrement Count.
+ Stall(50) // Delay = 50us.
+ }
+
+ If(LNot(Local0)) // Timeout?
+ {
+ KILL() // Yes. Kill Communication.
+ Return(0) // Return failure.
+ }
+
+ Store(HBDR,Index(TBUF,Local1)) // Place into Buffer.
+ Store(0x80,HSTS) // Clear Host Status.
+ Increment(Local1)
+ }
+
+ // Step 5: Exit the Method correctly.
+
+ If(COMP())
+ {
+ Or(HSTS,0xFF,HSTS) // Clear INUSE_STS and others.
+ Return(TBUF) // Return Success.
+ }
+
+ Return(0) // Return Failure.
+}
+
+
+// SMBus Start Check
+// Return: Success = 0
+// Failure = 1
+
+Method(STRT,0,Serialized)
+{
+ // Wait up to 200ms to confirm the SMBus Semaphore has been
+ // released (In Use Status = 0). Note that the Sleep time may take
+ // longer as the This function will yield the Processor such that it
+ // may perform different tasks during the delay.
+
+ Store(200,Local0) // 200 * 1ms = 200ms.
+
+ While(Local0)
+ {
+ If(And(HSTS,0x40)) // In Use Set?
+ {
+ Decrement(Local0) // Yes. Decrement Count.
+ Sleep(1) // Delay = 1ms.
+ If(LEqual(Local0,0)) // Count = 0?
+ {
+ Return(1) // Return failure.
+ }
+ }
+ Else
+ {
+ Store(0,Local0) // In Use Clear. Continue.
+ }
+ }
+
+ // In Use Status = 0 during last read, which will make subsequent
+ // reads return In Use Status = 1 until software clears it. All
+ // software using ICHx SMBus should check this bit before initiating
+ // any SMBus communication.
+
+ // Wait up to 200ms to confirm the Host Interface is
+ // not processing a command.
+
+ Store(4000,Local0) // 4000 * 50us = 200ms.
+
+ While(Local0)
+ {
+ If(And(HSTS,0x01)) // Host Busy Set?
+ {
+ Decrement(Local0) // Decrement Count.
+ Stall(50) // Delay = 50us.
+ If(LEqual(Local0,0)) // Count = 0?
+ {
+ KILL() // Yes. Kill Communication.
+ }
+ }
+ Else
+ {
+ Return(0)
+ }
+ }
+
+ Return(1) // Timeout. Return failure.
+}
+
+// SMBus Completion Check
+// Return: Success = 1
+// Failure = 0
+
+Method(COMP,0,Serialized)
+{
+ // Wait for up to 200ms for the Completion Command
+ // Status to get set.
+
+ Store(4000,Local0) // 4000 * 50us = 200ms.
+
+ While(Local0)
+ {
+ If(And(HSTS,0x02)) // Completion Status Set?
+ {
+ Return(1) // Yes. We are done.
+ }
+ Else
+ {
+ Decrement(Local0) // Decrement Count.
+ Stall(50) // Delay 50us.
+ If(LEqual(Local0,0)) // Count = 0?
+ {
+ KILL() // Yes. Kill Communication.
+ }
+ }
+ }
+
+ Return(0) // Timeout. Return Failure.
+}
+
+// SMBus Kill Command
+
+Method(KILL,0,Serialized)
+{
+ Or(HCON,0x02,HCON) // Yes. Send Kill command.
+ Or(HSTS,0xFF,HSTS) // Clear all status.
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchXhci.asl b/ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchXhci.asl
new file mode 100644
index 0000000..634e088
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/PchXhci.asl
@@ -0,0 +1,1229 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Haswell *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 2010 - 2014 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+ Method(_DEP){
+ If(LEqual(S0ID, 1)){
+ Return(Package() {\_SB.PEPD})
+ }Else{
+ Return(Package() {})
+ }
+ }
+
+ OperationRegion(XPRT,PCI_Config,0x00,0x100)
+ Field(XPRT,AnyAcc,NoLock,Preserve)
+ {
+ DVID, 16,
+ Offset(0x40),
+ , 11,
+ SWAI, 1, // 0x40 BIT[11]
+ , 20,
+ Offset(0x44),
+ , 12,
+ SAIP, 2, // 0x44 BIT[13:12]
+ , 18,
+ Offset(0x74),
+ D0D3, 2, // 0x74 BIT[1:0]
+ , 6,
+ PMEE, 1, // PME Enable
+ , 6,
+ PMES, 1, // PME Status
+ Offset(0xB0), // SSCFG Reg for LPTLP
+ , 13,
+ MB13, 1, // 0xB0 BIT[13]
+ MB14, 1, // 0xB0 BIT[14]
+ , 17,
+ Offset(0xD0),
+ PR2, 32, // XUSB2PR: xHC USB 2.0 Port Routing Register.
+ PR2M, 32, // XUSB2PRM: xHC USB 2.0 Port Routing Mask Register.
+ PR3, 32, // USB3_PSSEN: USB3.0 Port SuperSpeed Enable Register.
+ PR3M, 32 // USB3PRM: USB3.0 Port Routing Mask Register
+ }
+
+ OperationRegion(XHCP, SystemMemory, Add(PEBS, 0xA0000), 0x100)
+ Field(XHCP,AnyAcc,Lock,Preserve)
+ {
+ Offset(0x4),
+ PDBM, 16,
+ Offset(0x10),
+ MEMB, 64
+ }
+
+ //
+ // for each HS port, this method returns its corresponding selection bit in USB2PR register
+ //
+ Method(PR2S,1,Serialized) {
+
+ If(LEqual(And(CDID,0xF000), 0x8000)) { // LPT-H
+ Switch(Arg0) {
+ Case( 1) {return (0x0001)}
+ Case( 2) {return (0x0002)}
+ Case( 3) {return (0x0004)}
+ Case( 4) {return (0x0008)}
+ Case( 5) {return (0x0100)}
+ Case( 6) {return (0x0200)}
+ Case( 7) {return (0x0400)}
+ Case( 8) {return (0x0800)}
+ Case( 9) {return (0x0010)}
+ Case(10) {return (0x0020)}
+ Case(11) {return (0x1000)}
+ Case(12) {return (0x2000)}
+ Case(13) {return (0x0040)}
+ Case(14) {return (0x0080)}
+ Case(15) {return (0x4000)}
+ }
+ } else { // LPT-LP
+ Switch(Arg0) {
+ Case( 1) {return (0x0001)}
+ Case( 2) {return (0x0002)}
+ Case( 3) {return (0x0004)}
+ Case( 4) {return (0x0008)}
+ Case( 5) {return (0x0010)}
+ Case( 6) {return (0x0020)}
+ Case( 7) {return (0x0040)}
+ Case( 8) {return (0x0080)}
+ Case( 9) {return (0x0100)}
+ }
+ }
+ }
+
+ Name(XRST, Zero)
+ //
+ // Workaround for XHCI
+ //
+ // At D3 exit (AKA PS_ON)
+ // For LPT-LP
+ // Clear PCI CFG offset 0xB0[14:13]
+ // Clear MMIO Offset 0x816C[14]
+ // Clear MMIO Offset 0x816C[2]
+ // For LPT-H, LPT-LP
+ // Set MMIO Offset 8154[31]
+ // For LPT-LP
+ // Wait until all SS ports are out of polling
+ // For each SS port which is disconnected (i.e. PORTS.PLS=5h) and CSC=0
+ // Issue Warm Port Reset
+ // Wait 101ms
+ // Write '1' to all Port Change Status bits if reset
+ // Set MMIO Offset 0x80E0[15]
+ // For LPT-H, LPT-LP
+ // Clear XHCI CFG REG 0x40[11]
+ // Clear XHCI CFG REG 0x44[13:12]
+ //
+ // Prior to D3 entry (AKA PS_OFF)
+ // For LPT-LP
+ // Set PCI CFG offset 0xB0[14:13]
+ // Set MMIO Offset 0x816C[14]
+ // Set MMIO Offset 0x816C[2]
+ // For LPT-H, LPT-LP
+ // Clear MMIO Offset 8154[31]
+ // For LPT-LP
+ // Clear MMIO Offset 0x80E0[15]
+ // For LPT-H, LPT-LP
+ // Set XHCI CFG REG 0x40[11]
+ // Set XHCI CFG REG 0x44[13:12] = '01'
+ //
+ External(\_SB.PCI0.XHC.PS0X, MethodObj)
+ External(\_SB.PCI0.XHC.PS3X, MethodObj)
+ //
+ // D0 Method for xHCI Host Controller
+ //
+ Method(_PS0,0,Serialized)
+ {
+ // Uses:
+ // Local0 - Temporary
+ // Local1 - Original command register
+ // Local2 - Original MBAR
+ // Local4 - Port reset mask
+ //
+ If(LEqual(^DVID,0xFFFF))
+ {
+ Return()
+ }
+
+ //
+ // MBAR Programming
+ //
+ Store(^MEMB,Local2) // Save MBAR
+ Store(^PDBM,Local1) // Save CMD
+ And(^PDBM,Not(0x06),^PDBM) // Clear MSE/BME
+
+ //
+ // Switch to D0
+ //
+ Store(^D0D3,Local3)
+ Store(0,^D0D3)
+
+ Store(\SRMB,^MEMB) // Set MBAR
+ Or(Local1,0x0002,^PDBM) // Set MSE
+
+ OperationRegion(MCA1,SystemMemory,\SRMB,0x9000)
+ Field(MCA1,DWordAcc,Lock,Preserve)
+ {
+ Offset(0x510),
+ PSC1, 32,
+ Offset(0x520),
+ PSC2, 32,
+ Offset(0x530),
+ PSC3, 32,
+ Offset(0x540),
+ PSC4, 32,
+ Offset(0x80E0), // AUX Reset Control 1
+ , 15,
+ AX15, 1,
+ Offset(0x8154), // AUX Domain PM control register 2
+ , 31,
+ CLK2, 1, // [31]
+ Offset(0x816C), // AUXCLKCTL
+ , 2,
+ CLK0, 1, // [2]
+ , 11,
+ CLK1, 1, // [14] - USB3 Port Aux/Core clock gating enable
+ }
+
+ If(LEqual(PCHS, 2)) // LPT-LP
+ {
+ //
+ // Clear PCI CFG offset 0xB0[14:13]
+ //
+ Store(0,^MB13)
+ Store(0,^MB14)
+ //
+ // Clear MMIO Offset 0x816C[14]
+ // Clear MMIO Offset 0x816C[2]
+ //
+ Store(0,CLK0)
+ Store(0,CLK1)
+ }
+
+ //
+ // Set MMIO Offset 8154[31] for both LPT-LP and LPT-H
+ //
+ Store(1,CLK2)
+
+ If(LEqual(PCHS, 2)) // LPT-LP
+ {
+ //
+ // Wait until all ports are out of polling (PP=1, PLS=7)
+ //
+ while(LOr(LOr(LEqual(And(PSC1,0x3F8),0x2E0),
+ LEqual(And(PSC2,0x3F8),0x2E0)),
+ LOr(LEqual(And(PSC3,0x3F8),0x2E0),
+ LEqual(And(PSC4,0x3F8),0x2E0))))
+ {
+ Stall(10)
+ }
+
+ //
+ // Bitmask of SS ports for which warm reset was performed
+ //
+ Store(0, Local4)
+
+ //
+ // For each SS port which is disconnected (i.e. PORTS.PLS=5h) and CSC=0
+ // Issue Warm Port Reset
+ //
+ And(PSC1,Not(0x02),Local0) // Mask PED
+ If(LEqual(And(Local0,0x203F9),0x2A0)) // If SS PSC1 PP=1, PLS=5, CSC=0
+ {
+ Or(Local0,0x80000000,PSC1) // Set WPR and clear change flags
+ Or(Local4,0x1,Local4)
+ }
+ And(PSC2,Not(0x02),Local0) // Mask PED
+ If(LEqual(And(Local0,0x203F9),0x2A0)) // If SS PSC2 PP=1, PLS=5, CSC=0
+ {
+ Or(Local0,0x80000000,PSC2) // Set WPR and clear change flags
+ Or(Local4,0x2,Local4)
+ }
+ And(PSC3,Not(0x02),Local0) // Mask PED
+ If(LEqual(And(Local0,0x203F9),0x2A0)) // If SS PSC3 PP=1, PLS=5, CSC=0
+ {
+ Or(Local0,0x80000000,PSC3) // Set WPR and clear change flags
+ Or(Local4,0x4,Local4)
+ }
+ And(PSC4,Not(0x02),Local0) // Mask PED
+ If(LEqual(And(Local0,0x203F9),0x2A0)) // If SS PSC4 PP=1, PLS=5, CSC=0
+ {
+ Or(Local0,0x80000000,PSC4) // Set WPR and clear change flags
+ Or(Local4,0x8,Local4)
+ }
+ //
+ // Wait 101ms
+ // Write '1' to all Port Change Status bits if reset
+ //
+ If (Local4)
+ {
+ Sleep(101)
+
+ If (And(Local4,0x1))
+ {
+ And(PSC1,Not(0x02),Local0) // Mask PED
+ Or(Local0, 0x00FE0000,PSC1) // Clear SS PSC1 Bit 23:17
+ }
+ If (And(Local4,0x2))
+ {
+ And(PSC2,Not(0x02),Local0) // Mask PED
+ Or(Local0,0x00FE0000,PSC2) // Clear SS PSC2 Bit 23:17
+ }
+ If (And(Local4,0x4))
+ {
+ And(PSC3,Not(0x02),Local0) // Mask PED
+ Or(Local0,0x00FE0000,PSC3) // Clear SS PSC3 Bit 23:17
+ }
+ If (And(Local4,0x8))
+ {
+ And(PSC4,Not(0x02),Local0) // Mask PED
+ Or(Local0,0x00FE0000,PSC4) // Clear SS PSC4 Bit 23:17
+ }
+ }
+
+ //
+ // Set MMIO Offset 0x80E0[15]
+ //
+ Store(1,AX15) //0x80E0 - BIT15, AUX Reset Control 1
+ }
+
+ //
+ // Clear PCI CFG offset 0x40[11] for both LPT-LP and LPT-H
+ //
+ Store(0,^SWAI)
+ //
+ // Clear PCI CFG offset 0x44[13:12] for both LPT-LP and LPT-H
+ //
+ Store(0,^SAIP)
+
+ //
+ // Call platform XHC PS0 method if present
+ //
+ If(CondRefOf(\_SB.PCI0.XHC.PS0X))
+ {
+ \_SB.PCI0.XHC.PS0X()
+ }
+
+ //
+ // Leave device in D0 to avoid spurious PME event upon D3 entry
+ //
+
+ //
+ // Restoring MBAR
+ //
+ And(^PDBM,Not(0x02),^PDBM) // Clear MSE
+ Store(Local2,^MEMB) // Restore MBAR
+ Store(Local1,^PDBM) // Restore CMD
+ }
+
+ //
+ // D3 Method for xHCI Host Controller
+ //
+ Method(_PS3,0,Serialized)
+ {
+ // Uses:
+ // Local0 - Temporary
+ // Local1 - Original command register
+ // Local2 - Original MBAR
+ // Local3 - D0D3 temporary
+ //
+ If(LEqual(^DVID,0xFFFF))
+ {
+ Return()
+ }
+ Store(1, ^PMES) //Clear PME status
+ Store(1, ^PMEE) //Enable PME
+
+
+ //
+ // MBAR Programming
+ //
+ Store(^MEMB,Local2) // Save MBAR
+ Store(^PDBM,Local1) // Save CMD
+ And(^PDBM,Not(0x06),^PDBM) // Clear MSE/BME
+ Store(\SRMB,^MEMB) // Set MBAR
+ Or(^PDBM,0x02,^PDBM) // Set MSE
+
+ OperationRegion(MCA1,SystemMemory,\SRMB,0x9000)
+ Field(MCA1,DWordAcc,Lock,Preserve)
+ {
+ Offset(0x80E0), // AUX Reset Control 1
+ , 15,
+ AX15, 1,
+ Offset(0x8154), // AUX Domain PM control register 2
+ , 31,
+ CLK2, 1, // BIT31
+ Offset(0x816C), // 40.2.3.6.6040.2.3.6.59 AUXCLKCTL
+ , 2,
+ CLK0, 1, // BIT2
+ , 11,
+ CLK1, 1, // BIT14 - USB3 Port Aux/Core clock gating enable
+ , 17,
+ }
+
+ //
+ // If device is in D3, set to back to D0
+ //
+ Store(^D0D3,Local3)
+ if(LEqual(Local3,3))
+ {
+ Store(0,^D0D3)
+ }
+
+ If(LEqual(PCHS, 2)) // LPT-LP
+ {
+ //
+ // Set PCI CFG offset 0xB0[14:13]
+ //
+ Store(1,^MB13)
+ Store(1,^MB14)
+ //
+ // Set MMIO Offset 0x816C[14]
+ // Set MMIO Offset 0x816C[2]
+ //
+ Store(1,CLK0)
+ Store(1,CLK1)
+ }
+
+ //
+ // Clear MMIO Offset 8154[31] for both LPT-LP and LPT-H
+ //
+ Store(0,CLK2)
+
+ If(LEqual(PCHS, 2)) // LPT-LP
+ {
+ //
+ // Clear MMIO Offset 0x80E0[15]
+ //
+ Store(0,AX15) //0x80E0 - BIT15
+ }
+
+ //
+ // Set PCI CFG offset 0x40[11] = '1' for both LPT-LP and LPT-H
+ //
+ Store(1,^SWAI)
+ //
+ // Set PCI CFG offset 0x44[13:12] = '01' for both LPT-LP and LPT-H
+ //
+ Store(1,^SAIP)
+
+ //
+ // Call platform XHC PS3 method if existed.
+ // in the PS3X, MBAR is ready, CMD is ready, and Device is in D0.
+ //
+ If(CondRefOf(\_SB.PCI0.XHC.PS3X))
+ {
+ \_SB.PCI0.XHC.PS3X()
+ }
+
+ //
+ // Restoring device back to D3
+ //
+ if(LEqual(Local3,3))
+ {
+ Store(3,^D0D3)
+ }
+ //
+ // Restoring MBAR
+ //
+ And(^PDBM,Not(0x02),^PDBM) // Clear MSE
+ Store(Local2,^MEMB) // Restore MBAR
+ Store(Local1,^PDBM) // Restore CMD
+ }
+
+ //
+ //
+ // Check for XHCI switch UUID
+ //
+ // Arguments:
+ // Arg0 (Buffer) : UUID
+ //
+ // Returns:
+ // 1: It's valid UUID
+ // 0: Invalid UUID
+ //
+ Method(CUID,1,Serialized) {
+ If(LEqual(Arg0,ToUUID("7c9512a9-1705-4cb4-af7d-506a2423ab71"))) {
+ Return(1)
+ }
+ Return(0)
+ }
+
+ //
+ // _OSC for xHCI
+ // This method enables XHCI controller if available.
+ //
+ // Arguments:
+ // Arg0 (Integer): Revision ID - should be set to 1
+ // Arg1 (Integer): Count
+ // Arg2 (Buffer) : Capabilities Buffer
+ // DWORD#1 (Status/Error):
+ // Bit 0 - Query Support Flag
+ // Bit 1 - Always clear(0)
+ // Bit 2 - Always clear(0)
+ // Bit 3 - Always clear(0)
+ // All others - reserved (return 0)
+ //
+ // DWORD#3 (Controlled):
+ // Bit 0 - If set OS request routing back to EHCI
+ // All others - reserved (return 0)
+ // Returns:
+ // Capabilities Buffer:
+ // DWORD#1 (Status):
+ // Bit 0 - Reserved (not used)
+ // Bit 1 - _OSC failure. Platform Firmware was unable to process the request or query.
+ // Capabilities bits may have been masked.
+ // Bit 2 - Unrecognized UUID. This bit is set to indicate that the platform firmware does not
+ // recognize the UUID passed in _OSC Arg0.
+ // Capabilities bits are preserved.
+ // Bit 3 - Unrecognized Revision. This bit is set to indicate that the platform firmware does not
+ // recognize the Revision ID passed in via Arg1.
+ // Capabilities bits beyond those comprehended by the firmware will be masked.
+ // Bit 4 - Capabilities Masked. This bit is set to indicate
+ // that capabilities bits set by driver software
+ // have been cleared by platform firmware.
+ // All others - reserved (return 0)
+ //
+ Method(POSC,3,Serialized) {
+ //
+ // Create DWord field from the Capabilities Buffer
+ //
+ CreateDWordField(Arg2,0,CDW1)
+ CreateDWordField(Arg2,8,CDW3)
+
+ //
+ // Set failure if xHCI is disabled by BIOS
+ //
+ If (LEqual(XHCI, 0)) {
+ Or(CDW1,0x2,CDW1)
+ }
+
+ //
+ // Query flag clear
+ //
+ If(LNot(And(CDW1,0x1))) {
+ If (And(CDW3,0x1)) {
+ //
+ // Perform switch back to EHCI
+ //
+ ESEL()
+ }
+ Else {
+ If (LEqual(And(CDID,0xF000), 0x8000)) { // if LPT-H chipset
+ If (LGreater(Arg0, 0x1)) {
+ //
+ // Perform switch to xHCI
+ //
+ XSEL()
+ } Else {
+ //
+ // Set failure if revision is not supported
+ //
+ Or(CDW1,0xA,CDW1)
+ }
+ } Else { // if LPT-LP chipset
+ If (LGreater(Arg0, 0x2)) {
+ //
+ // Perform switch to xHCI
+ //
+ XSEL()
+ } Else {
+ //
+ // Set failure if revision is not supported
+ //
+ Or(CDW1,0xA,CDW1)
+ }
+ }
+ }
+ }
+
+ Return(Arg2)
+ }
+
+ Method(XSEL, 0, Serialized)
+ {
+ //
+ // xHCI in auto or smart auto mode
+ //
+ If (LOr(LEqual(XHCI,2), LEqual(XHCI,3))) {
+ //
+ // Set B0:D31:F0 ACh[16] to indicate begin of Driver phase of USB port routing
+ //
+ Store(1, XUSB)
+ Store(1, XRST) // Backup XUSB, cause it might lost in iRST G3 or DeepSx
+ //
+ // Enable selected SS ports, route corresponding HS ports to xHCI
+ //
+ Store(0, Local0)
+ And(PR3, 0xFFFFFFC0, Local0)
+ Or(Local0, PR3M, PR3)
+ Store(0, Local0)
+ And(PR2, 0xFFFF8000, Local0)
+ Or(Local0, PR2M, PR2)
+ }
+ }
+
+ Method(ESEL, 0, Serialized)
+ {
+ //
+ // xHCI in auto or smart auto mode
+ //
+ If (LOr(LEqual(XHCI,2), LEqual(XHCI,3))) {
+ //
+ // Disable all SS ports, route all HS ports to EHCI
+ //
+ And(PR3, 0xFFFFFFC0, PR3)
+ And(PR2, 0xFFFF8000, PR2)
+
+ //
+ // Mark as not routed.
+ //
+ Store(0, XUSB)
+ Store(0, XRST)
+ }
+ }
+
+ Method(XWAK, 0, Serialized)
+ {
+ //
+ // Ports were routed to xHCI before sleep
+ //
+ If (LOr(LEqual(XUSB,1), LEqual(XRST,1))) {
+ //
+ // Restore back to xHCI
+ //
+ XSEL()
+ }
+ }
+
+ Method(_S3D, 0, NotSerialized)
+ {
+ Return(0x02)
+ }
+
+ Method(_S4D, 0, NotSerialized)
+ {
+ Return(0x02)
+ }
+
+ Device(RHUB)
+ {
+ Name(_ADR, Zero)
+
+ //
+ // High Speed Ports
+ //
+ Device(HS01)
+ {
+ Name(_ADR, 0x01)
+ Name(_STA, 0xF)
+ Method(_UPC,0,Serialized) {
+ Name(UPCP, Package() { ASL_HS01_UPC }) //AMI_OVERRITE, Set token for OEM easy to modify.
+
+ If(LNot(And(PR2S(1), PR2))) {
+ Store(0x00,Index(UPCP,0))
+ }
+
+ Return(UPCP)
+ }
+ Method(_PLD,0,Serialized) {
+ Name(PLDP, Package() {
+ Buffer(0x10){ ASL_HS01_PLD } //AMI_OVERRITE, Set token for OEM easy to modify.
+ })
+ CreateBitField(DeRefOf(Index(PLDP,0)),64,VIS)
+ If(LNot(And(PR2S(1), PR2))) {
+ And(VIS,0,VIS)
+ }
+ Return (PLDP)
+ }
+ }
+
+ Device(HS02)
+ {
+ Name(_ADR, 0x02)
+ Name(_STA, 0xF)
+ Method(_UPC,0,Serialized) {
+ Name(UPCP, Package() { ASL_HS02_UPC }) //AMI_OVERRITE, Set token for OEM easy to modify.
+ If(LNot(And(PR2S(2), PR2))) {
+ Store(0x00,Index(UPCP,0))
+ }
+ Return(UPCP)
+ }
+ Method(_PLD,0,Serialized) {
+ Name(PLDP, Package() {
+ Buffer(0x10){ ASL_HS02_PLD } //AMI_OVERRITE, Set token for OEM easy to modify.
+ })
+ CreateBitField(DeRefOf(Index(PLDP,0)),64,VIS)
+ If(LNot(And(PR2S(2), PR2))) {
+ And(VIS,0,VIS)
+ }
+
+ Return (PLDP)
+ }
+ }
+
+ Device(HS03)
+ {
+ Name(_ADR, 0x03)
+ Name(_STA, 0xF)
+ Method(_UPC,0,Serialized) {
+ Name(UPCP, Package() { ASL_HS03_UPC }) //AMI_OVERRITE, Set token for OEM easy to modify.
+ If(LNot(And(PR2S(3), PR2))) {
+ Store(0x00,Index(UPCP,0x00))
+ }
+ Return(UPCP)
+ }
+ Method(_PLD,0,Serialized) {
+ Name(PLDP, Package() {
+ Buffer(0x10) { ASL_HS03_PLD } //AMI_OVERRITE, Set token for OEM easy to modify.
+ })
+ CreateBitField(DeRefOf(Index(PLDP,0)),64,VIS)
+ If(LNot(And(PR2S(3), PR2))) {
+ And(VIS,0,VIS)
+ }
+#if defined ASL_HS03_INTERNAL && ASL_HS03_INTERNAL == 1 //AMI_OVERRITE
+ If(LEqual(And(CDID,0xF000), 0x9000)) { // on LPT-LP platforms this port is internal
+ And(VIS,0,VIS)
+ }
+#endif //AMI_OVERRITE
+ Return (PLDP)
+ }
+ }
+
+ Device(HS04)
+ {
+ Name(_ADR, 0x04)
+ Name(_STA, 0xF)
+ Method(_UPC,0,Serialized) {
+ Name(UPCP, Package() { ASL_HS04_UPC }) //AMI_OVERRITE, Set token for OEM easy to modify.
+ If(LNot(And(PR2S(4), PR2))) {
+ Store(0x00,Index(UPCP,0))
+ }
+ Return(UPCP)
+ }
+ Method(_PLD,0,Serialized) {
+ Name(PLDP, Package() {
+ Buffer(0x10){ ASL_HS04_PLD } //AMI_OVERRITE, Set token for OEM easy to modify.
+ })
+ CreateBitField(DeRefOf(Index(PLDP,0)),64,VIS)
+ If(LNot(And(PR2S(4), PR2))) {
+ And(VIS,0,VIS)
+ }
+ Return (PLDP)
+ }
+ }
+
+ Device(HS05)
+ {
+ Name(_ADR, 0x05)
+ Name(_STA, 0xF)
+ Method(_UPC,0,Serialized) {
+ Name(UPCP, Package() { ASL_HS05_UPC }) // Change Type from "USB 3 Standard-A connector" to "Type 'A' connector". //AMI_OVERRITE, Set token for OEM easy to modify.
+ If(LNot(And(PR2S(5), PR2))) {
+ Store(0x00,Index(UPCP,0))
+ }
+ Return(UPCP)
+ }
+ Method(_PLD,0,Serialized) {
+ Name(PLDP, Package() {
+ Buffer(0x10){ ASL_HS05_PLD } //AMI_OVERRITE, Set token for OEM easy to modify.
+ })
+ CreateBitField(DeRefOf(Index(PLDP,0)),64,VIS)
+ If(LNot(And(PR2S(5), PR2))) {
+ And(VIS,0,VIS)
+ }
+ Return (PLDP)
+ }
+ }
+
+ Device(HS06)
+ {
+ Name(_ADR, 0x06)
+ Name(_STA, 0xF)
+ Method(_UPC,0,Serialized) {
+ Name(UPCP, Package() { ASL_HS06_UPC }) // Change Type from "USB 3 Standard-A connector" to "Type 'A' connector". //AMI_OVERRITE, Set token for OEM easy to modify.
+ If(LNot(And(PR2S(6), PR2))) {
+ Store(0x00,Index(UPCP,0))
+ }
+ Return(UPCP)
+ }
+ Method(_PLD,0,Serialized) {
+ Name(PLDP, Package() {
+ Buffer(0x10){ ASL_HS06_PLD } //AMI_OVERRITE, Set token for OEM easy to modify.
+ })
+ CreateBitField(DeRefOf(Index(PLDP,0)),64,VIS)
+ If(LNot(And(PR2S(6), PR2))) {
+ And(VIS,0,VIS)
+ }
+ Return (PLDP)
+ }
+ }
+
+ Device(HS07)
+ {
+ Name(_ADR, 0x07)
+ Name(_STA, 0xF)
+ Method(_UPC,0,Serialized) {
+ Name(UPCP, Package() { ASL_HS07_UPC }) //AMI_OVERRITE, Set token for OEM easy to modify.
+ If(LNot(And(PR2S(7), PR2))) {
+ Store(0x00,Index(UPCP,0))
+ }
+ Return(UPCP)
+ }
+ Method(_PLD,0,Serialized) {
+ Name(PLDP, Package() {
+ Buffer(0x10){ ASL_HS07_PLD } //AMI_OVERRITE, Set token for OEM easy to modify.
+ })
+ CreateBitField(DeRefOf(Index(PLDP,0)),64,VIS)
+ If(LNot(And(PR2S(7), PR2))) {
+ And(VIS,0,VIS)
+ }
+ Return (PLDP)
+ }
+ }
+
+ Device(HS08)
+ {
+ Name(_ADR, 0x08)
+ Name(_STA, 0xF)
+ Method(_UPC,0,Serialized) {
+ Name(UPCP, Package() { ASL_HS08_UPC }) //AMI_OVERRITE, Set token for OEM easy to modify.
+ If(LNot(And(PR2S(8), PR2))) {
+ Store(0x00,Index(UPCP,0))
+ }
+ Return(UPCP)
+ }
+ Method(_PLD,0,Serialized) {
+ Name(PLDP, Package() {
+ Buffer(0x10){ ASL_HS08_PLD } //AMI_OVERRITE, Set token for OEM easy to modify.
+ })
+ CreateBitField(DeRefOf(Index(PLDP,0)),64,VIS)
+ If(LNot(And(PR2S(8), PR2))) {
+ And(VIS,0,VIS)
+ }
+ Return (PLDP)
+ }
+ }
+
+ Device(HS09)
+ {
+ Name(_ADR, 0x09)
+ Name(_STA, 0xF)
+ Method(_UPC,0,Serialized) {
+ Name(UPCP, Package() { ASL_HS09_UPC }) // HS09 is routed to a USB3 A Connector //AMI_OVERRITE, Set token for OEM easy to modify.
+ If(LNot(And(PR2S(9), PR2))) {
+ Store(0x00,Index(UPCP,0))
+ }
+ Return(UPCP)
+ }
+ Method(_PLD,0,Serialized) {
+ Name(PLDP, Package() {
+ Buffer(0x10){ ASL_HS09_PLD } //AMI_OVERRITE, Set token for OEM easy to modify.
+ })
+ CreateBitField(DeRefOf(Index(PLDP,0)),64,VIS)
+ If(LNot(And(PR2S(9), PR2))) {
+ And(VIS,0,VIS)
+ }
+ If(LEqual(And(CDID,0xF000), 0x9000)) {
+ And(VIS,0,VIS) // invisible because on LPT-LP HS09 is KVM's USBR port
+ }
+ Return (PLDP)
+ }
+ }
+
+ Device(HS10)
+ {
+ Method(_ADR, 0, Serialized) {
+ If(LEqual(And(CDID,0xF000), 0x8000)) { // check for LPT-H chipset
+ Return (0xA)
+ } Else {
+ Return (0xFA) // on LPT-LP, 0xA is assigned to SSP so move this port's address away
+ }
+ }
+ Method(_STA, 0, Serialized) {
+ If(LEqual(And(CDID,0xF000), 0x8000)) { // check for LPT-H chipset
+ Return (0xF)
+ } Else {
+ Return (0) // this port doesn't exist on LPT-LP
+ }
+ }
+ Method(_UPC,0,Serialized) {
+ Name(UPCP, Package() { ASL_HS10_UPC }) // HS10 is routed to a USB3 A Connector //AMI_OVERRITE, Set token for OEM easy to modify.
+ If(LNot(And(PR2S(10), PR2))) {
+ Store(0x00,Index(UPCP,0))
+ }
+ Return(UPCP)
+ }
+ Method(_PLD,0,Serialized) {
+ Name(PLDP, Package() {
+ Buffer(0x10){ ASL_HS10_PLD } //AMI_OVERRITE, Set token for OEM easy to modify.
+ })
+ CreateBitField(DeRefOf(Index(PLDP,0)),64,VIS)
+ If(LNot(And(PR2S(10), PR2))) {
+ And(VIS,0,VIS)
+ }
+ Return (PLDP)
+ }
+ }
+
+ Device(HS11)
+ {
+ Method(_ADR, 0, Serialized) {
+ If(LEqual(And(CDID,0xF000), 0x8000)) { // check for LPT-H chipset
+ Return (0xB)
+ } Else {
+ Return (0xFB) // on LPT-LP, 0xB is assigned to SSP so move this port's address away
+ }
+ }
+ Method(_STA, 0, Serialized) {
+ If(LEqual(And(CDID,0xF000), 0x8000)) { // check for LPT-H chipset
+ Return (0xF)
+ } Else {
+ Return (0) //this port doesn't exist on LPT-LP
+ }
+ }
+ Method(_UPC,0,Serialized) {
+ Name(UPCP, Package() { ASL_HS11_UPC }) // Proprietary connector (internal header) //AMI_OVERRITE, Set token for OEM easy to modify.
+ If(LNot(And(PR2S(11), PR2))) {
+ Store(0x00,Index(UPCP,0))
+ }
+ Return(UPCP)
+ }
+ Method(_PLD,0,Serialized) {
+ Name(PLDP, Package() {
+ Buffer(0x10){ ASL_HS11_PLD } //AMI_OVERRITE, Set token for OEM easy to modify.
+ })
+ CreateBitField(DeRefOf(Index(PLDP,0)),64,VIS)
+ If(LNot(And(PR2S(11), PR2))) {
+ And(VIS,0,VIS)
+ }
+ Return (PLDP)
+ }
+ }
+
+ Device(HS12)
+ {
+ Method(_ADR, 0, Serialized) {
+ If(LEqual(And(CDID,0xF000), 0x8000)) { // check for LPT-H chipset
+ Return (0xC)
+ } Else {
+ Return (0xFC) // on LPT-LP, 0xC is assigned to SSP so move this port's address away
+ }
+ }
+ Method(_STA, 0, Serialized) {
+ If(LEqual(And(CDID,0xF000), 0x8000)) { // check for LPT-H chipset
+ Return (0xF)
+ } Else {
+ Return (0) //this port doesn't exist on LPT-LP
+ }
+ }
+ Method(_UPC,0,Serialized) {
+ Name(UPCP, Package() { ASL_HS12_UPC }) // Proprietary connector (internal header) //AMI_OVERRITE, Set token for OEM easy to modify.
+ If(LNot(And(PR2S(12), PR2))) {
+ Store(0x00,Index(UPCP,0))
+ }
+ Return(UPCP)
+ }
+ Method(_PLD,0,Serialized) {
+ Name(PLDP, Package() {
+ Buffer(0x10){ ASL_HS12_PLD } //AMI_OVERRITE, Set token for OEM easy to modify.
+ })
+ CreateBitField(DeRefOf(Index(PLDP,0)),64,VIS)
+ If(LNot(And(PR2S(12), PR2))) {
+ And(VIS,0,VIS)
+ }
+ Return (PLDP)
+ }
+ }
+
+ Device(HS13)
+ {
+ Method(_ADR, 0, Serialized) {
+ If(LEqual(And(CDID,0xF000), 0x8000)) { // check for LPT-H chipset
+ Return (0xD)
+ } Else {
+ Return (0xFD) // on LPT-LP, 0xD is assigned to SSP so move this port's address away
+ }
+ }
+ Method(_STA, 0, Serialized) {
+ If(LEqual(And(CDID,0xF000), 0x8000)) { // check for LPT-H chipset
+ Return (0xF)
+ } Else {
+ Return (0) //this port doesn't exist on LPT-LP
+ }
+ }
+ Method(_UPC,0,Serialized) {
+ Name(UPCP, Package() { ASL_HS13_UPC }) // Proprietary connector (internal header) //AMI_OVERRITE, Set token for OEM easy to modify.
+ If(LNot(And(PR2S(13), PR2))) {
+ Store(0x00,Index(UPCP,0))
+ }
+ Return(UPCP)
+ }
+ Method(_PLD,0,Serialized) {
+ Name(PLDP, Package() {
+ Buffer(0x10){ ASL_HS13_PLD } //AMI_OVERRITE, Set token for OEM easy to modify.
+ })
+ CreateBitField(DeRefOf(Index(PLDP,0)),64,VIS)
+ If(LNot(And(PR2S(13), PR2))) {
+ And(VIS,0,VIS)
+ }
+
+ Return (PLDP)
+ }
+
+ }
+
+ Device(HS14)
+ {
+ Name(_ADR, 0xE)
+ Method(_STA, 0, Serialized) {
+ If(LEqual(And(CDID,0xF000), 0x8000)) { // check for LPT-H chipset
+ Return (0xF)
+ } Else {
+ Return (0) //this port doesn't exist on LPT-LP
+ }
+ }
+ Method(_UPC,0,Serialized) {
+ Name(UPCP, Package() { ASL_HS14_UPC }) // Proprietary connector (internal header) //AMI_OVERRITE, Set token for OEM easy to modify.
+ If(LNot(And(PR2S(14), PR2))) {
+ Store(0x00,Index(UPCP,0))
+ }
+ Return(UPCP)
+ }
+ Method(_PLD,0,Serialized) {
+ Name(PLDP, Package() {
+ Buffer(0x10){ ASL_HS14_PLD } //AMI_OVERRITE, Set token for OEM easy to modify.
+ })
+ CreateBitField(DeRefOf(Index(PLDP,0)),64,VIS)
+ If(LNot(And(PR2S(14), PR2))) {
+ And(VIS,0,VIS)
+ }
+ Return (PLDP)
+ }
+ }
+
+ Device(HS15)
+ {
+ Name(_ADR, 0xF)
+ Method(_STA, 0, Serialized) {
+ If(LEqual(And(CDID,0xF000), 0x8000)) { // check for LPT-H chipset
+ Return (0xF)
+ } Else {
+ Return (0) //this port doesn't exist on LPT-LP
+ }
+ }
+ Method(_UPC,0,Serialized) {
+ Name(UPCP, Package() { ASL_HS15_UPC }) // Not connectable, USBR not enabled in H87 //AMI_OVERRITE, Set token for OEM easy to modify.
+ If(LNot(And(PR2S(15), PR2))) {
+ Store(0x00,Index(UPCP,0))
+ }
+ Return(UPCP)
+ }
+ Method(_PLD,0,Serialized) {
+ Name(PLDP, Package() {
+ Buffer(0x10){ ASL_HS15_PLD } //AMI_OVERRITE, Set token for OEM easy to modify.
+ })
+ CreateBitField(DeRefOf(Index(PLDP,0)),64,VIS)
+ If(LNot(And(PR2S(15), PR2))) {
+ And(VIS,0,VIS)
+ }
+ Return (PLDP)
+ }
+ }
+
+ //
+ // Super Speed Ports - must match _UPC declarations of the coresponding Full Speed Ports.
+ //
+ Device(SSP1)
+ {
+ Method(_ADR, 0, Serialized) {
+ If(LEqual(And(CDID,0xF000), 0x8000)) { // check for LPT-H chipset
+ Return (0x10)
+ } Else {
+ Return (0xA)
+ }
+ }
+ Name(_STA, 0xF)
+ Method(_UPC,0,Serialized) {
+ Name(UPCP, Package() { ASL_SSP1_UPC }) //AMI_OVERRITE, Set token for OEM easy to modify.
+ If(LNot(And(PR3, ASL_SSP1_PR3))) { //AMI_OVERRITE, Set token for OEM easy to modify.
+ Store(0x00,Index(UPCP,0))
+ }
+ Return(UPCP)
+ }
+ Method(_PLD,0,Serialized) {
+ Name(PLDP, Package() {
+ Buffer(0x10){ ASL_SSP1_PLD } //AMI_OVERRITE, Set token for OEM easy to modify.
+ })
+ CreateBitField(DeRefOf(Index(PLDP,0)),64,VIS)
+ If(LNot(And(PR3, ASL_SSP1_PR3))) { //AMI_OVERRITE, Set token for OEM easy to modify.
+ And(VIS,0,VIS)
+ }
+ Return (PLDP)
+ }
+ }
+
+ Device(SSP2)
+ {
+ Method(_ADR, 0, Serialized) {
+ If(LEqual(And(CDID,0xF000), 0x8000)) { // check for LPT-H chipset
+ Return (0x11)
+ } Else {
+ Return (0xB)
+ }
+ }
+ Name(_STA, 0xF)
+ Method(_UPC,0,Serialized) {
+ Name(UPCP, Package() { ASL_SSP2_UPC }) //AMI_OVERRITE, Set token for OEM easy to modify.
+ If(LNot(And(PR3, ASL_SSP2_PR3))) { //AMI_OVERRITE, Set token for OEM easy to modify.
+ Store(0x00,Index(UPCP,0))
+ }
+ Return(UPCP)
+ }
+ Method(_PLD,0,Serialized) {
+ Name(PLDP, Package() {
+ Buffer(0x10){ ASL_SSP2_PLD } //AMI_OVERRITE, Set token for OEM easy to modify.
+ })
+ CreateBitField(DeRefOf(Index(PLDP,0)),64,VIS)
+ If(LNot(And(PR3, ASL_SSP2_PR3))) { //AMI_OVERRITE, Set token for OEM easy to modify.
+ And(VIS,0,VIS)
+ }
+ Return (PLDP)
+ }
+ }
+
+ Device(SSP3)
+ {
+ Method(_ADR, 0, Serialized) {
+ If(LEqual(And(CDID,0xF000), 0x8000)) { // check for LPT-H chipset
+ Return (0x12)
+ } Else {
+ Return (0xC)
+ }
+ }
+ Name(_STA, 0xF)
+ Method(_UPC,0,Serialized) {
+ Name(UPCP, Package() { ASL_SSP3_UPC }) //AMI_OVERRITE, Set token for OEM easy to modify.
+ If(LNot(And(PR3, ASL_SSP3_PR3))) { //AMI_OVERRITE, Set token for OEM easy to modify.
+ Store(0x00,Index(UPCP,0))
+ }
+ Return(UPCP)
+ }
+ Method(_PLD,0,Serialized) {
+ Name(PLDP, Package() {
+ Buffer(0x10){ ASL_SSP3_PLD } //AMI_OVERRITE, Set token for OEM easy to modify.
+ })
+ CreateBitField(DeRefOf(Index(PLDP,0)),64,VIS)
+ If(LNot(And(PR3, ASL_SSP3_PR3))) { //AMI_OVERRITE, Set token for OEM easy to modify.
+ And(VIS,0,VIS)
+ }
+ Return (PLDP)
+ }
+ }
+
+ Device(SSP4)
+ {
+ Method(_ADR, 0, Serialized) {
+ If(LEqual(And(CDID,0xF000), 0x8000)) { // check for LPT-H chipset
+ Return (0x13)
+ } Else {
+ Return (0xD)
+ }
+ }
+ Name(_STA, 0xF)
+ Method(_UPC,0,Serialized) {
+ Name(UPCP, Package() { ASL_SSP4_UPC }) //AMI_OVERRITE, Set token for OEM easy to modify.
+ If(LNot(And(PR3, ASL_SSP4_PR3))) { //AMI_OVERRITE, Set token for OEM easy to modify.
+ Store(0x00,Index(UPCP,0))
+ }
+ Return(UPCP)
+ }
+ Method(_PLD,0,Serialized) {
+ Name(PLDP, Package() {
+ Buffer(0x10){ ASL_SSP4_PLD } //AMI_OVERRITE, Set token for OEM easy to modify.
+ })
+ CreateBitField(DeRefOf(Index(PLDP,0)),64,VIS)
+ If(LNot(And(PR3, ASL_SSP4_PR3))) { //AMI_OVERRITE, Set token for OEM easy to modify.
+ And(VIS,0,VIS)
+ }
+ Return (PLDP)
+ }
+ }
+
+ Device(SSP5)
+ {
+ Name(_ADR, 0x14)
+ Method(_STA, 0, Serialized) {
+ If(LEqual(And(CDID,0xF000), 0x8000)) { // check for LPT-H chipset
+ Return (0xF)
+ } Else {
+ Return (0) //this port doesn't exist on LPT-LP
+ }
+ }
+ Method(_UPC,0,Serialized) {
+ Name(UPCP, Package() { ASL_SSP5_UPC }) //AMI_OVERRITE, Set token for OEM easy to modify.
+ If(LNot(And(PR3, ASL_SSP5_PR3))) { //AMI_OVERRITE, Set token for OEM easy to modify.
+ Store(0x00,Index(UPCP,0))
+ }
+ Return(UPCP)
+ }
+ Method(_PLD,0,Serialized) {
+ Name(PLDP, Package() {
+ Buffer(0x10){ ASL_SSP5_PLD } //AMI_OVERRITE, Set token for OEM easy to modify.
+ })
+ CreateBitField(DeRefOf(Index(PLDP,0)),64,VIS)
+ If(LNot(And(PR3, ASL_SSP5_PR3))) { //AMI_OVERRITE, Set token for OEM easy to modify.
+ And(VIS,0,VIS)
+ }
+ Return (PLDP)
+ }
+ }
+
+ Device(SSP6)
+ {
+ Name(_ADR, 0x15)
+ Method(_STA, 0, Serialized) {
+ If(LEqual(And(CDID,0xF000), 0x8000)) { // check for LPT-H chipset
+ Return (0xF)
+ } Else {
+ Return (0) //this port doesn't exist on LPT-LP
+ }
+ }
+ Method(_UPC,0,Serialized) {
+ Name(UPCP, Package() { ASL_SSP6_UPC }) //AMI_OVERRITE, Set token for OEM easy to modify.
+ If(LNot(And(PR3, ASL_SSP6_PR3))) { //AMI_OVERRITE, Set token for OEM easy to modify.
+ Store(0x00,Index(UPCP,0))
+ }
+ Return(UPCP)
+ }
+ Method(_PLD,0,Serialized) {
+ Name(PLDP, Package() {
+ Buffer(0x10){ ASL_SSP6_PLD } //AMI_OVERRITE, Set token for OEM easy to modify.
+ })
+ CreateBitField(DeRefOf(Index(PLDP,0)),64,VIS)
+ If(LNot(And(PR3, ASL_SSP6_PR3))) { //AMI_OVERRITE, Set token for OEM easy to modify.
+ And(VIS,0,VIS)
+ }
+ Return (PLDP)
+ }
+ }
+ }
+
diff --git a/ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/UsbSbd.asl b/ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/UsbSbd.asl
new file mode 100644
index 0000000..12bcbbf
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/AcpiTables/Dsdt/UsbSbd.asl
@@ -0,0 +1,92 @@
+/************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Haswell *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* MPG-MSAE *;
+;* *;
+;* Copyright (c) 1999-2011 Intel Corporation. *;
+;* *;
+;* This program has been developed by Intel Corporation. *;
+;* Licensee has Intel's permission to incorporate this source code *;
+;* into their product, royalty free. This source code may NOT be *;
+;* redistributed to anyone without Intel's written permission. *;
+;* *;
+;* Intel specifically disclaims all warranties, express or *;
+;* implied, and all liability, including consequential and other *;
+;* indirect damages, for the use of this code, including liability *;
+;* for infringement of any proprietary rights, and including the *;
+;* warranties of merchantability and fitness for a particular *;
+;* purpose. Intel does not assume any responsibility for any *;
+;* errors which may appear in this code nor any responsibility to *;
+;* update it. *;
+;* *;
+;* Version: See README.TXT *;
+;* *;
+;************************************************************************/
+/*++
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+//
+// _DSM : Device Specific Method supporting USB Sideband Deferring function
+//
+// Arg0: UUID Unique function identifier
+// Arg1: Integer Revision Level
+// Arg2: Integer Function Index
+// Arg3: Package Parameters
+//
+Method (_DSM, 4, Serialized, 0, UnknownObj, {BuffObj, IntObj, IntObj, PkgObj})
+{
+
+ If (LEqual(Arg0, ToUUID ("A5FC708F-8775-4BA6-BD0C-BA90A1EC72F8")))
+ {
+ //
+ // Switch by function index
+ //
+ Switch (ToInteger(Arg2))
+ {
+ //
+ // Standard query - A bitmask of functions supported
+ // Supports function 0-2
+ //
+ Case (0)
+ {
+ if (LEqual(Arg1, 1)){ // test Arg1 for the revision
+ Return (Buffer () {0x07})
+ } else {
+ Return (Buffer () {0})
+ }
+ }
+ //
+ // USB Sideband Deferring Support
+ // 0: USB Sideband Deferring not supported on this device
+ // 1: USB Sideband Deferring supported
+ //
+ Case (1)
+ {
+ if (LEqual(SDGV,0xFF)){ // check for valid GPE vector
+ Return (0)
+ } else {
+ Return (1)
+ }
+ }
+ //
+ // GPE Vector
+ // Return the bit offset within the GPE block of the GPIO (HOST_ALERT) driven by this device
+ //
+ Case (2)
+ {
+ Return (SDGV)
+ }
+ }
+ }
+
+ Return (0)
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/ActiveBios/Dxe/ActiveBios.c b/ReferenceCode/Chipset/LynxPoint/ActiveBios/Dxe/ActiveBios.c
new file mode 100644
index 0000000..700d6b4
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/ActiveBios/Dxe/ActiveBios.c
@@ -0,0 +1,292 @@
+/** @file
+ Source file for the ActiveBios ActiveBios protocol implementation
+
+@copyright
+ Copyright (c) 2005 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "ActiveBios.h"
+
+//
+// Prototypes for our ActiveBios protocol functions
+//
+static
+EFI_STATUS
+EFIAPI
+SetState (
+ IN EFI_ACTIVE_BIOS_PROTOCOL *This,
+ IN EFI_ACTIVE_BIOS_STATE DesiredState,
+ IN UINTN Key
+ );
+
+static
+EFI_STATUS
+EFIAPI
+LockState (
+ IN EFI_ACTIVE_BIOS_PROTOCOL *This,
+ IN BOOLEAN Lock,
+ IN OUT UINTN *Key
+ );
+
+//
+// Function implementations
+//
+
+/**
+ Change the current active BIOS settings to the requested state.
+ The caller is responsible for requesting a supported state from
+ the EFI_ACTIVE_BIOS_STATE selections.
+ This will fail if someone has locked the interface and the correct key is
+ not provided.
+
+ @param[in] This Pointer to the EFI_ACTIVE_BIOS_PROTOCOL instance.
+ @param[in] DesiredState The requested state to configure the system for.
+ @param[in] Key If the interface is locked, Key must be the Key
+ returned from the LockState function call.
+
+ @retval EFI_SUCCESS The function completed successfully
+ @retval EFI_ACCESS_DENIED The interface is currently locked.
+**/
+static
+EFI_STATUS
+EFIAPI
+SetState (
+ IN EFI_ACTIVE_BIOS_PROTOCOL *This,
+ IN EFI_ACTIVE_BIOS_STATE DesiredState,
+ IN UINTN Key
+ )
+{
+ PCH_SERIES PchSeries;
+ PchSeries = GetPchSeries();
+ ///
+ /// Verify requested state is allowed
+ ///
+ ASSERT (DesiredState < ActiveBiosStateMax);
+
+ ///
+ /// Check if the interface is locked by another
+ ///
+ if (mPrivateData.Locked && Key != mPrivateData.CurrentKey) {
+ return EFI_ACCESS_DENIED;
+ }
+
+ if ((MmioRead32 (mPchRootComplexBar + R_PCH_RCRB_GCS) & B_PCH_RCRB_GCS_BILD) == B_PCH_RCRB_GCS_BILD) {
+ return EFI_ACCESS_DENIED;
+ }
+ ///
+ /// Set the requested state
+ ///
+ switch (DesiredState) {
+
+ case ActiveBiosStateSpi:
+ if (PchSeries == PchH) {
+ MmioAndThenOr16 (
+ (UINTN) (mPchRootComplexBar + R_PCH_RCRB_GCS),
+ (UINT16) (~B_PCH_H_RCRB_GCS_BBS),
+ (UINT16) (V_PCH_H_RCRB_GCS_BBS_SPI)
+ );
+ }
+ if (PchSeries == PchLp) {
+ MmioAndThenOr16 (
+ (UINTN) (mPchRootComplexBar + R_PCH_RCRB_GCS),
+ (UINT16) (~B_PCH_LP_RCRB_GCS_BBS),
+ (UINT16) (V_PCH_LP_RCRB_GCS_BBS_SPI)
+ );
+ }
+ break;
+
+ case ActiveBiosStateLpc:
+ if (PchSeries == PchH) {
+ MmioAndThenOr16 (
+ (UINTN) (mPchRootComplexBar + R_PCH_RCRB_GCS),
+ (UINT16) (~B_PCH_H_RCRB_GCS_BBS),
+ (UINT16) (V_PCH_H_RCRB_GCS_BBS_LPC)
+ );
+ }
+ if (PchSeries == PchLp) {
+ MmioAndThenOr16 (
+ (UINTN) (mPchRootComplexBar + R_PCH_RCRB_GCS),
+ (UINT16) (~B_PCH_LP_RCRB_GCS_BBS),
+ (UINT16) (V_PCH_LP_RCRB_GCS_BBS_LPC)
+ );
+ }
+ break;
+
+ default:
+ ///
+ /// This is an invalid use of the protocol
+ /// See definition, but caller must call with valid value
+ ///
+ ASSERT (!EFI_UNSUPPORTED);
+ break;
+ }
+ ///
+ /// Read state back
+ /// This ensures the chipset MMIO was flushed and updates the protocol state
+ ///
+ MmioRead16 (mPchRootComplexBar + R_PCH_RCRB_GCS);
+
+ ///
+ /// Record current state
+ ///
+ mPrivateData.ActiveBiosProtocol.State = DesiredState;
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Lock or unlock the current active BIOS state.
+ Key is a simple incrementing number.
+
+ @param[in] This Pointer to the EFI_ACTIVE_BIOS_PROTOCOL instance.
+ @param[in] Lock TRUE to lock the current state, FALSE to unlock.
+ @param[in, out] Key If Lock is TRUE, then a key will be returned. If
+ Lock is FALSE, the key returned from the prior call
+ to lock the protocol must be provided to unlock the
+ protocol. The value of Key is undefined except that
+ it cannot be 0.
+
+ @retval EFI_SUCCESS Command succeed.
+ @exception EFI_UNSUPPORTED The function is not supported.
+ @retval EFI_ACCESS_DENIED The interface is currently locked.
+**/
+static
+EFI_STATUS
+EFIAPI
+LockState (
+ IN EFI_ACTIVE_BIOS_PROTOCOL *This,
+ IN BOOLEAN Lock,
+ IN OUT UINTN *Key
+ )
+{
+ ///
+ /// Check if lock or unlock requesed
+ ///
+ if (Lock) {
+ ///
+ /// Check if already locked
+ ///
+ if (mPrivateData.Locked) {
+ return EFI_ACCESS_DENIED;
+ }
+ ///
+ /// Lock the interface
+ ///
+ mPrivateData.Locked = TRUE;
+
+ ///
+ /// Increment the key
+ ///
+ mPrivateData.CurrentKey++;
+
+ ///
+ /// Update the caller's copy
+ ///
+ *Key = mPrivateData.CurrentKey;
+ } else {
+ ///
+ /// Verify caller "owns" the current lock
+ ///
+ if (*Key == mPrivateData.CurrentKey) {
+ mPrivateData.Locked = FALSE;
+ } else {
+ return EFI_ACCESS_DENIED;
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Initialization function for the ActiveBios protocol implementation.
+
+ @param[in] This Pointer to the protocol
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+ActiveBiosProtocolConstructor (
+ IN EFI_ACTIVE_BIOS_PROTOCOL *This
+ )
+{
+ EFI_STATUS Status;
+ EFI_HANDLE Handle;
+ EFI_GUID EfiActiveBiosProtocolGuid = EFI_ACTIVE_BIOS_PROTOCOL_GUID;
+ PCH_SERIES PchSeries;
+ PchSeries = GetPchSeries();
+
+ ///
+ /// Read current state from the PCH
+ ///
+ if (PchSeries == PchH) {
+ switch (MmioRead16 (mPchRootComplexBar + R_PCH_RCRB_GCS) & B_PCH_H_RCRB_GCS_BBS) {
+
+ case V_PCH_H_RCRB_GCS_BBS_SPI:
+ mPrivateData.ActiveBiosProtocol.State = ActiveBiosStateSpi;
+ break;
+
+ case V_PCH_H_RCRB_GCS_BBS_LPC:
+ mPrivateData.ActiveBiosProtocol.State = ActiveBiosStateLpc;
+ break;
+
+ default:
+ ///
+ /// This is an invalid use of the protocol
+ /// See definition, but caller must call with valid value
+ ///
+ ASSERT (!EFI_UNSUPPORTED);
+ break;
+ }
+ }
+
+ if (PchSeries == PchLp) {
+ switch (MmioRead16 (mPchRootComplexBar + R_PCH_RCRB_GCS) & B_PCH_LP_RCRB_GCS_BBS) {
+
+ case V_PCH_LP_RCRB_GCS_BBS_SPI:
+ mPrivateData.ActiveBiosProtocol.State = ActiveBiosStateSpi;
+ break;
+
+ case V_PCH_LP_RCRB_GCS_BBS_LPC:
+ mPrivateData.ActiveBiosProtocol.State = ActiveBiosStateLpc;
+ break;
+
+ default:
+ ///
+ /// This is an invalid use of the protocol
+ /// See definition, but caller must call with valid value
+ ///
+ ASSERT (!EFI_UNSUPPORTED);
+ break;
+ }
+ }
+ mPrivateData.ActiveBiosProtocol.SetState = SetState;
+ mPrivateData.ActiveBiosProtocol.LockState = LockState;
+ mPrivateData.CurrentKey = 1;
+ mPrivateData.Locked = FALSE;
+
+ ///
+ /// Install the protocol
+ ///
+ Handle = NULL;
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &Handle,
+ &EfiActiveBiosProtocolGuid,
+ &mPrivateData.ActiveBiosProtocol,
+ NULL
+ );
+ return Status;
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/ActiveBios/Dxe/ActiveBios.cif b/ReferenceCode/Chipset/LynxPoint/ActiveBios/Dxe/ActiveBios.cif
new file mode 100644
index 0000000..92ebf07
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/ActiveBios/Dxe/ActiveBios.cif
@@ -0,0 +1,14 @@
+<component>
+ name = "ActiveBios"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\ActiveBios\Dxe"
+ RefName = "ActiveBios"
+[files]
+"ActiveBios.sdl"
+"ActiveBios.mak"
+"ActiveBiosMain.c"
+"ActiveBios.c"
+"ActiveBios.h"
+"ActiveBiosDepex.dxs"
+"ActiveBios.inf"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/ActiveBios/Dxe/ActiveBios.h b/ReferenceCode/Chipset/LynxPoint/ActiveBios/Dxe/ActiveBios.h
new file mode 100644
index 0000000..49efbff
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/ActiveBios/Dxe/ActiveBios.h
@@ -0,0 +1,104 @@
+/** @file
+ Defines and prototypes for the ActiveBios driver.
+ This driver implements the ActiveBios protocol for the PCH.
+ It provides a simple implementation that allows for basic control
+ of the PCH flash mapping state.
+
+@copyright
+ Copyright (c) 2005 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _ACTIVE_BIOS_H_
+#define _ACTIVE_BIOS_H_
+
+//
+// Include files
+//
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+
+#include "EdkIIGlueDxe.h"
+
+#include EFI_PROTOCOL_PRODUCER (ActiveBios)
+#include "PchAccess.h"
+#include "PchPlatformLib.h"
+#endif
+//
+// Active BIOS private data
+//
+#define ACTIVE_BIOS_SIGNATURE EFI_SIGNATURE_32 ('D', 'P', 'B', 'A')
+
+typedef struct {
+ UINT32 Signature;
+ EFI_HANDLE Handle;
+ EFI_ACTIVE_BIOS_PROTOCOL ActiveBiosProtocol;
+ UINTN CurrentKey;
+ BOOLEAN Locked;
+} ACTIVE_BIOS_INSTANCE;
+
+#define ACTIVE_BIOS_INSTANCE_FROM_ACTIVE_BIOS_THIS(a) \
+ CR ( \
+ a, \
+ ACTIVE_BIOS_INSTANCE, \
+ ActiveBiosProtocol, \
+ ACTIVE_BIOS_SIGNATURE \
+ )
+
+//
+// Driver global data
+//
+extern ACTIVE_BIOS_INSTANCE mPrivateData;
+extern UINT32 mPchRootComplexBar;
+
+//
+// Protocol constructor
+//
+
+/**
+ Initialization function for the ActiveBios protocol implementation.
+
+ @param[in] This Pointer to the protocol
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+ActiveBiosProtocolConstructor (
+ IN EFI_ACTIVE_BIOS_PROTOCOL *This
+ );
+
+//
+// Driver entry point
+//
+
+/**
+ ActiveBios driver entry point function.
+
+ @param[in] ImageHandle Image handle for this driver image
+ @param[in] SystemTable Pointer to the EFI System Table
+
+ @retval EFI_SUCCESS Application completed successfully
+ @exception EFI_UNSUPPORTED Unsupported chipset detected
+**/
+EFI_STATUS
+InstallActiveBios (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ );
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/ActiveBios/Dxe/ActiveBios.inf b/ReferenceCode/Chipset/LynxPoint/ActiveBios/Dxe/ActiveBios.inf
new file mode 100644
index 0000000..c8cc9f7
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/ActiveBios/Dxe/ActiveBios.inf
@@ -0,0 +1,77 @@
+## @file
+# Component description file for the ActiveBios BS_DRIVER
+#
+#@copyright
+# Copyright (c) 2005 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[Defines]
+BASE_NAME = ActiveBios
+FILE_GUID = BFD59D42-FE0F-4251-B772-4B098A1AEC85
+COMPONENT_TYPE = BS_DRIVER
+
+[Sources.Common]
+ ActiveBios.c
+ ActiveBiosMain.c
+ ActiveBios.h
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueDxeDriverEntryPoint.c
+
+[Libraries.Common]
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueDxeReportStatusCodeLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueBasePciLibPciExpress
+ EdkProtocolLib
+ $(PROJECT_PCH_FAMILY)ProtocolLib
+ PchPlatformLib
+
+[Includes.Common]
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[Nmake.Common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = ActiveBiosDepex.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=InstallActiveBios
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__
diff --git a/ReferenceCode/Chipset/LynxPoint/ActiveBios/Dxe/ActiveBios.mak b/ReferenceCode/Chipset/LynxPoint/ActiveBios/Dxe/ActiveBios.mak
new file mode 100644
index 0000000..9bc4a73
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/ActiveBios/Dxe/ActiveBios.mak
@@ -0,0 +1,96 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/ActiveBios/ActiveBios.mak 2 2/24/12 2:09a Victortu $
+#
+# $Revision: 2 $
+#
+# $Date: 2/24/12 2:09a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/ActiveBios/ActiveBios.mak $
+#
+# 2 2/24/12 2:09a Victortu
+# Updated to support 4.6.5.3_IntelEDK_1117_Patch7_00.
+#
+# 1 2/08/12 8:40a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+#---------------------------------------------------------------------------
+# CreateActiveBios Driver
+#---------------------------------------------------------------------------
+EDK : ActiveBios
+ActiveBios : $(BUILD_DIR)\ActiveBios.mak ActiveBiosBin
+
+
+$(BUILD_DIR)\ActiveBios.mak : $(ActiveBios_DIR)\$(@B).cif $(ActiveBios_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(ActiveBios_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+ActiveBios_INCLUDES=\
+ $(INTEL_PCH_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+
+ActiveBios_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=InstallActiveBios"\
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+ /D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+
+ActiveBios_LIB_LINKS =\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(EDKPROTOCOLLIB)\
+ $(INTEL_PCH_PROTOCOL_LIB)\
+ $(PchPlatformDxeLib_LIB)\
+ $(EdkIIGlueUefiRuntimeServicesTableLib_LIB)\
+
+ActiveBiosBin: $(ActiveBios_LIB_LINKS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\ActiveBios.mak all \
+ "MY_INCLUDES=$(ActiveBios_INCLUDES)" \
+ "MY_DEFINES=$(ActiveBios_DEFINES)" \
+ GUID=BFD59D42-FE0F-4251-B772-4B098A1AEC85\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=BS_DRIVER \
+ EDKIIModule=DXEDRIVER\
+ DEPEX1=$(ActiveBios_DIR)\ActiveBiosDepex.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \
+ COMPRESS=1
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/ActiveBios/Dxe/ActiveBios.sdl b/ReferenceCode/Chipset/LynxPoint/ActiveBios/Dxe/ActiveBios.sdl
new file mode 100644
index 0000000..c53e064
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/ActiveBios/Dxe/ActiveBios.sdl
@@ -0,0 +1,67 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/ActiveBios/ActiveBios.sdl 1 2/08/12 8:40a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 8:40a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/ActiveBios/ActiveBios.sdl $
+#
+# 1 2/08/12 8:40a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+TOKEN
+ Name = "ActiveBios_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable ActiveBios support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+End
+
+MODULE
+ File = "ActiveBios.mak"
+ Help = "Includes ActiveBios to Project"
+End
+
+PATH
+ Name = "ActiveBios_DIR"
+ Help = "ActiveBios file source directory"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\ActiveBios.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/ActiveBios/Dxe/ActiveBiosDepex.dxs b/ReferenceCode/Chipset/LynxPoint/ActiveBios/Dxe/ActiveBiosDepex.dxs
new file mode 100644
index 0000000..d7180b7
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/ActiveBios/Dxe/ActiveBiosDepex.dxs
@@ -0,0 +1,39 @@
+/** @file
+ Dispatch dependency expression file for the ActiveBios driver.
+
+@copyright
+ Copyright (c) 2005 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "DxeDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+#endif
+
+DEPENDENCY_START
+ TRUE
+DEPENDENCY_END
+
diff --git a/ReferenceCode/Chipset/LynxPoint/ActiveBios/Dxe/ActiveBiosMain.c b/ReferenceCode/Chipset/LynxPoint/ActiveBios/Dxe/ActiveBiosMain.c
new file mode 100644
index 0000000..7fd6a45
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/ActiveBios/Dxe/ActiveBiosMain.c
@@ -0,0 +1,73 @@
+/** @file
+ Main implementation source file for the ActiveBios driver
+
+@copyright
+ Copyright (c) 2005 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "ActiveBios.h"
+
+//
+// Global data
+//
+ACTIVE_BIOS_INSTANCE mPrivateData;
+UINT32 mPchRootComplexBar;
+
+/**
+ ActiveBios driver entry point function.
+
+ @param[in] ImageHandle Image handle for this driver image
+ @param[in] SystemTable Pointer to the EFI System Table
+
+ @retval EFI_SUCCESS Application completed successfully
+ @exception EFI_UNSUPPORTED Unsupported chipset detected
+**/
+EFI_STATUS
+InstallActiveBios (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ EFI_HANDLE Handle;
+
+ Status = EFI_SUCCESS;
+ Handle = NULL;
+
+ if (!IsPchSupported ()) {
+ DEBUG ((EFI_D_ERROR, "Active BIOS Protocol not supported due to no proper PCH LPC found!\n"));
+ return EFI_UNSUPPORTED;
+ }
+ ///
+ /// PCH RCBA must be initialized prior to run this driver.
+ ///
+ mPchRootComplexBar = PCH_RCRB_BASE;
+ ASSERT (mPchRootComplexBar != 0);
+
+ ///
+ /// Initialize private data
+ ///
+ mPrivateData.Signature = ACTIVE_BIOS_SIGNATURE;
+ mPrivateData.Handle = ImageHandle;
+
+ ///
+ /// Initialize our ActiveBios protocol
+ ///
+ Status = ActiveBiosProtocolConstructor (&mPrivateData.ActiveBiosProtocol);
+ ASSERT_EFI_ERROR (Status);
+
+ return Status;
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/Guid/ChipsetInitHob/ChipsetInitHob.c b/ReferenceCode/Chipset/LynxPoint/Guid/ChipsetInitHob/ChipsetInitHob.c
new file mode 100644
index 0000000..40bc926
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Guid/ChipsetInitHob/ChipsetInitHob.c
@@ -0,0 +1,28 @@
+/** @file
+ The GUID definition for ChipsetInitHob
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+#include "Tiano.h"
+#include "ChipsetInitHob.h"
+
+EFI_GUID gChipsetInitHobGuid = CHIPSET_INIT_INFO_HOB_GUID;
+
+EFI_GUID_STRING(&gChipsetInitHobGuid, "ChipsetInit HOB", "GUID for ChipsetInit HOB");
+
diff --git a/ReferenceCode/Chipset/LynxPoint/Guid/ChipsetInitHob/ChipsetInitHob.h b/ReferenceCode/Chipset/LynxPoint/Guid/ChipsetInitHob/ChipsetInitHob.h
new file mode 100644
index 0000000..df9548c
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Guid/ChipsetInitHob/ChipsetInitHob.h
@@ -0,0 +1,62 @@
+/*++ @file
+ Contains data used to determine if BIOS/ME/PMC are in sync
+ with the required platform ChipsetInit settings.
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+
+#ifndef _CHIPSET_INIT_INFO_HOBS_H__
+#define _CHIPSET_INIT_INFO_HOBS_H__
+
+#define CHIPSET_INIT_INFO_HOB_GUID \
+ { \
+ 0xc1392859, 0x1f65, 0x446e,0xb3, 0xf5, 0x84, 0x35, 0xfc, 0xc7, 0xd1, 0xc4 \
+ }
+
+extern EFI_GUID gChipsetInitInfoHobGuid;
+
+#pragma pack(push, 1)
+
+#ifndef _PEI_HOB_H_
+#ifndef __HOB__H__
+#ifndef __PI_HOB_H__
+typedef struct _EFI_HOB_GENERIC_HEADER {
+ UINT16 HobType;
+ UINT16 HobLength;
+ UINT32 Reserved;
+} EFI_HOB_GENERIC_HEADER;
+
+typedef struct _EFI_HOB_GUID_TYPE {
+ EFI_HOB_GENERIC_HEADER Header;
+ EFI_GUID Name;
+ //
+ // Guid specific data goes here
+ //
+} EFI_HOB_GUID_TYPE;
+#endif
+#endif
+#endif
+
+typedef struct _CHIPSET_INIT_INFO_HOB {
+ EFI_HOB_GUID_TYPE Header;
+ UINT32 ChipsetInitTableLen; // Size of the ChipsetInit table in bytes
+ UINT8 ChipsetInitTableUpdReq;
+ UINT8 ChipsetInitTable[384];
+} CHIPSET_INIT_INFO_HOB;
+
+#pragma pack(pop)
+#endif
+
diff --git a/ReferenceCode/Chipset/LynxPoint/Guid/PchGuidLib.cif b/ReferenceCode/Chipset/LynxPoint/Guid/PchGuidLib.cif
new file mode 100644
index 0000000..c9678d7
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Guid/PchGuidLib.cif
@@ -0,0 +1,14 @@
+<component>
+ name = "PchGuidLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\Guid\"
+ RefName = "PchGuidLib"
+[files]
+"PchGuidLib.sdl"
+"PchGuidLib.mak"
+"PchGuidLib.inf"
+"ChipsetInitHob\ChipsetInitHob.c"
+"ChipsetInitHob\ChipsetInitHob.h"
+"S3SupportHob\S3SupportHob.c"
+"S3SupportHob\S3SupportHob.h"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/Guid/PchGuidLib.inf b/ReferenceCode/Chipset/LynxPoint/Guid/PchGuidLib.inf
new file mode 100644
index 0000000..fe31ee1
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Guid/PchGuidLib.inf
@@ -0,0 +1,48 @@
+## @file
+# Component description file for PchGuidLib
+#
+#@copyright
+# Copyright (c) 2012 - 2015 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = PchGuidLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ ChipsetInitHob/ChipsetInitHob.c
+ ChipsetInitHob/ChipsetInitHob.h
+ S3SupportHob/S3SupportHob.c
+ S3SupportHob/S3SupportHob.h
+
+[includes.common]
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[nmake.common]
+C_STD_INCLUDE=
diff --git a/ReferenceCode/Chipset/LynxPoint/Guid/PchGuidLib.mak b/ReferenceCode/Chipset/LynxPoint/Guid/PchGuidLib.mak
new file mode 100644
index 0000000..df5e8f8
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Guid/PchGuidLib.mak
@@ -0,0 +1,21 @@
+# MAK file for the ModulePart:PchGuidLib
+all : PchGuidLib
+
+$(PchGuidLib_LIB) : PchGuidLib
+
+PchGuidLib : $(BUILD_DIR)\PchGuidLib.mak PchGuidLibBin
+
+$(BUILD_DIR)\PchGuidLib.mak : $(PchGuidLib_DIR)\$(@B).cif $(PchGuidLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(PchGuidLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+PchGuidLibBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDK_DEFAULTS)\
+ /f $(BUILD_DIR)\PchGuidLib.mak all\
+ "MY_INCLUDES=$(EDK_INCLUDES) $(EdkIIGlueLib_INCLUDES)" \
+ TYPE=LIBRARY
+!IF "$(x64_BUILD)"=="1"
+ $(MAKE) /$(MAKEFLAGS) $(EDK_DEFAULTS) BUILD_DIR=$(BUILD_DIR)\IA32\
+ /f $(BUILD_DIR)\PchGuidLib.mak all\
+ "MY_INCLUDES=$(EDK_INCLUDES) $(EdkIIGlueLib_INCLUDES)" \
+ TYPE=PEI_LIBRARY
+!ENDIF
diff --git a/ReferenceCode/Chipset/LynxPoint/Guid/PchGuidLib.sdl b/ReferenceCode/Chipset/LynxPoint/Guid/PchGuidLib.sdl
new file mode 100644
index 0000000..f9a5886
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Guid/PchGuidLib.sdl
@@ -0,0 +1,43 @@
+TOKEN
+ Name = "PchGuidLib_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable PchGuidLib support in Project"
+End
+
+MODULE
+ Help = "Includes PchGuidLib.mak to Project"
+ File = "PchGuidLib.mak"
+End
+
+PATH
+ Name = "PchGuidLib_DIR"
+End
+
+ELINK
+ Name = "/I$(PchGuidLib_DIR)"
+ Parent = "INTEL_PCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(PchGuidLib_DIR)\ChipsetInitHob"
+ Parent = "INTEL_PCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(PchGuidLib_DIR)\S3SupportHob"
+ Parent = "INTEL_PCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+TOKEN
+ Name = "PchGuidLib_LIB"
+ Value = "$$(LIB_BUILD_DIR)\PchGuidLib.lib"
+ TokenType = Expression
+ TargetMAK = Yes
+End
diff --git a/ReferenceCode/Chipset/LynxPoint/Guid/S3SupportHob/S3SupportHob.c b/ReferenceCode/Chipset/LynxPoint/Guid/S3SupportHob/S3SupportHob.c
new file mode 100644
index 0000000..b722fb1
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Guid/S3SupportHob/S3SupportHob.c
@@ -0,0 +1,30 @@
+/** @file
+ The GUID definition for ChipsetInitHob
+
+@copyright
+ Copyright (c) 2015 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+#include <Tiano.h>
+#include "S3SupportHob.h"
+
+EFI_GUID gS3SupportHobGuid = S3_SUPPORT_HOB_GUID;
+EFI_GUID gS3DataHobGuid = S3_DATA_HOB_GUID;
+
+EFI_GUID_STRING(&gS3SupportHobGuid, "S3 Support HOB", "GUID for S3 Support HOB");
+EFI_GUID_STRING(&gS3DataHobGuid, "S3 Data HOB", "GUID for S3 Data HOB")
+
diff --git a/ReferenceCode/Chipset/LynxPoint/Guid/S3SupportHob/S3SupportHob.h b/ReferenceCode/Chipset/LynxPoint/Guid/S3SupportHob/S3SupportHob.h
new file mode 100644
index 0000000..8892e02
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Guid/S3SupportHob/S3SupportHob.h
@@ -0,0 +1,73 @@
+/*++ @file
+ Contains data used to determine if BIOS/ME/PMC are in sync
+ with the required platform ChipsetInit settings.
+
+@copyright
+ Copyright (c) 2015 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+#ifndef _S3_SUPPORT_HOBS_H__
+#define _S3_SUPPORT_HOBS_H__
+
+#define S3_SUPPORT_HOB_GUID \
+ { \
+ 0xd33ca878, 0xde8f, 0x47d0, 0x9e, 0x47, 0x4d, 0x81, 0xb1, 0xa0, 0x9e, 0x88 \
+ }
+
+#define S3_DATA_HOB_GUID \
+ { \
+ 0x806e1de3, 0xc6c1, 0x495c, 0x85, 0xf4, 0x1b, 0xda, 0xbf, 0x93, 0x0, 0x5d \
+ }
+
+extern EFI_GUID gS3SupportHobGuid;
+extern EFI_GUID gS3DataHobGuid;
+
+#pragma pack(push, 1)
+
+#ifndef _PEI_HOB_H_
+#ifndef __HOB__H__
+#ifndef __PI_HOB_H__
+typedef struct _EFI_HOB_GENERIC_HEADER {
+ UINT16 HobType;
+ UINT16 HobLength;
+ UINT32 Reserved;
+} EFI_HOB_GENERIC_HEADER;
+
+typedef struct _EFI_HOB_GUID_TYPE {
+ EFI_HOB_GENERIC_HEADER Header;
+ EFI_GUID Name;
+ //
+ // Guid specific data goes here
+ //
+} EFI_HOB_GUID_TYPE;
+#endif
+#endif
+#endif
+
+typedef struct _S3_SUPPORT_HOB {
+ EFI_HOB_GUID_TYPE Header;
+ UINT32 PchS3PeimEntryPoint; // Entry Point of the PCH S3 PEIM module
+} S3_SUPPORT_HOB;
+
+typedef struct _S3_DATA_HOB {
+ EFI_HOB_GUID_TYPE Header;
+ VOID *S3DispatchDataArray; // Pointer to the EFI_PCH_S3_DISPATCH_ARRAY to be passed to DXE
+} S3_DATA_HOB;
+
+#pragma pack(pop)
+#endif
+
diff --git a/ReferenceCode/Chipset/LynxPoint/Include/IntelPchDxe.dsc b/ReferenceCode/Chipset/LynxPoint/Include/IntelPchDxe.dsc
new file mode 100644
index 0000000..a7b1da9
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Include/IntelPchDxe.dsc
@@ -0,0 +1,58 @@
+## @file
+# Build description file for building the PCH DXE drivers
+#
+#@copyright
+# Copyright (c) 2008 - 2015 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+#
+# DXE drivers produce PCH protocols
+#
+$(PROJECT_PCH_ROOT)\ActiveBios\Dxe\ActiveBios.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_PCH_ROOT)\Spi\RuntimeDxe\PchSpiRuntime.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_PCH_ROOT)\Spi\Smm\PchSpiSmm.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_PCH_ROOT)\SerialGpio\Dxe\PchSerialGpio.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_PCH_ROOT)\SmartTimer\Dxe\SmartTimer.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_PCH_ROOT)\SmmControl\RuntimeDxe\SmmControl.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_PCH_ROOT)\Smbus\Dxe\PchSmbusDxe.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_PCH_ROOT)\Smbus\Smm\PchSmbusSmm.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_PCH_ROOT)\LegacyInterrupt\Dxe\LegacyInterrupt.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_PCH_ROOT)\Reset\RuntimeDxe\PchResetRuntime.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_PCH_ROOT)\Wdt\Dxe\WdtDxe.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+
+#
+# DXE drivers use PCH protocols to initialize PCH
+#
+$(PROJECT_PCH_ROOT)\PchInit\Dxe\PchInitDxe.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+
+#
+# SMM drivers
+#
+$(PROJECT_PCH_ROOT)\Pcie\Smm\PchPcieSmm.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_PCH_ROOT)\PchInit\Smm\PchLateInitSmm.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_PCH_ROOT)\IoTrap\Smm\IoTrap.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_PCH_ROOT)\PchSmiDispatcher\Smm\PchSmiDispatcher.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_PCH_ROOT)\S3Support\Smm\S3SupportSmm.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+
+
+#
+# EFI 1.1 drivers
+#
+$(PROJECT_PCH_ROOT)\SataController\Dxe\SataController.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+
+#
+# Sample drivers
+#
+$(PROJECT_PCH_ROOT)\SampleCode\BiosWriteProtect\Smm\PchBiosWriteProtect.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints \ No newline at end of file
diff --git a/ReferenceCode/Chipset/LynxPoint/Include/IntelPchDxeLib.dsc b/ReferenceCode/Chipset/LynxPoint/Include/IntelPchDxeLib.dsc
new file mode 100644
index 0000000..c2ed62d
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Include/IntelPchDxeLib.dsc
@@ -0,0 +1,30 @@
+## @file
+# Build description file for building the PCH DXE libraries
+#
+#@copyright
+# Copyright (c) 2008 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+#
+# PCH DXE Libraries
+#
+$(PROJECT_PCH_ROOT)\Protocol\IntelPchProtocolLib.inf
+$(PROJECT_PCH_ROOT)\Library\PchPlatformLib\PchPlatformLib.inf
+$(PROJECT_PCH_ROOT)\Library\DxeRuntimePciLibPciExpress\DxeRuntimePciLibPciExpress.inf
+$(PROJECT_PCH_ROOT)\Library\PchPciExpressHelpersLib\PchPciExpressHelpersLib.inf
+$(PROJECT_PCH_ROOT)\Library\PchSmbusLib\Dxe\PchSmbusLibDxe.inf
+$(PROJECT_PCH_ROOT)\Library\RcFviDxeLib\RcFviDxeLib.inf
+$(PROJECT_PCH_ROOT)\SampleCode\Library\AslUpdate\Dxe\PchAslUpdateLib.inf
+$(PROJECT_PCH_ROOT)\Guid\PchGuidLib.inf \ No newline at end of file
diff --git a/ReferenceCode/Chipset/LynxPoint/Include/IntelPchInclude.cif b/ReferenceCode/Chipset/LynxPoint/Include/IntelPchInclude.cif
new file mode 100644
index 0000000..783287c
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Include/IntelPchInclude.cif
@@ -0,0 +1,33 @@
+<component>
+ name = "IntelPchInclude"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\Include"
+ RefName = "IntelPchInclude"
+[files]
+"IntelPchInclude.sdl"
+"PchRegs.h"
+"PchAccess.h"
+"IntelPchDxe.dsc"
+"IntelPchPei.dsc"
+"IntelPchDxeLib.dsc"
+"IntelPchPeiLib.dsc"
+"Library\PchPlatformLib.h"
+"Library\DxeRuntimePciLibPciExpress.h"
+"Library\PchPciExpressHelpersLib.h"
+"Library\PchSmbusLibrary.h"
+"Library\RcFviDxeLib.h"
+"PchRegs\PchRegsHda.h"
+"PchRegs\PchRegsLan.h"
+"PchRegs\PchRegsLpc.h"
+"PchRegs\PchRegsPcie.h"
+"PchRegs\PchRegsRcrb.h"
+"PchRegs\PchRegsSata.h"
+"PchRegs\PchRegsSmbus.h"
+"PchRegs\PchRegsSpi.h"
+"PchRegs\PchRegsThermal.h"
+"PchRegs\PchRegsUsb.h"
+"IobpDefinitions.h"
+"PchRegs\PchRegsAdsp.h"
+"PchUsbConfig.h"
+"PchRegs\PchRegsSerialIo.h"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/Include/IntelPchInclude.sdl b/ReferenceCode/Chipset/LynxPoint/Include/IntelPchInclude.sdl
new file mode 100644
index 0000000..2ed28cd
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Include/IntelPchInclude.sdl
@@ -0,0 +1,56 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/IntelPchInclude/IntelPchInclude.sdl 1 2/08/12 8:41a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 8:41a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/IntelPchInclude/IntelPchInclude.sdl $
+#
+# 1 2/08/12 8:41a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+TOKEN
+ Name = "IntelPchInclude_SUPPORT"
+ Value = 1
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+ Help = "Main switch to enable IntelpchInclude support in Project"
+End
+
+PATH
+ Name = "INTEL_COUGAR_POINT_INCLUDE_DIR"
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Include/IntelPchPei.dsc b/ReferenceCode/Chipset/LynxPoint/Include/IntelPchPei.dsc
new file mode 100644
index 0000000..bfb05b7
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Include/IntelPchPei.dsc
@@ -0,0 +1,38 @@
+## @file
+# Build description file for building the PCH PEI modules
+#
+#@copyright
+# Copyright (c) 2008 - 2015 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+#
+# PEI module produce PCH PPI
+#
+$(PROJECT_PCH_ROOT)\PchInit\Pei\PchInitPeim.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_PCH_ROOT)\Smbus\Pei\PchSmbusArpDisabled.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_PCH_ROOT)\Spi\Pei\PchSpiPeim.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_PCH_ROOT)\Wdt\Pei\WdtPeim.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_PCH_ROOT)\Reset\Pei\PchResetPeim.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_PCH_ROOT)\SmmControl\Pei\SmmControl.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_PCH_ROOT)\S3Support\Pei\PchS3Peim.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+
+#
+# Recovery related modules
+#
+$(PROJECT_PCH_ROOT)\Usb\Pei\PchUsb.inf Package = CompressPEIM SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+
+#
+# Sample drivers
+#
diff --git a/ReferenceCode/Chipset/LynxPoint/Include/IntelPchPeiLib.dsc b/ReferenceCode/Chipset/LynxPoint/Include/IntelPchPeiLib.dsc
new file mode 100644
index 0000000..28bd22d
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Include/IntelPchPeiLib.dsc
@@ -0,0 +1,28 @@
+## @file
+# Build description file for building the PCH PEI Libraries
+#
+#@copyright
+# Copyright (c) 2008 - 2015 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+#
+# PCH PEI libraries
+#
+$(PROJECT_PCH_ROOT)\Ppi\IntelPchPpiLib.inf
+$(PROJECT_PCH_ROOT)\Library\PchPlatformLib\PchPlatformLib.inf
+$(PROJECT_PCH_ROOT)\Library\PchPciExpressHelpersLib\PchPciExpressHelpersLib.inf
+$(PROJECT_PCH_ROOT)\Library\PchSmbusLib\Pei\PchSmbusLibPei.inf
+$(PROJECT_PCH_ROOT)\Guid\PchGuidLib.inf
+$(PROJECT_PCH_ROOT)\SampleCode\Ppi\IntelPchSampleCodePpiLib.inf \ No newline at end of file
diff --git a/ReferenceCode/Chipset/LynxPoint/Include/IobpDefinitions.h b/ReferenceCode/Chipset/LynxPoint/Include/IobpDefinitions.h
new file mode 100644
index 0000000..6b070fd
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Include/IobpDefinitions.h
@@ -0,0 +1,51 @@
+/** @file
+ General IOBP data structure and register definitions.
+
+@copyright
+ Copyright (c) 2009 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _IOBP_DEFINITIONS_H_
+#define _IOBP_DEFINITIONS_H_
+
+#include "Library/PchPlatformLib.h"
+
+#define IOBP_ADDR(portid, type, lane, block, offset) \
+ ((UINT32) (((portid) << 24) + ((type) << 14) + ((lane) << 8) + (block << 6) + offset))
+
+#define IOBP_PLP_ADDR(portid, type, lane, offset) \
+ ((UINT32) (((portid) << 24) + ((type) << 14) + ((lane) << 8) + offset))
+
+#define PCH_SATA_RXEQ_ID(port, genspeed) \
+ ((UINT32) (((port) << 8) + genspeed))
+
+typedef struct _IOBP_MMIO_TABLE_STRUCT {
+ UINT32 Address;
+ UINT32 AndMask;
+ UINT32 OrMask;
+} IOBP_MMIO_TABLE_STRUCT;
+
+typedef struct IOBP_MMIO_ADDRESS_STRUCT {
+ UINT32 Address;
+} IOBP_MMIO_ADDRESS;
+
+typedef struct _IOBP_SATA_TRACE_TABLE {
+ UINT32 TraceId;
+ UINT32 Address;
+ UINT32 AndMask;
+} IOBP_SATA_RXEQ_TABLE;
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Include/Library/DxeRuntimePciLibPciExpress.h b/ReferenceCode/Chipset/LynxPoint/Include/Library/DxeRuntimePciLibPciExpress.h
new file mode 100644
index 0000000..e3c04df
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Include/Library/DxeRuntimePciLibPciExpress.h
@@ -0,0 +1,61 @@
+/** @file
+ Header file for the Dxe Runtime PCI Express library.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _DXE_RUNTIME_PCI_LIB_PCIEXPRESS_H_
+#define _DXE_RUNTIME_PCI_LIB_PCIEXPRESS_H_
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#endif
+
+#if defined(__EDKII_GLUE_BASE_PCI_LIB_CF8__) || defined(__EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__)
+#error "Should not use EdkIIGluePciLibCf8 or EdkIIGluePciLibPciExpress with DxeRuntimePciLibPciExpress.\n"
+#endif
+
+/**
+ Constructor for Pci library. Register VirtualAddressNotifyEvent() notify function
+ It will ASSERT() if that operation fails
+
+ @param[in] None
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+EFIAPI
+PciLibConstructor (
+ VOID
+ );
+
+/**
+ Register memory space
+ If StartAddress > 0x0FFFFFFF, then ASSERT().
+ If SmPciLibAddressMapIndex) > PCI_LIB_ADDRESS_MAP_MAX_ITEM, then ASSERT().
+
+ @param[in] Address Starting address of the memory space
+ @param[in] Length Length of the memory space
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+EFIAPI
+PciLibRegisterMemory (
+ IN UINTN Address,
+ IN UINTN Length
+ );
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Include/Library/PchPciExpressHelpersLib.h b/ReferenceCode/Chipset/LynxPoint/Include/Library/PchPciExpressHelpersLib.h
new file mode 100644
index 0000000..aa5efad
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Include/Library/PchPciExpressHelpersLib.h
@@ -0,0 +1,296 @@
+/** @file
+ Header file for PCH PCI Express helpers library
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+#ifndef _PCH_PCI_EXPRESS_HELPERS_LIB_H_
+#define _PCH_PCI_EXPRESS_HELPERS_LIB_H_
+
+//
+// Function prototypes
+//
+/**
+ Find the Offset to a given Capabilities ID
+ CAPID list:
+ 0x01 = PCI Power Management Interface
+ 0x04 = Slot Identification
+ 0x05 = MSI Capability
+ 0x10 = PCI Express Capability
+
+ @param[in] Bus Pci Bus Number
+ @param[in] Device Pci Device Number
+ @param[in] Function Pci Function Number
+ @param[in] CapId CAPID to search for
+
+ @retval 0 CAPID not found
+ @retval Other CAPID found, Offset of desired CAPID
+**/
+UINT8
+PcieFindCapId (
+ IN UINT8 Bus,
+ IN UINT8 Device,
+ IN UINT8 Function,
+ IN UINT8 CapId
+ );
+
+/**
+ Search and return the offset of desired Pci Express Capability ID
+ CAPID list:
+ 0x0001 = Advanced Error Rreporting Capability
+ 0x0002 = Virtual Channel Capability
+ 0x0003 = Device Serial Number Capability
+ 0x0004 = Power Budgeting Capability
+
+ @param[in] Bus Pci Bus Number
+ @param[in] Device Pci Device Number
+ @param[in] Function Pci Function Number
+ @param[in] CapId Extended CAPID to search for
+
+ @retval 0 CAPID not found
+ @retval Other CAPID found, Offset of desired CAPID
+**/
+UINT16
+PcieFindExtendedCapId (
+ IN UINT8 Bus,
+ IN UINT8 Device,
+ IN UINT8 Function,
+ IN UINT16 CapId
+ );
+
+/**
+ Map a TC to VC0 for port and endpoint
+
+ @param[in] Bus1 The bus number of the port
+ @param[in] Device1 The device number of the port
+ @param[in] Function1 The function number of the port
+ @param[in] Bus2 The bus number of the endpoint
+ @param[in] Device2 The device number of the endpoint
+ @param[in] TCx The TC number
+
+ @exception EFI_UNSUPPORTED Unsupported operation.
+ @retval EFI_SUCCESS Successfully completed.
+**/
+EFI_STATUS
+PcieMapTcxVc0 (
+ IN UINT8 Bus1,
+ IN UINT8 Device1,
+ IN UINT8 Function1,
+ IN UINT8 Bus2,
+ IN UINT8 Device2,
+ IN UINT8 TCx
+ );
+
+/**
+ Set Common clock to Root port and Endpoint PCI device
+
+ @param[in] Bus1 Root port Pci Bus Number
+ @param[in] Device1 Root port Pci Device Number
+ @param[in] Function1 Root port Pci Function Number
+ @param[in] Bus2 Endpoint Pci Bus Number
+ @param[in] Device2 Endpoint Pci Device Number
+
+ @exception EFI_UNSUPPORTED Unsupported operation.
+ @retval EFI_SUCCESS VC mapping correctly initialized
+**/
+EFI_STATUS
+PcieSetCommonClock (
+ IN UINT8 Bus1,
+ IN UINT8 Device1,
+ IN UINT8 Function1,
+ IN UINT8 Bus2,
+ IN UINT8 Device2
+ );
+
+/**
+ This function enables the CLKREQ# PM on all the end point functions
+
+ @param[in] Bus Pci Bus Number
+ @param[in] Device Pci Device Number
+ @param[in] RootFunction Rootport Function Number
+
+ @retval None
+**/
+VOID
+PcieSetClkreq (
+ IN UINT8 Bus,
+ IN UINT8 Device,
+ IN UINT8 RootFunction
+ );
+
+/**
+ This function get or set the Max Payload Size on all the end point functions
+
+ @param[in] EndPointBus The Bus Number of the Endpoint
+ @param[in] EndPointDevice The Device Number of the Endpoint
+ @param[in] MaxPayload The Max Payolad Size of the root port
+ @param[in] Operation True: Set the Max Payload Size on all the end point functions
+ False: Get the Max Payload Size on all the end point functions
+
+ @retval EFI_SUCCESS Successfully completed.
+**/
+EFI_STATUS
+PcieMaxPayloadSize (
+ IN UINT8 EndPointBus,
+ IN UINT8 EndPointDevice,
+ IN OUT UINT16 *MaxPayload,
+ IN BOOLEAN Operation
+ );
+
+/**
+ This function disable the forwarding of EOI messages unless it discovers
+ an IOAPIC behind this root port.
+
+ @param[in] RootBus The Bus Number of the root port
+ @param[in] RootDevice The Device Number of the root port
+ @param[in] RootFunction The Function Number of the root port
+ @param[in] EndPointBus The Bus Number of the Endpoint
+ @param[in] EndPointDevice The Device Number of the Endpoint
+
+ @exception EFI_UNSUPPORTED Unsupported operation.
+ @retval EFI_SUCCESS Successfully completed.
+**/
+EFI_STATUS
+PcieSetEoiFwdDisable (
+ IN UINT8 RootBus,
+ IN UINT8 RootDevice,
+ IN UINT8 RootFunction,
+ IN UINT8 EndPointBus,
+ IN UINT8 EndPointDevice
+ );
+
+/**
+ This function performs the Power Management settings for root port and downstream device
+
+ @param[in] RootBus Pci Bus Number of the root port
+ @param[in] RootDevice Pci Device Number of the root port
+ @param[in] RootFunction Pci Function Number of the root port
+ @param[in] RootPortAspm Root port Aspm configuration
+ @param[in] NumOfDevAspmOverride Number of Device specific ASPM policy override items
+ @param[in] DevAspmOverride Pointer to array of Device specific ASPM policy override items
+ @param[in] TempBusNumberMin Minimal temp bus number that can be assigned to the root port (as secondary
+ bus number) and its down stream switches
+ @param[in] TempBusNumberMax Maximal temp bus number that can be assigned to the root port (as subordinate
+ bus number) and its down stream switches
+ @param[in] NumOfDevltrOverride Number of Device specific LTR override items
+ @param[in] DevLtrOverride Pointer to array of Device specific LTR policy override items
+ @param[in] PchPwrOptPcie Pcie Power Optimizer Configuration
+ @param[in, out] L1SubstatesSupported L1 substates supported on the root port
+ @param[in] L1SubstatesConfig L1 substates configurations on the root port
+ @param[in] PolicyRevision Policy revision for codes compatibility
+ @param[in] FirstRpToSetPm Indicates if this is the first root port to be set
+ @param[in] L1SupportedInAllEnabledPorts Check if L1 is supported in all enabled ports
+ @param[in] ClkreqSupportedInAllEnabledPorts Check if clkreq is supported in all enabled ports
+ @param[out] LtrSupported Return to check if all endpoints support LTR
+
+ @retval EFI_SUCCESS The function completed successfully
+ @exception EFI_UNSUPPORTED The pointer to the Port PCI Express Capability Structure is not found
+**/
+EFI_STATUS
+PcieSetPm (
+ IN UINT8 RootBus,
+ IN UINT8 RootDevice,
+ IN UINT8 RootFunction,
+ IN PCH_PCI_EXPRESS_ASPM_CONTROL RootPortAspm,
+ IN UINT8 NumOfDevAspmOverride,
+ IN PCH_PCIE_DEVICE_ASPM_OVERRIDE *DevAspmOverride,
+ IN UINT8 TempBusNumberMin,
+ IN UINT8 TempBusNumberMax,
+ IN UINT8 NumOfDevltrOverride,
+ IN PCH_PCIE_DEVICE_LTR_OVERRIDE *DevLtrOverride,
+ IN PCH_PCIE_PWR_OPT *PchPwrOptPcie,
+ IN OUT BOOLEAN *L1SubstatesSupported,
+ IN PCH_PCIE_EXPRESS_L1SUBSTATES_CONTROL L1SubstatesConfig,
+ IN UINT8 PolicyRevision,
+ IN BOOLEAN FirstRPToSetPm,
+ IN BOOLEAN L1SupportedInAllEnabledPorts,
+ IN BOOLEAN ClkreqSupportedInAllEnabledPorts,
+ OUT BOOLEAN *LtrSupported
+ );
+
+/**
+ This function checks if the root port and downstream device support Clkreq per port, ASPM L1 and L1 substates
+
+ @param[in] RootBus Pci Bus Number of the root port
+ @param[in] RootDevice Pci Device Number of the root port
+ @param[in] RootFunction Pci Function Number of the root port
+ @param[in] RootPortAspm Root port Aspm configuration
+ @param[in] NumOfDevAspmOverride Number of Device specific ASPM policy override items
+ @param[in] DevAspmOverride Pointer to array of Device specific ASPM policy override items
+ @param[in] TempBusNumberMin Minimal temp bus number that can be assigned to the root port (as secondary
+ bus number) and its down stream switches
+ @param[in] TempBusNumberMax Maximal temp bus number that can be assigned to the root port (as subordinate
+ bus number) and its down stream switches
+ @param[in] NumOfDevLtrOverride Number of Device specific LTR override items
+ @param[in] DevLtrOverride Pointer to array of Device specific LTR policy override items
+ @param[in] PchPwrOptPcie Pcie Power Optimizer Configuration
+ @param[in, out] L1SubstatesSupported Flag to indicate if L1 Substates are supported
+ @param[in] L1SubstatesConfig L1 Substates configuration
+ @param[in] PolicyRevision Revision of the policy
+ @param[in, out] AspmVal Aspm value for both rootport and end point devices
+ @param[in, out] ClkreqPerPortSupported Clkreq support for both rootport and endpoint devices
+ @param[out] LtrSupported Return to check if all endpoints support LTR
+
+ @retval EFI_SUCCESS The function completed successfully
+ @exception EFI_UNSUPPORTED The pointer to the Port PCI Express Capability Structure is not found
+**/
+EFI_STATUS
+PcieCheckPmConfig (
+ IN UINT8 RootBus,
+ IN UINT8 RootDevice,
+ IN UINT8 RootFunction,
+ IN PCH_PCI_EXPRESS_ASPM_CONTROL RootPortAspm,
+ IN UINT8 NumOfDevAspmOverride,
+ IN PCH_PCIE_DEVICE_ASPM_OVERRIDE *DevAspmOverride,
+ IN UINT8 TempBusNumberMin,
+ IN UINT8 TempBusNumberMax,
+ IN UINT8 NumOfDevLtrOverride,
+ IN PCH_PCIE_DEVICE_LTR_OVERRIDE *DevLtrOverride,
+ IN PCH_PCIE_PWR_OPT *PchPwrOptPcie,
+ IN OUT BOOLEAN *L1SubstatesSupported,
+ IN PCH_PCIE_EXPRESS_L1SUBSTATES_CONTROL L1SubstatesConfig,
+ IN UINT8 PolicyRevision,
+ IN OUT UINT16 *AspmVal,
+ IN OUT BOOLEAN *ClkreqPerPortSupported,
+ OUT BOOLEAN *LtrSupported
+ );
+
+/**
+ Initializes the root port and its down stream devices
+
+ @param[in] RootPortBus Pci Bus Number of the root port
+ @param[in] RootPortDevice Pci Device Number of the root port
+ @param[in] RootPortFunc Pci Function Number of the root port
+ @param[in] TempBusNumberMin Minimal temp bus number that can be assigned to the root port (as secondary
+ bus number) and its down stream switches
+ @param[in] TempBusNumberMax Maximal temp bus number that can be assigned to the root port (as subordinate
+ bus number) and its down stream switches
+ @param[out] DeviceClassDword Get the downstream device code dword for unstream RootPort reference
+
+ @retval EFI_SUCCESS Successfully completed
+ @retval EFI_NOT_FOUND Can not find device.
+**/
+EFI_STATUS
+PchPcieInitRootPortDownstreamDevices (
+ IN UINT8 RootPortBus,
+ IN UINT8 RootPortDevice,
+ IN UINT8 RootPortFunc,
+ IN UINT8 TempBusNumberMin,
+ IN UINT8 TempBusNumberMax,
+ OUT UINT32 *DeviceClassDword
+ );
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Include/Library/PchPlatformLib.h b/ReferenceCode/Chipset/LynxPoint/Include/Library/PchPlatformLib.h
new file mode 100644
index 0000000..4ebc5d8
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Include/Library/PchPlatformLib.h
@@ -0,0 +1,385 @@
+/** @file
+ Header file for PchPlatform Lib.
+
+@copyright
+ Copyright (c) 2008 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _PCH_PLATFORM_LIB_H_
+#define _PCH_PLATFORM_LIB_H_
+
+///
+/// Timeout value used when Sending / Receiving messages.
+/// NOTE: this must cover the longest possible wait time
+/// between message being sent and response being available.
+/// e.g. Virtual function readiness might take some time.
+///
+
+/**
+ Delay for at least the request number of microseconds.
+ This function would be called by runtime driver, please do not use any MMIO marco here.
+
+ @param[in] Microseconds Number of microseconds to delay.
+
+ @retval NONE
+**/
+VOID
+EFIAPI
+PchPmTimerStall (
+ IN UINTN Microseconds
+ );
+
+/**
+ Check whether SPI is in descriptor mode
+
+ @param[in] PchRootComplexBar The PCH Root Complex Bar
+
+ @retval TRUE SPI is in descriptor mode
+ @retval FALSE SPI is not in descriptor mode
+**/
+BOOLEAN
+EFIAPI
+PchIsSpiDescriptorMode (
+ IN UINTN PchRootComplexBar
+ );
+
+/**
+ Return Pch stepping type
+
+ @param[in] None
+
+ @retval PCH_STEPPING Pch stepping type
+**/
+PCH_STEPPING
+EFIAPI
+PchStepping (
+ VOID
+ );
+
+/**
+ Determine if PCH is supported
+
+ @param[in] None
+
+ @retval TRUE PCH is supported
+ @retval FALSE PCH is not supported
+**/
+BOOLEAN
+IsPchSupported (
+ VOID
+ );
+
+/**
+ This function can be called to enable/disable Alternate Access Mode
+
+ @param[in] PchRootComplexBar The PCH Root Complex Bar
+ @param[in] AmeCtrl If TRUE, enable Alternate Access Mode.
+ If FALSE, disable Alternate Access Mode.
+
+ @retval NONE
+**/
+VOID
+EFIAPI
+PchAlternateAccessMode (
+ IN UINTN PchRootComplexBar,
+ IN BOOLEAN AmeCtrl
+ );
+
+/**
+ Configures PCH IOBP
+
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+ @param[in] Address Address of the IOBP register block
+ @param[in] AndMask Mask to AND with the register
+ @param[in] OrMask Mask to OR with the register
+
+ @retval EFI_SUCCESS Successfully completed.
+ @retval EFI_DEVICE_ERROR Transaction fail
+**/
+EFI_STATUS
+EFIAPI
+ProgramIobp (
+ IN UINT32 RootComplexBar,
+ IN UINT32 Address,
+ IN UINT32 AndMask,
+ IN UINT32 OrMask
+ );
+
+/**
+ Read data from PCH IOBP register block
+
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+ @param[in] Address Address of the IOBP register block
+ @param[in] Data Data contain in the IOBP register block
+
+ @retval EFI_SUCCESS Successfully completed.
+ @retval EFI_DEVICE_ERROR Transaction fail
+**/
+EFI_STATUS
+EFIAPI
+ReadIobp (
+ IN UINT32 RootComplexBar,
+ IN UINT32 Address,
+ OUT UINT32 *Data
+ );
+
+
+typedef enum {
+ MemoryMapRead = 0x0,
+ MemoryMapWrite = 0x1,
+ IoMapRead = 0x2,
+ IoMapWrite = 0x3,
+ PciConfigRead = 0x4,
+ PciConfigWrite = 0x5,
+ PrivateControlRead = 0x6,
+ PrivateControlWrite = 0x7
+} PCH_IOBP_OPCODE;
+
+/**
+ Configures PCH IOBP
+
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+ @param[in] Address Address of the IOBP register block
+ @param[in] Opcode Iobp Opcode
+ @param[in] RouteId Route Id
+ @param[in, out] Data32 Read/Write data
+ @param[out] Response Response
+
+ @retval EFI_SUCCESS Successfully completed.
+ @retval EFI_DEVICE_ERROR Transaction fail
+**/
+EFI_STATUS
+EFIAPI
+PchIobpExecution (
+ IN UINT32 RootComplexBar,
+ IN UINT32 Address,
+ IN PCH_IOBP_OPCODE Opcode,
+ IN UINT8 RouteId,
+ IN OUT UINT32 *Data32,
+ OUT UINT8 *Response
+ );
+
+/**
+ Check whether Gbe Region is valid in SPI Flash
+
+ @param[in] PchRootComplexBar The PCH Root Complex Bar
+
+ @retval TRUE Gbe Region is valid
+ @retval FALSE Gbe Region is invalid
+**/
+BOOLEAN
+EFIAPI
+PchIsGbeRegionValid (
+ IN UINTN PchRootComplexBar
+ );
+
+/**
+ Check if integrated Gbe controller present
+
+ @param[in] None
+
+ @retval TRUE Integrated Gbe present
+ @retval FALSE Integrated Gbe not present
+**/
+BOOLEAN
+EFIAPI
+PchIsIntegratedGbePresent (
+ IN VOID
+ );
+
+typedef enum {
+ PchH = 1,
+ PchLp,
+ PchUnknownSeries
+} PCH_SERIES;
+
+/**
+ Return Pch Series
+
+ @param[in] None
+
+ @retval PCH_SERIES Pch Series
+**/
+PCH_SERIES
+EFIAPI
+GetPchSeries (
+ VOID
+ );
+
+/**
+ Get Pch Maximum Pcie Root Port Number
+
+ @param[in] None
+
+ @retval PcieMaxRootPort Pch Maximum Pcie Root Port Number
+**/
+UINT8
+EFIAPI
+GetPchMaxPciePortNum (
+ VOID
+ );
+
+/**
+ Get Pch Maximum Sata Port Number
+
+ @param[in] None
+
+ @retval Pch Maximum Sata Port Number
+**/
+UINT8
+EFIAPI
+GetPchMaxSataPortNum (
+ VOID
+ );
+
+/**
+ Get Pch Maximum Sata Controller Number
+
+ @param[in] None
+
+ @retval Pch Maximum Sata Controller Number
+**/
+UINT8
+EFIAPI
+GetPchMaxSataControllerNum (
+ VOID
+ );
+
+/**
+ Get Pch Maximum Usb Port Number of EHCI Controller
+
+ @param[in] None
+
+ @retval Pch Maximum Usb Port Number of EHCI Controller
+**/
+UINT8
+EFIAPI
+GetPchEhciMaxUsbPortNum (
+ VOID
+ );
+
+/**
+ Get Pch Maximum EHCI Controller Number
+
+ @param[in] None
+
+ @retval Pch Maximum EHCI Controller Number
+**/
+UINT8
+EFIAPI
+GetPchEhciMaxControllerNum (
+ VOID
+ );
+
+/**
+ Get Pch Usb Maximum Physical Port Number
+
+ @param[in] None
+
+ @retval Pch Usb Maximum Physical Port Number
+**/
+UINT8
+EFIAPI
+GetPchUsbMaxPhysicalPortNum (
+ VOID
+ );
+
+/**
+ Get Pch Maximum Usb2 Port Number of XHCI Controller
+
+ @param[in] None
+
+ @retval Pch Maximum Usb2 Port Number of XHCI Controller
+**/
+UINT8
+EFIAPI
+GetPchXhciMaxUsb2PortNum (
+ VOID
+ );
+
+/**
+ Get Pch Maximum Usb3 Port Number of XHCI Controller
+
+ @param[in] None
+
+ @retval Pch Maximum Usb3 Port Number of XHCI Controller
+**/
+UINT8
+EFIAPI
+GetPchXhciMaxUsb3PortNum (
+ VOID
+ );
+
+typedef enum {
+ WarmBoot = 1,
+ ColdBoot,
+ PwrFlr,
+ PwrFlrSys,
+ PwrFlrPch,
+ PchPmStatusMax
+} PCH_PM_STATUS;
+
+/**
+ Query PCH to determine the Pm Status
+
+ @param[in] PmStatus - The Pch Pm Status to be probed
+
+ @retval Return TRUE if Status querried is Valid or FALSE if otherwise
+**/
+BOOLEAN
+GetPchPmStatus (
+ PCH_PM_STATUS PmStatus
+ )
+;
+
+/**
+ Get Pch Pcie Root Port Function Number by Root Port Number
+
+ @param[in] UINT8 Root Port Number (start from 0)
+
+ @retval Pch Pcie Root Port Function Number
+**/
+UINT8
+EFIAPI
+GetPchPcieRpfn (
+ IN UINTN PchRootComplexBar,
+ IN UINT8 RpNumber
+ );
+
+/**
+ Get Pch Pcie Root Port Number by Root Port Function Number
+
+ @param[in] UINT8 Root Port Function Number
+
+ @retval Pch Pcie Root Port Number
+ @retval 0xFF No Root Port Number found
+**/
+UINT8
+EFIAPI
+GetPchPcieRpNumber (
+ IN UINTN PchRootComplexBar,
+ IN UINT8 Rpfn
+ );
+
+/**
+ Returns GbE over PCIe port number.
+
+ @return Root port number (0-based)
+ @retval GbE over PCIe disabled
+**/
+UINTN
+PchGetGbePortNumber (
+ VOID
+ );
+#endif \ No newline at end of file
diff --git a/ReferenceCode/Chipset/LynxPoint/Include/Library/PchSmbusLibrary.h b/ReferenceCode/Chipset/LynxPoint/Include/Library/PchSmbusLibrary.h
new file mode 100644
index 0000000..4dc0e3c
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Include/Library/PchSmbusLibrary.h
@@ -0,0 +1,44 @@
+/** @file
+ Header file for Pch Smbus Lib.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _PCH_SMBUS_LIBRARY_H_
+#define _PCH_SMBUS_LIBRARY_H_
+
+/**
+ This function provides a standard way to execute Smbus sequential
+ I2C Read. This function allows the PCH to perform block reads to
+ certain I2C devices, such as serial E2PROMs. Typically these data
+ bytes correspond to an offset (address) within the serial memory
+ chips.
+
+ @param[in] SmBusAddress Address that encodes the SMBUS Slave Address,
+ SMBUS Command, SMBUS Data Length, and PEC.
+ @param[out] Buffer Pointer to the buffer to store the bytes read
+ from the SMBUS
+ @param[out] Status eturn status for the executed command.
+
+ @retval UINTN The number of bytes read
+**/
+UINTN
+EFIAPI
+SmBusSeqI2CRead (
+ IN UINTN SmBusAddress,
+ OUT VOID *Buffer,
+ OUT RETURN_STATUS * Status OPTIONAL
+ );
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Include/Library/RcFviDxeLib.h b/ReferenceCode/Chipset/LynxPoint/Include/Library/RcFviDxeLib.h
new file mode 100644
index 0000000..eadf3aa
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Include/Library/RcFviDxeLib.h
@@ -0,0 +1,175 @@
+/** @file
+ Header file for Reference code Firmware Version Info Interface Lib implementation.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _RC_FVI_DXE_LIB_H_
+#define _RC_FVI_DXE_LIB_H_
+
+#include "Smbios.h"
+
+#pragma pack(1)
+
+///
+/// FviSmbios Type table -
+/// {
+/// FVI_HEADER;
+/// FVI_ELEMENTS;
+///...FVI_ELEMENTS;
+/// .....
+/// }
+///
+typedef struct {
+ UINT8 MajorVersion;
+ UINT8 MinorVersion;
+ UINT8 Revision;
+ UINT16 BuildNum;
+} RC_VERSION;
+
+///
+/// If string is implemented for ComponentName or VersionString, and then string index of
+/// ComponentName or VersionString can't be zero. The string index of ComponentName and
+/// VersionString will be updated and calculated when collect all elements.
+/// String index must contain zero if not implemented.
+///
+typedef struct {
+ UINT8 ComponentName;
+ UINT8 VersionString;
+ RC_VERSION Version;
+ UINT8 NameString[SMBIOS_STRING_MAX_LENGTH];
+ UINT8 VerString[SMBIOS_STRING_MAX_LENGTH];
+} FVI_ELEMENTS;
+
+#define FVI_ELEMENTS_SIZE_NOSTRING (sizeof(FVI_ELEMENTS) - SMBIOS_STRING_MAX_LENGTH * 2)
+#define DEFAULT_FVI_ELEMENT_DATA(Name) \
+{ \
+ 0x1, \
+ 0x00, \
+ { \
+ (UINT8) (((Name ## _RC_VERSION) & 0xFF000000) >> 24), \
+ (UINT8) (((Name ## _RC_VERSION) & 0x00FF0000) >> 16), \
+ (UINT8) (((Name ## _RC_VERSION) & 0x0000FF00) >> 8), \
+ (UINT16) (((Name ## _RC_VERSION) & 0x000000FF)), \
+ }, \
+ Name ## _FVI_STRING, \
+ 0 \
+}
+
+///
+/// This is the definitions for SMBIOS FviSmbios Type table
+///
+typedef struct {
+ SMBIOS_STRUCTURE_HDR Header;
+ UINT8 Count; ///< Number of elements included
+} FVI_HEADER;
+
+///
+/// This is definition for Misc sub class data hub
+///
+typedef struct {
+ EFI_SUBCLASS_TYPE1_HEADER Header;
+ FVI_HEADER FviHdr;
+} MISC_SUBCLASS_FVI_HEADER;
+
+///
+/// Use the OEM Data Record for SMBIOS Type 0x80-0xFF
+///
+#define MISC_SUBCLASS_TYPE1_HEADER_DATA(Name) \
+{ \
+ EFI_MISC_SUBCLASS_VERSION, \
+ sizeof(EFI_SUBCLASS_TYPE1_HEADER), \
+ Name ## _FVI_SMBIOS_INSTANCE, \
+ 0x1, \
+ EFI_MISC_SMBIOS_STRUCT_ENCAP_RECORD_NUMBER \
+}
+
+#define DEFAULT_FVI_HEADER_DATA(Name) \
+{ \
+ { \
+ Name ## _FVI_SMBIOS_TYPE, \
+ sizeof(FVI_HEADER), \
+ 0x00, \
+ }, \
+ 0x1 \
+}
+
+///
+/// Initialize per-record portion of subclass header and fvi header, also fill
+/// static data into data portion of record
+///
+#define MISC_SUBCLASS_FVI_HEADER_ENTRY(Name) \
+{\
+ MISC_SUBCLASS_TYPE1_HEADER_DATA(Name), \
+ DEFAULT_FVI_HEADER_DATA(Name) \
+}
+
+///
+/// The function to update the element before log to Data Hub
+///
+typedef EFI_STATUS (EFIAPI FVI_ELEMENT_FUNCTION) (
+ IN OUT FVI_ELEMENTS *Element
+ );
+
+typedef struct {
+ FVI_ELEMENTS Element;
+ FVI_ELEMENT_FUNCTION *Function;
+} FVI_ELEMENT_AND_FUNCTION;
+
+typedef struct {
+ MISC_SUBCLASS_FVI_HEADER FviHeader;
+ FVI_ELEMENT_AND_FUNCTION *Elements; ///< Pointer to elements.
+} FVI_DATA_HUB_CALLBACK_CONTEXT;
+
+#pragma pack()
+
+/**
+ Initialize callback context for Firmware Version Info (FVI) Interface Spec v0.7
+ implementation.
+
+ Invoke this routine to initialize data hub and context for log,
+ all elements can be updated before execute CreateRcFviDatahub or updated by
+ the element hook that registered as FVI_ELEMENT_FUNCTION
+
+ @param[in] Type Value is defined in SMBIOS Type 14 - Group Associaction structure - item type.
+ @param[in] Count Number of elements included by this SMBIOS table
+ @param[in] FviContext Context of FVI elements for data hub log
+
+ @retval None
+**/
+VOID
+InitFviDataHubCbContext (
+ IN UINT8 Type,
+ IN UINT8 Count,
+ IN FVI_DATA_HUB_CALLBACK_CONTEXT *FviContext
+ );
+
+/**
+ Create the Reference code version info as per Firmware Version Info (FVI) Interface Spec v0.7
+ to Data Hub.
+
+ Invoke this routine to log record when all Fvi elements are finialized
+
+ @param[in] FviContext Pointer to the notification functions context, which is context of FVI
+ elements for data hub log
+
+ @retval None
+**/
+VOID
+CreateRcFviDatahub (
+ IN FVI_DATA_HUB_CALLBACK_CONTEXT *FviContext
+ )
+;
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Include/PchAccess.h b/ReferenceCode/Chipset/LynxPoint/Include/PchAccess.h
new file mode 100644
index 0000000..206a2cc
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Include/PchAccess.h
@@ -0,0 +1,509 @@
+/** @file
+ Macros that simplify accessing PCH devices's PCI registers.
+
+ ** NOTE ** these macros assume the PCH device is on BUS 0
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PCH_ACCESS_H_
+#define _PCH_ACCESS_H_
+
+#include "PchRegs.h"
+
+#ifndef STALL_ONE_MICRO_SECOND
+#define STALL_ONE_MICRO_SECOND 1
+#endif
+#ifndef STALL_ONE_SECOND
+#define STALL_ONE_SECOND 1000000
+#endif
+
+///
+/// Memory Mapped PCI Access macros
+///
+///
+/// PCI Device MM Base
+///
+#ifndef MmPciAddress
+#define MmPciAddress(Segment, Bus, Device, Function, Register) \
+ ((UINTN) (PciRead32 (PCI_LIB_ADDRESS (0,0,0,0x60)) & 0xFC000000) + \
+ (UINTN) (Bus << 20) + \
+ (UINTN) (Device << 15) + \
+ (UINTN) (Function << 12) + \
+ (UINTN) (Register) \
+ )
+#endif
+///
+/// Pch Controller PCI access macros
+///
+#define PCH_RCRB_BASE ( \
+ MmioRead32 (MmPciAddress (0, \
+ DEFAULT_PCI_BUS_NUMBER_PCH, \
+ PCI_DEVICE_NUMBER_PCH_LPC, \
+ 0, \
+ R_PCH_LPC_RCBA)) &~BIT0 \
+ )
+
+//
+// Device 0x1b, Function 0
+//
+#define PchAzaliaPciCfg32(Register) \
+ MmioRead32 ( \
+ MmPciAddress (0, \
+ DEFAULT_PCI_BUS_NUMBER_PCH, \
+ PCI_DEVICE_NUMBER_PCH_AZALIA, \
+ 0, \
+ Register) \
+ )
+
+#define PchAzaliaPciCfg32Or(Register, OrData) \
+ MmioOr32 ( \
+ MmPciAddress (0, \
+ DEFAULT_PCI_BUS_NUMBER_PCH, \
+ PCI_DEVICE_NUMBER_PCH_AZALIA, \
+ 0, \
+ Register), \
+ OrData \
+ )
+
+#define PchAzaliaPciCfg32And(Register, AndData) \
+ MmioAnd32 ( \
+ MmPciAddress (0, \
+ DEFAULT_PCI_BUS_NUMBER_PCH, \
+ PCI_DEVICE_NUMBER_PCH_AZALIA, \
+ 0, \
+ Register), \
+ AndData \
+ )
+
+#define PchAzaliaPciCfg32AndThenOr(Register, AndData, OrData) \
+ MmioAndThenOr32 ( \
+ MmPciAddress (0, \
+ DEFAULT_PCI_BUS_NUMBER_PCH, \
+ PCI_DEVICE_NUMBER_PCH_AZALIA, \
+ 0, \
+ Register), \
+ OrData \
+ )
+
+#define PchAzaliaPciCfg16(Register) \
+ MmioRead16 ( \
+ MmPciAddress (0, \
+ DEFAULT_PCI_BUS_NUMBER_PCH, \
+ PCI_DEVICE_NUMBER_PCH_AZALIA, \
+ 0, \
+ Register) \
+ )
+
+#define PchAzaliaPciCfg16Or(Register, OrData) \
+ MmioOr16 ( \
+ MmPciAddress (0, \
+ DEFAULT_PCI_BUS_NUMBER_PCH, \
+ PCI_DEVICE_NUMBER_PCH_AZALIA, \
+ 0, \
+ Register), \
+ OrData \
+ )
+
+#define PchAzaliaPciCfg16And(Register, AndData) \
+ MmioAnd16 ( \
+ MmPciAddress (0, \
+ DEFAULT_PCI_BUS_NUMBER_PCH, \
+ PCI_DEVICE_NUMBER_PCH_AZALIA, \
+ 0, \
+ Register), \
+ AndData \
+ )
+
+#define PchAzaliaPciCfg16AndThenOr(Register, AndData, OrData) \
+ MmioAndThenOr16 ( \
+ MmPciAddress (0, \
+ DEFAULT_PCI_BUS_NUMBER_PCH, \
+ PCI_DEVICE_NUMBER_PCH_AZALIA, \
+ 0, \
+ Register), \
+ AndData, \
+ OrData \
+ )
+
+#define PchAzaliaPciCfg8(Register) MmioRead8 (MmPciAddress (0, DEFAULT_PCI_BUS_NUMBER_PCH, PCI_DEVICE_NUMBER_PCH_AZALIA, 0, Register))
+
+#define PchAzaliaPciCfg8Or(Register, OrData) \
+ MmioOr8 ( \
+ MmPciAddress (0, \
+ DEFAULT_PCI_BUS_NUMBER_PCH, \
+ PCI_DEVICE_NUMBER_PCH_AZALIA, \
+ 0, \
+ Register), \
+ OrData \
+ )
+
+#define PchAzaliaPciCfg8And(Register, AndData) \
+ MmioAnd8 ( \
+ MmPciAddress (0, \
+ DEFAULT_PCI_BUS_NUMBER_PCH, \
+ PCI_DEVICE_NUMBER_PCH_AZALIA, \
+ 0, \
+ Register), \
+ AndData \
+ )
+
+#define PchAzaliaPciCfg8AndThenOr(Register, AndData, OrData) \
+ MmioAndThenOr8 ( \
+ MmPciAddress (0, \
+ DEFAULT_PCI_BUS_NUMBER_PCH, \
+ PCI_DEVICE_NUMBER_PCH_AZALIA, \
+ 0, \
+ Register), \
+ AndData, \
+ OrData \
+ )
+
+//
+// Device 0x1f, Function 0
+//
+#define PchLpcPciCfg32(Register) MmioRead32 (MmPciAddress (0, DEFAULT_PCI_BUS_NUMBER_PCH, PCI_DEVICE_NUMBER_PCH_LPC, 0, Register))
+
+#define PchLpcPciCfg32Or (Register, OrData) \
+ MmioOr32 ( \
+ MmPciAddress (0, \
+ DEFAULT_PCI_BUS_NUMBER_PCH, \
+ PCI_DEVICE_NUMBER_PCH_LPC, \
+ 0, \
+ Register), \
+ OrData \
+ )
+
+#define PchLpcPciCfg32And(Register, AndData) \
+ MmioAnd32 ( \
+ MmPciAddress (0, \
+ DEFAULT_PCI_BUS_NUMBER_PCH, \
+ PCI_DEVICE_NUMBER_PCH_LPC, \
+ 0, \
+ Register), \
+ AndData \
+ )
+
+#define PchLpcPciCfg32AndThenOr(Register, AndData, OrData) \
+ MmioAndThenOr32 ( \
+ MmPciAddress (0, \
+ DEFAULT_PCI_BUS_NUMBER_PCH, \
+ PCI_DEVICE_NUMBER_PCH_LPC, \
+ 0, \
+ Register), \
+ AndData, \
+ OrData \
+ )
+
+#define PchLpcPciCfg16(Register) MmioRead16 (MmPciAddress (0, DEFAULT_PCI_BUS_NUMBER_PCH, PCI_DEVICE_NUMBER_PCH_LPC, 0, Register))
+
+#define PchLpcPciCfg16Or(Register, OrData) \
+ MmioOr16 ( \
+ MmPciAddress (0, \
+ DEFAULT_PCI_BUS_NUMBER_PCH, \
+ PCI_DEVICE_NUMBER_PCH_LPC, \
+ 0, \
+ Register), \
+ OrData \
+ )
+
+#define PchLpcPciCfg16And(Register, AndData) \
+ MmioAnd16 ( \
+ MmPciAddress (0, \
+ DEFAULT_PCI_BUS_NUMBER_PCH, \
+ PCI_DEVICE_NUMBER_PCH_LPC, \
+ 0, \
+ Register), \
+ AndData \
+ )
+
+#define PchLpcPciCfg16AndThenOr(Register, AndData, OrData) \
+ MmioAndThenOr16 ( \
+ MmPciAddress (0, \
+ DEFAULT_PCI_BUS_NUMBER_PCH, \
+ PCI_DEVICE_NUMBER_PCH_LPC, \
+ 0, \
+ Register), \
+ AndData, \
+ OrData \
+ )
+
+#define PchLpcPciCfg8(Register) MmioRead8 (MmPciAddress (0, DEFAULT_PCI_BUS_NUMBER_PCH, PCI_DEVICE_NUMBER_PCH_LPC, 0, Register))
+
+#define PchLpcPciCfg8Or(Register, OrData) \
+ MmioOr8 ( \
+ MmPciAddress (0, \
+ DEFAULT_PCI_BUS_NUMBER_PCH, \
+ PCI_DEVICE_NUMBER_PCH_LPC, \
+ 0, \
+ Register), \
+ OrData \
+ )
+
+#define PchLpcPciCfg8And(Register, AndData) \
+ MmioAnd8 ( \
+ MmPciAddress (0, \
+ DEFAULT_PCI_BUS_NUMBER_PCH, \
+ PCI_DEVICE_NUMBER_PCH_LPC, \
+ 0, \
+ Register), \
+ AndData \
+ )
+
+#define PchLpcPciCfg8AndThenOr(Register, AndData, OrData) \
+ MmioAndThenOr8 ( \
+ MmPciAddress (0, \
+ DEFAULT_PCI_BUS_NUMBER_PCH, \
+ PCI_DEVICE_NUMBER_PCH_LPC, \
+ 0, \
+ Register), \
+ AndData, \
+ OrData \
+ )
+
+//
+// SATA 1 device 0x1f, Function 2
+//
+#define PchSataPciCfg32(Register) MmioRead32 (MmPciAddress (0, DEFAULT_PCI_BUS_NUMBER_PCH, PCI_DEVICE_NUMBER_PCH_SATA, 2, Register))
+
+#define PchSataPciCfg32Or(Register, OrData) \
+ MmioOr32 ( \
+ MmPciAddress (0, \
+ DEFAULT_PCI_BUS_NUMBER_PCH, \
+ PCI_DEVICE_NUMBER_PCH_SATA, \
+ 2, \
+ Register), \
+ OrData \
+ )
+
+#define PchSataPciCfg32And(Register, AndData) \
+ MmioAnd32 ( \
+ MmPciAddress (0, \
+ DEFAULT_PCI_BUS_NUMBER_PCH, \
+ PCI_DEVICE_NUMBER_PCH_SATA, \
+ 2, \
+ Register), \
+ AndData \
+ )
+
+#define PchSataPciCfg32AndThenOr(Register, AndData, OrData) \
+ MmioAndThenOr32 ( \
+ MmPciAddress (0, \
+ DEFAULT_PCI_BUS_NUMBER_PCH, \
+ PCI_DEVICE_NUMBER_PCH_SATA, \
+ 2, \
+ Register), \
+ AndData, \
+ OrData \
+ )
+
+#define PchSataPciCfg16(Register) MmioRead16 (MmPciAddress (0, DEFAULT_PCI_BUS_NUMBER_PCH, PCI_DEVICE_NUMBER_PCH_SATA, 2, Register))
+
+#define PchSataPciCfg16Or(Register, OrData) \
+ MmioOr16 ( \
+ MmPciAddress (0, \
+ DEFAULT_PCI_BUS_NUMBER_PCH, \
+ PCI_DEVICE_NUMBER_PCH_SATA, \
+ 2, \
+ Register), \
+ OrData \
+ )
+
+#define PchSataPciCfg16And(Register, AndData) \
+ MmioAnd16 ( \
+ MmPciAddress (0, \
+ DEFAULT_PCI_BUS_NUMBER_PCH, \
+ PCI_DEVICE_NUMBER_PCH_SATA, \
+ 2, \
+ Register), \
+ AndData \
+ )
+
+#define PchSataPciCfg16AndThenOr(Register, AndData, OrData) \
+ MmioAndThenOr16 ( \
+ MmPciAddress (0, \
+ DEFAULT_PCI_BUS_NUMBER_PCH, \
+ PCI_DEVICE_NUMBER_PCH_SATA, \
+ 2, \
+ Register), \
+ AndData, \
+ OrData \
+ )
+
+#define PchSataPciCfg8(Register) MmioRead8 (MmPciAddress (0, DEFAULT_PCI_BUS_NUMBER_PCH, PCI_DEVICE_NUMBER_PCH_SATA, 2, Register))
+
+#define PchSataPciCfg8Or(Register, OrData) \
+ MmioOr8 ( \
+ MmPciAddress (0, \
+ DEFAULT_PCI_BUS_NUMBER_PCH, \
+ PCI_DEVICE_NUMBER_PCH_SATA, \
+ 2, \
+ Register), \
+ OrData \
+ )
+
+#define PchSataPciCfg8And(Register, AndData) \
+ MmioAnd8 ( \
+ MmPciAddress (0, \
+ DEFAULT_PCI_BUS_NUMBER_PCH, \
+ PCI_DEVICE_NUMBER_PCH_SATA, \
+ 2, \
+ Register), \
+ AndData \
+ )
+
+#define PchSataPciCfg8AndThenOr(Register, AndData, OrData) \
+ MmioAndThenOr8 ( \
+ MmPciAddress (0, \
+ DEFAULT_PCI_BUS_NUMBER_PCH, \
+ PCI_DEVICE_NUMBER_PCH_SATA, \
+ 2, \
+ Register), \
+ AndData, \
+ OrData \
+ )
+
+//
+// SATA 2 device 0x1f, Function 5
+//
+#define PchSata2PciCfg32(Register) MmioRead32 (MmPciAddress (0, DEFAULT_PCI_BUS_NUMBER_PCH, PCI_DEVICE_NUMBER_PCH_SATA2, 5, Register))
+
+#define PchSata2PciCfg32Or(Register, OrData) \
+ MmioOr32 ( \
+ MmPciAddress (0, \
+ DEFAULT_PCI_BUS_NUMBER_PCH, \
+ PCI_DEVICE_NUMBER_PCH_SATA2, \
+ 5, \
+ Register), \
+ OrData \
+ )
+
+#define PchSata2PciCfg32And(Register, AndData) \
+ MmioAnd32 ( \
+ MmPciAddress (0, \
+ DEFAULT_PCI_BUS_NUMBER_PCH, \
+ PCI_DEVICE_NUMBER_PCH_SATA2, \
+ 5, \
+ Register), \
+ AndData \
+ )
+
+#define PchSata2PciCfg32AndThenOr(Register, AndData, OrData) \
+ MmioAndThenOr32 ( \
+ MmPciAddress (0, \
+ DEFAULT_PCI_BUS_NUMBER_PCH, \
+ PCI_DEVICE_NUMBER_PCH_SATA2, \
+ 5, \
+ Register), \
+ AndData, \
+ OrData \
+ )
+
+#define PchSata2PciCfg16(Register) MmioRead16 (MmPciAddress (0, DEFAULT_PCI_BUS_NUMBER_PCH, PCI_DEVICE_NUMBER_PCH_SATA2, 5, Register))
+
+#define PchSata2PciCfg16Or(Register, OrData) \
+ MmioOr16 ( \
+ MmPciAddress (0, \
+ DEFAULT_PCI_BUS_NUMBER_PCH, \
+ PCI_DEVICE_NUMBER_PCH_SATA2, \
+ 5, \
+ Register), \
+ OrData \
+ )
+
+#define PchSata2PciCfg16And(Register, AndData) \
+ MmioAnd16 ( \
+ MmPciAddress (0, \
+ DEFAULT_PCI_BUS_NUMBER_PCH, \
+ PCI_DEVICE_NUMBER_PCH_SATA2, \
+ 5, \
+ Register), \
+ AndData \
+ )
+
+#define PchSata2PciCfg16AndThenOr(Register, AndData, OrData) \
+ MmioAndThenOr16 ( \
+ MmPciAddress (0, \
+ DEFAULT_PCI_BUS_NUMBER_PCH, \
+ PCI_DEVICE_NUMBER_PCH_SATA2, \
+ 5, \
+ Register), \
+ AndData, \
+ OrData \
+ )
+
+#define PchSata2PciCfg8(Register) MmioRead8 (MmPciAddress (DEFAULT_PCI_BUS_NUMBER_PCH, PCI_DEVICE_NUMBER_PCH_SATA2, 5, Register))
+
+#define PchSata2PciCfg8Or(Register, OrData) \
+ MmioOr8 ( \
+ MmPciAddress (0, \
+ DEFAULT_PCI_BUS_NUMBER_PCH, \
+ PCI_DEVICE_NUMBER_PCH_SATA2, \
+ 5, \
+ Register), \
+ OrData \
+ )
+
+#define PchSata2PciCfg8And(Register, AndData) \
+ MmioAnd8 ( \
+ MmPciAddress (0, \
+ DEFAULT_PCI_BUS_NUMBER_PCH, \
+ PCI_DEVICE_NUMBER_PCH_SATA2, \
+ 5, \
+ Register), \
+ AndData \
+ )
+
+#define PchSata2PciCfg8AndThenOr(Register, AndData, OrData) \
+ MmioAndThenOr8 ( \
+ MmPciAddress (0, \
+ DEFAULT_PCI_BUS_NUMBER_PCH, \
+ PCI_DEVICE_NUMBER_PCH_SATA2, \
+ 5, \
+ Register), \
+ AndData, \
+ OrData \
+ )
+
+//
+// Root Complex Register Block
+//
+#define PchMmRcrb32(Register) MmioRead32 (PCH_RCRB_BASE + Register)
+
+#define PchMmRcrb32Or(Register, OrData) MmioOr32 (PCH_RCRB_BASE + Register, OrData)
+
+#define PchMmRcrb32And(Register, AndData) MmioAnd32 (PCH_RCRB_BASE + Register, AndData)
+
+#define PchMmRcrb32AndThenOr(Register, AndData, OrData) MmioAndThenOr32 (PCH_RCRB_BASE + Register, AndData, OrData)
+
+#define PchMmRcrb16(Register) MmioRead16 (PCH_RCRB_BASE + Register)
+
+#define PchMmRcrb16Or(Register, OrData) MmioOr16 (PCH_RCRB_BASE + Register, OrData)
+
+#define PchMmRcrb16And(Register, AndData) MmioAnd16 (PCH_RCRB_BASE + Register, AndData)
+
+#define PchMmRcrb16AndThenOr(Register, AndData, OrData) MmioAndThenOr16 (PCH_RCRB_BASE + Register, AndData, OrData)
+
+#define PchMmRcrb8(Register) MmioRead8 (PCH_RCRB_BASE + Register)
+
+#define PchMmRcrb8Or(Register, OrData) MmioOr8 (PCH_RCRB_BASE + Register, OrData)
+
+#define PchMmRcrb8And(Register, AndData) MmioAnd8 (PCH_RCRB_BASE + Register, AndData)
+
+#define PchMmRcrb8AndThenOr(Register, AndData, OrData) MmioAndThenOr8 (PCH_RCRB_BASE + Register, AndData, OrData)
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Include/PchRegs.h b/ReferenceCode/Chipset/LynxPoint/Include/PchRegs.h
new file mode 100644
index 0000000..b37ef61
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Include/PchRegs.h
@@ -0,0 +1,474 @@
+/** @file
+ Register names for PCH.
+
+ Conventions:
+
+ - Prefixes:
+ Definitions beginning with "R_" are registers
+ Definitions beginning with "B_" are bits within registers
+ Definitions beginning with "V_" are meaningful values of bits within the registers
+ Definitions beginning with "S_" are register sizes
+ Definitions beginning with "N_" are the bit position
+ - In general, PCH registers are denoted by "_PCH_" in register names
+ - Registers / bits that are different between PCH generations are denoted by
+ "_PCH_<generation_name>_" in register/bit names. e.g., "_PCH_LPT_"
+ - Registers / bits that are different between SKUs are denoted by "_<SKU_name>"
+ at the end of the register/bit names
+ - Registers / bits of new devices introduced in a PCH generation will be just named
+ as "_PCH_" without <generation_name> inserted.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PCH_REGS_H_
+#define _PCH_REGS_H_
+
+//
+// Bit Difinitions.
+// @bug drive these definitions to code base. Should not need to be part of
+// chipset modules
+//
+#ifndef BIT0
+#define BIT0 0x0001
+#define BIT1 0x0002
+#define BIT2 0x0004
+#define BIT3 0x0008
+#define BIT4 0x0010
+#define BIT5 0x0020
+#define BIT6 0x0040
+#define BIT7 0x0080
+#define BIT8 0x0100
+#define BIT9 0x0200
+#define BIT10 0x0400
+#define BIT11 0x0800
+#define BIT12 0x1000
+#define BIT13 0x2000
+#define BIT14 0x4000
+#define BIT15 0x8000
+#define BIT16 0x00010000
+#define BIT17 0x00020000
+#define BIT18 0x00040000
+#define BIT19 0x00080000
+#define BIT20 0x00100000
+#define BIT21 0x00200000
+#define BIT22 0x00400000
+#define BIT23 0x00800000
+#define BIT24 0x01000000
+#define BIT25 0x02000000
+#define BIT26 0x04000000
+#define BIT27 0x08000000
+#define BIT28 0x10000000
+#define BIT29 0x20000000
+#define BIT30 0x40000000
+#define BIT31 0x80000000
+#define BIT32 0x100000000
+#define BIT33 0x200000000
+#define BIT34 0x400000000
+#define BIT35 0x800000000
+#define BIT36 0x1000000000
+#define BIT37 0x2000000000
+#define BIT38 0x4000000000
+#define BIT39 0x8000000000
+#define BIT40 0x10000000000
+#define BIT41 0x20000000000
+#define BIT42 0x40000000000
+#define BIT43 0x80000000000
+#define BIT44 0x100000000000
+#define BIT45 0x200000000000
+#define BIT46 0x400000000000
+#define BIT47 0x800000000000
+#define BIT48 0x1000000000000
+#define BIT49 0x2000000000000
+#define BIT50 0x4000000000000
+#define BIT51 0x8000000000000
+#define BIT52 0x10000000000000
+#define BIT53 0x20000000000000
+#define BIT54 0x40000000000000
+#define BIT55 0x80000000000000
+#define BIT56 0x100000000000000
+#define BIT57 0x200000000000000
+#define BIT58 0x400000000000000
+#define BIT59 0x800000000000000
+#define BIT60 0x1000000000000000
+#define BIT61 0x2000000000000000
+#define BIT62 0x4000000000000000
+#define BIT63 0x8000000000000000
+#endif
+///
+/// The default PCH PCI bus number
+///
+#define DEFAULT_PCI_BUS_NUMBER_PCH 0
+
+//
+// Default Vendor ID and Subsystem ID
+//
+#define V_PCH_INTEL_VENDOR_ID 0x8086 ///< Default Intel PCH Vendor ID
+#define V_PCH_DEFAULT_SID 0x7270 ///< Default Intel PCH Subsystem ID
+#define V_PCH_DEFAULT_SVID_SID (V_INTEL_VENDOR_ID + (V_PCH_DEFAULT_SID << 16)) ///< Default INTEL PCH Vendor ID and Subsystem ID
+
+//
+// Include device register definitions
+//
+#include "PchRegs/PchRegsHda.h"
+#include "PchRegs/PchRegsLan.h"
+#include "PchRegs/PchRegsLpc.h"
+#include "PchRegs/PchRegsPcie.h"
+#include "PchRegs/PchRegsRcrb.h"
+#include "PchRegs/PchRegsSata.h"
+#include "PchRegs/PchRegsSmbus.h"
+#include "PchRegs/PchRegsSpi.h"
+#include "PchRegs/PchRegsThermal.h"
+#include "PchRegs/PchRegsUsb.h"
+#ifdef SERIAL_IO_FLAG
+#include "PchRegs/PchRegsSerialIo.h"
+#endif // SERIAL_IO_FLAG
+#ifdef ADSP_FLAG
+#include "PchRegs/PchRegsAdsp.h"
+#endif // ADSP_FLAG
+
+//
+// LPC Device ID macros
+//
+//
+// Device IDs that are PCH LPT Desktop specific
+//
+#define IS_PCH_LPTH_LPC_DEVICE_ID_DESKTOP(DeviceId) \
+ ( \
+ (DeviceId == V_PCH_LPTH_LPC_DEVICE_ID_DT_0) || \
+ (DeviceId == V_PCH_LPTH_LPC_DEVICE_ID_DT_1) || \
+ (DeviceId == V_PCH_LPTH_LPC_DEVICE_ID_DT_3) || \
+ (DeviceId == V_PCH_LPTH_LPC_DEVICE_ID_DT_4) || \
+ (DeviceId == V_PCH_LPTH_LPC_DEVICE_ID_DT_5) || \
+ (DeviceId == V_PCH_LPTH_LPC_DEVICE_ID_DT_6) || \
+ (DeviceId == V_PCH_LPTH_LPC_DEVICE_ID_DT_2) || \
+ (DeviceId == V_PCH_LPTH_LPC_DEVICE_ID_DT_SUPER_SKU) \
+ )
+
+#define IS_PCH_LPTLP_LPC_DEVICE_ID_DESKTOP(DeviceId) (FALSE)
+
+#define IS_PCH_LPT_LPC_DEVICE_ID_DESKTOP(DeviceId) \
+ ( \
+ IS_PCH_LPTH_LPC_DEVICE_ID_DESKTOP(DeviceId) || \
+ IS_PCH_LPTLP_LPC_DEVICE_ID_DESKTOP(DeviceId) \
+ )
+
+//
+// Device IDs that are PCH LPT Mobile specific
+//
+#define IS_PCH_LPTH_LPC_DEVICE_ID_MOBILE(DeviceId) \
+ ( \
+ (DeviceId == V_PCH_LPTH_LPC_DEVICE_ID_MB_0) || \
+ (DeviceId == V_PCH_LPTH_LPC_DEVICE_ID_MB_2) || \
+ (DeviceId == V_PCH_LPTH_LPC_DEVICE_ID_MB_1) || \
+ (DeviceId == V_PCH_LPTH_LPC_DEVICE_ID_MB_SUPER_SKU) \
+ )
+
+#define IS_PCH_LPTLP_LPC_DEVICE_ID_MOBILE(DeviceId) \
+ ( \
+ (DeviceId == V_PCH_LPTLP_LPC_DEVICE_ID_MB_SUPER_SKU) || \
+ (DeviceId == V_PCH_LPTLP_LPC_DEVICE_ID_MB_0) || \
+ (DeviceId == V_PCH_LPTLP_LPC_DEVICE_ID_MB_1) || \
+ (DeviceId == V_PCH_LPTLP_LPC_DEVICE_ID_MB_2) || \
+ (DeviceId == V_PCH_LPTLP_LPC_DEVICE_ID_MB_3) || \
+ (DeviceId == V_PCH_LPTLP_LPC_DEVICE_ID_MB_4) || \
+ (DeviceId == V_PCH_LPTLP_LPC_DEVICE_ID_MB_5) \
+ )
+
+#define IS_PCH_LPT_LPC_DEVICE_ID_MOBILE(DeviceId) \
+ ( \
+ IS_PCH_LPTH_LPC_DEVICE_ID_MOBILE(DeviceId) || \
+ IS_PCH_LPTLP_LPC_DEVICE_ID_MOBILE(DeviceId) \
+ )
+//
+// Device IDS that are PCH LPT WorkStation specific
+//
+#define IS_PCH_LPTH_LPC_DEVICE_ID_WS(DeviceId) \
+ ( \
+ (DeviceId == V_PCH_LPTH_LPC_DEVICE_ID_SVR_3) || \
+ FALSE \
+ )
+
+#define IS_PCH_LPTLP_LPC_DEVICE_ID_WS(DeviceId) (FALSE)
+
+#define IS_PCH_LPT_LPC_DEVICE_ID_WS(DeviceId) \
+ ( \
+ IS_PCH_LPTH_LPC_DEVICE_ID_WS(DeviceId) || \
+ IS_PCH_LPTLP_LPC_DEVICE_ID_WS(DeviceId) \
+ )
+
+//
+// Device IDS that are PCH LPT Server specific
+//
+#define IS_PCH_LPTH_LPC_DEVICE_ID_SERVER(DeviceId) \
+ ( \
+ (DeviceId == V_PCH_LPTH_LPC_DEVICE_ID_SVR_0) || \
+ (DeviceId == V_PCH_LPTH_LPC_DEVICE_ID_SVR_1) || \
+ (DeviceId == V_PCH_LPTH_LPC_DEVICE_ID_SVR_2) || \
+ FALSE \
+ )
+
+#define IS_PCH_LPTLP_LPC_DEVICE_ID_SERVER(DeviceId) (FALSE)
+
+#define IS_PCH_LPT_LPC_DEVICE_ID_SERVER(DeviceId) \
+ ( \
+ IS_PCH_LPTH_LPC_DEVICE_ID_SERVER(DeviceId) || \
+ IS_PCH_LPTLP_LPC_DEVICE_ID_SERVER(DeviceId) \
+ )
+
+#define IS_PCH_LPTH_LPC_DEVICE_ID(DeviceId) \
+ ( \
+ IS_PCH_LPTH_LPC_DEVICE_ID_DESKTOP (DeviceId) || \
+ IS_PCH_LPTH_LPC_DEVICE_ID_MOBILE (DeviceId) || \
+ IS_PCH_LPTH_LPC_DEVICE_ID_WS (DeviceId) || \
+ IS_PCH_LPTH_LPC_DEVICE_ID_SERVER (DeviceId) \
+ )
+
+#define IS_PCH_LPTLP_LPC_DEVICE_ID(DeviceId) \
+ ( \
+ IS_PCH_LPTLP_LPC_DEVICE_ID_DESKTOP (DeviceId) || \
+ IS_PCH_LPTLP_LPC_DEVICE_ID_MOBILE (DeviceId) || \
+ IS_PCH_LPTLP_LPC_DEVICE_ID_WS (DeviceId) || \
+ IS_PCH_LPTLP_LPC_DEVICE_ID_SERVER (DeviceId) \
+ )
+
+#define IS_PCH_LPT_LPC_DEVICE_ID(DeviceId) \
+ ( \
+ IS_PCH_LPTH_LPC_DEVICE_ID(DeviceId) || \
+ IS_PCH_LPTLP_LPC_DEVICE_ID(DeviceId) \
+ )
+
+//
+// SATA AHCI Device ID macros
+//
+#define IS_PCH_LPTH_SATA_AHCI_DEVICE_ID(DeviceId) \
+ ( \
+ (DeviceId == V_PCH_LPTH_SATA_DEVICE_ID_D_AHCI) || \
+ (DeviceId == V_PCH_LPTH_SATA_DEVICE_ID_M_AHCI) \
+ )
+
+#define IS_PCH_LPTLP_SATA_AHCI_DEVICE_ID(DeviceId) \
+ ( \
+ (DeviceId == V_PCH_LPTLP_SATA_DEVICE_ID_M_AHCI0) || \
+ (DeviceId == V_PCH_LPTLP_SATA_DEVICE_ID_M_AHCI1) \
+ )
+
+#define IS_PCH_LPT_SATA_AHCI_DEVICE_ID(DeviceId) \
+ ( \
+ IS_PCH_LPTH_SATA_AHCI_DEVICE_ID (DeviceId) || \
+ IS_PCH_LPTLP_SATA_AHCI_DEVICE_ID (DeviceId) \
+ )
+
+//
+// SATA IDE Device ID macros
+//
+#define IS_PCH_LPTH_SATA_IDE_DEVICE_ID(DeviceId) \
+ ( \
+ (DeviceId == V_PCH_LPTH_SATA_DEVICE_ID_D_IDE) || \
+ (DeviceId == V_PCH_LPTH_SATA2_DEVICE_ID_D_IDE) || \
+ (DeviceId == V_PCH_LPTH_SATA_DEVICE_ID_M_IDE) || \
+ (DeviceId == V_PCH_LPTH_SATA2_DEVICE_ID_M_IDE) \
+ )
+
+#define IS_PCH_LPTLP_SATA_IDE_DEVICE_ID(DeviceId) (FALSE)
+
+#define IS_PCH_LPT_SATA_IDE_DEVICE_ID(DeviceId) \
+ ( \
+ IS_PCH_LPTH_SATA_IDE_DEVICE_ID(DeviceId) || \
+ IS_PCH_LPTLP_SATA_IDE_DEVICE_ID(DeviceId) \
+ )
+
+//
+// SATA RAID Device ID macros
+//
+#define IS_PCH_LPTH_SATA_RAID_DEVICE_ID(DeviceId) \
+ ( \
+ (DeviceId == V_PCH_LPTH_SATA_DEVICE_ID_D_RAID) || \
+ (DeviceId == V_PCH_LPTH_SATA_DEVICE_ID_D_RAID_PREM) || \
+ (DeviceId == V_PCH_LPTH_SATA_DEVICE_ID_D_RAID_ALTDIS) || \
+ (DeviceId == V_PCH_LPTH_SATA_DEVICE_ID_M_RAID) || \
+ (DeviceId == V_PCH_LPTH_SATA_DEVICE_ID_M_RAID_PREM) || \
+ (DeviceId == V_PCH_LPTH_SATA_DEVICE_ID_D_RAID_SERVER) || \
+ (DeviceId == V_PCH_LPTH_SATA_DEVICE_ID_M_RAID_ALTDIS) \
+ )
+
+#define IS_PCH_LPTLP_SATA_RAID_DEVICE_ID(DeviceId) \
+ ( \
+ (DeviceId == V_PCH_LPTLP_SATA_DEVICE_ID_M_RAID0) || \
+ (DeviceId == V_PCH_LPTLP_SATA_DEVICE_ID_M_RAID1) || \
+ (DeviceId == V_PCH_LPTLP_SATA_DEVICE_ID_M_RAID2) || \
+ (DeviceId == V_PCH_LPTLP_SATA_DEVICE_ID_M_RAID3) || \
+ (DeviceId == V_PCH_LPTLP_SATA_DEVICE_ID_M_RAID_ALTDIS0) || \
+ (DeviceId == V_PCH_LPTLP_SATA_DEVICE_ID_M_RAID_ALTDIS1) || \
+ (DeviceId == V_PCH_LPTLP_SATA_DEVICE_ID_M_RAID_PREM0) || \
+ (DeviceId == V_PCH_LPTLP_SATA_DEVICE_ID_M_RAID_PREM1) \
+ )
+
+#define IS_PCH_LPT_SATA_RAID_DEVICE_ID(DeviceId) \
+ ( \
+ IS_PCH_LPTH_SATA_RAID_DEVICE_ID(DeviceId) || \
+ IS_PCH_LPTLP_SATA_RAID_DEVICE_ID(DeviceId) \
+ )
+
+//
+// Combined SATA IDE/AHCI/RAID Device ID macros
+//
+#define IS_PCH_LPTH_SATA_DEVICE_ID(DeviceId) \
+ ( \
+ IS_PCH_LPTH_SATA_IDE_DEVICE_ID (DeviceId) || \
+ IS_PCH_LPTH_SATA_AHCI_DEVICE_ID (DeviceId) || \
+ IS_PCH_LPTH_SATA_RAID_DEVICE_ID (DeviceId) \
+ )
+
+#define IS_PCH_LPTLP_SATA_DEVICE_ID(DeviceId) \
+ ( \
+ IS_PCH_LPTLP_SATA_AHCI_DEVICE_ID (DeviceId) || \
+ IS_PCH_LPTLP_SATA_RAID_DEVICE_ID (DeviceId) \
+ )
+
+#define IS_PCH_LPT_SATA_DEVICE_ID(DeviceId) \
+ ( \
+ IS_PCH_LPTH_SATA_DEVICE_ID (DeviceId) || \
+ IS_PCH_LPTLP_SATA_DEVICE_ID (DeviceId) \
+ )
+
+#define IS_PCH_LPTH_RAID_AVAILABLE(DeviceId) (TRUE)
+#define IS_PCH_LPTLP_RAID_AVAILABLE(DeviceId) (TRUE)
+#define IS_PCH_LPT_RAID_AVAILABLE(DeviceId) \
+ ( \
+ IS_PCH_LPTH_RAID_AVAILABLE(DeviceId) || \
+ IS_PCH_LPTLP_RAID_AVAILABLE(DeviceId) \
+ )
+
+//
+// USB Device ID macros
+//
+#define IS_PCH_LPTH_USB_DEVICE_ID(DeviceId) \
+ ( \
+ (DeviceId == V_PCH_LPTH_USB_DEVICE_ID_EHCI_1) || \
+ (DeviceId == V_PCH_LPTH_USB_DEVICE_ID_EHCI_2) || \
+ (DeviceId == V_PCH_LPTH_USB_DEVICE_ID_XHCI_1) \
+ )
+
+#define IS_PCH_LPTLP_USB_DEVICE_ID(DeviceId) \
+ ( \
+ (DeviceId == V_PCH_LPTLP_USB_DEVICE_ID_EHCI_1) || \
+ (DeviceId == V_PCH_LPTLP_USB_DEVICE_ID_XHCI_1) \
+ )
+
+#define IS_PCH_LPT_USB_DEVICE_ID(DeviceId) \
+ ( \
+ IS_PCH_LPTH_USB_DEVICE_ID(DeviceId) || \
+ IS_PCH_LPTLP_USB_DEVICE_ID(DeviceId) \
+ )
+
+//
+// PCIE Device ID macros
+//
+#define IS_PCH_LPTH_PCIE_DEVICE_ID(DeviceId) \
+ ( \
+ (DeviceId == V_PCH_LPTH_PCIE_DEVICE_ID_PORT1) || \
+ (DeviceId == V_PCH_LPTH_PCIE_DEVICE_ID_PORT2) || \
+ (DeviceId == V_PCH_LPTH_PCIE_DEVICE_ID_PORT3) || \
+ (DeviceId == V_PCH_LPTH_PCIE_DEVICE_ID_PORT4) || \
+ (DeviceId == V_PCH_LPTH_PCIE_DEVICE_ID_PORT5) || \
+ (DeviceId == V_PCH_LPTH_PCIE_DEVICE_ID_PORT6) || \
+ (DeviceId == V_PCH_LPTH_PCIE_DEVICE_ID_PORT7) || \
+ (DeviceId == V_PCH_LPTH_PCIE_DEVICE_ID_PORT8) || \
+ (DeviceId == V_PCH_LPTH_PCIE_DEVICE_ID_MB_SUBD) || \
+ (DeviceId == V_PCH_LPTH_PCIE_DEVICE_ID_DT_SUBD) \
+ )
+
+#define IS_PCH_LPTLP_PCIE_DEVICE_ID(DeviceId) \
+ ( \
+ (DeviceId == V_PCH_LPTLP_PCIE_DEVICE_ID_PORT1) || \
+ (DeviceId == V_PCH_LPTLP_PCIE_DEVICE_ID_PORT1_ALT) || \
+ (DeviceId == V_PCH_LPTLP_PCIE_DEVICE_ID_PORT2) || \
+ (DeviceId == V_PCH_LPTLP_PCIE_DEVICE_ID_PORT2_ALT) || \
+ (DeviceId == V_PCH_LPTLP_PCIE_DEVICE_ID_PORT3) || \
+ (DeviceId == V_PCH_LPTLP_PCIE_DEVICE_ID_PORT3_ALT) || \
+ (DeviceId == V_PCH_LPTLP_PCIE_DEVICE_ID_PORT4) || \
+ (DeviceId == V_PCH_LPTLP_PCIE_DEVICE_ID_PORT4_ALT) || \
+ (DeviceId == V_PCH_LPTLP_PCIE_DEVICE_ID_PORT5) || \
+ (DeviceId == V_PCH_LPTLP_PCIE_DEVICE_ID_PORT5_ALT) || \
+ (DeviceId == V_PCH_LPTLP_PCIE_DEVICE_ID_PORT6) || \
+ (DeviceId == V_PCH_LPTLP_PCIE_DEVICE_ID_PORT6_ALT) \
+ )
+
+#define IS_PCH_LPT_PCIE_DEVICE_ID(DeviceId) \
+ ( \
+ IS_PCH_LPTH_PCIE_DEVICE_ID(DeviceId) || \
+ IS_PCH_LPTLP_PCIE_DEVICE_ID(DeviceId) \
+ )
+
+//
+// HD Azalia Device ID macros
+//
+#define IS_PCH_LPTLP_HDA_DEVICE_ID(DeviceId) \
+ ( \
+ (DeviceId == V_PCH_LPTLP_HDA_DEVICE_ID) || \
+ (DeviceId == V_PCH_LPTLP_HDA_DEVICE_ID_ALT) \
+ )
+
+///
+/// Any device ID that is PCH LynxPoint
+///
+#define IS_PCH_LPTH_DEVICE_ID(DeviceId) \
+ ( \
+ IS_PCH_LPTH_LPC_DEVICE_ID (DeviceId) || \
+ IS_PCH_LPTH_SATA_DEVICE_ID (DeviceId) || \
+ IS_PCH_LPTH_USB_DEVICE_ID (DeviceId) || \
+ IS_PCH_LPTH_PCIE_DEVICE_ID (DeviceId) || \
+ (DeviceId) == V_PCH_LPTH_THERMAL_DEVICE_ID || \
+ (DeviceId) == V_PCH_LPTH_SMBUS_DEVICE_ID || \
+ (DeviceId) == V_PCH_LPTH_LAN_DEVICE_ID || \
+ (DeviceId) == V_PCH_LPTH_HDA_DEVICE_ID \
+ )
+
+///
+/// Any device ID that is PCH LynxPoint-LP
+///
+#define IS_PCH_LPTLP_DEVICE_ID(DeviceId) \
+ ( \
+ IS_PCH_LPTLP_LPC_DEVICE_ID (DeviceId) || \
+ IS_PCH_LPTLP_SATA_DEVICE_ID (DeviceId) || \
+ IS_PCH_LPTLP_USB_DEVICE_ID (DeviceId) || \
+ IS_PCH_LPTLP_PCIE_DEVICE_ID (DeviceId) || \
+ IS_PCH_LPTLP_HDA_DEVICE_ID (DeviceId) || \
+ (DeviceId == V_PCH_LPTLP_THERMAL_DEVICE_ID) || \
+ (DeviceId == V_PCH_LPTLP_SMBUS_DEVICE_ID) || \
+ (DeviceId == V_PCH_LPTLP_LAN_DEVICE_ID) || \
+ (DeviceId == V_PCH_LPTLP_ADSP_DEVICE_ID) || \
+ (DeviceId == V_PCH_LPTLP_DMA_DEVICE_ID) || \
+ (DeviceId == V_PCH_LPTLP_I2C0_DEVICE_ID) || \
+ (DeviceId == V_PCH_LPTLP_I2C1_DEVICE_ID) || \
+ (DeviceId == V_PCH_LPTLP_SPI0_DEVICE_ID) || \
+ (DeviceId == V_PCH_LPTLP_SPI1_DEVICE_ID) || \
+ (DeviceId == V_PCH_LPTLP_UART0_DEVICE_ID) || \
+ (DeviceId == V_PCH_UART1_SDIO_DEVICE_ID) || \
+ (DeviceId == V_PCH_LPTLP_SDIO_DEVICE_ID) \
+ )
+
+///
+/// Combined any device ID that is PCH LynxPoint or LynxPoint-LP
+///
+#define IS_PCH_LPT_DEVICE_ID(DeviceId) \
+ (\
+ IS_PCH_LPTH_DEVICE_ID(DeviceId) || \
+ IS_PCH_LPTLP_DEVICE_ID(DeviceId) \
+ )
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsAdsp.h b/ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsAdsp.h
new file mode 100644
index 0000000..94198e7
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsAdsp.h
@@ -0,0 +1,109 @@
+/** @file
+ Register names for Audio DSP block
+
+ Conventions:
+
+ - Prefixes:
+ Definitions beginning with "R_" are registers
+ Definitions beginning with "B_" are bits within registers
+ Definitions beginning with "V_" are meaningful values of bits within the registers
+ Definitions beginning with "S_" are register sizes
+ Definitions beginning with "N_" are the bit position
+ - In general, PCH registers are denoted by "_PCH_" in register names
+ - Registers / bits that are different between PCH generations are denoted by
+ "_PCH_<generation_name>_" in register/bit names. e.g., "_PCH_CPT_"
+ - Registers / bits that are different between SKUs are denoted by "_<SKU_name>"
+ at the end of the register/bit names
+ - Registers / bits of new devices introduced in a PCH generation will be just named
+ as "_PCH_" without <generation_name> inserted.
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PCH_REGS_ADSP_H_
+#define _PCH_REGS_ADSP_H_
+
+#ifdef ADSP_FLAG
+
+#define MMIO_ADDR_MASK 0xFFFFFFF0
+
+//
+// AUDIO DSP Registers (D19:F0)
+//
+#define PCI_DEVICE_NUMBER_PCH_ADSP 19
+#define PCI_FUNCTION_NUMBER_PCH_ADSP 0
+#define R_PCH_ADSP_VENDOR_ID 0x00
+#define V_PCH_ADSP_VENDOR_ID V_PCH_INTEL_VENDOR_ID
+#define R_PCH_LPTLP_ADSP_DEVICE_ID 0x02
+#define V_PCH_LPTLP_ADSP_DEVICE_ID 0x9C36
+
+//
+// Audio DSP PCI Configuration space definitions
+//
+#define R_PCH_ADSP_COMMAND 0x04
+#define B_PCH_ADSP_COMMAND_BME BIT2
+#define B_PCH_ADSP_COMMAND_MSE BIT1
+#define R_PCH_ADSP_ADBA 0x10
+#define R_PCH_ADSP_SPCBA 0x14
+#define R_PCH_ADSP_VDRTCTL0 0xA0
+#define B_PCH_ADSP_VDRTCTL0_D3SRAMPGD BIT2
+#define B_PCH_ADSP_VDRTCTL0_D3PGD BIT1
+#define R_PCH_ADSP_VDRTCTL2 0xA8
+#define V_PCH_ADSP_VDRTCTL2 0xFFF
+#define R_PCH_ADSP_PME_CTRL_STS 0x84
+#define B_PCH_ADSP_PME_CTRL_STS_PWR_ST (BIT1|BIT0)
+
+#define SB_DSP_ID 0xD7
+
+//
+// Audio DSP IOSF Sideband interface definitions
+//
+#define R_PCH_RCRB_IOBPIRI_IOBPIS_ADSP 0xD7000000 ///< ADSP
+
+#define R_PCH_ADSP_VDLDAT1 0x624
+#define V_PCH_ADSP_VDLDAT1_CCO 0x40100
+
+#define R_PCH_ADSP_VDLDAT2 0x628
+#define V_PCH_ADSP_VDLDAT2_MASK 0xFFFF
+#define V_PCH_ADSP_VDLDAT2_IRQ3 0xD9D8
+#define V_PCH_ADSP_VDLDAT2_IRQ3_INV 0xD8D9
+#define V_PCH_ADSP_VDLDAT2_IRQ4 0xDBDA
+
+#define R_PCH_ADSP_PCICFGCTL 0x500
+#define B_PCH_ADSP_PCICFGCTL_PCICD BIT0
+#define B_PCH_ADSP_PCICFGCTL_ACPIIE BIT1
+#define B_PCH_ADSP_PCICFGCTL_SPCBAD BIT7
+
+#define R_PCH_ADSP_PMCTL 0x1E0
+#define V_PCH_ADSP_PMCTL 0x3F
+
+//
+// Audio DSP Shim registers
+//
+#define R_PCH_ADSP_SHIM_BASE 0xE7000
+#define R_PCH_ADSP_SHIM_LTRC 0xE0
+#define V_PCH_ADSP_SHIM_LTRC 0x3003
+
+// ACPI Interrupt
+#define R_PCH_ADSP_SHIM_IMC 0x28
+#define V_PCH_ADSP_SHIM_IMC 0x7FFF0000
+#define R_PCH_ADSP_SHIM_IPCD 0x40
+#define V_PCH_ADSP_SHIM_IPCD_1 0x80000000
+#define V_PCH_ADSP_SHIM_IPCD_2 0x04000000
+
+#endif // ADSP_FLAG
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsHda.h b/ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsHda.h
new file mode 100644
index 0000000..45b324d
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsHda.h
@@ -0,0 +1,399 @@
+/** @file
+ Register names for PCH High Definition Audio device.
+
+ Conventions:
+
+ - Prefixes:
+ Definitions beginning with "R_" are registers
+ Definitions beginning with "B_" are bits within registers
+ Definitions beginning with "V_" are meaningful values of bits within the registers
+ Definitions beginning with "S_" are register sizes
+ Definitions beginning with "N_" are the bit position
+ - In general, PCH registers are denoted by "_PCH_" in register names
+ - Registers / bits that are different between PCH generations are denoted by
+ "_PCH_<generation_name>_" in register/bit names. e.g., "_PCH_LPT_"
+ - Registers / bits that are different between SKUs are denoted by "_<SKU_name>"
+ at the end of the register/bit names
+ - Registers / bits of new devices introduced in a PCH generation will be just named
+ as "_PCH_" without <generation_name> inserted.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PCH_REGS_HDA_H_
+#define _PCH_REGS_HDA_H_
+
+//
+// Azalia Controller Registers (D27:F0)
+//
+#define PCI_DEVICE_NUMBER_PCH_AZALIA 27
+#define PCI_FUNCTION_NUMBER_PCH_AZALIA 0
+
+#define R_PCH_HDA_VENDOR_ID 0x00
+#define V_PCH_HDA_VENDOR_ID V_PCH_INTEL_VENDOR_ID
+#define R_PCH_HDA_DEVICE_ID 0x02
+#define V_PCH_LPTH_HDA_DEVICE_ID 0x8C20
+#define V_PCH_LPTLP_HDA_DEVICE_ID 0x9C20 ///< Azalia Device ID bit[0] fuse = 0
+#define V_PCH_LPTLP_HDA_DEVICE_ID_ALT 0x9C21 ///< Azalia Device ID bit[0] fuse = 1
+#define R_PCH_HDA_COMMAND 0x04
+#define B_PCH_HDA_COMMAND_INTR_DIS BIT10
+#define B_PCH_HDA_COMMAND_FBE BIT9
+#define B_PCH_HDA_COMMAND_SERR_EN BIT8
+#define B_PCH_HDA_COMMAND_WCC BIT7
+#define B_PCH_HDA_COMMAND_PER BIT6
+#define B_PCH_HDA_COMMAND_VPS BIT5
+#define B_PCH_HDA_COMMAND_MWIE BIT4
+#define B_PCH_HDA_COMMAND_SCE BIT3
+#define B_PCH_HDA_COMMAND_BME BIT2
+#define B_PCH_HDA_COMMAND_MSE BIT1
+#define B_PCH_HDA_COMMAND_IOSE BIT0
+#define R_PCH_HDA_STS 0x06
+#define B_PCH_HDA_STS_DPE BIT15
+#define B_PCH_HDA_STS_SSE BIT14
+#define B_PCH_HDA_STS_RMA BIT13
+#define B_PCH_HDA_STS_RTA BIT12
+#define B_PCH_HDA_STS_STA BIT11
+#define B_PCH_HDA_STS_DEV_STS (BIT10 | BIT9)
+#define B_PCH_HDA_STS_DPED BIT8
+#define B_PCH_HDA_STS_FB2BC BIT7
+#define B_PCH_HDA_STS_66MHZ_CAP BIT5
+#define B_PCH_HDA_STS_CAP_LST BIT4
+#define B_PCH_HDA_STS_INTR_STS BIT3
+#define R_PCH_HDA_RID 0x08
+#define B_PCH_HDA_RID 0xFF
+#define R_PCH_HDA_PI 0x09
+#define B_PCH_HDA_PI 0xFF
+#define R_PCH_HDA_SCC 0x0A
+#define B_PCH_HDA_SCC 0xFF
+#define R_PCH_HDA_BCC 0x0B
+#define B_PCH_HDA_BCC 0xFF
+#define R_PCH_HDA_CLS 0x0C
+#define B_PCH_HDA_CLS 0xFF
+#define R_PCH_HDA_LT 0x0D
+#define B_PCH_HDA_LT 0xFF
+#define R_PCH_HDA_HEADTYPE 0x0E
+#define B_PCH_HDA_HEADTYPE 0xFF
+#define R_PCH_HDA_HDBARL 0x10
+#define B_PCH_HDA_HDBARL_LBA 0xFFFFC000
+#define B_PCH_HDA_HDBARL_PREF BIT3
+#define B_PCH_HDA_HDBARL_ADDRNG (BIT2 | BIT1)
+#define B_PCH_HDA_HDBARL_SPTYP BIT0
+#define V_PCH_HDA_HDBAR_SIZE (1 << 14)
+#define R_PCH_HDA_HDBARU 0x14
+#define B_PCH_HDA_HDBARU_UBA 0xFFFFFFFF
+#define R_PCH_HDA_SVID 0x2C
+#define B_PCH_HDA_SVID 0xFFFF
+#define R_PCH_HDA_SID 0x2E
+#define B_PCH_HDA_SID 0xFFFF
+#define R_PCH_HDA_CAPPTR 0x34
+#define B_PCH_HDA_CAPPTR 0xFF
+#define R_PCH_HDA_INTLN 0x3C
+#define B_PCH_HDA_INTLN 0xFF
+#define R_PCH_HDA_INTPN 0x3D
+#define B_PCH_HDA_INTPN 0x0F
+#define R_PCH_HDA_HDCTL 0x40
+#define B_PCH_HDA_HDCTL_BCLD BIT1
+#define B_PCH_HDA_HDCTL_MODE BIT0
+#define R_PCH_HDA_AZIOBC 0x42
+#define B_PCH_HDA_AZIOBC_OSEL (BIT7 | BIT6)
+#define B_PCH_HDA_AZIOBC_AVDDIS BIT2
+#define R_PCH_HDA_TCSEL 0x44
+#define B_PCH_HDA_TCSEL (BIT2 | BIT1 | BIT0)
+#define V_PCH_HDA_TCSEL_TC0 0x00
+#define V_PCH_HDA_TCSEL_TC1 0x01
+#define V_PCH_HDA_TCSEL_TC2 0x02
+#define V_PCH_HDA_TCSEL_TC3 0x03
+#define V_PCH_HDA_TCSEL_TC4 0x04
+#define V_PCH_HDA_TCSEL_TC5 0x05
+#define V_PCH_HDA_TCSEL_TC6 0x06
+#define V_PCH_HDA_TCSEL_TC7 0x07
+#define R_PCH_HDA_DCKCTL 0x4C
+#define B_PCH_HDA_DCKCTL_DA BIT0
+#define R_PCH_HDA_DCKSTS 0x4D
+#define B_PCH_HDA_DCKSTS_DS BIT7
+#define B_PCH_HDA_DCKSTS_DM BIT0
+#define R_PCH_HDA_PID 0x50
+#define B_PCH_HDA_PID_NEXT 0xFF00
+#define B_PCH_HDA_PID_CAP 0x00FF
+#define R_PCH_HDA_PC 0x52
+#define B_PCH_HDA_PC_PME 0xF800
+#define B_PCH_HDA_PC_D2_SUP BIT10
+#define B_PCH_HDA_PC_D1_SUP BIT9
+#define B_PCH_HDA_PC_AUX (BIT8 | BIT7 | BIT6)
+#define B_PCH_HDA_PC_DSI BIT5
+#define B_PCH_HDA_PC_PMEC BIT3
+#define B_PCH_HDA_PC_VER (BIT2 | BIT1 | BIT0)
+#define R_PCH_HDA_PCS 0x54
+#define B_PCH_HDA_PCS_DATA 0xFF000000
+#define B_PCH_HDA_PCS_CCE BIT23
+#define B_PCH_HDA_PCS_PMES BIT15
+#define B_PCH_HDA_PCS_PMEE BIT8
+#define B_PCH_HDA_PCS_PS (BIT1 | BIT0)
+#define V_PCH_HDA_PCS_PS0 0x00
+#define V_PCH_HDA_PCS_PS3 0x03
+#define R_PCH_HDA_MID 0x60
+#define B_PCH_HDA_MID_NEXT 0xFF00
+#define B_PCH_HDA_MID_CAP 0x00FF
+#define R_PCH_HDA_MMC 0x62
+#define B_PCH_HDA_MMC_64ADD BIT7
+#define B_PCH_HDA_MMC_MME (BIT6 | BIT5 | BIT4)
+#define B_PCH_HDA_MMC_MMC (BIT3 | BIT2 | BIT1)
+#define B_PCH_HDA_MMC_ME BIT0
+#define R_PCH_HDA_MMLA 0x64
+#define B_PCH_HDA_MMLA 0xFFFFFFFC
+#define R_PCH_HDA_MMUA 0x68
+#define B_PCH_HDA_MMUA 0xFFFFFFFF
+#define R_PCH_HDA_MMD 0x6C
+#define B_PCH_HDA_MMD 0xFFFF
+#define R_PCH_HDA_PXID 0x70
+#define B_PCH_HDA_PXID_NEXT 0xFF00
+#define B_PCH_HDA_PXID_CAP 0x00FF
+#define R_PCH_HDA_PXC 0x72
+#define B_PCH_HDA_PXC_IMN 0x3E00
+#define B_PCH_HDA_PXC_SI BIT8
+#define B_PCH_HDA_PXC_DPT 0x00F0
+#define B_PCH_HDA_PXC_CV 0x000F
+#define R_PCH_HDA_DEVCAP 0x74
+#define B_PCH_HDA_DEVCAP_FLR BIT28
+#define B_PCH_HDA_DEVCAP_SPLS (BIT27 | BIT26)
+#define B_PCH_HDA_DEVCAP_SPLV 0x03FC0000
+#define B_PCH_HDA_DEVCAP_PWRIP BIT14
+#define B_PCH_HDA_DEVCAP_ATTNIP BIT13
+#define B_PCH_HDA_DEVCAP_ATTNBP BIT12
+#define B_PCH_HDA_DEVCAP_EL1AL 0x00000E00
+#define B_PCH_HDA_DEVCAP_EL0AL 0x000001C0
+#define B_PCH_HDA_DEVCAP_ETFS BIT5
+#define B_PCH_HDA_DEVCAP_PFS (BIT4 | BIT3)
+#define B_PCH_HDA_DEVCAP_MPSS 0x00000007
+#define R_PCH_HDA_DEVC 0x78
+#define B_PCH_HDA_DEVC_IF BIT15
+#define B_PCH_HDA_DEVC_MRRS (BIT13 | BIT12 | BIT11)
+#define B_PCH_HDA_DEVC_NSNPEN BIT11
+#define B_PCH_HDA_DEVC_APE BIT10
+#define B_PCH_HDA_DEVC_PFE BIT9
+#define B_PCH_HDA_DEVC_ETFE BIT8
+#define B_PCH_HDA_DEVC_MPS (BIT7 | BIT6 | BIT5)
+#define B_PCH_HDA_DEVC_ERO BIT4
+#define B_PCH_HDA_DEVC_URRE BIT3
+#define B_PCH_HDA_DEVC_FERE BIT2
+#define B_PCH_HDA_DEVC_NFERE BIT1
+#define B_PCH_HDA_DEVC_CERE BIT0
+#define R_PCH_HDA_DEVS 0x7A
+#define B_PCH_HDA_DEVS_TP BIT5
+#define B_PCH_HDA_DEVS_AUXPD BIT4
+#define B_PCH_HDA_DEVS_URD BIT3
+#define B_PCH_HDA_DEVS_FED BIT2
+#define B_PCH_HDA_DEVS_NFED BIT1
+#define B_PCH_HDA_DEVS_CED BIT0
+#define R_PCH_HDA_VCCAP 0x100
+#define B_PCH_HDA_VCCAP_NCO 0xFFF00000
+#define B_PCH_HDA_VCCAP_CAPVER 0x000F0000
+#define B_PCH_HDA_VCCAP_PCIEEC 0x0000FFFF
+#define R_PCH_HDA_PVCCAP1 0x104
+#define B_PCH_HDA_PVCCAP1_PATES 0x00000C00
+#define B_PCH_HDA_PVCCAP1_RC 0x00000300
+#define B_PCH_HDA_PVCCAP1_LPEVCC 0x00000070
+#define B_PCH_HDA_PVCCAP1_EVCC 0x00000007
+#define R_PCH_HDA_PVCCAP2 0x108
+#define B_PCH_HDA_PVCCAP2_VCATO 0xFF000000
+#define B_PCH_HDA_PVCCAP2_VCAC 0x000000FF
+#define R_PCH_HDA_PVCCTL 0x10C
+#define B_PCH_HDA_PVCCTL_VCAS 0x000E
+#define B_PCH_HDA_PVCCTL_LVCAT 0x0001
+#define R_PCH_HDA_PVCSTS 0x10E
+#define B_PCH_HDA_PVCSTS_VCATS 0x0001
+#define R_PCH_HDA_VC0CAP 0x110
+#define S_PCH_HDA_VC0CAP 4
+#define B_PCH_HDA_VC0CAP_PATO 0xFF000000
+#define B_PCH_HDA_VC0CAP_MTS 0x007F0000
+#define B_PCH_HDA_VC0CAP_RST BIT15
+#define B_PCH_HDA_VC0CAP_APS BIT14
+#define B_PCH_HDA_VC0CAP_PAC 0x000000FF
+#define R_PCH_HDA_VC0CTL 0x114
+#define S_PCH_HDA_VC0CTL 4
+#define B_PCH_HDA_VC0CTL_VC0EN BIT31
+#define B_PCH_HDA_VC0CTL_VC0ID 0x07000000
+#define B_PCH_HDA_VC0CTL_PAS 0x000E0000
+#define B_PCH_HDA_VC0CTL_LPAT BIT16
+#define B_PCH_HDA_VC0CTL_TCVC0_MAP 0x000000FE
+#define R_PCH_HDA_VC0STS 0x11A
+#define S_PCH_HDA_VC0STS 2
+#define B_PCH_HDA_VC0STS_VC0NP BIT1
+#define B_PCH_HDA_VC0STS_PATS BIT0
+#define R_PCH_HDA_VCICAP 0x11C
+#define S_PCH_HDA_VCICAP 4
+#define B_PCH_HDA_VCICAP_PATO 0xFF000000
+#define B_PCH_HDA_VCICAP_MTS 0x007F0000
+#define B_PCH_HDA_VCICAP_RST BIT15
+#define B_PCH_HDA_VCICAP_APS BIT14
+#define B_PCH_HDA_VCICAP_PAC 0x000000FF
+#define R_PCH_HDA_VCICTL 0x120
+#define S_PCH_HDA_VCICTL 4
+#define B_PCH_HDA_VCICTL_EN BIT31
+#define B_PCH_HDA_VCICTL_ID (BIT26 | BIT25 | BIT24)
+#define V_PCH_HDA_VCICTL_PAS 0x000E0000
+#define V_PCH_HDA_VCICTL_LPAT BIT16
+#define B_PCH_HDA_VCICTL_TCVCI_MAP 0x000000FE
+#define R_PCH_HDA_VCISTS 0x126
+#define S_PCH_HDA_VCISTS 1
+#define B_PCH_HDA_VCISTS_VCINP BIT1
+#define B_PCH_HDA_VCISTS_PATS BIT0
+#define R_PCH_HDA_RCCAP 0x130
+#define B_PCH_HDA_RCCAP_NCO 0xFFF00000
+#define B_PCH_HDA_RCCAP_CV 0x000F0000
+#define B_PCH_HDA_RCCAP_PCIEECID 0x0000FFFF
+#define R_PCH_HDA_ESD 0x134
+#define B_PCH_HDA_ESD_PN 0xFF000000
+#define B_PCH_HDA_ESD_CID 0x00FF0000
+#define B_PCH_HDA_ESD_NOLE 0x0000FF00
+#define B_PCH_HDA_ESD_ELTYP 0x0000000F
+#define R_PCH_HDA_L1DESC 0x140
+#define S_PCH_HDA_L1DESC 4
+#define B_PCH_HDA_LIDESC_TPN 0xFF000000
+#define B_PCH_HDA_LIDESC_TCID 0x00FF0000
+#define B_PCH_HDA_LIDESC_LT BIT1
+#define B_PCH_HDA_LIDESC_LV BIT0
+#define R_PCH_HDA_L1ADDL 0x148
+#define B_PCH_HDA_L1ADDL_LNK1LA 0xFFFFC000
+#define R_PCH_HDA_L1ADDU 0x14C
+#define B_PCH_HDA_L1ADDU 0xFFFFFFFF
+//
+// Intel High Definition Audio Memory Mapped Configuration Registers
+//
+#define R_HDA_GCAP 0x00
+#define S_HDA_GCAP 2
+#define B_HDA_GCAP_NOSSUP 0xF000
+#define B_HDA_GCAP_NISSUP 0x0F00
+#define B_HDA_GCAP_NBSSUP 0x00F8
+#define B_HDA_GCAP_NSDOS BIT1
+#define B_HDA_GCAP_64ADSUP BIT0
+#define R_HDA_VMIN 0x02
+#define B_HDA_VMIN_MV 0xFF
+#define R_HDA_VMAJ 0x03
+#define B_HDA_VMAJ_MV 0xFF
+#define R_HDA_OUTPAY 0x04
+#define B_HDA_OUTPAY_CAP 0x007F
+#define R_HDA_INPAY 0x06
+#define B_HDA_INPAY_CAP 0x007F
+#define R_HDA_GCTL 0x08
+#define B_HDA_GCTL_AURE BIT8
+#define B_HDA_GCTL_FC BIT1
+#define B_HDA_GCTL_CRST BIT0
+#define R_HDA_WAKEEN 0x0C
+#define B_HDA_WAKEEN_SDI_3 BIT3
+#define B_HDA_WAKEEN_SDI_2 BIT2
+#define B_HDA_WAKEEN_SDI_1 BIT1
+#define B_HDA_WAKEEN_SDI_0 BIT0
+#define R_HDA_STATESTS 0x0E
+#define B_HDA_STATESTS_SDIN3 BIT3
+#define B_HDA_STATESTS_SDIN2 BIT2
+#define B_HDA_STATESTS_SDIN1 BIT1
+#define B_HDA_STATESTS_SDIN0 BIT0
+#define R_HDA_GSTS 0x10
+#define B_HDA_GSTS_FS BIT1
+#define R_HDA_OUTSTRMPAY 0x18
+#define S_HDA_OUTSTRMPAY 2
+#define B_HDA_OUTSTRMPAY_OUTSTRMPAY 0xFFFF
+#define R_HDA_INSTRMPAY 0x1A
+#define B_HDA_INSTRMPAY_INSTRMPAY 0xFFFF
+#define R_HDA_INTCTL 0x20
+#define B_HDA_INTCTL_GIE BIT31
+#define B_HDA_INTCTL_CIE BIT30
+#define B_HDA_INTCTL_SIE_OS4 BIT7
+#define B_HDA_INTCTL_SIE_OS3 BIT6
+#define B_HDA_INTCTL_SIE_OS2 BIT5
+#define B_HDA_INTCTL_SIE_OS1 BIT4
+#define B_HDA_INTCTL_SIE_IS4 BIT3
+#define B_HDA_INTCTL_SIE_IS3 BIT2
+#define B_HDA_INTCTL_SIE_IS2 BIT1
+#define B_HDA_INTCTL_SIE_IS1 BIT0
+#define R_HDA_INTSTS 0x24
+#define B_HDA_INTSTS_GIS BIT31
+#define B_HDA_INTSTS_CIS BIT30
+#define B_HDA_INTSTS_SIS_OS4 BIT7
+#define B_HDA_INTSTS_SIS_OS3 BIT6
+#define B_HDA_INTSTS_SIS_OS2 BIT5
+#define B_HDA_INTSTS_SIS_OS1 BIT4
+#define B_HDA_INTSTS_SIS_IS4 BIT3
+#define B_HDA_INTSTS_SIS_IS3 BIT2
+#define B_HDA_INTSTS_SIS_IS2 BIT1
+#define B_HDA_INTSTS_SIS_IS1 BIT0
+#define R_HDA_WALCLK 0x30
+#define B_HDA_WALCLK_WCC 0xFFFFFFFF
+#define R_HDA_SSYNC 0x38
+#define S_HDA_SSYNC 4
+#define B_HDA_SSYNC_OS4 BIT7
+#define B_HDA_SSYNC_OS3 BIT6
+#define B_HDA_SSYNC_OS2 BIT5
+#define B_HDA_SSYNC_OS1 BIT4
+#define B_HDA_SSYNC_IS4 BIT3
+#define B_HDA_SSYNC_IS3 BIT2
+#define B_HDA_SSYNC_IS2 BIT1
+#define B_HDA_SSYNC_IS1 BIT0
+#define R_HDA_CORBLBASE 0x40
+#define B_HDA_CORBLBASE_BA 0xFFFFFF80
+#define B_HDA_CORBLBASE_UB 0x0000007F
+#define R_HDA_CORBUBASE 0x44
+#define B_HDA_CORBUBASE_BA 0xFFFFFFFF
+#define R_HDA_CORBWP 0x48
+#define B_HDA_CORBWP 0x000000FF
+#define R_HDA_CORBRP 0x4A
+#define B_HDA_CORBRP_PRST BIT15
+#define B_HDA_CORBRP_RP 0x00FF
+#define R_HDA_CORBCTL 0x4C
+#define B_HDA_CORBCTL_DMA_EN BIT1
+#define B_HDA_CORBCTL_MEMERRINTR_EN BIT0
+#define R_HDA_CORBST 0x4D
+#define B_HDA_CORBST_CMEI BIT0
+#define R_HDA_CORBSIZE 0x4E
+#define B_HDA_CORBSIZE_CAP 0xF0
+#define B_HDA_CORBSIZE_SIZE 0x03
+#define R_HDA_RIRBLBASE 0x50
+#define B_HDA_RIRBLBASE_BA 0xFFFFFF80
+#define B_HDA_RIRBLBASE_UB 0x0000007F
+#define R_HDA_RIRBUBASE 0x54
+#define B_HDA_RIRBUBASE_BA 0xFFFFFFFF
+#define R_HDA_RIRBWP 0x58
+#define B_HDA_RIRBWP_RST BIT15
+#define B_HDA_RIRBWP_WP 0x00FF
+#define R_HDA_RINTCNT 0x5A
+#define B_HDA_RINTCNT 0x00FF
+#define R_HDA_RIRBCTL 0x5C
+#define B_HDA_RIRBCTL_ROIC BIT2
+#define B_HDA_RIRBCTL_DMA BIT1
+#define B_HDA_RIRBCTL_RIC BIT0
+#define R_HDA_RIRBSTS 0x5D
+#define B_HDA_RIRBSTS_ROIS BIT2
+#define B_HDA_RIRBSTS_RI BIT0
+#define R_HDA_RIRBSIZE 0x5E
+#define B_HDA_RIRBSIZE_CAP 0xF0
+#define B_HDA_RIRBSIZE_SIZE 0x03
+#define R_HDA_IC 0x60
+#define B_HDA_IC 0xFFFFFFFF
+#define R_HDA_IR 0x64
+#define B_HDA_IR 0xFFFFFFFF
+#define R_HDA_IRS 0x68
+#define B_HDA_IRS_IRV BIT1
+#define B_HDA_IRS_ICB BIT0
+#define R_HDA_DPLBASE 0x70
+#define B_HDA_DPLBASE_LBA 0xFFFFFF80
+#define B_HDA_DPLBASE_LBU 0x0000007E
+#define B_HDA_DPLBASE_BUF_EN 0x00000001
+#define R_HDA_DPUBASE 0x74
+#define B_HDA_DPUBASE_UBA 0xFFFFFFFF
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsLan.h b/ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsLan.h
new file mode 100644
index 0000000..ff91dbf
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsLan.h
@@ -0,0 +1,196 @@
+/** @file
+ Register names for PCH LAN device
+
+ Conventions:
+
+ - Prefixes:
+ Definitions beginning with "R_" are registers
+ Definitions beginning with "B_" are bits within registers
+ Definitions beginning with "V_" are meaningful values of bits within the registers
+ Definitions beginning with "S_" are register sizes
+ Definitions beginning with "N_" are the bit position
+ - In general, PCH registers are denoted by "_PCH_" in register names
+ - Registers / bits that are different between PCH generations are denoted by
+ "_PCH_<generation_name>_" in register/bit names. e.g., "_PCH_LPT_"
+ - Registers / bits that are different between SKUs are denoted by "_<SKU_name>"
+ at the end of the register/bit names
+ - Registers / bits of new devices introduced in a PCH generation will be just named
+ as "_PCH_" without <generation_name> inserted.
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PCH_REGS_LAN_H_
+#define _PCH_REGS_LAN_H_
+
+//
+// LAN Controller Registers (D25:F0)
+//
+#define PCI_BUS_NUMBER_PCH_LAN 0
+#define PCI_DEVICE_NUMBER_PCH_LAN 25
+#define PCI_FUNCTION_NUMBER_PCH_LAN 0
+
+#define R_PCH_LAN_VENDOR_ID 0x00
+#define V_PCH_LAN_VENDOR_ID V_PCH_INTEL_VENDOR_ID
+#define R_PCH_LAN_DEVICE_ID 0x02
+#define V_PCH_LPTH_LAN_DEVICE_ID 0x8C33
+#define V_PCH_LPTLP_LAN_DEVICE_ID 0x155A
+#define R_PCH_LAN_CMD 0x04
+#define B_PCH_LAN_CMD_INTR_DIS BIT10
+#define B_PCH_LAN_CMD_FBE BIT9
+#define B_PCH_LAN_CMD_SERR_EN BIT8
+#define B_PCH_LAN_CMD_WCC BIT7
+#define B_PCH_LAN_CMD_PER BIT6
+#define B_PCH_LAN_CMD_PSE BIT5
+#define B_PCH_LAN_CMD_PMWE BIT4
+#define B_PCH_LAN_CMD_SCE BIT3
+#define B_PCH_LAN_CMD_BME BIT2
+#define B_PCH_LAN_CMD_MSE BIT1
+#define B_PCH_LAN_CMD_IOSE BIT0
+#define R_PCH_LAN_STS 0x06
+#define B_PCH_LAN_STS_DPE BIT15
+#define B_PCH_LAN_STS_SSE BIT14
+#define B_PCH_LAN_STS_RMA BIT13
+#define B_PCH_LAN_STS_RTA BIT12
+#define B_PCH_LAN_STS_STA BIT11
+#define B_PCH_LAN_STS_DEV_STS (BIT10 | BIT9)
+#define B_PCH_LAN_STS_DPED BIT8
+#define B_PCH_LAN_STS_FB2BC BIT7
+#define B_PCH_LAN_STS_66MHZ_CAP BIT5
+#define B_PCH_LAN_STS_CAP_LST BIT4
+#define B_PCH_LAN_STS_INTR_STS BIT3
+#define R_PCH_LAN_RID 0x08
+#define B_PCH_LAN_RID 0xFF
+#define R_PCH_LAN_CC 0x09
+#define S_PCH_LAN_CC 3
+#define B_PCH_LAN_CC 0xFFFFFF
+#define R_PCH_LAN_CLS 0x0C
+#define B_PCH_LAN_CLS 0xFF
+#define R_PCH_LAN_PLT 0x0D
+#define B_PCH_LAN_PLT 0xFF
+#define R_PCH_LAN_HEADTYPE 0x0E
+#define B_PCH_LAN_HEADTYPE 0xFF
+#define R_PCH_LAN_MEM_BASE_A 0x10
+#define B_PCH_LAN_MBARA_BA 0xFFFF8000
+#define B_PCH_LAN_MBARA_MSIZE 0x00007FF0
+#define B_PCH_LAN_MBARA_PM BIT3
+#define B_PCH_LAN_MBARA_MT (BIT2 | BIT1)
+#define B_PCH_LAN_MBARA_MIOS BIT0
+#define R_PCH_LAN_MBARB 0x14
+#define B_PCH_LAN_MBARB_BA 0xFFFFF000
+#define B_PCH_LAN_MBARB_MSIZE 0x00000FF0
+#define B_PCH_LAN_MBARB_PM BIT3
+#define B_PCH_LAN_MBARB_MT (BIT2 | BIT1)
+#define B_PCH_LAN_MBARB_MIOS BIT0
+#define R_PCH_LAN_MBARC 0x18
+#define B_PCH_LAN_MBARC_BA 0xFFFFFFE0
+#define B_PCH_LAN_MBARC_IOSIZE 0x0000001E
+#define B_PCH_LAN_MBARC_MIOS BIT0
+#define R_PCH_LAN_SVID 0x2C
+#define B_PCH_LAN_SVID 0xFFFF
+#define R_PCH_LAN_SID 0x2E
+#define B_PCH_LAN_SID 0xFFFF
+#define R_PCH_LAN_ERBA 0x30
+#define B_PCH_LAN_ERBA 0xFFFFFFFF
+#define R_PCH_LAN_CAP_PTR 0x34
+#define B_PCH_LAN_CAP_PTR 0xFF
+#define R_PCH_LAN_INTR 0x3C
+#define B_PCH_LAN_INTR_IPIN 0xFF00
+#define B_PCH_LAN_INTR_ILINE 0x00FF
+#define V_PCH_LAN_MEM_LENGTH 0x8000
+#define N_PCH_LAN_MEM_ALIGN 15
+#define R_PCH_LAN_LTR_CAP 0xA8
+#define R_PCH_LAN_CLIST1 0xC8
+#define B_PCH_LAN_CLIST1_NEXT 0xFF00
+#define B_PCH_LAN_CLIST1_CID 0x00FF
+#define R_PCH_LAN_PMC 0xCA
+#define B_PCH_LAN_PMC_PMES 0xF800
+#define B_PCH_LAN_PMC_D2S BIT10
+#define B_PCH_LAN_PMC_D1S BIT9
+#define B_PCH_LAN_PMC_AC (BIT8 | BIT7 | BIT6)
+#define B_PCH_LAN_PMC_DSI BIT5
+#define B_PCH_LAN_PMC_PMEC BIT3
+#define B_PCH_LAN_PMC_VS (BIT2 | BIT1 | BIT0)
+#define R_PCH_LAN_PMCS 0xCC
+#define B_PCH_LAN_PMCS_PMES BIT15
+#define B_PCH_LAN_PMCS_DSC (BIT14 | BIT13)
+#define B_PCH_LAN_PMCS_DSL 0x1E00
+#define V_PCH_LAN_PMCS_DSL0 0x0000
+#define V_PCH_LAN_PMCS_DSL3 0x0600
+#define V_PCH_LAN_PMCS_DSL4 0x0800
+#define V_PCH_LAN_PMCS_DSL7 0x0E00
+#define V_PCH_LAN_PMCS_DSL8 0x1000
+#define B_PCH_LAN_PMCS_PMEE BIT8
+#define B_PCH_LAN_PMCS_PS (BIT1 | BIT0)
+#define V_PCH_LAN_PMCS_PS0 0x00
+#define V_PCH_LAN_PMCS_PS3 0x03
+#define R_PCH_LAN_DR 0xCF
+#define B_PCH_LAN_DR 0xFF
+#define R_PCH_LAN_CLIST2 0xD0
+#define B_PCH_LAN_CLIST2_NEXT 0xFF00
+#define B_PCH_LAN_CLIST2_CID 0x00FF
+#define R_PCH_LAN_MCTL 0xD2
+#define B_PCH_LAN_MCTL_CID BIT7
+#define B_PCH_LAN_MCTL_MME (BIT6 | BIT5 | BIT4)
+#define B_PCH_LAN_MCTL_MMC (BIT3 | BIT2 | BIT1)
+#define B_PCH_LAN_MCTL_MSIE BIT0
+#define R_PCH_LAN_MADDL 0xD4
+#define B_PCH_LAN_MADDL 0xFFFFFFFF
+#define R_PCH_LAN_MADDH 0xD8
+#define B_PCH_LAN_MADDH 0xFFFFFFFF
+#define R_PCH_LAN_MDAT 0xDC
+#define B_PCH_LAN_MDAT 0xFFFFFFFF
+#define R_PCH_LAN_FLRCAP 0xE0
+#define B_PCH_LAN_FLRCAP_NEXT 0xFF00
+#define B_PCH_LAN_FLRCAP_CID 0x00FF
+#define V_PCH_LAN_FLRCAP_CID_SSEL0 0x13
+#define V_PCH_LAN_FLRCAP_CID_SSEL1 0x09
+#define R_PCH_LAN_FLRCLV 0xE2
+#define B_PCH_LAN_FLRCLV_FLRC_SSEL0 BIT9
+#define B_PCH_LAN_FLRCLV_TXP_SSEL0 BIT8
+#define B_PCH_LAN_FLRCLV_VSCID_SSEL1 0xF000
+#define B_PCH_LAN_FLRCLV_CAPVER_SSEL1 0x0F00
+#define B_PCH_LAN_FLRCLV_CAPLNG 0x00FF
+#define R_PCH_LAN_DEVCTRL 0xE4
+#define B_PCH_LAN_DEVCTRL BIT0
+//
+// Gigabit LAN Capabilities and Status Registers (Memory space)
+//
+#define R_PCH_MBARA_GBECSR1 0x0000
+#define B_PCH_MBARA_GBECSR1_PHYPDN BIT24
+#define R_PCH_MBARA_GBECSR2 0x0018
+#define B_PCH_MBARA_GBECSR2_PHYPDEN BIT20
+#define R_PCH_MBARA_GBECSR3 0x0020
+#define B_PCH_MBARA_GBECSR3_RB BIT28
+#define B_PCH_MBARA_GBECSR3_MDI_TYPE (BIT27 | BIT26)
+#define B_PCH_MBARA_GBECSR3_DATA 0x0000FFFF
+#define R_PCH_MBARA_GBECSR4 0x002C
+#define B_PCH_MBARA_GBECSR4_WIV BIT31
+#define B_PCH_MBARA_GBECSR4_WESB BIT30
+#define R_PCH_MBARA_GBECSR5 0x0F00
+#define B_PCH_MBARA_GBECSR5_SWFLAG BIT5
+#define R_PCH_MBARA_GBECSR6 0x0F10
+#define B_PCH_MBARA_GBECSR6_GGD BIT6
+#define B_PCH_MBARA_GBECSR6_GbE_DIS BIT3
+#define B_PCH_MBARA_GBECSR6_LPLUND BIT2
+#define B_PCH_MBARA_GBECSR6_LPLUD BIT1
+#define R_PCH_MBARA_GBECSR7 0x5400
+#define R_PCH_MBARA_GBECSR8 0x5404
+#define B_PCH_MBARA_GBECSR8_RAH 0x0000FFFF
+#define R_PCH_MBARA_GBECSR9 0x5800
+#define B_PCH_MBARA_GBECSR9_APME BIT0
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsLpc.h b/ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsLpc.h
new file mode 100644
index 0000000..c922e27
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsLpc.h
@@ -0,0 +1,1018 @@
+/** @file
+ Register names for PCH LPC device
+
+ Conventions:
+
+ - Prefixes:
+ Definitions beginning with "R_" are registers
+ Definitions beginning with "B_" are bits within registers
+ Definitions beginning with "V_" are meaningful values of bits within the registers
+ Definitions beginning with "S_" are register sizes
+ Definitions beginning with "N_" are the bit position
+ - In general, PCH registers are denoted by "_PCH_" in register names
+ - Registers / bits that are different between PCH generations are denoted by
+ "_PCH_<generation_name>_" in register/bit names. e.g., "_PCH_LPT_"
+ - Registers / bits that are different between SKUs are denoted by "_<SKU_name>"
+ at the end of the register/bit names
+ - Registers / bits of new devices introduced in a PCH generation will be just named
+ as "_PCH_" without <generation_name> inserted.
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PCH_REGS_LPC_H_
+#define _PCH_REGS_LPC_H_
+
+//
+// PCI to LPC Bridge Registers (D31:F0)
+//
+#define PCI_DEVICE_NUMBER_PCH_LPC 31
+#define PCI_FUNCTION_NUMBER_PCH_LPC 0
+
+#define PCH_HPET_BDF_MAX 8
+
+typedef enum {
+ LptHB0 = 0,
+ LptHC0,
+ LptHC1,
+ LptHC2,
+ LptLpB0,
+ LptLpB1,
+ LptLpB2,
+ PchSteppingMax
+} PCH_STEPPING;
+
+#define R_PCH_LPC_VENDOR_ID 0x00
+#define V_PCH_LPC_VENDOR_ID V_PCH_INTEL_VENDOR_ID
+#define R_PCH_LPC_DEVICE_ID 0x02
+
+//
+// LynxPoint Desktop LPC Device IDs
+//
+#define V_PCH_LPTH_LPC_DEVICE_ID_DT_SUPER_SKU 0x8C42 ///< LynxPoint Desktop Super SKU
+#define V_PCH_LPTH_LPC_DEVICE_ID_DT_0 0x8C44 ///< Intel Z87 Chipset
+#define V_PCH_LPTH_LPC_DEVICE_ID_DT_1 0x8C46 ///< Intel Z85 Chipset
+#define V_PCH_LPTH_LPC_DEVICE_ID_DT_2 0x8C4A ///< Intel H87 Chipset
+#define V_PCH_LPTH_LPC_DEVICE_ID_DT_3 0x8C4C ///< Intel Q85 Chipset
+#define V_PCH_LPTH_LPC_DEVICE_ID_DT_4 0x8C4E ///< Intel Q87 Chipset
+#define V_PCH_LPTH_LPC_DEVICE_ID_DT_5 0x8C50 ///< Intel B85 Chipset
+#define V_PCH_LPTH_LPC_DEVICE_ID_DT_6 0x8C5C ///< Intel H81 Chipset
+
+//
+// LynxPoint Mobile LPC Device IDs
+//
+#define V_PCH_LPTH_LPC_DEVICE_ID_MB_SUPER_SKU 0x8C41 ///< LynxPoint Mobile Super SKU
+#define V_PCH_LPTH_LPC_DEVICE_ID_MB_0 0x8C49 ///< Intel HM86 Chipset
+#define V_PCH_LPTH_LPC_DEVICE_ID_MB_1 0x8C4B ///< Intel HM87 Chipset
+#define V_PCH_LPTH_LPC_DEVICE_ID_MB_2 0x8C4F ///< Intel QM87 Chipset
+
+//
+// Lynxpoint Server/WS LPC Device IDs
+//
+#define V_PCH_LPTH_LPC_DEVICE_ID_SVR_0 0x8C52 ///< Server Essential SKU Intel C222 Chipset
+#define V_PCH_LPTH_LPC_DEVICE_ID_SVR_1 0x8C54 ///< Server Standard SKU Intel C224 Chipset
+#define V_PCH_LPTH_LPC_DEVICE_ID_SVR_2 0x8C56 ///< Server Advanced SKU Intel C226 Chipset
+#define V_PCH_LPTH_LPC_DEVICE_ID_SVR_3 0x8C58 ///< WS SKU
+
+#define V_PCH_LPTLP_LPC_DEVICE_ID_UNFUSE 0x9C40 ///< LynxPoint LP Unfuse
+#define V_PCH_LPTLP_LPC_DEVICE_ID_MB_SUPER_SKU 0x9C41 ///< LynxPoint LP Mobile Super SKU
+#define V_PCH_LPTLP_LPC_DEVICE_ID_MB_0 0x9C42 ///< LynxPoint LP Mobile TBD SKU
+#define V_PCH_LPTLP_LPC_DEVICE_ID_MB_1 0x9C43 ///< LynxPoint LP Mobile Premium SKU
+#define V_PCH_LPTLP_LPC_DEVICE_ID_MB_2 0x9C44 ///< LynxPoint LP Mobile TBD SKU
+#define V_PCH_LPTLP_LPC_DEVICE_ID_MB_3 0x9C45 ///< LynxPoint LP Mobile Mainstream SKU
+#define V_PCH_LPTLP_LPC_DEVICE_ID_MB_4 0x9C46 ///< LynxPoint LP Mobile TBD SKU
+#define V_PCH_LPTLP_LPC_DEVICE_ID_MB_5 0x9C47 ///< LynxPoint LP Mobile Value SKU
+
+#define R_PCH_LPC_COMMAND 0x04
+#define B_PCH_LPC_COMMAND_FBE 0x0200
+#define B_PCH_LPC_COMMAND_SERR_EN 0x0100
+#define B_PCH_LPC_COMMAND_WCC 0x0080
+#define B_PCH_LPC_COMMAND_PER 0x0040
+#define B_PCH_LPC_COMMAND_VPS 0x0020
+#define B_PCH_LPC_COMMAND_PMWE 0x0010
+#define B_PCH_LPC_COMMAND_SCE 0x0008
+#define B_PCH_LPC_COMMAND_BME 0x0004
+#define B_PCH_LPC_COMMAND_MSE 0x0002
+#define B_PCH_LPC_COMMAND_IOSE 0x0001
+#define R_PCH_LPC_DEV_STS 0x06
+#define B_PCH_LPC_DEV_STS_DPE 0x8000
+#define B_PCH_LPC_DEV_STS_SSE 0x4000
+#define B_PCH_LPC_DEV_STS_RMA 0x2000
+#define B_PCH_LPC_DEV_STS_RTA 0x1000
+#define B_PCH_LPC_DEV_STS_STA 0x0800
+#define B_PCH_LPC_DEV_STS_DEVT_STS 0x0600
+#define B_PCH_LPC_DEV_STS_MDPED 0x0100
+#define B_PCH_LPC_DEV_STS_FB2B 0x0080
+#define B_PCH_LPC_DEV_STS_UDF 0x0040
+#define B_PCH_LPC_DEV_STS_66MHZ_CAP 0x0020
+#define R_PCH_LPC_RID 0x08
+#define V_PCH_LPT_LPC_RID_0 0x00
+#define V_PCH_LPT_LPC_RID_1 0x01
+#define V_PCH_LPT_LPC_RID_2 0x02
+#define V_PCH_LPT_LPC_RID_3 0x03
+#define V_PCH_LPT_LPC_RID_4 0x04
+#define V_PCH_LPT_LPC_RID_5 0x05
+#define R_PCH_LPC_PI 0x09
+#define R_PCH_LPC_SCC 0x0A
+#define R_PCH_LPC_BCC 0x0B
+#define R_PCH_LPC_PLT 0x0D
+#define R_PCH_LPC_HEADTYP 0x0E
+#define B_PCH_LPC_HEADTYP_MFD BIT7
+#define B_PCH_LPC_HEADTYP_HT 0x7F
+#define R_PCH_LPC_SS 0x2C
+#define B_PCH_LPC_SS_SSID 0xFFFF0000
+#define B_PCH_LPC_SS_SSVID 0x0000FFFF
+#define R_PCH_LPC_ACPI_BASE 0x40
+#define B_PCH_LPC_ACPI_BASE_BAR 0xFFFC
+#define R_PCH_LPC_ACPI_CNT 0x44
+#define B_PCH_LPC_ACPI_CNT_ACPI_EN 0x80
+#define B_PCH_LPC_ACPI_CNT_SCI_IRG_SEL 0x07
+#define R_PCH_LPC_GPIO_BASE 0x48
+#define B_PCH_LPC_GPIO_BASE_BAR 0xFFFC
+#define R_PCH_LPC_GPIO_CNT 0x4C
+#define B_PCH_LPC_GPIO_CNT_GPIO_EN 0x10
+#define B_PCH_LPC_GPIO_LOCKDOWN_EN 0x01
+#define R_PCH_LPC_VLW_VBDF 0x50
+#define B_PCH_LPC_VLW_VBDF 0xFFFF
+#define R_PCH_LPC_VLW_VCTRL 0x54
+#define B_PCH_LPC_VLW_VCTRL_VCLE BIT15
+#define B_PCH_LPC_VLW_VCTRL_FERRVDMDEN BIT5
+#define B_PCH_LPC_VLW_VCTRL_NMIVMEN BIT4
+#define B_PCH_LPC_VLW_VCTRL_INITVMEN BIT3
+#define B_PCH_LPC_VLW_VCTRL_SMIVMEN BIT2
+#define B_PCH_LPC_VLW_VCTRL_INTRVMEN BIT1
+#define B_PCH_LPC_VLW_VCTRL_A20VMEN BIT0
+#define R_PCH_LPC_PIRQA_ROUT 0x60
+#define R_PCH_LPC_PIRQB_ROUT 0x61
+#define R_PCH_LPC_PIRQC_ROUT 0x62
+#define R_PCH_LPC_PIRQD_ROUT 0x63
+
+//
+// Bit values are the same for R_PCH_LPC_PIRQA_ROUT to R_PCH_LPC_PIRQH_ROUT
+//
+#define B_PCH_LPC_PIRQX_ROUT_IRQEN 0x80
+#define B_PCH_LPC_PIRQX_ROUT 0x0F
+#define V_PCH_LPC_PIRQX_ROUT_IRQ_3 0x03
+#define V_PCH_LPC_PIRQX_ROUT_IRQ_4 0x04
+#define V_PCH_LPC_PIRQX_ROUT_IRQ_5 0x05
+#define V_PCH_LPC_PIRQX_ROUT_IRQ_6 0x06
+#define V_PCH_LPC_PIRQX_ROUT_IRQ_7 0x07
+#define V_PCH_LPC_PIRQX_ROUT_IRQ_9 0x09
+#define V_PCH_LPC_PIRQX_ROUT_IRQ_10 0x0A
+#define V_PCH_LPC_PIRQX_ROUT_IRQ_11 0x0B
+#define V_PCH_LPC_PIRQX_ROUT_IRQ_12 0x0C
+#define V_PCH_LPC_PIRQX_ROUT_IRQ_14 0x0E
+#define V_PCH_LPC_PIRQX_ROUT_IRQ_15 0x0F
+#define R_PCH_LPC_SERIRQ_CNT 0x64
+#define B_PCH_LPC_SERIRQ_CNT_SIRQEN 0x80
+#define B_PCH_LPC_SERIRQ_CNT_SIRQMD 0x40
+#define B_PCH_LPC_SERIRQ_CNT_SIRQSZ 0x3C
+#define N_PCH_LPC_SERIRQ_CNT_SIRQSZ 2
+#define B_PCH_LPC_SERIRQ_CNT_SFPW 0x03
+#define N_PCH_LPC_SERIRQ_CNT_SFPW 0
+#define V_PCH_LPC_SERIRQ_CNT_SFPW_4CLK 0x00
+#define V_PCH_LPC_SERIRQ_CNT_SFPW_6CLK 0x01
+#define V_PCH_LPC_SERIRQ_CNT_SFPW_8CLK 0x02
+#define R_PCH_LPC_PIRQE_ROUT 0x68
+#define R_PCH_LPC_PIRQF_ROUT 0x69
+#define R_PCH_LPC_PIRQG_ROUT 0x6A
+#define R_PCH_LPC_PIRQH_ROUT 0x6B
+#define R_PCH_LPC_IOXAPIC 0x6C
+#define B_PCH_LPC_IOXAPIC_BUS 0xFF00
+#define B_PCH_LPC_IOXAPIC_DEVICE 0x00F8
+#define B_PCH_LPC_IOXAPIC_FUNC 0x0007
+#define R_PCH_LPC_HPET0 0x70
+#define B_PCH_LPC_HPET0_BUS 0xFF00
+#define B_PCH_LPC_HPET0_DEVICE 0x00F8
+#define B_PCH_LPC_HPET0_FUNC 0x0007
+#define R_PCH_LPC_HPET1 0x72
+#define B_PCH_LPC_HPET1_BUS 0xFF00
+#define B_PCH_LPC_HPET1_DEVICE 0x00F8
+#define B_PCH_LPC_HPET1_FUNC 0x0007
+#define R_PCH_LPC_HPET2 0x74
+#define B_PCH_LPC_HPET2_BUS 0xFF00
+#define B_PCH_LPC_HPET2_DEVICE 0x00F8
+#define B_PCH_LPC_HPET2_FUNC 0x0007
+#define R_PCH_LPC_HPET3 0x76
+#define B_PCH_LPC_HPET3_BUS 0xFF00
+#define B_PCH_LPC_HPET3_DEVICE 0x00F8
+#define B_PCH_LPC_HPET3_FUNC 0x0007
+#define R_PCH_LPC_HPET4 0x78
+#define B_PCH_LPC_HPET4_BUS 0xFF00
+#define B_PCH_LPC_HPET4_DEVICE 0x00F8
+#define B_PCH_LPC_HPET4_FUNC 0x0007
+#define R_PCH_LPC_HPET5 0x7A
+#define B_PCH_LPC_HPET5_BUS 0xFF00
+#define B_PCH_LPC_HPET5_DEVICE 0x00F8
+#define B_PCH_LPC_HPET5_FUNC 0x0007
+#define R_PCH_LPC_HPET6 0x7C
+#define B_PCH_LPC_HPET6_BUS 0xFF00
+#define B_PCH_LPC_HPET6_DEVICE 0x00F8
+#define B_PCH_LPC_HPET6_FUNC 0x0007
+#define R_PCH_LPC_HPET7 0x7E
+#define B_PCH_LPC_HPET7_BUS 0xFF00
+#define B_PCH_LPC_HPET7_DEVICE 0x00F8
+#define B_PCH_LPC_HPET7_FUNC 0x0007
+#define R_PCH_LPC_IO_DEC 0x80
+#define B_PCH_LPC_FDD_DEC 0x1000
+#define B_PCH_LPC_LPT_DEC 0x0300
+#define B_PCH_LPC_COMB_DEC 0x0070
+#define V_PCH_LPC_COMB_3F8 0x00
+#define V_PCH_LPC_COMB_2F8 0x10
+#define V_PCH_LPC_COMB_220 0x20
+#define V_PCH_LPC_COMB_228 0x30
+#define V_PCH_LPC_COMB_238 0x40
+#define V_PCH_LPC_COMB_2E8 0x50
+#define V_PCH_LPC_COMB_338 0x60
+#define V_PCH_LPC_COMB_3E8 0x70
+#define B_PCH_LPC_COMA_DEC 0x0007
+#define V_PCH_LPC_COMA_3F8 0x00
+#define V_PCH_LPC_COMA_2F8 0x01
+#define V_PCH_LPC_COMA_220 0x02
+#define V_PCH_LPC_COMA_228 0x03
+#define V_PCH_LPC_COMA_238 0x04
+#define V_PCH_LPC_COMA_2E8 0x05
+#define V_PCH_LPC_COMA_338 0x06
+#define V_PCH_LPC_COMA_3E8 0x07
+#define R_PCH_LPC_ENABLES 0x82
+#define B_PCH_LPC_ENABLES_CNF2_EN 0x2000
+#define B_PCH_LPC_ENABLES_CNF1_EN 0x1000
+#define B_PCH_LPC_ENABLES_MC_EN 0x0800
+#define B_PCH_LPC_ENABLES_KBC_EN 0x0400
+#define B_PCH_LPC_ENABLES_GAMEH_EN 0x0200
+#define B_PCH_LPC_ENABLES_GAMEL_EN 0x0100
+#define B_PCH_LPC_ENABLES_FDD_EN 0x0008
+#define B_PCH_LPC_ENABLES_LPT_EN 0x0004
+#define B_PCH_LPC_ENABLES_COMB_EN 0x0002
+#define B_PCH_LPC_ENABLES_COMA_EN 0x0001
+#define R_PCH_LPC_GEN1_DEC 0x84
+#define B_PCH_LPC_GEN1_DEC_IODRA 0x00FC0000
+#define B_PCH_LPC_GEN1_DEC_IOBAR 0x0000FFFC
+#define B_PCH_LPC_GEN1_DEC_EN 0x00000001
+#define R_PCH_LPC_GEN2_DEC 0x88
+#define R_PCH_LPC_GEN3_DEC 0x8C
+#define R_PCH_LPC_GEN4_DEC 0x90
+#define R_PCH_LPC_ULKMC 0x94
+#define B_PCH_LPC_ULKMC_SMIBYENDPS BIT15
+#define B_PCH_LPC_ULKMC_TRAPBY64W BIT11
+#define B_PCH_LPC_ULKMC_TRAPBY64R BIT10
+#define B_PCH_LPC_ULKMC_TRAPBY60W BIT9
+#define B_PCH_LPC_ULKMC_TRAPBY60R BIT8
+#define B_PCH_LPC_ULKMC_SMIATENDPS BIT7
+#define B_PCH_LPC_ULKMC_PSTATE BIT6
+#define B_PCH_LPC_ULKMC_A20PASSEN BIT5
+#define B_PCH_LPC_ULKMC_USBSMIEN BIT4
+#define B_PCH_LPC_ULKMC_64WEN BIT3
+#define B_PCH_LPC_ULKMC_64REN BIT2
+#define B_PCH_LPC_ULKMC_60WEN BIT1
+#define B_PCH_LPC_ULKMC_60REN BIT0
+#define R_PCH_LPC_LGMR 0x98
+#define B_PCH_LPC_LGMR_MA 0xFFFF0000
+#define B_PCH_LPC_LGMR_LMRD_EN BIT0
+
+#define R_PCH_LPC_FWH_BIOS_SEL 0xD0
+#define B_PCH_LPC_FWH_BIOS_SEL_F8 0xF0000000
+#define B_PCH_LPC_FWH_BIOS_SEL_F0 0x0F000000
+#define B_PCH_LPC_FWH_BIOS_SEL_E8 0x00F00000
+#define B_PCH_LPC_FWH_BIOS_SEL_E0 0x000F0000
+#define B_PCH_LPC_FWH_BIOS_SEL_D8 0x0000F000
+#define B_PCH_LPC_FWH_BIOS_SEL_D0 0x00000F00
+#define B_PCH_LPC_FWH_BIOS_SEL_C8 0x000000F0
+#define B_PCH_LPC_FWH_BIOS_SEL_C0 0x0000000F
+#define R_PCH_LPC_FWH_BIOS_SEL2 0xD4
+#define B_PCH_LPC_FWH_BIOS_SEL2_70 0xF000
+#define B_PCH_LPC_FWH_BIOS_SEL2_60 0x0F00
+#define B_PCH_LPC_FWH_BIOS_SEL2_50 0x00F0
+#define B_PCH_LPC_FWH_BIOS_SEL2_40 0x000F
+#define R_PCH_LPC_FWH_BIOS_DEC 0xD8
+#define B_PCH_LPC_FWH_BIOS_DEC_F8 0x8000
+#define B_PCH_LPC_FWH_BIOS_DEC_F0 0x4000
+#define B_PCH_LPC_FWH_BIOS_DEC_E8 0x2000
+#define B_PCH_LPC_FWH_BIOS_DEC_E0 0x1000
+#define B_PCH_LPC_FWH_BIOS_DEC_D8 0x0800
+#define B_PCH_LPC_FWH_BIOS_DEC_D0 0x0400
+#define B_PCH_LPC_FWH_BIOS_DEC_C8 0x0200
+#define B_PCH_LPC_FWH_BIOS_DEC_C0 0x0100
+#define B_PCH_LPC_FWH_BIOS_LEG_F 0x0080
+#define B_PCH_LPC_FWH_BIOS_LEG_E 0x0040
+#define B_PCH_LPC_FWH_BIOS_DEC_70 0x0008
+#define B_PCH_LPC_FWH_BIOS_DEC_60 0x0004
+#define B_PCH_LPC_FWH_BIOS_DEC_50 0x0002
+#define B_PCH_LPC_FWH_BIOS_DEC_40 0x0001
+#define R_PCH_LPC_BIOS_CNTL 0xDC
+#define S_PCH_LPC_BIOS_CNTL 1
+#define B_PCH_LPC_BIOS_CNTL_SMM_BWP 0x20 ///< SMM BIOS write protect disable
+#define B_PCH_LPC_BIOS_CNTL_TSS 0x10
+#define V_PCH_LPC_BIOS_CNTL_SRC 0x0C
+#define V_PCH_SRC_PREF_EN_CACHE_EN 0x08
+#define V_PCH_SRC_PREF_DIS_CACHE_DIS 0x04
+#define V_PCH_SRC_PREF_DIS_CACHE_EN 0x00
+#define B_PCH_LPC_BIOS_CNTL_BLE 0x02
+#define B_PCH_LPC_BIOS_CNTL_BIOSWE 0x01
+#define N_PCH_LPC_BIOS_CNTL_BLE 1
+#define N_PCH_LPC_BIOS_CNTL_BIOSWE 0
+#define R_PCH_LPC_FDCAP 0xE0
+#define B_PCH_LPC_FDCAP_NEXT 0xFF00
+#define B_PCH_LPC_FDCAP_CID 0x00FF
+#define R_PCH_LPC_FDLEN 0xE2
+#define B_PCH_LPC_FDLEN 0xFF
+#define R_PCH_LPC_FDVER 0xE3
+#define B_PCH_LPC_FDVER_VSCID 0xF0
+#define B_PCH_LPC_FDVER_CV 0x0F
+#define R_PCH_LPC_FVECIDX 0xE4
+#define B_PCH_LPC_FVECIDX_IDX 0x0000003C
+#define R_PCH_LPC_FVECD 0xE8
+#define R_PCH_LPC_FVEC0 0x00
+#define B_PCH_LPC_FVEC0_USB_PORT_CAP 0x00000C00
+#define V_PCH_LPC_FVEC0_USB_14_PORT 0x00000000
+#define V_PCH_LPC_FVEC0_USB_12_PORT 0x00000400
+#define V_PCH_LPC_FVEC0_USB_10_PORT 0x00000800
+#define B_PCH_LPC_FVEC0_SATA_RAID_CAP 0x00000080
+#define B_PCH_LPC_FVEC0_SATA_PORT23_CAP 0x00000040
+#define B_PCH_LPC_FVEC0_SATA_PORT1_6GB_CAP 0x00000008
+#define B_PCH_LPC_FVEC0_SATA_PORT0_6GB_CAP 0x00000004
+#define B_PCH_LPC_FVEC0_PCI_CAP 0x00000002
+#define R_PCH_LPC_FVEC1 0x01
+#define B_PCH_LPC_FVEC1_USB_R_CAP 0x00400000
+#define R_PCH_LPC_FVEC2 0x02
+#define B_PCH_LPC_FVEC2_IATT_CAP 0x00400000 ///< Intel Anti-Theft Technology Capability
+#define V_PCH_LPC_FVEC2_PCIE_PORT78_CAP 0x00200000
+#define V_PCH_LPC_FVEC2_PCH_IG_SUPPORT_CAP 0x00020000 ///< PCH Integrated Graphics Support Capability
+#define R_PCH_LPC_FVEC3 0x03
+#define B_PCH_LPC_FVEC3_DCMI_CAP 0x00002000 ///< Data Center Manageability Interface (DCMI) Capability
+#define B_PCH_LPC_FVEC3_NM_CAP 0x00001000 ///< Node Manager Capability
+#define R_PCH_LPC_RCBA 0xF0
+#define B_PCH_LPC_RCBA_BAR 0xFFFFC000
+#define B_PCH_LPC_RCBA_EN 0x00000001
+
+#define R_PCH_LPC_GEN_PMCON_1 0xA0
+#define B_PCH_LPC_GEN_PMCON_PER_SMI_SEL 0x0003
+#define V_PCH_LPC_GEN_PMCON_PER_SMI_64S 0x0000
+#define V_PCH_LPC_GEN_PMCON_PER_SMI_32S 0x0001
+#define V_PCH_LPC_GEN_PMCON_PER_SMI_16S 0x0002
+#define V_PCH_LPC_GEN_PMCON_PER_SMI_8S 0x0003
+#define B_PCH_LPC_GEN_PMCON_CLKRUN_EN 0x0004
+#define B_PCH_LPC_GEN_PMCON_PSEUDO_CLKRUN_EN 0x0008
+#define B_PCH_LPC_GEN_PMCON_SMI_LOCK 0x0010
+#define B_PCH_LPC_GEN_PMCON_PWRBTN_LVL 0x0200
+#define B_PCH_LPC_GEN_PMCON_BIOS_PCI_EXP_EN 0x0400
+#define B_PCH_LPC_GEN_PMCON_REQ_CLKRUN_BBCLKGATE 0x0800
+#define B_PCH_LPC_GEN_PMCON_ALLOW_SPXB_CG_INC0 0x1000
+#define B_PCH_LPC_GEN_PMCON_ALLOW_PLL_SD_INC0 0x2000
+#define R_PCH_LPC_GEN_PMCON_2 0xA2
+#define B_PCH_LPC_GEN_PMCON_PWROK_FLR 0x01
+#define B_PCH_LPC_GEN_PMCON_SYSPWR_FLR 0x02
+#define B_PCH_LPC_GEN_PMCON_MIN_SLP_S4 0x04
+#define B_PCH_LPC_GEN_PMCON_CTS 0x08
+#define B_PCH_LPC_GEN_PMCON_SRS 0x10
+#define B_PCH_LPC_GEN_PMCON_MEM_SR 0x20
+#define B_PCH_LPC_GEN_PMCON_DRAM_INIT 0x80
+#define B_PCH_LPC_GEN_PMCON_SX_PP_EN 0x0800
+#define B_PCH_LPC_GEN_PMCON_AG3_PP_EN 0x1000
+#define B_PCH_LPC_GEN_PMCON_DSX_PP_DIS 0x2000
+#define B_PCH_LPC_GEN_PMCON_DC_PP_DIS 0x4000
+#define R_PCH_LPC_GEN_PMCON_3 0xA4
+#define B_PCH_LPC_GEN_PMCON_PME_B0_S5_DIS BIT15
+#define B_PCH_LPC_GEN_PMCON_SUS_PWR_FLR BIT14
+#define B_PCH_LPC_GEN_PMCON_WOL_ENABLE_OVERRIDE BIT13
+#define B_PCH_LPC_GEN_PMCON_DISABLE_SX_STRETCH BIT12
+#define B_PCH_LPC_GEN_PMCON_SLP_S3_MAW 0xC00
+#define V_PCH_LPC_GEN_PMCON_SLP_S3_MAW_60US 0x000
+#define V_PCH_LPC_GEN_PMCON_SLP_S3_MAW_1MS 0x400
+#define V_PCH_LPC_GEN_PMCON_SLP_S3_MAW_50MS 0x800
+#define V_PCH_LPC_GEN_PMCON_SLP_S3_MAW_2S 0xC00
+#define B_PCH_LPC_GEN_PMCON_GEN_RST_STS BIT9
+#define B_PCH_LPC_GEN_PMCON_SWSMI_RTSL 0xC0
+#define V_PCH_LPC_GEN_PMCON_SWSMI_RTSL_64MS 0xC0
+#define V_PCH_LPC_GEN_PMCON_SWSMI_RTSL_32MS 0x80
+#define V_PCH_LPC_GEN_PMCON_SWSMI_RTSL_16MS 0x40
+#define V_PCH_LPC_GEN_PMCON_SWSMI_RTSL_1_5MS 0x00
+#define B_PCH_LPC_GEN_PMCON_SLP_S4_MAW 0x30
+#define V_PCH_LPC_GEN_PMCON_SLP_S4_MAW_1S 0x30
+#define V_PCH_LPC_GEN_PMCON_SLP_S4_MAW_2S 0x20
+#define V_PCH_LPC_GEN_PMCON_SLP_S4_MAW_3S 0x10
+#define V_PCH_LPC_GEN_PMCON_SLP_S4_MAW_4S 0x00
+#define B_PCH_LPC_GEN_PMCON_SLP_S4_ASE 0x08
+#define B_PCH_LPC_GEN_PMCON_RTC_PWR_STS 0x04
+#define B_PCH_LPC_GEN_PMCON_PWR_FLR 0x02
+#define B_PCH_LPC_GEN_PMCON_AFTERG3_EN 0x01
+#define R_PCH_LPC_GEN_PMCON_LOCK 0xA6
+#define B_PCH_LPC_GEN_PMCON_LOCK_S4_STRET_LD BIT2 ///< Lock down SLP_S3/SLP_S4 Minimum Assertion width
+#define B_PCH_LPC_GEN_PMCON_LOCK_ABASE_LK BIT1 ///< Lock ACPI BASE at 0x40, only cleared by reset when set
+#define R_PCH_LPC_CIR4 0xA9 ///< Chipset Initialization Register 4
+#define R_PCH_LPC_BM_BREAK_EN2 0xAA
+#define B_PCH_LPC_BM_BREAK_EN2_SATA3 BIT0
+#define R_PCH_LPC_BM_BREAK_EN 0xAB
+#define B_PCH_LPC_BM_BREAK_EN_STORAGE BIT7
+#define B_PCH_LPC_BM_BREAK_EN_PCIE BIT6
+#define B_PCH_LPC_BM_BREAK_EN_EHCI BIT2
+#define B_PCH_LPC_BM_BREAK_EN_HDA BIT0
+#define R_PCH_LPC_PMIR 0xAC
+#define B_PCH_LPC_PMIR_CF9LOCK BIT31 ///< CF9h Lockdown
+#define B_PCH_LPC_PMIR_CF9GR BIT20 ///< CF9h Global Reset
+#define B_PCH_LPC_PMIR_SKIP_HOST_RST_HS BIT19
+
+#define R_PCH_LPC_GPI_ROUT 0xB8
+#define B_PCH_LPC_GPI_ROUT_0 (BIT1 | BIT0)
+#define B_PCH_LPC_GPI_ROUT_1 (BIT3 | BIT2)
+#define B_PCH_LPC_GPI_ROUT_2 (BIT5 | BIT4)
+#define B_PCH_LPC_GPI_ROUT_3 (BIT7 | BIT6)
+#define B_PCH_LPC_GPI_ROUT_4 (BIT9 | BIT8)
+#define B_PCH_LPC_GPI_ROUT_5 (BIT11 | BIT10)
+#define B_PCH_LPC_GPI_ROUT_6 (BIT13 | BIT12)
+#define B_PCH_LPC_GPI_ROUT_7 (BIT15 | BIT14)
+#define B_PCH_LPC_GPI_ROUT_8 (BIT17 | BIT16)
+#define B_PCH_LPC_GPI_ROUT_9 (BIT19 | BIT18)
+#define B_PCH_LPC_GPI_ROUT_10 (BIT21 | BIT20)
+#define B_PCH_LPC_GPI_ROUT_11 (BIT23 | BIT22)
+#define B_PCH_LPC_GPI_ROUT_12 (BIT25 | BIT24)
+#define B_PCH_LPC_GPI_ROUT_13 (BIT27 | BIT26)
+#define B_PCH_LPC_GPI_ROUT_14 (BIT29 | BIT28)
+#define B_PCH_LPC_GPI_ROUT_15 (BIT31 | BIT30)
+
+#define R_PCH_LPC_GPI_ROUT2 0xBC
+#define B_PCH_LPC_GPI_ROUT2_17 (BIT1 | BIT0)
+#define B_PCH_LPC_GPI_ROUT2_19 (BIT3 | BIT2)
+#define B_PCH_LPC_GPI_ROUT2_21 (BIT5 | BIT4)
+#define B_PCH_LPC_GPI_ROUT2_22 (BIT7 | BIT6)
+#define B_PCH_LPC_GPI_ROUT2_43 (BIT9 | BIT8)
+#define B_PCH_LPC_GPI_ROUT2_56 (BIT11 | BIT10)
+#define B_PCH_LPC_GPI_ROUT2_57 (BIT13 | BIT12)
+#define B_PCH_LPC_GPI_ROUT2_60 (BIT15 | BIT14)
+
+#define R_PCH_LP_LPC_GPI_ROUT0 0x30
+#define R_PCH_LP_LPC_GPI_ROUT1 0x34
+#define R_PCH_LP_LPC_GPI_ROUT2 0x38
+
+#define R_PCH_LPC_MDAP 0xC0
+#define B_PCH_LPC_MDAP_POLICY_EN BIT31
+#define B_PCH_LPC_MDAP_PDMA_EN BIT30
+#define B_PCH_LPC_MDAP_VALUE 0x0001FFFF
+//
+// APM Registers
+//
+#define R_PCH_APM_CNT 0xB2
+#define R_PCH_APM_STS 0xB3
+
+//
+// ACPI and legacy I/O register offsets from PMBASE
+//
+#define R_PCH_ACPI_PM1_STS 0x00
+#define S_PCH_ACPI_PM1_STS 2
+#define B_PCH_ACPI_PM1_STS_WAK 0x8000
+#define B_PCH_ACPI_PM1_STS_PRBTNOR 0x0800
+#define B_PCH_ACPI_PM1_STS_RTC 0x0400
+#define B_PCH_ACPI_PM1_STS_PWRBTN 0x0100
+#define B_PCH_ACPI_PM1_STS_GBL 0x0020
+#define B_PCH_ACPI_PM1_STS_BM 0x0010
+#define B_PCH_ACPI_PM1_STS_TMROF 0x0001
+#define N_PCH_ACPI_PM1_STS_WAK 15
+#define N_PCH_ACPI_PM1_STS_PRBTNOR 11
+#define N_PCH_ACPI_PM1_STS_RTC 10
+#define N_PCH_ACPI_PM1_STS_PWRBTN 8
+#define N_PCH_ACPI_PM1_STS_GBL 5
+#define N_PCH_ACPI_PM1_STS_BM 4
+#define N_PCH_ACPI_PM1_STS_TMROF 0
+
+#define R_PCH_ACPI_PM1_EN 0x02
+#define S_PCH_ACPI_PM1_EN 2
+#define B_PCH_ACPI_PM1_EN_RTC 0x0400
+#define B_PCH_ACPI_PM1_EN_PWRBTN 0x0100
+#define B_PCH_ACPI_PM1_EN_GBL 0x0020
+#define B_PCH_ACPI_PM1_EN_TMROF 0X0001
+#define N_PCH_ACPI_PM1_EN_RTC 10
+#define N_PCH_ACPI_PM1_EN_PWRBTN 8
+#define N_PCH_ACPI_PM1_EN_GBL 5
+#define N_PCH_ACPI_PM1_EN_TMROF 0
+
+#define R_PCH_ACPI_PM1_CNT 0x04
+#define S_PCH_ACPI_PM1_CNT 4
+#define B_PCH_ACPI_PM1_CNT_SLP_EN 0x00002000
+#define B_PCH_ACPI_PM1_CNT_SLP_TYP 0x00001C00
+#define V_PCH_ACPI_PM1_CNT_S0 0x00000000
+#define V_PCH_ACPI_PM1_CNT_S1 0x00000400
+#define V_PCH_ACPI_PM1_CNT_S3 0x00001400
+#define V_PCH_ACPI_PM1_CNT_S4 0x00001800
+#define V_PCH_ACPI_PM1_CNT_S5 0x00001C00
+#define B_PCH_ACPI_PM1_CNT_GBL_RLS 0x00000004
+#define B_PCH_ACPI_PM1_CNT_BM_RLD 0x00000002
+#define B_PCH_ACPI_PM1_CNT_SCI_EN 0x00000001
+
+#define R_PCH_ACPI_PM1_TMR 0x08
+#define V_PCH_ACPI_TMR_FREQUENCY 3579545
+#define B_PCH_ACPI_PM1_TMR_VAL 0xFFFFFF
+#define V_PCH_ACPI_PM1_TMR_MAX_VAL 0x1000000 ///< The timer is 24 bit overflow
+
+#define R_PCH_ACPI_GPE0_STS_127_96 0x8C
+#define S_PCH_ACPI_GPE0_STS_127_96 4
+#define B_PCH_ACPI_GPE0_STS_127_96_WADT BIT18
+#define B_PCH_ACPI_GPE0_STS_127_96_GP27 BIT16
+#define B_PCH_ACPI_GPE0_STS_127_96_PME_B0 BIT13
+#define B_PCH_ACPI_GPE0_STS_127_96_ME_SCI BIT12
+#define B_PCH_ACPI_GPE0_STS_127_96_PME BIT11
+#define B_PCH_ACPI_GPE0_STS_127_96_BATLOW BIT10
+#define B_PCH_ACPI_GPE0_STS_127_96_PCI_EXP BIT9
+#define B_PCH_ACPI_GPE0_STS_127_96_RI BIT8
+#define B_PCH_ACPI_GPE0_STS_127_96_SMB_WAK BIT7
+#define B_PCH_ACPI_GPE0_STS_127_96_TC0SCI BIT6
+#define B_PCH_ACPI_GPE0_STS_127_96_SWGPE BIT2
+#define B_PCH_ACPI_GPE0_STS_127_96_HOT_PLUG BIT1
+#define N_PCH_ACPI_GPE0_STS_127_96_PME_B0 13
+#define N_PCH_ACPI_GPE0_STS_127_96_PME 11
+#define N_PCH_ACPI_GPE0_STS_127_96_BATLOW 10
+#define N_PCH_ACPI_GPE0_STS_127_96_PCI_EXP 9
+#define N_PCH_ACPI_GPE0_STS_127_96_RI 8
+#define N_PCH_ACPI_GPE0_STS_127_96_SMB_WAK 7
+#define N_PCH_ACPI_GPE0_STS_127_96_TC0SCI 6
+#define N_PCH_ACPI_GPE0_STS_127_96_SWGPE 2
+#define N_PCH_ACPI_GPE0_STS_127_96_HOT_PLUG 1
+
+#define R_PCH_ACPI_GPE0_EN_127_96 0x9C
+#define S_PCH_ACPI_GPE0_EN_127_96 4
+#define B_PCH_ACPI_GPE0_EN_127_96_WADT BIT18
+#define B_PCH_ACPI_GPE0_EN_127_96_GP27 BIT16
+#define B_PCH_ACPI_GPE0_EN_127_96_PME_B0 BIT13
+#define B_PCH_ACPI_GPE0_EN_127_96_ME_SCI BIT12
+#define B_PCH_ACPI_GPE0_EN_127_96_PME BIT11
+#define B_PCH_ACPI_GPE0_EN_127_96_BATLOW BIT10
+#define B_PCH_ACPI_GPE0_EN_127_96_PCI_EXP BIT9
+#define B_PCH_ACPI_GPE0_EN_127_96_RI BIT8
+#define B_PCH_ACPI_GPE0_EN_127_96_TC0SCI BIT6
+#define B_PCH_ACPI_GPE0_EN_127_96_SWGPE BIT2
+#define B_PCH_ACPI_GPE0_EN_127_96_HOT_PLUG BIT1
+#define N_PCH_ACPI_GPE0_EN_127_96_PME_B0 13
+#define N_PCH_ACPI_GPE0_EN_127_96_USB3 12
+#define N_PCH_ACPI_GPE0_EN_127_96_PME 11
+#define N_PCH_ACPI_GPE0_EN_127_96_BATLOW 10
+#define N_PCH_ACPI_GPE0_EN_127_96_PCI_EXP 9
+#define N_PCH_ACPI_GPE0_EN_127_96_RI 8
+#define N_PCH_ACPI_GPE0_EN_127_96_TC0SCI 6
+#define N_PCH_ACPI_GPE0_EN_127_96_SWGPE 2
+#define N_PCH_ACPI_GPE0_EN_127_96_HOT_PLUG 1
+
+#define R_PCH_ACPI_GPE0a_STS 0x20
+#define S_PCH_ACPI_GPE0a_STS 4
+#define B_PCH_ACPI_GPE0a_STS_GPInn 0xFFFF0000
+#define B_PCH_ACPI_GPE0a_STS_PME_B0 BIT13
+#define B_PCH_ACPI_GPE0a_STS_PME BIT11
+#define B_PCH_ACPI_GPE0a_STS_BATLOW BIT10
+#define B_PCH_ACPI_GPE0a_STS_PCI_EXP BIT9
+#define B_PCH_ACPI_GPE0a_STS_RI BIT8
+#define B_PCH_ACPI_GPE0a_STS_SMB_WAK BIT7
+#define B_PCH_ACPI_GPE0a_STS_TC0SCI BIT6
+#define B_PCH_ACPI_GPE0a_STS_SWGPE BIT2
+#define B_PCH_ACPI_GPE0a_STS_HOT_PLUG BIT1
+#define N_PCH_ACPI_GPE0a_STS_PME_B0 13
+#define N_PCH_ACPI_GPE0a_STS_PME 11
+#define N_PCH_ACPI_GPE0a_STS_BATLOW 10
+#define N_PCH_ACPI_GPE0a_STS_PCI_EXP 9
+#define N_PCH_ACPI_GPE0a_STS_RI 8
+#define N_PCH_ACPI_GPE0a_STS_SMB_WAK 7
+#define N_PCH_ACPI_GPE0a_STS_TC0SCI 6
+#define N_PCH_ACPI_GPE0a_STS_SWGPE 2
+#define N_PCH_ACPI_GPE0a_STS_HOT_PLUG 1
+
+#define R_PCH_ACPI_GPE0b_STS 0x24
+#define S_PCH_ACPI_GPE0b_STS 4
+#define B_PCH_ACPI_GPE0b_STS_GP60 BIT31
+#define B_PCH_ACPI_GPE0b_STS_GP57 BIT30
+#define B_PCH_ACPI_GPE0b_STS_GP56 BIT29
+#define B_PCH_ACPI_GPE0b_STS_GP43 BIT28
+#define B_PCH_ACPI_GPE0b_STS_GP22 BIT27
+#define B_PCH_ACPI_GPE0b_STS_GP21 BIT26
+#define B_PCH_ACPI_GPE0b_STS_GP19 BIT25
+#define B_PCH_ACPI_GPE0b_STS_GP17 BIT24
+#define B_PCH_ACPI_GPE0b_STS_WADT BIT6
+#define B_PCH_ACPI_GPE0b_STS_ME_SCI BIT4
+#define B_PCH_ACPI_GPE0b_STS_GP27 BIT3
+
+#define R_PCH_ACPI_GPE0a_EN 0x28
+#define S_PCH_ACPI_GPE0a_EN 4
+#define B_PCH_ACPI_GPE0a_EN_GPInn 0xFFFF0000
+#define B_PCH_ACPI_GPE0a_EN_PME_B0 BIT13
+#define B_PCH_ACPI_GPE0a_EN_PME BIT11
+#define B_PCH_ACPI_GPE0a_EN_BATLOW BIT10
+#define B_PCH_ACPI_GPE0a_EN_PCI_EXP BIT9
+#define B_PCH_ACPI_GPE0a_EN_RI BIT8
+#define B_PCH_ACPI_GPE0a_EN_TC0SCI BIT6
+#define B_PCH_ACPI_GPE0a_EN_SWGPE BIT2
+#define B_PCH_ACPI_GPE0a_EN_HOT_PLUG BIT1
+#define N_PCH_ACPI_GPE0a_EN_USB4 14
+#define N_PCH_ACPI_GPE0a_EN_PME_B0 13
+#define N_PCH_ACPI_GPE0a_EN_USB3 12
+#define N_PCH_ACPI_GPE0a_EN_PME 11
+#define N_PCH_ACPI_GPE0a_EN_BATLOW 10
+#define N_PCH_ACPI_GPE0a_EN_PCI_EXP 9
+#define N_PCH_ACPI_GPE0a_EN_RI 8
+#define N_PCH_ACPI_GPE0a_EN_TC0SCI 6
+#define N_PCH_ACPI_GPE0a_EN_SWGPE 2
+#define N_PCH_ACPI_GPE0a_EN_HOT_PLUG 1
+
+#define R_PCH_ACPI_GPE0b_EN 0x2C
+#define S_PCH_ACPI_GPE0b_EN 4
+#define B_PCH_ACPI_GPE0b_EN_GP60 BIT31
+#define B_PCH_ACPI_GPE0b_EN_GP57 BIT30
+#define B_PCH_ACPI_GPE0b_EN_GP56 BIT29
+#define B_PCH_ACPI_GPE0b_EN_GP43 BIT28
+#define B_PCH_ACPI_GPE0b_EN_GP22 BIT27
+#define B_PCH_ACPI_GPE0b_EN_GP21 BIT26
+#define B_PCH_ACPI_GPE0b_EN_GP19 BIT25
+#define B_PCH_ACPI_GPE0b_EN_GP17 BIT24
+#define B_PCH_ACPI_GPE0b_EN_WADT BIT6
+#define B_PCH_ACPI_GPE0b_EN_ME_SCI BIT4
+#define B_PCH_ACPI_GPE0b_EN_GP27 BIT3
+
+#define R_PCH_SMI_EN 0x30
+#define S_PCH_SMI_EN 4
+#define B_PCH_SMI_EN_LEGACY_USB3 BIT31
+#define B_PCH_SMI_EN_GPIO_UNLOCK_SMI BIT27
+#define B_PCH_SMI_EN_INTEL_USB2 BIT18
+#define B_PCH_SMI_EN_LEGACY_USB2 BIT17
+#define B_PCH_SMI_EN_PERIODIC BIT14
+#define B_PCH_SMI_EN_TCO BIT13
+#define B_PCH_SMI_EN_MCSMI BIT11
+#define B_PCH_SMI_EN_BIOS_RLS BIT7
+#define B_PCH_SMI_EN_SWSMI_TMR BIT6
+#define B_PCH_SMI_EN_APMC BIT5
+#define B_PCH_SMI_EN_ON_SLP_EN BIT4
+#define B_PCH_SMI_EN_LEGACY_USB BIT3
+#define B_PCH_SMI_EN_BIOS BIT2
+#define B_PCH_SMI_EN_EOS BIT1
+#define B_PCH_SMI_EN_GBL_SMI BIT0
+#define N_PCH_SMI_EN_LEGACY_USB3 31
+#define N_PCH_SMI_EN_GPIO_UNLOCK 27
+#define N_PCH_SMI_EN_INTEL_USB2 18
+#define N_PCH_SMI_EN_LEGACY_USB2 17
+#define N_PCH_SMI_EN_PERIODIC 14
+#define N_PCH_SMI_EN_TCO 13
+#define N_PCH_SMI_EN_MCSMI 11
+#define N_PCH_SMI_EN_BIOS_RLS 7
+#define N_PCH_SMI_EN_SWSMI_TMR 6
+#define N_PCH_SMI_EN_APMC 5
+#define N_PCH_SMI_EN_ON_SLP_EN 4
+#define N_PCH_SMI_EN_LEGACY_USB 3
+#define N_PCH_SMI_EN_BIOS 2
+#define N_PCH_SMI_EN_EOS 1
+#define N_PCH_SMI_EN_GBL_SMI 0
+
+#define R_PCH_SMI_STS 0x34
+#define S_PCH_SMI_STS 4
+#define B_PCH_SMI_STS_LEGACY_USB3 BIT31
+#define B_PCH_SMI_STS_GPIO_UNLOCK BIT27
+#define B_PCH_SMI_STS_SPI BIT26
+#define B_PCH_SMI_STS_MONITOR BIT21
+#define B_PCH_SMI_STS_PCI_EXP BIT20
+#define B_PCH_SMI_STS_PATCH BIT19
+#define B_PCH_SMI_STS_INTEL_USB2 BIT18
+#define B_PCH_SMI_STS_LEGACY_USB2 BIT17
+#define B_PCH_SMI_STS_SMBUS BIT16
+#define B_PCH_SMI_STS_SERIRQ BIT15
+#define B_PCH_SMI_STS_PERIODIC BIT14
+#define B_PCH_SMI_STS_TCO BIT13
+#define B_PCH_SMI_STS_DEVMON BIT12
+#define B_PCH_SMI_STS_MCSMI BIT11
+#define B_PCH_SMI_STS_GPIO_SMI BIT10
+#define B_PCH_SMI_STS_GPE1 BIT10
+#define B_PCH_SMI_STS_GPE0 BIT9
+#define B_PCH_SMI_STS_PM1_STS_REG BIT8
+#define B_PCH_SMI_STS_SWSMI_TMR BIT6
+#define B_PCH_SMI_STS_APM BIT5
+#define B_PCH_SMI_STS_ON_SLP_EN BIT4
+#define B_PCH_SMI_STS_LEGACY_USB BIT3
+#define B_PCH_SMI_STS_BIOS BIT2
+#define N_PCH_SMI_STS_LEGACY_USB3 31
+#define N_PCH_SMI_STS_GPIO_UNLOCK 27
+#define N_PCH_SMI_STS_SPI 26
+#define N_PCH_SMI_STS_MONITOR 21
+#define N_PCH_SMI_STS_PCI_EXP 20
+#define N_PCH_SMI_STS_PATCH 19
+#define N_PCH_SMI_STS_INTEL_USB2 18
+#define N_PCH_SMI_STS_LEGACY_USB2 17
+#define N_PCH_SMI_STS_SMBUS 16
+#define N_PCH_SMI_STS_SERIRQ 15
+#define N_PCH_SMI_STS_PERIODIC 14
+#define N_PCH_SMI_STS_TCO 13
+#define N_PCH_SMI_STS_DEVMON 12
+#define N_PCH_SMI_STS_MCSMI 11
+#define N_PCH_SMI_STS_GPE1 10
+#define N_PCH_SMI_STS_GPE0 9
+#define N_PCH_SMI_STS_PM1_STS_REG 8
+#define N_PCH_SMI_STS_SWSMI_TMR 6
+#define N_PCH_SMI_STS_APM 5
+#define N_PCH_SMI_STS_ON_SLP_EN 4
+#define N_PCH_SMI_STS_LEGACY_USB 3
+#define N_PCH_SMI_STS_BIOS 2
+
+#define R_PCH_LPTH_ALT_GP_SMI_EN 0x38
+#define S_PCH_LPTH_ALT_GP_SMI_EN 2
+#define R_PCH_LPTH_ALT_GP_SMI_STS 0x3A
+#define S_PCH_LPTH_ALT_GP_SMI_STS 2
+#define V_PCH_LPTH_ALT_GP_SMI_GPIBASE 0
+#define S_PCH_LPTH_ALT_GP_SMI_GPISIZE 16
+
+#define R_PCH_LPTLP_ALT_GP_SMI_EN 0x54
+#define S_PCH_LPTLP_ALT_GP_SMI_EN 4
+#define R_PCH_LPTLP_ALT_GP_SMI_STS 0x50
+#define S_PCH_LPTLP_ALT_GP_SMI_STS 4
+#define V_PCH_LPTLP_ALT_GP_SMI_GPIBASE 32
+#define S_PCH_LPTLP_ALT_GP_SMI_GPISIZE 16
+
+//
+// USB Per-Port Registers Write Control
+//
+#define R_PCH_UPRWC 0x3C
+#define S_PCH_UPRWC 2
+#define B_PCH_UPRWC_WR_EN_SMI_STS 0x0100
+#define B_PCH_UPRWC_WR_EN 0x0002
+#define B_PCH_UPRWC_WR_EN_SMI_EN 0x0001
+
+#define R_PCH_ACPI_GPE_CNTL 0x42
+#define B_PCH_ACPI_GPE_CNTL_SWGPE_CTRL BIT1
+
+#define R_PCH_DEVACT_STS 0x44
+#define S_PCH_DEVACT_STS 2
+#define B_PCH_DEVACT_STS_MASK 0x13E1
+#define B_PCH_DEVACT_STS_KBC 0x1000
+#define B_PCH_DEVACT_STS_PIRQDH 0x0200
+#define B_PCH_DEVACT_STS_PIRQCG 0x0100
+#define B_PCH_DEVACT_STS_PIRQBF 0x0080
+#define B_PCH_DEVACT_STS_PIRQAE 0x0040
+#define N_PCH_DEVACT_STS_KBC 12
+#define N_PCH_DEVACT_STS_PIRQDH 9
+#define N_PCH_DEVACT_STS_PIRQCG 8
+#define N_PCH_DEVACT_STS_PIRQBF 7
+#define N_PCH_DEVACT_STS_PIRQAE 6
+
+#define R_PCH_ACPI_PM2_CNT 0x50
+#define B_PCH_ACPI_PM2_CNT_ARB_DIS 0x01
+
+#define R_PCH_OC_WDT_CTL 0x54
+#define B_PCH_OC_WDT_CTL_RLD BIT31
+#define B_PCH_OC_WDT_CTL_ICCSURV_STS BIT25
+#define B_PCH_OC_WDT_CTL_NO_ICCSURV_STS BIT24
+#define B_PCH_OC_WDT_CTL_FORCE_ALL BIT15
+#define B_PCH_OC_WDT_CTL_EN BIT14
+#define B_PCH_OC_WDT_CTL_ICCSURV BIT13
+#define B_PCH_OC_WDT_CTL_LCK BIT12
+#define B_PCH_OC_WDT_CTL_TOV_MASK 0x3FF
+#define B_PCH_OC_WDT_CTL_FAILURE_STS BIT23
+#define B_PCH_OC_WDT_CTL_UNXP_RESET_STS BIT22
+#define B_PCH_OC_WDT_CTL_AFTER_POST 0x3F0000
+#define V_PCH_OC_WDT_CTL_STATUS_FAILURE 1
+#define V_PCH_OC_WDT_CTL_STATUS_OK 0
+
+#define R_PCH_ALT_GPI_SMI_EN2 0x5C
+#define B_PCH_ALT_GPI_SMI_EN2_ALT_GP60_SMI_EN BIT7
+#define B_PCH_ALT_GPI_SMI_EN2_ALT_GP57_SMI_EN BIT6
+#define B_PCH_ALT_GPI_SMI_EN2_ALT_GP56_SMI_EN BIT5
+#define B_PCH_ALT_GPI_SMI_EN2_ALT_GP43_SMI_EN BIT4
+#define B_PCH_ALT_GPI_SMI_EN2_ALT_GP22_SMI_EN BIT3
+#define B_PCH_ALT_GPI_SMI_EN2_ALT_GP21_SMI_EN BIT2
+#define B_PCH_ALT_GPI_SMI_EN2_ALT_GP19_SMI_EN BIT1
+#define B_PCH_ALT_GPI_SMI_EN2_ALT_GP17_SMI_EN BIT0
+#define R_PCH_ALT_GPI_SMI_STS2 0x5E
+#define B_PCH_ALT_GPI_SMI_STS2_ALT_GP60_SMI_STS BIT7
+#define B_PCH_ALT_GPI_SMI_STS2_ALT_GP57_SMI_STS BIT6
+#define B_PCH_ALT_GPI_SMI_STS2_ALT_GP56_SMI_STS BIT5
+#define B_PCH_ALT_GPI_SMI_STS2_ALT_GP43_SMI_STS BIT4
+#define B_PCH_ALT_GPI_SMI_STS2_ALT_GP22_SMI_STS BIT3
+#define B_PCH_ALT_GPI_SMI_STS2_ALT_GP21_SMI_STS BIT2
+#define B_PCH_ALT_GPI_SMI_STS2_ALT_GP19_SMI_STS BIT1
+#define B_PCH_ALT_GPI_SMI_STS2_ALT_GP17_SMI_STS BIT0
+
+//
+// TCO register I/O map
+//
+#define PCH_TCO_BASE 0x60
+
+#define R_PCH_TCO_RLD 0x0
+#define R_PCH_TCO_DAT_IN 0x2
+#define R_PCH_TCO_DAT_OUT 0x3
+#define R_PCH_TCO1_STS 0x04
+#define S_PCH_TCO1_STS 2
+#define B_PCH_TCO1_STS_DMISERR 0x1000
+#define B_PCH_TCO1_STS_DMISMI 0x0400
+#define B_PCH_TCO1_STS_DMISCI 0x0200
+#define B_PCH_TCO1_STS_BIOSWR 0x0100
+#define B_PCH_TCO1_STS_NEWCENTURY 0x0080
+#define B_PCH_TCO1_STS_TIMEOUT 0x0008
+#define B_PCH_TCO1_STS_TCO_INT 0x0004
+#define B_PCH_TCO1_STS_SW_TCO_SMI 0x0002
+#define B_PCH_TCO1_STS_NMI2SMI 0001
+#define N_PCH_TCO1_STS_DMISMI 10
+#define N_PCH_TCO1_STS_BIOSWR 8
+#define N_PCH_TCO1_STS_NEWCENTURY 7
+#define N_PCH_TCO1_STS_TIMEOUT 3
+#define N_PCH_TCO1_STS_SW_TCO_SMI 1
+#define N_PCH_TCO1_STS_NMI2SMI 0
+
+#define R_PCH_TCO2_STS 0x06
+#define S_PCH_TCO2_STS 2
+#define B_PCH_TCO2_STS_SMLINK_SLV_SMI BIT4
+#define B_PCH_TCO2_STS_BAD_BIOS BIT3
+#define B_PCH_TCO2_STS_BOOT BIT2
+#define B_PCH_TCO2_STS_SECOND_TO BIT1
+#define B_PCH_TCO2_STS_INTRD_DET BIT0
+#define N_PCH_TCO2_STS_INTRD_DET 0
+
+#define R_PCH_TCO1_CNT 0x08
+#define S_PCH_TCO1_CNT 2
+#define B_PCH_TCO_CNT_LOCK BIT12
+#define B_PCH_TCO_CNT_TMR_HLT BIT11
+#define B_PCH_TCO_CNT_NMI2SMI_EN BIT9
+#define B_PCH_TCO_CNT_NMI_NOW BIT8
+#define N_PCH_TCO_CNT_NMI2SMI_EN 9
+
+#define R_PCH_TCO2_CNT 0x0A
+#define S_PCH_TCO2_CNT 2
+#define B_PCH_TCO2_CNT_OS_POLICY 0x0030
+#define B_PCH_TCO2_CNT_GPI11_ALERT_DISABLE 0x0008
+#define B_PCH_TCO2_CNT_INTRD_SEL 0x0006
+#define N_PCH_TCO2_CNT_INTRD_SEL 2
+
+#define R_PCH_TCO_MESSAGE1 0x0C
+#define R_PCH_TCO_MESSAGE2 0x0D
+#define R_PCH_TCO_WDCNT 0x0E
+#define R_PCH_TCO_SW_IRQ_GEN 0x10
+#define B_PCH_TCO_IRQ12_CAUSE BIT1
+#define B_PCH_TCO_IRQ1_CAUSE BIT0
+#define R_PCH_TCO_TMR 0x12
+
+//
+// GPIO Init register offsets from GPIOBASE
+//
+#define R_PCH_GPIO_USE_SEL 0x00
+#define R_PCH_GPIO_IO_SEL 0x04
+#define R_PCH_GPIO_LVL 0x0C
+#define R_PCH_GPIO_IOAPIC_SEL 0x10
+#define V_PCH_GPIO_IOAPIC_SEL 0xFFFF
+#define R_PCH_GPIO_BLINK 0x18
+#define R_PCH_GPIO_SER_BLINK 0x1C
+#define R_PCH_GPIO_SB_CMDSTS 0x20
+#define B_PCH_GPIO_SB_CMDSTS_DLS_MASK 0x00C00000 ///< Data length select
+#define B_PCH_GPIO_SB_CMDSTS_DRS_MASK 0x003F0000 ///< Data rate select
+#define B_PCH_GPIO_SB_CMDSTS_BUSY BIT8
+#define B_PCH_GPIO_SB_CMDSTS_GO BIT0
+#define R_PCH_GPIO_SB_DATA 0x24
+#define R_PCH_GPIO_NMI_EN 0x28
+#define B_PCH_GPIO_NMI_EN 0xFFFF
+#define R_PCH_GPIO_NMI_STS 0x2A
+#define B_PCH_GPIO_NMI_STS 0xFFFF
+#define R_PCH_GPIO_GPI_INV 0x2C
+#define R_PCH_GPIO_USE_SEL2 0x30
+#define R_PCH_GPIO_IO_SEL2 0x34
+#define R_PCH_GPIO_LVL2 0x38
+#define R_PCH_GPIO_USE_SEL3 0x40
+#define R_PCH_GPIO_IO_SEL3 0x44
+#define R_PCH_GPIO_LVL3 0x48
+
+#define R_PCH_GP_RST_SEL 0x60
+#define S_PCH_GP_RST_SEL 4
+#define R_PCH_GP_RST_SEL2 0x64
+#define S_PCH_GP_RST_SEL2 4
+#define R_PCH_GP_RST_SEL3 0x68
+#define S_PCH_GP_RST_SEL3 4
+
+typedef struct {
+ UINT16 GpioOwn : 1;
+ UINT16 GpiRout : 1;
+ UINT16 GpiIe : 1;
+ UINT16 GpioUseSel : 1;
+ UINT16 GpioIoSel : 1;
+ UINT16 GpiInv : 1;
+ UINT16 GpiLxEb : 1;
+ UINT16 GpoLvl : 1;
+ UINT16 GpiWp : 2;
+ UINT16 GpinDis : 1;
+ UINT16 Reserved : 5;
+} PCH_GPIO_DEFINITION;
+
+#define R_PCH_GPIO_OWN0 0x00
+#define B_PCH_GPIO_OWN0_GPIO_USE_SEL BIT0
+#define B_PCH_GPIO_OWN0_GPIO_IO_SEL BIT2
+#define B_PCH_GPIO_OWN0_GPI_INV BIT3
+#define B_PCH_GPIO_OWN0_GPI_LxEB BIT4
+#define B_PCH_GPIO_OWN0_GPI_LVL BIT30
+#define B_PCH_GPIO_OWN0_GPO_LVL BIT31
+
+#define V_PCH_GPIO_OWN_GPIO 0x01
+#define V_PCH_GPIO_OWN_ACPI 0x00
+
+#define V_PCH_GPIO_USE_SEL_NATIVE 0x00
+#define V_PCH_GPIO_USE_SEL_GPIO 0x01
+
+#define V_PCH_GPIO_IO_SEL_OUT 0x00
+#define V_PCH_GPIO_IO_SEL_IN 0x01
+
+#define V_PCH_GPO_LVL_LOW 0x00
+#define V_PCH_GPO_LVL_HIGH 0x01
+
+#define V_PCH_GPI_LVL_NORMAL 0x00
+#define V_PCH_GPI_LVL_INVERTED 0x01
+
+#define V_PCH_GPI_LxEB_EDGE 0x00
+#define V_PCH_GPI_LxEB_LEVEL 0x01
+
+#define V_PCH_GPINDIS_ENABLE 0x00
+#define V_PCH_GPINDIS_DISABLE 0x01
+
+#define V_PCH_GPIWP_NONE 0x00
+#define V_PCH_GPIWP_DOWN 0x01
+#define V_PCH_GPIWP_UP 0x02
+
+#define R_PCH_GPIO_ROUT0 0x30
+#define V_PCH_GPIO_ROUT0_NMI_SMI 0x01
+#define V_PCH_GPIO_ROUT0_SCI 0x00
+
+#define R_PCH_GPIO_GC 0x7C
+#define R_PCH_GPI_IS0 0x80
+#define R_PCH_GPI_IS1 0x84
+#define R_PCH_GPI_IS2 0x88
+#define V_PCH_GPI_IS_CLEARALL 0xFFFFFFFF
+
+#define R_PCH_GPI_IE0 0x90
+#define V_PCH_GPI_IE_APIC_DISABLED 0x00
+#define V_PCH_GPI_IE_APIC_ENABLED 0x01
+
+#define R_PCH_GPI_IE1 0x94
+#define R_PCH_GPI_IE2 0x98
+#define V_PCH_GPI_IE_CLEARALL 0x00000000
+
+#define R_PCH_GP_N_CONFIG0 0x100
+#define R_PCH_GP_X_CONFIG0(n) (R_PCH_GP_N_CONFIG0 + ((n) * 0x08))
+#define R_PCH_GP_18_CONFIG0 R_PCH_GP_X_CONFIG0(18)
+#define R_PCH_GP_19_CONFIG0 R_PCH_GP_X_CONFIG0(19)
+#define R_PCH_GP_20_CONFIG0 R_PCH_GP_X_CONFIG0(20)
+#define R_PCH_GP_21_CONFIG0 R_PCH_GP_X_CONFIG0(21)
+#define R_PCH_GP_22_CONFIG0 R_PCH_GP_X_CONFIG0(22)
+#define R_PCH_GP_23_CONFIG0 R_PCH_GP_X_CONFIG0(23)
+#define R_PCH_GP_29_CONFIG0 R_PCH_GP_X_CONFIG0(29)
+#define R_PCH_GP_30_CONFIG0 R_PCH_GP_X_CONFIG0(30)
+#define R_PCH_GP_60_CONFIG0 R_PCH_GP_X_CONFIG0(60)
+#define R_PCH_GP_73_CONFIG0 R_PCH_GP_X_CONFIG0(73)
+#define R_PCH_GP_83_CONFIG0 R_PCH_GP_X_CONFIG0(83) ///< SPI0
+#define R_PCH_GP_87_CONFIG0 R_PCH_GP_X_CONFIG0(87) ///< SPI1
+#define R_PCH_GP_91_CONFIG0 R_PCH_GP_X_CONFIG0(91) ///< UART0
+#define V_PCH_GPIO_PIN_MAX 95
+
+//
+// Processor interface registers
+//
+#define R_PCH_NMI_SC 0x61
+#define B_PCH_NMI_SC_SERR_NMI_STS BIT7
+#define B_PCH_NMI_SC_IOCHK_NMI_STS BIT6
+#define B_PCH_NMI_SC_TMR2_OUT_STS BIT5
+#define B_PCH_NMI_SC_REF_TOGGLE BIT4
+#define B_PCH_NMI_SC_IOCHK_NMI_EN BIT3
+#define B_PCH_NMI_SC_PCI_SERR_EN BIT2
+#define B_PCH_NMI_SC_SPKR_DAT_EN BIT1
+#define B_PCH_NMI_SC_TIM_CNT2_EN BIT0
+#define R_PCH_NMI_EN 0x70
+#define B_PCH_NMI_EN_NMI_EN BIT7
+
+//
+// RTC register
+//
+#define R_PCH_RTC_INDEX 0x70
+#define R_PCH_RTC_TARGET 0x71
+#define R_PCH_RTC_EXT_INDEX 0x72
+#define R_PCH_RTC_EXT_TARGET 0x73
+#define R_PCH_RTC_REGA 0x0A
+#define B_PCH_RTC_REGA_UIP 0x80
+#define R_PCH_RTC_REGB 0x0B
+#define B_PCH_RTC_REGB_SET 0x80
+#define B_PCH_RTC_REGB_PIE 0x40
+#define B_PCH_RTC_REGB_AIE 0x20
+#define B_PCH_RTC_REGB_UIE 0x10
+#define B_PCH_RTC_REGB_DM 0x04
+#define B_PCH_RTC_REGB_HOURFORM 0x02
+#define R_PCH_RTC_REGC 0x0C
+#define R_PCH_RTC_REGD 0x0D
+
+//
+// Reset Generator I/O Port
+//
+#define R_PCH_RST_CNT 0xCF9
+#define B_PCH_RST_CNT_FULL_RST BIT3
+#define B_PCH_RST_CNT_RST_CPU BIT2
+#define B_PCH_RST_CNT_SYS_RST BIT1
+#define V_PCH_RST_CNT_FULLRESET 0x0E
+#define V_PCH_RST_CNT_HARDRESET 0x06
+#define V_PCH_RST_CNT_SOFTRESET 0x04
+#define V_PCH_RST_CNT_HARDSTARTSTATE 0x02
+#define V_PCH_RST_CNT_SOFTSTARTSTATE 0x00
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsPcie.h b/ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsPcie.h
new file mode 100644
index 0000000..7fb2afa
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsPcie.h
@@ -0,0 +1,548 @@
+/** @file
+ Register names for PCH PCI-E root port devices
+
+ Conventions:
+
+ - Prefixes:
+ Definitions beginning with "R_" are registers
+ Definitions beginning with "B_" are bits within registers
+ Definitions beginning with "V_" are meaningful values of bits within the registers
+ Definitions beginning with "S_" are register sizes
+ Definitions beginning with "N_" are the bit position
+ - In general, PCH registers are denoted by "_PCH_" in register names
+ - Registers / bits that are different between PCH generations are denoted by
+ "_PCH_<generation_name>_" in register/bit names. e.g., "_PCH_LPT_"
+ - Registers / bits that are different between SKUs are denoted by "_<SKU_name>"
+ at the end of the register/bit names
+ - Registers / bits of new devices introduced in a PCH generation will be just named
+ as "_PCH_" without <generation_name> inserted.
+
+@copyright
+ Copyright (c) 1999 - 2014 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PCH_REGS_PCIE_H_
+#define _PCH_REGS_PCIE_H_
+
+#define LPTH_PCIE_MAX_ROOT_PORTS 8
+#define LPTLP_PCIE_MAX_ROOT_PORTS 6
+
+//
+// PCH PCI Express Root Ports (D28:F0~5)
+//
+#define PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS 28
+#define PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_1 0
+#define PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_2 1
+#define PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_3 2
+#define PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_4 3
+#define PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_5 4
+#define PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_6 5
+#define PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_7 6
+#define PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_8 7
+#define R_PCH_PCIE_VENDOR_ID 0x00
+#define V_PCH_PCIE_VENDOR_ID V_PCH_INTEL_VENDOR_ID
+#define R_PCH_PCIE_DEVICE_ID 0x02
+
+#define V_PCH_LPTH_PCIE_DEVICE_ID_PORT1 0x8C10 ///< PCI Express Root Port #1, LPT
+#define V_PCH_LPTH_PCIE_DEVICE_ID_PORT2 0x8C12 ///< PCI Express Root Port #2, LPT
+#define V_PCH_LPTH_PCIE_DEVICE_ID_PORT3 0x8C14 ///< PCI Express Root Port #3, LPT
+#define V_PCH_LPTH_PCIE_DEVICE_ID_PORT4 0x8C16 ///< PCI Express Root Port #4, LPT
+#define V_PCH_LPTH_PCIE_DEVICE_ID_PORT5 0x8C18 ///< PCI Express Root Port #5, LPT
+#define V_PCH_LPTH_PCIE_DEVICE_ID_PORT6 0x8C1A ///< PCI Express Root Port #6, LPT
+#define V_PCH_LPTH_PCIE_DEVICE_ID_PORT7 0x8C1C ///< PCI Express Root Port #7, LPT
+#define V_PCH_LPTH_PCIE_DEVICE_ID_PORT8 0x8C1E ///< PCI Express Root Port #8, LPT
+#define V_PCH_LPTH_PCIE_DEVICE_ID_MB_SUBD 0x2448 ///< Mobile with subtractive decode enable
+#define V_PCH_LPTH_PCIE_DEVICE_ID_DT_SUBD 0x244E ///< Desktop with subtractive decode enable
+
+#define V_PCH_LPTLP_PCIE_DEVICE_ID_PORT1 0x9C10 ///< PCI Express Root Port #1, LPTLP PCIe Device ID bit[0] fuse = 0
+#define V_PCH_LPTLP_PCIE_DEVICE_ID_PORT1_ALT 0x9C11 ///< PCI Express Root Port #1, LPTLP PCIe Device ID bit[0] fuse = 1
+#define V_PCH_LPTLP_PCIE_DEVICE_ID_PORT2 0x9C12 ///< PCI Express Root Port #2, LPTLP PCIe Device ID bit[0] fuse = 0
+#define V_PCH_LPTLP_PCIE_DEVICE_ID_PORT2_ALT 0x9C13 ///< PCI Express Root Port #2, LPTLP PCIe Device ID bit[0] fuse = 1
+#define V_PCH_LPTLP_PCIE_DEVICE_ID_PORT3 0x9C14 ///< PCI Express Root Port #3, LPTLP PCIe Device ID bit[0] fuse = 0
+#define V_PCH_LPTLP_PCIE_DEVICE_ID_PORT3_ALT 0x9C15 ///< PCI Express Root Port #3, LPTLP PCIe Device ID bit[0] fuse = 1
+#define V_PCH_LPTLP_PCIE_DEVICE_ID_PORT4 0x9C16 ///< PCI Express Root Port #4, LPTLP PCIe Device ID bit[0] fuse = 0
+#define V_PCH_LPTLP_PCIE_DEVICE_ID_PORT4_ALT 0x9C17 ///< PCI Express Root Port #4, LPTLP PCIe Device ID bit[0] fuse = 1
+#define V_PCH_LPTLP_PCIE_DEVICE_ID_PORT5 0x9C18 ///< PCI Express Root Port #5, LPTLP PCIe Device ID bit[0] fuse = 0
+#define V_PCH_LPTLP_PCIE_DEVICE_ID_PORT5_ALT 0x9C19 ///< PCI Express Root Port #5, LPTLP PCIe Device ID bit[0] fuse = 1
+#define V_PCH_LPTLP_PCIE_DEVICE_ID_PORT6 0x9C1A ///< PCI Express Root Port #6, LPTLP PCIe Device ID bit[0] fuse = 0
+#define V_PCH_LPTLP_PCIE_DEVICE_ID_PORT6_ALT 0x9C1B ///< PCI Express Root Port #6, LPTLP PCIe Device ID bit[0] fuse = 1
+
+#define R_PCH_PCIE_PCICMD 0x04
+#define S_PCH_PCIE_PCICMD 2
+#define B_PCH_PCIE_PCICMD_ID BIT10
+#define B_PCH_PCIE_PCICMD_FBE BIT9
+#define B_PCH_PCIE_PCICMD_SEE BIT8
+#define B_PCH_PCIE_PCICMD_WCC BIT7
+#define B_PCH_PCIE_PCICMD_PER BIT6
+#define B_PCH_PCIE_PCICMD_VPS BIT5
+#define B_PCH_PCIE_PCICMD_PMWE BIT4
+#define B_PCH_PCIE_PCICMD_SCE BIT3
+#define B_PCH_PCIE_PCICMD_BME BIT2
+#define B_PCH_PCIE_PCICMD_MSE BIT1
+#define B_PCH_PCIE_PCICMD_IOSE BIT0
+#define R_PCH_PCIE_PCISTS 0x06
+#define S_PCH_PCIE_PCISTS 2
+#define B_PCH_PCIE_PCISTS_DPE BIT15
+#define B_PCH_PCIE_PCISTS_SSE BIT14
+#define B_PCH_PCIE_PCISTS_RMA BIT13
+#define B_PCH_PCIE_PCISTS_RTA BIT12
+#define B_PCH_PCIE_PCISTS_STA BIT11
+#define B_PCH_PCIE_PCISTS_DEV_STS (BIT10 | BIT9)
+#define B_PCH_PCIE_PCISTS_DPED BIT8
+#define B_PCH_PCIE_PCISTS_FB2BC BIT7
+#define B_PCH_PCIE_PCISTS_66MHZ_CAP BIT5
+#define B_PCH_PCIE_PCISTS_CAP_LST BIT4
+#define B_PCH_PCIE_PCISTS_INTR_STS BIT3
+#define R_PCH_PCIE_RID 0x08
+#define B_PCH_PCIE_RID 0xFF
+#define R_PCH_PCIE_PI 0x09
+#define B_PCH_PCIE_PI 0xFF
+#define R_PCH_PCIE_SCC 0x0A
+#define B_PCH_PCIE_SCC 0xFF
+#define V_PCH_PCIE_SCC_04 0x04
+#define V_PCH_PCIE_SCC_00 0x00
+#define R_PCH_PCIE_BCC 0x0B
+#define B_PCH_PCIE_BCC 0xFF
+#define R_PCH_PCIE_CLS 0x0C
+#define B_PCH_PCIE_CLS 0xFF
+#define R_PCH_PCIE_PLT 0x0D
+#define B_PCH_PCIE_PLT_LC 0xF8
+#define R_PCH_PCIE_HEADTYPE 0x0E
+#define B_PCH_PCIE_HEADTYPE_MFD BIT7
+#define B_PCH_PCIE_HEADTYPE_CL 0x7F
+#define V_PCH_PCIE_HEADTYPE_CL_01 0x01
+#define V_PCH_PCIE_HEADTYPE_CL_00 0x00
+#define R_PCH_PCIE_BNUM 0x18
+#define B_PCH_PCIE_BNUM_SBBN 0x00FF0000
+#define B_PCH_PCIE_BNUM_SCBN 0x0000FF00
+#define B_PCH_PCIE_BNUM_PBN 0x000000FF
+#define R_PCH_PCIE_SLT 0x1B
+#define B_PCH_PCIE_SLT 0xFF
+#define R_PCH_PCIE_IOBL 0x1C
+#define B_PCH_PCIE_IOBL_IOLA 0xF000
+#define B_PCH_PCIE_IOBL_IOLC 0x0F00
+#define B_PCH_PCIE_IOBL_IOBA 0x00F0
+#define B_PCH_PCIE_IOBL_IOBC 0x000F
+#define R_PCH_PCIE_SSTS 0x1E
+#define S_PCH_PCIE_SSTS 2
+#define B_PCH_PCIE_SSTS_DPE BIT15
+#define B_PCH_PCIE_SSTS_RSE BIT14
+#define B_PCH_PCIE_SSTS_RMA BIT13
+#define B_PCH_PCIE_SSTS_RTA BIT12
+#define B_PCH_PCIE_SSTS_STA BIT11
+#define B_PCH_PCIE_SSTS_SDTS (BIT10 | BIT9)
+#define B_PCH_PCIE_SSTS_DPD BIT8
+#define B_PCH_PCIE_SSTS_SFBC BIT7
+#define B_PCH_PCIE_SSTS_SC66 BIT5
+#define R_PCH_PCIE_MBL 0x20
+#define B_PCH_PCIE_MBL_ML 0xFFF00000
+#define B_PCH_PCIE_MBL_MB 0x0000FFF0
+#define R_PCH_PCIE_PMBL 0x24
+#define B_PCH_PCIE_PMBL_PML 0xFFF00000
+#define B_PCH_PCIE_PMBL_I64L 0x000F0000
+#define B_PCH_PCIE_PMBL_PMB 0x0000FFF0
+#define B_PCH_PCIE_PMBL_I64B 0x0000000F
+#define R_PCH_PCIE_PMBU32 0x28
+#define B_PCH_PCIE_PMBU32 0xFFFFFFFF
+#define R_PCH_PCIE_PMLU32 0x2C
+#define B_PCH_PCIE_PMLU32 0xFFFFFFFF
+#define R_PCH_PCIE_CAPP 0x34
+#define B_PCH_PCIE_CAPP 0xFF
+#define R_PCH_PCIE_INTR 0x3C
+#define B_PCH_PCIE_INTR_IPIN 0xFF00
+#define B_PCH_PCIE_INTR_ILINE 0x00FF
+#define R_PCH_PCIE_BCTRL 0x3E
+#define S_PCH_PCIE_BCTRL 2
+#define B_PCH_PCIE_BCTRL_DTSE BIT11
+#define B_PCH_PCIE_BCTRL_DTS BIT10
+#define B_PCH_PCIE_BCTRL_SDT BIT9
+#define B_PCH_PCIE_BCTRL_PDT BIT8
+#define B_PCH_PCIE_BCTRL_FBE BIT7
+#define B_PCH_PCIE_BCTRL_SBR BIT6
+#define B_PCH_PCIE_BCTRL_MAM BIT5
+#define B_PCH_PCIE_BCTRL_V16 BIT4
+#define B_PCH_PCIE_BCTRL_VE BIT3
+#define B_PCH_PCIE_BCTRL_IE BIT2
+#define B_PCH_PCIE_BCTRL_SE BIT1
+#define B_PCH_PCIE_BCTRL_PERE BIT0
+#define R_PCH_PCIE_CLIST 0x40
+#define B_PCH_PCIE_CLIST_NEXT 0xFF00
+#define B_PCH_PCIE_CLIST_CID 0x00FF
+#define R_PCH_PCIE_XCAP 0x42
+#define S_PCH_PCIE_XCAP 2
+#define B_PCH_PCIE_XCAP_IMN 0x3E00
+#define B_PCH_PCIE_XCAP_SI BIT8
+#define B_PCH_PCIE_XCAP_DT 0x00F0
+#define B_PCH_PCIE_XCAP_CV 0x000F
+#define R_PCH_PCIE_DCAP 0x44
+#define S_PCH_PCIE_DCAP 4
+#define B_PCH_PCIE_DCAP_CSPS 0x0C000000
+#define B_PCH_PCIE_DCAP_CSPV 0x03FC0000
+#define B_PCH_PCIE_DCAP_RBER BIT15
+#define B_PCH_PCIE_DCAP_PIP BIT14
+#define B_PCH_PCIE_DCAP_AIP BIT13
+#define B_PCH_PCIE_DCAP_ABP BIT12
+#define B_PCH_PCIE_DCAP_E1AL 0x00000E00
+#define B_PCH_PCIE_DCAP_E0AL 0x000001C0
+#define B_PCH_PCIE_DCAP_ETFS BIT5
+#define B_PCH_PCIE_DCAP_PFS 0x00000018
+#define B_PCH_PCIE_DCAP_MPS 0x00000007
+#define R_PCH_PCIE_DCTL 0x48
+#define S_PCH_PCIE_DCTL 2
+#define B_PCH_PCIE_DCTL_MRRS 0x7000
+#define B_PCH_PCIE_DCTL_ENS BIT11
+#define B_PCH_PCIE_DCTL_APME BIT10
+#define B_PCH_PCIE_DCTL_PFE BIT9
+#define B_PCH_PCIE_DCTL_ETFE BIT8
+#define B_PCH_PCIE_DCTL_MPS (BIT7 | BIT6 | BIT5)
+#define B_PCH_PCIE_DCTL_ERO BIT4
+#define B_PCH_PCIE_DCTL_URE BIT3
+#define B_PCH_PCIE_DCTL_FEE BIT2
+#define B_PCH_PCIE_DCTL_NFE BIT1
+#define B_PCH_PCIE_DCTL_CEE BIT0
+#define R_PCH_PCIE_DSTS 0x4A
+#define B_PCH_PCIE_DSTS_TDP BIT5
+#define B_PCH_PCIE_DSTS_APD BIT4
+#define B_PCH_PCIE_DSTS_URD BIT3
+#define B_PCH_PCIE_DSTS_FED BIT2
+#define B_PCH_PCIE_DSTS_NFED BIT1
+#define B_PCH_PCIE_DSTS_CED BIT0
+#define R_PCH_PCIE_LCAP 0x4C
+#define B_PCH_PCIE_LCAP_PN 0xFF000000
+#define V_PCH_PCIE_LCAP_PN1 (1 << 24)
+#define V_PCH_PCIE_LCAP_PN2 (2 << 24)
+#define V_PCH_PCIE_LCAP_PN3 (3 << 24)
+#define V_PCH_PCIE_LCAP_PN4 (4 << 24)
+#define V_PCH_PCIE_LCAP_PN5 (5 << 24)
+#define V_PCH_PCIE_LCAP_PN6 (6 << 24)
+#define V_PCH_PCIE_LCAP_PN7 (7 << 24)
+#define V_PCH_PCIE_LCAP_PN8 (8 << 24)
+#define B_PCH_PCIE_LCAP_LARC BIT20
+#define B_PCH_PCIE_LCAP_EL1 (BIT17 | BIT16 | BIT15)
+#define B_PCH_PCIE_LCAP_EL0 (BIT14 | BIT13 | BIT12)
+#define B_PCH_PCIE_LCAP_APMS (BIT11 | BIT10)
+#define V_PCH_PCIE_LCAP_APMS_L0S (1 << 10)
+#define V_PCH_PCIE_LCAP_APMS_L0S_L1 (3 << 10)
+#define B_PCH_PCIE_LCAP_MLW 0x000003F0
+#define B_PCH_PCIE_LCAP_MLS 0x0000000F
+#define R_PCH_PCIE_LCTL 0x50
+#define B_PCH_PCIE_LCTL_HAWD BIT9
+#define B_PCH_PCIE_LCTL_ES BIT7
+#define B_PCH_PCIE_LCTL_CCC BIT6
+#define B_PCH_PCIE_LCTL_RL BIT5
+#define B_PCH_PCIE_LCTL_LD BIT4
+#define B_PCH_PCIE_LCTL_RCBC BIT3
+#define B_PCH_PCIE_LCTL_APMC (BIT1 | BIT0)
+#define V_PCH_PCIE_LCTL_APMC_L0S 1
+#define V_PCH_PCIE_LCTL_APMC_L1 2
+#define V_PCH_PCIE_LCTL_APMC_L0S_L1 3
+#define R_PCH_PCIE_LSTS 0x52
+#define S_PCH_PCIE_LSTS 2
+#define B_PCH_PCIE_LSTS_DLLA BIT13
+#define B_PCH_PCIE_LSTS_SCC BIT12
+#define B_PCH_PCIE_LSTS_LT BIT11
+#define B_PCH_PCIE_LSTS_LTE BIT10
+#define B_PCH_PCIE_LSTS_NLW 0x03F0
+#define V_PCH_PCIE_LSTS_NLW_1 0x0010
+#define V_PCH_PCIE_LSTS_NLW_2 0x0020
+#define V_PCH_PCIE_LSTS_NLW_4 0x0040
+#define B_PCH_PCIE_LSTS_LS 0x000F
+#define R_PCH_PCIE_SLCAP 0x54
+#define S_PCH_PCIE_SLCAP 4
+#define B_PCH_PCIE_SLCAP_PSN 0xFFF80000
+#define B_PCH_PCIE_SLCAP_SLS 0x00018000
+#define B_PCH_PCIE_SLCAP_SLV 0x00007F80
+#define B_PCH_PCIE_SLCAP_HPC BIT6
+#define B_PCH_PCIE_SLCAP_HPS BIT5
+#define B_PCH_PCIE_SLCAP_PIP BIT4
+#define B_PCH_PCIE_SLCAP_AIP BIT3
+#define B_PCH_PCIE_SLCAP_MSP BIT2
+#define B_PCH_PCIE_SLCAP_PCP BIT1
+#define B_PCH_PCIE_SLCAP_ABP BIT0
+#define R_PCH_PCIE_SLCTL 0x58
+#define S_PCH_PCIE_SLCTL 2
+#define B_PCH_PCIE_SLCTL_LACE BIT12
+#define B_PCH_PCIE_SLCTL_PCC BIT10
+#define B_PCH_PCIE_SLCTL_HPE BIT5
+#define B_PCH_PCIE_SLCTL_PDE BIT3
+#define R_PCH_PCIE_SLSTS 0x5A
+#define S_PCH_PCIE_SLSTS 2
+#define B_PCH_PCIE_SLSTS_LASC BIT8
+#define B_PCH_PCIE_SLSTS_PDS BIT6
+#define B_PCH_PCIE_SLSTS_MS BIT5
+#define B_PCH_PCIE_SLSTS_PDC BIT3
+#define B_PCH_PCIE_SLSTS_MSC BIT2
+#define B_PCH_PCIE_SLSTS_PFD BIT1
+#define R_PCH_PCIE_RCTL 0x5C
+#define S_PCH_PCIE_RCTL 2
+#define B_PCH_PCIE_RCTL_PIE BIT3
+#define B_PCH_PCIE_RCTL_SFE BIT2
+#define B_PCH_PCIE_RCTL_SNE BIT1
+#define B_PCH_PCIE_RCTL_SCE BIT0
+#define R_PCH_PCIE_RSTS 0x60
+#define S_PCH_PCIE_RSTS 4
+#define B_PCH_PCIE_RSTS_PP BIT17
+#define B_PCH_PCIE_RSTS_PS BIT16
+#define B_PCH_PCIE_RSTS_RID 0x0000FFFF
+#define R_PCH_PCIE_DCAP2 0x64
+#define B_PCH_PCIE_DCAP2_CTDS BIT4
+#define B_PCH_PCIE_DCAP2_CTRS 0xF
+#define V_PCH_PCIE_DCAP2_CTRS_UNSUPPORTED 0x0
+#define V_PCH_PCIE_DCAP2_CTRS_RANGE_A 0x1
+#define V_PCH_PCIE_DCAP2_CTRS_RANGE_B 0x2
+#define V_PCH_PCIE_DCAP2_CTRS_RANGE_C 0x4
+#define V_PCH_PCIE_DCAP2_CTRS_RANGE_D 0x8
+#define R_PCH_PCIE_DCTL2 0x68
+#define B_PCH_PCIE_DCTL2_CTD BIT4
+#define B_PCH_PCIE_DCTL2_CTV 0xF
+#define V_PCH_PCIE_DCTL2_CTV_DEFAULT 0x0
+#define V_PCH_PCIE_DCTL2_CTV_40MS_50MS 0x5
+#define V_PCH_PCIE_DCTL2_CTV_160MS_170MS 0x6
+#define V_PCH_PCIE_DCTL2_CTV_400MS_500MS 0x9
+#define V_PCH_PCIE_DCTL2_CTV_1P6S_1P7S 0xA
+#define R_PCH_PCIE_LCTL2 0x70
+#define B_PCH_PCIE_LCTL2_TLS (BIT3 | BIT2 | BIT1 | BIT0)
+#define R_PCH_PCIE_MID 0x80
+#define S_PCH_PCIE_MID 2
+#define B_PCH_PCIE_MID_NEXT 0xFF00
+#define B_PCH_PCIE_MID_CID 0x00FF
+#define R_PCH_PCIE_MC 0x82
+#define S_PCH_PCIE_MC 2
+#define B_PCH_PCIE_MC_C64 BIT7
+#define B_PCH_PCIE_MC_MME (BIT6 | BIT5 | BIT4)
+#define B_PCH_PCIE_MC_MMC 0x000E
+#define B_PCH_PCIE_MC_MSIE BIT0
+#define R_PCH_PCIE_MA 0x84
+#define S_PCH_PCIE_MA 4
+#define B_PCH_PCIE_MA_ADDR 0xFFFFFFFC
+#define R_PCH_PCIE_MD 0x88
+#define S_PCH_PCIE_MD 2
+#define B_PCH_PCIE_MD_DATA 0xFFFF
+#define R_PCH_PCIE_SVCAP 0x90
+#define S_PCH_PCIE_SVCAP 2
+#define B_PCH_PCIE_SVCAP_NEXT 0xFF00
+#define B_PCH_PCIE_SVCAP_CID 0x00FF
+#define R_PCH_PCIE_SVID 0x94
+#define S_PCH_PCIE_SVID 4
+#define B_PCH_PCIE_SVID_SID 0xFFFF0000
+#define B_PCH_PCIE_SVID_SVID 0x0000FFFF
+#define R_PCH_PCIE_PMCAP 0xA0
+#define S_PCH_PCIE_PMCAP 2
+#define B_PCH_PCIE_PMCAP_NEXT 0xFF00
+#define B_PCH_PCIE_PMCAP_CID 0x00FF
+#define R_PCH_PCIE_PMC 0xA2
+#define S_PCH_PCIE_PMC 2
+#define B_PCH_PCIE_PMC_PMES 0xF800
+#define B_PCH_PCIE_PMC_D2S BIT10
+#define B_PCH_PCIE_PMC_D1S BIT9
+#define B_PCH_PCIE_PMC_AC 0x01C0
+#define B_PCH_PCIE_PMC_DSI BIT5
+#define B_PCH_PCIE_PMC_PMEC BIT3
+#define B_PCH_PCIE_PMC_VS 0x0007
+#define R_PCH_PCIE_PMCS 0xA4
+#define S_PCH_PCIE_PMCS 4
+#define B_PCH_PCIE_PMCS_BPCE BIT23
+#define B_PCH_PCIE_PMCS_B23S BIT22
+#define B_PCH_PCIE_PMCS_PMES BIT15
+#define B_PCH_PCIE_PMCS_PMEE BIT8
+#define B_PCH_PCIE_PMCS_PS (BIT1 | BIT0)
+#define V_PCH_PCIE_PMCS_D0 0x00
+#define V_PCH_PCIE_PMCS_D3H 0x03
+#define R_PCH_PCIE_CCFG 0xD0
+#define B_PCH_PCIE_CCFG_DCGEISMA BIT17
+#define R_PCH_PCIE_MPC2 0xD4
+#define S_PCH_PCIE_MPC2 4
+#define B_PCH_PCIE_MPC2_PCME BIT5
+#define B_PCH_PCIE_MPC2_ASPMCOEN BIT4
+#define B_PCH_PCIE_MPC2_ASPMCO (BIT3 | BIT2)
+#define V_PCH_PCIE_MPC2_ASPMCO_DISABLED 0
+#define V_PCH_PCIE_MPC2_ASPMCO_L0S 1 << 2
+#define V_PCH_PCIE_MPC2_ASPMCO_L1 2 << 2
+#define V_PCH_PCIE_MPC2_ASPMCO_L0S_L1 3 << 2
+#define B_PCH_PCIE_MPC2_EOIFD BIT1
+#define B_PCH_PCIE_MPC2_L1CTM BIT0
+#define R_PCH_PCIE_MPC 0xD8
+#define S_PCH_PCIE_MPC 4
+#define B_PCH_PCIE_MPC_PMCE BIT31
+#define B_PCH_PCIE_MPC_HPCE BIT30
+#define B_PCH_PCIE_MPC_LHO BIT29
+#define B_PCH_PCIE_MPC_ATE BIT28
+#define B_PCH_PCIE_MPC_MMBNCE BIT27
+#define B_PCH_PCIE_MPC_IRBNCE BIT26
+#define B_PCH_PCIE_MPC_IRRCE BIT25
+#define B_PCH_PCIE_MPC_BMERCE BIT24
+#define B_PCH_PCIE_MPC_FORCEDET BIT22
+#define B_PCH_PCIE_MPC_FCDL1E BIT21
+#define B_PCH_PCIE_MPC_UCEL (BIT20 | BIT19 | BIT18)
+#define B_PCH_PCIE_MPC_CCEL (BIT17 | BIT16 | BIT15)
+#define B_PCH_PCIE_MPC_PAE BIT7
+#define B_PCH_PCIE_MPC_MCTPSE BIT3
+#define B_PCH_PCIE_MPC_BT BIT2
+#define B_PCH_PCIE_MPC_HPME BIT1
+#define N_PCH_PCIE_MPC_HPME 1
+#define B_PCH_PCIE_MPC_PMME BIT0
+#define R_PCH_PCIE_SMSCS 0xDC
+#define S_PCH_PCIE_SMSCS 4
+#define B_PCH_PCIE_SMSCS_PMCS BIT31
+#define B_PCH_PCIE_SMSCS_HPCS BIT30
+#define B_PCH_PCIE_SMSCS_HPLAS BIT4
+#define N_PCH_PCIE_SMSCS_HPLAS 4
+#define B_PCH_PCIE_SMSCS_HPCCM BIT3
+#define B_PCH_PCIE_SMSCS_HPABM BIT2
+#define B_PCH_PCIE_SMSCS_HPPDM BIT1
+#define N_PCH_PCIE_SMSCS_HPPDM 1
+#define B_PCH_PCIE_SMSCS_PMMS BIT0
+#define R_PCH_PCIE_RPDCGEN 0xE1
+#define S_PCH_PCIE_RPDCGEN 1
+#define B_PCH_PCIE_RPDCGEN_RPSCGEN BIT7
+#define B_PCH_PCIE_RPDCGEN_POCGE BIT6
+#define B_PCH_PCIE_RPDCGEN_LCLKREQEN BIT5
+#define B_PCH_PCIE_RPDCGEN_BBCLKREQEN BIT4
+#define B_PCH_PCIE_RPDCGEN_SRDLCGEN BIT3
+#define B_PCH_PCIE_RPDCGEN_SRDBCGEN BIT2
+#define B_PCH_PCIE_RPDCGEN_RPDLCGEN BIT1
+#define B_PCH_PCIE_RPDCGEN_RPDBCGEN BIT0
+#define R_PCH_PCIE_RPPGEN 0xE2
+#define B_PCH_PCIE_RPPGEN_PTOTOP BIT6
+#define B_PCH_PCIE_RPPGEN_LMSDOCGE BIT5
+#define B_PCH_PCIE_RPPGEN_SEOCGE BIT4
+#define R_PCH_PCIE_PECR1 0xE8
+#define S_PCH_PCIE_PECR1 4
+#define B_PCH_PCIE_PECR1_FIELD_2 BIT1
+#define V_PCH_PCIE_PECR1_FIELD_3 (BIT3 | BIT2)
+#define R_PCH_PCIE_PECR3 0xEC
+#define B_PCH_PCIE_PECR3_SDCDID BIT1 ///< Subtractive Decode Compatibility Device ID
+#define B_PCH_PCIE_PECR3_SDE BIT0 ///< Subtractive Decode Enable
+#define R_PCH_PCIE_STRPFUSECFG 0xFC
+#define B_PCH_PCIE_STRPFUSECFG_SATAP3_PCIEP6L0_MODE (BIT23 | BIT22)
+#define B_PCH_PCIE_STRPFUSECFG_SATAP2_PCIEP6L1_MODE (BIT21 | BIT20)
+#define B_PCH_PCIE_STRPFUSECFG_SATAP5_PCIEP2_MODE (BIT23 | BIT22)
+#define B_PCH_PCIE_STRPFUSECFG_SATAP4_PCIEP1_MODE (BIT21 | BIT20)
+#define B_PCH_PCIE_STRPFUSECFG_GBE_PCIE_PEN (BIT19)
+#define B_PCH_PCIE_STRPFUSECFG_GBE_PCIEPORTSEL (BIT18 | BIT17 | BIT16)
+#define N_PCH_PCIE_STRPFUSECFG_GBE_PCIEPORTSEL 16
+#define B_PCH_PCIE_STRPFUSECFG_RPC (BIT15 | BIT14)
+#define V_PCH_PCIE_STRPFUSECFG_RPC_1_1_1_1 (0)
+#define V_PCH_PCIE_STRPFUSECFG_RPC_2_1_1 (BIT14)
+#define V_PCH_PCIE_STRPFUSECFG_RPC_2_2 (BIT15)
+#define V_PCH_PCIE_STRPFUSECFG_RPC_4 (BIT15 | BIT14)
+#define N_PCH_PCIE_STRPFUSECFG_RPC_4 14
+#define B_PCH_PCIE_STRPFUSECFG_SATAP3_PCIEP6L0_MODE_FUSE (BIT13 | BIT12)
+#define B_PCH_PCIE_STRPFUSECFG_SATAP2_PCIEP6L1_MODE_FUSE (BIT11 | BIT10)
+#define B_PCH_PCIE_STRPFUSECFG_SATAP5_PCIEP2_MODE_FUSE (BIT13 | BIT12)
+#define B_PCH_PCIE_STRPFUSECFG_SATAP4_PCIEP1_MODE_FUSE (BIT11 | BIT10)
+#define B_PCH_PCIE_STRPFUSECFG_mPHYIOPMDIS (BIT9)
+#define B_PCH_PCIE_STRPFUSECFG_PLLSHTDWNDIS (BIT8)
+#define B_PCH_PCIE_STRPFUSECFG_STPGATEDIS (BIT7)
+#define B_PCH_PCIE_STRPFUSECFG_ASPMDIS (BIT6)
+#define B_PCH_PCIE_STRPFUSECFG_LDCGDIS (BIT5)
+#define B_PCH_PCIE_STRPFUSECFG_LTCGDIS (BIT4)
+#define B_PCH_PCIE_STRPFUSECFG_BDCGDIS (BIT3)
+#define B_PCH_PCIE_STRPFUSECFG_DESKTOPMOB (BIT1)
+#define R_PCH_PCIE_AECH 0x100
+#define R_PCH_PCIE_UES 0x104
+#define S_PCH_PCIE_UES 4
+#define B_PCH_PCIE_UES_URE BIT20
+#define B_PCH_PCIE_UES_EE BIT19
+#define B_PCH_PCIE_UES_MT BIT18
+#define B_PCH_PCIE_UES_RO BIT17
+#define B_PCH_PCIE_UES_UC BIT16
+#define B_PCH_PCIE_UES_CA BIT15
+#define B_PCH_PCIE_UES_CT BIT14
+#define B_PCH_PCIE_UES_FCPE BIT13
+#define B_PCH_PCIE_UES_PT BIT12
+#define B_PCH_PCIE_UES_DLPE BIT4
+#define B_PCH_PCIE_UES_TE BIT0
+#define R_PCH_PCIE_UEM 0x108
+#define S_PCH_PCIE_UEM 4
+#define B_PCH_PCIE_UEM_URE BIT20
+#define B_PCH_PCIE_UEM_EE BIT19
+#define B_PCH_PCIE_UEM_MT BIT18
+#define B_PCH_PCIE_UEM_RO BIT17
+#define B_PCH_PCIE_UEM_UC BIT16
+#define B_PCH_PCIE_UEM_CA BIT15
+#define B_PCH_PCIE_UEM_CT BIT14
+#define B_PCH_PCIE_UEM_FCPE BIT13
+#define B_PCH_PCIE_UEM_PT BIT12
+#define B_PCH_PCIE_UEM_DLPE BIT4
+#define B_PCH_PCIE_UEM_TE BIT0
+#define R_PCH_PCIE_UEV 0x10C
+#define S_PCH_PCIE_UEV 4
+#define B_PCH_PCIE_UEV_URE BIT20
+#define B_PCH_PCIE_UEV_EE BIT19
+#define B_PCH_PCIE_UEV_MT BIT18
+#define B_PCH_PCIE_UEV_RO BIT17
+#define B_PCH_PCIE_UEV_UC BIT16
+#define B_PCH_PCIE_UEV_CA BIT15
+#define B_PCH_PCIE_UEV_CT BIT14
+#define B_PCH_PCIE_UEV_FCPE BIT13
+#define B_PCH_PCIE_UEV_PT BIT12
+#define B_PCH_PCIE_UEV_DLPE BIT4
+#define B_PCH_PCIE_UEV_TE BIT0
+#define R_PCH_PCIE_CES 0x110
+#define S_PCH_PCIE_CES 4
+#define B_PCH_PCIE_CES_ANFES BIT13
+#define B_PCH_PCIE_CES_RTT BIT12
+#define B_PCH_PCIE_CES_RNR BIT8
+#define B_PCH_PCIE_CES_BD BIT7
+#define B_PCH_PCIE_CES_BT BIT6
+#define B_PCH_PCIE_CES_RE BIT0
+#define R_PCH_PCIE_CEM 0x114
+#define S_PCH_PCIE_CEM 4
+#define B_PCH_PCIE_CEM_ANFEM BIT13
+#define B_PCH_PCIE_CEM_RTT BIT12
+#define B_PCH_PCIE_CEM_RNR BIT8
+#define B_PCH_PCIE_CEM_BD BIT7
+#define B_PCH_PCIE_CEM_BT BIT6
+#define B_PCH_PCIE_CEM_RE BIT0
+#define R_PCH_PCIE_AECC 0x118
+#define S_PCH_PCIE_AECC 4
+#define B_PCH_PCIE_AECC_ECE BIT8
+#define B_PCH_PCIE_AECC_ECC BIT7
+#define B_PCH_PCIE_AECC_EGE BIT6
+#define B_PCH_PCIE_AECC_EGC BIT5
+#define B_PCH_PCIE_AECC_FEP 0x0000001F
+#define R_PCH_PCIE_RES 0x130
+#define S_PCH_PCIE_RES 4
+#define B_PCH_PCIE_RES_AEMN 0xF8000000
+#define B_PCH_PCIE_RES_FEMR BIT6
+#define B_PCH_PCIE_RES_NFEMR BIT5
+#define B_PCH_PCIE_RES_FUF BIT4
+#define B_PCH_PCIE_RES_MENR BIT3
+#define B_PCH_PCIE_RES_ENR BIT2
+#define B_PCH_PCIE_RES_MCR BIT1
+#define B_PCH_PCIE_RES_CR BIT0
+#define R_PCH_PCIE_PECR2 0x320
+#define S_PCH_PCIE_PECR2 4
+#define B_PCH_PCIE_PECR2_FIELD_1 BIT21
+#define R_PCH_PCIE_PEETM 0x324
+#define S_PCH_PCIE_PEETM 1
+#define B_PCH_PCIE_PEETM_BAU BIT2
+#define R_PCH_PCIE_PEC1 0x330
+#define S_PCH_PCIE_PEC1 4
+#define B_PCH_PCIE_PEC1_FIELD_1 0xFF
+#define R_PCH_PCIE_LTROVR 0x400
+#define R_PCH_PCIE_LTROVR2 0x404
+#define R_PCH_PCIE_L1SECH 0x200
+#define V_PCH_PCIE_L1SECH_L1SUBST_CAP_ID 0x1E
+#define R_PCH_PCIE_L1SCAP 0x204
+#define R_PCH_PCIE_PCIEPMECTL 0x420
+#define B_PCH_PCIE_PCIEPMECTL_FDPGE BIT31
+#define B_PCH_PCIE_PCIEPMECTL_DLSULPGE BIT30
+#define B_PCH_PCIE_PCIEPMECTL_DLSULDLSD BIT29
+#define B_PCH_PCIE_PCIEPMECTL_L1LE BIT17
+#define V_PCH_PCIE_PCIEPMECTL_L1LTRTLV (BIT13 | BIT12 | BIT11 | BIT10 | BIT9 | BIT8 | BIT7 | BIT6 | BIT5 | BIT4)
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsRcrb.h b/ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsRcrb.h
new file mode 100644
index 0000000..a5206e4
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsRcrb.h
@@ -0,0 +1,483 @@
+/** @file
+ Register names for PCH Chipset Configuration Registers
+
+ Conventions:
+
+ - Prefixes:
+ Definitions beginning with "R_" are registers
+ Definitions beginning with "B_" are bits within registers
+ Definitions beginning with "V_" are meaningful values of bits within the registers
+ Definitions beginning with "S_" are register sizes
+ Definitions beginning with "N_" are the bit position
+ - In general, PCH registers are denoted by "_PCH_" in register names
+ - Registers / bits that are different between PCH generations are denoted by
+ "_PCH_<generation_name>_" in register/bit names. e.g., "_PCH_LPT_"
+ - Registers / bits that are different between SKUs are denoted by "_<SKU_name>"
+ at the end of the register/bit names
+ - Registers / bits of new devices introduced in a PCH generation will be just named
+ as "_PCH_" without <generation_name> inserted.
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PCH_REGS_RCRB_H_
+#define _PCH_REGS_RCRB_H_
+
+//
+// Chipset configuration registers (Memory space)
+// RCBA
+//
+#define R_PCH_RCRB_CIR0050 0x0050
+#define B_PCH_RCRB_CIR0_TCLOCKDN BIT31
+#define R_PCH_RCRB_RPFN 0x0404 ///< Root Port Function Number & Hide for PCI Express Root Ports
+#define B_PCH_RCRB_RPFN_RP8CH BIT31 ///< Root Port 8 Hide
+#define B_PCH_RCRB_RPFN_RP8FN (BIT30 | BIT29 | BIT28) ///< Root Port 8 Function Number
+#define B_PCH_RCRB_RPFN_RP7CH BIT27 ///< Root Port 7 Hide
+#define B_PCH_RCRB_RPFN_RP7FN (BIT26 | BIT25 | BIT24) ///< Root Port 7 Function Number
+#define B_PCH_RCRB_RPFN_RP6CH BIT23 ///< Root Port 6 Hide
+#define B_PCH_RCRB_RPFN_RP6FN (BIT22 | BIT21 | BIT20) ///< Root Port 6 Function Number
+#define B_PCH_RCRB_RPFN_RP5CH BIT19 ///< Root Port 5 Hide
+#define B_PCH_RCRB_RPFN_RP5FN (BIT18 | BIT17 | BIT16) ///< Root Port 5 Function Number
+#define B_PCH_RCRB_RPFN_RP4CH BIT15 ///< Root Port 4 Hide
+#define B_PCH_RCRB_RPFN_RP4FN (BIT14 | BIT13 | BIT12) ///< Root Port 4 Function Number
+#define B_PCH_RCRB_RPFN_RP3CH BIT11 ///< Root Port 3 Hide
+#define B_PCH_RCRB_RPFN_RP3FN (BIT10 | BIT9 | BIT8) ///< Root Port 3 Function Number
+#define B_PCH_RCRB_RPFN_RP2CH BIT7 ///< Root Port 2 Hide
+#define B_PCH_RCRB_RPFN_RP2FN (BIT6 | BIT5 | BIT4) ///< Root Port 2 Function Number
+#define B_PCH_RCRB_RPFN_RP1CH BIT3 ///< Root Port 1 Hide
+#define B_PCH_RCRB_RPFN_RP1FN (BIT2 | BIT1 | BIT0) ///< Root Port 1 Function Number
+#define S_PCH_RCRB_PRFN_RP_FIELD 4 ///< 4 bits per root port
+#define R_PCH_RCRB_CIR0900 0x0900
+#define R_PCH_RCRB_CIR1100 0x1100
+#define R_PCH_RCRB_TRSR 0x1E00 ///< Trap Status Register
+#define B_PCH_RCRB_TRSR_CTSS 0x000F ///< Cycle Trap SMI# Status mask
+#define R_PCH_RCRB_TRCR 0x1E10 ///< Trapped Cycle Register
+#define S_PCH_RCRB_TRCR 8
+#define B_PCH_RCRB_TRCR_RWI BIT24
+#define B_PCH_RCRB_TRCR_AHBE 0x00000000000F0000
+#define B_PCH_RCRB_TRCR_TIOA 0x000000000000FFFC
+#define R_PCH_RCRB_TRWDR 0x1E18 ///< Trap Write Data Register
+#define S_PCH_RCRB_TRWDR 8
+#define B_PCH_RCRB_TRWDR_TIOD 0x00000000FFFFFFFF
+#define R_PCH_RCRB_IO_TRAP_0 0x1E80 ///< Trap Configuration Register
+#define R_PCH_RCRB_IO_TRAP_1 0x1E88 ///< Trap Configuration Register
+#define R_PCH_RCRB_IO_TRAP_2 0x1E90 ///< Trap Configuration Register
+#define R_PCH_RCRB_IO_TRAP_3 0x1E98 ///< Trap Configuration Register
+#define B_PCH_RCRB_IO_TRAP_RWM BIT17 ///< 49 - 32 for 32 bit access
+#define B_PCH_RCRB_IO_TRAP_RWIO BIT16 ///< 48 - 32 for 32 bit access
+#define N_PCH_RCRB_IO_TRAP_RWIO (48 - 32) ///< for 32 bit access
+#define B_PCH_RCRB_IO_TRAP_BEM 0x000000F000000000
+#define B_PCH_RCRB_IO_TRAP_TBE 0x0000000F00000000
+#define B_PCH_RCRB_IO_TRAP_ADMA 0x0000000000FC0000
+#define B_PCH_RCRB_IO_TRAP_IOAD 0x000000000000FFFC
+#define B_PCH_RCRB_IO_TRAP_TRSE BIT0 ///< Trap and SMI# Enable
+#define R_PCH_RCRB_V0CTL 0x2014 ///< Virtual channel 0 resource control
+#define B_PCH_RCRB_V0CTL_EN BIT31
+#define B_PCH_RCRB_V0CTL_ID (7 << 24) ///< Bit[26:24]
+#define N_PCH_RCRB_V0CTL_ID 24
+#define V_PCH_RCRB_V0CTL_ETVM_MASK 0xFC00
+#define V_PCH_RCRB_V0CTL_TVM_MASK 0x7E
+#define R_PCH_RCRB_V0STS 0x201A ///< Virtual channel 0 status
+#define B_PCH_RCRB_V0STS_NP BIT1
+#define R_PCH_RCRB_V1CTL 0x2020 ///< Virtual channel 1 resource control
+#define B_PCH_RCRB_V1CTL_EN BIT31
+#define B_PCH_RCRB_V1CTL_ID (0x0F << 24) ///< Bit[27:24]
+#define N_PCH_RCRB_V1CTL_ID 24
+#define V_PCH_RCRB_V1CTL_ETVM_MASK 0xFC00
+#define V_PCH_RCRB_V1CTL_TVM_MASK 0xFE
+#define R_PCH_RCRB_V1STS 0x2026 ///< Virtual channel 1 status
+#define B_PCH_RCRB_V1STS_NP BIT1
+#define R_PCH_RCRB_CIR2030 0x2030 ///< Priority Virtual Channel resource control
+#define R_PCH_RCRB_CIR2040 0x2040 ///< Priority Virtual Channel resource control
+#define R_PCH_RCRB_CIR2088 0x2088
+#define R_PCH_RCRB_REC 0x20AC
+#define B_PCH_RCRB_REC_DPDP (BIT31)
+#define R_PCH_RCRB_LCAP 0x21A4 ///< Link capabilities
+#define B_PCH_RCRB_LCAP_EL1 (BIT17 | BIT16 | BIT15)
+#define B_PCH_RCRB_LCAP_EL0 (BIT14 | BIT13 | BIT12)
+#define B_PCH_RCRB_LCAP_APMS (BIT11 | BIT10) ///< L0 is supported on DMI
+#define B_PCH_RCRB_LCAP_MLW 0x000003F0
+#define B_PCH_RCRB_LCAP_MLS 0x0000000F
+#define R_PCH_RCRB_LCTL 0x21A8 ///< Link control
+#define B_PCH_RCRB_LCTL_ES BIT7
+#define B_PCH_RCRB_LCTL_APMC (BIT1 | BIT0)
+#define V_PCH_RCRB_LCTL_APMC_DIS 0x00
+#define V_PCH_RCRB_LCTL_APMC_L0S_EN 0x01
+#define R_PCH_RCRB_LSTS 0x21AA
+#define B_PCH_RCRB_LSTS_NLW 0x03F0
+#define B_PCH_RCRB_LSTS_LS 0x000F
+#define R_PCH_RCRB_DMIC 0x2234 ///< DMI control register
+#define B_PCH_H_RCRB_DMIC_DMICGEN (BIT3 | BIT2 | BIT1 | BIT0) ///< DMI Clock Gate Enable for PCH H
+#define B_PCH_LP_RCRB_DMIC_DMICGEN (BIT3 | BIT2 | BIT1 | BIT0) ///< DMI Clock Gate Enable for PCH LP
+#define R_PCH_RCRB_CIR2238 0x2238 ///< Chipset Initialization Register 2238
+#define R_PCH_RCBA_CIR228C 0x228C ///< Chipset Initialization Register 228C
+#define R_PCH_RCRB_DMC 0x2304 ///< DMI Miscellaneous Control Register
+#define R_PCH_RCRB_CIR2314 0x2314
+#define R_PCH_RCRB_CIR2320 0x2320
+#define R_PCH_RCRB_IOBPIRI 0x2330 ///< IOBP Indexed Register Index
+#define B_PCH_RCRB_IOBPIRI_IOBPIS 0xFF000000 ///< IOBP Interface Select
+#define V_PCH_RCRB_IOBPIRI_IOBPIS_SATA 0xEA000000 ///< SATA (Ports 0 and Ports 1)
+#define V_PCH_RCRB_IOBPIRI_IOBPIS_DMI 0xEB000000 ///< DMI
+#define V_PCH_RCRB_IOBPIRI_IOBPIS_PCIE 0xEC000000 ///< PCIe
+#define B_PCH_RCRB_IOBPIRI_IOBPFS 0xFFFF ///< IOBP Function Select
+#define R_PCH_RCRB_IOBPD 0x2334 ///< IOBP Indexed Register Data
+#define R_PCH_RCRB_IOBPS 0x2338 ///< IOBP Status
+#define B_PCH_RCRB_IOBPS_IOBPIA 0xFF00 ///< IOBP Interface Access
+#define V_PCH_RCRB_IOBPS_IOBPIA_R 0x0600 ///< Read access
+#define V_PCH_RCRB_IOBPS_IOBPIA_W 0x0700 ///< Write access
+#define B_PCH_RCRB_IOBPS (BIT2 | BIT1) ///< Status for the transaction
+#define V_PCH_RCRB_IOBPS_SUCCESS 0 ///< Successful
+#define V_PCH_RCRB_IOBPS_UNSUCCESS BIT1 ///< Unsuccessful
+#define V_PCH_RCRB_IOBPS_POWEREDDOWN BIT2 ///< Powered Down
+#define B_PCH_RCRB_IOBPS_BUSY BIT0
+#define R_PCH_RCRB_TCTL 0x3000 ///< TCO Configuration register
+#define B_PCH_RCRB_TCTL_IE BIT7 ///< TCO IRQ Enable
+#define B_PCH_RCRB_TCTL_IS (BIT2 | BIT1 | BIT0) ///< TCO IRQ Select
+#define V_PCH_RCRB_TCTL_IRQ_9 0x00
+#define V_PCH_RCRB_TCTL_IRQ_10 0x01
+#define V_PCH_RCRB_TCTL_IRQ_11 0x02
+#define V_PCH_RCRB_TCTL_IRQ_20 0x04 ///< only if APIC enabled
+#define V_PCH_RCRB_TCTL_IRQ_21 0x05 ///< only if APIC enabled
+#define V_PCH_RCRB_TCTL_IRQ_22 0x06 ///< only if APIC enabled
+#define V_PCH_RCRB_TCTL_IRQ_23 0x07 ///< only if APIC enabled
+#define R_PCH_RCRB_D31IP 0x3100 ///< Device 31 interrupt pin
+#define B_PCH_RCRB_D31IP_TTIP (BIT27 | BIT26 | BIT25 | BIT24)
+#define V_PCH_RCRB_D31IP_TTIP_INTA (1 << 24)
+#define V_PCH_RCRB_D31IP_TTIP_INTB (2 << 24)
+#define V_PCH_RCRB_D31IP_TTIP_INTC (3 << 24)
+#define V_PCH_RCRB_D31IP_TTIP_INTD (4 << 24)
+#define B_PCH_RCRB_D31IP_SIP2 (BIT23 | BIT22 | BIT21 | BIT20)
+#define V_PCH_RCRB_D31IP_SIP2_INTA (1 << 20)
+#define V_PCH_RCRB_D31IP_SIP2_INTB (2 << 20)
+#define V_PCH_RCRB_D31IP_SIP2_INTC (3 << 20)
+#define V_PCH_RCRB_D31IP_SIP2_INTD (4 << 20)
+#define B_PCH_RCRB_D31IP_SMIP (BIT15 | BIT14 | BIT13 | BIT12)
+#define V_PCH_RCRB_D31IP_SMIP_INTA (1 << 12)
+#define V_PCH_RCRB_D31IP_SMIP_INTB (2 << 12)
+#define V_PCH_RCRB_D31IP_SMIP_INTC (3 << 12)
+#define V_PCH_RCRB_D31IP_SMIP_INTD (4 << 12)
+#define B_PCH_RCRB_D31IP_SIP (BIT11 | BIT10 | BIT9 | BIT8)
+#define V_PCH_RCRB_D31IP_SIP_INTA (1 << 8)
+#define V_PCH_RCRB_D31IP_SIP_INTB (2 << 8)
+#define V_PCH_RCRB_D31IP_SIP_INTC (3 << 8)
+#define V_PCH_RCRB_D31IP_SIP_INTD (4 << 8)
+#define B_PCH_RCRB_D31IP_LIP (BIT3 | BIT2 | BIT1 | BIT0)
+#define R_PCH_RCRB_D29IP 0x3108 ///< Device 29 interrupt pin
+#define B_PCH_RCRB_D29IP_E1P (BIT3 | BIT2 | BIT1 | BIT0)
+#define V_PCH_RCRB_D29IP_E1P_INTA (1 << 0)
+#define V_PCH_RCRB_D29IP_E1P_INTB (2 << 0)
+#define V_PCH_RCRB_D29IP_E1P_INTC (3 << 0)
+#define V_PCH_RCRB_D29IP_E1P_INTD (4 << 0)
+#define R_PCH_RCRB_D28IP 0x310C ///< Device 28 interrupt pin
+#define B_PCH_RCRB_D28IP_P8IP (BIT31 | BIT30 | BIT29 | BIT28)
+#define V_PCH_RCRB_D28IP_P8IP_INTA (1 << 28)
+#define V_PCH_RCRB_D28IP_P8IP_INTB (2 << 28)
+#define V_PCH_RCRB_D28IP_P8IP_INTC (3 << 28)
+#define V_PCH_RCRB_D28IP_P8IP_INTD (4 << 28)
+#define B_PCH_RCRB_D28IP_P7IP (BIT27 | BIT26 | BIT25 | BIT24)
+#define V_PCH_RCRB_D28IP_P7IP_INTA (1 << 24)
+#define V_PCH_RCRB_D28IP_P7IP_INTB (2 << 24)
+#define V_PCH_RCRB_D28IP_P7IP_INTC (3 << 24)
+#define V_PCH_RCRB_D28IP_P7IP_INTD (4 << 24)
+#define B_PCH_RCRB_D28IP_P6IP (BIT23 | BIT22 | BIT21 | BIT20)
+#define V_PCH_RCRB_D28IP_P6IP_INTA (1 << 20)
+#define V_PCH_RCRB_D28IP_P6IP_INTB (2 << 20)
+#define V_PCH_RCRB_D28IP_P6IP_INTC (3 << 20)
+#define V_PCH_RCRB_D28IP_P6IP_INTD (4 << 20)
+#define B_PCH_RCRB_D28IP_P5IP (BIT19 | BIT18 | BIT17 | BIT16)
+#define V_PCH_RCRB_D28IP_P5IP_INTA (1 << 16)
+#define V_PCH_RCRB_D28IP_P5IP_INTB (2 << 16)
+#define V_PCH_RCRB_D28IP_P5IP_INTC (3 << 16)
+#define V_PCH_RCRB_D28IP_P5IP_INTD (4 << 16)
+#define B_PCH_RCRB_D28IP_P4IP (BIT15 | BIT14 | BIT13 | BIT12)
+#define V_PCH_RCRB_D28IP_P4IP_INTA (1 << 12)
+#define V_PCH_RCRB_D28IP_P4IP_INTB (2 << 12)
+#define V_PCH_RCRB_D28IP_P4IP_INTC (3 << 12)
+#define V_PCH_RCRB_D28IP_P4IP_INTD (4 << 12)
+#define B_PCH_RCRB_D28IP_P3IP (BIT11 | BIT10 | BIT9 | BIT8)
+#define V_PCH_RCRB_D28IP_P3IP_INTA (1 << 8)
+#define V_PCH_RCRB_D28IP_P3IP_INTB (2 << 8)
+#define V_PCH_RCRB_D28IP_P3IP_INTC (3 << 8)
+#define V_PCH_RCRB_D28IP_P3IP_INTD (4 << 8)
+#define B_PCH_RCRB_D28IP_P2IP (BIT7 | BIT6 | BIT5 | BIT4)
+#define V_PCH_RCRB_D28IP_P2IP_INTA (1 << 4)
+#define V_PCH_RCRB_D28IP_P2IP_INTB (2 << 4)
+#define V_PCH_RCRB_D28IP_P2IP_INTC (3 << 4)
+#define V_PCH_RCRB_D28IP_P2IP_INTD (4 << 4)
+#define B_PCH_RCRB_D28IP_P1IP (BIT3 | BIT2 | BIT1 | BIT0)
+#define V_PCH_RCRB_D28IP_P1IP_INTA (1 << 0)
+#define V_PCH_RCRB_D28IP_P1IP_INTB (2 << 0)
+#define V_PCH_RCRB_D28IP_P1IP_INTC (3 << 0)
+#define V_PCH_RCRB_D28IP_P1IP_INTD (4 << 0)
+#define R_PCH_RCRB_D27IP 0x3110 ///< Device 27 interrupt pin
+#define B_PCH_RCRB_D27IP_ZIP (BIT3 | BIT2 | BIT1 | BIT0)
+#define V_PCH_RCRB_D27IP_ZIP_INTA (1 << 0)
+#define V_PCH_RCRB_D27IP_ZIP_INTB (2 << 0)
+#define V_PCH_RCRB_D27IP_ZIP_INTC (3 << 0)
+#define V_PCH_RCRB_D27IP_ZIP_INTD (4 << 0)
+#define R_PCH_RCRB_D26IP 0x3114 ///< Device 26 interrupt pin
+#define B_PCH_RCRB_D26IP_E2P (BIT3 | BIT2 | BIT1 | BIT0)
+#define V_PCH_RCRB_D26IP_E2P_INTA (1 << 0)
+#define V_PCH_RCRB_D26IP_E2P_INTB (2 << 0)
+#define V_PCH_RCRB_D26IP_E2P_INTC (3 << 0)
+#define V_PCH_RCRB_D26IP_E2P_INTD (4 << 0)
+#define R_PCH_RCRB_D25IP 0x3118 ///< Device 25 interrupt pin
+#define B_PCH_RCRB_D25IP_LIP (BIT3 | BIT2 | BIT1 | BIT0)
+#define V_PCH_RCRB_D25IP_LIP_INTA (1 << 0)
+#define V_PCH_RCRB_D25IP_LIP_INTB (2 << 0)
+#define V_PCH_RCRB_D25IP_LIP_INTC (3 << 0)
+#define V_PCH_RCRB_D25IP_LIP_INTD (4 << 0)
+#define R_PCH_RCRB_D22IP 0x3124 ///< Device 22 interrupt pin
+#define B_PCH_RCRB_D22IP_KTIP (BIT15 | BIT14 | BIT13 | BIT12)
+#define V_PCH_RCRB_D22IP_KTIP_INTA (1 << 12)
+#define V_PCH_RCRB_D22IP_KTIP_INTB (2 << 12)
+#define V_PCH_RCRB_D22IP_KTIP_INTC (3 << 12)
+#define V_PCH_RCRB_D22IP_KTIP_INTD (4 << 12)
+#define B_PCH_RCRB_D22IP_IDERIP (BIT11 | BIT10 | BIT9 | BIT8)
+#define V_PCH_RCRB_D22IP_IDERIP_INTA (1 << 8)
+#define V_PCH_RCRB_D22IP_IDERIP_INTB (2 << 8)
+#define V_PCH_RCRB_D22IP_IDERIP_INTC (3 << 8)
+#define V_PCH_RCRB_D22IP_IDERIP_INTD (4 << 8)
+#define B_PCH_RCRB_D22IP_MEI2IP (BIT7 | BIT6 | BIT5 | BIT4)
+#define V_PCH_RCRB_D22IP_MEI2IP_INTA (1 << 4)
+#define V_PCH_RCRB_D22IP_MEI2IP_INTB (2 << 4)
+#define V_PCH_RCRB_D22IP_MEI2IP_INTC (3 << 4)
+#define V_PCH_RCRB_D22IP_MEI2IP_INTD (4 << 4)
+#define B_PCH_RCRB_D22IP_MEI1IP (BIT3 | BIT2 | BIT1 | BIT0)
+#define V_PCH_RCRB_D22IP_MEI1IP_INTA (1 << 0)
+#define V_PCH_RCRB_D22IP_MEI1IP_INTB (2 << 0)
+#define V_PCH_RCRB_D22IP_MEI1IP_INTC (3 << 0)
+#define V_PCH_RCRB_D22IP_MEI1IP_INTD (4 << 0)
+#define R_PCH_RCRB_D20IP 0x3128 ///< Device 20 interrupt pin
+#define B_PCH_RCRB_D20IP_XHCIP (BIT3 | BIT2 | BIT1 | BIT0)
+#define V_PCH_RCRB_D20IP_XHCIP_INTA (1 << 0)
+#define V_PCH_RCRB_D20IP_XHCIP_INTB (2 << 0)
+#define V_PCH_RCRB_D20IP_XHCIP_INTC (3 << 0)
+#define V_PCH_RCRB_D20IP_XHCIP_INTD (4 << 0)
+#define R_PCH_RCRB_D31IR 0x3140 ///< Device 31 interrupt route
+#define R_PCH_RCRB_D29IR 0x3144 ///< Device 29 interrupt route
+#define R_PCH_RCRB_D28IR 0x3146 ///< Device 28 interrupt route
+#define R_PCH_RCRB_D27IR 0x3148 ///< Device 27 interrupt route
+#define R_PCH_RCRB_D26IR 0x314C ///< Device 26 interrupt route
+#define R_PCH_RCRB_D25IR 0x3150 ///< Device 25 interrupt route
+#define R_PCH_RCRB_D23IR 0x3158 ///< Device 23 interrupt route
+#define R_PCH_RCRB_D22IR 0x315C ///< Device 22 interrupt route
+#define R_PCH_RCRB_D20IR 0x3160 ///< Device 20 interrupt route
+#define R_PCH_RCRB_D21IR 0x3164 ///< Device 21 interrupt route
+#define B_PCH_RCRB_D21IR_IE BIT15
+#define R_PCH_RCRB_D19IR 0x3168 ///< Device 19 interrupt route
+#define B_PCH_RCRB_D19IR_IS (BIT19 | BIT18 | BIT17 | BIT16)
+#define B_PCH_RCRB_D19IR_IE BIT15
+#define B_PCH_RCRB_DXXIR_IDR_MASK (BIT14 | BIT13 | BIT12)
+#define V_PCH_RCRB_DXXIR_IDR_PIRQA 0
+#define V_PCH_RCRB_DXXIR_IDR_PIRQB BIT12
+#define V_PCH_RCRB_DXXIR_IDR_PIRQC BIT13
+#define V_PCH_RCRB_DXXIR_IDR_PIRQD (BIT13 | BIT12)
+#define V_PCH_RCRB_DXXIR_IDR_PIRQE BIT14
+#define V_PCH_RCRB_DXXIR_IDR_PIRQF (BIT14 | BIT12)
+#define V_PCH_RCRB_DXXIR_IDR_PIRQG (BIT14 | BIT13)
+#define V_PCH_RCRB_DXXIR_IDR_PIRQH (BIT14 | BIT13 | BIT12)
+#define V_PCH_RCRB_DXXIR_ICR_PIRQA 0
+#define V_PCH_RCRB_DXXIR_ICR_PIRQB BIT8
+#define V_PCH_RCRB_DXXIR_ICR_PIRQC BIT9
+#define V_PCH_RCRB_DXXIR_ICR_PIRQD (BIT9 | BIT8)
+#define V_PCH_RCRB_DXXIR_ICR_PIRQE BIT10
+#define V_PCH_RCRB_DXXIR_ICR_PIRQF (BIT10 | BIT8)
+#define V_PCH_RCRB_DXXIR_ICR_PIRQG (BIT10 | BIT9)
+#define V_PCH_RCRB_DXXIR_ICR_PIRQH (BIT10 | BIT9 | BIT8)
+#define V_PCH_RCRB_DXXIR_IBR_PIRQA 0
+#define V_PCH_RCRB_DXXIR_IBR_PIRQB BIT4
+#define V_PCH_RCRB_DXXIR_IBR_PIRQC BIT5
+#define V_PCH_RCRB_DXXIR_IBR_PIRQD (BIT5 | BIT4)
+#define V_PCH_RCRB_DXXIR_IBR_PIRQE BIT6
+#define V_PCH_RCRB_DXXIR_IBR_PIRQF (BIT6 | BIT4)
+#define V_PCH_RCRB_DXXIR_IBR_PIRQG (BIT6 | BIT5)
+#define V_PCH_RCRB_DXXIR_IBR_PIRQH (BIT6 | BIT5 | BIT4)
+#define V_PCH_RCRB_DXXIR_IAR_PIRQA 0
+#define V_PCH_RCRB_DXXIR_IAR_PIRQB BIT0
+#define V_PCH_RCRB_DXXIR_IAR_PIRQC BIT1
+#define V_PCH_RCRB_DXXIR_IAR_PIRQD (BIT1 | BIT0)
+#define V_PCH_RCRB_DXXIR_IAR_PIRQE BIT2
+#define V_PCH_RCRB_DXXIR_IAR_PIRQF (BIT2 | BIT0)
+#define V_PCH_RCRB_DXXIR_IAR_PIRQG (BIT2 | BIT1)
+#define V_PCH_RCRB_DXXIR_IAR_PIRQH (BIT2 | BIT1 | BIT0)
+#define R_PCH_RCRB_OIC 0x31FE ///< Other Interrupt Control
+#define B_PCH_RCRB_OIC_OA24_39_D BIT11
+#define B_PCH_RCRB_OIC_CEN BIT9 ///< Coprocessor Error Enable
+#define B_PCH_RCRB_OIC_AEN BIT8 ///< APIC Enable
+#define V_PCH_RCRB_OIC_ASEL 0xFF
+#define R_PCH_IO_APIC_INDEX 0xFEC00000
+#define R_PCH_IO_APIC_DATA 0xFEC00010
+#define N_PCH_IO_APIC_ASEL 12
+#define R_PCH_RCRB_PRSTS 0x3310
+#define B_PCH_RCRB_PRSTS_PM_WD_TMR BIT15 ///< Power Management Watchdog Timer
+#define B_PCH_RCRB_PRSTS_VE_WD_TMR_STS BIT7 ///< VE Watchdog Timer Status
+#define B_PCH_RCRB_PRSTS_ME_WD_TMR_STS BIT6 ///< Management Engine Watchdog Timer Status
+#define B_PCH_RCRB_PRSTS_WOL_OVR_WK_STS BIT5
+#define B_PCH_RCRB_PRSTS_FIELD_1 BIT4
+#define B_PCH_RCRB_PRSTS_ME_HOST_PWRDN BIT3
+#define B_PCH_RCRB_PRSTS_ME_HRST_WARM_STS BIT2
+#define B_PCH_RCRB_PRSTS_ME_HRST_COLD_STS BIT1
+#define B_PCH_RCRB_PRSTS_ME_WAKE_STS BIT0
+#define R_PCH_RCRB_CIR3314 0x3314
+#define R_PCH_RCRB_PM_CFG 0x3318 ///< Power Management Configuration
+#define R_PCH_RCRB_PM_CFG_RTC_DS_WAKE_DIS BIT21 ///< RTC Wake from Deep S4/S5 Disable
+#define B_PCH_RCRB_PM_CFG_SSMAW_MASK (BIT19 | BIT18) ///< SLP_SUS# Min Assertion Width
+#define V_PCH_RCRB_PM_CFG_SSMAW_4S (BIT19 | BIT18) ///< 4 seconds
+#define V_PCH_RCRB_PM_CFG_SSMAW_1S BIT19 ///< 1 second
+#define V_PCH_RCRB_PM_CFG_SSMAW_0_5S BIT18 ///< 0.5 second (500ms)
+#define V_PCH_RCRB_PM_CFG_SSMAW_0S 0 ///< 0 second
+#define B_PCH_RCRB_PM_CFG_SAMAW_MASK (BIT17 | BIT16) ///< SLP_A# Min Assertion Width
+#define V_PCH_RCRB_PM_CFG_SAMAW_2S (BIT17 | BIT16) ///< 2 seconds
+#define V_PCH_RCRB_PM_CFG_SAMAW_98ms BIT17 ///< 98ms
+#define V_PCH_RCRB_PM_CFG_SAMAW_4S BIT16 ///< 4 seconds
+#define V_PCH_RCRB_PM_CFG_SAMAW_0S 0 ///< 0 second
+#define B_PCH_RCRB_PM_CFG_RPCD_MASK (BIT9 | BIT8) ///< Reset Power Cycle Duration
+#define V_PCH_RCRB_PM_CFG_RPCD_1S (BIT9 | BIT8) ///< 1-2 seconds
+#define V_PCH_RCRB_PM_CFG_RPCD_2S BIT9 ///< 2-3 seconds
+#define V_PCH_RCRB_PM_CFG_RPCD_3S BIT8 ///< 3-4 seconds
+#define V_PCH_RCRB_PM_CFG_RPCD_4S 0 ///< 4-5 seconds (Default)
+#define R_PCH_RCRB_CIR3324 0x3324
+#define R_PCH_RCRB_DEEP_S3_POL 0x3328 ///< Deep S3 Power Policies
+#define B_PCH_RCRB_DEEP_S3_POL_DPS3_EN_DC BIT1 ///< Deep S3 Enable in DC Mode
+#define B_PCH_RCRB_DEEP_S3_POL_DPS3_EN_AC BIT0 ///< Deep S3 Enable in AC Mode
+#define R_PCH_RCRB_DEEP_S4_POL 0x332C ///< Deep S4 Power Policies
+#define B_PCH_RCRB_DEEP_S4_POL_DPS4_EN_DC BIT1 ///< Deep S4 Enable in DC Mode
+#define B_PCH_RCRB_DEEP_S4_POL_DPS4_EN_AC BIT0 ///< Deep S4 Enable in AC Mode
+#define R_PCH_RCRB_DEEP_S5_POL 0x3330 ///< Deep S5 Power Policies
+#define B_PCH_RCRB_DEEP_S5_POL_DPS5_EN_DC BIT15 ///< Deep S5 Enable in DC Mode
+#define B_PCH_RCRB_DEEP_S5_POL_DPS5_EN_AC BIT14 ///< Deep S5 Enable in AC Mode
+#define R_PCH_RCRB_PM_CFG2 0x333C ///< Power Management Configuration Reg 2
+#define B_PCH_RCRB_PM_CFG2_DRAM_RESET_CTL (1 << 26) ///< DRAM RESET# control
+#define R_PCH_RCRB_CIR3340 0x3340
+#define R_PCH_RCRB_CIR3344 0x3344
+#define R_PCH_RCRB_CIR3348 0x3348
+#define R_PCH_RCRB_CIR3350 0x3350
+#define R_PCH_RCRB_CIR3360 0x3360
+#define R_PCH_RCRB_CIR3368 0x3368
+#define R_PCH_RCRB_CIR3378 0x3378
+#define R_PCH_RCRB_CIR337C 0x337C
+#define R_PCH_RCRB_CIR3388 0x3388
+#define R_PCH_RCRB_CIR3390 0x3390
+#define R_PCH_RCRB_CIR33A0 0x33A0
+#define R_PCH_RCRB_CIR33B0 0x33B0
+#define R_PCH_RCRB_CIR33C0 0x33C0
+#define PMSYNC_TPR_CONFIG 0x33C4
+#define B_PMSYNC_TPR_CONFIG_LOCK BIT31
+#define PMSYNC_TPR_CONFIG2 0x33CC
+#define R_PCH_RCRB_PMSYNC 0x33C8
+#define B_PCH_RCRB_PMSYNC_GPIO_D_SEL BIT11
+#define B_PCH_RCRB_PMSYNC_GPIO_C_SEL BIT10
+#define B_PCH_RCRB_PMSYNC_GPIO_B_SEL BIT9
+#define B_PCH_RCRB_PMSYNC_GPIO_A_SEL BIT8
+#define R_PCH_RCRB_CIR33D0 0x33D0
+#define R_PCH_RCRB_CIR33D4 0x33D4
+#define R_PCH_RCRB_RTC_CONF 0x3400 ///< RTC Configuration register
+#define S_PCH_RCRB_RTC_CONF 4
+#define B_PCH_RCRB_RTC_CONF_UCMOS_LOCK BIT4
+#define B_PCH_RCRB_RTC_CONF_LCMOS_LOCK BIT3
+#define B_PCH_RCRB_RTC_CONF_UCMOS_EN BIT2 ///< Upper CMOS bank enable
+#define R_PCH_RCRB_HPTC 0x3404 ///< High Performance Timer Configuration
+#define B_PCH_RCRB_HPTC_AE BIT7 ///< Address enable
+#define B_PCH_RCRB_HPTC_AS (BIT1 | BIT0) ///< Address selection
+#define R_PCH_PCH_HPET_CONFIG 0xFED00000
+#define N_PCH_HPET_ADDR_ASEL 12
+#define R_PCH_RCRB_GCS 0x3410 ///< General Control and Status
+#define B_PCH_RCRB_GCS_FLRCSSEL BIT12
+#define B_PCH_H_RCRB_GCS_BBS (BIT11 | BIT10) ///< Boot BIOS straps for Pch-H
+#define V_PCH_H_RCRB_GCS_BBS_SPI (3 << 10) ///< Boot BIOS strapped to SPI for Pch-H
+#define V_PCH_H_RCRB_GCS_BBS_LPC (0 << 10) ///< Boot BIOS strapped to LPC for Pch-H
+#define B_PCH_LP_RCRB_GCS_BBS BIT10 ///< Boot BIOS straps for Pch-Lp
+#define V_PCH_LP_RCRB_GCS_BBS_SPI 0 ///< Boot BIOS strapped to SPI for Pch-Lp
+#define V_PCH_LP_RCRB_GCS_BBS_LPC BIT10 ///< Boot BIOS strapped to LPC for Pch-Lp
+#define B_PCH_RCRB_GCS_SERM BIT9 ///< Server Error Reporting Mode
+#define B_PCH_RCRB_GCS_NR BIT5 ///< No Reboot strap
+#define B_PCH_RCRB_GCS_AME BIT4 ///< Alternate Access Mode Enable
+#define B_PCH_RCRB_GCS_SPS BIT3 ///< Shutdown Policy Select
+#define B_PCH_RCRB_GCS_RPR BIT2 ///< Reserved Page Route
+#define B_PCH_RCRB_GCS_BILD BIT0 ///< BIOS Interface Lock-Down
+#define R_PCH_RCRB_BUC 0x3414 ///< Backed Up Control
+#define B_PCH_RCRB_BUC_LAN_DIS BIT5 ///< LAN Disable
+#define B_PCH_RCRB_BUC_SDO BIT4 ///< Daylight Savings Override
+#define B_PCH_RCRB_BUC_TS BIT0 ///< Top Swap
+#define R_PCH_RCRB_FUNC_DIS 0x3418 ///< Function Disable Register
+#define B_PCH_RCRB_FUNC_DIS_XHCI BIT27 ///< XHCI controller disable
+#define B_PCH_RCRB_FUNC_DIS_SATA2 BIT25 ///< Serial ATA 2 disable
+#define B_PCH_RCRB_FUNC_DIS_THERMAL BIT24 ///< Thermal Throttle Disable
+#define B_PCH_RCRB_FUNC_DIS_PCI_EX_PORT8 BIT23 ///< PCI Express port 8 disable
+#define B_PCH_RCRB_FUNC_DIS_PCI_EX_PORT7 BIT22 ///< PCI Express port 7 disable
+#define B_PCH_RCRB_FUNC_DIS_PCI_EX_PORT6 BIT21 ///< PCI Express port 6 disable
+#define B_PCH_RCRB_FUNC_DIS_PCI_EX_PORT5 BIT20 ///< PCI Express port 5 disable
+#define B_PCH_RCRB_FUNC_DIS_PCI_EX_PORT4 BIT19 ///< PCI Express port 4 disable
+#define B_PCH_RCRB_FUNC_DIS_PCI_EX_PORT3 BIT18 ///< PCI Express port 3 disable
+#define B_PCH_RCRB_FUNC_DIS_PCI_EX_PORT2 BIT17 ///< PCI Express port 2 disable
+#define B_PCH_RCRB_FUNC_DIS_PCI_EX_PORT1 BIT16 ///< PCI Express port 1 disable
+#define N_PCH_RCRB_FUNC_DIS_PCI_EX_PORT1 16
+#define B_PCH_RCRB_FUNC_DIS_EHCI1 BIT15 ///< EHCI controller 1 disable
+#define B_PCH_RCRB_FUNC_DIS_LPC_BRIDGE BIT14 ///< LPC Bridge disable
+#define B_PCH_RCRB_FUNC_DIS_EHCI2 BIT13 ///< EHCI controller 2 disable
+#define B_PCH_RCRB_FUNC_DIS_AZALIA BIT4 ///< Azalia disable
+#define B_PCH_RCRB_FUNC_DIS_SMBUS BIT3 ///< SMBUS disable
+#define B_PCH_RCRB_FUNC_DIS_SATA1 BIT2 ///< Serial ATA disable
+#define B_PCH_RCRB_FUNC_DIS_ADSP BIT1 ///< Audio DSP disable
+#define B_PCH_RCRB_FUNC_DIS_FUNCTION_0 BIT0 ///< Function 0 disable
+#define R_PCH_RCRB_CG 0x341C ///< Clock Gating
+#define B_PCH_RCRB_CG_EN_DCG_BLA BIT30 ///< Platform Essential Cluster BLA unit Dynamic Clock Gate Enable
+#define B_PCH_RCRB_CG_EN_SCG_GSX BIT29 ///< GSX Static Clock Gate Enable
+#define B_PCH_RCRB_CG_EN_DCG_GPIO BIT28 ///< GPIO Dynamic Clock Gate Enable
+#define B_PCH_RCRB_CG_EN_DCG_HPET BIT27 ///< HPET Dynamic Clock Gate Enable
+#define B_PCH_RCRB_CG_EN_CG_GPEC BIT26 ///< Generic Platform Essential Clock Gate Enable
+#define B_PCH_RCRB_CG_EN_SCG_8254 BIT25 ///< 8254 Static Clock Gate Enable
+#define B_PCH_RCRB_CG_EN_SCG_8237 BIT24 ///< 8237 Static Clock Gate Enable
+
+#define B_PCH_RCRB_CG_EN_DCG_LPC BIT31 ///< Legacy(LPC) Dynamic Clock Gate Enable
+#define B_PCH_RCRB_CG_EN_SCG_LAN BIT23 ///< LAN Static Clock Gate Enable
+#define B_PCH_RCRB_CG_EN_DCG_HDA BIT22 ///< HDA Dynamic Clock Gate Enable
+#define B_PCH_RCRB_CG_EN_SCG_HDA BIT21 ///< HDA Static Clock Gate Enable
+#define B_PCH_RCRB_CG_EN_DCG_PCI BIT16 ///< PCI Dynamic Clock Gate Enable
+#define B_PCH_RCRB_CG_EN_CG_SMBUS BIT5 ///< SMBUS Static Clock Gating Enable
+#define R_PCH_RCRB_FDSW 0x3420 ///< Function Disable SUS well
+#define B_PCH_RCRB_FDSW_FDSWL BIT7 ///< Function Disable SUS well lockdown
+#define R_PCH_RCRB_DISPBDF 0x3424 ///< Display Bus, Device and Function Initialization
+#define B_PCH_RCRB_DISPBDF_DBN 0xFF00 ///< Display Bus Number
+#define B_PCH_RCRB_DISPBDF_DDN 0x00F8 ///< Display Device Number
+#define B_PCH_RCRB_DISPBDF_DFN 0x0007 ///< Display Function Number
+#define R_PCH_RCRB_FD2 0x3428 ///< Function Disable 2
+#define B_PCH_RCRB_FD2_KTD BIT4 ///< KT Disable
+#define B_PCH_RCRB_FD2_IRERD BIT3 ///< IDE-R Disable
+#define B_PCH_RCRB_FD2_MEI2D BIT2 ///< Intel MEI #2 Disable
+#define B_PCH_RCRB_FD2_MEI1D BIT1 ///< Intel MEI #1 Disable
+#define B_PCH_RCRB_FD2_DBDFEN BIT0 ///< Display BDF Enable
+#define R_PCH_RCRB_CIR3A28 0x3A28
+#define R_PCH_RCRB_CIR3A2C 0x3A2C
+#define R_PCH_RCRB_CIR3A6C 0x3A6C
+#define R_PCH_RCRB_CIR3A80 0x3A80
+#define R_PCH_RCRB_CIR3A84 0x3A84
+#define R_PCH_RCRB_CIR3A88 0x3A88
+#define R_PCH_RCRB_GSX_CTRL 0x3454 ///< GSX Control
+#define B_PCH_RCRB_GSX_BAR_ENABLE BIT4 ///< GSX BAR Enable
+#define R_PCH_RCRB_INT_ACPIIRQEN 0x31E0 ///< ACPI IRQ Control
+
+#define B_PCH_RCRB_INT_ACPIIRQEN_A15E BIT15 ///< ACPI IRQ15 Enable
+#define B_PCH_RCRB_INT_ACPIIRQEN_A14E BIT14 ///< ACPI IRQ14 Enable
+#define B_PCH_RCRB_INT_ACPIIRQEN_A13E BIT13 ///< ACPI IRQ13 Enable
+#define B_PCH_RCRB_INT_ACPIIRQEN_A7E BIT7 ///< ACPI IRQ7 Enable
+#define B_PCH_RCRB_INT_ACPIIRQEN_A6E BIT6 ///< ACPI IRQ6 Enable
+#define B_PCH_RCRB_INT_ACPIIRQEN_A5E BIT5 ///< ACPI IRQ5 Enable
+#define B_PCH_RCRB_INT_ACPIIRQEN_A4E BIT4 ///< ACPI IRQ4 Enable
+#define B_PCH_RCRB_INT_ACPIIRQEN_A3E BIT3 ///< ACPI IRQ3 Enable
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsSata.h b/ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsSata.h
new file mode 100644
index 0000000..add2c1e
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsSata.h
@@ -0,0 +1,703 @@
+/** @file
+ Register names for PCH SATA controllers
+
+ Conventions:
+
+ - Prefixes:
+ Definitions beginning with "R_" are registers
+ Definitions beginning with "B_" are bits within registers
+ Definitions beginning with "V_" are meaningful values of bits within the registers
+ Definitions beginning with "S_" are register sizes
+ Definitions beginning with "N_" are the bit position
+ - In general, PCH registers are denoted by "_PCH_" in register names
+ - Registers / bits that are different between PCH generations are denoted by
+ "_PCH_<generation_name>_" in register/bit names. e.g., "_PCH_LPT_"
+ - Registers / bits that are different between SKUs are denoted by "_<SKU_name>"
+ at the end of the register/bit names
+ - Registers / bits of new devices introduced in a PCH generation will be just named
+ as "_PCH_" without <generation_name> inserted.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PCH_REGS_SATA_H_
+#define _PCH_REGS_SATA_H_
+
+//
+// SATA Controller 1 Registers (D31:F2)
+//
+#define PCI_DEVICE_NUMBER_PCH_SATA 31
+#define PCI_FUNCTION_NUMBER_PCH_SATA 2
+#define R_PCH_SATA_VENDOR_ID 0x00
+#define V_PCH_SATA_VENDOR_ID V_PCH_INTEL_VENDOR_ID
+#define R_PCH_SATA_DEVICE_ID 0x02
+#define V_PCH_LPTH_SATA_DEVICE_ID_D_IDE 0x8C00 ///< Desktop IDE Mode (Ports 0,1, 2 and 3)
+#define V_PCH_LPTH_SATA_DEVICE_ID_D_AHCI 0x8C02 ///< Desktop AHCI Mode (Ports 0-5)
+#define V_PCH_LPTH_SATA_DEVICE_ID_D_RAID 0x8C04 ///< Desktop RAID 0/1/5/10 Mode, based on D31:F2:9Ch[7]
+#define V_PCH_LPTH_SATA_DEVICE_ID_D_RAID_PREM 0x8C06 ///< Desktop RAID 0/1/5/10 Mode, based on D31:F2:9Ch[7]
+#define V_PCH_LPTH_SATA_DEVICE_ID_D_RAID_ALTDIS 0x2822 ///< Desktop RAID 0/1/5/10 Mode, based on D31:F2:9Ch[9][7]
+#define V_PCH_LPTH_SATA_DEVICE_ID_D_RAID_SERVER 0x2826 ///< Server RAID 0/1/5/10 Mode, based on D31:F2:9Ch[9][7]
+#define V_PCH_LPTH_SATA2_DEVICE_ID_D_IDE 0x8C08 ///< Controller 2, Desktop IDE Mode, 2 ports
+#define V_PCH_LPTH_SATA_DEVICE_ID_M_IDE 0x8C01 ///< Mobile IDE Mode, port 0, 1, 4, 5
+#define V_PCH_LPTH_SATA_DEVICE_ID_M_AHCI 0x8C03 ///< Mobile AHCI Mode, port 0, 1, 4 5
+#define V_PCH_LPTH_SATA_DEVICE_ID_M_RAID 0x8C05 ///< Mobile RAID 0/1/5/10 Mode, based on D31:F2:9Ch[7]
+#define V_PCH_LPTH_SATA_DEVICE_ID_M_RAID_PREM 0x8C07 ///< Mobile RAID 0/1/5/10 Mode, based on D31:F2:9Ch[7]
+#define V_PCH_LPTH_SATA_DEVICE_ID_M_RAID_ALTDIS 0x282A ///< Mobile RAID 0/1/5/10 Mode, based on D31:F2:9Ch[7]
+#define V_PCH_LPTH_SATA2_DEVICE_ID_M_IDE 0x8C09 ///< Controller 2, Mobile IDE, 2 ports
+#define V_PCH_LPTH_SATA_DEVICE_ID_D_RAID1 0x8C0E ///< SATA Controller 1 (RAID 1/RRT Only)
+#define V_PCH_LPTH_SATA_DEVICE_ID_M_RAID1 0x8C0F ///< SATA Controller 1 (RAID 1/RRT Only) - Mobile
+
+//
+// SATA Controller 2 Registers (D31:F5)
+//
+#define PCI_DEVICE_NUMBER_PCH_SATA2 31
+#define PCI_FUNCTION_NUMBER_PCH_SATA2 5
+#define R_PCH_SATA2_VENDOR_ID 0x00
+#define V_PCH_SATA2_VENDOR_ID V_PCH_INTEL_VENDOR_ID
+#define R_PCH_SATA2_DEVICE_ID 0x02
+
+#define V_PCH_LPTLP_SATA_DEVICE_ID_M_TEST0 0x9C00 ///< SATA Controller 1 (TEST Mode only)
+#define V_PCH_LPTLP_SATA_DEVICE_ID_M_TEST1 0x9C01 ///< SATA Controller 1 (TEST Mode only) - Mobile
+#define V_PCH_LPTLP_SATA_DEVICE_ID_M_AHCI0 0x9C02 ///< SATA Controller 1 (AHCI)
+#define V_PCH_LPTLP_SATA_DEVICE_ID_M_AHCI1 0x9C03 ///< SATA Controller 1 (AHCI) - Mobile
+#define V_PCH_LPTLP_SATA_DEVICE_ID_M_RAID0 0x9C04 ///< SATA Controller 1 (RAID 0/1/5/10) - NOT premium
+#define V_PCH_LPTLP_SATA_DEVICE_ID_M_RAID_ALTDIS0 0x2822 ///< SATA Controller 1 (RAID 0/1/5/10) - NOT premium - Alternate ID
+#define V_PCH_LPTLP_SATA_DEVICE_ID_M_RAID1 0x9C05 ///< SATA Controller 1 (RAID 0/1/5/10) - NOT premium - Mobile
+#define V_PCH_LPTLP_SATA_DEVICE_ID_M_RAID_ALTDIS1 0x282A ///< SATA Controller 1 (RAID 0/1/5/10) - NOT premium - Mobile - Alternate ID
+#define V_PCH_LPTLP_SATA_DEVICE_ID_M_RAID_PREM0 0x9C06 ///< SATA Controller 1 (RAID 0/1/5/10) - premium
+#define V_PCH_LPTLP_SATA_DEVICE_ID_M_RAID_PREM1 0x9C07 ///< SATA Controller 1 (RAID 0/1/5/10) - premium - Mobile
+#define V_PCH_LPTLP_SATA_DEVICE_ID_M_RAID2 0x9C0E ///< SATA Controller 1 (RAID 1/RRT Only)
+#define V_PCH_LPTLP_SATA_DEVICE_ID_M_RAID3 0x9C0F ///< SATA Controller 1 (RAID 1/RRT Only) - Mobile
+
+//
+// SATA Controller common Registers
+//
+#define R_PCH_SATA_COMMAND 0x04
+#define B_PCH_SATA_COMMAND_INT_DIS BIT10
+#define B_PCH_SATA_COMMAND_FBE BIT9
+#define B_PCH_SATA_COMMAND_SERR_EN BIT8
+#define B_PCH_SATA_COMMAND_WCC BIT7
+#define B_PCH_SATA_COMMAND_PER BIT6
+#define B_PCH_SATA_COMMAND_VPS BIT5
+#define B_PCH_SATA_COMMAND_PMWE BIT4
+#define B_PCH_SATA_COMMAND_SCE BIT3
+#define B_PCH_SATA_COMMAND_BME BIT2
+#define B_PCH_SATA_COMMAND_MSE BIT1
+#define B_PCH_SATA_COMMAND_IOSE BIT0
+#define R_PCH_SATA_PCISTS 0x06
+#define B_PCH_SATA_PCISTS_DPE BIT15
+#define B_PCH_SATA_PCISTS_RMA BIT13
+#define B_PCH_SATA_PCISTS_DEV_STS_MASK (BIT10 | BIT9)
+#define B_PCH_SATA_PCISTS_DPED BIT8
+#define B_PCH_SATA_PCISTS_CAP_LIST BIT4
+#define B_PCH_SATA_PCISTS_ITNS BIT3
+#define R_PCH_SATA_RID 0x08
+#define R_PCH_SATA_PI_REGISTER 0x09
+#define B_PCH_SATA_PI_REGISTER_SNC BIT3
+#define B_PCH_SATA_PI_REGISTER_SNE BIT2
+#define B_PCH_SATA_PI_REGISTER_PNC BIT1
+#define B_PCH_SATA_PI_REGISTER_PNE BIT0
+#define R_PCH_SATA_SUB_CLASS_CODE 0x0A
+#define V_PCH_SATA_SUB_CLASS_CODE_IDE 0x01
+#define V_PCH_SATA_SUB_CLASS_CODE_AHCI 0x06
+#define V_PCH_SATA_SUB_CLASS_CODE_RAID 0x04
+#define R_PCH_SATA_BCC 0x0B
+#define B_PCH_SATA_BCC 0xFF
+#define R_PCH_SATA_PMLT 0x0D
+#define B_PCH_SATA_PMLT 0xFF
+#define R_PCH_SATA_HTYPE 0x0E
+#define B_PCH_SATA_HTYPE_MFD BIT7
+#define B_PCH_SATA_HTYPE_HL 0x7F
+#define R_PCH_SATA_PCMD_BAR 0x10
+#define B_PCH_SATA_PCMD_BAR_BA 0x0000FFF8
+#define B_PCH_SATA_PCMD_BAR_RTE BIT0
+#define R_PCH_SATA_PCNL_BAR 0x14
+#define B_PCH_SATA_PCNL_BAR_BA 0x0000FFFC
+#define B_PCH_SATA_PCNL_BAR_RTE BIT0
+#define R_PCH_SATA_SCMD_BAR 0x18
+#define B_PCH_SATA_SCMD_BAR_BA 0x0000FFF8
+#define B_PCH_SATA_SCMD_BAR_RTE BIT0
+#define R_PCH_SATA_SCNL_BAR 0x1C
+#define B_PCH_SATA_SCNL_BAR_BA 0x0000FFFC
+#define B_PCH_SATA_SCNL_BAR_RTE BIT0
+#define R_PCH_SATA_BUS_MASTER_BAR 0x20
+#define B_PCH_SATA_BUS_MASTER_BAR_BA 0x0000FFE0
+#define B_PCH_SATA_BUS_MASTER_BAR_BA4 BIT4
+#define B_PCH_SATA_BUS_MASTER_BAR_RTE BIT0
+#define R_PCH_SATA_SIDP_BAR 0x24
+#define R_PCH_SATA_AHCI_BAR 0x24
+#define B_PCH_SATA_AHCI_BAR_BA 0xFFFFF800
+#define V_PCH_SATA_AHCI_BAR_LENGTH 0x800
+#define N_PCH_SATA_AHCI_BAR_ALIGNMENT 11
+#define B_PCH_SATA_AHCI_BAR_PF BIT3
+#define B_PCH_SATA_AHCI_BAR_TP (BIT2 | BIT1)
+#define B_PCH_SATA_AHCI_BAR_RTE BIT0
+#define R_PCH_SATA_AHCI_SVID 0x2C
+#define B_PCH_SATA_AHCI_SVID 0xFFFF
+#define R_PCH_SATA_AHCI_SID 0x2E
+#define B_PCH_SATA_AHCI_SID 0xFFFF
+#define R_PCH_SATA_AHCI_CAP_PTR 0x34
+#define B_PCH_SATA_AHCI_CAP_PTR 0xFF
+#define R_PCH_SATA_AHCI_INTLN 0x3C
+#define B_PCH_SATA_AHCI_INTLN 0xFF
+#define R_PCH_SATA_AHCI_INTPN 0x3D
+#define B_PCH_SATA_AHCI_INTPN 0xFF
+#define R_PCH_SATA_TIMP 0x40
+#define R_PCH_SATA_TIMS 0x42
+#define B_PCH_SATA_TIM_IDE BIT15 ///< IDE Decode Enable
+#define R_PCH_SATA_PID 0x70
+#define B_PCH_SATA_PID_NEXT 0xFF00
+#define V_PCH_SATA_PID_NEXT_0 0xB000
+#define V_PCH_SATA_PID_NEXT_1 0xA800
+#define B_PCH_SATA_PID_CID 0x00FF
+#define R_PCH_SATA_PC 0x72
+#define S_PCH_SATA_PC 2
+#define B_PCH_SATA_PC_PME (BIT15 | BIT14 | BIT13 | BIT12 | BIT11)
+#define V_PCH_SATA_PC_PME_0 0x0000
+#define V_PCH_SATA_PC_PME_1 0x4000
+#define B_PCH_SATA_PC_D2_SUP BIT10
+#define B_PCH_SATA_PC_D1_SUP BIT9
+#define B_PCH_SATA_PC_AUX_CUR (BIT8 | BIT7 | BIT6)
+#define B_PCH_SATA_PC_DSI BIT5
+#define B_PCH_SATA_PC_PME_CLK BIT3
+#define B_PCH_SATA_PC_VER (BIT2 | BIT1 | BIT0)
+#define R_PCH_SATA_PMCS 0x74
+#define B_PCH_SATA_PMCS_PMES BIT15
+#define B_PCH_SATA_PMCS_PMEE BIT8
+#define B_PCH_SATA_PMCS_NSFRST BIT3
+#define V_PCH_SATA_PMCS_NSFRST_1 0x01
+#define V_PCH_SATA_PMCS_NSFRST_0 0x00
+#define B_PCH_SATA_PMCS_PS (BIT1 | BIT0)
+#define V_PCH_SATA_PMCS_PS_3 0x03
+#define V_PCH_SATA_PMCS_PS_0 0x00
+#define R_PCH_SATA_MID 0x80
+#define B_PCH_SATA_MID_NEXT 0xFF00
+#define B_PCH_SATA_MID_CID 0x00FF
+#define R_PCH_SATA_MC 0x82
+#define B_PCH_SATA_MC_C64 BIT7
+#define B_PCH_SATA_MC_MME (BIT6 | BIT5 | BIT4)
+#define V_PCH_SATA_MC_MME_4 0x04
+#define V_PCH_SATA_MC_MME_2 0x02
+#define V_PCH_SATA_MC_MME_1 0x01
+#define V_PCH_SATA_MC_MME_0 0x00
+#define B_PCH_SATA_MC_MMC (BIT3 | BIT2 | BIT1)
+#define V_PCH_SATA_MC_MMC_4 0x04
+#define V_PCH_SATA_MC_MMC_0 0x00
+#define B_PCH_SATA_MC_MSIE BIT0
+#define V_PCH_SATA_MC_MSIE_1 0x01
+#define V_PCH_SATA_MC_MSIE_0 0x00
+#define R_PCH_SATA_MA 0x84
+#define B_PCH_SATA_MA 0xFFFFFFFC
+#define R_PCH_SATA_MD 0x88
+#define B_PCH_SATA_MD_MSIMD 0xFFFF
+#define R_PCH_SATA_MAP 0x90
+#define B_PCH_H_SATA_MAP_SPD (BIT13 | BIT12 | BIT11 | BIT10 | BIT9 | BIT8)
+#define B_PCH_LP_SATA_MAP_SPD (BIT11 | BIT10 | BIT9 | BIT8)
+#define B_PCH_SATA_PORT5_DISABLED BIT13
+#define B_PCH_SATA_PORT4_DISABLED BIT12
+#define B_PCH_SATA_PORT3_DISABLED BIT11
+#define B_PCH_SATA_PORT2_DISABLED BIT10
+#define B_PCH_SATA_PORT1_DISABLED BIT9
+#define B_PCH_SATA_PORT0_DISABLED BIT8
+#define B_PCH_SATA2_MAP_SPD (BIT9 | BIT8)
+#define B_PCH_SATA2_PORT5_DISABLED BIT9
+#define B_PCH_SATA2_PORT4_DISABLED BIT8
+#define B_PCH_SATA_MAP_SMS_MASK (BIT7 | BIT6)
+#define V_PCH_SATA_MAP_SMS_LOOBACK_TESTMODE 0x00
+#define V_PCH_SATA_MAP_SMS_IDE 0x00
+#define V_PCH_SATA_MAP_SMS_AHCI 0x40
+#define V_PCH_SATA_MAP_SMS_RAID 0x80
+#define B_PCH_SATA_PORT_TO_CONTROLLER_CFG BIT5
+#define R_PCH_SATA_PCS 0x92
+#define S_PCH_SATA_PCS 0x2
+#define B_PCH_SATA_PCS_OOB_RETRY BIT15
+#define B_PCH_SATA_PCS_PORT5_DET BIT13
+#define B_PCH_SATA_PCS_PORT4_DET BIT12
+#define B_PCH_SATA_PCS_PORT3_DET BIT11
+#define B_PCH_SATA_PCS_PORT2_DET BIT10
+#define B_PCH_SATA_PCS_PORT1_DET BIT9
+#define B_PCH_SATA_PCS_PORT0_DET BIT8
+#define B_PCH_SATA_PCS_PORT5_EN BIT5
+#define B_PCH_SATA_PCS_PORT4_EN BIT4
+#define B_PCH_SATA_PCS_PORT3_EN BIT3
+#define B_PCH_SATA_PCS_PORT2_EN BIT2
+#define B_PCH_SATA_PCS_PORT1_EN BIT1
+#define B_PCH_SATA_PCS_PORT0_EN BIT0
+#define B_PCH_SATA2_PCS_PORT5_DET BIT9
+#define B_PCH_SATA2_PCS_PORT4_DET BIT8
+#define B_PCH_SATA2_PCS_PORT5_EN BIT1
+#define B_PCH_SATA2_PCS_PORT4_EN BIT0
+#define R_PCH_SATA_SCLKCG 0x94
+#define B_PCH_SATA_SCLKCG_PORT5_PCD BIT29
+#define B_PCH_SATA_SCLKCG_PORT4_PCD BIT28
+#define B_PCH_SATA_SCLKCG_PORT3_PCD BIT27
+#define B_PCH_SATA_SCLKCG_PORT2_PCD BIT26
+#define B_PCH_SATA_SCLKCG_PORT1_PCD BIT25
+#define B_PCH_SATA_SCLKCG_PORT0_PCD BIT24
+#define B_PCH_SATA_SCLKCG_POP3_DEVSLP BIT15
+#define R_PCH_SATA_SCLKGC 0x9C
+#define B_PCH_SATA_SCLKGC_AIE BIT7
+#define B_PCH_SATA_SCLKGC_AIES BIT6
+#define B_PCH_SATA_SCLKGC_SATATM_MASK 0x7C
+#define B_PCH_SATA_SCLKGC_SATATM_EN (BIT3 | BIT2)
+#define B_PCH_SATA_SCLKGC_SATA4PMIND BIT0
+#define R_PCH_SATA_SIRI 0xA0
+#define B_PCH_SATA_SIRI_IDX 0xFC
+#define R_PCH_SATA_STRD 0xA4
+#define B_PCH_SATA_STRD_DTA 0xFFFFFFFF
+#define R_PCH_SATA_CR0 0xA8
+#define B_PCH_SATA_CR0_MAJREV 0x00F00000
+#define B_PCH_SATA_CR0_MINREV 0x000F0000
+#define B_PCH_SATA_CR0_NEXT 0x0000FF00
+#define B_PCH_SATA_CR0_CAP 0x000000FF
+#define R_PCH_SATA_CR1 0xAC
+#define B_PCH_SATA_CR1_BAROFST 0xFFF0
+#define B_PCH_SATA_CR1_BARLOC 0x000F
+#define R_PCH_SATA_FLR_CID 0xB0
+#define B_PCH_SATA_FLR_CID_NEXT 0xFF00
+#define B_PCH_SATA_FLR_CID 0x00FF
+#define V_PCH_SATA_FLR_CID_1 0x0009
+#define V_PCH_SATA_FLR_CID_0 0x0013
+#define R_PCH_SATA_FLR_CLV 0xB2
+#define B_PCH_SATA_FLR_CLV_FLRC_FLRCSSEL_0 BIT9
+#define B_PCH_SATA_FLR_CLV_TXPC_FLRCSSEL_0 BIT8
+#define B_PCH_SATA_FLR_CLV_VSCID_FLRCSSEL_0 0x00FF
+#define B_PCH_SATA_FLR_CLV_VSCID_FLRCSSEL_1 0x00FF
+#define V_PCH_SATA_FLR_CLV_VSCID_FLRCSSEL 0x0006
+#define R_PCH_SATA_FLRC 0xB4
+#define B_PCH_SATA_FLRC_TXP BIT8
+#define B_PCH_SATA_FLRC_INITFLR BIT0
+#define R_PCH_SATA_ATC 0xC0
+#define B_PCH_SATA_ATC_SST BIT3
+#define B_PCH_SATA_ATC_SPT BIT2
+#define B_PCH_SATA_ATC_PST BIT1
+#define B_PCH_SATA_ATC_PMT BIT0
+#define R_PCH_SATA_ATS 0xC4
+#define B_PCH_SATA_ATS_SST BIT3
+#define B_PCH_SATA_ATS_SPT BIT2
+#define B_PCH_SATA_ATS_PST BIT1
+#define B_PCH_SATA_ATS_PMT BIT0
+#define R_PCH_SATA_SP 0xD0
+#define B_PCH_SATA_SP 0xFFFFFFFF
+#define R_PCH_SATA_BFCS 0xE0
+#define B_PCH_SATA_BFCS_P5BFI BIT15
+#define B_PCH_SATA_BFCS_P4BFI BIT14
+#define B_PCH_SATA_BFCS_P3BFI BIT13
+#define B_PCH_SATA_BFCS_P2BFI BIT12
+#define B_PCH_SATA_BFCS_P2BFS BIT11
+#define B_PCH_SATA_BFCS_P2BFF BIT10
+#define B_PCH_SATA_BFCS_P1BFI BIT9
+#define B_PCH_SATA_BFCS_P0BFI BIT8
+#define B_PCH_SATA_BFCS_BIST_FIS_T BIT7
+#define B_PCH_SATA_BFCS_BIST_FIS_A BIT6
+#define B_PCH_SATA_BFCS_BIST_FIS_S BIT5
+#define B_PCH_SATA_BFCS_BIST_FIS_L BIT4
+#define B_PCH_SATA_BFCS_BIST_FIS_F BIT3
+#define B_PCH_SATA_BFCS_BIST_FIS_P BIT2
+#define R_PCH_SATA_BFTD1 0xE4
+#define B_PCH_SATA_BFTD1 0xFFFFFFFF
+#define R_PCH_SATA_BFTD2 0xE8
+#define B_PCH_SATA_BFTD2 0xFFFFFFFF
+
+//
+// Serial ATA Index/Data Pair Superset Registers
+//
+#define R_PCH_SATA_SIDPBA_SINDX 0x00
+#define R_PCH_SATA_SIDPBA_SDATA 0x04
+#define V_PCH_SATA_AHCI_SINDX_RIDX_SCTL 0x01
+#define V_PCH_SATA_AHCI_SINDX_PIDX_PORT0 0x0000
+#define V_PCH_SATA_AHCI_SINDX_PIDX_PORT1 0x0200
+#define V_PCH_SATA_AHCI_SINDX_PIDX_PORT2 0x0100
+#define V_PCH_SATA_AHCI_SINDX_PIDX_PORT3 0x0300
+#define V_PCH_SATA_SIDPBA_SDATA_GEN1 0x10
+#define V_PCH_SATA_SIDPBA_SDATA_GEN2 0x20
+#define V_PCH_SATA_SIDPBA_SDATA_GEN3 0x30
+#define B_PCH_SATA_SIDPBA_SCTL_DET (BIT3|BIT2|BIT1|BIT0)
+#define V_PCH_SATA_SIDPBA_SCTL_DET_COMRST 0x01
+#define V_PCH_SATA_SIDPBA_SCTL_DET_NOINT 0x00
+#define V_PCH_SATA_SIDP_BAR_LENGTH 0x10
+#define N_PCH_SATA_SIDP_BAR_ALIGNMENT 0x04
+
+//
+// AHCI BAR Area related Registers
+//
+#define R_PCH_SATA_AHCI_CAP 0x0
+#define B_PCH_SATA_AHCI_CAP_S64A BIT31
+#define B_PCH_SATA_AHCI_CAP_SCQA BIT30
+#define B_PCH_SATA_AHCI_CAP_SSNTF BIT29
+#define B_PCH_SATA_AHCI_CAP_SIS BIT28 ///< Supports Interlock Switch
+#define B_PCH_SATA_AHCI_CAP_SSS BIT27 ///< Supports Stagger Spin-up
+#define B_PCH_SATA_AHCI_CAP_SALP BIT26
+#define B_PCH_SATA_AHCI_CAP_SAL BIT25
+#define B_PCH_SATA_AHCI_CAP_SCLO BIT24 ///< Supports Command List Override
+#define B_PCH_SATA_AHCI_CAP_ISS_MASK (BIT23 | BIT22 | BIT21 | BIT20)
+#define N_PCH_SATA_AHCI_CAP_ISS 20 ///< Interface Speed Support
+#define V_PCH_SATA_AHCI_CAP_ISS_1_5_G 0x01
+#define V_PCH_SATA_AHCI_CAP_ISS_3_0_G 0x02
+#define V_PCH_SATA_AHCI_CAP_ISS_6_0_G 0x03
+#define B_PCH_SATA_AHCI_CAP_SNZO BIT19
+#define B_PCH_SATA_AHCI_CAP_SAM BIT18
+#define B_PCH_SATA_AHCI_CAP_PMS BIT17 ///< Supports Port Multiplier
+#define B_PCH_SATA_AHCI_CAP_PMD BIT15 ///< PIO Multiple DRQ Block
+#define B_PCH_SATA_AHCI_CAP_SSC BIT14
+#define B_PCH_SATA_AHCI_CAP_PSC BIT13
+#define B_PCH_SATA_AHCI_CAP_NCS 0x1F00
+#define B_PCH_SATA_AHCI_CAP_CCCS BIT7
+#define B_PCH_SATA_AHCI_CAP_EMS BIT6
+#define B_PCH_SATA_AHCI_CAP_SXS BIT5 ///< External SATA is supported
+#define B_PCH_SATA_AHCI_CAP_NPS 0x001F
+
+#define R_PCH_SATA_AHCI_GHC 0x04
+#define B_PCH_SATA_AHCI_GHC_AE BIT31
+#define B_PCH_SATA_AHCI_GHC_MRSM BIT2
+#define B_PCH_SATA_AHCI_GHC_IE BIT1
+#define B_PCH_SATA_AHCI_GHC_HR BIT0
+
+#define R_PCH_SATA_AHCI_IS 0x08
+#define B_PCH_SATA_AHCI_IS_PORT5 BIT5
+#define B_PCH_SATA_AHCI_IS_PORT4 BIT4
+#define B_PCH_SATA_AHCI_IS_PORT3 BIT3
+#define B_PCH_SATA_AHCI_IS_PORT2 BIT2
+#define B_PCH_SATA_AHCI_IS_PORT1 BIT1
+#define B_PCH_SATA_AHCI_IS_PORT0 BIT0
+#define R_PCH_SATA_AHCI_PI 0x0C
+#define B_PCH_H_SATA_PORT_MASK 0x3F
+#define B_PCH_LP_SATA_PORT_MASK 0x0F
+#define B_PCH_SATA_PORT5_IMPLEMENTED BIT5
+#define B_PCH_SATA_PORT4_IMPLEMENTED BIT4
+#define B_PCH_SATA_PORT3_IMPLEMENTED BIT3
+#define B_PCH_SATA_PORT2_IMPLEMENTED BIT2
+#define B_PCH_SATA_PORT1_IMPLEMENTED BIT1
+#define B_PCH_SATA_PORT0_IMPLEMENTED BIT0
+#define R_PCH_SATA_AHCI_VS 0x10
+#define B_PCH_SATA_AHCI_VS_MJR 0xFFFF0000
+#define B_PCH_SATA_AHCI_VS_MNR 0x0000FFFF
+#define R_PCH_SATA_AHCI_EM_LOC 0x1C
+#define B_PCH_SATA_AHCI_EM_LOC_OFST 0xFFFF0000
+#define B_PCH_SATA_AHCI_EM_LOC_SZ 0x0000FFFF
+#define R_PCH_SATA_AHCI_EM_CTRL 0x20
+#define B_PCH_SATA_AHCI_EM_CTRL_ATTR_ALHD BIT26
+#define B_PCH_SATA_AHCI_EM_CTRL_ATTR_XMT BIT25
+#define B_PCH_SATA_AHCI_EM_CTRL_ATTR_SMB BIT24
+#define B_PCH_SATA_AHCI_EM_CTRL_SUPP_SGPIO BIT19
+#define B_PCH_SATA_AHCI_EM_CTRL_SUPP_SES2 BIT18
+#define B_PCH_SATA_AHCI_EM_CTRL_SUPP_SAFTE BIT17
+#define B_PCH_SATA_AHCI_EM_CTRL_SUPP_LED BIT16
+#define B_PCH_SATA_AHCI_EM_CTRL_RST BIT9
+#define B_PCH_SATA_AHCI_EM_CTRL_CTL_TM BIT8
+#define B_PCH_SATA_AHCI_EM_CTRL_STS_MR BIT0
+#define R_PCH_SATA_AHCI_CAP2 0x24
+#define B_PCH_SATA_AHCI_CAP2_DESO BIT5
+#define B_PCH_SATA_AHCI_CAP2_SADM BIT4
+#define B_PCH_SATA_AHCI_CAP2_SDS BIT3
+#define B_PCH_SATA_AHCI_CAP2_APST BIT2 ///< Automatic Partial to Slumber Transitions
+#define R_PCH_SATA_AHCI_VSP 0xA0
+#define B_PCH_SATA_AHCI_VSP_SLPD BIT0
+#define R_PCH_SATA_AHCI_RSTF 0xC8 ///< RST Feature Capabilities
+#define B_PCH_SATA_AHCI_RSTF_OUD (BIT11 | BIT10)
+#define N_PCH_SATA_AHCI_RSTF_OUD 10
+#define B_PCH_SATA_AHCI_RSTF_SEREQ BIT9
+#define B_PCH_SATA_AHCI_RSTF_IROES BIT8
+#define B_PCH_SATA_AHCI_RSTF_LEDL BIT7
+#define B_PCH_SATA_AHCI_RSTF_HDDLK BIT6
+#define B_PCH_SATA_AHCI_RSTF_IRSTOROM BIT5
+#define B_PCH_SATA_AHCI_RSTF_RSTE BIT4
+#define B_PCH_SATA_AHCI_RSTF_R5E BIT3
+#define B_PCH_SATA_AHCI_RSTF_R10E BIT2
+#define B_PCH_SATA_AHCI_RSTF_R1E BIT1
+#define B_PCH_SATA_AHCI_RSTF_R0E BIT0
+#define B_PCH_SATA_AHCI_RSTF_LOWBYTES 0x1FF
+#define R_PCH_SATA_AHCI_P0CLB 0x100
+#define R_PCH_SATA_AHCI_P1CLB 0x180
+#define R_PCH_SATA_AHCI_P2CLB 0x200
+#define R_PCH_SATA_AHCI_P3CLB 0x280
+#define R_PCH_SATA_AHCI_P4CLB 0x300
+#define R_PCH_SATA_AHCI_P5CLB 0x380
+#define R_PCH_SATA_AHCI_P6CLB 0x400
+#define R_PCH_SATA_AHCI_P7CLB 0x480
+#define B_PCH_SATA_AHCI_PXCLB 0xFFFFFC00
+#define R_PCH_SATA_AHCI_P0CLBU 0x104
+#define R_PCH_SATA_AHCI_P1CLBU 0x184
+#define R_PCH_SATA_AHCI_P2CLBU 0x204
+#define R_PCH_SATA_AHCI_P3CLBU 0x284
+#define R_PCH_SATA_AHCI_P4CLBU 0x304
+#define R_PCH_SATA_AHCI_P5CLBU 0x384
+#define R_PCH_SATA_AHCI_P6CLBU 0x404
+#define B_PCH_SATA_AHCI_PXCLBU 0xFFFFFFFF
+#define R_PCH_SATA_AHCI_P0FB 0x108
+#define R_PCH_SATA_AHCI_P1FB 0x188
+#define R_PCH_SATA_AHCI_P2FB 0x208
+#define R_PCH_SATA_AHCI_P3FB 0x288
+#define R_PCH_SATA_AHCI_P4FB 0x308
+#define R_PCH_SATA_AHCI_P5FB 0x388
+#define R_PCH_SATA_AHCI_P6FB 0x408
+#define B_PCH_SATA_AHCI_PXFB 0xFFFFFF00
+#define R_PCH_SATA_AHCI_P0FBU 0x10C
+#define R_PCH_SATA_AHCI_P1FBU 0x18C
+#define R_PCH_SATA_AHCI_P2FBU 0x20C
+#define R_PCH_SATA_AHCI_P3FBU 0x28C
+#define R_PCH_SATA_AHCI_P4FBU 0x30C
+#define R_PCH_SATA_AHCI_P5FBU 0x38C
+#define R_PCH_SATA_AHCI_P6FBU 0x40C
+#define B_PCH_SATA_AHCI_PXFBU 0xFFFFFFFF
+#define R_PCH_SATA_AHCI_P0IS 0x110
+#define R_PCH_SATA_AHCI_P1IS 0x190
+#define R_PCH_SATA_AHCI_P2IS 0x210
+#define R_PCH_SATA_AHCI_P3IS 0x290
+#define R_PCH_SATA_AHCI_P4IS 0x310
+#define R_PCH_SATA_AHCI_P5IS 0x390
+#define R_PCH_SATA_AHCI_P6IS 0x410
+#define B_PCH_SATA_AHCI_PXIS_CPDS BIT31
+#define B_PCH_SATA_AHCI_PXIS_TFES BIT30
+#define B_PCH_SATA_AHCI_PXIS_HBFS BIT29
+#define B_PCH_SATA_AHCI_PXIS_HBDS BIT28
+#define B_PCH_SATA_AHCI_PXIS_IFS BIT27
+#define B_PCH_SATA_AHCI_PXIS_INFS BIT26
+#define B_PCH_SATA_AHCI_PXIS_OFS BIT24
+#define B_PCH_SATA_AHCI_PXIS_IPMS BIT23
+#define B_PCH_SATA_AHCI_PXIS_PRCS BIT22
+#define B_PCH_SATA_AHCI_PXIS_DIS BIT7
+#define B_PCH_SATA_AHCI_PXIS_PCS BIT6
+#define B_PCH_SATA_AHCI_PXIS_DPS BIT5
+#define B_PCH_SATA_AHCI_PXIS_UFS BIT4
+#define B_PCH_SATA_AHCI_PXIS_SDBS BIT3
+#define B_PCH_SATA_AHCI_PXIS_DSS BIT2
+#define B_PCH_SATA_AHCI_PXIS_PSS BIT1
+#define B_PCH_SATA_AHCI_PXIS_DHRS BIT0
+#define R_PCH_SATA_AHCI_P0IE 0x114
+#define R_PCH_SATA_AHCI_P1IE 0x194
+#define R_PCH_SATA_AHCI_P2IE 0x214
+#define R_PCH_SATA_AHCI_P3IE 0x294
+#define R_PCH_SATA_AHCI_P4IE 0x314
+#define R_PCH_SATA_AHCI_P5IE 0x394
+#define R_PCH_SATA_AHCI_P6IE 0x414
+#define B_PCH_SATA_AHCI_PXIE_CPDE BIT31
+#define B_PCH_SATA_AHCI_PXIE_TFEE BIT30
+#define B_PCH_SATA_AHCI_PXIE_HBFE BIT29
+#define B_PCH_SATA_AHCI_PXIE_HBDE BIT28
+#define B_PCH_SATA_AHCI_PXIE_IFE BIT27
+#define B_PCH_SATA_AHCI_PXIE_INFE BIT26
+#define B_PCH_SATA_AHCI_PXIE_OFE BIT24
+#define B_PCH_SATA_AHCI_PXIE_IPME BIT23
+#define B_PCH_SATA_AHCI_PXIE_PRCE BIT22
+#define B_PCH_SATA_AHCI_PXIE_DIE BIT7
+#define B_PCH_SATA_AHCI_PXIE_PCE BIT6
+#define B_PCH_SATA_AHCI_PXIE_DPE BIT5
+#define B_PCH_SATA_AHCI_PXIE_UFIE BIT4
+#define B_PCH_SATA_AHCI_PXIE_SDBE BIT3
+#define B_PCH_SATA_AHCI_PXIE_DSE BIT2
+#define B_PCH_SATA_AHCI_PXIE_PSE BIT1
+#define B_PCH_SATA_AHCI_PXIE_DHRE BIT0
+#define R_PCH_SATA_AHCI_P0CMD 0x118
+#define R_PCH_SATA_AHCI_P1CMD 0x198
+#define R_PCH_SATA_AHCI_P2CMD 0x218
+#define R_PCH_SATA_AHCI_P3CMD 0x298
+#define R_PCH_SATA_AHCI_P4CMD 0x318
+#define R_PCH_SATA_AHCI_P5CMD 0x398
+#define R_PCH_SATA_AHCI_P6CMD 0x418
+#define B_PCH_SATA_AHCI_PxCMD_ICC (BIT31 | BIT30 | BIT29 | BIT28)
+#define B_PCH_SATA_AHCI_PxCMD_MASK (BIT27 | BIT26 | BIT21 | BIT22 | BIT19 | BIT18)
+#define B_PCH_SATA_AHCI_PxCMD_ASP BIT27
+#define B_PCH_SATA_AHCI_PxCMD_ALPE BIT26
+#define B_PCH_SATA_AHCI_PxCMD_DLAE BIT25
+#define B_PCH_SATA_AHCI_PxCMD_ATAPI BIT24
+#define B_PCH_SATA_AHCI_PxCMD_APSTE BIT23
+#define B_PCH_SATA_AHCI_PxCMD_SUD BIT1
+#define R_PCH_SATA_AHCI_P0DEVSLP 0x144
+#define R_PCH_SATA_AHCI_P1DEVSLP 0x1C4
+#define R_PCH_SATA_AHCI_P2DEVSLP 0x244
+#define R_PCH_SATA_AHCI_P3DEVSLP 0x2C4
+#define B_PCH_SATA_AHCI_PxDEVSLP_DSP BIT1
+#define B_PCH_SATA_AHCI_PxDEVSLP_ADSE BIT0
+#define B_PCH_SATA_AHCI_PxDEVSLP_DITO_MASK 0x01FF8000
+#define V_PCH_SATA_AHCI_PxDEVSLP_DITO_625 0x01388000
+#define B_PCH_SATA_AHCI_PxDEVSLP_DM_MASK 0x1E000000
+#define V_PCH_SATA_AHCI_PxDEVSLP_DM_16 0x1E000000
+#define B_PCH_SATA_AHCI_PxCMD_ESP BIT21 ///< Used with an external SATA device
+#define B_PCH_SATA_AHCI_PxCMD_MPSP BIT19 ///< Mechanical Switch Attached to Port
+#define B_PCH_SATA_AHCI_PxCMD_HPCP BIT18 ///< Hotplug capable
+#define B_PCH_SATA_AHCI_PxCMD_CR BIT15
+#define B_PCH_SATA_AHCI_PxCMD_FR BIT14
+#define B_PCH_SATA_AHCI_PxCMD_ISS BIT13
+#define B_PCH_SATA_AHCI_PxCMD_CCS 0x00001F00
+#define B_PCH_SATA_AHCI_PxCMD_FRE BIT4
+#define B_PCH_SATA_AHCI_PxCMD_CLO BIT3
+#define B_PCH_SATA_AHCI_PxCMD_POD BIT2
+#define B_PCH_SATA_AHCI_PxCMD_SUD BIT1
+#define B_PCH_SATA_AHCI_PxCMD_ST BIT0
+#define R_PCH_SATA_AHCI_P0TFD 0x120
+#define R_PCH_SATA_AHCI_P1TFD 0x1A0
+#define R_PCH_SATA_AHCI_P2TFD 0x220
+#define R_PCH_SATA_AHCI_P3TFD 0x2A0
+#define R_PCH_SATA_AHCI_P4TFD 0x320
+#define R_PCH_SATA_AHCI_P5TFD 0x3A0
+#define R_PCH_SATA_AHCI_P6TFD 0x420
+#define B_PCH_SATA_AHCI_PXTFD_ERR 0x0000FF00
+#define B_PCH_SATA_AHCI_PXTFD_STS 0x000000FF
+#define R_PCH_SATA_AHCI_P0SIG 0x124
+#define R_PCH_SATA_AHCI_P1SIG 0x1A4
+#define R_PCH_SATA_AHCI_P2SIG 0x224
+#define R_PCH_SATA_AHCI_P3SIG 0x2A4
+#define R_PCH_SATA_AHCI_P4SIG 0x324
+#define R_PCH_SATA_AHCI_P5SIG 0x3A4
+#define R_PCH_SATA_AHCI_P6SIG 0x424
+#define B_PCH_SATA_AHCI_PXSIG_LBA_HR 0xFF000000
+#define B_PCH_SATA_AHCI_PXSIG_LBA_MR 0x00FF0000
+#define B_PCH_SATA_AHCI_PXSIG_LBA_LR 0x0000FF00
+#define B_PCH_SATA_AHCI_PXSIG_SCR 0x000000FF
+#define R_PCH_SATA_AHCI_P0SSTS 0x128
+#define R_PCH_SATA_AHCI_P1SSTS 0x1A8
+#define R_PCH_SATA_AHCI_P2SSTS 0x228
+#define R_PCH_SATA_AHCI_P3SSTS 0x2A8
+#define R_PCH_SATA_AHCI_P4SSTS 0x328
+#define R_PCH_SATA_AHCI_P5SSTS 0x3A8
+#define R_PCH_SATA_AHCI_P6SSTS 0x428
+#define B_PCH_SATA_AHCI_PXSSTS_IPM_0 0x00000000
+#define B_PCH_SATA_AHCI_PXSSTS_IPM_1 0x00000100
+#define B_PCH_SATA_AHCI_PXSSTS_IPM_2 0x00000200
+#define B_PCH_SATA_AHCI_PXSSTS_IPM_6 0x00000600
+#define B_PCH_SATA_AHCI_PXSSTS_SPD_0 0x00000000
+#define B_PCH_SATA_AHCI_PXSSTS_SPD_1 0x00000010
+#define B_PCH_SATA_AHCI_PXSSTS_SPD_2 0x00000020
+#define B_PCH_SATA_AHCI_PXSSTS_SPD_3 0x00000030
+#define B_PCH_SATA_AHCI_PXSSTS_DET_0 0x00000000
+#define B_PCH_SATA_AHCI_PXSSTS_DET_1 0x00000001
+#define B_PCH_SATA_AHCI_PXSSTS_DET_3 0x00000003
+#define B_PCH_SATA_AHCI_PXSSTS_DET_4 0x00000004
+#define R_PCH_SATA_AHCI_P0SCTL 0x12C
+#define R_PCH_SATA_AHCI_P1SCTL 0x1AC
+#define R_PCH_SATA_AHCI_P2SCTL 0x22C
+#define R_PCH_SATA_AHCI_P3SCTL 0x2AC
+#define R_PCH_SATA_AHCI_P4SCTL 0x32C
+#define R_PCH_SATA_AHCI_P5SCTL 0x3AC
+#define R_PCH_SATA_AHCI_P6SCTL 0x42C
+#define B_PCH_SATA_AHCI_PXSCTL_IPM 0x00000F00
+#define V_PCH_SATA_AHCI_PXSCTL_IPM_0 0x00000000
+#define V_PCH_SATA_AHCI_PXSCTL_IPM_1 0x00000100
+#define V_PCH_SATA_AHCI_PXSCTL_IPM_2 0x00000200
+#define V_PCH_SATA_AHCI_PXSCTL_IPM_3 0x00000300
+#define B_PCH_SATA_AHCI_PXSCTL_SPD 0x000000F0
+#define V_PCH_SATA_AHCI_PXSCTL_SPD_0 0x00000000
+#define V_PCH_SATA_AHCI_PXSCTL_SPD_1 0x00000010
+#define V_PCH_SATA_AHCI_PXSCTL_SPD_2 0x00000020
+#define V_PCH_SATA_AHCI_PXSCTL_SPD_3 0x00000030
+#define B_PCH_SATA_AHCI_PXSCTL_DET 0x0000000F
+#define V_PCH_SATA_AHCI_PXSCTL_DET_0 0x00000000
+#define V_PCH_SATA_AHCI_PXSCTL_DET_1 0x00000001
+#define V_PCH_SATA_AHCI_PXSCTL_DET_4 0x00000004
+#define R_PCH_SATA_AHCI_P0SERR 0x130
+#define R_PCH_SATA_AHCI_P1SERR 0x1B0
+#define R_PCH_SATA_AHCI_P2SERR 0x230
+#define R_PCH_SATA_AHCI_P3SERR 0x2B0
+#define R_PCH_SATA_AHCI_P4SERR 0x330
+#define R_PCH_SATA_AHCI_P5SERR 0x3B0
+#define R_PCH_SATA_AHCI_P6SERR 0x430
+#define B_PCH_SATA_AHCI_PXSERR_EXCHG BIT26
+#define B_PCH_SATA_AHCI_PXSERR_UN_FIS_TYPE BIT25
+#define B_PCH_SATA_AHCI_PXSERR_TRSTE_24 BIT24
+#define B_PCH_SATA_AHCI_PXSERR_TRSTE_23 BIT23
+#define B_PCH_SATA_AHCI_PXSERR_HANDSHAKE BIT22
+#define B_PCH_SATA_AHCI_PXSERR_CRC_ERROR BIT21
+#define B_PCH_SATA_AHCI_PXSERR_10B8B_DECERR BIT19
+#define B_PCH_SATA_AHCI_PXSERR_COMM_WAKE BIT18
+#define B_PCH_SATA_AHCI_PXSERR_PHY_ERROR BIT17
+#define B_PCH_SATA_AHCI_PXSERR_PHY_RDY_CHG BIT16
+#define B_PCH_SATA_AHCI_PXSERR_INTRNAL_ERR BIT11
+#define B_PCH_SATA_AHCI_PXSERR_PROTOCOL_ERR BIT10
+#define B_PCH_SATA_AHCI_PXSERR_PCDIE BIT9
+#define B_PCH_SATA_AHCI_PXSERR_TDIE BIT8
+#define B_PCH_SATA_AHCI_PXSERR_RCE BIT1
+#define B_PCH_SATA_AHCI_PXSERR_RDIE BIT0
+#define R_PCH_SATA_AHCI_P0SACT 0x134
+#define R_PCH_SATA_AHCI_P1SACT 0x1B4
+#define R_PCH_SATA_AHCI_P2SACT 0x234
+#define R_PCH_SATA_AHCI_P3SACT 0x2B4
+#define R_PCH_SATA_AHCI_P4SACT 0x334
+#define R_PCH_SATA_AHCI_P5SACT 0x3B4
+#define R_PCH_SATA_AHCI_P6SACT 0x434
+#define B_PCH_SATA_AHCI_PXSACT_DS 0xFFFFFFFF
+#define R_PCH_SATA_AHCI_P0CI 0x138
+#define R_PCH_SATA_AHCI_P1CI 0x1B8
+#define R_PCH_SATA_AHCI_P2CI 0x238
+#define R_PCH_SATA_AHCI_P3CI 0x2B8
+#define R_PCH_SATA_AHCI_P4CI 0x338
+#define R_PCH_SATA_AHCI_P5CI 0x3B8
+#define R_PCH_SATA_AHCI_P6CI 0x438
+#define B_PCH_SATA_AHCI_PXCI 0xFFFFFFFF
+
+//
+// Macros of ICH capabilities for SATA controller which are used by SATA controller driver
+//
+//
+//
+// Define the individual capabilities of each sata controller
+//
+#define LPTH_SATA_MAX_CONTROLLERS 2 ///< max sata controllers number supported
+#define LPTLP_SATA_MAX_CONTROLLERS 1 ///< max sata controllers number supported
+#define PCH_IDE_MAX_CHANNELS 2 ///< max channels number of single sata controller
+#define PCH_IDE_MAX_DEVICES 2 ///< max devices number of single sata channel
+#define LPTH_AHCI_MAX_PORTS 6 ///< max number of sata ports in LPTH
+#define LPTLP_AHCI_MAX_PORTS 4 ///< max number of sata ports in LPTLP
+#define PCH_SATA_DEVICE_ID_INVALID 0xFFFF
+#define PCH_SATA_1_DEVICE_NUMBER PCI_DEVICE_NUMBER_PCH_SATA
+#define PCH_SATA_1_FUNCTION_NUMBER PCI_FUNCTION_NUMBER_PCH_SATA
+#define PCH_H_AHCI_1_MAX_PORTS 6 ///< max number of ports in sata in PCH
+#define PCH_LP_AHCI_1_MAX_PORTS 4 ///< max number of ports in sata1 in PCH
+#define PCH_IDE_1_MAX_CHANNELS 2
+#define PCH_IDE_1_MAX_DEVICES 2
+#define PCH_IDE_1_MAX_PORTS 4
+
+#define PCH_SATA_2_DEVICE_NUMBER PCI_DEVICE_NUMBER_PCH_SATA2
+#define PCH_SATA_2_FUNCTION_NUMBER PCI_FUNCTION_NUMBER_PCH_SATA2
+#define PCH_AHCI_2_MAX_PORTS 2 ///< number of ports in sata2 in PCH
+#define PCH_IDE_2_MAX_CHANNELS 2
+#define PCH_IDE_2_MAX_DEVICES 2
+#define PCH_IDE_2_MAX_PORTS 2
+
+//
+// GPIO SATA0GP is the Sata port 0 reset pin.
+//
+#define PCH_GPIO_SATA_PORT0_RESET 21
+#define PCH_LP_GPIO_SATA_PORT0_RESET (R_PCH_GP_N_CONFIG0 + (34 * 0x08))
+//
+// GPIO SATA1GP is the Sata port 1 reset pin.
+//
+#define PCH_GPIO_SATA_PORT1_RESET 19
+#define PCH_LP_GPIO_SATA_PORT1_RESET (R_PCH_GP_N_CONFIG0 + (35 * 0x08))
+
+//
+// GPIO SATA2GP is the Sata port 2 reset pin.
+//
+#define PCH_GPIO_SATA_PORT2_RESET 36
+#define PCH_LP_GPIO_SATA_PORT2_RESET (R_PCH_GP_N_CONFIG0 + (36 * 0x08))
+
+//
+// GPIO SATA3GP is the Sata port 3 reset pin.
+//
+#define PCH_GPIO_SATA_PORT3_RESET 37
+#define PCH_LP_GPIO_SATA_PORT3_RESET (R_PCH_GP_N_CONFIG0 + (37 * 0x08))
+
+//
+// GPIO SATA4GP is the Sata port 4 reset pin.
+//
+#define PCH_GPIO_SATA_PORT4_RESET 16
+//
+// GPIO SATA5GP is the Sata port 5 reset pin.
+//
+#define PCH_GPIO_SATA_PORT5_RESET 49
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsSerialIo.h b/ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsSerialIo.h
new file mode 100644
index 0000000..c99d758
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsSerialIo.h
@@ -0,0 +1,169 @@
+/** @file
+ Register names for PCH Serial IO Controllers
+
+ Conventions:
+
+ - Prefixes:
+ Definitions beginning with "R_" are registers
+ Definitions beginning with "B_" are bits within registers
+ Definitions beginning with "V_" are meaningful values of bits within the registers
+ Definitions beginning with "S_" are register sizes
+ Definitions beginning with "N_" are the bit position
+ - In general, PCH registers are denoted by "_PCH_" in register names
+ - Registers / bits that are different between PCH generations are denoted by
+ "_PCH_<generation_name>_" in register/bit names. e.g., "_PCH_CPT_"
+ - Registers / bits that are different between SKUs are denoted by "_<SKU_name>"
+ at the end of the register/bit names
+ - Registers / bits of new devices introduced in a PCH generation will be just named
+ as "_PCH_" without <generation_name> inserted.
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PCH_REGS_SERIAL_IO_H_
+#define _PCH_REGS_SERIAL_IO_H_
+
+#ifdef SERIAL_IO_FLAG
+
+//
+// Serial IO DMA Controller Registers (D21:F0)
+//
+#define PCI_DEVICE_NUMBER_PCH_LP_SERIAL_IO_DMA 21
+#define PCI_FUNCTION_NUMBER_PCH_LP_SERIAL_IO_DMA 0
+#define R_PCH_LP_SERIAL_IO_DMA_VENDOR_ID 0x00
+#define V_PCH_LP_SERIAL_IO_DMA_VENDOR_ID V_PCH_INTEL_VENDOR_ID
+#define R_PCH_LP_SERIAL_IO_DMA_DEVICE_ID 0x02
+#define V_PCH_LP_SERIAL_IO_DMA_DEVICE_ID 0x9C60
+
+//
+// Serial IO I2C0 Controller Registers (D21:F1)
+//
+#define PCI_DEVICE_NUMBER_PCH_LP_SERIAL_IO_I2C0 21
+#define PCI_FUNCTION_NUMBER_PCH_LP_SERIAL_IO_I2C0 1
+#define R_PCH_LP_SERIAL_IO_I2C0_VENDOR_ID 0x00
+#define V_PCH_LP_SERIAL_IO_I2C0_VENDOR_ID V_PCH_INTEL_VENDOR_ID
+#define R_PCH_LP_SERIAL_IO_I2C0_DEVICE_ID 0x02
+#define V_PCH_LP_SERIAL_IO_I2C0_DEVICE_ID 0x9C61
+
+//
+// Serial IO I2C0 Controller Registers (D21:F2)
+//
+#define PCI_DEVICE_NUMBER_PCH_LP_SERIAL_IO_I2C1 21
+#define PCI_FUNCTION_NUMBER_PCH_LP_SERIAL_IO_I2C1 2
+#define R_PCH_LP_SERIAL_IO_I2C1_VENDOR_ID 0x00
+#define V_PCH_LP_SERIAL_IO_I2C1_VENDOR_ID V_PCH_INTEL_VENDOR_ID
+#define R_PCH_LP_SERIAL_IO_I2C1_DEVICE_ID 0x02
+#define V_PCH_LP_SERIAL_IO_I2C1_DEVICE_ID 0x9C62
+
+//
+// Serial IO SPI0 Controller Registers (D21:F3)
+//
+#define PCI_DEVICE_NUMBER_PCH_LP_SERIAL_IO_SPI0 21
+#define PCI_FUNCTION_NUMBER_PCH_LP_SERIAL_IO_SPI0 3
+#define R_PCH_LP_SERIAL_IO_SPI0_VENDOR_ID 0x00
+#define V_PCH_LP_SERIAL_IO_SPI0_VENDOR_ID V_PCH_INTEL_VENDOR_ID
+#define R_PCH_LP_SERIAL_IO_SPI0_DEVICE_ID 0x02
+#define V_PCH_LP_SERIAL_IO_SPI0_DEVICE_ID 0x9C65
+
+//
+// Serial IO SPI1 Controller Registers (D21:F4)
+//
+#define PCI_DEVICE_NUMBER_PCH_LP_SERIAL_IO_SPI1 21
+#define PCI_FUNCTION_NUMBER_PCH_LP_SERIAL_IO_SPI1 4
+#define R_PCH_LP_SERIAL_IO_SPI1_VENDOR_ID 0x00
+#define V_PCH_LP_SERIAL_IO_SPI1_VENDOR_ID V_PCH_INTEL_VENDOR_ID
+#define R_PCH_LP_SERIAL_IO_SPI1_DEVICE_ID 0x02
+#define V_PCH_LP_SERIAL_IO_SPI1_DEVICE_ID 0x9C66
+
+//
+// Serial IO UART0 Controller Registers (D21:F5)
+//
+#define PCI_DEVICE_NUMBER_PCH_LP_SERIAL_IO_UART0 21
+#define PCI_FUNCTION_NUMBER_PCH_LP_SERIAL_IO_UART0 5
+#define R_PCH_LP_SERIAL_IO_UART0_VENDOR_ID 0x00
+#define V_PCH_LP_SERIAL_IO_UART0_VENDOR_ID V_PCH_INTEL_VENDOR_ID
+#define R_PCH_LP_SERIAL_IO_UART0_DEVICE_ID 0x02
+#define V_PCH_LP_SERIAL_IO_UART0_DEVICE_ID 0x9C63
+
+//
+// Serial IO UART1 Controller Registers (D21:F6)
+//
+#define PCI_DEVICE_NUMBER_PCH_LP_SERIAL_IO_UART1 21
+#define PCI_FUNCTION_NUMBER_PCH_LP_SERIAL_IO_UART1 6
+#define R_PCH_LP_SERIAL_IO_UART1_VENDOR_ID 0x00
+#define V_PCH_LP_SERIAL_IO_UART1_VENDOR_ID V_PCH_INTEL_VENDOR_ID
+#define R_PCH_LP_SERIAL_IO_UART1_DEVICE_ID 0x02
+#define V_PCH_LP_SERIAL_IO_UART1_DEVICE_ID 0x9C64
+
+//
+// Serial IO SDIO Controller Registers (D23:F0)
+//
+#define PCI_DEVICE_NUMBER_PCH_LP_SERIAL_IO_SDIO 23
+#define PCI_FUNCTION_NUMBER_PCH_LP_SERIAL_IO_SDIO 0
+#define R_PCH_LP_SERIAL_IO_SDIO_VENDOR_ID 0x00
+#define V_PCH_LP_SERIAL_IO_SDIO_VENDOR_ID V_PCH_INTEL_VENDOR_ID
+#define R_PCH_LP_SERIAL_IO_SDIO_DEVICE_ID 0x02
+#define V_PCH_LP_SERIAL_IO_SDIO_DEVICE_ID 0x9C35
+#define R_PCH_LP_SERIAL_IO_SDIO_PPR_CMD12 0x3C
+#define R_PCH_LP_SERIAL_IO_SDIO_PPR_GEN 0x1008
+#define B_PCH_LP_SERIAL_IO_SDIO_PPR_GEN_LTR_MODE BIT2
+#define R_PCH_LP_SERIAL_IO_SDIO_PPR_SW_LTR 0x1010
+
+
+#define R_PCH_LP_SERIAL_IO_SDIO_SLAVE_DELAY_DDR50_MODE 0x1034
+
+#define V_LP_SERIAL_IO_DEV_MIN_FUN 0
+#define V_LP_SERIAL_IO_DEV_MAX_FUN 6
+
+//
+// Serial IO Controllers General PCI Configuration Registers
+//
+#define R_PCH_LP_SERIAL_IO_VENDOR_ID 0x00
+#define R_PCH_LP_SERIAL_IO_DEVICE_ID 0x02
+#define R_PCH_LP_SERIAL_IO_COMMAND 0x04
+#define B_PCH_LP_SERIAL_IO_COMMAND_BME BIT2
+#define B_PCH_LP_SERIAL_IO_COMMAND_MSE BIT1
+#define R_PCH_LP_SERIAL_IO_BAR0 0x10
+#define B_PCH_LP_SERIAL_IO_BAR0_BAR 0xFFFFF000
+#define R_PCH_LP_SERIAL_IO_BAR1 0x14
+#define B_PCH_LP_SERIAL_IO_BAR1_BAR 0xFFFFF000
+#define V_PCH_LP_SERIAL_IO_BAR_SIZE (4 * 1024)
+#define V_PCH_LP_SERIAL_SDIO_BAR_SIZE (8 * 1024)
+#define N_PCH_LP_SERIAL_IO_BAR_ALIGNMENT 12
+#define R_PCH_LP_SERIAL_IO_PME_CTRL_STS 0x84
+#define B_PCH_LP_SERIAL_IO_PME_CTRL_STS_PWR_ST (BIT1| BIT0)
+
+//
+// Serial IO Controllers Private Registers
+//
+#define R_PCH_LP_SERIAL_IO_PPR_RST 0x804
+#define B_PCH_LP_SERIAL_IO_PPR_RST_APB BIT0
+#define B_PCH_LP_SERIAL_IO_PPR_RST_FUNC BIT1
+#define R_PCH_LP_SERIAL_IO_PPR_GEN 0x808
+#define B_PCH_LP_SERIAL_IO_PPR_GEN_LTR_MODE BIT2
+#define B_PCH_LP_SERIAL_IO_PPR_GEN_IO_VOLTAGE_SEL BIT3
+#define R_PCH_LP_SERIAL_IO_PPR_AUTO_LTR 0x814
+
+#define R_PCH_LP_SERIAL_IO_GPIODF0 0x154
+#define B_PCH_LP_SERIAL_IO_GPIODF0_SPI_IDLE_DET_EN BIT0
+#define B_PCH_LP_SERIAL_IO_GPIODF0_I2C_IDLE_DET_EN BIT1
+#define B_PCH_LP_SERIAL_IO_GPIODF0_UART_IDLE_DET_EN BIT2
+#define B_PCH_LP_SERIAL_IO_GPIODF0_DMA_IDLE_DET_EN BIT3
+#define B_PCH_LP_SERIAL_IO_GPIODF0_SDIO_IDLE_DET_EN BIT4
+
+#endif // SERIAL_IO_FLAG
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsSmbus.h b/ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsSmbus.h
new file mode 100644
index 0000000..a848108
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsSmbus.h
@@ -0,0 +1,172 @@
+/** @file
+ Register names for PCH Smbus Device.
+
+ Conventions:
+
+ - Prefixes:
+ Definitions beginning with "R_" are registers
+ Definitions beginning with "B_" are bits within registers
+ Definitions beginning with "V_" are meaningful values of bits within the registers
+ Definitions beginning with "S_" are register sizes
+ Definitions beginning with "N_" are the bit position
+ - In general, PCH registers are denoted by "_PCH_" in register names
+ - Registers / bits that are different between PCH generations are denoted by
+ "_PCH_<generation_name>_" in register/bit names. e.g., "_PCH_LPT_"
+ - Registers / bits that are different between SKUs are denoted by "_<SKU_name>"
+ at the end of the register/bit names
+ - Registers / bits of new devices introduced in a PCH generation will be just named
+ as "_PCH_" without <generation_name> inserted.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PCH_REGS_SMBUS_H_
+#define _PCH_REGS_SMBUS_H_
+
+//
+// SMBus Controller Registers (D31:F3)
+//
+#define PCI_DEVICE_NUMBER_PCH_SMBUS 31
+#define PCI_FUNCTION_NUMBER_PCH_SMBUS 3
+#define R_PCH_SMBUS_VENDOR_ID 0x00
+#define V_PCH_SMBUS_VENDOR_ID V_PCH_INTEL_VENDOR_ID
+#define R_PCH_SMBUS_DEVICE_ID 0x02
+#define V_PCH_LPTH_SMBUS_DEVICE_ID 0x8C22
+#define V_PCH_LPTLP_SMBUS_DEVICE_ID 0x9C22
+#define R_PCH_SMBUS_PCICMD 0x04
+#define B_PCH_SMBUS_PCICMD_INTR_DIS BIT10
+#define B_PCH_SMBUS_PCICMD_FBE BIT9
+#define B_PCH_SMBUS_PCICMD_SERR_EN BIT8
+#define B_PCH_SMBUS_PCICMD_WCC BIT7
+#define B_PCH_SMBUS_PCICMD_PER BIT6
+#define B_PCH_SMBUS_PCICMD_VPS BIT5
+#define B_PCH_SMBUS_PCICMD_PMWE BIT4
+#define B_PCH_SMBUS_PCICMD_SCE BIT3
+#define B_PCH_SMBUS_PCICMD_BME BIT2
+#define B_PCH_SMBUS_PCICMD_MSE BIT1
+#define B_PCH_SMBUS_PCICMD_IOSE BIT0
+#define R_PCH_SMBUS_PCISTS 0x06
+#define B_PCH_SMBUS_PCISTS_DPE BIT15
+#define B_PCH_SMBUS_PCISTS_SSE BIT14
+#define B_PCH_SMBUS_PCISTS_RMA BIT13
+#define B_PCH_SMBUS_PCISTS_RTA BIT12
+#define B_PCH_SMBUS_PCISTS_STA BIT11
+#define B_PCH_SMBUS_PCISTS_DEVT (BIT10 | BIT9)
+#define B_PCH_SMBUS_PCISTS_DPED BIT8
+#define B_PCH_SMBUS_PCISTS_FB2BC BIT7
+#define B_PCH_SMBUS_PCISTS_UDF BIT6
+#define B_PCH_SMBUS_PCISTS_66MHZ_CAP BIT5
+#define B_PCH_SMBUS_PCISTS_CAP_LIST BIT4
+#define B_PCH_SMBUS_PCISTS_INTS BIT3
+#define R_PCH_SMBUS_RID 0x08
+#define B_PCH_SMBUS_RID 0xFF
+#define R_PCH_SMBUS_SCC 0x0A
+#define V_PCH_SMBUS_SCC 0x05
+#define R_PCH_SMBUS_BCC 0x0B
+#define V_PCH_SMBUS_BCC 0x0C
+#define R_PCH_SMBUS_BAR0 0x10
+#define B_PCH_SMBUS_BAR0_BAR 0xFFFFFF00
+#define B_PCH_SMBUS_BAR0_PREF BIT3
+#define B_PCH_SMBUS_BAR0_ADDRNG (BIT2 | BIT1)
+#define B_PCH_SMBUS_BAR0_MSI BIT0
+#define R_PCH_SMBUS_BAR1 0x14
+#define B_PCH_SMBUS_BAR1_BAR 0xFFFFFFFF
+#define R_PCH_SMBUS_BASE 0x20
+#define V_PCH_SMBUS_BASE_SIZE (1 << 5)
+#define B_PCH_SMBUS_BASE_BAR 0x0000FFE0
+#define R_PCH_SMBUS_SVID 0x2C
+#define B_PCH_SMBUS_SVID 0xFFFF
+#define R_PCH_SMBUS_SID 0x2E
+#define B_PCH_SMBUS_SID 0xFFFF
+#define R_PCH_SMBUS_INT_LN 0x3C
+#define B_PCH_SMBUS_INT_LN 0xFF
+#define R_PCH_SMBUS_INT_PN 0x3D
+#define B_PCH_SMBUS_INT_PN 0xFF
+#define R_PCH_SMBUS_HOSTC 0x40
+#define B_PCH_SMBUS_HOSTC_SPDWD BIT4
+#define B_PCH_SMBUS_HOSTC_SSRESET BIT3
+#define B_PCH_SMBUS_HOSTC_I2C_EN BIT2
+#define B_PCH_SMBUS_HOSTC_SMI_EN BIT1
+#define B_PCH_SMBUS_HOSTC_HST_EN BIT0
+
+//
+// SMBus I/O Registers
+//
+#define R_PCH_SMBUS_HSTS 0x00 ///< Host Status Register R/W
+#define B_PCH_SMBUS_HBSY 0x01
+#define B_PCH_SMBUS_INTR 0x02
+#define B_PCH_SMBUS_DERR 0x04
+#define B_PCH_SMBUS_BERR 0x08
+#define B_PCH_SMBUS_FAIL 0x10
+#define B_PCH_SMBUS_SMBALERT_STS 0x20
+#define B_PCH_SMBUS_IUS 0x40
+#define B_PCH_SMBUS_BYTE_DONE_STS 0x80
+#define B_PCH_SMBUS_ERROR (B_PCH_SMBUS_DERR | B_PCH_SMBUS_BERR | B_PCH_SMBUS_FAIL)
+#define B_PCH_SMBUS_HSTS_ALL 0xFF
+#define R_PCH_SMBUS_HCTL 0x02 ///< Host Control Register R/W
+#define B_PCH_SMBUS_INTREN 0x01
+#define B_PCH_SMBUS_KILL 0x02
+#define B_PCH_SMBUS_SMB_CMD 0x1C
+#define V_PCH_SMBUS_SMB_CMD_QUICK 0x00
+#define V_PCH_SMBUS_SMB_CMD_BYTE 0x04
+#define V_PCH_SMBUS_SMB_CMD_BYTE_DATA 0x08
+#define V_PCH_SMBUS_SMB_CMD_WORD_DATA 0x0C
+#define V_PCH_SMBUS_SMB_CMD_PROCESS_CALL 0x10
+#define V_PCH_SMBUS_SMB_CMD_BLOCK 0x14
+#define V_PCH_SMBUS_SMB_CMD_IIC_READ 0x18
+#define V_PCH_SMBUS_SMB_CMD_BLOCK_PROCESS 0x1C
+#define B_PCH_SMBUS_LAST_BYTE 0x20
+#define B_PCH_SMBUS_START 0x40
+#define B_PCH_SMBUS_PEC_EN 0x80
+#define R_PCH_SMBUS_HCMD 0x03 ///< Host Command Register R/W
+#define R_PCH_SMBUS_TSA 0x04 ///< Transmit Slave Address Register R/W
+#define B_PCH_SMBUS_RW_SEL 0x01
+#define B_PCH_SMBUS_READ 0x01 // RW
+#define B_PCH_SMBUS_WRITE 0x00 // RW
+#define B_PCH_SMBUS_ADDRESS 0xFE
+#define R_PCH_SMBUS_HD0 0x05 ///< Data 0 Register R/W
+#define R_PCH_SMBUS_HD1 0x06 ///< Data 1 Register R/W
+#define R_PCH_SMBUS_HBD 0x07 ///< Host Block Data Register R/W
+#define R_PCH_SMBUS_PEC 0x08 ///< Packet Error Check Data Register R/W
+#define R_PCH_SMBUS_RSA 0x09 ///< Receive Slave Address Register R/W
+#define B_PCH_SMBUS_SLAVE_ADDR 0x7F
+#define R_PCH_SMBUS_SD 0x0A ///< Receive Slave Data Register R/W
+#define R_PCH_SMBUS_AUXS 0x0C ///< Auxiliary Status Register R/WC
+#define B_PCH_SMBUS_CRCE 0x01
+#define B_PCH_SMBUS_STCO 0x02 ///< SMBus TCO Mode
+#define R_PCH_SMBUS_AUXC 0x0D ///< Auxiliary Control Register R/W
+#define B_PCH_SMBUS_AAC 0x01
+#define B_PCH_SMBUS_E32B 0x02
+#define R_PCH_SMBUS_SMLC 0x0E ///< SMLINK Pin Control Register R/W
+#define B_PCH_SMBUS_SMLINK0_CUR_STS 0x01
+#define B_PCH_SMBUS_SMLINK1_CUR_STS 0x02
+#define B_PCH_SMBUS_SMLINK_CLK_CTL 0x04
+#define R_PCH_SMBUS_SMBC 0x0F ///< SMBus Pin Control Register R/W
+#define B_PCH_SMBUS_SMBCLK_CUR_STS 0x01
+#define B_PCH_SMBUS_SMBDATA_CUR_STS 0x02
+#define B_PCH_SMBUS_SMBCLK_CTL 0x04
+#define R_PCH_SMBUS_SSTS 0x10 ///< Slave Status Register R/WC
+#define B_PCH_SMBUS_HOST_NOTIFY_STS 0x01
+#define R_PCH_SMBUS_SCMD 0x11 ///< Slave Command Register R/W
+#define B_PCH_SMBUS_HOST_NOTIFY_INTREN 0x01
+#define B_PCH_SMBUS_HOST_NOTIFY_WKEN 0x02
+#define B_PCH_SMBUS_SMBALERT_DIS 0x04
+#define R_PCH_SMBUS_NDA 0x14 ///< Notify Device Address Register RO
+#define B_PCH_SMBUS_DEVICE_ADDRESS 0xFE
+#define R_PCH_SMBUS_NDLB 0x16 ///< Notify Data Low Byte Register RO
+#define R_PCH_SMBUS_NDHB 0x17 ///< Notify Data High Byte Register RO
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsSpi.h b/ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsSpi.h
new file mode 100644
index 0000000..b195e33
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsSpi.h
@@ -0,0 +1,380 @@
+/** @file
+ Register names for PCH SPI device.
+
+ Conventions:
+
+ - Prefixes:
+ Definitions beginning with "R_" are registers
+ Definitions beginning with "B_" are bits within registers
+ Definitions beginning with "V_" are meaningful values of bits within the registers
+ Definitions beginning with "S_" are register sizes
+ Definitions beginning with "N_" are the bit position
+ - In general, PCH registers are denoted by "_PCH_" in register names
+ - Registers / bits that are different between PCH generations are denoted by
+ "_PCH_<generation_name>_" in register/bit names. e.g., "_PCH_LPT_"
+ - Registers / bits that are different between SKUs are denoted by "_<SKU_name>"
+ at the end of the register/bit names
+ - Registers / bits of new devices introduced in a PCH generation will be just named
+ as "_PCH_" without <generation_name> inserted.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PCH_REGS_SPI_H_
+#define _PCH_REGS_SPI_H_
+
+//
+// SPI Host Interface Registers
+//
+#define R_PCH_RCRB_SPI_BASE 0x3800 ///< Base address of the SPI host interface registers
+#define R_PCH_SPI_BFPR (R_PCH_RCRB_SPI_BASE + 0x00) ///< BIOS Flash Primary Region Register(32bits), which is RO and contains the same value from FREG1
+#define R_PCH_SPI_HSFS (R_PCH_RCRB_SPI_BASE + 0x04) ///< Hardware Sequencing Flash Status Register(16bits)
+#define B_PCH_SPI_HSFS_FLOCKDN BIT15 ///< Flash Configuration Lock-Down
+#define B_PCH_SPI_HSFS_FDV BIT14 ///< Flash Descriptor Valid, once valid software can use hareware sequencing regs
+#define B_PCH_SPI_HSFS_FDOPSS BIT13 ///< Flash Descriptor Override Pin-Strap Status, 0: The Flash Descriptor Security Override / Intel
+ ///< ME Debug Mode strap is set via external pull-up on HDA_SDO; 1: No override.
+#define B_PCH_SPI_PRR3PRR4_LOCKDN BIT12 ///< PRR3 PRR4 Lock-Down
+#define B_PCH_SPI_HSFS_SCIP BIT5 ///< SPI cyble in progress
+#define B_PCH_SPI_HSFS_BERASE_MASK (BIT4 | BIT3) ///< Block/Sector Erase Size
+#define V_PCH_SPI_HSFS_BERASE_256B 0x00 ///< Block/Sector = 256 Bytes
+#define V_PCH_SPI_HSFS_BERASE_4K 0x01 ///< Block/Sector = 4K Bytes
+#define V_PCH_SPI_HSFS_BERASE_8K 0x10 ///< Block/Sector = 8K Bytes
+#define V_PCH_SPI_HSFS_BERASE_64K 0x11 ///< Block/Sector = 64K Bytes
+#define B_PCH_SPI_HSFS_AEL BIT2 ///< Access Error Log
+#define B_PCH_SPI_HSFS_FCERR BIT1 ///< Flash Cycle Error
+#define B_PCH_SPI_HSFS_FDONE BIT0 ///< Flash Cycle Done
+#define R_PCH_SPI_HSFC (R_PCH_RCRB_SPI_BASE + 0x06) ///< Hardware Sequencing Flash Control Register(16bits)
+#define B_PCH_SPI_HSFC_FSMIE BIT15 ///< Flash SPI SMI# Enable
+#define B_PCH_SPI_HSFC_FDBC_MASK 0x3F00 ///< Flash Data Byte Count ( <= 64), Count = (Value in this field) + 1.
+#define B_PCH_SPI_HSFC_FCYCLE_MASK 0x0006 ///< Flash Cycle.
+#define V_PCH_SPI_HSFC_FCYCLE_READ 0 ///< Flash Cycle Read
+#define V_PCH_SPI_HSFC_FCYCLE_WRITE 2 ///< Flash Cycle Write
+#define V_PCH_SPI_HSFC_FCYCLE_ERASE 3 ///< Flash Cycle Block Erase
+#define B_PCH_SPI_HSFC_FCYCLE_FGO BIT0 ///< Flash Cycle Go.
+#define R_PCH_SPI_FADDR (R_PCH_RCRB_SPI_BASE + 0x08) ///< SPI Flash Address
+#define B_PCH_SPI_FADDR_MASK 0x07FFFFFF ///< SPI Flash Address Mask (0~26bit)
+#define R_PCH_SPI_FDATA00 (R_PCH_RCRB_SPI_BASE + 0x10) ///< SPI Data 00 (32 bits)
+#define R_PCH_SPI_FDATA01 (R_PCH_RCRB_SPI_BASE + 0x14) ///< SPI Data 01
+#define R_PCH_SPI_FDATA02 (R_PCH_RCRB_SPI_BASE + 0x18) ///< SPI Data 02
+#define R_PCH_SPI_FDATA03 (R_PCH_RCRB_SPI_BASE + 0x1C) ///< SPI Data 03
+#define R_PCH_SPI_FDATA04 (R_PCH_RCRB_SPI_BASE + 0x20) ///< SPI Data 04
+#define R_PCH_SPI_FDATA05 (R_PCH_RCRB_SPI_BASE + 0x24) ///< SPI Data 05
+#define R_PCH_SPI_FDATA06 (R_PCH_RCRB_SPI_BASE + 0x28) ///< SPI Data 06
+#define R_PCH_SPI_FDATA07 (R_PCH_RCRB_SPI_BASE + 0x2C) ///< SPI Data 07
+#define R_PCH_SPI_FDATA08 (R_PCH_RCRB_SPI_BASE + 0x30) ///< SPI Data 08
+#define R_PCH_SPI_FDATA09 (R_PCH_RCRB_SPI_BASE + 0x34) ///< SPI Data 09
+#define R_PCH_SPI_FDATA10 (R_PCH_RCRB_SPI_BASE + 0x38) ///< SPI Data 10
+#define R_PCH_SPI_FDATA11 (R_PCH_RCRB_SPI_BASE + 0x3C) ///< SPI Data 11
+#define R_PCH_SPI_FDATA12 (R_PCH_RCRB_SPI_BASE + 0x40) ///< SPI Data 12
+#define R_PCH_SPI_FDATA13 (R_PCH_RCRB_SPI_BASE + 0x44) ///< SPI Data 13
+#define R_PCH_SPI_FDATA14 (R_PCH_RCRB_SPI_BASE + 0x48) ///< SPI Data 14
+#define R_PCH_SPI_FDATA15 (R_PCH_RCRB_SPI_BASE + 0x4C) ///< SPI Data 15
+#define R_PCH_SPI_FRAP (R_PCH_RCRB_SPI_BASE + 0x50) ///< SPI Flash Regions Access Permisions Register
+#define B_PCH_SPI_FRAP_BMWAG_MASK 0xFF000000 ///< Master Write Access Grant MASK
+#define B_PCH_SPI_FRAP_BMWAG_GBE BIT27 ///< Master write access grant for Host CPU/GbE
+#define B_PCH_SPI_FRAP_BMWAG_ME BIT26 ///< Master write access grant for ME
+#define B_PCH_SPI_FRAP_BMWAG_BIOS BIT25 ///< Master write access grant for Host CPU/BIOS
+#define B_PCH_SPI_FRAP_BMRAG_MASK 0x00FF0000 ///< Master Write Access Grant MASK
+#define B_PCH_SPI_FRAP_BMRAG_GBE BIT19 ///< Master write access grant for Host CPU/GbE
+#define B_PCH_SPI_FRAP_BMRAG_ME BIT18 ///< Master write access grant for ME
+#define B_PCH_SPI_FRAP_BMRAG_BIOS BIT17 ///< Master write access grant for Host CPU/BIOS
+#define B_PCH_SPI_FRAP_BRWA_MASK 0x0000FF00 ///< BIOS Regsion Write Access MASK, Region0~7 - 0: Flash Descriptor; 1: BIOS; 2: ME; 3: GbE; 4: ...
+#define B_PCH_SPI_FRAP_BRWA_GBE BIT11 ///< Region write access for Region3 GbE
+#define B_PCH_SPI_FRAP_BRWA_ME BIT10 ///< Region write access for Region2 ME
+#define B_PCH_SPI_FRAP_BRWA_BIOS BIT9 ///< Region write access for Region1 BIOS
+#define B_PCH_SPI_FRAP_BRWA_FLASHD BIT8 ///< Region write access for Region0 Flash Descriptor
+#define B_PCH_SPI_FRAP_BRRA_MASK 0x000000FF ///< BIOS Regsion Read Access MASK, Region0~7 - 0: Flash Descriptor; 1: BIOS; 2: ME; 3: GbE; 4: ...
+#define B_PCH_SPI_FRAP_BRRA_GBE BIT3 ///< Region read access for Region3 GbE
+#define B_PCH_SPI_FRAP_BRRA_ME BIT2 ///< Region read access for Region2 ME
+#define B_PCH_SPI_FRAP_BRRA_BIOS BIT1 ///< Region read access for Region1 BIOS
+#define B_PCH_SPI_FRAP_BRRA_FLASHD BIT0 ///< Region read access for Region0 Flash Descriptor
+#define R_PCH_SPI_FREG0_FLASHD (R_PCH_RCRB_SPI_BASE + 0x54) ///< Flash Region 0(Flash Descriptor)(32bits)
+#define B_PCH_SPI_FREG0_LIMIT_MASK 0x7FFF0000 ///< Size, [30:16] here represents limit[26:12]
+#define B_PCH_SPI_FREG0_BASE_MASK 0x00007FFF ///< Base, [14:0] here represents base [26:12]
+#define R_PCH_SPI_FREG1_BIOS (R_PCH_RCRB_SPI_BASE + 0x58) ///< Flash Region 1(BIOS)(32bits)
+#define B_PCH_SPI_FREG1_LIMIT_MASK 0x7FFF0000 ///< Size, [30:16] here represents limit[26:12]
+#define B_PCH_SPI_FREG1_BASE_MASK 0x00007FFF ///< Base, [14:0] here represents base [26:12]
+#define R_PCH_SPI_FREG2_ME (R_PCH_RCRB_SPI_BASE + 0x5C) ///< Flash Region 2(ME)(32bits)
+#define B_PCH_SPI_FREG2_LIMIT_MASK 0x7FFF0000 ///< Size, [30:16] here represents limit[26:12]
+#define B_PCH_SPI_FREG2_BASE_MASK 0x00007FFF ///< Base, [14:0] here represents base [26:12]
+#define R_PCH_SPI_FREG3_GBE (R_PCH_RCRB_SPI_BASE + 0x60) ///< Flash Region 3(GbE)(32bits)
+#define B_PCH_SPI_FREG3_LIMIT_MASK 0x7FFF0000 ///< Size, [30:16] here represents limit[26:12]
+#define B_PCH_SPI_FREG3_BASE_MASK 0x00007FFF ///< Base, [14:0] here represents base [26:12]
+#define R_PCH_SPI_FREG4_PLATFORM_DATA (R_PCH_RCRB_SPI_BASE + 0x64) ///< Flash Region 4(Platform Data)(32bits)
+#define B_PCH_SPI_FREG4_LIMIT_MASK 0x7FFF0000 ///< Size, [30:16] here represents limit[26:12]
+#define B_PCH_SPI_FREG4_BASE_MASK 0x00007FFF ///< Base, [14:0] here represents base [26:12]
+#define R_PCH_SPI_PR0 (R_PCH_RCRB_SPI_BASE + 0x74) ///< Protected Region 0 Register
+#define B_PCH_SPI_PR0_WPE BIT31 ///< Write Protection Enable
+#define B_PCH_SPI_PR0_PRL_MASK 0x7FFF0000 ///< Protected Range Limit Mask, [30:16] here represents upper limit of address [26:12]
+#define B_PCH_SPI_PR0_RPE BIT15 ///< Read Protection Enable
+#define B_PCH_SPI_PR0_PRB_MASK 0x00007FFF ///< Protected Range Base Mask, [14:0] here represents base limit of address [26:12]
+#define R_PCH_SPI_PR1 (R_PCH_RCRB_SPI_BASE + 0x78) ///< Protected Region 1 Register
+#define B_PCH_SPI_PR1_WPE BIT31 ///< Write Protection Enable
+#define B_PCH_SPI_PR1_PRL_MASK 0x7FFF0000 ///< Protected Range Limit Mask
+#define B_PCH_SPI_PR1_RPE BIT15 ///< Read Protection Enable
+#define B_PCH_SPI_PR1_PRB_MASK 0x00007FFF ///< Protected Range Base Mask
+#define R_PCH_SPI_PR2 (R_PCH_RCRB_SPI_BASE + 0x7C) ///< Protected Region 2 Register
+#define B_PCH_SPI_PR2_WPE BIT31 ///< Write Protection Enable
+#define B_PCH_SPI_PR2_PRL_MASK 0x7FFF0000 ///< Protected Range Limit Mask
+#define B_PCH_SPI_PR2_RPE BIT15 ///< Read Protection Enable
+#define B_PCH_SPI_PR2_PRB_MASK 0x00007FFF ///< Protected Range Base Mask
+#define R_PCH_SPI_PR3 (R_PCH_RCRB_SPI_BASE + 0x80) ///< Protected Region 3 Register
+#define B_PCH_SPI_PR3_WPE BIT31 ///< Write Protection Enable
+#define B_PCH_SPI_PR3_PRL_MASK 0x7FFF0000 ///< Protected Range Limit Mask
+#define B_PCH_SPI_PR3_RPE BIT15 ///< Read Protection Enable
+#define B_PCH_SPI_PR3_PRB_MASK 0x00007FFF ///< Protected Range Base Mask
+#define R_PCH_SPI_PR4 (R_PCH_RCRB_SPI_BASE + 0x84) ///< Protected Region 4 Register
+#define B_PCH_SPI_PR4_WPE BIT31 ///< Write Protection Enable
+#define B_PCH_SPI_PR4_PRL_MASK 0x7FFF0000 ///< Protected Range Limit Mask
+#define B_PCH_SPI_PR4_RPE BIT15 ///< Read Protection Enable
+#define B_PCH_SPI_PR4_PRB_MASK 0x00007FFF ///< Protected Range Base Mask
+#define R_PCH_SPI_SSFS (R_PCH_RCRB_SPI_BASE + 0x90) ///< Software Sequencing Flash Status Register(8bits)
+#define B_PCH_SPI_SSFS_FRS BIT7 ///< Fast Read Supported
+#define B_PCH_SPI_SSFS_DOFRS BIT6 ///< Dual Output Fast Read Supported
+#define B_PCH_SPI_SSFS_AEL BIT4 ///< Access Error Log
+#define B_PCH_SPI_SSFS_FCERR BIT3 ///< Flash Cycle Error
+#define B_PCH_SPI_SSFS_CDS BIT2 ///< Cycle Done Status
+#define B_PCH_SPI_SSFS_SCIP BIT0 ///< SPI Cycle in Progress
+#define R_PCH_SPI_SSFC (R_PCH_RCRB_SPI_BASE + 0x91) ///< Software Sequencing Flash Control(24bits)
+#define B_PCH_SPI_SSFC_SCF_MASK (BIT18 | BIT17 | BIT16) ///< SPI Cycle Frequency
+#define V_PCH_SPI_SSFC_SCF_20MHZ 0 ///< SPI Cycle Frequency = 20MHz
+#define V_PCH_SPI_SSFC_SCF_33MHZ 1 ///< SPI Cycle Frequency = 33MHz
+#define V_PCH_SPI_SSFC_SCF_50MHZ 4 ///< SPI Cycle Frequency = 50MHz
+#define B_PCH_SPI_SSFC_SME BIT15 ///< SPI SMI# Enable
+#define B_PCH_SPI_SSFC_DS BIT14 ///< SPI Data Cycle
+#define B_PCH_SPI_SSFC_DBC_MASK 0x3F00 ///< SPI Data Byte Count (value here + 1 = count)
+#define B_PCH_SPI_SSFC_COP 0x0070 ///< Cycle Opcode Pointer
+#define B_PCH_SPI_SSFC_SPOP BIT3 ///< Sequence Prefix Opcode Pointer
+#define B_PCH_SPI_SSFC_ACS BIT2 ///< Atomic Cycle Sequence
+#define B_PCH_SPI_SSFC_SCGO BIT1 ///< SPI Cycle Go
+#define R_PCH_SPI_PREOP (R_PCH_RCRB_SPI_BASE + 0x94) ///< Prefix Opcode Configuration Register(16 bits)
+#define B_PCH_SPI_PREOP1_MASK 0xFF00 ///< Prefix Opcode 1 Mask
+#define B_PCH_SPI_PREOP0_MASK 0x00FF ///< Prefix Opcode 0 Mask
+#define R_PCH_SPI_OPTYPE (R_PCH_RCRB_SPI_BASE + 0x96) ///< Opcode Type Configuration
+#define B_PCH_SPI_OPTYPE7_MASK (BIT15 | BIT14) ///< Opcode Type 7 Mask
+#define B_PCH_SPI_OPTYPE6_MASK (BIT13 | BIT12) ///< Opcode Type 6 Mask
+#define B_PCH_SPI_OPTYPE5_MASK (BIT11 | BIT10) ///< Opcode Type 5 Mask
+#define B_PCH_SPI_OPTYPE4_MASK (BIT9 | BIT8) ///< Opcode Type 4 Mask
+#define B_PCH_SPI_OPTYPE3_MASK (BIT7 | BIT6) ///< Opcode Type 3 Mask
+#define B_PCH_SPI_OPTYPE2_MASK (BIT5 | BIT4) ///< Opcode Type 2 Mask
+#define B_PCH_SPI_OPTYPE1_MASK (BIT3 | BIT2) ///< Opcode Type 1 Mask
+#define B_PCH_SPI_OPTYPE0_MASK (BIT1 | BIT0) ///< Opcode Type 0 Mask
+#define V_PCH_SPI_OPTYPE_RDNOADDR 0x00 ///< Read cycle type without address
+#define V_PCH_SPI_OPTYPE_WRNOADDR 0x01 ///< Write cycle type without address
+#define V_PCH_SPI_OPTYPE_RDADDR 0x02 ///< Address required; Read cycle type
+#define V_PCH_SPI_OPTYPE_WRADDR 0x03 ///< Address required; Write cycle type
+#define R_PCH_SPI_OPMENU (R_PCH_RCRB_SPI_BASE + 0x98) ///< Opcode Menu Configuration (64bits)
+#define R_PCH_SPI_FDOC (R_PCH_RCRB_SPI_BASE + 0xB0) ///< Flash Descriptor Observability Control Register(32 bits)
+#define B_PCH_SPI_FDOC_FDSS_MASK (BIT14 | BIT13 | BIT12) ///< Flash Descritor Section Select
+#define V_PCH_SPI_FDOC_FDSS_FSDM 0x0000 ///< Flash Signature and Descriptor Map
+#define V_PCH_SPI_FDOC_FDSS_COMP 0x1000 ///< Component
+#define V_PCH_SPI_FDOC_FDSS_REGN 0x2000 ///< Region
+#define V_PCH_SPI_FDOC_FDSS_MSTR 0x3000 ///< Master
+#define V_PCH_SPI_FDOC_FDSS_PCHS 0x4000 ///< PCH soft straps
+#define V_PCH_SPI_FDOC_FDSS_SFDP 0x5000 ///< SFDP Parameter Table
+#define B_PCH_SPI_FDOC_FDSI_MASK 0x0FFC ///< Flash Descriptor Section Index
+#define R_PCH_SPI_FDOD (R_PCH_RCRB_SPI_BASE + 0xB4) ///< Flash Descriptor Observability Data Register(32 bits)
+#define R_PCH_SPI_AFC (R_PCH_RCRB_SPI_BASE + 0xC0) ///< Additional Flash Control Register
+#define B_PCH_SPI_AFC_INF_DCGE (BIT2 | BIT1) ///< Flash Controller Interface Dynamic Clock Gating Enable
+#define B_PCH_SPI_AFC_CORE_DCGE BIT0 ///< Flash Core Dynamic Clock Gating Enable
+#define R_PCH_SPI_VSCC0 (R_PCH_RCRB_SPI_BASE + 0xC4) ///< Vendor Specific Component Capabilities Register(32 bits)
+#define B_PCH_SPI_VSCC0_CPPTV BIT31 ///< Component Property Parameter Table Valid
+#define B_PCH_SPI_VSCC0_VCL BIT23 ///< Vendor Component Lock
+#define B_PCH_SPI_VSCC0_EO_MASK 0x0000FF00 ///< Erase Opcode
+#define B_PCH_SPI_VSCC0_WEWS BIT4 ///< Write Enable on Write Status
+#define B_PCH_SPI_VSCC0_WSR BIT3 ///< Write Status Required
+#define B_PCH_SPI_VSCC0_WG_64B BIT2 ///< Write Granularity, 0: 1 Byte; 1: 64 Bytes
+#define B_PCH_SPI_VSCC0_BSES_MASK (BIT1 | BIT0) ///< Block/Sector Erase Size
+#define V_PCH_SPI_VSCC0_BSES_256B 0x0 ///< Block/Sector Erase Size = 256 Bytes
+#define V_PCH_SPI_VSCC0_BSES_4K 0x1 ///< Block/Sector Erase Size = 4K Bytes
+#define V_PCH_SPI_VSCC0_BSES_8K 0x2 ///< Block/Sector Erase Szie = 8K Bytes
+#define V_PCH_SPI_VSCC0_BSES_64K 0x3 ///< Block/Sector Erase Size = 64K Bytes
+#define R_PCH_SPI_VSCC1 (R_PCH_RCRB_SPI_BASE + 0xC8) ///< Vendor Specific Component Capabilities Register(32 bits)
+#define B_PCH_SPI_VSCC1_CPPTV BIT31 ///< Component Property Parameter Table Valid
+#define B_PCH_SPI_VSCC1_EO_MASK 0x0000FF00 ///< Erase Opcode
+#define B_PCH_SPI_VSCC1_WEWS BIT4 ///< Write Enable on Write Status
+#define B_PCH_SPI_VSCC1_WSR BIT3 ///< Write Status Required
+#define B_PCH_SPI_VSCC1_WG_64B BIT2 ///< Write Granularity, 0: 1 Byte; 1: 64 Bytes
+#define B_PCH_SPI_VSCC1_BSES_MASK (BIT1 | BIT0) ///< Block/Sector Erase Size
+#define V_PCH_SPI_VSCC1_BSES_256B 0x0 ///< Block/Sector Erase Size = 256 Bytes
+#define V_PCH_SPI_VSCC1_BSES_4K 0x1 ///< Block/Sector Erase Size = 4K Bytes
+#define V_PCH_SPI_VSCC1_BSES_8K 0x2 ///< Block/Sector Erase Size = 8K Bytes
+#define V_PCH_SPI_VSCC1_BSES_64K 0x3 ///< Block/Sector Erase Size = 64K Bytes
+#define R_PCH_SPI_PINTX (R_PCH_RCRB_SPI_BASE + 0xCC) ///< Parameter Table Index
+#define N_PCH_SPI_PINTX_SPT 14
+#define V_PCH_SPI_PINTX_SPT_CPT0 0x0 ///< Component 0 Property Parameter Table
+#define V_PCH_SPI_PINTX_SPT_CPT1 0x1 ///< Component 1 Property Parameter Table
+#define N_PCH_SPI_PINTX_HORD 12
+#define V_PCH_SPI_PINTX_HORD_SFDP 0x0 ///< SFDP Header
+#define V_PCH_SPI_PINTX_HORD_PT 0x1 ///< Parameter Table Header
+#define V_PCH_SPI_PINTX_HORD_DATA 0x2 ///< Data
+#define R_PCH_SPI_PTDATA (R_PCH_RCRB_SPI_BASE + 0xD0) ///< Parameter Table Data
+#define R_PCH_SPI_SRDL (R_PCH_RCRB_SPI_BASE + 0xF0) ///< Soft Reset Data Lock
+#define B_PCH_SPI_SRDL_SSL BIT0 ///< Set_Stap Lock
+#define R_PCH_SPI_SRDC (R_PCH_RCRB_SPI_BASE + 0xF4) ///< Soft Reset Data Control
+#define B_PCH_SPI_SRDC_SRDS BIT0 ///< Soft Reset Data Select
+#define R_PCH_SPI_SRD (R_PCH_RCRB_SPI_BASE + 0xF8) ///< Soft Reset Data
+//
+// @todo Follow up with EDS owner if it should be 3FFF or FFFF.
+//
+#define B_PCH_SPI_SRD_SSD 0x0000FFFF ///< Set_Stap Data
+//
+// Flash Descriptor Base Address Region (FDBAR) from Flash Region 0
+//
+#define R_PCH_SPI_FDBAR_FLVALSIG 0x00 ///< Flash Valid Signature
+#define V_PCH_SPI_FDBAR_FLVALSIG 0x0FF0A55A
+#define R_PCH_SPI_FDBAR_FLASH_MAP0 0x04
+#define B_PCH_SPI_FDBAR_FCBA 0x000000FF ///< Flash Component Base Address
+#define B_PCH_SPI_FDBAR_NC 0x00000300 ///< Number Of Components
+#define N_PCH_SPI_FDBAR_NC 0x08 ///< Number Of Components
+#define V_PCH_SPI_FDBAR_NC_1 0x00000000
+#define V_PCH_SPI_FDBAR_NC_2 0x00000100
+#define B_PCH_SPI_FDBAR_FRBA 0x00FF0000 ///< Flash Region Base Address
+#define B_PCH_SPI_FDBAR_NR 0x07000000 ///< Number Of Regions
+#define R_PCH_SPI_FDBAR_FLASH_MAP1 0x08
+#define B_PCH_SPI_FDBAR_FMBA 0x000000FF ///< Flash Master Base Address
+#define B_PCH_SPI_FDBAR_NM 0x00000700 ///< Number Of Masters
+#define B_PCH_SPI_FDBAR_FPCHSBA 0x00FF0000 ///< Flash PCH Strap Base Address
+#define B_PCH_SPI_FDBAR_PCHSL 0xFF000000 ///< PCH Strap Length
+#define R_PCH_SPI_FDBAR_FLASH_MAP2 0x0C
+#define B_PCH_SPI_FDBAR_FPROSBA 0x000000FF ///< Flash Processor Strap Base Address
+#define B_PCH_SPI_FDBAR_PROSL 0x0000FF00 ///< PROC Strap Length
+//
+// Flash Component Base Address (FCBA) from Flash Region 0
+//
+#define R_PCH_SPI_FCBA_FLCOMP 0x00 ///< Flash Components Register
+#define B_PCH_SPI_FLCOMP_RIDS_FREQ (BIT29 | BIT28 | BIT27) ///< Read ID and Read Status Clock Frequency
+#define B_PCH_SPI_FLCOMP_WE_FREQ (BIT26 | BIT25 | BIT24) ///< Write and Erase Clock Frequency
+#define B_PCH_SPI_FLCOMP_FRCF_FREQ (BIT23 | BIT22 | BIT21) ///< Fast Read Clock Frequency
+#define B_PCH_SPI_FLCOMP_FR_SUP BIT20 ///< Fast Read Support.
+#define B_PCH_SPI_FLCOMP_RC_FREQ (BIT19 | BIT18 | BIT17) ///< Read Clock Frequency.
+#define V_PCH_SPI_FLCOMP_FREQ_20MHZ 0x00
+#define V_PCH_SPI_FLCOMP_FREQ_33MHZ 0x01
+#define V_PCH_SPI_FLCOMP_FREQ_50MHZ 0x04
+#define B_PCH_SPI_FLCOMP_COMP2_MASK 0xF0 ///< Flash Component 2 Size MASK
+#define V_PCH_SPI_FLCOMP_COMP2_512KB 0x00
+#define V_PCH_SPI_FLCOMP_COMP2_1MB 0x10
+#define V_PCH_SPI_FLCOMP_COMP2_2MB 0x20
+#define V_PCH_SPI_FLCOMP_COMP2_4MB 0x30
+#define V_PCH_SPI_FLCOMP_COMP2_8MB 0x40
+#define V_PCH_SPI_FLCOMP_COMP2_16MB 0x50
+#define V_PCH_SPI_FLCOMP_COMP2_32MB 0x60
+#define V_PCH_SPI_FLCOMP_COMP2_64MB 0x70
+#define B_PCH_SPI_FLCOMP_COMP1_MASK 0x0F ///< Flash Component 1 Size MASK
+#define V_PCH_SPI_FLCOMP_COMP1_512KB 0x00
+#define V_PCH_SPI_FLCOMP_COMP1_1MB 0x01
+#define V_PCH_SPI_FLCOMP_COMP1_2MB 0x02
+#define V_PCH_SPI_FLCOMP_COMP1_4MB 0x03
+#define V_PCH_SPI_FLCOMP_COMP1_8MB 0x04
+#define V_PCH_SPI_FLCOMP_COMP1_16MB 0x05
+#define V_PCH_SPI_FLCOMP_COMP1_32MB 0x06
+#define V_PCH_SPI_FLCOMP_COMP1_64MB 0x07
+#define V_PCH_SPI_FLCOMP_COMP_512KB 0x80000
+//
+// Descriptor Upper Map Section from Flash Region 0
+//
+#define R_PCH_SPI_FLASH_UMAP1 0xEFC ///< Flash Upper Map 1
+#define B_PCH_SPI_FLASH_UMAP1_VTBA 0x000000FF ///< VSCC Table Base Address
+#define B_PCH_SPI_FLASH_UMAP1_VTL 0x0000FF00 ///< VSCC Table Length
+
+#define R_PCH_SPI_VTBA_JID0 0x00 ///< JEDEC-ID 0 Register
+#define S_PCH_SPI_VTBA_JID0 0x04
+#define B_PCH_SPI_VTBA_JID0_VID 0x000000FF
+#define B_PCH_SPI_VTBA_JID0_DID0 0x0000FF00
+#define B_PCH_SPI_VTBA_JID0_DID1 0x00FF0000
+#define N_PCH_SPI_VTBA_JID0_DID0 0x08
+#define N_PCH_SPI_VTBA_JID0_DID1 0x10
+#define R_PCH_SPI_VTBA_VSCC0 0x04
+#define S_PCH_SPI_VTBA_VSCC0 0x04
+#define R_PCH_SPI_STRP0 0x0 ///< PCH soft strap 0
+#define B_PCH_SPI_STRP0_BBBS (BIT31 |BIT30 | BIT29) ///< BIOS Boot-Block size
+#define B_PCH_SPI_STRP0_BBBS_64KB 0x00
+#define B_PCH_SPI_STRP0_BBBS_128KB BIT29
+#define B_PCH_SPI_STRP0_BBBS_256KB BIT30
+#define B_PCH_SPI_STRP0_BBBS_512KB (BIT30 | BIT29)
+#define B_PCH_SPI_STRP0_BBBS_1MB BIT31
+#define B_PCH_SPI_STRP0_DMI_REQID_DIS BIT24 ///< DMI RequesterID Check Disable
+#define B_PCH_SPI_STRP0_CFG_STRP1 BIT21 ///< Chipset configuration Softstrap 1
+#define B_PCH_SPI_STRP0_LAN_GP12_SEL BIT20 ///< LAN PHY Power Control GPIO12 Select
+#define B_PCH_SPI_STRP0_SML0FRQ (BIT15 | BIT14) ///< SMLink0 Frequency
+#define B_PCH_SPI_STRP0_SMB0FRQ (BIT13 | BIT12) ///< Intel ME SMBus Frequency
+#define B_PCH_SPI_STRP0_SML1FRQ (BIT11 | BIT10) ///< SMLink1 Frequency
+#define B_PCH_SPI_STRP0_SML1_EN BIT9 ///< SMLink1 Enable
+#define B_PCH_SPI_STRP0_SML0_EN BIT8 ///< SMLink0 Enable
+#define B_PCH_SPI_STRP0_SMB_EN BIT7 ///< Intel ME SMBus Select
+#define B_PCH_SPI_STRP0_CFG_STRP2 BIT1 ///< Chipset configuration Softstrap 2
+#define R_PCH_SPI_STRP1 0x04 ///< PCH soft strap 1
+#define B_PCH_SPI_STRP1_CFG_STRP3 0x0F ///< Chipset configuration Softstrap 3
+#define R_PCH_SPI_STRP2 0x08 ///< PCH soft strap 2
+#define B_PCH_SPI_STRP2_MESMA 0xFE000000 ///< ME SMBus Address
+#define B_PCH_SPI_STRP2_MESMI2CEN BIT24 ///< ME SMBus Address Enable
+#define B_PCH_SPI_STRP2_MESMASDA 0xFE00 ///< ME SMBus Alert Sending Device Address
+#define B_PCH_SPI_STRP2_MESMASDEN BIT8 ///< ME SMBus Alert Sending Device Address Enable
+#define R_PCH_SPI_STRP3 0x0C ///< PCH soft strap 3
+#define R_PCH_SPI_STRP4 0x10 ///< PCH soft strap 4
+#define B_PCH_SPI_STRP4_GBEPHYSMA 0xFE0000 ///< GbE PHY SMBus Address
+#define B_PCH_SPI_STRP4_GBEMACSMA 0xFE00 ///< GbE MAC SMBus Address
+#define B_PCH_SPI_STRP4_GBEMACSMAEN BIT8 ///< Gbe MAC SMBus Address Enable
+#define B_PCH_SPI_STRP4_PHYCON (BIT1 | BIT0) ///< Intel PHY Connectivity
+#define B_PCH_SPI_STRP4_NO_PHYCON 0x00
+#define B_PCH_SPI_STRP4_PHY_ON 0x02
+#define R_PCH_SPI_STRP5 0x14 ///< PCH soft strap 5
+#define R_PCH_SPI_STRP6 0x18 ///< PCH soft strap 6
+#define R_PCH_SPI_STRP7 0x1C ///< PCH soft strap 7
+#define B_PCH_SPI_STRP7_MESMASVID 0xFFFFFFFF ///< ME SMBus Subsystem Vendor and Device ID
+#define R_PCH_SPI_STRP8 0x20 ///< PCH soft strap 8
+#define R_PCH_SPI_STRP9 0x24 ///< PCH soft strap 9
+#define B_PCH_SPI_STRP9_HOT_SML1_SEL BIT22 ///< PCHHOT# or SML1AlERT# Select (0:SML1ALERT#; 1:PCHHOT#)
+#define B_PCH_SPI_STRP9_PCIE_SBDE_EN BIT14 ///< Subtractive Decode over PCI Express Enabling
+#define N_PCH_SPI_STRP9_PCIE_SBDE_EN 14
+#define B_PCH_SPI_STRP9_GBE_PCIE_EN BIT11 ///< GbE over PCI Express Enabling
+#define B_PCH_SPI_STRP9_GBE_PCIE_PSC (BIT8 | BIT9 | BIT10) ///< GbE PCI E Port Select
+#define N_PCH_SPI_STRP9_GBE_PCIE_PSC 8
+#define B_PCH_SPI_STRP9_DMILR BIT6 ///< DMI Lane Reversal
+#define B_PCH_SPI_STRP9_PCIELR2 BIT5 ///< PCIe Lane Reversal 2
+#define B_PCH_SPI_STRP9_PCIELR1 BIT4 ///< PCIe Lane Reversal 1
+#define B_PCH_SPI_STRP9_PCIEPCS2 BIT3 | BIT2 ///< PCI Express Port Configuration Strap 2
+#define B_PCH_SPI_STRP9_PCIEPCS1 BIT1 | BIT0 ///< PCI Express Port Configuration Strap 1
+#define V_PCH_SPI_STRP9_PCIEPCS_1x4 0x03 ///< 1x4 Port 1/5 (x4), Ports 2-4/6-8 (disabled)
+#define V_PCH_SPI_STRP9_PCIEPCS_2x2 0x02 ///< 2x2 Port 1/5 (x2), Port 3/7 (x2), Ports 2,4/6,8 (disabled)
+#define V_PCH_SPI_STRP9_PCIEPCS_1x2 0x01 ///< 1x2, 2x1 Port 1/5 (x2), Port 2/6 (disabled), Ports 3,4/7,8 (x1)
+#define V_PCH_SPI_STRP9_PCIEPCS_4x1 0x00 ///< 4x1 Ports 1-4/5-8 (x1)
+#define R_PCH_SPI_STRP10 0x28 ///< PCH soft strap 10
+#define B_PCH_SPI_STRP10_MER_CL1 BIT21 ///< ME Reset Capture on CL_RST1
+#define B_PCH_SPI_STRP10_ICC_SEL 0x1C0000 ///< Integrated Clocking Configuration Select
+#define B_PCH_SPI_STRP10_CFG_STRP7 BIT16 ///< Chipset Configuration Softstrap 7
+#define B_PCH_SPI_STRP10_MMADDR 0xFE00 ///< ME Memory-attached Debug Display Device Address
+#define B_PCH_SPI_STRP10_MMDDE BIT8 ///< ME Memory-attached Debug Display Device Enable
+#define B_PCH_SPI_STRP10_VE_EN BIT3 ///< 0 - VE disabled; 1 - VE enabled
+#define B_PCH_SPI_STRP10_CFG_STRP5 BIT2 ///< Chipset Configuration Softstrap 5
+#define B_PCH_SPI_STRP10_ME_BFlash BIT1 ///< ME from Boot Flash
+#define R_PCH_SPI_STRP11 0x2C ///< PCH soft strap 11
+#define B_PCH_SPI_STRP11_SML1I2CA 0xFE000000 ///< SMLink1 I2C Target Address
+#define B_PCH_SPI_STRP11_SML1I2CAEN BIT24 ///< SMLink1 I2C Target Address Enable
+#define B_PCH_SPI_STRP11_SML1GPA 0xE ///< SMLink1 GP Address
+#define B_PCH_SPI_STRP11_SML1GPAEN BIT0 ///< SMLink1 GP Address Enable
+#define R_PCH_SPI_STRP12 0x30
+#define R_PCH_SPI_STRP13 0x34
+#define R_PCH_SPI_STRP14 0x38
+#define R_PCH_SPI_STRP15 0x3C
+#define R_PCH_SPI_STRP15_SML1_THRMSEL BIT14 ///< SMLink1 Thermal Reporting Select
+#define B_PCH_SPI_STRP15_T209MIN (BIT9 | BIT8) ///< T209 min Timing
+#define B_PCH_SPI_STRP15_IWL_EN BIT6 ///< Intel integrated wired LAN Enable
+#define B_PCH_SPI_STRP15_CFG_STRP6 (BIT4 | BIT3) ///< Chipset Configuration Softstrap 6
+#define R_PCH_SPI_STRP17 0x44 ///< PCH Soft strap 17
+#define B_PCH_SPI_STRP17_CLK_MODE BIT0 ///< Integrated Clock mode select
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsThermal.h b/ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsThermal.h
new file mode 100644
index 0000000..b94d1ed
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsThermal.h
@@ -0,0 +1,100 @@
+/** @file
+ Register names for PCH Thermal Device
+
+ Conventions:
+
+ - Prefixes:
+ Definitions beginning with "R_" are registers
+ Definitions beginning with "B_" are bits within registers
+ Definitions beginning with "V_" are meaningful values of bits within the registers
+ Definitions beginning with "S_" are register sizes
+ Definitions beginning with "N_" are the bit position
+ - In general, PCH registers are denoted by "_PCH_" in register names
+ - Registers / bits that are different between PCH generations are denoted by
+ "_PCH_<generation_name>_" in register/bit names. e.g., "_PCH_LPT_"
+ - Registers / bits that are different between SKUs are denoted by "_<SKU_name>"
+ at the end of the register/bit names
+ - Registers / bits of new devices introduced in a PCH generation will be just named
+ as "_PCH_" without <generation_name> inserted.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PCH_REGS_THERMAL_H_
+#define _PCH_REGS_THERMAL_H_
+
+//
+// Thermal Device Registers (D31:F6)
+//
+#define PCI_DEVICE_NUMBER_PCH_THERMAL 31
+#define PCI_FUNCTION_NUMBER_PCH_THERMAL 6
+#define R_PCH_THERMAL_VENDOR_ID 0x00
+#define V_PCH_THERMAL_VENDOR_ID V_PCH_INTEL_VENDOR_ID
+#define R_PCH_THERMAL_DEVICE_ID 0x02
+#define V_PCH_LPTH_THERMAL_DEVICE_ID 0x8C24
+#define V_PCH_LPTLP_THERMAL_DEVICE_ID 0x9C24
+#define R_PCH_THERMAL_COMMAND 0x04
+#define B_PCH_THERMAL_COMMAND_MSE BIT1
+#define B_PCH_THERMAL_COMMAND_BME BIT2
+#define R_PCH_THERMAL_TBAR 0x10
+#define V_PCH_THERMAL_TBAR_SIZE (4 * 1024)
+#define N_PCH_THREMAL_TBAR_ALIGNMENT 12
+#define B_PCH_THERMAL_TBAR_MASK 0xFFFFF000
+#define R_PCH_THERMAL_TBARH 0x14
+#define R_PCH_THERMAL_SVID 0x2C
+#define R_PCH_THERMAL_INTLN 0x3C
+#define R_PCH_THERMAL_TBARB 0x40
+#define V_PCH_THERMAL_TBARB_SIZE (4 * 1024)
+#define N_PCH_THREMAL_TBARB_ALIGNMENT 12
+#define B_PCH_THERMAL_SPTYPEN BIT0
+#define R_PCH_THERMAL_TBARBH 0x44
+#define B_PCH_THERMAL_TBARB_MASK 0xFFFFF000
+
+#define R_PCH_TBARB_TSC 0x04
+#define B_PCH_TBARB_TSC_PLD BIT7
+#define B_PCH_TBARB_TSC_CPDE BIT0
+#define R_PCH_TBARB_TSS 0x06
+#define R_PCH_TBARB_TSEL 0x08
+#define B_PCH_TBARB_TSEL_PLD BIT7
+#define B_PCH_TBARB_TSEL_ETS BIT0
+#define R_PCH_TBARB_TSREL 0x0A
+#define R_PCH_TBARB_TSMIC 0x0C
+#define B_PCH_TBARB_TSMIC_PLD BIT7
+#define B_PCH_TBARB_TSMIC_SMIE BIT0
+#define R_PCH_TBARB_CTT 0x10
+#define V_PCH_TBARB_CTT_LPTH 0x154
+#define V_PCH_TBARB_CTT_LPTLP 0x14A
+#define R_PCH_TBARB_TAHV 0x14
+#define R_PCH_TBARB_TALV 0x18
+#define R_PCH_TBARB_TSPM 0x1C
+#define B_PCH_TBARB_TSPM_LTT (BIT8 | BIT7 | BIT6 | BIT5 | BIT4 | BIT3 | BIT2 | BIT1 | BIT0)
+#define V_PCH_TBARB_TSPM_LTT 0x0C8
+#define B_PCH_TBARB_TSPM_MAXTSST (BIT11 | BIT10 | BIT9)
+#define V_PCH_TBARB_TSPM_MAXTSST (0x4 << 9)
+#define B_PCH_TBARB_TSPM_MINTSST BIT12
+#define B_PCH_TBARB_TSPM_DTSSIC0 BIT13
+#define B_PCH_TBARB_TSPM_DTSSS0EN BIT14
+#define B_PCH_TBARB_TSPM_TSPMLOCK BIT15
+#define R_PCH_TBARB_TL 0x40
+#define B_PCH_TBARB_TL_LOCK BIT31
+#define R_PCH_TBARB_PHL 0x60
+#define B_PCH_TBARB_PHLE BIT15
+#define R_PCH_TBARB_PHLC 0x62
+#define R_PCH_TBARB_TAS 0x80
+#define R_PCH_TBARB_TSPIEN 0x82
+#define R_PCH_TBARB_TSGPEN 0x84
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsUsb.h b/ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsUsb.h
new file mode 100644
index 0000000..12eaa9d
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Include/PchRegs/PchRegsUsb.h
@@ -0,0 +1,563 @@
+/** @file
+ Register names for PCH USB devices
+
+ Conventions:
+
+ - Prefixes:
+ Definitions beginning with "R_" are registers
+ Definitions beginning with "B_" are bits within registers
+ Definitions beginning with "V_" are meaningful values of bits within the registers
+ Definitions beginning with "S_" are register sizes
+ Definitions beginning with "N_" are the bit position
+ - In general, PCH registers are denoted by "_PCH_" in register names
+ - Registers / bits that are different between PCH generations are denoted by
+ "_PCH_<generation_name>_" in register/bit names. e.g., "_PCH_LPT_"
+ - Registers / bits that are different between SKUs are denoted by "_<SKU_name>"
+ at the end of the register/bit names
+ - Registers / bits of new devices introduced in a PCH generation will be just named
+ as "_PCH_" without <generation_name> inserted.
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PCH_REGS_USB_H_
+#define _PCH_REGS_USB_H_
+
+//
+// USB Definitions
+//
+#define LPTH_USB_MAX_PHYSICAL_PORTS 14 ///< Max Physical Connector EHCI + XHCI, not counting virtual ports like USB-R.
+#define LPTH_EHCI_MAX_CONTROLLERS 2 ///< Max EHCI Controllers
+#define LPTH_EHCI_MAX_PORTS 14 ///< Counting ports behind RMHs 8 from EHCI-1 and 6 from EHCI-2, not counting EHCI USB-R virtual ports.
+#define LPTH_XHCI_MAX_USB2_PORTS 15 ///< 14 High Speed lanes + Including one port reserved for USBr
+#define LPTH_XHCI_MAX_USB3_PORTS 6 ///< 6 Super Speed lanes
+#define LPTLP_USB_MAX_PHYSICAL_PORTS 8 ///< Max Physical Connector EHCI + XHCI, not counting virtual ports like USB-R.
+#define LPTLP_EHCI_MAX_PORTS 8 ///< Counting ports behind RMHs 8 from EHCI-1 and 6 from EHCI-2, not counting EHCI USB-R virtual ports.
+#define LPTLP_EHCI_MAX_CONTROLLERS 1 ///< Max EHCI Controllers
+#define LPTLP_XHCI_MAX_USB2_PORTS 9 ///< 8 High Speed lanes + Including one port reserved for USBr
+#define LPTLP_XHCI_MAX_USB3_PORTS 4 ///< 4 Super Speed lanes
+
+#define R_PCH_USB_VENDOR_ID 0x00
+#define V_PCH_USB_VENDOR_ID V_PCH_INTEL_VENDOR_ID
+#define R_PCH_USB_DEVICE_ID 0x02
+#define V_PCH_LPTH_USB_DEVICE_ID_EHCI_1 0x8C26 ///< LPT EHCI#1
+#define V_PCH_LPTH_USB_DEVICE_ID_EHCI_2 0x8C2D ///< LPT EHCI#2
+#define V_PCH_LPTH_USB_DEVICE_ID_XHCI_1 0x8C31 ///< LPT XHCI#1
+#define V_PCH_LPTLP_USB_DEVICE_ID_EHCI_1 0x9C26 ///< LPTLP EHCI#1
+#define V_PCH_LPTLP_USB_DEVICE_ID_XHCI_1 0x9C31 ///< LPTLP XHCI#1
+
+//
+// USB2 (EHCI) related definitions
+//
+typedef enum {
+ PchEhci1 = 0,
+ PchEhci2,
+ PchEhciControllerMax
+} PCH_USB20_CONTROLLER_TYPE;
+
+#define PCI_DEVICE_NUMBER_PCH_USB 29
+#define PCI_FUNCTION_NUMBER_PCH_EHCI 0
+
+#define PCI_DEVICE_NUMBER_PCH_USB_EXT 26
+#define PCI_FUNCTION_NUMBER_PCH_EHCI2 0
+
+//
+// EHCI PCI Config Space registers
+//
+#define R_PCH_EHCI_COMMAND_REGISTER 0x04
+#define B_PCH_EHCI_COMMAND_INTR_DIS BIT10
+#define B_PCH_EHCI_COMMAND_FBE BIT9
+#define B_PCH_EHCI_COMMAND_SERR_EN BIT8
+#define B_PCH_EHCI_COMMAND_WCC BIT7
+#define B_PCH_EHCI_COMMAND_PER BIT6
+#define B_PCH_EHCI_COMMAND_VPS BIT5
+#define B_PCH_EHCI_COMMAND_PMWE BIT4
+#define B_PCH_EHCI_COMMAND_SCE BIT3
+#define B_PCH_EHCI_COMMAND_BME BIT2
+#define B_PCH_EHCI_COMMAND_MSE BIT1
+#define B_PCH_EHCI_COMMAND_IOSE BIT0
+
+#define R_PCH_EHCI_PCISTS 0x06
+#define B_PCH_EHCI_PCISTS_DPE BIT15
+#define B_PCH_EHCI_PCISTS_SSE BIT14
+#define B_PCH_EHCI_PCISTS_RMA BIT13
+#define B_PCH_EHCI_PCISTS_RTA BIT12
+#define B_PCH_EHCI_PCISTS_STA BIT11
+#define B_PCH_EHCI_PCISTS_DEV_STS (BIT10 | BIT9)
+#define B_PCH_EHCI_PCISTS_DPED BIT8
+#define B_PCH_EHCI_PCISTS_FB2BC BIT7
+#define B_PCH_EHCI_PCISTS_UDF BIT6
+#define B_PCH_EHCI_PCISTS_66MHZ_CAP BIT5
+#define B_PCH_EHCI_PCISTS_CAP_LST BIT4
+#define B_PCH_EHCI_PCISTS_INTR_STS BIT3
+
+#define R_PCH_EHCI_RID 0x08
+#define B_PCH_EHCI_RID 0xFF
+#define R_PCH_EHCI_PI 0x09
+#define B_PCH_EHCI_PI 0xFF
+#define R_PCH_EHCI_SCC 0x0A
+#define B_PCH_EHCI_SCC 0xFF
+#define R_PCH_EHCI_BCC 0x0B
+#define B_PCH_EHCI_BCC 0xFF
+#define R_PCH_EHCI_MLT 0x0D
+#define B_PCH_EHCI_MLT 0xFF
+#define R_PCH_EHCI_HEADTYPE 0x0E
+#define B_PCH_EHCI_HEADTYPE 0xFF
+#define R_PCH_EHCI_MEM_BASE 0x10
+#define V_PCH_EHCI_MEM_LENGTH 0x400
+#define N_PCH_EHCI_MEM_ALIGN 10
+#define R_PCH_EHCI_SVID 0x2C
+#define B_PCH_EHCI_SVID 0xFFFF
+#define R_PCH_EHCI_SID 0x2E
+#define B_PCH_EHCI_SID 0xFFFF
+#define R_PCH_EHCI_CAP_PTR 0x34
+#define B_PCH_EHCI_CAP_PTR 0xFF
+#define R_PCH_EHCI_INT_LN 0x3C
+#define B_PCH_EHCI_INT_LN 0xFF
+#define R_PCH_EHCI_INT_PN 0x3D
+#define B_PCH_EHCI_INT_PN 0xFF
+#define R_PCH_EHCI_IHFCLK 0x44
+#define B_PCH_EHCI_IHFCLK 0xFFFFFFFF
+#define R_PCH_EHCI_IHFCLKC 0x48
+#define B_PCH_EHCI_IHFCLKC 0xFFFFFFFF
+#define R_PCH_EHCI_PWR_CAPID 0x50
+#define B_PCH_EHCI_PWR_CAPID 0xFF
+#define R_PCH_EHCI_NXT_PTR1 0x51
+#define B_PCH_EHCI_NXT_PTR1 0xFF
+#define R_PCH_EHCI_PWR_CAP 0x52
+#define B_PCH_EHCI_PWR_CAP_PME_SUP 0xF800
+#define B_PCH_EHCI_PWR_CAP_D2_SUP BIT10
+#define B_PCH_EHCI_PWR_CAP_D1_SUP BIT9
+#define B_PCH_EHCI_PWR_CAP_AUX_CUR (BIT8 | BIT7 | BIT6)
+#define B_PCH_EHCI_PWR_CAP_DSI BIT5
+#define B_PCH_EHCI_PWR_CAP_PME_CLK BIT3
+#define B_PCH_EHCI_PWR_CAP_VER (BIT2 | BIT1 | BIT0)
+#define R_PCH_EHCI_PWR_CNTL_STS 0x54
+#define B_PCH_EHCI_PWR_CNTL_STS_PME_STS BIT15
+#define B_PCH_EHCI_PWR_CNTL_STS_DATASCL (BIT14 | BIT13)
+#define B_PCH_EHCI_PWR_CNTL_STS_DATASEL (BIT12 | BIT11 | BIT10 | BIT9)
+#define B_PCH_EHCI_PWR_CNTL_STS_PME_EN BIT8
+#define B_PCH_EHCI_PWR_CNTL_STS_NO_SOFT_RESET BIT3
+#define B_PCH_EHCI_PWR_CNTL_STS_PWR_STS (BIT1 | BIT0)
+#define V_PCH_EHCI_PWR_CNTL_STS_PWR_STS_D3 (BIT1 | BIT0)
+#define R_PCH_EHCI_DBG_CAPID 0x58
+#define B_PCH_EHCI_DBG_CAPID 0xFF
+#define R_PCH_EHCI_NXT_PTR2 0x59
+#define B_PCH_EHCI_NXT_PTR2 0xFF
+#define R_PCH_EHCI_DBG_BASE 0x5A
+#define B_PCH_EHCI_DBG_BASE_BAR_NUM 0xE000
+#define B_PCH_EHCI_DBG_BASE_PORT_OFFSET 0x1FFF
+#define R_PCH_EHCI_USB_RELNUM 0x60
+#define B_PCH_EHCI_USB_RELNUM 0xFF
+#define R_PCH_EHCI_FL_ADJ 0x61
+#define B_PCH_EHCI_FL_ADJ 0x3F
+#define R_PCH_EHCI_PWAKE_CAP 0x62
+#define B_PCH_EHCI_PWAKE_CAP_D29_MASK 0x01FE
+#define B_PCH_EHCI_PWAKE_CAP_D26_MASK 0x007E
+#define B_PCH_EHCI_PWAKE_CAP_PWK_IMP BIT0
+#define R_PCH_EHCI_PDO 0x64
+#define B_PCH_EHCI_PDO_DIS_PORT0 BIT0
+#define B_PCH_EHCI_PDO_D29_MASK 0xFF
+#define B_PCH_EHCI_PDO_D26_MASK 0x3F
+#define R_PCH_EHCI_RMHDEVR 0x66
+#define B_PCH_EHCI_RMHDEVR_D29_MASK 0x01FE
+#define B_PCH_EHCI_RMHDEVR_D26_MASK 0x007E
+#define R_PCH_EHCI_LEGEXT_CAP 0x68
+#define B_PCH_EHCI_LEGEXT_CAP_HCOS BIT24
+#define B_PCH_EHCI_LEGEXT_CAP_HCBIOS BIT16
+#define B_PCH_EHCI_LEGEXT_CAP_NEXT 0x0000FF00
+#define B_PCH_EHCI_LEGEXT_CAP_CAPID 0x000000FF
+#define R_PCH_EHCI_LEGEXT_CS 0x6C
+#define B_PCH_EHCI_LEGEXT_CS_SMIBAR BIT31
+#define B_PCH_EHCI_LEGEXT_CS_SMIPCI BIT30
+#define B_PCH_EHCI_LEGEXT_CS_SMIOS BIT29
+#define B_PCH_EHCI_LEGEXT_CS_SMIAA BIT21
+#define B_PCH_EHCI_LEGEXT_CS_SMIHSE BIT20
+#define B_PCH_EHCI_LEGEXT_CS_SMIFLR BIT19
+#define B_PCH_EHCI_LEGEXT_CS_SMIPCD BIT18
+#define B_PCH_EHCI_LEGEXT_CS_SMIERR BIT17
+#define B_PCH_EHCI_LEGEXT_CS_SMICOMP BIT16
+#define B_PCH_EHCI_LEGEXT_CS_SMIBAR_EN BIT15
+#define B_PCH_EHCI_LEGEXT_CS_SMIPCI_EN BIT14
+#define B_PCH_EHCI_LEGEXT_CS_SMIOS_EN BIT13
+#define B_PCH_EHCI_LEGEXT_CS_SMIAA_EN BIT5
+#define B_PCH_EHCI_LEGEXT_CS_SMIHSE_EN BIT4
+#define B_PCH_EHCI_LEGEXT_CS_SMIFLR_EN BIT3
+#define B_PCH_EHCI_LEGEXT_CS_SMIPCD_EN BIT2
+#define B_PCH_EHCI_LEGEXT_CS_SMIERR_EN BIT1
+#define B_PCH_EHCI_LEGEXT_CS_SMICOMP_EN BIT0
+#define R_PCH_EHCI_SPCSMI 0x70
+#define B_PCH_EHCI_SPCSMI_D29 0x3FC00000
+#define B_PCH_EHCI_SPCSMI_D26 0x0FC00000
+#define B_PCH_EHCI_SPCSMI_PMCSR BIT21
+#define B_PCH_EHCI_SPCSMI_ASYNC BIT20
+#define B_PCH_EHCI_SPCSMI_PERIODIC BIT19
+#define B_PCH_EHCI_SPCSMI_CF BIT18
+#define B_PCH_EHCI_SPCSMI_HCHALT BIT17
+#define B_PCH_EHCI_SPCSMI_HCRESET BIT16
+#define B_PCH_EHCI_SPCSMI_PO_EN 0x00003FC0
+#define B_PCH_EHCI_SPCSMI_PMCSR_EN BIT5
+#define B_PCH_EHCI_SPCSMI_ASYNC_EN BIT4
+#define B_PCH_EHCI_SPCSMI_PERIODIC_EN BIT3
+#define B_PCH_EHCI_SPCSMI_CF_EN BIT2
+#define B_PCH_EHCI_SPCSMI_HCHALT_EN BIT1
+#define B_PCH_EHCI_SPCSMI_HCRESET_EN BIT0
+#define R_PCH_EHCI_OCMAP 0x74
+#define R_PCH_EHCI_RMHWKCTL 0x7E
+#define R_PCH_EHCI_ACCESS_CNTL 0x80
+#define B_PCH_EHCI_ACCESS_CNTL_ENABLE BIT0
+#define V_PCH_EHCI_ACCESS_CNTL_ENABLE 0x01
+#define R_PCH_EHCI_FLR_CID 0x98
+#define B_PCH_EHCI_FLR_CID 0xFF
+#define V_PCH_EHCI_FLR_CID_13 0x13
+#define V_PCH_EHCI_FLR_CID_09 0x09
+#define R_PCH_EHCI_FLR_NEXT 0x99
+#define B_PCH_EHCI_FLR_NEXT 0xFF
+#define R_PCH_EHCI_FLR_CLV 0x9A
+#define B_PCH_EHCI_FLR_CLV_CAP_SSEL0 BIT9
+#define B_PCH_EHCI_FLR_CLV_TXP_SSEL0 BIT8
+#define B_PCH_EHCI_FLR_CLV_VSCID_SSEL1 0xF000
+#define B_PCH_EHCI_FLR_CLV_CAPVER_SSEL1 0x0F00
+#define B_PCH_EHCI_FLR_CLV_LNG 0x00FF
+#define R_PCH_EHCI_FLR_CTRL 0x9C
+#define B_PCH_EHCI_FLR_CTRL_INITFLR BIT0
+#define R_PCH_EHCI_FLR_STS 0x9D
+#define B_PCH_EHCI_FLR_STS_TXP BIT0
+
+//
+// EHCI MMIO registers
+//
+#define R_PCH_EHCI_HCSPARAMS 0x04
+#define N_PCH_EHCI_HCSPARAMS_DP_N 20
+#define N_PCH_EHCI_HCSPARAMS_N_CC 12
+#define N_PCH_EHCI_HCSPARAMS_N_PCC 8
+#define N_PCH_EHCI_HCSPARAMS_N_PORTS 0
+#define R_PCH_EHCI_USB2CMD 0x20
+#define B_PCH_EHCI_USB2CMD_ASE BIT5
+#define B_PCH_EHCI_USB2CMD_PSE BIT4
+#define B_PCH_EHCI_USB2CMD_HCRESET BIT1
+#define B_PCH_EHCI_USB2CMD_RS BIT0
+#define R_PCH_EHCI_USB2STS 0x24
+#define B_PCH_EHCI_USB2STS_HCHALTED BIT12
+#define R_PCH_EHCI_CONFIGFLAG 0x60
+#define R_PCH_EHCI_PORTSC0 0x64
+#define R_PCH_EHCI_PORTSC0_SUSPEND BIT7
+#define R_PCH_EHCI_PORTSC0_PORT_EN_DIS BIT2
+#define B_PCH_EHCI_PORTSC0_CHANGE_ENABLE_MASK (0x2A | R_PCH_EHCI_PORTSC0_PORT_EN_DIS) ///< Mask all change bits and port enabled
+#define B_PCH_EHCI_PORTSC0_RESET BIT8
+
+//
+// USB3 (XHCI) related definitions
+//
+#define PCI_DEVICE_NUMBER_PCH_XHCI 20
+#define PCI_FUNCTION_NUMBER_PCH_XHCI 0
+
+//
+// XHCI PCI Config Space registers
+//
+#define R_PCH_XHCI_COMMAND_REGISTER 0x04
+#define B_PCH_XHCI_COMMAND_BME BIT2
+#define B_PCH_XHCI_COMMAND_MSE BIT1
+#define R_PCH_XHCI_MEM_BASE 0x10
+#define V_PCH_XHCI_MEM_LENGTH 0x3000
+#define N_PCH_XHCI_MEM_ALIGN 16
+#define R_PCH_XHCI_SVID 0x2C
+#define B_PCH_XHCI_SVID 0xFFFF
+#define R_PCH_XHCI_SID 0x2E
+#define B_PCH_XHCI_SID 0xFFFF
+
+#define R_PCH_XHCI_XHCC1 0x40
+#define B_PCH_XHCI_XHCC1_ACCTRL BIT31
+#define B_PCH_XHCI_XHCC1_RMTASERR BIT24
+#define B_PCH_XHCI_XHCC1_URD BIT23
+#define B_PCH_XHCI_XHCC1_URRE BIT22
+#define B_PCH_XHCI_XHCC1_IIL1E (BIT21 | BIT20 | BIT19)
+#define V_PCH_XHCI_XHCC1_IIL1E_DIS 0
+#define V_PCH_XHCI_XHCC1_IIL1E_32 (BIT19)
+#define V_PCH_XHCI_XHCC1_IIL1E_64 (BIT20)
+#define V_PCH_XHCI_XHCC1_IIL1E_128 (BIT20 | BIT19)
+#define V_PCH_XHCI_XHCC1_IIL1E_256 (BIT21)
+#define V_PCH_XHCI_XHCC1_IIL1E_512 (BIT21 | BIT19)
+#define V_PCH_XHCI_XHCC1_IIL1E_1024 (BIT21 | BIT20)
+#define V_PCH_XHCI_XHCC1_IIL1E_131072 (BIT21 | BIT20 | BIT19)
+#define B_PCH_XHCI_XHCC1_XHCIL1E BIT18
+#define B_PCH_XHCI_XHCC1_D3IL1E BIT17
+#define B_PCH_XHCI_XHCC1_UNPPA (BIT16 | BIT15 | BIT14 | BIT13 | BIT12)
+#define B_PCH_XHCI_XHCC1_SWAXHCI BIT11
+#define B_PCH_XHCI_XHCC1_L23HRAWC (BIT10 | BIT9 | BIT8)
+#define B_PCH_XHCI_XHCC1_UTAGCP (BIT7 | BIT6)
+#define B_PCH_XHCI_XHCC1_UDAGCNP (BIT5 | BIT4)
+#define B_PCH_XHCI_XHCC1_UDAGCCP (BIT3 | BIT2)
+#define B_PCH_XHCI_XHCC1_UDAGC (BIT1 | BIT0)
+
+#define R_PCH_XHCI_XHCC2 0x44
+#define B_PCH_XHCI_XHCC2_OCCFDONE BIT31
+#define B_PCH_XHCI_XHCC2_XHCUPRDROE BIT11
+#define B_PCH_XHCI_XHCC2_IOSFSRAD BIT10
+#define B_PCH_XHCI_XHCC2_SWACXIHB (BIT9 | BIT8)
+#define B_PCH_XHCI_XHCC2_SWADMIL1IHB (BIT7 | BIT6)
+#define B_PCH_XHCI_XHCC2_L1FP2CGWC (BIT5 | BIT4 | BIT3)
+#define B_PCH_XHCI_XHCC2_RDREQSZCTRL (BIT2 | BIT1 | BIT0)
+
+#define R_PCH_XHCI_XHCLKGTEN 0x50
+#define B_PCH_XHCI_XHCLKGTEN_SSLSE BIT26
+#define B_PCH_XHCI_XHCLKGTEN_USB2PLLSE BIT25
+#define B_PCH_XHCI_XHCLKGTEN_IOSFSTCGE BIT24
+#define B_PCH_XHCI_XHCLKGTEN_HSTCGE (BIT23 | BIT22 | BIT21 | BIT20)
+#define B_PCH_XHCI_XHCLKGTEN_SSTCGE (BIT19 | BIT18 | BIT17 | BIT16)
+#define B_PCH_XHCI_XHCLKGTEN_XHCIGEU3S BIT15
+#define B_PCH_XHCI_XHCLKGTEN_XHCFTCLKSE BIT14
+#define B_PCH_XHCI_XHCLKGTEN_XHCBBTCGIPISO BIT13
+#define B_PCH_XHCI_XHCLKGTEN_XHCHSTCGU2NRWE BIT12
+#define B_PCH_XHCI_XHCLKGTEN_XHCUSB2PLLSDLE (BIT11 | BIT10)
+#define B_PCH_XHCI_XHCLKGTEN_HSPLLSUE (BIT9 | BIT8)
+#define B_PCH_XHCI_XHCLKGTEN_SSPLLSUE (BIT7 | BIT6 | BIT5)
+#define B_PCH_XHCI_XHCLKGTEN_XHCBLCGE BIT4
+#define B_PCH_XHCI_XHCLKGTEN_HSLTCGE BIT3
+#define B_PCH_XHCI_XHCLKGTEN_SSLTCGE BIT2
+#define B_PCH_XHCI_XHCLKGTEN_IOSFBTCGE BIT1
+#define B_PCH_XHCI_XHCLKGTEN_IOSFGBLCGE BIT0
+
+#define R_PCH_XHCI_USB_RELNUM 0x60
+#define B_PCH_XHCI_USB_RELNUM 0xFF
+#define R_PCH_XHCI_FL_ADJ 0x61
+#define B_PCH_XHCI_FL_ADJ 0x3F
+#define R_PCH_XHCI_PWR_CAPID 0x70
+#define B_PCH_XHCI_PWR_CAPID 0xFF
+#define R_PCH_XHCI_NXT_PTR1 0x71
+#define B_PCH_XHCI_NXT_PTR1 0xFF
+#define R_PCH_XHCI_PWR_CAP 0x72
+#define B_PCH_XHCI_PWR_CAP_PME_SUP 0xF800
+#define B_PCH_XHCI_PWR_CAP_D2_SUP BIT10
+#define B_PCH_XHCI_PWR_CAP_D1_SUP BIT9
+#define B_PCH_XHCI_PWR_CAP_AUX_CUR (BIT8 | BIT7 | BIT6)
+#define B_PCH_XHCI_PWR_CAP_DSI BIT5
+#define B_PCH_XHCI_PWR_CAP_PME_CLK BIT3
+#define B_PCH_XHCI_PWR_CAP_VER (BIT2 | BIT1 | BIT0)
+#define R_PCH_XHCI_PWR_CNTL_STS 0x74
+#define B_PCH_XHCI_PWR_CNTL_STS_PME_STS BIT15
+#define B_PCH_XHCI_PWR_CNTL_STS_DATASCL (BIT14 | BIT13)
+#define B_PCH_XHCI_PWR_CNTL_STS_DATASEL (BIT12 | BIT11 | BIT10 | BIT9)
+#define B_PCH_XHCI_PWR_CNTL_STS_PME_EN BIT8
+#define B_PCH_XHCI_PWR_CNTL_STS_PWR_STS (BIT1 | BIT0)
+#define V_PCH_XHCI_PWR_CNTL_STS_PWR_STS_D3 (BIT1 | BIT0)
+
+#define R_PCH_XHCI_U2OCM1 0xC0
+#define B_PCH_XHCI_U2OCM1_OC4_MAPPING 0xFF000000
+#define B_PCH_XHCI_U2OCM1_OC3_MAPPING 0x00FF0000
+#define B_PCH_XHCI_U2OCM1_OC2_MAPPING 0x0000FF00
+#define B_PCH_XHCI_U2OCM1_OC1_MAPPING 0x000000FF
+
+#define R_PCH_XHCI_U2OCM2 0xC4
+#define B_PCH_XHCI_U2OCM2_OC8_MAPPING 0x3F000000
+#define B_PCH_XHCI_U2OCM2_OC7_MAPPING 0x003F0000
+#define B_PCH_XHCI_U2OCM2_OC6_MAPPING 0x00003F00
+#define B_PCH_XHCI_U2OCM2_OC5_MAPPING 0x0000003F
+
+#define R_PCH_XHCI_U3OCM1 0xC8
+#define B_PCH_XHCI_U3OCM1_OC4_MAPPING 0x3F000000
+#define B_PCH_XHCI_U3OCM1_OC3_MAPPING 0x003F0000
+#define B_PCH_XHCI_U3OCM1_OC2_MAPPING 0x00003F00
+#define B_PCH_XHCI_U3OCM1_OC1_MAPPING 0x0000003F
+
+#define R_PCH_XHCI_U3OCM2 0xCC
+#define B_PCH_XHCI_U3OCM2_OC8_MAPPING 0x3F000000
+#define B_PCH_XHCI_U3OCM2_OC7_MAPPING 0x003F0000
+#define B_PCH_XHCI_U3OCM2_OC6_MAPPING 0x00003F00
+#define B_PCH_XHCI_U3OCM2_OC5_MAPPING 0x0000003F
+
+#define R_PCH_XHCI_USB2PR 0xD0
+#define B_PCH_XHCI_USB2PR_USB2HCSEL 0x7FFF
+#define R_PCH_XHCI_USB2PRM 0xD4
+#define B_PCH_XHCI_USB2PR_USB2HCSELM 0x7FFF
+
+#define R_PCH_XHCI_USB3PR 0xD8
+#define B_PCH_XHCI_USB3PR_USB3SSEN 0x3F
+#define R_PCH_XHCI_USB3PRM 0xDC
+#define B_PCH_XHCI_USB3PR_USB3SSENM 0x3F
+
+#define R_PCH_XHCI_FUS 0xE0
+#define B_PCH_XHCI_FUS_USBR (BIT5)
+#define V_PCH_XHCI_FUS_USBR_EN 0
+#define V_PCH_XHCI_FUS_USBR_DIS (BIT5)
+
+#define B_PCH_XHCI_FUS_SSPRTCNT (BIT4 | BIT3)
+#define V_PCH_XHCI_FUS_SSPRTCNT_00B 0
+#define V_PCH_XHCI_FUS_SSPRTCNT_01B (BIT3)
+#define V_PCH_XHCI_FUS_SSPRTCNT_10B (BIT4)
+#define V_PCH_XHCI_FUS_SSPRTCNT_11B (BIT4 | BIT3)
+
+#define B_PCH_XHCI_FUS_HSPRTCNT (BIT2 | BIT1)
+#define V_PCH_XHCI_FUS_HSPRTCNT_00B 0
+#define V_PCH_XHCI_FUS_HSPRTCNT_01B (BIT1)
+#define V_PCH_XHCI_FUS_HSPRTCNT_10B (BIT2)
+#define V_PCH_XHCI_FUS_HSPRTCNT_11B (BIT2 | BIT1)
+
+#define V_PCH_H_XHCI_FUS_SSPRTCNT_00B_CNT 6
+#define V_PCH_H_XHCI_FUS_SSPRTCNT_01B_CNT 4
+#define V_PCH_H_XHCI_FUS_SSPRTCNT_10B_CNT 2
+#define V_PCH_H_XHCI_FUS_SSPRTCNT_11B_CNT 0
+#define V_PCH_H_XHCI_FUS_SSPRTCNT_00B_MASK 0x3F
+#define V_PCH_H_XHCI_FUS_SSPRTCNT_01B_MASK 0x0F
+#define V_PCH_H_XHCI_FUS_SSPRTCNT_10B_MASK 0x03
+#define V_PCH_H_XHCI_FUS_SSPRTCNT_11B_MASK 0x00
+
+#define V_PCH_H_XHCI_FUS_HSPRTCNT_00B_CNT 14
+#define V_PCH_H_XHCI_FUS_HSPRTCNT_01B_CNT 12
+#define V_PCH_H_XHCI_FUS_HSPRTCNT_10B_CNT 10
+#define V_PCH_H_XHCI_FUS_HSPRTCNT_11B_CNT 8
+#define V_PCH_H_XHCI_FUS_HSPRTCNT_00B_MASK 0x3FFF
+#define V_PCH_H_XHCI_FUS_HSPRTCNT_01B_MASK 0x3FFF
+#define V_PCH_H_XHCI_FUS_HSPRTCNT_10B_MASK 0x0FFF
+#define V_PCH_H_XHCI_FUS_HSPRTCNT_11B_MASK 0x00FF
+
+#define V_PCH_LP_XHCI_FIXED_SSPRTCNT 4
+#define V_PCH_LP_XHCI_FIXED_SSPRTCNT_MASK 0x0F
+
+#define V_PCH_LP_XHCI_FIXED_HSPRTCNT 8
+#define V_PCH_LP_XHCI_FIXED_HSPRTCNT_MASK 0x00FF
+
+#define R_PCH_XHCI_USB2PDO 0xE4
+#define B_PCH_XHCI_USB2PDO_MASK 0x7FFF
+#define B_PCH_XHCI_USB2PDO_DIS_PORT0 BIT0
+
+#define R_PCH_XHCI_USB3PDO 0xE8
+#define B_PCH_XHCI_USB3PDO_MASK 0x3F
+#define B_PCH_XHCI_USB3PDO_DIS_PORT0 BIT0
+
+//
+// xHCI MMIO registers
+//
+
+//
+// 0x00 - 0x1F - Capability Registers
+//
+#define R_PCH_XHCI_CAPLENGTH 0x00
+#define R_PCH_XHCI_HCIVERSION 0x02
+#define R_PCH_XHCI_HCSPARAMS1 0x04
+#define R_PCH_XHCI_HCSPARAMS2 0x08
+#define R_PCH_XHCI_HCSPARAMS3 0x0C
+#define B_PCH_XHCI_HCSPARAMS3_U2DEL 0xFFFF0000
+#define B_PCH_XHCI_HCSPARAMS3_U1DEL 0x0000FFFF
+#define R_PCH_XHCI_HCCPARAMS 0x10
+#define B_PCH_XHCI_HCCPARAMS_LHRC BIT5
+#define B_PCH_XHCI_HCCPARAMS_MAXPSASIZE 0xF000
+#define R_PCH_XHCI_DBOFF 0x14
+#define R_PCH_XHCI_RTSOFF 0x18
+
+//
+// 0x80 - 0xBF - Operational Registers
+//
+#define R_PCH_XHCI_USBCMD 0x80
+#define B_PCH_XHCI_USBCMD_RS BIT0 ///< Run/Stop
+#define B_PCH_XHCI_USBCMD_RST BIT1 ///< HCRST
+#define R_PCH_XHCI_USBSTS 0x84
+
+//
+// 0x480 - 0x5CF - Port Status and Control Registers
+//
+#define R_PCH_XHCI_PORTSC01USB2 0x480
+#define R_PCH_XHCI_PORTSC02USB2 0x490
+#define R_PCH_XHCI_PORTSC03USB2 0x4A0
+#define R_PCH_XHCI_PORTSC04USB2 0x4B0
+#define R_PCH_XHCI_PORTSC05USB2 0x4C0
+#define R_PCH_XHCI_PORTSC06USB2 0x4D0
+#define R_PCH_XHCI_PORTSC07USB2 0x4E0
+#define R_PCH_XHCI_PORTSC08USB2 0x4F0
+#define R_PCH_XHCI_PORTSC09USB2 0x500
+#define R_PCH_H_XHCI_PORTSC10USB2 0x510
+#define R_PCH_H_XHCI_PORTSC11USB2 0x520
+#define R_PCH_H_XHCI_PORTSC12USB2 0x530
+#define R_PCH_H_XHCI_PORTSC13USB2 0x540
+#define R_PCH_H_XHCI_PORTSC14USB2 0x550
+#define R_PCH_H_XHCI_PORTSC15USB2 0x560
+
+#define B_PCH_XHCI_PORTSCXUSB2_WPR BIT31 ///< Warm Port Reset
+#define B_PCH_XHCI_PORTSCXUSB2_CEC BIT23 ///< Port Config Error Change
+#define B_PCH_XHCI_PORTSCXUSB2_PLC BIT22 ///< Port Link State Change
+#define B_PCH_XHCI_PORTSCXUSB2_PRC BIT21 ///< Port Reset Change
+#define B_PCH_XHCI_PORTSCXUSB2_OCC BIT20 ///< Over-current Change
+#define B_PCH_XHCI_PORTSCXUSB2_WRC BIT19 ///< Warm Port Reset Change
+#define B_PCH_XHCI_PORTSCXUSB2_PEC BIT18 ///< Port Enabled Disabled Change
+#define B_PCH_XHCI_PORTSCXUSB2_CSC BIT17 ///< Connect Status Change
+#define B_PCH_XHCI_PORTSCXUSB2_LWS BIT16 ///< Port Link State Write Strobe
+#define B_PCH_XHCI_USB2_U3_EXIT (BIT5 | BIT6 | BIT7 | BIT8)
+#define B_PCH_XHCI_USB2_U0_MASK (BIT5 | BIT6 | BIT7 | BIT8)
+#define B_PCH_XHCI_PORTSCXUSB2_PP BIT9
+#define B_PCH_XHCI_PORTSCXUSB2_PR BIT4 ///< Port Reset
+#define B_PCH_XHCI_PORTSCXUSB2_PED BIT1 ///< Port Enable/Disabled
+#define B_PCH_XHCI_PORTSCXUSB2_CCS BIT0 ///< Current Connect Status
+#define B_PCH_XHCI_PORT_CHANGE_ENABLE_MASK (B_PCH_XHCI_PORTSCXUSB2_CEC | B_PCH_XHCI_PORTSCXUSB2_PLC | B_PCH_XHCI_PORTSCXUSB2_PRC | B_PCH_XHCI_PORTSCXUSB2_OCC | B_PCH_XHCI_PORTSCXUSB2_WRC | B_PCH_XHCI_PORTSCXUSB2_PEC | B_PCH_XHCI_PORTSCXUSB2_CSC | B_PCH_XHCI_PORTSCXUSB2_PED)
+
+#define R_PCH_H_XHCI_PORTSC1USB3 0x570
+#define R_PCH_H_XHCI_PORTSC2USB3 0x580
+#define R_PCH_H_XHCI_PORTSC3USB3 0x590
+#define R_PCH_H_XHCI_PORTSC4USB3 0x5A0
+#define R_PCH_H_XHCI_PORTSC5USB3 0x5B0
+#define R_PCH_H_XHCI_PORTSC6USB3 0x5C0
+
+#define R_PCH_LP_XHCI_PORTSC1USB3 0x510
+#define R_PCH_LP_XHCI_PORTSC2USB3 0x520
+#define R_PCH_LP_XHCI_PORTSC3USB3 0x530
+#define R_PCH_LP_XHCI_PORTSC4USB3 0x540
+
+#define B_PCH_XHCI_PORTSCXUSB3_WPR BIT31 ///< Warm Port Reset
+#define B_PCH_XHCI_PORTSCXUSB3_CEC BIT23 ///< Port Config Error Change
+#define B_PCH_XHCI_PORTSCXUSB3_PLC BIT22 ///< Port Link State Change
+#define B_PCH_XHCI_PORTSCXUSB3_PRC BIT21 ///< Port Reset Change
+#define B_PCH_XHCI_PORTSCXUSB3_OCC BIT20 ///< Over-current Change
+#define B_PCH_XHCI_PORTSCXUSB3_WRC BIT19 ///< Warm Port Reset Change
+#define B_PCH_XHCI_PORTSCXUSB3_PEC BIT18 ///< Port Enabled Disabled Change
+#define B_PCH_XHCI_PORTSCXUSB3_CSC BIT17 ///< Connect Status Change
+#define B_PCH_XHCI_PORTSCXUSB3_LWS BIT16 ///< Port Link State Write Strobe //AMI_OVERRITE
+#define B_PCH_XHCI_PORTSCXUSB3_PLS (BIT8 | BIT7 | BIT6 | BIT5) ///< Port Link State
+#define V_PCH_XHCI_PORTSCXUSB3_PLS_POLLING 0x000000E0 ///< Link is in the Polling State
+#define V_PCH_XHCI_PORTSCXUSB3_PLS_RXDETECT 0x000000A0 ///< Link is in the RxDetect State
+#define B_PCH_XHCI_PORTSCXUSB3_PP BIT9 ///< Port Power //AMI_OVERRITE
+#define B_PCH_XHCI_PORTSCXUSB3_PR BIT4 ///< Port Reset
+#define B_PCH_XHCI_PORTSCXUSB3_PED BIT1 ///< Port Enable/Disabled
+#define B_PCH_XHCI_PORTSCXUSB3_CHANGE_ENABLE_MASK (B_PCH_XHCI_PORTSCXUSB3_CEC | B_PCH_XHCI_PORTSCXUSB3_PLC | B_PCH_XHCI_PORTSCXUSB3_PRC | B_PCH_XHCI_PORTSCXUSB3_OCC | B_PCH_XHCI_PORTSCXUSB3_WRC | B_PCH_XHCI_PORTSCXUSB3_PEC | B_PCH_XHCI_PORTSCXUSB3_CSC | B_PCH_XHCI_PORTSCXUSB3_PED)
+//
+// 0x2000 - 0x21FF - Runtime Registers
+// 0x3000 - 0x307F - Doorbell Registers
+//
+
+//
+// 0x8000 - 0x833F - Extended Capabilities Registers
+//
+#define R_PCH_XHCI_MMIO_ECR_8058 0x8058
+#define B_PCH_XHCI_MMIO_ECR_8058_BIT8 BIT8 ///< Set 0
+
+#define R_PCH_XHCI_MMIO_ECR_8090 0x8090
+#define B_PCH_XHCI_MMIO_ECR_8090_BIT14 BIT14 ///< Set 1
+#define B_PCH_XHCI_MMIO_ECR_8090_BIT8 BIT8 ///< Set 1
+
+#define R_PCH_XHCI_MMIO_ECR_8094 0x8094
+#define B_PCH_XHCI_MMIO_ECR_8094_BIT23 BIT23 ///< Set 1
+
+#define R_PCH_XHCI_MMIO_ECR_80E0 0x80E0
+#define B_PCH_XHCI_MMIO_ECR_80E0_BIT9 BIT9 ///< Set 1
+#define B_PCH_XHCI_MMIO_ECR_80E0_BIT6 BIT6 ///< Set 1
+
+#define R_PCH_XHCI_MMIO_ECR_80EC 0x80EC
+#define B_PCH_XHCI_MMIO_ECR_80EC_BIT_14_12 0x7000 ///< Set 6
+#define B_PCH_XHCI_MMIO_ECR_80EC_BIT_11_9 0x0E00 ///< Set 6
+
+#define R_PCH_XHCI_MMIO_ECR_8110 0x8110
+#define B_PCH_XHCI_MMIO_ECR_8110_BIT2 BIT2 ///< Set 0
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Include/PchUsbConfig.h b/ReferenceCode/Chipset/LynxPoint/Include/PchUsbConfig.h
new file mode 100644
index 0000000..61fc690
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Include/PchUsbConfig.h
@@ -0,0 +1,178 @@
+/** @file
+ General USB Configurate data structure and register definitions.
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PCH_USB_CONFIG_H_
+#define _PCH_USB_CONFIG_H_
+
+///
+/// ---------------------------- USB Config -----------------------------
+///
+///
+/// Overcurrent pins, the values match the setting of PCH EDS, please refer to PCH EDS for more details
+///
+typedef enum {
+ PchUsbOverCurrentPin0 = 0,
+ PchUsbOverCurrentPin1,
+ PchUsbOverCurrentPin2,
+ PchUsbOverCurrentPin3,
+ PchUsbOverCurrentPin4,
+ PchUsbOverCurrentPin5,
+ PchUsbOverCurrentPin6,
+ PchUsbOverCurrentPin7,
+ PchUsbOverCurrentPinSkip,
+ PchUsbOverCurrentPinMax
+} PCH_USB_OVERCURRENT_PIN;
+
+//
+// The location of the USB connectors. This information is use to decide eye diagram tuning value for Usb 2.0 motherboard trace.
+//
+typedef enum {
+ PchUsbPortLocationBackPanel = 0,
+ PchUsbPortLocationFrontPanel,
+ PchUsbPortLocationDock,
+ PchUsbPortLocationMiniPciE,
+ PchUsbPortLocationFlex,
+ PchUsbPortLocationInternalTopology,
+ PchUsbPortLocationSkip,
+ PchUsbPortLocationMax
+} PCH_USB_PORT_LOCATION;
+
+typedef struct {
+ UINT8 Enable : 1; ///< 0: Disable; 1: Enable. This would take effect while UsbPerPortCtl is enabled
+ UINT8 Rsvdbits : 7;
+ UINT8 Location; // The location of the USB connectors. Please use the enum PCH_USB_PORT_LOCATION.
+ UINT16 Usb20PortLength; // The length of Usb Port to configure the USB transmitter, bits [16:4] represents length of Usb Port in inches using octal format and [3:0] is for the decimal Point.
+ UINT8 Usb20EyeDiagramTuningParam1; // Set IOBP registers 0xE5004000 + (PortNumber * 0x100)[10:08] = {0,1,2,3,4,5,6,7}
+ UINT8 Usb20EyeDiagramTuningParam2; // Set IOBP registers 0xE5004000 + (PortNumber * 0x100)[13:11] = {0,1,2,3,4,5,6,7}
+} PCH_USB_PORT_SETTINGS;
+
+typedef struct {
+ UINT8 Enable : 1; ///< 0: Disable; 1: Enable. This would take effect while UsbPerPortCtl is enabled
+ UINT8 Rsvdbits : 7; ///< Reserved fields for future expansion w/o protocol change;
+} PCH_USB30_PORT_SETTINGS;
+
+typedef struct {
+ UINT8 Enable : 1; ///< 0: Disable; 1: Enable
+ UINT8 Rsvdbits : 7;
+} PCH_USB20_CONTROLLER_SETTINGS;
+
+#define PCH_XHCI_MODE_OFF 0
+#define PCH_XHCI_MODE_ON 1
+#define PCH_XHCI_MODE_AUTO 2
+#define PCH_XHCI_MODE_SMARTAUTO 3
+
+#define PCH_XHCI_STREAMS_OFF 0
+#define PCH_XHCI_STREAMS_ON 1
+
+#define EHCI_PRECONDITION(Device, EhciMmioBase) \
+ EhciPrecondition(Device, EhciMmioBase)
+#define XHCI_PRECONDITION(BusNumber, Device, Function, XhciMmioBase, USB2Ptr, HsPortCount, USB3Ptr, SsPortCount) \
+ XhciPrecondition(BusNumber, Device, Function, XhciMmioBase, USB2Ptr, HsPortCount, USB3Ptr, SsPortCount)
+
+typedef struct {
+ UINT8 Mode : 2; ///< 0: Disable; 1: Enable, 2: Auto, 3: Smart Auto
+ UINT8 PreBootSupport : 1; ///< 0: No xHCI driver available; 1: xHCI driver available
+ UINT8 XhciStreams : 1; ///< OBSOLETE from Revision 2 !!! DO NOT USE !!!
+ UINT8 ManualMode : 1; ///< 0: Disable; 1: Enable Manual Mode
+ UINT8 XhciIdleL1 : 1; ///< 0: Disable; 1: Enable
+ UINT8 Btcg : 1; ///<.0:.Disable; 1: Enable trunk clock gating
+ UINT8 Rsvdbits : 1;
+ UINT8 ManualModeUsb20PerPinRoute[LPTH_USB_MAX_PHYSICAL_PORTS]; ///< 0: EHCI; 1 :XHCI;
+ UINT8 ManualModeUsb30PerPinEnable[LPTH_XHCI_MAX_USB3_PORTS]; ///< 0: Disable; 1:Enable;
+} PCH_USB30_CONTROLLER_SETTINGS;
+
+///
+/// This member describes the expected configuration of the PCH USB controllers,
+/// Platform modules may need to refer Setup options, schematic, BIOS specification
+/// to update this field.
+/// The Usb20OverCurrentPins and Usb30OverCurrentPins field must be updated by refer
+/// the schematic.
+///
+typedef struct {
+ ///
+ /// This member describes whether the USB per-port controlling feature of PCH is
+ /// enabled by platform modules. If enabled, the USB Port N of PCH can be
+ /// enabled/disabled by setting PortSettings[N] to enabled/disabled.
+ ///
+ UINT8 UsbPerPortCtl : 1; ///< 0: Disable; 1: Enable Per-port enable control
+ ///
+ /// This member describes whether or not EHCI 1 USBR should be enabled.
+ ///
+ UINT8 Ehci1Usbr : 1; ///< 0: Disable; 1: Enable EHCI 1 USBR
+ ///
+ /// This member describes whether or not EHCI 2 USBR should be enabled.
+ ///
+ UINT8 Ehci2Usbr : 1; ///< 0: Disable; 1: Enable EHCI 2 USBR
+ UINT8 RsvdBits : 5;
+ ///
+ /// These members describe whether the USB2 Port N of PCH is enabled by platform modules.
+ /// They would take effect while UsbPerPortCtl is enabled. Panel and Dock are used to
+ /// describe the layout of USB port. Panel is only available for Desktop LPT.
+ /// Dock is only available for Mobile LPT.
+ ///
+ PCH_USB_PORT_SETTINGS PortSettings[LPTH_USB_MAX_PHYSICAL_PORTS];
+ ///
+ /// These members describe whether the USB 2.0 controller N of PCH is enabled by
+ /// platform modules.
+ ///
+ PCH_USB20_CONTROLLER_SETTINGS Usb20Settings[PchEhciControllerMax];
+ ///
+ /// These members describe some settings which are related to the USB 3.0 controller.
+ /// While ManualMode is set to 1, ManualModeUsb20PerPinRoute[] and ManualModeUsb30PerPinEnable[]
+ /// need to be programmed properly per the platform design.
+ /// While ManualModeUsb20PerPinRoute[] is set to 1, it means routes USB2 pins to the
+ /// XHCI controller. ManualModeUsb30PerPinEnable[] is used to control whether Super Speed
+ /// capability is enabled for a given USB3 port.
+ ///
+ PCH_USB30_CONTROLLER_SETTINGS Usb30Settings;
+ ///
+ /// These members describe the specific over current pin number of USB 2.0 Port N.
+ /// It is SW's responsibility to ensure that a given port's bit map is set only for
+ /// one OC pin Description. USB2 and USB3 on the same combo Port must use the same
+ /// OC pin.
+ ///
+ PCH_USB_OVERCURRENT_PIN Usb20OverCurrentPins[LPTH_USB_MAX_PHYSICAL_PORTS];
+ ///
+ /// These members describe the specific over current pin number of USB 3.0 Port N.
+ /// It is SW's responsibility to ensure that a given port's bit map is set only for
+ /// one OC pin Description. USB2 and USB3 on the same combo Port must use the same
+ /// OC pin.
+ ///
+ PCH_USB_OVERCURRENT_PIN Usb30OverCurrentPins[LPTH_XHCI_MAX_USB3_PORTS];
+ ///
+ /// This feature intends to reduce the necessary initialization time for USB HC
+ /// and devices on root ports. It is assembled by PCHInit drivers in PEI and DXE phase.
+ /// In PEI phase, the feature resets all USB HCs on PCH bus, including Intel EHCI
+ /// and XHCI. After reset USB HC, continue the system initialization without waiting
+ /// for the USB XHC reset ready. After running to DXE phase, the feature resets
+ /// those USB devices installed on each USB HC root port in parallel, including RMH
+ /// on EHCI root port 0 and any non USB3 speed devices on XHCI root port if XHCI is
+ /// enabled. For USB3 protocol root port, USB3 speed devices will be advanced to
+ /// enable state if link training succeeds after XHC reset.
+ ///
+ BOOLEAN UsbPrecondition;
+ ///
+ /// These members describe whether the USB3 Port N of PCH is enabled by platform modules.
+ /// They would take effect while UsbPerPortCtl is enabled.
+ ///
+ PCH_USB30_PORT_SETTINGS Port30Settings[LPTH_XHCI_MAX_USB3_PORTS];
+} PCH_USB_CONFIG;
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/IoTrap/Smm/IoTrap.c b/ReferenceCode/Chipset/LynxPoint/IoTrap/Smm/IoTrap.c
new file mode 100644
index 0000000..74cb450
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/IoTrap/Smm/IoTrap.c
@@ -0,0 +1,884 @@
+/** @file
+ Main implementation source file for the Io Trap SMM driver
+
+@copyright
+ Copyright (c) 2006 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "IoTrap.h"
+
+//
+// Module global variables
+//
+EFI_SMM_BASE_PROTOCOL *mSmmBase;
+EFI_SMM_SYSTEM_TABLE *mSmst;
+EFI_HANDLE mDriverImageHandle;
+EFI_SMM_ICHN_DISPATCH_PROTOCOL *mIchnDispatch;
+EFI_SMM_ICHN_DISPATCH_CONTEXT mIchnContext;
+EFI_HANDLE mIchnHandle;
+UINT32 mPchRootComplexBar;
+
+IO_TRAP_INSTANCE mIoTrapData;
+IO_TRAP_RECORD *mIoTrapRecord;
+
+static CONST UINT16 mLengthTable[7] = { 4, 8, 16, 32, 64, 128, 256 };
+
+/**
+ Register a new IO Trap SMI dispatch function with a parent SMM driver.
+ The caller will provide information about the IO trap characteristics via
+ the context. This includes base address, length, read vs. r/w, etc.
+ This function will autoallocate IO base address from a common pool if the base address is 0,
+ and the RegisterContext Address field will be updated.
+ The service will not perform GCD allocation if the base address is non-zero.
+ In this case, the caller is responsible for the existence and allocation of the
+ specific IO range.
+ This function looks for the suitable handler and Register a new IchnIoTrap handler
+ if the IO Trap handler is not used. It also enable the IO Trap Range to generate
+ SMI.
+
+ @param[in] This Pointer to the EFI_SMM_IO_TRAP_DISPATCH_PROTOCOL instance.
+ @param[in] DispatchFunction Pointer to dispatch function to be invoked for
+ this SMI source.
+ @param[in, out] RegisterContext Pointer to the dispatch function's context.
+ The caller fills this context in before calling
+ the register function to indicate to the register
+ function the IO trap SMI source for which the dispatch
+ function should be invoked. This may not be NULL.
+ @param[out] DispatchHandle Handle of dispatch function, for when interfacing
+ with the parent SMM driver, will be the address of linked
+ list link in the call back record. This may not be NULL.
+
+ @retval EFI_SUCCESS The dispatch function has been successfully
+ registered and the SMI source has been enabled.
+ @retval EFI_DEVICE_ERROR The driver was unable to enable the SMI source.
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources are available
+ @retval EFI_INVALID_PARAMETER Address requested is already in use.
+**/
+static
+EFI_STATUS
+EFIAPI
+IoTrapRegister (
+ IN EFI_SMM_IO_TRAP_DISPATCH_PROTOCOL *This,
+ IN EFI_SMM_IO_TRAP_DISPATCH_CALLBACK DispatchFunction,
+ IN OUT EFI_SMM_IO_TRAP_DISPATCH_REGISTER_CONTEXT *RegisterContext,
+ OUT EFI_HANDLE *DispatchHandle
+ )
+{
+ EFI_STATUS Status;
+ static CONST UINT16 IoTrapHandlerList[IO_TRAP_HANDLER_NUM] = { IchnIoTrap0, IchnIoTrap1, IchnIoTrap2, IchnIoTrap3 };
+ EFI_PHYSICAL_ADDRESS NextBaseAddress;
+ UINT32 NextUsedLength;
+ UINT8 NextTrapHandlerNum;
+ EFI_PHYSICAL_ADDRESS BaseAddress;
+ UINT32 UsedLength;
+ UINT8 TrapHandlerNum;
+ UINT32 IoTrapRegLowDword;
+ UINT32 IoTrapRegHighDword;
+ UINT8 LengthIndex;
+
+ //
+ // Return error if the type is invalid
+ //
+ if (RegisterContext->Type >= IoTrapTypeMaximum) {
+ DEBUG ((EFI_D_ERROR, "The Dispatch Type %0X is invalid! \n", RegisterContext->Type));
+ return EFI_INVALID_PARAMETER;
+ }
+ //
+ // Return error if the Length is invalid
+ //
+ if (RegisterContext->Length < 1 || RegisterContext->Length > 0x100) {
+ DEBUG ((EFI_D_ERROR, "The Dispatch Length %0X is invalid! \n", RegisterContext->Length));
+ return EFI_INVALID_PARAMETER;
+ }
+ //
+ // Return error if the address is invalid
+ //
+ if (RegisterContext->Address % 4 != 0) {
+ DEBUG ((EFI_D_ERROR, "The Dispatch address %0X is invalid! \n", RegisterContext->Address));
+ return EFI_INVALID_PARAMETER;
+ }
+ //
+ // Loop through the first IO Trap handler, looking for the suitable handler
+ //
+ for (TrapHandlerNum = 0; TrapHandlerNum < IO_TRAP_HANDLER_NUM; TrapHandlerNum++) {
+ //
+ // Get information from Io Trap handler register
+ //
+ IoTrapRegLowDword = MmioRead32 (mPchRootComplexBar + R_PCH_RCRB_IO_TRAP_0 + TrapHandlerNum * 8);
+
+ //
+ // Check if the IO Trap handler is not used
+ //
+ if ((IoTrapRegLowDword & B_PCH_RCRB_IO_TRAP_IOAD) == 0) {
+ //
+ // Search available IO address and allocate it if the IO address is 0
+ //
+ BaseAddress = RegisterContext->Address;
+ if (BaseAddress == 0) {
+ //
+ // Allocate 256 byte range from GCD for common pool usage
+ //
+ Status = gDS->AllocateIoSpace (
+ EfiGcdAllocateAnySearchBottomUp,
+ EfiGcdIoTypeIo,
+ 8,
+ 0x100,
+ &BaseAddress,
+ mDriverImageHandle,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "Can't find any available IO address! \n"));
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ RegisterContext->Address = (UINT16) BaseAddress;
+ UsedLength = 0x100;
+ mIoTrapData.TrapUsedLength[TrapHandlerNum] = RegisterContext->Length;
+ } else {
+ //
+ // PCH only support dword * power of 2 alignment
+ //
+ for (LengthIndex = 0; LengthIndex < sizeof (mLengthTable) / sizeof (UINT16); LengthIndex++) {
+ if (RegisterContext->Length == mLengthTable[LengthIndex]) {
+ break;
+ }
+ }
+ //
+ // Return error if the alignment is not dword * power of 2
+ //
+ if (LengthIndex >= sizeof (mLengthTable) / sizeof (UINT16)) {
+ DEBUG ((EFI_D_ERROR, "The PCH only support dword * power of 2 alignment! \n"));
+ DEBUG ((EFI_D_ERROR, "The Dispatch Length %0X is 0 or invalid! \n", RegisterContext->Length));
+ return EFI_INVALID_PARAMETER;
+ }
+
+ UsedLength = RegisterContext->Length;
+ }
+
+ //
+ // Register a new IchnIoTrap handler
+ //
+ mIchnContext.Type = IoTrapHandlerList[TrapHandlerNum];
+ mIchnHandle = NULL;
+ Status = mIchnDispatch->Register (
+ mIchnDispatch,
+ IoTrapCallback,
+ &mIchnContext,
+ &mIchnHandle
+ );
+ ASSERT_EFI_ERROR (Status);
+ mIoTrapData.IchnIoTrapHandle[TrapHandlerNum] = mIchnHandle;
+ //
+ // Fill in the Length, address and Enable the IO Trap SMI
+ //
+ IoTrapRegLowDword = (UINT32) (((UsedLength - 1) & ~(BIT1 + BIT0)) << 16) |
+ (UINT16) BaseAddress |
+ B_PCH_RCRB_IO_TRAP_TRSE;
+
+ MmioWrite32 (mPchRootComplexBar + R_PCH_RCRB_IO_TRAP_0 + TrapHandlerNum * 8,
+ (UINT32) (IoTrapRegLowDword)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINT64) (mPchRootComplexBar + R_PCH_RCRB_IO_TRAP_0 + TrapHandlerNum * 8),
+ 1,
+ &IoTrapRegLowDword
+ );
+
+ IoTrapRegHighDword = 0x000000F0 | (UINT32) (RegisterContext->Type << N_PCH_RCRB_IO_TRAP_RWIO);
+ MmioWrite32 (mPchRootComplexBar + R_PCH_RCRB_IO_TRAP_0 + TrapHandlerNum * 8 + 4,
+ (UINT32) (IoTrapRegHighDword)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINT64) (mPchRootComplexBar + R_PCH_RCRB_IO_TRAP_0 + TrapHandlerNum * 8 + 4),
+ 1,
+ &IoTrapRegHighDword
+ );
+
+ //
+ // Set MergeDisable flag of the registered IoTrap
+ //
+ mIoTrapData.MergeDisable[TrapHandlerNum] = RegisterContext->MergeDisable;
+ } else {
+ //
+ // Check next handler if MergeDisable is TRUE or the registered IoTrap if MergeDisable is TRUE
+ //
+ if ((RegisterContext->MergeDisable == TRUE) || (mIoTrapData.MergeDisable[TrapHandlerNum] == TRUE)) {
+ continue;
+ }
+ //
+ // The IO Trap handler is used, calculate the Length
+ //
+ UsedLength = ((IoTrapRegLowDword >> 16) & 0xFC) + 4;
+ BaseAddress = IoTrapRegLowDword & B_PCH_RCRB_IO_TRAP_IOAD;
+ //
+ // Assign an addfress from common pool if the caller's address is 0
+ //
+ if (RegisterContext->Address == 0) {
+ //
+ // Check next handler if it's fully used
+ //
+ if (mIoTrapData.TrapUsedLength[TrapHandlerNum] >= 0x100) {
+ continue;
+ }
+ //
+ // Check next handler if it's not for a common pool
+ //
+ if (UsedLength < 0x100) {
+ continue;
+ }
+ //
+ // Check next handler if the size is too big
+ //
+ if (RegisterContext->Length >= (UINT16) 0x100 - mIoTrapData.TrapUsedLength[TrapHandlerNum]) {
+ continue;
+ }
+ //
+ // For common pool, we don't need to change the BaseAddress and UsedLength
+ //
+ RegisterContext->Address = (UINT16) (BaseAddress + mIoTrapData.TrapUsedLength[TrapHandlerNum]);
+ mIoTrapData.TrapUsedLength[TrapHandlerNum] += RegisterContext->Length;
+ } else {
+ //
+ // Check next handler if the address is smaller than the IO trap handler's start address
+ //
+ if (RegisterContext->Address < (UINT16) BaseAddress) {
+ continue;
+ }
+ //
+ // Check next handler if the max address is bigger than IO trap handler's range
+ //
+ if ((RegisterContext->Address + RegisterContext->Length) > (UINT16) (BaseAddress + 256)) {
+ continue;
+ }
+ //
+ // If this handler is used for common pool, assert if the caller's address is within the range
+ //
+ if (mIoTrapData.TrapUsedLength[TrapHandlerNum] != 0) {
+ DEBUG ((EFI_D_ERROR, "The Dispatch address %0x is used for common pool! \n", RegisterContext->Address));
+ return EFI_INVALID_PARAMETER;
+ }
+ //
+ // Calculate the Length which is maximum use address - start address
+ //
+ UsedLength = RegisterContext->Address + RegisterContext->Length - (UINT16) BaseAddress;
+ //
+ // Check the alignment is dword * power of 2 or not
+ //
+ for (LengthIndex = 0; LengthIndex < sizeof (mLengthTable) / sizeof (UINT16); LengthIndex++) {
+ if (UsedLength == mLengthTable[LengthIndex]) {
+ break;
+ }
+ }
+ //
+ // Check next handler if the alignment is not dword * power of 2
+ //
+ if (LengthIndex >= sizeof (mLengthTable) / sizeof (UINT16)) {
+ continue;
+ }
+ //
+ // Merge the overlap range: remove next Io Trap handler if next Io Trap handler's range is within this handler's range
+ //
+ for (NextTrapHandlerNum = TrapHandlerNum + 1; NextTrapHandlerNum != TrapHandlerNum; NextTrapHandlerNum++) {
+ //
+ // Check if NextTrapHandlerNum overflow
+ //
+ if (NextTrapHandlerNum >= IO_TRAP_HANDLER_NUM) {
+ NextTrapHandlerNum = 0;
+ }
+ //
+ // Get information from Io Trap handler register
+ //
+ IoTrapRegLowDword = MmioRead32 (mPchRootComplexBar + R_PCH_RCRB_IO_TRAP_0 + NextTrapHandlerNum * 8);
+ //
+ // Check next handler if the IO Trap handler is not used
+ //
+ if ((IoTrapRegLowDword & B_PCH_RCRB_IO_TRAP_IOAD) == 0) {
+ continue;
+ }
+ //
+ // Check if next Io Trap handler's range is within this handler's range
+ //
+ NextUsedLength = ((IoTrapRegLowDword >> 16) & 0xFC) + 4;
+ NextBaseAddress = IoTrapRegLowDword & B_PCH_RCRB_IO_TRAP_IOAD;
+ if ((BaseAddress > NextBaseAddress) || ((BaseAddress + UsedLength) < (NextBaseAddress + NextUsedLength))) {
+ continue;
+ }
+ //
+ // Unregister the IO Trap handler
+ //
+ mIchnHandle = mIoTrapData.IchnIoTrapHandle[NextTrapHandlerNum];
+ mIchnContext.Type = IoTrapHandlerList[NextTrapHandlerNum];
+ Status = mIchnDispatch->UnRegister (
+ mIchnDispatch,
+ mIchnHandle
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Clear the Io Trap handler register
+ //
+ IoTrapRegLowDword = 0;
+ IoTrapRegHighDword = 0;
+ MmioWrite32 (
+ mPchRootComplexBar + R_PCH_RCRB_IO_TRAP_0 + NextTrapHandlerNum * 8 + 4,
+ (UINT32) (IoTrapRegHighDword)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINT64) (mPchRootComplexBar + R_PCH_RCRB_IO_TRAP_0 + NextTrapHandlerNum * 8 + 4),
+ 1,
+ &IoTrapRegHighDword
+ );
+
+ MmioWrite32 (
+ mPchRootComplexBar + R_PCH_RCRB_IO_TRAP_0 + NextTrapHandlerNum * 8,
+ (UINT32) (IoTrapRegLowDword)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINT64) (mPchRootComplexBar + R_PCH_RCRB_IO_TRAP_0 + NextTrapHandlerNum * 8),
+ 1,
+ &IoTrapRegLowDword
+ );
+ }
+ //
+ // Update the Length
+ //
+ IoTrapRegLowDword = (UINT32) (((UsedLength - 1) & ~(BIT1 + BIT0)) << 16) |
+ (UINT16) BaseAddress |
+ B_PCH_RCRB_IO_TRAP_TRSE;
+ MmioWrite32 (mPchRootComplexBar + R_PCH_RCRB_IO_TRAP_0 + TrapHandlerNum * 8,
+ (UINT32) (IoTrapRegLowDword)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINT64) (mPchRootComplexBar + R_PCH_RCRB_IO_TRAP_0 + TrapHandlerNum * 8),
+ 1,
+ &IoTrapRegLowDword
+ );
+ }
+ //
+ // Only set RWM bit when we need both read and write cycles.
+ //
+ IoTrapRegHighDword = MmioRead32 (mPchRootComplexBar + R_PCH_RCRB_IO_TRAP_0 + TrapHandlerNum * 8 + 4);
+ if ((IoTrapRegHighDword & B_PCH_RCRB_IO_TRAP_RWM) == 0 &&
+ (UINT32) ((IoTrapRegHighDword & B_PCH_RCRB_IO_TRAP_RWIO) >> N_PCH_RCRB_IO_TRAP_RWIO) !=
+ (UINT32) RegisterContext->Type) {
+ IoTrapRegHighDword = ((IoTrapRegHighDword | B_PCH_RCRB_IO_TRAP_RWM) & ~B_PCH_RCRB_IO_TRAP_RWIO);
+ MmioWrite32 (mPchRootComplexBar + R_PCH_RCRB_IO_TRAP_0 + TrapHandlerNum * 8 + 4,
+ (UINT32) (IoTrapRegHighDword)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINT64) (mPchRootComplexBar + R_PCH_RCRB_IO_TRAP_0 + TrapHandlerNum * 8 + 4),
+ 1,
+ &IoTrapRegHighDword
+ );
+ }
+ }
+ break;
+ }
+
+ if (TrapHandlerNum >= IO_TRAP_HANDLER_NUM) {
+ DEBUG ((EFI_D_ERROR, "All IO Trap handler is used, no available IO Trap handler! \n"));
+ return EFI_OUT_OF_RESOURCES;
+ }
+ //
+ // Create database record and add to database
+ //
+ Status = mSmst->SmmAllocatePool (
+ EfiRuntimeServicesData,
+ sizeof (IO_TRAP_RECORD),
+ (VOID **) &mIoTrapRecord
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "Failed to allocate memory for mIoTrapRecord! \n"));
+ return EFI_OUT_OF_RESOURCES;
+ }
+ //
+ // Gather information about the registration request
+ //
+ mIoTrapRecord->Signature = IO_TRAP_RECORD_SIGNATURE;
+ mIoTrapRecord->Context = *RegisterContext;
+ mIoTrapRecord->Callback = DispatchFunction;
+
+ InsertTailList (&mIoTrapData.CallbackDataBase, &mIoTrapRecord->Link);
+
+ //
+ // Child's handle will be the address linked list link in the record
+ //
+ *DispatchHandle = (EFI_HANDLE) (&mIoTrapRecord->Link);
+
+ DEBUG ((EFI_D_INFO, "RegisterContext->Address:%x! \n", RegisterContext->Address));
+ DEBUG ((EFI_D_INFO, "RegisterContext->Length:%x! \n", RegisterContext->Length));
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Unregister a child SMI source dispatch function with a parent SMM driver.
+
+ @param[in] This Pointer to the EFI_SMM_IO_TRAP_DISPATCH_PROTOCOL instance.
+ @param[in] DispatchHandle Handle of dispatch function to deregister.
+
+ @retval EFI_SUCCESS The dispatch function has been successfully
+ unregistered and the SMI source has been disabled
+ if there are no other registered child dispatch
+ functions for this SMI source.
+ @retval EFI_INVALID_PARAMETER Handle is invalid.
+**/
+EFI_STATUS
+EFIAPI
+IoTrapUnRegister (
+ IN EFI_SMM_IO_TRAP_DISPATCH_PROTOCOL *This,
+ IN EFI_HANDLE *DispatchHandle
+ )
+{
+ EFI_STATUS Status;
+ IO_TRAP_RECORD *RecordToDelete;
+ UINT32 IoTrapRegLowDword;
+ UINT32 IoTrapRegHighDword;
+ EFI_PHYSICAL_ADDRESS BaseAddress;
+ UINT32 UsedLength;
+ UINT8 TrapHandlerNum;
+ UINT8 LengthIndex;
+
+ if (*DispatchHandle == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ RecordToDelete = IO_TRAP_RECORD_FROM_LINK (*DispatchHandle);
+
+ //
+ // Take the entry out of the linked list
+ //
+ if (RecordToDelete->Link.ForwardLink == (LIST_ENTRY *) EFI_BAD_POINTER) {
+ return EFI_INVALID_PARAMETER;
+ }
+ //
+ // Loop through the first IO Trap handler, looking for the suitable handler
+ //
+ for (TrapHandlerNum = 0; TrapHandlerNum < IO_TRAP_HANDLER_NUM; TrapHandlerNum++) {
+ //
+ // Get information from Io Trap handler register
+ //
+ IoTrapRegLowDword = MmioRead32 (mPchRootComplexBar + R_PCH_RCRB_IO_TRAP_0 + TrapHandlerNum * 8);
+
+ //
+ // Check next Io Trap handler if the IO Trap handler is not used
+ //
+ if ((IoTrapRegLowDword & B_PCH_RCRB_IO_TRAP_IOAD) == 0) {
+ continue;
+ }
+
+ UsedLength = ((IoTrapRegLowDword >> 16) & 0xFC) + 4;
+ BaseAddress = IoTrapRegLowDword & B_PCH_RCRB_IO_TRAP_IOAD;
+
+ //
+ // Check if it's the maximum address of the Io Trap handler
+ //
+ if (BaseAddress + UsedLength == RecordToDelete->Context.Address + RecordToDelete->Context.Length) {
+
+ if (BaseAddress == RecordToDelete->Context.Address) {
+ //
+ // Disable the IO Trap handler if it's the only child of the Trap handler
+ //
+ mIchnHandle = mIoTrapData.IchnIoTrapHandle[TrapHandlerNum];
+ mIchnContext.Type = IchnIoTrap0 + TrapHandlerNum;
+ Status = mIchnDispatch->UnRegister (
+ mIchnDispatch,
+ mIchnHandle
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Clear the Io Trap handler register
+ //
+ IoTrapRegLowDword = 0;
+ IoTrapRegHighDword = 0;
+ MmioWrite32 (
+ mPchRootComplexBar + R_PCH_RCRB_IO_TRAP_0 + TrapHandlerNum * 8 + 4,
+ (UINT32) (IoTrapRegHighDword)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINT64) (mPchRootComplexBar + R_PCH_RCRB_IO_TRAP_0 + TrapHandlerNum * 8 + 4),
+ 1,
+ &IoTrapRegHighDword
+ );
+
+ } else {
+ //
+ // Calculate the new IO Trap handler Length
+ //
+ UsedLength = UsedLength - RecordToDelete->Context.Length;
+ //
+ // Check the alignment is dword * power of 2 or not
+ //
+ for (LengthIndex = 0; LengthIndex < sizeof (mLengthTable) / sizeof (UINT16); LengthIndex++) {
+ if (UsedLength == mLengthTable[LengthIndex]) {
+ break;
+ }
+ }
+ //
+ // Do not decrease the length if the alignment is not dword * power of 2
+ //
+ if (LengthIndex >= sizeof (mLengthTable) / sizeof (UINT16)) {
+ break;
+ }
+ //
+ // Decrease the length to prevent the IO trap SMI
+ //
+ IoTrapRegLowDword = (UINT32) ((((UsedLength - 1) &~(BIT1 + BIT0)) << 16) | BaseAddress | B_PCH_RCRB_IO_TRAP_TRSE);
+ }
+
+ MmioWrite32 (mPchRootComplexBar + R_PCH_RCRB_IO_TRAP_0 + TrapHandlerNum * 8, (UINT32) (IoTrapRegLowDword));
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINT64) (mPchRootComplexBar + R_PCH_RCRB_IO_TRAP_0 + TrapHandlerNum * 8),
+ 1,
+ &IoTrapRegLowDword
+ );
+ break;
+ }
+ }
+
+ RemoveEntryList (&RecordToDelete->Link);
+ Status = mSmst->SmmFreePool (RecordToDelete);
+ ASSERT_EFI_ERROR (Status);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This I/O Trap SMI handler invokes the ACPI reference code to handle the SMI.
+ It currently assumes it owns all of the IO trap SMI.
+
+ @param[in] DispatchHandle Not used
+ @param[in] DispatchContext Not used
+
+ @retval None
+**/
+VOID
+EFIAPI
+IoTrapCallback (
+ IN EFI_HANDLE DispatchHandle,
+ IN EFI_SMM_ICHN_DISPATCH_CONTEXT *DispatchContext
+ )
+{
+ IO_TRAP_RECORD *RecordInDb;
+ LIST_ENTRY *LinkInDb;
+ EFI_SMM_IO_TRAP_DISPATCH_CALLBACK_CONTEXT CurrentIoTrapData;
+ UINT16 BaseAddress;
+ UINT16 StartAddress;
+ UINT16 EndAddress;
+
+ if (!IsListEmpty (&mIoTrapData.CallbackDataBase)) {
+ BaseAddress = MmioRead16 (mPchRootComplexBar + R_PCH_RCRB_TRCR) & B_PCH_RCRB_TRCR_TIOA;
+ StartAddress = (UINT16) ((MmioRead32 (mPchRootComplexBar + R_PCH_RCRB_TRCR) & B_PCH_RCRB_TRCR_AHBE) >> 16);
+ //
+ // StartAddress and EndAddress will be equal if it's byte access
+ //
+ EndAddress = (UINT16) (HighBitSet32 ((UINT32) (StartAddress))) + BaseAddress;
+ StartAddress = (UINT16) (LowBitSet32 ((UINT32) (StartAddress))) + BaseAddress;
+
+ CurrentIoTrapData.Type = (BOOLEAN) ((MmioRead32 (mPchRootComplexBar + R_PCH_RCRB_TRCR) & B_PCH_RCRB_TRCR_RWI) != 0);
+ CurrentIoTrapData.WriteData = MmioRead32 (mPchRootComplexBar + R_PCH_RCRB_TRWDR);
+
+ LinkInDb = GetFirstNode (&mIoTrapData.CallbackDataBase);
+
+ while (!IsNull (&mIoTrapData.CallbackDataBase, LinkInDb)) {
+ RecordInDb = IO_TRAP_RECORD_FROM_LINK (LinkInDb);
+ if ((RecordInDb->Context.Address <= StartAddress) &&
+ (RecordInDb->Context.Address + RecordInDb->Context.Length > EndAddress)) {
+ if (RecordInDb->Context.Type == ReadWriteTrap || RecordInDb->Context.Type == CurrentIoTrapData.Type) {
+ //
+ // Pass the IO trap context information
+ //
+ CurrentIoTrapData.Address = StartAddress;
+ CurrentIoTrapData.Context = RecordInDb->Context.Context;
+ RecordInDb->Callback (&RecordInDb->Link, &CurrentIoTrapData);
+ break;
+ }
+ } else {
+ LinkInDb = GetNextNode (&mIoTrapData.CallbackDataBase, &RecordInDb->Link);
+ if (IsNull (&mIoTrapData.CallbackDataBase, LinkInDb)) {
+ //
+ // An IO access was trapped that does not have a handler registered.
+ // Since this is an invalid state, we will loop here.
+ // It may be appropriate to remove this loop in production systems to avoid potential user issues.
+ // But, this indicates an error condition.
+ //
+ DEBUG_CODE (
+ EFI_DEADLOOP ();
+ );
+ }
+ }
+ }
+ }
+}
+
+/**
+ Pause IoTrap callback function.
+
+ This function disables the SMI enable of IoTrap according to the DispatchHandle,
+ which is returned by IoTrap callback registration. It only supports the DispatchHandle
+ with MergeDisable TRUE and address not zero.
+
+ @param[in] This Pointer to the PCH_SMM_IO_TRAP_CONTROL_PROTOCOL instance.
+ @param[in] DispatchHandle Handle of the child service to change state.
+
+ @retval EFI_SUCCESS This operation is complete.
+ @retval EFI_INVALID_PARAMETER The DispatchHandle is invalid.
+ @retval EFI_ACCESS_DENIED The SMI status is alrady PAUSED.
+**/
+EFI_STATUS
+IoTrapControlPause (
+ IN PCH_SMM_IO_TRAP_CONTROL_PROTOCOL *This,
+ IN EFI_HANDLE DispatchHandle
+ )
+{
+ IO_TRAP_RECORD *IoTrapRecord;
+ UINT32 IoTrapRegLowDword;
+ EFI_PHYSICAL_ADDRESS BaseAddress;
+ UINT32 UsedLength;
+ UINT8 TrapHandlerNum;
+
+ if (DispatchHandle == 0) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ IoTrapRecord = IO_TRAP_RECORD_FROM_LINK (DispatchHandle);
+
+ if ((IoTrapRecord->Signature != IO_TRAP_RECORD_SIGNATURE) ||
+ (IoTrapRecord->Context.MergeDisable != TRUE) ||
+ (IoTrapRecord->Context.Address == 0) ||
+ (IoTrapRecord->Context.Length == 0))
+ {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ for (TrapHandlerNum = 0; TrapHandlerNum < IO_TRAP_HANDLER_NUM; TrapHandlerNum++) {
+ //
+ // This IoTrap register should be merge disabled.
+ //
+ if (mIoTrapData.MergeDisable[TrapHandlerNum] != TRUE) {
+ continue;
+ }
+
+ IoTrapRegLowDword = MmioRead32 (mPchRootComplexBar + R_PCH_RCRB_IO_TRAP_0 + TrapHandlerNum * 8);
+
+ UsedLength = ((IoTrapRegLowDword >> 16) & 0xFC) + 4;
+ BaseAddress = IoTrapRegLowDword & B_PCH_RCRB_IO_TRAP_IOAD;
+
+ //
+ // The address and length of record matches the IoTrap register's.
+ //
+ if ((BaseAddress == IoTrapRecord->Context.Address) &&
+ (UsedLength == IoTrapRecord->Context.Length )) {
+ //
+ // Check if status matched.
+ // If this is already Paused, return warning status.
+ //
+ if ((IoTrapRegLowDword & B_PCH_RCRB_IO_TRAP_TRSE) == 0) {
+ return EFI_ACCESS_DENIED;
+ }
+ //
+ // Clear IoTrap register SMI enable bit
+ //
+ IoTrapRegLowDword &= (~B_PCH_RCRB_IO_TRAP_TRSE);
+ MmioWrite32 (mPchRootComplexBar + R_PCH_RCRB_IO_TRAP_0 + TrapHandlerNum * 8, (UINT32) (IoTrapRegLowDword));
+ return EFI_SUCCESS;
+ }
+ }
+ return EFI_INVALID_PARAMETER;
+}
+
+/**
+ Resume IoTrap callback function.
+
+ This function enables the SMI enable of IoTrap according to the DispatchHandle,
+ which is returned by IoTrap callback registration. It only supports the DispatchHandle
+ with MergeDisable TRUE and address not zero.
+
+ @param[in] This Pointer to the PCH_SMM_IO_TRAP_CONTROL_PROTOCOL instance.
+ @param[in] DispatchHandle Handle of the child service to change state.
+
+ @retval EFI_SUCCESS This operation is complete.
+ @retval EFI_INVALID_PARAMETER The DispatchHandle is invalid.
+ @retval EFI_ACCESS_DENIED The SMI status is alrady RESUMED.
+**/
+EFI_STATUS
+IoTrapControlResume (
+ IN PCH_SMM_IO_TRAP_CONTROL_PROTOCOL *This,
+ IN EFI_HANDLE DispatchHandle
+ )
+{
+ IO_TRAP_RECORD *IoTrapRecord;
+ UINT32 IoTrapRegLowDword;
+ EFI_PHYSICAL_ADDRESS BaseAddress;
+ UINT32 UsedLength;
+ UINT8 TrapHandlerNum;
+
+ if (DispatchHandle == 0) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ IoTrapRecord = IO_TRAP_RECORD_FROM_LINK (DispatchHandle);
+
+ if ((IoTrapRecord->Signature != IO_TRAP_RECORD_SIGNATURE) ||
+ (IoTrapRecord->Context.MergeDisable != TRUE) ||
+ (IoTrapRecord->Context.Address == 0) ||
+ (IoTrapRecord->Context.Length == 0))
+ {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ for (TrapHandlerNum = 0; TrapHandlerNum < IO_TRAP_HANDLER_NUM; TrapHandlerNum++) {
+ //
+ // This IoTrap register should be merge disabled.
+ //
+ if (mIoTrapData.MergeDisable[TrapHandlerNum] != TRUE) {
+ continue;
+ }
+
+ IoTrapRegLowDword = MmioRead32 (mPchRootComplexBar + R_PCH_RCRB_IO_TRAP_0 + TrapHandlerNum * 8);
+
+ UsedLength = ((IoTrapRegLowDword >> 16) & 0xFC) + 4;
+ BaseAddress = IoTrapRegLowDword & B_PCH_RCRB_IO_TRAP_IOAD;
+
+ //
+ // The address and length of record matches the IoTrap register's.
+ //
+ if ((BaseAddress == IoTrapRecord->Context.Address) &&
+ (UsedLength == IoTrapRecord->Context.Length )) {
+ //
+ // Check if status matched.
+ // If this is already Resume, return warning status.
+ //
+ if ((IoTrapRegLowDword & B_PCH_RCRB_IO_TRAP_TRSE) != 0) {
+ return EFI_ACCESS_DENIED;
+ }
+ //
+ // Set IoTrap register SMI enable bit
+ //
+ IoTrapRegLowDword |= (B_PCH_RCRB_IO_TRAP_TRSE);
+ MmioWrite32 (mPchRootComplexBar + R_PCH_RCRB_IO_TRAP_0 + TrapHandlerNum * 8, (UINT32) (IoTrapRegLowDword));
+ return EFI_SUCCESS;
+ }
+ }
+ return EFI_INVALID_PARAMETER;
+}
+
+/**
+ IO Trap SMM driver entry point function.
+
+ @param[in] ImageHandle Image handle for this driver image
+ @param[in] SystemTable Pointer to the EFI System Table
+
+ @retval EFI_SUCCESS Driver initialization completed successfully
+**/
+EFI_STATUS
+EFIAPI
+InstallIoTrap (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+
+ //
+ // Initialize the EFI SMM driver library
+ //
+ mDriverImageHandle = ImageHandle;
+
+ //
+ // Find the SMM base protocol
+ //
+ Status = gBS->LocateProtocol (&gEfiSmmBaseProtocolGuid, NULL, (VOID **) &mSmmBase);
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Initialize global variables.
+ //
+ mSmmBase->GetSmstLocation (mSmmBase, &mSmst);
+
+ //
+ // Add other initialization code
+ //
+ //
+ // PCH RCBA must be initialized prior to run this driver.
+ //
+ mPchRootComplexBar = PCH_RCRB_BASE;
+ ASSERT (mPchRootComplexBar != 0);
+
+ //
+ // Locate the ICHn Dispatch protocol
+ //
+ Status = gBS->LocateProtocol (&gEfiSmmIchnDispatchProtocolGuid, NULL, (VOID **) &mIchnDispatch);
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Locate the S3 resume scripting protocol
+ //
+ INITIALIZE_SCRIPT (ImageHandle, SystemTable);
+
+ //
+ // Initialize the IO trap protocol we produce
+ //
+ mIoTrapData.Signature = IO_TRAP_INSTANCE_SIGNATURE;
+ mIoTrapData.EfiSmmIoTrapDispatchProtocol.Register = IoTrapRegister;
+ mIoTrapData.EfiSmmIoTrapDispatchProtocol.UnRegister = IoTrapUnRegister;
+
+ //
+ // Initialize the Io trap control protocol.
+ //
+ mIoTrapData.PchSmmIoTrapControlProtocol.Pause = IoTrapControlPause;
+ mIoTrapData.PchSmmIoTrapControlProtocol.Resume = IoTrapControlResume;
+
+ //
+ // Install protocol interface
+ //
+ mIoTrapData.Handle = NULL;
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &mIoTrapData.Handle,
+ &gEfiSmmIoTrapDispatchProtocolGuid,
+ &mIoTrapData.EfiSmmIoTrapDispatchProtocol,
+ &gPchSmmIoTrapControlGuid,
+ &mIoTrapData.PchSmmIoTrapControlProtocol,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Initialize IO TRAP Callback DataBase
+ //
+ InitializeListHead (&mIoTrapData.CallbackDataBase);
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/IoTrap/Smm/IoTrap.cif b/ReferenceCode/Chipset/LynxPoint/IoTrap/Smm/IoTrap.cif
new file mode 100644
index 0000000..c76e3da
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/IoTrap/Smm/IoTrap.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "IoTrap"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\IoTrap\Smm"
+ RefName = "IoTrap"
+[files]
+"IoTrap.sdl"
+"IoTrap.mak"
+"IoTrap.c"
+"IoTrap.h"
+"IoTrapDepex.dxs"
+"IoTrap.inf"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/IoTrap/Smm/IoTrap.h b/ReferenceCode/Chipset/LynxPoint/IoTrap/Smm/IoTrap.h
new file mode 100644
index 0000000..d449fea
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/IoTrap/Smm/IoTrap.h
@@ -0,0 +1,221 @@
+/** @file
+ Defines and prototypes for the IoTrap SMM driver
+
+@copyright
+ Copyright (c) 2006 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _IO_TRAP_H_
+#define _IO_TRAP_H_
+
+//
+// Include files
+//
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+
+#include "EdkIIGlueDxe.h"
+#include "EfiScriptLib.h"
+
+//
+// Driver Consumed Protocol
+//
+#include EFI_PROTOCOL_DEPENDENCY (SmmBase)
+#include EFI_PROTOCOL_DEPENDENCY (LoadedImage)
+#include EFI_PROTOCOL_DEPENDENCY (SmmIchnDispatch)
+#include EFI_PROTOCOL_DEPENDENCY (BootScriptSave)
+
+//
+// Driver Produced Protocol
+//
+#include EFI_PROTOCOL_PRODUCER (SmmIoTrapDispatch)
+#include EFI_PROTOCOL_PRODUCER (PchSmmIoTrapControl)
+#include "PchAccess.h"
+#endif
+
+#define IO_TRAP_HANDLER_NUM 4
+
+//
+// Driver private data
+//
+#define IO_TRAP_INSTANCE_SIGNATURE EFI_SIGNATURE_32 ('I', 'O', 'T', 'P')
+
+typedef struct {
+ UINT32 Signature;
+ EFI_HANDLE Handle;
+ EFI_SMM_IO_TRAP_DISPATCH_PROTOCOL EfiSmmIoTrapDispatchProtocol;
+ EFI_HANDLE IchnIoTrapHandle[IO_TRAP_HANDLER_NUM];
+ LIST_ENTRY CallbackDataBase;
+ UINT32 TrapUsedLength[IO_TRAP_HANDLER_NUM];
+ BOOLEAN MergeDisable[IO_TRAP_HANDLER_NUM]; ///< Determine if IoTrap can be merged with other IoTrap
+ PCH_SMM_IO_TRAP_CONTROL_PROTOCOL PchSmmIoTrapControlProtocol; ///< Protocol for runtime control the IoTrap state
+} IO_TRAP_INSTANCE;
+
+#define IO_TRAP_INSTANCE_FROM_THIS(a) CR (a, IO_TRAP_INSTANCE, EfiSmmIoTrapDispatchProtocol, IO_TRAP_INSTANCE_SIGNATURE)
+
+///
+/// "IOTRAP" RECORD
+/// Linked list data structures
+///
+#define IO_TRAP_RECORD_SIGNATURE EFI_SIGNATURE_32 ('I', 'T', 'R', 'C')
+
+typedef struct _IO_TRAP_RECORD {
+ UINT32 Signature;
+ LIST_ENTRY Link;
+ EFI_SMM_IO_TRAP_DISPATCH_REGISTER_CONTEXT Context;
+ EFI_SMM_IO_TRAP_DISPATCH_CALLBACK Callback;
+} IO_TRAP_RECORD;
+
+#define IO_TRAP_RECORD_FROM_LINK(_record) CR (_record, IO_TRAP_RECORD, Link, IO_TRAP_RECORD_SIGNATURE)
+
+//
+// Prototypes
+//
+/**
+ IO Trap SMM driver entry point function.
+
+ @param[in] ImageHandle Image handle for this driver image
+ @param[in] SystemTable Pointer to the EFI System Table
+
+ @retval EFI_SUCCESS Driver initialization completed successfully
+**/
+EFI_STATUS
+EFIAPI
+InstallIoTrap (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ );
+
+/**
+ Register a new IO Trap SMI dispatch function with a parent SMM driver.
+ The caller will provide information about the IO trap characteristics via
+ the context. This includes base address, length, read vs. r/w, etc.
+ This function will autoallocate IO base address from a common pool if the base address is 0,
+ and the RegisterContext Address field will be updated.
+ The service will not perform GCD allocation if the base address is non-zero.
+ In this case, the caller is responsible for the existence and allocation of the
+ specific IO range.
+ This function looks for the suitable handler and Register a new IchnIoTrap handler
+ if the IO Trap handler is not used. It also enable the IO Trap Range to generate
+ SMI.
+
+ @param[in] This Pointer to the EFI_SMM_IO_TRAP_DISPATCH_PROTOCOL instance.
+ @param[in] DispatchFunction Pointer to dispatch function to be invoked for
+ this SMI source.
+ @param[in, out] RegisterContext Pointer to the dispatch function's context.
+ The caller fills this context in before calling
+ the register function to indicate to the register
+ function the IO trap SMI source for which the dispatch
+ function should be invoked. This may not be NULL.
+ @param[out] DispatchHandle Handle of dispatch function, for when interfacing
+ with the parent SMM driver, will be the address of linked
+ list link in the call back record. This may not be NULL.
+
+ @retval EFI_SUCCESS The dispatch function has been successfully
+ registered and the SMI source has been enabled.
+ @retval EFI_DEVICE_ERROR The driver was unable to enable the SMI source.
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources are available
+ @retval EFI_INVALID_PARAMETER Address requested is already in use.
+**/
+static
+EFI_STATUS
+EFIAPI
+IoTrapRegister (
+ IN EFI_SMM_IO_TRAP_DISPATCH_PROTOCOL *This,
+ IN EFI_SMM_IO_TRAP_DISPATCH_CALLBACK DispatchFunction,
+ IN OUT EFI_SMM_IO_TRAP_DISPATCH_REGISTER_CONTEXT *RegisterContext,
+ OUT EFI_HANDLE *DispatchHandle
+ );
+
+/**
+ Unregister a child SMI source dispatch function with a parent SMM driver.
+
+ @param[in] This Pointer to the EFI_SMM_IO_TRAP_DISPATCH_PROTOCOL instance.
+ @param[in] DispatchHandle Handle of dispatch function to deregister.
+
+ @retval EFI_SUCCESS The dispatch function has been successfully
+ unregistered and the SMI source has been disabled
+ if there are no other registered child dispatch
+ functions for this SMI source.
+ @retval EFI_INVALID_PARAMETER Handle is invalid.
+**/
+EFI_STATUS
+EFIAPI
+IoTrapUnRegister (
+ IN EFI_SMM_IO_TRAP_DISPATCH_PROTOCOL *This,
+ IN EFI_HANDLE *DispatchHandle
+ );
+
+/**
+ This I/O Trap SMI handler invokes the ACPI reference code to handle the SMI.
+ It currently assumes it owns all of the IO trap SMI.
+
+ @param[in] DispatchHandle Not used
+ @param[in] DispatchContext Not used
+
+ @retval None
+**/
+VOID
+EFIAPI
+IoTrapCallback (
+ IN EFI_HANDLE DispatchHandle,
+ IN EFI_SMM_ICHN_DISPATCH_CONTEXT *DispatchContext
+ );
+
+/**
+ Pause IoTrap callback function.
+
+ This function disables the SMI enable of IoTrap according to the DispatchHandle,
+ which is returned by IoTrap callback registration. It only supports the DispatchHandle
+ with MergeDisable TRUE and address not zero.
+
+ @param[in] This Pointer to the PCH_SMM_IO_TRAP_CONTROL_PROTOCOL instance.
+ @param[in] DispatchHandle Handle of the child service to change state.
+
+ @retval EFI_SUCCESS This operation is complete.
+ @retval EFI_INVALID_PARAMETER The DispatchHandle is invalid.
+ @retval EFI_ACCESS_DENIED The SMI status is alrady PAUSED.
+**/
+EFI_STATUS
+IoTrapControlPause (
+ IN PCH_SMM_IO_TRAP_CONTROL_PROTOCOL * This,
+ IN EFI_HANDLE DispatchHandle
+ );
+
+/**
+ Resume IoTrap callback function.
+
+ This function enables the SMI enable of IoTrap according to the DispatchHandle,
+ which is returned by IoTrap callback registration. It only supports the DispatchHandle
+ with MergeDisable TRUE and address not zero.
+
+ @param[in] This Pointer to the PCH_SMM_IO_TRAP_CONTROL_PROTOCOL instance.
+ @param[in] DispatchHandle Handle of the child service to change state.
+
+ @retval EFI_SUCCESS This operation is complete.
+ @retval EFI_INVALID_PARAMETER The DispatchHandle is invalid.
+ @retval EFI_ACCESS_DENIED The SMI status is alrady RESUMED.
+**/
+EFI_STATUS
+IoTrapControlResume (
+ IN PCH_SMM_IO_TRAP_CONTROL_PROTOCOL * This,
+ IN EFI_HANDLE DispatchHandle
+ );
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/IoTrap/Smm/IoTrap.inf b/ReferenceCode/Chipset/LynxPoint/IoTrap/Smm/IoTrap.inf
new file mode 100644
index 0000000..7da9522
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/IoTrap/Smm/IoTrap.inf
@@ -0,0 +1,92 @@
+## @file
+# Component description file for the IoTrap BS_DRIVER
+#
+#@copyright
+# Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = IoTrap
+FILE_GUID = 2374EDDF-F203-4fc0-A20E-61BAD73089D6
+COMPONENT_TYPE = BS_DRIVER
+
+[sources.common]
+ IoTrap.c
+ IoTrap.h
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueSmmDriverEntryPoint.c
+
+[libraries.common]
+ EdkIIGlueBaseLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueBaseMemoryLib
+ EdkIIGlueBasePciLibPciExpress
+ EdkIIGlueDxeMemoryAllocationLib
+ EdkIIGlueDxeServicesTableLib
+ EdkIIGlueSmmRuntimeDxeReportStatusCodeLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueUefiLib
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueUefiDevicePathLib
+ EdkFrameworkProtocolLib
+ EdkProtocolLib
+ $(PROJECT_PCH_FAMILY)ProtocolLib
+ EfiScriptLib
+
+[includes.common]
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/SampleCode
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = IoTrapDepex.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=InstallIoTrap
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_LIB__ \
+ -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ -D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_SMM_RUNTIME_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_UEFI_LIB__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_DEVICE_PATH_LIB__
diff --git a/ReferenceCode/Chipset/LynxPoint/IoTrap/Smm/IoTrap.mak b/ReferenceCode/Chipset/LynxPoint/IoTrap/Smm/IoTrap.mak
new file mode 100644
index 0000000..950c31e
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/IoTrap/Smm/IoTrap.mak
@@ -0,0 +1,118 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/IoTrap/IoTrap.mak 4 12/18/12 5:19a Scottyang $
+#
+# $Revision: 4 $
+#
+# $Date: 12/18/12 5:19a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/IoTrap/IoTrap.mak $
+#
+# 4 12/18/12 5:19a Scottyang
+# [TAG] EIP109697
+# [Category] Improvement
+# [Description] Update PCH RC 0.8.1
+# [Files] ReferenceCode\Chipset\LynxPoint\*.*, SBDxe.c, SBPEI.c, SB.sd,
+# SbSetupData.c, GetSetupDate.c
+#
+# 3 9/26/12 2:27a Victortu
+#
+# 2 2/24/12 2:10a Victortu
+# Updated to support 4.6.5.3_IntelEDK_1117_Patch7_00.
+#
+# 1 2/08/12 8:44a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+#---------------------------------------------------------------------------
+# Create IoTrap Driver
+#---------------------------------------------------------------------------
+EDK : IoTrap
+IoTrap : $(BUILD_DIR)\IoTrap.mak IoTrapBin
+
+$(BUILD_DIR)\IoTrap.mak : $(IoTrap_DIR)\$(@B).cif $(IoTrap_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(IoTrap_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+IoTrap_INCLUDES=\
+ $(INTEL_PCH_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ /I$(EDK_SOURCE)\Foundation\Efi\Include\
+
+IoTrap_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=InstallIoTrap"\
+ /D __EDKII_GLUE_BASE_LIB__ \
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ /D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_SMM_RUNTIME_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_UEFI_LIB__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_UEFI_DEVICE_PATH_LIB__ \
+
+
+IoTrap_LIB_LINKS =\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGlueBasePciExpressLib_LIB)\
+ $(EdkIIGlueDxeMemoryAllocationLib_LIB)\
+ $(EdkIIGlueDxeServicesTableLib_LIB)\
+ $(EdkIIGlueSmmRuntimeDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueUefiLib_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueUefiRuntimeServicesTableLib_LIB)\
+ $(EdkIIGlueUefiDevicePathLib_LIB)\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(EDKPROTOCOLLIB)\
+ $(INTEL_PCH_PROTOCOL_LIB)\
+ $(EFISCRIPTLIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+
+IoTrapBin: $(IoTrap_LIB_LINKS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\IoTrap.mak all \
+ "MY_INCLUDES=$(IoTrap_INCLUDES)" \
+ "MY_DEFINES=$(IoTrap_DEFINES)" \
+ GUID=2374EDDF-F203-4fc0-A20E-61BAD73089D6\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=BS_DRIVER\
+ EDKIIModule=SMMDRIVER\
+ DEPEX1=$(IoTrap_DIR)\IoTrapDepex.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \
+ COMPRESS=1
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/IoTrap/Smm/IoTrap.sdl b/ReferenceCode/Chipset/LynxPoint/IoTrap/Smm/IoTrap.sdl
new file mode 100644
index 0000000..9eee5f4
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/IoTrap/Smm/IoTrap.sdl
@@ -0,0 +1,67 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/IoTrap/IoTrap.sdl 1 2/08/12 8:44a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 8:44a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/IoTrap/IoTrap.sdl $
+#
+# 1 2/08/12 8:44a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+TOKEN
+ Name = "IoTrap_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable IoTrap support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "IoTrap_DIR"
+End
+
+MODULE
+ File = "IoTrap.mak"
+ Help = "Includes IoTrap to Project"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\IoTrap.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/IoTrap/Smm/IoTrapDepex.dxs b/ReferenceCode/Chipset/LynxPoint/IoTrap/Smm/IoTrapDepex.dxs
new file mode 100644
index 0000000..0c0b283
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/IoTrap/Smm/IoTrapDepex.dxs
@@ -0,0 +1,43 @@
+/** @file
+ Dispatch dependency expression file for the IoTrap driver.
+
+@copyright
+ Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "DxeDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+
+#include EFI_PROTOCOL_DEPENDENCY (SmmBase)
+#include EFI_PROTOCOL_DEPENDENCY (SmmIchnDispatch)
+#endif
+
+DEPENDENCY_START
+ EFI_SMM_BASE_PROTOCOL_GUID AND
+ EFI_SMM_ICHN_DISPATCH_PROTOCOL_GUID
+DEPENDENCY_END
+
diff --git a/ReferenceCode/Chipset/LynxPoint/LegacyInterrupt/Dxe/IntelLegacyInterrupt.cif b/ReferenceCode/Chipset/LynxPoint/LegacyInterrupt/Dxe/IntelLegacyInterrupt.cif
new file mode 100644
index 0000000..b6fd327
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/LegacyInterrupt/Dxe/IntelLegacyInterrupt.cif
@@ -0,0 +1,12 @@
+<component>
+ name = "IntelLegacyInterrupt"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\LegacyInterrupt\Dxe"
+ RefName = "IntelLegacyInterrupt"
+[files]
+"IntelLegacyInterrupt.sdl"
+"IntelLegacyInterrupt.mak"
+"LegacyInterrupt.c"
+"LegacyInterrupt.h"
+"LegacyInterrupt.inf"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/LegacyInterrupt/Dxe/IntelLegacyInterrupt.mak b/ReferenceCode/Chipset/LynxPoint/LegacyInterrupt/Dxe/IntelLegacyInterrupt.mak
new file mode 100644
index 0000000..c304a3b
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/LegacyInterrupt/Dxe/IntelLegacyInterrupt.mak
@@ -0,0 +1,91 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/IntelLegacyInterrupt/IntelLegacyInterrupt.mak 2 2/24/12 2:11a Victortu $
+#
+# $Revision: 2 $
+#
+# $Date: 2/24/12 2:11a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/IntelLegacyInterrupt/IntelLegacyInterrupt.mak $
+#
+# 2 2/24/12 2:11a Victortu
+# Updated to support 4.6.5.3_IntelEDK_1117_Patch7_00.
+#
+# 1 2/08/12 8:45a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+
+#---------------------------------------------------------------------------
+# Create IntelLegacyInterrupt Driver
+#---------------------------------------------------------------------------
+EDK : IntelLegacyInterrupt
+IntelLegacyInterrupt : $(BUILD_DIR)\IntelLegacyInterrupt.mak IntelLegacyInterruptBin
+
+
+$(BUILD_DIR)\IntelLegacyInterrupt.mak : $(IntelLegacyInterrupt_DIR)\$(@B).cif $(IntelLegacyInterrupt_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(IntelLegacyInterrupt_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+IntelLegacyInterrupt_INCLUDES=\
+ $(INTEL_PCH_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+
+IntelLegacyInterrupt_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=LegacyInterruptInstall"\
+ /D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+
+IntelLegacyInterrupt_LIB_LINKS =\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EDKPROTOCOLLIB)\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(EdkIIGlueUefiRuntimeServicesTableLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+
+IntelLegacyInterruptBin: $(IntelLegacyInterrupt_LIB_LINKS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\IntelLegacyInterrupt.mak all \
+ "MY_INCLUDES=$(IntelLegacyInterrupt_INCLUDES)"\
+ "MY_DEFINES=$(IntelLegacyInterrupt_DEFINES)"\
+ GUID=C1C418F9-591D-461c-82A2-B9CD96DFEA86\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=BS_DRIVER\
+ EDKIIModule=DXEDRIVER\
+ COMPRESS=1
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/LegacyInterrupt/Dxe/IntelLegacyInterrupt.sdl b/ReferenceCode/Chipset/LynxPoint/LegacyInterrupt/Dxe/IntelLegacyInterrupt.sdl
new file mode 100644
index 0000000..194a4cc
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/LegacyInterrupt/Dxe/IntelLegacyInterrupt.sdl
@@ -0,0 +1,67 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/IntelLegacyInterrupt/IntelLegacyInterrupt.sdl 1 2/08/12 8:45a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 8:45a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/IntelLegacyInterrupt/IntelLegacyInterrupt.sdl $
+#
+# 1 2/08/12 8:45a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+TOKEN
+ Name = "IntelLegacyInterrupt_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable IntelLegacyInterrupt support in Project"
+End
+
+PATH
+ Name = "IntelLegacyInterrupt_DIR"
+ Help = "IntelLegacyInterrupt file source directory"
+End
+
+MODULE
+ File = "IntelLegacyInterrupt.mak"
+ Help = "Includes IntelLegacyInterrupt.mak to Project"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\IntelLegacyInterrupt.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/LegacyInterrupt/Dxe/LegacyInterrupt.c b/ReferenceCode/Chipset/LynxPoint/LegacyInterrupt/Dxe/LegacyInterrupt.c
new file mode 100644
index 0000000..213f91b
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/LegacyInterrupt/Dxe/LegacyInterrupt.c
@@ -0,0 +1,204 @@
+/** @file
+ This code supports a the private implementation
+ of the Legacy Interrupt protocol
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "LegacyInterrupt.h"
+
+///
+/// Handle for the Legacy Interrupt Protocol instance produced by this driver
+///
+EFI_HANDLE mLegacyInterruptHandle = NULL;
+
+///
+/// The Legacy Interrupt Protocol instance produced by this driver
+///
+EFI_LEGACY_INTERRUPT_PROTOCOL mLegacyInterrupt = {
+ GetNumberPirqs,
+ GetLocation,
+ ReadPirq,
+ WritePirq
+};
+
+///
+/// Module Global:
+/// Since this driver will only ever produce one instance of the Private Data
+/// protocol you are not required to dynamically allocate the PrivateData.
+///
+UINT8 PirqReg[MAX_PIRQ_NUMBER] = { PIRQA, PIRQB, PIRQC, PIRQD, PIRQE, PIRQF, PIRQG, PIRQH };
+
+/**
+ Return the number of PIRQs supported by this chipset.
+
+ @param[in] This Pointer to LegacyInterrupt Protocol
+ @param[out] NumberPirqs The pointer which point to the max IRQ number supported by this PCH.
+
+ @retval EFI_SUCCESS Legacy BIOS protocol installed
+**/
+EFI_STATUS
+EFIAPI
+GetNumberPirqs (
+ IN EFI_LEGACY_INTERRUPT_PROTOCOL *This,
+ OUT UINT8 *NumberPirqs
+ )
+{
+ *NumberPirqs = MAX_PIRQ_NUMBER;
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Return PCI location of this device. $PIR table requires this info.
+
+ @param[in] This Protocol instance pointer.
+ @param[out] Bus PCI Bus
+ @param[out] Device PCI Device
+ @param[out] Function PCI Function
+
+ @retval EFI_SUCCESS Bus/Device/Function returned
+**/
+EFI_STATUS
+EFIAPI
+GetLocation (
+ IN EFI_LEGACY_INTERRUPT_PROTOCOL *This,
+ OUT UINT8 *Bus,
+ OUT UINT8 *Device,
+ OUT UINT8 *Function
+ )
+{
+ *Bus = DEFAULT_PCI_BUS_NUMBER_PCH;
+ *Device = PCI_DEVICE_NUMBER_PCH_LPC;
+ *Function = PCI_FUNCTION_NUMBER_PCH_LPC;
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Builds the PCIE configuration address for the register specified by PirqNumber
+
+ @param[in] PirqNumber The PIRQ number to build the PCIE configuration address for
+
+ @retval UINTN The PCIE Configuration address for interrupt controller in PCH
+**/
+UINTN
+GetAddress (
+ UINT8 PirqNumber
+ )
+{
+ return MmPciAddress (
+ 0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ PirqReg[PirqNumber]
+ );
+}
+
+/**
+ Read the given PIRQ register
+
+ @param[in] This Pointer to LegacyInterrupt Protocol
+ @param[in] PirqNumber The Pirq register 0 = A, 1 = B etc
+ @param[out] PirqData Value read
+
+ @retval EFI_SUCCESS Decoding change affected.
+ @retval EFI_INVALID_PARAMETER Invalid PIRQ number
+**/
+EFI_STATUS
+EFIAPI
+ReadPirq (
+ IN EFI_LEGACY_INTERRUPT_PROTOCOL *This,
+ IN UINT8 PirqNumber,
+ OUT UINT8 *PirqData
+ )
+{
+ if (PirqNumber >= MAX_PIRQ_NUMBER) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ *PirqData = MmioRead8 (GetAddress (PirqNumber));
+ *PirqData = (UINT8) (*PirqData & 0x7f);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Read the given PIRQ register
+
+ @param[in] This Pointer to LegacyInterrupt Protocol
+ @param[in] PirqNumber The Pirq register 0 = A, 1 = B etc
+ @param[in] PirqData Value read
+
+ @retval EFI_SUCCESS Decoding change affected.
+ @retval EFI_INVALID_PARAMETER Invalid PIRQ number
+**/
+EFI_STATUS
+EFIAPI
+WritePirq (
+ IN EFI_LEGACY_INTERRUPT_PROTOCOL *This,
+ IN UINT8 PirqNumber,
+ IN UINT8 PirqData
+ )
+{
+ if (PirqNumber >= MAX_PIRQ_NUMBER) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ MmioWrite8 (GetAddress (PirqNumber), PirqData);
+ return EFI_SUCCESS;
+}
+
+/**
+ Install Driver to produce Legacy Interrupt protocol.
+
+ @param[in] ImageHandle Handle for this drivers loaded image protocol.
+ @param[in] SystemTable EFI system table.
+
+ @retval EFI_SUCCESS Legacy Interrupt protocol installed
+ @retval Other No protocol installed, unload driver.
+**/
+EFI_STATUS
+LegacyInterruptInstall (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+
+ DEBUG ((EFI_D_INFO, "LegacyInterruptInstall() Start\n"));
+
+ ///
+ /// Make sure the Legacy Interrupt Protocol is not already installed in the system
+ ///
+ ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiLegacyInterruptProtocolGuid);
+
+ ///
+ /// Make a new handle and install the protocol
+ ///
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &mLegacyInterruptHandle,
+ &gEfiLegacyInterruptProtocolGuid,
+ &mLegacyInterrupt,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ DEBUG ((EFI_D_INFO, "LegacyInterruptInstall() End\n"));
+ return Status;
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/LegacyInterrupt/Dxe/LegacyInterrupt.h b/ReferenceCode/Chipset/LynxPoint/LegacyInterrupt/Dxe/LegacyInterrupt.h
new file mode 100644
index 0000000..0c9440f
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/LegacyInterrupt/Dxe/LegacyInterrupt.h
@@ -0,0 +1,119 @@
+/** @file
+ This code supports a the private implementation
+ of the Legacy Interrupt protocol
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef LEGACY_INTERRUPT_H_
+#define LEGACY_INTERRUPT_H_
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+
+#include "EdkIIGlueDxe.h"
+
+#include EFI_PROTOCOL_PRODUCER (LegacyInterrupt)
+#include "PchAccess.h"
+#endif
+
+#define PIRQN 0x00 ///< PIRQ Null
+#define PIRQA 0x60
+#define PIRQB 0x61
+#define PIRQC 0x62
+#define PIRQD 0x63
+#define PIRQE 0x68
+#define PIRQF 0x69
+#define PIRQG 0x6A
+#define PIRQH 0x6B
+
+#define MAX_PIRQ_NUMBER 8
+
+/**
+ Return the number of PIRQs supported by this chipset.
+
+ @param[in] This Pointer to LegacyInterrupt Protocol
+ @param[out] NumberPirqs The pointer which point to the max IRQ number supported by this PCH.
+
+ @retval EFI_SUCCESS Legacy BIOS protocol installed
+**/
+EFI_STATUS
+EFIAPI
+GetNumberPirqs (
+ IN EFI_LEGACY_INTERRUPT_PROTOCOL *This,
+ OUT UINT8 *NumberPirqs
+ );
+
+/**
+ Return PCI location of this device. $PIR table requires this info.
+
+ @param[in] This Protocol instance pointer.
+ @param[out] Bus PCI Bus
+ @param[out] Device PCI Device
+ @param[out] Function PCI Function
+
+ @retval EFI_SUCCESS Bus/Device/Function returned
+**/
+EFI_STATUS
+EFIAPI
+GetLocation (
+ IN EFI_LEGACY_INTERRUPT_PROTOCOL *This,
+ OUT UINT8 *Bus,
+ OUT UINT8 *Device,
+ OUT UINT8 *Function
+ );
+
+/**
+ Read the given PIRQ register
+
+ @param[in] This Pointer to LegacyInterrupt Protocol
+ @param[in] PirqNumber The Pirq register 0 = A, 1 = B etc
+ @param[out] PirqData Value read
+
+ @retval EFI_SUCCESS Decoding change affected.
+ @retval EFI_INVALID_PARAMETER Invalid PIRQ number
+**/
+EFI_STATUS
+EFIAPI
+ReadPirq (
+ IN EFI_LEGACY_INTERRUPT_PROTOCOL *This,
+ IN UINT8 PirqNumber,
+ OUT UINT8 *PirqData
+ );
+
+/**
+ Read the given PIRQ register
+
+ @param[in] This Pointer to LegacyInterrupt Protocol
+ @param[in] PirqNumber The Pirq register 0 = A, 1 = B etc
+ @param[in] PirqData Value read
+
+ @retval EFI_SUCCESS Decoding change affected.
+ @retval EFI_INVALID_PARAMETER Invalid PIRQ number
+**/
+EFI_STATUS
+EFIAPI
+WritePirq (
+ IN EFI_LEGACY_INTERRUPT_PROTOCOL *This,
+ IN UINT8 PirqNumber,
+ IN UINT8 PirqData
+ );
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/LegacyInterrupt/Dxe/LegacyInterrupt.inf b/ReferenceCode/Chipset/LynxPoint/LegacyInterrupt/Dxe/LegacyInterrupt.inf
new file mode 100644
index 0000000..29c9cbc
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/LegacyInterrupt/Dxe/LegacyInterrupt.inf
@@ -0,0 +1,73 @@
+## @file
+# Component description file for LegacyBios module.
+#
+#@copyright
+# Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+##
+
+[defines]
+BASE_NAME = LegacyInterrupt
+FILE_GUID = C1C418F9-591D-461c-82A2-B9CD96DFEA86
+COMPONENT_TYPE = BS_DRIVER
+
+[sources.common]
+ LegacyInterrupt.c
+ LegacyInterrupt.h
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueDxeDriverEntryPoint.c
+
+[includes.common]
+ $(EDK_SOURCE)/Foundation/Efi
+ .
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[libraries.common]
+ EdkIIGlueDxeReportStatusCodeLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkProtocolLib
+ EdkFrameworkProtocolLib
+ EdkIIGlueBasePciLibPciExpress
+
+[nmake.common]
+ IMAGE_ENTRY_POINT=_ModuleEntryPoint
+
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=LegacyInterruptInstall
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \ No newline at end of file
diff --git a/ReferenceCode/Chipset/LynxPoint/Library/DxeRuntimePciLibPciExpress/DxeRuntimePciLibPciExpress.c b/ReferenceCode/Chipset/LynxPoint/Library/DxeRuntimePciLibPciExpress/DxeRuntimePciLibPciExpress.c
new file mode 100644
index 0000000..b9aab0a
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Library/DxeRuntimePciLibPciExpress/DxeRuntimePciLibPciExpress.c
@@ -0,0 +1,2148 @@
+/** @file
+ PCI Library using PC Express access.
+
+@copyright
+ Copyright (c) 2005 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "DxeRuntimePciLibPciExpress.h"
+
+/**
+ Assert the validity of a PCI address. A valid PCI address should contain 1's
+ only in the low 28 bits.
+
+ @param A The address to validate.
+**/
+#define ASSERT_INVALID_PCI_ADDRESS(A) ASSERT (((A) &~0xfffffff) == 0)
+
+/**
+ PCI Express base address
+**/
+STATIC UINTN mPciExpressBaseAddress;
+
+/**
+ Registered memory scope.
+**/
+typedef struct _REGISTERED_ADDRESS_MAP {
+ UINTN PciAddress;
+ UINTN Length;
+ UINTN RuntimeAddress;
+} REGISTERED_ADDRESS_MAP;
+
+#define PCI_LIB_ADDRESS_MAP_MAX_ITEM 64
+
+STATIC REGISTERED_ADDRESS_MAP mPciLibAddressMap[PCI_LIB_ADDRESS_MAP_MAX_ITEM];
+
+STATIC UINTN mPciLibAddressMapIndex = 0;
+
+/**
+ Virtual address notify event
+**/
+STATIC EFI_EVENT mVirtualNofityEvent;
+
+/**
+ Get the base address of PCI Express memory space.
+
+ @param[in] None
+
+ @retval VOID Return The base address of PCI Express.
+**/
+VOID *
+EFIAPI
+GetPciExpressBaseAddress (
+ VOID
+ )
+{
+ return (VOID *) (mPciExpressBaseAddress);
+}
+
+/**
+ Generate Pci Express address.
+ If Address > 0x0FFFFFFF or can't get the match Pci address, then ASSERT().
+
+ @param[in] Address Pci address.
+
+ @retval UINTN Pci Express address.
+**/
+static
+UINTN
+EFIAPI
+PreparePciExpressAddress (
+ IN UINTN Address
+ )
+{
+ UINTN Index;
+
+ ASSERT_INVALID_PCI_ADDRESS (Address);
+
+ if (EfiAtRuntime () == FALSE) {
+ return mPciExpressBaseAddress + Address;
+ }
+
+ for (Index = 0; Index < PCI_LIB_ADDRESS_MAP_MAX_ITEM; Index++) {
+ if ((Address >= mPciLibAddressMap[Index].PciAddress) &&
+ (Address < mPciLibAddressMap[Index].PciAddress + mPciLibAddressMap[Index].Length)
+ ) {
+ return mPciLibAddressMap[Index].RuntimeAddress + (Address - mPciLibAddressMap[Index].PciAddress);
+ }
+ }
+
+ ASSERT (FALSE);
+ EFI_DEADLOOP ();
+ return 0;
+}
+
+/**
+ Reads and returns the 8-bit PCI configuration register specified by Address.
+ This function must guarantee that all PCI read and write operations are
+ serialized.
+ If Address > 0x0FFFFFFF, then ASSERT().
+
+ @param[in] Address Address that encodes the PCI Bus, Device, Function and Register.
+
+ @retval UINT8 return The read value from the PCI configuration register.
+**/
+UINT8
+EFIAPI
+PciExpressRead8 (
+ IN UINTN Address
+ )
+{
+ return MmioRead8 (PreparePciExpressAddress (Address));
+}
+
+/**
+ Writes the 8-bit PCI configuration register specified by Address with the
+ value specified by Value. Value is returned. This function must guarantee
+ that all PCI read and write operations are serialized.
+ If Address > 0x0FFFFFFF, then ASSERT().
+
+ @param[in] Address Address that encodes the PCI Bus, Device, Function and Register.
+ @param[in] Value The value to write
+
+ @retval UINT8 The value to write to the MMIO register.
+**/
+UINT8
+EFIAPI
+PciExpressWrite8 (
+ IN UINTN Address,
+ IN UINT8 Value
+ )
+{
+ return MmioWrite8 (PreparePciExpressAddress (Address), Value);
+}
+
+/**
+ Reads the 8-bit PCI configuration register specified by Address, performs a
+ bitwise inclusive OR between the read result and the value specified by
+ OrData, and writes the result to the 8-bit PCI configuration register
+ specified by Address. The value written to the PCI configuration register is
+ returned. This function must guarantee that all PCI read and write operations
+ are serialized.
+ If Address > 0x0FFFFFFF, then ASSERT().
+
+ @param[in] Address Address that encodes the PCI Bus, Device, Function and Register.
+ @param[in] OrData The value to OR with the PCI configuration register.
+
+ @retval UINT8 The value written back to the PCI configuration register.
+**/
+UINT8
+EFIAPI
+PciExpressOr8 (
+ IN UINTN Address,
+ IN UINT8 OrData
+ )
+{
+ return MmioOr8 (PreparePciExpressAddress (Address), OrData);
+}
+
+/**
+ Reads the 8-bit PCI configuration register specified by Address, performs a
+ bitwise AND between the read result and the value specified by AndData, and
+ writes the result to the 8-bit PCI configuration register specified by
+ Address. The value written to the PCI configuration register is returned.
+ This function must guarantee that all PCI read and write operations are
+ serialized.
+ If Address > 0x0FFFFFFF, then ASSERT().
+
+ @param[in] Address Address that encodes the PCI Bus, Device, Function and Register.
+ @param[in] AndData The value to AND with the PCI configuration register.
+
+ @retval UINT8 The value written back to the PCI configuration register.
+**/
+UINT8
+EFIAPI
+PciExpressAnd8 (
+ IN UINTN Address,
+ IN UINT8 AndData
+ )
+{
+ return MmioAnd8 (PreparePciExpressAddress (Address), AndData);
+}
+
+/**
+ Reads the 8-bit PCI configuration register specified by Address, performs a
+ bitwise AND between the read result and the value specified by AndData,
+ performs a bitwise inclusive OR between the result of the AND operation and
+ the value specified by OrData, and writes the result to the 8-bit PCI
+ configuration register specified by Address. The value written to the PCI
+ configuration register is returned. This function must guarantee that all PCI
+ read and write operations are serialized.
+ If Address > 0x0FFFFFFF, then ASSERT().
+
+ @param[in] Address Address that encodes the PCI Bus, Device, Function and Register.
+ @param[in] AndData The value to AND with the PCI configuration register.
+ @param[in] OrData The value to OR with the result of the AND operation.
+
+ @retval UINT8 The value written back to the PCI configuration register.
+**/
+UINT8
+EFIAPI
+PciExpressAndThenOr8 (
+ IN UINTN Address,
+ IN UINT8 AndData,
+ IN UINT8 OrData
+ )
+{
+ return MmioAndThenOr8 (
+ PreparePciExpressAddress (Address),
+ AndData,
+ OrData
+ );
+}
+
+/**
+ Reads the bit field in an 8-bit PCI configuration register. The bit field is
+ specified by the StartBit and the EndBit. The value of the bit field is
+ returned.
+ If Address > 0x0FFFFFFF, then ASSERT().
+ If StartBit is greater than 7, then ASSERT().
+ If EndBit is greater than 7, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
+
+ @param[in] Address PCI configuration register to read.
+ @param[in] StartBit The original of the least significant bit in the bit field. Range 0..7.
+ @param[in] EndBit The original of the most significant bit in the bit field. Range 0..7.
+
+ @retval UINT8 The value of the bit field read from the PCI configuration register.
+**/
+UINT8
+EFIAPI
+PciExpressBitFieldRead8 (
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
+ )
+{
+ return MmioBitFieldRead8 (
+ PreparePciExpressAddress (Address),
+ StartBit,
+ EndBit
+ );
+}
+
+/**
+ Writes Value to the bit field of the PCI configuration register. The bit
+ field is specified by the StartBit and the EndBit. All other bits in the
+ destination PCI configuration register are preserved. The new value of the
+ 8-bit register is returned.
+ If Address > 0x0FFFFFFF, then ASSERT().
+ If StartBit is greater than 7, then ASSERT().
+ If EndBit is greater than 7, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
+
+ @param[in] Address PCI configuration register to write.
+ @param[in] StartBit The original of the least significant bit in the bit field. Range 0..7.
+ @param[in] EndBit The original of the most significant bit in the bit field. Range 0..7.
+ @param[in] Value New value of the bit field.
+
+ @retval UINT8 The value written back to the PCI configuration register.
+**/
+UINT8
+EFIAPI
+PciExpressBitFieldWrite8 (
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 Value
+ )
+{
+ return MmioBitFieldWrite8 (
+ PreparePciExpressAddress (Address),
+ StartBit,
+ EndBit,
+ Value
+ );
+}
+
+/**
+ Reads the 8-bit PCI configuration register specified by Address, performs a
+ bitwise inclusive OR between the read result and the value specified by
+ OrData, and writes the result to the 8-bit PCI configuration register
+ specified by Address. The value written to the PCI configuration register is
+ returned. This function must guarantee that all PCI read and write operations
+ are serialized. Extra left bits in OrData are stripped.
+ If Address > 0x0FFFFFFF, then ASSERT().
+ If StartBit is greater than 7, then ASSERT().
+ If EndBit is greater than 7, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
+
+ @param[in] Address PCI configuration register to write.
+ @param[in] StartBit The original of the least significant bit in the bit field. Range 0..7.
+ @param[in] EndBit The original of the most significant bit in the bit field. Range 0..7.
+ @param[in] OrData The value to OR with the PCI configuration register.
+
+ @retval UINT8 The value written back to the PCI configuration register.
+**/
+UINT8
+EFIAPI
+PciExpressBitFieldOr8 (
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 OrData
+ )
+{
+ return MmioBitFieldOr8 (
+ PreparePciExpressAddress (Address),
+ StartBit,
+ EndBit,
+ OrData
+ );
+}
+
+/**
+ Reads the 8-bit PCI configuration register specified by Address, performs a
+ bitwise AND between the read result and the value specified by AndData, and
+ writes the result to the 8-bit PCI configuration register specified by
+ Address. The value written to the PCI configuration register is returned.
+ This function must guarantee that all PCI read and write operations are
+ serialized. Extra left bits in AndData are stripped.
+ If Address > 0x0FFFFFFF, then ASSERT().
+ If StartBit is greater than 7, then ASSERT().
+ If EndBit is greater than 7, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
+
+ @param[in] Address PCI configuration register to write.
+ @param[in] StartBit The original of the least significant bit in the bit field. Range 0..7.
+ @param[in] EndBit The original of the most significant bit in the bit field. Range 0..7.
+ @param[in] AndData The value to AND with the PCI configuration register.
+
+ @retval UINT8 The value written back to the PCI configuration register.
+**/
+UINT8
+EFIAPI
+PciExpressBitFieldAnd8 (
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData
+ )
+{
+ return MmioBitFieldAnd8 (
+ PreparePciExpressAddress (Address),
+ StartBit,
+ EndBit,
+ AndData
+ );
+}
+
+/**
+ Reads the 8-bit PCI configuration register specified by Address, performs a
+ bitwise AND followed by a bitwise inclusive OR between the read result and
+ the value specified by AndData, and writes the result to the 8-bit PCI
+ configuration register specified by Address. The value written to the PCI
+ configuration register is returned. This function must guarantee that all PCI
+ read and write operations are serialized. Extra left bits in both AndData and
+ OrData are stripped.
+ If Address > 0x0FFFFFFF, then ASSERT().
+ If StartBit is greater than 7, then ASSERT().
+ If EndBit is greater than 7, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
+
+ @param[in] Address PCI configuration register to write.
+ @param[in] StartBit The original of the least significant bit in the bit field. Range 0..7.
+ @param[in] EndBit The original of the most significant bit in the bit field. Range 0..7.
+ @param[in] AndData The value to AND with the PCI configuration register.
+ @param[in] OrData The value to OR with the result of the AND operation.
+
+ @retval UINT8 The value written back to the PCI configuration register.
+**/
+UINT8
+EFIAPI
+PciExpressBitFieldAndThenOr8 (
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData,
+ IN UINT8 OrData
+ )
+{
+ return MmioBitFieldAndThenOr8 (
+ PreparePciExpressAddress (Address),
+ StartBit,
+ EndBit,
+ AndData,
+ OrData
+ );
+}
+
+/**
+ Reads and returns the 16-bit PCI configuration register specified by Address.
+ This function must guarantee that all PCI read and write operations are
+ serialized.
+ If Address > 0x0FFFFFFF, then ASSERT().
+ If Address is not aligned on a 16-bit boundary, then ASSERT().
+
+ @param[in] Address Address that encodes the PCI Bus, Device, Function and Register.
+
+ @retval UINT16 The read value from the PCI configuration register.
+**/
+UINT16
+EFIAPI
+PciExpressRead16 (
+ IN UINTN Address
+ )
+{
+ return MmioRead16 (PreparePciExpressAddress (Address));
+}
+
+/**
+ Writes the 16-bit PCI configuration register specified by Address with the
+ value specified by Value. Value is returned. This function must guarantee
+ that all PCI read and write operations are serialized.
+ If Address > 0x0FFFFFFF, then ASSERT().
+ If Address is not aligned on a 16-bit boundary, then ASSERT().
+
+ @param[in] Address Address that encodes the PCI Bus, Device, Function and Register.
+ @param[in] Value The value to write.
+
+ @retval UINT16 The value written to the PCI configuration register.
+**/
+UINT16
+EFIAPI
+PciExpressWrite16 (
+ IN UINTN Address,
+ IN UINT16 Value
+ )
+{
+ return MmioWrite16 (PreparePciExpressAddress (Address), Value);
+}
+
+/**
+ Reads the 16-bit PCI configuration register specified by Address, performs a
+ bitwise inclusive OR between the read result and the value specified by
+ OrData, and writes the result to the 16-bit PCI configuration register
+ specified by Address. The value written to the PCI configuration register is
+ returned. This function must guarantee that all PCI read and write operations
+ are serialized.
+ If Address > 0x0FFFFFFF, then ASSERT().
+ If Address is not aligned on a 16-bit boundary, then ASSERT().
+
+ @param[in] Address Address that encodes the PCI Bus, Device, Function and Register.
+ @param[in] OrData The value to OR with the PCI configuration register.
+
+ @retval UINT16 The value written back to the PCI configuration register.
+**/
+UINT16
+EFIAPI
+PciExpressOr16 (
+ IN UINTN Address,
+ IN UINT16 OrData
+ )
+{
+ return MmioOr16 (PreparePciExpressAddress (Address), OrData);
+}
+
+/**
+ Reads the 16-bit PCI configuration register specified by Address, performs a
+ bitwise AND between the read result and the value specified by AndData, and
+ writes the result to the 16-bit PCI configuration register specified by
+ Address. The value written to the PCI configuration register is returned.
+ This function must guarantee that all PCI read and write operations are
+ serialized.
+ If Address > 0x0FFFFFFF, then ASSERT().
+ If Address is not aligned on a 16-bit boundary, then ASSERT().
+
+ @param[in] Address Address that encodes the PCI Bus, Device, Function and Register.
+ @param[in] AndData The value to AND with the PCI configuration register.
+
+ @retval UINT16 The value written back to the PCI configuration register.
+**/
+UINT16
+EFIAPI
+PciExpressAnd16 (
+ IN UINTN Address,
+ IN UINT16 AndData
+ )
+{
+ return MmioAnd16 (PreparePciExpressAddress (Address), AndData);
+}
+
+/**
+ Reads the 16-bit PCI configuration register specified by Address, performs a
+ bitwise AND between the read result and the value specified by AndData,
+ performs a bitwise inclusive OR between the result of the AND operation and
+ the value specified by OrData, and writes the result to the 16-bit PCI
+ configuration register specified by Address. The value written to the PCI
+ configuration register is returned. This function must guarantee that all PCI
+ read and write operations are serialized.
+ If Address > 0x0FFFFFFF, then ASSERT().
+ If Address is not aligned on a 16-bit boundary, then ASSERT().
+
+ @param[in] Address Address that encodes the PCI Bus, Device, Function and Register.
+ @param[in] AndData The value to AND with the PCI configuration register.
+ @param[in] OrData The value to OR with the result of the AND operation.
+
+ @retval UINT16 The value written back to the PCI configuration register.
+**/
+UINT16
+EFIAPI
+PciExpressAndThenOr16 (
+ IN UINTN Address,
+ IN UINT16 AndData,
+ IN UINT16 OrData
+ )
+{
+ return MmioAndThenOr16 (
+ PreparePciExpressAddress (Address),
+ AndData,
+ OrData
+ );
+}
+
+/**
+ Reads the bit field in a 16-bit PCI configuration register. The bit field is
+ specified by the StartBit and the EndBit. The value of the bit field is
+ returned.
+ If Address > 0x0FFFFFFF, then ASSERT().
+ If Address is not aligned on a 16-bit boundary, then ASSERT().
+ If StartBit is greater than 15, then ASSERT().
+ If EndBit is greater than 15, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
+
+ @param[in] Address PCI configuration register to read.
+ @param[in] StartBit The original of the least significant bit in the bit field. Range 0..15.
+ @param[in] EndBit The original of the most significant bit in the bit field. Range 0..15.
+
+ @retval UINT16 The value of the bit field read from the PCI configuration register.
+**/
+UINT16
+EFIAPI
+PciExpressBitFieldRead16 (
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
+ )
+{
+ return MmioBitFieldRead16 (
+ PreparePciExpressAddress (Address),
+ StartBit,
+ EndBit
+ );
+}
+
+/**
+ Writes Value to the bit field of the PCI configuration register. The bit
+ field is specified by the StartBit and the EndBit. All other bits in the
+ destination PCI configuration register are preserved. The new value of the
+ 16-bit register is returned.
+ If Address > 0x0FFFFFFF, then ASSERT().
+ If Address is not aligned on a 16-bit boundary, then ASSERT().
+ If StartBit is greater than 15, then ASSERT().
+ If EndBit is greater than 15, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
+
+ @param[in] Address PCI configuration register to write.
+ @param[in] StartBit The original of the least significant bit in the bit field. Range 0..15.
+ @param[in] EndBit The original of the most significant bit in the bit field. Range 0..15.
+ @param[in] Value New value of the bit field.
+
+ @retval UINT16 The value written back to the PCI configuration register.
+**/
+UINT16
+EFIAPI
+PciExpressBitFieldWrite16 (
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 Value
+ )
+{
+ return MmioBitFieldWrite16 (
+ PreparePciExpressAddress (Address),
+ StartBit,
+ EndBit,
+ Value
+ );
+}
+
+/**
+ Reads the 16-bit PCI configuration register specified by Address, performs a
+ bitwise inclusive OR between the read result and the value specified by
+ OrData, and writes the result to the 16-bit PCI configuration register
+ specified by Address. The value written to the PCI configuration register is
+ returned. This function must guarantee that all PCI read and write operations
+ are serialized. Extra left bits in OrData are stripped.
+ If Address > 0x0FFFFFFF, then ASSERT().
+ If Address is not aligned on a 16-bit boundary, then ASSERT().
+ If StartBit is greater than 15, then ASSERT().
+ If EndBit is greater than 15, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
+
+ @param[in] Address PCI configuration register to write.
+ @param[in] StartBit The original of the least significant bit in the bit field. Range 0..15.
+ @param[in] EndBit The original of the most significant bit in the bit field. Range 0..15.
+ @param[in] OrData The value to OR with the PCI configuration register.
+
+ @retval UINT16 The value written back to the PCI configuration register.
+**/
+UINT16
+EFIAPI
+PciExpressBitFieldOr16 (
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 OrData
+ )
+{
+ return MmioBitFieldOr16 (
+ PreparePciExpressAddress (Address),
+ StartBit,
+ EndBit,
+ OrData
+ );
+}
+
+/**
+ Reads the 16-bit PCI configuration register specified by Address, performs a
+ bitwise AND between the read result and the value specified by AndData, and
+ writes the result to the 16-bit PCI configuration register specified by
+ Address. The value written to the PCI configuration register is returned.
+ This function must guarantee that all PCI read and write operations are
+ serialized. Extra left bits in AndData are stripped.
+ If Address > 0x0FFFFFFF, then ASSERT().
+ If Address is not aligned on a 16-bit boundary, then ASSERT().
+ If StartBit is greater than 15, then ASSERT().
+ If EndBit is greater than 15, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
+
+ @param[in] Address PCI configuration register to write.
+ @param[in] StartBit The original of the least significant bit in the bit field. Range 0..15.
+ @param[in] EndBit The original of the most significant bit in the bit field. Range 0..15.
+ @param[in] AndData The value to AND with the PCI configuration register.
+
+ @retval UINT16 The value written back to the PCI configuration register.
+**/
+UINT16
+EFIAPI
+PciExpressBitFieldAnd16 (
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData
+ )
+{
+ return MmioBitFieldAnd16 (
+ PreparePciExpressAddress (Address),
+ StartBit,
+ EndBit,
+ AndData
+ );
+}
+
+/**
+ Reads the 16-bit PCI configuration register specified by Address, performs a
+ bitwise AND followed by a bitwise inclusive OR between the read result and
+ the value specified by AndData, and writes the result to the 16-bit PCI
+ configuration register specified by Address. The value written to the PCI
+ configuration register is returned. This function must guarantee that all PCI
+ read and write operations are serialized. Extra left bits in both AndData and
+ OrData are stripped.
+ If Address > 0x0FFFFFFF, then ASSERT().
+ If Address is not aligned on a 16-bit boundary, then ASSERT().
+ If StartBit is greater than 15, then ASSERT().
+ If EndBit is greater than 15, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
+
+ @param[in] Address PCI configuration register to write.
+ @param[in] StartBit The original of the least significant bit in the bit field. Range 0..15.
+ @param[in] EndBit The original of the most significant bit in the bit field. Range 0..15.
+ @param[in] AndData The value to AND with the PCI configuration register.
+ @param[in] OrData The value to OR with the result of the AND operation.
+
+ @retval UINT16 The value written back to the PCI configuration register.
+**/
+UINT16
+EFIAPI
+PciExpressBitFieldAndThenOr16 (
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData,
+ IN UINT16 OrData
+ )
+{
+ return MmioBitFieldAndThenOr16 (
+ PreparePciExpressAddress (Address),
+ StartBit,
+ EndBit,
+ AndData,
+ OrData
+ );
+}
+
+/**
+ Reads and returns the 32-bit PCI configuration register specified by Address.
+ This function must guarantee that all PCI read and write operations are
+ serialized.
+ If Address > 0x0FFFFFFF, then ASSERT().
+ If Address is not aligned on a 32-bit boundary, then ASSERT().
+
+ @param[in] Address Address that encodes the PCI Bus, Device, Function and Register.
+
+ @retval UINT32 The read value from the PCI configuration register.
+**/
+UINT32
+EFIAPI
+PciExpressRead32 (
+ IN UINTN Address
+ )
+{
+ return MmioRead32 (PreparePciExpressAddress (Address));
+}
+
+/**
+ Writes the 32-bit PCI configuration register specified by Address with the
+ value specified by Value. Value is returned. This function must guarantee
+ that all PCI read and write operations are serialized.
+ If Address > 0x0FFFFFFF, then ASSERT().
+ If Address is not aligned on a 32-bit boundary, then ASSERT().
+
+ @param[in] Address Address that encodes the PCI Bus, Device, Function and Register.
+ @param[in] Value The value to write.
+
+ @retval UINT32 The value written to the PCI configuration register.
+**/
+UINT32
+EFIAPI
+PciExpressWrite32 (
+ IN UINTN Address,
+ IN UINT32 Value
+ )
+{
+ return MmioWrite32 (PreparePciExpressAddress (Address), Value);
+}
+
+/**
+ Reads the 32-bit PCI configuration register specified by Address, performs a
+ bitwise inclusive OR between the read result and the value specified by
+ OrData, and writes the result to the 32-bit PCI configuration register
+ specified by Address. The value written to the PCI configuration register is
+ returned. This function must guarantee that all PCI read and write operations
+ are serialized.
+ If Address > 0x0FFFFFFF, then ASSERT().
+ If Address is not aligned on a 32-bit boundary, then ASSERT().
+
+ @param[in] Address Address that encodes the PCI Bus, Device, Function and Register.
+ @param[in] OrData The value to OR with the PCI configuration register.
+
+ @retval UINT32 The value written back to the PCI configuration register.
+**/
+UINT32
+EFIAPI
+PciExpressOr32 (
+ IN UINTN Address,
+ IN UINT32 OrData
+ )
+{
+ return MmioOr32 (PreparePciExpressAddress (Address), OrData);
+}
+
+/**
+ Reads the 32-bit PCI configuration register specified by Address, performs a
+ bitwise AND between the read result and the value specified by AndData, and
+ writes the result to the 32-bit PCI configuration register specified by
+ Address. The value written to the PCI configuration register is returned.
+ This function must guarantee that all PCI read and write operations are
+ serialized.
+ If Address > 0x0FFFFFFF, then ASSERT().
+ If Address is not aligned on a 32-bit boundary, then ASSERT().
+
+ @param[in] Address Address that encodes the PCI Bus, Device, Function and Register.
+ @param[in] AndData The value to AND with the PCI configuration register.
+
+ @retval UINT32 The value written back to the PCI configuration register.
+**/
+UINT32
+EFIAPI
+PciExpressAnd32 (
+ IN UINTN Address,
+ IN UINT32 AndData
+ )
+{
+ return MmioAnd32 (PreparePciExpressAddress (Address), AndData);
+}
+
+/**
+ Reads the 32-bit PCI configuration register specified by Address, performs a
+ bitwise AND between the read result and the value specified by AndData,
+ performs a bitwise inclusive OR between the result of the AND operation and
+ the value specified by OrData, and writes the result to the 32-bit PCI
+ configuration register specified by Address. The value written to the PCI
+ configuration register is returned. This function must guarantee that all PCI
+ read and write operations are serialized.
+ If Address > 0x0FFFFFFF, then ASSERT().
+ If Address is not aligned on a 32-bit boundary, then ASSERT().
+
+ @param[in] Address Address that encodes the PCI Bus, Device, Function and Register.
+ @param[in] AndData The value to AND with the PCI configuration register.
+ @param[in] OrData The value to OR with the result of the AND operation.
+
+ @retval UINT32 The value written back to the PCI configuration register.
+**/
+UINT32
+EFIAPI
+PciExpressAndThenOr32 (
+ IN UINTN Address,
+ IN UINT32 AndData,
+ IN UINT32 OrData
+ )
+{
+ return MmioAndThenOr32 (
+ PreparePciExpressAddress (Address),
+ AndData,
+ OrData
+ );
+}
+
+/**
+ Reads the bit field in a 32-bit PCI configuration register. The bit field is
+ specified by the StartBit and the EndBit. The value of the bit field is
+ returned.
+ If Address > 0x0FFFFFFF, then ASSERT().
+ If Address is not aligned on a 32-bit boundary, then ASSERT().
+ If StartBit is greater than 31, then ASSERT().
+ If EndBit is greater than 31, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
+
+ @param[in] Address PCI configuration register to read.
+ @param[in] StartBit The original of the least significant bit in the bit field. Range 0..31.
+ @param[in] EndBit The original of the most significant bit in the bit field. Range 0..31.
+
+ @retval UNT32 The value of the bit field read from the PCI configuration register.
+**/
+UINT32
+EFIAPI
+PciExpressBitFieldRead32 (
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
+ )
+{
+ return MmioBitFieldRead32 (
+ PreparePciExpressAddress (Address),
+ StartBit,
+ EndBit
+ );
+}
+
+/**
+ Writes Value to the bit field of the PCI configuration register. The bit
+ field is specified by the StartBit and the EndBit. All other bits in the
+ destination PCI configuration register are preserved. The new value of the
+ 32-bit register is returned.
+ If Address > 0x0FFFFFFF, then ASSERT().
+ If Address is not aligned on a 32-bit boundary, then ASSERT().
+ If StartBit is greater than 31, then ASSERT().
+ If EndBit is greater than 31, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
+
+ @param[in] Address PCI configuration register to write.
+ @param[in] StartBit The original of the least significant bit in the bit field. Range 0..31.
+ @param[in] EndBit The original of the most significant bit in the bit field. Range 0..31.
+ @param[in] Value New value of the bit field.
+
+ @retval UINT32 The value written back to the PCI configuration register.
+**/
+UINT32
+EFIAPI
+PciExpressBitFieldWrite32 (
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 Value
+ )
+{
+ return MmioBitFieldWrite32 (
+ PreparePciExpressAddress (Address),
+ StartBit,
+ EndBit,
+ Value
+ );
+}
+
+/**
+ Reads the 32-bit PCI configuration register specified by Address, performs a
+ bitwise inclusive OR between the read result and the value specified by
+ OrData, and writes the result to the 32-bit PCI configuration register
+ specified by Address. The value written to the PCI configuration register is
+ returned. This function must guarantee that all PCI read and write operations
+ are serialized. Extra left bits in OrData are stripped.
+ If Address > 0x0FFFFFFF, then ASSERT().
+ If Address is not aligned on a 32-bit boundary, then ASSERT().
+ If StartBit is greater than 31, then ASSERT().
+ If EndBit is greater than 31, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
+
+ @param[in] Address PCI configuration register to write.
+ @param[in] StartBit The original of the least significant bit in the bit field. Range 0..31.
+ @param[in] EndBit The original of the most significant bit in the bit field. Range 0..31.
+ @param[in] OrData The value to OR with the PCI configuration register.
+
+ @retval UINT32 The value written back to the PCI configuration register.
+**/
+UINT32
+EFIAPI
+PciExpressBitFieldOr32 (
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 OrData
+ )
+{
+ return MmioBitFieldOr32 (
+ PreparePciExpressAddress (Address),
+ StartBit,
+ EndBit,
+ OrData
+ );
+}
+
+/**
+ Reads the 32-bit PCI configuration register specified by Address, performs a
+ bitwise AND between the read result and the value specified by AndData, and
+ writes the result to the 32-bit PCI configuration register specified by
+ Address. The value written to the PCI configuration register is returned.
+ This function must guarantee that all PCI read and write operations are
+ serialized. Extra left bits in AndData are stripped.
+ If Address > 0x0FFFFFFF, then ASSERT().
+ If Address is not aligned on a 32-bit boundary, then ASSERT().
+ If StartBit is greater than 31, then ASSERT().
+ If EndBit is greater than 31, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
+
+ @param[in] Address PCI configuration register to write.
+ @param[in] StartBit The original of the least significant bit in the bit field. Range 0..31.
+ @param[in] EndBit The original of the most significant bit in the bit field. Range 0..31.
+ @param[in] AndData The value to AND with the PCI configuration register.
+
+ @retval UINT32 The value written back to the PCI configuration register.
+**/
+UINT32
+EFIAPI
+PciExpressBitFieldAnd32 (
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData
+ )
+{
+ return MmioBitFieldAnd32 (
+ PreparePciExpressAddress (Address),
+ StartBit,
+ EndBit,
+ AndData
+ );
+}
+
+/**
+ Reads the 32-bit PCI configuration register specified by Address, performs a
+ bitwise AND followed by a bitwise inclusive OR between the read result and
+ the value specified by AndData, and writes the result to the 32-bit PCI
+ configuration register specified by Address. The value written to the PCI
+ configuration register is returned. This function must guarantee that all PCI
+ read and write operations are serialized. Extra left bits in both AndData and
+ OrData are stripped.
+ If Address > 0x0FFFFFFF, then ASSERT().
+ If Address is not aligned on a 32-bit boundary, then ASSERT().
+ If StartBit is greater than 31, then ASSERT().
+ If EndBit is greater than 31, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
+
+ @param[in] Address PCI configuration register to write.
+ @param[in] StartBit The original of the least significant bit in the bit field. Range 0..31.
+ @param[in] EndBit The original of the most significant bit in the bit field. Range 0..31.
+ @param[in] AndData The value to AND with the PCI configuration register.
+ @param[in] OrData The value to OR with the result of the AND operation.
+
+ @retval UINT32 The value written back to the PCI configuration register.
+**/
+UINT32
+EFIAPI
+PciExpressBitFieldAndThenOr32 (
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData,
+ IN UINT32 OrData
+ )
+{
+ return MmioBitFieldAndThenOr32 (
+ PreparePciExpressAddress (Address),
+ StartBit,
+ EndBit,
+ AndData,
+ OrData
+ );
+}
+
+/**
+ Reads the range of PCI configuration registers specified by StartAddress and
+ Size into the buffer specified by Buffer. This function only allows the PCI
+ configuration registers from a single PCI function to be read. Size is
+ returned. When possible 32-bit PCI configuration read cycles are used to read
+ from StartAdress to StartAddress + Size. Due to alignment restrictions, 8-bit
+ and 16-bit PCI configuration read cycles may be used at the beginning and the
+ end of the range.
+ If StartAddress > 0x0FFFFFFF, then ASSERT().
+ If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT().
+ If Size > 0 and Buffer is NULL, then ASSERT().
+
+ @param[in] StartAddress Starting address that encodes the PCI Bus, Device, Function and Register.
+ @param[in] Size Size in bytes of the transfer.
+ @param[in] Buffer Pointer to a buffer receiving the data read.
+
+ @retval UINTN Size in bytes of the transfer.
+**/
+UINTN
+EFIAPI
+PciExpressReadBuffer (
+ IN UINTN StartAddress,
+ IN UINTN Size,
+ OUT VOID *Buffer
+ )
+{
+ UINTN ReturnValue;
+
+ ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);
+
+ if (Size == 0) {
+ return Size;
+ }
+
+ ASSERT (Buffer != NULL);
+
+ //
+ // Save Size for return
+ //
+ ReturnValue = Size;
+
+ if ((StartAddress & 1) != 0) {
+ //
+ // Read a byte if StartAddress is byte aligned
+ //
+ *(volatile UINT8 *) Buffer = PciExpressRead8 (StartAddress);
+ StartAddress += sizeof (UINT8);
+ Size -= sizeof (UINT8);
+ Buffer = (UINT8 *) Buffer + 1;
+ }
+
+ if (Size >= sizeof (UINT16) && (StartAddress & 2) != 0) {
+ //
+ // Read a word if StartAddress is word aligned
+ //
+ *(volatile UINT16 *) Buffer = PciExpressRead16 (StartAddress);
+ StartAddress += sizeof (UINT16);
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *) Buffer + 1;
+ }
+
+ while (Size >= sizeof (UINT32)) {
+ //
+ // Read as many double words as possible
+ //
+ *(volatile UINT32 *) Buffer = PciExpressRead32 (StartAddress);
+ StartAddress += sizeof (UINT32);
+ Size -= sizeof (UINT32);
+ Buffer = (UINT32 *) Buffer + 1;
+ }
+
+ if (Size >= sizeof (UINT16)) {
+ //
+ // Read the last remaining word if exist
+ //
+ *(volatile UINT16 *) Buffer = PciExpressRead16 (StartAddress);
+ StartAddress += sizeof (UINT16);
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *) Buffer + 1;
+ }
+
+ if (Size >= sizeof (UINT8)) {
+ //
+ // Read the last remaining byte if exist
+ //
+ *(volatile UINT8 *) Buffer = PciExpressRead8 (StartAddress);
+ }
+
+ return ReturnValue;
+}
+
+/**
+ Writes the range of PCI configuration registers specified by StartAddress and
+ Size from the buffer specified by Buffer. This function only allows the PCI
+ configuration registers from a single PCI function to be written. Size is
+ returned. When possible 32-bit PCI configuration write cycles are used to
+ write from StartAdress to StartAddress + Size. Due to alignment restrictions,
+ 8-bit and 16-bit PCI configuration write cycles may be used at the beginning
+ and the end of the range.
+ If StartAddress > 0x0FFFFFFF, then ASSERT().
+ If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT().
+ If Size > 0 and Buffer is NULL, then ASSERT().
+
+ @param[in] StartAddress Starting address that encodes the PCI Bus, Device, Function and Register.
+ @param[in] Size Size in bytes of the transfer.
+ @param[in] Buffer Pointer to a buffer containing the data to write.
+
+ @retval UINTN Size in bytes of the transfer.
+**/
+UINTN
+EFIAPI
+PciExpressWriteBuffer (
+ IN UINTN StartAddress,
+ IN UINTN Size,
+ IN VOID *Buffer
+ )
+{
+ UINTN ReturnValue;
+
+ ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);
+
+ if (Size == 0) {
+ return 0;
+ }
+
+ ASSERT (Buffer != NULL);
+
+ //
+ // Save Size for return
+ //
+ ReturnValue = Size;
+
+ if ((StartAddress & 1) != 0) {
+ //
+ // Write a byte if StartAddress is byte aligned
+ //
+ PciExpressWrite8 (StartAddress, *(UINT8 *) Buffer);
+ StartAddress += sizeof (UINT8);
+ Size -= sizeof (UINT8);
+ Buffer = (UINT8 *) Buffer + 1;
+ }
+
+ if (Size >= sizeof (UINT16) && (StartAddress & 2) != 0) {
+ //
+ // Write a word if StartAddress is word aligned
+ //
+ PciExpressWrite16 (StartAddress, *(UINT16 *) Buffer);
+ StartAddress += sizeof (UINT16);
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *) Buffer + 1;
+ }
+
+ while (Size >= sizeof (UINT32)) {
+ //
+ // Write as many double words as possible
+ //
+ PciExpressWrite32 (StartAddress, *(UINT32 *) Buffer);
+ StartAddress += sizeof (UINT32);
+ Size -= sizeof (UINT32);
+ Buffer = (UINT32 *) Buffer + 1;
+ }
+
+ if (Size >= sizeof (UINT16)) {
+ //
+ // Write the last remaining word if exist
+ //
+ PciExpressWrite16 (StartAddress, *(UINT16 *) Buffer);
+ StartAddress += sizeof (UINT16);
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *) Buffer + 1;
+ }
+
+ if (Size >= sizeof (UINT8)) {
+ //
+ // Write the last remaining byte if exist
+ //
+ PciExpressWrite8 (StartAddress, *(UINT8 *) Buffer);
+ }
+
+ return ReturnValue;
+}
+
+/**
+ Reads and returns the 8-bit PCI configuration register specified by Address.
+ This function must guarantee that all PCI read and write operations are
+ serialized.
+ If Address > 0x0FFFFFFF, then ASSERT().
+
+ @param[in] Address Address that encodes the PCI Bus, Device, Function and Register.
+
+ @retval UINT8 The read value from the PCI configuration register.
+**/
+UINT8
+EFIAPI
+PciRead8 (
+ IN UINTN Address
+ )
+{
+ return PciExpressRead8 (Address);
+}
+
+/**
+ Writes the 8-bit PCI configuration register specified by Address with the
+ value specified by Value. Value is returned. This function must guarantee
+ that all PCI read and write operations are serialized.
+ If Address > 0x0FFFFFFF, then ASSERT().
+
+ @param[in] Address Address that encodes the PCI Bus, Device, Function and Register.
+ @param[in] Data The value to write.
+
+ @retval UINT8 The value written to the PCI configuration register.
+**/
+UINT8
+EFIAPI
+PciWrite8 (
+ IN UINTN Address,
+ IN UINT8 Data
+ )
+{
+ return PciExpressWrite8 (Address, Data);
+}
+
+/**
+ Reads the 8-bit PCI configuration register specified by Address, performs a
+ bitwise inclusive OR between the read result and the value specified by
+ OrData, and writes the result to the 8-bit PCI configuration register
+ specified by Address. The value written to the PCI configuration register is
+ returned. This function must guarantee that all PCI read and write operations
+ are serialized.
+ If Address > 0x0FFFFFFF, then ASSERT().
+
+ @param[in] Address Address that encodes the PCI Bus, Device, Function and Register.
+ @param[in] OrData The value to OR with the PCI configuration register.
+
+ @retval UINT8 The value written back to the PCI configuration register.
+**/
+UINT8
+EFIAPI
+PciOr8 (
+ IN UINTN Address,
+ IN UINT8 OrData
+ )
+{
+ return PciExpressOr8 (Address, OrData);
+}
+
+/**
+ Reads the 8-bit PCI configuration register specified by Address, performs a
+ bitwise AND between the read result and the value specified by AndData, and
+ writes the result to the 8-bit PCI configuration register specified by
+ Address. The value written to the PCI configuration register is returned.
+ This function must guarantee that all PCI read and write operations are
+ serialized.
+ If Address > 0x0FFFFFFF, then ASSERT().
+
+ @param[in] Address Address that encodes the PCI Bus, Device, Function and Register.
+ @param[in] AndData The value to AND with the PCI configuration register.
+
+ @retval UINT8 The value written back to the PCI configuration register.
+**/
+UINT8
+EFIAPI
+PciAnd8 (
+ IN UINTN Address,
+ IN UINT8 AndData
+ )
+{
+ return PciExpressAnd8 (Address, AndData);
+}
+
+/**
+ Reads the 8-bit PCI configuration register specified by Address, performs a
+ bitwise AND between the read result and the value specified by AndData,
+ performs a bitwise inclusive OR between the result of the AND operation and
+ the value specified by OrData, and writes the result to the 8-bit PCI
+ configuration register specified by Address. The value written to the PCI
+ configuration register is returned. This function must guarantee that all PCI
+ read and write operations are serialized.
+ If Address > 0x0FFFFFFF, then ASSERT().
+
+ @param[in] Address Address that encodes the PCI Bus, Device, Function and Register.
+ @param[in] AndData The value to AND with the PCI configuration register.
+ @param[in] OrData The value to OR with the result of the AND operation.
+
+ @retval UINT8 The value written back to the PCI configuration register.
+**/
+UINT8
+EFIAPI
+PciAndThenOr8 (
+ IN UINTN Address,
+ IN UINT8 AndData,
+ IN UINT8 OrData
+ )
+{
+ return PciExpressAndThenOr8 (Address, AndData, OrData);
+}
+
+/**
+ Reads the bit field in an 8-bit PCI configuration register. The bit field is
+ specified by the StartBit and the EndBit. The value of the bit field is
+ returned.
+ If Address > 0x0FFFFFFF, then ASSERT().
+ If StartBit is greater than 7, then ASSERT().
+ If EndBit is greater than 7, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
+
+ @param[in] Address PCI configuration register to read.
+ @param[in] StartBit The original of the least significant bit in the bit field. Range 0..7.
+ @param[in] EndBit The original of the most significant bit in the bit field. Range 0..7.
+
+ @retval UINT8 The value of the bit field read from the PCI configuration register.
+**/
+UINT8
+EFIAPI
+PciBitFieldRead8 (
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
+ )
+{
+ return PciExpressBitFieldRead8 (Address, StartBit, EndBit);
+}
+
+/**
+ Writes Value to the bit field of the PCI configuration register. The bit
+ field is specified by the StartBit and the EndBit. All other bits in the
+ destination PCI configuration register are preserved. The new value of the
+ 8-bit register is returned.
+ If Address > 0x0FFFFFFF, then ASSERT().
+ If StartBit is greater than 7, then ASSERT().
+ If EndBit is greater than 7, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
+
+ @param[in] Address PCI configuration register to write.
+ @param[in] StartBit The original of the least significant bit in the bit field. Range 0..7.
+ @param[in] EndBit The original of the most significant bit in the bit field. Range 0..7.
+ @param[in] Value New value of the bit field.
+
+ @retval UINT8 The value written back to the PCI configuration register.
+**/
+UINT8
+EFIAPI
+PciBitFieldWrite8 (
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 Value
+ )
+{
+ return PciExpressBitFieldWrite8 (Address, StartBit, EndBit, Value);
+}
+
+/**
+ Reads the 8-bit PCI configuration register specified by Address, performs a
+ bitwise inclusive OR between the read result and the value specified by
+ OrData, and writes the result to the 8-bit PCI configuration register
+ specified by Address. The value written to the PCI configuration register is
+ returned. This function must guarantee that all PCI read and write operations
+ are serialized. Extra left bits in OrData are stripped.
+ If Address > 0x0FFFFFFF, then ASSERT().
+ If StartBit is greater than 7, then ASSERT().
+ If EndBit is greater than 7, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
+
+ @param[in] Address PCI configuration register to write.
+ @param[in] StartBit The original of the least significant bit in the bit field. Range 0..7.
+ @param[in] EndBit The original of the most significant bit in the bit field. Range 0..7.
+ @param[in] OrData The value to OR with the PCI configuration register.
+
+ @retval UINT8 The value written back to the PCI configuration register.
+**/
+UINT8
+EFIAPI
+PciBitFieldOr8 (
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 OrData
+ )
+{
+ return PciExpressBitFieldOr8 (Address, StartBit, EndBit, OrData);
+}
+
+/**
+ Reads the 8-bit PCI configuration register specified by Address, performs a
+ bitwise AND between the read result and the value specified by AndData, and
+ writes the result to the 8-bit PCI configuration register specified by
+ Address. The value written to the PCI configuration register is returned.
+ This function must guarantee that all PCI read and write operations are
+ serialized. Extra left bits in AndData are stripped.
+ If Address > 0x0FFFFFFF, then ASSERT().
+ If StartBit is greater than 7, then ASSERT().
+ If EndBit is greater than 7, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
+
+ @param[in] Address PCI configuration register to write.
+ @param[in] StartBit The original of the least significant bit in the bit field. Range 0..7.
+ @param[in] EndBit The original of the most significant bit in the bit field. Range 0..7.
+ @param[in] AndData The value to AND with the PCI configuration register.
+
+ @retval UINT8 The value written back to the PCI configuration register.
+**/
+UINT8
+EFIAPI
+PciBitFieldAnd8 (
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData
+ )
+{
+ return PciExpressBitFieldAnd8 (Address, StartBit, EndBit, AndData);
+}
+
+/**
+ Reads the 8-bit PCI configuration register specified by Address, performs a
+ bitwise AND followed by a bitwise inclusive OR between the read result and
+ the value specified by AndData, and writes the result to the 8-bit PCI
+ configuration register specified by Address. The value written to the PCI
+ configuration register is returned. This function must guarantee that all PCI
+ read and write operations are serialized. Extra left bits in both AndData and
+ OrData are stripped.
+ If Address > 0x0FFFFFFF, then ASSERT().
+ If StartBit is greater than 7, then ASSERT().
+ If EndBit is greater than 7, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
+
+ @param[in] Address PCI configuration register to write.
+ @param[in] StartBit The original of the least significant bit in the bit field. Range 0..7.
+ @param[in] EndBit The original of the most significant bit in the bit field. Range 0..7.
+ @param[in] AndData The value to AND with the PCI configuration register.
+ @param[in] OrData The value to OR with the result of the AND operation.
+
+ @retval UINT8 The value written back to the PCI configuration register.
+**/
+UINT8
+EFIAPI
+PciBitFieldAndThenOr8 (
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData,
+ IN UINT8 OrData
+ )
+{
+ return PciExpressBitFieldAndThenOr8 (Address, StartBit, EndBit, AndData, OrData);
+}
+
+/**
+ Reads and returns the 16-bit PCI configuration register specified by Address.
+ This function must guarantee that all PCI read and write operations are
+ serialized.
+ If Address > 0x0FFFFFFF, then ASSERT().
+
+ @param[in] Address Address that encodes the PCI Bus, Device, Function and Register.
+
+ @retval UINT16 The read value from the PCI configuration register.
+**/
+UINT16
+EFIAPI
+PciRead16 (
+ IN UINTN Address
+ )
+{
+ return PciExpressRead16 (Address);
+}
+
+/**
+ Writes the 16-bit PCI configuration register specified by Address with the
+ value specified by Value. Value is returned. This function must guarantee
+ that all PCI read and write operations are serialized.
+ If Address > 0x0FFFFFFF, then ASSERT().
+
+ @param[in] Address Address that encodes the PCI Bus, Device, Function and Register.
+ @param[in] Data The value to write.
+
+ @retval UINT16 The value written to the PCI configuration register.
+**/
+UINT16
+EFIAPI
+PciWrite16 (
+ IN UINTN Address,
+ IN UINT16 Data
+ )
+{
+ return PciExpressWrite16 (Address, Data);
+}
+
+/**
+ Reads the 16-bit PCI configuration register specified by Address, performs a
+ bitwise inclusive OR between the read result and the value specified by
+ OrData, and writes the result to the 16-bit PCI configuration register
+ specified by Address. The value written to the PCI configuration register is
+ returned. This function must guarantee that all PCI read and write operations
+ are serialized.
+ If Address > 0x0FFFFFFF, then ASSERT().
+
+ @param[in] Address Address that encodes the PCI Bus, Device, Function and Register.
+ @param[in] OrData The value to OR with the PCI configuration register.
+
+ @retval UINT16 The value written back to the PCI configuration register.
+**/
+UINT16
+EFIAPI
+PciOr16 (
+ IN UINTN Address,
+ IN UINT16 OrData
+ )
+{
+ return PciExpressOr16 (Address, OrData);
+}
+
+/**
+ Reads the 16-bit PCI configuration register specified by Address, performs a
+ bitwise AND between the read result and the value specified by AndData, and
+ writes the result to the 16-bit PCI configuration register specified by
+ Address. The value written to the PCI configuration register is returned.
+ This function must guarantee that all PCI read and write operations are
+ serialized.
+ If Address > 0x0FFFFFFF, then ASSERT().
+
+ @param[in] Address Address that encodes the PCI Bus, Device, Function and Register.
+ @param[in] AndData The value to AND with the PCI configuration register.
+
+ @retval UINT16 The value written back to the PCI configuration register.
+**/
+UINT16
+EFIAPI
+PciAnd16 (
+ IN UINTN Address,
+ IN UINT16 AndData
+ )
+{
+ return PciExpressAnd16 (Address, AndData);
+}
+
+/**
+ Reads the 16-bit PCI configuration register specified by Address, performs a
+ bitwise AND between the read result and the value specified by AndData,
+ performs a bitwise inclusive OR between the result of the AND operation and
+ the value specified by OrData, and writes the result to the 16-bit PCI
+ configuration register specified by Address. The value written to the PCI
+ configuration register is returned. This function must guarantee that all PCI
+ read and write operations are serialized.
+ If Address > 0x0FFFFFFF, then ASSERT().
+
+ @param[in] Address Address that encodes the PCI Bus, Device, Function and Register.
+ @param[in] AndData The value to AND with the PCI configuration register.
+ @param[in] OrData The value to OR with the result of the AND operation.
+
+ @retval UINT16 The value written back to the PCI configuration register.
+**/
+UINT16
+EFIAPI
+PciAndThenOr16 (
+ IN UINTN Address,
+ IN UINT16 AndData,
+ IN UINT16 OrData
+ )
+{
+ return PciExpressAndThenOr16 (Address, AndData, OrData);
+}
+
+/**
+ Reads the bit field in a 16-bit PCI configuration register. The bit field is
+ specified by the StartBit and the EndBit. The value of the bit field is
+ returned.
+ If Address > 0x0FFFFFFF, then ASSERT().
+ If StartBit is greater than 15, then ASSERT().
+ If EndBit is greater than 15, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
+
+ @param[in] Address PCI configuration register to read.
+ @param[in] StartBit The original of the least significant bit in the bit field. Range 0..15.
+ @param[in] EndBit The original of the most significant bit in the bit field. Range 0..15.
+
+ @retval UINT16 The value of the bit field read from the PCI configuration register.
+**/
+UINT16
+EFIAPI
+PciBitFieldRead16 (
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
+ )
+{
+ return PciExpressBitFieldRead16 (Address, StartBit, EndBit);
+}
+
+/**
+ Writes Value to the bit field of the PCI configuration register. The bit
+ field is specified by the StartBit and the EndBit. All other bits in the
+ destination PCI configuration register are preserved. The new value of the
+ 16-bit register is returned.
+ If Address > 0x0FFFFFFF, then ASSERT().
+ If StartBit is greater than 15, then ASSERT().
+ If EndBit is greater than 15, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
+
+ @param[in] Address PCI configuration register to write.
+ @param[in] StartBit The original of the least significant bit in the bit field. Range 0..15.
+ @param[in] EndBit The original of the most significant bit in the bit field. Range 0..15.
+ @param[in] Value New value of the bit field.
+
+ @retval UINT16 The value written back to the PCI configuration register.
+**/
+UINT16
+EFIAPI
+PciBitFieldWrite16 (
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 Value
+ )
+{
+ return PciExpressBitFieldWrite16 (Address, StartBit, EndBit, Value);
+}
+
+/**
+ Reads the 16-bit PCI configuration register specified by Address, performs a
+ bitwise inclusive OR between the read result and the value specified by
+ OrData, and writes the result to the 16-bit PCI configuration register
+ specified by Address. The value written to the PCI configuration register is
+ returned. This function must guarantee that all PCI read and write operations
+ are serialized. Extra left bits in OrData are stripped.
+ If Address > 0x0FFFFFFF, then ASSERT().
+ If StartBit is greater than 15, then ASSERT().
+ If EndBit is greater than 15, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
+
+ @param[in] Address PCI configuration register to write.
+ @param[in] StartBit The original of the least significant bit in the bit field. Range 0..15.
+ @param[in] EndBit The original of the most significant bit in the bit field. Range 0..15.
+ @param[in] OrData The value to OR with the PCI configuration register.
+
+ @retval UINT16 The value written back to the PCI configuration register.
+**/
+UINT16
+EFIAPI
+PciBitFieldOr16 (
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 OrData
+ )
+{
+ return PciExpressBitFieldOr16 (Address, StartBit, EndBit, OrData);
+}
+
+/**
+ Reads the 16-bit PCI configuration register specified by Address, performs a
+ bitwise AND between the read result and the value specified by AndData, and
+ writes the result to the 16-bit PCI configuration register specified by
+ Address. The value written to the PCI configuration register is returned.
+ This function must guarantee that all PCI read and write operations are
+ serialized. Extra left bits in AndData are stripped.
+ If Address > 0x0FFFFFFF, then ASSERT().
+ If StartBit is greater than 15, then ASSERT().
+ If EndBit is greater than 15, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
+
+ @param[in] Address PCI configuration register to write.
+ @param[in] StartBit The original of the least significant bit in the bit field. Range 0..15.
+ @param[in] EndBit The original of the most significant bit in the bit field. Range 0..15.
+ @param[in] AndData The value to AND with the PCI configuration register.
+
+ @retval UINT16 The value written back to the PCI configuration register.
+**/
+UINT16
+EFIAPI
+PciBitFieldAnd16 (
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData
+ )
+{
+ return PciExpressBitFieldAnd16 (Address, StartBit, EndBit, AndData);
+}
+
+/**
+ Reads the 16-bit PCI configuration register specified by Address, performs a
+ bitwise AND followed by a bitwise inclusive OR between the read result and
+ the value specified by AndData, and writes the result to the 16-bit PCI
+ configuration register specified by Address. The value written to the PCI
+ configuration register is returned. This function must guarantee that all PCI
+ read and write operations are serialized. Extra left bits in both AndData and
+ OrData are stripped.
+ If Address > 0x0FFFFFFF, then ASSERT().
+ If StartBit is greater than 15, then ASSERT().
+ If EndBit is greater than 15, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
+
+ @param[in] Address PCI configuration register to write.
+ @param[in] StartBit The original of the least significant bit in the bit field. Range 0..15.
+ @param[in] EndBit The original of the most significant bit in the bit field. Range 0..15.
+ @param[in] AndData The value to AND with the PCI configuration register.
+ @param[in] OrData The value to OR with the result of the AND operation.
+
+ @retval UINT16 The value written back to the PCI configuration register.
+**/
+UINT16
+EFIAPI
+PciBitFieldAndThenOr16 (
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData,
+ IN UINT16 OrData
+ )
+{
+ return PciExpressBitFieldAndThenOr16 (Address, StartBit, EndBit, AndData, OrData);
+}
+
+/**
+ Reads and returns the 32-bit PCI configuration register specified by Address.
+ This function must guarantee that all PCI read and write operations are
+ serialized.
+ If Address > 0x0FFFFFFF, then ASSERT().
+
+ @param[in] Address Address that encodes the PCI Bus, Device, Function and Register.
+
+ @retval UINT32 The read value from the PCI configuration register.
+**/
+UINT32
+EFIAPI
+PciRead32 (
+ IN UINTN Address
+ )
+{
+ return PciExpressRead32 (Address);
+}
+
+/**
+ Writes the 32-bit PCI configuration register specified by Address with the
+ value specified by Value. Value is returned. This function must guarantee
+ that all PCI read and write operations are serialized.
+ If Address > 0x0FFFFFFF, then ASSERT().
+
+ @param[in] Address Address that encodes the PCI Bus, Device, Function and Register.
+ @param[in] Data The value to write.
+
+ @retval UINT32 The value written to the PCI configuration register.
+**/
+UINT32
+EFIAPI
+PciWrite32 (
+ IN UINTN Address,
+ IN UINT32 Data
+ )
+{
+ return PciExpressWrite32 (Address, Data);
+}
+
+/**
+ Reads the 32-bit PCI configuration register specified by Address, performs a
+ bitwise inclusive OR between the read result and the value specified by
+ OrData, and writes the result to the 32-bit PCI configuration register
+ specified by Address. The value written to the PCI configuration register is
+ returned. This function must guarantee that all PCI read and write operations
+ are serialized.
+ If Address > 0x0FFFFFFF, then ASSERT().
+
+ @param[in] Address Address that encodes the PCI Bus, Device, Function and Register.
+ @param[in] OrData The value to OR with the PCI configuration register.
+
+ @retval UINT32 The value written back to the PCI configuration register.
+**/
+UINT32
+EFIAPI
+PciOr32 (
+ IN UINTN Address,
+ IN UINT32 OrData
+ )
+{
+ return PciExpressOr32 (Address, OrData);
+}
+
+/**
+ Reads the 32-bit PCI configuration register specified by Address, performs a
+ bitwise AND between the read result and the value specified by AndData, and
+ writes the result to the 32-bit PCI configuration register specified by
+ Address. The value written to the PCI configuration register is returned.
+ This function must guarantee that all PCI read and write operations are
+ serialized.
+ If Address > 0x0FFFFFFF, then ASSERT().
+
+ @param[in] Address Address that encodes the PCI Bus, Device, Function and Register.
+ @param[in] AndData The value to AND with the PCI configuration register.
+
+ @retval UINT32 The value written back to the PCI configuration register.
+**/
+UINT32
+EFIAPI
+PciAnd32 (
+ IN UINTN Address,
+ IN UINT32 AndData
+ )
+{
+ return PciExpressAnd32 (Address, AndData);
+}
+
+/**
+ Reads the 32-bit PCI configuration register specified by Address, performs a
+ bitwise AND between the read result and the value specified by AndData,
+ performs a bitwise inclusive OR between the result of the AND operation and
+ the value specified by OrData, and writes the result to the 32-bit PCI
+ configuration register specified by Address. The value written to the PCI
+ configuration register is returned. This function must guarantee that all PCI
+ read and write operations are serialized.
+ If Address > 0x0FFFFFFF, then ASSERT().
+
+ @param[in] Address Address that encodes the PCI Bus, Device, Function and Register.
+ @param[in] AndData The value to AND with the PCI configuration register.
+ @param[in] OrData The value to OR with the result of the AND operation.
+
+ @retval UINT32 The value written back to the PCI configuration register.
+**/
+UINT32
+EFIAPI
+PciAndThenOr32 (
+ IN UINTN Address,
+ IN UINT32 AndData,
+ IN UINT32 OrData
+ )
+{
+ return PciExpressAndThenOr32 (Address, AndData, OrData);
+}
+
+/**
+ Reads the bit field in a 32-bit PCI configuration register. The bit field is
+ specified by the StartBit and the EndBit. The value of the bit field is
+ returned.
+ If Address > 0x0FFFFFFF, then ASSERT().
+ If StartBit is greater than 31, then ASSERT().
+ If EndBit is greater than 31, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
+
+ @param[in] Address PCI configuration register to read.
+ @param[in] StartBit The original of the least significant bit in the bit field. Range 0..31.
+ @param[in] EndBit The original of the most significant bit in the bit field. Range 0..31.
+
+ @retval UINT32 The value of the bit field read from the PCI configuration register.
+**/
+UINT32
+EFIAPI
+PciBitFieldRead32 (
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
+ )
+{
+ return PciExpressBitFieldRead32 (Address, StartBit, EndBit);
+}
+
+/**
+ Writes Value to the bit field of the PCI configuration register. The bit
+ field is specified by the StartBit and the EndBit. All other bits in the
+ destination PCI configuration register are preserved. The new value of the
+ 32-bit register is returned.
+ If Address > 0x0FFFFFFF, then ASSERT().
+ If StartBit is greater than 31, then ASSERT().
+ If EndBit is greater than 31, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
+
+ @param[in] Address PCI configuration register to write.
+ @param[in] StartBit The original of the least significant bit in the bit field. Range 0..31.
+ @param[in] EndBit The original of the most significant bit in the bit field. Range 0..31.
+ @param[in] Value New value of the bit field.
+
+ @retval UINT32 The value written back to the PCI configuration register.
+**/
+UINT32
+EFIAPI
+PciBitFieldWrite32 (
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 Value
+ )
+{
+ return PciExpressBitFieldWrite32 (Address, StartBit, EndBit, Value);
+}
+
+/**
+ Reads the 32-bit PCI configuration register specified by Address, performs a
+ bitwise inclusive OR between the read result and the value specified by
+ OrData, and writes the result to the 32-bit PCI configuration register
+ specified by Address. The value written to the PCI configuration register is
+ returned. This function must guarantee that all PCI read and write operations
+ are serialized. Extra left bits in OrData are stripped.
+ If Address > 0x0FFFFFFF, then ASSERT().
+ If StartBit is greater than 31, then ASSERT().
+ If EndBit is greater than 31, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
+
+ @param[in] Address PCI configuration register to write.
+ @param[in] StartBit The original of the least significant bit in the bit field. Range 0..31.
+ @param[in] EndBit The original of the most significant bit in the bit field. Range 0..31.
+ @param[in] OrData The value to OR with the PCI configuration register.
+
+ @retval UINT32 The value written back to the PCI configuration register.
+**/
+UINT32
+EFIAPI
+PciBitFieldOr32 (
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 OrData
+ )
+{
+ return PciExpressBitFieldOr32 (Address, StartBit, EndBit, OrData);
+}
+
+/**
+ Reads the 32-bit PCI configuration register specified by Address, performs a
+ bitwise AND between the read result and the value specified by AndData, and
+ writes the result to the 32-bit PCI configuration register specified by
+ Address. The value written to the PCI configuration register is returned.
+ This function must guarantee that all PCI read and write operations are
+ serialized. Extra left bits in AndData are stripped.
+ If Address > 0x0FFFFFFF, then ASSERT().
+ If StartBit is greater than 31, then ASSERT().
+ If EndBit is greater than 31, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
+
+ @param[in] Address PCI configuration register to write.
+ @param[in] StartBit The original of the least significant bit in the bit field. Range 0..31.
+ @param[in] EndBit The original of the most significant bit in the bit field. Range 0..31.
+ @param[in] AndData The value to AND with the PCI configuration register.
+
+ @retval UINT32 The value written back to the PCI configuration register.
+**/
+UINT32
+EFIAPI
+PciBitFieldAnd32 (
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData
+ )
+{
+ return PciExpressBitFieldAnd32 (Address, StartBit, EndBit, AndData);
+}
+
+/**
+ Reads the 32-bit PCI configuration register specified by Address, performs a
+ bitwise AND followed by a bitwise inclusive OR between the read result and
+ the value specified by AndData, and writes the result to the 32-bit PCI
+ configuration register specified by Address. The value written to the PCI
+ configuration register is returned. This function must guarantee that all PCI
+ read and write operations are serialized. Extra left bits in both AndData and
+ OrData are stripped.
+ If Address > 0x0FFFFFFF, then ASSERT().
+ If StartBit is greater than 31, then ASSERT().
+ If EndBit is greater than 31, then ASSERT().
+ If EndBit is less than StartBit, then ASSERT().
+
+ @param[in] Address PCI configuration register to write.
+ @param[in] StartBit The original of the least significant bit in the bit field. Range 0..31.
+ @param[in] EndBit The original of the most significant bit in the bit field. Range 0..31.
+ @param[in] AndData The value to AND with the PCI configuration register.
+ @param[in] OrData The value to OR with the result of the AND operation.
+
+ @retval UINT32 The value written back to the PCI configuration register.
+**/
+UINT32
+EFIAPI
+PciBitFieldAndThenOr32 (
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData,
+ IN UINT32 OrData
+ )
+{
+ return PciExpressBitFieldAndThenOr32 (Address, StartBit, EndBit, AndData, OrData);
+}
+
+/**
+ Reads the range of PCI configuration registers specified by StartAddress and
+ Size into the buffer specified by Buffer. This function only allows the PCI
+ configuration registers from a single PCI function to be read. Size is
+ returned. When possible 32-bit PCI configuration read cycles are used to read
+ from StartAdress to StartAddress + Size. Due to alignment restrictions, 8-bit
+ and 16-bit PCI configuration read cycles may be used at the beginning and the
+ end of the range.
+ If StartAddress > 0x0FFFFFFF, then ASSERT().
+ If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT().
+ If Size > 0 and Buffer is NULL, then ASSERT().
+
+ @param[in] StartAddress Starting address that encodes the PCI Bus, Device, Function and Register.
+ @param[in] Size Size in bytes of the transfer.
+ @param[in] Buffer Pointer to a buffer receiving the data read.
+
+ @retval UINTN Size in bytes of the transfer.
+**/
+UINTN
+EFIAPI
+PciReadBuffer (
+ IN UINTN StartAddress,
+ IN UINTN Size,
+ OUT VOID *Buffer
+ )
+{
+ return PciExpressReadBuffer (StartAddress, Size, Buffer);
+}
+
+/**
+ Writes the range of PCI configuration registers specified by StartAddress and
+ Size from the buffer specified by Buffer. This function only allows the PCI
+ configuration registers from a single PCI function to be written. Size is
+ returned. When possible 32-bit PCI configuration write cycles are used to
+ write from StartAdress to StartAddress + Size. Due to alignment restrictions,
+ 8-bit and 16-bit PCI configuration write cycles may be used at the beginning
+ and the end of the range.
+ If StartAddress > 0x0FFFFFFF, then ASSERT().
+ If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT().
+ If Size > 0 and Buffer is NULL, then ASSERT().
+
+ @param[in] StartAddress Starting address that encodes the PCI Bus, Device, Function and Register.
+ @param[in] Size Size in bytes of the transfer.
+ @param[in] Buffer Pointer to a buffer containing the data to write.
+
+ @retval UINTN The value written back to the PCI configuration register.
+**/
+UINTN
+EFIAPI
+PciWriteBuffer (
+ IN UINTN StartAddress,
+ IN UINTN Size,
+ IN VOID *Buffer
+ )
+{
+ return PciExpressWriteBuffer (StartAddress, Size, Buffer);
+}
+
+/**
+ Register memory space
+ If StartAddress > 0x0FFFFFFF, then ASSERT().
+ If SmPciLibAddressMapIndex) > PCI_LIB_ADDRESS_MAP_MAX_ITEM, then ASSERT().
+
+ @param[in] Address Starting address of the memory space
+ @param[in] Length Length of the memory space
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+EFIAPI
+PciLibRegisterMemory (
+ IN UINTN Address,
+ IN UINTN Length
+ )
+{
+ UINTN Index;
+
+ ASSERT_INVALID_PCI_ADDRESS (Address);
+ ASSERT (mPciLibAddressMapIndex < PCI_LIB_ADDRESS_MAP_MAX_ITEM);
+
+ //
+ // If already registered
+ //
+ for (Index = 0; Index < mPciLibAddressMapIndex; Index++) {
+ if (mPciLibAddressMap[Index].PciAddress == Address) {
+ return EFI_SUCCESS;
+ }
+ }
+
+ mPciLibAddressMap[mPciLibAddressMapIndex].PciAddress = Address;
+ mPciLibAddressMap[mPciLibAddressMapIndex].Length = Length;
+ mPciLibAddressMap[mPciLibAddressMapIndex].RuntimeAddress = mPciExpressBaseAddress + Address;
+ mPciLibAddressMapIndex++;
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Virtual address nofity.
+ The event handler changes PCIE base address to an virtual address.
+ Starting address of registered memory scope is converted as well.
+
+ @param[in] Event The event that be siganlled when virtual address changed
+ @param[in] Context The pointer of the ESAL procedure instance
+
+ @retval None
+**/
+VOID
+EFIAPI
+VirtualAddressNotifyEvent (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ UINTN Index;
+
+ for (Index = 0; Index < PCI_LIB_ADDRESS_MAP_MAX_ITEM; Index++) {
+ if (mPciLibAddressMap[Index].PciAddress != 0) {
+ gRT->ConvertPointer (EFI_INTERNAL_POINTER, (VOID *) &(mPciLibAddressMap[Index].RuntimeAddress));
+ }
+ }
+
+ gRT->ConvertPointer (EFI_INTERNAL_POINTER, (VOID *) &mPciExpressBaseAddress);
+}
+
+/**
+ Constructor for Pci library. Register VirtualAddressNotifyEvent() notify function
+ It will ASSERT() if that operation fails
+
+ @param[in] None
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+EFIAPI
+PciLibConstructor (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+
+ mPciExpressBaseAddress = (UINTN) PcdGet64 (PcdPciExpressBaseAddress);
+
+ Status = gBS->CreateEvent (
+ EFI_EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE,
+ EFI_TPL_NOTIFY,
+ VirtualAddressNotifyEvent,
+ NULL,
+ &mVirtualNofityEvent
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ZeroMem (mPciLibAddressMap, sizeof (mPciLibAddressMap));
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/Library/DxeRuntimePciLibPciExpress/DxeRuntimePciLibPciExpress.cif b/ReferenceCode/Chipset/LynxPoint/Library/DxeRuntimePciLibPciExpress/DxeRuntimePciLibPciExpress.cif
new file mode 100644
index 0000000..179a995
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Library/DxeRuntimePciLibPciExpress/DxeRuntimePciLibPciExpress.cif
@@ -0,0 +1,11 @@
+<component>
+ name = "DxeRuntimePciLibPciExpress"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\Library\DxeRuntimePciLibPciExpress"
+ RefName = "DxeRuntimePciLibPciExpress"
+[files]
+"DxeRuntimePciLibPciExpress.sdl"
+"DxeRuntimePciLibPciExpress.mak"
+"DxeRuntimePciLibPciExpress.c"
+"DxeRuntimePciLibPciExpress.inf"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/Library/DxeRuntimePciLibPciExpress/DxeRuntimePciLibPciExpress.inf b/ReferenceCode/Chipset/LynxPoint/Library/DxeRuntimePciLibPciExpress/DxeRuntimePciLibPciExpress.inf
new file mode 100644
index 0000000..20fec36
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Library/DxeRuntimePciLibPciExpress/DxeRuntimePciLibPciExpress.inf
@@ -0,0 +1,78 @@
+## @file
+# Component description file for the DxeRuntimePciLibPciExpress
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = PchDxeRuntimePciLibPciExpress
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ DxeRuntimePciLibPciExpress.c
+
+[sources.ia32]
+
+
+[sources.x64]
+
+
+[sources.ipf]
+
+
+[sources.ebc]
+
+
+[includes.common]
+ .
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Cpu/Pentium/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+
+[libraries.common]
+ EdkIIGlueEdkDxeRuntimeDriverLib
+
+[libraries.ia32]
+
+
+[libraries.x64]
+
+
+[nmake.common]
+ LIB_STD_FLAGS = $(LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
+
+[nmake.ia32]
+ C_FLAGS = $(C_FLAGS) -DMDE_CPU_IA32
+
+[nmake.x64]
+ C_FLAGS = $(C_FLAGS) -DMDE_CPU_X64
+
+[nmake.ipf]
+ C_FLAGS = $(C_FLAGS) -DMDE_CPU_IPF
+
+[nmake.ebc]
+ EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) -DEDKII_GLUE_LIBRARY_IMPLEMENTATION
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
+ EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) -DMDE_CPU_EBC
diff --git a/ReferenceCode/Chipset/LynxPoint/Library/DxeRuntimePciLibPciExpress/DxeRuntimePciLibPciExpress.mak b/ReferenceCode/Chipset/LynxPoint/Library/DxeRuntimePciLibPciExpress/DxeRuntimePciLibPciExpress.mak
new file mode 100644
index 0000000..2a0bb30
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Library/DxeRuntimePciLibPciExpress/DxeRuntimePciLibPciExpress.mak
@@ -0,0 +1,76 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchLib/DxeRuntimePciLibPciExpress/DxeRuntimePciLibPciExpress.mak 1 2/08/12 8:46a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 8:46a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchLib/DxeRuntimePciLibPciExpress/DxeRuntimePciLibPciExpress.mak $
+#
+# 1 2/08/12 8:46a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+
+# MAK file for the ModulePart:DxeRuntimePciLibPciExpress
+EDK : DxeRuntimePciLibPciExpress
+
+DxeRuntimePciLibPciExpress : $(BUILD_DIR)\DxeRuntimePciLibPciExpress.mak DxeRuntimePciLibPciExpressBin
+
+$(BUILD_DIR)\DxeRuntimePciLibPciExpress.mak : $(DxeRuntimePciLibPciExpress_DIR)\$(@B).cif $(DxeRuntimePciLibPciExpress_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(DxeRuntimePciLibPciExpress_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+$(DxeRuntimePciLibPciExpressLib_LIB) : DxeRuntimePciLibPciExpress
+
+DxeRuntimePciLibPciExpress_INCLUDES=\
+ $(EDK_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+
+DxeCpuBuildDefine = \
+!IF "$(x64_BUILD)"=="1"
+ /DMDE_CPU_X64\
+!ELSE
+ /DMDE_CPU_IA32\
+!ENDIF
+
+DxeRuntimePciLibPciExpress_DEFINES = \
+$(CFLAGS) \
+$(DxeCpuBuildDefine) \
+
+DxeRuntimePciLibPciExpressBin:
+ $(MAKE) /$(MAKEFLAGS) $(EDK_DEFAULTS) \
+ /f $(BUILD_DIR)\DxeRuntimePciLibPciExpress.mak all \
+ "MY_INCLUDES=$(DxeRuntimePciLibPciExpress_INCLUDES)" \
+ "CFLAGS=$(DxeRuntimePciLibPciExpress_DEFINES)"\
+ TYPE=LIBRARY LIBRARIES= \
+ LIBRARY_NAME=$(DxeRuntimePciLibPciExpressLib_LIB)
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Library/DxeRuntimePciLibPciExpress/DxeRuntimePciLibPciExpress.sdl b/ReferenceCode/Chipset/LynxPoint/Library/DxeRuntimePciLibPciExpress/DxeRuntimePciLibPciExpress.sdl
new file mode 100644
index 0000000..5c09ab6
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Library/DxeRuntimePciLibPciExpress/DxeRuntimePciLibPciExpress.sdl
@@ -0,0 +1,72 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchLib/DxeRuntimePciLibPciExpress/DxeRuntimePciLibPciExpress.sdl 1 2/08/12 8:46a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 8:46a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchLib/DxeRuntimePciLibPciExpress/DxeRuntimePciLibPciExpress.sdl $
+#
+# 1 2/08/12 8:46a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+TOKEN
+ Name = "DxeRuntimePciLibPciExpress_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable DxeRuntimePciLibPciExpress support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "DxeRuntimePciLibPciExpress_DIR"
+End
+
+MODULE
+ File = "DxeRuntimePciLibPciExpress.mak"
+ Help = "Includes DxeRuntimePciLibPciExpress.mak to Project"
+End
+
+ELINK
+ Name = "DxeRuntimePciLibPciExpressLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\DxeRuntimePciLibPciExpress_Lib.lib"
+ Parent = "DxeRuntimePciLibPciExpressLib_LIB"
+ InvokeOrder = AfterParent
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Library/PchLib.cif b/ReferenceCode/Chipset/LynxPoint/Library/PchLib.cif
new file mode 100644
index 0000000..2f066b4
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Library/PchLib.cif
@@ -0,0 +1,14 @@
+<component>
+ name = "PchLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\Library\"
+ RefName = "PchLib"
+[files]
+"PchLib.sdl"
+[parts]
+"DxeRuntimePciLibPciExpress"
+"PchPciExpressHelpersLib"
+"PchPlatformLib"
+"PchSmbusLib"
+"RcFviDxeLib"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/Library/PchLib.sdl b/ReferenceCode/Chipset/LynxPoint/Library/PchLib.sdl
new file mode 100644
index 0000000..b73418a
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Library/PchLib.sdl
@@ -0,0 +1,55 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchLib/PchLib.sdl 1 2/08/12 8:46a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 8:46a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchLib/PchLib.sdl $
+#
+# 1 2/08/12 8:46a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+TOKEN
+ Name = "PchLibrary_SUPPORT"
+ Value = 1
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable PchLibrary support in Project"
+End
+
+PATH
+ Name = "PchLibrary_DIR"
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Library/PchPciExpressHelpersLib/PchPciExpressHelpersLib.cif b/ReferenceCode/Chipset/LynxPoint/Library/PchPciExpressHelpersLib/PchPciExpressHelpersLib.cif
new file mode 100644
index 0000000..bffca56
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Library/PchPciExpressHelpersLib/PchPciExpressHelpersLib.cif
@@ -0,0 +1,12 @@
+<component>
+ name = "PchPciExpressHelpersLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\Library\PchPciExpressHelpersLib"
+ RefName = "PchPciExpressHelpersLib"
+[files]
+"PchPciExpressHelpersLib.sdl"
+"PchPciExpressHelpersLib.mak"
+"PchPciExpressHelpersLibrary.c"
+"PchPciExpressHelpersLibrary.h"
+"PchPciExpressHelpersLib.inf"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/Library/PchPciExpressHelpersLib/PchPciExpressHelpersLib.inf b/ReferenceCode/Chipset/LynxPoint/Library/PchPciExpressHelpersLib/PchPciExpressHelpersLib.inf
new file mode 100644
index 0000000..aa731f8
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Library/PchPciExpressHelpersLib/PchPciExpressHelpersLib.inf
@@ -0,0 +1,66 @@
+## @file
+# Component description file for the PchPciExpressHelpersLib
+#
+#@copyright
+# Copyright (c) 2008 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = PchPciExpressHelpersLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ PchPciExpressHelpersLibrary.c
+
+[sources.ia32]
+
+
+[sources.x64]
+
+
+[sources.ipf]
+
+
+[sources.ebc]
+
+
+[includes.common]
+ .
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Protocol/PchPlatformPolicy
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Cpu/Pentium/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[libraries.common]
+ PchPlatformLib
+
+[libraries.ia32]
+
+
+[libraries.x64]
+
+
+[nmake.common] \ No newline at end of file
diff --git a/ReferenceCode/Chipset/LynxPoint/Library/PchPciExpressHelpersLib/PchPciExpressHelpersLib.mak b/ReferenceCode/Chipset/LynxPoint/Library/PchPciExpressHelpersLib/PchPciExpressHelpersLib.mak
new file mode 100644
index 0000000..e8ce73e
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Library/PchPciExpressHelpersLib/PchPciExpressHelpersLib.mak
@@ -0,0 +1,88 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchLib/PchPciExpressHelpersLib/PchPciExpressHelpersLib.mak 2 10/16/12 4:57a Scottyang $
+#
+# $Revision: 2 $
+#
+# $Date: 10/16/12 4:57a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchLib/PchPciExpressHelpersLib/PchPciExpressHelpersLib.mak $
+#
+# 2 10/16/12 4:57a Scottyang
+# [TAG] EIP84720
+# [Category] Improvement
+# [Description] Support Hot-Plug in Shark Bay
+# [Files] PchRootPort.c, PchPcie.asl, PchPciExpressHelpersLib.mak,
+# PchPciExpressHlpersLibrary.c, SB.sdl
+#
+# 1 2/08/12 8:47a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+all : PchPciExpressHelpersLib
+
+PchPciExpressHelpersLib : PchPciExpressHelpersDxeLib PchPciExpressHelpersPeiLib
+
+$(PchPciExpressHelpersDxeLib_LIB) : PchPciExpressHelpersDxeLib
+$(PchPciExpressHelpersPeiLib_LIB) : PchPciExpressHelpersPeiLib
+
+PchPciExpressHelpersDxeLib : $(BUILD_DIR)\PchPciExpressHelpersLib.mak PchPciExpressHelpersLibDxeBin
+PchPciExpressHelpersPeiLib : $(BUILD_DIR)\PchPciExpressHelpersLib.mak PchPciExpressHelpersLibPeiBin
+
+$(BUILD_DIR)\PchPciExpressHelpersLib.mak : $(PchPciExpressHelpersLib_DIR)\$(@B).cif $(PchPciExpressHelpersLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(PchPciExpressHelpersLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+PchPciExpressHelpersLib_INCLUDES=\
+ $(EDK_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+
+PchPciExpressHelpersLib_DEFINES=\
+ $(CFLAGS)\
+
+PchPciExpressHelpersLibDxeBin:
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\PchPciExpressHelpersLib.mak all \
+ "MY_INCLUDES=$(PchPciExpressHelpersLib_INCLUDES)" \
+ TYPE=LIBRARY LIBRARIES= \
+ LIBRARY_NAME=$(PchPciExpressHelpersDxeLib_LIB)
+
+PchPciExpressHelpersLibPeiBin:
+!IF "$(x64_BUILD)"=="1"
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS) BUILD_DIR=$(BUILD_DIR)\IA32\
+!ELSE
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+!ENDIF
+ /f $(BUILD_DIR)\PchPciExpressHelpersLib.mak all \
+ "MY_INCLUDES=$(PchPciExpressHelpersLib_INCLUDES)" \
+ "MY_DEFINES=$(PchPciExpressHelpersLib_DEFINES)" \
+ LIBRARIES= \
+ TYPE=PEI_LIBRARY LIBRARY_NAME=$(PchPciExpressHelpersPeiLib_LIB)
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Library/PchPciExpressHelpersLib/PchPciExpressHelpersLib.sdl b/ReferenceCode/Chipset/LynxPoint/Library/PchPciExpressHelpersLib/PchPciExpressHelpersLib.sdl
new file mode 100644
index 0000000..1bb4ebc
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Library/PchPciExpressHelpersLib/PchPciExpressHelpersLib.sdl
@@ -0,0 +1,83 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchLib/PchPciExpressHelpersLib/PchPciExpressHelpersLib.sdl 1 2/08/12 8:47a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 8:47a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchLib/PchPciExpressHelpersLib/PchPciExpressHelpersLib.sdl $
+#
+# 1 2/08/12 8:47a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+TOKEN
+ Name = "PchPciExpressHelpersLib_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable PchPciExpressHelpersLib support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "PchPciExpressHelpersLib_DIR"
+End
+
+MODULE
+ File = "PchPciExpressHelpersLib.mak"
+ Help = "Includes PchPciExpressHelpersLib.mak to Project"
+End
+
+ELINK
+ Name = "PchPciExpressHelpersDxeLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PchPciExpressHelpersDxeLib_Lib.lib"
+ Parent = "PchPciExpressHelpersDxeLib_LIB"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "PchPciExpressHelpersPeiLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PchPciExpressHelpersPeiLib_Lib.lib"
+ Parent = "PchPciExpressHelpersPeiLib_LIB"
+ InvokeOrder = AfterParent
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Library/PchPciExpressHelpersLib/PchPciExpressHelpersLibrary.c b/ReferenceCode/Chipset/LynxPoint/Library/PchPciExpressHelpersLib/PchPciExpressHelpersLibrary.c
new file mode 100644
index 0000000..7d622b3
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Library/PchPciExpressHelpersLib/PchPciExpressHelpersLibrary.c
@@ -0,0 +1,2201 @@
+/** @file
+ This file contains routines that support PCI Express initialization
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "PchPciExpressHelpersLibrary.h"
+// AMI_OVERRIDE, [EIP84720]>
+#include "Token.h"
+// AMI_OVERRIDE, [EIP84720]<
+
+/**
+ Find the Offset to a given Capabilities ID
+ CAPID list:
+ 0x01 = PCI Power Management Interface
+ 0x04 = Slot Identification
+ 0x05 = MSI Capability
+ 0x10 = PCI Express Capability
+
+ @param[in] Bus Pci Bus Number
+ @param[in] Device Pci Device Number
+ @param[in] Function Pci Function Number
+ @param[in] CapId CAPID to search for
+
+ @retval 0 CAPID not found
+ @retval Other CAPID found, Offset of desired CAPID
+**/
+UINT8
+PcieFindCapId (
+ IN UINT8 Bus,
+ IN UINT8 Device,
+ IN UINT8 Function,
+ IN UINT8 CapId
+ )
+{
+ UINT8 CapHeaderOffset;
+ UINT8 CapHeaderId;
+ UINTN DeviceBase;
+
+ DeviceBase = MmPciAddress (0, Bus, Device, Function, 0);
+
+ ///
+ /// Check the header layout to determine the Offset of Capabilities Pointer Register
+ ///
+ if ((MmioRead8 (DeviceBase + PCI_HEADER_TYPE_OFFSET) & HEADER_LAYOUT_CODE) == (HEADER_TYPE_CARDBUS_BRIDGE)) {
+ ///
+ /// If CardBus bridge, start at Offset 0x14
+ ///
+ CapHeaderOffset = 0x14;
+ } else {
+ ///
+ /// Otherwise, start at Offset 0x34
+ ///
+ CapHeaderOffset = 0x34;
+ }
+ ///
+ /// Get Capability Header, A pointer value of 00h is used to indicate the last capability in the list.
+ ///
+ CapHeaderId = 0;
+ CapHeaderOffset = MmioRead8 (DeviceBase + CapHeaderOffset) & ((UINT8) ~(BIT0 | BIT1));
+ while (CapHeaderOffset != 0 && CapHeaderId != 0xFF) {
+ CapHeaderId = MmioRead8 (DeviceBase + CapHeaderOffset);
+ if (CapHeaderId == CapId) {
+ return CapHeaderOffset;
+ }
+ ///
+ /// Each capability must be DWORD aligned.
+ /// The bottom two bits of all pointers (including the initial pointer at 34h) are reserved
+ /// and must be implemented as 00b although software must mask them to allow for future uses of these bits.
+ ///
+ CapHeaderOffset = MmioRead8 (DeviceBase + CapHeaderOffset + 1) & ((UINT8) ~(BIT0 | BIT1));
+ }
+
+ return 0;
+}
+
+/**
+ Search and return the offset of desired Pci Express Capability ID
+ CAPID list:
+ 0x0001 = Advanced Error Rreporting Capability
+ 0x0002 = Virtual Channel Capability
+ 0x0003 = Device Serial Number Capability
+ 0x0004 = Power Budgeting Capability
+
+ @param[in] Bus Pci Bus Number
+ @param[in] Device Pci Device Number
+ @param[in] Function Pci Function Number
+ @param[in] CapId Extended CAPID to search for
+
+ @retval 0 CAPID not found
+ @retval Other CAPID found, Offset of desired CAPID
+**/
+UINT16
+PcieFindExtendedCapId (
+ IN UINT8 Bus,
+ IN UINT8 Device,
+ IN UINT8 Function,
+ IN UINT16 CapId
+ )
+{
+ UINT16 CapHeaderOffset;
+ UINT16 CapHeaderId;
+ UINTN DeviceBase;
+
+ DeviceBase = MmPciAddress (0, Bus, Device, Function, 0);
+
+ ///
+ /// Start to search at Offset 0x100
+ /// Get Capability Header, A pointer value of 00h is used to indicate the last capability in the list.
+ ///
+ CapHeaderId = 0;
+ CapHeaderOffset = 0x100;
+ while (CapHeaderOffset != 0 && CapHeaderId != 0xFFFF) {
+ CapHeaderId = MmioRead16 (DeviceBase + CapHeaderOffset);
+ if (CapHeaderId == CapId) {
+ return CapHeaderOffset;
+ }
+ ///
+ /// Each capability must be DWORD aligned.
+ /// The bottom two bits of all pointers are reserved and must be implemented as 00b
+ /// although software must mask them to allow for future uses of these bits.
+ ///
+ CapHeaderOffset = (MmioRead16 (DeviceBase + CapHeaderOffset + 2) >> 4) & ((UINT16) ~(BIT0 | BIT1));
+ }
+
+ return 0;
+}
+
+/**
+ Map a TC to VC0 for port and endpoint
+
+ @param[in] Bus1 The bus number of the port
+ @param[in] Device1 The device number of the port
+ @param[in] Function1 The function number of the port
+ @param[in] Bus2 The bus number of the endpoint
+ @param[in] Device2 The device number of the endpoint
+ @param[in] TCx The TC number
+
+ @exception EFI_UNSUPPORTED Unsupported operation.
+ @retval EFI_SUCCESS Successfully completed.
+**/
+EFI_STATUS
+PcieMapTcxVc0 (
+ IN UINT8 Bus1,
+ IN UINT8 Device1,
+ IN UINT8 Function1,
+ IN UINT8 Bus2,
+ IN UINT8 Device2,
+ IN UINT8 TCx
+ )
+{
+ UINT16 Offset;
+ UINTN DeviceBase1;
+ UINTN DeviceBase2;
+ UINT8 DeviceIndex;
+ UINT8 FunctionIndex;
+ UINT8 Function2;
+
+ DeviceBase1 = MmPciAddress (0, Bus1, Device1, Function1, 0);
+
+ ///
+ /// Set TCx-VC0 value on the port
+ ///
+ Offset = PcieFindExtendedCapId (Bus1, Device1, Function1, 2);
+ if (Offset == 0) {
+ return EFI_UNSUPPORTED;
+ }
+
+ MmioAndThenOr8 (DeviceBase1 + Offset + 0x014, (UINT8) (~0xF), 1);
+ MmioWrite8 (DeviceBase1 + Offset + 0x014, (UINT8) (1 << TCx));
+
+ ///
+ /// Set TCx-VC0 value on the Endpoint
+ ///
+ for (DeviceIndex = 0; DeviceIndex <= Device2; DeviceIndex++) {
+ DeviceBase2 = MmPciAddress (0, Bus2, DeviceIndex, 0, 0);
+ if (MmioRead16 (DeviceBase2 + PCI_VENDOR_ID_OFFSET) == 0xFFFF) {
+ continue;
+ }
+ ///
+ /// Check if EndPoint device is Multi-Function Device
+ ///
+ if (MmioRead8 (DeviceBase2 + PCI_HEADER_TYPE_OFFSET) & HEADER_TYPE_MULTI_FUNCTION) {
+ ///
+ /// If multi-function Device, check function 0-7
+ ///
+ Function2 = PCI_MAX_FUNC;
+ } else {
+ ///
+ /// Otherwise, check function 0 only
+ ///
+ Function2 = 0;
+ }
+
+ for (FunctionIndex = 0; FunctionIndex <= Function2; FunctionIndex++) {
+ DeviceBase2 = MmPciAddress (0, Bus2, DeviceIndex, FunctionIndex, 0);
+
+ Offset = PcieFindExtendedCapId (Bus2, DeviceIndex, FunctionIndex, 2);
+ if (Offset == 0) {
+ continue;
+ }
+
+ MmioAndThenOr8 (DeviceBase2 + Offset + 0x014, (UINT8) (~0xF), 1);
+ MmioWrite8 (DeviceBase2 + Offset + 0x014, (UINT8) (1 << TCx));
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Set Common clock to Root port and Endpoint PCI device
+
+ @param[in] Bus1 Root port Pci Bus Number
+ @param[in] Device1 Root port Pci Device Number
+ @param[in] Function1 Root port Pci Function Number
+ @param[in] Bus2 Endpoint Pci Bus Number
+ @param[in] Device2 Endpoint Pci Device Number
+
+ @exception EFI_UNSUPPORTED Unsupported operation.
+ @retval EFI_SUCCESS VC mapping correctly initialized
+**/
+EFI_STATUS
+PcieSetCommonClock (
+ IN UINT8 Bus1,
+ IN UINT8 Device1,
+ IN UINT8 Function1,
+ IN UINT8 Bus2,
+ IN UINT8 Device2
+ )
+{
+ UINT8 CapOffset1;
+ UINT8 CapOffset2;
+ BOOLEAN CommonClockSupport;
+ EFI_STATUS Status;
+ UINTN DeviceBase1;
+ UINTN DeviceBase2;
+ UINT16 RegData16;
+ UINT8 DeviceIndex;
+ UINT8 FunctionIndex;
+ UINT8 Function2;
+
+ DeviceBase1 = MmPciAddress (0, Bus1, Device1, Function1, 0);
+
+ ///
+ /// Get the pointer to the Port PCI Express Capability Structure.
+ ///
+ CommonClockSupport = FALSE;
+ CapOffset1 = PcieFindCapId (Bus1, Device1, Function1, EFI_PCI_CAPABILITY_ID_PCIEXP);
+ if (CapOffset1 == 0) {
+ return EFI_UNSUPPORTED;
+ }
+ ///
+ /// Check the Port Slot Clock Configuration Bit.
+ ///
+ if ((MmioRead16 (DeviceBase1 + CapOffset1 + 0x012) & BIT12) == 0) {
+ return EFI_UNSUPPORTED;
+ }
+
+ for (DeviceIndex = 0; DeviceIndex <= Device2; DeviceIndex++) {
+ DeviceBase2 = MmPciAddress (0, Bus2, DeviceIndex, 0, 0);
+ if (MmioRead16 (DeviceBase2 + PCI_VENDOR_ID_OFFSET) == 0xFFFF) {
+ continue;
+ }
+ ///
+ /// Check if EndPoint device is Multi-Function Device
+ ///
+ if (MmioRead8 (DeviceBase2 + PCI_HEADER_TYPE_OFFSET) & HEADER_TYPE_MULTI_FUNCTION) {
+ ///
+ /// If multi-function Device, check function 0-7
+ ///
+ Function2 = PCI_MAX_FUNC;
+ } else {
+ ///
+ /// Otherwise, check function 0 only
+ ///
+ Function2 = 0;
+ }
+
+ for (FunctionIndex = 0; FunctionIndex <= Function2; FunctionIndex++) {
+ DeviceBase2 = MmPciAddress (0, Bus2, DeviceIndex, FunctionIndex, 0);
+ ///
+ /// Check the Endpoint Slot Clock Configuration Bit.
+ ///
+ CapOffset2 = PcieFindCapId (Bus2, DeviceIndex, FunctionIndex, EFI_PCI_CAPABILITY_ID_PCIEXP);
+ if ((CapOffset2 != 0) && ((MmioRead16 (DeviceBase2 + CapOffset2 + 0x012) & BIT12) != 0)) {
+ ///
+ /// Common clock is supported, set common clock bit on root port
+ /// and the endpoint
+ ///
+ if (CommonClockSupport == FALSE) {
+ MmioOr8 (DeviceBase1 + CapOffset1 + 0x010, BIT6);
+ CommonClockSupport = TRUE;
+ }
+
+ MmioOr8 (DeviceBase2 + CapOffset2 + 0x010, BIT6);
+ }
+ }
+ }
+ ///
+ /// If common clock not supported on root port and endpoint, return EFI_UNSUPPORTED
+ ///
+ if (CommonClockSupport == FALSE) {
+ Status = EFI_UNSUPPORTED;
+ } else {
+ Status = EFI_SUCCESS;
+ }
+ ///
+ /// Set Pci + D4h Bit 6 and Bit 12 to 1 for root port only
+ ///
+ if (Bus1 == 0) {
+ MmioOr32 (DeviceBase1 + 0xD4, ((UINT32)(BIT6 | BIT12)));
+ }
+ ///
+ /// Retrain the Link per PCI Express Specification.
+ ///
+ MmioOr8 (DeviceBase1 + CapOffset1 + 0x010, BIT5);
+
+// AMI_OVERRIDE >>>
+#ifdef PCIE_CLEAR_RETRAIN_BIT_SUPPORT_FLAG
+ PchPmTimerStall (1);
+
+ if((MmioRead8 (DeviceBase1 + CapOffset1 + 0x010) & BIT5) == 1){
+ MmioAnd8 (DeviceBase1 + CapOffset1 + 0x010, BIT5);
+ }
+#endif
+// AMI_OVERRIDE <<<
+
+ ///
+ /// Wait until Re-Training has completed.
+ ///
+ do {
+ RegData16 = MmioRead16 (DeviceBase1 + CapOffset1 + 0x012) & BIT11;
+ } while (RegData16 != 0);
+
+ return Status;
+}
+
+/**
+ This function enables the CLKREQ# PM on all the end point functions
+
+ @param[in] Bus Pci Bus Number
+ @param[in] Device Pci Device Number
+ @param[in] RootFunction Rootport Function Number
+
+ @retval None
+**/
+VOID
+PcieSetClkreq (
+ IN UINT8 Bus,
+ IN UINT8 Device,
+ IN UINT8 RootFunction
+ )
+{
+ UINT8 CapOffset;
+ UINTN DeviceBase;
+ UINT8 DeviceIndex;
+ UINT8 FunctionIndex;
+ UINT8 Function;
+ UINT32 Data32;
+ UINT16 GpioBase;
+ BOOLEAN ClkreqPerPortSupported;
+ PCH_SERIES PchSeries;
+ UINT8 RootPortNumber;
+ UINT32 RootComplexBar;
+
+
+ PchSeries = GetPchSeries();
+
+ if (PchSeries == PchLp) {
+ GpioBase = MmioRead16 (
+ MmPciAddress (0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_GPIO_BASE)
+ ) & B_PCH_LPC_GPIO_BASE_BAR;
+
+ RootComplexBar = PCH_RCRB_BASE;
+ RootPortNumber = GetPchPcieRpNumber(RootComplexBar, RootFunction);
+ Data32 = (IoRead32 ((UINTN) (GpioBase + R_PCH_GP_X_CONFIG0(18 + RootPortNumber))) & B_PCH_GPIO_OWN0_GPIO_USE_SEL);
+
+ if (Data32 != 0) {
+ ///
+ /// CLKREQ not supported on root port
+ ///
+ return;
+ }
+ }
+
+ for (DeviceIndex = 0; DeviceIndex <= Device; DeviceIndex++) {
+ DeviceBase = MmPciAddress (0, Bus, DeviceIndex, 0, 0);
+ if (MmioRead16 (DeviceBase + PCI_VENDOR_ID_OFFSET) == 0xFFFF) {
+ continue;
+ }
+
+ ClkreqPerPortSupported = TRUE;
+
+ ///
+ /// Check if EndPoint device is Multi-Function Device
+ ///
+ if (MmioRead8 (DeviceBase + PCI_HEADER_TYPE_OFFSET) & HEADER_TYPE_MULTI_FUNCTION) {
+ ///
+ /// If multi-function Device, check function 0-7
+ ///
+ Function = PCI_MAX_FUNC;
+ } else {
+ ///
+ /// Otherwise, check function 0 only
+ ///
+ Function = 0;
+ }
+ ///
+ /// Parse thro all the functions of the endpoint and find the PCIe Cap ID (offset 10h) and if
+ /// exists then enable the CLKREQ# bit (BIT8) on that function
+ ///
+ for (FunctionIndex = 0; FunctionIndex <= Function; FunctionIndex++) {
+ ///
+ /// Find the PCIe Cap Id (offset 10h)
+ ///
+ CapOffset = PcieFindCapId (Bus, DeviceIndex, FunctionIndex, EFI_PCI_CAPABILITY_ID_PCIEXP);
+ if (CapOffset == 0) {
+ continue;
+ }
+
+ DeviceBase = MmPciAddress (0, Bus, DeviceIndex, FunctionIndex, 0);
+ ///
+ /// Check if CLKREQ# is supported by the endpoints
+ ///
+ if ((MmioRead32 (DeviceBase + CapOffset + 0x0C) & BIT18) == 0) {
+ ///
+ /// CLKREQ# is not supported so dont do anything
+ ///
+ ClkreqPerPortSupported = FALSE;
+ break;
+ }
+ }
+
+ if (ClkreqPerPortSupported == FALSE) {
+ continue;
+ }
+ ///
+ /// Now enable the CLKREQ#
+ ///
+ for (FunctionIndex = 0; FunctionIndex <= Function; FunctionIndex++) {
+ ///
+ /// Find the PCIe Cap Id (offset 10h)
+ ///
+ CapOffset = PcieFindCapId (Bus, DeviceIndex, FunctionIndex, EFI_PCI_CAPABILITY_ID_PCIEXP);
+ if (CapOffset == 0) {
+ continue;
+ }
+
+ DeviceBase = MmPciAddress (0, Bus, DeviceIndex, FunctionIndex, 0);
+ MmioOr16 (DeviceBase + CapOffset + 0x010, BIT8);
+ }
+ }
+}
+
+/**
+ This function get or set the Max Payload Size on all the end point functions
+
+ @param[in] EndPointBus The Bus Number of the Endpoint
+ @param[in] EndPointDevice The Device Number of the Endpoint
+ @param[in, out] MaxPayload The Max Payolad Size of the root port
+ @param[in] Operation True: Set the Max Payload Size on all the end point functions
+ False: Get the Max Payload Size on all the end point functions
+
+ @retval EFI_SUCCESS Successfully completed.
+**/
+EFI_STATUS
+PcieMaxPayloadSize (
+ IN UINT8 EndPointBus,
+ IN UINT8 EndPointDevice,
+ IN OUT UINT16 *MaxPayload,
+ IN BOOLEAN Operation
+ )
+{
+ UINTN DeviceBase;
+ UINT8 PcieCapOffset;
+ UINT16 EndPointMaxPayload;
+ UINT8 DeviceIndex;
+ UINT8 FunctionIndex;
+ UINT8 EndPointFunction;
+
+ ///
+ /// Obtain the Max Payload Size for all the end point functions
+ ///
+ for (DeviceIndex = 0; DeviceIndex <= EndPointDevice; DeviceIndex++) {
+ DeviceBase = MmPciAddress (0, EndPointBus, DeviceIndex, 0, 0);
+ if (MmioRead16 (DeviceBase + PCI_VENDOR_ID_OFFSET) == 0xFFFF) {
+ continue;
+ }
+ ///
+ /// Check if EndPoint device is Multi-Function Device
+ ///
+ if (MmioRead8 (DeviceBase + PCI_HEADER_TYPE_OFFSET) & HEADER_TYPE_MULTI_FUNCTION) {
+ ///
+ /// If multi-function Device, check function 0-7
+ ///
+ EndPointFunction = PCI_MAX_FUNC;
+ } else {
+ ///
+ /// Otherwise, check function 0 only
+ ///
+ EndPointFunction = 0;
+ }
+
+ for (FunctionIndex = 0; FunctionIndex <= EndPointFunction; FunctionIndex++) {
+ DeviceBase = MmPciAddress (0, EndPointBus, DeviceIndex, FunctionIndex, 0);
+ if (MmioRead16 (DeviceBase + 0x0) != 0xFFFF) {
+ ///
+ /// Get the pointer to the Endpoint PCI Express Capability Structure.
+ ///
+ PcieCapOffset = PcieFindCapId (EndPointBus, DeviceIndex, FunctionIndex, EFI_PCI_CAPABILITY_ID_PCIEXP);
+ if (PcieCapOffset == 0) {
+ continue;
+ }
+
+ if (Operation == TRUE) {
+ ///
+ /// Set the Max Payload Size of the end point function
+ ///
+ MmioAndThenOr16 (
+ DeviceBase + PcieCapOffset + 0x08,
+ (UINT16)~(BIT7 | BIT6 | BIT5),
+ *MaxPayload << 5
+ );
+ } else {
+ ///
+ /// Get the end point function Max Payload Size support
+ ///
+ EndPointMaxPayload = MmioRead16 (DeviceBase + PcieCapOffset + 0x04) & (BIT2 | BIT1 | BIT0);
+ ///
+ /// Obtain the minimum Max Payload Size between the PCIE root Port and the end point functions
+ ///
+ if (*MaxPayload > EndPointMaxPayload) {
+ *MaxPayload = EndPointMaxPayload;
+ }
+ }
+ }
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This function disable the forwarding of EOI messages unless it discovers
+ an IOAPIC behind this root port.
+
+ @param[in] RootBus The Bus Number of the root port
+ @param[in] RootDevice The Device Number of the root port
+ @param[in] RootFunction The Function Number of the root port
+ @param[in] EndPointBus The Bus Number of the Endpoint
+ @param[in] EndPointDevice The Device Number of the Endpoint
+
+ @exception EFI_UNSUPPORTED Unsupported operation.
+ @retval EFI_SUCCESS Successfully completed.
+**/
+EFI_STATUS
+PcieSetEoiFwdDisable (
+ IN UINT8 RootBus,
+ IN UINT8 RootDevice,
+ IN UINT8 RootFunction,
+ IN UINT8 EndPointBus,
+ IN UINT8 EndPointDevice
+ )
+{
+ BOOLEAN IoApicBehind;
+ UINTN RootDeviceBase;
+ UINTN DeviceBase;
+ UINT8 ProgInterface;
+ UINT8 SubClassCode;
+ UINT8 BaseClassCode;
+ UINT8 DeviceIndex;
+ UINT8 FunctionIndex;
+ UINT8 EndPointFunction;
+
+ IoApicBehind = FALSE;
+ RootDeviceBase = MmPciAddress (0, RootBus, RootDevice, RootFunction, 0);
+
+ ///
+ /// Check if an IOAPIC behind the root port
+ ///
+ for (DeviceIndex = 0; DeviceIndex <= EndPointDevice; DeviceIndex++) {
+ DeviceBase = MmPciAddress (0, EndPointBus, DeviceIndex, 0, 0);
+ if (MmioRead16 (DeviceBase + PCI_VENDOR_ID_OFFSET) == 0xFFFF) {
+ continue;
+ }
+ ///
+ /// Check if EndPoint device is Multi-Function Device
+ ///
+ if (MmioRead8 (DeviceBase + PCI_HEADER_TYPE_OFFSET) & HEADER_TYPE_MULTI_FUNCTION) {
+ ///
+ /// If multi-function Device, check function 0-7
+ ///
+ EndPointFunction = PCI_MAX_FUNC;
+ } else {
+ ///
+ /// Otherwise, check function 0 only
+ ///
+ EndPointFunction = 0;
+ }
+
+ for (FunctionIndex = 0; FunctionIndex <= EndPointFunction; FunctionIndex++) {
+ DeviceBase = MmPciAddress (0, EndPointBus, DeviceIndex, FunctionIndex, 0);
+ BaseClassCode = MmioRead8 (DeviceBase + PCI_CLASSCODE_OFFSET + 2);
+ SubClassCode = MmioRead8 (DeviceBase + PCI_CLASSCODE_OFFSET + 1);
+ ProgInterface = MmioRead8 (DeviceBase + PCI_CLASSCODE_OFFSET);
+
+ if ((BaseClassCode == PCI_CLASS_SYSTEM_PERIPHERAL) &&
+ (SubClassCode == PCI_SUBCLASS_PIC) &&
+ ((ProgInterface == PCI_IF_APIC_CONTROLLER) ||
+ (ProgInterface == PCI_IF_APIC_CONTROLLER2))) {
+ IoApicBehind = TRUE;
+ }
+ }
+ }
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 8.14 Additional PCI Express* Programming Steps
+ /// Step 20
+ /// If there is no IOAPIC behind the root port, set EOI Forwarding Disable bit (B0:D28:F0-F7:D4h[1]) to 1b.
+ ///
+ if (IoApicBehind == FALSE) {
+ #ifdef HOTPLUG_EOI_FLAG // AMI_OVERRIDE, [EIP84720]>
+ MmioOr8 (RootDeviceBase + 0xD4, (UINT8) (BIT1));
+ #else
+ //Supporting _RMV method in asl code, and reading hotplug capability register of root port
+ //if hotplug disable, then set EOI Forwarding Disable bit
+ #ifdef TBT_UP_PORT_FUNC_FLAG
+ if((TBT_UP_PORT_FUNC == RootFunction) || (!(MmioRead8 (DeviceBase + 0x54) & 0x40))){
+ #else
+ if(!(MmioRead8 (DeviceBase + 0x54) & 0x40)){
+ #endif
+ MmioOr8 (RootDeviceBase + 0xD4, (UINT8) (BIT1));
+ }
+ #endif // AMI_OVERRIDE, [EIP84720]<
+ }
+
+ return EFI_SUCCESS;
+}
+
+typedef enum {
+ CalculateAspm,
+ ManualAspm,
+ SetAspm
+} OPERATION;
+
+/**
+ This function compares the actual latency in LatencyValue1
+ with actual latency in LatencyValue2 and stores the minimum
+ back to LatencyValue1, in the required format.
+ If this is the first call, then LatencyValue1 will be replaced by LatencyValue2.
+
+ @param[in, out] LatencyValue1 - Current latency value
+ @param[in] LatencyValue2 - Latency value from the Table
+
+ @retval None
+**/
+VOID
+DetermineLatencyValue (
+ IN OUT UINT16 *LatencyValue1,
+ IN UINT16 *LatencyValue2
+ )
+{
+ ASSERT (LTR_SCALE_VALUE (*LatencyValue1) < 6);
+ ASSERT (LTR_SCALE_VALUE (*LatencyValue2) < 6);
+ ///
+ /// If there are more than one device behind a bridge that are part of the override table,
+ /// store the lower latency value and corresponding scale bits back to LatencyValue1
+ ///
+ if ((LTR_LATENCY_NS(*LatencyValue1) == 0) || (LTR_LATENCY_NS(*LatencyValue1) > LTR_LATENCY_NS(*LatencyValue2))) {
+ *LatencyValue1 = *LatencyValue2;
+ }
+}
+
+/**
+ Calculate/Set EndPoint device Power management settings
+
+ @param[in] RootDeviceBase The Root Port PCI Express address
+ @param[in] RootPcieCapOffset The pointer to the Root Port PCI Express Capability Structure
+ @param[in] EndPointBus The Bus Number of the Endpoint
+ @param[in] NumOfDevAspmOverride Number of Device specific ASPM policy override items
+ @param[in] DevAspmOverride Pointer to array of Device specific ASPM policy override items
+ @param[in, out] LinkAspmVal Resulting Link ASPM value programmed
+ @param[in] Operation Operation Types
+ @param[in] NumOfDevLtrOverride Number of Device specific LTR override items
+ @param[in] DevLtrOverride Pointer to array of Device specific LTR policy override items
+ @param[in, out] LtrOverrideVal Resulting LTR override value to be programmed
+ @param[in] RootL1SubstateExtCapOffset The register offset of Root Port L1 Substates
+ @param[in, out] L1SubstatesSupported Input and return the result of L1 Substates support
+ @param[in] L1SubstatesConfig L1 Substates configurations
+ @param[in, out] PortCommonModeRestoreTime Input and return common mode restore time of L1 Substate setting
+ @param[in, out] PortTpowerOnValue Input and return power on value of L1 Substate setting
+ @param[in, out] PortTpowerOnScale Input and return power on scale of L1 Substate setting
+ @param[in] PchPwrOptPcie Pcie Power Optimizer Configuration
+ @param[in, out] AspmOverride Input and return the Aspm Override enable for pre-1.1 devices
+ @param[in, out] ClkreqPerPortSupported Input to check if clkreq per port is supportted
+ @param[in, out] RpAndEndPointsLtrSupported Return to check if all endpoints support LTR
+ @param[in] PolicyRevision Policy revision for codes compatibility
+
+ @retval EFI_SUCCESS Successfully completed
+ @retval EFI_NOT_FOUND Can not find device
+ @retval EFI_OUT_OF_RESOURCES The endpoint device is a bridge, but the Subordinate Bus Number of
+ the root port is not greater than its Secondary Bus Number. You may
+ get this error if PCI emulation is not done before this function gets
+ called and the platform policy settings of "TempRootPortBusNumMax" and
+ "TempRootPortBusNumMin" do not provide enough resource for temp bus
+ number usage.
+**/
+EFI_STATUS
+PcieEndPointPm (
+ IN UINTN RootDeviceBase,
+ IN UINT32 RootPcieCapOffset,
+ IN UINT8 EndPointBus,
+ IN UINT8 NumOfDevAspmOverride,
+ IN PCH_PCIE_DEVICE_ASPM_OVERRIDE *DevAspmOverride,
+ IN OUT UINT16 *LinkAspmVal,
+ IN OPERATION Operation,
+ IN UINT8 NumOfDevLtrOverride,
+ IN PCH_PCIE_DEVICE_LTR_OVERRIDE *DevLtrOverride,
+ IN OUT UINT32 *LtrOverrideVal,
+ IN UINT16 RootL1SubstateExtCapOffset,
+ IN OUT BOOLEAN *L1SubstatesSupported,
+ IN PCH_PCIE_EXPRESS_L1SUBSTATES_CONTROL L1SubstatesConfig,
+ IN OUT UINT32 *PortCommonModeRestoreTime,
+ IN OUT UINT32 *PortTpowerOnValue,
+ IN OUT UINT32 *PortTpowerOnScale,
+ IN PCH_PCIE_PWR_OPT *PchPwrOptPcie,
+ IN OUT BOOLEAN *AspmOverride,
+ IN BOOLEAN *ClkreqPerPortSupported,
+ IN OUT BOOLEAN *RpAndEndPointsLtrSupported,
+ IN UINT8 PolicyRevision
+ )
+{
+ EFI_STATUS Status;
+ UINTN EndPointBase;
+ UINT8 EndPointFunction;
+ UINT8 EndPointPcieCapOffset;
+ UINT8 PcieDeviceIndex;
+ UINT16 EndPointAspm;
+ UINT16 EndPointVendorId;
+ UINT16 EndPointDeviceId;
+ UINT8 EndPointRevId;
+ UINT8 EndPointBaseClassCode;
+ UINT8 EndPointSubClassCode;
+ UINT32 PortLxLat;
+ UINT32 EndPointLxLat;
+ UINT32 LxLat;
+ UINT8 DownStreamBusMin;
+ UINT8 ClassCode;
+ UINT8 RootDevSubBusNum;
+ BOOLEAN BusAssign;
+ UINT8 DeviceIndex;
+ UINT8 FunctionIndex;
+ UINT16 LtrExtendedCapOffset;
+ UINT32 DeviceCapabilities2;
+ UINT16 DefaultMaxLatency;
+ UINT16 Data16;
+ UINT32 Data32;
+ UINT16 EndPointL1SubStateCapOffset;
+ UINT32 RootDeviceL1Substates;
+ UINT32 EndPointL1Substates;
+ UINT8 EndPointPortCommonModeRestoreTime;
+ UINT8 EndPointTpowerOnScale;
+ UINT8 EndPointTpowerOnValue;
+ UINT32 Multiplier[4] = {2, 10, 100, 0};
+ UINT32 EndPointL1SubstCapMask;
+ PCH_SERIES PchSeries;
+
+ DefaultMaxLatency = 0;
+ PchSeries = GetPchSeries();
+ for (DeviceIndex = 0; DeviceIndex <= PCI_MAX_DEVICE; DeviceIndex++) {
+ EndPointBase = MmPciAddress (0, EndPointBus, DeviceIndex, 0, 0);
+ if (MmioRead16 (EndPointBase + PCI_VENDOR_ID_OFFSET) == 0xFFFF) {
+ continue;
+ }
+ ///
+ /// Check if EndPoint device is Multi-Function Device
+ ///
+ if (MmioRead8 (EndPointBase + PCI_HEADER_TYPE_OFFSET) & HEADER_TYPE_MULTI_FUNCTION) {
+ ///
+ /// If multi-function Device, check function 0-7
+ ///
+ EndPointFunction = PCI_MAX_FUNC;
+ } else {
+ ///
+ /// Otherwise, check function 0 only
+ ///
+ EndPointFunction = 0;
+ }
+
+ for (FunctionIndex = 0; FunctionIndex <= EndPointFunction; FunctionIndex++) {
+ ///
+ /// Get the pointer to the Endpoint PCI Express Capability Structure.
+ ///
+ EndPointPcieCapOffset = PcieFindCapId (EndPointBus, DeviceIndex, FunctionIndex, EFI_PCI_CAPABILITY_ID_PCIEXP);
+
+ if (EndPointPcieCapOffset == 0) {
+ if (FunctionIndex < EndPointFunction) {
+ continue;
+ } else {
+ return EFI_NOT_FOUND;
+ }
+ }
+ EndPointBase = MmPciAddress (0, EndPointBus, DeviceIndex, FunctionIndex, 0);
+ EndPointVendorId = MmioRead16 (EndPointBase + R_PCH_PCIE_VENDOR_ID);
+ EndPointDeviceId = MmioRead16 (EndPointBase + R_PCH_PCIE_DEVICE_ID);
+ EndPointRevId = MmioRead8 (EndPointBase + R_PCH_PCIE_RID);
+ EndPointL1SubStateCapOffset = 0;
+ RootDeviceL1Substates = 0;
+ EndPointL1Substates = 0;
+ EndPointL1SubstCapMask = 0x0000001F;
+ if (PchSeries == PchLp) {
+ ///
+ /// Get the endpoint supports L1 Substates Capabilities
+ ///
+ for (PcieDeviceIndex = 0; PcieDeviceIndex < NumOfDevAspmOverride; PcieDeviceIndex++) {
+ if ((PolicyRevision >= DXE_PCH_PLATFORM_POLICY_PROTOCOL_REVISION_2) &&
+ ((DevAspmOverride[PcieDeviceIndex].OverrideConfig & PchPcieL1SubstatesOverride) == PchPcieL1SubstatesOverride) &&
+ (EndPointVendorId == DevAspmOverride[PcieDeviceIndex].VendorId) &&
+ (EndPointDeviceId == DevAspmOverride[PcieDeviceIndex].DeviceId) &&
+ ((EndPointRevId == DevAspmOverride[PcieDeviceIndex].RevId) ||
+ (DevAspmOverride[PcieDeviceIndex].RevId == 0xFF))) {
+ if ((EndPointVendorId == 0x8086) &&
+ ((EndPointDeviceId == 0x08B1) || (EndPointDeviceId == 0x08B2) ||
+ (EndPointDeviceId == 0x08B3) || (EndPointDeviceId == 0x08B4))) {
+ if ((MmioRead32 (EndPointBase + DevAspmOverride[PcieDeviceIndex].L1SubstatesCapOffset) & 0xFFFF) == 0xCAFE) {
+ EndPointL1SubStateCapOffset = DevAspmOverride[PcieDeviceIndex].L1SubstatesCapOffset;
+ EndPointL1SubstCapMask = DevAspmOverride[PcieDeviceIndex].L1SubstatesCapMask;
+ }
+ } else {
+ EndPointL1SubStateCapOffset = DevAspmOverride[PcieDeviceIndex].L1SubstatesCapOffset;
+ EndPointL1SubstCapMask = DevAspmOverride[PcieDeviceIndex].L1SubstatesCapMask;
+ }
+ }
+ }
+ if (EndPointL1SubStateCapOffset == 0) {
+ EndPointL1SubStateCapOffset = PcieFindExtendedCapId (
+ EndPointBus,
+ DeviceIndex,
+ FunctionIndex,
+ 0x1E);
+ }
+ if (EndPointL1SubStateCapOffset != 0) {
+ RootDeviceL1Substates = MmioRead32 (RootDeviceBase + RootL1SubstateExtCapOffset + 0x04);
+ EndPointL1Substates = MmioRead32 (EndPointBase + EndPointL1SubStateCapOffset + 0x04);
+ }
+ }
+ DeviceCapabilities2 = MmioRead32 (EndPointBase + EndPointPcieCapOffset + 0x24);
+ if (((DeviceCapabilities2 & BIT11) == 0) || (PchPwrOptPcie->LtrEnable != TRUE)) {
+ *RpAndEndPointsLtrSupported = FALSE;
+ }
+ ///
+ /// Configure downstream device if present.
+ ///
+
+ if (Operation == CalculateAspm || Operation == ManualAspm) {
+ if ((MmioRead32 (EndPointBase + EndPointPcieCapOffset + 0x00C) & BIT18) != BIT18) {
+ *ClkreqPerPortSupported = FALSE;
+ }
+ EndPointAspm = (MmioRead16 (EndPointBase + EndPointPcieCapOffset + 0x00C) >> 10) & 3;
+ DEBUG ((EFI_D_INFO, "Endpoint Device %0x Capability ASPM: %0x\n", DeviceIndex, EndPointAspm));
+ if (Operation == CalculateAspm) {
+ ///
+ /// Check endpoint for pre-1.1 devices based on the Role based Error Reporting Capability bit
+ /// and enable Aspm Override
+ ///
+ if (!(MmioRead16 (EndPointBase + EndPointPcieCapOffset + 0x4) & BIT15)) {
+ DEBUG ((EFI_D_INFO, "Override root port ASPM to L1 for pre-1.1 devices\n"));
+ *AspmOverride = TRUE;
+ }
+ ///
+ /// Mask APMC with values from lookup table.
+ /// RevID of 0xFF applies to all steppings.
+ ///
+ EndPointBaseClassCode = MmioRead8 (EndPointBase + R_PCH_PCIE_BCC);
+ EndPointSubClassCode = MmioRead8 (EndPointBase + R_PCH_PCIE_SCC);
+
+ for (PcieDeviceIndex = 0; PcieDeviceIndex < NumOfDevAspmOverride; PcieDeviceIndex++) {
+ if ((PolicyRevision >= DXE_PCH_PLATFORM_POLICY_PROTOCOL_REVISION_2) &&
+ ((DevAspmOverride[PcieDeviceIndex].OverrideConfig & PchPcieL1L2Override) == PchPcieL1L2Override) &&
+ ((DevAspmOverride[PcieDeviceIndex].VendorId == EndPointVendorId) ||
+ (DevAspmOverride[PcieDeviceIndex].VendorId == 0xFFFF)) &&
+ ((DevAspmOverride[PcieDeviceIndex].DeviceId == EndPointDeviceId) ||
+ (DevAspmOverride[PcieDeviceIndex].DeviceId == 0xFFFF)) &&
+ ((DevAspmOverride[PcieDeviceIndex].RevId == EndPointRevId) ||
+ (DevAspmOverride[PcieDeviceIndex].RevId == 0xFF)) &&
+ ((DevAspmOverride[PcieDeviceIndex].BaseClassCode == EndPointBaseClassCode) ||
+ (DevAspmOverride[PcieDeviceIndex].BaseClassCode == 0xFF)) &&
+ ((DevAspmOverride[PcieDeviceIndex].SubClassCode == EndPointSubClassCode) ||
+ (DevAspmOverride[PcieDeviceIndex].SubClassCode == 0xFF))) {
+ ///
+ /// Override value of 0xFF applies to all.
+ ///
+ EndPointAspm = DevAspmOverride[PcieDeviceIndex].EndPointAspm;
+ break;
+ }
+ }
+ ///
+ /// Check if L1 should be enabled based on port and endpoint L1 exit latency.
+ ///
+ if (EndPointAspm & BIT1) {
+ PortLxLat = MmioRead32 (RootDeviceBase + RootPcieCapOffset + 0x00C) & (BIT17 + BIT16 + BIT15);
+ EndPointLxLat = MmioRead32 (EndPointBase + EndPointPcieCapOffset + 0x00C) & (BIT17 + BIT16 + BIT15);
+
+ LxLat = PortLxLat;
+ if (PortLxLat < EndPointLxLat) {
+ LxLat = EndPointLxLat;
+ }
+ ///
+ /// check if the value is bigger than endpoint L1 acceptable exit latency, if it is
+ /// larger than accepted value, then we should disable L1
+ ///
+ LxLat >>= 6;
+ if (LxLat > (MmioRead32 (EndPointBase + EndPointPcieCapOffset + 0x004) & (BIT11 + BIT10 + BIT9))) {
+ EndPointAspm &= ~BIT1;
+ }
+ }
+ ///
+ /// Check if L0s should be enabled based on port and endpoint L0s exit latency.
+ ///
+ if (EndPointAspm & BIT0) {
+ PortLxLat = MmioRead32 (RootDeviceBase + RootPcieCapOffset + 0x00C) & (BIT14 + BIT13 + BIT12);
+ EndPointLxLat = MmioRead32 (EndPointBase + EndPointPcieCapOffset + 0x00C) & (BIT14 + BIT13 + BIT12);
+
+ LxLat = PortLxLat;
+ if (PortLxLat < EndPointLxLat) {
+ LxLat = EndPointLxLat;
+ }
+ ///
+ /// check if the value is bigger than endpoint L0s acceptable exit latency, if it is
+ /// larger than accepted value, then we should disable L0s
+ ///
+ LxLat >>= 6;
+ if (LxLat > (MmioRead32 (EndPointBase + EndPointPcieCapOffset + 0x004) & (BIT8 + BIT7 + BIT6))) {
+ EndPointAspm &= ~BIT0;
+ }
+ }
+ }
+
+ *LinkAspmVal &= EndPointAspm;
+ DEBUG ((EFI_D_INFO, "Calculate Endpoint Device %0x Aspm Value: %0x\n", DeviceIndex, EndPointAspm));
+ if (PchSeries == PchLp) {
+ ///
+ /// Check if the endpoint supports L1 Substates Capabilities
+ ///
+ if ((EndPointL1SubStateCapOffset != 0) && (RootL1SubstateExtCapOffset != 0)) {
+ ///
+ /// If both Root and endpoint's L1 Sub-States Extended Capability Offset + 0x04[4:0] are 11111b,
+ /// a. Read L1 Sub-States Extended Capability Offset + 0x04[15:8], and program the highest value advertised
+ /// between PCIe rootport and device to L1 Sub-States Extended Capability Offset + 0x08[15:8] on
+ /// Pcie root port.
+ /// b. Read L1 Sub-States Extended Capability Offset + 0x04[23:19] and [17:16], and program the highest value
+ /// advertised between PCIe root port and device.to L1 Sub-States Extended Capability Offset + 0x08 [7:0] on
+ /// both Pcie root port and device.
+ /// c. Program L1 Sub-States Extended Capability Offset + 0x08[31:29] to 010b for both Pcie root port and device
+ /// d. Program L1 Sub-States Extended Capability Offset + 0x08[25:16] to 0010100000b for both Pcie root port and device
+ /// e. Program L1 Sub-States Extended Capability Offset + 0x08[4:0] to 01111b for both Pcie root port and device
+ ///
+ if (((RootDeviceL1Substates & 0x1F) == 0x1F) &&
+ ((EndPointL1Substates & EndPointL1SubstCapMask) == EndPointL1SubstCapMask) &&
+ (L1SubstatesConfig != PchPcieL1SubstatesDisabled)) {
+ *L1SubstatesSupported = TRUE;
+ EndPointPortCommonModeRestoreTime = (EndPointL1Substates >> 8) & 0xFF;
+ EndPointTpowerOnScale = (EndPointL1Substates >> 16) & 0x3;
+ EndPointTpowerOnValue = (EndPointL1Substates >> 19) & 0x1F;
+
+ if (EndPointPortCommonModeRestoreTime > *PortCommonModeRestoreTime) {
+ *PortCommonModeRestoreTime = EndPointPortCommonModeRestoreTime;
+ }
+
+ if ((EndPointTpowerOnValue * Multiplier[EndPointTpowerOnScale]) >
+ (*PortTpowerOnValue * Multiplier[*PortTpowerOnScale])) {
+ *PortTpowerOnValue = EndPointTpowerOnValue;
+ *PortTpowerOnScale = EndPointTpowerOnScale;
+ }
+ }
+ }
+ }
+ ///
+ /// For each device detected, scan the LTR override table
+ /// If there are endpoints connected directly to the rootport then
+ /// LtrOverrideVal will be replaced by the value from the table for that endpoint
+ /// If there are endpoints that are behind a bridge and that are also part of the table then
+ /// LtrOverrideVal will maintain the minimum of all such values.
+ /// A non zero value of LtrOverrideVal will indicate:
+ /// i):That there is atleast one entry in the LTR override Table
+ /// ii):The final value to be programmed in offset 0x400. This value will be applied for all the devices
+ /// connected to this root port
+ ///
+ Data32 = *LtrOverrideVal;
+ if (DevLtrOverride != NULL) {
+ for (PcieDeviceIndex = 0; PcieDeviceIndex < NumOfDevLtrOverride; PcieDeviceIndex++) {
+ if ((DevLtrOverride[PcieDeviceIndex].VendorId == EndPointVendorId) &&
+ ((DevLtrOverride[PcieDeviceIndex].DeviceId == EndPointDeviceId) ||
+ (DevLtrOverride[PcieDeviceIndex].DeviceId == 0xFFFF)) &&
+ ((DevLtrOverride[PcieDeviceIndex].RevId == EndPointRevId) ||
+ (DevLtrOverride[PcieDeviceIndex].RevId == 0xFF))) {
+
+ ///
+ /// Get the Non-Snoop latency value from the table, compare and store the minimum
+ ///
+ if (DevLtrOverride[PcieDeviceIndex].NonSnoopLatency & BIT15) {
+ Data16 = (UINT16)((Data32 & 0xFFFF0000) >> 16);
+ DetermineLatencyValue(&Data16, &DevLtrOverride[PcieDeviceIndex].NonSnoopLatency);
+ Data32 = (Data32 & 0xFFFF) | ((UINT32)(Data16 << 16));
+ }
+
+ ///
+ /// Get the Snoop latency value from the table, compare and store the minimum
+ ///
+ if (DevLtrOverride[PcieDeviceIndex].SnoopLatency & BIT15) {
+ Data16 = (UINT16)(Data32 & 0xFFFF);
+ DetermineLatencyValue(&Data16, &DevLtrOverride[PcieDeviceIndex].SnoopLatency);
+ Data32 = (Data32 & 0xFFFF0000) | (UINT32)Data16;
+ }
+ *LtrOverrideVal = Data32;
+ break;
+ }
+ }
+ }
+ } else if (Operation == SetAspm) {
+ if (PchSeries == PchLp) {
+ if ((EndPointL1SubStateCapOffset != 0) && (*L1SubstatesSupported)) {
+ if (((RootDeviceL1Substates & 0x1F) == 0x1F) &&
+ ((EndPointL1Substates & EndPointL1SubstCapMask) == EndPointL1SubstCapMask)) {
+ MmioAndThenOr32 (
+ EndPointBase + EndPointL1SubStateCapOffset + 0x0C,
+ (UINT32) ~(0xF8),
+ (*PortTpowerOnValue << 3)
+ );
+ MmioAndThenOr32 (
+ EndPointBase + EndPointL1SubStateCapOffset + 0x0C,
+ (UINT32) ~(0x03),
+ *PortTpowerOnScale);
+ MmioAndThenOr32 (
+ EndPointBase + EndPointL1SubStateCapOffset + 0x08,
+ (UINT32) ~(0xE3FF0000),
+ (UINT32) (BIT30 | BIT23 | BIT21)
+ );
+ Data32 = (BIT3 | BIT2 | BIT1 | BIT0);
+ if (L1SubstatesConfig == PchPcieL1SubstatesL1_1) {
+ Data32 &= (UINT32)~(BIT0);
+ }
+ if (L1SubstatesConfig == PchPcieL1SubstatesL1_2) {
+ Data32 &= (UINT32)~(BIT1);
+ }
+ MmioAndThenOr32 (
+ EndPointBase + EndPointL1SubStateCapOffset + 0x08,
+ (UINT32) ~(0x1F),
+ Data32
+ );
+ }
+ }
+ }
+ ///
+ /// Write it to the Link Control register
+ ///
+ DEBUG ((EFI_D_INFO, "Program Endpoint Device %0x Aspm Value: %0x\n", DeviceIndex, *LinkAspmVal));
+ MmioAndThenOr16 (EndPointBase + EndPointPcieCapOffset + 0x10, 0xFFFC, *LinkAspmVal);
+ ///
+ /// PCH BIOS Spec Rev 0.5.5, Section 8.14.1 Power Optimizer Configuration
+ /// Step 3
+ /// For PCIe Endpoint,
+ /// If Endpoint device supported LTR, Device Capabilities 2 Register Offset 24h [11] = 1b,
+ ///
+ if ((DeviceCapabilities2 & BIT11) && (PchPwrOptPcie->LtrEnable == TRUE)) {
+ ///
+ /// Step 3.1
+ /// Program Endpoint LTR Mechanism Enable, Device Control 2 Register Offset 28h [10] = 1b
+ /// when device supports LTR but is not found in override table (table listing correct
+ /// latency requirements for devices that supports LTR and also for devices that do not
+ /// support LTR)
+ ///
+ if (DevLtrOverride != NULL) {
+ for (PcieDeviceIndex = 0; PcieDeviceIndex < NumOfDevLtrOverride; PcieDeviceIndex++) {
+ if ((DevLtrOverride[PcieDeviceIndex].VendorId != EndPointVendorId) ||
+ ((DevLtrOverride[PcieDeviceIndex].DeviceId != EndPointDeviceId) &&
+ (DevLtrOverride[PcieDeviceIndex].DeviceId != 0xFFFF)) ||
+ ((DevLtrOverride[PcieDeviceIndex].RevId != EndPointRevId) &&
+ (DevLtrOverride[PcieDeviceIndex].RevId != 0xFF))) {
+ MmioOr16 (EndPointBase + EndPointPcieCapOffset + 0x28, BIT10);
+ break;
+ }
+ }
+ } else {
+ MmioOr16 (EndPointBase + EndPointPcieCapOffset + 0x28, BIT10);
+ }
+ }
+ ///
+ /// Get the pointer to the Endpoint PCI Express Extended Capability Structure
+ /// and configure the Max Snoop and Max No-Snoop Latency for the endpoint
+ ///
+ LtrExtendedCapOffset = PcieFindExtendedCapId (EndPointBus, DeviceIndex, FunctionIndex, 0x18);
+ if (LtrExtendedCapOffset != 0) {
+ Data32 = *LtrOverrideVal;
+ if (PchSeries == PchH) {
+ DefaultMaxLatency = 0x0846;
+ }
+ if (PchSeries == PchLp) {
+ DefaultMaxLatency = 0x1003;
+ }
+ ///
+ /// PCH BIOS Spec Rev 0.5.6, Section 8.14.1 Power Optimizer Configuration
+ /// Step 3.2
+ /// Program Endpoint Max Snoop Latency Register, Latency Tolerance Reporting(LTR)
+ /// Capability Offset 04h [15:0] with Intel recommended default value for max snoop
+ /// latency if there is no snoop latency override value getting programmed in the
+ /// override register else program the endpoint Max Snoop Latency Register with the
+ /// minimum of snoop latency override value for that root port and Intel recommended
+ /// default value for max snoop latency
+ /// Intel recommended default value for max snoop latency for LPT-H = 0x0846
+ /// Intel recommended default value for max snoop latency for LPT-LP = 0x1003
+ ///
+ if (PolicyRevision >= DXE_PCH_PLATFORM_POLICY_PROTOCOL_REVISION_7) {
+ DefaultMaxLatency = PchPwrOptPcie->LtrMaxSnoopLatency;
+ }
+
+ Data16 = (UINT16)(Data32 & 0xFFFF);
+ ///
+ /// Set the max snoop latency to either the default max snoop latency or to the snoop latency override value
+ /// that is being programmed for this root port
+ ///
+ DetermineLatencyValue(&Data16, &DefaultMaxLatency);
+ MmioAndThenOr16 (
+ EndPointBase + LtrExtendedCapOffset + 4,
+ (UINT16) (~0x1FFF),
+ Data16
+ );
+ ///
+ /// PCH BIOS Spec Rev 0.5.6, Section 8.14.1 Power Optimizer Configuration
+ /// Step 3.3
+ /// Program Endpoint Max No-Snoop Latency Register, Latency Tolerance Reporting(LTR)
+ /// Capability Offset 06h [15:0] with Intel recommended default value for max no-snoop
+ /// latency if there is no No-snoop latency override value getting programmed in the
+ /// override register else program the endpoint Max No-Snoop Latency Register with the
+ /// minimum of No-snoop latency override value for that root port and Intel recommended
+ /// default value for max no-snoop latency
+ /// Intel recommended default value for max no-snoop latency for LPT-H = 0x0846
+ /// Intel recommended default value for max no-snoop latency for LPT-LP = 0x1003
+ ///
+ if (PolicyRevision >= DXE_PCH_PLATFORM_POLICY_PROTOCOL_REVISION_7) {
+ DefaultMaxLatency = PchPwrOptPcie->LtrMaxNoSnoopLatency;
+ }
+ Data16 = (UINT16)((Data32 & 0xFFFF0000) >> 16);
+ DetermineLatencyValue(&Data16, &DefaultMaxLatency);
+ MmioAndThenOr16 (
+ EndPointBase + LtrExtendedCapOffset + 6,
+ (UINT16) (~0x1FFF),
+ Data16
+ );
+ }
+ ///
+ /// Step 4
+ /// For PCIe Endpoint,
+ /// If Endpoint device supported OBFF, Device Capabilities 2 Register Offset 24h [19:18] = 2h,
+ ///
+ if ((DeviceCapabilities2 & BIT19) && (PchPwrOptPcie->ObffEnable == PCH_DEVICE_ENABLE)) {
+ ///
+ /// Step 4.1
+ /// Program Endpoint OBFF Mechanism Enable, Device Control 2 Register Offset 28h [14:13] = 3h
+ ///
+ MmioOr16 (EndPointBase + EndPointPcieCapOffset + 0x28, (BIT14 + BIT13));
+ }
+ }
+ ///
+ /// Check if this device is a bridge
+ ///
+ ClassCode = MmioRead8 (EndPointBase + R_PCH_PCIE_BCC);
+
+ if (ClassCode == PCI_CLASS_BRIDGE) {
+ ///
+ /// Get the downstream Bus number
+ ///
+ DownStreamBusMin = (UINT8) (MmioRead32 (EndPointBase + PCI_BRIDGE_PRIMARY_BUS_REGISTER_OFFSET) >> 8);
+ ///
+ /// If the Secondary Bus Number of endpoint device is not assigned
+ ///
+ if (DownStreamBusMin == 0) {
+ RootDevSubBusNum = (UINT8) (MmioRead32 (RootDeviceBase + PCI_BRIDGE_PRIMARY_BUS_REGISTER_OFFSET) >> 16);
+ ///
+ /// If the endpoint device is a bridge, the Subordinate Bus Number of the root port will need to be greater
+ /// than the Secondary Bus Number of the root port (the Bus Number of endpoint device).
+ ///
+ if (RootDevSubBusNum > EndPointBus) {
+ ///
+ /// Assign the Primary, Secondary and Subordinate Bus Number to endpoint device
+ ///
+ MmioAndThenOr32 (
+ EndPointBase + PCI_BRIDGE_PRIMARY_BUS_REGISTER_OFFSET,
+ 0xFF000000,
+ EndPointBus | (((UINT32) (EndPointBus + 1) << 8)) | ((UINT32) (RootDevSubBusNum << 16))
+ );
+ DownStreamBusMin = EndPointBus + 1;
+ } else {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ BusAssign = FALSE;
+ } else {
+ BusAssign = TRUE;
+ }
+
+ if (DownStreamBusMin > EndPointBus) {
+ Status = PcieEndPointPm (
+ RootDeviceBase,
+ RootPcieCapOffset,
+ DownStreamBusMin,
+ NumOfDevAspmOverride,
+ DevAspmOverride,
+ LinkAspmVal,
+ Operation,
+ NumOfDevLtrOverride,
+ DevLtrOverride,
+ LtrOverrideVal,
+ RootL1SubstateExtCapOffset,
+ L1SubstatesSupported,
+ L1SubstatesConfig,
+ PortCommonModeRestoreTime,
+ PortTpowerOnValue,
+ PortTpowerOnScale,
+ PchPwrOptPcie,
+ AspmOverride,
+ ClkreqPerPortSupported,
+ RpAndEndPointsLtrSupported,
+ PolicyRevision
+ );
+ if (Status == EFI_NOT_FOUND) {
+ DEBUG ((EFI_D_INFO, "Check DownStreamBus:%d and no device found!\n", DownStreamBusMin));
+ }
+
+ if (BusAssign == FALSE) {
+ ///
+ /// Clear Bus Numbers.
+ ///
+ MmioAnd32 (EndPointBase + PCI_BRIDGE_PRIMARY_BUS_REGISTER_OFFSET, 0xFF000000);
+ }
+ }
+ }
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This function checks if the root port and downstream device support Clkreq per port, ASPM L1 and L1 substates
+
+ @param[in] RootBus Pci Bus Number of the root port
+ @param[in] RootDevice Pci Device Number of the root port
+ @param[in] RootFunction Pci Function Number of the root port
+ @param[in] RootPortAspm Root port Aspm configuration
+ @param[in] NumOfDevAspmOverride Number of Device specific ASPM policy override items
+ @param[in] DevAspmOverride Pointer to array of Device specific ASPM policy override items
+ @param[in] TempBusNumberMin Minimal temp bus number that can be assigned to the root port (as secondary
+ bus number) and its down stream switches
+ @param[in] TempBusNumberMax Maximal temp bus number that can be assigned to the root port (as subordinate
+ bus number) and its down stream switches
+ @param[in] NumOfDevLtrOverride Number of Device specific LTR override items
+ @param[in] DevLtrOverride Pointer to array of Device specific LTR policy override items
+ @param[in] PchPwrOptPcie Pcie Power Optimizer Configuration
+ @param[in, out] L1SubstatesSupported Flag to indicate if L1 Substates are supported
+ @param[in] L1SubstatesConfig L1 Substates configuration
+ @param[in] PolicyRevision Revision of the policy
+ @param[in, out] AspmVal Aspm value for both rootport and end point devices
+ @param[in, out] ClkreqPerPortSupported Clkreq support for both rootport and endpoint devices
+ @param[out] LtrSupported Check and return if all endpoints support LTR
+
+ @retval EFI_SUCCESS The function completed successfully
+ @exception EFI_UNSUPPORTED The pointer to the Port PCI Express Capability Structure is not found
+**/
+EFI_STATUS
+PcieCheckPmConfig (
+ IN UINT8 RootBus,
+ IN UINT8 RootDevice,
+ IN UINT8 RootFunction,
+ IN PCH_PCI_EXPRESS_ASPM_CONTROL RootPortAspm,
+ IN UINT8 NumOfDevAspmOverride,
+ IN PCH_PCIE_DEVICE_ASPM_OVERRIDE *DevAspmOverride,
+ IN UINT8 TempBusNumberMin,
+ IN UINT8 TempBusNumberMax,
+ IN UINT8 NumOfDevLtrOverride,
+ IN PCH_PCIE_DEVICE_LTR_OVERRIDE *DevLtrOverride,
+ IN PCH_PCIE_PWR_OPT *PchPwrOptPcie,
+ IN OUT BOOLEAN *L1SubstatesSupported,
+ IN PCH_PCIE_EXPRESS_L1SUBSTATES_CONTROL L1SubstatesConfig,
+ IN UINT8 PolicyRevision,
+ IN OUT UINT16 *AspmVal,
+ IN OUT BOOLEAN *ClkreqPerPortSupported,
+ OUT BOOLEAN *LtrSupported
+ )
+{
+ EFI_STATUS Status;
+ UINTN RootDeviceBase;
+ UINT32 RootPcieCapOffset;
+ UINT8 EndPointBus;
+ OPERATION Operation;
+ UINT16 SlotStatus;
+ BOOLEAN BusAssign;
+ UINT32 DeviceCapabilities2;
+ UINT32 LtrOvrVal;
+ UINT32 Data32Or;
+ UINT16 GpioBase;
+ UINT32 RootComplexBar;
+ UINT16 RootL1SubstateExtCapOffset;
+ UINT32 PortCommonModeRestoreTime;
+ UINT32 PortTpowerOnValue;
+ UINT32 PortTpowerOnScale;
+ BOOLEAN AspmOverride;
+ PCH_SERIES PchSeries;
+ UINT8 RootPortNumber;
+
+ PchSeries = GetPchSeries();
+ Status = EFI_SUCCESS;
+ RootDeviceBase = MmPciAddress (0, RootBus, RootDevice, RootFunction, 0);
+ RootComplexBar = PCH_RCRB_BASE;
+ PortCommonModeRestoreTime = 0;
+ PortTpowerOnValue = 0;
+ PortTpowerOnScale = 0;
+ *L1SubstatesSupported = FALSE;
+ AspmOverride = FALSE;
+ *ClkreqPerPortSupported = FALSE;
+ GpioBase = 0;
+
+ if (MmioRead16 (RootDeviceBase + PCI_VENDOR_ID_OFFSET) == 0xFFFF) {
+ return EFI_NOT_FOUND;
+ }
+ if (PchSeries == PchLp) {
+ GpioBase = MmioRead16 (
+ MmPciAddress (0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_GPIO_BASE)
+ ) & B_PCH_LPC_GPIO_BASE_BAR;
+
+ RootPortNumber = GetPchPcieRpNumber(RootComplexBar, RootFunction);
+ Data32Or = (IoRead32 ((UINTN) (GpioBase + R_PCH_GP_X_CONFIG0(18 + RootPortNumber))) & B_PCH_GPIO_OWN0_GPIO_USE_SEL);
+
+ if (Data32Or == 0) {
+ *ClkreqPerPortSupported = TRUE;
+ }
+ }
+
+ ///
+ /// Get the pointer to the Port PCI Express Capability Structure.
+ ///
+ RootPcieCapOffset = PcieFindCapId (RootBus, RootDevice, RootFunction, EFI_PCI_CAPABILITY_ID_PCIEXP);
+ if (RootPcieCapOffset == 0) {
+ return EFI_UNSUPPORTED;
+ }
+ DeviceCapabilities2 = MmioRead32 (RootDeviceBase + RootPcieCapOffset + 0x24);
+
+ *AspmVal = (MmioRead16 (RootDeviceBase + RootPcieCapOffset + 0x00C) >> 10) & 3;
+ if (RootPortAspm == PchPcieAspmAutoConfig) {
+ Operation = CalculateAspm;
+ } else {
+ Operation = ManualAspm;
+ *AspmVal &= RootPortAspm;
+ }
+ ///
+ /// Get the downstream Bus number
+ ///
+ EndPointBus = (UINT8) (MmioRead32 (RootDeviceBase + PCI_BRIDGE_PRIMARY_BUS_REGISTER_OFFSET) >> 8);
+ ///
+ /// If the Secondary Bus Number of the root port is not assigned
+ /// Note:
+ /// It will be better that PCI emulation has been done before PcieSetPm(). Or, you will need to assign
+ /// a larger number to TempRootPortBusNumMax to support the specific card which has many bridges behind.
+ /// If it is not, the platform policy settings of "TempRootPortBusNumMax" and "TempRootPortBusNumMin"
+ /// will be assigned to the Subordinate and Secondary Bus Number of the root ports.
+ /// The assigned bus number will be cleared in the end of PcieSetPm().
+ ///
+ if (EndPointBus == 0) {
+ MmioAndThenOr32 (
+ RootDeviceBase + PCI_BRIDGE_PRIMARY_BUS_REGISTER_OFFSET,
+ 0xFF0000FF,
+ ((UINT32) (TempBusNumberMin << 8)) | ((UINT32) (TempBusNumberMax << 16))
+ );
+ EndPointBus = TempBusNumberMin;
+ BusAssign = FALSE;
+ } else {
+ BusAssign = TRUE;
+ }
+ ///
+ /// Check whether the slot has a device connected
+ ///
+ SlotStatus = MmioRead16 (RootDeviceBase + RootPcieCapOffset + 0x1A);
+ LtrOvrVal = 0;
+
+ RootL1SubstateExtCapOffset = 0;
+ if (PchSeries == PchLp) {
+ RootL1SubstateExtCapOffset = PcieFindExtendedCapId (RootBus, RootDevice, RootFunction, 0x1E);
+ if (RootL1SubstateExtCapOffset != 0) {
+ PortCommonModeRestoreTime = (MmioRead32 (RootDeviceBase + RootL1SubstateExtCapOffset + 0x04) >> 8) & 0xFF;
+ PortTpowerOnScale = (MmioRead32 (RootDeviceBase + RootL1SubstateExtCapOffset + 0x04) >> 16) & 0x3;
+ PortTpowerOnValue = (MmioRead32 (RootDeviceBase + RootL1SubstateExtCapOffset + 0x04) >> 19) & 0x1F;
+ }
+ }
+ ///
+ /// Obtain initial ASPM settings from respective port capability registers.
+ /// Scan LTR override table for device match and calculate the lowest override
+ /// value to be programmed into B0:D28:F0~F7 + 400h
+ ///
+ if (EndPointBus != 0 && (SlotStatus & BIT6) != 0) {
+ Status = PcieEndPointPm (
+ RootDeviceBase,
+ RootPcieCapOffset,
+ EndPointBus,
+ NumOfDevAspmOverride,
+ DevAspmOverride,
+ AspmVal,
+ Operation,
+ NumOfDevLtrOverride,
+ DevLtrOverride,
+ &LtrOvrVal,
+ RootL1SubstateExtCapOffset,
+ L1SubstatesSupported,
+ L1SubstatesConfig,
+ &PortCommonModeRestoreTime,
+ &PortTpowerOnValue,
+ &PortTpowerOnScale,
+ PchPwrOptPcie,
+ &AspmOverride,
+ ClkreqPerPortSupported,
+ LtrSupported,
+ PolicyRevision
+ );
+ }
+
+ if (BusAssign == FALSE) {
+ ///
+ /// Clear Bus Numbers.
+ ///
+ MmioAnd32 (RootDeviceBase + 0x018, 0xFF0000FF);
+ }
+
+ return Status;
+}
+/**
+ This function performs the Power Management settings for root port and downstream device
+
+ @param[in] RootBus Pci Bus Number of the root port
+ @param[in] RootDevice Pci Device Number of the root port
+ @param[in] RootFunction Pci Function Number of the root port
+ @param[in] RootPortAspm Root port Aspm configuration
+ @param[in] NumOfDevAspmOverride Number of Device specific ASPM policy override items
+ @param[in] DevAspmOverride Pointer to array of Device specific ASPM policy override items
+ @param[in] TempBusNumberMin Minimal temp bus number that can be assigned to the root port (as secondary
+ bus number) and its down stream switches
+ @param[in] TempBusNumberMax Maximal temp bus number that can be assigned to the root port (as subordinate
+ bus number) and its down stream switches
+ @param[in] NumOfDevLtrOverride Number of Device specific LTR override items
+ @param[in] DevLtrOverride Pointer to array of Device specific LTR policy override items
+ @param[in] PchPwrOptPcie Pcie Power Optimizer Configuration
+ @param[in, out] L1SubstatesSupported Flag to indicate if L1 Substates are supported
+ @param[in] L1SubstatesConfig L1 Substates configuration
+ @param[in] PolicyRevision Policy revision for codes compatibility
+ @param[in] FirstRpToSetPm Indicates if this is the first root port to be set
+ @param[in] L1SupportedInAllEnabledPorts Check if L1 is supported in all enabled ports
+ @param[in] ClkreqSupportedInAllEnabledPorts Check if clkreq is supported in all enabled ports
+ @param[out] LtrSupported Check and return if all endpoints support LTR
+
+ @retval EFI_SUCCESS The function completed successfully
+ @exception EFI_UNSUPPORTED The pointer to the Port PCI Express Capability Structure is not found
+**/
+EFI_STATUS
+PcieSetPm (
+ IN UINT8 RootBus,
+ IN UINT8 RootDevice,
+ IN UINT8 RootFunction,
+ IN PCH_PCI_EXPRESS_ASPM_CONTROL RootPortAspm,
+ IN UINT8 NumOfDevAspmOverride,
+ IN PCH_PCIE_DEVICE_ASPM_OVERRIDE *DevAspmOverride,
+ IN UINT8 TempBusNumberMin,
+ IN UINT8 TempBusNumberMax,
+ IN UINT8 NumOfDevLtrOverride,
+ IN PCH_PCIE_DEVICE_LTR_OVERRIDE *DevLtrOverride,
+ IN PCH_PCIE_PWR_OPT *PchPwrOptPcie,
+ IN OUT BOOLEAN *L1SubstatesSupported,
+ IN PCH_PCIE_EXPRESS_L1SUBSTATES_CONTROL L1SubstatesConfig,
+ IN UINT8 PolicyRevision,
+ IN BOOLEAN FirstRPToSetPm,
+ IN BOOLEAN L1SupportedInAllEnabledPorts,
+ IN BOOLEAN ClkreqSupportedInAllEnabledPorts,
+ OUT BOOLEAN *LtrSupported
+ )
+{
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 8.3.1 ASPM on DMI and the PCI Express* Root Ports
+ ///
+ /// When enabling L0s / L1 support, BIOS should enable upstream device before downstream
+ /// device. When disabling ASPM, BIOS should make sure downstream device is disabled
+ /// before upstream device.
+ /// The System BIOS must perform the following steps to enable
+ /// L0s/L1 on the root ports:
+ ///
+ /// 1. Determine whether the endpoint supports L1 by checking the Active State Link PM
+ /// Support field of the endpoint Link Capability Register. If the endpoint does not
+ /// support L1, the System BIOS can skip the L1 calculations below. Likewise, System
+ /// BIOS should not enable L1 on the root port or the endpoint if the endpoint does not
+ /// support L1.
+ /// 2. Calculate the total L0s and L1 exit latency. A description of this calculation
+ /// is provided in Section 8.3.1.1.
+ /// 3. Compare the calculated total exit latency with Endpoint L0s/L1 Acceptable Latency
+ /// read from the Device Capabilities Register of the Endpoint to determine if L0s or
+ /// L1 can be enabled for all or some of the links on the entire path to satisfy the
+ /// Acceptable Latency reported by the Endpoint. The Exit Latency fields reported by
+ /// the registers are given as a range. It is recommended that System BIOS uses the
+ /// high end of the range for the latency calculation and comparison. For example, if
+ /// the latency field reports "2 us to less than 4 us", then 4 us should be used for
+ /// the calculation.
+ /// 4. If the comparison in step 3 indicates L0s and L1 can be enabled on a root port and
+ /// the endpoints attached to the root port, then set the root port register
+ /// D28:F0~F7:Reg E8h[1], then set the APMC field, D28:F0~F7:Reg 50h[1:0] to 11b and write
+ /// the same value to the APMC field of the endpoint Link Control register. If the
+ /// comparison in step 1 indicates only L0s can be enabled on a root port and the
+ /// endpoints attached to the root port, then set the APMC field, D28:F0~F7:Reg 50h[1:0]
+ /// to 01b and write the same value to the APMC field of the endpoint Link Control
+ /// register.
+ ///
+ /// NOTE: current implementation does not support full length exit latency calculation
+ ///
+ UINT16 AspmVal;
+ EFI_STATUS Status;
+ UINTN RootDeviceBase;
+ UINT32 RootPcieCapOffset;
+ UINT8 EndPointBus;
+ OPERATION Operation;
+ UINT16 SlotStatus;
+ BOOLEAN BusAssign;
+ UINT32 DeviceCapabilities2;
+ UINT32 LtrOvrVal;
+ UINT32 Data32Or;
+ UINT8 Data8And;
+ UINT8 Data8Or;
+ UINT16 GpioBase;
+ BOOLEAN ClkreqPerPortSupported;
+ UINT32 RootComplexBar;
+ UINT16 RootL1SubstateExtCapOffset;
+ UINT32 PortCommonModeRestoreTime;
+ UINT32 PortTpowerOnValue;
+ UINT32 PortTpowerOnScale;
+ BOOLEAN AspmOverride;
+ PCH_SERIES PchSeries;
+ UINT8 RootPortNumber;
+#ifdef ULT_FLAG
+ UINT32 Data32;
+ UINT8 Response;
+#endif // ULT_FLAG
+
+ PchSeries = GetPchSeries();
+ Status = EFI_SUCCESS;
+ RootDeviceBase = MmPciAddress (0, RootBus, RootDevice, RootFunction, 0);
+ RootComplexBar = PCH_RCRB_BASE;
+ PortCommonModeRestoreTime = 0;
+ PortTpowerOnValue = 0;
+ PortTpowerOnScale = 0;
+ *L1SubstatesSupported = FALSE;
+ AspmOverride = FALSE;
+ ClkreqPerPortSupported = FALSE;
+ GpioBase = 0;
+
+ if (MmioRead16 (RootDeviceBase + PCI_VENDOR_ID_OFFSET) == 0xFFFF) {
+ return EFI_NOT_FOUND;
+ }
+ if (PchSeries == PchLp) {
+ GpioBase = MmioRead16 (
+ MmPciAddress (0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_GPIO_BASE)
+ ) & B_PCH_LPC_GPIO_BASE_BAR;
+
+ RootPortNumber = GetPchPcieRpNumber(RootComplexBar, RootFunction);
+ Data32Or = (IoRead32 ((UINTN) (GpioBase + R_PCH_GP_X_CONFIG0(18 + RootPortNumber))) & B_PCH_GPIO_OWN0_GPIO_USE_SEL);
+
+ if (Data32Or == 0) {
+ ClkreqPerPortSupported = TRUE;
+ }
+ }
+
+ ///
+ /// Get the pointer to the Port PCI Express Capability Structure.
+ ///
+ RootPcieCapOffset = PcieFindCapId (RootBus, RootDevice, RootFunction, EFI_PCI_CAPABILITY_ID_PCIEXP);
+ if (RootPcieCapOffset == 0) {
+ return EFI_UNSUPPORTED;
+ }
+ DeviceCapabilities2 = MmioRead32 (RootDeviceBase + RootPcieCapOffset + 0x24);
+
+ ///
+ /// Enable LTR mechanism for this root port if it is capable
+ ///
+ if ((DeviceCapabilities2 & BIT11) && (PchPwrOptPcie->LtrEnable == TRUE)) {
+ MmioOr16 (RootDeviceBase + RootPcieCapOffset + 0x28, BIT10);
+ }
+
+ ///
+ /// Enable OBFF using WAKE# signaling for this root port if it is capable
+ ///
+ if ((DeviceCapabilities2 & BIT19) && (PchPwrOptPcie->ObffEnable == TRUE)) {
+ MmioOr16 (RootDeviceBase + RootPcieCapOffset + 0x28, (BIT14 + BIT13));
+ }
+ AspmVal = (MmioRead16 (RootDeviceBase + RootPcieCapOffset + 0x00C) >> 10) & 3;
+ if (RootPortAspm == PchPcieAspmAutoConfig) {
+ Operation = CalculateAspm;
+ } else {
+ Operation = ManualAspm;
+ AspmVal &= RootPortAspm;
+ }
+ ///
+ /// Get the downstream Bus number
+ ///
+ EndPointBus = (UINT8) (MmioRead32 (RootDeviceBase + PCI_BRIDGE_PRIMARY_BUS_REGISTER_OFFSET) >> 8);
+ ///
+ /// If the Secondary Bus Number of the root port is not assigned
+ /// Note:
+ /// It will be better that PCI emulation has been done before PcieSetPm(). Or, you will need to assign
+ /// a larger number to TempRootPortBusNumMax to support the specific card which has many bridges behind.
+ /// If it is not, the platform policy settings of "TempRootPortBusNumMax" and "TempRootPortBusNumMin"
+ /// will be assigned to the Subordinate and Secondary Bus Number of the root ports.
+ /// The assigned bus number will be cleared in the end of PcieSetPm().
+ ///
+ if (EndPointBus == 0) {
+ MmioAndThenOr32 (
+ RootDeviceBase + PCI_BRIDGE_PRIMARY_BUS_REGISTER_OFFSET,
+ 0xFF0000FF,
+ ((UINT32) (TempBusNumberMin << 8)) | ((UINT32) (TempBusNumberMax << 16))
+ );
+ EndPointBus = TempBusNumberMin;
+ BusAssign = FALSE;
+ } else {
+ BusAssign = TRUE;
+ }
+ ///
+ /// Check whether the slot has a device connected
+ ///
+ SlotStatus = MmioRead16 (RootDeviceBase + RootPcieCapOffset + 0x1A);
+ LtrOvrVal = 0;
+
+ RootL1SubstateExtCapOffset = 0;
+ if (PchSeries == PchLp) {
+ RootL1SubstateExtCapOffset = PcieFindExtendedCapId (RootBus, RootDevice, RootFunction, 0x1E);
+ if (RootL1SubstateExtCapOffset != 0) {
+ PortCommonModeRestoreTime = (MmioRead32 (RootDeviceBase + RootL1SubstateExtCapOffset + 0x04) >> 8) & 0xFF;
+ PortTpowerOnScale = (MmioRead32 (RootDeviceBase + RootL1SubstateExtCapOffset + 0x04) >> 16) & 0x3;
+ PortTpowerOnValue = (MmioRead32 (RootDeviceBase + RootL1SubstateExtCapOffset + 0x04) >> 19) & 0x1F;
+ }
+ }
+ ///
+ /// Obtain initial ASPM settings from respective port capability registers.
+ /// Scan LTR override table for device match and calculate the lowest override
+ /// value to be programmed into B0:D28:F0~F7 + 400h
+ ///
+ if (EndPointBus != 0 && (SlotStatus & BIT6) != 0) {
+ Status = PcieEndPointPm (
+ RootDeviceBase,
+ RootPcieCapOffset,
+ EndPointBus,
+ NumOfDevAspmOverride,
+ DevAspmOverride,
+ &AspmVal,
+ Operation,
+ NumOfDevLtrOverride,
+ DevLtrOverride,
+ &LtrOvrVal,
+ RootL1SubstateExtCapOffset,
+ L1SubstatesSupported,
+ L1SubstatesConfig,
+ &PortCommonModeRestoreTime,
+ &PortTpowerOnValue,
+ &PortTpowerOnScale,
+ PchPwrOptPcie,
+ &AspmOverride,
+ &ClkreqPerPortSupported,
+ LtrSupported,
+ PolicyRevision
+ );
+ if (PchPwrOptPcie->LtrEnable == PCH_DEVICE_ENABLE) {
+ if (PolicyRevision >= DXE_PCH_PLATFORM_POLICY_PROTOCOL_REVISION_7) {
+ if (PchPwrOptPcie->SnoopLatencyOverrideMode == 1) {
+ LtrOvrVal &= 0xFFFF0000;
+ LtrOvrVal |= (UINT32) BIT15 |
+ (UINT32) (PchPwrOptPcie->SnoopLatencyOverrideMultiplier << 10) |
+ (UINT32) (PchPwrOptPcie->SnoopLatencyOverrideValue);
+ }
+
+ if (PchPwrOptPcie->NonSnoopLatencyOverrideMode == 1) {
+ LtrOvrVal &= 0x0000FFFF;
+ LtrOvrVal |= (UINT32) BIT31 |
+ (UINT32) (PchPwrOptPcie->NonSnoopLatencyOverrideMultiplier << 26) |
+ (UINT32) (PchPwrOptPcie->NonSnoopLatencyOverrideValue << 16);
+ }
+ }
+ if (LtrOvrVal != 0) {
+ ///
+ /// Program B0:D28:F0~F7 + 400h only if we find a device in the LTR override table
+ ///
+ MmioWrite32 (RootDeviceBase + R_PCH_PCIE_LTROVR, LtrOvrVal);
+ ///
+ /// Step 1.2
+ /// Program B0:D28:F0~F7 + 404h [1:0] = 11b for ports which has a PCIe device
+ /// device attached to it.
+ ///
+ Data32Or = BIT1 | BIT0;
+ if (PolicyRevision >= DXE_PCH_PLATFORM_POLICY_PROTOCOL_REVISION_7) {
+ if (PchPwrOptPcie->SnoopLatencyOverrideMode == 0) {
+ Data32Or &= (UINT32) ~BIT0;
+ }
+ if (PchPwrOptPcie->NonSnoopLatencyOverrideMode == 0) {
+ Data32Or &= (UINT32) ~BIT1;
+ }
+ if (PchPwrOptPcie->LtrConfigLock == PCH_DEVICE_ENABLE) {
+ ///
+ /// Set the lock bit
+ ///
+ Data32Or |= BIT2;
+ }
+ }
+ MmioWrite32 (RootDeviceBase + R_PCH_PCIE_LTROVR2, Data32Or);
+ }
+ }
+ }
+#ifdef ULT_FLAG
+ if (PchSeries == PchLp) {
+ ///
+ /// If both Root and endpoint's L1 Sub-States Extended Capability Offset + 0x04[4:0] are 11111b,
+ ///
+ if (*L1SubstatesSupported) {
+ ///
+ /// a. Read L1 Sub-States Extended Capability Offset + 0x04[15:8], and Set the highest value advertised
+ /// between PCIe rootport and device to L1 Sub-States Extended Capability Offset + 0x08[15:8] on both
+ /// Pcie root port and device.
+ ///
+ MmioAndThenOr32 (
+ RootDeviceBase + RootL1SubstateExtCapOffset + 0x08,
+ (UINT32) ~(0xFF00),
+ (UINT32) PortCommonModeRestoreTime << 8
+ );
+
+ ///
+ /// b. Read L1 Sub-States Extended Capability Offset + 0x04[23:19] and [17:16], and Set the highest value
+ /// advertised between PCIe root port and device to L1 Sub-States Extended Capability Offset + 0x0C [7:0] on
+ /// both Pcie root port and device.
+ MmioAndThenOr32 (
+ RootDeviceBase + RootL1SubstateExtCapOffset + 0x0C,
+ 0xFFFFFF04,
+ (UINT32) ((PortTpowerOnValue << 3) | PortTpowerOnScale)
+ );
+
+ ///
+ /// c. Set L1 Sub-States Extended Capability Offset + 0x08[31:29] to 010b for both Pcie root port and device
+ /// d. Set L1 Sub-States Extended Capability Offset + 0x08[25:16] to 0010100000b for both Pcie root port and device
+ ///
+ MmioAndThenOr32 (
+ RootDeviceBase + RootL1SubstateExtCapOffset + 0x08,
+ (UINT32) ~(0xE3FF0000),
+ (UINT32) (BIT30 | BIT23 | BIT21)
+ );
+
+ ///
+ /// e. If clkreq per port is suported, set D28:F0~F5:420h[0] to 1b prior to L1 enabling
+ ///
+ if (((AspmVal & V_PCH_PCIE_LCTL_APMC_L1) == V_PCH_PCIE_LCTL_APMC_L1) && ClkreqPerPortSupported) {
+ MmioOr32 (RootDeviceBase + R_PCH_PCIE_PCIEPMECTL, BIT0);
+ }
+
+ ///
+ /// f. Set L1 Sub-States Extended Capability Offset + 0x08[4:0] to 01111b for both Pcie root port and device
+ ///
+ Data32Or = (BIT3 | BIT2 | BIT1 | BIT0);
+ if (L1SubstatesConfig == PchPcieL1SubstatesL1_1) {
+ Data32Or &= (UINT32)~(BIT0);
+ }
+ if (L1SubstatesConfig == PchPcieL1SubstatesL1_2) {
+ Data32Or &= (UINT32)~(BIT1);
+ }
+ MmioAndThenOr32 (
+ RootDeviceBase + RootL1SubstateExtCapOffset + 0x08,
+ (UINT32) ~(BIT4 | BIT3 | BIT2 | BIT1 | BIT0),
+ Data32Or
+ );
+ }
+
+
+ if ((AspmVal & V_PCH_PCIE_LCTL_APMC_L1) == V_PCH_PCIE_LCTL_APMC_L1) {
+ ///
+ /// Program D28:F0~F5:E2h[5:4] to 11b prior to enabling ASPM L1,
+ /// if all enabled ports support ASPM L1
+ ///
+ if (FirstRPToSetPm && L1SupportedInAllEnabledPorts) {
+ Status = PchIobpExecution (
+ RootComplexBar,
+ 0xE00000E0,
+ PciConfigRead,
+ 0xE0 + GetPchPcieRpfn( RootComplexBar, PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_1),
+ &Data32,
+ &Response
+ );
+ ASSERT_EFI_ERROR (Status);
+ Data32 |= ((B_PCH_PCIE_RPPGEN_LMSDOCGE | B_PCH_PCIE_RPPGEN_SEOCGE) << 16);
+ Status = PchIobpExecution (
+ RootComplexBar,
+ 0xE00000E0,
+ PciConfigWrite,
+ 0xE0 + GetPchPcieRpfn( RootComplexBar, PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_1),
+ &Data32,
+ &Response
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
+
+ if (ClkreqPerPortSupported) {
+ ///
+ /// Program D28:F0~F5:420h[17] to 0b prior to enabling ASPM L1
+ ///
+ if (*L1SubstatesSupported) {
+ MmioAnd32 (RootDeviceBase + R_PCH_PCIE_PCIEPMECTL, (UINT32)~B_PCH_PCIE_PCIEPMECTL_L1LE);
+ }
+
+ ///
+ /// Program D28:F0~F5:420h[29] to 1b, when D28:F0:E1h[6] is set to 1b
+ ///
+ Data32Or = B_PCH_PCIE_PCIEPMECTL_DLSULDLSD;
+ MmioOr32 (
+ RootDeviceBase + R_PCH_PCIE_PCIEPMECTL,
+ Data32Or
+ );
+
+ ///
+ /// If dedicated CLKREQ# per-port is supported on all enabled ports, set D28:F0:E1h[6] to 1b prior to enabling ASPM L1
+ ///
+ if (FirstRPToSetPm && ClkreqSupportedInAllEnabledPorts) {
+ Status = PchIobpExecution (
+ RootComplexBar,
+ 0xE00000E0,
+ PciConfigRead,
+ 0xE0 + GetPchPcieRpfn( RootComplexBar, PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_1),
+ &Data32,
+ &Response
+ );
+ ASSERT_EFI_ERROR (Status);
+ Data32 |= (B_PCH_PCIE_RPDCGEN_POCGE << 8);
+ Status = PchIobpExecution (
+ RootComplexBar,
+ 0xE00000E0,
+ PciConfigWrite,
+ 0xE0 + GetPchPcieRpfn( RootComplexBar, PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_1),
+ &Data32,
+ &Response
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
+ }
+ }
+ }
+#endif // ULT_FLAG
+ ///
+ /// Set Root Port Aspm and enable LTR capability of the device
+ ///
+ MmioAndThenOr16 (RootDeviceBase + RootPcieCapOffset + 0x010, 0xFFFC, AspmVal);
+ ///
+ /// Based on the Role based Error Reporting Capability bit, for pre-1.1 devices,
+ /// program root port 0xD4[4] to 1 and 0xD4[3:2] to 10.
+ ///
+ if (AspmOverride) {
+ MmioAndThenOr8 (RootDeviceBase + R_PCH_PCIE_MPC2,
+ (UINT8)~(B_PCH_PCIE_MPC2_ASPMCOEN | B_PCH_PCIE_MPC2_ASPMCO),
+ (B_PCH_PCIE_MPC2_ASPMCOEN | V_PCH_PCIE_MPC2_ASPMCO_L1)
+ );
+ } else {
+ MmioAnd8 (RootDeviceBase + R_PCH_PCIE_MPC2, (UINT8)~(B_PCH_PCIE_MPC2_ASPMCOEN | B_PCH_PCIE_MPC2_ASPMCO));
+ }
+ ///
+ /// PCH BIOS Spec Rev 0.5.5, Section 8.14.1 Power Optimizer Configuration
+ /// Step 1
+ /// Enable support Latency Tolerance Reporting (LTR)
+ ///
+
+ if (EndPointBus != 0 && (SlotStatus & BIT6) != 0) {
+ ///
+ /// Set Endpoint Aspm and LTR capabilities
+ ///
+ Status = PcieEndPointPm (
+ RootDeviceBase,
+ RootPcieCapOffset,
+ EndPointBus,
+ NumOfDevAspmOverride,
+ DevAspmOverride,
+ &AspmVal,
+ SetAspm,
+ NumOfDevLtrOverride,
+ DevLtrOverride,
+ &LtrOvrVal,
+ RootL1SubstateExtCapOffset,
+ L1SubstatesSupported,
+ L1SubstatesConfig,
+ &PortCommonModeRestoreTime,
+ &PortTpowerOnValue,
+ &PortTpowerOnScale,
+ PchPwrOptPcie,
+ &AspmOverride,
+ &ClkreqPerPortSupported,
+ LtrSupported,
+ PolicyRevision
+ );
+ }
+
+ if (BusAssign == FALSE) {
+ ///
+ /// Clear Bus Numbers.
+ ///
+ MmioAnd32 (RootDeviceBase + 0x018, 0xFF0000FF);
+ }
+
+ if (!EFI_ERROR (Status)) {
+ ///
+ /// If L0s and L1 can be enabled on a root port and the endpoints attached to the root port,
+ /// then set the root port register D28:Fx:Reg E8h[1]
+ ///
+ if (AspmVal == V_PCH_PCIE_LCTL_APMC_L0S_L1) {
+ if (PchSeries == PchLp) {
+ ///
+ /// Set the root port register D28:Fx:REG E8h[3:2] to 10b before setting D28:Fx:Reg E8h[0] or E8h[1]
+ ///
+ Data8Or = BIT3;
+ Data8And = (UINT8) ~(V_PCH_PCIE_PECR1_FIELD_3);
+ MmioAndThenOr8 (
+ RootDeviceBase + R_PCH_PCIE_PECR1,
+ Data8And,
+ Data8Or
+ );
+ }
+ MmioOr8 (RootDeviceBase + R_PCH_PCIE_PECR1, B_PCH_PCIE_PECR1_FIELD_2);
+ }
+ }
+
+ return Status;
+}
+
+/**
+ Initializes the root port and its down stream devices
+
+ @param[in] RootPortBus Pci Bus Number of the root port
+ @param[in] RootPortDevice Pci Device Number of the root port
+ @param[in] RootPortFunc Pci Function Number of the root port
+ @param[in] TempBusNumberMin Minimal temp bus number that can be assigned to the root port (as secondary
+ bus number) and its down stream switches
+ @param[in] TempBusNumberMax Maximal temp bus number that can be assigned to the root port (as subordinate
+ bus number) and its down stream switches
+ @param[in, out] MaxPayload The Max Payolad Size of the root port
+ @param[out] DeviceClassDword Get the downstream device code dword for unstream RootPort reference
+
+ @retval EFI_SUCCESS Successfully completed
+ @retval EFI_NOT_FOUND Can not find device.
+**/
+EFI_STATUS
+PchPcieInitDownstreamDevices (
+ IN UINT8 RootPortBus,
+ IN UINT8 RootPortDevice,
+ IN UINT8 RootPortFunc,
+ IN UINT8 TempBusNumberMin,
+ IN UINT8 TempBusNumberMax,
+ IN OUT UINT16 *MaxPayload,
+ OUT UINT32 *DeviceClassDword
+ )
+{
+ EFI_STATUS Status;
+ UINT32 Index;
+ UINTN RPBase;
+ UINTN EndPointBase;
+
+ RPBase = MmPciAddress (0, RootPortBus, RootPortDevice, RootPortFunc, 0);
+ ///
+ /// Temporarily Hardcode the Root Port Bridge Number to TempBusNumberMin
+ ///
+ MmioAndThenOr32 (
+ RPBase + PCI_BRIDGE_PRIMARY_BUS_REGISTER_OFFSET,
+ 0xFF000000,
+ RootPortBus | ((UINT32) (TempBusNumberMin << 8)) | ((UINT32) (TempBusNumberMax << 16))
+ );
+ ///
+ /// This Endpoint check should immediately pass. Howerver, a 1.0s delay
+ /// has been added to match the timing requirements of the PCI Express Base
+ /// Specification, Revision 1.0A, Section 6.6 ("...software must allow 1.0s
+ /// after a reset of a device, before it may determine that a device which
+ /// fails to return a Successful Completion status for a valid Configuration
+ /// Request is a broken device").
+ ///
+ EndPointBase = MmPciAddress (0, TempBusNumberMin, 0, 0, 0);
+ ///
+ /// A config write is required in order for the device to re-capture the Bus number,
+ /// according to PCI Express Base Specification, 2.2.6.2 ("Note that the Bus Number
+ /// and Device Number may be changed at run time, and so it is necessary to re-capture
+ /// this information with each and every Configuration Write Request")
+ ///
+ MmioWrite8 (EndPointBase + 0x0, 0);
+ for (Index = 0; Index < 100000; Index++) {
+ if (MmioRead16 (EndPointBase + PCI_VENDOR_ID_OFFSET) != 0xFFFF) {
+ break;
+ }
+
+ PchPmTimerStall (10);
+ }
+
+ if (Index >= 100000) {
+ ///
+ /// Clear Bus Numbers.
+ ///
+ MmioAnd32 (RPBase + PCI_BRIDGE_PRIMARY_BUS_REGISTER_OFFSET, 0xFF000000);
+ return EFI_NOT_FOUND;
+ }
+ ///
+ /// Get the device class code dword for upstream RootPort reference
+ ///
+ if (DeviceClassDword != NULL) {
+ *DeviceClassDword = MmioRead32 (EndPointBase + R_PCH_PCIE_RID);
+ }
+ ///
+ /// Get the Max Payload Size on all the end point functions
+ ///
+ PcieMaxPayloadSize (TempBusNumberMin, PCI_MAX_DEVICE, MaxPayload, FALSE);
+ ///
+ /// Check if this device is a bridge
+ ///
+ if (MmioRead8 (EndPointBase + R_PCH_PCIE_BCC) == PCI_CLASS_BRIDGE) {
+ ///
+ /// Initialize downstream devices
+ ///
+ if (TempBusNumberMax > TempBusNumberMin) {
+ Status = PchPcieInitDownstreamDevices (
+ TempBusNumberMin,
+ 0,
+ 0,
+ TempBusNumberMin + 1,
+ TempBusNumberMax,
+ MaxPayload,
+ NULL
+ );
+ }
+ }
+ ///
+ /// Complete Common Port and Endpoint Configuration.
+ ///
+ ///
+ /// Map TC0-VC0
+ ///
+ PcieMapTcxVc0 (RootPortBus, RootPortDevice, (UINT8) RootPortFunc, TempBusNumberMin, PCI_MAX_DEVICE, 0x0);
+
+ ///
+ /// Set Common Clock for inserted cards
+ ///
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 8.3.1 ASPM on DMI and the PCI Express* Root Ports
+ /// Before determining whether ASPM can be enabled or not,
+ /// the System BIOS must perform the following steps:
+ ///
+ /// For PCH H
+ /// 1. Update the Link Capabilities of the DMI to indicate L1 is
+ /// supported on the interface by setting the LCAP Register
+ /// RCBA + 21A4h [11:10] = 11b
+ /// (Done in PchPm.c)
+ ///
+ /// 2. Enable L0s on DMI for Desktop platforms by setting the APMC field,
+ /// RCBA + offset 21A8h[1:0] to 01b.
+ /// Enable L0s/L1 on DMI by setting RCBA + offset 21A8h[1:0] to 11b.
+ /// (Done in PchPm.c)
+ ///
+ /// 3. For each root port, read the Slot Clock Configuration bit, D28:F0~F7:Reg 52h[12],
+ /// of the root port and the endpoint device connected to the port (i.e., D0:F0 on the
+ /// secondary bus behind the root port). If both components have this bit set, then the
+ /// System BIOS should set the Common Clock Configuration (CCC) bit, D28:F0~F7:Reg 50h[6],
+ /// for both components at both sides of the link to indicate that components at both ends
+ /// of the link use a common clock source.
+ ///
+ /// 4. If the CCC bit was changed by the System BIOS in step 3, System BIOS should initiate
+ /// a link training by setting the Retrain Link (RL) bit, D28:F0~F7:Reg 50h[5], and then poll the Link
+ /// Training (LT) bit, D28:F0~F7:Reg 52h[11], until it is clear.
+ /// Note that System BIOS should save and restore CCC bit on S3.
+ ///
+ PcieSetCommonClock (RootPortBus, RootPortDevice, (UINT8) RootPortFunc, TempBusNumberMin, PCI_MAX_DEVICE);
+
+ ///
+ /// Enable the PCIe CLKREQ#
+ ///
+ PcieSetClkreq (TempBusNumberMin, PCI_MAX_DEVICE, (UINT8) RootPortFunc);
+
+ ///
+ /// Set the Max Payload Size on all the end point functions
+ ///
+ PcieMaxPayloadSize (TempBusNumberMin, PCI_MAX_DEVICE, MaxPayload, TRUE);
+
+ ///
+ /// Disable the forwarding of EOI messages unless it discovers an IOAPIC behind this root port
+ ///
+ PcieSetEoiFwdDisable (RootPortBus, RootPortDevice, RootPortFunc, TempBusNumberMin, PCI_MAX_DEVICE);
+ ///
+ /// Clear Bus Numbers
+ ///
+ MmioAnd32 (RPBase + PCI_BRIDGE_PRIMARY_BUS_REGISTER_OFFSET, 0xFF000000);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Initializes the root port and its down stream devices
+
+ @param[in] RootPortBus Pci Bus Number of the root port
+ @param[in] RootPortDevice Pci Device Number of the root port
+ @param[in] RootPortFunc Pci Function Number of the root port
+ @param[in] TempBusNumberMin Minimal temp bus number that can be assigned to the root port (as secondary
+ bus number) and its down stream switches
+ @param[in] TempBusNumberMax Maximal temp bus number that can be assigned to the root port (as subordinate
+ bus number) and its down stream switches
+ @param[out] DeviceClassDword Get the downstream device code dword for unstream RootPort reference
+
+ @retval EFI_SUCCESS Successfully completed
+ @retval EFI_NOT_FOUND Can not find device.
+**/
+EFI_STATUS
+PchPcieInitRootPortDownstreamDevices (
+ IN UINT8 RootPortBus,
+ IN UINT8 RootPortDevice,
+ IN UINT8 RootPortFunc,
+ IN UINT8 TempBusNumberMin,
+ IN UINT8 TempBusNumberMax,
+ OUT UINT32 *DeviceClassDword
+ )
+{
+ UINT16 SlotStatus;
+ UINTN RPBase;
+ UINT16 RootPortMaxPayload;
+ UINT8 PcieCapOffset;
+ EFI_STATUS Status;
+
+ RPBase = MmPciAddress (0, RootPortBus, RootPortDevice, RootPortFunc, 0);
+ ///
+ /// Check for a Presence Detect Change.
+ ///
+ SlotStatus = MmioRead16 (RPBase + R_PCH_PCIE_SLSTS);
+
+ ///
+ /// Check whether the slot has a device connected
+ ///
+ if ((SlotStatus & BIT6) == 0) {
+ return EFI_NOT_FOUND;
+ }
+ ///
+ /// Get the pointer to the Endpoint PCI Express Capability Structure.
+ ///
+ PcieCapOffset = PcieFindCapId (
+ RootPortBus,
+ RootPortDevice,
+ RootPortFunc,
+ EFI_PCI_CAPABILITY_ID_PCIEXP
+ );
+
+ ///
+ /// Get the root port Max Payload Size support
+ ///
+ RootPortMaxPayload = MmioRead16 (RPBase + PcieCapOffset + 0x04) & (BIT2 | BIT1 | BIT0);
+
+ ///
+ /// Initialize downstream devices
+ ///
+ Status = PchPcieInitDownstreamDevices (
+ RootPortBus,
+ RootPortDevice,
+ RootPortFunc,
+ TempBusNumberMin,
+ TempBusNumberMax,
+ &RootPortMaxPayload,
+ DeviceClassDword
+ );
+
+ ///
+ /// Set the PCIE root Port Max Payload Size
+ ///
+ MmioAndThenOr16 (RPBase + PcieCapOffset + 0x08, (UINT16)~(BIT7 | BIT6 | BIT5), RootPortMaxPayload << 5);
+
+ return Status;
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/Library/PchPciExpressHelpersLib/PchPciExpressHelpersLibrary.h b/ReferenceCode/Chipset/LynxPoint/Library/PchPciExpressHelpersLib/PchPciExpressHelpersLibrary.h
new file mode 100644
index 0000000..7f32fe0
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Library/PchPciExpressHelpersLib/PchPciExpressHelpersLibrary.h
@@ -0,0 +1,42 @@
+/** @file
+ Header file for PCH Pci Express helps library implementation.
+
+@copyright
+ Copyright (c) 2008 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _PCH_PCI_EXPRESS_HELPERS_LIBRARY_H_
+#define _PCH_PCI_EXPRESS_HELPERS_LIBRARY_H_
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueBase.h"
+#include "PchPlatformPolicy.h"
+#include "PchAccess.h"
+#include "PchPlatformLib.h"
+#include "PchPciExpressHelperslib.h"
+#include "pci23.h"
+#include "pci22.h"
+#endif
+
+#define LTR_VALUE_MASK (BIT0 + BIT1 + BIT2 + BIT3 + BIT4 + BIT5 + BIT6 + BIT7 + BIT8 + BIT9)
+#define LTR_SCALE_MASK (BIT10 + BIT11 + BIT12)
+
+//
+// LTR related macros
+//
+#define LTR_LATENCY_VALUE(x) ((x) & LTR_VALUE_MASK)
+#define LTR_SCALE_VALUE(x) (((x) & LTR_SCALE_MASK) >> 10)
+#define LTR_LATENCY_NS(x) (LTR_LATENCY_VALUE(x) * (1 << (5 * LTR_SCALE_VALUE(x))))
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Library/PchPlatformLib/IobpAccess.c b/ReferenceCode/Chipset/LynxPoint/Library/PchPlatformLib/IobpAccess.c
new file mode 100644
index 0000000..d21a181
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Library/PchPlatformLib/IobpAccess.c
@@ -0,0 +1,295 @@
+/** @file
+ Program IOBP register.
+
+@copyright
+ Copyright (c) 2009 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "PchPlatformLibrary.h"
+
+/**
+ Configures PCH IOBP
+
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+ @param[in] Address Address of the IOBP register block
+ @param[in] AndMask Mask to AND with the register
+ @param[in] OrMask Mask to OR with the register
+
+ @retval EFI_SUCCESS Successfully completed.
+ @retval EFI_DEVICE_ERROR Transaction fail
+**/
+EFI_STATUS
+EFIAPI
+ProgramIobp (
+ IN UINT32 RootComplexBar,
+ IN UINT32 Address,
+ IN UINT32 AndMask,
+ IN UINT32 OrMask
+ )
+{
+ UINT32 Data32;
+ UINT8 ResponseStatus;
+ EFI_STATUS Status;
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 7.1.4 IOSF SBI Programming
+ /// Step 1 to Step 8
+ ///
+ Status = ReadIobp (RootComplexBar, Address, &Data32);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ ///
+ /// Step 9
+ /// Update the SBI data accordingly
+ ///
+ Data32 &= AndMask;
+ Data32 |= OrMask;
+ ///
+ /// Step 10
+ /// Set RCBA + 2338h[15:8] = 00000111b
+ ///
+ MmioAndThenOr16 (
+ (RootComplexBar + R_PCH_RCRB_IOBPS),
+ (UINT16) (~B_PCH_RCRB_IOBPS_IOBPIA),
+ (UINT16) V_PCH_RCRB_IOBPS_IOBPIA_W
+ );
+ ///
+ /// Step 11
+ /// Write RCBA + 2334h[31:0] with updated SBI data
+ ///
+ MmioWrite32 ((RootComplexBar + R_PCH_RCRB_IOBPD), Data32);
+
+ ///
+ /// Step 12
+ /// Set RCBA + 233Ah[15:0] = F000h
+ ///
+ MmioWrite16 (
+ (RootComplexBar + 0x233A),
+ 0xF000
+ );
+
+ ///
+ /// Step 13
+ /// Set RCBA + 2338h[0] = 1b
+ ///
+ MmioOr16 (
+ (RootComplexBar + R_PCH_RCRB_IOBPS),
+ (UINT16) BIT0
+ );
+
+ ///
+ /// Step 14
+ /// Poll RCBA + Offset 2338h[0] = 0b
+ ///
+ while (MmioRead8 (RootComplexBar + R_PCH_RCRB_IOBPS) & B_PCH_RCRB_IOBPS_BUSY);
+
+ ///
+ /// Step 15
+ /// Check if RCBA + 2338h[2:1] = 00b for successful transaction
+ ///
+ ResponseStatus = MmioRead8 (RootComplexBar + R_PCH_RCRB_IOBPS) & B_PCH_RCRB_IOBPS;
+ if (ResponseStatus == V_PCH_RCRB_IOBPS_SUCCESS) {
+ return EFI_SUCCESS;
+ } else {
+ return EFI_DEVICE_ERROR;
+ }
+}
+
+/**
+ Read data from PCH IOBP register block
+
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+ @param[in] Address Address of the IOBP register block
+ @param[out] Data Data contain in the IOBP register block
+
+ @retval EFI_SUCCESS Successfully completed.
+ @retval EFI_DEVICE_ERROR Transaction fail
+**/
+EFI_STATUS
+EFIAPI
+ReadIobp (
+ IN UINT32 RootComplexBar,
+ IN UINT32 Address,
+ OUT UINT32 *Data
+ )
+{
+ UINT8 ResponseStatus;
+
+ ///
+ /// Step 1 Poll RCBA + 2338[0] = 0b
+ ///
+ while (MmioRead8 (RootComplexBar + R_PCH_RCRB_IOBPS) & B_PCH_RCRB_IOBPS_BUSY);
+
+ ///
+ /// Step 2
+ /// Write RCBA + Offset 2330h[31:0] with IOBP register address
+ ///
+ MmioWrite32 ((RootComplexBar + R_PCH_RCRB_IOBPIRI), Address);
+ ///
+ /// Step 3
+ /// Set RCBA + 2338h[15:8] = 00000110b
+ ///
+ MmioAndThenOr16 (
+ (RootComplexBar + R_PCH_RCRB_IOBPS),
+ (UINT16) (~B_PCH_RCRB_IOBPS_IOBPIA),
+ (UINT16) V_PCH_RCRB_IOBPS_IOBPIA_R
+ );
+ ///
+ /// Step 4
+ /// Set RCBA + 233Ah[15:0] = F000h
+ ///
+ MmioWrite16 (
+ (RootComplexBar + 0x233A),
+ 0xF000
+ );
+ ///
+ /// Step 5
+ /// Set RCBA + 2338h[0] = 1b
+ ///
+ MmioOr16 (
+ (RootComplexBar + R_PCH_RCRB_IOBPS),
+ (UINT16) BIT0
+ );
+
+ ///
+ /// Step 6
+ /// Poll RCBA + Offset 2338h[0] = 0b, Polling for Busy bit
+ ///
+ while (MmioRead8 (RootComplexBar + R_PCH_RCRB_IOBPS) & B_PCH_RCRB_IOBPS_BUSY);
+
+ ///
+ /// Step 7
+ /// Check if RCBA + 2338h[2:1] = 00b for successful transaction
+ ///
+ ResponseStatus = MmioRead8 (RootComplexBar + R_PCH_RCRB_IOBPS) & B_PCH_RCRB_IOBPS;
+ if (ResponseStatus == V_PCH_RCRB_IOBPS_SUCCESS) {
+ ///
+ /// Step 8
+ /// Read RCBA + 2334h[31:0] for IOBP data
+ ///
+ *Data = MmioRead32 (RootComplexBar + R_PCH_RCRB_IOBPD);
+ return EFI_SUCCESS;
+ } else {
+ return EFI_DEVICE_ERROR;
+ }
+}
+
+/**
+ Configures PCH IOBP
+
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+ @param[in] Address Address of the IOBP register block
+ @param[in] Opcode Iobp Opcode
+ @param[in] RouteId Route Id
+ @param[in, out] Data32 Read/Write data
+ @param[out] Response Response
+
+ @retval EFI_SUCCESS Successfully completed.
+ @retval EFI_DEVICE_ERROR Transaction fail
+**/
+EFI_STATUS
+EFIAPI
+PchIobpExecution (
+ IN UINT32 RootComplexBar,
+ IN UINT32 Address,
+ IN PCH_IOBP_OPCODE Opcode,
+ IN UINT8 RouteId,
+ IN OUT UINT32 *Data32,
+ OUT UINT8 *Response
+ )
+{
+ ///
+ /// Step 1 Poll RCBA + 2338[0] = 0b
+ ///
+ while (MmioRead8 (RootComplexBar + R_PCH_RCRB_IOBPS) & B_PCH_RCRB_IOBPS_BUSY);
+ ///
+ /// Step 2
+ /// Write RCBA + Offset 2330h[31:0] with IOBP register address
+ ///
+ MmioWrite32 ((RootComplexBar + R_PCH_RCRB_IOBPIRI), Address);
+ ///
+ /// Step 3
+ /// Set RCBA + 2338h[15:8] to the opcode passed in
+ ///
+ MmioAndThenOr16 (
+ (RootComplexBar + R_PCH_RCRB_IOBPS),
+ (UINT16) (~B_PCH_RCRB_IOBPS_IOBPIA),
+ (UINT16) (Opcode << 8)
+ );
+ ///
+ /// Step 4
+ /// Set RCBA + 233Ah[15:8] = F0h
+ /// Set RCBA + 233Ah[7:0] = Route Id passed in
+ ///
+ MmioWrite16 (
+ (RootComplexBar + 0x233A),
+ (0xF000 | RouteId)
+ );
+ switch (Opcode) {
+ case MemoryMapWrite:
+ case IoMapWrite:
+ case PciConfigWrite:
+ case PrivateControlWrite:
+ ///
+ /// Step 5
+ /// Write RCBA + 2334h[31:0] with updated SBI data
+ ///
+ MmioWrite32 ((RootComplexBar + R_PCH_RCRB_IOBPD), *Data32);
+ break;
+ default:
+ break;
+ }
+ ///
+ /// Step 6
+ /// Set RCBA + 2338h[0] = 1b
+ ///
+ MmioOr16 (
+ (RootComplexBar + R_PCH_RCRB_IOBPS),
+ (UINT16) BIT0
+ );
+
+ ///
+ /// Step 7
+ /// Poll RCBA + Offset 2338h[0] = 0b, Polling for Busy bit
+ ///
+ while (MmioRead8 (RootComplexBar + R_PCH_RCRB_IOBPS) & B_PCH_RCRB_IOBPS_BUSY);
+
+ ///
+ /// Step 8
+ /// Check if RCBA + 2338h[2:1] = 00b for successful transaction
+ ///
+ *Response = MmioRead8 (RootComplexBar + R_PCH_RCRB_IOBPS) & B_PCH_RCRB_IOBPS;
+ if (*Response == V_PCH_RCRB_IOBPS_SUCCESS) {
+ switch (Opcode) {
+ case MemoryMapRead:
+ case IoMapRead:
+ case PciConfigRead:
+ case PrivateControlRead:
+ ///
+ /// Step 9
+ /// Read RCBA + 2334h[31:0] for IOBP data
+ ///
+ *Data32 = MmioRead32 (RootComplexBar + R_PCH_RCRB_IOBPD);
+ break;
+ default:
+ break;
+ }
+
+ return EFI_SUCCESS;
+ }
+ return EFI_DEVICE_ERROR;
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/Library/PchPlatformLib/PchPlatformLib.cif b/ReferenceCode/Chipset/LynxPoint/Library/PchPlatformLib/PchPlatformLib.cif
new file mode 100644
index 0000000..d146e3b
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Library/PchPlatformLib/PchPlatformLib.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "PchPlatformLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\Library\PchPlatformLib"
+ RefName = "PchPlatformLib"
+[files]
+"PchPlatformLib.mak"
+"PchPlatformLib.sdl"
+"PchPlatformLibrary.h"
+"PchPlatformLibrary.c"
+"PchPlatformLib.inf"
+"IobpAccess.c"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/Library/PchPlatformLib/PchPlatformLib.inf b/ReferenceCode/Chipset/LynxPoint/Library/PchPlatformLib/PchPlatformLib.inf
new file mode 100644
index 0000000..2aa9a25
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Library/PchPlatformLib/PchPlatformLib.inf
@@ -0,0 +1,67 @@
+## @file
+# Component description file for PEI/DXE PCH Platform Lib
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+
+[defines]
+BASE_NAME = PchPlatformLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ PchPlatformLibrary.h
+ PchPlatformLibrary.c
+ IobpAccess.c
+
+[sources.ia32]
+
+[sources.x64]
+
+[sources.ipf]
+
+[includes.common]
+ $(EDK_SOURCE)/Foundation/Efi
+ .
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/SampleCode
+
+[libraries.common]
+ EdkIIGlueBasePciLibPciExpress
+ EdkIIGlueBaseLib
+
+[nmake.common]
diff --git a/ReferenceCode/Chipset/LynxPoint/Library/PchPlatformLib/PchPlatformLib.mak b/ReferenceCode/Chipset/LynxPoint/Library/PchPlatformLib/PchPlatformLib.mak
new file mode 100644
index 0000000..d6ca967
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Library/PchPlatformLib/PchPlatformLib.mak
@@ -0,0 +1,112 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchLib/PchPlatformLib/PchPlatformLib.mak 3 10/16/12 2:52a Scottyang $
+#
+# $Revision: 3 $
+#
+# $Date: 10/16/12 2:52a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchLib/PchPlatformLib/PchPlatformLib.mak $
+#
+# 3 10/16/12 2:52a Scottyang
+# [TAG] EIP103924
+# [Category] Improvement
+# [Description] Update RC 0.7.1
+# [Files] ReferenceCode\Chipset\LynxPoint\*.*, SBDxe.c, SB.sd,
+# SbSetupData.c, GetSetupDate.c
+#
+# 2 7/02/12 9:17a Victortu
+#
+# 1 2/08/12 8:48a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+
+# MAK file for the ModulePart:PchPlatformLib
+EDK : PchPlatformLib
+
+PchPlatformLib : PchPlatformSmmLib PchPlatformDxeLib PchPlatformPeiLib
+
+$(PchPlatformSmmLib_LIB) : PchPlatformSmmLib
+$(PchPlatformDxeLib_LIB) : PchPlatformDxeLib
+$(PchPlatformPeiLib_LIB) : PchPlatformPeiLib
+
+PchPlatformSmmLib : $(BUILD_DIR)\PchPlatformLib.mak PchPlatformLibSmmBin
+
+PchPlatformDxeLib : $(BUILD_DIR)\PchPlatformLib.mak PchPlatformLibDxeBin
+
+PchPlatformPeiLib : $(BUILD_DIR)\PchPlatformLib.mak PchPlatformLibPeiBin
+
+$(BUILD_DIR)\PchPlatformLib.mak : $(PchPlatformLib_DIR)\$(@B).cif $(PchPlatformLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(PchPlatformLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+PchPlatformLib_INCLUDES =\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+ $(EDK_INCLUDES)\
+
+PchPlatformLib_LIBS=\
+ $(EdkIIGlueBaseLib_LIB)\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+
+PchPlatformLibSmmBin : $(PchPlatformLib_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\PchPlatformLib.mak all\
+ "MY_INCLUDES=$(PchPlatformLib_INCLUDES)" \
+ TYPE=LIBRARY \
+ LIBRARIES=\
+ LIBRARY_NAME=$(PchPlatformSmmLib_LIB)
+
+PchPlatformLibDxeBin : $(PchPlatformLib_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\PchPlatformLib.mak all\
+ "MY_INCLUDES=$(PchPlatformLib_INCLUDES)" \
+ "CFLAGS=$(CFLAGS) $(PchPlatformLib_DEFINES)"\
+ TYPE=LIBRARY \
+ LIBRARIES=\
+ LIBRARY_NAME=$(PchPlatformDxeLib_LIB)
+
+PchPlatformLibPeiBin : $(PchPlatformLib_LIBS)
+!IF "$(x64_BUILD)"=="1"
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS) BUILD_DIR=$(BUILD_DIR)\IA32\
+!ELSE
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+!ENDIF
+ /f $(BUILD_DIR)\PchPlatformLib.mak all\
+ "MY_INCLUDES=$(PchPlatformLib_INCLUDES)"\
+ "CFLAGS=$(CFLAGS) $(PchPlatformLib_DEFINES)"\
+ TYPE=PEI_LIBRARY \
+ LIBRARIES=\
+ LIBRARY_NAME=$(PchPlatformPeiLib_LIB)
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Library/PchPlatformLib/PchPlatformLib.sdl b/ReferenceCode/Chipset/LynxPoint/Library/PchPlatformLib/PchPlatformLib.sdl
new file mode 100644
index 0000000..4704a8c
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Library/PchPlatformLib/PchPlatformLib.sdl
@@ -0,0 +1,93 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchLib/PchPlatformLib/PchPlatformLib.sdl 1 2/08/12 8:48a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 8:48a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchLib/PchPlatformLib/PchPlatformLib.sdl $
+#
+# 1 2/08/12 8:48a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+TOKEN
+ Name = "PchPlatformLib_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable PchPlatformLib support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "PchPlatformLib_DIR"
+End
+
+MODULE
+ Help = "Includes PchPlatformLib.mak to Project"
+ File = "PchPlatformLib.mak"
+End
+
+ELINK
+ Name = "PchPlatformSmmLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PchPlatformSmmLib.lib"
+ Parent = "PchPlatformSmmLib_LIB"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "PchPlatformDxeLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PchPlatformDxeLib.lib"
+ Parent = "PchPlatformDxeLib_LIB"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "PchPlatformPeiLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PchPlatformPeiLib.lib"
+ Parent = "PchPlatformPeiLib_LIB"
+ InvokeOrder = AfterParent
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Library/PchPlatformLib/PchPlatformLibrary.c b/ReferenceCode/Chipset/LynxPoint/Library/PchPlatformLib/PchPlatformLibrary.c
new file mode 100644
index 0000000..2d9c6ac
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Library/PchPlatformLib/PchPlatformLibrary.c
@@ -0,0 +1,831 @@
+/** @file
+ PCH Platform Lib implementation.
+@copyright
+ Copyright (c) 2004 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "PchPlatformLibrary.h"
+
+/**
+ Delay for at least the request number of microseconds.
+ This function would be called by runtime driver, please do not use any MMIO marco here.
+
+ @param[in] Microseconds Number of microseconds to delay.
+
+ @retval NONE
+**/
+VOID
+EFIAPI
+PchPmTimerStall (
+ IN UINTN Microseconds
+ )
+{
+ UINTN Ticks;
+ UINTN Counts;
+ UINTN CurrentTick;
+ UINTN OriginalTick;
+ UINTN RemainingTick;
+ UINT16 AcpiBaseAddr;
+
+ if (Microseconds == 0) {
+ return;
+ }
+ ///
+ /// Please use PciRead here, it will link to MmioRead
+ /// if the caller is a Runtime driver, please use PchDxeRuntimePciLibPciExpress library, refer
+ /// PciExpressRead() on Library\DxeRuntimePciLibPciExpress\DxeRuntimePciLibPciExpress.c for the details.
+ /// For the rest please use EdkIIGlueBasePciLibPciExpress library
+ ///
+ AcpiBaseAddr = PciRead16 (
+ PCI_LIB_ADDRESS (DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_ACPI_BASE)
+ ) & B_PCH_LPC_ACPI_BASE_BAR;
+
+ OriginalTick = IoRead32 ((UINTN) (AcpiBaseAddr + R_PCH_ACPI_PM1_TMR)) & B_PCH_ACPI_PM1_TMR_VAL;
+ CurrentTick = OriginalTick;
+
+ ///
+ /// The timer frequency is 3.579545 MHz, so 1 ms corresponds 3.58 clocks
+ ///
+ Ticks = Microseconds * 358 / 100 + OriginalTick + 1;
+
+ ///
+ /// The loops needed by timer overflow
+ ///
+ Counts = Ticks / V_PCH_ACPI_PM1_TMR_MAX_VAL;
+
+ ///
+ /// Remaining clocks within one loop
+ ///
+ RemainingTick = Ticks % V_PCH_ACPI_PM1_TMR_MAX_VAL;
+
+ ///
+ /// not intend to use TMROF_STS bit of register PM1_STS, because this adds extra
+ /// one I/O operation, and maybe generate SMI
+ ///
+ while ((Counts != 0) || (RemainingTick > CurrentTick)) {
+ CurrentTick = IoRead32 ((UINTN) (AcpiBaseAddr + R_PCH_ACPI_PM1_TMR)) & B_PCH_ACPI_PM1_TMR_VAL;
+ ///
+ /// Check if timer overflow
+ ///
+ if ((CurrentTick < OriginalTick)) {
+ if (Counts != 0) {
+ Counts--;
+ } else {
+ ///
+ /// If timer overflow and Counts equ to 0, that means we already stalled more than
+ /// RemainingTick, break the loop here
+ ///
+ break;
+ }
+ }
+
+ OriginalTick = CurrentTick;
+ }
+}
+
+/**
+ Check whether SPI is in descriptor mode
+
+ @param[in] PchRootComplexBar The PCH Root Complex Bar
+
+ @retval TRUE SPI is in descriptor mode
+ @retval FALSE SPI is not in descriptor mode
+**/
+BOOLEAN
+EFIAPI
+PchIsSpiDescriptorMode (
+ IN UINTN PchRootComplexBar
+ )
+{
+ if ((MmioRead16 (PchRootComplexBar + R_PCH_SPI_HSFS) & B_PCH_SPI_HSFS_FDV) == B_PCH_SPI_HSFS_FDV) {
+ MmioAndThenOr32 (
+ PchRootComplexBar + R_PCH_SPI_FDOC,
+ (UINT32) (~(B_PCH_SPI_FDOC_FDSS_MASK | B_PCH_SPI_FDOC_FDSI_MASK)),
+ (UINT32) (V_PCH_SPI_FDOC_FDSS_FSDM | R_PCH_SPI_FDBAR_FLVALSIG)
+ );
+ if ((MmioRead32 (PchRootComplexBar + R_PCH_SPI_FDOD)) == V_PCH_SPI_FDBAR_FLVALSIG) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+ } else {
+ return FALSE;
+ }
+}
+
+/**
+ Return Pch stepping type
+
+ @param[in] None
+
+ @retval PCH_STEPPING Pch stepping type
+**/
+PCH_STEPPING
+EFIAPI
+PchStepping (
+ VOID
+ )
+{
+ UINT8 RevId;
+ UINT16 LpcDeviceId;
+
+ RevId = MmioRead8 (
+ MmPciAddress (0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_RID)
+ );
+
+ LpcDeviceId = MmioRead16 (
+ MmPciAddress (0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_DEVICE_ID)
+ );
+
+ if (IS_PCH_LPTH_LPC_DEVICE_ID (LpcDeviceId)) {
+ switch (RevId) {
+ case V_PCH_LPT_LPC_RID_2:
+ return LptHB0;
+ break;
+
+ case V_PCH_LPT_LPC_RID_3:
+ return LptHC0;
+ break;
+
+ case V_PCH_LPT_LPC_RID_4:
+ return LptHC1;
+ break;
+
+ case V_PCH_LPT_LPC_RID_5:
+ return LptHC2;
+ break;
+
+ default:
+ return PchSteppingMax;
+ break;
+ }
+ }
+
+ if (IS_PCH_LPTLP_LPC_DEVICE_ID (LpcDeviceId)) {
+ switch (RevId) {
+ case V_PCH_LPT_LPC_RID_2:
+ return LptLpB0;
+ break;
+
+ case V_PCH_LPT_LPC_RID_3:
+ return LptLpB1;
+ break;
+
+ case V_PCH_LPT_LPC_RID_4:
+ return LptLpB2;
+ break;
+
+ default:
+ return PchSteppingMax;
+ break;
+ }
+ }
+
+ return PchSteppingMax;
+}
+
+/**
+ Determine if PCH is supported
+
+ @param[in] None
+
+ @retval TRUE PCH is supported
+ @retval FALSE PCH is not supported
+**/
+BOOLEAN
+IsPchSupported (
+ VOID
+ )
+{
+ UINT16 LpcDeviceId;
+
+ LpcDeviceId = MmioRead16 (
+ MmPciAddress (0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_DEVICE_ID)
+ );
+
+ ///
+ /// Verify that this is a supported chipset
+ ///
+ if (MmioRead16 (
+ MmPciAddress (0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_VENDOR_ID)
+ ) != V_PCH_LPC_VENDOR_ID ||
+ !IS_PCH_LPT_LPC_DEVICE_ID (LpcDeviceId)) {
+ DEBUG ((EFI_D_ERROR, "PCH code doesn't support the LpcDeviceId: 0x%04x!\n", LpcDeviceId));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/**
+ This function can be called to enable/disable Alternate Access Mode
+
+ @param[in] PchRootComplexBar The PCH Root Complex Bar
+ @param[in] AmeCtrl If TRUE, enable Alternate Access Mode.
+ If FALSE, disable Alternate Access Mode.
+
+ @retval NONE
+**/
+VOID
+EFIAPI
+PchAlternateAccessMode (
+ IN UINTN PchRootComplexBar,
+ IN BOOLEAN AmeCtrl
+ )
+{
+ UINT32 Data32Or;
+ UINT32 Data32And;
+
+ Data32Or = 0;
+ Data32And = 0xFFFFFFFF;
+
+ if (AmeCtrl == TRUE) {
+ ///
+ /// Enable Alternate Access Mode
+ /// Note: The RTC Index field (including the NMI mask at bit7) is write-only
+ /// for normal operation and can only be read in Alt Access Mode.
+ ///
+ Data32Or = (UINT32) (B_PCH_RCRB_GCS_AME);
+ }
+
+ if (AmeCtrl == FALSE) {
+ ///
+ /// Disable Alternate Access Mode
+ ///
+ Data32And = (UINT32) ~(B_PCH_RCRB_GCS_AME);
+ }
+
+ ///
+ /// Program Alternate Access Mode Enable bit
+ ///
+ MmioAndThenOr32 (
+ PchRootComplexBar + R_PCH_RCRB_GCS,
+ Data32And,
+ Data32Or
+ );
+
+ ///
+ /// Reads back for posted write to take effect
+ ///
+ MmioRead32(PchRootComplexBar + R_PCH_RCRB_GCS);
+}
+
+/**
+ Check whether Gbe Region is valid in SPI Flash
+
+ @param[in] PchRootComplexBar The PCH Root Complex Bar
+
+ @retval TRUE Gbe Region is valid
+ @retval FALSE Gbe Region is invalid
+**/
+BOOLEAN
+EFIAPI
+PchIsGbeRegionValid (
+ IN UINTN PchRootComplexBar
+ )
+{
+ ///
+ /// If the GbE region is not used,
+ /// Region Limit of Flash Region 3 (GbE) Register (SPIBAR + 60h[30:16]) must be programmed to 0000h
+ /// Region Base of Flash Region 3 (GbE) Register (SPIBAR + 60h[14:0] ) must be programmed to 7FFFh
+ ///
+ if (PchIsSpiDescriptorMode (PchRootComplexBar) == TRUE) {
+ if (MmioRead32 (PchRootComplexBar + R_PCH_SPI_FREG3_GBE) == 0x00007FFF) {
+ return FALSE;
+ } else {
+ return TRUE;
+ }
+ } else {
+ return FALSE;
+ }
+}
+
+/**
+ Check if integrated Gbe controller present
+
+ @param[in] None
+
+ @retval TRUE Integrated Gbe present
+ @retval FALSE Integrated Gbe not present
+**/
+BOOLEAN
+EFIAPI
+PchIsIntegratedGbePresent (
+ IN VOID
+ )
+{
+ UINT32 Softstrap4;
+ UINT32 Softstrap15;
+ BOOLEAN IntegratedGbe;
+
+ ///
+ /// Check if Gbe region is present by reading PCH straps 15 (bit 6) and 4 (bits 1:0)
+ ///
+ MmioAnd32 (
+ PCH_RCRB_BASE + R_PCH_SPI_FDOC,
+ (UINT32) (~(B_PCH_SPI_FDOC_FDSS_MASK | B_PCH_SPI_FDOC_FDSI_MASK))
+ );
+
+ MmioOr32 (
+ PCH_RCRB_BASE + R_PCH_SPI_FDOC,
+ (UINT32) (V_PCH_SPI_FDOC_FDSS_PCHS | R_PCH_SPI_STRP4)
+ );
+
+ Softstrap4 = MmioRead32 (PCH_RCRB_BASE + R_PCH_SPI_FDOD);
+
+ MmioAnd32 (
+ PCH_RCRB_BASE + R_PCH_SPI_FDOC,
+ (UINT32) (~(B_PCH_SPI_FDOC_FDSS_MASK | B_PCH_SPI_FDOC_FDSI_MASK))
+ );
+
+ MmioOr32 (
+ PCH_RCRB_BASE + R_PCH_SPI_FDOC,
+ (UINT32) (V_PCH_SPI_FDOC_FDSS_PCHS | R_PCH_SPI_STRP15)
+ );
+
+ Softstrap15 = MmioRead32 (PCH_RCRB_BASE + R_PCH_SPI_FDOD);
+
+ ///
+ /// Both values have to be non-zero if integrated phy present
+ ///
+ IntegratedGbe = !!(Softstrap4 & B_PCH_SPI_STRP4_PHYCON) && !!(Softstrap15 & B_PCH_SPI_STRP15_IWL_EN);
+
+ return IntegratedGbe;
+}
+
+/**
+ Return Pch Series
+
+ @param[in] None
+
+ @retval PCH_SERIES Pch Series
+**/
+PCH_SERIES
+EFIAPI
+GetPchSeries (
+ VOID
+ )
+{
+ UINT16 LpcDeviceId;
+ UINT32 PchSeries;
+
+ ///
+ /// Please use PciRead here, it will link to MmioRead
+ /// if the caller is a Runtime driver, please use PchDxeRuntimePciLibPciExpress library, refer
+ /// PciExpressRead() on Library\DxeRuntimePciLibPciExpress\DxeRuntimePciLibPciExpress.c for the details.
+ /// For the rest please use EdkIIGlueBasePciLibPciExpress library
+ ///
+ LpcDeviceId = PciRead16 (
+ PCI_LIB_ADDRESS (DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_DEVICE_ID)
+ );
+
+ if (IS_PCH_LPTH_LPC_DEVICE_ID (LpcDeviceId)) {
+ PchSeries = PchH;
+ } else if (IS_PCH_LPTLP_LPC_DEVICE_ID (LpcDeviceId)) {
+ PchSeries = PchLp;
+ } else {
+ PchSeries = PchUnknownSeries;
+ DEBUG ((EFI_D_ERROR, "Unsupported PCH SKU, LpcDeviceId: 0x%04x!\n", LpcDeviceId));
+ ASSERT (FALSE);
+ }
+
+ return PchSeries;
+}
+
+/**
+ Get Pch Maximum Pcie Root Port Number
+
+ @param[in] None
+
+ @retval Pch Maximum Pcie Root Port Number
+**/
+UINT8
+EFIAPI
+GetPchMaxPciePortNum (
+ VOID
+ )
+{
+ PCH_SERIES PchSeries;
+
+ PchSeries = GetPchSeries();
+ switch (PchSeries) {
+ case PchLp:
+ return LPTLP_PCIE_MAX_ROOT_PORTS;
+
+ case PchH:
+ return LPTH_PCIE_MAX_ROOT_PORTS;
+
+ default:
+ return 0;
+ }
+}
+
+/**
+ Get Pch Maximum Sata Port Number
+
+ @param[in] None
+
+ @retval Pch Maximum Sata Port Number
+**/
+UINT8
+EFIAPI
+GetPchMaxSataPortNum (
+ VOID
+ )
+{
+ PCH_SERIES PchSeries;
+
+ PchSeries = GetPchSeries();
+ switch (PchSeries) {
+ case PchLp:
+ return LPTLP_AHCI_MAX_PORTS;
+
+ case PchH:
+ return LPTH_AHCI_MAX_PORTS;
+
+ default:
+ return 0;
+ }
+}
+
+/**
+ Get Pch Maximum Sata Controller Number
+
+ @param[in] None
+
+ @retval Pch Maximum Sata Controller Number
+**/
+UINT8
+EFIAPI
+GetPchMaxSataControllerNum (
+ VOID
+ )
+{
+ PCH_SERIES PchSeries;
+
+ PchSeries = GetPchSeries();
+ switch (PchSeries) {
+ case PchLp:
+ return LPTLP_SATA_MAX_CONTROLLERS;
+
+ case PchH:
+ return LPTH_SATA_MAX_CONTROLLERS;
+
+ default:
+ return 0;
+ }
+}
+
+/**
+ Get Pch Maximum Usb Port Number of EHCI Controller
+
+ @param[in] None
+
+ @retval Pch Maximum Usb Port Number of EHCI Controller
+**/
+UINT8
+EFIAPI
+GetPchEhciMaxUsbPortNum (
+ VOID
+ )
+{
+ PCH_SERIES PchSeries;
+
+ PchSeries = GetPchSeries();
+ switch (PchSeries) {
+ case PchLp:
+ return LPTLP_EHCI_MAX_PORTS;
+
+ case PchH:
+ return LPTH_EHCI_MAX_PORTS;
+
+ default:
+ return 0;
+ }
+}
+
+/**
+ Get Pch Maximum EHCI Controller Number
+
+ @param[in] None
+
+ @retval Pch Maximum EHCI Controller Number
+**/
+UINT8
+EFIAPI
+GetPchEhciMaxControllerNum (
+ VOID
+ )
+{
+ PCH_SERIES PchSeries;
+
+ PchSeries = GetPchSeries();
+ switch (PchSeries) {
+ case PchLp:
+ return LPTLP_EHCI_MAX_CONTROLLERS;
+
+ case PchH:
+ return LPTH_EHCI_MAX_CONTROLLERS;
+
+ default:
+ return 0;
+ }
+}
+
+/**
+ Get Pch Usb Maximum Physical Port Number
+
+ @param[in] None
+
+ @retval Pch Usb Maximum Physical Port Number
+**/
+UINT8
+EFIAPI
+GetPchUsbMaxPhysicalPortNum (
+ VOID
+ )
+{
+ PCH_SERIES PchSeries;
+
+ PchSeries = GetPchSeries();
+ switch (PchSeries) {
+ case PchLp:
+ return LPTLP_USB_MAX_PHYSICAL_PORTS;
+
+ case PchH:
+ return LPTH_USB_MAX_PHYSICAL_PORTS;
+
+ default:
+ return 0;
+ }
+}
+
+/**
+ Get Pch Maximum Usb2 Port Number of XHCI Controller
+
+ @param[in] None
+
+ @retval Pch Maximum Usb2 Port Number of XHCI Controller
+**/
+UINT8
+EFIAPI
+GetPchXhciMaxUsb2PortNum (
+ VOID
+ )
+{
+ PCH_SERIES PchSeries;
+
+ PchSeries = GetPchSeries();
+ switch (PchSeries) {
+ case PchLp:
+ return LPTLP_XHCI_MAX_USB2_PORTS;
+
+ case PchH:
+ return LPTH_XHCI_MAX_USB2_PORTS;
+
+ default:
+ return 0;
+ }
+}
+
+/**
+ Get Pch Maximum Usb3 Port Number of XHCI Controller
+
+ @param[in] None
+
+ @retval Pch Maximum Usb3 Port Number of XHCI Controller
+**/
+UINT8
+EFIAPI
+GetPchXhciMaxUsb3PortNum (
+ VOID
+ )
+{
+ PCH_SERIES PchSeries;
+
+ PchSeries = GetPchSeries();
+ switch (PchSeries) {
+ case PchLp:
+ return LPTLP_XHCI_MAX_USB3_PORTS;
+
+ case PchH:
+ return LPTH_XHCI_MAX_USB3_PORTS;
+
+ default:
+ return 0;
+ }
+}
+
+/**
+ Query PCH to determine the Pm Status
+
+ @param[in] PmStatus - The Pch Pm Status to be probed
+
+ @retval Return TRUE if Status querried is Valid or FALSE if otherwise
+**/
+BOOLEAN
+GetPchPmStatus (
+ PCH_PM_STATUS PmStatus
+ )
+{
+ UINT16 PmCon2;
+ UINT16 PmCon3;
+
+ PmCon2 = MmioRead16 (
+ MmPciAddress (0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_GEN_PMCON_2
+ )
+ );
+ PmCon3 = MmioRead16 (
+ MmPciAddress (0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_GEN_PMCON_3
+ )
+ );
+
+ switch(PmStatus){
+ case WarmBoot:
+ if (PmCon2 & B_PCH_LPC_GEN_PMCON_MEM_SR) {
+ return TRUE;
+ }
+ break;
+
+ case PwrFlr:
+ if (PmCon3 & B_PCH_LPC_GEN_PMCON_PWR_FLR) {
+ return TRUE;
+ }
+ break;
+
+ case PwrFlrSys:
+ if (PmCon2 & B_PCH_LPC_GEN_PMCON_SYSPWR_FLR) {
+ return TRUE;
+ }
+ break;
+
+ case PwrFlrPch:
+ if (PmCon2 & B_PCH_LPC_GEN_PMCON_PWROK_FLR) {
+ return TRUE;
+ }
+ break;
+
+ case ColdBoot:
+ ///
+ /// Check following conditions for cold boot.
+ /// (1)GEN_PMCON_2 (0:31:0 offset 0A2) bit[5] = 0
+ /// (2)GEN_PMCON_2 (0:31:0 offset 0A2) bit[1] = 1
+ /// (3)GEN_PMCON_3 (0:31:0 offset 0A4) bit[1] = 1
+ ///
+ if ((PmCon3 & B_PCH_LPC_GEN_PMCON_PWR_FLR) &&
+ (PmCon2 & B_PCH_LPC_GEN_PMCON_SYSPWR_FLR) &&
+ (!(PmCon2 & B_PCH_LPC_GEN_PMCON_MEM_SR))) {
+ return TRUE;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return FALSE;
+}
+
+/**
+ Get Pch Pcie Root Port Function Number by Root Port Number
+
+ @param[in] UINT8 Root Port Number (start from 0)
+
+ @retval Pch Pcie Root Port Function Number
+**/
+UINT8
+EFIAPI
+GetPchPcieRpfn (
+ IN UINTN PchRootComplexBar,
+ IN UINT8 RpNumber
+ )
+{
+ return ((MmioRead32(PchRootComplexBar + R_PCH_RCRB_RPFN) >> (RpNumber * S_PCH_RCRB_PRFN_RP_FIELD)) & B_PCH_RCRB_RPFN_RP1FN);
+}
+
+/**
+ Get Pch Pcie Root Port Number by Root Port Function Number
+
+ @param[in] UINT8 Root Port Function Number
+
+ @retval Pch Pcie Root Port Number
+ @retval 0xFF No Root Port Number found
+**/
+UINT8
+EFIAPI
+GetPchPcieRpNumber (
+ IN UINTN PchRootComplexBar,
+ IN UINT8 Rpfn
+ )
+{
+ UINT8 PortIndex;
+ for (PortIndex = 0; PortIndex < GetPchMaxPciePortNum(); PortIndex++) {
+ if (((MmioRead32(PchRootComplexBar + R_PCH_RCRB_RPFN) >> (PortIndex * S_PCH_RCRB_PRFN_RP_FIELD)) & B_PCH_RCRB_RPFN_RP1FN) == Rpfn) {
+ return PortIndex;
+ }
+ }
+
+ //Assert if function number not found for a root port
+ ASSERT (FALSE);
+ return 0xff;
+}
+
+
+/**
+ Returns GbE over PCIe port number.
+
+ @return Root port number (0-based)
+ @retval 0xff
+**/
+UINTN
+PchGetGbePortNumber (
+ VOID
+ )
+{
+ UINT32 Softstrap9;
+ UINT32 GbePortSel;
+
+ ///
+ /// Check if Intel PHY Over PCI Express Enable by reading PCH straps 9 (bit 11)
+ ///
+ MmioAnd32 (
+ PCH_RCRB_BASE + R_PCH_SPI_FDOC,
+ (UINT32) (~(B_PCH_SPI_FDOC_FDSS_MASK | B_PCH_SPI_FDOC_FDSI_MASK))
+ );
+
+ MmioOr32 (
+ PCH_RCRB_BASE + R_PCH_SPI_FDOC,
+ (UINT32) (V_PCH_SPI_FDOC_FDSS_PCHS | R_PCH_SPI_STRP9)
+ );
+
+ Softstrap9 = MmioRead32 (PCH_RCRB_BASE + R_PCH_SPI_FDOD);
+
+ ///
+ /// If Intel PHY Over PCI Express Enable bit is set, return GbE port number
+ ///
+ if (Softstrap9 & B_PCH_SPI_STRP9_GBE_PCIE_EN) {
+ GbePortSel = (Softstrap9 & B_PCH_SPI_STRP9_GBE_PCIE_PSC) >> N_PCH_SPI_STRP9_GBE_PCIE_PSC;
+ DEBUG ((EFI_D_INFO, "GbePortSel=%d\n", GbePortSel));
+ if (GetPchSeries () == PchLp) {
+ switch (GbePortSel) {
+ case 0: return 2; // Root Port 3
+ case 1: return 3; // Root Port 4
+ case 2: // Root Port 5, lane 0
+ case 3: // Root Port 5, lane 1
+ case 4: // Root Port 5, lane 2
+ case 5: // Root Port 5, lane 3
+ return 4;
+ default:
+ ASSERT (FALSE);
+ }
+ } else {
+ return GbePortSel;
+ }
+ }
+
+ return 0xff;
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/Library/PchPlatformLib/PchPlatformLibrary.h b/ReferenceCode/Chipset/LynxPoint/Library/PchPlatformLib/PchPlatformLibrary.h
new file mode 100644
index 0000000..0eec474
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Library/PchPlatformLib/PchPlatformLibrary.h
@@ -0,0 +1,29 @@
+/** @file
+ Header file for PCH Platform Lib implementation.
+
+@copyright
+ Copyright (c) 2008 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _PCH_PLATFORM_LIBRARY_IMPLEMENTATION_H_
+#define _PCH_PLATFORM_LIBRARY_IMPLEMENTATION_H_
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueBase.h"
+#include "Library/EdkIIGlueMemoryAllocationLib.h"
+#include "PchAccess.h"
+#include "PchPlatformLib.h"
+#endif
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/Common/PchSmbusComLib.cif b/ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/Common/PchSmbusComLib.cif
new file mode 100644
index 0000000..c6371c9
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/Common/PchSmbusComLib.cif
@@ -0,0 +1,8 @@
+<component>
+ name = "PchSmbusComLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\Library\PchSmbusLib\Common\"
+ RefName = "PchSmbusComLib"
+[files]
+"PchSmbusLib.c"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/Common/PchSmbusLib.c b/ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/Common/PchSmbusLib.c
new file mode 100644
index 0000000..dcb46e2
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/Common/PchSmbusLib.c
@@ -0,0 +1,54 @@
+/** @file
+ This file contains routines that support PCH SMBUS FUNCTION
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "PchSmbusLib.h"
+
+/**
+ This function provides a standard way to execute Smbus sequential
+ I2C Read. This function allows the PCH to perform block reads to
+ certain I2C devices, such as serial E2PROMs. Typically these data
+ bytes correspond to an offset (address) within the serial memory
+ chips.
+
+ @param[in] SmBusAddress Address that encodes the SMBUS Slave Address,
+ SMBUS Command, SMBUS Data Length, and PEC.
+ @param[out] Buffer Pointer to the buffer to store the bytes read
+ from the SMBUS
+ @param[out] Status eturn status for the executed command.
+
+ @retval UINTN The number of bytes read
+**/
+UINTN
+EFIAPI
+SmBusSeqI2CRead (
+ IN UINTN SmBusAddress,
+ OUT VOID *Buffer,
+ OUT RETURN_STATUS * Status OPTIONAL
+ )
+{
+ UINTN Length;
+
+ ASSERT (Buffer != NULL);
+ ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) >= 1);
+ ASSERT (SMBUS_LIB_RESEARVED (SmBusAddress) == 0);
+
+ Length = SMBUS_LIB_LENGTH (SmBusAddress);
+ return InternalSmBusExec (EfiSmbusReadByte, SmBusAddress, Length, Buffer, Status);
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/Dxe/PchSmbusDxeLib.cif b/ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/Dxe/PchSmbusDxeLib.cif
new file mode 100644
index 0000000..b1b49b0
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/Dxe/PchSmbusDxeLib.cif
@@ -0,0 +1,9 @@
+<component>
+ name = "PchSmbusDxeLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\Library\PchSmbusLib\Dxe\"
+ RefName = "PchSmbusDxeLib"
+[files]
+"PchSmbusLib.h"
+"PchSmbusLibDxe.inf"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/Dxe/PchSmbusLib.h b/ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/Dxe/PchSmbusLib.h
new file mode 100644
index 0000000..64c639d
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/Dxe/PchSmbusLib.h
@@ -0,0 +1,25 @@
+/** @file
+ Header file for PCH Smbus DXE Lib implementation.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _PCH_SMBUS_DXE_LIBRARY_IMPLEMENTATION_H_
+#define _PCH_SMBUS_DXE_LIBRARY_IMPLEMENTATION_H_
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "DxeSmbusLibInternal.h"
+#endif
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/Dxe/PchSmbusLibDxe.inf b/ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/Dxe/PchSmbusLibDxe.inf
new file mode 100644
index 0000000..57c7e50
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/Dxe/PchSmbusLibDxe.inf
@@ -0,0 +1,63 @@
+## @file
+# Component description file for DXE PCH Smbus Lib
+#
+#@copyright
+# Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = PchSmbusLibDxe
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ ../Common/PchSmbusLib.c
+
+[sources.ia32]
+
+[sources.x64]
+
+[sources.ipf]
+
+[includes.common]
+ $(EDK_SOURCE)/Foundation/Efi
+ .
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Library/DxeSmbusLib
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/SampleCode
+
+[libraries.common]
+
+
+[nmake.common]
diff --git a/ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/PchSmbusLib.cif b/ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/PchSmbusLib.cif
new file mode 100644
index 0000000..3263fa9
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/PchSmbusLib.cif
@@ -0,0 +1,14 @@
+<component>
+ name = "PchSmbusLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\Library\PchSmbusLib\"
+ RefName = "PchSmbusLib"
+[files]
+"PchSmbusLib.sdl"
+"PchSmbusLib.mak"
+"Common\PchSmbusComLib.cif"
+"Common\PchSmbusLib.c"
+[parts]
+"PchSmbusDxeLib"
+"PchSmbusPeiLib"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/PchSmbusLib.mak b/ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/PchSmbusLib.mak
new file mode 100644
index 0000000..35a4d8e
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/PchSmbusLib.mak
@@ -0,0 +1,74 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchLib/PchSmbusLib/PchSmbusLib.mak 1 2/08/12 8:49a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 8:49a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchLib/PchSmbusLib/PchSmbusLib.mak $
+#
+# 1 2/08/12 8:49a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+all : PchSmbusLib
+
+$(PchSmbusLib_LIB) : PchSmbusLib
+
+PchSmbusLib : $(BUILD_DIR)\PchSmbusLib.mak PchSmbusLibBin
+
+$(BUILD_DIR)\PchSmbusLib.mak : $(PchSmbusLib_DIR)\$(@B).cif $(PchSmbusLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(PchSmbusLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+PchSmbusPeiLib_INCLUDES=\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+ /I$(EdkIIGluePeiSmbusLib_DIR)\
+ /I$(PchSmbusLib_DIR)\Pei\
+
+PchSmbusDxeLib_INCLUDES=\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+ /I$(EdkIIGlueDxeSmbusLib_DIR)\
+ /I$(PchSmbusLib_DIR)\Dxe\
+
+PchSmbusLibBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\PchSmbusLib.mak all\
+ "MY_INCLUDES=$(PchSmbusDxeLib_INCLUDES)" \
+ TYPE=LIBRARY
+!IF "$(x64_BUILD)"=="1"
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS) BUILD_DIR=$(BUILD_DIR)\IA32\
+ /f $(BUILD_DIR)\PchSmbusLib.mak all\
+ "MY_INCLUDES=$(PchSmbusPeiLib_INCLUDES)" \
+ TYPE=PEI_LIBRARY
+!ENDIF
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/PchSmbusLib.sdl b/ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/PchSmbusLib.sdl
new file mode 100644
index 0000000..4f41e9a
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/PchSmbusLib.sdl
@@ -0,0 +1,59 @@
+TOKEN
+ Name = "PchSmbusLib_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable PchSmbusLib support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "PchSmbusLib_DIR"
+End
+
+MODULE
+ Help = "Includes PchSmbusLib.mak to Project"
+ File = "PchSmbusLib.mak"
+End
+
+ELINK
+ Name = "PchSmbusDxeLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "PchSmbusPeiLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+TOKEN
+ Name = "PchSmbusLib_LIB"
+ Value = "$$(LIB_BUILD_DIR)\PchSmbusLib.lib"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+ELINK
+ Name = "$(PchSmbusLib_LIB)"
+ Parent = "PchSmbusDxeLib_LIB"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(EdkIIGlueDxeSmbusLib_LIB)"
+ Parent = "PchSmbusDxeLib_LIB"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(PchSmbusLib_LIB)"
+ Parent = "PchSmbusPeiLib_LIB"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(EdkIIGluePeiSmbusLib_LIB)"
+ Parent = "PchSmbusPeiLib_LIB"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/Pei/PchSmbusLib.h b/ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/Pei/PchSmbusLib.h
new file mode 100644
index 0000000..b169af6
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/Pei/PchSmbusLib.h
@@ -0,0 +1,25 @@
+/** @file
+ Header file for PCH Smbus PEI Lib implementation.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _PCH_SMBUS_PEI_LIBRARY_IMPLEMENTATION_H_
+#define _PCH_SMBUS_PEI_LIBRARY_IMPLEMENTATION_H_
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "PeiSmbusLibInternal.h"
+#endif
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/Pei/PchSmbusLibPei.inf b/ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/Pei/PchSmbusLibPei.inf
new file mode 100644
index 0000000..e533165
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/Pei/PchSmbusLibPei.inf
@@ -0,0 +1,64 @@
+## @file
+# Component description file for PEI PCH Smbus Lib
+#
+#@copyright
+# Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = PchSmbusLibPei
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ ../Common/PchSmbusLib.c
+
+[sources.ia32]
+
+[sources.x64]
+
+[sources.ipf]
+
+[includes.common]
+ $(EDK_SOURCE)/Foundation/Efi
+ .
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Library/PeiSmbusLib
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/SampleCode
+
+[libraries.common]
+
+
+[nmake.common]
diff --git a/ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/Pei/PchSmbusPeiLib.cif b/ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/Pei/PchSmbusPeiLib.cif
new file mode 100644
index 0000000..22aba6f
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Library/PchSmbusLib/Pei/PchSmbusPeiLib.cif
@@ -0,0 +1,9 @@
+<component>
+ name = "PchSmbusPeiLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\Library\PchSmbusLib\Pei\"
+ RefName = "PchSmbusPeiLib"
+[files]
+"PchSmbusLib.h"
+"PchSmbusLibPei.inf"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/Library/RcFviDxeLib/CreateFviLibrary.c b/ReferenceCode/Chipset/LynxPoint/Library/RcFviDxeLib/CreateFviLibrary.c
new file mode 100644
index 0000000..e97d65b
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Library/RcFviDxeLib/CreateFviLibrary.c
@@ -0,0 +1,225 @@
+/** @file
+ Firmware Version Info Interface Lib implementation.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "RcFviLib.h"
+
+EFI_DATA_HUB_PROTOCOL *mDataHub = NULL;
+
+/**
+ Initialize callback context for Firmware Version Info (FVI) Interface Spec v0.7
+ implementation.
+
+ @param[in] String The pointer to the string for calculating length
+
+ @retval None
+**/
+UINT32
+GetStringLen (
+ IN UINT8 *String
+ )
+{
+ UINT8 Length;
+
+ for (Length = 0; *String != 0; String++, Length++) {
+ if (Length >= SMBIOS_STRING_MAX_LENGTH) {
+ break;
+ }
+ }
+
+ return (UINT32) (Length + 1);
+}
+
+/**
+ Initialize callback context for Firmware Version Info (FVI) Interface Spec v0.7
+ implementation.
+
+ @param[in] Type Value is defined in SMBIOS Type 14 - Group Associaction structure - item type.
+ @param[in] Count Number of elements included by this SMBIOS table
+ @param[in] FviContext Context of FVI elements for data hub log
+
+ @retval None
+**/
+VOID
+InitFviDataHubCbContext (
+ IN UINT8 Type,
+ IN UINT8 Count,
+ IN FVI_DATA_HUB_CALLBACK_CONTEXT *FviContext
+ )
+{
+ ///
+ /// Locate the Data hub protocol
+ ///
+ if (mDataHub == NULL) {
+ gBS->LocateProtocol (&gEfiDataHubProtocolGuid, NULL, (VOID **)&mDataHub);
+ }
+
+ if (FviContext != NULL) {
+ FviContext->FviHeader.FviHdr.Header.Type = Type;
+ FviContext->FviHeader.FviHdr.Count = Count;
+ FviContext->FviHeader.FviHdr.Header.Length = sizeof (FVI_HEADER) + FVI_ELEMENTS_SIZE_NOSTRING * Count;
+ } else {
+ ASSERT (FALSE);
+ }
+
+ return ;
+}
+
+/**
+ Create the Reference code version info as per Firmware Version Info (FVI) Interface Spec v0.7
+ to Data Hub.
+
+ @param[in] FviContext Pointer to the notification functions context, which is context of FVI
+ elements for data hub log
+
+ @retval None
+**/
+VOID
+CreateRcFviDatahub (
+ IN FVI_DATA_HUB_CALLBACK_CONTEXT *FviContext
+ )
+{
+ VOID *Registration;
+
+ if (mDataHub == NULL) {
+ EfiCreateProtocolNotifyEvent (
+ &gEfiDataHubProtocolGuid,
+ EFI_TPL_CALLBACK,
+ DataHubCallback,
+ (VOID *) FviContext,
+ &Registration
+ );
+ } else {
+ DataHubCallback ((EFI_EVENT) NULL, (VOID *) FviContext);
+ }
+}
+
+/**
+ Publish the Reference code version info as per Firmware Version Info (FVI) Interface Spec v0.7
+ using MiscSubClass Data Hub.
+
+ @param[in] Event Event whose notification function is being invoked.
+ @param[in] Context Pointer to the notification functions context, which is implementation dependent.
+
+ @retval None
+**/
+VOID
+EFIAPI
+DataHubCallback (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ EFI_STATUS Status;
+ FVI_DATA_HUB_CALLBACK_CONTEXT *FviContext;
+ UINT8 Index;
+ UINT8 StrIndex;
+ UINT8 *Record;
+ UINT8 *LastRecord;
+ UINT8 *String;
+ UINT8 Count;
+ UINT32 Length;
+ FVI_ELEMENT_AND_FUNCTION *NewElement;
+
+ Status = EFI_SUCCESS;
+ if (mDataHub == NULL) {
+ Status = gBS->LocateProtocol (&gEfiDataHubProtocolGuid, NULL, (VOID **)&mDataHub);
+ }
+
+ if ((mDataHub != NULL) && (Context != NULL)) {
+
+ if (Event != NULL) {
+ gBS->CloseEvent (Event);
+ }
+
+ FviContext = (FVI_DATA_HUB_CALLBACK_CONTEXT *) Context;
+ Count = FviContext->FviHeader.FviHdr.Count;
+
+ ///
+ /// Allocate a buffer to record data sorted later
+ ///
+ Length = sizeof (MISC_SUBCLASS_FVI_HEADER) + (sizeof (FVI_ELEMENTS) * Count);
+
+ Status = EFI_OUT_OF_RESOURCES;
+ Record = (UINT8 *) AllocateZeroPool (Length);
+ if (Record != NULL) {
+ LastRecord = Record;
+
+ ///
+ /// Copy the headers including Data Hub and SMBIOS FviSmbios OEM type
+ ///
+ CopyMem (LastRecord, &(FviContext->FviHeader), sizeof (MISC_SUBCLASS_FVI_HEADER));
+ LastRecord += sizeof (MISC_SUBCLASS_FVI_HEADER);
+ String = LastRecord + FVI_ELEMENTS_SIZE_NOSTRING * Count;
+
+ NewElement = FviContext->Elements;
+
+ ///
+ /// Copy elements including strings
+ ///
+ for (Index = 0, StrIndex = 1; Index < Count; Index++) {
+ if (NewElement->Function != NULL) {
+ NewElement->Function (&(NewElement->Element));
+ }
+
+ ///
+ /// If string is implemented for ComponentName or VersionString, and then string
+ /// index of ComponentName or VersionString can't be zero. The string index of
+ /// ComponentName and VersionString will be updated and calculated while analyse
+ /// all elements here.String index must be non-zero if implemented.
+ ///
+ if (NewElement->Element.ComponentName != 0) {
+ NewElement->Element.ComponentName = StrIndex;
+ Length = GetStringLen (NewElement->Element.NameString);
+ CopyMem (String, &(NewElement->Element.NameString), Length);
+ String += Length;
+ StrIndex++;
+ }
+
+ if (NewElement->Element.VersionString != 0) {
+ NewElement->Element.VersionString = StrIndex;
+ Length = GetStringLen (NewElement->Element.VerString);
+ CopyMem (String, &(NewElement->Element.VerString), Length);
+ String += Length;
+ StrIndex++;
+ }
+
+ CopyMem (LastRecord, &(NewElement->Element), FVI_ELEMENTS_SIZE_NOSTRING);
+ LastRecord += FVI_ELEMENTS_SIZE_NOSTRING;
+
+ NewElement++;
+ }
+
+ Length = (UINT32) (String - Record) + 1;
+ Status = mDataHub->LogData (
+ mDataHub,
+ &gMiscSubClassName,
+ &gMiscProducerGuid,
+ EFI_DATA_RECORD_CLASS_DATA,
+ (VOID *) Record,
+ Length
+ );
+ }
+
+ ASSERT (!EFI_ERROR (Status));
+ if (Record != NULL) {
+ FreePool (Record);
+ }
+ }
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/Library/RcFviDxeLib/RcFviDxeLib.cif b/ReferenceCode/Chipset/LynxPoint/Library/RcFviDxeLib/RcFviDxeLib.cif
new file mode 100644
index 0000000..57f9263
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Library/RcFviDxeLib/RcFviDxeLib.cif
@@ -0,0 +1,12 @@
+<component>
+ name = "RcFviDxeLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\Library\RcFviDxeLib"
+ RefName = "RcFviDxeLib"
+[files]
+"RcFviDxeLib.sdl"
+"RcFviDxeLib.mak"
+"CreateFviLibrary.c"
+"RcFviLib.h"
+"RcFviDxeLib.inf"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/Library/RcFviDxeLib/RcFviDxeLib.inf b/ReferenceCode/Chipset/LynxPoint/Library/RcFviDxeLib/RcFviDxeLib.inf
new file mode 100644
index 0000000..ad9f04c
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Library/RcFviDxeLib/RcFviDxeLib.inf
@@ -0,0 +1,67 @@
+## @file
+# Component description file for the PchRcFviDxeLib
+#
+#@copyright
+# Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = RcFviDxeLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ CreateFviLibrary.c
+
+[sources.ia32]
+
+
+[sources.x64]
+
+
+[sources.ipf]
+
+
+[sources.ebc]
+
+
+[includes.common]
+ .
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Cpu/Pentium/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[libraries.common]
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueDxeServicesTableLib
+ EdkIIGlueDxeMemoryAllocationLib
+ EdkFrameworkProtocolLib
+[libraries.ia32]
+
+
+[libraries.x64]
+
+
+[nmake.common] \ No newline at end of file
diff --git a/ReferenceCode/Chipset/LynxPoint/Library/RcFviDxeLib/RcFviDxeLib.mak b/ReferenceCode/Chipset/LynxPoint/Library/RcFviDxeLib/RcFviDxeLib.mak
new file mode 100644
index 0000000..4e8a698
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Library/RcFviDxeLib/RcFviDxeLib.mak
@@ -0,0 +1,69 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchLib/RcFviDxeLib/RcFviDxeLib.mak 1 2/08/12 8:50a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 8:50a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchLib/RcFviDxeLib/RcFviDxeLib.mak $
+#
+# 1 2/08/12 8:50a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#
+#*************************************************************************
+all : RcFviDxeLib
+
+$(RcFviDxeLib_LIB) : RcFviDxeLib
+
+RcFviDxeLib : $(BUILD_DIR)\RcFviDxeLib.mak RcFviDxeLibBin
+
+$(BUILD_DIR)\RcFviDxeLib.mak : $(RcFviDxeLib_DIR)\$(@B).cif $(RcFviDxeLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(RcFviDxeLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+RcFviDxeLib_INCLUDES=\
+ $(EDK_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+
+RcFviDxeLib_LIB_LINKS =\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueDxeServicesTableLib_LIB)\
+ $(EdkIIGlueDxeMemoryAllocationLib_LIB)\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+
+RcFviDxeLibBin:
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\RcFviDxeLib.mak all \
+ "MY_INCLUDES=$(RcFviDxeLib_INCLUDES)" \
+ TYPE=LIBRARY \
+ LIBRARY_NAME=$(RcFviDxeLib_LIB)
+
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Library/RcFviDxeLib/RcFviDxeLib.sdl b/ReferenceCode/Chipset/LynxPoint/Library/RcFviDxeLib/RcFviDxeLib.sdl
new file mode 100644
index 0000000..15c1fd4
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Library/RcFviDxeLib/RcFviDxeLib.sdl
@@ -0,0 +1,73 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchLib/RcFviDxeLib/RcFviDxeLib.sdl 1 2/08/12 8:50a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 8:50a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchLib/RcFviDxeLib/RcFviDxeLib.sdl $
+#
+# 1 2/08/12 8:50a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#
+#*************************************************************************
+TOKEN
+ Name = "RcFviDxeLib_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable RcFviDxeLib support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "RcFviDxeLib_DIR"
+End
+
+MODULE
+ File = "RcFviDxeLib.mak"
+ Help = "Includes RcFviDxeLib.mak to Project"
+End
+
+ELINK
+ Name = "RcFviDxeLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\RcFviDxeLib_Lib.lib"
+ Parent = "RcFviDxeLib_LIB"
+ InvokeOrder = AfterParent
+End
+
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Library/RcFviDxeLib/RcFviLib.h b/ReferenceCode/Chipset/LynxPoint/Library/RcFviDxeLib/RcFviLib.h
new file mode 100644
index 0000000..70a5556
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Library/RcFviDxeLib/RcFviLib.h
@@ -0,0 +1,49 @@
+/** @file
+ Header file for Reference code Firmware Version Info Interface Lib implementation.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _RC_FVI_LIBRARY_IMPLEMENTATION_H_
+#define _RC_FVI_LIBRARY_IMPLEMENTATION_H_
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueBase.h"
+#include "EdkIIGlueDxe.h"
+#include "Library/EdkIIGlueMemoryAllocationLib.h"
+
+#include EFI_GUID_DEFINITION (DataHubRecords)
+#include EFI_PROTOCOL_CONSUMER (DataHub)
+
+#include "RcFviDxeLib.h"
+
+#endif
+
+/**
+ Publish the Reference code version info as per Firmware Version Info (FVI) Interface Spec v0.7
+ using MiscSubClass Data Hub.
+
+ @param[in] Event Event whose notification function is being invoked.
+ @param[in] Context Pointer to the notification functions context, which is implementation dependent.
+
+ @retval None
+**/
+VOID
+EFIAPI
+DataHubCallback (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ );
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/LynxPoint.cif b/ReferenceCode/Chipset/LynxPoint/LynxPoint.cif
new file mode 100644
index 0000000..1722234
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/LynxPoint.cif
@@ -0,0 +1,47 @@
+<component>
+ name = "Intel Pch SB Refcode"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint"
+ RefName = "Intel Pch SB Refcode"
+[files]
+"Pch.sdl"
+[parts]
+"PchAcpiTables"
+"ActiveBios"
+"IntelPchInclude"
+"IoTrap"
+"IntelLegacyInterrupt"
+"PchLib"
+"PchInitDxe"
+"PchInitPeim"
+"PchSmiDispatcher"
+"PchPcieSmm"
+"IntelPchPpiLib"
+"IntelPchProtocolLib"
+"PchReset"
+"PchResetPeim"
+"PchResetCommonLib"
+"PchSampleCode"
+"SataController"
+"PchSerialGpio"
+"SmartTimer"
+"PchSmbusCommonLib"
+"PchSmbusDxe"
+"PchSmbusArpDisabled"
+"PeiSmmControl"
+"SmmControl"
+"PchSpiCommonLib"
+"PchSpiPeim"
+"PchSpiSmm"
+"PchSpiRuntime"
+"PchSmbusSmm"
+"PchSmbusArpEnabled"
+"PchUsbCommonLib"
+"PchUsb"
+"Wdt"
+"PchGuidLib"
+"PchLateInitSmm"
+"PchS3Support"
+"PchS3Peim"
+"S3SupportSmm"
+<endComponent> \ No newline at end of file
diff --git a/ReferenceCode/Chipset/LynxPoint/Pch.sdl b/ReferenceCode/Chipset/LynxPoint/Pch.sdl
new file mode 100644
index 0000000..2b372e3
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Pch.sdl
@@ -0,0 +1,485 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/Pch.sdl 8 1/10/13 8:33a Scottyang $
+#
+# $Revision: 8 $
+#
+# $Date: 1/10/13 8:33a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/Pch.sdl $
+#
+# 8 1/10/13 8:33a Scottyang
+# [TAG] None
+# [Category] Improvement
+# [Description] PCIE port swap function support.
+# [Files] Pch.sdl, PchRootPorts.c
+#
+# 7 11/20/12 9:38a Scottyang
+# [TAG] EIP107014
+# [Category] Improvement
+# [Description] Update RC 0.8.0
+# [Files] ReferenceCode\Chipset\LynxPoint\*.*, SBDxe.c, SB.sd,
+# SbSetupData.c, GetSetupDate.c
+#
+# 6 10/16/12 4:28a Scottyang
+# [TAG] EIP103924
+#
+# [Category] Improvement
+#
+# [Description] Update RC 0.7.1
+#
+# [Files] ReferenceCode\Chipset\LynxPoint\*.*, SBDxe.c, SB.sd,
+# SbSetupData.c, GetSetupDate.c
+#
+# 5 9/26/12 3:45a Victortu
+# [TAG] None
+# [Category] Improvement
+# [Description] Update for Intel PCH LPT RC070.
+# [Files] SB.sdl, SBDXE.c, SBPEI.c, Pch.sdl, SB.sd, SB.uni
+#
+# 4 8/13/12 8:22a Victortu
+# [TAG] None
+# [Category] Improvement
+# [Description] Remove PCH_A0PWRON_SAFEMODE.
+# [Files] SBDxe.c, Pch.sdl
+#
+# 3 7/27/12 6:29a Victortu
+# [TAG] None
+# [Category] Improvement
+# [Description] Support Server/Workstation PCH ID. Please set
+# "PCH_SVR_WS_ID_SUPPORT".
+# [Files] SBSetup.c, PchRegs.h, Pch.sdl
+#
+# [TAG] None
+# [Category] Improvement
+# [Description] Support ASLPREPROCESS_FLAG to include Iintel RC flags.
+# [Files] Pch.sdl
+#
+# [TAG] None
+# [Category] Improvement
+# [Description] Update to support ULT Platform.
+# [Files] SB.H, SB.mak, SB.sdl, SB.sd, SBSetup.c,
+# AcpiModeEnable.c, SBDxe.c, SBPEI.c, SBSMI.c, SleepSmi.c,
+# SmiHandlerPorting.c, SmiHandlerPorting2.c, SBPPI.h, Pch.sdl
+#
+# 2 7/02/12 10:07a Victortu
+#
+# 1 2/08/12 8:38a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+TOKEN
+ Name = "PCH_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable PCH support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+End
+
+TOKEN
+ Name = "CougarPoint_SUPPORT"
+ Value = "$(PCH_SUPPORT)"
+ Help = ""
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "PCHLP_SUPPORT"
+ Value = "0"
+ Help = "PCH LynxPoint-LP Support"
+ TokenType = Boolean
+ TargetMAK = Yes
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "PCIE_PORT_SWAP"
+ Value = "0"
+ Help = "PCH PCIE pport swap function"
+ TokenType = Boolean
+ TargetMAK = Yes
+ TargetH = Yes
+End
+
+ELINK
+ Name = "INTEL_PCH_RC_FLAGS"
+ Help = "PCH Reference Code command line options of the compiler"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(INTEL_PCH_RC_FLAGS)"
+ Parent = "GLOBAL_DEFINES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(INTEL_PCH_RC_FLAGS)"
+ Parent = "ASLPREPROCESS_FLAG"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/D PCH_SUPPORT"
+ Parent = "INTEL_PCH_RC_FLAGS"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/D CougarPoint_SUPPORT"
+ Parent = "INTEL_PCH_RC_FLAGS"
+ InvokeOrder = AfterParent
+End
+
+TOKEN
+ Name = "PCH_DEBUG_INFO"
+ Value = "1"
+ Help = "Enable/disable debug message in debug build for PCH drivers."
+ TokenType = Integer
+ TargetMAK = Yes
+End
+
+TOKEN
+ Name = "SERIAL_IO_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetMAK = Yes
+ TargetH = Yes
+ Token = "PCHLP_SUPPORT" "=" "1"
+End
+
+TOKEN
+ Name = "ADSP_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetMAK = Yes
+ TargetH = Yes
+ Token = "PCHLP_SUPPORT" "=" "1"
+End
+
+TOKEN
+ Name = "SUS_WELL_RESTORE"
+ Value = "1"
+ TokenType = Boolean
+ TargetMAK = Yes
+ Token = "RapidStart_SUPPORT" "=" "1"
+End
+
+TOKEN
+ Name = "USB_PRECONDITION_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetMAK = Yes
+End
+
+PATH
+ Name = "INTEL_COUGAR_POINT_DIR"
+End
+
+PATH
+ Name = "INTEL_PCH_DIR"
+End
+
+ELINK
+ Name = "/I$(INTEL_COUGAR_POINT_DIR)"
+ Parent = "INTEL_PCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(INTEL_PCH_DIR)"
+ Parent = "INTEL_PCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(INTEL_COUGAR_POINT_DIR)\Include"
+ Parent = "INTEL_PCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(INTEL_PCH_DIR)\Include"
+ Parent = "INTEL_PCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(INTEL_COUGAR_POINT_DIR)\Protocol"
+ Parent = "INTEL_PCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(INTEL_PCH_DIR)\Protocol"
+ Parent = "INTEL_PCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(INTEL_COUGAR_POINT_DIR)\SampleCode"
+ Parent = "INTEL_PCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(INTEL_PCH_DIR)\SampleCode"
+ Parent = "INTEL_PCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(INTEL_COUGAR_POINT_DIR)\Include\Library"
+ Parent = "INTEL_PCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(INTEL_PCH_DIR)\Include\Library"
+ Parent = "INTEL_PCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(INTEL_COUGAR_POINT_INCLUDE_DIR)\PchRegs"
+ Parent = "INTEL_PCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(INTEL_PCH_INCLUDE_DIR)\PchRegs"
+ Parent = "INTEL_PCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(INTEL_COUGAR_POINT_DIR)\Protocol\PchPlatformPolicy"
+ Parent = "INTEL_PCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(INTEL_PCH_DIR)\Protocol\PchPlatformPolicy"
+ Parent = "INTEL_PCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(INTEL_COUGAR_POINT_DIR)\PciExpress\Dxe"
+ Parent = "INTEL_PCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(INTEL_PCH_DIR)\PciExpress\Dxe"
+ Parent = "INTEL_PCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(INTEL_COUGAR_POINT_DIR)\S3Support\Common"
+ Parent = "INTEL_PCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(INTEL_PCH_DIR)\S3Support\Common"
+ Parent = "INTEL_PCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(INTEL_COUGAR_POINT_DIR)\SmBus\Common"
+ Parent = "INTEL_PCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(INTEL_PCH_DIR)\SmBus\Common"
+ Parent = "INTEL_PCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(INTEL_COUGAR_POINT_DIR)\Spi\Common"
+ Parent = "INTEL_PCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(INTEL_PCH_DIR)\Spi\Common"
+ Parent = "INTEL_PCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(PchUsbCommonLib_DIR)"
+ Parent = "INTEL_PCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(PchResetCommonLib_DIR)"
+ Parent = "INTEL_PCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(PchS3SupportDxe_DIR)"
+ Parent = "INTEL_PCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(INTEL_COUGAR_POINT_DIR)\PchInit\Common"
+ Parent = "INTEL_PCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(INTEL_PCH_DIR)\PchInit\Common"
+ Parent = "INTEL_PCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(PchSpiPeim_DIR)"
+ Parent = "PCH_SPI_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(PchSpiSmm_DIR)"
+ Parent = "PCH_SPI_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(PchSpiRuntime_DIR)"
+ Parent = "PCH_SPI_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(PchInitDxe_DIR)"
+ Parent = "PCH_INITDXE_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(PchInitPeim_DIR)"
+ Parent = "PCH_INITPEI_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "INTEL_PCH_INCLUDES"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "PCH_SPI_INCLUDES"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "PCH_INITDXE_INCLUDES"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "PCH_INITPEI_INCLUDES"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "PERF_TUNE_INCLUDES"
+ InvokeOrder = ReplaceParent
+ Token = "PERF_TUNE_SUPPORT" "!=" "1"
+End
+
+ELINK
+ Name = "/I$(INTEL_COUGAR_POINT_DIR)"
+ Parent = "PERF_TUNE_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(INTEL_PCH_DIR)"
+ Parent = "PERF_TUNE_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(PchReset_DIR)"
+ Parent = "PCH_INITDXE_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(PchResetPeim_DIR)"
+ Parent = "PCH_INITPEI_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/D SERIAL_IO_FLAG"
+ Parent = "INTEL_PCH_RC_FLAGS"
+ Token = "SERIAL_IO_SUPPORT" "=" "1"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/D ADSP_FLAG"
+ Parent = "INTEL_PCH_RC_FLAGS"
+ Token = "ADSP_SUPPORT" "=" "1"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/D SUS_WELL_RESTORE"
+ Parent = "INTEL_PCH_RC_FLAGS"
+ Token = "SUS_WELL_RESTORE" "=" "1"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/D USB_PRECONDITION_ENABLE_FLAG"
+ Parent = "INTEL_PCH_RC_FLAGS"
+ Token = "USB_PRECONDITION_SUPPORT" "=" "1"
+ InvokeOrder = AfterParent
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchHSIO.c b/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchHSIO.c
new file mode 100644
index 0000000..4c23c06
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchHSIO.c
@@ -0,0 +1,48 @@
+/** @file
+ Intializes all common Hsio structures
+
+@copyright
+ Copyright (c) 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+#include "PchHsio.h"
+
+#ifdef ULT_FLAG
+
+IOBP_MMIO_TABLE_STRUCT PchSerialIoSnoopLptLp[] = {
+ { 0xCB000240, (UINT32)~(0x000C0000), 0x00040000 },
+ { 0xCB000248, (UINT32)~(0x000C0000), 0x00040000 },
+ { 0xCB000250, (UINT32)~(0x000C0000), 0x00040000 },
+ { 0xCB000258, (UINT32)~(0x000C0000), 0x00040000 },
+ { 0xCB000260, (UINT32)~(0x000C0000), 0x00040000 },
+ { 0xCB000268, (UINT32)~(0x000C0000), 0x00040000 },
+ { 0xCB000270, (UINT32)~(0x000C0000), 0x00040000 },
+ { 0xCB000014, (UINT32)~(0x00006000), 0x00002000 }
+};
+
+IOBP_MMIO_TABLE_STRUCT PchSerialIoIntsLptLp[] = { // Device INTx PCI IRQ ACPI IRQ
+ { 0xCB000240, (UINT32)~(0x0000003C), 0x00000008 }, // D21:F0 = INTB IRQ20 IRQ6
+ { 0xCB000248, (UINT32)~(0x0000003C), 0x0000000C }, // D21:F1 = INTC IRQ21 IRQ7
+ { 0xCB000250, (UINT32)~(0x0000003C), 0x0000000C }, // D21:F2 = INTC IRQ21 IRQ7
+ { 0xCB000258, (UINT32)~(0x0000003C), 0x0000000C }, // D21:F3 = INTC IRQ21 IRQ7
+ { 0xCB000260, (UINT32)~(0x0000003C), 0x0000000C }, // D21:F4 = INTC IRQ21 IRQ7
+ { 0xCB000268, (UINT32)~(0x0000003C), 0x00000010 }, // D21:F5 = INTD IRQ21 IRQ13
+ { 0xCB000270, (UINT32)~(0x0000003C), 0x00000010 } // D21:F6 = INTD IRQ21 IRQ13
+}; // D23:F0 = INTA IRQ22 IRQ5
+
+#endif // ULT_FLAG \ No newline at end of file
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchHSIO.h b/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchHSIO.h
new file mode 100644
index 0000000..4dc83d9
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchHSIO.h
@@ -0,0 +1,47 @@
+/** @file
+
+ Header file with all common Hsio information
+
+@copyright
+ Copyright (c) 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+#ifndef _PCH_HSIO_H_
+#define _PCH_HSIO_H_
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueBase.h"
+#include "PchAccess.h"
+#include "PchPlatformLib.h"
+#include "IobpDefinitions.h"
+#ifdef TRAD_FLAG
+#include "PchHsioLptHB0.h"
+#include "PchHsioLptHCx.h"
+#endif //TRAD_FLAG
+#ifdef ULT_FLAG
+#include "PchHsioLptLpBx.h"
+#endif //ULT_FLAG
+#endif
+
+
+#ifdef ULT_FLAG
+extern IOBP_MMIO_TABLE_STRUCT PchSerialIoSnoopLptLp[8];
+extern IOBP_MMIO_TABLE_STRUCT PchSerialIoIntsLptLp[7];
+#endif // ULT_FLAG
+
+#endif //_PCH_HSIO_H_ \ No newline at end of file
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchHSIOLptHB0.c b/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchHSIOLptHB0.c
new file mode 100644
index 0000000..190f824
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchHSIOLptHB0.c
@@ -0,0 +1,295 @@
+/** @file
+ Intializes all include B0 Hsio structures
+
+@copyright
+ Copyright (c) 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+#include "PchHsio.h"
+
+#ifdef TRAD_FLAG
+
+UINT8 PchChipsetInitTableLptH_B0[] = {
+ 0x79, 0x56, //U16 CRC-16
+ 0x23, 0x02, //U16 Version
+ 0x1A, //U8 NumEntries
+ // Hsio Entries
+ // Offset Value EP
+ 0x40,0xC1, 0xA6,0x05,0x08,0x00, 0xEB,
+ 0x44,0xC1, 0x94,0x03,0x04,0x00, 0xEB,
+ 0x40,0x83, 0x96,0x05,0x08,0x00, 0xE9,
+ 0x40,0x83, 0x96,0x05,0x08,0x00, 0xEA,
+ 0x44,0x83, 0x94,0x03,0x04,0x00, 0xE9,
+ 0x44,0x83, 0x94,0x03,0x04,0x00, 0xEA,
+ 0x0C,0x80, 0x50,0xAB,0x02,0x0E, 0xEB,
+ 0x0C,0x80, 0x50,0xAB,0x02,0x0E, 0xE9,
+ 0x00,0xC1, 0x89,0x5F,0x0B,0x0F, 0xEB,
+ 0x00,0xC1, 0x89,0x5F,0x0B,0x0F, 0xE9,
+ 0x7C,0xC1, 0x00,0x3F,0x40,0x3D, 0xEB,
+ 0x7C,0xC1, 0x00,0x3F,0x00,0x4F, 0xE9,
+ 0x78,0xC1, 0x84,0x1B,0x00,0x00, 0xE9,
+ 0xCC,0xC1, 0x04,0x43,0x35,0x00, 0xEB,
+ 0x90,0xC0, 0x55,0x51,0x3E,0x2B, 0xE9,
+ 0x90,0x82, 0x55,0x51,0x3E,0x2B, 0xEA,
+ 0x8C,0xC0, 0x46,0x20,0x78,0x0C, 0xE9,
+ 0x8C,0x82, 0x46,0x20,0x78,0x0C, 0xEA,
+ 0x30,0xC0, 0x00,0x0F,0x00,0x00, 0xEB,
+ 0x30,0xC0, 0x00,0x0F,0x00,0x00, 0xE9,
+ 0x30,0xC0, 0x00,0x0F,0x00,0x00, 0xEA,
+ 0xCC,0xC1, 0x04,0x43,0x35,0x00, 0xE9,
+ 0xCC,0xC1, 0x04,0x43,0x35,0x00, 0xEA,
+ 0x2C,0xC0, 0x00,0x0A,0x00,0x0F, 0xEB,
+ 0x2C,0x82, 0x00,0x0A,0x00,0x0F, 0xE9,
+ 0x2C,0x82, 0x00,0x0A,0x00,0x0F, 0xEA
+};
+
+IOBP_MMIO_TABLE_STRUCT PchSataHsioLptH_B0[] = {
+ { 0xEA008008, (UINT32)~(0xFF000000), 0x1C000000 },
+ { 0xEA00800C, (UINT32)~(0x00007FFF), 0x00002B50 },
+ { 0xEA0024A4, (UINT32)~(0x0030FF00), 0x00308300 },
+ { 0xEA0026A4, (UINT32)~(0x0030FF00), 0x00308300 },
+ { 0xEA0008A4, (UINT32)~(0x0030FF00), 0x00308300 },
+ { 0xEA000AA4, (UINT32)~(0x0030FF00), 0x00308300 },
+ { 0xEA0024AC, (UINT32)~(0x00000030), 0x00000020 },
+ { 0xEA0026AC, (UINT32)~(0x00000030), 0x00000020 },
+ { 0xEA0008AC, (UINT32)~(0x00000030), 0x00000020 },
+ { 0xEA000AAC, (UINT32)~(0x00000030), 0x00000020 },
+ { 0xEA002488, (UINT32)~(0x0000FF00), 0x00008000 },
+ { 0xEA002688, (UINT32)~(0x0000FF00), 0x00008000 },
+ { 0xEA000888, (UINT32)~(0x0000FF00), 0x00008000 },
+ { 0xEA000A88, (UINT32)~(0x0000FF00), 0x00008000 },
+ { 0xEA002494, (UINT32)~(0x80000000), 0x80000000 },
+ { 0xEA002694, (UINT32)~(0x80000000), 0x80000000 },
+ { 0xEA000894, (UINT32)~(0x80000000), 0x80000000 },
+ { 0xEA000A94, (UINT32)~(0x80000000), 0x80000000 },
+ { 0xEA002540, (UINT32)~(0x00FFFFFF), 0x00180918 },
+ { 0xEA002740, (UINT32)~(0x00FFFFFF), 0x00180918 },
+ { 0xEA000940, (UINT32)~(0x00FFFFFF), 0x00180918 },
+ { 0xEA000B40, (UINT32)~(0x00FFFFFF), 0x00180918 },
+ { 0xEA002544, (UINT32)~(0x00FFFFFF), 0x00140918 },
+ { 0xEA002744, (UINT32)~(0x00FFFFFF), 0x00140918 },
+ { 0xEA000944, (UINT32)~(0x00FFFFFF), 0x00140918 },
+ { 0xEA000B44, (UINT32)~(0x00FFFFFF), 0x00140918 },
+ { 0xEA002548, (UINT32)~(0x00FFFFFF), 0x00140918 },
+ { 0xEA002748, (UINT32)~(0x00FFFFFF), 0x00140918 },
+ { 0xEA000948, (UINT32)~(0x00FFFFFF), 0x00140918 },
+ { 0xEA000B48, (UINT32)~(0x00FFFFFF), 0x00140918 },
+ { 0xEA002550, (UINT32)~(0x3F000000), 0x02000000 },
+ { 0xEA002750, (UINT32)~(0x3F000000), 0x02000000 },
+ { 0xEA000950, (UINT32)~(0x3F000000), 0x02000000 },
+ { 0xEA000B50, (UINT32)~(0x3F000000), 0x02000000 },
+ { 0xEA002554, (UINT32)~(0x003F0000), 0x00020000 },
+ { 0xEA002754, (UINT32)~(0x003F0000), 0x00020000 },
+ { 0xEA000954, (UINT32)~(0x003F0000), 0x00020000 },
+ { 0xEA000B54, (UINT32)~(0x003F0000), 0x00020000 },
+ { 0xEA002410, (UINT32)~(0xFFFF0000), 0x0D510000 },
+ { 0xEA002610, (UINT32)~(0xFFFF0000), 0x0D510000 },
+ { 0xEA000810, (UINT32)~(0xFFFF0000), 0x0D510000 },
+ { 0xEA000A10, (UINT32)~(0xFFFF0000), 0x0D510000 },
+ { 0xEA002400, (UINT32)~(0xCF030000), 0xCF030000 },
+ { 0xEA002600, (UINT32)~(0xCF030000), 0xCF030000 },
+ { 0xEA000800, (UINT32)~(0xCF030000), 0xCF030000 },
+ { 0xEA000A00, (UINT32)~(0xCF030000), 0xCF030000 },
+ { 0xEA002408, (UINT32)~(0xFFFC6108), 0xEA6C6108 },
+ { 0xEA002608, (UINT32)~(0xFFFC6108), 0xEA6C6108 },
+ { 0xEA000808, (UINT32)~(0xFFFC6108), 0xEA6C6108 },
+ { 0xEA000A08, (UINT32)~(0xFFFC6108), 0xEA6C6108 },
+ { 0xEA002418, (UINT32)~(0xFFFF0300), 0x38250100 },
+ { 0xEA002618, (UINT32)~(0xFFFF0300), 0x38250100 },
+ { 0xEA000818, (UINT32)~(0xFFFF0300), 0x38250100 },
+ { 0xEA000A18, (UINT32)~(0xFFFF0300), 0x38250100 },
+ { 0xEA002428, (UINT32)~(0xFF1F0000), 0x580E0000 },
+ { 0xEA002628, (UINT32)~(0xFF1F0000), 0x580E0000 },
+ { 0xEA000828, (UINT32)~(0xFF1F0000), 0x580E0000 },
+ { 0xEA000A28, (UINT32)~(0xFF1F0000), 0x580E0000 },
+ { 0xEA002438, (UINT32)~(0x0000000F), 0x0000000D },
+ { 0xEA002638, (UINT32)~(0x0000000F), 0x0000000D },
+ { 0xEA000838, (UINT32)~(0x0000000F), 0x0000000D },
+ { 0xEA000A38, (UINT32)~(0x0000000F), 0x0000000D },
+ { 0xEA002440, (UINT32)~(0x1F000000), 0x01000000 },
+ { 0xEA002640, (UINT32)~(0x1F000000), 0x01000000 },
+ { 0xEA000840, (UINT32)~(0x1F000000), 0x01000000 },
+ { 0xEA000A40, (UINT32)~(0x1F000000), 0x01000000 },
+ { 0xEA00242C, (UINT32)~(0x00020000), 0x00020000 },
+ { 0xEA00262C, (UINT32)~(0x00020000), 0x00020000 },
+ { 0xEA00082C, (UINT32)~(0x00020000), 0x00020000 },
+ { 0xEA000A2C, (UINT32)~(0x00020000), 0x00020000 },
+ { 0xEA00241C, (UINT32)~(0x00007C00), 0x00002400 },
+ { 0xEA00261C, (UINT32)~(0x00007C00), 0x00002400 },
+ { 0xEA00081C, (UINT32)~(0x00007C00), 0x00002400 },
+ { 0xEA000A1C, (UINT32)~(0x00007C00), 0x00002400 },
+ { 0xEA002500, (UINT32)~(0x0000E03E), 0x00004008 },
+ { 0xEA002700, (UINT32)~(0x0000E03E), 0x00004008 },
+ { 0xEA000900, (UINT32)~(0x0000E03E), 0x00004008 },
+ { 0xEA000B00, (UINT32)~(0x0000E03E), 0x00004008 },
+ { 0xEA00257C, (UINT32)~(0x000F3F00), 0x00003F00 },
+ { 0xEA00277C, (UINT32)~(0x000F3F00), 0x00003F00 },
+ { 0xEA00097C, (UINT32)~(0x000F3F00), 0x00003F00 },
+ { 0xEA000B7C, (UINT32)~(0x000F3F00), 0x00003F00 }
+};
+
+IOBP_MMIO_TABLE_STRUCT PchSataSharedHsioLptH_B0[] = {
+ { 0xEA0020A4, (UINT32)~(0x0030FF00), 0x00308300 },
+ { 0xEA0022A4, (UINT32)~(0x0030FF00), 0x00308300 },
+ { 0xEA0020AC, (UINT32)~(0x00000030), 0x00000020 },
+ { 0xEA0022AC, (UINT32)~(0x00000030), 0x00000020 },
+ { 0xEA002088, (UINT32)~(0x0000FF00), 0x00008000 },
+ { 0xEA002288, (UINT32)~(0x0000FF00), 0x00008000 },
+ { 0xEA002094, (UINT32)~(0x80000000), 0x80000000 },
+ { 0xEA002294, (UINT32)~(0x80000000), 0x80000000 },
+ { 0xEA002140, (UINT32)~(0x00FFFFFF), 0x00180918 },
+ { 0xEA002340, (UINT32)~(0x00FFFFFF), 0x00180918 },
+ { 0xEA002144, (UINT32)~(0x00FFFFFF), 0x00140918 },
+ { 0xEA002344, (UINT32)~(0x00FFFFFF), 0x00140918 },
+ { 0xEA002148, (UINT32)~(0x00FFFFFF), 0x00140918 },
+ { 0xEA002348, (UINT32)~(0x00FFFFFF), 0x00140918 },
+ { 0xEA002150, (UINT32)~(0x3F000000), 0x02000000 },
+ { 0xEA002350, (UINT32)~(0x3F000000), 0x02000000 },
+ { 0xEA002154, (UINT32)~(0x003F0000), 0x00020000 },
+ { 0xEA002354, (UINT32)~(0x003F0000), 0x00020000 },
+ { 0xEA002010, (UINT32)~(0xFFFF0000), 0x0D510000 },
+ { 0xEA002210, (UINT32)~(0xFFFF0000), 0x0D510000 },
+ { 0xEA002000, (UINT32)~(0xCF030000), 0xCF030000 },
+ { 0xEA002200, (UINT32)~(0xCF030000), 0xCF030000 },
+ { 0xEA002008, (UINT32)~(0xFFFC6108), 0xEA6C6108 },
+ { 0xEA002208, (UINT32)~(0xFFFC6108), 0xEA6C6108 },
+ { 0xEA002018, (UINT32)~(0xFFFF0300), 0x38250100 },
+ { 0xEA002218, (UINT32)~(0xFFFF0300), 0x38250100 },
+ { 0xEA002028, (UINT32)~(0xFF1F0000), 0x580E0000 },
+ { 0xEA002228, (UINT32)~(0xFF1F0000), 0x580E0000 },
+ { 0xEA002038, (UINT32)~(0x0000000F), 0x0000000D },
+ { 0xEA002238, (UINT32)~(0x0000000F), 0x0000000D },
+ { 0xEA002040, (UINT32)~(0x1F000000), 0x01000000 },
+ { 0xEA002240, (UINT32)~(0x1F000000), 0x01000000 },
+ { 0xEA00202C, (UINT32)~(0x00020700), 0x00020100 },
+ { 0xEA00222C, (UINT32)~(0x00020700), 0x00020100 },
+ { 0xEA00201C, (UINT32)~(0x00007C00), 0x00002400 },
+ { 0xEA00221C, (UINT32)~(0x00007C00), 0x00002400 },
+ { 0xEA002100, (UINT32)~(0x0000E03E), 0x00004008 },
+ { 0xEA002300, (UINT32)~(0x0000E03E), 0x00004008 },
+ { 0xEA00217C, (UINT32)~(0x000F3F00), 0x00003F00 },
+ { 0xEA00237C, (UINT32)~(0x000F3F00), 0x00003F00 }
+};
+
+IOBP_MMIO_TABLE_STRUCT PchUsb3HsioLptH_B0[] = {
+ { 0xE9003140, (UINT32)~(0x00FFFFFF), 0x00040998 },
+ { 0xE9003340, (UINT32)~(0x00FFFFFF), 0x00040998 },
+ { 0xE9001540, (UINT32)~(0x00FFFFFF), 0x00040998 },
+ { 0xE9001740, (UINT32)~(0x00FFFFFF), 0x00040998 },
+ { 0xE900316C, (UINT32)~(0x000000FF), 0x0000003F },
+ { 0xE900336C, (UINT32)~(0x000000FF), 0x0000003F },
+ { 0xE900156C, (UINT32)~(0x000000FF), 0x0000003F },
+ { 0xE900176C, (UINT32)~(0x000000FF), 0x0000003F },
+ { 0xE9003168, (UINT32)~(0x01000F3C), 0x00000A28 },
+ { 0xE9003368, (UINT32)~(0x01000F3C), 0x00000A28 },
+ { 0xE9001568, (UINT32)~(0x01000F3C), 0x00000A28 },
+ { 0xE9001768, (UINT32)~(0x01000F3C), 0x00000A28 },
+ { 0xE900314C, (UINT32)~(0x00FF0000), 0x00140000 },
+ { 0xE900334C, (UINT32)~(0x00FF0000), 0x00140000 },
+ { 0xE900154C, (UINT32)~(0x00FF0000), 0x00140000 },
+ { 0xE900174C, (UINT32)~(0x00FF0000), 0x00140000 },
+ { 0xE9003164, (UINT32)~(0x0000F000), 0x00005000 },
+ { 0xE9003364, (UINT32)~(0x0000F000), 0x00005000 },
+ { 0xE9001564, (UINT32)~(0x0000F000), 0x00005000 },
+ { 0xE9001764, (UINT32)~(0x0000F000), 0x00005000 },
+ { 0xE9003170, (UINT32)~(0x00000018), 0x00000000 },
+ { 0xE9003370, (UINT32)~(0x00000018), 0x00000000 },
+ { 0xE9001570, (UINT32)~(0x00000018), 0x00000000 },
+ { 0xE9001770, (UINT32)~(0x00000018), 0x00000000 },
+ { 0xE90031CC, (UINT32)~(0x00001407), 0x00001401 },
+ { 0xE90033CC, (UINT32)~(0x00001407), 0x00001401 },
+ { 0xE90015CC, (UINT32)~(0x00001407), 0x00001401 },
+ { 0xE90017CC, (UINT32)~(0x00001407), 0x00001401 }
+};
+
+IOBP_MMIO_TABLE_STRUCT PchUsb3SharedHsioLptH_B0[] = {
+ { 0xE9002D40, (UINT32)~(0x00FFFFFF), 0x00040998 },
+ { 0xE9002F40, (UINT32)~(0x00FFFFFF), 0x00040998 },
+ { 0xE9002D6C, (UINT32)~(0x000000FF), 0x0000003F },
+ { 0xE9002F6C, (UINT32)~(0x000000FF), 0x0000003F },
+ { 0xE9002D44, (UINT32)~(0x000000FF), 0x00000014 },
+ { 0xE9002F44, (UINT32)~(0x000000FF), 0x00000014 },
+ { 0xE9002D68, (UINT32)~(0x01000F3C), 0x00000A28 },
+ { 0xE9002F68, (UINT32)~(0x01000F3C), 0x00000A28 },
+ { 0xE9002D4C, (UINT32)~(0x00FF0000), 0x00140000 },
+ { 0xE9002F4C, (UINT32)~(0x00FF0000), 0x00140000 },
+ { 0xE9002D64, (UINT32)~(0x0000F000), 0x00005000 },
+ { 0xE9002F64, (UINT32)~(0x0000F000), 0x00005000 },
+ { 0xE9002D70, (UINT32)~(0x00000018), 0x00000000 },
+ { 0xE9002F70, (UINT32)~(0x00000018), 0x00000000 },
+ { 0xE9002DCC, (UINT32)~(0x00001407), 0x00001401 },
+ { 0xE9002FCC, (UINT32)~(0x00001407), 0x00001401 },
+ { 0xE9002C2C, (UINT32)~(0x00000700), 0x00000100 },
+ { 0xE9002E2C, (UINT32)~(0x00000700), 0x00000100 }
+};
+
+IOBP_MMIO_TABLE_STRUCT PchGbeSharedHsioLptH_B0[] = {
+ { 0xE9002E08, (UINT32)~(0xF0000100), 0xE0000100 },
+ { 0xE9002C08, (UINT32)~(0xF0000100), 0xE0000100 },
+ { 0xE9002A08, (UINT32)~(0xF0000100), 0xE0000100 },
+ { 0xE9002808, (UINT32)~(0xF0000100), 0xE0000100 },
+ { 0xE9002608, (UINT32)~(0xF0000100), 0xE0000100 },
+ { 0xE9002408, (UINT32)~(0xF0000100), 0xE0000100 },
+ { 0xE9002208, (UINT32)~(0xF0000100), 0xE0000100 },
+ { 0xE9002008, (UINT32)~(0xF0000100), 0xE0000100 }
+};
+
+IOBP_MMIO_TABLE_STRUCT PchDmiHsioLptH_B0[] = {
+ { 0xEB002090, (UINT32)~(0x0000FF00), 0x00005100 },
+ { 0xEB002290, (UINT32)~(0x0000FF00), 0x00005100 },
+ { 0xEB000490, (UINT32)~(0x0000FF00), 0x00005100 },
+ { 0xEB000690, (UINT32)~(0x0000FF00), 0x00005100 }
+};
+
+IOBP_MMIO_TABLE_STRUCT PchSataHsioLptH_DT_B0[] = {
+ { 0xEA002490, (UINT32)~(0x0000FFFF), 0x00003E67 },
+ { 0xEA002690, (UINT32)~(0x0000FFFF), 0x00003E67 },
+ { 0xEA000890, (UINT32)~(0x0000FFFF), 0x00003E67 },
+ { 0xEA000A90, (UINT32)~(0x0000FFFF), 0x00003E67 },
+ { 0xEA00248C, (UINT32)~(0x00FF0000), 0x00800000 },
+ { 0xEA00268C, (UINT32)~(0x00FF0000), 0x00800000 },
+ { 0xEA00088C, (UINT32)~(0x00FF0000), 0x00800000 },
+ { 0xEA000A8C, (UINT32)~(0x00FF0000), 0x00800000 }
+};
+
+IOBP_MMIO_TABLE_STRUCT PchSataSharedHsioLptH_DT_B0[] = {
+ { 0xEA002090, (UINT32)~(0x0000FFFF), 0x00003E67 },
+ { 0xEA002290, (UINT32)~(0x0000FFFF), 0x00003E67 },
+ { 0xEA00208C, (UINT32)~(0x00FF0000), 0x00800000 },
+ { 0xEA00228C, (UINT32)~(0x00FF0000), 0x00800000 }
+};
+
+IOBP_MMIO_TABLE_STRUCT PchSataHsioLptH_MB_B0[] = {
+ { 0xEA002490, (UINT32)~(0x0000FFFF), 0x00004C5A },
+ { 0xEA002690, (UINT32)~(0x0000FFFF), 0x00004C5A },
+ { 0xEA000890, (UINT32)~(0x0000FFFF), 0x00004C5A },
+ { 0xEA000A90, (UINT32)~(0x0000FFFF), 0x00004C5A },
+ { 0xEA00248C, (UINT32)~(0x00FF0000), 0x00800000 },
+ { 0xEA00268C, (UINT32)~(0x00FF0000), 0x00800000 },
+ { 0xEA00088C, (UINT32)~(0x00FF0000), 0x00800000 },
+ { 0xEA000A8C, (UINT32)~(0x00FF0000), 0x00800000 }
+};
+
+IOBP_MMIO_TABLE_STRUCT PchSataSharedHsioLptH_MB_B0[] = {
+ { 0xEA002090, (UINT32)~(0x0000FFFF), 0x00004C5A },
+ { 0xEA002290, (UINT32)~(0x0000FFFF), 0x00004C5A },
+ { 0xEA00208C, (UINT32)~(0x00FF0000), 0x00800000 },
+ { 0xEA00228C, (UINT32)~(0x00FF0000), 0x00800000 }
+};
+
+#endif // TRAD_FLAG
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchHSIOLptHB0.h b/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchHSIOLptHB0.h
new file mode 100644
index 0000000..efdd645
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchHSIOLptHB0.h
@@ -0,0 +1,44 @@
+/** @file
+
+ Header file with all LptHB0 Hsio information
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+
+#ifdef TRAD_FLAG
+#ifndef _PCH_HSIO_LPTHB0_H_
+#define _PCH_HSIO_LPTHB0_H_
+
+#define PCH_LPTH_HSIO_VER_B0 0x23
+
+extern UINT8 PchChipsetInitTableLptH_B0[187];
+extern IOBP_MMIO_TABLE_STRUCT PchSataHsioLptH_B0[82];
+extern IOBP_MMIO_TABLE_STRUCT PchSataSharedHsioLptH_B0[40];
+extern IOBP_MMIO_TABLE_STRUCT PchUsb3HsioLptH_B0[28];
+extern IOBP_MMIO_TABLE_STRUCT PchUsb3SharedHsioLptH_B0[18];
+extern IOBP_MMIO_TABLE_STRUCT PchGbeSharedHsioLptH_B0[8];
+extern IOBP_MMIO_TABLE_STRUCT PchDmiHsioLptH_B0[4];
+extern IOBP_MMIO_TABLE_STRUCT PchSataHsioLptH_DT_B0[8];
+extern IOBP_MMIO_TABLE_STRUCT PchSataSharedHsioLptH_DT_B0[4];
+extern IOBP_MMIO_TABLE_STRUCT PchSataHsioLptH_MB_B0[8];
+extern IOBP_MMIO_TABLE_STRUCT PchSataSharedHsioLptH_MB_B0[4];
+
+#endif //_PCH_HSIO_LPTHB0_H_
+#endif //TRAD_FLAG \ No newline at end of file
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchHsioLptHCx.c b/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchHsioLptHCx.c
new file mode 100644
index 0000000..68e74df
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchHsioLptHCx.c
@@ -0,0 +1,326 @@
+/** @file
+ Initializes all LPTHCx Hsio structures
+
+@copyright
+ Copyright (c) 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+
+**/
+
+#include "PchHsio.h"
+
+#ifdef TRAD_FLAG
+
+UINT8 PchChipsetInitTableLptH_Cx[] = {
+ 0x9D, 0x59, //U16 CRC-16
+ 0x2C, 0x03, //U16 Version
+ 0x29, //U8 NumEntries;
+ // HSIO Entries
+ // Offset Value EP
+ 0x2C,0xC0, 0x00,0x0A,0x00,0x0F, 0xEB,
+ 0x2C,0x82, 0x00,0x0A,0x00,0x0F, 0xE9,
+ 0x40,0xC1, 0x9C,0x05,0x88,0x00, 0xE9,
+ 0x98,0xC0, 0x41,0x3B,0x20,0x1F, 0xEB,
+ 0x98,0xC0, 0x41,0x3B,0x20,0x1F, 0xE9,
+ 0x98,0xC0, 0x41,0x3B,0x20,0x1F, 0xEA,
+ 0x2C,0x82, 0x00,0x0A,0x00,0x0F, 0xEA,
+ 0x30,0xC0, 0x00,0x0F,0x00,0x00, 0xEB,
+ 0x30,0xC0, 0x00,0x0F,0x00,0x00, 0xE9,
+ 0x94,0xC0, 0x55,0x60,0x40,0x47, 0xEB,
+ 0x30,0xC0, 0x00,0x0F,0x00,0x00, 0xEA,
+ 0x40,0x83, 0x9C,0x05,0x88,0x00, 0xEA,
+ 0x78,0xC1, 0x80,0x19,0x00,0x00, 0xEB,
+ 0x94,0xC0, 0x55,0x60,0x40,0x47, 0xE9,
+ 0x94,0xC0, 0x55,0x60,0x40,0x47, 0xEA,
+ 0x88,0xC0, 0x3A,0x98,0x80,0x55, 0xEB,
+ 0x78,0xC1, 0x80,0x19,0x00,0x00, 0xE9,
+ 0x88,0xC0, 0x3A,0x98,0x80,0x55, 0xE9,
+ 0x88,0x82, 0x3A,0x98,0x80,0x55, 0xEA,
+ 0x8C,0xC0, 0x46,0x20,0x78,0x0C, 0xEB,
+ 0x8C,0xC0, 0x46,0x20,0x78,0x0C, 0xE9,
+ 0x8C,0x82, 0x46,0x20,0x78,0x0C, 0xEA,
+ 0x78,0xC1, 0x80,0x19,0x00,0x00, 0xEA,
+ 0xCC,0xC1, 0x04,0x43,0x25,0x38, 0xE9,
+ 0xCC,0xC1, 0x04,0x43,0x25,0x38, 0xEB,
+ 0xCC,0xC1, 0x04,0x43,0x25,0x38, 0xEA,
+ 0x7C,0xC1, 0x00,0x24,0xA0,0x4E, 0xE9,
+ 0x7C,0xC1, 0x00,0x24,0xC0,0x3E, 0xEB,
+ 0x7C,0xC1, 0x00,0x24,0xC0,0x3E, 0xEA,
+ 0x40,0xC1, 0xAC,0x05,0x88,0x00, 0xEB,
+ 0x90,0xC0, 0x55,0x51,0x3E,0x2B, 0xEB,
+ 0x90,0xC0, 0x55,0x51,0x3E,0x2B, 0xE9,
+ 0x90,0x82, 0x55,0x51,0x3E,0x2B, 0xEA,
+ 0x08,0xC0, 0x00,0xA0,0x00,0xB0, 0xE9,
+ 0x08,0xC0, 0x00,0xA0,0x00,0xB0, 0xEA,
+ 0x44,0xC1, 0x94,0x03,0x84,0x00, 0xEB,
+ 0x44,0xC1, 0x94,0x03,0x84,0x00, 0xE9,
+ 0x44,0x83, 0x94,0x03,0x84,0x00, 0xEA,
+ 0x38,0xC0, 0x32,0x00,0xCE,0x38, 0xEB,
+ 0x38,0xC0, 0x32,0x00,0xCE,0x38, 0xE9,
+ 0x38,0xC0, 0x32,0x00,0xCE,0x38, 0xEA
+};
+
+IOBP_MMIO_TABLE_STRUCT PchSataSharedHsioLptH_Cx[] = {
+ { 0xEA002008, (UINT32)~(0xFFFC6108), 0xEA6C6108 },
+ { 0xEA002208, (UINT32)~(0xFFFC6108), 0xEA6C6108 },
+ { 0xEA002038, (UINT32)~(0x3F00000F), 0x0700000D },
+ { 0xEA002238, (UINT32)~(0x3F00000F), 0x0700000D },
+ { 0xEA00202C, (UINT32)~(0x00020F00), 0x00020100 },
+ { 0xEA00222C, (UINT32)~(0x00020F00), 0x00020100 },
+ { 0xEA002040, (UINT32)~(0x1F000000), 0x01000000 },
+ { 0xEA002240, (UINT32)~(0x1F000000), 0x01000000 },
+ { 0xEA002010, (UINT32)~(0xFFFF0000), 0x0D510000 },
+ { 0xEA002210, (UINT32)~(0xFFFF0000), 0x0D510000 },
+ { 0xEA002018, (UINT32)~(0xFFFF0300), 0x38250100 },
+ { 0xEA002218, (UINT32)~(0xFFFF0300), 0x38250100 },
+ { 0xEA002000, (UINT32)~(0xCF030000), 0xCF030000 },
+ { 0xEA002200, (UINT32)~(0xCF030000), 0xCF030000 },
+ { 0xEA002028, (UINT32)~(0xFF1F0000), 0x580E0000 },
+ { 0xEA002228, (UINT32)~(0xFF1F0000), 0x580E0000 },
+ { 0xEA00201C, (UINT32)~(0x00007C00), 0x00002400 },
+ { 0xEA00221C, (UINT32)~(0x00007C00), 0x00002400 },
+ { 0xEA00208C, (UINT32)~(0x00FF0000), 0x00800000 },
+ { 0xEA00228C, (UINT32)~(0x00FF0000), 0x00800000 },
+ { 0xEA0020A4, (UINT32)~(0x0030FF00), 0x00308300 },
+ { 0xEA0022A4, (UINT32)~(0x0030FF00), 0x00308300 },
+ { 0xEA0020AC, (UINT32)~(0x00000030), 0x00000020 },
+ { 0xEA0022AC, (UINT32)~(0x00000030), 0x00000020 },
+ { 0xEA002140, (UINT32)~(0x00FFFFFF), 0x00140718 },
+ { 0xEA002340, (UINT32)~(0x00FFFFFF), 0x00140718 },
+ { 0xEA002144, (UINT32)~(0x00FFFFFF), 0x00140998 },
+ { 0xEA002344, (UINT32)~(0x00FFFFFF), 0x00140998 },
+ { 0xEA002148, (UINT32)~(0x00FFFFFF), 0x00140998 },
+ { 0xEA002348, (UINT32)~(0x00FFFFFF), 0x00140998 },
+ { 0xEA00217C, (UINT32)~(0x03000000), 0x03000000 },
+ { 0xEA00237C, (UINT32)~(0x03000000), 0x03000000 },
+ { 0xEA002178, (UINT32)~(0x00001F00), 0x00001800 },
+ { 0xEA002378, (UINT32)~(0x00001F00), 0x00001800 },
+ { 0xEA00210C, (UINT32)~(0x0038000F), 0x00000005 },
+ { 0xEA00230C, (UINT32)~(0x0038000F), 0x00000005 }
+};
+
+IOBP_MMIO_TABLE_STRUCT PchSataHsioLptH_Cx[] = {
+ { 0xEA008008, (UINT32)~(0xFF000000), 0x1C000000 },
+ { 0xEA002408, (UINT32)~(0xFFFC6108), 0xEA6C6108 },
+ { 0xEA002608, (UINT32)~(0xFFFC6108), 0xEA6C6108 },
+ { 0xEA000808, (UINT32)~(0xFFFC6108), 0xEA6C6108 },
+ { 0xEA000A08, (UINT32)~(0xFFFC6108), 0xEA6C6108 },
+ { 0xEA002438, (UINT32)~(0x3F00000F), 0x0700000D },
+ { 0xEA002638, (UINT32)~(0x3F00000F), 0x0700000D },
+ { 0xEA000838, (UINT32)~(0x3F00000F), 0x0700000D },
+ { 0xEA000A38, (UINT32)~(0x3F00000F), 0x0700000D },
+ { 0xEA002440, (UINT32)~(0x1F000000), 0x01000000 },
+ { 0xEA002640, (UINT32)~(0x1F000000), 0x01000000 },
+ { 0xEA000840, (UINT32)~(0x1F000000), 0x01000000 },
+ { 0xEA000A40, (UINT32)~(0x1F000000), 0x01000000 },
+ { 0xEA002410, (UINT32)~(0xFFFF0000), 0x0D510000 },
+ { 0xEA002610, (UINT32)~(0xFFFF0000), 0x0D510000 },
+ { 0xEA000810, (UINT32)~(0xFFFF0000), 0x0D510000 },
+ { 0xEA000A10, (UINT32)~(0xFFFF0000), 0x0D510000 },
+ { 0xEA00242C, (UINT32)~(0x00020800), 0x00020000 },
+ { 0xEA00262C, (UINT32)~(0x00020800), 0x00020000 },
+ { 0xEA00082C, (UINT32)~(0x00020800), 0x00020000 },
+ { 0xEA000A2C, (UINT32)~(0x00020800), 0x00020000 },
+ { 0xEA002418, (UINT32)~(0xFFFF0300), 0x38250100 },
+ { 0xEA002618, (UINT32)~(0xFFFF0300), 0x38250100 },
+ { 0xEA000818, (UINT32)~(0xFFFF0300), 0x38250100 },
+ { 0xEA000A18, (UINT32)~(0xFFFF0300), 0x38250100 },
+ { 0xEA002400, (UINT32)~(0xCF030000), 0xCF030000 },
+ { 0xEA002600, (UINT32)~(0xCF030000), 0xCF030000 },
+ { 0xEA000800, (UINT32)~(0xCF030000), 0xCF030000 },
+ { 0xEA000A00, (UINT32)~(0xCF030000), 0xCF030000 },
+ { 0xEA002428, (UINT32)~(0xFF1F0000), 0x580E0000 },
+ { 0xEA002628, (UINT32)~(0xFF1F0000), 0x580E0000 },
+ { 0xEA000828, (UINT32)~(0xFF1F0000), 0x580E0000 },
+ { 0xEA000A28, (UINT32)~(0xFF1F0000), 0x580E0000 },
+ { 0xEA00241C, (UINT32)~(0x00007C00), 0x00002400 },
+ { 0xEA00261C, (UINT32)~(0x00007C00), 0x00002400 },
+ { 0xEA00081C, (UINT32)~(0x00007C00), 0x00002400 },
+ { 0xEA000A1C, (UINT32)~(0x00007C00), 0x00002400 },
+ { 0xEA00248C, (UINT32)~(0x00FF0000), 0x00800000 },
+ { 0xEA00268C, (UINT32)~(0x00FF0000), 0x00800000 },
+ { 0xEA00088C, (UINT32)~(0x00FF0000), 0x00800000 },
+ { 0xEA000A8C, (UINT32)~(0x00FF0000), 0x00800000 },
+ { 0xEA0024A4, (UINT32)~(0x0030FF00), 0x00308300 },
+ { 0xEA0026A4, (UINT32)~(0x0030FF00), 0x00308300 },
+ { 0xEA0008A4, (UINT32)~(0x0030FF00), 0x00308300 },
+ { 0xEA000AA4, (UINT32)~(0x0030FF00), 0x00308300 },
+ { 0xEA0024AC, (UINT32)~(0x00000030), 0x00000020 },
+ { 0xEA0026AC, (UINT32)~(0x00000030), 0x00000020 },
+ { 0xEA0008AC, (UINT32)~(0x00000030), 0x00000020 },
+ { 0xEA000AAC, (UINT32)~(0x00000030), 0x00000020 },
+ { 0xEA002540, (UINT32)~(0x00FFFFFF), 0x00140718 },
+ { 0xEA002740, (UINT32)~(0x00FFFFFF), 0x00140718 },
+ { 0xEA000940, (UINT32)~(0x00FFFFFF), 0x00140718 },
+ { 0xEA000B40, (UINT32)~(0x00FFFFFF), 0x00140718 },
+ { 0xEA002544, (UINT32)~(0x00FFFFFF), 0x00140998 },
+ { 0xEA002744, (UINT32)~(0x00FFFFFF), 0x00140998 },
+ { 0xEA000944, (UINT32)~(0x00FFFFFF), 0x00140998 },
+ { 0xEA000B44, (UINT32)~(0x00FFFFFF), 0x00140998 },
+ { 0xEA002548, (UINT32)~(0x00FFFFFF), 0x00140998 },
+ { 0xEA002748, (UINT32)~(0x00FFFFFF), 0x00140998 },
+ { 0xEA000948, (UINT32)~(0x00FFFFFF), 0x00140998 },
+ { 0xEA000B48, (UINT32)~(0x00FFFFFF), 0x00140998 },
+ { 0xEA00257C, (UINT32)~(0x03000000), 0x03000000 },
+ { 0xEA00277C, (UINT32)~(0x03000000), 0x03000000 },
+ { 0xEA00097C, (UINT32)~(0x03000000), 0x03000000 },
+ { 0xEA000B7C, (UINT32)~(0x03000000), 0x03000000 },
+ { 0xEA002578, (UINT32)~(0x00001F00), 0x00001800 },
+ { 0xEA002778, (UINT32)~(0x00001F00), 0x00001800 },
+ { 0xEA000978, (UINT32)~(0x00001F00), 0x00001800 },
+ { 0xEA000B78, (UINT32)~(0x00001F00), 0x00001800 },
+ { 0xEA00250C, (UINT32)~(0x0038000F), 0x00000005 },
+ { 0xEA00270C, (UINT32)~(0x0038000F), 0x00000005 },
+ { 0xEA00090C, (UINT32)~(0x0038000F), 0x00000005 },
+ { 0xEA000B0C, (UINT32)~(0x0038000F), 0x00000005 }
+};
+
+IOBP_MMIO_TABLE_STRUCT PchUsb3SharedHsioLptH_Cx[] = {
+ { 0xE9002C2C, (UINT32)~(0x00000700), 0x00000100 },
+ { 0xE9002E2C, (UINT32)~(0x00000700), 0x00000100 },
+ { 0xE9002DCC, (UINT32)~(0x00001407), 0x00001407 },
+ { 0xE9002FCC, (UINT32)~(0x00001407), 0x00001407 },
+ { 0xE9002D68, (UINT32)~(0x01000F3C), 0x00000A28 },
+ { 0xE9002F68, (UINT32)~(0x01000F3C), 0x00000A28 },
+ { 0xE9002D6C, (UINT32)~(0x000000FF), 0x0000003F },
+ { 0xE9002F6C, (UINT32)~(0x000000FF), 0x0000003F },
+ { 0xE9002D4C, (UINT32)~(0x00FFFF00), 0x00120500 },
+ { 0xE9002F4C, (UINT32)~(0x00FFFF00), 0x00120500 },
+ { 0xE9002D14, (UINT32)~(0x38000700), 0x00000100 },
+ { 0xE9002F14, (UINT32)~(0x38000700), 0x00000100 },
+ { 0xE9002D64, (UINT32)~(0x0000F000), 0x00005000 },
+ { 0xE9002F64, (UINT32)~(0x0000F000), 0x00005000 },
+ { 0xE9002D70, (UINT32)~(0x00000018), 0x00000000 },
+ { 0xE9002F70, (UINT32)~(0x00000018), 0x00000000 },
+ { 0xE9002C38, (UINT32)~(0x3F00000F), 0x0700000B },
+ { 0xE9002E38, (UINT32)~(0x3F00000F), 0x0700000B },
+ { 0xE9002D40, (UINT32)~(0x00800000), 0x00000000 },
+ { 0xE9002F40, (UINT32)~(0x00800000), 0x00000000 }
+};
+
+IOBP_MMIO_TABLE_STRUCT PchUsb3HsioLptH_Cx[] = {
+ { 0xE90031CC, (UINT32)~(0x00001407), 0x00001407 },
+ { 0xE90033CC, (UINT32)~(0x00001407), 0x00001407 },
+ { 0xE90015CC, (UINT32)~(0x00001407), 0x00001407 },
+ { 0xE90017CC, (UINT32)~(0x00001407), 0x00001407 },
+ { 0xE9003168, (UINT32)~(0x01000F3C), 0x00000A28 },
+ { 0xE9003368, (UINT32)~(0x01000F3C), 0x00000A28 },
+ { 0xE9001568, (UINT32)~(0x01000F3C), 0x00000A28 },
+ { 0xE9001768, (UINT32)~(0x01000F3C), 0x00000A28 },
+ { 0xE900316C, (UINT32)~(0x000000FF), 0x0000003F },
+ { 0xE900336C, (UINT32)~(0x000000FF), 0x0000003F },
+ { 0xE900156C, (UINT32)~(0x000000FF), 0x0000003F },
+ { 0xE900176C, (UINT32)~(0x000000FF), 0x0000003F },
+ { 0xE900314C, (UINT32)~(0x00FFFF00), 0x00120500 },
+ { 0xE900334C, (UINT32)~(0x00FFFF00), 0x00120500 },
+ { 0xE900154C, (UINT32)~(0x00FFFF00), 0x00120500 },
+ { 0xE900174C, (UINT32)~(0x00FFFF00), 0x00120500 },
+ { 0xE9003114, (UINT32)~(0x38000700), 0x00000100 },
+ { 0xE9003314, (UINT32)~(0x38000700), 0x00000100 },
+ { 0xE9001514, (UINT32)~(0x38000700), 0x00000100 },
+ { 0xE9001714, (UINT32)~(0x38000700), 0x00000100 },
+ { 0xE9003164, (UINT32)~(0x0000F000), 0x00005000 },
+ { 0xE9003364, (UINT32)~(0x0000F000), 0x00005000 },
+ { 0xE9001564, (UINT32)~(0x0000F000), 0x00005000 },
+ { 0xE9001764, (UINT32)~(0x0000F000), 0x00005000 },
+ { 0xE9003170, (UINT32)~(0x00000018), 0x00000000 },
+ { 0xE9003370, (UINT32)~(0x00000018), 0x00000000 },
+ { 0xE9001570, (UINT32)~(0x00000018), 0x00000000 },
+ { 0xE9001770, (UINT32)~(0x00000018), 0x00000000 },
+ { 0xE9003038, (UINT32)~(0x3F00000F), 0x0700000B },
+ { 0xE9003238, (UINT32)~(0x3F00000F), 0x0700000B },
+ { 0xE9001438, (UINT32)~(0x3F00000F), 0x0700000B },
+ { 0xE9001638, (UINT32)~(0x3F00000F), 0x0700000B },
+ { 0xE9003140, (UINT32)~(0x00800000), 0x00000000 },
+ { 0xE9003340, (UINT32)~(0x00800000), 0x00000000 },
+ { 0xE9001540, (UINT32)~(0x00800000), 0x00000000 },
+ { 0xE9001740, (UINT32)~(0x00800000), 0x00000000 }
+};
+
+IOBP_MMIO_TABLE_STRUCT PchGbeSharedHsioLptH_Cx[] = {
+ { 0xE9002E08, (UINT32)~(0xF0000100), 0xE0000100 },
+ { 0xE9002C08, (UINT32)~(0xF0000100), 0xE0000100 },
+ { 0xE9002A08, (UINT32)~(0xF0000100), 0xE0000100 },
+ { 0xE9002808, (UINT32)~(0xF0000100), 0xE0000100 },
+ { 0xE9002608, (UINT32)~(0xF0000100), 0xE0000100 },
+ { 0xE9002408, (UINT32)~(0xF0000100), 0xE0000100 },
+ { 0xE9002208, (UINT32)~(0xF0000100), 0xE0000100 },
+ { 0xE9002008, (UINT32)~(0xF0000100), 0xE0000100 }
+};
+
+IOBP_MMIO_TABLE_STRUCT PchSataSharedHsioLptH_MB_Cx[] = {
+ { 0xEA002090, (UINT32)~(0x0000FFFF), 0x00004C5A },
+ { 0xEA002290, (UINT32)~(0x0000FFFF), 0x00004C5A }
+};
+
+IOBP_MMIO_TABLE_STRUCT PchSataHsioLptH_MB_Cx[] = {
+ { 0xEA002490, (UINT32)~(0x0000FFFF), 0x00004C5A },
+ { 0xEA002690, (UINT32)~(0x0000FFFF), 0x00004C5A },
+ { 0xEA000890, (UINT32)~(0x0000FFFF), 0x00004C5A },
+ { 0xEA000A90, (UINT32)~(0x0000FFFF), 0x00004C5A }
+};
+
+IOBP_MMIO_TABLE_STRUCT PchSataSharedHsioLptH_DT_Cx[] = {
+ { 0xEA002090, (UINT32)~(0x0000FFFF), 0x00003E67 },
+ { 0xEA002290, (UINT32)~(0x0000FFFF), 0x00003E67 }
+};
+
+IOBP_MMIO_TABLE_STRUCT PchSataHsioLptH_DT_Cx[] = {
+ { 0xEA002490, (UINT32)~(0x0000FFFF), 0x00003E67 },
+ { 0xEA002690, (UINT32)~(0x0000FFFF), 0x00003E67 },
+ { 0xEA000890, (UINT32)~(0x0000FFFF), 0x00003E67 },
+ { 0xEA000A90, (UINT32)~(0x0000FFFF), 0x00003E67 }
+};
+
+IOBP_SATA_RXEQ_TABLE PchSataRxEqSharedHsioLptH_Cx[] = {
+ { 0x0400, 0xEA002154, (UINT32)~(0x00003F00) },
+ { 0x0400, 0xEA002158, (UINT32)~(0x0000003F) },
+ { 0x0500, 0xEA002354, (UINT32)~(0x00003F00) },
+ { 0x0500, 0xEA002358, (UINT32)~(0x0000003F) },
+ { 0x0401, 0xEA002154, (UINT32)~(0x3F00003F) },
+ { 0x0501, 0xEA002354, (UINT32)~(0x3F00003F) },
+ { 0x0402, 0xEA002150, (UINT32)~(0x3F000000) },
+ { 0x0402, 0xEA002154, (UINT32)~(0x003F0000) },
+ { 0x0502, 0xEA002350, (UINT32)~(0x3F000000) },
+ { 0x0502, 0xEA002354, (UINT32)~(0x003F0000) }
+};
+
+IOBP_SATA_RXEQ_TABLE PchSataRxEqHsioLptH_Cx[] = {
+ { 0x0000, 0xEA002554, (UINT32)~(0x00003F00) },
+ { 0x0000, 0xEA002558, (UINT32)~(0x0000003F) },
+ { 0x0100, 0xEA002754, (UINT32)~(0x00003F00) },
+ { 0x0100, 0xEA002758, (UINT32)~(0x0000003F) },
+ { 0x0200, 0xEA000954, (UINT32)~(0x00003F00) },
+ { 0x0200, 0xEA000958, (UINT32)~(0x0000003F) },
+ { 0x0300, 0xEA000B54, (UINT32)~(0x00003F00) },
+ { 0x0300, 0xEA000B58, (UINT32)~(0x0000003F) },
+ { 0x0001, 0xEA002554, (UINT32)~(0x3F00003F) },
+ { 0x0101, 0xEA002754, (UINT32)~(0x3F00003F) },
+ { 0x0201, 0xEA000954, (UINT32)~(0x3F00003F) },
+ { 0x0301, 0xEA000B54, (UINT32)~(0x3F00003F) },
+ { 0x0002, 0xEA002550, (UINT32)~(0x3F000000) },
+ { 0x0002, 0xEA002554, (UINT32)~(0x003F0000) },
+ { 0x0102, 0xEA002750, (UINT32)~(0x3F000000) },
+ { 0x0102, 0xEA002754, (UINT32)~(0x003F0000) },
+ { 0x0202, 0xEA000950, (UINT32)~(0x3F000000) },
+ { 0x0202, 0xEA000954, (UINT32)~(0x003F0000) },
+ { 0x0302, 0xEA000B50, (UINT32)~(0x3F000000) },
+ { 0x0302, 0xEA000B54, (UINT32)~(0x003F0000) }
+};
+
+#endif // TRAD_FLAG
+
+
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchHsioLptHCx.h b/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchHsioLptHCx.h
new file mode 100644
index 0000000..95ebdf7
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchHsioLptHCx.h
@@ -0,0 +1,47 @@
+/** @file
+
+ Header file with all LPTHCx Hsio information
+
+@copyright
+ Copyright (c) 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+
+**/
+
+
+#ifdef TRAD_FLAG
+#ifndef _PCH_HSIO_LPTHCX_H_
+#define _PCH_HSIO_LPTHCX_H_
+
+#define PCH_LPTH_HSIO_VER_CX 0x2C
+
+extern UINT8 PchChipsetInitTableLptH_Cx[292];
+extern IOBP_MMIO_TABLE_STRUCT PchSataSharedHsioLptH_Cx[36];
+extern IOBP_MMIO_TABLE_STRUCT PchSataHsioLptH_Cx[73];
+extern IOBP_MMIO_TABLE_STRUCT PchUsb3SharedHsioLptH_Cx[20];
+extern IOBP_MMIO_TABLE_STRUCT PchUsb3HsioLptH_Cx[36];
+extern IOBP_MMIO_TABLE_STRUCT PchGbeSharedHsioLptH_Cx[8];
+extern IOBP_MMIO_TABLE_STRUCT PchSataSharedHsioLptH_MB_Cx[2];
+extern IOBP_MMIO_TABLE_STRUCT PchSataHsioLptH_MB_Cx[4];
+extern IOBP_MMIO_TABLE_STRUCT PchSataSharedHsioLptH_DT_Cx[2];
+extern IOBP_MMIO_TABLE_STRUCT PchSataHsioLptH_DT_Cx[4];
+extern IOBP_SATA_RXEQ_TABLE PchSataRxEqSharedHsioLptH_Cx[10];
+extern IOBP_SATA_RXEQ_TABLE PchSataRxEqHsioLptH_Cx[20];
+
+
+#endif //_PCH_HSIO_LPTHCX_H_
+#endif //TRAD_FLAG
+
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchHsioLptLpBx.c b/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchHsioLptLpBx.c
new file mode 100644
index 0000000..85d763b
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchHsioLptLpBx.c
@@ -0,0 +1,239 @@
+/** @file
+ Initializes all LPTLPBx Hsio structures
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+
+**/
+
+#include "PchHsio.h"
+
+#ifdef ULT_FLAG
+
+UINT8 PchChipsetInitTableLptLp_Bx[] = {
+ 0xC2, 0xFB, //U16 CRC-16
+ 0x19, 0x11, //U16 Version
+ 0x20, //U8 NumEntries;
+ // HSIO Entries
+ // Offset Value EP
+ 0x0C,0xC0, 0x09,0x37,0x22,0x07, 0xE9,
+ 0x0C,0xC0, 0x09,0x37,0x22,0x07, 0xEA,
+ 0x2C,0x82, 0x00,0x0A,0x00,0x0F, 0xE9,
+ 0x40,0xC1, 0x9C,0x05,0x88,0x00, 0xEA,
+ 0x2C,0xC0, 0x00,0x0A,0x00,0x0F, 0xEA,
+ 0x98,0xC0, 0x41,0x3B,0x20,0x1F, 0xE9,
+ 0x30,0xC0, 0x00,0x0F,0x00,0x00, 0xE9,
+ 0x98,0xC0, 0x41,0x3B,0x20,0x1F, 0xEA,
+ 0x40,0xC1, 0x9C,0x05,0x88,0x00, 0xE9,
+ 0x94,0xC0, 0x55,0x60,0x40,0x47, 0xE9,
+ 0x30,0xC0, 0x00,0x0F,0x00,0x00, 0xEA,
+ 0x78,0xC1, 0x80,0x19,0x00,0x00, 0xE9,
+ 0x94,0xC0, 0x55,0x60,0x40,0x47, 0xEA,
+ 0x78,0xC1, 0x80,0x19,0x00,0x00, 0xEA,
+ 0x88,0xC0, 0x3A,0x98,0x80,0x55, 0xE9,
+ 0x88,0xC0, 0x3A,0x98,0x80,0x55, 0xEA,
+ 0x8C,0xC0, 0x46,0x20,0x78,0x0C, 0xE9,
+ 0x8C,0xC0, 0x46,0x20,0x78,0x0C, 0xEA,
+ 0x90,0xC0, 0x55,0x51,0x3E,0x2B, 0xE9,
+ 0x90,0xC0, 0x55,0x51,0x3E,0x2B, 0xEA,
+ 0xCC,0xC1, 0x04,0x43,0x00,0x38, 0xE9,
+ 0x7C,0xC1, 0x00,0x24,0xA0,0x4E, 0xE9,
+ 0xCC,0xC1, 0x04,0x43,0x00,0x38, 0xEA,
+ 0x7C,0xC1, 0x00,0x24,0xC0,0x3E, 0xEA,
+ 0xC4,0xC1, 0x00,0x02,0x00,0x00, 0xEA,
+ 0xC4,0xC1, 0x00,0x02,0x00,0x00, 0xE9,
+ 0x08,0xC0, 0x00,0xA0,0x00,0xB0, 0xE9,
+ 0x08,0xC0, 0x00,0xA0,0x00,0xB0, 0xEA,
+ 0x44,0xC1, 0x94,0x03,0x84,0x00, 0xE9,
+ 0x44,0xC1, 0x94,0x03,0x84,0x00, 0xEA,
+ 0x0C,0xC0, 0x09,0x17,0x22,0x07, 0xE9,
+ 0x0C,0xC0, 0x09,0x17,0x22,0x07, 0xEA
+};
+
+IOBP_MMIO_TABLE_STRUCT PchUsb3HsioLptLp_Bx[] = {
+ { 0xE90021CC, (UINT32)~(0x00001407), 0x00001407 },
+ { 0xE90023CC, (UINT32)~(0x00001407), 0x00001407 },
+ { 0xE9002168, (UINT32)~(0x01000F3C), 0x00000A28 },
+ { 0xE9002368, (UINT32)~(0x01000F3C), 0x00000A28 },
+ { 0xE900216C, (UINT32)~(0x000000FF), 0x0000003F },
+ { 0xE900236C, (UINT32)~(0x000000FF), 0x0000003F },
+ { 0xE900214C, (UINT32)~(0x00FFFF00), 0x00120500 },
+ { 0xE900234C, (UINT32)~(0x00FFFF00), 0x00120500 },
+ { 0xE9002164, (UINT32)~(0x0000F000), 0x00005000 },
+ { 0xE9002364, (UINT32)~(0x0000F000), 0x00005000 },
+ { 0xE9002170, (UINT32)~(0x00000018), 0x00000000 },
+ { 0xE9002370, (UINT32)~(0x00000018), 0x00000000 },
+ { 0xE9002114, (UINT32)~(0x38000700), 0x00000100 },
+ { 0xE9002314, (UINT32)~(0x38000700), 0x00000100 },
+ { 0xE9002038, (UINT32)~(0x0000000F), 0x0000000B },
+ { 0xE9002238, (UINT32)~(0x0000000F), 0x0000000B },
+ { 0xE9002014, (UINT32)~(0x0000FE00), 0x00006600 },
+ { 0xE9002214, (UINT32)~(0x0000FE00), 0x00006600 },
+ { 0xE9002140, (UINT32)~(0x00800000), 0x00000000 },
+ { 0xE9002340, (UINT32)~(0x00800000), 0x00000000 }
+};
+
+IOBP_MMIO_TABLE_STRUCT PchUsb3SharedHsioLptLp_Bx[] = {
+ { 0xE90025CC, (UINT32)~(0x00001407), 0x00001407 },
+ { 0xE90027CC, (UINT32)~(0x00001407), 0x00001407 },
+ { 0xE9002568, (UINT32)~(0x01000F3C), 0x00000A28 },
+ { 0xE9002768, (UINT32)~(0x01000F3C), 0x00000A28 },
+ { 0xE900242C, (UINT32)~(0x00000700), 0x00000100 },
+ { 0xE900262C, (UINT32)~(0x00000700), 0x00000100 },
+ { 0xE900256C, (UINT32)~(0x000000FF), 0x0000003F },
+ { 0xE900276C, (UINT32)~(0x000000FF), 0x0000003F },
+ { 0xE900254C, (UINT32)~(0x00FFFF00), 0x00120500 },
+ { 0xE900274C, (UINT32)~(0x00FFFF00), 0x00120500 },
+ { 0xE9002564, (UINT32)~(0x0000F000), 0x00005000 },
+ { 0xE9002764, (UINT32)~(0x0000F000), 0x00005000 },
+ { 0xE9002570, (UINT32)~(0x00000018), 0x00000000 },
+ { 0xE9002770, (UINT32)~(0x00000018), 0x00000000 },
+ { 0xE9002514, (UINT32)~(0x38000700), 0x00000100 },
+ { 0xE9002714, (UINT32)~(0x38000700), 0x00000100 },
+ { 0xE9002438, (UINT32)~(0x0000000F), 0x0000000B },
+ { 0xE9002638, (UINT32)~(0x0000000F), 0x0000000B },
+ { 0xE9002414, (UINT32)~(0x0000FE00), 0x00006600 },
+ { 0xE9002614, (UINT32)~(0x0000FE00), 0x00006600 },
+ { 0xE9002540, (UINT32)~(0x00800000), 0x00000000 },
+ { 0xE9002740, (UINT32)~(0x00800000), 0x00000000 }
+};
+
+IOBP_MMIO_TABLE_STRUCT PchSataSharedHsioLptLp_Bx[] = {
+ { 0xEA008008, (UINT32)~(0xFF000000), 0x1C000000 },
+ { 0xEA002008, (UINT32)~(0xFFFC6108), 0xEA6C6108 },
+ { 0xEA002208, (UINT32)~(0xFFFC6108), 0xEA6C6108 },
+ { 0xEA002408, (UINT32)~(0xFFFC6108), 0xEA6C6108 },
+ { 0xEA002608, (UINT32)~(0xFFFC6108), 0xEA6C6108 },
+ { 0xEA002038, (UINT32)~(0x0000000F), 0x0000000D },
+ { 0xEA002238, (UINT32)~(0x0000000F), 0x0000000D },
+ { 0xEA002438, (UINT32)~(0x0000000F), 0x0000000D },
+ { 0xEA002638, (UINT32)~(0x0000000F), 0x0000000D },
+ { 0xEA00202C, (UINT32)~(0x00020F00), 0x00020100 },
+ { 0xEA00222C, (UINT32)~(0x00020F00), 0x00020100 },
+ { 0xEA00242C, (UINT32)~(0x00020F00), 0x00020100 },
+ { 0xEA00262C, (UINT32)~(0x00020F00), 0x00020100 },
+ { 0xEA002040, (UINT32)~(0x1F000000), 0x01000000 },
+ { 0xEA002240, (UINT32)~(0x1F000000), 0x01000000 },
+ { 0xEA002440, (UINT32)~(0x1F000000), 0x01000000 },
+ { 0xEA002640, (UINT32)~(0x1F000000), 0x01000000 },
+ { 0xEA002010, (UINT32)~(0xFFFF0000), 0x55510000 },
+ { 0xEA002210, (UINT32)~(0xFFFF0000), 0x55510000 },
+ { 0xEA002410, (UINT32)~(0xFFFF0000), 0x55510000 },
+ { 0xEA002610, (UINT32)~(0xFFFF0000), 0x55510000 },
+ { 0xEA002140, (UINT32)~(0x00FFFFFF), 0x00140718 },
+ { 0xEA002340, (UINT32)~(0x00FFFFFF), 0x00140718 },
+ { 0xEA002540, (UINT32)~(0x00FFFFFF), 0x00140718 },
+ { 0xEA002740, (UINT32)~(0x00FFFFFF), 0x00140718 },
+ { 0xEA002144, (UINT32)~(0x00FFFFFF), 0x00140998 },
+ { 0xEA002344, (UINT32)~(0x00FFFFFF), 0x00140998 },
+ { 0xEA002544, (UINT32)~(0x00FFFFFF), 0x00140998 },
+ { 0xEA002744, (UINT32)~(0x00FFFFFF), 0x00140998 },
+ { 0xEA002148, (UINT32)~(0x00FFFFFF), 0x00140998 },
+ { 0xEA002348, (UINT32)~(0x00FFFFFF), 0x00140998 },
+ { 0xEA002548, (UINT32)~(0x00FFFFFF), 0x00140998 },
+ { 0xEA002748, (UINT32)~(0x00FFFFFF), 0x00140998 },
+ { 0xEA00217C, (UINT32)~(0x03000000), 0x03000000 },
+ { 0xEA00237C, (UINT32)~(0x03000000), 0x03000000 },
+ { 0xEA00257C, (UINT32)~(0x03000000), 0x03000000 },
+ { 0xEA00277C, (UINT32)~(0x03000000), 0x03000000 },
+ { 0xEA00208C, (UINT32)~(0x00FF0000), 0x00800000 },
+ { 0xEA00228C, (UINT32)~(0x00FF0000), 0x00800000 },
+ { 0xEA00248C, (UINT32)~(0x00FF0000), 0x00800000 },
+ { 0xEA00268C, (UINT32)~(0x00FF0000), 0x00800000 },
+ { 0xEA0020A4, (UINT32)~(0x0030FF00), 0x00308300 },
+ { 0xEA0022A4, (UINT32)~(0x0030FF00), 0x00308300 },
+ { 0xEA0024A4, (UINT32)~(0x0030FF00), 0x00308300 },
+ { 0xEA0026A4, (UINT32)~(0x0030FF00), 0x00308300 },
+ { 0xEA0020AC, (UINT32)~(0x00000030), 0x00000020 },
+ { 0xEA0022AC, (UINT32)~(0x00000030), 0x00000020 },
+ { 0xEA0024AC, (UINT32)~(0x00000030), 0x00000020 },
+ { 0xEA0026AC, (UINT32)~(0x00000030), 0x00000020 },
+ { 0xEA002018, (UINT32)~(0xFFFF0300), 0x38250100 },
+ { 0xEA002218, (UINT32)~(0xFFFF0300), 0x38250100 },
+ { 0xEA002418, (UINT32)~(0xFFFF0300), 0x38250100 },
+ { 0xEA002618, (UINT32)~(0xFFFF0300), 0x38250100 },
+ { 0xEA002000, (UINT32)~(0xCF030000), 0xCF030000 },
+ { 0xEA002200, (UINT32)~(0xCF030000), 0xCF030000 },
+ { 0xEA002400, (UINT32)~(0xCF030000), 0xCF030000 },
+ { 0xEA002600, (UINT32)~(0xCF030000), 0xCF030000 },
+ { 0xEA002028, (UINT32)~(0xFF1F0000), 0x580E0000 },
+ { 0xEA002228, (UINT32)~(0xFF1F0000), 0x580E0000 },
+ { 0xEA002428, (UINT32)~(0xFF1F0000), 0x580E0000 },
+ { 0xEA002628, (UINT32)~(0xFF1F0000), 0x580E0000 },
+ { 0xEA00201C, (UINT32)~(0x00007C00), 0x00002400 },
+ { 0xEA00221C, (UINT32)~(0x00007C00), 0x00002400 },
+ { 0xEA00241C, (UINT32)~(0x00007C00), 0x00002400 },
+ { 0xEA00261C, (UINT32)~(0x00007C00), 0x00002400 },
+ { 0xEA002178, (UINT32)~(0x00001F00), 0x00001800 },
+ { 0xEA002378, (UINT32)~(0x00001F00), 0x00001800 },
+ { 0xEA002578, (UINT32)~(0x00001F00), 0x00001800 },
+ { 0xEA002778, (UINT32)~(0x00001F00), 0x00001800 },
+ { 0xEA00210C, (UINT32)~(0x0038000F), 0x00000005 },
+ { 0xEA00230C, (UINT32)~(0x0038000F), 0x00000005 },
+ { 0xEA00250C, (UINT32)~(0x0038000F), 0x00000005 },
+ { 0xEA00270C, (UINT32)~(0x0038000F), 0x00000005 }
+};
+
+IOBP_MMIO_TABLE_STRUCT PchGbeSharedHsioLptLp_Bx[] = {
+ { 0xE9000808, (UINT32)~(0xF0000100), 0xE0000100 },
+ { 0xE9000A08, (UINT32)~(0xF0000100), 0xE0000100 },
+ { 0xE9000C08, (UINT32)~(0xF0000100), 0xE0000100 },
+ { 0xE9000E08, (UINT32)~(0xF0000100), 0xE0000100 },
+ { 0xE9001008, (UINT32)~(0xF0000100), 0xE0000100 },
+ { 0xE9001208, (UINT32)~(0xF0000100), 0xE0000100 }
+};
+
+IOBP_MMIO_TABLE_STRUCT PchSataSharedHsioLptLp_MB_Bx[] = {
+ { 0xEA002090, (UINT32)~(0x0000FFFF), 0x00004C5A },
+ { 0xEA002290, (UINT32)~(0x0000FFFF), 0x00004C5A },
+ { 0xEA002490, (UINT32)~(0x0000FFFF), 0x00004C5A },
+ { 0xEA002690, (UINT32)~(0x0000FFFF), 0x00004C5A }
+};
+
+IOBP_MMIO_TABLE_STRUCT PchSataSharedHsioLptLp_DT_Bx[] = {
+ { 0xEA002090, (UINT32)~(0x0000FFFF), 0x00003E67 },
+ { 0xEA002290, (UINT32)~(0x0000FFFF), 0x00003E67 },
+ { 0xEA002490, (UINT32)~(0x0000FFFF), 0x00003E67 },
+ { 0xEA002690, (UINT32)~(0x0000FFFF), 0x00003E67 }
+};
+
+IOBP_SATA_RXEQ_TABLE PchSataRxEqSharedHsioLptLp_Bx[] = {
+ { 0x0300, 0xEA002154, (UINT32)~(0x00003F00) },
+ { 0x0300, 0xEA002158, (UINT32)~(0x0000003F) },
+ { 0x0200, 0xEA002354, (UINT32)~(0x00003F00) },
+ { 0x0200, 0xEA002358, (UINT32)~(0x0000003F) },
+ { 0x0100, 0xEA002554, (UINT32)~(0x00003F00) },
+ { 0x0100, 0xEA002558, (UINT32)~(0x0000003F) },
+ { 0x0000, 0xEA002754, (UINT32)~(0x00003F00) },
+ { 0x0000, 0xEA002758, (UINT32)~(0x0000003F) },
+ { 0x0301, 0xEA002154, (UINT32)~(0x3F00003F) },
+ { 0x0201, 0xEA002354, (UINT32)~(0x3F00003F) },
+ { 0x0101, 0xEA002554, (UINT32)~(0x3F00003F) },
+ { 0x0001, 0xEA002754, (UINT32)~(0x3F00003F) },
+ { 0x0302, 0xEA002150, (UINT32)~(0x3F000000) },
+ { 0x0302, 0xEA002154, (UINT32)~(0x003F0000) },
+ { 0x0202, 0xEA002350, (UINT32)~(0x3F000000) },
+ { 0x0202, 0xEA002354, (UINT32)~(0x003F0000) },
+ { 0x0102, 0xEA002550, (UINT32)~(0x3F000000) },
+ { 0x0102, 0xEA002554, (UINT32)~(0x003F0000) },
+ { 0x0002, 0xEA002750, (UINT32)~(0x3F000000) },
+ { 0x0002, 0xEA002754, (UINT32)~(0x003F0000) }
+};
+
+#endif // ULT_FLAG
+
+
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchHsioLptLpBx.h b/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchHsioLptLpBx.h
new file mode 100644
index 0000000..d46962a
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchHsioLptLpBx.h
@@ -0,0 +1,42 @@
+/** @file
+
+ Header file with all LPTLPBx Hsio information
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+
+**/
+
+
+#ifdef ULT_FLAG
+#ifndef _PCH_HSIO_LPTLPBX_H_
+#define _PCH_HSIO_LPTLPBX_H_
+
+#define PCH_LPTLP_HSIO_VER_BX 0x19
+
+extern UINT8 PchChipsetInitTableLptLp_Bx[229];
+extern IOBP_MMIO_TABLE_STRUCT PchUsb3HsioLptLp_Bx[20];
+extern IOBP_MMIO_TABLE_STRUCT PchUsb3SharedHsioLptLp_Bx[22];
+extern IOBP_MMIO_TABLE_STRUCT PchSataSharedHsioLptLp_Bx[73];
+extern IOBP_MMIO_TABLE_STRUCT PchGbeSharedHsioLptLp_Bx[6];
+extern IOBP_MMIO_TABLE_STRUCT PchSataSharedHsioLptLp_MB_Bx[4];
+extern IOBP_MMIO_TABLE_STRUCT PchSataSharedHsioLptLp_DT_Bx[4];
+extern IOBP_SATA_RXEQ_TABLE PchSataRxEqSharedHsioLptLp_Bx[20];
+
+#endif //_PCH_HSIO_LPTLPBX_H_
+#endif //ULT_FLAG
+
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchInitVar.c b/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchInitVar.c
new file mode 100644
index 0000000..5bd895a
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchInitVar.c
@@ -0,0 +1,31 @@
+/** @file
+ This file defines variable shared between PCH Init DXE driver and PCH
+ Init S3 Resume PEIM.
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+///
+/// Include the protocol header file
+///
+#include "PchInitVar.h"
+
+///
+/// Protocol GUID definition
+///
+EFI_GUID gPchInitPeiVariableGuid = PCH_INIT_PEI_VARIABLE_GUID;
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchInitVar.h b/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchInitVar.h
new file mode 100644
index 0000000..7bd461b
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchInitVar.h
@@ -0,0 +1,65 @@
+/** @file
+ This file defines variable shared between PCH Init DXE driver and PCH
+ Init S3 Resume PEIM.
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+#ifndef _PCH_INIT_VAR_H_
+#define _PCH_INIT_VAR_H_
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueBase.h"
+#endif
+///
+/// Define the PCH Init Var GUID
+///
+///
+/// EDK and EDKII have different GUID formats
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#define PCH_INIT_PEI_VARIABLE_GUID \
+ { \
+ 0xa31b27a4, 0xcae6, 0x48ff, 0x8c, 0x5a, 0x29, 0x42, 0x21, 0xe6, 0xf3, 0x89 \
+ }
+#else
+#define PCH_INIT_PEI_VARIABLE_GUID \
+ { \
+ 0xa31b27a4, 0xcae6, 0x48ff, \
+ { \
+ 0x8c, 0x5a, 0x29, 0x42, 0x21, 0xe6, 0xf3, 0x89 \
+ } \
+ }
+#endif
+///
+/// Extern the GUID for PPI users.
+///
+extern EFI_GUID gPchInitPeiVariableGuid;
+
+#define PCH_INIT_PEI_VARIABLE_NAME L"PchInitPei"
+
+///
+/// Define the Pch Init Variable structure
+///
+
+typedef struct _PCH_LATE_INIT_SMM_VARIABLE {
+ UINT16 IoTrapAddress;
+ UINT32 PciMemBase;
+} PCH_LATE_INIT_SMM_VARIABLE;
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchUsbCommon.c b/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchUsbCommon.c
new file mode 100644
index 0000000..e53d783
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchUsbCommon.c
@@ -0,0 +1,3032 @@
+/** @file
+ Initializes PCH USB Controllers.
+
+@copyright
+ Copyright (c) 2009 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "PchUsbCommon.h"
+#include "Token.h"
+
+const USB_CONTROLLER EhciControllersMap[PchEhciControllerMax] = {
+ {
+ PCI_DEVICE_NUMBER_PCH_USB,
+ PCI_FUNCTION_NUMBER_PCH_EHCI
+ },
+ {
+ PCI_DEVICE_NUMBER_PCH_USB_EXT,
+ PCI_FUNCTION_NUMBER_PCH_EHCI2
+ }
+};
+
+UINTN PCH_H_PORTSCxUSB2[] = {
+ R_PCH_XHCI_PORTSC01USB2,
+ R_PCH_XHCI_PORTSC02USB2,
+ R_PCH_XHCI_PORTSC03USB2,
+ R_PCH_XHCI_PORTSC04USB2,
+ R_PCH_XHCI_PORTSC05USB2,
+ R_PCH_XHCI_PORTSC06USB2,
+ R_PCH_XHCI_PORTSC07USB2,
+ R_PCH_XHCI_PORTSC08USB2,
+ R_PCH_XHCI_PORTSC09USB2,
+ R_PCH_H_XHCI_PORTSC10USB2,
+ R_PCH_H_XHCI_PORTSC11USB2,
+ R_PCH_H_XHCI_PORTSC12USB2,
+ R_PCH_H_XHCI_PORTSC13USB2,
+ R_PCH_H_XHCI_PORTSC14USB2,
+ R_PCH_H_XHCI_PORTSC15USB2
+};
+
+UINTN PCH_LP_PORTSCxUSB2[] = {
+ R_PCH_XHCI_PORTSC01USB2,
+ R_PCH_XHCI_PORTSC02USB2,
+ R_PCH_XHCI_PORTSC03USB2,
+ R_PCH_XHCI_PORTSC04USB2,
+ R_PCH_XHCI_PORTSC05USB2,
+ R_PCH_XHCI_PORTSC06USB2,
+ R_PCH_XHCI_PORTSC07USB2,
+ R_PCH_XHCI_PORTSC08USB2,
+ R_PCH_XHCI_PORTSC09USB2
+};
+
+UINTN PCH_H_PORTSCxUSB3[] = {
+ R_PCH_H_XHCI_PORTSC1USB3,
+ R_PCH_H_XHCI_PORTSC2USB3,
+ R_PCH_H_XHCI_PORTSC3USB3,
+ R_PCH_H_XHCI_PORTSC4USB3,
+ R_PCH_H_XHCI_PORTSC5USB3,
+ R_PCH_H_XHCI_PORTSC6USB3
+};
+
+UINTN PCH_LP_PORTSCxUSB3[] = {
+ R_PCH_LP_XHCI_PORTSC1USB3,
+ R_PCH_LP_XHCI_PORTSC2USB3,
+ R_PCH_LP_XHCI_PORTSC3USB3,
+ R_PCH_LP_XHCI_PORTSC4USB3
+};
+
+///
+/// Table: USB2 Pins Mapping between XHCI/EHCI Port
+/// -------------------------------------------
+/// | USB2 Pin | EHCI Port | XHCI Port |
+/// |--------------+----------------+-----------|
+/// | USB[P,N][0] | EHCI 1 Port 0 | Port 0 |
+/// | USB[P,N][1] | EHCI 1 Port 1 | Port 1 |
+/// | USB[P,N][2] | EHCI 1 Port 2 | Port 2 |
+/// | USB[P,N][3] | EHCI 1 Port 3 | Port 3 |
+/// | USB[P,N][4] | EHCI 1 Port 4 | Port 8 |
+/// | USB[P,N][5] | EHCI 1 Port 5 | Port 9 |
+/// | USB[P,N][6] | EHCI 1 Port 6 | Port 12 |
+/// | USB[P,N][7] | EHCI 1 Port 7 | Port 13 |
+/// | USB[P,N][8] | EHCI 2 Port 8 | Port 4 |
+/// | USB[P,N][9] | EHCI 2 Port 9 | Port 5 |
+/// | USB[P,N][10] | EHCI 2 Port 10 | Port 6 |
+/// | USB[P,N][11] | EHCI 2 Port 11 | Port 7 |
+/// | USB[P,N][12] | EHCI 2 Port 12 | Port 10 |
+/// | USB[P,N][13] | EHCI 2 Port 13 | Port 11 |
+/// -------------------------------------------
+///
+const UINT32 XhciUsb2InternalPortNumberLookUpTable[] = {
+ 0,1,2,3,8,9,12,13,4,5,6,7,10,11,12,13
+};
+
+/**
+ Configures PCH USB controller
+
+ @param[in] UsbConfig The PCH Platform Policy for USB configuration
+ @param[in] EhciMmioBase Memory base address of EHCI Controller
+ @param[in] XhciMmioBase Memory base address of XHCI Controller
+ @param[in] BusNumber PCI Bus Number of the PCH device
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+ @param[out] FuncDisableReg Function Disable Register
+ @param[in] Revision The policy revision used for backward compatible check
+
+ @retval EFI_INVALID_PARAMETER The parameter of PchPlatformPolicy is invalid
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+EFIAPI
+CommonUsbInit (
+ IN PCH_USB_CONFIG *UsbConfig,
+ IN UINT32 EhciMmioBase,
+ IN UINT32 XhciMmioBase,
+ IN UINT8 BusNumber,
+ IN UINT32 RootComplexBar,
+ OUT UINT32 *FuncDisableReg,
+ IN UINT8 Revision
+ )
+{
+ UINTN PciD31F0RegBase;
+ UINTN XhciPciMmBase;
+ UINTN Ehci1PciMmBase;
+ UINTN Ehci2PciMmBase;
+ UINT16 LpcDeviceId;
+ UINT16 PmBase;
+ UINT16 RegData16 =0;
+ PCH_SERIES PchSeries;
+
+ DEBUG ((EFI_D_INFO, "CommonUsbInit() - Start\n"));
+
+ PchSeries = GetPchSeries();
+ PciD31F0RegBase = MmPciAddress (
+ 0,
+ BusNumber,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ 0
+ );
+ XhciPciMmBase = MmPciAddress (
+ 0,
+ BusNumber,
+ PCI_DEVICE_NUMBER_PCH_XHCI,
+ PCI_FUNCTION_NUMBER_PCH_XHCI,
+ 0
+ );
+ Ehci1PciMmBase = MmPciAddress (
+ 0,
+ BusNumber,
+ EhciControllersMap[PchEhci1].Device,
+ EhciControllersMap[PchEhci1].Function,
+ 0
+ );
+ Ehci2PciMmBase = 0;
+ if (PchSeries == PchH) {
+ Ehci2PciMmBase = MmPciAddress (
+ 0,
+ BusNumber,
+ EhciControllersMap[PchEhci2].Device,
+ EhciControllersMap[PchEhci2].Function,
+ 0
+ );
+ }
+
+ PmBase = MmioRead16 (PciD31F0RegBase + R_PCH_LPC_ACPI_BASE) & B_PCH_LPC_ACPI_BASE_BAR;
+ LpcDeviceId = MmioRead16 (PciD31F0RegBase + R_PCH_LPC_DEVICE_ID);
+ ///
+ /// Check to disable USB Controllers
+ ///
+ if (UsbConfig->Usb20Settings[PchEhci1].Enable == PCH_DEVICE_DISABLE) {
+ *FuncDisableReg |= B_PCH_RCRB_FUNC_DIS_EHCI1;
+ }
+
+ if (PchSeries == PchH) {
+ if (UsbConfig->Usb20Settings[PchEhci2].Enable == PCH_DEVICE_DISABLE) {
+ *FuncDisableReg |= B_PCH_RCRB_FUNC_DIS_EHCI2;
+ }
+ }
+
+ if (UsbConfig->Usb30Settings.Mode == PCH_XHCI_MODE_OFF) {
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, section 13.2.3 Hiding/Disabling xHCI Controller
+ /// In some instances, the System BIOS may choose to "hide" the xHCI controller. When
+ /// the xHCI device is hidden, all high speed shareable ports should be routed to the EHCI
+ /// controller to avoid the situation where USB ports are not functioning. To hide a host
+ /// controller, the BIOS must program the Function Disable register (RCBA + 3418h). See
+ /// the PCH EDS for a description of the register.
+ ///
+ *FuncDisableReg |= B_PCH_RCRB_FUNC_DIS_XHCI;
+ }
+
+ ///
+ /// Init USB Host Controllers
+ ///
+ CommonEhciHcsInit (
+ UsbConfig,
+ EhciMmioBase,
+ BusNumber,
+ Revision,
+ LpcDeviceId,
+ RootComplexBar
+ );
+
+ ///
+ /// Assign memory resources
+ ///
+ XhciMemorySpaceOpen (
+ UsbConfig,
+ XhciMmioBase,
+ XhciPciMmBase
+ );
+
+ CommonXhciHcInit (
+ UsbConfig,
+ XhciMmioBase,
+ Revision,
+ LpcDeviceId,
+ XhciPciMmBase
+ );
+
+ ///
+ /// Init Port Switching Flow
+ ///
+ PerformXhciEhciPortSwitchingFlow (
+ UsbConfig,
+ XhciMmioBase,
+ Revision,
+ LpcDeviceId,
+ XhciPciMmBase,
+ PciD31F0RegBase
+ );
+ ///
+ /// Setup USB Over-Current Mapping.
+ ///
+ EhciOverCurrentMapping (
+ UsbConfig,
+ Ehci1PciMmBase,
+ Ehci2PciMmBase
+ );
+
+ XhciOverCurrentMapping (
+ UsbConfig,
+ XhciPciMmBase
+ );
+
+ //
+ // Tune the USB 2.0 high-speed signals quality.
+ //
+ Usb2PortLengthProgramming (
+ UsbConfig,
+ LpcDeviceId,
+ RootComplexBar
+ );
+
+ ///
+ /// Support USB Per-Port Disable Control Override feature
+ ///
+#if defined OEM_USB_PER_PORT_DISABLE_SUPPORT && OEM_USB_PER_PORT_DISABLE_SUPPORT == 0
+ if (UsbConfig->UsbPerPortCtl == PCH_DEVICE_ENABLE) {
+ ///
+ /// PCH BIOS Spec Rev 0.5.0 Section 12.2 Disabling USB Ports
+ /// The PCH USB Port Disable Override Register (D26/29:F0 + 64h) can be locked by setting
+ /// the Write Enable bit of the PCH USB Per-Port Register Write Control Register,
+ /// PMBASE + 3Ch[1].
+ ///
+ /// Open the Per-Port Disable Control Override
+ ///
+ RegData16 = IoRead16 ((UINTN) ((UINT64) (PmBase + R_PCH_UPRWC)));
+ RegData16 |= B_PCH_UPRWC_WR_EN;
+ IoWrite16 ((UINTN) ((UINT64) (PmBase + R_PCH_UPRWC)), RegData16);
+#ifdef SUS_WELL_RESTORE
+ ///
+ /// To support RapidStart resume from G3 state, all resume well registers need to be saved
+ /// into S3 Script table.
+ ///
+ PCH_INIT_COMMON_SCRIPT_IO_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PmBase + R_PCH_UPRWC),
+ 1,
+ &RegData16
+ );
+#endif
+
+ EhciPortDisableOverride (
+ UsbConfig,
+ Ehci1PciMmBase,
+ Ehci2PciMmBase
+ );
+
+ XhciPortDisableOverride (
+ UsbConfig,
+ XhciPciMmBase,
+ Revision
+ );
+
+ ///
+ /// Close the Per-Port Disable Control Override
+ ///
+ RegData16 &= (~B_PCH_UPRWC_WR_EN);
+ IoWrite16 ((UINTN) ((UINT64) (PmBase + R_PCH_UPRWC)), RegData16);
+#ifdef SUS_WELL_RESTORE
+ ///
+ /// To support RapidStart resume from G3 state, all resume well registers need to be saved
+ /// into S3 Script table.
+ ///
+ PCH_INIT_COMMON_SCRIPT_IO_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PmBase + R_PCH_UPRWC),
+ 1,
+ &RegData16
+ );
+#endif
+ }
+#endif
+ ///
+ /// Support USBR feature
+ ///
+ if (UsbConfig->Ehci1Usbr == PCH_DEVICE_ENABLE &&
+ UsbConfig->Usb20Settings[PchEhci1].Enable == PCH_DEVICE_ENABLE) {
+ EhciUsbrEnable (Ehci1PciMmBase);
+ }
+ if (PchSeries == PchH) {
+ if (UsbConfig->Ehci2Usbr == PCH_DEVICE_ENABLE && UsbConfig->Usb20Settings[PchEhci2].Enable == PCH_DEVICE_ENABLE) {
+ EhciUsbrEnable (Ehci2PciMmBase);
+ }
+ }
+ ///
+ /// Clear memory resources
+ ///
+ XhciMemorySpaceClose (
+ UsbConfig,
+ XhciMmioBase,
+ XhciPciMmBase
+ );
+
+ DEBUG ((EFI_D_INFO, "CommonUsbInit() - End\n"));
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Performs basic configuration of PCH EHCI controller.
+
+ @param[in] UsbConfig The PCH Platform Policy for USB configuration
+ @param[in] EhciMmioBase Memory base address of EHCI Controller
+ @param[in] BusNumber PCI Bus Number of the PCH device
+ @param[in] Revision The policy revision used for backward compatible check
+ @param[in] LpcDeviceId The device ID of LPC
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+EFIAPI
+CommonEhciHcsInit (
+ IN PCH_USB_CONFIG *UsbConfig,
+ IN UINT32 EhciMmioBase,
+ IN UINT8 BusNumber,
+ IN UINT8 Revision,
+ IN UINT16 LpcDeviceId,
+ IN UINT32 RootComplexBar
+ )
+{
+ UINTN EhciPciMmBase;
+ UINT8 Index;
+ UINT16 PciCmd;
+ BOOLEAN SkipRst;
+ UINT32 DwordReg;
+ UINT8 NumberOfPorts;
+ EFI_STATUS Status;
+ UINT32 Data32And;
+ UINT32 Data32Or;
+ PCH_SERIES PchSeries;
+#ifndef AMI_OVERRIDE_EHCI_MMIOBASE
+ UINT32 TempMmioBase = EhciMmioBase;
+#endif
+
+ PchSeries = GetPchSeries();
+
+ for (Index = 0; Index < GetPchEhciMaxControllerNum (); Index++) {
+ EhciPciMmBase = MmPciAddress (
+ 0,
+ BusNumber,
+ EhciControllersMap[Index].Device,
+ EhciControllersMap[Index].Function,
+ 0
+ );
+
+#ifndef AMI_OVERRIDE_EHCI_MMIOBASE
+ if (EhciMmioBase != TempMmioBase)
+ EhciMmioBase = TempMmioBase;
+#endif
+ ///
+ /// Set EHCI structural parameter
+ ///
+ if (UsbConfig->Usb20Settings[Index].Enable == PCH_DEVICE_DISABLE) {
+ MmioWrite32 (EhciPciMmBase + R_PCH_EHCI_MEM_BASE, 0);
+ MmioWrite16 (EhciPciMmBase + R_PCH_EHCI_COMMAND_REGISTER, 0);
+ } else {
+ PciCmd = 0;
+ ///
+ /// Shared EHCI/XHCI ports w/a.
+ /// This step is required when some of the ports are routed to EHCI
+ /// and other ports are routed XHCI at the same time.
+ ///
+ /// Clear D26/D29:F0 + 78h [1:0]
+ ///
+ if (UsbConfig->Usb30Settings.ManualMode == PCH_DEVICE_ENABLE) {
+ MmioAnd16 (
+ (EhciPciMmBase + 0x78),
+ (UINT16) ~(BIT1 | BIT0));
+#ifdef SUS_WELL_RESTORE
+ ///
+ /// To support DeepSx and RapidStart resume from G3 state, all resume well registers
+ /// need to be saved into S3 Script table.
+ ///
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (EhciPciMmBase + 0x78),
+ 1,
+ (VOID *) (UINTN) (EhciPciMmBase + 0x78)
+ );
+#endif
+ }
+ ///
+ /// For some cases, like usb debug mode, the Ehci memory resource will have been assigned and
+ /// enabled here. If so, then set SkipRst flag to skip the steps that are for Ehci memory
+ /// resource clear and host controller reset
+ ///
+ if ((MmioRead32 (EhciPciMmBase + R_PCH_EHCI_MEM_BASE) == 0) &&
+ !(MmioRead16 (EhciPciMmBase + R_PCH_EHCI_COMMAND_REGISTER) & B_PCH_EHCI_COMMAND_MSE)) {
+ MmioWrite32 ((EhciPciMmBase + R_PCH_EHCI_MEM_BASE), EhciMmioBase);
+#ifdef SUS_WELL_RESTORE
+ ///
+ /// To support RapidStart resume from G3 state, all resume well registers need to be saved
+ /// into S3 Script table.
+ ///
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (EhciPciMmBase + R_PCH_EHCI_MEM_BASE),
+ 1,
+ (VOID *) (UINTN) (EhciPciMmBase + R_PCH_EHCI_MEM_BASE)
+ );
+#endif
+ ///
+ /// Clear SkipRst flag
+ ///
+ SkipRst = FALSE;
+ } else {
+ ///
+ /// Use the memory address of Ehci controller that has been assigned before initialization
+ /// to do the programming.
+ ///
+ EhciMmioBase = MmioRead32 (EhciPciMmBase + R_PCH_EHCI_MEM_BASE);
+ ///
+ /// Save Pci command register
+ ///
+ PciCmd = MmioRead16 (EhciPciMmBase + R_PCH_EHCI_COMMAND_REGISTER);
+ ///
+ /// Set SkipRst flag
+ ///
+ SkipRst = TRUE;
+ }
+
+ MmioOr16 (
+ (EhciPciMmBase + R_PCH_EHCI_COMMAND_REGISTER),
+ (UINT16) (B_PCH_EHCI_COMMAND_MSE | B_PCH_EHCI_COMMAND_BME)
+ );
+#ifdef SUS_WELL_RESTORE
+ ///
+ /// To support RapidStart resume from G3 state, all resume well registers need to be saved
+ /// into S3 Script table.
+ ///
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (EhciPciMmBase + R_PCH_EHCI_COMMAND_REGISTER),
+ 1,
+ (VOID *) (UINTN) (EhciPciMmBase + R_PCH_EHCI_COMMAND_REGISTER)
+ );
+#endif
+ ///
+ /// PCH BIOS Spec Rev 0.5.0 Section 12.10
+ /// Additional Programming Requirements during USB Initialization
+ ///
+ /// Step 1
+ /// Program D29/D26:MEM_BASE + 20h [1] = 1b,
+ /// This should be done before FS/LS initialitiation and also after S4/S5
+ ///
+ /// For some cases, like usb debug mode, we will skip this step, in case something will be destroyed
+ /// after doing host controller reset
+ ///
+ if (!SkipRst) {
+#ifdef USB_PRECONDITION_ENABLE_FLAG
+ ///
+ /// Reset the EHCI when running in PEI phase where USB precondition feature is enabled
+ /// or in DXE phase where USB precondition feature is disabled
+ /// If the precondition is enabled and running in DXE phase, EHCI has reset done already
+ ///
+ if (USB_RUN_IN_PEI || (!USB_PRECONDITION_POLICY_SUPPORT (UsbConfig))) {
+#endif // USB_PRECONDITION_ENABLE_FLAG
+ MmioOr16 ((EhciMmioBase + R_PCH_EHCI_USB2CMD), B_PCH_EHCI_USB2CMD_HCRESET);
+#ifdef USB_PRECONDITION_ENABLE_FLAG
+ }
+#endif // USB_PRECONDITION_ENABLE_FLAG
+ }
+ ///
+ /// Step 2
+ /// Configure number of controller and port:
+ ///
+ /// Step 2.a
+ /// Set D26/D29:F0:80h [0] = 1b
+ ///
+ MmioOr16 ((EhciPciMmBase + R_PCH_EHCI_ACCESS_CNTL), (UINT16) V_PCH_EHCI_ACCESS_CNTL_ENABLE);
+#ifdef SUS_WELL_RESTORE
+ ///
+ /// To support RapidStart resume from G3 state, all resume well registers need to be saved
+ /// into S3 Script table.
+ ///
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (EhciPciMmBase + R_PCH_EHCI_ACCESS_CNTL),
+ 1,
+ (VOID *) (UINTN) (EhciPciMmBase + R_PCH_EHCI_ACCESS_CNTL)
+ );
+#endif
+ ///
+ /// Step 2.b
+ /// Set both EHCI's N_CC bit, D26 & D29 MEM_BASE + offset 04h [15:12], to 0000b
+ ///
+ MmioBitFieldWrite32 (
+ (EhciMmioBase + R_PCH_EHCI_HCSPARAMS),
+ N_PCH_EHCI_HCSPARAMS_N_CC,
+ (N_PCH_EHCI_HCSPARAMS_N_CC + 3),
+ 0
+ );
+#ifdef SUS_WELL_RESTORE
+ ///
+ /// To support RapidStart resume from G3 state, all resume well registers need to be saved
+ /// into S3 Script table.
+ ///
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (EhciMmioBase + R_PCH_EHCI_HCSPARAMS),
+ 1,
+ (VOID *) (UINTN) (EhciMmioBase + R_PCH_EHCI_HCSPARAMS)
+ );
+#endif
+ ///
+ /// Step 2.c
+ /// Set both EHCI's N_PORTS bit, D26 & D29 MEM_BASE + offset 04h [3:0], to 2h
+ ///
+ NumberOfPorts = 2;
+ if (Index == PchEhci1) {
+ if (UsbConfig->Ehci1Usbr == PCH_DEVICE_ENABLE) {
+ NumberOfPorts = NumberOfPorts + 1;
+ }
+ } else {
+ if (PchSeries == PchH) {
+ if (Index == PchEhci2) {
+ if (UsbConfig->Ehci2Usbr == PCH_DEVICE_ENABLE) {
+ NumberOfPorts = NumberOfPorts + 1;
+ }
+ }
+ }
+ }
+ MmioBitFieldWrite32 (
+ (EhciMmioBase + R_PCH_EHCI_HCSPARAMS),
+ N_PCH_EHCI_HCSPARAMS_N_PORTS,
+ (N_PCH_EHCI_HCSPARAMS_N_PORTS + 3),
+ NumberOfPorts
+ );
+#ifdef SUS_WELL_RESTORE
+ ///
+ /// To support RapidStart resume from G3 state, all resume well registers need to be saved
+ /// into S3 Script table.
+ ///
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (EhciMmioBase + R_PCH_EHCI_HCSPARAMS),
+ 1,
+ (VOID *) (UINTN) (EhciMmioBase + R_PCH_EHCI_HCSPARAMS)
+ );
+#endif
+ ///
+ /// Step 2.d
+ /// Clear D26/D29:F0:80h [0] to 0b
+ ///
+ MmioAnd16 ((EhciPciMmBase + R_PCH_EHCI_ACCESS_CNTL), (UINT16) (~V_PCH_EHCI_ACCESS_CNTL_ENABLE));
+#ifdef SUS_WELL_RESTORE
+ ///
+ /// To support RapidStart resume from G3 state, all resume well registers need to be saved
+ /// into S3 Script table.
+ ///
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (EhciPciMmBase + R_PCH_EHCI_ACCESS_CNTL),
+ 1,
+ (VOID *) (UINTN) (EhciPciMmBase + R_PCH_EHCI_ACCESS_CNTL)
+ );
+#endif
+ ///
+ /// Step 3
+ /// Program D29/D26:F0 + 78h[2] = 1b.
+ ///
+ DwordReg = MmioRead32 (EhciPciMmBase + 0x78);
+ DwordReg |= (UINT32) (BIT2);
+ MmioWrite32 (
+ (UINTN) (EhciPciMmBase + 0x78),
+ DwordReg
+ );
+#ifdef SUS_WELL_RESTORE
+ ///
+ /// To support RapidStart resume from G3 state, all resume well registers need to be saved
+ /// into S3 Script table.
+ ///
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (EhciPciMmBase + 0x78),
+ 1,
+ (VOID *) (UINTN) (EhciPciMmBase + 0x78)
+ );
+#endif
+ ///
+ /// Step 4
+ /// Program D29/D26:F0 + 7Ch[14,7] = 1b
+ ///
+ MmioOr32 (EhciPciMmBase + 0x7C, (UINT32) BIT14 | BIT7);
+#ifdef SUS_WELL_RESTORE
+ ///
+ /// To support RapidStart resume from G3 state, all resume well registers need to be saved
+ /// into S3 Script table.
+ ///
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (EhciPciMmBase + 0x7C),
+ 1,
+ (VOID *) (UINTN) (EhciPciMmBase + 0x7C)
+ );
+#endif
+ ///
+ /// Step 5
+ /// Program D29/D26:F0 + 8Ch[11:8] = 0100b
+ /// Step 6
+ /// Program D29/D26:F0 + 8Ch[26,17] = 0b, 1b
+ ///
+ DwordReg = MmioRead32 (EhciPciMmBase + 0x8C);
+ DwordReg |= (UINT32) (BIT17 | BIT10);
+ DwordReg &= (UINT32)~(BIT26 | BIT11 | BIT9 | BIT8);
+ MmioWrite32 (
+ (UINTN) (EhciPciMmBase + 0x8C),
+ DwordReg
+ );
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (EhciPciMmBase + 0x8C),
+ 1,
+ (VOID *) (UINTN) (EhciPciMmBase + 0x8C)
+ );
+
+ if (SkipRst) {
+ ///
+ /// Restore Pci command register
+ ///
+ MmioWrite16 ((EhciPciMmBase + R_PCH_EHCI_COMMAND_REGISTER), PciCmd);
+#ifdef SUS_WELL_RESTORE
+ ///
+ /// To support RapidStart resume from G3 state, all resume well registers need to be saved
+ /// into S3 Script table.
+ ///
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (EhciPciMmBase + R_PCH_EHCI_COMMAND_REGISTER),
+ 1,
+ (VOID *) (UINTN) (EhciPciMmBase + R_PCH_EHCI_COMMAND_REGISTER)
+ );
+#endif
+ } else {
+#ifdef USB_PRECONDITION_ENABLE_FLAG
+ ///
+ /// If precondition is enabled, execute USB precondition function by each phase call
+ ///
+ if (USB_PRECONDITION_POLICY_SUPPORT (UsbConfig)) {
+ EHCI_PRECONDITION (EhciControllersMap[Index].Device, EhciMmioBase);
+ }
+#endif // USB_PRECONDITION_ENABLE_FLAG
+ ///
+ /// Clear memory resource and command register after initialization
+ ///
+ MmioAnd16 (
+ (EhciPciMmBase + R_PCH_EHCI_COMMAND_REGISTER),
+ (UINT16)~(B_PCH_EHCI_COMMAND_MSE | B_PCH_EHCI_COMMAND_BME)
+ );
+ MmioWrite32 ((EhciPciMmBase + R_PCH_EHCI_MEM_BASE), 0);
+#ifdef SUS_WELL_RESTORE
+ ///
+ /// To support RapidStart resume from G3 state, all resume well registers need to be saved
+ /// into S3 Script table.
+ ///
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (EhciPciMmBase + R_PCH_EHCI_COMMAND_REGISTER),
+ 1,
+ (VOID *) (UINTN) (EhciPciMmBase + R_PCH_EHCI_COMMAND_REGISTER)
+ );
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (EhciPciMmBase + R_PCH_EHCI_MEM_BASE),
+ 1,
+ (VOID *) (UINTN) (EhciPciMmBase + R_PCH_EHCI_MEM_BASE)
+ );
+#endif
+ }
+ }
+ }
+#ifdef USB_PRECONDITION_ENABLE_FLAG
+ ///
+ /// Execute the code if running in PEI phase when USB precondition feature is enabled
+ /// or in DXE phase when USB precondition feature disabled
+ /// If the precondition is enabled and running in DXE phase,
+ /// the code has already run once in PEI but the save S3 script need to run again in DXE phase
+ /// but only run if and only if both EHCI is not disabled
+ ///
+ if ((USB_RUN_IN_PEI || (!USB_PRECONDITION_POLICY_SUPPORT (UsbConfig))) ||
+ ((USB_RUN_IN_DXE) && ((UsbConfig->Usb20Settings[PchEhci1].Enable == PCH_DEVICE_ENABLE) ||
+ ((UsbConfig->Usb20Settings[PchEhci2].Enable == PCH_DEVICE_ENABLE) && (PchSeries == PchH)))))
+ {
+#endif // USB_PRECONDITION_ENABLE_FLAG
+ ///
+ /// PCH BIOS Spec Rev 0.5.5 Section 12.10
+ /// Additional Programming Requirements during USB Initialization
+ /// Step 7
+ /// IOBP Programming:
+ /// a) Set IOBP register 0xE5007F04 to 00004481h.
+ /// b) Set IOBP register 0xE500400F[0] + (PortNumber * 0x100) = 0b.
+ /// c) Set IOBP register 0xE5007F14[20:19] to 11b.
+ /// d) Set IOBP register 0xE5007F02[23:22] to 00b for LPT-LP
+ ///
+ /// Set IOBP register 0xE5007F04[14:13] to 10b.
+ ///
+ Data32And = 0;
+ Data32Or = 0x00004481;
+ Status = ProgramIobp (
+ RootComplexBar,
+ 0xE5007F04,
+ Data32And,
+ Data32Or
+ );
+ ASSERT_EFI_ERROR (Status);
+ Status = PCH_INIT_COMMON_SCRIPT_SAVE_IOBP_S3_ITEM (
+ RootComplexBar,
+ 0xE5007F04,
+ Data32And,
+ Data32Or
+ );
+ ASSERT_EFI_ERROR (Status);
+ for (Index = 0; Index < GetPchUsbMaxPhysicalPortNum (); Index++) {
+ ///
+ /// Set IOBP register 0xE500400F[0] + (PortNumber * 0x100) = 0b.
+ ///
+ Data32And = (UINT32)~(BIT0);
+ Data32Or = (UINT32) (0);
+ Status = ProgramIobp (
+ RootComplexBar,
+ 0xE500400F + ((Index + 1) * 0x100),
+ Data32And,
+ Data32Or
+ );
+ ASSERT_EFI_ERROR (Status);
+ Status = PCH_INIT_COMMON_SCRIPT_SAVE_IOBP_S3_ITEM (
+ RootComplexBar,
+ 0xE500400F + ((Index + 1) * 0x100),
+ Data32And,
+ Data32Or
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
+ ///
+ /// Set IOBP register 0xE5007F14[20:19] to 11b.
+ ///
+ Data32And = (UINT32)~(0);
+ Data32Or = (UINT32) (BIT20 | BIT19);
+ Status = ProgramIobp (
+ RootComplexBar,
+ 0xE5007F14,
+ Data32And,
+ Data32Or
+ );
+ ASSERT_EFI_ERROR (Status);
+ Status = PCH_INIT_COMMON_SCRIPT_SAVE_IOBP_S3_ITEM (
+ RootComplexBar,
+ 0xE5007F14,
+ Data32And,
+ Data32Or
+ );
+ ASSERT_EFI_ERROR (Status);
+ ///
+ /// Set IOBP register 0xE5007F02[23:22] to 00b for LPT-LP
+ ///
+ if (PchSeries == PchLp) {
+ Data32And = (UINT32)~(BIT23 | BIT22);
+ Data32Or = (UINT32) (0);
+ Status = ProgramIobp (
+ RootComplexBar,
+ 0xE5007F02,
+ Data32And,
+ Data32Or
+ );
+ ASSERT_EFI_ERROR (Status);
+ Status = PCH_INIT_COMMON_SCRIPT_SAVE_IOBP_S3_ITEM (
+ RootComplexBar,
+ 0xE5007F02,
+ Data32And,
+ Data32Or
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
+
+#ifdef USB_PRECONDITION_ENABLE_FLAG
+ }
+#endif // USB_PRECONDITION_ENABLE_FLAG
+ return EFI_SUCCESS;
+}
+
+/**
+ Performs basic configuration of PCH USB3 (xHCI) controller.
+
+ @param[in] UsbConfig The PCH Platform Policy for USB configuration
+ @param[in] XhciMmioBase Memory base address of xHCI Controller
+ @param[in] Revision The policy revision used for backward compatible check
+ @param[in] LpcDeviceId The device ID of LPC
+ @param[in] XhciPciMmBase XHCI PCI Base Address
+
+ @retval None
+**/
+VOID
+CommonXhciHcInit (
+ IN PCH_USB_CONFIG *UsbConfig,
+ IN UINT32 XhciMmioBase,
+ IN UINT8 Revision,
+ IN UINT16 LpcDeviceId,
+ IN UINTN XhciPciMmBase
+ )
+{
+ UINT32 Data32Or;
+ UINT32 Data32And;
+ UINT8 PchSteppingValue;
+ PCH_SERIES PchSeries;
+
+ Data32Or = 0;
+ Data32And = 0;
+ PchSeries = GetPchSeries();
+ PchSteppingValue = PchStepping();
+ ///
+ /// Check if XHCI disabled, Exit function.
+ ///
+ if (UsbConfig->Usb30Settings.Mode == PCH_XHCI_MODE_OFF) {
+ return;
+ }
+ ///
+ /// PCH BIOS Spec Rev 0.5.5, Section 13.2.1 xHCI controller setup
+ ///
+ if (PchSeries == PchH) {
+ ///
+ /// For LPT-H Only:
+ /// USB3 ports always start at offset 16 (accounting for 15 USB2 ports) regardless of the number of USB2 ports
+ /// the XHCI spec allows there to be a gap between the highest numbered USB2 port and the lowest numbered USB3 port).
+ /// So the Maxports value is dependent entirely on the number of USB3 ports, and not upon the number of USB2 ports.
+ /// So the appropriate BIOS workaround is to look at the number of USB3 ports in the FUS register - config offset E0h.
+ /// (since there are SKUs with fewer than 6 port).
+ /// * If number of SS ports = 6, maxports = 21 (15h)
+ /// * If number of SS ports = 4, maxports = 19 (13h)
+ /// * If number of SS ports = 2, maxports = 17 (11h)
+ /// * If number of SS ports = 0, maxports = 15 (0Fh)
+ ///
+ switch (MmioRead32 (XhciPciMmBase + R_PCH_XHCI_FUS) & B_PCH_XHCI_FUS_SSPRTCNT) {
+ case V_PCH_XHCI_FUS_SSPRTCNT_11B:
+ // Number of SS ports is 0, Set xHCIBAR + 04h[31:24] = 0Fh
+ Data32Or = 0x0F000000;
+ break;
+
+ case V_PCH_XHCI_FUS_SSPRTCNT_10B:
+ // Number of SS ports is 2, Set xHCIBAR + 04h[31:24] = 11h
+ Data32Or = 0x11000000;
+ break;
+
+ case V_PCH_XHCI_FUS_SSPRTCNT_01B:
+ // Number of SS ports is 4, Set xHCIBAR + 04h[31:24] = 13h
+ Data32Or = 0x13000000;
+ break;
+
+ case V_PCH_XHCI_FUS_SSPRTCNT_00B:
+ default:
+ // Number of SS ports is 6, Set xHCIBAR + 04h[31:24] = 15h
+ Data32Or = 0x15000000;
+ break;
+ }
+ MmioAndThenOr32 (
+ (XhciMmioBase + R_PCH_XHCI_HCSPARAMS1),
+ (UINT32) 0x00FFFFFF,
+ (UINT32) Data32Or
+ );
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciMmioBase + R_PCH_XHCI_HCSPARAMS1),
+ 1,
+ (VOID *) (UINTN) (XhciMmioBase + R_PCH_XHCI_HCSPARAMS1)
+ );
+ }
+ ///
+ /// Set xHCIBAR + 0Ch[7:0] = 0Ah and [31:16] = 200h
+ ///
+ MmioAndThenOr32 (
+ (XhciMmioBase + R_PCH_XHCI_HCSPARAMS3),
+ (UINT32) 0x0000FF00,
+ (UINT32) 0x0200000A
+ );
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciMmioBase + R_PCH_XHCI_HCSPARAMS3),
+ 1,
+ (VOID *) (UINTN) (XhciMmioBase + R_PCH_XHCI_HCSPARAMS3)
+ );
+ ///
+ /// Set xHCIBAR + 10h[10,9,5] to 1b, 1b, 0b
+ ///
+ MmioAndThenOr32 (
+ (XhciMmioBase + R_PCH_XHCI_HCCPARAMS),
+ (UINT32)~(BIT5),
+ (UINT32) (BIT10 | BIT9)
+ );
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciMmioBase + R_PCH_XHCI_HCCPARAMS),
+ 1,
+ (VOID *) (UINTN) (XhciMmioBase + R_PCH_XHCI_HCCPARAMS)
+ );
+ if (PchSeries == PchH) {
+ ///
+ /// For LPT-H, Set xHCIBAR + 8008h[19] to 0b
+ ///
+ MmioAnd32 (
+ (XhciMmioBase + 0x8008),
+ (UINT32)~(BIT19)
+ );
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciMmioBase + 0x8008),
+ 1,
+ (VOID *) (UINTN) (XhciMmioBase + 0x8008)
+ );
+ }
+
+ if (PchSeries == PchLp) {
+ ///
+ /// Set xHCIBAR + 8058h[16,8] to 1b, 0b
+ ///
+ MmioAndThenOr32 (
+ (XhciMmioBase + 0x8058),
+ (UINT32)~(BIT8),
+ (UINT32) (BIT16)
+ );
+ } else if (PchSeries == PchH) {
+ ///
+ /// Set xHCIBAR + 8058h[20,16,8] to 1b, 1b, 0b
+ ///
+ MmioAndThenOr32 (
+ (XhciMmioBase + 0x8058),
+ (UINT32)~(BIT8),
+ (UINT32) (BIT20 | BIT16)
+ );
+ }
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciMmioBase + 0x8058),
+ 1,
+ (VOID *) (UINTN) (XhciMmioBase + 0x8058)
+ );
+ ///
+ /// Set xHCIBAR + 8060h[25, 18] to 1b, 1b
+ ///
+ MmioOr32 (
+ (XhciMmioBase + 0x8060),
+ (UINT32) (BIT25 | BIT18)
+ );
+
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciMmioBase + 0x8060),
+ 1,
+ (VOID *) (UINTN) (XhciMmioBase + 0x8060)
+ );
+ ///
+ /// Set xHCIBAR + 8090h[14,8] to 1b, 1b
+ ///
+ MmioOr32 (XhciMmioBase + 0x8090, (UINT32) (BIT14 | BIT8));
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciMmioBase + 0x8090),
+ 1,
+ (VOID *) (UINTN) (XhciMmioBase + 0x8090)
+ );
+ ///
+ /// Set xHCIBAR + 8094h[23, 21, 14] to 1b, 1b, 1b
+ ///
+ MmioOr32 (XhciMmioBase + 0x8094, (UINT32) (BIT23 | BIT21 | BIT14));
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciMmioBase + 0x8094),
+ 1,
+ (VOID *) (UINTN) (XhciMmioBase + 0x8094)
+ );
+ ///
+ /// Set xHCIBAR + 80E0h[16, 6] to 0b, 1b
+ ///
+ MmioAndThenOr32 (
+ (XhciMmioBase + 0x80E0),
+ (UINT32)~(BIT16),
+ (UINT32) (BIT6)
+ );
+#ifdef SUS_WELL_RESTORE
+ ///
+ /// To support RapidStart resume from G3 state, all resume well registers need to be saved
+ /// into S3 Script table.
+ ///
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciMmioBase + 0x80E0),
+ 1,
+ (VOID *) (UINTN) (XhciMmioBase + 0x80E0)
+ );
+#endif // SUS_WELL_RESTORE
+ ///
+ /// Set xHCIBAR + 80ECh[14:12] to 00h
+ /// Set xHCIBAR + 80ECh[11:9] to 06h
+ ///
+ MmioAndThenOr32 (
+ (XhciMmioBase + 0x80EC),
+ (UINT32)~(BIT14 | BIT13 | BIT12 | BIT9),
+ (UINT32) (BIT11 | BIT10)
+ );
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciMmioBase + 0x80EC),
+ 1,
+ (VOID *) (UINTN) (XhciMmioBase + 0x80EC)
+ );
+ ///
+ /// Set xHCIBAR + 80F0h[20] to 0b
+ ///
+ MmioAnd32 (
+ (XhciMmioBase + 0x80F0),
+ (UINT32)~(BIT20)
+ );
+#ifdef SUS_WELL_RESTORE
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciMmioBase + 0x80F0),
+ 1,
+ (VOID *) (UINTN) (XhciMmioBase + 0x80F0)
+ );
+#endif // SUS_WELL_RESTORE
+ ///
+ /// For LPT-LP, Set xHCIBAR + 80FCh[25] to 1b (Note: In document it is written as bit 121 of 80F0h.)
+ ///
+ if (PchSeries == PchLp) {
+ MmioOr32 (XhciMmioBase + 0x80FC, (UINT32) (BIT25));
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciMmioBase + 0x80FC),
+ 1,
+ (VOID *) (UINTN) (XhciMmioBase + 0x80FC)
+ );
+ }
+ if (PchSeries == PchLp) {
+ ///
+ /// Set xHCIBAR + 8110h[20,11, 8, 2] to 1b, 1b, 0b, 0b
+ ///
+ MmioAndThenOr32 (
+ (XhciMmioBase + 0x8110),
+ (UINT32)~(BIT2 | BIT8),
+ (UINT32) (BIT20 | BIT11)
+ );
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciMmioBase + 0x8110),
+ 1,
+ (VOID *) (UINTN) (XhciMmioBase + 0x8110)
+ );
+ } else if (PchSeries == PchH) {
+ ///
+ /// Set xHCIBAR + 8110h[20,11,2] to 1b, 1b, 0b
+ ///
+ MmioAndThenOr32 (
+ (XhciMmioBase + 0x8110),
+ (UINT32)~(BIT2),
+ (UINT32) (BIT20 | BIT11)
+ );
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciMmioBase + 0x8110),
+ 1,
+ (VOID *) (UINTN) (XhciMmioBase + 0x8110)
+ );
+ }
+ ///
+ /// For LPT-H , Set xHCIBAR + 8140h[31:0] to FF03C132h
+ /// For LPT-LP, Set xHCIBAR + 8140h[31:0] to FF00F03Ch
+ ///
+ if (PchSeries == PchH) {
+ Data32And = (UINT32)~(0xFFFFFFFF);
+ Data32Or = (UINT32) (0xFF03C132);
+ MmioAndThenOr32 (
+ (XhciMmioBase + 0x8140),
+ Data32And,
+ Data32Or
+ );
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciMmioBase + 0x8140),
+ 1,
+ (VOID *) (UINTN) (XhciMmioBase + 0x8140)
+ );
+ }
+ if (PchSeries == PchLp) {
+ Data32And = (UINT32)~(0xFFFFFFFF);
+ Data32Or = (UINT32) (0xFF00F03C);
+ MmioAndThenOr32 (
+ (XhciMmioBase + 0x8140),
+ Data32And,
+ Data32Or
+ );
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciMmioBase + 0x8140),
+ 1,
+ (VOID *) (UINTN) (XhciMmioBase + 0x8140)
+ );
+ }
+
+ ///
+ /// For LPT-LP Set xHCIBAR + 8154h[21, 13] to 0b, 1b
+ /// For LPT-H Set xHCIBAR + 8154h[21, 13] to 0b, 0b
+ ///
+ if (PchSeries == PchH) {
+ Data32And = BIT21 | BIT13;
+ Data32Or = 0;
+ } else if (PchSeries == PchLp) {
+ Data32And = BIT21;
+ Data32Or = BIT13;
+ }
+ MmioAndThenOr32 (
+ (XhciMmioBase + 0x8154),
+ (UINT32)~(Data32And),
+ (UINT32) (Data32Or)
+ );
+ ///
+ /// Clear xHCIBAR + 8154h[3] to 0b
+ ///
+ MmioAnd32 (
+ (XhciMmioBase + 0x8154),
+ (UINT32)~(BIT3)
+ );
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciMmioBase + 0x8154),
+ 1,
+ (VOID *) (UINTN) (XhciMmioBase + 0x8154)
+ );
+
+ ///
+ /// For LPT-LP, Set xHCIBAR + 8164h[0,1] to 1b
+ ///
+ if (PchSeries == PchLp) {
+ MmioOr32 (XhciMmioBase + 0x8164, (UINT32) (BIT1 | BIT0));
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciMmioBase + 0x8164),
+ 1,
+ (VOID *) (UINTN) (XhciMmioBase + 0x8164)
+ );
+ }
+
+ ///
+ /// For LPT-LP, Set xHCIBAR + 8174h = 0x01400C0A
+ ///
+ if (PchSeries == PchLp) {
+ MmioWrite32 (XhciMmioBase + 0x8174, 0x01400c0a);
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciMmioBase + 0x8174),
+ 1,
+ (VOID *) (UINTN) (XhciMmioBase + 0x8174)
+ );
+ }
+ ///
+ /// For LPT-LP, Set xHCIBAR + 817Ch[31:0] to 033200A3h
+ ///
+ if (PchSeries == PchLp) {
+ Data32And = (UINT32)~(0xFFFFFFFF);
+ Data32Or = (UINT32) (0x033200A3);
+ MmioAndThenOr32 (
+ (XhciMmioBase + 0x817C),
+ Data32And,
+ Data32Or
+ );
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciMmioBase + 0x817C),
+ 1,
+ (VOID *) (UINTN) (XhciMmioBase + 0x817C)
+ );
+ }
+ ///
+ /// For LPT-LP, Set xHCIBAR + 8180h[31:0] to 00CB0028h
+ ///
+ if (PchSeries == PchLp) {
+ Data32And = (UINT32)~(0xFFFFFFFF);
+ Data32Or = (UINT32) (0x00CB0028);
+ MmioAndThenOr32 (
+ (XhciMmioBase + 0x8180),
+ Data32And,
+ Data32Or
+ );
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciMmioBase + 0x8180),
+ 1,
+ (VOID *) (UINTN) (XhciMmioBase + 0x8180)
+ );
+ }
+ ///
+ /// For LPT-LP, Set xHCIBAR + 8184h[31:0] to 0064001Eh
+ ///
+ if (PchSeries == PchLp) {
+ Data32And = (UINT32)~(0xFFFFFFFF);
+ Data32Or = (UINT32) (0x0064001E);
+ MmioAndThenOr32 (
+ (XhciMmioBase + 0x8184),
+ Data32And,
+ Data32Or
+ );
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciMmioBase + 0x8184),
+ 1,
+ (VOID *) (UINTN) (XhciMmioBase + 0x8184)
+ );
+ }
+
+ ///
+ /// Set D20:F0:44h[15,14,10,0] to 1b
+ /// Note: Only update D20:F0:44h by word since D20:F0:44h[31] is write-once bit
+ ///
+ MmioOr16 (XhciPciMmBase + 0x44, (UINT16) (BIT15 | BIT14 | BIT10 | BIT0));
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (XhciPciMmBase + 0x44),
+ 1,
+ (VOID *) (UINTN) (XhciPciMmBase + 0x44)
+ );
+
+ ///
+ /// Set D20:F0:44h[19:16] to 1111b
+ /// Note: Update D20:F0:44h by byte to 46h since D20:F0:44h[31] is write-once bit
+ ///
+ MmioOr8 (XhciPciMmBase + 0x46, (UINT8) (BIT3 | BIT2 | BIT1 | BIT0));
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (XhciPciMmBase + 0x46),
+ 1,
+ (VOID *) (UINTN) (XhciPciMmBase + 0x46)
+ );
+
+ ///
+ /// LPT-LP >= B0: BIOS must set XhciMmioBase + 0x8188[26, 24] to 1b, 1b
+ /// LPT-H >= C0: BIOS must set XhciMmioBase + 0x8188[ 24] to 1b
+ ///
+ if(((PchSeries == PchLp) && (PchSteppingValue >= LptLpB0))) {
+ MmioOr32 (XhciMmioBase + 0x8188, (UINT32) (BIT26 | BIT24));
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciMmioBase + 0x8188),
+ 1,
+ (VOID *) (UINTN) (XhciMmioBase + 0x8188)
+ );
+ } else if(((PchSeries == PchH) && (PchSteppingValue >= LptHC0))){
+ MmioOr32 (XhciMmioBase + 0x8188, (UINT32) (BIT24));
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciMmioBase + 0x8188),
+ 1,
+ (VOID *) (UINTN) (XhciMmioBase + 0x8188)
+ );
+ }
+}
+
+/**
+ Initialization XHCI Clock Gating registers
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+
+ @retval None
+**/
+VOID
+ConfigureXhciClockGating (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar
+ )
+{
+ UINT32 XhccCfg;
+ UINTN XhciPciMmBase;
+ UINT8 Data8;
+ UINT16 Data16;
+ UINT32 Data32And;
+ UINT32 Data32Or;
+ EFI_STATUS Status;
+ PCH_SERIES PchSeries;
+ PchSeries = GetPchSeries();
+ XhciPciMmBase = MmPciAddress (
+ 0,
+ PchPlatformPolicy->BusNumber,
+ PCI_DEVICE_NUMBER_PCH_XHCI,
+ PCI_FUNCTION_NUMBER_PCH_XHCI,
+ 0
+ );
+ ///
+ /// Set IOBP register 0xE5004001[7:6] to 11b
+ ///
+ Data32And = (UINT32)~(0);
+ Data32Or = (UINT32) (BIT7 | BIT6);
+ Status = ProgramIobp (
+ RootComplexBar,
+ 0xE5004001,
+ Data32And,
+ Data32Or
+ );
+ ASSERT_EFI_ERROR (Status);
+ Status = PCH_INIT_COMMON_SCRIPT_SAVE_IOBP_S3_ITEM (
+ RootComplexBar,
+ 0xE5004001,
+ Data32And,
+ Data32Or
+ );
+ ASSERT_EFI_ERROR (Status);
+ ///
+ /// For LPT-H : Set D20:F0:40h[21,20,18,17,8] to 1b
+ /// For LPT-LP:
+ /// Set D20:F0:40h[18,17,8] to 1b.
+ /// Set D20:F0:40h[21,20,19] to 000b to disable XHCI Idle L1.
+ /// Set D20:F0:40h[21,20,19] to 110b to enable XHCI Idle L1.
+ /// Note for LPT-LP Ax stepping,
+ /// USB3 hot plug will fail after 1 hot plug removal.
+ /// BIOS implement a Setup Option to disable XHCI Idle L1 as workaround.
+ /// Option should default to enable XHCI Idle L1 to allow PCH PM testing.
+ /// User need to put the system to G3 when changing from Enable to Disable state.
+ ///
+ XhccCfg = MmioRead32 (XhciPciMmBase + R_PCH_XHCI_XHCC1);
+ XhccCfg &= (UINT32) ~(B_PCH_XHCI_XHCC1_URD);
+ if (PchSeries == PchH) {
+ XhccCfg |= (UINT32) (BIT21 | BIT20 | BIT18 | BIT17 | BIT8);
+ } else if (PchSeries == PchLp) {
+ XhccCfg |= (UINT32) (BIT18 | BIT17 | BIT8);
+ if (PchPlatformPolicy->UsbConfig->Usb30Settings.XhciIdleL1 == PCH_DEVICE_DISABLE) {
+ XhccCfg &= (UINT32)~(BIT21 | BIT20 | BIT19);
+ } else {
+ XhccCfg |= (UINT32) (BIT21 | BIT20);
+ XhccCfg &= (UINT32)~(BIT19);
+ }
+ }
+ Data16 = (UINT16)XhccCfg;
+ Data8 = (UINT8)(XhccCfg >> 16);
+ MmioWrite16 (XhciPciMmBase + R_PCH_XHCI_XHCC1, Data16);
+ MmioWrite8 (XhciPciMmBase + R_PCH_XHCI_XHCC1 + 2, Data8);
+ ///
+ /// Set D20:F0:44h[9, 7, 3] to 1b
+ ///
+ MmioOr16 (XhciPciMmBase + 0x44, (UINT16) (BIT9 | BIT7 | BIT3));
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (XhciPciMmBase + 0x44),
+ 1,
+ (VOID *) (UINTN) (XhciPciMmBase + 0x44)
+ );
+
+ ///
+ /// For LPT-LP, Set D20:F0:A0h[18] to 1b
+ /// For LPT-H, Set D20:F0:A0h[6] to 1b
+ ///
+ if (PchSeries == PchH) {
+ Data32Or = BIT6;
+ } else if (PchSeries == PchLp) {
+ Data32Or = BIT18;
+ }
+ MmioOr32 (XhciPciMmBase + 0xA0, (UINT32) Data32Or);
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciPciMmBase + 0xA0),
+ 1,
+ (VOID *) (UINTN) (XhciPciMmBase + 0xA0)
+ );
+ ///
+ /// Set D20:F0:A4h[13] to 0b
+ ///
+ MmioAnd32 (XhciPciMmBase + 0xA4, (UINT32)~(BIT13));
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciPciMmBase + 0xA4),
+ 1,
+ (VOID *) (UINTN) (XhciPciMmBase + 0xA4)
+ );
+}
+
+/**
+ Performs basic configuration of PCH USB3 (xHCI) controller.
+
+ @param[in] UsbConfig The PCH Platform Policy for USB configuration
+ @param[in] XhciMmioBase Memory base address of XHCI Controller
+ @param[in] Revision The policy revision used for backward compatible check
+ @param[in] LpcDeviceId The device ID of LPC
+ @param[in] XhciPciMmBase XHCI PCI Base Address
+ @param[in] PciD31F0RegBase LPC PCI Base Address
+
+ @retval None
+**/
+VOID
+PerformXhciEhciPortSwitchingFlow (
+ IN PCH_USB_CONFIG *UsbConfig,
+ IN UINT32 XhciMmioBase,
+ IN UINT8 Revision,
+ IN UINT16 LpcDeviceId,
+ IN UINTN XhciPciMmBase,
+ IN UINTN PciD31F0RegBase
+ )
+{
+ UINT32 UsbPort;
+ UINTN PortResetTimeout;
+ UINTN HsPortCount;
+ UINTN HsUsbrPortCount;
+ UINTN SsPortCount;
+ UINT32 PortMask;
+ UINT8 UsbPortRouting;
+ PCH_SERIES PchSeries;
+ UINTN *PORTSCxUSB2Ptr;
+ UINTN *PORTSCxUSB3Ptr;
+ UINT32 Data32;
+
+ PchSeries = GetPchSeries();
+ PORTSCxUSB2Ptr = NULL;
+ PORTSCxUSB3Ptr = NULL;
+ switch (PchSeries) {
+ case PchLp:
+ PORTSCxUSB2Ptr = &PCH_LP_PORTSCxUSB2[0];
+ PORTSCxUSB3Ptr = &PCH_LP_PORTSCxUSB3[0];
+ break;
+
+ case PchH:
+ PORTSCxUSB2Ptr = &PCH_H_PORTSCxUSB2[0];
+ PORTSCxUSB3Ptr = &PCH_H_PORTSCxUSB3[0];
+ break;
+
+ default:
+ break;
+ }
+ ///
+ /// Check if XHCI disabled, Exit function.
+ ///
+ if (UsbConfig->Usb30Settings.Mode == PCH_XHCI_MODE_OFF) {
+ return;
+ }
+ ///
+ /// Retrieves information about number of implemented xHCI ports and sets
+ /// appropriate port mask registers
+ /// Get the xHCI port number and program xHCI Port Routing Mask register
+ ///
+ GetXhciPortCountAndSetPortRoutingMask (
+ XhciPciMmBase,
+ &HsPortCount,
+ &HsUsbrPortCount,
+ &SsPortCount
+ );
+ ///
+ /// Workaround for USB2PR / USB3PR value not surviving warm reset.
+ ///
+ /// Check if Warm Reset
+ ///
+#ifdef USB_PRECONDITION_ENABLE_FLAG
+ if (USB_RUN_IN_PEI || (!USB_PRECONDITION_POLICY_SUPPORT (UsbConfig))) {
+#endif // USB_PRECONDITION_ENABLE_FLAG
+ if (MmioRead16 (PciD31F0RegBase + R_PCH_LPC_GEN_PMCON_2) & B_PCH_LPC_GEN_PMCON_MEM_SR) {
+ ///
+ /// Restore USB Port Routing registers if OS HC Switch driver has been executed
+ ///
+ if (MmioRead32 (PciD31F0RegBase + 0xAC) & BIT16) {
+ ///
+ /// Program D20:F0:D8h[5:0] to the value of xHCI D20:F0:DCh[5:0]
+ ///
+ PortMask = MmioRead32 (XhciPciMmBase + R_PCH_XHCI_USB3PRM) & (UINT32) B_PCH_XHCI_USB3PR_USB3SSENM;
+
+ MmioAndThenOr32 (
+ XhciPciMmBase + R_PCH_XHCI_USB3PR,
+ (UINT32)~B_PCH_XHCI_USB3PR_USB3SSEN,
+ PortMask
+ );
+ ///
+ /// Step 3
+ /// Program D20:F0:D0h[14:0] to the value of xHCI D20:F0:D4h[14:0]
+ ///
+ PortMask = MmioRead32 (XhciPciMmBase + R_PCH_XHCI_USB2PRM) & (UINT32) B_PCH_XHCI_USB2PR_USB2HCSELM;
+
+ MmioAndThenOr32 (
+ XhciPciMmBase + R_PCH_XHCI_USB2PR,
+ (UINT32)~B_PCH_XHCI_USB2PR_USB2HCSEL,
+ PortMask
+ );
+ }
+ }
+#ifdef USB_PRECONDITION_ENABLE_FLAG
+ }
+#endif // USB_PRECONDITION_ENABLE_FLAG
+#ifdef USB_PRECONDITION_ENABLE_FLAG
+ ///
+ /// Only clear this bit after DXE phase has finished using it.
+ /// because if we clear it too early in PEI phase
+ /// then we cannot determine if OS HC Switch driver has been executed in DXE phase.
+ ///
+ if (USB_RUN_IN_DXE || (!USB_PRECONDITION_POLICY_SUPPORT (UsbConfig))) {
+#endif // USB_PRECONDITION_ENABLE_FLAG
+ ///
+ /// Clear B0:D31:F0 ACh[16] to indicate finish using this bit and begin of BIOS phase of USB port routing
+ ///
+ MmioAnd32 (PciD31F0RegBase + 0xAC, (UINT32) ~BIT16);
+#ifdef USB_PRECONDITION_ENABLE_FLAG
+ }
+#endif // USB_PRECONDITION_ENABLE_FLAG
+ ///
+ /// Do nothing for this case
+ ///
+ UsbPortRouting = USB_PR_CASE_0;
+
+ if ((UsbConfig->Usb30Settings.PreBootSupport == PCH_DEVICE_DISABLE) ||
+ ((UsbConfig->Usb30Settings.PreBootSupport == PCH_DEVICE_ENABLE) &&
+ (UsbConfig->Usb30Settings.Mode == PCH_XHCI_MODE_AUTO))) {
+ ///
+ /// PCH BIOS Spec Rev 0.5.0
+ /// When the BIOS does not have xHCI pre-boot software available:
+ /// Section 13.1.1.2 xHCI Enabled mode
+ /// BIOS should route the Ports to the EHCI controller and prior to OS boot
+ /// it should route the ports to the xHCI controller.
+ /// Section 13.1.1.3 xHCI Auto mode
+ /// BIOS should route the Ports to the EHCI controller
+ ///
+ /// When the BIOS has xHCI pre-boot software available:
+ /// Section 13.1.2.3 xHCI Auto mode
+ /// BIOS should route the Ports to the EHCI controller
+ ///
+ /// For above cases, BIOS should follow Section 13.2.5 to route the
+ /// USB Ports to EHCI Controller.
+ ///
+ UsbPortRouting = USB_PR_CASE_1;
+ }
+
+ if ((UsbConfig->Usb30Settings.PreBootSupport == PCH_DEVICE_ENABLE) &&
+ (UsbConfig->Usb30Settings.Mode == PCH_XHCI_MODE_ON)) {
+ ///
+ /// PCH BIOS Spec Rev 0.5.0
+ /// When the BIOS has xHCI pre-boot software available:
+ /// Section 13.1.2.2 xHCI Enabled mode
+ /// BIOS should route the Ports to the xHCI controller
+ ///
+ /// For the above case, BIOS should follow Section 13.2.6 to route the
+ /// USB Ports to xHCI Controller.
+ ///
+ UsbPortRouting = USB_PR_CASE_2;
+#ifdef USB_PRECONDITION_ENABLE_FLAG
+ ///
+ /// Execute if runnin in PEI phase or USB precondition feature is not enabled
+ /// If the precondition is enabled and running in DXE phase, the workaround is done already
+ ///
+ if (USB_RUN_IN_PEI || (!USB_PRECONDITION_POLICY_SUPPORT (UsbConfig))) {
+#endif // USB_PRECONDITION_ENABLE_FLAG
+ if (MmioRead16(PciD31F0RegBase + R_PCH_LPC_GEN_PMCON_2) & B_PCH_LPC_GEN_PMCON_MEM_SR) {
+ ///
+ /// Step 3
+ /// Initiate warm reset to all USB3 ports
+ ///
+ for (UsbPort = 0; UsbPort < SsPortCount; UsbPort++) {
+ MmioAndThenOr32 (
+ XhciMmioBase + PORTSCxUSB3Ptr[UsbPort],
+ (UINT32)~ (B_PCH_XHCI_PORTSCXUSB3_PED),
+ B_PCH_XHCI_PORTSCXUSB3_WPR
+ );
+ }
+ ///
+ /// 3.c. Poll for warm reset bit at steps #a to be cleared or timeout at 100ms
+ ///
+ PortResetTimeout = 0;
+ do {
+ Data32 = 0;
+ for (UsbPort = 0; UsbPort < SsPortCount; UsbPort++) {
+ Data32 |= MmioRead32 (XhciMmioBase + PORTSCxUSB3Ptr[UsbPort]);
+ }
+ PchPmTimerStall (TEN_MS_TIMEOUT);
+ PortResetTimeout++;
+ } while ((Data32 & B_PCH_XHCI_PORTSCXUSB3_PR) &&
+ (PortResetTimeout < PORT_RESET_TIMEOUT));
+ }
+#ifdef USB_PRECONDITION_ENABLE_FLAG
+ }
+#endif // USB_PRECONDITION_ENABLE_FLAG
+ }
+#ifdef USB_PRECONDITION_ENABLE_FLAG
+ ///
+ /// Execute if runnin in PEI phase or USB precondition feature is not enabled
+ /// If the precondition is enabled and running in DXE phase, the workaround is done already
+ ///
+ if (USB_RUN_IN_PEI || (!USB_PRECONDITION_POLICY_SUPPORT (UsbConfig))) {
+#endif // USB_PRECONDITION_ENABLE_FLAG
+ if ((SsPortCount != 0) &&
+ (UsbPortRouting == USB_PR_CASE_1) &&
+ ((MmioRead32 (XhciPciMmBase + R_PCH_XHCI_USB2PR) != 0) ||
+ (MmioRead32 (XhciPciMmBase + R_PCH_XHCI_USB3PR) != 0))) {
+ ///
+ /// PCH BIOS Spec Rev 0.5.0 Section 13.2.5 Routing of switchable USB Ports to
+ /// EHCI Controller
+ /// Step 1
+ /// Retrieve information about the number of implemented xHCI ports and set appropriate
+ /// port mask registers
+ /// Done in GetXhciPortCountAndSetPortRoutingMask()
+ /// Step 2
+ /// Based on available number of ports (from step 1) initiate port reset to enabled ports
+ /// where USB 2.0 device is connected
+ ///
+ /// 2.a. For Port #1, if xHCIBAR + 480h [0] is sets then
+ /// 2.b. Issue port reset by sets xHCIBAR + 480h [4] to 1b
+ /// 2.f. Repeat steps #a to #e for all the USB2.0 ports.
+ ///
+ for (UsbPort = 0; UsbPort < HsPortCount; UsbPort++) {
+ if (MmioRead32 (XhciMmioBase + PORTSCxUSB2Ptr[UsbPort]) & B_PCH_XHCI_PORTSCXUSB2_CCS) {
+ MmioAndThenOr32 (
+ XhciMmioBase + PORTSCxUSB2Ptr[UsbPort],
+ (UINT32)~(B_PCH_XHCI_PORTSCXUSB2_PED),
+ B_PCH_XHCI_PORTSCXUSB2_PR
+ );
+ }
+ }
+ ///
+ /// 2.c. Poll for port reset bit at steps #b to be cleared or timeout at 100ms
+ ///
+ PortResetTimeout = 0;
+ do {
+ Data32 = 0;
+ for (UsbPort = 0; UsbPort < HsPortCount; UsbPort++) {
+ Data32 |= MmioRead32 (XhciMmioBase + PORTSCxUSB2Ptr[UsbPort]);
+ }
+ PchPmTimerStall (TEN_MS_TIMEOUT);
+ PortResetTimeout++;
+ } while ((Data32 & B_PCH_XHCI_PORTSCXUSB2_PR) &&
+ (PortResetTimeout < PORT_RESET_TIMEOUT));
+ ///
+ /// 2.d. Program D20:F0:D0h[14:0] to 0
+ ///
+ MmioAnd32 (
+ XhciPciMmBase + R_PCH_XHCI_USB2PR,
+ (UINT32)~B_PCH_XHCI_USB2PR_USB2HCSEL
+ );
+ ///
+ /// 2.e. Clear all the port's status by program xHCIBAR + 480h [23:17] to 1111111b
+ ///
+ for (UsbPort = 0; UsbPort < HsPortCount; UsbPort++) {
+ MmioAndThenOr32 (
+ XhciMmioBase + PORTSCxUSB2Ptr[UsbPort],
+ (UINT32)~ (B_PCH_XHCI_PORTSCXUSB2_PED),
+ B_PCH_XHCI_PORTSCXUSB2_CEC |
+ B_PCH_XHCI_PORTSCXUSB2_PLC |
+ B_PCH_XHCI_PORTSCXUSB2_PRC |
+ B_PCH_XHCI_PORTSCXUSB2_OCC |
+ B_PCH_XHCI_PORTSCXUSB2_WRC |
+ B_PCH_XHCI_PORTSCXUSB2_PEC |
+ B_PCH_XHCI_PORTSCXUSB2_CSC
+ );
+ }
+ if (HsUsbrPortCount > 0) {
+ MmioAndThenOr32 (
+ XhciMmioBase + PORTSCxUSB2Ptr[HsPortCount],
+ (UINT32)~ (B_PCH_XHCI_PORTSCXUSB2_PED),
+ B_PCH_XHCI_PORTSCXUSB2_CEC |
+ B_PCH_XHCI_PORTSCXUSB2_PLC |
+ B_PCH_XHCI_PORTSCXUSB2_PRC |
+ B_PCH_XHCI_PORTSCXUSB2_OCC |
+ B_PCH_XHCI_PORTSCXUSB2_WRC |
+ B_PCH_XHCI_PORTSCXUSB2_PEC |
+ B_PCH_XHCI_PORTSCXUSB2_CSC
+ );
+ }
+ ///
+ /// Step 3
+ /// Initiate warm reset to all USB 3.0 ports
+ ///
+ /// 3.a. For Port #1, sets xHCIBAR + 570h [31]
+ /// 3.e. Repeat steps #a to #e for all the USB3.0 ports.
+ ///
+ for (UsbPort = 0; UsbPort < SsPortCount; UsbPort++) {
+ MmioAndThenOr32 (
+ XhciMmioBase + PORTSCxUSB3Ptr[UsbPort],
+ (UINT32)~ (B_PCH_XHCI_PORTSCXUSB3_PED),
+ B_PCH_XHCI_PORTSCXUSB3_WPR
+ );
+ }
+ ///
+ /// 3.b. Program D20:F0:D8h[5:0] to 0h.
+ ///
+ MmioAnd32 (
+ XhciPciMmBase + R_PCH_XHCI_USB3PR,
+ (UINT32)~B_PCH_XHCI_USB3PR_USB3SSEN
+ );
+ ///
+ /// 3.c. Poll for warm reset bit at steps #a to be cleared or timeout at 100ms
+ ///
+ PortResetTimeout = 0;
+ do {
+ Data32 = 0;
+ for (UsbPort = 0; UsbPort < SsPortCount; UsbPort++) {
+ Data32 |= MmioRead32 (XhciMmioBase + PORTSCxUSB3Ptr[UsbPort]);
+ }
+ PchPmTimerStall (TEN_MS_TIMEOUT);
+ PortResetTimeout++;
+ } while ((Data32 & B_PCH_XHCI_PORTSCXUSB3_PR) &&
+ (PortResetTimeout < PORT_RESET_TIMEOUT));
+ ///
+ /// 3.d. Clear all the port's status by program xHCIBAR + 570h [23:17] to 1111111b.
+ ///
+ for (UsbPort = 0; UsbPort < SsPortCount; UsbPort++) {
+ MmioAndThenOr32 (
+ XhciMmioBase + PORTSCxUSB3Ptr[UsbPort],
+ (UINT32)~ (B_PCH_XHCI_PORTSCXUSB3_PED),
+ B_PCH_XHCI_PORTSCXUSB3_CEC |
+ B_PCH_XHCI_PORTSCXUSB3_PLC |
+ B_PCH_XHCI_PORTSCXUSB3_PRC |
+ B_PCH_XHCI_PORTSCXUSB3_OCC |
+ B_PCH_XHCI_PORTSCXUSB3_WRC |
+ B_PCH_XHCI_PORTSCXUSB3_PEC |
+ B_PCH_XHCI_PORTSCXUSB3_CSC
+ );
+ }
+ ///
+ /// Step 4
+ /// Set the Run bit of xHCI controller, xHCIBAR +80h[0] to 1b
+ ///
+ MmioOr32 (
+ XhciMmioBase + R_PCH_XHCI_USBCMD,
+ B_PCH_XHCI_USBCMD_RS
+ );
+ ///
+ /// Step 5
+ /// Then clear the Run bit of xHCI controller, xHCIBAR +80h[0] to 0b
+ ///
+ MmioAnd32 (
+ XhciMmioBase + R_PCH_XHCI_USBCMD,
+ (UINT32)~B_PCH_XHCI_USBCMD_RS
+ );
+ } else if ((SsPortCount != 0) && (UsbPortRouting == USB_PR_CASE_2)) {
+ ///
+ /// PCH BIOS Spec Rev 0.5.0 Section 13.2.6 Routing of switchable USB Ports to
+ /// xHCI Controller
+ /// Step 1
+ /// Retrieve information about the number of implemented xHCI ports and set appropriate
+ /// port mask registers
+ /// Done in GetXhciPortCountAndSetPortRoutingMask()
+ /// Step 2
+ /// Program D20:F0:D8h[5:0] to the value of xHCI D20:F0:DCh[5:0]
+ ///
+ PortMask = MmioRead32 (XhciPciMmBase + R_PCH_XHCI_USB3PRM) & (UINT32) B_PCH_XHCI_USB3PR_USB3SSENM;
+
+ MmioAndThenOr32 (
+ XhciPciMmBase + R_PCH_XHCI_USB3PR,
+ (UINT32)~B_PCH_XHCI_USB3PR_USB3SSEN,
+ PortMask
+ );
+ ///
+ /// Step 3
+ /// Program D20:F0:D0h[14:0] to the value of xHCI D20:F0:D4h[14:0]
+ ///
+ PortMask = MmioRead32 (XhciPciMmBase + R_PCH_XHCI_USB2PRM) & (UINT32) B_PCH_XHCI_USB2PR_USB2HCSELM;
+
+ MmioAndThenOr32 (
+ XhciPciMmBase + R_PCH_XHCI_USB2PR,
+ (UINT32)~B_PCH_XHCI_USB2PR_USB2HCSEL,
+ PortMask
+ );
+ } else if (SsPortCount != 0) {
+ //
+ // Check if Warm Reset
+ //
+ if (MmioRead16(PciD31F0RegBase + R_PCH_LPC_GEN_PMCON_2) & B_PCH_LPC_GEN_PMCON_MEM_SR) {
+ ///
+ /// Step 3
+ /// Initiate warm reset to all USB3 ports
+ ///
+ for (UsbPort = 0; UsbPort < SsPortCount; UsbPort++) {
+ MmioAndThenOr32 (
+ XhciMmioBase + PORTSCxUSB3Ptr[UsbPort],
+ (UINT32)~ (B_PCH_XHCI_PORTSCXUSB3_PED),
+ B_PCH_XHCI_PORTSCXUSB3_WPR
+ );
+ }
+ ///
+ /// 3.c. Poll for warm reset bit at steps #a to be cleared or timeout at 100ms
+ ///
+ PortResetTimeout = 0;
+ do {
+ Data32 = 0;
+ for (UsbPort = 0; UsbPort < SsPortCount; UsbPort++) {
+ Data32 |= MmioRead32 (XhciMmioBase + PORTSCxUSB3Ptr[UsbPort]);
+ }
+ PchPmTimerStall (TEN_MS_TIMEOUT);
+ PortResetTimeout++;
+ } while ((Data32 & B_PCH_XHCI_PORTSCXUSB3_PR) &&
+ (PortResetTimeout < PORT_RESET_TIMEOUT));
+ }
+ }
+ if (UsbConfig->Usb30Settings.ManualMode == PCH_DEVICE_ENABLE) {
+ ///
+ /// Using the similar method as
+ /// PCH BIOS Spec Rev 0.5.0 Section 13.2.5 Routing of switchable USB Ports to
+ /// EHCI Controller
+ /// Step 1
+ /// Retrieve information about the number of implemented xHCI ports and set appropriate
+ /// port mask registers
+ /// Done in GetXhciPortCountAndSetPortRoutingMask()
+ /// Step 2
+ /// Based on available number of ports (from step 1) initiate port reset to enabled ports
+ /// where USB 2.0 device is connected
+ ///
+ /// 2.a. For Port #1, if xHCIBAR + 480h [0] is sets then
+ /// 2.b. Issue port reset by sets xHCIBAR + 480h [4] to 1b
+ /// 2.f. Repeat steps #a to #e for all the USB2.0 ports.
+ ///
+ for (UsbPort = 0; UsbPort < HsPortCount; UsbPort++) {
+ if (MmioRead32 (XhciMmioBase + PORTSCxUSB2Ptr[UsbPort]) & B_PCH_XHCI_PORTSCXUSB2_CCS) {
+ MmioAndThenOr32 (
+ XhciMmioBase + PORTSCxUSB2Ptr[UsbPort],
+ (UINT32)~(B_PCH_XHCI_PORTSCXUSB2_PED),
+ B_PCH_XHCI_PORTSCXUSB2_PR
+ );
+ }
+ }
+ ///
+ /// 2.c. Poll for port reset bit at steps #b to be cleared or timeout at 100ms
+ ///
+ PortResetTimeout = 0;
+ do {
+ Data32 = 0;
+ for (UsbPort = 0; UsbPort < HsPortCount; UsbPort++) {
+ Data32 |= MmioRead32 (XhciMmioBase + PORTSCxUSB2Ptr[UsbPort]);
+ }
+ PchPmTimerStall (TEN_MS_TIMEOUT);
+ PortResetTimeout++;
+ } while ((Data32 & B_PCH_XHCI_PORTSCXUSB2_PR) &&
+ (PortResetTimeout < PORT_RESET_TIMEOUT));
+ ///
+ /// 2.d. Program D20:F0:D0h[14:0] manually
+ ///
+ PortMask = 0;
+ for (UsbPort = 0; UsbPort < HsPortCount; UsbPort++) {
+ if (UsbConfig->Usb30Settings.ManualModeUsb20PerPinRoute[UsbPort]==1) { // 0: EHCI; 1 :XHCI;
+ PortMask |= 1 << UsbPort;
+ }
+ }
+ MmioAndThenOr32 (
+ XhciPciMmBase + R_PCH_XHCI_USB2PR,
+ (UINT32)~B_PCH_XHCI_USB2PR_USB2HCSEL,
+ PortMask
+ );
+ ///
+ /// 2.e. Clear all the port's status by program xHCIBAR + 480h [23:17] to 1111111b
+ ///
+ for (UsbPort = 0; UsbPort < HsPortCount; UsbPort++) {
+ MmioAndThenOr32 (
+ XhciMmioBase + PORTSCxUSB2Ptr[UsbPort],
+ (UINT32)~ (B_PCH_XHCI_PORTSCXUSB2_PED),
+ B_PCH_XHCI_PORTSCXUSB2_CEC |
+ B_PCH_XHCI_PORTSCXUSB2_PLC |
+ B_PCH_XHCI_PORTSCXUSB2_PRC |
+ B_PCH_XHCI_PORTSCXUSB2_OCC |
+ B_PCH_XHCI_PORTSCXUSB2_WRC |
+ B_PCH_XHCI_PORTSCXUSB2_PEC |
+ B_PCH_XHCI_PORTSCXUSB2_CSC
+ );
+ }
+ if (HsUsbrPortCount > 0) {
+ MmioAndThenOr32 (
+ XhciMmioBase + PORTSCxUSB2Ptr[HsPortCount],
+ (UINT32)~ (B_PCH_XHCI_PORTSCXUSB2_PED),
+ B_PCH_XHCI_PORTSCXUSB2_CEC |
+ B_PCH_XHCI_PORTSCXUSB2_PLC |
+ B_PCH_XHCI_PORTSCXUSB2_PRC |
+ B_PCH_XHCI_PORTSCXUSB2_OCC |
+ B_PCH_XHCI_PORTSCXUSB2_WRC |
+ B_PCH_XHCI_PORTSCXUSB2_PEC |
+ B_PCH_XHCI_PORTSCXUSB2_CSC
+ );
+ }
+ ///
+ /// Step 3
+ /// Initiate warm reset to all USB 3.0 ports
+ ///
+ /// 3.a. For Port #1, sets xHCIBAR + 570h [31]
+ /// 3.e. Repeat steps #a to #e for all the USB3.0 ports.
+ ///
+ for (UsbPort = 0; UsbPort < SsPortCount; UsbPort++) {
+ MmioAndThenOr32 (
+ XhciMmioBase + PORTSCxUSB3Ptr[UsbPort],
+ (UINT32)~ (B_PCH_XHCI_PORTSCXUSB3_PED),
+ B_PCH_XHCI_PORTSCXUSB3_WPR
+ );
+ }
+ ///
+ /// 3.b. Program D20:F0:D8h[5:0] manually.
+ ///
+ PortMask = 0;
+ for (UsbPort = 0; UsbPort < SsPortCount; UsbPort++) {
+ if (UsbConfig->Usb30Settings.ManualModeUsb30PerPinEnable[UsbPort]==1) { // 0: Disable; 1:Enable;
+ PortMask |= 1 << UsbPort;
+ }
+ }
+ MmioAndThenOr32 (
+ XhciPciMmBase + R_PCH_XHCI_USB3PR,
+ (UINT32)~B_PCH_XHCI_USB3PR_USB3SSEN,
+ PortMask
+ );
+ ///
+ /// 3.c. Poll for warm reset bit at steps #a to be cleared or timeout at 100ms
+ ///
+ PortResetTimeout = 0;
+ do {
+ Data32 = 0;
+ for (UsbPort = 0; UsbPort < SsPortCount; UsbPort++) {
+ Data32 |= MmioRead32 (XhciMmioBase + PORTSCxUSB3Ptr[UsbPort]);
+ }
+ PchPmTimerStall (TEN_MS_TIMEOUT);
+ PortResetTimeout++;
+ } while ((Data32 & B_PCH_XHCI_PORTSCXUSB3_PR) &&
+ (PortResetTimeout < PORT_RESET_TIMEOUT));
+ ///
+ /// 3.d. Clear all the port's status by program xHCIBAR + 570h [23:17] to 1111111b.
+ ///
+ for (UsbPort = 0; UsbPort < SsPortCount; UsbPort++) {
+ MmioAndThenOr32 (
+ XhciMmioBase + PORTSCxUSB3Ptr[UsbPort],
+ (UINT32)~ (B_PCH_XHCI_PORTSCXUSB3_PED),
+ B_PCH_XHCI_PORTSCXUSB3_CEC |
+ B_PCH_XHCI_PORTSCXUSB3_PLC |
+ B_PCH_XHCI_PORTSCXUSB3_PRC |
+ B_PCH_XHCI_PORTSCXUSB3_OCC |
+ B_PCH_XHCI_PORTSCXUSB3_WRC |
+ B_PCH_XHCI_PORTSCXUSB3_PEC |
+ B_PCH_XHCI_PORTSCXUSB3_CSC
+ );
+ }
+ ///
+ /// Step 4
+ /// Set the Run bit of xHCI controller, xHCIBAR + 80h[0] to 1b
+ ///
+ MmioOr32 (
+ XhciMmioBase + R_PCH_XHCI_USBCMD,
+ (UINT32) B_PCH_XHCI_USBCMD_RS
+ );
+ ///
+ /// Step 5
+ /// Then clear the Run bit of xHCI controller, xHCIBAR + 80h[0] to 0b
+ ///
+ MmioAnd32 (
+ XhciMmioBase + R_PCH_XHCI_USBCMD,
+ (UINT32) ~B_PCH_XHCI_USBCMD_RS
+ );
+ }
+#ifdef USB_PRECONDITION_ENABLE_FLAG
+ }
+#endif // USB_PRECONDITION_ENABLE_FLAG
+
+#ifdef SUS_WELL_RESTORE
+ ///
+ /// To support RapidStart resume from G3 state, XHCI USB3 PR resume well registers
+ /// get save into S3 Script table only when not running in Auto/Smart Auto mode.
+ ///
+ if (((UsbConfig->Usb30Settings.ManualMode == PCH_DEVICE_ENABLE)) ||
+ ((UsbConfig->Usb30Settings.PreBootSupport == PCH_DEVICE_ENABLE) &&
+ (UsbConfig->Usb30Settings.Mode == PCH_XHCI_MODE_ON))) {
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciPciMmBase + R_PCH_XHCI_USB3PR),
+ 1,
+ (VOID *) (UINTN) (XhciPciMmBase + R_PCH_XHCI_USB3PR)
+ );
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciPciMmBase + R_PCH_XHCI_USB2PR),
+ 1,
+ (VOID *) (UINTN) (XhciPciMmBase + R_PCH_XHCI_USB2PR)
+ );
+ }
+#endif
+
+#ifdef USB_PRECONDITION_ENABLE_FLAG
+ ///
+ /// Check if XHCI disabled or auto even no preboot support, exit function directly
+ ///
+ if ((UsbConfig->Usb30Settings.Mode == PCH_XHCI_MODE_OFF) ||
+ (UsbConfig->Usb30Settings.Mode == PCH_XHCI_MODE_AUTO) ||
+ (UsbConfig->Usb30Settings.PreBootSupport == PCH_DEVICE_DISABLE)
+ ) {
+ return;
+ }
+ ///
+ /// If precondition is enabled, execute USB precondition function by each phase call
+ ///
+ if (USB_PRECONDITION_POLICY_SUPPORT (UsbConfig)) {
+ XHCI_PRECONDITION (
+ (UINT8) ((XhciPciMmBase >> 20) &0xFF),
+ PCI_DEVICE_NUMBER_PCH_XHCI,
+ PCI_FUNCTION_NUMBER_PCH_XHCI,
+ XhciMmioBase,
+ PORTSCxUSB2Ptr,
+ HsPortCount,
+ PORTSCxUSB3Ptr,
+ SsPortCount
+ );
+ }
+#endif // USB_PRECONDITION_ENABLE_FLAG
+}
+
+/**
+ Retrieves information about number of implemented xHCI ports
+ and sets appropriate port mask registers.
+
+ @param[in] XhciPciMmBase XHCI PCI Base Address
+ @param[out] HsPortCount Count of High Speed Ports
+ @param[out] HsUsbrPortCount Count of USBr Port
+ @param[out] SsPortCount Count of Super Speed Ports
+
+ @retval None
+**/
+VOID
+GetXhciPortCountAndSetPortRoutingMask (
+ IN UINTN XhciPciMmBase,
+ OUT UINTN *HsPortCount,
+ OUT UINTN *HsUsbrPortCount,
+ OUT UINTN *SsPortCount
+ )
+{
+ UINT32 HsPortEnableMask;
+ UINT32 SsPortEnableMask;
+ PCH_SERIES PchSeries;
+
+ HsPortEnableMask = 0;
+ SsPortEnableMask = 0;
+ PchSeries = GetPchSeries();
+ ///
+ /// PCH BIOS Spec Rev 0.5.0
+ /// Section 13.2.5 Routing of switchable USB Ports to EHCI Controller
+ /// Section 13.2.6 Routing of switchable USB Ports to xHCI Controller
+ ///
+ if (PchSeries == PchH) {
+ ///
+ /// Step 1.a Check xHCI D20:F0:E0h[2:1] to get HS Port Count.
+ ///
+ switch (MmioRead32 (XhciPciMmBase + R_PCH_XHCI_FUS) & B_PCH_XHCI_FUS_HSPRTCNT) {
+ case V_PCH_XHCI_FUS_HSPRTCNT_11B:
+ ///
+ /// If the value is 11b: Set xHCI D20:F0:D4h[13:0] to 00FFh. Number of HS ports is 8.
+ ///
+ *HsPortCount = V_PCH_H_XHCI_FUS_HSPRTCNT_11B_CNT;
+ HsPortEnableMask = V_PCH_H_XHCI_FUS_HSPRTCNT_11B_MASK;
+ break;
+
+ case V_PCH_XHCI_FUS_HSPRTCNT_10B:
+ ///
+ /// If the value is 10b: Set xHCI D20:F0:D4h[13:0] to 0FFFh. Number of HS ports is 10.
+ /// It is work around. Bit 6 and 7 have to be set to 1 to enable USB2 ports.
+ ///
+ *HsPortCount = V_PCH_H_XHCI_FUS_HSPRTCNT_10B_CNT;
+ HsPortEnableMask = V_PCH_H_XHCI_FUS_HSPRTCNT_10B_MASK;
+ break;
+
+ case V_PCH_XHCI_FUS_HSPRTCNT_01B:
+ ///
+ /// If the value is 01b: Set xHCI D20:F0:D4h[13:0] to 3FFFh. Number of HS ports is 12.
+ /// It is work around. Bit 6 and 7 have to be set to 1 to enable USB2 ports.
+ ///
+ *HsPortCount = V_PCH_H_XHCI_FUS_HSPRTCNT_01B_CNT;
+ HsPortEnableMask = V_PCH_H_XHCI_FUS_HSPRTCNT_01B_MASK;
+ break;
+
+ case V_PCH_XHCI_FUS_HSPRTCNT_00B:
+ ///
+ /// If the value is 00b: Set xHCI D20:F0:D4h[13:0] to 3FFFh. Number of HS ports is 14
+ ///
+ default:
+ *HsPortCount = V_PCH_H_XHCI_FUS_HSPRTCNT_00B_CNT;
+ HsPortEnableMask = V_PCH_H_XHCI_FUS_HSPRTCNT_00B_MASK;
+ break;
+ }
+ ///
+ /// Step 1.b Check xHCI D20:F0:E0h[4:3] to get SS Port Count.
+ ///
+ switch (MmioRead32 (XhciPciMmBase + R_PCH_XHCI_FUS) & B_PCH_XHCI_FUS_SSPRTCNT) {
+ case V_PCH_XHCI_FUS_SSPRTCNT_11B:
+ ///
+ /// If the value is 11b: Set xHCI D20:F0:DCh[5:0] to 000000b. Number of SS ports is 0.
+ ///
+ *SsPortCount = V_PCH_H_XHCI_FUS_SSPRTCNT_11B_CNT;
+ SsPortEnableMask = V_PCH_H_XHCI_FUS_SSPRTCNT_11B_MASK;
+ break;
+
+ case V_PCH_XHCI_FUS_SSPRTCNT_10B:
+ ///
+ /// If the value is 10b: Set xHCI D20:F0:DCh[5:0] to 000011b. Number of SS ports is 2.
+ ///
+ *SsPortCount = V_PCH_H_XHCI_FUS_SSPRTCNT_10B_CNT;
+ SsPortEnableMask = V_PCH_H_XHCI_FUS_SSPRTCNT_10B_MASK;
+ break;
+
+ case V_PCH_XHCI_FUS_SSPRTCNT_01B:
+ ///
+ /// If the value is 01b: Set xHCI D20:F0:DCh[5:0] to 001111b. Number of SS ports is 4.
+ ///
+ *SsPortCount = V_PCH_H_XHCI_FUS_SSPRTCNT_01B_CNT;
+ SsPortEnableMask = V_PCH_H_XHCI_FUS_SSPRTCNT_01B_MASK;
+ break;
+
+ case V_PCH_XHCI_FUS_SSPRTCNT_00B:
+ ///
+ /// If the value is 00b: Set xHCI D20:F0:DCh[5:0] to 111111b. Number of SS ports is 6.
+ ///
+ default:
+ *SsPortCount = V_PCH_H_XHCI_FUS_SSPRTCNT_00B_CNT;
+ SsPortEnableMask = V_PCH_H_XHCI_FUS_SSPRTCNT_00B_MASK;
+ break;
+ }
+ ///
+ /// Step 1.c Check xHCI D20:F0:E0h[5] to know if USBr is enabled.
+ /// @todo Need more comments to understand this
+ ///
+ switch (MmioRead32 (XhciPciMmBase + R_PCH_XHCI_FUS) & B_PCH_XHCI_FUS_USBR) {
+ case V_PCH_XHCI_FUS_USBR_EN:
+ ///
+ /// If 0b: Set xHCI D20:F0:D4[14] to 1b. USBr port is enabled.
+ ///
+ *HsUsbrPortCount = 1;
+ HsPortEnableMask |= BIT14;
+ break;
+
+ case V_PCH_XHCI_FUS_USBR_DIS:
+ ///
+ /// If 1b: Set xHCI D20:F0:D4[14] to 0b. USBr port is disabled.
+ ///
+ *HsUsbrPortCount = 0;
+ HsPortEnableMask &= (~BIT14);
+ break;
+ }
+ } else if (PchSeries == PchLp) {
+ ///
+ /// Step 1.a LPT-LP has a fixed number of 8 HS ports. Set xHCI D20:F0:D4h[13:0] to 00FFh.
+ ///
+ *HsPortCount = V_PCH_LP_XHCI_FIXED_HSPRTCNT;
+ HsPortEnableMask = V_PCH_LP_XHCI_FIXED_HSPRTCNT_MASK;
+ ///
+ /// Step 1.b LPT-LP has a fixed number of 4 SS ports. Set xHCI D20:F0:DCh[3:0] to 0Fh.
+ ///
+ *SsPortCount = V_PCH_LP_XHCI_FIXED_SSPRTCNT;
+ SsPortEnableMask = V_PCH_LP_XHCI_FIXED_SSPRTCNT_MASK;
+ ///
+ /// Step 1.c Check xHCI D20:F0:E0h[5] to know if USBr is enabled.
+ /// @todo Need more comments to understand this
+ ///
+ switch (MmioRead32 (XhciPciMmBase + R_PCH_XHCI_FUS) & B_PCH_XHCI_FUS_USBR) {
+ case V_PCH_XHCI_FUS_USBR_EN:
+ ///
+ /// If 0b: Set xHCI D20:F0:D4[8] to 1b. USBr port is enabled.
+ ///
+ *HsUsbrPortCount = 1;
+ HsPortEnableMask |= BIT8;
+ break;
+
+ case V_PCH_XHCI_FUS_USBR_DIS:
+ ///
+ /// If 1b: Set xHCI D20:F0:D4[8] to 0b. USBr port is disabled.
+ ///
+ *HsUsbrPortCount = 0;
+ HsPortEnableMask &= (~BIT8);
+ break;
+ }
+ }
+
+ //Routing the USB ports 12, 8, and 5 to EHCI to avoid OC detection when wakening up from S3
+
+ #ifdef UPSERVER_SUPPORT
+ HsPortEnableMask &=~(BIT12|BIT8|BIT5);
+ #endif
+
+ ///
+ /// Set xHCI USB2 Port Routing Mask register (D20:F0:D4h[14:0])
+ /// per HS Port Enable Mask value
+ ///
+ MmioAndThenOr32 (
+ XhciPciMmBase + R_PCH_XHCI_USB2PRM,
+ ~ (UINT32) B_PCH_XHCI_USB2PR_USB2HCSELM,
+ HsPortEnableMask
+ );
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciPciMmBase + R_PCH_XHCI_USB2PRM),
+ 1,
+ (VOID *) (UINTN) (XhciPciMmBase + R_PCH_XHCI_USB2PRM)
+ );
+ ///
+ /// Set xHCI USB3 Port Routing Mask register (D20:F0:DCh[5:0])
+ /// per SS Port Enable Mask value
+ ///
+ MmioAndThenOr32 (
+ XhciPciMmBase + R_PCH_XHCI_USB3PRM,
+ ~ (UINT32) B_PCH_XHCI_USB3PR_USB3SSENM,
+ SsPortEnableMask
+ );
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciPciMmBase + R_PCH_XHCI_USB3PRM),
+ 1,
+ (VOID *) (UINTN) (XhciPciMmBase + R_PCH_XHCI_USB3PRM)
+ );
+}
+
+/**
+ Setup XHCI Over-Current Mapping
+
+ @param[in] UsbConfig The PCH Platform Policy for USB configuration
+ @param[in] XhciPciMmBase XHCI PCI Base Address
+
+ @retval None
+**/
+VOID
+XhciOverCurrentMapping (
+ IN PCH_USB_CONFIG *UsbConfig,
+ IN UINTN XhciPciMmBase
+ )
+{
+ ///
+ /// BIOS responsibility on Overcurrent protection.
+ /// ----------------------------------------------
+ /// There are 8 total overcurrent pins
+ /// which can be map to 14 USB2 ports and 6 USB3 ports.
+ /// On a given physical connector,
+ /// one OC pin is shared between the USB2 (HS) pins and USB3 (SS) pins.
+ /// USB2 (HS) pins are programmable to be owned by either XHCI or EHCI.
+ /// OC pins are associated to the current owner.
+ /// USB2 (HS) ports 1-8 use OC pins 1-4, ports 9-14 use OC pins 4-8
+ /// USB3 (SS) ports has the flexibility in pairing with any of the OC pins.
+ /// It is ok to map multiple ports to a single pin.
+ /// It is not ok to map a single ports to a multiple pins.
+ /// All USB ports routed out of the package must have Overcurrent protection.
+ /// USB Ports not routed out from the package should not be assigned OC pins.
+ ///
+ UINT32 Index;
+ UINT32 CurrentIndex;
+ UINT32 XhciHsOcm1;
+ UINT32 XhciHsOcm2;
+ UINT32 XhciSsOcm1;
+ UINT32 XhciSsOcm2;
+ PCH_SERIES PchSeries;
+
+ PchSeries = GetPchSeries();
+ ///
+ /// Check if XHCI disabled, Exit function.
+ ///
+ if (UsbConfig->Usb30Settings.Mode == PCH_XHCI_MODE_OFF) {
+ return;
+ }
+ ///
+ /// Find the corresponding register and set the bits
+ ///
+ XhciHsOcm1 = 0;
+ XhciHsOcm2 = 0;
+ XhciSsOcm1 = 0;
+ XhciSsOcm2 = 0;
+
+ for (Index = 0; Index < GetPchUsbMaxPhysicalPortNum (); Index++) {
+ if (UsbConfig->Usb20OverCurrentPins[Index] == PchUsbOverCurrentPinSkip) {
+ ///
+ /// No OC pin assigned, skip this port
+ ///
+ } else {
+ if (Index < 8) {
+ ///
+ /// Port 0-7: OC0 - OC3
+ ///
+ if (UsbConfig->Usb20OverCurrentPins[Index] > PchUsbOverCurrentPin3) {
+ ASSERT (FALSE);
+ continue;
+ }
+
+ CurrentIndex = UsbConfig->Usb20OverCurrentPins[Index] * 8 + Index;
+ XhciHsOcm1 |= (UINT32) (BIT0 << CurrentIndex);
+ } else {
+ ///
+ /// Port 8-13: OC4 - OC7
+ ///
+ if ((UsbConfig->Usb20OverCurrentPins[Index] < PchUsbOverCurrentPin4) ||
+ (UsbConfig->Usb20OverCurrentPins[Index] > PchUsbOverCurrentPin7)) {
+ ASSERT (FALSE);
+ continue;
+ }
+
+ CurrentIndex = (UsbConfig->Usb20OverCurrentPins[Index] - 4) * 8 + (Index - 8);
+ XhciHsOcm2 |= (UINT32) (BIT0 << CurrentIndex);
+ }
+ }
+ }
+
+ for (Index = 0; Index < GetPchXhciMaxUsb3PortNum (); Index++) {
+ if (UsbConfig->Usb30OverCurrentPins[Index] == PchUsbOverCurrentPinSkip) {
+ ///
+ /// No OC pin assigned, skip this port
+ ///
+ } else {
+ ///
+ /// Port 0-5: OC0 - OC7
+ ///
+ if (UsbConfig->Usb30OverCurrentPins[Index] < PchUsbOverCurrentPin4) {
+ CurrentIndex = UsbConfig->Usb30OverCurrentPins[Index] * 8 + Index;
+ XhciSsOcm1 |= (UINT32) (BIT0 << CurrentIndex);
+ } else {
+ CurrentIndex = (UsbConfig->Usb30OverCurrentPins[Index] - 4) * 8 + Index;
+ XhciSsOcm2 |= (UINT32) (BIT0 << CurrentIndex);
+ }
+ }
+ }
+ ///
+ /// OCM registers are in the suspend well.
+ ///
+ MmioWrite32 (XhciPciMmBase + R_PCH_XHCI_U2OCM1, XhciHsOcm1);
+ MmioWrite32 (XhciPciMmBase + R_PCH_XHCI_U3OCM1, XhciSsOcm1);
+ if (PchSeries == PchH) {
+ MmioWrite32 (XhciPciMmBase + R_PCH_XHCI_U2OCM2, XhciHsOcm2);
+ MmioWrite32 (XhciPciMmBase + R_PCH_XHCI_U3OCM2, XhciSsOcm2);
+ }
+
+#ifdef SUS_WELL_RESTORE
+ ///
+ /// To support RapidStart resume from G3 state, all resume well registers need to be saved
+ /// into S3 Script table.
+ ///
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciPciMmBase + R_PCH_XHCI_U2OCM1),
+ 1,
+ (VOID *) (UINTN) (XhciPciMmBase + R_PCH_XHCI_U2OCM1)
+ );
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciPciMmBase + R_PCH_XHCI_U3OCM1),
+ 1,
+ (VOID *) (UINTN) (XhciPciMmBase + R_PCH_XHCI_U3OCM1)
+ );
+ if (PchSeries == PchH) {
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciPciMmBase + R_PCH_XHCI_U2OCM2),
+ 1,
+ (VOID *) (UINTN) (XhciPciMmBase + R_PCH_XHCI_U2OCM2)
+ );
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciPciMmBase + R_PCH_XHCI_U3OCM2),
+ 1,
+ (VOID *) (UINTN) (XhciPciMmBase + R_PCH_XHCI_U3OCM2)
+ );
+ }
+#endif // SUS_WELL_RESTORE
+}
+
+/**
+ Setup EHCI Over-Current Mapping
+
+ @param[in] UsbConfig The PCH Platform Policy for USB configuration
+ @param[in] Ehci1PciMmBase EHCI 1 PCI Base Address
+ @param[in] Ehci2PciMmBase EHCI 2 PCI Base Address
+
+ @retval None
+**/
+VOID
+EhciOverCurrentMapping (
+ IN PCH_USB_CONFIG *UsbConfig,
+ IN UINTN Ehci1PciMmBase,
+ IN UINTN Ehci2PciMmBase
+ )
+{
+ UINT32 Index;
+ UINT32 CurrentIndex;
+ UINT32 Ehci1Ocm;
+ UINT32 Ehci2Ocm;
+ PCH_SERIES PchSeries;
+
+ Ehci1Ocm = 0;
+ Ehci2Ocm = 0;
+ PchSeries = GetPchSeries();
+
+ for (Index = 0; Index < GetPchUsbMaxPhysicalPortNum (); Index++) {
+ if (UsbConfig->Usb20OverCurrentPins[Index] == PchUsbOverCurrentPinSkip) {
+ ///
+ /// No OC pin assigned, skip this port
+ ///
+ } else {
+ if (Index < 8) {
+ ///
+ /// Port 0~7 -> OC0~3
+ ///
+ if (UsbConfig->Usb20OverCurrentPins[Index] > PchUsbOverCurrentPin3) {
+ ASSERT (FALSE);
+ continue;
+ }
+
+ CurrentIndex = UsbConfig->Usb20OverCurrentPins[Index] * 8 + Index;
+ Ehci1Ocm |= (UINT32) (BIT0 << CurrentIndex);
+ } else {
+ if (PchSeries == PchH) {
+ ///
+ /// Port 8~13 -> OC4~7
+ ///
+ if ((UsbConfig->Usb20OverCurrentPins[Index] < PchUsbOverCurrentPin4) ||
+ (UsbConfig->Usb20OverCurrentPins[Index] > PchUsbOverCurrentPin7)) {
+ ASSERT (FALSE);
+ continue;
+ }
+ CurrentIndex = (UsbConfig->Usb20OverCurrentPins[Index] - 4) * 8 + (Index - 8);
+ Ehci2Ocm |= (UINT32) (BIT0 << CurrentIndex);
+ }
+ }
+ }
+ }
+ ///
+ /// EHCI1OCM and EHCI2OCM are in the suspend well.
+ ///
+ if (UsbConfig->Usb20Settings[PchEhci1].Enable == PCH_DEVICE_ENABLE) {
+ MmioWrite32 (Ehci1PciMmBase + R_PCH_EHCI_OCMAP, Ehci1Ocm);
+ }
+
+ if (PchSeries == PchH) {
+ if (UsbConfig->Usb20Settings[PchEhci2].Enable == PCH_DEVICE_ENABLE) {
+ MmioWrite32 (Ehci2PciMmBase + R_PCH_EHCI_OCMAP, Ehci2Ocm);
+ }
+ }
+
+#ifdef SUS_WELL_RESTORE
+ ///
+ /// To support RapidStart resume from G3 state, all resume well registers need to be saved
+ /// into S3 Script table.
+ ///
+ if (UsbConfig->Usb20Settings[PchEhci1].Enable == PCH_DEVICE_ENABLE) {
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (Ehci1PciMmBase + R_PCH_EHCI_OCMAP),
+ 1,
+ (VOID *) (UINTN) (Ehci1PciMmBase + R_PCH_EHCI_OCMAP)
+ );
+ }
+
+ if (PchSeries == PchH) {
+ if (UsbConfig->Usb20Settings[PchEhci2].Enable == PCH_DEVICE_ENABLE) {
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (Ehci2PciMmBase + R_PCH_EHCI_OCMAP),
+ 1,
+ (VOID *) (UINTN) (Ehci2PciMmBase + R_PCH_EHCI_OCMAP)
+ );
+ }
+ }
+#endif
+}
+
+/**
+ Program Ehci Port Disable Override
+
+ @param[in] UsbConfig The PCH Platform Policy for USB configuration
+ @param[in] Ehci1PciMmBase EHCI 1 PCI Base Address
+ @param[in] Ehci2PciMmBase EHCI 2 PCI Base Address
+
+ @retval None
+**/
+VOID
+EhciPortDisableOverride (
+ IN PCH_USB_CONFIG *UsbConfig,
+ IN UINTN Ehci1PciMmBase,
+ IN UINTN Ehci2PciMmBase
+ )
+{
+ UINT32 Index;
+ PCH_SERIES PchSeries;
+
+ PchSeries = GetPchSeries();
+ ///
+ /// PCH BIOS Spec Rev 0.5.0 Section 12.2 Disabling USB Ports
+ /// System BIOS may choose to disable individual USB ports to save power or for security
+ /// purposes. Each of the USB ports has a corresponding bit within the PCH USB Port
+ /// Disable Override Register (D26/29:F0 + 64h). The PCH USB Port Disable Override
+ /// Register can be locked by setting the Write Enable bit of the PCH USB Per-Port Register
+ /// Write Control Register, PMBASE + 3Ch[1]. Refer to the PCH EDS for more details on
+ /// these registers.
+ ///
+ for (Index = 0; Index < GetPchUsbMaxPhysicalPortNum (); Index++) {
+ if ((Index < 8) && (UsbConfig->Usb20Settings[PchEhci1].Enable == PCH_DEVICE_ENABLE)) {
+ ///
+ /// EHCI1 PDO for Port 0 to 7
+ ///
+ if (UsbConfig->PortSettings[Index].Enable == PCH_DEVICE_DISABLE) {
+ MmioOr8 (Ehci1PciMmBase + R_PCH_EHCI_PDO, (UINT8) (B_PCH_EHCI_PDO_DIS_PORT0 << Index));
+ } else {
+ MmioAnd8 (Ehci1PciMmBase + R_PCH_EHCI_PDO, (UINT8) ~(B_PCH_EHCI_PDO_DIS_PORT0 << Index));
+ }
+ }
+ if (PchSeries == PchH) {
+ if ((Index < 14) && (UsbConfig->Usb20Settings[PchEhci2].Enable == PCH_DEVICE_ENABLE)) {
+ ///
+ /// EHCI2 PDO for Port 8 to 13
+ ///
+ if (UsbConfig->PortSettings[Index].Enable == PCH_DEVICE_DISABLE) {
+ MmioOr8 (Ehci2PciMmBase + R_PCH_EHCI_PDO, (UINT8) (B_PCH_EHCI_PDO_DIS_PORT0 << (Index - 8)));
+ } else {
+ MmioAnd8 (Ehci2PciMmBase + R_PCH_EHCI_PDO, (UINT8) ~(B_PCH_EHCI_PDO_DIS_PORT0 << (Index - 8)));
+ }
+ }
+ }
+ }
+
+#ifdef SUS_WELL_RESTORE
+ ///
+ /// To support RapidStart resume from G3 state, all resume well registers need to be saved
+ /// into S3 Script table.
+ ///
+ if (UsbConfig->Usb20Settings[PchEhci1].Enable == PCH_DEVICE_ENABLE) {
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (Ehci1PciMmBase + R_PCH_EHCI_PDO),
+ 1,
+ (VOID *) (UINTN) (Ehci1PciMmBase + R_PCH_EHCI_PDO)
+ );
+ }
+
+ if (PchSeries == PchH) {
+ if (UsbConfig->Usb20Settings[PchEhci2].Enable == PCH_DEVICE_ENABLE) {
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (Ehci2PciMmBase + R_PCH_EHCI_PDO),
+ 1,
+ (VOID *) (UINTN) (Ehci2PciMmBase + R_PCH_EHCI_PDO)
+ );
+ }
+ }
+#endif // SUS_WELL_RESTORE
+}
+
+/**
+ Program Xhci Port Disable Override
+
+ @param[in] UsbConfig The PCH Platform Policy for USB configuration
+ @param[in] XhciPciMmBase XHCI PCI Base Address
+ @param[in] Revision Platform policy revision
+
+ @retval None
+**/
+VOID
+XhciPortDisableOverride (
+ IN PCH_USB_CONFIG *UsbConfig,
+ IN UINTN XhciPciMmBase,
+ IN UINT8 Revision
+ )
+{
+ UINT32 Index;
+ UINT32 XhciUsb2Pdo;
+ UINT32 XhciUsb3Pdo;
+ UINT32 XhciIndex;
+ PCH_SERIES PchSeries;
+
+ PchSeries = GetPchSeries();
+ ///
+ /// Check if XHCI disabled, Exit function.
+ ///
+ if (UsbConfig->Usb30Settings.Mode == PCH_XHCI_MODE_OFF) {
+ return;
+ }
+ ///
+ /// PCH BIOS Spec Rev 0.5.0 Section 13.2.2 Port Disable Override
+ /// In LynxPoint PCH, Port disable override on xHCI ports is implemented by mapping the
+ /// appropriate ports to the EHCI controller and then setting the port disable override in
+ /// the EHCI function. Please refer to section 12.2.
+ /// Please note that there is a corresponding disable bit on D20:F0:E4h[14:0] for USB 2.0
+ /// ports and D20:F0:E8h[5:0] for USB 3.0 ports. BIOS needs to program them accordingly.
+ ///
+ /// XHCI PDO for HS
+ ///
+ XhciUsb2Pdo = MmioRead32 (XhciPciMmBase + R_PCH_XHCI_USB2PDO) & B_PCH_XHCI_USB2PDO_MASK;
+ for (Index = 0; Index < GetPchUsbMaxPhysicalPortNum (); Index++) {
+ XhciIndex = Index;
+ if (PchSeries == PchH) {
+ ///
+ /// Translate physical pins to internal ports numbering
+ ///
+ XhciIndex = XhciUsb2InternalPortNumberLookUpTable[Index];
+ }
+ if (UsbConfig->PortSettings[Index].Enable == PCH_DEVICE_DISABLE) {
+ XhciUsb2Pdo |= (UINT32) (B_PCH_XHCI_USB2PDO_DIS_PORT0 << XhciIndex);
+ } else {
+ XhciUsb2Pdo &= (UINT32)~(B_PCH_XHCI_USB2PDO_DIS_PORT0 << XhciIndex);
+ }
+ }
+ ///
+ /// XHCI PDO for SS
+ ///
+ XhciUsb3Pdo = MmioRead32 (XhciPciMmBase + R_PCH_XHCI_USB3PDO) & B_PCH_XHCI_USB3PDO_MASK;
+ for (Index = 0; Index < GetPchXhciMaxUsb3PortNum (); Index++) {
+
+ if (USB3PORT_SETTING_POLICY_SUPPORT(Revision)){
+ if (UsbConfig->Port30Settings[Index].Enable == PCH_DEVICE_DISABLE) {
+ XhciUsb3Pdo |= (UINT32) (B_PCH_XHCI_USB3PDO_DIS_PORT0 << Index);
+ } else {
+ XhciUsb3Pdo &= (UINT32)~(B_PCH_XHCI_USB3PDO_DIS_PORT0 << Index);
+ }
+ } else {
+ if (UsbConfig->PortSettings[Index].Enable == PCH_DEVICE_DISABLE) {
+ XhciUsb3Pdo |= (UINT32) (B_PCH_XHCI_USB3PDO_DIS_PORT0 << Index);
+ } else {
+ XhciUsb3Pdo &= (UINT32)~(B_PCH_XHCI_USB3PDO_DIS_PORT0 << Index);
+ }
+ }
+ }
+ ///
+ /// USB2PDO and USB3PDO are Write-Once registers and bits in them are in the SUS Well.
+ ///
+ MmioWrite32 (XhciPciMmBase + R_PCH_XHCI_USB2PDO, XhciUsb2Pdo);
+ MmioWrite32 (XhciPciMmBase + R_PCH_XHCI_USB3PDO, XhciUsb3Pdo);
+#ifdef SUS_WELL_RESTORE
+ ///
+ /// To support RapidStart resume from G3 state, all resume well registers need to be saved
+ /// into S3 Script table.
+ ///
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciPciMmBase + R_PCH_XHCI_USB2PDO),
+ 1,
+ (VOID *) (UINTN) (XhciPciMmBase + R_PCH_XHCI_USB2PDO)
+ );
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciPciMmBase + R_PCH_XHCI_USB3PDO),
+ 1,
+ (VOID *) (UINTN) (XhciPciMmBase + R_PCH_XHCI_USB3PDO)
+ );
+#endif
+}
+
+/**
+ Enable EHCI USBR device
+
+ @param[in] EhciPciMmBase Ehci PCI Base Address
+
+ @retval None
+**/
+VOID
+EhciUsbrEnable (
+ IN UINTN EhciPciMmBase
+ )
+{
+ ///
+ /// NOTE: EHCI USBR Enable
+ /// EHCI1_USBr_en and EHCI2_USBr_en are mutually exclusive. Both cannot be set to 1 at any one time.
+ /// SW must ensure at any one time, only 1 EHCI should have the bit set.
+ ///
+ MmioOr16 (EhciPciMmBase + 0x7A, (UINT16) BIT8);
+#ifdef SUS_WELL_RESTORE
+ ///
+ /// To support RapidStart resume from G3 state, all resume well registers need to be saved
+ /// into S3 Script table.
+ ///
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (EhciPciMmBase + 0x7A),
+ 1,
+ (VOID *) (UINTN) (EhciPciMmBase + 0x7A)
+ );
+#endif
+}
+
+/**
+ Program and enable XHCI Memory Space
+
+ @param[in] UsbConfig The PCH Platform Policy for USB configuration
+ @param[in] XhciMmioBase Memory base address of XHCI Controller
+ @param[in] XhciPciMmBase XHCI PCI Base Address
+
+ @retval None
+**/
+VOID
+XhciMemorySpaceOpen (
+ IN PCH_USB_CONFIG *UsbConfig,
+ IN UINT32 XhciMmioBase,
+ IN UINTN XhciPciMmBase
+ )
+{
+ ///
+ /// Check if XHCI disabled, Exit function.
+ ///
+ if (UsbConfig->Usb30Settings.Mode == PCH_XHCI_MODE_OFF) {
+ return;
+ }
+ ///
+ /// Assign memory resources
+ ///
+ MmioWrite32 (XhciPciMmBase + R_PCH_XHCI_MEM_BASE, XhciMmioBase);
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciPciMmBase + R_PCH_XHCI_MEM_BASE),
+ 1,
+ (VOID *) (UINTN) (XhciPciMmBase + R_PCH_XHCI_MEM_BASE)
+ );
+
+ MmioOr16 (
+ XhciPciMmBase + R_PCH_XHCI_COMMAND_REGISTER,
+ (UINT16) (B_PCH_XHCI_COMMAND_MSE | B_PCH_XHCI_COMMAND_BME)
+ );
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (XhciPciMmBase + R_PCH_XHCI_COMMAND_REGISTER),
+ 1,
+ (VOID *) (UINTN) (XhciPciMmBase + R_PCH_XHCI_COMMAND_REGISTER)
+ );
+}
+
+/**
+ Clear and disable XHCI Memory Space
+
+ @param[in] UsbConfig The PCH Platform Policy for USB configuration
+ @param[in] XhciMmioBase Memory base address of XHCI Controller
+ @param[in] XhciPciMmBase XHCI PCI Base Address
+
+ @retval None
+**/
+VOID
+XhciMemorySpaceClose (
+ IN PCH_USB_CONFIG *UsbConfig,
+ IN UINT32 XhciMmioBase,
+ IN UINTN XhciPciMmBase
+ )
+{
+ ///
+ /// Check if XHCI disabled, Exit function.
+ ///
+ if (UsbConfig->Usb30Settings.Mode == PCH_XHCI_MODE_OFF) {
+ return;
+ }
+ ///
+ /// Clear memory resources
+ ///
+ MmioAnd16 (
+ XhciPciMmBase + R_PCH_XHCI_COMMAND_REGISTER,
+ (UINT16)~(B_PCH_XHCI_COMMAND_MSE | B_PCH_XHCI_COMMAND_BME)
+ );
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (XhciPciMmBase + R_PCH_XHCI_COMMAND_REGISTER),
+ 1,
+ (VOID *) (UINTN) (XhciPciMmBase + R_PCH_XHCI_COMMAND_REGISTER)
+ );
+
+ MmioWrite32 ((XhciPciMmBase + R_PCH_XHCI_MEM_BASE), 0);
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciPciMmBase + R_PCH_XHCI_MEM_BASE),
+ 1,
+ (VOID *) (UINTN) (XhciPciMmBase + R_PCH_XHCI_MEM_BASE)
+ );
+}
+
+/**
+ Tune the USB 2.0 high-speed signals quality.
+
+ @param[in] UsbConfig The PCH Platform Policy for USB configuration
+ @param[in] LpcDeviceId The device ID of LPC
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+
+ @retval EFI_SUCCESS Successfully completed
+ @retval EFI_DEVICE_ERROR Programming is failed
+**/
+VOID
+Usb2PortLengthProgramming (
+ IN PCH_USB_CONFIG *UsbConfig,
+ IN UINT16 LpcDeviceId,
+ IN UINT32 RootComplexBar
+ )
+{
+ EFI_STATUS Status;
+ UINT32 Index;
+ UINT32 Data32And;
+ UINT32 Data32Or;
+#ifdef USB_PRECONDITION_ENABLE_FLAG
+ PCH_SERIES PchSeries;
+ PchSeries = GetPchSeries();
+ ///
+ /// Execute the code if running in PEI phase when USB precondition feature is enabled
+ /// or in DXE phase when USB precondition feature disabled
+ /// If the precondition is enabled and running in DXE phase,
+ /// the code has already run once in PEI but the save S3 script need to run again in DXE phase
+ /// but only run if and only if both EHCI is not disabled
+ ///
+ if ((USB_RUN_IN_PEI || (!USB_PRECONDITION_POLICY_SUPPORT (UsbConfig))) ||
+ ((USB_RUN_IN_DXE) && ((UsbConfig->Usb20Settings[PchEhci1].Enable == PCH_DEVICE_ENABLE) ||
+ ((UsbConfig->Usb20Settings[PchEhci2].Enable == PCH_DEVICE_ENABLE) && (PchSeries == PchH)))))
+ {
+#endif // USB_PRECONDITION_ENABLE_FLAG
+
+ //
+ // Set EHCI AFE USB2 PER PORT register
+ // IOBP registers 0xE5004000 + ((PortNumber+1) * 0x100)
+ //
+ for (Index = 0; Index < GetPchUsbMaxPhysicalPortNum (); Index++) {
+ Data32And = (UINT32)~(0x00007F00);
+ Data32Or = (UINT32) (0x00000000); // BIT[14] (PERPORTTXPEHALF) = 0
+ ASSERT (UsbConfig->PortSettings[Index].Usb20EyeDiagramTuningParam2 < 8);
+ Data32Or |= (UsbConfig->PortSettings[Index].Usb20EyeDiagramTuningParam2 & 0x07) << 11; // BIT[13:11] (PERPORTPETXISET) = Usb20EyeDiagramTuningParam2
+ ASSERT (UsbConfig->PortSettings[Index].Usb20EyeDiagramTuningParam1 < 8);
+ Data32Or |= (UsbConfig->PortSettings[Index].Usb20EyeDiagramTuningParam1 & 0x07) << 8; // BIT[10:08] (PERPORTTXISET) = Usb20EyeDiagramTuningParam1
+ Status = ProgramIobp (
+ RootComplexBar,
+ 0xE5004000 + ((Index + 1) * 0x100),
+ Data32And,
+ Data32Or
+ );
+ ASSERT_EFI_ERROR (Status);
+ Status = PCH_INIT_COMMON_SCRIPT_SAVE_IOBP_S3_ITEM (
+ RootComplexBar,
+ 0xE5004000 + ((Index + 1) * 0x100),
+ Data32And,
+ Data32Or
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
+#ifdef USB_PRECONDITION_ENABLE_FLAG
+ }
+#endif // USB_PRECONDITION_ENABLE_FLAG
+}
+
+VOID
+ConfigureUsbClockGating (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar
+)
+{
+ ConfigureEhciClockGating(PchPlatformPolicy,RootComplexBar);
+ ConfigureXhciClockGating(PchPlatformPolicy,RootComplexBar);
+}
+
+VOID
+ConfigureEhciClockGating (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar
+)
+{
+ UINTN EhciPciMmBase;
+ UINT8 Index;
+ UINT32 Data32And;
+ UINT32 Data32Or;
+ EFI_STATUS Status;
+ PCH_SERIES PchSeries;
+ PchSeries = GetPchSeries();
+ //
+ // Enable EHCI Clock Gating
+ //
+
+ ///
+ /// If LPT-LP when EHCI disabled, Set RCBA + Offset 3A84[2,0] = 1b, 1b
+ ///
+ if (PchSeries == PchLp) {
+ if (PchPlatformPolicy->UsbConfig->Usb20Settings[PchEhci1].Enable == PCH_DEVICE_DISABLE) {
+ MmioOr32 (
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3A84),
+ (UINT32) (BIT2 | BIT0)
+ );
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3A84),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3A84)
+ );
+ }
+ }
+
+ ///
+ /// Set IOBP register 0xE5004001[7:6] to 11b.
+ ///
+ Data32And = (UINT32)~(0);
+ Data32Or = (UINT32) (BIT7 | BIT6);
+ Status = ProgramIobp (
+ RootComplexBar,
+ 0xE5004001,
+ Data32And,
+ Data32Or
+ );
+ ASSERT_EFI_ERROR (Status);
+ Status = PCH_INIT_COMMON_SCRIPT_SAVE_IOBP_S3_ITEM (
+ RootComplexBar,
+ 0xE5004001,
+ Data32And,
+ Data32Or
+ );
+ ///
+ /// For each EHCI's PCI Config space registers
+ ///
+ for (Index = 0; Index < GetPchEhciMaxControllerNum (); Index++) {
+ EhciPciMmBase = MmPciAddress (
+ 0,
+ PchPlatformPolicy->BusNumber,
+ EhciControllersMap[Index].Device,
+ EhciControllersMap[Index].Function,
+ 0
+ );
+ ///
+ /// Set D29/D26:F0 + DCh[5,2,1] to 1b
+ /// Set D29/D26:F0 + DCh[0] to 1b when EHCI controller is disable
+ ///
+ Data32Or = (UINT32) (BIT5 | BIT2 | BIT1);
+ if (PchPlatformPolicy->UsbConfig->Usb20Settings[Index].Enable == PCH_DEVICE_DISABLE) {
+ Data32Or |= (UINT32) (BIT0);
+ }
+ MmioOr32 (EhciPciMmBase + 0xDC, Data32Or);
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (EhciPciMmBase + 0xDC),
+ 1,
+ (VOID *) (UINTN) (EhciPciMmBase + 0xDC)
+ );
+ ///
+ /// Set D29/D26:F0 + 78h[1:0] to 11b
+ ///
+ Data32Or = (UINT32) (BIT1 | BIT0);
+ MmioOr32 (EhciPciMmBase + 0x78, Data32Or);
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (EhciPciMmBase + 0x78),
+ 1,
+ (VOID *) (UINTN) (EhciPciMmBase + 0x78)
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
+}
+
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchUsbCommon.h b/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchUsbCommon.h
new file mode 100644
index 0000000..a4b3a32
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchUsbCommon.h
@@ -0,0 +1,360 @@
+/** @file
+
+ Header file for the PCH USB Common Driver.
+
+@copyright
+ Copyright (c) 2009 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#ifndef _USB_COMMON_H_
+#define _USB_COMMON_H_
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueBase.h"
+#include "PchAccess.h"
+#include "PchPlatformLib.h"
+#include "PchInitCommon.h"
+#endif
+
+#define USB_PR_CASE_0 0
+#define USB_PR_CASE_1 1
+#define USB_PR_CASE_2 2
+#define TEN_MS_TIMEOUT 10000
+#define PORT_RESET_TIMEOUT 10 ///< 100 ms timeout for xHCI port reset
+
+typedef struct {
+ UINT8 Device;
+ UINT8 Function;
+} USB_CONTROLLER;
+
+/**
+ Configures PCH USB controller
+
+ @param[in] UsbConfig The PCH Platform Policy for USB configuration
+ @param[in] EhciMmioBase Memory base address of EHCI Controller
+ @param[in] XhciMmioBase Memory base address of XHCI Controller
+ @param[in] BusNumber PCI Bus Number of the PCH device
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+ @param[out] FuncDisableReg Function Disable Register
+ @param[in] Revision The policy revision used for backward compatible check
+
+ @retval EFI_INVALID_PARAMETER The parameter of PchPlatformPolicy is invalid
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+EFIAPI
+CommonUsbInit (
+ IN PCH_USB_CONFIG *UsbConfig,
+ IN UINT32 EhciMmioBase,
+ IN UINT32 XhciMmioBase,
+ IN UINT8 BusNumber,
+ IN UINT32 RootComplexBar,
+ OUT UINT32 *FuncDisableReg,
+ IN UINT8 Revision
+ );
+
+/**
+ Performs basic configuration of PCH EHCI controller.
+
+ @param[in] UsbConfig The PCH Platform Policy for USB configuration
+ @param[in] EhciMmioBase Memory base address of EHCI Controller
+ @param[in] BusNumber PCI Bus Number of the PCH device
+ @param[in] Revision The policy revision used for backward compatible check
+ @param[in] LpcDeviceId The device ID of LPC
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+EFIAPI
+CommonEhciHcsInit (
+ IN PCH_USB_CONFIG *UsbConfig,
+ IN UINT32 EhciMmioBase,
+ IN UINT8 BusNumber,
+ IN UINT8 Revision,
+ IN UINT16 LpcDeviceId,
+ IN UINT32 RootComplexBar
+ );
+
+/**
+ Performs basic configuration of PCH USB3 (xHCI) controller.
+
+ @param[in] UsbConfig The PCH Platform Policy for USB configuration
+ @param[in] XhciMmioBase Memory base address of xHCI Controller
+ @param[in] Revision The policy revision used for backward compatible check
+ @param[in] LpcDeviceId The device ID of LPC
+ @param[in] XhciPciMmBase XHCI PCI Base Address
+
+ @retval None
+**/
+VOID
+CommonXhciHcInit (
+ IN PCH_USB_CONFIG *UsbConfig,
+ IN UINT32 XhciMmioBase,
+ IN UINT8 Revision,
+ IN UINT16 LpcDeviceId,
+ IN UINTN XhciPciMmBase
+ );
+
+/**
+ Performs basic configuration of PCH USB3 (xHCI) controller.
+
+ @param[in] UsbConfig The PCH Platform Policy for USB configuration
+ @param[in] XhciMmioBase Memory base address of XHCI Controller
+ @param[in] Revision The policy revision used for backward compatible check
+ @param[in] LpcDeviceId The device ID of LPC
+ @param[in] XhciPciMmBase XHCI PCI Base Address
+ @param[in] PciD31F0RegBase LPC PCI Base Address
+
+ @retval None
+**/
+VOID
+PerformXhciEhciPortSwitchingFlow (
+ IN PCH_USB_CONFIG *UsbConfig,
+ IN UINT32 XhciMmioBase,
+ IN UINT8 Revision,
+ IN UINT16 LpcDeviceId,
+ IN UINTN XhciPciMmBase,
+ IN UINTN PciD31F0RegBase
+ );
+
+/**
+ Retrieves information about number of implemented xHCI ports
+ and sets appropriate port mask registers.
+
+ @param[in] XhciPciMmBase XHCI PCI Base Address
+ @param[out] HsPortCount Count of High Speed Ports
+ @param[out] HsUsbrPortCount Count of USBr Port
+ @param[out] SsPortCount Count of Super Speed Ports
+
+ @retval None
+**/
+VOID
+GetXhciPortCountAndSetPortRoutingMask (
+ IN UINTN XhciPciMmBase,
+ OUT UINTN *HsPortCount,
+ OUT UINTN *HsUsbrPortCount,
+ OUT UINTN *SsPortCount
+ );
+
+/**
+ Setup XHCI Over-Current Mapping
+
+ @param[in] UsbConfig The PCH Platform Policy for USB configuration
+ @param[in] XhciPciMmBase XHCI PCI Base Address
+
+ @retval None
+**/
+VOID
+XhciOverCurrentMapping (
+ IN PCH_USB_CONFIG *UsbConfig,
+ IN UINTN XhciPciMmBase
+ );
+
+/**
+ Setup EHCI Over-Current Mapping
+
+ @param[in] UsbConfig The PCH Platform Policy for USB configuration
+ @param[in] Ehci1PciMmBase EHCI 1 PCI Base Address
+ @param[in] Ehci2PciMmBase EHCI 2 PCI Base Address
+
+ @retval None
+**/
+VOID
+EhciOverCurrentMapping (
+ IN PCH_USB_CONFIG *UsbConfig,
+ IN UINTN Ehci1PciMmBase,
+ IN UINTN Ehci2PciMmBase
+ );
+
+/**
+ Program Ehci Port Disable Override
+
+ @param[in] UsbConfig The PCH Platform Policy for USB configuration
+ @param[in] Ehci1PciMmBase EHCI 1 PCI Base Address
+ @param[in] Ehci2PciMmBase EHCI 2 PCI Base Address
+
+ @retval None
+**/
+VOID
+EhciPortDisableOverride (
+ IN PCH_USB_CONFIG *UsbConfig,
+ IN UINTN Ehci1PciMmBase,
+ IN UINTN Ehci2PciMmBase
+ );
+
+/**
+ Program Xhci Port Disable Override
+
+ @param[in] UsbConfig The PCH Platform Policy for USB configuration
+ @param[in] XhciPciMmBase XHCI PCI Base Address
+ @param[in] Revision Platform policy revision
+
+ @retval None
+**/
+VOID
+XhciPortDisableOverride (
+ IN PCH_USB_CONFIG *UsbConfig,
+ IN UINTN XhciPciMmBase,
+ IN UINT8 Revision
+ );
+
+/**
+ Enable EHCI USBR device
+
+ @param[in] EhciPciMmBase Ehci PCI Base Address
+
+ @retval None
+**/
+VOID
+EhciUsbrEnable (
+ IN UINTN EhciPciMmBase
+ );
+
+/**
+ Program and enable XHCI Memory Space
+
+ @param[in] UsbConfig The PCH Platform Policy for USB configuration
+ @param[in] XhciMmioBase Memory base address of XHCI Controller
+ @param[in] XhciPciMmBase XHCI PCI Base Address
+
+ @retval None
+**/
+VOID
+XhciMemorySpaceOpen (
+ IN PCH_USB_CONFIG *UsbConfig,
+ IN UINT32 XhciMmioBase,
+ IN UINTN XhciPciMmBase
+ );
+
+/**
+ Clear and disable XHCI Memory Space
+
+ @param[in] UsbConfig The PCH Platform Policy for USB configuration
+ @param[in] XhciMmioBase Memory base address of XHCI Controller
+ @param[in] XhciPciMmBase XHCI PCI Base Address
+
+ @retval None
+**/
+VOID
+XhciMemorySpaceClose (
+ IN PCH_USB_CONFIG *UsbConfig,
+ IN UINT32 XhciMmioBase,
+ IN UINTN XhciPciMmBase
+ );
+
+/**
+ Tune the USB 2.0 high-speed signals quality.
+
+ @param[in] UsbConfig The PCH Platform Policy for USB configuration
+ @param[in] LpcDeviceId The device ID of LPC
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+
+ @retval None
+**/
+VOID
+Usb2PortLengthProgramming (
+ IN PCH_USB_CONFIG *UsbConfig,
+ IN UINT16 LpcDeviceId,
+ IN UINT32 RootComplexBar
+ );
+
+/**
+ Initialization USB Clock Gating registers
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+
+ @retval None
+**/
+VOID
+ConfigureUsbClockGating (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar
+ );
+
+/**
+ Initialization EHCI Clock Gating registers
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+
+ @retval None
+**/
+VOID
+ConfigureEhciClockGating (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar
+ );
+
+/**
+ Initialization XHCI Clock Gating registers
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+
+ @retval None
+**/
+VOID
+ConfigureXhciClockGating (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar
+ );
+
+#ifdef USB_PRECONDITION_ENABLE_FLAG
+/**
+ Perform USB precondition on EHCI, it is the HC on USB HC in PEI phase;
+ it is the root port reset on installed USB device in DXE phase
+
+ @param[in] Device The device number of the EHCI
+ @param[in] EhciMmioBase Memory base address of EHCI Controller
+
+ @retval None
+**/
+VOID
+EhciPrecondition (
+ IN UINT8 Device,
+ IN UINT32 EhciMmioBase
+ );
+
+/**
+ Perform USB precondition on XHCI, it is the HC on USB HC in PEI phase;
+ it is the root port reset on installed USB device in DXE phase
+
+ @param[in] BusNumber The Bus number of the XHCI
+ @param[in] Device The device number of the XHCI
+ @param[in] Function The function number of the XHCI
+ @param[in] XhciMmioBase Memory base address of XHCI Controller
+ @param[in] XhciUSB2Ptr Pointer to USB2 protocol port register
+ @param[in] HsPortCount The number of USB2 protocol port supported by this XHCI
+
+ @retval None
+**/
+VOID
+XhciPrecondition (
+ IN UINT8 BusNumber,
+ IN UINT8 Device,
+ IN UINT8 Function,
+ IN UINT32 XhciMmioBase,
+ IN UINTN *XhciUSB2Ptr,
+ IN UINTN HsPortCount,
+ IN UINTN *XhciUSB3Ptr,
+ IN UINTN SsPortCount
+ );
+#endif // USB_PRECONDITION_ENABLE_FLAG
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchUsbCommonLib.cif b/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchUsbCommonLib.cif
new file mode 100644
index 0000000..8b9628f
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchUsbCommonLib.cif
@@ -0,0 +1,21 @@
+<component>
+ name = "PchUsbCommonLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\PchInit\Common"
+ RefName = "PchUsbCommonLib"
+[files]
+"PchUsbCommonLib.sdl"
+"PchUsbCommonLib.mak"
+"PchUsbCommon.h"
+"PchUsbCommon.c"
+"PchHSIO.c"
+"PchHSIO.h"
+"PchHSIOLptHB0.c"
+"PchHSIOLptHB0.h"
+"PchInitVar.c"
+"PchInitVar.h"
+"PchHsioLptLpBx.h"
+"PchHsioLptHCx.c"
+"PchHsioLptHCx.h"
+"PchHsioLptLpBx.c"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchUsbCommonLib.mak b/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchUsbCommonLib.mak
new file mode 100644
index 0000000..6abbf99
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchUsbCommonLib.mak
@@ -0,0 +1,127 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchUsbCommonLib/PchUsbCommonLib.mak 2 8/13/12 9:08a Victortu $
+#
+# $Revision: 2 $
+#
+# $Date: 8/13/12 9:08a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchUsbCommonLib/PchUsbCommonLib.mak $
+#
+# 2 8/13/12 9:08a Victortu
+#
+# 1 2/08/12 9:29a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+all : PchUsbCommonLib
+
+!IF "$(PchInitPeim_SUPPORT)" == "1"
+PchUsbCommonLib : PchUsbCommonPeiLib
+!ENDIF
+
+!IF "$(PchInitDxe_SUPPORT)" == "1"
+PchUsbCommonLib : PchUsbCommonDxeLib
+!ENDIF
+
+!IF "$(PchInitPeim_SUPPORT)" == "1"
+!IF "$(PchInitDxe_SUPPORT)" == "1"
+PchUsbCommonLib : PchUsbCommonDxeLib PchUsbCommonPeiLib
+!ENDIF
+!ENDIF
+
+!IF "$(PchInitDxe_SUPPORT)" == "1"
+$(PchUsbCommonDxeLib_LIB) : PchUsbCommonDxeLib
+!ENDIF
+
+!IF "$(PchInitPeim_SUPPORT)" == "1"
+$(PchUsbCommonPeiLib_LIB) : PchUsbCommonPeiLib
+!ENDIF
+
+PchUsbCommonDxeLib : $(BUILD_DIR)\PchUsbCommonLib.mak PchUsbCommonLibDxeBin
+
+PchUsbCommonPeiLib : $(BUILD_DIR)\PchUsbCommonLib.mak PchUsbCommonLibPeiBin
+
+$(BUILD_DIR)\PchUsbCommonLib.mak : $(PchUsbCommonLib_DIR)\$(@B).cif $(PchUsbCommonLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(PchUsbCommonLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+PchUsbCommonLib_INCLUDES=\
+ $(EDK_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+ /I$(INTEL_PCH_DIR)\Protocol\PchInfo\
+
+PchUsbCommonLibDxe_INCLUDES=\
+ $(PchUsbCommonLib_INCLUDES) $(PCH_INITDXE_INCLUDES)
+
+PchUsbCommonLibPeim_INCLUDES=\
+ $(PchUsbCommonLib_INCLUDES) $(PCH_INITPEI_INCLUDES)
+
+PchUsbCommonLib_DEFINES = \
+ $(CFLAGS)
+
+DxeCpuBuildDefine = \
+!IF "$(x64_BUILD)"=="1"
+ /DMDE_CPU_X64\
+!ELSE
+ /DMDE_CPU_IA32\
+!ENDIF
+
+PeimCpuBuildDefine = \
+ /DMDE_CPU_IA32\
+
+PchUsbCommonLibPeim_DEFINES = \
+ $(PchUsbCommonLib_DEFINES)\
+ $(PeimCpuBuildDefine)\
+
+PchUsbCommonLibDxe_DEFINES = \
+ $(PchUsbCommonLib_DEFINES)\
+ $(DxeCpuBuildDefine)\
+
+PchUsbCommonLibDxeBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS) \
+ /f $(BUILD_DIR)\PchUsbCommonLib.mak all\
+ "MY_INCLUDES=$(PchUsbCommonLibDxe_INCLUDES)" \
+ "CFLAGS=$(PchUsbCommonLibDxe_DEFINES)"\
+ TYPE=LIBRARY \
+ LIBRARY_NAME=$(PchUsbCommonDxeLib_LIB)
+
+PchUsbCommonLibPeiBin : $(EFISCRIPTLIB) $(EDKFRAMEWORKPROTOCOLLIB)
+!IF "$(x64_BUILD)"=="1"
+ $(MAKE) /$(MAKEFLAGS) $(EDK_DEFAULTS) BUILD_DIR=$(BUILD_DIR)\IA32 \
+!ELSE
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS) \
+!ENDIF
+ /f $(BUILD_DIR)\PchUsbCommonLib.mak all\
+ "MY_INCLUDES=$(PchUsbCommonLibPeim_INCLUDES)" \
+ "CFLAGS=$(PchUsbCommonLibPeim_DEFINES)"\
+ TYPE=PEI_LIBRARY \
+ LIBRARY_NAME=$(PchUsbCommonPeiLib_LIB)
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchUsbCommonLib.sdl b/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchUsbCommonLib.sdl
new file mode 100644
index 0000000..6d78a0b
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Common/PchUsbCommonLib.sdl
@@ -0,0 +1,81 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchUsbCommonLib/PchUsbCommonLib.sdl 1 2/08/12 9:29a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 9:29a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchUsbCommonLib/PchUsbCommonLib.sdl $
+#
+# 1 2/08/12 9:29a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+TOKEN
+ Name = "PchUsbCommonLib_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable PchUsbCommonLib support in Project"
+ TokenType = Boolean
+ TargetMAK = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "PchUsbCommonLib_DIR"
+End
+
+MODULE
+ Help = "Includes PchUsbCommonLib.mak to Project"
+ File = "PchUsbCommonLib.mak"
+End
+
+ELINK
+ Name = "PchUsbCommonDxeLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$$(LIB_BUILD_DIR)\PchUsbCommonDxeLib.lib"
+ Parent = "PchUsbCommonDxeLib_LIB"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "PchUsbCommonPeiLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$$(LIB_BUILD_DIR)\PchUsbCommonPeiLib.lib"
+ Parent = "PchUsbCommonPeiLib_LIB"
+ InvokeOrder = AfterParent
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchAudioDsp.c b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchAudioDsp.c
new file mode 100644
index 0000000..0045460
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchAudioDsp.c
@@ -0,0 +1,602 @@
+/** @file
+ Configures Audio DSP device
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "PchInit.h"
+
+#ifdef ADSP_FLAG
+#include "PchAslUpdateLib.h"
+
+//
+// AUDIO DSP Memory space definitions
+//
+#define V_PCH_ADSP_MEM_BASE_ADDRESS 0xFE000000
+#define S_PCH_ADSP_ADBAR_LENGTH 0x100000
+#define S_PCH_ADSP_SPCBAR_LENGTH 0x1000
+#define N_PCH_ADSP_ADBAR_ALIGN 16
+#define N_PCH_ADSP_SPCBAR_ALIGN 12
+
+/**
+ Configure AudioDSP SSP lines ownership
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+
+ @retval EFI_SUCCESS ADSP owns all I/O Buffers
+**/
+EFI_STATUS
+ConfigureAudioDspSsp(
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy
+ )
+{
+ UINTN PciAzaliaRegBase;
+
+ ///
+ /// Retrieve Azalia PCI Config base
+ ///
+ PciAzaliaRegBase = MmPciAddress (
+ 0,
+ PchPlatformPolicy->BusNumber,
+ PCI_DEVICE_NUMBER_PCH_AZALIA,
+ PCI_FUNCTION_NUMBER_PCH_AZALIA,
+ 0
+ );
+
+ DEBUG ((EFI_D_INFO, "Audio DSP: Switch HDA pins to ADSP\n"));
+
+ ///
+ /// BIOS is required to set Ownership select of I/O Buffer to Audio DSP.
+ /// Set D27:F0:42h[7:6] = 11b - Audio DSP subsystem owns all the I/O buffers.
+ ///
+ MmioOr8 ((UINTN)(PciAzaliaRegBase + R_PCH_HDA_AZIOBC), (UINT8)B_PCH_HDA_AZIOBC_OSEL);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (PciAzaliaRegBase + R_PCH_HDA_AZIOBC),
+ 1,
+ (VOID *) (UINTN) (PciAzaliaRegBase + R_PCH_HDA_AZIOBC)
+ );
+
+ PchPlatformPolicy->DeviceEnabling->Azalia = PCH_DEVICE_DISABLE;
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Allocates static memory pool for Audio DSP BAR and Shadowed PCI Configuration Space.
+
+ @retval EFI_SUCCESS The function completed successfully
+ @retval EFI_ERROR Error occured on initialization
+**/
+EFI_STATUS
+AllocateAudioDspBar (
+)
+{
+ EFI_PHYSICAL_ADDRESS AdspMemBaseAddress;
+ EFI_PHYSICAL_ADDRESS AdspBar;
+ EFI_PHYSICAL_ADDRESS AdspShadowedPciBar;
+ UINT32 PciAdspRegBase;
+ EFI_STATUS Status;
+
+ DEBUG ((EFI_D_INFO, "Audio DSP: Allocate fixed memory space\n"));
+
+ AdspMemBaseAddress = V_PCH_ADSP_MEM_BASE_ADDRESS;
+
+ Status = gDS->AddMemorySpace (
+ EfiGcdMemoryTypeReserved,
+ AdspMemBaseAddress,
+ S_PCH_ADSP_ADBAR_LENGTH + S_PCH_ADSP_SPCBAR_LENGTH,
+ 0
+ );
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ AdspBar = AdspMemBaseAddress;
+
+ Status = gDS->AllocateMemorySpace (
+ EfiGcdAllocateAddress,
+ EfiGcdMemoryTypeReserved,
+ N_PCH_ADSP_ADBAR_ALIGN,
+ S_PCH_ADSP_ADBAR_LENGTH,
+ &AdspBar,
+ mImageHandle,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+ ASSERT(AdspBar == V_PCH_ADSP_MEM_BASE_ADDRESS);
+
+ AdspShadowedPciBar = AdspMemBaseAddress + S_PCH_ADSP_ADBAR_LENGTH;
+
+ Status = gDS->AllocateMemorySpace (
+ EfiGcdAllocateAddress,
+ EfiGcdMemoryTypeReserved,
+ N_PCH_ADSP_SPCBAR_ALIGN,
+ S_PCH_ADSP_SPCBAR_LENGTH,
+ &AdspShadowedPciBar,
+ mImageHandle,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+ ASSERT(AdspShadowedPciBar == V_PCH_ADSP_MEM_BASE_ADDRESS + S_PCH_ADSP_ADBAR_LENGTH);
+
+ PciAdspRegBase = MmPciAddress (0, 0, PCI_DEVICE_NUMBER_PCH_ADSP, PCI_FUNCTION_NUMBER_PCH_ADSP, 0);
+
+ DEBUG ((EFI_D_INFO, "Audio DSP: Base Address (ADBA) = 0x%04x; Length = 0x%x\n", AdspBar, S_PCH_ADSP_ADBAR_LENGTH));
+
+ MmioWrite32 ((UINTN)(PciAdspRegBase + R_PCH_ADSP_ADBA), (UINT32)AdspBar);
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PciAdspRegBase + R_PCH_ADSP_ADBA),
+ 1,
+ (VOID *)(UINTN) (PciAdspRegBase + R_PCH_ADSP_ADBA)
+ );
+
+ DEBUG ((EFI_D_INFO, "Audio DSP: Shadowed PCI Configuration Base Address (SPCBA) = 0x%04x; Length = 0x%x\n", AdspShadowedPciBar, S_PCH_ADSP_SPCBAR_LENGTH));
+
+ MmioWrite32 ((UINTN)(PciAdspRegBase + R_PCH_ADSP_SPCBA), (UINT32)AdspShadowedPciBar);
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PciAdspRegBase + R_PCH_ADSP_SPCBA),
+ 1,
+ (VOID *)(UINTN) (PciAdspRegBase + R_PCH_ADSP_SPCBA)
+ );
+
+ ///
+ /// Enable memory space access
+ /// Program D19:F0:04h[2:1] = 11b
+ ///
+ MmioOr32 ((UINTN)(PciAdspRegBase + R_PCH_ADSP_COMMAND), (B_PCH_ADSP_COMMAND_BME | B_PCH_ADSP_COMMAND_MSE));
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PciAdspRegBase + R_PCH_ADSP_COMMAND),
+ 1,
+ (VOID *) (UINTN) (PciAdspRegBase + R_PCH_ADSP_COMMAND)
+ );
+
+ return Status;
+}
+
+/**
+ Disables/hides or enables/unhides Audio DSP PCI Configuration Space
+
+ @param[in] PciConfigurationDisable If TRUE, PCI Config Space will be disabled.
+ If FALSE, PCI Config Space will be enabled.
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+
+ @retval EFI_SUCCESS The function completed successfully
+ @retval EFI_DEVICE_ERROR Transaction fail
+**/
+EFI_STATUS
+DisableAudioDspPciConfigSpace(
+ IN BOOLEAN PciConfigurationDisable,
+ IN UINT32 RootComplexBar
+ )
+{
+ UINT32 Data32Or;
+ EFI_STATUS Status;
+
+ if (PciConfigurationDisable) {
+ DEBUG ((EFI_D_INFO, "Audio DSP: Hiding PCI Config Space\n"));
+ Data32Or = B_PCH_ADSP_PCICFGCTL_PCICD;
+ } else {
+ DEBUG ((EFI_D_INFO, "Audio DSP: Unhiding PCI Config Space\n"));
+ Data32Or = 0;
+ }
+
+ Status = ProgramIobp (
+ RootComplexBar,
+ (UINT32) (R_PCH_RCRB_IOBPIRI_IOBPIS_ADSP + R_PCH_ADSP_PCICFGCTL),
+ (UINT32)~(B_PCH_ADSP_PCICFGCTL_PCICD),
+ (UINT32) Data32Or
+ );
+ ASSERT_EFI_ERROR (Status);
+ Status = PCH_INIT_COMMON_SCRIPT_SAVE_IOBP_S3_ITEM (
+ RootComplexBar,
+ (UINT32) (R_PCH_RCRB_IOBPIRI_IOBPIS_ADSP + R_PCH_ADSP_PCICFGCTL),
+ (UINT32)~(B_PCH_ADSP_PCICFGCTL_PCICD),
+ (UINT32) Data32Or
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ return Status;
+}
+
+/**
+ Finalize Audio DSP initialization after PCI enumeration.
+ In particular configure ADSP in ACPI or PCI mode:
+ ACPI - patches ACPI table, sets ACPI IRQ and hides PCI config space.
+ PCI - sets PCI IRQ, does not hide PCI config space.
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+
+ @retval EFI_SUCCESS The function completed successfully
+ @retval EFI_UNSUPPORTED Audio DSP not found or not enabled
+**/
+EFI_STATUS
+ConfigureAudioDspBeforeBoot(
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar
+ )
+{
+ UINT8 Data8;
+ UINT32 Data32;
+ UINT32 PciAdspRegBase;
+ UINT16 AdspDeviceId;
+ EFI_STATUS Status;
+ EFI_STATUS AcpiTablePresent;
+
+ Status = EFI_SUCCESS;
+ AcpiTablePresent = EFI_NOT_FOUND;
+
+ DEBUG ((EFI_D_INFO, "ConfigureAudioDspBeforeBoot() Start\n"));
+
+ if (PchPlatformPolicy->DeviceEnabling->AudioDsp == PCH_DEVICE_ENABLE) {
+
+ PciAdspRegBase = MmPciAddress (
+ 0,
+ PchPlatformPolicy->BusNumber,
+ PCI_DEVICE_NUMBER_PCH_ADSP,
+ PCI_FUNCTION_NUMBER_PCH_ADSP,
+ 0
+ );
+
+ // Unhide ADSP PCI Config Space to do the final initialization
+ Status = DisableAudioDspPciConfigSpace (FALSE, RootComplexBar);
+
+ AdspDeviceId = MmioRead16 (PciAdspRegBase + R_PCH_LPTLP_ADSP_DEVICE_ID);
+
+ if (AdspDeviceId == V_PCH_LPTLP_ADSP_DEVICE_ID) {
+
+ if (PchPlatformPolicy->AudioDspConfig->AudioDspAcpiMode) {
+ //
+ // Locate ACPI table
+ //
+ AcpiTablePresent = InitializePchAslUpdateLib();
+
+ ///
+ /// Assign DSP BARs for ACPI use
+ ///
+ if(!EFI_ERROR(AcpiTablePresent)) {
+ DEBUG ((EFI_D_INFO, "Audio DSP: Updating ACPI tables\n"));
+ Data32 = (MmioRead32(PciAdspRegBase + R_PCH_ADSP_ADBA) & MMIO_ADDR_MASK);
+ UpdateResourceTemplateAslCode((EFI_SIGNATURE_32 ('A', 'D', 'S', 'P')),
+ (EFI_SIGNATURE_32 ('R', 'B', 'U', 'F')),
+ AML_MEMORY32_FIXED_OP,
+ 1,
+ 0x04,
+ &Data32,
+ sizeof(Data32)
+ );
+
+ Data32 = (MmioRead32(PciAdspRegBase + R_PCH_ADSP_SPCBA) & MMIO_ADDR_MASK);
+ UpdateResourceTemplateAslCode((EFI_SIGNATURE_32 ('A', 'D', 'S', 'P')),
+ (EFI_SIGNATURE_32 ('R', 'B', 'U', 'F')),
+ AML_MEMORY32_FIXED_OP,
+ 2,
+ 0x04,
+ &Data32,
+ sizeof(Data32)
+ );
+
+ if (PchPlatformPolicy->AudioDspConfig->AudioDspBluetoothSupport) {
+ DEBUG ((EFI_D_INFO, "Audio DSP: Bluetooth support enabled\n"));
+ Data8 = PCH_DEVICE_ENABLE;
+ UpdateNameAslCode(EFI_SIGNATURE_32('A','B','T','H'), &Data8, sizeof(Data8));
+ }
+
+ if (PchPlatformPolicy->AudioDspConfig->AudioDspAcpiInterruptMode == PCH_DEVICE_DISABLE) {
+ Data8 = 23; // PCI IRQ 23
+ UpdateResourceTemplateAslCode((EFI_SIGNATURE_32 ('A', 'D', 'S', 'P')),
+ (EFI_SIGNATURE_32 ('R', 'B', 'U', 'F')),
+ AML_INTERRUPT_DESC_OP,
+ 1,
+ 0x05,
+ &Data8,
+ sizeof(Data8)
+ );
+ }
+ }
+ }
+
+ if (PchPlatformPolicy->AudioDspConfig->AudioDspAcpiInterruptMode) {
+ DEBUG ((EFI_D_INFO, "Audio DSP: ACPI Interrupt mode\n"));
+
+ ///
+ /// Set Interrupt De-assert/Assert Opcode Override to IRQ3
+ ///
+ Data32 = V_PCH_ADSP_VDLDAT2_IRQ3;
+ Status = ProgramIobp (
+ RootComplexBar,
+ (UINT32) (R_PCH_RCRB_IOBPIRI_IOBPIS_ADSP + R_PCH_ADSP_VDLDAT2),
+ (UINT32)~(V_PCH_ADSP_VDLDAT2_MASK),
+ (UINT32) (Data32)
+ );
+ ASSERT_EFI_ERROR (Status);
+ Status = PCH_INIT_COMMON_SCRIPT_SAVE_IOBP_S3_ITEM (
+ RootComplexBar,
+ (UINT32) (R_PCH_RCRB_IOBPIRI_IOBPIS_ADSP + R_PCH_ADSP_VDLDAT2),
+ (UINT32)~(V_PCH_ADSP_VDLDAT2_MASK),
+ (UINT32) (Data32)
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ // Enable IRQ3 in RCRB
+ MmioOr32 ((UINTN)(RootComplexBar + R_PCH_RCRB_INT_ACPIIRQEN), B_PCH_RCRB_INT_ACPIIRQEN_A3E);
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_INT_ACPIIRQEN),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_RCRB_INT_ACPIIRQEN)
+ );
+
+ // Set ACPI Interrupt Enable bit
+ Data32 = B_PCH_ADSP_PCICFGCTL_ACPIIE;
+
+ } else {
+ DEBUG ((EFI_D_INFO, "Audio DSP: PCI Interrupt mode\n"));
+
+ /// Program D19:F0:3Ch = 23 - INTLN (Interrupt Line) to IRQ23
+ DEBUG ((EFI_D_INFO, "Audio DSP: Set INTLN to IRQ23\n"));
+ MmioWrite32 ((UINTN)(PciAdspRegBase + 0x3C), (UINT32)(0x17));
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PciAdspRegBase + 0x3C),
+ 1,
+ (VOID *)(UINTN) (PciAdspRegBase + 0x3C)
+ );
+
+ // Do not set ACPI Interrupt Enable bit
+ Data32 = 0;
+ }
+
+ ///
+ /// Configure ADSP in ACPI or PCI interrupt mode
+ /// Update ACPI Interrupt Enable (bit 1) in PCICFGCTL (offset 0x500) accordingly
+ ///
+ Status = ProgramIobp (
+ RootComplexBar,
+ (UINT32) (R_PCH_RCRB_IOBPIRI_IOBPIS_ADSP + R_PCH_ADSP_PCICFGCTL),
+ (UINT32)~(B_PCH_ADSP_PCICFGCTL_ACPIIE | B_PCH_ADSP_PCICFGCTL_SPCBAD),
+ (UINT32) (Data32)
+ );
+ ASSERT_EFI_ERROR (Status);
+ Status = PCH_INIT_COMMON_SCRIPT_SAVE_IOBP_S3_ITEM (
+ RootComplexBar,
+ (UINT32) (R_PCH_RCRB_IOBPIRI_IOBPIS_ADSP + R_PCH_ADSP_PCICFGCTL),
+ (UINT32)~(B_PCH_ADSP_PCICFGCTL_ACPIIE | B_PCH_ADSP_PCICFGCTL_SPCBAD),
+ (UINT32) (Data32)
+ );
+
+ if (PchPlatformPolicy->AudioDspConfig->AudioDspAcpiMode) {
+ ///
+ /// Configure ADSP in ACPI mode
+ /// Set PCI Configuration Disable (bit 0) in PCICFGCTL (offset 0x500)
+ ///
+ DEBUG ((EFI_D_INFO, "Audio DSP: ACPI mode\n"));
+ Status = DisableAudioDspPciConfigSpace(TRUE, RootComplexBar);
+ }
+ }
+ }
+
+ DEBUG ((EFI_D_INFO, "ConfigureAudioDspBeforeBoot() End\n"));
+
+ return Status;
+}
+
+/**
+ Initialize Audio DSP subsystem
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+ @param[in, out] FuncDisableReg The value of Function disable register
+
+ @retval EFI_SUCCESS Codec is detected and initialized
+ @retval EFI_UNSUPPORTED Audio DSP disabled
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate resources to initialize the codec
+**/
+EFI_STATUS
+ConfigureAudioDsp (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar,
+ IN OUT UINT32 *FuncDisableReg
+ )
+{
+ UINT32 Data32;
+ UINT32 PciAdspRegBase;
+ UINT32 AdspBar;
+ UINT16 AdspDeviceId;
+ EFI_STATUS Status;
+
+ DEBUG ((EFI_D_INFO, "ConfigureAudioDsp() Start\n"));
+
+ if (PchPlatformPolicy->DeviceEnabling->AudioDsp == PCH_DEVICE_ENABLE) {
+
+ PciAdspRegBase = MmPciAddress (
+ 0,
+ PchPlatformPolicy->BusNumber,
+ PCI_DEVICE_NUMBER_PCH_ADSP,
+ PCI_FUNCTION_NUMBER_PCH_ADSP,
+ 0
+ );
+
+ AdspDeviceId = MmioRead16 (PciAdspRegBase + R_PCH_LPTLP_ADSP_DEVICE_ID);
+
+ if (AdspDeviceId == V_PCH_LPTLP_ADSP_DEVICE_ID) {
+ DEBUG ((EFI_D_INFO, "Audio DSP: Found and Enabled\n"));
+
+ Status = AllocateAudioDspBar();
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ AdspBar = MmioRead32 (PciAdspRegBase + R_PCH_ADSP_ADBA);
+
+ ///
+ /// Set LTR value in DSP Shim LTR Control register to 3ms
+ /// SNOOP_REQ[13] = 1b, SNOOP_SCALE[12:10] = 100b (1ms), SNOOP_VAL[9:0] = 3h
+ ///
+ MmioWrite32 ((UINTN)(AdspBar + (R_PCH_ADSP_SHIM_BASE + R_PCH_ADSP_SHIM_LTRC)), (UINT32)V_PCH_ADSP_SHIM_LTRC);
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (AdspBar + (R_PCH_ADSP_SHIM_BASE + R_PCH_ADSP_SHIM_LTRC)),
+ 1,
+ (VOID *)(UINTN) (AdspBar + (R_PCH_ADSP_SHIM_BASE + R_PCH_ADSP_SHIM_LTRC))
+ );
+
+ ///
+ /// Program VDRTCTL2 D19:F0:A8h[31:0] = FFFh
+ ///
+ MmioWrite32 (PciAdspRegBase + R_PCH_ADSP_VDRTCTL2, (UINT32)V_PCH_ADSP_VDRTCTL2);
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PciAdspRegBase + R_PCH_ADSP_VDRTCTL2),
+ 1,
+ (VOID *)(UINTN) (PciAdspRegBase + R_PCH_ADSP_VDRTCTL2)
+ );
+
+ ///
+ /// Set DSP IOBP register VDLDAT1 (0x624) to 0x040100
+ ///
+ Status = ProgramIobp (
+ RootComplexBar,
+ (UINT32) (R_PCH_RCRB_IOBPIRI_IOBPIS_ADSP + R_PCH_ADSP_VDLDAT1),
+ (UINT32)~(V_PCH_ADSP_VDLDAT1_CCO),
+ (UINT32) (V_PCH_ADSP_VDLDAT1_CCO)
+ );
+ ASSERT_EFI_ERROR (Status);
+ Status = PCH_INIT_COMMON_SCRIPT_SAVE_IOBP_S3_ITEM (
+ RootComplexBar,
+ (UINT32) (R_PCH_RCRB_IOBPIRI_IOBPIS_ADSP + R_PCH_ADSP_VDLDAT1),
+ (UINT32)~(V_PCH_ADSP_VDLDAT1_CCO),
+ (UINT32) (V_PCH_ADSP_VDLDAT1_CCO)
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Set D3 Power Gating Enable
+ /// Program D19:F0:A0h[2:1] = 00b
+ ///
+ Data32 = MmioRead32 (PciAdspRegBase + R_PCH_ADSP_VDRTCTL0);
+ if (PchPlatformPolicy->AudioDspConfig->AudioDspD3PowerGating) {
+ DEBUG ((EFI_D_INFO, "Audio DSP: D3 Power Gating Enabled\n"));
+ Data32 &= ~(B_PCH_ADSP_VDRTCTL0_D3PGD | B_PCH_ADSP_VDRTCTL0_D3SRAMPGD);
+ } else {
+ DEBUG ((EFI_D_INFO, "Audio DSP: D3 Power Gating Disabled\n"));
+ Data32 |= B_PCH_ADSP_VDRTCTL0_D3PGD | B_PCH_ADSP_VDRTCTL0_D3SRAMPGD;
+ }
+
+ MmioWrite32 ((UINTN)(PciAdspRegBase + R_PCH_ADSP_VDRTCTL0), Data32);
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PciAdspRegBase + R_PCH_ADSP_VDRTCTL0),
+ 1,
+ &Data32
+ );
+
+ ///
+ /// Set PSF Snoop to SA
+ /// Program RCBA + 0x3350[10] = 1b
+ ///
+ MmioOr32 ((UINTN)(RootComplexBar + R_PCH_RCRB_CIR3350), (UINT32) BIT10);
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3350),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3350)
+ );
+
+ ///
+ /// Switch I/O Buffers ownership to ADSP
+ ///
+ ConfigureAudioDspSsp (PchPlatformPolicy);
+
+ ///
+ /// Disable ADSP PCI Configuration Space in order
+ /// to avoid Base Adresses override on PCI enumeration
+ ///
+ DisableAudioDspPciConfigSpace (TRUE, RootComplexBar);
+
+ }
+
+ Status = EFI_SUCCESS;
+ }
+ else {
+ DEBUG ((EFI_D_INFO, "Audio DSP: Disabled\n"));
+ ///
+ /// Set RCBA + 2B1Ch[29] = 1b
+ ///
+ MmioOr32 ((UINTN)(RootComplexBar + 0x2B1C), (UINT32)BIT29);
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + 0x2B1C),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + 0x2B1C)
+ );
+
+ ///
+ /// Set Audio DSP function disable by programming RCBA + 3418h[1] = 1b
+ ///
+ *FuncDisableReg |= B_PCH_RCRB_FUNC_DIS_ADSP;
+ Status = EFI_SUCCESS;
+ }
+
+ ///
+ /// Set DSP IOBP register PMCTL (0x1E0) to 0x3F
+ /// This should be set for both: ADSP enabled and disabled
+ ///
+ Status = ProgramIobp (
+ RootComplexBar,
+ (UINT32) (R_PCH_RCRB_IOBPIRI_IOBPIS_ADSP + R_PCH_ADSP_PMCTL),
+ (UINT32)~(V_PCH_ADSP_PMCTL),
+ (UINT32) (V_PCH_ADSP_PMCTL)
+ );
+ ASSERT_EFI_ERROR (Status);
+ Status = PCH_INIT_COMMON_SCRIPT_SAVE_IOBP_S3_ITEM (
+ RootComplexBar,
+ (UINT32) (R_PCH_RCRB_IOBPIRI_IOBPIS_ADSP + R_PCH_ADSP_PMCTL),
+ (UINT32)~(V_PCH_ADSP_PMCTL),
+ (UINT32) (V_PCH_ADSP_PMCTL)
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ DEBUG ((EFI_D_INFO, "ConfigureAudioDsp() End\n"));
+
+ return Status;
+}
+
+#endif // ADSP_FLAG
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchAzalia.c b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchAzalia.c
new file mode 100644
index 0000000..a0c7535
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchAzalia.c
@@ -0,0 +1,915 @@
+/** @file
+ Initializes the PCH Azalia codec.
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "PchInit.h"
+
+/**
+ Polling the Status bit
+
+ @param[in] StatusReg The regsiter address to read the status
+ @param[in] PollingBitMap The bit mapping for polling
+ @param[in] PollingData The Data for polling
+
+ @retval EFI_SUCCESS The function completed successfully
+ @retval EFI_TIMEOUT Polling the bit map time out
+**/
+EFI_STATUS
+StatusPolling (
+ IN UINT32 StatusReg,
+ IN UINT16 PollingBitMap,
+ IN UINT16 PollingData
+ )
+{
+ UINT32 LoopTime;
+
+ for (LoopTime = 0; LoopTime < AZALIA_MAX_LOOP_TIME; LoopTime++) {
+ if ((MmioRead16 (StatusReg) & PollingBitMap) == PollingData) {
+ break;
+ } else {
+ PchPmTimerStall (AZALIA_WAIT_PERIOD);
+ }
+ }
+
+ if (LoopTime >= AZALIA_MAX_LOOP_TIME) {
+ return EFI_TIMEOUT;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Send the command to the codec via the Immediate Command mechanism is written
+ to the IC register
+
+ @param[in] HdaBar Base address of Intel HD Audio memory mapped configuration registers
+ @param[in, out] CodecCommandData The Codec Command to be sent to the codec
+ @param[in] ReadBack Whether to get the response received from the codec
+
+ @retval EFI_DEVICE_ERROR Device status error, operation failed
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+SendCodecCommand (
+ IN UINT32 HdaBar,
+ IN OUT UINT32 *CodecCommandData,
+ IN BOOLEAN ReadBack
+ )
+{
+ EFI_STATUS Status;
+
+ Status = StatusPolling (HdaBar + R_HDA_IRS, (UINT16) B_HDA_IRS_ICB, (UINT16) 0);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "ICB bit is not zero before SendCodecCommand! \n"));
+ return EFI_DEVICE_ERROR;
+ }
+
+ MmioWrite32 (HdaBar + R_HDA_IC, *CodecCommandData);
+ MmioOr16 ((UINTN) (HdaBar + R_HDA_IRS), (UINT16) ((B_HDA_IRS_IRV | B_HDA_IRS_ICB)));
+
+ Status = StatusPolling (HdaBar + R_HDA_IRS, (UINT16) B_HDA_IRS_ICB, (UINT16) 0);
+ if (EFI_ERROR (Status)) {
+ MmioAnd16 ((UINTN) (HdaBar + R_HDA_IRS), (UINT16)~(B_HDA_IRS_ICB));
+ return Status;
+ }
+
+ if (ReadBack == TRUE) {
+ if ((MmioRead16 (HdaBar + R_HDA_IRS) & B_HDA_IRS_IRV) != 0) {
+ *CodecCommandData = MmioRead32 (HdaBar + R_HDA_IR);
+ } else {
+ DEBUG ((EFI_D_ERROR, "SendCodecCommand: ReadBack fail! \n"));
+ return EFI_DEVICE_ERROR;
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Set a "Send Codec Command" S3 dispatch item
+
+ @param[in] HdaBar Base address of Intel HD Audio memory mapped configuration registers
+ @param[in, out] CodecCommandData The Codec Command to be sent to the codec
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+SendCodecCommandS3Item (
+ IN UINT32 HdaBar,
+ IN OUT UINT32 CodecCommandData
+ )
+{
+ EFI_STATUS Status;
+#ifdef EFI_S3_RESUME
+ STATIC EFI_PCH_S3_SUPPORT_PROTOCOL *PchS3Support;
+ STATIC EFI_PCH_S3_PARAMETER_SEND_CODEC_COMMAND S3ParameterSendCodecCommand;
+ STATIC EFI_PCH_S3_DISPATCH_ITEM S3DispatchItem = {
+ PchS3ItemTypeSendCodecCommand,
+ &S3ParameterSendCodecCommand
+ };
+ EFI_PHYSICAL_ADDRESS S3DispatchEntryPoint;
+
+ if (!PchS3Support) {
+ ///
+ /// Get the PCH S3 Support Protocol
+ ///
+ Status = gBS->LocateProtocol (
+ &gEfiPchS3SupportProtocolGuid,
+ NULL,
+ (VOID **) &PchS3Support
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ }
+
+ S3ParameterSendCodecCommand.HdaBar = HdaBar;
+ S3ParameterSendCodecCommand.CodecCmdData = CodecCommandData;
+ Status = PchS3Support->SetDispatchItem (
+ PchS3Support,
+ &S3DispatchItem,
+ &S3DispatchEntryPoint
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Save the script dispatch item in the Boot Script
+ ///
+ SCRIPT_DISPATCH (EFI_ACPI_S3_RESUME_SCRIPT_TABLE, S3DispatchEntryPoint);
+#else
+ Status = EFI_SUCCESS;
+#endif
+ return Status;
+}
+
+/**
+ Initialize the Intel High Definition Audio Codec(s) present in the system.
+ For each codec, a predefined codec verb table should be programmed.
+ The list contains 32-bit verbs to be sent to the corresponding codec.
+ If it is not programmed, the codec uses the default verb table, which may or may not
+ correspond to the platform jack information.
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+ @param[in] RootComplexBar RootComplexBar address of this PCH device
+ @param[in, out] AzaliaStarted Whether Azalia is successfully started
+
+ @retval EFI_SUCCESS The function completed successfully
+ @retval EFI_INVALID_PARAMETER Provided VerbTableData is null
+**/
+EFI_STATUS
+DetectAndInitializeAzalia (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar,
+ IN OUT BOOLEAN *AzaliaStarted
+ )
+{
+ EFI_STATUS Status;
+ UINT32 Index;
+ UINT32 VendorDeviceId;
+ UINT32 RevisionId;
+ UINT8 ByteReg;
+ UINTN AzaliaBase;
+ UINT8 AzaliaSDINo;
+ UINT32 HdaBar;
+ UINT32 *VerbTable;
+ UINT32 LoopTime;
+ PCH_AZALIA_VERB_TABLE_HEADER *VerbHeaderTable;
+ EFI_PHYSICAL_ADDRESS BaseAddressBarMem;
+ UINT8 VerbTableNum;
+ PCH_AZALIA_CONFIG *AzaliaConfig;
+ UINT32 Data32And;
+ UINT32 Data32Or;
+ UINT16 Data16And;
+ UINT16 Data16Or;
+ UINT8 Data8And;
+ UINT8 Data8Or;
+ UINT32 CodecCmdData;
+ UINTN PciD31F0RegBase;
+ UINT16 LpcDeviceId;
+ UINT16 Data16;
+ UINT16 BitMask;
+ UINT16 BitValue;
+ PCH_SERIES PchSeries;
+
+ PchSeries = GetPchSeries();
+ AzaliaConfig = PchPlatformPolicy->AzaliaConfig;
+ AzaliaBase = MmPciAddress (
+ 0,
+ PchPlatformPolicy->BusNumber,
+ PCI_DEVICE_NUMBER_PCH_AZALIA,
+ PCI_FUNCTION_NUMBER_PCH_AZALIA,
+ 0
+ );
+ PciD31F0RegBase = MmPciAddress (
+ 0,
+ PchPlatformPolicy->BusNumber,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ 0
+ );
+ LpcDeviceId = MmioRead16 (PciD31F0RegBase + R_PCH_LPC_DEVICE_ID);
+
+ Data32And = 0xF8FFFF01;
+ if ((MmioRead32 ((UINTN) (RootComplexBar + R_PCH_RCRB_CIR2030)) & (UINT32) BIT31) != 0) {
+ ///
+ /// PCH BIOS Spec Rev 0.5.0 Section 9.4.2 High Definition Audio VCi Configuration
+ /// For Sever
+ /// Step 1
+ /// Configure and enable Vcp on DMI, done on PchDmiPeim.c
+ /// Step 2
+ /// Assign a Vcp ID value of 2 to High Definition Audio VCi ID field of VCi Resource Control register
+ /// D27:F0:Reg 120h[26:24] = 2
+ /// Step 3
+ /// Map Tcp to VCP. Set bit 2 of TC/VCi Map field of High Definition Audio VCi Resource Control register
+ /// D27:F0:Reg 120h[7:1]
+ ///
+ Data32Or = BIT25;
+ Data32Or |= MmioRead32 ((UINTN) (RootComplexBar + R_PCH_RCRB_CIR2030)) & V_PCH_RCRB_V1CTL_TVM_MASK;
+ MmioAndThenOr32 (
+ (UINTN) (AzaliaBase + R_PCH_HDA_VCICTL),
+ Data32And, // Data to be ANDed
+ Data32Or // Data to be ORed
+ );
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (AzaliaBase + R_PCH_HDA_VCICTL),
+ &Data32Or, // Data to be ORed
+ &Data32And // Data to be ANDed
+ );
+ ///
+ /// Step 4
+ /// Avoid isochronous transfers to use VC1, Clear No Snoop Enable of Device Control Register
+ /// D27:F0:Reg 78h[11] = 0b
+ ///
+ if (PchSeries == PchH) {
+ MmioAnd16 (
+ (UINTN) (AzaliaBase + R_PCH_HDA_DEVC),
+ (UINT16) (~B_PCH_HDA_DEVC_NSNPEN)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (AzaliaBase + R_PCH_HDA_DEVC),
+ 1,
+ (VOID *) (UINTN) (AzaliaBase + R_PCH_HDA_DEVC)
+ );
+ }
+ }
+ if ((MmioRead32 ((UINTN) (AzaliaBase + R_PCH_HDA_VCICTL)) & B_PCH_HDA_VCICTL_ID) != 0) {
+ ///
+ /// Step 5
+ /// Clear the TC/VC0 Map field of VC0 Resource Control register
+ /// D27:F0:Reg 114h[7:1] = 0
+ ///
+ MmioAnd32 (
+ (UINTN) (AzaliaBase + R_PCH_HDA_VC0CTL),
+ (UINT32) (~B_PCH_HDA_VC0CTL_TCVC0_MAP)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (AzaliaBase + R_PCH_HDA_VC0CTL),
+ 1,
+ (VOID *) (UINTN) (AzaliaBase + R_PCH_HDA_VC0CTL)
+ );
+ ///
+ /// Step 6
+ /// For LPT-H, Set VCi Enable bit of VCi Resource Control register
+ /// D27:F0:Reg 120h[31] = 1
+ /// For LPT-LP, Clear VCi Enable bit of VCi Resource Control register
+ /// D27:F0:Reg 120h[31] = 0
+ ///
+ if (PchSeries == PchH) {
+ MmioOr32 ((UINTN) (AzaliaBase + R_PCH_HDA_VCICTL), (UINT32) (B_PCH_HDA_VCICTL_EN));
+ }
+ if (PchSeries == PchLp) {
+ MmioAnd32 ((UINTN) (AzaliaBase + R_PCH_HDA_VCICTL), (UINT32)~(B_PCH_HDA_VCICTL_EN));
+ }
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (AzaliaBase + R_PCH_HDA_VCICTL),
+ 1,
+ (VOID *) (UINTN) (AzaliaBase + R_PCH_HDA_VCICTL)
+ );
+ }
+ ///
+ /// Firstly Initialize Azalia to be not started.
+ ///
+ *AzaliaStarted = FALSE;
+
+ ///
+ /// Allocate resource for HDBAR
+ ///
+ BaseAddressBarMem = 0x0FFFFFFFF;
+ Status = gDS->AllocateMemorySpace (
+ EfiGcdAllocateMaxAddressSearchBottomUp,
+ EfiGcdMemoryTypeMemoryMappedIo,
+ 14,
+ V_PCH_HDA_HDBAR_SIZE,
+ &BaseAddressBarMem,
+ mImageHandle,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ ///
+ /// System BIOS should ensure that the High Definition Audio HDBAR D27:F0:Reg 10-17h contains a valid address value
+ /// and is enabled by setting D27:F0:Reg 04h[1].
+ ///
+ HdaBar = (UINT32) BaseAddressBarMem;
+ MmioWrite32 (AzaliaBase + R_PCH_HDA_HDBARL, HdaBar);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (AzaliaBase + R_PCH_HDA_HDBARL),
+ 1,
+ (VOID *) (UINTN) (AzaliaBase + R_PCH_HDA_HDBARL)
+ );
+
+ MmioWrite32 (AzaliaBase + R_PCH_HDA_HDBARU, 0);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (AzaliaBase + R_PCH_HDA_HDBARU),
+ 1,
+ (VOID *) (UINTN) (AzaliaBase + R_PCH_HDA_HDBARU)
+ );
+
+ MmioOr16 ((UINTN) (AzaliaBase + R_PCH_HDA_COMMAND), (UINT16) B_PCH_HDA_COMMAND_MSE);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (AzaliaBase + R_PCH_HDA_COMMAND),
+ 1,
+ (VOID *) (UINTN) (AzaliaBase + R_PCH_HDA_COMMAND)
+ );
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.0 Section 9.5
+ /// Additional High Definition Audio Programming Steps
+ ///
+ if(PchSeries == PchH) {
+ ///
+ /// Step 1
+ /// Set D27:F0:43h[4] = 1b
+ ///
+ Data8And = (UINT8) ~0;
+ Data8Or = BIT4;
+ MmioOr8 ((UINTN) (AzaliaBase + 0x43), Data8Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (AzaliaBase + 0x43),
+ &Data8Or, // Data to be ORed
+ &Data8And // Data to be ANDed
+ );
+ ///
+ /// Step 2
+ /// Set D27:F0:C0h[17] = 1b
+ ///
+ Data32And = (UINT32) ~0;
+ Data32Or = BIT17;
+ MmioOr32 ((UINTN) (AzaliaBase + 0xC0), Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (AzaliaBase + 0xC0),
+ &Data32Or, // Data to be ORed
+ &Data32And // Data to be ANDed
+ );
+ }
+ ///
+ /// For LPT-LP, clear D27:F0:43h[6] = 0b
+ ///
+ if(PchSeries == PchLp) {
+ ///
+ /// Step 1
+ /// Set D27:F0:43h[6] = 0b
+ ///
+ MmioAnd8 ((UINTN) (AzaliaBase + 0x43), (UINT8) (~BIT6));
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (AzaliaBase + 0x43),
+ 1,
+ (VOID *) (UINTN) (AzaliaBase + 0x43)
+ );
+ }
+
+ ///
+ /// Step 3
+ /// For LPT-H, Set D27:F0:C4h[14] = 1b
+ /// For LPT-LP, Set D27:F0:C4h[24] = 1b
+ ///
+ Data32And = (UINT32) ~0;
+ Data32Or = 0;
+ if (PchSeries == PchH) {
+ Data32Or |= BIT14;
+ }
+ if (PchSeries == PchLp) {
+ Data32Or |= BIT24;
+ }
+ MmioOr32 ((UINTN) (AzaliaBase + 0xC4), Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (AzaliaBase + 0xC4),
+ &Data32Or, // Data to be ORed
+ &Data32And // Data to be ANDed
+ );
+
+ if (PchSeries == PchH) {
+ ///
+ /// Step 4
+ /// Set D27:F0:D0h[31] = 0b
+ ///
+ Data32And = ~BIT31;
+ Data32Or = (UINT32) 0;
+ MmioAnd32 ((UINTN) (AzaliaBase + 0xD0), Data32And);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (AzaliaBase + 0xD0),
+ &Data32Or, // Data to be ORed
+ &Data32And // Data to be ANDed
+ );
+ }
+
+ if (AzaliaConfig->DS == PCH_DEVICE_DISABLE) {
+ MmioAnd8 ((UINTN) (AzaliaBase + R_PCH_HDA_DCKSTS), (UINT8) (~B_PCH_HDA_DCKSTS_DS));
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (AzaliaBase + R_PCH_HDA_DCKSTS),
+ 1,
+ (VOID *) (UINTN) (AzaliaBase + R_PCH_HDA_DCKSTS)
+ );
+ } else if (AzaliaConfig->DA != PCH_DEVICE_DISABLE) {
+ if ((MmioRead8 (AzaliaBase + R_PCH_HDA_DCKSTS) & B_PCH_HDA_DCKSTS_DM) == 0) {
+ MmioOr8 ((UINTN) (AzaliaBase + R_PCH_HDA_DCKCTL), (UINT8) (B_PCH_HDA_DCKCTL_DA));
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (AzaliaBase + R_PCH_HDA_DCKCTL),
+ 1,
+ (VOID *) (UINTN) (AzaliaBase + R_PCH_HDA_DCKCTL)
+ );
+ }
+ }
+
+ if (PchSeries == PchLp) {
+ ///
+ /// @todo: Policy check to bypass for PO
+ /// Set Hdabar + 0x0012h[0] to 1b
+ ///
+ Data16And = (UINT16)~BIT0;
+ Data16Or = (UINT16) (BIT0);
+ MmioOr16 ((UINTN) (HdaBar + 0x0012), Data16Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (HdaBar + 0x0012),
+ &Data16Or, // Data to be ORed
+ &Data16And // Data to be ANDed
+ );
+
+ ///
+ /// W/A: Azalia BCLK is not at full swing when operating in high voltage mode
+ /// Set D27:F0:42h[2] = 1b - disabling Auto Voltage Detector.
+ ///
+ MmioOr8 ((UINTN)(AzaliaBase + R_PCH_HDA_AZIOBC), (UINT8)B_PCH_HDA_AZIOBC_AVDDIS);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (AzaliaBase + R_PCH_HDA_AZIOBC),
+ 1,
+ (VOID *) (UINTN) (AzaliaBase + R_PCH_HDA_AZIOBC)
+ );
+ }
+ ///
+ /// PCH BIOS Spec Rev 0.5.0 Section 9.1.3 Codec Initialization Programming Sequence
+ /// System BIOS should also ensure that the Controller Reset# bit of Global Control register
+ /// in memory-mapped space (HDBAR+08h[0]) is set to 1 and read back as 1.
+ /// Deassert the HDA controller RESET# to start up the link
+ ///
+ Data32And = 0xFFFFFFFF;
+ Data32Or = (UINT32) (B_HDA_GCTL_CRST);
+ MmioOr32 ((UINTN) (HdaBar + R_HDA_GCTL), Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (HdaBar + R_HDA_GCTL),
+ &Data32Or, // Data to be ORed
+ &Data32And // Data to be ANDed
+ );
+
+ BitMask = (UINT16) B_HDA_GCTL_CRST;
+ BitValue = (UINT16) B_HDA_GCTL_CRST;
+ Status = StatusPolling (HdaBar + R_HDA_GCTL, BitMask, BitValue);
+ SCRIPT_MEM_POLL (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ HdaBar + R_HDA_GCTL,
+ &BitMask,
+ &BitValue,
+ AZALIA_WAIT_PERIOD,
+ AZALIA_MAX_LOOP_TIME
+ );
+ ///
+ /// PCH BIOS Spec Rev 0.5.0 Section 9.1.3 Codec Initialization Programming Sequence
+ /// Read GCAP and write the same value back to the register once after Controller Reset# bit is set
+ ///
+ Data16 = MmioRead16 (HdaBar + R_HDA_GCAP);
+ MmioWrite16 (HdaBar + R_HDA_GCAP, Data16);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (HdaBar + R_HDA_GCAP),
+ 1,
+ (VOID *) (UINTN) (HdaBar + R_HDA_GCAP)
+ );
+
+ ///
+ /// Clear the "State Change Status Register" STATESTS bits for
+ /// each of the "SDIN Stat Change Status Flag"
+ ///
+ Data16 = AZALIA_MAX_SID_MASK_PCH_H;
+ if (PchSeries == PchLp) {
+ Data16 = AZALIA_MAX_SID_MASK_PCH_LP;
+ }
+ MmioOr8 ((UINTN) (HdaBar + R_HDA_STATESTS), (UINT8) (Data16));
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (HdaBar + R_HDA_STATESTS),
+ 1,
+ (VOID *) (UINTN) (HdaBar + R_HDA_STATESTS)
+ );
+
+ ///
+ /// Turn off the link and poll RESET# bit until it reads back as 0 to get hardware reset report
+ ///
+ Data32And = (UINT32) (~B_HDA_GCTL_CRST);
+ Data32Or = (UINT32) 0;
+ MmioAnd32 ((UINTN) (HdaBar + R_HDA_GCTL), Data32And);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (HdaBar + R_HDA_GCTL),
+ &Data32Or, // Data to be ORed
+ &Data32And // Data to be ANDed
+ );
+
+ BitMask = (UINT16) B_HDA_GCTL_CRST;
+ BitValue = 0;
+ Status = StatusPolling (HdaBar + R_HDA_GCTL, BitMask, BitValue);
+ SCRIPT_MEM_POLL (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ HdaBar + R_HDA_GCTL,
+ &BitMask,
+ &BitValue,
+ AZALIA_WAIT_PERIOD,
+ AZALIA_MAX_LOOP_TIME
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "Reset High Definition Audio (Azalia) Codec Time Out - 1! \n"));
+ goto ExitInitAzalia;
+ }
+ ///
+ /// Turn on the link and poll RESET# bit until it reads back as 1
+ ///
+ Data32And = 0xFFFFFFFF;
+ Data32Or = (UINT32) (B_HDA_GCTL_CRST);
+ MmioOr32 ((UINTN) (HdaBar + R_HDA_GCTL), Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (HdaBar + R_HDA_GCTL),
+ &Data32Or, // Data to be ORed
+ &Data32And // Data to be ANDed
+ );
+ ///
+ /// For some combo card that will need this delay because each codec has different latency to come out from RESET.
+ /// This delay can make sure all codecs be recognized by BIOS after RESET sequence.
+ /// Additional delay might be required to allow codec coming out of reset prior to subsequent operations,
+ /// please contact your codec vendor for detail. When clearing this bit and setting it afterward,
+ /// BIOS must ensure that minimum link timing requirements (minimum RESET# assertion time, etc.) are met..
+ ///
+ PchPmTimerStall (AzaliaConfig->ResetWaitTimer);
+ SCRIPT_STALL (EFI_ACPI_S3_RESUME_SCRIPT_TABLE, AzaliaConfig->ResetWaitTimer);
+
+ BitMask = (UINT16) B_HDA_GCTL_CRST;
+ BitValue = (UINT16) B_HDA_GCTL_CRST;
+ Status = StatusPolling (HdaBar + R_HDA_GCTL, BitMask, BitValue);
+ SCRIPT_MEM_POLL (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ HdaBar + R_HDA_GCTL,
+ &BitMask,
+ &BitValue,
+ AZALIA_WAIT_PERIOD,
+ AZALIA_MAX_LOOP_TIME
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "Reset High Definition Audio (Azalia) Codec Time Out - 2! \n"));
+ goto ExitInitAzalia;
+ }
+ ///
+ /// Read the "State Change Status Register" STATESTS bits twice to find out if any SDIN is connected
+ /// to a codec.
+ ///
+ Data16 = AZALIA_MAX_SID_MASK_PCH_H;
+ if (PchSeries == PchLp) {
+ Data16 = AZALIA_MAX_SID_MASK_PCH_LP;
+ }
+ for (LoopTime = 0, ByteReg = 0, AzaliaSDINo = 0; LoopTime < AZALIA_MAX_LOOP_TIME; LoopTime++) {
+ ByteReg = (UINT8)(MmioRead8 (HdaBar + R_HDA_STATESTS) & Data16);
+ if (ByteReg != 0 && (ByteReg == AzaliaSDINo)) {
+ break;
+ } else {
+ AzaliaSDINo = ByteReg;
+ }
+
+ PchPmTimerStall (AZALIA_WAIT_PERIOD);
+ }
+ ///
+ /// BIT3(1000) -- SDI3
+ /// BIT2(0100) -- SDI2
+ /// BIT1(0010) -- SDI1
+ /// BIT0(0001) -- SDI0
+ ///
+ if (ByteReg == 0) {
+ ///
+ /// No Azalia Detected
+ ///
+ ///
+ /// Turn off the link
+ ///
+ DEBUG ((EFI_D_ERROR, "No Azalia device is detected.\n"));
+ Data32And = (UINT32) (~B_HDA_GCTL_CRST);
+ Data32Or = (UINT32) 0;
+ MmioAnd32 ((UINTN) (HdaBar + R_HDA_GCTL), Data32And);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (HdaBar + R_HDA_GCTL),
+ &Data32Or, // Data to be ORed
+ &Data32And // Data to be ANDed
+ );
+ Status = EFI_DEVICE_ERROR;
+ goto ExitInitAzalia;
+ }
+ ///
+ /// PME Enable for Audio controller, this bit is in the resume well
+ ///
+ if (AzaliaConfig->Pme == PCH_DEVICE_ENABLE) {
+ MmioOr32 ((UINTN) (AzaliaBase + R_PCH_HDA_PCS), (UINT32) (B_PCH_HDA_PCS_PMEE));
+#ifdef SUS_WELL_RESTORE
+ ///
+ /// To support RapidStart resume from G3 state, all resume well registers need to be saved
+ /// into S3 Script table.
+ ///
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (AzaliaBase + R_PCH_HDA_PCS),
+ 1,
+ (VOID *) (UINTN) (AzaliaBase + R_PCH_HDA_PCS)
+ );
+#endif
+ }
+
+ Data16 = AZALIA_MAX_SID_NUMBER_PCH_H;
+ if (PchSeries == PchLp) {
+ Data16 = AZALIA_MAX_SID_NUMBER_PCH_LP;
+ }
+ for (AzaliaSDINo = 0; AzaliaSDINo < Data16; AzaliaSDINo++, ByteReg >>= 1) {
+ if ((ByteReg & 0x1) == 0) {
+ ///
+ /// SDIx has no Azalia Device
+ ///
+ DEBUG ((EFI_D_ERROR, "SDI%d has no Azalia device.\n", AzaliaSDINo));
+ continue;
+ }
+ ///
+ /// PME Enable for each existing codec, these bits are in the resume well
+ ///
+ if (AzaliaConfig->Pme != PCH_DEVICE_DISABLE) {
+ MmioOr16 (
+ (UINTN) (HdaBar + R_HDA_WAKEEN),
+ (UINT16) ((B_HDA_WAKEEN_SDI_0 << AzaliaSDINo))
+ );
+#ifdef SUS_WELL_RESTORE
+ ///
+ /// To support RapidStart resume from G3 state, all resume well registers need to be saved
+ /// into S3 Script table.
+ ///
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (HdaBar + R_HDA_WAKEEN),
+ 1,
+ (VOID *) (UINTN) (HdaBar + R_HDA_WAKEEN)
+ );
+#endif
+ }
+ ///
+ /// Verb: 31~28 27 26~20 19~0
+ /// CAd 1 NID Verb Command and data
+ /// 0/1/2
+ ///
+ /// Read the Vendor ID/Device ID pair from the attached codec
+ ///
+ VendorDeviceId = 0x000F0000 | (AzaliaSDINo << 28);
+ Status = SendCodecCommand (HdaBar, &VendorDeviceId, TRUE);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "Read the Codec Vendor ID/Device ID fail! \n"));
+ goto ExitInitAzalia;
+ }
+ ///
+ /// Read the Revision ID from the attached codec
+ ///
+ RevisionId = 0x000F0002 | (AzaliaSDINo << 28);
+ Status = SendCodecCommand (HdaBar, &RevisionId, TRUE);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "Read the Codec Revision ID fail! \n"));
+ goto ExitInitAzalia;
+ }
+
+ RevisionId = (RevisionId >> 8) & 0xFF;
+
+ ///
+ /// Get the match codec verb table, RevID of 0xFF applies to all steppings.
+ ///
+ for (VerbTableNum = 0, VerbHeaderTable = NULL, VerbTable = NULL;
+ VerbTableNum < AzaliaConfig->AzaliaVerbTableNum;
+ VerbTableNum++) {
+ if ((VendorDeviceId == AzaliaConfig->AzaliaVerbTable[VerbTableNum].VerbTableHeader.VendorDeviceId) &&
+ ((AzaliaConfig->AzaliaVerbTable[VerbTableNum].VerbTableHeader.RevisionId == 0xFF) ||
+ ( RevisionId == AzaliaConfig->AzaliaVerbTable[VerbTableNum].VerbTableHeader.RevisionId))) {
+ VerbHeaderTable = &(AzaliaConfig->AzaliaVerbTable[VerbTableNum].VerbTableHeader);
+ VerbTable = AzaliaConfig->AzaliaVerbTable[VerbTableNum].VerbTableData;
+ if (VerbTable == 0) {
+ DEBUG ((EFI_D_ERROR | EFI_D_INFO, "VerbTableData of VendorID:0x%X is null.\n", VendorDeviceId));
+ Status = EFI_INVALID_PARAMETER;
+ goto ExitInitAzalia;
+ }
+ DEBUG ((EFI_D_INFO, "Detected Azalia Codec with verb table, VendorID = 0x%X", VendorDeviceId));
+ DEBUG ((EFI_D_INFO, " on SDI%d, revision = 0x%0x.\n", AzaliaSDINo, RevisionId));
+ ///
+ /// Send the entire list of verbs in the matching verb table one by one to the codec
+ ///
+ for (Index = 0;
+ Index < (UINT32) ((VerbHeaderTable->NumberOfFrontJacks + VerbHeaderTable->NumberOfRearJacks) * 4);
+ Index++) {
+ ///
+ /// Clear CAd Field
+ ///
+ CodecCmdData = VerbTable[Index] & (UINT32) ~(BIT31 | BIT30 | BIT29 | BIT28);
+ ///
+ /// Program CAd Field per the SDI number got during codec detection
+ ///
+ CodecCmdData |= (UINT32) (AzaliaSDINo << 28);
+ Status = SendCodecCommand (HdaBar, &CodecCmdData, FALSE);
+ if (EFI_ERROR (Status)) {
+ ///
+ /// Skip the Azalia verb table loading when find the verb table content is not
+ /// properly matched with the HDA hardware, though IDs match.
+ ///
+ DEBUG (
+ (EFI_D_ERROR | EFI_D_INFO,
+ "Detected Azalia Codec of VendorID:0x%X, error occurs during loading verb table.\n",
+ VendorDeviceId)
+ );
+ goto ExitInitAzalia;
+ }
+ SendCodecCommandS3Item (HdaBar, CodecCmdData);
+ }
+ break;
+ }
+ }
+
+ if (VerbTableNum >= AzaliaConfig->AzaliaVerbTableNum) {
+ DEBUG (
+ (EFI_D_ERROR,
+ "Detected High Definition Audio (Azalia) Codec, VendorID = 0x%08x on SDI%d,",
+ VendorDeviceId,
+ AzaliaSDINo)
+ );
+ DEBUG ((EFI_D_ERROR, " but no matching verb table found.\n"));
+ }
+ }
+ ///
+ /// end of for
+ ///
+ *AzaliaStarted = TRUE;
+ Status = EFI_SUCCESS;
+
+ExitInitAzalia:
+ ///
+ /// Clear AZBAR and disable memory map access
+ ///
+ MmioAnd16 ((UINTN) (AzaliaBase + R_PCH_HDA_COMMAND), (UINT16) (~B_PCH_HDA_COMMAND_MSE));
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (AzaliaBase + R_PCH_HDA_COMMAND),
+ 1,
+ (VOID *) (UINTN) (AzaliaBase + R_PCH_HDA_COMMAND)
+ );
+
+ MmioWrite32 (AzaliaBase + R_PCH_HDA_HDBARL, 0);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (AzaliaBase + R_PCH_HDA_HDBARL),
+ 1,
+ (VOID *) (UINTN) (AzaliaBase + R_PCH_HDA_HDBARL)
+ );
+
+ MmioWrite32 (AzaliaBase + R_PCH_HDA_HDBARU, 0);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (AzaliaBase + R_PCH_HDA_HDBARU),
+ 1,
+ (VOID *) (UINTN) (AzaliaBase + R_PCH_HDA_HDBARU)
+ );
+
+ gDS->FreeMemorySpace (
+ BaseAddressBarMem,
+ V_PCH_HDA_HDBAR_SIZE
+ );
+
+ return Status;
+}
+
+/**
+ Detect and initialize the type of codec (AC'97 and HDA) present in the system.
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+ @param[in, out] AzaliaEnable Returned with TRUE if Azalia High Definition Audio codec
+ is detected and initialized.
+
+ @retval EFI_SUCCESS Codec is detected and initialized.
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate resources to initialize the codec.
+**/
+EFI_STATUS
+ConfigureAzalia (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar,
+ IN OUT BOOLEAN *AzaliaEnable
+ )
+{
+ EFI_STATUS Status;
+
+ DEBUG ((EFI_D_INFO, "ConfigureAzalia() Start\n"));
+
+ *AzaliaEnable = FALSE;
+
+ ///
+ /// If all codec devices are to be disabled, skip the detection code
+ ///
+ if (PchPlatformPolicy->DeviceEnabling->Azalia == PCH_DEVICE_DISABLE) {
+ DEBUG ((EFI_D_ERROR | EFI_D_INFO, "Skip Azalia Codec detection.\n"));
+ return EFI_SUCCESS;
+ }
+
+ Status = DetectAndInitializeAzalia (PchPlatformPolicy, RootComplexBar, AzaliaEnable);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR | EFI_D_INFO, "Azalia detection / initialization failure!\n"));
+
+ if (PchPlatformPolicy->DeviceEnabling->Azalia == PCH_DEVICE_ENABLE) {
+ *AzaliaEnable = TRUE;
+ }
+ }
+
+ DEBUG ((EFI_D_INFO, "ConfigureAzalia() End\n"));
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchDebugDump.c b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchDebugDump.c
new file mode 100644
index 0000000..f588686
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchDebugDump.c
@@ -0,0 +1,330 @@
+/** @file
+ Dump whole DXE_PCH_PLATFORM_POLICY_PROTOCOL and serial out.
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "PchInit.h"
+
+/**
+ Dump whole DXE_PCH_PLATFORM_POLICY_PROTOCOL and serial out.
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+
+ @retval None
+**/
+VOID
+PchDumpPlatformProtocol (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy
+ )
+{
+#ifdef EFI_DEBUG
+ UINT8 i;
+
+ DEBUG ((EFI_D_INFO, "\n"));
+ DEBUG ((EFI_D_INFO, "------------------------ PCH Dump platform protocol Start -----------------\n"));
+ DEBUG ((EFI_D_INFO, " PCH PLATFORM POLICY Revision= %x\n", PchPlatformPolicy->Revision));
+ DEBUG ((EFI_D_INFO, " PCH PLATFORM POLICY BusNumber= %x\n", PchPlatformPolicy->BusNumber));
+
+ DEBUG ((EFI_D_INFO, "\n"));
+ DEBUG ((EFI_D_INFO, "------------------------ PCH_DEVICE_ENABLE -----------------\n"));
+ DEBUG ((EFI_D_INFO, " PCH_DEVICE_ENABLE Lan= %x\n", PchPlatformPolicy->DeviceEnabling->Lan));
+ DEBUG ((EFI_D_INFO, " PCH_DEVICE_ENABLE Azalia= %x\n", PchPlatformPolicy->DeviceEnabling->Azalia));
+ DEBUG ((EFI_D_INFO, " PCH_DEVICE_ENABLE Sata= %x\n", PchPlatformPolicy->DeviceEnabling->Sata));
+ DEBUG ((EFI_D_INFO, " PCH_DEVICE_ENABLE Smbus= %x\n", PchPlatformPolicy->DeviceEnabling->Smbus));
+ DEBUG ((EFI_D_INFO, " PCH_DEVICE_ENABLE PciClockRun= %x\n", PchPlatformPolicy->DeviceEnabling->PciClockRun));
+ DEBUG ((EFI_D_INFO, " PCH_DEVICE_ENABLE Display= %x\n", PchPlatformPolicy->DeviceEnabling->Display));
+ DEBUG ((EFI_D_INFO, " PCH_DEVICE_ENABLE Crid%x\n", PchPlatformPolicy->DeviceEnabling->Crid));
+
+ DEBUG ((EFI_D_INFO, "\n"));
+ DEBUG ((EFI_D_INFO, "------------------------ PCH_USB_CONFIG -----------------\n"));
+ DEBUG ((EFI_D_INFO, " PCH_USB_CONFIG UsbPerPortCtl= %x\n", PchPlatformPolicy->UsbConfig->UsbPerPortCtl));
+ DEBUG ((EFI_D_INFO, " PCH_USB_CONFIG Ehci1Usbr= %x\n", PchPlatformPolicy->UsbConfig->Ehci1Usbr));
+ DEBUG ((EFI_D_INFO, " PCH_USB_CONFIG Ehci2Usbr= %x\n", PchPlatformPolicy->UsbConfig->Ehci2Usbr));
+ for (i = 0; i < GetPchUsbMaxPhysicalPortNum (); i++) {
+ DEBUG ((EFI_D_INFO, " PCH_USB_CONFIG PortSettings[%d] Enabled= %x\n", i, PchPlatformPolicy->UsbConfig->PortSettings[i].Enable));
+ DEBUG ((EFI_D_INFO, " PCH_USB_CONFIG PortSettings[%d] Location= %x\n", i, PchPlatformPolicy->UsbConfig->PortSettings[i].Location));
+ }
+
+ for (i = 0; i < GetPchXhciMaxUsb3PortNum (); i++) {
+ DEBUG ((EFI_D_INFO, " PCH_USB_CONFIG Port30Settings[%d] Enabled= %x\n", i, PchPlatformPolicy->UsbConfig->Port30Settings[i].Enable));
+ }
+
+ for (i = 0; i < GetPchEhciMaxControllerNum (); i++) {
+ DEBUG ((EFI_D_INFO, " PCH_USB_CONFIG Usb20Settings[%d] Enabled= %x\n", i, PchPlatformPolicy->UsbConfig->Usb20Settings[i].Enable));
+ }
+
+ DEBUG ((EFI_D_INFO, " PCH_USB_CONFIG Usb30Settings.Mode= %x\n", PchPlatformPolicy->UsbConfig->Usb30Settings.Mode));
+ DEBUG ((EFI_D_INFO, " PCH_USB_CONFIG Usb30Settings.PreBootSupport= %x\n", PchPlatformPolicy->UsbConfig->Usb30Settings.PreBootSupport));
+ DEBUG ((EFI_D_INFO, " XhciStreams is obsoleted, it doesn't effect any setting change since Revision 2.\n"));
+ DEBUG ((EFI_D_INFO, " PCH_USB_CONFIG Usb30Settings.ManualMode= %x\n", PchPlatformPolicy->UsbConfig->Usb30Settings.ManualMode));
+ DEBUG ((EFI_D_INFO, " PCH_USB_CONFIG Usb30Settings.XhciIdleL1= %x\n", PchPlatformPolicy->UsbConfig->Usb30Settings.XhciIdleL1));
+
+ for (i = 0; i < GetPchUsbMaxPhysicalPortNum (); i++) {
+ if (PchPlatformPolicy->UsbConfig->Usb30Settings.ManualModeUsb20PerPinRoute[i] == 0) {
+ DEBUG ((EFI_D_INFO, " PCH_USB_CONFIG Usb30Settings.ManualModeUsb20PerPinRoute[%d]= EHCI\n", i));
+ } else {
+ DEBUG ((EFI_D_INFO, " PCH_USB_CONFIG Usb30Settings.ManualModeUsb20PerPinRoute[%d]= XHCI\n", i));
+ }
+ }
+
+ for (i = 0; i < GetPchXhciMaxUsb3PortNum (); i++) {
+ DEBUG ((EFI_D_INFO,
+ "PCH_USB_CONFIG Usb30Settings.ManualModeUsb30PerPinEnable[%d]= %x\n",
+ i,
+ PchPlatformPolicy->UsbConfig->Usb30Settings.ManualModeUsb30PerPinEnable[i]));
+ }
+
+ for (i = 0; i < GetPchUsbMaxPhysicalPortNum (); i++) {
+ DEBUG ((EFI_D_INFO, " PCH_USB_CONFIG Usb20OverCurrentPins[%d]= OC%x\n", i, PchPlatformPolicy->UsbConfig->Usb20OverCurrentPins[i]));
+ }
+
+ for (i = 0; i < GetPchXhciMaxUsb3PortNum (); i++) {
+ DEBUG ((EFI_D_INFO, " PCH_USB_CONFIG Usb30OverCurrentPins[%d]= OC%x\n", i, PchPlatformPolicy->UsbConfig->Usb30OverCurrentPins[i]));
+ }
+
+ for (i = 0; i < GetPchEhciMaxUsbPortNum (); i++) {
+ DEBUG ((EFI_D_INFO, " PCH_USB_CONFIG Usb20PortLength[%d]= %x.%0x\n", i, PchPlatformPolicy->UsbConfig->PortSettings[i].Usb20PortLength >> 4, PchPlatformPolicy->UsbConfig->PortSettings[i].Usb20PortLength & 0xF));
+ }
+
+ DEBUG ((EFI_D_INFO, "\n"));
+ DEBUG ((EFI_D_INFO, "------------------------ PCH_PCI_EXPRESS_CONFIG -----------------\n"));
+ DEBUG ((EFI_D_INFO, " PCH_PCI_EXPRESS_CONFIG TempRootPortBusNumMin= %x\n", PchPlatformPolicy->PciExpressConfig->TempRootPortBusNumMin));
+ DEBUG ((EFI_D_INFO, " PCH_PCI_EXPRESS_CONFIG TempRootPortBusNumMax= %x\n", PchPlatformPolicy->PciExpressConfig->TempRootPortBusNumMax));
+ for (i = 0; i < GetPchMaxPciePortNum (); i++) {
+ DEBUG ((EFI_D_INFO, " PCH_PCI_EXPRESS_CONFIG RootPort[%d] Enabled= %x\n", i, PchPlatformPolicy->PciExpressConfig->RootPort[i].Enable));
+ DEBUG ((EFI_D_INFO, " PCH_PCI_EXPRESS_CONFIG RootPort[%d] Hide= %x\n", i, PchPlatformPolicy->PciExpressConfig->RootPort[i].Hide));
+ DEBUG ((EFI_D_INFO, " PCH_PCI_EXPRESS_CONFIG RootPort[%d] SlotImplemented= %x\n", i, PchPlatformPolicy->PciExpressConfig->RootPort[i].SlotImplemented));
+ DEBUG ((EFI_D_INFO, " PCH_PCI_EXPRESS_CONFIG RootPort[%d] HotPlug= %x\n", i, PchPlatformPolicy->PciExpressConfig->RootPort[i].HotPlug));
+ DEBUG ((EFI_D_INFO, " PCH_PCI_EXPRESS_CONFIG RootPort[%d] PmSci= %x\n", i, PchPlatformPolicy->PciExpressConfig->RootPort[i].PmSci));
+ DEBUG ((EFI_D_INFO, " PCH_PCI_EXPRESS_CONFIG RootPort[%d] ExtSync= %x\n", i, PchPlatformPolicy->PciExpressConfig->RootPort[i].ExtSync));
+ DEBUG ((EFI_D_INFO, " PCH_PCI_EXPRESS_CONFIG RootPort[%d] UnsupportedRequestReport= %x\n", i, PchPlatformPolicy->PciExpressConfig->RootPort[i].UnsupportedRequestReport));
+ DEBUG ((EFI_D_INFO, " PCH_PCI_EXPRESS_CONFIG RootPort[%d] FatalErrorReport= %x\n", i, PchPlatformPolicy->PciExpressConfig->RootPort[i].FatalErrorReport));
+ DEBUG ((EFI_D_INFO, " PCH_PCI_EXPRESS_CONFIG RootPort[%d] NoFatalErrorReport= %x\n", i, PchPlatformPolicy->PciExpressConfig->RootPort[i].NoFatalErrorReport));
+ DEBUG ((EFI_D_INFO, " PCH_PCI_EXPRESS_CONFIG RootPort[%d] CorrectableErrorReport= %x\n", i, PchPlatformPolicy->PciExpressConfig->RootPort[i].CorrectableErrorReport));
+ DEBUG ((EFI_D_INFO, " PCH_PCI_EXPRESS_CONFIG RootPort[%d] PmeInterrupt= %x\n", i, PchPlatformPolicy->PciExpressConfig->RootPort[i].PmeInterrupt));
+ DEBUG ((EFI_D_INFO, " PCH_PCI_EXPRESS_CONFIG RootPort[%d] SystemErrorOnFatalError= %x\n", i, PchPlatformPolicy->PciExpressConfig->RootPort[i].SystemErrorOnFatalError));
+ DEBUG ((EFI_D_INFO, " PCH_PCI_EXPRESS_CONFIG RootPort[%d] SystemErrorOnNonFatalError= %x\n", i, PchPlatformPolicy->PciExpressConfig->RootPort[i].SystemErrorOnNonFatalError));
+ DEBUG ((EFI_D_INFO, " PCH_PCI_EXPRESS_CONFIG RootPort[%d] SystemErrorOnCorrectableError= %x\n", i, PchPlatformPolicy->PciExpressConfig->RootPort[i].SystemErrorOnCorrectableError));
+ DEBUG ((EFI_D_INFO, " PCH_PCI_EXPRESS_CONFIG RootPort[%d] AdvancedErrorReporting= %x\n", i, PchPlatformPolicy->PciExpressConfig->RootPort[i].AdvancedErrorReporting));
+ DEBUG ((EFI_D_INFO, " PCH_PCI_EXPRESS_CONFIG RootPort[%d] TransmitterHalfSwing= %x\n", i, PchPlatformPolicy->PciExpressConfig->RootPort[i].TransmitterHalfSwing));
+ DEBUG ((EFI_D_INFO, " PCH_PCI_EXPRESS_CONFIG RootPort[%d] FunctionNumber= %x\n", i, PchPlatformPolicy->PciExpressConfig->RootPort[i].FunctionNumber));
+ DEBUG ((EFI_D_INFO, " PCH_PCI_EXPRESS_CONFIG RootPort[%d] PhysicalSlotNumber= %x\n", i, PchPlatformPolicy->PciExpressConfig->RootPort[i].PhysicalSlotNumber));
+ DEBUG ((EFI_D_INFO, " PCH_PCI_EXPRESS_CONFIG RootPort[%d] CompletionTimeout= %x\n", i, PchPlatformPolicy->PciExpressConfig->RootPort[i].CompletionTimeout));
+ DEBUG ((EFI_D_INFO, " PCH_PCI_EXPRESS_CONFIG RootPort[%d] Aspm= %x\n", i, PchPlatformPolicy->PciExpressConfig->RootPort[i].Aspm));
+ if (PchPlatformPolicy->Revision >= DXE_PCH_PLATFORM_POLICY_PROTOCOL_REVISION_2) {
+ DEBUG ((EFI_D_INFO, " PCH_PCI_EXPRESS_CONFIG RootPort[%d] L1Substates= %x\n", i, PchPlatformPolicy->PciExpressConfig->RootPort[i].L1Substates));
+ }
+ }
+
+ DEBUG ((EFI_D_INFO, " PCH_PCI_EXPRESS_CONFIG NumOfDevAspmOverride= %x\n", PchPlatformPolicy->PciExpressConfig->NumOfDevAspmOverride));
+ DEBUG ((EFI_D_INFO, " PCH_PCI_EXPRESS_CONFIG DevAspmOverride VendorId= %x\n", PchPlatformPolicy->PciExpressConfig->DevAspmOverride->VendorId));
+ DEBUG ((EFI_D_INFO, " PCH_PCI_EXPRESS_CONFIG DevAspmOverride DeviceId= %x\n", PchPlatformPolicy->PciExpressConfig->DevAspmOverride->DeviceId));
+ DEBUG ((EFI_D_INFO, " PCH_PCI_EXPRESS_CONFIG DevAspmOverride RevId= %x\n", PchPlatformPolicy->PciExpressConfig->DevAspmOverride->RevId));
+ DEBUG ((EFI_D_INFO, " PCH_PCI_EXPRESS_CONFIG DevAspmOverride BaseClassCode= %x\n", PchPlatformPolicy->PciExpressConfig->DevAspmOverride->BaseClassCode));
+ DEBUG ((EFI_D_INFO, " PCH_PCI_EXPRESS_CONFIG DevAspmOverride SubClassCode= %x\n", PchPlatformPolicy->PciExpressConfig->DevAspmOverride->SubClassCode));
+ DEBUG ((EFI_D_INFO, " PCH_PCI_EXPRESS_CONFIG DevAspmOverride EndPointAspm= %x\n", PchPlatformPolicy->PciExpressConfig->DevAspmOverride->EndPointAspm));
+ DEBUG ((EFI_D_INFO, " PCH_PCI_EXPRESS_CONFIG PchPcieSbdePort= %x\n", PchPlatformPolicy->PciExpressConfig->PchPcieSbdePort));
+ DEBUG ((EFI_D_INFO, " PCH_PCI_EXPRESS_CONFIG RootPortClockGating= %x\n", PchPlatformPolicy->PciExpressConfig->RootPortClockGating));
+ DEBUG ((EFI_D_INFO, " PCH_PCI_EXPRESS_CONFIG EnableSubDecode= %x\n", PchPlatformPolicy->PciExpressConfig->EnableSubDecode));
+
+ DEBUG ((EFI_D_INFO, "\n"));
+ DEBUG ((EFI_D_INFO, "------------------------ PCH_SATA_CONFIG -----------------\n"));
+ for (i = 0; i < GetPchMaxSataPortNum (); i++) {
+ DEBUG ((EFI_D_INFO, " PCH_SATA_CONFIG PortSettings[%d] Enabled= %x\n", i, PchPlatformPolicy->SataConfig->PortSettings[i].Enable));
+ DEBUG ((EFI_D_INFO, " PCH_SATA_CONFIG PortSettings[%d] HotPlug= %x\n", i, PchPlatformPolicy->SataConfig->PortSettings[i].HotPlug));
+ DEBUG ((EFI_D_INFO, " PCH_SATA_CONFIG PortSettings[%d] InterlockSw= %x\n", i, PchPlatformPolicy->SataConfig->PortSettings[i].InterlockSw));
+ DEBUG ((EFI_D_INFO, " PCH_SATA_CONFIG PortSettings[%d] External= %x\n", i, PchPlatformPolicy->SataConfig->PortSettings[i].External));
+ DEBUG ((EFI_D_INFO, " PCH_SATA_CONFIG PortSettings[%d] SpinUp= %x\n", i, PchPlatformPolicy->SataConfig->PortSettings[i].SpinUp));
+ DEBUG ((EFI_D_INFO, " PCH_SATA_CONFIG PortSettings[%d] SolidStateDrive= %x\n", i, PchPlatformPolicy->SataConfig->PortSettings[i].SolidStateDrive));
+ DEBUG ((EFI_D_INFO, " PCH_SATA_CONFIG PortSettings[%d] EnableDitoConfig= %x\n", PchPlatformPolicy->SataConfig->PortSettings[i].EnableDitoConfig));
+ DEBUG ((EFI_D_INFO, " PCH_SATA_CONFIG PortSettings[%d] DmVal= %x\n", PchPlatformPolicy->SataConfig->PortSettings[i].DmVal));
+ DEBUG ((EFI_D_INFO, " PCH_SATA_CONFIG PortSettings[%d] DitoVal= %x\n", PchPlatformPolicy->SataConfig->PortSettings[i].DitoVal));
+ }
+
+ DEBUG ((EFI_D_INFO, " PCH_SATA_CONFIG RaidAlternateId= %x\n", PchPlatformPolicy->SataConfig->RaidAlternateId));
+ DEBUG ((EFI_D_INFO, " PCH_SATA_CONFIG Raid0= %x\n", PchPlatformPolicy->SataConfig->Raid0));
+ DEBUG ((EFI_D_INFO, " PCH_SATA_CONFIG Raid1= %x\n", PchPlatformPolicy->SataConfig->Raid1));
+ DEBUG ((EFI_D_INFO, " PCH_SATA_CONFIG Raid10= %x\n", PchPlatformPolicy->SataConfig->Raid10));
+ DEBUG ((EFI_D_INFO, " PCH_SATA_CONFIG Raid5= %x\n", PchPlatformPolicy->SataConfig->Raid5));
+ DEBUG ((EFI_D_INFO, " PCH_SATA_CONFIG Irrt= %x\n", PchPlatformPolicy->SataConfig->Irrt));
+ DEBUG ((EFI_D_INFO, " PCH_SATA_CONFIG OromUiBanner= %x\n", PchPlatformPolicy->SataConfig->OromUiBanner));
+ DEBUG ((EFI_D_INFO, " PCH_SATA_CONFIG HddUnlock= %x\n", PchPlatformPolicy->SataConfig->HddUnlock));
+ DEBUG ((EFI_D_INFO, " PCH_SATA_CONFIG LedLocate= %x\n", PchPlatformPolicy->SataConfig->LedLocate));
+ DEBUG ((EFI_D_INFO, " PCH_SATA_CONFIG IrrtOnly= %x\n", PchPlatformPolicy->SataConfig->IrrtOnly));
+ DEBUG ((EFI_D_INFO, " PCH_SATA_CONFIG TestMode= %x\n", PchPlatformPolicy->SataConfig->TestMode));
+ DEBUG ((EFI_D_INFO, " PCH_SATA_CONFIG SalpSupport= %x\n", PchPlatformPolicy->SataConfig->SalpSupport));
+ DEBUG ((EFI_D_INFO, " PCH_SATA_CONFIG LegacyMode= %x\n", PchPlatformPolicy->SataConfig->LegacyMode));
+ DEBUG ((EFI_D_INFO, " PCH_SATA_CONFIG SmartStorage= %x\n", PchPlatformPolicy->SataConfig->SmartStorage));
+ DEBUG ((EFI_D_INFO, " PCH_SATA_CONFIG OromUiDelay= %x\n", PchPlatformPolicy->SataConfig->OromUiDelay));
+ DEBUG ((EFI_D_INFO, " PCH_SATA_CONFIG SpeedSupport= %x\n", PchPlatformPolicy->SataConfig->SpeedSupport));
+
+ DEBUG ((EFI_D_INFO, "\n"));
+ DEBUG ((EFI_D_INFO, "------------------------ PCH_AZALIA_CONFIG -----------------\n"));
+ DEBUG ((EFI_D_INFO, " PCH_AZALIA_CONFIG Pme= %x\n", PchPlatformPolicy->AzaliaConfig->Pme));
+ DEBUG ((EFI_D_INFO, " PCH_AZALIA_CONFIG DS= %x\n", PchPlatformPolicy->AzaliaConfig->DS));
+ DEBUG ((EFI_D_INFO, " PCH_AZALIA_CONFIG DA= %x\n", PchPlatformPolicy->AzaliaConfig->DA));
+ DEBUG ((EFI_D_INFO, " PCH_AZALIA_CONFIG AzaliaVerbTableNum= %x\n", PchPlatformPolicy->AzaliaConfig->AzaliaVerbTableNum));
+ DEBUG ((EFI_D_INFO, " PCH_AZALIA_CONFIG AzaliaVerbTable Header VendorDeviceId= %x\n", PchPlatformPolicy->AzaliaConfig->AzaliaVerbTable->VerbTableHeader.VendorDeviceId));
+ DEBUG ((EFI_D_INFO, " PCH_AZALIA_CONFIG AzaliaVerbTable Header SubSystemId= %x\n", PchPlatformPolicy->AzaliaConfig->AzaliaVerbTable->VerbTableHeader.SubSystemId));
+ DEBUG ((EFI_D_INFO, " PCH_AZALIA_CONFIG AzaliaVerbTable Header RevisionId= %x\n", PchPlatformPolicy->AzaliaConfig->AzaliaVerbTable->VerbTableHeader.RevisionId));
+ DEBUG ((EFI_D_INFO, " PCH_AZALIA_CONFIG AzaliaVerbTable Header FrontPanelSupport= %x\n", PchPlatformPolicy->AzaliaConfig->AzaliaVerbTable->VerbTableHeader.FrontPanelSupport));
+ DEBUG ((EFI_D_INFO, " PCH_AZALIA_CONFIG AzaliaVerbTable Header NumberOfRearJacks= %x\n", PchPlatformPolicy->AzaliaConfig->AzaliaVerbTable->VerbTableHeader.NumberOfRearJacks));
+ DEBUG ((EFI_D_INFO, " PCH_AZALIA_CONFIG AzaliaVerbTable Header NumberOfFrontJacks= %x\n", PchPlatformPolicy->AzaliaConfig->AzaliaVerbTable->VerbTableHeader.NumberOfFrontJacks));
+ DEBUG ((EFI_D_INFO, " PCH_AZALIA_CONFIG AzaliaVerbTable VerbTableData= %x\n", PchPlatformPolicy->AzaliaConfig->AzaliaVerbTable->VerbTableData));
+ DEBUG ((EFI_D_INFO, " PCH_AZALIA_CONFIG ResetWaitTimer= %x\n", PchPlatformPolicy->AzaliaConfig->ResetWaitTimer));
+
+ DEBUG ((EFI_D_INFO, "\n"));
+ DEBUG ((EFI_D_INFO, "------------------------ PCH_SMBUS_CONFIG -----------------\n"));
+ DEBUG ((EFI_D_INFO, " PCH_SMBUS_CONFIG NumRsvdSmbusAddresses= %x\n", PchPlatformPolicy->SmbusConfig->NumRsvdSmbusAddresses));
+ DEBUG ((EFI_D_INFO, " PCH_SMBUS_CONFIG RsvdSmbusAddressTable= %x\n", PchPlatformPolicy->SmbusConfig->RsvdSmbusAddressTable));
+
+ DEBUG ((EFI_D_INFO, "\n"));
+ DEBUG ((EFI_D_INFO, "------------------------ PCH_MISC_PM_CONFIG -----------------\n"));
+ DEBUG ((EFI_D_INFO, " PCH_MISC_PM_CONFIG PowerResetStatusClear MeWakeSts= %x\n", PchPlatformPolicy->MiscPmConfig->PowerResetStatusClear.MeWakeSts));
+ DEBUG ((EFI_D_INFO, " PCH_MISC_PM_CONFIG PowerResetStatusClear MeHrstColdSts= %x\n", PchPlatformPolicy->MiscPmConfig->PowerResetStatusClear.MeHrstColdSts));
+ DEBUG ((EFI_D_INFO, " PCH_MISC_PM_CONFIG PowerResetStatusClear MeHrstWarmSts= %x\n", PchPlatformPolicy->MiscPmConfig->PowerResetStatusClear.MeHrstWarmSts));
+ DEBUG ((EFI_D_INFO, " PCH_MISC_PM_CONFIG PowerResetStatusClear MeHostPowerDn= %x\n", PchPlatformPolicy->MiscPmConfig->PowerResetStatusClear.MeHostPowerDn));
+ DEBUG ((EFI_D_INFO, " PCH_MISC_PM_CONFIG PowerResetStatusClear WolOvrWkSts= %x\n", PchPlatformPolicy->MiscPmConfig->PowerResetStatusClear.WolOvrWkSts));
+ DEBUG ((EFI_D_INFO, " PCH_MISC_PM_CONFIG WakeConfig PmeB0S5Dis= %x\n", PchPlatformPolicy->MiscPmConfig->WakeConfig.PmeB0S5Dis));
+ DEBUG ((EFI_D_INFO, " PCH_MISC_PM_CONFIG WakeConfig WolEnableOverride= %x\n", PchPlatformPolicy->MiscPmConfig->WakeConfig.WolEnableOverride));
+ DEBUG ((EFI_D_INFO, " PCH_MISC_PM_CONFIG WakeConfig Gp27WakeFromDeepSx= %x\n", PchPlatformPolicy->MiscPmConfig->WakeConfig.Gp27WakeFromDeepSx));
+ DEBUG ((EFI_D_INFO, " PCH_MISC_PM_CONFIG PchDeepSxPol= %x\n", PchPlatformPolicy->MiscPmConfig->PchDeepSxPol));
+ DEBUG ((EFI_D_INFO, " PCH_MISC_PM_CONFIG PchSlpS3MinAssert= %x\n", PchPlatformPolicy->MiscPmConfig->PchSlpS3MinAssert));
+ DEBUG ((EFI_D_INFO, " PCH_MISC_PM_CONFIG PchSlpS4MinAssert= %x\n", PchPlatformPolicy->MiscPmConfig->PchSlpS4MinAssert));
+ DEBUG ((EFI_D_INFO, " PCH_MISC_PM_CONFIG PchSlpSusMinAssert= %x\n", PchPlatformPolicy->MiscPmConfig->PchSlpSusMinAssert));
+ DEBUG ((EFI_D_INFO, " PCH_MISC_PM_CONFIG PchSlpAMinAssert= %x\n", PchPlatformPolicy->MiscPmConfig->PchSlpAMinAssert));
+ DEBUG ((EFI_D_INFO, " PCH_MISC_PM_CONFIG SlpStrchSusUp= %x\n", PchPlatformPolicy->MiscPmConfig->SlpStrchSusUp));
+ DEBUG ((EFI_D_INFO, " PCH_MISC_PM_CONFIG SlpLanLowDc= %x\n", PchPlatformPolicy->MiscPmConfig->SlpLanLowDc));
+ DEBUG ((EFI_D_INFO, " PCH_MISC_PM_CONFIG PchPwrCycDur= %x\n", PchPlatformPolicy->MiscPmConfig->PchPwrCycDur));
+
+ DEBUG ((EFI_D_INFO, "\n"));
+ DEBUG ((EFI_D_INFO, "------------------------ PCH_IO_APIC_CONFIG -----------------\n"));
+ DEBUG ((EFI_D_INFO, " PCH_IO_APIC_CONFIG BdfValid= %x\n", PchPlatformPolicy->IoApicConfig->BdfValid));
+ DEBUG ((EFI_D_INFO, " PCH_IO_APIC_CONFIG BusNumber= %x\n", PchPlatformPolicy->IoApicConfig->BusNumber));
+ DEBUG ((EFI_D_INFO, " PCH_IO_APIC_CONFIG DeviceNumber= %x\n", PchPlatformPolicy->IoApicConfig->DeviceNumber));
+ DEBUG ((EFI_D_INFO, " PCH_IO_APIC_CONFIG FunctionNumber= %x\n", PchPlatformPolicy->IoApicConfig->FunctionNumber));
+
+ DEBUG ((EFI_D_INFO, "\n"));
+ DEBUG ((EFI_D_INFO, "------------------------ PCH_DEFAULT_SVID_SID -----------------\n"));
+ DEBUG ((EFI_D_INFO, " PCH_DEFAULT_SVID_SID SubSystemVendorId= %x\n", PchPlatformPolicy->DefaultSvidSid->SubSystemVendorId));
+ DEBUG ((EFI_D_INFO, " PCH_DEFAULT_SVID_SID SubSystemId= %x\n", PchPlatformPolicy->DefaultSvidSid->SubSystemId));
+
+ DEBUG ((EFI_D_INFO, "\n"));
+ DEBUG ((EFI_D_INFO, "------------------------ PCH_LOCK_DOWN_CONFIG -----------------\n"));
+ DEBUG ((EFI_D_INFO, " PCH_LOCK_DOWN_CONFIG GlobalSmi= %x\n", PchPlatformPolicy->LockDownConfig->GlobalSmi));
+ DEBUG ((EFI_D_INFO, " PCH_LOCK_DOWN_CONFIG BiosInterface= %x\n", PchPlatformPolicy->LockDownConfig->BiosInterface));
+ DEBUG ((EFI_D_INFO, " PCH_LOCK_DOWN_CONFIG GpioLockDown= %x\n", PchPlatformPolicy->LockDownConfig->GpioLockDown));
+ DEBUG ((EFI_D_INFO, " PCH_LOCK_DOWN_CONFIG RtcLock= %x\n", PchPlatformPolicy->LockDownConfig->RtcLock));
+ DEBUG ((EFI_D_INFO, " PCH_LOCK_DOWN_CONFIG BiosLock= %x\n", PchPlatformPolicy->LockDownConfig->BiosLock));
+ DEBUG ((EFI_D_INFO, " PCH_LOCK_DOWN_CONFIG PchBiosLockIoTrapAddress= %x\n", PchPlatformPolicy->LockDownConfig->PchBiosLockIoTrapAddress));
+
+ DEBUG ((EFI_D_INFO, "\n"));
+ DEBUG ((EFI_D_INFO, "------------------------ PCH_THERMAL_CONFIG -----------------\n"));
+ DEBUG ((EFI_D_INFO, " PCH_THERMAL_CONFIG ThermalAlertEnable TselLock %x\n", PchPlatformPolicy->ThermalConfig->ThermalAlertEnable.TselLock));
+ DEBUG ((EFI_D_INFO, " PCH_THERMAL_CONFIG ThermalAlertEnable TscLock %x\n", PchPlatformPolicy->ThermalConfig->ThermalAlertEnable.TscLock));
+ DEBUG ((EFI_D_INFO, " PCH_THERMAL_CONFIG ThermalAlertEnable TsmicLock= %x\n", PchPlatformPolicy->ThermalConfig->ThermalAlertEnable.TsmicLock));
+ DEBUG ((EFI_D_INFO, " PCH_THERMAL_CONFIG ThermalAlertEnable PhlcLock= %x\n", PchPlatformPolicy->ThermalConfig->ThermalAlertEnable.PhlcLock));
+ DEBUG ((EFI_D_INFO, " PCH_THERMAL_CONFIG ThermalDeviceEnable (D31:F6) %x\n", PchPlatformPolicy->ThermalConfig->ThermalDeviceEnable));
+ DEBUG ((EFI_D_INFO, " PCH_THERMAL_CONFIG PCH_THERMAL_THROTTLING THERMAL_THROTTLE_LEVELS T0Level %x centigrade degree\n", PchPlatformPolicy->ThermalConfig->ThermalThrottling.TTLevels.T0Level));
+ DEBUG ((EFI_D_INFO, " PCH_THERMAL_CONFIG PCH_THERMAL_THROTTLING THERMAL_THROTTLE_LEVELS T1Level %x centigrade degree\n", PchPlatformPolicy->ThermalConfig->ThermalThrottling.TTLevels.T1Level));
+ DEBUG ((EFI_D_INFO, " PCH_THERMAL_CONFIG PCH_THERMAL_THROTTLING THERMAL_THROTTLE_LEVELS T2Level %x centigrade degree\n", PchPlatformPolicy->ThermalConfig->ThermalThrottling.TTLevels.T2Level));
+ DEBUG ((EFI_D_INFO, " PCH_THERMAL_CONFIG PCH_THERMAL_THROTTLING THERMAL_THROTTLE_LEVELS TTEnable %x\n", PchPlatformPolicy->ThermalConfig->ThermalThrottling.TTLevels.TTEnable));
+ DEBUG ((EFI_D_INFO, " PCH_THERMAL_CONFIG PCH_THERMAL_THROTTLING THERMAL_THROTTLE_LEVELS TTState13Enable %x\n", PchPlatformPolicy->ThermalConfig->ThermalThrottling.TTLevels.TTState13Enable));
+ DEBUG ((EFI_D_INFO, " PCH_THERMAL_CONFIG PCH_THERMAL_THROTTLING THERMAL_THROTTLE_LEVELS TTLock %x\n", PchPlatformPolicy->ThermalConfig->ThermalThrottling.TTLevels.TTLock));
+ DEBUG ((EFI_D_INFO, " PCH_THERMAL_CONFIG PCH_THERMAL_THROTTLING THERMAL_THROTTLE_LEVELS SuggestedSetting %x\n", PchPlatformPolicy->ThermalConfig->ThermalThrottling.TTLevels.SuggestedSetting));
+ DEBUG ((EFI_D_INFO, " PCH_THERMAL_CONFIG PCH_THERMAL_THROTTLING DMI_HW_WIDTH_CONTROL DmiTsawEn %x\n", PchPlatformPolicy->ThermalConfig->ThermalThrottling.DmiHaAWC.DmiTsawEn));
+ DEBUG ((EFI_D_INFO, " PCH_THERMAL_CONFIG PCH_THERMAL_THROTTLING DMI_HW_WIDTH_CONTROL TS0TW %x\n", PchPlatformPolicy->ThermalConfig->ThermalThrottling.DmiHaAWC.TS0TW));
+ DEBUG ((EFI_D_INFO, " PCH_THERMAL_CONFIG PCH_THERMAL_THROTTLING DMI_HW_WIDTH_CONTROL TS1TW %x\n", PchPlatformPolicy->ThermalConfig->ThermalThrottling.DmiHaAWC.TS1TW));
+ DEBUG ((EFI_D_INFO, " PCH_THERMAL_CONFIG PCH_THERMAL_THROTTLING DMI_HW_WIDTH_CONTROL TS2TW %x\n", PchPlatformPolicy->ThermalConfig->ThermalThrottling.DmiHaAWC.TS2TW));
+ DEBUG ((EFI_D_INFO, " PCH_THERMAL_CONFIG PCH_THERMAL_THROTTLING DMI_HW_WIDTH_CONTROL TS3TW %x\n", PchPlatformPolicy->ThermalConfig->ThermalThrottling.DmiHaAWC.TS3TW));
+ DEBUG ((EFI_D_INFO, " PCH_THERMAL_CONFIG PCH_THERMAL_THROTTLING DMI_HW_WIDTH_CONTROL SuggestedSetting %x\n", PchPlatformPolicy->ThermalConfig->ThermalThrottling.DmiHaAWC.SuggestedSetting));
+ DEBUG ((EFI_D_INFO, " PCH_THERMAL_CONFIG PCH_THERMAL_THROTTLING SATA_THERMAL_THROTTLE P0T1M %x\n", PchPlatformPolicy->ThermalConfig->ThermalThrottling.SataTT.P0T1M));
+ DEBUG ((EFI_D_INFO, " PCH_THERMAL_CONFIG PCH_THERMAL_THROTTLING SATA_THERMAL_THROTTLE P0T2M %x\n", PchPlatformPolicy->ThermalConfig->ThermalThrottling.SataTT.P0T2M));
+ DEBUG ((EFI_D_INFO, " PCH_THERMAL_CONFIG PCH_THERMAL_THROTTLING SATA_THERMAL_THROTTLE P0T3M %x\n", PchPlatformPolicy->ThermalConfig->ThermalThrottling.SataTT.P0T3M));
+ DEBUG ((EFI_D_INFO, " PCH_THERMAL_CONFIG PCH_THERMAL_THROTTLING SATA_THERMAL_THROTTLE P0TDisp %x\n", PchPlatformPolicy->ThermalConfig->ThermalThrottling.SataTT.P0TDisp));
+ DEBUG ((EFI_D_INFO, " PCH_THERMAL_CONFIG PCH_THERMAL_THROTTLING SATA_THERMAL_THROTTLE P0Tinact %x\n", PchPlatformPolicy->ThermalConfig->ThermalThrottling.SataTT.P0Tinact));
+ DEBUG ((EFI_D_INFO, " PCH_THERMAL_CONFIG PCH_THERMAL_THROTTLING SATA_THERMAL_THROTTLE P0TDispFinit %x\n", PchPlatformPolicy->ThermalConfig->ThermalThrottling.SataTT.P0TDispFinit));
+ DEBUG ((EFI_D_INFO, " PCH_THERMAL_CONFIG PCH_THERMAL_THROTTLING SATA_THERMAL_THROTTLE P1T1M %x\n", PchPlatformPolicy->ThermalConfig->ThermalThrottling.SataTT.P1T1M));
+ DEBUG ((EFI_D_INFO, " PCH_THERMAL_CONFIG PCH_THERMAL_THROTTLING SATA_THERMAL_THROTTLE P1T2M %x\n", PchPlatformPolicy->ThermalConfig->ThermalThrottling.SataTT.P1T2M));
+ DEBUG ((EFI_D_INFO, " PCH_THERMAL_CONFIG PCH_THERMAL_THROTTLING SATA_THERMAL_THROTTLE P1T3M %x\n", PchPlatformPolicy->ThermalConfig->ThermalThrottling.SataTT.P1T3M));
+ DEBUG ((EFI_D_INFO, " PCH_THERMAL_CONFIG PCH_THERMAL_THROTTLING SATA_THERMAL_THROTTLE P1TDisp %x\n", PchPlatformPolicy->ThermalConfig->ThermalThrottling.SataTT.P1TDisp));
+ DEBUG ((EFI_D_INFO, " PCH_THERMAL_CONFIG PCH_THERMAL_THROTTLING SATA_THERMAL_THROTTLE P1Tinact %x\n", PchPlatformPolicy->ThermalConfig->ThermalThrottling.SataTT.P1Tinact));
+ DEBUG ((EFI_D_INFO, " PCH_THERMAL_CONFIG PCH_THERMAL_THROTTLING SATA_THERMAL_THROTTLE P1TDispFinit %x\n", PchPlatformPolicy->ThermalConfig->ThermalThrottling.SataTT.P1TDispFinit));
+ DEBUG ((EFI_D_INFO, " PCH_THERMAL_CONFIG PCH_THERMAL_THROTTLING SATA_THERMAL_THROTTLE SuggestedSetting %x\n", PchPlatformPolicy->ThermalConfig->ThermalThrottling.SataTT.SuggestedSetting));
+ DEBUG ((EFI_D_INFO, " PCH_THERMAL_CONFIG PchHotLevel = %x\n", PchPlatformPolicy->ThermalConfig->PchHotLevel));
+
+ DEBUG ((EFI_D_INFO, "\n"));
+ DEBUG ((EFI_D_INFO, "------------------------ PCH_LPC_HPET_CONFIG -----------------\n"));
+ DEBUG ((EFI_D_INFO, " PCH_LPC_HPET_CONFIG HpetConfig %x\n", PchPlatformPolicy->HpetConfig->BdfValid));
+ for (i = 0; i < PCH_HPET_BDF_MAX; i++) {
+ DEBUG ((EFI_D_INFO, " PCH_LPC_HPET_CONFIG Hpet[%d] BusNumber %x\n", i, PchPlatformPolicy->HpetConfig->Hpet[i].BusNumber));
+ DEBUG ((EFI_D_INFO, " PCH_LPC_HPET_CONFIG Hpet[%d] DeviceNumber %x\n", i, PchPlatformPolicy->HpetConfig->Hpet[i].DeviceNumber));
+ DEBUG ((EFI_D_INFO, " PCH_LPC_HPET_CONFIG Hpet[%d] FunctionNumber %x\n", i, PchPlatformPolicy->HpetConfig->Hpet[i].FunctionNumber));
+ }
+
+ DEBUG ((EFI_D_INFO, "\n"));
+ DEBUG ((EFI_D_INFO, "------------------------ PCH_LPC_SIRQ_CONFIG -----------------\n"));
+ DEBUG ((EFI_D_INFO, " PCH_LPC_SIRQ_CONFIG SirqEnable= %x\n", PchPlatformPolicy->SerialIrqConfig->SirqEnable));
+ DEBUG ((EFI_D_INFO, " PCH_LPC_SIRQ_CONFIG SirqMode= %x\n", PchPlatformPolicy->SerialIrqConfig->SirqMode));
+ DEBUG ((EFI_D_INFO, " PCH_LPC_SIRQ_CONFIG StartFramePulse= %x\n", PchPlatformPolicy->SerialIrqConfig->StartFramePulse));
+
+ DEBUG ((EFI_D_INFO, "\n"));
+ DEBUG ((EFI_D_INFO, "------------------------ PCH_DMI_CONFIG -----------------\n"));
+ DEBUG ((EFI_D_INFO, " PCH_DMI_CONFIG DmiAspm= %x\n", PchPlatformPolicy->DmiConfig->DmiAspm));
+ DEBUG ((EFI_D_INFO, " PCH_DMI_CONFIG DmiExtSync= %x\n", PchPlatformPolicy->DmiConfig->DmiExtSync));
+ DEBUG ((EFI_D_INFO, " PCH_DMI_CONFIG DmiIot= %x\n", PchPlatformPolicy->DmiConfig->DmiIot));
+
+ DEBUG ((EFI_D_INFO, "\n"));
+ DEBUG ((EFI_D_INFO, "------------------------ PCH_PWR_OPT_CONFIG -----------------\n"));
+ DEBUG ((EFI_D_INFO, " PCH_PWR_OPT_CONFIG PchPwrOptDmi= %x\n", PchPlatformPolicy->PwrOptConfig->PchPwrOptDmi));
+ DEBUG ((EFI_D_INFO, " PCH_PWR_OPT_CONFIG PchPwrOptGbe= %x\n", PchPlatformPolicy->PwrOptConfig->PchPwrOptGbe));
+ DEBUG ((EFI_D_INFO, " PCH_PWR_OPT_CONFIG PchPwrOptXhci= %x\n", PchPlatformPolicy->PwrOptConfig->PchPwrOptXhci));
+ DEBUG ((EFI_D_INFO, " PCH_PWR_OPT_CONFIG PchPwrOptEhci= %x\n", PchPlatformPolicy->PwrOptConfig->PchPwrOptEhci));
+ DEBUG ((EFI_D_INFO, " PCH_PWR_OPT_CONFIG PchPwrOptSata= %x\n", PchPlatformPolicy->PwrOptConfig->PchPwrOptSata));
+ DEBUG ((EFI_D_INFO, " PCH_PWR_OPT_CONFIG MemCloseStateEn= %x\n", PchPlatformPolicy->PwrOptConfig->MemCloseStateEn));
+ DEBUG ((EFI_D_INFO, " PCH_PWR_OPT_CONFIG InternalObffEn= %x\n", PchPlatformPolicy->PwrOptConfig->InternalObffEn));
+ DEBUG ((EFI_D_INFO, " PCH_PWR_OPT_CONFIG ExternalObffEn= %x\n", PchPlatformPolicy->PwrOptConfig->ExternalObffEn));
+ for (i = 0; i < GetPchMaxPciePortNum (); i++) {
+ DEBUG ((EFI_D_INFO, " PCH_PWR_OPT_CONFIG RootPort[%d] LtrEnable= %x\n", i, PchPlatformPolicy->PwrOptConfig->PchPwrOptPcie[i].LtrEnable));
+ DEBUG ((EFI_D_INFO, " PCH_PWR_OPT_CONFIG RootPort[%d] ObffEnable= %x\n", i, PchPlatformPolicy->PwrOptConfig->PchPwrOptPcie[i].ObffEnable));
+ }
+ DEBUG ((EFI_D_INFO, " PCH_PWR_OPT_CONFIG NumOfDevLtrOverride= %x\n", PchPlatformPolicy->PwrOptConfig->NumOfDevLtrOverride));
+ DEBUG ((EFI_D_INFO, " PCH_PWR_OPT_CONFIG DevLtrOverride VendorId= %x\n", PchPlatformPolicy->PwrOptConfig->DevLtrOverride->VendorId));
+ DEBUG ((EFI_D_INFO, " PCH_PWR_OPT_CONFIG DevLtrOverride DeviceId= %x\n", PchPlatformPolicy->PwrOptConfig->DevLtrOverride->DeviceId));
+ DEBUG ((EFI_D_INFO, " PCH_PWR_OPT_CONFIG DevLtrOverride RevId= %x\n", PchPlatformPolicy->PwrOptConfig->DevLtrOverride->RevId));
+ DEBUG ((EFI_D_INFO, " PCH_PWR_OPT_CONFIG DevLtrOverride SnoopLatency= %x\n", PchPlatformPolicy->PwrOptConfig->DevLtrOverride->SnoopLatency));
+ DEBUG ((EFI_D_INFO, " PCH_PWR_OPT_CONFIG DevLtrOverride NonSnoopLatency= %x\n", PchPlatformPolicy->PwrOptConfig->DevLtrOverride->NonSnoopLatency));
+ DEBUG ((EFI_D_INFO, " PCH_PWR_OPT_CONFIG LegacyDmaDisable= %x\n", PchPlatformPolicy->PwrOptConfig->LegacyDmaDisable));
+
+ for (i = 0; i < GetPchMaxPciePortNum (); i++) {
+ DEBUG ((EFI_D_INFO, " PCH_PWR_OPT_CONFIG RootPort[%d] LtrConfigLock= %x\n", i, PchPlatformPolicy->PwrOptConfig->PchPwrOptPcie[i].LtrConfigLock));
+ DEBUG ((EFI_D_INFO, " PCH_PWR_OPT_CONFIG RootPort[%d] LtrMaxSnoopLatency = %x\n", i, PchPlatformPolicy->PwrOptConfig->PchPwrOptPcie[i]. LtrMaxSnoopLatency));
+ DEBUG ((EFI_D_INFO, " PCH_PWR_OPT_CONFIG RootPort[%d] LtrMaxNoSnoopLatency = %x\n", i, PchPlatformPolicy->PwrOptConfig->PchPwrOptPcie[i].LtrMaxNoSnoopLatency));
+ DEBUG ((EFI_D_INFO, " PCH_PWR_OPT_CONFIG RootPort[%d] SnoopLatencyOverrideMode= %x\n", i, PchPlatformPolicy->PwrOptConfig->PchPwrOptPcie[i].SnoopLatencyOverrideMode));
+ DEBUG ((EFI_D_INFO, " PCH_PWR_OPT_CONFIG RootPort[%d] SnoopLatencyOverrideMultiplier= %x\n", i, PchPlatformPolicy->PwrOptConfig->PchPwrOptPcie[i].SnoopLatencyOverrideMultiplier));
+ DEBUG ((EFI_D_INFO, " PCH_PWR_OPT_CONFIG RootPort[%d] SnoopLatencyOverrideValue= %x\n", i, PchPlatformPolicy->PwrOptConfig->PchPwrOptPcie[i].SnoopLatencyOverrideValue));
+ DEBUG ((EFI_D_INFO, " PCH_PWR_OPT_CONFIG RootPort[%d] NonSnoopLatencyOverrideMode= %x\n", i, PchPlatformPolicy->PwrOptConfig->PchPwrOptPcie[i].NonSnoopLatencyOverrideMode));
+ DEBUG ((EFI_D_INFO, " PCH_PWR_OPT_CONFIG RootPort[%d] NonSnoopLatencyOverrideMultiplier= %x\n", i, PchPlatformPolicy->PwrOptConfig->PchPwrOptPcie[i].NonSnoopLatencyOverrideMultiplier));
+ DEBUG ((EFI_D_INFO, " PCH_PWR_OPT_CONFIG RootPort[%d] NonSnoopLatencyOverrideValue= %x\n", i, PchPlatformPolicy->PwrOptConfig->PchPwrOptPcie[i].NonSnoopLatencyOverrideValue));
+ }
+ DEBUG ((EFI_D_INFO, "\n"));
+ DEBUG ((EFI_D_INFO, "------------------------ PCH Dump platform protocol End -----------------\n"));
+ DEBUG ((EFI_D_INFO, "\n"));
+#endif
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchFvi.c b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchFvi.c
new file mode 100644
index 0000000..a4f89cc
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchFvi.c
@@ -0,0 +1,137 @@
+/** @file
+ PCH Firmware Version Info implementation.
+
+@copyright
+ Copyright (c) 2011 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "PchInit.h"
+
+FVI_ELEMENT_AND_FUNCTION mPchFviElementsData[] = {
+ {
+ DEFAULT_FVI_ELEMENT_DATA (PCH),
+ NULL
+ },
+ {
+ {
+ 1,
+ 2,
+ PCH_CRID_VERSION,
+ PCH_CRID_STATUS,
+ PCH_CRID_DISABLED,
+ },
+ NULL
+ },
+ {
+ {
+ 1,
+ 0,
+ PCH_CRID_VERSION,
+ PCH_CRID_ORIGINAL_VALUE,
+ {
+ 0
+ },
+ },
+ NULL
+ },
+ {
+ {
+ 1,
+ 0,
+ PCH_CRID_VERSION,
+ PCH_CRID_NEW_VALUE,
+ {
+ 0
+ },
+ },
+ NULL
+ },
+ {
+ {
+ 1,
+ 0,
+ RAID_RC_VERSION,
+ RAID_FVI_STRING,
+ {
+ 0
+ },
+ },
+ NULL
+ },
+#ifdef ULT_FLAG
+ {
+ {
+ 1,
+ 0,
+ {
+ PCH_LPTLP_HSIO_VER_BX,
+ 0,
+ 0,
+ 0,
+ },
+ PCH_LPTLPBX_HSIO_STRING,
+ {
+ 0
+ },
+ },
+ NULL
+ },
+#endif //ULT_FLAG
+#ifdef TRAD_FLAG
+ {
+ {
+ 1,
+ 0,
+ {
+ PCH_LPTH_HSIO_VER_B0,
+ 0,
+ 0,
+ 0,
+ },
+ PCH_LPTHB0_HSIO_STRING,
+ {
+ 0
+ },
+ },
+ NULL
+ },
+ {
+ {
+ 1,
+ 0,
+ {
+ PCH_LPTH_HSIO_VER_CX,
+ 0,
+ 0,
+ 0,
+ },
+ PCH_LPTHCX_HSIO_STRING,
+ {
+ 0
+ },
+ },
+ NULL
+ },
+#endif //TRAD_FLAG
+};
+
+FVI_DATA_HUB_CALLBACK_CONTEXT mPchFviVersionData = {
+ MISC_SUBCLASS_FVI_HEADER_ENTRY (PCH),
+ mPchFviElementsData,
+};
+
+UINTN mPchFviElements = sizeof (mPchFviElementsData)/ sizeof (FVI_ELEMENT_AND_FUNCTION);
+
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchInit.c b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchInit.c
new file mode 100644
index 0000000..df7f05b
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchInit.c
@@ -0,0 +1,2469 @@
+/** @file
+ This is the driver that initializes the Intel PCH.
+
+@copyright
+ Copyright (c) 1999 - 2015 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "PchInit.h"
+#include "HeciMsgLib.h"
+#include "ChipsetInitHob.h"
+
+// [ EIP357393 ]+>>>
+#define AMI_PCI_BUS_EXT_PROTOCOL_GUID \
+{ 0xf42a009d, 0x977f, 0x4f08, 0x94, 0x40, 0xbc, 0xa5, 0xa3, 0xbe, 0xd9, 0xaf };
+
+static EFI_GUID gAmiExtPciBusProtocolGuid = AMI_PCI_BUS_EXT_PROTOCOL_GUID;
+// [ EIP357393 ]+<<<
+
+//
+// Global Variables
+//
+EFI_HANDLE mImageHandle;
+#ifdef USB_PRECONDITION_ENABLE_FLAG
+extern EFI_USB_HC_PORT_PRECONDITION *mPrivatePreConditionList;
+#endif // USB_PRECONDITION_ENABLE_FLAG
+
+//
+// GUID Definitions
+//
+EFI_GUID gChipsetInitHobGuid = CHIPSET_INIT_INFO_HOB_GUID;
+EFI_GUID gEfiHeciProtocolGuid = HECI_PROTOCOL_GUID;
+
+//
+// EFI_EVENT
+//
+EFI_EVENT mHeciEvent;
+
+//
+// Local function prototypes
+//
+EFI_STATUS
+InitializePchDevice (
+ IN OUT PCH_INSTANCE_PRIVATE_DATA *PchInstance,
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar,
+ IN UINT16 PmBase,
+ IN UINT16 GpioBase
+ );
+
+EFI_STATUS
+ProgramSvidSid (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar
+ );
+
+VOID
+EFIAPI
+PchExitBootServicesEvent (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ );
+
+VOID
+EFIAPI
+PchInitBeforeBoot (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ );
+
+// [ EIP357393 ]+>>>
+EFI_STATUS
+EFIAPI
+PchSpiLockBeforeEndOfDxe (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ );
+// [ EIP357393 ]+<<<
+
+EFI_STATUS
+ChipsetInitSettingsCheck (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy
+ );
+
+/**
+ Configures PCH IOBP and stores this configuration in S3 boot script
+
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+ @param[in] Address Address of the IOBP register block
+ @param[in] AndMask Mask to AND with the register
+ @param[in] OrMask Mask to OR with the register
+**/
+VOID
+ProgramIobpWithScript (
+ IN UINT32 RootComplexBar,
+ IN UINT32 Address,
+ IN UINT32 AndMask,
+ IN UINT32 OrMask
+ )
+{
+ EFI_STATUS Status;
+
+ Status = ProgramIobp (RootComplexBar, Address, AndMask, OrMask);
+ ASSERT_EFI_ERROR (Status);
+
+ Status = PCH_INIT_COMMON_SCRIPT_SAVE_IOBP_S3_ITEM (
+ RootComplexBar,
+ Address,
+ AndMask,
+ OrMask
+ );
+ ASSERT_EFI_ERROR (Status);
+}
+
+/**
+ Configures 32-bit MMIO register and stores this configuration in S3 boot script
+
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+ @param[in] Address Address of the IOBP register block
+ @param[in] AndMask Mask to AND with the register
+ @param[in] OrMask Mask to OR with the register
+**/
+VOID
+MmioAndThenOr32WithScript (
+ IN UINTN Address,
+ IN UINT32 AndMask,
+ IN UINT32 OrMask
+ )
+{
+ MmioAndThenOr32 (Address, AndMask, OrMask);
+
+ PCH_INIT_COMMON_SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ Address,
+ &OrMask,
+ &AndMask
+ );
+}
+
+/**
+ This is the standard EFI driver point that detects
+ whether there is an PCH southbridge in the system
+ and if so, initializes the chip.
+
+ @param[in] ImageHandle Handle for the image of this driver
+ @param[in] SystemTable Pointer to the EFI System Table
+
+ @retval EFI_SUCCESS The function completed successfully
+ @retval EFI_OUT_OF_RESOURCES Do not have enough resources to initialize the driver
+**/
+EFI_STATUS
+EFIAPI
+PchInitEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ UINT8 BusNumber;
+ UINT32 RootComplexBar;
+ DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy;
+ UINTN NumHandles;
+ EFI_HANDLE *HandleBuffer;
+ UINT32 Index;
+ PCH_INSTANCE_PRIVATE_DATA *PchInstance;
+ UINT16 PmBase;
+ UINT16 GpioBase;
+ UINTN PciD31F0RegBase;
+
+ DEBUG ((EFI_D_INFO, "PchInitEntryPoint() Start\n"));
+
+ PchInstance = NULL;
+ PchPlatformPolicy = NULL;
+
+ INITIALIZE_SCRIPT (ImageHandle, SystemTable);
+ mImageHandle = ImageHandle;
+
+ ///
+ /// Retrieve all instances of PCH Platform Policy protocol
+ ///
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gDxePchPlatformPolicyProtocolGuid,
+ NULL,
+ &NumHandles,
+ &HandleBuffer
+ );
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ for (Index = 0; Index < NumHandles; Index++) {
+ Status = gBS->HandleProtocol (
+ HandleBuffer[Index],
+ &gDxePchPlatformPolicyProtocolGuid,
+ (VOID **) &PchPlatformPolicy
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Allocate and install the PCH Info protocol
+ ///
+ BusNumber = PchPlatformPolicy->BusNumber;
+ PciD31F0RegBase = MmPciAddress (
+ 0,
+ PchPlatformPolicy->BusNumber,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ 0
+ );
+ RootComplexBar = MmioRead32 (PciD31F0RegBase + R_PCH_LPC_RCBA) & B_PCH_LPC_RCBA_BAR;
+ PmBase = MmioRead16 (PciD31F0RegBase + R_PCH_LPC_ACPI_BASE) & B_PCH_LPC_ACPI_BASE_BAR;
+ GpioBase = MmioRead16 (PciD31F0RegBase + R_PCH_LPC_GPIO_BASE) & B_PCH_LPC_GPIO_BASE_BAR;
+
+ ASSERT (RootComplexBar != 0);
+ ASSERT (PmBase != 0);
+ ASSERT (GpioBase != 0);
+
+ DEBUG ((EFI_D_INFO, "PCH Device:\n-------------\n"));
+ DEBUG ((EFI_D_INFO, " RCBA 0x%X\n", RootComplexBar));
+ DEBUG ((EFI_D_INFO, " PmBase 0x%X\n", PmBase));
+ DEBUG ((EFI_D_INFO, " GpioBase 0x%X\n", GpioBase));
+ DEBUG ((EFI_D_INFO, "-------------\n"));
+
+ ///
+ /// Dump whole DXE_PCH_PLATFORM_POLICY_PROTOCOL and serial out.
+ ///
+ PchDumpPlatformProtocol (PchPlatformPolicy);
+ ///
+ /// Initialize the PCH device
+ ///
+ InitializePchDevice (PchInstance, PchPlatformPolicy, RootComplexBar, PmBase, GpioBase);
+
+ PchInstance = AllocateZeroPool (sizeof (PCH_INSTANCE_PRIVATE_DATA));
+ if (PchInstance == NULL) {
+ ASSERT (FALSE);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ PchInstance->PchInfo.Revision = PCH_INFO_PROTOCOL_REVISION_2;
+ PchInstance->PchInfo.BusNumber = BusNumber;
+ PchInstance->PchInfo.RCVersion = PCH_RC_VERSION;
+#ifdef USB_PRECONDITION_ENABLE_FLAG
+ PchInstance->PchInfo.Preconditioned = mPrivatePreConditionList;
+#endif // USB_PRECONDITION_ENABLE_FLAG
+
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &(HandleBuffer[Index]),
+ &gEfiPchInfoProtocolGuid,
+ &(PchInstance->PchInfo),
+ NULL
+ );
+ }
+
+ (gBS->FreePool) (HandleBuffer);
+
+ DEBUG ((EFI_D_INFO, "PchInitEntryPoint() End\n"));
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Initialize the PCH device according to the PCH Platform Policy protocol
+
+ @param[in, out] PchInstance PCH instance private data. May get updated by this function
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+ @param[in] PmBase Power Management IO base address of this PCH device
+ @param[in] GpioBase GPIO base address of this PCH device
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+InitializePchDevice (
+ IN OUT PCH_INSTANCE_PRIVATE_DATA *PchInstance,
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar,
+ IN UINT16 PmBase,
+ IN UINT16 GpioBase
+ )
+{
+ EFI_STATUS Status;
+ BOOLEAN AzaliaEnable;
+ UINT32 FuncDisableReg;
+ VOID *Registration;
+ VOID *Registration1; // [ EIP357393 ]
+ EFI_EVENT LegacyBootEvent;
+ EFI_EVENT ExitBootServicesEvent;
+ UINT16 LpcDeviceId;
+
+ DEBUG ((EFI_D_INFO, "InitializePchDevice() Start\n"));
+
+ FuncDisableReg = MmioRead32 (RootComplexBar + R_PCH_RCRB_FUNC_DIS);
+
+ LpcDeviceId = MmioRead16 (
+ MmPciAddress (
+ 0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ 0
+ ) + R_PCH_LPC_DEVICE_ID);
+
+ ///
+ /// Take care of any ChipsetInit settings before going any further.
+ ///
+ Status = ChipsetInitSettingsCheck(PchPlatformPolicy);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Miscellaneous power management handling
+ ///
+ Status = ConfigureMiscPm (PchPlatformPolicy, RootComplexBar, GpioBase);
+ ASSERT_EFI_ERROR (Status);
+ ///
+ /// Additional power management setting
+ ///
+ Status = ConfigureAdditionalPm (PchPlatformPolicy, RootComplexBar);
+ ASSERT_EFI_ERROR (Status);
+ ///
+ /// Configures PCH DMI power management configuration
+ ///
+ Status = ConfigureDmiPm (PchPlatformPolicy, RootComplexBar);
+ ASSERT_EFI_ERROR (Status);
+ ///
+ /// Deep Sx Enabling
+ ///
+ Status = ProgramDeepSx (PchPlatformPolicy, RootComplexBar);
+ ASSERT_EFI_ERROR (Status);
+ ///
+ /// Perform PCH initialization sequence
+ ///
+ Status = ConfigureMiscItems (PchPlatformPolicy, RootComplexBar, &FuncDisableReg);
+ ASSERT_EFI_ERROR (Status);
+
+#ifdef ADSP_FLAG
+ ///
+ /// Configure AudioDSP
+ ///
+ if(IS_PCH_LPTLP_LPC_DEVICE_ID(LpcDeviceId)) {
+ Status = ConfigureAudioDsp (PchPlatformPolicy, RootComplexBar, &FuncDisableReg);
+ ASSERT_EFI_ERROR (Status);
+ }
+#endif // ADSP_FLAG
+
+ ///
+ /// Detect and initialize the type of codec present in the system
+ ///
+ Status = ConfigureAzalia (PchPlatformPolicy, RootComplexBar, &AzaliaEnable);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Check to disable Azalia controller
+ ///
+ if (!AzaliaEnable) {
+ FuncDisableReg |= B_PCH_RCRB_FUNC_DIS_AZALIA;
+ }
+ ///
+ /// Initialize LAN
+ ///
+ Status = ConfigureLan (PchPlatformPolicy, RootComplexBar);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Configure USB
+ ///
+ Status = ConfigureUsb (PchPlatformPolicy, RootComplexBar, &FuncDisableReg);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Initialize PCIE root ports
+ ///
+ Status = PchInitRootPorts (PchPlatformPolicy, RootComplexBar, PmBase, &FuncDisableReg);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Thermal controller already enabled in PEI
+ ///
+
+ ///
+ /// Sata Controllers
+ ///
+ Status = ConfigureSata (PchPlatformPolicy, RootComplexBar, &FuncDisableReg, GpioBase);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Display link
+ ///
+ Status = ConfigureDisplay (PchPlatformPolicy, RootComplexBar);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Set the PCH Function Disable Register
+ ///
+ MmioWrite32 ((UINTN) (RootComplexBar + R_PCH_RCRB_FUNC_DIS), (UINT32) (FuncDisableReg));
+
+ ///
+ /// Reads back for posted write to take effect
+ ///
+ MmioRead32 (RootComplexBar + R_PCH_RCRB_FUNC_DIS);
+
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_FUNC_DIS),
+ 1,
+ &FuncDisableReg
+ );
+
+ ///
+ /// Reads back for posted write to take effect
+ ///
+ SCRIPT_MEM_POLL (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_FUNC_DIS),
+ &FuncDisableReg, // BitMask
+ &FuncDisableReg, // BitValue
+ 1, // Duration
+ 1 // LoopTimes
+ );
+ ///
+ /// Perform clock gating register settings
+ /// PCH BIOS Spec Rev 0.5.0, section 19.10 Enabling Clock Gating
+ ///
+ Status = ConfigureClockGating (PchPlatformPolicy, RootComplexBar, FuncDisableReg);
+ ASSERT_EFI_ERROR (Status);
+
+ Status = ConfigureIoApic (PchPlatformPolicy, RootComplexBar);
+ ASSERT_EFI_ERROR (Status);
+
+ Status = ProgramSvidSid (PchPlatformPolicy, RootComplexBar);
+ ASSERT_EFI_ERROR (Status);
+
+#ifdef SERIAL_IO_FLAG
+ ///
+ /// Configure Serial IO Controllers
+ ///
+ if(IS_PCH_LPTLP_LPC_DEVICE_ID(LpcDeviceId)) {
+ Status = ConfigureSerialIo (PchPlatformPolicy, RootComplexBar);
+ ASSERT_EFI_ERROR (Status);
+ }
+#endif // SERIAL_IO_FLAG
+
+// [ EIP357393 ]+>>>
+ // Create an AMI ExtPciBus protocol call back event.
+ //
+ EfiCreateProtocolNotifyEvent (
+ &gAmiExtPciBusProtocolGuid,
+ EFI_TPL_CALLBACK,
+ PchSpiLockBeforeEndOfDxe,
+ NULL,
+ &Registration1
+ );
+// [ EIP357393 ]+<<<
+
+ ///
+ /// Create an ExitPmAuth protocol call back event.
+ ///
+ EfiCreateProtocolNotifyEvent (
+ &gExitPmAuthProtocolGuid,
+ EFI_TPL_CALLBACK,
+ PchInitBeforeBoot,
+ NULL,
+ &Registration
+ );
+
+ ///
+ /// Create events for PCH to do the task before ExitBootServices/LegacyBoot.
+ /// It is guaranteed that only one of two events below will be signalled
+ ///
+ Status = gBS->CreateEvent (
+ EVENT_SIGNAL_EXIT_BOOT_SERVICES,
+ EFI_TPL_CALLBACK,
+ PchExitBootServicesEvent,
+ NULL,
+ &ExitBootServicesEvent
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ Status = EfiCreateEventLegacyBootEx (
+ EFI_TPL_CALLBACK,
+ PchExitBootServicesEvent,
+ NULL,
+ &LegacyBootEvent
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ DEBUG ((EFI_D_INFO, "InitializePchDevice() End\n"));
+
+ return Status;
+}
+
+/**
+ Program Pch devices Subsystem Vendor Identifier (SVID) and Subsystem Identifier (SID).
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+ProgramSvidSid (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar
+ )
+{
+ UINT8 Index;
+ UINT16 EhciAccessCntl;
+ UINT8 BusNumber;
+ UINTN PciEAddressBase;
+ UINT8 DeviceNumber;
+ UINT8 FunctionNumber;
+ UINT8 SvidRegOffset;
+ BOOLEAN IsPchEhci;
+ STATIC PCH_SVID_SID_INIT_ENTRY SvidSidInitTable[] = {
+ {
+ 31,
+ 0,
+ R_PCH_LPC_SS
+ },
+ {
+ 31,
+ 2,
+ R_PCH_SATA_AHCI_SVID
+ },
+ {
+ 31,
+ 5,
+ R_PCH_SATA_AHCI_SVID
+ },
+ {
+ 31,
+ 3,
+ R_PCH_SMBUS_SVID
+ },
+ {
+ 31,
+ 6,
+ R_PCH_THERMAL_SVID
+ },
+ {
+ 29,
+ 0,
+ R_PCH_EHCI_SVID
+ },
+ {
+ 26,
+ 0,
+ R_PCH_EHCI_SVID
+ },
+ {
+ 20,
+ 0,
+ R_PCH_XHCI_SVID
+ },
+ {
+ 27,
+ 0,
+ R_PCH_HDA_SVID
+ },
+ {
+ 28,
+ 0,
+ R_PCH_PCIE_SVID
+ },
+ {
+ 28,
+ 1,
+ R_PCH_PCIE_SVID
+ },
+ {
+ 28,
+ 2,
+ R_PCH_PCIE_SVID
+ },
+ {
+ 28,
+ 3,
+ R_PCH_PCIE_SVID
+ },
+ {
+ 28,
+ 4,
+ R_PCH_PCIE_SVID
+ },
+ {
+ 28,
+ 5,
+ R_PCH_PCIE_SVID
+ },
+ {
+ 28,
+ 6,
+ R_PCH_PCIE_SVID
+ },
+ {
+ 28,
+ 7,
+ R_PCH_PCIE_SVID
+ },
+ {
+ 25,
+ 0,
+ R_PCH_LAN_SVID
+ },
+ /* HECI */
+ {
+ 22,
+ 0,
+ PCI_SVID_OFFSET
+ },
+ {
+ 22,
+ 1,
+ PCI_SVID_OFFSET
+ },
+ {
+ 22,
+ 2,
+ PCI_SVID_OFFSET
+ },
+ {
+ 22,
+ 3,
+ PCI_SVID_OFFSET
+ }
+ };
+ PCH_SERIES PchSeries;
+
+ DEBUG ((EFI_D_INFO, "ProgramSvidSid() Start\n"));
+
+ PchSeries = GetPchSeries();
+ EhciAccessCntl = 0;
+ BusNumber = PchPlatformPolicy->BusNumber;
+
+ if ((PchPlatformPolicy->DefaultSvidSid->SubSystemVendorId != 0) ||
+ (PchPlatformPolicy->DefaultSvidSid->SubSystemId != 0)) {
+ for (Index = 0; Index < (sizeof (SvidSidInitTable) / sizeof (PCH_SVID_SID_INIT_ENTRY)); Index++) {
+ DeviceNumber = SvidSidInitTable[Index].DeviceNumber;
+ FunctionNumber = SvidSidInitTable[Index].FunctionNumber;
+ SvidRegOffset = SvidSidInitTable[Index].SvidRegOffset;
+ PciEAddressBase = MmPciAddress (
+ 0,
+ BusNumber,
+ DeviceNumber,
+ FunctionNumber,
+ 0
+ );
+ ///
+ /// Skip if the device is disabled
+ ///
+ if (MmioRead16 (PciEAddressBase) != V_PCH_INTEL_VENDOR_ID) {
+ continue;
+ }
+
+ IsPchEhci = FALSE;
+ if (PchSeries == PchH) {
+ IsPchEhci = IS_PCH_H_EHCI (DeviceNumber, FunctionNumber);
+ } else if (PchSeries == PchLp) {
+ IsPchEhci = IS_PCH_LP_EHCI (DeviceNumber, FunctionNumber);
+ }
+
+ ///
+ /// Set EHCI devices WRT_RDONLY bit (D29:F0,D26:F0:80h, bit 0) to 1, to make SVID and SID registers are writable
+ ///
+ if (IsPchEhci) {
+ EhciAccessCntl = MmioRead16 ((UINTN) (PciEAddressBase + R_PCH_EHCI_ACCESS_CNTL));
+ MmioOr16 ((UINTN) (PciEAddressBase + R_PCH_EHCI_ACCESS_CNTL), B_PCH_EHCI_ACCESS_CNTL_ENABLE);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PciEAddressBase + R_PCH_EHCI_ACCESS_CNTL),
+ 1,
+ (VOID *) (UINTN) (PciEAddressBase + R_PCH_EHCI_ACCESS_CNTL)
+ );
+ }
+
+ if ((DeviceNumber == 22 && FunctionNumber == 2) || (DeviceNumber == 22 && FunctionNumber == 3)) {
+ ///
+ /// Sub System Identifiers register of D22:F2&F3 is 32bit access and write once
+ ///
+ MmioWrite32 (
+ (UINTN) (PciEAddressBase + SvidRegOffset),
+ (UINT32) (PchPlatformPolicy->DefaultSvidSid->SubSystemVendorId |
+ (PchPlatformPolicy->DefaultSvidSid->SubSystemId << 16))
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PciEAddressBase + SvidRegOffset),
+ 1,
+ (VOID *) (UINTN) (PciEAddressBase + SvidRegOffset)
+ );
+ } else {
+ ///
+ /// Program Pch devices Subsystem Vendor Identifier (SVID)
+ ///
+ MmioWrite16 (
+ (UINTN) (PciEAddressBase + SvidRegOffset),
+ PchPlatformPolicy->DefaultSvidSid->SubSystemVendorId
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PciEAddressBase + SvidRegOffset),
+ 1,
+ (VOID *) (UINTN) (PciEAddressBase + SvidRegOffset)
+ );
+
+ ///
+ /// Program Pch devices Subsystem Identifier (SID)
+ ///
+ MmioWrite16 (
+ (UINTN) (PciEAddressBase + SvidRegOffset + 2),
+ PchPlatformPolicy->DefaultSvidSid->SubSystemId
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PciEAddressBase + SvidRegOffset + 2),
+ 1,
+ (VOID *) (PciEAddressBase + SvidRegOffset + 2)
+ );
+ }
+ ///
+ /// Restore the EHCI devices WRT_RDONLY bit (D29:F0,D26:F0:80h, bit 0) value
+ ///
+ if (IsPchEhci) {
+ MmioWrite16 ((UINTN) (PciEAddressBase + R_PCH_EHCI_ACCESS_CNTL), EhciAccessCntl);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PciEAddressBase + R_PCH_EHCI_ACCESS_CNTL),
+ 1,
+ &EhciAccessCntl
+ );
+ }
+ }
+ }
+
+ DEBUG ((EFI_D_INFO, "ProgramSvidSid() End\n"));
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Initialize R/WO Registers that described in PCH BIOS Spec
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+ @param[in] RootComplexBar RootComplexBar address of this PCH device
+ @param[in, out] FuncDisableReg The value of Function disable register
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+PciERWORegInit (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar,
+ IN OUT UINT32 *FuncDisableReg
+ )
+{
+ UINTN Index;
+ UINTN PciD31F5RegBase;
+ UINT8 BusNumber;
+ UINT8 RootPortFunction;
+ UINTN RPBase;
+ UINT32 Data32;
+ UINT16 Data16;
+ UINT8 Data8;
+ PCH_SERIES PchSeries;
+
+ DEBUG ((EFI_D_INFO, "PciERWORegInit() Start\n"));
+
+ PchSeries = GetPchSeries();
+ BusNumber = PchPlatformPolicy->BusNumber;
+ PciD31F5RegBase = 0;
+ if (PchSeries == PchH) {
+ PciD31F5RegBase = MmPciAddress (0, BusNumber, 31, 5, 0);
+ }
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 5.12 R/WO Registers, Table 5-4
+ /// System BIOS must read the register and write the same value back to the register
+ /// before passing control to the operating system.
+ /// Dev:Func/Type Register Offset Register Name Bits
+ /// D28:F0-F7 034h Capabilities Pointer 7:0
+ /// D28:F0-F7 040h Capabilities List 15:8
+ /// D28:F0-F7 042h PCI Express Capabilities 8
+ /// D28:F0~F7 044h Device Capabilities 2:0
+ /// D28:F0-F7 04Ch Link Capabilities 11:10, 17:15
+ /// D28:F0-F7 050h Link Control 3
+ /// D28:F0-F7 054h Slot Capabilities 31:19, 16:5
+ /// D28:F0-F7 064h Device Capabilities 2 11
+ /// D28:F0-F7 080h Message Signaled Interrupt Capability ID 15:8
+ /// D28:F0-F7 090h Port Mapping Regster 15:8
+ /// D28:F0-F7 094h Subsystem Vendor ID 31:0
+ /// D28:F0-F7 0D8h Miscellaneous Port Configuration 23, 2
+ /// D28:F0-F7 404h Latency Tolerance Reporting Override 2 2
+ /// RCBA 21A4h Link Capabilities 17:15 For PCH H
+ /// D31:F5 0A8h Next Capabilities Pointer 15:8
+ /// D31:F5 0B2h Capabilities List 9:8
+ ///
+ for (Index = 0; Index < GetPchMaxPciePortNum (); Index++) {
+ if (((*FuncDisableReg) & (B_PCH_RCRB_FUNC_DIS_PCI_EX_PORT1 << Index)) == 0) {
+ RootPortFunction = GetPchPcieRpfn(RootComplexBar, (UINT8)Index);
+ RPBase = MmPciAddress (0, BusNumber, PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS, RootPortFunction, 0);
+ Data32 = MmioRead32 (RPBase + R_PCH_PCIE_LCAP);
+ MmioWrite32 (RPBase + R_PCH_PCIE_LCAP, Data32);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RPBase + R_PCH_PCIE_LCAP),
+ 1,
+ &Data32
+ );
+
+ Data32 = MmioRead32 (RPBase + R_PCH_PCIE_SVID);
+ MmioWrite32 (RPBase + R_PCH_PCIE_SVID, Data32);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RPBase + R_PCH_PCIE_SVID),
+ 1,
+ &Data32
+ );
+
+ Data32 = MmioRead32 (RPBase + R_PCH_PCIE_SLCAP);
+ MmioWrite32 (RPBase + R_PCH_PCIE_SLCAP, Data32);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RPBase + R_PCH_PCIE_SLCAP),
+ 1,
+ &Data32
+ );
+ ///
+ /// Added PCIe register to be lockdown
+ ///
+ Data8 = MmioRead8 (RPBase + R_PCH_PCIE_CAPP);
+ MmioWrite8 (RPBase + R_PCH_PCIE_CAPP, Data8);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (RPBase + R_PCH_PCIE_CAPP),
+ 1,
+ &Data8
+ );
+
+ Data16 = MmioRead16 (RPBase + R_PCH_PCIE_CLIST);
+ MmioWrite16 (RPBase + R_PCH_PCIE_CLIST, Data16);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (RPBase + R_PCH_PCIE_CLIST),
+ 1,
+ &Data16
+ );
+
+ Data16 = MmioRead16 (RPBase + R_PCH_PCIE_DCAP);
+ MmioWrite16 (RPBase + R_PCH_PCIE_DCAP, Data16);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (RPBase + R_PCH_PCIE_DCAP),
+ 1,
+ &Data16
+ );
+
+ Data16 = MmioRead16 (RPBase + R_PCH_PCIE_MID);
+ MmioWrite16 (RPBase + R_PCH_PCIE_MID, Data16);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (RPBase + R_PCH_PCIE_MID),
+ 1,
+ &Data16
+ );
+
+ Data16 = MmioRead16 (RPBase + R_PCH_PCIE_SVCAP);
+ MmioWrite16 (RPBase + R_PCH_PCIE_SVCAP, Data16);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (RPBase + R_PCH_PCIE_SVCAP),
+ 1,
+ &Data16
+ );
+
+ if (PchSeries == PchLp) {
+ Data32 = MmioRead32 (RPBase + R_PCH_PCIE_L1SECH);
+ Data32 |= V_PCH_PCIE_L1SECH_L1SUBST_CAP_ID;
+ MmioWrite32 (RPBase + R_PCH_PCIE_L1SECH, Data32);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RPBase + R_PCH_PCIE_L1SECH),
+ 1,
+ &Data32
+ );
+
+ Data32 = MmioRead32 (RPBase + R_PCH_PCIE_L1SCAP);
+ MmioWrite32 (RPBase + R_PCH_PCIE_L1SCAP, Data32);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RPBase + R_PCH_PCIE_L1SCAP),
+ 1,
+ &Data32
+ );
+ }
+ }
+ }
+
+ if (PchSeries == PchH) {
+ ///
+ /// D31:F5:A8h[15:8]
+ ///
+ Data16 = MmioRead16 (PciD31F5RegBase + R_PCH_SATA_CR0);
+ MmioWrite16 (PciD31F5RegBase + R_PCH_SATA_CR0, Data16);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PciD31F5RegBase + R_PCH_SATA_CR0),
+ 1,
+ &Data16
+ );
+ ///
+ /// D31:F5:B2h[9:8]
+ ///
+ Data16 = MmioRead16 (PciD31F5RegBase + R_PCH_SATA_FLR_CLV);
+ MmioWrite16 (PciD31F5RegBase + R_PCH_SATA_FLR_CLV, Data16);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PciD31F5RegBase + R_PCH_SATA_FLR_CLV),
+ 1,
+ &Data16
+ );
+ }
+
+ ///
+ /// D28:F0-F7:42h[8] (PCI Express Capabilities) has been done in PchInitRootPorts().
+ /// D28:F0-F7:4Ch[17:15] (Link Capabilities) has been done in PchInitSingleRootPort().
+ /// D28:F0-F7:404h[2] (Latency Tolerance Reporting Override 2) has been done in PchInitSingleRootPort().
+ /// RCBA + 21A4h[17:15] (Link Capabilities) has been done in ConfigureDmiPm() for PCH H.
+ ///
+
+ DEBUG ((EFI_D_INFO, "PciERWORegInit() End\n"));
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Set a Root Port Downstream devices ASPM and LTR S3 dispatch item, this function may assert if any error happend
+
+ @param[in] RootPortBus Pci Bus Number of the root port
+ @param[in] RootPortDevice Pci Device Number of the root port
+ @param[in] RootPortFunc Pci Function Number of the root port
+ @param[in] RootPortAspm Root port Aspm configuration
+ @param[in] NumOfDevAspmOverride Number of Device specific ASPM policy override items
+ @param[in] DevAspmOverride Pointer to array of Device specific ASPM policy override items
+ @param[in] TempBusNumberMin Minimal temp bus number that can be assigned to the root port (as secondary
+ bus number) and its down stream switches
+ @param[in] TempBusNumberMax Maximal temp bus number that can be assigned to the root port (as subordinate
+ bus number) and its down stream switches
+ @param[in] NumOfDevLtrOverride Number of Device specific LTR override items
+ @param[in] DevLtrOverride Pointer to array of Device specific LTR policy override items
+ @param[in] PchPwrOptPcie Pcie Power Optimizer Configuration
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+SetPciePmS3Item (
+ IN UINT8 RootPortBus,
+ IN UINT8 RootPortDevice,
+ IN UINT8 RootPortFunc,
+ IN PCH_PCI_EXPRESS_ASPM_CONTROL RootPortAspm,
+ IN UINT8 NumOfDevAspmOverride,
+ IN PCH_PCIE_DEVICE_ASPM_OVERRIDE *DevAspmOverride,
+ IN UINT8 TempBusNumberMin,
+ IN UINT8 TempBusNumberMax,
+ IN UINT8 NumOfDevLtrOverride,
+ IN PCH_PCIE_DEVICE_LTR_OVERRIDE *DevLtrOverride,
+ IN PCH_PCIE_PWR_OPT *PchPwrOptPcie,
+ IN PCH_PCIE_EXPRESS_L1SUBSTATES_CONTROL L1SubstatesConfig,
+ IN UINT8 PolicyRevision,
+ IN BOOLEAN FirstRPToSetPm,
+ IN BOOLEAN L1SupportedInAllEnabledPorts,
+ IN BOOLEAN ClkreqSupportedInAllEnabledPorts
+ )
+{
+ EFI_STATUS Status;
+#ifdef EFI_S3_RESUME
+ STATIC EFI_PCH_S3_SUPPORT_PROTOCOL *PchS3Support;
+ STATIC EFI_PCH_S3_PARAMETER_PCIE_SET_PM S3ParameterSetPm;
+ STATIC EFI_PCH_S3_DISPATCH_ITEM S3DispatchItem = {
+ PchS3ItemTypePcieSetPm,
+ &S3ParameterSetPm
+ };
+ EFI_PHYSICAL_ADDRESS S3DispatchEntryPoint;
+
+ if (!PchS3Support) {
+ DEBUG ((EFI_D_INFO, "Locating the S3 Support Protocol - PCH Init\n"));
+
+ ///
+ /// Get the PCH S3 Support Protocol
+ ///
+ Status = gBS->LocateProtocol (
+ &gEfiPchS3SupportProtocolGuid,
+ NULL,
+ (VOID **) &PchS3Support
+ );
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ DEBUG ((EFI_D_INFO, "Located the S3 Support Protocol - PCH Init: %x\n", (UINTN)PchS3Support));
+ }
+
+ DEBUG ((EFI_D_INFO, "Attempting to set Custom PCH Init Dispatch Item\n"));
+
+ S3ParameterSetPm.RootPortBus = RootPortBus;
+ S3ParameterSetPm.RootPortDevice = RootPortDevice;
+ S3ParameterSetPm.RootPortFunc = RootPortFunc;
+ S3ParameterSetPm.RootPortAspm = RootPortAspm;
+ S3ParameterSetPm.NumOfDevAspmOverride = NumOfDevAspmOverride;
+ S3ParameterSetPm.DevAspmOverrideAddr = (UINT32) (UINTN) DevAspmOverride;
+ S3ParameterSetPm.TempBusNumberMin = TempBusNumberMin;
+ S3ParameterSetPm.TempBusNumberMax = TempBusNumberMax;
+ S3ParameterSetPm.PchPwrOptPcie = (UINT32) (UINTN) PchPwrOptPcie;
+ S3ParameterSetPm.NumOfDevLtrOverride = NumOfDevLtrOverride;
+ S3ParameterSetPm.DevLtrOverrideAddr = (UINT32) (UINTN) DevLtrOverride;
+ S3ParameterSetPm.L1SubstatesConfig = L1SubstatesConfig;
+ S3ParameterSetPm.PolicyRevision = PolicyRevision;
+ S3ParameterSetPm.FirstRPToSetPm = FirstRPToSetPm;
+ S3ParameterSetPm.L1SupportedInAllEnabledPorts = L1SupportedInAllEnabledPorts;
+ S3ParameterSetPm.ClkreqSupportedInAllEnabledPorts = ClkreqSupportedInAllEnabledPorts;
+ Status = PchS3Support->SetDispatchItem (
+ PchS3Support,
+ &S3DispatchItem,
+ &S3DispatchEntryPoint
+ );
+ ASSERT_EFI_ERROR (Status);
+ ///
+ /// Save the script dispatch item in the Boot Script
+ ///
+ SCRIPT_DISPATCH (EFI_ACPI_S3_RESUME_SCRIPT_TABLE, S3DispatchEntryPoint);
+#else
+ Status = EFI_SUCCESS;
+#endif
+ return Status;
+}
+
+/**
+ PCH initialization before ExitBootServices / LegacyBoot events
+ Useful for operations which must happen later than at EndOfPost event
+
+ @param[in] Event A pointer to the Event that triggered the callback.
+ @param[in] Context A pointer to private data registered with the callback function.
+
+ @retval None
+**/
+VOID
+EFIAPI
+PchExitBootServicesEvent (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ EFI_STATUS Status;
+ UINTN NumHandles;
+ EFI_HANDLE *HandleBuffer;
+ DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy;
+ UINTN Index;
+ UINT32 AhciBar;
+ UINTN PciD31F2RegBase;
+ UINT16 SataModeSelect;
+ UINT16 LpcDeviceId;
+ UINT32 PxSctlDet;
+ UINT32 PxCmdSud;
+ UINT16 OrgCmdWord;
+
+ ///
+ /// Closed the event to avoid call twice
+ ///
+ gBS->CloseEvent (Event);
+
+ LpcDeviceId = MmioRead16 (
+ MmPciAddress (
+ 0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ 0
+ ) + R_PCH_LPC_DEVICE_ID);
+
+ ///
+ /// Retrieve all instances of PCH Platform Policy protocol
+ ///
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gDxePchPlatformPolicyProtocolGuid,
+ NULL,
+ &NumHandles,
+ &HandleBuffer
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR | EFI_D_INFO, "Failed to locate handle buffer for PCH Policy protocol.\n"));
+ return;
+ }
+
+ for (Index = 0; Index < NumHandles; Index++) {
+ Status = gBS->HandleProtocol (
+ HandleBuffer[Index],
+ &gDxePchPlatformPolicyProtocolGuid,
+ (VOID **) &PchPlatformPolicy
+ );
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR | EFI_D_INFO, "Failed to find PCH Policy protocol.\n"));
+ return;
+ }
+
+ ConfigureXhciAtBoot (PchPlatformPolicy);
+#ifdef SERIAL_IO_FLAG
+ ConfigureSerialIoAtBoot(PchPlatformPolicy);
+#endif // SERIAL_IO_FLAG
+
+ ///
+ /// eSATA port support only up to Gen2
+ ///
+ PciD31F2RegBase = MmPciAddress (0, PchPlatformPolicy->BusNumber, PCI_DEVICE_NUMBER_PCH_SATA, PCI_FUNCTION_NUMBER_PCH_SATA, 0);
+ //
+ // Make sure SATA device exists.
+ //
+ if (MmioRead16 (PciD31F2RegBase + R_PCH_SATA_VENDOR_ID) != 0xFFFF) {
+ SataModeSelect = MmioRead16 (PciD31F2RegBase + R_PCH_SATA_MAP) & B_PCH_SATA_MAP_SMS_MASK;
+ if ((SataModeSelect == V_PCH_SATA_MAP_SMS_AHCI) ||
+ (SataModeSelect == V_PCH_SATA_MAP_SMS_RAID)) {
+ AhciBar = MmioRead32 (PciD31F2RegBase + R_PCH_SATA_AHCI_BAR) & B_PCH_SATA_AHCI_BAR_BA;
+ //
+ // Make sure the AhciBar is valid.
+ //
+ if ((AhciBar != 0x00000000) && (AhciBar != 0xFFFFFFFF)) {
+ ///
+ /// Keep original CMD word, and enable MSE
+ ///
+ OrgCmdWord = MmioRead16 (PciD31F2RegBase + R_PCH_SATA_COMMAND);
+ if ((OrgCmdWord & B_PCH_SATA_COMMAND_MSE) == 0) {
+ MmioOr16 ((PciD31F2RegBase + R_PCH_SATA_COMMAND), B_PCH_SATA_COMMAND_MSE);
+ }
+ for (Index = 0; Index < GetPchMaxSataPortNum (); Index++) {
+ if (PchPlatformPolicy->SataConfig->PortSettings[Index].External == PCH_DEVICE_ENABLE) {
+ PxSctlDet = MmioRead32(AhciBar + (R_PCH_SATA_AHCI_P0SCTL + (0x80 * Index))) & B_PCH_SATA_AHCI_PXSCTL_DET;
+ PxCmdSud = MmioRead32(AhciBar + (R_PCH_SATA_AHCI_P0CMD + (0x80 * Index))) & B_PCH_SATA_AHCI_PxCMD_SUD;
+ ///
+ /// Limit speed to Gen2
+ ///
+ MmioAndThenOr32 (
+ (UINTN) (AhciBar + (R_PCH_SATA_AHCI_P0SCTL + (0x80 * Index))),
+ (UINT32)~(B_PCH_SATA_AHCI_PXSCTL_SPD),
+ (UINT32) V_PCH_SATA_AHCI_PXSCTL_SPD_2
+ );
+ ///
+ /// If port is not offline, and it's spin up, need to port reset.
+ /// After port reset, clear the SERR.
+ /// - Set DET=1, and then set DET=0.
+ ///
+ if ((PxSctlDet == V_PCH_SATA_AHCI_PXSCTL_DET_0) &&
+ (PxCmdSud == B_PCH_SATA_AHCI_PxCMD_SUD))
+ {
+ MmioOr32 (AhciBar + (R_PCH_SATA_AHCI_P0SCTL + (0x80 * Index)), V_PCH_SATA_AHCI_PXSCTL_DET_1);
+ PchPmTimerStall (1000);
+ MmioAnd32(AhciBar + (R_PCH_SATA_AHCI_P0SCTL + (0x80 * Index)), (UINT32) ~(B_PCH_SATA_AHCI_PXSCTL_DET));
+ MmioWrite32 (AhciBar + (R_PCH_SATA_AHCI_P0SERR + (0x80 * Index)), (UINT32)~0u);
+ }
+ ///
+ /// If port is offline, and it's not spin up, meets the power bug.
+ /// Need to do the W/A to spin up the port and then spin down.
+ /// Then entering back to offline and listen.
+ /// - Set DET=0, SUD=1, and then set SUD=0, DET=4.
+ ///
+ if ((PxSctlDet == V_PCH_SATA_AHCI_PXSCTL_DET_4) &&
+ (PxCmdSud == 0))
+ {
+ MmioAnd32(AhciBar + (R_PCH_SATA_AHCI_P0SCTL + (0x80 * Index)), (UINT32) ~(B_PCH_SATA_AHCI_PXSCTL_DET));
+ MmioOr32 (AhciBar + (R_PCH_SATA_AHCI_P0CMD + (0x80 * Index)), B_PCH_SATA_AHCI_PxCMD_SUD);
+ PchPmTimerStall (1000);
+ MmioAnd32(AhciBar + (R_PCH_SATA_AHCI_P0CMD + (0x80 * Index)), (UINT32) ~(B_PCH_SATA_AHCI_PxCMD_SUD));
+ MmioOr32 (AhciBar + (R_PCH_SATA_AHCI_P0SCTL + (0x80 * Index)), V_PCH_SATA_AHCI_PXSCTL_DET_4);
+ }
+ }
+ }
+ ///
+ /// Restore original CMD word.
+ ///
+ if ((OrgCmdWord & B_PCH_SATA_COMMAND_MSE) == 0) {
+ MmioWrite16 ((PciD31F2RegBase + R_PCH_SATA_COMMAND), OrgCmdWord);
+ }
+ } // AhciBar is vaild
+ } // SATA mode is AHCI or RAID
+ } // if D31F2 is existed
+ }
+
+ return;
+}
+
+/**
+ PCH checkes the HECI protocol and sends ChipsetInitSyncMsg
+
+ @param[in] Event Event objext
+ @param[in] *Context VOID Pointer
+
+ @retval None
+**/
+VOID
+EFIAPI
+ChipsetInitSyncCallback (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ EFI_STATUS Status;
+ EFI_HECI_PROTOCOL *Heci;
+ CHIPSET_INIT_INFO_HOB *ChipsetInitHob;
+
+ ChipsetInitHob = NULL;
+ Status = EFI_SUCCESS;
+ DEBUG ((EFI_D_INFO, "ChipsetInitSyncCallback() Start\n"));
+
+ //
+ // Get the HECI protocol to make sure HECI is ready.
+ //
+ Status = gBS->LocateProtocol (&gEfiHeciProtocolGuid, NULL, (VOID **) &Heci);
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+
+ if (mHeciEvent) {
+ gBS->CloseEvent (mHeciEvent);
+ }
+
+ //
+ // Search for the ChipsetInit Info PEIM GUID HOB.
+ //
+ ChipsetInitHob = GetFirstGuidHob (&gChipsetInitHobGuid);
+ if (ChipsetInitHob == NULL) {
+ DEBUG ((EFI_D_INFO, "ChipsetInitHob not found.\n"));
+ return;
+ }
+
+ //
+ // If ChipsetInitTableUpdReq == 0, settings are already in sync and no furhter work needed
+ //
+ if (ChipsetInitHob->ChipsetInitTableUpdReq == 1) {
+ //
+ // If we do not have the ChipsetInit table that ME FW expects us to have,
+ // we must send the current ChipsetInit table to ME FW via HECI message.
+ //
+ Status = HeciChipsetInitSyncMsg(ChipsetInitHob->ChipsetInitTable, ChipsetInitHob->ChipsetInitTableLen);
+ }
+
+ DEBUG ((EFI_D_INFO, "ChipsetInitSyncCallback() End\n"));
+
+ return;
+}
+
+/**
+ Register the HECI protocol callback function for the ChipsetInit sync message.
+
+ @param[in] *PchPlatformPolicy A pointer to the PchPlatformPolicy.
+
+ @retval EFI_STATUS
+**/
+EFI_STATUS
+ChipsetInitSettingsCheck (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy
+ )
+{
+ EFI_STATUS Status;
+ VOID *HeciRegistration;
+
+ DEBUG ((EFI_D_INFO, "ChipsetInitSettingsCheck() Start\n"));
+
+ Status = gBS->CreateEvent (
+ EFI_EVENT_NOTIFY_SIGNAL,
+ EFI_TPL_CALLBACK,
+ ChipsetInitSyncCallback,
+ NULL,
+ &mHeciEvent
+ );
+ ASSERT_EFI_ERROR(Status);
+
+ Status = gBS->RegisterProtocolNotify (
+ &gEfiHeciProtocolGuid,
+ mHeciEvent,
+ &HeciRegistration
+ );
+ ASSERT_EFI_ERROR(Status);
+
+ ChipsetInitSyncCallback (NULL, NULL);
+
+ return Status;
+}
+
+/**
+ Update ASL object before Boot
+
+ @param[in] *PchPlatformPolicy A pointer to the PchPlatformPolicy.
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+
+ @retval EFI_STATUS
+ @retval EFI_NOT_READY The Acpi protocols are not ready.
+**/
+EFI_STATUS
+PchUpdateAslObjects (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar
+ )
+{
+ EFI_STATUS Status;
+ UINTN Index;
+ UINTN VariableSize;
+ UINT32 PciMemBase;
+ PCH_LATE_INIT_SMM_VARIABLE SaveRestoreData;
+ UINT32 AslSignature;
+ UINT32 RpFn;
+ UINT32 Data32;
+
+ Status = InitializePchAslUpdateLib();
+ DEBUG ((EFI_D_INFO, "InitializePchAslUpdateLib Status %x\n", Status));
+ ASSERT_EFI_ERROR (Status);
+
+ if(EFI_ERROR(Status)) {
+ return EFI_NOT_READY;
+ }
+
+ //
+ // Update SRMB, Save & Restore Memroy Base
+ //
+ VariableSize = sizeof (PCH_LATE_INIT_SMM_VARIABLE);
+ Status = gRT->GetVariable (
+ PCH_INIT_PEI_VARIABLE_NAME,
+ &gPchInitPeiVariableGuid,
+ NULL,
+ &VariableSize,
+ &SaveRestoreData
+ );
+ PciMemBase = SaveRestoreData.PciMemBase;
+ Status = UpdateNameAslCode(EFI_SIGNATURE_32('S','R','M','B'), &PciMemBase, sizeof(PciMemBase));
+
+ RpFn = MmioRead32 (RootComplexBar + R_PCH_RCRB_RPFN);
+ for (Index = 0; Index < GetPchMaxPciePortNum (); Index++) {
+ //
+ // Update RPA0, RPA1, RPA2, RPA3, RPA4, RPA5, RPA6, RPA7 for root port function swapping
+ //
+ Data32 = '0' + (UINT32)Index;
+ AslSignature = EFI_SIGNATURE_32('R','P','A',Data32);
+ Data32 = (UINT32)((RpFn >> (Index * S_PCH_RCRB_PRFN_RP_FIELD)) & B_PCH_RCRB_RPFN_RP1FN);
+ Data32 |= (UINT32)(PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS << 16);
+ Status = UpdateNameAslCode(AslSignature, &Data32, sizeof(UINT32));
+ DEBUG ((EFI_D_INFO, "Update RPAx %x %x\n", Index, Data32));
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Update Maximum Snoop Latency and Maximum No-Snoop Latency values for PCIE
+ //
+ if (PchPlatformPolicy->Revision >= DXE_PCH_PLATFORM_POLICY_PROTOCOL_REVISION_7) {
+ AslSignature = EFI_SIGNATURE_32('P','M','L',(UINT32)('1' + Index));
+ Data32 = (UINT32) PchPlatformPolicy->PwrOptConfig->PchPwrOptPcie[Index].LtrMaxSnoopLatency;
+ Status = UpdateNameAslCode(AslSignature, &Data32, sizeof(UINT32));
+ DEBUG ((EFI_D_INFO, "Update PMLx %x %x\n", Index+1, Data32));
+ ASSERT_EFI_ERROR (Status);
+ AslSignature = EFI_SIGNATURE_32('P','N','L',(UINT32)('1' + Index));
+ Data32 = (UINT32) PchPlatformPolicy->PwrOptConfig->PchPwrOptPcie[Index].LtrMaxNoSnoopLatency;
+ Status = UpdateNameAslCode(AslSignature, &Data32, sizeof(UINT32));
+ DEBUG ((EFI_D_INFO, "Update PNLx %x %x\n", Index+1, Data32));
+ ASSERT_EFI_ERROR (Status);
+ }
+ }
+
+ //
+ // Update PCHS.
+ //
+ Data32 = (UINT32) GetPchSeries();
+ Status = UpdateNameAslCode(EFI_SIGNATURE_32('P','C','H','S'), &Data32, sizeof(UINT32));
+
+ return EFI_SUCCESS;
+}
+
+/**
+ PCH initialization before Boot Sript Table is closed
+
+ @param[in] Event A pointer to the Event that triggered the callback.
+ @param[in] Context A pointer to private data registered with the callback function.
+
+ @retval None
+**/
+VOID
+EFIAPI
+PchInitBeforeBoot (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ EFI_STATUS Status;
+ UINTN NumHandles;
+ EFI_HANDLE *HandleBuffer;
+ UINTN Index;
+ DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy;
+ UINT32 RootComplexBar;
+ UINT32 FuncDisableReg;
+ UINTN PciD25F0RegBase;
+ UINTN PciD31F2RegBase;
+ UINT32 GbEMemBar;
+ UINTN PciD31F0RegBase;
+ UINTN GbeRootPortNumber;
+ UINT16 PmBase;
+ UINT16 GpioBase;
+ UINT32 Data32And;
+ UINT32 Data32Or;
+ UINT32 Data32;
+ UINT16 Data16And;
+ UINT16 Data16Or;
+ UINT8 Data8;
+ VOID *ProtocolPointer;
+ UINTN AzaliaBase;
+ const UINT8 StrEnabled[sizeof (PCH_CRID_ENABLED)] = PCH_CRID_ENABLED;
+ const UINT8 StrDisabled[sizeof (PCH_CRID_DISABLED)] = PCH_CRID_DISABLED;
+ EFI_HANDLE Handle;
+ PCH_SERIES PchSeries;
+ BOOLEAN L1SubstatesSupportedPerPort;
+ PCI_DATA_STRUCTURE *PcirBlockPtr;
+ EFI_PCI_IO_PROTOCOL *PciIo;
+ PCI_EXPANSION_ROM_HEADER *RomImage;
+ BOOLEAN FoundLegacyRaid;
+ EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2;
+ CHAR16 RstDriverName1[] = L"Intel RST";
+ CHAR16 RstDriverName2[] = L"Intel(R) RST";
+ EFI_DRIVER_SUPPORTED_EFI_VERSION_PROTOCOL *DriverEfiVersion;
+ EFI_STRING DriverName;
+ UINT16 AspmVal;
+ BOOLEAN ClkreqPerPortSupported;
+ BOOLEAN ClkreqSupportedInAllEnabledPorts;
+ BOOLEAN L1SupportedInAllEnabledPorts;
+ BOOLEAN FirstRPToSetPm;
+#ifdef EFI_S3_RESUME
+ STATIC EFI_PCH_S3_SUPPORT_PROTOCOL *PchS3Support;
+#endif
+
+ UINTN RPBase;
+ UINT8 PortIndex;
+ PCH_PCIE_DEVICE_ASPM_OVERRIDE *S3DevAspmOverrideTbl;
+ PCH_PCIE_PWR_OPT *S3PchPwrOptPcie;
+ UINT32 DevAspmOverrideTblSize;
+ PCH_PCI_EXPRESS_ASPM_CONTROL RootPortAspmVal;
+ UINT8 NumOfDevltrOverride;
+ PCH_PCIE_DEVICE_LTR_OVERRIDE *S3DevLtrOverrideTbl;
+ PCH_PCIE_DEVICE_LTR_OVERRIDE *DevLtrOverrideTbl;
+ UINT32 DevLtrOverrideTblSize;
+ PCH_PCIE_EXPRESS_L1SUBSTATES_CONTROL L1SubVal;
+ BOOLEAN LtrSupported;
+
+ S3DevLtrOverrideTbl = NULL;
+ DevLtrOverrideTbl = NULL;
+ NumOfDevltrOverride = 0;
+ LtrSupported = TRUE;
+ L1SubstatesSupportedPerPort = FALSE;
+ Handle = NULL;
+ PchSeries = GetPchSeries();
+ AspmVal = 0;
+ ClkreqPerPortSupported = FALSE;
+ ClkreqSupportedInAllEnabledPorts = TRUE;
+ L1SupportedInAllEnabledPorts = TRUE;
+ FirstRPToSetPm = TRUE;
+
+ ///
+ /// Check whether this is real ExitPmAuth notification, or just a SignalEvent
+ ///
+ Status = gBS->LocateProtocol (&gExitPmAuthProtocolGuid, NULL, (VOID **) &ProtocolPointer);
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+
+ DEBUG ((EFI_D_INFO, "PchInitBeforeBoot() Start\n"));
+
+ ///
+ /// Closed the event to avoid call twice when launch shell
+ ///
+ gBS->CloseEvent (Event);
+
+ ///
+ /// Retrieve all instances of PCH Platform Policy protocol
+ ///
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gDxePchPlatformPolicyProtocolGuid,
+ NULL,
+ &NumHandles,
+ &HandleBuffer
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR | EFI_D_INFO, "Failed to locate handle buffer for PCH Policy protocol.\n"));
+ return;
+ }
+ ///
+ /// Find the matching PCH Policy protocol
+ ///
+ for (Index = 0; Index < NumHandles; Index++) {
+ Status = gBS->HandleProtocol (
+ HandleBuffer[Index],
+ &gDxePchPlatformPolicyProtocolGuid,
+ (VOID **) &PchPlatformPolicy
+ );
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR | EFI_D_INFO, "Failed to find PCH Policy protocol.\n"));
+ return;
+ }
+
+ InitFviDataHubCbContext (
+ PchPlatformPolicy->MiscConfig->FviSmbiosType,
+ (UINT8) mPchFviElements,
+ &mPchFviVersionData
+ );
+
+ RootComplexBar = PCH_RCRB_BASE;
+
+ FuncDisableReg = MmioRead32 (RootComplexBar + R_PCH_RCRB_FUNC_DIS);
+ PciD31F0RegBase = MmPciAddress (0, PchPlatformPolicy->BusNumber, 31, 0, 0);
+ GpioBase = MmioRead16 (PciD31F0RegBase + R_PCH_LPC_GPIO_BASE) & B_PCH_LPC_GPIO_BASE_BAR;
+ PmBase = MmioRead16 (PciD31F0RegBase + R_PCH_LPC_ACPI_BASE) & B_PCH_LPC_ACPI_BASE_BAR;
+
+ Status = PciERWORegInit (PchPlatformPolicy, RootComplexBar, &FuncDisableReg);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Locking Thermal Reporting Settings prior to end of POST
+ ///
+ Status = ThermalLockDown (PchPlatformPolicy, GpioBase);
+ ASSERT_EFI_ERROR (Status);
+
+ if ((FuncDisableReg & B_PCH_RCRB_FUNC_DIS_AZALIA) == 0) {
+ AzaliaBase = MmPciAddress (
+ 0,
+ PchPlatformPolicy->BusNumber,
+ PCI_DEVICE_NUMBER_PCH_AZALIA,
+ PCI_FUNCTION_NUMBER_PCH_AZALIA,
+ 0
+ );
+ ///
+ /// PCH BIOS Spec Rev 0.5.0 Section 9.5
+ /// Additional High Definition Audio Programming Steps
+ /// Step 5
+ /// Set D27:F0:40h[1] = 1b after all settings done including 19.10.5
+ ///
+ MmioOr8 (AzaliaBase + R_PCH_HDA_HDCTL, B_PCH_HDA_HDCTL_BCLD);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (AzaliaBase + R_PCH_HDA_HDCTL),
+ 1,
+ (VOID *) (UINTN) (AzaliaBase + R_PCH_HDA_HDCTL)
+ );
+ }
+ ///
+ /// PCH BIOS Spec Rev 0.5.0 Section 19.4
+ /// Step 29
+ /// Set RCBA + Offset 3A6Ch[31:0] = 0x00000001, after step #26 to #28 are done
+ ///
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3A6C),
+ (UINT32) (0x00000001)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3A6C),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3A6C)
+ );
+ if (PchSeries == PchH) {
+ ///
+ /// PCH BIOS Spec Rev 0.5.5, Section 19.4 Additional Power Management Programming
+ /// Step 30
+ /// Set RCBA + Offset 2344h[31:24] = 0xFF
+ /// Set RCBA + Offset 2344h[7:0] = 0x0C
+ ///
+ Data32And = (UINT32)~(0xFF00000F);
+ Data32Or = (UINT32) (0xFF00000C);
+ MmioAndThenOr32 (
+ (UINTN) (RootComplexBar + 0x2344),
+ Data32And,
+ Data32Or
+ );
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + 0x2344),
+ &Data32Or, // Data to be ORed
+ &Data32And // Data to be ANDed
+ );
+ } else if (PchSeries == PchLp) {
+ ///
+ /// PCH BIOS Spec Rev 0.3.0 Section 31.7.2
+ /// Step 5
+ /// Set RCBA + Offset 2618h [25] = 1b.
+ ///
+ MmioOr32 (
+ (UINTN) (RootComplexBar + 0x2618),
+ (UINT32) (BIT25)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + 0x2618),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + 0x2618)
+ );
+ }
+/* // [ EIP357393 ]+>>>
+ ///
+ /// SPI Flash Programming Guide Section 5.5.1 Flash Configuration Lockdown
+ /// It is strongly recommended that BIOS sets the Host and GbE Flash Configuration Lock-Down (FLOCKDN)
+ /// bits (located at SPIBAR + 04h and MBAR + 04h respectively) to 1 on production platforms
+ ///
+ if (PchSeries == PchH) {
+ MmioOr16 ((UINTN) (RootComplexBar + R_PCH_SPI_HSFS), (UINT16) (B_PCH_SPI_HSFS_FLOCKDN + B_PCH_SPI_PRR3PRR4_LOCKDN));
+ } else if (PchSeries == PchLp) {
+ MmioOr16 ((UINTN) (RootComplexBar + R_PCH_SPI_HSFS), (UINT16) (B_PCH_SPI_HSFS_FLOCKDN));
+ }
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (RootComplexBar + R_PCH_SPI_HSFS),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_SPI_HSFS)
+ );
+*/ // [ EIP357393 ]+<<<
+
+ ///
+ /// Set the GbE Flash Configuration Lock-Down (FLOCKDN) bit (MBAR + 04h[15]) to 1
+ ///
+ if (PchPlatformPolicy->DeviceEnabling->Lan == PCH_DEVICE_ENABLE) {
+ PciD25F0RegBase = MmPciAddress (0, PchPlatformPolicy->BusNumber, 25, 0, 0);
+ ///
+ /// Enable memory space decoding in command register
+ ///
+ Data16And = 0xFFFF;
+ Data16Or = (UINT16) B_PCH_LAN_CMD_MSE;
+ MmioOr16 (PciD25F0RegBase + R_PCH_LAN_CMD, Data16Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PciD25F0RegBase + R_PCH_LAN_CMD),
+ &Data16Or, // Data to be ORed
+ &Data16And // Data to be ANDed
+ );
+
+/* // [ EIP357393 ]+>>>
+ GbEMemBar = MmioRead32 (PciD25F0RegBase + R_PCH_LAN_MBARB) & B_PCH_LAN_MBARB_BA;
+ ///
+ /// Assert if the memory data of GbEMemBar is invalid.
+ ///
+ if (MmioRead32 (GbEMemBar) == 0xFFFFFFFF) {
+ ASSERT (FALSE);
+ } else {
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PciD25F0RegBase + R_PCH_LAN_MBARB),
+ 1,
+ (VOID *) (UINTN) (PciD25F0RegBase + R_PCH_LAN_MBARB)
+ );
+ MmioOr16 (GbEMemBar + 0x04, BIT15);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (GbEMemBar + 0x04),
+ 1,
+ (VOID *) (UINTN) (GbEMemBar + 0x04)
+ );
+ }
+*/ // [ EIP357393 ]+<<<
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.0 Section 10.5 Additional GbE Controller Configurations for WOL Support
+ /// System BIOS requires to program the registers listed below for internal GbE.
+ /// Step 1, Set MBARA + Offset 2Ch [31] = 1b
+ /// Step 2, If WOL is enabled set MBARA + Offset 2Ch [30] = 1b
+ /// else if disabled set MBARA + Offset 2Ch [30] = 0b
+ ///
+ /// Additional Steppings:
+ /// Set MBARA + Offset 10h [31] = 1b
+ ///
+ GbEMemBar = MmioRead32 (PciD25F0RegBase + R_PCH_LAN_MEM_BASE_A) & B_PCH_LAN_MBARA_BA;
+ ///
+ /// Assert if the memory data of GbEMemBar is invalid.
+ ///
+ if (MmioRead32 (GbEMemBar) == 0xFFFFFFFF) {
+ ASSERT (FALSE);
+ } else {
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PciD25F0RegBase + R_PCH_LAN_MEM_BASE_A),
+ 1,
+ (VOID *) (UINTN) (PciD25F0RegBase + R_PCH_LAN_MEM_BASE_A)
+ );
+ MmioOr32 (GbEMemBar + 0x2c, (BIT31));
+ if (PchPlatformPolicy->MiscPmConfig->WakeConfig.WolEnableOverride) {
+ MmioOr32 (GbEMemBar + 0x2c, (BIT30));
+ } else {
+ MmioAnd32 (GbEMemBar + 0x2c, (UINT32) (~BIT30));
+ }
+
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (GbEMemBar + 0x2c),
+ 1,
+ (VOID *) (UINTN) (GbEMemBar + 0x2c)
+ );
+
+ ///
+ /// Set GbEMemBar + 0x10[31] to 1b if Gbe Clkreq is in native mode (0b)
+ ///
+ if (PchSeries == PchLp) {
+ GbeRootPortNumber = PchGetGbePortNumber();
+ Data32 = (IoRead32 ((UINTN) (GpioBase + R_PCH_GP_X_CONFIG0(18 + GbeRootPortNumber))) & B_PCH_GPIO_OWN0_GPIO_USE_SEL);
+ if (Data32 == 0) {
+ MmioOr32 (GbEMemBar + 0x10, BIT31);
+ } else {
+ MmioAnd32 (GbEMemBar + 0x10, (UINT32) (~BIT31));
+ }
+
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (GbEMemBar + 0x10),
+ 1,
+ (VOID *) (UINTN) (GbEMemBar + 0x10)
+ );
+ }
+ }
+ }
+ ///
+ /// PCH BIOS Spec Rev 0.5.0 section 14.1.7 Additional Programming Requirements during
+ /// SATA Initialization
+ /// Step 11
+ /// Program D31:F2:98h [29] to 1b
+ ///
+ PciD31F2RegBase = MmPciAddress (0, PchPlatformPolicy->BusNumber, 31, 2, 0);
+ MmioOr32 ((UINTN) (PciD31F2RegBase + 0x98), BIT29);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PciD31F2RegBase + 0x98),
+ 1,
+ (VOID *) (UINTN) (PciD31F2RegBase + 0x98)
+ );
+ ///
+ /// Step 14
+ /// Program D31:F2:9Ch [31] to 1b
+ ///
+ MmioOr32 ((UINTN) (PciD31F2RegBase + 0x9C), BIT31);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PciD31F2RegBase + 0x9C),
+ 1,
+ (VOID *) (UINTN) (PciD31F2RegBase + 0x9C)
+ );
+ ///
+ /// Do the Pcie ASPM enable prior to the end of POST
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 8.3.1 ASPM on DMI and the PCI Express* Root Ports
+ ///
+ /// Allcoate and Copy the entire Aspm override table pointed by DevAspmOverride to < 4G EfiReservedMemory
+ /// It's for S3 resume used.
+ ///
+ DevAspmOverrideTblSize = PchPlatformPolicy->PciExpressConfig->NumOfDevAspmOverride *
+ sizeof (PCH_PCIE_DEVICE_ASPM_OVERRIDE);
+ S3DevAspmOverrideTbl = AllocateReservedCopyPool (
+ DevAspmOverrideTblSize,
+ PchPlatformPolicy->PciExpressConfig->DevAspmOverride
+ );
+ ASSERT_EFI_ERROR (S3DevAspmOverrideTbl != NULL);
+
+ ///
+ /// Allcoate and Copy the entire LTR override table pointed by DevLtrOverride to < 4G EfiReservedMemory
+ /// It's used for S3 resume used.
+ ///
+ DevLtrOverrideTbl = PchPlatformPolicy->PwrOptConfig->DevLtrOverride;
+ NumOfDevltrOverride = PchPlatformPolicy->PwrOptConfig->NumOfDevLtrOverride;
+ if ((DevLtrOverrideTbl != NULL) && (NumOfDevltrOverride != 0)) {
+ DevLtrOverrideTblSize = NumOfDevltrOverride * sizeof (PCH_PCIE_DEVICE_LTR_OVERRIDE);
+ S3DevLtrOverrideTbl = AllocateReservedCopyPool (
+ DevLtrOverrideTblSize,
+ DevLtrOverrideTbl
+ );
+ ASSERT_EFI_ERROR (S3DevLtrOverrideTbl != NULL);
+ }
+ ///
+ /// Check all the enabled root ports and end point devices if they support Clkreq Per Port, L1 and L1 substates
+ ///
+ for (PortIndex = 0; PortIndex < GetPchMaxPciePortNum (); PortIndex++) {
+ RPBase = MmPciAddress (0, PchPlatformPolicy->BusNumber, PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS, GetPchPcieRpfn(RootComplexBar, PortIndex), 0);
+ if (((FuncDisableReg & (B_PCH_RCRB_FUNC_DIS_PCI_EX_PORT1 << PortIndex)) == 0) && ((MmioRead16 (RPBase + R_PCH_PCIE_SLSTS) & B_PCH_PCIE_SLSTS_PDS) != 0)) {
+ RootPortAspmVal = PchPlatformPolicy->PciExpressConfig->RootPort[PortIndex].Aspm;
+ L1SubVal = PchPcieL1SubstatesL1_1_2;
+ if (PchPlatformPolicy->Revision >= DXE_PCH_PLATFORM_POLICY_PROTOCOL_REVISION_2) {
+ L1SubVal = PchPlatformPolicy->PciExpressConfig->RootPort[PortIndex].L1Substates;
+ }
+ Status = PcieCheckPmConfig (
+ PchPlatformPolicy->BusNumber,
+ PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS,
+ GetPchPcieRpfn(RootComplexBar, PortIndex),
+ RootPortAspmVal,
+ PchPlatformPolicy->PciExpressConfig->NumOfDevAspmOverride,
+ PchPlatformPolicy->PciExpressConfig->DevAspmOverride,
+ PchPlatformPolicy->PciExpressConfig->TempRootPortBusNumMin,
+ PchPlatformPolicy->PciExpressConfig->TempRootPortBusNumMax,
+ NumOfDevltrOverride,
+ DevLtrOverrideTbl,
+ &(PchPlatformPolicy->PwrOptConfig->PchPwrOptPcie[PortIndex]),
+ &L1SubstatesSupportedPerPort,
+ L1SubVal,
+ PchPlatformPolicy->Revision,
+ &AspmVal,
+ &ClkreqPerPortSupported,
+ &LtrSupported
+ );
+ if ((AspmVal & V_PCH_PCIE_LCTL_APMC_L1) != V_PCH_PCIE_LCTL_APMC_L1) {
+ L1SupportedInAllEnabledPorts = FALSE;
+ }
+ ClkreqSupportedInAllEnabledPorts &= ClkreqPerPortSupported;
+ }
+ }
+ for (PortIndex = 0; PortIndex < GetPchMaxPciePortNum (); PortIndex++) {
+ if ((FuncDisableReg & (B_PCH_RCRB_FUNC_DIS_PCI_EX_PORT1 << PortIndex)) == 0) {
+ S3PchPwrOptPcie = AllocateReservedCopyPool (
+ sizeof (PCH_PCIE_PWR_OPT),
+ &PchPlatformPolicy->PwrOptConfig->PchPwrOptPcie[PortIndex]
+ );
+ ASSERT_EFI_ERROR (S3PchPwrOptPcie != NULL);
+ RootPortAspmVal = PchPlatformPolicy->PciExpressConfig->RootPort[PortIndex].Aspm;
+ L1SubVal = PchPcieL1SubstatesL1_1_2;
+ if (PchPlatformPolicy->Revision >= DXE_PCH_PLATFORM_POLICY_PROTOCOL_REVISION_2) {
+ L1SubVal = PchPlatformPolicy->PciExpressConfig->RootPort[PortIndex].L1Substates;
+ }
+ Status = PcieSetPm (
+ PchPlatformPolicy->BusNumber,
+ PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS,
+ GetPchPcieRpfn(RootComplexBar, PortIndex),
+ RootPortAspmVal,
+ PchPlatformPolicy->PciExpressConfig->NumOfDevAspmOverride,
+ PchPlatformPolicy->PciExpressConfig->DevAspmOverride,
+ PchPlatformPolicy->PciExpressConfig->TempRootPortBusNumMin,
+ PchPlatformPolicy->PciExpressConfig->TempRootPortBusNumMax,
+ NumOfDevltrOverride,
+ DevLtrOverrideTbl,
+ &(PchPlatformPolicy->PwrOptConfig->PchPwrOptPcie[PortIndex]),
+ &L1SubstatesSupportedPerPort,
+ L1SubVal,
+ PchPlatformPolicy->Revision,
+ FirstRPToSetPm,
+ L1SupportedInAllEnabledPorts,
+ ClkreqSupportedInAllEnabledPorts,
+ &LtrSupported
+ );
+ Status = SetPciePmS3Item (
+ PchPlatformPolicy->BusNumber,
+ PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS,
+ GetPchPcieRpfn(RootComplexBar, PortIndex),
+ RootPortAspmVal,
+ PchPlatformPolicy->PciExpressConfig->NumOfDevAspmOverride,
+ S3DevAspmOverrideTbl,
+ PchPlatformPolicy->PciExpressConfig->TempRootPortBusNumMin,
+ PchPlatformPolicy->PciExpressConfig->TempRootPortBusNumMax,
+ NumOfDevltrOverride,
+ S3DevLtrOverrideTbl,
+ S3PchPwrOptPcie,
+ L1SubVal,
+ PchPlatformPolicy->Revision,
+ FirstRPToSetPm,
+ L1SupportedInAllEnabledPorts,
+ ClkreqSupportedInAllEnabledPorts
+ );
+ FirstRPToSetPm = FALSE;
+ }
+ }
+ ///
+ /// LPT-LP only: If not all devices support LTR, set RCBA + 0x3320 to 0x00010003
+ ///
+ if (!LtrSupported && (PchSeries == PchLp) ) {
+ MmioAndThenOr32 ( (RootComplexBar + 0x3320), 0, 0x00010003);
+ }
+ ///
+ /// SPI Flash Programming Guide Section 5.5.2 Vendor Component Lock
+ /// It is strongly recommended that BIOS sets the Vendor Component Lock (VCL) bits. VCL applies
+ /// the lock to both VSCC0 and VSCC1 even if VSCC0 is not used. Without the VCL bits set, it is
+ /// possible to make Host/GbE VSCC register(s) changes in that can cause undesired host and
+ /// integrated GbE Serial Flash functionality.
+ ///
+ MmioOr32 ((UINTN) (RootComplexBar + R_PCH_SPI_VSCC0), B_PCH_SPI_VSCC0_VCL);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_SPI_VSCC0),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_SPI_VSCC0)
+ );
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 19.4 Additional Power Management Programming
+ /// Step 3
+ /// Set GEN_PMCON_LOCK register, D31:F0:A6h = 06h, after stretch and ACPI base programming completed.
+ ///
+ MmioOr8 (
+ (UINTN) (PciD31F0RegBase + R_PCH_LPC_GEN_PMCON_LOCK),
+ (UINT8) (B_PCH_LPC_GEN_PMCON_LOCK_S4_STRET_LD | B_PCH_LPC_GEN_PMCON_LOCK_ABASE_LK)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (PciD31F0RegBase + R_PCH_LPC_GEN_PMCON_LOCK),
+ 1,
+ (VOID *) (UINTN) (PciD31F0RegBase + R_PCH_LPC_GEN_PMCON_LOCK)
+ );
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 3.6 Flash Security Recommendation
+ /// Step 1
+ /// Intel strongly recommends that BIOS enables the BIOS Lock Enable (BLE) feature of the PCH.
+ /// Left to platform code to register an callback function to handle IchnBiosWp SMI
+ ///
+ /// Step 2
+ /// Intel strongly recommends that BIOS enables SMI_LOCK (B0:D31:F0:Offset A0h [4]=1)
+ /// which prevent writes to the Global SMI Enable bit (GLB_SMI_EN PMBASE + 30h Bit
+ /// [0]). Enabling this bit will mitigate malicious software attempts to gain system management
+ /// mode privileges.
+ ///
+ if (PchPlatformPolicy->LockDownConfig->GlobalSmi == PCH_DEVICE_ENABLE) {
+ ///
+ /// Save Global SMI Enable bit setting before BIOS enables SMI_LOCK during S3 resume
+ ///
+ Data32Or = IoRead32 ((UINTN) (PmBase + R_PCH_SMI_EN));
+ if ((Data32Or & B_PCH_SMI_EN_GBL_SMI) != 0) {
+ Data32And = 0xFFFFFFFF;
+ Data32Or &= B_PCH_SMI_EN_GBL_SMI;
+ SCRIPT_IO_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PmBase + R_PCH_SMI_EN),
+ &Data32Or, // Data to be ORed
+ &Data32And // Data to be ANDed
+ );
+ }
+
+ MmioOr8 ((UINTN) (PciD31F0RegBase + R_PCH_LPC_GEN_PMCON_1), B_PCH_LPC_GEN_PMCON_SMI_LOCK);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (PciD31F0RegBase + R_PCH_LPC_GEN_PMCON_1),
+ 1,
+ (VOID *) (UINTN) (PciD31F0RegBase + R_PCH_LPC_GEN_PMCON_1)
+ );
+ }
+ ///
+ /// Step 3
+ /// Intel strongly recommends that BIOS sets the BIOS Interface Lock Down bit
+ /// (RCBA+3410[0]=1 General Control and Status - BILD). Setting this bit will prevent writes
+ /// to the Backup Control Register Top Swap bit (BUC.TS RCBA + 3414 [0]) and the General
+ /// Control and Status Registers Boot BIOS Straps (RCBA + 3410h [11:10]). Enabling this bit
+ /// will mitigate malicious software attempts to replace the system BIOS option ROM with its own code.
+ ///
+ if (PchPlatformPolicy->LockDownConfig->BiosInterface == PCH_DEVICE_ENABLE) {
+ MmioOr32 ((UINTN) (RootComplexBar + R_PCH_RCRB_GCS), (UINT32) B_PCH_RCRB_GCS_BILD);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_GCS),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_RCRB_GCS)
+ );
+ ///
+ /// Reads back for posted write to take effect
+ ///
+ Data32Or = MmioRead32 ((UINTN) (RootComplexBar + R_PCH_RCRB_GCS));
+ SCRIPT_MEM_POLL (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_GCS),
+ &Data32Or, // BitMask
+ &Data32Or, // BitValue
+ 1, // Duration
+ 1 // LoopTimes
+ );
+ }
+ ///
+ /// PCH EDS Rev 1.0, Section 14.1.35.1.2
+ /// SATA Indexed Register 1Ch Bit18, 1 = This bit allows entrance to the PCH SATA test modes when set.
+ /// This bit should only be set when following the PCH MSQT for system board testing.
+ /// It is recommended to set this bit manually.
+ ///
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 5.15 IntelR Stable Image Platform Program (SIPP)
+ /// For platforms supporting Intel(R) SIPP, System BIOS will need to enable the CRID feature by:
+ /// Write the value 1Dh to to the RevID field in B0:D31:F0 Offset 08h
+ ///
+
+ ///
+ /// Update CRID FVI record
+ ///
+ mPchFviElementsData[CRID_ORIGINAL].Element.Version.BuildNum = (UINT16) MmioRead8 ((UINTN) (PciD31F0RegBase + R_PCH_LPC_RID));
+ if (PchPlatformPolicy->DeviceEnabling->Crid == PCH_DEVICE_ENABLE) {
+ Data8 = 0x1D;
+ MmioWrite8 ((UINTN) (PciD31F0RegBase + R_PCH_LPC_RID), Data8);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (PciD31F0RegBase + R_PCH_LPC_RID),
+ 1,
+ &Data8
+ );
+ CopyMem (mPchFviElementsData[CRID_STATUS].Element.VerString, StrEnabled, sizeof (StrEnabled));
+ } else {
+ CopyMem (mPchFviElementsData[CRID_STATUS].Element.VerString, StrDisabled, sizeof (StrDisabled));
+ }
+
+ mPchFviElementsData[CRID_NEW].Element.Version.BuildNum = (UINT16) MmioRead8 ((UINTN) (PciD31F0RegBase + R_PCH_LPC_RID));
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 16.4 GPIO Registers Lockdown
+ /// If GPIO configurations are not used after boot, it is recommended that the GLE Lockdown Enable
+ /// and the GPIO_UNLOCK_SMI_EN bits are set by BIOS prior to end of POST.
+ ///
+ if (PchPlatformPolicy->LockDownConfig->GpioLockDown == PCH_DEVICE_ENABLE) {
+ ///
+ /// Set GPIO Lockdown Enable bit
+ ///
+ MmioOr8 ((UINTN) (PciD31F0RegBase + R_PCH_LPC_GPIO_CNT), (UINT8) B_PCH_LPC_GPIO_LOCKDOWN_EN);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (PciD31F0RegBase + R_PCH_LPC_GPIO_CNT),
+ 1,
+ (VOID *) (UINTN) (PciD31F0RegBase + R_PCH_LPC_GPIO_CNT)
+ );
+ ///
+ /// Please locate SMM ICHn SMI Dispatch Extended Protocol and register the callback function to
+ /// IchnExGpioUnlock to set GPIO_UNLOCK_SMI_EN bit in the platform code.
+ ///
+ }
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 5.13 BIOS guide on using RTC RAM
+ /// For Data integrity protection, set RTC Memory locks (Upper 128 Byte Lock and
+ /// Lower 128 Byte Lock) at RCBA + 3400h[4] and RCBA + 3400h[3]. Note once locked
+ /// bytes 0x38 - 0x3F in each of the Upper and Lower Byte blocks, respectively,
+ /// cannot be unlocked until next reset.
+ ///
+ if (PchPlatformPolicy->LockDownConfig->RtcLock == PCH_DEVICE_ENABLE) {
+ MmioOr32 (
+ (UINTN) (RootComplexBar + R_PCH_RCRB_RTC_CONF),
+ (UINT32) (B_PCH_RCRB_RTC_CONF_UCMOS_LOCK | B_PCH_RCRB_RTC_CONF_LCMOS_LOCK)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_RTC_CONF),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_RCRB_RTC_CONF)
+ );
+ }
+ ///
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 3.6 Flash Security Recommendation
+ /// Step 1
+ /// BIOS needs to enable the BIOS Lock Enable (BLE) feature of the PCH by setting
+ /// B0:D31:F0:DCh[1] = 1b. When this bit is set, attempts to write the BIOS Write
+ /// Enable (BIOSWE) bit in PCH will cause a SMI which will allow the BIOS to verify
+ /// that the write is from a valid source. Remember that BIOS needs to set B0:D31:F0
+ /// Offset DC [0] = 0b to enable BIOS region protection before exiting the SMI handler.
+ /// Also, TCO_EN bit needs to be set (SMI_EN Register, PMBASE + 30h[13] = 1b) to keep
+ /// BLE feature enabled after booting to the OS.
+ ///
+ /// Generate PCH IO TRAP SMI to register IchnBiosWp callback function in
+ /// PchBiosLockIoTrapCallback() to handle TCO BIOSWR SMI
+ ///
+ if ((PchPlatformPolicy->LockDownConfig->BiosLock == PCH_DEVICE_ENABLE)) {
+ DEBUG (
+ (EFI_D_ERROR,
+ "PchBiosLockIoTrapAddress = 0x%x\n",
+ PchPlatformPolicy->LockDownConfig->PchBiosLockIoTrapAddress)
+ );
+
+ if (PchPlatformPolicy->LockDownConfig->PchBiosLockIoTrapAddress != 0) {
+ ///
+ /// Write PCH_BWP_SIGNATURE to IoTrap Address
+ ///
+ IoWrite32 (PchPlatformPolicy->LockDownConfig->PchBiosLockIoTrapAddress, PCH_BWP_SIGNATURE);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (PciD31F0RegBase + R_PCH_LPC_BIOS_CNTL),
+ 1,
+ (VOID *) (UINTN) (PciD31F0RegBase + R_PCH_LPC_BIOS_CNTL)
+ );
+ }
+ }
+ ///
+ /// Lock Down TCO
+ ///
+ Data16And = 0xFFFF;
+ Data16Or = B_PCH_TCO_CNT_LOCK;
+ IoOr16(PmBase + PCH_TCO_BASE + R_PCH_TCO1_CNT, Data16Or);
+ SCRIPT_IO_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PmBase + PCH_TCO_BASE + R_PCH_TCO1_CNT),
+ &Data16Or, // Data to be ORed
+ &Data16And // Data to be ANDed
+ );
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 5.15.1 Additional Chipset Initialization
+ /// Step 1
+ /// Set SPIBAR + F0h [0] to 1b
+ ///
+ MmioOr8 ((UINTN) (RootComplexBar + R_PCH_SPI_SRDL), B_PCH_SPI_SRDL_SSL);
+ ///
+ /// Check to disable Smbus controller
+ ///
+ if (PchPlatformPolicy->DeviceEnabling->Smbus == PCH_DEVICE_DISABLE) {
+ MmioOr32 ((UINTN) (RootComplexBar + R_PCH_RCRB_FUNC_DIS), (UINT32) B_PCH_RCRB_FUNC_DIS_SMBUS);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_FUNC_DIS),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_RCRB_FUNC_DIS)
+ );
+ ///
+ /// Reads back for posted write to take effect
+ ///
+ Data32Or = MmioRead32 ((UINTN) (RootComplexBar + R_PCH_RCRB_FUNC_DIS));
+ SCRIPT_MEM_POLL (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_FUNC_DIS),
+ &Data32Or, // BitMask
+ &Data32Or, // BitValue
+ 1, // Duration
+ 1 // LoopTimes
+ );
+ }
+
+ UsbInitBeforeBoot (PchPlatformPolicy);
+ FoundLegacyRaid = FALSE;
+ ///
+ /// Get all PCI IO protocols
+ ///
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiPciIoProtocolGuid,
+ NULL,
+ &NumHandles,
+ &HandleBuffer
+ );
+ if (!EFI_ERROR (Status)) {
+ ///
+ /// Find the RAID BIOS by checking each PCI IO handle for RST OPROM
+ ///
+ for (Index = 0; Index < NumHandles; Index++) {
+ Status = gBS->HandleProtocol (
+ HandleBuffer[Index],
+ &gEfiPciIoProtocolGuid,
+ (VOID **) &PciIo
+ );
+ if (EFI_ERROR (Status) || (PciIo->RomImage == NULL)) {
+ ///
+ /// If this PCI device doesn't have a ROM image, skip to the next device.
+ ///
+ continue;
+ }
+
+ RomImage = PciIo->RomImage;
+
+ ///
+ /// Get pointer to PCIR structure
+ ///
+ PcirBlockPtr = (PCI_DATA_STRUCTURE *) ((UINTN) RomImage + RomImage->PcirOffset);
+
+ ///
+ /// Check if we have an RAID BIOS OPROM.
+ ///
+ if ((RomImage->Signature == 0xAA55) &&
+ (PcirBlockPtr->ClassCode[0] == 0x00) &&
+ (PcirBlockPtr->ClassCode[1] == 0x04) &&
+ (PcirBlockPtr->ClassCode[2] == 0x01)
+ ) {
+ mPchFviElementsData[RAID_VER].Element.Version.MajorVersion = (UINT8) ((PcirBlockPtr->CodeRevision & 0xFF00) >> 8);
+ mPchFviElementsData[RAID_VER].Element.Version.MinorVersion = (UINT8) (PcirBlockPtr->CodeRevision & 0x00FF);
+ mPchFviElementsData[RAID_VER].Element.Version.Revision = 0;
+ mPchFviElementsData[RAID_VER].Element.Version.BuildNum = 0;
+ FoundLegacyRaid = TRUE;
+ }
+ }
+ }
+ ///
+ /// Search EFI RST OPROM
+ ///
+ if (FoundLegacyRaid == FALSE) {
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiDriverSupportedEfiVersionProtocolGuid,
+ NULL,
+ &NumHandles,
+ &HandleBuffer
+ );
+ if (!EFI_ERROR (Status)) {
+ for (Index = 0; Index < NumHandles; Index++) {
+ Status = gBS->HandleProtocol (
+ HandleBuffer[Index],
+ &gEfiComponentName2ProtocolGuid,
+ (VOID **) &ComponentName2
+ );
+ if (EFI_ERROR(Status)) {
+ continue;
+ }
+
+ Status = ComponentName2->GetDriverName (ComponentName2, LANGUAGE_CODE_ENGLISH, &DriverName);
+ if (EFI_ERROR(Status)) {
+ continue;
+ }
+
+ if ((StrnCmp (DriverName, RstDriverName1, (sizeof (RstDriverName1) / sizeof (CHAR16)) - 1) == 0) ||
+ (StrnCmp (DriverName, RstDriverName2, (sizeof (RstDriverName2) / sizeof (CHAR16)) - 1) == 0)) {
+ Status = gBS->HandleProtocol(
+ HandleBuffer[Index],
+ &gEfiDriverSupportedEfiVersionProtocolGuid,
+ (VOID**)&DriverEfiVersion);
+ mPchFviElementsData[RAID_VER].Element.Version.MajorVersion = (UINT8) ((DriverEfiVersion->FirmwareVersion & 0x00FF0000) >> 16);
+ mPchFviElementsData[RAID_VER].Element.Version.MinorVersion = (UINT8) (DriverEfiVersion->FirmwareVersion & 0x000000FF);
+ mPchFviElementsData[RAID_VER].Element.Version.Revision = 0;
+ mPchFviElementsData[RAID_VER].Element.Version.BuildNum = 0;
+ }
+ }
+ }
+ }
+
+ if (PchSeries == PchLp) {
+#ifdef SERIAL_IO_FLAG
+ ConfigureSerialIoBeforeBoot(PchPlatformPolicy, RootComplexBar);
+#endif // SERIAL_IO_FLAG
+#ifdef ADSP_FLAG
+ ConfigureAudioDspBeforeBoot (PchPlatformPolicy, RootComplexBar);
+#endif // ADSP_FLAG
+ }
+
+ //
+ // Update ASL objects
+ //
+ PchUpdateAslObjects (PchPlatformPolicy, RootComplexBar);
+
+ //
+ // Create RC FVI data hubs
+ //
+ CreateRcFviDatahub (&mPchFviVersionData);
+ }
+
+#ifdef EFI_S3_RESUME
+ if (!PchS3Support) {
+ DEBUG ((EFI_D_INFO, "Locating the S3 Support Protocol - PCH Init before Boot\n"));
+
+ ///
+ /// Get the PCH S3 Support Protocol
+ ///
+ Status = gBS->LocateProtocol (
+ &gEfiPchS3SupportProtocolGuid,
+ NULL,
+ (VOID **) &PchS3Support
+ );
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+
+ Status = PchS3Support->ReadyToLock(PchS3Support);
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+
+ }
+#endif
+
+ DEBUG ((EFI_D_INFO, "PchInitBeforeBoot() End\n"));
+
+ return;
+}
+
+// [ EIP357393 ]+>>>
+EFI_STATUS
+EFIAPI
+PchSpiLockBeforeEndOfDxe (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+/*++
+
+Routine Description:
+
+ Locking SPI configuration before End of Dxe
+
+Arguments:
+
+ Event A pointer to the Event that triggered the callback.
+ Context A pointer to private data registered with the callback function.
+
+Returns:
+
+ EFI_SUCCESS The function completed successfully
+
+ --*/
+{
+ EFI_STATUS Status;
+ UINTN NumHandles;
+ EFI_HANDLE *HandleBuffer;
+ UINTN Index;
+ DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy;
+ UINT32 RootComplexBar;
+ UINTN PciD25F0RegBase;
+ UINT32 GbEMemBar;
+ PCH_SERIES PchSeries = GetPchSeries();
+// UINT32 Data32And;
+// UINT32 Data32Or;
+ UINT16 Data16And;
+ UINT16 Data16Or;
+// UINT8 Data8;
+ VOID *ProtocolPointer;
+
+ //
+ // Check whether this is real AMI ExtPciBusProtocol notification, or just a SignalEvent
+ //
+ Status = gBS->LocateProtocol (&gAmiExtPciBusProtocolGuid, NULL, &ProtocolPointer);
+ if (EFI_ERROR (Status)) {
+ return EFI_SUCCESS;
+ }
+
+ //
+ // Closed the event to avoid call twice when launch shell
+ //
+ gBS->CloseEvent (Event);
+
+
+ //
+ // Retrieve all instances of PCH Platform Policy protocol
+ //
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gDxePchPlatformPolicyProtocolGuid,
+ NULL,
+ &NumHandles,
+ &HandleBuffer
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR | EFI_D_INFO, "Failed to locate handle buffer for PCH Policy protocol.\n"));
+ return Status;
+ }
+ //
+ // Find the matching PCH Policy protocol
+ //
+ for (Index = 0; Index < NumHandles; Index++) {
+ Status = gBS->HandleProtocol (
+ HandleBuffer[Index],
+ &gDxePchPlatformPolicyProtocolGuid,
+ &PchPlatformPolicy
+ );
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR | EFI_D_INFO, "Failed to find PCH Policy protocol.\n"));
+ return Status;
+ }
+
+ RootComplexBar = PCH_RCRB_BASE;
+
+ ///
+ /// SPI Flash Programming Guide Section 5.5.1 Flash Configuration Lockdown
+ /// It is strongly recommended that BIOS sets the Host and GbE Flash Configuration Lock-Down (FLOCKDN)
+ /// bits (located at SPIBAR + 04h and MBAR + 04h respectively) to 1 on production platforms
+ ///
+ if (PchSeries == PchH) {
+ MmioOr16 ((UINTN) (RootComplexBar + R_PCH_SPI_HSFS), (UINT16) (B_PCH_SPI_HSFS_FLOCKDN + B_PCH_SPI_PRR3PRR4_LOCKDN));
+ } else if (PchSeries == PchLp) {
+ MmioOr16 ((UINTN) (RootComplexBar + R_PCH_SPI_HSFS), (UINT16) (B_PCH_SPI_HSFS_FLOCKDN));
+ }
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (RootComplexBar + R_PCH_SPI_HSFS),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_SPI_HSFS)
+ );
+ //
+ // Set the GbE Flash Configuration Lock-Down (FLOCKDN) bit (MBAR + 04h[15]) to 1
+ //
+ if (PchPlatformPolicy->DeviceEnabling->Lan == PCH_DEVICE_ENABLE) {
+ PciD25F0RegBase = MmPciAddress (0, PchPlatformPolicy->BusNumber, 25, 0, 0);
+ GbEMemBar = MmioRead32 (PciD25F0RegBase + R_PCH_LAN_MBARB) & B_PCH_LAN_MBARB_BA;
+ if (GbEMemBar) {
+ //
+ // Enable memory space decoding in command register
+ //
+ Data16And = 0xFFFF;
+ Data16Or = (UINT16) B_PCH_LAN_CMD_MSE;
+ MmioOr16 (PciD25F0RegBase + R_PCH_LAN_CMD, Data16Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PciD25F0RegBase + R_PCH_LAN_CMD),
+ &Data16Or, // Data to be ORed
+ &Data16And // Data to be ANDed
+ );
+
+ ///
+ /// Assert if the memory data of GbEMemBar is invalid.
+ ///
+ if (MmioRead32 (GbEMemBar) == 0xFFFFFFFF) {
+ ASSERT (FALSE);
+ } else {
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PciD25F0RegBase + R_PCH_LAN_MBARB),
+ 1,
+ (VOID *) (UINTN) (PciD25F0RegBase + R_PCH_LAN_MBARB)
+ );
+ MmioOr16 (GbEMemBar + 0x04, BIT15);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (GbEMemBar + 0x04),
+ 1,
+ (VOID *) (UINTN) (GbEMemBar + 0x04)
+ );
+ }
+ }
+ }
+ }
+ return EFI_SUCCESS;
+}
+// [ EIP357393 ]+<<<
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchInit.dxs b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchInit.dxs
new file mode 100644
index 0000000..5e1ad9a
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchInit.dxs
@@ -0,0 +1,48 @@
+/** @file
+ Dispatch dependency expression file for the PchInit driver.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "DxeDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+
+#include EFI_PROTOCOL_DEFINITION (BootScriptSave)
+#include EFI_PROTOCOL_DEFINITION (PchPlatformPolicy)
+#include EFI_PROTOCOL_DEFINITION (PchS3Support)
+#include EFI_PROTOCOL_DEFINITION (SmmControl)
+#endif
+
+DEPENDENCY_START
+#ifdef EFI_S3_RESUME
+ EFI_BOOT_SCRIPT_SAVE_PROTOCOL_GUID AND
+ EFI_PCH_S3_SUPPORT_PROTOCOL_GUID AND
+#endif
+ DXE_PCH_PLATFORM_POLICY_PROTOCOL_GUID AND
+ EFI_SMM_CONTROL_PROTOCOL_GUID
+DEPENDENCY_END
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchInit.h b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchInit.h
new file mode 100644
index 0000000..a99c375
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchInit.h
@@ -0,0 +1,653 @@
+/** @file
+ Header file for PCH Initialization Driver.
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#ifndef _PCH_INITIALIZATION_DRIVER_H_
+#define _PCH_INITIALIZATION_DRIVER_H_
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+
+#include "EdkIIGlueDxe.h"
+#include "EfiScriptLib.h"
+
+//
+// Driver Consumed Protocol Prototypes
+//
+#include EFI_PROTOCOL_CONSUMER (PchPlatformPolicy)
+#include EFI_PROTOCOL_CONSUMER (BootScriptSave)
+#include EFI_PROTOCOL_CONSUMER (ExitPmAuth)
+#include EFI_PROTOCOL_CONSUMER (PchS3Support)
+#include EFI_PROTOCOL_PRODUCER (PchInfo)
+#include EFI_PROTOCOL_CONSUMER (DriverSupportedEfiVersion)
+#include EFI_GUID_DEFINITION (ChipsetInitHob)
+
+#include "PchAccess.h"
+#include "PchPlatformLib.h"
+#include "PchPciExpressHelpersLib.h"
+#include "PchUsbCommon.h"
+#include "PchHsio.h"
+#include "Pci22.h"
+#include "IobpDefinitions.h"
+#include "RcFviDxeLib.h"
+#include "PchInitVar.h"
+#include "PchAslUpdateLib.h"
+#endif
+
+#define AZALIA_MAX_LOOP_TIME 10
+#define AZALIA_WAIT_PERIOD 100
+#define AZALIA_MAX_SID_NUMBER_PCH_H 4
+#define AZALIA_MAX_SID_NUMBER_PCH_LP 2
+#define AZALIA_MAX_SID_MASK_PCH_H ((1 << AZALIA_MAX_SID_NUMBER_PCH_H) - 1)
+#define AZALIA_MAX_SID_MASK_PCH_LP ((1 << AZALIA_MAX_SID_NUMBER_PCH_LP) - 1)
+//
+// CPUID and MSR definitions
+//
+#define CPUID_VERSION_INFO 0x1
+#define CPUID_FULL_FAMILY_MODEL 0x0FFF0FF0
+#define CPUID_FULL_STEPPING 0x0000000F
+#define CPUID_FULL_FAMILY_MODEL_HASWELL 0x000306C0
+#define CPUID_FULL_FAMILY_MODEL_HASWELL_ULT 0x00040650
+#define CPUID_FULL_FAMILY_MODEL_CRYSTALWELL 0x00040660
+#define MSR_TEMPERATURE_TARGET 0x000001A2
+
+typedef enum {
+ //
+ // Haswell Family Stepping
+ //
+ EnumHswA0 = 1,
+ EnumHswB0,
+ EnumHswC0,
+ EnumHswD0,
+ //
+ // Haswell ULT Family Stepping
+ //
+ EnumHswUltB0 = 0,
+ EnumHswUltC0,
+ //
+ // Crystalwell Family Stepping
+ //
+ EnumCrwB0 = 0,
+ EnumCrwC0,
+ EnumCrwD0,
+ EnumCpuSteppingMax = CPUID_FULL_STEPPING
+} CPU_STEPPING;
+
+#pragma pack(1)
+typedef union _MSR_REGISTER {
+ UINT64 Qword;
+
+ struct _DWORDS {
+ UINT32 Low;
+ UINT32 High;
+ } Dwords;
+
+ struct _BYTES {
+ UINT8 FirstByte;
+ UINT8 SecondByte;
+ UINT8 ThirdByte;
+ UINT8 FouthByte;
+ UINT8 FifthByte;
+ UINT8 SixthByte;
+ UINT8 SeventhByte;
+ UINT8 EighthByte;
+ } Bytes;
+
+} MSR_REGISTER;
+
+typedef struct {
+ UINT32 RegEax;
+ UINT32 RegEbx;
+ UINT32 RegEcx;
+ UINT32 RegEdx;
+} EFI_CPUID_REGISTER;
+#pragma pack()
+
+typedef struct {
+ EFI_PCH_INFO_PROTOCOL PchInfo;
+} PCH_INSTANCE_PRIVATE_DATA;
+
+#define IS_PCH_H_EHCI(DeviceNumber, FunctionNumber) \
+ ( \
+ (DeviceNumber == PCI_DEVICE_NUMBER_PCH_USB && FunctionNumber == PCI_FUNCTION_NUMBER_PCH_EHCI) || \
+ (DeviceNumber == PCI_DEVICE_NUMBER_PCH_USB_EXT && FunctionNumber == PCI_FUNCTION_NUMBER_PCH_EHCI2) \
+ )
+
+#define IS_PCH_LP_EHCI(DeviceNumber, FunctionNumber) \
+ ( \
+ (DeviceNumber == PCI_DEVICE_NUMBER_PCH_USB && FunctionNumber == PCI_FUNCTION_NUMBER_PCH_EHCI) \
+ )
+
+//
+// Data definitions
+//
+extern EFI_HANDLE mImageHandle;
+
+///
+/// SVID / SID init table entry
+///
+typedef struct {
+ UINT8 DeviceNumber;
+ UINT8 FunctionNumber;
+ UINT8 SvidRegOffset;
+} PCH_SVID_SID_INIT_ENTRY;
+
+#define PCH_FVI_STRING "Reference Code - PCH - Lynxpoint"
+#define PCH_FVI_SMBIOS_TYPE 0xDD
+#define PCH_FVI_SMBIOS_INSTANCE 0x04
+#define PCH_CRID_STATUS "PCH-CRID Status"
+#define PCH_CRID_ORIGINAL_VALUE "PCH-CRID Original Value"
+#define PCH_CRID_NEW_VALUE "PCH-CRID New Value"
+#define PCH_CRID_ENABLED "Enabled "
+#define PCH_CRID_DISABLED "Disabled"
+#define PCH_LPTLPBX_HSIO_STRING "LPTLp Bx Hsio Version"
+#define PCH_LPTHB0_HSIO_STRING "LPTH B0 Hsio Version"
+#define PCH_LPTHCX_HSIO_STRING "LPTH Cx Hsio Version"
+#define PCH_CRID_VERSION \
+ { \
+ 0xFF, 0xFF, 0xFF, 0xFFFF \
+ }
+#define RAID_FVI_STRING "OPROM - RST - RAID"
+#define RAID_RC_VERSION \
+ { \
+ 0xFF, 0xFF, 0xFF, 0xFFFF \
+ }
+
+enum {
+ RC_VER = 0,
+ CRID_STATUS,
+ CRID_ORIGINAL,
+ CRID_NEW,
+ RAID_VER,
+ HSIO_LPTLPAX_VER,
+ HSIO_LPTLPBX_VER,
+ HSIO_LPTHB0_VER,
+ HSIO_LPTHCX_VER
+} PCH_FVI_INDEX;
+
+extern FVI_ELEMENT_AND_FUNCTION mPchFviElementsData[];
+extern FVI_DATA_HUB_CALLBACK_CONTEXT mPchFviVersionData;
+extern UINTN mPchFviElements;
+
+//
+// Function Prototype
+//
+
+/**
+ Configures PCH IOBP and stores this configuration in S3 boot script
+
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+ @param[in] Address Address of the IOBP register block
+ @param[in] AndMask Mask to AND with the register
+ @param[in] OrMask Mask to OR with the register
+**/
+VOID
+ProgramIobpWithScript (
+ IN UINT32 RootComplexBar,
+ IN UINT32 Address,
+ IN UINT32 AndMask,
+ IN UINT32 OrMask
+ );
+
+/**
+ Configures 32-bit MMIO register and stores this configuration in S3 boot script
+
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+ @param[in] Address Address of the IOBP register block
+ @param[in] AndMask Mask to AND with the register
+ @param[in] OrMask Mask to OR with the register
+**/
+VOID
+MmioAndThenOr32WithScript (
+ IN UINTN Address,
+ IN UINT32 AndMask,
+ IN UINT32 OrMask
+ );
+
+/**
+ Detect and initialize the type of codec (AC'97 and HDA) present in the system.
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+ @param[in] AzaliaEnable Returned with TRUE if Azalia High Definition Audio codec
+ is detected and initialized.
+
+ @retval EFI_SUCCESS Codec is detected and initialized.
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate resources to initialize the codec.
+**/
+EFI_STATUS
+ConfigureAzalia (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar,
+ IN OUT BOOLEAN *AzaliaEnable
+ );
+
+/**
+ Configure miscellaneous power management settings
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+ @param[in] GpioBase GPIO base address of this PCH device
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+ConfigureMiscPm (
+ DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ UINT32 RootComplexBar,
+ UINT16 GpioBase
+ );
+
+/**
+ Configure additional power management settings
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+ConfigureAdditionalPm (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar
+ );
+
+/**
+ Configure deep Sx programming
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+ProgramDeepSx (
+ DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ UINT32 RootComplexBar
+ );
+
+/**
+ Perform miscellany PCH initialization
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+ @param[in, out] FuncDisableReg The value of Function disable register
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+ConfigureMiscItems (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar,
+ IN OUT UINT32 *FuncDisableReg
+ );
+
+/**
+ Initialize LAN device. Reference: PCH BIOS Spec Rev 0.5.0,
+ 10.2 Enabling / Disabling the Internal GbE Controller
+ ** NOTE:
+ - The platform reset mandated by GbE enabling / disabling is handled
+ in PchInit PEIM. Platform PEI code is responsible for calling PCH Init PPI
+ - (BUC register setting is also done in the PCH Init PPI)
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+ @param[in] RootComplexBar RootComplexBar address of this PCH device
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+ConfigureLan (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar
+ );
+
+/**
+ Configures PCH USB controller
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+ @param[in, out] FuncDisableReg Function Disable Register
+
+ @retval EFI_INVALID_PARAMETER The parameter of PchPlatformPolicy is invalid
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+ConfigureUsb (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar,
+ IN OUT UINT32 *FuncDisableReg
+ );
+
+/**
+ Configures PCH Sata Controller
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+ @param[in, out] FuncDisableReg Function Disable Register
+ @param[in] GpioBase GPIO base address of this PCH device
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+ConfigureSata (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar,
+ IN OUT UINT32 *FuncDisableReg,
+ IN UINT16 GpioBase
+ );
+
+/**
+ Perform Clock Gating programming
+ Enables clock gating in various PCH interfaces and the registers must be restored during S3 resume.
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+ @param[in] FuncDisableReg The Function Disable Register
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+ConfigureClockGating (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar,
+ IN UINT32 FuncDisableReg
+ );
+
+/**
+ Configure IoApic Controler
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+ @param[in] RootComplexBar RootComplexBar address of this PCH device
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+ConfigureIoApic (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar
+ );
+
+/**
+ Configure PCH Display
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+ @param[in] RootComplexBar RootComplexBar address of this PCH device
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+ConfigureDisplay (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar
+ );
+
+/**
+ Perform Root Port Initialization.
+
+ @param[in] RootPort The root port to be initialized (zero based)
+ @param[in] RootPortFunction The PCI function number of the root port
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol
+ @param[in] PmBase The PM I/O Base address of the PCH
+ @param[in] RootComplexBar RCBA of the PCH
+
+ @retval EFI_SUCCESS Device found. The root port must be enabled.
+ @retval EFI_NOT_FOUND No device is found on the root port. It may be disabled.
+ @exception EFI_UNSUPPORTED Unsupported operation.
+**/
+EFI_STATUS
+PchInitSingleRootPort (
+ IN UINT8 RootPort,
+ IN UINT8 RootPortFunction,
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT16 PmBase,
+ IN UINT32 RootComplexBar
+ );
+
+/**
+ Perform Initialization of the Downstream Root Ports.
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol
+ @param[in] RootComplexBar RCBA of the PCH
+ @param[in] PmBase The PM I/O Base address of the PCH
+ @param[in, out] FuncDisableReg The function disable register. IN / OUT parameter.
+
+ @retval EFI_SUCCESS The function completed successfully
+ @retval EFI_INVALID_PARAMETER The PCIe Root Port Number of D28:F0 is not found
+ or invalid
+**/
+EFI_STATUS
+PchInitRootPorts (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar,
+ IN UINT16 PmBase,
+ IN OUT UINT32 *FuncDisableReg
+ );
+
+/**
+ This is the function to enable the clock gating for PCI Express ports.
+
+ @param[in] BusNumber The Bus Number of the PCH device
+ @param[in] PchPlatformPolicy PCH Platform Policy protocol
+ @param[in] RpEnableMask Bit Mask indicating the enabled root ports
+ @param[in] RpHiddenMask Bit Mask indicating the root ports used for other > x1 root ports
+ @param[in] RootComplexBar Root complex base address
+
+ @retval EFI_SUCCESS Successfully completed.
+**/
+EFI_STATUS
+PcieEnableClockGating (
+ IN UINT8 BusNumber,
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RpEnableMask,
+ IN UINT32 RpHiddenMask,
+ IN UINT32 RootComplexBar,
+ IN UINT32 NandPort
+ );
+
+/**
+ Set an Init Root Port Downstream devices S3 dispatch item, this function may assert if any error happend
+
+ @param[in] RootPortBus Pci Bus Number of the root port
+ @param[in] RootPortDevice Pci Device Number of the root port
+ @param[in] RootPortFunc Pci Function Number of the root port
+ @param[in] TempBusNumberMin Minimal temp bus number that can be assigned to the root port (as secondary
+ bus number) and its down stream switches
+ @param[in] TempBusNumberMax Maximal temp bus number that can be assigned to the root port (as subordinate
+ bus number) and its down stream switches
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+SetInitRootPortDownstreamS3Item (
+ IN UINT8 RootPortBus,
+ IN UINT8 RootPortDevice,
+ IN UINT8 RootPortFunc,
+ IN UINT8 TempBusNumberMin,
+ IN UINT8 TempBusNumberMax
+ );
+
+/**
+ Set an PCH IOBP programming S3 dispatch item, this function may assert if any error happend
+
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+ @param[in] Address Address of the IOBP register block
+ @param[in] AndMask Mask to AND with the register
+ @param[in] OrMask Mask to OR with the register
+
+ @retval EFI_SUCCESS The function completed successfully
+ @retval EFI_OUT_OF_RESOURCES Out of resources
+ @retval EFI_INVALID_PARAMETER Invalid parameter
+ @retval EFI_NOT_FOUND Protocol interface not found
+**/
+EFI_STATUS
+SetProgramIobpS3Item (
+ IN UINT32 RootComplexBar,
+ IN UINT32 Address,
+ IN UINT32 AndMask,
+ IN UINT32 OrMask
+ );
+
+/**
+ Locking Thermal Reporting Settings
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+ @param[in] GpioBase GPIO base address of this PCH device
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+ThermalLockDown (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ UINT16 GpioBase
+ );
+
+/**
+ Configures PCH DMI according to policies specified in PCH Platform Policy protocol
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+
+ @retval EFI_SUCCESS Successfully completed.
+**/
+EFI_STATUS
+EFIAPI
+ConfigureDmiPm (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar
+ );
+
+/**
+ Dump whole DXE_PCH_PLATFORM_POLICY_PROTOCOL and serial out.
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+
+ @retval None
+**/
+VOID
+PchDumpPlatformProtocol (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy
+ );
+
+/**
+ Lock USB registers before boot
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy
+
+ @retval None
+**/
+VOID
+UsbInitBeforeBoot (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy
+ );
+
+/**
+ Configures ports of the PCH USB3 (xHCI) controller
+ just before OS boot.
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+
+ @retval EFI_INVALID_PARAMETER The parameter of PchPlatformPolicy is invalid
+ @retval EFI_SUCCESS The function completed successfully
+**/
+VOID
+ConfigureXhciAtBoot (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy
+ );
+
+#ifdef SERIAL_IO_FLAG
+/**
+ Puts Serial IO controllers in D3
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+**/
+VOID
+ConfigureSerialIoAtBoot (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy
+ );
+
+/**
+ Hide PCI config space of Serial IO Controllerss and do any
+ final initialization.
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+ConfigureSerialIoBeforeBoot (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar
+ );
+
+/**
+ Configures Serial IO Controllers
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+ @param[in] RootComplexBar RootComplexBar address of this PCH device
+
+ @retval None
+**/
+EFI_STATUS
+ConfigureSerialIo (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar
+ );
+#endif // SERIAL_IO_FLAG
+
+#ifdef ADSP_FLAG
+/**
+ Initialize Audio DSP subsystem
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+ @param[in, out] FuncDisableReg The value of Function disable register
+
+ @retval EFI_SUCCESS Codec is detected and initialized
+ @retval EFI_UNSUPPORTED Audio DSP disabled
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate resources to initialize the codec
+**/
+EFI_STATUS
+ConfigureAudioDsp (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar,
+ IN OUT UINT32 *FuncDisableReg
+ );
+
+/**
+ Finalize Audio DSP initialization after PCI enumeration.
+ In particular configure ADSP in ACPI or PCI mode.
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+
+ @retval EFI_SUCCESS The function completed successfully
+ @retval EFI_UNSUPPORTED Audio DSP not found or not enabled
+**/
+EFI_STATUS
+ConfigureAudioDspBeforeBoot (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar
+ );
+
+#endif // ADSP_FLAG
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchInitCommon.h b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchInitCommon.h
new file mode 100644
index 0000000..86a6805
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchInitCommon.h
@@ -0,0 +1,110 @@
+/** @file
+
+ Header file for PCH common Initialization Driver.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PCH_INIT_COMMON_DRIVER_H_
+#define _PCH_INIT_COMMON_DRIVER_H_
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+
+#include "EdkIIGlueDxe.h"
+#include "EfiScriptLib.h"
+#include EFI_PROTOCOL_CONSUMER (PchPlatformPolicy)
+#ifdef USB_PRECONDITION_ENABLE_FLAG
+#include "PchUsbPrecondition.h"
+#endif // USB_PRECONDITION_ENABLE_FLAG
+
+#endif
+
+#define PCH_INIT_COMMON_SCRIPT_IO_WRITE(TableName, Width, Address, Count, Buffer) \
+ SCRIPT_IO_WRITE(TableName, Width, Address, Count, Buffer)
+
+#define PCH_INIT_COMMON_SCRIPT_IO_READ_WRITE(TableName, Width, Address, Data, DataMask) \
+ SCRIPT_IO_READ_WRITE(TableName, Width, Address, Data, DataMask)
+
+#define PCH_INIT_COMMON_SCRIPT_MEM_WRITE(TableName, Width, Address, Count, Buffer) \
+ SCRIPT_MEM_WRITE(TableName, Width, Address, Count, Buffer)
+
+#define PCH_INIT_COMMON_SCRIPT_MEM_READ_WRITE(TableName, Width, Address, Data, DataMask) \
+ SCRIPT_MEM_READ_WRITE(TableName, Width, Address, Data, DataMask)
+
+#define PCH_INIT_COMMON_SCRIPT_PCI_CFG_WRITE(TableName, Width, Address, Count, Buffer) \
+ SCRIPT_PCI_CFG_WRITE(TableName, Width, Address, Count, Buffer)
+
+#define PCH_INIT_COMMON_SCRIPT_PCI_CFG_READ_WRITE(TableName, Width, Address, Data, DataMask) \
+ SCRIPT_PCI_CFG_READ_WRITE(TableName, Width, Address, Data, DataMask)
+
+#define PCH_INIT_COMMON_SCRIPT_STALL(TableName, Duration) SCRIPT_STALL (TableName, Duration)
+
+#define PCH_INIT_COMMON_SCRIPT_SAVE_IOBP_S3_ITEM(RootComplexBar, Address, AndMask, OrMask) \
+ SetProgramIobpS3Item(RootComplexBar, Address, AndMask, OrMask)
+
+#ifdef USB_PRECONDITION_ENABLE_FLAG
+///
+/// Execute function when running in PEI
+/// It is always FALSE for DXE phase check
+///
+#define USB_RUN_IN_PEI FALSE
+
+///
+/// Execute function when running in DXE
+///
+#define USB_RUN_IN_DXE TRUE
+
+///
+/// USB precondition policy check
+///
+#define USB_PRECONDITION_POLICY_SUPPORT(UsbPolicy) \
+ ((UsbPolicy)->UsbPrecondition)
+
+#endif // USB_PRECONDITION_ENABLE_FLAG
+
+///
+/// USB3 port setting policy check
+///
+#define USB3PORT_SETTING_POLICY_SUPPORT(Revision) \
+ ((Revision >= DXE_PCH_PLATFORM_POLICY_PROTOCOL_REVISION_5))
+
+/**
+ Set an PCH IOBP programming S3 dispatch item, this function may assert if any error happend
+
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+ @param[in] Address Address of the IOBP register block
+ @param[in] AndMask Mask to AND with the register
+ @param[in] OrMask Mask to OR with the register
+
+ @retval EFI_SUCCESS The function completed successfully
+ @retval EFI_OUT_OF_RESOURCES Out of resources
+ @retval EFI_INVALID_PARAMETER Invalid parameter
+ @retval EFI_NOT_FOUND Protocol interface not found
+**/
+EFI_STATUS
+SetProgramIobpS3Item (
+ IN UINT32 RootComplexBar,
+ IN UINT32 Address,
+ IN UINT32 AndMask,
+ IN UINT32 OrMask
+ );
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchInitDxe.cif b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchInitDxe.cif
new file mode 100644
index 0000000..a8922a8
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchInitDxe.cif
@@ -0,0 +1,28 @@
+<component>
+ name = "PchInitDxe"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\PchInit\Dxe"
+ RefName = "PchInitDxe"
+[files]
+"PchInitDxe.sdl"
+"PchInitDxe.mak"
+"PchInit.h"
+"PchInit.c"
+"PchAzalia.c"
+"PchIoApic.c"
+"PchLan.c"
+"PchMisc.c"
+"PchPm.c"
+"PchSata.c"
+"PchUsb.c"
+"PchInit.dxs"
+"PchRootPorts.c"
+"PchInitCommon.h"
+"PchDebugDump.c"
+"PchFvi.c"
+"PchInitDxe.inf"
+"PchAudioDsp.c"
+"PchUsbPrecondition.c"
+"PchUsbPrecondition.h"
+"PchSerialIo.c"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchInitDxe.inf b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchInitDxe.inf
new file mode 100644
index 0000000..62675c2
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchInitDxe.inf
@@ -0,0 +1,134 @@
+## @file
+# Component description file for Pch Initialization driver
+#
+#@copyright
+# Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = PchInitDxe
+FILE_GUID = DE23ACEE-CF55-4fb6-AA77-984AB53DE823
+COMPONENT_TYPE = BS_DRIVER
+
+[sources.common]
+ PchInit.h
+ PchInit.c
+ PchAzalia.c
+ PchIoApic.c
+ PchLan.c
+ PchMisc.c
+ PchPm.c
+ PchSata.c
+ PchUsb.c
+ PchRootPorts.c
+ PchDebugDump.c
+ ../Common/PchUsbCommon.c
+ ../Common/PchHsio.c
+ ../Common/PchInitVar.c
+ PchFvi.c
+ PchSerialIo.c
+ PchAudioDsp.c
+ PchUsbPrecondition.c
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueDxeDriverEntryPoint.c
+
+[includes.common]
+ .
+ ../Common
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Framework/Guid/Hob
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Guid/ChipsetInitHob
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Protocol
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Protocol/PchInfo
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Samplecode/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Samplecode/Library/AslUpdate/Dxe
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Guid/MeDataHob
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/include
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/Dxe
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Heci/Include
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Protocol/MePlatformPolicy
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include/Library
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/SampleCode
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Include
+ $(EFI_SOURCE)/Include
+
+[libraries.common]
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueDxeReportStatusCodeLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueDxeServicesTableLib
+ EdkIIGlueDxeMemoryAllocationLib
+ EdkIIGlueDxeFirmwarePerformanceLib
+ EdkIIGlueBasePciLibPciExpress
+ EdkFrameworkProtocolLib
+ EdkProtocolLib
+ EdkIIGlueDxeHobLib
+ PchPciExpressHelpersLib
+ $(PROJECT_PCH_FAMILY)ProtocolLib
+ PchPlatformLib
+ EfiGuidLib
+ EfiScriptLib
+ RcFviDxeLib
+ PchAslUpdateLib
+ MeLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = PchInit.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=PchInitEntryPoint
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ -D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+ -D __EDKII_GLUE_DXE_HOB_LIB__
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchInitDxe.mak b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchInitDxe.mak
new file mode 100644
index 0000000..a1c641e
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchInitDxe.mak
@@ -0,0 +1,150 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchInitDxe/PchInitDxe.mak 6 1/14/13 2:40a Scottyang $
+#
+# $Revision: 6 $
+#
+# $Date: 1/14/13 2:40a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchInitDxe/PchInitDxe.mak $
+#
+# 6 1/14/13 2:40a Scottyang
+# [TAG] EIP112059
+#
+# [Category] Improvement
+#
+# [Description] Update PCH RC 0.9.0.
+# [Files] ReferenceCode\Chipset\LynxPoint\*.*
+#
+# 5 11/20/12 8:34a Scottyang
+# [TAG] EIP107014
+# [Category] Improvement
+# [Description] Update RC 0.8.0
+# [Files] ReferenceCode\Chipset\LynxPoint\*.*, SBDxe.c, SB.sd,
+# SbSetupData.c, GetSetupDate.c
+#
+# 4 8/13/12 9:14a Victortu
+#
+# 3 7/02/12 9:56a Victortu
+#
+# 2 2/24/12 2:12a Victortu
+# Updated to support 4.6.5.3_IntelEDK_1117_Patch7_00.
+#
+# 1 2/08/12 8:51a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+
+#---------------------------------------------------------------------------
+# Create PchInitDxe Driver
+#---------------------------------------------------------------------------
+EDK : PchInitDxe
+PchInitDxe : $(BUILD_DIR)\PchInitDxe.mak PchInitDxeBin
+
+
+$(BUILD_DIR)\PchInitDxe.mak : $(PchInitDxe_DIR)\$(@B).cif $(PchInitDxe_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(PchInitDxe_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+MY_DEFINES=\
+!IF "$(PCH_DEBUG_INFO)"=="1"
+ /D"PCH_DEBUG_INFO=1"\
+!ELSE
+ /D"PCH_DEBUG_INFO=0"\
+!ENDIF
+
+PchInitDxe_INCLUDES=\
+ /I$(PchUsbCommonLib_DIR)\
+ $(INTEL_PCH_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ /I$(INTEL_PCH_DIR)\Protocol\PchInfo\
+ /I$(INTEL_PCH_DIR)\SampleCode\Include\
+ /I$(INTEL_PCH_DIR)\SampleCode\Library\AslUpdate\Dxe\
+ /I$(INTEL_PCH_DIR)\Guid\SurvivabilityHob\
+ $(ME_INCLUDES)
+
+PchInitDxe_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=PchInitEntryPoint"\
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+ /D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__\
+ /D __EDKII_GLUE_DXE_HOB_LIB__
+
+PchInitDxe_LIB_LINKS =\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueDxeServicesTableLib_LIB)\
+ $(EdkIIGlueDxeMemoryAllocationLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(EDKPROTOCOLLIB)\
+ $(PchPciExpressHelpersDxeLib_LIB)\
+ $(INTEL_PCH_PROTOCOL_LIB)\
+ $(PchPlatformDxeLib_LIB)\
+ $(EFIGUIDLIB)\
+ $(EFISCRIPTLIB)\
+ $(PchUsbCommonDxeLib_LIB)\
+ $(EdkIIGlueUefiRuntimeServicesTableLib_LIB)\
+ $(RcFviDxeLib_LIB)\
+ $(PchAslUpdateLib_LIB)\
+ $(EdkIIGlueDxeHobLib_LIB)\
+!IF "$(iME_SUPPORT)"=="1"
+ $(PchGuidLib_LIB)\
+ $(MeLibDxe_LIB)
+!ENDIF
+
+PchInitDxeBin: $(PchInitDxe_LIB_LINKS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\PchInitDxe.mak all \
+ "MY_INCLUDES=$(PchInitDxe_INCLUDES)"\
+ "MY_DEFINES=$(PchInitDxe_DEFINES)"\
+ GUID=DE23ACEE-CF55-4fb6-AA77-984AB53DE823\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=BS_DRIVER\
+ EDKIIModule=DXEDRIVER\
+ DEPEX1=$(PchInitDxe_DIR)\PchInit.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX\
+!IF "$(SOFTSDV_PARTIAL_COMPRESS)"=="1"
+ COMPRESS=0
+!ELSE
+ COMPRESS=1
+!ENDIF
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchInitDxe.sdl b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchInitDxe.sdl
new file mode 100644
index 0000000..e0b5eb2
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchInitDxe.sdl
@@ -0,0 +1,66 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchInitDxe/PchInitDxe.sdl 1 2/08/12 8:51a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 8:51a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchInitDxe/PchInitDxe.sdl $
+#
+# 1 2/08/12 8:51a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+TOKEN
+ Name = "PchInitDxe_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable PchInitDxe support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "PchInitDxe_DIR"
+End
+
+MODULE
+ File = "PchInitDxe.mak"
+ Help = "Includes PchInitDxe.mak to Project"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PchInitDxe.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchIoApic.c b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchIoApic.c
new file mode 100644
index 0000000..ba0b94f
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchIoApic.c
@@ -0,0 +1,134 @@
+/** @file
+ Initializes PCH IO APIC Device.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "PchInit.h"
+
+/**
+ Configure IoApic Controler
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+ @param[in] RootComplexBar RootComplexBar address of this PCH device
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+ConfigureIoApic (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar
+ )
+{
+ UINT8 RegData8;
+ UINT16 RegData16;
+ UINT32 RegData32;
+ UINTN PciD31F0RegBase;
+ UINT32 IoApicAddress;
+ PCH_IO_APIC_CONFIG *IoApicConfig;
+ PCH_LPC_HPET_CONFIG *HpetConfig;
+ UINT8 Index;
+
+ DEBUG ((EFI_D_INFO, "ConfigureIoApic() Start\n"));
+
+ ///
+ /// Get LPC base address
+ ///
+ PciD31F0RegBase = MmPciAddress (0, PchPlatformPolicy->BusNumber, 31, 0, 0);
+ IoApicConfig = PchPlatformPolicy->IoApicConfig;
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 6.6.2.1
+ /// 1. Enable the IOAPIC by setting the APIC Enable bit, RCBA + offset 31FFh, Bit[0] if the
+ /// system needs to use the IOxAPIC. The APIC Enable bits needs read back after the bit is written.
+ /// Done in PchInitPeim.c PchIoApicInit()
+ ///
+ /// 2. Build the MP table and/or ACPI APIC table for the OS
+ /// This will be done in ACPI code.
+ ///
+ /// 3. Maximum Redirection Entries (MRE) in APIC Version Register (VER), offset 01h,
+ /// [23:16] has to be written once for Microsoft Windows OS.
+ /// The address bits 19:12 of IOAPIC INDEX and DATA are programmable
+ /// through OIC register at RCBA + 31FEh[7:0].
+ ///
+ IoApicAddress = (UINT32) MmioRead8 (RootComplexBar + R_PCH_RCRB_OIC);
+ IoApicAddress = IoApicAddress << N_PCH_IO_APIC_ASEL;
+ RegData8 = 0x01;
+ MmioWrite8 ((UINTN) (R_PCH_IO_APIC_INDEX | IoApicAddress), RegData8);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (R_PCH_IO_APIC_INDEX | IoApicAddress),
+ 1,
+ &RegData8
+ );
+ RegData32 = 0x170020;
+ if (GetPchSeries() == PchLp) {
+ if (IoApicConfig->IoApicEntry24_39 == PCH_DEVICE_ENABLE) {
+ RegData32 = 0x270020;
+ }
+ }
+ MmioWrite32 ((R_PCH_IO_APIC_DATA | IoApicAddress), RegData32);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (R_PCH_IO_APIC_DATA | IoApicAddress),
+ 1,
+ &RegData32
+ );
+
+ ///
+ /// Program this field to provide a unique bus:device:function number for the internal IOxAPIC
+ ///
+ if (IoApicConfig->BdfValid) {
+ RegData16 = ((UINT16) (IoApicConfig->BusNumber) << 8) & B_PCH_LPC_IOXAPIC_BUS;
+ RegData16 |= ((UINT16) (IoApicConfig->DeviceNumber) << 3) & B_PCH_LPC_IOXAPIC_DEVICE;
+ RegData16 |= (UINT16) (IoApicConfig->FunctionNumber) & B_PCH_LPC_IOXAPIC_FUNC;
+ MmioWrite16 ((UINTN) (PciD31F0RegBase + R_PCH_LPC_IOXAPIC), RegData16);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PciD31F0RegBase + R_PCH_LPC_IOXAPIC),
+ 1,
+ &RegData16
+ );
+ }
+ ///
+ /// Program this field accordingly if unique bus:device:function number is required for the
+ /// corresponding HPET
+ ///
+ HpetConfig = PchPlatformPolicy->HpetConfig;
+ if (HpetConfig->BdfValid) {
+ for (Index = 0; Index < PCH_HPET_BDF_MAX; Index++) {
+ RegData16 = ((UINT16) (HpetConfig->Hpet[Index].BusNumber) << 8) & B_PCH_LPC_HPET0_BUS;
+ RegData16 |= ((UINT16) (HpetConfig->Hpet[Index].DeviceNumber) << 3) & B_PCH_LPC_HPET0_DEVICE;
+ RegData16 |= (UINT16) (HpetConfig->Hpet[Index].FunctionNumber) & B_PCH_LPC_HPET0_FUNC;
+ MmioWrite16 ((UINTN) (PciD31F0RegBase + R_PCH_LPC_HPET0 + Index * 2), RegData16);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PciD31F0RegBase + R_PCH_LPC_HPET0 + Index * 2),
+ 1,
+ &RegData16
+ );
+ }
+ }
+
+ DEBUG ((EFI_D_INFO, "ConfigureIoApic() End\n"));
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchLan.c b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchLan.c
new file mode 100644
index 0000000..ab0c427
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchLan.c
@@ -0,0 +1,152 @@
+/** @file
+ Initializes PCH LAN Device
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "PchInit.h"
+
+/**
+ Enable GbE Controller
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+EnableGbEController (
+ DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ UINT32 RootComplexBar
+ )
+{
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, section 10.2.1
+ /// Done in PchInitPeimm.c PchGbeMandatedReset()
+ ///
+ return EFI_SUCCESS;
+}
+
+/**
+ Disable GbE Controller
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+DisableGbEController (
+ DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ UINT32 RootComplexBar
+ )
+{
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, section 10.2.2
+ /// Done in PchInitPeimm.c PchGbeMandatedReset()
+ ///
+ return EFI_SUCCESS;
+}
+
+/**
+ Initialize LAN device. Reference: PCH BIOS Spec Rev 0.5.0,
+ 10.2 Enabling / Disabling the Internal GbE Controller
+ ** NOTE:
+ - The platform reset mandated by GbE enabling / disabling is handled
+ in PchInit PEIM. Platform PEI code is responsible for calling PCH Init PPI
+ - BUC register setting is also done in the PCH Init PPI
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+ @param[in] RootComplexBar RootComplexBar address of this PCH device
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+ConfigureLan (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar
+ )
+{
+ UINT32 RegData32;
+ UINTN PciD25F0RegBase;
+ PCH_SERIES PchSeries;
+
+ DEBUG ((EFI_D_INFO, "ConfigureLan() Start\n"));
+ PchSeries = GetPchSeries();
+ ///
+ /// If SPI is used and in Descriptor mode, the PCIE Port X need to be disabled to use GbE
+ /// if not, the GbE should be disabled
+ ///
+ if (PchIsSpiDescriptorMode (RootComplexBar)) {
+ DEBUG ((EFI_D_INFO, "LAN can be enabled or disabled as SPI is in Descriptor Mode.\n"));
+
+ if (PchPlatformPolicy->DeviceEnabling->Lan == PCH_DEVICE_DISABLE) {
+ ///
+ /// Disable LAN
+ ///
+ DisableGbEController (PchPlatformPolicy, RootComplexBar);
+ } else {
+ ///
+ /// Enable LAN
+ ///
+ EnableGbEController (PchPlatformPolicy, RootComplexBar);
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.6 Section 10.7.1 LTR Programming
+ /// The maximum snoop/non-snoop platform latency values to 00000846h
+ /// in the GbE controller's PCI LTR capability register at D25:F0:Reg 0A8h
+ ///
+ if (PchPlatformPolicy->PwrOptConfig->PchPwrOptGbe == PCH_DEVICE_ENABLE) {
+ PciD25F0RegBase = MmPciAddress (
+ 0,
+ PCI_BUS_NUMBER_PCH_LAN,
+ PCI_DEVICE_NUMBER_PCH_LAN,
+ PCI_FUNCTION_NUMBER_PCH_LAN,
+ 0
+ );
+ RegData32 = 0x00000000;
+ if (PchSeries == PchH) {
+ RegData32 = 0x00000846;
+ }
+ if (PchSeries == PchLp) {
+ RegData32 = 0x00001003;
+ }
+ MmioWrite32 (PciD25F0RegBase + R_PCH_LAN_LTR_CAP, RegData32);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PciD25F0RegBase + R_PCH_LAN_LTR_CAP),
+ 1,
+ (VOID *) (UINTN) (PciD25F0RegBase + R_PCH_LAN_LTR_CAP)
+ );
+ }
+ }
+ } else {
+ ///
+ /// Non Descriptor mode: Disable LAN
+ ///
+ DEBUG ((EFI_D_ERROR, "LAN is disabled as SPI not in Descriptor Mode.\n"));
+ ///
+ /// Disable LAN
+ ///
+ DisableGbEController (PchPlatformPolicy, RootComplexBar);
+ }
+
+ DEBUG ((EFI_D_INFO, "ConfigureLan() End\n"));
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchMisc.c b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchMisc.c
new file mode 100644
index 0000000..ec38433
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchMisc.c
@@ -0,0 +1,395 @@
+/** @file
+ Miscellaneous PCH initialization tasks
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "PchInit.h"
+
+/**
+ Perform miscellany PCH initialization
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+ @param[in, out] FuncDisableReg The value of Function disable register
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+ConfigureMiscItems (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar,
+ IN OUT UINT32 *FuncDisableReg
+ )
+{
+ UINTN PciD31F0RegBase;
+ UINT8 RegData8;
+ UINT16 RegData16;
+ UINT16 LpcDeviceId;
+ UINTN RPBase;
+ UINT16 RpcConfig;
+
+ DEBUG ((EFI_D_INFO, "ConfigureMiscItems() Start\n"));
+
+ PciD31F0RegBase = MmPciAddress (0, PchPlatformPolicy->BusNumber, 31, 0, 0);
+ RegData8 = 0;
+ LpcDeviceId = MmioRead16 (PciD31F0RegBase + R_PCH_LPC_DEVICE_ID);
+
+ ///
+ /// Get PCIE Root Port Configuration
+ ///
+ RPBase = MmPciAddress (
+ 0,
+ PchPlatformPolicy->BusNumber,
+ PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS,
+ GetPchPcieRpfn( RootComplexBar, PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_1),
+ 0
+ );
+ RpcConfig = MmioRead16 (RPBase + R_PCH_PCIE_STRPFUSECFG);
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, 8.13 IOSF Port Configuration and Grant Count Programming
+ /// The following table shows the setting of IOSF fabric register (RCBA 0x103C [15:0]) based
+ /// on PCIe port configuration. BIOS should program the register based on the table below.
+ /// For Root Port 1 - 4:
+ /// (Program RCBA + 103Ch[7:3] according to B0:D28:F0 + FCh[15:14])
+ /// B0:D28:F0+FCh[15:14] RCBA+103Ch[1:0] RCBA+103Ch[3:2] RCBA+103Ch[5:4] RCBA+103Ch[7:6]
+ /// 00b 00b 00b 00b 00b
+ /// 01b 10b 00b 00b 00b
+ /// 10b 10b 00b 10b 00b
+ /// 11b 10b 00b 00b 00b
+ ///
+ switch (RpcConfig & B_PCH_PCIE_STRPFUSECFG_RPC) {
+ case V_PCH_PCIE_STRPFUSECFG_RPC_2_1_1:
+ RegData16 = 0x02;
+ break;
+
+ case V_PCH_PCIE_STRPFUSECFG_RPC_2_2:
+ RegData16 = 0x22;
+ break;
+
+ case V_PCH_PCIE_STRPFUSECFG_RPC_4:
+ RegData16 = 0x02;
+ break;
+
+ default:
+ RegData16 = 0x0;
+ break;
+ }
+
+ if (GetPchSeries() == PchH) {
+ ///
+ /// Get PCIE Root Port Configuration
+ ///
+ RPBase = MmPciAddress (
+ 0,
+ PchPlatformPolicy->BusNumber,
+ PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS,
+ PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_5,
+ 0
+ );
+ RpcConfig = MmioRead16 (RPBase + R_PCH_PCIE_STRPFUSECFG);
+ ///
+ /// For Root Port 5 - 8:
+ /// (Program RCBA + 103Ch[7:3] according to B0:D28:F4 + FCh[15:14])
+ /// B0:D28:F4+FCh[15:14] RCBA+103Ch[9:8] RCBA+103Ch[11:10] RCBA+103Ch[13:12] RCBA+103Ch[15:14]
+ /// 00b 00b 00b 00b 00b
+ /// 01b 10b 00b 00b 00b
+ /// 10b 10b 00b 10b 00b
+ /// 11b 10b 00b 00b 00b
+ ///
+ switch (RpcConfig & B_PCH_PCIE_STRPFUSECFG_RPC) {
+ case V_PCH_PCIE_STRPFUSECFG_RPC_2_1_1:
+ RegData16 |= 0x02 << 8;
+ break;
+
+ case V_PCH_PCIE_STRPFUSECFG_RPC_2_2:
+ RegData16 |= 0x22 << 8;
+ break;
+
+ case V_PCH_PCIE_STRPFUSECFG_RPC_4:
+ RegData16 |= 0x02 << 8;
+ break;
+
+ default:
+ RegData16 |= 0x0 << 8;
+ break;
+ }
+ }
+
+ MmioWrite16 (RootComplexBar + 0x103C, RegData16);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (RootComplexBar + 0x103C),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + 0x103C)
+ );
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 6.2 Serial IRQs
+ /// The only System BIOS requirement to use IRQs as a serial IRQ is to enable the function in D31:F0:Reg 64h[7] and
+ /// select continuous or quiet mode, D31:F0:Reg 64h[6].
+ /// PCH requires that the System BIOS first set the SERIRQ logic to continuous mode operation for at least one frame
+ /// before switching it into quiet mode operation. This operation should be performed during the normal boot sequence
+ /// as well as a resume from STR (S3).
+ ///
+ RegData8 = MmioRead8 (PciD31F0RegBase + R_PCH_LPC_SERIRQ_CNT) &
+ (UINT8) ~(B_PCH_LPC_SERIRQ_CNT_SIRQEN | B_PCH_LPC_SERIRQ_CNT_SFPW);
+
+ if (PchPlatformPolicy->SerialIrqConfig->SirqEnable == TRUE) {
+ switch (PchPlatformPolicy->SerialIrqConfig->StartFramePulse) {
+ case PchSfpw8Clk:
+ RegData8 |= V_PCH_LPC_SERIRQ_CNT_SFPW_8CLK;
+ break;
+
+ case PchSfpw6Clk:
+ RegData8 |= V_PCH_LPC_SERIRQ_CNT_SFPW_6CLK;
+ break;
+
+ case PchSfpw4Clk:
+ default:
+ RegData8 |= V_PCH_LPC_SERIRQ_CNT_SFPW_4CLK;
+ break;
+ }
+ ///
+ /// Set the SERIRQ logic to continuous mode
+ ///
+ RegData8 |= (UINT8) (B_PCH_LPC_SERIRQ_CNT_SIRQEN | B_PCH_LPC_SERIRQ_CNT_SIRQMD);
+ }
+
+ MmioWrite8 (PciD31F0RegBase + R_PCH_LPC_SERIRQ_CNT, RegData8);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (PciD31F0RegBase + R_PCH_LPC_SERIRQ_CNT),
+ 1,
+ (VOID *) (UINTN) (PciD31F0RegBase + R_PCH_LPC_SERIRQ_CNT)
+ );
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 19.8.1 RTC Resets
+ /// The PCH will set the RTC_PWR_STS bit (D31:F0:Reg A4h[2]) when the RTCRST# pin goes low.
+ /// The System BIOS shouldn't rely on the RTC RAM contents when the RTC_PWR_STS bit is set.
+ /// BIOS should clear this bit by writing a 0 to this bit position.
+ /// This bit isn't cleared by any reset function.
+ ///
+ MmioAnd8 ((UINTN) (PciD31F0RegBase + 0xA4), (UINT8) (~(BIT2)));
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 5.11 Intel PCH Boot Checklist
+ /// Step 8.1
+ /// Always set RCBA + Offset 3418h[0] = 1b
+ ///
+ *FuncDisableReg |= B_PCH_RCRB_FUNC_DIS_FUNCTION_0;
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 19.1 Handling Status Registers
+ /// System BIOS must set 1b to clear the following registers during power-on
+ /// and resuming from Sx sleep state.
+ /// - RCBA + Offset 3310h[0] = 1b
+ /// - RCBA + Offset 3310h[4] = 1b, needs to be done as early as possible during PEI
+ /// Done in InstallPchInitPpi ()
+ /// - RCBA + Offset 3310h[5] = 1b
+ ///
+ MmioOr32 (
+ (UINTN) (RootComplexBar + R_PCH_RCRB_PRSTS),
+ (UINT32) (B_PCH_RCRB_PRSTS_ME_WAKE_STS | B_PCH_RCRB_PRSTS_WOL_OVR_WK_STS)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_PRSTS),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_RCRB_PRSTS)
+ );
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 4.7
+ /// Enabling SLP_S3# and SLP_S4# Stretch
+ /// B0:D31:F0 Reg A4h[12:10] = 110b
+ /// B0:D31:F0 Reg A4h[5:3] = 001b
+ ///
+ RegData16 = MmioRead16 (PciD31F0RegBase + R_PCH_LPC_GEN_PMCON_3) &
+ (UINT16) (~(B_PCH_LPC_GEN_PMCON_SLP_S3_MAW |
+ B_PCH_LPC_GEN_PMCON_SLP_S4_MAW));
+
+ switch (PchPlatformPolicy->MiscPmConfig->PchSlpS3MinAssert) {
+ case PchSlpS360us:
+ RegData16 |= V_PCH_LPC_GEN_PMCON_SLP_S3_MAW_60US;
+ break;
+
+ case PchSlpS31ms:
+ RegData16 |= V_PCH_LPC_GEN_PMCON_SLP_S3_MAW_1MS;
+ break;
+
+ case PchSlpS350ms:
+ default:
+ RegData16 |= V_PCH_LPC_GEN_PMCON_SLP_S3_MAW_50MS;
+ break;
+
+ case PchSlpS32s:
+ RegData16 |= V_PCH_LPC_GEN_PMCON_SLP_S3_MAW_2S;
+ break;
+ }
+
+ switch (PchPlatformPolicy->MiscPmConfig->PchSlpS4MinAssert) {
+ case PchSlpS4PchTime:
+ RegData16 &= (UINT16) (~B_PCH_LPC_GEN_PMCON_SLP_S4_ASE);
+ break;
+
+ case PchSlpS41s:
+ RegData16 |= V_PCH_LPC_GEN_PMCON_SLP_S4_MAW_1S | B_PCH_LPC_GEN_PMCON_SLP_S4_ASE;
+ break;
+
+ case PchSlpS42s:
+ RegData16 |= V_PCH_LPC_GEN_PMCON_SLP_S4_MAW_2S | B_PCH_LPC_GEN_PMCON_SLP_S4_ASE;
+ break;
+
+ case PchSlpS43s:
+ RegData16 |= V_PCH_LPC_GEN_PMCON_SLP_S4_MAW_3S | B_PCH_LPC_GEN_PMCON_SLP_S4_ASE;
+ break;
+
+ case PchSlpS44s:
+ default:
+ RegData16 |= V_PCH_LPC_GEN_PMCON_SLP_S4_MAW_4S | B_PCH_LPC_GEN_PMCON_SLP_S4_ASE;
+ break;
+ }
+
+ if (PchPlatformPolicy->MiscPmConfig->SlpStrchSusUp == PCH_DEVICE_DISABLE) {
+ RegData16 |= B_PCH_LPC_GEN_PMCON_DISABLE_SX_STRETCH;
+ } else {
+ RegData16 &= ~B_PCH_LPC_GEN_PMCON_DISABLE_SX_STRETCH;
+ }
+
+ MmioWrite16 (PciD31F0RegBase + R_PCH_LPC_GEN_PMCON_3, RegData16);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PciD31F0RegBase + R_PCH_LPC_GEN_PMCON_3),
+ 1,
+ (VOID *) (UINTN) (PciD31F0RegBase + R_PCH_LPC_GEN_PMCON_3)
+ );
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 6.2 Serial IRQs
+ /// The only System BIOS requirement to use IRQs as a serial IRQ is to enable the function
+ /// in D31:F0:Reg 64h[7] and select continuous or quiet mode, D31:F0:Reg 64h[6].
+ ///
+ if ((PchPlatformPolicy->SerialIrqConfig->SirqEnable == TRUE) &&
+ (PchPlatformPolicy->SerialIrqConfig->SirqMode == PchQuietMode)) {
+ MmioAnd8 (PciD31F0RegBase + R_PCH_LPC_SERIRQ_CNT, (UINT8)~B_PCH_LPC_SERIRQ_CNT_SIRQMD);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (PciD31F0RegBase + R_PCH_LPC_SERIRQ_CNT),
+ 1,
+ (VOID *) (UINTN) (PciD31F0RegBase + R_PCH_LPC_SERIRQ_CNT)
+ );
+ }
+
+ ///
+ /// For LPT-LP, if Direct Connect Interface (DCI) is enabled, set RCBA + 3F02h[0] = 1,
+ /// else, set RCBA + 3F02h[0] = 0.
+ /// When enabling DCI (through the enable bit), it's able to access JTAG and Run Control features
+ /// in a closed chassis situation, by using the USB3 port on a Shark Bay ULT platform.
+ ///
+ if ((PchPlatformPolicy->Revision >= DXE_PCH_PLATFORM_POLICY_PROTOCOL_REVISION_6) &&
+ (GetPchSeries() == PchLp)) {
+ RegData16 = MmioRead16 (RootComplexBar + 0x3F02) & (UINT16)~BIT0;
+ if (PchPlatformPolicy->MiscConfig->DciEn) {
+ RegData16 |= BIT0;
+ }
+ MmioWrite16 (RootComplexBar + 0x3F02, RegData16);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (RootComplexBar + 0x3F02),
+ 1,
+ &RegData16
+ );
+ }
+
+ DEBUG ((EFI_D_INFO, "ConfigureMiscItems() End\n"));
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Configure PCH Display
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+ @param[in] RootComplexBar RootComplexBar address of this PCH device
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+ConfigureDisplay (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar
+ )
+{
+ UINT32 Data32And;
+ UINT32 Data32Or;
+
+ DEBUG ((EFI_D_INFO, "ConfigureDisplay() Start\n"));
+
+ if (PchPlatformPolicy->DeviceEnabling->Display == PCH_DEVICE_DISABLE) {
+ ///
+ /// Disable PCH Display Port
+ /// Step 1
+ /// Set RCBA + 3424h = 0h
+ ///
+ MmioWrite16 ((UINTN) (RootComplexBar + R_PCH_RCRB_DISPBDF), (UINT16) 0x0);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_DISPBDF),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_RCRB_DISPBDF)
+ );
+ ///
+ /// Step 2
+ /// Set RCBA + 3428h[0] = 0b
+ ///
+ Data32Or = 0;
+ Data32And = (UINT32) ~(B_PCH_RCRB_FD2_DBDFEN);
+ MmioAnd32 ((UINTN) (RootComplexBar + R_PCH_RCRB_FD2), Data32And);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_FD2),
+ &Data32Or, // Data to be ORed
+ &Data32And // Data to be ANDed
+ );
+
+ Data32Or = 0;
+ Data32And = (UINT32) (~BIT0);
+ MmioAnd32 ((UINTN) (RootComplexBar + R_PCH_RCRB_FD2), Data32And);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_FD2),
+ &Data32Or, // Data to be ORed
+ &Data32And // Data to be ANDed
+ );
+ }
+
+ DEBUG ((EFI_D_INFO, "ConfigureDisplay() End\n"));
+
+ return EFI_SUCCESS;
+} \ No newline at end of file
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchPm.c b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchPm.c
new file mode 100644
index 0000000..b2f53d7
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchPm.c
@@ -0,0 +1,3389 @@
+/** @file
+ Initializes PCH power management features.
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "PchInit.h"
+
+/**
+ Set an PCH IOBP programming S3 dispatch item, this function may assert if any error happend
+
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+ @param[in] Address Address of the IOBP register block
+ @param[in] AndMask Mask to AND with the register
+ @param[in] OrMask Mask to OR with the register
+
+ @retval EFI_SUCCESS The function completed successfully
+ @retval EFI_OUT_OF_RESOURCES Out of resources
+ @retval EFI_INVALID_PARAMETER Invalid parameter
+ @retval EFI_NOT_FOUND Protocol interface not found
+**/
+EFI_STATUS
+SetProgramIobpS3Item (
+ IN UINT32 RootComplexBar,
+ IN UINT32 Address,
+ IN UINT32 AndMask,
+ IN UINT32 OrMask
+ )
+{
+ EFI_STATUS Status;
+#ifdef EFI_S3_RESUME
+ STATIC EFI_PCH_S3_SUPPORT_PROTOCOL *PchS3Support;
+ STATIC EFI_PCH_S3_PARAMETER_PROG_IOBP S3ParameterProgramIobp;
+ STATIC EFI_PCH_S3_DISPATCH_ITEM S3DispatchItem = {
+ PchS3ItemTypeProgramIobp,
+ &S3ParameterProgramIobp
+ };
+ EFI_PHYSICAL_ADDRESS S3DispatchEntryPoint;
+
+ if (!PchS3Support) {
+ ///
+ /// Get the PCH S3 Support Protocol
+ ///
+ Status = gBS->LocateProtocol (
+ &gEfiPchS3SupportProtocolGuid,
+ NULL,
+ (VOID **) &PchS3Support
+ );
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ }
+
+ S3ParameterProgramIobp.RootComplexBar = RootComplexBar;
+ S3ParameterProgramIobp.Address = Address;
+ S3ParameterProgramIobp.AndMask = AndMask;
+ S3ParameterProgramIobp.OrMask = OrMask;
+ Status = PchS3Support->SetDispatchItem (
+ PchS3Support,
+ &S3DispatchItem,
+ &S3DispatchEntryPoint
+ );
+ ASSERT_EFI_ERROR (Status);
+ ///
+ /// Save the script dispatch item in the Boot Script
+ ///
+ SCRIPT_DISPATCH (EFI_ACPI_S3_RESUME_SCRIPT_TABLE, S3DispatchEntryPoint);
+#else
+ Status = EFI_SUCCESS;
+#endif
+ return Status;
+}
+
+/**
+ Locking Thermal Reporting Settings
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+ @param[in] GpioBase GPIO base address of this PCH device
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+ThermalLockDown (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ UINT16 GpioBase
+ )
+{
+ UINTN PciD31F6RegBase;
+ UINTN PciD31F2RegBase;
+ UINT32 ThermalBaseB;
+ UINT32 ThermalBase;
+ EFI_PHYSICAL_ADDRESS MemBaseAddress;
+ EFI_STATUS Status;
+ UINT8 Index;
+ UINT8 RegData8;
+ UINT16 RegData16;
+ UINT32 RegData32;
+ UINT32 RootComplexBar;
+ UINT32 Data32And;
+ UINT32 Data32Or = 0;
+ UINT16 Data16And;
+ UINT16 Data16Or;
+ UINT32 PchTTLevels = 0;
+ BOOLEAN PchHotEnable;
+ PCH_SERIES PchSeries;
+ EFI_CPUID_REGISTER Cpuid;
+ MSR_REGISTER TempMsr;
+ UINT32 temperature;
+ UINT8 MaxSataPortNum;
+
+ DEBUG ((EFI_D_INFO, "ThermalLockDown() Start\n"));
+
+ PchSeries = GetPchSeries();
+ ///
+ /// Check if TBARB is already initialized by platform code
+ ///
+ PciD31F6RegBase = MmPciAddress (
+ 0,
+ PchPlatformPolicy->BusNumber,
+ PCI_DEVICE_NUMBER_PCH_THERMAL,
+ PCI_FUNCTION_NUMBER_PCH_THERMAL,
+ 0
+ );
+ PciD31F2RegBase = MmPciAddress (
+ 0,
+ PchPlatformPolicy->BusNumber,
+ PCI_DEVICE_NUMBER_PCH_SATA,
+ PCI_FUNCTION_NUMBER_PCH_SATA,
+ 0
+ );
+ RootComplexBar = PCH_RCRB_BASE;
+ ThermalBaseB = MmioRead32 (PciD31F6RegBase + R_PCH_THERMAL_TBARB);
+ MemBaseAddress = 0x0ffffffff;
+
+ if (ThermalBaseB & B_PCH_THERMAL_SPTYPEN) {
+ ///
+ /// Check if TBARB is already initialized and if so use it.
+ ///
+ ThermalBaseB &= B_PCH_THERMAL_TBARB_MASK;
+ } else {
+#ifndef AMI_OVERRIDE_FOR_PCH
+ Status = gDS->AllocateMemorySpace (
+ EfiGcdAllocateMaxAddressSearchTopDown,
+ EfiGcdMemoryTypeMemoryMappedIo,
+ N_PCH_THREMAL_TBARB_ALIGNMENT,
+ V_PCH_THERMAL_TBARB_SIZE,
+ &MemBaseAddress,
+ mImageHandle,
+ NULL
+ );
+#else
+ Status = gDS->AllocateMemorySpace (
+ EfiGcdAllocateMaxAddressSearchBottomUp,
+ EfiGcdMemoryTypeMemoryMappedIo,
+ N_PCH_THREMAL_TBARB_ALIGNMENT,
+ V_PCH_THERMAL_TBARB_SIZE,
+ &MemBaseAddress,
+ mImageHandle,
+ NULL
+ );
+#endif
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ ThermalBaseB = (UINT32) MemBaseAddress;
+ MmioWrite32 (PciD31F6RegBase + R_PCH_THERMAL_TBARB, ThermalBaseB);
+ MmioWrite32 (PciD31F6RegBase + R_PCH_THERMAL_TBARBH, 0);
+ MmioOr32 (PciD31F6RegBase + R_PCH_THERMAL_TBARB, (UINT32) B_PCH_THERMAL_SPTYPEN);
+
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PciD31F6RegBase + R_PCH_THERMAL_TBARB),
+ 1,
+ (VOID *) (UINTN) (PciD31F6RegBase + R_PCH_THERMAL_TBARB)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PciD31F6RegBase + R_PCH_THERMAL_TBARBH),
+ 1,
+ (VOID *) (UINTN) (PciD31F6RegBase + R_PCH_THERMAL_TBARBH)
+ );
+ }
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, 17.3.1 Initializing Lynx Point Thermal Sensors
+ /// Step 1
+ /// TSC must then be written to 0x81 to enable the power down and lock the register.
+ ///
+ RegData8 = MmioRead8 (ThermalBaseB + R_PCH_TBARB_TSC);
+ ///
+ /// Enable Catastrophic Power Down
+ ///
+ RegData8 |= (UINT8) B_PCH_TBARB_TSC_CPDE;
+ ///
+ /// Step 8.1
+ /// It is recommended that TSC [7] set to 1 to lock the CAT Trip behavior.
+ ///
+ if (PchPlatformPolicy->ThermalConfig->ThermalAlertEnable.TscLock == PCH_DEVICE_ENABLE) {
+ RegData8 |= (UINT8) B_PCH_TBARB_TSC_PLD;
+ }
+
+ MmioWrite8 (ThermalBaseB + R_PCH_TBARB_TSC, RegData8);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (ThermalBaseB + R_PCH_TBARB_TSC),
+ 1,
+ (VOID *) (UINTN) (ThermalBaseB + R_PCH_TBARB_TSC)
+ );
+ ///
+ /// Step 8.2
+ /// TSMIC [7] locks SMI reporting of thermal events
+ ///
+ if (PchPlatformPolicy->ThermalConfig->ThermalAlertEnable.TsmicLock == PCH_DEVICE_ENABLE) {
+ MmioWrite8 (ThermalBaseB + R_PCH_TBARB_TSMIC, 0x80);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (ThermalBaseB + R_PCH_TBARB_TSMIC),
+ 1,
+ (VOID *) (UINTN) (ThermalBaseB + R_PCH_TBARB_TSMIC)
+ );
+ }
+
+ ///
+ /// Step 5
+ /// If the PCH_Hot pin reporting is supported, then write the temperature value and set the enable in PHL.
+ ///
+ PchHotEnable = FALSE;
+#ifdef TRAD_FLAG
+ if (PchSeries == PchH) {
+ ///
+ /// Note: For PCHHOT# support, we need to make sure if GPIO74 is set to native mode and PCHSTRP9[22] is
+ /// set to 1.
+ /// Check if GPIO74 is set to native mode.
+ ///
+ RegData8 = (UINT8)((IoRead32 ((UINTN) (GpioBase + R_PCH_GPIO_USE_SEL3)) & BIT10) >> 10);
+ }
+#endif // TRAD_FLAG
+
+#ifdef ULT_FLAG
+ if (PchSeries == PchLp) {
+ ///
+ /// Note: For PCHHOT# support, we need to make sure if GPIO73 is set to native mode and PCHSTRP9[22] is
+ /// set to 1.
+ /// Check if GPIO73 is set to native mode.
+ ///
+ RegData8 = (UINT8)(IoRead32 ((UINTN) (GpioBase + R_PCH_GP_73_CONFIG0)) & B_PCH_GPIO_OWN0_GPIO_USE_SEL);
+ }
+#endif // ULT_FLAG
+
+ if(RegData8 == 0x00) {
+ ///
+ /// Check if PCHSTRP9[22] is set to 1 (PCHHOT# is the native functionality of GPIO74)
+ ///
+ if ((MmioRead16 (RootComplexBar + R_PCH_SPI_HSFS) & B_PCH_SPI_HSFS_FDV) == B_PCH_SPI_HSFS_FDV) {
+ MmioAnd32 ((RootComplexBar + R_PCH_SPI_FDOC), (UINT32) (~(B_PCH_SPI_FDOC_FDSS_MASK | B_PCH_SPI_FDOC_FDSI_MASK)));
+ MmioOr32 ((RootComplexBar + R_PCH_SPI_FDOC), (UINT32) (V_PCH_SPI_FDOC_FDSS_PCHS | R_PCH_SPI_STRP9));
+ if (MmioRead32 (RootComplexBar + R_PCH_SPI_FDOD) & B_PCH_SPI_STRP9_HOT_SML1_SEL) {
+ PchHotEnable = TRUE;
+ }
+ }
+ }
+
+ ///
+ /// The value in PHL register is valid only if it is between 00h and 1FFh.
+ ///
+ if ((PchHotEnable == TRUE) && (PchPlatformPolicy->ThermalConfig->PchHotLevel < 0x0200)) {
+ ///
+ /// Program PHL register according to PchHotLevel setting.
+ ///
+ RegData16 = (PchPlatformPolicy->ThermalConfig->PchHotLevel | B_PCH_TBARB_PHLE);
+ MmioWrite16 (ThermalBaseB + R_PCH_TBARB_PHL, RegData16);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (ThermalBaseB + R_PCH_TBARB_PHL),
+ 1,
+ &RegData16
+ );
+ }
+ ///
+ /// Step 8.3
+ /// PHLC [0] locks the PHL and PHLC registers for PCH_Hot#
+ ///
+ if (PchPlatformPolicy->ThermalConfig->ThermalAlertEnable.PhlcLock == PCH_DEVICE_ENABLE) {
+ MmioWrite8 (ThermalBaseB + R_PCH_TBARB_PHLC, 0x01);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (ThermalBaseB + R_PCH_TBARB_PHLC),
+ 1,
+ (VOID *) (UINTN) (ThermalBaseB + R_PCH_TBARB_PHLC)
+ );
+ }
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 17.5 Thermal Throttling
+ /// Step 1
+ /// Additional programming to initialize Thermal Throttle device
+ /// For LPT-H,
+ /// a. Program ThermalBAR + 0xC0 to 8000390Bh
+ /// b. Program ThermalBAR + 0xC4 to C11F0201h
+ /// c. Program ThermalBAR + 0xC8 to 05800000h
+ /// d. Program ThermalBAR + 0xCC to 0000C000h
+ /// e. Program ThermalBAR + 0xD0 to 00000320h
+ /// f. Program ThermalBAR + 0xE0 to 80001E4Fh
+ /// g. Program ThermalBAR + 0xF0 to 00000003h
+ /// For LPT-LP,
+ /// a. Program ThermalBar + 0xC0 to 8000390Bh
+ /// b. Program ThermalBar + 0xC4 to C11F0401h
+ /// c. Program ThermalBAR + 0xC8 to 05800000h
+ /// d. Program ThermalBar + 0xCC to 0000C000h
+ /// e. Program ThermalBar + 0xD0 to 00000320h
+ /// f. Program ThermalBar + 0xE0 to 80001EDCh
+ /// g. Program ThermalBar + 0xF0 to 00000003h
+ ///
+
+ if (PchSeries == PchH) {
+ MmioWrite32 (ThermalBaseB + 0xC4, 0xC11F0201);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (ThermalBaseB + 0xC4),
+ 1,
+ (VOID *) (UINTN) (ThermalBaseB + 0xC4)
+ );
+
+ MmioWrite32 (ThermalBaseB + 0xE0, 0x80001E4F);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (ThermalBaseB + 0xE0),
+ 1,
+ (VOID *) (UINTN) (ThermalBaseB + 0xE0)
+ );
+ }
+
+ if (PchSeries == PchLp) {
+ MmioWrite32 (ThermalBaseB + 0xC4, 0xC11F0401);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (ThermalBaseB + 0xC4),
+ 1,
+ (VOID *) (UINTN) (ThermalBaseB + 0xC4)
+ );
+
+ MmioWrite32 (ThermalBaseB + 0xE0, 0x80001EDC);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (ThermalBaseB + 0xE0),
+ 1,
+ (VOID *) (UINTN) (ThermalBaseB + 0xE0)
+ );
+ }
+
+ MmioWrite32 (ThermalBaseB + 0xC0, 0x8000390B);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (ThermalBaseB + 0xC0),
+ 1,
+ (VOID *) (UINTN) (ThermalBaseB + 0xC0)
+ );
+
+ MmioWrite32 (ThermalBaseB + 0xC8, 0x05800000);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (ThermalBaseB + 0xC8),
+ 1,
+ (VOID *) (UINTN) (ThermalBaseB + 0xC8)
+ );
+
+ MmioWrite32 (ThermalBaseB + 0xCC, 0x0000C000);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (ThermalBaseB + 0xCC),
+ 1,
+ (VOID *) (UINTN) (ThermalBaseB + 0xCC)
+ );
+
+ MmioWrite32 (ThermalBaseB + 0xD0, 0x00000320);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (ThermalBaseB + 0xD0),
+ 1,
+ (VOID *) (UINTN) (ThermalBaseB + 0xD0)
+ );
+
+ MmioWrite32 (ThermalBaseB + 0xF0, 0x00000003);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (ThermalBaseB + 0xF0),
+ 1,
+ (VOID *) (UINTN) (ThermalBaseB + 0xF0)
+ );
+ ///
+ /// HSW BWG 15.8 : Processor PCH-LP cross throttling
+ ///
+ if (PchSeries == PchLp){
+ AsmCpuid (CPUID_VERSION_INFO, &Cpuid.RegEax, &Cpuid.RegEbx, &Cpuid.RegEcx, &Cpuid.RegEdx);
+ if (((Cpuid.RegEax & CPUID_FULL_FAMILY_MODEL) == CPUID_FULL_FAMILY_MODEL_HASWELL_ULT) &&
+ ((PchPlatformPolicy->ThermalConfig->ThermalThrottling.TTLevels.PchCrossThrottling == PCH_DEVICE_ENABLE) ||
+ (PchPlatformPolicy->ThermalConfig->ThermalThrottling.TTLevels.SuggestedSetting == PCH_DEVICE_ENABLE))) {
+ //
+ // Read MSR 0x1A2 TEMPERATURE_TARGET
+ //
+ TempMsr.Qword = AsmReadMsr64 (MSR_TEMPERATURE_TARGET);
+ ///
+ /// Tcc activation offset in temperature target MSR changes from 4 bits [27:24] to 6 bits [29:24] on ULT C step onwards
+ /// since Tcc will never be more than 205C, thus the calculation for PHL will never overflow
+ ///
+ if ((Cpuid.RegEax & CPUID_FULL_STEPPING) >= EnumHswUltC0) {
+ temperature = (TempMsr.Bytes.ThirdByte - (TempMsr.Bytes.FouthByte & 0x3F));
+ } else {
+ temperature = (TempMsr.Bytes.ThirdByte - (TempMsr.Bytes.FouthByte & 0xF));
+ }
+
+ if (PchPlatformPolicy->ThermalConfig->ThermalThrottling.TTLevels.SuggestedSetting == PCH_DEVICE_ENABLE) {
+ ///
+ /// PCH T0/T1/T2 Level (MMIO TBARB+40h) :
+ /// T0L = (((MSR TEMPERATURE_TARGET[23:16] - TEMPERATURE_TARGET) + 50) * 2)
+ /// T1L = T0L + 5C
+ /// T2L = T1L + 5C
+ ///
+ PchTTLevels = (UINT32)((( temperature + 10 + 50) * 2) << 20) |
+ (UINT32)(((temperature + 5 + 50) * 2) << 10) |
+ (UINT32)((temperature + 50) * 2);
+ Data32Or = BIT31 | BIT29;
+ } else {
+ PchTTLevels = (UINT32) (((PchPlatformPolicy->ThermalConfig->ThermalThrottling.TTLevels.T2Level + 10 + 50) * 2) << 20) |
+ (UINT32) (((PchPlatformPolicy->ThermalConfig->ThermalThrottling.TTLevels.T1Level + 5 + 50) * 2) << 10) |
+ (UINT32) ((PchPlatformPolicy->ThermalConfig->ThermalThrottling.TTLevels.T0Level + 50) * 2);
+ Data32Or = (UINT32) (PchPlatformPolicy->ThermalConfig->ThermalThrottling.TTLevels.TTLock << 31) |
+ (UINT32) (PchPlatformPolicy->ThermalConfig->ThermalThrottling.TTLevels.TTState13Enable << 30) |
+ (UINT32) (PchPlatformPolicy->ThermalConfig->ThermalThrottling.TTLevels.TTEnable << 29);
+ }
+ }
+ } else if (PchSeries == PchH) {
+ if (PchPlatformPolicy->ThermalConfig->ThermalThrottling.TTLevels.SuggestedSetting == PCH_DEVICE_ENABLE) {
+ ///
+ /// Set TBARB + 40h = 0B485093Ch
+ /// Program TBARB + 40h[31:28] in separate write
+ ///
+ PchTTLevels = 0xB485093C;
+ Data32Or = BIT31 | BIT29;
+ }else {
+ ///
+ /// PCH BIOS Spec Rev 0.5.5, Section 17.3.1 Initializing Lynx Point Thermal Sensors
+ /// Trip Point Temperature = (Trip Point Register [8:0]) / 2 - 50 centigrade degree
+ /// If Trip Point Temperature <= T0Level, the system will be in T0 state.
+ /// If T1Level >= Trip Point Temperature > T0Level, the system will be in T1 state.
+ /// If T2Level >= Trip Point Temperature > T1Level, the system will be in T2 state.
+ /// If Trip Point Temperature > T2Level, the system will be in T3 state.
+ ///
+ PchTTLevels = (UINT32) (((PchPlatformPolicy->ThermalConfig->ThermalThrottling.TTLevels.T2Level + 50) * 2) << 20) |
+ (UINT32) (((PchPlatformPolicy->ThermalConfig->ThermalThrottling.TTLevels.T1Level + 50) * 2) << 10) |
+ (UINT32) ((PchPlatformPolicy->ThermalConfig->ThermalThrottling.TTLevels.T0Level + 50) * 2);
+ Data32Or = (UINT32) (PchPlatformPolicy->ThermalConfig->ThermalThrottling.TTLevels.TTLock << 31) |
+ (UINT32) (PchPlatformPolicy->ThermalConfig->ThermalThrottling.TTLevels.TTState13Enable << 30) |
+ (UINT32) (PchPlatformPolicy->ThermalConfig->ThermalThrottling.TTLevels.TTEnable << 29);
+ }
+ }
+
+ ///
+ /// Program TBARB + 40h[27:0]
+ ///
+ MmioWrite32 (ThermalBaseB + R_PCH_TBARB_TL, PchTTLevels);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (ThermalBaseB + R_PCH_TBARB_TL),
+ 1,
+ (VOID *) (UINTN) (ThermalBaseB + R_PCH_TBARB_TL)
+ );
+ ///
+ /// Program TBARB + 40h[31:28]
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, 17.3.1 Initializing Lynx Point Thermal Sensors
+ /// Step 8.4
+ /// TL [31] locks the thermal throttling registers
+ ///
+ MmioOr32 (ThermalBaseB + R_PCH_TBARB_TL, Data32Or);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (ThermalBaseB + R_PCH_TBARB_TL),
+ 1,
+ (VOID *) (UINTN) (ThermalBaseB + R_PCH_TBARB_TL)
+ );
+
+ if (PchSeries == PchLp) {
+ ///
+ /// Processor PCH-LP cross throttling - Set RCBA MMIO offset 0x33C4[26:24] = 101b
+ ///
+ AsmCpuid (CPUID_VERSION_INFO, &Cpuid.RegEax, &Cpuid.RegEbx, &Cpuid.RegEcx, &Cpuid.RegEdx);
+ if (((Cpuid.RegEax & CPUID_FULL_FAMILY_MODEL) == CPUID_FULL_FAMILY_MODEL_HASWELL_ULT) &&
+ ((PchPlatformPolicy->ThermalConfig->ThermalThrottling.TTLevels.PchCrossThrottling == PCH_DEVICE_ENABLE) ||
+ (PchPlatformPolicy->ThermalConfig->ThermalThrottling.TTLevels.SuggestedSetting == PCH_DEVICE_ENABLE))) {
+ Data32And = (UINT32)~(BIT26 | BIT25 | BIT24);
+ Data32Or = BIT26 | BIT24;
+ MmioAndThenOr32 ((UINTN) (RootComplexBar + PMSYNC_TPR_CONFIG), Data32And, Data32Or);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + PMSYNC_TPR_CONFIG),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + PMSYNC_TPR_CONFIG)
+ );
+ }
+ ///
+ /// Lock PMSYNC_TPR_CFG and PMSYNC_TPR_CFG2
+ /// Set RCBA + 0x33C4[31] = 1b.
+ ///
+ MmioOr32 (RootComplexBar + PMSYNC_TPR_CONFIG,B_PMSYNC_TPR_CONFIG_LOCK);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + PMSYNC_TPR_CONFIG),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + PMSYNC_TPR_CONFIG)
+ );
+ }
+
+ if (PchSeries == PchH) {
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 17.5 Thermal Throttling
+ /// Step 3
+ /// Set Chipset Initialization Register 30 (RCBA + 2238h) = 00000941h
+ ///
+ if (PchPlatformPolicy->ThermalConfig->ThermalThrottling.DmiHaAWC.SuggestedSetting == PCH_DEVICE_ENABLE) {
+ RegData32 = 0x00000941;
+ } else {
+ RegData32 = (UINT32) (PchPlatformPolicy->ThermalConfig->ThermalThrottling.DmiHaAWC.TS3TW << 10) |
+ (UINT32) (PchPlatformPolicy->ThermalConfig->ThermalThrottling.DmiHaAWC.TS2TW << 8) |
+ (UINT32) (PchPlatformPolicy->ThermalConfig->ThermalThrottling.DmiHaAWC.TS1TW << 6) |
+ (UINT32) (PchPlatformPolicy->ThermalConfig->ThermalThrottling.DmiHaAWC.TS0TW << 4) |
+ (UINT32) PchPlatformPolicy->ThermalConfig->ThermalThrottling.DmiHaAWC.DmiTsawEn;
+ }
+ ///
+ /// If DMI IOT is enabled, set chipset Initialization Register 30 (RCBA + 2238h) = 00000551h
+ ///
+ if (PchPlatformPolicy->DmiConfig->DmiIot == PCH_DEVICE_ENABLE) {
+ RegData32 = 0x00000551;
+ }
+ MmioWrite32 ((UINTN) (RootComplexBar + R_PCH_RCRB_CIR2238), RegData32);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR2238),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_RCRB_CIR2238)
+ );
+ }
+
+ ///
+ /// Step 4
+ /// Program SATA Indexed Register Index and Data:
+ /// a. If port 0 is empty, set D31:F2:A0h=A0h and D31:F2:A4h[15:00] = 0000h
+ /// else if Port 0 has a HDD, set D31:F2:A4h[15:00] = 0039h
+ /// else if Port 0 has a SSD, set D31:F2:A4h[15:00] = 0F39h
+ /// b. If port 1 is empty, set D31:F2:A0h=A0h and D31:F2:A4h[31:16] = 0000h
+ /// else if Port 1 has a HDD, set D31:F2:A4h[31:16] = 0039h
+ /// else if Port 1 has a SSD, set D31:F2:A4h[31:16] = 0F39h
+ /// c. If port 2 is empty, set D31:F2:A0h=A4h and D31:F2:A4h[15:00] = 0000h
+ /// else if Port 2 has a HDD, set D31:F2:A4h[15:00] = 0039h
+ /// else if Port 2 has a SSD, set D31:F2:A4h[15:00] = 0F39h
+ /// d. If port 3 is empty, set D31:F2:A0h=A4h and D31:F2:A4h[31:16] = 0000h
+ /// else if Port 3 has a HDD, set D31:F2:A4h[31:16] = 0039h
+ /// else if Port 3 has a SSD, set D31:F2:A4h[31:16] = 0F39h
+ /// e. If port 4 is empty, set D31:F2:A0h=A8h and D31:F2:A4h[15:00] = 0000h
+ /// else if Port 4 has a HDD, set D31:F2:A4h[15:00] = 0039h
+ /// else if Port 4 has a SSD, set D31:F2:A4h[15:00] = 0F39h
+ /// f. If port 5 is empty, set D31:F2:A0h=A8h and D31:F2:A4h[31:16] = 0000h
+ /// else if Port 5 has a HDD, set D31:F2:A4h[31:16] = 0039h
+ /// else if Port 5 has a SSD, set D31:F2:A4h[31:16] = 0F39h
+ ///
+ MaxSataPortNum = GetPchMaxSataPortNum();
+ RegData16 = MmioRead16 (PciD31F2RegBase + R_PCH_SATA_PCS);
+ for (Index = 0; Index < (MaxSataPortNum / 2); Index++) {
+ Data32And = 0x70C070C0;
+ Data32Or = 0x00000000;
+ if (PchPlatformPolicy->ThermalConfig->ThermalThrottling.SataTT.SuggestedSetting == PCH_DEVICE_ENABLE) {
+ if ((RegData16 & (B_PCH_SATA_PCS_PORT0_DET << (Index * 2))) != 0) {
+ Data32Or |= 0x00000039;
+ if (PchPlatformPolicy->SataConfig->PortSettings[0 + (Index * 2)].SolidStateDrive == PCH_DEVICE_ENABLE) {
+ Data32Or |= 0x00000F00;
+ }
+ }
+
+ if ((RegData16 & (B_PCH_SATA_PCS_PORT0_DET << ((Index * 2) + 1))) != 0) {
+ Data32Or |= 0x00390000;
+ if (PchPlatformPolicy->SataConfig->PortSettings[1 + (Index * 2)].SolidStateDrive == PCH_DEVICE_ENABLE) {
+ Data32Or |= 0x0F000000;
+ }
+ }
+ } else {
+ Data32Or = (UINT32) (PchPlatformPolicy->ThermalConfig->ThermalThrottling.SataTT.P1TDispFinit << 31) |
+ (UINT32) (PchPlatformPolicy->ThermalConfig->ThermalThrottling.SataTT.P1Tinact << 26) |
+ (UINT32) (PchPlatformPolicy->ThermalConfig->ThermalThrottling.SataTT.P1TDisp << 24) |
+ (UINT32) (PchPlatformPolicy->ThermalConfig->ThermalThrottling.SataTT.P1T3M << 20) |
+ (UINT32) (PchPlatformPolicy->ThermalConfig->ThermalThrottling.SataTT.P1T2M << 18) |
+ (UINT32) (PchPlatformPolicy->ThermalConfig->ThermalThrottling.SataTT.P1T1M << 16) |
+ (UINT32) (PchPlatformPolicy->ThermalConfig->ThermalThrottling.SataTT.P0TDispFinit << 15) |
+ (UINT32) (PchPlatformPolicy->ThermalConfig->ThermalThrottling.SataTT.P0Tinact << 10) |
+ (UINT32) (PchPlatformPolicy->ThermalConfig->ThermalThrottling.SataTT.P0TDisp << 8) |
+ (UINT32) (PchPlatformPolicy->ThermalConfig->ThermalThrottling.SataTT.P0T3M << 4) |
+ (UINT32) (PchPlatformPolicy->ThermalConfig->ThermalThrottling.SataTT.P0T2M << 2) |
+ (UINT32) PchPlatformPolicy->ThermalConfig->ThermalThrottling.SataTT.P0T1M;
+ }
+
+ MmioWrite8 (PciD31F2RegBase + R_PCH_SATA_SIRI, (0xA0 + (Index * 4)));
+ MmioAndThenOr32 ((UINTN) (PciD31F2RegBase + R_PCH_SATA_STRD), Data32And, Data32Or);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (PciD31F2RegBase + R_PCH_SATA_SIRI),
+ 1,
+ (VOID *) (UINTN) (PciD31F2RegBase + R_PCH_SATA_SIRI)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PciD31F2RegBase + R_PCH_SATA_STRD),
+ 1,
+ (VOID *) (UINTN) (PciD31F2RegBase + R_PCH_SATA_STRD)
+ );
+ }
+
+ ///
+ /// Program ThermalBar + 0xA4 [1:0] = 11b
+ ///
+ MmioOr8 (ThermalBaseB + 0xA4, (UINT8) (BIT1 | BIT0));
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (ThermalBaseB + 0xA4),
+ 1,
+ (VOID *) (UINTN) (ThermalBaseB + 0xA4)
+ );
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, 17.3.1 Initializing Lynx Point Thermal Sensors
+ /// Step 7
+ /// Enable thermal sensor by programming TSEL register to 01h
+ /// This should be done after all thermal initialization steps are finished.
+ ///
+ RegData8 = MmioRead8 (ThermalBaseB + R_PCH_TBARB_TSEL);
+ RegData8 |= (UINT8) B_PCH_TBARB_TSEL_ETS;
+ ///
+ /// Step 8.5
+ /// TSEL [7] locks the thermal sensor enable, after TAHV and TAHL are programmed by BIOS or driver
+ /// later in case.
+ ///
+ if (PchPlatformPolicy->ThermalConfig->ThermalAlertEnable.TselLock == PCH_DEVICE_ENABLE) {
+ RegData8 |= (UINT8) B_PCH_TBARB_TSEL_PLD;
+ }
+
+ MmioWrite8 (ThermalBaseB + R_PCH_TBARB_TSEL, RegData8);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (ThermalBaseB + R_PCH_TBARB_TSEL),
+ 1,
+ (VOID *) (UINTN) (ThermalBaseB + R_PCH_TBARB_TSEL)
+ );
+ ///
+ /// Step 8.6
+ /// Program ThermalBAR + 0x0A [7] = 1b
+ /// For LP, Program ThermalBar + 0x0A [7, 0] = 1b, 1b
+ ///
+ RegData8 = BIT7;
+ if (PchSeries == PchLp) {
+ RegData8 |= BIT0;
+ }
+ MmioOr8 (ThermalBaseB + R_PCH_TBARB_TSREL, RegData8);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (ThermalBaseB + R_PCH_TBARB_TSREL),
+ 1,
+ (VOID *) (UINTN) (ThermalBaseB + R_PCH_TBARB_TSREL)
+ );
+
+ ///
+ /// For LP, Program ThermalBar + 0x1C [14:0] = 48C8h
+ /// For LP, Program ThermalBar + 0x1C [15] = 1h
+ ///
+ if (PchSeries == PchLp) {
+ Data16And = (B_PCH_TBARB_TSPM_LTT | B_PCH_TBARB_TSPM_MAXTSST | B_PCH_TBARB_TSPM_MINTSST | B_PCH_TBARB_TSPM_DTSSIC0 |
+ B_PCH_TBARB_TSPM_DTSSS0EN);
+ Data16Or = (V_PCH_TBARB_TSPM_LTT | V_PCH_TBARB_TSPM_MAXTSST | B_PCH_TBARB_TSPM_DTSSS0EN);
+ MmioAndThenOr16 (ThermalBaseB + R_PCH_TBARB_TSPM,
+ (UINT16) Data16And,
+ (UINT16) Data16Or);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (ThermalBaseB + R_PCH_TBARB_TSPM),
+ 1,
+ (VOID *) (UINTN) (ThermalBaseB + R_PCH_TBARB_TSPM)
+ );
+
+ MmioOr16 (ThermalBaseB + R_PCH_TBARB_TSPM, (UINT16) B_PCH_TBARB_TSPM_TSPMLOCK);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (ThermalBaseB + R_PCH_TBARB_TSPM),
+ 1,
+ (VOID *) (UINTN) (ThermalBaseB + R_PCH_TBARB_TSPM)
+ );
+ }
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 17.2, Thermal Subsystem Device Initialization
+ /// Step 5
+ /// BIOS needs to perform the following steps prior to end of POST to free up the PCI resources
+ /// and hide the thermal subsystem device(OPTIONAL), except on mobile platforms that support
+ /// Intel DPPM. Also, BIOS may keep the TBARBH programmed if BIOS needs runtime access to PCH
+ /// thermal subsystem device data. In that case, BIOS must ensure TBARBH memory is reserved and
+ /// reported to the OS as motherboard resources to avoid memory allocation conflicts.
+ ///
+ if (PchPlatformPolicy->ThermalConfig->ThermalDeviceEnable == FALSE) {
+ ///
+ /// Step 5.1
+ /// Clear the Memory and Bus Master enable bit of D31:F6
+ ///
+ MmioAnd16 (
+ PciD31F6RegBase + R_PCH_THERMAL_COMMAND,
+ (UINT16)~(B_PCH_THERMAL_COMMAND_MSE | B_PCH_THERMAL_COMMAND_BME)
+ );
+ ///
+ /// Step 5.2
+ /// Clear and release memory resource assigned in TBAR (D31:F6:10h-13h)
+ ///
+ ThermalBase = MmioRead32 (PciD31F6RegBase + R_PCH_THERMAL_TBAR) & B_PCH_THERMAL_TBAR_MASK;
+
+ if ((ThermalBase != 0) && (ThermalBase != B_PCH_THERMAL_TBAR_MASK)) {
+ MmioWrite32 (PciD31F6RegBase + R_PCH_THERMAL_TBAR, 0);
+ MmioWrite32 (PciD31F6RegBase + R_PCH_THERMAL_TBARH, 0);
+
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PciD31F6RegBase + R_PCH_THERMAL_TBAR),
+ 1,
+ (VOID *) (UINTN) (PciD31F6RegBase + R_PCH_THERMAL_TBAR)
+ );
+
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PciD31F6RegBase + R_PCH_THERMAL_TBARH),
+ 1,
+ (VOID *) (UINTN) (PciD31F6RegBase + R_PCH_THERMAL_TBARH)
+ );
+
+ gDS->FreeMemorySpace (
+ (EFI_PHYSICAL_ADDRESS) ThermalBase,
+ V_PCH_THERMAL_TBAR_SIZE
+ );
+ }
+ ///
+ /// Step 5.3
+ /// Optionally, release and clear memory resource assigned in TBARB (D31:F6:40h-48h) if BIOS/ASL
+ /// implementation does not require access to PCH thermal subsystem device data during run time.
+ /// Left this to platform code
+ ///
+ /// Step 5.4
+ /// Hide D31:F6 PCI configuration space by setting FD.TTD (RCBA + 3418h[24])
+ ///
+ Data32And = 0xFFFFFFFF;
+ Data32Or = (UINT32) B_PCH_RCRB_FUNC_DIS_THERMAL;
+ MmioOr32 (RootComplexBar + R_PCH_RCRB_FUNC_DIS, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_FUNC_DIS),
+ &Data32Or, // Data to be ORed
+ &Data32And // Data to be ANDed
+ );
+ ///
+ /// Reads back for posted write to take effect
+ ///
+ Data32Or = MmioRead32 ((UINTN) (RootComplexBar + R_PCH_RCRB_FUNC_DIS));
+ SCRIPT_MEM_POLL (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_FUNC_DIS),
+ &Data32Or, // BitMask
+ &Data32Or, // BitValue
+ 1, // Duration
+ 1 // LoopTimes
+ );
+ }
+
+ DEBUG ((EFI_D_INFO, "ThermalLockDown() End\n"));
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Perform Clock Gating programming
+ Enables clock gating in various PCH interfaces and the registers must be restored during S3 resume.
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+ @param[in] FuncDisableReg The Function Disable Register
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+ConfigureClockGating (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar,
+ IN UINT32 FuncDisableReg
+ )
+{
+ UINT8 RegData8;
+ UINT32 RegData32;
+ UINT32 RegDataOr32;
+ UINT32 RegDataAnd32;
+ UINTN PciD31F0RegBase;
+ UINT16 LpcDeviceId;
+ UINT16 Data16Or;
+ PCH_SERIES PchSeries;
+ UINT32 D2F0Base;
+
+ DEBUG ((EFI_D_INFO, "ConfigureClockGating() Start\n"));
+
+ PchSeries = GetPchSeries();
+ PciD31F0RegBase = MmPciAddress (0, PchPlatformPolicy->BusNumber, 31, 0, 0);
+ LpcDeviceId = MmioRead16 (PciD31F0RegBase + R_PCH_LPC_DEVICE_ID);
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.5, section 19.10
+ /// 1
+ /// DMI interface
+ /// Enable Dynamic Clock Gating in the DMIC register by programming
+ /// For PCH LP
+ /// RCBA + 2234h [2] to 1b, RCBA + 2234h [0] to 1b
+ /// RCBA + 2234h [3:0] to 1111b
+ /// Set D31:F0:A0h[5] = 1b
+ /// Set D31:F0:A0h[6] = 1b
+ /// Set D31:F0:A0h[7] = 1b
+ /// Set D31:F0:A0h[11] = 0b
+ /// Set D31:F0:A0h[12] = 1b
+ /// For PCH H
+ /// RCBA + 2234h [3:0] to 1111b
+ /// Enable Dynamic Clock Gating in the DMIC register by programming RCBA + 2234h [3:0] to 1111b
+ /// before enabling ASPM.
+ /// Set D31:F0:A0h[11] = 1b
+ /// Set D31:F0:A0h[12] = 1b
+ /// Set D31:F0:A0h[14] = 1b.
+ /// System BIOS is also required to set following bit.
+ /// Dekstop: "Pseudo CLKRUN_EN (PSEUDO_CLKRUN_EN)" bit (D31:F0:A0h[3]) = 1b
+ /// Mobile: "PCI CLKRUN# Enable" bit (D31:F0:A0h[2]) = 1b
+ ///
+ switch (PchSeries) {
+ case PchLp:
+ MmioOr8 ((UINTN) (RootComplexBar + R_PCH_RCRB_DMIC), (UINT8) (B_PCH_LP_RCRB_DMIC_DMICGEN));
+ break;
+
+ case PchH:
+ MmioOr8 ((UINTN) (RootComplexBar + R_PCH_RCRB_DMIC), (UINT8) (B_PCH_H_RCRB_DMIC_DMICGEN));
+ break;
+
+ default:
+ break;
+ }
+
+ if (PchSeries == PchLp) {
+ Data16Or = (UINT16)(BIT12 | BIT7 | BIT6 | BIT5);
+ Data16Or |= BIT11;
+ MmioOr16 ((UINTN) (PciD31F0RegBase + R_PCH_LPC_GEN_PMCON_1), Data16Or);
+ } else if (PchSeries == PchH) {
+ MmioOr16 ((UINTN) (PciD31F0RegBase + R_PCH_LPC_GEN_PMCON_1), (UINT16) (BIT14 | BIT12 | BIT11));
+ }
+
+ if (PchPlatformPolicy->DeviceEnabling->PciClockRun == PCH_DEVICE_DISABLE) {
+ if (IS_PCH_LPT_LPC_DEVICE_ID_MOBILE (LpcDeviceId)) {
+ MmioAnd16 ((UINTN) (PciD31F0RegBase + R_PCH_LPC_GEN_PMCON_1), (UINT16) (~B_PCH_LPC_GEN_PMCON_CLKRUN_EN));
+ } else {
+ MmioAnd16 ((UINTN) (PciD31F0RegBase + R_PCH_LPC_GEN_PMCON_1), (UINT16) (~B_PCH_LPC_GEN_PMCON_PSEUDO_CLKRUN_EN));
+ }
+ } else {
+ if (IS_PCH_LPT_LPC_DEVICE_ID_MOBILE (LpcDeviceId)) {
+ MmioOr16 ((UINTN) (PciD31F0RegBase + R_PCH_LPC_GEN_PMCON_1), (UINT16) (B_PCH_LPC_GEN_PMCON_CLKRUN_EN));
+ } else {
+ MmioOr16 ((UINTN) (PciD31F0RegBase + R_PCH_LPC_GEN_PMCON_1), (UINT16) (B_PCH_LPC_GEN_PMCON_PSEUDO_CLKRUN_EN));
+ }
+ }
+
+ RegData8 = MmioRead8 (RootComplexBar + R_PCH_RCRB_DMIC);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_DMIC),
+ 1,
+ &RegData8
+ );
+
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PciD31F0RegBase + R_PCH_LPC_GEN_PMCON_1),
+ 1,
+ (VOID *) (UINTN) (PciD31F0RegBase + R_PCH_LPC_GEN_PMCON_1)
+ );
+
+ if (PchSeries == PchLp) {
+ ///
+ /// Set RCBA + 2614h[27:25],[14:13],[10],[8] = 101b, 11b, 1b, 1b respectively
+ /// Set RCBA + 2614h[23:16] = 0x20
+ /// Set RCBA + 2614h[30:28] = 0b
+ /// Set RCBA + 2614h[26] = 1b if D2F0+8 >= 0x0B
+ ///
+ D2F0Base = MmPciAddress (0, 0, 2, 0, 0);
+ RegDataAnd32 = (UINT32) ~(BIT30 | BIT29 | BIT28 | BIT26 | 0x00FF0000);
+ RegDataOr32 = (UINT32) (BIT27 | BIT25 | BIT21 | BIT14 | BIT13 | BIT10 | BIT8);
+ if ((MmioRead16 (D2F0Base) != 0xFFFF) && (MmioRead8 (D2F0Base + 8) >= 0x0B)) {
+ RegDataOr32 |= (UINT32) BIT26;
+ }
+ MmioAndThenOr32 (
+ (UINTN) (RootComplexBar + 0x2614),
+ RegDataAnd32,
+ RegDataOr32
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + 0x2614),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + 0x2614)
+ );
+ ///
+ /// Set Chipset Initialization Register 2 [4:0] (RCBA + 900h) = 11111b
+ /// Set Chipset Initialization Register 2 [9:8] (RCBA + 900h) = 11b
+ ///
+ MmioOr32 (
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR0900),
+ (UINT32) (BIT9 | BIT8 | BIT4 | BIT3 | BIT2 | BIT1 | BIT0)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR0900),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_RCRB_CIR0900)
+ );
+ } else if (PchSeries == PchH) {
+ ///
+ /// Set Chipset Initialization Register 2 [14] (RCBA + 900h) = 1b
+ ///
+ MmioOr32 (
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR0900),
+ (UINT32) (BIT14)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR0900),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_RCRB_CIR0900)
+ );
+ }
+ ///
+ /// 2
+ /// PCI Express* interface
+ /// 2.1
+ /// For each enabled PCI Express* root port, program D28:F0~F7:Reg E1h[1:0] to 3h to enable dynamic clock gating.
+ /// System BIOS also require to set D28:F0~F7:Reg E8h[0] = 1b
+ /// 2.2
+ /// Additionally, if port 0 is in x2 mode, these bits should not be set for port 1.
+ /// Likewise, if port 0 is in x4 mode, these bits should not be set for ports 1, 2, or 3
+ /// Done in PchRootPorts.c PcieEnableClockGating
+ /// 2.2.1
+ /// If PCIe root ports 0-3 are all disabled, set B0:D28:F0 + E2h[0] = 1b
+ /// if PCIe root ports 4-7 are all disabled, set B0:D28:F4 + E2h[0] = 1b
+ /// 2.3
+ /// Set B0:D28:F0&F4 + E1h [5:2] = 1111b
+ /// 2.4
+ /// Set B0:D28:F0&F4:E1h[7] = 1b
+ /// 2.6
+ /// Set B0:D28:F0~F7 + 324h[5] = 1b
+ /// Done in PchRootPorts.c PcieEnableClockGating
+ ///
+ /// Reg RCBA+341C is modified at multiple places, save at the end of the function
+ ///
+ /// 3
+ /// Serial ATA*
+ /// - Set bits D31:F2:94h[29:24] to 3Fh as part of the chipset initialization before disabling
+ /// the SATA function when the SATA interface is not supported on the platform. BIOS can also
+ /// set PCD bits to disable clocks for the un-routed ports on the platform.
+ /// - After configuring Port and Control Status (PCS) Register Port x Enabled (PxE) bits accordingly,
+ /// wait 1.4 micro second, then the PCD bits (D31:F2:Reg 94h[29:24]) should be set to be the inverse
+ /// of the Port and Control Status (PCS) Register Port x Enabled (PxE) bits
+ /// Please note that PCS should be set and PCD should not be set when ports are enabled for hot
+ /// plug support or used for SATA testing in test mode.
+ /// Done in ConfigureSata();
+ /// - Program D31:F2:98h[29] to 1b
+ /// Done in PchInitBeforeBoot()
+ /// - Set SATA Initialization Register 70h[31:0] = 3F00BF1Fh (Done in ConfigureMiscPm)
+ /// Set SATA Initialization Register 54h[31:0] = CF000F0Fh (Done in ConfigureMiscPm)
+ /// Set SATA Initialization Register 58h[31:0] = 190000h (Done in ConfigureMiscPm)
+ ///
+ /// 4
+ /// USB 1.1 / USB 2.0 / USB 3.0
+ ///
+ /// ConfigureUsbClockGating() has been moved to ConfigureMiscPm() to run before Function Disable
+ ///
+ /// 5
+ /// Intel High Definition Audio (HDA) controller.
+ ///
+ if (FuncDisableReg & B_PCH_RCRB_FUNC_DIS_AZALIA) {
+ ///
+ /// 5.1
+ /// If the HD Audio Controller is not being used, D27:F0 can be disabled and statically gated. Only statically
+ /// gate the Intel High Definition Audio controller if it is not being used in the system by setting RCBA + 341Ch[21].
+ ///
+ MmioOr32 ((UINTN) (RootComplexBar + R_PCH_RCRB_CG), (UINT32) (B_PCH_RCRB_CG_EN_SCG_HDA));
+ } else {
+ ///
+ /// 5.2
+ /// When the Intel High Definition Audio controller is used in the system,
+ /// dynamic clock gating can be used by setting RCBA + 341Ch[22].
+ ///
+ MmioOr32 ((UINTN) (RootComplexBar + R_PCH_RCRB_CG), (UINT32) (B_PCH_RCRB_CG_EN_DCG_HDA));
+ }
+ if (PchSeries == PchLp) {
+ ///
+ /// For PchLp, set RCBA + 341Ch[22]
+ ///
+ MmioOr32 ((UINTN) (RootComplexBar + R_PCH_RCRB_CG), (UINT32) (B_PCH_RCRB_CG_EN_DCG_HDA));
+ ///
+ /// 5.3
+ /// Set D27:F0:43h[6:5][2:0] = 11b, 111b (Done in ConfigureMiscPm)
+ ///
+ }
+ ///
+ /// Reg RCBA+341C is modified at multiple places, save at the end of the function
+ ///
+ /// 7
+ /// LPC.
+ /// Enable dynamic clock gating by setting RCRB+341C[31] to 1b.
+ ///
+ MmioOr32 ((UINTN) (RootComplexBar + R_PCH_RCRB_CG), (UINT32) (B_PCH_RCRB_CG_EN_DCG_LPC));
+ if (PchSeries == PchH) {
+ ///
+ /// Reg RCBA+341C is modified at multiple places, save at the end of the function
+ ///
+ /// 8
+ /// PCI Interface.
+ /// Enable PCI dynamic clock gating by setting RCBA + 341Ch[16].
+ ///
+ MmioOr32 ((UINTN) (RootComplexBar + R_PCH_RCRB_CG), (UINT32) (B_PCH_RCRB_CG_EN_DCG_PCI));
+ } else if (PchSeries == PchLp) {
+ ///
+ /// Set RCRB+341Ch[30][28:26] to 1b, 111b
+ ///
+ MmioOr32 (
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CG),
+ (UINT32) (B_PCH_RCRB_CG_EN_DCG_BLA | B_PCH_RCRB_CG_EN_DCG_GPIO | B_PCH_RCRB_CG_EN_DCG_HPET |
+ B_PCH_RCRB_CG_EN_CG_GPEC));
+ ///
+ /// Set RCRB+3434h[2:0] to 111b
+ ///
+ MmioOr8 (
+ (UINTN) (RootComplexBar + 0x3434),
+ (UINT8) (BIT2 | BIT1 | BIT0)
+ );
+ RegData8 = MmioRead8 (RootComplexBar + 0x3434);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (RootComplexBar + 0x3434),
+ 1,
+ &RegData8
+ );
+ ///
+ /// If RCRB+3454h[4] is 0b, then set RCRB+341C[29] to 1b, else set RCRB+341C[29] to 0b
+ ///
+ if ((MmioRead32 (RootComplexBar + R_PCH_RCRB_GSX_CTRL) & B_PCH_RCRB_GSX_BAR_ENABLE) == 0) {
+ MmioOr32 ((UINTN) (RootComplexBar + R_PCH_RCRB_CG), (UINT32) (B_PCH_RCRB_CG_EN_SCG_GSX));
+ } else {
+ MmioAnd32 ((UINTN) (RootComplexBar + R_PCH_RCRB_CG), (UINT32) (~B_PCH_RCRB_CG_EN_SCG_GSX));
+ }
+ }
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 10.2.1/10.2.2 Enable/Disable the GbE Clock Gating
+ /// Set RCBA + 341Ch[23]
+ ///
+ if (PchPlatformPolicy->DeviceEnabling->Lan == PCH_DEVICE_ENABLE) {
+ MmioAnd32 ((UINTN) (RootComplexBar + R_PCH_RCRB_CG), (UINT32) (~B_PCH_RCRB_CG_EN_SCG_LAN));
+ } else {
+ MmioOr32 ((UINTN) (RootComplexBar + R_PCH_RCRB_CG), (UINT32) (B_PCH_RCRB_CG_EN_SCG_LAN));
+ }
+ if (PchSeries == PchLp) {
+ ///
+ /// 9
+ /// SPI Clock gating.
+ /// Enable SPI clock gating by programming RCBA + 38C0h [13:10][2:0] to 1111b, 111b
+ ///
+ MmioOr32 (
+ (UINTN) (RootComplexBar + R_PCH_SPI_AFC),
+ (UINT32) (BIT13 | BIT12 | BIT11 | BIT10 | B_PCH_SPI_AFC_INF_DCGE | B_PCH_SPI_AFC_CORE_DCGE)
+ );
+ RegData32 = MmioRead32 (RootComplexBar + R_PCH_SPI_AFC);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_SPI_AFC),
+ 1,
+ &RegData32
+ );
+ } else if (PchSeries == PchH) {
+ ///
+ /// 9
+ /// SPI Clock gating.
+ /// Enable SPI clock gating by programming RCBA + 38C0h [2:0] to 111b
+ ///
+ MmioOr32 (
+ (UINTN) (RootComplexBar + R_PCH_SPI_AFC),
+ (UINT32) (B_PCH_SPI_AFC_INF_DCGE | B_PCH_SPI_AFC_CORE_DCGE)
+ );
+ RegData32 = MmioRead32 (RootComplexBar + R_PCH_SPI_AFC);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_SPI_AFC),
+ 1,
+ &RegData32
+ );
+ }
+ ///
+ /// 10
+ /// SMBus
+ /// Enable SMBus dynamic clock gating by setting D31:F3:80h [8, 10, 12 and 14] = 0b respectively (Done in ConfigureMiscPm)
+ ///
+ ///
+ /// PCH BIOS Spec Rev 0.5.5, section 19.10
+ /// 11
+ /// Misc
+ /// Set D31:F2:300h [17:16] = 11b (Done in ConfigureMiscPm)
+ ///
+
+ if (PchSeries == PchLp) {
+ ///
+ /// Set D31:F2:98h [31:30], [23] to 00b, 1b (Done in ConfigureMiscPm)
+ ///
+ /// Set iobp register CE00C000h[0] to 0b
+ ///
+ ProgramIobpWithScript (
+ RootComplexBar,
+ 0xCE00C000,
+ (UINT32)~(BIT0),
+ 0
+ );
+
+ ///
+ /// Disable legacy DMA (8237) if desired
+ /// Set RCBA + Offset 0x341C[24] = 1
+ ///
+ if ((PchPlatformPolicy->Revision >= DXE_PCH_PLATFORM_POLICY_PROTOCOL_REVISION_4)
+ && PchPlatformPolicy->PwrOptConfig->LegacyDmaDisable)
+ {
+ MmioOr32 ((UINTN) (RootComplexBar + R_PCH_RCRB_CG), (UINT32) (B_PCH_RCRB_CG_EN_SCG_8237));
+ }
+ }
+ ///
+ /// Save 341C value to the S3 script table. This register is modified at multiple places in this function. So instead of saving
+ /// at each location read the value once at the end of the function and save in S3 resume script.
+ ///
+ RegData32 = MmioRead32 (RootComplexBar + R_PCH_RCRB_CG);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CG),
+ 1,
+ &RegData32
+ );
+
+ DEBUG ((EFI_D_INFO, "ConfigureClockGating() End\n"));
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Configure miscellaneous power management settings
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+ @param[in] GpioBase GPIO base address of this PCH device
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+ConfigureMiscPm (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar,
+ IN UINT16 GpioBase
+ )
+{
+ UINT8 Data8Or;
+ UINT8 Data8And;
+ UINT32 RegData32;
+ UINT16 RegData16;
+ UINT32 RegData32Tmp;
+ UINTN PciD31F0RegBase;
+ UINTN PciD31F3RegBase;
+ UINTN PciD31F2RegBase;
+ UINT16 LpcDeviceId;
+ UINTN PciD27F0RegBase;
+ PCH_SERIES PchSeries;
+ UINT32 DsxCfg;
+
+ DEBUG ((EFI_D_INFO, "ConfigureMiscPm() Start\n"));
+
+ PchSeries = GetPchSeries();
+ PciD31F0RegBase = MmPciAddress (0, PchPlatformPolicy->BusNumber, 31, 0, 0);
+ PciD31F3RegBase = MmPciAddress (0, PchPlatformPolicy->BusNumber, 31, 3, 0);
+ PciD31F2RegBase = MmPciAddress (0, PchPlatformPolicy->BusNumber, 31, 2, 0);
+ LpcDeviceId = MmioRead16 (PciD31F0RegBase + R_PCH_LPC_DEVICE_ID);
+ PciD27F0RegBase = 0;
+ if (PchSeries == PchLp) {
+ PciD27F0RegBase = MmPciAddress (0, PchPlatformPolicy->BusNumber, 27, 0, 0);
+ }
+
+ ///
+ /// Clear power / reset status bits on PCH Corporate
+ ///
+ RegData32 = 0;
+ if (PchPlatformPolicy->MiscPmConfig->PowerResetStatusClear.MeWakeSts) {
+ RegData32 |= B_PCH_RCRB_PRSTS_ME_WAKE_STS;
+ }
+
+ if (PchPlatformPolicy->MiscPmConfig->PowerResetStatusClear.MeHrstColdSts) {
+ RegData32 |= B_PCH_RCRB_PRSTS_ME_HRST_COLD_STS;
+ }
+
+ if (PchPlatformPolicy->MiscPmConfig->PowerResetStatusClear.MeHrstWarmSts) {
+ RegData32 |= B_PCH_RCRB_PRSTS_ME_HRST_WARM_STS;
+ }
+
+ if (PchPlatformPolicy->MiscPmConfig->PowerResetStatusClear.MeHostPowerDn) {
+ RegData32 |= B_PCH_RCRB_PRSTS_ME_HOST_PWRDN;
+ }
+
+ if (PchPlatformPolicy->MiscPmConfig->PowerResetStatusClear.WolOvrWkSts) {
+ RegData32 |= B_PCH_RCRB_PRSTS_WOL_OVR_WK_STS;
+ }
+
+ MmioOr32 (RootComplexBar + R_PCH_RCRB_PRSTS, RegData32);
+ RegData32Tmp = 0xFFFFFFFF;
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ RootComplexBar + R_PCH_RCRB_PRSTS,
+ &RegData32, // OR mask
+ &RegData32Tmp // AND mask
+ );
+
+ ///
+ /// We need to enable GP27_PIN_DSX_EN for Wake from both SX and DSX
+ ///
+ DsxCfg = MmioRead32(RootComplexBar + 0x3334);
+ if (PchPlatformPolicy->MiscPmConfig->WakeConfig.Gp27WakeFromDeepSx == PCH_DEVICE_ENABLE) {
+ DsxCfg |= BIT0;
+ } else {
+ DsxCfg &= ~BIT0;
+ }
+
+ ///
+ /// Enable WAKE_PIN__DSX_EN for Wake
+ ///
+ if(PchPlatformPolicy->Revision >= DXE_PCH_PLATFORM_POLICY_PROTOCOL_REVISION_5) {
+ if (PchPlatformPolicy->MiscPmConfig->WakeConfig.PcieWakeFromDeepSx == PCH_DEVICE_ENABLE) {
+ DsxCfg |= BIT2;
+ } else {
+ DsxCfg &= ~BIT2;
+ }
+ }
+ MmioWrite32 ((RootComplexBar + 0x3334), DsxCfg);
+
+ ///
+ /// Handle wake policy
+ /// Don't need to record in S3 script as R_PCH_LPC_GEN_PMCON_3 is in RTC and SUS power well
+ ///
+ RegData16 = MmioRead16 (PciD31F0RegBase + R_PCH_LPC_GEN_PMCON_3) &
+ (UINT16) (~(B_PCH_LPC_GEN_PMCON_PME_B0_S5_DIS +
+ B_PCH_LPC_GEN_PMCON_WOL_ENABLE_OVERRIDE));
+
+ if (PchPlatformPolicy->MiscPmConfig->WakeConfig.PmeB0S5Dis) {
+ RegData16 |= B_PCH_LPC_GEN_PMCON_PME_B0_S5_DIS;
+ MmioWrite16 (PciD31F0RegBase + R_PCH_LPC_GEN_PMCON_3, RegData16);
+ }
+
+ if (PchPlatformPolicy->MiscPmConfig->WakeConfig.WolEnableOverride) {
+ ///
+ /// PCH BIOS Spec Rev 0.5.0 Section 10.4 Wake-On-LAN (WOL) Implementation
+ /// Step 1
+ /// Clear D31:F0:A2h[14] = 0b to ensure the LAN PHY will be powered for WOL
+ /// when the power source is either the AC or the DC battery.
+ ///
+ RegData16 = MmioRead16 (PciD31F0RegBase + R_PCH_LPC_GEN_PMCON_2);
+ RegData16 &= (UINT16) ~B_PCH_LPC_GEN_PMCON_DC_PP_DIS;
+
+ ///
+ /// Step 2
+ /// Clear D31:F0:A2h[13] = 0b to ensure the LAN PHY will be powered for WOL in Deep Sx.
+ ///
+ RegData16 &= (UINT16) ~B_PCH_LPC_GEN_PMCON_DSX_PP_DIS;
+
+ ///
+ /// Step 3
+ /// Set D31:F0:A2h[12] = 1b to ensure the LAN PHY will be powered for WOL after a G3 transition.
+ ///
+ RegData16 |= (UINT16) B_PCH_LPC_GEN_PMCON_AG3_PP_EN;
+
+ ///
+ /// Step 4
+ /// Set D31:F0:A2h[11] = 1b to ensure the LAN PHY will be powered for WOL from Sx.
+ ///
+ RegData16 |= (UINT16) B_PCH_LPC_GEN_PMCON_SX_PP_EN;
+ MmioWrite16 (PciD31F0RegBase + R_PCH_LPC_GEN_PMCON_2, RegData16);
+
+ ///
+ /// Step 5
+ /// "PME_B0_EN", PMBASE + Offset 28h[13], bit must be programmed to enable wakes
+ /// from S1-S4 at the Power Management Controller
+ /// Done in ASL code(_PRW)
+ ///
+ ///
+ /// Step 6
+ /// Set "WOL Enable Override", D31:F0:A4h:[13], bit to 1b to guarantee the
+ /// LAN-Wakes are enabled at the Power Management Controller, even in surprise
+ /// S5 cases such as power loss/return and Power Button Override
+ ///
+ RegData16 = MmioRead16 (PciD31F0RegBase + R_PCH_LPC_GEN_PMCON_3);
+ RegData16 |= (UINT16) B_PCH_LPC_GEN_PMCON_WOL_ENABLE_OVERRIDE;
+ MmioWrite16 (PciD31F0RegBase + R_PCH_LPC_GEN_PMCON_3, RegData16);
+
+ ///
+ /// Step 7
+ /// Moreover, system BIOS also require to enables in the LAN device by performing
+ /// the WOL configuration requirements in the GbE region of the SPI flash.
+ /// Done in PchSmmSxGoToSleep() SMM handler.
+ ///
+ } else {
+ ///
+ /// D31:F0:A2h[14:11] and D31:F0:A4h[13] are all in RTC or DSW well, so BIOS also
+ /// needs to program them while WOL setup option is disabled.
+ ///
+ RegData16 = MmioRead16 (PciD31F0RegBase + R_PCH_LPC_GEN_PMCON_2);
+ RegData16 |= (UINT16) (B_PCH_LPC_GEN_PMCON_DC_PP_DIS | B_PCH_LPC_GEN_PMCON_DSX_PP_DIS);
+ RegData16 &= (UINT16) ~(B_PCH_LPC_GEN_PMCON_AG3_PP_EN | B_PCH_LPC_GEN_PMCON_SX_PP_EN);
+ MmioWrite16 (PciD31F0RegBase + R_PCH_LPC_GEN_PMCON_2, RegData16);
+
+ RegData16 = MmioRead16 (PciD31F0RegBase + R_PCH_LPC_GEN_PMCON_3);
+ RegData16 &= (UINT16) ~(B_PCH_LPC_GEN_PMCON_WOL_ENABLE_OVERRIDE);
+ MmioWrite16 (PciD31F0RegBase + R_PCH_LPC_GEN_PMCON_3, RegData16);
+ }
+
+ ///
+ /// Configure On DC PHY Power Diable according to policy SlpLanLowDc.
+ /// When this bit is set, SLP_LAN# will be driven low when ACPRESENT is low.
+ /// This indicates that LAN PHY should be powered off on battery mode.
+ /// This will override the DC_PP_DIS setting by WolEnableOverride.
+ ///
+ if (PchPlatformPolicy->Revision >= DXE_PCH_PLATFORM_POLICY_PROTOCOL_REVISION_7) {
+ RegData16 = MmioRead16 (PciD31F0RegBase + R_PCH_LPC_GEN_PMCON_2);
+ if (PchPlatformPolicy->MiscPmConfig->SlpLanLowDc) {
+ if ((RegData16 & B_PCH_LPC_GEN_PMCON_DC_PP_DIS) == 0) {
+ RegData16 |= (UINT16) (B_PCH_LPC_GEN_PMCON_DC_PP_DIS);
+ MmioWrite16 (PciD31F0RegBase + R_PCH_LPC_GEN_PMCON_2, RegData16);
+ }
+ } else {
+ if ((RegData16 & B_PCH_LPC_GEN_PMCON_DC_PP_DIS) != 0) {
+ RegData16 &= (UINT16) ~(B_PCH_LPC_GEN_PMCON_DC_PP_DIS);
+ MmioWrite16 (PciD31F0RegBase + R_PCH_LPC_GEN_PMCON_2, RegData16);
+ }
+ }
+ }
+
+ ///
+ /// - Set SATA Initialization Register 70h[31:0] = 3F00BF1Fh
+ ///
+ MmioWrite8 (PciD31F2RegBase + R_PCH_SATA_SIRI, 0x70);
+ MmioWrite32 (PciD31F2RegBase + R_PCH_SATA_STRD, 0x3F00BF1F);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (PciD31F2RegBase + R_PCH_SATA_SIRI),
+ 1,
+ (VOID *) (UINTN) (PciD31F2RegBase + R_PCH_SATA_SIRI)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PciD31F2RegBase + R_PCH_SATA_STRD),
+ 1,
+ (VOID *) (UINTN) (PciD31F2RegBase + R_PCH_SATA_STRD)
+ );
+ if (PchSeries == PchLp) {
+ ///
+ /// Set SATA Initialization Register 54h[31:0] = CF000F0Fh
+ ///
+ MmioWrite8 (PciD31F2RegBase + R_PCH_SATA_SIRI, 0x54);
+ MmioWrite32 (PciD31F2RegBase + R_PCH_SATA_STRD, 0xCF000F0F);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (PciD31F2RegBase + R_PCH_SATA_SIRI),
+ 1,
+ (VOID *) (UINTN) (PciD31F2RegBase + R_PCH_SATA_SIRI)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PciD31F2RegBase + R_PCH_SATA_STRD),
+ 1,
+ (VOID *) (UINTN) (PciD31F2RegBase + R_PCH_SATA_STRD)
+ );
+ ///
+ /// Set SATA Initialization Register 58h[31:0] = 190000h
+ ///
+ MmioWrite8 (PciD31F2RegBase + R_PCH_SATA_SIRI, 0x58);
+ MmioWrite32 (PciD31F2RegBase + R_PCH_SATA_STRD, 0x190000);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (PciD31F2RegBase + R_PCH_SATA_SIRI),
+ 1,
+ (VOID *) (UINTN) (PciD31F2RegBase + R_PCH_SATA_SIRI)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PciD31F2RegBase + R_PCH_SATA_STRD),
+ 1,
+ (VOID *) (UINTN) (PciD31F2RegBase + R_PCH_SATA_STRD)
+ );
+ }
+ ///
+ /// 4
+ /// USB 1.1 / USB 2.0 / USB 3.0
+ ///
+ ConfigureUsbClockGating (PchPlatformPolicy, RootComplexBar);
+
+ if (PchSeries == PchLp) {
+ ///
+ /// 5.3
+ /// Set D27:F0:43h[6:5][3:0] = 11b, 111b
+ ///
+ Data8And = (UINT8) ~0x0;
+ Data8Or = (BIT6 | BIT5 | BIT3 | BIT2 | BIT1 | BIT0);
+ MmioOr8 ((UINTN) (PciD27F0RegBase + 0x43), Data8Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (PciD27F0RegBase + 0x43),
+ &Data8Or, // Data to be ORed
+ &Data8And // Data to be ANDed
+ );
+ }
+ ///
+ /// 10
+ /// SMBus
+ /// Enable SMBus dynamic clock gating by setting D31:F3:80h [8, 10, 12 and 14] = 0b respectively
+ ///
+ MmioAnd16 ((UINTN) (PciD31F3RegBase + 0x80), (UINT16) ~(BIT14 | BIT12 | BIT10 | BIT8));
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PciD31F3RegBase + 0x80),
+ 1,
+ (VOID *) (UINTN) (PciD31F3RegBase + 0x80)
+ );
+ ///
+ /// PCH BIOS Spec Rev 0.5.5, section 19.10
+ /// 11
+ /// Misc
+ ///
+ /// Set D31:F2:300h [31:29] to 111b and [19] to 1b
+ ///
+ MmioOr32 ((UINTN) (PciD31F2RegBase + 0x300), BIT31 | BIT30 | BIT29 | BIT19);
+ ///
+ /// Set D31:F2:300h [17:16] = 11b
+ ///
+ MmioOr32 ((UINTN) (PciD31F2RegBase + 0x300), BIT17 | BIT16);
+
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PciD31F2RegBase + 0x300),
+ 1,
+ (VOID *) (UINTN) (PciD31F2RegBase + 0x300)
+ );
+
+ if (PchSeries == PchLp) {
+ ///
+ /// Set D31:F2:98h [31:30], [23] to 00b, 1b
+ ///
+ MmioAndThenOr32(PciD31F2RegBase + 0x98, (UINT32)~(BIT31 | BIT30), BIT23);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PciD31F2RegBase + 0x98),
+ 1,
+ (VOID *) (UINTN) (PciD31F2RegBase + 0x98)
+ );
+
+ ///
+ /// Set RCBA + 0x333C[23:20] to 1100b
+ ///
+ MmioAndThenOr32 (
+ (UINTN) (RootComplexBar + R_PCH_RCRB_PM_CFG2),
+ (UINT32)~(BIT21 | BIT20),
+ (UINT32) (BIT22 | BIT23)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_PM_CFG2),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_RCRB_PM_CFG2)
+ );
+ }
+ DEBUG ((EFI_D_INFO, "ConfigureMiscPm() End\n"));
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Configure additional power management settings
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+ConfigureAdditionalPm (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar
+ )
+{
+ UINTN PciD31F0RegBase;
+ UINTN PciD31F2RegBase;
+ UINTN PciD28F0RegBase;
+ UINT32 Data32;
+ UINT8 Data8;
+ UINT16 LpcDeviceId;
+ UINT32 Data32And;
+ UINT32 Data32Or;
+ EFI_STATUS Status;
+ PCH_SERIES PchSeries;
+
+ Data32 = 0x0;
+ PchSeries = GetPchSeries();
+ PciD31F0RegBase = MmPciAddress (0, PchPlatformPolicy->BusNumber, 31, 0, 0);
+ PciD31F2RegBase = MmPciAddress (0, PchPlatformPolicy->BusNumber, 31, 2, 0);
+ PciD28F0RegBase = MmPciAddress (0, PchPlatformPolicy->BusNumber, 28, 0, 0);
+ LpcDeviceId = MmioRead16 (PciD31F0RegBase + R_PCH_LPC_DEVICE_ID);
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 19.4 Additional Power Management Programming
+ /// Step 1
+ /// Set D31:F0:A9h[7:0] = 46h
+ ///
+ MmioWrite8 (
+ (UINTN) (PciD31F0RegBase + R_PCH_LPC_CIR4),
+ (UINT8) (0x46)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (PciD31F0RegBase + R_PCH_LPC_CIR4),
+ 1,
+ (VOID *) (UINTN) (PciD31F0RegBase + R_PCH_LPC_CIR4)
+ );
+ ///
+ /// Step 2
+ /// Set Power Management Initialization Register (PMIR) Field 1, D31:F0:ACh[31] = 1b
+ /// Done in Intel Management Engine Framework Reference Code
+ /// Step 3
+ /// Set GEN_PMCON_LOCK register, D31:F0:A6h = 06h, after stretch and ACPI base programming completed.
+ /// Done in PchInitBeforeBoot()
+ if (PchSeries == PchH) {
+ ///
+ /// Step 4
+ /// Set RCBA + Offset 2238h[0] = 1b
+ ///
+ MmioOr32 (
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR2238),
+ (UINT32) (BIT0)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR2238),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_RCRB_CIR2238)
+ );
+ }
+ ///
+ /// Step 5
+ /// Set RCBA + Offset 232Ch[0] = 1b
+ ///
+ if (PchSeries == PchH) {
+ MmioOr32 (
+ (UINTN) (RootComplexBar + 0x232C),
+ (UINT32) (BIT0)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + 0x232C),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + 0x232C)
+ );
+ }
+
+ if (PchSeries == PchLp) {
+ ///
+ /// Step 5
+ /// Set RCBA + Offset 232Ch[0] = 0b
+ ///
+ MmioAnd32 (
+ (UINTN) (RootComplexBar + 0x232C),
+ (UINT32) ~(BIT0)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + 0x232C),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + 0x232C)
+ );
+ ///
+ /// Step 6
+ /// If Trunk Clock Gating is enabled:
+ /// set RCBA + Offset 1100h[15,14,8,5,4,3,2,1,0] all 1b
+ /// If Trunk Clock Gating is disabled:
+ /// set RCBA + Offset 1100h[15] = 0b
+ /// set RCBA + Offset 1100h[14,8,5,4,3,2,1,0] all 1b
+ ///
+
+ if((PchPlatformPolicy->UsbConfig->Usb30Settings.Mode != PCH_XHCI_MODE_ON) &&
+ (PchPlatformPolicy->UsbConfig->Usb30Settings.Btcg == PCH_DEVICE_DISABLE)) {
+ MmioAndThenOr32 (
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR1100),
+ (UINT32)~(BIT15),
+ (UINT32) (BIT14 | BIT8 | BIT5 | BIT4 | BIT3 | BIT2 | BIT1 | BIT0)
+ );
+ } else {
+ MmioOr32 (
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR1100),
+ (UINT32) (BIT15 | BIT14 | BIT8 | BIT5 | BIT4 | BIT3 | BIT2 | BIT1 | BIT0)
+ );
+ }
+
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR1100),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_RCRB_CIR1100)
+ );
+ } else if (PchSeries == PchH) {
+ ///
+ /// Step 6
+ /// If Truck Clock Gating is enabled:
+ /// set RCBA + Offset 1100h[14:13] = 11b
+ /// If Truck Clock Gating is disabled:
+ /// set RCBA + Offset 1100h[14:13] = 10b
+ ///
+ if((PchPlatformPolicy->UsbConfig->Usb30Settings.Mode != PCH_XHCI_MODE_ON) &&
+ (PchPlatformPolicy->UsbConfig->Usb30Settings.Btcg == PCH_DEVICE_DISABLE)) {
+ MmioAndThenOr32 ((UINTN) (RootComplexBar + R_PCH_RCRB_CIR1100), (UINT32) ~(BIT13), (UINT32) (BIT14));
+ } else {
+ MmioOr32 (
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR1100),
+ (UINT32) (BIT14 | BIT13)
+ );
+ }
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR1100),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_RCRB_CIR1100)
+ );
+ }
+
+ if (PchSeries == PchLp) {
+ ///
+ /// Set IOBP register 0xCF000000[14:12] = 111b
+ /// Set IOBP register 0XCF000000[0] = 1b
+ ///
+ Data32And = (UINT32)~(0);
+ Data32Or = 0x7001;
+ Status = ProgramIobp (
+ RootComplexBar,
+ 0xCF000000,
+ Data32And,
+ Data32Or
+ );
+ ASSERT_EFI_ERROR (Status);
+ Status = PCH_INIT_COMMON_SCRIPT_SAVE_IOBP_S3_ITEM (
+ RootComplexBar,
+ 0xCF000000,
+ Data32And,
+ Data32Or
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Set IOBP register 0xCA000000[3] = 1b
+ /// Set IOBP register 0XCA000000[0] = 1b
+ ///
+ Data32And = (UINT32)~(0);
+ Data32Or = (UINT32) (0x09);
+ Status = ProgramIobp (
+ RootComplexBar,
+ 0xCA000000,
+ Data32And,
+ Data32Or
+ );
+ ASSERT_EFI_ERROR (Status);
+ Status = PCH_INIT_COMMON_SCRIPT_SAVE_IOBP_S3_ITEM (
+ RootComplexBar,
+ 0xCA000000,
+ Data32And,
+ Data32Or
+ );
+ ASSERT_EFI_ERROR (Status);
+ } else if (PchSeries == PchH) {
+ ///
+ /// Step 7
+ /// Set RCBA + Offset 2304h[31:0] = 0xC07B8400
+ ///
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + R_PCH_RCRB_DMC),
+ (UINT32) (0xC07B8400)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_DMC),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_RCRB_DMC)
+ );
+ ///
+ /// Step 8
+ /// Set RCBA + Offset 2314h[23 and 5] = 1b
+ ///
+ MmioOr32 (
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR2314),
+ (UINT32) (BIT23 | BIT5)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR2314),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_RCRB_CIR2314)
+ );
+ }
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.5, Section 19.4 Additional Power Management Programming
+ /// Step 9
+ /// Set B0:D28:F0 + F5h[3:0] = 0101b
+ ///
+ MmioAndThenOr8 (
+ (UINTN) (PciD28F0RegBase + 0xF5),
+ (UINT8) ~(BIT3 | BIT1),
+ (UINT8) (BIT2 | BIT0)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (PciD28F0RegBase + 0xF5),
+ 1,
+ (VOID *) (UINTN) (PciD28F0RegBase + 0xF5)
+ );
+
+ if (PchSeries == PchH) {
+ ///
+ /// Step 10
+ /// Set RCBA + Offset 2320h [1] = 1b
+ ///
+ MmioOr32 ((UINTN) (RootComplexBar + R_PCH_RCRB_CIR2320), (UINT32) (BIT1));
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR2320),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_RCRB_CIR2320)
+ );
+ }
+ if (PchSeries == PchLp) {
+ ///
+ /// Step 10
+ /// Set RCBA + Offset 2320h [6:4] = 001b
+ ///
+ MmioAndThenOr32 (
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR2320),
+ (UINT8) ~(BIT6 | BIT5),
+ (UINT8) (BIT4)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR2320),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_RCRB_CIR2320)
+ );
+ }
+ switch (PchSeries) {
+ case PchLp:
+ ///
+ /// Step 11
+ /// Set RCBA + Offset 3314h[31:0] = 0x00012FFF
+ ///
+ Data32 = 0x00012FFF;
+ break;
+
+ case PchH:
+ default:
+ ///
+ /// Step 11
+ /// Set RCBA + Offset 3314h[31:0] = 0x000007BF
+ ///
+ Data32 = 0x000007BF;
+ break;
+ }
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3314),
+ (UINT32) (Data32)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3314),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3314)
+ );
+
+ switch (PchSeries) {
+ case PchLp:
+ ///
+ /// Step 12
+ /// Set RCBA + Offset 3318h[31:0] = 0x0DCF0400
+ ///
+ Data32 = 0x0DCF0400;
+ break;
+
+ case PchH:
+ default:
+ ///
+ /// Step 12
+ /// Set RCBA + Offset 3318h[31:0] = 0x0DCF0020 (Note: Keep BIT5 unchanged)
+ ///
+ Data32 = 0x0DCF0020;
+ break;
+ }
+ ///
+ /// Note: RCBA + 3318h[19:16] are platform dependent settings (0Fh provides longest assertion),
+ /// please consult with your board design engineers for correct values to be programmed to.
+ ///
+ /// For RCBA + 3318h[9:8] Reset Power Cycle Duration could be customized, please refer to EDS
+ /// and make sure the setting correct, which never less than the following register.
+ /// - GEN_PMCON_3.SLP_S3_MIN_ASST_WDTH
+ /// - GEN_PMCON_3.SLP_S4_MIN_ASST_WDTH
+ /// - PM_CFG.SLP_A_MIN_ASST_WDTH
+ /// - PM_CFG.SLP_LAN_MIN_ASST_WDTH
+ ///
+ Data32 &= (UINT32)~(B_PCH_RCRB_PM_CFG_SSMAW_MASK | B_PCH_RCRB_PM_CFG_SAMAW_MASK);
+ if (PchPlatformPolicy->Revision >= DXE_PCH_PLATFORM_POLICY_PROTOCOL_REVISION_4) {
+ Data32 &= (UINT32)~(B_PCH_RCRB_PM_CFG_RPCD_MASK);
+ }
+
+ switch (PchPlatformPolicy->MiscPmConfig->PchSlpSusMinAssert) {
+ case PchSlpSus0ms:
+ Data32 |= V_PCH_RCRB_PM_CFG_SSMAW_0S;
+ break;
+
+ case PchSlpSus500ms:
+ Data32 |= V_PCH_RCRB_PM_CFG_SSMAW_0_5S;
+ break;
+
+ case PchSlpSus1s:
+ Data32 |= V_PCH_RCRB_PM_CFG_SSMAW_1S;
+ break;
+
+ case PchSlpSus4s:
+ default:
+ Data32 |= V_PCH_RCRB_PM_CFG_SSMAW_4S;
+ break;
+ }
+ switch (PchPlatformPolicy->MiscPmConfig->PchSlpAMinAssert) {
+ case PchSlpA0ms:
+ Data32 |= V_PCH_RCRB_PM_CFG_SAMAW_0S;
+ break;
+
+ case PchSlpA4s:
+ Data32 |= V_PCH_RCRB_PM_CFG_SAMAW_4S;
+ break;
+
+ case PchSlpA98ms:
+ Data32 |= V_PCH_RCRB_PM_CFG_SAMAW_98ms;
+ break;
+
+ case PchSlpA2s:
+ default:
+ Data32 |= V_PCH_RCRB_PM_CFG_SAMAW_2S;
+ break;
+ }
+ if (PchPlatformPolicy->Revision >= DXE_PCH_PLATFORM_POLICY_PROTOCOL_REVISION_4) {
+ switch (PchPlatformPolicy->MiscPmConfig->PchPwrCycDur) {
+ case 0: // treat as PCH default
+ Data32 |= V_PCH_RCRB_PM_CFG_RPCD_4S;
+ break;
+
+ case 1:
+ Data32 |= V_PCH_RCRB_PM_CFG_RPCD_1S;
+ break;
+
+ case 2:
+ Data32 |= V_PCH_RCRB_PM_CFG_RPCD_2S;
+ break;
+
+ case 3:
+ Data32 |= V_PCH_RCRB_PM_CFG_RPCD_3S;
+ break;
+
+ case 4:
+ Data32 |= V_PCH_RCRB_PM_CFG_RPCD_4S;
+ break;
+
+ default:
+ Data32 |= V_PCH_RCRB_PM_CFG_RPCD_4S;
+ DEBUG ((EFI_D_ERROR, "Error. Not a valid PCH reset power cycle duration setting.\n"));
+ break;
+ }
+ }
+ ///
+ /// For LP, force bit 5 = 0
+ /// For LPT-H, preserve bit 5
+ ///
+ if (PchSeries == PchLp) {
+ Data32 &= (UINT32) ~(BIT5);
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + R_PCH_RCRB_PM_CFG),
+ Data32
+ );
+ } else {
+ MmioOr32 (
+ (UINTN) (RootComplexBar + R_PCH_RCRB_PM_CFG),
+ Data32
+ );
+ }
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_PM_CFG),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_RCRB_PM_CFG)
+ );
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 19.4 Additional Power Management Programming
+ /// Step 13
+ /// Set RCBA + Offset 3324h[31:0] = 0x04000000
+ ///
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3324),
+ (UINT32) (0x04000000)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3324),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3324)
+ );
+
+ if (PchSeries == PchH) {
+ ///
+ /// Step 14
+ /// Set RCBA + Offset 3340h[31:0] = 0x020DDBFF
+ ///
+ MmioOr32 (
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3340),
+ (UINT32) (0x020DDBFF)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3340),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3340)
+ );
+ ///
+ /// Step 15
+ /// Set RCBA + Offset 3344h[0] = 1b
+ ///
+ MmioOr32 (
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3344),
+ (UINT32) (BIT0)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3344),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3344)
+ );
+ }
+ switch (PchSeries) {
+ case PchLp:
+ ///
+ /// Step 16
+ /// Set RCBA + Offset 3368h[31:0] = 0x00041400
+ ///
+ Data32 = 0x00041400;
+ break;
+
+ case PchH:
+ default:
+ ///
+ /// Step 16
+ /// Set RCBA + Offset 3368h[31:0] = 0x00041000
+ ///
+ Data32 = 0x00041000;
+ break;
+ }
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3368),
+ (UINT32) (Data32)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3368),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3368)
+ );
+
+ if (PchSeries == PchH) {
+ ///
+ /// Step 17
+ /// Set RCBA + Offset 3378h[31:0] = 3F8DDBFFh
+ ///
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3378),
+ (UINT32) (0x3F8DDBFF)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3378),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3378)
+ );
+ ///
+ /// Step 18
+ /// Set RCBA + Offset 337Ch[31:0] = 000001E1h
+ ///
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR337C),
+ (UINT32) (0x000001E1)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR337C),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_RCRB_CIR337C)
+ );
+ }
+ switch (PchSeries) {
+ case PchLp:
+ ///
+ /// Step 19
+ /// Set RCBA + Offset 3388h[31:0] = 0x3F8DDBFF
+ ///
+ Data32 = 0x3F8DDBFF;
+ break;
+
+ case PchH:
+ default:
+ ///
+ /// Step 19
+ /// Set RCBA + Offset 3388h[31:0] = 0x00001000
+ ///
+ Data32 = 0x00001000;
+ break;
+ }
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3388),
+ (UINT32) (Data32)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3388),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3388)
+ );
+ if (PchSeries == PchH) {
+ ///
+ /// Step 20
+ /// Set RCBA + Offset 33A0h[31:0] = 00000800h
+ ///
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR33A0),
+ (UINT32) (0x00000800)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR33A0),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_RCRB_CIR33A0)
+ );
+ }
+ switch (PchSeries) {
+ case PchLp:
+ ///
+ /// Step 21
+ /// Set RCBA + Offset 33ACh[31:0] = 0x00007001
+ ///
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + 0x33AC),
+ (UINT32) (0x00007001)
+ );
+ break;
+
+ case PchH:
+ default:
+ ///
+ /// Step 21
+ /// Set RCBA + Offset 33ACh[31:0] = 00001000h
+ ///
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + 0x33AC),
+ (UINT32) (0x00001000)
+ );
+ break;
+ }
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + 0x33AC),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + 0x33AC)
+ );
+ switch (PchSeries) {
+ case PchLp:
+ ///
+ /// Step 22
+ /// Set RCBA + Offset 33B0h[31:0] = 0x00181900
+ ///
+ Data32 = 0x00181900;
+ break;
+
+ case PchH:
+ default:
+ ///
+ /// Step 22
+ /// Set RCBA + Offset 33B0h[31:0] = 0x00001000
+ ///
+ Data32 = 0x00001000;
+ break;
+ }
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR33B0),
+ (UINT32) (Data32)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR33B0),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_RCRB_CIR33B0)
+ );
+ switch (PchSeries) {
+ case PchLp:
+ ///
+ /// Step 23
+ /// Set RCBA + Offset 33C0h[31:0] = 0x00060A00
+ ///
+ Data32 = 0x00060A00;
+ break;
+
+ case PchH:
+ default:
+ ///
+ /// Step 23
+ /// Set RCBA + Offset 33C0h[31:0] = 0x00011900
+ ///
+ Data32 = 0x00011900;
+ break;
+ }
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR33C0),
+ (UINT32) (Data32)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR33C0),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_RCRB_CIR33C0)
+ );
+ ///
+ /// Step 24
+ /// LP Set RCBA + Offset 33D0h[31:0] = 0x06200840
+ /// LP Set RCBA + Offset 33D0h[31:0] = 06004622h for LPT LP A0/A1 only
+ /// LPT-H Set RCBA + Offset 33D0h[31:0] = 06000802h
+ switch (PchSeries) {
+ case PchLp:
+ if (PchSeries == PchLp && PchStepping() < LptLpB0) {
+ Data32 = 0x06004622;
+ } else {
+ Data32 = 0x06200840;
+ }
+ break;
+
+ case PchH:
+ default:
+ Data32 = 0x06000802;
+ break;
+ }
+
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR33D0),
+ (UINT32) (Data32)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR33D0),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_RCRB_CIR33D0)
+ );
+ ///
+ /// Step 25 -- Note, this step has been moved to meet programming sequence requirements
+ /// Register 3A80 - 3A88 must be program after 3A00-3A3F and before 3A6C
+ /// Set RCBA + 3A88h[31:0] = 0x00000001
+ ///
+ switch (PchSeries) {
+ case PchLp:
+ ///
+ /// Step 26
+ /// Set RCBA + Offset 3A28h[31:0] = 01010101h
+ ///
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3A28),
+ (UINT32) (0x01010101)
+ );
+ break;
+
+ case PchH:
+ default:
+ ///
+ /// Step 26
+ /// Set RCBA + Offset 3A28h[31:0] = 01010000h
+ ///
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3A28),
+ (UINT32) (0x01010000)
+ );
+ break;
+ }
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3A28),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3A28)
+ );
+ switch (PchSeries) {
+ case PchLp:
+ ///
+ /// Step 27
+ /// Set RCBA + Offset 3A2Ch[31:0] = 04040404h
+ ///
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3A2C),
+ (UINT32) (0x04040404)
+ );
+ break;
+
+ case PchH:
+ default:
+ ///
+ /// Step 27
+ /// Set RCBA + Offset 3A2Ch[31:0] = 01010404h
+ ///
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3A2C),
+ (UINT32) (0x01010404)
+ );
+ break;
+ }
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3A2C),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3A2C)
+ );
+ ///
+ /// Step 29
+ /// Set RCBA + Offset 3A6Ch[31:0] = 00000001h, after all steps in this routine are done
+ /// Done in PchInitBeforeBoot()
+ ///
+ /// Step 30
+ /// For PCH H
+ /// Set RCBA + Offset 2344h[31:24] = 0FFh
+ /// Set RCBA + Offset 2344h[7:0] = 0Ch
+ /// Done in PchInitBeforeBoot()
+ ///
+ /// Step 31
+ /// For LPT-H set RCBA + Offset 33A4h[0] = 1b
+ ///
+ if (PchSeries == PchH) {
+ MmioOr32 (
+ (UINTN) (RootComplexBar + 0x33A4),
+ (UINT32) (BIT0)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + 0x33A4),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + 0x33A4)
+ );
+ }
+
+ if (PchSeries == PchLp) {
+ ///
+ /// Step 32
+ ///
+ /// Set RCBA + Offset 2B1Ch
+ /// [31:30] =2'b00
+ /// [29] =0 if Audio DSP is enabled. 1 if disabled (RCBA offset x3418[1]=1). ConfigureAudioDsp will take care of this bit, which is executed later
+ /// Note1: Must assume enable in this flow because ConfigureAudioDsp only program this in the "audio disable flow" only
+ /// [28:22] = 7'b0001110
+ /// [21:16]=corresponding bit has to be set for each SRC[5:0]CLKRQ# pin that is enabled (ie attached to a PCIe device)
+ /// [15:0]=0x8033h
+ ///
+ Data32 = 0x03808033;
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + 0x2B1C),
+ (UINT32) (Data32)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + 0x2B1C),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + 0x2B1C)
+ );
+ ///
+ /// Step 33
+ /// Set RCBA + Offset 2B34[31:0] = 80000009h
+ /// Set bit 3 and 0, PMC shutdown time = 16us
+ ///
+ Data32 = 0x80000009;
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + 0x2B34),
+ (UINT32) (Data32)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + 0x2B34),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + 0x2B34)
+ );
+
+ ///
+ /// Step 34
+ /// Set RCBA + Offset 3348[31:0] = 022DDFFFh
+ ///
+ Data32 = 0x022DDFFF;
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + 0x3348),
+ (UINT32) (Data32)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + 0x3348),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + 0x3348)
+ );
+ ///
+ /// Step 35
+ /// Set RCBA + Offset 334C[31:0] = 00000001h
+ ///
+ Data32 = 0x00000001;
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + 0x334C),
+ (UINT32) (Data32)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + 0x334C),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + 0x334C)
+ );
+ ///
+ /// Step 36
+ /// Set RCBA + Offset 3358[31:0] = 0001C000h
+ ///
+ Data32 = 0x0001C000;
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + 0x3358),
+ (UINT32) (Data32)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + 0x3358),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + 0x3358)
+ );
+ ///
+ /// Step 37
+ /// Set RCBA + Offset 3380[31:0] = 3F8DDBFFh
+ ///
+ Data32 = 0x3F8DDBFF;
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + 0x3380),
+ (UINT32) (Data32)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + 0x3380),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + 0x3380)
+ );
+ ///
+ /// Step 38
+ /// Set RCBA + Offset 3384[31:0] = 0001C7E1h
+ ///
+ Data32 = 0x0001C7E1;
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + 0x3384),
+ (UINT32) (Data32)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + 0x3384),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + 0x3384)
+ );
+ ///
+ /// Step 39
+ /// Set RCBA + Offset 338C[31:0] = 0x0001C7E1
+ ///
+ Data32 = 0x0001C7E1;
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + 0x338C),
+ (UINT32) (Data32)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + 0x338C),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + 0x338C)
+ );
+ ///
+ /// Step 40
+ /// Set RCBA + Offset 3398[31:0] = 0001C000h
+ ///
+ Data32 = 0x0001C000;
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + 0x3398),
+ (UINT32) (Data32)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + 0x3398),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + 0x3398)
+ );
+ ///
+ /// Step 41
+ /// Set RCBA + Offset 33A8[31:0] = 0x00181900
+ ///
+ Data32 = 0x00181900;
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + 0x33A8),
+ (UINT32) (Data32)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + 0x33A8),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + 0x33A8)
+ );
+ ///
+ /// Step 42
+ /// Set RCBA + Offset 33DC[31:0] = 00080000h
+ ///
+ Data32 = 0x00080000;
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + 0x33DC),
+ (UINT32) (Data32)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + 0x33DC),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + 0x33DC)
+ );
+ ///
+ /// Step 43
+ /// Set RCBA + Offset 33E0[31:0] = 00000001h
+ ///
+ Data32 = 0x00000001;
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + 0x33E0),
+ (UINT32) (Data32)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + 0x33E0),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + 0x33E0)
+ );
+ ///
+ /// Step 44
+ /// Set RCBA + Offset 3A20[31:0] = 00000404h
+ ///
+ Data32 = 0x00000404;
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + 0x3A20),
+ (UINT32) (Data32)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + 0x3A20),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + 0x3A20)
+ );
+ ///
+ /// Step 45
+ /// Set RCBA + Offset 3A24[31:0] = 01010101h
+ ///
+ Data32 = 0x01010101;
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + 0x3A24),
+ (UINT32) (Data32)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + 0x3A24),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + 0x3A24)
+ );
+ ///
+ /// Step 46
+ /// Set RCBA + Offset 3A30[31:0] = 01010101h
+ ///
+ Data32 = 0x01010101;
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + 0x3A30),
+ (UINT32) (Data32)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + 0x3A30),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + 0x3A30)
+ );
+ ///
+ /// Step 47
+ /// Set D31:F0:ACh[21] = 0b
+ ///
+ MmioAnd32 (
+ (UINTN) (PciD31F0RegBase + R_PCH_LPC_PMIR),
+ (UINT32) ~(BIT21)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PciD31F0RegBase + R_PCH_LPC_PMIR),
+ 1,
+ (VOID *) (UINTN) (PciD31F0RegBase + R_PCH_LPC_PMIR)
+ );
+ ///
+ /// Step 48
+ /// set RCBA + Offset 410h[1:0] = 11b
+ ///
+ MmioOr32 (
+ (UINTN) (RootComplexBar + 0x410),
+ (UINT32) (BIT1 | BIT0)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + 0x410),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + 0x410)
+ );
+ ///
+ /// Step 49
+ /// Set RCBA + 2618h[27] = 1b
+ ///
+ MmioOr32 (
+ (UINTN) (RootComplexBar + 0x2618),
+ (UINT32) BIT27
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + 0x2618),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + 0x2618)
+ );
+ ///
+ /// Step 50
+ /// Set RCBA + 2300h[1] = 1b
+ ///
+ Data32And = 0xFFFFFFFF;
+ Data32Or = (UINT32) BIT1;
+ MmioOr32 (RootComplexBar + 0x2300 , Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + 0x2300),
+ &Data32Or, // Data to be ORed
+ &Data32And // Data to be ANDed
+ );
+ ///
+ /// Step 51
+ /// Set RCBA + 2600h[3] = 1b
+ ///
+ MmioOr32 (
+ (UINTN) (RootComplexBar + 0x2600),
+ (UINT32) BIT3
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + 0x2600),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + 0x2600)
+ );
+ ///
+ /// Step 52
+ /// Set RCBA + 33B4h[0] = 0x00007001
+ ///
+ Data32 = 0x00007001;
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + 0x33B4),
+ (UINT32) (Data32)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + 0x33B4),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + 0x33B4)
+ );
+ /// Step 53
+ /// Set RCBA + Offset 3350[31:0] = 0x022DDFFF
+ ///
+ Data32 = 0x022DDFFF;
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + 0x3350),
+ (UINT32) (Data32)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + 0x3350),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + 0x3350)
+ );
+ ///
+ /// Step 54
+ /// Set RCBA + Offset 3354[31:0] = 0x00000001
+ ///
+ Data32 = 0x00000001;
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + 0x3354),
+ (UINT32) (Data32)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + 0x3354),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + 0x3354)
+ );
+ }
+
+ if ((PchPlatformPolicy->PwrOptConfig->PchPwrOptDmi == PCH_DEVICE_ENABLE)) {
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 19.13 Power Optimizer Considerations (MB Only)
+ /// Notes: Settings is not recommended for Lynx Point Power on ES0 samples
+ /// Step 1
+ /// Enable PM SYNC State 12
+ /// Program RCBA + 33D4h[27] = 1b
+ /// For PCH LP
+ /// Program RCBA + 2B14[31:0] = 1E0A4616h
+ /// Program RCBA + 2B24[31:0] = 40000005h
+ /// For PCH H
+ /// Program RCBA + 2B14[31:0] = 1E0A0317h
+ /// Program RCBA + 2B24[31:0] = 4000000Bh
+ /// Program RCBA + 2B28[31:0] = 00000002h
+ /// Program RCBA + 2B2C[31:0] = 00008813h
+ ///
+ MmioOr32 (
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR33D4),
+ (UINT32) BIT27
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR33D4),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_RCRB_CIR33D4)
+ );
+ ///
+ /// Program RCBA + 33C8h[27] = 1b
+ ///
+ Data32Or = BIT27;
+ if (PchSeries == PchLp) {
+ ///
+ /// Program RCBA + 33C8h[7] = 1b
+ ///
+ Data32Or = BIT7;
+ }
+ MmioOr32 (
+ (UINTN) (RootComplexBar + R_PCH_RCRB_PMSYNC),
+ (UINT32) Data32Or
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_PMSYNC),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_RCRB_PMSYNC)
+ );
+ ///
+ /// For LPT-LP, Program RCBA + 2B10[31:0] = 0000883Ch
+ ///
+ if (PchSeries == PchLp) {
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + 0x2B10),
+ (UINT32) (0x0000883C)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + 0x2B10),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + 0x2B10)
+ );
+ }
+ ///
+ /// Program RCBA + 2B14[31:0] = 1E0A0317h
+ /// For LP Program RCBA + 2B14[31:0] = 1E0A4616h
+ ///
+ Data32 = 0x1E0A0317;
+ if (PchSeries == PchLp) {
+ Data32 = 0x1E0A4616;
+ }
+ if (PchPlatformPolicy->PwrOptConfig->MemCloseStateEn == PCH_DEVICE_DISABLE) {
+ Data32 &= (UINT32) ~(BIT2);
+ }
+ if (PchPlatformPolicy->PwrOptConfig->InternalObffEn == PCH_DEVICE_DISABLE) {
+ Data32 &= (UINT32) ~(BIT1);
+ }
+ if (PchPlatformPolicy->PwrOptConfig->ExternalObffEn == PCH_DEVICE_DISABLE) {
+ Data32 &= (UINT32) ~(BIT0);
+ }
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + 0x2B14),
+ (UINT32) (Data32)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + 0x2B14),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + 0x2B14)
+ );
+ if (PchSeries == PchLp) {
+ ///
+ /// Set RCBA + Offset 2B24[31:0] = 0x40000005
+ ///
+ Data32 = 0x40000005;
+ } else {
+ ///
+ /// Set RCBA + Offset 2B24[31:0] = 0x4000000B
+ ///
+ Data32 = 0x4000000B;
+ }
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + 0x2B24),
+ Data32
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + 0x2B24),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + 0x2B24)
+ );
+ if (PchSeries == PchH) {
+ ///
+ /// Set RCBA + Offset 2B28[31:0] = 0x00000002
+ ///
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + 0x2B28),
+ (UINT32) (0x00000002)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + 0x2B28),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + 0x2B28)
+ );
+ }
+ if (PchSeries == PchH) {
+ ///
+ /// Set RCBA + Offset 2B2C[31:0] = 0x00008813
+ ///
+ Data32 = 0x00008813;
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + 0x2B2C),
+ Data32
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + 0x2B2C),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + 0x2B2C)
+ );
+ }
+ /// Step 7
+ /// Enable PM Demand in Cx States
+ /// For LPT-H, use default
+ /// For LPT-LP Program RCBA + 02B20h[1:0] = 0x0005DB01
+ ///
+ if (PchSeries == PchLp) {
+ Data32 = 0x0005DB01;
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + 0x2B20),
+ Data32
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + 0x2B20),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + 0x2B20)
+ );
+ }
+ }
+ switch (PchSeries) {
+ case PchLp:
+ ///
+ /// Step 55
+ /// Set RCBA + 3A80h[31:0] = 05145005h
+ ///
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3A80),
+ (UINT32) (0x05145005)
+ );
+ break;
+ case PchH:
+ default:
+ ///
+ /// Step 55
+ /// Set RCBA + 3A80h[31:0] = 01040000h
+ ///
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3A80),
+ (UINT32) (0x01040000)
+ );
+ break;
+ }
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3A80),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3A80)
+ );
+ ///
+ /// Step 56
+ /// Ensure this is done after 3A00-3A3C and before 3A6C
+ /// if PchLp, Set RCBA + Offset 3A84h[31:0] = 0x00001005
+ /// if PchH, Set RCBA + Offset 3A84h[31:0] = 0x01041001
+ /// if PCS.P0E and PCS.P1E = 0b, Set RCBA + Offset 3A84h[20,18] = 1b, 1b
+ /// if PCS.P2E and PCS.P3E = 0b, Set RCBA + Offset 3A84h[24,26] = 1b, 1b
+ ///
+ if (PchSeries == PchLp) {
+ Data32 = 0x00001005;
+ } else {
+ Data32 = 0x01041001;
+ }
+ Data8 = MmioRead8 (PciD31F2RegBase + R_PCH_SATA_PCS);
+ if((Data8 & (UINT8) (B_PCH_SATA_PCS_PORT0_EN | B_PCH_SATA_PCS_PORT1_EN)) == 0) {
+ Data32 |= (BIT20 | BIT18);
+ }
+ if((Data8 & (UINT8) (B_PCH_SATA_PCS_PORT2_EN | B_PCH_SATA_PCS_PORT3_EN)) == 0) {
+ Data32 |= (BIT24 | BIT26);
+ }
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3A84),
+ (UINT32) (Data32)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3A84),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3A84)
+ );
+ ///
+ /// Step 57
+ /// Set RCBA + 3A88h[31:0] = 0x00000001
+ ///
+ if (PchSeries == PchH) {
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3A88),
+ (UINT32) (0x00000001)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3A88),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_RCRB_CIR3A88)
+ );
+ }
+ ///
+ /// Step 58
+ /// For LPT-LP Set RCBA + Offset 33D4h = 0x2FFF2FB1, after step #14 to #24 and D31:F0:A9h are done
+ /// Note for LP only: Preserve bits 31,30,28,15,14,12, which are platform specific
+ /// For LPT-H Set RCBA + Offset 33D4h = 0xC00BC000, after step #14 to #24 and D31:F0:A9h are done
+ ///
+ switch (PchSeries) {
+ case PchLp:
+ MmioOr32 (
+ (UINTN) (RootComplexBar + 0x33D4),
+ (UINT32) (0x2FFF2FB1)
+ );
+ break;
+
+ case PchH:
+ default:
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + 0x33D4),
+ (UINT32) (0xC00BC000)
+ );
+ break;
+ }
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + 0x33D4),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + 0x33D4)
+ );
+
+ if (PchSeries == PchLp) {
+ ///
+ /// This is the last step which only apply for LPT-LP
+ /// Set RCBA + Offset 33C8h[15] = 1b
+ ///
+ MmioOr32 (
+ (UINTN) (RootComplexBar + 0x33C8),
+ (UINT32) (BIT15)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + 0x33C8),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + 0x33C8)
+ );
+ }
+ return EFI_SUCCESS;
+}
+
+/**
+ Configures PCH DMI according to policies specified in PCH Platform Policy protocol
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+
+ @retval EFI_SUCCESS Successfully completed.
+**/
+EFI_STATUS
+EFIAPI
+ConfigureDmiPm (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar
+ )
+{
+ UINT32 Data32And;
+ UINT32 Data32Or;
+ UINT16 Data16And;
+ UINT16 Data16Or;
+ UINTN PciD28F0RegBase;
+ PCH_PCI_EXPRESS_ASPM_CONTROL DmiAspmCtrl;
+ PCH_SERIES PchSeries;
+
+ DEBUG ((EFI_D_INFO, "ConfigureDmi() Start\n"));
+
+ PchSeries = GetPchSeries();
+ PciD28F0RegBase = MmPciAddress (0, PchPlatformPolicy->BusNumber, 28, 0, 0);
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.0 Section 7.1.5 Additional PCH DMI Programming Steps
+ ///
+ if (PchSeries == PchH) {
+ /// Step 4.1
+ /// If RCBA + Offset 2320h[1] = 0 and B0:D28:F0 + F5h[0] = 0, set RCBA + Offset 21A4h[17:15] = 010b
+ /// Else set RCBA + Offset 21A4h[17:15] = 100b
+ ///
+ if (((MmioRead32 ((UINTN) RootComplexBar + R_PCH_RCRB_CIR2320) & (UINT32) (BIT1)) == 0) &&
+ ((MmioRead8 (PciD28F0RegBase + 0xF5) & BIT0) == 0)) {
+ Data32Or = BIT16;
+ } else {
+ Data32Or = BIT17;
+ }
+ ///
+ /// Step 4.2
+ /// Set RCBA + Offset 21A4h[14:12] = 011b
+ ///
+ Data32Or |= BIT13 | BIT12;
+ Data32And = (UINT32)~(B_PCH_RCRB_LCAP_EL1 | B_PCH_RCRB_LCAP_EL0);
+ MmioAndThenOr32 (RootComplexBar + R_PCH_RCRB_LCAP, Data32And, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_LCAP),
+ &Data32Or, // Data to be ORed
+ &Data32And // Data to be ANDed
+ );
+ }
+ ///
+ /// Step 4.3
+ /// Set RCBA + 2348[3:0] = 0h
+ ///
+ Data32Or = 0;
+ Data32And = (UINT32) ~(BIT0 | BIT1 | BIT2 | BIT3);
+ MmioAnd32 (RootComplexBar + 0x2348, Data32And);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + 0x2348),
+ &Data32Or, // Data to be ORed
+ &Data32And // Data to be ANDed
+ );
+
+ ///
+ /// Enable DMI ASPM
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 8.3.1 ASPM on DMI and the PCI Express* Root Ports
+ ///
+ if (PchPlatformPolicy->DmiConfig->DmiAspm == PCH_DEVICE_ENABLE) {
+ ///
+ /// While DmiAspm is enabled, DMI ASPM will be set to Intel recommended value.
+ /// PCH BIOS Spec Rev 0.5.0, Section 8.3.1 ASPM on DMI and the PCI Express* Root Ports
+ /// Note: We recommend PCH platforms to enable L0s and L1, but unless both sides of the link have L0s and/or
+ /// L1 enabled they will be disabled by the link.
+ ///
+ DmiAspmCtrl = PchPcieAspmL0sL1;
+ } else {
+ DmiAspmCtrl = PchPcieAspmDisabled;
+ }
+
+ if (DmiAspmCtrl != PchPcieAspmDisabled) {
+ if (PchSeries == PchH) {
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 8.3.1
+ /// BIOS should set RCBA + 2304h[10] to 0b prior to enabling DMI ASPM.
+ ///
+ Data32And = (UINT32)~(BIT10);
+ Data32Or = 0;
+ MmioAnd32 (RootComplexBar + R_PCH_RCRB_DMC, Data32And);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_DMC),
+ &Data32Or, // Data to be ORed
+ &Data32And // Data to be ANDed
+ );
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 8.3.1
+ ///
+ /// Step 1
+ /// RCBA + 21A4h[11:10] = 11b
+ ///
+ Data32And = 0xFFFFFFFF;
+ Data32Or = B_PCH_RCRB_LCAP_APMS;
+ MmioOr32 (RootComplexBar + R_PCH_RCRB_LCAP, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_LCAP),
+ &Data32Or, // Data to be ORed
+ &Data32And // Data to be ANDed
+ );
+ }
+
+ if (DmiAspmCtrl == PchPcieAspmL0sL1) {
+ ///
+ /// Step 2
+ /// Enable L0s/L1 on DMI by setting RCBA + offset 21A8h[1:0] to 11b
+ ///
+ Data16And = (UINT16) (~(BIT1 + BIT0));
+ Data16Or = (UINT16) (BIT1 + BIT0);
+
+ } else {
+ //
+ // Do nothing
+ //
+ Data16And = 0xFFFF;
+ Data16Or = 0;
+ }
+ if (PchSeries == PchH) {
+ ///
+ /// Program RCBA + offset 21A8h[1:0]
+ ///
+ MmioAndThenOr16 (RootComplexBar + R_PCH_RCRB_LCTL, Data16And, Data16Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_LCTL),
+ &Data16Or, // Data to be ORed
+ &Data16And // Data to be ANDed
+ );
+ ///
+ /// BIOS should set RCBA + 2304h[10] back to 1b after enabling DMI ASPM.
+ ///
+ Data32And = 0xFFFFFFFF;
+ Data32Or = (UINT32) (BIT10);
+ MmioOr32 (RootComplexBar + R_PCH_RCRB_DMC, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_DMC),
+ &Data32Or, // Data to be ORed
+ &Data32And // Data to be ANDed
+ );
+ }
+ }
+
+ if (PchSeries == PchH) {
+ if (PchPlatformPolicy->DmiConfig->DmiExtSync == PCH_DEVICE_ENABLE) {
+ Data16And = (UINT16) (~(B_PCH_RCRB_LCTL_ES));
+ Data16Or = (UINT16) B_PCH_RCRB_LCTL_ES;
+ MmioAndThenOr16 (RootComplexBar + R_PCH_RCRB_LCTL, Data16And, Data16Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_LCTL),
+ &Data16Or, // Data to be ORed
+ &Data16And // Data to be ANDed
+ );
+ }
+ }
+
+ DEBUG ((EFI_D_INFO, "ConfigureDmi() End\n"));
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Configure deep Sx programming
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+ProgramDeepSx (
+ DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ UINT32 RootComplexBar
+ )
+{
+ UINT32 S3Data32;
+ UINT32 S4Data32;
+ UINT32 S5Data32;
+ UINTN PciD31F0RegBase;
+ UINT16 LpcDeviceId;
+
+ PciD31F0RegBase = MmPciAddress (0, PchPlatformPolicy->BusNumber, 31, 0, 0);
+ LpcDeviceId = MmioRead16 (PciD31F0RegBase + R_PCH_LPC_DEVICE_ID);
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 19.11 Deep Sx Power Policies
+ /// The System BIOS can perform the following register programming guidelines to enable system
+ /// enter Deep S4 or Deep S5.
+ ///
+ /// DPS3_EN_DC DPS3_EN_AC DPS4_EN_DC DPS4_EN_AC DPS5_EN_DC DPS5_EN_AC
+ /// RCBA+3328h[1] RCBA + 3328h[0] RCBA + 332Ch[1] RCBA + 332Ch[0] RCBA + 3330h[15] RCBA + 3330h[14]
+ /// Deep Sx disabled 0 0 0 0 0 0
+ ///
+ /// Enabled in S5 0 0 0 0 1 1
+ ///
+ /// Enabled in S4 and S5 0 0 1 1 1 1
+ ///
+ /// Enabled in S3, S4 and S5 1 1 1 1 1 1
+ ///
+ /// Configuration supported by MOBILE:
+ /// Enabled in S5 0 0 0 0 1 0
+ /// (Battery mode)
+ /// Enabled in S4 and S5 0 0 1 0 1 0
+ /// (Battery Mode)
+ /// Enabled in S3, S4 and S5 1 0 1 0 1 0
+ /// (Battery Mode)
+ ///
+ /// NOTE: Mobile platforms support Deep S4/S5 in DC ONLY,
+ /// Desktop and Intel C206 Chipset (LPC Dev ID 0x1C56) platforms support Deep S4/S5 in AC ONLY,
+ /// Intel C204 Chipset (LPC Dev ID 0x1C54) and Intel C202 Chipset (LPC Dev ID 0x1C52) platforms DO NOT support Deep S4/S5.
+ ///
+ /// Deep Sx disabled 0 0 0 0 0 0
+ ///
+ if (IS_PCH_LPT_LPC_DEVICE_ID_DESKTOP (LpcDeviceId) ||
+ IS_PCH_LPT_LPC_DEVICE_ID_SERVER (LpcDeviceId) ||
+ IS_PCH_LPT_LPC_DEVICE_ID_WS (LpcDeviceId)) {
+ if ((PchPlatformPolicy->MiscPmConfig->PchDeepSxPol == PchMobileDpS5En) ||
+ (PchPlatformPolicy->MiscPmConfig->PchDeepSxPol == PchMobileDpS4S5En) ||
+ (PchPlatformPolicy->MiscPmConfig->PchDeepSxPol == PchMobileDpS3S4S5En)) {
+ ///
+ /// Set PchDeepSxPol to PchDeepSxPolDisable for unsupported deep Sx policy
+ ///
+ PchPlatformPolicy->MiscPmConfig->PchDeepSxPol = PchDeepSxPolDisable;
+ DEBUG ((EFI_D_ERROR, "Unsupported Deep Sx policy for desktop system\n"));
+ }
+
+ } else {
+ if ((PchPlatformPolicy->MiscPmConfig->PchDeepSxPol == PchDesktopDpS5En) ||
+ (PchPlatformPolicy->MiscPmConfig->PchDeepSxPol == PchDesktopDpS4S5En) ||
+ (PchPlatformPolicy->MiscPmConfig->PchDeepSxPol == PchDesktopDpS3S4S5En)) {
+ ///
+ /// Set PchDeepSxPol to PchDeepSxPolDisable for unsupported deep Sx policy
+ ///
+ PchPlatformPolicy->MiscPmConfig->PchDeepSxPol = PchDeepSxPolDisable;
+ DEBUG ((EFI_D_ERROR, "Unsupported Deep Sx policy for mobile system\n"));
+ }
+ }
+
+ switch (PchPlatformPolicy->MiscPmConfig->PchDeepSxPol) {
+ case PchDesktopDpS5En:
+ ///
+ /// Configuration 2: Enabled in S5/AC-DC
+ /// DEEP_S3_POL.DPS3_EN_DC = 0; DEEP_S3_POL.DPS3_EN_AC = 0;
+ /// DEEP_S4_POL.DPS4_EN_DC = 0; DEEP_S4_POL.DPS4_EN_AC = 0;
+ /// DEEP_S5_POL.DPS5_EN_DC = 1; DEEP_S5_POL.DPS5_EN_AC = 1;
+ ///
+ S3Data32 = 0;
+ S4Data32 = 0;
+ S5Data32 = (UINT32) (B_PCH_RCRB_DEEP_S5_POL_DPS5_EN_AC | B_PCH_RCRB_DEEP_S5_POL_DPS5_EN_DC);
+ break;
+
+ case PchDesktopDpS4S5En:
+ ///
+ /// Configuration 4: Enabled only in S4-S5
+ /// DEEP_S3_POL.DPS3_EN_DC = 0; DEEP_S3_POL.DPS3_EN_AC = 0;
+ /// DEEP_S4_POL.DPS4_EN_DC = 1; DEEP_S4_POL.DPS4_EN_AC = 1;
+ /// DEEP_S5_POL.DPS5_EN_DC = 1; DEEP_S5_POL.DPS5_EN_AC = 1;
+ ///
+ S3Data32 = 0;
+ S4Data32 = (UINT32) (B_PCH_RCRB_DEEP_S4_POL_DPS4_EN_AC | B_PCH_RCRB_DEEP_S4_POL_DPS4_EN_DC);
+ S5Data32 = (UINT32) (B_PCH_RCRB_DEEP_S5_POL_DPS5_EN_AC | B_PCH_RCRB_DEEP_S5_POL_DPS5_EN_DC);
+ break;
+
+ case PchDesktopDpS3S4S5En:
+ ///
+ /// Configuration 6: Enabled only in S3-S4-S5
+ /// DEEP_S3_POL.DPS3_EN_DC = 1; DEEP_S3_POL.DPS3_EN_AC = 1;
+ /// DEEP_S4_POL.DPS4_EN_DC = 1; DEEP_S4_POL.DPS4_EN_AC = 1;
+ /// DEEP_S5_POL.DPS5_EN_DC = 1; DEEP_S5_POL.DPS5_EN_AC = 1;
+ ///
+ S3Data32 = (UINT32) (B_PCH_RCRB_DEEP_S3_POL_DPS3_EN_AC | B_PCH_RCRB_DEEP_S3_POL_DPS3_EN_DC);
+ S4Data32 = (UINT32) (B_PCH_RCRB_DEEP_S4_POL_DPS4_EN_AC | B_PCH_RCRB_DEEP_S4_POL_DPS4_EN_DC);
+ S5Data32 = (UINT32) (B_PCH_RCRB_DEEP_S5_POL_DPS5_EN_AC | B_PCH_RCRB_DEEP_S5_POL_DPS5_EN_DC);
+ break;
+
+ case PchMobileDpS5En:
+ ///
+ /// Configuration 1: Enabled in S5/Battery only
+ /// DEEP_S3_POL.DPS3_EN_DC = 0; DEEP_S3_POL.DPS3_EN_AC = 0;
+ /// DEEP_S4_POL.DPS4_EN_DC = 0; DEEP_S4_POL.DPS4_EN_AC = 0;
+ /// DEEP_S5_POL.DPS5_EN_DC = 1; DEEP_S5_POL.DPS5_EN_AC = 0;
+ ///
+ S3Data32 = 0;
+ S4Data32 = 0;
+ S5Data32 = (UINT32) (B_PCH_RCRB_DEEP_S5_POL_DPS5_EN_DC);
+ break;
+
+ case PchMobileDpS4S5En:
+ ///
+ /// Configuration 3: Enabled only in S4-S5/Battery Mode
+ /// DEEP_S3_POL.DPS3_EN_DC = 0; DEEP_S3_POL.DPS3_EN_AC = 0;
+ /// DEEP_S4_POL.DPS4_EN_DC = 1; DEEP_S4_POL.DPS4_EN_AC = 0;
+ /// DEEP_S5_POL.DPS5_EN_DC = 1; DEEP_S5_POL.DPS5_EN_AC = 0;
+ ///
+ S3Data32 = 0;
+ S4Data32 = (UINT32) (B_PCH_RCRB_DEEP_S4_POL_DPS4_EN_DC);
+ S5Data32 = (UINT32) (B_PCH_RCRB_DEEP_S5_POL_DPS5_EN_DC);
+ break;
+
+ case PchMobileDpS3S4S5En:
+ ///
+ /// Configuration 5: Enabled only in S4-S5/Battery Mode
+ /// DEEP_S3_POL.DPS3_EN_DC = 1; DEEP_S3_POL.DPS3_EN_AC = 0;
+ /// DEEP_S4_POL.DPS4_EN_DC = 1; DEEP_S4_POL.DPS4_EN_AC = 0;
+ /// DEEP_S5_POL.DPS5_EN_DC = 1; DEEP_S5_POL.DPS5_EN_AC = 0;
+ ///
+ S3Data32 = (UINT32) (B_PCH_RCRB_DEEP_S3_POL_DPS3_EN_DC);
+ S4Data32 = (UINT32) (B_PCH_RCRB_DEEP_S4_POL_DPS4_EN_DC);
+ S5Data32 = (UINT32) (B_PCH_RCRB_DEEP_S5_POL_DPS5_EN_DC);
+ break;
+
+ case PchDeepSxPolDisable:
+ default:
+ ///
+ /// Configuration 5: DeepSx Disabled
+ /// DEEP_S3_POL.DPS3_EN_DC = 0; DEEP_S3_POL.DPS3_EN_AC = 0;
+ /// DEEP_S4_POL.DPS4_EN_DC = 0; DEEP_S4_POL.DPS4_EN_AC = 0;
+ /// DEEP_S5_POL.DPS5_EN_DC = 0; DEEP_S5_POL.DPS5_EN_AC = 0;
+ ///
+ S3Data32 = 0;
+ S4Data32 = 0;
+ S5Data32 = 0;
+ break;
+ }
+
+ MmioWrite32 ((RootComplexBar + R_PCH_RCRB_DEEP_S3_POL), S3Data32);
+ MmioWrite32 ((RootComplexBar + R_PCH_RCRB_DEEP_S4_POL), S4Data32);
+ MmioWrite32 ((RootComplexBar + R_PCH_RCRB_DEEP_S5_POL), S5Data32);
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchRootPorts.c b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchRootPorts.c
new file mode 100644
index 0000000..e9ae324
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchRootPorts.c
@@ -0,0 +1,2154 @@
+/** @file
+ This file contains functions that initializes PCI Express Root Ports of PCH.
+
+@copyright
+ Copyright (c) 1999 - 2014 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "PchInit.h"
+// AMI_OVERRIDE, [EIP84720]>
+#include "Token.h"
+// AMI_OVERRIDE, [EIP84720]<
+
+#ifdef TRAD_FLAG
+UINT32 PchHPcieHsioAddr[] = {
+ 0xE9002E40,
+ 0xE9002C40,
+ 0xE9002A40,
+ 0xE9002840,
+ 0xE9002640,
+ 0xE9002440,
+ 0xE9002240,
+ 0xE9002040,
+ 0xEA002040,
+ 0xEA002240
+};
+#endif // TRAD_FLAG
+
+#ifdef ULT_FLAG
+UINT32 PchLpPcieHsioAddr[] = {
+ 0xE9002440,
+ 0xE9002640,
+ 0xE9000840,
+ 0xE9000A40,
+ 0xE9000C40,
+ 0xE9000E40,
+ 0xE9001040,
+ 0xE9001240,
+ 0xEA002040,
+ 0xEA002240,
+ 0xEA002440,
+ 0xEA002640
+};
+#endif // ULT_FLAG
+
+/**
+ Set an Init Root Port Downstream devices S3 dispatch item, this function may assert if any error happend
+
+ @param[in] RootPortBus Pci Bus Number of the root port
+ @param[in] RootPortDevice Pci Device Number of the root port
+ @param[in] RootPortFunc Pci Function Number of the root port
+ @param[in] TempBusNumberMin Minimal temp bus number that can be assigned to the root port (as secondary
+ bus number) and its down stream switches
+ @param[in] TempBusNumberMax Maximal temp bus number that can be assigned to the root port (as subordinate
+ bus number) and its down stream switches
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+SetInitRootPortDownstreamS3Item (
+ IN UINT8 RootPortBus,
+ IN UINT8 RootPortDevice,
+ IN UINT8 RootPortFunc,
+ IN UINT8 TempBusNumberMin,
+ IN UINT8 TempBusNumberMax
+ )
+{
+ EFI_STATUS Status;
+#ifdef EFI_S3_RESUME
+ STATIC EFI_PCH_S3_SUPPORT_PROTOCOL *PchS3Support;
+ STATIC EFI_PCH_S3_PARAMETER_INIT_PCIE_ROOT_PORT_DOWNSTREAM S3ParameterRootPortDownstream;
+ STATIC EFI_PCH_S3_DISPATCH_ITEM S3DispatchItem = {
+ PchS3ItemTypeInitPcieRootPortDownstream,
+ &S3ParameterRootPortDownstream
+ };
+ EFI_PHYSICAL_ADDRESS S3DispatchEntryPoint;
+
+ if (!PchS3Support) {
+ ///
+ /// Get the PCH S3 Support Protocol
+ ///
+ Status = gBS->LocateProtocol (
+ &gEfiPchS3SupportProtocolGuid,
+ NULL,
+ (VOID **) &PchS3Support
+ );
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ }
+
+ S3ParameterRootPortDownstream.RootPortBus = RootPortBus;
+ S3ParameterRootPortDownstream.RootPortDevice = RootPortDevice;
+ S3ParameterRootPortDownstream.RootPortFunc = RootPortFunc;
+ S3ParameterRootPortDownstream.TempBusNumberMin = TempBusNumberMin;
+ S3ParameterRootPortDownstream.TempBusNumberMax = TempBusNumberMax;
+ Status = PchS3Support->SetDispatchItem (
+ PchS3Support,
+ &S3DispatchItem,
+ &S3DispatchEntryPoint
+ );
+ ASSERT_EFI_ERROR (Status);
+ ///
+ /// Save the script dispatch item in the Boot Script
+ ///
+ SCRIPT_DISPATCH (EFI_ACPI_S3_RESUME_SCRIPT_TABLE, S3DispatchEntryPoint);
+#else
+ Status = EFI_SUCCESS;
+#endif
+ return Status;
+}
+
+/**
+ Perform Initialization of the Downstream Root Ports.
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol
+ @param[in] RootComplexBar RCBA of the PCH
+ @param[in] PmBase The PM I/O Base address of the PCH
+ @param[in, out] FuncDisableReg The function disable register. IN / OUT parameter.
+
+ @retval EFI_SUCCESS The function completed successfully
+ @retval EFI_INVALID_PARAMETER The PCIe Root Port Number of D28:F0 is not found
+ or invalid
+**/
+EFI_STATUS
+PchInitRootPorts (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar,
+ IN UINT16 PmBase,
+ IN OUT UINT32 *FuncDisableReg
+ )
+{
+ EFI_STATUS Status;
+ UINT32 Data32And;
+ UINT32 Data32Or;
+ PCH_PCI_EXPRESS_CONFIG *PciExpressConfig;
+ UINT32 RpEnableMask;
+ UINT8 PortIndex;
+ UINTN RPBase;
+ UINT32 LoopTime;
+ UINTN PciD31F0RegBase;
+ UINTN PciD31F2RegBase;
+ UINTN PciD28F0RegBase;
+ UINTN PciD28F4RegBase;
+ UINT32 RpFnAnd;
+ UINT32 RpFnOr;
+ UINT32 StrpFuseCfg1;
+ UINT32 StrpFuseCfg2;
+ UINT8 RpLaneOwner;
+ UINT8 GbePort;
+ UINT8 NandPort;
+ UINT16 LpcDeviceId;
+ UINT32 BitMask;
+ UINT32 BitValue;
+ UINT8 FuncNum;
+ UINT8 RpPortFuncIndex;
+ UINT8 Func0PortNum;
+ ///
+ /// Whether a root port is hidden by another one with width > x1
+ ///
+ UINT32 RpHiddenMask;
+ ///
+ /// Subtractive Decode ports if enabled
+ ///
+ UINT32 SubDecodePort;
+ PCH_SERIES PchSeries;
+ UINT8 Mask;
+ BOOLEAN LanEnabled;
+
+ DEBUG ((EFI_D_INFO, "PchInitRootPorts() Start\n"));
+
+ PchSeries = GetPchSeries();
+ Status = EFI_SUCCESS;
+ RpEnableMask = 0;
+ RpHiddenMask = 0;
+ PciExpressConfig = PchPlatformPolicy->PciExpressConfig;
+ Data32And = 0xFFFFFFFF;
+ Data32Or = 0;
+ PciD31F0RegBase = MmPciAddress (
+ 0,
+ PchPlatformPolicy->BusNumber,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ 0
+ );
+ PciD31F2RegBase = MmPciAddress (
+ 0,
+ PchPlatformPolicy->BusNumber,
+ PCI_DEVICE_NUMBER_PCH_SATA,
+ PCI_FUNCTION_NUMBER_PCH_SATA,
+ 0
+ );
+ PciD28F0RegBase = MmPciAddress (
+ 0,
+ PchPlatformPolicy->BusNumber,
+ PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS,
+ GetPchPcieRpfn( RootComplexBar, PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_1),
+ 0
+ );
+ PciD28F4RegBase = MmPciAddress (
+ 0,
+ PchPlatformPolicy->BusNumber,
+ PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS,
+ GetPchPcieRpfn( RootComplexBar, PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_5),
+ 0
+ );
+ LpcDeviceId = MmioRead16 (PciD31F0RegBase + R_PCH_LPC_DEVICE_ID);
+ FuncNum = 0;
+ RpPortFuncIndex = 0;
+ Func0PortNum = 0xFF;
+ RpLaneOwner = 0;
+
+ ///
+ /// Configure root port function number mapping and configuration space hiding
+ /// Program at end of function
+ ///
+ RpFnAnd = 0xFFFFFFFF;
+ RpFnOr = 0;
+ for (PortIndex = 0; PortIndex < GetPchMaxPciePortNum (); PortIndex++) {
+ //
+ // if RootPortFunctionSwapping is enabled, Function number is equal to port index.
+ // else, use the function number mapping from platform policy.
+ //
+ if ((PchPlatformPolicy->Revision >= DXE_PCH_PLATFORM_POLICY_PROTOCOL_REVISION_3) &&
+ (PciExpressConfig->RootPortFunctionSwapping == 1)) {
+ FuncNum = PortIndex;
+ } else {
+ FuncNum = PciExpressConfig->RootPort[PortIndex].FunctionNumber;
+ }
+ RpFnAnd &= (UINT32) (~((B_PCH_RCRB_RPFN_RP1CH | B_PCH_RCRB_RPFN_RP1FN) << (PortIndex * S_PCH_RCRB_PRFN_RP_FIELD)));
+ RpFnOr |= (FuncNum) << (PortIndex * S_PCH_RCRB_PRFN_RP_FIELD);
+
+ if (FuncNum < GetPchMaxPciePortNum ()) {
+ ///
+ /// If FunctionNumber of the PCIE Root Port is duplicated, then disable the corresponding "Enable" field.
+ ///
+ if (RpPortFuncIndex & (UINT8) (1 << FuncNum)) {
+ DEBUG ((EFI_D_ERROR, " Hide Root Port %x since its FunctionNumber is duplicated.\n", PortIndex + 1));
+ ASSERT (FALSE);
+ PciExpressConfig->RootPort[PortIndex].Hide = PCH_DEVICE_ENABLE;
+ PciExpressConfig->RootPort[PortIndex].Enable = PCH_DEVICE_DISABLE;
+ RpHiddenMask |= (1 << PortIndex);
+ }
+ ///
+ /// Set RpPortFuncIndex while the FunctionNumber is used.
+ ///
+ RpPortFuncIndex |= (UINT8) (1 << FuncNum);
+ } else {
+ ///
+ /// If FunctionNumber of the PCIE Root Port is outside 7, the Root Port Config Hide bit will be set.
+ /// If so, then disable the corresponding "Enable" field.
+ ///
+ DEBUG ((EFI_D_ERROR, " Root Port %x will be hidden since its FunctionNumber is out of 7.\n", PortIndex + 1));
+ ASSERT (FALSE);
+ PciExpressConfig->RootPort[PortIndex].Enable = PCH_DEVICE_DISABLE;
+ RpHiddenMask |= (1 << PortIndex);
+ }
+
+ RpFnOr |= ((PciExpressConfig->RootPort[PortIndex].Hide) ? B_PCH_RCRB_RPFN_RP1CH : 0) << (PortIndex * S_PCH_RCRB_PRFN_RP_FIELD);
+ ///
+ /// Func0PortNum indicates which PCIe Root Port is D28:F0
+ ///
+ if (FuncNum == 0) {
+ Func0PortNum = PortIndex;
+ }
+ }
+
+ if (Func0PortNum >= GetPchMaxPciePortNum ()) {
+ DEBUG ((EFI_D_ERROR, "The PCIe Root Port Number of D28:F0 is not found or invalid!\n"));
+ return EFI_INVALID_PARAMETER;
+ }
+ ///
+ /// Hide PCIE root port 1-4 according to the PCIE port configuration 1
+ ///
+ StrpFuseCfg1 = MmioRead32 (PciD28F0RegBase + R_PCH_PCIE_STRPFUSECFG);
+ switch (StrpFuseCfg1 & (UINT32) B_PCH_PCIE_STRPFUSECFG_RPC) {
+ case V_PCH_PCIE_STRPFUSECFG_RPC_2_1_1:
+ ///
+ /// Port Configuration = 01b: 1x2, 2x1 Port 1 (x2), Port 2 (disabled), Ports 3, 4 (x1)
+ ///
+ RpHiddenMask |= BIT1;
+ break;
+
+ case V_PCH_PCIE_STRPFUSECFG_RPC_2_2:
+ ///
+ /// Port Configuration = 10b: 2x2 Port 1 (x2), Port 3 (x2), Ports 2, 4 (disabled)
+ ///
+ RpHiddenMask |= (BIT1 | BIT3);
+ break;
+
+ case V_PCH_PCIE_STRPFUSECFG_RPC_4:
+ ///
+ /// Port Configuration = 11b: 1x4 Port 1 (x4), Ports 2-4 (disabled)
+ ///
+ RpHiddenMask |= (BIT1 | BIT2 | BIT3);
+ break;
+
+ default:
+ break;
+ }
+
+ if (PchSeries == PchH) {
+ ///
+ /// Hide PCIE root port 5-8 according to the PCIE port configuration
+ ///
+ StrpFuseCfg2 = MmioRead32 (PciD28F4RegBase + R_PCH_PCIE_STRPFUSECFG);
+ switch (StrpFuseCfg2 & (UINT32) B_PCH_PCIE_STRPFUSECFG_RPC) {
+ case V_PCH_PCIE_STRPFUSECFG_RPC_2_1_1:
+ ///
+ /// Port Configuration = 01b: 1x2, 2x1 Port 5 (x2), Port 6 (disabled), Ports 7, 8 (x1)
+ ///
+ RpHiddenMask |= BIT5;
+ break;
+
+ case V_PCH_PCIE_STRPFUSECFG_RPC_2_2:
+ ///
+ /// Port Configuration = 10b: 2x2 Port 5 (x2), Port 7 (x2), Ports 6, 8 (disabled)
+ ///
+ RpHiddenMask |= (BIT5 | BIT7);
+ break;
+
+ case V_PCH_PCIE_STRPFUSECFG_RPC_4:
+ ///
+ /// Port Configuration = 11b: 1x4 Port 5 (x4), Ports 6-8 (disabled)
+ ///
+ RpHiddenMask |= (BIT5 | BIT6 | BIT7);
+ break;
+
+ default:
+ break;
+ }
+ }
+ ///
+ /// If GBE Over PCIe Enabled, then System BIOS must disable the PCI Express* Root Port
+ ///
+ LanEnabled = !(MmioRead32 (RootComplexBar + R_PCH_RCRB_BUC) & B_PCH_RCRB_BUC_LAN_DIS);
+
+ if ((StrpFuseCfg1 & B_PCH_PCIE_STRPFUSECFG_GBE_PCIE_PEN) && LanEnabled) {
+ GbePort = (UINT8) ((StrpFuseCfg1 & B_PCH_PCIE_STRPFUSECFG_GBE_PCIEPORTSEL) >> N_PCH_PCIE_STRPFUSECFG_GBE_PCIEPORTSEL);
+ } else {
+ GbePort = 0xFF;
+ }
+ ///
+ /// If NAND Over PCIe Enabled, then System BIOS must disable the PCI Express* Root Port
+ ///
+ if ((MmioRead32 (PciD31F2RegBase + 0x300) & BIT0) != 0) {
+ NandPort = (UINT8) (((MmioRead32 (PciD31F2RegBase + 0x300)) & 0x1FE) >> 1);
+ } else {
+ NandPort = 0x00;
+ }
+ if (PchSeries == PchH) {
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 8.14 Additional PCI Express* Programming Steps
+ /// Step 3
+ /// Function disable unused PCIE port
+ /// Disable PCIe Port 1 if either of the conditions are met
+ /// i. B0:D28:F0 + 410h[4] = 0b and B0:D28:F0 + 410h[0] = 0b
+ /// ii. GbeOverPCIe is configured to use Pcie Port 1 and SATA port 4 is mapped to this lane instead of PCIe Port 1
+ /// iii. NandOverPCIe is configured to use PCIe Port 1
+ /// NOTE:
+ /// For condition ii, if Gbe is configured to Pcie Port 1, and Pcie Port 1 ownes the shared lane instead of SATA port 4,
+ /// then it supports Gbe + 8 PCIES configuration, and BIOS won't hide the Root Port 1.
+ ///
+ RpLaneOwner = MmioRead8 (PciD28F0RegBase + 0x410);
+ if ((((RpLaneOwner & (BIT4)) == 0x0) && ((RpLaneOwner & BIT0) == 0x0)) ||
+ ((GbePort == 0x0) && ((RpLaneOwner & (BIT4)) == 0)) ||
+ (NandPort == BIT0)) {
+ RpHiddenMask |= BIT0;
+ }
+ }
+ if (PchSeries == PchLp) {
+ ///
+ /// Function disabled unused PCIE port
+ /// Disable PCIe Port 1 if either of the conditions are met
+ /// i. B0:D28:F0 + 410h [1:0] = 00b or 10b
+ /// ii. NandOverPCIe is configured to use PCIe Port 1
+ ///
+ if (((MmioRead32 (PciD28F0RegBase + 0x410) & (BIT1 | BIT0)) == 0) ||
+ ((MmioRead32 (PciD28F0RegBase + 0x410) & (BIT1 | BIT0)) == BIT1) ||
+ (NandPort == BIT0)) {
+ RpHiddenMask |= BIT0;
+ }
+ }
+ if (PchSeries == PchH) {
+ ///
+ /// Disable PCIe Port 2 if either of the conditions are met
+ /// i. B0:D28:F0 + 410h [5] = 0b and B0:D28:F0 + 410h [2] = 0b
+ /// ii. GbeOverPCIe is configured to use Pcie Port 2 and SATA port 5 is mapped to this lane instead of PCIe Port 2
+ /// iii. NandOverPCIe is configured to use PCIe Port 2
+ /// NOTE:
+ /// For condition ii, if Gbe is configured to Pcie Port 2, and Pcie Port 2 ownes the shared lane instead of SATA port 5,
+ /// then it supports Gbe + 8 PCIES configuration, and BIOS won't hide the Root Port 2.
+ ///
+ if ((((RpLaneOwner & (BIT5)) == 0x0) && ((RpLaneOwner & BIT2) == 0x0)) ||
+ ((GbePort == 0x1) && ((RpLaneOwner & (BIT5)) == 0)) ||
+ (NandPort == BIT1)) {
+ RpHiddenMask |= BIT1;
+ }
+ }
+ if (PchSeries == PchLp) {
+ ///
+ /// Disable PCIe Port 2 if either of the conditions are met
+ /// i. B0:D28:F0 + 410h [3:2] = 00b or 10b
+ /// ii. NandOverPCIe is configured to use PCIe Port 2
+ ///
+ if (((MmioRead32 (PciD28F0RegBase + 0x410) & (BIT3 | BIT2)) == 0) ||
+ ((MmioRead32 (PciD28F0RegBase + 0x410) & (BIT3 | BIT2)) == BIT3) ||
+ (NandPort == BIT1)) {
+ RpHiddenMask |= BIT1;
+ }
+ }
+ ///
+ /// Disable PCIe Port 3 if GbeOverPCIe is configured to use Port 3
+ ///
+ if ((PchSeries == PchH) && (GbePort == 0x2)) {
+ RpHiddenMask |= BIT2;
+ }
+ if ((PchSeries == PchLp) && (GbePort == 0x0)) {
+ RpHiddenMask |= BIT2;
+ }
+ ///
+ /// Disable PCIe Port 4 if GbeOverPCIe is configured to use Port 4
+ ///
+ if ((PchSeries == PchH) && (GbePort == 0x3)) {
+ RpHiddenMask |= BIT3;
+ }
+ if ((PchSeries == PchLp) && (GbePort == 0x1)) {
+ RpHiddenMask |= BIT3;
+ }
+ ///
+ /// Disable PCIe Port 5 if GbeOverPCIe is configured to use Port 5
+ /// or NandOverPCIe is configure to use Port 5
+ ///
+ if ((PchSeries == PchH) && (GbePort == 0x4 || NandPort == BIT4)) {
+ RpHiddenMask |= BIT4;
+ }
+ ///
+ /// Disable PCIe Port 5 if GbeOverPCIe is configured to use Port 5
+ /// NandOverPCIe is configure to use Port 5
+ ///
+ if ((PchSeries == PchLp) && (GbePort == 0x2 || GbePort == 0x3 || GbePort == 0x4 || GbePort == 0x5 || NandPort == BIT4)) {
+ RpHiddenMask |= BIT4;
+ }
+ ///
+ /// Disable PCIe Port 6 if GbeOverPCIe is configured to use Port 6
+ /// or NandOverPCIe is configure to use Port 6
+ ///
+ if ((PchSeries == PchH) && (GbePort == 0x5 || NandPort == BIT5)) {
+ RpHiddenMask |= BIT5;
+ }
+ ///
+ /// Disable PCIe Port 6 if SATA P1-P4 is configured
+ /// to use Port 6 Lane 0 - Lane 3
+ /// or NandOverPCIe is configure to use Port 6
+ ///
+ if ((PchSeries == PchLp) && ((MmioRead32 (PciD28F0RegBase + 0x410) & (BIT7 | BIT6 | BIT5 | BIT4)) == 0x0) || NandPort == BIT5) {
+ RpHiddenMask |= BIT5;
+ }
+ if (PchSeries == PchH) {
+ ///
+ /// Disable PCIe Port 7 if GbeOverPCIe is configured to use Port 7
+ ///
+ if (GbePort == 0x6) {
+ RpHiddenMask |= BIT6;
+ }
+ ///
+ /// Disable PCIe Port 8 if GbeOverPCIe is configured to use Port 8
+ ///
+ if (GbePort == 0x7) {
+ RpHiddenMask |= BIT7;
+ }
+ }
+ if (((MmioRead32 ((UINTN) (RootComplexBar + 0x1030))) & ((UINT32) (BIT22))) &&
+ (PciExpressConfig->EnableSubDecode)) {
+ ///
+ /// Assert if Subtractive Decode Port is disabled by configuration
+ ///
+ ASSERT_EFI_ERROR ((RpHiddenMask & (B_PCH_RCRB_FUNC_DIS_PCI_EX_PORT1 <<
+ (PciExpressConfig->PchPcieSbdePort))) == 0x1);
+ SubDecodePort = PciExpressConfig->PchPcieSbdePort;
+ } else {
+ SubDecodePort = 0xFF;
+ }
+ ///
+ /// The port of function number 0 might be disabled.
+ /// Will swap the function number 0 to enabled port on the end of this function.
+ /// Gather the enabled root ports here.
+ ///
+ for (PortIndex = 0; PortIndex < GetPchMaxPciePortNum (); PortIndex++) {
+ if ((PciExpressConfig->RootPort[PortIndex].Enable) &&
+ (((*FuncDisableReg) & (B_PCH_RCRB_FUNC_DIS_PCI_EX_PORT1 << PortIndex)) == 0)) {
+ RpEnableMask |= 1 << PortIndex;
+ }
+ }
+ ///
+ /// Disable the port which is going to be hidden.
+ ///
+ if (RpEnableMask != 0) {
+ RpEnableMask &= ~(RpHiddenMask);
+ }
+ //
+ // If RootPortFunctionSwapping is disabled, force to enable the root port of function 0
+ //
+ if (!((PchPlatformPolicy->Revision >= DXE_PCH_PLATFORM_POLICY_PROTOCOL_REVISION_3) &&
+ (PciExpressConfig->RootPortFunctionSwapping == 1))) {
+ RpEnableMask |= 1 << Func0PortNum;
+ }
+ for (PortIndex = 0; PortIndex < GetPchMaxPciePortNum (); PortIndex++) {
+ FuncNum = GetPchPcieRpfn (RootComplexBar, PortIndex);
+ RPBase = MmPciAddress (
+ 0,
+ PchPlatformPolicy->BusNumber,
+ PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS,
+ FuncNum,
+ 0
+ );
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.0 Section 8.2
+ /// Else if the port is hot-plug enable, do not disable the port. If BIOS wants to disable the port,
+ /// BIOS should not enable the hot plug capability or must disable the hot plug capability of the port.
+ /// Set B0:D28:Fn + 338h [26] = 0b at early POST. Done in PchInitPeim.c PchMiscInit().
+ ///
+ /// Enabled Slot implemented for the enabled PCIE Root Ports. This is due to new PCIe disabling methodtology
+ /// to check if any is populated on the slots.
+ ///
+ if ((RpHiddenMask & (1 << PortIndex)) == 0) {
+ MmioOr16 (RPBase + R_PCH_PCIE_XCAP, B_PCH_PCIE_XCAP_SI);
+ }
+
+ if ((RpHiddenMask & (1 << PortIndex)) != 0) {
+ *FuncDisableReg |= B_PCH_RCRB_FUNC_DIS_PCI_EX_PORT1 << PortIndex;
+ } else if (((RpEnableMask & (1 << PortIndex)) != 0) &&
+ ((MmioRead16 (RPBase + R_PCH_PCIE_SLSTS) & BIT6) == 0) &&
+ (PciExpressConfig->RootPort[PortIndex].HotPlug == 0) &&
+ (PortIndex != SubDecodePort)) {
+ ///
+ /// PCH BIOS Spec Rev 0.5.0 Section 8.2
+ /// Else if the port is not hot plug enable and no PCIe card is detected,
+ /// Set B0:D28:Fn + 338h [26] = 1b
+ /// Poll B0:D28:Fn + 328h [31:24] until 01h or else 50ms timeout
+ /// Set B0:D28:Fn + 408h [27] = 1b
+ /// Function disable the port at RCBA+ 3418
+ ///
+ Data32And = 0xFFFFFFFF;
+ Data32Or = (UINT32) BIT26;
+ MmioOr32 ((RPBase + 0x338), Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RPBase + 0x338),
+ &Data32Or, // Data to be ORed
+ &Data32And // Data to be ANDed
+ );
+
+ BitMask = (UINT32) (BIT31 | BIT30 | BIT29 | BIT28 | BIT27 | BIT26 | BIT25 | BIT24);
+ BitValue = 1 << 24;
+ for (LoopTime = 0; LoopTime < 500; LoopTime++) {
+ if ((MmioRead32 (RPBase + 0x328) & BitMask) == BitValue) {
+ break;
+ } else {
+ PchPmTimerStall (100);
+ }
+ }
+ SCRIPT_MEM_POLL (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ RPBase + 0x328,
+ &BitMask,
+ &BitValue,
+ 50,
+ 1000
+ );
+
+ Data32And = 0xFFFFFFFF;
+ Data32Or = (UINT32) BIT27;
+ MmioOr32 ((RPBase + 0x408), Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RPBase + 0x408),
+ &Data32Or, // Data to be ORed
+ &Data32And // Data to be ANDed
+ );
+ *FuncDisableReg |= B_PCH_RCRB_FUNC_DIS_PCI_EX_PORT1 << PortIndex;
+ } else if ((RpEnableMask & (1 << PortIndex)) == 0) {
+ ///
+ /// Else if the port is not hot plug enable, and BIOS wants to disable the port
+ /// If a PCIe card is detected, set B0:D28:Fn + 50h[4] = 1b
+ /// followed by function disable the port at RCBA + 3418h
+ ///
+ if ((MmioRead16 (RPBase + R_PCH_PCIE_SLSTS) & BIT6) != 0) {
+ MmioOr16 ((RPBase + R_PCH_PCIE_LCTL), (UINT16) BIT4);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (RPBase + R_PCH_PCIE_LCTL),
+ 1,
+ (VOID *) (UINTN) (RPBase + R_PCH_PCIE_LCTL)
+ );
+ }
+ *FuncDisableReg |= B_PCH_RCRB_FUNC_DIS_PCI_EX_PORT1 << PortIndex;
+ } else {
+ ///
+ /// Configure the rootports
+ ///
+ Status = PchInitSingleRootPort (
+ (UINT8) PortIndex,
+ FuncNum,
+ PchPlatformPolicy,
+ PmBase,
+ RootComplexBar
+ );
+ if (!EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, " Root Port %x device enabled. RpEnableMask: 0x%x\n", PortIndex + 1, RpEnableMask));
+ }
+
+ if ((PciExpressConfig->RootPort[PortIndex].TransmitterHalfSwing) &&
+ (((MmioRead32 (RPBase + 0x328) & (0x00780000)) >> 19) == 0x7)) {
+ MmioOr8 (RPBase + R_PCH_PCIE_LCTL, B_PCH_PCIE_LCTL_LD);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (RPBase + R_PCH_PCIE_LCTL),
+ 1,
+ (VOID *) (UINTN) (RPBase + R_PCH_PCIE_LCTL)
+ );
+ MmioOr16 (RPBase + R_PCH_PCIE_PECR1, BIT13);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (RPBase + R_PCH_PCIE_PECR1),
+ 1,
+ (VOID *) (UINTN) (RPBase + R_PCH_PCIE_PECR1)
+ );
+ MmioAnd8 (RPBase + R_PCH_PCIE_LCTL, (UINT8) ~(B_PCH_PCIE_LCTL_LD));
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (RPBase + R_PCH_PCIE_LCTL),
+ 1,
+ (VOID *) (UINTN) (RPBase + R_PCH_PCIE_LCTL)
+ );
+ }
+ }
+
+ if (MmioRead32 (RPBase) == 0xFFFFFFFF) {
+ continue;
+ }
+
+ if ((PchSeries == PchH) && (PortIndex == 0 || PortIndex == 4)) {
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 8.14 Additional PCI Express* Programming Steps
+ /// Step 19
+ /// Set B0:F28:F0&F4 + F7h[3:2] = 00b
+ ///
+ MmioAnd8 (RPBase + 0xF7, (UINT8) ~(BIT3 | BIT2));
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (RPBase + 0xF7),
+ 1,
+ (VOID *) (UINTN) (RPBase + 0xF7)
+ );
+ }
+ if ((PchSeries == PchLp) && (PortIndex == 0 || PortIndex == 4 || PortIndex == 5)) {
+ ///
+ /// Set B0:F28:F0,F4&F5 + F7h[3:2] = 00b
+ ///
+ MmioAnd8 (RPBase + 0xF7, (UINT8) ~(BIT3 | BIT2));
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (RPBase + 0xF7),
+ 1,
+ (VOID *) (UINTN) (RPBase + 0xF7)
+ );
+ }
+
+ if ((RpHiddenMask & (1 << PortIndex)) == 0) {
+ ///
+ /// Disable the forwarding of EOI messages.
+ /// Set B0:D28:F0/F1/F2/F3/F4/F5/F6/F7 + D4h [1] = 1b
+ ///
+ #ifdef HOTPLUG_EOI_FLAG // AMI_OVERRIDE, [EIP84720]>
+ MmioOr8 (RPBase + 0xD4, (UINT8) (BIT1));
+ #else
+ //Supporting _RMV method in asl code, and reading hotplug capability register of root port
+ //if hotplug disable, then set EOI Forwarding Disable bit
+ #ifdef TBT_UP_PORT_FUNC_FLAG
+ if((TBT_UP_PORT_FUNC == PortIndex) || (!(MmioRead8 (RPBase + 0x54) & 0x40)))
+ #else
+ if(!(MmioRead8 (RPBase + 0x54) & 0x40))
+ #endif
+ MmioOr8 (RPBase + 0xD4, (UINT8) (BIT1));
+ #endif // AMI_OVERRIDE, [EIP84720]<
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (RPBase + 0xD4),
+ 1,
+ (VOID *) (UINTN) (RPBase + 0xD4)
+ );
+ }
+ }
+ //
+ // If RootPortFunctionSwapping is disabled, force to enable the root port of function 0
+ //
+ if (!((PchPlatformPolicy->Revision >= DXE_PCH_PLATFORM_POLICY_PROTOCOL_REVISION_3) &&
+ (PciExpressConfig->RootPortFunctionSwapping == 1))) {
+ Mask = (0xFF >>(8-GetPchMaxPciePortNum ()));
+ if (((*FuncDisableReg >> N_PCH_RCRB_FUNC_DIS_PCI_EX_PORT1) & Mask) != Mask) {
+ *FuncDisableReg &= ~(B_PCH_RCRB_FUNC_DIS_PCI_EX_PORT1 << Func0PortNum);
+ }
+ }
+
+ ///
+ /// Configure root port clock gating
+ ///
+ RpEnableMask = (UINT8)~(*FuncDisableReg >> 16);
+ if (PciExpressConfig->RootPortClockGating) {
+ PcieEnableClockGating (
+ PchPlatformPolicy->BusNumber,
+ PchPlatformPolicy,
+ RpEnableMask,
+ RpHiddenMask,
+ RootComplexBar,
+ NandPort
+ );
+ }
+
+ ///
+ /// Enable PCIE Relaxed Order. It always allows downstream completions to pass posted write.
+ /// Set B0:D28:Fx offset 320h [24,23] to 1, 1b.
+ /// Set RCBA 2314h[31,7] to 1, 1b.
+ /// Set RCBA 1114h[15,14] to 1, 1b.
+ ///
+ for (FuncNum = 0; FuncNum < GetPchMaxPciePortNum (); FuncNum++) {
+ RPBase = MmPciAddress (
+ 0,
+ PchPlatformPolicy->BusNumber,
+ PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS,
+ FuncNum,
+ 0
+ );
+ if (MmioRead16 (RPBase + R_PCH_PCIE_VENDOR_ID) == 0xFFFF) {
+ continue;
+ }
+ MmioOr32 (RPBase + R_PCH_PCIE_PECR2, (BIT24 | BIT23));
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RPBase + R_PCH_PCIE_PECR2),
+ 1,
+ (VOID *) (UINTN) (RPBase + R_PCH_PCIE_PECR2)
+ );
+ }
+ MmioOr32 (RootComplexBar + R_PCH_RCRB_CIR2314, (BIT31 | BIT7));
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_CIR2314),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + R_PCH_RCRB_CIR2314)
+ );
+ MmioOr16 (RootComplexBar + 0x1114, (BIT15 | BIT14));
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (RootComplexBar + 0x1114),
+ 1,
+ (VOID *) (UINTN) (RootComplexBar + 0x1114)
+ );
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 8.14 Additional PCI Express* Programming Steps
+ /// Step 4
+ /// Reconfigured the Function number using RPFN register at RCBA + 404h if function 0 (F0) is disabled
+ /// (If Port of function 0 is disable, swap the function number with other enabled port)
+ ///
+ if ((PchPlatformPolicy->Revision >= DXE_PCH_PLATFORM_POLICY_PROTOCOL_REVISION_3) &&
+ (PciExpressConfig->RootPortFunctionSwapping == 1)) {
+ Func0PortNum = 0xFF;
+ for (PortIndex = 0; PortIndex < GetPchMaxPciePortNum (); PortIndex++) {
+ FuncNum = (UINT8)((RpFnOr >> (PortIndex * S_PCH_RCRB_PRFN_RP_FIELD)) & B_PCH_RCRB_RPFN_RP1FN);
+ if (FuncNum == 0) {
+ Func0PortNum = PortIndex;
+ break;
+ }
+ }
+ if ((Func0PortNum < GetPchMaxPciePortNum ()) && ((RpEnableMask & (BIT0 << Func0PortNum)) == 0)) {
+ for (PortIndex = 0; PortIndex < GetPchMaxPciePortNum (); PortIndex++) {
+ if ((RpEnableMask & (BIT0 << PortIndex)) != 0) {
+ FuncNum = (UINT8)((RpFnOr >> (PortIndex * S_PCH_RCRB_PRFN_RP_FIELD)) & B_PCH_RCRB_RPFN_RP1FN);
+ RpFnOr &= ((UINT32)~(B_PCH_RCRB_RPFN_RP1FN << (Func0PortNum * S_PCH_RCRB_PRFN_RP_FIELD))) &
+ ((UINT32)~(B_PCH_RCRB_RPFN_RP1FN << (PortIndex * S_PCH_RCRB_PRFN_RP_FIELD)));
+ RpFnOr |= ((UINT32)(((UINT32)FuncNum) << (Func0PortNum * S_PCH_RCRB_PRFN_RP_FIELD)));
+ break;
+ }
+ }
+ }
+ }
+
+ MmioAndThenOr32 (RootComplexBar + R_PCH_RCRB_RPFN, RpFnAnd, RpFnOr);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RootComplexBar + R_PCH_RCRB_RPFN),
+ &RpFnOr, // Data to be ORed
+ &RpFnAnd // Data to be ANDed
+ );
+
+ DEBUG ((EFI_D_INFO, "PchInitRootPorts() End\n"));
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Perform Root Port Initialization.
+
+ @param[in] RootPort The root port to be initialized (zero based)
+ @param[in] RootPortFunction The PCI function number of the root port
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol
+ @param[in] PmBase The PM I/O Base address of the PCH
+ @param[in] RootComplexBar RCBA of the PCH
+
+ @retval EFI_SUCCESS Device found. The root port must be enabled.
+ @retval EFI_NOT_FOUND No device is found on the root port. It may be disabled.
+ @exception EFI_UNSUPPORTED Unsupported operation.
+**/
+EFI_STATUS
+PchInitSingleRootPort (
+ IN UINT8 RootPort,
+ IN UINT8 RootPortFunction,
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT16 PmBase,
+ IN UINT32 RootComplexBar
+ )
+{
+ EFI_STATUS Status;
+ UINTN RPBase;
+ UINTN LpcBase;
+ UINTN PciD28F0RegBase;
+ UINTN PciD28F4RegBase;
+ UINTN PciD28F5RegBase;
+ UINT32 CapOffset;
+ UINT8 BusNumber;
+ UINT32 Data32;
+ UINT16 Data16;
+ UINT32 Data32Or;
+ UINT32 Data32And;
+ UINT16 Data16Or;
+ UINT16 Data16And;
+ UINT32 PcieNccSSc;
+ UINT8 DeviceLaneOwner;
+ UINT32 PchPcieHsioAddrPerPort[4];
+ UINT8 NumOfLanePerPort;
+ UINT8 LaneIndex;
+ PCH_PCI_EXPRESS_ROOT_PORT_CONFIG *RootPortConfig;
+ BOOLEAN DeviceFound;
+ PCH_SERIES PchSeries;
+ UINT32 DeviceClassDword;
+
+ PchSeries = GetPchSeries();
+ DeviceFound = FALSE;
+ RootPortConfig = &PchPlatformPolicy->PciExpressConfig->RootPort[RootPort];
+ BusNumber = PchPlatformPolicy->BusNumber;
+ RPBase = MmPciAddress (0, BusNumber, PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS, RootPortFunction, 0);
+ LpcBase = MmPciAddress (0, BusNumber, PCI_DEVICE_NUMBER_PCH_LPC, PCI_FUNCTION_NUMBER_PCH_LPC, 0);
+ PciD28F0RegBase = MmPciAddress (0, BusNumber, PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS, GetPchPcieRpfn( RootComplexBar, PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_1), 0);
+ PciD28F4RegBase = MmPciAddress (0, BusNumber, PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS, GetPchPcieRpfn( RootComplexBar, PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_5), 0);
+ PciD28F5RegBase = 0;
+ DeviceClassDword = 0;
+ if (PchSeries == PchLp) {
+ PciD28F5RegBase = MmPciAddress (0, BusNumber, PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS, GetPchPcieRpfn( RootComplexBar, PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_6), 0);
+ }
+ CapOffset = PcieFindCapId (
+ BusNumber,
+ PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS,
+ RootPortFunction,
+ 0x10
+ );
+
+ if (CapOffset == 0) {
+ return EFI_UNSUPPORTED;
+ }
+
+ PcieNccSSc = 0;
+ NumOfLanePerPort = 0;
+ switch (RootPort) {
+ case PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_1:
+ PcieNccSSc = MmioRead32 (PciD28F0RegBase + 0x32C) & BIT28;
+ break;
+
+ case PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_2:
+ PcieNccSSc = MmioRead32 (PciD28F0RegBase + 0x32C) & BIT29;
+ break;
+
+ case PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_3:
+ PcieNccSSc = MmioRead32 (PciD28F0RegBase + 0x32C) & BIT30;
+ break;
+
+ case PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_4:
+ PcieNccSSc = MmioRead32 (PciD28F0RegBase + 0x32C) & BIT31;
+ break;
+
+ case PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_5:
+ PcieNccSSc = MmioRead32 (PciD28F4RegBase + 0x32C) & BIT28;
+ break;
+
+ case PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_6:
+ if (PchSeries == PchH) {
+ PcieNccSSc = MmioRead32 (PciD28F4RegBase + 0x32C) & BIT29;
+ } else if (PchSeries == PchLp) {
+ PcieNccSSc = MmioRead32 (PciD28F5RegBase + 0x32C) & BIT29;
+ }
+ break;
+
+ case PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_7:
+ if (PchSeries == PchH) {
+ PcieNccSSc = MmioRead32 (PciD28F4RegBase + 0x32C) & BIT30;
+ }
+ break;
+
+ case PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_8:
+ if (PchSeries == PchH) {
+ PcieNccSSc = MmioRead32 (PciD28F4RegBase + 0x32C) & BIT31;
+ }
+ break;
+
+ default:
+ PcieNccSSc = 0;
+ }
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 8.14 Additional PCI Express* Programming Steps
+ /// Step 5
+ /// If corresponding Root Port 4 to 1 in B0:D28:F0 + 32Ch [31:28], Root Port 8 to 5
+ /// in B0:D28:F4 + 32Ch [31:28], is set, for EACH PORT (x):
+ ///
+ if (PcieNccSSc) {
+ ///
+ /// Step 5.1, 5.2
+ /// Set B0:D28:Fx + D4h[4] = 1b
+ /// Set B0:D28:Fx + D4h[3:2] = 10b
+ ///
+ MmioAndThenOr8 ((RPBase + 0xD4), (UINT8)~BIT2, BIT4 | BIT3);
+ ///
+ /// Step 5.3
+ /// Set B0:D28:Fx + D8h[20:18] = 111b
+ ///
+ MmioOr32 ((RPBase + 0xD8), BIT20 | BIT19 | BIT18);
+ ///
+ /// Step 5.4
+ /// Set B0:D28:Fx + 4Ch[17:15] = 100b, see also step 9.
+ ///
+ MmioAndThenOr32 ((RPBase + 0x4C), (UINT32)~(BIT16 | BIT15), BIT17);
+#ifdef ULT_FLAG
+ if (PchSeries == PchLp) {
+ ///
+ /// Step 5.5
+ /// Read the IOBP register below, increase the values by 2 and write back.
+ /// E9002440 [20:16], [12:8]
+ /// E9002640 [20:16], [12:8]
+ /// E9000840 [20:16], [12:8]
+ /// E9000A40 [20:16], [12:8]
+ /// E9000C40 [20:16], [12:8]
+ /// E9000E40 [20:16], [12:8]
+ /// E9001040 [20:16], [12:8]
+ /// E9001240 [20:16], [12:8]
+ /// EA002040 [20:16], [12:8]
+ /// EA002240 [20:16], [12:8]
+ /// EA002440 [20:16], [12:8]
+ /// EA002640 [20:16], [12:8]
+ ///
+ DeviceLaneOwner = MmioRead8 (PciD28F0RegBase + 0x410);
+ if (RootPort == PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_5) {
+ NumOfLanePerPort = 4;
+ PchPcieHsioAddrPerPort[0] = PchLpPcieHsioAddr[4];
+ PchPcieHsioAddrPerPort[1] = PchLpPcieHsioAddr[5];
+ PchPcieHsioAddrPerPort[2] = PchLpPcieHsioAddr[6];
+ PchPcieHsioAddrPerPort[3] = PchLpPcieHsioAddr[7];
+ } else if (RootPort == PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_6) {
+ NumOfLanePerPort = 0;
+ if ((DeviceLaneOwner & BIT4) == BIT4) {
+ PchPcieHsioAddrPerPort[NumOfLanePerPort++] = PchLpPcieHsioAddr[8];
+ }
+ if ((DeviceLaneOwner & BIT5) == BIT5) {
+ PchPcieHsioAddrPerPort[NumOfLanePerPort++] = PchLpPcieHsioAddr[9];
+ }
+ if ((DeviceLaneOwner & BIT6) == BIT6) {
+ PchPcieHsioAddrPerPort[NumOfLanePerPort++] = PchLpPcieHsioAddr[10];
+ }
+ if ((DeviceLaneOwner & BIT7) == BIT7) {
+ PchPcieHsioAddrPerPort[NumOfLanePerPort++] = PchLpPcieHsioAddr[11];
+ }
+ } else {
+ NumOfLanePerPort = 1;
+ PchPcieHsioAddrPerPort[0] = PchLpPcieHsioAddr[RootPort];
+ }
+ }
+#endif // ULT_FLAG
+#ifdef TRAD_FLAG
+ if (PchSeries == PchH) {
+ ///
+ /// Step 5.5
+ /// Read the IOBP register below, increase the values by 2 and write back.
+ /// Dedicated lane Setting
+ /// E9002040 [20:16], [12:8]
+ /// E9002240 [20:16], [12:8]
+ /// E9002440 [20:16], [12:8]
+ /// E9002640 [20:16], [12:8]
+ /// E9002840 [20:16], [12:8]
+ /// E9002A40 [20:16], [12:8]
+ /// Shared lane Setting
+ /// E9002C40 [20:16], [12:8]
+ /// E9002E40 [20:16], [12:8]
+ /// EA002040 [20:16], [12:8]
+ /// EA002240 [20:16], [12:8]
+ ///
+ DeviceLaneOwner = MmioRead8 (PciD28F0RegBase + 0x410);
+ NumOfLanePerPort = 1;
+ if (RootPort == PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_1) {
+ if ((DeviceLaneOwner & (BIT1 | BIT0)) == BIT0) {
+ PchPcieHsioAddrPerPort[0] = PchHPcieHsioAddr[0];
+ } else {
+ PchPcieHsioAddrPerPort[0] = PchHPcieHsioAddr[8];
+ }
+ } else if (RootPort == PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_2) {
+ if ((DeviceLaneOwner & (BIT3 | BIT2)) == BIT2) {
+ PchPcieHsioAddrPerPort[0] = PchHPcieHsioAddr[1];
+ } else {
+ PchPcieHsioAddrPerPort[0] = PchHPcieHsioAddr[9];
+ }
+ } else {
+ PchPcieHsioAddrPerPort[0] = PchHPcieHsioAddr[RootPort];
+ }
+ }
+#endif // TRAD_FLAG
+ for (LaneIndex = 0; LaneIndex < NumOfLanePerPort; LaneIndex++) {
+ Status = ReadIobp (
+ RootComplexBar,
+ PchPcieHsioAddrPerPort[LaneIndex],
+ &Data32
+ );
+ ASSERT_EFI_ERROR (Status);
+ Data32 += 0x00020200;
+ Status = ProgramIobp (
+ RootComplexBar,
+ PchPcieHsioAddrPerPort[LaneIndex],
+ 0x0,
+ Data32
+ );
+ ASSERT_EFI_ERROR (Status);
+ Status = SetProgramIobpS3Item (
+ RootComplexBar,
+ PchPcieHsioAddrPerPort[LaneIndex],
+ 0x0,
+ Data32
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
+ ///
+ /// Step 5.6
+ /// Set B0:D28:Fx + 338h[26] = 0b
+ ///
+ MmioAnd32 ((RPBase + 0x338), (UINT32)~BIT26);
+ }
+
+ Data32 = MmioRead32 (RPBase + R_PCH_PCIE_DCAP2);
+ ///
+ /// PCH BIOS Spec Rev 0.5.5, Section 8.14.1 Power Optimizer Configuration
+ /// Step 1
+ /// Enable support Latency Tolerance Reporting (LTR)
+ /// Step 1.1
+ /// Program B0:D28:F0~F7 + 400h to 883C883Ch for ports which has a PCIe
+ /// device attached to it.
+ /// Done in PcieSetPm()
+ /// Step 1.2
+ /// Program B0:D28:F0~F7 + 404h [1:0] = 11b for ports which has a PCIe device
+ /// device attached to it.
+ /// Done in PcieSetPm()
+ /// Step 1.3
+ /// Program B0:D28:F0-F7 + 64h [11] = 1b
+ ///
+ if (PchPlatformPolicy->PwrOptConfig->PchPwrOptPcie[RootPort].LtrEnable == PCH_DEVICE_ENABLE) {
+ Data32 |= BIT11;
+ } else {
+ Data32 &= (UINT32) ~(BIT11);
+ }
+ ///
+ /// Step 2
+ /// Support Optimized Buffer Flush/Fill (OBFF)
+ /// Step 2.1
+ /// Program B0:D28:F0-F7 + 64h [19:18] = 2h
+ ///
+ if (PchPlatformPolicy->PwrOptConfig->PchPwrOptPcie[RootPort].ObffEnable == PCH_DEVICE_ENABLE) {
+ Data32 |= BIT19;
+ } else {
+ Data32 &= (UINT32) ~(BIT19 | BIT18);
+ }
+ MmioWrite32 (RPBase + R_PCH_PCIE_DCAP2, Data32);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RPBase + R_PCH_PCIE_DCAP2),
+ 1,
+ &Data32
+ );
+
+ Data16 = MmioRead16 (RPBase + R_PCH_PCIE_DCTL2);
+ ///
+ /// Step 1.4
+ /// Program B0:D28:F0-F7 + 68h [10] = 1b
+ ///
+ if (PchPlatformPolicy->PwrOptConfig->PchPwrOptPcie[RootPort].LtrEnable == PCH_DEVICE_ENABLE) {
+ Data16 |= BIT10;
+ } else {
+ Data16 &= (UINT16) ~(BIT10);
+ }
+ ///
+ /// Step 2.2
+ /// Program B0:D28:F0-F7 + 68h [14:13] = 3h
+ ///
+ if (PchPlatformPolicy->PwrOptConfig->PchPwrOptPcie[RootPort].ObffEnable == PCH_DEVICE_ENABLE) {
+ Data16 |= BIT14 | BIT13;
+ } else {
+ Data16 &= (UINT16) ~(BIT14 | BIT13);
+ }
+
+ MmioWrite16 (RPBase + R_PCH_PCIE_DCTL2, Data16);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (RPBase + R_PCH_PCIE_DCTL2),
+ 1,
+ &Data16
+ );
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 8.14 Additional PCI Express* Programming Steps
+ /// Step 6
+ /// Set B0:D28:F0~F7 + 318h [31:16] = 1414h
+ ///
+ Data32Or = 0x14140000;
+ Data32And = (UINT32) (~(0xFFFF0000));
+ MmioAndThenOr32 (RPBase + 0x318, Data32And, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RPBase + 0x318),
+ &Data32Or, // Data to be ORed
+ &Data32And // Data to be ANDed
+ );
+
+ ///
+ /// Step 7
+ /// If B0:D28:F0 + F5h[0] = 1b or step 5 is TRUE, set B0:D28:F0~F7 + 4Ch[17:15] = 100b
+ /// Else set B0:D28:F0~F7 + 4Ch[17:15] = 010b
+ ///
+ if ((MmioRead8 (PciD28F0RegBase + 0xF5) & BIT0) || PcieNccSSc) {
+ Data32Or = BIT17;
+ } else {
+ Data32Or = BIT16;
+ }
+
+ Data32And = (UINT32) (~B_PCH_PCIE_LCAP_EL1);
+ MmioAndThenOr32 (RPBase + R_PCH_PCIE_LCAP, Data32And, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RPBase + R_PCH_PCIE_LCAP),
+ &Data32Or, // Data to be ORed
+ &Data32And // Data to be ANDed
+ );
+ ///
+ /// Step 8
+ /// Set B0:D28:F0~F7 + 314h[31:24] = 74h
+ /// Step 9
+ /// Set B0:D28:F0~F7 + 314h[23:16] = 3Ah
+ /// Step 10
+ /// Set B0:D28:F0~F7 + 314h[15:08] = 36h
+ /// Step 11
+ /// Set B0:D28:F0~F7 + 314h[07:00] = 1Bh
+ ///
+ Data32Or = 0x743A361B;
+ Data32And = (UINT32) (0x0);
+ MmioAndThenOr32 (RPBase + 0x314, Data32And, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RPBase + 0x314),
+ &Data32Or, // Data to be ORed
+ &Data32And // Data to be ANDed
+ );
+ ///
+ /// Step 12
+ /// Set B0:D28:F0~F7 + D8h[17:15] = 3h
+ ///
+ Data32And = (UINT32) (~B_PCH_PCIE_MPC_CCEL);
+ Data32Or = BIT16 | BIT15;
+ MmioAndThenOr32 (RPBase + R_PCH_PCIE_MPC, Data32And, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RPBase + R_PCH_PCIE_MPC),
+ &Data32Or, // Data to be ORed
+ &Data32And // Data to be ANDed
+ );
+ ///
+ /// Step 13
+ /// Set B0:D28:F0~F7 + 33Ch[24:0] = 854C74h
+ ///
+ Data32And = 0xFF000000;
+ Data32Or = 0x854C74;
+ MmioAndThenOr32 (RPBase + 0x33C, Data32And, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RPBase + 0x33C),
+ &Data32Or, // Data to be ORed
+ &Data32And // Data to be ANDed
+ );
+
+ ///
+ /// Step 16
+ /// Set B0:D28:F0~F7 + D8h[25] = 1b
+ ///
+ Data32And = (UINT32) ~(B_PCH_PCIE_MPC_IRRCE);
+ Data32Or = B_PCH_PCIE_MPC_IRRCE;
+ MmioAndThenOr32 (RPBase + R_PCH_PCIE_MPC, Data32And, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RPBase + R_PCH_PCIE_MPC),
+ &Data32Or, // Data to be ORed
+ &Data32And // Data to be ANDed
+ );
+ ///
+ /// Step 17
+ /// For system that support MCTP over PCIE set
+ /// Set B0:D28:F0~F7 + D8h[27] = 1b
+ /// Set B0:D28:F0~F7 + D8h[3] = 1b
+ ///
+ Data32And = (UINT32) ~(B_PCH_PCIE_MPC_MCTPSE | B_PCH_PCIE_MPC_MMBNCE);
+ Data32Or = B_PCH_PCIE_MPC_MCTPSE | B_PCH_PCIE_MPC_MMBNCE;
+ MmioAndThenOr32 (RPBase + R_PCH_PCIE_MPC, Data32And, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RPBase + R_PCH_PCIE_MPC),
+ &Data32Or, // Data to be ORed
+ &Data32And // Data to be ANDed
+ );
+ ///
+ /// Step 18
+ /// Set B0:D28:F0~F7 + F5h[7:4] = 0000b
+ ///
+ MmioAnd8 (RPBase + 0xF5, (UINT8) ~(BIT4 | BIT5 | BIT6 | BIT7));
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (RPBase + 0xF5),
+ 1,
+ (VOID *) (UINTN) (RPBase + 0xF5)
+ );
+ ///
+ /// Step 20
+ /// If there is no IOAPIC behind the root port, set EOI Forwarding Disable bit (B0:D28:F0-F7:D4h[1]) to 1b.
+ /// Done in PchPciExpressHelpersLibrary.c PcieSetEoiFwdDisable()
+ ///
+ /// Step 21
+ /// For systems that support Advanced Error Reporting set
+ /// B0:D28:F0~F7:100h[19:0] = 10001h
+ /// Else
+ /// B0:D28:F0~F7:100h[19:0] = 0h
+ ///
+ if (RootPortConfig->AdvancedErrorReporting) {
+ Data32 = (UINT32)(BIT16 | BIT0);
+ } else {
+ Data32 = 0;
+ }
+ ///
+ /// For LPT-LP, setup the next capability offset to 0x200
+ /// B0:D28:F0~F7:100h[29] = 1b
+ ///
+ if (PchSeries == PchLp) {
+ Data32 |= BIT29;
+ }
+ MmioWrite32 (RPBase + R_PCH_PCIE_AECH, Data32);
+
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RPBase + R_PCH_PCIE_AECH),
+ 1,
+ (VOID *) (UINTN) (RPBase + R_PCH_PCIE_AECH)
+ );
+ ///
+ /// Step 22
+ /// System bios should initiate link retrain for all slots that has card populated after register restoration.
+ /// Done in PchPciExpressHelpersLibrary.c PchPcieInitRootPortDownstreamDevices ()
+ /// Step 23
+ /// System BIOS should read and write back to capability register B0:D28:F0 offsets 34h, 40h,
+ /// 80h and 90h after it has been configure or prior to boot
+ /// Done in PchInit.c PciERWORegInit ()
+ ///
+ /// Configure Extended Synch
+ ///
+ if (RootPortConfig->ExtSync) {
+ Data16And = (UINT16) (-1);
+ Data16Or = B_PCH_PCIE_LCTL_ES;
+ } else {
+ Data16And = (UINT16) (~B_PCH_PCIE_LCTL_ES);
+ Data16Or = 0;
+ }
+
+ MmioAndThenOr16 (RPBase + R_PCH_PCIE_LCTL, Data16And, Data16Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (RPBase + R_PCH_PCIE_LCTL),
+ &Data16Or, // Data to be ORed
+ &Data16And // Data to be ANDed
+ );
+
+ if (PchSeries == PchLp) {
+ ///
+ /// Step 23
+ /// Program B0:D28:F0~F5:320h[21:20] to 01b and [8:6] to 011b
+ ///
+ Data32And = (UINT32) (~(BIT21 | BIT20 | BIT8 | BIT7 | BIT6));
+ Data32Or = BIT20 | BIT7 | BIT6;
+ MmioAndThenOr32 (RPBase + R_PCH_PCIE_PECR2, Data32And, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RPBase + R_PCH_PCIE_PECR2),
+ &Data32Or, // Data to be ORed
+ &Data32And // Data to be ANDed
+ );
+ }
+
+ ///
+ /// Configure Completion Timeout
+ ///
+ Data16And = (UINT16)~(B_PCH_PCIE_DCTL2_CTD | B_PCH_PCIE_DCTL2_CTV);
+ Data16Or = 0;
+ if (RootPortConfig->CompletionTimeout == PchPcieCompletionTO_Disabled) {
+ Data16Or = B_PCH_PCIE_DCTL2_CTD;
+ } else {
+ switch (RootPortConfig->CompletionTimeout) {
+ case PchPcieCompletionTO_Default:
+ Data16Or = V_PCH_PCIE_DCTL2_CTV_DEFAULT;
+ break;
+
+ case PchPcieCompletionTO_16_55ms:
+ Data16Or = V_PCH_PCIE_DCTL2_CTV_40MS_50MS;
+ break;
+
+ case PchPcieCompletionTO_65_210ms:
+ Data16Or = V_PCH_PCIE_DCTL2_CTV_160MS_170MS;
+ break;
+
+ case PchPcieCompletionTO_260_900ms:
+ Data16Or = V_PCH_PCIE_DCTL2_CTV_400MS_500MS;
+ break;
+
+ case PchPcieCompletionTO_1_3P5s:
+ Data16Or = V_PCH_PCIE_DCTL2_CTV_1P6S_1P7S;
+ break;
+
+ default:
+ Data16Or = 0;
+ break;
+ }
+ }
+
+ MmioAndThenOr16 (RPBase + R_PCH_PCIE_DCTL2, Data16And, Data16Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (RPBase + R_PCH_PCIE_DCTL2),
+ &Data16Or, // Data to be ORed
+ &Data16And // Data to be ANDed
+ );
+
+ ///
+ /// Set the Slot Implmemented Bit. Note that this must be set before
+ /// presence is valid.
+ /// PCH BIOS Spec Rev 0.5.0 section 8.2.2, The System BIOS must
+ /// initialize the "Slot Implemented" bit of the PCI Express* Capabilities Register,
+ /// XCAP D28:F0~7:Reg 42h[8] of each available and enabled downstream root port.
+ /// Setting this bit will indicate that the PCI Express* link associated with this
+ /// port is connected to a slot (as compared to being connected to an integrated
+ /// device component).
+ ///
+ if (RootPortConfig->SlotImplemented) {
+ ///
+ /// Slot Implemented enabled earlier. Here will only save this register for enabled ports
+ ///
+ Data16Or = BIT8;
+ Data16And = 0xFFFF;
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (RPBase + CapOffset + 2),
+ &Data16Or, // Data to be ORed
+ &Data16And // Data to be ANDed
+ );
+ ///
+ /// For Root Port Slots Numbering on the CRBs.
+ ///
+ Data32Or = 0;
+ Data32And = (UINT32) (~(B_PCH_PCIE_SLCAP_SLV | B_PCH_PCIE_SLCAP_SLS | B_PCH_PCIE_SLCAP_PSN));
+ ///
+ /// PCH BIOS Spec Rev 0.5.0 section 8.8.2.1
+ /// Note: If Hot Plug is supported, then write a 1 to the Hot Plug Capable (bit6) and Hot Plug
+ /// Surprise (bit5) in the Slot Capabilities register, D28:F0~7:Reg 54h. Otherwise,
+ /// write 0 to the bits PCIe Hot Plug SCI Enable
+ ///
+ Data32And &= (UINT32) (~(B_PCH_PCIE_SLCAP_HPC | B_PCH_PCIE_SLCAP_HPS));
+ if (RootPortConfig->HotPlug) {
+ Data32Or |= B_PCH_PCIE_SLCAP_HPC | B_PCH_PCIE_SLCAP_HPS;
+ }
+ ///
+ /// Get the width from LCAP
+ /// Slot Type X1 X4/X8 X16
+ /// Default 10W 25W 75W
+ /// The slot power consumption and allocation is platform specific. Please refer to the
+ /// "PCI Express* Card Electromechanical (CEM) Spec" for details.
+ /// bugbug what's the default setting for X2
+ ///
+ if ((((MmioRead32 (RPBase + R_PCH_PCIE_LCAP)) & B_PCH_PCIE_LCAP_MLW) >> 4) == 0x01) {
+ Data32Or |= (UINT32) (100 << 7);
+ Data32Or |= (UINT32) (1 << 15);
+ } else if ((((MmioRead32 (RPBase + R_PCH_PCIE_LCAP)) & B_PCH_PCIE_LCAP_MLW) >> 4) >= 0x04) {
+ Data32Or |= (UINT32) (250 << 7);
+ Data32Or |= (UINT32) (1 << 15);
+ }
+
+ Data32Or |= (UINT32) (RootPortConfig->PhysicalSlotNumber << 19);
+ MmioAndThenOr32 (RPBase + R_PCH_PCIE_SLCAP, Data32And, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RPBase + R_PCH_PCIE_SLCAP),
+ &Data32Or, // Data to be ORed
+ &Data32And // Data to be ANDed
+ );
+ }
+ ///
+ /// Initialize downstream devices
+ ///
+ Status = PchPcieInitRootPortDownstreamDevices (
+ BusNumber,
+ (UINT8) PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS,
+ RootPortFunction,
+ PchPlatformPolicy->PciExpressConfig->TempRootPortBusNumMin,
+ PchPlatformPolicy->PciExpressConfig->TempRootPortBusNumMax,
+ &DeviceClassDword
+ );
+ if (Status == EFI_SUCCESS) {
+ DeviceFound = TRUE;
+ } else {
+ ///
+ /// Disable the forwarding of EOI messages.
+ /// Set B0:D28:F0/F1/F2/F3/F4/F5/F6/F7 + D4h [1] = 1b
+ ///
+ #ifdef HOTPLUG_EOI_FLAG // AMI_OVERRIDE, [EIP84720]>
+ MmioOr8 (RPBase + 0xD4, (UINT8) (BIT1));
+ #else
+ //Supporting _RMV method in asl code, and reading hotplug capability register of root port
+ //if hotplug disable, then set EOI Forwarding Disable bit
+ #ifdef TBT_UP_PORT_FUNC_FLAG
+ if((TBT_UP_PORT_FUNC == RootPortFunction) || (!(MmioRead8 (RPBase + 0x54) & 0x40)))
+ #else
+ if(!(MmioRead8 (RPBase + 0x54) & 0x40))
+ #endif
+ MmioOr8 (RPBase + 0xD4, (UINT8) (BIT1));
+ #endif // AMI_OVERRIDE, [EIP84720]<
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (RPBase + 0xD4),
+ 1,
+ (VOID *) (UINTN) (RPBase + 0xD4)
+ );
+ }
+ ///
+ /// Not checking the error status here - downstream device not present does not
+ /// mean an error of this root port. Our return status of EFI_SUCCESS means this
+ /// port is enabled and outer function depends on this return status to do
+ /// subsequent initializations.
+ ///
+ Status = SetInitRootPortDownstreamS3Item (
+ BusNumber,
+ (UINT8) PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS,
+ RootPortFunction,
+ PchPlatformPolicy->PciExpressConfig->TempRootPortBusNumMin,
+ PchPlatformPolicy->PciExpressConfig->TempRootPortBusNumMax
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Additional configurations
+ ///
+
+ ///
+ /// Enable Subtractive Decode of RootPort
+ /// Step 1
+ /// Ensure flash descriptor PCH Strap 9 Bit 14, which read RCBA + 1030h[22] = 1b
+ /// Step 2
+ /// Set B0:D28:Fn + ECh[1:0] = 11b,
+ /// If downstream is PCI-to-PCI bridge, then also set B0:D28:Fn + ECh[2] = 1b
+ ///
+ if ((RootPort == PchPlatformPolicy->PciExpressConfig->PchPcieSbdePort) &&
+ (MmioRead32 ((UINTN) (RootComplexBar + 0x1030)) & BIT22) &&
+ (PchPlatformPolicy->PciExpressConfig->EnableSubDecode))
+ {
+ Data32Or = (B_PCH_PCIE_PECR3_SDCDID | B_PCH_PCIE_PECR3_SDE);
+ if ((((DeviceClassDword >> 24) & 0xFF) == PCI_CLASS_BRIDGE) && // BCC
+ (((DeviceClassDword >> 16) & 0xFF) == PCI_CLASS_BRIDGE_CARDBUS)) // SCC
+ {
+ Data32Or |= BIT2;
+ }
+
+ MmioOr32 (RPBase + R_PCH_PCIE_PECR3, Data32Or);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RPBase + R_PCH_PCIE_PECR3),
+ 1,
+ (VOID *) (UINTN) (RPBase + R_PCH_PCIE_PECR3)
+ );
+ }
+
+ ///
+ /// Configure Error Reporting policy in the Device Control Register
+ ///
+ Data16And = (UINT16) (~(B_PCH_PCIE_DCTL_URE | B_PCH_PCIE_DCTL_FEE | B_PCH_PCIE_DCTL_NFE | B_PCH_PCIE_DCTL_CEE));
+ Data16Or = 0;
+
+ if (RootPortConfig->UnsupportedRequestReport) {
+ Data16Or |= B_PCH_PCIE_DCTL_URE;
+ }
+
+ if (RootPortConfig->FatalErrorReport) {
+ Data16Or |= B_PCH_PCIE_DCTL_FEE;
+ }
+
+ if (RootPortConfig->NoFatalErrorReport) {
+ Data16Or |= B_PCH_PCIE_DCTL_NFE;
+ }
+
+ if (RootPortConfig->CorrectableErrorReport) {
+ Data16Or |= B_PCH_PCIE_DCTL_CEE;
+ }
+
+ MmioAndThenOr16 (RPBase + R_PCH_PCIE_DCTL, Data16And, Data16Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (RPBase + R_PCH_PCIE_DCTL),
+ &Data16Or, // Data to be ORed
+ &Data16And // Data to be ANDed
+ );
+
+ ///
+ /// Configure Interrupt / Error reporting in R_PCH_PCIE_RCTL
+ ///
+ Data16And = (UINT16) (~(B_PCH_PCIE_RCTL_PIE | B_PCH_PCIE_RCTL_SFE | B_PCH_PCIE_RCTL_SNE | B_PCH_PCIE_RCTL_SCE));
+ Data16Or = 0;
+
+ if (RootPortConfig->PmeInterrupt) {
+ Data16Or |= B_PCH_PCIE_RCTL_PIE;
+ }
+
+ if (RootPortConfig->SystemErrorOnFatalError) {
+ Data16Or |= B_PCH_PCIE_RCTL_SFE;
+ }
+
+ if (RootPortConfig->SystemErrorOnNonFatalError) {
+ Data16Or |= B_PCH_PCIE_RCTL_SNE;
+ }
+
+ if (RootPortConfig->SystemErrorOnCorrectableError) {
+ Data16Or |= B_PCH_PCIE_RCTL_SCE;
+ }
+
+ MmioAndThenOr16 (RPBase + R_PCH_PCIE_RCTL, Data16And, Data16Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (RPBase + R_PCH_PCIE_RCTL),
+ &Data16Or, // Data to be ORed
+ &Data16And // Data to be ANDed
+ );
+
+ ///
+ /// Root PCI-E Powermanagement SCI Enable
+ ///
+ if (RootPortConfig->PmSci) {
+ ///
+ /// PCH BIOS Spec Rev 0.5.0 section 8.7.3 BIOS Enabling of Intel PCH PCI Express* PME SCI Generation
+ /// Step 1
+ /// Make sure that PME Interrupt Enable bit, D28:F0-7:Reg 5Ch[3] is cleared
+ ///
+ Data16And = (UINT16) (~B_PCH_PCIE_RCTL_PIE);
+ Data16Or = 0;
+ MmioAnd16 (RPBase + R_PCH_PCIE_RCTL, Data16And);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (RPBase + R_PCH_PCIE_RCTL),
+ &Data16Or, // Data to be ORed
+ &Data16And // Data to be ANDed
+ );
+
+ ///
+ /// Step 2
+ /// Program Misc Port Config (MPC) register at PCI config space offset
+ /// D8h as follows:
+ /// Set Power Management SCI Enable bit, D28:F0~7:Reg D8h[31]
+ /// Clear Power Management SMI Enable bit, D28:F0~7:Reg D8h[0]
+ ///
+ Data32And = (UINT32) (~B_PCH_PCIE_MPC_PMME);
+ Data32Or = B_PCH_PCIE_MPC_PMCE;
+ MmioAndThenOr32 (RPBase + R_PCH_PCIE_MPC, Data32And, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RPBase + R_PCH_PCIE_MPC),
+ &Data32Or, // Data to be ORed
+ &Data32And // Data to be ANDed
+ );
+
+ ///
+ /// Step 3
+ /// Make sure GPE0 Register (PMBase+20h[9]), PCI_EXP_STS is 0, clear it if not zero
+ ///
+ if (PchSeries == PchLp) {
+ Data32Or = IoRead32 (PmBase + R_PCH_ACPI_GPE0_STS_127_96);
+ if ((Data32Or & B_PCH_ACPI_GPE0_STS_127_96_PCI_EXP) != 0) {
+ Data32Or = B_PCH_ACPI_GPE0_STS_127_96_PCI_EXP;
+ IoWrite32 (PmBase + R_PCH_ACPI_GPE0_STS_127_96, Data32Or);
+ SCRIPT_IO_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PmBase + R_PCH_ACPI_GPE0_STS_127_96),
+ 1,
+ &Data32Or
+ );
+ }
+ } else if (PchSeries == PchH) {
+ Data32Or = IoRead32 (PmBase + R_PCH_ACPI_GPE0a_STS);
+ if ((Data32Or & B_PCH_ACPI_GPE0a_STS_PCI_EXP) != 0) {
+ Data32Or = B_PCH_ACPI_GPE0a_STS_PCI_EXP;
+ IoWrite32 (PmBase + R_PCH_ACPI_GPE0a_STS, Data32Or);
+ SCRIPT_IO_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PmBase + R_PCH_ACPI_GPE0a_STS),
+ 1,
+ &Data32Or
+ );
+ }
+ }
+ ///
+ /// Step 4
+ /// Set BIOS_PCI_EXP_EN bit, D31:F0:Reg A0[10],
+ /// to globally enable the setting of the PCI_EXP_STS bit by a PCI Express* PME event.
+ ///
+ Data16Or = MmioRead16 (LpcBase + R_PCH_LPC_GEN_PMCON_1);
+ if ((Data16Or & B_PCH_LPC_GEN_PMCON_BIOS_PCI_EXP_EN) == 0) {
+ Data16And = 0xFFFF;
+ Data16Or = B_PCH_LPC_GEN_PMCON_BIOS_PCI_EXP_EN;
+ MmioOr16 (LpcBase + R_PCH_LPC_GEN_PMCON_1, Data16Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (LpcBase + R_PCH_LPC_GEN_PMCON_1),
+ &Data16Or, // Data to be ORed
+ &Data16And // Data to be ANDed
+ );
+ }
+ }
+
+ if (RootPortConfig->HotPlug) {
+ ///
+ /// PCH BIOS Spec Rev 0.5.0 section 8.8.2.1
+ /// Step 1
+ /// Clear following status bits, by writing 1b to them, in the Slot
+ /// Status register at offset 1Ah of PCI Express Capability structure:
+ /// Attention Button Pressed (bit0)
+ /// Presence Detect Changed (bit3)
+ ///
+ Data16And = 0xFFFF;
+ Data16Or = (BIT3 | BIT0);
+ MmioOr16 (RPBase + CapOffset + 0x1A, Data16Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (RPBase + CapOffset + 0x1A),
+ &Data16Or, // Data to be ORed
+ &Data16And // Data to be ANDed
+ );
+ ///
+ /// Step 2
+ /// Program the following bits in Slot Control register at offset 18h
+ /// of PCI Express* Capability structure:
+ /// Attention Button Pressed Enable (bit0) = 1b
+ /// Presence Detect Changed Enable (bit3) = 1b
+ /// Hot Plug Interrupt Enable (bit5) = 0b
+ ///
+ Data16And = (UINT16) (~BIT5);
+ Data16Or = (BIT3 | BIT0);
+ MmioAndThenOr16 (RPBase + CapOffset + 0x18, Data16And, Data16Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (RPBase + CapOffset + 0x18),
+ &Data16Or, // Data to be ORed
+ &Data16And // Data to be ANDed
+ );
+ ///
+ /// Step 3
+ /// Program Misc Port Config (MPC) register at PCI config space offset
+ /// D8h as follows:
+ /// Hot Plug SCI Enable (HPCE, bit30) = 1b
+ /// Hot Plug SMI Enable (HPME, bit1) = 0b
+ ///
+ Data32And = (UINT32) (~B_PCH_PCIE_MPC_HPME);
+ Data32Or = B_PCH_PCIE_MPC_HPCE;
+ MmioAndThenOr32 (RPBase + R_PCH_PCIE_MPC, Data32And, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RPBase + R_PCH_PCIE_MPC),
+ &Data32Or, // Data to be ORed
+ &Data32And // Data to be ANDed
+ );
+ ///
+ /// Step 4
+ /// Clear GPE0 Register (PMBase+20h), bit1, HOT_PLUG_STS by writing 1
+ ///
+ if (PchSeries == PchLp) {
+ IoWrite32 (PmBase + R_PCH_ACPI_GPE0_STS_127_96, (UINT32) B_PCH_ACPI_GPE0_STS_127_96_HOT_PLUG);
+ } else if (PchSeries == PchH) {
+ IoWrite32 (PmBase + R_PCH_ACPI_GPE0a_STS, (UINT32) B_PCH_ACPI_GPE0a_STS_HOT_PLUG);
+ }
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.0 section 8.9
+ /// BIOS should mask the reporting of Completion timeout (CT) errors byerrors by setting
+ /// the uncorrectable Error Mask register D28:F0~7:Reg 108h[14].
+ ///
+ Data32And = 0xFFFFFFFF;
+ Data32Or = B_PCH_PCIE_UEM_CT;
+ MmioOr32 (RPBase + R_PCH_PCIE_UEM, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RPBase + R_PCH_PCIE_UEM),
+ &Data32Or, // Data to be ORed
+ &Data32And // Data to be ANDed
+ );
+ }
+
+ if (DeviceFound == TRUE || (RootPortConfig->HotPlug == PCH_DEVICE_ENABLE)) {
+ return EFI_SUCCESS;
+ } else {
+ return EFI_NOT_FOUND;
+ }
+}
+
+/**
+ This is the function to enable the clock gating for PCI Express ports.
+
+ @param[in] BusNumber The Bus Number of the PCH device
+ @param[in] PchPlatformPolicy PCH Platform Policy protocol
+ @param[in] RpEnableMask Bit Mask indicating the enabled root ports
+ @param[in] RpHiddenMask Bit Mask indicating the root ports used for other > x1 root ports
+ @param[in] RootComplexBar Root complex base address
+
+ @retval EFI_SUCCESS Successfully completed.
+**/
+EFI_STATUS
+PcieEnableClockGating (
+ IN UINT8 BusNumber,
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RpEnableMask,
+ IN UINT32 RpHiddenMask,
+ IN UINT32 RootComplexBar,
+ IN UINT32 NandPort
+ )
+{
+ UINTN RPBase;
+ UINT32 PortIndex;
+ UINT8 Data8Or;
+ UINT8 Data8And;
+ UINT32 Data32Or;
+ UINT32 Data32And;
+ UINT16 GpioBase;
+ BOOLEAN ClkreqPerPortSupported;
+ PCH_SERIES PchSeries;
+
+ PchSeries = GetPchSeries();
+ GpioBase = 0;
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, section 19.10 Enabling Clock Gating
+ /// 2.1
+ /// For each enabled PCI Express* root port, program D28:F0~F7:Reg E1h[1:0] to 3h to enable dynamic clock gating.
+ /// System BIOS also require to set D28:F0~F7:Reg E8h[0] = 1b
+ /// 2.2
+ /// Additionally, if port 0 is in x2 mode, these bits should not be set for port 1.
+ /// Likewise, if port 0 is in x4 mode, these bits should not be set for ports 1, 2, or 3
+ ///
+ for (PortIndex = 0; PortIndex < GetPchMaxPciePortNum (); PortIndex++) {
+ ClkreqPerPortSupported = FALSE;
+ if (PchSeries == PchLp) {
+ GpioBase = MmioRead16 (
+ MmPciAddress (0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_GPIO_BASE)
+ ) & B_PCH_LPC_GPIO_BASE_BAR;
+ Data32Or = (IoRead32 ((UINTN) (GpioBase + R_PCH_GP_X_CONFIG0(18 + PortIndex))) & B_PCH_GPIO_OWN0_GPIO_USE_SEL);
+ if (Data32Or == 0) {
+ ClkreqPerPortSupported = TRUE;
+ }
+ }
+ if (((RpEnableMask & (1 << PortIndex)) != 0) && ((RpHiddenMask & (1 << PortIndex)) == 0)) {
+ RPBase = MmPciAddress (
+ 0,
+ BusNumber,
+ PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS,
+ GetPchPcieRpfn (RootComplexBar, (UINT8) PortIndex),
+ 0
+ );
+
+ Data8Or = B_PCH_PCIE_RPDCGEN_RPDLCGEN | B_PCH_PCIE_RPDCGEN_RPDBCGEN;
+ Data8And = 0xFF;
+ MmioOr8 (
+ RPBase + R_PCH_PCIE_RPDCGEN,
+ Data8Or
+ );
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (RPBase + R_PCH_PCIE_RPDCGEN),
+ &Data8Or, // Data to be ORed
+ &Data8And // Data to be ANDed
+ );
+
+ if (PchSeries == PchLp) {
+ ///
+ /// 2.3
+ /// Program D28:F0~F5:E2h[6] to 1b
+ ///
+ Data8Or = B_PCH_PCIE_RPPGEN_PTOTOP;
+ Data8And = (UINT8)~B_PCH_PCIE_RPPGEN_PTOTOP;
+ MmioOr8 (
+ RPBase + R_PCH_PCIE_RPPGEN,
+ Data8Or
+ );
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (RPBase + R_PCH_PCIE_RPPGEN),
+ &Data8Or, // Data to be ORed
+ &Data8And // Data to be ANDed
+ );
+
+ ///
+ /// 2.4
+ /// Program D28:F0~F5:E8h[3:2] to 10b before setting D28:F0~F5:E8h[1:0]
+ ///
+ Data8Or = BIT3;
+ Data8And = (UINT8)~(V_PCH_PCIE_PECR1_FIELD_3);
+ MmioAndThenOr8 (
+ RPBase + R_PCH_PCIE_PECR1,
+ Data8And,
+ Data8Or
+ );
+ }
+
+ Data32And = 0xFFFFFFFF;
+ Data32Or = (UINT32) BIT0;
+ MmioOr32 (RPBase + R_PCH_PCIE_PECR1, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RPBase + R_PCH_PCIE_PECR1),
+ &Data32Or, // Data to be ORed
+ &Data32And // Data to be ANDed
+ );
+ ///
+ /// Step 2.6
+ /// Set B0:D28:F0~F7 + 324h[5] = 1b
+ ///
+ MmioOr32 (RPBase + R_PCH_PCIE_PEETM, (UINT32) (BIT5));
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RPBase + R_PCH_PCIE_PEETM),
+ 1,
+ (VOID *) (UINTN) (RPBase + R_PCH_PCIE_PEETM)
+ );
+//for Denlow SVR, refer Inel doc 493798, c state communication
+#ifdef PCH_DENLOW_SERVER_SUPPORT
+ /// Set B0:D28:F0~F7 + 324h[3] = 1b
+ ///
+ MmioOr32 (RPBase + R_PCH_PCIE_PEETM, (UINT32) (BIT3));
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RPBase + R_PCH_PCIE_PEETM),
+ 1,
+ (VOID *) (UINTN) (RPBase + R_PCH_PCIE_PEETM)
+ );
+#endif
+ }
+
+ if (PchSeries == PchLp) {
+ ///
+ /// Program D28:F0~F5:E2h[5:4] to 11b prior to function disable the port
+ /// Program D28:F0~F5:420h[31] to 1b prior to function disable the port
+ ///
+ if ((RpEnableMask & (1 << PortIndex)) == 0) {
+ RPBase = MmPciAddress (
+ 0,
+ BusNumber,
+ PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS,
+ GetPchPcieRpfn (RootComplexBar, (UINT8) PortIndex),
+ 0
+ );
+ Data8Or = (B_PCH_PCIE_RPPGEN_LMSDOCGE | B_PCH_PCIE_RPPGEN_SEOCGE);
+ Data8And = (UINT8)~(B_PCH_PCIE_RPPGEN_LMSDOCGE | B_PCH_PCIE_RPPGEN_SEOCGE);
+ MmioOr8 (
+ RPBase + R_PCH_PCIE_RPPGEN,
+ Data8Or
+ );
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (RPBase + R_PCH_PCIE_RPPGEN),
+ &Data8Or, // Data to be ORed
+ &Data8And // Data to be ANDed
+ );
+ Data32Or = (B_PCH_PCIE_PCIEPMECTL_FDPGE);
+ Data32And = (UINT32)~(B_PCH_PCIE_PCIEPMECTL_FDPGE);
+ MmioOr32 (
+ RPBase + R_PCH_PCIE_PCIEPMECTL,
+ Data32Or
+ );
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RPBase + R_PCH_PCIE_PCIEPMECTL),
+ &Data32Or, // Data to be ORed
+ &Data32And // Data to be ANDed
+ );
+ }
+ ///
+ /// Program D28:F0~F5:420h[30:29] to 111b
+ ///
+ if (ClkreqPerPortSupported) {
+ RPBase = MmPciAddress (
+ 0,
+ BusNumber,
+ PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS,
+ GetPchPcieRpfn (RootComplexBar, (UINT8) PortIndex),
+ 0
+ );
+ Data32Or = (B_PCH_PCIE_PCIEPMECTL_DLSULPGE | B_PCH_PCIE_PCIEPMECTL_DLSULDLSD);
+ Data32And = (UINT32)~(B_PCH_PCIE_PCIEPMECTL_DLSULPGE | B_PCH_PCIE_PCIEPMECTL_DLSULDLSD);
+ MmioOr32 (
+ RPBase + R_PCH_PCIE_PCIEPMECTL,
+ Data32Or
+ );
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RPBase + R_PCH_PCIE_PCIEPMECTL),
+ &Data32Or, // Data to be ORed
+ &Data32And // Data to be ANDed
+ );
+ }
+ }
+ }
+
+ if (PchSeries == PchLp) {
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, section 19.10
+ /// Step 2.4
+ /// Program D28:F0,F4&F5:Reg E1h[5:2] to 1111b
+ /// Program D28:F0,F4&F5:Reg E1h[7] to 1b
+ ///
+ for (PortIndex = 0; PortIndex < GetPchMaxPciePortNum (); PortIndex ++) {
+ if ((PortIndex == 0 || PortIndex == 4 || PortIndex == 5) && !(NandPort & (0x1 << PortIndex))) {
+ RPBase = MmPciAddress (
+ 0,
+ BusNumber,
+ PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS,
+ GetPchPcieRpfn (RootComplexBar, (UINT8) PortIndex),
+ 0
+ );
+ Data8Or =
+ (
+ B_PCH_PCIE_RPDCGEN_LCLKREQEN |
+ B_PCH_PCIE_RPDCGEN_BBCLKREQEN |
+ B_PCH_PCIE_RPDCGEN_SRDLCGEN |
+ B_PCH_PCIE_RPDCGEN_SRDBCGEN
+ );
+
+ MmioOr8 (RPBase + R_PCH_PCIE_RPDCGEN, Data8Or);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (RPBase + R_PCH_PCIE_RPDCGEN),
+ 1,
+ (VOID *) (UINTN) (RPBase + R_PCH_PCIE_RPDCGEN)
+ );
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, section 19.10
+ /// Step 2.5
+ /// If PCIe root ports 0-3 are all disabled, set B0:D28:F0 + E2h [0] = 1b and E1h [7] = 1b.
+ /// If PCIe root port 4 is disabled, set B0:D28:F4 + E2h [0] = 1b and E1h [7] = 1b.
+ /// If PCIe root port 5 is disabled, set B0:D28:F5 + E2h [0] = 1b and E1h [7] = 1b.
+ ///
+ if (((!(RpEnableMask & 0xF)) && (PortIndex == 0)) || ((!(RpEnableMask & (0x1 << PortIndex))) && (PortIndex >= 4))) {
+ MmioOr8 ((RPBase + 0xE2), BIT0);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (RPBase + 0xE2),
+ 1,
+ (VOID *) (UINTN) (RPBase + 0xE2)
+ );
+
+ MmioOr8 (RPBase + R_PCH_PCIE_RPDCGEN, B_PCH_PCIE_RPDCGEN_RPSCGEN);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (RPBase + R_PCH_PCIE_RPDCGEN),
+ 1,
+ (VOID *) (UINTN) (RPBase + R_PCH_PCIE_RPDCGEN)
+ );
+ }
+ }
+ }
+ ///
+ /// Additional steps
+ /// If all PCIe root ports are disabled, set B0:D28:F0 + E1h[6] to 1b
+ ///
+ if ((RpEnableMask & 0x3F) == 0) {
+ RPBase = MmPciAddress (
+ 0,
+ BusNumber,
+ PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS,
+ GetPchPcieRpfn(RootComplexBar, PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_1),
+ 0
+ );
+ MmioOr8 (
+ RPBase + R_PCH_PCIE_RPDCGEN,
+ B_PCH_PCIE_RPDCGEN_POCGE
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (RPBase + R_PCH_PCIE_RPDCGEN),
+ 1,
+ (VOID *) (UINTN) (RPBase + R_PCH_PCIE_RPDCGEN)
+ );
+ }
+ }
+ if (PchSeries == PchH) {
+ ///
+ /// PCH BIOS Spec Rev 0.5.5, section 19.10
+ /// Step 2.3
+ /// Program D28:F0&F4:Reg E1h[5:2] to 1111b
+ ///
+ for (PortIndex = 0; PortIndex < GetPchMaxPciePortNum (); PortIndex += 4) {
+ if (((RpHiddenMask & (1 << PortIndex)) == 0) && !(NandPort & (0x1 << PortIndex))) {
+ RPBase = MmPciAddress (
+ 0,
+ BusNumber,
+ PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS,
+ GetPchPcieRpfn (RootComplexBar, (UINT8) PortIndex),
+ 0
+ );
+ Data8Or =
+ (
+ B_PCH_PCIE_RPDCGEN_LCLKREQEN |
+ B_PCH_PCIE_RPDCGEN_BBCLKREQEN |
+ B_PCH_PCIE_RPDCGEN_SRDLCGEN |
+ B_PCH_PCIE_RPDCGEN_SRDBCGEN
+ );
+ MmioOr8 (RPBase + R_PCH_PCIE_RPDCGEN, Data8Or);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (RPBase + R_PCH_PCIE_RPDCGEN),
+ 1,
+ (VOID *) (UINTN) (RPBase + R_PCH_PCIE_RPDCGEN)
+ );
+ ///
+ /// PCH BIOS Spec Rev 0.5.5, section 19.10
+ /// Step 2.4
+ /// If PCIe root ports 0-3 are all disabled, set B0:D28:F0 + E2h [0] = 1b and E1h [7] = 1b.
+ /// If PCIe root ports 4-7 are all disabled, set B0:D28:F4 + E2h [0] = 1b and E1h [7] = 1b.
+ ///
+ if (!(RpEnableMask & (0xF << PortIndex))) {
+ MmioOr8 ((RPBase + 0xE2), BIT0);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (RPBase + 0xE2),
+ 1,
+ (VOID *) (UINTN) (RPBase + 0xE2)
+ );
+
+ MmioOr8 (RPBase + R_PCH_PCIE_RPDCGEN, B_PCH_PCIE_RPDCGEN_RPSCGEN);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (RPBase + R_PCH_PCIE_RPDCGEN),
+ 1,
+ (VOID *) (UINTN) (RPBase + R_PCH_PCIE_RPDCGEN)
+ );
+ }
+ }
+ }
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchSata.c b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchSata.c
new file mode 100644
index 0000000..56021ca
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchSata.c
@@ -0,0 +1,1547 @@
+/** @file
+ Configures PCH Sata Controller
+
+@copyright
+ Copyright (c) 2008 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "PchInit.h"
+
+
+EFI_STATUS
+ConfigureSataAhci (
+ DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ UINT32 RootComplexBar,
+ UINT16 GpioBase
+ );
+
+EFI_STATUS
+ConfigureSataSpeedIde (
+ DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ UINTN PciDevFuncRegBase,
+ UINTN MaxPorts
+ );
+
+EFI_STATUS
+DisableSataController (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN OUT UINT32 *FuncDisableReg
+ );
+
+/**
+ Configures PCH Sata Controller
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+ @param[in, out] FuncDisableReg Function Disable Register
+ @param[in] GpioBase GPIO base address of this PCH device
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+ConfigureSata (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar,
+ IN OUT UINT32 *FuncDisableReg,
+ IN UINT16 GpioBase
+ )
+{
+ EFI_STATUS Status;
+ UINT32 Index;
+ UINT16 WordReg;
+ UINT16 SataGcReg;
+ UINTN PciD31F2RegBase;
+ PCH_SATA_CONFIG *SataConfig;
+ UINT16 SataPortsEnabled;
+ UINT16 SataModeSelect;
+ UINTN PciD31F5RegBase;
+ UINTN PciDevFuncRegBase;
+ UINTN MaxPorts;
+ UINT32 Data32And;
+ UINT32 Data32Or;
+ PCH_SERIES PchSeries;
+
+ DEBUG ((EFI_D_INFO, "ConfigureSata() Start\n"));
+
+ PchSeries = GetPchSeries();
+ SataConfig = PchPlatformPolicy->SataConfig;
+ PciD31F2RegBase = MmPciAddress (0, PchPlatformPolicy->BusNumber, 31, 2, 0);
+ PciD31F5RegBase = 0;
+ if (PchSeries == PchH) {
+ PciD31F5RegBase = MmPciAddress (0, PchPlatformPolicy->BusNumber, 31, 5, 0);
+ }
+ SataModeSelect = MmioRead16 (PciD31F2RegBase + R_PCH_SATA_MAP) & B_PCH_SATA_MAP_SMS_MASK;
+ Status = EFI_SUCCESS;
+
+ ///
+ /// Check to disable SATA controller
+ ///
+ if (PchPlatformPolicy->DeviceEnabling->Sata == PCH_DEVICE_DISABLE) {
+ Status = DisableSataController (PchPlatformPolicy, FuncDisableReg);
+ return Status;
+ }
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.0 section 14.1.7 Additional Programming Requirements during
+ /// SATA Initialization
+ /// Step 12
+ /// Program D31:F2:9Ch[5] to 1b (Note: this must be programmed together with D31:F2:9Ch[7:6]
+ /// in word write)
+ ///
+ SataGcReg = MmioRead16 (PciD31F2RegBase + R_PCH_SATA_SCLKGC);
+ SataGcReg |= BIT5;
+
+ switch (SataModeSelect) {
+#ifdef TRAD_FLAG
+ case V_PCH_SATA_MAP_SMS_IDE:
+ if (PchSeries == PchH) {
+ ///
+ /// Set Native IDE decoding
+ ///
+ /// PCH BIOS Spec Rev 0.5.0 Section 14.1.3 Set the Programming Interface
+ /// Using native IDE is only possible when the SATA controller is operating in IDE mode.
+ /// The programming interface is selected by setting the programming interface register
+ /// (PI = Reg: 09h) appropriately. There are two native mode enabling bits in the
+ /// PI register to control the primary and secondary channels of SATA1.
+ ///
+ /// Only D31:F2 needs to be set. D31:F5 is readonly
+ ///
+ if (SataConfig->LegacyMode == PCH_DEVICE_ENABLE) {
+ MmioAnd8 (
+ PciD31F2RegBase + R_PCH_SATA_PI_REGISTER,
+ (UINT8)~(B_PCH_SATA_PI_REGISTER_PNE | B_PCH_SATA_PI_REGISTER_SNE)
+ );
+ } else {
+ MmioOr8 (
+ PciD31F2RegBase + R_PCH_SATA_PI_REGISTER,
+ (UINT8) B_PCH_SATA_PI_REGISTER_PNE | B_PCH_SATA_PI_REGISTER_SNE
+ );
+ }
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (PciD31F2RegBase + R_PCH_SATA_PI_REGISTER),
+ 1,
+ (VOID *) (UINTN) (PciD31F2RegBase + R_PCH_SATA_PI_REGISTER)
+ );
+ MmioOr16 ((UINTN) (PciD31F5RegBase + R_PCH_SATA_TIMP), (UINT16) (B_PCH_SATA_TIM_IDE));
+ WordReg = MmioRead16 (PciD31F5RegBase + R_PCH_SATA_TIMP);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PciD31F5RegBase + R_PCH_SATA_TIMP),
+ 1,
+ &WordReg
+ );
+ MmioOr16 ((UINTN) (PciD31F5RegBase + R_PCH_SATA_TIMS), (UINT16) (B_PCH_SATA_TIM_IDE));
+ WordReg = MmioRead16 (PciD31F5RegBase + R_PCH_SATA_TIMS);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PciD31F5RegBase + R_PCH_SATA_TIMS),
+ 1,
+ &WordReg
+ );
+ }
+ break;
+#endif // TRAD_FLAG
+
+ case V_PCH_SATA_MAP_SMS_RAID:
+ ///
+ /// When RAID alternate ID is enabled, the Device ID will change to 30XX from 282X in RAID mode
+ ///
+ if (SataConfig->RaidAlternateId == PCH_DEVICE_ENABLE) {
+ SataGcReg &= ~B_PCH_SATA_SCLKGC_AIES;
+ SataGcReg |= B_PCH_SATA_SCLKGC_AIE;
+ }
+#ifdef PCH_SVR_WS_SKU
+ SataGcReg &= ~B_PCH_SATA_SCLKGC_AIE;
+ SataGcReg |= B_PCH_SATA_SCLKGC_AIES;
+#endif
+ break;
+ }
+ ///
+ /// Unconditional write is necessary to lock the register
+ ///
+ MmioWrite16 (PciD31F2RegBase + R_PCH_SATA_SCLKGC, SataGcReg);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PciD31F2RegBase + R_PCH_SATA_SCLKGC),
+ 1,
+ &SataGcReg
+ );
+
+ ///
+ /// Set legacy IDE decoding
+ /// These bits also effect with AHCI mode when PCH is using legacy mechanisms.
+ ///
+ MmioOr16 ((UINTN) (PciD31F2RegBase + R_PCH_SATA_TIMP), (UINT16) (B_PCH_SATA_TIM_IDE));
+ WordReg = MmioRead16 (PciD31F2RegBase + R_PCH_SATA_TIMP);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PciD31F2RegBase + R_PCH_SATA_TIMP),
+ 1,
+ &WordReg
+ );
+
+ MmioOr16 ((UINTN) (PciD31F2RegBase + R_PCH_SATA_TIMS), (UINT16) (B_PCH_SATA_TIM_IDE));
+ WordReg = MmioRead16 (PciD31F2RegBase + R_PCH_SATA_TIMS);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PciD31F2RegBase + R_PCH_SATA_TIMS),
+ 1,
+ &WordReg
+ );
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, section 19.10
+ /// Step 4.2
+ /// D31:F2 PCS: Enable the port in any of below condition:
+ /// Hot plug is enabled
+ /// A device is attached
+ /// Test mode is enabled
+ /// Configured as eSATA port
+ ///
+ SataPortsEnabled = 0;
+ WordReg = MmioRead16 (PciD31F2RegBase + R_PCH_SATA_PCS);
+ for (Index = 0; Index < GetPchMaxSataPortNum (); Index++) {
+ if ((SataConfig->PortSettings[Index].HotPlug == PCH_DEVICE_ENABLE) ||
+ (WordReg & (BIT0 << (8 + Index))) ||
+ (SataConfig->TestMode == PCH_DEVICE_ENABLE) ||
+ (SataConfig->PortSettings[Index].External == PCH_DEVICE_ENABLE)) {
+ SataPortsEnabled |= (SataConfig->PortSettings[Index].Enable << Index);
+ }
+ }
+ if (PchSeries == PchH) {
+ ///
+ /// D31:F5 PCS: Enable the port in any of below condition:
+ /// Hot plug is enabled
+ /// A device is attached
+ /// Test mode is enabled
+ ///
+ /// Note: In IDE mode, SATA Port 4/5 enable status needs to be checked before setting D31:F2 MAP[13:8].
+ /// It's because:
+ /// (1) SataPortsEnabled [5:4] will be set while it is configured as eSATA port that is not
+ /// supported in IDE mode.
+ /// (2) D31:F2 MAP[12] setting needs to sync up with D31:F5 MAP[8] setting.
+ /// D31:F2 MAP[13] setting needs to sync up with D31:F5 MAP[9] setting.
+ ///
+ if (SataModeSelect == V_PCH_SATA_MAP_SMS_IDE) {
+ ///
+ /// Clear SataPortsEnabled [5:4] before checking SATA Port 4/5 enable status
+ ///
+ SataPortsEnabled &= ~(BIT5 | BIT4);
+ WordReg = MmioRead16 (PciD31F5RegBase + R_PCH_SATA_PCS);
+ for (Index = 4; Index < GetPchMaxSataPortNum (); Index++) {
+ ///
+ /// D31:F5 PCS[9:8] = Port 4/5 Present bit
+ ///
+ if ((SataConfig->PortSettings[Index].HotPlug == PCH_DEVICE_ENABLE) ||
+ (WordReg & (BIT0 << (4 + Index))) ||
+ (SataConfig->TestMode == PCH_DEVICE_ENABLE)) {
+ ///
+ /// SataPortsEnabled [5:4] = Sata Port 4/5 enable status
+ ///
+ SataPortsEnabled |= (SataConfig->PortSettings[Index].Enable << Index);
+ }
+ }
+ }
+ }
+
+ ///
+ /// Set MAP register for PCH H
+ /// Set D31:F2 MAP[13:8] to 1b if SATA Port 0/1/2/3/4/5 is disabled
+ /// SataPortsEnabled [5:0] = Sata Port 0/1/2/3/4/5 enable status
+ /// MAP.SPD (D31:F2:Reg90h[13:8]) is Write Once
+ ///
+ /// Set MAP register for PCH LP
+ /// Set D31:F2 MAP[11:8] to 1b if SATA Port 0/1/2/3 is disabled
+ /// SataPortsEnabled [3:0] = Sata Port 0/1/2/3 enable status
+ /// MAP.SPD (D31:F2:Reg90h[11:8]) is Write Once
+ ///
+ switch (PchSeries) {
+ case PchLp:
+ MmioOr16 ((UINTN) (PciD31F2RegBase + R_PCH_SATA_MAP), ((~SataPortsEnabled << 8) & (UINT16) B_PCH_LP_SATA_MAP_SPD));
+ break;
+
+ case PchH:
+ MmioOr16 ((UINTN) (PciD31F2RegBase + R_PCH_SATA_MAP), ((~SataPortsEnabled << 8) & (UINT16) B_PCH_H_SATA_MAP_SPD));
+ break;
+
+ default:
+ break;
+ }
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PciD31F2RegBase + R_PCH_SATA_MAP),
+ 1,
+ (VOID *) (UINTN) (PciD31F2RegBase + R_PCH_SATA_MAP)
+ );
+
+ //
+ // D31:F2 PCS[5:0] = Port 0~5 Enabled bit
+ // as per SataPortsEnabled value.
+ //
+ MmioOr16 ((UINTN) (PciD31F2RegBase + R_PCH_SATA_PCS), (UINT16) (SataPortsEnabled));
+
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PciD31F2RegBase + R_PCH_SATA_PCS),
+ 1,
+ (VOID *) (UINTN) (PciD31F2RegBase + R_PCH_SATA_PCS)
+ );
+
+#ifdef TRAD_FLAG
+ if (PchSeries == PchH) {
+ ///
+ /// Set D31:F5 MAP[9:8] and D31:F5 PCS[1:0]
+ ///
+ if (SataModeSelect == V_PCH_SATA_MAP_SMS_IDE) {
+ ///
+ /// Set D31:F5 MAP[9:8] to 1b if SATA Port 4/5 is disabled
+ /// SataPortsEnabled [5:4] = Sata Port 4/5 enable status
+ /// MAP.SPD (D31:F5:Reg90h[9:8]) is Write Once
+ ///
+ MmioOr16 ((UINTN) (PciD31F5RegBase + R_PCH_SATA_MAP), ((~SataPortsEnabled << 4) & (UINT16) B_PCH_SATA2_MAP_SPD));
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PciD31F5RegBase + R_PCH_SATA_MAP),
+ 1,
+ (VOID *) (UINTN) (PciD31F5RegBase + R_PCH_SATA_MAP)
+ );
+ ///
+ /// D31:F5 PCS[1:0] = Port 4/5 Enabled bit
+ ///
+ MmioAndThenOr16 (
+ (UINTN) (PciD31F5RegBase + R_PCH_SATA_PCS),
+ (UINT16) (~(B_PCH_SATA2_PCS_PORT5_EN | B_PCH_SATA2_PCS_PORT4_EN)),
+ (UINT16) (SataPortsEnabled >> 4)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PciD31F5RegBase + R_PCH_SATA_PCS),
+ 1,
+ (VOID *) (UINTN) (PciD31F5RegBase + R_PCH_SATA_PCS)
+ );
+ }
+ }
+#endif // TRAD_FLAG
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, section 19.10
+ /// Step 4.2
+ /// After configuring Port and Control Status (PCS) Register Port x Enabled (PxE) bits accordingly,
+ /// wait 1.4 micro second
+ ///
+ PchPmTimerStall (0x02);
+ SCRIPT_STALL (EFI_ACPI_S3_RESUME_SCRIPT_TABLE, 0x02);
+
+ ///
+ /// After programming the PCS.PxE, check if it is zero.
+ /// If no port enabled, terminate the SATA configuration and disable the SATA controller.
+ ///
+ WordReg = MmioRead16 ((UINTN) (PciD31F2RegBase + R_PCH_SATA_PCS));
+ WordReg &= (UINT16) ((1 << GetPchMaxSataPortNum ()) - 1);
+#ifdef TRAD_FLAG
+ if (WordReg == 0) {
+ if ((PchSeries == PchH) && (SataModeSelect == V_PCH_SATA_MAP_SMS_IDE)) {
+ WordReg = MmioRead16 ((UINTN) (PciD31F5RegBase + R_PCH_SATA_PCS));
+ WordReg &= (UINT16) (B_PCH_SATA2_PCS_PORT5_EN |
+ B_PCH_SATA2_PCS_PORT4_EN);
+ }
+ }
+#endif // TRAD_FLAG
+ if (WordReg == 0) {
+ Status = DisableSataController (PchPlatformPolicy, FuncDisableReg);
+ return Status;
+ }
+
+ if (PchSeries == PchLp) {
+ ///
+ /// If Listen Mode support is not required, program D31:F2:98h[24] to 1b.
+ ///
+ if ((SataConfig->PortSettings[0].HotPlug == PCH_DEVICE_DISABLE) &&
+ (SataConfig->PortSettings[1].HotPlug == PCH_DEVICE_DISABLE) &&
+ (SataConfig->PortSettings[2].HotPlug == PCH_DEVICE_DISABLE) &&
+ (SataConfig->PortSettings[3].HotPlug == PCH_DEVICE_DISABLE)) {
+ MmioOr32 ((UINTN) (PciD31F2RegBase + 0x98), (UINT32) (BIT24));
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PciD31F2RegBase + 0x98),
+ 1,
+ (VOID *) (UINTN) (PciD31F2RegBase + 0x98)
+ );
+ }
+ }
+
+ ///
+ /// Configure AHCI
+ ///
+ if (PchSeries == PchLp) {
+ if (SataModeSelect != V_PCH_SATA_MAP_SMS_LOOBACK_TESTMODE) {
+ Status = ConfigureSataAhci (PchPlatformPolicy, RootComplexBar, GpioBase);
+ }
+ } else if (PchSeries == PchH) {
+ if (SataModeSelect != V_PCH_SATA_MAP_SMS_IDE) {
+ Status = ConfigureSataAhci (PchPlatformPolicy, RootComplexBar, GpioBase);
+ } else {
+ ///
+ /// If it is IDE mode
+ ///
+ if(PchPlatformPolicy->SataConfig->SpeedSupport != PchSataSpeedSupportDefault){
+ PciDevFuncRegBase = 0;
+ MaxPorts = 0;
+ for (Index = 0; Index < GetPchMaxSataControllerNum (); Index++) {
+ switch (Index) {
+ case 0:
+ PciDevFuncRegBase = PciD31F2RegBase;
+ MaxPorts = PCH_IDE_1_MAX_PORTS;
+ break;
+
+ case 1:
+ PciDevFuncRegBase = PciD31F5RegBase;
+ MaxPorts = PCH_IDE_2_MAX_PORTS;
+ break;
+ }
+ Status = ConfigureSataSpeedIde (PchPlatformPolicy, PciDevFuncRegBase, MaxPorts);
+ }
+ }
+ }
+ }
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, section 19.10
+ /// Step 4.1
+ /// Set bits D31:F2:Reg 94h[29:24] to 3Fh as part of the chipset initialization and before disabling the
+ /// SATA function if the SATA interface is not supported. BIOS can also set PCD bits for the un-routed ports
+ /// on the platform to disable clocks for the unused ports
+ /// Set the PCD [port x] = 1 if the corresponding PCS.PxE = 0 (either have a device attached or have
+ /// hot plug enabled)
+ ///
+ for (Index = 0; Index < GetPchMaxSataPortNum (); Index++) {
+ if ((SataPortsEnabled & (B_PCH_SATA_PCS_PORT0_EN << Index)) == 0) {
+ MmioOr32 ((UINTN) (PciD31F2RegBase + R_PCH_SATA_SCLKCG), (UINT32) (B_PCH_SATA_SCLKCG_PORT0_PCD << Index));
+ }
+ }
+
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PciD31F2RegBase + R_PCH_SATA_SCLKCG),
+ 1,
+ (VOID *) (UINTN) (PciD31F2RegBase + R_PCH_SATA_SCLKCG)
+ );
+ ///
+ /// PCH BIOS Spec Rev 0.5.6, 14.1.6 Power Optimizer Configuration
+ /// System BIOS must execute the following steps as part of System BIOS initialization
+ /// of the PCH SATA controller on both cold boot (G3/S5) and S3/S4 resume path. Please
+ /// refer to the PCH EDS, section 14.1.35.1 for the SATA initialization settings and
+ /// the actual register indexes/values to be programmed.
+ ///
+ if (PchPlatformPolicy->PwrOptConfig->PchPwrOptSata == PCH_DEVICE_ENABLE) {
+ ///
+ /// Step 1
+ /// Set D31:F2 + SIR Index 64h[31:0] = 883C9001h
+ ///
+ MmioWrite8 (PciD31F2RegBase + R_PCH_SATA_SIRI, 0x64);
+ if (PchSeries == PchH) {
+ MmioWrite32 (PciD31F2RegBase + R_PCH_SATA_STRD, 0x883C9001);
+ }
+ if (PchSeries == PchLp) {
+ MmioWrite32 (PciD31F2RegBase + R_PCH_SATA_STRD, 0x883C9003);
+ }
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (PciD31F2RegBase + R_PCH_SATA_SIRI),
+ 1,
+ (VOID *) (UINTN) (PciD31F2RegBase + R_PCH_SATA_SIRI)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PciD31F2RegBase + R_PCH_SATA_STRD),
+ 1,
+ (VOID *) (UINTN) (PciD31F2RegBase + R_PCH_SATA_STRD)
+ );
+ ///
+ /// Step 2
+ /// Set D31:F2 + SIR Index 68h[15:0] = 880Ah
+ ///
+ MmioWrite8 (PciD31F2RegBase + R_PCH_SATA_SIRI, 0x68);
+ Data32And = 0xFFFF0000;
+ Data32Or = 0x0000880A;
+ MmioAndThenOr32 (
+ (UINTN) (PciD31F2RegBase + R_PCH_SATA_STRD),
+ Data32And,
+ Data32Or
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (PciD31F2RegBase + R_PCH_SATA_SIRI),
+ 1,
+ (VOID *) (UINTN) (PciD31F2RegBase + R_PCH_SATA_SIRI)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PciD31F2RegBase + R_PCH_SATA_STRD),
+ 1,
+ (VOID *) (UINTN) (PciD31F2RegBase + R_PCH_SATA_STRD)
+ );
+ ///
+ /// Step 3
+ /// Set D31:F2 + SIR Index 60h[3] = 1b
+ ///
+ MmioWrite8 (PciD31F2RegBase + R_PCH_SATA_SIRI, 0x60);
+ Data32And = 0xFFFFFFF7;
+ Data32Or = 0x00000008;
+ MmioAndThenOr32 (
+ (UINTN) (PciD31F2RegBase + R_PCH_SATA_STRD),
+ Data32And,
+ Data32Or
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (PciD31F2RegBase + R_PCH_SATA_SIRI),
+ 1,
+ (VOID *) (UINTN) (PciD31F2RegBase + R_PCH_SATA_SIRI)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PciD31F2RegBase + R_PCH_SATA_STRD),
+ 1,
+ (VOID *) (UINTN) (PciD31F2RegBase + R_PCH_SATA_STRD)
+ );
+ ///
+ /// Step 4
+ /// Set D31:F2 + SIR Index 60h[0] = 1b
+ ///
+ MmioWrite8 (PciD31F2RegBase + R_PCH_SATA_SIRI, 0x60);
+ Data32And = 0xFFFFFFFE;
+//for Denlow SVR, refer Inel doc 493798, c state communication
+#ifdef PCH_DENLOW_SERVER_SUPPORT
+ /// Set D31:F2 + SIR Index 60h[0] = 0b
+ Data32Or = 0x00000000;
+#else
+ Data32Or = 0x00000001;
+#endif
+ MmioAndThenOr32 (
+ (UINTN) (PciD31F2RegBase + R_PCH_SATA_STRD),
+ Data32And,
+ Data32Or
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (PciD31F2RegBase + R_PCH_SATA_SIRI),
+ 1,
+ (VOID *) (UINTN) (PciD31F2RegBase + R_PCH_SATA_SIRI)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PciD31F2RegBase + R_PCH_SATA_STRD),
+ 1,
+ (VOID *) (UINTN) (PciD31F2RegBase + R_PCH_SATA_STRD)
+ );
+ ///
+ /// Step 5
+ /// Set D31:F2 + SIR Index 60h[1] = 1b
+ ///
+ MmioWrite8 (PciD31F2RegBase + R_PCH_SATA_SIRI, 0x60);
+ Data32And = 0xFFFFFFFD;
+ Data32Or = 0x00000002;
+ MmioAndThenOr32 (
+ (UINTN) (PciD31F2RegBase + R_PCH_SATA_STRD),
+ Data32And,
+ Data32Or
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (PciD31F2RegBase + R_PCH_SATA_SIRI),
+ 1,
+ (VOID *) (UINTN) (PciD31F2RegBase + R_PCH_SATA_SIRI)
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PciD31F2RegBase + R_PCH_SATA_STRD),
+ 1,
+ (VOID *) (UINTN) (PciD31F2RegBase + R_PCH_SATA_STRD)
+ );
+ }
+
+#ifdef TRAD_FLAG
+ ///
+ /// For dual controller IDE mode, disable the individual controller if no port enabled.
+ /// For SATA2, the SATA configuration should be done through SATA1.
+ /// Therefore, disabling the SATA1/SATA2 after finishing SATA configuration.
+ ///
+ if (PchSeries == PchH) {
+ if (SataModeSelect == V_PCH_SATA_MAP_SMS_IDE) {
+ WordReg = MmioRead16 (PciD31F5RegBase + R_PCH_SATA_PCS);
+ WordReg &= (UINT16) (B_PCH_SATA2_PCS_PORT5_EN |
+ B_PCH_SATA2_PCS_PORT4_EN);
+ if (WordReg == 0) {
+ *FuncDisableReg |= B_PCH_RCRB_FUNC_DIS_SATA2;
+ }
+ WordReg = MmioRead16 (PciD31F2RegBase + R_PCH_SATA_PCS);
+ WordReg &= (UINT16) (B_PCH_SATA_PCS_PORT3_EN |
+ B_PCH_SATA_PCS_PORT2_EN |
+ B_PCH_SATA_PCS_PORT1_EN |
+ B_PCH_SATA_PCS_PORT0_EN);
+ if (WordReg == 0) {
+ *FuncDisableReg |= B_PCH_RCRB_FUNC_DIS_SATA1;
+ }
+ }
+ }
+#endif // TRAD_FLAG
+
+ DEBUG ((EFI_D_INFO, "ConfigureSata() End\n"));
+
+ return Status;
+}
+
+/**
+ Program the Max speed suported in each ports while in IDE mode.
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance.
+ @param[in] PciDevFuncRegBase Pci B/D/F/Reg Base for the Sata controler.
+ @param[in] MaxPorts Max Sata ports supported in the Controller.
+
+ @retval EFI_SUCESS The function exited sucessfully
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources are available
+**/
+EFI_STATUS
+ConfigureSataSpeedIde (
+ DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ UINTN PciDevFuncRegBase,
+ UINTN MaxPorts
+ )
+{
+ EFI_STATUS Status;
+#ifdef TRAD_FLAG
+ PCH_SATA_CONFIG *SataConfig;
+ EFI_PHYSICAL_ADDRESS IoBaseAddress;
+ UINT16 SidpBa;
+ UINT16 SidpBaSaveRestore;
+ UINT16 DevCmdSaveRestore;
+ UINT8 Data8;
+ UINT16 Data16;
+ UINTN PortIndex;
+
+ Data16 = 0;
+ Data8 = 0;
+
+ SataConfig = PchPlatformPolicy->SataConfig;
+
+ Status = gDS->AllocateIoSpace (
+ EfiGcdAllocateAnySearchBottomUp,
+ EfiGcdIoTypeIo,
+ N_PCH_SATA_SIDP_BAR_ALIGNMENT,
+ V_PCH_SATA_SIDP_BAR_LENGTH,
+ &IoBaseAddress,
+ mImageHandle,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ ///
+ /// Set the SIDP BAR
+ ///
+ SidpBa = (UINT16) IoBaseAddress;
+ SidpBaSaveRestore = MmioRead16 (PciDevFuncRegBase + R_PCH_SATA_SIDP_BAR);
+ MmioWrite16 (PciDevFuncRegBase + R_PCH_SATA_SIDP_BAR, SidpBa);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PciDevFuncRegBase + R_PCH_SATA_SIDP_BAR),
+ 1,
+ &SidpBa
+ );
+ ///
+ /// Enable command register I/O space decoding
+ ///
+ DevCmdSaveRestore = MmioRead16 (PciDevFuncRegBase + R_PCH_SATA_COMMAND);
+ MmioOr16 ((UINTN) (PciDevFuncRegBase + R_PCH_SATA_COMMAND), (UINT16) B_PCH_SATA_COMMAND_IOSE);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PciDevFuncRegBase + R_PCH_SATA_COMMAND),
+ 1,
+ (VOID *) (UINTN) (PciDevFuncRegBase + R_PCH_SATA_COMMAND)
+ );
+ ///
+ /// Configure for the max speed support 1.5Gb/s, 3.0Gb/s and 6.0Gb/s.
+ ///
+ for (PortIndex = 0; PortIndex < MaxPorts; PortIndex++) {
+ switch (PortIndex) {
+ case 0:
+ Data16 = V_PCH_SATA_AHCI_SINDX_RIDX_SCTL | V_PCH_SATA_AHCI_SINDX_PIDX_PORT0;
+ break;
+
+ case 1:
+ Data16 = V_PCH_SATA_AHCI_SINDX_RIDX_SCTL | V_PCH_SATA_AHCI_SINDX_PIDX_PORT1;
+ break;
+
+ case 2:
+ Data16 = V_PCH_SATA_AHCI_SINDX_RIDX_SCTL | V_PCH_SATA_AHCI_SINDX_PIDX_PORT2;
+ break;
+
+ case 3:
+ Data16 = V_PCH_SATA_AHCI_SINDX_RIDX_SCTL | V_PCH_SATA_AHCI_SINDX_PIDX_PORT3;
+ break;
+ }
+
+ IoWrite16 ((UINTN) (SidpBa + R_PCH_SATA_SIDPBA_SINDX), Data16);
+ SCRIPT_IO_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (SidpBa + R_PCH_SATA_SIDPBA_SINDX),
+ 1,
+ &Data16
+ );
+
+ switch (SataConfig->SpeedSupport) {
+ case PchSataSpeedSupportGen1:
+ Data8 = V_PCH_SATA_SIDPBA_SDATA_GEN1;
+ break;
+
+ case PchSataSpeedSupportGen2:
+ Data8 = V_PCH_SATA_SIDPBA_SDATA_GEN2;
+ break;
+
+ case PchSataSpeedSupportGen3:
+ Data8 = V_PCH_SATA_SIDPBA_SDATA_GEN3;
+ break;
+ }
+
+ IoWrite8 ((UINTN) (SidpBa + R_PCH_SATA_SIDPBA_SDATA), Data8);
+ SCRIPT_IO_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (SidpBa + R_PCH_SATA_SIDPBA_SDATA),
+ 1,
+ &Data8
+ );
+ Data16 = MmioRead16 ((UINTN) (PciDevFuncRegBase + R_PCH_SATA_PCS)) >> 8;
+ if(((Data16 >> PortIndex) & BIT0)){
+ Data8 = (IoRead8 (SidpBa + R_PCH_SATA_SIDPBA_SDATA) & ~B_PCH_SATA_SIDPBA_SCTL_DET) + V_PCH_SATA_SIDPBA_SCTL_DET_COMRST;
+ IoWrite8 ((UINTN) (SidpBa + R_PCH_SATA_SIDPBA_SDATA), Data8);
+ SCRIPT_IO_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (SidpBa + R_PCH_SATA_SIDPBA_SDATA),
+ 1,
+ &Data8
+ );
+ PchPmTimerStall (1000);
+ SCRIPT_STALL (EFI_ACPI_S3_RESUME_SCRIPT_TABLE, 1000);
+ Data8 = (IoRead8 (SidpBa + R_PCH_SATA_SIDPBA_SDATA) & ~B_PCH_SATA_SIDPBA_SCTL_DET) + V_PCH_SATA_SIDPBA_SCTL_DET_NOINT;
+ IoWrite8 ((UINTN) (SidpBa + R_PCH_SATA_SIDPBA_SDATA), Data8);
+ SCRIPT_IO_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (SidpBa + R_PCH_SATA_SIDPBA_SDATA),
+ 1,
+ &Data8
+ );
+ }
+ }
+ ///
+ /// Restore command register I/O space decoding
+ ///
+ MmioWrite16 (PciDevFuncRegBase + R_PCH_SATA_COMMAND, DevCmdSaveRestore);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PciDevFuncRegBase + R_PCH_SATA_COMMAND),
+ 1,
+ &DevCmdSaveRestore
+ );
+ ///
+ /// Restore the SIDP BAR
+ ///
+ MmioWrite16 (PciDevFuncRegBase + R_PCH_SATA_SIDP_BAR, SidpBaSaveRestore);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PciDevFuncRegBase + R_PCH_SATA_SIDP_BAR),
+ 1,
+ &SidpBaSaveRestore
+ );
+ ///
+ /// Free allocated resources
+ ///
+ gDS->FreeIoSpace (IoBaseAddress, (UINT64) V_PCH_SATA_SIDP_BAR_LENGTH);
+#else
+ Status = EFI_SUCCESS;
+#endif // TRAD_FLAG
+
+ return Status;
+}
+
+/**
+ Program AHCI PI register for Enabled ports
+ Handle hotplug, and interlock switch setting,
+ and config related GPIOs.
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+ @param[in] RootComplexBar RootComplexBar value of this PCH device
+ @param[in] GpioBase GPIO base address of this PCH device
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+ConfigureSataAhci (
+ DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ UINT32 RootComplexBar,
+ UINT16 GpioBase
+ )
+{
+ EFI_STATUS Status;
+ EFI_PHYSICAL_ADDRESS MemBaseAddress;
+ UINT32 AhciBar;
+ UINT32 CapRegister;
+ UINT32 Data32And;
+ UINT32 Data32Or;
+ UINT32 DwordReg;
+ UINT32 PxCMDRegister;
+ UINT16 SataPortsEnabled;
+ UINT8 Index;
+ UINTN PciD31F2RegBase;
+ UINT16 WordReg;
+ UINT8 ByteReg;
+ PCH_SATA_CONFIG *SataConfig;
+ UINT16 SataModeSelect;
+ PCH_SERIES PchSeries;
+ UINT8 SataResetGpio[LPTH_AHCI_MAX_PORTS] = {
+ PCH_GPIO_SATA_PORT0_RESET,
+ PCH_GPIO_SATA_PORT1_RESET,
+ PCH_GPIO_SATA_PORT2_RESET,
+ PCH_GPIO_SATA_PORT3_RESET,
+ PCH_GPIO_SATA_PORT4_RESET,
+ PCH_GPIO_SATA_PORT5_RESET,
+ };
+
+ UINT16 SataResetLpGpio[LPTLP_AHCI_MAX_PORTS] = {
+ PCH_LP_GPIO_SATA_PORT0_RESET,
+ PCH_LP_GPIO_SATA_PORT1_RESET,
+ PCH_LP_GPIO_SATA_PORT2_RESET,
+ PCH_LP_GPIO_SATA_PORT3_RESET,
+ };
+
+ DEBUG ((EFI_D_INFO, "ConfigureSataAhci() Start\n"));
+ PchSeries = GetPchSeries();
+ SataConfig = PchPlatformPolicy->SataConfig;
+ PciD31F2RegBase = MmPciAddress (0, PchPlatformPolicy->BusNumber, 31, 2, 0);
+ SataModeSelect = MmioRead16 (PciD31F2RegBase + R_PCH_SATA_MAP) & B_PCH_SATA_MAP_SMS_MASK;
+ DwordReg = 0;
+
+ ///
+ /// Allocate the AHCI BAR
+ ///
+ MemBaseAddress = 0x0ffffffff;
+ Status = gDS->AllocateMemorySpace (
+ EfiGcdAllocateMaxAddressSearchBottomUp,
+ EfiGcdMemoryTypeMemoryMappedIo,
+ N_PCH_SATA_AHCI_BAR_ALIGNMENT, // 2^11: 2K Alignment
+ V_PCH_SATA_AHCI_BAR_LENGTH, // 2K Length
+ &MemBaseAddress,
+ mImageHandle,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ ///
+ /// Set the AHCI BAR
+ ///
+ AhciBar = (UINT32) MemBaseAddress;
+ MmioWrite32 (PciD31F2RegBase + R_PCH_SATA_AHCI_BAR, AhciBar);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PciD31F2RegBase + R_PCH_SATA_AHCI_BAR),
+ 1,
+ &AhciBar
+ );
+
+ ///
+ /// Enable command register memory space decoding
+ ///
+ MmioOr16 ((UINTN) (PciD31F2RegBase + R_PCH_SATA_COMMAND), (UINT16) B_PCH_SATA_COMMAND_MSE);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PciD31F2RegBase + R_PCH_SATA_COMMAND),
+ 1,
+ (VOID *) (UINTN) (PciD31F2RegBase + R_PCH_SATA_COMMAND)
+ );
+
+ ///
+ /// Assert if the memory data of AhciBar is invalid.
+ ///
+ ASSERT (MmioRead32 (AhciBar) != 0xFFFFFFFF);
+
+ ///
+ /// Get Port Settings
+ ///
+ SataPortsEnabled = MmioRead16 ((UINTN) (PciD31F2RegBase + R_PCH_SATA_PCS));
+ if (PchSeries == PchH) {
+ SataPortsEnabled &= (UINT16) (B_PCH_SATA_PCS_PORT5_EN |
+ B_PCH_SATA_PCS_PORT4_EN |
+ B_PCH_SATA_PCS_PORT3_EN |
+ B_PCH_SATA_PCS_PORT2_EN |
+ B_PCH_SATA_PCS_PORT1_EN |
+ B_PCH_SATA_PCS_PORT0_EN );
+ } else if (PchSeries == PchLp) {
+ SataPortsEnabled &= (UINT16) (B_PCH_SATA_PCS_PORT3_EN |
+ B_PCH_SATA_PCS_PORT2_EN |
+ B_PCH_SATA_PCS_PORT1_EN |
+ B_PCH_SATA_PCS_PORT0_EN );
+ }
+
+ ///
+ /// Read the default value of the Host Capabilites Register
+ /// NOTE: many of the bits in this register are R/WO (Read/Write Once)
+ ///
+ CapRegister = MmioRead32 (AhciBar + R_PCH_SATA_AHCI_CAP);
+ CapRegister &= (UINT32)~(B_PCH_SATA_AHCI_CAP_SIS | B_PCH_SATA_AHCI_CAP_SSS | B_PCH_SATA_AHCI_CAP_SALP |
+ B_PCH_SATA_AHCI_CAP_PMS | B_PCH_SATA_AHCI_CAP_SSC | B_PCH_SATA_AHCI_CAP_PSC |
+ B_PCH_SATA_AHCI_CAP_SXS);
+ if (PchSeries == PchLp) {
+ CapRegister &= (UINT32)~(B_PCH_SATA_AHCI_CAP_SAM);
+ }
+
+ for (Index = 0; Index < GetPchMaxSataPortNum (); Index++) {
+ ///
+ /// Check PCS.PxE to know if the SATA Port x is disabled.
+ ///
+ if ((SataPortsEnabled & (B_PCH_SATA_PCS_PORT0_EN << Index)) == 0) {
+ continue;
+ }
+ if (PchSeries == PchLp) {
+ ///
+ /// Program AhciBar + 0h[18] = 1b
+ ///
+ CapRegister |= B_PCH_SATA_AHCI_CAP_SAM;
+ }
+
+ if (SataConfig->PortSettings[Index].InterlockSw == PCH_DEVICE_ENABLE) {
+ ///
+ /// Mechanical Presence Switch is Enabled for at least one of the ports
+ ///
+ CapRegister |= B_PCH_SATA_AHCI_CAP_SIS;
+ }
+
+ if ((SataConfig->PortSettings[Index].SpinUp == PCH_DEVICE_ENABLE) ||
+ (SataConfig->PortSettings[Index].External == PCH_DEVICE_ENABLE)) {
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 14.1.4 Initialize Registers in AHCI Memory-Mapped Space
+ /// Step 1.4
+ /// Set SSS (ABAR + 00h[27]) to enable SATA controller supports staggered
+ /// spin-up on its ports, for use in balancing power spikes
+ /// SATA Port Spin up is supported at least one of the ports
+ /// If this is an extra eSATA port. It needs to be hotpluggable but it's usually empty anyway
+ /// so LPM is not available but Listen Mode is available, so it will have good power management.
+ /// If Sata Test Mode enabled, then uncoditonally clear SSS (ABAR + 00h[27])
+ /// to resolve Spin-donw issue with the test equiepment
+ ///
+ if (SataConfig->TestMode == PCH_DEVICE_ENABLE ) {
+ CapRegister &= ~B_PCH_SATA_AHCI_CAP_SSS;
+ } else {
+ CapRegister |= B_PCH_SATA_AHCI_CAP_SSS;
+ }
+ }
+
+ if (SataConfig->PortSettings[Index].External == PCH_DEVICE_ENABLE) {
+ ///
+ /// External SATA is supported at least one of the ports
+ ///
+ CapRegister |= B_PCH_SATA_AHCI_CAP_SXS;
+ }
+ }
+ ///
+ /// Enable Enabled SATA ports,
+ /// If BIOS accesses any of the port specific AHCI address range before setting PI bit,
+ /// BIOS is required to read the PI register before the initial write to the PI register.
+ /// NOTE: many of the bits in this register are R/WO (Read/Write Once)
+ ///
+ Data32And = (UINT32) (~B_PCH_H_SATA_PORT_MASK);
+ if (PchSeries == PchLp) {
+ Data32And = (UINT32) (~B_PCH_LP_SATA_PORT_MASK);
+ }
+ Data32Or = (UINT32) (SataPortsEnabled);
+ MmioAndThenOr32 (
+ (UINTN) (AhciBar + R_PCH_SATA_AHCI_PI),
+ Data32And,
+ Data32Or
+ );
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (AhciBar + R_PCH_SATA_AHCI_PI),
+ &Data32Or, // Data to be ORed
+ &Data32And // Data to be ANDed
+ );
+ ///
+ /// After BIOS issues initial write to this register, BIOS is requested to issue two
+ /// reads to this register.
+ ///
+ Data32Or = MmioRead32 (AhciBar + R_PCH_SATA_AHCI_PI);
+ SCRIPT_MEM_POLL (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (AhciBar + R_PCH_SATA_AHCI_PI),
+ &Data32Or, // BitMask
+ &Data32Or, // BitValue
+ 1, // Duration
+ 1 // LoopTimes
+ );
+ SCRIPT_MEM_POLL (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (AhciBar + R_PCH_SATA_AHCI_PI),
+ &Data32Or, // BitMask
+ &Data32Or, // BitValue
+ 1, // Duration
+ 1 // LoopTimes
+ );
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 14.1.4 Initialize Registers in AHCI Memory-Mapped Space
+ /// Step 1
+ /// For Lynx Point
+ /// Set PSC (ABAR + 00h[13]). This bit informs the Windows software driver that the AHCI
+ /// Controller supports the partial low-power state.
+ /// Set SSC (ABAR + 00h[14]). This bit informs the Windows software driver that the AHCI
+ /// Controller supports the slumber low-power state.
+ /// Set SALP (ABAR + 00h[26]) to enable Aggressive Link Power Management (LPM) support.
+ ///
+ CapRegister |= (B_PCH_SATA_AHCI_CAP_SSC | B_PCH_SATA_AHCI_CAP_PSC);
+
+ if (SataConfig->SalpSupport == PCH_DEVICE_ENABLE) {
+ CapRegister |= B_PCH_SATA_AHCI_CAP_SALP;
+ }
+ ///
+ /// Support Command List Override & PIO Multiple DRQ Block
+ ///
+ CapRegister |= (B_PCH_SATA_AHCI_CAP_SCLO | B_PCH_SATA_AHCI_CAP_PMD);
+
+ ///
+ /// Configure for the max speed support 1.5Gb/s, 3.0Gb/s and 6.0Gb/s.
+ ///
+ CapRegister &= ~B_PCH_SATA_AHCI_CAP_ISS_MASK;
+
+ switch (SataConfig->SpeedSupport) {
+ case PchSataSpeedSupportGen1:
+ CapRegister |= (V_PCH_SATA_AHCI_CAP_ISS_1_5_G << N_PCH_SATA_AHCI_CAP_ISS);
+ break;
+
+ case PchSataSpeedSupportGen2:
+ CapRegister |= (V_PCH_SATA_AHCI_CAP_ISS_3_0_G << N_PCH_SATA_AHCI_CAP_ISS);
+ break;
+
+ case PchSataSpeedSupportGen3:
+ case PchSataSpeedSupportDefault:
+ CapRegister |= (V_PCH_SATA_AHCI_CAP_ISS_6_0_G << N_PCH_SATA_AHCI_CAP_ISS);
+ break;
+ }
+ ///
+ /// Update the Host Capabilites Register and save for S3 resume
+ /// NOTE: Many of the bits in this register are R/WO (Read/Write Once)
+ ///
+ MmioWrite32 (AhciBar + R_PCH_SATA_AHCI_CAP, CapRegister);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (AhciBar + R_PCH_SATA_AHCI_CAP),
+ 1,
+ &CapRegister
+ );
+
+ if (PchSeries == PchLp) {
+ ///
+ /// Set ABAR + 24h[5] to 1b
+ /// Set ABAR + 24h[4:2] to 111b
+ ///
+ Data32Or = B_PCH_SATA_AHCI_CAP2_DESO;
+ Data32Or |= B_PCH_SATA_AHCI_CAP2_SDS | B_PCH_SATA_AHCI_CAP2_SADM | B_PCH_SATA_AHCI_CAP2_APST;
+ MmioOr32 (AhciBar + R_PCH_SATA_AHCI_CAP2, Data32Or);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (AhciBar + R_PCH_SATA_AHCI_CAP2),
+ 1,
+ (VOID *) (UINTN) (AhciBar + R_PCH_SATA_AHCI_CAP2)
+ );
+ }
+
+ ///
+ /// Port[Max:0] Command Register update
+ /// NOTE: this register must be updated after Port Implemented and Capabilities register,
+ /// Many of the bits in this register are R/WO (Read/Write Once)
+ ///
+ for (Index = 0; Index < GetPchMaxSataPortNum (); Index++) {
+ ///
+ /// Check PCS.PxE to know if the SATA Port x is disabled.
+ ///
+ if ((SataPortsEnabled & (B_PCH_SATA_PCS_PORT0_EN << Index)) == 0) {
+ continue;
+ }
+ ///
+ /// Initial to zero first
+ ///
+ PxCMDRegister = 0;
+
+ if (SataConfig->PortSettings[Index].HotPlug == PCH_DEVICE_ENABLE) {
+ if (SataConfig->PortSettings[Index].External == PCH_DEVICE_DISABLE) {
+ ///
+ /// Hot Plug of this port is enabled
+ ///
+ PxCMDRegister |= B_PCH_SATA_AHCI_PxCMD_HPCP;
+ if (SataConfig->PortSettings[Index].InterlockSw == PCH_DEVICE_ENABLE) {
+ ///
+ /// Mechanical Switch of this port is Attached
+ ///
+ PxCMDRegister |= B_PCH_SATA_AHCI_PxCMD_MPSP;
+ ///
+ /// Check the GPIO Pin is set as used for native function not a normal GPIO
+ ///
+ if (PchSeries == PchH) {
+ DwordReg = IoRead32 (
+ (UINTN)
+ (GpioBase + R_PCH_GPIO_USE_SEL +
+ (SataResetGpio[Index] / 32 * (R_PCH_GPIO_USE_SEL2 - R_PCH_GPIO_USE_SEL))));
+ DwordReg = (DwordReg & (1 << SataResetGpio[Index] % 32));
+ }
+
+ if (PchSeries == PchLp) {
+ DwordReg = IoRead32 (
+ (UINTN)
+ (GpioBase + SataResetLpGpio[Index]));
+ DwordReg = (DwordReg & B_PCH_GPIO_OWN0_GPIO_USE_SEL);
+ }
+
+ if(DwordReg != 0) {
+ if (PchSeries == PchH) {
+ DEBUG ((EFI_D_ERROR,
+ "BIOS must set the SATA%0xGP / GPIO%0d to native function if Inter Lock Switch is enabled!\n",
+ Index,
+ SataResetGpio[Index]));
+ ASSERT_EFI_ERROR (EFI_DEVICE_ERROR);
+ }
+
+ if (PchSeries == PchLp) {
+ DEBUG ((EFI_D_ERROR,
+ "BIOS must set the SATA%0xGP / GPIO%0d to native function if Inter Lock Switch is enabled!\n",
+ Index,
+ SataResetLpGpio[Index]));
+ ASSERT_EFI_ERROR (EFI_DEVICE_ERROR);
+ }
+ }
+ }
+ }
+ } else {
+ ///
+ /// When "Mechanical Switch Attached to Port" (PxCMD[19]) is set, it is expected that HPCP (PxCMD[18]) is also set.
+ ///
+ if (SataConfig->PortSettings[Index].InterlockSw == PCH_DEVICE_ENABLE) {
+ DEBUG ((EFI_D_ERROR, "Hot-Plug function of Port%d should be enabled while the Inter Lock Switch of it is enabled!\n",
+ Index));
+ }
+ }
+
+ if (SataConfig->PortSettings[Index].External == PCH_DEVICE_ENABLE) {
+ PxCMDRegister |= B_PCH_SATA_AHCI_PxCMD_ESP;
+ }
+
+ if (SataConfig->PortSettings[Index].SpinUp == PCH_DEVICE_ENABLE) {
+ PxCMDRegister |= B_PCH_SATA_AHCI_PxCMD_SUD;
+ }
+
+ ///
+ /// eSATA port support only up to Gen2
+ ///
+ if (SataConfig->PortSettings[Index].External == PCH_DEVICE_ENABLE) {
+ Data32And = (UINT32)~(B_PCH_SATA_AHCI_PXSCTL_SPD);
+ Data32Or = (V_PCH_SATA_AHCI_PXSCTL_SPD_2);
+ if (PchSeries == PchLp) {
+ Data32And = (UINT32)~(B_PCH_SATA_AHCI_PXSCTL_SPD | B_PCH_SATA_AHCI_PXSCTL_IPM);
+ Data32Or = (V_PCH_SATA_AHCI_PXSCTL_SPD_2);
+ }
+ MmioAndThenOr32 (
+ (UINTN) (AhciBar + (R_PCH_SATA_AHCI_P0SCTL + (0x80 * Index))),
+ Data32And,
+ Data32Or
+ );
+
+ DwordReg = MmioRead32 (AhciBar + (R_PCH_SATA_AHCI_P0SCTL + (0x80 * Index)));
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (AhciBar + (R_PCH_SATA_AHCI_P0SCTL + (0x80 * Index))),
+ 1,
+ &DwordReg
+ );
+ }
+
+ MmioAndThenOr32 (
+ (UINTN) (AhciBar + (R_PCH_SATA_AHCI_P0CMD + (0x80 * Index))),
+ (UINT32)~(B_PCH_SATA_AHCI_PxCMD_MASK),
+ (UINT32) PxCMDRegister
+ );
+ DwordReg = MmioRead32 (AhciBar + (R_PCH_SATA_AHCI_P0CMD + (0x80 * Index)));
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (AhciBar + (R_PCH_SATA_AHCI_P0CMD + (0x80 * Index))),
+ 1,
+ &DwordReg
+ );
+ if ((PchSeries == PchLp)) {
+ ///
+ /// Set ABAR + 144h[1], ABAR + 1C4h[1], ABAR + 244h[1], ABAR + 2C4[1] to 0b as default
+ /// Board rework is required to enable DevSlp.
+ /// POR settings are ABAR + 144h[1], ABAR + 1C4h[1], ABAR + 244h[1] = 1b, ABAR + 2C4[1] to 0b
+ ///
+ if (SataConfig->PortSettings[Index].DevSlp == PCH_DEVICE_ENABLE) {
+ Data32And = (UINT32)~(B_PCH_SATA_AHCI_PxDEVSLP_DITO_MASK | B_PCH_SATA_AHCI_PxDEVSLP_DM_MASK);
+ Data32Or = (B_PCH_SATA_AHCI_PxDEVSLP_DSP | V_PCH_SATA_AHCI_PxDEVSLP_DM_16 | V_PCH_SATA_AHCI_PxDEVSLP_DITO_625);
+ if (SataConfig->PortSettings[Index].EnableDitoConfig == PCH_DEVICE_ENABLE) {
+ Data32Or &= Data32And;
+ Data32Or |= ((SataConfig->PortSettings[Index].DitoVal << 15) | (SataConfig->PortSettings[Index].DmVal << 25));
+ }
+ MmioAndThenOr32 (
+ (UINTN) (AhciBar + (R_PCH_SATA_AHCI_P0DEVSLP + (0x80 * Index))),
+ Data32And,
+ Data32Or
+ );
+ } else {
+ MmioAnd32 (
+ (UINTN) (AhciBar + (R_PCH_SATA_AHCI_P0DEVSLP + (0x80 * Index))),
+ (UINT32) ~(B_PCH_SATA_AHCI_PxDEVSLP_DSP)
+ );
+ }
+ DwordReg = MmioRead32 (AhciBar + (R_PCH_SATA_AHCI_P0DEVSLP + (0x80 * Index)));
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (AhciBar + (R_PCH_SATA_AHCI_P0DEVSLP + (0x80 * Index))),
+ 1,
+ &DwordReg
+ );
+ }
+
+ ///
+ /// eSATA port support only up to Gen2.
+ /// Save and restore Port Speed limitation
+ ///
+ if (SataConfig->PortSettings[Index].External == PCH_DEVICE_ENABLE) {
+ ByteReg = MmioRead8 (AhciBar + (R_PCH_SATA_AHCI_P0SCTL + (0x80 * Index)));
+ ByteReg &= (UINT8) ~(B_PCH_SATA_AHCI_PXSCTL_SPD);
+ ByteReg |= (UINT8) V_PCH_SATA_AHCI_PXSCTL_SPD_2;
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (AhciBar + (R_PCH_SATA_AHCI_P0SCTL + (0x80 * Index))),
+ 1,
+ &ByteReg
+ );
+ }
+ }
+ if ((PchSeries == PchLp)) {
+ ///
+ /// DevSlp on Port 0 and Port 3 are mutual exclusive. Assert if otherwise.
+ ///
+ ASSERT (!((SataConfig->PortSettings[0].DevSlp) && (SataConfig->PortSettings[3].DevSlp)));
+ if ((SataConfig->PortSettings[0].DevSlp == PCH_DEVICE_DISABLE) &&
+ (SataConfig->PortSettings[3].DevSlp == PCH_DEVICE_ENABLE)) {
+ MmioOr32 (
+ (UINTN) (PciD31F2RegBase + R_PCH_SATA_SCLKCG),
+ (UINT32) B_PCH_SATA_SCLKCG_POP3_DEVSLP
+ );
+ DwordReg = MmioRead32 (PciD31F2RegBase + R_PCH_SATA_SCLKCG);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PciD31F2RegBase + R_PCH_SATA_SCLKCG),
+ 1,
+ &DwordReg
+ );
+ }
+ }
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 14.1.5.2 Enable Flexible RAID OROM Features
+ /// Lynx Point with RAID capable sku is able to customize the RAID features through setting the
+ /// Intel RST Feature Capabilities (RSTF) register before loading the RAID Option ROM. The RAID
+ /// OROM will enable the desired features based on the setting in that register, please refer to
+ /// PCH EDS for more details.
+ /// For example, if the platform desired features are RAID0, RAID1, RAID5, RAID10 and
+ /// RST Smart Storage caching. System BIOS should set RSTF (ABAR + C8h [15:0]) to 022Fh before
+ /// loading RAID OROM.
+ ///
+ WordReg = 0;
+
+ if (SataConfig->HddUnlock == PCH_DEVICE_ENABLE) {
+ ///
+ /// If set to "1", indicates that the HDD password unlock in the OS is enabled
+ /// while SATA is configured as RAID mode.
+ ///
+ WordReg |= B_PCH_SATA_AHCI_RSTF_HDDLK;
+ }
+
+ if (SataConfig->LedLocate == PCH_DEVICE_ENABLE) {
+ ///
+ /// If set to "1", indicates that the LED/SGPIO hardware is attached and ping to
+ /// locate feature is enabled on the OS while SATA is configured as RAID mode.
+ ///
+ WordReg |= B_PCH_SATA_AHCI_RSTF_LEDL;
+ }
+
+ if (SataModeSelect == V_PCH_SATA_MAP_SMS_RAID) {
+ if (SataConfig->Raid0 == PCH_DEVICE_ENABLE) {
+ ///
+ /// If set to "1", then RAID0 is enabled in Flexible RAID Option ROM.
+ ///
+ WordReg |= B_PCH_SATA_AHCI_RSTF_R0E;
+ }
+
+ if (SataConfig->Raid1 == PCH_DEVICE_ENABLE) {
+ ///
+ /// If set to "1", then RAID1 is enabled in FD-OROM.
+ ///
+ WordReg |= B_PCH_SATA_AHCI_RSTF_R1E;
+ }
+
+ if (SataConfig->Raid10 == PCH_DEVICE_ENABLE) {
+ ///
+ /// If set to "1", then RAID10 is enabled in FD-OROM.
+ ///
+ WordReg |= B_PCH_SATA_AHCI_RSTF_R10E;
+ }
+
+ if (SataConfig->Raid5 == PCH_DEVICE_ENABLE) {
+ ///
+ /// If set to "1", then RAID5 is enabled in FD-OROM.
+ ///
+ WordReg |= B_PCH_SATA_AHCI_RSTF_R5E;
+ }
+
+ if (SataConfig->Irrt == PCH_DEVICE_ENABLE) {
+ ///
+ /// If set to "1", then Intel Rapid Recovery Technology is enabled.
+ ///
+ WordReg |= B_PCH_SATA_AHCI_RSTF_RSTE;
+ }
+
+ if (SataConfig->OromUiBanner == PCH_DEVICE_ENABLE) {
+ ///
+ /// If set to "1" then the OROM UI is shown. Otherwise, no OROM banner or information
+ /// will be displayed if all disks and RAID volumes are Normal.
+ ///
+ WordReg |= B_PCH_SATA_AHCI_RSTF_IRSTOROM;
+ }
+
+ if (SataConfig->IrrtOnly == PCH_DEVICE_ENABLE) {
+ ///
+ /// If set to "1", then only IRRT volumes can span internal and eSATA drives. If cleared
+ /// to "0", then any RAID volume can span internal and eSATA drives.
+ ///
+ WordReg |= B_PCH_SATA_AHCI_RSTF_IROES;
+ }
+ ///
+ /// Enable the RST Smart Storage caching bit to support Smart Storage caching.
+ ///
+ if (SataConfig->SmartStorage == PCH_DEVICE_ENABLE) {
+ WordReg |= B_PCH_SATA_AHCI_RSTF_SEREQ;
+ }
+ ///
+ /// Program the delay of the OROM UI Splash Screen in a normal status.
+ ///
+ WordReg |= (UINT16) (SataConfig->OromUiDelay << N_PCH_SATA_AHCI_RSTF_OUD);
+ }
+ ///
+ /// RSTF(RST Feature Capabilities) is a Write-Once register.
+ ///
+ MmioWrite16 ((UINTN) (AhciBar + R_PCH_SATA_AHCI_RSTF), WordReg);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (AhciBar + R_PCH_SATA_AHCI_RSTF),
+ 1,
+ &WordReg
+ );
+
+ ///
+ /// Set Ahci Bar to zero
+ ///
+ AhciBar = 0;
+ MmioWrite32 (PciD31F2RegBase + R_PCH_SATA_AHCI_BAR, AhciBar);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PciD31F2RegBase + R_PCH_SATA_AHCI_BAR),
+ 1,
+ &AhciBar
+ );
+
+ ///
+ /// Free the GCD pool
+ ///
+ gDS->FreeMemorySpace (
+ MemBaseAddress,
+ V_PCH_SATA_AHCI_BAR_LENGTH
+ );
+ DEBUG ((EFI_D_INFO, "ConfigureSataAhci() End\n"));
+ return EFI_SUCCESS;
+}
+
+/**
+ Disable Sata Controller
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+ @param[in, out] FuncDisableReg Function Disable Register
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+DisableSataController (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN OUT UINT32 *FuncDisableReg
+ )
+{
+ UINTN PciD31F2RegBase;
+ UINTN PciD31F5RegBase;
+ UINT16 SataModeSelect;
+ PCH_SERIES PchSeries;
+
+ PciD31F2RegBase = MmPciAddress (0, PchPlatformPolicy->BusNumber, 31, 2, 0);
+ PciD31F5RegBase = 0;
+ SataModeSelect = MmioRead16 (PciD31F2RegBase + R_PCH_SATA_MAP) & B_PCH_SATA_MAP_SMS_MASK;
+ PchSeries = GetPchSeries();
+
+#ifdef ULT_FLAG
+ if (PchSeries == PchLp) {
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 14.2 SATA Controller Disabling
+ /// Step 1
+ /// Set D31:F2:92h [3:0] to 0000b
+ ///
+ MmioAnd16 (PciD31F2RegBase + R_PCH_SATA_PCS,
+ (UINT16) ~(B_PCH_SATA_PCS_PORT0_EN | B_PCH_SATA_PCS_PORT1_EN | B_PCH_SATA_PCS_PORT2_EN |
+ B_PCH_SATA_PCS_PORT3_EN));
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PciD31F2RegBase + R_PCH_SATA_PCS),
+ 1,
+ (VOID *) (UINTN) (PciD31F2RegBase + R_PCH_SATA_PCS)
+ );
+ ///
+ /// Step 3
+ /// Set Sata Port Clock Disable bits D31:F2:94h[27:24] to Fh
+ ///
+ MmioOr32 ((UINTN) (PciD31F2RegBase + R_PCH_SATA_SCLKCG),
+ (UINT32) (B_PCH_SATA_SCLKCG_PORT0_PCD | B_PCH_SATA_SCLKCG_PORT1_PCD | B_PCH_SATA_SCLKCG_PORT2_PCD |
+ B_PCH_SATA_SCLKCG_PORT3_PCD));
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PciD31F2RegBase + R_PCH_SATA_SCLKCG),
+ 1,
+ (VOID *) (UINTN) (PciD31F2RegBase + R_PCH_SATA_SCLKCG)
+ );
+ ///
+ /// Step 4
+ /// Disabling SATA Device by programming RCBA + 3418h [2][25]
+ ///
+ *FuncDisableReg |= B_PCH_RCRB_FUNC_DIS_SATA1;
+ }
+#endif // ULT_FLAG
+#ifdef TRAD_FLAG
+ if (PchSeries == PchH) {
+ PciD31F5RegBase = MmPciAddress (0, PchPlatformPolicy->BusNumber, 31, 5, 0);
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 14.2 SATA Controller Disabling
+ /// Step 1
+ /// Set D31:F2:92h [5:0] to 000000b
+ ///
+ MmioAnd16 (PciD31F2RegBase + R_PCH_SATA_PCS,
+ (UINT16) ~(B_PCH_SATA_PCS_PORT0_EN | B_PCH_SATA_PCS_PORT1_EN | B_PCH_SATA_PCS_PORT2_EN |
+ B_PCH_SATA_PCS_PORT3_EN | B_PCH_SATA_PCS_PORT4_EN | B_PCH_SATA_PCS_PORT5_EN));
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PciD31F2RegBase + R_PCH_SATA_PCS),
+ 1,
+ (VOID *) (UINTN) (PciD31F2RegBase + R_PCH_SATA_PCS)
+ );
+ if (SataModeSelect == V_PCH_SATA_MAP_SMS_IDE) {
+ ///
+ /// Step 2
+ /// Set D31:F5:92h [1:0] to 00b if SATA is in IDE mode
+ ///
+ MmioAnd16 (PciD31F5RegBase + R_PCH_SATA_PCS,
+ (UINT16) ~(B_PCH_SATA_PCS_PORT0_EN | B_PCH_SATA_PCS_PORT1_EN));
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PciD31F5RegBase + R_PCH_SATA_PCS),
+ 1,
+ (VOID *) (UINTN) (PciD31F5RegBase + R_PCH_SATA_PCS)
+ );
+ }
+ ///
+ /// Step 3
+ /// Set Sata Port Clock Disable bits D31:F2:94h[29:24] to 3Fh
+ ///
+ MmioOr32 ((UINTN) (PciD31F2RegBase + R_PCH_SATA_SCLKCG),
+ (UINT32) (B_PCH_SATA_SCLKCG_PORT0_PCD | B_PCH_SATA_SCLKCG_PORT1_PCD | B_PCH_SATA_SCLKCG_PORT2_PCD |
+ B_PCH_SATA_SCLKCG_PORT3_PCD | B_PCH_SATA_SCLKCG_PORT4_PCD | B_PCH_SATA_SCLKCG_PORT5_PCD));
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PciD31F2RegBase + R_PCH_SATA_SCLKCG),
+ 1,
+ (VOID *) (UINTN) (PciD31F2RegBase + R_PCH_SATA_SCLKCG)
+ );
+ ///
+ /// Step 4
+ /// Disabling SATA Device by programming RCBA + 3418h [2][25]
+ ///
+ *FuncDisableReg |= B_PCH_RCRB_FUNC_DIS_SATA1;
+ *FuncDisableReg |= B_PCH_RCRB_FUNC_DIS_SATA2;
+ }
+#endif // TRAD_FLAG
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchSerialIo.c b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchSerialIo.c
new file mode 100644
index 0000000..16e23a6
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchSerialIo.c
@@ -0,0 +1,997 @@
+/** @file
+ Initializes the PCH Serial IO Controllers.
+
+@copyright
+ Copyright (c) 2012 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "PchInit.h"
+
+#ifdef SERIAL_IO_FLAG
+#include "PchAslUpdateLib.h"
+
+#include EFI_PROTOCOL_DEPENDENCY (AcpiTable)
+
+
+
+#define SERIAL_IO_ADDRESS_AREA 0xFE101000;
+
+//
+// Resource Group Header
+//
+typedef struct {
+ UINT32 ResourceGroupLength;
+ UINT32 VendorId;
+ UINT32 SubVendorId;
+ UINT16 DeviceId;
+ UINT16 SubDeviceId;
+ UINT16 Revision;
+ UINT16 Reserved;
+ UINT32 SharedInfoLength;
+} EFI_ACPI_5_0_CSRT_RESOURCE_GROUP_HEADER;
+
+//
+// Resource Group1 Share Info
+//
+typedef struct {
+ UINT16 MajorVersion1;
+ UINT16 MinorVersion0;
+ UINT32 MmioBaseL;
+ UINT32 MmioBaseH;
+ UINT32 InterruptGSI;
+ UINT8 InterruptPolarity;
+ UINT8 InterruptMode;
+ UINT8 NumberofChannels;
+ UINT8 DMAAddressWidth;
+ UINT16 BaseRequestLine;
+ UINT16 NumberofHandshakeSignals;
+ UINT32 MaximumBlockTransferSize;
+} EFI_ACPI_5_0_RESOURCE_GROUP1_SHARED_INFO;
+
+//
+// Resource Descriptor Header
+//
+typedef struct {
+ UINT32 ResourceDescriptorLength;
+ UINT16 ResourceType;
+ UINT16 ResourceSubType;
+ UINT32 UID;
+} EFI_ACPI_5_0_CSRT_RESOURCE_DESCRIPTOR_HEADER;
+
+//
+// Core System Resources Table Structure (CSRT)
+//
+typedef struct {
+ EFI_ACPI_DESCRIPTION_HEADER Header;
+ EFI_ACPI_5_0_CSRT_RESOURCE_GROUP_HEADER ResourceGroup1;
+ EFI_ACPI_5_0_RESOURCE_GROUP1_SHARED_INFO ResourceGroup1SharedInfo;
+ EFI_ACPI_5_0_CSRT_RESOURCE_DESCRIPTOR_HEADER ControllerResourceDescriptor1;
+ EFI_ACPI_5_0_CSRT_RESOURCE_DESCRIPTOR_HEADER ChannelResourceDescriptor1[8];
+} EFI_ACPI_5_0_CORE_SYSTEM_RESOURCES_TABLE;
+
+typedef enum {
+ INDEX_DMA,
+ INDEX_I2C0,
+ INDEX_I2C1,
+ INDEX_SPI0,
+ INDEX_SPI1,
+ INDEX_UART0,
+ INDEX_UART1,
+ INDEX_SDIO,
+ MAX_SIO_INDEX
+} SIO_DEVICE;
+
+typedef struct {
+ UINT8 DevNum;
+ UINT8 FuncNum;
+ UINT32 DisableAddr;
+ UINT32 AcpiSwitchAddr;
+ UINT32 DeviceModeSwitchBit; // turns device into ACPI mode by hiding its PCI config space
+ UINT32 IrqModeSwitchBit; // turns device's interrupts into ACPI mode
+ UINT32 Signature;
+ UINT8 IrqPin;
+ UINT32 Bar0;
+ UINT32 Bar1;
+} SERIAL_IO_DEVICE_DESCRIPTOR;
+
+#define SERIAL_IO_DEVICE_QUANTITY 8
+
+SERIAL_IO_DEVICE_DESCRIPTOR SerialIoDevice [SERIAL_IO_DEVICE_QUANTITY] =
+{ {21, 0, 0xCE00AA07, 0xCB000240, BIT20, BIT21, EFI_SIGNATURE_32('S','D','M','A'), 2, 0xFE101000, 0xFE102000},
+ {21, 1, 0xCE00AA47, 0xCB000248, BIT20, BIT21, EFI_SIGNATURE_32('I','2','C','0'), 3, 0xFE103000, 0xFE104000},
+ {21, 2, 0xCE00AA87, 0xCB000250, BIT20, BIT21, EFI_SIGNATURE_32('I','2','C','1'), 3, 0xFE105000, 0xFE106000},
+ {21, 3, 0xCE00AAC7, 0xCB000258, BIT20, BIT21, EFI_SIGNATURE_32('S','P','I','0'), 3, 0xFE107000, 0xFE108000},
+ {21, 4, 0xCE00AB07, 0xCB000260, BIT20, BIT21, EFI_SIGNATURE_32('S','P','I','1'), 3, 0xFE109000, 0xFE10A000},
+ {21, 5, 0xCE00AB47, 0xCB000268, BIT20, BIT21, EFI_SIGNATURE_32('U','A','0','0'), 4, 0xFE10B000, 0xFE10C000},
+ {21, 6, 0xCE00AB87, 0xCB000270, BIT20, BIT21, EFI_SIGNATURE_32('U','A','0','1'), 4, 0xFE10D000, 0xFE10E000},
+ {23, 0, 0xCE00AE07, 0xCB000000, BIT4, BIT5, EFI_SIGNATURE_32('S','D','H','C'), 1, 0xFE110000, 0xFE112000}
+};
+
+EFI_STATUS
+InstallDmaAcpiTable (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy
+);
+
+BOOLEAN IsSerialIoDeviceEnabled (
+ SIO_DEVICE Device
+ )
+{
+ UINTN RegBase;
+ UINT32 VendorDeviceId;
+
+ RegBase = MmPciAddress (0, 0, SerialIoDevice[Device].DevNum, SerialIoDevice[Device].FuncNum, 0);
+ VendorDeviceId = MmioRead32 (RegBase + R_PCH_LP_SERIAL_IO_VENDOR_ID);
+ if (VendorDeviceId == 0xFFFFFFFF) {
+ return FALSE;
+ } else {
+ return TRUE;
+ }
+}
+
+/**
+ Disable Serial IO Controllers based on PchPlatformPolicy.
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+ @param[in] RootComplexBar RootComplexBar address of this PCH device
+
+ @retval None
+**/
+VOID
+DisableSerialIoControllers (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar
+ )
+{
+ UINT8 FunctionEnable[SERIAL_IO_DEVICE_QUANTITY];
+ UINTN Address;
+ UINT8 i;
+ BOOLEAN Func0Missing;
+
+ //
+ // Higher functions of a PCI device can't exist if there's no Function0
+ // This issue only applies in PCI mode, not in ACPI.
+ //
+ Func0Missing = PchPlatformPolicy->DeviceEnabling->SerialIoDma == PCH_DEVICE_DISABLE &&
+ PchPlatformPolicy->SerialIoConfig->SerialIoMode == PchSerialIoIsPci;
+
+ //
+ // DMA is useless without at least one SerialIo device
+ //
+ FunctionEnable[INDEX_DMA] = PchPlatformPolicy->DeviceEnabling->SerialIoDma &&
+ ( PchPlatformPolicy->DeviceEnabling->SerialIoI2c0 ||
+ PchPlatformPolicy->DeviceEnabling->SerialIoI2c1 ||
+ PchPlatformPolicy->DeviceEnabling->SerialIoSpi0 ||
+ PchPlatformPolicy->DeviceEnabling->SerialIoSpi1 ||
+ PchPlatformPolicy->DeviceEnabling->SerialIoUart0 ||
+ PchPlatformPolicy->DeviceEnabling->SerialIoUart1 ||
+ PchPlatformPolicy->DeviceEnabling->SerialIoSdio );
+
+ FunctionEnable[INDEX_I2C0] = PchPlatformPolicy->DeviceEnabling->SerialIoI2c0 && !Func0Missing;
+ FunctionEnable[INDEX_I2C1] = PchPlatformPolicy->DeviceEnabling->SerialIoI2c1 && !Func0Missing;
+ FunctionEnable[INDEX_SPI0] = PchPlatformPolicy->DeviceEnabling->SerialIoSpi0 && !Func0Missing;
+ FunctionEnable[INDEX_SPI1] = PchPlatformPolicy->DeviceEnabling->SerialIoSpi1 && !Func0Missing;
+ FunctionEnable[INDEX_UART0] = PchPlatformPolicy->DeviceEnabling->SerialIoUart0 && !Func0Missing;
+ FunctionEnable[INDEX_UART1] = PchPlatformPolicy->DeviceEnabling->SerialIoUart1 && !Func0Missing;
+ //
+ // SDIO doesn't care about DMA missing - it has its own device number
+ //
+ FunctionEnable[INDEX_SDIO] = PchPlatformPolicy->DeviceEnabling->SerialIoSdio;
+
+ DEBUG ((EFI_D_INFO, "DisableSerialIoControllers() Start\n"));
+
+ ///
+ /// PCH BIOS Spec Rev 0.7.0 Section 23.2 Disabling Serial IO Controllers
+ /// By default all controllers are enabled in hardware.
+ ///
+
+ for (i = 0; i < SERIAL_IO_DEVICE_QUANTITY; i++) {
+ if (FunctionEnable[i] == PCH_DEVICE_DISABLE) {
+ ///
+ /// Step 1
+ /// Set the Dx:Fx:84h[1:0] = 11b
+ ///
+ Address = MmPciAddress (0, 0, SerialIoDevice[i].DevNum, SerialIoDevice[i].FuncNum, R_PCH_LP_SERIAL_IO_PME_CTRL_STS);
+ MmioAndThenOr32WithScript(Address, (UINT32)~(B_PCH_LP_SERIAL_IO_PME_CTRL_STS_PWR_ST), BIT1 | BIT0 );
+ ///
+ /// Step 2
+ /// Program IOBP register CE00Axx7h[8] = 1b
+ ///
+ ProgramIobpWithScript (RootComplexBar, SerialIoDevice[i].DisableAddr, (UINT32)~(BIT8), BIT8);
+ }
+ }
+
+ DEBUG ((EFI_D_INFO, "DisableSerialIoControllers() End\n"));
+}
+
+UINT8
+GetSerialIoIrqNumber(
+ UINT8 DeviceNumber,
+ UINT8 InterruptPin,
+ UINT8 InterruptMode
+)
+{
+ UINT32 IrqRoute;
+ UINT8 InterruptRoute;
+ UINT32 RootComplexBar;
+ UINT32 IrqRoutingRegister;
+
+ if (InterruptMode == PchSerialIoIsAcpi) {
+ //
+ // ACPI IRQs are wired to irq pins 5,6,7,13
+ //
+ switch(InterruptPin) {
+ case 0x1:
+ return 5;
+ break;
+ case 0x2:
+ return 6;
+ break;
+ case 0x3:
+ return 7;
+ break;
+ case 0x4:
+ return 13;
+ break;
+ case 0x0:
+ default:
+ return 0;
+ }
+ } else {
+ if(InterruptPin > 0) {
+ //
+ // PCI INTs are first routed to PIRQs according to R_PCH_RCRB_D21IR / R_PCH_RCRB_D23IR register
+ //
+ RootComplexBar = MmioRead32 (
+ MmPciAddress (0,
+ 0,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_RCBA)
+ ) & B_PCH_LPC_RCBA_BAR;
+
+ if (DeviceNumber == 21) {
+ IrqRoutingRegister = R_PCH_RCRB_D21IR;
+ } else if (DeviceNumber == 23) {
+ IrqRoutingRegister = R_PCH_RCRB_D23IR;
+ } else {
+ ASSERT(FALSE);
+ return 0;
+ }
+ IrqRoute = MmioRead32 (RootComplexBar + IrqRoutingRegister);
+
+ InterruptRoute = ( IrqRoute >> (4* (InterruptPin-1) ) ) & 0x7;
+
+ //
+ // ...and PIRQs are wired to irq pins 16..23
+ // A 16, B 17, C 18, D 19, E 20, F 21, G 22, H 23
+ //
+ return (InterruptRoute + 16);
+ } else {
+ return 0;
+ }
+ }
+}
+
+
+/**
+ Update ASL definitions for SerialIo devices.
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+UpdateSerialIoAcpiData (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar
+ )
+{
+
+ EFI_STATUS Status;
+ UINTN RegBase;
+ UINT32 Data32;
+ UINT16 GpioBase;
+ UINT8 i;
+
+ Status = InitializePchAslUpdateLib();
+
+ if(EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ //
+ // ACPI code update for all devices
+ //
+ for (i=0; i<SERIAL_IO_DEVICE_QUANTITY; i++) {
+
+ if (!IsSerialIoDeviceEnabled(i)) {
+ continue;
+ }
+
+ RegBase = MmPciAddress (0, 0, SerialIoDevice[i].DevNum, SerialIoDevice[i].FuncNum, 0);
+
+ Data32 = (MmioRead32(RegBase + R_PCH_LP_SERIAL_IO_BAR0) & B_PCH_LP_SERIAL_IO_BAR0_BAR);
+ UpdateResourceTemplateAslCode(SerialIoDevice[i].Signature,
+ EFI_SIGNATURE_32 ('R', 'B', 'U', 'F'),
+ AML_MEMORY32_FIXED_OP,
+ 1,
+ 0x04,
+ &Data32,
+ sizeof(Data32)
+ );
+ }
+
+ //
+ // Update GPIO device ACPI variables
+ //
+ RegBase = MmPciAddress (0, 0, PCI_DEVICE_NUMBER_PCH_LPC, PCI_FUNCTION_NUMBER_PCH_LPC, 0);
+
+ GpioBase = (MmioRead16(RegBase + R_PCH_LPC_GPIO_BASE) & B_PCH_LPC_GPIO_BASE_BAR);
+
+ //
+ // Update _MIN[32:0] of the DWord Address Space Descriptor with GPIO BAR0
+ //
+ Data32 = (UINT32)GpioBase;
+ UpdateResourceTemplateAslCode((EFI_SIGNATURE_32 ('G', 'P', 'I', '0')),
+ (EFI_SIGNATURE_32 ('R', 'B', 'U', 'F')),
+ AML_DWORD_OP,
+ 1,
+ 0x0A,
+ &Data32,
+ sizeof(Data32)
+ );
+
+ //
+ // Update _MAX[32:0] of the DWord Address Space Descriptor with GPIO BAR0 + 3FFh
+ //
+ Data32 = (UINT32)GpioBase + 0x3FF;
+ UpdateResourceTemplateAslCode((EFI_SIGNATURE_32 ('G', 'P', 'I', '0')),
+ (EFI_SIGNATURE_32 ('R', 'B', 'U', 'F')),
+ AML_DWORD_OP,
+ 1,
+ 0x0E,
+ &Data32,
+ sizeof(Data32)
+ );
+
+
+ return Status;
+}
+
+/**
+ Hide PCI config space of Serial IO Controllers and do any final initialization.
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+PutSerialIoInAcpiMode (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar
+ )
+{
+ EFI_STATUS Status;
+ UINTN Bar1;
+ UINTN RegBase;
+ UINT32 Data32;
+ UINT32 Data32And;
+ UINT32 Data32Or;
+ UINT8 i;
+
+ Status = EFI_SUCCESS;
+
+ Status = InitializePchAslUpdateLib();
+
+ if(EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ //
+ // ACPI code update for all devices
+ //
+ for (i=0; i<SERIAL_IO_DEVICE_QUANTITY; i++) {
+
+ if (!IsSerialIoDeviceEnabled(i)) {
+ continue;
+ }
+
+ RegBase = MmPciAddress (0, 0, SerialIoDevice[i].DevNum, SerialIoDevice[i].FuncNum, 0);
+
+ Data32 = (MmioRead32(RegBase + R_PCH_LP_SERIAL_IO_BAR1) & B_PCH_LP_SERIAL_IO_BAR1_BAR);
+ UpdateResourceTemplateAslCode(EFI_SIGNATURE_32 ('S', 'I', 'R', 'C'),
+ EFI_SIGNATURE_32 ('B', 'U', 'F', ('1'+i)),
+ AML_MEMORY32_FIXED_OP,
+ 1,
+ 0x04,
+ &Data32,
+ sizeof(Data32)
+ );
+
+ Data32 = GetSerialIoIrqNumber(SerialIoDevice[i].DevNum, SerialIoDevice[i].IrqPin, PchPlatformPolicy->SerialIoConfig->SerialIoInterruptMode);
+ UpdateResourceTemplateAslCode(SerialIoDevice[i].Signature,
+ EFI_SIGNATURE_32 ('R', 'B', 'U', 'F'),
+ AML_INTERRUPT_DESC_OP,
+ 1,
+ 0x05,
+ &Data32,
+ sizeof(UINT8)
+ );
+
+ }
+
+ //
+ // Install DMA CSRT ACPI table as per ACPI5.0 spec
+ //
+ if(PchPlatformPolicy->DeviceEnabling->SerialIoDma == PCH_DEVICE_ENABLE) {
+ InstallDmaAcpiTable(PchPlatformPolicy);
+ }
+
+ ///
+ /// PCH BIOS Spec Rev 0.7.0 Section 23.6 Enable Serial IO PCI Controllers ACPI Mode
+ ///
+
+ for (i = 0; i < SERIAL_IO_DEVICE_QUANTITY; i++) {
+ ///
+ /// Check if SerialIo device is present
+ ///
+ if (!IsSerialIoDeviceEnabled(i)) {
+ continue;
+ }
+
+ ///
+ /// Get BAR1 Address
+ ///
+ Bar1 = MmioRead32(
+ MmPciAddress (0,
+ PchPlatformPolicy->BusNumber,
+ SerialIoDevice[i].DevNum,
+ SerialIoDevice[i].FuncNum,
+ R_PCH_LP_SERIAL_IO_BAR1)
+ ) & B_PCH_LP_SERIAL_IO_BAR1_BAR;
+
+ ///
+ /// Step 1
+ /// Program Dx:Fx:04h[2:1] = 11b
+ /// (skipped - this was performed while assigning BARs)
+ ///
+
+ ///
+ /// Step 2
+ /// Program Dx:Fx to ACPI Mode
+ ///
+ Data32And = 0xFFFFFFFF;
+ Data32Or = SerialIoDevice[i].DeviceModeSwitchBit;
+ ProgramIobpWithScript (RootComplexBar, SerialIoDevice[i].AcpiSwitchAddr, Data32And, Data32Or);
+
+ ///
+ /// Set D3Hot Power State via BAR1 Address, for all devices except DMA
+ ///
+ if(i != INDEX_DMA) {
+ Data32And = (UINT32) ~B_PCH_LP_SERIAL_IO_PME_CTRL_STS_PWR_ST;
+ Data32Or = B_PCH_LP_SERIAL_IO_PME_CTRL_STS_PWR_ST;
+
+ PCH_INIT_COMMON_SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ Bar1 + R_PCH_LP_SERIAL_IO_PME_CTRL_STS,
+ &Data32Or,
+ &Data32And
+ );
+ }
+
+ }
+
+ return Status;
+}
+
+/**
+ Assigns MMIO addresses for SerialIO controllers from a predefined pool
+
+ @retval None
+**/
+EFI_STATUS
+AssignBARs (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy
+)
+{
+ EFI_PHYSICAL_ADDRESS Bar;
+ EFI_PHYSICAL_ADDRESS RegBase;
+ EFI_STATUS Status;
+ UINTN i;
+ UINT64 TotalSize;
+ UINT32 IrqNumber;
+
+ Bar = SERIAL_IO_ADDRESS_AREA;
+ TotalSize = 2 * ((SERIAL_IO_DEVICE_QUANTITY - 1) * V_PCH_LP_SERIAL_IO_BAR_SIZE + V_PCH_LP_SERIAL_SDIO_BAR_SIZE);
+
+ Status = gDS->AddMemorySpace (
+ EfiGcdMemoryTypeReserved,
+ Bar,
+ TotalSize,
+ 0
+ );
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+ Status = gDS->AllocateMemorySpace (
+ EfiGcdAllocateAddress,
+ EfiGcdMemoryTypeReserved,
+ N_PCH_LP_SERIAL_IO_BAR_ALIGNMENT,
+ TotalSize,
+ &Bar,
+ mImageHandle,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ for (i = 0; i < SERIAL_IO_DEVICE_QUANTITY; i++) {
+ if (!IsSerialIoDeviceEnabled(i)) {
+ continue;
+ }
+ RegBase = MmPciAddress (0, 0, SerialIoDevice[i].DevNum, SerialIoDevice[i].FuncNum, 0);
+
+ MmioAndThenOr32WithScript(RegBase + R_PCH_LP_SERIAL_IO_BAR0, 0x0, SerialIoDevice[i].Bar0);
+ MmioAndThenOr32WithScript(RegBase + R_PCH_LP_SERIAL_IO_BAR1, 0x0, SerialIoDevice[i].Bar1);
+
+ MmioAndThenOr32WithScript(RegBase + R_PCH_LP_SERIAL_IO_COMMAND,
+ 0xFFFFFFFF,
+ B_PCH_LP_SERIAL_IO_COMMAND_BME | B_PCH_LP_SERIAL_IO_COMMAND_MSE
+ );
+ IrqNumber = GetSerialIoIrqNumber(SerialIoDevice[i].DevNum, SerialIoDevice[i].IrqPin, PchPlatformPolicy->SerialIoConfig->SerialIoInterruptMode);
+ MmioAndThenOr32WithScript(RegBase + R_PCH_PCIE_INTR, (UINT32)~B_PCH_PCIE_INTR_ILINE, IrqNumber);
+ }
+ return Status;
+
+}
+
+
+/**
+ Hides SerialIo controllers from Pci config space
+ This prevents BIOS Pci enumerator from assigning mmio resources
+ SerialIo controllers will receive addresses from a separate pool
+
+ @param[in] RootComplexBar RootComplexBar address of this PCH device
+
+ @retval None
+**/
+VOID
+HideSerialIoDevices (
+ IN UINT32 RootComplexBar
+ )
+{
+ UINTN i;
+ UINT32 Data32And;
+ UINT32 Data32Or;
+
+ for (i = 0; i < SERIAL_IO_DEVICE_QUANTITY; i++) {
+ Data32And = (UINT32) 0xFFFFFFFF;
+ Data32Or = (UINT32) SerialIoDevice[i].DeviceModeSwitchBit;
+
+ ProgramIobpWithScript (RootComplexBar, SerialIoDevice[i].AcpiSwitchAddr, Data32And, Data32Or);
+ }
+}
+
+/**
+ Reveals SerialIo controllers' Pci config space
+ This allows BIOS to complete initialization for those devices
+
+ @param[in] RootComplexBar RootComplexBar address of this PCH device
+
+ @retval None
+**/
+VOID
+RevealConfigSpace (
+ IN UINT32 RootComplexBar
+ )
+{
+ UINTN i;
+ UINT32 Data32And;
+ UINT32 Data32Or;
+
+ for (i = 0; i < SERIAL_IO_DEVICE_QUANTITY; i++) {
+ Data32And = (UINT32)~(SerialIoDevice[i].DeviceModeSwitchBit);
+ Data32Or = (UINT32) 0x0;
+ ProgramIobpWithScript (RootComplexBar, SerialIoDevice[i].AcpiSwitchAddr, Data32And, Data32Or);
+ }
+}
+
+
+/**
+ Configures Serial IO Controllers
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+ @param[in] RootComplexBar RootComplexBar address of this PCH device
+
+ @retval None
+**/
+EFI_STATUS
+ConfigureSerialIoDevices (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar
+ )
+{
+ UINT8 Index;
+ UINTN RegBase;
+ UINTN Bar0;
+ UINT32 Data32And;
+ UINT32 Data32Or;
+ UINT8 i;
+
+ for (i = 0; i < INDEX_SDIO; i++) {
+ ///
+ /// Check if device is present
+ ///
+ if (!IsSerialIoDeviceEnabled(i)) {
+ continue;
+ }
+ RegBase = MmPciAddress (0, 0, SerialIoDevice[i].DevNum, SerialIoDevice[i].FuncNum, 0);
+
+ Bar0 = MmioRead32 (RegBase + R_PCH_LP_SERIAL_IO_BAR0);
+
+ if(i != PCI_FUNCTION_NUMBER_PCH_LP_SERIAL_IO_DMA) {
+ ///
+ /// PCH BIOS Spec Rev 0.7.0 Section 23.3 Serial IO LTR Programming
+ /// Step 1: Program BAR0 + 808h[2] = 0b
+ /// Step 2: Program BAR0 + 804h[1:0] = 00b
+ /// Step 3: Program BAR0 + 804h[1:0] = 11b
+ ///
+ MmioAndThenOr32WithScript (Bar0 + R_PCH_LP_SERIAL_IO_PPR_GEN, (UINT32)(~B_PCH_LP_SERIAL_IO_PPR_GEN_LTR_MODE), 0x0);
+ MmioAndThenOr32WithScript (Bar0 + R_PCH_LP_SERIAL_IO_PPR_RST, (UINT32)(~(B_PCH_LP_SERIAL_IO_PPR_RST_FUNC | B_PCH_LP_SERIAL_IO_PPR_RST_APB)), 0);
+ MmioAndThenOr32WithScript (Bar0 + R_PCH_LP_SERIAL_IO_PPR_RST, 0xFFFFFFFF, (UINT32)(B_PCH_LP_SERIAL_IO_PPR_RST_FUNC | B_PCH_LP_SERIAL_IO_PPR_RST_APB));
+
+ ///
+ /// Step 4
+ /// Program BAR0 + 814h with LTR value for each SerialIo controller
+ ///
+ MmioAndThenOr32WithScript(Bar0 + R_PCH_LP_SERIAL_IO_PPR_AUTO_LTR, 0, 0);
+ }
+
+ ///
+ /// PCH BIOS Spec Rev 0.7.0 Section 23.7 Serial IO Power Management Programming
+ /// Step 4
+ /// Program IO Voltage Select for I2C0 & I2C1 as per platform policy
+ ///
+ if(i == PCI_FUNCTION_NUMBER_PCH_LP_SERIAL_IO_I2C0) {
+ if (PchPlatformPolicy->SerialIoConfig->I2c0VoltageSelect == PchSerialIoIs33V) {
+ MmioAndThenOr32WithScript(Bar0 + R_PCH_LP_SERIAL_IO_PPR_GEN, (UINT32)~(B_PCH_LP_SERIAL_IO_PPR_GEN_IO_VOLTAGE_SEL), 0);
+ } else {
+ MmioAndThenOr32WithScript(Bar0 + R_PCH_LP_SERIAL_IO_PPR_GEN, 0xFFFFFFFF, B_PCH_LP_SERIAL_IO_PPR_GEN_IO_VOLTAGE_SEL);
+ }
+ }
+
+ if(i== PCI_FUNCTION_NUMBER_PCH_LP_SERIAL_IO_I2C1) {
+ if (PchPlatformPolicy->SerialIoConfig->I2c1VoltageSelect == PchSerialIoIs33V) {
+ MmioAndThenOr32WithScript(Bar0 + R_PCH_LP_SERIAL_IO_PPR_GEN, (UINT32)~(B_PCH_LP_SERIAL_IO_PPR_GEN_IO_VOLTAGE_SEL), 0);
+ } else {
+ MmioAndThenOr32WithScript(Bar0 + R_PCH_LP_SERIAL_IO_PPR_GEN, 0xFFFFFFFF, B_PCH_LP_SERIAL_IO_PPR_GEN_IO_VOLTAGE_SEL);
+ }
+ }
+
+ ///
+ /// PCH BIOS Spec Rev 0.7.0 Section 23.4 Serial IO Interrupt Programming
+ /// Step 4
+ /// Program D21:Fx to PCI Interrupt Mode
+ ///
+ Data32And = (UINT32)~(SerialIoDevice[i].IrqModeSwitchBit);
+ if(PchPlatformPolicy->SerialIoConfig->SerialIoInterruptMode == PchSerialIoIsAcpi) {
+ Data32Or = SerialIoDevice[i].IrqModeSwitchBit;
+ } else {
+ Data32Or = 0x00;
+ }
+
+ ///
+ /// PCH BIOS Spec Rev 0.7.0 Section 23.7 Serial IO Power Management Programming
+ /// Step 5
+ /// Program D21:Fx FAB_PM_CAP_PRSNT_PORT0
+ ///
+ Data32Or |= BIT1;
+ ProgramIobpWithScript (RootComplexBar, SerialIoDevice[i].AcpiSwitchAddr, Data32And, Data32Or);
+ }
+
+ ///
+ /// Check if SDIO device is present
+ ///
+ if (IsSerialIoDeviceEnabled(INDEX_SDIO)) {
+
+ RegBase = MmPciAddress (0, 0, SerialIoDevice[INDEX_SDIO].DevNum, SerialIoDevice[INDEX_SDIO].FuncNum, 0);
+
+ Bar0 = MmioRead32 (RegBase + R_PCH_LP_SERIAL_IO_BAR0);
+
+ MmioAndThenOr32WithScript (Bar0 + R_PCH_LP_SERIAL_IO_SDIO_SLAVE_DELAY_DDR50_MODE, 0, 0x00000306);
+
+
+ ///
+ /// PCH BIOS Spec Rev 0.3.0 Section 23.3 Serial IO LTR Programming
+ /// Step 5
+ /// Program BAR0 + 1008h[2] = 1b
+ ///
+ MmioAndThenOr32WithScript (Bar0 + R_PCH_LP_SERIAL_IO_SDIO_PPR_GEN, 0xFFFFFFFF, B_PCH_LP_SERIAL_IO_SDIO_PPR_GEN_LTR_MODE);
+
+ ///
+ /// Step 6
+ /// Program BAR0 + 1010h = 0x00000000 for SDIO controller
+ ///
+ Data32And = 0x00000000;
+ MmioAndThenOr32WithScript (Bar0 + R_PCH_LP_SERIAL_IO_SDIO_PPR_SW_LTR, 0, 0);
+
+ ///
+ /// Program D23:F0 to PCI Interrupt Mode
+ ///
+ Data32And = (UINT32)~(SerialIoDevice[INDEX_SDIO].IrqModeSwitchBit);
+ if(PchPlatformPolicy->SerialIoConfig->SerialIoInterruptMode == PchSerialIoIsAcpi) {
+ Data32Or = SerialIoDevice[INDEX_SDIO].IrqModeSwitchBit;
+ } else {
+ Data32Or = 0x00;
+ }
+ ProgramIobpWithScript (RootComplexBar, SerialIoDevice[INDEX_SDIO].AcpiSwitchAddr, Data32And, Data32Or);
+ }
+
+ ///
+ /// PCH BIOS Spec Rev 0.7.0 Section 23.4 Serial IO Interrupt Programing
+ ///
+ if(PchPlatformPolicy->SerialIoConfig->SerialIoInterruptMode == PchSerialIoIsAcpi) {
+ ///
+ /// Enable ACPI IRQ for IRQ13, IRQ7, IRQ6, IRQ5 in RCRB
+ ///
+ Data32Or = (B_PCH_RCRB_INT_ACPIIRQEN_A13E | B_PCH_RCRB_INT_ACPIIRQEN_A7E | B_PCH_RCRB_INT_ACPIIRQEN_A6E | B_PCH_RCRB_INT_ACPIIRQEN_A5E);
+ MmioAndThenOr32WithScript((UINTN)(RootComplexBar + R_PCH_RCRB_INT_ACPIIRQEN), 0xFFFFFFFF, Data32Or);
+ }
+
+#ifdef ULT_FLAG
+ if (GetPchSeries() == PchLp) {
+ for (Index = 0; Index < (sizeof (PchSerialIoIntsLptLp) / sizeof (IOBP_MMIO_TABLE_STRUCT)); Index++) {
+ ///
+ /// Program IOBP register
+ ///
+ Data32And = PchSerialIoIntsLptLp[Index].AndMask;
+ Data32Or = PchSerialIoIntsLptLp[Index].OrMask;
+ ProgramIobpWithScript (RootComplexBar, PchSerialIoIntsLptLp[Index].Address, Data32And, Data32Or);
+ }
+ }
+#endif //ULT_FLAG
+
+ ///
+ /// PCH BIOS Spec Rev 0.3.0 Section 31.22.6 Serial IO Power Management Programming
+ /// Step 1
+ /// Program CB000154h[12,9:8,4:0] = 1001100011111b
+ ///
+ Data32And = (UINT32)~(BIT12 | BIT9 | BIT8 | BIT4 | BIT3 | BIT2 | BIT1 | BIT0);
+ Data32Or = (UINT32) (BIT12 | BIT9 | BIT8 | BIT4 | BIT3 | BIT2 | BIT1 | BIT0);
+
+ if (PchPlatformPolicy->Revision >= DXE_PCH_PLATFORM_POLICY_PROTOCOL_REVISION_6) {
+ if (PchPlatformPolicy->SerialIoConfig->Ddr50Support) {
+ Data32Or |= BIT6;
+ }
+ }
+
+ ProgramIobpWithScript (RootComplexBar, 0xCB000154, Data32And, Data32Or);
+
+ ///
+ /// Step 2
+ /// Programming done above
+ ///
+ /// Step 3
+ /// Program CB000180h[5:0] = 111111b
+ ///
+ Data32And = (UINT32)~(BIT5 | BIT4 | BIT3 | BIT2 | BIT1 | BIT0);
+ Data32Or = (UINT32) (BIT5 | BIT4 | BIT3 | BIT2 | BIT1 | BIT0);
+ ProgramIobpWithScript (RootComplexBar, 0xCB000180, Data32And, Data32Or);
+
+#ifdef ULT_FLAG
+ if (GetPchSeries() == PchLp) {
+ ///
+ /// PCH BIOS Spec Rev 0.3.0 Section 23.8 Serial IO Snoop Programing
+ ///
+ for (Index = 0; Index < (sizeof (PchSerialIoSnoopLptLp) / sizeof (IOBP_MMIO_TABLE_STRUCT)); Index++) {
+ ///
+ /// Program IOBP register
+ ///
+ ProgramIobpWithScript (
+ RootComplexBar,
+ PchSerialIoSnoopLptLp[Index].Address,
+ PchSerialIoSnoopLptLp[Index].AndMask,
+ PchSerialIoSnoopLptLp[Index].OrMask
+ );
+ }
+ }
+#endif // ULT_FLAG
+
+ return EFI_SUCCESS;
+}
+
+VOID
+ConfigureSerialIoAtBoot (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy
+ )
+{
+ UINTN i;
+ UINT8 FunctionEnable[SERIAL_IO_DEVICE_QUANTITY];
+
+ if (PchPlatformPolicy->SerialIoConfig->SerialIoMode != PchSerialIoIsAcpi) {
+ return;
+ }
+
+ FunctionEnable[INDEX_I2C0] = PchPlatformPolicy->DeviceEnabling->SerialIoI2c0;
+ FunctionEnable[INDEX_I2C1] = PchPlatformPolicy->DeviceEnabling->SerialIoI2c1;
+ FunctionEnable[INDEX_SPI0] = PchPlatformPolicy->DeviceEnabling->SerialIoSpi0;
+ FunctionEnable[INDEX_SPI1] = PchPlatformPolicy->DeviceEnabling->SerialIoSpi1;
+ FunctionEnable[INDEX_UART0] = PchPlatformPolicy->DeviceEnabling->SerialIoUart0;
+ FunctionEnable[INDEX_UART1] = PchPlatformPolicy->DeviceEnabling->SerialIoUart1;
+ FunctionEnable[INDEX_SDIO] = PchPlatformPolicy->DeviceEnabling->SerialIoSdio;
+
+ for (i=INDEX_I2C0; i<MAX_SIO_INDEX; i++) {
+ if (!FunctionEnable[i]) {
+ continue;
+ }
+
+ ///
+ /// Set D3Hot Power State via BAR1 Address, for all devices except DMA
+ ///
+ if(i != INDEX_DMA) {
+ MmioAndThenOr32 (SerialIoDevice[i].Bar1 + R_PCH_LP_SERIAL_IO_PME_CTRL_STS,
+ (UINT32) ~B_PCH_LP_SERIAL_IO_PME_CTRL_STS_PWR_ST,
+ B_PCH_LP_SERIAL_IO_PME_CTRL_STS_PWR_ST
+ );
+ MmioRead32(SerialIoDevice[i].Bar1 + R_PCH_LP_SERIAL_IO_PME_CTRL_STS);
+ }
+ }
+}
+
+
+/**
+ Configures Serial IO Controllers after Pci Enum
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+ @param[in] RootComplexBar RootComplexBar address of this PCH device
+
+ @retval None
+**/
+EFI_STATUS
+ConfigureSerialIoBeforeBoot (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar
+ )
+{
+
+ RevealConfigSpace(RootComplexBar);
+ DisableSerialIoControllers(PchPlatformPolicy, RootComplexBar);
+ AssignBARs(PchPlatformPolicy);
+ ConfigureSerialIoDevices(PchPlatformPolicy, RootComplexBar);
+ UpdateSerialIoAcpiData(PchPlatformPolicy, RootComplexBar);
+
+ if (PchPlatformPolicy->SerialIoConfig->SerialIoMode == PchSerialIoIsAcpi) {
+ PutSerialIoInAcpiMode(PchPlatformPolicy, RootComplexBar);
+ }
+ return EFI_SUCCESS;
+}
+
+
+EFI_STATUS
+ConfigureSerialIo (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar
+ )
+{
+ HideSerialIoDevices(RootComplexBar);
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+InstallDmaAcpiTable (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy
+)
+{
+ UINTN AcpiTableKey;
+ EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
+ EFI_ACPI_5_0_CORE_SYSTEM_RESOURCES_TABLE *CoreSystemResourcesTable;
+ UINT64 Data64;
+ UINT32 Data32;
+ UINTN RegBase;
+ UINT8 Index;
+ EFI_STATUS Status;
+ UINT32 IrqNumber;
+
+ AcpiTable = NULL;
+ CoreSystemResourcesTable = NULL;
+ AcpiTableKey = 0;
+
+ //
+ // Locate ACPI support protocol
+ //
+ Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, &AcpiTable);
+ if( EFI_ERROR(Status) || AcpiTable == NULL) {
+ return EFI_UNSUPPORTED;
+ }
+ //
+ // Allocate Memory for Core System Resources Table
+ //
+ CoreSystemResourcesTable = AllocateZeroPool(sizeof(EFI_ACPI_5_0_CORE_SYSTEM_RESOURCES_TABLE));
+
+ if(CoreSystemResourcesTable == NULL) {
+ return EFI_UNSUPPORTED;
+ }
+
+ CoreSystemResourcesTable->Header.Signature = EFI_SIGNATURE_32('C','S','R','T');
+ CoreSystemResourcesTable->Header.Length = sizeof(EFI_ACPI_5_0_CORE_SYSTEM_RESOURCES_TABLE);
+ CoreSystemResourcesTable->Header.Revision = 0x01;
+ CoreSystemResourcesTable->Header.Checksum = 0x00;
+ Data64 = EFI_SIGNATURE_64 ('I', 'N', 'T', 'L', 0, 0, 0, 0);
+ CopyMem (&CoreSystemResourcesTable->Header.OemId, &Data64, sizeof(CoreSystemResourcesTable->Header.OemId));
+ Data64 = EFI_SIGNATURE_64 ('H', 'S', 'W', 'U', 'L', 'T', '-', 'R');
+ CopyMem (&CoreSystemResourcesTable->Header.OemTableId, &Data64, sizeof(CoreSystemResourcesTable->Header.OemTableId));
+ CoreSystemResourcesTable->Header.OemRevision = 0x00000001;
+ CoreSystemResourcesTable->Header.CreatorId = EFI_SIGNATURE_32('I','N','T','L');
+ CoreSystemResourcesTable->Header.CreatorRevision = 0x20100528;
+
+ CoreSystemResourcesTable->ResourceGroup1.ResourceGroupLength = sizeof(EFI_ACPI_5_0_CORE_SYSTEM_RESOURCES_TABLE) - sizeof(EFI_ACPI_DESCRIPTION_HEADER);
+ CoreSystemResourcesTable->ResourceGroup1.VendorId = EFI_SIGNATURE_32('I','N','T','L');
+ CoreSystemResourcesTable->ResourceGroup1.SubVendorId = 0x00000000;
+ CoreSystemResourcesTable->ResourceGroup1.DeviceId = 0x9C60;
+ CoreSystemResourcesTable->ResourceGroup1.SubDeviceId = 0x0000;
+ CoreSystemResourcesTable->ResourceGroup1.Revision = 0x0001;
+ CoreSystemResourcesTable->ResourceGroup1.Reserved = 0x0000;
+ CoreSystemResourcesTable->ResourceGroup1.SharedInfoLength = 0x00000001C;
+ CoreSystemResourcesTable->ResourceGroup1SharedInfo.MajorVersion1 = 0x001;
+ CoreSystemResourcesTable->ResourceGroup1SharedInfo.MinorVersion0 = 0x000;
+
+ RegBase = MmPciAddress (0, 0, SerialIoDevice[INDEX_DMA].DevNum, SerialIoDevice[INDEX_DMA].FuncNum, 0);
+ Data32 = (MmioRead32(RegBase + R_PCH_LP_SERIAL_IO_BAR0) & B_PCH_LP_SERIAL_IO_BAR0_BAR);
+ CoreSystemResourcesTable->ResourceGroup1SharedInfo.MmioBaseL = Data32;
+ CoreSystemResourcesTable->ResourceGroup1SharedInfo.MmioBaseH = 0x00000000;
+ //
+ // Match DMA interrupt value
+ //
+ IrqNumber = GetSerialIoIrqNumber(SerialIoDevice[INDEX_DMA].DevNum, SerialIoDevice[INDEX_DMA].IrqPin, PchPlatformPolicy->SerialIoConfig->SerialIoInterruptMode);
+ CoreSystemResourcesTable->ResourceGroup1SharedInfo.InterruptGSI = IrqNumber;
+
+ CoreSystemResourcesTable->ResourceGroup1SharedInfo.InterruptPolarity = 0x02;
+ CoreSystemResourcesTable->ResourceGroup1SharedInfo.InterruptMode = 0x00;
+ CoreSystemResourcesTable->ResourceGroup1SharedInfo.NumberofChannels = 0x08;
+ CoreSystemResourcesTable->ResourceGroup1SharedInfo.DMAAddressWidth = 0x20;
+
+ CoreSystemResourcesTable->ResourceGroup1SharedInfo.BaseRequestLine = 0x0010;
+ CoreSystemResourcesTable->ResourceGroup1SharedInfo.NumberofHandshakeSignals = 0x0010;
+ CoreSystemResourcesTable->ResourceGroup1SharedInfo.MaximumBlockTransferSize = 0x00000FFF;
+
+ CoreSystemResourcesTable->ControllerResourceDescriptor1.ResourceDescriptorLength = 0x0000000C;
+ CoreSystemResourcesTable->ControllerResourceDescriptor1.ResourceType = 0x0003;
+ CoreSystemResourcesTable->ControllerResourceDescriptor1.ResourceSubType = 0x0001;
+ CoreSystemResourcesTable->ControllerResourceDescriptor1.UID = 0x20495053;
+
+ Data32 = 0x30414843;
+ for(Index = 0; Index < 8; Index++) {
+ CoreSystemResourcesTable->ChannelResourceDescriptor1[Index].ResourceDescriptorLength = 0x0000000C;
+ CoreSystemResourcesTable->ChannelResourceDescriptor1[Index].ResourceType = 0x0003;
+ CoreSystemResourcesTable->ChannelResourceDescriptor1[Index].ResourceSubType = 0x0000;
+ CoreSystemResourcesTable->ChannelResourceDescriptor1[Index].UID = Data32;
+ Data32 += 0x1000000;
+ }
+ Status = AcpiTable->InstallAcpiTable (AcpiTable, CoreSystemResourcesTable, CoreSystemResourcesTable->Header.Length, &AcpiTableKey);
+ return Status;
+}
+
+
+
+#endif // SERIAL_IO_FLAG
+
+
+
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchUsb.c b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchUsb.c
new file mode 100644
index 0000000..ddf41a8
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchUsb.c
@@ -0,0 +1,439 @@
+/** @file
+ Initializes PCH USB Controllers.
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "PchInit.h"
+
+/**
+ Lock USB registers before boot
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy
+
+ @retval None
+**/
+VOID
+UsbInitBeforeBoot(
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy
+)
+{
+ EFI_STATUS Status;
+ UINT32 XhccCfg;
+ UINTN XhciPciMmBase;
+ UINT32 XhciMmioBase;
+ UINT32 Data32And;
+ UINT32 Data32Or;
+ UINT32 PchSeries;
+ UINT16 OrgCommandWord;
+ BOOLEAN NeedGcdMemSpace;
+
+ Data32And = 0xFFFFFFFF;
+ Data32Or = 0x0;
+ NeedGcdMemSpace = FALSE;
+
+ if (PchPlatformPolicy->UsbConfig->Usb30Settings.Mode == PCH_XHCI_MODE_OFF) {
+ return;
+ }
+
+ XhciPciMmBase = MmPciAddress (
+ 0,
+ PchPlatformPolicy->BusNumber,
+ PCI_DEVICE_NUMBER_PCH_XHCI,
+ PCI_FUNCTION_NUMBER_PCH_XHCI,
+ 0
+ );
+ XhciMmioBase = MmioRead32(XhciPciMmBase + R_PCH_XHCI_MEM_BASE) & ~(0x0F);
+ if(XhciMmioBase == 0){
+ ///
+ /// Allocate GCD mem space
+ ///
+ XhciMmioBase = 0xFFFFFFFF;
+ Status = gDS->AllocateMemorySpace (
+ EfiGcdAllocateMaxAddressSearchBottomUp,
+ EfiGcdMemoryTypeMemoryMappedIo,
+ N_PCH_XHCI_MEM_ALIGN,
+ V_PCH_XHCI_MEM_LENGTH,
+ (EFI_PHYSICAL_ADDRESS *)&XhciMmioBase,
+ mImageHandle,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+ NeedGcdMemSpace = TRUE;
+ MmioWrite32 (XhciPciMmBase + R_PCH_XHCI_MEM_BASE, XhciMmioBase);
+ }
+ PchSeries = GetPchSeries();
+
+ ///
+ ///Restore xHCI MMIO Enable
+ ///
+ OrgCommandWord = MmioRead16 (XhciPciMmBase + R_PCH_XHCI_COMMAND_REGISTER);
+ MmioOr16 (
+ XhciPciMmBase + R_PCH_XHCI_COMMAND_REGISTER,
+ (UINT16) (B_PCH_XHCI_COMMAND_MSE | B_PCH_XHCI_COMMAND_BME)
+ );
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (XhciPciMmBase + R_PCH_XHCI_COMMAND_REGISTER),
+ 1,
+ (VOID *) (UINTN) (XhciPciMmBase + R_PCH_XHCI_COMMAND_REGISTER)
+ );
+
+ ///
+ ///Restore xHCI BAR
+ ///
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciPciMmBase + R_PCH_XHCI_MEM_BASE),
+ 1,
+ (VOID *) (UINTN) (XhciPciMmBase + R_PCH_XHCI_MEM_BASE)
+ );
+
+ if (PchSeries == PchH) {
+ ///
+ /// For LPT-H, Set xHCIBAR + 8144h[8, 7, 6] to 1b, 0b, 0b
+ ///
+ MmioAndThenOr32 (XhciMmioBase + 0x8144, (UINT32) ~(BIT7 | BIT6), (UINT32) (BIT8));
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciMmioBase + 0x8144),
+ 1,
+ (VOID *) (UINTN) (XhciMmioBase + 0x8144)
+ );
+ } else if (PchSeries == PchLp) {
+ ///
+ /// For LPT-LP, Set xHCIBAR + 8144h[8, 7, 6] to 1b, 1b, 1b
+ ///
+ MmioOr32 (XhciMmioBase + 0x8144, (UINT32) (BIT8 | BIT7 | BIT6));
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciMmioBase + 0x8144),
+ 1,
+ (VOID *) (UINTN) (XhciMmioBase + 0x8144)
+ );
+ ///
+ /// For LPT-LP, Set xHCIBAR + 816Ch[19:0] to 000E0038h
+ ///
+ Data32And = (UINT32) ~(0x000FFFFF);
+ Data32Or = (UINT32) (0x000E0038);
+ MmioAndThenOr32 (
+ (XhciMmioBase + 0x816C),
+ Data32And,
+ Data32Or
+ );
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciMmioBase + 0x816C),
+ 1,
+ (VOID *) (UINTN) (XhciMmioBase + 0x816C)
+ );
+ ///
+ /// For LPT-LP, Set D20:F0:B0h[17,14,13] to 1b, 0b, 0b
+ ///
+ MmioAndThenOr32 (XhciPciMmBase + 0xB0, (UINT32) ~(BIT14 | BIT13), (UINT32) (BIT17));
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciPciMmBase + 0xB0),
+ 1,
+ (VOID *) (UINTN) (XhciPciMmBase + 0xB0)
+ );
+ }
+
+ ///
+ /// Set D20:F0:50h[28:0] to 0FCE2E5F for LPT-LP
+ /// Set D20:F0:50h[26:0] to 07886E9Fh for LPT-H B0 onward
+ ///
+ if (PchSeries == PchH) {
+ Data32And = (UINT32)~(0x07FFFFFF);
+ Data32Or = (UINT32) (0x07886E9F);
+ } else if (PchSeries == PchLp) {
+ Data32And = (UINT32) ~(0x1FFFFFFF);
+ Data32Or = (UINT32) (0x0FCE2E5F);
+ }
+ MmioAndThenOr32 (
+ (XhciPciMmBase + 0x50),
+ Data32And,
+ Data32Or
+ );
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciPciMmBase + 0x50),
+ 1,
+ (VOID *) (UINTN) (XhciPciMmBase + 0x50)
+ );
+
+ if ((GetBootModeHob () == BOOT_ON_S4_RESUME) &&
+ (PchPlatformPolicy->UsbConfig->UsbPrecondition == PCH_DEVICE_ENABLE)) {
+ ///
+ /// For LPT-LP, Set xHCIBAR + 80E0[24] to 1h
+ ///
+ MmioOr32 (XhciMmioBase + 0x80E0, (UINT32) (BIT24));
+
+ ///
+ /// For LPT-LP, Set xHCIBAR + 80E0[24] to 0h
+ ///
+ MmioAnd32 (XhciMmioBase + 0x80E0, (UINT32) ~(BIT24));
+ }
+
+ ///
+ /// PCH BIOS Spec xHCI controller setup
+ /// Note:
+ /// D20:F0:40h is write once register.
+ /// Unsupported Request Detected bit is write clear
+ ///
+ XhccCfg = MmioRead32 (XhciPciMmBase + R_PCH_XHCI_XHCC1);
+ XhccCfg &= (UINT32) ~(B_PCH_XHCI_XHCC1_URD);
+ ///
+ /// PCH BIOS Spec Rev 0.5.5, Section 13.2.4 Locking xHCI Register Settings
+ /// PCH BIOS Spec Locking xHCI Register settings
+ /// After xHCI is initialized, BIOS should lock the xHCI configuration registers to RO.
+ /// This prevent any unintended changes. There is also a lockdown feature for OverCurrent
+ /// registers. BIOS should set these bits to lock down the settings prior to end of POST.
+ /// 1. Set Access Control bit at D20:F0:40h[31] to 1b to lock xHCI register settings.
+ /// 2. Set OC Configuration Done bit at D20:F0:44h[31] to lock overcurrent mappings from
+ /// further changes.
+ ///
+ MmioOr32 (XhciPciMmBase + 0x44, (UINT32) (BIT31));
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciPciMmBase + 0x44),
+ 1,
+ (VOID *) (UINTN) (XhciPciMmBase + 0x44)
+ );
+ XhccCfg |= (UINT32) (B_PCH_XHCI_XHCC1_ACCTRL);
+ MmioWrite32 (XhciPciMmBase + R_PCH_XHCI_XHCC1, XhccCfg);
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciPciMmBase + R_PCH_XHCI_XHCC1),
+ 1,
+ &XhccCfg
+ );
+
+ ///
+ ///restore xHCI original command byte
+ ///
+ MmioWrite16 ((XhciPciMmBase + R_PCH_XHCI_COMMAND_REGISTER), OrgCommandWord);
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (XhciPciMmBase + R_PCH_XHCI_COMMAND_REGISTER),
+ 1,
+ (VOID *) (UINTN) (XhciPciMmBase + R_PCH_XHCI_COMMAND_REGISTER)
+ );
+
+ if (NeedGcdMemSpace) {
+ MmioWrite32 (XhciPciMmBase + R_PCH_XHCI_MEM_BASE, 0);
+ ///
+ ///clear xHCI BAR
+ ///
+ PCH_INIT_COMMON_SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (XhciPciMmBase + R_PCH_XHCI_MEM_BASE),
+ 1,
+ (VOID *) (UINTN) (XhciPciMmBase + R_PCH_XHCI_MEM_BASE)
+ );
+ ///
+ /// release GCD Mem space
+ ///
+ gDS->FreeMemorySpace (
+ XhciMmioBase,
+ V_PCH_XHCI_MEM_LENGTH
+ );
+ }
+
+}
+
+/**
+ Configures ports of the PCH USB3 (xHCI) controller
+ just before OS boot.
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+
+ @retval EFI_INVALID_PARAMETER The parameter of PchPlatformPolicy is invalid
+ @retval EFI_SUCCESS The function completed successfully
+**/
+VOID
+ConfigureXhciAtBoot (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy
+ )
+{
+ UINTN PciD20F0RegBase;
+ UINT32 PortMask;
+
+ DEBUG ((EFI_D_INFO, "ConfigureXhciAtBoot() Start\n"));
+
+ PciD20F0RegBase = MmPciAddress (
+ 0,
+ PchPlatformPolicy->BusNumber,
+ PCI_DEVICE_NUMBER_PCH_XHCI,
+ PCI_FUNCTION_NUMBER_PCH_XHCI,
+ 0
+ );
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.0
+ /// When the BIOS does not have xHCI pre-boot software available:
+ /// Section 13.1.1.2 xHCI Enabled mode
+ /// BIOS should route the Ports to the EHCI controller and prior to OS boot
+ /// it should route the ports to the xHCI controller.
+ ///
+ if ((PchPlatformPolicy->UsbConfig->Usb30Settings.Mode == PCH_XHCI_MODE_ON) &&
+ (PchPlatformPolicy->UsbConfig->Usb30Settings.PreBootSupport == PCH_DEVICE_DISABLE)) {
+ ///
+ /// PCH BIOS Spec Rev 0.5.0 Section 13.2.6 Routing of switchable USB Ports to
+ /// xHCI Controller
+ /// Step 1
+ /// Done in GetXhciPortsNumber()
+ /// Step 2
+ /// Program D20:F0:D8h[5:0] to the value of xHCI D20:F0:DCh[5:0]
+ ///
+ PortMask = MmioRead32 (PciD20F0RegBase + R_PCH_XHCI_USB3PRM);
+
+ MmioAndThenOr32 (
+ PciD20F0RegBase + R_PCH_XHCI_USB3PR,
+ (UINT32)~B_PCH_XHCI_USB3PR_USB3SSEN,
+ PortMask
+ );
+ ///
+ /// Step 3
+ /// Program D20:F0:D0h[14:0] to the value of xHCI D20:F0:D4h[15:0]
+ ///
+ PortMask = MmioRead32 (PciD20F0RegBase + R_PCH_XHCI_USB2PRM);
+
+ MmioAndThenOr32 (
+ PciD20F0RegBase + R_PCH_XHCI_USB2PR,
+ (UINT32)~B_PCH_XHCI_USB2PR_USB2HCSEL,
+ PortMask
+ );
+ ///
+ /// Note: Registers USB3PR[5:0] and USB2PR[14:0] are located in SUS well so BIOS doesn't
+ /// need to restore them during S3 resume, but needs to restore corresponding mask
+ /// registers. For RapidStart resume from G3 state support, HC Switch driver will call
+ /// _OSC method to restore USB2PR and USB3PR.
+ }
+
+ DEBUG ((EFI_D_INFO, "ConfigureXhciAtBoot() End\n"));
+}
+
+/**
+ Configures PCH USB controller
+
+ @param[in] PchPlatformPolicy The PCH Platform Policy protocol instance
+ @param[in] RootComplexBar RootComplexBar address of this PCH device
+ @param[in, out] FuncDisableReg Function Disable Register
+
+ @retval EFI_INVALID_PARAMETER The parameter of PchPlatformPolicy is invalid
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+ConfigureUsb (
+ IN DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy,
+ IN UINT32 RootComplexBar,
+ IN OUT UINT32 *FuncDisableReg
+ )
+{
+ EFI_STATUS Status;
+ UINT8 BusNumber;
+ PCH_USB_CONFIG *UsbConfig;
+ UINT32 UsbFuncDisable;
+ EFI_PHYSICAL_ADDRESS EhciMemBaseAddress;
+ EFI_PHYSICAL_ADDRESS XhciMemBaseAddress;
+
+ DEBUG ((EFI_D_INFO, "ConfigureUsb() Start\n"));
+
+ BusNumber = PchPlatformPolicy->BusNumber;
+ UsbConfig = PchPlatformPolicy->UsbConfig;
+ EhciMemBaseAddress = 0x0ffffffff;
+
+ Status = gDS->AllocateMemorySpace (
+ EfiGcdAllocateMaxAddressSearchBottomUp,
+ EfiGcdMemoryTypeMemoryMappedIo,
+ N_PCH_EHCI_MEM_ALIGN,
+ V_PCH_EHCI_MEM_LENGTH,
+ &EhciMemBaseAddress,
+ mImageHandle,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ XhciMemBaseAddress = 0x0ffffffff;
+
+ Status = gDS->AllocateMemorySpace (
+ EfiGcdAllocateMaxAddressSearchBottomUp,
+ EfiGcdMemoryTypeMemoryMappedIo,
+ N_PCH_XHCI_MEM_ALIGN,
+ V_PCH_XHCI_MEM_LENGTH,
+ &XhciMemBaseAddress,
+ mImageHandle,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+
+ gDS->FreeMemorySpace (
+ EhciMemBaseAddress,
+ V_PCH_EHCI_MEM_LENGTH
+ );
+
+ return Status;
+ }
+
+ UsbFuncDisable = *FuncDisableReg;
+
+ Status = CommonUsbInit (
+ UsbConfig,
+ (UINT32) EhciMemBaseAddress,
+ (UINT32) XhciMemBaseAddress,
+ BusNumber,
+ RootComplexBar,
+ &UsbFuncDisable,
+ PchPlatformPolicy->Revision
+ );
+ *FuncDisableReg = UsbFuncDisable;
+
+ //
+ // Free allocated resources
+ //
+ gDS->FreeMemorySpace (
+ EhciMemBaseAddress,
+ V_PCH_EHCI_MEM_LENGTH
+ );
+
+ gDS->FreeMemorySpace (
+ XhciMemBaseAddress,
+ V_PCH_XHCI_MEM_LENGTH
+ );
+ DEBUG ((EFI_D_INFO, "ConfigureUsb() End\n"));
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchUsbPrecondition.c b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchUsbPrecondition.c
new file mode 100644
index 0000000..ea8f794
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchUsbPrecondition.c
@@ -0,0 +1,522 @@
+/** @file
+ PCH USB precondition feature support in DXE phase
+
+@copyright
+ Copyright (c) 2012 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "PchInit.h"
+#include "PchUsbPrecondition.h"
+#include "PchUsbCommon.h"
+
+#ifdef USB_PRECONDITION_ENABLE_FLAG
+//
+// Data referred by EHCI
+//
+extern USB_CONTROLLER EhciControllersMap[];
+
+//
+// Data referred by XHCI
+//
+UINTN *PORTSCxUSB2Ptr;
+UINTN *PORTSCxUSB3Ptr;
+
+//
+// Data referred by USB Precondition feature
+//
+EFI_USB_HC_PORT_PRECONDITION *mPrivatePreConditionList = NULL;
+
+//
+// This flag set when 50ms root port reset duration is satisified (Tdrstr). It is countered from
+// last root port reset.
+//
+BOOLEAN PchUsbRPortsRstDoneFlag = FALSE;
+
+//
+// All root ports reset continuously, so the reset starting time between first root port and last
+// root port should not exceed PCH ACPI timer High-to-Low transition frequency - 2.3435 seconds.
+//
+UINTN LastRPortResetTicks = 0;
+
+//
+// Tdrstr for all root portis satisfied as the following scenarios:
+//
+// |
+// |-> Reset all root ports of 1st HC, save tick_1 to LastRPortResetTicks
+// |
+// |-> Reset all root ports of 2nd HC, save tick_2 to LastRPortResetTicks
+// |
+// |-> IsRootPortReset () for is invoked by first call, wait until if delay for tick_2 is enough
+// | Set PchUsbRPortsRstDoneFlag = TRUE, return TRUE if the port is in the list
+// |
+// |-> IsRootPortReset () is invoked for the other HC, and PchUsbRPortsRstDoneFlag is set
+// | Return TRUE if the port is in the list
+//
+
+/**
+ Return current PCH PM1 timer value
+
+ @param[in] None
+
+ @retval PM1 timer value in 32 bit
+**/
+UINTN
+PchGetPchTimerTick (
+ VOID
+ )
+{
+ UINT16 AcpiBaseAddr;
+
+ AcpiBaseAddr = PciRead16 (
+ PCI_LIB_ADDRESS (DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ 0,
+ R_PCH_LPC_ACPI_BASE)
+ ) & B_PCH_LPC_ACPI_BASE_BAR;
+
+ return IoRead32 ((UINTN) (AcpiBaseAddr + R_PCH_ACPI_PM1_TMR)) & B_PCH_ACPI_PM1_TMR_VAL;
+
+}
+
+/**
+ Check if the required delay condition is satisified
+ Note: The delay can't be larger than PCH ACPI timer High-to-Low
+ transition frequency - 2.3435 seconds.
+
+ @param[in] InitialTicks Initial PM1 tick value
+ @param[in] RequiredStallInUs Required delay in us
+
+ @retval TRUE The required delay is satisified
+ @retval FALSE The required delay is not satisified
+**/
+BOOLEAN
+UsbTimeout (
+ IN UINTN InitialTicks,
+ IN UINTN RequiredStallInUs
+ )
+{
+ UINTN CurrentTick;
+ UINTN ExpiredTick;
+
+ //
+ // The timer frequency is 3.579545 MHz, so 1 us corresponds 3.58 clocks
+ //
+ ExpiredTick = RequiredStallInUs * 358 / 100 + InitialTicks + 1;
+ CurrentTick = PchGetPchTimerTick ();
+
+ //
+ // The High-to-Low transition will occur every 2.3435 seconds.
+ //
+ if (CurrentTick < InitialTicks) {
+ CurrentTick += V_PCH_ACPI_PM1_TMR_MAX_VAL;
+ }
+
+ if (CurrentTick > ExpiredTick){
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/**
+ Initialize usb global data and flag for reference
+
+ @param[in] None
+
+ @retval None
+**/
+VOID
+UsbInitGlobalData (
+ VOID
+ )
+{
+
+ ///
+ /// Set the flag to false and start to count time.
+ ///
+ PchUsbRPortsRstDoneFlag = FALSE;
+
+ ///
+ /// This is the latest root port reset, record it to ensure the Tdrstr is satisified.
+ ///
+ LastRPortResetTicks = PchGetPchTimerTick();
+ return;
+}
+
+/**
+ Check if the delay is enough since last root port reset
+
+ @param[in] None
+
+ @retval None
+**/
+VOID
+UsbTdrstrDelayCheck (
+ VOID
+ )
+{
+ UINTN i;
+
+ ///
+ /// If the latest root port reset done, and then for all root ports reset by
+ /// this protocol is ready. If we are in scenario#3, wait until delay time is enough. The flag
+ /// is set either by timer event or the waitting loop.
+ ///
+ for (i = 0; (PchUsbRPortsRstDoneFlag != TRUE) && (i < USB_ROOT_PORT_RESET_STALL_US/ USB_TDRSTR_CHECK_INTERVAL_US); i++) {
+ if (UsbTimeout (LastRPortResetTicks, USB_ROOT_PORT_RESET_STALL_US)) {
+ PchUsbRPortsRstDoneFlag = TRUE;
+ LastRPortResetTicks = 0;
+ break;
+ }
+ PchPmTimerStall (USB_TDRSTR_CHECK_INTERVAL_US);
+ }
+
+ return ;
+}
+
+/**
+ Check if the queried port is reset by USB precondition feature or not
+
+ @param[in] This EFI_USB_HC_PORT_PRECONDITION instance
+ @param[in] PortNumber The root port number (started by zero) to be queried
+
+ @retval TRUE The root port is reset done
+ @retval FALSE The root port is not reset
+**/
+BOOLEAN
+EFIAPI
+IsEhcRootPortReset (
+ IN EFI_USB_HC_PORT_PRECONDITION *This,
+ IN UINT8 PortNumber
+ )
+{
+ USB_EHCI_PRECONDITION_DEV *EhcPreCondition;
+
+ EhcPreCondition = EHC_PRECONDITION_FROM_THIS (This);
+
+ ///
+ /// For the EHCI on PCH, the root port 0 is always RMH and existing.
+ /// PCH USB precondition feature resets the root port 0 on PCH EHCI only
+ /// If the signature, PortNumber, or PortResetBitMap is invalid, return
+ /// FALSE directly. Otherwise, return TRUE when required reset signal delay
+ /// is satisified.
+ ///
+ if ((EhcPreCondition->Signature != EHCI_PRECONDITION_DEV_SIGN) ||
+ (PortNumber != 0) ||
+ (EhcPreCondition->PortResetBitMap == 0)) {
+ return FALSE;
+ }
+
+ //
+ // Drive the reset signal on root port for at least 50ms(Tdrstr). Check USB 2.0 Spec
+ // section 7.1.7.5 for timing requirements.
+ //
+ if (!PchUsbRPortsRstDoneFlag) {
+ UsbTdrstrDelayCheck ();
+ }
+ return TRUE;
+}
+
+/**
+ Perform USB precondition on EHCI, it is the root port reset on
+ installed USB device in DXE phase
+
+ @param[in] Device The device number of the EHCI
+ @param[in] EhciMmioBase Memory base address of EHCI Controller
+
+ @retval None
+**/
+VOID
+EhciPrecondition (
+ IN UINT8 Device,
+ IN UINT32 EhciMmioBase
+ )
+{
+ UINTN i;
+ UINT32 Data32;
+ USB_EHCI_PRECONDITION_DEV *EhcPreCondition;
+ EFI_USB_HC_LOCATION EhcLocation = {0, 0, 0, 0};
+
+ //
+ // Check if all ports routed to this EHCI successfully, if not, exit directly
+ //
+ if ((MmioRead32 (EhciMmioBase + R_PCH_EHCI_CONFIGFLAG) & BIT0) == 0) {
+ return;
+ }
+
+ EhcPreCondition = AllocateZeroPool (sizeof (USB_EHCI_PRECONDITION_DEV));
+ if (EhcPreCondition == NULL) {
+ return;
+ }
+
+ ///
+ /// This is Intel RMH behind EHCI, and it is on root hub port 0. Reset the root hub port0.
+ ///
+ for (i = 0; i < (USB_HC_RESET_STALL_US/ 10); i++) {
+ if ((MmioRead32 (EhciMmioBase + R_PCH_EHCI_PORTSC0) & BIT0) == 0) {
+ //
+ // Root port 0 on EHCI is RMH, check the CCS bit before reset port.
+ // If the CCS bit is not true, wait and poll until timeout
+ //
+ PchPmTimerStall (10);
+ } else {
+ break;
+ }
+ }
+
+ Data32 = MmioRead32 (EhciMmioBase + R_PCH_EHCI_PORTSC0);
+
+ //
+ // Mask of the port change bits, they are WC (write clean).
+ // Set one to PortReset bit and must also set zero to PortEnable bit
+ //
+ Data32 &= ~B_PCH_EHCI_PORTSC0_CHANGE_ENABLE_MASK;
+ Data32 |= B_PCH_EHCI_PORTSC0_RESET;
+ MmioWrite32 ((EhciMmioBase + R_PCH_EHCI_PORTSC0), Data32);
+
+ UsbInitGlobalData ();
+ EhcPreCondition->Signature = EHCI_PRECONDITION_DEV_SIGN;
+
+ //
+ // RMH is at root hub port 0
+ //
+ EhcPreCondition->PortResetBitMap = BIT0;
+
+ //
+ // Suggest required delay time defined by specification per RMH implementation. Reserved so far
+ //
+ ZeroMem (&(EhcPreCondition->Protocol.Timing), sizeof (EFI_USB_PORT_ENUM_TIMING_TABLE));
+
+ EhcLocation.DeviceNumber = (UINTN) Device;
+ CopyMem (&(EhcPreCondition->Protocol.Location), &EhcLocation, sizeof (EFI_USB_HC_LOCATION));
+
+ EhcPreCondition->Protocol.IsRootPortReset = IsEhcRootPortReset;
+ EhcPreCondition->Protocol.Next = mPrivatePreConditionList;
+ mPrivatePreConditionList = &(EhcPreCondition->Protocol);
+}
+
+/**
+ Check if the queried port is reset by USB precondition feature or not. This service must be called when
+ XHC is in Run(R/S = '1') mode per XHCI specification requirement.
+
+ @param[in] This EFI_USB_HC_PORT_PRECONDITION instance
+ @param[in] PortNumber The root port number (started by zero) to be queried
+
+ @retval TRUE The root port is reset done
+ @retval FALSE The root port is not reset
+**/
+BOOLEAN
+EFIAPI
+IsXhcRootPortReset (
+ IN EFI_USB_HC_PORT_PRECONDITION *This,
+ IN UINT8 PortNumber
+ )
+{
+ UINT32 UsbPort;
+ UINT32 Data32;
+ UINT32 XhciMmioBase;
+ UINT32 XhciPciMmBase;
+ USB_XHCI_PRECONDITION_DEV *XhcPreCondition;
+ BOOLEAN ResumeFlag;
+
+ XhcPreCondition = XHC_PRECONDITION_FROM_THIS (This);
+
+ ///
+ /// If the signature, PortNumber, or PortResetBitMap is invalid, return
+ /// FALSE directly. Otherwise, return TRUE when required reset signal delay
+ /// is satisified.
+ ///
+ if ((XhcPreCondition->PortResetBitMap == 0) || (XhcPreCondition->Signature != XHCI_PRECONDITION_DEV_SIGN)) {
+ return FALSE;
+ }
+
+ ///
+ /// Resume all USB2 protocol ports by first call
+ ///
+ if (XhcPreCondition->PORTSCxResumeDoneFlag != TRUE) {
+ //
+ // Drive the reset signal on root port for at least 50ms(Tdrstr). Check USB 2.0 Spec
+ // section 7.1.7.5 for timing requirements.
+ //
+ if (!PchUsbRPortsRstDoneFlag) {
+ UsbTdrstrDelayCheck ();
+ }
+
+ XhciPciMmBase = (UINT32) MmPciAddress (
+ 0,
+ (UINT8) XhcPreCondition->Protocol.Location.BusNumber,
+ (UINT8) XhcPreCondition->Protocol.Location.DeviceNumber,
+ (UINT8) XhcPreCondition->Protocol.Location.FunctionNumber,
+ 0
+ );
+
+ XhciMmioBase = MmioRead32 (XhciPciMmBase + R_PCH_XHCI_MEM_BASE) & (~0xF);
+ ResumeFlag = FALSE;
+
+ ///
+ /// For USB2 protocol port on XHCI, the reset done port will enter U3 state once the HC is halted
+ /// To recovery the USB2 protocol port from U3 to U0, SW should:
+ /// 1. SW shall ensure that the XHC is in Run mode prior to transitioning a root hub port from Resume to
+ /// the U0 state.
+ /// 2. Write a "15" (Resume) to the PLS, XHC shall transmit the resume signaling within 1ms (Tursm)
+ /// 3. SW shall ensure that resume is signaled for at least 20 ms (Tdrsmdn) from the write of Resume
+ /// 4. After Tdrsmdn is complete, SW shall write a "0"(U0) to the PLS field
+ ///
+ for (UsbPort = 0; UsbPort < XhcPreCondition->HsPortCount; UsbPort++) {
+ if (((UINT32)(1 << UsbPort) & XhcPreCondition->PortResetBitMap) != 0) {
+ Data32 = MmioRead32 (XhciMmioBase + PORTSCxUSB2Ptr[UsbPort]);
+ if ((Data32 & B_PCH_XHCI_PORTSCXUSB2_CCS) != 0) {
+ Data32 &= ~B_PCH_XHCI_PORT_CHANGE_ENABLE_MASK;
+ Data32 |= (B_PCH_XHCI_USB2_U3_EXIT + B_PCH_XHCI_PORTSCXUSB2_PP + B_PCH_XHCI_PORTSCXUSB2_LWS);
+ MmioWrite32 (
+ XhciMmioBase + PORTSCxUSB2Ptr[UsbPort],
+ Data32
+ );
+ ResumeFlag = TRUE;
+ } else {
+ //
+ // The CCS bit of this port disappears, it may be caused by the following reasons:
+ // 1. Link training is successfully now, the CCS shows on correct USB speed port, i.e. USB3
+ // speed if it is USB3 device.
+ // 2. The device is removed.
+ // Ignore this port due to there is no device on it now.
+ //
+ XhcPreCondition->PortResetBitMap &= ~(UINT32) (1 << UsbPort);
+ }
+ }
+ }
+
+ if (ResumeFlag) {
+ //
+ // There is one root port resuming from U3 at least.
+ //
+ PchPmTimerStall (20 * 1000);
+ for (UsbPort = 0; UsbPort < XhcPreCondition->HsPortCount; UsbPort++) {
+ if (((UINT32)(1 << UsbPort) & XhcPreCondition->PortResetBitMap) != 0 ) {
+ Data32 = (B_PCH_XHCI_PORTSCXUSB2_PP + B_PCH_XHCI_PORTSCXUSB2_LWS + B_PCH_XHCI_PORTSCXUSB2_CCS);
+ MmioWrite32 (
+ XhciMmioBase + PORTSCxUSB2Ptr[UsbPort],
+ Data32
+ );
+ }
+ }
+ }
+ XhcPreCondition->PORTSCxResumeDoneFlag = TRUE;
+ }
+
+ if (XhcPreCondition->PORTSCxResumeDoneFlag == TRUE) {
+ //
+ // If the signature, PortNumber, or PortResetBitMap is invalid, return
+ // FALSE directly. Otherwise, return TRUE when required reset signal delay
+ // is satisified.
+ //
+ if (((UINT32)(1 << PortNumber) & XhcPreCondition->PortResetBitMap) != 0) {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+/**
+ Perform USB precondition on XHCI, it is the root port reset on
+ installed USB device in DXE phase
+
+ @param[in] BusNumber The Bus number of the XHCI
+ @param[in] Device The device number of the XHCI
+ @param[in] Function The function number of the XHCI
+ @param[in] XhciMmioBase Memory base address of XHCI Controller
+ @param[in] XhciUSB2Ptr Pointer to USB2 protocol port register
+ @param[in] HsPortCount The number of USB2 protocol port supported by this XHCI
+
+ @retval None
+**/
+VOID
+XhciPrecondition (
+ IN UINT8 BusNumber,
+ IN UINT8 Device,
+ IN UINT8 Function,
+ IN UINT32 XhciMmioBase,
+ IN UINTN *XhciUSB2Ptr,
+ IN UINTN HsPortCount,
+ IN UINTN *XhciUSB3Ptr,
+ IN UINTN SsPortCount
+ )
+{
+ UINT32 UsbPort;
+ UINT32 Data32;
+ USB_XHCI_PRECONDITION_DEV *XhcPreCondition;
+ EFI_USB_HC_LOCATION XhcLocation = {0, 0, 0, 0};
+
+ XhcPreCondition = AllocateZeroPool (sizeof (USB_XHCI_PRECONDITION_DEV));
+ if (XhcPreCondition == NULL) {
+ return;
+ }
+
+ PORTSCxUSB2Ptr = XhciUSB2Ptr;
+ PORTSCxUSB3Ptr = XhciUSB3Ptr;
+ XhcPreCondition->Signature = XHCI_PRECONDITION_DEV_SIGN;
+
+ XhcPreCondition->HsPortCount = HsPortCount;
+
+ for (UsbPort = 0; UsbPort < HsPortCount; UsbPort++) {
+ Data32 = MmioRead32 (XhciMmioBase + PORTSCxUSB2Ptr[UsbPort]);
+ if ((Data32 & B_PCH_XHCI_PORTSCXUSB2_CCS) != 0) {
+ Data32 &= ~B_PCH_XHCI_PORTSCXUSB2_PED;
+ Data32 |= B_PCH_XHCI_PORTSCXUSB2_PR | B_PCH_XHCI_PORTSCXUSB2_PP;
+ MmioWrite32 (
+ XhciMmioBase + PORTSCxUSB2Ptr[UsbPort],
+ Data32
+ );
+ //
+ // PortSC registers in PCH XHCI is counted from HS ports
+ //
+ XhcPreCondition->PortResetBitMap |= (UINT32) (1 << UsbPort);
+ }
+ }
+#ifdef EFI_DEBUG
+ DEBUG ((EFI_D_INFO, "XhciPreconditionDxe - USB3PORTSC Start\n"));
+ for (UsbPort = 0; UsbPort < SsPortCount; UsbPort++) {
+ DEBUG ((EFI_D_INFO, "USB3Port %x - %x\n", UsbPort, MmioRead32 (XhciMmioBase + XhciUSB3Ptr[UsbPort])));
+ }
+#endif
+
+ //
+ // Clear WRC bit for all USB3 PORTSC
+ //
+ for (UsbPort = 0; UsbPort < SsPortCount; UsbPort++) {
+ MmioAndThenOr32 (
+ XhciMmioBase + PORTSCxUSB3Ptr[UsbPort],
+ (UINT32)~ (B_PCH_XHCI_PORTSCXUSB3_CHANGE_ENABLE_MASK),
+ B_PCH_XHCI_PORTSCXUSB3_WRC
+ );
+ }
+#ifdef EFI_DEBUG
+ DEBUG ((EFI_D_INFO, "XhciPreconditionDxe - USB3PORTSC Done\n"));
+ for (UsbPort = 0; UsbPort < SsPortCount; UsbPort++) {
+ DEBUG ((EFI_D_INFO, "USB3Port %x - %x\n", UsbPort, MmioRead32 (XhciMmioBase + XhciUSB3Ptr[UsbPort])));
+ }
+#endif
+ UsbInitGlobalData ();
+ XhcLocation.DeviceNumber = (UINTN) Device;
+ XhcLocation.FunctionNumber = (UINTN) Function;
+ CopyMem (&(XhcPreCondition->Protocol.Location), &XhcLocation, sizeof (EFI_USB_HC_LOCATION));
+ XhcPreCondition->Protocol.IsRootPortReset = IsXhcRootPortReset;
+ XhcPreCondition->PORTSCxResumeDoneFlag = FALSE;
+ XhcPreCondition->Protocol.Next = mPrivatePreConditionList;
+ mPrivatePreConditionList = &(XhcPreCondition->Protocol);
+}
+
+#endif // USB_PRECONDITION_ENABLE_FLAG
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchUsbPrecondition.h b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchUsbPrecondition.h
new file mode 100644
index 0000000..faaeda9
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Dxe/PchUsbPrecondition.h
@@ -0,0 +1,54 @@
+/** @file
+ Header file for PCH USB precondition feature support in DXE phase
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PCH_USB_PRECONDITION_H_
+#define _PCH_USB_PRECONDITION_H_
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueBase.h"
+#include "PchAccess.h"
+#include "UsbHcPortPrecondition.h"
+#endif
+
+#define USB_HC_RESET_STALL_US 10 * 1000 ///< 10ms
+#define USB_ROOT_PORT_RESET_STALL_US 50 * 1000 ///< 50ms
+#define USB_TDRSTR_CHECK_INTERVAL_US 100
+#define EHCI_PRECONDITION_DEV_SIGN EFI_SIGNATURE_32 ('e','p','r','e')
+#define EHC_PRECONDITION_FROM_THIS(a) CR(a, USB_EHCI_PRECONDITION_DEV, Protocol, EHCI_PRECONDITION_DEV_SIGN)
+
+typedef struct _USB_EHCI_PRECONDITION_DEV {
+ UINTN Signature;
+ EFI_USB_HC_PORT_PRECONDITION Protocol;
+ UINTN PortResetBitMap;
+} USB_EHCI_PRECONDITION_DEV;
+
+#define XHCI_PRECONDITION_DEV_SIGN EFI_SIGNATURE_32 ('x','p','r','e')
+#define XHC_PRECONDITION_FROM_THIS(a) CR(a, USB_XHCI_PRECONDITION_DEV, Protocol, XHCI_PRECONDITION_DEV_SIGN)
+
+typedef struct _USB_XHCI_PRECONDITION_DEV {
+ UINTN Signature;
+ EFI_USB_HC_PORT_PRECONDITION Protocol;
+ UINTN HsPortCount;
+ UINTN PortResetBitMap;
+ UINTN PortResetDoneBitMap;
+ BOOLEAN PORTSCxResumeDoneFlag;
+} USB_XHCI_PRECONDITION_DEV;
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchDmiPeim.c b/ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchDmiPeim.c
new file mode 100644
index 0000000..a53bf8b
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchDmiPeim.c
@@ -0,0 +1,831 @@
+/** @file
+ This file contains functions for PCH DMI TC/VC programing and status polling
+
+@copyright
+ Copyright (c) 2009 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+// AMI_OVERRIDE >>>
+#ifdef AMI_RC_DEBUG
+#include "PeiLib.h"
+#endif
+// AMI_OVERRIDE <<<
+#include "PchInitPeim.h"
+#include "HeciRegs.h"
+#include "MeAccess.h"
+#include "ChipsetInitHob.h"
+
+//
+// GUID Definitions
+//
+EFI_GUID gChipsetInitHobGuid = CHIPSET_INIT_INFO_HOB_GUID;
+
+/**
+ Programing transaction classes of the corresponding virtual channel and Enable it
+
+ @param[in] RootComplexBar PCH Root Complex Base Address
+ @param[in] Vc The virtual channel number for programing
+ @param[in] VcId The Identifier to be used for this virtual channel
+ @param[in] VcMap The transaction classes are mapped to this virtual channel.
+ When a bit is set, this transaction class is mapped to the virtual channel
+
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+PchSetDmiTcVcMapping (
+ IN UINT32 RootComplexBar,
+ IN UINT8 Vc,
+ IN UINT8 VcId,
+ IN UINT8 VcMap
+ )
+{
+ UINTN Address;
+ UINT32 VxCtlAnd;
+ UINT32 VxCtlOr;
+
+ Address = RootComplexBar;
+
+ VxCtlAnd = (UINT32) (~(B_PCH_RCRB_V1CTL_ID | V_PCH_RCRB_V1CTL_TVM_MASK));
+ VxCtlOr = (VcId << N_PCH_RCRB_V1CTL_ID) & B_PCH_RCRB_V1CTL_ID;
+ VxCtlOr |= VcMap;
+ VxCtlOr |= B_PCH_RCRB_V1CTL_EN;
+
+ switch (Vc) {
+ case DmiVcTypeVc0:
+ Address += R_PCH_RCRB_V0CTL;
+ break;
+
+ case DmiVcTypeVc1:
+ Address += R_PCH_RCRB_V1CTL;
+ break;
+
+ case DmiVcTypeVcp:
+ Address += R_PCH_RCRB_CIR2030;
+ break;
+
+ case DmiVcTypeVcm:
+ Address += R_PCH_RCRB_CIR2040;
+ break;
+
+ default:
+ return EFI_INVALID_PARAMETER;
+ }
+
+ MmioAndThenOr32 (Address, VxCtlAnd, VxCtlOr);
+ if ((Vc == DmiVcTypeVc1) || (Vc == DmiVcTypeVcp)) {
+ //
+ // Reads back for posted write to take effect
+ //
+ MmioRead32 (Address);
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Polling negotiation status of the corresponding virtual channel
+
+ @param[in] RootComplexBar PCH Root Complex Base Address
+ @param[in] Vc The virtual channel number for programing
+
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+PchPollDmiVcStatus (
+ IN UINT32 RootComplexBar,
+ IN UINT8 Vc
+ )
+{
+ UINTN Address;
+
+ Address = RootComplexBar;
+
+ switch (Vc) {
+ case DmiVcTypeVc0:
+ Address += R_PCH_RCRB_V0STS;
+ break;
+
+ case DmiVcTypeVc1:
+ Address += R_PCH_RCRB_V1STS;
+ break;
+
+ case DmiVcTypeVcp:
+ Address += 0x2036;
+ break;
+
+ case DmiVcTypeVcm:
+ Address += 0x2046;
+ break;
+
+ default:
+ return EFI_INVALID_PARAMETER;
+ }
+ //
+ // Wait for negotiation to complete
+ //
+ while ((MmioRead16 (Address) & B_PCH_RCRB_V1STS_NP) != 0);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ The function performing TC/VC mapping program, and poll all PCH Virtual Channel
+ until negotiation completion
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+
+ @retval EFI_SUCCESS The function completed successfully
+ @retval Others All other error conditions encountered result in an ASSERT.
+**/
+EFI_STATUS
+EFIAPI
+PchDmiTcVcProgPoll (
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_STATUS Status;
+ PCH_DMI_TC_VC_PPI *PchDmiTcVcMapPpi;
+ UINT32 RootComplexBar;
+ UINT8 Index;
+ UINT8 VcMap[DmiVcTypeMax] = { 0 };
+
+ ///
+ /// Locate PchDmiTcVcMap Ppi
+ ///
+ Status = (*PeiServices)->LocatePpi (PeiServices, &gPchDmiTcVcMapPpiGuid, 0, NULL, (VOID **)&PchDmiTcVcMapPpi);
+ ASSERT_EFI_ERROR (Status);
+ RootComplexBar = PCH_RCRB_BASE;
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 7.1.5
+ /// Step 3.1
+ /// RCBA + Offset 50h[19] = 1b
+ /// Step 3.2
+ /// RCBA + Offset 50h[23:20] = 2h and RCBA + Offset 50h[17] = 1b,
+ /// ensure that D29/D26:F0:88h [2] = 0b (Done at PchMiscInit() on PchInitPeim.c)
+ ///
+ MmioAndThenOr32 (RootComplexBar + R_PCH_RCRB_CIR0050, (UINT32) (~0x00F00000), (UINT32) (0x00200000));
+
+ if (PchDmiTcVcMapPpi->DmiVc[DmiVcTypeVcp].Enable == PCH_DEVICE_ENABLE) {
+ MmioOr32 (RootComplexBar + R_PCH_RCRB_CIR0050, BIT17 | BIT19);
+ }
+ ///
+ /// Reads back for posted write to take effect
+ ///
+ MmioRead32 (RootComplexBar + R_PCH_RCRB_CIR0050);
+
+ ///
+ /// Step 3.3, Step 3.4, Step 3.5, Step 3,6, Set the TC/VC mappings
+ ///
+ for (Index = 0; Index < DmiTcTypeMax; Index++) {
+ DEBUG ((EFI_D_INFO, "TC:%0x VC:%0x!\n", Index, PchDmiTcVcMapPpi->DmiTc[Index].Vc));
+ VcMap[PchDmiTcVcMapPpi->DmiTc[Index].Vc] |= (BIT0 << Index);
+ }
+
+ for (Index = 0; Index < DmiVcTypeMax; Index++) {
+ DEBUG ((EFI_D_INFO, "VC:%0x VCID:%0x Enable:%0x!\n",Index, PchDmiTcVcMapPpi->DmiVc[Index].VcId, PchDmiTcVcMapPpi->DmiVc[Index].Enable));
+ if (PchDmiTcVcMapPpi->DmiVc[Index].Enable == PCH_DEVICE_ENABLE) {
+ PchSetDmiTcVcMapping (
+ RootComplexBar,
+ Index,
+ PchDmiTcVcMapPpi->DmiVc[Index].VcId,
+ VcMap[Index]
+ );
+ }
+ }
+ ///
+ /// Step 3.7
+ /// Set RCBA + Offset 50h[31] = 1b
+ /// Lock down the TC mapping if no further changes are required to bits [30:16]
+ ///
+ MmioOr32 (RootComplexBar + R_PCH_RCRB_CIR0050, B_PCH_RCRB_CIR0_TCLOCKDN);
+ ///
+ /// Reads back for posted write to take effect
+ ///
+ MmioRead32 (RootComplexBar + R_PCH_RCRB_CIR0050);
+
+ ///
+ /// Step 3.8
+ /// After both above and System Agent DMI TC/VC mapping are programmed,
+ /// poll VC negotiation pending status until is zero:
+ /// 3.8.1 RCBA + Offset 201Ah[1]
+ /// 3.8.2 RCBA + Offset 2026h[1]
+ /// 3.8.3 RCBA + Offset 2036h[1]
+ /// 3.8.4 RCBA + Offset 2046h[1]
+ ///
+ for (Index = 0; Index < DmiVcTypeMax; Index++) {
+ if (PchDmiTcVcMapPpi->DmiVc[Index].Enable == PCH_DEVICE_ENABLE) {
+ PchPollDmiVcStatus (RootComplexBar, Index);
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ The function set the Target Link Speed in PCH to DMI GEN 2.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+
+ @retval None
+**/
+VOID
+EFIAPI
+PchDmiGen2Prog (
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+#ifdef TRAD_FLAG
+ UINT32 RootComplexBar;
+
+ if (GetPchSeries() == PchH) {
+ DEBUG ((EFI_D_INFO, "PchDmiGen2Prog() Start\n"));
+ RootComplexBar = PCH_RCRB_BASE;
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 7.1.5
+ /// Step 2
+ /// Configure DMI Link Speed as early as possible
+ /// Step 2.1
+ /// Please refer to the System Agent BIOS Writer's Guide on Supported Link Speed
+ /// field in Link Capabilities register in CPU complex. (Done in SA code)
+ /// Step 2.2
+ /// If the Supported Link Speed in CPU complex is 0010b (Done in SA code)
+ /// and RCBA + Offset 21A4h[3:0] = 0010b
+ ///
+ if ((MmioRead32 (RootComplexBar + R_PCH_RCRB_LCAP) & B_PCH_RCRB_LCAP_MLS) == 0x02) {
+ ///
+ /// Step 2.2.1
+ /// Set RCBA + Offset 21B0h[3:0] = 0010b
+ ///
+ MmioAndThenOr8 (RootComplexBar + 0x21B0, (UINT8)~(BIT3 | BIT2 | BIT1 | BIT0), (UINT8) BIT1);
+ ///
+ /// Step 2.2.2
+ /// Please refer to the System Agent BIOS Writer's Guide to perform DMI Link Retrain after
+ /// configures new DMI Link Speed. (Done in SA code)
+ ///
+ }
+ DEBUG ((EFI_D_INFO, "PchDmiGen2Prog() End\n"));
+ }
+#endif // TRAD_FLAG
+}
+
+/**
+ The function program DMI miscellaneous registers.
+
+ @param[in] PchPlatformPolicyPpi The PCH Platform Policy PPI instance
+
+ @retval EFI_SUCCESS The DMI required settings programmed correctly
+**/
+EFI_STATUS
+EFIAPI
+PchDmiMiscProg (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PCH_PLATFORM_POLICY_PPI *PchPlatformPolicyPpi
+ )
+{
+ UINT32 RootComplexBar;
+ EFI_STATUS Status;
+ UINT16 LpcDeviceId;
+ UINTN PciD31F0RegBase;
+ UINTN PciD28F0RegBase;
+ UINTN PciD20F0RegBase;
+ UINT32 Data32And;
+ UINT32 Data32Or;
+ UINT16 i;
+ UINT16 size;
+ UINT8 DeviceLaneOwner;
+ UINT32 StrpFuseCfg1;
+ UINT8 GbePort;
+#ifdef ULT_FLAG
+ UINTN RPBase;
+ UINT8 PortIndex;
+#endif // ULT_FLAG
+ PCH_SERIES PchSeries;
+ UINT8 PchSteppingValue;
+ UINT32 Msg;
+ UINT32 MsgTimeout;
+ UINT32 PchChipsetInitTableId;
+ UINT32 PchChipsetInitTableLength;
+ UINT8 *PchChipsetInitTable;
+ HECI_FWS_REGISTER MeHfs;
+ CHIPSET_INIT_INFO_HOB *ChipsetInitHob;
+ EFI_BOOT_MODE BootMode;
+#ifdef TRAD_FLAG
+ IOBP_MMIO_TABLE_STRUCT *PchDmiHsio;
+#endif // TRAD_FLAG
+ IOBP_MMIO_TABLE_STRUCT *PchUsb3Hsio;
+ IOBP_MMIO_TABLE_STRUCT *PchUsb3SharedHsio;
+ IOBP_MMIO_TABLE_STRUCT *PchGbeSharedHsio;
+
+ PchSeries = GetPchSeries();
+ Status = EFI_SUCCESS;
+ RootComplexBar = PchPlatformPolicyPpi->Rcba;
+ PchChipsetInitTable = NULL;
+ PchChipsetInitTableLength = 0;
+ Msg = 0;
+ MsgTimeout = MAX_ME_MSG_ACK_TIMEOUT;
+ PciD31F0RegBase = MmPciAddress (
+ 0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ 0
+ );
+ PciD28F0RegBase = MmPciAddress (
+ 0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS,
+ PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_1,
+ 0
+ );
+ PciD20F0RegBase = MmPciAddress (
+ 0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_XHCI,
+ PCI_FUNCTION_NUMBER_PCH_XHCI,
+ 0
+ );
+ LpcDeviceId = MmioRead16 (PciD31F0RegBase + R_PCH_LPC_DEVICE_ID);
+ PchSteppingValue = PchStepping();
+ //
+ // Get PchSeries and assign the appropriate ChipsetInit table
+ //
+ switch (PchSteppingValue) {
+#ifdef ULT_FLAG
+ case LptLpB0:
+ case LptLpB1:
+ case LptLpB2:
+ PchChipsetInitTable = PchChipsetInitTableLptLp_Bx;
+ PchChipsetInitTableLength = sizeof(PchChipsetInitTableLptLp_Bx);
+ break;
+#endif // ULT_FLAG
+#ifdef TRAD_FLAG
+ case LptHB0:
+ PchChipsetInitTable = PchChipsetInitTableLptH_B0;
+ PchChipsetInitTableLength = sizeof(PchChipsetInitTableLptH_B0);
+ break;
+ case LptHC0:
+ case LptHC1:
+ case LptHC2:
+ PchChipsetInitTable = PchChipsetInitTableLptH_Cx;
+ PchChipsetInitTableLength = sizeof(PchChipsetInitTableLptH_Cx);
+ break;
+#endif // TRAD_FLAG
+ default:
+ DEBUG ((EFI_D_ERROR, "Unsupported PCH Stepping\n"));
+ }
+
+ //
+ // GetBoodMode, do not perform ChipsetInit check on S3 RESUME
+ //
+ Status = PeiServicesGetBootMode(&BootMode);
+ if(BootMode != BOOT_ON_S3_RESUME) {
+ //
+ // Create Hob to send ChipsetInit table status to DXE phase.
+ //
+ DEBUG((EFI_D_INFO, "(Hsio) Creating HOB to adjust Hsio settings from DXE, if required.\n"));
+ Status = (**PeiServices).CreateHob (
+ PeiServices,
+ EFI_HOB_TYPE_GUID_EXTENSION,
+ sizeof (CHIPSET_INIT_INFO_HOB),
+ &ChipsetInitHob
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Initialize ChipsetInitHob
+ //
+ ChipsetInitHob->Header.Name = gChipsetInitHobGuid;
+ ChipsetInitHob->ChipsetInitTableLen = PchChipsetInitTableLength;
+ ChipsetInitHob->ChipsetInitTableUpdReq = 0;
+
+ //
+ // Set the Host To ME flag requestint the Hsio ChipsetInit Table Version applied by ME FW
+ //
+ HeciPciAndThenOr32(R_ME_H_GS, 0, (H2M_HSIO_MESSAGE | H2M_HSIO_CMD_GETHSIOVER));
+
+ //
+ // Wait for the acknowledge from the FW, once it completes data should be in the FWSTS register
+ // Wait max of 100ms for FW to acknowledge.
+ //
+ do {
+ //
+ // Delay 1us. Need to give some time for ME to respond.
+ //
+ PchPmTimerStall(1);
+ MeHfs.ul = HeciPciRead32(R_ME_HFS);
+ MsgTimeout--;
+ if (MsgTimeout == 0) {
+ DEBUG ((EFI_D_INFO, "(Hsio) ME FW failed to acknowledge the GETHsioVER command.\n"));
+ Status = EFI_TIMEOUT;
+ //
+ // Do not assert until a supporting ME FW is available
+ //
+ // ASSERT_EFI_ERROR(Status);
+ break;
+ }
+ } while (MeHfs.r.BiosMessageAck != M2H_HSIO_MSG_ACK);
+ if (MsgTimeout > 0) {
+ DEBUG ((EFI_D_INFO, "(Hsio) The GETHsioVER command was acknowledged by ME FW.\n"));
+ }
+
+ //
+ // If successfully got the ACK from ME, then the Hsio Version info should be in the FWSTATUS register
+ // Otherwise, just continue Hsio programming assuming the ChipsetInit settings programmed through other means.
+ //
+ if (Status == EFI_SUCCESS) {
+ //
+ // Receive the Hsio Version reported by ME FW.
+ //
+ Msg = HeciPciRead32(R_ME_HFS_5);
+ DEBUG((EFI_D_INFO, "(Hsio) ME Reported Hsio Version:%d CRC=0x%04X Response=%d us\n", (Msg>>16), (Msg&0xFFFF), MAX_ME_MSG_ACK_TIMEOUT - MsgTimeout));
+
+ //
+ // Send final message back to ME so that it can restore the FWSTS5 value (used for other messaging)
+ //
+ HeciPciAndThenOr32 (R_ME_H_GS, 0, H2M_HSIO_MESSAGE | H2M_HSIO_CMD_CLOSE);
+
+ //
+ // Get ChipsetInit table indentifier from the one found in the code
+ //
+ if(PchChipsetInitTable != NULL) {
+ PchChipsetInitTableId = *((UINT32*)PchChipsetInitTable);
+ DEBUG((EFI_D_INFO, "(Hsio) BIOS Hsio Version:%d CRC=0x%04X Length=%d bytes.\n", (PchChipsetInitTableId>>16),(PchChipsetInitTableId&0xFFFF), PchChipsetInitTableLength));
+
+ //
+ // If expected table id is not found, then skip the rest of the Hsio programming until it can be updated from DXE
+ //
+ if (Msg != PchChipsetInitTableId) {
+ //
+ // Pass the expected ChipsetInit table to the DXE code that will apply the settings to ME and reset.
+ //
+ ChipsetInitHob->ChipsetInitTableUpdReq = 1;
+ //
+ // Copy the ChipsetInit settings from local table into the HOB
+ //
+ if (sizeof(ChipsetInitHob->ChipsetInitTable) >= PchChipsetInitTableLength) {
+ CopyMem (ChipsetInitHob->ChipsetInitTable, PchChipsetInitTable, PchChipsetInitTableLength);
+ } else {
+ ASSERT(FALSE); // Table should always fit into HOB structure.
+ }
+
+ //
+ // Skip the Hsio programming, DMI setting in ChipsetInit table should be good enough to get through DMI init.
+ //
+ return Status;
+ }
+ } else {
+ ASSERT(FALSE);
+ }
+ }
+ }
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 7.1.5
+ /// Step 1.1
+ /// RCBA + Offset 2088h = 00109000h
+ ///
+ MmioWrite32 (
+ (RootComplexBar + R_PCH_RCRB_CIR2088),
+ 0x00109000
+ );
+ ///
+ /// Step 1.2
+ /// RCBA + offset 20ACh[30] = 1b
+ ///
+ MmioOr32 (RootComplexBar + R_PCH_RCRB_REC, BIT30);
+ if (PchSeries == PchH) {
+ ///
+ /// Step 1.3
+ /// Set RCBA + Offset 2340h[7:0] = 1Bh
+ ///
+ MmioWrite8 (RootComplexBar + 0x2340, 0x1B);
+ ///
+ /// Step 1.4
+ /// Set RCBA + Offset 2340h[23:16] = 3Ah
+ ///
+ Data32And = (UINT32) 0xFF00FFFF;
+ Data32Or = (UINT32) (0x3A << 16);
+
+ MmioAndThenOr32 (
+ RootComplexBar + 0x2340,
+ Data32And,
+ Data32Or
+ );
+ ///
+ /// Step 1.5
+ /// Program RCBA + Offset 2324[31:0] = 00854C74h
+ ///
+ MmioWrite32 (RootComplexBar + 0x2324, 0x00854C74);
+ }
+
+ ///
+ /// Program Hsio Setting
+ ///
+ DeviceLaneOwner = MmioRead8 (PciD28F0RegBase + 0x410);
+ StrpFuseCfg1 = MmioRead32 (PciD28F0RegBase + R_PCH_PCIE_STRPFUSECFG);
+#ifdef TRAD_FLAG
+ ///
+ /// PCH BIOS Spec Rev 0.5.6, Section 7.1.5
+ /// Step 6
+ /// Bios is required to program IOBP setting according to the following table:
+ /// Table 7-10 DMI Lane Setting
+ ///
+ if (PchSeries == PchH) {
+ switch (PchSteppingValue) {
+ case LptHB0:
+ size = (sizeof (PchDmiHsioLptH_B0) / sizeof (IOBP_MMIO_TABLE_STRUCT));
+ PchDmiHsio = PchDmiHsioLptH_B0;
+ break;
+ default:
+ PchDmiHsio = NULL;
+ size = 0;
+ DEBUG ((EFI_D_ERROR, "Unsupported PCH Stepping\n"));
+ }
+ for (i = 0; i < size; i++) {
+ Status = ProgramIobp (
+ RootComplexBar,
+ PchDmiHsio[i].Address,
+ PchDmiHsio[i].AndMask,
+ PchDmiHsio[i].OrMask
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
+ }
+#endif // TRAD_FLAG
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.6, Section 7.1.5
+ /// Table 7-3 USB3 dedicated lane Setting
+ ///
+ switch (PchSteppingValue) {
+#ifdef ULT_FLAG
+ case LptLpB0:
+ case LptLpB1:
+ case LptLpB2:
+ size = (sizeof (PchUsb3HsioLptLp_Bx) / sizeof (IOBP_MMIO_TABLE_STRUCT));
+ PchUsb3Hsio = PchUsb3HsioLptLp_Bx;
+ break;
+#endif // ULT_FLAG
+#ifdef TRAD_FLAG
+ case LptHB0:
+ size = (sizeof (PchUsb3HsioLptH_B0) / sizeof (IOBP_MMIO_TABLE_STRUCT));
+ PchUsb3Hsio = PchUsb3HsioLptH_B0;
+ break;
+ case LptHC0:
+ case LptHC1:
+ case LptHC2:
+ size = (sizeof (PchUsb3HsioLptH_Cx) / sizeof (IOBP_MMIO_TABLE_STRUCT));
+ PchUsb3Hsio = PchUsb3HsioLptH_Cx;
+ break;
+#endif // TRAD_FLAG
+ default:
+ PchUsb3Hsio = NULL;
+ size = 0;
+ DEBUG ((EFI_D_ERROR, "Unsupported PCH Stepping\n"));
+ }
+ for (i = 0; i < size; i++) {
+ Status = ProgramIobp (
+ RootComplexBar,
+ PchUsb3Hsio[i].Address,
+ PchUsb3Hsio[i].AndMask,
+ PchUsb3Hsio[i].OrMask
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.6, Section 7.1.5
+ /// Table 7-5 USB3 Shared laneSetting
+ ///
+ switch (PchSteppingValue) {
+#ifdef ULT_FLAG
+ case LptLpB0:
+ case LptLpB1:
+ case LptLpB2:
+ size = (sizeof (PchUsb3SharedHsioLptLp_Bx) / sizeof (IOBP_MMIO_TABLE_STRUCT));
+ PchUsb3SharedHsio = PchUsb3SharedHsioLptLp_Bx;
+ break;
+#endif // ULT_FLAG
+#ifdef TRAD_FLAG
+ case LptHB0:
+ size = (sizeof (PchUsb3SharedHsioLptH_B0) / sizeof (IOBP_MMIO_TABLE_STRUCT));
+ PchUsb3SharedHsio = PchUsb3SharedHsioLptH_B0;
+ break;
+ case LptHC0:
+ case LptHC1:
+ case LptHC2:
+ size = (sizeof (PchUsb3SharedHsioLptH_Cx) / sizeof (IOBP_MMIO_TABLE_STRUCT));
+ PchUsb3SharedHsio = PchUsb3SharedHsioLptH_Cx;
+ break;
+#endif // TRAD_FLAG
+ default:
+ PchUsb3SharedHsio = NULL;
+ size = 0;
+ DEBUG ((EFI_D_ERROR, "Unsupported PCH Stepping\n"));
+ }
+ for (i = 0; i < size; i++) {
+ if (PchSeries == PchLp) {
+ if ((((PchUsb3SharedHsio[i].Address & 0xFE00) == 0x2400) && ((DeviceLaneOwner & (BIT1 | BIT0)) != BIT1)) ||
+ (((PchUsb3SharedHsio[i].Address & 0xFE00) == 0x2600) && ((DeviceLaneOwner & (BIT3 | BIT2)) != BIT3))) {
+ continue;
+ }
+ } else if (PchSeries == PchH) {
+ if ((((PchUsb3SharedHsio[i].Address & 0xFE00) == 0x2C00) && ((DeviceLaneOwner & (BIT3 | BIT2)) != BIT3)) ||
+ (((PchUsb3SharedHsio[i].Address & 0xFE00) == 0x2E00) && ((DeviceLaneOwner & (BIT1 | BIT0)) != BIT1))) {
+ continue;
+ }
+ }
+ Status = ProgramIobp (
+ RootComplexBar,
+ PchUsb3SharedHsio[i].Address,
+ PchUsb3SharedHsio[i].AndMask,
+ PchUsb3SharedHsio[i].OrMask
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
+
+ ///
+ /// Table 7-9 Gbe Lane Setting
+ /// Bios should check the PCIE port that is assigned to Gbe and program the following address accordingly
+ ///
+ switch (PchSteppingValue) {
+#ifdef ULT_FLAG
+ case LptLpB0:
+ case LptLpB1:
+ case LptLpB2:
+ PchGbeSharedHsio = PchGbeSharedHsioLptLp_Bx;
+ size = (sizeof (PchGbeSharedHsioLptLp_Bx) / sizeof (IOBP_MMIO_TABLE_STRUCT));
+ break;
+#endif // ULT_FLAG
+#ifdef TRAD_FLAG
+ case LptHB0:
+ PchGbeSharedHsio = PchGbeSharedHsioLptH_B0;
+ size = (sizeof (PchGbeSharedHsioLptH_B0) / sizeof (IOBP_MMIO_TABLE_STRUCT));
+ break;
+ case LptHC0:
+ case LptHC1:
+ case LptHC2:
+ PchGbeSharedHsio = PchGbeSharedHsioLptH_Cx;
+ size = (sizeof (PchGbeSharedHsioLptH_Cx) / sizeof (IOBP_MMIO_TABLE_STRUCT));
+ break;
+#endif // TRAD_FLAG
+ default:
+ PchGbeSharedHsio = NULL;
+ size = 0;
+ DEBUG ((EFI_D_ERROR, "Unsupported PCH Stepping\n"));
+ }
+
+
+ if (PchGbeSharedHsio != NULL) {
+ if ((StrpFuseCfg1 & B_PCH_PCIE_STRPFUSECFG_GBE_PCIE_PEN) != 0) {
+ GbePort = (UINT8) ((StrpFuseCfg1 & B_PCH_PCIE_STRPFUSECFG_GBE_PCIEPORTSEL) >> N_PCH_PCIE_STRPFUSECFG_GBE_PCIEPORTSEL);
+ } else {
+ GbePort = 0xFF;
+ }
+
+ if (GbePort != 0xFF) {
+#ifdef ULT_FLAG
+ if (PchSeries == PchLp) {
+ if (GbePort <= 0x5) {
+ Status = ProgramIobp (
+ RootComplexBar,
+ PchGbeSharedHsio[GbePort].Address,
+ PchGbeSharedHsio[GbePort].AndMask,
+ PchGbeSharedHsio[GbePort].OrMask
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
+ }
+#endif // ULT_FLAG
+#ifdef TRAD_FLAG
+ if (PchSeries == PchH) {
+ if (GbePort == 0x0) {
+ if ((DeviceLaneOwner & (BIT1 | BIT0)) == BIT0) {
+ Status = ProgramIobp (
+ RootComplexBar,
+ PchGbeSharedHsio[GbePort].Address,
+ PchGbeSharedHsio[GbePort].AndMask,
+ PchGbeSharedHsio[GbePort].OrMask
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
+ } else if (GbePort == 0x1) {
+ if ((DeviceLaneOwner & (BIT3 | BIT2)) == BIT2) {
+ Status = ProgramIobp (
+ RootComplexBar,
+ PchGbeSharedHsio[GbePort].Address,
+ PchGbeSharedHsio[GbePort].AndMask,
+ PchGbeSharedHsio[GbePort].OrMask
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
+ } else {
+ Status = ProgramIobp (
+ RootComplexBar,
+ PchGbeSharedHsio[GbePort].Address,
+ PchGbeSharedHsio[GbePort].AndMask,
+ PchGbeSharedHsio[GbePort].OrMask
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
+ }
+#endif // TRAD_FLAG
+ }
+ }
+ ///
+ /// Step 7
+ /// For LP, clear B0:D28:F0~F7:110h[13, 12, 8:6, 0] = 1b, 1b, 111b, 1b
+ /// For LP, clear B0:D28:F0~F7:104h[20, 18:14, 12, 4] = 1b, 11111b, 1b, 1b
+ ///
+#ifdef ULT_FLAG
+ if (GetPchSeries() == PchLp) {
+ for (PortIndex = 0; PortIndex < GetPchMaxPciePortNum (); PortIndex++) {
+ RPBase = MmPciAddress (
+ 0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS,
+ PortIndex,
+ 0
+ );
+ MmioOr32 (RPBase + R_PCH_PCIE_CES, (UINT32)(B_PCH_PCIE_CES_ANFES | B_PCH_PCIE_CES_RTT |
+ B_PCH_PCIE_CES_RNR | B_PCH_PCIE_CES_BD |
+ B_PCH_PCIE_CES_BT | B_PCH_PCIE_CES_RE));
+ MmioOr32 (RPBase + R_PCH_PCIE_UES, (UINT32)(B_PCH_PCIE_UES_URE | B_PCH_PCIE_UES_MT |
+ B_PCH_PCIE_UES_RO | B_PCH_PCIE_UES_UC |
+ B_PCH_PCIE_UES_CA | B_PCH_PCIE_UES_CT |
+ B_PCH_PCIE_UES_PT | B_PCH_PCIE_UES_DLPE));
+ }
+ }
+#endif //ULT_FLAG
+
+ ///
+ /// Step 8
+ /// Bios is required to program IOBP setting according to the table 7-7 to 7-8
+ /// using 7.1.4 IOSF SBI with OPCODE "PHY Configuration Register".
+ /// Done in PchSataInit().
+ ///
+ /// PCH BIOS Spec Rev 0.5.1, Section 7.1.5
+ /// Step 9
+ /// IOBP Programming:
+ /// For Mobile:
+ /// BIOS is required to program IOBP setting according to Table 7-11 and
+ /// Table 7-12 using settings in Section 7.1.4 with OPCODE "PHY Configuration Register".
+ /// For Desktop:
+ /// BIOS is required to program IOBP setting according to Table 7-13 and
+ /// Table 7-14 using settings in Section 7.1.4 with OPCODE "PHY Configuration Register".
+ /// Done in PchSataInit().
+ ///
+ /// Step 10, 11
+ /// Set D20:F0:B0h[7] to 0b
+ /// Set D20:F0:B0h[16] to 1b
+ ///
+ Data32And = (UINT32) ~(BIT7);
+ Data32Or = (UINT32) (BIT16);
+
+ MmioAndThenOr32 (
+ PciD20F0RegBase + 0xB0,
+ Data32And,
+ Data32Or
+ );
+ if (GetPchSeries() == PchLp) {
+ ///
+ /// Step 12
+ /// Sideband Minimum Duration. T_SB_MIN = 16ns
+ /// RCBA + Offset 260Ch[15:0]=0010h
+ ///
+ MmioWrite16 (
+ (RootComplexBar + 0x260C),
+ 0x0010
+ );
+ ///
+ /// Step x
+ /// Program Iobp 0xEC000106 to 3100h
+ ///
+ Status = ProgramIobp (
+ RootComplexBar,
+ 0xEC000106,
+ (UINT32)~(0x00003100),
+ 0x00003100
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
+ return Status;
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchInitCommon.h b/ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchInitCommon.h
new file mode 100644
index 0000000..be59220
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchInitCommon.h
@@ -0,0 +1,73 @@
+/** @file
+ Header file for the PCH Common Init PEIM.
+
+@copyright
+ Copyright (c) 2009 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PCH_INIT_COMMON_PEIM_H_
+#define _PCH_INIT_COMMON_PEIM_H_
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#include EFI_PPI_CONSUMER (PchPlatformPolicy)
+#include EFI_PPI_CONSUMER (PchUsbPolicy)
+#endif
+
+#define PCH_INIT_COMMON_SCRIPT_IO_WRITE(TableName, Width, Address, Count, Buffer)
+
+#define PCH_INIT_COMMON_SCRIPT_IO_READ_WRITE(TableName, Width, Address, Data, DataMask)
+
+#define PCH_INIT_COMMON_SCRIPT_MEM_WRITE(TableName, Width, Address, Count, Buffer)
+
+#define PCH_INIT_COMMON_SCRIPT_MEM_READ_WRITE(TableName, Width, Address, Data, DataMask)
+
+#define PCH_INIT_COMMON_SCRIPT_PCI_CFG_WRITE(TableName, Width, Address, Count, Buffer)
+
+#define PCH_INIT_COMMON_SCRIPT_PCI_CFG_READ_WRITE(TableName, Width, Address, Data, DataMask)
+
+#define PCH_INIT_COMMON_SCRIPT_STALL(TableName, Duration)
+
+#define PCH_INIT_COMMON_SCRIPT_SAVE_IOBP_S3_ITEM(RootComplexBar, Address, AndMask, OrMask) \
+ EFI_SUCCESS
+
+#ifdef USB_PRECONDITION_ENABLE_FLAG
+///
+/// Execute function when running in PEI
+///
+#define USB_RUN_IN_PEI TRUE
+
+///
+/// Execute function when running in DXE
+/// It is always FALSE for PEI phase check
+///
+#define USB_RUN_IN_DXE FALSE
+
+///
+/// USB precondition policy check
+///
+#define USB_PRECONDITION_POLICY_SUPPORT(UsbPolicy) \
+ ((UsbPolicy)->UsbPrecondition)
+
+#endif // USB_PRECONDITION_ENABLE_FLAG
+
+///
+/// USB3 port setting policy check
+///
+#define USB3PORT_SETTING_POLICY_SUPPORT(Revision) \
+ ((Revision >= PCH_PLATFORM_POLICY_PPI_REVISION_3))
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchInitPeim.c b/ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchInitPeim.c
new file mode 100644
index 0000000..12133c7
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchInitPeim.c
@@ -0,0 +1,2232 @@
+/** @file
+ The PCH Init PEIM implements the PCH PEI Init PPI.
+
+@copyright
+ Copyright (c) 2004 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "PchInitPeim.h"
+
+//
+// Global variables
+//
+static PCH_DMI_TC_VC_PPI mPchDmiTcVcMap = {
+ {
+ DmiVcTypeVc0,
+ DmiVcTypeVc1,
+ DmiVcTypeVcp,
+ DmiVcTypeVc0,
+ DmiVcTypeVc0,
+ DmiVcTypeVc0,
+ DmiVcTypeVc0,
+ DmiVcTypeVcm
+ },
+ {
+ {PCH_DEVICE_ENABLE, (UINT8) 0},
+ {PCH_DEVICE_ENABLE, (UINT8) 1},
+ {PCH_DEVICE_ENABLE, (UINT8) 2},
+ {PCH_DEVICE_ENABLE, (UINT8) 7}
+ }
+};
+
+static PCH_INIT_PPI mPchInitPpi = {
+ PchUsbInit,
+ PchDmiTcVcProgPoll,
+ PchDmiGen2Prog,
+ PchCpuStrapSet
+};
+
+static EFI_PEI_PPI_DESCRIPTOR mPpiListVariable = {
+ (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+ &gPchInitPpiGuid,
+ &mPchInitPpi
+};
+
+static EFI_PEI_PPI_DESCRIPTOR mPpiPchPeiInitDone = {
+ (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+ &gPchPeiInitDonePpiGuid,
+ NULL
+};
+
+static EFI_PEI_NOTIFY_DESCRIPTOR mNotifyList = {
+ EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
+ &gPchPlatformPolicyPpiGuid,
+ PchInitialize
+};
+
+EFI_GUID gEfiPeiEndOfPeiPhasePpiGuid = EFI_PEI_END_OF_PEI_PHASE_PPI_GUID;
+static EFI_PEI_NOTIFY_DESCRIPTOR mPchS3ResumeNotifyDesc = {
+ (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+ &gEfiPeiEndOfPeiPhasePpiGuid,
+ PchS3ResumeAtEndOfPei
+};
+//
+// Functions
+//
+
+/**
+ Internal function performing SATA init needed in PEI phase
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] PchPlatformPolicyPpi The PCH Platform Policy PPI instance
+
+ @retval EFI_SUCCESS No platform reset action is taken. System can continue boot flow.
+ @retval Others Won't return if platform reset action is taken
+**/
+EFI_STATUS
+EFIAPI
+PchSataInit (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PCH_PLATFORM_POLICY_PPI *PchPlatformPolicyPpi
+ )
+{
+
+ UINT32 Data32And;
+ UINT32 Data32Or;
+ UINTN PciD31F0RegBase;
+ UINT16 LpcDeviceId;
+ UINTN PciD31F2RegBase;
+ UINTN PciD28F0RegBase;
+ BOOLEAN SkipSataInit;
+ UINT16 i;
+ UINT16 GSpeed;
+ UINT16 PortId;
+ UINT8 RxEq;
+ UINT32 OrMask;
+ UINT16 size;
+ UINT32 RootComplexBar;
+ UINT8 DeviceLaneOwner;
+ EFI_STATUS Status;
+ PCH_SERIES PchSeries;
+ UINT32 PchSataTraceId;
+#ifdef TRAD_FLAG
+ IOBP_MMIO_TABLE_STRUCT *PchSataHsio;
+ IOBP_MMIO_TABLE_STRUCT *PchSataHsio_MB;
+ IOBP_MMIO_TABLE_STRUCT *PchSataHsio_DT;
+ IOBP_SATA_RXEQ_TABLE *PchSataRxEqHsio;
+#endif // TRAD_FLAG
+ IOBP_MMIO_TABLE_STRUCT *PchSataSharedHsio;
+ IOBP_MMIO_TABLE_STRUCT *PchSataSharedHsio_MB;
+ IOBP_MMIO_TABLE_STRUCT *PchSataSharedHsio_DT;
+ IOBP_SATA_RXEQ_TABLE *PchSataRxEqSharedHsio;
+
+ DEBUG ((EFI_D_INFO, "PchSataInit() - Start\n"));
+
+ PchSeries = GetPchSeries();
+ RootComplexBar = PCH_RCRB_BASE;
+ PciD31F0RegBase = MmPciAddress (
+ 0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ 0
+ );
+ LpcDeviceId = MmioRead16 (PciD31F0RegBase + R_PCH_LPC_DEVICE_ID);
+ PciD31F2RegBase = MmPciAddress (
+ 0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_SATA,
+ PCI_FUNCTION_NUMBER_PCH_SATA,
+ 0
+ );
+ PciD28F0RegBase = MmPciAddress (
+ 0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS,
+ PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_1,
+ 0
+ );
+ SkipSataInit = FALSE;
+
+ ///
+ /// Skip SATA init if any of SATA port0 ~ port3 is enabled
+ ///
+ if ((MmioRead8 (PciD31F2RegBase + R_PCH_SATA_PCS) & (UINT8) (B_PCH_SATA_PCS_PORT3_EN |
+ B_PCH_SATA_PCS_PORT2_EN |
+ B_PCH_SATA_PCS_PORT1_EN |
+ B_PCH_SATA_PCS_PORT0_EN)) != 0) {
+ SkipSataInit = TRUE;
+ }
+ if (PchSeries == PchH) {
+ ///
+ /// Skip SATA init if SATA port4 or port5 is enabled
+ ///
+ if ((MmioRead8 (PciD31F2RegBase + R_PCH_SATA_PCS) & (UINT8) (B_PCH_SATA_PCS_PORT5_EN |
+ B_PCH_SATA_PCS_PORT4_EN)) != 0) {
+ SkipSataInit = TRUE;
+ }
+ }
+ if (SkipSataInit == TRUE) {
+ if (PchSeries == PchH) {
+ ///
+ /// Any SATA port should not be enabled unless CPU only reset.
+ /// The value of 0xEA000AAC[5:4] is 10b after issuing CPU only reset.
+ /// Note:
+ /// The default value of 0xEA000AAC[5:4] is 00b.
+ /// The following "if" condition will need to update while the
+ /// BIOS recommended setting of 0xEA000AAC[5:4] is changed.
+ /// Asset if any SATA port is enabled before SATA Hsio initialization is done
+ ///
+ Status = ReadIobp (RootComplexBar, 0xEA000AAC, &Data32And);
+ if ((Data32And & (UINT32) (BIT4 | BIT5)) != 0x20) {
+ DEBUG ((EFI_D_ERROR, "Please do not enable any SATA port before SATA Hsio initialization is done.\n"));
+ ASSERT (0);
+ }
+ }
+ } else {
+ ///
+ /// Assume SATA mode will be AHCI, SATA Port 0 - Port 5 are all for D31:F2
+ ///
+ if (PchSeries == PchH) {
+ MmioAndThenOr8 (
+ PciD31F2RegBase + R_PCH_SATA_MAP,
+ (UINT8) (~B_PCH_SATA_MAP_SMS_MASK),
+ (UINT8) (V_PCH_SATA_MAP_SMS_AHCI | B_PCH_SATA_PORT_TO_CONTROLLER_CFG)
+ );
+ } else if (PchSeries == PchLp) {
+ MmioAndThenOr8 (
+ PciD31F2RegBase + R_PCH_SATA_MAP,
+ (UINT8) (~B_PCH_SATA_MAP_SMS_MASK),
+ (UINT8) (V_PCH_SATA_MAP_SMS_AHCI)
+ );
+ }
+ ///
+ /// PCH BIOS Spec Rev 0.5.0 section 14.1.7 Additional Programming Requirements during
+ /// SATA Initialization
+ /// Step 2
+ /// System BIOS must set D31:F2:Reg 94h[8:0] = 183h as part of the chipset initialization
+ /// prior to SATA configuration. These bits should be restored while resuming from a S3
+ /// sleep state.
+ ///
+ Data32And = (UINT32)~(BIT8 | BIT7 | BIT6 | BIT5 | BIT4 | BIT3 | BIT2 | BIT1 | BIT0);
+ Data32Or = 0x183;
+ MmioAndThenOr32 (
+ (UINTN) (PciD31F2RegBase + R_PCH_SATA_SCLKCG),
+ Data32And,
+ Data32Or
+ );
+ ///
+ /// Step 3
+ /// D31:F2:Reg 92h[15] = 1b
+ /// Set OOB Retry Mode bit of Port Control and Status (PCS) register
+ /// These bits should be restored while resuming from a S3 sleep state
+ ///
+ MmioOr16 ((UINTN) (PciD31F2RegBase + R_PCH_SATA_PCS), (UINT16) (B_PCH_SATA_PCS_OOB_RETRY));
+ ///
+ /// Step 4
+ /// System BIOS must program SATA Hsio table as stated in Table 7-7 to 7-8 BEFORE the SATA
+ /// ports are enabled.
+ ///
+ /// PCH BIOS Spec Rev 0.5.6, Section 7.1.5
+ /// Step 8
+ /// Bios is required to program IOBP setting according to the table 7-7 to 7-8
+ /// using 7.1.4 IOSF SBI with OPCODE "PHY Configuration Register".
+ /// Table 7-7 SATA dedicated lane setting
+ ///
+ DeviceLaneOwner = MmioRead8 (PciD28F0RegBase + 0x410);
+#ifdef TRAD_FLAG
+ switch (PchStepping()) {
+ case LptHB0:
+ size = (sizeof (PchSataHsioLptH_B0) / sizeof (IOBP_MMIO_TABLE_STRUCT));
+ PchSataHsio = PchSataHsioLptH_B0;
+ break;
+ case LptHC0:
+ case LptHC1:
+ case LptHC2:
+ size = (sizeof (PchSataHsioLptH_Cx) / sizeof (IOBP_MMIO_TABLE_STRUCT));
+ PchSataHsio = PchSataHsioLptH_Cx;
+ break;
+ default:
+ PchSataHsio = NULL;
+ size = 0;
+ DEBUG ((EFI_D_ERROR, "Unsupported PCH Stepping\n"));
+ }
+
+ for (i = 0; i < size; i++) {
+ Status = ProgramIobp (
+ RootComplexBar,
+ PchSataHsio[i].Address,
+ PchSataHsio[i].AndMask,
+ PchSataHsio[i].OrMask
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
+#endif // TRAD_FLAG
+ ///
+ /// Table 7-8 SATA Shared lane setting
+ ///
+ switch (PchStepping()) {
+#ifdef ULT_FLAG
+ case LptLpB0:
+ case LptLpB1:
+ case LptLpB2:
+ size = (sizeof (PchSataSharedHsioLptLp_Bx) / sizeof (IOBP_MMIO_TABLE_STRUCT));
+ PchSataSharedHsio = PchSataSharedHsioLptLp_Bx;
+ break;
+#endif // ULT_FLAG
+#ifdef TRAD_FLAG
+ case LptHB0:
+ size = (sizeof (PchSataSharedHsioLptH_B0) / sizeof (IOBP_MMIO_TABLE_STRUCT));
+ PchSataSharedHsio = PchSataSharedHsioLptH_B0;
+ break;
+ case LptHC0:
+ case LptHC1:
+ case LptHC2:
+ size = (sizeof (PchSataSharedHsioLptH_Cx) / sizeof (IOBP_MMIO_TABLE_STRUCT));
+ PchSataSharedHsio = PchSataSharedHsioLptH_Cx;
+ break;
+#endif // TRAD_FLAG
+ default:
+ size = 0;
+ PchSataSharedHsio = NULL;
+ DEBUG ((EFI_D_ERROR, "Unsupported PCH Stepping\n"));
+ }
+ for (i = 0; i < size; i++) {
+ if (PchSeries == PchLp) {
+ if ((((PchSataSharedHsio[i].Address & 0xFE00) == 0x2000) && ((DeviceLaneOwner & BIT4) == BIT4)) ||
+ (((PchSataSharedHsio[i].Address & 0xFE00) == 0x2200) && ((DeviceLaneOwner & BIT5) == BIT5)) ||
+ (((PchSataSharedHsio[i].Address & 0xFE00) == 0x2400) && ((DeviceLaneOwner & BIT6) == BIT6)) ||
+ (((PchSataSharedHsio[i].Address & 0xFE00) == 0x2600) && ((DeviceLaneOwner & BIT7) == BIT7))) {
+ continue;
+ }
+ } else if (PchSeries == PchH) {
+ if ((((PchSataSharedHsio[i].Address & 0xFE00) == 0x2000) && ((DeviceLaneOwner & BIT4) == BIT4)) ||
+ (((PchSataSharedHsio[i].Address & 0xFE00) == 0x2200) && ((DeviceLaneOwner & BIT5) == BIT5))) {
+ continue;
+ }
+ }
+ Status = ProgramIobp (
+ RootComplexBar,
+ PchSataSharedHsio[i].Address,
+ PchSataSharedHsio[i].AndMask,
+ PchSataSharedHsio[i].OrMask
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.1, Section 7.1.5
+ /// Step 9
+ /// IOBP Programming:
+ /// For Mobile:
+ /// BIOS is required to program IOBP setting according to Table 7-11 and
+ /// Table 7-12 using settings in Section 7.1.4 with OPCODE "PHY Configuration Register".
+ ///
+ if (IS_PCH_LPT_LPC_DEVICE_ID_MOBILE (LpcDeviceId)) {
+#ifdef TRAD_FLAG
+ ///
+ /// Table 7-11 SATA Dedicated Lane Setting
+ ///
+ switch (PchStepping()) {
+ case LptHB0:
+ size = (sizeof (PchSataHsioLptH_MB_B0) / sizeof (IOBP_MMIO_TABLE_STRUCT));
+ PchSataHsio_MB = PchSataHsioLptH_MB_B0;
+ break;
+ case LptHC0:
+ case LptHC1:
+ case LptHC2:
+ size = (sizeof (PchSataHsioLptH_MB_Cx) / sizeof (IOBP_MMIO_TABLE_STRUCT));
+ PchSataHsio_MB = PchSataHsioLptH_MB_Cx;
+ break;
+ default:
+ size = 0;
+ PchSataHsio_MB = NULL;
+ DEBUG ((EFI_D_ERROR, "Unsupported PCH Stepping\n"));
+ }
+ for (i = 0; i < size; i++) {
+ Status = ProgramIobp (
+ RootComplexBar,
+ PchSataHsio_MB[i].Address,
+ PchSataHsio_MB[i].AndMask,
+ PchSataHsio_MB[i].OrMask
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
+#endif // TRAD_FLAG
+ ///
+ /// Table 7-12 SATA Shared Lane Setting
+ ///
+ switch (PchStepping()) {
+#ifdef ULT_FLAG
+ case LptLpB0:
+ case LptLpB1:
+ case LptLpB2:
+ size = (sizeof (PchSataSharedHsioLptLp_MB_Bx) / sizeof (IOBP_MMIO_TABLE_STRUCT));
+ PchSataSharedHsio_MB = PchSataSharedHsioLptLp_MB_Bx;
+ break;
+#endif // ULT_FLAG
+#ifdef TRAD_FLAG
+ case LptHB0:
+ size = (sizeof (PchSataSharedHsioLptH_MB_B0) / sizeof (IOBP_MMIO_TABLE_STRUCT));
+ PchSataSharedHsio_MB = PchSataSharedHsioLptH_MB_B0;
+ break;
+ case LptHC0:
+ case LptHC1:
+ case LptHC2:
+ size = (sizeof (PchSataSharedHsioLptH_MB_Cx) / sizeof (IOBP_MMIO_TABLE_STRUCT));
+ PchSataSharedHsio_MB = PchSataSharedHsioLptH_MB_Cx;
+ break;
+#endif // TRAD_FLAG
+ default:
+ size = 0;
+ PchSataSharedHsio_MB = NULL;
+ DEBUG ((EFI_D_ERROR, "Unsupported PCH Stepping\n"));
+ }
+ for (i = 0; i < size; i++) {
+ if (PchSeries == PchLp) {
+ if ((((PchSataSharedHsio_MB[i].Address & 0xFE00) == 0x2000) && ((DeviceLaneOwner & BIT4) == BIT4)) ||
+ (((PchSataSharedHsio_MB[i].Address & 0xFE00) == 0x2200) && ((DeviceLaneOwner & BIT5) == BIT5)) ||
+ (((PchSataSharedHsio_MB[i].Address & 0xFE00) == 0x2400) && ((DeviceLaneOwner & BIT6) == BIT6)) ||
+ (((PchSataSharedHsio_MB[i].Address & 0xFE00) == 0x2600) && ((DeviceLaneOwner & BIT7) == BIT7))) {
+ continue;
+ }
+ } else if (PchSeries == PchH) {
+ if ((((PchSataSharedHsio_MB[i].Address & 0xFE00) == 0x2000) && ((DeviceLaneOwner & BIT4) == BIT4)) ||
+ (((PchSataSharedHsio_MB[i].Address & 0xFE00) == 0x2200) && ((DeviceLaneOwner & BIT5) == BIT5))) {
+ continue;
+ }
+ }
+ Status = ProgramIobp (
+ RootComplexBar,
+ PchSataSharedHsio_MB[i].Address,
+ PchSataSharedHsio_MB[i].AndMask,
+ PchSataSharedHsio_MB[i].OrMask
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
+ } else {
+ ///
+ /// For Desktop:
+ /// BIOS is required to program IOBP setting according to Table 7-13 and
+ /// Table 7-14 using settings in Section 7.1.4 with OPCODE "PHY Configuration Register".
+ /// Table 7-13 SATA Dedicated Lane Setting
+ ///
+#ifdef TRAD_FLAG
+ switch (PchStepping()) {
+ case LptHB0:
+ size = (sizeof (PchSataHsioLptH_DT_B0) / sizeof (IOBP_MMIO_TABLE_STRUCT));
+ PchSataHsio_DT = PchSataHsioLptH_DT_B0;
+ break;
+ case LptHC0:
+ case LptHC1:
+ case LptHC2:
+ size = (sizeof (PchSataHsioLptH_DT_Cx) / sizeof (IOBP_MMIO_TABLE_STRUCT));
+ PchSataHsio_DT = PchSataHsioLptH_DT_Cx;
+ break;
+ default:
+ size = 0;
+ PchSataHsio_DT = NULL;
+ DEBUG ((EFI_D_ERROR, "Unsupported PCH Stepping\n"));
+ }
+ for (i = 0; i < size; i++) {
+ Status = ProgramIobp (
+ RootComplexBar,
+ PchSataHsio_DT[i].Address,
+ PchSataHsio_DT[i].AndMask,
+ PchSataHsio_DT[i].OrMask
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
+#endif // TRAD_FLAG
+ ///
+ /// Table 7-14 SATA Shared Lane Setting
+ ///
+ switch (PchStepping()) {
+#ifdef ULT_FLAG
+ case LptLpB0:
+ case LptLpB1:
+ case LptLpB2:
+ size = (sizeof (PchSataSharedHsioLptLp_DT_Bx) / sizeof (IOBP_MMIO_TABLE_STRUCT));
+ PchSataSharedHsio_DT = PchSataSharedHsioLptLp_DT_Bx;
+ break;
+#endif // ULT_FLAG
+#ifdef TRAD_FLAG
+ case LptHB0:
+ size = (sizeof (PchSataSharedHsioLptH_DT_B0) / sizeof (IOBP_MMIO_TABLE_STRUCT));
+ PchSataSharedHsio_DT = PchSataSharedHsioLptH_DT_B0;
+ break;
+ case LptHC0:
+ case LptHC1:
+ case LptHC2:
+ size = (sizeof (PchSataSharedHsioLptH_DT_Cx) / sizeof (IOBP_MMIO_TABLE_STRUCT));
+ PchSataSharedHsio_DT = PchSataSharedHsioLptH_DT_Cx;
+ break;
+#endif // TRAD_FLAG
+ default:
+ size = 0;
+ PchSataSharedHsio_DT = NULL;
+ DEBUG ((EFI_D_ERROR, "Unsupported PCH Stepping\n"));
+ }
+ for (i = 0; i < size; i++) {
+ if (PchSeries == PchLp) {
+ if ((((PchSataSharedHsio_DT[i].Address & 0xFE00) == 0x2000) && ((DeviceLaneOwner & BIT4) == BIT4)) ||
+ (((PchSataSharedHsio_DT[i].Address & 0xFE00) == 0x2200) && ((DeviceLaneOwner & BIT5) == BIT5)) ||
+ (((PchSataSharedHsio_DT[i].Address & 0xFE00) == 0x2400) && ((DeviceLaneOwner & BIT6) == BIT6)) ||
+ (((PchSataSharedHsio_DT[i].Address & 0xFE00) == 0x2600) && ((DeviceLaneOwner & BIT7) == BIT7))) {
+ continue;
+ }
+ } else if (PchSeries == PchH) {
+ if ((((PchSataSharedHsio_DT[i].Address & 0xFE00) == 0x2000) && ((DeviceLaneOwner & BIT4) == BIT4)) ||
+ (((PchSataSharedHsio_DT[i].Address & 0xFE00) == 0x2200) && ((DeviceLaneOwner & BIT5) == BIT5))) {
+ continue;
+ }
+ }
+ Status = ProgramIobp (
+ RootComplexBar,
+ PchSataSharedHsio_DT[i].Address,
+ PchSataSharedHsio_DT[i].AndMask,
+ PchSataSharedHsio_DT[i].OrMask
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
+ }
+
+ ///
+ /// Table 7-15 SATA RxEq Dedicated Lane Setting
+ ///
+ PchSataTraceId = 0;
+#ifdef TRAD_FLAG
+ switch (PchStepping()) {
+ case LptHC0:
+ case LptHC1:
+ case LptHC2:
+ size = (sizeof (PchSataRxEqHsioLptH_Cx) / sizeof (IOBP_SATA_RXEQ_TABLE));
+ PchSataRxEqHsio = PchSataRxEqHsioLptH_Cx;
+ break;
+ default:
+ PchSataRxEqHsio = NULL;
+ size = 0;
+ DEBUG ((EFI_D_ERROR, "Unsupported PCH Stepping\n"));
+ }
+
+ for(PortId = 0; PortId < GetPchMaxSataPortNum (); PortId++){
+ for(GSpeed = 0; GSpeed < 3; GSpeed++){
+ if(PchPlatformPolicyPpi->SataConfig->SataTraceConfig->PortRxEq[PortId].GenSpeed[GSpeed].Enable == PCH_DEVICE_ENABLE) {
+ PchSataTraceId = PCH_SATA_RXEQ_ID(PortId, GSpeed);
+ for (i = 0; i < size; i++) {
+ if(PchSataRxEqHsio[i].TraceId == PchSataTraceId) {
+ RxEq = PchPlatformPolicyPpi->SataConfig->SataTraceConfig->PortRxEq[PortId].GenSpeed[GSpeed].RxEq;
+ OrMask = (((UINT32) (((RxEq) << 24 ) + ((RxEq) << 16 ) + ((RxEq) << 8 ) + RxEq)) & ((UINT32)~(PchSataRxEqHsio[i].AndMask)));
+ Status = ProgramIobp (
+ RootComplexBar,
+ PchSataRxEqHsio[i].Address,
+ PchSataRxEqHsio[i].AndMask,
+ OrMask
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
+ }
+ }
+ }
+ }
+#endif // TRAD_FLAG
+
+ ///
+ /// Table 7-16 SATA RxEq Shared Lane Setting
+ ///
+ switch (PchStepping()) {
+#ifdef ULT_FLAG
+ case LptLpB0:
+ case LptLpB1:
+ case LptLpB2:
+ size = (sizeof (PchSataRxEqSharedHsioLptLp_Bx) / sizeof (IOBP_SATA_RXEQ_TABLE));
+ PchSataRxEqSharedHsio = PchSataRxEqSharedHsioLptLp_Bx;
+ break;
+#endif // ULT_FLAG
+#ifdef TRAD_FLAG
+ case LptHC0:
+ case LptHC1:
+ case LptHC2:
+ size = (sizeof (PchSataRxEqSharedHsioLptH_Cx) / sizeof (IOBP_SATA_RXEQ_TABLE));
+ PchSataRxEqSharedHsio = PchSataRxEqSharedHsioLptH_Cx;
+ break;
+#endif // TRAD_FLAG
+ default:
+ size = 0;
+ PchSataRxEqSharedHsio = NULL;
+ DEBUG ((EFI_D_ERROR, "Unsupported PCH Stepping\n"));
+ }
+
+ for(PortId = 0; PortId < GetPchMaxSataPortNum (); PortId++){
+ for(GSpeed = 0; GSpeed < 3; GSpeed++){
+ if(PchPlatformPolicyPpi->SataConfig->SataTraceConfig->PortRxEq[PortId].GenSpeed[GSpeed].Enable == PCH_DEVICE_ENABLE) {
+ PchSataTraceId = PCH_SATA_RXEQ_ID(PortId, GSpeed);
+ for (i = 0; i < size; i++) {
+ if(PchSataRxEqSharedHsio[i].TraceId == PchSataTraceId) {
+ if (PchSeries == PchLp) {
+ if ((((PchSataRxEqSharedHsio[i].Address & 0xFE00) == 0x2000) && ((DeviceLaneOwner & BIT4) == BIT4)) ||
+ (((PchSataRxEqSharedHsio[i].Address & 0xFE00) == 0x2200) && ((DeviceLaneOwner & BIT5) == BIT5)) ||
+ (((PchSataRxEqSharedHsio[i].Address & 0xFE00) == 0x2400) && ((DeviceLaneOwner & BIT6) == BIT6)) ||
+ (((PchSataRxEqSharedHsio[i].Address & 0xFE00) == 0x2600) && ((DeviceLaneOwner & BIT7) == BIT7)))
+ {
+ continue;
+ }
+ } else if (PchSeries == PchH) {
+ if ((((PchSataRxEqSharedHsio[i].Address & 0xFE00) == 0x2000) && ((DeviceLaneOwner & BIT4) == BIT4)) ||
+ (((PchSataRxEqSharedHsio[i].Address & 0xFE00) == 0x2200) && ((DeviceLaneOwner & BIT5) == BIT5)))
+ {
+ continue;
+ }
+ }
+ RxEq = PchPlatformPolicyPpi->SataConfig->SataTraceConfig->PortRxEq[PortId].GenSpeed[GSpeed].RxEq;
+ OrMask = (((UINT32) (((RxEq) << 24 ) + ((RxEq) << 16 ) + ((RxEq) << 8 ) + RxEq)) & ((UINT32)~(PchSataRxEqSharedHsio[i].AndMask)));
+ Status = ProgramIobp (
+ RootComplexBar,
+ PchSataRxEqSharedHsio[i].Address,
+ PchSataRxEqSharedHsio[i].AndMask,
+ OrMask
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
+ }
+ }
+ }
+ }
+ ///
+ /// PCH BIOS Spec Rev 0.5.0 section 14.1.7 Additional Programming Requirements during
+ /// SATA Initialization
+ /// Step 5
+ /// Program D31:F2:98h[22] to 1b for desktop and mobile platform only.
+ ///
+ if (IS_PCH_LPT_LPC_DEVICE_ID_DESKTOP (LpcDeviceId) ||
+ IS_PCH_LPT_LPC_DEVICE_ID_MOBILE (LpcDeviceId)) {
+ MmioOr32 (
+ (UINTN) (PciD31F2RegBase + 0x98),
+ (UINT32) (BIT22)
+ );
+ }
+ ///
+ /// Step 6
+ /// Program D31:F2:98h[19] = 1b
+ ///
+ MmioOr32 (
+ (UINTN) (PciD31F2RegBase + 0x98),
+ (UINT32) (BIT19)
+ );
+ ///
+ /// Step 7
+ /// Program D31:F2:98h[12:7] = 04h
+ ///
+ Data32And = (UINT32) (~(BIT7 | BIT8 | BIT10 | BIT11 | BIT12));
+ Data32Or = (UINT32) (BIT9);
+ MmioAndThenOr32 (
+ (UINTN) (PciD31F2RegBase + 0x98),
+ Data32And,
+ Data32Or
+ );
+ ///
+ /// Step 8
+ /// Program D31:F2:98h[20] to 1b
+ ///
+ MmioOr32 ((UINTN) (PciD31F2RegBase + 0x98), (UINT32) (BIT20));
+ ///
+ /// Step 9
+ /// Program D31:F2:98h[6:5] to 01b
+ ///
+ MmioAndThenOr32 (
+ (UINTN) (PciD31F2RegBase + 0x98),
+ (UINT32) (~(BIT6 | BIT5)),
+ BIT5
+ );
+ ///
+ /// Step 10
+ /// Program D31:F2:98h [18] to 1b
+ ///
+ Data32Or = (UINT32) (BIT18);
+ MmioOr32 (
+ (UINTN) (PciD31F2RegBase + 0x98),
+ Data32Or
+ );
+ ///
+ /// Step 11
+ /// Program D31:F2:98h[29] to 1b
+ /// Done in PchInitBeforeBoot()
+ ///
+ /// Step 12
+ /// Program D31:F2:9Ch[5] to 1b (Note: this must be programmed together with D31:F2:9Ch[7:6]
+ /// in word write)
+ /// Done in ConfigureSata ()
+ ///
+ /// Step 13
+ /// When SATA in IDE mode
+ /// a. Program D31:F2:34h [7:0] to 70h
+ /// b. Program D31:F2:70h [15:8] to 0h
+ /// Done in PchMiscInit ()
+ ///
+ /// Step 14
+ /// Program D31:F2:9Ch[31] to 1b at the End of Post
+ /// Done in PchInitBeforeBoot()
+ ///
+ /// Enable the SATA port0 ~ port3.
+ ///
+ if (PchSeries == PchH) {
+ MmioOr8 (
+ PciD31F2RegBase + R_PCH_SATA_PCS,
+ (UINT8) (B_PCH_SATA_PCS_PORT3_EN | B_PCH_SATA_PCS_PORT2_EN | B_PCH_SATA_PCS_PORT1_EN | B_PCH_SATA_PCS_PORT0_EN)
+ );
+ }
+ if (PchSeries == PchLp) {
+ ///
+ /// If D28:F0:410h[7] = 1b, System BIOS should not enable the SATA port0
+ /// If D28:F0:410h[6] = 1b, System BIOS should not enable the SATA port1
+ /// If D28:F0:410h[5] = 1b, System BIOS should not enable the SATA port2
+ /// If D28:F0:410h[4] = 1b, System BIOS should not enable the SATA port3
+ ///
+ if ((MmioRead8 (PciD28F0RegBase + 0x410) & BIT7) == 0) {
+ MmioOr8 (
+ PciD31F2RegBase + R_PCH_SATA_PCS,
+ (UINT8) B_PCH_SATA_PCS_PORT0_EN
+ );
+ }
+ if ((MmioRead8 (PciD28F0RegBase + 0x410) & BIT6) == 0) {
+ MmioOr8 (
+ PciD31F2RegBase + R_PCH_SATA_PCS,
+ (UINT8) B_PCH_SATA_PCS_PORT1_EN
+ );
+ }
+ if ((MmioRead8 (PciD28F0RegBase + 0x410) & BIT5) == 0) {
+ MmioOr8 (
+ PciD31F2RegBase + R_PCH_SATA_PCS,
+ (UINT8) B_PCH_SATA_PCS_PORT2_EN
+ );
+ }
+ if ((MmioRead8 (PciD28F0RegBase + 0x410) & BIT4) == 0) {
+ MmioOr8 (
+ PciD31F2RegBase + R_PCH_SATA_PCS,
+ (UINT8) B_PCH_SATA_PCS_PORT3_EN
+ );
+ }
+ }
+ if (PchSeries == PchH) {
+ ///
+ /// Enable the SATA port4 and port5.
+ /// Step 1.a
+ /// If D28:F0:410h[4] = 1b, System BIOS should not enable the SATA port4
+ /// Step 1.b
+ /// If D28:F0:410h[5] = 1b, System BIOS should not enable the SATA port5
+ ///
+ if ((MmioRead8 (PciD28F0RegBase + 0x410) & BIT4) == 0) {
+ MmioOr8 (
+ PciD31F2RegBase + R_PCH_SATA_PCS,
+ (UINT8) B_PCH_SATA_PCS_PORT4_EN
+ );
+ }
+ if ((MmioRead8 (PciD28F0RegBase + 0x410) & BIT5) == 0) {
+ MmioOr8 (
+ PciD31F2RegBase + R_PCH_SATA_PCS,
+ (UINT8) B_PCH_SATA_PCS_PORT5_EN
+ );
+ }
+ }
+ }
+
+ DEBUG ((EFI_D_INFO, "PchSataInit() - End\n"));
+
+ return EFI_SUCCESS;
+}
+
+/**
+ The function is used while doing CPU Only Reset, where PCH may be required
+ to initialize strap data before soft reset.
+
+ @param[in] PeiServices General purpose services available to every PEIM
+ @param[in] Operation Get/Set Cpu Strap Set Data
+ @param[in, out] CpuStrapSet Cpu Strap Set Data
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @exception EFI_UNSUPPORTED The function is not supported.
+**/
+EFI_STATUS
+EFIAPI
+PchCpuStrapSet (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN CPU_STRAP_OPERATION Operation,
+ IN OUT UINT16 *CpuStrapSet
+ )
+{
+ UINT32 RootComplexBar;
+
+ DEBUG ((EFI_D_INFO, "PchCpuStrapSet() - Start\n"));
+
+ RootComplexBar = PCH_RCRB_BASE;
+
+ switch (Operation) {
+ case GetCpuStrapSetData:
+ ///
+ /// Get CPU Strap Settings select. 0 = from descriptor, 1 = from PCH
+ ///
+ if ((MmioRead8 ((UINTN) (RootComplexBar + R_PCH_SPI_SRDC)) & B_PCH_SPI_SRDC_SRDS) == 0) {
+ ///
+ /// Read Strap from Flash Descriptor
+ ///
+ *CpuStrapSet = 0;
+ return EFI_SUCCESS;
+ } else {
+ ///
+ /// Read Strap from PCH Soft Strap.
+ ///
+ *CpuStrapSet = MmioRead16 ((UINTN) (RootComplexBar + R_PCH_SPI_SRD));
+ }
+ break;
+
+ case SetCpuStrapSetData:
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 4.3 Soft Reset Control
+ /// 2. If there are CPU configuration changes, program the strap setting into the
+ /// Soft Reset Data register located at SPIBAR Offset F8h [15:0] (RCBA + Offset 38F8h [15:0])
+ /// and follow the steps outlined in the "CPU Only Reset BIOS Flow" section of the Processor
+ /// BIOS Writer's Guide and skip steps 3 and 4.
+ /// a. Program Soft Reset Data Register SPIBAR + F8h [13:0] (RCBA + 38F8h [13:0])
+ /// (details in Processor BIOS Writer's Guide)
+ /// b. Set RCBA + Offset 38F4h[0] = 1b
+ /// c. Set RCBA + Offset 38F0h[0] = 1b
+ /// d. Skip steps 3 and 4.
+ ///
+ MmioWrite16 ((UINTN) (RootComplexBar + R_PCH_SPI_SRD), *CpuStrapSet);
+ MmioOr8 ((UINTN) (RootComplexBar + R_PCH_SPI_SRDC), B_PCH_SPI_SRDC_SRDS);
+ MmioOr8 ((UINTN) (RootComplexBar + R_PCH_SPI_SRDL), B_PCH_SPI_SRDL_SSL);
+ break;
+
+ case LockCpuStrapSetData:
+ MmioOr8 ((UINTN) (RootComplexBar + R_PCH_SPI_SRDL), B_PCH_SPI_SRDL_SSL);
+ break;
+
+ default:
+ break;
+ }
+
+ DEBUG ((EFI_D_INFO, "PchCpuStrapSet() - End\n"));
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This function may trigger platform reset depending on the current GbE status,
+ the intended GbE enabling, and current ME status. (When ME is enabled, this function
+ may trigger a Global reset.)
+ This function may not return if it triggers an platform reset and the BIOS boot flow
+ restarts.
+ If this function returns EFI_SUCCESS it indicates there is no need for platform
+ reset in this boot, and boot flow continues.
+ If this function returns EFI_DEVICE_ERROR, something error happens.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] PchPlatformPolicyPpi The PCH Platform Policy PPI instance
+
+ @retval EFI_SUCCESS No platform reset action is taken. System can continue boot flow.
+ @retval Others Won't return if platform reset action is taken
+**/
+EFI_STATUS
+EFIAPI
+PchGbeMandatedReset (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PCH_PLATFORM_POLICY_PPI *PchPlatformPolicyPpi
+ )
+{
+ UINT8 RegData8;
+ UINTN PciD25F0RegBase;
+ UINT32 GbEMemBar;
+ UINT32 TempGbEMemBar;
+ UINT16 CmdReg;
+ BOOLEAN ResetRequired;
+ BOOLEAN GbeRegion;
+ PCH_RESET_PPI *PchResetPpi;
+ EFI_STATUS Status;
+ PCH_RESET_TYPE PchResetType;
+
+ PciD25F0RegBase = 0;
+ GbEMemBar = 0;
+ ResetRequired = FALSE;
+
+ ///
+ /// Read the BUC register
+ ///
+ RegData8 = MmioRead8 (PchPlatformPolicyPpi->Rcba + R_PCH_RCRB_BUC);
+
+ GbeRegion = PchIsGbeRegionValid (PchPlatformPolicyPpi->Rcba);
+
+ ///
+ /// If no change of status, just return success
+ ///
+ if (((RegData8 & B_PCH_RCRB_BUC_LAN_DIS) &&
+ !PchPlatformPolicyPpi->GbeConfig->EnableGbe) ||
+ (!(RegData8 & B_PCH_RCRB_BUC_LAN_DIS) &&
+ PchPlatformPolicyPpi->GbeConfig->EnableGbe)) {
+ return EFI_SUCCESS;
+ }
+
+
+ Status = (*PeiServices)->LocatePpi (
+ PeiServices,
+ &gPchResetPpiGuid,
+ 0,
+ NULL,
+ (VOID **)&PchResetPpi
+ );
+
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Before modifying LAN Disable bit, make sure it's not locked.
+ /// If it's locked, issus a GlobalReset to unlock it.
+ ///
+ RegData8 = MmioRead8 (PchPlatformPolicyPpi->Rcba + R_PCH_RCRB_FDSW);
+ if (RegData8 & B_PCH_RCRB_FDSW_FDSWL) {
+ DEBUG ((EFI_D_ERROR, "PchGbeMandatedReset: resetting the board via CF9 to unlock LAN Disable register...\n"));
+ PchResetPpi->Reset (PchResetPpi, GlobalReset);
+ ///
+ /// Shouldn't reach here
+ ///
+ return EFI_SUCCESS;
+ }
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 10.2.1/10.2.2 Enable/Disable the GbE Clock Gating
+ /// Step 3
+ /// Set RCBA + 341Ch[23]
+ /// Done in ConfigureClockGating()
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 10.2 Enabling / Disabling the Internal GbE Controller
+ /// In PCH systems, changing the internal GbE controller from disabled to enabled
+ /// during POST requires a system reset (IO port CF9h = 0Eh) immediately after clearing the LAN disable
+ /// bit in the BUC register, RCBA + 3414[5]. If ME is enabled and the LAN disable bit
+ /// has changed, then system BIOS must set D31:F0:Reg 0ACh[20] prior to issuing a platform reset (IO port CF9h = 0x6 or 0xE).
+ ///
+ /// Therefore, the flow is as below:
+ /// When LAN changes from disabled to enabled
+ /// If ME is not existed, require a power cycle reset.
+ /// If ME is enabled, require a global reset.
+ /// When LAN changes from enabled to disabled
+ /// If ME is not existed, no power cycle reset is required.
+ /// If ME is enabled, and Me is using Gbe (by checking GBEBAR+0x5B54[15]=1), require a global reset.
+ ///
+
+ ///
+ /// Set the BUC register
+ ///
+ if (PchPlatformPolicyPpi->GbeConfig->EnableGbe) {
+ ///
+ /// Change internal Gbe from disabled to enabled
+ ///
+ if (GbeRegion == TRUE) {
+ ResetRequired = TRUE;
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 10.2.1 Enable the Internal GbE Controller
+ /// Step 1
+ /// Set RCBA + 3414h[5] = 0b
+ ///
+ MmioAnd8 (PchPlatformPolicyPpi->Rcba + R_PCH_RCRB_BUC, (UINT8) (~B_PCH_RCRB_BUC_LAN_DIS));
+ }
+ } else {
+ ///
+ /// Change internal Gbe from enabled to disabled
+ ///
+ if (GbeRegion == TRUE) {
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 10.2.2 Disable the Internal GbE Controller
+ /// Step 1a
+ /// If Intel ME enable then detect if it supports GBe. Read FWSM_S[15] bit in MBARA + offset 5B54h register.
+ ///
+ PciD25F0RegBase = MmPciAddress (
+ 0,
+ PchPlatformPolicyPpi->BusNumber,
+ PCI_DEVICE_NUMBER_PCH_LAN,
+ PCI_FUNCTION_NUMBER_PCH_LAN,
+ 0
+ );
+ ///
+ /// Store current value of PCH_LAN_MEM_BASE_A
+ ///
+ TempGbEMemBar = MmioRead32 (PciD25F0RegBase + R_PCH_LAN_MEM_BASE_A);
+ ///
+ /// As PCI enumeration has not been done, set PCH_LAN_MBARB per the platform policy
+ ///
+ MmioWrite32 (PciD25F0RegBase + R_PCH_LAN_MEM_BASE_A, PchPlatformPolicyPpi->PlatformData->TempMemBaseAddr);
+ ///
+ /// Store the setting of R_PCH_LAN_CMD
+ ///
+ CmdReg = MmioRead16 (PciD25F0RegBase + R_PCH_LAN_CMD);
+ ///
+ /// Enable memory space decoding in command register
+ ///
+ MmioOr16 (PciD25F0RegBase + R_PCH_LAN_CMD, (UINT16) B_PCH_LAN_CMD_MSE);
+ ///
+ /// Check if GbE device exists
+ ///
+ GbEMemBar = MmioRead32 (PciD25F0RegBase + R_PCH_LAN_MEM_BASE_A) & B_PCH_LAN_MBARA_BA;
+
+ if (GbEMemBar != 0xFFFFFFFF) {
+ if ((MmioRead16 (GbEMemBar + 0x5B54)) & BIT15) {
+ ResetRequired = TRUE;
+ }
+ }
+ ///
+ /// Restore the setting of R_PCH_LAN_CMD
+ ///
+ MmioWrite16 (PciD25F0RegBase + R_PCH_LAN_CMD, CmdReg);
+ ///
+ /// Restore the value of PCH_LAN_MEM_BASE_A
+ ///
+ MmioWrite32 (PciD25F0RegBase + R_PCH_LAN_MEM_BASE_A, TempGbEMemBar);
+ }
+ ///
+ /// Step 1
+ /// Set RCBA + 3414h[5] = 1b
+ ///
+ MmioOr8 (PchPlatformPolicyPpi->Rcba + R_PCH_RCRB_BUC, (UINT8) B_PCH_RCRB_BUC_LAN_DIS);
+ }
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 10.2.1 & 10.2.2
+ /// Step 2
+ /// Read back for posted write to take effect
+ ///
+ MmioRead8 (PchPlatformPolicyPpi->Rcba + R_PCH_RCRB_BUC);
+
+ if (!ResetRequired) {
+ return EFI_SUCCESS;
+ }
+
+ DEBUG ((EFI_D_ERROR, "PchGbeMandatedReset: resetting the board via CF9...\n"));
+ if ((MmioRead32 (PchPlatformPolicyPpi->Rcba + R_PCH_RCRB_FD2) & B_PCH_RCRB_FD2_MEI1D) == 0) {
+ if (PchPlatformPolicyPpi->PlatformData->EcPresent) {
+ PchResetType = GlobalResetWithEc;
+ } else {
+ PchResetType = GlobalReset;
+ }
+ } else {
+ PchResetType = PowerCycleReset;
+ }
+
+ PchResetPpi->Reset (PchResetPpi, PchResetType);
+ ///
+ /// Shouldn't reach here
+ ///
+ return EFI_SUCCESS;
+}
+
+/**
+ Internal function performing miscellaneous init needed in early PEI phase
+
+ @param[in] PchPlatformPolicyPpi The PCH Platform Policy PPI instance
+
+ @retval EFI_SUCCESS Succeeds.
+ @retval EFI_DEVICE_ERROR Device error, aborts abnormally.
+**/
+EFI_STATUS
+PchMiscInit (
+ IN PCH_PLATFORM_POLICY_PPI *PchPlatformPolicyPpi
+ )
+{
+ EFI_STATUS Status;
+ UINT8 Index;
+ UINTN PciD31F2RegBase;
+ UINTN PciD31F5RegBase;
+ UINTN PciD28F0RegBase;
+ UINTN PciD31F0RegBase;
+ UINT16 LpcDeviceId;
+ PCH_HPET_CONFIG *HpetConfig;
+ UINT16 Data16;
+ UINT32 Data32;
+ UINT32 Data32And;
+ UINT32 Data32Or;
+ UINTN RPBase;
+ BOOLEAN RpSpeedChanged;
+ UINT32 RootComplexBar;
+
+ const USB_CONTROLLER EhciControllersMap[PchEhciControllerMax] = {
+ {
+ PCI_DEVICE_NUMBER_PCH_USB,
+ PCI_FUNCTION_NUMBER_PCH_EHCI
+ },
+ {
+ PCI_DEVICE_NUMBER_PCH_USB_EXT,
+ PCI_FUNCTION_NUMBER_PCH_EHCI2
+ }
+ };
+ PCH_SERIES PchSeries;
+
+ PchSeries = GetPchSeries();
+ PciD31F0RegBase = MmPciAddress (
+ 0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ 0
+ );
+ PciD31F2RegBase = MmPciAddress (
+ 0,
+ PchPlatformPolicyPpi->BusNumber,
+ PCI_DEVICE_NUMBER_PCH_SATA,
+ PCI_FUNCTION_NUMBER_PCH_SATA,
+ 0
+ );
+ PciD31F5RegBase = 0;
+ if (PchSeries == PchH) {
+ PciD31F5RegBase = MmPciAddress (
+ 0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_SATA,
+ PCI_FUNCTION_NUMBER_PCH_SATA2,
+ 0
+ );
+ }
+ PciD28F0RegBase = MmPciAddress (
+ 0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS,
+ PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_1,
+ 0
+ );
+ HpetConfig = PchPlatformPolicyPpi->HpetConfig;
+ ///
+ /// Set B0:D31:F0 + ACh[20] = 0 at early boot
+ ///
+ MmioAnd32 (PciD31F0RegBase + R_PCH_LPC_PMIR, (UINT32)~(B_PCH_LPC_PMIR_CF9GR));
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 8.14 Additional PCI Express* Programming Steps
+ /// NOTE: Detection of Non-Complaint PCI Express Devices in Gen2 Ports
+ /// Some non-graphics PCI Express devices do not follow PCI Express Specification and currently report
+ /// the incorrect Gen capability or link width. This may cause the improper detection of the card
+ /// by the Intel Gen2 PCI Express port.
+ /// The following settings may improve the ability of an Intel Gen2 PCI Express port to detect
+ /// these non-compliant PCI Express devices.
+ /// If BIOS cannot detect or train the device: Set B0:D28:F0~F7 + 70h [3:0]= 1h
+ /// Wait 100 ms for link to train up
+ /// Please note the above setting is "as-is" as Intel cannot verify all non-compliant devices.
+ /// You need to ensure that the workaround works with devices you are planning to use.
+ ///
+ RpSpeedChanged = FALSE;
+ for (Index = 0; Index < GetPchMaxPciePortNum (); Index++) {
+ RPBase = MmPciAddress (
+ 0,
+ PchPlatformPolicyPpi->BusNumber,
+ PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS,
+ Index,
+ 0
+ );
+ if (MmioRead16 (RPBase + R_PCH_PCIE_VENDOR_ID) == 0xFFFF) {
+ continue;
+ }
+
+ switch (PchPlatformPolicyPpi->PcieConfig->PcieSpeed[Index]) {
+ case PchPcieGen1:
+ Data16 = BIT0;
+ break;
+ case PchPcieGen2:
+ case PchPcieAuto:
+ default:
+ Data16 = BIT1;
+ break;
+ }
+ if ((MmioRead16 (RPBase + R_PCH_PCIE_LCTL2) & (UINT16) (B_PCH_PCIE_LCTL2_TLS)) != Data16) {
+ MmioAndThenOr16 (RPBase + R_PCH_PCIE_LCTL2, (UINT16)~(B_PCH_PCIE_LCTL2_TLS), Data16);
+ RpSpeedChanged = TRUE;
+ }
+ }
+ //
+ // Merge all delay for change link speed of RPs together to reduce the delay time.
+ //
+ if (RpSpeedChanged) {
+ PchPmTimerStall (100 * 1000);
+ }
+
+ for (Index = 0; Index < GetPchMaxPciePortNum (); Index++) {
+ RPBase = MmPciAddress (
+ 0,
+ PchPlatformPolicyPpi->BusNumber,
+ PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS,
+ Index,
+ 0
+ );
+ if (MmioRead16 (RPBase + R_PCH_PCIE_VENDOR_ID) == 0xFFFF) {
+ continue;
+ }
+ ///
+ /// PCH BIOS Spec Rev 0.5.0 Section 8.2
+ /// Else if the port is hot-plug enable, do not disable the port. If BIOS wants to disable the port,
+ /// BIOS should not enable the hot plug capability or must disable the hot plug capability of the port.
+ /// Set B0:D28:Fn + 338h [26] = 0b at early POST.
+ ///
+ MmioAnd32 ((RPBase + 0x338), (UINT32) ~BIT26);
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 8.14 Additional PCI Express* Programming Steps
+ /// Step 1
+ /// Before MRC execution, system BIOS must program the following register.
+ /// B0:D28:F0 + F4h[6:5] = 0b
+ /// B0:D28:F0 + F4h[7] = 1b
+ ///
+ if (Index == 0) {
+ MmioAndThenOr8 ((RPBase + 0xF4), (UINT8) ~(BIT5 | BIT6), BIT7);
+ }
+ }
+
+ for (Index = 0; Index < GetPchEhciMaxControllerNum (); Index++) {
+ ///
+ /// PCH BIOS Spec Rev 0.5.0 Section 7.1.5 Additional PCH DMI Programming Steps
+ /// Step 3.2
+ /// RCBA + Offset 50h[23:20] = 2h and RCBA + Offset 50h[17] = 1b (Done at
+ /// PchDmiTcVcProgPoll() on PchDmiPeim.c)
+ /// and also ensure that D29/D26:F0:88h [2] = 0b
+ ///
+ Data32 = MmioRead32 (
+ (UINTN) MmPciAddress (0,
+ PchPlatformPolicyPpi->BusNumber,
+ EhciControllersMap[Index].Device,
+ EhciControllersMap[Index].Function,
+ 0x88)
+ );
+ Data32 &= (UINT32) (~BIT2);
+ MmioWrite32 (
+ MmPciAddress (0,
+ PchPlatformPolicyPpi->BusNumber,
+ EhciControllersMap[Index].Device,
+ EhciControllersMap[Index].Function,
+ 0x88),
+ Data32
+ );
+ }
+ ///
+ /// Initial and enable HPET High Precision Timer memory address for basic usage
+ ///
+ if (HpetConfig->Enable == PCH_DEVICE_ENABLE) {
+ MmioAndThenOr32 (
+ (UINTN) (PchPlatformPolicyPpi->Rcba + R_PCH_RCRB_HPTC),
+ (UINT32)~B_PCH_RCRB_HPTC_AS,
+ (UINT32) (((HpetConfig->Base >> N_PCH_HPET_ADDR_ASEL) & B_PCH_RCRB_HPTC_AS) | B_PCH_RCRB_HPTC_AE)
+ );
+ ///
+ /// Read back for posted write to take effect
+ ///
+ MmioRead32 (PchPlatformPolicyPpi->Rcba + R_PCH_RCRB_HPTC);
+ ///
+ /// Set HPET Timer enable to start counter spinning
+ ///
+ MmioOr32 (HpetConfig->Base + 0x10, 0x1);
+ }
+
+ if (PchPlatformPolicyPpi->Port80Route == PchReservedPageToLpc) {
+ MmioAnd32 (PchPlatformPolicyPpi->Rcba + R_PCH_RCRB_GCS, (UINT32) (~B_PCH_RCRB_GCS_RPR));
+ } else {
+ MmioOr32 (PchPlatformPolicyPpi->Rcba + R_PCH_RCRB_GCS, (UINT32) B_PCH_RCRB_GCS_RPR);
+ }
+ ///
+ /// Read back for posted write to take effect
+ ///
+ MmioRead32 (PchPlatformPolicyPpi->Rcba + R_PCH_RCRB_GCS);
+
+#ifdef TRAD_FLAG
+ if (PchSeries == PchH) {
+ if (PchPlatformPolicyPpi->SataConfig->SataMode == PchSataModeIde) {
+ ///
+ /// PCH BIOS Spec Rev 0.5.0 section 14.1.7 Additional Programming Requirements during
+ /// Step 13
+ /// When SATA in IDE mode
+ /// a. Program D31:F2:34h [7:0] to 70h
+ ///
+ Data32And = (UINT32) ~(0xFF);
+ Data32Or = (UINT32) (0x70);
+ MmioAndThenOr32 (
+ (UINTN) (PciD31F2RegBase + 0x34),
+ Data32And,
+ Data32Or
+ );
+ ///
+ /// b. Program D31:F2:70h [15:8] to 0h
+ ///
+ Data32And = (UINT32) ~(0xFF00);
+ MmioAnd32 (
+ (UINTN) (PciD31F2RegBase + 0x70),
+ Data32And
+ );
+ ///
+ /// IDE mode, SATA Port 0 - Port 3 are for D31:F2, Port4 and Port 5 are for D31:F5
+ ///
+ MmioAnd8 (
+ PciD31F2RegBase + R_PCH_SATA_MAP,
+ (UINT8)~(B_PCH_SATA_MAP_SMS_MASK | B_PCH_SATA_PORT_TO_CONTROLLER_CFG)
+ );
+ ///
+ /// PCH BIOS Spec Rev 0.5.0 section 14.1.7 Additional Programming Requirements during
+ /// SATA Initialization
+ /// Step 1
+ /// If D28:F0:410h[5:4] = 11b, System BIOS must disable D31:F5 by setting SAD2 bit,
+ /// RCBA + 3418[25]
+ ///
+ if ((MmioRead8 (PciD28F0RegBase + 0x410) & (UINT8) (BIT5 | BIT4)) == (UINT8) (BIT5 | BIT4)) {
+ MmioOr32 (PchPlatformPolicyPpi->Rcba + R_PCH_RCRB_FUNC_DIS, (UINT32) B_PCH_RCRB_FUNC_DIS_SATA2);
+ ///
+ /// Reads back for posted write to take effect
+ ///
+ MmioRead32 (PchPlatformPolicyPpi->Rcba + R_PCH_RCRB_FUNC_DIS);
+ } else {
+ ///
+ /// Enable the SATA port4 and port5.
+ /// Step 1.a
+ /// If D28:F0:410h[4] = 1b, System BIOS should not enable the SATA port4
+ /// Step 1.b
+ /// If D28:F0:410h[5] = 1b, System BIOS should not enable the SATA port5
+ ///
+ if ((MmioRead8 (PciD28F0RegBase + 0x410) & BIT4) == 0) {
+ MmioOr8 (
+ PciD31F5RegBase + R_PCH_SATA_PCS,
+ (UINT8) B_PCH_SATA2_PCS_PORT4_EN
+ );
+ }
+ if ((MmioRead8 (PciD28F0RegBase + 0x410) & BIT5) == 0) {
+ MmioOr8 (
+ PciD31F5RegBase + R_PCH_SATA_PCS,
+ (UINT8) B_PCH_SATA2_PCS_PORT5_EN
+ );
+ }
+ }
+ } else {
+ MmioOr32 (PchPlatformPolicyPpi->Rcba + R_PCH_RCRB_FUNC_DIS, (UINT32) B_PCH_RCRB_FUNC_DIS_SATA2);
+ ///
+ /// Reads back for posted write to take effect
+ ///
+ MmioRead32 (PchPlatformPolicyPpi->Rcba + R_PCH_RCRB_FUNC_DIS);
+ }
+ }
+#endif //TRAD_FLAG
+#ifdef ULT_FLAG
+ if (PchSeries == PchLp) {
+ if (PchPlatformPolicyPpi->SataConfig->SataMode == PchSataModeLoopbackTest) {
+ ///
+ /// Set D31:F2:90h[7:6] to 00b
+ ///
+ MmioAnd8 (
+ PciD31F2RegBase + R_PCH_SATA_MAP,
+ (UINT8)~(B_PCH_SATA_MAP_SMS_MASK)
+ );
+ ///
+ /// Set D31:F2 + SIR Index 00h[15] = 1b
+ ///
+ MmioWrite8 (PciD31F2RegBase + R_PCH_SATA_SIRI, 0x00);
+ Data32And = 0xFFFF7FFF;
+ Data32Or = 0x00008000;
+ MmioAndThenOr32 (
+ (UINTN) (PciD31F2RegBase + R_PCH_SATA_STRD),
+ Data32And,
+ Data32Or
+ );
+ }
+ }
+#endif // ULT_FLAG
+ if (PchPlatformPolicyPpi->SataConfig->SataMode == PchSataModeRaid) {
+ LpcDeviceId = MmioRead16 (PciD31F0RegBase + R_PCH_LPC_DEVICE_ID);
+ if (IS_PCH_LPT_RAID_AVAILABLE (LpcDeviceId)) {
+ MmioAndThenOr8 (
+ PciD31F2RegBase + R_PCH_SATA_MAP,
+ (UINT8) (~B_PCH_SATA_MAP_SMS_MASK),
+ (UINT8) (V_PCH_SATA_MAP_SMS_RAID)
+ );
+ } else {
+ DEBUG ((EFI_D_INFO, "PCH Device ID : 0x%x\n", LpcDeviceId));
+ DEBUG ((EFI_D_ERROR, "This SKU doesn't support RAID feature. Set to AHCI mode.\n"));
+ }
+ }
+
+ //
+ // The following three ICC isCLK settings must be done for S3/S4/S5 before ICC HW is locked.
+ // For S3 path, the ICC HW is locked just after DID message. So program those in PEI.
+ //
+ if (PchSeries == PchLp) {
+ RootComplexBar = PchPlatformPolicyPpi->Rcba;
+ ///
+ /// Set the isCLK PLL lock speed in the ICC HW.
+ /// Set bits 13:12 and bits 10:8, clear bit 11, fast lock time = 11us
+ /// NOTE: Lock occurs after EOP message sent, and this write will fail until core well reset. On write failure
+ /// expectation is that the register was previously programmed and values are maintained in HW registers.
+ ///
+ Status = ProgramIobp(RootComplexBar, 0xED00015C, (UINT32)~(BIT11), (BIT13|BIT12|BIT10|BIT9|BIT8));
+
+ ///
+ /// Set the isCLK freeze timer in the ICC HW.
+ /// Set bits 23:22, Clk timer = 1 clk
+ /// NOTE: Lock occurs after EOP message sent, and this write will fail until core well reset. On write failure
+ /// expectation is that the register was previously programmed and values are maintained in HW registers.
+ ///
+ Status = ProgramIobp(RootComplexBar, 0xED000118, (UINT32)0xFFFFFFFF, (UINT32) (BIT23|BIT22));
+
+ ///
+ /// Set bit 21 and 18, expand Vcont Window
+ ///
+ Status = ProgramIobp(RootComplexBar, 0xED000120, (UINT32)0xFFFFFFFF, (UINT32) (BIT21|BIT18));
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Perform Thermal Management Support initialization
+
+ @param[in] PchPlatformPolicyPpi The PCH Platform Policy PPI instance
+
+ @retval EFI_SUCCESS Succeeds.
+ @retval EFI_DEVICE_ERROR Device error, aborts abnormally.
+**/
+EFI_STATUS
+PchThermalInit (
+ IN PCH_PLATFORM_POLICY_PPI *PchPlatformPolicyPpi
+ )
+{
+ UINTN PciD31F6RegBase;
+ UINTN PciD0F0RegBase;
+ UINT32 ThermalBaseB;
+ PCH_MEMORY_THROTTLING *MemoryThrottling;
+ UINT32 Data32And;
+ UINT32 Data32Or;
+ UINT32 Softstrap15;
+
+ PciD31F6RegBase = MmPciAddress (
+ 0,
+ PchPlatformPolicyPpi->BusNumber,
+ PCI_DEVICE_NUMBER_PCH_THERMAL,
+ PCI_FUNCTION_NUMBER_PCH_THERMAL,
+ 0
+ );
+ PciD0F0RegBase = MmPciAddress (0, 0, 0, 0, 0);
+
+ MemoryThrottling = PchPlatformPolicyPpi->ThermalMgmt->MemoryThrottling;
+ ThermalBaseB = PchPlatformPolicyPpi->PlatformData->TempMemBaseAddr;
+
+ ///
+ /// D31:F6:Reg 44h[31:0], with a 64-bit BAR for BIOS.
+ /// Enable the BAR by setting the SPTYPEN bit, D31:F6:Reg 40h[0].
+ ///
+ MmioWrite32 (PciD31F6RegBase + R_PCH_THERMAL_TBARB, ThermalBaseB);
+ MmioWrite32 (PciD31F6RegBase + R_PCH_THERMAL_TBARBH, 0);
+ MmioOr32 (PciD31F6RegBase + R_PCH_THERMAL_TBARB, (UINT32) B_PCH_THERMAL_SPTYPEN);
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, 17.2 Thermal Subsystem Device Initialization
+ /// The System BIOS must perform the following steps to initialize the PCH thermal subsystem device, D31:F6.
+ /// Step 1
+ /// Enable Thermal Subsystem device by making sure FD.TTD is cleared.
+ /// The default value of FD.TTD is cleared.
+ ///
+ /// Step 2
+ /// Optionally program Device 31 Interrupt Pin/Route registers
+ /// Left this to platform code
+ ///
+ /// Step 3
+ /// Go through general PCI enumeration and assign standard PCI resource, including TBARB, TBARBH, etc.
+ /// Left this to platform code
+ ///
+ /// Step 4
+ /// Initialize relevant Thermal subsystems for the desired features.
+ ///
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 17.3.1 Initializing Lynx Point Thermal Sensors
+ /// Step 1
+ /// Set various trip points based on the particular usage model. Note that Cat Trip must always be programmed.
+ /// - CTT must be programmed for Cat Trip, CTT must never be changed while the TS enable is set.
+ /// This rule prevents a spurious trip from occurring and causing a system shutdown.
+ /// TSC must then be written to 0x81 to enable the power down and lock the register.
+ /// TSC programming is done in PchPm.c ThermalLockDown()
+ /// - TAHV and TAHL may be programmed if the BIOS or driver wish to force a SW notification for PCH temperature
+ /// - If TAHL/TAHV programmed much later in the flow when a driver is loaded, this means that the TS had been
+ /// enabled long before this, the thermal sensor must be disabled when TAHL/TAHV are programmed, and then
+ /// re-enabled.
+ /// - TSPIEN or TSGPEN may be programmed to cause either an interrupt or SMI/SCI.
+ /// - It is recommended that TAHV, TALV, TSPIEN and TSGPEN be left at their default value, unless there is a
+ /// specific usage that requires these to be programmed.
+ ///
+ if (GetPchSeries() == PchLp) {
+ MmioWrite16 (ThermalBaseB + R_PCH_TBARB_CTT, V_PCH_TBARB_CTT_LPTLP);
+ } else {
+ MmioWrite16 (ThermalBaseB + R_PCH_TBARB_CTT, V_PCH_TBARB_CTT_LPTH);
+ }
+
+ ///
+ /// Step 2
+ /// Clear trip status from TSS/TAS. BIOS should write 0xFF to clear any bit that was inadvertently set while programming
+ /// the TS. This write of 0xFF should be done before continuing to the next steps.
+ ///
+ MmioWrite8 (ThermalBaseB + R_PCH_TBARB_TSS, 0xFF);
+ MmioWrite8 (ThermalBaseB + R_PCH_TBARB_TAS, 0xFF);
+
+ ///
+ /// Step 3
+ /// Enable the desired thermal trip alert methods, i.e. GPE (TSGPEN), SMI (TSMIC) or Interrupt (TSPIEN).
+ /// Only one of the methods should be enabled and the method will be depending on the platform implementation.
+ /// - TSGPEN: BIOS should leave this as default 00h, unless it is required to enable GPE.
+ /// - TSMIC: BIOS should leave TSMIC[7:0] as default 00h, unless the SMI handler is loaded
+ /// and it's safe to enable SMI for these events.
+ /// - TSPIEN: BIOS should leave this as default 0x00, so that a driver can enable later
+ ///
+ MmioWrite8 (ThermalBaseB + R_PCH_TBARB_TSGPEN, 0x00);
+ MmioWrite8 (ThermalBaseB + R_PCH_TBARB_TSPIEN, 0x00);
+
+ ///
+ /// If PCHSTRP15[14] is 1, PMC will set up SML1 for temp reporting to an EC
+ ///
+ MmioAndThenOr32 (
+ PCH_RCRB_BASE + R_PCH_SPI_FDOC,
+ (UINT32) (~(B_PCH_SPI_FDOC_FDSS_MASK | B_PCH_SPI_FDOC_FDSI_MASK)),
+ (UINT32) (V_PCH_SPI_FDOC_FDSS_PCHS | R_PCH_SPI_STRP15)
+ );
+
+ Softstrap15 = MmioRead32 (PCH_RCRB_BASE + R_PCH_SPI_FDOD);
+
+ if ((Softstrap15 & R_PCH_SPI_STRP15_SML1_THRMSEL) != 0) {
+ ///
+ /// Step 4
+ /// If thermal reporting to an EC over SMBus is supported, then write 0x01 to TSREL, else leave at default.
+ ///
+ MmioWrite8 (ThermalBaseB + R_PCH_TBARB_TSREL, 0x01);
+ }
+
+ ///
+ /// Step 5
+ /// If the PCH_Hot pin reporting is supported, then write the temperature value and set the enable in PHL.
+ /// Done in PchPm.c ThermalLockDown()
+ ///
+ /// Step 6
+ /// If thermal throttling is supported, then set the desired values in TL.
+ /// Done in PchPm.c ThermalLockDown()
+ ///
+ /// Step 7
+ /// Enable thermal sensor by programming TSEL register to 0x01.
+ /// Done in PchPm.c ThermalLockDown()
+ ///
+ /// Step 8
+ /// Lock down the thermal reporting to prevent outside agents from changing the values
+ /// Done in PchPm.c ThermalLockDown()
+ ///
+
+ ///
+ /// Clear BAR and disable access
+ ///
+ MmioAnd32 ((UINTN) (PciD31F6RegBase + R_PCH_THERMAL_TBARB), (UINT32)~B_PCH_THERMAL_SPTYPEN);
+ MmioWrite32 ((UINTN) (PciD31F6RegBase + R_PCH_THERMAL_TBARB), 0);
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 17.5.1 Memory Bandwidth Throttling
+ /// If the platform supports an external memory thermal sensor (TS-on-DIMM or TS-on-Board),
+ /// system BIOS needs to program the registers bellow.
+ /// Here are the settings used in the Intel CRB:
+ /// 1. Program RCBA + 33D4h [31:28] = 1100b, for GPIO_D and GPIO_C to PM_SYNC Enable
+ /// 2. Program RCBA + 33D4h [15:12] = 1100b, for GPIO_D and GPIO_C C0 Transmit Enable.
+ /// 3. Program RCBA + 33C8h [11:8] = 0100b to select GPIO 4 to GPIO_C (EXTTS#0) and
+ /// GPIO 5 to GPIO_D (EXTTS#1)
+ /// GPIOBASE + 00h [5:4] = 11b (Done in platform code)
+ ///
+ if (MemoryThrottling->Enable == PCH_DEVICE_ENABLE) {
+ Data32And = 0x0FFF0FFF;
+ Data32Or = 0;
+ if (MemoryThrottling->TsGpioPinSetting[TsGpioC].PmsyncEnable == PCH_DEVICE_ENABLE) {
+ Data32Or |= BIT30;
+ }
+
+ if (MemoryThrottling->TsGpioPinSetting[TsGpioD].PmsyncEnable == PCH_DEVICE_ENABLE) {
+ Data32Or |= BIT31;
+ }
+
+ if (MemoryThrottling->TsGpioPinSetting[TsGpioC].C0TransmitEnable == PCH_DEVICE_ENABLE) {
+ Data32Or |= BIT14;
+ }
+
+ if (MemoryThrottling->TsGpioPinSetting[TsGpioD].C0TransmitEnable == PCH_DEVICE_ENABLE) {
+ Data32Or |= BIT15;
+ }
+
+ MmioAndThenOr32 (
+ PchPlatformPolicyPpi->Rcba + R_PCH_RCRB_CIR33D4,
+ Data32And,
+ Data32Or
+ );
+
+ Data32And = 0xFFFFF0FF;
+ Data32Or = 0;
+ if (MemoryThrottling->TsGpioPinSetting[TsGpioC].PinSelection == 1) {
+ Data32Or |= B_PCH_RCRB_PMSYNC_GPIO_C_SEL;
+ }
+
+ if (MemoryThrottling->TsGpioPinSetting[TsGpioD].PinSelection == 1) {
+ Data32Or |= B_PCH_RCRB_PMSYNC_GPIO_D_SEL;
+ }
+
+ MmioAndThenOr32 (
+ PchPlatformPolicyPpi->Rcba + R_PCH_RCRB_PMSYNC,
+ Data32And,
+ Data32Or
+ );
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Initialize IOAPIC according to IoApicConfig policy of the PCH
+ Platform Policy PPI
+
+ @param[in] PchPlatformPolicyPpi The PCH Platform Policy PPI instance
+
+ @retval EFI_SUCCESS Succeeds.
+ @retval EFI_DEVICE_ERROR Device error, aborts abnormally.
+**/
+EFI_STATUS
+PchIoApicInit (
+ IN PCH_PLATFORM_POLICY_PPI *PchPlatformPolicyPpi
+ )
+{
+ UINT32 RootComplexBar;
+ PCH_IOAPIC_CONFIG *IoApicConfig;
+ UINT32 IoApicAddress;
+ UINT32 IoApicId;
+
+ RootComplexBar = PchPlatformPolicyPpi->Rcba;
+ IoApicConfig = PchPlatformPolicyPpi->IoApicConfig;
+
+ if (IoApicConfig->ApicRangeSelect != MmioRead8 (RootComplexBar + R_PCH_RCRB_OIC)) {
+ ///
+ /// Program APIC Range Select bits that define address bits 19:12 for the IOxAPIC range.
+ /// This value must not be changed unless the IOxAPIC Enable bit is cleared.
+ ///
+ MmioAnd16 ((UINTN) (RootComplexBar + R_PCH_RCRB_OIC), (UINT16)~(B_PCH_RCRB_OIC_AEN));
+ ///
+ /// Program APIC Range Select bits at RCBA + 31FEh[7:0]
+ ///
+ MmioAndThenOr16 (
+ RootComplexBar + R_PCH_RCRB_OIC,
+ (UINT16)~(V_PCH_RCRB_OIC_ASEL),
+ (UINT16) IoApicConfig->ApicRangeSelect
+ );
+ }
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 6.6.2.1
+ /// 1. Enable the IOAPIC by setting the APIC Enable bit, RCBA + offset 31FFh, Bit[0] if the
+ /// system needs to use the IOxAPIC. The APIC Enable bits needs read back after the bit is written.
+ ///
+ MmioOr16 ((UINTN) (RootComplexBar + R_PCH_RCRB_OIC), (UINT16) B_PCH_RCRB_OIC_AEN);
+ ///
+ /// Reads back for posted write to take effect
+ ///
+ MmioRead16 (RootComplexBar + R_PCH_RCRB_OIC);
+
+ ///
+ /// Get current IO APIC ID
+ ///
+ IoApicAddress = (UINT32) (MmioRead8 (RootComplexBar + R_PCH_RCRB_OIC) << N_PCH_IO_APIC_ASEL);
+ MmioWrite8 ((UINTN) (R_PCH_IO_APIC_INDEX | IoApicAddress), 0);
+ IoApicId = MmioRead32 ((UINTN) (R_PCH_IO_APIC_DATA | IoApicAddress)) >> 24;
+ ///
+ /// IO APIC ID is at APIC Identification Register [27:24]
+ ///
+ if ((IoApicConfig->IoApicId != IoApicId) && (IoApicConfig->IoApicId < 0x10)) {
+ ///
+ /// Program APIC ID
+ ///
+ MmioWrite8 ((UINTN) (R_PCH_IO_APIC_INDEX | IoApicAddress), 0);
+ MmioWrite32 ((UINTN) (R_PCH_IO_APIC_DATA | IoApicAddress), (UINT32) (IoApicConfig->IoApicId << 24));
+ }
+
+ if (GetPchSeries() == PchLp) {
+ if (IoApicConfig->IoApicEntry24_39 == PCH_DEVICE_DISABLE) {
+ ///
+ /// Program IOAPIC Entry 24-39 Disable bit at RCBA + 31FEh[11]
+ ///
+ MmioOr16 (RootComplexBar + R_PCH_RCRB_OIC, (UINT16) B_PCH_RCRB_OIC_OA24_39_D);
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This function performs basic initialization for PCH in PEI phase.
+ If any of the base address arguments is zero, this function will disable the corresponding
+ decoding, otherwise this function will enable the decoding.
+ This function locks down the PMBase.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] NotifyDescriptor The notification structure this PEIM registered on install.
+ @param[in] Ppi The memory discovered PPI. Not used.
+
+ @retval EFI_SUCCESS Succeeds.
+ @retval EFI_DEVICE_ERROR Device error, aborts abnormally.
+**/
+EFI_STATUS
+EFIAPI
+PchInitialize (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
+ IN VOID *Ppi
+ )
+{
+ EFI_STATUS Status;
+ UINT8 Data8Or;
+ UINT8 Data8And;
+ PCH_PLATFORM_POLICY_PPI *PchPlatformPolicyPpi;
+#ifdef EFI_DEBUG
+ UINT8 Index;
+#endif
+#ifdef USB_PRECONDITION_ENABLE_FLAG
+ EFI_BOOT_MODE BootMode;
+#endif // USB_PRECONDITION_ENABLE_FLAG
+ UINTN AcpiBarAddress;
+ UINTN GpioBarAddress;
+
+ DEBUG ((EFI_D_INFO, "PchInitialize() - Start\n"));
+
+ ///
+ /// Get platform policy settings through the PchPlatformPolicy PPI
+ ///
+ Status = (**PeiServices).LocatePpi (
+ PeiServices,
+ &gPchPlatformPolicyPpiGuid,
+ 0,
+ NULL,
+ (VOID **)&PchPlatformPolicyPpi
+ );
+ ASSERT_EFI_ERROR (Status);
+#ifdef EFI_DEBUG
+ DEBUG ((EFI_D_INFO, "\n------------------------ PchPlatformPolicyPpi Dump Begin -----------------\n"));
+ DEBUG ((EFI_D_INFO, "Revision : 0x%x\n", PchPlatformPolicyPpi->Revision));
+ DEBUG ((EFI_D_INFO, "BusNumber : 0x%x\n", PchPlatformPolicyPpi->BusNumber));
+ DEBUG ((EFI_D_INFO, "Rcba : 0x%x\n", PchPlatformPolicyPpi->Rcba));
+ DEBUG ((EFI_D_INFO, "PmBase : 0x%x\n", PchPlatformPolicyPpi->PmBase));
+ DEBUG ((EFI_D_INFO, "GpioBase : 0x%x\n", PchPlatformPolicyPpi->GpioBase));
+
+ DEBUG ((EFI_D_INFO, "PCH GBE Configuration --- \n"));
+ DEBUG ((EFI_D_INFO, " EnableGbe : 0x%x\n", PchPlatformPolicyPpi->GbeConfig->EnableGbe));
+
+ DEBUG ((EFI_D_INFO, "\n------------------------ PCH THERMAL Configuration -----------------\n"));
+ DEBUG ((EFI_D_INFO, "PCH MEMORY THERMAL MANAGEMENT --- \n"));
+ DEBUG (
+ (EFI_D_INFO,
+ "MemoryThrottling->Enable : 0x%x\n",
+ PchPlatformPolicyPpi->ThermalMgmt->MemoryThrottling->Enable)
+ );
+ DEBUG (
+ (EFI_D_INFO,
+ "MemoryThrottling->TsGpioPinSetting[TsGpioC].PmsyncEnable : 0x%x\n",
+ PchPlatformPolicyPpi->ThermalMgmt->MemoryThrottling->TsGpioPinSetting[TsGpioC].PmsyncEnable)
+ );
+ DEBUG (
+ (EFI_D_INFO,
+ "MemoryThrottling->TsGpioPinSetting[TsGpioD].PmsyncEnable : 0x%x\n",
+ PchPlatformPolicyPpi->ThermalMgmt->MemoryThrottling->TsGpioPinSetting[TsGpioD].PmsyncEnable)
+ );
+ DEBUG (
+ (EFI_D_INFO,
+ "MemoryThrottling->TsGpioPinSetting[TsGpioC].C0TransmitEnable : 0x%x\n",
+ PchPlatformPolicyPpi->ThermalMgmt->MemoryThrottling->TsGpioPinSetting[TsGpioC].C0TransmitEnable)
+ );
+ DEBUG (
+ (EFI_D_INFO,
+ "MemoryThrottling->TsGpioPinSetting[TsGpioD].C0TransmitEnable : 0x%x\n",
+ PchPlatformPolicyPpi->ThermalMgmt->MemoryThrottling->TsGpioPinSetting[TsGpioD].C0TransmitEnable)
+ );
+ DEBUG (
+ (EFI_D_INFO,
+ "MemoryThrottling->TsGpioPinSetting[TsGpioC].PinSelection : 0x%x\n",
+ PchPlatformPolicyPpi->ThermalMgmt->MemoryThrottling->TsGpioPinSetting[TsGpioC].PinSelection)
+ );
+ DEBUG (
+ (EFI_D_INFO,
+ "MemoryThrottling->TsGpioPinSetting[TsGpioD].PinSelection : 0x%x\n",
+ PchPlatformPolicyPpi->ThermalMgmt->MemoryThrottling->TsGpioPinSetting[TsGpioD].PinSelection)
+ );
+
+ DEBUG ((EFI_D_INFO, "PCH HPET Configuration --- \n"));
+ DEBUG ((EFI_D_INFO, " Enable : 0x%x\n", PchPlatformPolicyPpi->HpetConfig->Enable));
+ DEBUG ((EFI_D_INFO, " Base : 0x%x\n", PchPlatformPolicyPpi->HpetConfig->Base));
+
+ DEBUG ((EFI_D_INFO, "PCH RESERVED PAGE ROUTE --- \n"));
+ if (PchPlatformPolicyPpi->Port80Route == PchReservedPageToLpc) {
+ DEBUG ((EFI_D_INFO, " Port80Route : PchReservedPageToLpc\n"));
+ } else if (PchPlatformPolicyPpi->Port80Route == PchReservedPageToPcie) {
+ DEBUG ((EFI_D_INFO, " Port80Route : PchReservedPageToPciE\n"));
+ }
+
+ DEBUG ((EFI_D_INFO, "PCH SATA Mode --- \nSataMode : "));
+ switch (PchPlatformPolicyPpi->SataConfig->SataMode) {
+ case PchSataModeIde:
+ DEBUG ((EFI_D_INFO, "PchSataModeIde"));
+ break;
+ case PchSataModeAhci:
+ DEBUG ((EFI_D_INFO, "PchSataModeAhci"));
+ break;
+ case PchSataModeRaid:
+ DEBUG ((EFI_D_INFO, "PchSataModeRaid"));
+ break;
+ case PchSataModeLoopbackTest:
+ DEBUG ((EFI_D_INFO, "PchSataModeLoopbackTest"));
+ break;
+ default:
+ break;
+ }
+
+ DEBUG ((EFI_D_INFO, "\nPCH IO APIC Configuration --- \n"));
+ DEBUG ((EFI_D_INFO, " IoApicId : 0x%x\n", PchPlatformPolicyPpi->IoApicConfig->IoApicId));
+ DEBUG ((EFI_D_INFO, " ApicRangeSelect : 0x%x\n", PchPlatformPolicyPpi->IoApicConfig->ApicRangeSelect));
+
+ DEBUG ((EFI_D_INFO, "PCH PCIE Speed--- \n"));
+ for (Index = 0; Index < GetPchMaxPciePortNum (); Index++) {
+ if (PchPlatformPolicyPpi->PcieConfig->PcieSpeed[Index] == PchPcieGen1) {
+ DEBUG ((EFI_D_INFO, " PCIE Port %x Speed: PchPcieGen1\n", Index));
+ } else if (PchPlatformPolicyPpi->PcieConfig->PcieSpeed[Index] == PchPcieGen2) {
+ DEBUG ((EFI_D_INFO, " PCIE Port %x Speed: PchPcieGen2\n", Index));
+ } else if (PchPlatformPolicyPpi->PcieConfig->PcieSpeed[Index] == PchPcieAuto) {
+ DEBUG ((EFI_D_INFO, " PCIE Port %x Speed: PchPcieAuto\n", Index));
+ }
+ }
+
+ DEBUG ((EFI_D_INFO, "Platform Data Configuration --- \n"));
+ DEBUG ((EFI_D_INFO, " EcPresent : %x\n", PchPlatformPolicyPpi->PlatformData->EcPresent));
+ DEBUG ((EFI_D_INFO, " SmmBwp : %x\n", PchPlatformPolicyPpi->PlatformData->SmmBwp));
+
+ DEBUG ((EFI_D_INFO, "\n------------------------ PchPlatformPolicyPpi Dump End -----------------\n"));
+#endif
+ ///
+ /// Set Rcba
+ ///
+ ASSERT ((PchPlatformPolicyPpi->Rcba & (UINT32) (~B_PCH_LPC_RCBA_BAR)) == 0);
+ MmioAndThenOr32 (
+ MmPciAddress (0,
+ PchPlatformPolicyPpi->BusNumber,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_RCBA),
+ (UINT32) (~B_PCH_LPC_RCBA_BAR),
+ PchPlatformPolicyPpi->Rcba | B_PCH_LPC_RCBA_EN
+ );
+
+ ///
+ /// Set PM Base
+ ///
+ AcpiBarAddress = MmPciAddress (0,
+ PchPlatformPolicyPpi->BusNumber,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_ACPI_BASE
+ );
+ MmioWrite32 (AcpiBarAddress, PchPlatformPolicyPpi->PmBase);
+ ASSERT ((MmioRead32 (AcpiBarAddress) & B_PCH_LPC_ACPI_BASE_BAR) == PchPlatformPolicyPpi->PmBase);
+ if (PchPlatformPolicyPpi->PmBase != 0) {
+ ///
+ /// Enable PM Base
+ ///
+ MmioOr8 (
+ MmPciAddress (0,
+ PchPlatformPolicyPpi->BusNumber,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_ACPI_CNT),
+ (UINT8) B_PCH_LPC_ACPI_CNT_ACPI_EN
+ );
+ } else {
+ ///
+ /// Disable PM Base
+ ///
+ MmioAnd8 (
+ MmPciAddress (0,
+ PchPlatformPolicyPpi->BusNumber,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_ACPI_CNT),
+ (UINT8) (~B_PCH_LPC_ACPI_CNT_ACPI_EN)
+ );
+ }
+ ///
+ /// Lock down the PM Base
+ ///
+ MmioOr8 (
+ MmPciAddress (0,
+ PchPlatformPolicyPpi->BusNumber,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_GEN_PMCON_LOCK),
+ (UINT8) (B_PCH_LPC_GEN_PMCON_LOCK_ABASE_LK)
+ );
+
+ ///
+ /// Set GPIO Base
+ ///
+ GpioBarAddress = MmPciAddress (0,
+ PchPlatformPolicyPpi->BusNumber,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_GPIO_BASE
+ );
+ MmioWrite32 (GpioBarAddress, PchPlatformPolicyPpi->GpioBase);
+ ASSERT ((MmioRead32 (GpioBarAddress) & B_PCH_LPC_GPIO_BASE_BAR) == PchPlatformPolicyPpi->GpioBase);
+ if (PchPlatformPolicyPpi->GpioBase != 0) {
+ ///
+ /// Enable GPIO Base
+ ///
+ MmioOr8 (
+ MmPciAddress (0,
+ PchPlatformPolicyPpi->BusNumber,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_GPIO_CNT),
+ (UINT8) B_PCH_LPC_GPIO_CNT_GPIO_EN
+ );
+ } else {
+ ///
+ /// Disable GPIO Base
+ ///
+ MmioAnd8 (
+ MmPciAddress (0,
+ PchPlatformPolicyPpi->BusNumber,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_GPIO_CNT),
+ (UINT8) (~B_PCH_LPC_GPIO_CNT_GPIO_EN)
+ );
+ }
+
+ if (PchPlatformPolicyPpi->PlatformData->SmmBwp == 0) {
+ ///
+ /// Clear SMM_BWP bit (D31:F0:RegDCh[5])
+ ///
+ Data8And = (UINT8) ~B_PCH_LPC_BIOS_CNTL_SMM_BWP;
+ Data8Or = 0x00;
+ } else {
+ ///
+ /// Set SMM_BWP and BLE bit (D31:F0:RegDCh[5][1])
+ ///
+ Data8And = 0xFF;
+ Data8Or = (UINT8) (B_PCH_LPC_BIOS_CNTL_SMM_BWP + B_PCH_LPC_BIOS_CNTL_BLE);
+ }
+
+ MmioAndThenOr8 (
+ MmPciAddress (0,
+ PchPlatformPolicyPpi->BusNumber,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_BIOS_CNTL),
+ Data8And,
+ Data8Or
+ );
+
+ Status = PchSataInit (PeiServices, PchPlatformPolicyPpi);
+ ASSERT_EFI_ERROR (Status);
+
+ Status = PchDmiMiscProg (PeiServices, PchPlatformPolicyPpi);
+ ASSERT_EFI_ERROR (Status);
+
+ Status = PchGbeMandatedReset (PeiServices, PchPlatformPolicyPpi);
+ ASSERT_EFI_ERROR (Status);
+
+ Status = PchMiscInit (PchPlatformPolicyPpi);
+ ASSERT_EFI_ERROR (Status);
+ Status = PchThermalInit (PchPlatformPolicyPpi);
+ ASSERT_EFI_ERROR (Status);
+ Status = PchIoApicInit (PchPlatformPolicyPpi);
+ ASSERT_EFI_ERROR (Status);
+
+#ifdef USB_PRECONDITION_ENABLE_FLAG
+ if (PchPlatformPolicyPpi->Revision > PCH_PLATFORM_POLICY_PPI_REVISION_1) {
+ ///
+ /// If it is in S3 boot path or recovery mode, do nothing
+ ///
+ Status = (*PeiServices)->GetBootMode (PeiServices, &BootMode);
+ if (!EFI_ERROR (Status)) {
+ if ((BootMode != BOOT_ON_S3_RESUME) && (BootMode != BOOT_IN_RECOVERY_MODE)) {
+ if (PchPlatformPolicyPpi->UsbConfig->UsbPrecondition) {
+
+ ///
+ /// Initialize PCH USB when USB_PRECONDITION feature is enabled by USB_CONFIG policy
+ /// Initialize PCH EHCI and XHCI by the same MMIO resource one by one
+ ///
+ Status = PchStartUsbInit (
+ PchPlatformPolicyPpi->UsbConfig,
+ PchPlatformPolicyPpi->PlatformData->TempMemBaseAddr,
+ PchPlatformPolicyPpi->PlatformData->TempMemBaseAddr,
+ PchPlatformPolicyPpi->Revision
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
+ }
+ }
+ }
+#endif // USB_PRECONDITION_ENABLE_FLAG
+ DEBUG ((EFI_D_INFO, "PchInitialize() - End\n"));
+
+ ///
+ /// Install the PCH PEI Init Done PPI
+ ///
+ Status = (**PeiServices).InstallPpi (PeiServices, &mPpiPchPeiInitDone);
+ ASSERT_EFI_ERROR (Status);
+
+ return Status;
+}
+
+/**
+ Internal function performing miscellaneous init needed in very early PEI phase
+
+ @param[in] RootComplexBar RootComplexBar address of this PCH device
+
+ @retval None
+**/
+VOID
+PchMiscEarlyInit (
+ IN UINT32 RootComplexBar
+ )
+{
+ UINTN PciD31F0RegBase;
+ UINT8 Nmi;
+ UINT8 Data8;
+ UINT32 Data32Or;
+
+ DEBUG ((EFI_D_INFO, "PchMiscEarlyInit() - Start\n"));
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 7.1.3 PCH Display Port Enable
+ /// Step 1
+ /// Set RCBA + 3424h = 0010h
+ ///
+ MmioWrite16 ((UINTN) (RootComplexBar + R_PCH_RCRB_DISPBDF), (UINT16) 0x10);
+
+ ///
+ /// Step 2
+ /// Set RCBA + 3428h[0] = 1b
+ ///
+ Data32Or = B_PCH_RCRB_FD2_DBDFEN;
+ MmioOr32 ((UINTN) (RootComplexBar + R_PCH_RCRB_FD2), Data32Or);
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 19.3 Power Failure Considerations
+ /// RTC_PWR_STS bit, GEN_PMCON_3 (D31:F0:A4h[2])
+ /// When the RTC_PWR_STS bit is set, it indicates that the RTCRST# signal went low.
+ /// Software should clear this bit. For example, changing the RTC battery sets this bit.
+ /// System BIOS should reset CMOS to default values if the RTC_PWR_STS bit is set.
+ /// The System BIOS should execute the sequence below if the RTC_PWR_STS bit is set
+ /// before memory initialization. This will ensure that the RTC state machine has been
+ /// initialized.
+ /// 1. If the RTC_PWR_STS bit is set which indicates a new coin-cell battery insertion or a
+ /// battery failure, steps 2 through 5 should be executed.
+ /// 2. Set RTC Register 0Ah[6:4] to 110b or 111b
+ /// 3. Set RTC Register 0Bh[7].
+ /// 4. Set RTC Register 0Ah[6:4] to 010b
+ /// 5. Clear RTC Register 0Bh[7].
+ ///
+ PciD31F0RegBase = MmPciAddress (
+ 0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ 0
+ );
+
+ if ((MmioRead16 (PciD31F0RegBase + R_PCH_LPC_GEN_PMCON_3) &
+ (UINT16) B_PCH_LPC_GEN_PMCON_RTC_PWR_STS) != 0) {
+ ///
+ /// Enable Alternate Access Mode
+ /// Note: The RTC Index field (including the NMI mask at bit7) is write-only
+ /// for normal operation and can only be read in Alt Access Mode.
+ ///
+ PchAlternateAccessMode (RootComplexBar, TRUE);
+ ///
+ /// Read NMI Enable bit
+ ///
+ Nmi = IoRead8 (R_PCH_NMI_EN) & (UINT8) B_PCH_NMI_EN_NMI_EN;
+ ///
+ /// Disable Alternate Access Mode
+ ///
+ PchAlternateAccessMode (RootComplexBar, FALSE);
+ ///
+ /// 2. Set RTC Register 0Ah[6:4] to 110b or 111b
+ ///
+ IoWrite8 (R_PCH_RTC_INDEX, (UINT8) (R_PCH_RTC_REGA | Nmi));
+ Data8 = IoRead8 (R_PCH_RTC_TARGET) & (UINT8) ~(BIT6 | BIT5 | BIT4);
+ Data8 |= (UINT8) (BIT6 | BIT5);
+ IoWrite8 (R_PCH_RTC_TARGET, Data8);
+ ///
+ /// 3. Set RTC Register 0Bh[7].
+ ///
+ IoWrite8 (R_PCH_RTC_INDEX, (UINT8) (R_PCH_RTC_REGB | Nmi));
+ IoOr8 (R_PCH_RTC_TARGET, (UINT8) B_PCH_RTC_REGB_SET);
+ ///
+ /// 4. Set RTC Register 0Ah[6:4] to 010b
+ ///
+ IoWrite8 (R_PCH_RTC_INDEX, (UINT8) (R_PCH_RTC_REGA | Nmi));
+ Data8 = IoRead8 (R_PCH_RTC_TARGET) & (UINT8) ~(BIT6 | BIT5 | BIT4);
+ Data8 |= (UINT8) (BIT5);
+ IoWrite8 (R_PCH_RTC_TARGET, Data8);
+ ///
+ /// 5. Clear RTC Register 0Bh[7].
+ ///
+ IoWrite8 (R_PCH_RTC_INDEX, (UINT8) (R_PCH_RTC_REGB | Nmi));
+ IoAnd8 (R_PCH_RTC_TARGET, (UINT8) ~B_PCH_RTC_REGB_SET);
+ }
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 19.1 Handling Status Registers
+ /// System BIOS must set 1b to clear the following registers during power-on
+ /// and resuming from Sx sleep state.
+ /// - RCBA + Offset 3310h[0] = 1b
+ /// Done in ConfigureMiscItems ()
+ /// - RCBA + Offset 3310h[4] = 1b, needs to be done as early as possible during PEI
+ /// - RCBA + Offset 3310h[5] = 1b
+ /// Done in ConfigureMiscItems ()
+ ///
+ MmioWrite32 (
+ (UINTN) (RootComplexBar + R_PCH_RCRB_PRSTS),
+ (UINT32) (B_PCH_RCRB_PRSTS_FIELD_1)
+ );
+
+ DEBUG ((EFI_D_INFO, "PchMiscEarlyInit() - End\n"));
+
+ return;
+}
+
+///
+/// Entry point
+///
+
+/**
+ Installs the PCH PEI Init PPI
+ Performing Pch early init after PchPlatfromPolicy PPI produced
+
+ @param[in] FfsHeader Not used.
+ @param[in] PeiServices General purpose services available to every PEIM.
+
+ @retval EFI_SUCCESS The function completes successfully
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to create database
+**/
+EFI_STATUS
+EFIAPI
+InstallPchInitPpi (
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_STATUS Status;
+ UINT32 RootComplexBar;
+ EFI_PEI_PPI_DESCRIPTOR *PchDmiTcVcMapPpiDesc;
+ PCH_DMI_TC_VC_PPI *PchDmiTcVcMapPpi;
+
+ DEBUG ((EFI_D_INFO, "InstallPchInitPpi() - Start\n"));
+
+ ///
+ /// Check if Rcba has been set
+ ///
+ RootComplexBar = PCH_RCRB_BASE;
+ DEBUG ((EFI_D_INFO, "Rcba needs to be programmed before here\n"));
+ ASSERT ((RootComplexBar & (UINT32) (~B_PCH_LPC_RCBA_BAR)) == 0);
+ ///
+ /// Perform miscellaneous init needed in very early PEI phase
+ ///
+ PchMiscEarlyInit (RootComplexBar);
+
+ ///
+ /// Install the DMI TC VC PPI
+ /// Allocate descriptor and PPI structures. Since these are dynamically updated
+ ///
+ PchDmiTcVcMapPpiDesc = (EFI_PEI_PPI_DESCRIPTOR *) AllocateZeroPool (sizeof (EFI_PEI_PPI_DESCRIPTOR));
+ if (PchDmiTcVcMapPpiDesc == NULL) {
+ DEBUG ((EFI_D_ERROR, "Failed to allocate memory for PchDmiTcVcMapPpiDesc! \n"));
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ PchDmiTcVcMapPpi = (PCH_DMI_TC_VC_PPI *) AllocateZeroPool (sizeof (PCH_DMI_TC_VC_PPI));
+ if (PchDmiTcVcMapPpi == NULL) {
+ DEBUG ((EFI_D_ERROR, "Failed to allocate memory for PchDmiTcVcMapPpi! \n"));
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ CopyMem (PchDmiTcVcMapPpi, &mPchDmiTcVcMap, sizeof (PCH_DMI_TC_VC_PPI));
+
+ PchDmiTcVcMapPpiDesc->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;
+ PchDmiTcVcMapPpiDesc->Guid = &gPchDmiTcVcMapPpiGuid;
+ PchDmiTcVcMapPpiDesc->Ppi = PchDmiTcVcMapPpi;
+ Status = (**PeiServices).InstallPpi (PeiServices, PchDmiTcVcMapPpiDesc);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Install the PCH PEI Init PPI
+ ///
+ Status = (**PeiServices).InstallPpi (PeiServices, &mPpiListVariable);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Performing Pch early init after PchPlatfromPolicy PPI produced
+ ///
+ Status = (**PeiServices).NotifyPpi (PeiServices, &mNotifyList);
+ ASSERT_EFI_ERROR (Status);
+
+ Status = (**PeiServices).NotifyPpi (PeiServices, &mPchS3ResumeNotifyDesc);
+ ASSERT_EFI_ERROR (Status);
+
+ DEBUG ((EFI_D_INFO, "InstallPchInitPpi() - End\n"));
+
+ return Status;
+}
+
+/**
+ This function trigger SMI through Iotrap to perform PCH register save and restore in SMI
+
+ @param[in] PeiServices - Pointer to PEI Services Table.
+ @param[in] NotifyDesc - Pointer to the descriptor for the Notification event that
+ caused this function to execute.
+ @param[in] Ppi - Pointer to the PPI data associated with this function.
+
+ @retval EFI_STATUS - Always return EFI_SUCCESS
+**/
+EFI_STATUS
+PchS3ResumeAtEndOfPei (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
+ IN VOID *Ppi
+ )
+{
+ EFI_STATUS Status;
+ EFI_BOOT_MODE BootMode;
+ PCH_LATE_INIT_SMM_VARIABLE SaveRestoreData;
+ UINTN VariableSize;
+ PEI_READ_ONLY_VARIABLE_PPI *VariableServices;
+
+ Status = PeiServicesGetBootMode (&BootMode);
+ DEBUG ((EFI_D_INFO, "[PCH] BootMode = %X\n", BootMode));
+
+ if (BootMode != BOOT_ON_S3_RESUME) {
+ return EFI_SUCCESS;
+ }
+ ///
+ /// Locate Variable Ppi
+ ///
+ Status = (*PeiServices)->LocatePpi (PeiServices, &gPeiReadOnlyVariablePpiGuid, 0, NULL, &VariableServices);
+ ASSERT_EFI_ERROR (Status);
+
+ VariableSize = sizeof (PCH_LATE_INIT_SMM_VARIABLE);
+ Status = VariableServices->PeiGetVariable (
+ PeiServices,
+ PCH_INIT_PEI_VARIABLE_NAME,
+ &gPchInitPeiVariableGuid,
+ NULL,
+ &VariableSize,
+ &SaveRestoreData
+ );
+
+ if (EFI_ERROR(Status)) {
+ return EFI_SUCCESS;
+ }
+
+ ///
+ /// Write to IO trap address to trigger SMI for register restoration
+ ///
+ DEBUG ((EFI_D_INFO, "S3 SMI register restoration\n"));
+ IoWrite16 (SaveRestoreData.IoTrapAddress, 0x0);
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchInitPeim.cif b/ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchInitPeim.cif
new file mode 100644
index 0000000..f8cc797
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchInitPeim.cif
@@ -0,0 +1,17 @@
+<component>
+ name = "PchInitPeim"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\PchInit\Pei"
+ RefName = "PchInitPeim"
+[files]
+"PchInitPeim.sdl"
+"PchInitPeim.mak"
+"PchInitPeim.h"
+"PchInitPeim.c"
+"PchInitPeim.dxs"
+"PchInitPeim.inf"
+"PchUsbInit.c"
+"PchInitCommon.h"
+"PchDmiPeim.c"
+"PchUsbPreconditionPeim.c"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchInitPeim.dxs b/ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchInitPeim.dxs
new file mode 100644
index 0000000..a2a2f80
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchInitPeim.dxs
@@ -0,0 +1,39 @@
+/** @file
+ Dependency expression source file.
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "PeimDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+#endif
+
+DEPENDENCY_START
+ TRUE
+DEPENDENCY_END
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchInitPeim.h b/ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchInitPeim.h
new file mode 100644
index 0000000..1e433db
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchInitPeim.h
@@ -0,0 +1,253 @@
+/** @file
+ Header file for the PCH Init PEIM
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PCH_INIT_PEIM_H_
+#define _PCH_INIT_PEIM_H_
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+
+#include "EdkIIGluePeim.h"
+#include "PchInitVar.h"
+#include "PchAccess.h"
+#include "PchPlatformLib.h"
+#include "PchUsbCommon.h"
+#include "IobpDefinitions.h"
+#include "PchHsio.h"
+#include EFI_PPI_PRODUCER (PchInit)
+#include EFI_PPI_PRODUCER (PchDmiTcVcMap)
+#include EFI_PPI_CONSUMER (MemoryDiscovered)
+#include EFI_PPI_CONSUMER (PchUsbPolicy)
+#include EFI_PPI_CONSUMER (PchPlatformPolicy)
+#include EFI_PPI_CONSUMER (PchReset)
+#include EFI_PPI_PRODUCER (PchPeiInitDone)
+#endif
+
+//
+// ChipsetInit settings defines
+//
+#define H2M_HSIO_MESSAGE (0x7 << 28)///< Master type for all H2M Hsio messages
+#define H2M_HSIO_CMD_GETHSIOVER 1 ///< Triggers Hsio version to be sent through ME/Host FW Status registers
+#define H2M_HSIO_CMD_CLOSE 0 ///< Triggers H2M Hsio interface to close and revert FW Status registers
+#define M2H_HSIO_MSG_ACK 0x7 ///< Ack sent in response to any H2M Hsio messages
+#define MAX_ME_MSG_ACK_TIMEOUT 0x186A0 // Wait max of 100ms for FW to acknowledge.
+
+/**
+ Internal function performing SATA init needed in PEI phase
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] PchPlatformPolicyPpi The PCH Platform Policy PPI instance
+
+ @retval None
+**/
+EFI_STATUS
+EFIAPI
+PchSataInit (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PCH_PLATFORM_POLICY_PPI *PchPlatformPolicyPpi
+ );
+
+/**
+ This function may trigger platform reset depending on the current GbE status,
+ the intended GbE enabling, and current ME status. (When ME is enabled, this function
+ may trigger a Global reset.)
+ This function may not return if it triggers an platform reset and the BIOS boot flow
+ restarts.
+ If this function returns EFI_SUCCESS it indicates there is no need for platform
+ reset in this boot, and boot flow continues.
+ If this function returns EFI_DEVICE_ERROR, something error happens.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] PchPlatformPolicyPpi The PCH Platform Policy PPI instance
+
+ @retval EFI_SUCCESS No platform reset action is taken. System can continue boot flow.
+ @retval Others Won't return if platform reset action is taken
+**/
+EFI_STATUS
+EFIAPI
+PchGbeMandatedReset (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PCH_PLATFORM_POLICY_PPI *PchPlatformPolicyPpi
+ );
+
+/**
+ Perform Thermal Management Support initialization
+
+ @param[in] PchPlatformPolicyPpi The PCH Platform Policy PPI instance
+
+ @retval EFI_SUCCESS Succeeds.
+ @retval EFI_DEVICE_ERROR Device error, aborts abnormally.
+**/
+EFI_STATUS
+PchThermalInit (
+ IN PCH_PLATFORM_POLICY_PPI *PchPlatformPolicyPpi
+ );
+
+/**
+ Initialize IOAPIC according to IoApicConfig policy of the PCH
+ Platform Policy PPI
+
+ @param[in] PchPlatformPolicyPpi The PCH Platform Policy PPI instance
+
+ @retval EFI_SUCCESS Succeeds.
+ @retval EFI_DEVICE_ERROR Device error, aborts abnormally.
+**/
+EFI_STATUS
+PchIoApicInit (
+ IN PCH_PLATFORM_POLICY_PPI *PchPlatformPolicyPpi
+ );
+
+/**
+ This function performs basic initialization for PCH in PEI phase.
+ If any of the base address arguments is zero, this function will disable the corresponding
+ decoding, otherwise this function will enable the decoding.
+ This function locks down the PMBase.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] NotifyDescriptor The notification structure this PEIM registered on install.
+ @param[in] Ppi The memory discovered PPI. Not used.
+
+ @retval EFI_SUCCESS Succeeds.
+ @retval EFI_DEVICE_ERROR Device error, aborts abnormally.
+**/
+EFI_STATUS
+EFIAPI
+PchInitialize (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
+ IN VOID *Ppi
+ );
+
+/**
+ The function performing USB init in PEI phase. This could be used by USB recovery
+ or debug features that need USB initialization during PEI phase.
+ Note: Before executing this function, please be sure that PCH_INIT_PPI.Initialize
+ has been done and PchUsbPolicyPpi has been installed.
+
+ @param[in] PeiServices General purpose services available to every PEIM
+
+ @retval EFI_SUCCESS The function completed successfully
+ @retval Others All other error conditions encountered result in an ASSERT.
+**/
+EFI_STATUS
+EFIAPI
+PchUsbInit (
+ IN EFI_PEI_SERVICES **PeiServices
+ );
+
+/**
+ The function performing TC/VC mapping program, and poll all PCH Virtual Channel
+ until negotiation completion
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+
+ @retval EFI_SUCCESS The function completed successfully
+ @retval Others All other error conditions encountered result in an ASSERT.
+**/
+EFI_STATUS
+EFIAPI
+PchDmiTcVcProgPoll (
+ IN EFI_PEI_SERVICES **PeiServices
+ );
+
+/**
+ The function set the Target Link Speed in PCH to DMI GEN 2.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+
+ @retval None
+**/
+VOID
+EFIAPI
+PchDmiGen2Prog (
+ IN EFI_PEI_SERVICES **PeiServices
+ );
+
+/**
+ The function program DMI miscellaneous registers.
+
+ @param[in] PeiServices General purpose services available to every PEIM
+ @param[in] PchPlatformPolicyPpi The PCH Platform Policy PPI instance
+
+ @retval EFI_SUCCESS The DMI required settings programmed correctly
+**/
+EFI_STATUS
+EFIAPI
+PchDmiMiscProg (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PCH_PLATFORM_POLICY_PPI *PchPlatformPolicyPpi
+ );
+
+/**
+ The function is used while doing CPU Only Reset, where PCH may be required
+ to initialize strap data before soft reset.
+
+ @param[in] PeiServices General purpose services available to every PEIM
+ @param[in] Operation Get/Set Cpu Strap Set Data
+ @param[in, out] CpuStrapSet Cpu Strap Set Data
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @exception EFI_UNSUPPORTED The function is not supported.
+**/
+EFI_STATUS
+EFIAPI
+PchCpuStrapSet (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN CPU_STRAP_OPERATION Operation,
+ IN OUT UINT16 *CpuStrapSet
+ );
+
+/**
+ The function performing USB init in PEI phase. This could be
+ used by USB recovery ,debug features or usb precondition
+ enabled case that need USB initialization during PEI phase.
+ Please be sure the function should not be executed in if the
+ boot mode is S3 resume.
+
+ @param[in] PeiServices General purpose services available to every PEIM
+
+ @retval EFI_SUCCESS The function completed successfully
+ @retval Others All other error conditions encountered result in an ASSERT.
+**/
+EFI_STATUS
+PchStartUsbInit (
+ IN PCH_USB_CONFIG *UsbConfig,
+ IN UINT32 EhciMemBaseAddr,
+ IN UINT32 XhciMemBaseAddr,
+ IN UINT8 Revision
+ );
+
+/**
+ This function handles Pch S3 resume task
+
+ @param[in] PeiServices - Pointer to PEI Services Table.
+ @param[in] NotifyDesc - Pointer to the descriptor for the Notification event that
+ caused this function to execute.
+ @param[in] Ppi - Pointer to the PPI data associated with this function.
+
+ @retval EFI_STATUS - Always return EFI_SUCCESS
+**/
+EFI_STATUS
+PchS3ResumeAtEndOfPei (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
+ IN VOID *Ppi
+ );
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchInitPeim.inf b/ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchInitPeim.inf
new file mode 100644
index 0000000..02e4639
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchInitPeim.inf
@@ -0,0 +1,108 @@
+## @file
+# Component description file for the PCH Init PEIM.
+#
+#@copyright
+# Copyright (c) 2004 - 2013 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = PchInitPeim
+FILE_GUID = FD236AE7-0791-48c4-B29E-29BDEEE1A838
+COMPONENT_TYPE = PE32_PEIM
+
+[sources.common]
+ PchInitPeim.h
+ PchInitPeim.c
+ PchUsbInit.c
+ ../Common/PchUsbCommon.c
+ ../Common/PchInitVar.c
+ ../Common/PchHsio.c
+ ../Common/PchHsioLptHB0.c
+ ../Common/PchHsioLptHCx.c
+ ../Common/PchHsioLptLpBx.c
+ PchDmiPeim.c
+
+ PchUsbPreconditionPeim.c
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGluePeimEntryPoint.c
+
+[includes.common]
+ .
+ ../Common
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Protocol/PchPlatformPolicy
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Guid/ChipsetInitHob
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Heci/Include
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/include
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/library/Pei/Include
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include
+
+[libraries.common]
+ $(PROJECT_PCH_FAMILY)PpiLib
+ EdkFrameworkPpiLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueBaseMemoryLib
+ EdkIIGluePeiDebugLibReportStatusCode
+ EdkIIGluePeiReportStatusCodeLib
+ EdkIIGluePeiServicesLib
+ EdkIIGluePeiMemoryAllocationLib
+ EdkIIGluePeiFirmwarePerformanceLib
+ EdkIIGlueBasePciLibPciExpress
+ EdkPpiLib
+ PchPlatformLib
+ PeiLib
+ $(PROJECT_PCH_FAMILY)PpiLib
+ EdkIIGluePeiFirmwarePerformanceLib
+ PchPlatformLib
+ MeLibPpi
+ MeGuidLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = PchInitPeim.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=InstallPchInitPpi
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_PEI_SERVICES_LIB__ \
+ -D __EDKII_GLUE_PEI_MEMORY_ALLOCATION_LIB__ \
+ -D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchInitPeim.mak b/ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchInitPeim.mak
new file mode 100644
index 0000000..0bd26c3
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchInitPeim.mak
@@ -0,0 +1,117 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchInitPeim/PchInitPeim.mak 4 12/18/12 4:53a Scottyang $
+#
+# $Revision: 4 $
+#
+# $Date: 12/18/12 4:53a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchInitPeim/PchInitPeim.mak $
+#
+# 4 12/18/12 4:53a Scottyang
+# [TAG] EIP109697
+# [Category] Improvement
+# [Description] Update PCH RC 0.8.1
+# [Files] ReferenceCode\Chipset\LynxPoint\*.*, SBDxe.c, SBPEI.c, SB.sd,
+# SbSetupData.c, GetSetupDate.c
+#
+# 3 11/20/12 8:36a Scottyang
+# [TAG] EIP107014
+# [Category] Improvement
+# [Description] Update RC 0.8.0
+# [Files] ReferenceCode\Chipset\LynxPoint\*.*, SBDxe.c, SB.sd,
+# SbSetupData.c, GetSetupDate.c
+#
+# 2 2/24/12 2:13a Victortu
+# Updated to support 4.6.5.3_IntelEDK_1117_Patch7_00.
+#
+# 1 2/08/12 8:53a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+
+#---------------------------------------------------------------------------
+# Create PchInitPeim module
+#---------------------------------------------------------------------------
+EDK : PchInitPeim
+PchInitPeim : $(BUILD_DIR)\PchInitPeim.mak PchInitPeimBin
+
+
+$(BUILD_DIR)\PchInitPeim.mak : $(PchInitPeim_DIR)\$(@B).cif $(PchInitPeim_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(PchInitPeim_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+PchInitPeim_INCLUDES=\
+ /I$(INTEL_PCH_DIR)\PchInit\Common\
+ $(INTEL_PCH_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ /I$(INTEL_PCH_DIR)\Guid\SurvivabilityHob\
+ $(ME_INCLUDES)\
+
+PchInitPeim_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=InstallPchInitPpi"\
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_PEI_SERVICES_LIB__ \
+ /D __EDKII_GLUE_PEI_MEMORY_ALLOCATION_LIB__ \
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__
+
+PchInitPeim_LIB_LINKS =\
+ $(GuidLib_LIB) \
+ $(PchPlatformPeiLib_LIB) \
+ $(IntelPchPpiLib_LIB)\
+ $(EDKFRAMEWORKPPILIB) \
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EdkIIGlueBaseLibIA32_LIB)\
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB) \
+ $(EdkIIGluePeiDebugLibReportStatusCode_LIB) \
+ $(EdkIIGluePeiReportStatusCodeLib_LIB) \
+ $(EdkIIGluePeiServicesLib_LIB) \
+ $(EdkIIGluePeiMemoryAllocationLib_LIB) \
+ $(EdkIIGlueBasePciLibCf8_LIB) \
+ $(PchUsbCommonPeiLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(PEILIB)
+
+PchInitPeimBin: $(PchInitPeim_LIB_LINKS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\PchInitPeim.mak all \
+ "MY_INCLUDES=$(PchInitPeim_INCLUDES)"\
+ "MY_DEFINES=$(PchInitPeim_DEFINES)"\
+ NAME=PchInitPeim\
+ MAKEFILE=$(BUILD_DIR)\PchInitPeim.mak \
+ GUID=FD236AE7-0791-48c4-B29E-29BDEEE1A838\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=PEIM \
+ EDKIIModule=PEIM\
+ DEPEX1=$(PchInitPeim_DIR)\PchInitPeim.dxs\
+ DEPEX1_TYPE=EFI_SECTION_PEI_DEPEX\
+ COMPRESS=0
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchInitPeim.sdl b/ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchInitPeim.sdl
new file mode 100644
index 0000000..cfde1c7
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchInitPeim.sdl
@@ -0,0 +1,67 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchInitPeim/PchInitPeim.sdl 1 2/08/12 8:53a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 8:53a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchInitPeim/PchInitPeim.sdl $
+#
+# 1 2/08/12 8:53a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+TOKEN
+ Name = "PchInitPeim_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable PchInitPeim support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "PchInitPeim_DIR"
+End
+
+MODULE
+ File = "PchInitPeim.mak"
+ Help = "Includes PchInitPeim.mak to Project"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PchInitPeim.ffs"
+ Parent = "FV_BB"
+ InvokeOrder = AfterParent
+End
+
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchUsbInit.c b/ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchUsbInit.c
new file mode 100644
index 0000000..44381fc
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchUsbInit.c
@@ -0,0 +1,198 @@
+/** @file
+ Initializes PCH USB Controllers.
+
+@copyright
+ Copyright (c) 2009 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "PchInitPeim.h"
+
+/**
+ The function performing USB init in PEI phase. This could be used by USB recovery
+ or debug features that need USB initialization during PEI phase.
+ Note: Before executing this function, please be sure that PCH_INIT_PPI.Initialize
+ has been done and PchUsbPolicyPpi has been installed.
+
+ @param[in] PeiServices General purpose services available to every PEIM
+
+ @retval EFI_SUCCESS The function completed successfully
+ @retval Others All other error conditions encountered result in an ASSERT.
+**/
+EFI_STATUS
+EFIAPI
+PchUsbInit (
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_STATUS Status;
+ PCH_USB_POLICY_PPI *PchUsbPolicyPpi;
+
+ DEBUG ((EFI_D_INFO, "PchUsbInit() - Start\n"));
+
+ ///
+ /// Get PchUsbPolicy PPI for PCH_USB_CONFIG
+ ///
+ Status = (**PeiServices).LocatePpi (
+ PeiServices,
+ &gPchUsbPolicyPpiGuid,
+ 0,
+ NULL,
+ (VOID **)&PchUsbPolicyPpi
+ );
+
+ if (Status == EFI_SUCCESS) {
+#ifdef EFI_DEBUG
+ DEBUG ((EFI_D_INFO, "\n------------------------ PchUsbPolicyPpi Dump Begin -----------------\n"));
+ DEBUG ((EFI_D_INFO, "Revision : 0x%x\n", PchUsbPolicyPpi->Revision));
+ DEBUG ((EFI_D_INFO, "Mode : 0x%x\n", PchUsbPolicyPpi->Mode));
+ DEBUG ((EFI_D_INFO, "EhciMemBaseAddr : 0x%x\n", PchUsbPolicyPpi->EhciMemBaseAddr));
+ DEBUG ((EFI_D_INFO, "EhciMemLength : 0x%x\n", PchUsbPolicyPpi->EhciMemLength));
+ DEBUG ((EFI_D_INFO, "XhciMemBaseAddr : 0x%x\n", PchUsbPolicyPpi->XhciMemBaseAddr));
+#endif
+ Status = PchStartUsbInit (
+ PchUsbPolicyPpi->UsbConfig,
+ (UINT32) PchUsbPolicyPpi->EhciMemBaseAddr,
+ (UINT32) PchUsbPolicyPpi->XhciMemBaseAddr,
+ PchUsbPolicyPpi->Revision
+ );
+#ifdef EFI_DEBUG
+ DEBUG ((EFI_D_INFO, "\n"));
+ DEBUG ((EFI_D_INFO, "\n------------------------ PchUsbPolicyPpi Dump End -----------------\n"));
+#endif
+ }
+ DEBUG ((EFI_D_INFO, "PchUsbInit() - End\n"));
+ return Status;
+}
+
+/**
+ The function performing USB init in PEI phase. This could be
+ used by USB recovery ,debug features or usb precondition
+ enabled case that need USB initialization during PEI phase.
+ Please be sure the function should not be executed in if the
+ boot mode is S3 resume.
+
+ @param[in] UsbConfig Pointer to a PCH_USB_CONFIG that provides the platform setting
+ @param[in] EhciMemBaseAddr Predefined Ehci memory base address for Ehci hc configuration
+ @param[in] XhciMemBaseAddr Predefined Xhci memory base address for Xhci hc configuration
+ @param[in] Revision Revision of PCH_USB_CONFIG
+
+ @retval EFI_SUCCESS The function completed successfully
+ @retval Others All other error conditions encountered result in an ASSERT
+**/
+EFI_STATUS
+PchStartUsbInit (
+ IN PCH_USB_CONFIG *UsbConfig,
+ IN UINT32 EhciMemBaseAddr,
+ IN UINT32 XhciMemBaseAddr,
+ IN UINT8 Revision
+ )
+{
+ EFI_STATUS Status;
+ UINT32 RootComplexBar;
+ UINT32 FuncDisableReg;
+#ifdef EFI_DEBUG
+ UINT8 i;
+#endif
+
+ DEBUG ((EFI_D_INFO, "PchStartUsbInit() - Start\n"));
+ Status = EFI_INVALID_PARAMETER;
+ if (UsbConfig != NULL) {
+#ifdef EFI_DEBUG
+ DEBUG ((EFI_D_INFO, "Revision : 0x%x\n", Revision));
+ DEBUG ((EFI_D_INFO, "EhciMemBaseAddr : 0x%x\n", EhciMemBaseAddr));
+ DEBUG ((EFI_D_INFO, "XhciMemBaseAddr : 0x%x\n", XhciMemBaseAddr));
+
+ DEBUG ((EFI_D_INFO, "\n"));
+ DEBUG ((EFI_D_INFO, "------------------------ PCH_USB_CONFIG Dump Start -----------------\n"));
+ DEBUG ((EFI_D_INFO, " PCH_USB_CONFIG UsbPerPortCtl= %x\n", UsbConfig->UsbPerPortCtl));
+ DEBUG ((EFI_D_INFO, " PCH_USB_CONFIG Ehci1Usbr= %x\n", UsbConfig->Ehci1Usbr));
+ DEBUG ((EFI_D_INFO, " PCH_USB_CONFIG Ehci2Usbr= %x\n", UsbConfig->Ehci2Usbr));
+ for (i = 0; i < GetPchUsbMaxPhysicalPortNum (); i++) {
+ DEBUG ((EFI_D_INFO, " PCH_USB_CONFIG PortSettings[%d] Enabled= %x\n", i, UsbConfig->PortSettings[i].Enable));
+ DEBUG ((EFI_D_INFO, " PCH_USB_CONFIG PortSettings[%d] Location = %x\n", i, UsbConfig->PortSettings[i].Location));
+ }
+
+ for (i = 0; i < GetPchXhciMaxUsb3PortNum (); i++) {
+ DEBUG ((EFI_D_INFO, " PCH_USB_CONFIG Port30Settings[%d] Enabled= %x\n", i, UsbConfig->Port30Settings[i].Enable));
+ }
+
+ for (i = 0; i < GetPchEhciMaxControllerNum (); i++) {
+ DEBUG ((EFI_D_INFO, " PCH_USB_CONFIG Usb20Settings[%d] Enabled= %x\n", i, UsbConfig->Usb20Settings[i].Enable));
+ }
+
+ DEBUG ((EFI_D_INFO, " PCH_USB_CONFIG Usb30Settings.Mode= %x\n", UsbConfig->Usb30Settings.Mode));
+ DEBUG ((EFI_D_INFO, " PCH_USB_CONFIG Usb30Settings.PreBootSupport= %x\n", UsbConfig->Usb30Settings.PreBootSupport));
+ DEBUG ((EFI_D_INFO, " XhciStreams is obsoleted, it doesn't effect any setting change since Revision 2.\n"));
+ DEBUG ((EFI_D_INFO, " PCH_USB_CONFIG Usb30Settings.ManualMode= %x\n", UsbConfig->Usb30Settings.ManualMode));
+ DEBUG ((EFI_D_INFO, " PCH_USB_CONFIG Usb30Settings.XhciIdleL1= %x\n", UsbConfig->Usb30Settings.XhciIdleL1));
+
+ for (i = 0; i < GetPchUsbMaxPhysicalPortNum (); i++) {
+ if (UsbConfig->Usb30Settings.ManualModeUsb20PerPinRoute[i] == 0) {
+ DEBUG ((EFI_D_INFO, " PCH_USB_CONFIG Usb30Settings.ManualModeUsb20PerPinRoute[%d]= EHCI\n", i));
+ } else {
+ DEBUG ((EFI_D_INFO, " PCH_USB_CONFIG Usb30Settings.ManualModeUsb20PerPinRoute[%d]= XHCI\n", i));
+ }
+ }
+
+ for (i = 0; i < GetPchXhciMaxUsb3PortNum (); i++) {
+ DEBUG ((EFI_D_INFO,
+ "PCH_USB_CONFIG Usb30Settings.ManualModeUsb30PerPinEnable[%d]= %x\n",
+ i,
+ UsbConfig->Usb30Settings.ManualModeUsb30PerPinEnable[i]));
+ }
+
+ for (i = 0; i < GetPchUsbMaxPhysicalPortNum (); i++) {
+ DEBUG ((EFI_D_INFO, " PCH_USB_CONFIG Usb20OverCurrentPins[%d]= OC%x\n", i, UsbConfig->Usb20OverCurrentPins[i]));
+ }
+
+ for (i = 0; i < GetPchXhciMaxUsb3PortNum (); i++) {
+ DEBUG ((EFI_D_INFO, " PCH_USB_CONFIG Usb30OverCurrentPins[%d]= OC%x\n", i, UsbConfig->Usb30OverCurrentPins[i]));
+ }
+
+ for (i = 0; i < GetPchEhciMaxUsbPortNum (); i++) {
+ DEBUG ((EFI_D_INFO, " PCH_USB_CONFIG Usb20PortLength[%d]= %x.%0x\n", i, UsbConfig->PortSettings[i].Usb20PortLength >> 4, UsbConfig->PortSettings[i].Usb20PortLength & 0xF));
+ }
+ DEBUG ((EFI_D_INFO, "\n"));
+ DEBUG ((EFI_D_INFO, "\n------------------------ PCH_USB_CONFIG Dump End -----------------\n"));
+#endif
+ RootComplexBar = PCH_RCRB_BASE;
+ FuncDisableReg = MmioRead32 (RootComplexBar + R_PCH_RCRB_FUNC_DIS);
+
+ Status = CommonUsbInit (
+ UsbConfig,
+ (UINT32) EhciMemBaseAddr,
+ (UINT32) XhciMemBaseAddr,
+ 0,
+ RootComplexBar,
+ &FuncDisableReg,
+ Revision
+ );
+
+ ASSERT_EFI_ERROR (Status);
+
+ MmioWrite32 ((UINTN) (RootComplexBar + R_PCH_RCRB_FUNC_DIS), (UINT32) (FuncDisableReg));
+ //
+ // Reads back for posted write to take effect
+ //
+ MmioRead32 ((UINTN) (RootComplexBar + R_PCH_RCRB_FUNC_DIS));
+ }
+
+ DEBUG ((EFI_D_INFO, "PchStartUsbInit() - End\n"));
+
+ return Status;
+
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchUsbPreconditionPeim.c b/ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchUsbPreconditionPeim.c
new file mode 100644
index 0000000..0735fd6
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Pei/PchUsbPreconditionPeim.c
@@ -0,0 +1,105 @@
+/** @file
+
+ PCH USB precondition feature support in PEI phase
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "PchInitPeim.h"
+
+#ifdef USB_PRECONDITION_ENABLE_FLAG
+
+extern USB_CONTROLLER EhciControllersMap[];
+
+/**
+ Perform USB precondition on EHCI, it is the HC on USB HC in PEI phase
+
+ @param[in] Device The device number of the EHCI
+ @param[in] EhciMmioBase Memory base address of EHCI Controller
+
+ @retval None
+**/
+VOID
+EhciPrecondition (
+ IN UINT8 Device,
+ IN UINT32 EhciMmioBase
+ )
+{
+ UINTN HcResetTimeout;
+
+ HcResetTimeout = 0;
+ while ((HcResetTimeout < 200) &&
+ (MmioRead32 (EhciMmioBase + R_PCH_EHCI_USB2CMD) & B_PCH_EHCI_USB2CMD_HCRESET)) {
+ PchPmTimerStall (100);
+ HcResetTimeout++;
+ }
+
+ if ((MmioRead32 (EhciMmioBase + R_PCH_EHCI_USB2CMD) & B_PCH_EHCI_USB2CMD_HCRESET) == 0) {
+ //
+ // Route all ports to this EHCI
+ //
+ MmioWrite32 ((EhciMmioBase + R_PCH_EHCI_CONFIGFLAG), BIT0);
+ }
+}
+
+/**
+ Perform USB precondition on XHCI, it is the HC on USB HC in PEI phase
+
+ @param[in] BusNumber The Bus number of the XHCI
+ @param[in] Device The device number of the XHCI
+ @param[in] Function The function number of the XHCI
+ @param[in] XhciMmioBase Memory base address of XHCI Controller
+ @param[in] XhciUSB2Ptr Pointer to USB2 protocol port register
+ @param[in] HsPortCount The number of USB2 protocol port supported by this XHCI
+
+ @retval None
+**/
+VOID
+XhciPrecondition (
+ IN UINT8 BusNumber,
+ IN UINT8 Device,
+ IN UINT8 Function,
+ IN UINT32 XhciMmioBase,
+ IN UINTN *XhciUSB2Ptr,
+ IN UINTN HsPortCount,
+ IN UINTN *XhciUSB3Ptr,
+ IN UINTN SsPortCount
+ )
+{
+ UINT32 Data32;
+ UINTN HcHaltTimeout;
+
+ //
+ // Set the XHC to halt state before reset
+ //
+ HcHaltTimeout = 0;
+ if (!(MmioRead32 (XhciMmioBase + R_PCH_XHCI_USBSTS) & BIT0)) {
+ Data32 = MmioRead32 (XhciMmioBase + R_PCH_XHCI_USBCMD);
+ MmioWrite32 ((XhciMmioBase + R_PCH_XHCI_USBCMD), (Data32 &~B_PCH_XHCI_USBCMD_RS));
+ while ((HcHaltTimeout < 200) &&
+ (!(MmioRead32 (XhciMmioBase + R_PCH_XHCI_USBSTS) & BIT0))) {
+ PchPmTimerStall (100);
+ HcHaltTimeout++;
+ }
+ }
+
+ if (MmioRead32 (XhciMmioBase + R_PCH_XHCI_USBSTS) & BIT0) {
+ MmioOr16 ((XhciMmioBase + R_PCH_XHCI_USBCMD), BIT1);
+ }
+}
+
+#endif // USB_PRECONDITION_ENABLE_FLAG
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Smm/PchLateInitSmm.c b/ReferenceCode/Chipset/LynxPoint/PchInit/Smm/PchLateInitSmm.c
new file mode 100644
index 0000000..e29c5a1
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Smm/PchLateInitSmm.c
@@ -0,0 +1,753 @@
+/** @file
+ PCH S3 Save and Restore SMM Driver Entry
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "PchLateInitSmm.h"
+
+STATIC PCH_SAVE_RESTORE_REG PchSaveRestoreReg_Common[] = {
+ {Acpi, R_PCH_ACPI_PM1_EN, 0, BIT14, 2},
+ {Rcrb, 0x3300, 0, 0xFFFFFFFF, 4},
+ {Rcrb, 0x3304, 0, 0xFFFFFFFF, 4},
+ {Rcrb, 0x3308, 0, 0xFFFFFFFF, 4},
+ {Rcrb, 0x330C, 0, 0xFFFFFFFF, 4}
+};
+
+#ifdef TRAD_FLAG
+STATIC PCH_SAVE_RESTORE_REG PchSaveRestoreReg_PchH[] = {
+ {Acpi, R_PCH_ACPI_GPE0a_EN, 0, 0xFFFF0246, 4},
+ {Acpi, R_PCH_ACPI_GPE0b_EN, 0, 0xFF000040, 4},
+ {Tco , R_PCH_TCO2_CNT , 0, BIT5 | BIT4, 1}
+};
+#endif // TRAD_FLAG
+
+#ifdef ULT_FLAG
+STATIC PCH_SAVE_RESTORE_REG PchSaveRestoreReg_PchLp[] = {
+ {Rcrb, 0x3320, 0, 0xFFFFFFFF, 4}
+};
+#endif // ULT_FLAG
+
+STATIC PCH_SAVE_RESTORE_PCI PchSaveRestorePciReg_Common[] = {
+ {PciCfg, PCI_DEVICE_NUMBER_PCH_AZALIA, 0, 0, R_PCH_HDA_PCS + 1, 0, BIT0, 1, NULL},
+ {PciMmr, PCI_DEVICE_NUMBER_PCH_AZALIA, 0, PCI_BASE_ADDRESSREG_OFFSET, R_HDA_WAKEEN, 0, BIT3 | BIT2 | BIT1 | BIT0, 1, NULL},
+ {PciCfg, PCI_DEVICE_NUMBER_PCH_USB, 0, 0, R_PCH_EHCI_PWR_CNTL_STS + 1, 0, BIT0, 1, NULL},
+ {PciMmr, PCI_DEVICE_NUMBER_PCH_USB, 0, PCI_BASE_ADDRESSREG_OFFSET, R_PCH_EHCI_CONFIGFLAG, 0, BIT0, 1, NULL},
+ {PciMmr, PCI_DEVICE_NUMBER_PCH_USB, 0, PCI_BASE_ADDRESSREG_OFFSET, R_PCH_EHCI_PORTSC0 + 2, 0, BIT6 | BIT5 | BIT4, 1, NULL},
+ {PciMmr, PCI_DEVICE_NUMBER_PCH_USB, 0, PCI_BASE_ADDRESSREG_OFFSET, R_PCH_EHCI_PORTSC0 + 6, 0, BIT6 | BIT5 | BIT4, 1, NULL},
+ {PciMmr, PCI_DEVICE_NUMBER_PCH_USB, 0, PCI_BASE_ADDRESSREG_OFFSET, R_PCH_EHCI_PORTSC0 + 10, 0, BIT6 | BIT5 | BIT4, 1, NULL},
+ {PciMmr, PCI_DEVICE_NUMBER_PCH_USB, 0, PCI_BASE_ADDRESSREG_OFFSET, R_PCH_EHCI_PORTSC0 + 14, 0, BIT6 | BIT5 | BIT4, 1, NULL},
+ {PciMmr, PCI_DEVICE_NUMBER_PCH_USB, 0, PCI_BASE_ADDRESSREG_OFFSET, R_PCH_EHCI_PORTSC0 + 18, 0, BIT6 | BIT5 | BIT4, 1, NULL},
+ {PciMmr, PCI_DEVICE_NUMBER_PCH_USB, 0, PCI_BASE_ADDRESSREG_OFFSET, R_PCH_EHCI_PORTSC0 + 22, 0, BIT6 | BIT5 | BIT4, 1, NULL},
+ {PciMmr, PCI_DEVICE_NUMBER_PCH_USB, 0, PCI_BASE_ADDRESSREG_OFFSET, R_PCH_EHCI_PORTSC0 + 26, 0, BIT6 | BIT5 | BIT4, 1, NULL},
+ {PciMmr, PCI_DEVICE_NUMBER_PCH_USB, 0, PCI_BASE_ADDRESSREG_OFFSET, R_PCH_EHCI_PORTSC0 + 30, 0, BIT6 | BIT5 | BIT4, 1, NULL},
+ {PciMmr, PCI_DEVICE_NUMBER_PCH_USB, 0, PCI_BASE_ADDRESSREG_OFFSET, R_PCH_EHCI_PORTSC0 + 34, 0, BIT6 | BIT5 | BIT4, 1, NULL},
+ {PciMmr, PCI_DEVICE_NUMBER_PCH_USB, 0, PCI_BASE_ADDRESSREG_OFFSET, R_PCH_EHCI_PORTSC0 + 38, 0, BIT6 | BIT5 | BIT4, 1, NULL},
+ {PciCfg, PCI_DEVICE_NUMBER_PCH_XHCI, 0, 0, R_PCH_XHCI_PWR_CNTL_STS + 1, 0, BIT0 | BIT7, 1, NULL},
+ {PciCfg, PCI_DEVICE_NUMBER_PCH_XHCI, 0, 0, R_PCH_XHCI_USB2PR, 0, 0x7FFF, 2, NULL},
+ {PciCfg, PCI_DEVICE_NUMBER_PCH_XHCI, 0, 0, R_PCH_XHCI_USB3PR, 0, 0x3F, 1, NULL},
+ {PciCfg, PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS, 0, 0, R_PCH_PCIE_PMCS + 1, 0, BIT0, 1, NULL},
+ {PciCfg, PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS, 1, 0, R_PCH_PCIE_PMCS + 1, 0, BIT0, 1, NULL},
+ {PciCfg, PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS, 2, 0, R_PCH_PCIE_PMCS + 1, 0, BIT0, 1, NULL},
+ {PciCfg, PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS, 3, 0, R_PCH_PCIE_PMCS + 1, 0, BIT0, 1, NULL},
+ {PciCfg, PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS, 4, 0, R_PCH_PCIE_PMCS + 1, 0, BIT0, 1, NULL},
+ {PciCfg, PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS, 5, 0, R_PCH_PCIE_PMCS + 1, 0, BIT0, 1, NULL}
+};
+
+#ifdef TRAD_FLAG
+STATIC PCH_SAVE_RESTORE_PCI PchSaveRestorePciReg_PchH[] = {
+ {PciCfg, PCI_DEVICE_NUMBER_PCH_USB_EXT, 0, 0, R_PCH_EHCI_PWR_CNTL_STS + 1, 0, BIT0, 1, NULL},
+ {PciMmr, PCI_DEVICE_NUMBER_PCH_USB_EXT, 0, PCI_BASE_ADDRESSREG_OFFSET, R_PCH_EHCI_CONFIGFLAG, 0, BIT0, 1, NULL},
+ {PciMmr, PCI_DEVICE_NUMBER_PCH_USB_EXT, 0, PCI_BASE_ADDRESSREG_OFFSET, R_PCH_EHCI_PORTSC0 + 2, 0, BIT6 | BIT5 | BIT4, 1, NULL},
+ {PciMmr, PCI_DEVICE_NUMBER_PCH_USB_EXT, 0, PCI_BASE_ADDRESSREG_OFFSET, R_PCH_EHCI_PORTSC0 + 6, 0, BIT6 | BIT5 | BIT4, 1, NULL},
+ {PciMmr, PCI_DEVICE_NUMBER_PCH_USB_EXT, 0, PCI_BASE_ADDRESSREG_OFFSET, R_PCH_EHCI_PORTSC0 + 10, 0, BIT6 | BIT5 | BIT4, 1, NULL},
+ {PciMmr, PCI_DEVICE_NUMBER_PCH_USB_EXT, 0, PCI_BASE_ADDRESSREG_OFFSET, R_PCH_EHCI_PORTSC0 + 14, 0, BIT6 | BIT5 | BIT4, 1, NULL},
+ {PciMmr, PCI_DEVICE_NUMBER_PCH_USB_EXT, 0, PCI_BASE_ADDRESSREG_OFFSET, R_PCH_EHCI_PORTSC0 + 18, 0, BIT6 | BIT5 | BIT4, 1, NULL},
+ {PciMmr, PCI_DEVICE_NUMBER_PCH_USB_EXT, 0, PCI_BASE_ADDRESSREG_OFFSET, R_PCH_EHCI_PORTSC0 + 22, 0, BIT6 | BIT5 | BIT4, 1, NULL},
+ {PciMmr, PCI_DEVICE_NUMBER_PCH_USB_EXT, 0, PCI_BASE_ADDRESSREG_OFFSET, R_PCH_EHCI_PORTSC0 + 26, 0, BIT6 | BIT5 | BIT4, 1, NULL},
+ {PciMmr, PCI_DEVICE_NUMBER_PCH_USB_EXT, 0, PCI_BASE_ADDRESSREG_OFFSET, R_PCH_EHCI_PORTSC0 + 30, 0, BIT6 | BIT5 | BIT4, 1, NULL},
+ {PciMmr, PCI_DEVICE_NUMBER_PCH_USB_EXT, 0, PCI_BASE_ADDRESSREG_OFFSET, R_PCH_EHCI_PORTSC0 + 34, 0, BIT6 | BIT5 | BIT4, 1, NULL},
+ {PciMmr, PCI_DEVICE_NUMBER_PCH_USB_EXT, 0, PCI_BASE_ADDRESSREG_OFFSET, R_PCH_EHCI_PORTSC0 + 38, 0, BIT6 | BIT5 | BIT4, 1, NULL},
+ {PciCfg, PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS, 6, 0, R_PCH_PCIE_PMCS + 1, 0, BIT0, 1, NULL},
+ {PciCfg, PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS, 7, 0, R_PCH_PCIE_PMCS + 1, 0, BIT0, 1, NULL}
+};
+#endif // TRAD_FLAG
+
+#ifdef ULT_FLAG
+STATIC PCH_SAVE_RESTORE_PCI PchSaveRestorePciReg_PchLp[] = {
+ {PciMmr, PCI_DEVICE_NUMBER_PCH_SATA, 2, R_PCH_SATA_AHCI_BAR, R_PCH_SATA_AHCI_P0DEVSLP, 0, 0x1FFFFFFF, 4, RestorePxDevSlp},
+ {PciMmr, PCI_DEVICE_NUMBER_PCH_SATA, 2, R_PCH_SATA_AHCI_BAR, R_PCH_SATA_AHCI_P1DEVSLP, 0, 0x1FFFFFFF, 4, RestorePxDevSlp},
+ {PciMmr, PCI_DEVICE_NUMBER_PCH_SATA, 2, R_PCH_SATA_AHCI_BAR, R_PCH_SATA_AHCI_P3DEVSLP, 0, 0x1FFFFFFF, 4, RestorePxDevSlp}
+};
+#endif // ULT_FLAG
+DEVICE_POWER_STATE DevicePowerState[] = {
+ {PCI_DEVICE_NUMBER_PCH_AZALIA, 0, DeviceD0},
+ {PCI_DEVICE_NUMBER_PCH_USB_EXT, 0, DeviceD0},
+ {PCI_DEVICE_NUMBER_PCH_USB, 0, DeviceD0},
+ {PCI_DEVICE_NUMBER_PCH_XHCI, 0, DeviceD0},
+ {PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS, 0, DeviceD0},
+ {PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS, 1, DeviceD0},
+ {PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS, 2, DeviceD0},
+ {PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS, 3, DeviceD0},
+ {PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS, 4, DeviceD0},
+ {PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS, 5, DeviceD0},
+ {PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS, 6, DeviceD0},
+ {PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS, 7, DeviceD0}
+};
+
+PCH_SAVE_RESTORE_PCI_WRAP PchSaveRestorePciRegWrap[] = {
+#ifdef TRAD_FLAG
+ {PchSaveRestorePciReg_Common, ARRAY_SIZE(PchSaveRestorePciReg_Common), PchH},
+ {PchSaveRestorePciReg_PchH, ARRAY_SIZE (PchSaveRestorePciReg_PchH), PchH}
+#endif // TRAD_FLAG
+#if (defined ULT_FLAG) && (defined TRAD_FLAG)
+ ,
+#endif // ULT_FLAG && TRAD_FLAG
+#ifdef ULT_FLAG
+ {PchSaveRestorePciReg_Common, ARRAY_SIZE(PchSaveRestorePciReg_Common), PchLp},
+ {PchSaveRestorePciReg_PchLp, ARRAY_SIZE(PchSaveRestorePciReg_PchLp), PchLp}
+#endif // ULT_FLAG
+};
+
+PCH_SAVE_RESTORE_REG_WRAP PchSaveRestoreRegWrap[] = {
+#ifdef TRAD_FLAG
+ {PchSaveRestoreReg_Common, ARRAY_SIZE(PchSaveRestoreReg_Common), PchH},
+ {PchSaveRestoreReg_PchH, ARRAY_SIZE(PchSaveRestoreReg_PchH), PchH}
+#endif // TRAD_FLAG
+#if (defined ULT_FLAG) && (defined TRAD_FLAG)
+ ,
+#endif // ULT_FLAG && TRAD_FLAG
+#ifdef ULT_FLAG
+ {PchSaveRestoreReg_Common, ARRAY_SIZE(PchSaveRestoreReg_Common), PchLp},
+ {PchSaveRestoreReg_PchLp, ARRAY_SIZE(PchSaveRestoreReg_PchLp), PchLp}
+#endif // ULT_FLAG
+};
+
+UINT32 PciMemBase = 0;
+
+/**
+
+ Find the Offset to a given Capabilities ID
+ CAPID list:
+ 0x01 = PCI Power Management Interface
+ 0x04 = Slot Identification
+ 0x05 = MSI Capability
+ 0x10 = PCI Express Capability
+
+ @param[in] Bus - Pci Bus Number
+ @param[in] Device - Pci Device Number
+ @param[in] Func - Pci Function Number
+ @param[in] CapId - CAPID to search for
+
+ @retval 0 - CAPID not found
+ @retval Other - CAPID found, Offset of desired CAPID
+
+**/
+UINT8
+PcieFindCapId (
+ IN UINT8 Bus,
+ IN UINT8 Device,
+ IN UINT8 Func,
+ IN UINT8 CapId
+ )
+{
+ UINT8 CapHeader;
+
+ ///
+ /// Always start at Offset 0x34
+ ///
+ CapHeader = MmioRead8 (MmPciAddress (0, Bus, Device, Func, PCI_CAPBILITY_POINTER_OFFSET));
+ if (CapHeader == 0xFF) {
+ return 0;
+ }
+
+ while (CapHeader != 0) {
+ ///
+ /// Bottom 2 bits of the pointers are reserved per PCI Local Bus Spec 2.2
+ ///
+ CapHeader &= ~(BIT1 | BIT0);
+ ///
+ /// Search for desired CapID
+ ///
+ if (MmioRead8 (MmPciAddress (0, Bus, Device, Func, CapHeader)) == CapId) {
+ return CapHeader;
+ }
+
+ CapHeader = MmioRead8 (MmPciAddress (0, Bus, Device, Func, CapHeader + 1));
+ }
+
+ return 0;
+}
+
+/**
+
+ Save Device Power State and restore later
+
+ @param[in] Device - Pci Device Number
+ @param[in] Function - Pci Function Number
+
+ @retval None
+
+**/
+VOID
+SaveDevPowState (
+ IN UINT8 Device,
+ IN UINT8 Function
+ )
+{
+ UINTN index;
+
+ for (index = 0; index < ARRAY_SIZE(DevicePowerState); index++) {
+ if ((DevicePowerState[index].Device == Device) && (DevicePowerState[index].Function) == Function) {
+ DevicePowerState[index].PowerState = DeviceD3;
+ break;
+ }
+ }
+}
+
+/**
+
+ Restore Device Power State back to D3
+
+ @retval None
+
+**/
+VOID
+RestoreDevPowState (
+ VOID
+ )
+{
+ UINTN index;
+ UINTN PciBaseAddress;
+ UINT8 CapOffset;
+
+ for (index = 0; index < ARRAY_SIZE(DevicePowerState); index++) {
+ if (DevicePowerState[index].PowerState == DeviceD3) {
+ PciBaseAddress = MmPciAddress(
+ 0,
+ 0,
+ DevicePowerState[index].Device,
+ DevicePowerState[index].Function,
+ 0
+ );
+ CapOffset = PcieFindCapId (
+ 0,
+ DevicePowerState[index].Device,
+ DevicePowerState[index].Function,
+ EFI_PCI_CAPABILITY_ID_PCIPM
+ );
+ if (CapOffset != 0) {
+ MmioOr8 (PciBaseAddress + CapOffset + 0x4, DeviceD3);
+ }
+ }
+ }
+}
+
+/**
+ Restore PxDevSlp
+
+ @param[in] *PchSaveRestorePci - Pointer to Pch Save Restore Pci to be restored.
+
+ @retval None
+**/
+VOID
+RestorePxDevSlp(
+ IN PCH_SAVE_RESTORE_PCI *PchSaveRestorePci
+ )
+{
+ UINTN PciBaseAddress;
+ UINT32 PciBar;
+ UINTN Address;
+ UINT8 PciCmd;
+ UINT32 Data32;
+ UINT32 PortIndex;
+
+ ASSERT ((PchSaveRestorePci->AccessType == PciMmr) &&
+ (PchSaveRestorePci->Device == PCI_DEVICE_NUMBER_PCH_SATA) &&
+ ((PchSaveRestorePci->Offset == R_PCH_SATA_AHCI_P0DEVSLP) ||
+ (PchSaveRestorePci->Offset == R_PCH_SATA_AHCI_P1DEVSLP) ||
+ (PchSaveRestorePci->Offset == R_PCH_SATA_AHCI_P3DEVSLP)) &&
+ (PchSaveRestorePci->Width == 4));
+
+ PciBaseAddress = MmPciAddress (
+ 0,
+ 0,
+ PchSaveRestorePci->Device,
+ PchSaveRestorePci->Function,
+ 0
+ );
+ PortIndex = (PchSaveRestorePci->Offset - R_PCH_SATA_AHCI_P0DEVSLP)/0x80;
+ PciCmd = MmioRead8 (PciBaseAddress + PCI_COMMAND_OFFSET);
+ MmioWrite8 (PciBaseAddress + PCI_COMMAND_OFFSET, BIT1);
+ PciBar = MmioRead32 (PciBaseAddress + PchSaveRestorePci->BarOffset);
+ MmioWrite32 (PciBaseAddress + PchSaveRestorePci->BarOffset, PciMemBase);
+ Address = PciMemBase + PchSaveRestorePci->Offset;
+ ///
+ /// Restore DM and DITO
+ ///
+ MmioAndThenOr32 (Address, (UINT32)~PchSaveRestorePci->Mask, (PchSaveRestorePci->Data & (B_PCH_SATA_AHCI_PxDEVSLP_DM_MASK | B_PCH_SATA_AHCI_PxDEVSLP_DITO_MASK)));
+
+ ///
+ /// Makesure PxCMD.ST and PxDEVSLP.ADSE are cleared to '0' before updating PxDEVSLP.DETO and PxDEVSLP.MDAT value.
+ ///
+ Data32 = MmioRead32 (PciMemBase + (R_PCH_SATA_AHCI_P0CMD + (0x80 * PortIndex)));
+ MmioAnd32 (PciMemBase + (R_PCH_SATA_AHCI_P0CMD + (0x80 * PortIndex)), (UINT32)~B_PCH_SATA_AHCI_PxCMD_ST);
+ MmioAnd32 (Address, (UINT32)~B_PCH_SATA_AHCI_PxDEVSLP_ADSE);
+ MmioOr32 (Address, (PchSaveRestorePci->Data & (UINT32)~B_PCH_SATA_AHCI_PxDEVSLP_ADSE));
+ MmioOr32 (PciMemBase + (R_PCH_SATA_AHCI_P0CMD + (0x80 * PortIndex)), (Data32 & B_PCH_SATA_AHCI_PxCMD_ST));
+ MmioOr32 (Address, (PchSaveRestorePci->Data & B_PCH_SATA_AHCI_PxDEVSLP_ADSE));
+
+ ///
+ /// Restore original PCI command and bar
+ ///
+ MmioWrite8 (PciBaseAddress + PCI_COMMAND_OFFSET, PciCmd);
+ MmioWrite32 (PciBaseAddress + PchSaveRestorePci->BarOffset, PciBar);
+}
+
+/**
+ A SMI callback to do PCH SMI register restoration
+
+ @param[in] DispatchHandle - The handle of this callback, obtained when registering
+ @param[in] DispatchContext - Pointer to the EFI_SMM_IO_TRAP_DISPATCH_CALLBACK_CONTEXT
+
+ @retval None
+**/
+VOID
+PchIoTrapSmiCallback (
+ IN EFI_HANDLE DispatchHandle,
+ IN EFI_SMM_IO_TRAP_DISPATCH_CALLBACK_CONTEXT *CallbackContext
+ )
+{
+ UINT16 AcpiBase;
+ UINT16 TcoBase;
+ UINTN index;
+ UINTN i;
+ UINTN PciBaseAddress;
+ UINTN Address;
+ UINT8 PowerState;
+ UINT8 PciCmd;
+ UINT32 PciBar;
+ UINT32 Mask;
+ PCH_SERIES PchSeries;
+
+ AcpiBase = PchLpcPciCfg32(R_PCH_LPC_ACPI_BASE) & B_PCH_LPC_ACPI_BASE_BAR;
+ TcoBase = AcpiBase + PCH_TCO_BASE;
+ PowerState = 0x0;
+ PchSeries = GetPchSeries();
+
+ ///
+ /// Restoring IO and MMIO registers
+ ///
+ for (i = 0; i < ARRAY_SIZE (PchSaveRestoreRegWrap); i++) {
+ if (PchSeries != PchSaveRestoreRegWrap[i].PchSeries) {
+ continue;
+ }
+ for (index = 0; index < PchSaveRestoreRegWrap[i].size; index++) {
+ Mask = PchSaveRestoreRegWrap[i].PchSaveRestoreReg[index].Mask;
+ switch (PchSaveRestoreRegWrap[i].PchSaveRestoreReg[index].AccessType) {
+ case Tco:
+ Address = TcoBase + PchSaveRestoreRegWrap[i].PchSaveRestoreReg[index].Address;
+ switch (PchSaveRestoreRegWrap[i].PchSaveRestoreReg[index].Width) {
+ case 4:
+ IoAndThenOr32 (Address, (UINT32) ~Mask, PchSaveRestoreRegWrap[i].PchSaveRestoreReg[index].Data);
+ break;
+ case 2:
+ IoAndThenOr16 (Address, (UINT16) ~Mask, (UINT16) (PchSaveRestoreRegWrap[i].PchSaveRestoreReg[index].Data));
+ break;
+ case 1:
+ IoAndThenOr8 (Address, (UINT8) ~Mask, (UINT8) (PchSaveRestoreRegWrap[i].PchSaveRestoreReg[index].Data));
+ break;
+ }
+ break;
+ case Acpi:
+ Address = AcpiBase + PchSaveRestoreRegWrap[i].PchSaveRestoreReg[index].Address;
+ switch (PchSaveRestoreRegWrap[i].PchSaveRestoreReg[index].Width) {
+ case 4:
+ IoAndThenOr32 (Address, (UINT32) ~Mask, PchSaveRestoreRegWrap[i].PchSaveRestoreReg[index].Data);
+ break;
+ case 2:
+ IoAndThenOr16 (Address, (UINT16) ~Mask, (UINT16) (PchSaveRestoreRegWrap[i].PchSaveRestoreReg[index].Data));
+ break;
+ case 1:
+ IoAndThenOr8 (Address, (UINT8) ~Mask, (UINT8) (PchSaveRestoreRegWrap[i].PchSaveRestoreReg[index].Data));
+ break;
+ }
+ break;
+ case Rcrb:
+ Address = PchSaveRestoreRegWrap[i].PchSaveRestoreReg[index].Address;
+ switch (PchSaveRestoreRegWrap[i].PchSaveRestoreReg[index].Width) {
+ case 4:
+ PchMmRcrb32AndThenOr (Address, (UINT32) ~Mask, PchSaveRestoreRegWrap[i].PchSaveRestoreReg[index].Data);
+ break;
+ case 2:
+ PchMmRcrb16AndThenOr (Address, (UINT16) ~Mask, (UINT16) (PchSaveRestoreRegWrap[i].PchSaveRestoreReg[index].Data));
+ break;
+ case 1:
+ PchMmRcrb8AndThenOr (Address, (UINT8) ~Mask, (UINT8) (PchSaveRestoreRegWrap[i].PchSaveRestoreReg[index].Data));
+ break;
+ }
+ break;
+ }
+ }
+ }
+
+ ///
+ /// Restoring PCI config space and PCI bar registers
+ ///
+ for (i = 0; i < ARRAY_SIZE (PchSaveRestorePciRegWrap); i++) {
+ if (PchSeries != PchSaveRestorePciRegWrap[i].PchSeries) {
+ continue;
+ }
+ for (index = 0; index < PchSaveRestorePciRegWrap[i].size; index++) {
+ PciBaseAddress = MmPciAddress(
+ 0,
+ 0,
+ PchSaveRestorePciRegWrap[i].PchSaveRestorePci[index].Device,
+ PchSaveRestorePciRegWrap[i].PchSaveRestorePci[index].Function,
+ 0
+ );
+ if (MmioRead32(PciBaseAddress) == 0xFFFFFFFF) {
+ continue;
+ }
+ if (PchSaveRestorePciRegWrap[i].PchSaveRestorePci[index].RestoreFunction == NULL) {
+ Mask = PchSaveRestorePciRegWrap[i].PchSaveRestorePci[index].Mask;
+ switch (PchSaveRestorePciRegWrap[i].PchSaveRestorePci[index].AccessType) {
+ case PciCfg:
+ Address = PciBaseAddress + PchSaveRestorePciRegWrap[i].PchSaveRestorePci[index].Offset;
+ switch (PchSaveRestorePciRegWrap[i].PchSaveRestorePci[index].Width) {
+ case 4:
+ MmioAndThenOr32 (Address, (UINT32) ~Mask, PchSaveRestorePciRegWrap[i].PchSaveRestorePci[index].Data);
+ break;
+ case 2:
+ MmioAndThenOr16 (Address, (UINT16) ~Mask, (UINT16) (PchSaveRestorePciRegWrap[i].PchSaveRestorePci[index].Data));
+ break;
+ case 1:
+ MmioAndThenOr8 (Address, (UINT8) ~Mask, (UINT8) (PchSaveRestorePciRegWrap[i].PchSaveRestorePci[index].Data));
+ break;
+ }
+ break;
+ case PciMmr:
+ PciCmd = MmioRead8 (PciBaseAddress + PCI_COMMAND_OFFSET);
+ MmioWrite8 (PciBaseAddress + PCI_COMMAND_OFFSET, BIT1);
+ PciBar = MmioRead32 (PciBaseAddress + PchSaveRestorePciRegWrap[i].PchSaveRestorePci[index].BarOffset);
+ MmioWrite32 (PciBaseAddress + PchSaveRestorePciRegWrap[i].PchSaveRestorePci[index].BarOffset, PciMemBase);
+ Address = PciMemBase + PchSaveRestorePciRegWrap[i].PchSaveRestorePci[index].Offset;
+ switch (PchSaveRestorePciRegWrap[i].PchSaveRestorePci[index].Width) {
+ case 4:
+ MmioAndThenOr32 (Address, (UINT32) ~Mask, PchSaveRestorePciRegWrap[i].PchSaveRestorePci[index].Data);
+ break;
+ case 2:
+ MmioAndThenOr16 (Address, (UINT16) ~Mask, (UINT16) (PchSaveRestorePciRegWrap[i].PchSaveRestorePci[index].Data));
+ break;
+ case 1:
+ MmioAndThenOr8 (Address, (UINT8) ~Mask, (UINT8) (PchSaveRestorePciRegWrap[i].PchSaveRestorePci[index].Data));
+ break;
+ }
+ ///
+ /// Restore original PCI command and bar
+ ///
+ MmioWrite8 (PciBaseAddress + PCI_COMMAND_OFFSET, PciCmd);
+ MmioWrite32 (PciBaseAddress + PchSaveRestorePciRegWrap[i].PchSaveRestorePci[index].BarOffset, PciBar);
+ break;
+ }
+ } else {
+ PchSaveRestorePciRegWrap[i].PchSaveRestorePci [index].RestoreFunction (&(PchSaveRestorePciRegWrap[i].PchSaveRestorePci[index]));
+ }
+ }
+ }
+}
+
+/**
+ This function save PCH register before enter S3
+
+ @param[in] Handle Handle of the callback
+ @param[in] Context The dispatch context
+
+ @retval EFI_SUCCESS PCH register saved
+**/
+EFI_STATUS
+PchS3EntryCallBack (
+ IN EFI_HANDLE Handle,
+ IN EFI_SMM_SX_DISPATCH_CONTEXT *Context
+ )
+{
+ UINT32 AcpiBase;
+ UINT32 TcoBase;
+ UINTN PciBaseAddress;
+ UINTN index;
+ UINTN i;
+ UINT8 PowerState;
+ UINT8 CapOffset;
+ UINT32 PciBar;
+ UINT32 Mask;
+ UINT32 Address;
+ PCH_SERIES PchSeries;
+
+ AcpiBase = PchLpcPciCfg32(R_PCH_LPC_ACPI_BASE) & B_PCH_LPC_ACPI_BASE_BAR;
+ TcoBase = AcpiBase + PCH_TCO_BASE;
+ PowerState = 0x0;
+ PchSeries = GetPchSeries();
+
+ ///
+ /// Saving IO and MMIO registers
+ ///
+ for (i = 0; i < ARRAY_SIZE (PchSaveRestoreRegWrap); i++) {
+ if (PchSeries != PchSaveRestoreRegWrap[i].PchSeries) {
+ continue;
+ }
+ for (index = 0; index < PchSaveRestoreRegWrap[i].size; index++) {
+ Mask = PchSaveRestoreRegWrap[i].PchSaveRestoreReg[index].Mask;
+ switch (PchSaveRestoreRegWrap[i].PchSaveRestoreReg[index].AccessType) {
+ case Tco:
+ Address = TcoBase + PchSaveRestoreRegWrap[i].PchSaveRestoreReg[index].Address;
+ switch (PchSaveRestoreRegWrap[i].PchSaveRestoreReg[index].Width) {
+ case 4:
+ PchSaveRestoreRegWrap[i].PchSaveRestoreReg[index].Data = (IoRead32 (Address)) & Mask;
+ break;
+ case 2:
+ PchSaveRestoreRegWrap[i].PchSaveRestoreReg[index].Data = (IoRead16 (Address)) & Mask;
+ break;
+ case 1:
+ PchSaveRestoreRegWrap[i].PchSaveRestoreReg[index].Data = (IoRead8 (Address)) & Mask;
+ break;
+ }
+ break;
+ case Acpi:
+ Address = AcpiBase + PchSaveRestoreRegWrap[i].PchSaveRestoreReg[index].Address;
+ switch (PchSaveRestoreRegWrap[i].PchSaveRestoreReg[index].Width) {
+ case 4:
+ PchSaveRestoreRegWrap[i].PchSaveRestoreReg[index].Data = (IoRead32 (Address)) & Mask;
+ break;
+ case 2:
+ PchSaveRestoreRegWrap[i].PchSaveRestoreReg[index].Data = (IoRead16 (Address)) & Mask;
+ break;
+ case 1:
+ PchSaveRestoreRegWrap[i].PchSaveRestoreReg[index].Data = (IoRead8 (Address)) & Mask;
+ break;
+ }
+ break;
+ case Rcrb:
+ Address = PchSaveRestoreRegWrap[i].PchSaveRestoreReg[index].Address;
+ switch (PchSaveRestoreRegWrap[i].PchSaveRestoreReg[index].Width) {
+ case 4:
+ PchSaveRestoreRegWrap[i].PchSaveRestoreReg[index].Data = (PchMmRcrb32 (Address)) & Mask;
+ break;
+ case 2:
+ PchSaveRestoreRegWrap[i].PchSaveRestoreReg[index].Data = (PchMmRcrb16 (Address)) & Mask;
+ break;
+ case 1:
+ PchSaveRestoreRegWrap[i].PchSaveRestoreReg[index].Data = (PchMmRcrb8 (Address)) & Mask;
+ break;
+ }
+ break;
+ }
+ }
+ }
+
+ ///
+ /// Saving PCI config space and PCI bar registers
+ ///
+ for (i = 0; i < ARRAY_SIZE (PchSaveRestorePciRegWrap); i++) {
+ if (PchSeries != PchSaveRestorePciRegWrap[i].PchSeries) {
+ continue;
+ }
+ for (index = 0; index < PchSaveRestorePciRegWrap[i].size; index++) {
+ PciBaseAddress = MmPciAddress(
+ 0,
+ 0,
+ PchSaveRestorePciRegWrap[i].PchSaveRestorePci[index].Device,
+ PchSaveRestorePciRegWrap[i].PchSaveRestorePci[index].Function,
+ 0
+ );
+ if (MmioRead32(PciBaseAddress) == 0xFFFFFFFF) {
+ continue;
+ }
+ Mask = PchSaveRestorePciRegWrap[i].PchSaveRestorePci[index].Mask;
+ switch (PchSaveRestorePciRegWrap[i].PchSaveRestorePci[index].AccessType) {
+ case PciCfg:
+ Address = (UINT32) PciBaseAddress + PchSaveRestorePciRegWrap[i].PchSaveRestorePci[index].Offset;
+ switch (PchSaveRestorePciRegWrap[i].PchSaveRestorePci[index].Width) {
+ case 4:
+ PchSaveRestorePciRegWrap[i].PchSaveRestorePci[index].Data = (MmioRead32 (Address)) & Mask;
+ break;
+ case 2:
+ PchSaveRestorePciRegWrap[i].PchSaveRestorePci[index].Data = (MmioRead16 (Address)) & Mask;
+ break;
+ case 1:
+ PchSaveRestorePciRegWrap[i].PchSaveRestorePci[index].Data = (MmioRead8 (Address)) & Mask;
+ break;
+ }
+ break;
+ case PciMmr:
+ PciBar = MmioRead32 (PciBaseAddress + PchSaveRestorePciRegWrap[i].PchSaveRestorePci[index].BarOffset);
+ CapOffset = PcieFindCapId (
+ 0,
+ PchSaveRestorePciRegWrap[i].PchSaveRestorePci[index].Device,
+ PchSaveRestorePciRegWrap[i].PchSaveRestorePci[index].Function,
+ EFI_PCI_CAPABILITY_ID_PCIPM
+ );
+ if (CapOffset != 0) {
+ PowerState = MmioRead8(PciBaseAddress + CapOffset + 0x4) & (BIT1 | BIT0);
+ if (PowerState == DeviceD3) {
+ ///
+ /// Bring up device to D0
+ ///
+ MmioAnd8 (PciBaseAddress + CapOffset + 0x4, (UINT8)~(BIT1 | BIT0));
+ MmioWrite32 (PciBaseAddress + PchSaveRestorePciRegWrap[i].PchSaveRestorePci[index].BarOffset, PciBar);
+ MmioWrite8 (PciBaseAddress + PCI_COMMAND_OFFSET, BIT1);
+ SaveDevPowState(PchSaveRestorePciRegWrap[i].PchSaveRestorePci[index].Device, PchSaveRestorePciRegWrap[i].PchSaveRestorePci[index].Function);
+ }
+ }
+ PciBar = PciBar & (UINT32)~(0xF);
+ if (PciBar == 0x0) {
+ continue;
+ }
+ Address = PciBar + PchSaveRestorePciRegWrap[i].PchSaveRestorePci[index].Offset;
+ switch (PchSaveRestorePciRegWrap[i].PchSaveRestorePci[index].Width) {
+ case 4:
+ PchSaveRestorePciRegWrap[i].PchSaveRestorePci[index].Data = (MmioRead32 (Address)) & Mask;
+ break;
+ case 2:
+ PchSaveRestorePciRegWrap[i].PchSaveRestorePci[index].Data = (MmioRead16 (Address)) & Mask;
+ break;
+ case 1:
+ PchSaveRestorePciRegWrap[i].PchSaveRestorePci[index].Data = (MmioRead8 (Address)) & Mask;
+ break;
+ }
+ break;
+ }
+ }
+ }
+
+ ///
+ /// Restore devices to D3
+ ///
+ RestoreDevPowState();
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Initializes the PCH SMM handler for PCH save and restore
+
+ @param[in] ImageHandle - Handle for the image of this driver
+ @param[in] SystemTable - Pointer to the EFI System Table
+
+ @retval EFI_SUCCESS - PCH SMM handler was installed
+**/
+EFI_STATUS
+PchLateInitSmmEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ EFI_PHYSICAL_ADDRESS MemBase;
+ EFI_SMM_IO_TRAP_DISPATCH_PROTOCOL *PchIoTrap;
+ EFI_SMM_IO_TRAP_DISPATCH_REGISTER_CONTEXT PchIoTrapContext;
+ EFI_HANDLE PchIoTrapHandle;
+ EFI_SMM_SX_DISPATCH_CONTEXT SxDispatchContext;
+ EFI_SMM_SX_DISPATCH_PROTOCOL *SxDispatchProtocol;
+ EFI_HANDLE SxDispatchHandle;
+ PCH_LATE_INIT_SMM_VARIABLE SaveRestoreData;
+
+ DEBUG ((EFI_D_INFO, "PchLateInitSmmEntryPoint()\n"));
+
+ ///
+ /// Locate the PCH Trap dispatch protocol
+ ///
+ Status = gBS->LocateProtocol (&gEfiSmmIoTrapDispatchProtocolGuid, NULL, &PchIoTrap);
+ ASSERT_EFI_ERROR (Status);
+
+ PchIoTrapContext.Type = ReadWriteTrap;
+ PchIoTrapContext.Length = 4;
+ PchIoTrapContext.Address = 0;
+ PchIoTrapContext.Context = NULL;
+ PchIoTrapContext.MergeDisable = FALSE;
+ Status = PchIoTrap->Register (
+ PchIoTrap,
+ PchIoTrapSmiCallback,
+ &PchIoTrapContext,
+ &PchIoTrapHandle
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ SaveRestoreData.IoTrapAddress = PchIoTrapContext.Address;
+
+ DEBUG ((EFI_D_INFO, "PchIotrapSmiAddress = 0x%x\n", PchIoTrapContext.Address));
+
+ ///
+ /// Locate the Sx Dispatch Protocol
+ ///
+ Status = gBS->LocateProtocol (
+ &gEfiSmmSxDispatchProtocolGuid,
+ NULL,
+ &SxDispatchProtocol
+ );
+ ASSERT_EFI_ERROR (Status);
+ ///
+ /// Register the callback for S3 entry
+ ///
+ SxDispatchContext.Type = SxS3;
+ SxDispatchContext.Phase = SxEntry;
+ Status = SxDispatchProtocol->Register (
+ SxDispatchProtocol,
+ PchS3EntryCallBack,
+ &SxDispatchContext,
+ &SxDispatchHandle
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ MemBase = 0x0ffffffff;
+#ifndef AMI_OVERRIDE_FOR_SMM
+ Status = gDS->AllocateMemorySpace (
+ EfiGcdAllocateMaxAddressSearchTopDown,
+ EfiGcdMemoryTypeMemoryMappedIo,
+ 16, // 2^16: 64K Alignment
+ 0x10000, // 64K Length
+ &MemBase,
+ ImageHandle,
+ NULL
+ );
+#else
+ Status = gDS->AllocateMemorySpace (
+ EfiGcdAllocateMaxAddressSearchBottomUp,
+ EfiGcdMemoryTypeMemoryMappedIo,
+ 16, // 2^16: 64K Alignment
+ 0x10000, // 64K Length
+ &MemBase,
+ ImageHandle,
+ NULL
+ );
+#endif // AMI_OVERRIDE_FOR_SMM
+ ASSERT_EFI_ERROR (Status);
+
+ PciMemBase = (UINT32) MemBase;
+
+ SaveRestoreData.PciMemBase = PciMemBase;
+
+ Status = gRT->SetVariable (
+ PCH_INIT_PEI_VARIABLE_NAME,
+ &gPchInitPeiVariableGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
+ sizeof (PCH_LATE_INIT_SMM_VARIABLE),
+ &SaveRestoreData
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Smm/PchLateInitSmm.cif b/ReferenceCode/Chipset/LynxPoint/PchInit/Smm/PchLateInitSmm.cif
new file mode 100644
index 0000000..260cf93
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Smm/PchLateInitSmm.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "PchLateInitSmm"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\PchInit\Smm"
+ RefName = "PchLateInitSmm"
+[files]
+"PchLateInitSmm.sdl"
+"PchLateInitSmm.mak"
+"PchLateInitSmm.c"
+"PchLateInitSmm.h"
+"PchLateInitSmm.dxs"
+"PchLateInitSmm.inf"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Smm/PchLateInitSmm.dxs b/ReferenceCode/Chipset/LynxPoint/PchInit/Smm/PchLateInitSmm.dxs
new file mode 100644
index 0000000..32f981f
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Smm/PchLateInitSmm.dxs
@@ -0,0 +1,46 @@
+/** @file
+ Dependency expression source file.
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "DxeDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+
+#include EFI_PROTOCOL_DEPENDENCY (SmmBase)
+#include EFI_PROTOCOL_DEPENDENCY (SmmIoTrapDispatch)
+#include EFI_ARCH_PROTOCOL_DEFINITION (Variable)
+#include EFI_ARCH_PROTOCOL_DEFINITION (VariableWrite)
+#endif
+
+DEPENDENCY_START
+ EFI_SMM_BASE_PROTOCOL_GUID AND
+ EFI_SMM_IO_TRAP_DISPATCH_PROTOCOL_GUID AND
+ EFI_VARIABLE_ARCH_PROTOCOL_GUID AND
+ EFI_VARIABLE_WRITE_ARCH_PROTOCOL_GUID
+DEPENDENCY_END
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Smm/PchLateInitSmm.h b/ReferenceCode/Chipset/LynxPoint/PchInit/Smm/PchLateInitSmm.h
new file mode 100644
index 0000000..0082af0
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Smm/PchLateInitSmm.h
@@ -0,0 +1,106 @@
+/** @file
+ Header file for PCH SMM Handler
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+#ifndef _PCHLATEINITSMM_H_
+#define _PCHLATEINITSMM_H_
+
+///
+/// External include files do NOT need to be explicitly specified in real EDKII
+/// environment
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "PchAccess.h"
+#include "PchPlatformLib.h"
+#include "PchInitVar.h"
+#include "pci22.h"
+#endif
+///
+/// Driver Consumed Protocol Prototypes
+///
+#include EFI_PROTOCOL_DEPENDENCY (SmmBase)
+#include EFI_PROTOCOL_DEPENDENCY (SmmIoTrapDispatch)
+#include EFI_PROTOCOL_DEPENDENCY (SmmSxDispatch)
+
+#define EFI_PCI_CAPABILITY_ID_PCIPM 0x01
+
+#define DeviceD0 0x00
+#define DeviceD3 0x03
+
+#define ARRAY_SIZE(data) (sizeof (data) / sizeof (data[0]))
+
+typedef enum {
+ PciCfg,
+ PciMmr
+} PCH_PCI_ACCESS_TYPE;
+
+typedef enum {
+ Acpi,
+ Rcrb,
+ Tco
+} PCH_ACCESS_TYPE;
+
+typedef struct {
+ PCH_ACCESS_TYPE AccessType;
+ UINT32 Address;
+ UINT32 Data;
+ UINT32 Mask;
+ UINT8 Width;
+} PCH_SAVE_RESTORE_REG;
+
+typedef struct {
+ PCH_SAVE_RESTORE_REG* PchSaveRestoreReg;
+ UINT8 size;
+ PCH_SERIES PchSeries;
+} PCH_SAVE_RESTORE_REG_WRAP;
+
+struct _PCH_SAVE_RESTORE_PCI;
+
+typedef struct _PCH_SAVE_RESTORE_PCI{
+ PCH_PCI_ACCESS_TYPE AccessType;
+ UINT8 Device;
+ UINT8 Function;
+ UINT8 BarOffset;
+ UINT16 Offset;
+ UINT32 Data;
+ UINT32 Mask;
+ UINT8 Width;
+ VOID (*RestoreFunction)(struct _PCH_SAVE_RESTORE_PCI *PchSaveRestorePci);
+} PCH_SAVE_RESTORE_PCI;
+
+typedef struct {
+ PCH_SAVE_RESTORE_PCI* PchSaveRestorePci;
+ UINT8 size;
+ PCH_SERIES PchSeries;
+} PCH_SAVE_RESTORE_PCI_WRAP;
+
+typedef struct {
+ UINT8 Device;
+ UINT8 Function;
+ UINT8 PowerState;
+} DEVICE_POWER_STATE;
+
+VOID
+RestorePxDevSlp(
+ IN PCH_SAVE_RESTORE_PCI *PchSaveRestorePci
+ );
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Smm/PchLateInitSmm.inf b/ReferenceCode/Chipset/LynxPoint/PchInit/Smm/PchLateInitSmm.inf
new file mode 100644
index 0000000..9f04d49
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Smm/PchLateInitSmm.inf
@@ -0,0 +1,88 @@
+## @file
+# Component description file for the PCH late initialization SMM module.
+#
+#@copyright
+# Copyright (c) 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = PchLateInitSmm
+FILE_GUID = D7B10D4E-67E6-4C74-83E9-F9AF0ACC33CC
+COMPONENT_TYPE = BS_DRIVER
+
+[sources.common]
+ PchLateInitSmm.c
+ PchLateInitSmm.h
+ ../Common/PchInitVar.c
+
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueSmmDriverEntryPoint.c
+[includes.common]
+ $(EDK_SOURCE)/Foundation/Efi
+ .
+ ../Common
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/SampleCode/Include
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/SampleCode
+
+[libraries.common]
+ EdkFrameworkProtocolLib
+ $(PROJECT_PCH_FAMILY)ProtocolLib
+ PchPlatformLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueSmmRuntimeDxeReportStatusCodeLib
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueDxeServicesTableLib
+ EdkIIGlueDxeMemoryAllocationLib
+ EdkProtocolLib
+ EfiScriptLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT=_ModuleEntryPoint
+ DPX_SOURCE=PchLateInitSmm.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=PchLateInitSmmEntryPoint
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_SMM_RUNTIME_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Smm/PchLateInitSmm.mak b/ReferenceCode/Chipset/LynxPoint/PchInit/Smm/PchLateInitSmm.mak
new file mode 100644
index 0000000..d9cf9b7
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Smm/PchLateInitSmm.mak
@@ -0,0 +1,97 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchLateInitSmm.mak 1 12/18/12 4:55a Scottyang $
+#
+# $Revision: 1 $
+#
+# $Date: 12/18/12 4:55a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchLateInitSmm.mak $
+#
+# 1 12/18/12 4:55a Scottyang
+# [TAG] EIP109697
+# [Category] Improvement
+# [Description] Update PCH RC 0.8.1
+# [Files] ReferenceCode\Chipset\LynxPoint\*.*, SBDxe.c, SBPEI.c, SB.sd,
+# SbSetupData.c, GetSetupDate.c
+#
+#*************************************************************************
+#---------------------------------------------------------------------------
+# Create PchLateInitSmm Driver
+#---------------------------------------------------------------------------
+EDK : PchLateInitSmm
+PchLateInitSmm : $(BUILD_DIR)\PchLateInitSmm.mak PchLateInitSmmBin
+
+$(BUILD_DIR)\PchLateInitSmm.mak : $(PchLateInitSmm_DIR)\$(@B).cif $(PchLateInitSmm_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(PchLateInitSmm_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+PchLateInitSmm_INCLUDES=\
+ /I$(INTEL_PCH_DIR)\PchInit\Common\
+ $(INTEL_PCH_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ /I$(EDK_SOURCE)\Foundation\Efi\Include\
+
+PchLateInitSmm_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=PchLateInitSmmEntryPoint"\
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_SMM_RUNTIME_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+
+PchLateInitSmm_LIB_LINKS =\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(INTEL_PCH_PROTOCOL_LIB)\
+ $(PchPlatformDxeLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueSmmRuntimeDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueUefiRuntimeServicesTableLib_LIB)\
+ $(EdkIIGlueDxeServicesTableLib_LIB)\
+ $(EdkIIGlueDxeMemoryAllocationLib_LIB)\
+ $(EDKPROTOCOLLIB)\
+ $(EFISCRIPTLIB)\
+ $(PchUsbCommonDxeLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+
+PchLateInitSmmBin: $(PchLateInitSmm_LIB_LINKS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\PchLateInitSmm.mak all \
+ "MY_INCLUDES=$(PchLateInitSmm_INCLUDES)" \
+ "MY_DEFINES=$(PchLateInitSmm_DEFINES)" \
+ GUID=D7B10D4E-67E6-4C74-83E9-F9AF0ACC33CC\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=BS_DRIVER\
+ EDKIIModule=SMMDRIVER\
+ DEPEX1=$(PchLateInitSmm_DIR)\PchLateInitSmm.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \
+ COMPRESS=1
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/PchInit/Smm/PchLateInitSmm.sdl b/ReferenceCode/Chipset/LynxPoint/PchInit/Smm/PchLateInitSmm.sdl
new file mode 100644
index 0000000..efb0a48
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchInit/Smm/PchLateInitSmm.sdl
@@ -0,0 +1,71 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchLateInitSmm.sdl 1 12/18/12 4:55a Scottyang $
+#
+# $Revision: 1 $
+#
+# $Date: 12/18/12 4:55a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchLateInitSmm.sdl $
+#
+# 1 12/18/12 4:55a Scottyang
+# [TAG] EIP109697
+# [Category] Improvement
+# [Description] Update PCH RC 0.8.1
+# [Files] ReferenceCode\Chipset\LynxPoint\*.*, SBDxe.c, SBPEI.c, SB.sd,
+# SbSetupData.c, GetSetupDate.c
+#
+#*************************************************************************
+TOKEN
+ Name = "PchLateInitSmm_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable PchLateInitSmm support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "PchLateInitSmm_DIR"
+End
+
+MODULE
+ File = "PchLateInitSmm.mak"
+ Help = "Includes PchLateInitSmm to Project"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PchLateInitSmm.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmiDispatcher.cif b/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmiDispatcher.cif
new file mode 100644
index 0000000..51c2e34
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmiDispatcher.cif
@@ -0,0 +1,24 @@
+<component>
+ name = "PchSmiDispatcher"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\PchSmiDispatcher\Smm"
+ RefName = "PchSmiDispatcher"
+[files]
+"PchSmiDispatcher.sdl"
+"PchSmiDispatcher.mak"
+"PchSmm.h"
+"PchSmmCore.c"
+"PchSmmHelpers.h"
+"PchSmmHelpers.c"
+"PchxSmmHelpers.h"
+"PchxSmmHelpers.c"
+"PchSmmUsb.c"
+"PchSmmGpi.c"
+"PchSmmPowerButton.c"
+"PchSmmSw.c"
+"PchSmmSx.c"
+"PchSmmIchn.c"
+"PchSmmPeriodicTimer.c"
+"PchSmiDispatcher.dxs"
+"PchSmiDispatcher.inf"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmiDispatcher.dxs b/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmiDispatcher.dxs
new file mode 100644
index 0000000..e0f4908
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmiDispatcher.dxs
@@ -0,0 +1,43 @@
+/** @file
+ Dispatch dependency expression file for the PchSmmDispatcher driver.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "DxeDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+
+#include EFI_PROTOCOL_DEFINITION (SmmBase)
+#include EFI_PROTOCOL_CONSUMER(PciRootBridgeIo)
+#endif
+
+DEPENDENCY_START
+ EFI_SMM_BASE_PROTOCOL_GUID AND
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GUID
+DEPENDENCY_END
diff --git a/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmiDispatcher.inf b/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmiDispatcher.inf
new file mode 100644
index 0000000..a251b73
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmiDispatcher.inf
@@ -0,0 +1,104 @@
+## @file
+# Component description file for the Pch SMI Dispatch Handlers module
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = PchSmiDispatcher
+FILE_GUID = B0D6ED53-B844-43f5-BD2F-61095264E77E
+COMPONENT_TYPE = BS_DRIVER
+
+[sources.common]
+ PchSmm.h
+ PchSmmCore.c
+ PchSmmHelpers.h
+ PchSmmHelpers.c
+ PchxSmmHelpers.h
+ PchxSmmHelpers.c
+ PchSmmUsb.c
+ PchSmmGpi.c
+ PchSmmPowerButton.c
+ PchSmmSw.c
+ PchSmmSx.c
+ PchSmmIchn.c
+ PchSmmPeriodicTimer.c
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueSmmDriverEntryPoint.c
+
+[libraries.common]
+ EdkIIGlueBaseLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueBaseMemoryLib
+ EdkIIGlueDxeMemoryAllocationLib
+ EdkIIGlueSmmRuntimeDxeReportStatusCodeLib
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueDxeServicesTableLib
+ EdkIIGlueUefiDevicePathLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueBasePciLibPciExpress
+ EdkFrameworkProtocolLib
+ EdkProtocolLib
+ $(PROJECT_PCH_FAMILY)ProtocolLib
+ PchPlatformLib
+ EdkIIGlueSmmFirmwarePerformanceLib
+
+[libraries.ia32,libraries.x64]
+
+[includes.common]
+ .
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Cpu/Pentium/Include
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = PchSmiDispatcher.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=InitializePchSmmDispatcher
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_LIB__ \
+ -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ -D __EDKII_GLUE_SMM_RUNTIME_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_DEVICE_PATH_LIB__ \
+ -D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__
+
diff --git a/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmiDispatcher.mak b/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmiDispatcher.mak
new file mode 100644
index 0000000..d4308f8
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmiDispatcher.mak
@@ -0,0 +1,115 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSmiDispatcher/PchSmiDispatcher.mak 3 6/24/13 6:08a Scottyang $
+#
+# $Revision: 3 $
+#
+# $Date: 6/24/13 6:08a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSmiDispatcher/PchSmiDispatcher.mak $
+#
+# 3 6/24/13 6:08a Scottyang
+# [TAG] EIP127297
+# [Category] Improvement
+# [Description] Update PCH RC 1.6.0.
+# [Files] SB.sd, SBDxe.c, ..\ReferenceCode\Chipset\LynxPoint\*.*
+#
+# 2 2/24/12 2:14a Victortu
+# Updated to support 4.6.5.3_IntelEDK_1117_Patch7_00.
+#
+# 1 2/08/12 8:54a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+
+#---------------------------------------------------------------------------
+# Create PchSmiDispatcher Driver
+#---------------------------------------------------------------------------
+EDK : PchSmiDispatcher
+PchSmiDispatcher : $(BUILD_DIR)\PchSmiDispatcher.mak PchSmiDispatcherBin
+
+
+$(BUILD_DIR)\PchSmiDispatcher.mak : $(PchSmiDispatcher_DIR)\$(@B).cif $(PchSmiDispatcher_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(PchSmiDispatcher_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+PchSmiDispatcher_INCLUDES=\
+ $(INTEL_PCH_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+
+PchSmiDispatcher_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=InitializePchSmmDispatcher"\
+ /D __EDKII_GLUE_BASE_LIB__ \
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_SMM_RUNTIME_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_UEFI_DEVICE_PATH_LIB__ \
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+ /D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+
+PchSmiDispatcher_LIB_LINKS =\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGlueDxeMemoryAllocationLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueSmmRuntimeDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueUefiDevicePathLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(EDKPROTOCOLLIB)\
+ $(INTEL_PCH_PROTOCOL_LIB)\
+ $(PchPlatformSmmLib_LIB)\
+ $(EdkIIGlueSmmFirmwarePerformanceLib_LIB)\
+ $(EdkIIGlueUefiRuntimeServicesTableLib_LIB)\
+ $(EdkIIGlueDxeServicesTableLib_LIB)\
+
+PchSmiDispatcherBin: $(COMPILERSTUB) $(PchSmiDispatcher_LIB_LINKS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\PchSmiDispatcher.mak all \
+ "MY_INCLUDES=$(PchSmiDispatcher_INCLUDES)" \
+ "MY_DEFINES=$(PchSmiDispatcher_DEFINES)" \
+ GUID=B0D6ED53-B844-43f5-BD2F-61095264E77E\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=BS_DRIVER\
+ EDKIIModule=SMMDRIVER\
+ DEPEX1=$(PchSmiDispatcher_DIR)\PchSmiDispatcher.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \
+ COMPRESS=1
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmiDispatcher.sdl b/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmiDispatcher.sdl
new file mode 100644
index 0000000..93c2ae0
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmiDispatcher.sdl
@@ -0,0 +1,102 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSmiDispatcher/PchSmiDispatcher.sdl 3 12/30/13 5:10a Barretlin $
+#
+# $Revision: 3 $
+#
+# $Date: 12/30/13 5:10a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSmiDispatcher/PchSmiDispatcher.sdl $
+#
+# 3 12/30/13 5:10a Barretlin
+# [TAG] EIP145008
+# [Category] Improvement
+# [Description] Force Power button event phase always as entry to avoid
+# some power button issue
+# [Files] PchSmiDispatcher.sdl PchSmmPowerButton.c
+#
+# 2 4/25/12 9:22a Victortu
+# [TAG] None
+# [Category] Improvement
+# [Description] Reprogram SMM ChildDispatcher drivers.
+# [Files] SmiHandlerGeneric.c; SmiHandlerPorting.c;
+# SmiHandlerGeneric2.c; SmmChildDispatch2Main.c; SmmChildDispatcher2.mak;
+# SmmChildDispatcher2.sdl; SmmChildDispatch.h; SmmChildDispatchMain.c;
+# SmmChildDispatchProtocol.c; SmmChildDispatcher.dxs;
+# PchSmiDispatcher.sdl
+#
+# 1 2/08/12 8:54a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+TOKEN
+ Name = "PchSmiDispatcher_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable PchSmiDispatcher support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+End
+
+TOKEN
+ Name = "INTEL_RC_SMI_DISPATCHER_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetH = Yes
+ Lock = Yes
+End
+
+TOKEN
+ Name = "FORCE_PWB_PHASE_AS_ENTRY"
+ Value = "1"
+ Help = "Force Power button event phase always as entry to avoid some power button issue. EIP145008"
+ TokenType = Boolean
+ TargetH = Yes
+End
+
+PATH
+ Name = "PchSmiDispatcher_DIR"
+ Help = "PchSmiDispatcher file source directory"
+End
+
+MODULE
+ Help = "Includes PchSmiDispatcher.mak to Project"
+ File = "PchSmiDispatcher.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PchSmiDispatcher.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmm.h b/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmm.h
new file mode 100644
index 0000000..864615b
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmm.h
@@ -0,0 +1,727 @@
+/** @file
+ Prototypes and defines for the PCH SMM Dispatcher.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#ifndef PCH_SMM_H
+#define PCH_SMM_H
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+
+#include "EdkIIGlueDxe.h"
+
+//
+// Driver Consumed Protocol Prototypes
+//
+//
+// Used during initialization
+//
+#include EFI_PROTOCOL_DEPENDENCY (PciRootBridgeIo)
+#include EFI_PROTOCOL_CONSUMER (LoadedImage)
+//
+// Used during SMI dispatch
+//
+#include EFI_PROTOCOL_DEPENDENCY (SmmBase)
+#include EFI_PROTOCOL_CONSUMER (SmmControl)
+//
+// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// SUPPORTED PROTOCOLS
+//
+#include EFI_PROTOCOL_PRODUCER (SmmUsbDispatch)
+#include EFI_PROTOCOL_PRODUCER (SmmSxDispatch)
+#include EFI_PROTOCOL_PRODUCER (SmmSwDispatch)
+#include EFI_PROTOCOL_PRODUCER (SmmGpiDispatch)
+#include EFI_PROTOCOL_PRODUCER (SmmIchnDispatch)
+#include EFI_PROTOCOL_PRODUCER (SmmIchnDispatchEx)
+#include EFI_PROTOCOL_PRODUCER (SmmPowerButtonDispatch)
+#include EFI_PROTOCOL_PRODUCER (SmmPeriodicTimerDispatch)
+#include "PchAccess.h"
+#include "PchPlatformLib.h"
+#endif
+///
+/// Define an enumeration for all the supported protocols
+///
+typedef enum {
+ UsbType,
+ SxType,
+ SwType,
+ GpiType,
+ IchnType,
+ IchnExType,
+ PowerButtonType,
+ PeriodicTimerType,
+ PchSmmProtocolTypeMax
+} PCH_SMM_PROTOCOL_TYPE;
+
+///
+/// SPECIFYING A REGISTER
+/// We want a general way of referring to addresses. For this case, we'll only
+/// need addresses in the ACPI table (and the TCO entries within the ACPI table).
+/// However, it's interesting to consider what it would take to support other types
+/// of addresses. To address Will's concern, I think it prudent to accommodate it
+/// early on in the design.
+///
+/// Addresses we need to consider:
+///
+/// Type: Required:
+/// I/O Yes
+/// ACPI (special case of I/O) Only if we want to
+/// TCO (special case of ACPI) Only if we want to
+/// GPIO (special case of I/O) Only if we want to
+/// Memory (or Memory Mapped I/O) Only if we want to
+/// PCIE Yes, for BiosWp
+///
+typedef enum {
+ ///
+ /// IO_ADDR_TYPE, /// unimplemented
+ ///
+ ACPI_ADDR_TYPE,
+ GPIO_ADDR_TYPE,
+ ///
+ /// MEMORY_ADDR_TYPE, /// unimplemented
+ ///
+ MEMORY_MAPPED_IO_ADDRESS_TYPE,
+ PCIE_ADDR_TYPE,
+ NUM_ADDR_TYPES, ///< count of items in this enum
+ PCH_SMM_ADDR_TYPE_NULL = -1 ///< sentinel to indicate NULL or to signal end of arrays
+} ADDR_TYPE;
+
+//
+// Assumption: 32-bits -- enum's evaluate to integer
+// Assumption: This code will only run on IA-32. Justification: IA-64 doesn't have SMIs.
+// We don't have to worry about 64-bit addresses.
+// Typedef the size of addresses in case the numbers I'm using are wrong or in case
+// this changes. This is a good idea because PCI_ADDR will change, for example, when
+// we add support for PciExpress.
+//
+typedef UINT16 IO_ADDR;
+typedef IO_ADDR GPIO_ADDR;
+typedef IO_ADDR ACPI_ADDR; ///< can omit
+typedef IO_ADDR TCO_ADDR; ///< can omit
+typedef UINTN MEM_ADDR;
+typedef MEM_ADDR *MEMORY_MAPPED_IO_ADDRESS;
+typedef union {
+ UINT32 Raw;
+ struct {
+ UINT8 Reg;
+ UINT8 Fnc;
+ UINT8 Dev;
+ UINT8 Bus;
+ } Fields;
+} PCIE_ADDR;
+
+typedef struct {
+ ADDR_TYPE Type;
+ union {
+ ///
+ /// used to initialize during declaration/definition
+ ///
+ UINT32 raw;
+
+ ///
+ /// used to access useful data
+ ///
+ IO_ADDR io;
+ ACPI_ADDR acpi;
+ TCO_ADDR tco;
+ GPIO_ADDR gpio;
+ MEM_ADDR mem;
+ MEMORY_MAPPED_IO_ADDRESS Mmio;
+ PCIE_ADDR pcie;
+
+ } Data;
+
+} PCH_SMM_ADDRESS;
+
+///
+/// SPECIFYING BITS WITHIN A REGISTER
+/// Here's a struct that helps us specify a source or enable bit.
+///
+typedef struct {
+ PCH_SMM_ADDRESS Reg;
+ UINT8 SizeInBytes; ///< of the register
+ UINT8 Bit;
+} PCH_SMM_BIT_DESC;
+
+//
+// Sometimes, we'll have bit descriptions that are unused. It'd be great to have a
+// way to easily identify them:
+//
+#define IS_BIT_DESC_NULL(BitDesc) ((BitDesc).Reg.Type == PCH_SMM_ADDR_TYPE_NULL) ///< "returns" true when BitDesc is NULL
+#define NULL_THIS_BIT_DESC(BitDesc) ((BitDesc).Reg.Type = PCH_SMM_ADDR_TYPE_NULL) ///< will "return" an integer w/ value of 0
+#define NULL_BIT_DESC_INITIALIZER \
+ { \
+ { \
+ PCH_SMM_ADDR_TYPE_NULL, \
+ { \
+ 0 \
+ } \
+ }, \
+ 0, 0 \
+ }
+//
+// I'd like a type to specify the callback's Sts & En bits because they'll
+// be commonly used together:
+//
+#define NUM_EN_BITS 2
+#define NUM_STS_BITS 1
+
+//
+// Flags
+//
+typedef UINT8 PCH_SMM_SOURCE_FLAGS;
+
+//
+// Flags required today
+//
+#define PCH_SMM_NO_FLAGS 0
+#define PCH_SMM_SCI_EN_DEPENDENT 1
+
+//
+// Flags that might be required tomorrow
+//
+///
+/// #define PCH_SMM_CLEAR_WITH_ONE 2 /// may need to support bits that clear by writing 0
+/// #define PCH_SMM_MULTIBIT_FIELD 3 /// may need to support status/enable fields 2 bits wide
+///
+typedef struct {
+ PCH_SMM_SOURCE_FLAGS Flags;
+ PCH_SMM_BIT_DESC En[NUM_EN_BITS];
+ PCH_SMM_BIT_DESC Sts[NUM_STS_BITS];
+} PCH_SMM_SOURCE_DESC;
+//
+// 31 bytes, I think
+//
+#define NULL_SOURCE_DESC_INITIALIZER \
+ { \
+ PCH_SMM_NO_FLAGS, \
+ { \
+ NULL_BIT_DESC_INITIALIZER, NULL_BIT_DESC_INITIALIZER \
+ }, \
+ { \
+ NULL_BIT_DESC_INITIALIZER \
+ } \
+ }
+
+///
+/// CHILD CONTEXTS
+/// To keep consistent w/ the architecture, we'll need to provide the context
+/// to the child when we call its callback function. After talking with Will,
+/// we agreed that we'll need functions to "dig" the context out of the hardware
+/// in many cases (Sx, Trap, Gpi, etc), and we'll need a function to compare those
+/// contexts to prevent unnecessary dispatches. I'd like a general type for these
+/// "GetContext" functions, so I'll need a union of all the protocol contexts for
+/// our internal use:
+///
+typedef union {
+ //
+ // (in no particular order)
+ //
+ EFI_SMM_ICHN_DISPATCH_CONTEXT Ichn;
+ EFI_SMM_ICHN_DISPATCH_EX_CONTEXT IchnEx;
+ EFI_SMM_SX_DISPATCH_CONTEXT Sx;
+ EFI_SMM_PERIODIC_TIMER_DISPATCH_CONTEXT PeriodicTimer;
+ EFI_SMM_SW_DISPATCH_CONTEXT Sw;
+ EFI_SMM_POWER_BUTTON_DISPATCH_CONTEXT PowerButton;
+ EFI_SMM_USB_DISPATCH_CONTEXT Usb;
+ EFI_SMM_GPI_DISPATCH_CONTEXT Gpi;
+} PCH_SMM_CONTEXT;
+//
+// Assumption: PeriodicTimer largest at 3x64-bits or 24 bytes
+//
+typedef struct _DATABASE_RECORD DATABASE_RECORD;
+
+///
+/// Assumption: the GET_CONTEXT function will be as small and simple as possible.
+/// Assumption: We don't need to pass in an enumeration for the protocol because each
+/// GET_CONTEXT function is written for only one protocol.
+/// We also need a function to compare contexts to see if the child should be dispatched
+///
+typedef
+VOID
+(EFIAPI *GET_CONTEXT) (
+ IN DATABASE_RECORD * Record,
+ OUT PCH_SMM_CONTEXT * Context
+ );
+
+typedef
+BOOLEAN
+(EFIAPI *CMP_CONTEXT) (
+ IN PCH_SMM_CONTEXT * Context1,
+ IN PCH_SMM_CONTEXT * Context2
+ );
+
+///
+/// Finally, every protocol will require a "Get Context" and "Compare Context" call, so
+/// we may as well wrap that up in a table, too.
+///
+typedef struct {
+ GET_CONTEXT GetContext;
+ CMP_CONTEXT CmpContext;
+} CONTEXT_FUNCTIONS;
+
+extern CONTEXT_FUNCTIONS ContextFunctions[PchSmmProtocolTypeMax];
+
+///
+/// MAPPING CONTEXT TO BIT DESCRIPTIONS
+/// I'd like to have a general approach to mapping contexts to bit descriptions.
+/// Sometimes, we'll find that we can use table lookups or constant assignments;
+/// other times, we'll find that we'll need to use a function to perform the mapping.
+/// If we define a macro to mask that process, we'll never have to change the code.
+/// I don't know if this is desirable or not -- if it isn't, then we can get rid
+/// of the macros and just use function calls or variable assignments. Doesn't matter
+/// to me.
+/// Mapping complex contexts requires a function
+///
+
+/**
+ Maps a USB context to a source description.
+
+ @param[in] Context The context we need to map. Type must be USB.
+ @param[out] SrcDesc The source description that corresponds to the given context.
+
+ @retval None
+**/
+VOID
+MapUsbToSrcDesc (
+ IN PCH_SMM_CONTEXT *Context,
+ OUT PCH_SMM_SOURCE_DESC *SrcDesc
+ );
+
+/**
+ Figure out which timer the child is requesting and
+ send back the source description
+
+ @param[in] DispatchContext The pointer to the Dispatch Context instances
+ @param[out] SrcDesc The pointer to the source description
+
+ @retval None
+**/
+VOID
+MapPeriodicTimerToSrcDesc (
+ IN PCH_SMM_CONTEXT *DispatchContext,
+ OUT PCH_SMM_SOURCE_DESC *SrcDesc
+ );
+
+//
+// Mapping simple contexts can be done by assignment or lookup table
+//
+extern const PCH_SMM_SOURCE_DESC SW_SOURCE_DESC;
+extern const PCH_SMM_SOURCE_DESC SX_SOURCE_DESC;
+extern const PCH_SMM_SOURCE_DESC POWER_BUTTON_SOURCE_DESC;
+
+//
+// With the changes we've made to the protocols, we can now use table
+// lookups for the following protocols:
+//
+#define NUM_SUPPORTED_GPIS 16
+extern const PCH_SMM_SOURCE_DESC LPTH_GPI_SOURCE_DESC[NUM_SUPPORTED_GPIS];
+extern const PCH_SMM_SOURCE_DESC LPTLP_GPI_SOURCE_DESC[NUM_SUPPORTED_GPIS];
+
+extern PCH_SMM_SOURCE_DESC ICHN_H_SOURCE_DESCS[NUM_ICHN_TYPES];
+extern PCH_SMM_SOURCE_DESC ICHN_LP_SOURCE_DESCS[NUM_ICHN_TYPES];
+extern PCH_SMM_SOURCE_DESC ICHN_EX_SOURCE_DESCS[IchnExTypeMAX - IchnExPciExpress];
+
+///
+/// For PCHx, APMC is UINT8 port, so the MAX SWI Value is 0xFF.
+///
+#define MAXIMUM_SWI_VALUE 0xFF
+
+///
+/// GENERALIZING THE CALLBACK
+/// All SmmXxxDispatch callbacks have the same form:
+///
+/// VOID Callback( EFI_HANDLE, EFI_SMM_Xxx_DISPATCH_CONTEXT )
+/// We need a typedef that'll allow us to call any callback
+///
+typedef
+VOID
+(EFIAPI *PCH_SMM_CALLBACK) (
+ IN EFI_HANDLE Handle,
+ IN PCH_SMM_CONTEXT * Context
+ );
+
+///
+/// Open: Need to make sure this kind of type cast will actually work.
+/// May need an intermediate form w/ two VOID* arguments. I'll figure
+/// that out when I start compiling.
+///
+typedef
+VOID
+(EFIAPI *PCH_SMM_CLEAR_SOURCE) (
+ PCH_SMM_SOURCE_DESC * SrcDesc
+ );
+
+///
+/// "DATABASE" RECORD
+/// Linked list data structures
+///
+#define DATABASE_RECORD_SIGNATURE EFI_SIGNATURE_32 ('D', 'B', 'R', 'C')
+
+struct _DATABASE_RECORD {
+ UINT32 Signature;
+ LIST_ENTRY Link;
+
+ ///
+ /// Status and Enable bit description
+ ///
+ PCH_SMM_SOURCE_DESC SrcDesc;
+
+ ///
+ /// Callback function
+ ///
+ PCH_SMM_CALLBACK Callback;
+ PCH_SMM_CONTEXT ChildContext;
+
+ ///
+ /// Special handling hooks -- init them to NULL if unused/unneeded
+ ///
+ PCH_SMM_CLEAR_SOURCE ClearSource; ///< needed for SWSMI timer
+
+ ///
+ /// Functions required to make callback code general
+ ///
+ CONTEXT_FUNCTIONS ContextFunctions;
+
+ ///
+ /// The protocol that this record dispatches
+ ///
+ PCH_SMM_PROTOCOL_TYPE ProtocolType;
+
+};
+
+#define DATABASE_RECORD_FROM_LINK(_record) CR (_record, DATABASE_RECORD, Link, DATABASE_RECORD_SIGNATURE)
+
+///
+/// HOOKING INTO THE ARCHITECTURE
+///
+typedef
+EFI_STATUS
+(EFIAPI *PCH_SMM_GENERIC_REGISTER) (
+ IN VOID **This,
+ IN VOID *DispatchFunction,
+ IN VOID *DispatchContext,
+ OUT EFI_HANDLE * DispatchHandle
+ );
+typedef
+EFI_STATUS
+(EFIAPI *PCH_SMM_GENERIC_UNREGISTER) (
+ IN VOID **This,
+ IN EFI_HANDLE DispatchHandle
+ );
+
+///
+/// Define a memory "stamp" equivalent in size and function to most of the protocols
+///
+typedef struct {
+ PCH_SMM_GENERIC_REGISTER Register;
+ PCH_SMM_GENERIC_UNREGISTER Unregister;
+ UINTN Extra1;
+ UINTN Extra2; ///< may not need this one
+} PCH_SMM_GENERIC_PROTOCOL;
+
+/**
+ Register a child SMI dispatch function with a parent SMM driver.
+
+ @param[in] This Pointer to the PCH_SMM_GENERIC_PROTOCOL instance.
+ @param[in] DispatchFunction Pointer to dispatch function to be invoked for this SMI source.
+ @param[in] DispatchContext Pointer to the dispatch function's context.
+ @param[out] DispatchHandle Handle of dispatch function, for when interfacing
+ with the parent SMM driver, will be the address of linked
+ list link in the call back record.
+
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to create database record
+ @retval EFI_INVALID_PARAMETER The input parameter is invalid
+ @retval EFI_SUCCESS The dispatch function has been successfully
+ registered and the SMI source has been enabled.
+**/
+EFI_STATUS
+PchSmmCoreRegister (
+ IN PCH_SMM_GENERIC_PROTOCOL *This,
+ IN PCH_SMM_CALLBACK DispatchFunction,
+ IN PCH_SMM_CONTEXT *DispatchContext,
+ OUT EFI_HANDLE *DispatchHandle
+ );
+
+/**
+ Unregister a child SMI source dispatch function with a parent SMM driver.
+
+ @param[in] This Pointer to the EFI_SMM_IO_TRAP_DISPATCH_PROTOCOL instance.
+ @param[in] DispatchHandle Handle of dispatch function to deregister.
+
+ @retval EFI_SUCCESS The dispatch function has been successfully
+ unregistered and the SMI source has been disabled
+ if there are no other registered child dispatch
+ functions for this SMI source.
+ @retval EFI_INVALID_PARAMETER Handle is invalid.
+**/
+EFI_STATUS
+PchSmmCoreUnRegister (
+ IN PCH_SMM_GENERIC_PROTOCOL *This,
+ IN EFI_HANDLE *DispatchHandle
+ );
+
+typedef union {
+ PCH_SMM_GENERIC_PROTOCOL Generic;
+
+ EFI_SMM_USB_DISPATCH_PROTOCOL Usb;
+ EFI_SMM_SX_DISPATCH_PROTOCOL Sx;
+ EFI_SMM_SW_DISPATCH_PROTOCOL Sw;
+ EFI_SMM_GPI_DISPATCH_PROTOCOL Gpi;
+ EFI_SMM_ICHN_DISPATCH_PROTOCOL Ichn;
+ EFI_SMM_ICHN_DISPATCH_EX_PROTOCOL IchnEx;
+ EFI_SMM_POWER_BUTTON_DISPATCH_PROTOCOL PowerButton;
+ EFI_SMM_PERIODIC_TIMER_DISPATCH_PROTOCOL PeriodicTimer;
+} PCH_SMM_PROTOCOL;
+
+///
+/// Define a structure to help us identify the generic protocol
+///
+#define PROTOCOL_SIGNATURE EFI_SIGNATURE_32 ('P', 'R', 'O', 'T')
+
+typedef struct {
+ UINTN Signature;
+
+ PCH_SMM_PROTOCOL_TYPE Type;
+ PCH_SMM_PROTOCOL Protocols;
+} PCH_SMM_QUALIFIED_PROTOCOL;
+
+#define QUALIFIED_PROTOCOL_FROM_GENERIC(_generic) \
+ CR ( \
+ _generic, \
+ PCH_SMM_QUALIFIED_PROTOCOL, \
+ Protocols, \
+ PROTOCOL_SIGNATURE \
+ )
+
+///
+/// Create private data for the protocols that we'll publish
+///
+typedef struct {
+ LIST_ENTRY CallbackDataBase;
+ EFI_HANDLE InstallMultProtHandle;
+ PCH_SMM_QUALIFIED_PROTOCOL Protocols[PchSmmProtocolTypeMax];
+} PRIVATE_DATA;
+
+extern PRIVATE_DATA mPrivateData;
+extern EFI_SMM_SYSTEM_TABLE *mSmst;
+extern UINT32 mAcpiBaseAddr;
+extern UINT32 mGpioBaseAddr;
+extern EFI_SMM_BASE_PROTOCOL *mSmmBase;
+
+/**
+ Get the Software Smi value
+
+ @param[in] Record No use
+ @param[out] Context The context that includes Software Smi value to be filled
+
+ @retval None
+**/
+VOID
+EFIAPI
+SwGetContext (
+ IN DATABASE_RECORD *Record,
+ OUT PCH_SMM_CONTEXT *Context
+ );
+
+/**
+ Check whether software SMI value of two contexts match
+
+ @param[in] Context1 Context 1 that includes software SMI value 1
+ @param[in] Context2 Context 2 that includes software SMI value 2
+
+ @retval FALSE Software SMI value match
+ @retval TRUE Software SMI value don't match
+**/
+BOOLEAN
+EFIAPI
+SwCmpContext (
+ IN PCH_SMM_CONTEXT *Context1,
+ IN PCH_SMM_CONTEXT *Context2
+ );
+
+/**
+ Get the Sleep type
+
+ @param[in] Record No use
+ @param[out] Context The context that includes SLP_TYP bits to be filled
+
+ @retval None
+**/
+VOID
+EFIAPI
+SxGetContext (
+ IN DATABASE_RECORD *Record,
+ OUT PCH_SMM_CONTEXT *Context
+ );
+
+/**
+ Check whether sleep type of two contexts match
+
+ @param[in] Context1 Context 1 that includes sleep type 1
+ @param[in] Context2 Context 2 that includes sleep type 2
+
+ @retval FALSE Sleep types match
+ @retval TRUE Sleep types don't match
+**/
+BOOLEAN
+EFIAPI
+SxCmpContext (
+ IN PCH_SMM_CONTEXT *Context1,
+ IN PCH_SMM_CONTEXT *Context2
+ );
+
+/**
+ Update the elapsed time from the Interval data of DATABASE_RECORD
+
+ @param[in] Record The pointer to the DATABASE_RECORD.
+ @param[out] HwContext The Context to be updated.
+
+ @retval None
+**/
+VOID
+EFIAPI
+PeriodicTimerGetContext (
+ IN DATABASE_RECORD *Record,
+ OUT PCH_SMM_CONTEXT *Context
+ );
+
+/**
+ Check whether Periodic Timer of two contexts match
+
+ @param[in] Context1 Context 1 that includes Periodic Timer 1
+ @param[in] Context2 Context 2 that includes Periodic Timer 2
+
+ @retval FALSE Periodic Timer match
+ @retval TRUE Periodic Timer don't match
+**/
+BOOLEAN
+EFIAPI
+PeriodicTimerCmpContext (
+ IN PCH_SMM_CONTEXT *Context1,
+ IN PCH_SMM_CONTEXT *Context2
+ );
+
+/**
+ Get the power button status.
+
+ @param[in] Record The pointer to the DATABASE_RECORD.
+ @param[out] Context Calling context from the hardware, will be updated with the current power button status.
+
+ @retval None
+**/
+VOID
+EFIAPI
+PowerButtonGetContext (
+ IN DATABASE_RECORD *Record,
+ OUT PCH_SMM_CONTEXT *Context
+ );
+
+/**
+ Check whether Power Button status of two contexts match
+
+ @param[in] Context1 Context 1 that includes Power Button status 1
+ @param[in] Context2 Context 2 that includes Power Button status 2
+
+ @retval FALSE Power Button status match
+ @retval TRUE Power Button status don't match
+**/
+BOOLEAN
+EFIAPI
+PowerButtonCmpContext (
+ IN PCH_SMM_CONTEXT *Context1,
+ IN PCH_SMM_CONTEXT *Context2
+ );
+
+/**
+ This function is responsible for calculating and enabling any timers that are required
+ to dispatch messages to children. The SrcDesc argument isn't acutally used.
+
+ @param[in] SrcDesc Pointer to the PCH_SMM_SOURCE_DESC instance.
+
+ @retval None.
+**/
+VOID
+EFIAPI
+PchSmmPeriodicTimerClearSource (
+ IN PCH_SMM_SOURCE_DESC *SrcDesc
+ );
+
+/**
+ This services returns the next SMI tick period that is supported by the chipset.
+ The order returned is from longest to shortest interval period.
+
+ @param[in] This Pointer to the EFI_SMM_PERIODIC_TIMER_DISPATCH_PROTOCOL instance.
+ @param[in, out] SmiTickInterval Pointer to pointer of the next shorter SMI interval period that is supported by the child.
+
+ @retval EFI_SUCCESS The service returned successfully.
+ @retval EFI_INVALID_PARAMETER The parameter SmiTickInterval is invalid.
+**/
+EFI_STATUS
+PchSmmPeriodicTimerDispatchGetNextShorterInterval (
+ IN EFI_SMM_PERIODIC_TIMER_DISPATCH_PROTOCOL *This,
+ IN OUT UINT64 **SmiTickInterval
+ );
+
+/**
+ When we get an SMI that indicates that we are transitioning to a sleep state,
+ we need to actually transition to that state. We do this by disabling the
+ "SMI on sleep enable" feature, which generates an SMI when the operating system
+ tries to put the system to sleep, and then physically putting the system to sleep.
+
+ @param[in] None
+
+ @retval None.
+**/
+VOID
+PchSmmSxGoToSleep (
+ VOID
+ );
+
+/**
+ Clear the SMI status bit after the SMI handling is done
+
+ @param[in] SrcDesc Pointer to the PCH SMI source description table
+
+ @retval None
+**/
+VOID
+EFIAPI
+PchSmmIchnClearSource (
+ IN PCH_SMM_SOURCE_DESC *SrcDesc
+ );
+
+/**
+ Fix the base address of the source regs and status regs.
+ Since Base should get from register filled by platform modules already.
+
+ @param[in] None.
+
+ @retval None.
+**/
+VOID
+PchSmmIchnFixSourceBase (
+ VOID
+ );
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmmCore.c b/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmmCore.c
new file mode 100644
index 0000000..89100d5
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmmCore.c
@@ -0,0 +1,891 @@
+/** @file
+ This driver is responsible for the registration of child drivers
+ and the abstraction of the PCH SMI sources.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "PchSmm.h"
+#include "PchSmmHelpers.h"
+// AMI_OVERRIDE, GPIO_ROUT >>>
+#include "Token.h"
+// AMI_OVERRIDE, GPIO_ROUT <<<
+
+///
+/// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+/// MODULE / GLOBAL DATA
+///
+/// Module variables used by the both the main dispatcher and the source dispatchers
+/// Declared in PchSmmSources.h
+///
+EFI_SMM_SYSTEM_TABLE *mSmst;
+UINT32 mAcpiBaseAddr;
+UINT32 mGpioBaseAddr;
+EFI_SMM_BASE_PROTOCOL *mSmmBase;
+//
+// The reserved mmio address can only be used in Sx handler
+// it's not reserved in ACPI.
+//
+EFI_PHYSICAL_ADDRESS mResvMmioBaseAddr;
+
+PRIVATE_DATA mPrivateData = { ///< for the structure
+ {
+ NULL
+ }, ///< CallbackDataBase linked list head
+ NULL, ///< EFI handle returned when calling InstallMultipleProtocolInterfaces
+ { ///< protocol arrays
+ ///
+ /// elements within the array
+ ///
+ {
+ PROTOCOL_SIGNATURE,
+ UsbType,
+ {
+ (PCH_SMM_GENERIC_REGISTER) PchSmmCoreRegister,
+ (PCH_SMM_GENERIC_UNREGISTER) PchSmmCoreUnRegister
+ }
+ },
+ {
+ PROTOCOL_SIGNATURE,
+ SxType,
+ {
+ (PCH_SMM_GENERIC_REGISTER) PchSmmCoreRegister,
+ (PCH_SMM_GENERIC_UNREGISTER) PchSmmCoreUnRegister
+ }
+ },
+ {
+ PROTOCOL_SIGNATURE,
+ SwType,
+ {
+ (PCH_SMM_GENERIC_REGISTER) PchSmmCoreRegister,
+ (PCH_SMM_GENERIC_UNREGISTER) PchSmmCoreUnRegister,
+ (UINTN) MAXIMUM_SWI_VALUE
+ }
+ },
+ {
+ PROTOCOL_SIGNATURE,
+ GpiType,
+ {
+ (PCH_SMM_GENERIC_REGISTER) PchSmmCoreRegister,
+ (PCH_SMM_GENERIC_UNREGISTER) PchSmmCoreUnRegister,
+ (UINTN) NUM_SUPPORTED_GPIS
+ }
+ },
+ {
+ PROTOCOL_SIGNATURE,
+ IchnType,
+ {
+ (PCH_SMM_GENERIC_REGISTER) PchSmmCoreRegister,
+ (PCH_SMM_GENERIC_UNREGISTER) PchSmmCoreUnRegister
+ }
+ },
+ {
+ PROTOCOL_SIGNATURE,
+ IchnExType,
+ {
+ (PCH_SMM_GENERIC_REGISTER) PchSmmCoreRegister,
+ (PCH_SMM_GENERIC_UNREGISTER) PchSmmCoreUnRegister
+ }
+ },
+ {
+ PROTOCOL_SIGNATURE,
+ PowerButtonType,
+ {
+ (PCH_SMM_GENERIC_REGISTER) PchSmmCoreRegister,
+ (PCH_SMM_GENERIC_UNREGISTER) PchSmmCoreUnRegister
+ }
+ },
+ {
+ PROTOCOL_SIGNATURE,
+ PeriodicTimerType,
+ {
+ (PCH_SMM_GENERIC_REGISTER) PchSmmCoreRegister,
+ (PCH_SMM_GENERIC_UNREGISTER) PchSmmCoreUnRegister,
+ (UINTN) PchSmmPeriodicTimerDispatchGetNextShorterInterval
+ }
+ },
+ }
+};
+
+CONTEXT_FUNCTIONS mContextFunctions[PchSmmProtocolTypeMax] = {
+ {
+ NULL,
+ NULL
+ },
+ {
+ SxGetContext,
+ SxCmpContext
+ },
+ {
+ SwGetContext,
+ SwCmpContext
+ },
+ {
+ NULL,
+ NULL
+ },
+ {
+ NULL,
+ NULL
+ },
+ {
+ NULL,
+ NULL
+ },
+ {
+ PowerButtonGetContext,
+ PowerButtonCmpContext
+ },
+ {
+ PeriodicTimerGetContext,
+ PeriodicTimerCmpContext
+ },
+};
+
+///
+/// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+/// PROTOTYPES
+///
+/// Functions use only in this file
+///
+EFI_STATUS
+EFIAPI
+PchSmmCoreDispatcher (
+ IN EFI_HANDLE SmmImageHandle,
+ IN OUT VOID *CommunicationBuffer,
+ IN OUT UINTN *SourceSize
+ );
+
+///
+/// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+/// FUNCTIONS
+///
+/// Driver entry point
+///
+
+/**
+ Initializes the PCH SMM Dispatcher
+
+ @param[in] ImageHandle Pointer to the loaded image protocol for this driver
+ @param[in] SystemTable Pointer to the EFI System Table
+
+ @retval EFI_SUCCESS PchSmmDispatcher Initialization completed.
+**/
+EFI_STATUS
+EFIAPI
+InitializePchSmmDispatcher (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+
+ ///
+ /// Locate SMM Base Protocol
+ ///
+ Status = gBS->LocateProtocol (&gEfiSmmBaseProtocolGuid, NULL, (VOID **) &mSmmBase);
+ if (EFI_ERROR (Status)) {
+ ASSERT (FALSE);
+ return Status;
+ }
+ ///
+ /// Initialize our module variables
+ ///
+ Status = mSmmBase->GetSmstLocation (mSmmBase, &mSmst);
+ if (EFI_ERROR (Status)) {
+ ASSERT (FALSE);
+ return Status;
+ }
+
+ PERF_START_EX (ImageHandle, L"SmmModule", NULL, AsmReadTsc(), 8);
+
+ ///
+ /// Access ACPI Base Addresses Register
+ ///
+ mAcpiBaseAddr = (UINT32) (MmioRead16 (
+ MmPciAddress (0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_ACPI_BASE)
+ ) & B_PCH_LPC_ACPI_BASE_BAR);
+ ASSERT (mAcpiBaseAddr != 0);
+
+ ///
+ /// Access GPIO Base Addresses Register
+ ///
+ mGpioBaseAddr = (UINT32) (MmioRead16 (
+ MmPciAddress (0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_GPIO_BASE)
+ ) & B_PCH_LPC_GPIO_BASE_BAR);
+ ASSERT (mGpioBaseAddr != 0);
+
+ ///
+ /// Fix the ICHN_SOURCE_DESCS base, in order to obtain independence with platform.
+ ///
+ PchSmmIchnFixSourceBase ();
+
+ PchSmmPublishDispatchProtocols ();
+
+ ///
+ /// Register a callback function to handle subsequent SMIs. This callback
+ /// will be called by SmmCoreDispatcher.
+ ///
+//AMI_OVERRIDE Support SMM2>>
+ mSmmBase->RegisterCallback (mSmmBase, ImageHandle, PchSmmCoreDispatcher, TRUE, FALSE);
+//AMI_OVERRIDE Support SMM2<<
+
+ ///
+ /// Initialize Callback DataBase
+ ///
+ InitializeListHead (&mPrivateData.CallbackDataBase);
+
+ ///
+ /// Enable SMIs on the PCH now that we have a callback
+ ///
+ PchSmmInitHardware ();
+
+ mResvMmioBaseAddr = 0x0ffffffff;
+#ifndef AMI_OVERRIDE_FOR_PCH
+ Status = gDS->AllocateMemorySpace (
+ EfiGcdAllocateMaxAddressSearchTopDown,
+ EfiGcdMemoryTypeMemoryMappedIo,
+ 16, // 2^16: 64K Alignment
+ 0x10000, // 64K Length
+ &mResvMmioBaseAddr,
+ ImageHandle,
+ NULL
+ );
+#else
+ Status = gDS->AllocateMemorySpace (
+ EfiGcdAllocateMaxAddressSearchBottomUp,
+ EfiGcdMemoryTypeMemoryMappedIo,
+ 16, // 2^16: 64K Alignment
+ 0x10000, // 64K Length
+ &mResvMmioBaseAddr,
+ ImageHandle,
+ NULL
+ );
+#endif
+ ASSERT_EFI_ERROR (Status);
+ DEBUG((EFI_D_INFO,"mResvMmioBaseAddr %x\n", mResvMmioBaseAddr));
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Check the Fed SwSmiInputValue to see if there is a duplicated one in the database
+
+ @param[in] FedSwSmiInputValue Fed SwSmiInputValue
+
+ @retval EFI_SUCCESS There is no duplicated SwSmiInputValue
+ @retval EFI_INVALID_PARAMETER There is a duplicated SwSmiInputValue
+**/
+EFI_STATUS
+SmiInputValueDuplicateCheck (
+ UINTN FedSwSmiInputValue
+ )
+{
+
+ DATABASE_RECORD *RecordInDb;
+ LIST_ENTRY *LinkInDb;
+
+ LinkInDb = GetFirstNode (&mPrivateData.CallbackDataBase);
+ while (!IsNull (&mPrivateData.CallbackDataBase, LinkInDb)) {
+ RecordInDb = DATABASE_RECORD_FROM_LINK (LinkInDb);
+
+ if (RecordInDb->ProtocolType == SwType) {
+ if (RecordInDb->ChildContext.Sw.SwSmiInputValue == FedSwSmiInputValue) {
+ return EFI_INVALID_PARAMETER;
+ }
+ }
+
+ LinkInDb = GetNextNode (&mPrivateData.CallbackDataBase, &RecordInDb->Link);
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Register a child SMI dispatch function with a parent SMM driver.
+
+ @param[in] This Pointer to the PCH_SMM_GENERIC_PROTOCOL instance.
+ @param[in] DispatchFunction Pointer to dispatch function to be invoked for this SMI source.
+ @param[in] DispatchContext Pointer to the dispatch function's context.
+ @param[out] DispatchHandle Handle of dispatch function, for when interfacing
+ with the parent SMM driver, will be the address of linked
+ list link in the call back record.
+
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to create database record
+ @retval EFI_INVALID_PARAMETER The input parameter is invalid
+ @retval EFI_SUCCESS The dispatch function has been successfully
+ registered and the SMI source has been enabled.
+**/
+EFI_STATUS
+PchSmmCoreRegister (
+ IN PCH_SMM_GENERIC_PROTOCOL *This,
+ IN PCH_SMM_CALLBACK DispatchFunction,
+ IN PCH_SMM_CONTEXT *DispatchContext,
+ OUT EFI_HANDLE *DispatchHandle
+ )
+{
+ EFI_STATUS Status;
+ DATABASE_RECORD *Record;
+ PCH_SMM_QUALIFIED_PROTOCOL *Qualified;
+ PCH_SMM_SOURCE_DESC NullSourceDesc = NULL_SOURCE_DESC_INITIALIZER;
+ PCH_SERIES PchSeries;
+ UINTN Index;
+
+ PchSeries = GetPchSeries();
+ Index = 0;
+ ///
+ /// Create database record and add to database
+ ///
+ if (mSmst == NULL) {
+ ASSERT (FALSE);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Status = mSmst->SmmAllocatePool (EfiRuntimeServicesData, sizeof (DATABASE_RECORD), (VOID **) &Record);
+ if (EFI_ERROR (Status)) {
+ ASSERT (FALSE);
+ return EFI_OUT_OF_RESOURCES;
+ }
+ ///
+ /// Gather information about the registration request
+ ///
+ Record->Callback = DispatchFunction;
+ Record->ChildContext = *DispatchContext;
+
+ Qualified = QUALIFIED_PROTOCOL_FROM_GENERIC (This);
+
+ Record->ProtocolType = Qualified->Type;
+
+ Record->ContextFunctions = mContextFunctions[Qualified->Type];
+ ///
+ /// Perform linked list housekeeping
+ ///
+ Record->Signature = DATABASE_RECORD_SIGNATURE;
+
+ switch (Qualified->Type) {
+ ///
+ /// By the end of this switch statement, we'll know the
+ /// source description the child is registering for
+ ///
+ case UsbType:
+ ///
+ /// Check the validity of Context Type
+ ///
+ if ((Record->ChildContext.Usb.Type < UsbLegacy) || (Record->ChildContext.Usb.Type > UsbWake)) {
+ goto Error;
+ }
+
+ InsertTailList (&mPrivateData.CallbackDataBase, &Record->Link);
+ MapUsbToSrcDesc (DispatchContext, &(Record->SrcDesc));
+ Record->ClearSource = NULL;
+ ///
+ /// use default clear source function
+ ///
+ break;
+
+ case SxType:
+ ///
+ /// Check the validity of Context Type and Phase
+ ///
+ if ((Record->ChildContext.Sx.Type < SxS0) ||
+ (Record->ChildContext.Sx.Type >= EfiMaximumSleepType) ||
+ (Record->ChildContext.Sx.Phase < SxEntry) ||
+ (Record->ChildContext.Sx.Phase >= EfiMaximumPhase)
+ ) {
+ goto Error;
+ }
+
+ InsertTailList (&mPrivateData.CallbackDataBase, &Record->Link);
+ CopyMem ((VOID *) &(Record->SrcDesc), (VOID *) (&SX_SOURCE_DESC), sizeof (PCH_SMM_SOURCE_DESC));
+ Record->ClearSource = NULL;
+ ///
+ /// use default clear source function
+ ///
+ break;
+
+ case SwType:
+ ///
+ /// Check the validity of Context Value
+ ///
+ if (Record->ChildContext.Sw.SwSmiInputValue > MAXIMUM_SWI_VALUE) {
+ goto Error;
+ }
+
+ if (EFI_ERROR (SmiInputValueDuplicateCheck (Record->ChildContext.Sw.SwSmiInputValue))) {
+ goto Error;
+ }
+
+ InsertTailList (&mPrivateData.CallbackDataBase, &Record->Link);
+ CopyMem ((VOID *) &(Record->SrcDesc), (VOID *) (&SW_SOURCE_DESC), sizeof (PCH_SMM_SOURCE_DESC));
+ Record->ClearSource = NULL;
+ ///
+ /// use default clear source function
+ ///
+ break;
+
+ case GpiType:
+ Index = Record->ChildContext.Gpi.GpiNum;
+ if (PchSeries == PchH) {
+ Index -= V_PCH_LPTH_ALT_GP_SMI_GPIBASE;
+ if (Index >= S_PCH_LPTH_ALT_GP_SMI_GPISIZE) {
+ goto Error;
+ }
+ } else if (PchSeries == PchLp) {
+ Index -= V_PCH_LPTLP_ALT_GP_SMI_GPIBASE;
+ if (Index >= S_PCH_LPTLP_ALT_GP_SMI_GPISIZE) {
+ goto Error;
+ }
+ } else {
+ goto Error;
+ }
+ InsertTailList (&mPrivateData.CallbackDataBase, &Record->Link);
+ if (PchSeries == PchH) {
+ CopyMem (
+ (VOID *) &(Record->SrcDesc),
+ (VOID *) &(LPTH_GPI_SOURCE_DESC[Index]),
+ sizeof (PCH_SMM_SOURCE_DESC)
+ );
+ } else if (PchSeries == PchLp) {
+ CopyMem (
+ (VOID *) &(Record->SrcDesc),
+ (VOID *) &(LPTLP_GPI_SOURCE_DESC[Index]),
+ sizeof (PCH_SMM_SOURCE_DESC)
+ );
+ }
+ Record->ClearSource = NULL;
+ ///
+ /// use default clear source function
+ ///
+ break;
+
+ case IchnType:
+ ///
+ /// Check the validity of Context Type
+ ///
+ if (Record->ChildContext.Ichn.Type >= NUM_ICHN_TYPES) {
+ goto Error;
+ }
+
+ InsertTailList (&mPrivateData.CallbackDataBase, &Record->Link);
+ if (PchSeries == PchLp) {
+ CopyMem (
+ (VOID *) &(Record->SrcDesc),
+ (VOID *) &(ICHN_LP_SOURCE_DESCS[Record->ChildContext.Ichn.Type]),
+ sizeof (PCH_SMM_SOURCE_DESC)
+ );
+ } else if (PchSeries == PchH) {
+ CopyMem (
+ (VOID *) &(Record->SrcDesc),
+ (VOID *) &(ICHN_H_SOURCE_DESCS[Record->ChildContext.Ichn.Type]),
+ sizeof (PCH_SMM_SOURCE_DESC)
+ );
+ }
+ Record->ClearSource = PchSmmIchnClearSource;
+ break;
+
+ case IchnExType:
+ ///
+ /// Check the validity of Context Type
+ ///
+ if ((Record->ChildContext.IchnEx.Type < IchnExPciExpress) || (Record->ChildContext.IchnEx.Type >= IchnExTypeMAX)) {
+ goto Error;
+ }
+
+ InsertTailList (&mPrivateData.CallbackDataBase, &Record->Link);
+ CopyMem (
+ (VOID *) &(Record->SrcDesc),
+ (VOID *) &(ICHN_EX_SOURCE_DESCS[Record->ChildContext.IchnEx.Type - IchnExPciExpress]),
+ sizeof (PCH_SMM_SOURCE_DESC)
+ );
+ Record->ClearSource = NULL;
+ break;
+
+ case PowerButtonType:
+ ///
+ /// Check the validity of Context Phase
+ ///
+ if ((Record->ChildContext.PowerButton.Phase < PowerButtonEntry) ||
+ (Record->ChildContext.PowerButton.Phase > PowerButtonExit)
+ ) {
+ goto Error;
+ }
+
+ InsertTailList (&mPrivateData.CallbackDataBase, &Record->Link);
+ CopyMem ((VOID *) &(Record->SrcDesc), (VOID *) &POWER_BUTTON_SOURCE_DESC, sizeof (PCH_SMM_SOURCE_DESC));
+ Record->ClearSource = NULL;
+ ///
+ /// use default clear source function
+ ///
+ break;
+
+ case PeriodicTimerType:
+ ///
+ /// Check the validity of timer value
+ ///
+ if (DispatchContext->PeriodicTimer.SmiTickInterval <= 0) {
+ goto Error;
+ }
+
+ InsertTailList (&mPrivateData.CallbackDataBase, &Record->Link);
+ MapPeriodicTimerToSrcDesc (DispatchContext, &(Record->SrcDesc));
+ Record->ClearSource = PchSmmPeriodicTimerClearSource;
+ break;
+
+ default:
+ return EFI_INVALID_PARAMETER;
+ break;
+ }
+
+ if (CompareSources (&Record->SrcDesc, &NullSourceDesc)) {
+ goto Error;
+ }
+
+ if (Record->ClearSource == NULL) {
+ ///
+ /// Clear the SMI associated w/ the source using the default function
+ ///
+ PchSmmClearSource (&Record->SrcDesc);
+ } else {
+ ///
+ /// This source requires special handling to clear
+ ///
+ Record->ClearSource (&Record->SrcDesc);
+ }
+
+ PchSmmEnableSource (&Record->SrcDesc);
+
+// AMI_OVERRIDE, GPIO_ROUT >>>
+// Added GPIO_ROUT (B0:D31:F0 Reg#B8h) initialization for GPI SMI register.
+{
+ UINT32 GpioRout;
+ UINT32 GpioSmiRout;
+
+ if (Qualified->Type == GpiType) {
+ if (PchSeries == PchH) {
+ GpioRout = (UINT32) (MmioRead32 ( \
+ MmPciAddress (0,
+ DEFAULT_PCI_BUS_NUMBER_PCH, \
+ PCI_DEVICE_NUMBER_PCH_LPC, \
+ PCI_FUNCTION_NUMBER_PCH_LPC, \
+ R_PCH_LPC_GPI_ROUT)\
+ ));
+
+ GpioRout &= ~(3 << (Record->ChildContext.Gpi.GpiNum * 2));
+ GpioRout |= (1 << (Record->ChildContext.Gpi.GpiNum * 2));
+
+ MmioWrite32 ( \
+ MmPciAddress (0,
+ DEFAULT_PCI_BUS_NUMBER_PCH, \
+ PCI_DEVICE_NUMBER_PCH_LPC, \
+ PCI_FUNCTION_NUMBER_PCH_LPC,\
+ R_PCH_LPC_GPI_ROUT), \
+ GpioRout\
+ );
+ }else if(PchSeries == PchLp){
+ if( Record->ChildContext.Gpi.GpiNum >= 32 && Record->ChildContext.Gpi.GpiNum < 48){
+ GpioRout = IoRead32(GPIO_BASE_ADDRESS + R_PCH_LP_LPC_GPI_ROUT1);
+ GpioSmiRout = IoRead32(GPIO_BASE_ADDRESS + R_PCH_LPTLP_ALT_GP_SMI_EN);
+
+ GpioRout |= (1 << (Record->ChildContext.Gpi.GpiNum - 32));
+ GpioSmiRout |= (1 << (Record->ChildContext.Gpi.GpiNum - 32));
+
+ IoWrite32((GPIO_BASE_ADDRESS + R_PCH_LP_LPC_GPI_ROUT1),GpioRout);
+ IoWrite32((GPIO_BASE_ADDRESS + R_PCH_LPTLP_ALT_GP_SMI_EN),GpioSmiRout);
+ }
+ }
+ }
+}
+// AMI_OVERRIDE, GPIO_ROUT <<<
+
+ ///
+ /// Child's handle will be the address linked list link in the record
+ ///
+ *DispatchHandle = (EFI_HANDLE) (&Record->Link);
+
+ return EFI_SUCCESS;
+
+Error:
+ Status = mSmst->SmmFreePool (Record);
+ ///
+ /// DEBUG((EFI_D_ERROR,"Free pool status %d\n", Status ));
+ ///
+ return EFI_INVALID_PARAMETER;
+}
+
+/**
+ Unregister a child SMI source dispatch function with a parent SMM driver.
+
+ @param[in] This Pointer to the EFI_SMM_IO_TRAP_DISPATCH_PROTOCOL instance.
+ @param[in] DispatchHandle Handle of dispatch function to deregister.
+
+ @retval EFI_SUCCESS The dispatch function has been successfully
+ unregistered and the SMI source has been disabled
+ if there are no other registered child dispatch
+ functions for this SMI source.
+ @retval EFI_INVALID_PARAMETER Handle is invalid.
+**/
+EFI_STATUS
+PchSmmCoreUnRegister (
+ IN PCH_SMM_GENERIC_PROTOCOL *This,
+ IN EFI_HANDLE *DispatchHandle
+ )
+{
+ ///
+ /// BOOLEAN SafeToDisable;
+ ///
+ DATABASE_RECORD *RecordToDelete;
+
+ ///
+ /// DATABASE_RECORD *RecordInDb;
+ /// EFI_LIST_NODE *LinkInDb;
+ ///
+ if (DispatchHandle == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ RecordToDelete = DATABASE_RECORD_FROM_LINK (DispatchHandle);
+
+ ///
+ /// Take the entry out of the linked list
+ ///
+ if (RecordToDelete->Link.ForwardLink == (LIST_ENTRY *) EFI_BAD_POINTER) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ RemoveEntryList (&RecordToDelete->Link);
+
+ ///
+ /// See if we can disable the source, reserved for future use since this might
+ /// not be the only criteria to disable
+ ///
+ /// SafeToDisable = TRUE;
+ /// LinkInDb = GetFirstNode (&mPrivateData.CallbackDataBase);
+ /// while(!IsNull (&mPrivateData.CallbackDataBase, LinkInDb)) {
+ /// RecordInDb = DATABASE_RECORD_FROM_LINK (LinkInDb);
+ /// if (CompareEnables (&RecordToDelete->SrcDesc, &RecordInDb->SrcDesc)) {
+ /// SafeToDisable = FALSE;
+ /// break;
+ /// }
+ /// LinkInDb = GetNextNode (&mPrivateData.CallbackDataBase, &RecordInDb->Link);
+ /// }
+ /// if (SafeToDisable) {
+ /// PchSmmDisableSource( &Record->SrcDesc );
+ /// }
+ ///
+ return EFI_SUCCESS;
+}
+
+/**
+ The callback function to handle subsequent SMIs. This callback will be called by SmmCoreDispatcher.
+
+ @param[in] SmmImageHandle Not used
+ @param[in, out] CommunicationBuffer Not used
+ @param[in, out] SourceSize Not used
+
+ @retval EFI_SUCCESS Function successfully completed
+**/
+EFI_STATUS
+EFIAPI
+PchSmmCoreDispatcher (
+ IN EFI_HANDLE SmmImageHandle,
+ IN OUT VOID *CommunicationBuffer,
+ IN OUT UINTN *SourceSize
+ )
+{
+ ///
+ /// Used to prevent infinite loops
+ ///
+ UINTN EscapeCount;
+
+ BOOLEAN ContextsMatch;
+ BOOLEAN EosSet;
+ BOOLEAN SxChildWasDispatched;
+
+ DATABASE_RECORD *RecordInDb;
+ LIST_ENTRY *LinkInDb;
+ DATABASE_RECORD *RecordToExhaust;
+ LIST_ENTRY *LinkToExhaust;
+
+ PCH_SMM_CONTEXT Context;
+
+ EFI_STATUS Status;
+
+ PCH_SMM_SOURCE_DESC ActiveSource = NULL_SOURCE_DESC_INITIALIZER;
+
+ EscapeCount = 100;
+ ContextsMatch = FALSE;
+ EosSet = FALSE;
+ SxChildWasDispatched = FALSE;
+ Status = EFI_SUCCESS;
+
+ if (!IsListEmpty (&mPrivateData.CallbackDataBase)) {
+ ///
+ /// We have children registered w/ us -- continue
+ ///
+ while ((!EosSet) && (EscapeCount > 0)) {
+ EscapeCount--;
+
+ LinkInDb = GetFirstNode (&mPrivateData.CallbackDataBase);
+
+ while (!IsNull (&mPrivateData.CallbackDataBase, LinkInDb)) {
+ RecordInDb = DATABASE_RECORD_FROM_LINK (LinkInDb);
+
+ ///
+ /// look for the first active source
+ ///
+ if (!SourceIsActive (&RecordInDb->SrcDesc)) {
+ ///
+ /// Didn't find the source yet, keep looking
+ ///
+ LinkInDb = GetNextNode (&mPrivateData.CallbackDataBase, &RecordInDb->Link);
+
+ ///
+ /// if it's the last one, try to clear EOS
+ ///
+ if (IsNull (&mPrivateData.CallbackDataBase, LinkInDb)) {
+ EosSet = PchSmmSetAndCheckEos ();
+ }
+ } else {
+ ///
+ /// We found a source. If this is a sleep type, we have to go to
+ /// appropriate sleep state anyway.No matter there is sleep child or not
+ ///
+ if (RecordInDb->ProtocolType == SxType) {
+ SxChildWasDispatched = TRUE;
+ }
+ ///
+ /// "cache" the source description and don't query I/O anymore
+ ///
+ CopyMem ((VOID *) &ActiveSource, (VOID *) &(RecordInDb->SrcDesc), sizeof (PCH_SMM_SOURCE_DESC));
+ LinkToExhaust = LinkInDb;
+
+ ///
+ /// exhaust the rest of the queue looking for the same source
+ ///
+ while (!IsNull (&mPrivateData.CallbackDataBase, LinkToExhaust)) {
+ RecordToExhaust = DATABASE_RECORD_FROM_LINK (LinkToExhaust);
+ ///
+ /// RecordToExhaust->Link might be removed (unregistered) by Callback function, and then the
+ /// system will hang in ASSERT() while calling GetNextNode().
+ /// To prevent the issue, we need to get next record in DB here (before Callback function).
+ ///
+ LinkToExhaust = GetNextNode (&mPrivateData.CallbackDataBase, &RecordToExhaust->Link);
+
+ if (CompareSources (&RecordToExhaust->SrcDesc, &ActiveSource)) {
+ ///
+ /// These source descriptions are equal, so this callback should be
+ /// dispatched.
+ ///
+ if (RecordToExhaust->ContextFunctions.GetContext != NULL) {
+ ///
+ /// This child requires that we get a calling context from
+ /// hardware and compare that context to the one supplied
+ /// by the child.
+ ///
+ ASSERT (RecordToExhaust->ContextFunctions.CmpContext != NULL);
+
+ ///
+ /// Make sure contexts match before dispatching event to child
+ ///
+ RecordToExhaust->ContextFunctions.GetContext (RecordToExhaust, &Context);
+ ContextsMatch = RecordToExhaust->ContextFunctions.CmpContext (&Context, &RecordToExhaust->ChildContext);
+
+ } else {
+ ///
+ /// This child doesn't require any more calling context beyond what
+ /// it supplied in registration. Simply pass back what it gave us.
+ ///
+ ASSERT (RecordToExhaust->Callback != NULL);
+ Context = RecordToExhaust->ChildContext;
+ ContextsMatch = TRUE;
+ }
+
+ if (ContextsMatch) {
+
+ ASSERT (RecordToExhaust->Callback != NULL);
+ PERF_START_EX (NULL, L"SmmFunction", NULL, AsmReadTsc(), RecordToExhaust->ProtocolType);
+ RecordToExhaust->Callback ((EFI_HANDLE) & RecordToExhaust->Link, &Context);
+ PERF_END_EX (NULL, L"SmmFunction", NULL, AsmReadTsc(), RecordToExhaust->ProtocolType);
+ if (RecordToExhaust->ProtocolType == SxType) {
+ SxChildWasDispatched = TRUE;
+ }
+ }
+ }
+ }
+
+ if (RecordInDb->ClearSource == NULL) {
+ ///
+ /// Clear the SMI associated w/ the source using the default function
+ ///
+ PchSmmClearSource (&ActiveSource);
+ } else {
+ ///
+ /// This source requires special handling to clear
+ ///
+ RecordInDb->ClearSource (&ActiveSource);
+ }
+ ///
+ /// Also, try to clear EOS
+ ///
+ EosSet = PchSmmSetAndCheckEos ();
+ ///
+ /// Queue is empty, reset the search
+ ///
+ break;
+ }
+ }
+ }
+ }
+ ///
+ /// If you arrive here, there are two possible reasons:
+ /// (1) you've got problems with clearing the SMI status bits in the
+ /// ACPI table. If you don't properly clear the SMI bits, then you won't be able to set the
+ /// EOS bit. If this happens too many times, the loop exits.
+ /// (2) there was a SMM communicate for callback messages that was received prior
+ /// to this driver.
+ /// If there is an asynchronous SMI that occurs while processing the Callback, let
+ /// all of the drivers (including this one) have an opportunity to scan for the SMI
+ /// and handle it.
+ /// If not, we don't want to exit and have the foreground app. clear EOS without letting
+ /// these other sources get serviced.
+ ///
+ /// This assert is not valid with CSM legacy solution because it generates software SMI
+ /// to test for legacy USB support presence.
+ /// This may not be illegal, so we cannot assert at this time.
+ ///
+ /// ASSERT (EscapeCount > 0);
+ ///
+ if (SxChildWasDispatched) {
+ ///
+ /// A child of the SmmSxDispatch protocol was dispatched during this call;
+ /// put the system to sleep.
+ ///
+ PchSmmSxGoToSleep ();
+ }
+
+ return Status;
+
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmmGpi.c b/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmmGpi.c
new file mode 100644
index 0000000..e9b16f9
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmmGpi.c
@@ -0,0 +1,101 @@
+/** @file
+ File to contain all the hardware specific stuff for the Smm Gpi dispatch protocol.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "PchSmmHelpers.h"
+
+#define LPTH_GPI_INIT_ELEMENT(num) { \
+ PCH_SMM_NO_FLAGS, \
+ { \
+ { \
+ { \
+ ACPI_ADDR_TYPE, R_PCH_LPTH_ALT_GP_SMI_EN \
+ }, \
+ S_PCH_LPTH_ALT_GP_SMI_EN, num, \
+ }, \
+ NULL_BIT_DESC_INITIALIZER \
+ }, \
+ { \
+ { \
+ { \
+ ACPI_ADDR_TYPE, R_PCH_LPTH_ALT_GP_SMI_STS \
+ }, \
+ S_PCH_LPTH_ALT_GP_SMI_STS, (num), \
+ }, \
+ } \
+ }
+
+#define LPTLP_GPI_INIT_ELEMENT(num) { \
+ PCH_SMM_NO_FLAGS, \
+ { \
+ { \
+ { \
+ GPIO_ADDR_TYPE, R_PCH_LPTLP_ALT_GP_SMI_EN \
+ }, \
+ S_PCH_LPTLP_ALT_GP_SMI_EN, num, \
+ }, \
+ NULL_BIT_DESC_INITIALIZER \
+ }, \
+ { \
+ { \
+ { \
+ GPIO_ADDR_TYPE, R_PCH_LPTLP_ALT_GP_SMI_STS \
+ }, \
+ S_PCH_LPTLP_ALT_GP_SMI_STS, (num), \
+ }, \
+ } \
+ }
+
+const PCH_SMM_SOURCE_DESC LPTH_GPI_SOURCE_DESC[NUM_SUPPORTED_GPIS] = {
+ LPTH_GPI_INIT_ELEMENT(0),
+ LPTH_GPI_INIT_ELEMENT(1),
+ LPTH_GPI_INIT_ELEMENT(2),
+ LPTH_GPI_INIT_ELEMENT(3),
+ LPTH_GPI_INIT_ELEMENT(4),
+ LPTH_GPI_INIT_ELEMENT(5),
+ LPTH_GPI_INIT_ELEMENT(6),
+ LPTH_GPI_INIT_ELEMENT(7),
+ LPTH_GPI_INIT_ELEMENT(8),
+ LPTH_GPI_INIT_ELEMENT(9),
+ LPTH_GPI_INIT_ELEMENT(10),
+ LPTH_GPI_INIT_ELEMENT(11),
+ LPTH_GPI_INIT_ELEMENT(12),
+ LPTH_GPI_INIT_ELEMENT(13),
+ LPTH_GPI_INIT_ELEMENT(14),
+ LPTH_GPI_INIT_ELEMENT(15),
+};
+
+const PCH_SMM_SOURCE_DESC LPTLP_GPI_SOURCE_DESC[NUM_SUPPORTED_GPIS] = {
+ LPTLP_GPI_INIT_ELEMENT(0),
+ LPTLP_GPI_INIT_ELEMENT(1),
+ LPTLP_GPI_INIT_ELEMENT(2),
+ LPTLP_GPI_INIT_ELEMENT(3),
+ LPTLP_GPI_INIT_ELEMENT(4),
+ LPTLP_GPI_INIT_ELEMENT(5),
+ LPTLP_GPI_INIT_ELEMENT(6),
+ LPTLP_GPI_INIT_ELEMENT(7),
+ LPTLP_GPI_INIT_ELEMENT(8),
+ LPTLP_GPI_INIT_ELEMENT(9),
+ LPTLP_GPI_INIT_ELEMENT(10),
+ LPTLP_GPI_INIT_ELEMENT(11),
+ LPTLP_GPI_INIT_ELEMENT(12),
+ LPTLP_GPI_INIT_ELEMENT(13),
+ LPTLP_GPI_INIT_ELEMENT(14),
+ LPTLP_GPI_INIT_ELEMENT(15),
+};
diff --git a/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmmHelpers.c b/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmmHelpers.c
new file mode 100644
index 0000000..062f518
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmmHelpers.c
@@ -0,0 +1,317 @@
+/** @file
+ Helper functions for PCH SMM dispatcher.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "PchSmmHelpers.h"
+
+///
+/// #define BIT_ZERO 0x00000001
+///
+const UINT32 BIT_ZERO = 0x00000001;
+
+///
+/// SUPPORT / HELPER FUNCTIONS (PCH version-independent)
+///
+
+/**
+ Compare 2 SMM source descriptors' enable settings.
+
+ @param[in] Src1 Pointer to the PCH SMI source description table 1
+ @param[in] Src2 Pointer to the PCH SMI source description table 2
+
+ @retval TRUE The enable settings of the 2 SMM source descriptors are identical.
+ @retval FALSE The enable settings of the 2 SMM source descriptors are not identical.
+**/
+BOOLEAN
+CompareEnables (
+ const IN PCH_SMM_SOURCE_DESC *Src1,
+ const IN PCH_SMM_SOURCE_DESC *Src2
+ )
+{
+ BOOLEAN IsEqual;
+ UINTN loopvar;
+
+ IsEqual = TRUE;
+ for (loopvar = 0; loopvar < NUM_EN_BITS; loopvar++) {
+ ///
+ /// It's okay to compare a NULL bit description to a non-NULL bit description.
+ /// They are unequal and these tests will generate the correct result.
+ ///
+ if (Src1->En[loopvar].Bit != Src2->En[loopvar].Bit ||
+ Src1->En[loopvar].Reg.Type != Src2->En[loopvar].Reg.Type ||
+ Src1->En[loopvar].Reg.Data.raw != Src2->En[loopvar].Reg.Data.raw
+ ) {
+ IsEqual = FALSE;
+ break;
+ ///
+ /// out of for loop
+ ///
+ }
+ }
+
+ return IsEqual;
+}
+
+/**
+ Compare 2 SMM source descriptors' statuses.
+
+ @param[in] Src1 Pointer to the PCH SMI source description table 1
+ @param[in] Src2 Pointer to the PCH SMI source description table 2
+
+ @retval TRUE The statuses of the 2 SMM source descriptors are identical.
+ @retval FALSE The statuses of the 2 SMM source descriptors are not identical.
+**/
+BOOLEAN
+CompareStatuses (
+ const IN PCH_SMM_SOURCE_DESC *Src1,
+ const IN PCH_SMM_SOURCE_DESC *Src2
+ )
+{
+ BOOLEAN IsEqual;
+ UINTN loopvar;
+
+ IsEqual = TRUE;
+
+ for (loopvar = 0; loopvar < NUM_STS_BITS; loopvar++) {
+ ///
+ /// It's okay to compare a NULL bit description to a non-NULL bit description.
+ /// They are unequal and these tests will generate the correct result.
+ ///
+ if (Src1->Sts[loopvar].Bit != Src2->Sts[loopvar].Bit ||
+ Src1->Sts[loopvar].Reg.Type != Src2->Sts[loopvar].Reg.Type ||
+ Src1->Sts[loopvar].Reg.Data.raw != Src2->Sts[loopvar].Reg.Data.raw
+ ) {
+ IsEqual = FALSE;
+ break;
+ ///
+ /// out of for loop
+ ///
+ }
+ }
+
+ return IsEqual;
+}
+
+/**
+ Compare 2 SMM source descriptors, based on Enable settings and Status settings of them.
+
+ @param[in] Src1 Pointer to the PCH SMI source description table 1
+ @param[in] Src2 Pointer to the PCH SMI source description table 2
+
+ @retval TRUE The 2 SMM source descriptors are identical.
+ @retval FALSE The 2 SMM source descriptors are not identical.
+**/
+BOOLEAN
+CompareSources (
+ const IN PCH_SMM_SOURCE_DESC *Src1,
+ const IN PCH_SMM_SOURCE_DESC *Src2
+ )
+{
+ return (BOOLEAN) (CompareEnables (Src1, Src2) && CompareStatuses (Src1, Src2));
+}
+
+/**
+ Check if an SMM source is active.
+
+ @param[in] Src Pointer to the PCH SMI source description table
+
+ @retval TRUE It is active.
+ @retval FALSE It is inactive.
+**/
+BOOLEAN
+SourceIsActive (
+ const IN PCH_SMM_SOURCE_DESC *Src
+ )
+{
+ BOOLEAN IsActive;
+ UINTN loopvar;
+
+ BOOLEAN SciEn;
+
+ IsActive = TRUE;
+
+ SciEn = PchSmmGetSciEn ();
+
+ if ((Src->Flags & PCH_SMM_SCI_EN_DEPENDENT) && (SciEn)) {
+ ///
+ /// This source is dependent on SciEn, and SciEn == 1. An ACPI OS is present,
+ /// so we shouldn't do anything w/ this source until SciEn == 0.
+ ///
+ IsActive = FALSE;
+
+ } else {
+ ///
+ /// Read each bit desc from hardware and make sure it's a one
+ ///
+ for (loopvar = 0; loopvar < NUM_EN_BITS; loopvar++) {
+
+ if (!IS_BIT_DESC_NULL (Src->En[loopvar])) {
+
+ if (ReadBitDesc (&Src->En[loopvar]) == 0) {
+ IsActive = FALSE;
+ break;
+ ///
+ /// out of for loop
+ ///
+ }
+
+ }
+ }
+
+ if (IsActive) {
+ ///
+ /// Read each bit desc from hardware and make sure it's a one
+ ///
+ for (loopvar = 0; loopvar < NUM_STS_BITS; loopvar++) {
+
+ if (!IS_BIT_DESC_NULL (Src->Sts[loopvar])) {
+
+ if (ReadBitDesc (&Src->Sts[loopvar]) == 0) {
+ IsActive = FALSE;
+ break;
+ ///
+ /// out of for loop
+ ///
+ }
+
+ }
+ }
+ }
+ }
+
+ return IsActive;
+}
+
+/**
+ Enable the SMI source event by set the SMI enable bit, this function would also clear SMI
+ status bit to make initial state is correct
+
+ @param[in] SrcDesc Pointer to the PCH SMI source description table
+
+ @retval None
+**/
+VOID
+PchSmmEnableSource (
+ const PCH_SMM_SOURCE_DESC *SrcDesc
+ )
+{
+ UINTN loopvar;
+
+ ///
+ /// Set enables to 1 by writing a 1
+ ///
+ for (loopvar = 0; loopvar < NUM_EN_BITS; loopvar++) {
+ if (!IS_BIT_DESC_NULL (SrcDesc->En[loopvar])) {
+ WriteBitDesc (&SrcDesc->En[loopvar], 1, FALSE);
+ }
+ }
+ ///
+ /// Clear statuses to 0 by writing a 1
+ ///
+ for (loopvar = 0; loopvar < NUM_STS_BITS; loopvar++) {
+ if (!IS_BIT_DESC_NULL (SrcDesc->Sts[loopvar])) {
+ WriteBitDesc (&SrcDesc->Sts[loopvar], 1, TRUE);
+ }
+ }
+}
+
+/**
+ Disable the SMI source event by clear the SMI enable bit
+
+ @param[in] SrcDesc Pointer to the PCH SMI source description table
+
+ @retval None
+**/
+VOID
+PchSmmDisableSource (
+ const PCH_SMM_SOURCE_DESC *SrcDesc
+ )
+{
+ UINTN loopvar;
+
+ for (loopvar = 0; loopvar < NUM_EN_BITS; loopvar++) {
+ if (!IS_BIT_DESC_NULL (SrcDesc->En[loopvar])) {
+ WriteBitDesc (&SrcDesc->En[loopvar], 0, FALSE);
+ }
+ }
+}
+
+/**
+ Clear the SMI status bit by set the source bit of SMI status register
+
+ @param[in] SrcDesc Pointer to the PCH SMI source description table
+
+ @retval None
+**/
+VOID
+PchSmmClearSource (
+ const PCH_SMM_SOURCE_DESC *SrcDesc
+ )
+{
+ UINTN loopvar;
+
+ for (loopvar = 0; loopvar < NUM_STS_BITS; loopvar++) {
+ if (!IS_BIT_DESC_NULL (SrcDesc->Sts[loopvar])) {
+ WriteBitDesc (&SrcDesc->Sts[loopvar], 1, TRUE);
+ }
+ }
+}
+
+/**
+ Sets the source to a 1 and then waits for it to clear.
+ Be very careful when calling this function -- it will not
+ ASSERT. An acceptable case to call the function is when
+ waiting for the NEWCENTURY_STS bit to clear (which takes
+ 3 RTCCLKs).
+
+ @param[in] SrcDesc Pointer to the PCH SMI source description table
+
+ @retval None
+**/
+VOID
+PchSmmClearSourceAndBlock (
+ const PCH_SMM_SOURCE_DESC *SrcDesc
+ )
+{
+ UINTN loopvar;
+ BOOLEAN IsSet;
+
+ for (loopvar = 0; loopvar < NUM_STS_BITS; loopvar++) {
+
+ if (!IS_BIT_DESC_NULL (SrcDesc->Sts[loopvar])) {
+ ///
+ /// Write the bit
+ ///
+ WriteBitDesc (&SrcDesc->Sts[loopvar], 1, TRUE);
+
+ ///
+ /// Don't return until the bit actually clears.
+ ///
+ IsSet = TRUE;
+ while (IsSet) {
+ IsSet = ReadBitDesc (&SrcDesc->Sts[loopvar]);
+ ///
+ /// IsSet will eventually clear -- or else we'll have
+ /// an infinite loop.
+ ///
+ }
+ }
+ }
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmmHelpers.h b/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmmHelpers.h
new file mode 100644
index 0000000..24ef5f8
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmmHelpers.h
@@ -0,0 +1,155 @@
+/** @file
+ Helper functions for PCH SMM
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef PCH_SMM_HELPERS_H
+#define PCH_SMM_HELPERS_H
+
+#include "PchSmm.h"
+#include "PchxSmmHelpers.h"
+
+//
+// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// SUPPORT / HELPER FUNCTIONS (PCH version-independent)
+//
+
+/**
+ Publish SMI Dispatch protocols.
+
+ @param[in] None
+
+ @retval None
+**/
+VOID
+PchSmmPublishDispatchProtocols (
+ VOID
+ );
+
+/**
+ Compare 2 SMM source descriptors' enable settings.
+
+ @param[in] Src1 Pointer to the PCH SMI source description table 1
+ @param[in] Src2 Pointer to the PCH SMI source description table 2
+
+ @retval TRUE The enable settings of the 2 SMM source descriptors are identical.
+ @retval FALSE The enable settings of the 2 SMM source descriptors are not identical.
+**/
+BOOLEAN
+CompareEnables (
+ const IN PCH_SMM_SOURCE_DESC *Src1,
+ const IN PCH_SMM_SOURCE_DESC *Src2
+ );
+
+/**
+ Compare 2 SMM source descriptors' statuses.
+
+ @param[in] Src1 Pointer to the PCH SMI source description table 1
+ @param[in] Src2 Pointer to the PCH SMI source description table 2
+
+ @retval TRUE The statuses of the 2 SMM source descriptors are identical.
+ @retval FALSE The statuses of the 2 SMM source descriptors are not identical.
+**/
+BOOLEAN
+CompareStatuses (
+ const IN PCH_SMM_SOURCE_DESC *Src1,
+ const IN PCH_SMM_SOURCE_DESC *Src2
+ );
+
+/**
+ Compare 2 SMM source descriptors, based on Enable settings and Status settings of them.
+
+ @param[in] Src1 Pointer to the PCH SMI source description table 1
+ @param[in] Src2 Pointer to the PCH SMI source description table 2
+
+ @retval TRUE The 2 SMM source descriptors are identical.
+ @retval FALSE The 2 SMM source descriptors are not identical.
+**/
+BOOLEAN
+CompareSources (
+ const IN PCH_SMM_SOURCE_DESC *Src1,
+ const IN PCH_SMM_SOURCE_DESC *Src2
+ );
+
+/**
+ Check if an SMM source is active.
+
+ @param[in] Src Pointer to the PCH SMI source description table
+
+ @retval TRUE It is active.
+ @retval FALSE It is inactive.
+**/
+BOOLEAN
+SourceIsActive (
+ const IN PCH_SMM_SOURCE_DESC *Src
+ );
+
+/**
+ Enable the SMI source event by set the SMI enable bit, this function would also clear SMI
+ status bit to make initial state is correct
+
+ @param[in] SrcDesc Pointer to the PCH SMI source description table
+
+ @retval None
+**/
+VOID
+PchSmmEnableSource (
+ const PCH_SMM_SOURCE_DESC *SrcDesc
+ );
+
+/**
+ Disable the SMI source event by clear the SMI enable bit
+
+ @param[in] SrcDesc Pointer to the PCH SMI source description table
+
+ @retval None
+**/
+VOID
+PchSmmDisableSource (
+ const PCH_SMM_SOURCE_DESC *SrcDesc
+ );
+
+/**
+ Clear the SMI status bit by set the source bit of SMI status register
+
+ @param[in] SrcDesc Pointer to the PCH SMI source description table
+
+ @retval None
+**/
+VOID
+PchSmmClearSource (
+ const PCH_SMM_SOURCE_DESC *SrcDesc
+ );
+
+/**
+ Sets the source to a 1 and then waits for it to clear.
+ Be very careful when calling this function -- it will not
+ ASSERT. An acceptable case to call the function is when
+ waiting for the NEWCENTURY_STS bit to clear (which takes
+ 3 RTCCLKs).
+
+ @param[in] SrcDesc Pointer to the PCH SMI source description table
+
+ @retval None
+**/
+VOID
+PchSmmClearSourceAndBlock (
+ const PCH_SMM_SOURCE_DESC *SrcDesc
+ );
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmmIchn.c b/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmmIchn.c
new file mode 100644
index 0000000..5ecb7d3
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmmIchn.c
@@ -0,0 +1,2425 @@
+/** @file
+ File to contain all the hardware specific stuff for the Smm Ichn dispatch protocol.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "PchSmmHelpers.h"
+
+#define PCH_RCRB_BASE_NEED_FIX 0
+
+PCH_SMM_SOURCE_DESC ICHN_H_SOURCE_DESCS[NUM_ICHN_TYPES] = {
+ ///
+ /// IchnMch
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_EN
+ },
+ S_PCH_SMI_EN,
+ N_PCH_SMI_EN_TCO
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ (PCH_TCO_BASE + R_PCH_TCO1_STS)
+ },
+ S_PCH_TCO1_STS,
+ N_PCH_TCO1_STS_DMISMI
+ }
+ }
+ },
+ ///
+ /// IchnPme
+ ///
+ {
+ PCH_SMM_SCI_EN_DEPENDENT,
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_ACPI_GPE0a_EN
+ },
+ S_PCH_ACPI_GPE0a_EN,
+ N_PCH_ACPI_GPE0a_EN_PME
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_ACPI_GPE0a_STS
+ },
+ S_PCH_ACPI_GPE0a_STS,
+ N_PCH_ACPI_GPE0a_STS_PME
+ }
+ }
+ },
+ ///
+ /// IchnRtcAlarm
+ ///
+ {
+ PCH_SMM_SCI_EN_DEPENDENT,
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_ACPI_PM1_EN
+ },
+ S_PCH_ACPI_PM1_EN,
+ N_PCH_ACPI_PM1_EN_RTC
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_ACPI_PM1_STS
+ },
+ S_PCH_ACPI_PM1_STS,
+ N_PCH_ACPI_PM1_STS_RTC
+ }
+ }
+ },
+ ///
+ /// IchnRingIndicate
+ ///
+ {
+ PCH_SMM_SCI_EN_DEPENDENT,
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_ACPI_GPE0a_EN
+ },
+ S_PCH_ACPI_GPE0a_EN,
+ N_PCH_ACPI_GPE0a_EN_RI
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_ACPI_GPE0a_STS
+ },
+ S_PCH_ACPI_GPE0a_STS,
+ N_PCH_ACPI_GPE0a_STS_RI
+ }
+ }
+ },
+ ///
+ /// IchnAc97Wake
+ /// ICH8M has removed AC97 but IchnAc97Wake is the enumed index reserved in framework SmmIchnDispatch protocol,
+ /// we just fill in invalid initializer and not use it.
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ NULL_BIT_DESC_INITIALIZER,
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ NULL_BIT_DESC_INITIALIZER
+ }
+ },
+ ///
+ /// IchnSerialIrq
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ NULL_BIT_DESC_INITIALIZER,
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_STS
+ },
+ S_PCH_SMI_STS,
+ N_PCH_SMI_STS_SERIRQ
+ }
+ }
+ },
+ ///
+ /// IchnY2KRollover
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_EN
+ },
+ S_PCH_SMI_EN,
+ N_PCH_SMI_EN_TCO
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ (PCH_TCO_BASE + R_PCH_TCO1_STS)
+ },
+ S_PCH_TCO1_STS,
+ N_PCH_TCO1_STS_NEWCENTURY
+ }
+ }
+ },
+ ///
+ /// IchnTcoTimeout
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_EN
+ },
+ S_PCH_SMI_EN,
+ N_PCH_SMI_EN_TCO
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ (PCH_TCO_BASE + R_PCH_TCO1_STS)
+ },
+ S_PCH_TCO1_STS,
+ N_PCH_TCO1_STS_TIMEOUT
+ }
+ }
+ },
+ ///
+ /// IchnOsTco
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_EN
+ },
+ S_PCH_SMI_EN,
+ N_PCH_SMI_EN_TCO
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ (PCH_TCO_BASE + R_PCH_TCO1_STS)
+ },
+ S_PCH_TCO1_STS,
+ N_PCH_TCO1_STS_SW_TCO_SMI
+ }
+ }
+ },
+ ///
+ /// IchnNmi
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_EN
+ },
+ S_PCH_SMI_EN,
+ N_PCH_SMI_EN_TCO
+ },
+ {
+ {
+ ACPI_ADDR_TYPE,
+ (PCH_TCO_BASE + R_PCH_TCO1_CNT)
+ },
+ S_PCH_TCO1_CNT,
+ N_PCH_TCO_CNT_NMI2SMI_EN
+ }
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ (PCH_TCO_BASE + R_PCH_TCO1_STS)
+ },
+ S_PCH_TCO1_STS,
+ N_PCH_TCO1_STS_NMI2SMI
+ }
+ }
+ },
+ ///
+ /// IchnIntruderDetect
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_EN
+ },
+ S_PCH_SMI_EN,
+ N_PCH_SMI_EN_TCO
+ },
+ {
+ {
+ ACPI_ADDR_TYPE,
+ (PCH_TCO_BASE + R_PCH_TCO2_CNT)
+ },
+ S_PCH_TCO2_CNT,
+ N_PCH_TCO2_CNT_INTRD_SEL
+ }
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ (PCH_TCO_BASE + R_PCH_TCO2_STS)
+ },
+ S_PCH_TCO2_STS,
+ N_PCH_TCO2_STS_INTRD_DET
+ }
+ }
+ },
+ ///
+ /// IchnBiosWp
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_EN
+ },
+ S_PCH_SMI_EN,
+ N_PCH_SMI_EN_TCO
+ },
+ {
+ {
+ PCIE_ADDR_TYPE,
+ (
+ (DEFAULT_PCI_BUS_NUMBER_PCH << 24) |
+ (PCI_DEVICE_NUMBER_PCH_LPC << 16) |
+ (PCI_FUNCTION_NUMBER_PCH_LPC << 8) |
+ R_PCH_LPC_BIOS_CNTL
+ )
+ },
+ S_PCH_LPC_BIOS_CNTL,
+ N_PCH_LPC_BIOS_CNTL_BLE
+ }
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ (PCH_TCO_BASE + R_PCH_TCO1_STS)
+ },
+ S_PCH_TCO1_STS,
+ N_PCH_TCO1_STS_BIOSWR
+ }
+ }
+ },
+ ///
+ /// IchnMcSmi
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_EN
+ },
+ S_PCH_SMI_EN,
+ N_PCH_SMI_EN_MCSMI
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_STS
+ },
+ S_PCH_SMI_STS,
+ N_PCH_SMI_STS_MCSMI
+ }
+ }
+ },
+ ///
+ /// IchnPmeB0
+ ///
+ {
+ PCH_SMM_SCI_EN_DEPENDENT,
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_ACPI_GPE0a_EN
+ },
+ S_PCH_ACPI_GPE0a_EN,
+ N_PCH_ACPI_GPE0a_EN_PME_B0
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_ACPI_GPE0a_STS
+ },
+ S_PCH_ACPI_GPE0a_STS,
+ N_PCH_ACPI_GPE0a_STS_PME_B0
+ }
+ }
+ },
+ ///
+ /// IchnThrmSts (THRM# signal no longer existed in PCH)
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ NULL_BIT_DESC_INITIALIZER,
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ NULL_BIT_DESC_INITIALIZER
+ }
+ },
+ ///
+ /// IchnSmBus
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ NULL_BIT_DESC_INITIALIZER,
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_STS
+ },
+ S_PCH_SMI_STS,
+ N_PCH_SMI_STS_SMBUS
+ }
+ }
+ },
+ ///
+ /// IchnIntelUsb2
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_EN
+ },
+ S_PCH_SMI_EN,
+ N_PCH_SMI_EN_INTEL_USB2
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_STS
+ },
+ S_PCH_SMI_STS,
+ N_PCH_SMI_STS_INTEL_USB2
+ }
+ }
+ },
+ ///
+ /// IchnMonSmi7
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ NULL_BIT_DESC_INITIALIZER,
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ NULL_BIT_DESC_INITIALIZER
+ }
+ },
+ ///
+ /// IchnMonSmi6
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ NULL_BIT_DESC_INITIALIZER,
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ NULL_BIT_DESC_INITIALIZER
+ }
+ },
+ ///
+ /// IchnMonSmi5
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ NULL_BIT_DESC_INITIALIZER,
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ NULL_BIT_DESC_INITIALIZER
+ }
+ },
+ ///
+ /// IchnMonSmi4
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ NULL_BIT_DESC_INITIALIZER,
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ NULL_BIT_DESC_INITIALIZER
+ }
+ },
+ ///
+ /// IchnDevTrap13
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ NULL_BIT_DESC_INITIALIZER,
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ NULL_BIT_DESC_INITIALIZER
+ }
+ },
+ ///
+ /// IchnDevTrap12, KBC_ACT_STS
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ NULL_BIT_DESC_INITIALIZER,
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_DEVACT_STS
+ },
+ S_PCH_DEVACT_STS,
+ 12
+ }
+ }
+ },
+ ///
+ /// IchnDevTrap11
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ NULL_BIT_DESC_INITIALIZER,
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ NULL_BIT_DESC_INITIALIZER
+ }
+ },
+ ///
+ /// IchnDevTrap10
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ NULL_BIT_DESC_INITIALIZER,
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ NULL_BIT_DESC_INITIALIZER
+ }
+ },
+ ///
+ /// IchnDevTrap9, PIRQDH_ACT_STS
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ NULL_BIT_DESC_INITIALIZER,
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_DEVACT_STS
+ },
+ S_PCH_DEVACT_STS,
+ 9
+ }
+ }
+ },
+ ///
+ /// IchnDevTrap8, PIRQCG_ACT_STS
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ NULL_BIT_DESC_INITIALIZER,
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_DEVACT_STS
+ },
+ S_PCH_DEVACT_STS,
+ 8
+ }
+ }
+ },
+ ///
+ /// IchnDevTrap7, PIRQBF_ACT_STS
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ NULL_BIT_DESC_INITIALIZER,
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_DEVACT_STS
+ },
+ S_PCH_DEVACT_STS,
+ 7
+ }
+ }
+ },
+ ///
+ /// IchnDevTrap6, PIRQAE_ACT_STS
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ NULL_BIT_DESC_INITIALIZER,
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_DEVACT_STS
+ },
+ S_PCH_DEVACT_STS,
+ 6
+ }
+ }
+ },
+ ///
+ /// IchnDevTrap5
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ NULL_BIT_DESC_INITIALIZER,
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ NULL_BIT_DESC_INITIALIZER
+ }
+ },
+ ///
+ /// IchnDevTrap3
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ NULL_BIT_DESC_INITIALIZER,
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ NULL_BIT_DESC_INITIALIZER
+ }
+ },
+ ///
+ /// IchnDevTrap2
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ NULL_BIT_DESC_INITIALIZER,
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ NULL_BIT_DESC_INITIALIZER
+ }
+ },
+ ///
+ /// IchnDevTrap1
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ NULL_BIT_DESC_INITIALIZER,
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ NULL_BIT_DESC_INITIALIZER
+ }
+ },
+ ///
+ /// IchnDevTrap0, IDE_ACT_STS
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ NULL_BIT_DESC_INITIALIZER,
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_DEVACT_STS
+ },
+ S_PCH_DEVACT_STS,
+ 0
+ }
+ }
+ },
+ ///
+ /// PCH I/O Trap register 3 monitor,
+ /// The "PCH_RCRB_BASE_NEED_FIX" should be fixed since the RCRB base should get from the RCBA register filled by platform module.
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ MEMORY_MAPPED_IO_ADDRESS_TYPE,
+ PCH_RCRB_BASE_NEED_FIX + R_PCH_RCRB_IO_TRAP_3
+ },
+ 8,
+ 0
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ MEMORY_MAPPED_IO_ADDRESS_TYPE,
+ PCH_RCRB_BASE_NEED_FIX + R_PCH_RCRB_TRSR
+ },
+ 1,
+ 3
+ }
+ }
+ },
+ ///
+ /// PCH I/O Trap register 2 monitor
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ MEMORY_MAPPED_IO_ADDRESS_TYPE,
+ PCH_RCRB_BASE_NEED_FIX + R_PCH_RCRB_IO_TRAP_2
+ },
+ 8,
+ 0
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ MEMORY_MAPPED_IO_ADDRESS_TYPE,
+ PCH_RCRB_BASE_NEED_FIX + R_PCH_RCRB_TRSR
+ },
+ 1,
+ 2
+ }
+ }
+ },
+ ///
+ /// PCH I/O Trap register 1 monitor
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ MEMORY_MAPPED_IO_ADDRESS_TYPE,
+ PCH_RCRB_BASE_NEED_FIX + R_PCH_RCRB_IO_TRAP_1
+ },
+ 8,
+ 0
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ MEMORY_MAPPED_IO_ADDRESS_TYPE,
+ PCH_RCRB_BASE_NEED_FIX + R_PCH_RCRB_TRSR
+ },
+ 1,
+ 1
+ }
+ }
+ },
+ ///
+ /// PCH I/O Trap register 0 monitor
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ MEMORY_MAPPED_IO_ADDRESS_TYPE,
+ PCH_RCRB_BASE_NEED_FIX + R_PCH_RCRB_IO_TRAP_0
+ },
+ 8,
+ 0
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ MEMORY_MAPPED_IO_ADDRESS_TYPE,
+ PCH_RCRB_BASE_NEED_FIX + R_PCH_RCRB_TRSR
+ },
+ 1,
+ 0
+ }
+ }
+ }
+};
+
+PCH_SMM_SOURCE_DESC ICHN_LP_SOURCE_DESCS[NUM_ICHN_TYPES] = {
+ ///
+ /// IchnMch
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_EN
+ },
+ S_PCH_SMI_EN,
+ N_PCH_SMI_EN_TCO
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ (PCH_TCO_BASE + R_PCH_TCO1_STS)
+ },
+ S_PCH_TCO1_STS,
+ N_PCH_TCO1_STS_DMISMI
+ }
+ }
+ },
+ ///
+ /// IchnPme
+ ///
+ {
+ PCH_SMM_SCI_EN_DEPENDENT,
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_ACPI_GPE0_EN_127_96
+ },
+ S_PCH_ACPI_GPE0_EN_127_96,
+ N_PCH_ACPI_GPE0_EN_127_96_PME
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_ACPI_GPE0_STS_127_96
+ },
+ S_PCH_ACPI_GPE0_STS_127_96,
+ N_PCH_ACPI_GPE0_STS_127_96_PME
+ }
+ }
+ },
+ ///
+ /// IchnRtcAlarm
+ ///
+ {
+ PCH_SMM_SCI_EN_DEPENDENT,
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_ACPI_PM1_EN
+ },
+ S_PCH_ACPI_PM1_EN,
+ N_PCH_ACPI_PM1_EN_RTC
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_ACPI_PM1_STS
+ },
+ S_PCH_ACPI_PM1_STS,
+ N_PCH_ACPI_PM1_STS_RTC
+ }
+ }
+ },
+ ///
+ /// IchnRingIndicate
+ ///
+ {
+ PCH_SMM_SCI_EN_DEPENDENT,
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_ACPI_GPE0_EN_127_96
+ },
+ S_PCH_ACPI_GPE0_EN_127_96,
+ N_PCH_ACPI_GPE0_EN_127_96_RI
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_ACPI_GPE0_STS_127_96
+ },
+ S_PCH_ACPI_GPE0_STS_127_96,
+ N_PCH_ACPI_GPE0_STS_127_96_RI
+ }
+ }
+ },
+ ///
+ /// IchnAc97Wake
+ /// ICH8M has removed AC97 but IchnAc97Wake is the enumed index reserved in framework SmmIchnDispatch protocol,
+ /// we just fill in invalid initializer and not use it.
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ NULL_BIT_DESC_INITIALIZER,
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ NULL_BIT_DESC_INITIALIZER
+ }
+ },
+ ///
+ /// IchnSerialIrq
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ NULL_BIT_DESC_INITIALIZER,
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_STS
+ },
+ S_PCH_SMI_STS,
+ N_PCH_SMI_STS_SERIRQ
+ }
+ }
+ },
+ ///
+ /// IchnY2KRollover
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_EN
+ },
+ S_PCH_SMI_EN,
+ N_PCH_SMI_EN_TCO
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ (PCH_TCO_BASE + R_PCH_TCO1_STS)
+ },
+ S_PCH_TCO1_STS,
+ N_PCH_TCO1_STS_NEWCENTURY
+ }
+ }
+ },
+ ///
+ /// IchnTcoTimeout
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_EN
+ },
+ S_PCH_SMI_EN,
+ N_PCH_SMI_EN_TCO
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ (PCH_TCO_BASE + R_PCH_TCO1_STS)
+ },
+ S_PCH_TCO1_STS,
+ N_PCH_TCO1_STS_TIMEOUT
+ }
+ }
+ },
+ ///
+ /// IchnOsTco
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_EN
+ },
+ S_PCH_SMI_EN,
+ N_PCH_SMI_EN_TCO
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ (PCH_TCO_BASE + R_PCH_TCO1_STS)
+ },
+ S_PCH_TCO1_STS,
+ N_PCH_TCO1_STS_SW_TCO_SMI
+ }
+ }
+ },
+ ///
+ /// IchnNmi
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_EN
+ },
+ S_PCH_SMI_EN,
+ N_PCH_SMI_EN_TCO
+ },
+ {
+ {
+ ACPI_ADDR_TYPE,
+ (PCH_TCO_BASE + R_PCH_TCO1_CNT)
+ },
+ S_PCH_TCO1_CNT,
+ N_PCH_TCO_CNT_NMI2SMI_EN
+ }
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ (PCH_TCO_BASE + R_PCH_TCO1_STS)
+ },
+ S_PCH_TCO1_STS,
+ N_PCH_TCO1_STS_NMI2SMI
+ }
+ }
+ },
+ ///
+ /// IchnIntruderDetect
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_EN
+ },
+ S_PCH_SMI_EN,
+ N_PCH_SMI_EN_TCO
+ },
+ {
+ {
+ ACPI_ADDR_TYPE,
+ (PCH_TCO_BASE + R_PCH_TCO2_CNT)
+ },
+ S_PCH_TCO2_CNT,
+ N_PCH_TCO2_CNT_INTRD_SEL
+ }
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ (PCH_TCO_BASE + R_PCH_TCO2_STS)
+ },
+ S_PCH_TCO2_STS,
+ N_PCH_TCO2_STS_INTRD_DET
+ }
+ }
+ },
+ ///
+ /// IchnBiosWp
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_EN
+ },
+ S_PCH_SMI_EN,
+ N_PCH_SMI_EN_TCO
+ },
+ {
+ {
+ PCIE_ADDR_TYPE,
+ (
+ (DEFAULT_PCI_BUS_NUMBER_PCH << 24) |
+ (PCI_DEVICE_NUMBER_PCH_LPC << 16) |
+ (PCI_FUNCTION_NUMBER_PCH_LPC << 8) |
+ R_PCH_LPC_BIOS_CNTL
+ )
+ },
+ S_PCH_LPC_BIOS_CNTL,
+ N_PCH_LPC_BIOS_CNTL_BLE
+ }
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ (PCH_TCO_BASE + R_PCH_TCO1_STS)
+ },
+ S_PCH_TCO1_STS,
+ N_PCH_TCO1_STS_BIOSWR
+ }
+ }
+ },
+ ///
+ /// IchnMcSmi
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_EN
+ },
+ S_PCH_SMI_EN,
+ N_PCH_SMI_EN_MCSMI
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_STS
+ },
+ S_PCH_SMI_STS,
+ N_PCH_SMI_STS_MCSMI
+ }
+ }
+ },
+ ///
+ /// IchnPmeB0
+ ///
+ {
+ PCH_SMM_SCI_EN_DEPENDENT,
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_ACPI_GPE0_EN_127_96
+ },
+ S_PCH_ACPI_GPE0_EN_127_96,
+ N_PCH_ACPI_GPE0_EN_127_96_PME_B0
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_ACPI_GPE0_STS_127_96
+ },
+ S_PCH_ACPI_GPE0_STS_127_96,
+ N_PCH_ACPI_GPE0_STS_127_96_PME_B0
+ }
+ }
+ },
+ ///
+ /// IchnThrmSts (THRM# signal no longer existed in PCH)
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ NULL_BIT_DESC_INITIALIZER,
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ NULL_BIT_DESC_INITIALIZER
+ }
+ },
+ ///
+ /// IchnSmBus
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ NULL_BIT_DESC_INITIALIZER,
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_STS
+ },
+ S_PCH_SMI_STS,
+ N_PCH_SMI_STS_SMBUS
+ }
+ }
+ },
+ ///
+ /// IchnIntelUsb2
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_EN
+ },
+ S_PCH_SMI_EN,
+ N_PCH_SMI_EN_INTEL_USB2
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_STS
+ },
+ S_PCH_SMI_STS,
+ N_PCH_SMI_STS_INTEL_USB2
+ }
+ }
+ },
+ ///
+ /// IchnMonSmi7
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ NULL_BIT_DESC_INITIALIZER,
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ NULL_BIT_DESC_INITIALIZER
+ }
+ },
+ ///
+ /// IchnMonSmi6
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ NULL_BIT_DESC_INITIALIZER,
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ NULL_BIT_DESC_INITIALIZER
+ }
+ },
+ ///
+ /// IchnMonSmi5
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ NULL_BIT_DESC_INITIALIZER,
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ NULL_BIT_DESC_INITIALIZER
+ }
+ },
+ ///
+ /// IchnMonSmi4
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ NULL_BIT_DESC_INITIALIZER,
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ NULL_BIT_DESC_INITIALIZER
+ }
+ },
+ ///
+ /// IchnDevTrap13
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ NULL_BIT_DESC_INITIALIZER,
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ NULL_BIT_DESC_INITIALIZER
+ }
+ },
+ ///
+ /// IchnDevTrap12, KBC_ACT_STS
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ NULL_BIT_DESC_INITIALIZER,
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_DEVACT_STS
+ },
+ S_PCH_DEVACT_STS,
+ 12
+ }
+ }
+ },
+ ///
+ /// IchnDevTrap11
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ NULL_BIT_DESC_INITIALIZER,
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ NULL_BIT_DESC_INITIALIZER
+ }
+ },
+ ///
+ /// IchnDevTrap10
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ NULL_BIT_DESC_INITIALIZER,
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ NULL_BIT_DESC_INITIALIZER
+ }
+ },
+ ///
+ /// IchnDevTrap9, PIRQDH_ACT_STS
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ NULL_BIT_DESC_INITIALIZER,
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_DEVACT_STS
+ },
+ S_PCH_DEVACT_STS,
+ 9
+ }
+ }
+ },
+ ///
+ /// IchnDevTrap8, PIRQCG_ACT_STS
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ NULL_BIT_DESC_INITIALIZER,
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_DEVACT_STS
+ },
+ S_PCH_DEVACT_STS,
+ 8
+ }
+ }
+ },
+ ///
+ /// IchnDevTrap7, PIRQBF_ACT_STS
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ NULL_BIT_DESC_INITIALIZER,
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_DEVACT_STS
+ },
+ S_PCH_DEVACT_STS,
+ 7
+ }
+ }
+ },
+ ///
+ /// IchnDevTrap6, PIRQAE_ACT_STS
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ NULL_BIT_DESC_INITIALIZER,
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_DEVACT_STS
+ },
+ S_PCH_DEVACT_STS,
+ 6
+ }
+ }
+ },
+ ///
+ /// IchnDevTrap5
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ NULL_BIT_DESC_INITIALIZER,
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ NULL_BIT_DESC_INITIALIZER
+ }
+ },
+ ///
+ /// IchnDevTrap3
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ NULL_BIT_DESC_INITIALIZER,
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ NULL_BIT_DESC_INITIALIZER
+ }
+ },
+ ///
+ /// IchnDevTrap2
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ NULL_BIT_DESC_INITIALIZER,
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ NULL_BIT_DESC_INITIALIZER
+ }
+ },
+ ///
+ /// IchnDevTrap1
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ NULL_BIT_DESC_INITIALIZER,
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ NULL_BIT_DESC_INITIALIZER
+ }
+ },
+ ///
+ /// IchnDevTrap0, IDE_ACT_STS
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ NULL_BIT_DESC_INITIALIZER,
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_DEVACT_STS
+ },
+ S_PCH_DEVACT_STS,
+ 0
+ }
+ }
+ },
+ ///
+ /// PCH I/O Trap register 3 monitor,
+ /// The "PCH_RCRB_BASE_NEED_FIX" should be fixed since the RCRB base should get from the RCBA register filled by platform module.
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ MEMORY_MAPPED_IO_ADDRESS_TYPE,
+ PCH_RCRB_BASE_NEED_FIX + R_PCH_RCRB_IO_TRAP_3
+ },
+ 8,
+ 0
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ MEMORY_MAPPED_IO_ADDRESS_TYPE,
+ PCH_RCRB_BASE_NEED_FIX + R_PCH_RCRB_TRSR
+ },
+ 1,
+ 3
+ }
+ }
+ },
+ ///
+ /// PCH I/O Trap register 2 monitor
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ MEMORY_MAPPED_IO_ADDRESS_TYPE,
+ PCH_RCRB_BASE_NEED_FIX + R_PCH_RCRB_IO_TRAP_2
+ },
+ 8,
+ 0
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ MEMORY_MAPPED_IO_ADDRESS_TYPE,
+ PCH_RCRB_BASE_NEED_FIX + R_PCH_RCRB_TRSR
+ },
+ 1,
+ 2
+ }
+ }
+ },
+ ///
+ /// PCH I/O Trap register 1 monitor
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ MEMORY_MAPPED_IO_ADDRESS_TYPE,
+ PCH_RCRB_BASE_NEED_FIX + R_PCH_RCRB_IO_TRAP_1
+ },
+ 8,
+ 0
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ MEMORY_MAPPED_IO_ADDRESS_TYPE,
+ PCH_RCRB_BASE_NEED_FIX + R_PCH_RCRB_TRSR
+ },
+ 1,
+ 1
+ }
+ }
+ },
+ ///
+ /// PCH I/O Trap register 0 monitor
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ MEMORY_MAPPED_IO_ADDRESS_TYPE,
+ PCH_RCRB_BASE_NEED_FIX + R_PCH_RCRB_IO_TRAP_0
+ },
+ 8,
+ 0
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ MEMORY_MAPPED_IO_ADDRESS_TYPE,
+ PCH_RCRB_BASE_NEED_FIX + R_PCH_RCRB_TRSR
+ },
+ 1,
+ 0
+ }
+ }
+ }
+};
+
+PCH_SMM_SOURCE_DESC ICHN_EX_SOURCE_DESCS[IchnExTypeMAX - IchnExPciExpress] = {
+ ///
+ /// IchnExPciExpress
+ ///
+ NULL_SOURCE_DESC_INITIALIZER,
+ ///
+ /// IchnExMonitor
+ ///
+ NULL_SOURCE_DESC_INITIALIZER,
+ ///
+ /// IchnExSpi
+ ///
+ NULL_SOURCE_DESC_INITIALIZER,
+ ///
+ /// IchnExQRT
+ ///
+ NULL_SOURCE_DESC_INITIALIZER,
+ ///
+ /// IchnExGpioUnlock
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_EN
+ },
+ S_PCH_SMI_EN,
+ N_PCH_SMI_EN_GPIO_UNLOCK
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_STS
+ },
+ S_PCH_SMI_STS,
+ N_PCH_SMI_STS_GPIO_UNLOCK
+ }
+ }
+ },
+ ///
+ /// IchnExTmrOverflow
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_ACPI_PM1_EN
+ },
+ S_PCH_ACPI_PM1_EN,
+ N_PCH_ACPI_PM1_EN_TMROF
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_ACPI_PM1_STS
+ },
+ S_PCH_ACPI_PM1_STS,
+ N_PCH_ACPI_PM1_STS_TMROF
+ }
+ }
+ },
+ ///
+ /// IchnExPcie0Hotplug
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ PCIE_ADDR_TYPE,
+ (
+ (DEFAULT_PCI_BUS_NUMBER_PCH << 24) |
+ (PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS << 16) |
+ (PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_1 << 8) |
+ R_PCH_PCIE_MPC
+ )
+ },
+ S_PCH_PCIE_MPC,
+ N_PCH_PCIE_MPC_HPME
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ PCIE_ADDR_TYPE,
+ (
+ (DEFAULT_PCI_BUS_NUMBER_PCH << 24) |
+ (PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS << 16) |
+ (PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_1 << 8) |
+ R_PCH_PCIE_SMSCS
+ )
+ },
+ S_PCH_PCIE_SMSCS,
+ N_PCH_PCIE_SMSCS_HPPDM
+ }
+ }
+ },
+ ///
+ /// IchnExPcie1Hotplug
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ PCIE_ADDR_TYPE,
+ (
+ (DEFAULT_PCI_BUS_NUMBER_PCH << 24) |
+ (PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS << 16) |
+ (PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_2 << 8) |
+ R_PCH_PCIE_MPC
+ )
+ },
+ S_PCH_PCIE_MPC,
+ N_PCH_PCIE_MPC_HPME
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ PCIE_ADDR_TYPE,
+ (
+ (DEFAULT_PCI_BUS_NUMBER_PCH << 24) |
+ (PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS << 16) |
+ (PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_2 << 8) |
+ R_PCH_PCIE_SMSCS
+ )
+ },
+ S_PCH_PCIE_SMSCS,
+ N_PCH_PCIE_SMSCS_HPPDM
+ }
+ }
+ },
+ ///
+ /// IchnExPcie2Hotplug
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ PCIE_ADDR_TYPE,
+ (
+ (DEFAULT_PCI_BUS_NUMBER_PCH << 24) |
+ (PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS << 16) |
+ (PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_3 << 8) |
+ R_PCH_PCIE_MPC
+ )
+ },
+ S_PCH_PCIE_MPC,
+ N_PCH_PCIE_MPC_HPME
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ PCIE_ADDR_TYPE,
+ (
+ (DEFAULT_PCI_BUS_NUMBER_PCH << 24) |
+ (PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS << 16) |
+ (PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_3 << 8) |
+ R_PCH_PCIE_SMSCS
+ )
+ },
+ S_PCH_PCIE_SMSCS,
+ N_PCH_PCIE_SMSCS_HPPDM
+ }
+ }
+ },
+ ///
+ /// IchnExPcie3Hotplug
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ PCIE_ADDR_TYPE,
+ (
+ (DEFAULT_PCI_BUS_NUMBER_PCH << 24) |
+ (PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS << 16) |
+ (PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_4 << 8) |
+ R_PCH_PCIE_MPC
+ )
+ },
+ S_PCH_PCIE_MPC,
+ N_PCH_PCIE_MPC_HPME
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ PCIE_ADDR_TYPE,
+ (
+ (DEFAULT_PCI_BUS_NUMBER_PCH << 24) |
+ (PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS << 16) |
+ (PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_4 << 8) |
+ R_PCH_PCIE_SMSCS
+ )
+ },
+ S_PCH_PCIE_SMSCS,
+ N_PCH_PCIE_SMSCS_HPPDM
+ }
+ }
+ },
+ ///
+ /// IchnExPcie4Hotplug
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ PCIE_ADDR_TYPE,
+ (
+ (DEFAULT_PCI_BUS_NUMBER_PCH << 24) |
+ (PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS << 16) |
+ (PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_5 << 8) |
+ R_PCH_PCIE_MPC
+ )
+ },
+ S_PCH_PCIE_MPC,
+ N_PCH_PCIE_MPC_HPME
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ PCIE_ADDR_TYPE,
+ (
+ (DEFAULT_PCI_BUS_NUMBER_PCH << 24) |
+ (PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS << 16) |
+ (PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_5 << 8) |
+ R_PCH_PCIE_SMSCS
+ )
+ },
+ S_PCH_PCIE_SMSCS,
+ N_PCH_PCIE_SMSCS_HPPDM
+ }
+ }
+ },
+ ///
+ /// IchnExPcie5Hotplug
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ PCIE_ADDR_TYPE,
+ (
+ (DEFAULT_PCI_BUS_NUMBER_PCH << 24) |
+ (PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS << 16) |
+ (PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_6 << 8) |
+ R_PCH_PCIE_MPC
+ )
+ },
+ S_PCH_PCIE_MPC,
+ N_PCH_PCIE_MPC_HPME
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ PCIE_ADDR_TYPE,
+ (
+ (DEFAULT_PCI_BUS_NUMBER_PCH << 24) |
+ (PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS << 16) |
+ (PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_6 << 8) |
+ R_PCH_PCIE_SMSCS
+ )
+ },
+ S_PCH_PCIE_SMSCS,
+ N_PCH_PCIE_SMSCS_HPPDM
+ }
+ }
+ },
+ ///
+ /// IchnExPcie6Hotplug
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ PCIE_ADDR_TYPE,
+ (
+ (DEFAULT_PCI_BUS_NUMBER_PCH << 24) |
+ (PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS << 16) |
+ (PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_7 << 8) |
+ R_PCH_PCIE_MPC
+ )
+ },
+ S_PCH_PCIE_MPC,
+ N_PCH_PCIE_MPC_HPME
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ PCIE_ADDR_TYPE,
+ (
+ (DEFAULT_PCI_BUS_NUMBER_PCH << 24) |
+ (PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS << 16) |
+ (PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_7 << 8) |
+ R_PCH_PCIE_SMSCS
+ )
+ },
+ S_PCH_PCIE_SMSCS,
+ N_PCH_PCIE_SMSCS_HPPDM
+ }
+ }
+ },
+ ///
+ /// IchnExPcie7Hotplug
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ PCIE_ADDR_TYPE,
+ (
+ (DEFAULT_PCI_BUS_NUMBER_PCH << 24) |
+ (PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS << 16) |
+ (PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_8 << 8) |
+ R_PCH_PCIE_MPC
+ )
+ },
+ S_PCH_PCIE_MPC,
+ N_PCH_PCIE_MPC_HPME
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ PCIE_ADDR_TYPE,
+ (
+ (DEFAULT_PCI_BUS_NUMBER_PCH << 24) |
+ (PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS << 16) |
+ (PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_8 << 8) |
+ R_PCH_PCIE_SMSCS
+ )
+ },
+ S_PCH_PCIE_SMSCS,
+ N_PCH_PCIE_SMSCS_HPPDM
+ }
+ }
+ },
+ ///
+ /// IchnExPcie0LinkActive
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ PCIE_ADDR_TYPE,
+ (
+ (DEFAULT_PCI_BUS_NUMBER_PCH << 24) |
+ (PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS << 16) |
+ (PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_1 << 8) |
+ R_PCH_PCIE_MPC
+ )
+ },
+ S_PCH_PCIE_MPC,
+ N_PCH_PCIE_MPC_HPME
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ PCIE_ADDR_TYPE,
+ (
+ (DEFAULT_PCI_BUS_NUMBER_PCH << 24) |
+ (PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS << 16) |
+ (PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_1 << 8) |
+ R_PCH_PCIE_SMSCS
+ )
+ },
+ S_PCH_PCIE_SMSCS,
+ N_PCH_PCIE_SMSCS_HPLAS
+ }
+ }
+ },
+ ///
+ /// IchnExPcie1LinkActive
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ PCIE_ADDR_TYPE,
+ (
+ (DEFAULT_PCI_BUS_NUMBER_PCH << 24) |
+ (PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS << 16) |
+ (PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_2 << 8) |
+ R_PCH_PCIE_MPC
+ )
+ },
+ S_PCH_PCIE_MPC,
+ N_PCH_PCIE_MPC_HPME
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ PCIE_ADDR_TYPE,
+ (
+ (DEFAULT_PCI_BUS_NUMBER_PCH << 24) |
+ (PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS << 16) |
+ (PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_2 << 8) |
+ R_PCH_PCIE_SMSCS
+ )
+ },
+ S_PCH_PCIE_SMSCS,
+ N_PCH_PCIE_SMSCS_HPLAS
+ }
+ }
+ },
+ ///
+ /// IchnExPcie2LinkActive
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ PCIE_ADDR_TYPE,
+ (
+ (DEFAULT_PCI_BUS_NUMBER_PCH << 24) |
+ (PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS << 16) |
+ (PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_3 << 8) |
+ R_PCH_PCIE_MPC
+ )
+ },
+ S_PCH_PCIE_MPC,
+ N_PCH_PCIE_MPC_HPME
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ PCIE_ADDR_TYPE,
+ (
+ (DEFAULT_PCI_BUS_NUMBER_PCH << 24) |
+ (PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS << 16) |
+ (PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_3 << 8) |
+ R_PCH_PCIE_SMSCS
+ )
+ },
+ S_PCH_PCIE_SMSCS,
+ N_PCH_PCIE_SMSCS_HPLAS
+ }
+ }
+ },
+ ///
+ /// IchnExPcie3LinkActive
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ PCIE_ADDR_TYPE,
+ (
+ (DEFAULT_PCI_BUS_NUMBER_PCH << 24) |
+ (PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS << 16) |
+ (PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_4 << 8) |
+ R_PCH_PCIE_MPC
+ )
+ },
+ S_PCH_PCIE_MPC,
+ N_PCH_PCIE_MPC_HPME
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ PCIE_ADDR_TYPE,
+ (
+ (DEFAULT_PCI_BUS_NUMBER_PCH << 24) |
+ (PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS << 16) |
+ (PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_4 << 8) |
+ R_PCH_PCIE_SMSCS
+ )
+ },
+ S_PCH_PCIE_SMSCS,
+ N_PCH_PCIE_SMSCS_HPLAS
+ }
+ }
+ },
+ ///
+ /// IchnExPcie4LinkActive
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ PCIE_ADDR_TYPE,
+ (
+ (DEFAULT_PCI_BUS_NUMBER_PCH << 24) |
+ (PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS << 16) |
+ (PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_5 << 8) |
+ R_PCH_PCIE_MPC
+ )
+ },
+ S_PCH_PCIE_MPC,
+ N_PCH_PCIE_MPC_HPME
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ PCIE_ADDR_TYPE,
+ (
+ (DEFAULT_PCI_BUS_NUMBER_PCH << 24) |
+ (PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS << 16) |
+ (PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_5 << 8) |
+ R_PCH_PCIE_SMSCS
+ )
+ },
+ S_PCH_PCIE_SMSCS,
+ N_PCH_PCIE_SMSCS_HPLAS
+ }
+ }
+ },
+ ///
+ /// IchnExPcie5LinkActive
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ PCIE_ADDR_TYPE,
+ (
+ (DEFAULT_PCI_BUS_NUMBER_PCH << 24) |
+ (PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS << 16) |
+ (PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_6 << 8) |
+ R_PCH_PCIE_MPC
+ )
+ },
+ S_PCH_PCIE_MPC,
+ N_PCH_PCIE_MPC_HPME
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ PCIE_ADDR_TYPE,
+ (
+ (DEFAULT_PCI_BUS_NUMBER_PCH << 24) |
+ (PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS << 16) |
+ (PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_6 << 8) |
+ R_PCH_PCIE_SMSCS
+ )
+ },
+ S_PCH_PCIE_SMSCS,
+ N_PCH_PCIE_SMSCS_HPLAS
+ }
+ }
+ },
+ ///
+ /// IchnExPcie6LinkActive
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ PCIE_ADDR_TYPE,
+ (
+ (DEFAULT_PCI_BUS_NUMBER_PCH << 24) |
+ (PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS << 16) |
+ (PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_7 << 8) |
+ R_PCH_PCIE_MPC
+ )
+ },
+ S_PCH_PCIE_MPC,
+ N_PCH_PCIE_MPC_HPME
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ PCIE_ADDR_TYPE,
+ (
+ (DEFAULT_PCI_BUS_NUMBER_PCH << 24) |
+ (PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS << 16) |
+ (PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_7 << 8) |
+ R_PCH_PCIE_SMSCS
+ )
+ },
+ S_PCH_PCIE_SMSCS,
+ N_PCH_PCIE_SMSCS_HPLAS
+ }
+ }
+ },
+ ///
+ /// IchnExPcie7LinkActive
+ ///
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ PCIE_ADDR_TYPE,
+ (
+ (DEFAULT_PCI_BUS_NUMBER_PCH << 24) |
+ (PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS << 16) |
+ (PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_8 << 8) |
+ R_PCH_PCIE_MPC
+ )
+ },
+ S_PCH_PCIE_MPC,
+ N_PCH_PCIE_MPC_HPME
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ PCIE_ADDR_TYPE,
+ (
+ (DEFAULT_PCI_BUS_NUMBER_PCH << 24) |
+ (PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS << 16) |
+ (PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_8 << 8) |
+ R_PCH_PCIE_SMSCS
+ )
+ },
+ S_PCH_PCIE_SMSCS,
+ N_PCH_PCIE_SMSCS_HPLAS
+ }
+ }
+ }
+};
+
+///
+/// TCO_STS bit that needs to be cleared
+///
+PCH_SMM_SOURCE_DESC TCO_STS = {
+ PCH_SMM_NO_FLAGS,
+ {
+ NULL_BIT_DESC_INITIALIZER,
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_STS
+ },
+ S_PCH_SMI_STS,
+ N_PCH_SMI_STS_TCO
+ }
+ }
+};
+
+/**
+ Clear the SMI status bit after the SMI handling is done
+
+ @param[in] SrcDesc Pointer to the PCH SMI source description table
+
+ @retval None
+**/
+VOID
+EFIAPI
+PchSmmIchnClearSource (
+ PCH_SMM_SOURCE_DESC *SrcDesc
+ )
+{
+ if ((
+ (SrcDesc->Sts[0].Reg.Data.acpi == PCH_TCO_BASE + R_PCH_TCO1_STS) &&
+ (SrcDesc->Sts[0].Bit == N_PCH_TCO1_STS_NEWCENTURY)
+ ) ||
+ (
+ (SrcDesc->Sts[0].Reg.Data.acpi == PCH_TCO_BASE + R_PCH_TCO2_STS) &&
+ (SrcDesc->Sts[0].Bit == N_PCH_TCO2_STS_INTRD_DET)
+ )
+ ) {
+ ///
+ /// This is the Y2K rollover bit and requires special handling
+ ///
+ PchSmmClearSourceAndBlock (SrcDesc);
+ } else {
+ PchSmmClearSource (SrcDesc);
+ }
+ ///
+ /// Any TCO-based status bits require special handling.
+ /// SMI_STS.TCO_STS must be cleared in addition to the status bit in the TCO registers
+ ///
+ PchSmmClearSource (&TCO_STS);
+}
+
+/**
+ Fix the base address of the source regs and status regs.
+ Since Base should get from register filled by platform modules already.
+
+ @param[in] None.
+
+ @retval None.
+**/
+VOID
+PchSmmIchnFixSourceBase (
+ VOID
+ )
+{
+ PCH_SERIES PchSeries;
+
+ PchSeries = GetPchSeries();
+ ///
+ /// We need to fix the IoTrap item's RCRB base,
+ ///
+ if (PchSeries == PchLp) {
+ ICHN_LP_SOURCE_DESCS[IchnIoTrap3].En[0].Reg.Data.mem = (MEM_ADDR) (PCH_RCRB_BASE + R_PCH_RCRB_IO_TRAP_3);
+ ICHN_LP_SOURCE_DESCS[IchnIoTrap3].Sts[0].Reg.Data.mem = (MEM_ADDR) (PCH_RCRB_BASE + R_PCH_RCRB_TRSR);
+ ICHN_LP_SOURCE_DESCS[IchnIoTrap2].En[0].Reg.Data.mem = (MEM_ADDR) (PCH_RCRB_BASE + R_PCH_RCRB_IO_TRAP_2);
+ ICHN_LP_SOURCE_DESCS[IchnIoTrap2].Sts[0].Reg.Data.mem = (MEM_ADDR) (PCH_RCRB_BASE + R_PCH_RCRB_TRSR);
+ ICHN_LP_SOURCE_DESCS[IchnIoTrap1].En[0].Reg.Data.mem = (MEM_ADDR) (PCH_RCRB_BASE + R_PCH_RCRB_IO_TRAP_1);
+ ICHN_LP_SOURCE_DESCS[IchnIoTrap1].Sts[0].Reg.Data.mem = (MEM_ADDR) (PCH_RCRB_BASE + R_PCH_RCRB_TRSR);
+ ICHN_LP_SOURCE_DESCS[IchnIoTrap0].En[0].Reg.Data.mem = (MEM_ADDR) (PCH_RCRB_BASE + R_PCH_RCRB_IO_TRAP_0);
+ ICHN_LP_SOURCE_DESCS[IchnIoTrap0].Sts[0].Reg.Data.mem = (MEM_ADDR) (PCH_RCRB_BASE + R_PCH_RCRB_TRSR);
+ } else if (PchSeries == PchH) {
+ ICHN_H_SOURCE_DESCS[IchnIoTrap3].En[0].Reg.Data.mem = (MEM_ADDR) (PCH_RCRB_BASE + R_PCH_RCRB_IO_TRAP_3);
+ ICHN_H_SOURCE_DESCS[IchnIoTrap3].Sts[0].Reg.Data.mem = (MEM_ADDR) (PCH_RCRB_BASE + R_PCH_RCRB_TRSR);
+ ICHN_H_SOURCE_DESCS[IchnIoTrap2].En[0].Reg.Data.mem = (MEM_ADDR) (PCH_RCRB_BASE + R_PCH_RCRB_IO_TRAP_2);
+ ICHN_H_SOURCE_DESCS[IchnIoTrap2].Sts[0].Reg.Data.mem = (MEM_ADDR) (PCH_RCRB_BASE + R_PCH_RCRB_TRSR);
+ ICHN_H_SOURCE_DESCS[IchnIoTrap1].En[0].Reg.Data.mem = (MEM_ADDR) (PCH_RCRB_BASE + R_PCH_RCRB_IO_TRAP_1);
+ ICHN_H_SOURCE_DESCS[IchnIoTrap1].Sts[0].Reg.Data.mem = (MEM_ADDR) (PCH_RCRB_BASE + R_PCH_RCRB_TRSR);
+ ICHN_H_SOURCE_DESCS[IchnIoTrap0].En[0].Reg.Data.mem = (MEM_ADDR) (PCH_RCRB_BASE + R_PCH_RCRB_IO_TRAP_0);
+ ICHN_H_SOURCE_DESCS[IchnIoTrap0].Sts[0].Reg.Data.mem = (MEM_ADDR) (PCH_RCRB_BASE + R_PCH_RCRB_TRSR);
+ }
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmmPeriodicTimer.c b/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmmPeriodicTimer.c
new file mode 100644
index 0000000..ee554f7
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmmPeriodicTimer.c
@@ -0,0 +1,519 @@
+/** @file
+ File to contain all the hardware specific stuff for the Periodical Timer dispatch protocol.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "PchSmmHelpers.h"
+
+typedef enum {
+ PERIODIC_TIMER= 0,
+ SWSMI_TIMER,
+ NUM_TIMERS
+} SUPPORTED_TIMER;
+
+typedef struct _TIMER_INTERVAL {
+ UINT64 Interval;
+ UINT8 AssociatedTimer;
+} TIMER_INTERVAL;
+
+#define NUM_INTERVALS 8
+
+//
+// Time constants, in 100 nano-second units
+//
+#define TIME_64s 640000000 ///< 64 s
+#define TIME_32s 320000000 ///< 32 s
+#define TIME_16s 160000000 ///< 16 s
+#define TIME_8s 80000000 ///< 8 s
+#define TIME_64ms 640000 ///< 64 ms
+#define TIME_32ms 320000 ///< 32 ms
+#define TIME_16ms 160000 ///< 16 ms
+#define TIME_1_5ms 15000 ///< 1.5 ms
+
+typedef enum {
+ INDEX_TIME_64s = 0,
+ INDEX_TIME_32s,
+ INDEX_TIME_16s,
+ INDEX_TIME_8s,
+ INDEX_TIME_64ms,
+ INDEX_TIME_32ms,
+ INDEX_TIME_16ms,
+ INDEX_TIME_1_5ms,
+ INDEX_TIME_MAX
+} TIMER_INTERVAL_INDEX;
+
+static TIMER_INTERVAL mSmmPeriodicTimerIntervals[NUM_INTERVALS] = {
+ {
+ TIME_64s,
+ PERIODIC_TIMER
+ },
+ {
+ TIME_32s,
+ PERIODIC_TIMER
+ },
+ {
+ TIME_16s,
+ PERIODIC_TIMER
+ },
+ {
+ TIME_8s,
+ PERIODIC_TIMER
+ },
+ {
+ TIME_64ms,
+ SWSMI_TIMER
+ },
+ {
+ TIME_32ms,
+ SWSMI_TIMER
+ },
+ {
+ TIME_16ms,
+ SWSMI_TIMER
+ },
+ {
+ TIME_1_5ms,
+ SWSMI_TIMER
+ },
+};
+
+typedef struct _TIMER_INFO {
+ UINTN NumChildren; ///< number of children using this timer
+ UINT64 MinReqInterval; ///< minimum interval required by children
+ UINTN CurrentSetting; ///< interval this timer is set at right now (index into interval table)
+} TIMER_INFO;
+
+TIMER_INFO mTimers[NUM_TIMERS];
+
+PCH_SMM_SOURCE_DESC mTIMER_SOURCE_DESCS[NUM_TIMERS] = {
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_EN
+ },
+ S_PCH_SMI_EN,
+ N_PCH_SMI_EN_PERIODIC
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_STS
+ },
+ S_PCH_SMI_STS,
+ N_PCH_SMI_STS_PERIODIC
+ }
+ }
+ },
+ {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_EN
+ },
+ S_PCH_SMI_EN,
+ N_PCH_SMI_EN_SWSMI_TMR
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_STS
+ },
+ S_PCH_SMI_STS,
+ N_PCH_SMI_STS_SWSMI_TMR
+ }
+ }
+ }
+};
+
+VOID
+PchSmmPeriodicTimerProgramTimers (
+ VOID
+ );
+
+/**
+ Convert the dispatch context to the timer interval, this function will assert if then either:
+ (1) The context contains an invalid interval
+ (2) The timer interval table is corrupt
+
+ @param[in] DispatchContext The pointer to the Dispatch Context
+
+ @retval TIMER_INTERVAL The timer interval of input dispatch context
+**/
+TIMER_INTERVAL *
+ContextToTimerInterval (
+ IN PCH_SMM_CONTEXT *DispatchContext
+ )
+{
+ UINTN loopvar;
+
+ ///
+ /// Determine which timer this child is using
+ ///
+ for (loopvar = 0; loopvar < NUM_INTERVALS; loopvar++) {
+ if (((DispatchContext->PeriodicTimer.SmiTickInterval == 0) &&
+ (DispatchContext->PeriodicTimer.Period >= mSmmPeriodicTimerIntervals[loopvar].Interval)) ||
+ (DispatchContext->PeriodicTimer.SmiTickInterval == mSmmPeriodicTimerIntervals[loopvar].Interval)) {
+ return &mSmmPeriodicTimerIntervals[loopvar];
+ }
+ }
+ ///
+ /// If this assertion fires, then either:
+ /// (1) the context contains an invalid interval
+ /// (2) the timer interval table is corrupt
+ ///
+ ASSERT (FALSE);
+
+ return NULL;
+}
+
+/**
+ Figure out which timer the child is requesting and
+ send back the source description
+
+ @param[in] DispatchContext The pointer to the Dispatch Context instances
+ @param[out] SrcDesc The pointer to the source description
+
+ @retval None
+**/
+VOID
+MapPeriodicTimerToSrcDesc (
+ IN PCH_SMM_CONTEXT *DispatchContext,
+ OUT PCH_SMM_SOURCE_DESC *SrcDesc
+ )
+{
+ TIMER_INTERVAL *TimerInterval;
+
+ ///
+ /// Figure out which timer the child is requesting and
+ /// send back the source description
+ ///
+ TimerInterval = ContextToTimerInterval (DispatchContext);
+ if (TimerInterval == NULL) {
+ return;
+ }
+
+ CopyMem (
+ (VOID *) SrcDesc,
+ (VOID *) (&mTIMER_SOURCE_DESCS[TimerInterval->AssociatedTimer]),
+ sizeof (PCH_SMM_SOURCE_DESC)
+ );
+
+ ///
+ /// Program the value of the interval into hardware
+ ///
+ PchSmmPeriodicTimerProgramTimers ();
+}
+
+/**
+ Update the elapsed time from the Interval data of DATABASE_RECORD
+
+ @param[in] Record The pointer to the DATABASE_RECORD.
+ @param[out] HwContext The Context to be updated.
+
+ @retval None
+**/
+VOID
+EFIAPI
+PeriodicTimerGetContext (
+ IN DATABASE_RECORD *Record,
+ OUT PCH_SMM_CONTEXT *HwContext
+ )
+{
+ TIMER_INTERVAL *TimerInterval;
+
+ ASSERT (Record->ProtocolType == PeriodicTimerType);
+
+ TimerInterval = ContextToTimerInterval (&Record->ChildContext);
+ if (TimerInterval == NULL) {
+ return;
+ }
+ ///
+ /// Ignore the hardware context. It's not required for this protocol.
+ /// Instead, just increment the child's context.
+ /// Update the elapsed time w/ the data from our tables
+ ///
+ Record->ChildContext.PeriodicTimer.ElapsedTime += TimerInterval->Interval;
+ *HwContext = Record->ChildContext;
+}
+
+/**
+ Check whether Periodic Timer of two contexts match
+
+ @param[in] Context1 Context 1 that includes Periodic Timer 1
+ @param[in] Context2 Context 2 that includes Periodic Timer 2
+
+ @retval FALSE Periodic Timer match
+ @retval TRUE Periodic Timer don't match
+**/
+BOOLEAN
+EFIAPI
+PeriodicTimerCmpContext (
+ IN PCH_SMM_CONTEXT *HwContext,
+ IN PCH_SMM_CONTEXT *ChildContext
+ )
+{
+
+ if (ChildContext->PeriodicTimer.ElapsedTime >= ChildContext->PeriodicTimer.Period) {
+ ///
+ /// This child should be dispatched
+ /// Need reset ElapsedTime, or SMI handler will be invoked during SmiTickInterval instead of Period.
+ ///
+ ChildContext->PeriodicTimer.ElapsedTime = 0;
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+}
+
+/**
+ Program Smm Periodic Timer
+
+ @param[in] None
+
+ @retval None
+**/
+VOID
+PchSmmPeriodicTimerProgramTimers (
+ VOID
+ )
+{
+ UINT16 GenPmCon1;
+ UINT8 GenPmCon3;
+ SUPPORTED_TIMER Timer;
+ DATABASE_RECORD *RecordInDb;
+ LIST_ENTRY *LinkInDb;
+ UINTN PciD31F0RegBase;
+ TIMER_INTERVAL *TimerInterval;
+
+ PciD31F0RegBase = MmPciAddress (
+ 0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ 0
+ );
+ ///
+ /// Find the minimum required interval for each timer
+ ///
+ for (Timer = 0; Timer < NUM_TIMERS; Timer++) {
+ mTimers[Timer].MinReqInterval = ~ (UINT64) 0x0;
+ mTimers[Timer].NumChildren = 0;
+ }
+
+ LinkInDb = GetFirstNode (&mPrivateData.CallbackDataBase);
+ while (!IsNull (&mPrivateData.CallbackDataBase, LinkInDb)) {
+ RecordInDb = DATABASE_RECORD_FROM_LINK (LinkInDb);
+ if (RecordInDb->ProtocolType == PeriodicTimerType) {
+ ///
+ /// This child is registerd with the PeriodicTimer protocol
+ ///
+ TimerInterval = ContextToTimerInterval (&RecordInDb->ChildContext);
+ if (TimerInterval == NULL) {
+ return;
+ }
+
+ Timer = TimerInterval->AssociatedTimer;
+ if (Timer < 0 || Timer >= NUM_TIMERS) {
+ ASSERT (FALSE);
+ EFI_DEADLOOP ();
+ }
+
+ if (mTimers[Timer].MinReqInterval > RecordInDb->ChildContext.PeriodicTimer.SmiTickInterval) {
+ mTimers[Timer].MinReqInterval = RecordInDb->ChildContext.PeriodicTimer.SmiTickInterval;
+ }
+
+ mTimers[Timer].NumChildren++;
+ }
+
+ LinkInDb = GetNextNode (&mPrivateData.CallbackDataBase, &RecordInDb->Link);
+ }
+ ///
+ /// Program the hardware
+ ///
+ if (mTimers[PERIODIC_TIMER].NumChildren > 0) {
+ GenPmCon1 = MmioRead16 (PciD31F0RegBase + R_PCH_LPC_GEN_PMCON_1);
+
+ GenPmCon1 &= ~B_PCH_LPC_GEN_PMCON_PER_SMI_SEL;
+ switch (mTimers[PERIODIC_TIMER].MinReqInterval) {
+ case TIME_64s:
+ GenPmCon1 |= V_PCH_LPC_GEN_PMCON_PER_SMI_64S;
+ mTimers[PERIODIC_TIMER].CurrentSetting = INDEX_TIME_64s;
+ break;
+
+ case TIME_32s:
+ GenPmCon1 |= V_PCH_LPC_GEN_PMCON_PER_SMI_32S;
+ mTimers[PERIODIC_TIMER].CurrentSetting = INDEX_TIME_32s;
+ break;
+
+ case TIME_16s:
+ GenPmCon1 |= V_PCH_LPC_GEN_PMCON_PER_SMI_16S;
+ mTimers[PERIODIC_TIMER].CurrentSetting = INDEX_TIME_16s;
+ break;
+
+ case TIME_8s:
+ GenPmCon1 |= V_PCH_LPC_GEN_PMCON_PER_SMI_8S;
+ mTimers[PERIODIC_TIMER].CurrentSetting = INDEX_TIME_8s;
+ break;
+
+ default:
+ ASSERT (FALSE);
+ break;
+ }
+
+ MmioWrite16 (PciD31F0RegBase + R_PCH_LPC_GEN_PMCON_1, GenPmCon1);
+
+ ///
+ /// Restart the timer here, just need to clear the SMI
+ ///
+ PchSmmClearSource (&mTIMER_SOURCE_DESCS[PERIODIC_TIMER]);
+ } else {
+ PchSmmDisableSource (&mTIMER_SOURCE_DESCS[PERIODIC_TIMER]);
+ }
+
+ if (mTimers[SWSMI_TIMER].NumChildren > 0) {
+ ///
+ /// ICH9, ICH10 and PCH share the same bit positions for SW SMI Rate settings
+ ///
+ GenPmCon3 = MmioRead8 (PciD31F0RegBase + R_PCH_LPC_GEN_PMCON_3);
+ GenPmCon3 &= ~B_PCH_LPC_GEN_PMCON_SWSMI_RTSL;
+ switch (mTimers[SWSMI_TIMER].MinReqInterval) {
+ case TIME_64ms:
+ GenPmCon3 |= V_PCH_LPC_GEN_PMCON_SWSMI_RTSL_64MS;
+ mTimers[SWSMI_TIMER].CurrentSetting = INDEX_TIME_64ms;
+ break;
+
+ case TIME_32ms:
+ GenPmCon3 |= V_PCH_LPC_GEN_PMCON_SWSMI_RTSL_32MS;
+ mTimers[SWSMI_TIMER].CurrentSetting = INDEX_TIME_32ms;
+ break;
+
+ case TIME_16ms:
+ GenPmCon3 |= V_PCH_LPC_GEN_PMCON_SWSMI_RTSL_16MS;
+ mTimers[SWSMI_TIMER].CurrentSetting = INDEX_TIME_16ms;
+ break;
+
+ case TIME_1_5ms:
+ GenPmCon3 |= V_PCH_LPC_GEN_PMCON_SWSMI_RTSL_1_5MS;
+ mTimers[SWSMI_TIMER].CurrentSetting = INDEX_TIME_1_5ms;
+ break;
+
+ default:
+ ASSERT (FALSE);
+ break;
+ }
+ ///
+ /// SWSMI_RATE_SEL BIT (D31:F0:A4h[7:6]) bits are in RTC well
+ ///
+ MmioWrite8 (PciD31F0RegBase + R_PCH_LPC_GEN_PMCON_3, GenPmCon3);
+
+ ///
+ /// Restart the timer here, need to disable, clear, then enable to restart this timer
+ ///
+ PchSmmDisableSource (&mTIMER_SOURCE_DESCS[SWSMI_TIMER]);
+ PchSmmClearSource (&mTIMER_SOURCE_DESCS[SWSMI_TIMER]);
+ PchSmmEnableSource (&mTIMER_SOURCE_DESCS[SWSMI_TIMER]);
+ } else {
+ PchSmmDisableSource (&mTIMER_SOURCE_DESCS[SWSMI_TIMER]);
+ }
+}
+
+/**
+ This services returns the next SMI tick period that is supported by the chipset.
+ The order returned is from longest to shortest interval period.
+
+ @param[in] This Pointer to the EFI_SMM_PERIODIC_TIMER_DISPATCH_PROTOCOL instance.
+ @param[in, out] SmiTickInterval Pointer to pointer of the next shorter SMI interval period that is supported by the child.
+
+ @retval EFI_SUCCESS The service returned successfully.
+ @retval EFI_INVALID_PARAMETER The parameter SmiTickInterval is invalid.
+**/
+EFI_STATUS
+PchSmmPeriodicTimerDispatchGetNextShorterInterval (
+ IN EFI_SMM_PERIODIC_TIMER_DISPATCH_PROTOCOL *This,
+ IN OUT UINT64 **SmiTickInterval
+ )
+{
+ TIMER_INTERVAL *IntervalPointer;
+
+ ASSERT (SmiTickInterval != NULL);
+
+ IntervalPointer = (TIMER_INTERVAL *) *SmiTickInterval;
+
+ if (IntervalPointer == NULL) {
+ ///
+ /// The first time child requesting an interval
+ ///
+ IntervalPointer = &mSmmPeriodicTimerIntervals[0];
+ } else if (IntervalPointer == &mSmmPeriodicTimerIntervals[NUM_INTERVALS - 1]) {
+ ///
+ /// At end of the list
+ ///
+ IntervalPointer = NULL;
+ } else {
+ if ((IntervalPointer >= &mSmmPeriodicTimerIntervals[0]) &&
+ (IntervalPointer < &mSmmPeriodicTimerIntervals[NUM_INTERVALS - 1])
+ ) {
+ ///
+ /// Get the next interval in the list
+ ///
+ IntervalPointer++;
+ } else {
+ ///
+ /// Input is out of range
+ ///
+ return EFI_INVALID_PARAMETER;
+ }
+ }
+
+ if (IntervalPointer != NULL) {
+ *SmiTickInterval = &IntervalPointer->Interval;
+ } else {
+ *SmiTickInterval = NULL;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This function is responsible for calculating and enabling any timers that are required
+ to dispatch messages to children. The SrcDesc argument isn't acutally used.
+
+ @param[in] SrcDesc Pointer to the PCH_SMM_SOURCE_DESC instance.
+
+ @retval None.
+**/
+VOID
+EFIAPI
+PchSmmPeriodicTimerClearSource (
+ IN PCH_SMM_SOURCE_DESC *SrcDesc
+ )
+{
+ PchSmmPeriodicTimerProgramTimers ();
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmmPowerButton.c b/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmmPowerButton.c
new file mode 100644
index 0000000..e172808
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmmPowerButton.c
@@ -0,0 +1,104 @@
+/** @file
+ File to contain all the hardware specific stuff for the Smm Power Button dispatch protocol.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "Token.h"
+#include "PchSmmHelpers.h"
+
+const PCH_SMM_SOURCE_DESC POWER_BUTTON_SOURCE_DESC = {
+ PCH_SMM_SCI_EN_DEPENDENT,
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_ACPI_PM1_EN
+ },
+ S_PCH_ACPI_PM1_EN,
+ N_PCH_ACPI_PM1_EN_PWRBTN
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_ACPI_PM1_STS
+ },
+ S_PCH_ACPI_PM1_STS,
+ N_PCH_ACPI_PM1_STS_PWRBTN
+ }
+ }
+};
+
+/**
+ Get the power button status.
+
+ @param[in] Record The pointer to the DATABASE_RECORD.
+ @param[out] Context Calling context from the hardware, will be updated with the current power button status.
+
+ @retval None
+**/
+VOID
+EFIAPI
+PowerButtonGetContext (
+ IN DATABASE_RECORD *Record,
+ OUT PCH_SMM_CONTEXT *Context
+ )
+{
+ UINT16 GenPmCon1;
+
+ GenPmCon1 = MmioRead16 (
+ MmPciAddress (0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_GEN_PMCON_1)
+ );
+
+ if ((GenPmCon1 & B_PCH_LPC_GEN_PMCON_PWRBTN_LVL) != 0) {
+ Context->PowerButton.Phase = PowerButtonExit;
+ } else {
+ Context->PowerButton.Phase = PowerButtonEntry;
+ }
+
+// AMI_OVERRIDE, EIP145008, forced PowerButton.Phase as PowerButtonEntry.>>>
+#if defined FORCE_PWB_PHASE_AS_ENTRY && FORCE_PWB_PHASE_AS_ENTRY == 1
+ Context->PowerButton.Phase = PowerButtonEntry;
+#endif
+// AMI_OVERRIDE, EIP145008, forced PowerButton.Phase as PowerButtonEntry.<<<
+}
+
+/**
+ Check whether Power Button status of two contexts match
+
+ @param[in] Context1 Context 1 that includes Power Button status 1
+ @param[in] Context2 Context 2 that includes Power Button status 2
+
+ @retval FALSE Power Button status match
+ @retval TRUE Power Button status don't match
+**/
+BOOLEAN
+EFIAPI
+PowerButtonCmpContext (
+ IN PCH_SMM_CONTEXT *Context1,
+ IN PCH_SMM_CONTEXT *Context2
+ )
+{
+ return (BOOLEAN) (Context1->PowerButton.Phase == Context2->PowerButton.Phase);
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmmSw.c b/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmmSw.c
new file mode 100644
index 0000000..9a20df3
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmmSw.c
@@ -0,0 +1,87 @@
+/** @file
+ File to contain all the hardware specific stuff for the Smm Sw dispatch protocol.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "PchSmmHelpers.h"
+
+const PCH_SMM_SOURCE_DESC SW_SOURCE_DESC = {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_EN
+ },
+ S_PCH_SMI_EN,
+ N_PCH_SMI_EN_APMC
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_STS
+ },
+ S_PCH_SMI_STS,
+ N_PCH_SMI_STS_APM
+ }
+ }
+};
+
+/**
+ Get the Software Smi value
+
+ @param[in] Record No use
+ @param[out] Context The context that includes Software Smi value to be filled
+
+ @retval None
+**/
+VOID
+EFIAPI
+SwGetContext (
+ IN DATABASE_RECORD *Record,
+ OUT PCH_SMM_CONTEXT *Context
+ )
+{
+ UINT8 ApmCnt;
+
+ ApmCnt = IoRead8 ((UINTN) R_PCH_APM_CNT);
+
+ Context->Sw.SwSmiInputValue = ApmCnt;
+}
+
+/**
+ Check whether software SMI value of two contexts match
+
+ @param[in] Context1 Context 1 that includes software SMI value 1
+ @param[in] Context2 Context 2 that includes software SMI value 2
+
+ @retval FALSE Software SMI value match
+ @retval TRUE Software SMI value don't match
+**/
+BOOLEAN
+EFIAPI
+SwCmpContext (
+ IN PCH_SMM_CONTEXT *Context1,
+ IN PCH_SMM_CONTEXT *Context2
+ )
+{
+ return (BOOLEAN) (Context1->Sw.SwSmiInputValue == Context2->Sw.SwSmiInputValue);
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmmSx.c b/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmmSx.c
new file mode 100644
index 0000000..3f7e3e2
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmmSx.c
@@ -0,0 +1,975 @@
+/** @file
+ File to contain all the hardware specific stuff for the Smm Sx dispatch protocol.
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "PchSmmHelpers.h"
+
+extern EFI_PHYSICAL_ADDRESS mResvMmioBaseAddr;
+///
+/// Maximum loop time for GbE status check
+///
+#define GBE_MAX_LOOP_TIME 4000
+
+const PCH_SMM_SOURCE_DESC SX_SOURCE_DESC = {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_EN
+ },
+ S_PCH_SMI_EN,
+ N_PCH_SMI_EN_ON_SLP_EN
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_STS
+ },
+ S_PCH_SMI_STS,
+ N_PCH_SMI_STS_ON_SLP_EN
+ }
+ }
+};
+
+/**
+ Get the Sleep type
+
+ @param[in] Record No use
+ @param[out] Context The context that includes SLP_TYP bits to be filled
+
+ @retval None
+**/
+VOID
+EFIAPI
+SxGetContext (
+ IN DATABASE_RECORD *Record,
+ OUT PCH_SMM_CONTEXT *Context
+ )
+{
+ UINT32 Pm1Cnt;
+
+ Pm1Cnt = IoRead32 ((UINTN) (mAcpiBaseAddr + R_PCH_ACPI_PM1_CNT));
+
+ ///
+ /// By design, the context phase will always be ENTRY
+ ///
+ Context->Sx.Phase = SxEntry;
+
+ ///
+ /// Map the PM1_CNT register's SLP_TYP bits to the context type
+ ///
+ switch (Pm1Cnt & B_PCH_ACPI_PM1_CNT_SLP_TYP) {
+ case V_PCH_ACPI_PM1_CNT_S0:
+ Context->Sx.Type = SxS0;
+ break;
+
+ case V_PCH_ACPI_PM1_CNT_S1:
+ Context->Sx.Type = SxS1;
+ break;
+
+ case V_PCH_ACPI_PM1_CNT_S3:
+ Context->Sx.Type = SxS3;
+ break;
+
+ case V_PCH_ACPI_PM1_CNT_S4:
+ Context->Sx.Type = SxS4;
+ break;
+
+ case V_PCH_ACPI_PM1_CNT_S5:
+ Context->Sx.Type = SxS5;
+ break;
+
+ default:
+ ASSERT (FALSE);
+ break;
+ }
+}
+
+/**
+ Check whether sleep type of two contexts match
+
+ @param[in] Context1 Context 1 that includes sleep type 1
+ @param[in] Context2 Context 2 that includes sleep type 2
+
+ @retval FALSE Sleep types match
+ @retval TRUE Sleep types don't match
+**/
+BOOLEAN
+EFIAPI
+SxCmpContext (
+ IN PCH_SMM_CONTEXT *Context1,
+ IN PCH_SMM_CONTEXT *Context2
+ )
+{
+ return (BOOLEAN) (Context1->Sx.Type == Context2->Sx.Type);
+}
+
+/**
+ Check ready flag to see if writing to MDIC is done.
+
+ @param[in] GbEBar GbE Memory Base Address Register
+
+ @retval EFI_SUCCESS Successfully completed.
+ @retval EFI_TIMEOUT Checking flag time out.
+**/
+EFI_STATUS
+CheckReadyFlag (
+ UINT32 GbEBar
+ )
+{
+ UINT32 ReadyFlag;
+ UINT32 LoopTime;
+
+ ReadyFlag = 0;
+
+ for (LoopTime = 0; LoopTime < GBE_MAX_LOOP_TIME; LoopTime++) {
+ ReadyFlag = MmioRead32 (GbEBar + R_PCH_MBARA_GBECSR3) & B_PCH_MBARA_GBECSR3_RB;
+
+ if (ReadyFlag) {
+ break;
+ }
+
+ PchPmTimerStall (10);
+ }
+
+ if (LoopTime >= GBE_MAX_LOOP_TIME) {
+ return EFI_TIMEOUT;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ PCH BIOS Spec Rev 0.5.0 Section 10.5
+ Additional Internal GbE Controller special cases WOL Support
+
+ @param[in] None
+
+ @retval None
+**/
+VOID
+GbES02SxWorkaround (
+ VOID
+ )
+{
+ UINTN PciD25F0RegBase;
+ UINTN PciD31F0RegBase;
+ UINT32 GbEBar;
+ UINT32 GbEBarB;
+ UINT16 CmdReg;
+ UINT32 RAL0;
+ UINT32 RAH0;
+ UINT32 PhyCtrl;
+ UINT32 ExtCnfCtrl;
+ UINT32 Buffer;
+ UINT32 LoopTime;
+ UINT32 RootComplexBar;
+ UINT32 PchGpioBase;
+ EFI_STATUS Status;
+
+ PciD25F0RegBase = MmPciAddress (
+ 0,
+ PCI_BUS_NUMBER_PCH_LAN,
+ PCI_DEVICE_NUMBER_PCH_LAN,
+ PCI_FUNCTION_NUMBER_PCH_LAN,
+ 0
+ );
+ PciD31F0RegBase = MmPciAddress (
+ 0,
+ 0,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ 0
+ );
+ RootComplexBar = PCH_RCRB_BASE;
+ PchGpioBase = (MmioRead32 (PciD31F0RegBase + R_PCH_LPC_GPIO_BASE)) &~BIT0;
+ GbEBar = 0;
+ GbEBarB = 0;
+ CmdReg = 0;
+ Buffer = 0;
+
+ if (((MmioRead16 (RootComplexBar + R_PCH_RCRB_BUC)) & BIT5) == 0) {
+ ///
+ /// System BIOS requires to program the registers listed below for internal GbE to function upon S0 to S3,4,5 transition
+ /// (When ME off and GbE device in D0)
+ ///
+ /// Note: Time out should be applied for MBARA + Offset 20h[28] verification to avoid non respond loop. Upon time out,
+ /// system BIOS is required to clear MBARA + Offset F00h [5] = 0b before exiting the WA.
+ ///
+ /// Check if GbE device is in D0 state
+ ///
+ if ((MmioRead16 (PciD25F0RegBase + R_PCH_LAN_PMCS) & (UINT16) B_PCH_LAN_PMCS_PS) == (UINT16) V_PCH_LAN_PMCS_PS0) {
+ GbEBar = MmioRead32 (PciD25F0RegBase + R_PCH_LAN_MEM_BASE_A);
+ ///
+ /// Step 1
+ /// If MBARA + Offset 5800h [0] = 1b then proceed the steps below
+ ///
+ if (MmioRead32 (GbEBar + R_PCH_MBARA_GBECSR9) & B_PCH_MBARA_GBECSR9_APME) {
+ ///
+ /// Step 2
+ /// System BIOS perform read to MBARA + Offset 5400h [31:0], MBARA + Offset 5404h [31:0]
+ /// and MBARA + Offset F00h [31:0]
+ ///
+ RAL0 = MmioRead32 (GbEBar + R_PCH_MBARA_GBECSR7);
+ RAH0 = MmioRead32 (GbEBar + R_PCH_MBARA_GBECSR8);
+ ExtCnfCtrl = MmioRead32 (GbEBar + R_PCH_MBARA_GBECSR5);
+ ///
+ /// Step 3
+ /// Ensure that MBARA + Offset F00h [5] = 1b
+ /// a. Set MBARA + Offset F00h [31:0] value with the value read in step 2 or with 0x20 (set bit 5)
+ /// b. Read MBARA + Offset F00h
+ /// c. If MBARA + Offset F00h [5] = 1b (true) continue else wait X Sec and go back to step 3.b for Y times
+ /// (X*Y totals to ~200mSec) if false - exit flow by jumping to step 32.
+ ///
+ MmioWrite32 (GbEBar + R_PCH_MBARA_GBECSR5, ExtCnfCtrl | B_PCH_MBARA_GBECSR5_SWFLAG);
+
+ for (LoopTime = 0; LoopTime < GBE_MAX_LOOP_TIME; LoopTime++) {
+ ExtCnfCtrl = MmioRead32 (GbEBar + R_PCH_MBARA_GBECSR5);
+
+ if (ExtCnfCtrl & B_PCH_MBARA_GBECSR5_SWFLAG) {
+ break;
+ }
+
+ PchPmTimerStall (50);
+ }
+
+ if (LoopTime >= GBE_MAX_LOOP_TIME) {
+ goto ExitGbEWa;
+ }
+ ///
+ /// Step 4
+ /// If MBARA + Offset 5B54h [15] = 1b then jump to Step 10
+ ///
+ if ((MmioRead32 (GbEBar + 0x5B54) & BIT15) != BIT15) {
+ ///
+ /// Step 5
+ /// If MBARA + Offset F10h [2] = 1b, then set MBARA + Offset F10h[1] = 1b. Else clear MBARA + Offset F10h[1] = 0b
+ ///
+ if (MmioRead32 (GbEBar + R_PCH_MBARA_GBECSR6) & B_PCH_MBARA_GBECSR6_LPLUND) {
+ MmioOr32 (GbEBar + R_PCH_MBARA_GBECSR6, (UINT32) B_PCH_MBARA_GBECSR6_LPLUD);
+ } else {
+ MmioAnd32 (GbEBar + R_PCH_MBARA_GBECSR6, (UINT32)~B_PCH_MBARA_GBECSR6_LPLUD);
+ }
+ ///
+ /// Step 6
+ /// Set MBARA + Offset 20h = 0x043f0000. Verify MBARA + Offset 20h[28] = 1b
+ ///
+ MmioWrite32 ((GbEBar + R_PCH_MBARA_GBECSR3), 0x043f0000);
+
+ Status = CheckReadyFlag (GbEBar);
+ if (EFI_ERROR (Status)) {
+ goto ExitGbEWa;
+ }
+ ///
+ /// Step 7
+ /// Wait 4 mSec
+ ///
+ PchPmTimerStall (4 * 1000);
+ ///
+ /// Step 8
+ /// Set MBARA + Offset 20h = 0x04390000 or with 0x400 or with 0x40 if MBARA + Offset F10h [3] = 1b
+ /// or with 0x04 if MBARA + Offset F10h [2] = 1b
+ ///
+ Buffer = 0x04390000 | 0x400;
+ if (MmioRead32 (GbEBar + R_PCH_MBARA_GBECSR6) & B_PCH_MBARA_GBECSR6_GbE_DIS) {
+ Buffer |= 0x40;
+ }
+
+ if (MmioRead32 (GbEBar + R_PCH_MBARA_GBECSR6) & B_PCH_MBARA_GBECSR6_LPLUND) {
+ Buffer |= 0x04;
+ }
+
+ MmioWrite32 ((GbEBar + R_PCH_MBARA_GBECSR3), Buffer);
+ ///
+ /// Step 9
+ /// Verify MBARA + Offset 20h[28] = 1b
+ ///
+ Status = CheckReadyFlag (GbEBar);
+ if (EFI_ERROR (Status)) {
+ goto ExitGbEWa;
+ }
+ }
+ ///
+ /// Step 10
+ /// Set MBARA + Offset 20h = 0x043f6400
+ ///
+ MmioWrite32 ((GbEBar + R_PCH_MBARA_GBECSR3), 0x043f6400);
+ ///
+ /// Step 11
+ /// Wait 4 mSec
+ ///
+ PchPmTimerStall (4 * 1000);
+ ///
+ /// Step 12
+ /// Set MBARA + Offset F10h [6] = 1b (read modify write)
+ ///
+ PhyCtrl = MmioRead32 (GbEBar + R_PCH_MBARA_GBECSR6);
+ MmioWrite32 (GbEBar + R_PCH_MBARA_GBECSR6, PhyCtrl | B_PCH_MBARA_GBECSR6_GGD);
+ ///
+ /// Step 13
+ /// Verify MBARA + Offset 20h[28] = 1b, set MBARA + Offset 20h = 0x4310010
+ ///
+ Status = CheckReadyFlag (GbEBar);
+ if (EFI_ERROR (Status)) {
+ goto ExitGbEWa;
+ }
+
+ MmioWrite32 ((GbEBar + R_PCH_MBARA_GBECSR3), 0x4310010);
+ ///
+ /// Step 14
+ /// Verify MBARA + Offset 20h[28] = 1b, set MBARA + Offset 20h = 0x4320000 or with
+ /// the least significant word of MBARA + offset 5400 that read in step 2
+ ///
+ Status = CheckReadyFlag (GbEBar);
+ if (EFI_ERROR (Status)) {
+ goto ExitGbEWa;
+ }
+
+ MmioWrite32 ((GbEBar + R_PCH_MBARA_GBECSR3), (0x4320000 | (RAL0 & 0x0000FFFF)));
+ ///
+ /// Step 15
+ /// Verify MBARA + Offset 20h[28] = 1b, set MBARA + Offset 20h = 0x4310011
+ ///
+ Status = CheckReadyFlag (GbEBar);
+ if (EFI_ERROR (Status)) {
+ goto ExitGbEWa;
+ }
+
+ MmioWrite32 ((GbEBar + R_PCH_MBARA_GBECSR3), 0x4310011);
+ ///
+ /// Step 16
+ /// Verify MBARA + Offset 20h[28] = 1b, set MBARA + Offset 20h = 0x4320000 or with
+ /// the most significant word of MBARA + offset 5400 that read in step 2
+ ///
+ Status = CheckReadyFlag (GbEBar);
+ if (EFI_ERROR (Status)) {
+ goto ExitGbEWa;
+ }
+
+ MmioWrite32 ((GbEBar + R_PCH_MBARA_GBECSR3), (0x4320000 | (RAL0 >> 16)));
+ ///
+ /// Step 17
+ /// Verify MBARA + Offset 20h[28] = 1b, set MBARA + Offset 20h = 0x4310012
+ ///
+ Status = CheckReadyFlag (GbEBar);
+ if (EFI_ERROR (Status)) {
+ goto ExitGbEWa;
+ }
+
+ MmioWrite32 ((GbEBar + R_PCH_MBARA_GBECSR3), 0x4310012);
+ ///
+ /// Step 18
+ /// Verify MBARA + Offset 20h[28] = 1b, set MBARA + Offset 20h = 0x4320000 or with
+ /// the least significant word of MBARA + offset 5404 that read in step 2
+ ///
+ Status = CheckReadyFlag (GbEBar);
+ if (EFI_ERROR (Status)) {
+ goto ExitGbEWa;
+ }
+
+ MmioWrite32 ((GbEBar + R_PCH_MBARA_GBECSR3), (0x4320000 | (RAH0 & B_PCH_MBARA_GBECSR8_RAH)));
+ ///
+ /// Step 19
+ /// Verify MBARA + Offset 20h[28] = 1b, set MBARA + Offset 20h = 0x4310013
+ ///
+ Status = CheckReadyFlag (GbEBar);
+ if (EFI_ERROR (Status)) {
+ goto ExitGbEWa;
+ }
+
+ MmioWrite32 ((GbEBar + R_PCH_MBARA_GBECSR3), 0x4310013);
+ ///
+ /// Step 20
+ /// Verify MBARA + Offset 20h[28] = 1b, set MBARA + Offset 20h = 0x4328000
+ ///
+ Status = CheckReadyFlag (GbEBar);
+ if (EFI_ERROR (Status)) {
+ goto ExitGbEWa;
+ }
+
+ MmioWrite32 ((GbEBar + R_PCH_MBARA_GBECSR3), 0x4328000);
+ ///
+ /// Step 21
+ /// Verify MBARA + Offset 20h[28] = 1b, set MBARA + Offset 20h = 0x4310001
+ ///
+ Status = CheckReadyFlag (GbEBar);
+ if (EFI_ERROR (Status)) {
+ goto ExitGbEWa;
+ }
+
+ MmioWrite32 ((GbEBar + R_PCH_MBARA_GBECSR3), 0x4310001);
+ ///
+ /// Step 22
+ /// Verify MBARA + Offset 20h[28] = 1b, set MBARA + Offset 20h = 0x8320000
+ ///
+ Status = CheckReadyFlag (GbEBar);
+ if (EFI_ERROR (Status)) {
+ goto ExitGbEWa;
+ }
+
+ MmioWrite32 ((GbEBar + R_PCH_MBARA_GBECSR3), 0x8320000);
+ ///
+ /// Step 23
+ /// Verify MBARA + Offset 20h[28] = 1b, TEMP[15:0] = MBARA + Offset 20h [15:0]
+ ///
+ Status = CheckReadyFlag (GbEBar);
+ if (EFI_ERROR (Status)) {
+ goto ExitGbEWa;
+ }
+
+ Buffer = MmioRead32 (GbEBar + R_PCH_MBARA_GBECSR3) & B_PCH_MBARA_GBECSR3_DATA;
+ ///
+ /// Step 24
+ /// Set MBARA + Offset 20h = 0x4320000 or TEMP[15:0] or 0x0001
+ ///
+ MmioWrite32 ((GbEBar + R_PCH_MBARA_GBECSR3), 0x4320000 | Buffer | 0x0001);
+ ///
+ /// Step 25
+ /// Verify MBARA + Offset 20h[28] = 1b, set MBARA + Offset 20h = 0x43f6460
+ ///
+ Status = CheckReadyFlag (GbEBar);
+ if (EFI_ERROR (Status)) {
+ goto ExitGbEWa;
+ }
+
+ MmioWrite32 ((GbEBar + R_PCH_MBARA_GBECSR3), 0x43f6460);
+ ///
+ /// Step 26
+ /// Wait 4 mSec
+ ///
+ PchPmTimerStall (4 * 1000);
+ ///
+ /// Step 27
+ /// Verify MBARA + Offset 20h[28] = 1b, set MBARA + Offset 20h = 0x4310042
+ ///
+ Status = CheckReadyFlag (GbEBar);
+ if (EFI_ERROR (Status)) {
+ goto ExitGbEWa;
+ }
+
+ MmioWrite32 ((GbEBar + R_PCH_MBARA_GBECSR3), 0x4310042);
+ ///
+ /// Step 28
+ /// Verify MBARA + Offset 20h[28] = 1b.
+ ///
+ Status = CheckReadyFlag (GbEBar);
+ if (EFI_ERROR (Status)) {
+ goto ExitGbEWa;
+ }
+
+ MmioWrite32 ((GbEBar + R_PCH_MBARA_GBECSR3), 0x43F6020);
+
+ ///
+ /// Step 29
+ /// Wait 4 mSec
+ ///
+ PchPmTimerStall (4 * 1000);
+
+ ///
+ /// Step 30
+ /// Verify MBARA + Offset 20h[28] = 1b, set MBARA + Offset 20h = 0x8310000
+ ///
+ Status = CheckReadyFlag (GbEBar);
+ if (EFI_ERROR (Status)) {
+ goto ExitGbEWa;
+ }
+
+ MmioWrite32 ((GbEBar + R_PCH_MBARA_GBECSR3), 0x8310000);
+ ///
+ /// Step 31
+ /// Verify MBARA + Offset 20h[28] = 1b, TEMP[15:0] = MBARA + 20[15:0]
+ ///
+ Status = CheckReadyFlag (GbEBar);
+ if (EFI_ERROR (Status)) {
+ goto ExitGbEWa;
+ }
+
+ Buffer = MmioRead32 (GbEBar + R_PCH_MBARA_GBECSR3) & 0x0000FFFF;
+
+ ///
+ /// Step 32
+ /// Verify MBARA + 20h[28] = 1b, set MBARA + 20h = 4310000h or with the TEMP[15:0] or with 10h
+ ///
+ Status = CheckReadyFlag (GbEBar);
+ if (EFI_ERROR (Status)) {
+ goto ExitGbEWa;
+ }
+
+ExitGbEWa:
+
+ MmioWrite32 ((GbEBar + R_PCH_MBARA_GBECSR3), 0x4310000 | Buffer | 0x10);
+ ///
+ /// Step 33
+ /// Verify MBARA + Offset 20h[28] = 1b
+ ///
+ Status = CheckReadyFlag (GbEBar);
+
+ ///
+ /// Step 34
+ /// Clear MBARA + Offset F00h [5] = 0b (read modify write)
+ ///
+ MmioWrite32 ((GbEBar + R_PCH_MBARA_GBECSR5), (ExtCnfCtrl & (UINT32) (~BIT5)));
+
+ }
+ }
+ }
+}
+
+typedef struct {
+ UINT8 Device;
+ UINT8 Function;
+} USB_CONTROLLER;
+
+/**
+ PCH BIOS Spec Rev 0.5.0, Section 12.10.1
+ Additional Programming Requirements prior to enter
+ S4/S5
+
+ @param[in] None
+
+ @retval None
+**/
+VOID
+UsbS02SxWorkaround (
+ VOID
+ )
+{
+ UINT8 Index;
+ UINTN EhciPciRegBase;
+ UINT32 UsbBar;
+ UINT16 CmdReg;
+ UINT16 PowerState;
+ USB_CONTROLLER EhciControllersMap[PchEhciControllerMax] = {
+ {
+ PCI_DEVICE_NUMBER_PCH_USB,
+ PCI_FUNCTION_NUMBER_PCH_EHCI
+ },
+ {
+ PCI_DEVICE_NUMBER_PCH_USB_EXT,
+ PCI_FUNCTION_NUMBER_PCH_EHCI2
+ }
+ };
+
+ ///
+ /// System BIOS must execute the following steps prior to enter S4/S5.
+ ///
+ for (Index = 0; Index < GetPchEhciMaxControllerNum (); Index++) {
+ ///
+ /// Step 1
+ /// Read "Memory Base Address (MEM_BASE) Register" of D26/D29:F0
+ ///
+ EhciPciRegBase = MmPciAddress (0, 0, EhciControllersMap[Index].Device, EhciControllersMap[Index].Function, 0);
+ UsbBar = MmioRead32 (EhciPciRegBase + R_PCH_EHCI_MEM_BASE);
+ CmdReg = MmioRead16 (EhciPciRegBase + R_PCH_EHCI_COMMAND_REGISTER);
+ PowerState = MmioRead16 (EhciPciRegBase + R_PCH_EHCI_PWR_CNTL_STS);
+
+ if (UsbBar != 0xFFFFFFFF) {
+ ///
+ /// Check if the Ehci device is in D3 power state
+ ///
+ if ((PowerState & B_PCH_EHCI_PWR_CNTL_STS_PWR_STS) == V_PCH_EHCI_PWR_CNTL_STS_PWR_STS_D3) {
+ ///
+ /// Step 2
+ /// Set "Power State" bit of PWR_CNTL_STS register, D26/D29:F0:54h [1:0] = 0h
+ ///
+ MmioWrite16 (EhciPciRegBase + R_PCH_EHCI_PWR_CNTL_STS, (PowerState &~B_PCH_EHCI_PWR_CNTL_STS_PWR_STS));
+ ///
+ /// Step 3
+ /// Write back the value from step 1 to the "Memory Base Address (MEM_BASE) Register" of D26/D29:F0
+ ///
+ MmioWrite32 (EhciPciRegBase + R_PCH_EHCI_MEM_BASE, UsbBar);
+ ///
+ /// Step 4
+ /// Enable "Memory Space Enable (MSE)" bit, set D26/D29:F0:04h [1] = 1b.
+ ///
+ MmioOr16 (
+ EhciPciRegBase + R_PCH_EHCI_COMMAND_REGISTER,
+ (UINT16) (B_PCH_EHCI_COMMAND_MSE)
+ );
+ }
+ ///
+ /// Step 5
+ /// Clear "Asynchronous Schedule Enable" and "Periodic Schedule Enable" bits, if "Run/Stop (RS)" bit, MEM_BASE + offset 20h [0] = 1b.
+ /// Proceed to steps below if "Run/Stop (RS)" bit, MEM_BASE + offset 20h [0] = 0b.
+ ///
+ if (!(MmioRead32 (UsbBar + R_PCH_EHCI_USB2CMD) & B_PCH_EHCI_USB2CMD_RS)) {
+ MmioAnd32 (UsbBar + R_PCH_EHCI_USB2CMD, (UINT32)~(B_PCH_EHCI_USB2CMD_ASE | B_PCH_EHCI_USB2CMD_PSE));
+ MmioOr32 (UsbBar + R_PCH_EHCI_USB2CMD, B_PCH_EHCI_USB2CMD_RS);
+ }
+ ///
+ /// Step 6
+ /// If "Port Enabled/Disabled" bit of Port N Status and Control (PORTSC) Register is set, MEM_BASE + 64h [2] = 1b,
+ /// proceed steps below else continue with S4/S5.
+ ///
+ if ((MmioRead32 (UsbBar + R_PCH_EHCI_PORTSC0) & R_PCH_EHCI_PORTSC0_PORT_EN_DIS)) {
+ ///
+ /// Step 7
+ /// Ensure that "Suspend" bit of Port N Status and Control (PORTSC) Register is set, MEM_BASE + 64h [7] = 1b.
+ ///
+ if (!(MmioRead32 (UsbBar + R_PCH_EHCI_PORTSC0) & R_PCH_EHCI_PORTSC0_SUSPEND)) {
+ MmioOr32 (UsbBar + R_PCH_EHCI_PORTSC0, R_PCH_EHCI_PORTSC0_SUSPEND);
+ }
+ ///
+ /// Step 8
+ /// Set delay of 25ms
+ ///
+ PchPmTimerStall (25 * 1000);
+ ///
+ /// Step 9
+ /// Clear "Run/Stop (RS)" bit, MEM_BASE + offset 20h [0] = 0b.
+ ///
+ MmioAnd32 (UsbBar + R_PCH_EHCI_USB2CMD, (UINT32)~(B_PCH_EHCI_USB2CMD_RS));
+ }
+ ///
+ /// If the EHCI device is in D3 power state before executing this WA
+ ///
+ if ((PowerState & B_PCH_EHCI_PWR_CNTL_STS_PWR_STS) == V_PCH_EHCI_PWR_CNTL_STS_PWR_STS_D3) {
+ ///
+ /// Restore PCI Command Register
+ ///
+ MmioWrite16 (EhciPciRegBase + R_PCH_EHCI_COMMAND_REGISTER, CmdReg);
+ ///
+ /// Set "Power State" bit of PWR_CNTL_STS register to D3 state, D26/D29:F0:54h [1:0] = 3h
+ ///
+ MmioWrite16 (EhciPciRegBase + R_PCH_EHCI_PWR_CNTL_STS, PowerState);
+ }
+ ///
+ /// Step 10
+ /// Continue with S4/S5
+ ///
+ }
+ }
+}
+
+/**
+ Additional xHCI Controller Configurations Prior to Entering S3/S4/S5
+
+ @param[in] None
+
+ @retval None
+**/
+VOID
+XhciSxWorkaround (
+ VOID
+ )
+{
+ UINT32 RootComplexBar;
+ UINTN XhciPciMmBase;
+ UINT8 OrgCmdByte;
+ UINT32 OrgMmioAddr;
+ UINT32 OrgMmioHAddr;
+ UINT8 OrgPwrSts;
+ PCH_SERIES PchSeries;
+ UINT32 XhciMmioBase;
+ UINT32 PortScOffset[4];
+ UINT32 Data32;
+ UINT32 Index;
+ UINT32 ResetMask;
+
+ PchSeries = GetPchSeries();
+
+ RootComplexBar = PCH_RCRB_BASE;
+ ///
+ /// Check if XHCI controller is enabled
+ ///
+ if ((MmioRead32 (RootComplexBar + R_PCH_RCRB_FUNC_DIS) & (UINT32) B_PCH_RCRB_FUNC_DIS_XHCI) != 0) {
+ return;
+ }
+ XhciPciMmBase = MmPciAddress (
+ 0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_XHCI,
+ PCI_FUNCTION_NUMBER_PCH_XHCI,
+ 0
+ );
+
+ //
+ // Save Cmd and XhciBar and PwrSts registers
+ //
+ OrgCmdByte = MmioRead8 (XhciPciMmBase + R_PCH_XHCI_COMMAND_REGISTER);
+ OrgMmioAddr = MmioRead32 (XhciPciMmBase + R_PCH_XHCI_MEM_BASE) & 0xFFFF0000;
+ OrgMmioHAddr = MmioRead32 (XhciPciMmBase + R_PCH_XHCI_MEM_BASE + 4);
+ OrgPwrSts = MmioRead8 (XhciPciMmBase + R_PCH_XHCI_PWR_CNTL_STS);
+ //
+ // Bring device back to D0
+ //
+ MmioAnd8 (XhciPciMmBase + R_PCH_XHCI_PWR_CNTL_STS, (UINT8)~(B_PCH_XHCI_PWR_CNTL_STS_PWR_STS));
+ //
+ // Use the reserved MMIO
+ // Clear MSE before changing MMIO address
+ //
+ MmioAnd8 (XhciPciMmBase + R_PCH_XHCI_COMMAND_REGISTER, (UINT8)~(B_PCH_XHCI_COMMAND_BME | B_PCH_XHCI_COMMAND_MSE));
+ MmioWrite32 (XhciPciMmBase + R_PCH_XHCI_MEM_BASE, (UINT32)mResvMmioBaseAddr);
+ MmioWrite32 (XhciPciMmBase + R_PCH_XHCI_MEM_BASE + 4, 0);
+ XhciMmioBase = (UINT32)mResvMmioBaseAddr;
+ //
+ // Set MSE
+ //
+ MmioOr8 (XhciPciMmBase + R_PCH_XHCI_COMMAND_REGISTER, (B_PCH_XHCI_COMMAND_BME | B_PCH_XHCI_COMMAND_MSE));
+
+ //
+ // XHC W/A for LPT-LP
+ // Clear PCI CFG offset 0xB0[14:13] for LPT-LP
+ // Clear MMIO Offset 0x816C[14]
+ // Clear MMIO Offset 0x816C[2]
+ // Wait until all SS ports are out of polling
+ // For each SS port which is disconnected (i.e. PORTS.PLS=5h) and CSC=0
+ // Issue Warm Port Reset
+ // Wait 101ms
+ // Write '1' to all Port Change Status bits if reset
+ // Set MMIO Offset 0x80E0[15]
+ //
+ // For PCH H and LP
+ // Clear MMIO Offset 0x8154[31]
+ //
+ if (PchSeries == PchLp) {
+ //
+ // Clear PCI CFG offset 0xB0[14:13] for LPT-LP
+ //
+ MmioAnd32 (XhciPciMmBase + 0xB0, (UINT32)~(BIT14 | BIT13));
+ //
+ // Clear MMIO Offset 0x816C[14]
+ // Clear MMIO Offset 0x816C[2]
+ //
+ MmioAnd32 (XhciMmioBase + 0x816C, (UINT32)~(BIT14 | BIT2));
+
+ PortScOffset[0] = R_PCH_LP_XHCI_PORTSC1USB3;
+ PortScOffset[1] = R_PCH_LP_XHCI_PORTSC2USB3;
+ PortScOffset[2] = R_PCH_LP_XHCI_PORTSC3USB3;
+ PortScOffset[3] = R_PCH_LP_XHCI_PORTSC4USB3;
+ //
+ // Wait until all ports are out of polling (PP=1, PLS=7)
+ //
+ for (Index = 0; Index < 4; Index++) {
+ Data32 = MmioRead32 (XhciMmioBase + PortScOffset[Index]);
+ //
+ // Check if PLS = 7, and PP = 1
+ //
+ while ((Data32 & B_PCH_XHCI_PORTSCXUSB3_PLS) == V_PCH_XHCI_PORTSCXUSB3_PLS_POLLING)
+ {
+ PchPmTimerStall (10);
+ Data32 = MmioRead32 (XhciMmioBase + PortScOffset[Index]);
+ }
+ }
+ ResetMask = 0;
+ for (Index = 0; Index < 4; Index++) {
+ Data32 = MmioRead32 (XhciMmioBase + PortScOffset[Index]);
+ //
+ // If Port X is Disconnected (i.e. PORTS.PLS=5h) AND PORTSC{X}.CSC=0
+ // Check if PLS = 5, CSC = 0, and PP = 1
+ //
+ if (((Data32 & B_PCH_XHCI_PORTSCXUSB3_PLS) == V_PCH_XHCI_PORTSCXUSB3_PLS_RXDETECT) &&
+ ((Data32 & B_PCH_XHCI_PORTSCXUSB3_CSC) == 0))
+ {
+ //
+ // Issue Warm Port Reset
+ //
+ ResetMask |= (1 << Index);
+ Data32 &= (UINT32)~(B_PCH_XHCI_PORTSCXUSB3_PED);
+ Data32 |= B_PCH_XHCI_PORTSCXUSB3_WPR;
+ MmioWrite32 (XhciMmioBase + PortScOffset[Index], Data32);
+ }
+ }
+
+ if (ResetMask != 0) {
+ //
+ // Wait 101ms to ensure reset completed
+ //
+ PchPmTimerStall (101 * 1000);
+
+ for (Index = 0; Index < 4; ++Index) {
+ if (ResetMask & (1 << Index)) {
+ Data32 = MmioRead32 (XhciMmioBase + PortScOffset[Index]);
+ Data32 &= (UINT32)~(B_PCH_XHCI_PORTSCXUSB3_PED);
+ //
+ // Write '1' to All Port Change Status
+ //
+ Data32 |= (B_PCH_XHCI_PORTSCXUSB3_CEC |
+ B_PCH_XHCI_PORTSCXUSB3_PLC |
+ B_PCH_XHCI_PORTSCXUSB3_PRC |
+ B_PCH_XHCI_PORTSCXUSB3_OCC |
+ B_PCH_XHCI_PORTSCXUSB3_WRC |
+ B_PCH_XHCI_PORTSCXUSB3_PEC |
+ B_PCH_XHCI_PORTSCXUSB3_CSC);
+ MmioWrite32 (XhciMmioBase + PortScOffset[Index], Data32);
+ }
+ }
+ }
+
+ //
+ // Set MMIO Offset 0x80E0[15]
+ //
+ MmioOr32 (XhciMmioBase + 0x80E0, BIT15);
+ }
+ //
+ // Clear MMIO Offset 0x8154[31]
+ //
+ MmioAnd32 (XhciMmioBase + 0x8154, (UINT32)~BIT31);
+
+ //
+ // Restore Cmd and XhciBar and PwrSts registers
+ //
+ MmioAnd8 (XhciPciMmBase + R_PCH_XHCI_COMMAND_REGISTER, (UINT8)~(B_PCH_XHCI_COMMAND_BME | B_PCH_XHCI_COMMAND_MSE));
+ MmioWrite32 (XhciPciMmBase + R_PCH_XHCI_MEM_BASE + 4, OrgMmioHAddr);
+ MmioWrite32 (XhciPciMmBase + R_PCH_XHCI_MEM_BASE, OrgMmioAddr);
+ MmioWrite8 (XhciPciMmBase + R_PCH_XHCI_COMMAND_REGISTER, OrgCmdByte);
+
+ ///
+ /// Set D3hot state - 11b
+ ///
+ MmioOr16 ((XhciPciMmBase + R_PCH_XHCI_PWR_CNTL_STS), (UINT16) 0x3);
+
+ ///
+ /// Set "PME Enable" bit of PWR_CNTL_STS register, D20:F0:74h[8] = 1h
+ ///
+ MmioOr16 ((XhciPciMmBase + R_PCH_XHCI_PWR_CNTL_STS), (UINT16) (B_PCH_XHCI_PWR_CNTL_STS_PME_EN));
+
+}
+
+/**
+ When we get an SMI that indicates that we are transitioning to a sleep state,
+ we need to actually transition to that state. We do this by disabling the
+ "SMI on sleep enable" feature, which generates an SMI when the operating system
+ tries to put the system to sleep, and then physically putting the system to sleep.
+
+ @param[in] None
+
+ @retval None.
+**/
+VOID
+PchSmmSxGoToSleep (
+ VOID
+ )
+{
+ UINT32 Pm1Cnt;
+ UINT32 RootComplexBar;
+ PCH_SERIES PchSeries;
+
+ PchSeries = GetPchSeries();
+ RootComplexBar = PCH_RCRB_BASE;
+
+ ///
+ /// Flush cache into memory before we go to sleep. It is necessary for S3 sleep
+ /// because we may update memory in SMM Sx sleep handlers -- the updates are in cache now
+ ///
+ AsmWbinvd ();
+
+ ///
+ /// Disable SMIs
+ ///
+ PchSmmClearSource (&SX_SOURCE_DESC);
+ PchSmmDisableSource (&SX_SOURCE_DESC);
+
+ ///
+ /// Get Power Management 1 Control Register Value
+ ///
+ Pm1Cnt = IoRead32 ((UINTN) (mAcpiBaseAddr + R_PCH_ACPI_PM1_CNT));
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 12.10.1
+ /// Additional Programming Requirements prior to enter S4/S5
+ ///
+ if (((Pm1Cnt & B_PCH_ACPI_PM1_CNT_SLP_TYP) == V_PCH_ACPI_PM1_CNT_S4) ||
+ ((Pm1Cnt & B_PCH_ACPI_PM1_CNT_SLP_TYP) == V_PCH_ACPI_PM1_CNT_S5)) {
+ UsbS02SxWorkaround ();
+ }
+
+ if (((Pm1Cnt & B_PCH_ACPI_PM1_CNT_SLP_TYP) == V_PCH_ACPI_PM1_CNT_S3) ||
+ ((Pm1Cnt & B_PCH_ACPI_PM1_CNT_SLP_TYP) == V_PCH_ACPI_PM1_CNT_S4) ||
+ ((Pm1Cnt & B_PCH_ACPI_PM1_CNT_SLP_TYP) == V_PCH_ACPI_PM1_CNT_S5)) {
+ XhciSxWorkaround ();
+ ///
+ /// PCH BIOS Spec Rev 0.5.0 Section 10.6
+ /// Additional Internal GbE Controller special cases WOL Support
+ ///
+ GbES02SxWorkaround ();
+ ///
+ /// PCH BIOS Spec Rev 0.5.0 Section 10.6 Additional GbE based wake events
+ /// The GPIO[27] is used as a wake pin when the GbE controller is enabled.
+ /// The System BIOS should enable this as wake event by setting the GPIO[27]
+ /// Enable bit (GP27_EN PMBASE + 2Ch[3]). Unlike other wake events the System
+ /// BIOS does not need to clear the corresponding GPIO[27] Status bit
+ /// (GP27_STS PMBASE + 24h[3]) as the bit will be cleared by the hardware.
+ ///
+ /// RCBA + 0x3334 [0] will be 1b while PchDeepSx is enabled and GP27 is
+ /// reuqired to wake up the system from PchDeepSx.
+ ///
+ if ((MmioRead32 (RootComplexBar + 0x3334) & (UINT32) BIT0) != 0) {
+ if (PchSeries == PchLp) {
+ IoOr32 ((UINTN) (mAcpiBaseAddr + R_PCH_ACPI_GPE0_EN_127_96), (UINT32) B_PCH_ACPI_GPE0_EN_127_96_GP27);
+ } else if (PchSeries == PchH) {
+ IoOr32 ((UINTN) (mAcpiBaseAddr + R_PCH_ACPI_GPE0b_EN), (UINT32) B_PCH_ACPI_GPE0b_EN_GP27);
+ }
+ }
+ }
+
+ ///
+ /// Record S3 suspend performance data
+ ///
+ if ((Pm1Cnt & B_PCH_ACPI_PM1_CNT_SLP_TYP) == V_PCH_ACPI_PM1_CNT_S3) {
+ ///
+ /// Report status code before goto S3 sleep
+ ///
+ REPORT_STATUS_CODE (EFI_PROGRESS_CODE, PROGRESS_CODE_S3_SUSPEND_END);
+
+ ///
+ /// Flush cache into memory before we go to sleep.
+ ///
+ AsmWbinvd ();
+ }
+
+ ///
+ /// Now that SMIs are disabled, write to the SLP_EN bit again to trigger the sleep
+ ///
+ Pm1Cnt |= B_PCH_ACPI_PM1_CNT_SLP_EN;
+
+ IoWrite32 ((UINTN) (mAcpiBaseAddr + R_PCH_ACPI_PM1_CNT), Pm1Cnt);
+
+ ///
+ /// Should only proceed if wake event is generated.
+ ///
+ if ((Pm1Cnt & B_PCH_ACPI_PM1_CNT_SLP_TYP) == V_PCH_ACPI_PM1_CNT_S1) {
+ while (((IoRead16 ((UINTN) (mAcpiBaseAddr + R_PCH_ACPI_PM1_STS))) & B_PCH_ACPI_PM1_STS_WAK) == 0x0);
+ } else {
+ EFI_DEADLOOP ();
+ }
+ ///
+ /// The system just went to sleep. If the sleep state was S1, then code execution will resume
+ /// here when the system wakes up.
+ ///
+ Pm1Cnt = IoRead32 ((UINTN) (mAcpiBaseAddr + R_PCH_ACPI_PM1_CNT));
+
+ if ((Pm1Cnt & B_PCH_ACPI_PM1_CNT_SCI_EN) == 0) {
+ ///
+ /// An ACPI OS isn't present, clear the sleep information
+ ///
+ Pm1Cnt &= ~B_PCH_ACPI_PM1_CNT_SLP_TYP;
+ Pm1Cnt |= V_PCH_ACPI_PM1_CNT_S0;
+
+ IoWrite32 ((UINTN) (mAcpiBaseAddr + R_PCH_ACPI_PM1_CNT), Pm1Cnt);
+ }
+
+ PchSmmClearSource (&SX_SOURCE_DESC);
+ PchSmmEnableSource (&SX_SOURCE_DESC);
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmmUsb.c b/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmmUsb.c
new file mode 100644
index 0000000..8f24ff5
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchSmmUsb.c
@@ -0,0 +1,300 @@
+/** @file
+ File to contain all the hardware specific stuff for the Smm USB dispatch protocol.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "PchSmmHelpers.h"
+
+PCH_SMM_SOURCE_DESC mUSB2_WAKE = {
+ PCH_SMM_SCI_EN_DEPENDENT,
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_EN
+ },
+ S_PCH_SMI_EN,
+ N_PCH_SMI_EN_INTEL_USB2
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_STS
+ },
+ S_PCH_SMI_STS,
+ N_PCH_SMI_STS_INTEL_USB2
+ }
+ }
+};
+
+PCH_SMM_SOURCE_DESC mUSB1_LEGACY = {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_EN
+ },
+ S_PCH_SMI_EN,
+ N_PCH_SMI_EN_LEGACY_USB
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_STS
+ },
+ S_PCH_SMI_STS,
+ N_PCH_SMI_STS_LEGACY_USB
+ }
+ }
+};
+
+PCH_SMM_SOURCE_DESC mUSB2_LEGACY = {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_EN
+ },
+ S_PCH_SMI_EN,
+ N_PCH_SMI_EN_LEGACY_USB2
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_STS
+ },
+ S_PCH_SMI_STS,
+ N_PCH_SMI_STS_LEGACY_USB2
+ }
+ }
+};
+
+PCH_SMM_SOURCE_DESC mUSB3_LEGACY = {
+ PCH_SMM_NO_FLAGS,
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_EN
+ },
+ S_PCH_SMI_EN,
+ N_PCH_SMI_EN_LEGACY_USB3
+ },
+ NULL_BIT_DESC_INITIALIZER
+ },
+ {
+ {
+ {
+ ACPI_ADDR_TYPE,
+ R_PCH_SMI_STS
+ },
+ S_PCH_SMI_STS,
+ N_PCH_SMI_STS_LEGACY_USB3
+ }
+ }
+};
+
+typedef enum {
+ PchUsbControllerLpc0 = 0,
+ PchUsbControllerEhci1,
+ PchUsbControllerEhci2,
+ PchUsbControllerXhci,
+ PchUsbControllerTypeMax
+} PCH_USB_CONTROLLER_TYPE;
+
+typedef struct {
+ UINT8 Function;
+ UINT8 Device;
+ PCH_USB_CONTROLLER_TYPE UsbConType;
+} USB_CONTROLLER;
+
+USB_CONTROLLER mUsbControllersMap[] = {
+ {
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PchUsbControllerLpc0
+ },
+ {
+ PCI_FUNCTION_NUMBER_PCH_EHCI,
+ PCI_DEVICE_NUMBER_PCH_USB,
+ PchUsbControllerEhci1
+ },
+ {
+ PCI_FUNCTION_NUMBER_PCH_EHCI2,
+ PCI_DEVICE_NUMBER_PCH_USB_EXT,
+ PchUsbControllerEhci2
+ },
+ {
+ PCI_FUNCTION_NUMBER_PCH_XHCI,
+ PCI_DEVICE_NUMBER_PCH_XHCI,
+ PchUsbControllerXhci
+ }
+};
+
+/**
+ Find the handle that best matches the input Device Path and return the USB controller type
+
+ @param[in] DevicePath Pointer to the device Path table
+ @param[out] Controller Returned with the USB controller type of the input device path
+
+ @retval EFI_SUCCESS Find the handle that best matches the input Device Path
+ @exception EFI_UNSUPPORTED Invalid device Path table or can't find any match USB device path
+ PCH_USB_CONTROLLER_TYPE The USB controller type of the input
+ device path
+**/
+EFI_STATUS
+DevicePathToSupportedController (
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
+ OUT PCH_USB_CONTROLLER_TYPE *Controller
+ )
+{
+ EFI_STATUS Status;
+ EFI_HANDLE DeviceHandle;
+ ACPI_HID_DEVICE_PATH *AcpiNode;
+ PCI_DEVICE_PATH *PciNode;
+ EFI_DEVICE_PATH_PROTOCOL *RemaingDevicePath;
+ UINT8 UsbIndex;
+ ///
+ /// Find the handle that best matches the Device Path. If it is only a
+ /// partial match the remaining part of the device path is returned in
+ /// RemainingDevicePath.
+ ///
+ RemaingDevicePath = DevicePath;
+ Status = gBS->LocateDevicePath (
+ &gEfiPciRootBridgeIoProtocolGuid,
+ &DevicePath,
+ &DeviceHandle
+ );
+ if (EFI_ERROR (Status)) {
+ return EFI_UNSUPPORTED;
+ }
+
+ DevicePath = RemaingDevicePath;
+
+ ///
+ /// Get first node: Acpi Node
+ ///
+ AcpiNode = (ACPI_HID_DEVICE_PATH *) RemaingDevicePath;
+
+ if (AcpiNode->Header.Type != ACPI_DEVICE_PATH ||
+ AcpiNode->Header.SubType != ACPI_DP ||
+ DevicePathNodeLength (&AcpiNode->Header) != sizeof (ACPI_HID_DEVICE_PATH) ||
+ AcpiNode->HID != EISA_PNP_ID (0x0A03) ||
+ AcpiNode->UID != 0
+ ) {
+ return EFI_UNSUPPORTED;
+ } else {
+ ///
+ /// Get the next node: Pci Node
+ ///
+ RemaingDevicePath = NextDevicePathNode (RemaingDevicePath);
+ PciNode = (PCI_DEVICE_PATH *) RemaingDevicePath;
+ if (PciNode->Header.Type != HARDWARE_DEVICE_PATH ||
+ PciNode->Header.SubType != HW_PCI_DP ||
+ DevicePathNodeLength (&PciNode->Header) != sizeof (PCI_DEVICE_PATH)
+ ) {
+ return EFI_UNSUPPORTED;
+ }
+
+ for (UsbIndex = 0; UsbIndex < sizeof (mUsbControllersMap) / sizeof (USB_CONTROLLER); UsbIndex++) {
+ if ((PciNode->Device == mUsbControllersMap[UsbIndex].Device) &&
+ (PciNode->Function == mUsbControllersMap[UsbIndex].Function)) {
+ *Controller = mUsbControllersMap[UsbIndex].UsbConType;
+ return EFI_SUCCESS;
+ }
+ }
+
+ return EFI_UNSUPPORTED;
+ }
+}
+
+/**
+ Maps a USB context to a source description.
+
+ @param[in] Context The context we need to map. Type must be USB.
+ @param[in] SrcDesc The source description that corresponds to the given context.
+
+ @retval None.
+**/
+VOID
+MapUsbToSrcDesc (
+ IN PCH_SMM_CONTEXT *Context,
+ OUT PCH_SMM_SOURCE_DESC *SrcDesc
+ )
+{
+ PCH_USB_CONTROLLER_TYPE Controller;
+ EFI_STATUS Status;
+
+ Status = DevicePathToSupportedController (Context->Usb.Device, &Controller);
+ ///
+ /// Either the device path passed in by the child is incorrect or
+ /// the ones stored here internally are incorrect.
+ ///
+ ASSERT_EFI_ERROR (Status);
+
+ switch (Context->Usb.Type) {
+ case UsbLegacy:
+ switch (Controller) {
+ case PchUsbControllerLpc0:
+ CopyMem ((VOID *) SrcDesc, (VOID *) (&mUSB1_LEGACY), sizeof (PCH_SMM_SOURCE_DESC));
+ break;
+
+ case PchUsbControllerEhci1:
+ case PchUsbControllerEhci2:
+ CopyMem ((VOID *) SrcDesc, (VOID *) (&mUSB2_LEGACY), sizeof (PCH_SMM_SOURCE_DESC));
+ break;
+
+ case PchUsbControllerXhci:
+ CopyMem ((VOID *) SrcDesc, (VOID *) (&mUSB3_LEGACY), sizeof (PCH_SMM_SOURCE_DESC));
+ break;
+
+ default:
+ ASSERT (FALSE);
+ break;
+ }
+ break;
+
+ case UsbWake:
+ switch (Controller) {
+ case PchUsbControllerEhci1:
+ case PchUsbControllerEhci2:
+ CopyMem ((VOID *) SrcDesc, (VOID *) (&mUSB2_WAKE), sizeof (PCH_SMM_SOURCE_DESC));
+ break;
+
+ default:
+ ASSERT (FALSE);
+ break;
+ }
+ break;
+
+ default:
+ ASSERT (FALSE);
+ break;
+ }
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchxSmmHelpers.c b/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchxSmmHelpers.c
new file mode 100644
index 0000000..f6513a7
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchxSmmHelpers.c
@@ -0,0 +1,820 @@
+/** @file
+ This driver is responsible for the registration of child drivers
+ and the abstraction of the PCH SMI sources.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "PchSmmHelpers.h"
+
+//
+// Help handle porting bit shifts to IA-64.
+//
+#define BIT_ZERO 0x00000001
+
+/**
+ Publish SMI Dispatch protocols.
+
+ @param[in] None
+
+ @retval None
+**/
+VOID
+PchSmmPublishDispatchProtocols (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+
+ ///
+ /// Install protocol interfaces.
+ ///
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &mPrivateData.InstallMultProtHandle,
+ &gEfiSmmGpiDispatchProtocolGuid,
+ &mPrivateData.Protocols[GpiType].Protocols.Gpi,
+ &gEfiSmmSxDispatchProtocolGuid,
+ &mPrivateData.Protocols[SxType].Protocols.Sx,
+ &gEfiSmmSwDispatchProtocolGuid,
+ &mPrivateData.Protocols[SwType].Protocols.Sw,
+ &gEfiSmmIchnDispatchProtocolGuid,
+ &mPrivateData.Protocols[IchnType].Protocols.Ichn,
+ &gEfiSmmIchnDispatchExProtocolGuid,
+ &mPrivateData.Protocols[IchnExType].Protocols.IchnEx,
+ &gEfiSmmPowerButtonDispatchProtocolGuid,
+ &mPrivateData.Protocols[PowerButtonType].Protocols.PowerButton,
+ &gEfiSmmPeriodicTimerDispatchProtocolGuid,
+ &mPrivateData.Protocols[PeriodicTimerType].Protocols.PeriodicTimer,
+ &gEfiSmmUsbDispatchProtocolGuid,
+ &mPrivateData.Protocols[UsbType].Protocols.Usb,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+}
+
+/**
+ Initialize bits that aren't necessarily related to an SMI source.
+
+ @param[in] None
+
+ @retval EFI_SUCCESS SMI source initialization completed.
+ @retval Asserts Global Smi Bit is not enabled successfully.
+**/
+EFI_STATUS
+PchSmmInitHardware (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+
+ ///
+ /// Clear all SMIs
+ ///
+ PchSmmClearSmi ();
+
+ Status = PchSmmEnableGlobalSmiBit ();
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Be *really* sure to clear all SMIs
+ ///
+ PchSmmClearSmi ();
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Enables the PCH to generate SMIs. Note that no SMIs will be generated
+ if no SMI sources are enabled. Conversely, no enabled SMI source will
+ generate SMIs if SMIs are not globally enabled. This is the main
+ switchbox for SMI generation.
+
+ @param[in] None
+
+ @retval EFI_SUCCESS Enable Global Smi Bit completed
+**/
+EFI_STATUS
+PchSmmEnableGlobalSmiBit (
+ VOID
+ )
+{
+ UINT32 SmiEn;
+
+ SmiEn = IoRead32 ((UINTN) (mAcpiBaseAddr + R_PCH_SMI_EN));
+
+ ///
+ /// Set the "global smi enable" bit
+ ///
+ SmiEn |= B_PCH_SMI_EN_GBL_SMI;
+
+ IoWrite32 ((UINTN) (mAcpiBaseAddr + R_PCH_SMI_EN), SmiEn);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Clears the SMI after all SMI source have been processed.
+ Note that this function will not work correctly (as it is
+ written) unless all SMI sources have been processed.
+ A revision of this function could manually clear all SMI
+ status bits to guarantee success.
+
+ @param[in] None
+
+ @retval EFI_SUCCESS Clears the SMIs completed
+ @retval Asserts EOS was not set to a 1
+**/
+EFI_STATUS
+PchSmmClearSmi (
+ VOID
+ )
+{
+ BOOLEAN EosSet;
+ BOOLEAN SciEn;
+ UINT32 Pm1Cnt;
+ UINT16 Pm1Sts;
+ UINT32 Gpe0Sts;
+ UINT32 Gpe0aStsLow;
+ UINT32 Gpe0bStsHigh;
+ UINT32 SmiSts;
+ UINT32 AltGpiSmiSts;
+ UINT16 DevActSts;
+ UINT16 Tco1Sts;
+ UINT16 Tco2Sts;
+ PCH_SERIES PchSeries;
+
+ PchSeries = GetPchSeries();
+ Gpe0Sts = 0;
+ Gpe0aStsLow = 0;
+ Gpe0bStsHigh = 0;
+ AltGpiSmiSts = 0;
+ ///
+ /// Determine whether an ACPI OS is present (via the SCI_EN bit)
+ ///
+ Pm1Cnt = IoRead32 ((UINTN) (mAcpiBaseAddr + R_PCH_ACPI_PM1_CNT));
+ SciEn = (BOOLEAN) ((Pm1Cnt & B_PCH_ACPI_PM1_CNT_SCI_EN) == B_PCH_ACPI_PM1_CNT_SCI_EN);
+ if (!SciEn) {
+ ///
+ /// Clear any SMIs that double as SCIs (when SCI_EN==0)
+ ///
+ Pm1Sts = IoRead16 ((UINTN) (mAcpiBaseAddr + R_PCH_ACPI_PM1_STS));
+ if (PchSeries == PchLp) {
+ Gpe0Sts = IoRead32 ((UINTN) (mAcpiBaseAddr + R_PCH_ACPI_GPE0_STS_127_96));
+ } else if (PchSeries == PchH) {
+ Gpe0aStsLow = IoRead32 ((UINTN) (mAcpiBaseAddr + R_PCH_ACPI_GPE0a_STS));
+ Gpe0bStsHigh = IoRead32 ((UINTN) (mAcpiBaseAddr + R_PCH_ACPI_GPE0b_STS));
+ }
+
+ Pm1Sts |=
+ (
+ B_PCH_ACPI_PM1_STS_WAK |
+ B_PCH_ACPI_PM1_STS_PRBTNOR |
+ B_PCH_ACPI_PM1_STS_RTC |
+ B_PCH_ACPI_PM1_STS_PWRBTN |
+ B_PCH_ACPI_PM1_STS_GBL |
+ B_PCH_ACPI_PM1_STS_TMROF
+ );
+
+ if (PchSeries == PchLp) {
+ Gpe0Sts |=
+ (
+ B_PCH_ACPI_GPE0_STS_127_96_PME_B0 |
+ B_PCH_ACPI_GPE0_STS_127_96_PME |
+ B_PCH_ACPI_GPE0_STS_127_96_BATLOW |
+ B_PCH_ACPI_GPE0_STS_127_96_PCI_EXP |
+ B_PCH_ACPI_GPE0_STS_127_96_RI |
+ B_PCH_ACPI_GPE0_STS_127_96_SMB_WAK |
+ B_PCH_ACPI_GPE0_STS_127_96_TC0SCI |
+ B_PCH_ACPI_GPE0_STS_127_96_HOT_PLUG |
+ B_PCH_ACPI_GPE0_STS_127_96_BATLOW |
+ B_PCH_ACPI_GPE0_STS_127_96_GP27
+ );
+ } else if (PchSeries == PchH) {
+ Gpe0aStsLow |=
+ (
+ B_PCH_ACPI_GPE0a_STS_PME_B0 |
+ B_PCH_ACPI_GPE0a_STS_PME |
+ B_PCH_ACPI_GPE0a_STS_BATLOW |
+ B_PCH_ACPI_GPE0a_STS_PCI_EXP |
+ B_PCH_ACPI_GPE0a_STS_RI |
+ B_PCH_ACPI_GPE0a_STS_SMB_WAK |
+ B_PCH_ACPI_GPE0a_STS_TC0SCI |
+ B_PCH_ACPI_GPE0a_STS_HOT_PLUG |
+ B_PCH_ACPI_GPE0a_STS_BATLOW
+ );
+
+ Gpe0bStsHigh |= (B_PCH_ACPI_GPE0b_STS_GP27);
+ }
+
+ IoWrite16 ((UINTN) (mAcpiBaseAddr + R_PCH_ACPI_PM1_STS), (UINT16) Pm1Sts);
+ if (PchSeries == PchLp) {
+ IoWrite32 ((UINTN) (mAcpiBaseAddr + R_PCH_ACPI_GPE0_STS_127_96), (UINT32) Gpe0Sts);
+ } else if (PchSeries == PchH) {
+ IoWrite32 ((UINTN) (mAcpiBaseAddr + R_PCH_ACPI_GPE0a_STS), (UINT32) Gpe0aStsLow);
+ IoWrite32 ((UINTN) (mAcpiBaseAddr + R_PCH_ACPI_GPE0b_STS), (UINT32) Gpe0bStsHigh);
+ }
+ }
+ ///
+ /// Clear all SMIs that are unaffected by SCI_EN
+ ///
+ if (PchSeries == PchLp) {
+ AltGpiSmiSts = IoRead32 ((UINTN) (mGpioBaseAddr + R_PCH_LPTLP_ALT_GP_SMI_STS));
+ } else if (PchSeries == PchH) {
+ AltGpiSmiSts = IoRead16 ((UINTN) (mAcpiBaseAddr + R_PCH_LPTH_ALT_GP_SMI_STS));
+ }
+ SmiSts = IoRead32 ((UINTN) (mAcpiBaseAddr + R_PCH_SMI_STS));
+ DevActSts = IoRead16 ((UINTN) (mAcpiBaseAddr + R_PCH_DEVACT_STS));
+ Tco1Sts = IoRead16 ((UINTN) (mAcpiBaseAddr + PCH_TCO_BASE + R_PCH_TCO1_STS));
+ Tco2Sts = IoRead16 ((UINTN) (mAcpiBaseAddr + PCH_TCO_BASE + R_PCH_TCO2_STS));
+
+ SmiSts |=
+ (
+ B_PCH_SMI_STS_SMBUS |
+ B_PCH_SMI_STS_PERIODIC |
+ B_PCH_SMI_STS_TCO |
+ B_PCH_SMI_STS_MCSMI |
+ B_PCH_SMI_STS_SWSMI_TMR |
+ B_PCH_SMI_STS_APM |
+ B_PCH_SMI_STS_ON_SLP_EN |
+ B_PCH_SMI_STS_BIOS
+ );
+ AltGpiSmiSts |= 0xFFFF;
+ DevActSts |=
+ (
+ B_PCH_DEVACT_STS_KBC |
+ B_PCH_DEVACT_STS_PIRQDH |
+ B_PCH_DEVACT_STS_PIRQCG |
+ B_PCH_DEVACT_STS_PIRQBF |
+ B_PCH_DEVACT_STS_PIRQAE
+ );
+ Tco1Sts |=
+ (
+ B_PCH_TCO1_STS_DMISERR |
+ B_PCH_TCO1_STS_DMISMI |
+ B_PCH_TCO1_STS_DMISCI |
+ B_PCH_TCO1_STS_BIOSWR |
+ B_PCH_TCO1_STS_NEWCENTURY |
+ B_PCH_TCO1_STS_TIMEOUT |
+ B_PCH_TCO1_STS_TCO_INT |
+ B_PCH_TCO1_STS_SW_TCO_SMI
+ );
+ if(PchSeries == PchLp){
+ IoWrite32 ((UINTN) (mGpioBaseAddr + R_PCH_LPTLP_ALT_GP_SMI_STS), AltGpiSmiSts);
+ } else if (PchSeries == PchH) {
+ IoWrite16 ((UINTN) (mAcpiBaseAddr + R_PCH_LPTH_ALT_GP_SMI_STS), (UINT16)AltGpiSmiSts);
+ }
+ IoWrite16 ((UINTN) (mAcpiBaseAddr + PCH_TCO_BASE + R_PCH_TCO1_STS), Tco1Sts);
+
+ Tco2Sts |= B_PCH_TCO2_STS_SECOND_TO;
+ IoWrite16 ((UINTN) (mAcpiBaseAddr + PCH_TCO_BASE + R_PCH_TCO2_STS), Tco2Sts);
+
+ Tco2Sts |= (B_PCH_TCO2_STS_SMLINK_SLV_SMI | B_PCH_TCO2_STS_BOOT | B_PCH_TCO2_STS_INTRD_DET);
+ IoWrite16 ((UINTN) (mAcpiBaseAddr + PCH_TCO_BASE + R_PCH_TCO2_STS), Tco2Sts);
+
+ IoWrite32 ((UINTN) (mAcpiBaseAddr + R_PCH_SMI_STS), SmiSts);
+
+ IoWrite16 ((UINTN) (mAcpiBaseAddr + R_PCH_DEVACT_STS), DevActSts);
+
+ ///
+ /// Try to clear the EOS bit. ASSERT on an error
+ ///
+ EosSet = PchSmmSetAndCheckEos ();
+ ASSERT (EosSet);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Set the SMI EOS bit after all SMI source have been processed.
+
+ @param[in] None
+
+ @retval FALSE EOS was not set to a 1; this is an error
+ @retval TRUE EOS was correctly set to a 1
+**/
+BOOLEAN
+PchSmmSetAndCheckEos (
+ VOID
+ )
+{
+ UINT32 SmiEn;
+
+ SmiEn = IoRead32 ((UINTN) (mAcpiBaseAddr + R_PCH_SMI_EN));
+
+ ///
+ /// Reset the PCH to generate subsequent SMIs
+ ///
+ SmiEn |= B_PCH_SMI_EN_EOS;
+
+ IoWrite32 ((UINTN) (mAcpiBaseAddr + R_PCH_SMI_EN), SmiEn);
+
+ ///
+ /// Double check that the assert worked
+ ///
+ SmiEn = IoRead32 ((UINTN) (mAcpiBaseAddr + R_PCH_SMI_EN));
+
+ ///
+ /// Return TRUE if EOS is set correctly
+ ///
+ if ((SmiEn & B_PCH_SMI_EN_EOS) == 0) {
+ ///
+ /// EOS was not set to a 1; this is an error
+ ///
+ return FALSE;
+ } else {
+ ///
+ /// EOS was correctly set to a 1
+ ///
+ return TRUE;
+ }
+}
+
+/**
+ Determine whether an ACPI OS is present (via the SCI_EN bit)
+
+ @param[in] None
+
+ @retval TRUE ACPI OS is present
+ @retval FALSE ACPI OS is not present
+**/
+BOOLEAN
+PchSmmGetSciEn (
+ VOID
+ )
+{
+ BOOLEAN SciEn;
+ UINT32 Pm1Cnt;
+
+ ///
+ /// Determine whether an ACPI OS is present (via the SCI_EN bit)
+ ///
+ Pm1Cnt = IoRead32 ((UINTN) (mAcpiBaseAddr + R_PCH_ACPI_PM1_CNT));
+ SciEn = (BOOLEAN) ((Pm1Cnt & B_PCH_ACPI_PM1_CNT_SCI_EN) == B_PCH_ACPI_PM1_CNT_SCI_EN);
+
+ return SciEn;
+}
+
+/**
+ Read a specifying bit with the register
+ These may or may not need to change w/ the PCH version; they're highly IA-32 dependent, though.
+
+ @param[in] BitDesc The struct that includes register address, size in byte and bit number
+
+ @retval TRUE The bit is enabled
+ @retval FALSE The bit is disabled
+**/
+BOOLEAN
+ReadBitDesc (
+ const PCH_SMM_BIT_DESC *BitDesc
+ )
+{
+ EFI_STATUS Status;
+ UINT64 Register;
+ UINT32 PciBus;
+ UINT32 PciDev;
+ UINT32 PciFun;
+ UINT32 PciReg;
+ UINTN RegSize;
+ BOOLEAN BitWasOne;
+ UINTN ShiftCount;
+ UINTN RegisterOffset;
+ UINT32 BaseAddr;
+
+ ASSERT (BitDesc != NULL);
+ ASSERT (!IS_BIT_DESC_NULL (*BitDesc));
+
+ RegSize = 0;
+ Register = 0;
+ ShiftCount = 0;
+ BitWasOne = FALSE;
+
+ switch (BitDesc->Reg.Type) {
+
+ case ACPI_ADDR_TYPE:
+ case GPIO_ADDR_TYPE:
+ if(BitDesc->Reg.Type == ACPI_ADDR_TYPE){
+ RegisterOffset = BitDesc->Reg.Data.acpi;
+ BaseAddr = mAcpiBaseAddr;
+ } else {
+ RegisterOffset = BitDesc->Reg.Data.gpio;
+ BaseAddr = mGpioBaseAddr;
+ }
+ switch (BitDesc->SizeInBytes) {
+
+ case 0:
+ ///
+ /// Chances are that this field didn't get initialized.
+ /// Check your assignments to bit descriptions.
+ ///
+ ASSERT (FALSE);
+ break;
+
+ case 1:
+ RegSize = SMM_IO_UINT8;
+ break;
+
+ case 2:
+ RegSize = SMM_IO_UINT16;
+ break;
+
+ case 4:
+ RegSize = SMM_IO_UINT32;
+ break;
+
+ case 8:
+ RegSize = SMM_IO_UINT64;
+ break;
+
+ default:
+ ///
+ /// Unsupported or invalid register size
+ ///
+ ASSERT (FALSE);
+ break;
+ }
+ ///
+ /// Double check that we correctly read in the acpi base address
+ ///
+ ASSERT ((BaseAddr != 0x0) && ((BaseAddr & 0x1) != 0x1));
+
+ ShiftCount = BitDesc->Bit;
+ ///
+ /// As current CPU Smm Io can only support at most
+ /// 32-bit read/write,if Operation is 64 bit,
+ /// we do a 32 bit operation according to BitDesc->Bit
+ ///
+ if (RegSize == SMM_IO_UINT64) {
+ RegSize = SMM_IO_UINT32;
+ ///
+ /// If the operation is for high 32 bits
+ ///
+ if (BitDesc->Bit >= 32) {
+ RegisterOffset += 4;
+ ShiftCount -= 32;
+ }
+ }
+
+ Status = mSmst->SmmIo.Io.Read (
+ &mSmst->SmmIo,
+ RegSize,
+ BaseAddr + RegisterOffset,
+ 1,
+ &Register
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ if ((Register & (LShiftU64 (BIT_ZERO, ShiftCount))) != 0) {
+ BitWasOne = TRUE;
+ } else {
+ BitWasOne = FALSE;
+ }
+ break;
+
+ case MEMORY_MAPPED_IO_ADDRESS_TYPE:
+ ///
+ /// Read the register, and it with the bit to read
+ ///
+ switch (BitDesc->SizeInBytes) {
+ case 1:
+ Register = (UINT64) MmioRead8 ((UINTN) BitDesc->Reg.Data.Mmio);
+ break;
+
+ case 2:
+ Register = (UINT64) MmioRead16 ((UINTN) BitDesc->Reg.Data.Mmio);
+ break;
+
+ case 4:
+ Register = (UINT64) MmioRead32 ((UINTN) BitDesc->Reg.Data.Mmio);
+ break;
+
+ case 8:
+ Register = (UINT64) MmioRead32 ((UINTN) BitDesc->Reg.Data.Mmio);
+ *((UINT32 *) (&Register) + 1) = MmioRead32 ((UINTN) BitDesc->Reg.Data.Mmio + 4);
+ break;
+
+ default:
+ ///
+ /// Unsupported or invalid register size
+ ///
+ ASSERT (FALSE);
+ break;
+ }
+
+ Register = Register & (LShiftU64 (BIT0, BitDesc->Bit));
+ if (Register) {
+ BitWasOne = TRUE;
+ } else {
+ BitWasOne = FALSE;
+ }
+ break;
+
+ case PCIE_ADDR_TYPE:
+ PciBus = BitDesc->Reg.Data.pcie.Fields.Bus;
+ PciDev = BitDesc->Reg.Data.pcie.Fields.Dev;
+ PciFun = BitDesc->Reg.Data.pcie.Fields.Fnc;
+ PciReg = BitDesc->Reg.Data.pcie.Fields.Reg;
+ switch (BitDesc->SizeInBytes) {
+
+ case 0:
+ ///
+ /// Chances are that this field didn't get initialized.
+ /// Check your assignments to bit descriptions.
+ ///
+ ASSERT (FALSE);
+ break;
+
+ case 1:
+ Register = (UINT64) MmioRead8 (MmPciAddress (0, PciBus, PciDev, PciFun, PciReg));
+ break;
+
+ case 2:
+ Register = (UINT64) MmioRead16 (MmPciAddress (0, PciBus, PciDev, PciFun, PciReg));
+ break;
+
+ case 4:
+ Register = (UINT64) MmioRead32 (MmPciAddress (0, PciBus, PciDev, PciFun, PciReg));
+ break;
+
+ default:
+ ///
+ /// Unsupported or invalid register size
+ ///
+ ASSERT (FALSE);
+ break;
+ }
+
+ if ((Register & (LShiftU64 (BIT_ZERO, BitDesc->Bit))) != 0) {
+ BitWasOne = TRUE;
+ } else {
+ BitWasOne = FALSE;
+ }
+ break;
+
+ default:
+ ///
+ /// This address type is not yet implemented
+ ///
+ ASSERT (FALSE);
+ break;
+ }
+
+ return BitWasOne;
+}
+
+/**
+ Write a specifying bit with the register
+
+ @param[in] BitDesc The struct that includes register address, size in byte and bit number
+ @param[in] ValueToWrite The value to be wrote
+ @param[in] WriteClear If the rest bits of the register is write clear
+
+ @retval None
+**/
+VOID
+WriteBitDesc (
+ const PCH_SMM_BIT_DESC *BitDesc,
+ const BOOLEAN ValueToWrite,
+ const BOOLEAN WriteClear
+ )
+{
+ EFI_STATUS Status;
+ UINT64 Register;
+ UINT64 AndVal;
+ UINT64 OrVal;
+ UINT32 RegSize;
+ UINT32 PciBus;
+ UINT32 PciDev;
+ UINT32 PciFun;
+ UINT32 PciReg;
+ UINTN RegisterOffset;
+ UINT32 BaseAddr;
+
+ ASSERT (BitDesc != NULL);
+ ASSERT (!IS_BIT_DESC_NULL (*BitDesc));
+
+ RegSize = 0;
+ Register = 0;
+
+ if (WriteClear) {
+ AndVal = LShiftU64 (BIT_ZERO, BitDesc->Bit);
+ } else {
+ AndVal = ~(LShiftU64 (BIT_ZERO, BitDesc->Bit));
+ }
+
+ OrVal = (LShiftU64 ((UINT32) ValueToWrite, BitDesc->Bit));
+
+ switch (BitDesc->Reg.Type) {
+
+ case ACPI_ADDR_TYPE:
+ case GPIO_ADDR_TYPE:
+ if(BitDesc->Reg.Type == ACPI_ADDR_TYPE){
+ RegisterOffset = BitDesc->Reg.Data.acpi;
+ BaseAddr = mAcpiBaseAddr;
+ } else {
+ RegisterOffset = BitDesc->Reg.Data.gpio;
+ BaseAddr = mGpioBaseAddr;
+ }
+ switch (BitDesc->SizeInBytes) {
+
+ case 0:
+ ///
+ /// Chances are that this field didn't get initialized.
+ /// Check your assignments to bit descriptions.
+ ///
+ ASSERT (FALSE);
+ break;
+
+ case 1:
+ RegSize = SMM_IO_UINT8;
+ break;
+
+ case 2:
+ RegSize = SMM_IO_UINT16;
+ break;
+
+ case 4:
+ RegSize = SMM_IO_UINT32;
+ break;
+
+ case 8:
+ RegSize = SMM_IO_UINT64;
+ break;
+
+ default:
+ ///
+ /// Unsupported or invalid register size
+ ///
+ ASSERT (FALSE);
+ break;
+ }
+ ///
+ /// Double check that we correctly read in the acpi base address
+ ///
+ ASSERT ((BaseAddr != 0x0) && ((BaseAddr & 0x1) != 0x1));
+
+ ///
+ /// As current CPU Smm Io can only support at most
+ /// 32-bit read/write,if Operation is 64 bit,
+ /// we do a 32 bit operation according to BitDesc->Bit
+ ///
+ if (RegSize == SMM_IO_UINT64) {
+ RegSize = SMM_IO_UINT32;
+ ///
+ /// If the operation is for high 32 bits
+ ///
+ if (BitDesc->Bit >= 32) {
+ RegisterOffset += 4;
+
+ if (WriteClear) {
+ AndVal = LShiftU64 (BIT_ZERO, BitDesc->Bit - 32);
+ } else {
+ AndVal = ~(LShiftU64 (BIT_ZERO, BitDesc->Bit - 32));
+ }
+
+ OrVal = LShiftU64 ((UINT32) ValueToWrite, BitDesc->Bit - 32);
+ }
+ }
+
+ Status = mSmst->SmmIo.Io.Read (
+ &mSmst->SmmIo,
+ RegSize,
+ BaseAddr + RegisterOffset,
+ 1,
+ &Register
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ Register &= AndVal;
+ Register |= OrVal;
+
+ Status = mSmst->SmmIo.Io.Write (
+ &mSmst->SmmIo,
+ RegSize,
+ BaseAddr + RegisterOffset,
+ 1,
+ &Register
+ );
+ ASSERT_EFI_ERROR (Status);
+ break;
+
+ case MEMORY_MAPPED_IO_ADDRESS_TYPE:
+ ///
+ /// Read the register, or it with the bit to set, then write it back.
+ ///
+ switch (BitDesc->SizeInBytes) {
+ case 1:
+ Register = (UINT64) MmioRead8 ((UINTN) BitDesc->Reg.Data.Mmio);
+ break;
+
+ case 2:
+ Register = (UINT64) MmioRead16 ((UINTN) BitDesc->Reg.Data.Mmio);
+ break;
+
+ case 4:
+ Register = (UINT64) MmioRead32 ((UINTN) BitDesc->Reg.Data.Mmio);
+ break;
+
+ case 8:
+ Register = (UINT64) MmioRead32 ((UINTN) BitDesc->Reg.Data.Mmio);
+ *((UINT32 *) (&Register) + 1) = MmioRead32 ((UINTN) BitDesc->Reg.Data.Mmio + 4);
+ break;
+
+ default:
+ ///
+ /// Unsupported or invalid register size
+ ///
+ ASSERT (FALSE);
+ break;
+ }
+
+ Register &= AndVal;
+ Register |= OrVal;
+ ///
+ /// Read the register, or it with the bit to set, then write it back.
+ ///
+ switch (BitDesc->SizeInBytes) {
+ case 1:
+ MmioWrite8 ((UINTN) BitDesc->Reg.Data.Mmio, (UINT8) Register);
+ break;
+
+ case 2:
+ MmioWrite16 ((UINTN) BitDesc->Reg.Data.Mmio, (UINT16) Register);
+ break;
+
+ case 4:
+ MmioWrite32 ((UINTN) BitDesc->Reg.Data.Mmio, (UINT32) Register);
+ break;
+
+ case 8:
+ MmioWrite32 ((UINTN) BitDesc->Reg.Data.Mmio, (UINT32) Register);
+ MmioWrite32 ((UINTN) BitDesc->Reg.Data.Mmio + 4, *((UINT32 *) (&Register) + 1));
+ break;
+
+ default:
+ ///
+ /// Unsupported or invalid register size
+ ///
+ ASSERT (FALSE);
+ break;
+ }
+ break;
+
+ case PCIE_ADDR_TYPE:
+ PciBus = BitDesc->Reg.Data.pcie.Fields.Bus;
+ PciDev = BitDesc->Reg.Data.pcie.Fields.Dev;
+ PciFun = BitDesc->Reg.Data.pcie.Fields.Fnc;
+ PciReg = BitDesc->Reg.Data.pcie.Fields.Reg;
+ switch (BitDesc->SizeInBytes) {
+
+ case 0:
+ ///
+ /// Chances are that this field didn't get initialized -- check your assignments
+ /// to bit descriptions.
+ ///
+ ASSERT (FALSE);
+ break;
+
+ case 1:
+ MmioAndThenOr8 (MmPciAddress (0, PciBus, PciDev, PciFun, PciReg), (UINT8) AndVal, (UINT8) OrVal);
+ break;
+
+ case 2:
+ MmioAndThenOr16 (MmPciAddress (0, PciBus, PciDev, PciFun, PciReg), (UINT16) AndVal, (UINT16) OrVal);
+ break;
+
+ case 4:
+ MmioAndThenOr32 (MmPciAddress (0, PciBus, PciDev, PciFun, PciReg), (UINT32) AndVal, (UINT32) OrVal);
+ break;
+
+ default:
+ ///
+ /// Unsupported or invalid register size
+ ///
+ ASSERT (FALSE);
+ break;
+ }
+ break;
+
+ default:
+ ///
+ /// This address type is not yet implemented
+ ///
+ ASSERT (FALSE);
+ break;
+ }
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchxSmmHelpers.h b/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchxSmmHelpers.h
new file mode 100644
index 0000000..ead184c
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/PchSmiDispatcher/Smm/PchxSmmHelpers.h
@@ -0,0 +1,128 @@
+/** @file
+ This driver is responsible for the registration of child drivers
+ and the abstraction of the PCH SMI sources.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PCHX_SMM_HELPERS_H_
+#define _PCHX_SMM_HELPERS_H_
+
+#include "PchSmm.h"
+#include "PchPlatformLib.h"
+
+/**
+ Initialize bits that aren't necessarily related to an SMI source.
+
+ @param[in] None
+
+ @retval EFI_SUCCESS SMI source initialization completed.
+ @retval Asserts Global Smi Bit is not enabled successfully.
+**/
+EFI_STATUS
+PchSmmInitHardware (
+ VOID
+ );
+
+/**
+ Enables the PCH to generate SMIs. Note that no SMIs will be generated
+ if no SMI sources are enabled. Conversely, no enabled SMI source will
+ generate SMIs if SMIs are not globally enabled. This is the main
+ switchbox for SMI generation.
+
+ @param[in] None
+
+ @retval EFI_SUCCESS Enable Global Smi Bit completed
+**/
+EFI_STATUS
+PchSmmEnableGlobalSmiBit (
+ VOID
+ );
+
+/**
+ Clears the SMI after all SMI source have been processed.
+ Note that this function will not work correctly (as it is
+ written) unless all SMI sources have been processed.
+ A revision of this function could manually clear all SMI
+ status bits to guarantee success.
+
+ @param[in] None
+
+ @retval EFI_SUCCESS Clears the SMIs completed
+ @retval Asserts EOS was not set to a 1
+**/
+EFI_STATUS
+PchSmmClearSmi (
+ VOID
+ );
+
+/**
+ Set the SMI EOS bit after all SMI source have been processed.
+
+ @param[in] None
+
+ @retval FALSE EOS was not set to a 1; this is an error
+ @retval TRUE EOS was correctly set to a 1
+**/
+BOOLEAN
+PchSmmSetAndCheckEos (
+ VOID
+ );
+
+/**
+ Determine whether an ACPI OS is present (via the SCI_EN bit)
+
+ @param[in] None
+
+ @retval TRUE ACPI OS is present
+ @retval FALSE ACPI OS is not present
+**/
+BOOLEAN
+PchSmmGetSciEn (
+ VOID
+ );
+
+/**
+ Read a specifying bit with the register
+
+ @param[in] BitDesc The struct that includes register address, size in byte and bit number
+
+ @retval TRUE The bit is enabled
+ @retval FALSE The bit is disabled
+**/
+BOOLEAN
+ReadBitDesc (
+ const PCH_SMM_BIT_DESC *BitDesc
+ );
+
+/**
+ Write a specifying bit with the register
+
+ @param[in] BitDesc The struct that includes register address, size in byte and bit number
+ @param[in] ValueToWrite The value to be wrote
+ @param[in] WriteClear If the rest bits of the register is write clear
+
+ @retval None
+**/
+VOID
+WriteBitDesc (
+ const PCH_SMM_BIT_DESC *BitDesc,
+ const BOOLEAN ValueToWrite,
+ const BOOLEAN WriteClear
+ );
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Pcie/Smm/PchPcieSmm.c b/ReferenceCode/Chipset/LynxPoint/Pcie/Smm/PchPcieSmm.c
new file mode 100644
index 0000000..720fcfc
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Pcie/Smm/PchPcieSmm.c
@@ -0,0 +1,388 @@
+/** @file
+ PCH Pcie SMM Driver Entry
+
+@copyright
+ Copyright (c) 2010 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "PchPcieSmm.h"
+
+//
+// Global variables
+//
+EFI_SMM_SYSTEM_TABLE *mSmst;
+EFI_SMM_BASE_PROTOCOL *mSmmBase;
+PCH_PCI_EXPRESS_CONFIG *mPciExpressConfig;
+PCH_PWR_OPT_CONFIG *mPchPwrOptConfig;
+UINT8 *mRevision;
+UINT8 mBusNumber;
+
+/**
+ Program Common Clock and ASPM of Downstream Devices
+
+ @param[in] Function Pcie Root Port Function Number
+
+ @retval EFI_SUCCESS Function complete successfully
+**/
+EFI_STATUS
+PchPcieSmi (
+ IN UINT8 Function
+ )
+{
+ UINT16 Data16;
+ UINT8 SecBus;
+ UINT8 SubBus;
+ BOOLEAN L1SubstatesSupported;
+ EFI_HANDLE Handle;
+ PCH_PCIE_EXPRESS_L1SUBSTATES_CONTROL L1SubVal;
+ UINT8 RootPortNumber;
+ UINT32 RootComplexBar;
+ UINTN PciD31F0RegBase;
+ BOOLEAN LtrSupported;
+ PCH_SERIES PchSeries;
+
+ Handle = NULL;
+ PchSeries = GetPchSeries();
+ LtrSupported = TRUE;
+ PciD31F0RegBase = MmPciAddress (
+ 0,
+ mBusNumber,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ 0
+ );
+ RootComplexBar = MmioRead32 (PciD31F0RegBase + R_PCH_LPC_RCBA) & B_PCH_LPC_RCBA_BAR;
+ RootPortNumber = GetPchPcieRpNumber(RootComplexBar, Function);
+
+ if (RootPortNumber == 0xFF) {
+ return EFI_DEVICE_ERROR;
+ }
+ ///
+ /// Check for presense detect state
+ ///
+ Data16 = MmioRead16 (MmPciAddress (0, 0, PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS, Function, R_PCH_PCIE_SLSTS));
+ Data16 &= B_PCH_PCIE_SLSTS_PDS;
+ if (Data16) {
+ SecBus = MmioRead8 (MmPciAddress (0, 0, PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS, Function, 0x19));
+ SubBus = MmioRead8 (MmPciAddress (0, 0, PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS, Function, 0x1A));
+ PchPcieInitRootPortDownstreamDevices (0, PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS, Function, SecBus, SubBus, NULL);
+ MmioWrite8 (MmPciAddress (0, 0, PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS, Function, 0x19), SecBus);
+ MmioWrite8 (MmPciAddress (0, 0, PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS, Function, 0x1A), SubBus);
+ L1SubVal = PchPcieL1SubstatesL1_1_2;
+ if ((*mRevision) >= DXE_PCH_PLATFORM_POLICY_PROTOCOL_REVISION_2) {
+ L1SubVal = mPciExpressConfig->RootPort[RootPortNumber].L1Substates;
+ }
+ PcieSetPm (
+ 0,
+ PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS,
+ Function,
+ mPciExpressConfig->RootPort[RootPortNumber].Aspm,
+ mPciExpressConfig->NumOfDevAspmOverride,
+ mPciExpressConfig->DevAspmOverride,
+ mPciExpressConfig->TempRootPortBusNumMin,
+ mPciExpressConfig->TempRootPortBusNumMax,
+ mPchPwrOptConfig->NumOfDevLtrOverride,
+ mPchPwrOptConfig->DevLtrOverride,
+ &(mPchPwrOptConfig->PchPwrOptPcie[RootPortNumber]),
+ &L1SubstatesSupported,
+ L1SubVal,
+ *mRevision,
+ FALSE,
+ FALSE,
+ FALSE,
+ &LtrSupported
+ );
+
+ if(!LtrSupported && (PchSeries == PchLp)) {
+ MmioAndThenOr32 ( (RootComplexBar + 0x3320), 0, 0x00010003);
+ }
+ } else {
+ ///
+ /// Clear CCC and LTSP bits when PCIe Card hot unplugged
+ ///
+ MmioAnd32 (MmPciAddress (0, 0, PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS, Function, R_PCH_PCIE_MPC2), (UINT32) ~BIT6);
+ MmioAnd16 (MmPciAddress (0, 0, PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS, Function, R_PCH_PCIE_LCTL), (UINT16) ~B_PCH_PCIE_LCTL_CCC);
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ PCIE Hotplug SMI call back function for each Root port
+
+ @param[in] DispatchHandle Handle of this dispatch function
+ @param[in] DispatchContext Pointer to the dispatch function's context.
+ The DispatchContext fields are filled in by the dispatching driver
+ prior to invoke this dispatch function
+**/
+VOID
+EFIAPI
+PchPcieSmiHandlerFunction (
+ IN EFI_HANDLE DispatchHandle,
+ IN EFI_SMM_ICHN_DISPATCH_EX_CONTEXT *DispatchContext
+ )
+{
+ PchPcieSmi ((UINT8) (DispatchContext->Type - IchnExPcie0Hotplug));
+ return;
+}
+
+/**
+ PCIE Link Active State Change Hotplug SMI call back function for all Root ports
+
+ @param[in] DispatchHandle Handle of this dispatch function
+ @param[in] DispatchContext Pointer to the dispatch function's context.
+ The DispatchContext fields are filled in by the dispatching driver
+ prior to invoke this dispatch function
+**/
+VOID
+EFIAPI
+PchPcieLinkActiveStateChange (
+ IN EFI_HANDLE DispatchHandle,
+ IN EFI_SMM_ICHN_DISPATCH_EX_CONTEXT *DispatchContext
+ )
+{
+ return;
+}
+
+/**
+ Register PCIE Hotplug SMI dispatch function to handle Hotplug enabling
+
+ @param[in] ImageHandle The image handle of this module
+ @param[in] SystemTable The EFI System Table
+
+ @retval EFI_SUCCESS The function completes successfully
+**/
+EFI_STATUS
+EFIAPI
+InitializePchPcieSmm (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ UINT8 Index;
+ UINT8 Data8;
+ UINT32 Data32Or;
+ UINT32 Data32And;
+ UINTN RPBase;
+ EFI_HANDLE PcieHandle;
+ static CONST EFI_SMM_ICHN_EX_SMI_TYPE PchHPcieHandlerList[LPTH_PCIE_MAX_ROOT_PORTS * 2] = {
+ IchnExPcie0Hotplug,
+ IchnExPcie1Hotplug,
+ IchnExPcie2Hotplug,
+ IchnExPcie3Hotplug,
+ IchnExPcie4Hotplug,
+ IchnExPcie5Hotplug,
+ IchnExPcie6Hotplug,
+ IchnExPcie7Hotplug,
+ IchnExPcie0LinkActive,
+ IchnExPcie1LinkActive,
+ IchnExPcie2LinkActive,
+ IchnExPcie3LinkActive,
+ IchnExPcie4LinkActive,
+ IchnExPcie5LinkActive,
+ IchnExPcie6LinkActive,
+ IchnExPcie7LinkActive
+ };
+ static CONST EFI_SMM_ICHN_EX_SMI_TYPE PchLpPcieHandlerList[LPTLP_PCIE_MAX_ROOT_PORTS * 2] = {
+ IchnExPcie0Hotplug,
+ IchnExPcie1Hotplug,
+ IchnExPcie2Hotplug,
+ IchnExPcie3Hotplug,
+ IchnExPcie4Hotplug,
+ IchnExPcie5Hotplug,
+ IchnExPcie0LinkActive,
+ IchnExPcie1LinkActive,
+ IchnExPcie2LinkActive,
+ IchnExPcie3LinkActive,
+ IchnExPcie4LinkActive,
+ IchnExPcie5LinkActive
+ };
+ EFI_SMM_ICHN_DISPATCH_EX_PROTOCOL *mIchnDispatch;
+ EFI_SMM_ICHN_DISPATCH_EX_CONTEXT PchPcieContext;
+ UINTN PortIndex;
+ DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy;
+ PCH_PCIE_DEVICE_LTR_OVERRIDE *DevLtrOverrideTbl;
+ UINT32 TableSize;
+ PCH_SERIES PchSeries;
+
+ DEBUG ((EFI_D_INFO, "InitializePchPcieSmm() Start\n"));
+
+ PchSeries = GetPchSeries();
+ DevLtrOverrideTbl = NULL;
+ ///
+ /// Locate SmmBase protocol
+ ///
+ Status = gBS->LocateProtocol (&gEfiSmmBaseProtocolGuid, NULL, (VOID **) &mSmmBase);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Initialize our module variables
+ ///
+ Status = mSmmBase->GetSmstLocation (mSmmBase, &mSmst);
+ ASSERT_EFI_ERROR (Status);
+ ///
+ /// Locate the ICHnEx Dispatch protocol
+ ///
+ Status = gBS->LocateProtocol (&gEfiSmmIchnDispatchExProtocolGuid, NULL, (VOID **) &mIchnDispatch);
+ ASSERT_EFI_ERROR (Status);
+
+ Status = gBS->LocateProtocol (&gDxePchPlatformPolicyProtocolGuid, NULL, (VOID **) &PchPlatformPolicy);
+ ASSERT_EFI_ERROR (Status);
+
+ Status = mSmst->SmmAllocatePool (
+ EfiRuntimeServicesData,
+ sizeof (PCH_PCI_EXPRESS_CONFIG),
+ (VOID **) &mPciExpressConfig
+ );
+ ASSERT_EFI_ERROR (Status);
+ Status = mSmst->SmmAllocatePool (
+ EfiRuntimeServicesData,
+ sizeof (PCH_PWR_OPT_CONFIG),
+ (VOID **) &mPchPwrOptConfig
+ );
+ ASSERT_EFI_ERROR (Status);
+ mPciExpressConfig->NumOfDevAspmOverride = PchPlatformPolicy->PciExpressConfig->NumOfDevAspmOverride;
+ TableSize = PchPlatformPolicy->PciExpressConfig->NumOfDevAspmOverride * sizeof (PCH_PCIE_DEVICE_ASPM_OVERRIDE);
+
+ ///
+ /// Allocate and copy ASPM override table to SMM memory
+ ///
+ Status = mSmst->SmmAllocatePool (
+ EfiRuntimeServicesData,
+ TableSize,
+ (VOID **) &mPciExpressConfig->DevAspmOverride
+ );
+ ASSERT_EFI_ERROR (Status);
+ CopyMem (mPciExpressConfig->DevAspmOverride, PchPlatformPolicy->PciExpressConfig->DevAspmOverride, TableSize);
+
+ Status = mSmst->SmmAllocatePool (
+ EfiRuntimeServicesData,
+ sizeof (PchPlatformPolicy->Revision),
+ &mRevision
+ );
+ ASSERT_EFI_ERROR (Status);
+ *mRevision = PchPlatformPolicy->Revision;
+ mBusNumber = PchPlatformPolicy->BusNumber;
+ ///
+ /// Allocate and copy LTR override table to SMM memory
+ ///
+ mPchPwrOptConfig->NumOfDevLtrOverride = PchPlatformPolicy->PwrOptConfig->NumOfDevLtrOverride;
+ DevLtrOverrideTbl = PchPlatformPolicy->PwrOptConfig->DevLtrOverride;
+ if ((DevLtrOverrideTbl != NULL) && (PchPlatformPolicy->PwrOptConfig->NumOfDevLtrOverride != 0)) {
+ TableSize = PchPlatformPolicy->PwrOptConfig->NumOfDevLtrOverride * sizeof (PCH_PCIE_DEVICE_LTR_OVERRIDE);
+ Status = mSmst->SmmAllocatePool (
+ EfiRuntimeServicesData,
+ TableSize,
+ (VOID **) &mPchPwrOptConfig->DevLtrOverride
+ );
+ ASSERT_EFI_ERROR (Status);
+ CopyMem (mPchPwrOptConfig->DevLtrOverride, DevLtrOverrideTbl, TableSize);
+ }
+
+ for (PortIndex = 0; PortIndex < GetPchMaxPciePortNum (); PortIndex++) {
+ mPciExpressConfig->RootPort[PortIndex].Aspm = PchPlatformPolicy->PciExpressConfig->RootPort[PortIndex].Aspm;
+ if (PchPlatformPolicy->Revision >= DXE_PCH_PLATFORM_POLICY_PROTOCOL_REVISION_2) {
+ mPciExpressConfig->RootPort[PortIndex].L1Substates = PchPlatformPolicy->PciExpressConfig->RootPort[PortIndex].L1Substates;
+ }
+ mPchPwrOptConfig->PchPwrOptPcie[PortIndex].LtrEnable = PchPlatformPolicy->PwrOptConfig->PchPwrOptPcie[PortIndex].LtrEnable;
+ mPchPwrOptConfig->PchPwrOptPcie[PortIndex].ObffEnable = PchPlatformPolicy->PwrOptConfig->PchPwrOptPcie[PortIndex].ObffEnable;
+ if (PchPlatformPolicy->Revision >= DXE_PCH_PLATFORM_POLICY_PROTOCOL_REVISION_7) {
+ mPchPwrOptConfig->PchPwrOptPcie[PortIndex].LtrMaxSnoopLatency = PchPlatformPolicy->PwrOptConfig->PchPwrOptPcie[PortIndex].LtrMaxSnoopLatency;
+ mPchPwrOptConfig->PchPwrOptPcie[PortIndex].LtrMaxNoSnoopLatency = PchPlatformPolicy->PwrOptConfig->PchPwrOptPcie[PortIndex].LtrMaxNoSnoopLatency;
+ }
+ }
+ ///
+ /// Locate the S3 resume scripting protocol
+ ///
+ INITIALIZE_SCRIPT (ImageHandle, SystemTable);
+
+ //
+ // Throught all PCIE root port function and register the SMI Handler for enabled ports.
+ //
+ for (Index = 0; Index < GetPchMaxPciePortNum (); Index++) {
+ RPBase = MmPciAddress (
+ 0,
+ 0,
+ PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS,
+ Index,
+ 0
+ );
+ //
+ // Skip the root port function which is not enabled
+ //
+ if (MmioRead32 (RPBase) == 0xFFFFFFFF) {
+ continue;
+ }
+
+ Data8 = MmioRead8 (RPBase + R_PCH_PCIE_SLCAP);
+ if (Data8 & B_PCH_PCIE_SLCAP_HPC) {
+ switch (PchSeries) {
+ case PchLp:
+ PchPcieContext.Type = PchLpPcieHandlerList[Index];
+ break;
+
+ case PchH:
+ PchPcieContext.Type = PchHPcieHandlerList[Index];
+ break;
+ default:
+ break;
+ }
+ PcieHandle = NULL;
+ Status = mIchnDispatch->Register (
+ mIchnDispatch,
+ PchPcieSmiHandlerFunction,
+ &PchPcieContext,
+ &PcieHandle
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ switch (PchSeries) {
+ case PchLp:
+ PchPcieContext.Type = PchLpPcieHandlerList[Index + LPTLP_PCIE_MAX_ROOT_PORTS];
+ break;
+
+ case PchH:
+ PchPcieContext.Type = PchHPcieHandlerList[Index + LPTH_PCIE_MAX_ROOT_PORTS];
+ break;
+ default:
+ break;
+ }
+ Status = mIchnDispatch->Register (
+ mIchnDispatch,
+ PchPcieLinkActiveStateChange,
+ &PchPcieContext,
+ &PcieHandle
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ Data32Or = B_PCH_PCIE_MPC_HPME;
+ Data32And = (UINT32)~B_PCH_PCIE_MPC_HPME;
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (RPBase + R_PCH_PCIE_MPC),
+ &Data32Or, // Data to be ORed
+ &Data32And // Data to be ANDed
+ );
+ }
+ }
+
+ DEBUG ((EFI_D_INFO, "InitializePchPcieSmm() End\n"));
+
+ return EFI_SUCCESS;
+} \ No newline at end of file
diff --git a/ReferenceCode/Chipset/LynxPoint/Pcie/Smm/PchPcieSmm.cif b/ReferenceCode/Chipset/LynxPoint/Pcie/Smm/PchPcieSmm.cif
new file mode 100644
index 0000000..043b301
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Pcie/Smm/PchPcieSmm.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "PchPcieSmm"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\Pcie\Smm"
+ RefName = "PchPcieSmm"
+[files]
+"PchPcieSmm.sdl"
+"PchPcieSmm.mak"
+"PchPcieSmm.h"
+"PchPcieSmm.c"
+"PchPcieSmm.dxs"
+"PchPcieSmm.inf"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/Pcie/Smm/PchPcieSmm.dxs b/ReferenceCode/Chipset/LynxPoint/Pcie/Smm/PchPcieSmm.dxs
new file mode 100644
index 0000000..878ce6b
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Pcie/Smm/PchPcieSmm.dxs
@@ -0,0 +1,52 @@
+/** @file
+ Dependency expression source file.
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "DxeDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+
+#include EFI_PROTOCOL_DEPENDENCY (SmmBase)
+#include EFI_PROTOCOL_DEPENDENCY (SmmIchnDispatchEx)
+#include EFI_PROTOCOL_DEPENDENCY (BootScriptSave)
+#include EFI_PROTOCOL_DEPENDENCY (PchInfo)
+#include EFI_PROTOCOL_DEPENDENCY (PchPlatformPolicy)
+#endif
+
+DEPENDENCY_START
+ EFI_SMM_BASE_PROTOCOL_GUID AND
+ EFI_SMM_ICHN_DISPATCH_EX_PROTOCOL_GUID AND
+#ifdef EFI_S3_RESUME
+ EFI_BOOT_SCRIPT_SAVE_PROTOCOL_GUID AND
+#endif
+ EFI_PCH_INFO_PROTOCOL_GUID AND
+ DXE_PCH_PLATFORM_POLICY_PROTOCOL_GUID
+DEPENDENCY_END
+
+
diff --git a/ReferenceCode/Chipset/LynxPoint/Pcie/Smm/PchPcieSmm.h b/ReferenceCode/Chipset/LynxPoint/Pcie/Smm/PchPcieSmm.h
new file mode 100644
index 0000000..caa0f58
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Pcie/Smm/PchPcieSmm.h
@@ -0,0 +1,99 @@
+/** @file
+ PCH Pcie SMM Driver Header
+
+@copyright
+ Copyright (c) 2010 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PCH_PCIE_SMM_H
+#define _PCH_PCIE_SMM_H
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+
+#include "EdkIIGlueDxe.h"
+#include "EfiScriptLib.h"
+#endif
+
+#include EFI_PROTOCOL_CONSUMER (PchPlatformPolicy)
+#include EFI_PROTOCOL_CONSUMER (SmmIchnDispatchEx)
+#include "PchAccess.h"
+#include "PchPlatformLib.h"
+#include "PchPciExpressHelpersLib.h"
+//
+// Prototypes
+//
+
+/**
+ Program Common Clock and ASPM of Downstream Devices
+
+ @param[in] PciePortNum Pcie Root Port Number
+
+ @retval EFI_SUCCESS Function complete successfully
+**/
+EFI_STATUS
+PchPcieSmi (
+ IN UINT8 PciePortNum
+ );
+
+/**
+ PCIE Hotplug SMI call back function for each Root port
+
+ @param[in] DispatchHandle Handle of this dispatch function
+ @param[in] DispatchContext Pointer to the dispatch function's context.
+ The DispatchContext fields are filled in by the dispatching driver
+ prior to invoke this dispatch function
+**/
+VOID
+EFIAPI
+PchPcieSmiHandlerFunction (
+ IN EFI_HANDLE DispatchHandle,
+ IN EFI_SMM_ICHN_DISPATCH_EX_CONTEXT *DispatchContext
+ );
+
+/**
+ PCIE Link Active State Change Hotplug SMI call back function for all Root ports
+
+ @param[in] DispatchHandle Handle of this dispatch function
+ @param[in] DispatchContext Pointer to the dispatch function's context.
+ The DispatchContext fields are filled in by the dispatching driver
+ prior to invoke this dispatch function
+**/
+VOID
+EFIAPI
+PchPcieLinkActiveStateChange (
+ IN EFI_HANDLE DispatchHandle,
+ IN EFI_SMM_ICHN_DISPATCH_EX_CONTEXT *DispatchContext
+ );
+
+/**
+ Register PCIE Hotplug SMI dispatch function to handle Hotplug enabling
+
+ @param[in] ImageHandle The image handle of this module
+ @param[in] SystemTable The EFI System Table
+
+ @retval EFI_SUCCESS The function completes successfully
+**/
+EFI_STATUS
+EFIAPI
+InitializePchPcieSmm (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ );
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Pcie/Smm/PchPcieSmm.inf b/ReferenceCode/Chipset/LynxPoint/Pcie/Smm/PchPcieSmm.inf
new file mode 100644
index 0000000..00ca70f
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Pcie/Smm/PchPcieSmm.inf
@@ -0,0 +1,86 @@
+## @file
+# Component description file for PchPcieSmm driver
+#
+#@copyright
+# Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = PchPcieSmm
+FILE_GUID = acaeaa7a-c039-4424-88da-f42212ea0e55
+COMPONENT_TYPE = BS_DRIVER
+
+[sources.common]
+ PchPcieSmm.c
+ PchPcieSmm.h
+
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueSmmDriverEntryPoint.c
+
+[includes.common]
+ $(EDK_SOURCE)/Foundation/Efi
+ .
+ ../Common
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/SampleCode
+
+[libraries.common]
+ EdkFrameworkProtocolLib
+ $(PROJECT_PCH_FAMILY)ProtocolLib
+ PchPlatformLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueSmmRuntimeDxeReportStatusCodeLib
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueBasePciLibPciExpress
+ EdkProtocolLib
+ PchPciExpressHelpersLib
+ EfiScriptLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT=_ModuleEntryPoint
+ DPX_SOURCE=PchPcieSmm.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=InitializePchPcieSmm
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_SMM_RUNTIME_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__
diff --git a/ReferenceCode/Chipset/LynxPoint/Pcie/Smm/PchPcieSmm.mak b/ReferenceCode/Chipset/LynxPoint/Pcie/Smm/PchPcieSmm.mak
new file mode 100644
index 0000000..a2d4181
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Pcie/Smm/PchPcieSmm.mak
@@ -0,0 +1,100 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchPcieSmm/PchPcieSmm.mak 2 2/24/12 2:14a Victortu $
+#
+# $Revision: 2 $
+#
+# $Date: 2/24/12 2:14a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchPcieSmm/PchPcieSmm.mak $
+#
+# 2 2/24/12 2:14a Victortu
+# Updated to support 4.6.5.3_IntelEDK_1117_Patch7_00.
+#
+# 1 2/08/12 8:57a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+
+#---------------------------------------------------------------------------
+# Create PchPcieSmm Driver
+#---------------------------------------------------------------------------
+EDK : PchPcieSmm
+PchPcieSmm : $(BUILD_DIR)\PchPcieSmm.mak PchPcieSmmBin
+
+
+$(BUILD_DIR)\PchPcieSmm.mak : $(PchPcieSmm_DIR)\$(@B).cif $(PchPcieSmm_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(PchPcieSmm_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+PchPcieSmm_INCLUDES=\
+ $(INTEL_PCH_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(EDK_INCLUDES)
+
+PchPcieSmm_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=InitializePchPcieSmm"\
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_SMM_RUNTIME_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+ /D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+
+PchPcieSmm_LIB_LINKS =\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(INTEL_PCH_PROTOCOL_LIB)\
+ $(PchPlatformSmmLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueSmmRuntimeDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(EDKPROTOCOLLIB)\
+ $(PchPciExpressHelpersDxeLib_LIB)\
+ $(EFISCRIPTLIB)\
+ $(EFIPROTOCOLLIB)\
+ $(EdkIIGlueUefiRuntimeServicesTableLib_LIB)\
+
+PchPcieSmmBin: $(PchPcieSmm_LIB_LINKS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\PchPcieSmm.mak all \
+ "MY_INCLUDES=$(PchPcieSmm_INCLUDES)" \
+ "MY_DEFINES=$(PchPcieSmm_DEFINES)" \
+ GUID=ACAEAA7A-C039-4424-88DA-F42212EA0E55\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=BS_DRIVER\
+ EDKIIModule=SMMDRIVER\
+ DEPEX1=$(PchPcieSmm_DIR)\PchPcieSmm.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX\
+ COMPRESS=1
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Pcie/Smm/PchPcieSmm.sdl b/ReferenceCode/Chipset/LynxPoint/Pcie/Smm/PchPcieSmm.sdl
new file mode 100644
index 0000000..1e1f223
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Pcie/Smm/PchPcieSmm.sdl
@@ -0,0 +1,69 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchPcieSmm/PchPcieSmm.sdl 1 2/08/12 8:57a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 8:57a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchPcieSmm/PchPcieSmm.sdl $
+#
+# 1 2/08/12 8:57a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+TOKEN
+ Name = "PchPcieSmm_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable PchPcieSmm support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "PchPcieSmm_DIR"
+ Help = "PchPcieSmm file source directory"
+End
+
+MODULE
+ Help = "Includes PchPcieSmm.mak to Project"
+ File = "PchPcieSmm.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PchPcieSmm.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Ppi/IntelPchPpiLib.cif b/ReferenceCode/Chipset/LynxPoint/Ppi/IntelPchPpiLib.cif
new file mode 100644
index 0000000..3136c1b
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Ppi/IntelPchPpiLib.cif
@@ -0,0 +1,28 @@
+<component>
+ name = "IntelPchPpiLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\Ppi\"
+ RefName = "IntelPchPpiLib"
+[files]
+"IntelPchPpiLib.inf"
+"IntelPchPpiLib.sdl"
+"IntelPchPpiLib.mak"
+"Spi\Spi.h"
+"Spi\Spi.c"
+"PchInit\PchInit.h"
+"PchInit\PchInit.c"
+"PchPeiInitDone\PchPeiInitDone.c"
+"PchPeiInitDone\PchPeiInitDone.h"
+"PchUsbPolicy\PchUsbPolicy.c"
+"PchUsbPolicy\PchUsbPolicy.h"
+"PchDmiTcVcMap\PchDmiTcVcMap.c"
+"PchDmiTcVcMap\PchDmiTcVcMap.h"
+"PchPlatformPolicy\PchPlatformPolicy.c"
+"PchPlatformPolicy\PchPlatformPolicy.h"
+"Wdt\Wdt.h"
+"Wdt\Wdt.c"
+"PchReset\PchReset.h"
+"PchReset\PchReset.c"
+"SmmControl\SmmControl.c"
+"SmmControl\SmmControl.h"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/Ppi/IntelPchPpiLib.inf b/ReferenceCode/Chipset/LynxPoint/Ppi/IntelPchPpiLib.inf
new file mode 100644
index 0000000..166d089
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Ppi/IntelPchPpiLib.inf
@@ -0,0 +1,68 @@
+## @file
+# Component description file for the PCH Ppi library
+#
+#@copyright
+# Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = $(PROJECT_PCH_FAMILY)PpiLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ Spi/Spi.h
+ Spi/Spi.c
+ PchInit/PchInit.h
+ PchInit/PchInit.c
+ PchUsbPolicy/PchUsbPolicy.h
+ PchUsbPolicy/PchUsbPolicy.c
+ PchDmiTcVcMap/PchDmiTcVcMap.h
+ PchDmiTcVcMap/PchDmiTcVcMap.c
+ PchPlatformPolicy/PchPlatformPolicy.h
+ PchPlatformPolicy/PchPlatformPolicy.c
+ Wdt/Wdt.h
+ Wdt/Wdt.c
+ PchReset/PchReset.h
+ PchReset/PchReset.c
+ PchPeiInitDone/PchPeiInitDone.h
+ PchPeiInitDone/PchPeiInitDone.c
+ SmmControl/SmmControl.h
+ SmmControl/SmmControl.c
+
+[includes.common]
+ .
+ $(EDK_SOURCE)/Foundation/Library/Pei/Include
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Protocol/PchPlatformPolicy
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[nmake.common]
+C_STD_INCLUDE=
+
diff --git a/ReferenceCode/Chipset/LynxPoint/Ppi/IntelPchPpiLib.mak b/ReferenceCode/Chipset/LynxPoint/Ppi/IntelPchPpiLib.mak
new file mode 100644
index 0000000..bd1e833
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Ppi/IntelPchPpiLib.mak
@@ -0,0 +1,63 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/IntelPchPpiLib/IntelPchPpiLib.mak 1 2/08/12 8:58a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 8:58a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/IntelPchPpiLib/IntelPchPpiLib.mak $
+#
+# 1 2/08/12 8:58a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+
+# MAK file for the ModulePart:IntelPchPpiLib
+all : IntelPchPpiLib
+
+$(IntelPchPpiLib_LIB) : IntelPchPpiLib
+
+IntelPchPpiLib : $(BUILD_DIR)\IntelPchPpiLib.mak IntelPchPpiLibBin
+
+$(BUILD_DIR)\IntelPchPpiLib.mak : $(IntelPchPpiLib_DIR)\$(@B).cif $(IntelPchPpiLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(IntelPchPpiLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+IntelPchPpiLib_INCLUDES =\
+ $(EDK_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+
+IntelPchPpiLibBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\IntelPchPpiLib.mak all\
+ "MY_INCLUDES=$(IntelPchPpiLib_INCLUDES)" \
+ TYPE=PEI_LIBRARY LIBRARIES= \
+ LIBRARY_NAME=$(IntelPchPpiLib_LIB)
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Ppi/IntelPchPpiLib.sdl b/ReferenceCode/Chipset/LynxPoint/Ppi/IntelPchPpiLib.sdl
new file mode 100644
index 0000000..776a8cb
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Ppi/IntelPchPpiLib.sdl
@@ -0,0 +1,72 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/IntelPchPpiLib/IntelPchPpiLib.sdl 1 2/08/12 8:58a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 8:58a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/IntelPchPpiLib/IntelPchPpiLib.sdl $
+#
+# 1 2/08/12 8:58a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+TOKEN
+ Name = "IntelPchPpiLib_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable IntelPchPpiLib support in Project"
+End
+
+PATH
+ Name = "IntelPchPpiLib_DIR"
+ Help = "IntelPchPpiLib file source directory"
+End
+
+MODULE
+ File = "IntelPchPpiLib.mak"
+ Help = "Includes IntelPchPpiLib.mak to Project"
+End
+
+ELINK
+ Name = "IntelPchPpiLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\IntelPchPpiLib.lib"
+ Parent = "IntelPchPpiLib_LIB"
+ InvokeOrder = AfterParent
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Ppi/PchDmiTcVcMap/PchDmiTcVcMap.c b/ReferenceCode/Chipset/LynxPoint/Ppi/PchDmiTcVcMap/PchDmiTcVcMap.c
new file mode 100644
index 0000000..f11b338
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Ppi/PchDmiTcVcMap/PchDmiTcVcMap.c
@@ -0,0 +1,43 @@
+/** @file
+ This file defines the DMI TC/VC mapping policy
+
+@copyright
+ Copyright (c) 2009 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+//
+// Statements that include other files
+//
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#endif
+//
+// Include the PPI header file
+//
+#include "PchDmiTcVcMap.h"
+
+//
+// PPI GUID definition
+//
+EFI_GUID gPchDmiTcVcMapPpiGuid = PCH_DMI_TC_VC_PPI_GUID;
+
+//
+// PPI description
+//
+EFI_GUID_STRING(&gPchDmiTcVcMapPpiGuid, "PCH DMI TC VC Map PPI", "PCH DMI TC VC Mapping PPI"); \ No newline at end of file
diff --git a/ReferenceCode/Chipset/LynxPoint/Ppi/PchDmiTcVcMap/PchDmiTcVcMap.h b/ReferenceCode/Chipset/LynxPoint/Ppi/PchDmiTcVcMap/PchDmiTcVcMap.h
new file mode 100644
index 0000000..7a2e555
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Ppi/PchDmiTcVcMap/PchDmiTcVcMap.h
@@ -0,0 +1,80 @@
+/** @file
+ This file defines the PCH DMI TC/VC mapping PPI
+
+@copyright
+ Copyright (c) 2009 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _PCH_DMI_TC_VC_MAP_H_
+#define _PCH_DMI_TC_VC_MAP_H_
+
+///
+/// Define the PCH DMI TC VC Mapping PPI GUID
+///
+///
+/// EDK and EDKII have different GUID formats
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#define PCH_DMI_TC_VC_PPI_GUID \
+ { \
+ 0xed097352, 0x9041, 0x445a, 0x80, 0xb6, 0xb2, 0x9d, 0x50, 0x9e, 0x88, 0x45 \
+ }
+#else
+#define PCH_DMI_TC_VC_PPI_GUID \
+ { \
+ 0xed097352, 0x9041, 0x445a, \
+ { \
+ 0x80, 0xb6, 0xb2, 0x9d, 0x50, 0x9e, 0x88, 0x45 \
+ } \
+ }
+#endif
+//
+// Extern the GUID for PPI users.
+//
+extern EFI_GUID gPchDmiTcVcMapPpiGuid;
+
+//
+// Forward reference for ANSI C compatibility
+//
+typedef struct _PCH_DMI_TC_VC_PPI PCH_DMI_TC_VC_PPI;
+
+typedef enum {
+ DmiVcTypeVc0,
+ DmiVcTypeVc1,
+ DmiVcTypeVcp,
+ DmiVcTypeVcm,
+ DmiVcTypeMax
+} PCH_DMI_VC_TYPE;
+
+typedef struct {
+ PCH_DMI_VC_TYPE Vc; ///< The Virtual Channel to which the TC is mapped
+} PCH_DMI_TC_CONFIG;
+
+typedef struct {
+ BOOLEAN Enable; ///< 0: Disable; 1: Enable
+ UINT8 VcId; ///< Vc ID Encoding for the Virtual Channel
+} PCH_DMI_VC_CONFIG;
+
+#define DmiTcTypeMax 8
+
+///
+/// PCH_DMI_TC_VC_PPI Structure Definition
+/// Note: The default DMI TC/VC mapping will be used if it's not initialized
+///
+struct _PCH_DMI_TC_VC_PPI {
+ PCH_DMI_TC_CONFIG DmiTc[DmiTcTypeMax]; ///< Configures PCH DMI Traffic class mapping.
+ PCH_DMI_VC_CONFIG DmiVc[DmiVcTypeMax]; ///< Configures PCH DMI Virtual Channel setting.
+};
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Ppi/PchInit/PchInit.c b/ReferenceCode/Chipset/LynxPoint/Ppi/PchInit/PchInit.c
new file mode 100644
index 0000000..bb31fa3
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Ppi/PchInit/PchInit.c
@@ -0,0 +1,43 @@
+/** @file
+ This file defines the PCH Init PPI
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+//
+// Statements that include other files
+//
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#endif
+//
+// Include the PPI header file
+//
+#include "PchInit.h"
+
+//
+// PPI GUID definition
+//
+EFI_GUID gPchInitPpiGuid = PCH_INIT_PPI_GUID;
+
+//
+// PPI description
+//
+EFI_GUID_STRING(&gPchInitPpiGuid, "PCH Init PPI", "PCH Initialization PPI");
diff --git a/ReferenceCode/Chipset/LynxPoint/Ppi/PchInit/PchInit.h b/ReferenceCode/Chipset/LynxPoint/Ppi/PchInit/PchInit.h
new file mode 100644
index 0000000..9021a28
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Ppi/PchInit/PchInit.h
@@ -0,0 +1,153 @@
+/** @file
+ This file defines the PCH Init PPI
+
+@copyright
+ Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _PCH_INIT_H_
+#define _PCH_INIT_H_
+
+///
+/// Define the PCH Init PPI GUID
+///
+///
+/// EDK and EDKII have different GUID formats
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#define PCH_INIT_PPI_GUID \
+ { \
+ 0x908c7f8b, 0x5c48, 0x47fb, 0x83, 0x57, 0xf5, 0xfd, 0x4e, 0x23, 0x52, 0x76 \
+ }
+#else
+#define PCH_INIT_PPI_GUID \
+ { \
+ 0x908c7f8b, 0x5c48, 0x47fb, \
+ { \
+ 0x83, 0x57, 0xf5, 0xfd, 0x4e, 0x23, 0x52, 0x76 \
+ } \
+ }
+#endif
+//
+// Extern the GUID for PPI users.
+//
+extern EFI_GUID gPchInitPpiGuid;
+
+//
+// Forward reference for ANSI C compatibility
+//
+typedef struct _PCH_INIT_PPI PCH_INIT_PPI;
+
+//
+// Data structure definitions
+//
+typedef enum _CPU_STRAP_OPERATION
+{
+ GetCpuStrapSetData,
+ SetCpuStrapSetData,
+ LockCpuStrapSetData
+} CPU_STRAP_OPERATION;
+
+/**
+ The function performing USB init in PEI phase. This could be used by USB recovery
+ or debug features that need USB initialization during PEI phase.
+ Note: Before executing this function, please be sure that PCH_INIT_PPI.Initialize
+ has been done and PchUsbPolicyPpi has been installed.
+
+ @param[in] PeiServices General purpose services available to every PEIM
+
+ @retval EFI_SUCCESS The function completed successfully
+ @retval Others All other error conditions encountered result in an ASSERT.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *PCH_USB_INIT) (
+ IN EFI_PEI_SERVICES **PeiServices
+ );
+
+/**
+ The function performing TC/VC mapping program, and poll all PCH Virtual Channel
+ until negotiation completion
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+
+ @retval EFI_SUCCESS The function completed successfully
+ @retval Others All other error conditions encountered result in an ASSERT.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *PCH_DMI_TCVC_PROGPOLL) (
+ IN EFI_PEI_SERVICES **PeiServices
+ );
+
+/**
+ The function set the Target Link Speed in PCH to DMI GEN 2.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+
+ @retval None
+**/
+typedef
+VOID
+(EFIAPI *PCH_DMI_GEN2_PROG) (
+ IN EFI_PEI_SERVICES **PeiServices
+ );
+
+/**
+ The function is used while doing CPU Only Reset, where PCH may be required
+ to initialize strap data before soft reset.
+
+ @param[in] PeiServices General purpose services available to every PEIM
+ @param[in] Operation Get/Set Cpu Strap Set Data
+ @param[in] CpuStrapSet Cpu Strap Set Data
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @exception EFI_UNSUPPORTED The function is not supported.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *PCH_CPU_STRAP_SET) (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN CPU_STRAP_OPERATION Operation,
+ IN OUT UINT16 *CpuStrapSet
+ );
+
+///
+/// PCH_INIT_PPI Structure Definition
+///
+struct _PCH_INIT_PPI {
+ ///
+ /// The function performs USB init in PEI phase. This could be used by USB recovery
+ /// or debug function that USB initialization needs to be done in PEI phase.
+ /// Note: Before executing this function, please be sure that PCH_PLATFORM_POLICY_PPI
+ /// and PCH_USB_POLICY_PPI have been installed.
+ ///
+ PCH_USB_INIT UsbInit;
+ ///
+ /// The function performing TC/VC mapping program, and poll all PCH Virtual Channel
+ /// until negotiation completion.
+ ///
+ PCH_DMI_TCVC_PROGPOLL DmiTcVcProgPoll;
+ ///
+ /// The function changes the PCH target link speed to DMI Gen 2
+ ///
+ PCH_DMI_GEN2_PROG DmiGen2Prog;
+ ///
+ /// The function provides a way to initialize PCH strap data before soft reset
+ /// while doing CPU Only Reset
+ ///
+ PCH_CPU_STRAP_SET CpuStrapSet;
+};
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Ppi/PchPeiInitDone/PchPeiInitDone.c b/ReferenceCode/Chipset/LynxPoint/Ppi/PchPeiInitDone/PchPeiInitDone.c
new file mode 100644
index 0000000..b754481
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Ppi/PchPeiInitDone/PchPeiInitDone.c
@@ -0,0 +1,47 @@
+/** @file
+ To indicate PCH code finish PCH controller initialization
+ upon policy configuration
+
+@copyright
+ Copyright (c) 2011 -2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+//
+// Include the ppi header file
+//
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+
+#include "EdkIIGluePeim.h"
+#endif
+
+#include EFI_PPI_DEFINITION (PchPeiInitDone)
+
+//
+// PPI GUID definition
+//
+EFI_GUID gPchPeiInitDonePpiGuid = PCH_PEI_INIT_DONE_PPI_GUID;
+
+//
+// PPI description
+//
+EFI_GUID_STRING
+ (
+ &gPchPeiInitDonePpiGuid, "Pch PEI Init Done Ppi",
+ "This is a dummy PPI to ensure PCH PEI Init Done PPI is updated before RC modules"
+ );
diff --git a/ReferenceCode/Chipset/LynxPoint/Ppi/PchPeiInitDone/PchPeiInitDone.h b/ReferenceCode/Chipset/LynxPoint/Ppi/PchPeiInitDone/PchPeiInitDone.h
new file mode 100644
index 0000000..ee764cb
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Ppi/PchPeiInitDone/PchPeiInitDone.h
@@ -0,0 +1,53 @@
+/** @file
+ PCH Init Done PPI
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+#ifndef _PCH_PEI_INIT_DONE_PPI_H_
+#define _PCH_PEI_INIT_DONE_PPI_H_
+
+///
+/// GUID for the PCH PEI Init Done PPI
+///
+///
+/// EDK and EDKII have different GUID formats
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#define PCH_PEI_INIT_DONE_PPI_GUID \
+ { \
+ 0x1edcbdf9, 0xffc6, 0x4bd4, 0x94, 0xf6, 0x19, 0x5d, 0x1d, 0xe1, 0x70, 0x56 \
+ }
+#else
+#define PCH_PEI_INIT_DONE_PPI_GUID \
+ { \
+ 0x1edcbdf9, 0xffc6, 0x4bd4, \
+ { \
+ 0x94, 0xf6, 0x19, 0x5d, 0x1d, 0xe1, 0x70, 0x56 \
+ } \
+ }
+#endif
+//
+// Extern the GUID for PPI users.
+//
+extern EFI_GUID gPchPeiInitDonePpiGuid;
+
+//
+// Forward reference for ANSI C compatibility
+//
+typedef struct _PCH_PEI_INIT_DONE_PPI PCH_PEI_INIT_DONE_PPI;
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Ppi/PchPlatformPolicy/PchPlatformPolicy.c b/ReferenceCode/Chipset/LynxPoint/Ppi/PchPlatformPolicy/PchPlatformPolicy.c
new file mode 100644
index 0000000..206a26a
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Ppi/PchPlatformPolicy/PchPlatformPolicy.c
@@ -0,0 +1,43 @@
+/** @file
+ PCH policy PPI produced by a platform driver specifying various
+ expected PCH settings. This PPI is consumed by the PCH PEI modules.
+
+@copyright
+ Copyright (c) 2009 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+//
+// Statements that include other files
+//
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+
+#include "EdkIIGluePeim.h"
+#endif
+
+#include "PchPlatformPolicy.h"
+
+//
+// PPI GUID definition
+//
+EFI_GUID gPchPlatformPolicyPpiGuid = PCH_PLATFORM_POLICY_PPI_GUID;
+
+//
+// PPI description
+//
+EFI_GUID_STRING(&gPchPlatformPolicyPpiGuid, "PchPlatformPolicy PPI", "Intel(R) DXE Phase PCH Platform Policy PPI"); \ No newline at end of file
diff --git a/ReferenceCode/Chipset/LynxPoint/Ppi/PchPlatformPolicy/PchPlatformPolicy.h b/ReferenceCode/Chipset/LynxPoint/Ppi/PchPlatformPolicy/PchPlatformPolicy.h
new file mode 100644
index 0000000..fbf4694
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Ppi/PchPlatformPolicy/PchPlatformPolicy.h
@@ -0,0 +1,263 @@
+/** @file
+ PCH policy PPI produced by a platform driver specifying various
+ expected PCH settings. This PPI is consumed by the PCH PEI modules.
+
+@copyright
+ Copyright (c) 2009 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef PCH_PLATFORM_POLICY_H_
+#define PCH_PLATFORM_POLICY_H_
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "PchAccess.h"
+#include "PchUsbConfig.h"
+#endif
+///
+/// PCH policy provided by platform for PEI phase
+///
+///
+/// EDK and EDKII have different GUID formats
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#define PCH_PLATFORM_POLICY_PPI_GUID \
+ { \
+ 0x36f6ce3d, 0xb76e, 0x42c2, 0x9f, 0x96, 0x3e, 0x41, 0x84, 0xa3, 0x50, 0x66 \
+ }
+#else
+#define PCH_PLATFORM_POLICY_PPI_GUID \
+ { \
+ 0x36f6ce3d, 0xb76e, 0x42c2, \
+ { \
+ 0x9f, 0x96, 0x3e, 0x41, 0x84, 0xa3, 0x50, 0x66 \
+ } \
+ }
+#endif
+
+extern EFI_GUID gPchPlatformPolicyPpiGuid;
+
+//
+// Forward reference for ANSI C compatibility
+//
+typedef struct _PCH_PLATFORM_POLICY_PPI PCH_PLATFORM_POLICY_PPI;
+
+///
+/// PPI revision number
+/// Any backwards compatible changes to this PPI will result in an update in the revision number
+/// Major changes will require publication of a new PPI
+///
+/// Revision 1: Original version
+///
+#define PCH_PLATFORM_POLICY_PPI_REVISION_1 1
+///
+/// Revision 2: Add UsbConfig
+///
+#define PCH_PLATFORM_POLICY_PPI_REVISION_2 2
+///
+/// Revision 3: Add Port30Settings in PCH_USB_CONFIG
+///
+#define PCH_PLATFORM_POLICY_PPI_REVISION_3 3
+///
+/// Revision 4: Add Sata RxEq Settings in PCH_SATA_TRACE_CONFIG
+/// Deprecate PortLength and PortTopology in PCH_SATA_TRACE_CONFIG
+///
+#define PCH_PLATFORM_POLICY_PPI_REVISION_4 4
+//
+// Generic definitions for device enabling/disabling used by PCH code.
+//
+#define PCH_DEVICE_ENABLE 1
+#define PCH_DEVICE_DISABLE 0
+
+//
+// ---------------------------- Gbe Config -----------------------------
+//
+typedef struct {
+ ///
+ /// Determines if enable GBE
+ /// When EnableGbe is changed (from disabled to enabled or from enabled to disabled),
+ /// it needs to set LAN Disable regsiter, which might be locked by FDSWL register.
+ /// So it's recommendated to issue a global reset when changing the status for PCH Internal LAN.
+ ///
+ UINT8 EnableGbe : 1;
+ UINT8 Rsvdbits : 7;
+} PCH_GBE_CONFIG;
+
+//
+// ---------------------------- Thermal Config -----------------------------
+//
+typedef struct {
+ UINT8 PmsyncEnable : 1;
+ UINT8 C0TransmitEnable : 1;
+ UINT8 PinSelection : 1; ///< GpioC 0:GPIO37; 1:GPIO4, GpioD 0:GPIO5; 1:GPIO0
+ UINT8 Rsvdbits : 5;
+} TS_GPIO_PIN_SETTING;
+
+typedef enum {
+ TsGpioC = 0,
+ TsGpioD,
+ MaxTsGpioPin
+} PCH_PMSYNC_GPIO_X_SELECTION;
+
+typedef struct {
+ UINT8 Enable : 1;
+ UINT8 Rsvdbits : 7;
+ TS_GPIO_PIN_SETTING TsGpioPinSetting[MaxTsGpioPin];
+} PCH_MEMORY_THROTTLING;
+
+typedef struct {
+ PCH_MEMORY_THROTTLING *MemoryThrottling;
+} PCH_THERMAL_MANAGEMENT;
+
+//
+// ---------------------------- HPET Config -----------------------------
+//
+typedef struct {
+ BOOLEAN Enable; ///< Determines if enable HPET function
+ UINT32 Base; ///< The HPET base address
+} PCH_HPET_CONFIG;
+
+//
+// ---------------------------- Reserved Page Config -----------------------------
+//
+typedef enum {
+ PchReservedPageToLpc, ///< Port 80h cycles are sent to LPC.
+ PchReservedPageToPcie ///< Port 80h cycles are sent to PCIe.
+} PCH_RESERVED_PAGE_ROUTE;
+
+//
+// ---------------------------- SATA Config -----------------------------
+//
+typedef enum {
+ PchSataModeIde = 0,
+ PchSataModeAhci = 1,
+ PchSataModeRaid = 2,
+ PchSataModeLoopbackTest = 3,
+ PchSataModeMax
+} PCH_SATA_MODE;
+
+typedef enum {
+ PchDirectConnect,
+ PchCableUp
+} PCH_SATA_TOPOLOGY;
+
+///
+/// This policy configures SATA RX Equalization for each Gen Speed.
+/// When enabled, BIOS will configure SATA RXEQ according to RxEq setting, else BIOS will use default setting.
+/// For which RxEq value to use, please refer to PCH EDS for more details.
+///
+typedef struct {
+ UINT8 RxEq;
+ UINT8 Enable;
+}PCH_SATA_GENSPEED;
+
+///
+/// This policy provides the SATA RX Equalization policy for each Gen Speed per port.
+/// GenSpeed[0] configures GEN1 RxEq, GenSpeed[1] configures GEN2 RxEq, and GenSpeed[2] configures GEN3 RxEq.
+///
+typedef struct {
+ PCH_SATA_GENSPEED GenSpeed[3];
+} PCH_SATA_PORT_RXEQ;
+
+typedef struct {
+ UINT16 PortLength[2]; ///< @deprecate
+ UINT8 TestMode : 1; ///< 0: Disable; 1: Allow entrance to the PCH SATA test modes
+ UINT8 RsvdBits : 7;
+ PCH_SATA_TOPOLOGY PortTopology[2]; ///< @deprecate
+ PCH_SATA_PORT_RXEQ PortRxEq[6]; ///< Configure SATA RX Equalization according to platform design
+} PCH_SATA_TRACE_CONFIG;
+
+typedef struct {
+ PCH_SATA_MODE SataMode; ///< Determines the system will be configured to which SATA mode
+ PCH_SATA_TRACE_CONFIG *SataTraceConfig; ///< Decide SATA trace related configurations.
+} PCH_SATA_CONTROL;
+
+//
+// ---------------------------- PCI Express Config -----------------------------
+//
+typedef enum {
+ PchPcieAuto,
+ PchPcieGen1,
+ PchPcieGen2
+} PCH_PCIE_SPEED;
+
+typedef struct {
+ PCH_PCIE_SPEED PcieSpeed[LPTH_PCIE_MAX_ROOT_PORTS]; ///< Determines each PCIE Port speed capability. 0: Auto; 1: Gen1; 2: Gen2.
+} PCH_PCIE_CONFIG;
+
+//
+// ---------------------------- IO APIC Config -----------------------------
+//
+typedef struct {
+ UINT8 IoApicId; ///< This member determines IOAPIC ID.
+ UINT8 ApicRangeSelect; ///< Define address bits 19:12 for the IOxAPIC range
+ UINT8 IoApicEntry24_39 :1; ///< 0: Disable; 1: Enable IOAPIC Entry 24-39
+ UINT8 RsvdBits :7;
+} PCH_IOAPIC_CONFIG;
+
+//
+// ---------------------------- PCH Platform Data -----------------------------
+//
+typedef struct {
+ UINT8 EcPresent : 1; ///< Reports if EC is present or not.
+ UINT8 SmmBwp : 1; ///< 0: Clear SMM_BWP bit; 1: Set SMM_BWP bit.
+ ///< The BIOS must set the SMM_BWP bit while PFAT (Platform Firmware Armoring Technology)
+ ///< support is enabled.
+ UINT8 Rsvdbits : 6;
+ UINT32 TempMemBaseAddr; ///< Temporary Memory Base Address for PCI devices to be
+ ///< used to initialize MMIO registers. Minimum size is
+ ///< 32KB bytes
+} PCH_PLATFORM_DATA;
+
+//
+// ------------ General PCH Platform Policy PPI definition ------------
+//
+struct _PCH_PLATFORM_POLICY_PPI {
+ ///
+ /// This member specifies the revision of the PCH policy PPI. This field is used to
+ /// indicate backwards compatible changes to the protocol. Platform code that produces
+ /// this PPI must fill with the correct revision value for the PCH reference code
+ /// to correctly interpret the content of the PPI fields.
+ ///
+ UINT8 Revision;
+ UINT8 BusNumber; ///< Bus Number of the PCH device.
+ UINT32 Rcba; ///< Root Complex Base Address.
+ UINT16 PmBase; ///< Power management I/O base address.
+ UINT16 GpioBase; ///< General purpose I/O base address.
+ PCH_GBE_CONFIG *GbeConfig; ///< Enable/Disable Gbe function.
+ PCH_THERMAL_MANAGEMENT *ThermalMgmt; ///< Enable the thermal management and pass the GPIO usage.
+ PCH_HPET_CONFIG *HpetConfig; ///< Enable HPET function and the pass HPET base address.
+ PCH_RESERVED_PAGE_ROUTE Port80Route; ///< Control where the Port 80h cycles are sent, 0: LPC; 1: PCI.
+ ///
+ /// SATA configuration that decides which Mode the SATA controller should operate in
+ /// and describes SATA Port 0, 1 Trace length and decides whether PCH SATA TEST mode
+ /// is enabled.
+ ///
+ PCH_SATA_CONTROL *SataConfig;
+ ///
+ /// PCIE configuration describes each PCIE Port speed capability.
+ /// 0: Auto; 1: Gen1; 2:Gen2
+ ///
+ PCH_PCIE_CONFIG *PcieConfig;
+ PCH_IOAPIC_CONFIG *IoApicConfig; ///< Determines IO APIC ID and IO APIC Range.
+ PCH_PLATFORM_DATA *PlatformData; ///< Decides platform data, like EcPresent.
+ ///
+ /// This member decides the USB config and is a common structure for Protocols also.
+ ///
+ PCH_USB_CONFIG *UsbConfig;
+};
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Ppi/PchReset/PchReset.c b/ReferenceCode/Chipset/LynxPoint/Ppi/PchReset/PchReset.c
new file mode 100644
index 0000000..2eba7db
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Ppi/PchReset/PchReset.c
@@ -0,0 +1,42 @@
+/** @file
+ This file defines the PCH Reset PPI
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+//
+// Include the ppi header file
+//
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#endif
+#include "PchReset.h"
+
+//
+// PPI GUID definition
+//
+EFI_GUID gPchResetPpiGuid = PCH_RESET_PPI_GUID;
+EFI_GUID gPchResetCallbackPpiGuid = PCH_RESET_CALLBACK_PPI_GUID;
+
+//
+// PPI description
+//
+EFI_GUID_STRING(&gPchResetPpiGuid, "PCH RESET PPI", "Intel(R) PCH Reset PPI");
+EFI_GUID_STRING(&gPchResetCallbackPpiGuid, "PCH RESET CALLBACK PPI", "Intel(R) PCH Reset Callback PPI");
diff --git a/ReferenceCode/Chipset/LynxPoint/Ppi/PchReset/PchReset.h b/ReferenceCode/Chipset/LynxPoint/Ppi/PchReset/PchReset.h
new file mode 100644
index 0000000..8f2c9bd
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Ppi/PchReset/PchReset.h
@@ -0,0 +1,68 @@
+/** @file
+ PCH Reset PPI
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _PEI_PCH_RESET_H_
+#define _PEI_PCH_RESET_H_
+
+#include <Protocol/PchReset/PchReset.h>
+
+///
+/// GUID for the PCH Reset PPI
+///
+/// EDK and EDKII have different GUID formats
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#define PCH_RESET_PPI_GUID \
+ { \
+ 0x433e0f9f, 0x5ae, 0x410a, 0xa0, 0xc3, 0xbf, 0x29, 0x8e, 0xcb, 0x25, 0xac \
+ }
+
+#define PCH_RESET_CALLBACK_PPI_GUID \
+ { \
+ 0x17865dc0, 0xb8b, 0x4da8, 0x8b, 0x42, 0x7c, 0x46, 0xb8, 0x5c, 0xca, 0x4d \
+ }
+#else
+#define PCH_RESET_PPI_GUID \
+ { \
+ 0x433e0f9f, 0x5ae, 0x410a, \
+ { \
+ 0xa0, 0xc3, 0xbf, 0x29, 0x8e, 0xcb, 0x25, 0xac \
+ } \
+ }
+#define PCH_RESET_CALLBACK_PPI_GUID \
+ { \
+ 0x17865dc0, 0xb8b, 0x4da8, \
+ { \
+ 0x8b, 0x42, 0x7c, 0x46, 0xb8, 0x5c, 0xca, 0x4d \
+ } \
+ }
+#endif
+//
+// Extern the GUID for PPI users.
+//
+extern EFI_GUID gPchResetPpiGuid;
+extern EFI_GUID gPchResetCallbackPpiGuid;
+
+//
+// Forward reference for ANSI C compatibility
+//
+typedef PCH_RESET_PROTOCOL PCH_RESET_PPI;
+
+typedef PCH_RESET_CALLBACK_PROTOCOL PCH_RESET_CALLBACK_PPI;
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Ppi/PchUsbPolicy/PchUsbPolicy.c b/ReferenceCode/Chipset/LynxPoint/Ppi/PchUsbPolicy/PchUsbPolicy.c
new file mode 100644
index 0000000..b798bff
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Ppi/PchUsbPolicy/PchUsbPolicy.c
@@ -0,0 +1,45 @@
+/** @file
+ PCH Usb policy PPI produced by a platform driver specifying
+ various expected PCH Usb settings. This PPI is consumed by the
+ PCH PEI drivers.
+
+@copyright
+ Copyright (c) 2009 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+//
+// Statements that include other files
+//
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#endif
+//
+// Include the PPI header file
+//
+#include "PchUsbPolicy.h"
+
+//
+// PPI GUID definition
+//
+EFI_GUID gPchUsbPolicyPpiGuid = PCH_USB_POLICY_PPI_GUID;
+
+//
+// PPI description
+//
+EFI_GUID_STRING(&gPchUsbPolicyPpiGuid, "PchUsbPolicy PPI", "Intel(R) PCH USB Policy PPI");
diff --git a/ReferenceCode/Chipset/LynxPoint/Ppi/PchUsbPolicy/PchUsbPolicy.h b/ReferenceCode/Chipset/LynxPoint/Ppi/PchUsbPolicy/PchUsbPolicy.h
new file mode 100644
index 0000000..65e918f
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Ppi/PchUsbPolicy/PchUsbPolicy.h
@@ -0,0 +1,126 @@
+/** @file
+ PCH Usb policy PPI produced by a platform driver specifying
+ various expected PCH Usb settings. This PPI is consumed by the
+ PCH PEI drivers.
+
+@copyright
+ Copyright (c) 2009 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _PCH_USB_POLICY_H_
+#define _PCH_USB_POLICY_H_
+
+///
+/// PCH Usb policy provided by platform for PEI phase
+///
+///
+/// EDK and EDKII have different GUID formats
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "PchAccess.h"
+#include "PchPlatformPolicy.h"
+#endif
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#define PCH_USB_POLICY_PPI_GUID \
+ { \
+ 0x887acae1, 0x6a8c, 0x4eee, 0x97, 0xd, 0x91, 0x12, 0xda, 0x63, 0xbc, 0xf1 \
+ }
+#else
+#define PCH_USB_POLICY_PPI_GUID \
+ { \
+ 0x887acae1, 0x6a8c, 0x4eee, \
+ { \
+ 0x97, 0xd, 0x91, 0x12, 0xda, 0x63, 0xbc, 0xf1 \
+ } \
+ }
+#endif
+
+extern EFI_GUID gPchUsbPolicyPpiGuid;
+
+typedef struct _PCH_USB_POLICY_PPI PCH_USB_POLICY_PPI;
+
+///
+/// PPI revision number
+/// Any backwards compatible changes to this PPI will result in an update in the revision number
+/// Major changes will require publication of a new PPI
+///
+/// Revision 1: Original version
+///
+#define PCH_USB_POLICY_PPI_REVISION_1 1
+///
+/// Revision 2: Add ManualMode, ManualModeUsb20PerPinRoute and ManualModeUsb30PerPinEnable
+/// to PCH_USB30_CONTROLLER_SETTINGS
+/// Deprecated XhciStreams of PCH_USB30_CONTROLLER_SETTINGS
+///
+#define PCH_USB_POLICY_PPI_REVISION_2 2
+///
+/// Revision 3: Add UsbPrecondition in UsbConfig
+///
+#define PCH_USB_POLICY_PPI_REVISION_3 3
+///
+/// Revision 4: Add XhciIdleL1 to PCH_USB30_CONTROLLER_SETTINGS
+///
+#define PCH_USB_POLICY_PPI_REVISION_4 4
+
+//
+// Generic definitions for device enabling/disabling used by PCH code.
+//
+#define PCH_DEVICE_ENABLE 1
+#define PCH_DEVICE_DISABLE 0
+
+#define EHCI_MODE 1
+
+///
+/// PCH Usb policy PPI produced by a platform driver specifying various expected
+/// PCH Usb settings that would be used by PCH_INIT_PPI.UsbInit () and USB PEI module.
+/// This PPI needs to be installed before calling PCH_INIT_PPI.UsbInit ().
+///
+struct _PCH_USB_POLICY_PPI {
+ ///
+ /// This member specifies the revision of the PEI PCH USB Policy PPI.
+ /// This field is used to indicate backwards compatible changes to the protocol.
+ /// Platform code that produces this PPI must fill with the correct revision value
+ /// for the PCH reference code to correctly interpret the content of the PPI fields.
+ ///
+ UINT8 Revision;
+ ///
+ /// This member describes USB controller's related configuration.
+ ///
+ PCH_USB_CONFIG *UsbConfig;
+ ///
+ /// This member decides which USB controller needs to be initialed and allocated
+ /// resource in Pei Phase. It will be referred by USB PEI module.
+ /// For RMH enabled, please set this field to EHCI_MODE.
+ ///
+ UINT8 Mode;
+ ///
+ /// This member describes EHCI memory base address. USB PEI module will refer to
+ /// this field to program memory base address of each EHCI controllers.
+ ///
+ UINTN EhciMemBaseAddr;
+ ///
+ /// This member describes EHCI memory length. USB PEI module will check this field
+ /// to determine if the memory resource is less than the required. Each EHCI controller
+ /// requires 0x400 memory space.
+ ///
+ UINT32 EhciMemLength;
+ ///
+ /// This member describes XHCI memory base address. USB PEI module will refer to
+ /// this field to program memory base address of the XHCI controller.
+ ///
+ UINTN XhciMemBaseAddr;
+};
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Ppi/SmmControl/SmmControl.c b/ReferenceCode/Chipset/LynxPoint/Ppi/SmmControl/SmmControl.c
new file mode 100644
index 0000000..91c73b0
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Ppi/SmmControl/SmmControl.c
@@ -0,0 +1,26 @@
+/** @file
+ This code abstracts the PEI core to provide SmmControl services.
+
+@copyright
+ Copyright (c) 2002 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+#include "Tiano.h"
+#include "Pei.h"
+#include EFI_PPI_DEFINITION (SmmControl)
+
+EFI_GUID gPeiSmmControlPpiGuid = PEI_SMM_CONTROL_PPI_GUID;
+
+EFI_GUID_STRING(&gPeiSmmControlPpiGuid, "SmmControl", "SMM Control PPI");
diff --git a/ReferenceCode/Chipset/LynxPoint/Ppi/SmmControl/SmmControl.h b/ReferenceCode/Chipset/LynxPoint/Ppi/SmmControl/SmmControl.h
new file mode 100644
index 0000000..659aa63
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Ppi/SmmControl/SmmControl.h
@@ -0,0 +1,72 @@
+/** @file
+ This code abstracts the PEI core to provide SmmControl services.
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+#ifndef _PEI_SMM_CONTROL_PPI_H_
+#define _PEI_SMM_CONTROL_PPI_H_
+
+///
+/// Define the SPI PPI GUID
+///
+///
+/// EDK and EDKII have different GUID formats
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#define PEI_SMM_CONTROL_PPI_GUID \
+ { \
+ 0x61c68702, 0x4d7e, 0x4f43, 0x8d, 0xef, 0xa7, 0x43, 0x5, 0xce, 0x74, 0xc5 \
+ }
+#else
+#define PEI_SMM_CONTROL_PPI_GUID \
+ { \
+ 0x61c68702, 0x4d7e, 0x4f43, \
+ { \
+ 0x8d, 0xef, 0xa7, 0x43, 0x5, 0xce, 0x74, 0xc5 \
+ } \
+ }
+#endif
+
+EFI_FORWARD_DECLARATION (PEI_SMM_CONTROL_PPI);
+
+typedef
+EFI_STATUS
+(EFIAPI *PEI_SMM_ACTIVATE) (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_SMM_CONTROL_PPI * This,
+ IN OUT INT8 *ArgumentBuffer OPTIONAL,
+ IN OUT UINTN *ArgumentBufferSize OPTIONAL,
+ IN BOOLEAN Periodic OPTIONAL,
+ IN UINTN ActivationInterval OPTIONAL
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *PEI_SMM_DEACTIVATE) (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_SMM_CONTROL_PPI * This,
+ IN BOOLEAN Periodic OPTIONAL
+ );
+
+typedef struct _PEI_SMM_CONTROL_PPI {
+ PEI_SMM_ACTIVATE Trigger;
+ PEI_SMM_DEACTIVATE Clear;
+} PEI_SMM_CONTROL_PPI;
+
+extern EFI_GUID gPeiSmmControlPpiGuid;
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Ppi/Spi/Spi.c b/ReferenceCode/Chipset/LynxPoint/Ppi/Spi/Spi.c
new file mode 100644
index 0000000..5e58bed
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Ppi/Spi/Spi.c
@@ -0,0 +1,44 @@
+/** @file
+ This file defines the EFI SPI PPI which implements the
+ Intel(R) SPI Host Controller Compatibility Interface.
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+//
+// Statements that include other files
+//
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#endif
+//
+// Include the PPI header file
+//
+#include "Spi.h"
+
+//
+// PPI GUID definition
+//
+EFI_GUID gPeiSpiPpiGuid = PEI_SPI_PPI_GUID;
+
+//
+// PPI description
+//
+EFI_GUID_STRING(&gPeiSpiPpiGuid, "SPI PPI", "Intel(R) Serial Peripheral Interface PPI");
diff --git a/ReferenceCode/Chipset/LynxPoint/Ppi/Spi/Spi.h b/ReferenceCode/Chipset/LynxPoint/Ppi/Spi/Spi.h
new file mode 100644
index 0000000..85fef0a
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Ppi/Spi/Spi.h
@@ -0,0 +1,57 @@
+/** @file
+ This file defines the EFI SPI PPI which implements the
+ Intel(R) PCH SPI Host Controller Compatibility Interface.
+
+@copyright
+ Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _PEI_SPI_H_
+#define _PEI_SPI_H_
+
+#include <Protocol/Spi/Spi.h>
+
+///
+/// Define the SPI PPI GUID
+///
+///
+/// EDK and EDKII have different GUID formats
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#define PEI_SPI_PPI_GUID \
+ { \
+ 0xfbf26154, 0x4e55, 0x4bdc, 0xaf, 0x7b, 0xd9, 0x18, 0xac, 0x44, 0x3f, 0x61 \
+ }
+#else
+#define PEI_SPI_PPI_GUID \
+ { \
+ 0xfbf26154, 0x4e55, 0x4bdc, \
+ { \
+ 0xaf, 0x7b, 0xd9, 0x18, 0xac, 0x44, 0x3f, 0x61 \
+ } \
+ }
+#endif
+//
+// Extern the GUID for PPI users.
+//
+extern EFI_GUID gPeiSpiPpiGuid;
+
+///
+/// Reuse the EFI_SPI_PROTOCOL definitions
+/// This is possible becaues the PPI implementation does not rely on a PeiService pointer,
+/// as it uses EDKII Glue Lib to do IO accesses
+///
+typedef EFI_SPI_PROTOCOL PEI_SPI_PPI;
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Ppi/Wdt/Wdt.c b/ReferenceCode/Chipset/LynxPoint/Ppi/Wdt/Wdt.c
new file mode 100644
index 0000000..1e7827c
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Ppi/Wdt/Wdt.c
@@ -0,0 +1,32 @@
+/** @file
+ Watchdog Timer PPI
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#endif
+#include "Wdt.h"
+
+//
+// PPI GUID definition
+//
+EFI_GUID gWdtPpiGuid = WDT_PPI_GUID;
+
+//
+// PPI description
+//
+EFI_GUID_STRING(&gWdtPpiGuid, "WDT PPI", "Watchdog Timer PPI");
diff --git a/ReferenceCode/Chipset/LynxPoint/Ppi/Wdt/Wdt.h b/ReferenceCode/Chipset/LynxPoint/Ppi/Wdt/Wdt.h
new file mode 100644
index 0000000..8246fad
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Ppi/Wdt/Wdt.h
@@ -0,0 +1,53 @@
+/** @file
+ Watchdog Timer PPI
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _PEI_WDT_H_
+#define _PEI_WDT_H_
+
+#include <Protocol/Wdt/Wdt.h>
+///
+/// GUID for the WDT PPI
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#define WDT_PPI_GUID \
+ { \
+ 0xF38D1338, 0xAF7A, 0x4FB6, 0x91, 0xDB, 0x1A, 0x9C, 0x21, 0x83, 0x57, 0x0D \
+ }
+
+#else
+
+#define WDT_PPI_GUID \
+ { \
+ 0xF38D1338, 0xAF7A, 0x4FB6, \
+ { \
+ 0x91, 0xDB, 0x1A, 0x9C, 0x21, 0x83, 0x57, 0x0D \
+ } \
+ }
+
+#endif
+//
+// Extern the GUID for PPI users.
+//
+extern EFI_GUID gWdtPpiGuid;
+
+///
+/// Reuse WDT_PROTOCOL definition
+///
+typedef WDT_PROTOCOL WDT_PPI;
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Protocol/ActiveBios/ActiveBios.c b/ReferenceCode/Chipset/LynxPoint/Protocol/ActiveBios/ActiveBios.c
new file mode 100644
index 0000000..6a23962
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Protocol/ActiveBios/ActiveBios.c
@@ -0,0 +1,47 @@
+/** @file
+ This protocol is used to report and control what BIOS is mapped to the
+ BIOS address space anchored at 4GB boundary.
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+//
+// Statements that include other files
+//
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+
+#include "EdkIIGlueDxe.h"
+#endif
+
+#include "ActiveBios.h"
+
+//
+// Protocol GUID definition
+//
+EFI_GUID gEfiActiveBiosProtocolGuid = EFI_ACTIVE_BIOS_PROTOCOL_GUID;
+
+//
+// Protocol description
+//
+EFI_GUID_STRING
+ (
+ &gEfiActiveBiosProtocolGuid, "Active BIOS Protocol",
+ "The active BIOS protocol provides services related to where BIOS address space is directed in hardware."
+ );
diff --git a/ReferenceCode/Chipset/LynxPoint/Protocol/ActiveBios/ActiveBios.h b/ReferenceCode/Chipset/LynxPoint/Protocol/ActiveBios/ActiveBios.h
new file mode 100644
index 0000000..744be68
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Protocol/ActiveBios/ActiveBios.h
@@ -0,0 +1,136 @@
+/** @file
+ This protocol is used to report and control what BIOS is mapped to the
+ BIOS address space anchored at 4GB boundary.
+
+ This protocol is EFI compatible.
+
+ E.G. For current generation ICH, the 4GB-16MB to 4GB range can be mapped
+ to PCI, SPI, or FWH.
+
+@copyright
+ Copyright (c) 2005 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _EFI_ACTIVE_BIOS_PROTOCOL_H_
+#define _EFI_ACTIVE_BIOS_PROTOCOL_H_
+
+///
+/// Define the protocol GUID
+///
+/// EDK and EDKII have different GUID formats
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#define EFI_ACTIVE_BIOS_PROTOCOL_GUID \
+ { \
+ 0xebbe2d1b, 0x1647, 0x4bda, 0xab, 0x9a, 0x78, 0x63, 0xe3, 0x96, 0xd4, 0x1a \
+ }
+#else
+#define EFI_ACTIVE_BIOS_PROTOCOL_GUID \
+ { \
+ 0xebbe2d1b, 0x1647, 0x4bda, \
+ { \
+ 0xab, 0x9a, 0x78, 0x63, 0xe3, 0x96, 0xd4, 0x1a \
+ } \
+ }
+#endif
+//
+// Extern the GUID for protocol users.
+//
+extern EFI_GUID gEfiActiveBiosProtocolGuid;
+
+//
+// Forward reference for ANSI C compatibility
+//
+typedef struct _EFI_ACTIVE_BIOS_PROTOCOL EFI_ACTIVE_BIOS_PROTOCOL;
+
+///
+/// Protocol definitions
+///
+typedef enum {
+ ActiveBiosStateSpi,
+ ActiveBiosStateLpc,
+ ActiveBiosStateMax
+} EFI_ACTIVE_BIOS_STATE;
+
+/**
+ Change the current active BIOS settings to the requested state.
+ The caller is responsible for requesting a supported state from
+ the EFI_ACTIVE_BIOS_STATE selections.
+ This will fail if someone has locked the interface and the correct key is
+ not provided.
+
+ @param[in] This Pointer to the EFI_ACTIVE_BIOS_PROTOCOL instance.
+ @param[in] DesiredState The requested state to configure the system for.
+ @param[in] Key If the interface is locked, Key must be the Key
+ returned from the LockState function call.
+
+ @retval EFI_SUCCESS The function completed successfully
+ @retval EFI_ACCESS_DENIED The interface is currently locked.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_ACTIVE_BIOS_SET_ACTIVE_BIOS_STATE) (
+ IN EFI_ACTIVE_BIOS_PROTOCOL * This,
+ IN EFI_ACTIVE_BIOS_STATE DesiredState,
+ IN UINTN Key
+ );
+
+/**
+ Lock the current active BIOS state from further changes. This allows a
+ caller to implement a critical section. This is optionally supported
+ functionality. Size conscious implementations may choose to require
+ callers cooperate without support from this protocol.
+
+ @param[in] This Pointer to the EFI_ACTIVE_BIOS_PROTOCOL instance.
+ @param[in] Lock TRUE to lock the current state, FALSE to unlock.
+ @param[in, out] Key If Lock is TRUE, then a key will be returned. If
+ Lock is FALSE, the key returned from the prior call
+ to lock the protocol must be provided to unlock the
+ protocol. The value of Key is undefined except that
+ it cannot be 0.
+
+ @retval EFI_SUCCESS Command succeed.
+ @exception EFI_UNSUPPORTED The function is not supported.
+ @retval EFI_ACCESS_DENIED The interface is currently locked.
+ @retval EFI_DEVICE_ERROR Device error, command aborts abnormally.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_ACTIVE_BIOS_LOCK_ACTIVE_BIOS_STATE) (
+ IN EFI_ACTIVE_BIOS_PROTOCOL * This,
+ IN BOOLEAN Lock,
+ IN OUT UINTN *Key
+ );
+
+///
+/// Protocol definition
+///
+/// Note that some functions are optional. This means that they may be NULL.
+/// Caller is required to verify that an optional function is defined by checking
+/// that the value is not NULL.
+///
+/// This protocol allows the PCH to be configured to map the top 16 MB of memory
+/// below 4 GB to different buses, LPC, SPI, or PCI. The State reflects the current
+/// setting. SetState() allows consumers to request a new state, and LockState()
+/// allows consumers to prevent other consumers from changing the state. It is the
+/// caller's responsibility to configure and lock the desired state to prevent issues
+/// resulting from other consumers changing the state.
+///
+struct _EFI_ACTIVE_BIOS_PROTOCOL {
+ EFI_ACTIVE_BIOS_STATE State; ///< The current state mapping that is selected.
+ EFI_ACTIVE_BIOS_SET_ACTIVE_BIOS_STATE SetState; ///< Change the current state to the requested state mapping.
+ EFI_ACTIVE_BIOS_LOCK_ACTIVE_BIOS_STATE LockState; ///< Lock the current state mapping to prevent changes to the current state.
+};
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Protocol/IntelPchProtocolLib.cif b/ReferenceCode/Chipset/LynxPoint/Protocol/IntelPchProtocolLib.cif
new file mode 100644
index 0000000..edc8183
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Protocol/IntelPchProtocolLib.cif
@@ -0,0 +1,33 @@
+<component>
+ name = "IntelPchProtocolLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\Protocol\"
+ RefName = "IntelPchProtocolLib"
+[files]
+"IntelPchProtocolLib.sdl"
+"IntelPchProtocolLib.mak"
+"ActiveBios\ActiveBios.h"
+"ActiveBios\ActiveBios.c"
+"PchPlatformPolicy\PchPlatformPolicy.h"
+"PchPlatformPolicy\PchPlatformPolicy.c"
+"Spi\Spi.h"
+"Spi\Spi.c"
+"SerialGpio\SerialGpio.h"
+"SerialGpio\SerialGpio.c"
+"SmmIoTrapDispatch\SmmIoTrapDispatch.h"
+"SmmIoTrapDispatch\SmmIoTrapDispatch.c"
+"PchInfo\PchInfo.h"
+"PchInfo\PchInfo.c"
+"PchInfo\UsbHcPortPrecondition.h"
+"PchReset\PchReset.h"
+"PchReset\PchReset.c"
+"PchS3Support\PchS3Support.h"
+"PchS3Support\PchS3Support.c"
+"SmmIchnDispatchEx\SmmIchnDispatchEx.h"
+"SmmIchnDispatchEx\SmmIchnDispatchEx.c"
+"IntelPchProtocolLib.inf"
+"Wdt\Wdt.h"
+"Wdt\Wdt.c"
+"PchSmmIoTrapControl\PchSmmIoTrapControl.c"
+"PchSmmIoTrapControl\PchSmmIoTrapControl.h"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/Protocol/IntelPchProtocolLib.inf b/ReferenceCode/Chipset/LynxPoint/Protocol/IntelPchProtocolLib.inf
new file mode 100644
index 0000000..ebda5f7
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Protocol/IntelPchProtocolLib.inf
@@ -0,0 +1,70 @@
+## @file
+# Component description file for the PCH protocol library
+#
+#@copyright
+# Copyright (c) 2004 - 2013 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = $(PROJECT_PCH_FAMILY)ProtocolLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ ActiveBios/ActiveBios.h
+ ActiveBios/ActiveBios.c
+ PchPlatformPolicy/PchPlatformPolicy.h
+ PchPlatformPolicy/PchPlatformPolicy.c
+ Spi/Spi.h
+ Spi/Spi.c
+ SerialGpio/SerialGpio.h
+ SerialGpio/SerialGpio.c
+ SmmIoTrapDispatch/SmmIoTrapDispatch.h
+ SmmIoTrapDispatch/SmmIoTrapDispatch.c
+ PchSmmIoTrapControl/PchSmmIoTrapControl.h
+ PchSmmIoTrapControl/PchSmmIoTrapControl.c
+ PchInfo/PchInfo.h
+ PchInfo/PchInfo.c
+ PchReset/PchReset.h
+ PchReset/PchReset.c
+ PchS3Support/PchS3Support.h
+ PchS3Support/PchS3Support.c
+ SmmIchnDispatchEx/SmmIchnDispatchEx.h
+ SmmIchnDispatchEx/SmmIchnDispatchEx.c
+ Wdt/Wdt.h
+ Wdt/Wdt.c
+[includes.common]
+ .
+ $(EDK_SOURCE)/Foundation/Library/Pei/Include
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[nmake.common]
+C_STD_INCLUDE=
+
diff --git a/ReferenceCode/Chipset/LynxPoint/Protocol/IntelPchProtocolLib.mak b/ReferenceCode/Chipset/LynxPoint/Protocol/IntelPchProtocolLib.mak
new file mode 100644
index 0000000..1f328b5
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Protocol/IntelPchProtocolLib.mak
@@ -0,0 +1,62 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/IntelPchProtocolLib/IntelPchProtocolLib.mak 1 2/08/12 9:01a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 9:01a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/IntelPchProtocolLib/IntelPchProtocolLib.mak $
+#
+# 1 2/08/12 9:01a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+
+# MAK file for the ModulePart:IntelPchProtocolLib
+EDK : IntelPchProtocolLib
+
+$(INTEL_PCH_PROTOCOL_LIB) : IntelPchProtocolLib
+
+IntelPchProtocolLib : $(BUILD_DIR)\IntelPchProtocolLib.mak IntelPchProtocolLibBin
+
+$(BUILD_DIR)\IntelPchProtocolLib.mak : $(INTEL_PCH_PROTOCOL_LIB_DIR)\$(@B).cif $(INTEL_PCH_PROTOCOL_LIB_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(INTEL_PCH_PROTOCOL_LIB_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+IntelPchProtocolLib_INCLUDES =\
+ $(EDK_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+
+IntelPchProtocolLibBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\IntelPchProtocolLib.mak all\
+ "MY_INCLUDES=$(IntelPchProtocolLib_INCLUDES)" \
+ TYPE=LIBRARY LIBRARIES=
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Protocol/IntelPchProtocolLib.sdl b/ReferenceCode/Chipset/LynxPoint/Protocol/IntelPchProtocolLib.sdl
new file mode 100644
index 0000000..0d0b35d
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Protocol/IntelPchProtocolLib.sdl
@@ -0,0 +1,71 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/IntelPchProtocolLib/IntelPchProtocolLib.sdl 1 2/08/12 9:01a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 9:01a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/IntelPchProtocolLib/IntelPchProtocolLib.sdl $
+#
+# 1 2/08/12 9:01a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+TOKEN
+ Name = "IntelPchProtocolLib_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable IntelPchProtocolLib support in Project"
+End
+
+PATH
+ Name = "INTEL_PCH_PROTOCOL_LIB_DIR"
+End
+
+MODULE
+ File = "IntelPchProtocolLib.mak"
+ Help = "Includes IntelPchProtocolLib.mak to Project"
+End
+
+ELINK
+ Name = "INTEL_PCH_PROTOCOL_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\IntelPchProtocolLib.lib"
+ Parent = "INTEL_PCH_PROTOCOL_LIB"
+ InvokeOrder = AfterParent
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Protocol/PchInfo/PchInfo.c b/ReferenceCode/Chipset/LynxPoint/Protocol/PchInfo/PchInfo.c
new file mode 100644
index 0000000..24f5b2e
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Protocol/PchInfo/PchInfo.c
@@ -0,0 +1,41 @@
+/** @file
+ This file defines the Pch Info Protocol.
+
+@copyright
+ Copyright (c) 2008 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+//
+// Statements that include other files
+//
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#endif
+
+#include "PchInfo.h"
+
+//
+// Protocol GUID definition
+//
+EFI_GUID gEfiPchInfoProtocolGuid = EFI_PCH_INFO_PROTOCOL_GUID;
+
+//
+// Protocol description
+//
+EFI_GUID_STRING(&gEfiPchInfoProtocolGuid, "PCH Info Protocol", "PCH Information Protocol");
diff --git a/ReferenceCode/Chipset/LynxPoint/Protocol/PchInfo/PchInfo.h b/ReferenceCode/Chipset/LynxPoint/Protocol/PchInfo/PchInfo.h
new file mode 100644
index 0000000..d03867a
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Protocol/PchInfo/PchInfo.h
@@ -0,0 +1,121 @@
+/** @file
+ This file defines the PCH Info Protocol.
+
+@copyright
+ Copyright (c) 2008 - 2015 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _PCH_INFO_H_
+#define _PCH_INFO_H_
+
+///
+/// Define PCH INFO protocol GUID
+///
+/// EDK and EDKII have different GUID formats
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "UsbHcPortPrecondition.h"
+#define EFI_PCH_INFO_PROTOCOL_GUID \
+ { \
+ 0x984eb4e9, 0x5a95, 0x41de, 0xaa, 0xd0, 0x53, 0x66, 0x8c, 0xa5, 0x13, 0xc0 \
+ }
+
+#else
+#define EFI_PCH_INFO_PROTOCOL_GUID \
+ { \
+ 0x984eb4e9, 0x5a95, 0x41de, \
+ { \
+ 0xaa, 0xd0, 0x53, 0x66, 0x8c, 0xa5, 0x13, 0xc0 \
+ } \
+ }
+#endif
+//
+// Extern the GUID for protocol users.
+//
+extern EFI_GUID gEfiPchInfoProtocolGuid;
+
+//
+// Forward reference for ANSI C compatibility
+//
+typedef struct _EFI_PCH_INFO_PROTOCOL EFI_PCH_INFO_PROTOCOL;
+
+///
+/// Protocol revision number
+/// Any backwards compatible changes to this protocol will result in an update in the revision number
+/// Major changes will require publication of a new protocol
+///
+/// Revision 1: Original version
+///
+#define PCH_INFO_PROTOCOL_REVISION_1 1
+///
+/// Revision 2: Add Preconditioned for Usb precondition support.
+///
+#define PCH_INFO_PROTOCOL_REVISION_2 2
+
+///
+/// RCVersion[7:0] is the release number.
+/// For example:
+/// LptFramework 0.6.0-01 should be 00 06 00 01 (0x00060001)
+/// LptFramework 0.6.2 should be 00 06 02 00 (0x00060200)
+/// LptFramework 0.7.0 should be 00 07 00 00 (0x00070000)
+/// LptFramework 0.7.1 should be 00 07 01 00 (0x00070100)
+/// LptFramework 0.8.0 should be 00 08 00 00 (0x00080000)
+/// LptFramework 0.8.1 should be 00 08 01 00 (0x00080100)
+/// LptFramework 0.9.0 should be 00 09 00 00 (0x00090000)
+/// LptFramework 1.0.0 should be 01 00 00 00 (0x01000000)
+/// LptFramework 1.1.0 should be 01 01 00 00 (0x01010000)
+/// LptFramework 1.2.0 should be 01 02 00 00 (0x01020000)
+/// LptFramework 1.3.0 should be 01 03 00 00 (0x01030000)
+/// LptFramework 1.3.1 should be 01 03 01 00 (0x01030100)
+/// LptFramework 1.4.0 should be 01 04 00 00 (0x01040000)
+/// LptFramework 1.5.0 should be 01 05 00 00 (0x01050000)
+/// LptFramework 1.6.0 should be 01 06 00 00 (0x01060000)
+/// LptFramework 1.6.1 should be 01 06 01 00 (0x01060100)
+/// LptFramework 1.6.2 should be 01 06 02 00 (0x01060200)
+/// LptFramework 1.7.0 should be 01 07 00 00 (0x01070000)
+/// LptFramework 1.8.0 should be 01 08 00 00 (0x01080000)
+/// LptFramework 1.9.0 should be 01 09 00 00 (0x01090000)
+/// LptFramework 1.9.1 should be 01 09 01 00 (0x01090100)
+///
+#define PCH_RC_VERSION 0x01090100
+
+///
+/// Protocol definition
+///
+/// This protocol is used to provide the information of PCH controller.
+///
+struct _EFI_PCH_INFO_PROTOCOL {
+ ///
+ /// This member specifies the revision of the PCH Info protocol. This field is used
+ /// to indicate backwards compatible changes to the protocol. Platform code that
+ /// consumes this protocol must read the correct revision value to correctly interpret
+ /// the content of the protocol fields.
+ ///
+ UINT8 Revision;
+ ///
+ /// The actual bus number of the PCH devices.
+ ///
+ UINT8 BusNumber;
+ ///
+ /// The reference code package release number
+ ///
+ UINT32 RCVersion;
+ ///
+ /// Indicate the Usb precondition feature is working, and it links all the Usb HC
+ /// precondition structures in the list.
+ ///
+ EFI_USB_HC_PORT_PRECONDITION *Preconditioned;
+};
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Protocol/PchInfo/UsbHcPortPrecondition.h b/ReferenceCode/Chipset/LynxPoint/Protocol/PchInfo/UsbHcPortPrecondition.h
new file mode 100644
index 0000000..56b13cb
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Protocol/PchInfo/UsbHcPortPrecondition.h
@@ -0,0 +1,53 @@
+/** @file
+ Header file for the PCH USB Common Driver
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _USB_HC_PORT_PRECONDITION_H_
+#define _USB_HC_PORT_PRECONDITION_H_
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#endif
+
+typedef struct _EFI_USB_HC_LOCATION {
+ UINTN SegmentNumber;
+ UINTN BusNumber;
+ UINTN DeviceNumber;
+ UINTN FunctionNumber;
+} EFI_USB_HC_LOCATION;
+
+typedef struct _EFI_USB_PORT_ENUM_TIMING_TABLE {
+ UINTN ResetRecovery;
+} EFI_USB_PORT_ENUM_TIMING_TABLE;
+
+EFI_FORWARD_DECLARATION (EFI_USB_HC_PORT_PRECONDITION);
+
+typedef
+BOOLEAN
+(EFIAPI *EFI_USB_HC_PORT_RESET_STATUS) (
+ IN EFI_USB_HC_PORT_PRECONDITION *This,
+ IN UINT8 PortNumber
+ );
+
+struct _EFI_USB_HC_PORT_PRECONDITION {
+ UINT8 Revision;
+ EFI_USB_HC_PORT_PRECONDITION *Next;
+ EFI_USB_HC_LOCATION Location;
+ EFI_USB_HC_PORT_RESET_STATUS IsRootPortReset;
+ EFI_USB_PORT_ENUM_TIMING_TABLE Timing;
+};
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Protocol/PchPlatformPolicy/PchPlatformPolicy.c b/ReferenceCode/Chipset/LynxPoint/Protocol/PchPlatformPolicy/PchPlatformPolicy.c
new file mode 100644
index 0000000..dfb9d2c
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Protocol/PchPlatformPolicy/PchPlatformPolicy.c
@@ -0,0 +1,44 @@
+/** @file
+ PCH policy protocol produced by a platform driver specifying various
+ expected PCH settings. This protocol is consumed by the PCH drivers.
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+//
+// Statements that include other files
+//
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+
+#include "EdkIIGlueDxe.h"
+#endif
+
+#include "PchPlatformPolicy.h"
+
+//
+// Protocol GUID definition
+//
+EFI_GUID gDxePchPlatformPolicyProtocolGuid = DXE_PCH_PLATFORM_POLICY_PROTOCOL_GUID;
+
+//
+// Protocol description
+//
+EFI_GUID_STRING
+ (&gDxePchPlatformPolicyProtocolGuid, "PchPlatformPolicy Protocol", "Intel(R) DXE Phase PCH Platform Policy Protocol");
diff --git a/ReferenceCode/Chipset/LynxPoint/Protocol/PchPlatformPolicy/PchPlatformPolicy.h b/ReferenceCode/Chipset/LynxPoint/Protocol/PchPlatformPolicy/PchPlatformPolicy.h
new file mode 100644
index 0000000..82df716
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Protocol/PchPlatformPolicy/PchPlatformPolicy.h
@@ -0,0 +1,1061 @@
+/** @file
+ PCH policy protocol produced by a platform driver specifying various
+ expected PCH settings. This protocol is consumed by the PCH drivers.
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+#ifndef _PCH_PLATFORM_POLICY_H_
+#define _PCH_PLATFORM_POLICY_H_
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "PchAccess.h"
+#include "PchUsbConfig.h"
+#endif
+///
+/// PCH policy provided by platform for DXE phase
+///
+///
+/// EDK and EDKII have different GUID formats
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#define DXE_PCH_PLATFORM_POLICY_PROTOCOL_GUID \
+ { \
+ 0x9797aaf8, 0xe49b, 0x4f02, 0xa3, 0x68, 0xc8, 0x14, 0x8d, 0x2b, 0xc9, 0xe7 \
+ }
+#else
+#define DXE_PCH_PLATFORM_POLICY_PROTOCOL_GUID \
+ { \
+ 0x9797aaf8, 0xe49b, 0x4f02, \
+ { \
+ 0xa3, 0x68, 0xc8, 0x14, 0x8d, 0x2b, 0xc9, 0xe7 \
+ } \
+ }
+#endif
+
+extern EFI_GUID gDxePchPlatformPolicyProtocolGuid;
+
+//
+// Forward reference for ANSI C compatibility
+//
+typedef struct _DXE_PCH_PLATFORM_POLICY_PROTOCOL DXE_PCH_PLATFORM_POLICY_PROTOCOL;
+
+///
+/// Protocol revision number
+/// Any backwards compatible changes to this protocol will result in an update in the revision number
+/// Major changes will require publication of a new protocol
+///
+
+///
+/// Revision 1: Original version
+///
+#define DXE_PCH_PLATFORM_POLICY_PROTOCOL_REVISION_1 1
+
+///
+/// Revision 2: Add L1Substates in PCH_PCI_EXPRESS_ROOT_PORT_CONFIG
+/// for BIOS Capability to Enable/Disable L1 Substates.
+/// Add override configuration for L1L2 and L1 substates.
+///
+#define DXE_PCH_PLATFORM_POLICY_PROTOCOL_REVISION_2 2
+
+///
+/// Revision 3: Add RootPortFunctionSwapping in PCH_PCI_EXPRESS_CONFIG
+/// for switching the support of RootPortFunctionSwapping.
+///
+#define DXE_PCH_PLATFORM_POLICY_PROTOCOL_REVISION_3 3
+
+///
+/// Revision 4: Add LegacyDmaDisable in PCH_PWR_OPT_CONFIG
+/// Add PchPwrCycDur in PCH_MISC_PM_CONFIG
+///
+#define DXE_PCH_PLATFORM_POLICY_PROTOCOL_REVISION_4 4
+
+///
+/// Revision 5: Add Port30Settings in PCH_USB_CONFIG
+/// Add PcieWakeFromDeepSx in PCH_WAKE_CONFIG
+///
+#define DXE_PCH_PLATFORM_POLICY_PROTOCOL_REVISION_5 5
+
+///
+/// Revision 6: Add DciEn in PCH_MISC_CONFIG
+/// Add DDR50 support in PCH_SERIAL_IO_CONFIG
+///
+#define DXE_PCH_PLATFORM_POLICY_PROTOCOL_REVISION_6 6
+
+///
+/// Revision 7: Add LTR related policies in PCH_PCIE_PWR_OPT
+/// LtrMaxSnoopLatency
+/// LtrMaxNoSnoopLatency
+/// SnoopLatencyOverrideMode
+/// SnoopLatencyOverrideMultiplier
+/// SnoopLatencyOverrideValue
+/// NonSnoopLatencyOverrideMode
+/// NonSnoopLatencyOverrideMultiplier
+/// NonSnoopLatencyOverrideValue
+/// Update SlpLanLowDc usage.
+///
+#define DXE_PCH_PLATFORM_POLICY_PROTOCOL_REVISION_7 7
+
+//
+// Generic definitions for device enabling/disabling used by PCH code.
+//
+#define PCH_DEVICE_ENABLE 1
+#define PCH_DEVICE_DISABLE 0
+
+//
+// ---------------------------- Device Enabling ------------------------------
+//
+///
+/// PCH Device enablings
+///
+/// The PCH_DEVICE_ENABLING block allows platform modules to tell the PCH drivers
+/// to enable/disable a set of PCH features.
+/// Platform modules may need to refer Setup options, schematic, BIOS specification
+/// to update these fields.
+///
+typedef struct {
+ ///
+ /// This member determines if enable or disable Intel Gigabit LAN device.
+ /// It must be set to disable while the device is not used.
+ ///
+ UINT8 Lan : 1; ///< 0: Disable; 1: Enable
+ ///
+ /// This member describes whether or not Intel HD Audio (Azalia) should be enabled.
+ /// If enabled and no codec exists the reference code will automatically disable
+ /// the Azalia device.
+ ///
+ UINT8 Azalia : 2; ///< 0: Disable; 1: Enable; 2: Auto
+ ///
+ /// This member describes whether or not the SATA controllers should be enabled.
+ ///
+ UINT8 Sata : 1; ///< 0: Disable; 1: Enable
+ ///
+ /// This member describes whether or not the SMBus controller of PCH should be enabled.
+ ///
+ UINT8 Smbus : 1; ///< 0: Disable; 1: Enable
+ ///
+ /// This member describes whether or not the PCI ClockRun feature of PCH should
+ /// be enabled.
+ ///
+ UINT8 PciClockRun : 1; ///< 0: Disable; 1: Enable
+ ///
+ /// This member describes whether or not PCH display logic should be enabled.
+ /// PCH display logic properly decodes the Register Access that are used to communicate
+ /// with the North Display in the IMC. This device should be enabled or disabled
+ /// as defined in the BIOS specification.
+ ///
+ UINT8 Display : 1; ///< 0: Disable; 1: Enable
+ ///
+ /// This member describes whether or not the Compatibility Revision ID (CRID) feature
+ /// of PCH should be enabled.
+ ///
+ UINT8 Crid : 1; ///< 0: Disable; 1: Enable
+ ///
+ /// This member describes whether or not the DMA of Serial IO controllers should be enabled.
+ ///
+ UINT8 SerialIoDma : 1; ///< 0: Disable; 1: Enable
+ ///
+ /// This member describes whether or not the Serial IO I2c0 controller should be enabled.
+ ///
+ UINT8 SerialIoI2c0 : 1; ///< 0: Disable; 1: Enable
+ ///
+ /// This member describes whether or not the Serial IO I2c1 controller should be enabled.
+ ///
+ UINT8 SerialIoI2c1 : 1; ///< 0: Disable; 1: Enable
+ ///
+ /// This member describes whether or not the Serial IO Spi0 controller should be enabled.
+ ///
+ UINT8 SerialIoSpi0 : 1; ///< 0: Disable; 1: Enable
+ ///
+ /// This member describes whether or not the Serial IO Spi1 controller should be enabled.
+ ///
+ UINT8 SerialIoSpi1 : 1; ///< 0: Disable; 1: Enable
+ ///
+ /// This member describes whether or not the Serial IO Uart0 controller should be enabled.
+ ///
+ UINT8 SerialIoUart0 : 1; ///< 0: Disable; 1: Enable
+ ///
+ /// This member describes whether or not the Serial IO Uart1 controller should be enabled.
+ ///
+ UINT8 SerialIoUart1 : 1; ///< 0: Disable; 1: Enable
+ ///
+ /// This member describes whether or not the Serial IO Sdio controller should be enabled.
+ ///
+ UINT8 SerialIoSdio : 1; ///< 0: Disable; 1: Enable
+ ///
+ /// This member describes whether or not the Asdio Dsp controller should be enabled.
+ ///
+ UINT8 AudioDsp : 1; ///< 0: Disable; 1: Enable
+ UINT8 Rsvdbits : 7; ///< Reserved fields for future expansion w/o protocol change
+} PCH_DEVICE_ENABLING;
+
+//
+// ---------------------------- PCI Express Config ----------------------
+//
+///
+/// The values before AutoConfig match the setting of PCI Express Base Specification 1.1, please be careful for adding new feature
+///
+typedef enum {
+ PchPcieAspmDisabled,
+ PchPcieAspmL0s,
+ PchPcieAspmL1,
+ PchPcieAspmL0sL1,
+ PchPcieAspmAutoConfig,
+ PchPcieAspmMax
+} PCH_PCI_EXPRESS_ASPM_CONTROL;
+
+///
+/// Refer to PCH EDS for the PCH implementation values corresponding
+/// to below PCI-E spec defined ranges
+///
+typedef enum {
+ PchPcieL1SubstatesDisabled,
+ PchPcieL1SubstatesL1_1,
+ PchPcieL1SubstatesL1_2,
+ PchPcieL1SubstatesL1_1_2,
+ PchPcieL1SubstatesMax
+} PCH_PCIE_EXPRESS_L1SUBSTATES_CONTROL;
+
+typedef enum {
+ PchPcieCompletionTO_Default,
+ PchPcieCompletionTO_50_100us,
+ PchPcieCompletionTO_1_10ms,
+ PchPcieCompletionTO_16_55ms,
+ PchPcieCompletionTO_65_210ms,
+ PchPcieCompletionTO_260_900ms,
+ PchPcieCompletionTO_1_3P5s,
+ PchPcieCompletionTO_4_13s,
+ PchPcieCompletionTO_17_64s,
+ PchPcieCompletionTO_Disabled
+} PCH_PCIE_COMPLETION_TIMEOUT;
+
+typedef enum {
+ PchPcieOverrideDisabled = 0x00,
+ PchPcieL1L2Override = 0x01,
+ PchPcieL1SubstatesOverride = 0x02,
+ PchPcieL1L2AndL1SubstatesOverride = 0x03
+} PCH_PCI_EXPRESS_ASPM_OVERRIDE_CONFIG;
+
+typedef struct {
+ UINT8 Enable : 1; ///< Root Port enabling, 0: Disable; 1: Enable.
+ UINT8 Hide : 1; ///< Whether or not to hide the configuration space of this port.
+ UINT8 SlotImplemented : 1; ///< Indicates whether the root port is connected to a slot.
+ UINT8 HotPlug : 1; ///< Indicate whether the root port is hot plug available.
+ UINT8 PmSci : 1; ///< Indicate whether the root port power manager SCI is enabled.
+ UINT8 ExtSync : 1; ///< Indicate whether the extended synch is enabled.
+ UINT8 Rsvdbits : 2;
+ //
+ // Error handlings
+ //
+ UINT8 UnsupportedRequestReport : 1; ///< Indicate whether the Unsupported Request Report is enabled.
+ UINT8 FatalErrorReport : 1; ///< Indicate whether the Fatal Error Report is enabled.
+ UINT8 NoFatalErrorReport : 1; ///< Indicate whether the No Fatal Error Report is enabled.
+ UINT8 CorrectableErrorReport : 1; ///< Indicate whether the Correctable Error Report is enabled.
+ UINT8 PmeInterrupt : 1; ///< Indicate whether the PME Interrupt is enabled.
+ UINT8 SystemErrorOnFatalError : 1; ///< Indicate whether the System Error on Fatal Error is enabled.
+ UINT8 SystemErrorOnNonFatalError : 1; ///< Indicate whether the System Error on Non Fatal Error is enabled.
+ UINT8 SystemErrorOnCorrectableError : 1; ///< Indicate whether the System Error on Correctable Error is enabled.
+
+ UINT8 AdvancedErrorReporting : 1; ///< Indicate whether the Advanced Error Reporting is enabled
+ UINT8 TransmitterHalfSwing : 1; ///< Indicate whether the Transmitter Half Swing is enabled.
+ UINT8 Reserved : 6; ///< Reserved fields for future expansion w/o protocol change
+
+ UINT8 FunctionNumber; ///< The function number this root port is mapped to
+ UINT8 PhysicalSlotNumber; ///< Indicates the slot number for the root port.
+ PCH_PCIE_COMPLETION_TIMEOUT CompletionTimeout; ///< The completion timeout configuration of the root port
+ PCH_PCI_EXPRESS_ASPM_CONTROL Aspm; ///< The ASPM configuration of the root port
+ PCH_PCIE_EXPRESS_L1SUBSTATES_CONTROL L1Substates; ///< The L1 Substates configuration of the root port
+} PCH_PCI_EXPRESS_ROOT_PORT_CONFIG;
+
+typedef struct {
+ UINT16 VendorId; ///< The vendor Id of Pci Express card ASPM setting override, 0xFFFF means any Vendor ID
+ UINT16 DeviceId; ///< The Device Id of Pci Express card ASPM setting override, 0xFFFF means any Device ID
+ UINT8 RevId; ///< The Rev Id of Pci Express card ASPM setting override, 0xFF means all steppings
+ UINT8 BaseClassCode; ///< The Base Class Code of Pci Express card ASPM setting override, 0xFF means all base class
+ UINT8 SubClassCode; ///< The Sub Class Code of Pci Express card ASPM setting override, 0xFF means all sub class
+ PCH_PCI_EXPRESS_ASPM_CONTROL EndPointAspm; ///< The override ASPM setting from End point
+ PCH_PCI_EXPRESS_ASPM_OVERRIDE_CONFIG OverrideConfig; ///< The override configuration. e.g. 0x0 means this subset is applicable to L1L2 override only.
+ UINT16 L1SubstatesCapOffset; ///< The L1Substates Capability Offset
+ UINT32 L1SubstatesCapMask; ///< The L1Substates Capability Mask
+} PCH_PCIE_DEVICE_ASPM_OVERRIDE;
+
+typedef enum {
+ PchPciePort1,
+ PchPciePort2,
+ PchPciePort3,
+ PchPciePort4,
+ PchPciePort5,
+ PchPciePort6,
+ PchPciePort7,
+ PchPciePort8
+} PCH_PCIE_SBDE_PORTS;
+
+///
+/// The PCH_PCI_EXPRESS_CONFIG block describes the expected configuration of the PCH PCI Express controllers
+///
+typedef struct {
+ ///
+ /// Temp Bus Number range available to be assigned to each root port and its downstream
+ /// devices for initialization of these devices before PCI Bus enumeration.
+ ///
+ UINT8 TempRootPortBusNumMin;
+ ///
+ /// Temp Bus Number range available to be assigned to each root port and its downstream
+ /// devices for initialization of these devices before PCI Bus enumeration.
+ ///
+ UINT8 TempRootPortBusNumMax;
+ ///
+ /// These members describe the configuration of each PCH PCIe root port.
+ ///
+ PCH_PCI_EXPRESS_ROOT_PORT_CONFIG RootPort[LPTH_PCIE_MAX_ROOT_PORTS];
+ UINT8 NumOfDevAspmOverride; ///< Number of Pci Express card Aspm setting override
+ PCH_PCIE_DEVICE_ASPM_OVERRIDE *DevAspmOverride; ///< The Pointer which is point to Pci Express card Aspm setting override
+ ///
+ /// The PCIe Port that selected for enable Subtractive Decode.
+ ///
+ PCH_PCIE_SBDE_PORTS PchPcieSbdePort;
+ ///
+ /// This member describes whether the PCI Express Clock Gating for each root port
+ /// is enabled by platform modules.
+ ///
+ UINT8 RootPortClockGating : 1;
+ ///
+ /// This member determines if enable subtractive decode over PCIe
+ ///
+ UINT8 EnableSubDecode : 1; ///< Determines if enable subtractive decode over PCIe
+ UINT8 Rsvdbits : 6; ///< Reserved fields for future expansion w/o protocol change
+ ///
+ /// Support root port function number swapping if root port of function 0 is disabled.
+ /// When RootPortFunctionSwapping enabled, the FunctionNumber for per root port will be ignored.
+ /// It allows to automatically swap the function 0 to eanble root port by enabling this policy, or
+ /// elaborates the FunctionNumber per root port and disable this policy.
+ /// NOTE: When RootPortFunctionSwapping is disabled, Bios tries to force enable the root port of function 0.
+ /// Be careful not assign the function 0 to the port connecting to Gbe/Nand or no lane available.
+ ///
+ UINT8 RootPortFunctionSwapping;
+} PCH_PCI_EXPRESS_CONFIG;
+
+//
+// ---------------------------- SATA Config -----------------------------
+//
+typedef enum {
+ PchSataOromDelay2sec,
+ PchSataOromDelay4sec,
+ PchSataOromDelay6sec,
+ PchSataOromDelay8sec
+} PCH_SATA_OROM_DELAY;
+
+typedef enum {
+ PchSataSpeedSupportDefault,
+ PchSataSpeedSupportGen1,
+ PchSataSpeedSupportGen2,
+ PchSataSpeedSupportGen3
+} PCH_SATA_SPEED_SUPPORT;
+
+typedef struct {
+ UINT8 Enable : 1; ///< 0: Disable; 1: Enable
+ UINT8 HotPlug : 1; ///< 0: Disable; 1: Enable
+ UINT8 InterlockSw : 1; ///< 0: Disable; 1: Enable
+ UINT8 External : 1; ///< 0: Disable; 1: Enable
+ UINT8 SpinUp : 1; ///< 0: Disable; 1: Enable the COMRESET initialization Sequence to the device
+ UINT8 SolidStateDrive : 1; ///< 0: HDD; 1: SSD
+ UINT8 DevSlp : 1; ///< 0: Disable; 1: Enable DevSlp on the port
+ UINT8 EnableDitoConfig: 1; ///< 0: Disable; 1: Enable
+ UINT8 DmVal : 4; ///< DM value to be set
+ UINT8 Rsvdbits : 4; ///< Reserved fields for future expansion w/o protocol change
+ UINT16 DitoVal : 10; ///< Dito value to be set
+ UINT16 Rsvdbits16 : 6; ///< Reserved fields for future expansion w/o protocol change
+} PCH_SATA_PORT_SETTINGS;
+
+///
+/// The PCH_SATA_CONFIG block describes the expected configuration of the SATA controllers.
+///
+typedef struct {
+ PCH_SATA_PORT_SETTINGS PortSettings[LPTH_AHCI_MAX_PORTS];
+ UINT8 RaidAlternateId : 1; ///< 0: Disable; 1: Enable
+ ///< Whether RAID Alternate ID is enabled. When disabled, the SATA controller D31:F2
+ ///< in RAID mode will report Device ID 282Xh; when enabled, the SATA controller
+ ///< D31:F2 in RAID mode will report Device ID 292Xh.
+ UINT8 Raid0 : 1; ///< 0: Disable; 1: Enable RAID0
+ UINT8 Raid1 : 1; ///< 0: Disable; 1: Enable RAID1
+ UINT8 Raid10 : 1; ///< 0: Disable; 1: Enable RAID10
+ UINT8 Raid5 : 1; ///< 0: Disable; 1: Enable RAID5
+ UINT8 Irrt : 1; ///< 0: Disable; 1: Enable Intel Rapid Recovery Technology
+ UINT8 OromUiBanner : 1; ///< 0: Disable; 1: Enable OROM UI and BANNER
+ UINT8 HddUnlock : 1; ///< 0: Disable; 1: Indicates that the HDD password unlock in the OS is enabled
+
+ UINT8 LedLocate : 1; ///< 0: Disable; 1: Indicates that the LED/SGPIO hardware is attached and ping to locate feature is enabled on the OS
+ UINT8 IrrtOnly : 1; ///< 0: Disable; 1: Allow only IRRT drives to span internal and external ports
+ UINT8 TestMode : 1; ///< 0: Disable; 1: Allow entrance to the PCH SATA test modes
+ UINT8 SalpSupport : 1; ///< 0: Disable; 1: Enable Aggressive Link Power Management
+ UINT8 LegacyMode : 1; ///< 0: Native PCI mode; 1: Legacy mode when controller 1 is operating in IDE mode
+ UINT8 SmartStorage : 1; ///< 0: Disable; 1: Enable RST Smart Storage caching Bit
+ UINT8 OromUiDelay : 2; ///< 00: 2 secs; 01: 4 secs; 10: 6 secs; 11: 8 secs
+
+ UINT8 SpeedSupport : 4; ///< Indicates the maximum speed the SATA controller can support
+ ///< 1h: 1.5 Gb/s (Gen 1); 2h: 3 Gb/s(Gen 2); 3h: 6 Gb/s (Gen 1)
+ UINT8 Rsvdbits : 4; ///< Reserved fields for future expansion w/o protocol change
+} PCH_SATA_CONFIG;
+
+//
+// --------------------------- AZALIA Config ------------------------------
+//
+typedef struct {
+ UINT32 VendorDeviceId; ///< This is the Vendor ID (byte 3 and byte 2) and Device ID (byte 1 and byte 0) of the Azalia codec.
+ UINT16 SubSystemId; ///< This is the sub system ID of this codec.
+ UINT8 RevisionId; ///< This is the revision ID of this codec. 0xFF applies to all steppings
+ UINT8 FrontPanelSupport; ///< Whether or not support front panel. 1: Yes, 0: No.
+ UINT16 NumberOfRearJacks; ///< Number of rear jacks.
+ UINT16 NumberOfFrontJacks; ///< Number of front jacks.
+} PCH_AZALIA_VERB_TABLE_HEADER;
+
+typedef struct {
+ PCH_AZALIA_VERB_TABLE_HEADER VerbTableHeader; ///< The header information in Azalia verb table.
+ UINT32 *VerbTableData; ///< Pointer to the buffer containing verb tables data provided by platform.
+} PCH_AZALIA_VERB_TABLE;
+
+
+///
+/// The AZALIA_CONFIG block describes the expected configuration of the Intel HD Audio (Azalia) feature.
+///
+typedef struct {
+ UINT8 Pme : 1; ///< Azalia wake-on-ring, 0: Disable; 1: Enable
+ UINT8 DS : 1; ///< 0: Docking is not supported; 1:Docking is supported
+ UINT8 DA : 1; ///< 0: Docking is not attached; 1:Docking is attached
+ UINT8 Rsvdbits : 5;
+ UINT8 AzaliaVerbTableNum; ///< Number of verb tables provided by platform
+ PCH_AZALIA_VERB_TABLE *AzaliaVerbTable; ///< Pointer to the actual verb table(s)
+ UINT16 ResetWaitTimer; ///< The delay timer after Azalia reset, the value is number of microseconds
+} PCH_AZALIA_CONFIG;
+
+//
+// --------------------------- AUDIO DSP Config ------------------------------
+//
+///
+/// The PCH_AUDIO_DSP_CONFIG block describes the misc power management configurations
+/// of the Audio Dsp controller, and also the Acpi or Pci mode selection for the
+/// Audio Dsp controller.
+///
+typedef struct {
+ UINT8 AudioDspD3PowerGating : 1; ///< This flag enables/disables the Audio Dsp D3 power gating.
+ UINT8 AudioDspBluetoothSupport : 1; ///< Audio Dsp Bluetooth support enabled.
+ UINT8 AudioDspAcpiMode : 1; ///< If this is enabled, the Audio Dsp device is shown as ACPI device,
+ ///< and the PCI controller for the Audio Dsp will be hidden, and vice versa.
+ UINT8 AudioDspAcpiInterruptMode : 1; ///< If this is enabled, the Audio Dsp device uses ACPI interrupts
+ UINT8 Rsvdbits : 4;
+} PCH_AUDIO_DSP_CONFIG;
+
+//
+// --------------------------- Serial IO Config ------------------------------
+//
+///
+/// The PCH_LP_SERIAL_CONFIG block provides the configurations to set the Serial IO controllers
+/// to Acpi devices or Pci controllers, and also set the interrupt type to Acpi or Pci
+/// through platform policy. It also provides to configure the I2c0 and I2c1 voltage
+/// to 1.8v or 3.3v by platform setting.
+///
+typedef struct {
+ UINT8 SerialIoMode : 1; ///< Set to 0 will create Acpi devices for Serial IO Controllers. Set to 1 will show the Pci devices.
+ UINT8 SerialIoInterruptMode : 1; ///< Configures all Serial IO Controllers in PCI or ACPI Interrupt Mode.
+ UINT8 I2c0VoltageSelect : 1; ///< Selects the IO voltage for I2c0 controller. It can be 1.8v or 3.3v
+ UINT8 I2c1VoltageSelect : 1; ///< selects the IO voltage for I2c1 controller. It can be 1.8v or 3.3v
+ ///
+ /// GpioInt Configuration
+ ///
+ UINT8 GpioIrqRoute : 1; ///< 0: IRQ14; 1: IRQ15
+ UINT8 DriverModeTouchPanel : 1; ///< Driver Mode Touch Panel (ACPI=0:GPIO=1)
+ UINT8 DriverModeTouchPad : 1; ///< Driver Mode Touch Pad (ACPI=0:GPIO=1)
+ UINT8 DriverModeSensorHub : 1; ///< Driver Mode Sensor Hub (ACPI=0;GPIO=1)
+
+ UINT8 Ddr50Support : 1; ///< enables DDR50 support in SDIO controller
+ UINT8 Reserved : 7; // padding
+} PCH_SERIAL_IO_CONFIG;
+
+typedef enum {
+ PchSerialIoIsAcpi = 0,
+ PchSerialIoIsPci
+} PCH_SERIAL_IO_MODE_CONFIG;
+
+typedef enum {
+ PchSerialIoIs33V = 0,
+ PchSerialIoIs18V
+} PCH_LP_SERIAL_IO_VOLTAGE_SEL;
+
+//
+// --------------------------- Smbus Config ------------------------------
+//
+
+///
+/// The SMBUS_CONFIG block lists the reserved addresses for non-ARP capable devices in the platform.
+///
+typedef struct {
+ UINT8 NumRsvdSmbusAddresses; ///< The number of elements in the SmbusAddressTable.
+ UINT8 *RsvdSmbusAddressTable; ///< The pointer to an array of addresses reserved for non-ARP-capable SMBus devices.
+} PCH_SMBUS_CONFIG;
+
+//
+// --------------------------- Miscellaneous PM Config ------------------------------
+//
+typedef struct {
+ UINT8 MeWakeSts : 1; ///< Clear the ME_WAKE_STS bit in the Power and Reset Status (PRSTS) register.
+ UINT8 MeHrstColdSts : 1; ///< Clear the ME_HRST_COLD_STS bit in the Power and Reset Status (PRSTS) register.
+ UINT8 MeHrstWarmSts : 1; ///< Clear the ME_HRST_WARM_STS bit in the Power and Reset Status (PRSTS) register.
+ UINT8 MeHostPowerDn : 1; ///< Clear the ME_HOST_PWRDN bit in the Power and Reset Status (PRSTS) register.
+ UINT8 WolOvrWkSts : 1; ///< Clear the WOL_OVR_WK_STS bit in the Power and Reset Status (PRSTS) register.
+ UINT8 Rsvdbits : 3;
+} PCH_POWER_RESET_STATUS;
+
+typedef struct {
+ UINT8 PmeB0S5Dis : 1; ///< Corresponds to the PME_B0_S5_DIS bit in the General PM Configuration 3 (GEN_PM_CON_3) register.
+ UINT8 WolEnableOverride : 1; ///< Corresponds to the "MOL Enable Override" bit in the General PM Configuration 3 (GEN_PM_CON_3) register.
+ UINT8 Gp27WakeFromDeepSx : 1; ///< Determine if enable GP27 to wake from deep Sx.
+ UINT8 PcieWakeFromDeepSx : 1; ///< Determine if enable PCIe to wake from deep Sx.
+ UINT8 Rsvdbits : 4;
+} PCH_WAKE_CONFIG;
+
+typedef enum {
+ PchDeepSxPolDisable = 0,
+ PchMobileDpS5En,
+ PchDesktopDpS5En,
+ PchMobileDpS4S5En,
+ PchDesktopDpS4S5En,
+ PchMobileDpS3S4S5En,
+ PchDesktopDpS3S4S5En
+} PCH_DEEP_SX_CONFIG;
+
+typedef enum {
+ PchSlpS360us,
+ PchSlpS31ms,
+ PchSlpS350ms,
+ PchSlpS32s
+} PCH_SLP_S3_MIN_ASSERT;
+
+typedef enum {
+ PchSlpS4PchTime, ///< The time defined in PCH EDS Power Sequencing and Reset Signal Timings table
+ PchSlpS41s,
+ PchSlpS42s,
+ PchSlpS43s,
+ PchSlpS44s
+} PCH_SLP_S4_MIN_ASSERT;
+
+typedef enum {
+ PchSlpSus0ms,
+ PchSlpSus500ms,
+ PchSlpSus1s,
+ PchSlpSus4s
+} PCH_SLP_SUS_MIN_ASSERT;
+
+typedef enum {
+ PchSlpA0ms,
+ PchSlpA4s,
+ PchSlpA98ms,
+ PchSlpA2s
+} PCH_SLP_A_MIN_ASSERT;
+
+///
+/// The PCH_MISC_PM_CONFIG block describes expected miscellaneous power management settings.
+/// The PowerResetStatusClear field would clear the Power/Reset status bits, please
+/// set the bits if you want PCH Init driver to clear it, if you want to check the
+/// status later then clear the bits.
+///
+typedef struct {
+ ///
+ /// Specify which Power/Reset bits need to be cleared by
+ /// the PCH Init Driver.
+ /// Usually platform drivers take care of these bits, but if
+ /// not, let PCH Init driver clear the bits.
+ ///
+ PCH_POWER_RESET_STATUS PowerResetStatusClear;
+ PCH_WAKE_CONFIG WakeConfig; ///< Specify Wake Policy
+ PCH_DEEP_SX_CONFIG PchDeepSxPol; ///< Deep Sx Policy
+ PCH_SLP_S3_MIN_ASSERT PchSlpS3MinAssert; ///< SLP_S3 Minimum Assertion Width Policy
+ PCH_SLP_S4_MIN_ASSERT PchSlpS4MinAssert; ///< SLP_S4 Minimum Assertion Width Policy
+ PCH_SLP_SUS_MIN_ASSERT PchSlpSusMinAssert; ///< SLP_SUS Minimum Assertion Width Policy
+ PCH_SLP_A_MIN_ASSERT PchSlpAMinAssert; ///< SLP_A Minimum Assertion Width Policy
+ UINT8 SlpStrchSusUp : 1; ///< Enable/Disable SLP_X Stretching After SUS Well Power Up
+ ///
+ /// Enable/Disable SLP_LAN# Low on DC Power.
+ /// Configure On DC PHY Power Diable according to policy SlpLanLowDc.
+ /// When this is enabled, SLP_LAN# will be driven low when ACPRESENT is low.
+ /// This indicates that LAN PHY should be powered off on battery mode.
+ /// This will override the DC_PP_DIS setting by WolEnableOverride.
+ ///
+ UINT8 SlpLanLowDc : 1;
+ UINT8 Rsvdbits : 6;
+ ///
+ /// Reset Power Cycle Duration could be customized in the unit of second.Please refer to EDS
+ /// for all support settings. So far PCH supports 1~4 seconds, and PCH default is 4 seconds.
+ /// And make sure the setting correct, which never less than the following register.
+ /// - GEN_PMCON_3.SLP_S3_MIN_ASST_WDTH
+ /// - GEN_PMCON_3.SLP_S4_MIN_ASST_WDTH
+ /// - PM_CFG.SLP_A_MIN_ASST_WDTH
+ /// - PM_CFG.SLP_LAN_MIN_ASST_WDTH
+ ///
+ UINT8 PchPwrCycDur; ///< Reset Power Cycle Duration
+} PCH_MISC_PM_CONFIG;
+
+//
+// --------------------------- IO APIC Config ------------------------------
+//
+///
+/// The PCH_IO_APIC_CONFIG block describes the expected configuration of the PCH
+/// IO APIC, it's optional and PCH code would ignore it if the BdfValid bit is
+/// not TRUE. Bus:device:function fields will be programmed to the register
+/// LPC_IBDF(D31:F0:R6Ch-6Dh), it's using for the following purpose:
+/// As the Requester ID when initiating Interrupt Messages to the processor.
+/// As the Completer ID when responding to the reads targeting the IOxAPI's
+/// Memory-Mapped I/O registers.
+/// This field defaults to Bus 0: Device 31: Function 0 after reset. BIOS can
+/// program this field to provide a unique Bus:Device:Function number for the
+/// internal IOxAPIC.
+///
+typedef struct {
+ BOOLEAN BdfValid; ///< Whether the BDF value is valid, PCH code will not program these fields if this bit is not TRUE.
+ UINT8 BusNumber; ///< Bus/Device/Function used as Requestor / Completer ID.
+ UINT8 DeviceNumber; ///< Bus/Device/Function used as Requestor / Completer ID.
+ UINT8 FunctionNumber; ///< Bus/Device/Function used as Requestor / Completer ID.
+ UINT8 IoApicEntry24_39 :1; ///< 0: Disable; 1: Enable IOAPIC Entry 24-39.
+ UINT8 RsvdBits :7;
+} PCH_IO_APIC_CONFIG;
+
+//
+// --------------------------- Subsystem Vendor ID / Subsystem ID Config -----
+//
+///
+/// The PCH_DEFAULT_SVID_SID block describes the default Subsystem Vendor ID and
+/// Subsystem ID of the PCH devices.
+/// This field will be ignored if the value of SubSystemVendorId and SubSystemId
+/// are both 0.
+/// If the SVID and SID registers of some PCH devices are filled before PchInit
+/// driver execute then this field will be ignored because SVID and SID registers
+/// are write once.
+///
+typedef struct {
+ UINT16 SubSystemVendorId; ///< Default Subsystem Vendor ID of the PCH devices.
+ UINT16 SubSystemId; ///< Default Subsystem ID of the PCH devices.
+} PCH_DEFAULT_SVID_SID;
+
+//
+// --------------------------- Lock Down Config ------------------------------
+//
+#define PCH_BWP_SIGNATURE EFI_SIGNATURE_32 ('P', 'B', 'W', 'P')
+///
+/// The PCH_LOCK_DOWN_CONFIG block describes the expected configuration of the PCH
+/// for security requirement.
+///
+typedef struct {
+ ///
+ /// Enable SMI_LOCK bit to prevent writes to the Global SMI Enable bit.
+ ///
+ UINT8 GlobalSmi : 1;
+ ///
+ /// Enable BIOS Interface Lock Down bit to prevent writes to the Backup Control Register
+ /// Top Swap bit and the General Control and Status Registers Boot BIOS Straps.
+ ///
+ UINT8 BiosInterface : 1;
+ ///
+ /// Enable GPIO Lockdown Enable bit to enables lockdown of the GPIO registers:
+ /// GPIO_USE_SEL, GP_IO_SEL, GP_LVL, GPIO_USE_SEL2, GP_IO_SEL2, GP_LVL2,
+ /// GPIO_USE_SEL3, GP_IO_SEL3, GP_LVL3, GP_RST_SEL.
+ ///
+ UINT8 GpioLockDown : 1;
+ ///
+ /// Enable RTC lower and upper 128 byte Lock bits to lock Bytes 38h-3Fh in the upper
+ /// and lower 128-byte bank of RTC RAM.
+ ///
+ UINT8 RtcLock : 1;
+ ///
+ /// Enable the BIOS Lock Enable (BLE) feature and set SMM_BWP bit (D31:F0:RegDCh[5])
+ /// for the BIOS region protection. When it is enabled, the BIOS Region can only be
+ /// modified from SMM after ExitPmAuth protocol is installed.
+ /// Note: When BiosLock is enabled, platform code also needs to update to take care
+ /// of BIOS modification (including SetVariable) in DXE or runtime phase after
+ /// ExitPmAuth protocol is installed.
+ ///
+ UINT8 BiosLock : 1;
+ UINT8 Rsvdbits : 3;
+ ///
+ /// Indicates the IO Address which is used to generate IO Trap SMI to register
+ /// IchnBiosWp callback function in PchBiosLockIoTrapCallback () to handle TCO
+ /// BIOSWR SMI. Please refer to the sample code of PchBiosWriteProtect driver for
+ /// more details about PchBiosLockIoTrapCallback().If PchBiosLockIoTrapAddress is 0,
+ /// BIOS will allocate available IO address with 256 byte range from GCD and pass it
+ /// to PchBiosLockIoTrapAddress. PCH Reference code replaces the SW SMI generated
+ /// by PchBiosLockSwSmiNumber with the IO Trap SMI generated by PchBiosLockIoTrapAddress.
+ ///
+ UINT16 PchBiosLockIoTrapAddress; ///< IO Trap range base address for Bios Lock
+} PCH_LOCK_DOWN_CONFIG;
+
+//
+// --------------------------- Thermal Config ------------------------------------
+//
+typedef struct {
+ UINT8 TselLock : 1;
+ UINT8 TscLock : 1;
+ UINT8 TsmicLock : 1;
+ UINT8 PhlcLock : 1;
+ UINT8 Rsvdbits : 4;
+} PCH_THERMAL_ALERT_ENABLE;
+
+typedef struct {
+ UINT32 T0Level : 9;
+ UINT32 T1Level : 9;
+ UINT32 T2Level : 9;
+ UINT32 TTEnable : 1;
+ UINT32 TTState13Enable : 1;
+ UINT32 TTLock : 1;
+ UINT32 SuggestedSetting : 1; ///< Enable/Disable suggested representative values
+ ///
+ /// ULT processors support thermal management and cross thermal throttling between the processor package
+ /// and LP PCH. The PMSYNC message from PCH to CPU includes specific bit fields to update the PCH
+ /// thermal status to the processor which is factored into the processor throttling.
+ /// Enable/Disable PCH Cross Throttling; 0: Disabled, 1: Enabled
+ ///
+ UINT32 PchCrossThrottling : 1;
+} THERMAL_THROTTLE_LEVELS;
+
+typedef struct {
+ UINT8 DmiTsawEn : 1; ///< DMI Thermal Sensor Autonomous Width Enable
+ UINT8 SuggestedSetting : 1; ///< Enable/Disable suggested representative values
+ UINT8 Rsvdbits : 6;
+
+ UINT8 TS0TW : 2; ///< Thermal Sensor 0 Target Width
+ UINT8 TS1TW : 2; ///< Thermal Sensor 1 Target Width
+ UINT8 TS2TW : 2; ///< Thermal Sensor 2 Target Width
+ UINT8 TS3TW : 2; ///< Thermal Sensor 3 Target Width
+} DMI_HW_WIDTH_CONTROL;
+
+typedef struct {
+ UINT8 P0T1M : 2; ///< Port 0 T1 Multipler
+ UINT8 P0T2M : 2; ///< Port 0 T2 Multipler
+ UINT8 P0T3M : 2; ///< Port 0 T3 Multipler
+ UINT8 P0TDisp : 2; ///< Port 0 Tdispatch
+
+ UINT8 P1T1M : 2; ///< Port 1 T1 Multipler
+ UINT8 P1T2M : 2; ///< Port 1 T2 Multipler
+ UINT8 P1T3M : 2; ///< Port 1 T3 Multipler
+ UINT8 P1TDisp : 2; ///< Port 1 Tdispatch
+
+ UINT8 P0Tinact : 2; ///< Port 0 Tinactive
+ UINT8 P0TDispFinit : 1; ///< Port 0 Alternate Fast Init Tdispatch
+ UINT8 P1Tinact : 2; ///< Port 1 Tinactive
+ UINT8 P1TDispFinit : 1; ///< Port 1 Alternate Fast Init Tdispatch
+ UINT8 SuggestedSetting : 1; ///< Enable/Disable suggested representative values
+ UINT8 Rsvdbits : 1;
+} SATA_THERMAL_THROTTLE;
+
+///
+/// If DmiIot of DmiConfig is enabled, the TTLevels and DmiHaAWC value will not be used.
+///
+typedef struct {
+ THERMAL_THROTTLE_LEVELS TTLevels;
+ DMI_HW_WIDTH_CONTROL DmiHaAWC;
+ SATA_THERMAL_THROTTLE SataTT;
+} PCH_THERMAL_THROTTLING;
+
+///
+/// The PCH_THERMAL_CONFIG block describes the expected configuration of the PCH for Thermal.
+///
+typedef struct {
+ ///
+ /// This field determines if the PCH's TEMP_ALERT# pin will be asserted while the
+ /// temperature of processor core, PCH, Memory Controller/Graphics and DIMM is
+ /// outside the temperature limits.
+ ///
+ PCH_THERMAL_ALERT_ENABLE ThermalAlertEnable;
+ ///
+ /// This field reports the status of Thermal Device. When it reports ThermalDevice
+ /// is disabled, the PCI configuration space of thermal device will be hidden by
+ /// setting FD.TTD prior to end of POST.
+ ///
+ BOOLEAN ThermalDeviceEnable;
+ ///
+ /// This field decides the settings of Thermal throttling. When the Suggested Setting
+ /// is enabled, PCH RC will use the suggested representative values.
+ ///
+ PCH_THERMAL_THROTTLING ThermalThrottling;
+ ///
+ /// This field decides the temperature, 0x00 is the hottest temperature and 0x1FF
+ /// is the lowest temperature
+ ///
+ UINT16 PchHotLevel;
+} PCH_THERMAL_CONFIG;
+
+//
+// --------------------------- HPET Config ------------------------------
+//
+typedef struct {
+ UINT8 BusNumber; ///< Bus Number HPETn used as Requestor / Completer ID
+ UINT8 DeviceNumber; ///< Device Number HPETn used as Requestor / Completer ID
+ UINT8 FunctionNumber; ///< Function Number HPETn used as Requestor / Completer ID
+} PCH_HPET_BDF_CONFIG;
+
+///
+/// The PCH_LPC_HPET_CONFIG block describes the expected configuration of the PCH for HPET.
+///
+typedef struct {
+ BOOLEAN BdfValid; ///< Whether the BDF value is valid
+ PCH_HPET_BDF_CONFIG Hpet[PCH_HPET_BDF_MAX]; ///< Lpc HPET n Bus:Device:Function Configuration
+} PCH_LPC_HPET_CONFIG;
+
+//
+// --------------------------- Serial IRQ Config ------------------------------
+//
+typedef enum {
+ PchQuietMode,
+ PchContinuousMode
+} PCH_SIRQ_MODE;
+///
+/// Refer to PCH EDS for the details of Start Frame Pulse Width in Continuous and Quiet mode
+///
+typedef enum {
+ PchSfpw4Clk,
+ PchSfpw6Clk,
+ PchSfpw8Clk
+} PCH_START_FRAME_PULSE;
+
+///
+/// The PCH_LPC_SIRQ_CONFIG block describes the expected configuration of the PCH for Serial IRQ.
+///
+typedef struct {
+ BOOLEAN SirqEnable; ///< Determines if enable Serial IRQ
+ PCH_SIRQ_MODE SirqMode; ///< Serial IRQ Mode Select. 0: quiet mode 1: continuous mode.
+ PCH_START_FRAME_PULSE StartFramePulse; ///< Start Frame Pulse Width
+} PCH_LPC_SIRQ_CONFIG;
+
+//
+// ---------------------------- DMI Config -----------------------------
+//
+///
+/// The PCH_DMI_CONFIG block describes the expected configuration of the PCH for DMI.
+///
+typedef struct {
+ UINT8 DmiAspm : 1; ///< Enable/Disable ASPM on PCH side of the DMI Link.
+ ///< While DmiAspm is enabled, DMI ASPM will be set to Intel recommended value.
+ UINT8 DmiExtSync : 1; ///< Determines if force extended transmission of FTS ordered sets when
+ ///< exiting L0s prior to entering L0.
+ UINT8 DmiIot : 1; ///< Enable/Disable DMI IOT
+ UINT8 Rsvdbits : 5;
+} PCH_DMI_CONFIG;
+
+//
+// --------------------------- Power Optimizer Config ------------------------------
+//
+typedef struct {
+ UINT8 LtrEnable :1; ///< Latency Tolerance Reporting Mechanism.
+ UINT8 ObffEnable :1; ///< Pcie end point Optimized Buffer Flush/Fill (OBFF) capability for the root port.
+ UINT8 LtrConfigLock :1;
+ UINT8 Rsvdbits :5;
+ UINT16 LtrMaxSnoopLatency; ///< Latency Tolerance Reporting, Max Snoop Latency.
+ UINT16 LtrMaxNoSnoopLatency; ///< Latency Tolerance Reporting, Max Non-Snoop Latency.
+ UINT8 SnoopLatencyOverrideMode; ///< Latency Tolerance Reporting, Snoop Latency Override Mode.
+ UINT8 SnoopLatencyOverrideMultiplier; ///< Latency Tolerance Reporting, Snoop Latency Override Multiplier.
+ UINT16 SnoopLatencyOverrideValue; ///< Latency Tolerance Reporting, Snoop Latency Override Value.
+ UINT8 NonSnoopLatencyOverrideMode; ///< Latency Tolerance Reporting, Non-Snoop Latency Override Mode.
+ UINT8 NonSnoopLatencyOverrideMultiplier; ///< Latency Tolerance Reporting, Non-Snoop Latency Override Multiplier.
+ UINT16 NonSnoopLatencyOverrideValue; ///< Latency Tolerance Reporting, Non-Snoop Latency Override Value.
+} PCH_PCIE_PWR_OPT;
+
+typedef struct {
+ UINT16 VendorId; ///< PCI configuration space offset 0
+ UINT16 DeviceId; ///< PCI configuration space offset 2
+ UINT8 RevId; ///< PCI configuration space offset 8; 0xFF means all steppings
+/**
+ SnoopLatency bit definition
+ Note: All Reserved bits must be set to 0
+
+ BIT[15] - When set to 1b, indicates that the values in bits 9:0 are valid
+ When clear values in bits 9:0 will be ignored
+ BITS[14:13] - Reserved
+ BITS[12:10] - Value in bits 9:0 will be multiplied with the scale in these bits
+ 000b - 1 ns
+ 001b - 32 ns
+ 010b - 1024 ns
+ 011b - 32,768 ns
+ 100b - 1,048,576 ns
+ 101b - 33,554,432 ns
+ 110b - Reserved
+ 111b - Reserved
+ BITS[9:0] - Snoop Latency Value. The value in these bits will be multiplied with
+ the scale in bits 12:10
+**/
+ UINT16 SnoopLatency;
+/**
+ NonSnoopLatency bit definition
+ Note: All Reserved bits must be set to 0
+
+ BIT[15] - When set to 1b, indicates that the values in bits 9:0 are valid
+ When clear values in bits 9:0 will be ignored
+ BITS[14:13] - Reserved
+ BITS[12:10] - Value in bits 9:0 will be multiplied with the scale in these bits
+ 000b - 1 ns
+ 001b - 32 ns
+ 010b - 1024 ns
+ 011b - 32,768 ns
+ 100b - 1,048,576 ns
+ 101b - 33,554,432 ns
+ 110b - Reserved
+ 111b - Reserved
+ BITS[9:0] - Non Snoop Latency Value. The value in these bits will be multiplied with
+ the scale in bits 12:10
+**/
+ UINT16 NonSnoopLatency;
+} PCH_PCIE_DEVICE_LTR_OVERRIDE;
+
+///
+/// The PCH_PWR_OPT_CONFIG block describes the expected configuration of the PCH for Power Optimizer.
+///
+typedef struct {
+ UINT8 PchPwrOptDmi :1; ///< enable/disable DMI Power Optimizer on PCH side.
+ UINT8 PchPwrOptGbe :1; ///< enable/disable Gbe Power Optimizer on PCH side.
+ UINT8 PchPwrOptXhci :1; ///< enable/disable XHCI Power Optimizer on PCH side.
+ UINT8 PchPwrOptEhci :1; ///< enable/disable EHCI Power Optimizer on PCH side.
+ UINT8 PchPwrOptSata :1; ///< enable/disable SATA Power Optimizer on PCH side.
+ UINT8 MemCloseStateEn :1; ///< enable/disable MEM CLOSED State on PCH side.
+ UINT8 InternalObffEn :1; ///< enable/disable Optimized Buffer Flush/Fill (OBFF) protocol for internal on PCH side.
+ UINT8 ExternalObffEn :1; ///< enable/disable Optimized Buffer Flush/Fill (OBFF) protocol for external on PCH side.
+ UINT8 NumOfDevLtrOverride; ///< Number of Pci Express card listed in LTR override table
+ PCH_PCIE_DEVICE_LTR_OVERRIDE *DevLtrOverride; ///< Pointer to Pci Express devices LTR override table
+ PCH_PCIE_PWR_OPT PchPwrOptPcie[LPTH_PCIE_MAX_ROOT_PORTS]; ///< related configuration for PCIE ports power optimization.
+ UINT8 LegacyDmaDisable :1; ///< disable/enable legacy DMA controller (8254) and port 0x61 timer
+ UINT8 Rsvdbits :7;
+} PCH_PWR_OPT_CONFIG;
+
+//
+// --------------------- Miscellaneous Config ------------------------------
+//
+///
+/// The PCH_MISC_CONFIG block describes the expected configuration of the PCH for Miscellaneous Configuration.
+///
+typedef struct {
+ ///
+ /// This member determines the SMBIOS OEM type (0x80 to 0xFF) defined in SMBIOS
+ /// Type 14 - Group Associations structure - item type.
+ /// FVI structure uses it as SMBIOS OEM type to provide version information.
+ ///
+ UINT8 FviSmbiosType;
+ ///
+ /// This member enables/disables Direct Connect Interface (DCI) for LPT-LP.
+ /// When enabling DCI (through the enable bit), it's able to access JTAG and Run Control features
+ /// in a closed chassis situation, by using the USB3 port on a Shark Bay ULT platform.
+ ///
+ UINT8 DciEn :1;
+ UINT8 Rsvdbits :7;
+} PCH_MISC_CONFIG;
+
+//
+// ------------ General PCH Platform Policiy protocol definition ------------
+//
+///
+/// The PCH platform policy protocol allows the platform code to publish a set of
+/// configuration information that the PCH drivers will use to configure the PCH hardware.
+/// The Revision field is used to accommodate backward compatible changes to the protocol.
+/// The Revision should be initialized to DXE_PLATFORM_PCH_POLICY_PROTOCOL_REVISION_X
+/// by the protocol producer.
+/// The BusNumber field is used for platform to assign Bus number with multiple instances.
+///
+struct _DXE_PCH_PLATFORM_POLICY_PROTOCOL {
+ ///
+ /// This member specifies the revision of the PCH Policy protocol.
+ /// This field is used to indicate backwards compatible changes to the protocol.
+ /// Platform code that produces this protocol must fill with the correct revision
+ /// value for the PCH reference code to correctly interpret the content of the
+ /// protocol fields.
+ ///
+ UINT8 Revision;
+ ///
+ /// This member describes the desired bus number of the PCH controller.
+ ///
+ UINT8 BusNumber;
+ ///
+ /// This member describes which PCH devices should be enabled or disabled.
+ ///
+ PCH_DEVICE_ENABLING *DeviceEnabling;
+ ///
+ /// This member describes USB controller's related configuration.
+ ///
+ PCH_USB_CONFIG *UsbConfig;
+ ///
+ /// This member describes PCI Express controller's related configuration.
+ ///
+ PCH_PCI_EXPRESS_CONFIG *PciExpressConfig;
+ ///
+ /// This member describes SATA controller's related configuration.
+ ///
+ PCH_SATA_CONFIG *SataConfig;
+ ///
+ /// This member describes the Intel HD Audio (Azalia) related configuration.
+ ///
+ PCH_AZALIA_CONFIG *AzaliaConfig;
+ ///
+ /// This member describes SMBus related configuration.
+ ///
+ PCH_SMBUS_CONFIG *SmbusConfig;
+ ///
+ /// This member describes miscellaneous platform power management configurations.
+ ///
+ PCH_MISC_PM_CONFIG *MiscPmConfig;
+ ///
+ /// This member describes IOAPIC related configuration.
+ ///
+ PCH_IO_APIC_CONFIG *IoApicConfig;
+ ///
+ /// This member describes default SVID and Sid for PCH devices.
+ ///
+ PCH_DEFAULT_SVID_SID *DefaultSvidSid;
+ ///
+ /// This member describes LockDown related configuration.
+ ///
+ PCH_LOCK_DOWN_CONFIG *LockDownConfig;
+ ///
+ /// This member describes Thermal related configuration.
+ ///
+ PCH_THERMAL_CONFIG *ThermalConfig;
+ ///
+ /// This member describes HPET related configuration.
+ ///
+ PCH_LPC_HPET_CONFIG *HpetConfig;
+ ///
+ /// This member describes the expected configuration of the PCH for Serial IRQ.
+ ///
+ PCH_LPC_SIRQ_CONFIG *SerialIrqConfig;
+ ///
+ /// This member describes DMI related configuration.
+ ///
+ PCH_DMI_CONFIG *DmiConfig;
+ ///
+ /// This member describes the Power Optimizer configuration.
+ ///
+ PCH_PWR_OPT_CONFIG *PwrOptConfig;
+ ///
+ /// This member describes the Miscellaneous configuration.
+ ///
+ PCH_MISC_CONFIG *MiscConfig;
+ ///
+ /// This member describes the Audio Dsp related configuration
+ ///
+ PCH_AUDIO_DSP_CONFIG *AudioDspConfig;
+ ///
+ /// This member describes the Serial IO related configuration
+ ///
+ PCH_SERIAL_IO_CONFIG *SerialIoConfig;
+};
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Protocol/PchReset/PchReset.c b/ReferenceCode/Chipset/LynxPoint/Protocol/PchReset/PchReset.c
new file mode 100644
index 0000000..28210a6
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Protocol/PchReset/PchReset.c
@@ -0,0 +1,44 @@
+/** @file
+ This file defines the PCH Reset Protocol
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+//
+// Include the protocol header file
+//
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+
+#include "EdkIIGlueDxe.h"
+#endif
+
+#include "PchReset.h"
+
+//
+// Protocol GUID definition
+//
+EFI_GUID gPchResetProtocolGuid = PCH_RESET_PROTOCOL_GUID;
+EFI_GUID gPchResetCallbackProtocolGuid = PCH_RESET_CALLBACK_PROTOCOL_GUID;
+
+//
+// Protocol description
+//
+EFI_GUID_STRING(&gPchResetProtocolGuid, "PCH Reset Protocol", "Intel(R) PCH Reset Protocol");
+EFI_GUID_STRING(&gPchResetProtocolGuid, "PCH Reset Callback Protocol", "Intel(R) PCH Reset Callback Protocol");
diff --git a/ReferenceCode/Chipset/LynxPoint/Protocol/PchReset/PchReset.h b/ReferenceCode/Chipset/LynxPoint/Protocol/PchReset/PchReset.h
new file mode 100644
index 0000000..f11a744
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Protocol/PchReset/PchReset.h
@@ -0,0 +1,139 @@
+/** @file
+ PCH Reset Protocol
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _PCH_RESET_H_
+#define _PCH_RESET_H_
+
+///
+/// GUID for the PCH Reset Protocol
+///
+/// EDK and EDKII have different GUID formats
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#define PCH_RESET_PROTOCOL_GUID \
+ { \
+ 0xdb63592c, 0xb8cc, 0x44c8, 0x91, 0x8c, 0x51, 0xf5, 0x34, 0x59, 0x8a, 0x5a \
+ }
+#define PCH_RESET_CALLBACK_PROTOCOL_GUID \
+ { \
+ 0x3a3300ab, 0xc929, 0x487d, 0xab, 0x34, 0x15, 0x9b, 0xc1, 0x35, 0x62, 0xc0 \
+ }
+#else
+#define PCH_RESET_PROTOCOL_GUID \
+ { \
+ 0xdb63592c, 0xb8cc, 0x44c8, \
+ { \
+ 0x91, 0x8c, 0x51, 0xf5, 0x34, 0x59, 0x8a, 0x5a \
+ } \
+ }
+#define PCH_RESET_CALLBACK_PROTOCOL_GUID \
+ { \
+ 0x3a3300ab, 0xc929, 0x487d, \
+ { \
+ 0xab, 0x34, 0x15, 0x9b, 0xc1, 0x35, 0x62, 0xc0 \
+ } \
+ }
+#endif
+
+#define EFI_CAPSULE_VARIABLE_NAME L"CapsuleUpdateData"
+
+//
+// Extern the GUID for protocol users.
+//
+extern EFI_GUID gPchResetProtocolGuid;
+extern EFI_GUID gPchResetCallbackProtocolGuid;
+
+//
+// Forward reference for ANSI C compatibility
+//
+typedef struct _PCH_RESET_PROTOCOL PCH_RESET_PROTOCOL;
+
+typedef struct _PCH_RESET_CALLBACK_PROTOCOL PCH_RESET_CALLBACK_PROTOCOL;
+
+//
+// Related Definitions
+//
+///
+/// PCH Reset Types
+///
+typedef enum {
+ ColdReset,
+ WarmReset,
+ ShutdownReset,
+ PowerCycleReset,
+ GlobalReset,
+ GlobalResetWithEc
+} PCH_RESET_TYPE;
+
+//
+// Member functions
+//
+/**
+ Execute Pch Reset from the host controller.
+
+ @param[in] This Pointer to the PCH_RESET_PROTOCOL instance.
+ @param[in] PchResetType Pch Reset Types which includes ColdReset, WarmReset, ShutdownReset,
+ PowerCycleReset, GlobalReset, GlobalResetWithEc
+
+ @retval EFI_SUCCESS Successfully completed.
+ @retval EFI_INVALID_PARAMETER If ResetType is invalid.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *PCH_RESET) (
+ IN PCH_RESET_PROTOCOL * This,
+ IN PCH_RESET_TYPE PchResetType
+ );
+
+/**
+ Execute call back function for Pch Reset.
+
+ @param[in] PchResetType Pch Reset Types which includes PowerCycle, Globalreset.
+
+ @retval EFI_SUCCESS The callback function has been done successfully
+ @retval EFI_NOT_FOUND Failed to find Pch Reset Callback protocol. Or, none of
+ callback protocol is installed.
+ @retval Others Do not do any reset from PCH
+**/
+typedef
+EFI_STATUS
+(EFIAPI *PCH_RESET_CALLBACK) (
+ IN PCH_RESET_TYPE PchResetType
+ );
+
+///
+/// Interface structure for the Pch Reset Protocol
+///
+struct _PCH_RESET_PROTOCOL {
+ PCH_RESET Reset;
+};
+
+///
+/// PCH_RESET_CALLBACK_PROTOCOL Structure Definition
+///
+/// This protocol is used to execute PCH Reset from the host controller.
+/// The PCH Reset protocol and PCH Reset PPI implement the Intel (R) PCH Reset Interface
+/// for DXE and PEI environments, respectively. If other drivers need to run their
+/// callback function right before issuing the reset, they can install PCH Reset
+/// Callback Protocol/PPI before PCH Reset DXE/PEI driver to achieve that.
+///
+struct _PCH_RESET_CALLBACK_PROTOCOL {
+ PCH_RESET_CALLBACK ResetCallback;
+};
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Protocol/PchS3Support/PchS3Support.c b/ReferenceCode/Chipset/LynxPoint/Protocol/PchS3Support/PchS3Support.c
new file mode 100644
index 0000000..284ad1e
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Protocol/PchS3Support/PchS3Support.c
@@ -0,0 +1,43 @@
+/** @file
+ This file defines the PCH S3 Support Protocol.
+
+@copyright
+ Copyright (c) 2008 - 2015 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+//
+// Statements that include other files
+//
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#endif
+
+#include "PchS3Support.h"
+
+//
+// Protocol GUID definition
+//
+EFI_GUID gEfiPchS3SupportProtocolGuid = EFI_PCH_S3_SUPPORT_PROTOCOL_GUID;
+EFI_GUID gEfiPchS3SupportSmmProtocolGuid = EFI_PCH_S3_SUPPORT_SMM_PROTOCOL_GUID;
+
+//
+// Protocol description
+//
+EFI_GUID_STRING(&gEfiPchS3SupportProtocolGuid, "PCH S3 Support Protocol", "PCH S3 Support Protocol");
+EFI_GUID_STRING(&gEfiPchS3SupportSmmProtocolGuid, "PCH S3 SMM Support Protocol", "PCH S3 SMM Support Protocol");
diff --git a/ReferenceCode/Chipset/LynxPoint/Protocol/PchS3Support/PchS3Support.h b/ReferenceCode/Chipset/LynxPoint/Protocol/PchS3Support/PchS3Support.h
new file mode 100644
index 0000000..5ac64a6
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Protocol/PchS3Support/PchS3Support.h
@@ -0,0 +1,218 @@
+/** @file
+ This file defines the PCH S3 support Protocol.
+
+@copyright
+ Copyright (c) 2008 - 2015 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _PCH_S3_SUPPORT_PROTOCOL_H_
+#define _PCH_S3_SUPPORT_PROTOCOL_H_
+
+///
+/// Define the PCH S3 Support protocol GUID
+///
+/// EDK and EDKII have different GUID formats
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#define EFI_PCH_S3_SUPPORT_PROTOCOL_GUID \
+ { \
+ 0x2224aee3, 0x8d0b, 0x480a, 0xb2, 0x72, 0x2a, 0xbe, 0x92, 0xcd, 0x4e, 0x78 \
+ }
+#else
+#define EFI_PCH_S3_SUPPORT_PROTOCOL_GUID \
+ { \
+ 0x2224aee3, 0x8d0b, 0x480a, \
+ { \
+ 0xb2, 0x72, 0x2a, 0xbe, 0x92, 0xcd, 0x4e, 0x78 \
+ } \
+ }
+#endif
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#define EFI_PCH_S3_SUPPORT_SMM_PROTOCOL_GUID \
+ { \
+ 0xe8fe82e8, 0x7d00, 0x41ff, 0x91, 0x1e, 0xb, 0x99, 0x6f, 0x85, 0xc9, 0x57 \
+ }
+#else
+#define EFI_PCH_S3_SUPPORT_SMM_PROTOCOL_GUID \
+ { \
+ 0xe8fe82e8, 0x7d00, 0x41ff, \
+ { \
+ 0x91, 0x1e, 0xb, 0x99, 0x6f, 0x85, 0xc9, 0x57 \
+ } \
+ }
+#endif
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#define EFI_PCH_S3_SUPPORT_DATA_GUID \
+ { 0xd5beb067, 0xc08e, 0x40fb, 0x8f, 0x27, 0x52, 0x0, 0xcf, 0xe4, 0x2c, 0x9 }
+#else
+#define EFI_PCH_S3_SUPPORT_DATA_GUID \
+ { 0xd5beb067, 0xc08e, 0x40fb, { 0x8f, 0x27, 0x52, 0x0, 0xcf, 0xe4, 0x2c, 0x9 } }
+#endif
+
+#include "PchPlatformPolicy/PchPlatformPolicy.h"
+
+//
+// Extern the GUID for protocol users.
+//
+extern EFI_GUID gEfiPchS3SupportProtocolGuid;
+extern EFI_GUID gEfiPchS3SupportSmmProtocolGuid;
+extern EFI_GUID gS3SupportSmramDataGuid;
+
+//
+// Forward reference for ANSI C compatibility
+//
+typedef struct _EFI_PCH_S3_SUPPORT_PROTOCOL EFI_PCH_S3_SUPPORT_PROTOCOL;
+typedef struct _EFI_PCH_S3_SUPPORT_SMM_PROTOCOL EFI_PCH_S3_SUPPORT_SMM_PROTOCOL;
+
+typedef enum {
+ PchS3ItemTypeSendCodecCommand,
+ PchS3ItemTypeInitPcieRootPortDownstream,
+ PchS3ItemTypePcieSetPm,
+ PchS3ItemTypeProgramIobp,
+ PchS3ItemTypeMax
+} EFI_PCH_S3_DISPATCH_ITEM_TYPE;
+
+///
+/// In the following structures it is required that they are usable in both PEI (32-bit) and DXE (64-bit).
+/// As a result, Pointers and Enumerations will be of different underlying sizes. Therefore neither should
+/// appear in the middle of these structures. If done, then size adjustment will need to be explicit
+/// via other mechanisms (like a union).
+///
+typedef struct {
+ UINT32 HdaBar;
+ UINT32 CodecCmdData;
+} EFI_PCH_S3_PARAMETER_SEND_CODEC_COMMAND;
+
+typedef struct {
+ UINT8 RootPortBus;
+ UINT8 RootPortDevice;
+ UINT8 RootPortFunc;
+ UINT8 TempBusNumberMin;
+ UINT8 TempBusNumberMax;
+} EFI_PCH_S3_PARAMETER_INIT_PCIE_ROOT_PORT_DOWNSTREAM;
+
+typedef struct {
+ UINT8 RootPortBus;
+ UINT8 RootPortDevice;
+ UINT8 RootPortFunc;
+ PCH_PCI_EXPRESS_ASPM_CONTROL RootPortAspm;
+ UINT8 NumOfDevAspmOverride;
+ UINT32 DevAspmOverrideAddr;
+ UINT8 TempBusNumberMin;
+ UINT8 TempBusNumberMax;
+ UINT8 NumOfDevLtrOverride;
+ UINT32 DevLtrOverrideAddr;
+ UINT32 PchPwrOptPcie;
+ PCH_PCIE_EXPRESS_L1SUBSTATES_CONTROL L1SubstatesConfig;
+ UINT8 PolicyRevision;
+ BOOLEAN FirstRPToSetPm;
+ BOOLEAN L1SupportedInAllEnabledPorts;
+ BOOLEAN ClkreqSupportedInAllEnabledPorts;
+} EFI_PCH_S3_PARAMETER_PCIE_SET_PM;
+
+typedef struct {
+ UINT32 RootComplexBar;
+ UINT32 Address;
+ UINT32 AndMask;
+ UINT32 OrMask;
+} EFI_PCH_S3_PARAMETER_PROG_IOBP;
+
+typedef struct {
+ union { // The union definition is in place because this structure
+ EFI_PCH_S3_DISPATCH_ITEM_TYPE Value; // is used in both DXE and PEI where enumerations are
+ UINT64 Spacer; // different sizes.
+ } ItemType;
+ VOID *Parameter;
+} EFI_PCH_S3_DISPATCH_ITEM;
+
+typedef struct {
+ EFI_GUID PchS3CustomScriptGuid;
+ UINT32 MaximumBufferSize;
+ UINT32 BufferSpaceRemaining;
+ UINT8 *NextDispatchItem;
+ //EFI_PCH_S3_DISPATCH_ITEM DispatchItemAray[] // This structure is followed in memory
+ // by an Array of EFI_PCH_S3_DISPATCH_ITEM structures
+} EFI_PCH_S3_DISPATCH_ARRAY;
+
+#define QWORD_ALIGNED_SIZE(x) ((sizeof (x) + 7) / 8 * 8) // QWORD alignment is needed for the variable lengths
+ // of the "Parameter" field of the EFI_PCH_S3_DISPATCH_ITEM
+ // structure. Alignment must be maintained between
+ // the 32-bit PEI code and 64-bit DXE code.
+
+//
+// Member functions
+//
+/**
+ Set an item to be dispatched at S3 resume time. At the same time, the entry point
+ of the PCH S3 support image is returned to be used in subsequent boot script save
+ call
+
+ @param[in] This Pointer to the protocol instance.
+ @param[in] DispatchItem The item to be dispatched.
+ @param[out] S3DispatchEntryPoint The entry point of the PCH S3 support image.
+
+ @retval EFI_STATUS Successfully completed.
+ @retval EFI_OUT_OF_RESOURCES Out of resources.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_PCH_S3_SUPPORT_SET_S3_DISPATCH_ITEM) (
+ IN EFI_PCH_S3_SUPPORT_PROTOCOL * This,
+ IN EFI_PCH_S3_DISPATCH_ITEM * DispatchItem,
+ OUT EFI_PHYSICAL_ADDRESS * S3DispatchEntryPoint
+ );
+
+/**
+ Perform the EFI_PCH_S3_SUPPORT_SMM_PROTOCOL IO Trap to invoke DispatchArray data copy and
+ IO Trap Unregister.
+
+ @param[in] This Pointer to the protocol instance.
+
+ @retval EFI_STATUS Successfully completed.
+ @retval EFI_OUT_OF_RESOURCES Out of resources.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_PCH_S3_SUPPORT_READY_TO_LOCK) (
+ IN EFI_PCH_S3_SUPPORT_PROTOCOL *This
+ );
+
+///
+/// Protocol definition
+///
+/// This Protocol is used to set an item to be dispatched at S3 resume time.
+/// At the same time, the entry point of the PCH S3 support image is returned to
+/// be used in subsequent boot script save call.
+///
+struct _EFI_PCH_S3_SUPPORT_PROTOCOL {
+ EFI_PCH_S3_SUPPORT_SET_S3_DISPATCH_ITEM SetDispatchItem; ///< Set the item to be dispatched at S3 resume time.
+ EFI_PCH_S3_SUPPORT_READY_TO_LOCK ReadyToLock; ///< The caller is finished using the protocol and it can be locked.
+};
+
+
+///
+/// Protocol Definition
+///
+/// This Protocol is used to communicate the location of the Boot Services copy of the EFI_PCH_S3_DISPATCH_ARRAY.
+/// The pointer is then used to allow the SMM module to copy the data to the appropriate SMRAM location. The
+/// ProtocolSize is communicated in # of Pages.
+///
+struct _EFI_PCH_S3_SUPPORT_SMM_PROTOCOL {
+ UINT16 ProtocolSize; ///< Protocol size in Pages (due to Page alignment requirements in SMM)
+ UINT16 PchS3SupportIoTrap; ///< IO Trap port to support ExitPmAuth notification for copy and unregister
+ EFI_PCH_S3_DISPATCH_ARRAY *DispatchArray; ///< A pointer to the Boot Services copy of the Dispatch Array
+};
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Protocol/PchSmmIoTrapControl/PchSmmIoTrapControl.c b/ReferenceCode/Chipset/LynxPoint/Protocol/PchSmmIoTrapControl/PchSmmIoTrapControl.c
new file mode 100644
index 0000000..c32e7ff
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Protocol/PchSmmIoTrapControl/PchSmmIoTrapControl.c
@@ -0,0 +1,42 @@
+/** @file
+ This file defines the PCH SMM IO Trap Control Protocol
+
+@copyright
+ Copyright (c) 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+//
+// Include the protocol header file
+//
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+
+#include "EdkIIGlueDxe.h"
+#endif
+
+#include "PchSmmIoTrapControl.h"
+
+//
+// Protocol GUID definition
+//
+EFI_GUID gPchSmmIoTrapControlGuid = PCH_SMM_IO_TRAP_CONTROL_GUID;
+
+//
+// Protocol description
+//
+EFI_GUID_STRING(&gPchSmmIoTrapDispatchProtocolGuid, "PCH IO Trap Control Protocol", "EFI PCH SMM IO Trap Control Protocol");
diff --git a/ReferenceCode/Chipset/LynxPoint/Protocol/PchSmmIoTrapControl/PchSmmIoTrapControl.h b/ReferenceCode/Chipset/LynxPoint/Protocol/PchSmmIoTrapControl/PchSmmIoTrapControl.h
new file mode 100644
index 0000000..2e0395e
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Protocol/PchSmmIoTrapControl/PchSmmIoTrapControl.h
@@ -0,0 +1,90 @@
+/** @file
+ PCH SMM IO Trap Control Protocol
+
+@copyright
+ Copyright (c) 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _PCH_SMM_IO_TRAP_CONTROL_H_
+#define _PCH_SMM_IO_TRAP_CONTROL_H_
+
+///
+/// GUID for the SMM IO Trap Control Protocol
+///
+/// EDK and EDKII have different GUID formats
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#define PCH_SMM_IO_TRAP_CONTROL_GUID \
+ { \
+ 0x514D2AFD, 0x2096, 0x4283, 0x9D, 0xA6, 0x70, 0x0C, 0xD2, 0x7D, 0xC7, 0xA5 \
+ }
+#else
+#define PCH_SMM_IO_TRAP_CONTROL_GUID \
+ { \
+ 0x514D2AFD, 0x2096, 0x4283, \
+ { \
+ 0x9D, 0xA6, 0x70, 0x0C, 0xD2, 0x7D, 0xC7, 0xA5 \
+ } \
+ }
+#endif
+
+//
+// Extern the GUID for protocol users.
+//
+extern EFI_GUID gPchSmmIoTrapControlGuid;
+
+//
+// Forward reference for ANSI C compatibility
+//
+typedef struct _PCH_SMM_IO_TRAP_CONTROL_PROTOCOL PCH_SMM_IO_TRAP_CONTROL_PROTOCOL;
+
+//
+// Related Definitions
+//
+
+//
+// Member functions
+//
+
+/**
+ The Prototype of Pause and Resume IoTrap callback function.
+
+ @param[in] This Pointer to the PCH_SMM_IO_TRAP_CONTROL_PROTOCOL instance.
+ @param[in] DispatchHandle Handle of the child service to change state.
+
+ @retval EFI_SUCCESS This operation is complete.
+ @retval EFI_INVALID_PARAMETER The DispatchHandle is invalid.
+ @retval EFI_ACCESS_DENIED The SMI status is alrady PAUSED/RESUMED.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *PCH_SMM_IO_TRAP_CONTROL_FUNCTION) (
+ IN PCH_SMM_IO_TRAP_CONTROL_PROTOCOL * This,
+ IN EFI_HANDLE DispatchHandle
+ );
+
+/**
+ Interface structure for the SMM IO trap pause and resume protocol
+ This protocol provides the functions to runtime control the IoTrap SMI enabled/disable.
+ This applys the capability to the DispatchHandle which returned by IoTrap callback
+ registration, and the DispatchHandle which must be MergeDisable = TRUE and Address != 0.
+ Besides, when S3 resuem, it only restores the state of IoTrap callback registration.
+ The Paused/Resume state won't be restored after S3 resume.
+**/
+struct _PCH_SMM_IO_TRAP_CONTROL_PROTOCOL {
+ PCH_SMM_IO_TRAP_CONTROL_FUNCTION Pause;
+ PCH_SMM_IO_TRAP_CONTROL_FUNCTION Resume;
+};
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Protocol/SerialGpio/SerialGpio.c b/ReferenceCode/Chipset/LynxPoint/Protocol/SerialGpio/SerialGpio.c
new file mode 100644
index 0000000..09c40e1
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Protocol/SerialGpio/SerialGpio.c
@@ -0,0 +1,34 @@
+/** @file
+ This file defines the EFI Serial GPIO Interface Protocol which implements the
+ Intel(R) Serial Data over GPIO Pin functionality Protocol Interface.
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+//
+// Include the protocol header file
+//
+#include "SerialGpio.h"
+
+//
+// Protocol GUID definition
+//
+EFI_GUID gEfiSerialGpioProtocolGuid = EFI_SERIAL_GPIO_PROTOCOL_GUID;
+
+//
+// Protocol description
+//
+EFI_GUID_STRING(&gEfiSerialGpioProtocolGuid, "Serial GPIO Protocol", "Intel(R) Serial GPIO Interface Protocol");
diff --git a/ReferenceCode/Chipset/LynxPoint/Protocol/SerialGpio/SerialGpio.h b/ReferenceCode/Chipset/LynxPoint/Protocol/SerialGpio/SerialGpio.h
new file mode 100644
index 0000000..9559cb1
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Protocol/SerialGpio/SerialGpio.h
@@ -0,0 +1,166 @@
+/** @file
+ This file defines the EFI Serial GPIO Interface Protocol which implements the
+ Intel(R) Serial Data over GPIO Pin functionality Protocol Interface.
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _EFI_SERIAL_GPIO_H_
+#define _EFI_SERIAL_GPIO_H_
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+
+#include "EdkIIGlueDxe.h"
+#endif
+///
+/// Define the Serial GPIO protocol GUID
+///
+/// EDK and EDKII have different GUID formats
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#define EFI_SERIAL_GPIO_PROTOCOL_GUID \
+ { \
+ 0xf52c3858, 0x5ef8, 0x4d41, 0x83, 0x4e, 0xc3, 0x9e, 0xef, 0x8a, 0x45, 0xa3 \
+ }
+#else
+#define EFI_SERIAL_GPIO_PROTOCOL_GUID \
+ { \
+ 0xf52c3858, 0x5ef8, 0x4d41, \
+ { \
+ 0x83, 0x4e, 0xc3, 0x9e, 0xef, 0x8a, 0x45, 0xa3 \
+ } \
+ }
+#endif
+//
+// Extern the GUID for protocol users.
+//
+extern EFI_GUID gEfiSerialGpioProtocolGuid;
+//
+// Forward reference for ANSI C compatibility
+//
+typedef struct _EFI_SERIAL_GPIO_PROTOCOL EFI_SERIAL_GPIO_PROTOCOL;
+
+//
+// This is the max number of GPIO pins in this ICH chipset that support Blink feature
+// 0~31 GPIO in ICH8M support blink feature
+//
+#define SERIAL_GPIO_MAX_PIN_NUMBER 32
+#define SERIAL_GPIO_MAX_DATA_RATE 63
+#define WAIT_TIME 100000
+#define WAIT_PERIOD 10
+
+///
+/// Serial GPIO protocol data structures and definitions
+///
+typedef enum {
+ EnumSerialGpioDataByte,
+ EnumSerialGpioDataWord,
+ EnumSerialGpioDataUndefined,
+ EnumSerialGpioDataDword,
+ EnumSerialGpioDataMax
+} SERIAL_GPIO_DATA_WIDTH;
+
+//
+// Protocol member functions
+//
+/**
+ Register for one GPIO Pin that will be used as serial GPIO.
+ For PCH only GPIO0~31 will have the capability to be used as serail GPIO.
+ The caller of this procedure need to be very clear of whPch GPIO should be used as serail GPIO,
+ it should not be input, native, conflict with other GPIO, or Index > 31 on the caller's platform.
+
+ @param[in] This Pointer to the EFI_SERIAL_GPIO_PROTOCOL instance.
+ @param[in] SerialGpioPinIndex The GPIO pin Index that will be used as serial GPIO for data sending.
+
+ @retval EFI_SUCCESS Opcode initialization on the SERIAL_GPIO host controller completed.
+ @retval EFI_ACCESS_DENIED The SERIAL_GPIO configuration interface is locked.
+ @retval EFI_OUT_OF_RESOURCES Not enough resource available to initialize the device.
+ @retval EFI_DEVICE_ERROR Device error, operation failed.
+ @retval EFI_INVALID_PARAMETER SerialGpioPinIndex is out of range
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_SERIAL_GPIO_REGISTER) (
+ IN EFI_SERIAL_GPIO_PROTOCOL * This,
+ IN UINT8 SerialGpioPinIndex
+ );
+
+/**
+ Unregister for one GPIO Pin that has been used as serial GPIO, and recover the registers before
+ registering.
+
+ @param[in] This Pointer to the EFI_SERIAL_GPIO_PROTOCOL instance.
+ @param[in] SerialGpioPinIndex The GPIO pin Index that will be used as serial GPIO for data sending.
+
+ @retval EFI_SUCCESS Opcode initialization on the SERIAL_GPIO host controller completed.
+ @retval EFI_ACCESS_DENIED The SERIAL_GPIO configuration interface is locked.
+ @retval EFI_OUT_OF_RESOURCES Not enough resource available to initialize the device.
+ @retval EFI_DEVICE_ERROR Device error, operation failed.
+ @retval EFI_INVALID_PARAMETER Invalid function parameters
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_SERIAL_GPIO_UNREGISTER) (
+ IN EFI_SERIAL_GPIO_PROTOCOL * This,
+ IN UINT8 SerialGpioPinIndex
+ );
+
+/**
+ Execute SERIAL_GPIO commands from the host controller.
+
+ @param[in] This Pointer to the EFI_SERIAL_GPIO_PROTOCOL instance.
+ @param[in] GpioPinIndex Index of the GPIO pin.
+ @param[in] DataRate The data rate for serail data transfering. 1 ~ SERIAL_GPIO_MAX_DATA_RATE; 1: 128ns intervals; ...; 8: 8*128 = 1024ns intervals, default value;...
+ @param[in] DataCountInByte Number of bytes of the data will be transmitted through the GPIO pin.
+ @param[in, out] Buffer Pointer to caller-allocated buffer containing the dada sent through the GPIO pin.
+
+ @retval EFI_SUCCESS Execute succeed.
+ @retval EFI_INVALID_PARAMETER The parameters specified are not valid.
+ @retval EFI_DEVICE_ERROR Device error, GPIO serial data sent failed.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_SERIAL_GPIO_SEND_DATA) (
+ IN EFI_SERIAL_GPIO_PROTOCOL * This,
+ IN UINT8 GpioPinIndex,
+ IN UINT8 DataRate,
+ IN UINTN DataCountInByte,
+ IN OUT UINT8 *Buffer
+ );
+
+///
+/// Protocol definition
+///
+/// This Protocol allows a platform module to execute the IntelR Serial Data over
+/// GPIO Pin functionality Protocol Interface.
+/// The caller will first call the SerialGpioRegister() function to configure the GPIO
+/// to be used. Then the caller will execute one or more calls to the SerialGpioSendData()
+/// function to perform serial GPIO activities. Finally, the caller will use the
+/// SerialGpioUnRegister() function to un-register and allow other consumers to utilize
+/// the serial GPIO services.
+/// If the serial GPIO capabilities are in use by another caller, the registration
+/// function will return an error.
+///
+struct _EFI_SERIAL_GPIO_PROTOCOL {
+ EFI_SERIAL_GPIO_REGISTER SerialGpioRegister; ///< Register for one GPIO pin that will be used as serial GPIO.
+ EFI_SERIAL_GPIO_SEND_DATA SerialGpioSendData; ///< Execute SERIAL_GPIO commands from the host controller.
+ EFI_SERIAL_GPIO_UNREGISTER SerialGpioUnRegister; ///< Un-register the current GPIO pin used for serial GPIO, and recovers the registers before registering.
+};
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Protocol/SmmIchnDispatchEx/SmmIchnDispatchEx.c b/ReferenceCode/Chipset/LynxPoint/Protocol/SmmIchnDispatchEx/SmmIchnDispatchEx.c
new file mode 100644
index 0000000..224e62f
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Protocol/SmmIchnDispatchEx/SmmIchnDispatchEx.c
@@ -0,0 +1,46 @@
+/** @file
+ This file defines the SmmIchnDispatch Extended Protocol
+
+@copyright
+ Copyright (c) 2008 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+//
+// Include the protocol header file
+//
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+
+#include "EdkIIGlueDxe.h"
+#endif
+
+#include "SmmIchnDispatchEx.h"
+
+//
+// Protocol GUID definition
+//
+EFI_GUID gEfiSmmIchnDispatchExProtocolGuid = EFI_SMM_ICHN_DISPATCH_EX_PROTOCOL_GUID;
+
+//
+// Protocol description
+//
+EFI_GUID_STRING
+ (
+ &gEfiSmmIchnDispatchExProtocolGuid, "SMM ICHn SMI Dispatch Extended Protocol",
+ "EFI 2.0 SMM ICHn SMI Dispatch Extended Protocol"
+ );
diff --git a/ReferenceCode/Chipset/LynxPoint/Protocol/SmmIchnDispatchEx/SmmIchnDispatchEx.h b/ReferenceCode/Chipset/LynxPoint/Protocol/SmmIchnDispatchEx/SmmIchnDispatchEx.h
new file mode 100644
index 0000000..79e5ad7
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Protocol/SmmIchnDispatchEx/SmmIchnDispatchEx.h
@@ -0,0 +1,177 @@
+/** @file
+ SmmIchnDispatch Extended Protocol
+
+@copyright
+ Copyright (c) 2008 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _EFI_SMM_ICHN_DISPATCH_EX_H_
+#define _EFI_SMM_ICHN_DISPATCH_EX_H_
+
+///
+/// GUID for the SmmIchnDispatch Extended Protocol
+///
+/// EDK and EDKII have different GUID formats
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#define EFI_SMM_ICHN_DISPATCH_EX_PROTOCOL_GUID \
+ { \
+ 0x3920405b, 0xc897, 0x44da, 0x88, 0xf3, 0x4c, 0x49, 0x8a, 0x6f, 0xf7, 0x36 \
+ }
+#else
+#define EFI_SMM_ICHN_DISPATCH_EX_PROTOCOL_GUID \
+ { \
+ 0x3920405b, 0xc897, 0x44da, \
+ { \
+ 0x88, 0xf3, 0x4c, 0x49, 0x8a, 0x6f, 0xf7, 0x36 \
+ } \
+ }
+
+#endif
+//
+// Extern the GUID for protocol users.
+//
+extern EFI_GUID gEfiSmmIchnDispatchExProtocolGuid;
+
+//
+// Forward reference for ANSI C compatibility
+//
+typedef struct _EFI_SMM_ICHN_DISPATCH_EX_PROTOCOL EFI_SMM_ICHN_DISPATCH_EX_PROTOCOL;
+
+//
+// Related Definitions
+//
+///
+/// Ichn Dispatch Extended Types
+///
+typedef enum {
+ IchnExPciExpress = NUM_ICHN_TYPES + 1,
+ IchnExMonitor,
+ IchnExSpi,
+ IchnExQRT,
+ IchnExGpioUnlock,
+ IchnExTmrOverflow,
+ IchnExPcie0Hotplug,
+ IchnExPcie1Hotplug,
+ IchnExPcie2Hotplug,
+ IchnExPcie3Hotplug,
+ IchnExPcie4Hotplug,
+ IchnExPcie5Hotplug,
+ IchnExPcie6Hotplug,
+ IchnExPcie7Hotplug,
+ IchnExPcie0LinkActive,
+ IchnExPcie1LinkActive,
+ IchnExPcie2LinkActive,
+ IchnExPcie3LinkActive,
+ IchnExPcie4LinkActive,
+ IchnExPcie5LinkActive,
+ IchnExPcie6LinkActive,
+ IchnExPcie7LinkActive,
+ //
+ // INSERT NEW ITEMS JUST BEFORE THIS LINE
+ //
+ IchnExTypeMAX ///< the maximum number of items in this enumeration
+} EFI_SMM_ICHN_EX_SMI_TYPE;
+
+typedef struct {
+ EFI_SMM_ICHN_EX_SMI_TYPE Type;
+} EFI_SMM_ICHN_DISPATCH_EX_CONTEXT;
+
+//
+// Member functions
+//
+
+/**
+ Dispatch function for a ICH n Extended specific SMI handler.
+
+ @param[in] DispatchHandle Handle of this dispatch function.
+ @param[in] DispatchContext Pointer to the dispatch function's context.
+ The DispatchContext fields are filled in
+ by the dispatching driver prior to
+ invoking this dispatch function.
+
+ @retval None
+**/
+typedef
+VOID
+(EFIAPI *EFI_SMM_ICHN_DISPATCH_EX) (
+ IN EFI_HANDLE DispatchHandle,
+ IN EFI_SMM_ICHN_DISPATCH_EX_CONTEXT * DispatchContext
+ );
+
+/**
+ Register a child SMI source dispatch function with a parent SMM driver
+
+ @param[in] This Protocol instance pointer.
+ @param[in] DispatchFunction Pointer to dispatch function to be invoked for
+ this SMI source
+ @param[in] DispatchContext Pointer to the dispatch function's context.
+ The caller fills this context in before calling
+ the register function to indicate to the register
+ function the ICHN SMI source for which the dispatch
+ function should be invoked.
+ @param[out] DispatchHandle Handle of dispatch function, for when interfacing
+ with the parent SMM driver.
+
+ @retval EFI_SUCCESS The dispatch function has been successfully
+ registered and the SMI source has been enabled.
+ @retval EFI_DEVICE_ERROR The driver was unable to enable the SMI source.
+ @retval EFI_OUT_OF_RESOURCES Not enough memory (system or SMM) to manage this
+ child.
+ @retval EFI_INVALID_PARAMETER DispatchContext is invalid. The ICHN input value
+ is not within valid range.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_SMM_ICHN_EX_REGISTER) (
+ IN EFI_SMM_ICHN_DISPATCH_EX_PROTOCOL * This,
+ IN EFI_SMM_ICHN_DISPATCH_EX DispatchFunction,
+ IN EFI_SMM_ICHN_DISPATCH_EX_CONTEXT * DispatchContext,
+ OUT EFI_HANDLE * DispatchHandle
+ );
+
+/**
+ Unregister a child SMI source dispatch function with a parent SMM driver
+
+ @param[in] This Protocol instance pointer.
+ @param[in] DispatchHandle Handle of dispatch function to deregister.
+
+ @retval EFI_SUCCESS The dispatch function has been successfully
+ unregistered and the SMI source has been disabled
+ if there are no other registered child dispatch
+ functions for this SMI source.
+ @retval EFI_INVALID_PARAMETER Handle is invalid.
+ @retval Others TBD
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_SMM_ICHN_EX_UNREGISTER) (
+ IN EFI_SMM_ICHN_DISPATCH_EX_PROTOCOL * This,
+ IN EFI_HANDLE DispatchHandle
+ );
+
+///
+/// Interface structure for the SMM Ich n specific SMI Dispatch Protocol
+///
+/// This protocol provides the ability to dispatch function for a ICHn specific SMI.
+/// This protocol acts as an extension to the EFI_SMM_ICHN_DISPATCH_PROTOCOL capabilities
+/// by defining several new SMI types: IchnExPciExpress, IchnExMonitor, IchnExSpi,
+/// IchnExQRT, IchnGpioUnlockSmi, IchnExTmrOverflow, IchnExPcieXHotplug, IchnExPcieXLinkActive.
+///
+struct _EFI_SMM_ICHN_DISPATCH_EX_PROTOCOL {
+ EFI_SMM_ICHN_EX_REGISTER Register; ///< Register a child SMI source dispatch function with a parent SMM driver.
+ EFI_SMM_ICHN_EX_UNREGISTER UnRegister; ///< Un-register a child SMI source dispatch function with a parent SMM driver.
+};
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Protocol/SmmIoTrapDispatch/SmmIoTrapDispatch.c b/ReferenceCode/Chipset/LynxPoint/Protocol/SmmIoTrapDispatch/SmmIoTrapDispatch.c
new file mode 100644
index 0000000..dfd348f
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Protocol/SmmIoTrapDispatch/SmmIoTrapDispatch.c
@@ -0,0 +1,42 @@
+/** @file
+ This file defines the PCH SMM IO Trap Dispatch Protocol
+
+@copyright
+ Copyright (c) 2005 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+//
+// Include the protocol header file
+//
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+
+#include "EdkIIGlueDxe.h"
+#endif
+
+#include "SmmIoTrapDispatch.h"
+
+//
+// Protocol GUID definition
+//
+EFI_GUID gEfiSmmIoTrapDispatchProtocolGuid = EFI_SMM_IO_TRAP_DISPATCH_PROTOCOL_GUID;
+
+//
+// Protocol description
+//
+EFI_GUID_STRING(&gEfiSmmIoTrapDispatchProtocolGuid, "SMM IO Trap Protocol", "EFI PCH SMM IO Trap Protocol");
diff --git a/ReferenceCode/Chipset/LynxPoint/Protocol/SmmIoTrapDispatch/SmmIoTrapDispatch.h b/ReferenceCode/Chipset/LynxPoint/Protocol/SmmIoTrapDispatch/SmmIoTrapDispatch.h
new file mode 100644
index 0000000..8923d3c
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Protocol/SmmIoTrapDispatch/SmmIoTrapDispatch.h
@@ -0,0 +1,182 @@
+/** @file
+ PCH SMM IO Trap Dispatch Protocol
+
+@copyright
+ Copyright (c) 2005 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _EFI_SMM_IO_TRAP_DISPATCH_H_
+#define _EFI_SMM_IO_TRAP_DISPATCH_H_
+
+///
+/// GUID for the SMM IO Trap Dispatch Protocol
+///
+/// EDK and EDKII have different GUID formats
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#define EFI_SMM_IO_TRAP_DISPATCH_PROTOCOL_GUID \
+ { \
+ 0xdb7f536b, 0xede4, 0x4714, 0xa5, 0xc8, 0xe3, 0x46, 0xeb, 0xaa, 0x20, 0x1d \
+ }
+#else
+#define EFI_SMM_IO_TRAP_DISPATCH_PROTOCOL_GUID \
+ { \
+ 0xdb7f536b, 0xede4, 0x4714, \
+ { \
+ 0xa5, 0xc8, 0xe3, 0x46, 0xeb, 0xaa, 0x20, 0x1d \
+ } \
+ }
+#endif
+//
+// Extern the GUID for protocol users.
+//
+extern EFI_GUID gEfiSmmIoTrapDispatchProtocolGuid;
+
+//
+// Forward reference for ANSI C compatibility
+//
+typedef struct _EFI_SMM_IO_TRAP_DISPATCH_PROTOCOL EFI_SMM_IO_TRAP_DISPATCH_PROTOCOL;
+
+//
+// Related Definitions
+//
+///
+/// IO Trap valid types
+///
+typedef enum {
+ WriteTrap,
+ ReadTrap,
+ ReadWriteTrap,
+ IoTrapTypeMaximum
+} EFI_SMM_IO_TRAP_DISPATCH_TYPE;
+
+///
+/// IO Trap context structure containing information about the IO trap event that should invoke the callback
+///
+typedef struct {
+ UINT16 Address; ///< IO Trap range base address (NULL means allocate)
+ UINT16 Length; ///< IO Trap range length
+ EFI_SMM_IO_TRAP_DISPATCH_TYPE Type; ///< Access types to trap on
+ VOID *Context; ///< Callback function context
+ BOOLEAN MergeDisable; ///< Determine if IoTrap needs to be merged with other registered IoTrap
+} EFI_SMM_IO_TRAP_DISPATCH_REGISTER_CONTEXT;
+
+///
+/// IO Trap context structure containing information about the IO trap that occurred
+///
+typedef struct {
+ UINT16 Address; ///< IO address trapped
+ EFI_SMM_IO_TRAP_DISPATCH_TYPE Type; ///< IO access type
+ UINT32 WriteData; ///< Data written (contents undefined for read trap)
+ VOID *Context; ///< Callback function context
+} EFI_SMM_IO_TRAP_DISPATCH_CALLBACK_CONTEXT;
+
+//
+// Member functions
+//
+
+/**
+ Dispatch function for an IO Trap specific SMI handler.
+
+ @param[in] DispatchHandle Handle of this dispatch function.
+ @param[in] CallbackContext Pointer to the dispatched function's context.
+ The CallbackContext fields are updated
+ by the dispatching driver prior to
+ invoking this callback function.
+
+ @retval None
+**/
+typedef
+VOID
+(EFIAPI *EFI_SMM_IO_TRAP_DISPATCH_CALLBACK) (
+ IN EFI_HANDLE DispatchHandle,
+ IN EFI_SMM_IO_TRAP_DISPATCH_CALLBACK_CONTEXT * CallbackContext
+ );
+
+/**
+ Register an IO trap SMI child handler for a specified SMI.
+ This service will register a child for a given SMI source.
+ The caller will provide information about the IO trap characteristics via the context.
+ This includes base address, length, and type (read, write, read/write).
+ The service will allocate the IO range if the base address is 0, and the RegisterContext
+ Address field will be updated and returned to the caller.
+ The service will allocate system resources via GCD services for the requested IO trap range and type.
+ An error will be returned if insufficient resources are available to fulfill the request.
+ The service will not perform GCD allocation if the base address is non-zero. In this case,
+ the caller is responsible for the existence and allocation of the specific IO range.
+ An error may be returned if some or all of the requested resources conflict with an existing IO trap child handler.
+ It is not required that implementations will allow multiple children for a single IO trap SMI source.
+ Some implementations may support multiple children.
+
+ @param[in] This Pointer to the EFI_SMM_IO_TRAP_DISPATCH_PROTOCOL instance.
+ @param[in] DispatchFunction Pointer to the dispatch function to be invoked for this SMI source.
+ @param[in, out] RegisterContext Pointer to the dispatch function's context.
+ The caller fills this context in before calling the register function to indicate to the
+ register function the IO trap SMI source for which the dispatch function should be invoked.
+ This may not be NULL.
+ @param[out] DispatchHandle Handle of the dispatch function, for when interfacing with the parent SMM driver.
+ Type EFI_HANDLE is defined in InstallProtocolInterface() in the EFI 1.10 Specification.
+ This may not be NULL.
+
+ @retval EFI_SUCCESS The dispatch function has been successfully registered.
+ @retval EFI_DEVICE_ERROR The driver was unable to complete due to hardware error.
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources are available to fulfill
+ the IO trap range request.
+ @retval EFI_INVALID_PARAMETER RegisterContext is invalid. The input value is not within a valid range.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_SMM_IO_TRAP_DISPATCH_REGISTER) (
+ IN EFI_SMM_IO_TRAP_DISPATCH_PROTOCOL * This,
+ IN EFI_SMM_IO_TRAP_DISPATCH_CALLBACK DispatchFunction,
+ IN OUT EFI_SMM_IO_TRAP_DISPATCH_REGISTER_CONTEXT * RegisterContext,
+ OUT EFI_HANDLE * DispatchHandle
+ );
+
+/**
+ Unregister a child SMI source dispatch function with a parent SMM driver
+
+ This service removes a previously installed child dispatch handler.
+ This does not guarantee that the system resources will be freed from the GCD.
+
+ @param[in] This Pointer to the EFI_SMM_IO_TRAP_DISPATCH_PROTOCOL instance.
+ @param[in] DispatchHandle Handle of the child service to remove.
+ Type EFI_HANDLE is defined in InstallProtocolInterface() in the EFI 1.10 Specification.
+
+ @retval EFI_SUCCESS The dispatch function has been successfully
+ unregistered.
+ @retval EFI_INVALID_PARAMETER Handle is invalid.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_SMM_IO_TRAP_DISPATCH_UNREGISTER) (
+ IN EFI_SMM_IO_TRAP_DISPATCH_PROTOCOL * This,
+ IN EFI_HANDLE * DispatchHandle
+ );
+
+///
+/// Interface structure for the SMM IO trap specific SMI Dispatch Protocol
+///
+/// This protocol provides the ability to install child handlers for IO trap SMI.
+/// These handlers will be invoked to respond to specific IO trap SMI. IO trap SMI
+/// would typically be generated on reads or writes to specific processor IO space
+/// addresses or ranges. This protocol will typically abstract a limited hardware
+/// resource, so callers should handle errors gracefully.
+///
+struct _EFI_SMM_IO_TRAP_DISPATCH_PROTOCOL {
+ EFI_SMM_IO_TRAP_DISPATCH_REGISTER Register; ///< Installs a child service to be dispatched when the requested IO trap SMI occurs.
+ EFI_SMM_IO_TRAP_DISPATCH_UNREGISTER UnRegister; ///< Removes a previously registered child service.
+};
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Protocol/Spi/Spi.c b/ReferenceCode/Chipset/LynxPoint/Protocol/Spi/Spi.c
new file mode 100644
index 0000000..2df15e8
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Protocol/Spi/Spi.c
@@ -0,0 +1,48 @@
+/** @file
+ This file defines the EFI SPI Protocol which implements the
+ Intel(R) SPI Host Controller Compatibility Interface.
+
+@copyright
+ Copyright (c) 2004 - 2015 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+//
+// Statements that include other files
+//
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#endif
+//
+// Include the protocol header file
+//
+#include "Spi.h"
+
+//
+// Protocol GUID definition
+//
+EFI_GUID gEfiSpiProtocolGuid = EFI_SPI_PROTOCOL_GUID;
+EFI_GUID gEfiSmmSpiProtocolGuid = EFI_SMM_SPI_PROTOCOL_GUID;
+EFI_GUID gEfiSpiDataProtocolGuid = EFI_SPI_DATA_PROTOCOL_GUID;
+
+//
+// Protocol description
+//
+EFI_GUID_STRING(&gEfiSpiProtocolGuid, "SPI Protocol", "Intel(R) Serial Peripheral Interface Protocol");
+EFI_GUID_STRING(&gEfiSmmSpiProtocolGuid, "SMM SPI Protocol", "Intel(R) Serial Peripheral Interface Protocol");
+EFI_GUID_STRING(&gEfiSpiDataProtocolGuid, "SPI Data Protocol", "Intel(R) Serial Peripheral Data Interface Protocol");
diff --git a/ReferenceCode/Chipset/LynxPoint/Protocol/Spi/Spi.h b/ReferenceCode/Chipset/LynxPoint/Protocol/Spi/Spi.h
new file mode 100644
index 0000000..d44332b
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Protocol/Spi/Spi.h
@@ -0,0 +1,346 @@
+/** @file
+ This file defines the EFI SPI Protocol which implements the
+ Intel(R) PCH SPI Host Controller Compatibility Interface.
+
+@copyright
+ Copyright (c) 2006 - 2015 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _EFI_SPI_H_
+#define _EFI_SPI_H_
+
+///
+/// Define the SPI protocol GUID
+///
+/// EDK and EDKII have different GUID formats
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#define EFI_SPI_PROTOCOL_GUID \
+ { \
+ 0xf8b84ae6, 0x8465, 0x4f95, 0x9f, 0xb, 0xea, 0xaa, 0x37, 0xc6, 0x15, 0x5a \
+ }
+#define EFI_SMM_SPI_PROTOCOL_GUID \
+ { \
+ 0xbd75fe35, 0xfdce, 0x49d7, 0xa9, 0xdd, 0xb2, 0x6f, 0x1f, 0xc6, 0xb4, 0x37 \
+ }
+#define EFI_SPI_DATA_PROTOCOL_GUID \
+ { \
+ 0xd617e1a8, 0x207d, 0x4544, 0xb1, 0x2d, 0x94, 0xd0, 0x96, 0x60, 0xa2, 0xd1 \
+ }
+#else
+#define EFI_SPI_PROTOCOL_GUID \
+ { \
+ 0xf8b84ae6, 0x8465, 0x4f95, \
+ { \
+ 0x9f, 0xb, 0xea, 0xaa, 0x37, 0xc6, 0x15, 0x5a \
+ } \
+ }
+#define EFI_SMM_SPI_PROTOCOL_GUID \
+ { \
+ 0xbd75fe35, 0xfdce, 0x49d7, \
+ { \
+ 0xa9, 0xdd, 0xb2, 0x6f, 0x1f, 0xc6, 0xb4, 0x37 \
+ } \
+ }
+#define EFI_SPI_DATA_PROTOCOL_GUID \
+ { \
+ 0xd617e1a8, 0x207d, 0x4544, \
+ { \
+ 0xb1, 0x2d, 0x94, 0xd0, 0x96, 0x60, 0xa2, 0xd1 \
+ } \
+ }
+#endif
+
+//
+// Extern the GUID for protocol users.
+//
+extern EFI_GUID gEfiSpiProtocolGuid;
+extern EFI_GUID gEfiSmmSpiProtocolGuid;
+extern EFI_GUID gEfiSpiDataProtocolGuid;
+
+//
+// Forward reference for ANSI C compatibility
+//
+typedef struct _EFI_SPI_PROTOCOL EFI_SPI_PROTOCOL;
+typedef struct _EFI_SPI_DATA_PROTOCOL EFI_SPI_DATA_PROTOCOL;
+
+//
+// SPI protocol data structures and definitions
+//
+///
+/// Number of Prefix Opcodes allowed on the SPI interface
+///
+#define SPI_NUM_PREFIX_OPCODE 2
+
+///
+/// Number of Opcodes in the Opcode Menu
+///
+#define SPI_NUM_OPCODE 8
+
+///
+/// Opcode Type
+/// EnumSpiOpcodeCommand: Command without address
+/// EnumSpiOpcodeRead: Read with address
+/// EnumSpiOpcodeWrite: Write with address
+///
+typedef enum {
+ EnumSpiOpcodeReadNoAddr,
+ EnumSpiOpcodeWriteNoAddr,
+ EnumSpiOpcodeRead,
+ EnumSpiOpcodeWrite,
+ EnumSpiOpcodeMax
+} SPI_OPCODE_TYPE;
+
+typedef enum {
+ EnumSpiCycle20MHz,
+ EnumSpiCycle33MHz,
+ EnumSpiCycle66MHz, ///< not supported by PCH
+ EnumSpiCycle50MHz,
+ EnumSpiCycleMax
+} SPI_CYCLE_FREQUENCY;
+
+typedef enum {
+ EnumSpiRegionAll,
+ EnumSpiRegionBios,
+ EnumSpiRegionMe,
+ EnumSpiRegionGbE,
+ EnumSpiRegionDescriptor,
+ EnumSpiRegionPlatformData,
+ EnumSpiRegionMax
+} SPI_REGION_TYPE;
+
+///
+/// Hardware Sequencing required operations (as listed in PCH EDS "Hardware
+/// Sequencing Commands and Opcode Requirements"
+///
+typedef enum {
+ EnumSpiOperationWriteStatus,
+ EnumSpiOperationProgramData_1_Byte,
+ EnumSpiOperationProgramData_64_Byte,
+ EnumSpiOperationReadData,
+ EnumSpiOperationWriteDisable,
+ EnumSpiOperationReadStatus,
+ EnumSpiOperationWriteEnable,
+ EnumSpiOperationFastRead,
+ EnumSpiOperationEnableWriteStatus,
+ EnumSpiOperationErase_256_Byte,
+ EnumSpiOperationErase_4K_Byte,
+ EnumSpiOperationErase_8K_Byte,
+ EnumSpiOperationErase_64K_Byte,
+ EnumSpiOperationFullChipErase,
+ EnumSpiOperationJedecId,
+ EnumSpiOperationDualOutputFastRead,
+ EnumSpiOperationDiscoveryParameters,
+ EnumSpiOperationOther,
+ EnumSpiOperationMax
+} SPI_OPERATION;
+
+///
+/// SPI Command Configuration
+///
+typedef struct _SPI_COMMAND_CONFIG {
+ ///
+ /// The expected frequency to be used (value to be programmed to the SSFC Register)
+ ///
+ SPI_CYCLE_FREQUENCY Frequency;
+ ///
+ /// Which Hardware Sequencing required operation this opcode respoinds to.
+ /// The required operations are listed in EDS Table 5-55: "Hardware
+ /// Sequencing Commands and Opcode Requirements"
+ /// If the opcode does not corresponds to any operation listed, use
+ /// EnumSpiOperationOther, and provides TYPE and Code for it in
+ /// SpecialOpcodeEntry.
+ ///
+ SPI_OPERATION Operation;
+} SPI_COMMAND_CONFIG;
+
+///
+/// Special Opcode entries
+///
+typedef struct _SPI_SPECIAL_OPCODE_ENTRY {
+ ///
+ /// Opcode Menu Index whose Opcode Type/Menu Configuration Register need to be
+ /// overrided or programmed per "Type" and "Code". Filled this field with 0xFF
+ /// as the end tag of SpecialOpcodeEntry.
+ ///
+ UINT8 OpcodeIndex;
+ ///
+ /// Operation Type (value to be programmed to the OPTYPE register)
+ ///
+ SPI_OPCODE_TYPE Type;
+ ///
+ /// The opcode (value to be programmed to the OPMENU register)
+ ///
+ UINT8 Code;
+} SPI_SPECIAL_OPCODE_ENTRY;
+
+///
+/// Initialization data table loaded to the SPI host controller
+///
+/// Note: Most of time, the SPI flash parts with the same vendor would have the same
+/// Prefix Opcode, Opcode menu, so you can provide one table for the SPI flash parts with
+/// the same vendor.
+///
+typedef struct _SPI_INIT_DATA {
+ ///
+ /// Prefix opcodes which are loaded into the SPI host controller
+ ///
+ UINT8 PrefixOpcode[SPI_NUM_PREFIX_OPCODE];
+ ///
+ /// Determines Opcode Type, Menu and Frequency of the SPI commands
+ ///
+ SPI_COMMAND_CONFIG SpiCmdConfig[SPI_NUM_OPCODE];
+ ///
+ /// Special Opcode entry for the special operations.
+ ///
+ SPI_SPECIAL_OPCODE_ENTRY *SpecialOpcodeEntry;
+ ///
+ /// The offset of the start of the BIOS image relative to the flash device.
+ /// Please note this is a Flash Linear Address, NOT a memory space address.
+ /// This value is platform specific and depends on the system flash map.
+ /// This value is only used on non Descriptor mode.
+ ///
+ UINTN BiosStartOffset;
+ ///
+ /// The the BIOS Image size in flash. This value is platform specific
+ /// and depends on the system flash map. Please note BIOS Image size may
+ /// be smaller than BIOS Region size (in Descriptor Mode) or the flash size
+ /// (in Non Descriptor Mode), and in this case, BIOS Image is supposed to be
+ /// placed at the top end of the BIOS Region (in Descriptor Mode) or the flash
+ /// (in Non Descriptor Mode)
+ ///
+ UINTN BiosSize;
+} SPI_INIT_DATA;
+
+//
+// Protocol member functions
+//
+
+/**
+ JEDEC Read IDs from SPI flash part, this function will return 1-byte Vendor ID and 2-byte Device ID
+
+ @param[in] This Pointer to the EFI_SPI_PROTOCOL instance.
+ @param[in] Address This value is to determine the command is sent to SPI Component 1 or 2
+ @param[in, out] Buffer Pointer to caller-allocated buffer containing the data received or sent during the SPI cycle.
+
+ @retval EFI_SUCCESS Read Jedec Id completed.
+ @retval EFI_DEVICE_ERROR Device error, operation failed.
+ @exception EFI_UNSUPPORTED This function is unsupported after SpiProtocolInit is called
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_SPI_READ_ID) (
+ IN EFI_SPI_PROTOCOL * This,
+ IN UINTN Address,
+ IN OUT UINT8 * Buffer
+ );
+
+/**
+ Initializes the host controller to execute SPI commands.
+
+ @param[in] This Pointer to the EFI_SPI_PROTOCOL instance.
+ @param[in] InitData Pointer to caller-allocated buffer containing the SPI
+ interface initialization table.
+
+ @retval EFI_SUCCESS Opcode initialization on the SPI host controller completed.
+ @retval EFI_ACCESS_DENIED The SPI configuration interface is locked.
+ @retval EFI_OUT_OF_RESOURCES Not enough resource available to initialize the device.
+ @retval EFI_DEVICE_ERROR Device error, operation failed.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_SPI_INIT) (
+ IN EFI_SPI_PROTOCOL * This,
+ IN SPI_INIT_DATA * InitData
+ );
+
+/**
+ Execute SPI commands from the host controller.
+
+ @param[in] This Pointer to the EFI_SPI_PROTOCOL instance.
+ @param[in] OpcodeIndex Index of the command in the OpCode Menu.
+ @param[in] PrefixOpcodeIndex Index of the first command to run when in an atomic cycle sequence.
+ @param[in] DataCycle TRUE if the SPI cycle contains data
+ @param[in] Atomic TRUE if the SPI cycle is atomic and interleave cycles are not allowed.
+ @param[in] ShiftOut If DataByteCount is not zero, TRUE to shift data out and FALSE to shift data in.
+ @param[in] Address In Descriptor Mode, for Descriptor Region, GbE Region, ME Region and Platform
+ Region, this value specifies the offset from the Region Base; for BIOS Region,
+ this value specifies the offset from the start of the BIOS Image. In Non
+ Descriptor Mode, this value specifies the offset from the start of the BIOS Image.
+ Please note BIOS Image size may be smaller than BIOS Region size (in Descriptor
+ Mode) or the flash size (in Non Descriptor Mode), and in this case, BIOS Image is
+ supposed to be placed at the top end of the BIOS Region (in Descriptor Mode) or
+ the flash (in Non Descriptor Mode)
+ @param[in] DataByteCount Number of bytes in the data portion of the SPI cycle.
+ @param[in, out] Buffer Pointer to caller-allocated buffer containing the dada received or sent during the SPI cycle.
+ @param[in] SpiRegionType SPI Region type. Values EnumSpiRegionBios, EnumSpiRegionGbE, EnumSpiRegionMe,
+ EnumSpiRegionDescriptor, and EnumSpiRegionPlatformData are only applicable in
+ Descriptor mode. Value EnumSpiRegionAll is applicable to both Descriptor Mode
+ and Non Descriptor Mode, which indicates "SpiRegionOffset" is actually relative
+ to base of the 1st flash device (i.e., it is a Flash Linear Address).
+
+ @retval EFI_SUCCESS Command succeed.
+ @retval EFI_INVALID_PARAMETER The parameters specified are not valid.
+ @exception EFI_UNSUPPORTED Command not supported.
+ @retval EFI_DEVICE_ERROR Device error, command aborts abnormally.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_SPI_EXECUTE) (
+ IN EFI_SPI_PROTOCOL * This,
+ IN UINT8 OpcodeIndex,
+ IN UINT8 PrefixOpcodeIndex,
+ IN BOOLEAN DataCycle,
+ IN BOOLEAN Atomic,
+ IN BOOLEAN ShiftOut,
+ IN UINTN Address,
+ IN UINT32 DataByteCount,
+ IN OUT UINT8 *Buffer,
+ IN SPI_REGION_TYPE SpiRegionType
+ );
+
+///
+/// EFI SPI Protocol definition
+///
+/// These protocols/PPI allows a platform module to perform SPI operations through the
+/// Intel PCH SPI Host Controller Interface.
+///
+struct _EFI_SPI_PROTOCOL {
+ EFI_SPI_READ_ID ReadId; ///< JEDEC Read IDs from SPI flash part, this function will return 1-byte Vendor ID and 2-byte Device ID.
+ EFI_SPI_INIT Init; ///< Initialize the host controller to execute SPI commands.
+ EFI_SPI_EXECUTE Execute; ///< Execute SPI commands from the host controller.
+};
+
+///
+/// This protocol provides data about the Flash device to non-SPI modules in order to
+/// allow other entities to determine if their data is coming directly from Flash or
+/// if it is coming from other areas of memory.
+///
+struct _EFI_SPI_DATA_PROTOCOL {
+ ///
+ /// The offset of the start of the BIOS image within memory space address.
+ ///
+ UINTN BiosStartMemoryAddress;
+ ///
+ /// The the BIOS Image size in flash. This value is platform specific
+ /// and depends on the system flash map. Please note BIOS Image size may
+ /// be smaller than BIOS Region size (in Descriptor Mode) or the flash size
+ /// (in Non Descriptor Mode), and in this case, BIOS Image will be placed
+ /// at the top end of the BIOS Region (in Descriptor Mode) or the flash
+ /// (in Non Descriptor Mode)
+ ///
+ UINTN BiosSize;
+};
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Protocol/Wdt/Wdt.c b/ReferenceCode/Chipset/LynxPoint/Protocol/Wdt/Wdt.c
new file mode 100644
index 0000000..03ec452
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Protocol/Wdt/Wdt.c
@@ -0,0 +1,34 @@
+/** @file
+ Watchdog Timer protocol
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+
+#include "EdkIIGlueDxe.h"
+#endif
+
+#include "Wdt.h"
+
+//
+// Protocol GUID definition
+//
+EFI_GUID gWdtProtocolGuid = WDT_PROTOCOL_GUID;
+
+//
+// Protocol description
+//
+EFI_GUID_STRING(&gWdtProtocolGuid, "WDT Protocol", "Watchdog Timer Protocol");
diff --git a/ReferenceCode/Chipset/LynxPoint/Protocol/Wdt/Wdt.h b/ReferenceCode/Chipset/LynxPoint/Protocol/Wdt/Wdt.h
new file mode 100644
index 0000000..322aa2f
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Protocol/Wdt/Wdt.h
@@ -0,0 +1,157 @@
+/** @file
+ Watchdog Timer protocol
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _DXE_WDT_H_
+#define _DXE_WDT_H_
+
+///
+/// GUID for the WDT Protocol
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#define WDT_PROTOCOL_GUID \
+ { \
+ 0xB42B8D12, 0x2ACB, 0x499a, 0xA9, 0x20, 0xDD, 0x5B, 0xE6, 0xCF, 0x09, 0xB1 \
+ }
+
+#else
+
+#define WDT_PROTOCOL_GUID \
+ { \
+ 0xB42B8D12, 0x2ACB, 0x499a, \
+ { \
+ 0xA9, 0x20, 0xDD, 0x5B, 0xE6, 0xCF, 0x09, 0xB1 \
+ } \
+ }
+
+#endif
+//
+// Extern the GUID for protocol users.
+//
+extern EFI_GUID gWdtProtocolGuid;
+//
+// Forward reference for ANSI C compatibility
+//
+typedef struct _WDT_PROTOCOL WDT_PROTOCOL;
+
+/**
+ Reloads WDT with new timeout value and starts it. Also sets Unexpected Reset bit, which
+ causes the next reset to be treated as watchdog expiration - unless AllowKnownReset()
+ function was called too.
+
+ @param[in] TimeoutValue Time in seconds before WDT times out. Supported range = 1 - 1024.
+
+ @retval EFI_SUCCESS if everything's OK
+ @retval EFI_INVALID_PARAMETER if TimeoutValue parameter is wrong
+**/
+typedef
+EFI_STATUS
+(EFIAPI *WDT_RELOAD_AND_START) (
+ UINT32 TimeoutValue
+ );
+
+/**
+ Returns WDT failure status.
+
+ @param[in] None
+
+ @retval V_PCH_OC_WDT_CTL_STATUS_FAILURE If there was WDT expiration or unexpected reset
+ @retval V_PCH_OC_WDT_CTL_STATUS_OK Otherwise
+**/
+typedef
+UINT8
+(EFIAPI *WDT_CHECK_STATUS) (
+ VOID
+ );
+
+/**
+ Returns information if WDT coverage for the duration of BIOS execution
+ was requested by an OS application.
+
+ @param[in] None
+
+ @retval TRUE if WDT was requested
+ @retval FALSE if WDT was not requested
+**/
+typedef
+UINT8
+(EFIAPI *IS_WDT_REQUIRED) (
+ VOID
+ );
+
+/**
+ Returns WDT enabled/disabled status.
+
+ @param[in] None
+
+ @retval TRUE if WDT is enabled
+ @retval FALSE if WDT is disabled
+**/
+typedef
+UINT8
+(EFIAPI *IS_WDT_ENABLED) (
+ VOID
+ );
+
+/**
+ Disables WDT timer.
+
+ @param[in] None
+
+ @retval None
+**/
+typedef
+VOID
+(EFIAPI *WDT_DISABLE) (
+ VOID
+ );
+
+/**
+ Normally, each reboot performed while watchdog runs is considered a failure.
+ This function allows platform to perform expected reboots with WDT running,
+ without being interpreted as failures.
+ In DXE phase, it is enough to call this function any time before reset.
+ In PEI phase, between calling this function and performing reset, ReloadAndStart()
+ must not be called.
+
+ @param[in] None
+
+ @retval None
+**/
+typedef
+VOID
+(EFIAPI *WDT_ALLOW_KNOWN_RESET) (
+ VOID
+ );
+
+///
+/// These protocols and PPI allow a platform module to perform watch dog timer operations
+/// through the Intel PCH LPC Host Controller Interface. The WDT protocol and WDT PPI
+/// implement the Intel (R) Watch Dog timer for DXE, and PEI environments, respectively.
+/// WDT_PROTOCOL referenced hereafter represents both WDT_PROTOCOL and WDT_PPI, as they
+/// share the identical data structure.
+///
+struct _WDT_PROTOCOL {
+ WDT_RELOAD_AND_START ReloadAndStart; ///< Reloads WDT with new timeout value and starts it.
+ WDT_CHECK_STATUS CheckStatus; ///< Returns WDT failure status.
+ WDT_DISABLE Disable; ///< Disables WDT timer.
+ WDT_ALLOW_KNOWN_RESET AllowKnownReset; ///< Perform expected reboots with WDT running, without being interpreted as failures.
+ IS_WDT_REQUIRED IsWdtRequired; ///< Returns information if WDT coverage for the duration of BIOS execution was requested by an OS application.
+ IS_WDT_ENABLED IsWdtEnabled; ///< Returns WDT enabled/disabled status.
+};
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Reset/Common/PchResetCommon.c b/ReferenceCode/Chipset/LynxPoint/Reset/Common/PchResetCommon.c
new file mode 100644
index 0000000..4516b1f
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Reset/Common/PchResetCommon.c
@@ -0,0 +1,254 @@
+/** @file
+ PCH RESET Common Library implements the Pch Reset Interface.
+
+@copyright
+ Copyright (c) 2011 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "PchReset.h"
+
+/**
+ Initialize an Pch Reset protocol instance.
+ The function will assert in debug if PCH RCBA has not been initialized
+
+ @param[in] PchResetInstance Pointer to PchResetInstance to initialize
+
+ @retval EFI_SUCCESS The protocol instance was properly initialized
+ @exception EFI_UNSUPPORTED The PCH is not supported by this module
+**/
+EFI_STATUS
+PchResetProtocolConstructor (
+ PCH_RESET_INSTANCE *PchResetInstance
+ )
+{
+ ///
+ /// Check if the current PCH is known and supported by this code
+ ///
+ if (!IsPchSupported ()) {
+ DEBUG ((EFI_D_ERROR, "PCH Reset Protocol not supported due to no proper PCH LPC found!\n"));
+ return EFI_UNSUPPORTED;
+ }
+ ///
+ /// Initialize the Reset protocol instance
+ ///
+ PchResetInstance->Signature = PCH_RESET_SIGNATURE;
+ PchResetInstance->Handle = NULL;
+ PchResetInstance->PchResetProtocol.Reset = PchReset;
+
+ ///
+ /// Sanity check to ensure PCH RCBA initialization has occurred previously.
+ ///
+ PchResetInstance->PchRootComplexBar = PCH_RCRB_BASE;
+ ASSERT (PchResetInstance->PchRootComplexBar != 0);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Execute Pch Reset from the host controller.
+
+ @param[in] This Pointer to the PCH_RESET_PROTOCOL instance.
+ @param[in] PchResetType Pch Reset Types which includes ColdReset, WarmReset, ShutdownReset,
+ PowerCycleReset, GlobalReset, GlobalResetWithEc
+
+ @retval EFI_SUCCESS Successfully completed.
+ @retval EFI_INVALID_PARAMETER If ResetType is invalid.
+**/
+EFI_STATUS
+EFIAPI
+PchReset (
+ IN PCH_RESET_PROTOCOL *This,
+ IN PCH_RESET_TYPE PchResetType
+ )
+{
+ PCH_RESET_INSTANCE *PchResetInstance;
+ UINTN PchRootComplexBar;
+ UINT16 PmBase;
+ UINT16 GpioBase;
+ UINT8 OutputData;
+ UINT32 Data32;
+ UINT16 Data16;
+ EFI_STATUS Status;
+ PCH_SERIES PchSeries;
+
+ PchSeries = GetPchSeries();
+ PchResetInstance = PCH_RESET_INSTANCE_FROM_THIS (This);
+ PchRootComplexBar = PchResetInstance->PchRootComplexBar;
+ PmBase = PciRead16 (
+ PCI_LIB_ADDRESS (DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_ACPI_BASE)
+ ) & B_PCH_LPC_ACPI_BASE_BAR;
+
+ GpioBase = PciRead16 (
+ PCI_LIB_ADDRESS (DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_GPIO_BASE)
+ ) & B_PCH_LPC_GPIO_BASE_BAR;
+
+ switch (PchResetType) {
+ case WarmReset:
+ IoWrite8 ((UINTN) R_PCH_RST_CNT, (UINT8) V_PCH_RST_CNT_SOFTSTARTSTATE);
+ OutputData = V_PCH_RST_CNT_SOFTRESET;
+ break;
+
+ case ColdReset:
+ IoWrite8 ((UINTN) R_PCH_RST_CNT, (UINT8) V_PCH_RST_CNT_HARDSTARTSTATE);
+
+// AMI_OVERRIDE, [EIP81593] >>>
+#ifdef COLD_RESET_WITH_POWER_CYCLE
+ OutputData = V_PCH_RST_CNT_FULLRESET;
+#else
+ OutputData = V_PCH_RST_CNT_HARDRESET;
+#endif
+// AMI_OVERRIDE, [EIP81593] <<<
+ break;
+
+ case ShutdownReset:
+ ///
+ /// Firstly, ACPI decode must be enabled
+ ///
+ PciOr8 (
+ PCI_LIB_ADDRESS (DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_ACPI_CNT),
+ (UINT8) (B_PCH_LPC_ACPI_CNT_ACPI_EN)
+ );
+
+ ///
+ /// Then, GPE0_EN should be disabled to avoid any GPI waking up the system from S5
+ ///
+ if (PchSeries == PchLp) {
+ IoWrite32 ((UINTN) (PmBase + R_PCH_ACPI_GPE0_EN_127_96), 0);
+ } else if (PchSeries == PchH) {
+ IoWrite16 ((UINTN) (PmBase + R_PCH_ACPI_GPE0a_EN), 0);
+ IoWrite16 ((UINTN) (PmBase + R_PCH_ACPI_GPE0b_EN), 0);
+ }
+
+ ///
+ /// Secondly, PwrSts register must be cleared
+ ///
+ /// Write a "1" to bit[8] of power button status register at
+ /// (PM_BASE + PM1_STS_OFFSET) to clear this bit
+ ///
+ Data16 = B_PCH_SMI_STS_PM1_STS_REG;
+// AMI_OVERWRITE >>> EIP136638
+ IoWrite16 ((UINTN) (PmBase + R_PCH_ACPI_PM1_STS), Data16);
+// AMI_OVERWRITE <<<
+
+ ///
+ /// Finally, transform system into S5 sleep state
+ ///
+ Data32 = IoRead32 ((UINTN) (PmBase + R_PCH_ACPI_PM1_CNT));
+
+ Data32 = (UINT32) ((Data32 &~(B_PCH_ACPI_PM1_CNT_SLP_TYP + B_PCH_ACPI_PM1_CNT_SLP_EN)) | V_PCH_ACPI_PM1_CNT_S5);
+
+ IoWrite32 ((UINTN) (PmBase + R_PCH_ACPI_PM1_CNT), Data32);
+
+ Data32 = Data32 | B_PCH_ACPI_PM1_CNT_SLP_EN;
+
+ IoWrite32 ((UINTN) (PmBase + R_PCH_ACPI_PM1_CNT), Data32);
+
+ return EFI_SUCCESS;
+
+ case PowerCycleReset:
+ case GlobalReset:
+ case GlobalResetWithEc:
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 4.6 GPIO Reset Requirement
+ /// System BIOS is recommended to clear "GPIO Reset Select" registers [GP_RST_SEL1 (GPIOBASE + offset 60h),
+ /// GP_RST_SEL2 (GPIOBASE + offset 64h) and GP_RST_SEL3 (GPIOBASE + offset 68h)] before issuing a hard or
+ /// global reset unless specially requested by the platform designer.
+ ///
+ IoWrite32 ((UINTN) (GpioBase + R_PCH_GP_RST_SEL), 0);
+ IoWrite32 ((UINTN) (GpioBase + R_PCH_GP_RST_SEL2), 0);
+ IoWrite32 ((UINTN) (GpioBase + R_PCH_GP_RST_SEL3), 0);
+
+ if ((PchResetType == GlobalReset) || (PchResetType == GlobalResetWithEc)) {
+ PciOr32 (
+ PCI_LIB_ADDRESS (DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_PMIR),
+ (UINT32) (B_PCH_LPC_PMIR_CF9GR)
+ );
+ }
+
+ if ((PchResetType == GlobalResetWithEc) &&
+ ((MmioRead32 (PchRootComplexBar + R_PCH_RCRB_DEEP_S4_POL) &
+ (B_PCH_RCRB_DEEP_S4_POL_DPS4_EN_AC | B_PCH_RCRB_DEEP_S4_POL_DPS4_EN_DC)) == 0) &&
+ ((MmioRead32 (PchRootComplexBar + R_PCH_RCRB_DEEP_S5_POL) &
+ (B_PCH_RCRB_DEEP_S5_POL_DPS5_EN_AC | B_PCH_RCRB_DEEP_S5_POL_DPS5_EN_DC)) == 0)) {
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 4.5 Global Reset
+ /// For systems with an embedded controller, System BIOS should also take these additional steps when it performs the Global Reset:
+ /// CF9h Global Reset:
+ ///
+ if (PchSeries == PchH) {
+ /// 1. Set GPIOBASE + offset 00h[30] = 1b (for non-Deep Sx enabled platforms)
+ /// 2. Set GPIOBASE + offset 04h[30] = 0b (for non-Deep Sx enabled platforms)
+ /// 3. Set GPIOBASE + offset 0Ch[30] = 0b (for non-Deep Sx enabled platforms)
+ /// 4. Set GPIOBASE + offset 60h[30] = 1b (for non-Deep Sx enabled platforms)
+ /// NOTE: For Deep Sx enabled platforms steps 1,2 and 3 should be skipped and pin should be left in native mode
+ /// 5. Set CF9GR bit, D31:F0:ACh[20], issue a Global Reset through a 0xCF9 write of either 06h or 0Eh commands.
+ /// Global Reset MEI Message
+ /// 1. BIOS makes sure GPIO30 is left in native mode (default mode) before sending a Global Reset MEI message.
+ ///
+ IoOr32 ((UINTN) (GpioBase + R_PCH_GPIO_USE_SEL), (UINT32) (BIT30));
+ IoAnd32 ((UINTN) (GpioBase + R_PCH_GPIO_IO_SEL), (UINT32) (~BIT30));
+ IoAnd32 ((UINTN) (GpioBase + R_PCH_GPIO_LVL), (UINT32) (~BIT30));
+ }
+
+ if (PchSeries == PchLp) {
+ /// 1. Set GPIOBASE + offset 1F0h[0] = 1b (for non-Deep Sx enabled platforms)
+ /// 2. Set GPIOBASE + offset 1F0h[2] = 0b (for non-Deep Sx enabled platforms)
+ /// 3. Set GPIOBASE + offset 1F0h[31] = 0b (for non-Deep Sx enabled platforms)
+ /// 4. Set GPIOBASE + offset 60h[30] = 1h (for non-Deep Sx enabled platforms)
+ /// NOTE: For Deep Sx enabled platforms steps 1,2 and 3 should be skipped and pin should be left in native mode
+ /// 5. Set CF9GR bit, D31:F0:ACh[20], issue a Global Reset through a 0xCF9 write of either 06h or 0Eh commands.
+ /// Global Reset MEI Message
+ /// 1. BIOS makes sure GPIO30 is left in native mode (default mode) before sending a Global Reset MEI message.
+ ///
+ IoOr32 ((UINTN) (GpioBase + R_PCH_GP_30_CONFIG0), (UINT32) (B_PCH_GPIO_OWN0_GPIO_USE_SEL));
+ IoAnd32 ((UINTN) (GpioBase + R_PCH_GP_30_CONFIG0), (UINT32) (~B_PCH_GPIO_OWN0_GPIO_IO_SEL));
+ IoAnd32 ((UINTN) (GpioBase + R_PCH_GP_30_CONFIG0), (UINT32) (~B_PCH_GPIO_OWN0_GPO_LVL));
+ }
+ IoOr32 ((UINTN) (GpioBase + R_PCH_GP_RST_SEL), (UINT32) (BIT30));
+ }
+
+ OutputData = V_PCH_RST_CNT_FULLRESET;
+ break;
+
+ default:
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Status = PchResetCallback (PchResetType);
+
+ if ((Status == EFI_SUCCESS) || (Status == EFI_NOT_FOUND)) {
+ IoWrite8 ((UINTN) R_PCH_RST_CNT, OutputData);
+ ///
+ /// Waiting for system reset
+ ///
+ EFI_DEADLOOP ();
+ }
+
+ return Status;
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/Reset/Common/PchResetCommon.h b/ReferenceCode/Chipset/LynxPoint/Reset/Common/PchResetCommon.h
new file mode 100644
index 0000000..a9020a7
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Reset/Common/PchResetCommon.h
@@ -0,0 +1,86 @@
+/** @file
+ Header file for PCH RESET Common Library.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _RESET_COMMON_H_
+#define _RESET_COMMON_H_
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "PchAccess.h"
+#include "PchPlatformLib.h"
+#endif
+///
+/// Private data structure definitions for the driver
+///
+#define PCH_RESET_SIGNATURE EFI_SIGNATURE_32 ('I', 'E', 'R', 'S')
+
+typedef struct {
+ UINT32 Signature;
+ EFI_HANDLE Handle;
+ PCH_RESET_PROTOCOL PchResetProtocol;
+ UINTN PchRootComplexBar;
+} PCH_RESET_INSTANCE;
+
+#define PCH_RESET_INSTANCE_FROM_THIS(a) \
+ CR ( \
+ a, \
+ PCH_RESET_INSTANCE, \
+ PchResetProtocol, \
+ PCH_RESET_SIGNATURE \
+ )
+
+//
+// Function prototypes used by the Pch Reset protocol.
+//
+
+/**
+ Initialize an Pch Reset protocol instance.
+ The function will assert in debug if PCH RCBA has not been initialized
+
+ @param[in] PchResetInstance Pointer to PchResetInstance to initialize
+
+ @retval EFI_SUCCESS The protocol instance was properly initialized
+ @exception EFI_UNSUPPORTED The PCH is not supported by this module
+**/
+EFI_STATUS
+PchResetProtocolConstructor (
+ PCH_RESET_INSTANCE *PchResetInstance
+ );
+
+/**
+ Execute Pch Reset from the host controller.
+
+ @param[in] This Pointer to the PCH_RESET_PROTOCOL instance.
+ @param[in] PchResetType Pch Reset Types which includes ColdReset, WarmReset, ShutdownReset,
+ PowerCycleReset, GlobalReset, GlobalResetWithEc
+
+ @retval EFI_SUCCESS Successfully completed.
+ @retval EFI_INVALID_PARAMETER If ResetType is invalid.
+**/
+EFI_STATUS
+EFIAPI
+PchReset (
+ IN PCH_RESET_PROTOCOL *This,
+ IN PCH_RESET_TYPE PchResetType
+ );
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Reset/Common/PchResetCommonLib.cif b/ReferenceCode/Chipset/LynxPoint/Reset/Common/PchResetCommonLib.cif
new file mode 100644
index 0000000..8fad0d9
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Reset/Common/PchResetCommonLib.cif
@@ -0,0 +1,11 @@
+<component>
+ name = "PchResetCommonLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\Reset\Common"
+ RefName = "PchResetCommonLib"
+[files]
+"PchResetCommonLib.sdl"
+"PchResetCommonLib.mak"
+"PchResetCommon.h"
+"PchResetCommon.c"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/Reset/Common/PchResetCommonLib.mak b/ReferenceCode/Chipset/LynxPoint/Reset/Common/PchResetCommonLib.mak
new file mode 100644
index 0000000..eecda96
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Reset/Common/PchResetCommonLib.mak
@@ -0,0 +1,124 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchResetCommonLib/PchResetCommonLib.mak 1 2/08/12 9:06a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 9:06a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchResetCommonLib/PchResetCommonLib.mak $
+#
+# 1 2/08/12 9:06a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+all : PchResetCommonLib
+
+!IF "$(PchInitPeim_SUPPORT)" == "1"
+PchResetCommonLib : PchResetCommonPeiLib
+!ENDIF
+
+!IF "$(PchInitDxe_SUPPORT)" == "1"
+PchResetCommonLib : PchResetCommonDxeLib
+!ENDIF
+
+!IF "$(PchInitPeim_SUPPORT)" == "1"
+!IF "$(PchInitDxe_SUPPORT)" == "1"
+PchResetCommonLib : PchResetCommonDxeLib PchResetCommonPeiLib
+!ENDIF
+!ENDIF
+
+!IF "$(PchInitDxe_SUPPORT)" == "1"
+$(PchResetCommonDxeLib_LIB) : PchResetCommonDxeLib
+!ENDIF
+
+!IF "$(PchInitPeim_SUPPORT)" == "1"
+$(PchResetCommonPeiLib_LIB) : PchResetCommonPeiLib
+!ENDIF
+
+PchResetCommonDxeLib : $(BUILD_DIR)\PchResetCommonLib.mak PchResetCommonLibDxeBin
+
+PchResetCommonPeiLib : $(BUILD_DIR)\PchResetCommonLib.mak PchResetCommonLibPeiBin
+
+$(BUILD_DIR)\PchResetCommonLib.mak : $(PchResetCommonLib_DIR)\$(@B).cif $(PchResetCommonLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(PchResetCommonLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+PchResetCommonLib_INCLUDES=\
+ $(EDK_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+
+PchResetCommonLibDxe_INCLUDES=\
+ $(PchResetCommonLib_INCLUDES) $(PCH_INITDXE_INCLUDES)
+
+PchResetCommonLibPeim_INCLUDES=\
+ $(PchResetCommonLib_INCLUDES) $(PCH_INITPEI_INCLUDES)
+
+PchResetCommonLib_DEFINES = \
+ $(CFLAGS)
+
+DxeCpuBuildDefine = \
+!IF "$(x64_BUILD)"=="1"
+ /DMDE_CPU_X64\
+!ELSE
+ /DMDE_CPU_IA32\
+!ENDIF
+
+PeimCpuBuildDefine = \
+ /DMDE_CPU_IA32\
+
+PchResetCommonLibPeim_DEFINES = \
+ $(PchResetCommonLib_DEFINES)\
+ $(PeimCpuBuildDefine)\
+
+PchResetCommonLibDxe_DEFINES = \
+ $(PchResetCommonLib_DEFINES)\
+ $(DxeCpuBuildDefine)\
+
+PchResetCommonLibDxeBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS) \
+ /f $(BUILD_DIR)\PchResetCommonLib.mak all\
+ "MY_INCLUDES=$(PchResetCommonLibDxe_INCLUDES)" \
+ "CFLAGS=$(PchResetCommonLibDxe_DEFINES)"\
+ TYPE=LIBRARY \
+ LIBRARY_NAME=$(PchResetCommonDxeLib_LIB)
+
+PchResetCommonLibPeiBin : $(EFISCRIPTLIB) $(EDKFRAMEWORKPROTOCOLLIB)
+!IF "$(x64_BUILD)"=="1"
+ $(MAKE) /$(MAKEFLAGS) $(EDK_DEFAULTS) BUILD_DIR=$(BUILD_DIR)\IA32 \
+!ELSE
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS) \
+!ENDIF
+ /f $(BUILD_DIR)\PchResetCommonLib.mak all\
+ "MY_INCLUDES=$(PchResetCommonLibPeim_INCLUDES)" \
+ "CFLAGS=$(PchResetCommonLibPeim_DEFINES)"\
+ TYPE=PEI_LIBRARY \
+ LIBRARY_NAME=$(PchResetCommonPeiLib_LIB)
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Reset/Common/PchResetCommonLib.sdl b/ReferenceCode/Chipset/LynxPoint/Reset/Common/PchResetCommonLib.sdl
new file mode 100644
index 0000000..745b6bd
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Reset/Common/PchResetCommonLib.sdl
@@ -0,0 +1,97 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchResetCommonLib/PchResetCommonLib.sdl 2 1/11/13 12:47a Scottyang $
+#
+# $Revision: 2 $
+#
+# $Date: 1/11/13 12:47a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchResetCommonLib/PchResetCommonLib.sdl $
+#
+# 2 1/11/13 12:47a Scottyang
+# [TAG] EIP81593
+# [Category] Improvement
+# [Description] Added new SDL token "COLD_RESET_WITH_POWER_CYCLE".
+# [Files] SB.sdl, SBGeneric.c, PchResetCommon.c,
+# PchResetCommonLib.sdl
+#
+# 1 2/08/12 9:06a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+TOKEN
+ Name = "PchResetCommonLib_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable PchUsbCommonLib support in Project"
+ TokenType = Boolean
+ TargetMAK = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "PchResetCommonLib_DIR"
+End
+
+MODULE
+ Help = "Includes PchResetCommonLib.mak to Project"
+ File = "PchResetCommonLib.mak"
+End
+
+ELINK
+ Name = "PchResetCommonDxeLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$$(LIB_BUILD_DIR)\PchResetCommonDxeLib.lib"
+ Parent = "PchResetCommonDxeLib_LIB"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "PchResetCommonPeiLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$$(LIB_BUILD_DIR)\PchResetCommonPeiLib.lib"
+ Parent = "PchResetCommonPeiLib_LIB"
+ InvokeOrder = AfterParent
+End
+
+ # [EIP81593]>
+ELINK
+ Name = "/D COLD_RESET_WITH_POWER_CYCLE"
+ Parent = "GLOBAL_DEFINES"
+ InvokeOrder = AfterParent
+ Token = "COLD_RESET_WITH_POWER_CYCLE" "=" "1"
+End
+ # <[EIP81593]
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Reset/Pei/PchReset.c b/ReferenceCode/Chipset/LynxPoint/Reset/Pei/PchReset.c
new file mode 100644
index 0000000..5993d67
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Reset/Pei/PchReset.c
@@ -0,0 +1,134 @@
+/** @file
+ PCH RESET PEIM DRIVER.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "PchReset.h"
+
+/**
+ Installs PCH RESET PPI
+
+ @param[in] FfsHeader Not used.
+ @param[in] PeiServices General purpose services available to every PEIM.
+
+ @retval EFI_SUCCESS PCH SPI PPI is installed successfully
+ @retval EFI_OUT_OF_RESOURCES Can't allocate pool
+**/
+EFI_STATUS
+InstallPchReset (
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_STATUS Status;
+ PEI_PCH_RESET_INSTANCE *PeiPchResetInstance;
+ PCH_RESET_INSTANCE *PchResetInstance;
+
+ DEBUG ((EFI_D_INFO, "InstallPchReset() Start\n"));
+
+ PeiPchResetInstance = (PEI_PCH_RESET_INSTANCE *) AllocateZeroPool (sizeof (PEI_PCH_RESET_INSTANCE));
+ if (NULL == PeiPchResetInstance) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ PchResetInstance = &(PeiPchResetInstance->PchResetInstance);
+ PchResetProtocolConstructor (PchResetInstance);
+
+ PeiPchResetInstance->PpiDescriptor.Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;
+ PeiPchResetInstance->PpiDescriptor.Guid = &gPchResetPpiGuid;
+ PeiPchResetInstance->PpiDescriptor.Ppi = &(PchResetInstance->PchResetProtocol);
+
+ ///
+ /// Install the PCH RESET PPI
+ ///
+ Status = (**PeiServices).InstallPpi (PeiServices, &PeiPchResetInstance->PpiDescriptor);
+ ASSERT_EFI_ERROR (Status);
+
+ DEBUG ((EFI_D_INFO, "PCH RESET PPI Installed\n"));
+
+ DEBUG ((EFI_D_INFO, "InstallPchReset() End\n"));
+
+ return Status;
+}
+
+/**
+ Execute call back function for Pch Reset.
+
+ @param[in] PchResetType Pch Reset Types which includes PowerCycle, Globalreset.
+
+ @retval EFI_SUCCESS The callback function has been done successfully
+ @exception EFI_UNSUPPORTED Do not do any reset from PCH
+**/
+EFI_STATUS
+PchResetCallback (
+ IN PCH_RESET_TYPE PchResetType
+ )
+{
+ EFI_STATUS Status;
+ UINTN Instance;
+ PCH_RESET_CALLBACK_PPI *PchResetCallbackPpi;
+
+ if ((PchResetType == GlobalReset) || (PchResetType == GlobalResetWithEc)) {
+ ///
+ /// After MRC is done, DRAM Init Done message will be sent to ME FW.
+ ///
+ Status = PeiServicesLocatePpi (
+ &gEfiPeiMemoryDiscoveredPpiGuid,
+ 0,
+ NULL,
+ NULL
+ );
+
+ if (Status == EFI_SUCCESS) {
+ ///
+ /// After sending DRAM Init Done to ME FW, please do the global reset through HECI.
+ ///
+ DEBUG ((EFI_D_ERROR, "Please do the global reset through HECI \n"));
+ return EFI_UNSUPPORTED;
+ }
+ }
+
+ Instance = 0;
+
+ do {
+ ///
+ /// Those drivers that need to install Pch Reset Callback Ppi have the responsibility
+ /// to make sure themselves execute before Pch Reset PEI driver.
+ ///
+ Status = PeiServicesLocatePpi (
+ &gPchResetCallbackPpiGuid,
+ Instance,
+ NULL,
+ (VOID**) &PchResetCallbackPpi
+ );
+
+ if (Status == EFI_SUCCESS) {
+ PchResetCallbackPpi->ResetCallback (PchResetType);
+ } else {
+ if ((Instance == 0) && (Status == EFI_NOT_FOUND)) {
+ DEBUG ((EFI_D_ERROR | EFI_D_INFO, "None of Pch Reset Callback Ppi is found .\n"));
+ } else {
+ DEBUG ((EFI_D_INFO, "Failed to locate Pch Reset Callback Ppi.\n"));
+ }
+ }
+
+ Instance++;
+ } while (Status != EFI_NOT_FOUND);
+
+ return EFI_SUCCESS;
+} \ No newline at end of file
diff --git a/ReferenceCode/Chipset/LynxPoint/Reset/Pei/PchReset.dxs b/ReferenceCode/Chipset/LynxPoint/Reset/Pei/PchReset.dxs
new file mode 100644
index 0000000..5e18cb4
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Reset/Pei/PchReset.dxs
@@ -0,0 +1,39 @@
+/** @file
+ Dependency expression source file.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "PeimDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+#endif
+
+DEPENDENCY_START
+ TRUE
+DEPENDENCY_END
diff --git a/ReferenceCode/Chipset/LynxPoint/Reset/Pei/PchReset.h b/ReferenceCode/Chipset/LynxPoint/Reset/Pei/PchReset.h
new file mode 100644
index 0000000..fa6ddc0
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Reset/Pei/PchReset.h
@@ -0,0 +1,65 @@
+/** @file
+ Header file for PCH RESET PEIM Driver.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PCH_RESET_H
+#define _PCH_RESET_H
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#include EFI_PPI_PRODUCER (PchReset)
+#include "PchResetCommon.h"
+#include EFI_PPI_CONSUMER (MemoryDiscovered)
+#include "PchAccess.h"
+#endif
+
+typedef struct {
+ EFI_PEI_PPI_DESCRIPTOR PpiDescriptor;
+ PCH_RESET_INSTANCE PchResetInstance;
+} PEI_PCH_RESET_INSTANCE;
+
+/**
+ Installs PCH RESET PPI
+
+ @param[in] FfsHeader Not used.
+ @param[in] PeiServices General purpose services available to every PEIM.
+
+ @retval EFI_SUCCESS PCH SPI PPI is installed successfully
+ @retval EFI_OUT_OF_RESOURCES Can't allocate pool
+**/
+EFI_STATUS
+InstallPchReset (
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+ );
+
+/**
+ Execute call back function for Pch Reset.
+
+ @param[in] PchResetType Pch Reset Types which includes PowerCycle, Globalreset.
+
+ @retval EFI_SUCCESS The callback function has been done successfully
+ @exception EFI_UNSUPPORTED Do not do any reset from PCH
+**/
+EFI_STATUS
+EFIAPI
+PchResetCallback (
+ IN PCH_RESET_TYPE PchResetType
+ );
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Reset/Pei/PchResetPeim.cif b/ReferenceCode/Chipset/LynxPoint/Reset/Pei/PchResetPeim.cif
new file mode 100644
index 0000000..294cf3c
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Reset/Pei/PchResetPeim.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "PchResetPeim"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\Reset\Pei"
+ RefName = "PchResetPeim"
+[files]
+"PchResetPeim.sdl"
+"PchResetPeim.mak"
+"PchReset.h"
+"PchReset.c"
+"PchReset.dxs"
+"PchResetPeim.inf"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/Reset/Pei/PchResetPeim.inf b/ReferenceCode/Chipset/LynxPoint/Reset/Pei/PchResetPeim.inf
new file mode 100644
index 0000000..cd135c0
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Reset/Pei/PchResetPeim.inf
@@ -0,0 +1,84 @@
+## @file
+# Component description file for the Pch Reset PEIM.
+#
+#@copyright
+# Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+
+[defines]
+BASE_NAME = PchResetPeim
+FILE_GUID = 147B4839-5DBE-413f-917F-DFEB687C6312
+COMPONENT_TYPE = PE32_PEIM
+
+[sources.common]
+ PchReset.h
+ PchReset.c
+ ../Common/PchResetCommon.c
+
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGluePeimEntryPoint.c
+
+[includes.common]
+ .
+ ../Common
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[libraries.common]
+ $(PROJECT_PCH_FAMILY)PpiLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueBaseMemoryLib
+ EdkIIGluePeiDebugLibReportStatusCode
+ EdkIIGluePeiReportStatusCodeLib
+ EdkIIGluePeiServicesLib
+ EdkIIGluePeiMemoryAllocationLib
+ EdkIIGlueBasePciLibPciExpress
+ EdkPpiLib
+ PchPlatformLib
+ EdkFrameworkPpiLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = PchReset.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=InstallPchReset
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_PEI_SERVICES_LIB__ \
+ -D __EDKII_GLUE_PEI_MEMORY_ALLOCATION_LIB__ \
+ -D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__
diff --git a/ReferenceCode/Chipset/LynxPoint/Reset/Pei/PchResetPeim.mak b/ReferenceCode/Chipset/LynxPoint/Reset/Pei/PchResetPeim.mak
new file mode 100644
index 0000000..541ee4f
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Reset/Pei/PchResetPeim.mak
@@ -0,0 +1,99 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchResetPeim/PchResetPeim.mak 2 2/24/12 2:17a Victortu $
+#
+# $Revision: 2 $
+#
+# $Date: 2/24/12 2:17a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchResetPeim/PchResetPeim.mak $
+#
+# 2 2/24/12 2:17a Victortu
+# Updated to support 4.6.5.3_IntelEDK_1117_Patch7_00.
+#
+# 1 2/08/12 9:05a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+
+#---------------------------------------------------------------------------
+# Create PchResetPeim module
+#---------------------------------------------------------------------------
+EDK : PchResetPeim
+PchResetPeim : $(BUILD_DIR)\PchResetPeim.mak PchResetPeimBin
+
+
+$(BUILD_DIR)\PchResetPeim.mak : $(PchResetPeim_DIR)\$(@B).cif $(PchResetPeim_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(PchResetPeim_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+PchResetPeim_INCLUDES=\
+ $(INTEL_PCH_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+
+PchResetPeim_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=InstallPchReset"\
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_PEI_SERVICES_LIB__ \
+ /D __EDKII_GLUE_PEI_MEMORY_ALLOCATION_LIB__ \
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__
+
+PchResetPeim_LIB_LINKS =\
+ $(GuidLib_LIB) \
+ $(PchPlatformPeiLib_LIB) \
+ $(IntelPchPpiLib_LIB)\
+ $(EDKFRAMEWORKPPILIB) \
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EdkIIGlueBaseLibIA32_LIB)\
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB) \
+ $(EdkIIGluePeiDebugLibReportStatusCode_LIB) \
+ $(EdkIIGluePeiReportStatusCodeLib_LIB) \
+ $(EdkIIGluePeiServicesLib_LIB) \
+ $(EdkIIGluePeiMemoryAllocationLib_LIB) \
+ $(EdkIIGlueBasePciLibCf8_LIB) \
+ $(PchResetCommonPeiLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+
+PchResetPeimBin: $(PchResetPeim_LIB_LINKS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\PchResetPeim.mak all \
+ "MY_INCLUDES=$(PchResetPeim_INCLUDES)"\
+ "MY_DEFINES=$(PchResetPeim_DEFINES)"\
+ NAME=PchResetPeim\
+ MAKEFILE=$(BUILD_DIR)\PchResetPeim.mak \
+ GUID=FF259F16-18D1-4298-8DD2-BD87FF2894A9\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=PEIM \
+ EDKIIModule=PEIM\
+ DEPEX1=$(PchResetPeim_DIR)\PchReset.dxs\
+ DEPEX1_TYPE=EFI_SECTION_PEI_DEPEX\
+ COMPRESS=0
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Reset/Pei/PchResetPeim.sdl b/ReferenceCode/Chipset/LynxPoint/Reset/Pei/PchResetPeim.sdl
new file mode 100644
index 0000000..b213204
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Reset/Pei/PchResetPeim.sdl
@@ -0,0 +1,67 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchResetPeim/PchResetPeim.sdl 1 2/08/12 9:05a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 9:05a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchResetPeim/PchResetPeim.sdl $
+#
+# 1 2/08/12 9:05a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+TOKEN
+ Name = "PchResetPeim_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable PchInitPeim support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "PchResetPeim_DIR"
+End
+
+MODULE
+ File = "PchResetPeim.mak"
+ Help = "Includes PchResetPeim.mak to Project"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PchResetPeim.ffs"
+ Parent = "FV_BB"
+ InvokeOrder = AfterParent
+End
+
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Reset/RuntimeDxe/PchReset.c b/ReferenceCode/Chipset/LynxPoint/Reset/RuntimeDxe/PchReset.c
new file mode 100644
index 0000000..8f4b925
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Reset/RuntimeDxe/PchReset.c
@@ -0,0 +1,496 @@
+/** @file
+ PCH RESET Runtime Driver
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "PchReset.h"
+
+PCH_RESET_INSTANCE *mPchResetInstance;
+
+STATIC UINT8 mDaysOfMonthInfo[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+
+/**
+ Check if it is leap year
+
+ @param[in] Year year to be check
+
+ @retval True year is leap year
+ @retval FALSE year is not a leap year
+**/
+BOOLEAN
+IsLeapYear (
+ IN UINT16 Year
+ )
+{
+ return (Year % 4 == 0) && ((Year % 100 != 0) || (Year % 400 == 0));
+}
+
+/**
+ Set System Wakeup Alarm.
+
+ @param[in] WakeAfter Time offset in seconds to wake from S3
+
+ @retval EFI_SUCCESS Timer started successfully
+**/
+
+STATIC
+EFI_STATUS
+SetSystemWakeupAlarm (
+ IN UINT32 WakeAfter
+ )
+{
+ EFI_STATUS Status;
+ EFI_TIME Time;
+ EFI_TIME_CAPABILITIES Capabilities;
+ UINT32 Reminder;
+ UINT16 PmBase;
+ UINT8 DayOfMonth;
+ ///
+ /// For an instant wake 2 seconds is a safe value
+ ///
+ if (WakeAfter < 2) {
+ WakeAfter = 2;
+ }
+
+ Status = EfiGetTime (&Time, &Capabilities);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Reminder = WakeAfter + (UINT32) Time.Second;
+ Time.Second = Reminder % 60;
+ Reminder = Reminder / 60;
+ Reminder = Reminder + (UINT32) Time.Minute;
+ Time.Minute = Reminder % 60;
+ Reminder = Reminder / 60;
+ Reminder = Reminder + (UINT32) Time.Hour;
+ Time.Hour = Reminder % 24;
+ Reminder = Reminder / 24;
+
+ if (Reminder > 0) {
+ Reminder = Reminder + (UINT32) Time.Day;
+ if ((Time.Month == 2) && IsLeapYear (Time.Year)) {
+ DayOfMonth = 29;
+ } else {
+ DayOfMonth = mDaysOfMonthInfo[Time.Month - 1];
+ }
+ if (Reminder > DayOfMonth) {
+ Time.Day = (UINT8)Reminder - DayOfMonth;
+ Reminder = 1;
+ } else {
+ Time.Day = (UINT8)Reminder;
+ Reminder = 0;
+ }
+ }
+
+ if (Reminder > 0) {
+ if (Time.Month == 12) {
+ Time.Month = 1;
+ Time.Year = Time.Year + 1;
+ } else {
+ Time.Month = Time.Month + 1;
+ }
+ }
+
+ Status = EfiSetWakeupTime (TRUE, &Time);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ PmBase = (UINT16) (PciRead32 (
+ PCI_LIB_ADDRESS (DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_ACPI_BASE)
+ ) & B_PCH_LPC_ACPI_BASE_BAR);
+
+ ///
+ /// Clear RTC PM1 status
+ ///
+ IoWrite16 (PmBase + R_PCH_ACPI_PM1_STS, B_PCH_ACPI_PM1_STS_RTC);
+
+ ///
+ /// set RTC_EN bit in PM1_EN to wake up from the alarm
+ ///
+ IoWrite16 (
+ PmBase + R_PCH_ACPI_PM1_EN,
+ (IoRead16 (PmBase + R_PCH_ACPI_PM1_EN) | B_PCH_ACPI_PM1_EN_RTC)
+ );
+ return Status;
+}
+
+// AMI_OVERRIDE, [EIP111666] >>>
+EFI_GUID gPchGetResetTypeGuid = PCH_RESET_PROTOCOL_GUID;
+
+EFI_STATUS
+EFIAPI
+PchResetExitBootServicesEvent (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+/*++
+
+Routine Description:
+
+ PCH initialization before ExitBootServices / LegacyBoot events
+ Useful for operations which must happen later than at EndOfPost event
+
+Arguments:
+
+ Event A pointer to the Event that triggered the callback.
+ Context A pointer to private data registered with the callback function.
+
+Returns:
+
+ EFI_SUCCESS The function completed successfully
+
+ --*/
+{
+ //
+ // Closed the event to avoid call twice
+ //
+ UINT8 LegacyBoot;
+ gBS->CloseEvent (Event);
+
+ gRT->SetVariable (
+ L"InLegacyBoot",
+ &gPchGetResetTypeGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS |
+ EFI_VARIABLE_RUNTIME_ACCESS,
+ sizeof(UINT8),
+ &LegacyBoot
+ );
+ return EFI_SUCCESS;
+}
+// AMI_OVERRIDE, [EIP111666] <<<
+
+/**
+ Initialize the state information for the Timer Architectural Protocol
+
+ @param[in] ImageHandle Image handle of the loaded driver
+ @param[in] SystemTable Pointer to the System Table
+
+ @retval EFI_SUCCESS Thread can be successfully created
+ @retval EFI_OUT_OF_RESOURCES Cannot allocate protocol data structure
+ @retval EFI_DEVICE_ERROR Cannot create the timer service
+**/
+EFI_STATUS
+EFIAPI
+InstallPchReset (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ UINT64 Length;
+// AMI_OVERRIDE, NBDXE.c already done. >>>
+/* UINT64 BaseAddress;
+ EFI_GCD_MEMORY_SPACE_DESCRIPTOR MemorySpaceDescriptor;
+ UINT64 Attributes;*/
+// AMI_OVERRIDE, NBDXE.c already done. <<<
+// AMI_OVERRIDE, [EIP111666] >>>
+ EFI_EVENT LegacyBootEvent;
+// AMI_OVERRIDE, [EIP111666] <<<
+
+ DEBUG ((EFI_D_INFO, "InstallPchReset() Start\n"));
+
+ Status = PciLibConstructor ();
+ ASSERT_EFI_ERROR (Status);
+// AMI_OVERRIDE, NBDXE.c already done. >>>
+/*
+ BaseAddress = MmPciAddress(0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ 0
+ );
+ Length = 4096;
+
+ Status = gDS->GetMemorySpaceDescriptor (BaseAddress, &MemorySpaceDescriptor);
+ ASSERT_EFI_ERROR (Status);
+
+ Attributes = MemorySpaceDescriptor.Attributes | EFI_MEMORY_RUNTIME;
+
+ Status = gDS->SetMemorySpaceAttributes (
+ BaseAddress,
+ Length,
+ Attributes
+ );
+ DEBUG ((EFI_D_INFO, "Status = %r\n",Status));
+ ASSERT_EFI_ERROR (Status);*/
+// AMI_OVERRIDE, NBDXE.c already done. <<<
+
+ Length = 4096;
+ // AMI_OVERRIDE_FOR_FIRST_BOOT
+ Status = PciLibRegisterMemory (
+ PCI_LIB_ADDRESS (0,
+ 0,
+ 0,
+ 0),
+ (UINTN) Length
+ );
+ // AMI_OVERRIDE_FOR_FIRST_BOOT
+
+ Status = PciLibRegisterMemory (
+ PCI_LIB_ADDRESS (DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ 0),
+ (UINTN) Length
+ );
+ ASSERT_EFI_ERROR (Status);
+ ///
+ /// Allocate Runtime memory for the PchReset protocol instance.
+ ///
+ mPchResetInstance = AllocateRuntimeZeroPool (sizeof (PCH_RESET_INSTANCE));
+ if (mPchResetInstance == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Status = PchResetProtocolConstructor (mPchResetInstance);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ ///
+ /// Install protocol interface
+ ///
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &mPchResetInstance->Handle,
+ &gPchResetProtocolGuid,
+ &mPchResetInstance->PchResetProtocol,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+
+// AMI_OVERRIDE, [EIP111666] >>>
+ Status = EfiCreateEventLegacyBootEx (
+ EFI_TPL_CALLBACK,
+ PchResetExitBootServicesEvent,
+ NULL,
+ &LegacyBootEvent
+ );
+// AMI_OVERRIDE, [EIP111666] <<<
+
+ ///
+ /// The Lib Deconstruct will automatically be called when entrypoint return error.
+ ///
+ DEBUG ((EFI_D_INFO, "InstallPchReset() End\n"));
+
+ return Status;
+}
+
+#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
+/**
+ If need be, do any special reset required for capsules. For this
+ implementation where we're called from the ResetSystem() api,
+ just set our capsule variable and return to let the caller
+ do a soft reset.
+
+ @param[in] None
+
+ @retval None
+**/
+VOID
+CapsuleReset (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ UINTN Size;
+ UINTN CapsuleDataPtr;
+ UINT32 Data32;
+ UINT32 Eflags;
+ UINT16 PmBase;
+
+ ///
+ /// Check if there are pending capsules to process
+ ///
+ Size = sizeof (CapsuleDataPtr);
+ Status = EfiGetVariable (
+ EFI_CAPSULE_VARIABLE_NAME,
+ &gEfiCapsuleVendorGuid,
+ NULL,
+ &Size,
+ (VOID *) &CapsuleDataPtr
+ );
+
+ if (Status == EFI_SUCCESS) {
+ ///
+ /// Wake up system 2 seconds after putting system into S3 to complete the reset operation.
+ ///
+ SetSystemWakeupAlarm (2);
+ ///
+ /// Process capsules across a system reset.
+ ///
+ PmBase = PciRead16 (
+ PCI_LIB_ADDRESS (DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_ACPI_BASE)
+ ) & B_PCH_LPC_ACPI_BASE_BAR;
+
+ ASSERT (PmBase != 0);
+
+ Data32 = IoRead32 ((UINTN) (PmBase + R_PCH_ACPI_PM1_CNT));
+
+ Data32 = (UINT32) ((Data32 & ~(B_PCH_ACPI_PM1_CNT_SLP_TYP + B_PCH_ACPI_PM1_CNT_SLP_EN)) | V_PCH_ACPI_PM1_CNT_S3);
+
+ Eflags = (UINT32) AsmReadEflags ();
+
+ if ((Eflags & 0x200)) {
+ DisableInterrupts ();
+ }
+
+ AsmWbinvd ();
+ AsmWriteCr0 (AsmReadCr0 () | 0x060000000);
+
+ IoWrite32 (
+ (UINTN) (PmBase + R_PCH_ACPI_PM1_CNT),
+ (UINT32) Data32
+ );
+
+ Data32 = Data32 | B_PCH_ACPI_PM1_CNT_SLP_EN;
+
+ IoWrite32 (
+ (UINTN) (PmBase + R_PCH_ACPI_PM1_CNT),
+ (UINT32) Data32
+ );
+
+ if ((Eflags & 0x200)) {
+ EnableInterrupts ();
+ }
+ ///
+ /// Should not return
+ ///
+ EFI_DEADLOOP ();
+ }
+}
+#endif
+
+/**
+ Execute call back function for Pch Reset.
+
+ @param[in] PchResetType Pch Reset Types which includes PowerCycle, Globalreset.
+
+ @retval EFI_SUCCESS The callback function has been done successfully
+ @retval EFI_NOT_FOUND Failed to find Pch Reset Callback protocol. Or, none of
+ callback protocol is installed.
+ @retval Others Do not do any reset from PCH
+**/
+EFI_STATUS
+EFIAPI
+PchResetCallback (
+ IN PCH_RESET_TYPE PchResetType
+ )
+{
+ EFI_STATUS Status;
+ UINTN NumHandles;
+ EFI_HANDLE *HandleBuffer;
+ UINTN Index;
+ PCH_RESET_CALLBACK_PROTOCOL *PchResetCallback;
+// AMI_OVERRIDE, [EIP111666] >>>
+ UINTN VariableSize = 1;
+ UINT8 TempBuffer;
+ BOOLEAN LegacyBoot = FALSE;
+// AMI_OVERRIDE, [EIP111666] <<<
+
+// AMI_OVERRIDE, [EIP111666] >>>
+ Status = gRT->GetVariable (
+ L"InLegacyBoot",
+ &gPchGetResetTypeGuid,
+ NULL,
+ &VariableSize,
+ &TempBuffer
+ );
+
+ // If variable found, we are in runtime.
+ if(!EFI_ERROR(Status))
+ LegacyBoot = TRUE;
+
+ if (!(EfiAtRuntime () || LegacyBoot)) {
+// AMI_OVERRIDE, [EIP111666] <<<
+
+ ///
+ /// Retrieve all instances of Pch Reset Callback protocol
+ ///
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gPchResetCallbackProtocolGuid,
+ NULL,
+ &NumHandles,
+ &HandleBuffer
+ );
+
+ if (EFI_ERROR (Status)) {
+ ///
+ /// Those drivers that need to install Pch Reset Callback protocol have the responsibility
+ /// to make sure themselves execute before Pch Reset Runtime driver.
+ ///
+ if (Status == EFI_NOT_FOUND) {
+ DEBUG ((EFI_D_ERROR | EFI_D_INFO, "Or, none of Pch Reset callback protocol is installed.\n"));
+ }
+
+ return Status;
+ }
+
+ for (Index = 0; Index < NumHandles; Index++) {
+ Status = gBS->HandleProtocol (
+ HandleBuffer[Index],
+ &gPchResetCallbackProtocolGuid,
+ (VOID **) &PchResetCallback
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ if (!EFI_ERROR (Status)) {
+ PchResetCallback->ResetCallback (PchResetType);
+ } else {
+ DEBUG ((EFI_D_ERROR | EFI_D_INFO, "Failed to locate Pch Reset Callback protocol.\n"));
+ return Status;
+ }
+ }
+ }
+
+#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
+ if (PchResetType == WarmReset) {
+ CapsuleReset ();
+ }
+#endif
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Fixup internal data pointers so that the services can be called in virtual mode.
+
+ @param[in] Event The event registered.
+ @param[in] Context Event context. Not used in this event handler.
+
+ @retval None
+**/
+EFI_RUNTIMESERVICE
+VOID
+PchResetVirtualAddressChangeEvent (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ gRT->ConvertPointer (EFI_INTERNAL_POINTER, (VOID *) &(mPchResetInstance->PchResetProtocol.Reset));
+ gRT->ConvertPointer (EFI_INTERNAL_POINTER, (VOID *) &(mPchResetInstance->PchRootComplexBar));
+ gRT->ConvertPointer (EFI_INTERNAL_POINTER, (VOID *) &(mPchResetInstance));
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/Reset/RuntimeDxe/PchReset.cif b/ReferenceCode/Chipset/LynxPoint/Reset/RuntimeDxe/PchReset.cif
new file mode 100644
index 0000000..ba1456a
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Reset/RuntimeDxe/PchReset.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "PchReset"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\Reset\RuntimeDxe"
+ RefName = "PchReset"
+[files]
+"PchReset.sdl"
+"PchReset.mak"
+"PchReset.c"
+"PchReset.h"
+"PchReset.dxs"
+"PchResetRuntime.inf"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/Reset/RuntimeDxe/PchReset.dxs b/ReferenceCode/Chipset/LynxPoint/Reset/RuntimeDxe/PchReset.dxs
new file mode 100644
index 0000000..7047c3a
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Reset/RuntimeDxe/PchReset.dxs
@@ -0,0 +1,39 @@
+/** @file
+ Dependency expression file.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "DxeDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+#endif
+
+DEPENDENCY_START
+ TRUE
+DEPENDENCY_END
diff --git a/ReferenceCode/Chipset/LynxPoint/Reset/RuntimeDxe/PchReset.h b/ReferenceCode/Chipset/LynxPoint/Reset/RuntimeDxe/PchReset.h
new file mode 100644
index 0000000..4a43703
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Reset/RuntimeDxe/PchReset.h
@@ -0,0 +1,83 @@
+/** @file
+ Header file for PCH RESET Runtime Driver
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PCH_RESET_H
+#define _PCH_RESET_H
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include EFI_PROTOCOL_PRODUCER (PchReset)
+#include EFI_PROTOCOL_CONSUMER (PchPlatformPolicy)
+#include EFI_GUID_DEFINITION (Capsule)
+#include "PchResetCommon.h"
+#include "DxeRuntimePciLibPciExpress.h"
+#endif
+
+/**
+ Initialize the state information for the Timer Architectural Protocol
+
+ @param[in] ImageHandle Image handle of the loaded driver
+ @param[in] SystemTable Pointer to the System Table
+
+ @retval EFI_SUCCESS Thread can be successfully created
+ @retval EFI_OUT_OF_RESOURCES Cannot allocate protocol data structure
+ @retval EFI_DEVICE_ERROR Cannot create the timer service
+**/
+EFI_STATUS
+EFIAPI
+InstallPchReset (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ );
+
+/**
+ Execute call back function for Pch Reset.
+
+ @param[in] PchResetType Pch Reset Types which includes PowerCycle, Globalreset.
+
+ @retval EFI_SUCCESS The callback function has been done successfully
+ @retval EFI_NOT_FOUND Failed to find Pch Reset Callback protocol. Or, none of
+ callback protocol is installed.
+ @retval Others Do not do any reset from PCH
+**/
+EFI_STATUS
+EFIAPI
+PchResetCallback (
+ IN PCH_RESET_TYPE PchResetType
+ );
+
+/**
+ Fixup internal data pointers so that the services can be called in virtual mode.
+
+ @param[in] Event The event registered.
+ @param[in] Context Event context. Not used in this event handler.
+
+ @retval None
+**/
+VOID
+PchResetVirtualAddressChangeEvent (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ );
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Reset/RuntimeDxe/PchReset.mak b/ReferenceCode/Chipset/LynxPoint/Reset/RuntimeDxe/PchReset.mak
new file mode 100644
index 0000000..9e3ae14
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Reset/RuntimeDxe/PchReset.mak
@@ -0,0 +1,117 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchReset/PchReset.mak 3 6/24/13 6:21a Scottyang $
+#
+# $Revision: 3 $
+#
+# $Date: 6/24/13 6:21a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchReset/PchReset.mak $
+#
+# 3 6/24/13 6:21a Scottyang
+# [TAG] EIP127297
+# [Category] Improvement
+# [Description] Update PCH RC 1.6.0.
+# [Files] SB.sd, SBDxe.c, ..\ReferenceCode\Chipset\LynxPoint\*.*
+#
+# 2 2/24/12 2:16a Victortu
+# Updated to support 4.6.5.3_IntelEDK_1117_Patch7_00.
+#
+# 1 2/08/12 9:04a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+
+#---------------------------------------------------------------------------
+# Create PchReset Driver
+#---------------------------------------------------------------------------
+EDK : PchReset
+PchReset : $(BUILD_DIR)\PchReset.mak PchResetBin
+
+
+PchReset_OBJECTS = \
+$(BUILD_DIR)\$(PchReset_DIR)\PchReset.obj
+
+$(BUILD_DIR)\PchReset.mak : $(PchReset_DIR)\$(@B).cif $(PchReset_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(PchReset_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+PchReset_INCLUDES=\
+ $(INTEL_PCH_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+
+PchReset_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=InstallPchReset"\
+ /D"__EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT_HANDLER__=PchResetVirtualAddressChangeEvent"\
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_BASE_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__ \
+ /D __EDKII_GLUE_SMM_RUNTIME_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+
+PchReset_LIB_LINKS =\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueEdkDxeRuntimeDriverLib_LIB)\
+ $(EdkIIGlueDxeMemoryAllocationLib_LIB)\
+ $(ArchProtocolLib)\
+ $(INTEL_PCH_PROTOCOL_LIB)\
+ $(EDKPROTOCOLLIB)\
+ $(PchPlatformDxeLib_LIB)\
+ $(DxeRuntimePciLibPciExpressLib_LIB)\
+ $(PchResetCommonDxeLib_LIB)\
+ $(EdkIIGlueSmmRuntimeDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueUefiRuntimeServicesTableLib_LIB)\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(EdkIIGlueDxeServicesTableLib_LIB)\
+
+PchResetBin: $(PchReset_LIB_LINKS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\PchReset.mak all \
+ "MY_INCLUDES=$(PchReset_INCLUDES)"\
+ "MY_DEFINES=$(PchReset_DEFINES)"\
+ GUID=BB1FBD4F-2E30-4793-9BED-74F672BC8FFE\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=RT_DRIVER\
+ EDKIIModule=DXEDRIVER\
+ "OBJECTS=$(PchReset_OBJECTS)" \
+ DEPEX1=$(PchReset_DIR)\PchReset.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX\
+ COMPRESS=1
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Reset/RuntimeDxe/PchReset.sdl b/ReferenceCode/Chipset/LynxPoint/Reset/RuntimeDxe/PchReset.sdl
new file mode 100644
index 0000000..40d618b
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Reset/RuntimeDxe/PchReset.sdl
@@ -0,0 +1,67 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchReset/PchReset.sdl 1 2/08/12 9:04a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 9:04a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchReset/PchReset.sdl $
+#
+# 1 2/08/12 9:04a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+TOKEN
+ Name = "PchReset_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable PchReset support in Project"
+End
+
+PATH
+ Name = "PchReset_DIR"
+ Help = "PchReset file source directory"
+End
+
+MODULE
+ File = "PchReset.mak"
+ Help = "Includes PchReset to Project"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PchReset.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Reset/RuntimeDxe/PchResetRuntime.inf b/ReferenceCode/Chipset/LynxPoint/Reset/RuntimeDxe/PchResetRuntime.inf
new file mode 100644
index 0000000..e099032
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Reset/RuntimeDxe/PchResetRuntime.inf
@@ -0,0 +1,90 @@
+## @file
+# Component description file for Pch Reset Runtime module
+#
+#@copyright
+# Copyright (c) 2011 - 2013 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+##
+
+[defines]
+BASE_NAME = PchResetRuntime
+FILE_GUID = AF59F2F5-5E28-4e03-80E2-4727545AF811
+COMPONENT_TYPE = RT_DRIVER
+
+[sources.common]
+ PchReset.c
+ PchReset.h
+ ../Common/PchResetCommon.c
+
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueDxeDriverEntryPoint.c
+
+[includes.common]
+ $(EDK_SOURCE)/Foundation/Efi
+ .
+ ../Common
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Cpu/Pentium/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[libraries.common]
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueBaseLib
+ EdkIIGlueSmmRuntimeDxeReportStatusCodeLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueEdkDxeRuntimeDriverLib
+ EdkIIGlueDxeMemoryAllocationLib
+ EdkIIGlueDxeServicesTableLib
+ ArchProtocolLib
+ $(PROJECT_PCH_FAMILY)ProtocolLib
+ PchDxeRuntimePciLibPciExpress
+ EdkProtocolLib
+ PchPlatformLib
+ EdkFrameworkProtocolLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT=_ModuleEntryPoint
+ DPX_SOURCE=PchReset.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=InstallPchReset
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT_HANDLER__=PchResetVirtualAddressChangeEvent
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_BASE_LIB__ \
+ -D __EDKII_GLUE_SMM_RUNTIME_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__ \
+ -D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__
diff --git a/ReferenceCode/Chipset/LynxPoint/S3Support/Dxe/PchS3Support.c b/ReferenceCode/Chipset/LynxPoint/S3Support/Dxe/PchS3Support.c
new file mode 100644
index 0000000..943ffd7
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/S3Support/Dxe/PchS3Support.c
@@ -0,0 +1,369 @@
+/** @file
+ This is the driver that implements the PCH S3 Support protocol
+
+@copyright
+ Copyright (c) 1999 - 2015 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "PchS3Support.h"
+#include "S3SupportHob.h"
+// AMI_OVERRIDE, [ EIP217847 ] >>>
+#include "token.h"
+// AMI_OVERRIDE, [ EIP217847 ] <<<
+
+//
+// Global Variables
+//
+EFI_HANDLE mImageHandle;
+EFI_PCH_S3_SUPPORT_PROTOCOL mPchS3SupportProtocol;
+EFI_PCH_S3_SUPPORT_SMM_PROTOCOL mPchS3SupportSmmProtocol;
+UINT32 mPchS3ImageEntryPoint;
+EFI_PCH_S3_DISPATCH_ARRAY *mPchS3CustomDispatchScript;
+
+//
+// GUID Definitions
+//
+EFI_GUID gS3SupportHobGuid = S3_SUPPORT_HOB_GUID;
+EFI_GUID gS3SupportSmramDataGuid = EFI_PCH_S3_SUPPORT_DATA_GUID;
+
+//
+// Functions
+//
+
+/**
+ PCH S3 support driver entry point
+
+ @param[in] ImageHandle Handle for the image of this driver
+ @param[in] SystemTable Pointer to the EFI System Table
+
+ @retval EFI_STATUS
+**/
+EFI_STATUS
+EFIAPI
+PchS3SupportEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+
+ DEBUG ((EFI_D_INFO, "PchS3SupportEntryPoint() Start\n"));
+ mImageHandle = ImageHandle;
+
+ ///
+ /// Initialize the Boot Services memory for the Dispatch Script Array
+ ///
+ Status = InitializePchS3CustomScriptMemory();
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ DEBUG ((EFI_D_INFO, "Dispatch Script Array Space initialized.\n"));
+
+ ///
+ /// Retrieve the PCH S3 Support PEIM entry point and load it into the Module variable
+ ///
+ Status = LoadPchS3ImageEntryPoint (&mPchS3ImageEntryPoint);
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ DEBUG ((EFI_D_INFO, "PCH S3 Image Entry Point intialized.\n"));
+
+ ///
+ /// Initialize and Install the PCH S3 Support and PCH S3 SMM Support protocols
+ ///
+ mPchS3SupportSmmProtocol.DispatchArray = mPchS3CustomDispatchScript;
+ mPchS3SupportSmmProtocol.ProtocolSize = 1; // Allocate one page
+ mPchS3SupportProtocol.SetDispatchItem = PchS3SetDispatchItem;
+ mPchS3SupportProtocol.ReadyToLock = S3SupportReadyToLock;
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &mImageHandle,
+ &gEfiPchS3SupportProtocolGuid,
+ &mPchS3SupportProtocol,
+ &gEfiPchS3SupportSmmProtocolGuid,
+ &mPchS3SupportSmmProtocol,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ DEBUG ((EFI_D_INFO, "PchS3SupportEntryPoint() End\n"));
+
+ return Status;
+}
+
+/**
+ Set an item to be dispatched at S3 resume time. This will initially create a Script
+ entry in Boot Services memory. At the same time, the entry point of the PCH S3 support
+ image is returned to be used in subsequent boot script save calls.
+
+ @param[in] This Pointer to the protocol instance.
+ @param[in] DispatchItem The item to be dispatched.
+ @param[out] S3DispatchEntryPoint The entry point of the PCH S3 support image.
+
+ @retval EFI_STATUS Successfully completed.
+ @retval EFI_OUT_OF_RESOURCES Out of resources.
+**/
+EFI_STATUS
+EFIAPI
+PchS3SetDispatchItem (
+ IN EFI_PCH_S3_SUPPORT_PROTOCOL *This,
+ IN EFI_PCH_S3_DISPATCH_ITEM *InputDispatchItem,
+ OUT EFI_PHYSICAL_ADDRESS *S3DispatchEntryPoint
+ )
+{
+ EFI_STATUS Status;
+ UINT32 TypeSize;
+ UINT32 ParameterSize;
+ UINT32 Size;
+ UINT8 *CurrentPos;
+
+ DEBUG ((EFI_D_INFO, "PchS3SetDispatchItem() Start\n"));
+
+ Status = EFI_SUCCESS;
+
+ DEBUG ((EFI_D_INFO, "Dispatch Item Address: 0x%x; Dispatch Item Type: %x\n", (UINTN)InputDispatchItem, (UINTN)InputDispatchItem->ItemType.Value));
+
+ ///
+ /// Calculate the size required;
+ /// ** Always round up to be 8 byte aligned as the script is initially created from 64-bit code in DXE
+ ///
+ switch (InputDispatchItem->ItemType.Value) {
+ case PchS3ItemTypeSendCodecCommand:
+ ParameterSize = QWORD_ALIGNED_SIZE(EFI_PCH_S3_PARAMETER_SEND_CODEC_COMMAND);
+ break;
+
+ case PchS3ItemTypeInitPcieRootPortDownstream:
+ ParameterSize = QWORD_ALIGNED_SIZE(EFI_PCH_S3_PARAMETER_INIT_PCIE_ROOT_PORT_DOWNSTREAM);
+ break;
+
+ case PchS3ItemTypePcieSetPm:
+ ParameterSize = QWORD_ALIGNED_SIZE(EFI_PCH_S3_PARAMETER_PCIE_SET_PM);
+ break;
+
+ case PchS3ItemTypeProgramIobp:
+ ParameterSize = QWORD_ALIGNED_SIZE(EFI_PCH_S3_PARAMETER_PROG_IOBP);
+ break;
+
+ default:
+ ParameterSize = 0;
+ DEBUG ((EFI_D_INFO, "Unrecognized Custom Dispatch Type\n"));
+ ASSERT (FALSE);
+ return EFI_INVALID_PARAMETER;
+ }
+
+ ///
+ /// Round up TypeSize to be 8 byte aligned
+ ///
+ TypeSize = QWORD_ALIGNED_SIZE (EFI_PCH_S3_DISPATCH_ITEM_TYPE);
+
+ ///
+ /// Total size is TypeSize + ParameterSize
+ ///
+ Size = TypeSize + ParameterSize;
+
+ if (mPchS3CustomDispatchScript->BufferSpaceRemaining < Size) {
+ DEBUG ((EFI_D_INFO, "Space remaining in Dispatch Script buffer is too small\n"));
+ ASSERT (FALSE);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ if (mPchS3CustomDispatchScript->NextDispatchItem == NULL) {
+ DEBUG ((EFI_D_INFO, "S3 Support Protocol has been unregistered. Error.\n"));
+ ASSERT (FALSE);
+ return EFI_ACCESS_DENIED;
+ }
+
+ ///
+ /// Store the dispatch type and dispatch parameter
+ ///
+ CurrentPos = mPchS3CustomDispatchScript->NextDispatchItem;
+ *(EFI_PCH_S3_DISPATCH_ITEM_TYPE *)CurrentPos = InputDispatchItem->ItemType.Value;
+ CurrentPos += TypeSize;
+ CopyMem (CurrentPos, InputDispatchItem->Parameter, ParameterSize);
+
+ ///
+ /// Move the pointer to the NextDispatchItem ahead to free space in our buffer
+ /// and decrement the space remaining data
+ ///
+ mPchS3CustomDispatchScript->NextDispatchItem += Size;
+ mPchS3CustomDispatchScript->BufferSpaceRemaining -= Size;
+
+ ///
+ /// Return the S3 Image's entry point
+ ///
+ *S3DispatchEntryPoint = mPchS3ImageEntryPoint;
+
+ DEBUG ((EFI_D_INFO, "PchS3SetDispatchItem() End\n"));
+
+ return Status;
+}
+
+
+/**
+ Perform the EFI_PCH_S3_SUPPORT_SMM_PROTOCOL IO Trap to invoke DispatchArray data copy and
+ IO Trap Unregister.
+
+ @param[in] This Pointer to the protocol instance.
+
+ @retval EFI_SUCCESS Successfully completed.
+**/
+EFI_STATUS
+EFIAPI
+S3SupportReadyToLock(
+ IN EFI_PCH_S3_SUPPORT_PROTOCOL *This
+ )
+{
+ EFI_STATUS Status;
+
+
+ DEBUG ((EFI_D_INFO, "S3SupportExitPmAuthCallback() Start\n"));
+
+ Status = EFI_SUCCESS;
+
+ DEBUG ((EFI_D_INFO, "Invoke the S3 Support IO Trap: 0x%x\n", mPchS3SupportSmmProtocol.PchS3SupportIoTrap));
+
+ ///
+ /// Invoke the SMM IO Trap Handler for invoking the data copy to SMRAM and unregistration of the IO Trap
+ ///
+ IoWrite32 (mPchS3SupportSmmProtocol.PchS3SupportIoTrap, 0);
+
+ if (mImageHandle != NULL)
+ {
+ DEBUG ((EFI_D_INFO, "Uninstall the S3 Support Protocol\n", mPchS3SupportSmmProtocol.PchS3SupportIoTrap));
+
+ Status = gBS->UninstallMultipleProtocolInterfaces (
+ mImageHandle,
+ &gEfiPchS3SupportProtocolGuid,
+ &mPchS3SupportProtocol,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
+ DEBUG ((EFI_D_INFO, "S3SupportExitPmAuthCallback() End\n"));
+
+ return Status;
+}
+
+/**
+ Initialize the Pch S3 Custom Script memory area. This will later be transferred to SMRAM.
+
+ @param[in] VOID
+
+ @retval EFI_SUCCESS Successfully completed.
+ @retval EFI_OUT_OF_RESOURCES Not enough space was available to allocate for the BS memory required.
+**/
+EFI_STATUS
+InitializePchS3CustomScriptMemory (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ EFI_PHYSICAL_ADDRESS Address;
+
+ ///
+ /// Allocate Boot Services memory for the initial copy of the PCH S3 Custom Dispatch Script
+ ///
+ Status = (gBS->AllocatePool)(
+ EfiBootServicesData,
+ EFI_PAGE_SIZE,
+ &(VOID *)Address);
+ if (!EFI_ERROR (Status)) {
+
+ mPchS3CustomDispatchScript = (EFI_PCH_S3_DISPATCH_ARRAY *)(UINTN)Address;
+
+ ///
+ /// Initialize the DispatchScriptArray
+ /// Ensure to account for the HOB space that will be needed for moving the data from SMRAM to normal
+ /// memory during S3 resume in the MaximumBufferSize parameter.
+ ///
+ mPchS3CustomDispatchScript->PchS3CustomScriptGuid = gS3SupportSmramDataGuid;
+ mPchS3CustomDispatchScript->MaximumBufferSize = EFI_PAGE_SIZE - QWORD_ALIGNED_SIZE(EFI_HOB_GUID_TYPE);
+ mPchS3CustomDispatchScript->BufferSpaceRemaining = mPchS3CustomDispatchScript->MaximumBufferSize - QWORD_ALIGNED_SIZE(EFI_PCH_S3_DISPATCH_ARRAY);
+ mPchS3CustomDispatchScript->NextDispatchItem = (UINT8*)mPchS3CustomDispatchScript + QWORD_ALIGNED_SIZE(EFI_PCH_S3_DISPATCH_ARRAY);
+ }
+
+ return Status;
+}
+
+
+/**
+ Load the entry point address of the PCHS3Peim from the HOB that it generated during the PEI phase of POST
+
+ @param[out] ImageEntryPoint The ImageEntryPoint after success loading
+
+ @retval EFI_STATUS
+**/
+EFI_STATUS
+LoadPchS3ImageEntryPoint (
+ OUT UINT32 *ImageEntryPoint
+ )
+{
+ EFI_STATUS Status;
+ S3_SUPPORT_HOB *S3SupportHob;
+// EFI_SPI_DATA_PROTOCOL *SpiDataInterface;
+
+ DEBUG ((EFI_D_INFO, "LoadPchS3ImageEntryPoint() Start\n"));
+
+ Status = EFI_SUCCESS;
+ S3SupportHob = NULL;
+ *ImageEntryPoint = 0;
+
+ //
+ // Search for the S3SupportHob
+ //
+ S3SupportHob = GetFirstGuidHob(&gS3SupportHobGuid);
+ if (S3SupportHob == NULL) {
+ DEBUG ((EFI_D_INFO, "S3SupportHob not found.\n"));
+ ASSERT_EFI_ERROR (Status);
+ return Status;
+ }
+
+ //
+ // Find the SPI protocol and save the pointer.
+ //
+// Status = gBS->LocateProtocol (&gEfiSpiDataProtocolGuid, NULL, &SpiDataInterface);
+// if (EFI_ERROR (Status)) {
+// DEBUG ((EFI_D_ERROR, "ERROR - Spi LocateProtocol failed!\n"));
+// return Status;
+// }
+
+ ///
+ /// If the PCH S3 PEIM is not located in flash, fail
+ ///
+// AMI_OVERRIDE, [ EIP217847 ] >>>
+// if (S3SupportHob->PchS3PeimEntryPoint < SpiDataInterface->BiosStartMemoryAddress ||
+// S3SupportHob->PchS3PeimEntryPoint > SpiDataInterface->BiosStartMemoryAddress + SpiDataInterface->BiosSize)
+ if ((S3SupportHob->PchS3PeimEntryPoint < (0xFFFFFFFF - FLASH_SIZE + 1)) || (S3SupportHob->PchS3PeimEntryPoint > 0xFFFFFFFF))
+// AMI_OVERRIDE, [ EIP217847 ] <<<
+ {
+ DEBUG ((EFI_D_INFO, "PchS3Image is NOT located in Flash. Current Entry Point: %x\n", S3SupportHob->PchS3PeimEntryPoint));
+
+ ASSERT(FALSE);
+ return EFI_SECURITY_VIOLATION;
+ }
+
+ // Load the HOB data from PEI execution which contains the entry point of the PCHS3Peim from Flash
+ *ImageEntryPoint = S3SupportHob->PchS3PeimEntryPoint;
+
+ DEBUG ((EFI_D_INFO, "PchS3Image is Located in Flash at Entry Point: %x\n", S3SupportHob->PchS3PeimEntryPoint));
+ DEBUG ((EFI_D_INFO, "LoadPchS3ImageEntryPoint() End\n"));
+
+ return Status;
+} \ No newline at end of file
diff --git a/ReferenceCode/Chipset/LynxPoint/S3Support/Dxe/PchS3Support.cif b/ReferenceCode/Chipset/LynxPoint/S3Support/Dxe/PchS3Support.cif
new file mode 100644
index 0000000..cbd8f6a
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/S3Support/Dxe/PchS3Support.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "PchS3Support"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\S3Support\Dxe"
+ RefName = "PchS3Support"
+[files]
+"PchS3Support.sdl"
+"PchS3Support.mak"
+"PchS3Support.c"
+"PchS3Support.h"
+"PchS3Support.dxs"
+"PchS3Support.inf"
+<endComponent> \ No newline at end of file
diff --git a/ReferenceCode/Chipset/LynxPoint/S3Support/Dxe/PchS3Support.dxs b/ReferenceCode/Chipset/LynxPoint/S3Support/Dxe/PchS3Support.dxs
new file mode 100644
index 0000000..8c346bd
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/S3Support/Dxe/PchS3Support.dxs
@@ -0,0 +1,45 @@
+/** @file
+ Dispatch dependency expression file for the PchS3Support driver.
+
+@copyright
+ Copyright (c) 1999 - 2015 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "DxeDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+
+#include EFI_PROTOCOL_DEFINITION (BootScriptSave)
+#include EFI_PROTOCOL_CONSUMER (Spi)
+#endif
+
+//DEPENDENCY_START
+// EFI_BOOT_SCRIPT_SAVE_PROTOCOL_GUID AND
+// EFI_SPI_DATA_PROTOCOL_GUID
+//DEPENDENCY_END
+DEPENDENCY_START
+ EFI_BOOT_SCRIPT_SAVE_PROTOCOL_GUID
+DEPENDENCY_END \ No newline at end of file
diff --git a/ReferenceCode/Chipset/LynxPoint/S3Support/Dxe/PchS3Support.h b/ReferenceCode/Chipset/LynxPoint/S3Support/Dxe/PchS3Support.h
new file mode 100644
index 0000000..817f786
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/S3Support/Dxe/PchS3Support.h
@@ -0,0 +1,126 @@
+/** @file
+ Header file for PCH S3 Support driver
+
+@copyright
+ Copyright (c) 1999 - 2015 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PCH_S3_SUPPORT_DRIVER_H_
+#define _PCH_S3_SUPPORT_DRIVER_H_
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+
+#include "EdkIIGlueDxe.h"
+#include "EfiScriptLib.h"
+
+//
+// Driver Produced Protocol Prototypes
+//
+#include EFI_PROTOCOL_PRODUCER (PchS3Support)
+#include EFI_GUID_DEFINITION (S3SupportHob)
+#include EFI_PROTOCOL_CONSUMER (Spi)
+
+#include "PchAccess.h"
+#include "PchPlatformLib.h"
+#endif
+
+///
+/// EDK and EDKII have different GUID formats
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#define EFI_PCH_S3_IMAGE_GUID \
+ { \
+ 0x271dd6f2, 0x54cb, 0x45e6, 0x85, 0x85, 0x8c, 0x92, 0x3c, 0x1a, 0xc7, 0x6 \
+ }
+#else
+#define EFI_PCH_S3_IMAGE_GUID \
+ { \
+ 0x271dd6f2, 0x54cb, 0x45e6, \
+ { \
+ 0x85, 0x85, 0x8c, 0x92, 0x3c, 0x1a, 0xc7, 0x6 \
+ } \
+ }
+#endif
+
+extern EFI_GUID gEfiSpiProtocolGuid;
+
+//
+// Function prototypes
+//
+
+/**
+ Set an item to be dispatched at S3 resume time. At the same time, the entry point
+ of the PCH S3 support image is returned to be used in subsequent boot script save
+ call
+
+ @param[in] This Pointer to the protocol instance.
+ @param[in] InputDispatchItem The item to be dispatched.
+ @param[out] S3DispatchEntryPoint The entry point of the PCH S3 support image.
+
+ @retval EFI_STATUS Successfully completed.
+ @retval EFI_OUT_OF_RESOURCES Out of resources.
+**/
+EFI_STATUS
+EFIAPI
+PchS3SetDispatchItem (
+ IN EFI_PCH_S3_SUPPORT_PROTOCOL *This,
+ IN EFI_PCH_S3_DISPATCH_ITEM *InputDispatchItem,
+ OUT EFI_PHYSICAL_ADDRESS *S3DispatchEntryPoint
+ );
+
+/**
+ Perform the EFI_PCH_S3_SUPPORT_SMM_PROTOCOL IO Trap to invoke DispatchArray data copy and
+ IO Trap Unregister.
+
+ @param[in] This Pointer to the protocol instance.
+
+ @retval EFI_SUCCESS Successfully completed.
+**/
+EFI_STATUS
+EFIAPI
+S3SupportReadyToLock(
+ IN EFI_PCH_S3_SUPPORT_PROTOCOL *This
+ );
+
+/**
+ Initialize the Pch S3 Custom Script memory area. This will later be transferred to SMRAM.
+
+ @param[in] VOID
+
+ @retval None
+**/
+EFI_STATUS
+InitializePchS3CustomScriptMemory (
+ VOID
+ );
+
+/**
+ Load the entry point address of the PCHS3Peim from the HOB that it generated during the PEI phase of POST
+
+ @param[out] ImageEntryPoint The ImageEntryPoint after success loading
+
+ @retval EFI_STATUS
+**/
+EFI_STATUS
+LoadPchS3ImageEntryPoint (
+ OUT UINT32 *ImageEntryPoint
+ );
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/S3Support/Dxe/PchS3Support.inf b/ReferenceCode/Chipset/LynxPoint/S3Support/Dxe/PchS3Support.inf
new file mode 100644
index 0000000..c65847f
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/S3Support/Dxe/PchS3Support.inf
@@ -0,0 +1,103 @@
+## @file
+# Component description file for Pch Initialization driver
+#
+#@copyright
+# Copyright (c) 1999 - 2015 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = PchS3Support
+FILE_GUID = C7EA9787-CA0A-43b4-B1E5-25EF87391F8D
+COMPONENT_TYPE = BS_DRIVER
+
+[sources.common]
+ PchS3Support.h
+ PchS3Support.c
+
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueDxeDriverEntryPoint.c
+
+[includes.common]
+ $(EDK_SOURCE)/Foundation/Efi
+ .
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Framework/Guid/Hob
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Guid/S3SupportHob
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Protocol
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Protocol/PchPlatformPolicy
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Protocol/PchS3Support
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include/Library
+
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/SampleCode
+
+[libraries.common]
+ EfiScriptLib
+ EfiCommonLib
+ EdkProtocolLib
+ EdkFrameworkProtocolLib
+ $(PROJECT_PCH_FAMILY)ProtocolLib
+ PchPlatformLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueDxeReportStatusCodeLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueDxeServicesTableLib
+ EdkIIGlueDxeMemoryAllocationLib
+ EdkIIGlueDxeHobLib
+ EdkIIGlueBasePciLibPciExpress
+ EfiDriverLib
+ EdkIIGlueUefiDevicePathLib
+ EdkIIGlueUefiLib
+ EfiGuidLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = PchS3Support.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=PchS3SupportEntryPoint
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ -D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+ -D __EDKII_GLUE_DXE_HOB_LIB__
diff --git a/ReferenceCode/Chipset/LynxPoint/S3Support/Dxe/PchS3Support.mak b/ReferenceCode/Chipset/LynxPoint/S3Support/Dxe/PchS3Support.mak
new file mode 100644
index 0000000..cabc751
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/S3Support/Dxe/PchS3Support.mak
@@ -0,0 +1,115 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2015, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+# $Header: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/S3Support/Dxe/PchS3Support.mak 1 5/21/15 2:53a Dennisliu $
+#
+# $Revision: 1 $
+#
+# $Date: 5/21/15 2:53a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/S3Support/Dxe/PchS3Support.mak $
+#
+# 1 5/21/15 2:53a Dennisliu
+# [TAG] EIP217847
+# [Category] Improvement
+# [Description] [PCH] Shark Bay-M/DT Reference Code Production Version
+# 1.9.1
+# [Files] PchS3Support.sdl
+# PchS3Support.mak
+# PchS3Support.c
+# PchS3Support.h
+# PchS3Support.dxs
+# PchS3Support.inf
+#
+#*************************************************************************
+
+#---------------------------------------------------------------------------
+# Create PchS3Support Driver
+#---------------------------------------------------------------------------
+EDK : PchS3Support
+PchS3Support : $(BUILD_DIR)\PchS3Support.mak PchS3SupportBin
+
+
+$(BUILD_DIR)\PchS3Support.mak : $(PchS3Support_DIR)\$(@B).cif $(PchS3Support_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(PchS3Support_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+PchS3Support_INCLUDES=\
+ $(INTEL_PCH_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+
+PchS3Support_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=PchS3SupportEntryPoint"\
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+ /D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_DXE_HOB_LIB__ \
+
+PchS3Support_LIB_LINKS =\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(EDKPROTOCOLLIB)\
+ $(PchPlatformDxeLib_LIB)\
+ $(EFISCRIPTLIB) $(EFIPROTOCOLLIB)\
+ $(INTEL_PCH_PROTOCOL_LIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueDxeServicesTableLib_LIB)\
+ $(PchS3SupportCommonDxeLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(EdkIIGlueUefiRuntimeServicesTableLib_LIB)\
+ $(EFIDRIVERLIB)\
+ $(EdkIIGlueUefiDevicePathLib_LIB)\
+ $(EdkIIGlueUefiLib_LIB)\
+ $(EdkIIGlueDxeHobLib_LIB)\
+
+
+PchS3SupportBin: $(PchS3Support_LIB_LINKS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\PchS3Support.mak all \
+ "MY_INCLUDES=$(PchS3Support_INCLUDES)"\
+ "MY_DEFINES=$(PchS3Support_DEFINES)"\
+ GUID=08F2C63B-08DE-4ccd-8670-ACFE644A1C48\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=BS_DRIVER\
+ EDKIIModule=DXEDRIVER\
+ DEPEX1=$(PchS3Support_DIR)\PchS3Support.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX\
+ COMPRESS=1
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2015, 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/ReferenceCode/Chipset/LynxPoint/S3Support/Dxe/PchS3Support.sdl b/ReferenceCode/Chipset/LynxPoint/S3Support/Dxe/PchS3Support.sdl
new file mode 100644
index 0000000..15c9702
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/S3Support/Dxe/PchS3Support.sdl
@@ -0,0 +1,75 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2015, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+# $Header: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/S3Support/Dxe/PchS3Support.sdl 1 5/21/15 2:53a Dennisliu $
+#
+# $Revision: 1 $
+#
+# $Date: 5/21/15 2:53a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/S3Support/Dxe/PchS3Support.sdl $
+#
+# 1 5/21/15 2:53a Dennisliu
+# [TAG] EIP217847
+# [Category] Improvement
+# [Description] [PCH] Shark Bay-M/DT Reference Code Production Version
+# 1.9.1
+# [Files] PchS3Support.sdl
+# PchS3Support.mak
+# PchS3Support.c
+# PchS3Support.h
+# PchS3Support.dxs
+# PchS3Support.inf
+#
+#*************************************************************************
+TOKEN
+ Name = "PchS3Support_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable PchS3Support support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "PchS3Support_DIR"
+End
+
+MODULE
+ Help = "Includes PchS3Support.mak to Project"
+ File = "PchS3Support.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PchS3Support.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2015, 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/ReferenceCode/Chipset/LynxPoint/S3Support/Pei/PchS3Peim.c b/ReferenceCode/Chipset/LynxPoint/S3Support/Pei/PchS3Peim.c
new file mode 100644
index 0000000..7e7149e
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/S3Support/Pei/PchS3Peim.c
@@ -0,0 +1,563 @@
+/** @file
+ This is the PEIM that performs the S3 resume tasks.
+
+@copyright
+ Copyright (c) 2008 - 2015 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "PchS3Peim.h"
+#include "S3SupportHob.h"
+
+//
+// GUID Definitions
+//
+EFI_GUID gS3SupportHobGuid = S3_SUPPORT_HOB_GUID;
+EFI_GUID gS3SupportSmramDataGuid = EFI_PCH_S3_SUPPORT_DATA_GUID;
+EFI_GUID gS3DataHobGuid = S3_DATA_HOB_GUID;
+
+static EFI_PEI_NOTIFY_DESCRIPTOR mSmmAccessCallbackList = {
+ (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+ &gPeiSmmAccessPpiGuid,
+ CreateS3DataHob
+};
+
+
+
+/**
+ PCH S3 PEIM entry point. This Entry Point is entered for three separate reasons.
+ 1. It is entered via dispatcher in standard POST in order to create a HOB for
+ the DXE module to find it's EntryPoint.
+ 2. It is entered via dispatcher in S3 Resume in order to find the Dispatch Script
+ in SMRAM and copy it to a HOB in Boot Services memory.
+ 3. It is entered in response to an invocation from the Boot Script Dispatch Opcode.
+
+ In all three cases it is critical that this code is executed directly from Flash and
+ not from a location in memory.
+
+
+ @param[in] FfsHeader Header for FFS
+ @param[in] PeiServices PEI Services table pointer
+
+ @retval EFI_SUCCESS Successfully completed
+**/
+EFI_STATUS
+EFIAPI
+InitializePchS3Peim (
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_STATUS Status;
+ UINT32 ParameterSize;
+ UINT32 TypeSize;
+ UINT32 Size;
+ EFI_PCH_S3_DISPATCH_ARRAY *DispatchArray;
+ EFI_PCH_S3_DISPATCH_ITEM *DispatchItem;
+ S3_SUPPORT_HOB *S3SupportHob;
+ S3_DATA_HOB *GuidHob;
+ PEI_SMM_ACCESS_PPI *SmmAccessPpi;
+
+ DEBUG ((EFI_D_INFO, "InitializePchS3Peim() Start\n"));
+
+ Status = EFI_SUCCESS;
+
+ GuidHob = (S3_DATA_HOB *)GetFirstGuidHob (&gS3DataHobGuid);
+
+ ///
+ /// Search for the S3 Data Hob
+ /// Not finding the Hob indicates that this is the initial pass through this code for any particular POST (S3, S4, S5 or other)
+ ///
+ if (GuidHob == NULL)
+ {
+ //
+ // If we are entering the entry point for the first time on a specific boot (regardless of mode),
+ // then we need to generate a HOB with the entry point information in order to pass the data to DXE
+ // for entry into the Boot Script.
+ //
+ DEBUG ((EFI_D_INFO, "PCH S3 Data HOB didn't exist\n"));
+ DEBUG ((EFI_D_INFO, "Attempt to create the PchS3Peim S3 Support Hob\n"));
+
+ Status = (*PeiServices)->CreateHob (
+ PeiServices,
+ EFI_HOB_TYPE_GUID_EXTENSION,
+ sizeof (S3_SUPPORT_HOB),
+ &S3SupportHob
+ );
+ if (!EFI_ERROR (Status)) {
+ S3SupportHob->Header.Name = gS3SupportHobGuid;
+ S3SupportHob->PchS3PeimEntryPoint = (UINTN) _ModuleEntryPoint;
+ DEBUG ((EFI_D_INFO, "PCH S3 Hob Created - %g\n", &gS3SupportHobGuid));
+ }
+
+ DEBUG ((EFI_D_INFO, "Collect data from SMRAM for PCH S3 Data Script\n"));
+
+ ///
+ /// Creation of the S3 Data Hob is only needed on S3. However, the boot mode can't be trusted
+ /// until after Memory Initialization has been completed because of RapidStart (FFS).
+ /// As a result, we will check boot mode inside of the CreateS3DataHob function after the SmmAccessPpi
+ /// is available.
+ ///
+ Status = PeiServicesLocatePpi (
+ &gPeiSmmAccessPpiGuid,
+ 0,
+ NULL,
+ (VOID **)&SmmAccessPpi
+ );
+ if (Status == EFI_SUCCESS)
+ {
+
+ ///
+ /// Then this is our first call on S3 resume
+ /// Find the PCH S3 Boot Script within SMRAM and create the HOB used for executing the Script
+ ///
+ Status = CreateS3DataHob (PeiServices, NULL, SmmAccessPpi);
+ DEBUG ((EFI_D_INFO, "CreateS3DataHob, result=%r\n", Status));
+
+ }
+ else
+ {
+ ///
+ /// Register for notify if SMM_ACCESS isn't yet available.
+ /// We can't have a module dependency on SMM_ACCESS because the module
+ /// must be called on both Normal Boot and S3 resume. SMM_ACCESS
+ /// PPI isn't published on Normal Boot, however.
+ ///
+ DEBUG ((EFI_D_INFO, "SMM Access protocol not yet available -> Register for notification later.\n"));
+
+ //
+ // Register notify to set default variable once variable service is ready.
+ //
+ Status = (**PeiServices).NotifyPpi (PeiServices, &mSmmAccessCallbackList);
+ ASSERT_PEI_ERROR (PeiServices, Status);
+
+ }
+ return Status;
+ }
+ else
+ {
+ DEBUG ((EFI_D_INFO, "PchS3Peim S3 Data Hob located. Proceed with Dispatch.\n"));
+
+ ///
+ /// Setup the DispatchArray variable to point at the Hob
+ ///
+ DispatchArray = (EFI_PCH_S3_DISPATCH_ARRAY *)(VOID *)&GuidHob->S3DispatchDataArray;
+ }
+
+ DEBUG ((EFI_D_INFO, "Dispatch Array Located -> 0x%x\n", DispatchArray));
+ DEBUG ((EFI_D_INFO, "Dispatch Item Located (Current NextDispatchItem entry) -> 0x%x\n", DispatchArray->NextDispatchItem));
+
+ DispatchItem = (EFI_PCH_S3_DISPATCH_ITEM *)DispatchArray->NextDispatchItem;
+
+ DEBUG ((EFI_D_INFO, "Dispatch Item Type -> 0x%x\n", DispatchItem->ItemType.Value));
+
+ ///
+ /// Calculate the size required;
+ /// ** Always round up to be 8 byte aligned as the script is initially created from 64-bit code in DXE
+ ///
+ TypeSize = QWORD_ALIGNED_SIZE (EFI_PCH_S3_DISPATCH_ITEM_TYPE);
+
+ switch (DispatchItem->ItemType.Value) {
+ case PchS3ItemTypeSendCodecCommand:
+ ParameterSize = QWORD_ALIGNED_SIZE(EFI_PCH_S3_PARAMETER_SEND_CODEC_COMMAND);
+ Status = PchS3SendCodecCommand ((EFI_PCH_S3_PARAMETER_SEND_CODEC_COMMAND *)&DispatchItem->Parameter);
+ break;
+
+ case PchS3ItemTypeInitPcieRootPortDownstream:
+ ParameterSize = QWORD_ALIGNED_SIZE(EFI_PCH_S3_PARAMETER_INIT_PCIE_ROOT_PORT_DOWNSTREAM);
+ Status = PchS3InitPcieRootPortDownstream ((EFI_PCH_S3_PARAMETER_INIT_PCIE_ROOT_PORT_DOWNSTREAM *)&DispatchItem->Parameter);
+ if (Status == EFI_NOT_FOUND) {
+ ///
+ /// EFI_NOT_FOUND is not an error here
+ ///
+ Status = EFI_SUCCESS;
+ }
+ break;
+
+ case PchS3ItemTypePcieSetPm:
+ ParameterSize = QWORD_ALIGNED_SIZE(EFI_PCH_S3_PARAMETER_PCIE_SET_PM);
+ Status = PchS3PcieSetPm ((EFI_PCH_S3_PARAMETER_PCIE_SET_PM *)&DispatchItem->Parameter);
+ if (Status == EFI_NOT_FOUND) {
+ ///
+ /// EFI_NOT_FOUND is not an error here
+ ///
+ Status = EFI_SUCCESS;
+ }
+ break;
+
+ case PchS3ItemTypeProgramIobp:
+ ParameterSize = QWORD_ALIGNED_SIZE(EFI_PCH_S3_PARAMETER_PROG_IOBP);
+ Status = PchS3ProgramIobp ((EFI_PCH_S3_PARAMETER_PROG_IOBP *)&DispatchItem->Parameter);
+ break;
+
+ default:
+ ParameterSize = 0;
+ DEBUG ((EFI_D_INFO, "Parameter not found\n"));
+
+ ASSERT (FALSE);
+ break;
+ }
+
+ ///
+ /// Advance the Execution Position
+ ///
+ Size = ParameterSize + TypeSize;
+ DispatchArray->NextDispatchItem += Size;
+
+ if ((UINTN)DispatchArray->NextDispatchItem > (UINTN)((UINT8*)DispatchArray + DispatchArray->MaximumBufferSize)) {
+ ///
+ /// We are beyond end, wrap for the next S3 resume path
+ ///
+ DispatchArray->NextDispatchItem = (UINT8*)DispatchArray + QWORD_ALIGNED_SIZE(EFI_PCH_S3_DISPATCH_ARRAY);
+ }
+
+ DEBUG ((EFI_D_INFO, "InitializePchS3Peim() End\n"));
+
+ return Status;
+}
+
+/**
+This routine is used to search SMRAM and get SmramCpuData point.
+
+@param[in] PeiServices - PEI services global pointer
+@param[in] SmmAccessPpi - SmmAccess PPI instance
+
+@retval SmramCpuData - The pointer of CPU information in SMRAM.
+**/
+EFI_STATUS
+CreateS3DataHob (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
+ IN VOID *Interface
+ )
+{
+ EFI_SMRAM_DESCRIPTOR *SmramRanges;
+ UINTN SmramRangeCount;
+ UINTN Size;
+ EFI_STATUS Status;
+ UINT32 Address;
+ EFI_PCH_S3_DISPATCH_ARRAY *S3DispatchArray;
+ PEI_SMM_ACCESS_PPI *SmmAccessPpi;
+ BOOLEAN Found;
+ UINTN Index;
+ S3_DATA_HOB *GuidHob;
+ EFI_BOOT_MODE BootMode;
+
+ DEBUG ((EFI_D_INFO, "CreateS3DataHob() Start\n"));
+
+ ///
+ /// Now that we know we have a valid Boot Mode.
+ /// Check it to see if we need to process the S3 Data Hob Request
+ ///
+ Status = (*PeiServices)->GetBootMode (PeiServices, &BootMode);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_INFO, "PchS3Peim S3 Boot Mode not available.\n"));
+ return Status;
+ }
+
+ DEBUG ((EFI_D_INFO, "PchS3Peim S3 Boot Mode Check: %x\n", BootMode));
+
+ if (BootMode != BOOT_ON_S3_RESUME) {
+ //
+ // Only Create the S3 Data Hob on S3 resume
+ //
+ return Status;
+ }
+
+ SmmAccessPpi = (PEI_SMM_ACCESS_PPI *)Interface;
+
+ Found = FALSE;
+ S3DispatchArray = NULL;
+
+ ///
+ /// Open all SMM regions
+ ///
+ Index = 0;
+ do {
+ Status = SmmAccessPpi->Open (PeiServices, SmmAccessPpi, Index);
+ Index++;
+ } while (!EFI_ERROR (Status));
+
+ ///
+ /// Get all SMRAM range
+ ///
+ Size = 0;
+ Status = SmmAccessPpi->GetCapabilities (PeiServices, SmmAccessPpi, &Size, NULL);
+ ASSERT (Status == EFI_BUFFER_TOO_SMALL);
+
+ Status = PeiServicesAllocatePool (
+ Size,
+ (VOID **)&SmramRanges
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ Status = SmmAccessPpi->GetCapabilities (PeiServices, SmmAccessPpi, &Size, SmramRanges);
+ ASSERT_EFI_ERROR (Status);
+
+ Size /= sizeof (*SmramRanges);
+ SmramRangeCount = Size;
+
+ ///
+ /// Assume TSEG is the last range of SMRAM in SmramRanges
+ ///
+ SmramRanges += SmramRangeCount - 1;
+
+ ///
+ /// Search SMRAM on page alignment for the SMM PCH S3 SMRAM Data signature
+ ///
+ for (Address = (UINT32)(SmramRanges->CpuStart + SmramRanges->PhysicalSize - EFI_PAGE_SIZE);
+ Address >= (UINT32)SmramRanges->CpuStart;
+ Address -= EFI_PAGE_SIZE
+ ) {
+ S3DispatchArray = (EFI_PCH_S3_DISPATCH_ARRAY *)(UINTN)Address;
+ if (CompareGuid (&S3DispatchArray->PchS3CustomScriptGuid, &gS3SupportSmramDataGuid)) {
+ ///
+ /// Find it
+ ///
+ Found = TRUE;
+ break;
+ }
+ }
+
+ ///
+ /// Close all SMM regions
+ ///
+ Index = 0;
+ do {
+ Status = SmmAccessPpi->Close (PeiServices, SmmAccessPpi, Index);
+ Index++;
+ } while (!EFI_ERROR (Status));
+
+
+ if (!Found)
+ {
+ DEBUG ((EFI_D_INFO, "S3 Dispatch Data Not Found!\n"));
+ return EFI_NOT_FOUND;
+ }
+
+ ///
+ /// Generate Hob from SMRAM Data
+ ///
+ Status = (*PeiServices)->CreateHob (
+ PeiServices,
+ EFI_HOB_TYPE_GUID_EXTENSION,
+ EFI_PAGE_SIZE,
+ &GuidHob
+ );
+
+ if (!EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_INFO, "PchS3Peim S3 Data Hob created: Address - 0x%x\n", (UINTN)GuidHob));
+
+ GuidHob->Header.Name = gS3DataHobGuid;
+ CopyMem (&GuidHob->S3DispatchDataArray, S3DispatchArray, S3DispatchArray->MaximumBufferSize);
+
+ ///
+ /// Reset the NextDispatchItem to the beginning of the buffer for playback.
+ ///
+ S3DispatchArray = (EFI_PCH_S3_DISPATCH_ARRAY *)(UINTN)&GuidHob->S3DispatchDataArray;
+ S3DispatchArray->NextDispatchItem = (UINT8 *)S3DispatchArray + QWORD_ALIGNED_SIZE(EFI_PCH_S3_DISPATCH_ARRAY);
+
+ }
+
+ DEBUG ((EFI_D_INFO, "CreateS3DataHob() End\n"));
+
+ return EFI_SUCCESS;
+}
+
+
+#define AZALIA_MAX_LOOP_TIME 10
+#define AZALIA_WAIT_PERIOD 100
+
+/**
+ Polling the Status bit
+
+ @param[in] StatusReg The regsiter address to read the status
+ @param[in] PollingBitMap The bit mapping for polling
+ @param[in] PollingData The Data for polling
+
+ @retval EFI_SUCCESS The function completed successfully
+ @retval EFI_TIMEOUT Polling the bit map time out
+**/
+static
+EFI_STATUS
+CodecStatusPolling (
+ IN UINT32 StatusReg,
+ IN UINT16 PollingBitMap,
+ IN UINT16 PollingData
+ )
+{
+ UINT32 LoopTime;
+
+ for (LoopTime = 0; LoopTime < AZALIA_MAX_LOOP_TIME; LoopTime++) {
+ if ((MmioRead16 (StatusReg) & PollingBitMap) == PollingData) {
+ break;
+ } else {
+ PchPmTimerStall (AZALIA_WAIT_PERIOD);
+ }
+ }
+
+ if (LoopTime >= AZALIA_MAX_LOOP_TIME) {
+ return EFI_TIMEOUT;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Send Codec command on S3 resume
+
+ @param[in] Parameter Parameters passed in from DXE
+
+ @retval EFI_DEVICE_ERROR Device status error, operation failed
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+PchS3SendCodecCommand (
+ EFI_PCH_S3_PARAMETER_SEND_CODEC_COMMAND *Parameter
+ )
+{
+ UINT32 HdaBar;
+ UINT32 *CodecCommandData;
+ EFI_STATUS Status;
+
+ HdaBar = Parameter->HdaBar;
+ CodecCommandData = &Parameter->CodecCmdData;
+
+ DEBUG ((EFI_D_INFO, "Going to SendCodecCommand: %08x! \n", *CodecCommandData));
+ Status = CodecStatusPolling (HdaBar + R_HDA_IRS, (UINT16) B_HDA_IRS_ICB, (UINT16) 0);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "ICB bit is not zero before SendCodecCommand! \n"));
+ return EFI_DEVICE_ERROR;
+ }
+
+ MmioWrite32 (HdaBar + R_HDA_IC, *CodecCommandData);
+ MmioOr16 ((UINTN) (HdaBar + R_HDA_IRS), (UINT16) ((B_HDA_IRS_IRV | B_HDA_IRS_ICB)));
+
+ Status = CodecStatusPolling (HdaBar + R_HDA_IRS, (UINT16) B_HDA_IRS_ICB, (UINT16) 0);
+ if (EFI_ERROR (Status)) {
+ MmioAnd16 ((UINTN) (HdaBar + R_HDA_IRS), (UINT16)~(B_HDA_IRS_ICB));
+ DEBUG ((EFI_D_ERROR, "SendCodecCommand: SendCodecCommand:%08x fail! \n"));
+ return Status;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Perform Init Root Port Downstream devices on S3 resume
+
+ @param[in] Parameter Parameters passed in from DXE
+
+ @retval EFI_STATUS
+**/
+EFI_STATUS
+PchS3InitPcieRootPortDownstream (
+ EFI_PCH_S3_PARAMETER_INIT_PCIE_ROOT_PORT_DOWNSTREAM *Parameter
+ )
+{
+ EFI_STATUS Status;
+
+ Status = PchPcieInitRootPortDownstreamDevices (
+ Parameter->RootPortBus,
+ Parameter->RootPortDevice,
+ Parameter->RootPortFunc,
+ Parameter->TempBusNumberMin,
+ Parameter->TempBusNumberMax,
+ NULL
+ );
+ ///
+ /// Not checking the error status here - downstream device not present does not
+ /// mean an error of this root port. Our return status of EFI_SUCCESS means this
+ /// port is enabled and outer function depends on this return status to do
+ /// subsequent initializations.
+ ///
+ return Status;
+}
+
+/**
+ Perform Root Port Downstream devices PCIE ASPM and LTR override on S3 resume
+
+ @param[in] Parameter Parameters passed in from DXE
+
+ @retval EFI_STATUS
+**/
+EFI_STATUS
+PchS3PcieSetPm (
+ EFI_PCH_S3_PARAMETER_PCIE_SET_PM *Parameter
+ )
+{
+ EFI_STATUS Status;
+ PCH_PCIE_DEVICE_ASPM_OVERRIDE *DevAspmOverride;
+ PCH_PCIE_DEVICE_LTR_OVERRIDE *DevLtrOverride;
+ PCH_PCIE_PWR_OPT *S3PchPwrOptPcie;
+ BOOLEAN L1SubstatesSupported;
+ BOOLEAN LtrSupported;
+
+ DevAspmOverride = (PCH_PCIE_DEVICE_ASPM_OVERRIDE *) (UINTN) Parameter->DevAspmOverrideAddr;
+ DevLtrOverride = (PCH_PCIE_DEVICE_LTR_OVERRIDE *) (UINTN) Parameter->DevLtrOverrideAddr;
+ S3PchPwrOptPcie = (PCH_PCIE_PWR_OPT *) (UINTN) Parameter->PchPwrOptPcie;
+ Status = PcieSetPm (
+ Parameter->RootPortBus,
+ Parameter->RootPortDevice,
+ Parameter->RootPortFunc,
+ Parameter->RootPortAspm,
+ Parameter->NumOfDevAspmOverride,
+ DevAspmOverride,
+ Parameter->TempBusNumberMin,
+ Parameter->TempBusNumberMax,
+ Parameter->NumOfDevLtrOverride,
+ DevLtrOverride,
+ S3PchPwrOptPcie,
+ &L1SubstatesSupported,
+ Parameter->L1SubstatesConfig,
+ Parameter->PolicyRevision,
+ Parameter->FirstRPToSetPm,
+ Parameter->L1SupportedInAllEnabledPorts,
+ Parameter->ClkreqSupportedInAllEnabledPorts,
+ &LtrSupported
+ );
+ ///
+ /// Not checking the error status here - downstream device not present does not
+ /// mean an error of this root port. Our return status of EFI_SUCCESS means this
+ /// port is enabled and outer function depends on this return status to do
+ /// subsequent initializations.
+ ///
+ return Status;
+}
+
+/**
+ Perform PCH IOBP programming on S3 resume
+
+ @param[in] Parameter Parameters passed in from DXE
+
+ @retval EFI_STATUS
+**/
+EFI_STATUS
+PchS3ProgramIobp (
+ EFI_PCH_S3_PARAMETER_PROG_IOBP *Parameter
+ )
+{
+ EFI_STATUS Status;
+
+ Status = ProgramIobp (
+ Parameter->RootComplexBar,
+ Parameter->Address,
+ Parameter->AndMask,
+ Parameter->OrMask
+ );
+
+ return Status;
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/S3Support/Pei/PchS3Peim.cif b/ReferenceCode/Chipset/LynxPoint/S3Support/Pei/PchS3Peim.cif
new file mode 100644
index 0000000..d19743c
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/S3Support/Pei/PchS3Peim.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "PchS3Peim"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\S3Support\Pei"
+ RefName = "PchS3Peim"
+[files]
+"PchS3Peim.sdl"
+"PchS3Peim.mak"
+"PchS3Peim.h"
+"PchS3Peim.c"
+"PchS3Peim.dxs"
+"PchS3Peim.inf"
+<endComponent> \ No newline at end of file
diff --git a/ReferenceCode/Chipset/LynxPoint/S3Support/Pei/PchS3Peim.dxs b/ReferenceCode/Chipset/LynxPoint/S3Support/Pei/PchS3Peim.dxs
new file mode 100644
index 0000000..fbeaa9b
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/S3Support/Pei/PchS3Peim.dxs
@@ -0,0 +1,41 @@
+/** @file
+ Dispatch dependency expression file for the PchS3Peim driver.
+
+@copyright
+ Copyright (c) 1999 - 2015 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "PeimDepex.h"
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+
+#include "Common/EdkIIGlueDefinitionChangesPeim.h"
+#include EFI_PPI_DEFINITION (BootMode)
+
+#endif
+
+DEPENDENCY_START
+ PEI_MASTER_BOOT_MODE_PEIM_PPI
+DEPENDENCY_END
diff --git a/ReferenceCode/Chipset/LynxPoint/S3Support/Pei/PchS3Peim.h b/ReferenceCode/Chipset/LynxPoint/S3Support/Pei/PchS3Peim.h
new file mode 100644
index 0000000..133904a
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/S3Support/Pei/PchS3Peim.h
@@ -0,0 +1,106 @@
+/** @file
+ This is the PEIM that performs the S3 resume tasks.
+
+@copyright
+ Copyright (c) 2008 - 2015 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PCH_S3_PEIM_H_
+#define _PCH_S3_PEIM_H_
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#include "PchAccess.h"
+#include "PchPlatformLib.h"
+#include "PchPlatformPolicy.h"
+#include "PchPciExpressHelpersLib.h"
+#include EFI_PROTOCOL_CONSUMER (PchS3Support)
+#include EFI_PPI_DEPENDENCY (Variable)
+#include EFI_PPI_DEPENDENCY (SmmAccess)
+
+#endif
+
+#define EFI_PCH_S3_STALL_INTERVAL 50 ///< us
+
+/**
+This routine is used to search SMRAM and get SmramCpuData point.
+
+@param[in] PeiServices - PEI services global pointer
+@param[in] SmmAccessPpi - SmmAccess PPI instance
+
+@retval SmramCpuData - The pointer of CPU information in SMRAM.
+**/
+EFI_STATUS
+CreateS3DataHob (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
+ IN VOID *Interface
+ );
+
+/**
+ Send Codec command on S3 resume
+
+ @param[in] Parameter Parameters passed in from DXE
+
+ @retval EFI_DEVICE_ERROR Device status error, operation failed
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+PchS3SendCodecCommand (
+ EFI_PCH_S3_PARAMETER_SEND_CODEC_COMMAND *Parameter
+ );
+
+/**
+ Perform Init Root Port Downstream devices on S3 resume
+
+ @param[in] Parameter Parameters passed in from DXE
+
+ @retval EFI_STATUS
+**/
+EFI_STATUS
+PchS3InitPcieRootPortDownstream (
+ EFI_PCH_S3_PARAMETER_INIT_PCIE_ROOT_PORT_DOWNSTREAM *Parameter
+ );
+
+/**
+ Perform Root Port Downstream devices PCIE ASPM and LTR override on S3 resume
+
+ @param[in] Parameter Parameters passed in from DXE
+
+ @retval EFI_STATUS
+**/
+EFI_STATUS
+PchS3PcieSetPm (
+ EFI_PCH_S3_PARAMETER_PCIE_SET_PM *Parameter
+ );
+
+/**
+ Perform PCH IOBP programming on S3 resume
+
+ @param[in] Parameter Parameters passed in from DXE
+
+ @retval EFI_STATUS
+**/
+EFI_STATUS
+PchS3ProgramIobp (
+ EFI_PCH_S3_PARAMETER_PROG_IOBP *Parameter
+ );
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/S3Support/Pei/PchS3Peim.inf b/ReferenceCode/Chipset/LynxPoint/S3Support/Pei/PchS3Peim.inf
new file mode 100644
index 0000000..498fde8
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/S3Support/Pei/PchS3Peim.inf
@@ -0,0 +1,100 @@
+## @file
+# Component description file for PchS3 PEIM
+# This is the PEIM that performs the S3 resume tasks as instructed by
+# PCH Init DXE driver. This PEIM is NOT dispatched by PEI Core, but is rather
+# dispatched by the S3 Boot Script Engine. It is the responsibility of PCH
+# Init DXE driver to load this PEIM and register its entry point to the
+# Boot Script engine. This PEIM consumes the PCH Init Variable.
+#
+#@copyright
+# Copyright (c) 1999 - 2015 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = PchS3Peim
+FILE_GUID = 271DD6F2-54CB-45e6-8585-8C923C1AC706
+COMPONENT_TYPE = PE32_PEIM
+
+[sources.common]
+ PchS3Peim.h
+ PchS3Peim.c
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGluePeimEntryPoint.c
+
+[includes.common]
+ .
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Pei/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Protocol
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Protocol/PchPlatformPolicy
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Protocol/PchS3Support
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Guid/S3SupportHob
+
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Pei/Include
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/SampleCode
+
+[libraries.common]
+ PchPlatformLib
+ PchPciExpressHelpersLib
+ EdkFrameworkPpiLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGluePeiDebugLibReportStatusCode
+ EdkIIGluePeiReportStatusCodeLib
+ EdkIIGluePeiServicesLib
+ EdkIIGluePeiMemoryAllocationLib
+ EdkIIGlueBasePciLibPciExpress
+ EdkIIGluePeiHobLib
+ EdkPpiLib
+ IntelPchSampleCodePpiLib
+ PeiLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT=_ModuleEntryPoint
+ DPX_SOURCE=PchS3Peim.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=InitializePchS3Peim
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_PEI_SERVICES_LIB__ \
+ -D __EDKII_GLUE_PEI_MEMORY_ALLOCATION_LIB__ \
+ -D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__
diff --git a/ReferenceCode/Chipset/LynxPoint/S3Support/Pei/PchS3Peim.mak b/ReferenceCode/Chipset/LynxPoint/S3Support/Pei/PchS3Peim.mak
new file mode 100644
index 0000000..aac60c4
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/S3Support/Pei/PchS3Peim.mak
@@ -0,0 +1,52 @@
+#---------------------------------------------------------------------------
+# Create PchS3Pei module
+#---------------------------------------------------------------------------
+EDK : PchS3Peim
+PchS3Peim : $(BUILD_DIR)\PchS3Peim.mak PchS3PeimBin
+
+
+$(BUILD_DIR)\PchS3Peim.mak : $(PchS3Peim_DIR)\$(@B).cif $(PchS3Peim_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(PchS3Peim_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+PchS3Peim_INCLUDES=\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+
+PchS3Peim_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=InitializePchS3Peim"\
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_PEI_SERVICES_LIB__ \
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+ /D __EDKII_GLUE_PEI_HOB_LIB__ \
+
+PchS3Peim_LIB_LINKS=\
+ $(IntelPchPpiLib_LIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EdkIIGlueBaseLibIA32_LIB)\
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGluePeiDebugLibReportStatusCode_LIB)\
+ $(EdkIIGluePeiReportStatusCodeLib_LIB)\
+ $(EdkIIGluePeiServicesLib_LIB) \
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(WdtCommonPeiLib_LIB)\
+ $(EDKFRAMEWORKPPILIB)\
+ $(EdkIIGluePeiHobLib_LIB)\
+ $(IntelSaSampleCodePpiLib_LIB)\
+ $(PchPlatformPeiLib_LIB)\
+ $(PchPciExpressHelpersPeiLib_LIB)\
+ $(PEILIB)\
+
+PchS3PeimBin: $(PchS3Peim_LIB_LINKS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\PchS3Peim.mak all \
+ "MY_INCLUDES=$(PchS3Peim_INCLUDES)"\
+ "MY_DEFINES=$(PchS3Peim_DEFINES)"\
+ GUID=271DD6F2-54CB-45e6-8585-8C923C1AC706\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=PEIM \
+ EDKIIModule=PEIM\
+ DEPEX1=$(PchS3Peim_DIR)\PchS3Peim.dxs\
+ DEPEX1_TYPE=EFI_SECTION_PEI_DEPEX\
+ COMPRESS=0 \ No newline at end of file
diff --git a/ReferenceCode/Chipset/LynxPoint/S3Support/Pei/PchS3Peim.sdl b/ReferenceCode/Chipset/LynxPoint/S3Support/Pei/PchS3Peim.sdl
new file mode 100644
index 0000000..13198b4
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/S3Support/Pei/PchS3Peim.sdl
@@ -0,0 +1,75 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2015, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+# $Header: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/S3Support/Pei/PchS3Peim.sdl 1 5/21/15 2:56a Dennisliu $
+#
+# $Revision: 1 $
+#
+# $Date: 5/21/15 2:56a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/S3Support/Pei/PchS3Peim.sdl $
+#
+# 1 5/21/15 2:56a Dennisliu
+# [TAG] EIP217847
+# [Category] Improvement
+# [Description] [PCH] Shark Bay-M/DT Reference Code Production Version
+# 1.9.1
+# [Files] PchS3Peim.sdl
+# PchS3Peim.mak
+# PchS3Peim.h
+# PchS3Peim.c
+# PchS3Peim.dxs
+# PchS3Peim.inf
+#
+#*************************************************************************
+TOKEN
+ Name = "PchS3Peim_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable PchS3Peim support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "PchS3Peim_DIR"
+End
+
+MODULE
+ File = "PchS3Peim.mak"
+ Help = "Includes PchS3Peim.mak to Project"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PchS3Peim.ffs"
+ Parent = "FV_BB"
+ InvokeOrder = AfterParent
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2015, 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/ReferenceCode/Chipset/LynxPoint/S3Support/Smm/S3SupportSmm.c b/ReferenceCode/Chipset/LynxPoint/S3Support/Smm/S3SupportSmm.c
new file mode 100644
index 0000000..b08699d
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/S3Support/Smm/S3SupportSmm.c
@@ -0,0 +1,156 @@
+/** @file
+ PCH S3 Support Protocol SMM Driver Entry
+
+@copyright
+ Copyright (c) 2015 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "S3SupportSmm.h"
+
+
+//
+// Global Variables
+//
+UINT16 mS3SupportIoTrapAddress;
+EFI_SMM_SYSTEM_TABLE *mSmst;
+EFI_SMM_BASE_PROTOCOL *mSmmBase;
+EFI_SMM_IO_TRAP_DISPATCH_PROTOCOL *mPchIoTrap;
+EFI_HANDLE mImageHandle;
+EFI_PCH_S3_SUPPORT_SMM_PROTOCOL *mPchS3SupportSmmProtocol;
+EFI_HANDLE mPchIoTrapHandle;
+
+/**
+ An IO Trap SMI callback to copy the DispatchArray data to SMRAM and unregister the IO Trap.
+
+ @param[in] DispatchHandle - The handle of this callback, obtained when registering
+ @param[in] DispatchContext - Pointer to the EFI_SMM_IO_TRAP_DISPATCH_CALLBACK_CONTEXT
+
+ @retval None
+**/
+VOID
+S3SupportSmmExitPmAuthCallback (
+ IN EFI_HANDLE DispatchHandle,
+ IN EFI_SMM_IO_TRAP_DISPATCH_CALLBACK_CONTEXT *CallbackContext
+ )
+{
+ EFI_PHYSICAL_ADDRESS Address;
+ EFI_STATUS Status;
+
+ DEBUG ((EFI_D_INFO, "S3SupportSmmExitPmAuthCallback() Start\n"));
+
+ ///
+ /// Allocate SMRAM memory for the PCH S3 Custom Dispatch Script
+ ///
+ Status = mSmst->SmmAllocatePages (
+ AllocateAnyPages,
+ EfiRuntimeServicesData,
+ mPchS3SupportSmmProtocol->ProtocolSize,
+ &Address
+ );
+ DEBUG ((EFI_D_INFO, "SMRAM Memory Allocation Failed - S3SupportSmmExitPmAuthCallback()\n"));
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Copy S3 Support Data from Boot Services memory to SMRAM
+ ///
+ CopyMem ((VOID *)Address, mPchS3SupportSmmProtocol->DispatchArray, mPchS3SupportSmmProtocol->ProtocolSize * EFI_PAGE_SIZE);
+
+ ///
+ /// Unregister the IO Trap as the copy to SMRAM is only allowed once
+ ///
+ Status = mPchIoTrap->UnRegister (
+ mPchIoTrap,
+ &mPchIoTrapHandle
+ );
+ DEBUG ((EFI_D_INFO, "IO Trap Unregister Failed - S3SupportSmmExitPmAuthCallback()\n"));
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Clear the NextDispatchItem in the Boot Services Memory so as to cause an error
+ /// if an entity tries to use the Protocol to add more data after the copy to SMRAM.
+ ///
+ mPchS3SupportSmmProtocol->DispatchArray->NextDispatchItem = NULL;
+
+ DEBUG ((EFI_D_INFO, "S3SupportSmmExitPmAuthCallback() End\n"));
+
+ return;
+}
+
+/**
+ Initializes the PCH SMM handler for PCH save and restore
+
+ @param[in] ImageHandle - Handle for the image of this driver
+ @param[in] SystemTable - Pointer to the EFI System Table
+
+ @retval EFI_SUCCESS - PCH SMM handler was installed
+**/
+EFI_STATUS
+S3SupportSmmEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ EFI_SMM_IO_TRAP_DISPATCH_REGISTER_CONTEXT PchIoTrapContext;
+
+ DEBUG ((EFI_D_INFO, "S3SupportSmmEntryPoint() Start\n"));
+
+ mImageHandle = NULL;
+
+ ///
+ /// Locate SmmBase protocol
+ ///
+ Status = gBS->LocateProtocol (&gEfiSmmBaseProtocolGuid, NULL, (VOID **)&mSmmBase);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Initialize our module variables
+ ///
+ Status = mSmmBase->GetSmstLocation (mSmmBase, &mSmst);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Locate the PCH S3 SMM Support protocol
+ ///
+ Status = gBS->LocateProtocol (&gEfiPchS3SupportSmmProtocolGuid, NULL, (void **)&mPchS3SupportSmmProtocol);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Locate the PCH Trap dispatch protocol
+ ///
+ Status = gBS->LocateProtocol (&gEfiSmmIoTrapDispatchProtocolGuid, NULL, &mPchIoTrap);
+ ASSERT_EFI_ERROR (Status);
+
+ PchIoTrapContext.Type = WriteTrap;
+ PchIoTrapContext.Length = 4;
+ PchIoTrapContext.Address = 0;
+ PchIoTrapContext.Context = NULL;
+ PchIoTrapContext.MergeDisable = FALSE;
+ Status = mPchIoTrap->Register (
+ mPchIoTrap,
+ S3SupportSmmExitPmAuthCallback,
+ &PchIoTrapContext,
+ &mPchIoTrapHandle
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ mPchS3SupportSmmProtocol->PchS3SupportIoTrap = PchIoTrapContext.Address;
+
+ DEBUG ((EFI_D_INFO, "Pch S3 Support IO Trap Address = 0x%x\n", PchIoTrapContext.Address));
+ DEBUG ((EFI_D_INFO, "S3SupportSmmEntryPoint() End\n"));
+
+ return Status;
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/S3Support/Smm/S3SupportSmm.cif b/ReferenceCode/Chipset/LynxPoint/S3Support/Smm/S3SupportSmm.cif
new file mode 100644
index 0000000..9bee2a2
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/S3Support/Smm/S3SupportSmm.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "S3SupportSmm"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\S3Support\Smm"
+ RefName = "S3SupportSmm"
+[files]
+"S3SupportSmm.sdl"
+"S3SupportSmm.mak"
+"S3SupportSmm.c"
+"S3SupportSmm.h"
+"S3SupportSmm.dxs"
+"S3SupportSmm.inf"
+<endComponent> \ No newline at end of file
diff --git a/ReferenceCode/Chipset/LynxPoint/S3Support/Smm/S3SupportSmm.dxs b/ReferenceCode/Chipset/LynxPoint/S3Support/Smm/S3SupportSmm.dxs
new file mode 100644
index 0000000..b8218d4
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/S3Support/Smm/S3SupportSmm.dxs
@@ -0,0 +1,46 @@
+/** @file
+ Dependency expression source file.
+
+@copyright
+ Copyright (c) 2015 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "DxeDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+
+#include EFI_PROTOCOL_DEPENDENCY (SmmBase)
+#include EFI_PROTOCOL_DEPENDENCY (SmmIoTrapDispatch)
+#include EFI_PROTOCOL_DEPENDENCY (PchS3Support)
+
+
+#endif
+
+DEPENDENCY_START
+ EFI_SMM_BASE_PROTOCOL_GUID AND
+ EFI_SMM_IO_TRAP_DISPATCH_PROTOCOL_GUID AND
+ EFI_PCH_S3_SUPPORT_SMM_PROTOCOL_GUID
+DEPENDENCY_END
diff --git a/ReferenceCode/Chipset/LynxPoint/S3Support/Smm/S3SupportSmm.h b/ReferenceCode/Chipset/LynxPoint/S3Support/Smm/S3SupportSmm.h
new file mode 100644
index 0000000..1ac0dc7
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/S3Support/Smm/S3SupportSmm.h
@@ -0,0 +1,60 @@
+/** @file
+ Header file for PCH SMM Handler
+
+@copyright
+ Copyright (c) 2015 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+#ifndef _PCHLATEINITSMM_H_
+#define _PCHLATEINITSMM_H_
+
+///
+/// External include files do NOT need to be explicitly specified in real EDKII
+/// environment
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "PchAccess.h"
+#include "PchPlatformLib.h"
+
+///
+/// Driver Consumed Protocol Prototypes
+///
+#include EFI_PROTOCOL_DEPENDENCY (PchS3Support)
+#include EFI_PROTOCOL_DEPENDENCY (SmmBase)
+#include EFI_PROTOCOL_DEPENDENCY (SmmIoTrapDispatch)
+#include EFI_PROTOCOL_DEPENDENCY (SmmSxDispatch)
+#include EFI_PROTOCOL_CONSUMER (ExitPmAuth)
+
+
+#endif
+
+/**
+ An IO Trap SMI callback to copy the DispatchArray data to SMRAM and unregister the IO Trap.
+
+ @param[in] DispatchHandle - The handle of this callback, obtained when registering
+ @param[in] DispatchContext - Pointer to the EFI_SMM_IO_TRAP_DISPATCH_CALLBACK_CONTEXT
+
+ @retval None
+**/
+VOID
+S3SupportSmmExitPmAuthCallback (
+ EFI_EVENT Event,
+ VOID *ParentImageHandle
+);
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/S3Support/Smm/S3SupportSmm.inf b/ReferenceCode/Chipset/LynxPoint/S3Support/Smm/S3SupportSmm.inf
new file mode 100644
index 0000000..b45f322
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/S3Support/Smm/S3SupportSmm.inf
@@ -0,0 +1,95 @@
+## @file
+# Component description file for Pch Initialization driver
+#
+#@copyright
+# Copyright (c) 2015 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = S3SupportSmm
+FILE_GUID = BFBEDBD4-1B7E-42f5-A528-4351E860F120
+COMPONENT_TYPE = BS_DRIVER
+
+[sources.common]
+ S3SupportSmm.c
+ S3SupportSmm.h
+
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueSmmDriverEntryPoint.c
+[includes.common]
+ $(EDK_SOURCE)/Foundation/Efi
+ .
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Framework/Guid/Hob
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Guid/S3SupportHob
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Protocol
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Protocol/PchPlatformPolicy
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Protocol/PchS3Support
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EDK_SOURCE)/Foundation/Framework/Protocol
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/SampleCode
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/SampleCode/Include
+
+[libraries.common]
+ EdkFrameworkProtocolLib
+ $(PROJECT_PCH_FAMILY)ProtocolLib
+ PchPlatformLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueSmmRuntimeDxeReportStatusCodeLib
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueDxeServicesTableLib
+ EdkIIGlueDxeMemoryAllocationLib
+ EdkIIGlueDxeHobLib
+ EdkProtocolLib
+ EfiScriptLib
+ EfiGuidLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT=_ModuleEntryPoint
+ DPX_SOURCE=S3SupportSmm.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=S3SupportSmmEntryPoint
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_SMM_RUNTIME_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ -D __EDKII_GLUE_DXE_HOB_LIB__ \ No newline at end of file
diff --git a/ReferenceCode/Chipset/LynxPoint/S3Support/Smm/S3SupportSmm.mak b/ReferenceCode/Chipset/LynxPoint/S3Support/Smm/S3SupportSmm.mak
new file mode 100644
index 0000000..c91012e
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/S3Support/Smm/S3SupportSmm.mak
@@ -0,0 +1,94 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2015, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+# $Header: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/S3Support/Smm/S3SupportSmm.mak 1 5/21/15 3:01a Dennisliu $Revision:
+#
+# $Date: 5/21/15 3:01a $Log:
+#
+#*************************************************************************
+
+#---------------------------------------------------------------------------
+# Create S3SupportSmm Driver
+#---------------------------------------------------------------------------
+EDK : S3SupportSmm
+S3SupportSmm : $(BUILD_DIR)\S3SupportSmm.mak S3SupportSmmBin
+
+
+$(BUILD_DIR)\S3SupportSmm.mak : $(S3SupportSmm_DIR)\$(@B).cif $(S3SupportSmm_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(S3SupportSmm_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+S3SupportSmm_INCLUDES=\
+ $(INTEL_PCH_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+
+S3SupportSmm_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=S3SupportSmmEntryPoint"\
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+ /D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+
+S3SupportSmm_LIB_LINKS =\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(EDKPROTOCOLLIB)\
+ $(PchPlatformDxeLib_LIB)\
+ $(EFISCRIPTLIB) $(EFIPROTOCOLLIB)\
+ $(INTEL_PCH_PROTOCOL_LIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueDxeServicesTableLib_LIB)\
+ $(PchS3SupportCommonDxeLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(EdkIIGlueUefiRuntimeServicesTableLib_LIB)\
+ $(EFIDRIVERLIB)\
+ $(EdkIIGlueUefiDevicePathLib_LIB)\
+ $(EdkIIGlueUefiLib_LIB)\
+
+S3SupportSmmBin: $(S3SupportSmm_LIB_LINKS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\S3SupportSmm.mak all \
+ "MY_INCLUDES=$(S3SupportSmm_INCLUDES)"\
+ "MY_DEFINES=$(S3SupportSmm_DEFINES)"\
+ GUID=BFBEDBD4-1B7E-42f5-A528-4351E860F120\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=BS_DRIVER\
+ EDKIIModule=SMMDRIVER\
+ DEPEX1=$(S3SupportSmm_DIR)\S3SupportSmm.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX\
+ COMPRESS=1
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2015, 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/ReferenceCode/Chipset/LynxPoint/S3Support/Smm/S3SupportSmm.sdl b/ReferenceCode/Chipset/LynxPoint/S3Support/Smm/S3SupportSmm.sdl
new file mode 100644
index 0000000..1a812ec
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/S3Support/Smm/S3SupportSmm.sdl
@@ -0,0 +1,57 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2015, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+# $Header: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/S3Support/Smm/S3SupportSmm.sdl 1 5/21/15 3:01a Dennisliu $Revision:
+#
+# $Date: 5/21/15 3:01a $Log:
+#
+#*************************************************************************
+TOKEN
+ Name = "S3SupportSmm_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable S3SupportSmm support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "S3SupportSmm_DIR"
+End
+
+MODULE
+ Help = "Includes S3SupportSmm.mak to Project"
+ File = "S3SupportSmm.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\S3SupportSmm.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2015, 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/ReferenceCode/Chipset/LynxPoint/SampleCode/AcpiTables/Dsdt/Sensor.asl b/ReferenceCode/Chipset/LynxPoint/SampleCode/AcpiTables/Dsdt/Sensor.asl
new file mode 100644
index 0000000..3b61882
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SampleCode/AcpiTables/Dsdt/Sensor.asl
@@ -0,0 +1,103 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the SandyBridge *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 2013 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+ //--------------------
+ // Intel Sensor Solution
+ //--------------------
+ Name (_ADR, Zero)
+ Name (_UID, One)
+
+ Method (_STA, 0, NotSerialized)
+ {
+ // check for device enabled in BIOS setup, 1 = enabled
+ If(LNotEqual(And(SDS0,0x01), 0x01)) {
+ Return (0x00) // device is disabled in BIOS setup
+ }
+
+ // check the GPIO mode select, 1 = Sensor Hub
+ // verify the Sensor Hub _HID
+ If(LAnd(LEqual(\_SB.RDGP(44), 0x01),LEqual(_HID, "INT33D1"))) {
+ Return(0xF) // device is Sensor Hub and Sensor Hub mode is selected
+ }
+
+ // check the GPIO mode select, 0 = DFU
+ // verify the DFU _HID
+ If(LAnd(LEqual(\_SB.RDGP(44), 0x00),LEqual(_HID, "INT33D7"))) {
+ Return(0xF) // device is DFU and DFU mode is selected
+ }
+
+ Return(0x00)
+ }
+
+ Method(_DSM, 0x4, NotSerialized)
+ {
+ // DSM UUID for HIDI2C. Do Not change.
+ If(LEqual(Arg0, ToUUID("3CDFF6F7-4267-4555-AD05-B30A3D8938DE")))
+ {
+ // Function 0 : Query Function
+ If(LEqual(Arg2, Zero))
+ {
+ // Revision 1
+ If(LEqual(Arg1, One))
+ {
+ Return(Buffer(One) { 0x03 })
+ }
+ }
+ // Function 1 : HID Function
+ If(LEqual(Arg2, One))
+ {
+ // HID Descriptor Address (IHV Specific)
+ Return(0x0001)
+ }
+ }
+ Else
+ {
+ Return(Buffer(One) { 0x00 })
+ }
+ }
+
+ Method (_CRS, 0, NotSerialized)
+ {
+ Name (SBFI, ResourceTemplate ()
+ {
+ I2cSerialBus (
+ 0x40, //SlaveAddress: bus address
+ ControllerInitiated, //SlaveMode: Default to ControllerInitiated
+ 400000, //ConnectionSpeed: in Hz
+ AddressingMode7Bit, //Addressing Mode: default to 7 bit
+ "\\_SB.PCI0.I2C0", //ResourceSource: I2C bus controller name
+ , //ResourceSourceIndex: defaults to 0
+ , //ResourceUsage: Defaults to ResourceConsumer
+ , //Descriptor Name: creates name for offset of resource descriptor
+ ) //VendorData
+
+ Interrupt(ResourceConsumer, Level, ActiveLow, Exclusive, , ,) {28} //Route to PIRQM
+ })
+
+ Return (SBFI)
+ }
+
diff --git a/ReferenceCode/Chipset/LynxPoint/SampleCode/AcpiTables/Dsdt/SerialIoDevices.asl b/ReferenceCode/Chipset/LynxPoint/SampleCode/AcpiTables/Dsdt/SerialIoDevices.asl
new file mode 100644
index 0000000..b344520
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SampleCode/AcpiTables/Dsdt/SerialIoDevices.asl
@@ -0,0 +1,1527 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the SandyBridge *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 2013 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+Scope (\_SB.PCI0)
+{
+ External(\_SB.PCI0.SDHC.WI01.PS0X, MethodObj)
+ External(\_SB.PCI0.SDHC.WI01.PS3X, MethodObj)
+ External(\_SB.PCI0.I2C1.TPD7.PS0X, MethodObj)
+ External(\_SB.PCI0.I2C1.TPD8.PS0X, MethodObj)
+
+
+} // end scope \_SB.PCI0
+
+Scope(\_SB.PCI0.I2C0)
+{
+
+ //--------------------
+ // Audio Codec device
+ // Realtek
+ //--------------------
+ Device (ACD0)
+ {
+ // I2C/I2S Audio Codec (Realtek as default)
+ Name (_ADR, 0x1C)
+ Name (_HID, "INT33CA")
+ Name (_CID, "INT33CA")
+ Name (_DDN, "Intel(R) Smart Sound Technology Audio Codec - INT33CA" )
+ Name (_UID, 1)
+
+ // Parameter values for Realtek codec
+ Name (MCLK, Zero)
+ Name (SCLK, 0x9)
+ Name (SSPM, Zero)
+
+ Name (RBUF, ResourceTemplate ()
+ {
+ I2CSerialBus(
+ 0x1C, //SlaveAddress: bus address
+ , //SlaveMode: default to ControllerInitiated
+ 400000, //ConnectionSpeed: in Hz
+ , //Addressing Mode: default to 7 bit
+ "\\_SB.PCI0.I2C0", //ResourceSource: I2C bus controller name
+ , //Descriptor Name: creates name for offset of resource descriptor
+ ) //VendorData
+
+ Interrupt(ResourceConsumer, Level, ActiveLow, ExclusiveAndWake, , ,) {37} //Route to PIRQx - jack detection
+ })
+
+ Name(EOD, 1)
+ Method (_CRS, 0x0, NotSerialized)
+ {
+ Return (RBUF)
+ }
+
+ Method (_SRS, 0x1, Serialized)
+ {
+ Store (1, EOD)
+ }
+
+ Method (_STA, 0x0, NotSerialized)
+ {
+ If (LOr(LNotEqual(CODS, Zero), LNotEqual(ADSD, Zero)))
+ {
+ Return(0x0) // Codec Selection != Realtek or ADSP disabled - Not present
+ }
+ If (AND(EOD, 0x1, EOD))
+ {
+ Return(0xf) // Enabled 1111
+ }
+ Else
+ {
+ Return(0xd) // Disabled 1101
+ }
+ }
+
+ Method (_DIS, 0x0, NotSerialized)
+ {
+ Store(0, EOD)
+ }
+ } // Device (ACD0)
+
+ //--------------------
+ // Audio Codec device
+ // Cirrus Logic
+ //--------------------
+ Device (ACD1)
+ {
+ Name (_ADR, 0x4A)
+ Name (_HID, "INT33C9")
+ Name (_CID, "INT33C9")
+ Name (_DDN, "Intel(R) Smart Sound Technology Audio Codec - INT33C9" )
+ Name (_UID, 1)
+
+ // Parameter values for Cirrus codec
+ Name (MCLK, 0x6)
+ Name (SCLK, Zero)
+ Name (SSPM, One)
+
+ Name (RBUF, ResourceTemplate ()
+ {
+ I2CSerialBus(
+ 0x4A, //SlaveAddress: bus address
+ , //SlaveMode: default to ControllerInitiated
+ 400000, //ConnectionSpeed: in Hz
+ , //Addressing Mode: default to 7 bit
+ "\\_SB.PCI0.I2C0", //ResourceSource: I2C bus controller name
+ , //Descriptor Name: creates name for offset of resource descriptor
+ ) //VendorData
+ })
+
+ Name(EOD, 1)
+ Method (_CRS, 0x0, NotSerialized)
+ {
+ Store (1, EOD)
+ Return (RBUF)
+ }
+
+ Method (_STA, 0x0, NotSerialized)
+ {
+ If (LOr(LNotEqual(CODS, One), LNotEqual(ADSD, Zero)))
+ {
+ Return(0x0) // Codec Selection != Cirrus or ADSP disabled - Not present
+ }
+ If (AND(EOD, 0x1, EOD))
+ {
+ Return(0xf) // Enabled 1111
+ }
+ Else
+ {
+ Return(0xd) // Disabled 1101
+ }
+ }
+
+ Method (_DIS, 0x0, NotSerialized)
+ {
+ Store(0, EOD)
+ }
+ } // Device (ACD1)
+
+ //--------------------
+ // Audio Codec device
+ // IDT
+ //--------------------
+ Device (ACD2)
+ {
+ Name (_ADR, 0x69)
+ Name (_HID, "INT33CB")
+ Name (_CID, "INT33CB")
+ Name (_DDN, "Intel(R) Smart Sound Technology Audio Codec - INT33CB" )
+ Name (_UID, 1)
+
+ // Parameter values for IDT codec
+ Name (MCLK, 0x18)
+ Name (SCLK, 0x9)
+ Name (SSPM, Zero)
+
+ Name (RBUF, ResourceTemplate ()
+ {
+ I2CSerialBus(
+ 0x69, //SlaveAddress: bus address
+ , //SlaveMode: default to ControllerInitiated
+ 400000, //ConnectionSpeed: in Hz
+ , //Addressing Mode: default to 7 bit
+ "\\_SB.PCI0.I2C0", //ResourceSource: I2C bus controller name
+ , //Descriptor Name: creates name for offset of resource descriptor
+ ) //VendorData
+
+ GpioIo(Exclusive, PullDefault, 0, 0, IoRestrictionInputOnly, "\\_SB.PCI0.GPI0", ) {0x33} // GPIO51 for HP detection
+ GpioIo(Exclusive, PullDefault, 0, 0, IoRestrictionInputOnly, "\\_SB.PCI0.GPI0", ) {0x35} // GPIO53 for Mic detection
+
+ Interrupt(ResourceConsumer, Edge, ActiveHigh, ExclusiveAndWake, , ,) {35} // GPIO51 - HP jack detection
+ Interrupt(ResourceConsumer, Edge, ActiveHigh, ExclusiveAndWake, , ,) {37} // GPIO53 - Mic jack detection
+ })
+
+ Name(EOD, 1)
+ Method (_CRS, 0x0, NotSerialized)
+ {
+ Return (RBUF)
+ }
+
+ Method (_SRS, 0x1, Serialized)
+ {
+ Store (1, EOD)
+ }
+
+ Method (_STA, 0x0, NotSerialized)
+ {
+ If (LOr(LNotEqual(CODS, 2), LNotEqual(ADSD, Zero)))
+ {
+ Return(0x0) // Codec Selection != IDT or ADSP disabled - Not present
+ }
+ If (AND(EOD, 0x1, EOD))
+ {
+ Return(0xf) // Enabled 1111
+ }
+ Else
+ {
+ Return(0xd) // Disabled 1101
+ }
+ }
+
+ Method (_DIS, 0x0, NotSerialized)
+ {
+ Store(0, EOD)
+ }
+ } // Device (ACD2)
+
+ //--------------------
+ // Intel Sensor Hub
+ //--------------------
+ Device (SHUB)
+ {
+ Name (_HID, "INT33D1")
+ Name (_CID, "PNP0C50")
+ Include ("Sensor.asl")
+ } // Device (SHUB)
+
+ //--------------------
+ // Intel DFU Device
+ //--------------------
+ Device (DFUD)
+ {
+ Name (_HID, "INT33D7")
+ Include ("Sensor.asl")
+ } // Device DFUD
+
+ Device (TPD4)
+ {
+ Name (_ADR, Zero)
+ Name (_HID, "MSFT1111")
+ Name (_CID, "PNP0C50")
+ Name (_UID, One)
+
+ Method(_DSM, 0x4, NotSerialized)
+ {
+ // DSM UUID for HIDI2C. Do Not change.
+ If(LEqual(Arg0, ToUUID("3CDFF6F7-4267-4555-AD05-B30A3D8938DE")))
+ {
+ // Function 0 : Query Function
+ If(LEqual(Arg2, Zero))
+ {
+ // Revision 1
+ If(LEqual(Arg1, One))
+ {
+ Return(Buffer(One) { 0x03 })
+ }
+ }
+ // Function 1 : HID Function
+ If(LEqual(Arg2, One))
+ {
+ // HID Descriptor Address (IHV Specific)
+ Return(0x0001)
+ }
+ }
+ Else
+ {
+ Return(Buffer(One) { 0x00 })
+ }
+ }
+
+ Method (_STA, 0, NotSerialized)
+ {
+ If(LEqual(And(SDS0,0x04), 0x04)) {
+ Return (0x0F)
+ } Else {
+ Return (0x00)
+ }
+ }
+
+ Method (_CRS, 0, NotSerialized)
+ {
+ Name (SBFI, ResourceTemplate ()
+ {
+ I2cSerialBus (
+ 0x60, //SlaveAddress: bus address
+ ControllerInitiated, //SlaveMode: Default to ControllerInitiated
+ 400000, //ConnectionSpeed: in Hz
+ AddressingMode7Bit, //Addressing Mode: default to 7 bit
+ "\\_SB.PCI0.I2C0", //ResourceSource: I2C bus controller name
+ , //ResourceSourceIndex: defaults to 0
+ , //ResourceUsage: Defaults to ResourceConsumer
+ , //Descriptor Name: creates name for offset of resource descriptor
+ ) //VendorData
+
+ Interrupt(ResourceConsumer, Level, ActiveLow, Exclusive, , ,) {28} //Route to PIRQM
+ })
+
+ Return (SBFI)
+ }
+
+ Method (_PRW, 0) {
+ Return(Package(){0x0E,4}) // can wakeup from S4 state
+ }
+
+ Method (_S3W, 0) {
+ Return(3)
+ }
+
+ Method (_S4W, 0) {
+ Return(3)
+ }
+
+ Method(_PS0,0,Serialized)
+ {
+ ADBG("TPD4 Ctrlr D0")
+ //
+ // Set GPI_INV to normal
+ //
+ \_SB.WTIN(14,0)
+
+ //
+ // Set GPI_OWN to GPIO
+ //
+ Store(1,\GO14)
+ }
+
+ Method(_PS3,0,Serialized)
+ {
+ ADBG("TPD4 Ctrlr D3")
+ //
+ // Set GPI_INV to Inverted
+ //
+ \_SB.WTIN(14,1)
+
+ //
+ // Set GPI_OWN to ACPI
+ //
+ Store(0,\GO14)
+ }
+ } // Device (TPD4)
+
+
+} // end Scope(\_SB.PCI0.I2C0)
+
+
+ //----------------------------
+ // Serial IO I2C1 Controller
+ //----------------------------
+Scope(\_SB.PCI0.I2C1)
+{
+
+
+ //------------------------
+ // Atmel Touch Panel
+ //------------------------
+ Device (TPL0)
+ {
+ Name (_ADR, Zero)
+ Name (_HID, "ATML1000")
+ Name (_CID, "PNP0C50")
+ Name (_UID, One)
+
+ Name (_S0W, 4) // required to put the device to D3 Cold during S0 idle
+
+ Method(_DSM, 0x4, NotSerialized)
+ {
+ // DSM UUID for HIDI2C. Do Not change.
+ If(LEqual(Arg0, ToUUID("3CDFF6F7-4267-4555-AD05-B30A3D8938DE")))
+ {
+ // Function 0 : Query Function
+ If(LEqual(Arg2, Zero))
+ {
+ // Revision 1
+ If(LEqual(Arg1, One))
+ {
+ Return(Buffer(One) { 0x03 })
+ }
+ Else
+ {
+ Return(Buffer(One) { 0x00 })
+ }
+ }
+ // Function 1 : HID Function
+ If(LEqual(Arg2, One))
+ {
+ // HID Descriptor Address (IHV Specific)
+ Return(0x0000)
+ }
+ }
+ Else
+ {
+ Return(Buffer(One) { 0x00 })
+ }
+ }
+
+ Method (_STA, 0, NotSerialized)
+ {
+ // Note: _STA in ATML1000 and ATML2000 must be identical. These devices
+ // communicate with the same HW.
+
+ If(LEqual(And(SDS1,0x0001), 0x0001)) {
+ Return (0x0F)
+ } Else {
+ Return (0x00)
+ }
+ }
+
+ Method (_CRS, 0, NotSerialized)
+ {
+ Name (SBFI, ResourceTemplate ()
+ {
+ I2cSerialBus (
+ 0x4C, //SlaveAddress: bus address
+ ControllerInitiated, //SlaveMode: Default to ControllerInitiated
+ 400000, //ConnectionSpeed: in Hz
+ AddressingMode7Bit, //Addressing Mode: default to 7 bit
+ "\\_SB.PCI0.I2C1", //ResourceSource: I2C bus controller name
+ , //ResourceSourceIndex: defaults to 0
+ , //ResourceUsage: Defaults to ResourceConsumer
+ , //Descriptor Name: creates name for offset of resource descriptor
+ ) //VendorData
+
+ Interrupt(ResourceConsumer, Level, ActiveLow, Exclusive, , ,) {34} //Interrupt from touch screen routed to GPIO50-->PIRQS
+ })
+
+ Return (SBFI)
+ }
+ } // Device (TPL0)
+
+ //------------------------
+ // Atmel Touch Panel FW Update
+ //------------------------
+ Device (TPFU)
+ {
+ Name (_ADR, Zero)
+ Name (_HID, "ATML2000")
+ Name (_CID, "PNP0C02")
+ Name (_UID, 10)
+
+ Method (_STA, 0, NotSerialized)
+ {
+ // Note: _STA in ATML1000 and ATML2000 must be identical. These devices
+ // communicate with the same HW.
+
+ If(LAnd(And(SDS1,0x0001),And(APFU,0x0001))) {
+ Return (0x0F)
+ } Else {
+ Return (0x00)
+ }
+ }
+
+ Method (_CRS, 0, NotSerialized)
+ {
+ Name (SBFI, ResourceTemplate ()
+ {
+ I2cSerialBus (
+ 0x26, //SlaveAddress: bus address
+ ControllerInitiated, //SlaveMode: Default to ControllerInitiated
+ 400000, //ConnectionSpeed: in Hz
+ AddressingMode7Bit, //Addressing Mode: default to 7 bit
+ "\\_SB.PCI0.I2C1", //ResourceSource: I2C bus controller name
+ , //ResourceSourceIndex: defaults to 0
+ , //ResourceUsage: Defaults to ResourceConsumer
+ , //Descriptor Name: creates name for offset of resource descriptor
+ ) //VendorData
+
+ I2cSerialBus (
+ 0x27, //SlaveAddress: bus address
+ ControllerInitiated, //SlaveMode: Default to ControllerInitiated
+ 400000, //ConnectionSpeed: in Hz
+ AddressingMode7Bit, //Addressing Mode: default to 7 bit
+ "\\_SB.PCI0.I2C1", //ResourceSource: I2C bus controller name
+ , //ResourceSourceIndex: defaults to 0
+ , //ResourceUsage: Defaults to ResourceConsumer
+ , //Descriptor Name: creates name for offset of resource descriptor
+ ) //VendorData
+ })
+
+ Return (SBFI)
+ }
+ } // Device (TPFU)
+
+ //------------------------
+ // ELAN Touch Panel
+ //------------------------
+ Device (TPL1)
+ {
+ Name (_HID, "ELAN1001")
+ Name (_CID, "PNP0C50")
+ Name (_UID, One)
+
+ Name (_S0W, 4) // required to put the device to D3 Cold during S0 idle
+
+ Method(_DSM, 0x4, NotSerialized)
+ {
+ // DSM UUID for HIDI2C. Do Not change.
+ If(LEqual(Arg0, ToUUID("3CDFF6F7-4267-4555-AD05-B30A3D8938DE")))
+ {
+ // Function 0 : Query Function
+ If(LEqual(Arg2, Zero))
+ {
+ // Revision 1
+ If(LEqual(Arg1, One))
+ {
+ Return(Buffer(One) { 0x03 })
+ }
+ Else
+ {
+ Return(Buffer(One) { 0x00 })
+ }
+ }
+ // Function 1 : HID Function
+ If(LEqual(Arg2, One))
+ {
+ // HID Descriptor Address (IHV Specific)
+ Return(0x0001)
+ }
+ }
+ Else
+ {
+ Return(Buffer(One) { 0x00 })
+ }
+ }
+
+ Method (_STA, 0, NotSerialized)
+ {
+ If(LEqual(And(SDS1,0x0002), 0x0002)) {
+ Return (0x0F)
+ } Else {
+ Return (0x00)
+ }
+ }
+
+ Method (_CRS, 0, NotSerialized)
+ {
+ Name (SBFI, ResourceTemplate ()
+ {
+ I2cSerialBus (
+ 0x10, //SlaveAddress: bus address
+ ControllerInitiated, //SlaveMode: Default to ControllerInitiated
+ 400000, //ConnectionSpeed: in Hz
+ AddressingMode7Bit, //Addressing Mode: default to 7 bit
+ "\\_SB.PCI0.I2C1", //ResourceSource: I2C bus controller name
+ , //ResourceSourceIndex: defaults to 0
+ , //ResourceUsage: Defaults to ResourceConsumer
+ , //Descriptor Name: creates name for offset of resource descriptor
+ ) //VendorData
+
+ Interrupt(ResourceConsumer, Level, ActiveLow, Exclusive, , ,) {34} //Interrupt from touch screen routed to GPIO50-->PIRQS
+ })
+
+ Return (SBFI)
+ }
+ } // Device (TPL1)
+
+
+ //------------------------------
+ // NTRIG Digitizer Touch Panel
+ //------------------------------
+ Device (TPL2)
+ {
+ Name (_ADR, One)
+ Name (_HID, "NTRG0001")
+ Name (_CID, "PNP0C50")
+ Name (_UID, One)
+
+ Name (_S0W, 4) // required to put the device to D3 Cold during S0 idle
+
+ Method(_DSM, 0x4, NotSerialized)
+ {
+ // DSM UUID for HIDI2C. Do Not change.
+ If(LEqual(Arg0, ToUUID("3CDFF6F7-4267-4555-AD05-B30A3D8938DE")))
+ {
+ // Function 0 : Query Function
+ If(LEqual(Arg2, Zero))
+ {
+ // Revision 1
+ If(LEqual(Arg1, One))
+ {
+ Return(Buffer(One) { 0x03 })
+ }
+ Else
+ {
+ Return(Buffer(One) { 0x00 })
+ }
+ }
+ // Function 1 : HID Function
+ If(LEqual(Arg2, One))
+ {
+ // HID Descriptor Address (IHV Specific)
+ Return(0x0001)
+ }
+ }
+ Else
+ {
+ Return(Buffer(One) { 0x00 })
+ }
+ }
+
+ Method (_STA, 0, NotSerialized)
+ {
+ If(LEqual(And(SDS1,0x0020), 0x0020)) {
+ Return (0x0F)
+ } Else {
+ Return (0x00)
+ }
+ }
+
+ Method (_CRS, 0, NotSerialized)
+ {
+ Name (SBFI, ResourceTemplate ()
+ {
+ I2cSerialBus (
+ 0x07, //SlaveAddress: bus address
+ ControllerInitiated, //SlaveMode: Default to ControllerInitiated
+ 400000, //ConnectionSpeed: in Hz
+ AddressingMode7Bit, //Addressing Mode: default to 7 bit
+ "\\_SB.PCI0.I2C1", //ResourceSource: I2C bus controller name
+ , //ResourceSourceIndex: defaults to 0
+ , //ResourceUsage: Defaults to ResourceConsumer
+ , //Descriptor Name: creates name for offset of resource descriptor
+ ) //VendorData
+
+ Interrupt(ResourceConsumer, Level, ActiveLow, Exclusive, , ,) {34} //Interrupt from touch screen routed to GPIO50-->PIRQS
+ })
+
+ Return (SBFI)
+
+ }
+ } // Device (TPL2)
+
+ //------------------------
+ // EETI Touch Panel
+ //------------------------
+ Device (TPL3)
+ {
+ Name (_ADR, One)
+ Name (_HID, "EETI7900")
+ Name (_CID, "PNP0C50")
+ Name (_UID, One)
+
+ Name (_S0W, 4) // required to put the device to D3 Cold during S0 idle
+
+ Method(_DSM, 0x4, NotSerialized)
+ {
+ // DSM UUID for HIDI2C. Do Not change.
+ If(LEqual(Arg0, ToUUID("3CDFF6F7-4267-4555-AD05-B30A3D8938DE")))
+ {
+ // Function 0 : Query Function
+ If(LEqual(Arg2, Zero))
+ {
+ // Revision 1
+ If(LEqual(Arg1, One))
+ {
+ Return(Buffer(One) { 0x03 })
+ }
+ Else
+ {
+ Return(Buffer(One) { 0x00 })
+ }
+ }
+ // Function 1 : HID Function
+ If(LEqual(Arg2, One))
+ {
+ // HID Descriptor Address (IHV Specific)
+ Return(0x000F)
+ }
+ }
+ Else
+ {
+ Return(Buffer(One) { 0x00 })
+ }
+ }
+
+ Method (_STA, 0, NotSerialized)
+ {
+ If(LEqual(And(SDS1,0x0040), 0x0040)) {
+ Return (0x0F)
+ } Else {
+ Return (0x00)
+ }
+ }
+
+ Method (_CRS, 0, NotSerialized)
+ {
+ Name (SBFI, ResourceTemplate ()
+ {
+ I2cSerialBus (
+ 0x2A, //SlaveAddress: bus address
+ ControllerInitiated, //SlaveMode: Default to ControllerInitiated
+ 400000, //ConnectionSpeed: in Hz
+ AddressingMode7Bit, //Addressing Mode: default to 7 bit
+ "\\_SB.PCI0.I2C1", //ResourceSource: I2C bus controller name
+ , //ResourceSourceIndex: defaults to 0
+ , //ResourceUsage: Defaults to ResourceConsumer
+ , //Descriptor Name: creates name for offset of resource descriptor
+ ) //VendorData
+
+ Interrupt(ResourceConsumer, Level, ActiveLow, Exclusive, , ,) {34} //Interrupt from touch screen routed to GPIO50-->PIRQS
+ })
+
+
+ Return (SBFI)
+
+ }
+ } // Device (TPL3)
+
+
+ //------------------------
+ // ELAN Touch Pad
+ //------------------------
+ Device (TPD0)
+ {
+ Name (_ADR, One)
+ Name (_HID, "ELAN1000")
+ Name (_CID, "PNP0C50")
+ Name (_UID, One)
+
+ Name (_S0W, 4) // required to put the device to D3 Cold during S0 idle
+
+ Method(_DSM, 0x4, NotSerialized)
+ {
+ // DSM UUID for HIDI2C. Do Not change.
+ If(LEqual(Arg0, ToUUID("3CDFF6F7-4267-4555-AD05-B30A3D8938DE")))
+ {
+ // Function 0 : Query Function
+ If(LEqual(Arg2, Zero))
+ {
+ // Revision 1
+ If(LEqual(Arg1, One))
+ {
+ Return(Buffer(One) { 0x03 })
+ }
+ Else
+ {
+ Return(Buffer(One) { 0x00 })
+ }
+ }
+ // Function 1 : HID Function
+ If(LEqual(Arg2, One))
+ {
+ // HID Descriptor Address (IHV Specific)
+ Return(0x0001)
+ }
+ }
+ Else
+ {
+ Return(Buffer(One) { 0x00 })
+ }
+ }
+
+ Method (_STA, 0, NotSerialized)
+ {
+ If(LEqual(And(SDS1,0x0004), 0x0004)) {
+ Return (0x0F)
+ } Else {
+ Return (0x00)
+ }
+ }
+
+ Method (_CRS, 0, Serialized)
+ {
+ Name (SBFI, ResourceTemplate ()
+ {
+ I2cSerialBus (
+ 0x15, //SlaveAddress: bus address
+ ControllerInitiated, //SlaveMode: Default to ControllerInitiated
+ 400000, //ConnectionSpeed: in Hz
+ AddressingMode7Bit, //Addressing Mode: default to 7 bit
+ "\\_SB.PCI0.I2C1", //ResourceSource: I2C bus controller name
+ , //ResourceSourceIndex: defaults to 0
+ , //ResourceUsage: Defaults to ResourceConsumer
+ , //Descriptor Name: creates name for offset of resource descriptor
+ ) //VendorData
+
+ Interrupt(ResourceConsumer, Level, ActiveLow, Exclusive, , ,INT0) {39} //Interrupt from Touchpad routed to GPIO55 - IOxAPIC PIRQX
+ })
+
+ If(LEqual(GR13, 1)) {
+ CreateByteField (SBFI, INT0._INT, VAL3) // Extended Interrupt Descriptor
+ Store(27, VAL3)
+ }
+
+ Return (SBFI)
+
+
+ }
+ } // Device (TPD0)
+
+ //------------------------
+ // Synaptics touchpad
+ //------------------------
+ Device (TPD1)
+ {
+ Name (_ADR, One)
+ Name (_HID, "MSFT0001")
+ Name (_CID, "PNP0C50")
+ Name (_UID, One)
+
+ Name (_S0W, 4) // required to put the device to D3 Cold during S0 idle
+
+ Method(_DSM, 0x4, NotSerialized)
+ {
+ // DSM UUID for HIDI2C. Do Not change.
+ If(LEqual(Arg0, ToUUID("3CDFF6F7-4267-4555-AD05-B30A3D8938DE")))
+ {
+ // Function 0 : Query Function
+ If(LEqual(Arg2, Zero))
+ {
+ // Revision 1
+ If(LEqual(Arg1, One))
+ {
+ Return(Buffer(One) { 0x03 })
+ }
+ Else
+ {
+ Return(Buffer(One) { 0x00 })
+ }
+ }
+ // Function 1 : HID Function
+ If(LEqual(Arg2, One))
+ {
+ // HID Descriptor Address (IHV Specific)
+ Return(0x0020)
+ }
+ }
+ Else
+ {
+ Return(Buffer(One) { 0x00 })
+ }
+ }
+
+ Method (_STA, 0, NotSerialized)
+ {
+ If(LEqual(And(SDS1,0x0008), 0x0008)) {
+ Return (0x0F)
+ } Else {
+ Return (0x00)
+ }
+ }
+
+ Method (_CRS, 0, Serialized)
+ {
+ Name (SBFI, ResourceTemplate ()
+ {
+ I2cSerialBus (
+ 0x20, //SlaveAddress: bus address
+ ControllerInitiated, //SlaveMode: Default to ControllerInitiated
+ 400000, //ConnectionSpeed: in Hz
+ AddressingMode7Bit, //Addressing Mode: default to 7 bit
+ "\\_SB.PCI0.I2C1", //ResourceSource: I2C bus controller name
+ , //ResourceSourceIndex: defaults to 0
+ , //ResourceUsage: Defaults to ResourceConsumer
+ , //Descriptor Name: creates name for offset of resource descriptor
+ ) //VendorData
+
+ Interrupt(ResourceConsumer, Level, ActiveLow, Exclusive, , ,INT0) {39} //Interrupt from Touchpad routed to GPIO55 - IOxAPIC PIRQX
+ })
+
+ If(LEqual(GR13, 1)) {
+ CreateByteField (SBFI, INT0._INT, VAL3) // Extended Interrupt Descriptor
+ Store(27, VAL3)
+ }
+
+ Return (SBFI)
+ }
+ } // Device (TPD1)
+
+ //------------------------
+ // Alps touchpad
+ //------------------------
+ Device (TPD2)
+ {
+ Name (_ADR, One)
+ Name (_HID, "ALP0001")
+ Name (_CID, "PNP0C50")
+ Name (_UID, One)
+
+ Name (_S0W, 4) // required to put the device to D3 Cold during S0 idle
+
+ Method(_DSM, 0x4, NotSerialized)
+ {
+ // DSM UUID for HIDI2C. Do Not change.
+ If(LEqual(Arg0, ToUUID("3CDFF6F7-4267-4555-AD05-B30A3D8938DE")))
+ {
+ // Function 0 : Query Function
+ If(LEqual(Arg2, Zero))
+ {
+ // Revision 1
+ If(LEqual(Arg1, One))
+ {
+ Return(Buffer(One) { 0x03 })
+ }
+ Else
+ {
+ Return(Buffer(One) { 0x00 })
+ }
+ }
+ // Function 1 : HID Function
+ If(LEqual(Arg2, One))
+ {
+ // HID Descriptor Address (IHV Specific)
+ Return(0x0001)
+ }
+ }
+ Else
+ {
+ Return(Buffer(One) { 0x00 })
+ }
+ }
+
+ Method (_STA, 0, NotSerialized)
+ {
+ If(LEqual(And(SDS1,0x0080), 0x0080)) {
+ Return (0x0F)
+ } Else {
+ Return (0x00)
+ }
+ }
+
+ Method (_CRS, 0, Serialized)
+ {
+ Name (SBFI, ResourceTemplate ()
+ {
+ I2cSerialBus (
+ 0x2A, //SlaveAddress: bus address
+ ControllerInitiated, //SlaveMode: Default to ControllerInitiated
+ 400000, //ConnectionSpeed: in Hz
+ AddressingMode7Bit, //Addressing Mode: default to 7 bit
+ "\\_SB.PCI0.I2C1", //ResourceSource: I2C bus controller name
+ , //ResourceSourceIndex: defaults to 0
+ , //ResourceUsage: Defaults to ResourceConsumer
+ , //Descriptor Name: creates name for offset of resource descriptor
+ ) //VendorData
+
+ Interrupt(ResourceConsumer, Level, ActiveLow, Exclusive, , ,INT0) {39} //Interrupt from Touchpad routed to GPIO55 - IOxAPIC PIRQX
+ })
+
+ If(LEqual(GR13, 1)) {
+ CreateByteField (SBFI, INT0._INT, VAL3) // Extended Interrupt Descriptor
+ Store(27, VAL3)
+ }
+
+ Return (SBFI)
+ }
+ } // Device (TPD2)
+
+ //------------------------
+ // Cypress touchpad
+ //------------------------
+ Device (TPD3)
+ {
+ Name (_ADR, One)
+ Name (_HID, "CYP0001")
+ Name (_CID, "PNP0C50")
+ Name (_UID, One)
+
+ Name (_S0W, 4) // required to put the device to D3 Cold during S0 idle
+
+ Method(_DSM, 0x4, NotSerialized)
+ {
+ // DSM UUID for HIDI2C. Do Not change.
+ If(LEqual(Arg0, ToUUID("3CDFF6F7-4267-4555-AD05-B30A3D8938DE")))
+ {
+ // Function 0 : Query Function
+ If(LEqual(Arg2, Zero))
+ {
+ // Revision 1
+ If(LEqual(Arg1, One))
+ {
+ Return(Buffer(One) { 0x03 })
+ }
+ Else
+ {
+ Return(Buffer(One) { 0x00 })
+ }
+ }
+ // Function 1 : HID Function
+ If(LEqual(Arg2, One))
+ {
+ // HID Descriptor Address (IHV Specific)
+ Return(0x0001)
+ }
+ }
+ Else
+ {
+ Return(Buffer(One) { 0x00 })
+ }
+ }
+
+ Method (_STA, 0, NotSerialized)
+ {
+ If(LEqual(And(SDS1,0x0100), 0x0100)) {
+ Return (0x0F)
+ } Else {
+ Return (0x00)
+ }
+ }
+
+ Method (_CRS, 0, Serialized)
+ {
+ Name (SBFI, ResourceTemplate ()
+ {
+ I2cSerialBus (
+ 0x24, //SlaveAddress: bus address
+ ControllerInitiated, //SlaveMode: Default to ControllerInitiated
+ 400000, //ConnectionSpeed: in Hz
+ AddressingMode7Bit, //Addressing Mode: default to 7 bit
+ "\\_SB.PCI0.I2C1", //ResourceSource: I2C bus controller name
+ , //ResourceSourceIndex: defaults to 0
+ , //ResourceUsage: Defaults to ResourceConsumer
+ , //Descriptor Name: creates name for offset of resource descriptor
+ ) //VendorData
+
+ Interrupt(ResourceConsumer, Level, ActiveLow, Exclusive, , ,INT0) {39} //Interrupt from Touchpad routed to GPIO55 - IOxAPIC PIRQX
+ })
+
+ If(LEqual(GR13, 1)) {
+ CreateByteField (SBFI, INT0._INT, VAL3) // Extended Interrupt Descriptor
+ Store(27, VAL3)
+ }
+
+ Return (SBFI)
+ }
+ } // Device (TPD3)
+
+ //------------------------
+ // ELAN Precision Touch Pad
+ //------------------------
+ Device (TPD7)
+ {
+ Name (_ADR, One)
+ Name (_HID, "ELAN1010")
+ Name (_CID, "PNP0C50")
+ Name (_UID, One)
+
+ Name (_S0W, 3) // PTP will be in D3hot during CS, and wake capable
+
+ Method (_S3W, 0) {
+ If(LEqual(S0ID, 0)) {
+ Return (3)
+ } Else {
+ Return (0)
+ }
+ }
+
+ Method(_DSM, 0x4, NotSerialized)
+ {
+ // DSM UUID for HIDI2C. Do Not change.
+ If(LEqual(Arg0, ToUUID("3CDFF6F7-4267-4555-AD05-B30A3D8938DE")))
+ {
+ // Function 0 : Query Function
+ If(LEqual(Arg2, Zero))
+ {
+ // Revision 1
+ If(LEqual(Arg1, One))
+ {
+ Return(Buffer(One) { 0x03 })
+ }
+ Else
+ {
+ Return(Buffer(One) { 0x00 })
+ }
+ }
+ // Function 1 : HID Function
+ If(LEqual(Arg2, One))
+ {
+ // HID Descriptor Address (IHV Specific)
+ Return(0x0001)
+ }
+ }
+ Else
+ {
+ Return(Buffer(One) { 0x00 })
+ }
+ }
+
+ // Get the right SDS value
+ Method (_STA, 0, NotSerialized)
+ {
+ If(LEqual(And(SDS1,0x0800), 0x0800)) {
+ Return (0x0F)
+ } Else {
+ Return (0x00)
+ }
+ }
+
+ Method (_CRS, 0, Serialized)
+ {
+ Name (SBFI, ResourceTemplate ()
+ {
+ I2cSerialBus (
+ 0x15, //SlaveAddress: bus address
+ ControllerInitiated, //SlaveMode: Default to ControllerInitiated
+ 400000, //ConnectionSpeed: in Hz
+ AddressingMode7Bit, //Addressing Mode: default to 7 bit
+ "\\_SB.PCI0.I2C1", //ResourceSource: I2C bus controller name
+ , //ResourceSourceIndex: defaults to 0
+ , //ResourceUsage: Defaults to ResourceConsumer
+ , //Descriptor Name: creates name for offset of resource descriptor
+ ) //VendorData
+
+ Interrupt(ResourceConsumer, Level, ActiveLow, ExclusiveAndWake, , ,INT0) {39} //Interrupt from Touchpad routed to GPIO55 - IOxAPIC PIRQX
+ })
+
+ If(LEqual(GR13, 1)) {
+ CreateByteField (SBFI, INT0._INT, VAL3) // Extended Interrupt Descriptor
+ Store(27, VAL3)
+
+ If(LEqual(S0ID, 0)) {
+ CreateByteField (SBFI, INT0._SHR, VAL4) // Change to exclusive
+ And(VAL4, 0xE7, VAL4) //Exclusive
+ }
+ }
+
+ Return (SBFI)
+
+
+ }
+
+ Method (_PRW, 0) {
+ If(LAnd(LEqual(S0ID, 0),LEqual(GR13, 1))) {
+ Return(Package(){0x0D, 3}) // can wakeup from S4 state
+ }
+ Return(Package(){Zero, Zero})
+ }
+
+ Method(_PS0,0,Serialized)
+ {
+ ADBG("TPD7 Ctrlr D0")
+ If(LAnd(LEqual(S0ID, 0),LEqual(GR13, 1))) {
+ \_SB.WTIN(13, 0) // Set GPI_INV to normal
+ Store(1, \GO13) // Set GPI_OWN to GPIO
+ }
+
+ If(CondRefOf(\_SB.PCI0.I2C1.TPD7.PS0X))
+ {
+ \_SB.PCI0.I2C1.TPD7.PS0X()
+ }
+ }
+
+ Method(_PS3,0,Serialized)
+ {
+ ADBG("TPD7 Ctrlr D3")
+ If(LAnd(LEqual(S0ID, 0),LEqual(GR13, 1))) {
+ \_SB.WTIN(13, 1) // Set GPI_INV to Inverted
+ Store(0, \GO13) // Set GPI_OWN to ACPI
+ }
+ }
+ } // Device (TPD7)
+
+ //------------------------
+ // Synaptics Precision touchpad
+ //------------------------
+ Device (TPD8)
+ {
+ Name (_ADR, One)
+ Name (_HID, "SYNA2393")
+ Name (_CID, "PNP0C50")
+ Name (_UID, One)
+
+ Name (_S0W, 3) // PTP will be in D3hot during CS, and wake capable
+
+ Method (_S3W, 0) {
+ If(LEqual(S0ID, 0)) {
+ Return (3)
+ } Else {
+ Return (0)
+ }
+ }
+
+ Method(_DSM, 0x4, NotSerialized)
+ {
+ // DSM UUID for HIDI2C. Do Not change.
+ If(LEqual(Arg0, ToUUID("3CDFF6F7-4267-4555-AD05-B30A3D8938DE")))
+ {
+ // Function 0 : Query Function
+ If(LEqual(Arg2, Zero))
+ {
+ // Revision 1
+ If(LEqual(Arg1, One))
+ {
+ Return(Buffer(One) { 0x03 })
+ }
+ Else
+ {
+ Return(Buffer(One) { 0x00 })
+ }
+ }
+ // Function 1 : HID Function
+ If(LEqual(Arg2, One))
+ {
+ // HID Descriptor Address (IHV Specific)
+ Return(0x0020)
+ }
+ }
+ Else
+ {
+ Return(Buffer(One) { 0x00 })
+ }
+ }
+
+ // Get the right SDS value
+ Method (_STA, 0, NotSerialized)
+ {
+ If(LEqual(And(SDS1,0x1000), 0x1000)) {
+ Return (0x0F)
+ } Else {
+ Return (0x00)
+ }
+ }
+
+ Method (_CRS, 0, Serialized)
+ {
+ Name (SBFI, ResourceTemplate ()
+ {
+ I2cSerialBus (
+ 0x20, //SlaveAddress: bus address
+ ControllerInitiated, //SlaveMode: Default to ControllerInitiated
+ 400000, //ConnectionSpeed: in Hz
+ AddressingMode7Bit, //Addressing Mode: default to 7 bit
+ "\\_SB.PCI0.I2C1", //ResourceSource: I2C bus controller name
+ , //ResourceSourceIndex: defaults to 0
+ , //ResourceUsage: Defaults to ResourceConsumer
+ , //Descriptor Name: creates name for offset of resource descriptor
+ ) //VendorData
+
+ Interrupt(ResourceConsumer, Level, ActiveLow, ExclusiveAndWake, , ,INT0) {39} //Interrupt from Touchpad routed to GPIO55 - IOxAPIC PIRQX
+ })
+
+ If(LEqual(GR13, 1)) {
+ CreateByteField (SBFI, INT0._INT, VAL3) // Extended Interrupt Descriptor
+ Store(27, VAL3) //PIRQ
+
+ If(LEqual(S0ID, 0)) {
+ CreateByteField (SBFI, INT0._SHR, VAL4) // Change to exclusive
+ And(VAL4, 0xE7, VAL4) //Exclusive
+ }
+ }
+
+ Return (SBFI)
+ }
+
+ Method (_PRW, 0) {
+ If(LAnd(LEqual(S0ID, 0),LEqual(GR13, 1))) {
+ Return(Package(){0x0D,3}) // can wakeup from S4 state
+ }
+ Return(Package(){Zero, Zero})
+ }
+
+ Method(_PS0,0,Serialized)
+ {
+ ADBG("TPD8 Ctrlr D0")
+ If(LAnd(LEqual(S0ID, 0),LEqual(GR13, 1))) {
+ \_SB.WTIN(13, 0) // Set GPI_INV to normal
+ Store(1, \GO13) // Set GPI_OWN to GPIO
+ }
+
+ If(CondRefOf(\_SB.PCI0.I2C1.TPD8.PS0X))
+ {
+ \_SB.PCI0.I2C1.TPD8.PS0X()
+ }
+ }
+
+ Method(_PS3,0,Serialized)
+ {
+ ADBG("TPD8 Ctrlr D3")
+ If(LAnd(LEqual(S0ID, 0),LEqual(GR13, 1))) {
+ \_SB.WTIN(13, 1) // Set GPI_INV to Inverted
+ Store(0, \GO13) // Set GPI_OWN to ACPI
+ }
+ }
+ } // Device (TPD8)
+ } // Device (I2C1)
+
+ //----------------------------
+ // Serial IO SPI0 Controller
+ //----------------------------
+Scope(\_SB.PCI0.SPI0)
+{
+
+
+} // end Scope(\_SB.PCI0.SPI0)
+
+ //----------------------------
+ // Serial IO SPI1 Controller
+ //----------------------------
+Scope(\_SB.PCI0.SPI1)
+{
+
+} // end Scope(\_SB.PCI0.SPI1)
+
+ //-----------------------------
+ // Serial IO UART0 Controller
+ //-----------------------------
+Scope(\_SB.PCI0.UA00)
+{
+
+ //
+ // Bluetooth controller using serial interface
+ //
+ Device(BTH0)
+ {
+ Name(_HID, "INT33E0")
+
+ Method(_CRS, 0x0, NotSerialized)
+ {
+ Name(UBUF, ResourceTemplate ()
+ {
+ UARTSerialBus(
+ 115200, //InitialBaudRate: in bits per second
+ DataBitsEight, //BitsPerByte: default to DataBitsEight (optional)
+ StopBitsOne, //StopBits: defaults to StopBitsOne (optional)
+ 0xc0, //LinesInUse: 8 1-bit flags to declare line enabled
+ , //IsBigEndian: default to LittleEndian (optional)
+ ParityTypeNone, //Parity: defaults to ParityTypeNone (optional)
+ FlowControlHardware, //FlowControl: defaults to FlowControlNone (optional)
+ 32, //ReceiveBufferSize
+ 32, //TransmitBufferSize
+ "\\_SB.PCI0.UA00", //ResourceSource: UART bus controller name
+ , //ResourceSourceIndex: defaults to 0 (optional)
+ , //ResourceUsage: defaults to ResourceConsumer (optional)
+ , //DescriptorName: creates name for offset of resource descriptor
+ ) //VendorData
+ })
+
+ Return (UBUF)
+ }
+
+ Method (_STA, 0x0, NotSerialized)
+ {
+ If(LEqual(And(SDS4,0x01), 0x01)) {
+ Return (0x0F)
+ } Else {
+ Return (0x00)
+ }
+ }
+ } // Device BTH0
+
+ } // end Scope(\_SB.PCI0.UART0)
+
+ //-----------------------------
+ // Serial IO UART1 Controller
+ //-----------------------------
+Scope(\_SB.PCI0.UA01)
+ {
+
+ //
+ // Bluetooth controller using serial interface
+ //
+ Device(BTH1)
+ {
+ Name(_HID, "INT33E0")
+
+ Method(_CRS, 0x0, NotSerialized)
+ {
+ Name(UBUF, ResourceTemplate ()
+ {
+ UARTSerialBus(
+ 115200, //InitialBaudRate: in bits per second
+ DataBitsEight, //BitsPerByte: default to DataBitsEight (optional)
+ StopBitsOne, //StopBits: defaults to StopBitsOne (optional)
+ 0xc0, //LinesInUse: 8 1-bit flags to declare line enabled
+ , //IsBigEndian: default to LittleEndian (optional)
+ ParityTypeNone, //Parity: defaults to ParityTypeNone (optional)
+ FlowControlHardware, //FlowControl: defaults to FlowControlNone (optional)
+ 32, //ReceiveBufferSize
+ 32, //TransmitBufferSize
+ "\\_SB.PCI0.UA01", //ResourceSource: UART bus controller name
+ , //ResourceSourceIndex: defaults to 0 (optional)
+ , //ResourceUsage: defaults to ResourceConsumer (optional)
+ , //DescriptorName: creates name for offset of resource descriptor
+ ) //VendorData
+ Interrupt(ResourceConsumer, Level, ActiveLow, SharedAndWake, , , ) {25} // GPIO9 - PIRQ J(APIC pin 25) for BT Wake
+ GpioIo(Exclusive, PullDefault, 0, 0, IoRestrictionOutputOnly, "\\_SB.PCI0.GPI0", ) {87} // for RF Kill
+ })
+
+ Return (UBUF)
+ }
+
+ Method (_STA, 0x0, NotSerialized)
+ {
+ If(LEqual(And(SDS5,0x01), 0x01)) {
+ Return (0x0F)
+ } Else {
+ Return (0x00)
+ }
+ }
+ } // Device BTH1
+
+ //
+ // BroadCom Bluetooth controller using serial interface
+ //
+ Device(BTH2)
+ {
+ Method(_HID, 0, NotSerialized) {
+ if (LEqual(BCV4, 0)) {
+ Return("BCM2E20")
+ } else {
+ Return("BCM2E40")
+ }
+ }
+
+ Method(_CRS, 0x0, NotSerialized)
+ {
+ Name(UBUF, ResourceTemplate ()
+ {
+ UARTSerialBus(
+ 115200, //InitialBaudRate: in bits per second
+ , //BitsPerByte: default to DataBitsEight (optional)
+ , //StopBits: defaults to StopBitsOne (optional)
+ 0xc0, //LinesInUse: 8 1-bit flags to declare line enabled
+ , //IsBigEndian: default to LittleEndian (optional)
+ , //Parity: defaults to ParityTypeNone (optional)
+ FlowControlHardware, //FlowControl: defaults to FlowControlNone (optional)
+ 32, //ReceiveBufferSize
+ 32, //TransmitBufferSize
+ "\\_SB.PCI0.UA01", //ResourceSource: UART bus controller name
+ , //ResourceSourceIndex: defaults to 0 (optional)
+ , //ResourceUsage: defaults to ResourceConsumer (optional)
+ , //DescriptorName: creates name for offset of resource descriptor
+ ) //VendorData
+ Interrupt(ResourceConsumer, Edge, ActiveLow, Exclusive, , , ) {25} // GPIO9 - PIRQ J(APIC pin 25) for BT Wake
+ GpioIo(Exclusive, PullDefault, 0, 0, IoRestrictionOutputOnly, "\\_SB.PCI0.GPI0", ) {57} // for BT_DEV_WAKE
+ GpioIo(Exclusive, PullDefault, 0, 0, IoRestrictionOutputOnly, "\\_SB.PCI0.GPI0", ) {87} // for RF Kill
+ })
+ Return (UBUF)
+ }
+
+ Method (_STA, 0x0, NotSerialized)
+ {
+ If(LEqual(And(SDS5,0x02), 0x02)) {
+ Return (0x0F)
+ } Else {
+ Return (0x00)
+ }
+ }
+ Name (_S0W, 2) // required to put the device to D2 during S0 idle
+ } // Device BTH2
+
+
+ } // end Scope(\_SB.PCI0.UART1)
+
+ //--------------------------------
+ // Serial IO SDIO Host Controller
+ //--------------------------------
+Scope(\_SB.PCI0.SDHC)
+{
+
+ Device (WI01)
+ {
+ Name (_ADR, 1)
+ Name (_DDN, "SDIO Wifi device Function 1" )
+
+ Method (_STA, 0x0, NotSerialized)
+ {
+ Return (0x0F)
+ }
+
+ Method (_RMV, 0, NotSerialized)
+ {
+ Return (0x0)
+ }
+
+ Name (_S4W, 2) // required per guidance from MS (SDIO Wifi device power states doc)
+ Name (_S0W, 2) // required to put the Wifi device to D2 during S0 idle
+ // D0 Method for WiFi
+ Method(_PS0,0,Serialized)
+ {
+ ADBG("WiFi1 Enter D0")
+ If(CondRefOf(\_SB.PCI0.SDHC.WI01.PS0X))
+ {
+ \_SB.PCI0.SDHC.WI01.PS0X()
+ }
+ }
+ // D2 Method for WiFi
+ Method(_PS2,0,Serialized)
+ {
+ ADBG("WiFi1 Enter D2")
+ }
+ // D3 Method for WiFi
+ Method(_PS3,0,Serialized)
+ {
+ ADBG("WiFi1 Enter D3")
+ If(CondRefOf(\_SB.PCI0.SDHC.WI01.PS3X))
+ {
+ \_SB.PCI0.SDHC.WI01.PS3X()
+ }
+ }
+ //Method(_DSW, 3){
+ //ADBG("Wifi1 _DSW")
+ //}
+ //
+ Name (RBUF, ResourceTemplate ()
+ {
+ Memory32Fixed (ReadWrite, 0x00000000, 0x0000000, BARC) // SW LTR Registers
+ Interrupt(ResourceConsumer, Level, ActiveLow, SharedAndWake, , , ) {38}
+ })
+
+ Method (_CRS, 0, NotSerialized)
+ {
+ CreateDWordField(^^RBUF, ^^BARA._BAS, AVAL)
+ if(LNotEqual(AVAL, 0)) {
+ CreateDWordField(^RBUF, ^BARC._LEN, WLN0)
+ Store(0xC, WLN0)
+ CreateDWordField(^RBUF, ^BARC._BAS, WVAL)
+ Add(AVAL, 0x1008, WVAL)
+ }
+ Return (RBUF)
+ }
+ }
+} // end Scope(\_SB.PCI0.SDHC)
+
diff --git a/ReferenceCode/Chipset/LynxPoint/SampleCode/BiosWriteProtect/Smm/PchBiosWriteProtect.c b/ReferenceCode/Chipset/LynxPoint/SampleCode/BiosWriteProtect/Smm/PchBiosWriteProtect.c
new file mode 100644
index 0000000..020f152
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SampleCode/BiosWriteProtect/Smm/PchBiosWriteProtect.c
@@ -0,0 +1,188 @@
+/** @file
+ PCH BIOS Write Protect Driver.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#include "PchBiosWriteProtect.h"
+
+///
+/// Global variables
+///
+EFI_SMM_ICHN_DISPATCH_PROTOCOL *mIchnDispatch;
+EFI_SMM_IO_TRAP_DISPATCH_PROTOCOL *mPchIoTrap;
+UINTN mPciD31F0RegBase;
+
+/**
+ This hardware SMI handler will be run every time the BIOS Write Enable bit is set.
+
+ @param[in] DispatchHandle Not used
+ @param[in] DispatchContext Not used
+
+ @retval None
+**/
+VOID
+EFIAPI
+PchBiosWpCallback (
+ IN EFI_HANDLE DispatchHandle,
+ IN EFI_SMM_ICHN_DISPATCH_CONTEXT *DispatchContext
+ )
+{
+ ///
+ /// Disable BIOSWE bit to protect BIOS
+ ///
+ MmioAnd8 ((UINTN) (mPciD31F0RegBase + R_PCH_LPC_BIOS_CNTL), (UINT8) ~B_PCH_LPC_BIOS_CNTL_BIOSWE);
+}
+
+/**
+ Register an IchnBiosWp callback function to handle TCO BIOSWR SMI
+ SMM_BWP and BLE bits will be set here
+
+ @param[in] DispatchHandle Not used
+ @param[in] CallbackContext Information about the IO trap that occurred
+
+ @retval None
+**/
+VOID
+EFIAPI
+PchBiosLockIoTrapCallback (
+ IN EFI_HANDLE DispatchHandle,
+ IN EFI_SMM_IO_TRAP_DISPATCH_CALLBACK_CONTEXT *CallbackContext
+ )
+{
+ EFI_STATUS Status;
+ EFI_SMM_ICHN_DISPATCH_CONTEXT IchnContext;
+ EFI_HANDLE IchnHandle;
+
+ ///
+ /// Do not run the callback function if it is not Write cycle trapped or the wrtie data
+ /// is not PCH_BWP_SIGNATURE,
+ ///
+ if ((CallbackContext->Type != WriteTrap) || (CallbackContext->WriteData != PCH_BWP_SIGNATURE)) {
+ return;
+ }
+
+ if (mIchnDispatch == NULL) {
+ return;
+ }
+
+ IchnHandle = NULL;
+
+ ///
+ /// Set SMM_BWP bit before registering IchnBiosWp
+ ///
+ MmioOr8 ((UINTN) (mPciD31F0RegBase + R_PCH_LPC_BIOS_CNTL), (UINT8) B_PCH_LPC_BIOS_CNTL_SMM_BWP);
+
+ ///
+ /// Register an IchnBiosWp callback function to handle TCO BIOSWR SMI
+ ///
+ IchnContext.Type = IchnBiosWp;
+ Status = mIchnDispatch->Register (
+ mIchnDispatch,
+ PchBiosWpCallback,
+ &IchnContext,
+ &IchnHandle
+ );
+ ASSERT_EFI_ERROR (Status);
+}
+
+/**
+ Entry point for Pch Bios Write Protect driver.
+
+ @param[in] ImageHandle Image handle of this driver.
+ @param[in] SystemTable Global system service table.
+
+ @retval EFI_SUCCESS Initialization complete.
+**/
+EFI_STATUS
+EFIAPI
+InstallPchBiosWriteProtect (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy;
+ EFI_HANDLE PchIoTrapHandle;
+ EFI_SMM_IO_TRAP_DISPATCH_REGISTER_CONTEXT PchIoTrapContext;
+
+ ///
+ /// Locate PCH Platform Policy protocol
+ ///
+ Status = gBS->LocateProtocol (&gDxePchPlatformPolicyProtocolGuid, NULL, (VOID **) &PchPlatformPolicy);
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR | EFI_D_INFO, "Failed to locate PCH Policy protocol.\n"));
+ return Status;
+ }
+
+ if ((PchPlatformPolicy->LockDownConfig->BiosLock == PCH_DEVICE_ENABLE)) {
+ mPciD31F0RegBase = MmPciAddress (
+ 0,
+ 0,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ 0
+ );
+
+ ///
+ /// Get the ICHn protocol
+ ///
+ mIchnDispatch = NULL;
+ Status = gBS->LocateProtocol (&gEfiSmmIchnDispatchProtocolGuid, NULL, (VOID **) &mIchnDispatch);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Locate the PCH IO TRAP Dispatch protocol
+ ///
+ PchIoTrapHandle = NULL;
+ Status = gBS->LocateProtocol (&gEfiSmmIoTrapDispatchProtocolGuid, NULL, (VOID **) &mPchIoTrap);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Register BIOS Lock IO Trap SMI handler
+ ///
+ PchIoTrapContext.Type = WriteTrap;
+ PchIoTrapContext.Length = 4;
+ PchIoTrapContext.Address = PchPlatformPolicy->LockDownConfig->PchBiosLockIoTrapAddress;
+ PchIoTrapContext.Context = NULL;
+ PchIoTrapContext.MergeDisable = FALSE;
+ Status = mPchIoTrap->Register (
+ mPchIoTrap,
+ PchBiosLockIoTrapCallback,
+ &PchIoTrapContext,
+ &PchIoTrapHandle
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ DEBUG ((EFI_D_ERROR, "PchBiosLockIoTrapAddress = 0x%x\n", PchIoTrapContext.Address));
+
+ if ((PchPlatformPolicy->LockDownConfig->PchBiosLockIoTrapAddress == 0) &&
+ (PchIoTrapContext.Address == 0)) {
+ DEBUG ((EFI_D_ERROR | EFI_D_INFO, "Invalid PchIoTrapContext.Address!!!\n"));
+ ASSERT (FALSE);
+ } else {
+ if ((PchPlatformPolicy->LockDownConfig->PchBiosLockIoTrapAddress != 0) &&
+ (PchPlatformPolicy->LockDownConfig->PchBiosLockIoTrapAddress != PchIoTrapContext.Address)) {
+ DEBUG ((EFI_D_ERROR | EFI_D_INFO, "Invalid PchIoTrapContext.Address!!!\n"));
+ ASSERT (FALSE);
+ } else {
+ PchPlatformPolicy->LockDownConfig->PchBiosLockIoTrapAddress = PchIoTrapContext.Address;
+ }
+ }
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/SampleCode/BiosWriteProtect/Smm/PchBiosWriteProtect.dxs b/ReferenceCode/Chipset/LynxPoint/SampleCode/BiosWriteProtect/Smm/PchBiosWriteProtect.dxs
new file mode 100644
index 0000000..47c8ea9
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SampleCode/BiosWriteProtect/Smm/PchBiosWriteProtect.dxs
@@ -0,0 +1,48 @@
+/** @file
+ Dependency expression source file.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "DxeDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+
+#include EFI_PROTOCOL_DEFINITION (PchPlatformPolicy)
+#include EFI_PROTOCOL_DEFINITION (SmmBase)
+#include EFI_PROTOCOL_DEPENDENCY (SmmIchnDispatch)
+#include EFI_PROTOCOL_DEPENDENCY (SmmIoTrapDispatch)
+
+#endif
+
+DEPENDENCY_START
+ DXE_PCH_PLATFORM_POLICY_PROTOCOL_GUID AND
+ EFI_SMM_BASE_PROTOCOL_GUID AND
+ EFI_SMM_ICHN_DISPATCH_PROTOCOL_GUID AND
+ EFI_SMM_IO_TRAP_DISPATCH_PROTOCOL_GUID
+DEPENDENCY_END
diff --git a/ReferenceCode/Chipset/LynxPoint/SampleCode/BiosWriteProtect/Smm/PchBiosWriteProtect.h b/ReferenceCode/Chipset/LynxPoint/SampleCode/BiosWriteProtect/Smm/PchBiosWriteProtect.h
new file mode 100644
index 0000000..fedc210
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SampleCode/BiosWriteProtect/Smm/PchBiosWriteProtect.h
@@ -0,0 +1,36 @@
+/** @file
+ Header file for the Pch Bios Write Protect Driver.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _PCH_BIOS_WRITE_PROTECT_H_
+#define _PCH_BIOS_WRITE_PROTECT_H_
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "PchAccess.h"
+#include "PchPlatformLib.h"
+
+//
+// Driver Dependency Protocols
+//
+#include EFI_PROTOCOL_CONSUMER (PchPlatformPolicy)
+#include EFI_PROTOCOL_CONSUMER (SmmBase)
+#include EFI_PROTOCOL_CONSUMER (SmmIchnDispatch)
+#include EFI_PROTOCOL_CONSUMER (SmmIoTrapDispatch)
+#endif
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/SampleCode/BiosWriteProtect/Smm/PchBiosWriteProtect.inf b/ReferenceCode/Chipset/LynxPoint/SampleCode/BiosWriteProtect/Smm/PchBiosWriteProtect.inf
new file mode 100644
index 0000000..552d188
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SampleCode/BiosWriteProtect/Smm/PchBiosWriteProtect.inf
@@ -0,0 +1,94 @@
+## @file
+# Component description file for the PchBiosWriteProtect driver.
+#
+#@copyright
+# Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = PchBiosWriteProtect
+FILE_GUID = 2EE81ACB-64B2-41ae-8635-7030D16C4AA8
+COMPONENT_TYPE = BS_DRIVER
+
+[sources.common]
+ PchBiosWriteProtect.h
+ PchBiosWriteProtect.c
+
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueSmmDriverEntryPoint.c
+
+
+[includes.common]
+ .
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/SampleCode
+
+[libraries.common]
+ EdkIIGlueBaseLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueBaseMemoryLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueSmmRuntimeDxeReportStatusCodeLib
+ EdkIIGlueDxeMemoryAllocationLib
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueUefiDevicePathLib
+ EdkIIGlueBasePciLibPciExpress
+ EdkFrameworkProtocolLib
+ EdkProtocolLib
+ $(PROJECT_PCH_FAMILY)ProtocolLib
+ PchPlatformLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = PchBiosWriteProtect.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=InstallPchBiosWriteProtect
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_SMM_RUNTIME_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_DEVICE_PATH_LIB__ \
+ -D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__
diff --git a/ReferenceCode/Chipset/LynxPoint/SampleCode/Guid/SmbusArpMap/SmbusArpMap.h b/ReferenceCode/Chipset/LynxPoint/SampleCode/Guid/SmbusArpMap/SmbusArpMap.h
new file mode 100644
index 0000000..32f4ee0
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SampleCode/Guid/SmbusArpMap/SmbusArpMap.h
@@ -0,0 +1,29 @@
+/** @file
+ GUID for use in describing SMBus devices that were ARPed during PEI.
+
+@copyright
+ Copyright (c) 2009 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains 'Framework Code' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may not be modified, except as allowed by
+ additional terms of your license agreement.
+**/
+#ifndef _EFI_SMBUS_ARP_MAP_GUID_H_
+#define _EFI_SMBUS_ARP_MAP_GUID_H_
+
+#define EFI_SMBUS_ARP_MAP_GUID \
+ { \
+ 0x707be83e, 0x0bf6, 0x40a5, 0xbe, 0x64, 0x34, 0xc0, 0x3a, 0xa0, 0xb8, 0xe2 \
+ }
+
+extern EFI_GUID gEfiSmbusArpMapGuid;
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/SampleCode/Include/Acpi3_0.h b/ReferenceCode/Chipset/LynxPoint/SampleCode/Include/Acpi3_0.h
new file mode 100644
index 0000000..cc5111b
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SampleCode/Include/Acpi3_0.h
@@ -0,0 +1,681 @@
+/** @file
+ ACPI 3.0 definitions from the ACPI Specification Revision 3.0 September 2, 2004
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains 'Framework Code' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may not be modified, except as allowed by
+ additional terms of your license agreement.
+**/
+#ifndef _ACPI_3_0_H_
+#define _ACPI_3_0_H_
+
+//
+// Statements that include other files
+//
+#include "Tiano.h"
+#include "Acpi.h"
+
+//
+// Ensure proper structure formats
+//
+#pragma pack(1)
+//
+// ACPI Specification Revision
+//
+#define EFI_ACPI_3_0_REVISION 0x03 // @bug: Not in spec yet.
+//
+// @bug: OEM values need to be moved somewhere else, probably read from data hub
+// and produced by a platform specific driver.
+//
+//
+// ACPI 3.0 Generic Address Space definition
+//
+typedef struct {
+ UINT8 AddressSpaceId;
+ UINT8 RegisterBitWidth;
+ UINT8 RegisterBitOffset;
+ UINT8 AccessSize;
+ UINT64 Address;
+} EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE;
+
+//
+// Generic Address Space Address IDs
+//
+#define EFI_ACPI_3_0_SYSTEM_MEMORY 0
+#define EFI_ACPI_3_0_SYSTEM_IO 1
+#define EFI_ACPI_3_0_PCI_CONFIGURATION_SPACE 2
+#define EFI_ACPI_3_0_EMBEDDED_CONTROLLER 3
+#define EFI_ACPI_3_0_SMBUS 4
+#define EFI_ACPI_3_0_FUNCTIONAL_FIXED_HARDWARE 0x7F
+
+//
+// Generic Address Space Access Sizes
+//
+#define EFI_ACPI_3_0_UNDEFINED 0
+#define EFI_ACPI_3_0_BYTE 1
+#define EFI_ACPI_3_0_WORD 2
+#define EFI_ACPI_3_0_DWORD 3
+#define EFI_ACPI_3_0_QWORD 4
+
+//
+// ACPI 3.0 table structures
+//
+//
+// Root System Description Pointer Structure
+//
+typedef struct {
+ UINT64 Signature;
+ UINT8 Checksum;
+ UINT8 OemId[6];
+ UINT8 Revision;
+ UINT32 RsdtAddress;
+ UINT32 Length;
+ UINT64 XsdtAddress;
+ UINT8 ExtendedChecksum;
+ UINT8 Reserved[3];
+} EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER;
+
+//
+// RSD_PTR Revision (as defined in ACPI 3.0 spec.)
+//
+#define EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER_REVISION 0x02 // ACPISpec30 (Revision 3.0 September 2, 2004) says current value is 2
+//
+// Common table header, this prefaces all ACPI tables, including FACS, but
+// excluding the RSD PTR structure
+//
+typedef struct {
+ UINT32 Signature;
+ UINT32 Length;
+} EFI_ACPI_3_0_COMMON_HEADER;
+
+//
+// Root System Description Table
+// No definition needed as it is a common description table header followed by a
+// variable number of UINT32 table pointers.
+//
+//
+// RSDT Revision (as defined in ACPI 3.0 spec.)
+//
+#define EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_TABLE_REVISION 0x01
+
+//
+// Extended System Description Table
+// No definition needed as it is a common description table header followed by a
+// variable number of UINT64 table pointers.
+//
+//
+// XSDT Revision (as defined in ACPI 3.0 spec.)
+//
+#define EFI_ACPI_3_0_EXTENDED_SYSTEM_DESCRIPTION_TABLE_REVISION 0x01
+
+//
+// Fixed ACPI Description Table Structure (FADT)
+//
+typedef struct {
+ EFI_ACPI_DESCRIPTION_HEADER Header;
+ UINT32 FirmwareCtrl;
+ UINT32 Dsdt;
+ UINT8 Reserved0;
+ UINT8 PreferredPmProfile;
+ UINT16 SciInt;
+ UINT32 SmiCmd;
+ UINT8 AcpiEnable;
+ UINT8 AcpiDisable;
+ UINT8 S4BiosReq;
+ UINT8 PstateCnt;
+ UINT32 Pm1aEvtBlk;
+ UINT32 Pm1bEvtBlk;
+ UINT32 Pm1aCntBlk;
+ UINT32 Pm1bCntBlk;
+ UINT32 Pm2CntBlk;
+ UINT32 PmTmrBlk;
+ UINT32 Gpe0Blk;
+ UINT32 Gpe1Blk;
+ UINT8 Pm1EvtLen;
+ UINT8 Pm1CntLen;
+ UINT8 Pm2CntLen;
+ UINT8 PmTmrLen;
+ UINT8 Gpe0BlkLen;
+ UINT8 Gpe1BlkLen;
+ UINT8 Gpe1Base;
+ UINT8 CstCnt;
+ UINT16 PLvl2Lat;
+ UINT16 PLvl3Lat;
+ UINT16 FlushSize;
+ UINT16 FlushStride;
+ UINT8 DutyOffset;
+ UINT8 DutyWidth;
+ UINT8 DayAlrm;
+ UINT8 MonAlrm;
+ UINT8 Century;
+ UINT16 IaPcBootArch;
+ UINT8 Reserved1;
+ UINT32 Flags;
+ EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE ResetReg;
+ UINT8 ResetValue;
+ UINT8 Reserved2[3];
+ UINT64 XFirmwareCtrl;
+ UINT64 XDsdt;
+ EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE XPm1aEvtBlk;
+ EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE XPm1bEvtBlk;
+ EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE XPm1aCntBlk;
+ EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE XPm1bCntBlk;
+ EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE XPm2CntBlk;
+ EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE XPmTmrBlk;
+ EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE XGpe0Blk;
+ EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE XGpe1Blk;
+} EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE;
+
+//
+// FADT Version (as defined in ACPI 3.0 spec.)
+//
+#define EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION 0x04
+
+//
+// Fixed ACPI Description Table Preferred Power Management Profile
+//
+#define EFI_ACPI_3_0_PM_PROFILE_UNSPECIFIED 0
+#define EFI_ACPI_3_0_PM_PROFILE_DESKTOP 1
+#define EFI_ACPI_3_0_PM_PROFILE_MOBILE 2
+#define EFI_ACPI_3_0_PM_PROFILE_WORKSTATION 3
+#define EFI_ACPI_3_0_PM_PROFILE_ENTERPRISE_SERVER 4
+#define EFI_ACPI_3_0_PM_PROFILE_SOHO_SERVER 5
+#define EFI_ACPI_3_0_PM_PROFILE_APPLIANCE_PC 6
+#define EFI_ACPI_3_0_PM_PROFILE_PERFORMANCE_SERVER 7
+
+//
+// Fixed ACPI Description Table Boot Architecture Flags
+// All other bits are reserved and must be set to 0.
+//
+#define EFI_ACPI_3_0_LEGACY_DEVICES (1 << 0)
+#define EFI_ACPI_3_0_8042 (1 << 1)
+#define EFI_ACPI_3_0_VGA_NOT_PRESENT (1 << 2)
+
+//
+// Fixed ACPI Description Table Fixed Feature Flags
+// All other bits are reserved and must be set to 0.
+//
+#define EFI_ACPI_3_0_WBINVD (1 << 0)
+#define EFI_ACPI_3_0_WBINVD_FLUSH (1 << 1)
+#define EFI_ACPI_3_0_PROC_C1 (1 << 2)
+#define EFI_ACPI_3_0_P_LVL2_UP (1 << 3)
+#define EFI_ACPI_3_0_PWR_BUTTON (1 << 4)
+#define EFI_ACPI_3_0_SLP_BUTTON (1 << 5)
+#define EFI_ACPI_3_0_FIX_RTC (1 << 6)
+#define EFI_ACPI_3_0_RTC_S4 (1 << 7)
+#define EFI_ACPI_3_0_TMR_VAL_EXT (1 << 8)
+#define EFI_ACPI_3_0_DCK_CAP (1 << 9)
+#define EFI_ACPI_3_0_RESET_REG_SUP (1 << 10)
+#define EFI_ACPI_3_0_SEALED_CASE (1 << 11)
+#define EFI_ACPI_3_0_HEADLESS (1 << 12)
+#define EFI_ACPI_3_0_CPU_SW_SLP (1 << 13)
+#define EFI_ACPI_3_0_PCI_EXP_WAK (1 << 14)
+#define EFI_ACPI_3_0_USE_PLATFORM_CLOCK (1 << 15)
+#define EFI_ACPI_3_0_S4_RTC_STS_VALID (1 << 16)
+#define EFI_ACPI_3_0_REMOTE_POWER_ON_CAPABLE (1 << 17)
+#define EFI_ACPI_3_0_FORCE_APIC_CLUSTER_MODEL (1 << 18)
+#define EFI_ACPI_3_0_FORCE_APIC_PHYSICAL_DESTINATION_MODE (1 << 19)
+
+//
+// Firmware ACPI Control Structure
+//
+typedef struct {
+ UINT32 Signature;
+ UINT32 Length;
+ UINT32 HardwareSignature;
+ UINT32 FirmwareWakingVector;
+ UINT32 GlobalLock;
+ UINT32 Flags;
+ UINT64 XFirmwareWakingVector;
+ UINT8 Version;
+ UINT8 Reserved[31];
+} EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE;
+
+//
+// FACS Version (as defined in ACPI 3.0 spec.)
+//
+#define EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION 0x01
+
+//
+// Firmware Control Structure Feature Flags
+// All other bits are reserved and must be set to 0.
+//
+#define EFI_ACPI_3_0_S4BIOS_F (1 << 0)
+
+//
+// Differentiated System Description Table,
+// Secondary System Description Table
+// and Persistent System Description Table,
+// no definition needed as they are common description table header followed by a
+// definition block.
+//
+#define EFI_ACPI_3_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_REVISION 0x02
+#define EFI_ACPI_3_0_SECONDARY_SYSTEM_DESCRIPTION_TABLE_REVISION 0x02
+
+//
+// Multiple APIC Description Table header definition. The rest of the table
+// must be defined in a platform specific manner.
+//
+typedef struct {
+ EFI_ACPI_DESCRIPTION_HEADER Header;
+ UINT32 LocalApicAddress;
+ UINT32 Flags;
+} EFI_ACPI_3_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER;
+
+//
+// MADT Revision (as defined in ACPI 3.0 spec.)
+//
+#define EFI_ACPI_3_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION 0x02
+
+//
+// Multiple APIC Flags
+// All other bits are reserved and must be set to 0.
+//
+#define EFI_ACPI_3_0_PCAT_COMPAT (1 << 0)
+
+//
+// Multiple APIC Description Table APIC structure types
+// All other values between 0x09 an 0xFF are reserved and
+// will be ignored by OSPM.
+//
+#define EFI_ACPI_3_0_PROCESSOR_LOCAL_APIC 0x00
+#define EFI_ACPI_3_0_IO_APIC 0x01
+#define EFI_ACPI_3_0_INTERRUPT_SOURCE_OVERRIDE 0x02
+#define EFI_ACPI_3_0_NON_MASKABLE_INTERRUPT_SOURCE 0x03
+#define EFI_ACPI_3_0_LOCAL_APIC_NMI 0x04
+#define EFI_ACPI_3_0_LOCAL_APIC_ADDRESS_OVERRIDE 0x05
+#define EFI_ACPI_3_0_IO_SAPIC 0x06
+#define EFI_ACPI_3_0_LOCAL_SAPIC 0x07
+#define EFI_ACPI_3_0_PLATFORM_INTERRUPT_SOURCES 0x08
+
+//
+// APIC Structure Definitions
+//
+//
+// Processor Local APIC Structure Definition
+//
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 AcpiProcessorId;
+ UINT8 ApicId;
+ UINT32 Flags;
+} EFI_ACPI_3_0_PROCESSOR_LOCAL_APIC_STRUCTURE;
+
+//
+// Local APIC Flags. All other bits are reserved and must be 0.
+//
+#define EFI_ACPI_3_0_LOCAL_APIC_ENABLED (1 << 0)
+
+//
+// IO APIC Structure
+//
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 IoApicId;
+ UINT8 Reserved;
+ UINT32 IoApicAddress;
+ UINT32 GlobalSystemInterruptBase;
+} EFI_ACPI_3_0_IO_APIC_STRUCTURE;
+
+//
+// Interrupt Source Override Structure
+//
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 Bus;
+ UINT8 Source;
+ UINT32 GlobalSystemInterrupt;
+ UINT16 Flags;
+} EFI_ACPI_3_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE;
+
+//
+// Platform Interrupt Sources Structure Definition
+//
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT16 Flags;
+ UINT8 InterruptType;
+ UINT8 ProcessorId;
+ UINT8 ProcessorEid;
+ UINT8 IoSapicVector;
+ UINT32 GlobalSystemInterrupt;
+ UINT32 PlatformInterruptSourceFlags;
+ UINT8 CpeiProcessorOverride;
+ UINT8 Reserved[31];
+} EFI_ACPI_3_0_PLATFORM_INTERRUPT_APIC_STRUCTURE;
+
+//
+// MPS INTI flags.
+// All other bits are reserved and must be set to 0.
+//
+#define EFI_ACPI_3_0_POLARITY (3 << 0)
+#define EFI_ACPI_3_0_TRIGGER_MODE (3 << 2)
+
+//
+// Non-Maskable Interrupt Source Structure
+//
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT16 Flags;
+ UINT32 GlobalSystemInterrupt;
+} EFI_ACPI_3_0_NON_MASKABLE_INTERRUPT_SOURCE_STRUCTURE;
+
+//
+// Local APIC NMI Structure
+//
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 AcpiProcessorId;
+ UINT16 Flags;
+ UINT8 LocalApicLint;
+} EFI_ACPI_3_0_LOCAL_APIC_NMI_STRUCTURE;
+
+//
+// Local APIC Address Override Structure
+//
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT16 Reserved;
+ UINT64 LocalApicAddress;
+} EFI_ACPI_3_0_LOCAL_APIC_ADDRESS_OVERRIDE_STRUCTURE;
+
+//
+// IO SAPIC Structure
+//
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 IoApicId;
+ UINT8 Reserved;
+ UINT32 GlobalSystemInterruptBase;
+ UINT64 IoSapicAddress;
+} EFI_ACPI_3_0_IO_SAPIC_STRUCTURE;
+
+//
+// Local SAPIC Structure
+// This struct followed by a null-terminated ASCII string - ACPI Processor UID String
+//
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 AcpiProcessorId;
+ UINT8 LocalSapicId;
+ UINT8 LocalSapicEid;
+ UINT8 Reserved[3];
+ UINT32 Flags;
+ UINT32 ACPIProcessorUIDValue;
+} EFI_ACPI_3_0_PROCESSOR_LOCAL_SAPIC_STRUCTURE;
+
+//
+// Platform Interrupt Sources Structure
+//
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT16 Flags;
+ UINT8 InterruptType;
+ UINT8 ProcessorId;
+ UINT8 ProcessorEid;
+ UINT8 IoSapicVector;
+ UINT32 GlobalSystemInterrupt;
+ UINT32 PlatformInterruptSourceFlags;
+} EFI_ACPI_3_0_PLATFORM_INTERRUPT_SOURCES_STRUCTURE;
+
+//
+// Platform Interrupt Source Flags.
+// All other bits are reserved and must be set to 0.
+//
+#define EFI_ACPI_3_0_CPEI_PROCESSOR_OVERRIDE (1 << 0)
+
+//
+// Smart Battery Description Table (SBST)
+//
+typedef struct {
+ EFI_ACPI_DESCRIPTION_HEADER Header;
+ UINT32 WarningEnergyLevel;
+ UINT32 LowEnergyLevel;
+ UINT32 CriticalEnergyLevel;
+} EFI_ACPI_3_0_SMART_BATTERY_DESCRIPTION_TABLE;
+
+//
+// SBST Version (as defined in ACPI 3.0 spec.)
+//
+#define EFI_ACPI_3_0_SMART_BATTERY_DESCRIPTION_TABLE_REVISION 0x01
+
+//
+// Embedded Controller Boot Resources Table (ECDT)
+// The table is followed by a null terminated ASCII string that contains
+// a fully qualified reference to the name space object.
+//
+typedef struct {
+ EFI_ACPI_DESCRIPTION_HEADER Header;
+ EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE EcControl;
+ EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE EcData;
+ UINT32 Uid;
+ UINT8 GpeBit;
+} EFI_ACPI_3_0_EMBEDDED_CONTROLLER_BOOT_RESOURCES_TABLE;
+
+//
+// ECDT Version (as defined in ACPI 3.0 spec.)
+//
+#define EFI_ACPI_3_0_EMBEDDED_CONTROLLER_BOOT_RESOURCES_TABLE_REVISION 0x01
+
+//
+// System Resource Affinity Table (SRAT. The rest of the table
+// must be defined in a platform specific manner.
+//
+typedef struct {
+ EFI_ACPI_DESCRIPTION_HEADER Header;
+ UINT32 Reserved1; // Must be set to 1
+ UINT64 Reserved2;
+} EFI_ACPI_3_0_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER;
+
+//
+// SRAT Version (as defined in ACPI 3.0 spec.)
+//
+#define EFI_ACPI_3_0_SYSTEM_RESOURCE_AFFINITY_TABLE_REVISION 0x02
+
+//
+// SRAT structure types.
+// All other values between 0x02 an 0xFF are reserved and
+// will be ignored by OSPM.
+//
+#define EFI_ACPI_3_0_PROCESSOR_LOCAL_APIC_SAPIC_AFFINITY 0x00
+#define EFI_ACPI_3_0_MEMORY_AFFINITY 0x01
+
+//
+// Processor Local APIC/SAPIC Affinity Structure Definition
+//
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 ProximityDomain7To0;
+ UINT8 ApicId;
+ UINT32 Flags;
+ UINT8 LocalSapicEid;
+ UINT8 ProximityDomain31To8[3];
+ UINT8 Reserved[4];
+} EFI_ACPI_3_0_PROCESSOR_LOCAL_APIC_SAPIC_AFFINITY_STRUCTURE;
+
+//
+// Local APIC/SAPIC Flags. All other bits are reserved and must be 0.
+//
+#define EFI_ACPI_3_0_PROCESSOR_LOCAL_APIC_SAPIC_ENABLED (1 << 0)
+
+//
+// Memory Affinity Structure Definition
+//
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT32 ProximityDomain;
+ UINT16 Reserved1;
+ UINT32 AddressBaseLow;
+ UINT32 AddressBaseHigh;
+ UINT32 LengthLow;
+ UINT32 LengthHigh;
+ UINT32 Reserved2;
+ UINT32 Flags;
+ UINT64 Reserved3;
+} EFI_ACPI_3_0_MEMORY_AFFINITY_STRUCTURE;
+
+//
+// Memory Flags. All other bits are reserved and must be 0.
+//
+#define EFI_ACPI_3_0_MEMORY_ENABLED (1 << 0)
+#define EFI_ACPI_3_0_MEMORY_HOT_PLUGGABLE (1 << 1)
+#define EFI_ACPI_3_0_MEMORY_NONVOLATILE (1 << 2)
+
+//
+// System Locality Distance Information Table (SLIT).
+// The rest of the table is a matrix.
+//
+typedef struct {
+ EFI_ACPI_DESCRIPTION_HEADER Header;
+ UINT64 NumberOfSystemLocalities;
+} EFI_ACPI_3_0_SYSTEM_LOCALITY_DISTANCE_INFORMATION_TABLE_HEADER;
+
+//
+// SLIT Version (as defined in ACPI 3.0 spec.)
+//
+#define EFI_ACPI_3_0_SYSTEM_LOCALITY_DISTANCE_INFORMATION_TABLE_REVISION 0x01
+
+//
+// Known table signatures
+//
+//
+// "RSD PTR " Root System Description Pointer
+//
+#define EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER_SIGNATURE 0x2052545020445352
+
+//
+// "APIC" Multiple APIC Description Table
+//
+#define EFI_ACPI_3_0_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE 0x43495041
+
+//
+// "DSDT" Differentiated System Description Table
+//
+#define EFI_ACPI_3_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE 0x54445344
+
+//
+// "ECDT" Embedded Controller Boot Resources Table
+//
+#define EFI_ACPI_3_0_EMBEDDED_CONTROLLER_BOOT_RESOURCES_TABLE_SIGNATURE 0x54444345
+
+//
+// "FACP" Fixed ACPI Description Table
+//
+#define EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE 0x50434146
+
+//
+// "FACS" Firmware ACPI Control Structure
+//
+#define EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE 0x53434146
+
+//
+// "PSDT" Persistent System Description Table
+//
+#define EFI_ACPI_3_0_PERSISTENT_SYSTEM_DESCRIPTION_TABLE_SIGNATURE 0x54445350
+
+//
+// "RSDT" Root System Description Table
+//
+#define EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_TABLE_SIGNATURE 0x54445352
+
+//
+// "SBST" Smart Battery Specification Table
+//
+#define EFI_ACPI_3_0_SMART_BATTERY_SPECIFICATION_TABLE_SIGNATURE 0x54534253
+
+//
+// "SLIT" System Locality Information Table
+//
+#define EFI_ACPI_3_0_SYSTEM_LOCALITY_INFORMATION_TABLE_SIGNATURE 0x54494C53
+
+//
+// "SRAT" System Resource Affinity Table
+//
+#define EFI_ACPI_3_0_SYSTEM_RESOURCE_AFFINITY_TABLE_SIGNATURE 0x54415253
+
+//
+// "SSDT" Secondary System Description Table
+//
+#define EFI_ACPI_3_0_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE 0x54445353
+
+//
+// "XSDT" Extended System Description Table
+//
+#define EFI_ACPI_3_0_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE 0x54445358
+
+//
+// "BOOT" MS Simple Boot Spec
+//
+#define EFI_ACPI_3_0_SIMPLE_BOOT_FLAG_TABLE_SIGNATURE 0x544F4F42
+
+//
+// "CPEP" Corrected Platform Error Polling Table
+// See
+//
+#define EFI_ACPI_3_0_CORRECTED_PLATFORM_ERROR_POLLING_TABLE_SIGNATURE 0x50455043
+
+//
+// "DBGP" MS Debug Port Spec
+//
+#define EFI_ACPI_3_0_DEBUG_PORT_TABLE_SIGNATURE 0x50474244
+
+//
+// "ETDT" Event Timer Description Table
+//
+#define EFI_ACPI_3_0_EVENT_TIMER_DESCRIPTION_TABLE_SIGNATURE 0x54445445
+
+//
+// "HPET" IA-PC High Precision Event Timer Table
+//
+#define EFI_ACPI_3_0_HIGH_PRECISION_EVENT_TIMER_TABLE_SIGNATURE 0x54455048
+
+//
+// "MCFG" PCI Express Memory Mapped Configuration Space Base Address Description Table
+//
+#define EFI_ACPI_3_0_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE 0x4746434D
+
+//
+// "SPCR" Serial Port Concole Redirection Table
+//
+#define EFI_ACPI_3_0_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE 0x52435053
+
+//
+// "SPMI" Server Platform Management Interface Table
+//
+#define EFI_ACPI_3_0_SERVER_PLATFORM_MANAGEMENT_INTERFACE_TABLE_SIGNATURE 0x494D5053
+
+//
+// "TCPA" Trusted Computing Platform Alliance Capabilities Table
+//
+#define EFI_ACPI_3_0_TRUSTED_COMPUTING_PLATFORM_ALLIANCE_CAPABILITIES_TABLE_SIGNATURE 0x41504354
+
+//
+// "WDRT" Watchdog Resource Table
+//
+#define EFI_ACPI_3_0_WATCHDOG_RESOURCE_TABLE_SIGNATURE 0x41504354 0x54524457
+
+#pragma pack()
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/SampleCode/Include/PchAslUpdateLib.h b/ReferenceCode/Chipset/LynxPoint/SampleCode/Include/PchAslUpdateLib.h
new file mode 100644
index 0000000..64bc613
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SampleCode/Include/PchAslUpdateLib.h
@@ -0,0 +1,166 @@
+/** @file
+ ASL dynamic update library definitions.
+ This library provides dymanic update to various ASL structures.
+ There may be different libraries for different environments (PEI, BS, RT, SMM).
+ Make sure you meet the requirements for the library (protocol dependencies, use
+ restrictions, etc).
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _ASL_UPDATE_LIB_H_
+#define _ASL_UPDATE_LIB_H_
+
+//
+// Include files
+//
+#include "Acpi3_0.h"
+
+#include EFI_PROTOCOL_DEPENDENCY (AcpiSupport)
+#include EFI_PROTOCOL_DEPENDENCY (AcpiTable)
+
+//
+// AML parsing definitions
+//
+#define AML_NAME_OP 0x08
+#define AML_BUFFER_OP 0x11
+#define AML_DMA_FIXED_DESC_OP 0x55
+#define AML_DEVICE_OP 0x825B
+#define AML_MEMORY32_FIXED_OP 0x86
+#define AML_DWORD_OP 0x87
+#define AML_INTERRUPT_DESC_OP 0x89
+#define AML_RESRC_TEMP_END_TAG 0x0079
+
+/**
+ Initialize the ASL update library state.
+ This must be called prior to invoking other library functions.
+
+ @param[in] None
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+InitializePchAslUpdateLib (
+ VOID
+ );
+
+/**
+ This procedure will update immediate value assigned to a Name
+
+ @param[in] AslSignature The signature of Operation Region that we want to update.
+ @param[in] Buffer source of data to be written over original aml
+ @param[in] Length length of data to be overwritten
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+UpdateNameAslCode(
+ IN UINT32 AslSignature,
+ IN VOID *Buffer,
+ IN UINTN Length
+ );
+
+/**
+ This function locates an ACPI structure and updates it.
+ This function knows how to update operation regions and BUFA/BUFB resource structures.
+
+ This function may not be implemented in all instantiations of this library.
+
+ @param[in] AslSignature The signature of Operation Region that we want to update.
+ @param[in] BufferName signature of the Buffer inside OpRegion that we want to update
+ @param[in] MacroAmlEncoding type of entry inside Buffer.
+ @param[in] MacroEntryNumber number of entry of the above type
+ @param[in] Offset offset (in bytes) inside entry where update will be performed
+ @param[in] Buffer source of data to be written over original aml
+ @param[in] Length length of data to be overwritten
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+UpdateResourceTemplateAslCode (
+ IN UINT32 AslSignature,
+ IN UINT32 BufferName,
+ IN UINT8 MacroAmlEncoding,
+ IN UINT8 MacroEntryNumber,
+ IN UINT8 Offset,
+ IN VOID *Buffer,
+ IN UINTN Length
+ );
+
+/**
+ This function uses the ACPI support protocol to locate an ACPI table using the .
+ It is really only useful for finding tables that only have a single instance,
+ e.g. FADT, FACS, MADT, etc. It is not good for locating SSDT, etc.
+ Matches are determined by finding the table with ACPI table that has
+ a matching signature and version.
+
+ @param[in] TableId Pointer to an ASCII string containing the Signature to match
+ @param[in out] Table Updated with a pointer to the table
+ @param[in out] Handle AcpiSupport protocol table handle for the table found
+ @param[in out] Version On input, the version of the table desired,
+ on output, the versions the table belongs to
+ (see AcpiSupport protocol for details)
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+LocateAcpiTableBySignature (
+ IN UINT32 Signature,
+ IN OUT EFI_ACPI_DESCRIPTION_HEADER **Table,
+ IN OUT UINTN *Handle,
+ IN OUT EFI_ACPI_TABLE_VERSION *Version
+ );
+
+/**
+ This function uses the ACPI support protocol to locate an ACPI SSDT table.
+ The table is located by searching for a matching OEM Table ID field.
+ Partial match searches are supported via the TableIdSize parameter.
+
+ @param[in] TableId Pointer to an ASCII string containing the OEM Table ID from the ACPI table header
+ @param[in] TableIdSize Length of the TableId to match. Table ID are 8 bytes long, this function
+ will consider it a match if the first TableIdSize bytes match
+ @param[in out] Table Updated with a pointer to the table
+ @param[in out] Handle AcpiSupport protocol table handle for the table found
+ @param[in out] Version See AcpiSupport protocol, GetAcpiTable function for use
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+LocateAcpiTableByOemTableId (
+ IN UINT8 *TableId,
+ IN UINT8 TableIdSize,
+ IN OUT EFI_ACPI_DESCRIPTION_HEADER **Table,
+ IN OUT UINTN *Handle,
+ IN OUT EFI_ACPI_TABLE_VERSION *Version
+ );
+
+/**
+ This function calculates and updates an UINT8 checksum.
+
+ @param[in] Buffer Pointer to buffer to checksum
+ @param[in] Size Number of bytes to checksum
+ @param[in] ChecksumOffset Offset to place the checksum result in
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFI_BOOTSERVICE
+AcpiChecksum (
+ IN VOID *Buffer,
+ IN UINTN Size,
+ IN UINTN ChecksumOffset
+ );
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/SampleCode/Library/AslUpdate/Dxe/PchAslUpdateLib.c b/ReferenceCode/Chipset/LynxPoint/SampleCode/Library/AslUpdate/Dxe/PchAslUpdateLib.c
new file mode 100644
index 0000000..919ab50
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SampleCode/Library/AslUpdate/Dxe/PchAslUpdateLib.c
@@ -0,0 +1,474 @@
+/** @file
+ Boot service DXE ASL update library implementation.
+
+ These functions in this file can be called during DXE and cannot be called during runtime
+ or in SMM which should use a RT or SMM library.
+
+ This library uses the ACPI Support protocol.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#endif
+#include "PchAslUpdateLib.h"
+
+//
+// Function implemenations
+//
+static EFI_ACPI_SUPPORT_PROTOCOL *mAcpiSupport = NULL;
+static EFI_ACPI_TABLE_PROTOCOL *mAcpiTable = NULL;
+
+/**
+ Initialize the ASL update library state.
+ This must be called prior to invoking other library functions.
+
+ @param[in] None
+
+ @retval EFI_SUCCESS - The function completed successfully.
+**/
+EFI_STATUS
+InitializePchAslUpdateLib (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+
+ ///
+ /// Locate ACPI tables
+ ///
+ Status = gBS->LocateProtocol (&gEfiAcpiSupportGuid, NULL, (VOID **) &mAcpiSupport);
+ Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **) &mAcpiTable);
+ return Status;
+}
+
+/**
+ This procedure will update immediate value assigned to a Name
+
+ @param[in] AslSignature - The signature of Operation Region that we want to update.
+ @param[in] Buffer - source of data to be written over original aml
+ @param[in] Length - length of data to be overwritten
+
+ @retval EFI_SUCCESS - The function completed successfully.
+**/
+EFI_STATUS
+UpdateNameAslCode(
+ IN UINT32 AslSignature,
+ IN VOID *Buffer,
+ IN UINTN Length
+ )
+{
+ EFI_STATUS Status;
+ EFI_ACPI_DESCRIPTION_HEADER *Table;
+ EFI_ACPI_TABLE_VERSION Version;
+ UINT8 *CurrPtr;
+ UINT32 *Signature;
+ UINT8 *DsdtPointer;
+ UINT8 Index;
+ UINTN Handle;
+ UINT8 DataSize;
+
+ ///
+ /// Locate table with matching ID
+ ///
+ Index = 0;
+
+ do {
+ Status = mAcpiSupport->GetAcpiTable (mAcpiSupport, Index, (VOID **) &Table, &Version, &Handle);
+ if (Status == EFI_NOT_FOUND) {
+ break;
+ }
+
+ ASSERT_EFI_ERROR (Status);
+ Index++;
+ } while (Table->Signature != EFI_ACPI_3_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE);
+
+ ///
+ /// Point to the beginning of the DSDT table
+ ///
+ Index = 0;
+ CurrPtr = (UINT8 *) Table;
+
+ ///
+ /// Loop through the ASL looking for values that we must fix up.
+ ///
+ for (DsdtPointer = CurrPtr; DsdtPointer <= (CurrPtr + ((EFI_ACPI_COMMON_HEADER *) CurrPtr)->Length); DsdtPointer++) {
+ ///
+ /// Get a pointer to compare for signature
+ ///
+ Signature = (UINT32 *) DsdtPointer;
+ ///
+ /// Check if this is the Device Object signature we are looking for
+ ///
+ if ((*Signature) == AslSignature) {
+ ///
+ /// Look for Name Encoding
+ ///
+ if(*(DsdtPointer-1) == AML_NAME_OP){
+ ///
+ /// Check if size of new and old data is the same
+ ///
+ DataSize = *(DsdtPointer+4);
+ if ((Length == 1 && DataSize == 0xA) ||
+ (Length == 2 && DataSize == 0xB) ||
+ (Length == 4 && DataSize == 0xC) ) {
+ CopyMem (DsdtPointer+5, Buffer, Length);
+ } else if (Length == 1 && ((*(UINT8*)Buffer) == 0 || (*(UINT8*)Buffer) == 1) && (DataSize == 0 || DataSize == 1)) {
+ CopyMem (DsdtPointer+4, Buffer, Length);
+ } else {
+ FreePool (Table);
+ return EFI_BAD_BUFFER_SIZE;
+ }
+#ifdef AMI_OVERRIDE_FOR_ACPI
+ Status = mAcpiTable->UninstallAcpiTable (
+ mAcpiTable,
+ Handle
+ );
+ Handle = 0;
+#endif //AMI_OVERRIDE_FOR_ACPI
+ Status = mAcpiTable->InstallAcpiTable (
+ mAcpiTable,
+ Table,
+ Table->Length,
+ &Handle
+ );
+ FreePool (Table);
+ return Status;
+ }
+ }
+ }
+ return EFI_NOT_FOUND;
+}
+
+/**
+ This procedure will update a Resource Descriptor Macro in
+ Resrouce Template buffer list.
+
+ @param[in] AslSignature - The signature of Operation Region that we want to update.
+ @param[in] BufferName - signature of the Buffer inside OpRegion that we want to update
+ @param[in] MacroAmlEncoding - type of entry inside Buffer.
+ @param[in] MacroEntryNumber - number of entry of the above type
+ @param[in] Offset - offset (in bytes) inside entry where update will be performed
+ @param[in] Buffer - source of data to be written over original aml
+ @param[in] Length - length of data to be overwritten
+
+ @retval EFI_SUCCESS - The function completed successfully.
+**/
+EFI_STATUS
+UpdateResourceTemplateAslCode (
+ IN UINT32 AslSignature,
+ IN UINT32 BufferName,
+ IN UINT8 MacroAmlEncoding,
+ IN UINT8 MacroEntryNumber,
+ IN UINT8 Offset,
+ IN VOID *Buffer,
+ IN UINTN Length
+ )
+{
+ EFI_STATUS Status;
+ EFI_ACPI_DESCRIPTION_HEADER *Table;
+ EFI_ACPI_TABLE_VERSION Version;
+ UINT8 *CurrPtr;
+ UINT8 *Operation;
+ UINT32 *Signature;
+ UINT8 *DsdtPointer;
+ UINT8 Index;
+ UINTN Handle;
+ UINT32 AslLength;
+ BOOLEAN EntryFound;
+
+ ///
+ /// Locate table with matching ID
+ ///
+ Index = 0;
+ AslLength = 0;
+ EntryFound = FALSE;
+
+ do {
+ Status = mAcpiSupport->GetAcpiTable (mAcpiSupport, Index, (VOID **)&Table, &Version, &Handle);
+ if (Status == EFI_NOT_FOUND) {
+ break;
+ }
+
+ ASSERT_EFI_ERROR (Status);
+ Index++;
+ } while (Table->Signature != EFI_ACPI_3_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE);
+
+ ///
+ /// Point to the beginning of the DSDT table
+ ///
+ Index = 0;
+ CurrPtr = (UINT8 *) Table;
+
+ ///
+ /// Loop through the ASL looking for values that we must fix up.
+ ///
+ for (DsdtPointer = CurrPtr; DsdtPointer <= (CurrPtr + ((EFI_ACPI_COMMON_HEADER *) CurrPtr)->Length); DsdtPointer++) {
+ ///
+ /// Get a pointer to compare for signature
+ ///
+ Signature = (UINT32 *) DsdtPointer;
+
+ ///
+ /// Check if this is the Device Object signature we are looking for
+ ///
+ if ((*Signature) == AslSignature) {
+ ///
+ /// Read the Device Object block length
+ ///
+ if (*(UINT16 *)(DsdtPointer - 3) == AML_DEVICE_OP) {
+ AslLength = *(DsdtPointer - 1);
+ } else if (*(UINT16 *)(DsdtPointer - 4) == AML_DEVICE_OP) {
+ AslLength = *(UINT16 *)(DsdtPointer - 2);
+ AslLength = (AslLength & 0x0F) + ((AslLength & 0x0FF00) >> 4);
+ } else if (*(UINT16 *)(DsdtPointer - 5) == AML_DEVICE_OP) {
+ AslLength = *(UINT32 *)(DsdtPointer - 3) & 0x00FFFFFFFF;
+ AslLength = (AslLength & 0x0F) + ((AslLength & 0x0000FF00) >> 4) + ((AslLength & 0x00FF0000) >> 4);
+ } else if (*(UINT16 *)(DsdtPointer - 6) == AML_DEVICE_OP) {
+ AslLength = *(UINT32 *)(DsdtPointer - 4);
+ AslLength = (AslLength & 0x0F) + ((AslLength & 0x0000FF00) >> 4) + ((AslLength & 0x00FF0000) >> 4) + ((AslLength & 0xFF000000) >> 4);
+ } else {
+ continue; //Search for next instance
+ }
+
+ ///
+ /// Conditional match. Search AML Encoding in Device.
+ ///
+ for (Operation = DsdtPointer; Operation <= DsdtPointer + AslLength; Operation++) {
+ ///
+ /// Look for Name Encoding
+ ///
+ while(Operation <= DsdtPointer + AslLength) {
+ if(*Operation == AML_NAME_OP){
+ ///
+ /// Found Name AML Encoding
+ ///
+ Operation++;
+ if(*(UINT32 *)(Operation) == BufferName) {
+ ///
+ /// Found RBUF Resource Template object name
+ ///
+ break;
+ }
+ }
+ Operation++;
+ }
+
+ if(Operation > DsdtPointer + AslLength ){
+ continue; //Search for next instance
+ }
+
+ ///
+ /// Now look for the Resource Template Object buffer opcode
+ ///
+ while((*Operation) != AML_BUFFER_OP) {
+ Operation++;
+ if(Operation > DsdtPointer + AslLength){
+ FreePool (Table);
+ return EFI_NOT_FOUND;
+ }
+ }
+
+ ///
+ /// Now look for the Macro to be updated until
+ /// (1) it is found OR (2) reach end of resource template
+ ///
+ while(*(UINT16 *)(Operation) != AML_RESRC_TEMP_END_TAG) {
+ if((*Operation == MacroAmlEncoding)) {
+ ///
+ /// We found a matching encoding however, the buffer list may have "n" number
+ /// of same encoding entries. Let's narrow down to the "n"th entry.
+ ///
+ Index++;
+ if(Index == MacroEntryNumber) {
+ ///
+ /// Get to the starting offset & end offset
+ ///
+ Operation += Offset;
+
+ ///
+ /// Fixup the value at the offset
+ ///
+ CopyMem ((VOID *) Operation, (VOID *) (Buffer), Length);
+
+ ///
+ /// Update the modified ACPI table
+ ///
+#ifdef AMI_OVERRIDE_FOR_ACPI
+ Status = mAcpiTable->UninstallAcpiTable (
+ mAcpiTable,
+ Handle
+ );
+ Handle = 0;
+#endif //AMI_OVERRIDE_FOR_ACPI
+ Status = mAcpiTable->InstallAcpiTable (
+ mAcpiTable,
+ Table,
+ Table->Length,
+ &Handle
+ );
+ FreePool (Table);
+ return Status;
+ }
+ }
+ Operation++;
+ }
+
+ if(Operation > DsdtPointer + AslLength) {
+ FreePool (Table);
+ return EFI_NOT_FOUND;
+ }
+ }
+ }
+ }
+
+ return EFI_NOT_FOUND;
+}
+
+/**
+ This function uses the ACPI support protocol to locate an ACPI table.
+ It is really only useful for finding tables that only have a single instance,
+ e.g. FADT, FACS, MADT, etc. It is not good for locating SSDT, etc.
+
+ @param[in] Signature - Pointer to an ASCII string containing the OEM Table ID from the ACPI table header
+ @param[in, out] Table - Updated with a pointer to the table
+ @param[in, out] Handle - AcpiSupport protocol table handle for the table found
+ @param[in, out] Version - The version of the table desired
+
+ @retval EFI_SUCCESS - The function completed successfully.
+**/
+EFI_STATUS
+LocateAcpiTableBySignature (
+ IN UINT32 Signature,
+ IN OUT EFI_ACPI_DESCRIPTION_HEADER **Table,
+ IN OUT UINTN *Handle,
+ IN OUT EFI_ACPI_TABLE_VERSION *Version
+ )
+{
+ EFI_STATUS Status;
+ INTN Index;
+ EFI_ACPI_TABLE_VERSION DesiredVersion;
+
+ DesiredVersion = *Version;
+ ///
+ /// Locate table with matching ID
+ ///
+ Index = 0;
+ do {
+ Status = mAcpiSupport->GetAcpiTable (mAcpiSupport, Index, (VOID **)Table, Version, Handle);
+ if (Status == EFI_NOT_FOUND) {
+ break;
+ }
+
+ ASSERT_EFI_ERROR (Status);
+ Index++;
+ } while ((*Table)->Signature != Signature || !(*Version & DesiredVersion));
+
+ ///
+ /// If we found the table, there will be no error.
+ ///
+ return Status;
+}
+
+/**
+ This function uses the ACPI support protocol to locate an ACPI SSDT table.
+
+ @param[in] TableId - Pointer to an ASCII string containing the OEM Table ID from the ACPI table header
+ @param[in] TableIdSize - Length of the TableId to match. Table ID are 8 bytes long, this function
+ will consider it a match if the first TableIdSize bytes match
+ @param[in, out] Table - Updated with a pointer to the table
+ @param[in, out] Handle - AcpiSupport protocol table handle for the table found
+ @param[in, out] Version - See AcpiSupport protocol, GetAcpiTable function for use
+
+ @retval EFI_SUCCESS - The function completed successfully.
+**/
+EFI_STATUS
+LocateAcpiTableByOemTableId (
+ IN UINT8 *TableId,
+ IN UINT8 TableIdSize,
+ IN OUT EFI_ACPI_DESCRIPTION_HEADER **Table,
+ IN OUT UINTN *Handle,
+ IN OUT EFI_ACPI_TABLE_VERSION *Version
+ )
+{
+ EFI_STATUS Status;
+ INTN Index;
+
+ ///
+ /// Locate table with matching ID
+ ///
+ Index = 0;
+ do {
+ Status = mAcpiSupport->GetAcpiTable (mAcpiSupport, Index, (VOID **)Table, Version, Handle);
+ if (Status == EFI_NOT_FOUND) {
+ break;
+ }
+
+ ASSERT_EFI_ERROR (Status);
+ Index++;
+ } while (CompareMem (&(*Table)->OemTableId, TableId, TableIdSize));
+
+ ///
+ /// If we found the table, there will be no error.
+ ///
+ return Status;
+}
+
+/**
+ This function calculates and updates an UINT8 checksum.
+
+ @param[in] Buffer Pointer to buffer to checksum
+ @param[in] Size Number of bytes to checksum
+ @param[in] ChecksumOffset Offset to place the checksum result in
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+AcpiChecksum (
+ IN VOID *Buffer,
+ IN UINTN Size,
+ IN UINTN ChecksumOffset
+ )
+{
+ UINT8 Sum;
+ UINT8 *Ptr;
+
+ Sum = 0;
+ ///
+ /// Initialize pointer
+ ///
+ Ptr = Buffer;
+
+ ///
+ /// set checksum to 0 first
+ ///
+ Ptr[ChecksumOffset] = 0;
+
+ ///
+ /// add all content of buffer
+ ///
+ while (Size--) {
+ Sum = (UINT8) (Sum + (*Ptr++));
+ }
+ ///
+ /// set checksum
+ ///
+ Ptr = Buffer;
+ Ptr[ChecksumOffset] = (UINT8) (0xff - Sum + 1);
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/SampleCode/Library/AslUpdate/Dxe/PchAslUpdateLib.cif b/ReferenceCode/Chipset/LynxPoint/SampleCode/Library/AslUpdate/Dxe/PchAslUpdateLib.cif
new file mode 100644
index 0000000..79bdb6e
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SampleCode/Library/AslUpdate/Dxe/PchAslUpdateLib.cif
@@ -0,0 +1,11 @@
+<component>
+ name = "PchAslUpdateLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\SampleCode\Library\AslUpdate\Dxe\"
+ RefName = "PchAslUpdateLib"
+[files]
+"PchAslUpdateLib.sdl"
+"PchAslUpdateLib.mak"
+"PchAslUpdateLib.c"
+"PchAslUpdateLib.inf"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/SampleCode/Library/AslUpdate/Dxe/PchAslUpdateLib.inf b/ReferenceCode/Chipset/LynxPoint/SampleCode/Library/AslUpdate/Dxe/PchAslUpdateLib.inf
new file mode 100644
index 0000000..c0a0509
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SampleCode/Library/AslUpdate/Dxe/PchAslUpdateLib.inf
@@ -0,0 +1,66 @@
+## @file
+# Provides services to update ASL tables.
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = PchAslUpdateLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ PchAslUpdateLib.c
+
+[includes.common]
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/SampleCode/Include
+
+#
+# Edk II Glue Library, some hearder are included by R9 header so have to include
+#
+
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Framework
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[libraries.common]
+ EdkIIGlueBaseMemoryLib
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+
+[nmake.common]
+
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__
diff --git a/ReferenceCode/Chipset/LynxPoint/SampleCode/Library/AslUpdate/Dxe/PchAslUpdateLib.mak b/ReferenceCode/Chipset/LynxPoint/SampleCode/Library/AslUpdate/Dxe/PchAslUpdateLib.mak
new file mode 100644
index 0000000..5f59035
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SampleCode/Library/AslUpdate/Dxe/PchAslUpdateLib.mak
@@ -0,0 +1,83 @@
+#**********************************************************************
+#**********************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSampleCode/Library/AslUpdate/Dxe/PchAslUpdateLib.mak 1 7/02/12 9:37a Victortu $
+#
+# $Revision: 1 $
+#
+# $Date: 7/02/12 9:37a $
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSampleCode/Library/AslUpdate/Dxe/PchAslUpdateLib.mak $
+#
+# 1 7/02/12 9:37a Victortu
+# PchAslUpdateLib initially releases.
+#
+# 6 1/13/10 2:13p Felixp
+#
+#**********************************************************************
+#<AMI_FHDR_START>
+#
+# Name: PchAslUpdateLib.mak
+#
+# Description:
+#
+#<AMI_FHDR_END>
+#**********************************************************************
+all : PchAslUpdateLib
+
+$(PchAslUpdateLib_LIB) : PchAslUpdateLib
+
+PchAslUpdateLib : $(BUILD_DIR)\PchAslUpdateLib.mak PchAslUpdateLibBin
+
+$(BUILD_DIR)\PchAslUpdateLib.mak : $(PchAslUpdateLib_DIR)\$(@B).cif $(PchAslUpdateLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(PchAslUpdateLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+PchAslUpdateLib_INCLUDES=\
+ $(EDK_INCLUDES) \
+ $(EdkIIGlueLib_INCLUDES)\
+ /I$(INTEL_PCH_DIR)\SampleCode\Include
+
+PchAslUpdateLib_DEFINES = \
+ $(MY_DEFINES)\
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__\
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__\
+ /D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__
+
+PchAslUpdateLib_LIBS=\
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueUefiRuntimeServicesTableLib_LIB)\
+
+PchAslUpdateLibBin: $(PchAslUpdateLib_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS) \
+ /f $(BUILD_DIR)\PchAslUpdateLib.mak all \
+ "MY_INCLUDES=$(PchAslUpdateLib_INCLUDES)" \
+ "MY_DEFINES=$(PchAslUpdateLib_DEFINES)"\
+ TYPE=LIBRARY
+#**********************************************************************
+#**********************************************************************
+#** **
+#** (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/ReferenceCode/Chipset/LynxPoint/SampleCode/Library/AslUpdate/Dxe/PchAslUpdateLib.sdl b/ReferenceCode/Chipset/LynxPoint/SampleCode/Library/AslUpdate/Dxe/PchAslUpdateLib.sdl
new file mode 100644
index 0000000..c52b5a8
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SampleCode/Library/AslUpdate/Dxe/PchAslUpdateLib.sdl
@@ -0,0 +1,29 @@
+TOKEN
+ Name = PchAslUpdateLib_SUPPORT
+ Value = 1
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable PchAslUpdateLib support in Project"
+End
+
+MODULE
+ Help = "Includes PchAslUpdateLib.mak to Project"
+ File = "PchAslUpdateLib.mak"
+End
+
+PATH
+ Name = "PchAslUpdateLib_DIR"
+End
+
+ELINK
+ Name = "PchAslUpdateLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PchAslUpdateLib.lib"
+ Parent = "PchAslUpdateLib_LIB"
+ InvokeOrder = AfterParent
+End \ No newline at end of file
diff --git a/ReferenceCode/Chipset/LynxPoint/SampleCode/PchPolicyInit/Common/PchPolicyInitCommon.c b/ReferenceCode/Chipset/LynxPoint/SampleCode/PchPolicyInit/Common/PchPolicyInitCommon.c
new file mode 100644
index 0000000..8845a6d
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SampleCode/PchPolicyInit/Common/PchPolicyInitCommon.c
@@ -0,0 +1,427 @@
+/** @file
+ This file is SampleCode for Intel PCH Common Platform Policy initialzation.
+
+@copyright
+ Copyright (c) 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "EdkIIGlueBase.h"
+#include "PchPlatformPolicy.h"
+#include "PchPlatformLib.h"
+#include "PchRegs.h"
+#endif
+
+/**
+ Initilize Intel USB Common Platform Policy
+
+ @param[in] PchUsbConfig Usb platform policy structure.
+
+ @retval NONE
+**/
+VOID
+InitPchUsbConfig (
+ IN PCH_USB_CONFIG *PchUsbConfig
+ )
+{
+ UINTN PortIndex;
+ UINT16 LpcDeviceId;
+ PCH_SERIES PchSeries;
+
+ if (PchUsbConfig == NULL) {
+ return;
+ }
+
+ PchSeries = GetPchSeries();
+ LpcDeviceId = MmioRead16 (MmPciAddress (0, 0, PCI_DEVICE_NUMBER_PCH_LPC, PCI_FUNCTION_NUMBER_PCH_LPC, 0) + R_PCH_LPC_DEVICE_ID);
+
+ //
+ // EHCI Host Controller Enable/Disable
+ //
+ PchUsbConfig->Usb20Settings[0].Enable = PCH_DEVICE_ENABLE;
+ PchUsbConfig->Usb20Settings[1].Enable = PCH_DEVICE_ENABLE;
+
+ //
+ // Automatically disable EHCI when XHCI Mode is Enabled to save power.
+ //
+ if (PchUsbConfig->Usb30Settings.Mode == PCH_XHCI_MODE_ON) {
+ PchUsbConfig->Usb20Settings[0].Enable = PCH_DEVICE_DISABLE;
+ if (PchSeries == PchH) {
+ PchUsbConfig->Usb20Settings[1].Enable = PCH_DEVICE_DISABLE;
+ }
+ }
+ //
+ // Set to Enable if BIOS has its own xHCI driver
+ //
+ PchUsbConfig->Usb30Settings.PreBootSupport = PCH_DEVICE_ENABLE;
+ ///
+ /// PCH BIOS Spec Rev 0.5.0 Section 13.1 xHCI controller options in Reference Code
+ /// Please refer to Table 13-1 in PCH BIOS Spec for USB Port Operation with no xHCI
+ /// pre-boot software.
+ /// Please refer to Table 13-2 in PCH BIOS Spec for USB Port Operation with xHCI
+ /// pre-boot software.
+ ///
+ /// The xHCI modes that available in BIOS are:
+ /// Disabled - forces only USB 2.0 to be supported in the OS. The xHCI controller is turned off
+ /// and hidden from the PCI space.
+ /// Enabled - allows USB 3.0 to be supported in the OS. The xHCI controller is turned on. The
+ /// shareable ports are routed to the xHCI controller. OS needs to provide drivers
+ /// to support USB 3.0.
+ /// Auto - This mode uses ACPI protocol to provide an option that enables the xHCI controller
+ /// and reroute USB ports via the _OSC ACPI method call. Note, this mode switch requires
+ /// special OS driver support for USB 3.0.
+ /// Smart Auto - This mode is similar to Auto, but it adds the capability to route the ports to xHCI
+ /// or EHCI according to setting used in previous boots (for non-G3 boot) in the pre-boot
+ /// environment. This allows the use of USB 3.0 devices prior to OS boot. Note, this mode
+ /// switch requires special OS driver support for USB 3.0 and USB 3.0 software available
+ /// in the pre-boot enviroment.
+ ///
+ /// Manual Mode - For validation and experimental purposes only. Do not create setup option for end-user BIOS.
+ ///
+ /// Recommendations:
+ /// - If BIOS supports xHCI pre-boot driver then use Smart Auto mode as default
+ /// - If BIOS does not support xHCI pre-boot driver then use AUTO mode as default
+ ///
+ if (PchUsbConfig->Usb30Settings.PreBootSupport == PCH_DEVICE_ENABLE) {
+ PchUsbConfig->Usb30Settings.Mode = PCH_XHCI_MODE_SMARTAUTO;
+ } else {
+ PchUsbConfig->Usb30Settings.Mode = PCH_XHCI_MODE_AUTO;
+ }
+
+ //
+ // Manual Mode is for validation and experimental purposes only.
+ // Do not create setup option for end-user BIOS.
+ //
+ PchUsbConfig->Usb30Settings.ManualMode = PCH_DEVICE_DISABLE;
+
+ //
+ // XhciIdleL1 can be set to disable for LPT-LP Ax stepping to workaround USB3 hot plug will fail after 1 hot plug removal.
+ //
+ PchUsbConfig->Usb30Settings.XhciIdleL1 = PCH_DEVICE_ENABLE;
+
+ //
+ // Btcg is for enabling/disabling trunk clock gating.
+ //
+ PchUsbConfig->Usb30Settings.Btcg = PCH_DEVICE_ENABLE;
+
+ for (PortIndex = 0; PortIndex < GetPchUsbMaxPhysicalPortNum (); PortIndex++) {
+ PchUsbConfig->Usb30Settings.ManualModeUsb20PerPinRoute[PortIndex] = 0;
+ }
+
+ for (PortIndex = 0; PortIndex < GetPchXhciMaxUsb3PortNum (); PortIndex++) {
+ PchUsbConfig->Usb30Settings.ManualModeUsb30PerPinEnable[PortIndex] = PCH_DEVICE_DISABLE;
+ }
+
+ //
+ // Use by AMT/MEBx to enable USB-R support.
+ //
+ PchUsbConfig->Ehci1Usbr = PCH_DEVICE_DISABLE;
+ PchUsbConfig->Ehci2Usbr = PCH_DEVICE_DISABLE;
+
+ //
+ // UsbPrecondition = Enable , Force USB Init happen in PEI as part of 2Sec Fast Boot bios optimization
+ // UsbPrecondition = Disable, USB Init happen in DXE just like traditionally where it happen.
+ //
+ PchUsbConfig->UsbPrecondition = PCH_DEVICE_DISABLE;
+
+ //
+ // USB Per-Port Control is use to Enable/Disable individual port.
+ //
+ PchUsbConfig->UsbPerPortCtl = PCH_DEVICE_DISABLE;
+
+ PchUsbConfig->PortSettings[0].Enable = PCH_DEVICE_ENABLE;
+ PchUsbConfig->PortSettings[1].Enable = PCH_DEVICE_ENABLE;
+ PchUsbConfig->PortSettings[2].Enable = PCH_DEVICE_ENABLE;
+ PchUsbConfig->PortSettings[3].Enable = PCH_DEVICE_ENABLE;
+ PchUsbConfig->PortSettings[4].Enable = PCH_DEVICE_ENABLE;
+ PchUsbConfig->PortSettings[5].Enable = PCH_DEVICE_ENABLE;
+ PchUsbConfig->PortSettings[6].Enable = PCH_DEVICE_ENABLE;
+ PchUsbConfig->PortSettings[7].Enable = PCH_DEVICE_ENABLE;
+ PchUsbConfig->PortSettings[8].Enable = PCH_DEVICE_ENABLE;
+ PchUsbConfig->PortSettings[9].Enable = PCH_DEVICE_ENABLE;
+ PchUsbConfig->PortSettings[10].Enable = PCH_DEVICE_ENABLE;
+ PchUsbConfig->PortSettings[11].Enable = PCH_DEVICE_ENABLE;
+ PchUsbConfig->PortSettings[12].Enable = PCH_DEVICE_ENABLE;
+ PchUsbConfig->PortSettings[13].Enable = PCH_DEVICE_ENABLE;
+
+ PchUsbConfig->Port30Settings[0].Enable = PCH_DEVICE_ENABLE;
+ PchUsbConfig->Port30Settings[1].Enable = PCH_DEVICE_ENABLE;
+ PchUsbConfig->Port30Settings[2].Enable = PCH_DEVICE_ENABLE;
+ PchUsbConfig->Port30Settings[3].Enable = PCH_DEVICE_ENABLE;
+ PchUsbConfig->Port30Settings[4].Enable = PCH_DEVICE_ENABLE;
+ PchUsbConfig->Port30Settings[5].Enable = PCH_DEVICE_ENABLE;
+
+ //
+ // USB Port Over Current Pins mapping, please set as per board layout.
+ //
+ PchUsbConfig->Usb20OverCurrentPins[ 0] = PchUsbOverCurrentPin0;
+ PchUsbConfig->Usb20OverCurrentPins[ 1] = PchUsbOverCurrentPin0;
+ PchUsbConfig->Usb20OverCurrentPins[ 2] = PchUsbOverCurrentPin1;
+ PchUsbConfig->Usb20OverCurrentPins[ 3] = PchUsbOverCurrentPin1;
+ PchUsbConfig->Usb20OverCurrentPins[ 4] = PchUsbOverCurrentPin2;
+ PchUsbConfig->Usb20OverCurrentPins[ 5] = PchUsbOverCurrentPin2;
+ PchUsbConfig->Usb20OverCurrentPins[ 6] = PchUsbOverCurrentPin3;
+ PchUsbConfig->Usb20OverCurrentPins[ 7] = PchUsbOverCurrentPin3;
+ PchUsbConfig->Usb20OverCurrentPins[ 8] = PchUsbOverCurrentPin4;
+ PchUsbConfig->Usb20OverCurrentPins[ 9] = PchUsbOverCurrentPin4;
+ PchUsbConfig->Usb20OverCurrentPins[10] = PchUsbOverCurrentPin5;
+ PchUsbConfig->Usb20OverCurrentPins[11] = PchUsbOverCurrentPin5;
+ PchUsbConfig->Usb20OverCurrentPins[12] = PchUsbOverCurrentPin6;
+ PchUsbConfig->Usb20OverCurrentPins[13] = PchUsbOverCurrentPin6;
+
+ PchUsbConfig->Usb30OverCurrentPins[0] = PchUsbOverCurrentPin0;
+ PchUsbConfig->Usb30OverCurrentPins[1] = PchUsbOverCurrentPin0;
+ PchUsbConfig->Usb30OverCurrentPins[2] = PchUsbOverCurrentPin1;
+ PchUsbConfig->Usb30OverCurrentPins[3] = PchUsbOverCurrentPin1;
+ PchUsbConfig->Usb30OverCurrentPins[4] = PchUsbOverCurrentPin2;
+ PchUsbConfig->Usb30OverCurrentPins[5] = PchUsbOverCurrentPin2;
+
+ //
+ // USB 2.0 D+/D- trace length in inchs*10 or 1000mils/10 measurement eg. 12.3" = 0x123
+ // Please set as per board layout.
+ //
+ PchUsbConfig->PortSettings[ 0].Usb20PortLength = 0x100;
+ PchUsbConfig->PortSettings[ 1].Usb20PortLength = 0x100;
+ PchUsbConfig->PortSettings[ 2].Usb20PortLength = 0x100;
+ PchUsbConfig->PortSettings[ 3].Usb20PortLength = 0x100;
+ PchUsbConfig->PortSettings[ 4].Usb20PortLength = 0x100;
+ PchUsbConfig->PortSettings[ 5].Usb20PortLength = 0x100;
+ PchUsbConfig->PortSettings[ 6].Usb20PortLength = 0x100;
+ PchUsbConfig->PortSettings[ 7].Usb20PortLength = 0x100;
+ PchUsbConfig->PortSettings[ 8].Usb20PortLength = 0x100;
+ PchUsbConfig->PortSettings[ 9].Usb20PortLength = 0x100;
+ PchUsbConfig->PortSettings[10].Usb20PortLength = 0x100;
+ PchUsbConfig->PortSettings[11].Usb20PortLength = 0x100;
+ PchUsbConfig->PortSettings[12].Usb20PortLength = 0x100;
+ PchUsbConfig->PortSettings[13].Usb20PortLength = 0x100;
+
+ //
+ // Port Location
+ //
+ PchUsbConfig->PortSettings[ 0].Location = PchUsbPortLocationFrontPanel;
+ PchUsbConfig->PortSettings[ 1].Location = PchUsbPortLocationFrontPanel;
+ PchUsbConfig->PortSettings[ 2].Location = PchUsbPortLocationFrontPanel;
+ PchUsbConfig->PortSettings[ 3].Location = PchUsbPortLocationFrontPanel;
+ PchUsbConfig->PortSettings[ 4].Location = PchUsbPortLocationFrontPanel;
+ PchUsbConfig->PortSettings[ 5].Location = PchUsbPortLocationFrontPanel;
+ PchUsbConfig->PortSettings[ 6].Location = PchUsbPortLocationFrontPanel;
+ PchUsbConfig->PortSettings[ 7].Location = PchUsbPortLocationFrontPanel;
+ PchUsbConfig->PortSettings[ 8].Location = PchUsbPortLocationFrontPanel;
+ PchUsbConfig->PortSettings[ 9].Location = PchUsbPortLocationFrontPanel;
+ PchUsbConfig->PortSettings[10].Location = PchUsbPortLocationFrontPanel;
+ PchUsbConfig->PortSettings[11].Location = PchUsbPortLocationFrontPanel;
+ PchUsbConfig->PortSettings[12].Location = PchUsbPortLocationFrontPanel;
+ PchUsbConfig->PortSettings[13].Location = PchUsbPortLocationFrontPanel;
+
+/*
+ Guideline:
+ This algorithm is move from chipset level code to board level code to allow OEM more flexibility
+ to tune the value for individual board layout electrical characteristics to pass the USB 2.0 Eye Diagram Test.
+
+ IF Board=LPT-H Desktop
+ For BIT[10:08] Usb20EyeDiagramTuningParam1 (PERPORTTXISET)
+ IF Back Panel
+ SET to 4
+ ELSE
+ SET to 3
+ ENDIF
+
+ For BIT[13:11] Usb20EyeDiagramTuningParam2 (PERPORTPETXISET)
+ IF Back Panel
+ IF Trace Length < 8"
+ SET to 2
+ ELSE IF Trace Length < 13"
+ SET to 3
+ ELSE
+ SET to 4
+ ENDIF
+ ELSE
+ SET to 2
+ ENDIF
+
+ For BIT[14]
+ Always SET to 0
+
+ END LPT-H Desktop
+
+ IF Board=LPT-H Mobile
+ For BIT[10:08] Usb20EyeDiagramTuningParam1 (PERPORTTXISET)
+ IF Interal Topology
+ SET to 5
+ ELSE IF Dock
+ SET to 4
+ ELSE
+ IF Trace Length < 7"
+ SET to 5
+ ELSE
+ SET to 6
+ ENDIF
+ ENDIF
+
+ For BIT[13:11] Usb20EyeDiagramTuningParam2 (PERPORTPETXISET)
+ IF Interal Topology
+ SET to 2
+ ELSE IF Dock
+ IF Trace Length < 5"
+ SET to 1
+ ELSE
+ SET to 2
+ ENDIF
+ ELSE
+ IF Trace Length < 10"
+ SET to 2
+ ELSE
+ SET to 3
+ ENDIF
+ ENDIF
+
+ For BIT[14]
+ Always SET to 0
+ END LPT-H Mobile
+
+ IF Board=LPT-LP
+ For BIT[10:08] Usb20EyeDiagramTuningParam1 (PERPORTTXISET)
+ IF Back Panel OR MiniPciE
+ IF Trace Length < 7"
+ SET to 5
+ ELSE
+ SET to 6
+ ENDIF
+ ELSE IF Dock
+ SET to 4
+ ELSE
+ SET to 5
+ ENDIF
+
+ For BIT[13:11] Usb20EyeDiagramTuningParam2 (PERPORTPETXISET)
+ IF Back Panel OR MiniPciE
+ IF Trace Length < 10"
+ SET to 2
+ ELSE
+ SET to 3
+ ENDIF
+ ELSE IF Dock
+ IF Trace Length < 5"
+ SET to 1
+ ELSE
+ SET to 2
+ ENDIF
+ ELSE
+ SET to 2
+ ENDIF
+
+ For BIT[14]
+ Always SET to 0
+ END LPT-LP
+*/
+
+ //
+ // USB 2.0 trace length signal strength
+ //
+/*
+ IF Board=LPT-H Mobile
+
+ END LPT-H Mobile
+*/
+
+ if (PchSeries == PchH) {
+ if (IS_PCH_LPT_LPC_DEVICE_ID_DESKTOP (LpcDeviceId)) {
+ for (PortIndex = 0; PortIndex < GetPchUsbMaxPhysicalPortNum (); PortIndex++) {
+ if (PchUsbConfig->PortSettings[PortIndex].Location == PchUsbPortLocationBackPanel) {
+ PchUsbConfig->PortSettings[PortIndex].Usb20EyeDiagramTuningParam1 = 4; //Back Panel
+ } else {
+ PchUsbConfig->PortSettings[PortIndex].Usb20EyeDiagramTuningParam1 = 3; //Front Panel
+ }
+
+ if (PchUsbConfig->PortSettings[PortIndex].Location == PchUsbPortLocationBackPanel) {
+ if (PchUsbConfig->PortSettings[PortIndex].Usb20PortLength < 0x80) {
+ PchUsbConfig->PortSettings[PortIndex].Usb20EyeDiagramTuningParam2 = 2; //Back Panel, less than 7.9"
+ } else if (PchUsbConfig->PortSettings[PortIndex].Usb20PortLength < 0x130) {
+ PchUsbConfig->PortSettings[PortIndex].Usb20EyeDiagramTuningParam2 = 3; //Back Panel, 8"-12.9"
+ } else {
+ PchUsbConfig->PortSettings[PortIndex].Usb20EyeDiagramTuningParam2 = 4; //Back Panel, 13" onward
+ }
+ } else {
+ PchUsbConfig->PortSettings[PortIndex].Usb20EyeDiagramTuningParam2 = 2; //Front Panel
+ }
+ }
+ } else if (IS_PCH_LPT_LPC_DEVICE_ID_MOBILE (LpcDeviceId)) {
+ for (PortIndex = 0; PortIndex < GetPchUsbMaxPhysicalPortNum (); PortIndex++) {
+ if (PchUsbConfig->PortSettings[PortIndex].Location == PchUsbPortLocationInternalTopology) {
+ PchUsbConfig->PortSettings[PortIndex].Usb20EyeDiagramTuningParam1 = 5; // Internal Topology
+ } else if (PchUsbConfig->PortSettings[PortIndex].Location == PchUsbPortLocationDock) {
+ PchUsbConfig->PortSettings[PortIndex].Usb20EyeDiagramTuningParam1 = 4; // Dock
+ } else {
+ if (PchUsbConfig->PortSettings[PortIndex].Usb20PortLength < 0x70) {
+ PchUsbConfig->PortSettings[PortIndex].Usb20EyeDiagramTuningParam1 = 5; //Back Panel, less than 7"
+ } else {
+ PchUsbConfig->PortSettings[PortIndex].Usb20EyeDiagramTuningParam1 = 6; //Back Panel, 7" onward
+ }
+ }
+
+ if (PchUsbConfig->PortSettings[PortIndex].Location == PchUsbPortLocationInternalTopology) {
+ PchUsbConfig->PortSettings[PortIndex].Usb20EyeDiagramTuningParam2 = 2; // Internal Topology
+ } else if (PchUsbConfig->PortSettings[PortIndex].Location == PchUsbPortLocationDock) {
+ if (PchUsbConfig->PortSettings[PortIndex].Usb20PortLength < 0x50) {
+ PchUsbConfig->PortSettings[PortIndex].Usb20EyeDiagramTuningParam2 = 1; //Dock, less than 5"
+ } else {
+ PchUsbConfig->PortSettings[PortIndex].Usb20EyeDiagramTuningParam2 = 2; //Dock, 5" onward
+ }
+ } else {
+ if (PchUsbConfig->PortSettings[PortIndex].Usb20PortLength < 0x100) {
+ PchUsbConfig->PortSettings[PortIndex].Usb20EyeDiagramTuningParam2 = 2; //Back Panel, less than 10"
+ } else {
+ PchUsbConfig->PortSettings[PortIndex].Usb20EyeDiagramTuningParam2 = 3; //Back Panel, 10" onward
+ }
+ }
+ }
+ }
+ } else if (PchSeries == PchLp) {
+ for (PortIndex = 0; PortIndex < GetPchUsbMaxPhysicalPortNum (); PortIndex++) {
+ if ((PchUsbConfig->PortSettings[PortIndex].Location == PchUsbPortLocationBackPanel) ||
+ (PchUsbConfig->PortSettings[PortIndex].Location == PchUsbPortLocationMiniPciE)) {
+ if (PchUsbConfig->PortSettings[PortIndex].Usb20PortLength < 0x70) {
+ PchUsbConfig->PortSettings[PortIndex].Usb20EyeDiagramTuningParam1 = 5; //Back Panel, less than 7"
+ } else {
+ PchUsbConfig->PortSettings[PortIndex].Usb20EyeDiagramTuningParam1 = 6; //Back Panel, 7" onward
+ }
+ } else if (PchUsbConfig->PortSettings[PortIndex].Location == PchUsbPortLocationDock) {
+ PchUsbConfig->PortSettings[PortIndex].Usb20EyeDiagramTuningParam1 = 4; // Dock
+ } else {
+ PchUsbConfig->PortSettings[PortIndex].Usb20EyeDiagramTuningParam1 = 5; // Internal Topology
+ }
+
+ if ((PchUsbConfig->PortSettings[PortIndex].Location == PchUsbPortLocationBackPanel) ||
+ (PchUsbConfig->PortSettings[PortIndex].Location == PchUsbPortLocationMiniPciE)) {
+ if (PchUsbConfig->PortSettings[PortIndex].Usb20PortLength < 0x100) {
+ PchUsbConfig->PortSettings[PortIndex].Usb20EyeDiagramTuningParam2 = 2; //Back Panel, less than 10"
+ } else {
+ PchUsbConfig->PortSettings[PortIndex].Usb20EyeDiagramTuningParam2 = 3; //Back Panel, 10" onward
+ }
+ } else if (PchUsbConfig->PortSettings[PortIndex].Location == PchUsbPortLocationDock) {
+ if (PchUsbConfig->PortSettings[PortIndex].Usb20PortLength < 0x50) {
+ PchUsbConfig->PortSettings[PortIndex].Usb20EyeDiagramTuningParam2 = 1; //Dock, less than 5"
+ } else {
+ PchUsbConfig->PortSettings[PortIndex].Usb20EyeDiagramTuningParam2 = 2; //Dock, 5" onward
+ }
+ } else {
+ PchUsbConfig->PortSettings[PortIndex].Usb20EyeDiagramTuningParam2 = 2; // Internal Topology
+ }
+ }
+ }
+
+ return;
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/SampleCode/PchPolicyInit/Common/PchPolicyInitCommon.h b/ReferenceCode/Chipset/LynxPoint/SampleCode/PchPolicyInit/Common/PchPolicyInitCommon.h
new file mode 100644
index 0000000..daf1750
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SampleCode/PchPolicyInit/Common/PchPolicyInitCommon.h
@@ -0,0 +1,33 @@
+/** @file
+ Header file for Common PchPolicyInit Library
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _PCH_POLICY_INIT_COMMON_H_
+#define _PCH_POLICY_INIT_COMMON_H_
+
+/**
+ This function performs PCH USB Platform Policy initialzation
+
+ @param[in] UsbConfig Pointer to PCH_USB_CONFIG data buffer.
+
+ @retval NONE
+**/
+VOID
+InitPchUsbConfig (
+ IN PCH_USB_CONFIG *UsbConfig
+ );
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/SampleCode/PchPolicyInit/Dxe/PchPolicyInitDxe.c b/ReferenceCode/Chipset/LynxPoint/SampleCode/PchPolicyInit/Dxe/PchPolicyInitDxe.c
new file mode 100644
index 0000000..5deee40
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SampleCode/PchPolicyInit/Dxe/PchPolicyInitDxe.c
@@ -0,0 +1,490 @@
+/** @file
+ This file is SampleCode for Intel PCH DXE Platform Policy initialzation.
+
+@copyright
+ Copyright (c) 2009 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+#include "PchPolicyInitDxe.h"
+#include "..\Common\PchPolicyInitCommon.h"
+
+#define SW_SMI_BIOS_LOCK 0xA9
+#define PCI_CLASS_NETWORK 0x02
+#define PCI_CLASS_NETWORK_ETHERNET 0x00
+#define PCI_CLASS_NETWORK_OTHER 0x80
+
+DXE_PCH_PLATFORM_POLICY_PROTOCOL mPchPolicyData = { 0 };
+PCH_DEVICE_ENABLING mPchDeviceEnabling = { 0 };
+PCH_USB_CONFIG mPchUsbConfig = { 0 };
+PCH_PCI_EXPRESS_CONFIG mPchPciExpressConfig = { 0 };
+PCH_SATA_CONFIG mPchSataConfig = { 0 };
+PCH_AZALIA_CONFIG mPchAzaliaConfig = { 0 };
+PCH_SMBUS_CONFIG mPchSmbusConfig = { 0 };
+PCH_MISC_PM_CONFIG mPchMiscPmConfig = { 0 };
+PCH_IO_APIC_CONFIG mPchIoApicConfig = { 0 };
+PCH_DEFAULT_SVID_SID mPchDefaultSvidSid = { 0 };
+PCH_LOCK_DOWN_CONFIG mPchLockDownConfig = { 0 };
+PCH_THERMAL_CONFIG mPchThermalConfig = { 0 };
+PCH_LPC_HPET_CONFIG mPchHpetConfig = { 0 };
+PCH_LPC_SIRQ_CONFIG mSerialIrqConfig = { 0 };
+PCH_DMI_CONFIG mPchDmiConfig = { 0 };
+PCH_PWR_OPT_CONFIG mPchPwrOptConfig = { 0 };
+PCH_MISC_CONFIG mPchMiscConfig = { 0 };
+PCH_AUDIO_DSP_CONFIG mAudioDspConfig = { 0 };
+PCH_SERIAL_IO_CONFIG mSerialIoConfig = { 0 };
+
+UINT8 mSmbusRsvdAddresses[4] = {
+ 0xA0,
+ 0xA2,
+ 0xA4,
+ 0xA6
+};
+
+PCH_PCIE_DEVICE_ASPM_OVERRIDE mDevAspmOverride[] = {
+ //
+ // Intel PRO/Wireless
+ //
+ {0x8086, 0x422b, 0xff, 0xff, 0xff, PchPcieAspmL1, PchPcieL1L2Override, 0xFFFF, 0xFFFFFFFF},
+ {0x8086, 0x422c, 0xff, 0xff, 0xff, PchPcieAspmL1, PchPcieL1L2Override, 0xFFFF, 0xFFFFFFFF},
+ {0x8086, 0x4238, 0xff, 0xff, 0xff, PchPcieAspmL1, PchPcieL1L2Override, 0xFFFF, 0xFFFFFFFF},
+ {0x8086, 0x4239, 0xff, 0xff, 0xff, PchPcieAspmL1, PchPcieL1L2Override, 0xFFFF, 0xFFFFFFFF},
+ //
+ // Intel WiMAX/WiFi Link
+ //
+ {0x8086, 0x0082, 0xff, 0xff, 0xff, PchPcieAspmL1, PchPcieL1L2Override, 0xFFFF, 0xFFFFFFFF},
+ {0x8086, 0x0085, 0xff, 0xff, 0xff, PchPcieAspmL1, PchPcieL1L2Override, 0xFFFF, 0xFFFFFFFF},
+ {0x8086, 0x0083, 0xff, 0xff, 0xff, PchPcieAspmL1, PchPcieL1L2Override, 0xFFFF, 0xFFFFFFFF},
+ {0x8086, 0x0084, 0xff, 0xff, 0xff, PchPcieAspmL1, PchPcieL1L2Override, 0xFFFF, 0xFFFFFFFF},
+ {0x8086, 0x0086, 0xff, 0xff, 0xff, PchPcieAspmL1, PchPcieL1L2Override, 0xFFFF, 0xFFFFFFFF},
+ {0x8086, 0x0087, 0xff, 0xff, 0xff, PchPcieAspmL1, PchPcieL1L2Override, 0xFFFF, 0xFFFFFFFF},
+ {0x8086, 0x0088, 0xff, 0xff, 0xff, PchPcieAspmL1, PchPcieL1L2Override, 0xFFFF, 0xFFFFFFFF},
+ {0x8086, 0x0089, 0xff, 0xff, 0xff, PchPcieAspmL1, PchPcieL1L2Override, 0xFFFF, 0xFFFFFFFF},
+ {0x8086, 0x008F, 0xff, 0xff, 0xff, PchPcieAspmL1, PchPcieL1L2Override, 0xFFFF, 0xFFFFFFFF},
+ {0x8086, 0x0090, 0xff, 0xff, 0xff, PchPcieAspmL1, PchPcieL1L2Override, 0xFFFF, 0xFFFFFFFF},
+ //
+ // Intel Crane Peak WLAN NIC
+ //
+ {0x8086, 0x08AE, 0xff, PCI_CLASS_NETWORK, PCI_CLASS_NETWORK_OTHER, PchPcieAspmL1, PchPcieL1L2Override, 0xFFFF, 0xFFFFFFFF},
+ {0x8086, 0x08AF, 0xff, PCI_CLASS_NETWORK, PCI_CLASS_NETWORK_OTHER, PchPcieAspmL1, PchPcieL1L2Override, 0xFFFF, 0xFFFFFFFF},
+ //
+ // Intel Crane Peak w/BT WLAN NIC
+ //
+ {0x8086, 0x0896, 0xff, PCI_CLASS_NETWORK, PCI_CLASS_NETWORK_OTHER, PchPcieAspmL1, PchPcieL1L2Override, 0xFFFF, 0xFFFFFFFF},
+ {0x8086, 0x0897, 0xff, PCI_CLASS_NETWORK, PCI_CLASS_NETWORK_OTHER, PchPcieAspmL1, PchPcieL1L2Override, 0xFFFF, 0xFFFFFFFF},
+ //
+ // Intel Kelsey Peak WiFi, WiMax
+ //
+ {0x8086, 0x0885, 0xff, PCI_CLASS_NETWORK, PCI_CLASS_NETWORK_OTHER, PchPcieAspmL1, PchPcieL1L2Override, 0xFFFF, 0xFFFFFFFF},
+ {0x8086, 0x0886, 0xff, PCI_CLASS_NETWORK, PCI_CLASS_NETWORK_OTHER, PchPcieAspmL1, PchPcieL1L2Override, 0xFFFF, 0xFFFFFFFF},
+ //
+ // Intel Centrino Wireless-N 105
+ //
+ {0x8086, 0x0894, 0xff, PCI_CLASS_NETWORK, PCI_CLASS_NETWORK_OTHER, PchPcieAspmL1, PchPcieL1L2Override, 0xFFFF, 0xFFFFFFFF},
+ {0x8086, 0x0895, 0xff, PCI_CLASS_NETWORK, PCI_CLASS_NETWORK_OTHER, PchPcieAspmL1, PchPcieL1L2Override, 0xFFFF, 0xFFFFFFFF},
+ //
+ // Intel Centrino Wireless-N 135
+ //
+ {0x8086, 0x0892, 0xff, PCI_CLASS_NETWORK, PCI_CLASS_NETWORK_OTHER, PchPcieAspmL1, PchPcieL1L2Override, 0xFFFF, 0xFFFFFFFF},
+ {0x8086, 0x0893, 0xff, PCI_CLASS_NETWORK, PCI_CLASS_NETWORK_OTHER, PchPcieAspmL1, PchPcieL1L2Override, 0xFFFF, 0xFFFFFFFF},
+ //
+ // Intel Centrino Wireless-N 2200
+ //
+ {0x8086, 0x0890, 0xff, PCI_CLASS_NETWORK, PCI_CLASS_NETWORK_OTHER, PchPcieAspmL1, PchPcieL1L2Override, 0xFFFF, 0xFFFFFFFF},
+ {0x8086, 0x0891, 0xff, PCI_CLASS_NETWORK, PCI_CLASS_NETWORK_OTHER, PchPcieAspmL1, PchPcieL1L2Override, 0xFFFF, 0xFFFFFFFF},
+ //
+ // Intel Centrino Wireless-N 2230
+ //
+ {0x8086, 0x0887, 0xff, PCI_CLASS_NETWORK, PCI_CLASS_NETWORK_OTHER, PchPcieAspmL1, PchPcieL1L2Override, 0xFFFF, 0xFFFFFFFF},
+ {0x8086, 0x0888, 0xff, PCI_CLASS_NETWORK, PCI_CLASS_NETWORK_OTHER, PchPcieAspmL1, PchPcieL1L2Override, 0xFFFF, 0xFFFFFFFF},
+ //
+ // Intel Centrino Wireless-N 6235
+ //
+ {0x8086, 0x088E, 0xff, PCI_CLASS_NETWORK, PCI_CLASS_NETWORK_OTHER, PchPcieAspmL1, PchPcieL1L2Override, 0xFFFF, 0xFFFFFFFF},
+ {0x8086, 0x088F, 0xff, PCI_CLASS_NETWORK, PCI_CLASS_NETWORK_OTHER, PchPcieAspmL1, PchPcieL1L2Override, 0xFFFF, 0xFFFFFFFF},
+ //
+ // Intel CampPeak 2 Wifi
+ //
+ {0x8086, 0x08B5, 0xff, PCI_CLASS_NETWORK, PCI_CLASS_NETWORK_OTHER, PchPcieAspmL1, PchPcieL1L2Override, 0xFFFF, 0xFFFFFFFF},
+ {0x8086, 0x08B6, 0xff, PCI_CLASS_NETWORK, PCI_CLASS_NETWORK_OTHER, PchPcieAspmL1, PchPcieL1L2Override, 0xFFFF, 0xFFFFFFFF},
+ //
+ // Intel WilkinsPeak 1 Wifi
+ //
+ {0x8086, 0x08B3, 0xff, PCI_CLASS_NETWORK, PCI_CLASS_NETWORK_OTHER, PchPcieAspmL1, PchPcieL1L2AndL1SubstatesOverride, 0x0154, 0x00000003},
+ {0x8086, 0x08B3, 0xff, PCI_CLASS_NETWORK, PCI_CLASS_NETWORK_OTHER, PchPcieAspmL1, PchPcieL1SubstatesOverride, 0x0158, 0x00000003},
+ {0x8086, 0x08B4, 0xff, PCI_CLASS_NETWORK, PCI_CLASS_NETWORK_OTHER, PchPcieAspmL1, PchPcieL1L2AndL1SubstatesOverride, 0x0154, 0x00000003},
+ {0x8086, 0x08B4, 0xff, PCI_CLASS_NETWORK, PCI_CLASS_NETWORK_OTHER, PchPcieAspmL1, PchPcieL1SubstatesOverride, 0x0158, 0x00000003},
+ //
+ // Intel Wilkins Peak 2 Wifi
+ //
+ {0x8086, 0x08B1, 0xff, PCI_CLASS_NETWORK, PCI_CLASS_NETWORK_OTHER, PchPcieAspmL1, PchPcieL1L2AndL1SubstatesOverride, 0x0154, 0x00000003},
+ {0x8086, 0x08B1, 0xff, PCI_CLASS_NETWORK, PCI_CLASS_NETWORK_OTHER, PchPcieAspmL1, PchPcieL1SubstatesOverride, 0x0158, 0x00000003},
+ {0x8086, 0x08B2, 0xff, PCI_CLASS_NETWORK, PCI_CLASS_NETWORK_OTHER, PchPcieAspmL1, PchPcieL1L2AndL1SubstatesOverride, 0x0154, 0x00000003},
+ {0x8086, 0x08B2, 0xff, PCI_CLASS_NETWORK, PCI_CLASS_NETWORK_OTHER, PchPcieAspmL1, PchPcieL1SubstatesOverride, 0x0158, 0x00000003},
+ //
+ // Intel Wilkins Peak PF Wifi
+ //
+ {0x8086, 0x08B0, 0xff, PCI_CLASS_NETWORK, PCI_CLASS_NETWORK_OTHER, PchPcieAspmL1, PchPcieL1L2Override, 0xFFFF, 0xFFFFFFFF}
+
+};
+
+//
+// Function implementations
+//
+
+/**
+ Initilize Intel PCH DXE Platform Policy
+
+ @param[in] ImageHandle Image handle of this driver.
+ @param[in] SystemTable Global system service table.
+
+ @retval EFI_SUCCESS Initialization complete.
+ @exception EFI_UNSUPPORTED The chipset is unsupported by this driver.
+ @retval EFI_OUT_OF_RESOURCES Do not have enough resources to initialize the driver.
+ @retval EFI_DEVICE_ERROR Device error, driver exits abnormally.
+**/
+EFI_STATUS
+EFIAPI
+PchPolicyInitDxeEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_HANDLE Handle;
+ EFI_STATUS Status;
+ UINT8 PortIndex;
+ UINTN Index;
+ PCH_SERIES PchSeries;
+ PchSeries = GetPchSeries();
+ //
+ // General intialization
+ //
+ mPchPolicyData.Revision = DXE_PCH_PLATFORM_POLICY_PROTOCOL_REVISION_7;
+ mPchPolicyData.BusNumber = 0;
+
+ mPchPolicyData.DeviceEnabling = &mPchDeviceEnabling;
+ mPchPolicyData.UsbConfig = &mPchUsbConfig;
+ mPchPolicyData.PciExpressConfig = &mPchPciExpressConfig;
+ mPchPolicyData.SataConfig = &mPchSataConfig;
+ mPchPolicyData.AzaliaConfig = &mPchAzaliaConfig;
+ mPchPolicyData.SmbusConfig = &mPchSmbusConfig;
+ mPchPolicyData.MiscPmConfig = &mPchMiscPmConfig;
+ mPchPolicyData.IoApicConfig = &mPchIoApicConfig;
+ mPchPolicyData.DefaultSvidSid = &mPchDefaultSvidSid;
+ mPchPolicyData.LockDownConfig = &mPchLockDownConfig;
+ mPchPolicyData.ThermalConfig = &mPchThermalConfig;
+ mPchPolicyData.HpetConfig = &mPchHpetConfig;
+ mPchPolicyData.SerialIrqConfig = &mSerialIrqConfig;
+ mPchPolicyData.DmiConfig = &mPchDmiConfig;
+ mPchPolicyData.PwrOptConfig = &mPchPwrOptConfig;
+ mPchPolicyData.MiscConfig = &mPchMiscConfig;
+ mPchPolicyData.AudioDspConfig = &mAudioDspConfig;
+ mPchPolicyData.SerialIoConfig = &mSerialIoConfig;
+
+ ///
+ /// PCH BIOS Spec Rev 0.5.0 Section 3.6 Flash Security Recommendations,
+ /// Intel strongly recommends that BIOS sets the BIOS Interface Lock Down bit. Enabling this bit
+ /// will mitigate malicious software attempts to replace the system BIOS option ROM with its own code.
+ /// We always enable this as a platform policy.
+ ///
+ mPchLockDownConfig.BiosInterface = PCH_DEVICE_ENABLE;
+ mPchLockDownConfig.GlobalSmi = PCH_DEVICE_ENABLE;
+ mPchLockDownConfig.GpioLockDown = PCH_DEVICE_DISABLE;
+ mPchLockDownConfig.RtcLock = PCH_DEVICE_ENABLE;
+ ///
+ /// While BiosLock is enabled, BIOS can only be modified from SMM after ExitPmAuth.
+ ///
+ mPchLockDownConfig.BiosLock = PCH_DEVICE_DISABLE;
+ ///
+ /// If PchBiosLockIoTrapAddress is 0, BIOS will allocate available IO address with
+ /// 256 byte range from GCD and pass it to PchBiosLockIoTrapAddress.
+ ///
+ mPchLockDownConfig.PchBiosLockIoTrapAddress = 0;
+ ///
+ /// Initialize policy to default values when variable isn't found.
+ ///
+ mPchDeviceEnabling.Lan = PCH_DEVICE_ENABLE;
+ mPchDeviceEnabling.Azalia = 2;
+ mPchDeviceEnabling.Sata = PCH_DEVICE_ENABLE;
+ mPchDeviceEnabling.Smbus = PCH_DEVICE_ENABLE;
+ mPchDeviceEnabling.PciClockRun = PCH_DEVICE_ENABLE;
+ mPchDeviceEnabling.Display = 1;
+ mPchDeviceEnabling.Crid = PCH_DEVICE_DISABLE;
+ mPchDeviceEnabling.SerialIoDma = PCH_DEVICE_ENABLE;
+ mPchDeviceEnabling.SerialIoI2c0 = PCH_DEVICE_ENABLE;
+ mPchDeviceEnabling.SerialIoI2c1 = PCH_DEVICE_ENABLE;
+ mPchDeviceEnabling.SerialIoSpi0 = PCH_DEVICE_ENABLE;
+ mPchDeviceEnabling.SerialIoSpi1 = PCH_DEVICE_ENABLE;
+ mPchDeviceEnabling.SerialIoUart0 = PCH_DEVICE_ENABLE;
+ mPchDeviceEnabling.SerialIoUart1 = PCH_DEVICE_ENABLE;
+ mPchDeviceEnabling.SerialIoSdio = PCH_DEVICE_ENABLE;
+ mPchDeviceEnabling.AudioDsp = PCH_DEVICE_DISABLE;
+
+ ///
+ /// Init USB related setting
+ ///
+ InitPchUsbConfig (&mPchUsbConfig);
+
+ ///
+ /// PCI Express related settings from setup variable
+ ///
+ mPchPciExpressConfig.RootPortClockGating = PCH_DEVICE_ENABLE;
+ mPchPciExpressConfig.TempRootPortBusNumMin = 2;
+ mPchPciExpressConfig.TempRootPortBusNumMax = 4;
+
+ for (PortIndex = 0; PortIndex < GetPchMaxPciePortNum (); PortIndex++) {
+ mPchPciExpressConfig.RootPort[PortIndex].Enable = PCH_DEVICE_ENABLE;
+ mPchPciExpressConfig.RootPort[PortIndex].FunctionNumber = PortIndex;
+ mPchPciExpressConfig.RootPort[PortIndex].PhysicalSlotNumber = PortIndex;
+ mPchPciExpressConfig.RootPort[PortIndex].Aspm = 4;
+ mPchPciExpressConfig.RootPort[PortIndex].SlotImplemented = 1;
+ mPchPciExpressConfig.RootPort[PortIndex].L1Substates = 3;
+
+ }
+ mPchPciExpressConfig.RootPort[7].HotPlug = 1;
+ mPchPciExpressConfig.NumOfDevAspmOverride = sizeof (mDevAspmOverride) / sizeof (PCH_PCIE_DEVICE_ASPM_OVERRIDE);
+ mPchPciExpressConfig.DevAspmOverride = mDevAspmOverride;
+ mPchPciExpressConfig.EnableSubDecode = 0;
+ mPchPciExpressConfig.PchPcieSbdePort = 0;
+ mPchPciExpressConfig.RootPortFunctionSwapping = 1;
+
+ for (PortIndex = 0; PortIndex < GetPchMaxSataPortNum (); PortIndex++) {
+ mPchSataConfig.PortSettings[PortIndex].Enable = PCH_DEVICE_ENABLE;
+ mPchSataConfig.PortSettings[PortIndex].HotPlug = PCH_DEVICE_DISABLE;
+ mPchSataConfig.PortSettings[PortIndex].InterlockSw = PCH_DEVICE_DISABLE;
+ mPchSataConfig.PortSettings[PortIndex].External = PCH_DEVICE_DISABLE;
+ mPchSataConfig.PortSettings[PortIndex].SpinUp = PCH_DEVICE_DISABLE;
+ mPchSataConfig.PortSettings[PortIndex].SolidStateDrive = PCH_DEVICE_DISABLE;
+ mPchSataConfig.PortSettings[PortIndex].DevSlp = PCH_DEVICE_DISABLE;
+ mPchSataConfig.PortSettings[PortIndex].EnableDitoConfig = PCH_DEVICE_DISABLE;
+ mPchSataConfig.PortSettings[PortIndex].DmVal = 15;
+ mPchSataConfig.PortSettings[PortIndex].DitoVal = 625;
+ }
+
+ mPchSataConfig.RaidAlternateId = PCH_DEVICE_DISABLE;
+ mPchSataConfig.Raid0 = PCH_DEVICE_ENABLE;
+ mPchSataConfig.Raid1 = PCH_DEVICE_ENABLE;
+ mPchSataConfig.Raid10 = PCH_DEVICE_ENABLE;
+ mPchSataConfig.Raid5 = PCH_DEVICE_ENABLE;
+ mPchSataConfig.Irrt = PCH_DEVICE_ENABLE;
+ mPchSataConfig.OromUiBanner = PCH_DEVICE_ENABLE;
+ mPchSataConfig.HddUnlock = PCH_DEVICE_ENABLE;
+ mPchSataConfig.LedLocate = PCH_DEVICE_ENABLE;
+ mPchSataConfig.IrrtOnly = PCH_DEVICE_ENABLE;
+ mPchSataConfig.SmartStorage = PCH_DEVICE_ENABLE;
+ mPchSataConfig.OromUiDelay = PchSataOromDelay2sec;
+ mPchSataConfig.TestMode = PCH_DEVICE_DISABLE;
+ mPchSataConfig.SalpSupport = PCH_DEVICE_ENABLE;
+ mPchSataConfig.LegacyMode = PCH_DEVICE_DISABLE;
+ mPchSataConfig.SpeedSupport = PchSataSpeedSupportDefault;
+
+ ///
+ /// AzaliaConfig
+ ///
+ mPchAzaliaConfig.Pme = PCH_DEVICE_DISABLE;
+ mPchAzaliaConfig.ResetWaitTimer = 300;
+ mPchAzaliaConfig.DS = 1;
+ mPchAzaliaConfig.DA = 0;
+
+ ///
+ /// Reserved SMBus Address
+ ///
+ mPchSmbusConfig.NumRsvdSmbusAddresses = 4;
+ mPchSmbusConfig.RsvdSmbusAddressTable = mSmbusRsvdAddresses;
+
+ ///
+ /// MiscPm Configuration
+ ///
+ mPchMiscPmConfig.PchDeepSxPol = PchDeepSxPolDisable;
+ mPchMiscPmConfig.WakeConfig.PmeB0S5Dis = PCH_DEVICE_DISABLE;
+ mPchMiscPmConfig.WakeConfig.WolEnableOverride = PCH_DEVICE_DISABLE;
+ mPchMiscPmConfig.WakeConfig.Gp27WakeFromDeepSx = PCH_DEVICE_ENABLE;
+ mPchMiscPmConfig.WakeConfig.PcieWakeFromDeepSx = PCH_DEVICE_DISABLE;
+ mPchMiscPmConfig.PowerResetStatusClear.MeWakeSts = PCH_DEVICE_ENABLE;
+ mPchMiscPmConfig.PowerResetStatusClear.MeHrstColdSts = PCH_DEVICE_ENABLE;
+ mPchMiscPmConfig.PowerResetStatusClear.MeHrstWarmSts = PCH_DEVICE_ENABLE;
+
+ mPchMiscPmConfig.PchSlpS3MinAssert = PchSlpS350ms;
+ mPchMiscPmConfig.PchSlpS4MinAssert = PchSlpS44s;
+ mPchMiscPmConfig.PchSlpSusMinAssert = PchSlpSus4s;
+ mPchMiscPmConfig.PchSlpAMinAssert = PchSlpA2s;
+ mPchMiscPmConfig.PchPwrCycDur = 4; // 4-5 seconds (PCH default setting)
+ mPchMiscPmConfig.SlpStrchSusUp = PCH_DEVICE_DISABLE;
+ mPchMiscPmConfig.SlpLanLowDc = PCH_DEVICE_DISABLE;
+
+ ///
+ /// Io Apic configuration
+ ///
+ mPchIoApicConfig.BdfValid = 1;
+ mPchIoApicConfig.BusNumber = 0xF0;
+ mPchIoApicConfig.DeviceNumber = 0x1F;
+ mPchIoApicConfig.FunctionNumber = 0x00;
+ mPchIoApicConfig.IoApicEntry24_39 = PCH_DEVICE_ENABLE;
+
+ ///
+ /// Default Svid Sdid configuration
+ ///
+ mPchDefaultSvidSid.SubSystemVendorId = V_PCH_INTEL_VENDOR_ID;
+ mPchDefaultSvidSid.SubSystemId = V_PCH_DEFAULT_SID;
+
+ ///
+ /// Thermal configuration - Initialize policy to default values when variable isn't found.
+ ///
+ mPchThermalConfig.ThermalAlertEnable.TselLock = PCH_DEVICE_ENABLE;
+ mPchThermalConfig.ThermalAlertEnable.TscLock = PCH_DEVICE_ENABLE;
+ mPchThermalConfig.ThermalAlertEnable.TsmicLock = PCH_DEVICE_ENABLE;
+ mPchThermalConfig.ThermalAlertEnable.PhlcLock = PCH_DEVICE_ENABLE;
+ mPchThermalConfig.ThermalThrottling.TTLevels.SuggestedSetting = PCH_DEVICE_ENABLE;
+ mPchThermalConfig.ThermalThrottling.TTLevels.PchCrossThrottling = PCH_DEVICE_ENABLE;
+ mPchThermalConfig.ThermalThrottling.DmiHaAWC.SuggestedSetting = PCH_DEVICE_ENABLE;
+ mPchThermalConfig.ThermalThrottling.SataTT.SuggestedSetting = PCH_DEVICE_ENABLE;
+ mPchThermalConfig.ThermalDeviceEnable = PCH_DEVICE_DISABLE;
+ ///
+ /// The value in this field is valid only if it is between 00h and 17Fh.
+ /// 0x17F is the hottest temperature and 0x000 is the lowest temperature
+ ///
+ mPchThermalConfig.PchHotLevel = 0x000;
+
+ ///
+ /// HEPT Configuration
+ ///
+ mPchHpetConfig.BdfValid = 1;
+ for (Index = 0; Index < PCH_HPET_BDF_MAX; Index++) {
+ mPchHpetConfig.Hpet[Index].BusNumber = 0xF0;
+ mPchHpetConfig.Hpet[Index].DeviceNumber = 0x0F;
+ mPchHpetConfig.Hpet[Index].FunctionNumber = 0x00;
+ }
+ ///
+ /// Initialize Serial IRQ Config
+ ///
+ mSerialIrqConfig.SirqEnable = TRUE;
+ mSerialIrqConfig.StartFramePulse = PchSfpw4Clk;
+ mSerialIrqConfig.SirqMode = PchContinuousMode;
+
+ ///
+ /// DMI related settings
+ ///
+ mPchDmiConfig.DmiAspm = PCH_DEVICE_ENABLE;
+ mPchDmiConfig.DmiExtSync = PCH_DEVICE_DISABLE;
+ mPchDmiConfig.DmiIot = PCH_DEVICE_DISABLE;
+
+ ///
+ /// Power Optimizer related settings
+ ///
+ mPchPwrOptConfig.PchPwrOptDmi = PCH_DEVICE_ENABLE;
+ mPchPwrOptConfig.PchPwrOptGbe = PCH_DEVICE_ENABLE;
+ mPchPwrOptConfig.PchPwrOptXhci = PCH_DEVICE_DISABLE;
+ mPchPwrOptConfig.PchPwrOptEhci = PCH_DEVICE_DISABLE;
+ mPchPwrOptConfig.PchPwrOptSata = PCH_DEVICE_ENABLE;
+ mPchPwrOptConfig.MemCloseStateEn = PCH_DEVICE_ENABLE;
+ mPchPwrOptConfig.InternalObffEn = PCH_DEVICE_ENABLE;
+ mPchPwrOptConfig.ExternalObffEn = PCH_DEVICE_DISABLE; // De-feature OBFF from LPT-H/LPT-LP.
+ mPchPwrOptConfig.NumOfDevLtrOverride = 0;
+ mPchPwrOptConfig.DevLtrOverride = NULL;
+ for (PortIndex = 0; PortIndex < GetPchMaxPciePortNum (); PortIndex++) {
+ mPchPwrOptConfig.PchPwrOptPcie[PortIndex].LtrEnable = PCH_DEVICE_ENABLE;
+ //
+ // De-feature OBFF from LPT-H/LPT-LP.
+ // Doesn't enable Obff policy anymore.
+ //
+ mPchPwrOptConfig.PchPwrOptPcie[PortIndex].ObffEnable = PCH_DEVICE_DISABLE;
+ }
+ mPchPwrOptConfig.LegacyDmaDisable = PCH_DEVICE_DISABLE;
+ for (PortIndex = 0; PortIndex < GetPchMaxPciePortNum (); PortIndex++) {
+ if (PchSeries == PchLp) {
+ mPchPwrOptConfig.PchPwrOptPcie[PortIndex].LtrMaxSnoopLatency = 0x1003;
+ mPchPwrOptConfig.PchPwrOptPcie[PortIndex].LtrMaxNoSnoopLatency = 0x1003;
+ }
+ if (PchSeries == PchH) {
+ mPchPwrOptConfig.PchPwrOptPcie[PortIndex].LtrMaxSnoopLatency = 0x0846;
+ mPchPwrOptConfig.PchPwrOptPcie[PortIndex].LtrMaxNoSnoopLatency = 0x0846;
+ }
+ mPchPwrOptConfig.PchPwrOptPcie[PortIndex].LtrConfigLock = PCH_DEVICE_ENABLE;
+ mPchPwrOptConfig.PchPwrOptPcie[PortIndex].SnoopLatencyOverrideMode = 2;
+ mPchPwrOptConfig.PchPwrOptPcie[PortIndex].SnoopLatencyOverrideMultiplier = 2;
+ mPchPwrOptConfig.PchPwrOptPcie[PortIndex].SnoopLatencyOverrideValue = 60;
+ mPchPwrOptConfig.PchPwrOptPcie[PortIndex].NonSnoopLatencyOverrideMode = 2;
+ mPchPwrOptConfig.PchPwrOptPcie[PortIndex].NonSnoopLatencyOverrideMultiplier = 2;
+ mPchPwrOptConfig.PchPwrOptPcie[PortIndex].NonSnoopLatencyOverrideValue = 60;
+ }
+
+ ///
+ /// Misc. Config
+ ///
+ /// FviSmbiosType is the SMBIOS OEM type (0x80 to 0xFF) defined in SMBIOS Type 14 - Group
+ /// Associations structure - item type. FVI structure uses it as SMBIOS OEM type to provide
+ /// version information. The default value is type 221.
+ ///
+ mPchMiscConfig.FviSmbiosType = 0xDD;
+
+ ///
+ /// DCI (Direct Connect Interface) Configuration
+ ///
+ mPchMiscConfig.DciEn = PCH_DEVICE_DISABLE;
+
+ ///
+ /// Audio Dsp Configuration
+ ///
+ mAudioDspConfig.AudioDspD3PowerGating = PCH_DEVICE_ENABLE;
+ mAudioDspConfig.AudioDspAcpiMode = 1; //1: ACPI mode, 0: PCI mode
+ mAudioDspConfig.AudioDspAcpiInterruptMode = 1; //1: ACPI mode, 0: PCI mode
+ mAudioDspConfig.AudioDspBluetoothSupport = PCH_DEVICE_DISABLE; // Bluetooth SCO disabled
+
+ ///
+ /// Serial IO Configuration
+ ///
+ mSerialIoConfig.SerialIoMode = PchSerialIoIsAcpi;
+ switch(PchStepping()) {
+ default:
+ mSerialIoConfig.SerialIoInterruptMode = PchSerialIoIsAcpi;
+ break;
+ }
+ mSerialIoConfig.Ddr50Support = PCH_DEVICE_DISABLE;
+
+ mSerialIoConfig.I2c0VoltageSelect = PchSerialIoIs18V;
+ mSerialIoConfig.I2c1VoltageSelect = PchSerialIoIs33V;
+
+
+ ///
+ /// Update policy by platform setting
+ ///
+ UpdateDxePchPlatformPolicy (&mPchPolicyData);
+
+#ifdef USB_PRECONDITION_ENABLE_FLAG
+ ///
+ /// Update Precondition option for S4 resume.
+ /// Skip Precondition for S4 resume in case this boot may not connect BIOS USB driver.
+ /// If BIOS USB driver will be connected always for S4, then disable below update.
+ /// To keep consistency during boot, must enabled or disabled below function in both PEI and DXE
+ /// PlatformPolicyInit driver.
+ ///
+ if (mPchUsbConfig.UsbPrecondition == TRUE) {
+ if (GetBootModeHob () == BOOT_ON_S4_RESUME) {
+ mPchUsbConfig.UsbPrecondition = FALSE;
+ DEBUG ((EFI_D_INFO, "BootMode is BOOT_ON_S4_RESUME, disable Precondition\n"));
+ }
+ }
+#endif // USB_PRECONDITION_ENABLE_FLAG
+ Handle = NULL;
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &Handle,
+ &gDxePchPlatformPolicyProtocolGuid,
+ &mPchPolicyData,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ return Status;
+
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/SampleCode/PchPolicyInit/Dxe/PchPolicyInitDxe.dxs b/ReferenceCode/Chipset/LynxPoint/SampleCode/PchPolicyInit/Dxe/PchPolicyInitDxe.dxs
new file mode 100644
index 0000000..0140fb2
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SampleCode/PchPolicyInit/Dxe/PchPolicyInitDxe.dxs
@@ -0,0 +1,44 @@
+/** @file
+ Dependency expression source file.
+
+@copyright
+ Copyright (c) 2009 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "PeimDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+#endif
+#include EFI_ARCH_PROTOCOL_DEFINITION (Variable)
+#include EFI_PROTOCOL_DEFINITION (PlatformInfo)
+#include EFI_PROTOCOL_DEFINITION (CpuIo)
+
+DEPENDENCY_START
+ EFI_VARIABLE_ARCH_PROTOCOL_GUID AND
+ PLATFORM_INFO_PROTOCOL_GUID AND
+ EFI_CPU_IO_PROTOCOL_GUID
+DEPENDENCY_END \ No newline at end of file
diff --git a/ReferenceCode/Chipset/LynxPoint/SampleCode/PchPolicyInit/Dxe/PchPolicyInitDxe.h b/ReferenceCode/Chipset/LynxPoint/SampleCode/PchPolicyInit/Dxe/PchPolicyInitDxe.h
new file mode 100644
index 0000000..ae0cbae
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SampleCode/PchPolicyInit/Dxe/PchPolicyInitDxe.h
@@ -0,0 +1,56 @@
+/** @file
+ Header file for the PchPolicyInitDxe Driver.
+
+@copyright
+ Copyright (c) 2009 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _PCH_PLATFORM_POLICY_DXE_H_
+#define _PCH_PLATFORM_POLICY_DXE_H_
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include EFI_PROTOCOL_PRODUCER (PchPlatformPolicy)
+#include "PchAccess.h"
+#include "PchPlatformPolicyUpdateDxeLib.h"
+#include "PchPlatformLib.h"
+#endif
+
+//
+// Functions
+//
+
+/**
+ Initilize Intel PCH DXE Platform Policy
+
+ @param[in] ImageHandle Image handle of this driver.
+ @param[in, out] SystemTable Global system service table.
+
+ @retval EFI_SUCCESS Initialization complete.
+ @exception EFI_UNSUPPORTED The chipset is unsupported by this driver.
+ @retval EFI_OUT_OF_RESOURCES Do not have enough resources to initialize the driver.
+ @retval EFI_DEVICE_ERROR Device error, driver exits abnormally.
+**/
+EFI_STATUS
+EFIAPI
+PchPolicyInitDxeEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN OUT EFI_SYSTEM_TABLE *SystemTable
+ );
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/SampleCode/PchPolicyInit/Dxe/PchPolicyInitDxe.inf b/ReferenceCode/Chipset/LynxPoint/SampleCode/PchPolicyInit/Dxe/PchPolicyInitDxe.inf
new file mode 100644
index 0000000..3b883ab
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SampleCode/PchPolicyInit/Dxe/PchPolicyInitDxe.inf
@@ -0,0 +1,82 @@
+## @file
+# Component description file for the PchPolicyInitDxe DXE driver.
+#
+#@copyright
+# Copyright (c) 2009 - 2013 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = PchPolicyInitDxe
+FILE_GUID = 3BC42C6D-ABEC-41ba-8CCB-D8E0EF1CEF85
+COMPONENT_TYPE = BS_DRIVER
+
+[sources.common]
+ PchPolicyInitDxe.h
+ PchPolicyInitDxe.c
+ ../Common/PchPolicyInitCommon.c
+ ../Common/PchPolicyInitCommon.h
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueDxeDriverEntryPoint.c
+
+[includes.common]
+ .
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include/Pcd
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include/Library
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Cpu/Pentium/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Protocol/PchPlatformPolicy
+ $(PLATFORM_ECP_PACKAGE)/Include
+
+[libraries.common]
+ EdkIIGlueDxeReportStatusCodeLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkFrameworkProtocolLib
+ EdkIIGlueDxeHobLib
+ EdkProtocolLib
+ $(PROJECT_PCH_FAMILY)ProtocolLib
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ PlatformPolicyUpdateDxeLib
+ EdkIIGlueDxeServicesTableLib
+ PchPlatformLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = PchPolicyInitDxe.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=PchPolicyInitDxeEntryPoint
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_DXE_HOB_LIB__
diff --git a/ReferenceCode/Chipset/LynxPoint/SampleCode/PchPolicyInit/Pei/PchPolicyInitPei.c b/ReferenceCode/Chipset/LynxPoint/SampleCode/PchPolicyInit/Pei/PchPolicyInitPei.c
new file mode 100644
index 0000000..08e0cf7
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SampleCode/PchPolicyInit/Pei/PchPolicyInitPei.c
@@ -0,0 +1,250 @@
+/** @file
+ This file is SampleCode for Intel PCH PEI Platform Policy initialzation.
+
+@copyright
+ Copyright (c) 2009 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+#include "PchPolicyInitPei.h"
+#include "..\Common\PchPolicyInitCommon.h"
+#ifdef RAPID_START_FLAG
+#include "RapidStartCommonLib.h"
+#endif
+
+/**
+ This PEIM performs PCH PEI Platform Policy initialzation.
+
+ @param[in] FfsHeader Pointer to Firmware File System file header.
+ @param[in] PeiServices General purpose services available to every PEIM.
+
+ @retval EFI_SUCCESS The PPI is installed and initialized.
+ @retval EFI ERRORS The PPI is not successfully installed.
+ @retval EFI_OUT_OF_RESOURCES Do not have enough resources to initialize the driver
+**/
+EFI_STATUS
+EFIAPI
+PchPolicyInitPeiEntryPoint (
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_STATUS Status;
+ EFI_PEI_PPI_DESCRIPTOR *PchPlatformPolicyPpiDesc;
+ PCH_PLATFORM_POLICY_PPI *PchPlatformPolicyPpi;
+ PCH_GBE_CONFIG *GbeConfig;
+ PCH_THERMAL_MANAGEMENT *ThermalMgmt;
+ PCH_MEMORY_THROTTLING *MemoryThrottling;
+ PCH_HPET_CONFIG *HpetConfig;
+ PCH_SATA_CONTROL *SataConfig;
+ PCH_SATA_TRACE_CONFIG *SataTraceConfig;
+ PCH_PCIE_CONFIG *PcieConfig;
+ PCH_IOAPIC_CONFIG *IoApicConfig;
+ PCH_PLATFORM_DATA *PlatformData;
+ PCH_USB_CONFIG *UsbConfig;
+#ifdef USB_PRECONDITION_ENABLE_FLAG
+ EFI_BOOT_MODE BootMode;
+#endif // USB_PRECONDITION_ENABLE_FLAG
+ UINT8 PortIndex;
+
+ PchPlatformPolicyPpiDesc = (EFI_PEI_PPI_DESCRIPTOR *) AllocateZeroPool (sizeof (EFI_PEI_PPI_DESCRIPTOR));
+ ASSERT (PchPlatformPolicyPpiDesc != NULL);
+ if (PchPlatformPolicyPpiDesc == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ PchPlatformPolicyPpi = (PCH_PLATFORM_POLICY_PPI *) AllocateZeroPool (sizeof (PCH_PLATFORM_POLICY_PPI));
+ ASSERT (PchPlatformPolicyPpi != NULL);
+ if (PchPlatformPolicyPpi == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ GbeConfig = (PCH_GBE_CONFIG *) AllocateZeroPool (sizeof (PCH_GBE_CONFIG));
+ ASSERT (GbeConfig != NULL);
+ if (GbeConfig == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ ThermalMgmt = (PCH_THERMAL_MANAGEMENT *) AllocateZeroPool (sizeof (PCH_THERMAL_MANAGEMENT));
+ ASSERT (ThermalMgmt != NULL);
+ if (ThermalMgmt == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ MemoryThrottling = (PCH_MEMORY_THROTTLING *) AllocateZeroPool (sizeof (PCH_MEMORY_THROTTLING));
+ ASSERT (MemoryThrottling != NULL);
+ if (MemoryThrottling == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ HpetConfig = (PCH_HPET_CONFIG *) AllocateZeroPool (sizeof (PCH_HPET_CONFIG));
+ ASSERT (HpetConfig != NULL);
+ if (HpetConfig == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ SataConfig = (PCH_SATA_CONTROL *) AllocateZeroPool (sizeof (PCH_SATA_CONTROL));
+ ASSERT (SataConfig != NULL);
+ if (SataConfig == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ SataTraceConfig = (PCH_SATA_TRACE_CONFIG *) AllocateZeroPool (sizeof (PCH_SATA_TRACE_CONFIG));
+ ASSERT (SataTraceConfig != NULL);
+ if (SataTraceConfig == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ PcieConfig = (PCH_PCIE_CONFIG *) AllocateZeroPool (sizeof (PCH_PCIE_CONFIG));
+ ASSERT (PcieConfig != NULL);
+ if (PcieConfig == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ IoApicConfig = (PCH_IOAPIC_CONFIG *) AllocateZeroPool (sizeof (PCH_IOAPIC_CONFIG));
+ ASSERT (IoApicConfig != NULL);
+ if (IoApicConfig == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ PlatformData = (PCH_PLATFORM_DATA *) AllocateZeroPool (sizeof (PCH_PLATFORM_DATA));
+ ASSERT (PlatformData != NULL);
+ if (PlatformData == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ UsbConfig = (PCH_USB_CONFIG *) AllocateZeroPool (sizeof (PCH_USB_CONFIG));
+ ASSERT (UsbConfig != NULL);
+ if (UsbConfig == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ PchPlatformPolicyPpi->Revision = PCH_PLATFORM_POLICY_PPI_REVISION_4;
+ PchPlatformPolicyPpi->BusNumber = 0;
+ PchPlatformPolicyPpi->Rcba = PCH_LPC_RCBA_BASE_ADDRESS;
+ PchPlatformPolicyPpi->PmBase = PCH_LPC_ACPI_BASE_ADDRESS;
+ PchPlatformPolicyPpi->GpioBase = PCH_LPC_GPIO_BASE_ADDRESS;
+ PchPlatformPolicyPpi->Port80Route = 0;
+
+ PchPlatformPolicyPpi->GbeConfig = GbeConfig;
+ PchPlatformPolicyPpi->ThermalMgmt = ThermalMgmt;
+ PchPlatformPolicyPpi->HpetConfig = HpetConfig;
+ PchPlatformPolicyPpi->SataConfig = SataConfig;
+ PchPlatformPolicyPpi->PcieConfig = PcieConfig;
+ PchPlatformPolicyPpi->IoApicConfig = IoApicConfig;
+ PchPlatformPolicyPpi->PlatformData = PlatformData;
+ PchPlatformPolicyPpi->UsbConfig = UsbConfig;
+
+ GbeConfig->EnableGbe = 1;
+ ThermalMgmt->MemoryThrottling = MemoryThrottling;
+ MemoryThrottling->Enable = PCH_DEVICE_DISABLE;
+ MemoryThrottling->TsGpioPinSetting[TsGpioC].PmsyncEnable = PCH_DEVICE_ENABLE;
+ MemoryThrottling->TsGpioPinSetting[TsGpioD].PmsyncEnable = PCH_DEVICE_ENABLE;
+ MemoryThrottling->TsGpioPinSetting[TsGpioC].C0TransmitEnable = PCH_DEVICE_ENABLE;
+ MemoryThrottling->TsGpioPinSetting[TsGpioD].C0TransmitEnable = PCH_DEVICE_ENABLE;
+ MemoryThrottling->TsGpioPinSetting[TsGpioC].PinSelection = 1;
+ MemoryThrottling->TsGpioPinSetting[TsGpioD].PinSelection = 0;
+
+ HpetConfig->Enable = 1;
+ HpetConfig->Base = PCH_HPET_BASE_ADDRESS;
+
+ SataConfig->SataMode = PchSataModeAhci;
+ SataConfig->SataTraceConfig = SataTraceConfig;
+
+ SataTraceConfig->TestMode = PCH_DEVICE_DISABLE;
+ for( PortIndex = 0; PortIndex < 6; PortIndex++ ) {
+ SataTraceConfig->PortRxEq[PortIndex].GenSpeed[0].Enable = PCH_DEVICE_DISABLE;
+ SataTraceConfig->PortRxEq[PortIndex].GenSpeed[1].Enable = PCH_DEVICE_DISABLE;
+ SataTraceConfig->PortRxEq[PortIndex].GenSpeed[2].Enable = PCH_DEVICE_DISABLE;
+ SataTraceConfig->PortRxEq[PortIndex].GenSpeed[0].RxEq = 0x0;
+ SataTraceConfig->PortRxEq[PortIndex].GenSpeed[1].RxEq = 0x0;
+ SataTraceConfig->PortRxEq[PortIndex].GenSpeed[2].RxEq = 0x0;
+ }
+
+ PcieConfig->PcieSpeed[0] = PchPcieAuto;
+ PcieConfig->PcieSpeed[1] = PchPcieAuto;
+ PcieConfig->PcieSpeed[2] = PchPcieAuto;
+ PcieConfig->PcieSpeed[3] = PchPcieAuto;
+ PcieConfig->PcieSpeed[4] = PchPcieAuto;
+ PcieConfig->PcieSpeed[5] = PchPcieAuto;
+ PcieConfig->PcieSpeed[6] = PchPcieAuto;
+ PcieConfig->PcieSpeed[7] = PchPcieAuto;
+
+ IoApicConfig->IoApicId = 0x02;
+ IoApicConfig->ApicRangeSelect = 0x00;
+ IoApicConfig->IoApicEntry24_39 = PCH_DEVICE_ENABLE;
+
+ PlatformData->EcPresent = 0;
+ ///
+ /// PlatformData->SmmBwp value directly depends on the value of CpuConfig->Pfat
+ /// (found in CpuPolicyInitPei.c file)
+ /// If CpuConfig->Pfat is set to 1 (enabled) then
+ /// PlatformData->SmmBwp has to be set to 1 (enabled)
+ /// This is a PFAT Security requirement that needs to be addressed
+ /// If CpuConfig->Pfat is set to 0 (disabled) then
+ /// PlatformData->SmmBwp value don't care, it can be set to either
+ /// 1 (enabled) or 0 (disabled) based on customer implementation
+ ///
+ PlatformData->SmmBwp = 0;
+
+ ///
+ /// Temporary Memory Base Address for PCI devices to be used to initialize MMIO registers.
+ /// Minimum size is 64KB bytes.
+ ///
+ PlatformData->TempMemBaseAddr = PCH_TEMP_MEM_BASE_ADDRESS;
+
+ ///
+ /// Init USB related setting
+ ///
+ InitPchUsbConfig (UsbConfig);
+
+ PchPlatformPolicyPpiDesc->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;
+ PchPlatformPolicyPpiDesc->Guid = &gPchPlatformPolicyPpiGuid;
+
+ UpdatePeiPchPlatformPolicy (PeiServices, PchPlatformPolicyPpi);
+#ifdef RAPID_START_FLAG
+ if (RapidStartResumeCheck () == TRUE) {
+ ///
+ /// This is RapidStart resume, skip the UsbPrecondition feature in PEI phase
+ ///
+ PchPlatformPolicyPpi->UsbConfig->UsbPrecondition = 0;
+ }
+#endif
+
+
+ PchPlatformPolicyPpiDesc->Ppi = PchPlatformPolicyPpi;
+#ifdef USB_PRECONDITION_ENABLE_FLAG
+ ///
+ /// Update Precondition option for S4 resume.
+ /// Skip Precondition for S4 resume in case this boot may not connect BIOS USB driver.
+ /// If BIOS USB driver will be connected always for S4, then disable below update.
+ /// To keep consistency during boot, must enabled or disabled below function in both PEI and DXE
+ /// PlatformPolicyInit driver.
+ ///
+ if (UsbConfig->UsbPrecondition == TRUE) {
+ (*PeiServices)->GetBootMode (PeiServices, &BootMode);
+ if (BootMode == BOOT_ON_S4_RESUME) {
+ UsbConfig->UsbPrecondition = FALSE;
+ DEBUG ((EFI_D_INFO, "BootMode is BOOT_ON_S4_RESUME, disable Precondition\n"));
+ }
+ }
+#endif // USB_PRECONDITION_ENABLE_FLAG
+
+ ///
+ /// Install PCH Platform Policy PPI
+ ///
+ Status = (**PeiServices).InstallPpi (PeiServices, PchPlatformPolicyPpiDesc);
+ ASSERT_EFI_ERROR (Status);
+
+ return Status;
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/SampleCode/PchPolicyInit/Pei/PchPolicyInitPei.dxs b/ReferenceCode/Chipset/LynxPoint/SampleCode/PchPolicyInit/Pei/PchPolicyInitPei.dxs
new file mode 100644
index 0000000..806a8d6
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SampleCode/PchPolicyInit/Pei/PchPolicyInitPei.dxs
@@ -0,0 +1,40 @@
+/** @file
+ Dependency expression source file.
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "PeimDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+#include EFI_PPI_DEPENDENCY (Variable)
+#endif
+
+DEPENDENCY_START
+ PEI_READ_ONLY_VARIABLE_ACCESS_PPI_GUID
+DEPENDENCY_END
diff --git a/ReferenceCode/Chipset/LynxPoint/SampleCode/PchPolicyInit/Pei/PchPolicyInitPei.h b/ReferenceCode/Chipset/LynxPoint/SampleCode/PchPolicyInit/Pei/PchPolicyInitPei.h
new file mode 100644
index 0000000..3d155b3
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SampleCode/PchPolicyInit/Pei/PchPolicyInitPei.h
@@ -0,0 +1,60 @@
+/** @file
+ Header file for the PchPeiPolicy PEIM.
+
+@copyright
+ Copyright (c) 2009 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _PCH_POLICY_INIT_PEI_H_
+#define _PCH_POLICY_INIT_PEI_H_
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#include EFI_PPI_PRODUCER (PchPlatformPolicy)
+#include "PchAccess.h"
+#include "PchPlatformPolicyUpdatePeiLib.h"
+#endif
+
+#define PCH_LPC_RCBA_BASE_ADDRESS 0xFED1C000
+#define PCH_LPC_ACPI_BASE_ADDRESS 0x1800
+#define PCH_LPC_GPIO_BASE_ADDRESS 0x800
+
+#define PCH_TEMP_MEM_BASE_ADDRESS 0xDFFF0000
+#define PCH_HPET_BASE_ADDRESS 0xFED00000
+
+//
+// Functions
+//
+
+/**
+ This PEIM performs PCH PEI Platform Policy initialzation.
+
+ @param[in] FfsHeader Pointer to Firmware File System file header.
+ @param[in] PeiServices General purpose services available to every PEIM.
+
+ @retval EFI_SUCCESS The PPI is installed and initialized.
+ @retval EFI ERRORS The PPI is not successfully installed.
+ @retval EFI_OUT_OF_RESOURCES Do not have enough resources to initialize the driver
+**/
+EFI_STATUS
+EFIAPI
+PchPolicyInitPeiEntryPoint (
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+ );
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/SampleCode/PchPolicyInit/Pei/PchPolicyInitPei.inf b/ReferenceCode/Chipset/LynxPoint/SampleCode/PchPolicyInit/Pei/PchPolicyInitPei.inf
new file mode 100644
index 0000000..37ab29d
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SampleCode/PchPolicyInit/Pei/PchPolicyInitPei.inf
@@ -0,0 +1,87 @@
+## @file
+# Component description file for the PchPolicyInitPei PEIM.
+#
+#@copyright
+# Copyright (c) 2009 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = PchPolicyInitPei
+FILE_GUID = 20596BCC-EF0D-4772-AB71-C5102620A013
+COMPONENT_TYPE = PE32_PEIM
+
+[sources.common]
+ PchPolicyInitPei.h
+ PchPolicyInitPei.c
+ ../Common/PchPolicyInitCommon.c
+ ../Common/PchPolicyInitCommon.h
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGluePeimEntryPoint.c
+
+[includes.common]
+ .
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Ppi/PchPlatformPolicy
+ $(EFI_SOURCE)/$(PROJECT_RAPID_START_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_RAPID_START_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_RAPID_START_ROOT)/Samplecode/Library/RapidStartCommonLib
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Pei/Include
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(PLATFORM_ECP_PACKAGE)/Include
+
+[libraries.common]
+ $(PROJECT_PCH_FAMILY)PpiLib
+ EdkFrameworkPpiLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueBaseMemoryLib
+ EdkIIGluePeiDebugLibReportStatusCode
+ EdkIIGluePeiReportStatusCodeLib
+ EdkIIGluePeiServicesLib
+ EdkIIGluePeiMemoryAllocationLib
+ EdkPpiLib
+ PlatformPolicyUpdatePeiLib
+ RapidStartCommonLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = PchPolicyInitPei.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=PchPolicyInitPeiEntryPoint
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_PEI_SERVICES_LIB__ \
+ -D __EDKII_GLUE_PEI_MEMORY_ALLOCATION_LIB__
diff --git a/ReferenceCode/Chipset/LynxPoint/SampleCode/PchSampleCode.cif b/ReferenceCode/Chipset/LynxPoint/SampleCode/PchSampleCode.cif
new file mode 100644
index 0000000..f3282bf
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SampleCode/PchSampleCode.cif
@@ -0,0 +1,34 @@
+<component>
+ name = "PchSampleCode"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\SampleCode\"
+ RefName = "PchSampleCode"
+[files]
+"Ppi\SmbusPolicy\SmbusPolicy.h"
+"Ppi\UsbController\UsbController.h"
+"Guid\SmbusArpMap\SmbusArpMap.h"
+"Protocol\SmmSmbus\SmmSmbus.h"
+"PchPolicyInit\Pei\PchPolicyInitPei.dxs"
+"PchPolicyInit\Pei\PchPolicyInitPei.c"
+"PchPolicyInit\Pei\PchPolicyInitPei.h"
+"PchPolicyInit\Pei\PchPolicyInitPei.inf"
+"PchPolicyInit\Dxe\PchPolicyInitDxe.dxs"
+"PchPolicyInit\Dxe\PchPolicyInitDxe.c"
+"PchPolicyInit\Dxe\PchPolicyInitDxe.h"
+"PchPolicyInit\Dxe\PchPolicyInitDxe.inf"
+"BiosWriteProtect\Smm\PchBiosWriteProtect.c"
+"BiosWriteProtect\Smm\PchBiosWriteProtect.dxs"
+"BiosWriteProtect\Smm\PchBiosWriteProtect.h"
+"BiosWriteProtect\Smm\PchBiosWriteProtect.inf"
+"Include\Acpi3_0.h"
+"Include\PchAslUpdateLib.h"
+"PchPolicyInit\Common\PchPolicyInitCommon.c"
+"PchPolicyInit\Common\PchPolicyInitCommon.h"
+"AcpiTables\Dsdt\SerialIoDevices.asl"
+"AcpiTables\Dsdt\Sensor.asl"
+"Ppi\IntelPchSampleCodePpiLib.inf"
+"Ppi\SmmAccess\SmmAccess.c"
+"Ppi\SmmAccess\SmmAccess.h"
+[parts]
+"PchAslUpdateLib"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/SampleCode/Ppi/IntelPchSampleCodePpiLib.inf b/ReferenceCode/Chipset/LynxPoint/SampleCode/Ppi/IntelPchSampleCodePpiLib.inf
new file mode 100644
index 0000000..b72ede5
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SampleCode/Ppi/IntelPchSampleCodePpiLib.inf
@@ -0,0 +1,45 @@
+## @file
+# Component description file for the PEI protocol library
+#
+#@copyright
+# Copyright (c) 2015 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+
+[defines]
+BASE_NAME = IntelPchSampleCodePpiLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ SmmAccess/SmmAccess.h
+ SmmAccess/SmmAccess.c
+
+[includes.common]
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Pei/Include
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/SampleCode
+
+[nmake.common]
+C_STD_INCLUDE=
diff --git a/ReferenceCode/Chipset/LynxPoint/SampleCode/Ppi/SmbusPolicy/SmbusPolicy.h b/ReferenceCode/Chipset/LynxPoint/SampleCode/Ppi/SmbusPolicy/SmbusPolicy.h
new file mode 100644
index 0000000..b43803b
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SampleCode/Ppi/SmbusPolicy/SmbusPolicy.h
@@ -0,0 +1,38 @@
+/** @file
+ Smbus Policy PPI as defined in EFI 2.0
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains 'Framework Code' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may not be modified, except as allowed by
+ additional terms of your license agreement.
+**/
+#ifndef _PEI_SMBUS_POLICY_PPI_H
+#define _PEI_SMBUS_POLICY_PPI_H
+
+#define PEI_SMBUS_POLICY_PPI_GUID \
+ { \
+ 0x63b6e435, 0x32bc, 0x49c6, 0x81, 0xbd, 0xb7, 0xa1, 0xa0, 0xfe, 0x1a, 0x6c \
+ }
+
+EFI_FORWARD_DECLARATION (PEI_SMBUS_POLICY_PPI);
+
+struct _PEI_SMBUS_POLICY_PPI {
+ UINTN BaseAddress;
+ UINT32 PciAddress;
+ UINT8 NumRsvdAddress;
+ UINT8 *RsvdAddress;
+};
+
+extern EFI_GUID gPeiSmbusPolicyPpiGuid;
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/SampleCode/Ppi/SmmAccess/SmmAccess.c b/ReferenceCode/Chipset/LynxPoint/SampleCode/Ppi/SmmAccess/SmmAccess.c
new file mode 100644
index 0000000..85ab194
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SampleCode/Ppi/SmmAccess/SmmAccess.c
@@ -0,0 +1,25 @@
+/** @file
+ SmmAccess PPI GUID
+
+@copyright
+ Copyright (c) 2015 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains 'Framework Code' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may not be modified, except as allowed by
+ additional terms of your license agreement.
+**/
+#include "Tiano.h"
+#include "Pei.h"
+#include EFI_PPI_DEFINITION (SmmAccess)
+
+EFI_GUID gPeiSmmAccessPpiGuid = PEI_SMM_ACCESS_PPI_GUID;
+
+EFI_GUID_STRING(&gPeiSmmAccessPpiGuid, "SmmAccess", "SMM Access PPI");
diff --git a/ReferenceCode/Chipset/LynxPoint/SampleCode/Ppi/SmmAccess/SmmAccess.h b/ReferenceCode/Chipset/LynxPoint/SampleCode/Ppi/SmmAccess/SmmAccess.h
new file mode 100644
index 0000000..4873b1a
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SampleCode/Ppi/SmmAccess/SmmAccess.h
@@ -0,0 +1,136 @@
+/** @file
+ This code abstracts the PEI core to provide SmmAccess services.
+
+@copyright
+ Copyright (c) 2015 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains 'Framework Code' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may not be modified, except as allowed by
+ additional terms of your license agreement.
+**/
+#ifndef _PEI_SMM_ACCESS_PPI_H_
+#define _PEI_SMM_ACCESS_PPI_H_
+
+#include EFI_GUID_DEFINITION (SmramMemoryReserve)
+
+#define PEI_SMM_ACCESS_PPI_GUID \
+ { \
+ 0x268f33a9, 0xcccd, 0x48be, 0x88, 0x17, 0x86, 0x5, 0x3a, 0xc3, 0x2e, 0xd6 \
+ }
+
+EFI_FORWARD_DECLARATION (PEI_SMM_ACCESS_PPI);
+
+typedef
+EFI_STATUS
+(EFIAPI *PEI_SMM_OPEN) (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_SMM_ACCESS_PPI * This,
+ IN UINTN DescriptorIndex
+ )
+/**
+ This routine accepts a request to "open" a region of SMRAM. The
+ region could be legacy ABSEG, HSEG, or TSEG near top of physical memory.
+ The use of "open" means that the memory is visible from all PEIM
+ and SMM agents.
+
+ @param[in] This - Pointer to the SMM Access Interface.
+ @param[in] DescriptorIndex - Region of SMRAM to Open.
+
+ @retval EFI_SUCCESS - The region was successfully opened.
+ @retval EFI_DEVICE_ERROR - The region could not be opened because locked by
+ chipset.
+ @retval EFI_INVALID_PARAMETER - The descriptor index was out of bounds.
+**/
+;
+
+typedef
+EFI_STATUS
+(EFIAPI *PEI_SMM_CLOSE) (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_SMM_ACCESS_PPI * This,
+ IN UINTN DescriptorIndex
+ )
+/**
+ This routine accepts a request to "close" a region of SMRAM. The
+ region could be legacy AB or TSEG near top of physical memory.
+ The use of "close" means that the memory is only visible from SMM agents,
+ not from PEIM.
+
+ @param[in] This - Pointer to the SMM Access Interface.
+ @param[in] DescriptorIndex - Region of SMRAM to Close.
+
+ @retval EFI_SUCCESS - The region was successfully closed.
+ @retval EFI_DEVICE_ERROR - The region could not be closed because locked by
+ chipset.
+ @retval EFI_INVALID_PARAMETER - The descriptor index was out of bounds.
+**/
+;
+
+typedef
+EFI_STATUS
+(EFIAPI *PEI_SMM_LOCK) (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_SMM_ACCESS_PPI * This,
+ IN UINTN DescriptorIndex
+ )
+/**
+ This routine accepts a request to "lock" SMRAM. The
+ region could be legacy AB or TSEG near top of physical memory.
+ The use of "lock" means that the memory can no longer be opened
+ to PEIM.
+
+ @param[in] This - Pointer to the SMM Access Interface.
+ @param[in] DescriptorIndex - Region of SMRAM to Lock.
+
+ @retval EFI_SUCCESS - The region was successfully locked.
+ @retval EFI_DEVICE_ERROR - The region could not be locked because at least
+ one range is still open.
+ @retval EFI_INVALID_PARAMETER - The descriptor index was out of bounds.
+**/
+;
+
+typedef
+EFI_STATUS
+(EFIAPI *PEI_SMM_CAPABILITIES) (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_SMM_ACCESS_PPI * This,
+ IN OUT UINTN *SmramMapSize,
+ IN OUT EFI_SMRAM_DESCRIPTOR * SmramMap
+ )
+/**
+ This routine services a user request to discover the SMRAM
+ capabilities of this platform. This will report the possible
+ ranges that are possible for SMRAM access, based upon the
+ memory controller capabilities.
+
+ @param[in] This - Pointer to the SMRAM Access Interface.
+ @param[in] SmramMapSize - Pointer to the variable containing size of the
+ buffer to contain the description information.
+ @param[in] SmramMap - Buffer containing the data describing the Smram
+ region descriptors.
+
+ @retval EFI_BUFFER_TOO_SMALL - The user did not provide a sufficient buffer.
+ @retval EFI_SUCCESS - The user provided a sufficiently-sized buffer.
+**/
+;
+
+struct _PEI_SMM_ACCESS_PPI {
+ PEI_SMM_OPEN Open;
+ PEI_SMM_CLOSE Close;
+ PEI_SMM_LOCK Lock;
+ PEI_SMM_CAPABILITIES GetCapabilities;
+ BOOLEAN LockState;
+ BOOLEAN OpenState;
+};
+
+extern EFI_GUID gPeiSmmAccessPpiGuid;
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/SampleCode/Ppi/UsbController/UsbController.h b/ReferenceCode/Chipset/LynxPoint/SampleCode/Ppi/UsbController/UsbController.h
new file mode 100644
index 0000000..2fec82f
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SampleCode/Ppi/UsbController/UsbController.h
@@ -0,0 +1,49 @@
+/** @file
+ Usb Controller PPI as defined in EFI 2.0
+
+ This code abstracts the PEI core to provide Usb Controller Info from Chipset.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains 'Framework Code' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may not be modified, except as allowed by
+ additional terms of your license agreement.
+**/
+#ifndef _PEI_USB_CONTROLLER_PPI_H_
+#define _PEI_USB_CONTROLLER_PPI_H_
+
+#define PEI_USB_CONTROLLER_PPI_GUID \
+ { \
+ 0x3bc1f6de, 0x693e, 0x4547, 0xa3, 0x0, 0x21, 0x82, 0x3c, 0xa4, 0x20, 0xb2 \
+ }
+
+#define PEI_EHCI_CONTROLLER 0x03
+
+EFI_FORWARD_DECLARATION (PEI_USB_CONTROLLER_PPI);
+
+typedef
+EFI_STATUS
+(EFIAPI *PEI_GET_USB_CONTROLLER) (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_CONTROLLER_PPI *This,
+ IN UINT8 UsbControllerId,
+ OUT UINTN *ControllerType,
+ OUT UINTN *BaseAddress
+ );
+
+struct _PEI_USB_CONTROLLER_PPI {
+ PEI_GET_USB_CONTROLLER GetUsbController;
+};
+
+extern EFI_GUID gPeiUsbControllerPpiGuid;
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/SampleCode/Protocol/SmmSmbus/SmmSmbus.h b/ReferenceCode/Chipset/LynxPoint/SampleCode/Protocol/SmmSmbus/SmmSmbus.h
new file mode 100644
index 0000000..8b792ac
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SampleCode/Protocol/SmmSmbus/SmmSmbus.h
@@ -0,0 +1,50 @@
+/** @file
+ SmmSmbus Protocol
+
+@copyright
+ Copyright (c) 2009 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef __EFI_SMM_SMBUS_PROTOCOL_H__
+#define __EFI_SMM_SMBUS_PROTOCOL_H__
+
+///
+/// GUID for the SmmSmbus Protocol
+///
+/// EDK and EDKII have different GUID formats
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+
+#define EFI_SMM_SMBUS_PROTOCOL_GUID \
+ { \
+ 0x72e40094, 0x2ee1, 0x497a, 0x8f, 0x33, 0x4c, 0x93, 0x4a, 0x9e, 0x9c, 0xc \
+ }
+#else
+#define EFI_SMM_SMBUS_PROTOCOL_GUID \
+ { \
+ 0x72e40094, 0x2ee1, 0x497a, \
+ { \
+ 0x8f, 0x33, 0x4c, 0x93, 0x4a, 0x9e, 0x9c, 0xc \
+ } \
+ }
+
+#endif
+//
+// Resuse the DXE definition, and use another GUID.
+//
+typedef EFI_SMBUS_HC_PROTOCOL SMM_SMBUS_HC_PROTOCOL;
+
+extern EFI_GUID gEfiSmmSmbusProtocolGuid;
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/SataController/Dxe/SataController.c b/ReferenceCode/Chipset/LynxPoint/SataController/Dxe/SataController.c
new file mode 100644
index 0000000..c53575c
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SataController/Dxe/SataController.c
@@ -0,0 +1,943 @@
+/** @file
+ This driver module produces IDE_CONTROLLER_INIT protocol for serial ATA
+ driver and will be used by IDE Bus driver to support chipset dependent timing
+ information, config SATA control/status registers. This driver
+ is responsible for early initialization of serial ATA controller.
+
+ Serial ATA spec requires SATA controller compatible with parallel IDE
+ controller. That's why lots of code here is the same with IDE controller
+ driver. However, We need this driver to optimize timing settings for SATA
+ device and set SATA config/error/status registers.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part o f this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "SataController.h"
+
+///
+/// SATA controller Driver GUID
+///
+EFI_GUID gSataControllerDriverGuid = PCH_SATA_CONTROLLER_DRIVER_GUID;
+
+///
+/// EFI_DRIVER_BINDING_PROTOCOL instance
+///
+EFI_DRIVER_BINDING_PROTOCOL mSataControllerDriverBinding = {
+ SataControllerSupported,
+ SataControllerStart,
+ SataControllerStop,
+ 0x10,
+ NULL,
+ NULL
+};
+
+//
+// Internal function definitions
+//
+EFI_STATUS
+CalculateBestPioMode (
+ IN EFI_IDENTIFY_DATA * IdentifyData,
+ IN UINT16 *DisPioMode OPTIONAL,
+ OUT UINT16 *SelectedMode
+ );
+
+EFI_STATUS
+CalculateBestUdmaMode (
+ IN EFI_IDENTIFY_DATA * IdentifyData,
+ IN UINT16 *DisUDmaMode OPTIONAL,
+ OUT UINT16 *SelectedMode
+ );
+
+/**
+ Chipset SATA Driver EntryPoint function. It follows the standard EFI driver
+ model. It's called by StartImage() of DXE Core
+
+ @param[in] ImageHandle While the driver image loaded be the ImageLoader(),
+ an image handle is assigned to this driver binary,
+ all activities of the driver is tied to this ImageHandle
+ @param[in] SystemTable A pointer to the system table, for all BS(Boo Services) and
+ RT(Runtime Services)
+
+ @retval EFI_SUCCESS Function completes successfully
+**/
+EFI_STATUS
+EFIAPI
+InitializeSataControllerDriver (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ return EFI_SUCCESS;
+}
+
+/**
+ This function checks to see if the driver supports a device specified by
+ "Controller handle" parameter. It is called by DXE Core StartImage() or
+ ConnectController() routines. The driver uses 'device path' and/or
+ 'services' from the Bus I/O abstraction attached to the controller handle
+ to determine if the driver support this controller handle.
+ Note: In the BDS (Boot Device Selection) phase, the DXE core enumerate all
+ devices (or, controller) and assigns GUIDs to them.
+
+ @param[in] This A pointer points to the Binding Protocol instance
+ @param[in] Controller The handle of controller to be tested.
+ @param[in] RemainingDevicePath A pointer to the device path. Ignored by device
+ driver but used by bus driver
+
+ @retval EFI_SUCCESS The device is supported
+ @exception EFI_UNSUPPORTED The device is not supported
+**/
+EFI_STATUS
+EFIAPI
+SataControllerSupported (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE Controller,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
+ )
+{
+ EFI_STATUS Status;
+ UINT32 SataDeviceIdFound;
+ EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
+ EFI_PCI_IO_PROTOCOL *PciIo;
+ PCI_TYPE00 PciData;
+
+ ///
+ /// SATA Controller is a device driver, and should ingore the
+ /// "RemainingDevicePath" according to EFI spec
+ ///
+ Status = gBS->OpenProtocol (
+ Controller,
+ &gEfiDevicePathProtocolGuid,
+ (VOID *) &ParentDevicePath,
+ This->DriverBindingHandle,
+ Controller,
+ EFI_OPEN_PROTOCOL_BY_DRIVER
+ );
+ if (EFI_ERROR (Status)) {
+ ///
+ /// EFI_ALREADY_STARTED is also an error
+ ///
+ return Status;
+ }
+ ///
+ /// Close the protocol because we don't use it here
+ ///
+ gBS->CloseProtocol (
+ Controller,
+ &gEfiDevicePathProtocolGuid,
+ This->DriverBindingHandle,
+ Controller
+ );
+
+ ///
+ /// Now test the EfiPciIoProtocol
+ ///
+ Status = gBS->OpenProtocol (
+ Controller,
+ &gEfiPciIoProtocolGuid,
+ (VOID **) &PciIo,
+ This->DriverBindingHandle,
+ Controller,
+ EFI_OPEN_PROTOCOL_BY_DRIVER
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ ///
+ /// Now further check the PCI header: Base class (offset 0x0B) and
+ /// Sub Class (offset 0x0A). This controller should be an SATA controller
+ ///
+ Status = PciIo->Pci.Read (
+ PciIo,
+ EfiPciIoWidthUint8,
+ 0,
+ sizeof (PciData),
+ &PciData
+ );
+ if (EFI_ERROR (Status)) {
+ gBS->CloseProtocol (
+ Controller,
+ &gEfiPciIoProtocolGuid,
+ This->DriverBindingHandle,
+ Controller
+ );
+ return EFI_UNSUPPORTED;
+ }
+ ///
+ /// Since we already got the PciData, we can close protocol to avoid to carry it on for multiple exit points.
+ ///
+ gBS->CloseProtocol (
+ Controller,
+ &gEfiPciIoProtocolGuid,
+ This->DriverBindingHandle,
+ Controller
+ );
+
+ ///
+ /// Examine SATA PCI Configuration table fields
+ ///
+ SataDeviceIdFound = FALSE;
+ ///
+ /// When found is storage device and provided by Intel then detect for right device Ids
+ ///
+ if (PciData.Hdr.VendorId == V_PCH_SATA_VENDOR_ID) {
+ if ((PciData.Hdr.ClassCode[2] == PCI_CLASS_MASS_STORAGE)) {
+ if ((PciData.Hdr.ClassCode[1] == V_PCH_SATA_SUB_CLASS_CODE_IDE)) {
+ if (IS_PCH_LPT_SATA_IDE_DEVICE_ID (PciData.Hdr.DeviceId)) {
+ SataDeviceIdFound = TRUE;
+ }
+ }
+
+ if (PciData.Hdr.ClassCode[1] == V_PCH_SATA_SUB_CLASS_CODE_AHCI) {
+ if (IS_PCH_LPT_SATA_AHCI_DEVICE_ID (PciData.Hdr.DeviceId)) {
+ SataDeviceIdFound = TRUE;
+ }
+ }
+
+ if (PciData.Hdr.ClassCode[1] == V_PCH_SATA_SUB_CLASS_CODE_RAID) {
+ if (IS_PCH_LPT_SATA_RAID_DEVICE_ID (PciData.Hdr.DeviceId)) {
+ SataDeviceIdFound = TRUE;
+ }
+ }
+ }
+ }
+
+ if (!SataDeviceIdFound) {
+ return EFI_UNSUPPORTED;
+ }
+
+ return Status;
+}
+
+/**
+ This routine is called right after the .Supported() is called and returns
+ EFI_SUCCESS. Notes: The supported protocols are checked but the Protocols
+ are closed.
+
+ @param[in] This A pointer points to the Binding Protocol instance
+ @param[in] Controller The handle of controller to be tested. Parameter
+ passed by the caller
+ @param[in] RemainingDevicePath A pointer to the device path. Should be ignored by
+ device driver
+
+ @retval EFI_SUCCESS The device is started
+ @retval Other values Something error happened
+**/
+EFI_STATUS
+EFIAPI
+SataControllerStart (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE Controller,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
+ )
+{
+ EFI_STATUS Status;
+ EFI_PCI_IO_PROTOCOL *PciIo;
+ EFI_SATA_CONTROLLER_PRIVATE_DATA *SataPrivateData;
+ PCI_TYPE00 PciData;
+ UINTN SegNum;
+ UINTN BusNum;
+ UINTN DevNum;
+ UINTN FuncNum;
+ UINT64 CommandVal;
+
+ DEBUG ((EFI_D_INFO, "SataControllerStart() Start\n"));
+
+ SataPrivateData = NULL;
+ ///
+ /// Now test and open the EfiPciIoProtocol
+ ///
+ Status = gBS->OpenProtocol (
+ Controller,
+ &gEfiPciIoProtocolGuid,
+ (VOID **) &PciIo,
+ This->DriverBindingHandle,
+ Controller,
+ EFI_OPEN_PROTOCOL_BY_DRIVER
+ );
+ ///
+ /// Status == 0 - A normal execution flow, SUCCESS and the program proceeds.
+ /// Status == ALREADY_STARTED - A non-zero Status code returned. It indicates
+ /// that the protocol has been opened and should be treated as a
+ /// normal condition and the program proceeds. The Protocol will not
+ /// opened 'again' by this call.
+ /// Status != ALREADY_STARTED - Error status, terminate program execution
+ ///
+ if (EFI_ERROR (Status)) {
+ ///
+ /// EFI_ALREADY_STARTED is also an error
+ ///
+ return Status;
+ }
+ ///
+ /// Allocate SATA private data structure
+ ///
+ SataPrivateData = AllocatePool (sizeof (EFI_SATA_CONTROLLER_PRIVATE_DATA));
+ if (SataPrivateData == NULL) {
+ DEBUG ((EFI_D_ERROR, "SATA Controller START ERROR: Allocating pool for IdePrivateData failed!\n"));
+ Status = EFI_OUT_OF_RESOURCES;
+ goto Done;
+ }
+ ///
+ /// Initialize SATA private data
+ ///
+ ZeroMem (SataPrivateData, sizeof (EFI_SATA_CONTROLLER_PRIVATE_DATA));
+ SataPrivateData->Signature = SATA_CONTROLLER_SIGNATURE;
+ SataPrivateData->PciIo = PciIo;
+ SataPrivateData->IdeInit.GetChannelInfo = IdeInitGetChannelInfo;
+ SataPrivateData->IdeInit.NotifyPhase = IdeInitNotifyPhase;
+ SataPrivateData->IdeInit.SubmitData = IdeInitSubmitData;
+ SataPrivateData->IdeInit.DisqualifyMode = IdeInitDisqualifyMode;
+ SataPrivateData->IdeInit.CalculateMode = IdeInitCalculateMode;
+ SataPrivateData->IdeInit.SetTiming = IdeInitSetTiming;
+ SataPrivateData->IdeInit.EnumAll = PCH_SATA_ENUMER_ALL;
+
+ Status = PciIo->GetLocation (
+ PciIo,
+ &SegNum,
+ &BusNum,
+ &DevNum,
+ &FuncNum
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ Status = PciIo->Pci.Read (
+ PciIo,
+ EfiPciIoWidthUint8,
+ 0,
+ sizeof (PciData),
+ &PciData
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Get device capabilities
+ ///
+ Status = PciIo->Attributes (
+ PciIo,
+ EfiPciIoAttributeOperationSupported,
+ 0,
+ &CommandVal
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Enable Command Register
+ ///
+ Status = PciIo->Attributes (
+ PciIo,
+ EfiPciIoAttributeOperationEnable,
+ CommandVal & EFI_PCI_DEVICE_ENABLE,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+ if (PciData.Hdr.ClassCode[1] == V_PCH_SATA_SUB_CLASS_CODE_IDE) {
+ SataPrivateData->IdeInit.ChannelCount = PCH_IDE_1_MAX_CHANNELS;
+ } else if (PciData.Hdr.ClassCode[1] == V_PCH_SATA_SUB_CLASS_CODE_AHCI ||
+ PciData.Hdr.ClassCode[1] == V_PCH_SATA_SUB_CLASS_CODE_RAID) {
+ ///
+ /// Default MAX port number
+ ///
+ SataPrivateData->IdeInit.ChannelCount = GetPchMaxSataPortNum ();
+ }
+ ///
+ /// Install IDE_CONTROLLER_INIT protocol & private data to this instance
+ ///
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &Controller,
+ &gSataControllerDriverGuid,
+ SataPrivateData,
+ &gEfiIdeControllerInitProtocolGuid,
+ &(SataPrivateData->IdeInit),
+ NULL
+ );
+
+Done:
+
+ if (EFI_ERROR (Status)) {
+
+ gBS->CloseProtocol (
+ Controller,
+ &gEfiPciIoProtocolGuid,
+ This->DriverBindingHandle,
+ Controller
+ );
+ if (SataPrivateData != NULL) {
+ FreePool (SataPrivateData);
+ }
+ }
+
+ DEBUG ((EFI_D_INFO, "SataControllerStart() End\n"));
+
+ return Status;
+}
+
+/**
+ Stop managing the target device
+
+ @param[in] This A pointer pointing to the Binding Protocol instance
+ @param[in] Controller The handle of controller to be stopped
+ @param[in] NumberOfChildren Number of child devices
+ @param[in] ChildHandleBuffer Buffer holding child device handles
+
+ @retval EFI_SUCCESS The target device is stopped
+**/
+EFI_STATUS
+EFIAPI
+SataControllerStop (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE Controller,
+ IN UINTN NumberOfChildren,
+ IN EFI_HANDLE *ChildHandleBuffer
+ )
+{
+ EFI_STATUS Status;
+ EFI_SATA_CONTROLLER_PRIVATE_DATA *SataPrivateData;
+
+ DEBUG ((EFI_D_INFO, "SataControllerStop() Start\n"));
+
+ ///
+ /// Get private data
+ ///
+ Status = gBS->OpenProtocol (
+ Controller,
+ &gSataControllerDriverGuid,
+ (VOID **) &SataPrivateData,
+ This->DriverBindingHandle,
+ Controller,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+
+ if (!EFI_ERROR (Status)) {
+ gBS->UninstallMultipleProtocolInterfaces (
+ Controller,
+ &gSataControllerDriverGuid,
+ SataPrivateData,
+ &gEfiIdeControllerInitProtocolGuid,
+ &(SataPrivateData->IdeInit),
+ NULL
+ );
+ }
+ ///
+ /// Close protocols opened by SATA controller driver
+ ///
+ gBS->CloseProtocol (
+ Controller,
+ &gEfiPciIoProtocolGuid,
+ This->DriverBindingHandle,
+ Controller
+ );
+
+ if (SataPrivateData != NULL) {
+ FreePool (SataPrivateData);
+ }
+
+ DEBUG ((EFI_D_INFO, "SataControllerStop() End\n"));
+
+ return EFI_SUCCESS;
+}
+
+//
+// Interface functions of IDE_CONTROLLER_INIT protocol
+//
+
+/**
+ This function can be used to obtain information about a specified channel.
+ It's usually used by IDE Bus driver during enumeration process.
+
+ @param[in] This the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.
+ @param[in] Channel Channel number (0 based, either 0 or 1)
+ @param[out] Enabled TRUE if the channel is enabled. If the channel is disabled,
+ then it will no be enumerated.
+ @param[out] MaxDevices The Max number of IDE devices that the bus driver can expect
+ on this channel. For ATA/ATAPI, this number is either 1 or 2.
+
+ @retval EFI_SUCCESS Function completes successfully
+ @retval Other Values Something error happened
+ @retval EFI_INVALID_PARAMETER The Channel parameter is invalid
+**/
+EFI_STATUS
+EFIAPI
+IdeInitGetChannelInfo (
+ IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
+ IN UINT8 Channel,
+ OUT BOOLEAN *Enabled,
+ OUT UINT8 *MaxDevices
+ )
+{
+ ///
+ /// Channel number (0 based, either 0 or 1)
+ ///
+ EFI_SATA_CONTROLLER_PRIVATE_DATA *SataPrivateData;
+
+ SataPrivateData = SATA_CONTROLLER_PRIVATE_DATA_FROM_THIS (This);
+ ASSERT (SataPrivateData);
+
+ if (Channel < This->ChannelCount) {
+ *Enabled = TRUE;
+ *MaxDevices = PCH_IDE_1_MAX_DEVICES;
+ return EFI_SUCCESS;
+ } else {
+ *Enabled = FALSE;
+ return EFI_INVALID_PARAMETER;
+ }
+}
+
+/**
+ This function is called by IdeBus driver before executing certain actions.
+ This allows IDE Controller Init to prepare for each action.
+
+ @param[in] This the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.
+ @param[in] Phase phase indicator defined by IDE_CONTROLLER_INIT protocol
+ @param[in] Channel Channel number (0 based, either 0 or 1)
+
+ @retval EFI_SUCCESS Function completes successfully
+ @retval EFI_INVALID_PARAMETER Channel parameter is out of range
+ @exception EFI_UNSUPPORTED Phase is not supported
+**/
+EFI_STATUS
+EFIAPI
+IdeInitNotifyPhase (
+ IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
+ IN EFI_IDE_CONTROLLER_ENUM_PHASE Phase,
+ IN UINT8 Channel
+ )
+{
+ if (Channel >= This->ChannelCount) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ switch (Phase) {
+
+ case EfiIdeBeforeChannelEnumeration:
+ case EfiIdeAfterChannelEnumeration:
+ case EfiIdeBeforeChannelReset:
+ case EfiIdeAfterChannelReset:
+ case EfiIdeBusBeforeDevicePresenceDetection:
+ case EfiIdeBusAfterDevicePresenceDetection:
+ case EfiIdeResetMode:
+ ///
+ /// Do nothing at present
+ ///
+ break;
+
+ default:
+ return EFI_UNSUPPORTED;
+ break;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This function is called by IdeBus driver to submit EFI_IDENTIFY_DATA data structure
+ obtained from IDE deivce. This structure is used to set IDE timing
+
+ @param[in] This the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.
+ @param[in] Channel IDE channel number (0 based, either 0 or 1)
+ @param[in] Device IDE device number
+ @param[in] IdentifyData A pointer to EFI_IDENTIFY_DATA data structure
+
+ @retval EFI_SUCCESS Function completes successfully
+ @retval EFI_INVALID_PARAMETER Channel or Device parameter is out of range
+**/
+EFI_STATUS
+EFIAPI
+IdeInitSubmitData (
+ IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
+ IN UINT8 Channel,
+ IN UINT8 Device,
+ IN EFI_IDENTIFY_DATA *IdentifyData
+ )
+{
+ EFI_SATA_CONTROLLER_PRIVATE_DATA *SataPrivateData;
+ SataPrivateData = SATA_CONTROLLER_PRIVATE_DATA_FROM_THIS (This);
+ ASSERT (SataPrivateData);
+
+ if ((Channel >= This->ChannelCount) || (Device >= PCH_IDE_1_MAX_DEVICES)) {
+ return EFI_INVALID_PARAMETER;
+ }
+ ///
+ /// Make a local copy of device's IdentifyData and mark the valid flag
+ ///
+ if (IdentifyData != NULL) {
+ CopyMem (
+ &(SataPrivateData->IdentifyData[Channel][Device]),
+ IdentifyData,
+ sizeof (EFI_IDENTIFY_DATA)
+ );
+
+ SataPrivateData->IdentifyValid[Channel][Device] = TRUE;
+ } else {
+ SataPrivateData->IdentifyValid[Channel][Device] = FALSE;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This function is called by IdeBus driver to disqualify unsupported operation
+ mode on specfic IDE device
+
+ @param[in] This The EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.
+ @param[in] Channel IDE channel number (0 based, either 0 or 1)
+ @param[in] Device IDE device number
+ @param[in] BadModes Operation mode indicator
+
+ @retval EFI_SUCCESS Function completes successfully
+ @retval EFI_INVALID_PARAMETER Channel parameter or Devicde parameter is out of range,
+ or BadModes is NULL
+**/
+EFI_STATUS
+EFIAPI
+IdeInitDisqualifyMode (
+ IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
+ IN UINT8 Channel,
+ IN UINT8 Device,
+ IN EFI_ATA_COLLECTIVE_MODE *BadModes
+ )
+{
+ EFI_SATA_CONTROLLER_PRIVATE_DATA *SataPrivateData;
+ SataPrivateData = SATA_CONTROLLER_PRIVATE_DATA_FROM_THIS (This);
+ ASSERT (SataPrivateData);
+
+ if ((Channel >= This->ChannelCount) || (BadModes == NULL) || (Device >= PCH_IDE_1_MAX_DEVICES)) {
+ return EFI_INVALID_PARAMETER;
+ }
+ ///
+ /// Record the disqualified modes per channel per device. From ATA/ATAPI spec,
+ /// if a mode is not supported, the modes higher than it is also not
+ /// supported
+ ///
+ CopyMem (
+ &(SataPrivateData->DisqulifiedModes[Channel][Device]),
+ BadModes,
+ sizeof (EFI_ATA_COLLECTIVE_MODE)
+ );
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This function is called by IdeBus driver to calculate the best operation mode
+ supported by specific IDE device
+
+ @param[in] This The EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.
+ @param[in] Channel IDE channel number (0 based, either 0 or 1)
+ @param[in] Device IDE device number
+ @param[in, out] SupportedModes Modes collection supported by IDE device
+
+ @retval EFI_SUCCESS Function completes successfully
+ @retval EFI_INVALID_PARAMETER Channel parameter or Device parameter is out of range;
+ Or SupportedModes is NULL
+ @retval EFI_NOT_READY Identify data is not valid
+ @retval EFI_OUT_OF_RESOURCES SupportedModes is out of range
+**/
+EFI_STATUS
+EFIAPI
+IdeInitCalculateMode (
+ IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
+ IN UINT8 Channel,
+ IN UINT8 Device,
+ IN OUT EFI_ATA_COLLECTIVE_MODE **SupportedModes
+ )
+{
+ EFI_SATA_CONTROLLER_PRIVATE_DATA *SataPrivateData;
+ EFI_IDENTIFY_DATA *IdentifyData;
+ BOOLEAN IdentifyValid;
+ EFI_ATA_COLLECTIVE_MODE *DisqulifiedModes;
+ UINT16 SelectedMode;
+ EFI_STATUS Status;
+
+ SataPrivateData = SATA_CONTROLLER_PRIVATE_DATA_FROM_THIS (This);
+ ASSERT (SataPrivateData);
+
+ if ((Channel >= This->ChannelCount) || (SupportedModes == NULL) || (Device >= PCH_IDE_1_MAX_DEVICES)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ IdentifyData = &(SataPrivateData->IdentifyData[Channel][Device]);
+ DisqulifiedModes = &(SataPrivateData->DisqulifiedModes[Channel][Device]);
+ IdentifyValid = SataPrivateData->IdentifyValid[Channel][Device];
+
+ ///
+ /// Make sure we've got the valid identify data of the device from SubmitData()
+ ///
+ if (!IdentifyValid) {
+ return EFI_NOT_READY;
+ }
+
+ *SupportedModes = AllocateZeroPool (sizeof (EFI_ATA_COLLECTIVE_MODE));
+ if (*SupportedModes == NULL) {
+ ASSERT (FALSE);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Status = CalculateBestPioMode (
+ IdentifyData,
+ (DisqulifiedModes->PioMode.Valid ? ((UINT16 *) &(DisqulifiedModes->PioMode.Mode)) : NULL),
+ &SelectedMode
+ );
+ if (!EFI_ERROR (Status)) {
+ (*SupportedModes)->PioMode.Valid = TRUE;
+ (*SupportedModes)->PioMode.Mode = SelectedMode;
+
+ } else {
+ (*SupportedModes)->PioMode.Valid = FALSE;
+ }
+
+ Status = CalculateBestUdmaMode (
+ IdentifyData,
+ (DisqulifiedModes->UdmaMode.Valid ? ((UINT16 *) &(DisqulifiedModes->UdmaMode.Mode)) : NULL),
+ &SelectedMode
+ );
+
+ if (!EFI_ERROR (Status)) {
+ (*SupportedModes)->UdmaMode.Valid = TRUE;
+ (*SupportedModes)->UdmaMode.Mode = SelectedMode;
+
+ } else {
+ (*SupportedModes)->UdmaMode.Valid = FALSE;
+ }
+ ///
+ /// The modes other than PIO and UDMA are not supported by SATA controller
+ ///
+ return EFI_SUCCESS;
+}
+
+/**
+ This function is called by IdeBus driver to set appropriate timing on IDE
+ controller according supported operation mode
+
+ @param[in] This The EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.
+ @param[in] Channel IDE channel number (0 based, either 0 or 1)
+ @param[in] Device IDE device number
+ @param[in] Modes Operation modes
+
+ @retval EFI_SUCCESS This function always returns EFI_SUCCESS
+**/
+EFI_STATUS
+EFIAPI
+IdeInitSetTiming (
+ IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
+ IN UINT8 Channel,
+ IN UINT8 Device,
+ IN EFI_ATA_COLLECTIVE_MODE *Modes
+ )
+{
+ return EFI_SUCCESS;
+}
+
+/**
+ This function is used to calculate the best PIO mode supported by
+ specific IDE device
+
+ @param[in] IdentifyData The identify data of specific IDE device
+ @param[in] DisPioMode Disqualified PIO modes collection
+ @param[out] SelectedMode Available PIO modes collection
+
+ @retval EFI_SUCCESS Function completes successfully
+ @exception EFI_UNSUPPORTED Some invalid condition
+**/
+EFI_STATUS
+CalculateBestPioMode (
+ IN EFI_IDENTIFY_DATA * IdentifyData,
+ IN UINT16 *DisPioMode OPTIONAL,
+ OUT UINT16 *SelectedMode
+ )
+{
+ UINT16 PioMode;
+ UINT16 AdvancedPioMode;
+ UINT16 Temp;
+ UINT16 Index;
+ UINT16 MinimumPioCycleTime;
+
+ Temp = 0xff;
+
+ PioMode = (UINT8) (IdentifyData->AtaData.pio_cycle_timing >> 8);
+
+ ///
+ /// see whether Identify Data word 64 - 70 are valid
+ ///
+ if ((IdentifyData->AtaData.field_validity & 0x02) == 0x02) {
+
+ AdvancedPioMode = IdentifyData->AtaData.advanced_pio_modes;
+
+ for (Index = 0; Index < 8; Index++) {
+ if ((AdvancedPioMode & 0x01) != 0) {
+ Temp = Index;
+ }
+
+ AdvancedPioMode >>= 1;
+ }
+ ///
+ /// if Temp is modified, meant the advanced_pio_modes is not zero;
+ /// if Temp is not modified, meant the no advanced PIO Mode is supported,
+ /// the best PIO Mode is the value in pio_cycle_timing.
+ ///
+ if (Temp != 0xff) {
+ AdvancedPioMode = (UINT16) (Temp + 3);
+ } else {
+ AdvancedPioMode = PioMode;
+ }
+ ///
+ /// Limit the PIO mode to at most PIO4.
+ ///
+ PioMode = (UINT16) (AdvancedPioMode < 4 ? AdvancedPioMode : 4);
+
+ MinimumPioCycleTime = IdentifyData->AtaData.min_pio_cycle_time_with_flow_control;
+
+ if (MinimumPioCycleTime <= 120) {
+ PioMode = (UINT16) (4 < PioMode ? 4 : PioMode);
+ } else if (MinimumPioCycleTime <= 180) {
+ PioMode = (UINT16) (3 < PioMode ? 3 : PioMode);
+ } else if (MinimumPioCycleTime <= 240) {
+ PioMode = (UINT16) (2 < PioMode ? 2 : PioMode);
+ } else {
+ PioMode = 0;
+ }
+ ///
+ /// Degrade the PIO mode if the mode has been disqualified
+ ///
+ if (DisPioMode != NULL) {
+
+ if (*DisPioMode < 2) {
+ return EFI_UNSUPPORTED;
+ ///
+ /// no mode below ATA_PIO_MODE_BELOW_2
+ ///
+ }
+
+ if (PioMode >= *DisPioMode) {
+ PioMode = (UINT16) (*DisPioMode - 1);
+ }
+ }
+
+ if (PioMode < 2) {
+ *SelectedMode = 1;
+ ///
+ /// ATA_PIO_MODE_BELOW_2;
+ ///
+ } else {
+ *SelectedMode = PioMode;
+ ///
+ /// ATA_PIO_MODE_2 to ATA_PIO_MODE_4;
+ ///
+ }
+
+ } else {
+ ///
+ /// Identify Data word 64 - 70 are not valid
+ /// Degrade the PIO mode if the mode has been disqualified
+ ///
+ if (DisPioMode != NULL) {
+
+ if (*DisPioMode < 2) {
+ return EFI_UNSUPPORTED;
+ ///
+ /// no mode below ATA_PIO_MODE_BELOW_2
+ ///
+ }
+
+ if (PioMode == *DisPioMode) {
+ PioMode--;
+ }
+ }
+
+ if (PioMode < 2) {
+ *SelectedMode = 1;
+ ///
+ /// ATA_PIO_MODE_BELOW_2;
+ ///
+ } else {
+ *SelectedMode = 2;
+ ///
+ /// ATA_PIO_MODE_2;
+ ///
+ }
+
+ }
+
+ DEBUG ((EFI_D_ERROR, "CalculateBestPioMode() End\n"));
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This function is used to calculate the best UDMA mode supported by
+ specific IDE device
+
+ @param[in] IdentifyData The identify data of specific IDE device
+ @param[in] DisUDmaMode Disqualified UDMA modes collection
+ @param[out] SelectedMode Available UMDA modes collection
+
+ @retval EFI_SUCCESS Function completes successfully
+ @exception EFI_UNSUPPORTED Some invalid condition
+**/
+EFI_STATUS
+CalculateBestUdmaMode (
+ IN EFI_IDENTIFY_DATA * IdentifyData,
+ IN UINT16 *DisUDmaMode OPTIONAL,
+ OUT UINT16 *SelectedMode
+ )
+{
+ UINT16 TempMode;
+ UINT16 DeviceUDmaMode;
+
+ DeviceUDmaMode = 0;
+ ///
+ /// flag for 'Udma mode is not supported'
+ ///
+ /// Check whether the WORD 88 (supported UltraDMA by drive) is valid
+ ///
+ if ((IdentifyData->AtaData.field_validity & 0x04) == 0x00) {
+ return EFI_UNSUPPORTED;
+ }
+
+ DeviceUDmaMode = IdentifyData->AtaData.ultra_dma_mode;
+ DeviceUDmaMode &= 0x3f;
+ TempMode = 0;
+ ///
+ /// initialize it to UDMA-0
+ ///
+ while ((DeviceUDmaMode >>= 1) != 0) {
+ TempMode++;
+ }
+ ///
+ /// Degrade the UDMA mode if the mode has been disqualified
+ ///
+ if (DisUDmaMode != NULL) {
+ if (*DisUDmaMode == 0) {
+ *SelectedMode = 0;
+ return EFI_UNSUPPORTED;
+ ///
+ /// no mode below ATA_UDMA_MODE_0
+ ///
+ }
+
+ if (TempMode >= *DisUDmaMode) {
+ TempMode = (UINT16) (*DisUDmaMode - 1);
+ }
+ }
+ ///
+ /// Possible returned mode is between ATA_UDMA_MODE_0 and ATA_UDMA_MODE_5
+ ///
+ *SelectedMode = TempMode;
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/SataController/Dxe/SataController.cif b/ReferenceCode/Chipset/LynxPoint/SataController/Dxe/SataController.cif
new file mode 100644
index 0000000..1ad423f
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SataController/Dxe/SataController.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "SataController"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\SataController\Dxe"
+ RefName = "SataController"
+[files]
+"SataController.sdl"
+"SataController.mak"
+"SataController.c"
+"SataController.h"
+"SataControllerName.c"
+"SataController.inf"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/SataController/Dxe/SataController.h b/ReferenceCode/Chipset/LynxPoint/SataController/Dxe/SataController.h
new file mode 100644
index 0000000..45b6f8a
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SataController/Dxe/SataController.h
@@ -0,0 +1,323 @@
+/** @file
+ Header file for chipset Serial ATA controller driver.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#ifndef _SERIAL_ATA_CONTROLLER_H_
+#define _SERIAL_ATA_CONTROLLER_H_
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+
+#include "EdkIIGlueDxe.h"
+#include "pci22.h"
+#include "EFIScriptLib.h"
+
+#include EFI_PROTOCOL_PRODUCER (IdeControllerInit)
+#include EFI_PROTOCOL_CONSUMER (PciIo)
+#include "PchAccess.h"
+#include "PchPlatformLib.h"
+#endif
+//
+// Global Variables definitions
+//
+extern EFI_DRIVER_BINDING_PROTOCOL mSataControllerDriverBinding;
+extern EFI_COMPONENT_NAME_PROTOCOL mSataControllerName;
+extern UINTN mPchGpioBase;
+
+///
+/// {BB929DA9-68F7-4035-B22C-A3BB3F23DA55}
+///
+///
+/// Define the protocol GUID
+///
+/// Only EdkII defines EDK_RELEASE_VERSION as 0x00020000
+///
+#if (EDK_RELEASE_VERSION != 0x00020000)
+#define PCH_SATA_CONTROLLER_DRIVER_GUID \
+ { \
+ 0xbb929da9, 0x68f7, 0x4035, 0xb2, 0x2c, 0xa3, 0xbb, 0x3f, 0x23, 0xda, 0x55 \
+ };
+#else
+#define PCH_SATA_CONTROLLER_DRIVER_GUID \
+ { \
+ 0xbb929da9, 0x68f7, 0x4035, \
+ { \
+ 0xb2, 0x2c, 0xa3, 0xbb, 0x3f, 0x23, 0xda, 0x55 \
+ } \
+ };
+#endif
+
+#define PCH_SATA_ENUMER_ALL FALSE
+
+#define PCH_SATA_MASTER_DRIVE 0x00
+#define PCH_SATA_SLAVE_DRIVE 0x01
+
+///
+/// SATA controller driver private data structure
+///
+#define SATA_CONTROLLER_SIGNATURE EFI_SIGNATURE_32 ('S', 'A', 'T', 'A')
+
+typedef struct _EFI_SATA_CONTROLLER_PRIVATE_DATA {
+ ///
+ /// Standard signature used to identify SATA controller private data
+ ///
+ UINT32 Signature;
+
+ ///
+ /// Protocol instance of IDE_CONTROLLER_INIT produced by this driver
+ ///
+ EFI_IDE_CONTROLLER_INIT_PROTOCOL IdeInit;
+
+ ///
+ /// copy of protocol pointers used by this driver
+ ///
+ EFI_PCI_IO_PROTOCOL *PciIo;
+
+ ///
+ /// The highest disqulified mode for each attached SATA device.
+ /// Per ATA/ATAPI spec, if a mode is not supported, the modes higher than
+ /// it should not be supported
+ ///
+ EFI_ATA_COLLECTIVE_MODE DisqulifiedModes[LPTH_AHCI_MAX_PORTS][PCH_IDE_1_MAX_DEVICES];
+
+ ///
+ /// A copy of IDENTIFY data for each attached SATA device and its flag
+ ///
+ EFI_IDENTIFY_DATA IdentifyData[LPTH_AHCI_MAX_PORTS][PCH_IDE_1_MAX_DEVICES];
+ BOOLEAN IdentifyValid[LPTH_AHCI_MAX_PORTS][PCH_IDE_1_MAX_DEVICES];
+} EFI_SATA_CONTROLLER_PRIVATE_DATA;
+
+#define SATA_CONTROLLER_PRIVATE_DATA_FROM_THIS(a) \
+ CR ( \
+ a, \
+ EFI_SATA_CONTROLLER_PRIVATE_DATA, \
+ IdeInit, \
+ SATA_CONTROLLER_SIGNATURE \
+ )
+
+//
+// Driver binding functions declaration
+//
+
+/**
+ This function checks to see if the driver supports a device specified by
+ "Controller handle" parameter. It is called by DXE Core StartImage() or
+ ConnectController() routines. The driver uses 'device path' and/or
+ 'services' from the Bus I/O abstraction attached to the controller handle
+ to determine if the driver support this controller handle.
+ Note: In the BDS (Boot Device Selection) phase, the DXE core enumerate all
+ devices (or, controller) and assigns GUIDs to them.
+
+ @param[in] This A pointer points to the Binding Protocol instance
+ @param[in] Controller The handle of controller to be tested.
+ @param[in] RemainingDevicePath A pointer to the device path. Ignored by device
+ driver but used by bus driver
+
+ @retval EFI_SUCCESS The device is supported
+ @exception EFI_UNSUPPORTED The device is not supported
+**/
+EFI_STATUS
+EFIAPI
+SataControllerSupported (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE Controller,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
+ );
+
+/**
+ This routine is called right after the .Supported() is called and returns
+ EFI_SUCCESS. Notes: The supported protocols are checked but the Protocols
+ are closed.
+
+ @param[in] This A pointer points to the Binding Protocol instance
+ @param[in] Controller The handle of controller to be tested. Parameter
+ passed by the caller
+ @param[in] RemainingDevicePath A pointer to the device path. Should be ignored by
+ device driver
+
+ @retval EFI_SUCCESS The device is started
+ @retval Other values Something error happened
+**/
+EFI_STATUS
+EFIAPI
+SataControllerStart (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE Controller,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
+ );
+
+/**
+ Stop managing the target device
+
+ @param[in] This A pointer pointing to the Binding Protocol instance
+ @param[in] Controller The handle of controller to be stopped
+ @param[in] NumberOfChildren Number of child devices
+ @param[in] ChildHandleBuffer Buffer holding child device handles
+
+ @retval EFI_SUCCESS The target device is stopped
+**/
+EFI_STATUS
+EFIAPI
+SataControllerStop (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE Controller,
+ IN UINTN NumberOfChildren,
+ IN EFI_HANDLE *ChildHandleBuffer
+ );
+
+//
+// IDE controller init functions declaration
+//
+
+/**
+ This function can be used to obtain information about a specified channel.
+ It's usually used by IDE Bus driver during enumeration process.
+
+ @param[in] This the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.
+ @param[in] Channel Channel number (0 based, either 0 or 1)
+ @param[out] Enabled TRUE if the channel is enabled. If the channel is disabled,
+ then it will no be enumerated.
+ @param[out] MaxDevices The Max number of IDE devices that the bus driver can expect
+ on this channel. For ATA/ATAPI, this number is either 1 or 2.
+
+ @retval EFI_SUCCESS Function completes successfully
+ @retval Other Values Something error happened
+ @retval EFI_INVALID_PARAMETER The Channel parameter is invalid
+**/
+EFI_STATUS
+EFIAPI
+IdeInitGetChannelInfo (
+ IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
+ IN UINT8 Channel,
+ OUT BOOLEAN *Enabled,
+ OUT UINT8 *MaxDevices
+ );
+
+/**
+ This function is called by IdeBus driver before executing certain actions.
+ This allows IDE Controller Init to prepare for each action.
+
+ @param[in] This the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.
+ @param[in] Phase phase indicator defined by IDE_CONTROLLER_INIT protocol
+ @param[out] Channel Channel number (0 based, either 0 or 1)
+
+ @retval EFI_SUCCESS Function completes successfully
+ @retval EFI_INVALID_PARAMETER Channel parameter is out of range
+ @exception EFI_UNSUPPORTED Phase is not supported
+**/
+EFI_STATUS
+EFIAPI
+IdeInitNotifyPhase (
+ IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
+ IN EFI_IDE_CONTROLLER_ENUM_PHASE Phase,
+ OUT UINT8 Channel
+ );
+
+/**
+ This function is called by IdeBus driver to submit EFI_IDENTIFY_DATA data structure
+ obtained from IDE deivce. This structure is used to set IDE timing
+
+ @param[in] This the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.
+ @param[in] Channel IDE channel number (0 based, either 0 or 1)
+ @param[in] Device IDE device number
+ @param[in] IdentifyData A pointer to EFI_IDENTIFY_DATA data structure
+
+ @retval EFI_SUCCESS Function completes successfully
+ @retval EFI_INVALID_PARAMETER Channel or Device parameter is out of range
+**/
+EFI_STATUS
+EFIAPI
+IdeInitSubmitData (
+ IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
+ IN UINT8 Channel,
+ IN UINT8 Device,
+ IN EFI_IDENTIFY_DATA *IdentifyData
+ );
+
+/**
+ This function is called by IdeBus driver to disqualify unsupported operation
+ mode on specfic IDE device
+
+ @param[in] This The EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.
+ @param[in] Channel IDE channel number (0 based, either 0 or 1)
+ @param[in] Device IDE device number
+ @param[in] BadModes Operation mode indicator
+
+ @retval EFI_SUCCESS Function completes successfully
+ @retval EFI_INVALID_PARAMETER Channel parameter or Devicde parameter is out of range,
+ or BadModes is NULL
+**/
+EFI_STATUS
+EFIAPI
+IdeInitDisqualifyMode (
+ IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
+ IN UINT8 Channel,
+ IN UINT8 Device,
+ IN EFI_ATA_COLLECTIVE_MODE *BadModes
+ );
+
+/**
+ This function is called by IdeBus driver to calculate the best operation mode
+ supported by specific IDE device
+
+ @param[in] This The EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.
+ @param[in] Channel IDE channel number (0 based, either 0 or 1)
+ @param[in] Device IDE device number
+ @param[in, out] SupportedModes Modes collection supported by IDE device
+
+ @retval EFI_SUCCESS Function completes successfully
+ @retval EFI_INVALID_PARAMETER Channel parameter or Device parameter is out of range;
+ Or SupportedModes is NULL
+ @retval EFI_NOT_READY Identify data is not valid
+ @retval EFI_OUT_OF_RESOURCES SupportedModes is out of range
+**/
+EFI_STATUS
+EFIAPI
+IdeInitCalculateMode (
+ IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
+ IN UINT8 Channel,
+ IN UINT8 Device,
+ IN OUT EFI_ATA_COLLECTIVE_MODE **SupportedModes
+ );
+
+/**
+ This function is called by IdeBus driver to set appropriate timing on IDE
+ controller according supported operation mode
+
+ @param[in] This The EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.
+ @param[in] Channel IDE channel number (0 based, either 0 or 1)
+ @param[in] Device IDE device number
+ @param[in] Modes Operation modes
+
+ @retval EFI_SUCCESS This function always returns EFI_SUCCESS
+**/
+EFI_STATUS
+EFIAPI
+IdeInitSetTiming (
+ IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
+ IN UINT8 Channel,
+ IN UINT8 Device,
+ IN EFI_ATA_COLLECTIVE_MODE *Modes
+ );
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/SataController/Dxe/SataController.inf b/ReferenceCode/Chipset/LynxPoint/SataController/Dxe/SataController.inf
new file mode 100644
index 0000000..b80a195
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SataController/Dxe/SataController.inf
@@ -0,0 +1,94 @@
+## @file
+# Component description file for PCH SATA controller Driver module.
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = SataController
+FILE_GUID = BB65942B-521F-4ec3-BAF9-A92540CF60D2
+COMPONENT_TYPE = BS_DRIVER
+
+[sources.common]
+ SataController.h
+ SataController.c
+ SataControllerName.c
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueDxeDriverEntryPoint.c
+
+[includes.common]
+ .
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/SampleCode
+
+[libraries.common]
+ EfiScriptLib
+ EdkProtocolLib
+ EdkFrameworkProtocolLib
+ $(PROJECT_PCH_FAMILY)ProtocolLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueBaseMemoryLib
+ EdkIIGlueDxeReportStatusCodeLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueUefiLib
+ EdkIIGlueUefiDriverModelLib
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueDxeMemoryAllocationLib
+ PchPlatformLib
+ EdkIIGlueBasePciLibPciExpress
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=InitializeSataControllerDriver \
+ -D __EDKII_GLUE_DRIVER_BINDING_PROTOCOL_INSTANCE__=mSataControllerDriverBinding \
+ -D __EDKII_GLUE_COMPONENT_NAME_PROTOCOL_INSTANCE__=mSataControllerName
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_UEFI_LIB__ \
+ -D __EDKII_GLUE_UEFI_DRIVER_MODEL_LIB__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__
diff --git a/ReferenceCode/Chipset/LynxPoint/SataController/Dxe/SataController.mak b/ReferenceCode/Chipset/LynxPoint/SataController/Dxe/SataController.mak
new file mode 100644
index 0000000..915e815
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SataController/Dxe/SataController.mak
@@ -0,0 +1,116 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/SataController/SataController.mak 3 10/16/12 3:33a Scottyang $
+#
+# $Revision: 3 $
+#
+# $Date: 10/16/12 3:33a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/SataController/SataController.mak $
+#
+# 3 10/16/12 3:33a Scottyang
+# [TAG] EIP103924
+#
+# [Category] Improvement
+#
+# [Description] Update RC 0.7.1
+#
+# [Files] ReferenceCode\Chipset\LynxPoint\*.*, SBDxe.c, SB.sd,
+# SbSetupData.c, GetSetupDate.c
+#
+# 2 2/24/12 2:20a Victortu
+# Updated to support 4.6.5.3_IntelEDK_1117_Patch7_00.
+#
+# 1 2/08/12 9:15a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+
+#---------------------------------------------------------------------------
+# Create SataController Driver
+#---------------------------------------------------------------------------
+EDK : SataController
+SataController : $(BUILD_DIR)\SataController.mak SataControllerBin
+
+
+$(BUILD_DIR)\SataController.mak : $(SataController_DIR)\$(@B).cif $(SataController_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(SataController_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+SataController_INCLUDES=\
+ $(INTEL_PCH_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+
+SataController_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=InitializeSataControllerDriver"\
+ /D"__EDKII_GLUE_DRIVER_BINDING_PROTOCOL_INSTANCE__=mSataControllerDriverBinding"\
+ /D"__EDKII_GLUE_COMPONENT_NAME_PROTOCOL_INSTANCE__=mSataControllerName"\
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_UEFI_LIB__ \
+ /D __EDKII_GLUE_UEFI_DRIVER_MODEL_LIB__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_BASE_PCI_LIB_CF8__ \
+ /D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__
+
+SataController_LIB_LINKS =\
+ $(EFISCRIPTLIB) $(INTEL_PCH_PROTOCOL_LIB)\
+ $(EDKPROTOCOLLIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueUefiLib_LIB)\
+ $(EdkIIGlueUefiDriverModelLib_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueBasePciLibCf8_LIB)\
+ $(EdkIIGlueDxeMemoryAllocationLib_LIB)\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(PchPlatformDxeLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)
+
+SataControllerBin: $(SataController_LIB_LINKS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\SataController.mak all \
+ "MY_INCLUDES=$(SataController_INCLUDES)" \
+ "MY_DEFINES=$(SataController_DEFINES)" \
+ GUID=BB65942B-521F-4ec3-BAF9-A92540CF60D2\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=BS_DRIVER \
+ EDKIIModule=DXEDRIVER\
+ COMPRESS=1
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/SataController/Dxe/SataController.sdl b/ReferenceCode/Chipset/LynxPoint/SataController/Dxe/SataController.sdl
new file mode 100644
index 0000000..cecd287
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SataController/Dxe/SataController.sdl
@@ -0,0 +1,67 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/SataController/SataController.sdl 1 2/08/12 9:15a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 9:15a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/SataController/SataController.sdl $
+#
+# 1 2/08/12 9:15a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+TOKEN
+ Name = "SataController_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable SataController support in Project"
+End
+
+PATH
+ Name = "SataController_DIR"
+ Help = "SataController file source directory"
+End
+
+MODULE
+ File = "SataController.mak"
+ Help = "Includes SataController.mak to Project"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\SataController.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/SataController/Dxe/SataControllerName.c b/ReferenceCode/Chipset/LynxPoint/SataController/Dxe/SataControllerName.c
new file mode 100644
index 0000000..5de33b3
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SataController/Dxe/SataControllerName.c
@@ -0,0 +1,173 @@
+/** @file
+ This portion is to register the Sata Controller Driver name:
+ "SATA Controller Init Driver"
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "SataController.h"
+
+///
+/// Forward reference declaration
+///
+EFI_STATUS
+EFIAPI
+SataControllerGetDriverName (
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN CHAR8 *Language,
+ OUT CHAR16 **DriverName
+ );
+
+EFI_STATUS
+EFIAPI
+SataControllerGetControllerName (
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_HANDLE ChildHandle OPTIONAL,
+ IN CHAR8 *Language,
+ OUT CHAR16 **ControllerName
+ );
+
+///
+/// EFI Component Name Protocol
+/// This portion declares a gloabl variable of EFI_COMPONENT_NAME_PROTOCOL type.
+///
+EFI_COMPONENT_NAME_PROTOCOL mSataControllerName = {
+ SataControllerGetDriverName,
+ SataControllerGetControllerName,
+ "eng"
+};
+
+///
+/// Define the Driver's unicode name string
+///
+static EFI_UNICODE_STRING_TABLE mSataControllerDriverNameTable[] = {
+ {
+ "eng",
+ L"PCH Serial ATA Controller Initialization Driver"
+ },
+ {
+ NULL,
+ NULL
+ }
+};
+
+static EFI_UNICODE_STRING_TABLE mSataControllerControllerNameTable[] = {
+ {
+ "eng",
+ L"PCH Serial ATA Controller"
+ },
+ {
+ NULL,
+ NULL
+ }
+};
+
+/**
+ Retrieves a Unicode string that is the user readable name of the EFI Driver.
+
+ @param[in] This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
+ @param[in] Language A pointer to a three character ISO 639-2 language identifier.
+ This is the language of the driver name that that the caller
+ is requesting, and it must match one of the languages specified
+ in SupportedLanguages. The number of languages supported by a
+ driver is up to the driver writer.
+ @param[out] DriverName A pointer to the Unicode string to return. This Unicode string
+ is the name of the driver specified by This in the language
+ specified by Language.
+
+ @retval EFI_SUCCESS The Unicode string for the Driver specified by This
+ and the language specified by Language was returned
+ in DriverName.
+ @retval EFI_INVALID_PARAMETER Language is NULL.
+ @retval EFI_INVALID_PARAMETER DriverName is NULL.
+ @exception EFI_UNSUPPORTED The driver specified by This does not support the
+ language specified by Language.
+**/
+EFI_STATUS
+EFIAPI
+SataControllerGetDriverName (
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN CHAR8 *Language,
+ OUT CHAR16 **DriverName
+ )
+{
+
+ return LookupUnicodeString (
+ Language,
+ mSataControllerName.SupportedLanguages,
+ mSataControllerDriverNameTable,
+ DriverName
+ );
+}
+
+/**
+ Retrieves a Unicode string that is the user readable name of the controller
+ that is being managed by an EFI Driver.
+
+ @param[in] This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
+ @param[in] ControllerHandle The handle of a controller that the driver specified by
+ This is managing. This handle specifies the controller
+ whose name is to be returned.
+ @param[in] ChildHandle The handle of the child controller to retrieve the name
+ of. This is an optional parameter that may be NULL. It
+ will be NULL for device drivers. It will also be NULL
+ for a bus drivers that wish to retrieve the name of the
+ bus controller. It will not be NULL for a bus driver
+ that wishes to retrieve the name of a child controller.
+ @param[in] Language A pointer to a three character ISO 639-2 language
+ identifier. This is the language of the controller name
+ that that the caller is requesting, and it must match one
+ of the languages specified in SupportedLanguages. The
+ number of languages supported by a driver is up to the
+ driver writer.
+ @param[out] ControllerName A pointer to the Unicode string to return. This Unicode
+ string is the name of the controller specified by
+ ControllerHandle and ChildHandle in the language
+ specified by Language from the point of view of the
+ driver specified by This.
+
+ @retval EFI_SUCCESS The Unicode string for the user readable name in the
+ language specified by Language for the driver
+ specified by This was returned in DriverName.
+ @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
+ ChildHandle is not NULL and it is not a valid EFI_HANDLE.
+ @retval EFI_INVALID_PARAMETER Language is NULL.
+ ControllerName is NULL.
+ @exception EFI_UNSUPPORTED The driver specified by This is not currently
+ managing the controller specified by
+ ControllerHandle and ChildHandle.
+ The driver specified by This does not support the
+ language specified by Language.
+**/
+EFI_STATUS
+EFIAPI
+SataControllerGetControllerName (
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_HANDLE ChildHandle OPTIONAL,
+ IN CHAR8 *Language,
+ OUT CHAR16 **ControllerName
+ )
+{
+ return LookupUnicodeString (
+ Language,
+ mSataControllerName.SupportedLanguages,
+ mSataControllerControllerNameTable,
+ ControllerName
+ );
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/SerialGpio/Dxe/PchSerialGpio.c b/ReferenceCode/Chipset/LynxPoint/SerialGpio/Dxe/PchSerialGpio.c
new file mode 100644
index 0000000..53fc550
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SerialGpio/Dxe/PchSerialGpio.c
@@ -0,0 +1,516 @@
+/** @file
+ PCH SERIAL GPIO Driver implements the SERIAL GPIO Interface.
+ Usage model for this protocol is:
+ 1. locate this protocol by guid variable gEfiSerialGpioProtocolGuid
+ 2. Use SerialGpioRegister to register for one serial GPIO pin.
+ 3. Send data using SerialGpioSendData.
+ 4. If another GPIO need to send serial data,
+ the former one need to be unregistered using SerialGpioUnRegister since PCH have only one set of registers for serial GPIO data sending.
+ And register the new GPIO pin for Serial Gpio data sending.
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "PchSerialGpio.h"
+
+///
+/// Global variables
+///
+UINT32 mPchGpioBase;
+
+/**
+ Register for one GPIO Pin that will be used as serial GPIO.
+ For PCH only GPIO0~31 will have the capability to be used as serail GPIO.
+ The caller of this procedure need to be very clear of whPch GPIO should be used as serail GPIO,
+ it should not be input, native, conflict with other GPIO, or Index > 31 on the caller's platform.
+
+ @param[in] This Pointer to the EFI_SERIAL_GPIO_PROTOCOL instance.
+ @param[in] SerialGpioPinIndex The GPIO pin Index that will be used as serial GPIO for data sending.
+
+ @retval EFI_SUCCESS Opcode initialization on the SERIAL_GPIO host controller completed.
+ @retval EFI_ACCESS_DENIED The SERIAL_GPIO configuration interface is locked.
+ @retval EFI_OUT_OF_RESOURCES Not enough resource available to initialize the device.
+ @retval EFI_DEVICE_ERROR Device error, operation failed.
+ @retval EFI_INVALID_PARAMETER SerialGpioPinIndex is out of range
+**/
+EFI_STATUS
+EFIAPI
+PchSerialGpioRegister (
+ IN EFI_SERIAL_GPIO_PROTOCOL *This,
+ IN UINT8 SerialGpioPinIndex
+ )
+{
+ UINT32 GpioSerBlinkValue;
+ UINT32 GpioUseSelValue;
+ UINT32 GpioIoSelValue;
+ UINT32 GpioBlinkValue;
+ SERIAL_GPIO_INSTANCE *SerialGpioInstance;
+ PCH_SERIES PchSeries;
+
+ if (SerialGpioPinIndex >= SERIAL_GPIO_MAX_PIN_NUMBER) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ SerialGpioInstance = SERIAL_GPIO_INSTANCE_FROM_SERIAL_GPIO_PROTOCOL (This);
+ if (SerialGpioInstance->CurrentActiveSerialGpio != SERIAL_GPIO_PIN_CLEARED) {
+ DEBUG (
+ (EFI_D_ERROR,
+ "You have to unregister the former serial GPIO %d registered, then try to register this GPIO pin %d\n",
+ SerialGpioInstance->CurrentActiveSerialGpio,
+ SerialGpioPinIndex)
+ );
+ }
+
+ GpioUseSelValue = 0;
+ GpioIoSelValue = 0;
+ PchSeries = GetPchSeries();
+
+ ///
+ /// Read out values original in serial GPIO registers.
+ ///
+ if (PchSeries == PchH) {
+ GpioUseSelValue = IoRead32 ((UINTN) (mPchGpioBase + R_PCH_GPIO_USE_SEL));
+ GpioIoSelValue = IoRead32 ((UINTN) (mPchGpioBase + R_PCH_GPIO_IO_SEL));
+ }
+
+ if (PchSeries == PchLp) {
+ GpioUseSelValue = IoRead32 ((UINTN) (mPchGpioBase + (R_PCH_GP_N_CONFIG0 + (SerialGpioPinIndex * 0x08))));
+ }
+
+ GpioBlinkValue = IoRead32 ((UINTN) (mPchGpioBase + R_PCH_GPIO_BLINK));
+ GpioSerBlinkValue = IoRead32 ((UINTN) (mPchGpioBase + R_PCH_GPIO_SER_BLINK));
+
+ SerialGpioInstance->RegistersToRecover.SavedGpioUseSelValue = GpioUseSelValue;
+ SerialGpioInstance->RegistersToRecover.SavedGpioBlinkValue = GpioBlinkValue;
+ SerialGpioInstance->RegistersToRecover.SavedGpioSerBlinkValue = GpioSerBlinkValue;
+ if (PchSeries == PchH) {
+ SerialGpioInstance->RegistersToRecover.SavedGpioIoSelValue = GpioIoSelValue;
+ }
+
+ ///
+ /// Modify settings in serial GPIO registers.
+ ///
+ ///
+ /// Serial GPIO will have to be selected as GPIO, not native
+ ///
+ if (PchSeries == PchH) {
+ GpioUseSelValue |= (1 << SerialGpioPinIndex);
+ }
+
+ if (PchSeries == PchLp) {
+ GpioUseSelValue |= B_PCH_GPIO_OWN0_GPIO_USE_SEL;
+ }
+
+ ///
+ /// Serial GPIO will have no Blink setting
+ ///
+ GpioBlinkValue &= (~(1 << SerialGpioPinIndex));
+
+ ///
+ /// Serial GPIO will have to enable serial Binlk setting
+ ///
+ GpioSerBlinkValue |= (1 << SerialGpioPinIndex);
+
+ ///
+ /// Serial GPIO will have to be output
+ ///
+ if (PchSeries == PchH) {
+ GpioIoSelValue &= (~(1 << SerialGpioPinIndex));
+ }
+
+ if (PchSeries == PchLp) {
+ GpioUseSelValue &= (~B_PCH_GPIO_OWN0_GPIO_IO_SEL);
+ }
+
+ if (WaitForSerialGpioNotBusy () != EFI_SUCCESS) {
+ return EFI_DEVICE_ERROR;
+ }
+
+ if (PchSeries == PchH) {
+ IoWrite32 ((UINTN) (mPchGpioBase + R_PCH_GPIO_USE_SEL), GpioUseSelValue);
+ IoWrite32 ((UINTN) (mPchGpioBase + R_PCH_GPIO_IO_SEL), GpioIoSelValue);
+ }
+
+ if (PchSeries == PchLp) {
+ IoWrite32 ((UINTN) (mPchGpioBase + (R_PCH_GP_N_CONFIG0 + (SerialGpioPinIndex * 0x08))), GpioUseSelValue);
+ }
+
+ IoWrite32 ((UINTN) (mPchGpioBase + R_PCH_GPIO_BLINK), GpioBlinkValue);
+ IoWrite32 ((UINTN) (mPchGpioBase + R_PCH_GPIO_SER_BLINK), GpioSerBlinkValue);
+
+ ///
+ /// Record this GPIO index to private data structure
+ ///
+ SerialGpioInstance->CurrentActiveSerialGpio = SerialGpioPinIndex;
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Unregister for one GPIO Pin that has been used as serial GPIO, and recover the registers before
+ registering.
+
+ @param[in] This Pointer to the EFI_SERIAL_GPIO_PROTOCOL instance.
+ @param[in] SerialGpioPinIndex The GPIO pin Index that will be used as serial GPIO for data sending.
+
+ @retval EFI_SUCCESS Opcode initialization on the SERIAL_GPIO host controller completed.
+ @retval EFI_ACCESS_DENIED The SERIAL_GPIO configuration interface is locked.
+ @retval EFI_OUT_OF_RESOURCES Not enough resource available to initialize the device.
+ @retval EFI_DEVICE_ERROR Device error, operation failed.
+ @retval EFI_INVALID_PARAMETER Invalid function parameters
+**/
+EFI_STATUS
+EFIAPI
+PchSerialGpioUnRegister (
+ IN EFI_SERIAL_GPIO_PROTOCOL *This,
+ IN UINT8 SerialGpioPinIndex
+ )
+{
+ UINT32 GpioSerBlinkValue;
+ UINT32 GpioUseSelValue;
+ UINT32 GpioIoSelValue;
+ UINT32 GpioBlinkValue;
+ SERIAL_GPIO_INSTANCE *SerialGpioInstance;
+ PCH_SERIES PchSeries;
+
+ SerialGpioInstance = SERIAL_GPIO_INSTANCE_FROM_SERIAL_GPIO_PROTOCOL (This);
+ if (SerialGpioInstance == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if ((SerialGpioPinIndex != SerialGpioInstance->CurrentActiveSerialGpio) ||
+ (SerialGpioPinIndex >= SERIAL_GPIO_MAX_PIN_NUMBER)
+ ) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ GpioUseSelValue = 0;
+ GpioIoSelValue = 0;
+ PchSeries = GetPchSeries();
+
+ GpioUseSelValue = SerialGpioInstance->RegistersToRecover.SavedGpioUseSelValue;
+ GpioBlinkValue = SerialGpioInstance->RegistersToRecover.SavedGpioBlinkValue;
+ GpioSerBlinkValue = SerialGpioInstance->RegistersToRecover.SavedGpioSerBlinkValue;
+
+ if (PchSeries == PchH) {
+ GpioIoSelValue = SerialGpioInstance->RegistersToRecover.SavedGpioIoSelValue;
+ }
+
+ ///
+ /// At least to clear the serial Blink property
+ ///
+ GpioSerBlinkValue &= (~(1 << SerialGpioInstance->CurrentActiveSerialGpio));
+
+ if (WaitForSerialGpioNotBusy () != EFI_SUCCESS) {
+ return EFI_DEVICE_ERROR;
+ }
+ ///
+ /// Write values with original values in serial GPIO registers.
+ ///
+
+ if (PchSeries == PchH) {
+ IoWrite32 ((UINTN) (mPchGpioBase + R_PCH_GPIO_USE_SEL), GpioUseSelValue);
+ IoWrite32 ((UINTN) (mPchGpioBase + R_PCH_GPIO_IO_SEL), GpioIoSelValue);
+ }
+
+ if (PchSeries == PchLp) {
+ IoWrite32 ((UINTN) (mPchGpioBase + (R_PCH_GP_N_CONFIG0 + (SerialGpioPinIndex * 0x08))), GpioUseSelValue);
+ }
+ IoWrite32 ((UINTN) (mPchGpioBase + R_PCH_GPIO_BLINK), GpioBlinkValue);
+ IoWrite32 ((UINTN) (mPchGpioBase + R_PCH_GPIO_SER_BLINK), GpioSerBlinkValue);
+
+ ///
+ /// Clear the GPIO index in private data structure
+ ///
+ SerialGpioInstance->CurrentActiveSerialGpio = SERIAL_GPIO_PIN_CLEARED;
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Execute SERIAL_GPIO commands from the host controller.
+
+ @param[in] This Pointer to the EFI_SERIAL_GPIO_PROTOCOL instance.
+ @param[in] GpioPinIndex Index of the GPIO pin.
+ @param[in] DataRate The data rate for serail data transfering. 1 ~ SERIAL_GPIO_MAX_DATA_RATE; 1: 128ns intervals; ...; 8: 8*128 = 1024ns intervals, default value;...
+ @param[in] DataCountInByte Number of bytes of the data will be transmitted through the GPIO pin.
+ @param[in, out] Buffer Pointer to caller-allocated buffer containing the dada sent through the GPIO pin.
+
+ @retval EFI_SUCCESS Execute succeed.
+ @retval EFI_INVALID_PARAMETER The parameters specified are not valid.
+ @retval EFI_DEVICE_ERROR Device error, GPIO serial data sent failed.
+**/
+EFI_STATUS
+EFIAPI
+PchSerialGpioSendData (
+ IN EFI_SERIAL_GPIO_PROTOCOL *This,
+ IN UINT8 GpioPinIndex,
+ IN UINT8 DataRate,
+ IN UINTN DataCountInByte,
+ IN OUT UINT8 *Buffer
+ )
+{
+ EFI_STATUS Status;
+ UINTN DataCountInDword;
+ UINTN DataCountLeftInByte;
+ UINTN Index;
+ UINT32 GpioSbCmdStsValue;
+ SERIAL_GPIO_INSTANCE *SerialGpioInstance;
+
+ SerialGpioInstance = SERIAL_GPIO_INSTANCE_FROM_SERIAL_GPIO_PROTOCOL (This);
+ if (SerialGpioInstance == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+ ///
+ /// Check if the parameters are valid.
+ ///
+ if ((Buffer == NULL) ||
+ (DataRate > SERIAL_GPIO_MAX_DATA_RATE) ||
+ (GpioPinIndex != SerialGpioInstance->CurrentActiveSerialGpio)
+ ) {
+ return EFI_INVALID_PARAMETER;
+ }
+ ///
+ /// Make sure it's safe to program the serial GPIO.
+ ///
+ if (WaitForSerialGpioNotBusy () != EFI_SUCCESS) {
+ return EFI_DEVICE_ERROR;
+ }
+ ///
+ /// set data rate
+ ///
+ GpioSbCmdStsValue = IoRead32 ((UINTN) (mPchGpioBase + R_PCH_GPIO_SB_CMDSTS));
+ GpioSbCmdStsValue &= (~B_PCH_GPIO_SB_CMDSTS_DRS_MASK);
+ GpioSbCmdStsValue |= (DataRate << 16);
+ IoWrite32 ((UINTN) (mPchGpioBase + R_PCH_GPIO_SB_CMDSTS), GpioSbCmdStsValue);
+ if (WaitForSerialGpioNotBusy () != EFI_SUCCESS) {
+ return EFI_DEVICE_ERROR;
+ }
+
+ DataCountInDword = DataCountInByte / 4;
+ DataCountLeftInByte = DataCountInByte % 4;
+ for (Index = 0; Index < DataCountInDword; Index++) {
+ Status = SendSerialGpioSend (
+ This,
+ EnumSerialGpioDataDword,
+ (Buffer + Index * 4)
+ );
+ if (EFI_ERROR (Status)) {
+ return EFI_DEVICE_ERROR;
+ }
+ }
+
+ for (Index = 0; Index < DataCountLeftInByte; Index++) {
+ Status = SendSerialGpioSend (
+ This,
+ EnumSerialGpioDataByte,
+ (Buffer + DataCountInDword * 4 + Index)
+ );
+ if (EFI_ERROR (Status)) {
+ return EFI_DEVICE_ERROR;
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This function sends the dword/word/byte through the serial GPIO pin.
+
+ @param[in] This Pointer to the EFI_SERIAL_GPIO_PROTOCOL instance.
+ @param[in] DataWidth The data width. 0: byte; 1: word; 2: reserved; 3: dword.
+ @param[in] Data Data buffer that contains the data (<= UINT32)
+
+ @retval EFI_SUCCESS SERIAL_GPIO command completes successfully.
+ @retval EFI_DEVICE_ERROR Device error, the command aborts abnormally.
+**/
+EFI_STATUS
+SendSerialGpioSend (
+ IN EFI_SERIAL_GPIO_PROTOCOL *This,
+ IN SERIAL_GPIO_DATA_WIDTH DataWidth,
+ IN UINT8 *Data
+ )
+{
+ UINT32 DataInDword;
+ UINT32 GpioSbCmdStsValue;
+
+ ///
+ /// Wait the SERIAL GPIO BUSY to be cleared.
+ ///
+ if (WaitForSerialGpioNotBusy () != EFI_SUCCESS) {
+ return EFI_DEVICE_ERROR;
+ }
+ ///
+ /// set data length
+ ///
+ GpioSbCmdStsValue = IoRead32 ((UINTN) (mPchGpioBase + R_PCH_GPIO_SB_CMDSTS));
+ GpioSbCmdStsValue &= (~B_PCH_GPIO_SB_CMDSTS_DLS_MASK);
+ GpioSbCmdStsValue |= (DataWidth << 22);
+ IoWrite32 ((UINTN) (mPchGpioBase + R_PCH_GPIO_SB_CMDSTS), GpioSbCmdStsValue);
+ ///
+ /// Set Data
+ ///
+ DataInDword = *(UINT32 *) Data;
+ IoWrite32 ((UINTN) (mPchGpioBase + R_PCH_GPIO_SB_DATA), DataInDword);
+ ///
+ /// Set GO to start transmit
+ ///
+ GpioSbCmdStsValue |= B_PCH_GPIO_SB_CMDSTS_GO;
+ IoWrite32 ((UINTN) (mPchGpioBase + R_PCH_GPIO_SB_CMDSTS), GpioSbCmdStsValue);
+ if (WaitForSerialGpioNotBusy () != EFI_SUCCESS) {
+ return EFI_DEVICE_ERROR;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Wait PCH serial GPIO Busy bit being cleared by PCH chipset.
+
+ @param[in] None.
+
+ @retval EFI_SUCCESS SERIAL GPIO BUSY bit is cleared.
+ @retval EFI_DEVICE_ERROR Time out while waiting the SERIAL GPIO BUSY bit to be cleared.
+ It's not safe to send next data block on the SERIAL GPIO interface.
+**/
+EFI_STATUS
+WaitForSerialGpioNotBusy (
+ VOID
+ )
+{
+ UINTN WaitTicks;
+ UINTN WaitCount;
+ UINT32 GpioSbCmdStsValue;
+
+ ///
+ /// Convert the wait period allowed into to tick count
+ ///
+ WaitCount = WAIT_TIME / WAIT_PERIOD;
+ ///
+ /// Wait for the SERIAL_GPIO cycle to complete.
+ ///
+ for (WaitTicks = 0; WaitTicks < WaitCount; WaitTicks++) {
+ GpioSbCmdStsValue = IoRead32 ((UINTN) (mPchGpioBase + R_PCH_GPIO_SB_CMDSTS));
+ if ((GpioSbCmdStsValue & B_PCH_GPIO_SB_CMDSTS_BUSY) == 0) {
+ return EFI_SUCCESS;
+ }
+
+ PchPmTimerStall (WAIT_PERIOD);
+ }
+
+ return EFI_DEVICE_ERROR;
+}
+
+/**
+ Entry point for the SERIAL_GPIO host controller driver.
+
+ @param[in] ImageHandle Image handle of this driver.
+ @param[in] SystemTable Global system service table.
+
+ @exception EFI_UNSUPPORTED The chipset is unsupported by this driver.
+ @retval EFI_SUCCESS Initialization complete.
+ @retval EFI_OUT_OF_RESOURCES Do not have enough resources to initialize the driver.
+ @retval EFI_DEVICE_ERROR Device error, driver exits abnormally.
+**/
+EFI_STATUS
+EFIAPI
+InstallPchSerialGpio (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ SERIAL_GPIO_INSTANCE *SerialGpioInstance;
+ UINT32 GpioSerBlinkValue;
+ UINT32 GpioUseSelValue;
+ UINT32 GpioIoSelValue;
+ UINT32 GpioBlinkValue;
+ PCH_SERIES PchSeries;
+
+ DEBUG ((EFI_D_INFO, "InstallPchSerialGpio() Start\n"));
+
+ ///
+ /// Locate CPU IO protocol
+ ///
+ if (!IsPchSupported ()) {
+ DEBUG ((EFI_D_ERROR, "SERIAL GPIO Protocol not supported due to no proper PCH LPC found!\n"));
+ return EFI_UNSUPPORTED;
+ }
+
+ GpioUseSelValue = 0;
+ GpioIoSelValue = 0;
+ PchSeries = GetPchSeries();
+
+ ///
+ /// PCH RCBA must be initialized prior to run this driver.
+ ///
+ mPchGpioBase = MmioRead16 (
+ MmPciAddress (0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_GPIO_BASE)
+ ) & B_PCH_LPC_GPIO_BASE_BAR;
+ ASSERT (mPchGpioBase != 0);
+
+ ///
+ /// Allocate Runtime memory for the SERIAL_GPIO protocol instance.
+ ///
+ SerialGpioInstance = AllocateRuntimePool (sizeof (SERIAL_GPIO_INSTANCE));
+ if (SerialGpioInstance == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ if (PchSeries == PchH) {
+ GpioUseSelValue = IoRead32 ((UINTN) (mPchGpioBase + R_PCH_GPIO_USE_SEL));
+ GpioIoSelValue = IoRead32 ((UINTN) (mPchGpioBase + R_PCH_GPIO_IO_SEL));
+ }
+ GpioBlinkValue = IoRead32 ((UINTN) (mPchGpioBase + R_PCH_GPIO_BLINK));
+ GpioSerBlinkValue = IoRead32 ((UINTN) (mPchGpioBase + R_PCH_GPIO_SER_BLINK));
+ SerialGpioInstance->Signature = PCH_SERIAL_GPIO_PRIVATE_DATA_SIGNATURE;
+ SerialGpioInstance->Handle = NULL;
+ SerialGpioInstance->CurrentActiveSerialGpio = SERIAL_GPIO_PIN_CLEARED;
+
+ if (PchSeries == PchH) {
+ SerialGpioInstance->RegistersToRecover.SavedGpioUseSelValue = GpioUseSelValue;
+ SerialGpioInstance->RegistersToRecover.SavedGpioIoSelValue = GpioIoSelValue;
+ }
+ SerialGpioInstance->RegistersToRecover.SavedGpioBlinkValue = GpioBlinkValue;
+ SerialGpioInstance->RegistersToRecover.SavedGpioSerBlinkValue = GpioSerBlinkValue;
+
+ SerialGpioInstance->SerialGpioProtocol.SerialGpioRegister = PchSerialGpioRegister;
+ SerialGpioInstance->SerialGpioProtocol.SerialGpioSendData = PchSerialGpioSendData;
+ SerialGpioInstance->SerialGpioProtocol.SerialGpioUnRegister = PchSerialGpioUnRegister;
+ ///
+ /// Install the EFI_SERIAL_GPIO_PROTOCOL interface
+ ///
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &(SerialGpioInstance->Handle),
+ &gEfiSerialGpioProtocolGuid,
+ &(SerialGpioInstance->SerialGpioProtocol),
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ FreePool (SerialGpioInstance);
+ return EFI_DEVICE_ERROR;
+ }
+
+ DEBUG ((EFI_D_INFO, "InstallPchSerialGpio() End\n"));
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/SerialGpio/Dxe/PchSerialGpio.cif b/ReferenceCode/Chipset/LynxPoint/SerialGpio/Dxe/PchSerialGpio.cif
new file mode 100644
index 0000000..9df0226
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SerialGpio/Dxe/PchSerialGpio.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "PchSerialGpio"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\SerialGpio\Dxe"
+ RefName = "PchSerialGpio"
+[files]
+"PchSerialGpio.sdl"
+"PchSerialGpio.mak"
+"PchSerialGpio.c"
+"PchSerialGpio.h"
+"PchSerialGpio.dxs"
+"PchSerialGpio.inf"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/SerialGpio/Dxe/PchSerialGpio.dxs b/ReferenceCode/Chipset/LynxPoint/SerialGpio/Dxe/PchSerialGpio.dxs
new file mode 100644
index 0000000..7a9a510
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SerialGpio/Dxe/PchSerialGpio.dxs
@@ -0,0 +1,39 @@
+/** @file
+ Dependency expression source file.
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "DxeDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+#endif
+
+DEPENDENCY_START
+ TRUE
+DEPENDENCY_END
diff --git a/ReferenceCode/Chipset/LynxPoint/SerialGpio/Dxe/PchSerialGpio.h b/ReferenceCode/Chipset/LynxPoint/SerialGpio/Dxe/PchSerialGpio.h
new file mode 100644
index 0000000..d882ada
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SerialGpio/Dxe/PchSerialGpio.h
@@ -0,0 +1,193 @@
+/** @file
+ Header file for the PCH SERIAL GPIO Driver.
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PCH_SERIAL_GPIO_H_
+#define _PCH_SERIAL_GPIO_H_
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+
+#include "EdkIIGlueDxe.h"
+
+//
+// Driver Produced Protocols
+//
+#include EFI_PROTOCOL_PRODUCER (SerialGpio)
+#include "PchAccess.h"
+#include "PchPlatformLib.h"
+#endif
+///
+/// Private data structure definitions for the driver
+///
+#define PCH_SERIAL_GPIO_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('S', 'G', 'P', 'O')
+
+#define SERIAL_GPIO_INSTANCE_FROM_SERIAL_GPIO_PROTOCOL(a) \
+ CR ( \
+ a, \
+ SERIAL_GPIO_INSTANCE, \
+ SerialGpioProtocol, \
+ PCH_SERIAL_GPIO_PRIVATE_DATA_SIGNATURE \
+ )
+
+///
+/// Only when CurrentActiveSerialGpio == SERIAL_GPIO_PIN_CLEARED,
+/// can the next GPIO be register as serail GPIO using SerialGpioProtocol
+///
+#define SERIAL_GPIO_PIN_CLEARED 0xFF
+///
+/// This is the old values in GPIO related registers for recovery when unregister this serial GPIO pin.
+///
+typedef struct {
+ UINT32 SavedGpioUseSelValue;
+ UINT32 SavedGpioBlinkValue;
+ UINT32 SavedGpioSerBlinkValue;
+ UINT32 SavedGpioIoSelValue;
+} SERIAL_GPIO_REGISTERS_TO_RECOVER;
+
+typedef struct {
+ UINTN Signature;
+ EFI_HANDLE Handle;
+ UINT8 CurrentActiveSerialGpio; ///< can only have one pin at one time
+ SERIAL_GPIO_REGISTERS_TO_RECOVER RegistersToRecover;
+ EFI_SERIAL_GPIO_PROTOCOL SerialGpioProtocol;
+} SERIAL_GPIO_INSTANCE;
+
+//
+// Function prototypes used by the SERIAL_GPIO protocol.
+//
+
+/**
+ Register for one GPIO Pin that will be used as serial GPIO.
+ For PCH only GPIO0~31 will have the capability to be used as serail GPIO.
+ The caller of this procedure need to be very clear of whPch GPIO should be used as serail GPIO,
+ it should not be input, native, conflict with other GPIO, or Index > 31 on the caller's platform.
+
+ @param[in] This Pointer to the EFI_SERIAL_GPIO_PROTOCOL instance.
+ @param[in] SerialGpioPinIndex The GPIO pin Index that will be used as serial GPIO for data sending.
+
+ @retval EFI_SUCCESS Opcode initialization on the SERIAL_GPIO host controller completed.
+ @retval EFI_ACCESS_DENIED The SERIAL_GPIO configuration interface is locked.
+ @retval EFI_OUT_OF_RESOURCES Not enough resource available to initialize the device.
+ @retval EFI_DEVICE_ERROR Device error, operation failed.
+ @retval EFI_INVALID_PARAMETER SerialGpioPinIndex is out of range
+**/
+EFI_STATUS
+EFIAPI
+PchSerialGpioRegister (
+ IN EFI_SERIAL_GPIO_PROTOCOL *This,
+ IN UINT8 SerialGpioPinIndex
+ );
+
+/**
+ Unregister for one GPIO Pin that has been used as serial GPIO, and recover the registers before
+ registering.
+
+ @param[in] This Pointer to the EFI_SERIAL_GPIO_PROTOCOL instance.
+ @param[in] SerialGpioPinIndex The GPIO pin Index that will be used as serial GPIO for data sending.
+
+ @retval EFI_SUCCESS Opcode initialization on the SERIAL_GPIO host controller completed.
+ @retval EFI_ACCESS_DENIED The SERIAL_GPIO configuration interface is locked.
+ @retval EFI_OUT_OF_RESOURCES Not enough resource available to initialize the device.
+ @retval EFI_DEVICE_ERROR Device error, operation failed.
+ @retval EFI_INVALID_PARAMETER Invalid function parameters
+**/
+EFI_STATUS
+EFIAPI
+PchSerialGpioUnRegister (
+ IN EFI_SERIAL_GPIO_PROTOCOL *This,
+ IN UINT8 SerialGpioPinIndex
+ );
+
+/**
+ Execute SERIAL_GPIO commands from the host controller.
+
+ @param[in] This Pointer to the EFI_SERIAL_GPIO_PROTOCOL instance.
+ @param[in] GpioPinIndex Index of the GPIO pin.
+ @param[in] DataRate The data rate for serail data transfering. 1 ~ SERIAL_GPIO_MAX_DATA_RATE; 1: 128ns intervals; ...; 8: 8*128 = 1024ns intervals, default value;...
+ @param[in] DataCountInByte Number of bytes of the data will be transmitted through the GPIO pin.
+ @param[in, out] Buffer Pointer to caller-allocated buffer containing the dada sent through the GPIO pin.
+
+ @retval EFI_SUCCESS Execute succeed.
+ @retval EFI_INVALID_PARAMETER The parameters specified are not valid.
+ @retval EFI_DEVICE_ERROR Device error, GPIO serial data sent failed.
+**/
+EFI_STATUS
+EFIAPI
+PchSerialGpioSendData (
+ IN EFI_SERIAL_GPIO_PROTOCOL *This,
+ IN UINT8 GpioPinIndex,
+ IN UINT8 DataRate,
+ IN UINTN DataCountInByte,
+ IN OUT UINT8 *Buffer
+ );
+
+/**
+ This function sends the dword/word/byte through the serial GPIO pin.
+
+ @param[in] This Pointer to the EFI_SERIAL_GPIO_PROTOCOL instance.
+ @param[in] DataWidth The data width. 0: byte; 1: word; 2: reserved; 3: dword.
+ @param[in] Data Data buffer that contains the data (<= UINT32)
+
+ @retval EFI_SUCCESS SERIAL_GPIO command completes successfully.
+ @retval EFI_DEVICE_ERROR Device error, the command aborts abnormally.
+**/
+EFI_STATUS
+SendSerialGpioSend (
+ IN EFI_SERIAL_GPIO_PROTOCOL *This,
+ IN SERIAL_GPIO_DATA_WIDTH DataWidth,
+ IN UINT8 *Data
+ );
+
+/**
+ Wait PCH serial GPIO Busy bit being cleared by PCH chipset.
+
+ @param[in] None.
+
+ @retval EFI_SUCCESS SERIAL GPIO BUSY bit is cleared.
+ @retval EFI_DEVICE_ERROR Time out while waiting the SERIAL GPIO BUSY bit to be cleared.
+ It's not safe to send next data block on the SERIAL GPIO interface.
+**/
+EFI_STATUS
+WaitForSerialGpioNotBusy (
+ VOID
+ );
+
+/**
+ Entry point for the SERIAL_GPIO host controller driver.
+
+ @param[in] ImageHandle Image handle of this driver.
+ @param[in] SystemTable Global system service table.
+
+ @exception EFI_UNSUPPORTED The chipset is unsupported by this driver.
+ @retval EFI_SUCCESS Initialization complete.
+ @retval EFI_OUT_OF_RESOURCES Do not have enough resources to initialize the driver.
+ @retval EFI_DEVICE_ERROR Device error, driver exits abnormally.
+**/
+EFI_STATUS
+EFIAPI
+InstallPchSerialGpio (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ );
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/SerialGpio/Dxe/PchSerialGpio.inf b/ReferenceCode/Chipset/LynxPoint/SerialGpio/Dxe/PchSerialGpio.inf
new file mode 100644
index 0000000..508c09d
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SerialGpio/Dxe/PchSerialGpio.inf
@@ -0,0 +1,79 @@
+## @file
+# Component description file for the PCH serial GPIO driver.
+#
+#@copyright
+# Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = PchSerialGpio
+FILE_GUID = FC1B7640-3466-4c06-B1CC-1C935394B5C2
+COMPONENT_TYPE = BS_DRIVER
+
+[sources.common]
+ PchSerialGpio.h
+ PchSerialGpio.c
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueDxeDriverEntryPoint.c
+
+[includes.common]
+ .
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[libraries.common]
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueDxeReportStatusCodeLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueDxeMemoryAllocationLib
+ EdkIIGlueBasePciLibPciExpress
+ EdkProtocolLib
+ $(PROJECT_PCH_FAMILY)ProtocolLib
+ PchPlatformLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = PchSerialGpio.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=InstallPchSerialGpio
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ -D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__
diff --git a/ReferenceCode/Chipset/LynxPoint/SerialGpio/Dxe/PchSerialGpio.mak b/ReferenceCode/Chipset/LynxPoint/SerialGpio/Dxe/PchSerialGpio.mak
new file mode 100644
index 0000000..21383c0
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SerialGpio/Dxe/PchSerialGpio.mak
@@ -0,0 +1,96 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSerialGpio/PchSerialGpio.mak 2 2/24/12 2:20a Victortu $
+#
+# $Revision: 2 $
+#
+# $Date: 2/24/12 2:20a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSerialGpio/PchSerialGpio.mak $
+#
+# 2 2/24/12 2:20a Victortu
+# Updated to support 4.6.5.3_IntelEDK_1117_Patch7_00.
+#
+# 1 2/08/12 9:15a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+
+#---------------------------------------------------------------------------
+# Create PchSerialGpio Driver
+#---------------------------------------------------------------------------
+EDK : PchSerialGpio
+PchSerialGpio : $(BUILD_DIR)\PchSerialGpio.mak PchSerialGpioBin
+
+$(BUILD_DIR)\PchSerialGpio.mak : $(PchSerialGpio_DIR)\$(@B).cif $(PchSerialGpio_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(PchSerialGpio_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+PchSerialGpio_INCLUDES=\
+ $(INTEL_PCH_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+
+PchSerialGpio_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=InstallPchSerialGpio"\
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__
+
+PchSerialGpio_LIB_LINKS =\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueDxeMemoryAllocationLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(EDKPROTOCOLLIB)\
+ $(INTEL_PCH_PROTOCOL_LIB)\
+ $(PchPlatformDxeLib_LIB)
+
+PchSerialGpioBin: $(PchSerialGpio_LIB_LINKS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\PchSerialGpio.mak all \
+ "MY_INCLUDES=$(PchSerialGpio_INCLUDES)"\
+ "MY_DEFINES=$(PchSerialGpio_DEFINES)"\
+ GUID=FC1B7640-3466-4c06-B1CC-1C935394B5C2\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=BS_DRIVER\
+ EDKIIModule=DXEDRIVER\
+ DEPEX1=$(PchSerialGpio_DIR)\PchSerialGpio.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX\
+ COMPRESS=1
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/SerialGpio/Dxe/PchSerialGpio.sdl b/ReferenceCode/Chipset/LynxPoint/SerialGpio/Dxe/PchSerialGpio.sdl
new file mode 100644
index 0000000..d7095d3
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SerialGpio/Dxe/PchSerialGpio.sdl
@@ -0,0 +1,67 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSerialGpio/PchSerialGpio.sdl 1 2/08/12 9:15a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 9:15a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSerialGpio/PchSerialGpio.sdl $
+#
+# 1 2/08/12 9:15a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+TOKEN
+ Name = "PchSerialGpio_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable PchSerialGpio support in Project"
+End
+
+PATH
+ Name = "PchSerialGpio_DIR"
+ Help = "PchSerialGpio file source directory"
+End
+
+MODULE
+ File = "PchSerialGpio.mak"
+ Help = "Includes PchSerialGpio.mak to Project"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PchSerialGpio.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/SmartTimer/Dxe/SmartTimer.c b/ReferenceCode/Chipset/LynxPoint/SmartTimer/Dxe/SmartTimer.c
new file mode 100644
index 0000000..2d97c7a
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SmartTimer/Dxe/SmartTimer.c
@@ -0,0 +1,523 @@
+/** @file
+ Timer Architectural Protocol as defined in the DXE CIS
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "SmartTimer.h"
+
+///
+/// The handle onto which the Timer Architectural Protocol will be installed
+///
+EFI_HANDLE mTimerHandle = NULL;
+
+///
+/// The Timer Architectural Protocol that this driver produces
+///
+EFI_TIMER_ARCH_PROTOCOL mTimer = {
+ TimerDriverRegisterHandler,
+ TimerDriverSetTimerPeriod,
+ TimerDriverGetTimerPeriod,
+ TimerDriverGenerateSoftInterrupt
+};
+
+///
+/// Pointer to the CPU Architectural Protocol instance
+///
+EFI_CPU_ARCH_PROTOCOL *mCpu;
+
+///
+/// Pointer to the Legacy 8259 Protocol instance
+///
+EFI_LEGACY_8259_PROTOCOL *mLegacy8259;
+
+///
+/// The notification function to call on every timer interrupt.
+/// A bug in the compiler prevents us from initializing this here.
+///
+volatile EFI_TIMER_NOTIFY mTimerNotifyFunction;
+
+///
+/// The current period of the timer interrupt
+///
+volatile UINT64 mTimerPeriod = 0;
+
+///
+/// The time of twice timer interrupt duration
+///
+volatile UINTN mPreAcpiTick = 0;
+
+///
+/// PMIO BAR Registers
+///
+UINT16 mPchPmioBase;
+
+//
+// Worker Functions
+//
+
+/**
+ Sets the counter value for Timer #0 in a legacy 8254 timer.
+
+ @param[in] Count The 16-bit counter value to program into Timer #0 of the legacy 8254 timer.
+
+ @retval None
+**/
+VOID
+SetPitCount (
+ IN UINT16 Count
+ )
+{
+ UINT8 Data;
+ ///
+ /// 0x36 = Read/Write counter LSB then MSB, Mode3 square wave output from this timer.
+ /// Check register Counter Access Ports Register(0x40/41/42 for counter0/1/2) in PCH B0D31F0
+ /// check Counter Operating Mode 0~5 at 8254 Timer function description in LPC in EDS.
+ ///
+ Data = 0x36;
+ IoWrite8 (TIMER_CONTROL_PORT, Data);
+ IoWrite8 (TIMER0_COUNT_PORT, (UINT8) Count);
+ IoWrite8 (TIMER0_COUNT_PORT, (UINT8) (Count >> 8));
+}
+
+/**
+ Get the current ACPI counter's value
+
+ @param[in] None
+
+ @retval UINT32 The value of the counter
+**/
+UINT32
+GetAcpiTick (
+ VOID
+ )
+{
+ UINT32 Tick;
+
+ Tick = IoRead32 ((UINTN) (mPchPmioBase + R_PCH_ACPI_PM1_TMR));
+ return Tick;
+
+}
+
+/**
+ Measure the 8254 timer interrupt use the ACPI time counter
+
+ @param[in] TimePeriod The current period of the timer interrupt
+
+ @retval UINT64 The real system time pass between the sequence 8254 timer
+ interrupt
+**/
+UINT64
+MeasureTimeLost (
+ IN UINT64 TimePeriod
+ )
+{
+ UINT32 CurrentTick;
+ UINT32 EndTick;
+ UINT64 LostTime;
+
+ CurrentTick = GetAcpiTick ();
+ EndTick = CurrentTick;
+
+ if (CurrentTick < mPreAcpiTick) {
+ EndTick = CurrentTick + 0x1000000;
+ }
+ ///
+ /// The calculation of the lost system time should be very accurate, we use
+ /// the shift calcu to make sure the value's accurate:
+ /// the origenal formula is:
+ /// (EndTick - mPreAcpiTick) * 10,000,000
+ /// LostTime = -----------------------------------------------
+ /// (3,579,545 Hz / 1,193,182 Hz) * 1,193,182 Hz
+ ///
+ /// Note: the 3,579,545 Hz is the ACPI timer's clock;
+ /// the 1,193,182 Hz is the 8254 timer's clock;
+ ///
+ LostTime = RShiftU64 (
+ MultU64x32 ((UINT64) (EndTick - mPreAcpiTick),
+ 46869689) + 0x00FFFFFF,
+ 24
+ );
+
+ if (LostTime != 0) {
+ mPreAcpiTick = CurrentTick;
+ }
+
+ return LostTime;
+}
+
+/**
+ 8254 Timer #0 Interrupt Handler
+
+ @param[in] InterruptType The type of interrupt that occured
+ @param[in] SystemContext A pointer to the system context when the interrupt occured
+
+ @retval None
+**/
+VOID
+EFIAPI
+TimerInterruptHandler (
+ IN EFI_EXCEPTION_TYPE InterruptType,
+ IN EFI_SYSTEM_CONTEXT SystemContext
+ )
+{
+ EFI_TPL OriginalTPL;
+
+ OriginalTPL = gBS->RaiseTPL (TPL_HIGH_LEVEL);
+
+ mLegacy8259->EndOfInterrupt (mLegacy8259, Efi8259Irq0);
+
+ if (mTimerNotifyFunction) {
+ ///
+ /// If we have the timer interrupt miss, then we use
+ /// the platform ACPI time counter to retrieve the time lost
+ ///
+ mTimerNotifyFunction (MeasureTimeLost (mTimerPeriod));
+ }
+
+ gBS->RestoreTPL (OriginalTPL);
+}
+
+/**
+ This function registers the handler NotifyFunction so it is called every time
+ the timer interrupt fires. It also passes the amount of time since the last
+ handler call to the NotifyFunction. If NotifyFunction is NULL, then the
+ handler is unregistered. If the handler is registered, then EFI_SUCCESS is
+ returned. If the CPU does not support registering a timer interrupt handler,
+ then EFI_UNSUPPORTED is returned. If an attempt is made to register a handler
+ when a handler is already registered, then EFI_ALREADY_STARTED is returned.
+ If an attempt is made to unregister a handler when a handler is not registered,
+ then EFI_INVALID_PARAMETER is returned. If an error occurs attempting to
+ register the NotifyFunction with the timer interrupt, then EFI_DEVICE_ERROR
+ is returned.
+
+ @param[in] This The EFI_TIMER_ARCH_PROTOCOL instance.
+ @param[in] NotifyFunction The function to call when a timer interrupt fires. This
+ function executes at TPL_HIGH_LEVEL. The DXE Core will
+ register a handler for the timer interrupt, so it can know
+ how much time has passed. This information is used to
+ signal timer based events. NULL will unregister the handler.
+
+ @retval EFI_SUCCESS The timer handler was registered.
+ @exception EFI_UNSUPPORTED The CPU does not support registering a timer interrupt handler
+ @retval EFI_ALREADY_STARTED NotifyFunction is not NULL, and a handler is already registered.
+ @retval EFI_INVALID_PARAMETER NotifyFunction is NULL, and a handler was not previously registered.
+**/
+EFI_STATUS
+EFIAPI
+TimerDriverRegisterHandler (
+ IN EFI_TIMER_ARCH_PROTOCOL *This,
+ IN EFI_TIMER_NOTIFY NotifyFunction
+ )
+{
+ ///
+ /// If an attempt is made to unregister a handler when a handler is not registered,
+ /// then EFI_INVALID_PARAMETER is returned.
+ ///
+ if (mTimerNotifyFunction == NULL && NotifyFunction == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+ ///
+ /// If an attempt is made to register a handler
+ /// when a handler is already registered, then EFI_ALREADY_STARTED is returned.
+ ///
+ if (mTimerNotifyFunction != NULL && NotifyFunction != NULL) {
+ return EFI_ALREADY_STARTED;
+ }
+ ///
+ /// If the CPU does not support registering a timer interrupt handler, then EFI_UNSUPPORTED is returned.
+ ///
+ if (mCpu == NULL || mLegacy8259 == NULL) {
+ return EFI_UNSUPPORTED;
+ }
+
+ if (NotifyFunction == NULL) {
+ ///
+ /// If NotifyFunction is NULL, then the handler is unregistered.
+ ///
+ mTimerNotifyFunction = NULL;
+ } else {
+ mTimerNotifyFunction = NotifyFunction;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This function adjusts the period of timer interrupts to the value specified
+ by TimerPeriod. If the timer period is updated, then the selected timer
+ period is stored in EFI_TIMER.TimerPeriod, and EFI_SUCCESS is returned. If
+ the timer hardware is not programmable, then EFI_UNSUPPORTED is returned.
+ If an error occurs while attempting to update the timer period, then the
+ timer hardware will be put back in its state prior to this call, and
+ EFI_DEVICE_ERROR is returned. If TimerPeriod is 0, then the timer interrupt
+ is disabled. This is not the same as disabling the CPU's interrupts.
+ Instead, it must either turn off the timer hardware, or it must adjust the
+ interrupt controller so that a CPU interrupt is not generated when the timer
+ interrupt fires.
+
+ @param[in] This The EFI_TIMER_ARCH_PROTOCOL instance.
+ @param[in] TimerPeriod The rate to program the timer interrupt in 100 nS units. If
+ the timer hardware is not programmable, then EFI_UNSUPPORTED is
+ returned. If the timer is programmable, then the timer period
+ will be rounded up to the nearest timer period that is supported
+ by the timer hardware. If TimerPeriod is set to 0, then the
+ timer interrupts will be disabled.
+
+ @retval EFI_SUCCESS The timer period was changed.
+**/
+EFI_STATUS
+EFIAPI
+TimerDriverSetTimerPeriod (
+ IN EFI_TIMER_ARCH_PROTOCOL *This,
+ IN UINT64 TimerPeriod
+ )
+{
+ UINT64 TimerCount;
+
+ ///
+ /// The basic clock is 1.19318 MHz or 0.119318 ticks per 100 ns.
+ /// TimerPeriod * 0.119318 = 8254 timer divisor. Using integer arithmetic
+ /// TimerCount = (TimerPeriod * 119318)/1000000.
+ ///
+ /// Round up to next highest integer. This guarantees that the timer is
+ /// equal to or slightly longer than the requested time.
+ /// TimerCount = ((TimerPeriod * 119318) + 500000)/1000000
+ ///
+ /// Note that a TimerCount of 0 is equivalent to a count of 65,536
+ ///
+ /// Since TimerCount is limited to 16 bits for IA32, TimerPeriod is limited
+ /// to 20 bits.
+ ///
+ if (TimerPeriod == 0) {
+ ///
+ /// Disable timer interrupt for a TimerPeriod of 0
+ ///
+ mLegacy8259->DisableIrq (mLegacy8259, Efi8259Irq0);
+ } else {
+ ///
+ /// Convert TimerPeriod into 8254 counts
+ ///
+ TimerCount = DivU64x32Remainder (MultU64x32 (119318, (UINT32) TimerPeriod) + 500000, 1000000, 0);
+
+ ///
+ /// Check for overflow
+ ///
+ if (TimerCount >= 65536) {
+ TimerCount = 0;
+ if (TimerPeriod >= DEFAULT_TIMER_TICK_DURATION) {
+ TimerPeriod = DEFAULT_TIMER_TICK_DURATION;
+ }
+ }
+ ///
+ /// Program the 8254 timer with the new count value
+ ///
+ SetPitCount ((UINT16) TimerCount);
+
+ ///
+ /// Enable timer interrupt
+ ///
+ mLegacy8259->EnableIrq (mLegacy8259, Efi8259Irq0, FALSE);
+ }
+ ///
+ /// Save the new timer period
+ ///
+ mTimerPeriod = TimerPeriod;
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This function retrieves the period of timer interrupts in 100 ns units,
+ returns that value in TimerPeriod, and returns EFI_SUCCESS. If TimerPeriod
+ is NULL, then EFI_INVALID_PARAMETER is returned. If a TimerPeriod of 0 is
+ returned, then the timer is currently disabled.
+
+ @param[in] This The EFI_TIMER_ARCH_PROTOCOL instance.
+ @param[out] TimerPeriod A pointer to the timer period to retrieve in 100 ns units.
+ If 0 is returned, then the timer is currently disabled.
+
+ @retval EFI_SUCCESS The timer period was returned in TimerPeriod.
+ @retval EFI_INVALID_PARAMETER TimerPeriod is NULL.
+**/
+EFI_STATUS
+EFIAPI
+TimerDriverGetTimerPeriod (
+ IN EFI_TIMER_ARCH_PROTOCOL *This,
+ OUT UINT64 *TimerPeriod
+ )
+{
+ if (TimerPeriod == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ *TimerPeriod = mTimerPeriod;
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This function generates a soft timer interrupt. If the platform does not support soft
+ timer interrupts, then EFI_UNSUPPORTED is returned. Otherwise, EFI_SUCCESS is returned.
+ If a handler has been registered through the EFI_TIMER_ARCH_PROTOCOL.RegisterHandler()
+ service, then a soft timer interrupt will be generated. If the timer interrupt is
+ enabled when this service is called, then the registered handler will be invoked. The
+ registered handler should not be able to distinguish a hardware-generated timer
+ interrupt from a software-generated timer interrupt.
+
+ @param[in] This The EFI_TIMER_ARCH_PROTOCOL instance.
+
+ @retval EFI_SUCCESS The soft timer interrupt was generated.
+**/
+EFI_STATUS
+EFIAPI
+TimerDriverGenerateSoftInterrupt (
+ IN EFI_TIMER_ARCH_PROTOCOL *This
+ )
+{
+ EFI_STATUS Status;
+ UINT16 IRQMask;
+ EFI_TPL OriginalTPL;
+
+ DEBUG ((EFI_D_INFO, "TimerDriverGenerateSoftInterrupt() Start\n"));
+
+ ///
+ /// If the timer interrupt is enabled, then the registered handler will be invoked.
+ ///
+ Status = mLegacy8259->GetMask (mLegacy8259, NULL, NULL, &IRQMask, NULL);
+ ASSERT_EFI_ERROR (Status);
+ if ((IRQMask & 0x1) == 0) {
+ ///
+ /// Invoke the registered handler
+ ///
+ OriginalTPL = gBS->RaiseTPL (TPL_HIGH_LEVEL);
+
+ if (mTimerNotifyFunction) {
+ ///
+ /// We use the platform ACPI time counter to determine
+ /// the amount of time that has passed
+ ///
+ mTimerNotifyFunction (MeasureTimeLost (mTimerPeriod));
+ }
+
+ gBS->RestoreTPL (OriginalTPL);
+ }
+
+ DEBUG ((EFI_D_INFO, "TimerDriverGenerateSoftInterrupt() End\n"));
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Initialize the Timer Architectural Protocol driver
+
+ @param[in] ImageHandle ImageHandle of the loaded driver
+ @param[in] SystemTable Pointer to the System Table
+
+ @retval EFI_SUCCESS Timer Architectural Protocol created
+ @retval Other Failed
+**/
+EFI_STATUS
+EFIAPI
+TimerDriverInitialize (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ UINT32 TimerVector;
+
+ DEBUG ((EFI_D_INFO, "TimerDriverInitialize() Start\n"));
+
+ ///
+ /// Initialize the pointer to our notify function.
+ ///
+ mTimerNotifyFunction = NULL;
+ mCpu = NULL;
+ mLegacy8259 = NULL;
+
+ ///
+ /// Make sure the Timer Architectural Protocol is not already installed in the system
+ ///
+ ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiTimerArchProtocolGuid);
+
+ ///
+ /// Find the CPU architectural protocol. ASSERT if not found.
+ ///
+ Status = gBS->LocateProtocol (&gEfiCpuArchProtocolGuid, NULL, (VOID **) &mCpu);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Find the Legacy8259 protocol. ASSERT if not found.
+ ///
+ Status = gBS->LocateProtocol (&gEfiLegacy8259ProtocolGuid, NULL, (VOID **) &mLegacy8259);
+ ASSERT_EFI_ERROR (Status);
+
+ mPchPmioBase = MmioRead16 (
+ MmPciAddress (0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_ACPI_BASE)
+ ) & B_PCH_LPC_ACPI_BASE_BAR;
+ ASSERT (mPchPmioBase != 0);
+ ///
+ /// Force the timer to be disabled
+ ///
+ Status = TimerDriverSetTimerPeriod (&mTimer, 0);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Get the interrupt vector number corresponding to IRQ0 from the 8259 driver
+ ///
+ TimerVector = 0;
+ Status = mLegacy8259->GetVector (mLegacy8259, Efi8259Irq0, (UINT8 *) &TimerVector);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Install interrupt handler for 8254 Timer #0 (ISA IRQ0)
+ ///
+ Status = mCpu->RegisterInterruptHandler (mCpu, TimerVector, TimerInterruptHandler);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Force the timer to be enabled at its default period
+ ///
+ Status = TimerDriverSetTimerPeriod (&mTimer, DEFAULT_TIMER_TICK_DURATION);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Begin the ACPI timer counter
+ ///
+ mPreAcpiTick = GetAcpiTick ();
+
+ ///
+ /// Install the Timer Architectural Protocol onto a new handle
+ ///
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &mTimerHandle,
+ &gEfiTimerArchProtocolGuid,
+ &mTimer,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ DEBUG ((EFI_D_INFO, "TimerDriverInitialize() End\n"));
+
+ return Status;
+} \ No newline at end of file
diff --git a/ReferenceCode/Chipset/LynxPoint/SmartTimer/Dxe/SmartTimer.cif b/ReferenceCode/Chipset/LynxPoint/SmartTimer/Dxe/SmartTimer.cif
new file mode 100644
index 0000000..dc6239c
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SmartTimer/Dxe/SmartTimer.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "SmartTimer"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\SmartTimer\Dxe"
+ RefName = "SmartTimer"
+[files]
+"SmartTimer.sdl"
+"SmartTimer.mak"
+"SmartTimer.h"
+"SmartTimer.c"
+"SmartTimer.dxs"
+"SmartTimer.inf"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/SmartTimer/Dxe/SmartTimer.dxs b/ReferenceCode/Chipset/LynxPoint/SmartTimer/Dxe/SmartTimer.dxs
new file mode 100644
index 0000000..bca8dd7
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SmartTimer/Dxe/SmartTimer.dxs
@@ -0,0 +1,42 @@
+/** @file
+ Dependency expression source file.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "DxeDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+
+#include EFI_ARCH_PROTOCOL_DEFINITION (Cpu)
+#include EFI_PROTOCOL_DEFINITION (Legacy8259)
+#endif
+
+DEPENDENCY_START
+ EFI_CPU_ARCH_PROTOCOL_GUID AND EFI_LEGACY_8259_PROTOCOL_GUID
+DEPENDENCY_END
diff --git a/ReferenceCode/Chipset/LynxPoint/SmartTimer/Dxe/SmartTimer.h b/ReferenceCode/Chipset/LynxPoint/SmartTimer/Dxe/SmartTimer.h
new file mode 100644
index 0000000..d691a29
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SmartTimer/Dxe/SmartTimer.h
@@ -0,0 +1,178 @@
+/** @file
+ Private data structures
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _SMARTTIMER_H_
+#define _SMARTTIMER_H_
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+
+#include "EdkIIGlueDxe.h"
+#include "PchAccess.h"
+
+//
+// Consumed Protocols
+//
+#include EFI_ARCH_PROTOCOL_CONSUMER (Cpu)
+#include EFI_PROTOCOL_CONSUMER (Legacy8259)
+//
+// Produced Protocols
+//
+#include EFI_ARCH_PROTOCOL_PRODUCER (Timer)
+#endif
+///
+/// The PCAT 8253/8254 has an input clock at 1.193182 MHz and Timer 0 is
+/// initialized as a 16 bit free running counter that generates an interrupt(IRQ0)
+/// each time the counter rolls over.
+///
+/// 65536 counts
+/// ---------------- * 1,000,000 uS/S = 54925.4 uS = 549254 * 100 ns
+/// 1,193,182 Hz
+///
+#define DEFAULT_TIMER_TICK_DURATION 549254
+#define TIMER_CONTROL_PORT 0x43
+#define TIMER0_COUNT_PORT 0x40
+
+//
+// Function Prototypes
+//
+
+/**
+ Initialize the Timer Architectural Protocol driver
+
+ @param[in] ImageHandle ImageHandle of the loaded driver
+ @param[in] SystemTable Pointer to the System Table
+
+ @retval EFI_SUCCESS Timer Architectural Protocol created
+ @retval Other Failed
+**/
+EFI_STATUS
+EFIAPI
+TimerDriverInitialize (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+;
+
+/**
+ This function registers the handler NotifyFunction so it is called every time
+ the timer interrupt fires. It also passes the amount of time since the last
+ handler call to the NotifyFunction. If NotifyFunction is NULL, then the
+ handler is unregistered. If the handler is registered, then EFI_SUCCESS is
+ returned. If the CPU does not support registering a timer interrupt handler,
+ then EFI_UNSUPPORTED is returned. If an attempt is made to register a handler
+ when a handler is already registered, then EFI_ALREADY_STARTED is returned.
+ If an attempt is made to unregister a handler when a handler is not registered,
+ then EFI_INVALID_PARAMETER is returned. If an error occurs attempting to
+ register the NotifyFunction with the timer interrupt, then EFI_DEVICE_ERROR
+ is returned.
+
+ @param[in] This The EFI_TIMER_ARCH_PROTOCOL instance.
+ @param[in] NotifyFunction The function to call when a timer interrupt fires. This
+ function executes at TPL_HIGH_LEVEL. The DXE Core will
+ register a handler for the timer interrupt, so it can know
+ how much time has passed. This information is used to
+ signal timer based events. NULL will unregister the handler.
+
+ @retval EFI_SUCCESS The timer handler was registered.
+ @exception EFI_UNSUPPORTED The CPU does not support registering a timer interrupt handler
+ @retval EFI_ALREADY_STARTED NotifyFunction is not NULL, and a handler is already registered.
+ @retval EFI_INVALID_PARAMETER NotifyFunction is NULL, and a handler was not previously registered.
+**/
+EFI_STATUS
+EFIAPI
+TimerDriverRegisterHandler (
+ IN EFI_TIMER_ARCH_PROTOCOL *This,
+ IN EFI_TIMER_NOTIFY NotifyFunction
+ );
+
+/**
+ This function adjusts the period of timer interrupts to the value specified
+ by TimerPeriod. If the timer period is updated, then the selected timer
+ period is stored in EFI_TIMER.TimerPeriod, and EFI_SUCCESS is returned. If
+ the timer hardware is not programmable, then EFI_UNSUPPORTED is returned.
+ If an error occurs while attempting to update the timer period, then the
+ timer hardware will be put back in its state prior to this call, and
+ EFI_DEVICE_ERROR is returned. If TimerPeriod is 0, then the timer interrupt
+ is disabled. This is not the same as disabling the CPU's interrupts.
+ Instead, it must either turn off the timer hardware, or it must adjust the
+ interrupt controller so that a CPU interrupt is not generated when the timer
+ interrupt fires.
+
+ @param[in] This The EFI_TIMER_ARCH_PROTOCOL instance.
+ @param[in] TimerPeriod The rate to program the timer interrupt in 100 nS units. If
+ the timer hardware is not programmable, then EFI_UNSUPPORTED is
+ returned. If the timer is programmable, then the timer period
+ will be rounded up to the nearest timer period that is supported
+ by the timer hardware. If TimerPeriod is set to 0, then the
+ timer interrupts will be disabled.
+
+ @retval EFI_SUCCESS The timer period was changed.
+**/
+EFI_STATUS
+EFIAPI
+TimerDriverSetTimerPeriod (
+ IN EFI_TIMER_ARCH_PROTOCOL *This,
+ IN UINT64 TimerPeriod
+ );
+
+/**
+ This function retrieves the period of timer interrupts in 100 ns units,
+ returns that value in TimerPeriod, and returns EFI_SUCCESS. If TimerPeriod
+ is NULL, then EFI_INVALID_PARAMETER is returned. If a TimerPeriod of 0 is
+ returned, then the timer is currently disabled.
+
+ @param[in] This The EFI_TIMER_ARCH_PROTOCOL instance.
+ @param[out] TimerPeriod A pointer to the timer period to retrieve in 100 ns units.
+ If 0 is returned, then the timer is currently disabled.
+
+ @retval EFI_SUCCESS The timer period was returned in TimerPeriod.
+ @retval EFI_INVALID_PARAMETER TimerPeriod is NULL.
+**/
+EFI_STATUS
+EFIAPI
+TimerDriverGetTimerPeriod (
+ IN EFI_TIMER_ARCH_PROTOCOL *This,
+ OUT UINT64 *TimerPeriod
+ );
+
+/**
+ This function generates a soft timer interrupt. If the platform does not support soft
+ timer interrupts, then EFI_UNSUPPORTED is returned. Otherwise, EFI_SUCCESS is returned.
+ If a handler has been registered through the EFI_TIMER_ARCH_PROTOCOL.RegisterHandler()
+ service, then a soft timer interrupt will be generated. If the timer interrupt is
+ enabled when this service is called, then the registered handler will be invoked. The
+ registered handler should not be able to distinguish a hardware-generated timer
+ interrupt from a software-generated timer interrupt.
+
+ @param[in] This The EFI_TIMER_ARCH_PROTOCOL instance.
+
+ @retval EFI_SUCCESS The soft timer interrupt was generated.
+**/
+EFI_STATUS
+EFIAPI
+TimerDriverGenerateSoftInterrupt (
+ IN EFI_TIMER_ARCH_PROTOCOL *This
+ );
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/SmartTimer/Dxe/SmartTimer.inf b/ReferenceCode/Chipset/LynxPoint/SmartTimer/Dxe/SmartTimer.inf
new file mode 100644
index 0000000..cd6c46b
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SmartTimer/Dxe/SmartTimer.inf
@@ -0,0 +1,77 @@
+## @file
+# Component description file for 8254 Timer module cooperate
+# with ACPI time counter
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = SmartTimer
+FILE_GUID = 90CB75DB-71FC-489d-AACF-943477EC7212
+COMPONENT_TYPE = BS_DRIVER
+
+[sources.common]
+ SmartTimer.c
+ SmartTimer.h
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueDxeDriverEntryPoint.c
+
+[includes.common]
+ $(EDK_SOURCE)/Foundation/Efi
+ .
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[libraries.common]
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueBaseLib
+ EdkIIGlueBasePciLibPciExpress
+ EdkIIGlueDxeReportStatusCodeLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkFrameworkProtocolLib
+ ArchProtocolLib
+ EdkProtocolLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT=_ModuleEntryPoint
+ DPX_SOURCE=SmartTimer.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=TimerDriverInitialize
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_BASE_LIB__ \
+ -D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__
diff --git a/ReferenceCode/Chipset/LynxPoint/SmartTimer/Dxe/SmartTimer.mak b/ReferenceCode/Chipset/LynxPoint/SmartTimer/Dxe/SmartTimer.mak
new file mode 100644
index 0000000..53ffa0d
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SmartTimer/Dxe/SmartTimer.mak
@@ -0,0 +1,100 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/SmartTimer/SmartTimer.mak 3 9/26/12 3:17a Victortu $
+#
+# $Revision: 3 $
+#
+# $Date: 9/26/12 3:17a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/SmartTimer/SmartTimer.mak $
+#
+# 3 9/26/12 3:17a Victortu
+# Lynx Point PCH Chipset Framework Reference Code Beta 0.7.0
+#
+# 2 2/24/12 2:21a Victortu
+# Updated to support 4.6.5.3_IntelEDK_1117_Patch7_00.
+#
+# 1 2/08/12 9:17a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+
+#---------------------------------------------------------------------------
+# Create SmartTimer Driver
+#---------------------------------------------------------------------------
+EDK : SmartTimer
+SmartTimer : $(BUILD_DIR)\SmartTimer.mak SmartTimerBin
+
+
+$(BUILD_DIR)\SmartTimer.mak : $(SmartTimer_DIR)\$(@B).cif $(SmartTimer_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(SmartTimer_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+SmartTimer_INCLUDES=\
+ $(INTEL_PCH_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+
+SmartTimer_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=TimerDriverInitialize"\
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_BASE_LIB__ \
+ /D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__
+
+SmartTimer_LIB_LINKS =\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(ArchProtocolLib)\
+ $(EDKPROTOCOLLIB)
+
+
+SmartTimerBin: $(SmartTimer_LIB_LINKS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\SmartTimer.mak all \
+ "MY_INCLUDES=$(SmartTimer_INCLUDES)"\
+ "MY_DEFINES=$(SmartTimer_DEFINES)"\
+ GUID=90CB75DB-71FC-489d-AACF-943477EC7212\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=BS_DRIVER\
+ EDKIIModule=DXEDRIVER\
+ DEPEX1=$(SmartTimer_DIR)\SmartTimer.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX\
+ COMPRESS=1
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/SmartTimer/Dxe/SmartTimer.sdl b/ReferenceCode/Chipset/LynxPoint/SmartTimer/Dxe/SmartTimer.sdl
new file mode 100644
index 0000000..33c25e3
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SmartTimer/Dxe/SmartTimer.sdl
@@ -0,0 +1,76 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/SmartTimer/SmartTimer.sdl 2 11/19/13 7:36a Barretlin $
+#
+# $Revision: 2 $
+#
+# $Date: 11/19/13 7:36a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/SmartTimer/SmartTimer.sdl $
+#
+# 2 11/19/13 7:36a Barretlin
+# [TAG] EIP141917
+# [Category] New Feature
+# [Description] Support SetTimer() with HPET Timer on Lynx Point
+# [Files] SB.sdl SBGeneric.c SBDxe.c SbHpet.h sbProtocal.cif
+# SamrtTimer.sdl
+#
+# 1 2/08/12 9:17a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+TOKEN
+ Name = "SmartTimer_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable SmartTimer support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+ Token = "HPET_PROTOCOL_SUPPORT" "=" "0"
+End
+
+PATH
+ Name = "SmartTimer_DIR"
+End
+
+MODULE
+ Help = "Includes SmartTimer to Project"
+ File = "SmartTimer.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\SmartTimer.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Smbus/Common/PchSmbusCommon.h b/ReferenceCode/Chipset/LynxPoint/Smbus/Common/PchSmbusCommon.h
new file mode 100644
index 0000000..35cf2e5
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Smbus/Common/PchSmbusCommon.h
@@ -0,0 +1,190 @@
+/** @file
+ PCH Smbus Protocol
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PCH_SMBUS_COMMON_H
+#define _PCH_SMBUS_COMMON_H
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueBase.h"
+#include "PchAccess.h"
+#include "PchPlatformLib.h"
+#include "EfiSmbus.h"
+
+#endif
+//
+// Definitions
+//
+#define STALL_PERIOD 10 * STALL_ONE_MICRO_SECOND ///< 10 microseconds
+#define STALL_TIME STALL_ONE_SECOND ///< 1 second
+#define BUS_TRIES 3 ///< How many times to retry on Bus Errors
+#define SMBUS_NUM_RESERVED 38 ///< Number of device addresses that are reserved by the SMBus spec.
+#define SMBUS_ADDRESS_ARP 0xC2 >> 1
+#define SMBUS_DATA_PREPARE_TO_ARP 0x01
+#define SMBUS_DATA_RESET_DEVICE 0x02
+#define SMBUS_DATA_GET_UDID_GENERAL 0x03
+#define SMBUS_DATA_ASSIGN_ADDRESS 0x04
+#define SMBUS_GET_UDID_LENGTH 17 ///< 16 byte UDID + 1 byte address
+//
+// Private data and functions
+//
+
+typedef
+UINT8
+(EFIAPI *SMBUS_IO_READ) (
+ IN UINT8 Offset
+ );
+
+typedef
+VOID
+(EFIAPI *SMBUS_IO_WRITE) (
+ IN UINT8 Offset,
+ IN UINT8 Data
+ );
+
+typedef
+BOOLEAN
+(EFIAPI *SMBUS_IO_DONE) (
+ IN UINT8 *StsReg
+ );
+
+#define PCH_SMBUS_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('p', 's', 'm', 'b')
+
+/**
+ Get SMBUS IO Base address
+
+ @param[in] None
+
+ @retval UINT32 The SMBUS IO Base Address
+**/
+UINT32
+SmbusGetIoBase (
+ VOID
+ );
+
+/**
+ This function provides a standard way to read PCH Smbus IO registers.
+
+ @param[in] Offset Register offset from Smbus base IO address.
+
+ @retval UINT8 Returns data read from IO.
+**/
+UINT8
+EFIAPI
+SmbusIoRead (
+ IN UINT8 Offset
+ );
+
+/**
+ This function provides a standard way to write PCH Smbus IO registers.
+
+ @param[in] Offset Register offset from Smbus base IO address.
+ @param[in] Data Data to write to register.
+
+ @retval None.
+**/
+VOID
+EFIAPI
+SmbusIoWrite (
+ IN UINT8 Offset,
+ IN UINT8 Data
+ );
+
+/**
+ This function provides a standard way to check if an SMBus transaction has
+ completed.
+
+ @param[in] StsReg Not used for input. On return, contains the
+ value of the SMBus status register.
+
+ @retval TRUE Transaction is complete
+ @retval FALSE Otherwise.
+**/
+BOOLEAN
+EFIAPI
+IoDone (
+ IN UINT8 *StsReg
+ );
+
+/**
+ Check if it's ok to use the bus.
+
+ @param[in] None
+
+ @retval EFI_SUCCESS SmBus is acquired and it's safe to send commands.
+ @retval EFI_TIMEOUT SmBus is busy, it's not safe to send commands.
+**/
+EFI_STATUS
+AcquireBus (
+ VOID
+ );
+
+/**
+ This function provides a standard way to execute Smbus protocols
+ as defined in the SMBus Specification. The data can either be of
+ the Length byte, word, or a block of data. The resulting transaction will be
+ either the SMBus Slave Device accepts this transaction or this function
+ returns with an error
+
+ @param[in] SlaveAddress Smbus Slave device the command is directed at
+ @param[in] Command Slave Device dependent
+ @param[in] Operation Which SMBus protocol will be used
+ @param[in] PecCheck Defines if Packet Error Code Checking is to be used
+ @param[in, out] Length How many bytes to read. Must be 0 <= Length <= 32 depending on Operation
+ It will contain the actual number of bytes read/written.
+ @param[in, out] Buffer Contain the data read/written.
+
+ @retval EFI_SUCCESS The operation completed successfully.
+ @exception EFI_UNSUPPORTED The operation is unsupported.
+
+ @retval EFI_INVALID_PARAMETER Length or Buffer is NULL for any operation besides
+ quick read or quick write.
+ @retval EFI_TIMEOUT The transaction did not complete within an internally
+ specified timeout period, or the controller is not
+ available for use.
+ @retval EFI_DEVICE_ERROR There was an Smbus error (NACK) during the operation.
+ This could indicate the slave device is not present
+ or is in a hung condition.
+**/
+EFI_STATUS
+SmbusExec (
+ IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
+ IN EFI_SMBUS_DEVICE_COMMAND Command,
+ IN EFI_SMBUS_OPERATION Operation,
+ IN BOOLEAN PecCheck,
+ IN OUT UINTN *Length,
+ IN OUT VOID *Buffer
+ );
+
+/**
+ This function initializes the Smbus Registers.
+
+ @param[in] None.
+
+ @retval None.
+**/
+VOID
+InitializeSmbusRegisters (
+ VOID
+ );
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Smbus/Common/PchSmbusCommonLib.cif b/ReferenceCode/Chipset/LynxPoint/Smbus/Common/PchSmbusCommonLib.cif
new file mode 100644
index 0000000..e62b886
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Smbus/Common/PchSmbusCommonLib.cif
@@ -0,0 +1,11 @@
+<component>
+ name = "PchSmbusCommonLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\Smbus\Common"
+ RefName = "PchSmbusCommonLib"
+[files]
+"PchSmbusCommonLib.sdl"
+"PchSmbusCommonLib.mak"
+"PchSmbusExec.c"
+"PchSmbusCommon.h"
+<endComponent> \ No newline at end of file
diff --git a/ReferenceCode/Chipset/LynxPoint/Smbus/Common/PchSmbusCommonLib.mak b/ReferenceCode/Chipset/LynxPoint/Smbus/Common/PchSmbusCommonLib.mak
new file mode 100644
index 0000000..2eb1277
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Smbus/Common/PchSmbusCommonLib.mak
@@ -0,0 +1,124 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSmbusCommonLib/PchSmbusCommonLib.mak 1 2/08/12 9:18a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 9:18a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSmbusCommonLib/PchSmbusCommonLib.mak $
+#
+# 1 2/08/12 9:18a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+all : PchSmbusCommonLib
+
+PchSmbusCommonLib : PchSmbusCommonDxeLib PchSmbusCommonSmmLib PchSmbusCommonPeiLib
+
+$(PchSmbusCommonSmmLib_LIB) : PchSmbusCommonSmmLib
+$(PchSmbusCommonDxeLib_LIB) : PchSmbusCommonDxeLib
+$(PchSmbusCommonPeiLib_LIB) : PchSmbusCommonPeiLib
+
+PchSmbusCommonSmmLib : $(BUILD_DIR)\PchSmbusCommonLib.mak PchSmbusCommonLibSmmBin
+
+PchSmbusCommonDxeLib : $(BUILD_DIR)\PchSmbusCommonLib.mak PchSmbusCommonLibDxeBin
+
+PchSmbusCommonPeiLib : $(BUILD_DIR)\PchSmbusCommonLib.mak PchSmbusCommonLibPeiBin
+
+$(BUILD_DIR)\PchSmbusCommonLib.mak : $(PchSmbusCommonLib_DIR)\$(@B).cif $(PchSmbusCommonLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(PchSmbusCommonLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+PchSmbusCommonLib_INCLUDES=\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+
+PchSmbusCommonLibSmm_INCLUDES=\
+ $(PchSmbusCommonLib_INCLUDES)
+
+PchSmbusCommonLibDxe_INCLUDES=\
+ $(PchSmbusCommonLib_INCLUDES)
+
+PchSmbusCommonLibPeim_INCLUDES=\
+ $(PchSmbusCommonLib_INCLUDES)
+
+PchSmbusCommonLib_DEFINES = \
+ $(CFLAGS)
+
+DxeCpuBuildDefine = \
+!IF "$(x64_BUILD)"=="1"
+ /DMDE_CPU_X64\
+!ELSE
+ /DMDE_CPU_IA32\
+!ENDIF
+
+PeimCpuBuildDefine = \
+ /DMDE_CPU_IA32\
+
+PchSmbusCommonLibPeim_DEFINES = \
+ $(PchSmbusCommonLib_DEFINES)\
+ $(PeimCpuBuildDefine)\
+
+PchSmbusCommonLibDxe_DEFINES = \
+ $(PchSmbusCommonLib_DEFINES)\
+ $(DxeCpuBuildDefine)\
+
+PchSmbusCommonLibSmm_DEFINES = \
+ $(PchSmbusCommonLibDxe_DEFINES)\
+
+PchSmbusCommonLibDxeBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS) \
+ /f $(BUILD_DIR)\PchSmbusCommonLib.mak all\
+ "MY_INCLUDES=$(PchSmbusCommonLibDxe_INCLUDES)" \
+ "CFLAGS=$(PchSmbusCommonLibDxe_DEFINES)"\
+ TYPE=LIBRARY \
+ LIBRARY_NAME=$(PchSmbusCommonDxeLib_LIB)
+
+PchSmbusCommonLibSmmBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS) \
+ /f $(BUILD_DIR)\PchSmbusCommonLib.mak all\
+ "MY_INCLUDES=$(PchSmbusCommonLibSmm_INCLUDES)" \
+ "CFLAGS=$(PchSmbusCommonLibSmm_DEFINES)"\
+ TYPE=LIBRARY \
+ BUILD_DIR=$(BUILD_DIR)\Smm\
+ LIBRARY_NAME=$(PchSmbusCommonSmmLib_LIB)
+
+PchSmbusCommonLibPeiBin :
+!IF "$(x64_BUILD)"=="1"
+ $(MAKE) /$(MAKEFLAGS) $(EDK_DEFAULTS) BUILD_DIR=$(BUILD_DIR)\IA32 \
+!ELSE
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS) \
+!ENDIF
+ /f $(BUILD_DIR)\PchSmbusCommonLib.mak all\
+ "MY_INCLUDES=$(PchSmbusCommonLibPeim_INCLUDES)" \
+ "CFLAGS=$(PchSmbusCommonLibPeim_DEFINES)"\
+ TYPE=PEI_LIBRARY \
+ LIBRARY_NAME=$(PchSmbusCommonPeiLib_LIB)
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Smbus/Common/PchSmbusCommonLib.sdl b/ReferenceCode/Chipset/LynxPoint/Smbus/Common/PchSmbusCommonLib.sdl
new file mode 100644
index 0000000..7785408
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Smbus/Common/PchSmbusCommonLib.sdl
@@ -0,0 +1,92 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSmbusCommonLib/PchSmbusCommonLib.sdl 1 2/08/12 9:18a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 9:18a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSmbusCommonLib/PchSmbusCommonLib.sdl $
+#
+# 1 2/08/12 9:18a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+TOKEN
+ Name = "PchSmbusCommonLib_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable PchSmbusCommonLib support in Project"
+ TokenType = Boolean
+ TargetMAK = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "PchSmbusCommonLib_DIR"
+End
+
+MODULE
+ Help = "Includes PchSmbusCommonLib.mak to Project"
+ File = "PchSmbusCommonLib.mak"
+End
+
+ELINK
+ Name = "PchSmbusCommonDxeLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PchSmbusCommonDxeLib.lib"
+ Parent = "PchSmbusCommonDxeLib_LIB"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "PchSmbusCommonPeiLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PchSmbusCommonPeiLib.lib"
+ Parent = "PchSmbusCommonPeiLib_LIB"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "PchSmbusCommonSmmLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PchSmbusCommonSmmLib.lib"
+ Parent = "PchSmbusCommonSmmLib_LIB"
+ InvokeOrder = AfterParent
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Smbus/Common/PchSmbusExec.c b/ReferenceCode/Chipset/LynxPoint/Smbus/Common/PchSmbusExec.c
new file mode 100644
index 0000000..4015dda
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Smbus/Common/PchSmbusExec.c
@@ -0,0 +1,661 @@
+/** @file
+ PCH Smbus Executive Code (common PEI/DXE/SMM code)
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "PchSmbusCommon.h"
+
+/**
+ Get SMBUS IO Base address
+
+ @param[in] None
+
+ @retval UINT32 The SMBUS IO Base Address
+**/
+UINT32
+SmbusGetIoBase (
+ VOID
+ )
+{
+ UINT32 SmbusIoBase;
+
+ SmbusIoBase = MmioRead32 (
+ MmPciAddress (0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_SMBUS,
+ PCI_FUNCTION_NUMBER_PCH_SMBUS,
+ R_PCH_SMBUS_BASE)
+ ) & B_PCH_SMBUS_BASE_BAR;
+
+ ASSERT (SmbusIoBase != B_PCH_SMBUS_BASE_BAR && SmbusIoBase != 0);
+
+ return SmbusIoBase;
+}
+
+/**
+ This function provides a standard way to read PCH Smbus IO registers.
+
+ @param[in] Offset Register offset from Smbus base IO address.
+
+ @retval UINT8 Returns data read from IO.
+**/
+UINT8
+EFIAPI
+SmbusIoRead (
+ IN UINT8 Offset
+ )
+{
+ return IoRead8 (SmbusGetIoBase () + Offset);
+}
+
+/**
+ This function provides a standard way to write PCH Smbus IO registers.
+
+ @param[in] Offset Register offset from Smbus base IO address.
+ @param[in] Data Data to write to register.
+
+ @retval None.
+**/
+VOID
+EFIAPI
+SmbusIoWrite (
+ IN UINT8 Offset,
+ IN UINT8 Data
+ )
+{
+ ///
+ /// Write New Value
+ ///
+ IoWrite8 (SmbusGetIoBase () + Offset, Data);
+ return;
+}
+
+/**
+ This function provides a standard way to check if an SMBus transaction has
+ completed.
+
+ @param[in] StsReg Not used for input. On return, contains the
+ value of the SMBus status register.
+
+ @retval TRUE Transaction is complete
+ @retval FALSE Otherwise.
+**/
+BOOLEAN
+EFIAPI
+IoDone (
+ IN UINT8 *StsReg
+ )
+{
+ ///
+ /// Wait for IO to complete
+ ///
+ UINTN StallIndex;
+ UINTN StallTries;
+
+ StallTries = STALL_TIME / STALL_PERIOD;
+
+ for (StallIndex = 0; StallIndex < StallTries; StallIndex++) {
+ *StsReg = SmbusIoRead (R_PCH_SMBUS_HSTS);
+ if (*StsReg & (B_PCH_SMBUS_INTR | B_PCH_SMBUS_BYTE_DONE_STS | B_PCH_SMBUS_DERR | B_PCH_SMBUS_BERR)) {
+ return TRUE;
+ } else {
+ PchPmTimerStall (STALL_PERIOD);
+ }
+ }
+
+ return FALSE;
+}
+
+/**
+ Check if it's ok to use the bus.
+
+ @param[in] None
+
+ @retval EFI_SUCCESS SmBus is acquired and it's safe to send commands.
+ @retval EFI_TIMEOUT SmBus is busy, it's not safe to send commands.
+**/
+EFI_STATUS
+AcquireBus (
+ VOID
+ )
+{
+ UINT8 StsReg;
+
+ StsReg = 0;
+ StsReg = SmbusIoRead (R_PCH_SMBUS_HSTS);
+ if (StsReg & B_PCH_SMBUS_IUS) {
+ return EFI_TIMEOUT;
+ } else if (StsReg & B_PCH_SMBUS_HBSY) {
+ ///
+ /// Clear Status Register and exit
+ ///
+ SmbusIoWrite (R_PCH_SMBUS_HSTS, B_PCH_SMBUS_HSTS_ALL);
+ return EFI_TIMEOUT;
+ } else {
+ ///
+ /// Clear out any odd status information (Will Not Clear In Use)
+ ///
+ SmbusIoWrite (R_PCH_SMBUS_HSTS, StsReg);
+ return EFI_SUCCESS;
+ }
+}
+
+/**
+ This function provides a standard way to execute Smbus protocols
+ as defined in the SMBus Specification. The data can either be of
+ the Length byte, word, or a block of data. The resulting transaction will be
+ either the SMBus Slave Device accepts this transaction or this function
+ returns with an error
+
+ @param[in] SlaveAddress Smbus Slave device the command is directed at
+ @param[in] Command Slave Device dependent
+ @param[in] Operation Which SMBus protocol will be used
+ @param[in] PecCheck Defines if Packet Error Code Checking is to be used
+ @param[in, out] Length How many bytes to read. Must be 0 <= Length <= 32 depending on Operation
+ It will contain the actual number of bytes read/written.
+ @param[in, out] Buffer Contain the data read/written.
+
+ @retval EFI_SUCCESS The operation completed successfully.
+ @exception EFI_UNSUPPORTED The operation is unsupported.
+
+ @retval EFI_INVALID_PARAMETER Length or Buffer is NULL for any operation besides
+ quick read or quick write.
+ @retval EFI_TIMEOUT The transaction did not complete within an internally
+ specified timeout period, or the controller is not
+ available for use.
+ @retval EFI_DEVICE_ERROR There was an Smbus error (NACK) during the operation.
+ This could indicate the slave device is not present
+ or is in a hung condition.
+**/
+EFI_STATUS
+SmbusExec (
+ IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
+ IN EFI_SMBUS_DEVICE_COMMAND Command,
+ IN EFI_SMBUS_OPERATION Operation,
+ IN BOOLEAN PecCheck,
+ IN OUT UINTN *Length,
+ IN OUT VOID *Buffer
+ )
+{
+ EFI_STATUS Status;
+ UINT8 AuxcReg;
+ UINT8 AuxStsReg;
+ UINT8 SmbusOperation;
+ UINT8 StsReg;
+ UINT8 SlvAddrReg;
+ UINT8 HostCmdReg;
+ UINT8 BlockCount;
+ BOOLEAN BufferTooSmall;
+ UINTN Index;
+ UINTN BusIndex;
+ UINT8 *CallBuffer;
+ UINT8 SmbusHctl;
+ UINT32 Timeout;
+
+ CallBuffer = Buffer;
+ BlockCount = 0;
+
+ ///
+ /// For any operations besides quick read & write, the pointers to
+ /// Length and Buffer must not be NULL.
+ ///
+ if ((Operation != EfiSmbusQuickRead) && (Operation != EfiSmbusQuickWrite)) {
+ if ((Length == NULL) || (Buffer == NULL)) {
+ return EFI_INVALID_PARAMETER;
+ }
+ }
+ ///
+ /// See if its ok to use the bus based upon INUSE_STS bit.
+ ///
+ Status = AcquireBus ();
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ ///
+ /// This is the main operation loop. If the operation results in a Smbus
+ /// collision with another master on the bus, it attempts the requested
+ /// transaction again at least BUS_TRIES attempts.
+ ///
+ for (BusIndex = 0; BusIndex < BUS_TRIES; BusIndex++) {
+ ///
+ /// Operation Specifics (pre-execution)
+ ///
+ Status = EFI_SUCCESS;
+ SmbusOperation = V_PCH_SMBUS_SMB_CMD_QUICK;
+ SlvAddrReg = (UINT8) ((SlaveAddress.SmbusDeviceAddress << 1) | 1);
+ HostCmdReg = (UINT8) Command;
+ AuxcReg = 0;
+
+ switch (Operation) {
+
+ case EfiSmbusQuickWrite:
+ SlvAddrReg--;
+
+ ///
+ /// The "break;" command is not present here to allow code execution
+ /// do drop into the next case, which contains common code to this case.
+ ///
+ case EfiSmbusQuickRead:
+ if (PecCheck == TRUE) {
+ Status = EFI_UNSUPPORTED;
+ }
+ break;
+
+ case EfiSmbusSendByte:
+ HostCmdReg = CallBuffer[0];
+ SlvAddrReg--;
+
+ ///
+ /// The "break;" command is not present here to allow code execution
+ /// do drop into the next case, which contains common code to this case.
+ ///
+ case EfiSmbusReceiveByte:
+ SmbusOperation = V_PCH_SMBUS_SMB_CMD_BYTE;
+ if (*Length < 1) {
+ Status = EFI_BUFFER_TOO_SMALL;
+ }
+
+ *Length = 1;
+ break;
+
+ case EfiSmbusWriteByte:
+ SmbusIoWrite (R_PCH_SMBUS_HD0, CallBuffer[0]);
+ SlvAddrReg--;
+ *Length = 1;
+
+ ///
+ /// The "break;" command is not present here to allow code execution
+ /// do drop into the next case, which contains common code to this case.
+ ///
+ case EfiSmbusReadByte:
+ if (*Length < 1) {
+ Status = EFI_BUFFER_TOO_SMALL;
+ } else if (*Length == 1) {
+ SmbusOperation = V_PCH_SMBUS_SMB_CMD_BYTE_DATA;
+ } else if (*Length <= 256) {
+ if (PecCheck == TRUE) {
+ ///
+ /// The I2C Read command with either PEC_EN or AAC bit set
+ /// produces undefined results.
+ ///
+ Status = EFI_UNSUPPORTED;
+ }
+
+ SmbusOperation = V_PCH_SMBUS_SMB_CMD_IIC_READ;
+ } else {
+ Status = EFI_INVALID_PARAMETER;
+ }
+
+ break;
+
+ case EfiSmbusReadWord:
+ SmbusOperation = V_PCH_SMBUS_SMB_CMD_WORD_DATA;
+ if (*Length < 2) {
+ Status = EFI_BUFFER_TOO_SMALL;
+ }
+
+ *Length = 2;
+ break;
+
+ case EfiSmbusWriteWord:
+ SmbusOperation = V_PCH_SMBUS_SMB_CMD_WORD_DATA;
+ SlvAddrReg--;
+ SmbusIoWrite (R_PCH_SMBUS_HD1, CallBuffer[1]);
+ SmbusIoWrite (R_PCH_SMBUS_HD0, CallBuffer[0]);
+ if (*Length < 2) {
+ Status = EFI_BUFFER_TOO_SMALL;
+ }
+
+ *Length = 2;
+ break;
+
+ case EfiSmbusWriteBlock:
+ SmbusIoWrite (R_PCH_SMBUS_HD0, *(UINT8 *) Length);
+ SlvAddrReg--;
+ BlockCount = (UINT8) (*Length);
+
+ ///
+ /// The "break;" command is not present here to allow code execution
+ /// do drop into the next case, which contains common code to this case.
+ ///
+ case EfiSmbusReadBlock:
+ SmbusOperation = V_PCH_SMBUS_SMB_CMD_BLOCK;
+ if ((*Length < 1) || (*Length > 32)) {
+ Status = EFI_INVALID_PARAMETER;
+ break;
+ }
+
+ AuxcReg |= B_PCH_SMBUS_E32B;
+ break;
+
+ case EfiSmbusProcessCall:
+ SmbusOperation = V_PCH_SMBUS_SMB_CMD_PROCESS_CALL;
+ SmbusIoWrite (R_PCH_SMBUS_HD1, CallBuffer[1]);
+ SmbusIoWrite (R_PCH_SMBUS_HD0, CallBuffer[0]);
+ if (*Length < 2) {
+ Status = EFI_BUFFER_TOO_SMALL;
+ }
+
+ *Length = 2;
+ break;
+
+ case EfiSmbusBWBRProcessCall:
+ ///
+ /// The write byte count cannot be zero or more than
+ /// 32 bytes.
+ ///
+ if ((*Length < 1) || (*Length > 32)) {
+ Status = EFI_INVALID_PARAMETER;
+ break;
+ }
+
+ SmbusIoWrite (R_PCH_SMBUS_HD0, *(UINT8 *) Length);
+ BlockCount = (UINT8) (*Length);
+ SmbusOperation = V_PCH_SMBUS_SMB_CMD_BLOCK_PROCESS;
+
+ AuxcReg |= B_PCH_SMBUS_E32B;
+ break;
+
+ default:
+ Status = EFI_INVALID_PARAMETER;
+ break;
+ }
+
+ if (EFI_ERROR (Status)) {
+ break;
+ }
+
+ if (PecCheck == TRUE) {
+ AuxcReg |= B_PCH_SMBUS_AAC;
+ }
+ ///
+ /// Set Auxiliary Control register
+ ///
+ SmbusIoWrite (R_PCH_SMBUS_AUXC, AuxcReg);
+
+ ///
+ /// Reset the pointer of the internal buffer
+ ///
+ SmbusIoRead (R_PCH_SMBUS_HCTL);
+
+ ///
+ /// Now that the 32 byte buffer is turned on, we can write th block data
+ /// into it
+ ///
+ if ((Operation == EfiSmbusWriteBlock) || (Operation == EfiSmbusBWBRProcessCall)) {
+ for (Index = 0; Index < BlockCount; Index++) {
+ ///
+ /// Write next byte
+ ///
+ SmbusIoWrite (R_PCH_SMBUS_HBD, CallBuffer[Index]);
+ }
+ }
+ ///
+ /// Set SMBus slave address for the device to send/receive from
+ ///
+ SmbusIoWrite (R_PCH_SMBUS_TSA, SlvAddrReg);
+
+ ///
+ /// For I2C read, send DATA1 register for the offset (address)
+ /// within the serial memory chips
+ ///
+ if ((Operation == EfiSmbusReadByte) && (*Length > 1)) {
+ SmbusIoWrite (R_PCH_SMBUS_HD1, HostCmdReg);
+ } else {
+ ///
+ /// Set Command register
+ ///
+ SmbusIoWrite (R_PCH_SMBUS_HCMD, HostCmdReg);
+ }
+ ///
+ /// Set Control Register (Initiate Operation, Interrupt disabled)
+ ///
+ SmbusIoWrite (R_PCH_SMBUS_HCTL, (UINT8) (SmbusOperation + B_PCH_SMBUS_START));
+
+ ///
+ /// Wait for IO to complete
+ ///
+ if (!IoDone (&StsReg)) {
+ Status = EFI_TIMEOUT;
+ break;
+ } else if (StsReg & B_PCH_SMBUS_DERR) {
+ AuxStsReg = SmbusIoRead (R_PCH_SMBUS_AUXS);
+ if (AuxStsReg & B_PCH_SMBUS_CRCE) {
+ Status = EFI_CRC_ERROR;
+ } else {
+ Status = EFI_DEVICE_ERROR;
+ }
+ break;
+ } else if (StsReg & B_PCH_SMBUS_BERR) {
+ ///
+ /// Clear the Bus Error for another try
+ ///
+ Status = EFI_DEVICE_ERROR;
+ SmbusIoWrite (R_PCH_SMBUS_HSTS, B_PCH_SMBUS_BERR);
+ ///
+ /// Clear Status Registers
+ ///
+ SmbusIoWrite (R_PCH_SMBUS_HSTS, B_PCH_SMBUS_HSTS_ALL);
+ SmbusIoWrite (R_PCH_SMBUS_AUXS, B_PCH_SMBUS_CRCE);
+ ///
+ /// If bus collision happens, stall some time, then try again
+ /// Here we choose 10 milliseconds to avoid MTCP transfer.
+ ///
+ PchPmTimerStall (STALL_PERIOD);
+ continue;
+ }
+ ///
+ /// successfull completion
+ /// Operation Specifics (post-execution)
+ ///
+ switch (Operation) {
+
+ case EfiSmbusReadWord:
+ ///
+ /// The "break;" command is not present here to allow code execution
+ /// do drop into the next case, which contains common code to this case.
+ ///
+ case EfiSmbusProcessCall:
+ CallBuffer[1] = SmbusIoRead (R_PCH_SMBUS_HD1);
+ CallBuffer[0] = SmbusIoRead (R_PCH_SMBUS_HD0);
+ break;
+
+ case EfiSmbusReadByte:
+ if (*Length > 1) {
+ for (Index = 0; Index < *Length; Index++) {
+ ///
+ /// Read the byte
+ ///
+ CallBuffer[Index] = SmbusIoRead (R_PCH_SMBUS_HBD);
+ ///
+ /// After receiving byte n-1 (1-base) of the message, the
+ /// software will then set the LAST BYTE bit. The software
+ /// will then clear the BYTE_DONE_STS bit.
+ ///
+ if (Index == ((*Length - 1) - 1)) {
+ SmbusHctl = SmbusIoRead (R_PCH_SMBUS_HCTL) | (UINT8) B_PCH_SMBUS_LAST_BYTE;
+ SmbusIoWrite (R_PCH_SMBUS_HCTL, SmbusHctl);
+ } else if (Index == (*Length - 1)) {
+ ///
+ /// Clear the LAST BYTE bit after receiving byte n (1-base) of the message
+ ///
+ SmbusHctl = SmbusIoRead (R_PCH_SMBUS_HCTL) & (UINT8) ~B_PCH_SMBUS_LAST_BYTE;
+ SmbusIoWrite (R_PCH_SMBUS_HCTL, SmbusHctl);
+ }
+ ///
+ /// Clear the BYTE_DONE_STS bit
+ ///
+ SmbusIoWrite (R_PCH_SMBUS_HSTS, B_PCH_SMBUS_BYTE_DONE_STS);
+ ///
+ /// Check BYTE_DONE_STS bit to know if it has completed transmission
+ /// of a byte. No need to check it for the last byte.
+ ///
+ if (Index < (*Length - 1)) {
+ ///
+ /// If somehow board operates at 10Khz, it will take 0.9 ms (9/10Khz) for another byte.
+ /// Add 10 us delay for a loop of 100 that the total timeout is 1 ms to take care of
+ /// the slowest case.
+ ///
+ for (Timeout = 0; Timeout < 100; Timeout++) {
+ if ((SmbusIoRead (R_PCH_SMBUS_HSTS) & (UINT8) B_PCH_SMBUS_BYTE_DONE_STS) != 0) {
+ break;
+ }
+ ///
+ /// Delay 10 us
+ ///
+ PchPmTimerStall (STALL_PERIOD);
+ }
+
+ if (Timeout >= 100) {
+ Status = EFI_TIMEOUT;
+ break;
+ }
+ }
+ }
+ break;
+ }
+
+ case EfiSmbusReceiveByte:
+ CallBuffer[0] = SmbusIoRead (R_PCH_SMBUS_HD0);
+ break;
+
+ case EfiSmbusWriteBlock:
+ SmbusIoWrite (R_PCH_SMBUS_HSTS, B_PCH_SMBUS_BYTE_DONE_STS);
+ break;
+
+ case EfiSmbusReadBlock:
+ BufferTooSmall = FALSE;
+ ///
+ /// Find out how many bytes will be in the block
+ ///
+ BlockCount = SmbusIoRead (R_PCH_SMBUS_HD0);
+ if (*Length < BlockCount) {
+ BufferTooSmall = TRUE;
+ } else {
+ for (Index = 0; Index < BlockCount; Index++) {
+ ///
+ /// Read the byte
+ ///
+ CallBuffer[Index] = SmbusIoRead (R_PCH_SMBUS_HBD);
+ }
+ }
+
+ *Length = BlockCount;
+ if (BufferTooSmall) {
+ Status = EFI_BUFFER_TOO_SMALL;
+ }
+ break;
+
+ case EfiSmbusBWBRProcessCall:
+ ///
+ /// Find out how many bytes will be in the block
+ ///
+ BlockCount = SmbusIoRead (R_PCH_SMBUS_HD0);
+ ///
+ /// The read byte count cannot be zero.
+ ///
+ if (BlockCount < 1) {
+ Status = EFI_BUFFER_TOO_SMALL;
+ break;
+ }
+ ///
+ /// The combined data payload (the write byte count + the read byte count)
+ /// must not exceed 32 bytes
+ ///
+ if (((UINT8) (*Length) + BlockCount) > 32) {
+ Status = EFI_DEVICE_ERROR;
+ break;
+ }
+
+ for (Index = 0; Index < BlockCount; Index++) {
+ ///
+ /// Read the byte
+ ///
+ CallBuffer[Index] = SmbusIoRead (R_PCH_SMBUS_HBD);
+ }
+
+ *Length = BlockCount;
+ break;
+
+ default:
+ break;
+ };
+
+ if ((StsReg & B_PCH_SMBUS_BERR) && (Status != EFI_BUFFER_TOO_SMALL)) {
+ ///
+ /// Clear the Bus Error for another try
+ ///
+ Status = EFI_DEVICE_ERROR;
+ SmbusIoWrite (R_PCH_SMBUS_HSTS, B_PCH_SMBUS_BERR);
+ ///
+ /// If bus collision happens, stall some time, then try again
+ /// Here we choose 10 milliseconds to avoid MTCP transfer.
+ ///
+ PchPmTimerStall (STALL_PERIOD);
+ continue;
+ } else {
+ break;
+ }
+ }
+ ///
+ /// Clear Status Registers and exit
+ ///
+ SmbusIoWrite (R_PCH_SMBUS_HSTS, B_PCH_SMBUS_HSTS_ALL);
+ SmbusIoWrite (R_PCH_SMBUS_AUXS, B_PCH_SMBUS_CRCE);
+ SmbusIoWrite (R_PCH_SMBUS_AUXC, 0);
+ return Status;
+}
+
+/**
+ This function initializes the Smbus Registers.
+
+ @param[in] None.
+
+ @retval None.
+**/
+VOID
+InitializeSmbusRegisters (
+ VOID
+ )
+{
+ UINTN SmbusRegBase;
+
+ SmbusRegBase = MmPciAddress (
+ 0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_SMBUS,
+ PCI_FUNCTION_NUMBER_PCH_SMBUS,
+ 0
+ );
+ ///
+ /// Enable the Smbus I/O Enable
+ ///
+ MmioOr8 (SmbusRegBase + R_PCH_SMBUS_PCICMD, B_PCH_SMBUS_PCICMD_IOSE);
+
+ ///
+ /// Enable the Smbus host controller
+ ///
+ MmioAndThenOr8 (
+ SmbusRegBase + R_PCH_SMBUS_HOSTC,
+ (UINT8) (~(B_PCH_SMBUS_HOSTC_SMI_EN | B_PCH_SMBUS_HOSTC_I2C_EN)),
+ B_PCH_SMBUS_HOSTC_HST_EN
+ );
+
+ SmbusIoWrite (R_PCH_SMBUS_HSTS, B_PCH_SMBUS_HSTS_ALL);
+} \ No newline at end of file
diff --git a/ReferenceCode/Chipset/LynxPoint/Smbus/Dxe/PchSmbus.dxs b/ReferenceCode/Chipset/LynxPoint/Smbus/Dxe/PchSmbus.dxs
new file mode 100644
index 0000000..a64aee1
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Smbus/Dxe/PchSmbus.dxs
@@ -0,0 +1,40 @@
+/** @file
+ Dispatch dependency expression file for the DXE PchSmbus driver.
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "DxeDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+
+#include EFI_PROTOCOL_DEFINITION (PchPlatformPolicy)
+#endif
+
+DEPENDENCY_START
+ DXE_PCH_PLATFORM_POLICY_PROTOCOL_GUID
+DEPENDENCY_END
diff --git a/ReferenceCode/Chipset/LynxPoint/Smbus/Dxe/PchSmbus.h b/ReferenceCode/Chipset/LynxPoint/Smbus/Dxe/PchSmbus.h
new file mode 100644
index 0000000..6c6b93b
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Smbus/Dxe/PchSmbus.h
@@ -0,0 +1,360 @@
+/** @file
+ PCH Smbus Protocol
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#ifndef _DXE_PCH_SMBUS_H
+#define _DXE_PCH_SMBUS_H
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+
+#include "EdkIIGlueDxe.h"
+//
+// Driver Produced Protocol Prototypes
+//
+#include EFI_PROTOCOL_PRODUCER (Smbus)
+#include EFI_GUID_DEFINITION (SmbusArpMap)
+//
+// Driver Consumed Protcol Prototypes
+//
+#include EFI_PROTOCOL_CONSUMER (PchPlatformPolicy)
+#include "PchSmbusCommon.h"
+#endif
+//
+// Definitions
+//
+///
+/// Max number of SMBus devices (7 bit address yields 128 combinations but 21 of those are reserved)
+///
+#define MAX_SMBUS_DEVICES 107
+#define MICROSECOND 10
+#define MILLISECOND (1000 * MICROSECOND)
+#define ONESECOND (1000 * MILLISECOND)
+
+///
+/// Private Data Structures
+///
+typedef struct _SMBUS_NOTIFY_FUNCTION_LIST_NODE {
+ UINT32 Signature;
+ LIST_ENTRY Link;
+ EFI_SMBUS_DEVICE_ADDRESS SlaveAddress;
+ UINTN Data;
+ EFI_SMBUS_NOTIFY_FUNCTION NotifyFunction;
+} SMBUS_NOTIFY_FUNCTION_LIST_NODE;
+
+#define SMBUS_NOTIFY_FUNCTION_LIST_NODE_FROM_LINK(_node) \
+ CR ( \
+ _node, \
+ SMBUS_NOTIFY_FUNCTION_LIST_NODE, \
+ Link, \
+ PCH_SMBUS_PRIVATE_DATA_SIGNATURE \
+ )
+
+///
+/// Declare a local instance structure for this driver
+///
+typedef struct _SMBUS_INSTANCE {
+ UINTN Signature;
+ EFI_HANDLE Handle;
+
+ UINT32 SmbusIoBase;
+ SMBUS_IO_READ SmbusIoRead;
+ SMBUS_IO_WRITE SmbusIoWrite;
+ SMBUS_IO_DONE IoDone;
+
+ ///
+ /// Published interface
+ ///
+ EFI_SMBUS_HC_PROTOCOL SmbusController;
+
+ UINT8 DeviceMapEntries;
+ EFI_SMBUS_DEVICE_MAP DeviceMap[MAX_SMBUS_DEVICES];
+
+ UINT8 PlatformNumRsvd;
+ UINT8 *PlatformRsvdAddr;
+
+ LIST_ENTRY NotifyFunctionList;
+ EFI_EVENT NotificationEvent;
+
+} SMBUS_INSTANCE;
+
+//
+// Driver global data
+//
+SMBUS_INSTANCE *mSmbusContext;
+
+//
+// Prototypes
+//
+
+/**
+ Execute an SMBUS operation
+
+ @param[in] This The protocol instance
+ @param[in] SlaveAddress The address of the SMBUS slave device
+ @param[in] Command The SMBUS command
+ @param[in] Operation Which SMBus protocol will be issued
+ @param[in] PecCheck If Packet Error Code Checking is to be used
+ @param[out] Length Length of data
+ @param[out] Buffer Data buffer
+
+ @retval EFI_SUCCESS The SMBUS operation is successful
+ @retval Other Values Something error occurred
+**/
+EFI_STATUS
+EFIAPI
+SmbusExecute (
+ IN EFI_SMBUS_HC_PROTOCOL *This,
+ IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
+ IN EFI_SMBUS_DEVICE_COMMAND Command,
+ IN EFI_SMBUS_OPERATION Operation,
+ IN BOOLEAN PecCheck,
+ IN OUT UINTN *Length,
+ IN OUT VOID *Buffer
+ );
+
+/**
+ Smbus driver entry point
+
+ @param[in] ImageHandle ImageHandle of this module
+ @param[in] SystemTable EFI System Table
+
+ @retval EFI_SUCCESS Driver initializes successfully
+ @retval Other values Some error occurred
+**/
+EFI_STATUS
+EFIAPI
+InitializePchSmbus (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ );
+
+/**
+ Set Slave address for an Smbus device with a known UDID or perform a general
+ ARP of all devices.
+
+ @param[in] This Pointer to the instance of the EFI_SMBUS_HC_PROTOCOL.
+ @param[in] ArpAll If TRUE, do a full ARP. Otherwise, just ARP the specified UDID.
+ @param[in] SmbusUdid When doing a directed ARP, ARP the device with this UDID.
+ @@param[in, out] SlaveAddress Buffer to store new Slave Address during directed ARP. On output,If
+ ArpAlll == TRUE, this will contain the newly assigned Slave address.
+
+ @retval EFI_INVALID_PARAMETER ArpAll == FALSE but SmbusUdid or SlaveAddress are NULL.
+ Return value from SmbusFullArp() or SmbusDirectedArp().
+**/
+EFI_STATUS
+EFIAPI
+SmbusArpDevice (
+ IN EFI_SMBUS_HC_PROTOCOL * This,
+ IN BOOLEAN ArpAll,
+ IN EFI_SMBUS_UDID * SmbusUdid, OPTIONAL
+ IN OUT EFI_SMBUS_DEVICE_ADDRESS * SlaveAddress OPTIONAL
+ );
+
+/**
+ Get a pointer to the assigned mappings of UDID's to Slave Addresses.
+
+ @param[in] This Pointer to the instance of the EFI_SMBUS_HC_PROTOCOL.
+ @param[in, out] Length Buffer to contain the lenght of the Device Map, it will be updated to
+ contain the number of pairs of UDID's mapped to Slave Addresses.
+ @param[in, out] SmbusDeviceMap Buffer to contian a pointer to the Device Map, it will be updated to
+ point to the first pair in the Device Map
+
+ @retval EFI_SUCCESS Function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+SmbusGetArpMap (
+ IN EFI_SMBUS_HC_PROTOCOL *This,
+ IN OUT UINTN *Length,
+ IN OUT EFI_SMBUS_DEVICE_MAP **SmbusDeviceMap
+ );
+
+/**
+ Register a callback in the event of a Host Notify command being sent by a
+ specified Slave Device.
+
+ @param[in] This Pointer to the instance of the EFI_SMBUS_HC_PROTOCOL.
+ @param[in] SlaveAddress Address of the device whose Host Notify command we want to
+ trap.
+ @param[in] Data Data of the Host Notify command we want to trap.
+ @param[in] NotifyFunction Function to be called in the event the desired Host Notify
+ command occurs.
+
+ @exception EFI_UNSUPPORTED Unable to create the event needed for notifications.
+ @retval EFI_INVALID_PARAMETER NotifyFunction was NULL.
+ @retval EFI_OUT_OF_RESOURCES Unable to allocate space to register the notification.
+ @retval EFI_SUCCESS Function completed successfully
+**/
+EFI_STATUS
+EFIAPI
+SmbusNotify (
+ IN EFI_SMBUS_HC_PROTOCOL *This,
+ IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
+ IN UINTN Data,
+ IN EFI_SMBUS_NOTIFY_FUNCTION NotifyFunction
+ );
+
+/**
+ Set up a periodic event so that we can check if any Slave Device has sent a
+ Notify ARP Master command.
+
+ @param[in] None.
+
+ @retval EFI_SUCCESS Periodic event successfully set up.
+ @retval Other Errors Failed to set up Periodic event.
+ Error value from CreateEvent().
+ Error value from SetTimer().
+**/
+EFI_STATUS
+InitializePeriodicEvent (
+ VOID
+ );
+
+/**
+ Function to be called every time periodic event happens. This will check if
+ the SMBus Host Controller has received a Host Notify command. If so, it will
+ see if a notification has been reqested on that event and make any callbacks
+ that may be necessary.
+
+ @param[in] Event The periodic event that occured and got us into this callback.
+ @param[in] Context Event context. Will be NULL in this case, since we already have our
+ private data in a module global variable.
+
+ @retval None
+**/
+VOID
+EFIAPI
+PollSmbusNotify (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ );
+
+/**
+ Issue a prepare ARP command to informs all devices that the ARP Master is starting the ARP process
+
+ @param[in] Private Pointer to the SMBUS_INSTANCE
+
+ @retval EFI_SUCCESS The SMBUS operation is successful
+ @retval Other Values Something error occurred
+**/
+EFI_STATUS
+SmbusPrepareToArp (
+ IN SMBUS_INSTANCE *Private
+ );
+
+/**
+ Issue a Get UDID (general) command to requests ARP-capable and/or Discoverable devices to
+ return their slave address along with their UDID.
+
+ @param[in] Private Pointer to the SMBUS_INSTANCE
+ @param[in, out] DeviceMap Pointer to SMBUS device map table that slave device return
+
+ @retval EFI_SUCCESS The SMBUS operation is successful
+ @retval Other Values Something error occurred
+**/
+EFI_STATUS
+SmbusGetUdidGeneral (
+ IN SMBUS_INSTANCE *Private,
+ IN OUT EFI_SMBUS_DEVICE_MAP *DeviceMap
+ );
+
+/**
+ Issue a Assign address command to assigns an address to a specific slave device.
+
+ @param[in] Private Pointer to the SMBUS_INSTANCE
+ @param[in, out] DeviceMap Pointer to SMBUS device map table that send to slave device
+
+ @retval EFI_SUCCESS The SMBUS operation is successful
+ @retval Other Values Something error occurred
+**/
+EFI_STATUS
+SmbusAssignAddress (
+ IN SMBUS_INSTANCE *Private,
+ IN OUT EFI_SMBUS_DEVICE_MAP *DeviceMap
+ );
+
+/**
+ Do a fully (general) Arp procress to assign the slave address of all ARP-capable device.
+ This function will issue issue the "Prepare to ARP", "Get UDID" and "Assign Address" commands.
+
+ @param[in] Private Pointer to the SMBUS_INSTANCE
+
+ @retval EFI_OUT_OF_RESOURCES No available address to assign
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+SmbusFullArp (
+ IN SMBUS_INSTANCE *Private
+ );
+
+/**
+ Do a directed Arp procress to assign the slave address of a single ARP-capable device.
+
+ @param[in] Private Pointer to the SMBUS_INSTANCE
+ @param[in] SmbusUdid When doing a directed ARP, ARP the device with this UDID.
+ @param[in, out] SlaveAddress Buffer to store new Slave Address during directed ARP.
+
+ @retval EFI_OUT_OF_RESOURCES DeviceMapEntries is more than Max number of SMBus devices
+ Or there is no available address to assign
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+SmbusDirectedArp (
+ IN SMBUS_INSTANCE *Private,
+ IN EFI_SMBUS_UDID *SmbusUdid,
+ IN OUT EFI_SMBUS_DEVICE_ADDRESS *SlaveAddress
+ );
+
+/**
+ Find an available address to assign
+
+ @param[in] Private Pointer to the SMBUS_INSTANCE
+ @param[in] SlaveAddress Buffer to store new Slave Address during directed ARP.
+
+ @retval EFI_OUT_OF_RESOURCES There is no available address to assign
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+GetNextAvailableAddress (
+ IN SMBUS_INSTANCE *Private,
+ IN OUT EFI_SMBUS_DEVICE_ADDRESS *SlaveAddress
+ );
+
+/**
+ Check whether the address is assignable.
+
+ @param[in] Private Pointer to the SMBUS_INSTANCE
+ @param[in] SlaveAddress The Slave Address for checking
+
+ @retval TRUE The address is assignable
+ @retval FALSE The address is not assignable
+**/
+BOOLEAN
+IsAddressAvailable (
+ IN SMBUS_INSTANCE *Private,
+ IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress
+ );
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Smbus/Dxe/PchSmbusArp.c b/ReferenceCode/Chipset/LynxPoint/Smbus/Dxe/PchSmbusArp.c
new file mode 100644
index 0000000..88124d4
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Smbus/Dxe/PchSmbusArp.c
@@ -0,0 +1,681 @@
+/** @file
+ PCH Smbus Driver, ARP functions common to PEI and DXE
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "PchSmbus.h"
+
+///
+/// These addresses are reserved by the SMBus 2.0 specification
+///
+static UINT8 mReservedAddress[SMBUS_NUM_RESERVED] = {
+ 0x00,
+ 0x02,
+ 0x04,
+ 0x06,
+ 0x08,
+ 0x0A,
+ 0x0C,
+ 0x0E,
+ 0x10,
+ 0x18,
+ 0x50,
+ 0x6E,
+ 0xC2,
+ 0xF0,
+ 0xF2,
+ 0xF4,
+ 0xF6,
+ 0xF8,
+ 0xFA,
+ 0xFC,
+ 0xFE,
+ 0x12,
+ 0x14,
+ 0x16,
+ 0x58,
+ 0x5A,
+ 0x80,
+ 0x82,
+ 0x84,
+ 0x86,
+ 0x88,
+ 0x90,
+ 0x92,
+ 0x94,
+ 0x96,
+ 0x1A,
+ 0x1C,
+ 0x1E
+};
+
+/**
+ Set Slave address for an Smbus device with a known UDID or perform a general
+ ARP of all devices.
+
+ @param[in] This Pointer to the instance of the EFI_SMBUS_HC_PROTOCOL.
+ @param[in] ArpAll If TRUE, do a full ARP. Otherwise, just ARP the specified UDID.
+ @param[in] SmbusUdid When doing a directed ARP, ARP the device with this UDID.
+ @@param[in, out] SlaveAddress Buffer to store new Slave Address during directed ARP. On output,If
+ ArpAlll == TRUE, this will contain the newly assigned Slave address.
+
+ @retval EFI_INVALID_PARAMETER ArpAll == FALSE but SmbusUdid or SlaveAddress are NULL.
+ Return value from SmbusFullArp() or SmbusDirectedArp().
+**/
+EFI_STATUS
+EFIAPI
+SmbusArpDevice (
+ IN EFI_SMBUS_HC_PROTOCOL * This,
+ IN BOOLEAN ArpAll,
+ IN EFI_SMBUS_UDID * SmbusUdid, OPTIONAL
+ IN OUT EFI_SMBUS_DEVICE_ADDRESS * SlaveAddress OPTIONAL
+ )
+{
+ DEBUG ((EFI_D_INFO, "SmbusArpDevice() Start\n"));
+
+ InitializeSmbusRegisters ();
+
+ DEBUG ((EFI_D_INFO, "SmbusArpDevice() End\n"));
+
+ if (ArpAll) {
+ return SmbusFullArp (mSmbusContext);
+ } else {
+ if ((SmbusUdid == NULL) || (SlaveAddress == NULL)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ return SmbusDirectedArp (mSmbusContext, SmbusUdid, SlaveAddress);
+ }
+}
+
+/**
+ Get a pointer to the assigned mappings of UDID's to Slave Addresses.
+
+ @param[in] This Pointer to the instance of the EFI_SMBUS_HC_PROTOCOL.
+ @param[in, out] Length Buffer to contain the lenght of the Device Map, it will be updated to
+ contain the number of pairs of UDID's mapped to Slave Addresses.
+ @param[in, out] SmbusDeviceMap Buffer to contian a pointer to the Device Map, it will be updated to
+ point to the first pair in the Device Map
+
+ @retval EFI_SUCCESS Function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+SmbusGetArpMap (
+ IN EFI_SMBUS_HC_PROTOCOL *This,
+ IN OUT UINTN *Length,
+ IN OUT EFI_SMBUS_DEVICE_MAP **SmbusDeviceMap
+ )
+{
+ *Length = mSmbusContext->DeviceMapEntries * sizeof (EFI_SMBUS_DEVICE_MAP);
+ *SmbusDeviceMap = mSmbusContext->DeviceMap;
+ return EFI_SUCCESS;
+}
+
+/**
+ Register a callback in the event of a Host Notify command being sent by a
+ specified Slave Device.
+
+ @param[in] This Pointer to the instance of the EFI_SMBUS_HC_PROTOCOL.
+ @param[in] SlaveAddress Address of the device whose Host Notify command we want to
+ trap.
+ @param[in] Data Data of the Host Notify command we want to trap.
+ @param[in] NotifyFunction Function to be called in the event the desired Host Notify
+ command occurs.
+
+ @exception EFI_UNSUPPORTED Unable to create the event needed for notifications.
+ @retval EFI_INVALID_PARAMETER NotifyFunction was NULL.
+ @retval EFI_OUT_OF_RESOURCES Unable to allocate space to register the notification.
+ @retval EFI_SUCCESS Function completed successfully
+**/
+EFI_STATUS
+EFIAPI
+SmbusNotify (
+ IN EFI_SMBUS_HC_PROTOCOL *This,
+ IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
+ IN UINTN Data,
+ IN EFI_SMBUS_NOTIFY_FUNCTION NotifyFunction
+ )
+{
+ EFI_STATUS Status;
+ SMBUS_NOTIFY_FUNCTION_LIST_NODE *NewNode;
+
+ DEBUG ((EFI_D_INFO, "SmbusNotify() Start\n"));
+
+ if (NotifyFunction == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ NewNode = (SMBUS_NOTIFY_FUNCTION_LIST_NODE *) AllocatePool (sizeof (SMBUS_NOTIFY_FUNCTION_LIST_NODE));
+ if (NewNode == NULL) {
+ DEBUG ((EFI_D_ERROR, "Failed to allocate memory for NewNode! \n"));
+ return EFI_OUT_OF_RESOURCES;
+ }
+ ///
+ /// If this is the first notification request, start an event to periodically
+ /// check for a Notify master command.
+ ///
+ if (!mSmbusContext->NotificationEvent) {
+ Status = InitializePeriodicEvent ();
+ if (EFI_ERROR (Status)) {
+ FreePool (NewNode);
+ return EFI_UNSUPPORTED;
+ }
+ }
+
+ NewNode->Signature = PCH_SMBUS_PRIVATE_DATA_SIGNATURE;
+ NewNode->SlaveAddress.SmbusDeviceAddress = SlaveAddress.SmbusDeviceAddress;
+ NewNode->Data = Data;
+ NewNode->NotifyFunction = NotifyFunction;
+
+ InsertTailList (&mSmbusContext->NotifyFunctionList, &NewNode->Link);
+
+ DEBUG ((EFI_D_INFO, "SmbusNotify() End\n"));
+ return EFI_SUCCESS;
+}
+
+/**
+ Set up a periodic event so that we can check if any Slave Device has sent a
+ Notify ARP Master command.
+
+ @param[in] None.
+
+ @retval EFI_SUCCESS Periodic event successfully set up.
+ @retval Other Errors Failed to set up Periodic event.
+ Error value from CreateEvent().
+**/
+EFI_STATUS
+InitializePeriodicEvent (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+
+ Status = gBS->CreateEvent (
+ (EVENT_TIMER | EVENT_NOTIFY_SIGNAL),
+ TPL_CALLBACK,
+ PollSmbusNotify,
+ NULL,
+ &mSmbusContext->NotificationEvent
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = gBS->SetTimer (
+ mSmbusContext->NotificationEvent,
+ TimerPeriodic,
+ 1000 * MILLISECOND
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Function to be called every time periodic event happens. This will check if
+ the SMBus Host Controller has received a Host Notify command. If so, it will
+ see if a notification has been reqested on that event and make any callbacks
+ that may be necessary.
+
+ @param[in] Event The periodic event that occured and got us into this callback.
+ @param[in] Context Event context. Will be NULL in this case, since we already have our
+ private data in a module global variable.
+
+ @retval None
+**/
+VOID
+EFIAPI
+PollSmbusNotify (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ LIST_ENTRY *Link;
+ EFI_SMBUS_DEVICE_ADDRESS SlaveAddress;
+ SMBUS_NOTIFY_FUNCTION_LIST_NODE *Node;
+ UINT8 SstsReg;
+ UINTN Data;
+
+ DEBUG ((EFI_D_INFO, "PollSmbusNotify() Start\n"));
+
+ InitializeSmbusRegisters ();
+
+ SstsReg = SmbusIoRead (R_PCH_SMBUS_SSTS);
+ if (!(SstsReg & B_PCH_SMBUS_HOST_NOTIFY_STS)) {
+ ///
+ /// Host Notify has not been received
+ ///
+ return;
+ }
+ ///
+ /// There was a Host Notify, see if any one wants to know about it
+ ///
+ SlaveAddress.SmbusDeviceAddress = (SmbusIoRead (R_PCH_SMBUS_NDA)) >> 1;
+
+ Link = GetFirstNode (&mSmbusContext->NotifyFunctionList);
+
+ while (!IsNull (&mSmbusContext->NotifyFunctionList, Link)) {
+ Node = SMBUS_NOTIFY_FUNCTION_LIST_NODE_FROM_LINK (Link);
+
+ if (Node->SlaveAddress.SmbusDeviceAddress == SlaveAddress.SmbusDeviceAddress) {
+ Data = (SmbusIoRead (R_PCH_SMBUS_NDHB) << 8) + (SmbusIoRead (R_PCH_SMBUS_NDLB));
+ if ((UINT16) Node->Data == (UINT16) Data) {
+ ///
+ /// We have a match, notify the requested function
+ ///
+ Node->NotifyFunction (SlaveAddress, Data);
+ }
+ }
+
+ Link = GetNextNode (&mSmbusContext->NotifyFunctionList, &Node->Link);
+ }
+ ///
+ /// Clear the Notify Status bit and exit.
+ ///
+ SmbusIoWrite (R_PCH_SMBUS_SSTS, B_PCH_SMBUS_HOST_NOTIFY_STS);
+
+ DEBUG ((EFI_D_INFO, "PollSmbusNotify() End\n"));
+
+ return;
+}
+
+/**
+ Issue a prepare ARP command to informs all devices that the ARP Master is starting the ARP process
+
+ @param[in] Private Pointer to the SMBUS_INSTANCE
+
+ @retval EFI_SUCCESS The SMBUS operation is successful
+ @retval Other Values Something error occurred
+**/
+EFI_STATUS
+SmbusPrepareToArp (
+ IN SMBUS_INSTANCE *Private
+ )
+{
+ EFI_SMBUS_DEVICE_ADDRESS SlaveAddress;
+ EFI_STATUS Status;
+ UINTN Length;
+ UINT8 Buffer;
+
+ DEBUG ((EFI_D_INFO, "SmbusPrepareToArp() Start\n"));
+
+ SlaveAddress.SmbusDeviceAddress = SMBUS_ADDRESS_ARP;
+ Length = 1;
+ Buffer = SMBUS_DATA_PREPARE_TO_ARP;
+
+ Status = SmbusExec (
+ SlaveAddress,
+ 0,
+ EfiSmbusSendByte,
+ TRUE,
+ &Length,
+ &Buffer
+ );
+
+ DEBUG ((EFI_D_INFO, "SmbusPrepareToArp() End\n"));
+
+ return Status;
+}
+
+/**
+ Issue a Get UDID (general) command to requests ARP-capable and/or Discoverable devices to
+ return their slave address along with their UDID.
+
+ @param[in] Private Pointer to the SMBUS_INSTANCE
+ @param[in, out] DeviceMap Pointer to SMBUS device map table that slave device return
+
+ @retval EFI_SUCCESS The SMBUS operation is successful
+ @retval Other Values Something error occurred
+**/
+EFI_STATUS
+SmbusGetUdidGeneral (
+ IN SMBUS_INSTANCE *Private,
+ IN OUT EFI_SMBUS_DEVICE_MAP *DeviceMap
+ )
+{
+ EFI_SMBUS_DEVICE_ADDRESS SlaveAddress;
+ EFI_STATUS Status;
+ UINTN Length;
+ UINT8 Buffer[SMBUS_GET_UDID_LENGTH];
+
+ DEBUG ((EFI_D_INFO, "SmbusGetUdidGeneral() Start\n"));
+
+ SlaveAddress.SmbusDeviceAddress = SMBUS_ADDRESS_ARP;
+ Length = SMBUS_GET_UDID_LENGTH;
+
+ Status = SmbusExec (
+ SlaveAddress,
+ SMBUS_DATA_GET_UDID_GENERAL,
+ EfiSmbusReadBlock,
+ TRUE,
+ &Length,
+ Buffer
+ );
+
+ if (!EFI_ERROR (Status)) {
+ if (Length == SMBUS_GET_UDID_LENGTH) {
+ DeviceMap->SmbusDeviceUdid.DeviceCapabilities = Buffer[0];
+ DeviceMap->SmbusDeviceUdid.VendorRevision = Buffer[1];
+ DeviceMap->SmbusDeviceUdid.VendorId = (UINT16) ((Buffer[2] << 8) + Buffer[3]);
+ DeviceMap->SmbusDeviceUdid.DeviceId = (UINT16) ((Buffer[4] << 8) + Buffer[5]);
+ DeviceMap->SmbusDeviceUdid.Interface = (UINT16) ((Buffer[6] << 8) + Buffer[7]);
+ DeviceMap->SmbusDeviceUdid.SubsystemVendorId = (UINT16) ((Buffer[8] << 8) + Buffer[9]);
+ DeviceMap->SmbusDeviceUdid.SubsystemDeviceId = (UINT16) ((Buffer[10] << 8) + Buffer[11]);
+ DeviceMap->SmbusDeviceUdid.VendorSpecificId = (UINT32) ((Buffer[12] << 24) + (Buffer[13] << 16) + (Buffer[14] << 8) + Buffer[15]);
+ DeviceMap->SmbusDeviceAddress.SmbusDeviceAddress = (UINT8) (Buffer[16] >> 1);
+ } else {
+ Status = EFI_DEVICE_ERROR;
+ }
+ }
+
+ DEBUG ((EFI_D_INFO, "SmbusGetUdidGeneral() End\n"));
+
+ return Status;
+}
+
+/**
+ Issue a Assign address command to assigns an address to a specific slave device.
+
+ @param[in] Private Pointer to the SMBUS_INSTANCE
+ @param[in, out] DeviceMap Pointer to SMBUS device map table that send to slave device
+
+ @retval EFI_SUCCESS The SMBUS operation is successful
+ @retval Other Values Something error occurred
+**/
+EFI_STATUS
+SmbusAssignAddress (
+ IN SMBUS_INSTANCE *Private,
+ IN OUT EFI_SMBUS_DEVICE_MAP *DeviceMap
+ )
+{
+ EFI_SMBUS_DEVICE_ADDRESS SlaveAddress;
+ EFI_STATUS Status;
+ UINTN Length;
+ UINT8 Buffer[SMBUS_GET_UDID_LENGTH];
+
+ DEBUG ((EFI_D_INFO, "SmbusAssignAddress() Start\n"));
+
+ Buffer[0] = DeviceMap->SmbusDeviceUdid.DeviceCapabilities;
+ Buffer[1] = DeviceMap->SmbusDeviceUdid.VendorRevision;
+ Buffer[2] = (UINT8) (DeviceMap->SmbusDeviceUdid.VendorId >> 8);
+ Buffer[3] = (UINT8) (DeviceMap->SmbusDeviceUdid.VendorId);
+ Buffer[4] = (UINT8) (DeviceMap->SmbusDeviceUdid.DeviceId >> 8);
+ Buffer[5] = (UINT8) (DeviceMap->SmbusDeviceUdid.DeviceId);
+ Buffer[6] = (UINT8) (DeviceMap->SmbusDeviceUdid.Interface >> 8);
+ Buffer[7] = (UINT8) (DeviceMap->SmbusDeviceUdid.Interface);
+ Buffer[8] = (UINT8) (DeviceMap->SmbusDeviceUdid.SubsystemVendorId >> 8);
+ Buffer[9] = (UINT8) (DeviceMap->SmbusDeviceUdid.SubsystemVendorId);
+ Buffer[10] = (UINT8) (DeviceMap->SmbusDeviceUdid.SubsystemDeviceId >> 8);
+ Buffer[11] = (UINT8) (DeviceMap->SmbusDeviceUdid.SubsystemDeviceId);
+ Buffer[12] = (UINT8) (DeviceMap->SmbusDeviceUdid.VendorSpecificId >> 24);
+ Buffer[13] = (UINT8) (DeviceMap->SmbusDeviceUdid.VendorSpecificId >> 16);
+ Buffer[14] = (UINT8) (DeviceMap->SmbusDeviceUdid.VendorSpecificId >> 8);
+ Buffer[15] = (UINT8) (DeviceMap->SmbusDeviceUdid.VendorSpecificId);
+ Buffer[16] = (UINT8) (DeviceMap->SmbusDeviceAddress.SmbusDeviceAddress << 1);
+
+ SlaveAddress.SmbusDeviceAddress = SMBUS_ADDRESS_ARP;
+ Length = SMBUS_GET_UDID_LENGTH;
+
+ Status = SmbusExec (
+ SlaveAddress,
+ SMBUS_DATA_ASSIGN_ADDRESS,
+ EfiSmbusWriteBlock,
+ TRUE,
+ &Length,
+ Buffer
+ );
+
+ DEBUG ((EFI_D_INFO, "SmbusAssignAddress() End\n"));
+
+ return Status;
+}
+
+/**
+ Do a fully (general) Arp procress to assign the slave address of all ARP-capable device.
+ This function will issue issue the "Prepare to ARP", "Get UDID" and "Assign Address" commands.
+
+ @param[in] Private Pointer to the SMBUS_INSTANCE
+
+ @retval EFI_OUT_OF_RESOURCES No available address to assign
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+SmbusFullArp (
+ IN SMBUS_INSTANCE *Private
+ )
+{
+ EFI_STATUS Status;
+ EFI_SMBUS_DEVICE_MAP *CurrentDeviceMap;
+
+ DEBUG ((EFI_D_INFO, "SmbusFullArp() Start\n"));
+
+ Status = SmbusPrepareToArp (Private);
+ if (EFI_ERROR (Status)) {
+ if (Status == EFI_DEVICE_ERROR) {
+ ///
+ /// ARP is complete
+ ///
+ return EFI_SUCCESS;
+ } else {
+ return Status;
+ }
+ }
+ ///
+ /// Main loop to ARP all ARP-capable devices
+ ///
+ do {
+ CurrentDeviceMap = &Private->DeviceMap[Private->DeviceMapEntries];
+ Status = SmbusGetUdidGeneral (Private, CurrentDeviceMap);
+ if (EFI_ERROR (Status)) {
+ break;
+ }
+
+ if (CurrentDeviceMap->SmbusDeviceAddress.SmbusDeviceAddress == (0xFF >> 1)) {
+ ///
+ /// If address is unassigned, assign it
+ ///
+ Status = GetNextAvailableAddress (
+ Private,
+ &CurrentDeviceMap->SmbusDeviceAddress
+ );
+ if (EFI_ERROR (Status)) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ } else if (((CurrentDeviceMap->SmbusDeviceUdid.DeviceCapabilities) & 0xC0) != 0) {
+ ///
+ /// if address is not fixed, check if the current address is available
+ ///
+ if (!IsAddressAvailable (
+ Private,
+ CurrentDeviceMap->SmbusDeviceAddress
+ )) {
+ ///
+ /// if currently assigned address is already used, get a new one
+ ///
+ Status = GetNextAvailableAddress (
+ Private,
+ &CurrentDeviceMap->SmbusDeviceAddress
+ );
+ if (EFI_ERROR (Status)) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ }
+ }
+
+ Status = SmbusAssignAddress (Private, CurrentDeviceMap);
+ if (EFI_ERROR (Status)) {
+ ///
+ /// If there was a device error, just continue on and try again.
+ /// Other errors should be reported.
+ ///
+ if (Status != EFI_DEVICE_ERROR) {
+ return Status;
+ }
+ } else {
+ ///
+ /// If there was no error, the address was assigned and we must update our
+ /// records.
+ ///
+ Private->DeviceMapEntries++;
+ }
+
+ } while (Private->DeviceMapEntries < MAX_SMBUS_DEVICES);
+
+ DEBUG ((EFI_D_INFO, "SmbusFullArp() End\n"));
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Do a directed Arp procress to assign the slave address of a single ARP-capable device.
+
+ @param[in] Private Pointer to the SMBUS_INSTANCE
+ @param[in] SmbusUdid When doing a directed ARP, ARP the device with this UDID.
+ @param[in, out] SlaveAddress Buffer to store new Slave Address during directed ARP.
+
+ @retval EFI_OUT_OF_RESOURCES DeviceMapEntries is more than Max number of SMBus devices
+ Or there is no available address to assign
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+SmbusDirectedArp (
+ IN SMBUS_INSTANCE *Private,
+ IN EFI_SMBUS_UDID *SmbusUdid,
+ IN OUT EFI_SMBUS_DEVICE_ADDRESS *SlaveAddress
+ )
+{
+ EFI_STATUS Status;
+ EFI_SMBUS_DEVICE_MAP *CurrentDeviceMap;
+
+ DEBUG ((EFI_D_INFO, "SmbusDirectedArp() Start\n"));
+
+ if (Private->DeviceMapEntries >= MAX_SMBUS_DEVICES) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ CurrentDeviceMap = &Private->DeviceMap[Private->DeviceMapEntries];
+
+ ///
+ /// Find an available address to assign
+ ///
+ Status = GetNextAvailableAddress (
+ Private,
+ &CurrentDeviceMap->SmbusDeviceAddress
+ );
+ if (EFI_ERROR (Status)) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ CurrentDeviceMap->SmbusDeviceUdid.DeviceCapabilities = SmbusUdid->DeviceCapabilities;
+ CurrentDeviceMap->SmbusDeviceUdid.DeviceId = SmbusUdid->DeviceId;
+ CurrentDeviceMap->SmbusDeviceUdid.Interface = SmbusUdid->Interface;
+ CurrentDeviceMap->SmbusDeviceUdid.SubsystemDeviceId = SmbusUdid->SubsystemDeviceId;
+ CurrentDeviceMap->SmbusDeviceUdid.SubsystemVendorId = SmbusUdid->SubsystemVendorId;
+ CurrentDeviceMap->SmbusDeviceUdid.VendorId = SmbusUdid->VendorId;
+ CurrentDeviceMap->SmbusDeviceUdid.VendorRevision = SmbusUdid->VendorRevision;
+ CurrentDeviceMap->SmbusDeviceUdid.VendorSpecificId = SmbusUdid->VendorSpecificId;
+
+ Status = SmbusAssignAddress (Private, CurrentDeviceMap);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Private->DeviceMapEntries++;
+ SlaveAddress->SmbusDeviceAddress = CurrentDeviceMap->SmbusDeviceAddress.SmbusDeviceAddress;
+
+ DEBUG ((EFI_D_INFO, "SmbusDirectedArp() End\n"));
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Find an available address to assign
+
+ @param[in] Private Pointer to the SMBUS_INSTANCE
+ @param[in] SlaveAddress Buffer to store new Slave Address during directed ARP.
+
+ @retval EFI_OUT_OF_RESOURCES There is no available address to assign
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+GetNextAvailableAddress (
+ IN SMBUS_INSTANCE *Private,
+ IN EFI_SMBUS_DEVICE_ADDRESS *SlaveAddress
+ )
+{
+ for (SlaveAddress->SmbusDeviceAddress = 0x03;
+ SlaveAddress->SmbusDeviceAddress < 0x7F;
+ SlaveAddress->SmbusDeviceAddress++
+ ) {
+ if (IsAddressAvailable (Private, *SlaveAddress)) {
+ return EFI_SUCCESS;
+ }
+ }
+
+ return EFI_OUT_OF_RESOURCES;
+}
+
+/**
+ Check whether the address is assignable.
+
+ @param[in] Private Pointer to the SMBUS_INSTANCE
+ @param[in] SlaveAddress The Slave Address for checking
+
+ @retval TRUE The address is assignable
+ @retval FALSE The address is not assignable
+**/
+BOOLEAN
+IsAddressAvailable (
+ IN SMBUS_INSTANCE *Private,
+ IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress
+ )
+{
+ UINT8 Index;
+
+ ///
+ /// See if we have already assigned this address to a device
+ ///
+ for (Index = 0; Index < Private->DeviceMapEntries; Index++) {
+ if (SlaveAddress.SmbusDeviceAddress == Private->DeviceMap[Index].SmbusDeviceAddress.SmbusDeviceAddress) {
+ return FALSE;
+ }
+ }
+ ///
+ /// See if this address is claimed by a platform non-ARP-capable device
+ ///
+ for (Index = 0; Index < Private->PlatformNumRsvd; Index++) {
+ if ((SlaveAddress.SmbusDeviceAddress << 1) == Private->PlatformRsvdAddr[Index]) {
+ return FALSE;
+ }
+ }
+ ///
+ /// See if this is a reserved address
+ ///
+ for (Index = 0; Index < SMBUS_NUM_RESERVED; Index++) {
+ if ((SlaveAddress.SmbusDeviceAddress << 1) == (UINTN) mReservedAddress[Index]) {
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/Smbus/Dxe/PchSmbusDxe.cif b/ReferenceCode/Chipset/LynxPoint/Smbus/Dxe/PchSmbusDxe.cif
new file mode 100644
index 0000000..5a97eaa
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Smbus/Dxe/PchSmbusDxe.cif
@@ -0,0 +1,14 @@
+<component>
+ name = "PchSmbusDxe"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\Smbus\Dxe"
+ RefName = "PchSmbusDxe"
+[files]
+"PchSmbusDxe.sdl"
+"PchSmbusDxe.mak"
+"PchSmbus.h"
+"PchSmbusArp.c"
+"PchSmbusEntry.c"
+"PchSmbus.dxs"
+"PchSmbusDxe.inf"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/Smbus/Dxe/PchSmbusDxe.inf b/ReferenceCode/Chipset/LynxPoint/Smbus/Dxe/PchSmbusDxe.inf
new file mode 100644
index 0000000..ae41336
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Smbus/Dxe/PchSmbusDxe.inf
@@ -0,0 +1,93 @@
+## @file
+# Component description file for PchSmbus driver
+#
+#@copyright
+# Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = PchSmbusDxe
+FILE_GUID = E052D8A6-224A-4c32-8D37-2E0AE162364D
+COMPONENT_TYPE = BS_DRIVER
+
+[sources.common]
+ PchSmbusEntry.c
+ PchSmbus.h
+ PchSmbusArp.c
+ ../Common/PchSmbusExec.c
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueDxeDriverEntryPoint.c
+
+[includes.common]
+ $(EDK_SOURCE)/Foundation/Efi
+ .
+ ../Common
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/SampleCode
+
+[libraries.common]
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueBaseLib
+ EdkIIGlueDxeReportStatusCodeLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueDxeMemoryAllocationLib
+ EdkIIGlueDxeHobLib
+ EdkIIGlueBasePciLibPciExpress
+ EdkFrameworkProtocolLib
+ EdkProtocolLib
+ $(PROJECT_PCH_FAMILY)ProtocolLib
+ PchPlatformLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT=_ModuleEntryPoint
+ DPX_SOURCE=PchSmbus.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=InitializePchSmbus
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_BASE_LIB__ \
+ -D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ -D __EDKII_GLUE_DXE_HOB_LIB__ \
+ -D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \ No newline at end of file
diff --git a/ReferenceCode/Chipset/LynxPoint/Smbus/Dxe/PchSmbusDxe.mak b/ReferenceCode/Chipset/LynxPoint/Smbus/Dxe/PchSmbusDxe.mak
new file mode 100644
index 0000000..3e74002
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Smbus/Dxe/PchSmbusDxe.mak
@@ -0,0 +1,103 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSmbusDxe/PchSmbusDxe.mak 2 2/24/12 2:22a Victortu $
+#
+# $Revision: 2 $
+#
+# $Date: 2/24/12 2:22a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSmbusDxe/PchSmbusDxe.mak $
+#
+# 2 2/24/12 2:22a Victortu
+# Updated to support 4.6.5.3_IntelEDK_1117_Patch7_00.
+#
+# 1 2/08/12 9:19a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+
+#---------------------------------------------------------------------------
+# Create PchSmbusDxe Driver
+#---------------------------------------------------------------------------
+EDK : PchSmbusDxe
+PchSmbusDxe : $(BUILD_DIR)\PchSmbusDxe.mak PchSmbusDxeBin
+
+
+$(BUILD_DIR)\PchSmbusDxe.mak : $(PchSmbusDxe_DIR)\$(@B).cif $(PchSmbusDxe_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(PchSmbusDxe_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+PchSmbusDxe_INCLUDES=\
+ $(INTEL_PCH_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+
+PchSmbusDxe_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=InitializePchSmbus"\
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_BASE_LIB__ \
+ /D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ /D __EDKII_GLUE_DXE_HOB_LIB__ \
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__
+
+PchSmbusDxe_LIB_LINKS =\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueDxeMemoryAllocationLib_LIB)\
+ $(EdkIIGlueDxeHobLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(EDKPROTOCOLLIB)\
+ $(INTEL_PCH_PROTOCOL_LIB)\
+ $(PchPlatformDxeLib_LIB)\
+ $(PchSmbusCommonDxeLib_LIB)
+
+PchSmbusDxeBin: $(PchSmbusDxe_LIB_LINKS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\PchSmbusDxe.mak all \
+ "MY_INCLUDES=$(PchSmbusDxe_INCLUDES)"\
+ "MY_DEFINES=$(PchSmbusDxe_DEFINES)"\
+ GUID=E052D8A6-224A-4c32-8D37-2E0AE162364D\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=BS_DRIVER\
+ EDKIIModule=DXEDRIVER\
+ DEPEX1=$(PchSmbusDxe_DIR)\PchSmbus.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX\
+ COMPRESS=1
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Smbus/Dxe/PchSmbusDxe.sdl b/ReferenceCode/Chipset/LynxPoint/Smbus/Dxe/PchSmbusDxe.sdl
new file mode 100644
index 0000000..8d5afd7
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Smbus/Dxe/PchSmbusDxe.sdl
@@ -0,0 +1,67 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSmbusDxe/PchSmbusDxe.sdl 1 2/08/12 9:19a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 9:19a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSmbusDxe/PchSmbusDxe.sdl $
+#
+# 1 2/08/12 9:19a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+TOKEN
+ Name = "PchSmbusDxe_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable PchSmbusDxe support in Project"
+End
+
+PATH
+ Name = "PchSmbusDxe_DIR"
+ Help = "PchSmbusDxe file source directory"
+End
+
+MODULE
+ Help = "Includes PchSmbusDxe.mak to Project"
+ File = "PchSmbusDxe.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PchSmbusDxe.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Smbus/Dxe/PchSmbusEntry.c b/ReferenceCode/Chipset/LynxPoint/Smbus/Dxe/PchSmbusEntry.c
new file mode 100644
index 0000000..35cab3f
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Smbus/Dxe/PchSmbusEntry.c
@@ -0,0 +1,149 @@
+/** @file
+ PCH Smbus Driver
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "PchSmbus.h"
+
+EFI_GUID mEfiSmbusArpMapGuid = EFI_SMBUS_ARP_MAP_GUID;
+
+/**
+ Execute an SMBUS operation
+
+ @param[in] This The protocol instance
+ @param[in] SlaveAddress The address of the SMBUS slave device
+ @param[in] Command The SMBUS command
+ @param[in] Operation Which SMBus protocol will be issued
+ @param[in] PecCheck If Packet Error Code Checking is to be used
+ @param[in, out] Length Length of data
+ @param[in, out] Buffer Data buffer
+
+ @retval EFI_SUCCESS The SMBUS operation is successful
+ @retval Other Values Something error occurred
+**/
+EFI_STATUS
+EFIAPI
+SmbusExecute (
+ IN EFI_SMBUS_HC_PROTOCOL *This,
+ IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
+ IN EFI_SMBUS_DEVICE_COMMAND Command,
+ IN EFI_SMBUS_OPERATION Operation,
+ IN BOOLEAN PecCheck,
+ IN OUT UINTN *Length,
+ IN OUT VOID *Buffer
+ )
+{
+ DEBUG ((EFI_D_INFO, "SmbusExecute() Start, SmbusDeviceAddress=%x, Command=%x, Operation=%x\n", (SlaveAddress.SmbusDeviceAddress << 1), Command, Operation));
+ InitializeSmbusRegisters ();
+
+ return SmbusExec (
+ SlaveAddress,
+ Command,
+ Operation,
+ PecCheck,
+ Length,
+ Buffer
+ );
+}
+
+/**
+ Smbus driver entry point
+
+ @param[in] ImageHandle ImageHandle of this module
+ @param[in] SystemTable EFI System Table
+
+ @retval EFI_SUCCESS Driver initializes successfully
+ @retval Other values Some error occurred
+**/
+EFI_STATUS
+EFIAPI
+InitializePchSmbus (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ DXE_PCH_PLATFORM_POLICY_PROTOCOL *PchPlatformPolicy;
+ EFI_STATUS Status;
+ UINTN DataSize;
+ VOID *Data;
+ EFI_PEI_HOB_POINTERS HobList;
+
+ DEBUG ((EFI_D_INFO, "InitializePchSmbus() Start\n"));
+
+ Status = gBS->LocateProtocol (
+ &gDxePchPlatformPolicyProtocolGuid,
+ NULL,
+ (VOID **) &PchPlatformPolicy
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ mSmbusContext = AllocateZeroPool (sizeof (SMBUS_INSTANCE));
+ if (mSmbusContext == NULL) {
+ ASSERT (FALSE);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ mSmbusContext->Signature = PCH_SMBUS_PRIVATE_DATA_SIGNATURE;
+ mSmbusContext->IoDone = IoDone;
+ mSmbusContext->SmbusIoRead = SmbusIoRead;
+ mSmbusContext->SmbusIoWrite = SmbusIoWrite;
+ mSmbusContext->SmbusController.Execute = SmbusExecute;
+ mSmbusContext->SmbusController.ArpDevice = SmbusArpDevice;
+ mSmbusContext->SmbusController.GetArpMap = SmbusGetArpMap;
+ mSmbusContext->SmbusController.Notify = SmbusNotify;
+ mSmbusContext->PlatformNumRsvd = PchPlatformPolicy->SmbusConfig->NumRsvdSmbusAddresses;
+ mSmbusContext->PlatformRsvdAddr = PchPlatformPolicy->SmbusConfig->RsvdSmbusAddressTable;
+
+ ///
+ /// See if PEI already ARPed any devices, and if so, update our device map.
+ ///
+ /// Get Hob list
+ ///
+ Status = EfiGetSystemConfigurationTable (&gEfiHobListGuid, (VOID **) &HobList.Raw);
+ ASSERT_EFI_ERROR (Status);
+
+ HobList.Raw = GetNextGuidHob (&mEfiSmbusArpMapGuid, HobList.Raw);
+ ///
+ /// If we found the right hob, store the information. Otherwise, continue.
+ ///
+ if (HobList.Raw != NULL) {
+ Data = (VOID *) ((UINT8 *) (&HobList.Guid->Name) + sizeof (EFI_GUID));
+ DataSize = HobList.Header->HobLength - sizeof (EFI_HOB_GUID_TYPE);
+ CopyMem (mSmbusContext->DeviceMap, Data, DataSize);
+ mSmbusContext->DeviceMapEntries = (UINT8) (DataSize / sizeof (EFI_SMBUS_DEVICE_MAP));
+ }
+ ///
+ /// Initialize the NotifyFunctionList
+ ///
+ InitializeListHead (&mSmbusContext->NotifyFunctionList);
+
+ ///
+ /// Install the SMBUS interface
+ ///
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &mSmbusContext->Handle,
+ &gEfiSmbusProtocolGuid,
+ &mSmbusContext->SmbusController,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ DEBUG ((EFI_D_INFO, "InitializePchSmbus() End\n"));
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbus.dxs b/ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbus.dxs
new file mode 100644
index 0000000..30bfdc5
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbus.dxs
@@ -0,0 +1,44 @@
+/** @file
+ Dependency expression file for PCH SMBUS PEIM.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "PeimDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+#include "Common/EdkIIGlueDefinitionChangesPeim.h"
+
+#include EFI_PPI_DEFINITION (SmbusPolicy)
+#endif
+
+DEPENDENCY_START
+ PEI_SMBUS_POLICY_PPI_GUID
+DEPENDENCY_END
+
+
diff --git a/ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbus.h b/ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbus.h
new file mode 100644
index 0000000..fe64e8a
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbus.h
@@ -0,0 +1,409 @@
+/** @file
+ PCH Smbus PPI
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#ifndef _PEI_PCH_SMBUS_H_
+#define _PEI_PCH_SMBUS_H_
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+
+#include "EdkIIGluePeim.h"
+
+//
+// Driver Produced PPI Prototypes
+//
+#include EFI_PPI_PRODUCER (Smbus)
+//
+// Driver Consumed PPI Prototypes
+//
+#include EFI_PPI_CONSUMER (EndOfPeiSignal)
+#include EFI_PPI_CONSUMER (SmbusPolicy)
+#include EFI_PPI_CONSUMER (MemoryDiscovered)
+#include EFI_GUID_DEFINITION (SmbusArpMap)
+#include "PchSmbusCommon.h"
+#endif
+///
+/// Max number of SMBus devices
+/// (7 bit address yields 128 combinations but 21 of those are reserved)
+/// Due to limited resources, we only allow 8 in PEI.
+///
+#define MAX_SMBUS_DEVICES 8
+
+#define MAX_SMBUS_NOTIFICATION 8
+
+///
+/// Private Data Structures
+///
+typedef struct _PEI_SMBUS_NOTIFY_FUNCTION_LIST_NODE {
+ EFI_SMBUS_DEVICE_ADDRESS SlaveAddress;
+ UINTN Data;
+ EFI_PEI_SMBUS_NOTIFY_FUNCTION NotifyFunction;
+} PEI_SMBUS_NOTIFY_FUNCTION_LIST_NODE;
+
+///
+/// Declare a local instance structure for this PEIM
+///
+typedef struct _SMBUS_INSTANCE {
+ UINTN Signature;
+ EFI_PEI_SERVICES **PeiServices;
+ PEI_SMBUS_POLICY_PPI *SmbusPolicy;
+ UINTN SmbusIoBase;
+ EFI_PEI_PPI_DESCRIPTOR PpiDescriptor;
+ EFI_PEI_SMBUS_PPI SmbusPpi;
+ EFI_PEI_NOTIFY_DESCRIPTOR NotifyDescriptor;
+ UINT8 DeviceMapEntries;
+ EFI_SMBUS_DEVICE_MAP DeviceMap[MAX_SMBUS_DEVICES];
+ UINT8 PlatformNumRsvd;
+ UINT8 *PlatformRsvdAddr;
+
+ UINT8 NotifyFunctionNum;
+ PEI_SMBUS_NOTIFY_FUNCTION_LIST_NODE NotifyFunctionList[MAX_SMBUS_NOTIFICATION];
+} SMBUS_INSTANCE;
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#define SMBUS_PRIVATE_DATA_FROM_PPI_THIS(a) PEI_CR (a, SMBUS_INSTANCE, SmbusPpi, PCH_SMBUS_PRIVATE_DATA_SIGNATURE)
+
+#define SMBUS_PRIVATE_DATA_FROM_DESCRIPTOR_THIS(a) \
+ PEI_CR ( \
+ a, \
+ SMBUS_INSTANCE, \
+ PpiDescriptor, \
+ PCH_SMBUS_PRIVATE_DATA_SIGNATURE \
+ )
+
+#define SMBUS_PRIVATE_DATA_FROM_NOTIFY_THIS(a) \
+ PEI_CR ( \
+ a, \
+ SMBUS_INSTANCE, \
+ NotifyDescriptor, \
+ PCH_SMBUS_PRIVATE_DATA_SIGNATURE \
+ )
+
+#else
+
+#define SMBUS_PRIVATE_DATA_FROM_PPI_THIS(a) CR (a, SMBUS_INSTANCE, SmbusPpi, PCH_SMBUS_PRIVATE_DATA_SIGNATURE)
+
+#define SMBUS_PRIVATE_DATA_FROM_DESCRIPTOR_THIS(a) \
+ CR ( \
+ a, \
+ SMBUS_INSTANCE, \
+ PpiDescriptor, \
+ PCH_SMBUS_PRIVATE_DATA_SIGNATURE \
+ )
+
+#define SMBUS_PRIVATE_DATA_FROM_NOTIFY_THIS(a) \
+ CR ( \
+ a, \
+ SMBUS_INSTANCE, \
+ NotifyDescriptor, \
+ PCH_SMBUS_PRIVATE_DATA_SIGNATURE \
+ )
+
+#endif
+//
+// Prototypes
+//
+
+/**
+ This function provides a standard way to execute an SMBUS command
+ PPI as defined in the SMBus Specification. The data can either be of
+ the length byte, word, or a block of data (1 to 32 bytes long).
+ The resulting transaction will be either the SMBus Slave Device accepts
+ this transaction or this function returns with an error
+
+ @param[in] PeiServices PEI services table pointer
+ @param[in] This PEI_SMBUS_PPI instance
+ @param[in] SlaveAddress Smbus Slave device address
+ @param[in] Command Command to be sent
+ @param[in] Operation Which SMBus PPI will be used
+ @param[in] PecCheck Defines if Packet Error Code Checking is to be used
+ @param[in, out] Length How many bytes to read/write. Must be 1 <= Length <= 32 depending on the Operation
+ @param[in, out] Buffer Data buffer
+
+ @retval EFI_SUCCESS Operation success.
+ Length will contain the actual number of bytes read.
+ Buffer will contain the data read.
+ @retval Otherwise Operation failed.
+**/
+EFI_STATUS
+EFIAPI
+SmbusExecute (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_SMBUS_PPI *This,
+ IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
+ IN EFI_SMBUS_DEVICE_COMMAND Command,
+ IN EFI_SMBUS_OPERATION Operation,
+ IN BOOLEAN PecCheck,
+ IN OUT UINTN *Length,
+ IN OUT VOID *Buffer
+ );
+
+/**
+ Initialize the Smbus PPI and program the Smbus BAR
+
+ @param[in] FfsHeader Not used.
+ @param[in] PeiServices General purpose services available to every PEIM.
+
+ @retval EFI_SUCCESS The function completes successfully
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to create database
+**/
+EFI_STATUS
+InitializePchSmbusPeim (
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+ );
+
+/**
+ Fix up pointers since they are located in real memory now.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] NotifyDescriptor The notification structure this PEIM registered on install.
+ @param[in] Ppi The memory discovered PPI. Not used.
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+MemoryDiscoveredPpiNotifyCallback (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
+ IN VOID *Ppi
+ );
+
+/**
+ Set Slave address for an Smbus device with a known UDID or perform a general
+ ARP of all devices.
+
+ @param[in] PeiServices Pointer to the PEI Services table.
+ @param[in] This Pointer to the instance of the PEI_SMBUS_PPI.
+ @param[in] ArpAll If TRUE, do a full ARP. Otherwise, just ARP the specified UDID.
+ @param[in] SmbusUdid When doing a directed ARP, ARP the device with this UDID.
+ @param[in, out] SlaveAddress Buffer to store new Slave Address during directed ARP.
+
+ @exception EFI_UNSUPPORTED This functionality is not supported
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+SmbusArpDevice (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_SMBUS_PPI * This,
+ IN BOOLEAN ArpAll,
+ IN EFI_SMBUS_UDID * SmbusUdid, OPTIONAL
+ IN OUT EFI_SMBUS_DEVICE_ADDRESS * SlaveAddress OPTIONAL
+ );
+
+/**
+ Get a pointer to the assigned mappings of UDID's to Slave Addresses.
+
+ @param[in] PeiServices Pointer to the PEI Services table.
+ @param[in] This Pointer to the instance of the PEI_SMBUS_PPI.
+ @param[in, out] Length Buffer to contain the lenght of the Device Map.
+ @param[in, out] SmbusDeviceMap Buffer to contian a pointer to the Device Map.
+
+ @exception EFI_UNSUPPORTED This functionality is not supported
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+SmbusGetArpMap (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_SMBUS_PPI *This,
+ IN OUT UINTN *Length,
+ IN OUT EFI_SMBUS_DEVICE_MAP **SmbusDeviceMap
+ );
+
+/**
+ Register a callback in the event of a Host Notify command being sent by a
+ specified Slave Device.
+
+ @param[in] PeiServices The general PEI Services
+ @param[in] This The PPI instance
+ @param[in] SlaveAddress Address of the device whose Host Notify command we want to trap.
+ @param[in] Data Data of the Host Notify command we want to trap.
+ @param[in] NotifyFunction Function to be called in the event the desired Host Notify command occurs.
+
+ @exception EFI_UNSUPPORTED This functionality is not supported
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+SmbusNotify (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_SMBUS_PPI *This,
+ IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
+ IN UINTN Data,
+ IN EFI_PEI_SMBUS_NOTIFY_FUNCTION NotifyFunction
+ );
+
+/**
+ This function initializes the SmBus driver in PEI.
+
+ @param[in] PeiServices Standard PEI services
+ @param[in] Private SMBUS private data structure
+
+ @retval None.
+**/
+VOID
+InitializePeiPrivate (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN SMBUS_INSTANCE *Private
+ );
+
+/**
+ Issue a prepare ARP command to informs all devices that the ARP Master is starting the ARP process
+
+ @param[in] Private Pointer to the SMBUS_INSTANCE
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+SmbusPrepareToArp (
+ IN SMBUS_INSTANCE *Private
+ );
+
+/**
+ Issue a Get UDID (general) command to requests ARP-capable and/or Discoverable devices to
+ return their slave address along with their UDID.
+
+ @param[in] Private Pointer to the SMBUS_INSTANCE
+ @param[in, out] DeviceMap Pointer to SMBUS device map table that slave device return
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+SmbusGetUdidGeneral (
+ IN SMBUS_INSTANCE *Private,
+ IN OUT EFI_SMBUS_DEVICE_MAP *DeviceMap
+ );
+
+/**
+ Issue a Assign address command to assigns an address to a specific slave device.
+
+ @param[in] Private Pointer to the SMBUS_INSTANCE
+ @param[in, out] DeviceMap Pointer to SMBUS device map table that send to slave device
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+SmbusAssignAddress (
+ IN SMBUS_INSTANCE *Private,
+ IN OUT EFI_SMBUS_DEVICE_MAP *DeviceMap
+ );
+
+/**
+ Do a fully (general) Arp procress to assign the slave address of all ARP-capable device.
+ This function will issue issue the "Prepare to ARP", "Get UDID" and "Assign Address" commands.
+
+ @param[in] Private Pointer to the SMBUS_INSTANCE
+
+ @retval EFI_OUT_OF_RESOURCES No available address to assign
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+SmbusFullArp (
+ IN SMBUS_INSTANCE *Private
+ );
+
+/**
+ Do a directed Arp procress to assign the slave address of a single ARP-capable device.
+
+ @param[in] Private Pointer to the SMBUS_INSTANCE
+ @param[in] SmbusUdid When doing a directed ARP, ARP the device with this UDID.
+ @param[in, out] SlaveAddress Buffer to store new Slave Address during directed ARP.
+
+ @retval EFI_OUT_OF_RESOURCES DeviceMapEntries is more than Max number of SMBus devices.
+ Or there is no available address to assign
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+SmbusDirectedArp (
+ IN SMBUS_INSTANCE *Private,
+ IN EFI_SMBUS_UDID *SmbusUdid,
+ IN OUT EFI_SMBUS_DEVICE_ADDRESS *SlaveAddress
+ );
+
+/**
+ Find an available address to assign
+
+ @param[in] Private Pointer to the SMBUS_INSTANCE
+ @param[in, out] SlaveAddress Buffer to store new Slave Address during directed ARP.
+
+ @retval EFI_OUT_OF_RESOURCES There is no available address to assign
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+GetNextAvailableAddress (
+ IN SMBUS_INSTANCE *Private,
+ IN OUT EFI_SMBUS_DEVICE_ADDRESS *SlaveAddress
+ );
+
+/**
+ Check whether the address is assignable.
+
+ @param[in] Private Pointer to the SMBUS_INSTANCE
+ @param[in] SlaveAddress The Slave Address for checking
+
+ @retval TRUE The address is assignable
+ @retval FALSE The address is not assignable
+**/
+BOOLEAN
+IsAddressAvailable (
+ IN SMBUS_INSTANCE *Private,
+ IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress
+ );
+
+/**
+ This function gets called back at the end of PEI if any devices were ARPed
+ during PEI. It will build a HOB to describe to DXE what devices were ARPed.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] NotifyDescriptor The notification structure this PEIM registered on install.
+ @param[in] Ppi The EndOfPeiSignal PPI.
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EndOfPeiCallback (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
+ IN VOID *Ppi
+ );
+
+/**
+ Function to be called when SMBus.Execute happens. This will check if
+ the SMBus Host Controller has received a Host Notify command. If so, it will
+ see if a notification has been reqested on that event and make any callbacks
+ that may be necessary.
+
+ @param[in] Private Pointer to the SMBUS_INSTANCE
+
+ @retval None
+**/
+VOID
+CheckNotification (
+ IN SMBUS_INSTANCE *Private
+ );
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArp.c b/ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArp.c
new file mode 100644
index 0000000..9ba5647
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArp.c
@@ -0,0 +1,444 @@
+/** @file
+ PCH Smbus PEIM. This file is used when we want ARP support.
+
+@copyright
+ Copyright (c) 2009 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "PchSmbus.h"
+
+///
+/// These addresses are reserved by the SMBus 2.0 specification
+///
+static UINT8 mReservedAddress[SMBUS_NUM_RESERVED] = {
+ 0x00,
+ 0x02,
+ 0x04,
+ 0x06,
+ 0x08,
+ 0x0A,
+ 0x0C,
+ 0x0E,
+ 0x10,
+ 0x18,
+ 0x50,
+ 0x6E,
+ 0xC2,
+ 0xF0,
+ 0xF2,
+ 0xF4,
+ 0xF6,
+ 0xF8,
+ 0xFA,
+ 0xFC,
+ 0xFE,
+ 0x12,
+ 0x14,
+ 0x16,
+ 0x58,
+ 0x5A,
+ 0x80,
+ 0x82,
+ 0x84,
+ 0x86,
+ 0x88,
+ 0x90,
+ 0x92,
+ 0x94,
+ 0x96,
+ 0x1A,
+ 0x1C,
+ 0x1E
+};
+
+/**
+ Issue a prepare ARP command to informs all devices that the ARP Master is starting the ARP process
+
+ @param[in] Private Pointer to the SMBUS_INSTANCE
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+SmbusPrepareToArp (
+ IN SMBUS_INSTANCE *Private
+ )
+{
+ EFI_SMBUS_DEVICE_ADDRESS SlaveAddress;
+ EFI_STATUS Status;
+ UINTN Length;
+ UINT8 Buffer;
+
+ DEBUG ((EFI_D_INFO, "PEI SmbusPrepareToArp() Start\n"));
+
+ SlaveAddress.SmbusDeviceAddress = SMBUS_ADDRESS_ARP;
+ Length = 1;
+ Buffer = SMBUS_DATA_PREPARE_TO_ARP;
+
+ Status = SmbusExec (
+ SlaveAddress,
+ 0,
+ EfiSmbusSendByte,
+ TRUE,
+ &Length,
+ &Buffer
+ );
+
+ DEBUG ((EFI_D_INFO, "PEI SmbusPrepareToArp() End\n"));
+
+ return Status;
+}
+
+/**
+ Issue a Get UDID (general) command to requests ARP-capable and/or Discoverable devices to
+ return their slave address along with their UDID.
+
+ @param[in] Private Pointer to the SMBUS_INSTANCE
+ @param[in, out] DeviceMap Pointer to SMBUS device map table that slave device return
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+SmbusGetUdidGeneral (
+ IN SMBUS_INSTANCE *Private,
+ IN OUT EFI_SMBUS_DEVICE_MAP *DeviceMap
+ )
+{
+ EFI_SMBUS_DEVICE_ADDRESS SlaveAddress;
+ EFI_STATUS Status;
+ UINTN Length;
+ UINT8 Buffer[SMBUS_GET_UDID_LENGTH];
+
+ SlaveAddress.SmbusDeviceAddress = SMBUS_ADDRESS_ARP;
+ Length = SMBUS_GET_UDID_LENGTH;
+
+ DEBUG ((EFI_D_INFO, "PEI SmbusGetUdidGeneral() Start\n"));
+
+ Status = SmbusExec (
+ SlaveAddress,
+ SMBUS_DATA_GET_UDID_GENERAL,
+ EfiSmbusReadBlock,
+ TRUE,
+ &Length,
+ Buffer
+ );
+
+ if (!EFI_ERROR (Status)) {
+ if (Length == SMBUS_GET_UDID_LENGTH) {
+ DeviceMap->SmbusDeviceUdid.DeviceCapabilities = Buffer[0];
+ DeviceMap->SmbusDeviceUdid.VendorRevision = Buffer[1];
+ DeviceMap->SmbusDeviceUdid.VendorId = (UINT16) ((Buffer[2] << 8) + Buffer[3]);
+ DeviceMap->SmbusDeviceUdid.DeviceId = (UINT16) ((Buffer[4] << 8) + Buffer[5]);
+ DeviceMap->SmbusDeviceUdid.Interface = (UINT16) ((Buffer[6] << 8) + Buffer[7]);
+ DeviceMap->SmbusDeviceUdid.SubsystemVendorId = (UINT16) ((Buffer[8] << 8) + Buffer[9]);
+ DeviceMap->SmbusDeviceUdid.SubsystemDeviceId = (UINT16) ((Buffer[10] << 8) + Buffer[11]);
+ DeviceMap->SmbusDeviceUdid.VendorSpecificId = (UINT32) ((Buffer[12] << 24) + (Buffer[13] << 16) + (Buffer[14] << 8) + Buffer[15]);
+ DeviceMap->SmbusDeviceAddress.SmbusDeviceAddress = (UINT8) (Buffer[16] >> 1);
+ } else {
+ Status = EFI_DEVICE_ERROR;
+ }
+ }
+
+ DEBUG ((EFI_D_INFO, "PEI SmbusGetUdidGeneral() End\n"));
+
+ return Status;
+}
+
+/**
+ Issue a Assign address command to assigns an address to a specific slave device.
+
+ @param[in] Private Pointer to the SMBUS_INSTANCE
+ @param[in, out] DeviceMap Pointer to SMBUS device map table that send to slave device
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+SmbusAssignAddress (
+ IN SMBUS_INSTANCE *Private,
+ IN OUT EFI_SMBUS_DEVICE_MAP *DeviceMap
+ )
+{
+ EFI_SMBUS_DEVICE_ADDRESS SlaveAddress;
+ EFI_STATUS Status;
+ UINTN Length;
+ UINT8 Buffer[SMBUS_GET_UDID_LENGTH];
+
+ DEBUG ((EFI_D_INFO, "PEI SmbusAssignAddress() Start\n"));
+
+ Buffer[0] = DeviceMap->SmbusDeviceUdid.DeviceCapabilities;
+ Buffer[1] = DeviceMap->SmbusDeviceUdid.VendorRevision;
+ Buffer[2] = (UINT8) (DeviceMap->SmbusDeviceUdid.VendorId >> 8);
+ Buffer[3] = (UINT8) (DeviceMap->SmbusDeviceUdid.VendorId);
+ Buffer[4] = (UINT8) (DeviceMap->SmbusDeviceUdid.DeviceId >> 8);
+ Buffer[5] = (UINT8) (DeviceMap->SmbusDeviceUdid.DeviceId);
+ Buffer[6] = (UINT8) (DeviceMap->SmbusDeviceUdid.Interface >> 8);
+ Buffer[7] = (UINT8) (DeviceMap->SmbusDeviceUdid.Interface);
+ Buffer[8] = (UINT8) (DeviceMap->SmbusDeviceUdid.SubsystemVendorId >> 8);
+ Buffer[9] = (UINT8) (DeviceMap->SmbusDeviceUdid.SubsystemVendorId);
+ Buffer[10] = (UINT8) (DeviceMap->SmbusDeviceUdid.SubsystemDeviceId >> 8);
+ Buffer[11] = (UINT8) (DeviceMap->SmbusDeviceUdid.SubsystemDeviceId);
+ Buffer[12] = (UINT8) (DeviceMap->SmbusDeviceUdid.VendorSpecificId >> 24);
+ Buffer[13] = (UINT8) (DeviceMap->SmbusDeviceUdid.VendorSpecificId >> 16);
+ Buffer[14] = (UINT8) (DeviceMap->SmbusDeviceUdid.VendorSpecificId >> 8);
+ Buffer[15] = (UINT8) (DeviceMap->SmbusDeviceUdid.VendorSpecificId);
+ Buffer[16] = (UINT8) (DeviceMap->SmbusDeviceAddress.SmbusDeviceAddress << 1);
+
+ SlaveAddress.SmbusDeviceAddress = SMBUS_ADDRESS_ARP;
+ Length = SMBUS_GET_UDID_LENGTH;
+
+ Status = SmbusExec (
+ SlaveAddress,
+ SMBUS_DATA_ASSIGN_ADDRESS,
+ EfiSmbusWriteBlock,
+ TRUE,
+ &Length,
+ Buffer
+ );
+
+ DEBUG ((EFI_D_INFO, "PEI SmbusAssignAddress() End\n"));
+
+ return Status;
+}
+
+/**
+ Do a fully (general) Arp procress to assign the slave address of all ARP-capable device.
+ This function will issue issue the "Prepare to ARP", "Get UDID" and "Assign Address" commands.
+
+ @param[in] Private Pointer to the SMBUS_INSTANCE
+
+ @retval EFI_OUT_OF_RESOURCES No available address to assign
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+SmbusFullArp (
+ IN SMBUS_INSTANCE *Private
+ )
+{
+ EFI_STATUS Status;
+ EFI_SMBUS_DEVICE_MAP *CurrentDeviceMap;
+
+ DEBUG ((EFI_D_INFO, "PEI SmbusFullArp() Start\n"));
+
+ Status = SmbusPrepareToArp (Private);
+ if (EFI_ERROR (Status)) {
+ if (Status == EFI_DEVICE_ERROR) {
+ ///
+ /// ARP is complete
+ ///
+ return EFI_SUCCESS;
+ } else {
+ return Status;
+ }
+ }
+ ///
+ /// Main loop to ARP all ARP-capable devices
+ ///
+ do {
+ CurrentDeviceMap = &Private->DeviceMap[Private->DeviceMapEntries];
+ Status = SmbusGetUdidGeneral (Private, CurrentDeviceMap);
+ if (EFI_ERROR (Status)) {
+ break;
+ }
+
+ if (CurrentDeviceMap->SmbusDeviceAddress.SmbusDeviceAddress == (0xFF >> 1)) {
+ ///
+ /// If address is unassigned, assign it
+ ///
+ Status = GetNextAvailableAddress (
+ Private,
+ &CurrentDeviceMap->SmbusDeviceAddress
+ );
+ if (EFI_ERROR (Status)) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ } else if (((CurrentDeviceMap->SmbusDeviceUdid.DeviceCapabilities) & 0xC0) != 0) {
+ ///
+ /// if address is not fixed, check if the current address is available
+ ///
+ if (!IsAddressAvailable (
+ Private,
+ CurrentDeviceMap->SmbusDeviceAddress
+ )) {
+ ///
+ /// if currently assigned address is already used, get a new one
+ ///
+ Status = GetNextAvailableAddress (
+ Private,
+ &CurrentDeviceMap->SmbusDeviceAddress
+ );
+ if (EFI_ERROR (Status)) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ }
+ }
+
+ Status = SmbusAssignAddress (Private, CurrentDeviceMap);
+ if (EFI_ERROR (Status)) {
+ ///
+ /// If there was a device error, just continue on and try again.
+ /// Other errors should be reported.
+ ///
+ if (Status != EFI_DEVICE_ERROR) {
+ return Status;
+ }
+ } else {
+ ///
+ /// If there was no error, the address was assigned and we must update our
+ /// records.
+ ///
+ Private->DeviceMapEntries++;
+ }
+
+ } while (Private->DeviceMapEntries < MAX_SMBUS_DEVICES);
+
+ DEBUG ((EFI_D_INFO, "PEI SmbusFullArp() End\n"));
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Do a directed Arp procress to assign the slave address of a single ARP-capable device.
+
+ @param[in] Private Pointer to the SMBUS_INSTANCE
+ @param[in] SmbusUdid When doing a directed ARP, ARP the device with this UDID.
+ @param[in, out] SlaveAddress Buffer to store new Slave Address during directed ARP.
+
+ @retval EFI_OUT_OF_RESOURCES DeviceMapEntries is more than Max number of SMBus devices.
+ Or there is no available address to assign
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+SmbusDirectedArp (
+ IN SMBUS_INSTANCE *Private,
+ IN EFI_SMBUS_UDID *SmbusUdid,
+ IN OUT EFI_SMBUS_DEVICE_ADDRESS *SlaveAddress
+ )
+{
+ EFI_STATUS Status;
+ EFI_SMBUS_DEVICE_MAP *CurrentDeviceMap;
+
+ DEBUG ((EFI_D_INFO, "PEI SmbusDirectedArp() Start\n"));
+
+ if (Private->DeviceMapEntries >= MAX_SMBUS_DEVICES) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ CurrentDeviceMap = &Private->DeviceMap[Private->DeviceMapEntries];
+
+ ///
+ /// Find an available address to assign
+ ///
+ Status = GetNextAvailableAddress (
+ Private,
+ &CurrentDeviceMap->SmbusDeviceAddress
+ );
+ if (EFI_ERROR (Status)) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ CurrentDeviceMap->SmbusDeviceUdid.DeviceCapabilities = SmbusUdid->DeviceCapabilities;
+ CurrentDeviceMap->SmbusDeviceUdid.DeviceId = SmbusUdid->DeviceId;
+ CurrentDeviceMap->SmbusDeviceUdid.Interface = SmbusUdid->Interface;
+ CurrentDeviceMap->SmbusDeviceUdid.SubsystemDeviceId = SmbusUdid->SubsystemDeviceId;
+ CurrentDeviceMap->SmbusDeviceUdid.SubsystemVendorId = SmbusUdid->SubsystemVendorId;
+ CurrentDeviceMap->SmbusDeviceUdid.VendorId = SmbusUdid->VendorId;
+ CurrentDeviceMap->SmbusDeviceUdid.VendorRevision = SmbusUdid->VendorRevision;
+ CurrentDeviceMap->SmbusDeviceUdid.VendorSpecificId = SmbusUdid->VendorSpecificId;
+
+ Status = SmbusAssignAddress (Private, CurrentDeviceMap);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Private->DeviceMapEntries++;
+ SlaveAddress->SmbusDeviceAddress = CurrentDeviceMap->SmbusDeviceAddress.SmbusDeviceAddress;
+
+ DEBUG ((EFI_D_INFO, "PEI SmbusDirectedArp() End\n"));
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Find an available address to assign
+
+ @param[in] Private Pointer to the SMBUS_INSTANCE
+ @param[in] SlaveAddress Buffer to store new Slave Address during directed ARP.
+
+ @retval EFI_OUT_OF_RESOURCES There is no available address to assign
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+GetNextAvailableAddress (
+ IN SMBUS_INSTANCE *Private,
+ IN EFI_SMBUS_DEVICE_ADDRESS *SlaveAddress
+ )
+{
+ for (SlaveAddress->SmbusDeviceAddress = 0x03;
+ SlaveAddress->SmbusDeviceAddress < 0x7F;
+ SlaveAddress->SmbusDeviceAddress++
+ ) {
+ if (IsAddressAvailable (Private, *SlaveAddress)) {
+ return EFI_SUCCESS;
+ }
+ }
+
+ return EFI_OUT_OF_RESOURCES;
+}
+
+/**
+ Check whether the address is assignable.
+
+ @param[in] Private Pointer to the SMBUS_INSTANCE
+ @param[in] SlaveAddress The Slave Address for checking
+
+ @retval TRUE The address is assignable
+ @retval FALSE The address is not assignable
+**/
+BOOLEAN
+IsAddressAvailable (
+ IN SMBUS_INSTANCE *Private,
+ IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress
+ )
+{
+ UINT8 Index;
+
+ ///
+ /// See if we have already assigned this address to a device
+ ///
+ for (Index = 0; Index < Private->DeviceMapEntries; Index++) {
+ if (SlaveAddress.SmbusDeviceAddress == Private->DeviceMap[Index].SmbusDeviceAddress.SmbusDeviceAddress) {
+ return FALSE;
+ }
+ }
+ ///
+ /// See if this address is claimed by a platform non-ARP-capable device
+ ///
+ for (Index = 0; Index < Private->PlatformNumRsvd; Index++) {
+ if ((SlaveAddress.SmbusDeviceAddress << 1) == Private->PlatformRsvdAddr[Index]) {
+ return FALSE;
+ }
+ }
+ ///
+ /// See if this is a reserved address
+ ///
+ for (Index = 0; Index < SMBUS_NUM_RESERVED; Index++) {
+ if ((SlaveAddress.SmbusDeviceAddress << 1) == (UINTN) mReservedAddress[Index]) {
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArpDisabled.cif b/ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArpDisabled.cif
new file mode 100644
index 0000000..6682817
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArpDisabled.cif
@@ -0,0 +1,14 @@
+<component>
+ name = "PchSmbusArpDisabled"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\Smbus\Pei"
+ RefName = "PchSmbusArpDisabled"
+[files]
+"PchSmbusArpDisabled.sdl"
+"PchSmbusArpDisabled.mak"
+"PchSmbusEntry.c"
+"PchSmbus.h"
+"PchSmbusArpdisabled.c"
+"PchSmbus.dxs"
+"PchSmbusArpDisabled.inf"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArpDisabled.inf b/ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArpDisabled.inf
new file mode 100644
index 0000000..a66047e
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArpDisabled.inf
@@ -0,0 +1,88 @@
+## @file
+# Component description file for PchSmbus module
+# This version will NOT include ARP support.
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = PchSmbusArpDisabled
+FILE_GUID = 643DF777-F312-42ed-81CC-1B1F57E18AD6
+COMPONENT_TYPE = PE32_PEIM
+
+[sources.common]
+ PchSmbus.h
+ PchSmbusEntry.c
+ PchSmbusArpDisabled.c
+ ../Common/PchSmbusExec.c
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGluePeimEntryPoint.c
+
+[includes.common]
+ .
+ ../Common
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Pei/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/SampleCode
+
+[libraries.common]
+ EdkFrameworkPpiLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGluePeiDebugLibReportStatusCode
+ EdkIIGluePeiReportStatusCodeLib
+ EdkIIGluePeiServicesLib
+ EdkIIGluePeiMemoryAllocationLib
+ EdkIIGlueBasePciLibPciExpress
+ PchPlatformLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT=_ModuleEntryPoint
+ DPX_SOURCE=PchSmbus.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=InitializePchSmbusPeim
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_PEI_SERVICES_LIB__ \
+ -D __EDKII_GLUE_PEI_MEMORY_ALLOCATION_LIB__ \
+ -D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__
diff --git a/ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArpDisabled.mak b/ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArpDisabled.mak
new file mode 100644
index 0000000..531b08e
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArpDisabled.mak
@@ -0,0 +1,97 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSmbusArpDisabled/PchSmbusArpDisabled.mak 2 2/24/12 2:23a Victortu $
+#
+# $Revision: 2 $
+#
+# $Date: 2/24/12 2:23a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSmbusArpDisabled/PchSmbusArpDisabled.mak $
+#
+# 2 2/24/12 2:23a Victortu
+# Updated to support 4.6.5.3_IntelEDK_1117_Patch7_00.
+#
+# 1 2/08/12 9:20a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+
+#---------------------------------------------------------------------------
+# Create PchSmbusArpDisabled Driver
+#---------------------------------------------------------------------------
+EDK : PchSmbusArpDisabled
+PchSmbusArpDisabled : $(BUILD_DIR)\PchSmbusArpDisabled.mak PchSmbusArpDisabledBin
+
+
+$(BUILD_DIR)\PchSmbusArpDisabled.mak : $(PchSmbusArpDisabled_DIR)\$(@B).cif $(PchSmbusArpDisabled_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(PchSmbusArpDisabled_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+PchSmbusArpDisabled_INCLUDES=\
+ $(INTEL_PCH_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+
+PchSmbusArpDisabled_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=InitializePchSmbusPeim"\
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_PEI_SERVICES_LIB__ \
+ /D __EDKII_GLUE_PEI_MEMORY_ALLOCATION_LIB__ \
+ /D __EDKII_GLUE_BASE_PCI_CF8_LIB__ \
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__
+
+PchSmbusArpDisabled_LIB_LINKS =\
+ $(EDKFRAMEWORKPPILIB)\
+ $(PchPlatformPeiLib_LIB)\
+ $(PchSmbusCommonPeiLib_LIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EdkIIGlueBaseLibIA32_LIB)\
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGluePeiDebugLibReportStatusCode_LIB)\
+ $(EdkIIGluePeiReportStatusCodeLib_LIB)\
+ $(EdkIIGluePeiServicesLib_LIB)\
+ $(EdkIIGluePeiMemoryAllocationLib_LIB)\
+ $(EdkIIGlueBasePciLibCf8_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+
+PchSmbusArpDisabledBin: $(PchSmbusArpDisabled_LIB_LINKS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\PchSmbusArpDisabled.mak all\
+ NAME=PchSmbusArpDisabled\
+ MAKEFILE=$(BUILD_DIR)\PchSmbusArpDisabled.mak \
+ GUID=643DF777-F312-42ed-81CC-1B1F57E18AD6\
+ "MY_INCLUDES=$(PchSmbusArpDisabled_INCLUDES)"\
+ "MY_DEFINES=$(MY_DEFINES) $(PchSmbusArpDisabled_DEFINES)"\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=PEIM \
+ EDKIIModule=PEIM\
+ DEPEX1=$(PchSmbusArpDisabled_DIR)\PchSmbus.dxs DEPEX1_TYPE=EFI_SECTION_PEI_DEPEX \
+ COMPRESS=0
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArpDisabled.sdl b/ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArpDisabled.sdl
new file mode 100644
index 0000000..23e79a5
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArpDisabled.sdl
@@ -0,0 +1,67 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSmbusArpDisabled/PchSmbusArpDisabled.sdl 1 2/08/12 9:20a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 9:20a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSmbusArpDisabled/PchSmbusArpDisabled.sdl $
+#
+# 1 2/08/12 9:20a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+TOKEN
+ Name = "PchSmbusArpDisabled_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable PchSmbusArpDisabled support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "PchSmbusArpDisabled_DIR"
+ Help = "PchSmbusArpDisabled file source directory"
+End
+
+MODULE
+ Help = "Includes PchSmbusArpDisabled.mak to Project"
+ File = "PchSmbusArpDisabled.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PchSmbusArpDisabled.ffs"
+ Parent = "FV_BB"
+ InvokeOrder = AfterParent
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArpEnabled.c b/ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArpEnabled.c
new file mode 100644
index 0000000..91a8614
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArpEnabled.c
@@ -0,0 +1,291 @@
+/** @file
+ PCH Smbus PEIM. This file is used when we want ARP support.
+
+@copyright
+ Copyright (c) 2009 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "PchSmbus.h"
+
+static EFI_PEI_NOTIFY_DESCRIPTOR mNotifyList = {
+ (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+ &gEndOfPeiSignalPpiGuid,
+ EndOfPeiCallback
+};
+
+EFI_GUID mEfiSmbusArpMapGuid = EFI_SMBUS_ARP_MAP_GUID;
+
+/**
+ Set Slave address for an Smbus device with a known UDID or perform a general
+ ARP of all devices.
+
+ @param[in] PeiServices Pointer to the PEI Services table.
+ @param[in] This Pointer to the instance of the PEI_SMBUS_PPI.
+ @param[in] ArpAll If TRUE, do a full ARP. Otherwise, just ARP the specified UDID.
+ @param[in] SmbusUdid When doing a directed ARP, ARP the device with this UDID.
+ @param[in, out] SlaveAddress Buffer to store new Slave Address during directed ARP.
+
+ @exception EFI_UNSUPPORTED This functionality is not supported
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+SmbusArpDevice (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_SMBUS_PPI * This,
+ IN BOOLEAN ArpAll,
+ IN EFI_SMBUS_UDID * SmbusUdid OPTIONAL,
+ IN OUT EFI_SMBUS_DEVICE_ADDRESS * SlaveAddress OPTIONAL
+ )
+{
+ SMBUS_INSTANCE *Private;
+ EFI_STATUS Status;
+ UINT8 OldMapEntries;
+
+ DEBUG ((EFI_D_INFO, "PEI SmbusArpDevice() Start\n"));
+
+ Private = SMBUS_PRIVATE_DATA_FROM_PPI_THIS (This);
+
+ OldMapEntries = Private->DeviceMapEntries;
+
+ if (ArpAll) {
+ Status = SmbusFullArp (Private);
+ } else {
+ if ((SmbusUdid == NULL) || (SlaveAddress == NULL)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Status = SmbusDirectedArp (Private, SmbusUdid, SlaveAddress);
+ }
+
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ ///
+ /// If we just added the first entry in the device map, set up a callback so
+ /// we can pass the map to DXE via a HOB at the end of PEI.
+ ///
+ if ((OldMapEntries == 0) && (Private->DeviceMapEntries > 0)) {
+ Status = (**PeiServices).NotifyPpi (PeiServices, &mNotifyList);
+ ASSERT_EFI_ERROR (Status);
+ }
+
+ DEBUG ((EFI_D_INFO, "PEI SmbusArpDevice() End\n"));
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Get a pointer to the assigned mappings of UDID's to Slave Addresses.
+
+ @param[in] PeiServices Pointer to the PEI Services table.
+ @param[in] This Pointer to the instance of the PEI_SMBUS_PPI.
+ @param[in, out] Length Buffer to contain the lenght of the Device Map.
+ @param[in, out] SmbusDeviceMap Buffer to contian a pointer to the Device Map.
+
+ @exception EFI_UNSUPPORTED This functionality is not supported
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+SmbusGetArpMap (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_SMBUS_PPI *This,
+ IN OUT UINTN *Length,
+ IN OUT EFI_SMBUS_DEVICE_MAP **SmbusDeviceMap
+ )
+{
+ SMBUS_INSTANCE *Private;
+
+ Private = SMBUS_PRIVATE_DATA_FROM_PPI_THIS (This);
+
+ *Length = Private->DeviceMapEntries * sizeof (EFI_SMBUS_DEVICE_MAP);
+ *SmbusDeviceMap = Private->DeviceMap;
+ return EFI_SUCCESS;
+}
+
+/**
+ Register a callback in the event of a Host Notify command being sent by a
+ specified Slave Device.
+
+ @param[in] PeiServices The general PEI Services
+ @param[in] This The PPI instance
+ @param[in] SlaveAddress Address of the device whose Host Notify command we want to trap.
+ @param[in] Data Data of the Host Notify command we want to trap.
+ @param[in] NotifyFunction Function to be called in the event the desired Host Notify command occurs.
+
+ @exception EFI_UNSUPPORTED This functionality is not supported
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+SmbusNotify (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_SMBUS_PPI *This,
+ IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
+ IN UINTN Data,
+ IN EFI_PEI_SMBUS_NOTIFY_FUNCTION NotifyFunction
+ )
+{
+ SMBUS_INSTANCE *Private;
+
+ DEBUG ((EFI_D_INFO, "PEI SmbusNotify() Start\n"));
+
+ Private = SMBUS_PRIVATE_DATA_FROM_PPI_THIS (This);
+
+ if (NotifyFunction == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+ ///
+ /// NOTE: Currently there is no periodic event in PEI.
+ /// So we just check the Notification at the end of in each
+ /// Smbus.Execute function.
+ ///
+ if (Private->NotifyFunctionNum >= MAX_SMBUS_NOTIFICATION) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Private->NotifyFunctionList[Private->NotifyFunctionNum].SlaveAddress.SmbusDeviceAddress = SlaveAddress.SmbusDeviceAddress;
+ Private->NotifyFunctionList[Private->NotifyFunctionNum].Data = Data;
+ Private->NotifyFunctionList[Private->NotifyFunctionNum].NotifyFunction = NotifyFunction;
+ Private->NotifyFunctionNum++;
+
+ ///
+ /// Last step, check notification
+ ///
+ CheckNotification (Private);
+
+ DEBUG ((EFI_D_INFO, "PEI SmbusNotify() End\n"));
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This function gets called back at the end of PEI if any devices were ARPed
+ during PEI. It will build a HOB to describe to DXE what devices were ARPed.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] NotifyDescriptor The notification structure this PEIM registered on install.
+ @param[in] Ppi The EndOfPeiSignal PPI.
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EndOfPeiCallback (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
+ IN VOID *Ppi
+ )
+{
+ EFI_STATUS Status;
+ EFI_PEI_PPI_DESCRIPTOR *SmbusDescriptor;
+ PEI_SMBUS_PPI *SmbusPpi;
+ SMBUS_INSTANCE *Private;
+ UINTN BufferSize;
+ VOID *Hob;
+
+ DEBUG ((EFI_D_INFO, "PEI EndOfPeiCallback() Start\n"));
+
+ Status = (**PeiServices).LocatePpi (
+ PeiServices,
+ &gPeiSmbusPpiGuid, /// GUID
+ 0, /// INSTANCE
+ &SmbusDescriptor, /// PEI_PPI_DESCRIPTOR
+ &SmbusPpi /// PPI
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ Private = SMBUS_PRIVATE_DATA_FROM_DESCRIPTOR_THIS (SmbusDescriptor);
+ BufferSize = sizeof (EFI_SMBUS_DEVICE_MAP) * Private->DeviceMapEntries;
+
+ Hob = BuildGuidDataHob (
+ &mEfiSmbusArpMapGuid,
+ Private->DeviceMap,
+ BufferSize
+ );
+ ASSERT (Hob != NULL);
+
+ DEBUG ((EFI_D_INFO, "PEI EndOfPeiCallback() End\n"));
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Function to be called when SMBus.Execute happens. This will check if
+ the SMBus Host Controller has received a Host Notify command. If so, it will
+ see if a notification has been reqested on that event and make any callbacks
+ that may be necessary.
+
+ @param[in] Private Pointer to the SMBUS_INSTANCE
+
+ @retval None
+**/
+VOID
+CheckNotification (
+ IN SMBUS_INSTANCE *Private
+ )
+{
+ EFI_SMBUS_DEVICE_ADDRESS SlaveAddress;
+ UINT8 SstsReg;
+ UINTN Data;
+ UINTN Index;
+
+ DEBUG ((EFI_D_INFO, "PEI CheckNotification() Start\n"));
+
+ if (Private->NotifyFunctionNum == 0) {
+ ///
+ /// Since no one register it, not need to check.
+ ///
+ return;
+ }
+
+ SstsReg = SmbusIoRead (R_PCH_SMBUS_SSTS);
+ if (!(SstsReg & B_PCH_SMBUS_HOST_NOTIFY_STS)) {
+ ///
+ /// Host Notify has not been received
+ ///
+ return;
+ }
+ ///
+ /// There was a Host Notify, see if any one wants to know about it
+ ///
+ SlaveAddress.SmbusDeviceAddress = (SmbusIoRead (R_PCH_SMBUS_NDA)) >> 1;
+
+ for (Index = 0; Index < Private->NotifyFunctionNum; Index++) {
+
+ if (Private->NotifyFunctionList[Index].SlaveAddress.SmbusDeviceAddress == SlaveAddress.SmbusDeviceAddress) {
+ Data = (SmbusIoRead (R_PCH_SMBUS_NDHB) << 8) + (SmbusIoRead (R_PCH_SMBUS_NDLB));
+ if ((UINT16) Private->NotifyFunctionList[Index].Data == (UINT16) Data) {
+ ///
+ /// We have a match, notify the requested function
+ ///
+ Private->NotifyFunctionList[Index].NotifyFunction (
+ Private->PeiServices,
+ &Private->SmbusPpi,
+ SlaveAddress,
+ Data
+ );
+ }
+ }
+ }
+ ///
+ /// Clear the Notify Status bit and exit.
+ ///
+ SmbusIoWrite (R_PCH_SMBUS_SSTS, B_PCH_SMBUS_HOST_NOTIFY_STS);
+
+ DEBUG ((EFI_D_INFO, "PEI CheckNotification() End\n"));
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArpEnabled.cif b/ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArpEnabled.cif
new file mode 100644
index 0000000..5674891
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArpEnabled.cif
@@ -0,0 +1,15 @@
+<component>
+ name = "PchSmbusArpEnabled"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\Smbus\Pei"
+ RefName = "PchSmbusArpEnabled"
+[files]
+"PchSmbusArpEnabled.sdl"
+"PchSmbusArpEnabled.mak"
+"PchSmbusEntry.c"
+"PchSmbus.h"
+"PchSmbusArpEnabled.c"
+"PchSmbusArp.c"
+"PchSmbus.dxs"
+"PchSmbusArpEnabled.inf"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArpEnabled.inf b/ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArpEnabled.inf
new file mode 100644
index 0000000..c4a23f1
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArpEnabled.inf
@@ -0,0 +1,91 @@
+## @file
+# Component description file for PchSmbus module
+# This version will include ARP support.
+#
+#@copyright
+# Copyright (c) 2009 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = PchSmbusArpEnabled
+FILE_GUID = 22B194B4-CC0E-46c7-9FCE-DA10D6ED1731
+COMPONENT_TYPE = PE32_PEIM
+
+[sources.common]
+ PchSmbus.h
+ PchSmbusEntry.c
+ PchSmbusArpEnabled.c
+ PchSmbusArp.c
+ ../Common/PchSmbusExec.c
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGluePeimEntryPoint.c
+
+[includes.common]
+ .
+ ../Common
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Pei/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/SampleCode
+
+[libraries.common]
+ EdkFrameworkPpiLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGluePeiDebugLibReportStatusCode
+ EdkIIGluePeiReportStatusCodeLib
+ EdkIIGluePeiServicesLib
+ EdkIIGluePeiMemoryAllocationLib
+ EdkIIGluePeiHobLib
+ EdkIIGlueBasePciLibPciExpress
+ PchPlatformLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT=_ModuleEntryPoint
+ DPX_SOURCE=PchSmbus.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=PeimInitializePchSmbus
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_PEI_SERVICES_LIB__ \
+ -D __EDKII_GLUE_PEI_MEMORY_ALLOCATION_LIB__ \
+ -D __EDKII_GLUE_PEI_HOB_LIB__ \
+ -D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__
diff --git a/ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArpEnabled.mak b/ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArpEnabled.mak
new file mode 100644
index 0000000..b1b2ce9
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArpEnabled.mak
@@ -0,0 +1,97 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSmbusArpEnabled/PchSmbusArpEnabled.mak 2 2/24/12 2:29a Victortu $
+#
+# $Revision: 2 $
+#
+# $Date: 2/24/12 2:29a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSmbusArpEnabled/PchSmbusArpEnabled.mak $
+#
+# 2 2/24/12 2:29a Victortu
+# Updated to support 4.6.5.3_IntelEDK_1117_Patch7_00.
+#
+# 1 2/08/12 9:28a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+
+#---------------------------------------------------------------------------
+# Create PchSmbusArpEnabled Driver
+#---------------------------------------------------------------------------
+EDK : PchSmbusArpEnabled
+PchSmbusArpEnabled : $(BUILD_DIR)\PchSmbusArpEnabled.mak PchSmbusArpEnabledBin
+
+
+$(BUILD_DIR)\PchSmbusArpEnabled.mak : $(PchSmbusArpEnabled_DIR)\$(@B).cif $(PchSmbusArpEnabled_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(PchSmbusArpEnabled_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+PchSmbusArpEnabled_INCLUDES=\
+ $(INTEL_PCH_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+
+PchSmbusArpEnabled_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=InitializePchSmbusPeim"\
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_PEI_SERVICES_LIB__ \
+ /D __EDKII_GLUE_PEI_MEMORY_ALLOCATION_LIB__ \
+ /D __EDKII_GLUE_PEI_HOB_LIB__ \
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__
+
+PchSmbusArpEnabled_LIB_LINKS =\
+ $(EDKFRAMEWORKPPILIB)\
+ $(PchPlatformPeiLib_LIB)\
+ $(PchSmbusCommonPeiLib_LIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EdkIIGlueBaseLibIA32_LIB)\
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGluePeiDebugLibReportStatusCode_LIB)\
+ $(EdkIIGluePeiReportStatusCodeLib_LIB)\
+ $(EdkIIGluePeiServicesLib_LIB)\
+ $(EdkIIGluePeiMemoryAllocationLib_LIB)\
+ $(EdkIIGluePeiHobLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+
+PchSmbusArpEnabledBin: $(PchSmbusArpEnabled_LIB_LINKS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\PchSmbusArpEnabled.mak all\
+ NAME=PchSmbusArpEnabled\
+ MAKEFILE=$(BUILD_DIR)\PchSmbusArpEnabled.mak \
+ GUID=22B194B4-CC0E-46c7-9FCE-DA10D6ED1731\
+ "MY_INCLUDES=$(PchSmbusArpEnabled_INCLUDES)"\
+ "MY_DEFINES=$(MY_DEFINES) $(PchSmbusArpEnabled_DEFINES)"\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=PEIM \
+ EDKIIModule=PEIM\
+ DEPEX1=$(PchSmbusArpEnabled_DIR)\PchSmbus.dxs DEPEX1_TYPE=EFI_SECTION_PEI_DEPEX \
+ COMPRESS=0
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArpEnabled.sdl b/ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArpEnabled.sdl
new file mode 100644
index 0000000..dcb1377
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArpEnabled.sdl
@@ -0,0 +1,67 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSmbusArpEnabled/PchSmbusArpEnabled.sdl 1 2/08/12 9:28a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 9:28a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSmbusArpEnabled/PchSmbusArpEnabled.sdl $
+#
+# 1 2/08/12 9:28a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+TOKEN
+ Name = "PchSmbusArpEnabled_SUPPORT"
+ Value = "0"
+ Help = "Main switch to enable PchSmbusArpEnabled support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "PchSmbusArpEnabled_DIR"
+ Help = "PchSmbusArpEnabled file source directory"
+End
+
+MODULE
+ Help = "Includes PchSmbusArpEnabled.mak to Project"
+ File = "PchSmbusArpEnabled.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PchSmbusArpEnabled.ffs"
+ Parent = "FV_BB"
+ InvokeOrder = AfterParent
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArpdisabled.c b/ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArpdisabled.c
new file mode 100644
index 0000000..b249317
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusArpdisabled.c
@@ -0,0 +1,117 @@
+/** @file
+ PCH Smbus PEIM. This file is used when we do not want ARP support.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "PchSmbus.h"
+
+/**
+ Set Slave address for an Smbus device with a known UDID or perform a general
+ ARP of all devices.
+
+ @param[in] PeiServices Pointer to the PEI Services table.
+ @param[in] This Pointer to the instance of the PEI_SMBUS_PPI.
+ @param[in] ArpAll If TRUE, do a full ARP. Otherwise, just ARP the specified UDID.
+ @param[in] SmbusUdid When doing a directed ARP, ARP the device with this UDID.
+ @param[in, out] SlaveAddress Buffer to store new Slave Address during directed ARP.
+
+ @exception EFI_UNSUPPORTED This functionality is not supported
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+SmbusArpDevice (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_SMBUS_PPI * This,
+ IN BOOLEAN ArpAll,
+ IN EFI_SMBUS_UDID * SmbusUdid OPTIONAL,
+ IN OUT EFI_SMBUS_DEVICE_ADDRESS * SlaveAddress OPTIONAL
+ )
+{
+ return EFI_UNSUPPORTED;
+}
+
+/**
+ Get a pointer to the assigned mappings of UDID's to Slave Addresses.
+
+ @param[in] PeiServices Pointer to the PEI Services table.
+ @param[in] This Pointer to the instance of the PEI_SMBUS_PPI.
+ @param[in, out] Length Buffer to contain the lenght of the Device Map.
+ @param[in, out] SmbusDeviceMap Buffer to contian a pointer to the Device Map.
+
+ @exception EFI_UNSUPPORTED This functionality is not supported
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+SmbusGetArpMap (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_SMBUS_PPI *This,
+ IN OUT UINTN *Length,
+ IN OUT EFI_SMBUS_DEVICE_MAP **SmbusDeviceMap
+ )
+{
+ return EFI_UNSUPPORTED;
+}
+
+/**
+ Register a callback in the event of a Host Notify command being sent by a
+ specified Slave Device.
+
+ @param[in] PeiServices The general PEI Services
+ @param[in] This The PPI instance
+ @param[in] SlaveAddress Address of the device whose Host Notify command we want to trap.
+ @param[in] Data Data of the Host Notify command we want to trap.
+ @param[in] NotifyFunction Function to be called in the event the desired Host Notify command occurs.
+
+ @exception EFI_UNSUPPORTED This functionality is not supported
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+SmbusNotify (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_SMBUS_PPI *This,
+ IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
+ IN UINTN Data,
+ IN EFI_PEI_SMBUS_NOTIFY_FUNCTION NotifyFunction
+ )
+{
+ ///
+ /// Requires a periodic event, not supported in PEI
+ ///
+ return EFI_UNSUPPORTED;
+}
+
+/**
+ Function to be called when SMBus.Execute happens. This will check if
+ the SMBus Host Controller has received a Host Notify command. If so, it will
+ see if a notification has been reqested on that event and make any callbacks
+ that may be necessary.
+
+ @param[in] Private Pointer to the SMBUS_INSTANCE
+
+ @retval None
+**/
+VOID
+CheckNotification (
+ IN SMBUS_INSTANCE *Private
+ )
+{
+ return;
+} \ No newline at end of file
diff --git a/ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusEntry.c b/ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusEntry.c
new file mode 100644
index 0000000..3e4a6a0
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Smbus/Pei/PchSmbusEntry.c
@@ -0,0 +1,241 @@
+/** @file
+ PCH Smbus PEIM.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "PchSmbus.h"
+
+///
+/// Global variables
+///
+EFI_GUID mPeiSmbusPolicyPpiGuid = PEI_SMBUS_POLICY_PPI_GUID;
+
+//
+// Functions
+//
+
+/**
+ This function provides a standard way to execute an SMBUS command
+ PPI as defined in the SMBus Specification. The data can either be of
+ the length byte, word, or a block of data (1 to 32 bytes long).
+ The resulting transaction will be either the SMBus Slave Device accepts
+ this transaction or this function returns with an error
+
+ @param[in] PeiServices PEI services table pointer
+ @param[in] This PEI_SMBUS_PPI instance
+ @param[in] SlaveAddress Smbus Slave device address
+ @param[in] Command Command to be sent
+ @param[in] Operation Which SMBus PPI will be used
+ @param[in] PecCheck Defines if Packet Error Code Checking is to be used
+ @param[in, out] Length How many bytes to read/write. Must be 1 <= Length <= 32 depending on the Operation
+ @param[in, out] Buffer Data buffer
+
+ @retval EFI_SUCCESS Operation success.
+ Length will contain the actual number of bytes read.
+ Buffer will contain the data read.
+ @retval Otherwise Operation failed.
+**/
+EFI_STATUS
+EFIAPI
+SmbusExecute (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_SMBUS_PPI *This,
+ IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
+ IN EFI_SMBUS_DEVICE_COMMAND Command,
+ IN EFI_SMBUS_OPERATION Operation,
+ IN BOOLEAN PecCheck,
+ IN OUT UINTN *Length,
+ IN OUT VOID *Buffer
+ )
+{
+ EFI_STATUS Status;
+ SMBUS_INSTANCE *Private;
+ DEBUG ((EFI_D_EVENT, "PEI SmbusExecute() Start, SmbusDeviceAddress=%x, Command=%x, Operation=%x\n", (SlaveAddress.SmbusDeviceAddress << 1), Command, Operation));
+ Private = SMBUS_PRIVATE_DATA_FROM_PPI_THIS (This);
+
+ Status = SmbusExec (
+ SlaveAddress,
+ Command,
+ Operation,
+ PecCheck,
+ Length,
+ Buffer
+ );
+ ///
+ /// Last step, check notification
+ ///
+ CheckNotification (Private);
+ DEBUG ((EFI_D_EVENT, "PEI SmbusExecute() End\n"));
+ return Status;
+}
+
+/**
+ Initialize the Smbus PPI and program the Smbus BAR
+
+ @param[in] FfsHeader Not used.
+ @param[in] PeiServices General purpose services available to every PEIM.
+
+ @retval EFI_SUCCESS The function completes successfully
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to create database
+**/
+EFI_STATUS
+InitializePchSmbusPeim (
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_STATUS Status;
+ SMBUS_INSTANCE *Private;
+ UINTN SmbusRegBase;
+
+ DEBUG ((EFI_D_INFO, "InitializePchSmbusPeim() Start\n"));
+
+ Private = (SMBUS_INSTANCE *) AllocatePool (sizeof (SMBUS_INSTANCE));
+ if (Private == NULL) {
+ DEBUG ((EFI_D_ERROR, "Failed to allocate memory for Private! \n"));
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ InitializePeiPrivate (PeiServices, Private);
+
+ SmbusRegBase = MmPciAddress (
+ 0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_SMBUS,
+ PCI_FUNCTION_NUMBER_PCH_SMBUS,
+ 0
+ );
+ ///
+ /// Since PEI has no PCI enumerator, set the BAR & I/O space enable ourselves
+ ///
+ MmioAndThenOr32 (SmbusRegBase + R_PCH_SMBUS_BASE, B_PCH_SMBUS_BASE_BAR, Private->SmbusIoBase);
+
+ MmioOr8 (SmbusRegBase + R_PCH_SMBUS_PCICMD, B_PCH_SMBUS_PCICMD_IOSE);
+
+ ///
+ /// Reset the SMBus host controller
+ ///
+ MmioOr8 (SmbusRegBase + R_PCH_SMBUS_HOSTC, B_PCH_SMBUS_HOSTC_SSRESET);
+
+ ///
+ /// Enable the SMBus host controller
+ ///
+ MmioAndThenOr8 (
+ SmbusRegBase + R_PCH_SMBUS_HOSTC,
+ (UINT8) (~(B_PCH_SMBUS_HOSTC_SMI_EN | B_PCH_SMBUS_HOSTC_I2C_EN)),
+ B_PCH_SMBUS_HOSTC_HST_EN
+ );
+
+ ///
+ /// Clear Status Register before anyone uses the interfaces
+ ///
+ SmbusIoWrite (R_PCH_SMBUS_HSTS, B_PCH_SMBUS_HSTS_ALL);
+
+ Status = PeiServicesInstallPpi (&Private->PpiDescriptor);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Install a call-back for the permanent-memory so that we can fix up internal pointers
+ ///
+ Status = (**PeiServices).NotifyPpi (PeiServices, &Private->NotifyDescriptor);
+ ASSERT_EFI_ERROR (Status);
+
+ DEBUG ((EFI_D_INFO, "InitializePchSmbusPeim() End\n"));
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This function initializes the SmBus driver in PEI.
+
+ @param[in] PeiServices Standard PEI services
+ @param[in] Private SMBUS private data structure
+
+ @retval None.
+**/
+VOID
+InitializePeiPrivate (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN SMBUS_INSTANCE *Private
+ )
+{
+ EFI_STATUS Status;
+
+ Private->Signature = PCH_SMBUS_PRIVATE_DATA_SIGNATURE;
+ Private->PeiServices = PeiServices;
+
+ Status = (**PeiServices).LocatePpi (
+ PeiServices,
+ &mPeiSmbusPolicyPpiGuid,
+ 0,
+ NULL,
+ (VOID **) &(Private->SmbusPolicy)
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ Private->SmbusIoBase = Private->SmbusPolicy->BaseAddress;
+
+ Private->PpiDescriptor.Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;
+ Private->PpiDescriptor.Guid = &gEfiPeiSmbusPpiGuid;
+
+ Private->PpiDescriptor.Ppi = &Private->SmbusPpi;
+
+ Private->SmbusPpi.Execute = SmbusExecute;
+ Private->SmbusPpi.ArpDevice = SmbusArpDevice;
+ Private->SmbusPpi.GetArpMap = SmbusGetArpMap;
+ Private->SmbusPpi.Notify = SmbusNotify;
+
+ Private->NotifyDescriptor.Flags = (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST);
+ Private->NotifyDescriptor.Guid = &gEfiPeiMemoryDiscoveredPpiGuid;
+ Private->NotifyDescriptor.Notify = MemoryDiscoveredPpiNotifyCallback;
+
+ Private->DeviceMapEntries = 0;
+ Private->PlatformNumRsvd = Private->SmbusPolicy->NumRsvdAddress;
+ Private->PlatformRsvdAddr = Private->SmbusPolicy->RsvdAddress;
+
+ Private->NotifyFunctionNum = 0;
+
+ return;
+}
+
+/**
+ Fix up pointers since they are located in real memory now.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] NotifyDescriptor The notification structure this PEIM registered on install.
+ @param[in] Ppi The memory discovered PPI. Not used.
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+MemoryDiscoveredPpiNotifyCallback (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
+ IN VOID *Ppi
+ )
+{
+ SMBUS_INSTANCE *Private;
+
+ Private = SMBUS_PRIVATE_DATA_FROM_NOTIFY_THIS (NotifyDescriptor);
+
+ InitializePeiPrivate (PeiServices, Private);
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/Smbus/Smm/PchSmbus.dxs b/ReferenceCode/Chipset/LynxPoint/Smbus/Smm/PchSmbus.dxs
new file mode 100644
index 0000000..287dd96
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Smbus/Smm/PchSmbus.dxs
@@ -0,0 +1,41 @@
+/** @file
+ Dependency expression source file.
+
+@copyright
+ Copyright (c) 2009 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "DxeDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+
+#include EFI_PROTOCOL_DEFINITION (SmmBase)
+#include EFI_PROTOCOL_DEFINITION (Smbus)
+#endif
+
+DEPENDENCY_START
+ EFI_SMM_BASE_PROTOCOL_GUID
+DEPENDENCY_END
diff --git a/ReferenceCode/Chipset/LynxPoint/Smbus/Smm/PchSmbus.h b/ReferenceCode/Chipset/LynxPoint/Smbus/Smm/PchSmbus.h
new file mode 100644
index 0000000..8b99bcd
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Smbus/Smm/PchSmbus.h
@@ -0,0 +1,183 @@
+/** @file
+ PCH Smbus Protocol
+
+@copyright
+ Copyright (c) 2009 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _SMM_PCH_SMBUS_H
+#define _SMM_PCH_SMBUS_H
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+
+#include "EdkIIGlueDxe.h"
+
+//
+// Driver Produced Protocol Prototypes
+//
+#include EFI_PROTOCOL_DEFINITION (Smbus)
+#include EFI_PROTOCOL_PRODUCER (SmmSmbus)
+
+//
+// Driver Consumed Protcol Prototypes
+//
+#include "PchSmbusCommon.h"
+#endif
+//
+// Definitions
+//
+///
+/// Max number of SMBus devices (7 bit address yields 128 combinations but 21 of those are reserved)
+///
+#define MAX_SMBUS_DEVICES 107
+#define MICROSECOND 10
+#define MILLISECOND (1000 * MICROSECOND)
+#define ONESECOND (1000 * MILLISECOND)
+
+///
+/// Declare a local instance structure for this driver
+///
+typedef struct _SMBUS_INSTANCE {
+ UINTN Signature;
+ EFI_HANDLE Handle;
+
+ UINT32 SmbusIoBase;
+ SMBUS_IO_READ SmbusIoRead;
+ SMBUS_IO_WRITE SmbusIoWrite;
+ SMBUS_IO_DONE IoDone;
+
+ ///
+ /// Published interface
+ ///
+ EFI_SMBUS_HC_PROTOCOL SmbusController;
+
+} SMBUS_INSTANCE;
+
+SMBUS_INSTANCE *mSmbusContext;
+
+//
+// Prototypes
+//
+
+/**
+ Execute an SMBUS operation
+
+ @param[in] This The protocol instance
+ @param[in] SlaveAddress The address of the SMBUS slave device
+ @param[in] Command The SMBUS command
+ @param[in] Operation Which SMBus protocol will be issued
+ @param[in] PecCheck If Packet Error Code Checking is to be used
+ @param[in, out] Length Length of data
+ @param[in, out] Buffer Data buffer
+
+ @retval EFI_SUCCESS The SMBUS operation is successful
+ @retval Other Values Something error occurred
+**/
+EFI_STATUS
+EFIAPI
+SmbusExecute (
+ IN EFI_SMBUS_HC_PROTOCOL *This,
+ IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
+ IN EFI_SMBUS_DEVICE_COMMAND Command,
+ IN EFI_SMBUS_OPERATION Operation,
+ IN BOOLEAN PecCheck,
+ IN OUT UINTN *Length,
+ IN OUT VOID *Buffer
+ );
+
+/**
+ Smbus driver entry point
+
+ @param[in] ImageHandle ImageHandle of this module
+ @param[in] SystemTable EFI System Table
+
+ @retval EFI_SUCCESS Driver initializes successfully
+ @retval Other values Some error occurred
+**/
+EFI_STATUS
+EFIAPI
+InitializePchSmbusSmm (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ );
+
+/**
+ Set Slave address for an Smbus device with a known UDID or perform a general
+ ARP of all devices.
+
+ @param[in] This Pointer to the instance of the EFI_SMBUS_HC_PROTOCOL.
+ @param[in] ArpAll If TRUE, do a full ARP. Otherwise, just ARP the specified UDID.
+ @param[in] SmbusUdid When doing a directed ARP, ARP the device with this UDID.
+ @param[in, out] SlaveAddress Buffer to store new Slave Address during directed ARP. On output,If
+ ArpAlll == TRUE, this will contain the newly assigned Slave address.
+
+ @exception EFI_UNSUPPORTED This functionality is not supported
+**/
+EFI_STATUS
+EFIAPI
+SmbusArpDevice (
+ IN EFI_SMBUS_HC_PROTOCOL * This,
+ IN BOOLEAN ArpAll,
+ IN EFI_SMBUS_UDID * SmbusUdid, OPTIONAL
+ IN OUT EFI_SMBUS_DEVICE_ADDRESS * SlaveAddress OPTIONAL
+ );
+
+/**
+ Get a pointer to the assigned mappings of UDID's to Slave Addresses.
+
+ @param[in] This Pointer to the instance of the EFI_SMBUS_HC_PROTOCOL.
+ @param[in, out] Length Buffer to contain the lenght of the Device Map, it will be updated to
+ contain the number of pairs of UDID's mapped to Slave Addresses.
+ @param[in, out] SmbusDeviceMap Buffer to contian a pointer to the Device Map, it will be updated to
+ point to the first pair in the Device Map
+
+ @exception EFI_UNSUPPORTED This functionality is not supported
+**/
+EFI_STATUS
+EFIAPI
+SmbusGetArpMap (
+ IN EFI_SMBUS_HC_PROTOCOL *This,
+ IN OUT UINTN *Length,
+ IN OUT EFI_SMBUS_DEVICE_MAP **SmbusDeviceMap
+ );
+
+/**
+ Register a callback in the event of a Host Notify command being sent by a
+ specified Slave Device.
+
+ @param[in] This Pointer to the instance of the EFI_SMBUS_HC_PROTOCOL.
+ @param[in] SlaveAddress Address of the device whose Host Notify command we want to
+ trap.
+ @param[in] Data Data of the Host Notify command we want to trap.
+ @param[in] NotifyFunction Function to be called in the event the desired Host Notify
+ command occurs.
+
+ @exception EFI_UNSUPPORTED This functionality is not supported
+**/
+EFI_STATUS
+EFIAPI
+SmbusNotify (
+ IN EFI_SMBUS_HC_PROTOCOL *This,
+ IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
+ IN UINTN Data,
+ IN EFI_SMBUS_NOTIFY_FUNCTION NotifyFunction
+ );
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Smbus/Smm/PchSmbusArpDisabled.c b/ReferenceCode/Chipset/LynxPoint/Smbus/Smm/PchSmbusArpDisabled.c
new file mode 100644
index 0000000..89b9fbc
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Smbus/Smm/PchSmbusArpDisabled.c
@@ -0,0 +1,103 @@
+/** @file
+ PCH Smbus Driver, ARP functions not supported
+
+@copyright
+ Copyright (c) 2009 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "PchSmbus.h"
+
+/**
+ Set Slave address for an Smbus device with a known UDID or perform a general
+ ARP of all devices.
+
+ @param[in] This Pointer to the instance of the EFI_SMBUS_HC_PROTOCOL.
+ @param[in] ArpAll If TRUE, do a full ARP. Otherwise, just ARP the specified UDID.
+ @param[in] SmbusUdid When doing a directed ARP, ARP the device with this UDID.
+ @param[in, out] SlaveAddress Buffer to store new Slave Address during directed ARP. On output,If
+ ArpAlll == TRUE, this will contain the newly assigned Slave address.
+
+ @exception EFI_UNSUPPORTED This functionality is not supported
+**/
+EFI_STATUS
+EFIAPI
+SmbusArpDevice (
+ IN EFI_SMBUS_HC_PROTOCOL * This,
+ IN BOOLEAN ArpAll,
+ IN EFI_SMBUS_UDID * SmbusUdid, OPTIONAL
+ IN OUT EFI_SMBUS_DEVICE_ADDRESS * SlaveAddress OPTIONAL
+ )
+{
+ ///
+ /// ARP should be done in DXE SMBUS driver.
+ /// Not needed here.
+ ///
+ return EFI_UNSUPPORTED;
+}
+
+/**
+ Get a pointer to the assigned mappings of UDID's to Slave Addresses.
+
+ @param[in] This Pointer to the instance of the EFI_SMBUS_HC_PROTOCOL.
+ @param[in, out] Length Buffer to contain the lenght of the Device Map, it will be updated to
+ contain the number of pairs of UDID's mapped to Slave Addresses.
+ @param[in, out] SmbusDeviceMap Buffer to contian a pointer to the Device Map, it will be updated to
+ point to the first pair in the Device Map
+
+ @exception EFI_UNSUPPORTED This functionality is not supported
+**/
+EFI_STATUS
+EFIAPI
+SmbusGetArpMap (
+ IN EFI_SMBUS_HC_PROTOCOL *This,
+ IN OUT UINTN *Length,
+ IN OUT EFI_SMBUS_DEVICE_MAP **SmbusDeviceMap
+ )
+{
+ ///
+ /// ARP should be done in DXE SMBUS driver.
+ /// Not needed here.
+ ///
+ return EFI_UNSUPPORTED;
+}
+
+/**
+ Register a callback in the event of a Host Notify command being sent by a
+ specified Slave Device.
+
+ @param[in] This Pointer to the instance of the EFI_SMBUS_HC_PROTOCOL.
+ @param[in] SlaveAddress Address of the device whose Host Notify command we want to
+ trap.
+ @param[in] Data Data of the Host Notify command we want to trap.
+ @param[in] NotifyFunction Function to be called in the event the desired Host Notify
+ command occurs.
+
+ @exception EFI_UNSUPPORTED This functionality is not supported
+**/
+EFI_STATUS
+EFIAPI
+SmbusNotify (
+ IN EFI_SMBUS_HC_PROTOCOL *This,
+ IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
+ IN UINTN Data,
+ IN EFI_SMBUS_NOTIFY_FUNCTION NotifyFunction
+ )
+{
+ ///
+ /// Not needed for SMM.
+ ///
+ return EFI_UNSUPPORTED;
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/Smbus/Smm/PchSmbusEntry.c b/ReferenceCode/Chipset/LynxPoint/Smbus/Smm/PchSmbusEntry.c
new file mode 100644
index 0000000..37cb621
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Smbus/Smm/PchSmbusEntry.c
@@ -0,0 +1,128 @@
+/** @file
+ PCH Smbus Driver Entry
+
+@copyright
+ Copyright (c) 2009 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "PchSmbus.h"
+
+//
+// Global variables
+//
+EFI_SMM_BASE_PROTOCOL *mSmmBase;
+EFI_SMM_SYSTEM_TABLE *mSmst;
+
+EFI_GUID mEfiSmmSmbusProtocolGuid = EFI_SMM_SMBUS_PROTOCOL_GUID;
+
+/**
+ Execute an SMBUS operation
+
+ @param[in] This The protocol instance
+ @param[in] SlaveAddress The address of the SMBUS slave device
+ @param[in] Command The SMBUS command
+ @param[in] Operation Which SMBus protocol will be issued
+ @param[in] PecCheck If Packet Error Code Checking is to be used
+ @param[in, out] Length Length of data
+ @param[in, out] Buffer Data buffer
+
+ @retval EFI_SUCCESS The SMBUS operation is successful
+ @retval Other Values Something error occurred
+**/
+EFI_STATUS
+EFIAPI
+SmbusExecute (
+ IN EFI_SMBUS_HC_PROTOCOL *This,
+ IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
+ IN EFI_SMBUS_DEVICE_COMMAND Command,
+ IN EFI_SMBUS_OPERATION Operation,
+ IN BOOLEAN PecCheck,
+ IN OUT UINTN *Length,
+ IN OUT VOID *Buffer
+ )
+{
+ InitializeSmbusRegisters ();
+
+ return SmbusExec (
+ SlaveAddress,
+ Command,
+ Operation,
+ PecCheck,
+ Length,
+ Buffer
+ );
+}
+
+/**
+ Smbus driver entry point
+
+ @param[in] ImageHandle ImageHandle of this module
+ @param[in] SystemTable EFI System Table
+
+ @retval EFI_SUCCESS Driver initializes successfully
+ @retval Other values Some error occurred
+**/
+EFI_STATUS
+EFIAPI
+InitializePchSmbusSmm (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+
+ ///
+ /// Locate SMM Base Protocol
+ ///
+ Status = gBS->LocateProtocol (&gEfiSmmBaseProtocolGuid, NULL, (VOID **) &mSmmBase);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Initialize our module variables
+ ///
+ Status = mSmmBase->GetSmstLocation (mSmmBase, &mSmst);
+ ASSERT_EFI_ERROR (Status);
+
+ Status = mSmst->SmmAllocatePool (EfiRuntimeServicesData, sizeof (SMBUS_INSTANCE), (VOID **) &mSmbusContext);
+
+ if (EFI_ERROR (Status)) {
+ return Status;
+ } else {
+ ZeroMem (mSmbusContext, sizeof (SMBUS_INSTANCE));
+
+ mSmbusContext->Signature = PCH_SMBUS_PRIVATE_DATA_SIGNATURE;
+ mSmbusContext->IoDone = IoDone;
+ mSmbusContext->SmbusIoRead = SmbusIoRead;
+ mSmbusContext->SmbusIoWrite = SmbusIoWrite;
+ mSmbusContext->SmbusController.Execute = SmbusExecute;
+ mSmbusContext->SmbusController.ArpDevice = SmbusArpDevice;
+ mSmbusContext->SmbusController.GetArpMap = SmbusGetArpMap;
+ mSmbusContext->SmbusController.Notify = SmbusNotify;
+
+ ///
+ /// Install the SMBUS interface
+ ///
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &mSmbusContext->Handle,
+ &mEfiSmmSmbusProtocolGuid,
+ &mSmbusContext->SmbusController,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/Smbus/Smm/PchSmbusSmm.cif b/ReferenceCode/Chipset/LynxPoint/Smbus/Smm/PchSmbusSmm.cif
new file mode 100644
index 0000000..884f322
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Smbus/Smm/PchSmbusSmm.cif
@@ -0,0 +1,14 @@
+<component>
+ name = "PchSmbusSmm"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\Smbus\Smm"
+ RefName = "PchSmbusSmm"
+[files]
+"PchSmbusSmm.sdl"
+"PchSmbusSmm.mak"
+"PchSmbus.h"
+"PchSmbusArpDisabled.c"
+"PchSmbusEntry.c"
+"PchSmbus.dxs"
+"PchSmbusSmm.inf"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/Smbus/Smm/PchSmbusSmm.inf b/ReferenceCode/Chipset/LynxPoint/Smbus/Smm/PchSmbusSmm.inf
new file mode 100644
index 0000000..bd5a8f8
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Smbus/Smm/PchSmbusSmm.inf
@@ -0,0 +1,95 @@
+## @file
+# Component description file for PchSmbus driver
+#
+#@copyright
+# Copyright (c) 2009 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = PchSmbusSmm
+FILE_GUID = 59287178-59B2-49ca-BC63-532B12EA2C53
+COMPONENT_TYPE = BS_DRIVER
+
+[sources.common]
+ PchSmbusEntry.c
+ PchSmbus.h
+ PchSmbusArpDisabled.c
+ ../Common/PchSmbusExec.c
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueSmmDriverEntryPoint.c
+
+[includes.common]
+ $(EDK_SOURCE)/Foundation/Efi
+ .
+ ../Common
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/SampleCode
+
+[libraries.common]
+ EdkIIGlueBaseLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueBaseMemoryLib
+ EdkIIGlueDxeMemoryAllocationLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueSmmRuntimeDxeReportStatusCodeLib
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueUefiDevicePathLib
+ EdkIIGlueBasePciLibPciExpress
+ EdkProtocolLib
+ EdkFrameworkProtocolLib
+ $(PROJECT_PCH_FAMILY)ProtocolLib
+ PchPlatformLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT=_ModuleEntryPoint
+ DPX_SOURCE=PchSmbus.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=InitializePchSmbusSmm
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_LIB__ \
+ -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_SMM_RUNTIME_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_DEVICE_PATH_LIB__ \
+ -D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__
diff --git a/ReferenceCode/Chipset/LynxPoint/Smbus/Smm/PchSmbusSmm.mak b/ReferenceCode/Chipset/LynxPoint/Smbus/Smm/PchSmbusSmm.mak
new file mode 100644
index 0000000..32274ff
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Smbus/Smm/PchSmbusSmm.mak
@@ -0,0 +1,105 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSmbusSmm/PchSmbusSmm.mak 2 2/24/12 2:28a Victortu $
+#
+# $Revision: 2 $
+#
+# $Date: 2/24/12 2:28a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSmbusSmm/PchSmbusSmm.mak $
+#
+# 2 2/24/12 2:28a Victortu
+# Updated to support 4.6.5.3_IntelEDK_1117_Patch7_00.
+#
+# 1 2/08/12 9:27a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+
+#---------------------------------------------------------------------------
+# Create PchSmbus SMM Driver
+#---------------------------------------------------------------------------
+EDK : PchSmbusSmm
+PchSmbusSmm : $(BUILD_DIR)\PchSmbusSmm.mak PchSmbusSmmBin
+
+
+$(BUILD_DIR)\PchSmbusSmm.mak : $(PchSmbusSmm_DIR)\$(@B).cif $(PchSmbusSmm_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(PchSmbusSmm_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+PchSmbusSmm_INCLUDES=\
+ $(INTEL_PCH_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+
+PchSmbusSmm_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=InitializePchSmbusSmm"\
+ /D __EDKII_GLUE_BASE_LIB__ \
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_SMM_RUNTIME_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_UEFI_DEVICE_PATH_LIB__ \
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__
+
+PchSmbusSmm_LIB_LINKS =\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGlueDxeMemoryAllocationLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueSmmRuntimeDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueUefiDevicePathLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(EDKPROTOCOLLIB)\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(INTEL_PCH_PROTOCOL_LIB)\
+ $(PchPlatformSmmLib_LIB) \
+ $(PchSmbusCommonSmmLib_LIB)
+
+PchSmbusSmmBin: $(PchSmbusSmm_LIB_LINKS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\PchSmbusSmm.mak all \
+ "MY_INCLUDES=$(PchSmbusSmm_INCLUDES)"\
+ "MY_DEFINES=$(PchSmbusSmm_DEFINES)"\
+ GUID=59287178-59B2-49ca-BC63-532B12EA2C53\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=RT_DRIVER\
+ EDKIIModule=SMMDRIVER\
+ DEPEX1=$(PchSmbusSmm_DIR)\PchSmbus.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX\
+ COMPRESS=1
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Smbus/Smm/PchSmbusSmm.sdl b/ReferenceCode/Chipset/LynxPoint/Smbus/Smm/PchSmbusSmm.sdl
new file mode 100644
index 0000000..b2db358
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Smbus/Smm/PchSmbusSmm.sdl
@@ -0,0 +1,67 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSmbusSmm/PchSmbusSmm.sdl 1 2/08/12 9:27a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 9:27a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSmbusSmm/PchSmbusSmm.sdl $
+#
+# 1 2/08/12 9:27a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+TOKEN
+ Name = "PchSmbusSmm_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable PchSmbusSmm support in Project"
+End
+
+PATH
+ Name = "PchSmbusSmm_DIR"
+ Help = "PchSmbusSmm file source directory"
+End
+
+MODULE
+ Help = "Includes PchSmbusSmm.mak to Project"
+ File = "PchSmbusSmm.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PchSmbusSmm.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/SmmControl/Pei/PeiSmmControl.cif b/ReferenceCode/Chipset/LynxPoint/SmmControl/Pei/PeiSmmControl.cif
new file mode 100644
index 0000000..4d83025
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SmmControl/Pei/PeiSmmControl.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "PeiSmmControl"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\SmmControl\Pei\"
+ RefName = "PeiSmmControl"
+[files]
+"PeiSmmControl.sdl"
+"PeiSmmControl.mak"
+"SmmControl.dxs"
+"SmmControl.inf"
+"SmmControlDriver.c"
+"SmmControlDriver.h"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/SmmControl/Pei/PeiSmmControl.mak b/ReferenceCode/Chipset/LynxPoint/SmmControl/Pei/PeiSmmControl.mak
new file mode 100644
index 0000000..5199538
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SmmControl/Pei/PeiSmmControl.mak
@@ -0,0 +1,93 @@
+#**********************************************************************
+#**********************************************************************
+#** **
+#** (C)Copyright 1985-2010, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#**********************************************************************
+#**********************************************************************
+
+#**********************************************************************
+# $Header: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PeiSmmControl/PeiSmmControl.mak 1 9/26/12 3:34a Victortu $
+#
+# $Revision: 1 $
+#
+# $Date: 9/26/12 3:34a $
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PeiSmmControl/PeiSmmControl.mak $
+#
+# 1 9/26/12 3:34a Victortu
+# Lynx Point PCH Chipset Framework Reference Code Beta 0.7.0
+#
+# 6 1/13/10 2:13p Felixp
+#
+#**********************************************************************
+#<AMI_FHDR_START>
+#
+# Name: PeiSmmControl.mak
+#
+# Description:
+#
+#<AMI_FHDR_END>
+#**********************************************************************
+EDK : PeiSmmControl
+
+PeiSmmControl : $(BUILD_DIR)\PeiSmmControl.mak PeiSmmControlBin
+
+$(BUILD_DIR)\PeiSmmControl.mak : $(PeiSmmControl_DIR)\$(@B).cif $(PeiSmmControl_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(PeiSmmControl_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+PeiSmmControl_INCLUDES=\
+ $(EDK_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+
+PeiSmmControl_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=SmmControlPeiDriverEntryInit"\
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_PEI_SERVICES_LIB__ \
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__
+
+PeiSmmControl_LIB_LINKS =\
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGluePeiDebugLibReportStatusCode_LIB)\
+ $(EdkIIGluePeiReportStatusCodeLib_LIB)\
+ $(EdkIIGluePeiServicesLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+
+PeiSmmControlBin : $(PeiSmmControl_LIB_LINKS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\PeiSmmControl.mak all\
+ "MY_INCLUDES=$(PeiSmmControl_INCLUDES)" \
+ "MY_DEFINES=$(PeiSmmControl_DEFINES)" \
+ GUID=FF456B9C-0DC7-4682-9E92-0DE84B6E4067\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=PEIM \
+ EDKIIModule=PEIM\
+ DEPEX1=$(PeiSmmControl_DIR)\SmmControl.dxs\
+ DEPEX1_TYPE=EFI_SECTION_PEI_DEPEX\
+ COMPRESS=0
+#**********************************************************************
+#**********************************************************************
+#** **
+#** (C)Copyright 1985-2010, 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/ReferenceCode/Chipset/LynxPoint/SmmControl/Pei/PeiSmmControl.sdl b/ReferenceCode/Chipset/LynxPoint/SmmControl/Pei/PeiSmmControl.sdl
new file mode 100644
index 0000000..8470880
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SmmControl/Pei/PeiSmmControl.sdl
@@ -0,0 +1,24 @@
+TOKEN
+ Name = PeiSmmControl_SUPPORT
+ Value = 1
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable PeiSmmControl support in Project"
+End
+
+MODULE
+ Help = "Includes PeiSmmControl.mak to Project"
+ File = "PeiSmmControl.mak"
+End
+
+PATH
+ Name = "PeiSmmControl_DIR"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PeiSmmControl.ffs"
+ Parent = "FV_BB"
+ InvokeOrder = AfterParent
+End \ No newline at end of file
diff --git a/ReferenceCode/Chipset/LynxPoint/SmmControl/Pei/SmmControl.dxs b/ReferenceCode/Chipset/LynxPoint/SmmControl/Pei/SmmControl.dxs
new file mode 100644
index 0000000..2ff2cf2
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SmmControl/Pei/SmmControl.dxs
@@ -0,0 +1,35 @@
+/** @file
+ @todo ADD DESCRIPTION
+
+@copyright
+ Copyright (c) 2005 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+//
+// Same for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "PeimDepex.h"
+//
+// For R8 only
+//
+#ifdef BUILD_WITH_EDKII_GLUE_LIB
+#include "EfiDepex.h"
+
+#endif
+DEPENDENCY_START
+ TRUE
+DEPENDENCY_END
diff --git a/ReferenceCode/Chipset/LynxPoint/SmmControl/Pei/SmmControl.inf b/ReferenceCode/Chipset/LynxPoint/SmmControl/Pei/SmmControl.inf
new file mode 100644
index 0000000..f65db70
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SmmControl/Pei/SmmControl.inf
@@ -0,0 +1,76 @@
+## @file
+# Component description file for SmmControl module
+#
+#@copyright
+# Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = SmmControl
+FILE_GUID = FF456B9C-0DC7-4682-9E92-0DE84B6E4067
+COMPONENT_TYPE = PE32_PEIM
+
+[sources.common]
+ SmmControlDriver.h
+ SmmControlDriver.c
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGluePeimEntryPoint.c
+
+[includes.common]
+ .
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Pei/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+ $(EFI_SOURCE)/Library/Include
+ $(EFI_SOURCE)/Include
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[libraries.common]
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueBaseMemoryLib
+ EdkIIGluePeiDebugLibReportStatusCode
+ EdkIIGluePeiReportStatusCodeLib
+ EdkIIGluePeiServicesLib
+ EdkIIGlueBasePciLibPciExpress
+
+[nmake.common]
+ IMAGE_ENTRY_POINT=_ModuleEntryPoint
+ DPX_SOURCE=SmmControl.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=SmmControlPeiDriverEntryInit
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_PEI_SERVICES_LIB__ \
+ -D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__
diff --git a/ReferenceCode/Chipset/LynxPoint/SmmControl/Pei/SmmControlDriver.c b/ReferenceCode/Chipset/LynxPoint/SmmControl/Pei/SmmControlDriver.c
new file mode 100644
index 0000000..a4638e8
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SmmControl/Pei/SmmControlDriver.c
@@ -0,0 +1,282 @@
+/** @file
+ This is the driver that publishes the SMM Control Ppi.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "SmmControlDriver.h"
+
+EFI_GUID mPeiSmmControlPpiGuid = PEI_SMM_CONTROL_PPI_GUID;
+
+STATIC PEI_SMM_CONTROL_PPI mSmmControlPpi = {
+ PeiActivate,
+ PeiDeactivate
+};
+
+STATIC EFI_PEI_PPI_DESCRIPTOR mPpiList = {
+ (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+ &mPeiSmmControlPpiGuid,
+ &mSmmControlPpi
+};
+
+EFI_PEIM_ENTRY_POINT (SmmControlPeiDriverEntryInit)
+
+/**
+ This is the constructor for the SMM Control ppi
+
+ @param[in] FfsHeader FfsHeader.
+ @param[in] PeiServices General purpose services available to every PEIM.
+
+ @retval EFI_STATUS Results of the installation of the SMM Control Ppi
+**/
+EFI_STATUS
+EFIAPI
+SmmControlPeiDriverEntryInit (
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_STATUS Status;
+
+ Status = (**PeiServices).InstallPpi (PeiServices, &mPpiList);
+ ASSERT_EFI_ERROR (Status);
+
+ return Status;
+}
+
+/**
+ Trigger the software SMI
+
+ @param[in] Data The value to be set on the software SMI data port
+
+ @retval EFI_SUCCESS Function completes successfully
+**/
+EFI_STATUS
+EFIAPI
+SmmTrigger (
+ IN UINT8 Data
+ )
+{
+ UINT32 OutputData;
+ UINT32 OutputPort;
+ UINT32 PmBase;
+
+ PmBase = MmioRead32 (
+ MmPciAddress (0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_ACPI_BASE)
+ ) & B_PCH_LPC_ACPI_BASE_BAR;
+
+ ///
+ /// Enable the APMC SMI
+ ///
+ OutputPort = PmBase + R_PCH_SMI_EN;
+ OutputData = IoRead32 ((UINTN) OutputPort);
+ OutputData |= (B_PCH_SMI_EN_APMC | B_PCH_SMI_EN_GBL_SMI);
+ DEBUG (
+ (EFI_D_INFO,
+ "The SMI Control Port at address %x will be written to %x.\n",
+ OutputPort,
+ OutputData)
+ );
+ IoWrite32 (
+ (UINTN) OutputPort,
+ (UINT32) (OutputData)
+ );
+
+ OutputPort = R_PCH_APM_CNT;
+ OutputData = Data;
+
+ ///
+ /// Generate the APMC SMI
+ ///
+ IoWrite8 (
+ (UINTN) OutputPort,
+ (UINT8) (OutputData)
+ );
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Clear the SMI status
+
+ @param[in] None
+
+ @retval EFI_SUCCESS The function completes successfully
+ @retval EFI_DEVICE_ERROR Something error occurred
+**/
+EFI_STATUS
+EFIAPI
+SmmClear (
+ VOID
+ )
+{
+ UINT32 OutputData;
+ UINT32 OutputPort;
+ UINT32 PmBase;
+
+ PmBase = MmioRead32 (
+ MmPciAddress (0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_ACPI_BASE)
+ ) & B_PCH_LPC_ACPI_BASE_BAR;
+
+ ///
+ /// Clear the Power Button Override Status Bit, it gates EOS from being set.
+ ///
+ OutputPort = PmBase + R_PCH_ACPI_PM1_STS;
+ OutputData = B_PCH_ACPI_PM1_STS_PRBTNOR;
+ DEBUG (
+ (EFI_D_INFO,
+ "The PM1 Status Port at address %x will be written to %x.\n",
+ OutputPort,
+ OutputData)
+ );
+ IoWrite16 (
+ (UINTN) OutputPort,
+ (UINT16) (OutputData)
+ );
+
+ ///
+ /// Clear the APM SMI Status Bit
+ ///
+ OutputPort = PmBase + R_PCH_SMI_STS;
+ OutputData = B_PCH_SMI_STS_APM;
+ DEBUG (
+ (EFI_D_INFO,
+ "The SMI Status Port at address %x will be written to %x.\n",
+ OutputPort,
+ OutputData)
+ );
+ IoWrite32 (
+ (UINTN) OutputPort,
+ (UINT32) (OutputData)
+ );
+
+ ///
+ /// Set the EOS Bit
+ ///
+ OutputPort = PmBase + R_PCH_SMI_EN;
+ OutputData = IoRead32 ((UINTN) OutputPort);
+ OutputData |= B_PCH_SMI_EN_EOS;
+ DEBUG (
+ (EFI_D_INFO,
+ "The SMI Control Port at address %x will be written to %x.\n",
+ OutputPort,
+ OutputData)
+ );
+ IoWrite32 (
+ (UINTN) OutputPort,
+ (UINT32) (OutputData)
+ );
+
+ ///
+ /// If the EOS bit did not get set, then we've got a problem.
+ ///
+ DEBUG_CODE (
+ OutputData = IoRead32 ((UINTN) OutputPort);
+ if ((OutputData & B_PCH_SMI_EN_EOS) != B_PCH_SMI_EN_EOS) {
+ DEBUG ((EFI_D_ERROR, "Bugger, EOS did not get set!\n"));
+ return EFI_DEVICE_ERROR;
+ }
+ );
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This routine generates an SMI
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] This The EFI SMM Control ppi instance
+ @param[in, out] ArgumentBuffer The buffer of argument
+ @param[in, out] ArgumentBufferSize The size of the argument buffer
+ @param[in] Periodic Periodic or not
+ @param[in] ActivationInterval Interval of periodic SMI
+
+ @retval EFI Status Describing the result of the operation
+ @retval EFI_INVALID_PARAMETER Some parameter value passed is not supported
+**/
+EFI_STATUS
+EFIAPI
+PeiActivate (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_SMM_CONTROL_PPI *This,
+ IN OUT INT8 *ArgumentBuffer OPTIONAL,
+ IN OUT UINTN *ArgumentBufferSize OPTIONAL,
+ IN BOOLEAN Periodic OPTIONAL,
+ IN UINTN ActivationInterval OPTIONAL
+ )
+{
+ EFI_STATUS Status;
+ UINT8 Data;
+
+ if (Periodic) {
+ DEBUG ((EFI_D_WARN, "Invalid parameter\n"));
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (ArgumentBuffer == NULL) {
+ Data = 0xFF;
+ } else {
+ if (ArgumentBufferSize == NULL || *ArgumentBufferSize != 1) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Data = *ArgumentBuffer;
+ }
+ ///
+ /// Clear any pending the APM SMI
+ ///
+ Status = SmmClear ();
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ return SmmTrigger (Data);
+}
+
+/**
+ This routine clears an SMI
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] This The EFI SMM Control ppi instance
+ @param[in] Periodic Periodic or not
+
+ @retval EFI Status Describing the result of the operation
+ @retval EFI_INVALID_PARAMETER Some parameter value passed is not supported
+**/
+EFI_STATUS
+EFIAPI
+PeiDeactivate (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_SMM_CONTROL_PPI *This,
+ IN BOOLEAN Periodic OPTIONAL
+ )
+{
+ if (Periodic) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ return SmmClear ();
+}
+
diff --git a/ReferenceCode/Chipset/LynxPoint/SmmControl/Pei/SmmControlDriver.h b/ReferenceCode/Chipset/LynxPoint/SmmControl/Pei/SmmControlDriver.h
new file mode 100644
index 0000000..1cc28b3
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SmmControl/Pei/SmmControlDriver.h
@@ -0,0 +1,95 @@
+/** @file
+ Header file for SMM Control Driver.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _EFI_PEI_SMM_CONTROL_DRIVER_H_
+#define _EFI_PEI_SMM_CONTROL_DRIVER_H_
+
+#include "EdkIIGluePeim.h"
+#include "Pci22.h"
+
+//
+// Driver private data
+//
+#include EFI_PPI_DEFINITION (SmmControl)
+#include "PchAccess.h"
+#include "PchPlatformLib.h"
+
+//
+// Prototypes
+//
+
+/**
+ This is the constructor for the SMM Control ppi
+
+ @param[in] FfsHeader FfsHeader.
+ @param[in] PeiServices General purpose services available to every PEIM.
+
+ @retval EFI_STATUS Results of the installation of the SMM Control Ppi
+**/
+EFI_STATUS
+EFIAPI
+SmmControlPeiDriverEntryInit (
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+ );
+
+/**
+ This routine generates an SMI
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] This The EFI SMM Control ppi instance
+ @param[in, out] ArgumentBuffer The buffer of argument
+ @param[in, out] ArgumentBufferSize The size of the argument buffer
+ @param[in] Periodic Periodic or not
+ @param[in] ActivationInterval Interval of periodic SMI
+
+ @retval EFI Status Describing the result of the operation
+ @retval EFI_INVALID_PARAMETER Some parameter value passed is not supported
+**/
+EFI_STATUS
+EFIAPI
+PeiActivate (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_SMM_CONTROL_PPI *This,
+ IN OUT INT8 *ArgumentBuffer OPTIONAL,
+ IN OUT UINTN *ArgumentBufferSize OPTIONAL,
+ IN BOOLEAN Periodic OPTIONAL,
+ IN UINTN ActivationInterval OPTIONAL
+ );
+
+/**
+ This routine clears an SMI
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] This The EFI SMM Control ppi instance
+ @param[in] Periodic Periodic or not
+
+ @retval EFI Status Describing the result of the operation
+ @retval EFI_INVALID_PARAMETER Some parameter value passed is not supported
+**/
+EFI_STATUS
+EFIAPI
+PeiDeactivate (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_SMM_CONTROL_PPI *This,
+ IN BOOLEAN Periodic OPTIONAL
+ );
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/SmmControl/RuntimeDxe/SmmControl.cif b/ReferenceCode/Chipset/LynxPoint/SmmControl/RuntimeDxe/SmmControl.cif
new file mode 100644
index 0000000..f683a24
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SmmControl/RuntimeDxe/SmmControl.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "SmmControl"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\SmmControl\RuntimeDxe"
+ RefName = "SmmControl"
+[files]
+"SmmControl.sdl"
+"SmmControl.mak"
+"SmmControlDriver.h"
+"SmmControlDriver.c"
+"SmmControl.dxs"
+"SmmControl.inf"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/SmmControl/RuntimeDxe/SmmControl.dxs b/ReferenceCode/Chipset/LynxPoint/SmmControl/RuntimeDxe/SmmControl.dxs
new file mode 100644
index 0000000..994ee96
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SmmControl/RuntimeDxe/SmmControl.dxs
@@ -0,0 +1,36 @@
+/** @file
+ Dispatch dependency expression file for the SmmControl driver.
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+//
+// Same for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "DxeDepex.h"
+
+//
+// For R8 only
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+#endif
+
+DEPENDENCY_START
+ TRUE
+DEPENDENCY_END
diff --git a/ReferenceCode/Chipset/LynxPoint/SmmControl/RuntimeDxe/SmmControl.inf b/ReferenceCode/Chipset/LynxPoint/SmmControl/RuntimeDxe/SmmControl.inf
new file mode 100644
index 0000000..5d9d647
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SmmControl/RuntimeDxe/SmmControl.inf
@@ -0,0 +1,85 @@
+## @file
+# Component description file for SmmControl module
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = SmmControl
+FILE_GUID = A0BAD9F7-AB78-491b-B583-C52B7F84B9E0
+COMPONENT_TYPE = RT_DRIVER
+
+[sources.common]
+ SmmControlDriver.h
+ SmmControlDriver.c
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueDxeDriverEntryPoint.c
+
+[includes.common]
+ .
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[libraries.common]
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueBaseMemoryLib
+ EdkIIGlueSmmRuntimeDxeReportStatusCodeLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueUefiDevicePathLib
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueDxeMemoryAllocationLib
+ EdkIIGlueEdkDxeRuntimeDriverLib
+ EdkIIGlueBasePciLibPciExpress
+ EdkFrameworkProtocolLib
+ EdkProtocolLib
+ PchPlatformLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = SmmControl.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=SmmControlDriverEntryInit
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT_HANDLER__=SmmControlVirtualAddressChangeEvent
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_SMM_RUNTIME_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_UEFI_DEVICE_PATH_LIB__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__ \
+ -D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ -D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__
diff --git a/ReferenceCode/Chipset/LynxPoint/SmmControl/RuntimeDxe/SmmControl.mak b/ReferenceCode/Chipset/LynxPoint/SmmControl/RuntimeDxe/SmmControl.mak
new file mode 100644
index 0000000..802fa7f
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SmmControl/RuntimeDxe/SmmControl.mak
@@ -0,0 +1,105 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/SmmControl/SmmControl.mak 2 2/24/12 2:24a Victortu $
+#
+# $Revision: 2 $
+#
+# $Date: 2/24/12 2:24a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/SmmControl/SmmControl.mak $
+#
+# 2 2/24/12 2:24a Victortu
+# Updated to support 4.6.5.3_IntelEDK_1117_Patch7_00.
+#
+# 1 2/08/12 9:21a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+#---------------------------------------------------------------------------
+# Create SmmControl Driver
+#---------------------------------------------------------------------------
+EDK : SmmControl
+SmmControl : $(BUILD_DIR)\SmmControl.mak SmmControlBin
+
+
+$(BUILD_DIR)\SmmControl.mak : $(SmmControl_DIR)\$(@B).cif $(SmmControl_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(SmmControl_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+SmmControl_INCLUDES=\
+ $(INTEL_PCH_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+
+SmmControl_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=SmmControlDriverEntryInit"\
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_UEFI_DEVICE_PATH_LIB__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__ \
+ /D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+ /D __EDKII_GLUE_SMM_RUNTIME_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+
+SmmControl_LIB_LINKS =\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueUefiDevicePathLib_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueDxeMemoryAllocationLib_LIB)\
+ $(EdkIIGlueEdkDxeRuntimeDriverLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(EDKPROTOCOLLIB)\
+ $(PchPlatformDxeLib_LIB)\
+ $(SmmControlLib_LIB)\
+ $(EdkIIGlueSmmRuntimeDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueUefiRuntimeServicesTableLib_LIB)\
+
+SmmControlBin: $(SmmControl_LIB_LINKS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\SmmControl.mak all \
+ "MY_INCLUDES=$(SmmControl_INCLUDES)" \
+ "MY_DEFINES=$(SmmControl_DEFINES)" \
+ GUID=A0BAD9F7-AB78-491b-B583-C52B7F84B9E0\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=RT_DRIVER\
+ EDKIIModule=DXEDRIVER\
+ DEPEX1=$(SmmControl_DIR)\SmmControl.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \
+ COMPRESS=1
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/SmmControl/RuntimeDxe/SmmControl.sdl b/ReferenceCode/Chipset/LynxPoint/SmmControl/RuntimeDxe/SmmControl.sdl
new file mode 100644
index 0000000..9809183
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SmmControl/RuntimeDxe/SmmControl.sdl
@@ -0,0 +1,67 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/SmmControl/SmmControl.sdl 1 2/08/12 9:21a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 9:21a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/SmmControl/SmmControl.sdl $
+#
+# 1 2/08/12 9:21a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+TOKEN
+ Name = "SmmControl_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable SmmControl support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Token = "SMM_SUPPORT" "=" "1"
+End
+
+PATH
+ Name = "SmmControl_DIR"
+End
+
+MODULE
+ File = "SmmControl.mak"
+ Help = "Includes SmmControl to Project"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\SmmControl.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/SmmControl/RuntimeDxe/SmmControlDriver.c b/ReferenceCode/Chipset/LynxPoint/SmmControl/RuntimeDxe/SmmControlDriver.c
new file mode 100644
index 0000000..1220cf2
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SmmControl/RuntimeDxe/SmmControlDriver.c
@@ -0,0 +1,478 @@
+/** @file
+ This is the driver that publishes the SMM Control Protocol.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "SmmControlDriver.h"
+
+STATIC SMM_CONTROL_PRIVATE_DATA mSmmControl;
+UINT32 mPmBase;
+UINT32 mGpioBase;
+
+VOID
+EFIAPI
+DisablePendingSmis (
+ VOID
+ );
+
+/**
+ Fixup internal data pointers so that the services can be called in virtual mode.
+
+ @param[in] Event The event registered.
+ @param[in] Context Event context.
+
+ @retval None.
+**/
+VOID
+EFIAPI
+SmmControlVirtualAddressChangeEvent (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ gRT->ConvertPointer (EFI_INTERNAL_POINTER, (VOID *) &(mSmmControl.SmmControl.Trigger));
+ gRT->ConvertPointer (EFI_INTERNAL_POINTER, (VOID *) &(mSmmControl.SmmControl.Clear));
+ gRT->ConvertPointer (EFI_INTERNAL_POINTER, (VOID *) &(mSmmControl.SmmControl.GetRegisterInfo));
+}
+
+/**
+ This is the constructor for the SMM Control protocol
+
+ @param[in] ImageHandle Handle for the image of this driver
+ @param[in] SystemTable Pointer to the EFI System Table
+
+ @retval EFI_STATUS Results of the installation of the SMM Control Protocol
+**/
+EFI_STATUS
+EFIAPI
+SmmControlDriverEntryInit (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+
+ if (!IsPchSupported ()) {
+ DEBUG ((EFI_D_ERROR, "SMM Control Protocol not supported due to no proper PCH LPC found!\n"));
+ Status = EFI_UNSUPPORTED;
+ }
+
+ DEBUG ((EFI_D_INFO, "SmmControlDriverEntryInit() Start\n"));
+
+ ///
+ /// Get the Power Management I/O space base address. We assume that
+ /// this base address has already been programmed if this driver is
+ /// being run.
+ ///
+ mGpioBase = MmioRead32 (
+ MmPciAddress (0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_GPIO_BASE)
+ ) & B_PCH_LPC_GPIO_BASE_BAR ;
+ ASSERT (mGpioBase != 0);
+
+ mPmBase = MmioRead32 (
+ MmPciAddress (0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_ACPI_BASE)
+ ) & B_PCH_LPC_ACPI_BASE_BAR;
+
+ Status = EFI_SUCCESS;
+ if (mPmBase != 0) {
+ ///
+ /// Install the instance of the protocol
+ ///
+ mSmmControl.Signature = SMM_CONTROL_PRIVATE_DATA_SIGNATURE;
+ mSmmControl.Handle = ImageHandle;
+
+ mSmmControl.SmmControl.Trigger = Activate;
+ mSmmControl.SmmControl.Clear = Deactivate;
+ mSmmControl.SmmControl.GetRegisterInfo = GetRegisterInfo;
+ mSmmControl.SmmControl.MinimumTriggerPeriod = 0;
+
+ ///
+ /// Install our protocol interfaces on the device's handle
+ ///
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &mSmmControl.Handle,
+ &gEfiSmmControlProtocolGuid,
+ &mSmmControl.SmmControl,
+ NULL
+ );
+ } else {
+ Status = EFI_DEVICE_ERROR;
+ }
+ ///
+ /// Disable any PCH SMIs that, for whatever reason, are asserted after the boot.
+ ///
+ DisablePendingSmis ();
+
+ DEBUG ((EFI_D_INFO, "SmmControlDriverEntryInit() End\n"));
+
+ return Status;
+}
+
+/**
+ Trigger the software SMI
+
+ @param[in] Data The value to be set on the software SMI data port
+
+ @retval EFI_SUCCESS Function completes successfully
+**/
+EFI_STATUS
+EFIAPI
+SmmTrigger (
+ IN UINT8 Data
+ )
+{
+ UINT32 OutputData;
+ UINT32 OutputPort;
+
+ ///
+ /// Enable the APMC SMI
+ ///
+ OutputPort = mPmBase + R_PCH_SMI_EN;
+ OutputData = IoRead32 ((UINTN) OutputPort);
+ OutputData |= (B_PCH_SMI_EN_APMC | B_PCH_SMI_EN_GBL_SMI);
+ DEBUG (
+ (EFI_D_VERBOSE,
+ "The SMI Control Port at address %x will be written to %x.\n",
+ OutputPort,
+ OutputData)
+ );
+ IoWrite32 (
+ (UINTN) OutputPort,
+ (UINT32) (OutputData)
+ );
+
+ OutputPort = R_PCH_APM_CNT;
+ OutputData = Data;
+
+ ///
+ /// Generate the APMC SMI
+ ///
+ IoWrite8 (
+ (UINTN) OutputPort,
+ (UINT8) (OutputData)
+ );
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Clear the SMI status
+
+ @param[in] None
+
+ @retval EFI_SUCCESS The function completes successfully
+ @retval EFI_DEVICE_ERROR Something error occurred
+**/
+EFI_STATUS
+EFIAPI
+SmmClear (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ UINT32 OutputData;
+ UINT32 OutputPort;
+
+ Status = EFI_SUCCESS;
+
+ ///
+ /// Clear the Power Button Override Status Bit, it gates EOS from being set.
+ ///
+ OutputPort = mPmBase + R_PCH_ACPI_PM1_STS;
+ OutputData = B_PCH_ACPI_PM1_STS_PRBTNOR;
+ DEBUG (
+ (EFI_D_VERBOSE,
+ "The PM1 Status Port at address %x will be written to %x.\n",
+ OutputPort,
+ OutputData)
+ );
+ IoWrite16 (
+ (UINTN) OutputPort,
+ (UINT16) (OutputData)
+ );
+
+ ///
+ /// Clear the APM SMI Status Bit
+ ///
+ OutputPort = mPmBase + R_PCH_SMI_STS;
+ OutputData = B_PCH_SMI_STS_APM;
+ DEBUG (
+ (EFI_D_VERBOSE,
+ "The SMI Status Port at address %x will be written to %x.\n",
+ OutputPort,
+ OutputData)
+ );
+ IoWrite32 (
+ (UINTN) OutputPort,
+ (UINT32) (OutputData)
+ );
+
+ ///
+ /// Set the EOS Bit
+ ///
+ OutputPort = mPmBase + R_PCH_SMI_EN;
+ OutputData = IoRead32 ((UINTN) OutputPort);
+ OutputData |= B_PCH_SMI_EN_EOS;
+ DEBUG (
+ (EFI_D_VERBOSE,
+ "The SMI Control Port at address %x will be written to %x.\n",
+ OutputPort,
+ OutputData)
+ );
+ IoWrite32 (
+ (UINTN) OutputPort,
+ (UINT32) (OutputData)
+ );
+
+ ///
+ /// There is no need to read EOS back and check if it is set.
+ /// This can lead to a reading of zero if an SMI occurs right after the SMI_EN port read
+ /// but before the data is returned to the CPU.
+ /// SMM Dispatcher should make sure that EOS is set after all SMI sources are processed.
+ ///
+ return Status;
+}
+
+/**
+ This routine generates an SMI
+
+ @param[in] This The EFI SMM Control protocol instance
+ @param[in, out] ArgumentBuffer The buffer of argument
+ @param[in, out] ArgumentBufferSize The size of the argument buffer
+ @param[in] Periodic Periodic or not
+ @param[in] ActivationInterval Interval of periodic SMI
+
+ @retval EFI Status Describing the result of the operation
+ @retval EFI_INVALID_PARAMETER Some parameter value passed is not supported
+**/
+EFI_STATUS
+EFIAPI
+Activate (
+ IN EFI_SMM_CONTROL_PROTOCOL * This,
+ IN OUT INT8 *ArgumentBuffer OPTIONAL,
+ IN OUT UINTN *ArgumentBufferSize OPTIONAL,
+ IN BOOLEAN Periodic OPTIONAL,
+ IN UINTN ActivationInterval OPTIONAL
+ )
+{
+ EFI_STATUS Status;
+ UINT8 Data;
+
+ if (Periodic) {
+ DEBUG ((EFI_D_WARN, "Invalid parameter\n"));
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (ArgumentBuffer == NULL) {
+ Data = 0xFF;
+ } else {
+ if (ArgumentBufferSize == NULL || *ArgumentBufferSize != 1) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Data = *ArgumentBuffer;
+ }
+ ///
+ /// Clear any pending the APM SMI
+ ///
+ Status = SmmClear ();
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ return SmmTrigger (Data);
+}
+
+/**
+ This routine clears an SMI
+
+ @param[in] This The EFI SMM Control protocol instance
+ @param[in] Periodic Periodic or not
+
+ @retval EFI Status Describing the result of the operation
+ @retval EFI_INVALID_PARAMETER Some parameter value passed is not supported
+**/
+EFI_STATUS
+EFIAPI
+Deactivate (
+ IN EFI_SMM_CONTROL_PROTOCOL *This,
+ IN BOOLEAN Periodic OPTIONAL
+ )
+{
+ if (Periodic) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ return SmmClear ();
+}
+
+/**
+ This routine gets SMM control register information
+
+ @param[in] This The SMM Control protocol instance
+ @param[in, out] SmiRegister Output parameter: the SMI control register information is returned
+
+ @retval EFI_INVALID_PARAMETER Parameter SmiRegister is NULL
+ @retval EFI_SUCCESS Function completes successfully
+**/
+EFI_STATUS
+EFIAPI
+GetRegisterInfo (
+ IN EFI_SMM_CONTROL_PROTOCOL *This,
+ IN OUT EFI_SMM_CONTROL_REGISTER *SmiRegister
+ )
+{
+ if (SmiRegister == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ SmiRegister->SmiTriggerRegister = R_PCH_APM_CNT;
+ SmiRegister->SmiDataRegister = R_PCH_APM_STS;
+ return EFI_SUCCESS;
+}
+
+/**
+ Disable all pending SMIs
+
+ @param[in] None
+
+ @retval None
+**/
+VOID
+EFIAPI
+DisablePendingSmis (
+ VOID
+ )
+{
+ UINT32 Data;
+ UINT32 Port;
+ BOOLEAN SciEn;
+ PCH_SERIES PchSeries;
+
+ ///
+ /// Determine whether an ACPI OS is present (via the SCI_EN bit)
+ ///
+ Port = mPmBase + R_PCH_ACPI_PM1_CNT;
+ Data = IoRead16 ((UINTN) Port);
+ SciEn = (BOOLEAN) ((Data & B_PCH_ACPI_PM1_CNT_SCI_EN) == B_PCH_ACPI_PM1_CNT_SCI_EN);
+ PchSeries = GetPchSeries();
+
+ if (!SciEn) {
+ ///
+ /// Clear any SMIs that double as SCIs (when SCI_EN==0)
+ ///
+ Port = mPmBase + R_PCH_ACPI_PM1_STS;
+ Data = 0xFFFF;
+ IoWrite16 ((UINTN) Port, (UINT16) (Data));
+
+ Port = mPmBase + R_PCH_ACPI_PM1_EN;
+ Data = 0x0000;
+ IoWrite16 ((UINTN) Port, (UINT16) (Data));
+
+ Port = mPmBase + R_PCH_ACPI_PM1_CNT;
+ Data = 0x0000;
+ IoWrite16 ((UINTN) Port, (UINT16) (Data));
+
+ if (PchSeries == PchLp) {
+ Port = mPmBase + R_PCH_ACPI_GPE0_STS_127_96;
+ Data = 0xFFFBFFFF;
+ } else if (PchSeries == PchH) {
+ Port = mPmBase + R_PCH_ACPI_GPE0a_STS;
+ Data = 0xFFFFFFFF;
+ }
+ IoWrite32 ((UINTN) Port, (UINT32) (Data));
+
+ if (PchSeries == PchLp) {
+ Port = mPmBase + R_PCH_ACPI_GPE0_EN_127_96;
+ Data = 0x00040000;
+ } else if (PchSeries == PchH) {
+ Port = mPmBase + R_PCH_ACPI_GPE0a_EN;
+ Data = 0x00000000;
+ }
+ IoWrite32 ((UINTN) Port, (UINT32) (Data));
+
+ if (PchSeries == PchH) {
+ Port = mPmBase + R_PCH_ACPI_GPE0b_STS;
+ Data = IoRead32 (Port);
+ Data |= 0x1F;
+ IoWrite32 ((UINTN) Port, (UINT32) (Data));
+
+ Port = mPmBase + R_PCH_ACPI_GPE0b_EN;
+ Data = IoRead32 (Port);
+ Data &= 0xFFFFFFE0;
+ IoWrite32 ((UINTN) Port, (UINT32) (Data));
+ }
+ }
+ ///
+ /// Clear and disable all SMIs that are unaffected by SCI_EN
+ ///
+ if (PchSeries == PchH) {
+ Port = mPmBase + R_PCH_LPTH_ALT_GP_SMI_EN;
+ Data = 0x0000;
+ IoWrite16 ((UINTN) Port, (UINT16) (Data));
+
+ Port = mPmBase + R_PCH_LPTH_ALT_GP_SMI_STS;
+ Data = 0xFFFF;
+ IoWrite16 ((UINTN) Port, (UINT16) (Data));
+ } else if (PchSeries == PchLp) {
+ Port = mGpioBase + R_PCH_LPTLP_ALT_GP_SMI_EN;
+ Data = IoRead32 ((UINTN) Port) & 0x0000;
+ IoWrite32 ((UINTN) Port, Data);
+
+ Port = mGpioBase + R_PCH_LPTLP_ALT_GP_SMI_STS;
+ Data = IoRead32 ((UINTN) Port) | 0xFFFF;
+ IoWrite32 ((UINTN) Port, Data);
+ }
+
+ Port = mPmBase + R_PCH_DEVACT_STS;
+ Data = 0xFFFF;
+ IoWrite32 ((UINTN) Port, (UINT32) (Data));
+
+ Port = mPmBase + R_PCH_SMI_STS;
+ Data = 0xFFFFFFFF;
+ IoWrite32 ((UINTN) Port, (UINT32) (Data));
+
+ ///
+ /// (Make sure to write this register last -- EOS re-enables SMIs for the PCH)
+ ///
+ Port = mPmBase + R_PCH_SMI_EN;
+ Data = IoRead32 ((UINTN) Port);
+ ///
+ /// clear all bits except those tied to SCI_EN
+ ///
+ Data &= B_PCH_SMI_EN_BIOS_RLS;
+ ///
+ /// enable SMIs and specifically enable writes to APM_CNT.
+ ///
+ Data |= B_PCH_SMI_EN_GBL_SMI | B_PCH_SMI_EN_APMC;
+ ///
+ /// NOTE: Default value of EOS is set in PCH, it will be automatically cleared Once the PCH asserts SMI# low,
+ /// we don't need to do anything to clear it
+ ///
+ IoWrite32 ((UINTN) Port, (UINT32) (Data));
+
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/SmmControl/RuntimeDxe/SmmControlDriver.h b/ReferenceCode/Chipset/LynxPoint/SmmControl/RuntimeDxe/SmmControlDriver.h
new file mode 100644
index 0000000..79effdb
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/SmmControl/RuntimeDxe/SmmControlDriver.h
@@ -0,0 +1,164 @@
+/** @file
+ Header file for SMM Control Driver.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _SMM_CONTROL_DRIVER_H_
+#define _SMM_CONTROL_DRIVER_H_
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+
+#include "EdkIIGlueDxe.h"
+#include "Pci22.h"
+
+//
+// Driver private data
+//
+#include EFI_PROTOCOL_DEFINITION (SmmControl)
+#include "PchAccess.h"
+#include "PchPlatformLib.h"
+#endif
+
+#define SMM_CONTROL_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('i', '4', 's', 'c')
+
+typedef struct {
+ UINTN Signature;
+ EFI_HANDLE Handle;
+ EFI_SMM_CONTROL_PROTOCOL SmmControl;
+} SMM_CONTROL_PRIVATE_DATA;
+
+#define SMM_CONTROL_PRIVATE_DATA_FROM_THIS(a) CR (a, SMM_CONTROL_PRIVATE_DATA, SmmControl, SMM_CONTROL_DEV_SIGNATURE)
+
+//
+// Prototypes
+//
+
+/**
+ This is the constructor for the SMM Control protocol
+
+ @param[in] ImageHandle Handle for the image of this driver
+ @param[in] SystemTable Pointer to the EFI System Table
+
+ @retval EFI_STATUS Results of the installation of the SMM Control Protocol
+**/
+EFI_STATUS
+EFIAPI
+SmmControlDriverEntryInit (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ );
+
+/**
+ Trigger the software SMI
+
+ @param[in] Data The value to be set on the software SMI data port
+
+ @retval EFI_SUCCESS Function completes successfully
+**/
+EFI_STATUS
+EFIAPI
+SmmTrigger (
+ UINT8 Data
+ );
+
+/**
+ Clear the SMI status
+
+ @param[in] None
+
+ @retval EFI_SUCCESS The function completes successfully
+ @retval EFI_DEVICE_ERROR Something error occurred
+**/
+EFI_STATUS
+EFIAPI
+SmmClear (
+ VOID
+ );
+
+/**
+ This routine generates an SMI
+
+ @param[in] This The EFI SMM Control protocol instance
+ @param[in, out] ArgumentBuffer The buffer of argument
+ @param[in, out] ArgumentBufferSize The size of the argument buffer
+ @param[in] Periodic Periodic or not
+ @param[in] ActivationInterval Interval of periodic SMI
+
+ @retval EFI Status Describing the result of the operation
+ @retval EFI_INVALID_PARAMETER Some parameter value passed is not supported
+**/
+EFI_STATUS
+EFIAPI
+Activate (
+ IN EFI_SMM_CONTROL_PROTOCOL * This,
+ IN OUT INT8 *ArgumentBuffer OPTIONAL,
+ IN OUT UINTN *ArgumentBufferSize OPTIONAL,
+ IN BOOLEAN Periodic OPTIONAL,
+ IN UINTN ActivationInterval OPTIONAL
+ );
+
+/**
+ This routine clears an SMI
+
+ @param[in] This The EFI SMM Control protocol instance
+ @param[in] Periodic Periodic or not
+
+ @retval EFI Status Describing the result of the operation
+ @retval EFI_INVALID_PARAMETER Some parameter value passed is not supported
+**/
+EFI_STATUS
+EFIAPI
+Deactivate (
+ IN EFI_SMM_CONTROL_PROTOCOL *This,
+ IN BOOLEAN Periodic OPTIONAL
+ );
+
+/**
+ This routine gets SMM control register information
+
+ @param[in] This The SMM Control protocol instance
+ @param[in, out] SmiRegister Output parameter: the SMI control register information is returned
+
+ @retval EFI_INVALID_PARAMETER Parameter SmiRegister is NULL
+ @retval EFI_SUCCESS Function completes successfully
+**/
+EFI_STATUS
+EFIAPI
+GetRegisterInfo (
+ IN EFI_SMM_CONTROL_PROTOCOL *This,
+ IN OUT EFI_SMM_CONTROL_REGISTER *SmiRegister
+ );
+
+/**
+ Disable all pending SMIs
+
+ @param[in] None
+
+ @retval None
+**/
+VOID
+EFIAPI
+DisablePendingSmis (
+ VOID
+ );
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Spi/Common/PchSpiCommonLib.cif b/ReferenceCode/Chipset/LynxPoint/Spi/Common/PchSpiCommonLib.cif
new file mode 100644
index 0000000..5b922d8
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Spi/Common/PchSpiCommonLib.cif
@@ -0,0 +1,11 @@
+<component>
+ name = "PchSpiCommonLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\Spi\Common"
+ RefName = "PchSpiCommonLib"
+[files]
+"PchSpiCommonLib.sdl"
+"PchSpiCommonLib.mak"
+"SpiCommon.c"
+"SpiCommon.h"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/Spi/Common/PchSpiCommonLib.mak b/ReferenceCode/Chipset/LynxPoint/Spi/Common/PchSpiCommonLib.mak
new file mode 100644
index 0000000..b781d72
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Spi/Common/PchSpiCommonLib.mak
@@ -0,0 +1,125 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSpiCommonLib/PchSpiCommonLib.mak 1 2/08/12 9:22a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 9:22a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSpiCommonLib/PchSpiCommonLib.mak $
+#
+# 1 2/08/12 9:22a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+all : PchSpiCommonLib
+
+PchSpiCommonLib : PchSpiCommonDxeLib PchSpiCommonSmmLib PchSpiCommonPeiLib
+
+$(PchSpiCommonSmmLib_LIB) : PchSpiCommonSmmLib
+$(PchSpiCommonDxeLib_LIB) : PchSpiCommonDxeLib
+$(PchSpiCommonPeiLib_LIB) : PchSpiCommonPeiLib
+
+PchSpiCommonSmmLib : $(BUILD_DIR)\PchSpiCommonLib.mak PchSpiCommonLibSmmBin
+
+PchSpiCommonDxeLib : $(BUILD_DIR)\PchSpiCommonLib.mak PchSpiCommonLibDxeBin
+
+PchSpiCommonPeiLib : $(BUILD_DIR)\PchSpiCommonLib.mak PchSpiCommonLibPeiBin
+
+$(BUILD_DIR)\PchSpiCommonLib.mak : $(PchSpiCommonLib_DIR)\$(@B).cif $(PchSpiCommonLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(PchSpiCommonLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+PchSpiCommonLib_INCLUDES=\
+ $(EDK_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+
+PchSpiCommonLibSmm_INCLUDES=\
+ $(PchSpiCommonLib_INCLUDES) $(PCH_SPI_INCLUDES)
+
+PchSpiCommonLibDxe_INCLUDES=\
+ $(PchSpiCommonLib_INCLUDES) $(PCH_SPI_INCLUDES)
+
+PchSpiCommonLibPeim_INCLUDES=\
+ $(PchSpiCommonLib_INCLUDES) $(PCH_SPI_INCLUDES)
+
+PchSpiCommonLib_DEFINES = \
+ $(CFLAGS)
+
+DxeCpuBuildDefine = \
+!IF "$(x64_BUILD)"=="1"
+ /DMDE_CPU_X64\
+!ELSE
+ /DMDE_CPU_IA32\
+!ENDIF
+
+PeimCpuBuildDefine = \
+ /DMDE_CPU_IA32\
+
+PchSpiCommonLibPeim_DEFINES = \
+ $(PchSpiCommonLib_DEFINES)\
+ $(PeimCpuBuildDefine)\
+
+PchSpiCommonLibDxe_DEFINES = \
+ $(PchSpiCommonLib_DEFINES)\
+ $(DxeCpuBuildDefine)\
+
+PchSpiCommonLibSmm_DEFINES = \
+ $(PchSpiCommonLibDxe_DEFINES)\
+
+PchSpiCommonLibDxeBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS) \
+ /f $(BUILD_DIR)\PchSpiCommonLib.mak all\
+ "MY_INCLUDES=$(PchSpiCommonLibDxe_INCLUDES)" \
+ "CFLAGS=$(PchSpiCommonLibDxe_DEFINES)"\
+ TYPE=LIBRARY \
+ LIBRARY_NAME=$(PchSpiCommonDxeLib_LIB)
+
+PchSpiCommonLibSmmBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS) \
+ /f $(BUILD_DIR)\PchSpiCommonLib.mak all\
+ "MY_INCLUDES=$(PchSpiCommonLibSmm_INCLUDES)" \
+ "CFLAGS=$(PchSpiCommonLibSmm_DEFINES)"\
+ TYPE=LIBRARY \
+ BUILD_DIR=$(BUILD_DIR)\Smm\
+ LIBRARY_NAME=$(PchSpiCommonSmmLib_LIB)
+
+PchSpiCommonLibPeiBin :
+!IF "$(x64_BUILD)"=="1"
+ $(MAKE) /$(MAKEFLAGS) $(EDK_DEFAULTS) BUILD_DIR=$(BUILD_DIR)\IA32 \
+!ELSE
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS) \
+!ENDIF
+ /f $(BUILD_DIR)\PchSpiCommonLib.mak all\
+ "MY_INCLUDES=$(PchSpiCommonLibPeim_INCLUDES)" \
+ "CFLAGS=$(PchSpiCommonLibPeim_DEFINES)"\
+ TYPE=PEI_LIBRARY \
+ LIBRARY_NAME=$(PchSpiCommonPeiLib_LIB)
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Spi/Common/PchSpiCommonLib.sdl b/ReferenceCode/Chipset/LynxPoint/Spi/Common/PchSpiCommonLib.sdl
new file mode 100644
index 0000000..33582be
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Spi/Common/PchSpiCommonLib.sdl
@@ -0,0 +1,92 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSpiCommonLib/PchSpiCommonLib.sdl 1 2/08/12 9:22a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 9:22a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSpiCommonLib/PchSpiCommonLib.sdl $
+#
+# 1 2/08/12 9:22a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+TOKEN
+ Name = "PchSpiCommonLib_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable PchSpiCommonLib support in Project"
+ TokenType = Boolean
+ TargetMAK = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "PchSpiCommonLib_DIR"
+End
+
+MODULE
+ Help = "Includes PchSpiCommonLib.mak to Project"
+ File = "PchSpiCommonLib.mak"
+End
+
+ELINK
+ Name = "PchSpiCommonDxeLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PchSpiCommonDxeLib.lib"
+ Parent = "PchSpiCommonDxeLib_LIB"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "PchSpiCommonPeiLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PchSpiCommonPeiLib.lib"
+ Parent = "PchSpiCommonPeiLib_LIB"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "PchSpiCommonSmmLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PchSpiCommonSmmLib.lib"
+ Parent = "PchSpiCommonSmmLib_LIB"
+ InvokeOrder = AfterParent
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Spi/Common/SpiCommon.c b/ReferenceCode/Chipset/LynxPoint/Spi/Common/SpiCommon.c
new file mode 100644
index 0000000..2797bd9
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Spi/Common/SpiCommon.c
@@ -0,0 +1,1425 @@
+/** @file
+ PCH SPI Common Driver implements the SPI Host Controller Compatibility Interface.
+
+@copyright
+ Copyright (c) 2008 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "PchSpi.h"
+
+/**
+ Initialize an SPI protocol instance.
+ The function will assert in debug if PCH RCBA has not been initialized
+
+ @param[in] SpiInstance Pointer to SpiInstance to initialize
+
+ @retval EFI_SUCCESS The protocol instance was properly initialized
+ @exception EFI_UNSUPPORTED The PCH is not supported by this module
+**/
+EFI_STATUS
+SpiProtocolConstructor (
+ SPI_INSTANCE *SpiInstance
+ )
+{
+ ///
+ /// Check if the current PCH is known and supported by this code
+ ///
+ if (!IsPchSupported ()) {
+ DEBUG ((EFI_D_ERROR, "PCH SPI Protocol not supported due to no proper PCH LPC found!\n"));
+ return EFI_UNSUPPORTED;
+ }
+ ///
+ /// Initialize the SPI protocol instance
+ ///
+ SpiInstance->Signature = PCH_SPI_PRIVATE_DATA_SIGNATURE;
+ SpiInstance->Handle = NULL;
+ SpiInstance->SpiProtocol.ReadId = SpiProtocolReadId;
+ SpiInstance->SpiProtocol.Init = SpiProtocolInit;
+ SpiInstance->SpiProtocol.Execute = SpiProtocolExecute;
+
+ ///
+ /// Sanity check to ensure PCH RCBA initialization has occurred previously.
+ ///
+ SpiInstance->PchRootComplexBar = PCH_RCRB_BASE;
+ ASSERT (SpiInstance->PchRootComplexBar != 0);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ JEDEC Read IDs from SPI flash part, this function will return 1-byte Vendor ID and 2-byte Device ID
+
+ @param[in] This Pointer to the EFI_SPI_PROTOCOL instance.
+ @param[in] Address This value is for determines the command is sent to SPI Component 1 or 2
+ @param[in, out] Buffer Pointer to caller-allocated buffer containing the dada received or sent during the SPI cycle.
+
+ @retval EFI_SUCCESS Read Jedec Id completed.
+ @retval EFI_DEVICE_ERROR Device error, operation failed.
+ @exception EFI_UNSUPPORTED This function is unsupport after SpiProtocolInit is called
+**/
+EFI_STATUS
+EFIAPI
+SpiProtocolReadId (
+ IN EFI_SPI_PROTOCOL *This,
+ IN UINTN Address,
+ IN OUT UINT8 *Buffer
+ )
+{
+ EFI_STATUS Status;
+ SPI_INSTANCE *SpiInstance;
+ UINTN PchRootComplexBar;
+ UINT16 OpcodeType;
+ UINT8 Code;
+
+ SpiInstance = SPI_INSTANCE_FROM_SPIPROTOCOL (This);
+ if (SpiInstance->SpiIdTable[0].VendorId != 0) {
+ DEBUG ((EFI_D_ERROR, "This function is unsupport after SpiProtocolInit is called, please use SpiProtocolExecute to get Jedec ID!\n"));
+ return EFI_UNSUPPORTED;
+ }
+
+ PchRootComplexBar = SpiInstance->PchRootComplexBar;
+ SpiInstance->SpiInitTable.SpiCmdConfig[0].Operation = EnumSpiOperationJedecId;
+ SpiInstance->SpiInitTable.SpiCmdConfig[0].Frequency = EnumSpiCycle50MHz;
+ OpcodeType = (UINT16) (V_PCH_SPI_OPTYPE_RDNOADDR);
+ Code = PCH_SPI_COMMAND_READ_ID;
+
+ ///
+ /// Set Opcode Menu Configuration registers.
+ /// Need to be done before sending any SPI command
+ ///
+ MmioWrite8 (PchRootComplexBar + R_PCH_SPI_OPMENU, Code);
+ MmioRead8 (PchRootComplexBar + R_PCH_SPI_OPMENU);
+ ///
+ /// Set Opcode Type Configuration registers.
+ ///
+ MmioWrite16 (PchRootComplexBar + R_PCH_SPI_OPTYPE, OpcodeType);
+ MmioRead16 (PchRootComplexBar + R_PCH_SPI_OPTYPE);
+
+ Status = SpiProtocolExecute (
+ This,
+ 0,
+ 0,
+ TRUE,
+ TRUE,
+ FALSE,
+ Address,
+ 3,
+ Buffer,
+ EnumSpiRegionAll
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Get Descriptor values from the Descriptor Region.
+
+ @param[in] This A pointer to "EFI_SPI_PROTOCOL" for issuing commands
+
+ @retval None
+**/
+VOID
+EFIAPI
+GetDescriptorValues (
+ IN EFI_SPI_PROTOCOL *This
+ )
+{
+ SPI_INSTANCE *SpiInstance;
+ UINTN PchRootComplexBar;
+
+ SpiInstance = SPI_INSTANCE_FROM_SPIPROTOCOL (This);
+ PchRootComplexBar = SpiInstance->PchRootComplexBar;
+
+ ///
+ /// Select to Flash Map 0 Register to get the number of flash Component
+ ///
+ MmioAndThenOr32 (
+ PchRootComplexBar + R_PCH_SPI_FDOC,
+ (UINT32) (~(B_PCH_SPI_FDOC_FDSS_MASK | B_PCH_SPI_FDOC_FDSI_MASK)),
+ (UINT32) (V_PCH_SPI_FDOC_FDSS_FSDM | R_PCH_SPI_FDBAR_FLASH_MAP0)
+ );
+
+ ///
+ /// Copy Zero based Number Of Components
+ ///
+ SpiInstance->SpiDescriptor.NumberComponents = (UINT8) ((MmioRead16 (PchRootComplexBar + R_PCH_SPI_FDOD) & B_PCH_SPI_FDBAR_NC) >> N_PCH_SPI_FDBAR_NC);
+
+ ///
+ /// Select to Flash Components Register to get the Component 1 Density
+ ///
+ MmioAndThenOr32 (
+ PchRootComplexBar + R_PCH_SPI_FDOC,
+ (UINT32) (~(B_PCH_SPI_FDOC_FDSS_MASK | B_PCH_SPI_FDOC_FDSI_MASK)),
+ (UINT32) (V_PCH_SPI_FDOC_FDSS_COMP | R_PCH_SPI_FCBA_FLCOMP)
+ );
+
+ ///
+ /// Copy Component 1 Density
+ ///
+ SpiInstance->SpiDescriptor.Comp1Density = (UINT8) MmioRead32 (PchRootComplexBar + R_PCH_SPI_FDOD) & B_PCH_SPI_FLCOMP_COMP1_MASK;
+}
+
+/**
+ Get VSCC values from the Descriptor Region (VSCC Table).
+
+ @param[in] This A pointer to "EFI_SPI_PROTOCOL" for issuing commands
+ @param[in] ReadDataCmdOpcodeIndex The index of the opcode - "PCH_SPI_COMMAND_READ_DATA"
+ @param[in, out] Vscc0Value VSCC0 (Vendor Specific Component Capabilities) Value
+ @param[in, out] Vscc1Value VSCC1 (Vendor Specific Component Capabilities) Value
+
+ @retval EFI_SUCCESS Found the VSCC values on Descriptor Region
+ @retval EFI_NOT_FOUND Couldn't find the VSCC values on Descriptor Region
+ @exception EFI_UNSUPPORTED ReadDataCmdOpcodeIndex is out of range
+**/
+EFI_STATUS
+EFIAPI
+GetDescriptorVsccValues (
+ IN EFI_SPI_PROTOCOL *This,
+ IN UINT8 ReadDataCmdOpcodeIndex,
+ IN OUT UINT32 *Vscc0Value,
+ IN OUT UINT32 *Vscc1Value
+ )
+{
+ UINT32 SpiDescFlashUpperMap1;
+ UINT32 VsccTableBaseAddr;
+ UINT32 VsccTableLength;
+ UINT32 JedecIdRegIndex;
+ EFI_STATUS Status;
+ UINT32 FlashDescriptor;
+ SPI_INSTANCE *SpiInstance;
+ BOOLEAN MatchedVtbEntryFound;
+ UINT8 SpiIndex;
+ UINT32 Data32;
+ Data32 = 0;
+
+ if (ReadDataCmdOpcodeIndex >= SPI_NUM_OPCODE) {
+ return EFI_UNSUPPORTED;
+ }
+
+ SpiInstance = SPI_INSTANCE_FROM_SPIPROTOCOL (This);
+
+ Status = SpiProtocolExecute (
+ This,
+ ReadDataCmdOpcodeIndex,
+ 0,
+ TRUE,
+ TRUE,
+ FALSE,
+ (UINTN) R_PCH_SPI_FLASH_UMAP1,
+ sizeof (SpiDescFlashUpperMap1),
+ (UINT8 *) &SpiDescFlashUpperMap1,
+ EnumSpiRegionDescriptor
+ );
+ if ((EFI_ERROR (Status)) || (SpiDescFlashUpperMap1 == 0xFFFFFFFF)) {
+ return EFI_NOT_FOUND;
+ }
+ ///
+ /// B_PCH_SPI_FLASH_UMAP1_VTBA represents address bits [11:4]
+ ///
+ VsccTableBaseAddr = ((SpiDescFlashUpperMap1 & B_PCH_SPI_FLASH_UMAP1_VTBA) << 4);
+ ///
+ /// Multiplied by 4? B_PCH_SPI_FDBAR_VTL is the 1-based number of DWORDs.
+ ///
+ VsccTableLength = (((SpiDescFlashUpperMap1 & B_PCH_SPI_FLASH_UMAP1_VTL) >> 8) << 2);
+ if (VsccTableLength < SIZE_OF_SPI_VTBA_ENTRY) {
+ ///
+ /// Non-existent or invalid Vscc Table
+ ///
+ return EFI_NOT_FOUND;
+ }
+
+ for (SpiIndex = 0; SpiIndex <= SpiInstance->SpiDescriptor.NumberComponents; SpiIndex++) {
+ JedecIdRegIndex = 0;
+ MatchedVtbEntryFound = FALSE;
+ while (JedecIdRegIndex <= (VsccTableLength - SIZE_OF_SPI_VTBA_ENTRY)) {
+ Status = SpiProtocolExecute (
+ This,
+ ReadDataCmdOpcodeIndex,
+ 0,
+ TRUE,
+ TRUE,
+ FALSE,
+ (UINTN) (VsccTableBaseAddr + JedecIdRegIndex),
+ sizeof (UINT32),
+ (UINT8 *) &FlashDescriptor,
+ EnumSpiRegionDescriptor
+ );
+
+ if ((EFI_ERROR (Status)) || (FlashDescriptor == 0xFFFFFFFF)) {
+ break;
+ }
+
+ if (((FlashDescriptor & B_PCH_SPI_VTBA_JID0_VID) != SpiInstance->SpiIdTable[SpiIndex].VendorId) ||
+ (((FlashDescriptor & B_PCH_SPI_VTBA_JID0_DID0) >> N_PCH_SPI_VTBA_JID0_DID0)
+ != SpiInstance->SpiIdTable[SpiIndex].DeviceId0) ||
+ (((FlashDescriptor & B_PCH_SPI_VTBA_JID0_DID1) >> N_PCH_SPI_VTBA_JID0_DID1)
+ != SpiInstance->SpiIdTable[SpiIndex].DeviceId1)) {
+ JedecIdRegIndex += SIZE_OF_SPI_VTBA_ENTRY;
+ } else {
+ MatchedVtbEntryFound = TRUE;
+ break;
+ }
+ }
+
+ if (!MatchedVtbEntryFound) {
+ return EFI_NOT_FOUND;
+ }
+
+ Status = SpiProtocolExecute (
+ This,
+ ReadDataCmdOpcodeIndex,
+ 0,
+ TRUE,
+ TRUE,
+ FALSE,
+ (UINTN) (VsccTableBaseAddr + JedecIdRegIndex + R_PCH_SPI_VTBA_VSCC0),
+ sizeof (UINT32),
+ (UINT8 *) &Data32,
+ EnumSpiRegionDescriptor
+ );
+ if ((EFI_ERROR (Status)) || (Data32 == 0xFFFFFFFF)) {
+ return EFI_NOT_FOUND;
+ }
+ ///
+ /// Copy correct VSCCn value
+ ///
+ if (SpiIndex == 0) {
+ *Vscc0Value = Data32;
+ } else {
+ *Vscc1Value = Data32;
+ return EFI_SUCCESS;
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Discover if the flash parts supports 4KB Block/Sector erase size.
+
+ @param[in] This A pointer to "EFI_SPI_PROTOCOL" for issuing commands
+
+ @retval EFI_SUCCESS The flash part supports 4KB erase size.
+ @exception EFI_UNSUPPORTED The flash part does not support 4KB erase size.
+**/
+EFI_STATUS
+EFIAPI
+SpiDiscoveryParameters (
+ IN EFI_SPI_PROTOCOL *This
+ )
+{
+ UINT16 ParameterTableIndex;
+ UINT32 Data32;
+ SPI_INSTANCE *SpiInstance;
+ UINT8 SpiIndex;
+ UINTN PchRootComplexBar;
+
+ SpiInstance = SPI_INSTANCE_FROM_SPIPROTOCOL (This);
+ PchRootComplexBar = SpiInstance->PchRootComplexBar;
+
+ ///
+ /// Check if valid SFDP table is present for SPI0
+ ///
+ Data32 = MmioRead32 ((UINTN) (PchRootComplexBar + R_PCH_SPI_VSCC0)) & B_PCH_SPI_VSCC0_CPPTV;
+ if (Data32 == 0) {
+ return EFI_UNSUPPORTED;
+ }
+
+ SpiInstance = SPI_INSTANCE_FROM_SPIPROTOCOL (This);
+
+ ///
+ /// Check if valid SFDP table is present for SPI1
+ ///
+ if (SpiInstance->SpiDescriptor.NumberComponents) {
+ Data32 = MmioRead32 ((UINTN) (PchRootComplexBar + R_PCH_SPI_VSCC1)) & B_PCH_SPI_VSCC1_CPPTV;
+ if (Data32 == 0) {
+ ///
+ /// Program VSCCn values from Flash Descriptor or internal BIOS table
+ /// if both parts do not support SFDP
+ ///
+ return EFI_UNSUPPORTED;
+ }
+ }
+
+ for (SpiIndex = 0; SpiIndex <= SpiInstance->SpiDescriptor.NumberComponents; SpiIndex++) {
+ ///
+ /// Read Block/Sector Erase Size in 1st dword in the Flash Parameter Table.
+ ///
+ ParameterTableIndex = (SpiIndex << N_PCH_SPI_PINTX_SPT) | (V_PCH_SPI_PINTX_HORD_DATA << N_PCH_SPI_PINTX_HORD);
+ MmioWrite32 (PchRootComplexBar + R_PCH_SPI_PINTX, ParameterTableIndex);
+ Data32 = MmioRead32 (PchRootComplexBar + R_PCH_SPI_PTDATA) & B_PCH_SPI_VSCC0_BSES_MASK;
+
+ ///
+ /// Program VSCCn.EO from Flash Descriptor or internal BIOS table
+ /// if erase size other than 4KB.
+ ///
+ if (Data32 != V_PCH_SPI_VSCC0_BSES_4K) {
+ return EFI_UNSUPPORTED;
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Initialize the host controller to execute SPI command.
+
+ @param[in] This Pointer to the EFI_SPI_PROTOCOL instance.
+ @param[in] InitData Initialization data to be programmed into the SPI host controller.
+
+ @retval EFI_SUCCESS Initialization completed.
+ @retval EFI_ACCESS_DENIED The SPI static configuration interface has been locked-down.
+ @retval EFI_INVALID_PARAMETER Bad input parameters.
+ @exception EFI_UNSUPPORTED Can't get Descriptor mode VSCC values
+**/
+EFI_STATUS
+EFIAPI
+SpiProtocolInit (
+ IN EFI_SPI_PROTOCOL *This,
+ IN SPI_INIT_DATA *InitData
+ )
+{
+ EFI_STATUS Status;
+ UINT8 Index;
+ UINT16 OpcodeType;
+ SPI_INSTANCE *SpiInstance;
+ SPI_SPECIAL_OPCODE_ENTRY *SpecialOpcodeEntry;
+ UINT32 Vscc0Value;
+ UINT32 Vscc1Value;
+ UINTN PchRootComplexBar;
+ UINT8 UnlockCmdOpcodeIndex;
+ UINT8 ReadDataCmdOpcodeIndex;
+ UINT8 JedecIdCmdOpcodeIndex;
+ UINT8 Code;
+ UINT8 FlashPartId[3];
+ UINT32 Data32;
+
+ SpiInstance = SPI_INSTANCE_FROM_SPIPROTOCOL (This);
+ PchRootComplexBar = SpiInstance->PchRootComplexBar;
+ Vscc0Value = 0;
+ Vscc1Value = 0;
+
+ if (InitData == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+ ///
+ /// Check if the SPI interface has been locked-down.
+ ///
+ if ((MmioRead16 (PchRootComplexBar + R_PCH_SPI_HSFS) & B_PCH_SPI_HSFS_FLOCKDN) != 0) {
+ ASSERT_EFI_ERROR (EFI_ACCESS_DENIED);
+ return EFI_ACCESS_DENIED;
+ }
+ ///
+ /// Copy Flash Descriptor Values into SPI driver Private data structure
+ ///
+ SpiInstance->DescriptorMode = PchIsSpiDescriptorMode (PchRootComplexBar);
+ if (SpiInstance->DescriptorMode == TRUE) {
+ GetDescriptorValues (This);
+ }
+ ///
+ /// Clear all the status bits for hardware regs.
+ ///
+ MmioOr16 (
+ (UINTN) (PchRootComplexBar + R_PCH_SPI_HSFS),
+ (UINT16) ((B_PCH_SPI_HSFS_AEL | B_PCH_SPI_HSFS_FCERR | B_PCH_SPI_HSFS_FDONE))
+ );
+ MmioRead16 (PchRootComplexBar + R_PCH_SPI_HSFS);
+
+ ///
+ /// Clear all the status bits for software regs.
+ ///
+ MmioOr8 (
+ (UINTN) (PchRootComplexBar + R_PCH_SPI_SSFS),
+ (UINT8) ((B_PCH_SPI_SSFS_FCERR | B_PCH_SPI_SSFS_CDS))
+ );
+ MmioRead8 (PchRootComplexBar + R_PCH_SPI_SSFS);
+
+ ReadDataCmdOpcodeIndex = SPI_NUM_OPCODE;
+ UnlockCmdOpcodeIndex = SPI_NUM_OPCODE;
+ JedecIdCmdOpcodeIndex = SPI_NUM_OPCODE;
+ ///
+ /// Set Opcode Type Configuration registers.
+ /// Need to be done before sending any SPI command
+ ///
+ for (Index = 0, OpcodeType = 0; Index < SPI_NUM_OPCODE; Index++) {
+ ///
+ /// Copy Operation and Frequency into SPI driver Private data structure
+ ///
+ SpiInstance->SpiInitTable.SpiCmdConfig[Index].Operation = InitData->SpiCmdConfig[Index].Operation;
+ SpiInstance->SpiInitTable.SpiCmdConfig[Index].Frequency = InitData->SpiCmdConfig[Index].Frequency;
+
+ switch (SpiInstance->SpiInitTable.SpiCmdConfig[Index].Operation) {
+ case EnumSpiOperationReadData:
+ OpcodeType |= (UINT16) (V_PCH_SPI_OPTYPE_RDADDR << (Index * 2));
+ Code = PCH_SPI_COMMAND_READ_DATA;
+ ReadDataCmdOpcodeIndex = Index;
+ break;
+
+ case EnumSpiOperationFastRead:
+ OpcodeType |= (UINT16) (V_PCH_SPI_OPTYPE_RDADDR << (Index * 2));
+ Code = PCH_SPI_COMMAND_FAST_READ;
+ ReadDataCmdOpcodeIndex = Index;
+ break;
+
+ case EnumSpiOperationDualOutputFastRead:
+ OpcodeType |= (UINT16) (V_PCH_SPI_OPTYPE_RDADDR << (Index * 2));
+ Code = PCH_SPI_COMMAND_DUAL_FAST_READ;
+ ReadDataCmdOpcodeIndex = Index;
+ break;
+
+ case EnumSpiOperationDiscoveryParameters:
+ OpcodeType |= (UINT16) (V_PCH_SPI_OPTYPE_RDADDR << (Index * 2));
+ Code = PCH_SPI_COMMAND_DISCOVERY_PARAMETERS;
+ break;
+
+ case EnumSpiOperationProgramData_1_Byte:
+ case EnumSpiOperationProgramData_64_Byte:
+ OpcodeType |= (UINT16) (V_PCH_SPI_OPTYPE_WRADDR << (Index * 2));
+ Code = PCH_SPI_COMMAND_PROGRAM_BYTE;
+ break;
+
+ case EnumSpiOperationErase_256_Byte:
+ OpcodeType |= (UINT16) (V_PCH_SPI_OPTYPE_WRADDR << (Index * 2));
+ Code = PCH_SPI_COMMAND_256B_ERASE;
+ break;
+
+ case EnumSpiOperationErase_4K_Byte:
+ OpcodeType |= (UINT16) (V_PCH_SPI_OPTYPE_WRADDR << (Index * 2));
+ Code = PCH_SPI_COMMAND_4KB_ERASE;
+ break;
+
+ case EnumSpiOperationErase_64K_Byte:
+ OpcodeType |= (UINT16) (V_PCH_SPI_OPTYPE_WRADDR << (Index * 2));
+ Code = PCH_SPI_COMMAND_64KB_ERASE;
+ break;
+
+ case EnumSpiOperationWriteStatus:
+ OpcodeType |= (UINT16) (V_PCH_SPI_OPTYPE_WRNOADDR << (Index * 2));
+ Code = PCH_SPI_COMMAND_WRITE_STATUS;
+ UnlockCmdOpcodeIndex = Index;
+ break;
+
+ case EnumSpiOperationWriteDisable:
+ OpcodeType |= (UINT16) (V_PCH_SPI_OPTYPE_WRNOADDR << (Index * 2));
+ Code = PCH_SPI_COMMAND_WRITE_DISABLE;
+ break;
+
+ case EnumSpiOperationWriteEnable:
+ OpcodeType |= (UINT16) (V_PCH_SPI_OPTYPE_WRNOADDR << (Index * 2));
+ Code = PCH_SPI_COMMAND_WRITE_ENABLE;
+ break;
+
+ case EnumSpiOperationEnableWriteStatus:
+ OpcodeType |= (UINT16) (V_PCH_SPI_OPTYPE_WRNOADDR << (Index * 2));
+ Code = PCH_SPI_COMMAND_ENABLE_WRITE_STATUS;
+ break;
+
+ case EnumSpiOperationFullChipErase:
+ OpcodeType |= (UINT16) (V_PCH_SPI_OPTYPE_WRNOADDR << (Index * 2));
+ Code = PCH_SPI_COMMAND_FULL_CHIP_ERASE;
+ break;
+
+ case EnumSpiOperationReadStatus:
+ OpcodeType |= (UINT16) (V_PCH_SPI_OPTYPE_RDNOADDR << (Index * 2));
+ Code = PCH_SPI_COMMAND_READ_STATUS;
+ break;
+
+ case EnumSpiOperationJedecId:
+ OpcodeType |= (UINT16) (V_PCH_SPI_OPTYPE_RDNOADDR << (Index * 2));
+ Code = PCH_SPI_COMMAND_READ_ID;
+ JedecIdCmdOpcodeIndex = Index;
+ break;
+
+ case EnumSpiOperationErase_8K_Byte:
+ case EnumSpiOperationOther:
+ Code = 0;
+ break;
+
+ default:
+ Code = 0;
+ ASSERT (FALSE);
+ break;
+ }
+ ///
+ /// Overrided Opcode Type and Menu Configuration registers per SpecialOpcodeEntry
+ ///
+ if (InitData->SpecialOpcodeEntry != NULL) {
+ SpecialOpcodeEntry = InitData->SpecialOpcodeEntry;
+
+ while (SpecialOpcodeEntry->OpcodeIndex != 0xFF) {
+ if (SpecialOpcodeEntry->OpcodeIndex == Index) {
+ OpcodeType &= (UINT16)~(B_PCH_SPI_OPTYPE0_MASK << (Index * 2));
+ OpcodeType |= (UINT16) (SpecialOpcodeEntry->Type << (Index * 2));
+ Code = SpecialOpcodeEntry->Code;
+ }
+
+ SpecialOpcodeEntry++;
+ }
+ }
+ ///
+ /// Set Opcode Menu Configuration registers.
+ /// Need to be done before sending any SPI command
+ ///
+ MmioWrite8 (
+ PchRootComplexBar + R_PCH_SPI_OPMENU + Index,
+ Code
+ );
+ MmioRead8 (PchRootComplexBar + R_PCH_SPI_OPMENU + Index);
+ }
+ ///
+ /// Set Opcode Type Configuration registers.
+ ///
+ MmioWrite16 (PchRootComplexBar + R_PCH_SPI_OPTYPE, OpcodeType);
+ MmioRead16 (PchRootComplexBar + R_PCH_SPI_OPTYPE);
+
+ if (JedecIdCmdOpcodeIndex >= SPI_NUM_OPCODE) {
+ return EFI_UNSUPPORTED;
+ } else {
+ ///
+ /// Read VendorId/DeviceId from SPI Component 1
+ ///
+ Status = SpiProtocolExecute (
+ This,
+ JedecIdCmdOpcodeIndex,
+ 0,
+ TRUE,
+ TRUE,
+ FALSE,
+ (UINTN) 0,
+ 3,
+ FlashPartId,
+ EnumSpiRegionDescriptor
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ ///
+ /// Copy VendorId, DeviceId0, DeviceId1 and BiosStartOffset into SPI
+ /// driver Private data structure
+ ///
+ SpiInstance->SpiIdTable[0].VendorId = FlashPartId[0];
+ SpiInstance->SpiIdTable[0].DeviceId0 = FlashPartId[1];
+ SpiInstance->SpiIdTable[0].DeviceId1 = FlashPartId[2];
+ SpiInstance->SpiInitTable.BiosStartOffset = InitData->BiosStartOffset;
+ if (SpiInstance->SpiDescriptor.NumberComponents == 0x01) {
+ ///
+ /// If SPI Descriptor indicates two SPI components then
+ /// read VendorId/DeviceId from SPI Component 2.
+ /// Calculate SPI Component 2 address. The secondary SPI's address is equal to the first SPI's size
+ /// Note: 512KB (BIT19) is the minimum Componenty Density.
+ ///
+ Data32 = (UINT32) (UINTN) (V_PCH_SPI_FLCOMP_COMP_512KB << SpiInstance->SpiDescriptor.Comp1Density);
+ Status = SpiProtocolExecute (
+ This,
+ JedecIdCmdOpcodeIndex,
+ 0,
+ TRUE,
+ TRUE,
+ FALSE,
+ (UINTN) Data32,
+ 3,
+ FlashPartId,
+ EnumSpiRegionAll
+ );
+ if (!EFI_ERROR (Status)) {
+ ///
+ /// Copy VendorId, DeviceId0, DeviceId1 into SPI
+ /// driver Private data structure
+ ///
+ SpiInstance->SpiIdTable[1].VendorId = FlashPartId[0];
+ SpiInstance->SpiIdTable[1].DeviceId0 = FlashPartId[1];
+ SpiInstance->SpiIdTable[1].DeviceId1 = FlashPartId[2];
+ }
+ }
+ ///
+ /// Set the Prefix Opcode registers.
+ ///
+ MmioWrite16 (
+ PchRootComplexBar + R_PCH_SPI_PREOP,
+ (InitData->PrefixOpcode[1] << 8) | InitData->PrefixOpcode[0]
+ );
+ MmioRead16 (PchRootComplexBar + R_PCH_SPI_PREOP);
+
+ ///
+ /// Copy PrefixOpcode into SPI driver Private data structure
+ ///
+ for (Index = 0; Index < SPI_NUM_PREFIX_OPCODE; Index++) {
+ SpiInstance->SpiInitTable.PrefixOpcode[Index] = InitData->PrefixOpcode[Index];
+ }
+ ///
+ /// Copy BiosSize into SPI driver Private data structure
+ ///
+ SpiInstance->SpiInitTable.BiosSize = InitData->BiosSize;
+ }
+ ///
+ /// Get VSCC values from VTBA table in the Descriptor.
+ ///
+ if (SpiInstance->DescriptorMode == TRUE) {
+ Status = GetDescriptorVsccValues (
+ This,
+ ReadDataCmdOpcodeIndex,
+ &Vscc0Value,
+ &Vscc1Value
+ );
+
+ if (EFI_ERROR (Status)) {
+ ///
+ /// Program the VSCC0 & VSCC1 registers by getting the data from SpiInitTable
+ ///
+ for (Index = 0; Index < SPI_NUM_OPCODE; Index++) {
+ ///
+ /// For every platform that supports ME, only 4 KB erase is supported
+ /// Get the opcode from SpiInitTable if the operation is 4 KB erase
+ ///
+ if (SpiInstance->SpiInitTable.SpiCmdConfig[Index].Operation == EnumSpiOperationErase_4K_Byte) {
+ Vscc0Value = Vscc0Value | (UINT32) (V_PCH_SPI_VSCC0_BSES_4K);
+ Vscc0Value = Vscc0Value | (UINT32) (PCH_SPI_COMMAND_4KB_ERASE << 8);
+ } else if (SpiInstance->SpiInitTable.SpiCmdConfig[Index].Operation == EnumSpiOperationProgramData_64_Byte) {
+ Vscc0Value = Vscc0Value | (UINT32) (B_PCH_SPI_VSCC0_WG_64B);
+ }
+ }
+ ///
+ /// Bit WSR and WEWS should NOT be both set to 1, so we check if there is any "Write enable on Write status" prefix opcode
+ /// from SpiInitTable at first, then check "Write Status Enable" prefix opcode
+ ///
+ if ((SpiInstance->SpiInitTable.PrefixOpcode[0] == PCH_SPI_COMMAND_WRITE_ENABLE) ||
+ (SpiInstance->SpiInitTable.PrefixOpcode[1] == PCH_SPI_COMMAND_WRITE_ENABLE)) {
+ Vscc0Value = Vscc0Value | (UINT32) (B_PCH_SPI_VSCC0_WEWS);
+ } else if ((SpiInstance->SpiInitTable.PrefixOpcode[0] == PCH_SPI_COMMAND_WRITE_STATUS_EN) ||
+ (SpiInstance->SpiInitTable.PrefixOpcode[1] == PCH_SPI_COMMAND_WRITE_STATUS_EN)) {
+ Vscc0Value = Vscc0Value | (UINT32) (B_PCH_SPI_VSCC0_WSR);
+ }
+
+ Vscc1Value = Vscc0Value;
+ }
+ ///
+ /// The VCL locks itself when set, it will assert because we have no way to update VSCC value
+ ///
+ if ((MmioRead32 ((UINTN) (PchRootComplexBar + R_PCH_SPI_VSCC0)) & B_PCH_SPI_VSCC0_VCL) != 0) {
+ ASSERT_EFI_ERROR (EFI_ACCESS_DENIED);
+ return EFI_ACCESS_DENIED;
+ }
+
+ ASSERT (Vscc0Value != 0);
+ MmioWrite32 ((UINTN) (PchRootComplexBar + R_PCH_SPI_VSCC0), Vscc0Value);
+ if (SpiInstance->SpiDescriptor.NumberComponents) {
+ MmioWrite32 ((UINTN) (PchRootComplexBar + R_PCH_SPI_VSCC1), Vscc1Value);
+ }
+ }
+
+ SpiPhaseInit ();
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Execute SPI commands from the host controller.
+ This function would be called by runtime driver, please do not use any MMIO marco here
+
+ @param[in] This Pointer to the EFI_SPI_PROTOCOL instance.
+ @param[in] OpcodeIndex Index of the command in the OpCode Menu.
+ @param[in] PrefixOpcodeIndex Index of the first command to run when in an atomic cycle sequence.
+ @param[in] DataCycle TRUE if the SPI cycle contains data
+ @param[in] Atomic TRUE if the SPI cycle is atomic and interleave cycles are not allowed.
+ @param[in] ShiftOut If DataByteCount is not zero, TRUE to shift data out and FALSE to shift data in.
+ @param[in] Address In Descriptor Mode, for Descriptor Region, GbE Region, ME Region and Platform
+ Region, this value specifies the offset from the Region Base; for BIOS Region,
+ this value specifies the offset from the start of the BIOS Image. In Non
+ Descriptor Mode, this value specifies the offset from the start of the BIOS Image.
+ Please note BIOS Image size may be smaller than BIOS Region size (in Descriptor
+ Mode) or the flash size (in Non Descriptor Mode), and in this case, BIOS Image is
+ supposed to be placed at the top end of the BIOS Region (in Descriptor Mode) or
+ the flash (in Non Descriptor Mode)
+ @param[in] DataByteCount Number of bytes in the data portion of the SPI cycle. This function may break the
+ data transfer into multiple operations. This function ensures each operation does
+ not cross 256 byte flash address boundary.
+ *NOTE: if there is some SPI chip that has a stricter address boundary requirement
+ (e.g., its write page size is < 256 byte), then the caller cannot rely on this
+ function to cut the data transfer at proper address boundaries, and it's the
+ caller's reponsibility to pass in a properly cut DataByteCount parameter.
+ @param[in, out] Buffer Pointer to caller-allocated buffer containing the dada received or sent during the
+ SPI cycle.
+ @param[in] SpiRegionType SPI Region type. Values EnumSpiRegionBios, EnumSpiRegionGbE, EnumSpiRegionMe,
+ EnumSpiRegionDescriptor, and EnumSpiRegionPlatformData are only applicable in
+ Descriptor mode. Value EnumSpiRegionAll is applicable to both Descriptor Mode
+ and Non Descriptor Mode, which indicates "SpiRegionOffset" is actually relative
+ to base of the 1st flash device (i.e., it is a Flash Linear Address).
+
+ @retval EFI_SUCCESS Command succeed.
+ @retval EFI_INVALID_PARAMETER The parameters specified are not valid.
+ @exception EFI_UNSUPPORTED Command not supported.
+ @retval EFI_DEVICE_ERROR Device error, command aborts abnormally.
+**/
+EFI_STATUS
+EFIAPI
+SpiProtocolExecute (
+ IN EFI_SPI_PROTOCOL *This,
+ IN UINT8 OpcodeIndex,
+ IN UINT8 PrefixOpcodeIndex,
+ IN BOOLEAN DataCycle,
+ IN BOOLEAN Atomic,
+ IN BOOLEAN ShiftOut,
+ IN UINTN Address,
+ IN UINT32 DataByteCount,
+ IN OUT UINT8 *Buffer,
+ IN SPI_REGION_TYPE SpiRegionType
+ )
+{
+ EFI_STATUS Status;
+ UINT8 BiosCtlSave;
+ UINT32 Data32;
+ UINT32 PmBase;
+ UINT32 SmiEnSave;
+
+ BiosCtlSave = 0;
+ SmiEnSave = 0;
+
+ ///
+ /// Check if the parameters are valid.
+ ///
+ if ((OpcodeIndex >= SPI_NUM_OPCODE) || (PrefixOpcodeIndex >= SPI_NUM_PREFIX_OPCODE)) {
+ return EFI_INVALID_PARAMETER;
+ }
+ ///
+ /// Make sure it's safe to program the command.
+ /// Poll both Hardware Sequencing and Software Sequencing Status
+ ///
+ if (!WaitForSpiCycleComplete (This, TRUE, FALSE)) {
+ return EFI_DEVICE_ERROR;
+ }
+
+ if (!WaitForSpiCycleComplete (This, FALSE, FALSE)) {
+ return EFI_DEVICE_ERROR;
+ }
+ ///
+ /// Acquire access to the SPI interface is not required any more.
+ ///
+ ///
+ /// Disable SMIs to make sure normal mode flash access is not interrupted by an SMI
+ /// whose SMI handler accesses flash (e.g. for error logging)
+ ///
+ /// *** NOTE: if the SMI_LOCK bit is set (i.e., B0:D31:F0:Offset A0h [4]='1'),
+ /// clearing B_GBL_SMI_EN will not have effect. In this situation, some other
+ /// synchronization methods must be applied either here or in the consumer of the
+ /// EFI_SPI_PROTOCOl.Execute(). An example method is disabling the specific SMI sources
+ /// whose SMI handlers access flash before calling Execute() and re-enabling the SMI
+ /// sources after the call.
+ ///
+ PmBase = PciRead32 (
+ PCI_LIB_ADDRESS (DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_ACPI_BASE)
+ ) & B_PCH_LPC_ACPI_BASE_BAR;
+
+ SmiEnSave = IoRead32 ((UINTN) (PmBase + R_PCH_SMI_EN));
+ Data32 = SmiEnSave &~B_PCH_SMI_EN_GBL_SMI;
+ IoWrite32 ((UINTN) (PmBase + R_PCH_SMI_EN), Data32);
+ ///
+ /// If shifts the data out, disable Prefetching and Caching.
+ ///
+ if (ShiftOut) {
+ BiosCtlSave = PciRead8 (
+ PCI_LIB_ADDRESS (DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_BIOS_CNTL)
+ ) & V_PCH_LPC_BIOS_CNTL_SRC;
+ PciAndThenOr8 (
+ PCI_LIB_ADDRESS (DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_BIOS_CNTL),
+ (UINT8) (~V_PCH_LPC_BIOS_CNTL_SRC),
+ (UINT8) ((V_PCH_SRC_PREF_DIS_CACHE_DIS))
+ );
+ }
+ ///
+ /// Sends the command to the SPI interface to execute.
+ ///
+ Status = SendSpiCmd (
+ This,
+ OpcodeIndex,
+ PrefixOpcodeIndex,
+ DataCycle,
+ Atomic,
+ ShiftOut,
+ Address,
+ DataByteCount,
+ Buffer,
+ SpiRegionType
+ );
+ ///
+ /// Restore the settings for SPI Prefetching and Caching.
+ ///
+ if (ShiftOut) {
+ PciAndThenOr8 (
+ PCI_LIB_ADDRESS (DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_BIOS_CNTL),
+ (UINT8) (~V_PCH_LPC_BIOS_CNTL_SRC),
+ (UINT8) (BiosCtlSave)
+ );
+ }
+ ///
+ /// Restore SMIs.
+ ///
+ IoWrite32 ((UINTN) (PmBase + R_PCH_SMI_EN), SmiEnSave);
+
+ return Status;
+}
+
+/**
+ Convert SPI offset to Physical address of SPI hardware
+
+ @param[in] This Pointer to the EFI_SPI_PROTOCOL instance.
+ @param[in] SpiRegionOffset In Descriptor Mode, for Descriptor Region, GbE Region, ME Region and Platform
+ Region, this value specifies the offset from the Region Base; for BIOS Region,
+ this value specifies the offset from the start of the BIOS Image. In Non
+ Descriptor Mode, this value specifies the offset from the start of the BIOS Image.
+ Please note BIOS Image size may be smaller than BIOS Region size (in Descriptor
+ Mode) or the flash size (in Non Descriptor Mode), and in this case, BIOS Image is
+ supposed to be placed at the top end of the BIOS Region (in Descriptor Mode) or
+ the flash (in Non Descriptor Mode)
+ @param[in] BaseAddress Base Address of the region.
+ @param[in] SpiRegionType SPI Region type. Values EnumSpiRegionBios, EnumSpiRegionGbE, EnumSpiRegionMe,
+ EnumSpiRegionDescriptor, and EnumSpiRegionPlatformData are only applicable in
+ Descriptor mode. Value EnumSpiRegionAll is applicable to both Descriptor Mode
+ and Non Descriptor Mode, which indicates "SpiRegionOffset" is actually relative
+ to base of the 1st flash device (i.e., it is a Flash Linear Address).
+ @param[in, out] HardwareSpiAddress Return absolution SPI address (i.e., Flash Linear Address)
+ @param[in, out] BaseAddress Return base address of the region type
+ @param[in, out] LimitAddress Return limit address of the region type
+
+ @retval EFI_SUCCESS Command succeed.
+**/
+VOID
+SpiOffset2Physical (
+ IN EFI_SPI_PROTOCOL *This,
+ IN UINTN SpiRegionOffset,
+ IN SPI_REGION_TYPE SpiRegionType,
+ OUT UINTN *HardwareSpiAddress,
+ OUT UINTN *BaseAddress,
+ OUT UINTN *LimitAddress
+ )
+{
+ SPI_INSTANCE *SpiInstance;
+ UINTN PchRootComplexBar;
+
+ SpiInstance = SPI_INSTANCE_FROM_SPIPROTOCOL (This);
+ PchRootComplexBar = SpiInstance->PchRootComplexBar;
+
+ if (SpiInstance->DescriptorMode == TRUE) {
+ switch (SpiRegionType) {
+
+ case EnumSpiRegionBios:
+ *LimitAddress = (((MmioRead32 (PchRootComplexBar + R_PCH_SPI_FREG1_BIOS)
+ & B_PCH_SPI_FREG1_LIMIT_MASK) >> 16) + 1) << 12;
+ *BaseAddress = (MmioRead32 (PchRootComplexBar + R_PCH_SPI_FREG1_BIOS)
+ & B_PCH_SPI_FREG1_BASE_MASK) << 12;
+ break;
+
+ case EnumSpiRegionGbE:
+ *BaseAddress = (MmioRead32 (PchRootComplexBar + R_PCH_SPI_FREG3_GBE) & B_PCH_SPI_FREG3_BASE_MASK) << 12;
+ *LimitAddress = (((MmioRead32 (PchRootComplexBar + R_PCH_SPI_FREG3_GBE)
+ & B_PCH_SPI_FREG3_LIMIT_MASK) >> 16) + 1) << 12;
+ break;
+
+ case EnumSpiRegionMe:
+ *BaseAddress = (MmioRead32 (PchRootComplexBar + R_PCH_SPI_FREG2_ME) & B_PCH_SPI_FREG2_BASE_MASK) << 12;
+ *LimitAddress = (((MmioRead32 (PchRootComplexBar + R_PCH_SPI_FREG2_ME)
+ & B_PCH_SPI_FREG2_LIMIT_MASK) >> 16) + 1) << 12;
+ break;
+
+ case EnumSpiRegionDescriptor:
+ *BaseAddress = (MmioRead32 (PchRootComplexBar + R_PCH_SPI_FREG0_FLASHD) & B_PCH_SPI_FREG0_BASE_MASK) << 12;
+ *LimitAddress = (((MmioRead32 (PchRootComplexBar + R_PCH_SPI_FREG0_FLASHD)
+ & B_PCH_SPI_FREG0_LIMIT_MASK) >> 16) + 1) << 12;
+ break;
+
+ case EnumSpiRegionPlatformData:
+ *BaseAddress = (MmioRead32 (PchRootComplexBar + R_PCH_SPI_FREG4_PLATFORM_DATA) & B_PCH_SPI_FREG4_BASE_MASK) << 12;
+ *LimitAddress = (((MmioRead32 (PchRootComplexBar + R_PCH_SPI_FREG4_PLATFORM_DATA)
+ & B_PCH_SPI_FREG4_LIMIT_MASK) >> 16) + 1) << 12;
+ break;
+
+ default:
+ ///
+ /// EnumSpiRegionAll indicates address is relative to flash device (i.e., address is Flash
+ /// Linear Address)
+ ///
+ *BaseAddress = 0;
+ *LimitAddress = 0;
+ break;
+ }
+
+ *HardwareSpiAddress = SpiRegionOffset +*BaseAddress;
+ } else {
+ if (SpiRegionType == EnumSpiRegionAll) {
+ ///
+ /// EnumSpiRegionAll indicates address is relative to flash device (i.e., address is Flash
+ /// Linear Address)
+ ///
+ *HardwareSpiAddress = SpiRegionOffset;
+ } else {
+ ///
+ /// Otherwise address is relative to BIOS image
+ ///
+ *HardwareSpiAddress = SpiRegionOffset + SpiInstance->SpiInitTable.BiosStartOffset;
+ }
+ }
+}
+
+/**
+ This function sends the programmed SPI command to the slave device.
+
+ @param[in] OpcodeIndex Index of the command in the OpCode Menu.
+ @param[in] PrefixOpcodeIndex Index of the first command to run when in an atomic cycle sequence.
+ @param[in] DataCycle TRUE if the SPI cycle contains data
+ @param[in] Atomic TRUE if the SPI cycle is atomic and interleave cycles are not allowed.
+ @param[in] ShiftOut If DataByteCount is not zero, TRUE to shift data out and FALSE to shift data in.
+ @param[in] Address In Descriptor Mode, for Descriptor Region, GbE Region, ME Region and Platform
+ Region, this value specifies the offset from the Region Base; for BIOS Region,
+ this value specifies the offset from the start of the BIOS Image. In Non
+ Descriptor Mode, this value specifies the offset from the start of the BIOS Image.
+ Please note BIOS Image size may be smaller than BIOS Region size (in Descriptor
+ Mode) or the flash size (in Non Descriptor Mode), and in this case, BIOS Image is
+ supposed to be placed at the top end of the BIOS Region (in Descriptor Mode) or
+ the flash (in Non Descriptor Mode)
+ @param[in] DataByteCount Number of bytes in the data portion of the SPI cycle. This function may break the
+ data transfer into multiple operations. This function ensures each operation does
+ not cross 256 byte flash address boundary.
+ *NOTE: if there is some SPI chip that has a stricter address boundary requirement
+ (e.g., its write page size is < 256 byte), then the caller cannot rely on this
+ function to cut the data transfer at proper address boundaries, and it's the
+ caller's reponsibility to pass in a properly cut DataByteCount parameter.
+ @param[in, out] Buffer Data received or sent during the SPI cycle.
+ @param[in] SpiRegionType SPI Region type. Values EnumSpiRegionBios, EnumSpiRegionGbE, EnumSpiRegionMe,
+ EnumSpiRegionDescriptor, and EnumSpiRegionPlatformData are only applicable in
+ Descriptor mode. Value EnumSpiRegionAll is applicable to both Descriptor Mode
+ and Non Descriptor Mode, which indicates "SpiRegionOffset" is actually relative
+ to base of the 1st flash device (i.e., it is a Flash Linear Address).
+
+ @retval EFI_SUCCESS SPI command completes successfully.
+ @retval EFI_DEVICE_ERROR Device error, the command aborts abnormally.
+ @retval EFI_ACCESS_DENIED Some unrecognized command encountered in hardware sequencing mode
+ @retval EFI_INVALID_PARAMETER The parameters specified are not valid.
+**/
+EFI_STATUS
+SendSpiCmd (
+ IN EFI_SPI_PROTOCOL *This,
+ IN UINT8 OpcodeIndex,
+ IN UINT8 PrefixOpcodeIndex,
+ IN BOOLEAN DataCycle,
+ IN BOOLEAN Atomic,
+ IN BOOLEAN ShiftOut,
+ IN UINTN Address,
+ IN UINT32 DataByteCount,
+ IN OUT UINT8 *Buffer,
+ IN SPI_REGION_TYPE SpiRegionType
+ )
+{
+ UINT32 Index;
+ SPI_INSTANCE *SpiInstance;
+ UINTN HardwareSpiAddr;
+ UINTN SpiBiosSize;
+ BOOLEAN UseSoftwareSequence;
+ UINTN BaseAddress;
+ UINTN LimitAddress;
+ UINT32 SpiDataCount;
+ UINT8 OpCode;
+ UINT16 OpType;
+ SPI_OPERATION Operation;
+ UINTN PchRootComplexBar;
+ UINT32 SpiSoftFreq;
+ UINT16 FlashCycle;
+ UINT8 BiosCntl;
+ BOOLEAN BiosWriteProtect;
+
+ SpiInstance = SPI_INSTANCE_FROM_SPIPROTOCOL (This);
+ PchRootComplexBar = SpiInstance->PchRootComplexBar;
+ SpiBiosSize = SpiInstance->SpiInitTable.BiosSize;
+ Operation = SpiInstance->SpiInitTable.SpiCmdConfig[OpcodeIndex].Operation;
+ OpCode = MmioRead8 (PchRootComplexBar + R_PCH_SPI_OPMENU + OpcodeIndex);
+ OpType = (MmioRead16 (PchRootComplexBar + R_PCH_SPI_OPTYPE) >> OpcodeIndex * 2) & (UINT16) (B_PCH_SPI_OPTYPE0_MASK);
+ ///
+ /// Please use PciRead here, it will link to MmioRead
+ /// if the caller is a Runtime driver, please use PchDxeRuntimePciLibPciExpress library, refer
+ /// PciExpressRead() on Library\DxeRuntimePciLibPciExpress\DxeRuntimePciLibPciExpress.c for the details.
+ /// For the rest please use EdkIIGlueBasePciLibPciExpress library
+ ///
+ BiosCntl = PciRead8 (
+ PCI_LIB_ADDRESS (DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_BIOS_CNTL));
+ ///
+ /// Check if the value of opcode register is 0 or the BIOS Size of SpiInitTable is 0 while SpiRegionType is EnumSpiRegionBios.
+ ///
+ if (OpCode == 0 || (SpiBiosSize == 0 && SpiRegionType == EnumSpiRegionBios)) {
+ ASSERT (FALSE);
+ return EFI_INVALID_PARAMETER;
+ }
+ ///
+ /// Check if need to disable BIOS Write Protect
+ ///
+ if ((Operation == EnumSpiOperationProgramData_1_Byte) ||
+ (Operation == EnumSpiOperationProgramData_64_Byte) ||
+ (Operation == EnumSpiOperationErase_256_Byte) ||
+ (Operation == EnumSpiOperationErase_4K_Byte) ||
+ (Operation == EnumSpiOperationErase_8K_Byte) ||
+ (Operation == EnumSpiOperationErase_64K_Byte) ||
+ (Operation == EnumSpiOperationFullChipErase)) {
+ DisableBiosWriteProtect ();
+ BiosWriteProtect = FALSE;
+ } else {
+ BiosWriteProtect = TRUE;
+ }
+ ///
+ /// Per PCH BIOS Spec Section 3.7 BIOS Region SMM Protection Enabling,
+ /// If SMM_BWP bit (D31:F0:RegDCh[5]) is set, the BIOS Region can only be updated
+ /// by following the steps:
+ /// - Once all threads enter SMM
+ /// - Read memory location FED30880h OR with 00000001h, place the result in EAX,
+ /// and write data to lower 32 bits of MSR 1FEh. (This is done in
+ /// DisableBiosWriteProtect())
+ ///
+ if (((BiosCntl & B_PCH_LPC_BIOS_CNTL_SMM_BWP) == B_PCH_LPC_BIOS_CNTL_SMM_BWP) &&
+ (BiosWriteProtect == FALSE) &&
+ ((MmioRead32 ((UINTN) 0xFED30880) & (UINT32) BIT0) == 0)) {
+ EnableBiosWriteProtect ();
+ return EFI_ACCESS_DENIED;
+ }
+ ///
+ /// When current code is read id OR current is not descriptor mode, we will use compatible mode
+ ///
+ UseSoftwareSequence = FALSE;
+ if ((Operation == EnumSpiOperationJedecId) ||
+ (Operation == EnumSpiOperationReadStatus) ||
+ (Operation == EnumSpiOperationWriteStatus) ||
+ (Operation == EnumSpiOperationWriteDisable) ||
+ (Operation == EnumSpiOperationWriteEnable) ||
+ (Operation == EnumSpiOperationEnableWriteStatus) ||
+ (Operation == EnumSpiOperationOther) ||
+ (Operation == EnumSpiOperationDiscoveryParameters) ||
+ (SpiInstance->DescriptorMode == FALSE)
+ ) {
+ UseSoftwareSequence = TRUE;
+ }
+
+ SpiOffset2Physical (This, Address, SpiRegionType, &HardwareSpiAddr, &BaseAddress, &LimitAddress);
+ ///
+ /// Have direct access to BIOS region in Descriptor mode,
+ ///
+ if (OpType == EnumSpiOpcodeRead && SpiRegionType == EnumSpiRegionBios) {
+ CopyMem (
+ Buffer,
+ (UINT8 *) ((HardwareSpiAddr - BaseAddress) + (UINT32) (~(SpiBiosSize - 1))),
+ DataByteCount
+ );
+ return EFI_SUCCESS;
+ }
+ ///
+ /// DEBUG((EFI_D_ERROR, "SPIADDR %x, %x, %x, %x\n", Address, HardwareSpiAddr, BaseAddress,
+ /// LimitAddress));
+ ///
+ if ((DataCycle == FALSE) && (DataByteCount > 0)) {
+ DataByteCount = 0;
+ }
+
+ do {
+ ///
+ /// Trim at 256 byte boundary per operation,
+ /// - PCH SPI controller requires trimming at 4KB boundary
+ /// - Some SPI chips require trimming at 256 byte boundary for write operation
+ /// - Trimming has limited performance impact as we can read / write atmost 64 byte
+ /// per operation
+ ///
+ if (HardwareSpiAddr + DataByteCount > ((HardwareSpiAddr + BIT8) &~(BIT8 - 1))) {
+ SpiDataCount = (((UINT32) (HardwareSpiAddr) + BIT8) &~(BIT8 - 1)) - (UINT32) (HardwareSpiAddr);
+ } else {
+ SpiDataCount = DataByteCount;
+ }
+ ///
+ /// Calculate the number of bytes to shift in/out during the SPI data cycle.
+ /// Valid settings for the number of bytes duing each data portion of the
+ /// PCH SPI cycles are: 0, 1, 2, 3, 4, 5, 6, 7, 8, 16, 24, 32, 40, 48, 56, 64
+ ///
+ if ((SpiInstance->DescriptorMode == FALSE) &&
+ (OpCode == PCH_SPI_COMMAND_PROGRAM_BYTE || Operation == EnumSpiOperationProgramData_1_Byte)) {
+ SpiDataCount = 1;
+ } else if (SpiDataCount >= 64) {
+ SpiDataCount = 64;
+ } else if ((SpiDataCount &~0x07) != 0) {
+ SpiDataCount = SpiDataCount &~0x07;
+ }
+ ///
+ /// If shifts data out, load data into the SPI data buffer.
+ ///
+ if (ShiftOut) {
+ for (Index = 0; Index < SpiDataCount; Index++) {
+ MmioWrite8 (PchRootComplexBar + R_PCH_SPI_FDATA00 + Index, Buffer[Index]);
+ MmioRead8 (PchRootComplexBar + R_PCH_SPI_FDATA00 + Index);
+ }
+ }
+
+ MmioWrite32 (
+ (PchRootComplexBar + R_PCH_SPI_FADDR),
+ (UINT32) (HardwareSpiAddr & B_PCH_SPI_FADDR_MASK)
+ );
+ MmioRead32 (PchRootComplexBar + R_PCH_SPI_FADDR);
+
+ ///
+ /// Execute the command on the SPI compatible mode
+ ///
+ if (UseSoftwareSequence) {
+ ///
+ /// Software sequencing ...
+ ///
+ ///
+ /// Clear error flags
+ ///
+ MmioWrite16 (PchRootComplexBar + R_PCH_SPI_HSFS, (UINT16) B_PCH_SPI_HSFS_AEL);
+ MmioWrite8 (PchRootComplexBar + R_PCH_SPI_SSFS, (UINT8) B_PCH_SPI_SSFS_FCERR);
+
+ switch (SpiInstance->SpiInitTable.SpiCmdConfig[OpcodeIndex].Frequency) {
+ case EnumSpiCycle20MHz:
+ SpiSoftFreq = V_PCH_SPI_SSFC_SCF_20MHZ;
+ break;
+
+ case EnumSpiCycle33MHz:
+ SpiSoftFreq = V_PCH_SPI_SSFC_SCF_33MHZ;
+ break;
+
+ case EnumSpiCycle50MHz:
+ SpiSoftFreq = V_PCH_SPI_SSFC_SCF_50MHZ;
+ break;
+
+ default:
+ ///
+ /// This is an invalid use of the protocol
+ /// See definition, but caller must call with valid value
+ ///
+ SpiSoftFreq = 0;
+ ASSERT (!EFI_UNSUPPORTED);
+ break;
+ }
+ ///
+ /// PCH Chipset EDS 1.1, Section 22.1.19
+ /// SSFC BIT23:19 are reserved, BIOS must set this field to '11111'b
+ /// To change the offset to the right DWORD boundary, so use offset 0x90 as the operation address
+ ///
+ if (DataCycle) {
+ MmioWrite32 (
+ (PchRootComplexBar + R_PCH_SPI_SSFC - 1),
+ ( (UINT32) (BIT23 | BIT22 | BIT21 | BIT20 | BIT19) |
+ (UINT32) ((SpiSoftFreq << 16) & B_PCH_SPI_SSFC_SCF_MASK) |
+ (UINT32) (B_PCH_SPI_SSFC_DS) | (UINT32) (((SpiDataCount - 1) << 8) & B_PCH_SPI_SSFC_DBC_MASK) |
+ (UINT32) ((OpcodeIndex << 4) & B_PCH_SPI_SSFC_COP) |
+ (UINT32) ((PrefixOpcodeIndex << 3) & B_PCH_SPI_SSFC_SPOP) |
+ (UINT32) (Atomic ? B_PCH_SPI_SSFC_ACS : 0) |
+ (UINT32) (B_PCH_SPI_SSFC_SCGO)) << 8);
+ } else {
+ MmioWrite32 (
+ (PchRootComplexBar + R_PCH_SPI_SSFC - 1),
+ ( (UINT32) (BIT23 | BIT22 | BIT21 | BIT20 | BIT19) |
+ (UINT32) ((SpiSoftFreq << 16) & B_PCH_SPI_SSFC_SCF_MASK) |
+ (UINT32) ((OpcodeIndex << 4) & B_PCH_SPI_SSFC_COP) |
+ (UINT32) ((PrefixOpcodeIndex << 3) & B_PCH_SPI_SSFC_SPOP) |
+ (UINT32) (Atomic ? B_PCH_SPI_SSFC_ACS : 0) |
+ (UINT32) (B_PCH_SPI_SSFC_SCGO)) << 8);
+ }
+
+ MmioRead32 (PchRootComplexBar + R_PCH_SPI_SSFC - 1);
+ } else {
+ ///
+ /// Hardware sequencing ...
+ ///
+ ///
+ /// check for PCH SPI hardware sequencing required commands
+ ///
+ if (Operation == EnumSpiOperationReadData ||
+ Operation == EnumSpiOperationFastRead ||
+ Operation == EnumSpiOperationDualOutputFastRead) {
+ ///
+ /// Read Cycle
+ ///
+ FlashCycle = (UINT16) (V_PCH_SPI_HSFC_FCYCLE_READ << 1);
+ } else if (Operation == EnumSpiOperationProgramData_1_Byte ||
+ Operation == EnumSpiOperationProgramData_64_Byte) {
+ ///
+ /// Write Cycle
+ ///
+ FlashCycle = (UINT16) (V_PCH_SPI_HSFC_FCYCLE_WRITE << 1);
+ } else if (Operation == EnumSpiOperationErase_256_Byte ||
+ Operation == EnumSpiOperationErase_4K_Byte ||
+ Operation == EnumSpiOperationErase_8K_Byte ||
+ Operation == EnumSpiOperationErase_64K_Byte ||
+ Operation == EnumSpiOperationFullChipErase) {
+ ///
+ /// Erase Cycle
+ ///
+ FlashCycle = (UINT16) (V_PCH_SPI_HSFC_FCYCLE_ERASE << 1);
+ } else {
+ ///
+ /// Unrecognized Operation
+ ///
+ ASSERT (FALSE);
+ return EFI_ACCESS_DENIED;
+ }
+ ///
+ /// Clear error flags
+ ///
+ MmioWrite16 (
+ PchRootComplexBar + R_PCH_SPI_HSFS,
+ (UINT16) (B_PCH_SPI_HSFS_AEL | B_PCH_SPI_HSFS_FCERR)
+ );
+ ///
+ /// Send the command
+ ///
+ MmioWrite16 (
+ PchRootComplexBar + R_PCH_SPI_HSFC,
+ (UINT16) (((SpiDataCount - 1) << 8) & B_PCH_SPI_HSFC_FDBC_MASK) |
+ FlashCycle | B_PCH_SPI_HSFC_FCYCLE_FGO
+ );
+ ///
+ /// Read back for posted write to take effect
+ ///
+ MmioRead16 (PchRootComplexBar + R_PCH_SPI_HSFC);
+ }
+ ///
+ /// end of command execution
+ ///
+ /// Wait the SPI cycle to complete.
+ ///
+ if (!WaitForSpiCycleComplete (This, UseSoftwareSequence, TRUE)) {
+ if (BiosWriteProtect == FALSE) {
+ ///
+ /// Enable BIOS Write Protect
+ ///
+ EnableBiosWriteProtect ();
+ }
+ return EFI_DEVICE_ERROR;
+ }
+ ///
+ /// If shifts data in, get data from the SPI data bufffer.
+ ///
+ if (!ShiftOut) {
+ for (Index = 0; Index < SpiDataCount; Index++) {
+ Buffer[Index] = MmioRead8 (PchRootComplexBar + R_PCH_SPI_FDATA00 + Index);
+ }
+ }
+
+ HardwareSpiAddr += SpiDataCount;
+ Buffer += SpiDataCount;
+ DataByteCount -= SpiDataCount;
+ } while (DataByteCount > 0);
+
+ if (BiosWriteProtect == FALSE) {
+ ///
+ /// Enable BIOS Write Protect
+ ///
+ EnableBiosWriteProtect ();
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Wait execution cycle to complete on the SPI interface. Check both Hardware
+ and Software Sequencing status registers
+
+ @param[in] This The SPI protocol instance
+ @param[in] UseSoftwareSequence TRUE if Software Sequencing
+ @param[in] ErrorCheck TRUE if the SpiCycle needs to do the error check
+
+ @retval TRUE SPI cycle completed on the interface.
+ @retval FALSE Time out while waiting the SPI cycle to complete.
+ It's not safe to program the next command on the SPI interface.
+**/
+BOOLEAN
+WaitForSpiCycleComplete (
+ IN EFI_SPI_PROTOCOL *This,
+ IN BOOLEAN UseSoftwareSequence,
+ IN BOOLEAN ErrorCheck
+ )
+{
+ UINT64 WaitTicks;
+ UINT64 WaitCount;
+ UINT32 StatusRegAddr;
+ UINT32 CycleInProgressBit;
+ UINT16 AelBit;
+ UINT16 FcErrBit;
+ UINT16 FcycleDone;
+ UINT16 Data16;
+ SPI_INSTANCE *SpiInstance;
+ UINTN PchRootComplexBar;
+
+ SpiInstance = SPI_INSTANCE_FROM_SPIPROTOCOL (This);
+ PchRootComplexBar = SpiInstance->PchRootComplexBar;
+
+ if (UseSoftwareSequence) {
+ ///
+ /// This is Software Sequencing
+ ///
+ StatusRegAddr = R_PCH_SPI_SSFS;
+ CycleInProgressBit = B_PCH_SPI_SSFS_SCIP;
+ AelBit = B_PCH_SPI_SSFS_AEL;
+ FcErrBit = B_PCH_SPI_SSFS_FCERR;
+ FcycleDone = B_PCH_SPI_SSFS_CDS;
+ } else {
+ ///
+ /// This is Hardware Sequencing
+ ///
+ StatusRegAddr = R_PCH_SPI_HSFS;
+ CycleInProgressBit = B_PCH_SPI_HSFS_SCIP;
+ AelBit = B_PCH_SPI_HSFS_AEL;
+ FcErrBit = B_PCH_SPI_HSFS_FCERR;
+ FcycleDone = B_PCH_SPI_HSFS_FDONE;
+ }
+ ///
+ /// Convert the wait period allowed into to tick count
+ ///
+ WaitCount = WAIT_TIME / WAIT_PERIOD;
+
+ ///
+ /// Wait for the SPI cycle to complete.
+ ///
+ for (WaitTicks = 0; WaitTicks < WaitCount; WaitTicks++) {
+ Data16 = MmioRead16 (PchRootComplexBar + StatusRegAddr);
+ if ((Data16 & CycleInProgressBit) == 0) {
+ if (UseSoftwareSequence){
+ MmioWrite8 (PchRootComplexBar + StatusRegAddr, (UINT8)(AelBit | FcErrBit | FcycleDone));
+ }else{
+ MmioWrite16 (PchRootComplexBar + StatusRegAddr, (AelBit | FcErrBit | FcycleDone));
+ }
+ if (((Data16 & AelBit) || (Data16 & FcErrBit)) && (ErrorCheck == TRUE)) {
+ return FALSE;
+ } else {
+ return TRUE;
+ }
+ }
+
+ PchPmTimerStall (WAIT_PERIOD);
+ }
+
+ return FALSE;
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/Spi/Common/SpiCommon.h b/ReferenceCode/Chipset/LynxPoint/Spi/Common/SpiCommon.h
new file mode 100644
index 0000000..224ebee
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Spi/Common/SpiCommon.h
@@ -0,0 +1,300 @@
+/** @file
+ Header file for the PCH SPI Common Driver.
+
+@copyright
+ Copyright (c) 2008 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#ifndef _SPI_COMMON_H_
+#define _SPI_COMMON_H_
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "PchAccess.h"
+#include "PchPlatformLib.h"
+#endif
+//
+// Maximum time allowed while waiting the SPI cycle to complete
+// Wait Time = 6 seconds = 6000000 microseconds
+// Wait Period = 10 microseconds
+//
+#define WAIT_TIME 6000000 ///< Wait Time = 6 seconds = 6000000 microseconds
+#define WAIT_PERIOD 10 ///< Wait Period = 10 microseconds
+//
+// PCH Required SPI Commands -------- COMMAND SET I ------------
+// SPI flash device must support in order to be compatible with PCH
+//
+#define PCH_SPI_COMMAND_WRITE_STATUS 0x01
+#define PCH_SPI_COMMAND_PROGRAM_BYTE 0x02
+#define PCH_SPI_COMMAND_READ_DATA 0x03
+#define PCH_SPI_COMMAND_WRITE_DISABLE 0x04
+#define PCH_SPI_COMMAND_READ_STATUS 0x05
+#define PCH_SPI_COMMAND_WRITE_ENABLE 0x06
+#define PCH_SPI_COMMAND_FAST_READ 0x0B
+#define PCH_SPI_COMMAND_DUAL_FAST_READ 0x3B ///< Dual Output Fast Read
+#define PCH_SPI_COMMAND_ENABLE_WRITE_STATUS 0x50 ///< Enable Write Status Register
+#define PCH_SPI_COMMAND_DISCOVERY_PARAMETERS 0x5A ///< Serial Flash Discovery Parameters
+#define PCH_SPI_COMMAND_READ_ID 0x9F ///< JEDEC Read ID
+#define PCH_SPI_COMMAND_FULL_CHIP_ERASE 0xC7 ///< Full Chip Erase
+//
+// Need to support at least one of the following three kinds of size of sector for erasing
+//
+#define PCH_SPI_COMMAND_4KB_ERASE 0x20
+#define PCH_SPI_COMMAND_64KB_ERASE 0xD8
+#define PCH_SPI_COMMAND_256B_ERASE 0xDB
+//
+// ICH8M Recommended SPI Commands -------- COMMAND SET II ------------
+// SPI flash device best to support
+//
+#define PCH_SPI_COMMAND_WRITE_STATUS 0x01
+#define PCH_SPI_COMMAND_WRITE_STATUS_EN 0x50
+#define PCH_SPI_COMMAND_FULL_CHIP_ERASE 0xC7
+
+#define SIZE_OF_SPI_VTBA_ENTRY (S_PCH_SPI_VTBA_JID0 + S_PCH_SPI_VTBA_VSCC0)
+
+///
+/// Private data structure definitions for the driver
+///
+#define PCH_SPI_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('P', 'S', 'P', 'I')
+
+///
+/// Initialization data table loaded to the SPI host controller
+/// PrefixOpcode Prefix opcodes which are loaded into the SPI host controller
+/// SpiCmdConfig Determines Opcode Type, Menu and Frequency of the SPI commands
+/// BiosStartOffset The offset of the start of the BIOS image relative to the flash device.
+/// Please note this is a Flash Linear Address, NOT a memory space address.
+/// This value is platform specific and depends on the system flash map.
+/// This value is only used on non Descriptor mode.
+/// BiosSize The the BIOS Image size in flash. This value is platform specific
+/// and depends on the system flash map. Please note BIOS Image size may
+/// be smaller than BIOS Region size (in Descriptor Mode) or the flash size
+/// (in Non Descriptor Mode), and in this case, BIOS Image is supposed to be
+/// placed at the top end of the BIOS Region (in Descriptor Mode) or the flash
+/// (in Non Descriptor Mode)
+///
+typedef struct _SPI_INIT_TABLE {
+ UINT8 PrefixOpcode[SPI_NUM_PREFIX_OPCODE];
+ SPI_COMMAND_CONFIG SpiCmdConfig[SPI_NUM_OPCODE];
+ UINTN BiosStartOffset;
+ UINTN BiosSize;
+} SPI_INIT_TABLE;
+
+typedef struct _SPI_ID_TABLE {
+ UINT8 VendorId;
+ UINT8 DeviceId0;
+ UINT8 DeviceId1;
+} SPI_ID_TABLE;
+
+typedef struct _SPI_DESCRIPTOR_TABLE {
+ UINT8 NumberComponents :2;
+ UINT8 Comp1Density :4;
+ UINT8 Rsvd :2;
+} SPI_DESCRIPTOR_TABLE;
+
+typedef struct {
+ UINTN Signature;
+ EFI_HANDLE Handle;
+ EFI_SPI_PROTOCOL SpiProtocol;
+ SPI_INIT_TABLE SpiInitTable;
+ SPI_ID_TABLE SpiIdTable[2];
+ UINTN PchRootComplexBar;
+ SPI_DESCRIPTOR_TABLE SpiDescriptor;
+ BOOLEAN DescriptorMode;
+} SPI_INSTANCE;
+
+#define SPI_INSTANCE_FROM_SPIPROTOCOL(a) CR (a, SPI_INSTANCE, SpiProtocol, PCH_SPI_PRIVATE_DATA_SIGNATURE)
+
+//
+// Function prototypes used by the SPI protocol.
+//
+
+/**
+ Initialize an SPI protocol instance.
+ The function will assert in debug if PCH RCBA has not been initialized
+
+ @param[in] SpiInstance Pointer to SpiInstance to initialize
+
+ @retval EFI_SUCCESS The protocol instance was properly initialized
+ @exception EFI_UNSUPPORTED The PCH is not supported by this module
+**/
+EFI_STATUS
+SpiProtocolConstructor (
+ SPI_INSTANCE *SpiInstance
+ );
+
+/**
+ JEDEC Read IDs from SPI flash part, this function will return 1-byte Vendor ID and 2-byte Device ID
+
+ @param[in] This Pointer to the EFI_SPI_PROTOCOL instance.
+ @param[in] Address This value is for determines the command is sent to SPI Component 1 or 2
+ @param[in, out] Buffer Pointer to caller-allocated buffer containing the dada received or sent during the SPI cycle.
+
+ @retval EFI_SUCCESS Read Jedec Id completed.
+ @retval EFI_DEVICE_ERROR Device error, operation failed.
+ @exception EFI_UNSUPPORTED This function is unsupport after SpiProtocolInit is called
+**/
+EFI_STATUS
+EFIAPI
+SpiProtocolReadId (
+ IN EFI_SPI_PROTOCOL *This,
+ IN UINTN Address,
+ IN OUT UINT8 *Buffer
+ );
+
+/**
+ Initialize the host controller to execute SPI command.
+
+ @param[in] This Pointer to the EFI_SPI_PROTOCOL instance.
+ @param[in] InitData Initialization data to be programmed into the SPI host controller.
+
+ @retval EFI_SUCCESS Initialization completed.
+ @retval EFI_ACCESS_DENIED The SPI static configuration interface has been locked-down.
+ @retval EFI_INVALID_PARAMETER Bad input parameters.
+ @exception EFI_UNSUPPORTED Can't get Descriptor mode VSCC values
+**/
+EFI_STATUS
+EFIAPI
+SpiProtocolInit (
+ IN EFI_SPI_PROTOCOL *This,
+ IN SPI_INIT_DATA *InitData
+ );
+
+/**
+ Execute SPI commands from the host controller.
+ This function would be called by runtime driver, please do not use any MMIO marco here
+
+ @param[in] This Pointer to the EFI_SPI_PROTOCOL instance.
+ @param[in] OpcodeIndex Index of the command in the OpCode Menu.
+ @param[in] PrefixOpcodeIndex Index of the first command to run when in an atomic cycle sequence.
+ @param[in] DataCycle TRUE if the SPI cycle contains data
+ @param[in] Atomic TRUE if the SPI cycle is atomic and interleave cycles are not allowed.
+ @param[in] ShiftOut If DataByteCount is not zero, TRUE to shift data out and FALSE to shift data in.
+ @param[in] Address In Descriptor Mode, for Descriptor Region, GbE Region, ME Region and Platform
+ Region, this value specifies the offset from the Region Base; for BIOS Region,
+ this value specifies the offset from the start of the BIOS Image. In Non
+ Descriptor Mode, this value specifies the offset from the start of the BIOS Image.
+ Please note BIOS Image size may be smaller than BIOS Region size (in Descriptor
+ Mode) or the flash size (in Non Descriptor Mode), and in this case, BIOS Image is
+ supposed to be placed at the top end of the BIOS Region (in Descriptor Mode) or
+ the flash (in Non Descriptor Mode)
+ @param[in] DataByteCount Number of bytes in the data portion of the SPI cycle. This function may break the
+ data transfer into multiple operations. This function ensures each operation does
+ not cross 256 byte flash address boundary.
+ *NOTE: if there is some SPI chip that has a stricter address boundary requirement
+ (e.g., its write page size is < 256 byte), then the caller cannot rely on this
+ function to cut the data transfer at proper address boundaries, and it's the
+ caller's reponsibility to pass in a properly cut DataByteCount parameter.
+ @param[in, out] Buffer Pointer to caller-allocated buffer containing the dada received or sent during the
+ SPI cycle.
+ @param[in] SpiRegionType SPI Region type. Values EnumSpiRegionBios, EnumSpiRegionGbE, EnumSpiRegionMe,
+ EnumSpiRegionDescriptor, and EnumSpiRegionPlatformData are only applicable in
+ Descriptor mode. Value EnumSpiRegionAll is applicable to both Descriptor Mode
+ and Non Descriptor Mode, which indicates "SpiRegionOffset" is actually relative
+ to base of the 1st flash device (i.e., it is a Flash Linear Address).
+
+ @retval EFI_SUCCESS Command succeed.
+ @retval EFI_INVALID_PARAMETER The parameters specified are not valid.
+ @exception EFI_UNSUPPORTED Command not supported.
+ @retval EFI_DEVICE_ERROR Device error, command aborts abnormally.
+**/
+EFI_STATUS
+EFIAPI
+SpiProtocolExecute (
+ IN EFI_SPI_PROTOCOL *This,
+ IN UINT8 OpcodeIndex,
+ IN UINT8 PrefixOpcodeIndex,
+ IN BOOLEAN DataCycle,
+ IN BOOLEAN Atomic,
+ IN BOOLEAN ShiftOut,
+ IN UINTN Address,
+ IN UINT32 DataByteCount,
+ IN OUT UINT8 *Buffer,
+ IN SPI_REGION_TYPE SpiRegionType
+ );
+
+/**
+ This function sends the programmed SPI command to the slave device.
+
+ @param[in] OpcodeIndex Index of the command in the OpCode Menu.
+ @param[in] PrefixOpcodeIndex Index of the first command to run when in an atomic cycle sequence.
+ @param[in] DataCycle TRUE if the SPI cycle contains data
+ @param[in] Atomic TRUE if the SPI cycle is atomic and interleave cycles are not allowed.
+ @param[in] ShiftOut If DataByteCount is not zero, TRUE to shift data out and FALSE to shift data in.
+ @param[in] Address In Descriptor Mode, for Descriptor Region, GbE Region, ME Region and Platform
+ Region, this value specifies the offset from the Region Base; for BIOS Region,
+ this value specifies the offset from the start of the BIOS Image. In Non
+ Descriptor Mode, this value specifies the offset from the start of the BIOS Image.
+ Please note BIOS Image size may be smaller than BIOS Region size (in Descriptor
+ Mode) or the flash size (in Non Descriptor Mode), and in this case, BIOS Image is
+ supposed to be placed at the top end of the BIOS Region (in Descriptor Mode) or
+ the flash (in Non Descriptor Mode)
+ @param[in] DataByteCount Number of bytes in the data portion of the SPI cycle. This function may break the
+ data transfer into multiple operations. This function ensures each operation does
+ not cross 256 byte flash address boundary.
+ *NOTE: if there is some SPI chip that has a stricter address boundary requirement
+ (e.g., its write page size is < 256 byte), then the caller cannot rely on this
+ function to cut the data transfer at proper address boundaries, and it's the
+ caller's reponsibility to pass in a properly cut DataByteCount parameter.
+ @param[in, out] Buffer Data received or sent during the SPI cycle.
+ @param[in] SpiRegionType SPI Region type. Values EnumSpiRegionBios, EnumSpiRegionGbE, EnumSpiRegionMe,
+ EnumSpiRegionDescriptor, and EnumSpiRegionPlatformData are only applicable in
+ Descriptor mode. Value EnumSpiRegionAll is applicable to both Descriptor Mode
+ and Non Descriptor Mode, which indicates "SpiRegionOffset" is actually relative
+ to base of the 1st flash device (i.e., it is a Flash Linear Address).
+
+ @retval EFI_SUCCESS SPI command completes successfully.
+ @retval EFI_DEVICE_ERROR Device error, the command aborts abnormally.
+ @retval EFI_ACCESS_DENIED Some unrecognized command encountered in hardware sequencing mode
+ @retval EFI_INVALID_PARAMETER The parameters specified are not valid.
+**/
+EFI_STATUS
+SendSpiCmd (
+ IN EFI_SPI_PROTOCOL *This,
+ IN UINT8 OpcodeIndex,
+ IN UINT8 PrefixOpcodeIndex,
+ IN BOOLEAN DataCycle,
+ IN BOOLEAN Atomic,
+ IN BOOLEAN ShiftOut,
+ IN UINTN Address,
+ IN UINT32 DataByteCount,
+ IN OUT UINT8 *Buffer,
+ IN SPI_REGION_TYPE SpiRegionType
+ );
+
+/**
+ Wait execution cycle to complete on the SPI interface. Check both Hardware
+ and Software Sequencing status registers
+
+ @param[in] This The SPI protocol instance
+ @param[in] UseSoftwareSequence TRUE if this is a Hardware Sequencing operation
+ @param[in] ErrorCheck TRUE if the SpiCycle needs to do the error check
+
+ @retval TRUE SPI cycle completed on the interface.
+ @retval FALSE Time out while waiting the SPI cycle to complete.
+ It's not safe to program the next command on the SPI interface.
+**/
+BOOLEAN
+WaitForSpiCycleComplete (
+ IN EFI_SPI_PROTOCOL *This,
+ IN BOOLEAN UseSoftwareSequence,
+ IN BOOLEAN ErrorCheck
+ );
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Spi/Pei/PchSpi.c b/ReferenceCode/Chipset/LynxPoint/Spi/Pei/PchSpi.c
new file mode 100644
index 0000000..f5b0062
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Spi/Pei/PchSpi.c
@@ -0,0 +1,133 @@
+/** @file
+ PCH SPI PEIM implements the SPI Host Controller Compatibility Interface.
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "PchSpi.h"
+
+/**
+ Installs PCH SPI PPI
+
+ @param[in] FfsHeader Not used.
+ @param[in] PeiServices General purpose services available to every PEIM.
+
+ @retval EFI_SUCCESS PCH SPI PPI is installed successfully
+ @retval EFI_OUT_OF_RESOURCES Can't allocate pool
+**/
+EFI_STATUS
+InstallPchSpi (
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_STATUS Status;
+ PEI_SPI_INSTANCE *PeiSpiInstance;
+ SPI_INSTANCE *SpiInstance;
+
+ DEBUG ((EFI_D_INFO, "InstallPchSpi() Start\n"));
+
+ PeiSpiInstance = (PEI_SPI_INSTANCE *) AllocateZeroPool (sizeof (PEI_SPI_INSTANCE));
+ if (NULL == PeiSpiInstance) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ SpiInstance = &(PeiSpiInstance->SpiInstance);
+ SpiProtocolConstructor (SpiInstance);
+
+ PeiSpiInstance->PpiDescriptor.Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;
+ PeiSpiInstance->PpiDescriptor.Guid = &gPeiSpiPpiGuid;
+ PeiSpiInstance->PpiDescriptor.Ppi = &(SpiInstance->SpiProtocol);
+
+ ///
+ /// Install the SPI PPI
+ ///
+ Status = (**PeiServices).InstallPpi (PeiServices, &PeiSpiInstance->PpiDescriptor);
+ ASSERT_EFI_ERROR (Status);
+
+ DEBUG ((EFI_D_INFO, "SPI PPI Installed\n"));
+
+ DEBUG ((EFI_D_INFO, "InstallPchSpi() End\n"));
+
+ return Status;
+}
+
+/**
+ This function is a a hook for Spi Pei phase specific initialization
+
+ @param[in] None
+
+ @retval None
+**/
+VOID
+EFIAPI
+SpiPhaseInit (
+ VOID
+ )
+{
+ return;
+}
+
+/**
+ This function is a hook for Spi to disable BIOS Write Protect
+
+ @param[in] None
+
+ @retval None
+**/
+VOID
+EFIAPI
+DisableBiosWriteProtect (
+ VOID
+ )
+{
+ ///
+ /// Enable the access to the BIOS space for both read and write cycles
+ ///
+ PciOr8 (
+ PCI_LIB_ADDRESS (DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ 0,
+ R_PCH_LPC_BIOS_CNTL),
+ (UINT8) (B_PCH_LPC_BIOS_CNTL_BIOSWE)
+ );
+}
+
+/**
+ This function is a hook for Spi to enable BIOS Write Protect
+
+ @param[in] None
+
+ @retval None
+**/
+VOID
+EFIAPI
+EnableBiosWriteProtect (
+ VOID
+ )
+{
+ ///
+ /// Disable the access to the BIOS space for write cycles
+ ///
+ PciAnd8 (
+ PCI_LIB_ADDRESS (DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ 0,
+ R_PCH_LPC_BIOS_CNTL),
+ (UINT8) (~B_PCH_LPC_BIOS_CNTL_BIOSWE)
+ );
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/Spi/Pei/PchSpi.dxs b/ReferenceCode/Chipset/LynxPoint/Spi/Pei/PchSpi.dxs
new file mode 100644
index 0000000..a2a2f80
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Spi/Pei/PchSpi.dxs
@@ -0,0 +1,39 @@
+/** @file
+ Dependency expression source file.
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "PeimDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+#endif
+
+DEPENDENCY_START
+ TRUE
+DEPENDENCY_END
diff --git a/ReferenceCode/Chipset/LynxPoint/Spi/Pei/PchSpi.h b/ReferenceCode/Chipset/LynxPoint/Spi/Pei/PchSpi.h
new file mode 100644
index 0000000..d7be0a2
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Spi/Pei/PchSpi.h
@@ -0,0 +1,74 @@
+/** @file
+ Header file for the PCH SPI Runtime Driver.
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PCH_SPI_H_
+#define _PCH_SPI_H_
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#include EFI_PPI_PRODUCER (Spi)
+#include "SpiCommon.h"
+#endif
+
+typedef struct {
+ EFI_PEI_PPI_DESCRIPTOR PpiDescriptor;
+ SPI_INSTANCE SpiInstance;
+} PEI_SPI_INSTANCE;
+
+/**
+ This function is a hook for Spi Pei phase specific initialization
+
+ @param[in] None
+
+ @retval None
+**/
+VOID
+EFIAPI
+SpiPhaseInit (
+ VOID
+ );
+
+/**
+ This function is a hook for Spi to disable BIOS Write Protect
+
+ @param[in] None
+
+ @retval None
+**/
+VOID
+EFIAPI
+DisableBiosWriteProtect (
+ VOID
+ );
+
+/**
+ This function is a hook for Spi to enable BIOS Write Protect
+
+ @param[in] None
+
+ @retval None
+**/
+VOID
+EFIAPI
+EnableBiosWriteProtect (
+ VOID
+ );
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Spi/Pei/PchSpiPeim.cif b/ReferenceCode/Chipset/LynxPoint/Spi/Pei/PchSpiPeim.cif
new file mode 100644
index 0000000..e6e60c4
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Spi/Pei/PchSpiPeim.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "PchSpiPeim"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\Spi\Pei"
+ RefName = "PchSpiPeim"
+[files]
+"PchSpiPeim.sdl"
+"PchSpiPeim.mak"
+"PchSpi.c"
+"PchSpi.h"
+"PchSpi.dxs"
+"PchSpiPeim.inf"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/Spi/Pei/PchSpiPeim.inf b/ReferenceCode/Chipset/LynxPoint/Spi/Pei/PchSpiPeim.inf
new file mode 100644
index 0000000..44d0485
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Spi/Pei/PchSpiPeim.inf
@@ -0,0 +1,83 @@
+## @file
+# Component description file for the SPI PEIM.
+#
+#@copyright
+# Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = PchSpiPeim
+FILE_GUID = AA652CB9-2D52-4624-9FAE-D4E58B67CA46
+COMPONENT_TYPE = PE32_PEIM
+
+[sources.common]
+ PchSpi.h
+ PchSpi.c
+ ../Common/SpiCommon.c
+
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGluePeimEntryPoint.c
+
+
+[includes.common]
+ .
+ ../Common
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[libraries.common]
+ $(PROJECT_PCH_FAMILY)PpiLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueBaseMemoryLib
+ EdkIIGluePeiDebugLibReportStatusCode
+ EdkIIGluePeiReportStatusCodeLib
+ EdkIIGluePeiServicesLib
+ EdkIIGluePeiMemoryAllocationLib
+ EdkIIGlueBasePciLibPciExpress
+ EdkPpiLib
+ PchPlatformLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = PchSpi.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=InstallPchSpi
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_PEI_SERVICES_LIB__ \
+ -D __EDKII_GLUE_PEI_MEMORY_ALLOCATION_LIB__ \
+ -D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__
diff --git a/ReferenceCode/Chipset/LynxPoint/Spi/Pei/PchSpiPeim.mak b/ReferenceCode/Chipset/LynxPoint/Spi/Pei/PchSpiPeim.mak
new file mode 100644
index 0000000..5504366
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Spi/Pei/PchSpiPeim.mak
@@ -0,0 +1,99 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSpiPeim/PchSpiPeim.mak 2 2/24/12 2:24a Victortu $
+#
+# $Revision: 2 $
+#
+# $Date: 2/24/12 2:24a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSpiPeim/PchSpiPeim.mak $
+#
+# 2 2/24/12 2:24a Victortu
+# Updated to support 4.6.5.3_IntelEDK_1117_Patch7_00.
+#
+# 1 2/08/12 9:23a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+
+#---------------------------------------------------------------------------
+# Create PchSpiPeim Driver
+#---------------------------------------------------------------------------
+EDK : PchSpiPeim
+PchSpiPeim : $(BUILD_DIR)\PchSpiPeim.mak PchSpiPeimBin
+
+
+$(BUILD_DIR)\PchSpiPeim.mak : $(PchSpiPeim_DIR)\$(@B).cif $(PchSpiPeim_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(PchSpiPeim_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+PchSpiPeim_INCLUDES=\
+ $(PCH_SPI_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+
+PchSpiPeim_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=InstallPchSpi"\
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_PEI_SERVICES_LIB__ \
+ /D __EDKII_GLUE_PEI_MEMORY_ALLOCATION_LIB__ \
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__
+
+PchSpiPeim_LIB_LINKS =\
+ $(PchPlatformPeiLib_LIB)\
+ $(PchSpiCommonPeiLib_LIB)\
+ $(IntelPchPpiLib_LIB)\
+ $(IntelPchPpiLib_BIN)\
+ $(EDKFRAMEWORKGUIDLIB)\
+ $(EdkIIGlueBaseLibIA32_LIB)\
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGluePeiDebugLibReportStatusCode_LIB)\
+ $(EdkIIGluePeiReportStatusCodeLib_LIB)\
+ $(EdkIIGluePeiServicesLib_LIB)\
+ $(EdkIIGluePeiMemoryAllocationLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+
+PchSpiPeimBin: $(PchSpiPeim_LIB_LINKS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\PchSpiPeim.mak all\
+ NAME=PchSpiPeim\
+ MAKEFILE=$(BUILD_DIR)\PchSpiPeim.mak \
+ GUID=AA652CB9-2D52-4624-9FAE-D4E58B67CA46\
+ "MY_INCLUDES=$(PchSpiPeim_INCLUDES)"\
+ "MY_DEFINES=$(MY_DEFINES) $(PchSpiPeim_DEFINES)"\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=PEIM \
+ EDKIIModule=PEIM\
+ DEPEX1=$(PchSpiPeim_DIR)\PchSpi.dxs DEPEX1_TYPE=EFI_SECTION_PEI_DEPEX \
+ COMPRESS=0
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Spi/Pei/PchSpiPeim.sdl b/ReferenceCode/Chipset/LynxPoint/Spi/Pei/PchSpiPeim.sdl
new file mode 100644
index 0000000..526a272
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Spi/Pei/PchSpiPeim.sdl
@@ -0,0 +1,67 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSpiPeim/PchSpiPeim.sdl 1 2/08/12 9:23a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 9:23a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSpiPeim/PchSpiPeim.sdl $
+#
+# 1 2/08/12 9:23a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+TOKEN
+ Name = "PchSpiPeim_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable PchSpiPeim support in Project"
+End
+
+PATH
+ Name = "PchSpiPeim_DIR"
+ Help = "PchSpiPeim file source directory"
+End
+
+MODULE
+ File = "PchSpiPeim.mak"
+ Help = "Includes PchSpiPeim.mak to Project"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PchSpiPeim.ffs"
+ Parent = "FV_BB"
+ InvokeOrder = AfterParent
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Spi/RuntimeDxe/PchSpi.c b/ReferenceCode/Chipset/LynxPoint/Spi/RuntimeDxe/PchSpi.c
new file mode 100644
index 0000000..b833b63
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Spi/RuntimeDxe/PchSpi.c
@@ -0,0 +1,322 @@
+/** @file
+ PCH SPI Runtime Driver implements the SPI Host Controller Compatibility Interface.
+
+@copyright
+ Copyright (c) 2004 - 2015 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "PchSpi.h"
+
+///
+/// Global variables
+///
+SPI_INSTANCE *mSpiInstance;
+EFI_SPI_DATA_PROTOCOL mSpiDataInfoProtocol;
+
+static CONST UINT32 mSpiRegister[] = {
+ R_PCH_SPI_SSFS,
+ R_PCH_SPI_PREOP,
+ R_PCH_SPI_OPMENU,
+ R_PCH_SPI_OPMENU + 4,
+ R_PCH_SPI_VSCC0,
+ R_PCH_SPI_VSCC1
+};
+
+//
+// Function implementations
+//
+
+/**
+ Fixup internal data pointers so that the services can be called in virtual mode.
+
+ @param[in] Event The event registered.
+ @param[in] Context Event context. Not used in this event handler.
+
+ @retval None.
+**/
+EFI_RUNTIMESERVICE
+VOID
+PchSpiVirtualAddressChangeEvent (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ gRT->ConvertPointer (EFI_INTERNAL_POINTER, (VOID *) &(mSpiInstance->PchRootComplexBar));
+ gRT->ConvertPointer (EFI_INTERNAL_POINTER, (VOID *) &(mSpiInstance->SpiProtocol.Init));
+ gRT->ConvertPointer (EFI_INTERNAL_POINTER, (VOID *) &(mSpiInstance->SpiProtocol.Execute));
+ gRT->ConvertPointer (EFI_INTERNAL_POINTER, (VOID *) &(mSpiInstance->SpiDescriptor));
+ gRT->ConvertPointer (EFI_INTERNAL_POINTER, (VOID *) &(mSpiInstance));
+}
+
+/**
+ Entry point for the SPI host controller driver.
+
+ @param[in] ImageHandle Image handle of this driver.
+ @param[in] SystemTable Global system service table.
+
+ @retval EFI_SUCCESS Initialization complete.
+ @exception EFI_UNSUPPORTED The chipset is unsupported by this driver.
+ @retval EFI_OUT_OF_RESOURCES Do not have enough resources to initialize the driver.
+ @retval EFI_DEVICE_ERROR Device error, driver exits abnormally.
+**/
+EFI_STATUS
+EFIAPI
+InstallPchSpi (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ UINT64 BaseAddress;
+ UINT64 Length;
+ EFI_GCD_MEMORY_SPACE_DESCRIPTOR GcdMemorySpaceDescriptor;
+ EFI_GCD_MEMORY_SPACE_DESCRIPTOR LpcMemorySpaceDescriptor;
+ UINT64 Attributes;
+
+ DEBUG ((EFI_D_INFO, "InstallPchSpi() Start\n"));
+
+ Status = PciLibConstructor ();
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Allocate Runtime memory for the SPI protocol instance.
+ ///
+ mSpiInstance = AllocateRuntimeZeroPool (sizeof (SPI_INSTANCE));
+ if (mSpiInstance == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ ///
+ /// Initialize the SPI protocol instance
+ ///
+ Status = SpiProtocolConstructor (mSpiInstance);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ ///
+ /// Install the EFI_SPI_PROTOCOL interface
+ ///
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &(mSpiInstance->Handle),
+ &gEfiSpiProtocolGuid,
+ &(mSpiInstance->SpiProtocol),
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ FreePool (mSpiInstance);
+ return EFI_DEVICE_ERROR;
+ }
+ ///
+ /// Set RCBA space in GCD to be RUNTIME so that the range will be supported in
+ /// virtual address mode in EFI aware OS runtime.
+ /// It will assert if RCBA Memory Space is not allocated
+ /// The caller is responsible for the existence and allocation of the RCBA Memory Spaces
+ ///
+ BaseAddress = (EFI_PHYSICAL_ADDRESS) (mSpiInstance->PchRootComplexBar);
+ Length = 0x4000;
+
+ Status = gDS->GetMemorySpaceDescriptor (BaseAddress, &GcdMemorySpaceDescriptor);
+ ASSERT_EFI_ERROR (Status);
+
+ Attributes = GcdMemorySpaceDescriptor.Attributes | EFI_MEMORY_RUNTIME;
+
+ Status = gDS->SetMemorySpaceAttributes (
+ BaseAddress,
+ Length,
+ Attributes
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// LPC memory space
+ ///
+ BaseAddress = MmPciAddress(0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ 0
+ );
+ Length = 4096;
+
+ Status = gDS->GetMemorySpaceDescriptor (BaseAddress, &LpcMemorySpaceDescriptor);
+ ASSERT_EFI_ERROR (Status);
+
+ Attributes = LpcMemorySpaceDescriptor.Attributes | EFI_MEMORY_RUNTIME;
+
+ Status = gDS->SetMemorySpaceAttributes (
+ BaseAddress,
+ Length,
+ Attributes
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ Status = PciLibRegisterMemory (
+ PCI_LIB_ADDRESS (DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ 0),
+ (UINTN) Length
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ DEBUG ((EFI_D_INFO, "InstallPchSpi() End\n"));
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Save SPI VSCC0/VSCC1 register into S3 resume script table.
+
+ @param[in] Event The event that triggered this notification function
+ @param[in] ParentImageHandle Pointer to the notification functions context
+**/
+VOID
+EFIAPI
+VsccS3SaveRestore (
+ IN EFI_EVENT Event,
+ IN VOID *ParentImageHandle
+ )
+{
+ EFI_STATUS Status;
+ EFI_BOOT_SCRIPT_SAVE_PROTOCOL *BootScriptSave;
+ UINTN Index;
+
+ ///
+ /// Check whether this is real BootScriptSave notification, or just a SignalEvent
+ ///
+ Status = gBS->LocateProtocol (&gEfiBootScriptSaveGuid, NULL, (VOID **) &BootScriptSave);
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+ ///
+ /// Closed the event to avoid call twice when launch shell
+ ///
+ gBS->CloseEvent (Event);
+
+ ///
+ /// Save SPI Registers for S3 resume usage
+ ///
+ INITIALIZE_SCRIPT (ParentImageHandle, gST);
+
+ for (Index = 0; Index < sizeof (mSpiRegister) / sizeof (UINT32); Index++) {
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (mSpiInstance->PchRootComplexBar + mSpiRegister[Index]),
+ 1,
+ (VOID *) (UINTN) (mSpiInstance->PchRootComplexBar + mSpiRegister[Index])
+ );
+ }
+
+ return;
+}
+
+/**
+ This function is a hook for Spi Dxe phase specific initialization
+
+ @param[in] None
+
+ @retval None
+**/
+VOID
+EFIAPI
+SpiPhaseInit (
+ VOID
+ )
+{
+ VOID *Registration;
+ EFI_STATUS Status;
+
+ ///
+ /// Create event for the SPI flash VSCC registers S3 save/restore.
+ ///
+ EfiCreateProtocolNotifyEvent (
+ &gEfiBootScriptSaveGuid,
+ TPL_CALLBACK,
+ VsccS3SaveRestore,
+ NULL,
+ &Registration
+ );
+
+ ///
+ /// Initialize and Install the SPI Data protocol
+ ///
+ mSpiDataInfoProtocol.BiosSize = mSpiInstance->SpiInitTable.BiosSize;
+ mSpiDataInfoProtocol.BiosStartMemoryAddress = SIZE_4GB - mSpiDataInfoProtocol.BiosSize;
+
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &(mSpiInstance->Handle),
+ &gEfiSpiDataProtocolGuid,
+ &mSpiDataInfoProtocol,
+ NULL
+ );
+ if (EFI_ERROR(Status))
+ {
+ ASSERT(FALSE);
+ }
+
+ return;
+}
+
+/**
+ This function is a hook for Spi to disable BIOS Write Protect
+
+ @param[in] None
+
+ @retval None
+**/
+VOID
+EFIAPI
+DisableBiosWriteProtect (
+ VOID
+ )
+{
+ ///
+ /// Enable the access to the BIOS space for both read and write cycles
+ ///
+ PciOr8 (
+ PCI_LIB_ADDRESS (DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_BIOS_CNTL),
+ (UINT8) (B_PCH_LPC_BIOS_CNTL_BIOSWE)
+ );
+}
+
+/**
+ This function is a hook for Spi to enable BIOS Write Protect
+
+ @param[in] None
+
+ @retval None
+**/
+VOID
+EFIAPI
+EnableBiosWriteProtect (
+ VOID
+ )
+{
+ ///
+ /// Disable the access to the BIOS space for write cycles
+ ///
+ PciAnd8 (
+ PCI_LIB_ADDRESS (DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_BIOS_CNTL),
+ (UINT8) (~B_PCH_LPC_BIOS_CNTL_BIOSWE)
+ );
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/Spi/RuntimeDxe/PchSpi.dxs b/ReferenceCode/Chipset/LynxPoint/Spi/RuntimeDxe/PchSpi.dxs
new file mode 100644
index 0000000..7a9a510
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Spi/RuntimeDxe/PchSpi.dxs
@@ -0,0 +1,39 @@
+/** @file
+ Dependency expression source file.
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "DxeDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+#endif
+
+DEPENDENCY_START
+ TRUE
+DEPENDENCY_END
diff --git a/ReferenceCode/Chipset/LynxPoint/Spi/RuntimeDxe/PchSpi.h b/ReferenceCode/Chipset/LynxPoint/Spi/RuntimeDxe/PchSpi.h
new file mode 100644
index 0000000..aaee7fb
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Spi/RuntimeDxe/PchSpi.h
@@ -0,0 +1,92 @@
+/** @file
+ Header file for the PCH SPI Runtime Driver.
+
+@copyright
+ Copyright (c) 2004 - 2015 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PCH_SPI_H_
+#define _PCH_SPI_H_
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include EFI_PROTOCOL_PRODUCER (Spi)
+#include "SpiCommon.h"
+#include "DxeRuntimePciLibPciExpress.h"
+#include "EfiScriptLib.h"
+#include EFI_PROTOCOL_CONSUMER (BootScriptSave)
+#endif
+
+#define SIZE_4GB 0x0000000100000000ULL
+
+//
+// Function prototypes used by the SPI protocol.
+//
+
+/**
+ Fixup internal data pointers so that the services can be called in virtual mode.
+
+ @param[in] Event The event registered.
+ @param[in] Context Event context. Not used in this event handler.
+
+ @retval None.
+**/
+VOID
+PchSpiVirtualAddressChangeEvent (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ );
+
+/**
+ This function is a hook for Spi Dxe phase specific initialization
+
+ @param[in] None
+
+ @retval None
+**/
+VOID
+EFIAPI
+SpiPhaseInit (
+ VOID
+ );
+
+/**
+ This function is a hook for Spi to disable BIOS Write Protect
+
+ @param[in] None
+
+ @retval None
+**/
+VOID
+EFIAPI
+DisableBiosWriteProtect (
+ VOID
+ );
+
+/**
+ This function is a hook for Spi to enable BIOS Write Protect
+
+ @param[in] None
+
+ @retval None
+**/
+VOID
+EFIAPI
+EnableBiosWriteProtect (
+ VOID
+ );
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Spi/RuntimeDxe/PchSpiRuntime.cif b/ReferenceCode/Chipset/LynxPoint/Spi/RuntimeDxe/PchSpiRuntime.cif
new file mode 100644
index 0000000..f721bd8
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Spi/RuntimeDxe/PchSpiRuntime.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "PchSpiRuntime"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\Spi\RuntimeDxe"
+ RefName = "PchSpiRuntime"
+[files]
+"PchSpiRuntime.sdl"
+"PchSpiRuntime.mak"
+"PchSpi.c"
+"PchSpi.h"
+"PchSpi.dxs"
+"PchSpiRuntime.inf"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/Spi/RuntimeDxe/PchSpiRuntime.inf b/ReferenceCode/Chipset/LynxPoint/Spi/RuntimeDxe/PchSpiRuntime.inf
new file mode 100644
index 0000000..cd4ced8
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Spi/RuntimeDxe/PchSpiRuntime.inf
@@ -0,0 +1,91 @@
+## @file
+# Component description file for the SPI Runtime driver.
+#
+#@copyright
+# Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = PchSpiRuntime
+FILE_GUID = C194C6EA-B68C-4981-B64B-9BD271474B20
+COMPONENT_TYPE = RT_DRIVER
+
+[sources.common]
+ PchSpi.h
+ PchSpi.c
+ ../Common/SpiCommon.c
+
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueDxeDriverEntryPoint.c
+
+
+[includes.common]
+ .
+ ../Common
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include/Library
+
+[libraries.common]
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueBaseMemoryLib
+ EdkIIGlueSmmRuntimeDxeReportStatusCodeLib
+ EdkIIGlueEdkDxeRuntimeDriverLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueDxeMemoryAllocationLib
+ EdkIIGlueDxeServicesTableLib
+ EdkProtocolLib
+ $(PROJECT_PCH_FAMILY)ProtocolLib
+ PchDxeRuntimePciLibPciExpress
+ PchPlatformLib
+ EfiScriptLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = PchSpi.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=InstallPchSpi
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT_HANDLER__=PchSpiVirtualAddressChangeEvent
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_SMM_RUNTIME_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ -D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \ No newline at end of file
diff --git a/ReferenceCode/Chipset/LynxPoint/Spi/RuntimeDxe/PchSpiRuntime.mak b/ReferenceCode/Chipset/LynxPoint/Spi/RuntimeDxe/PchSpiRuntime.mak
new file mode 100644
index 0000000..39646e9
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Spi/RuntimeDxe/PchSpiRuntime.mak
@@ -0,0 +1,113 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSpiRuntime/PchSpiRuntime.mak 2 2/24/12 2:27a Victortu $
+#
+# $Revision: 2 $
+#
+# $Date: 2/24/12 2:27a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSpiRuntime/PchSpiRuntime.mak $
+#
+# 2 2/24/12 2:27a Victortu
+# Updated to support 4.6.5.3_IntelEDK_1117_Patch7_00.
+#
+# 1 2/08/12 9:26a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+
+#---------------------------------------------------------------------------
+# Create PchSpiRuntime Driver
+#---------------------------------------------------------------------------
+EDK : PchSpiRuntime
+PchSpiRuntime : $(BUILD_DIR)\PchSpiRuntime.mak PchSpiRuntimeBin
+
+
+$(BUILD_DIR)\PchSpiRuntime.mak : $(PchSpiRuntime_DIR)\$(@B).cif $(PchSpiRuntime_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(PchSpiRuntime_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+PchSpiRuntime_INCLUDES=\
+ $(INTEL_PCH_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(EDK_INCLUDES)\
+ $(PCH_SPI_INCLUDES)\
+
+PchSpiRuntime_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=InstallPchSpi"\
+ /D "__EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT_HANDLER__=PchSpiVirtualAddressChangeEvent"\
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ /D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_SMM_RUNTIME_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+
+
+PchSpiRuntime_LIB_LINKS =\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGlueEdkDxeRuntimeDriverLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueDxeMemoryAllocationLib_LIB)\
+ $(EdkIIGlueDxeServicesTableLib_LIB)\
+ $(EDKPROTOCOLLIB)\
+ $(INTEL_PCH_PROTOCOL_LIB)\
+ $(DxeRuntimePciLibPciExpressLib_LIB)\
+ $(PchPlatformDxeLib_LIB)\
+ $(EFISCRIPTLIB)\
+ $(PchSpiCommonDxeLib_LIB)\
+ $(EdkIIGlueSmmRuntimeDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueUefiRuntimeServicesTableLib_LIB)\
+
+PchSpiRuntimeBin: $(PchSpiRuntime_LIB_LINKS)
+ $(ECHO) DEPENDENCY_START > $(BUILD_DIR)\Fake.dxs
+ $(ECHO) FALSE >> $(BUILD_DIR)\Fake.dxs
+ $(ECHO) DEPENDENCY_END >> $(BUILD_DIR)\Fake.dxs
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\PchSpiRuntime.mak all \
+ "MY_INCLUDES=$(PchSpiRuntime_INCLUDES)"\
+ "MY_DEFINES=$(PchSpiRuntime_DEFINES)"\
+ GUID=C194C6EA-B68C-4981-B64B-9BD271474B20\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=RT_DRIVER\
+ EDKIIModule=DXEDRIVER\
+ DEPEX1=$(BUILD_DIR)\Fake.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX\
+ COMPRESS=1
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Spi/RuntimeDxe/PchSpiRuntime.sdl b/ReferenceCode/Chipset/LynxPoint/Spi/RuntimeDxe/PchSpiRuntime.sdl
new file mode 100644
index 0000000..02546b0
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Spi/RuntimeDxe/PchSpiRuntime.sdl
@@ -0,0 +1,66 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSpiRuntime/PchSpiRuntime.sdl 1 2/08/12 9:25a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 9:25a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSpiRuntime/PchSpiRuntime.sdl $
+#
+# 1 2/08/12 9:25a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+TOKEN
+ Name = "PchSpiRuntime_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable PchSpiRuntime support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "PchSpiRuntime_DIR"
+End
+
+MODULE
+ File = "PchSpiRuntime.mak"
+ Help = "Includes PchSpiRuntime to Project"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PchSpiRuntime.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Spi/Smm/PchSpi.c b/ReferenceCode/Chipset/LynxPoint/Spi/Smm/PchSpi.c
new file mode 100644
index 0000000..9c041ad
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Spi/Smm/PchSpi.c
@@ -0,0 +1,244 @@
+/** @file
+ PCH SPI SMM Driver implements the SPI Host Controller Compatibility Interface.
+
+@copyright
+ Copyright (c) 2008 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "PchSpi.h"
+
+//
+// Global variables
+//
+EFI_SMM_BASE_PROTOCOL *mSmmBase;
+EFI_SMM_SYSTEM_TABLE *mSmst;
+SPI_INSTANCE *mSpiInstance;
+
+/**
+ Entry point for the SPI host controller driver.
+
+ @param[in] ImageHandle Image handle of this driver.
+ @param[in] SystemTable Global system service table.
+
+ @retval EFI_SUCCESS Initialization complete.
+ @exception EFI_UNSUPPORTED The chipset is unsupported by this driver.
+ @retval EFI_OUT_OF_RESOURCES Do not have enough resources to initialize the driver.
+ @retval EFI_DEVICE_ERROR Device error, driver exits abnormally.
+**/
+EFI_STATUS
+EFIAPI
+InstallPchSpi (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+
+ ///
+ /// Locate SMM Base Protocol
+ ///
+ Status = gBS->LocateProtocol (&gEfiSmmBaseProtocolGuid, NULL, (VOID **) &mSmmBase);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Initialize our module variables
+ ///
+ Status = mSmmBase->GetSmstLocation (mSmmBase, &mSmst);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Allocate pool for SPI protocol instance
+ ///
+ Status = mSmst->SmmAllocatePool (
+ EfiRuntimeServicesData, /// MemoryType don't care
+ sizeof (SPI_INSTANCE),
+ (VOID **) &mSpiInstance
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ if (mSpiInstance == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ ZeroMem ((VOID *) mSpiInstance, sizeof (SPI_INSTANCE));
+ ///
+ /// Initialize the SPI protocol instance
+ ///
+ Status = SpiProtocolConstructor (mSpiInstance);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ ///
+ /// Install the SMM EFI_SPI_PROTOCOL interface
+ ///
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &(mSpiInstance->Handle),
+ &gEfiSmmSpiProtocolGuid,
+ &(mSpiInstance->SpiProtocol),
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ mSmst->SmmFreePool (mSpiInstance);
+ return EFI_DEVICE_ERROR;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This function is a a hook for Spi Smm phase specific initialization
+
+ @param[in] None
+
+ @retval None
+**/
+VOID
+EFIAPI
+SpiPhaseInit (
+ VOID
+ )
+{
+ UINTN Index;
+ static CONST UINT32 SpiRegister[] = {
+ R_PCH_SPI_SSFS,
+ R_PCH_SPI_PREOP,
+ R_PCH_SPI_OPMENU,
+ R_PCH_SPI_OPMENU + 4,
+ R_PCH_SPI_VSCC0,
+ R_PCH_SPI_VSCC1
+ };
+
+ ///
+ /// Save SPI Registers for S3 resume usage
+ ///
+ for (Index = 0; Index < sizeof (SpiRegister) / sizeof (UINT32); Index++) {
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (mSpiInstance->PchRootComplexBar + SpiRegister[Index]),
+ 1,
+ (VOID *) (UINTN) (mSpiInstance->PchRootComplexBar + SpiRegister[Index])
+ );
+ }
+}
+
+/**
+ This function is a hook for Spi to disable BIOS Write Protect
+
+ @param[in] None
+
+ @retval None
+**/
+VOID
+EFIAPI
+DisableBiosWriteProtect (
+ VOID
+ )
+{
+ UINT8 Data8;
+ UINT32 Data32;
+
+ ///
+ /// Set BIOSWE bit (B0:D31:F0 Offset DCh [0]) = 1b
+ ///
+ PciOr8 (
+ PCI_LIB_ADDRESS (DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ 0,
+ R_PCH_LPC_BIOS_CNTL),
+ (UINT8) (B_PCH_LPC_BIOS_CNTL_BIOSWE)
+ );
+ ///
+ /// PCH BIOS Spec Rev 0.5.0, Section 3.7 BIOS Region SMM Protection Enabling
+ /// If the following steps are implemented:
+ /// - Set the SMM_BWP bit (B0:D31:F0 Offset DCh [5]) = 1b
+ /// - Follow the 1st recommendation in section 3.6
+ /// the BIOS Region can only be updated by following the steps bellow:
+ /// - Once all threads enter SMM
+ /// - Read memory location FED30880h OR with 00000001h, place the result in EAX,
+ /// and write data to lower 32 bits of MSR 1FEh (sample code available)
+ /// - Set BIOSWE bit (B0:D31:F0 Offset DCh [0]) = 1b
+ /// - Modify BIOS Region
+ /// - Clear BIOSWE bit (B0:D31:F0 Offset DCh [0]) = 0b
+ /// - Read memory location FED30880h AND with FFFFFFFEh, place the result in EAX,
+ /// and write data to lower 32 bits of MSR 1FEh (sample code available)
+ ///
+ Data8 = PciRead8 (
+ PCI_LIB_ADDRESS (DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ 0,
+ R_PCH_LPC_BIOS_CNTL)
+ );
+ ///
+ /// Check if SMM_BWP bit is set
+ ///
+ if ((Data8 & B_PCH_LPC_BIOS_CNTL_SMM_BWP) == B_PCH_LPC_BIOS_CNTL_SMM_BWP) {
+ ///
+ /// Read memory location FED30880h OR with 00000001h, place the result in EAX,
+ /// and write data to lower 32 bits of MSR 1FEh (sample code available)
+ ///
+ Data32 = MmioRead32 ((UINTN) (0xFED30880)) | (UINT32) (BIT0);
+ AsmWriteMsr32 (0x1FE, Data32);
+ }
+}
+
+/**
+ This function is a hook for Spi to enable BIOS Write Protect
+
+ @param[in] None
+
+ @retval None
+**/
+VOID
+EFIAPI
+EnableBiosWriteProtect (
+ VOID
+ )
+{
+ UINT8 Data8;
+ UINT32 Data32;
+
+ ///
+ /// Clear BIOSWE bit (B0:D31:F0 Offset DCh [0]) = 0b
+ ///
+ PciAnd8 (
+ PCI_LIB_ADDRESS (DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ 0,
+ R_PCH_LPC_BIOS_CNTL),
+ (UINT8) (~B_PCH_LPC_BIOS_CNTL_BIOSWE)
+ );
+
+ Data8 = PciRead8 (
+ PCI_LIB_ADDRESS (DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ 0,
+ R_PCH_LPC_BIOS_CNTL)
+ );
+ ///
+ /// Check if SMM_BWP bit is set
+ ///
+ if ((Data8 & B_PCH_LPC_BIOS_CNTL_SMM_BWP) == B_PCH_LPC_BIOS_CNTL_SMM_BWP) {
+ ///
+ /// Read memory location FED30880h AND with FFFFFFFEh, place the result in EAX,
+ /// and write data to lower 32 bits of MSR 1FEh (sample code available)
+ ///
+ Data32 = MmioRead32 ((UINTN) (0xFED30880)) & (UINT32) (~BIT0);
+ AsmWriteMsr32 (0x1FE, Data32);
+ }
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/Spi/Smm/PchSpi.dxs b/ReferenceCode/Chipset/LynxPoint/Spi/Smm/PchSpi.dxs
new file mode 100644
index 0000000..0f2e9b0
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Spi/Smm/PchSpi.dxs
@@ -0,0 +1,45 @@
+/** @file
+ Dependency expression source file.
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "DxeDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+
+#include EFI_PROTOCOL_DEFINITION (SmmBase)
+#include EFI_PROTOCOL_DEFINITION (BootScriptSave)
+#include EFI_PROTOCOL_DEFINITION (Pfat)
+#endif
+
+DEPENDENCY_START
+#ifdef EFI_S3_RESUME
+ EFI_BOOT_SCRIPT_SAVE_PROTOCOL_GUID AND
+#endif
+ EFI_SMM_BASE_PROTOCOL_GUID
+DEPENDENCY_END
diff --git a/ReferenceCode/Chipset/LynxPoint/Spi/Smm/PchSpi.h b/ReferenceCode/Chipset/LynxPoint/Spi/Smm/PchSpi.h
new file mode 100644
index 0000000..1f9244e
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Spi/Smm/PchSpi.h
@@ -0,0 +1,76 @@
+/** @file
+ Header file for the PCH SPI SMM Driver.
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PCH_SPI_H_
+#define _PCH_SPI_H_
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include EFI_PROTOCOL_PRODUCER (Spi)
+#include "SpiCommon.h"
+#include "EfiScriptLib.h"
+
+//
+// Driver Dependency Protocols
+//
+#include EFI_PROTOCOL_DEPENDENCY (SmmBase)
+#include EFI_PROTOCOL_CONSUMER (BootScriptSave)
+#endif
+
+/**
+ This function is a a hook for Spi Smm phase specific initialization
+
+ @param[in] None
+
+ @retval None
+**/
+VOID
+EFIAPI
+SpiPhaseInit (
+ VOID
+ );
+
+/**
+ This function is a hook for Spi to disable BIOS Write Protect
+
+ @param[in] None
+
+ @retval None
+**/
+VOID
+EFIAPI
+DisableBiosWriteProtect (
+ VOID
+ );
+
+/**
+ This function is a hook for Spi to enable BIOS Write Protect
+
+ @param[in] None
+
+ @retval None
+**/
+VOID
+EFIAPI
+EnableBiosWriteProtect (
+ VOID
+ );
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Spi/Smm/PchSpiSmm.cif b/ReferenceCode/Chipset/LynxPoint/Spi/Smm/PchSpiSmm.cif
new file mode 100644
index 0000000..8ae77f5
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Spi/Smm/PchSpiSmm.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "PchSpiSmm"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\Spi\Smm"
+ RefName = "PchSpiSmm"
+[files]
+"PchSpiSmm.sdl"
+"PchSpiSmm.mak"
+"PchSpi.c"
+"PchSpi.h"
+"PchSpi.dxs"
+"PchSpiSmm.inf"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/Spi/Smm/PchSpiSmm.inf b/ReferenceCode/Chipset/LynxPoint/Spi/Smm/PchSpiSmm.inf
new file mode 100644
index 0000000..5fe34a2
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Spi/Smm/PchSpiSmm.inf
@@ -0,0 +1,92 @@
+## @file
+# Component description file for the SPI SMM driver.
+#
+#@copyright
+# Copyright (c) 2008 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = PchSpiSmm
+FILE_GUID = 27F4917B-A707-4aad-9676-26DF168CBF0D
+COMPONENT_TYPE = BS_DRIVER
+
+[sources.common]
+ PchSpi.h
+ PchSpi.c
+ ../Common/SpiCommon.c
+
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueSmmDriverEntryPoint.c
+
+
+[includes.common]
+ .
+ ../Common
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[libraries.common]
+ EdkIIGlueBaseLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueBaseMemoryLib
+ EdkIIGlueSmmRuntimeDxeReportStatusCodeLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueDxeMemoryAllocationLib
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueUefiDevicePathLib
+ EdkIIGlueBasePciLibPciExpress
+ EdkFrameworkProtocolLib
+ EdkProtocolLib
+ $(PROJECT_PCH_FAMILY)ProtocolLib
+ PchPlatformLib
+ EfiScriptLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = PchSpi.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=InstallPchSpi
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ -D __EDKII_GLUE_SMM_RUNTIME_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_DEVICE_PATH_LIB__ \
+ -D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__
diff --git a/ReferenceCode/Chipset/LynxPoint/Spi/Smm/PchSpiSmm.mak b/ReferenceCode/Chipset/LynxPoint/Spi/Smm/PchSpiSmm.mak
new file mode 100644
index 0000000..9b15d4d
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Spi/Smm/PchSpiSmm.mak
@@ -0,0 +1,112 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSpiSmm/PchSpiSmm.mak 3 9/26/12 3:40a Victortu $
+#
+# $Revision: 3 $
+#
+# $Date: 9/26/12 3:40a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSpiSmm/PchSpiSmm.mak $
+#
+# 3 9/26/12 3:40a Victortu
+# Lynx Point PCH Chipset Framework Reference Code Beta 0.7.0
+#
+# 2 2/24/12 2:26a Victortu
+# Updated to support 4.6.5.3_IntelEDK_1117_Patch7_00.
+#
+# 1 2/08/12 9:24a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+
+#---------------------------------------------------------------------------
+# Create PchSpi SMM Driver
+#---------------------------------------------------------------------------
+EDK : PchSpiSmm
+PchSpiSmm : $(BUILD_DIR)\PchSpiSmm.mak PchSpiSmmBin
+
+
+$(BUILD_DIR)\PchSpiSmm.mak : $(PchSpiSmm_DIR)\$(@B).cif $(PchSpiSmm_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(PchSpiSmm_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+PchSpiSmm_INCLUDES=\
+ $(INTEL_PCH_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(PCH_SPI_INCLUDES)\
+ $(PROJECT_CPU_INCLUDES)\
+
+PchSpiSmm_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=InstallPchSpi"\
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_SMM_RUNTIME_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_UEFI_DEVICE_PATH_LIB__ \
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+ /D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+
+PchSpiSmm_LIB_LINKS =\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueSmmRuntimeDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueDxeMemoryAllocationLib_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueUefiDevicePathLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(EDKPROTOCOLLIB)\
+ $(INTEL_PCH_PROTOCOL_LIB)\
+ $(PchPlatformSmmLib_LIB)\
+ $(PchSpiCommonSmmLib_LIB)\
+ $(EFISCRIPTLIB)\
+ $(EdkIIGlueUefiRuntimeServicesTableLib_LIB)\
+
+PchSpiSmmBin: $(PchSpiSmm_LIB_LINKS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\PchSpiSmm.mak all \
+ "MY_INCLUDES=$(PchSpiSmm_INCLUDES)"\
+ "MY_DEFINES=$(PchSpiSmm_DEFINES)"\
+ GUID=27F4917B-A707-4aad-9676-26DF168CBF0D\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=BS_DRIVER\
+ EDKIIModule=SMMDRIVER\
+ DEPEX1=$(PchSpiSmm_DIR)\PchSpi.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX\
+ COMPRESS=1
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Spi/Smm/PchSpiSmm.sdl b/ReferenceCode/Chipset/LynxPoint/Spi/Smm/PchSpiSmm.sdl
new file mode 100644
index 0000000..5310706
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Spi/Smm/PchSpiSmm.sdl
@@ -0,0 +1,66 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSpiSmm/PchSpiSmm.sdl 1 2/08/12 9:24a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 9:24a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchSpiSmm/PchSpiSmm.sdl $
+#
+# 1 2/08/12 9:24a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+TOKEN
+ Name = "PchSpiSmm_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable PchSpi SMM support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "PchSpiSmm_DIR"
+End
+
+MODULE
+ File = "PchSpiSmm.mak"
+ Help = "Includes PchSpi to Project"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PchSpiSmm.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Usb/Pei/PchEhci.c b/ReferenceCode/Chipset/LynxPoint/Usb/Pei/PchEhci.c
new file mode 100644
index 0000000..e65e39e
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Usb/Pei/PchEhci.c
@@ -0,0 +1,229 @@
+/** @file
+ Pch Ehci PPI Init
+
+@copyright
+ Copyright (c) 2009 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "PchEhci.h"
+#include "PchPlatformLib.h"
+
+EFI_GUID mPeiEhciControllerPpiGuid = PEI_USB_CONTROLLER_PPI_GUID;
+
+///
+/// PPI interface function
+///
+STATIC
+EFI_STATUS
+EFIAPI
+GetEhciController (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_CONTROLLER_PPI *This,
+ IN UINT8 UsbControllerId,
+ OUT UINTN *ControllerType,
+ OUT UINTN *BaseAddress
+ );
+
+///
+/// Globals variable
+///
+STATIC PEI_USB_CONTROLLER_PPI mEhciControllerPpi = { GetEhciController };
+
+STATIC EFI_PEI_PPI_DESCRIPTOR mPpiList = {
+ (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+ &mPeiEhciControllerPpiGuid,
+ NULL
+};
+
+///
+/// Helper function
+///
+STATIC
+EFI_STATUS
+EnableEhciController (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PCH_EHCI_DEVICE *PeiPchEhciDev,
+ IN UINT8 UsbControllerId
+ );
+
+/**
+ Initialize PCH EHCI PEIM
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] UsbPolicyPpi PCH Usb Policy PPI
+
+ @retval EFI_SUCCESS The PCH EHCI PEIM is initialized successfully
+ @retval EFI_INVALID_PARAMETER UsbControllerId is out of range
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to create database
+ @retval Others All other error conditions encountered result in an ASSERT.
+**/
+EFI_STATUS
+InitForEHCI (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PCH_USB_POLICY_PPI *UsbPolicyPpi
+ )
+{
+ EFI_STATUS Status;
+ UINTN Index;
+ PCH_EHCI_DEVICE *PeiPchEhciDev;
+ EFI_BOOT_MODE BootMode;
+
+ DEBUG ((EFI_D_INFO, "InitForEHCI() Start\n"));
+
+ Status = (*PeiServices)->GetBootMode (PeiServices, &BootMode);
+
+ ///
+ /// We do not export this in S3 boot path, because it is only for recovery.
+ ///
+ if (BootMode == BOOT_ON_S3_RESUME) {
+ return EFI_SUCCESS;
+ }
+
+ PeiPchEhciDev = (PCH_EHCI_DEVICE *) AllocatePool (sizeof (PCH_EHCI_DEVICE));
+ if (PeiPchEhciDev == NULL) {
+ DEBUG ((EFI_D_ERROR, "Failed to allocate memory for PeiPchEhciDev! \n"));
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ PeiPchEhciDev->EhciControllerPpi = mEhciControllerPpi;
+ PeiPchEhciDev->PpiList = mPpiList;
+ PeiPchEhciDev->PpiList.Ppi = &PeiPchEhciDev->EhciControllerPpi;
+
+ PeiPchEhciDev->TotalEhciControllers = PchEhciControllerMax;
+
+ ///
+ /// Assign resources and enable EHCI controllers
+ ///
+ if (UsbPolicyPpi->EhciMemLength < (EHCI_MEMORY_SPACE * PeiPchEhciDev->TotalEhciControllers)) {
+ DEBUG ((EFI_D_ERROR, "The EhciMemLength got from UsbPolicyPpi is less than the required (%0x) !\n", (EHCI_MEMORY_SPACE * PeiPchEhciDev->TotalEhciControllers)));
+ return EFI_INVALID_PARAMETER;
+ }
+
+ for (Index = 0; Index < PeiPchEhciDev->TotalEhciControllers; Index++) {
+ PeiPchEhciDev->MemBase[Index] = UsbPolicyPpi->EhciMemBaseAddr + EHCI_MEMORY_SPACE * Index;
+ Status = EnableEhciController (PeiServices, PeiPchEhciDev, (UINT8) Index);
+ ASSERT_EFI_ERROR (Status);
+ }
+ ///
+ /// Install USB Controller PPI
+ ///
+ Status = PeiServicesInstallPpi (&PeiPchEhciDev->PpiList);
+
+ ASSERT_EFI_ERROR (Status);
+
+ DEBUG ((EFI_D_INFO, "InitForEHCI() End\n"));
+
+ return Status;
+
+}
+
+///
+/// PPI interface implementation
+///
+
+/**
+ Get EHCI controller information
+
+ @param[in] PeiServices General PEI services
+ @param[in] This Pointer to the PEI_EHCI_CONTROLLER_PPI
+ @param[in] UsbControllerId The USB controller number
+ @param[out] ControllerType Output: USB controller type
+ @param[out] BaseAddress Output: EHCI controller memory base address
+
+ @retval EFI_INVALID_PARAMETER UsbControllerId is out of range
+ @retval EFI_SUCCESS Function completes successfully
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+GetEhciController (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_CONTROLLER_PPI *This,
+ IN UINT8 UsbControllerId,
+ OUT UINTN *ControllerType,
+ OUT UINTN *BaseAddress
+ )
+{
+ PCH_EHCI_DEVICE *PeiPchEhciDev;
+
+ PeiPchEhciDev = PCH_EHCI_DEVICE_FROM_THIS (This);
+
+ if (UsbControllerId >= PeiPchEhciDev->TotalEhciControllers) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ *ControllerType = PEI_EHCI_CONTROLLER;
+
+ *BaseAddress = PeiPchEhciDev->MemBase[UsbControllerId];
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Enable the EHCI controller
+
+ @param[in] PeiServices The general PEI services
+ @param[in] PeiPchEhciDev The EHCI device
+ @param[in] UsbControllerId The USB Controller number
+
+ @retval EFI_INVALID_PARAMETER UsbControllerId is out of range
+ @retval EFI_SUCCESS The function completes successfully
+**/
+STATIC
+EFI_STATUS
+EnableEhciController (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PCH_EHCI_DEVICE *PeiPchEhciDev,
+ IN UINT8 UsbControllerId
+ )
+{
+ UINTN BaseAddress;
+ UINTN EhciAddress;
+ PCH_SERIES PchSeries;
+
+ PchSeries = GetPchSeries();
+ if (UsbControllerId >= PeiPchEhciDev->TotalEhciControllers) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ BaseAddress = PeiPchEhciDev->MemBase[UsbControllerId];
+
+ EhciAddress = EFI_UNSUPPORTED;
+ if (PchSeries == PchH) {
+ EhciAddress = PCH_H_PCIE_EHCI_ADDR (UsbControllerId);
+ } else if (PchSeries == PchLp) {
+ EhciAddress = PCH_LP_PCIE_EHCI_ADDR (UsbControllerId);
+ }
+
+ if (EhciAddress == EFI_UNSUPPORTED) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ ///
+ /// Assign base address register
+ ///
+ MmioWrite32 ((EhciAddress + R_PCH_EHCI_MEM_BASE), BaseAddress);
+
+ ///
+ /// Enable PCH EHCI register
+ ///
+ MmioOr16 (
+ (EhciAddress + R_PCH_EHCI_COMMAND_REGISTER),
+ (UINT16) (B_PCH_EHCI_COMMAND_BME | B_PCH_EHCI_COMMAND_MSE)
+ );
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/Usb/Pei/PchEhci.h b/ReferenceCode/Chipset/LynxPoint/Usb/Pei/PchEhci.h
new file mode 100644
index 0000000..3c97998
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Usb/Pei/PchEhci.h
@@ -0,0 +1,82 @@
+/** @file
+ Header file for the PCH EHCI PPI
+
+@copyright
+ Copyright (c) 2009 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PEI_PCH_EHCI_H
+#define _PEI_PCH_EHCI_H
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+
+//
+// Driver Produced PPI Prototypes
+//
+#include EFI_PPI_DEFINITION (UsbController)
+
+//
+// Driver Consumed PPI Prototypes
+//
+#include EFI_PPI_CONSUMER (PchUsbPolicy)
+#include "PchAccess.h"
+#include "PchUsb.h"
+#endif
+
+#define PCH_PCIE_EHCI1_BUS_DEV_FUNC MmPciAddress ( \
+ 0, \
+ DEFAULT_PCI_BUS_NUMBER_PCH, \
+ PCI_DEVICE_NUMBER_PCH_USB, \
+ PCI_FUNCTION_NUMBER_PCH_EHCI, \
+ 0 \
+ )
+
+#define PCH_PCIE_EHCI2_BUS_DEV_FUNC MmPciAddress ( \
+ 0, \
+ DEFAULT_PCI_BUS_NUMBER_PCH, \
+ PCI_DEVICE_NUMBER_PCH_USB_EXT, \
+ PCI_FUNCTION_NUMBER_PCH_EHCI2, \
+ 0 \
+ )
+
+#define PCH_H_PCIE_EHCI_ADDR(Controller) ( \
+ (Controller == PchEhci1) ? PCH_PCIE_EHCI1_BUS_DEV_FUNC : \
+ (Controller == PchEhci2) ? PCH_PCIE_EHCI2_BUS_DEV_FUNC : EFI_UNSUPPORTED \
+ )
+
+#define PCH_LP_PCIE_EHCI_ADDR(Controller) ( \
+ (Controller == PchEhci1) ? PCH_PCIE_EHCI1_BUS_DEV_FUNC : EFI_UNSUPPORTED \
+ )
+
+#define PEI_PCH_EHCI_SIGNATURE EFI_SIGNATURE_32 ('E', 'H', 'C', 'I')
+#define EHCI_MEMORY_SPACE 0x400
+
+typedef struct {
+ UINTN Signature;
+ PEI_USB_CONTROLLER_PPI EhciControllerPpi;
+ EFI_PEI_PPI_DESCRIPTOR PpiList;
+ UINTN TotalEhciControllers;
+ UINTN MemBase[PchEhciControllerMax];
+} PCH_EHCI_DEVICE;
+
+#define PCH_EHCI_DEVICE_FROM_THIS(a) PEI_CR (a, PCH_EHCI_DEVICE, EhciControllerPpi, PEI_PCH_EHCI_SIGNATURE)
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Usb/Pei/PchUsb.c b/ReferenceCode/Chipset/LynxPoint/Usb/Pei/PchUsb.c
new file mode 100644
index 0000000..493f5e6
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Usb/Pei/PchUsb.c
@@ -0,0 +1,77 @@
+/** @file
+ Pch Usb Pei Init
+
+@copyright
+ Copyright (c) 2009 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "PchUsb.h"
+
+/**
+ Initialize PCH USB PEIM
+
+ @param[in] FfsHeader Not used.
+ @param[in] PeiServices General purpose services available to every PEIM.
+
+ @retval EFI_SUCCESS The PCH USB PEIM is initialized successfully
+ @retval Others All other error conditions encountered result in an ASSERT.
+**/
+EFI_STATUS
+InitializePchUsb (
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_STATUS Status;
+ PCH_USB_POLICY_PPI *UsbPolicyPpi;
+
+ DEBUG ((EFI_D_INFO, "InitializePchUsb() Start\n"));
+
+ ///
+ /// Locate UsbPolicy PPI
+ ///
+ Status = (**PeiServices).LocatePpi (
+ PeiServices,
+ &gPchUsbPolicyPpiGuid,
+ 0,
+ NULL,
+ (VOID **) &UsbPolicyPpi
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ if (Status == EFI_SUCCESS) {
+ ///
+ /// Enable USB controller and install PeiUsbControllerPpi for USB recovery function
+ ///
+ switch (UsbPolicyPpi->Mode) {
+ case EHCI_MODE:
+ DEBUG ((EFI_D_ERROR, "Usb Recovery Mode : EHCI !\n"));
+ DEBUG ((EFI_D_ERROR, "EhciMemBaseAddr:%0x!\n", UsbPolicyPpi->EhciMemBaseAddr));
+ DEBUG ((EFI_D_ERROR, "EhciMemLength:%0x!\n", UsbPolicyPpi->EhciMemLength));
+ InitForEHCI (PeiServices, UsbPolicyPpi);
+ break;
+
+ default:
+ ASSERT_EFI_ERROR (EFI_INVALID_PARAMETER);
+ break;
+ }
+ }
+
+ DEBUG ((EFI_D_INFO, "InitializePchUsb() End\n"));
+
+ return Status;
+
+} \ No newline at end of file
diff --git a/ReferenceCode/Chipset/LynxPoint/Usb/Pei/PchUsb.cif b/ReferenceCode/Chipset/LynxPoint/Usb/Pei/PchUsb.cif
new file mode 100644
index 0000000..277bd21
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Usb/Pei/PchUsb.cif
@@ -0,0 +1,15 @@
+<component>
+ name = "PchUsb"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\Usb\Pei"
+ RefName = "PchUsb"
+[files]
+"PchUsb.sdl"
+"PchUsb.mak"
+"PchUsb.dxs"
+"PchEhci.c"
+"PchEhci.h"
+"PchUsb.c"
+"PchUsb.h"
+"PchUsb.inf"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/Usb/Pei/PchUsb.dxs b/ReferenceCode/Chipset/LynxPoint/Usb/Pei/PchUsb.dxs
new file mode 100644
index 0000000..34d58dd
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Usb/Pei/PchUsb.dxs
@@ -0,0 +1,45 @@
+/** @file
+ Dependency expression file for PCH USB PEIM.
+
+@copyright
+ Copyright (c) 2009 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+
+//
+// Same for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "PeimDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+
+#include EFI_PPI_DEFINITION (LoadFile)
+#include EFI_PPI_DEFINITION (PchUsbPolicy)
+#include EFI_PPI_CONSUMER (BootMode)
+#endif
+
+DEPENDENCY_START
+ EFI_PEI_FV_FILE_LOADER_GUID AND
+ PEI_MASTER_BOOT_MODE_PEIM_PPI AND
+ PCH_USB_POLICY_PPI_GUID
+DEPENDENCY_END \ No newline at end of file
diff --git a/ReferenceCode/Chipset/LynxPoint/Usb/Pei/PchUsb.h b/ReferenceCode/Chipset/LynxPoint/Usb/Pei/PchUsb.h
new file mode 100644
index 0000000..7f20b4a
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Usb/Pei/PchUsb.h
@@ -0,0 +1,47 @@
+/** @file
+ Header file for the PCH USB PEIM
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PCH_USB_H_
+#define _PCH_USB_H_
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#include "PchAccess.h"
+#include EFI_PPI_CONSUMER (PchUsbPolicy)
+#endif
+
+/**
+ Initialize PCH EHCI PEIM
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] UsbPolicyPpi PCH Usb Policy PPI
+
+ @retval EFI_SUCCESS The PCH EHCI PEIM is initialized successfully
+ @retval EFI_INVALID_PARAMETER UsbControllerId is out of range
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to create database
+ @retval Others All other error conditions encountered result in an ASSERT.
+**/
+EFI_STATUS
+InitForEHCI (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PCH_USB_POLICY_PPI *UsbPolicyPpi
+ );
+
+#endif
diff --git a/ReferenceCode/Chipset/LynxPoint/Usb/Pei/PchUsb.inf b/ReferenceCode/Chipset/LynxPoint/Usb/Pei/PchUsb.inf
new file mode 100644
index 0000000..bb6fe1e
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Usb/Pei/PchUsb.inf
@@ -0,0 +1,87 @@
+## @file
+# Component description file for PCH USB PEIM
+#
+#@copyright
+# Copyright (c) 2009 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = PchUsb
+FILE_GUID = 6B4FDBD2-47E1-4a09-BA8E-8E041F208B95
+COMPONENT_TYPE = PE32_PEIM
+
+[sources.common]
+ PchEhci.c
+ PchUsb.c
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGluePeimEntryPoint.c
+
+[includes.common]
+ $(EDK_SOURCE)/Foundation/Efi
+ .
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Library/Pei/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Protocol/PchPlatformPolicy
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Library/PchPlatformLib
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/SampleCode
+
+[libraries.common]
+ $(PROJECT_PCH_FAMILY)PpiLib
+ EdkIIGlueBaseMemoryLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGluePeiDebugLibReportStatusCode
+ EdkIIGluePeiReportStatusCodeLib
+ EdkIIGluePeiServicesLib
+ EdkIIGluePeiMemoryAllocationLib
+ EdkPpiLib
+ PchPlatformLib
+ EdkIIGlueBasePciLibPciExpress
+
+[nmake.common]
+ IMAGE_ENTRY_POINT=_ModuleEntryPoint
+ DPX_SOURCE=PchUsb.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=InitializePchUsb
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_PEI_SERVICES_LIB__ \
+ -D __EDKII_GLUE_PEI_MEMORY_ALLOCATION_LIB__
diff --git a/ReferenceCode/Chipset/LynxPoint/Usb/Pei/PchUsb.mak b/ReferenceCode/Chipset/LynxPoint/Usb/Pei/PchUsb.mak
new file mode 100644
index 0000000..22c8316
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Usb/Pei/PchUsb.mak
@@ -0,0 +1,111 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchUsb/PchUsb.mak 4 10/16/12 3:37a Scottyang $
+#
+# $Revision: 4 $
+#
+# $Date: 10/16/12 3:37a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchUsb/PchUsb.mak $
+#
+# 4 10/16/12 3:37a Scottyang
+# [TAG] EIP103924
+#
+# [Category] Improvement
+#
+# [Description] Update RC 0.7.1
+#
+# [Files] ReferenceCode\Chipset\LynxPoint\*.*, SBDxe.c, SB.sd,
+# SbSetupData.c, GetSetupDate.c
+#
+# 3 7/02/12 9:19a Victortu
+#
+# 2 2/24/12 2:30a Victortu
+# Updated to support 4.6.5.3_IntelEDK_1117_Patch7_00.
+#
+# 1 2/08/12 9:30a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+
+#---------------------------------------------------------------------------
+# Create PchUsb Driver
+#---------------------------------------------------------------------------
+EDK : PchUsb
+PchUsb : $(BUILD_DIR)\PchUsb.mak PchUsbBin
+
+
+$(BUILD_DIR)\PchUsb.mak : $(PchUsb_DIR)\$(@B).cif $(PchUsb_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(PchUsb_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+PchUsb_INCLUDES=\
+ $(INTEL_PCH_INCLUDES)\
+ /I$(INTEL_PCH_DIR)\Library\PchPlatformLib\
+ $(EdkIIGlueLib_INCLUDES)\
+
+PchUsb_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=InitializePchUsb"\
+ /D__EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D__EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D__EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ /D__EDKII_GLUE_PEI_SERVICES_LIB__ \
+ /D__EDKII_GLUE_PEI_MEMORY_ALLOCATION_LIB__\
+ /D __EDKII_GLUE_BASE_PCI_LIB_CF8__
+
+PchUsb_LIB_LINKS =\
+ $(EDKFRAMEWORKPPILIB)\
+ $(EdkIIGlueBaseMemoryLib_LIB) \
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EdkIIGlueBaseLibIA32_LIB)\
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB) \
+ $(EdkIIGluePeiDebugLibReportStatusCode_LIB) \
+ $(EdkIIGluePeiReportStatusCodeLib_LIB) \
+ $(EdkIIGluePeiServicesLib_LIB) \
+ $(EdkIIGluePeiMemoryAllocationLib_LIB) \
+ $(EdkIIGlueBasePciLibCf8_LIB) \
+ $(IntelPchPpiLib_LIB) \
+ $(PchPlatformPeiLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)
+
+PchUsbBin: $(PchUsb_LIB_LINKS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\PchUsb.mak all\
+ NAME=PchUsb\
+ MAKEFILE=$(BUILD_DIR)\PchUsb.mak \
+ GUID=6B4FDBD2-47E1-4a09-BA8E-8E041F208B95\
+ "MY_INCLUDES=$(PchUsb_INCLUDES)"\
+ "MY_DEFINES=$(PchUsb_DEFINES)"\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=PEIM \
+ EDKIIModule=PEIM\
+ DEPEX1=$(PchUsb_DIR)\PchUsb.dxs DEPEX1_TYPE=EFI_SECTION_PEI_DEPEX \
+ COMPRESS=1
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Usb/Pei/PchUsb.sdl b/ReferenceCode/Chipset/LynxPoint/Usb/Pei/PchUsb.sdl
new file mode 100644
index 0000000..ca8d385
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Usb/Pei/PchUsb.sdl
@@ -0,0 +1,66 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchUsb/PchUsb.sdl 1 2/08/12 9:30a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 9:30a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/PchUsb/PchUsb.sdl $
+#
+# 1 2/08/12 9:30a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+TOKEN
+ Name = "PchUsb_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable PchUsb support in Project"
+ TokenType = Boolean
+ TargetMAK = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "PchUsb_DIR"
+End
+
+MODULE
+ Help = "Includes PchUsb.mak to Project"
+ File = "PchUsb.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PchUsb.ffs"
+ Parent = "FV_BB"
+ InvokeOrder = AfterParent
+End
+
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Wdt/Common/WdtCommon.c b/ReferenceCode/Chipset/LynxPoint/Wdt/Common/WdtCommon.c
new file mode 100644
index 0000000..6576aad
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Wdt/Common/WdtCommon.c
@@ -0,0 +1,246 @@
+/** @file
+ Library that contains common parts of WdtPei and WdtDxe. Not a standalone module.
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueBase.h"
+#endif
+
+#include "WdtCommon.h"
+
+UINT8 mAllowExpectedReset = 0;
+///
+/// mWdtHobGuid is linked and used in WdtPei and WdtDxe
+///
+EFI_GUID mWdtHobGuid = WDT_HOB_GUID;
+
+/**
+ Reads LPC bridge to get Watchdog Timer address
+
+ @param[in] none
+
+ @retval UINT32 Watchdog's address
+**/
+UINT32
+WdtGetAddress (
+ VOID
+ )
+{
+ UINT32 Address;
+
+ Address = (MmioRead32 (
+ MmPciAddress (0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_ACPI_BASE)) & B_PCH_LPC_ACPI_BASE_BAR)
+ + R_PCH_OC_WDT_CTL;
+
+ return Address;
+}
+
+/**
+ Reloads WDT with new timeout value and starts it. Also sets Unexpected Reset bit, which
+ causes the next reset to be treated as watchdog expiration - unless AllowKnownReset()
+ function was called too.
+
+ @param[in] TimeoutValue Time in seconds before WDT times out. Supported range = 1 - 1024.
+
+ @retval EFI_SUCCESS if everything's OK
+ @retval EFI_INVALID_PARAMETER if TimeoutValue parameter is wrong
+**/
+EFI_STATUS
+EFIAPI
+WdtReloadAndStart (
+ IN UINT32 TimeoutValue
+ )
+{
+ UINT32 Readback;
+
+ DEBUG ((EFI_D_INFO, "\n(Wdt) ReloadAndStartTimer(%d)\n", TimeoutValue));
+
+ if ((TimeoutValue > B_PCH_OC_WDT_CTL_TOV_MASK) || (TimeoutValue == 0)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Readback = IoRead32 (WdtGetAddress ());
+ Readback |= (B_PCH_OC_WDT_CTL_EN | B_PCH_OC_WDT_CTL_FORCE_ALL | B_PCH_OC_WDT_CTL_ICCSURV);
+ if (mAllowExpectedReset == 0) {
+ Readback |= B_PCH_OC_WDT_CTL_UNXP_RESET_STS;
+ }
+
+#if defined EFI_DEBUG && !defined USE_WDT_IN_DEBUG_BIOS
+ ///
+ /// in Debug mode, WDT will not be turned on. This is to prevent platform reboots triggered
+ /// by WDT expiration, which can be expected when processor is halted for debugging
+ ///
+ Readback &= ~(B_PCH_OC_WDT_CTL_EN | B_PCH_OC_WDT_CTL_FORCE_ALL | B_PCH_OC_WDT_CTL_UNXP_RESET_STS);
+ DEBUG ((EFI_D_INFO, "(Wdt) Wdt disabled in Debug BIOS\n"));
+
+#endif
+
+ Readback &= ~(B_PCH_OC_WDT_CTL_TOV_MASK);
+ Readback |= ((TimeoutValue - 1) & B_PCH_OC_WDT_CTL_TOV_MASK);
+ IoWrite32 (WdtGetAddress (), Readback);
+ Readback |= B_PCH_OC_WDT_CTL_RLD;
+ IoWrite32 (WdtGetAddress (), Readback);
+ return EFI_SUCCESS;
+}
+
+/**
+ Disables WDT timer.
+
+ @param[in] None
+
+ @retval None
+**/
+VOID
+EFIAPI
+WdtDisable (
+ VOID
+ )
+{
+ UINT32 Readback;
+
+ DEBUG ((EFI_D_INFO, "(Wdt) DisableTimer\n"));
+
+ Readback = IoRead32 (WdtGetAddress ());
+ Readback &= ~(B_PCH_OC_WDT_CTL_EN | B_PCH_OC_WDT_CTL_FORCE_ALL | B_PCH_OC_WDT_CTL_UNXP_RESET_STS);
+ IoWrite32 (WdtGetAddress (), Readback);
+}
+
+/**
+ Returns WDT failure status.
+
+ @param[in] None
+
+ @retval V_PCH_OC_WDT_CTL_STATUS_FAILURE If there was WDT expiration or unexpected reset
+ @retval V_PCH_OC_WDT_CTL_STATUS_OK Otherwise
+**/
+UINT8
+EFIAPI
+WdtCheckStatus (
+ VOID
+ )
+{
+ UINT32 Readback;
+
+ DEBUG ((EFI_D_INFO, "(Wdt) CheckTimerStatus\n"));
+
+ Readback = IoRead32 (WdtGetAddress ());
+
+ DEBUG ((EFI_D_INFO, "(Wdt) Readback = (%x)\n", Readback));
+
+ if (Readback & B_PCH_OC_WDT_CTL_FAILURE_STS) {
+ DEBUG ((EFI_D_INFO, "(Wdt) Status = FAILURE\n"));
+ return V_PCH_OC_WDT_CTL_STATUS_FAILURE;
+ } else {
+ return V_PCH_OC_WDT_CTL_STATUS_OK;
+ }
+}
+
+/**
+ Normally, each reboot performed while watchdog runs is considered a failure.
+ This function allows platform to perform expected reboots with WDT running,
+ without being interpreted as failures.
+ In DXE phase, it is enough to call this function any time before reset.
+ In PEI phase, between calling this function and performing reset, ReloadAndStart()
+ must not be called.
+
+ @param[in] None
+
+ @retval None
+**/
+VOID
+EFIAPI
+WdtAllowKnownReset (
+ VOID
+ )
+{
+ UINT32 Readback;
+
+ DEBUG ((EFI_D_INFO, "(Wdt) AllowKnownReset\n"));
+
+ mAllowExpectedReset = 1;
+
+ Readback = IoRead32 (WdtGetAddress ());
+ Readback &= ~(B_PCH_OC_WDT_CTL_UNXP_RESET_STS | B_PCH_OC_WDT_CTL_FORCE_ALL);
+ IoWrite32 (WdtGetAddress (), Readback);
+}
+
+/**
+ Returns information if WDT coverage for the duration of BIOS execution
+ was requested by an OS application
+
+ @param[in] None
+
+ @retval TRUE if WDT was requested
+ @retval FALSE if WDT was not requested
+**/
+UINT8
+EFIAPI
+IsWdtRequired (
+ VOID
+ )
+{
+ UINT32 Readback;
+
+ DEBUG ((EFI_D_INFO, "(Wdt) IsWdtRequired"));
+
+ Readback = IoRead32 (WdtGetAddress ());
+
+ if ((Readback & B_PCH_OC_WDT_CTL_AFTER_POST) != 0) {
+ DEBUG ((EFI_D_INFO, " - yes\n"));
+ return TRUE;
+ } else {
+ DEBUG ((EFI_D_INFO, " - no\n"));
+ return FALSE;
+ }
+
+}
+
+/**
+ Returns WDT enabled/disabled status.
+
+ @param[in] None
+
+ @retval TRUE if WDT is enabled
+ @retval FALSE if WDT is disabled
+**/
+UINT8
+EFIAPI
+IsWdtEnabled (
+ VOID
+ )
+{
+ UINT32 Readback;
+
+ DEBUG ((EFI_D_INFO, "(Wdt) IsWdtEnabled"));
+
+ Readback = IoRead32 (WdtGetAddress ());
+
+ if ((Readback & B_PCH_OC_WDT_CTL_EN) != 0) {
+ DEBUG ((EFI_D_INFO, " - yes\n"));
+ return TRUE;
+ } else {
+ DEBUG ((EFI_D_INFO, " - no\n"));
+ return FALSE;
+ }
+
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/Wdt/Common/WdtCommon.h b/ReferenceCode/Chipset/LynxPoint/Wdt/Common/WdtCommon.h
new file mode 100644
index 0000000..dfc6959
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Wdt/Common/WdtCommon.h
@@ -0,0 +1,166 @@
+/** @file
+ Library that contains common parts of WdtPei and WdtDxe. Not a standalone module.
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "PchAccess.h"
+
+extern UINT8 mAllowExpectedReset;
+extern EFI_GUID mWdtHobGuid;
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#define WDT_HOB_GUID \
+ { \
+ 0x65675786, 0xacca, 0x4b11, 0x8a, 0xb7, 0xf8, 0x43, 0xaa, 0x2a, 0x8b, 0xea \
+ }
+#else
+#define WDT_HOB_GUID \
+ { \
+ 0x65675786, 0xacca, 0x4b11, \
+ { \
+ 0x8a, 0xb7, 0xf8, 0x43, 0xaa, 0x2a, 0x8b, 0xea \
+ } \
+ }
+#endif
+//
+// HOB definitions duplicated from HOB.h which couldn't be included directly,
+// because it requires either EdkIIGluePeim.h or EdkIIGlueDxe.h,
+// and WdtCommon must not include any of those.
+//
+#ifndef _PEI_HOB_H_
+#ifndef __HOB__H__
+typedef struct _EFI_HOB_GENERIC_HEADER {
+ UINT16 HobType;
+ UINT16 HobLength;
+ UINT32 Reserved;
+} EFI_HOB_GENERIC_HEADER;
+
+typedef struct _EFI_HOB_GUID_TYPE {
+ EFI_HOB_GENERIC_HEADER Header;
+ EFI_GUID Name;
+} EFI_HOB_GUID_TYPE;
+#endif
+#endif
+
+typedef struct {
+ EFI_HOB_GUID_TYPE Header;
+ UINT16 TimeoutValue;
+ UINT8 Active;
+} WDT_HOB;
+
+/**
+ Reads LPC bridge to get Watchdog Timer address
+
+ @param[in] none
+
+ @retval UINT32 Watchdog's address
+**/
+UINT32
+WdtGetAddress (
+ VOID
+ );
+
+/**
+ Reloads WDT with new timeout value and starts it. Also sets Unexpected Reset bit, which
+ causes the next reset to be treated as watchdog expiration - unless AllowKnownReset()
+ function was called too.
+
+ @param[in] TimeoutValue Time in seconds before WDT times out. Supported range = 1 - 1024.
+
+ @retval EFI_SUCCESS if everything's OK
+ @retval EFI_INVALID_PARAMETER if TimeoutValue parameter is wrong
+**/
+EFI_STATUS
+EFIAPI
+WdtReloadAndStart (
+ IN UINT32 TimeoutValue
+ );
+
+/**
+ Disables WDT timer.
+
+ @param[in] None
+
+ @retval None
+**/
+VOID
+EFIAPI
+WdtDisable (
+ VOID
+ );
+
+/**
+ Returns WDT failure status.
+
+ @param[in] None
+
+ @retval V_PCH_OC_WDT_CTL_STATUS_FAILURE If there was WDT expiration or unexpected reset
+ @retval V_PCH_OC_WDT_CTL_STATUS_OK Otherwise
+**/
+UINT8
+EFIAPI
+WdtCheckStatus (
+ VOID
+ );
+
+/**
+ Normally, each reboot performed while watchdog runs is considered a failure.
+ This function allows platform to perform expected reboots with WDT running,
+ without being interpreted as failures.
+ In DXE phase, it is enough to call this function any time before reset.
+ In PEI phase, between calling this function and performing reset, ReloadAndStart()
+ must not be called.
+
+ @param[in] None
+
+ @retval None
+**/
+VOID
+EFIAPI
+WdtAllowKnownReset (
+ VOID
+ );
+
+/**
+ Returns information if WDT coverage for the duration of BIOS execution
+ was requested by an OS application
+
+ @param[in] None
+
+ @retval TRUE if WDT was requested
+ @retval FALSE if WDT was not requested
+**/
+UINT8
+EFIAPI
+IsWdtRequired (
+ VOID
+ );
+
+/**
+ Returns WDT enabled/disabled status.
+
+ @param[in] None
+
+ @retval TRUE if WDT is enabled
+ @retval FALSE if WDT is disabled
+**/
+UINT8
+EFIAPI
+IsWdtEnabled (
+ VOID
+ );
diff --git a/ReferenceCode/Chipset/LynxPoint/Wdt/Common/WdtCommonLib.cif b/ReferenceCode/Chipset/LynxPoint/Wdt/Common/WdtCommonLib.cif
new file mode 100644
index 0000000..588d9c9
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Wdt/Common/WdtCommonLib.cif
@@ -0,0 +1,11 @@
+<component>
+ name = "WdtCommonLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\Wdt\Common"
+ RefName = "WdtCommonLib"
+[files]
+"WdtCommonLib.sdl"
+"WdtCommonLib.mak"
+"WdtCommon.h"
+"WdtCommon.c"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/Wdt/Common/WdtCommonLib.mak b/ReferenceCode/Chipset/LynxPoint/Wdt/Common/WdtCommonLib.mak
new file mode 100644
index 0000000..8032e7d
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Wdt/Common/WdtCommonLib.mak
@@ -0,0 +1,103 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/Wdt/WdtCommonLib/WdtCommonLib.mak 1 2/08/12 9:31a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 9:31a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/Wdt/WdtCommonLib/WdtCommonLib.mak $
+#
+# 1 2/08/12 9:31a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+EDK : WdtCommonLib
+WdtDxe : $(BUILD_DIR)\WdtDxe.mak WdtDxeBin
+
+WdtCommonLib : WdtCommonDxeLib WdtCommonPeiLib
+
+$(WdtCommonDxeLib_LIB) : WdtCommonDxeLib
+$(WdtCommonPeiLib_LIB) : WdtCommonPeiLib
+
+WdtCommonDxeLib : $(BUILD_DIR)\WdtCommonLib.mak WdtCommonLibDxeBin
+
+WdtCommonPeiLib : $(BUILD_DIR)\WdtCommonLib.mak WdtCommonLibPeiBin
+
+$(BUILD_DIR)\WdtCommonLib.mak : $(WdtCommonLib_DIR)\$(@B).cif $(WdtCommonLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(WdtCommonLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+WdtCommonLib_INCLUDES=\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+ $(WdtCommonLib_INCLUDES)
+
+
+WdtCommonLib_DEFINES = \
+ $(CFLAGS)
+
+DxeCpuBuildDefine = \
+!IF "$(x64_BUILD)"=="1"
+ /DMDE_CPU_X64\
+!ELSE
+ /DMDE_CPU_IA32\
+!ENDIF
+
+PeimCpuBuildDefine = \
+ /DMDE_CPU_IA32\
+
+WdtCommonLibPeim_DEFINES = \
+ $(WdtCommonLib_DEFINES)\
+ $(PeimCpuBuildDefine)\
+
+WdtCommonLibDxe_DEFINES = \
+ $(WdtCommonLib_DEFINES)\
+ $(DxeCpuBuildDefine)\
+
+WdtCommonLibDxeBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS) \
+ /f $(BUILD_DIR)\WdtCommonLib.mak all\
+ "MY_INCLUDES=$(WdtCommonLib_INCLUDES)" \
+ "CFLAGS=$(WdtCommonLibDxe_DEFINES)"\
+ TYPE=LIBRARY \
+ LIBRARY_NAME=$(WdtCommonDxeLib_LIB)
+
+WdtCommonLibPeiBin :
+!IF "$(x64_BUILD)"=="1"
+ $(MAKE) /$(MAKEFLAGS) $(EDK_DEFAULTS) BUILD_DIR=$(BUILD_DIR)\IA32 \
+!ELSE
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS) \
+!ENDIF
+ /f $(BUILD_DIR)\WdtCommonLib.mak all\
+ "MY_INCLUDES=$(WdtCommonLib_INCLUDES)" \
+ "CFLAGS=$(WdtCommonLibPeim_DEFINES)"\
+ TYPE=PEI_LIBRARY \
+ LIBRARY_NAME=$(WdtCommonPeiLib_LIB)
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Wdt/Common/WdtCommonLib.sdl b/ReferenceCode/Chipset/LynxPoint/Wdt/Common/WdtCommonLib.sdl
new file mode 100644
index 0000000..46ed512
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Wdt/Common/WdtCommonLib.sdl
@@ -0,0 +1,92 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/Wdt/WdtCommonLib/WdtCommonLib.sdl 1 2/08/12 9:31a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 9:31a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/Wdt/WdtCommonLib/WdtCommonLib.sdl $
+#
+# 1 2/08/12 9:31a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+TOKEN
+ Name = "WdtCommonLib_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable WdtCommonLib support in Project"
+ TokenType = Boolean
+ TargetMAK = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "WdtCommonLib_DIR"
+End
+
+MODULE
+ Help = "Includes WdtCommonLib.mak to Project"
+ File = "WdtCommonLib.mak"
+End
+
+ELINK
+ Name = "WdtCommonLib_INCLUDES"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "/I$(WdtCommonLib_DIR)"
+ Parent = "WdtCommonLib_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "WdtCommonDxeLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\WdtCommonDxeLib.lib"
+ Parent = "WdtCommonDxeLib_LIB"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "WdtCommonPeiLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\WdtCommonPeiLib.lib"
+ Parent = "WdtCommonPeiLib_LIB"
+ InvokeOrder = AfterParent
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Wdt/Dxe/WdtDxe.c b/ReferenceCode/Chipset/LynxPoint/Wdt/Dxe/WdtDxe.c
new file mode 100644
index 0000000..ea5bd2f
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Wdt/Dxe/WdtDxe.c
@@ -0,0 +1,218 @@
+/** @file
+ Implementation file for Watchdog Timer functionality
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#endif
+
+#include EFI_PROTOCOL_CONSUMER (PchReset)
+#include "WdtCommon.h"
+#include EFI_PROTOCOL_PRODUCER (Wdt)
+
+VOID
+EFIAPI
+WdtRunBeforeOsBoot (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ );
+
+EFI_STATUS
+EFIAPI
+WdtPchResetCallback (
+ IN PCH_RESET_TYPE PchResetType
+ );
+
+#define TIMEOUT_AFTER_POST_MULTIPLIER 16
+#define MINIMUM_TIMEOUT_AT_S4_EXIT 600 ///< 10 minutes
+EFI_HANDLE mImageHandle;
+WDT_PROTOCOL mWdtProtocol = {
+ WdtReloadAndStart,
+ WdtCheckStatus,
+ WdtDisable,
+ WdtAllowKnownReset,
+ IsWdtRequired,
+ IsWdtEnabled
+};
+
+PCH_RESET_CALLBACK_PROTOCOL mPchResetCallbackProtocol = { WdtPchResetCallback };
+
+/**
+ Installs WDT protocol.
+ Registers a function to be executed just before booting to OS.
+
+ @param[in] ImageHandle Image handle for this driver image
+ @param[in] SystemTable Pointer to the EFI System Table
+
+ @retval EFI_SUCCESS WDT DXE driver initialization completed successfully
+**/
+EFI_STATUS
+WdtDxeEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ EFI_EVENT Event;
+
+ DEBUG ((EFI_D_INFO, "(Wdt) Entry Point to WdtDxe\n"));
+
+ mImageHandle = ImageHandle;
+
+ Status = gBS->CreateEvent (
+ EVENT_SIGNAL_EXIT_BOOT_SERVICES,
+ EFI_TPL_CALLBACK,
+ WdtRunBeforeOsBoot,
+ NULL,
+ &Event
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ Status = EfiCreateEventLegacyBootEx (
+ EFI_TPL_CALLBACK,
+ WdtRunBeforeOsBoot,
+ NULL,
+ &Event
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ DEBUG ((EFI_D_INFO, "(Wdt) WDT event registration; Status = %r\n", Status));
+
+ Status = gBS->InstallProtocolInterface (
+ &ImageHandle,
+ &gWdtProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ &mWdtProtocol
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ Status = gBS->InstallProtocolInterface (
+ &ImageHandle,
+ &gPchResetCallbackProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ &mPchResetCallbackProtocol
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Turns on watchdog timer just before booting to OS, if an OS application requested that.
+ Clears request status.
+ Uninstalls Wdt protocol to prevent other modules from interfering with actions described above.
+
+ @param[in] Event useless here, but required in functions invoked by events
+ @param[in] Context useless here, but required in functions invoked by events
+
+ @retval None
+**/
+VOID
+EFIAPI
+WdtRunBeforeOsBoot (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ UINT32 ReloadValue;
+ UINT32 Readback;
+ EFI_STATUS Status;
+ EFI_BOOT_MODE BootMode;
+ EFI_PEI_HOB_POINTERS HobList;
+ WDT_HOB *WdtHob;
+
+ gBS->CloseEvent (Event);
+
+ DEBUG ((EFI_D_INFO, "(Wdt) RunWdtBeforeOsBoot\n"));
+ Status = gBS->UninstallProtocolInterface (
+ mImageHandle,
+ &gWdtProtocolGuid,
+ &mWdtProtocol
+ );
+
+ Status = gBS->UninstallProtocolInterface (
+ mImageHandle,
+ &gPchResetCallbackProtocolGuid,
+ &mPchResetCallbackProtocol
+ );
+ ///
+ /// check boot type, there are different flows for S4/S5
+ ///
+ EfiGetSystemConfigurationTable (&gEfiHobListGuid, (VOID **) &HobList.Raw);
+ if (HobList.Header->HobType != EFI_HOB_TYPE_HANDOFF) {
+ DEBUG ((EFI_D_ERROR, "(Wdt) Handoff Hob missing!\n"));
+ return;
+ }
+
+ BootMode = HobList.HandoffInformationTable->BootMode;
+
+ WdtHob = GetFirstGuidHob (&mWdtHobGuid);
+ if (WdtHob == NULL) {
+ return;
+ }
+
+ Readback = IoRead32 (WdtGetAddress ());
+ ReloadValue = TIMEOUT_AFTER_POST_MULTIPLIER * ((Readback & B_PCH_OC_WDT_CTL_AFTER_POST) >> 16);
+
+ if (BootMode == BOOT_ON_S4_RESUME) {
+ ///
+ /// S4 resume: if WDT was enabled before S0->S4 transition,
+ /// then WDT must be turned on even though TimeoutValueAfterPost == 0
+ /// unlike in S5->S0 flow, ToVaP is not set to zero after being consumed
+ ///
+ if (WdtHob->Active == 1) {
+ if (ReloadValue != 0) {
+ WdtReloadAndStart (ReloadValue);
+ } else {
+ WdtReloadAndStart (MINIMUM_TIMEOUT_AT_S4_EXIT);
+ }
+ } else {
+ WdtDisable ();
+ }
+ } else if (ReloadValue != 0) {
+ ///
+ /// start WDT with TimeoutValueAfterPost and clear that value from register
+ ///
+ Readback &= ~(B_PCH_OC_WDT_CTL_AFTER_POST);
+ IoWrite32 (WdtGetAddress (), Readback);
+ WdtReloadAndStart (ReloadValue);
+ } else {
+ WdtDisable ();
+ }
+
+ return;
+}
+
+/**
+ WDT call back function for Pch Reset.
+
+ @param[in] PchResetType Pch Reset Types which includes PowerCycle, Globalreset.
+
+ @retval EFI_SUCCESS The function completed successfully
+ @retval Others All other error conditions encountered result in an ASSERT.
+**/
+EFI_STATUS
+EFIAPI
+WdtPchResetCallback (
+ IN PCH_RESET_TYPE PchResetType
+ )
+{
+ WdtAllowKnownReset ();
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/Wdt/Dxe/WdtDxe.cif b/ReferenceCode/Chipset/LynxPoint/Wdt/Dxe/WdtDxe.cif
new file mode 100644
index 0000000..84a9fad
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Wdt/Dxe/WdtDxe.cif
@@ -0,0 +1,12 @@
+<component>
+ name = "WdtDxe"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\Wdt\Dxe\"
+ RefName = "WdtDxe"
+[files]
+"WdtDxe.sdl"
+"WdtDxe.dxs"
+"WdtDxe.mak"
+"WdtDxe.c"
+"WdtDxe.inf"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/Wdt/Dxe/WdtDxe.dxs b/ReferenceCode/Chipset/LynxPoint/Wdt/Dxe/WdtDxe.dxs
new file mode 100644
index 0000000..b64a661
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Wdt/Dxe/WdtDxe.dxs
@@ -0,0 +1,30 @@
+/** @file
+ Dependencies file for Watchdog Timer functionality
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+
+#include "AutoGen.h"
+#include "DxeDepex.h"
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+#endif
+
+DEPENDENCY_START
+ TRUE
+DEPENDENCY_END
diff --git a/ReferenceCode/Chipset/LynxPoint/Wdt/Dxe/WdtDxe.inf b/ReferenceCode/Chipset/LynxPoint/Wdt/Dxe/WdtDxe.inf
new file mode 100644
index 0000000..ceff3c7
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Wdt/Dxe/WdtDxe.inf
@@ -0,0 +1,87 @@
+## @file
+# Component description file for the watchdog timer driver.
+#
+#@copyright
+# Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = WdtDxe
+FILE_GUID = 5AAB83E5-F027-4ca7-BFD0-16358CC9E453
+COMPONENT_TYPE = BS_DRIVER
+
+[sources.common]
+ WdtDxe.c
+ ../Common/WdtCommon.h
+ ../Common/WdtCommon.c
+
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueDxeDriverEntryPoint.c
+
+
+[includes.common]
+ .
+ ../Common
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include/Library
+
+[libraries.common]
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueBaseMemoryLib
+ EdkIIGlueBasePciLibPciExpress
+ EdkIIGlueDxeReportStatusCodeLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueDxeServicesTableLib
+ EdkProtocolLib
+ EdkIIGlueDxeHobLib
+ $(PROJECT_PCH_FAMILY)ProtocolLib
+ EfiGuidLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = WdtDxe.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=WdtDxeEntryPoint \
+ -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_DXE_HOB_LIB__ \ No newline at end of file
diff --git a/ReferenceCode/Chipset/LynxPoint/Wdt/Dxe/WdtDxe.mak b/ReferenceCode/Chipset/LynxPoint/Wdt/Dxe/WdtDxe.mak
new file mode 100644
index 0000000..a36f6cd
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Wdt/Dxe/WdtDxe.mak
@@ -0,0 +1,102 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/Wdt/WdtDxe/WdtDxe.mak 3 9/26/12 3:43a Victortu $
+#
+# $Revision: 3 $
+#
+# $Date: 9/26/12 3:43a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/Wdt/WdtDxe/WdtDxe.mak $
+#
+# 3 9/26/12 3:43a Victortu
+# Lynx Point PCH Chipset Framework Reference Code Beta 0.7.0
+#
+# 2 2/24/12 2:31a Victortu
+# Updated to support 4.6.5.3_IntelEDK_1117_Patch7_00.
+#
+# 1 2/08/12 9:32a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+EDK : WdtDxe
+WdtDxe : $(BUILD_DIR)\WdtDxe.mak WdtDxeBin
+
+$(BUILD_DIR)\WdtDxe.mak : $(WdtDxe_DIR)\$(@B).cif $(BUILD_RULES)
+ $(CIF2MAK) $(WdtDxe_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+WdtDxe_INCLUDES=\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+ $(WdtCommonLib_INCLUDES)
+
+WdtDxe_LIBS=\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueDxeServicesTableLib_LIB)\
+ $(EDKPROTOCOLLIB)\
+ $(EdkIIGlueDxeHobLib_LIB)\
+ $(INTEL_PCH_PROTOCOL_LIB)\
+ $(EFIGUIDLIB)\
+ $(WdtCommonDxeLib_LIB)
+
+WdtDxe_DEFINES=\
+ $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=WdtDxeEntryPoint"\
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__\
+ /D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__\
+ /D __EDKII_GLUE_DXE_HOB_LIB__
+
+WdtDxeBin : $(WdtDxe_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\WdtDxe.mak all\
+ "MY_INCLUDES=$(WdtDxe_INCLUDES)"\
+ "MY_DEFINES=$(WdtDxe_DEFINES)"\
+ GUID=5AAB83E5-F027-4ca7-BFD0-16358CC9E453\
+ ENTRY_POINT=_ModuleEntryPoint \
+ EDKIIModule=DXEDRIVER\
+ TYPE=BS_DRIVER \
+ DEPEX1=$(WdtDxe_DIR)\WdtDxe.dxs \
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \
+ COMPRESS=1
+
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Wdt/Dxe/WdtDxe.sdl b/ReferenceCode/Chipset/LynxPoint/Wdt/Dxe/WdtDxe.sdl
new file mode 100644
index 0000000..edfd5a6
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Wdt/Dxe/WdtDxe.sdl
@@ -0,0 +1,68 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/Wdt/WdtDxe/WdtDxe.sdl 1 2/08/12 9:32a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 9:32a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/Wdt/WdtDxe/WdtDxe.sdl $
+#
+# 1 2/08/12 9:32a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+TOKEN
+ Name = "WdtDxe_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+ Help = "Main switch to enable ICC support in Project in DXE Phase"
+End
+
+MODULE
+ Help = "Includes WdtDxe.mak to Project"
+ File = "WdtDxe.mak"
+End
+
+PATH
+ Name = "WdtDxe_DIR"
+ Help = "Icc Support commands"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\WdtDxe.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Wdt/Pei/WdtPei.c b/ReferenceCode/Chipset/LynxPoint/Wdt/Pei/WdtPei.c
new file mode 100644
index 0000000..c1d1e03
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Wdt/Pei/WdtPei.c
@@ -0,0 +1,280 @@
+/** @file
+ Implementation file for Watchdog Timer functionality
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#endif
+
+#include EFI_PPI_CONSUMER (PchReset)
+#include "WdtCommon.h"
+#include EFI_PPI_PRODUCER (Wdt)
+
+EFI_STATUS
+EFIAPI
+WdtPchResetCallback (
+ IN PCH_RESET_TYPE PchResetType
+ );
+
+static WDT_PPI mWdtPpi = {
+ WdtReloadAndStart,
+ WdtCheckStatus,
+ WdtDisable,
+ WdtAllowKnownReset,
+ IsWdtRequired,
+ IsWdtEnabled
+};
+
+static PCH_RESET_CALLBACK_PPI mPchResetCallbackPpi = { WdtPchResetCallback };
+
+EFI_STATUS
+EndOfPeiCallback (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
+ IN VOID *Ppi
+ );
+
+static EFI_PEI_PPI_DESCRIPTOR mInstallWdtPpi = {
+ EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
+ &gWdtPpiGuid,
+ &mWdtPpi
+};
+
+static EFI_PEI_PPI_DESCRIPTOR mInstallPchResetCallbackPpi = {
+ EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
+ &gPchResetCallbackPpiGuid,
+ &mPchResetCallbackPpi
+};
+
+static EFI_PEI_NOTIFY_DESCRIPTOR mNotifyList = {
+ (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+ &gEndOfPeiSignalPpiGuid,
+ EndOfPeiCallback
+};
+
+#define MINIMUM_TIMEOUT_AT_S3_EXIT 10 ///< seconds
+
+/**
+ Reads PCH registers to check if platform wakes from S3/S4
+
+ @param[in] None
+
+ @retval TRUE if platfrom wakes from S3/S4
+ @retval FALSE otherwise
+**/
+UINT8
+IsWakeFromS3_S4 (
+ VOID
+ )
+{
+ UINT32 Address;
+ UINT16 SleepType;
+
+ Address = MmioRead32 (
+ MmPciAddress (0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_ACPI_BASE)
+ ) & B_PCH_LPC_ACPI_BASE_BAR;
+
+ if (IoRead16 (Address + R_PCH_ACPI_PM1_STS) & B_PCH_ACPI_PM1_STS_WAK) {
+ SleepType = IoRead16 (Address + R_PCH_ACPI_PM1_CNT) & B_PCH_ACPI_PM1_CNT_SLP_TYP;
+ if ((SleepType == V_PCH_ACPI_PM1_CNT_S3) || (SleepType == V_PCH_ACPI_PM1_CNT_S4)) {
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+/**
+ Initializes watchdog failure bits.
+ If there was an unexpected reset, enforces WDT expiration.
+ Stores initial WDT state in a HOB, it is useful in flows with S3/S4 resume.
+ Stops watchdog.
+ Installs watchdog PPI for other modules to use.
+
+ @param[in] FfsHeader Pointer to Firmware File System file header.
+ @param[in] PeiServices General purpose services available to every PEIM.
+
+ @retval EFI_SUCCESS When everything is OK
+**/
+EFI_STATUS
+WdtPeiEntryPoint (
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ UINT32 Readback;
+ EFI_STATUS Status;
+ UINT16 TimeoutValue;
+ UINT8 Active;
+ WDT_HOB *WdtHobPtr;
+
+#ifndef WDT_SUPPORT_ENABLED
+ ///
+ /// clear status bits and disable watchdog, then lock the register
+ ///
+ IoWrite32 (WdtGetAddress (), (B_PCH_OC_WDT_CTL_ICCSURV_STS | B_PCH_OC_WDT_CTL_NO_ICCSURV_STS));
+ IoWrite32 (WdtGetAddress (), B_PCH_OC_WDT_CTL_LCK);
+#endif
+
+ Readback = IoRead32 (WdtGetAddress ());
+
+ DEBUG ((EFI_D_INFO, "(WDT) Readback = 0x%08x\n", Readback));
+ ///
+ /// Write current Wdt settings to a HOB, they may be be needed in S3/S4 resume paths
+ ///
+ if (Readback & B_PCH_OC_WDT_CTL_EN) {
+ Active = 1;
+ TimeoutValue = (UINT16) ((Readback & B_PCH_OC_WDT_CTL_TOV_MASK) + 1);
+ } else {
+ Active = 0;
+ TimeoutValue = 0;
+ }
+
+ Status = (*PeiServices)->CreateHob (PeiServices, EFI_HOB_TYPE_GUID_EXTENSION, sizeof (WDT_HOB), (VOID **) &WdtHobPtr);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ WdtHobPtr->Header.Name = mWdtHobGuid;
+ WdtHobPtr->Active = Active;
+ WdtHobPtr->TimeoutValue = TimeoutValue;
+ ///
+ /// If there was a WDT expiration, set Failure Status and clear timeout status bits
+ /// Timeout status bits are cleared by writing '1'
+ ///
+ if (Readback & (B_PCH_OC_WDT_CTL_ICCSURV_STS | B_PCH_OC_WDT_CTL_NO_ICCSURV_STS)) {
+ DEBUG ((EFI_D_ERROR, "(WDT) Expiration detected.\n", Readback));
+ Readback |= B_PCH_OC_WDT_CTL_FAILURE_STS;
+ Readback |= (B_PCH_OC_WDT_CTL_ICCSURV_STS | B_PCH_OC_WDT_CTL_NO_ICCSURV_STS);
+ Readback &= ~(B_PCH_OC_WDT_CTL_UNXP_RESET_STS);
+ } else {
+ ///
+ /// If there was unexpected reset but no WDT expiration and no resume from S3/S4,
+ /// clear unexpected reset status and enforce expiration. This is to inform Firmware
+ /// which has no access to unexpected reset status bit, that something went wrong.
+ ///
+ if ((Readback & B_PCH_OC_WDT_CTL_UNXP_RESET_STS) && !IsWakeFromS3_S4 ()) {
+#if defined EFI_DEBUG && !defined USE_WDT_IN_DEBUG_BIOS
+ DEBUG ((EFI_D_ERROR, "(WDT) Unexpected reset detected and ignored.\n"));
+ Readback &= ~(B_PCH_OC_WDT_CTL_FAILURE_STS | B_PCH_OC_WDT_CTL_UNXP_RESET_STS);
+ Readback |= (B_PCH_OC_WDT_CTL_ICCSURV_STS | B_PCH_OC_WDT_CTL_NO_ICCSURV_STS);
+#else
+ DEBUG ((EFI_D_ERROR, "(WDT) Unexpected reset detected. Enforcing Wdt expiration.\n"));
+ WdtReloadAndStart (1);
+ while (1) {
+ ///
+ /// wait for reboot caused by WDT expiration
+ ///
+ }
+#endif
+ } else {
+ ///
+ /// No WDT expiration and no unexpected reset - clear Failure status
+ ///
+ DEBUG ((EFI_D_INFO, "(WDT) Status OK.\n", Readback));
+ Readback &= ~(B_PCH_OC_WDT_CTL_FAILURE_STS);
+ Readback |= (B_PCH_OC_WDT_CTL_ICCSURV_STS | B_PCH_OC_WDT_CTL_NO_ICCSURV_STS);
+ }
+ }
+
+ IoWrite32 (WdtGetAddress (), Readback);
+ ///
+ /// register an event for EndOfPei. It will support Wdt in resume from S3.
+ ///
+ Status = (**PeiServices).NotifyPpi (PeiServices, &mNotifyList);
+
+ Status = (**PeiServices).InstallPpi (PeiServices, &mInstallWdtPpi);
+
+ Status = (**PeiServices).InstallPpi (PeiServices, &mInstallPchResetCallbackPpi);
+
+ ASSERT_EFI_ERROR (Status);
+
+ return Status;
+}
+
+/**
+ Support for WDT in S3 resume.
+ If WDT was enabled during S0->S3 transition, this function will turn on WDT
+ just before waking OS. Timeout value will be overridden if it was too small.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] NotifyDescriptor The notification structure this PEIM registered on install.
+ @param[in] Ppi The memory discovered PPI. Not used.
+
+ @retval EFI_SUCCESS When everything is OK
+ @retval EFI_NOT_FOUND WdtHob is not found
+**/
+EFI_STATUS
+EndOfPeiCallback (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
+ IN VOID *Ppi
+ )
+{
+ WDT_HOB *WdtHob;
+ EFI_STATUS Status;
+ EFI_BOOT_MODE BootMode;
+
+ DEBUG ((EFI_D_INFO, "(WDT) EndOfPeiCallback\n"));
+ Status = (*PeiServices)->GetBootMode (PeiServices, &BootMode);
+ ASSERT_EFI_ERROR (Status);
+ WdtHob = GetFirstGuidHob (&mWdtHobGuid);
+ if (WdtHob == NULL) {
+ return EFI_NOT_FOUND;
+ }
+
+ DEBUG ((EFI_D_INFO, "(WDT) BootMode %d, Hob, active %d, ToV %d\n", BootMode, WdtHob->Active, WdtHob->TimeoutValue));
+
+ if (BootMode == BOOT_ON_S3_RESUME) {
+ if (WdtHob->Active == 1) {
+ if (WdtHob->TimeoutValue < MINIMUM_TIMEOUT_AT_S3_EXIT) {
+ WdtReloadAndStart (MINIMUM_TIMEOUT_AT_S3_EXIT);
+ } else {
+ WdtReloadAndStart (WdtHob->TimeoutValue);
+ }
+ } else {
+ WdtDisable ();
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ WDT call back function for Pch Reset.
+
+ @param[in] PchResetType Pch Reset Types which includes PowerCycle, Globalreset.
+
+ @retval EFI_SUCCESS The function completed successfully
+ @retval Others All other error conditions encountered result in an ASSERT.
+**/
+EFI_STATUS
+EFIAPI
+WdtPchResetCallback (
+ IN PCH_RESET_TYPE PchResetType
+ )
+{
+ WdtAllowKnownReset ();
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/Chipset/LynxPoint/Wdt/Pei/WdtPei.cif b/ReferenceCode/Chipset/LynxPoint/Wdt/Pei/WdtPei.cif
new file mode 100644
index 0000000..24fbb35
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Wdt/Pei/WdtPei.cif
@@ -0,0 +1,12 @@
+<component>
+ name = "WdtPei"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\Wdt\Pei\"
+ RefName = "WdtPei"
+[files]
+"WdtPei.sdl"
+"WdtPei.dxs"
+"WdtPei.mak"
+"WdtPei.c"
+"WdtPeim.inf"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/Wdt/Pei/WdtPei.dxs b/ReferenceCode/Chipset/LynxPoint/Wdt/Pei/WdtPei.dxs
new file mode 100644
index 0000000..9531248
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Wdt/Pei/WdtPei.dxs
@@ -0,0 +1,31 @@
+/** @file
+ Dependencies file for Watchdog Timer functionality
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+
+#include "AutoGen.h"
+#include "PeimDepex.h"
+
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+#endif
+
+DEPENDENCY_START
+ TRUE
+DEPENDENCY_END
diff --git a/ReferenceCode/Chipset/LynxPoint/Wdt/Pei/WdtPei.mak b/ReferenceCode/Chipset/LynxPoint/Wdt/Pei/WdtPei.mak
new file mode 100644
index 0000000..1c2df94
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Wdt/Pei/WdtPei.mak
@@ -0,0 +1,94 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/Wdt/WdtPei/WdtPei.mak 2 2/24/12 2:32a Victortu $
+#
+# $Revision: 2 $
+#
+# $Date: 2/24/12 2:32a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/Wdt/WdtPei/WdtPei.mak $
+#
+# 2 2/24/12 2:32a Victortu
+# Updated to support 4.6.5.3_IntelEDK_1117_Patch7_00.
+#
+# 1 2/08/12 9:33a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+EDK : WdtPei
+WdtPei : $(BUILD_DIR)\WdtPei.mak WdtPeiBin
+
+$(BUILD_DIR)\WdtPei.mak : $(WdtPei_DIR)\$(@B).cif $(BUILD_RULES)
+ $(CIF2MAK) $(WdtPei_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+WdtPei_INCLUDES=\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+ $(WdtCommonLib_INCLUDES)\
+
+WdtPei_DEFINES=$(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=WdtPeiEntryPoint"\
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_PEI_SERVICES_LIB__ \
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+ /D __EDKII_GLUE_PEI_HOB_LIB__ \
+!IF "$(WDT_SUPPORT_ENABLED)"=="1"
+ /D WDT_SUPPORT_ENABLED
+!ENDIF
+
+WdtPei_LIBS =\
+ $(IntelPchPpiLib_LIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EdkIIGlueBaseLibIA32_LIB)\
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGluePeiDebugLibReportStatusCode_LIB)\
+ $(EdkIIGluePeiReportStatusCodeLib_LIB)\
+ $(EdkIIGluePeiServicesLib_LIB) \
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(WdtCommonPeiLib_LIB)\
+ $(EDKFRAMEWORKPPILIB)\
+ $(EdkIIGluePeiHobLib_LIB)
+
+WdtPeiBin : $(WdtPei_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS) \
+ /f $(BUILD_DIR)\WdtPei.mak all \
+ "MY_INCLUDES = $(WdtPei_INCLUDES)" \
+ "MY_DEFINES = $(WdtPei_DEFINES)" \
+ GUID=1D88C542-9DF7-424a-AA90-02B61F286938 \
+ ENTRY_POINT=_ModuleEntryPoint \
+ EDKIIModule=PEIM\
+ TYPE=PEIM \
+ DEPEX1=$(WdtPei_DIR)\WdtPei.dxs \
+ DEPEX1_TYPE=EFI_SECTION_PEI_DEPEX \
+ COMPRESS=0
+
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Wdt/Pei/WdtPei.sdl b/ReferenceCode/Chipset/LynxPoint/Wdt/Pei/WdtPei.sdl
new file mode 100644
index 0000000..59d48d3
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Wdt/Pei/WdtPei.sdl
@@ -0,0 +1,78 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/Wdt/WdtPei/WdtPei.sdl 1 2/08/12 9:33a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 9:33a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/Wdt/WdtPei/WdtPei.sdl $
+#
+# 1 2/08/12 9:33a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+TOKEN
+ Name = "WdtPei_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+ Help = "Main switch to enable Wdt support in Project in PEI Phase"
+End
+
+TOKEN
+ Name = "WDT_SUPPORT_ENABLED"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+End
+
+MODULE
+ Help = "Includes WdtPei.mak to Project"
+ File = "WdtPei.mak"
+End
+
+PATH
+ Name = "WdtPei_DIR"
+ Help = "Wdt Support commands"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\WdtPei.ffs"
+ Parent = "FV_BB"
+ Priority = 30
+ InvokeOrder = AfterParent
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/LynxPoint/Wdt/Pei/WdtPeim.inf b/ReferenceCode/Chipset/LynxPoint/Wdt/Pei/WdtPeim.inf
new file mode 100644
index 0000000..2f574a9
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Wdt/Pei/WdtPeim.inf
@@ -0,0 +1,87 @@
+## @file
+# Component description file for the watchdog driver.
+#
+#@copyright
+# Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = WdtPeim
+FILE_GUID = 1D88C542-9DF7-424a-AA90-02B61F286938
+COMPONENT_TYPE = PE32_PEIM
+
+[sources.common]
+ WdtPei.c
+ ../Common/WdtCommon.h
+ ../Common/WdtCommon.c
+
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGluePeimEntryPoint.c
+
+
+[includes.common]
+ .
+ ../Common
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[libraries.common]
+ $(PROJECT_PCH_FAMILY)PpiLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGluePeiDebugLibReportStatusCode
+ EdkIIGluePeiReportStatusCodeLib
+ EdkIIGluePeiServicesLib
+ EdkIIGlueBasePciLibPciExpress
+ PchPlatformLib
+ EdkFrameworkPpiLib
+ EdkIIGluePeiHobLib
+ EdkPpiLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = WdtPei.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=WdtPeiEntryPoint
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_PEI_SERVICES_LIB__ \
+ -D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+ -D __EDKII_GLUE_PEI_HOB_LIB__
+
+#
+# Undefine the flag below to disable and lock WDT
+#
+ C_FLAGS = $(C_FLAGS) -DWDT_SUPPORT_ENABLED
diff --git a/ReferenceCode/Chipset/LynxPoint/Wdt/Wdt.cif b/ReferenceCode/Chipset/LynxPoint/Wdt/Wdt.cif
new file mode 100644
index 0000000..26d94c7
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Wdt/Wdt.cif
@@ -0,0 +1,12 @@
+<component>
+ name = "Wdt"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\LynxPoint\Wdt\"
+ RefName = "Wdt"
+[files]
+"Wdt.sdl"
+[parts]
+"WdtCommonLib"
+"WdtDxe"
+"WdtPei"
+<endComponent>
diff --git a/ReferenceCode/Chipset/LynxPoint/Wdt/Wdt.sdl b/ReferenceCode/Chipset/LynxPoint/Wdt/Wdt.sdl
new file mode 100644
index 0000000..33ff822
--- /dev/null
+++ b/ReferenceCode/Chipset/LynxPoint/Wdt/Wdt.sdl
@@ -0,0 +1,73 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/Wdt/Wdt.sdl 1 2/08/12 9:31a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 9:31a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/Wdt/Wdt.sdl $
+#
+# 1 2/08/12 9:31a Yurenlai
+# Intel Lynx Point/SB eChipset initially releases.
+#
+#*************************************************************************
+TOKEN
+ Name = "WDT_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable WDT support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "WDT_DIR"
+End
+
+ELINK
+ Name = "WDT_INCLUDES"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "/I$(WDT_DIR)"
+ Parent = "WDT_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(WDT_DIR)\Protocol"
+ Parent = "WDT_INCLUDES"
+ InvokeOrder = AfterParent
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/SystemAgent/AcpiTables/Dmar/Dmar.act b/ReferenceCode/Chipset/SystemAgent/AcpiTables/Dmar/Dmar.act
new file mode 100644
index 0000000..122a3cc
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/AcpiTables/Dmar/Dmar.act
@@ -0,0 +1,340 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+
+Module Name:
+
+ Dmar.act
+
+Abstract:
+
+ This file describes the contents of the ACPI DMA address Remapping
+
+--*/
+
+#include "Dmar.h"
+
+EFI_ACPI_DMAR_TABLE DmarTable = {
+
+ EFI_ACPI_VTD_DMAR_TABLE_SIGNATURE,
+ sizeof (EFI_ACPI_DMAR_TABLE),
+ EFI_ACPI_DMAR_TABLE_REVISION,
+
+ //
+ // Checksum will be updated at runtime
+ //
+ 0x00,
+
+ //
+ // It is expected that these values will be programmed at runtime
+ //
+ 'I', 'N', 'T', 'E', 'L', ' ',
+ EFI_ACPI_DMAR_OEM_TABLE_ID,
+ 0x1,
+ EFI_ACPI_DMAR_OEM_CREATOR_ID,
+ 1,
+
+ //
+ // DMAR table specific entries below:
+ //
+
+ //
+ // 39-bit addressing Host Address Width
+ //
+ 38,
+
+ //
+ // Flags
+ //
+ 0,
+
+ //
+ // Reserved fields
+ //
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+
+ //
+ // First DRHD structure, VT-d Engine #1
+ //
+ {
+ 0, // Type = 0 (DRHD)
+ sizeof (EFI_ACPI_DRHD_ENGINE1_STRUCT), // Length of structure
+ 0, // Flag - Do not include all - bugbug - not clear what this means
+ 0, // Reserved fields
+ 0, // Segment
+ 0x00000000, // Base address of DMA-remapping hardware - Updated at boot time
+
+ //
+ // Device Scopes
+ //
+ {
+ 1, // Type
+ sizeof (EFI_ACPI_DEV_SCOPE_STRUCTURE), // Length
+ 0, // Segment number
+ 0, // Reserved
+ 0, // Start bus number
+ {2, 0} // PCI path
+ }
+ },
+
+ //Second DRHD structure VT-d Engine# 2
+ {
+ 0, // Type = 0 (DRHD)
+ sizeof(EFI_ACPI_DRHD_ENGINE2_STRUCT), // Length of strucure.
+ 1, // Flag - Include all
+ 0, // Reserved
+ 0, // Segment Number
+ 0x00000000, // Base address of DMA-remapping hardware.
+
+ {
+ //
+ // Device Scopes
+ //
+ {
+ 3, // Type=IO APIC
+ sizeof (EFI_ACPI_DEV_SCOPE_STRUCTURE), // Length
+ 0, // Reserved
+ 2, // Enumeration ID
+ 0xF0, // Start bus number
+ {31, 0} // PCI path
+ },
+ //
+ // Device Scopes
+ //
+ {
+ 4, // Type=HPET
+ sizeof (EFI_ACPI_DEV_SCOPE_STRUCTURE), // Length
+ 0, // Reserved
+ 0, // Enumeration ID
+ 0xF0, // Start bus number
+ {15, 0} // PCI path
+ }
+ ,
+ //
+ // Device Scopes - I2C0
+ //
+ {
+ 5, // Type=ACPI_NAMESPACE_DEVICE
+ sizeof (EFI_ACPI_DEV_SCOPE_STRUCTURE), // Length
+ 0, // Reserved
+ 1, // Enumeration ID
+ 0, // Start bus number
+ {21, 1} // PCI path
+ },
+ //
+ // Device Scopes - I2C1
+ //
+ {
+ 5, // Type=ACPI_NAMESPACE_DEVICE
+ sizeof (EFI_ACPI_DEV_SCOPE_STRUCTURE), // Length
+ 0, // Reserved
+ 2, // Enumeration ID
+ 0, // Start bus number
+ {21, 2} // PCI path
+ },
+ //
+ // Device Scopes - SPI0
+ //
+ {
+ 5, // Type=ACPI_NAMESPACE_DEVICE
+ sizeof (EFI_ACPI_DEV_SCOPE_STRUCTURE), // Length
+ 0, // Reserved
+ 3, // Enumeration ID
+ 0, // Start bus number
+ {21, 3} // PCI path
+ },
+ //
+ // Device Scopes - SPI1
+ //
+ {
+ 5, // Type=ACPI_NAMESPACE_DEVICE
+ sizeof (EFI_ACPI_DEV_SCOPE_STRUCTURE), // Length
+ 0, // Reserved
+ 4, // Enumeration ID
+ 0, // Start bus number
+ {21, 4} // PCI path
+ },
+ //
+ // Device Scopes - UART0
+ //
+ {
+ 5, // Type=ACPI_NAMESPACE_DEVICE
+ sizeof (EFI_ACPI_DEV_SCOPE_STRUCTURE), // Length
+ 0, // Reserved
+ 5, // Enumeration ID
+ 0, // Start bus number
+ {21, 5} // PCI path
+ },
+ //
+ // Device Scopes - UART1
+ //
+ {
+ 5, // Type=ACPI_NAMESPACE_DEVICE
+ sizeof (EFI_ACPI_DEV_SCOPE_STRUCTURE), // Length
+ 0, // Reserved
+ 6, // Enumeration ID
+ 0, // Start bus number
+ {21, 6} // PCI path
+ },
+ //
+ // Device Scopes - SDIO
+ //
+ {
+ 5, // Type=ACPI_NAMESPACE_DEVICE
+ sizeof (EFI_ACPI_DEV_SCOPE_STRUCTURE), // Length
+ 0, // Reserved
+ 7, // Enumeration ID
+ 0, // Start bus number
+ {23, 0} // PCI path
+ }
+ }
+ },
+
+ //RMRR structure for USB devices.
+ {
+ 0x1, // Type 1 - RMRR structure
+ sizeof(EFI_ACPI_RMRR_USB_STRUC), // Length
+ 0x0000, // Reserved
+ 0x0000, // Segment Num
+ 0x00000000000E0000, // RMRR Base address - Updated in runtime.
+ 0x00000000000EFFFF, // RMRR Limit address - Updated in runtime.
+ {
+ {
+ 1, // Type
+ sizeof(EFI_ACPI_DEV_SCOPE_STRUCTURE), // Length
+ 0, // Reserved
+ 0, // Enum ID
+ 0, // Start bus number
+ {29, 0} // PCI path
+ },
+ {
+ 1, // Type
+ sizeof(EFI_ACPI_DEV_SCOPE_STRUCTURE), // Length
+ 0, // Reserved
+ 0, // Enum ID
+ 0, // Start bus number
+ {26, 0} // PCI path
+ },
+ {
+ 1, // Type
+ sizeof(EFI_ACPI_DEV_SCOPE_STRUCTURE), // Length
+ 0, // Reserved
+ 0, // Enum ID
+ 0, // Start bus number
+ {20, 0} // PCI path
+ }
+ }
+ },
+
+ //RMRR structure for IGD device.
+ {
+ 1, // Type 1 - RMRR structure
+ sizeof(EFI_ACPI_RMRR_IGD_STRUC), // Length
+ 0x0000, // Reserved
+ 0x0000, // Segment Num
+ 0x0000000000000000, // RMRR Base address - Updated in runtime.
+ 0x0000000000000000, // RMRR Limit address - Updated in runtime.
+ {
+ {
+ 1, // Type
+ sizeof(EFI_ACPI_DEV_SCOPE_STRUCTURE), // Length
+ 0, // Reserved
+ 0, // Enum ID
+ 0, // Start bus number
+ {2, 0} // PCI path
+ }
+ }
+ }
+ ,
+
+ // ANDD structure.
+ {
+ 4, // Type 4 - ANDD structure
+ sizeof(EFI_ACPI_ANDD_STRUC), // Length
+ 0, 0, 0, // Reserved [3]
+ 1,
+ "\\_SB.PCI0.I2C0"
+ },
+
+ // ANDD structure.
+ {
+ 4, // Type 4 - ANDD structure
+ sizeof(EFI_ACPI_ANDD_STRUC), // Length
+ 0, 0, 0, // Reserved [3]
+ 2,
+ "\\_SB.PCI0.I2C1"
+ },
+
+ // ANDD structure.
+ {
+ 4, // Type 4 - ANDD structure
+ sizeof(EFI_ACPI_ANDD_STRUC), // Length
+ 0, 0, 0, // Reserved [3]
+ 3,
+ "\\_SB.PCI0.SPI0"
+ },
+
+ // ANDD structure.
+ {
+ 4, // Type 4 - ANDD structure
+ sizeof(EFI_ACPI_ANDD_STRUC), // Length
+ 0, 0, 0, // Reserved [3]
+ 4,
+ "\\_SB.PCI0.SPI1"
+ },
+
+ // ANDD structure.
+ {
+ 4, // Type 4 - ANDD structure
+ sizeof(EFI_ACPI_ANDD_STRUC), // Length
+ 0, 0, 0, // Reserved [3]
+ 5,
+ "\\_SB.PCI0.UA00"
+ },
+
+ // ANDD structure.
+ {
+ 4, // Type 4 - ANDD structure
+ sizeof(EFI_ACPI_ANDD_STRUC), // Length
+ 0, 0, 0, // Reserved [3]
+ 6,
+ "\\_SB.PCI0.UA01"
+ },
+
+ // ANDD structure.
+ {
+ 4, // Type 4 - ANDD structure
+ sizeof(EFI_ACPI_ANDD_STRUC), // Length
+ 0, 0, 0, // Reserved [3]
+ 7,
+ "\\_SB.PCI0.SDHC"
+ }
+};
+
+//
+// Dummy function required for build tools
+//
+int
+main (
+ VOID
+ )
+{
+ return 0;
+} \ No newline at end of file
diff --git a/ReferenceCode/Chipset/SystemAgent/AcpiTables/Dmar/Dmar.h b/ReferenceCode/Chipset/SystemAgent/AcpiTables/Dmar/Dmar.h
new file mode 100644
index 0000000..0025a02
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/AcpiTables/Dmar/Dmar.h
@@ -0,0 +1,39 @@
+/** @file
+ This file describes the contents of the ACPI DMA address Remapping
+ Some additional ACPI values are defined in Acpi1_0.h and Acpi2_0.h.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _SA_DMAR_H_
+#define _SA_DMAR_H_
+
+///
+/// Include standard ACPI table definitions
+///
+#include "Acpi1_0.h"
+#include "Acpi2_0.h"
+#include "Acpi3_0.h"
+#include "DmaRemappingTable.h"
+
+#pragma pack(1)
+
+#define EFI_ACPI_DMAR_OEM_TABLE_ID 0x20575348 ///< "HSW "
+#define EFI_ACPI_DMAR_OEM_CREATOR_ID 0x4C544E49 ///< "INTL"
+#pragma pack()
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/AcpiTables/HOST_BUS.ASL b/ReferenceCode/Chipset/SystemAgent/AcpiTables/HOST_BUS.ASL
new file mode 100644
index 0000000..439736e
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/AcpiTables/HOST_BUS.ASL
@@ -0,0 +1,770 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+
+Module Name:
+
+ HOST_BUS.ASL
+
+Abstract:
+
+ SystemAgent PCI configuration space definition.
+
+--*/
+
+
+ //
+ // Define various System Agent (SA) PCI Configuration Space
+ // registers which will be used to dynamically produce all
+ // resources in the Host Bus _CRS.
+ //
+OperationRegion (HBUS, PCI_Config, 0x00, 0x100)
+Field (HBUS, DWordAcc, NoLock, Preserve)
+{
+ Offset(0x40), // EPBAR (0:0:0:40)
+ EPEN, 1, // Enable
+ , 11,
+ EPBR, 20, // EPBAR [31:12]
+
+ Offset(0x48), // MCHBAR (0:0:0:48)
+ MHEN, 1, // Enable
+ , 14,
+ MHBR, 17, // MCHBAR [31:15]
+
+ Offset(0x50), // GGC (0:0:0:50)
+ GCLK, 1, // GGCLCK
+
+ Offset(0x54), // DEVEN (0:0:0:54)
+ D0EN, 1, // DEV0 Enable
+ D1F2, 1, // DEV1 FUN2 Enable
+ D1F1, 1, // DEV1 FUN1 Enable
+ D1F0, 1, // DEV1 FUN0 Enable
+
+ Offset(0x60), // PCIEXBAR (0:0:0:60)
+ PXEN, 1, // Enable
+ PXSZ, 2, // PCI Express Size
+ , 23,
+ PXBR, 6, // PCI Express BAR [31:26]
+
+ Offset(0x68), // DMIBAR (0:0:0:68)
+ DIEN, 1, // Enable
+ , 11,
+ DIBR, 20, // DMIBAR [31:12]
+
+ Offset(0x70), // MESEG_BASE (0:0:0:70)
+ , 20,
+ MEBR, 12, // MESEG_BASE [31:20]
+
+ Offset(0x80), // PAM0 Register (0:0:0:80)
+ , 4,
+ PM0H, 2, // PAM 0, High Nibble
+ , 2,
+
+ Offset(0x81), // PAM1 Register (0:0:0:81)
+ PM1L, 2, // PAM1, Low Nibble
+ , 2,
+ PM1H, 2, // PAM1, High Nibble
+ , 2,
+
+ Offset(0x82), // PAM2 Register (0:0:0:82)
+ PM2L, 2, // PAM2, Low Nibble
+ , 2,
+ PM2H, 2, // PAM2, High Nibble
+ , 2,
+
+ Offset(0x83), // PAM3 Register (0:0:0:83)
+ PM3L, 2, // PAM3, Low Nibble
+ , 2,
+ PM3H, 2, // PAM3, High Nibble
+ , 2,
+
+ Offset(0x84), // PAM4 Register (0:0:0:84)
+ PM4L, 2, // PAM4, Low Nibble
+ , 2,
+ PM4H, 2, // PAM4, High Nibble
+ , 2,
+
+ Offset(0x85), // PAM5 Register (0:0:0:85)
+ PM5L, 2, // PAM5, Low Nibble
+ , 2,
+ PM5H, 2, // PAM5, High Nibble
+ , 2,
+
+ Offset(0x86), // PAM6 Register (0:0:0:86)
+ PM6L, 2, // PAM6, Low Nibble
+ , 2,
+ PM6H, 2, // PAM6, High Nibble
+ , 2,
+
+ Offset(0xA8), // Top of Upper Usable DRAM Register (0:0:0:A8)
+ , 20,
+ TUUD, 19, // TOUUD [38:20]
+
+ Offset(0xBC), // Top of Lower Usable DRAM Register (0:0:0:BC)
+ , 20,
+ TLUD, 12, // TOLUD [31:20]
+
+ Offset(0xC8), // ERRSTS register (0:0:0:C8)
+ , 7,
+ HTSE, 1 // Host Thermal Sensor Event for SMI/SCI/SERR
+}
+
+OperationRegion (MCHT, SystemMemory, 0xFED10000, 0x1100)
+
+// Define a buffer that will store all the bus, memory, and IO information
+// relating to the Host Bus. This buffer will be dynamically altered in
+// the _CRS and passed back to the OS.
+
+Name(BUF0,ResourceTemplate()
+{
+ // Bus Number Allocation: Bus 0 to 0xFF
+
+ WORDBusNumber(ResourceProducer,MinFixed,MaxFixed,PosDecode,0x00,
+ 0x0000,0x00FF,0x00,0x0100,,,PB00)
+
+ // I/O Region Allocation 0 ( 0x0000 - 0x0CF7 )
+
+ DWordIo(ResourceProducer,MinFixed,MaxFixed,PosDecode,EntireRange,
+ 0x00,0x0000,0x0CF7,0x00,0x0CF8,,,PI00)
+
+ // PCI Configuration Registers ( 0x0CF8 - 0x0CFF )
+
+ Io(Decode16,0x0CF8,0x0CF8,1,0x08)
+
+ // I/O Region Allocation 1 ( 0x0D00 - 0xFFFF )
+
+ DWordIo(ResourceProducer,MinFixed,MaxFixed,PosDecode,EntireRange,
+ 0x00,0x0D00,0xFFFF,0x00,0xF300,,,PI01)
+
+ // Video Buffer Area ( 0xA0000 - 0xBFFFF )
+
+ DWordMemory(ResourceProducer,PosDecode,MinFixed,MaxFixed,Cacheable,
+ ReadWrite,0x00,0xA0000,0xBFFFF,0x00,0x20000,,,A000)
+
+ // ISA Add-on BIOS Area ( 0xC0000 - 0xC3FFF )
+
+ DWordMemory(ResourceProducer,PosDecode,MinFixed,MaxFixed,Cacheable,
+ ReadWrite,0x00,0xC0000,0xC3FFF,0x00,0x4000,,,C000)
+
+ // ISA Add-on BIOS Area ( 0xC4000 - 0xC7FFF )
+
+ DWordMemory(ResourceProducer,PosDecode,MinFixed,MaxFixed,Cacheable,
+ ReadWrite,0x00,0xC4000,0xC7FFF,0x00,0x4000,,,C400)
+
+ // ISA Add-on BIOS Area ( 0xC8000 - 0xCBFFF )
+
+ DWordMemory(ResourceProducer,PosDecode,MinFixed,MaxFixed,Cacheable,
+ ReadWrite,0x00,0xC8000,0xCBFFF,0x00,0x4000,,,C800)
+
+ // ISA Add-on BIOS Area ( 0xCC000 - 0xCFFFF )
+
+ DWordMemory(ResourceProducer,PosDecode,MinFixed,MaxFixed,Cacheable,
+ ReadWrite,0x00,0xCC000,0xCFFFF,0x00,0x4000,,,CC00)
+
+ // ISA Add-on BIOS Area ( 0xD0000 - 0xD3FFF )
+
+ DWordMemory(ResourceProducer,PosDecode,MinFixed,MaxFixed,Cacheable,
+ ReadWrite,0x00,0xD0000,0xD3FFF,0x00,0x4000,,,D000)
+
+ // ISA Add-on BIOS Area ( 0xD4000 - 0xD7FFF )
+
+ DWordMemory(ResourceProducer,PosDecode,MinFixed,MaxFixed,Cacheable,
+ ReadWrite,0x00,0xD4000,0xD7FFF,0x00,0x4000,,,D400)
+
+ // ISA Add-on BIOS Area ( 0xD8000 - 0xDBFFF )
+
+ DWordMemory(ResourceProducer,PosDecode,MinFixed,MaxFixed,Cacheable,
+ ReadWrite,0x00,0xD8000,0xDBFFF,0x00,0x4000,,,D800)
+
+ // ISA Add-on BIOS Area ( 0xDC000 - 0xDFFFF )
+
+ DWordMemory(ResourceProducer,PosDecode,MinFixed,MaxFixed,Cacheable,
+ ReadWrite,0x00,0xDC000,0xDFFFF,0x00,0x4000,,,DC00)
+
+ // BIOS Extension Area ( 0xE0000 - 0xE3FFF )
+
+ DWordMemory(ResourceProducer,PosDecode,MinFixed,MaxFixed,Cacheable,
+ ReadWrite,0x00,0xE0000,0xE3FFF,0x00,0x4000,,,E000)
+
+ // BIOS Extension Area ( 0xE4000 - 0xE7FFF )
+
+ DWordMemory(ResourceProducer,PosDecode,MinFixed,MaxFixed,Cacheable,
+ ReadWrite,0x00,0xE4000,0xE7FFF,0x00,0x4000,,,E400)
+
+ // BIOS Extension Area ( 0xE8000 - 0xEBFFF )
+
+ DWordMemory(ResourceProducer,PosDecode,MinFixed,MaxFixed,Cacheable,
+ ReadWrite,0x00,0xE8000,0xEBFFF,0x00,0x4000,,,E800)
+
+ // BIOS Extension Area ( 0xEC000 - 0xEFFFF )
+
+ DWordMemory(ResourceProducer,PosDecode,MinFixed,MaxFixed,Cacheable,
+ ReadWrite,0x00,0xEC000,0xEFFFF,0x00,0x4000,,,EC00)
+
+ // BIOS Area ( 0xF0000 - 0xFFFFF )
+
+ DWordMemory(ResourceProducer,PosDecode,MinFixed,MaxFixed,Cacheable,
+ ReadWrite,0x00,0xF0000,0xFFFFF,0x00,0x10000,,,F000)
+
+// // Memory Hole Region ( 0xF00000 - 0xFFFFFF )
+//
+// DWordMemory(ResourceProducer,PosDecode,MinFixed,MaxFixed,Cacheable,
+// ReadWrite,0x00,0xF00000,0xFFFFFF,0x00,0x100000,,,HOLE)
+
+ // PCI Memory Region ( TOLUD - 0xFEAFFFFF )
+
+ DWordMemory(ResourceProducer,PosDecode,MinFixed,MaxFixed,Cacheable,
+ ReadWrite,0x00,0x00000000,0xFEAFFFFF,0x00,0xFEB00000,,,PM01)
+})
+
+Method(_CRS,0,Serialized)
+{
+ // Fix up Max Bus Number and Length
+ CreateWordField(BUF0, ^PB00._MAX, PBMX)
+ Store(Subtract(ShiftRight(\PELN,20),2), PBMX)
+ CreateWordField(BUF0, ^PB00._LEN, PBLN)
+ Store(Subtract(ShiftRight(\PELN,20),1), PBLN)
+ // Fix up all of the Option ROM areas from 0xC0000-0xFFFFF.
+ //
+
+ If(PM1L) // \_SB.PCI0
+ {
+ // PAMx != 0. Set length = 0.
+
+ CreateDwordField(BUF0, ^C000._LEN,C0LN)
+ Store(Zero,C0LN)
+ }
+
+ If(LEqual(PM1L,1))
+ {
+ CreateBitField(BUF0, ^C000._RW,C0RW)
+ Store(Zero,C0RW)
+ }
+
+ If(PM1H)
+ {
+ CreateDwordField(BUF0, ^C400._LEN,C4LN)
+ Store(Zero,C4LN)
+ }
+
+ If(LEqual(PM1H,1))
+ {
+ CreateBitField(BUF0, ^C400._RW,C4RW)
+ Store(Zero,C4RW)
+ }
+
+ If(PM2L)
+ {
+ CreateDwordField(BUF0, ^C800._LEN,C8LN)
+ Store(Zero,C8LN)
+ }
+
+ If(LEqual(PM2L,1))
+ {
+ CreateBitField(BUF0, ^C800._RW,C8RW)
+ Store(Zero,C8RW)
+ }
+
+ If(PM2H)
+ {
+ CreateDwordField(BUF0, ^CC00._LEN,CCLN)
+ Store(Zero,CCLN)
+ }
+
+ If(LEqual(PM2H,1))
+ {
+ CreateBitField(BUF0, ^CC00._RW,CCRW)
+ Store(Zero,CCRW)
+ }
+
+ If(PM3L)
+ {
+ CreateDwordField(BUF0, ^D000._LEN,D0LN)
+ Store(Zero,D0LN)
+ }
+
+ If(LEqual(PM3L,1))
+ {
+ CreateBitField(BUF0, ^D000._RW,D0RW)
+ Store(Zero,D0RW)
+ }
+
+ If(PM3H)
+ {
+ CreateDwordField(BUF0, ^D400._LEN,D4LN)
+ Store(Zero,D4LN)
+ }
+
+ If(LEqual(PM3H,1))
+ {
+ CreateBitField(BUF0, ^D400._RW,D4RW)
+ Store(Zero,D4RW)
+ }
+
+ If(PM4L)
+ {
+ CreateDwordField(BUF0, ^D800._LEN,D8LN)
+ Store(Zero,D8LN)
+ }
+
+ If(LEqual(PM4L,1))
+ {
+ CreateBitField(BUF0, ^D800._RW,D8RW)
+ Store(Zero,D8RW)
+ }
+
+ If(PM4H)
+ {
+ CreateDwordField(BUF0, ^DC00._LEN,DCLN)
+ Store(Zero,DCLN)
+ }
+
+ If(LEqual(PM4H,1))
+ {
+ CreateBitField(BUF0, ^DC00._RW,DCRW)
+ Store(Zero,DCRW)
+ }
+
+ If(PM5L)
+ {
+ CreateDwordField(BUF0, ^E000._LEN,E0LN)
+ Store(Zero,E0LN)
+ }
+
+ If(LEqual(PM5L,1))
+ {
+ CreateBitField(BUF0, ^E000._RW,E0RW)
+ Store(Zero,E0RW)
+ }
+
+ If(PM5H)
+ {
+ CreateDwordField(BUF0, ^E400._LEN,E4LN)
+ Store(Zero,E4LN)
+ }
+
+ If(LEqual(PM5H,1))
+ {
+ CreateBitField(BUF0, ^E400._RW,E4RW)
+ Store(Zero,E4RW)
+ }
+
+ If(PM6L)
+ {
+ CreateDwordField(BUF0, ^E800._LEN,E8LN)
+ Store(Zero,E8LN)
+ }
+
+ If(LEqual(PM6L,1))
+ {
+ CreateBitField(BUF0, ^E800._RW,E8RW)
+ Store(Zero,E8RW)
+ }
+
+ If(PM6H)
+ {
+ CreateDwordField(BUF0, ^EC00._LEN,ECLN)
+ Store(Zero,ECLN)
+ }
+
+ If(LEqual(PM6H,1))
+ {
+ CreateBitField(BUF0, ^EC00._RW,ECRW)
+ Store(Zero,ECRW)
+ }
+
+ If(PM0H)
+ {
+ CreateDwordField(BUF0, ^F000._LEN,F0LN)
+ Store(Zero,F0LN)
+ }
+
+ If(LEqual(PM0H,1))
+ {
+ CreateBitField(BUF0, ^F000._RW,F0RW)
+ Store(Zero,F0RW)
+ }
+
+// // Enable the 1MB region between 15-16MB if HENA = 1.
+//
+// If( MCHC.HENA)
+// {
+// CreateDwordField(BUF0, HOLE._LEN,H0LN)
+// Store(0x100000,H0LN)
+// }
+
+ // Create pointers to Memory Sizing values.
+
+ CreateDwordField(BUF0, ^PM01._MIN,M1MN)
+ CreateDwordField(BUF0, ^PM01._MAX,M1MX)
+ CreateDwordField(BUF0, ^PM01._LEN,M1LN)
+
+ // Set Memory Size Values. TLUD represents bits 31:20 of phyical
+ // TOM, so shift these bits into the correct position and fix up
+ // the Memory Region available to PCI.
+
+ ShiftLeft( TLUD,20,M1MN)
+ Add(Subtract(M1MX,M1MN),1,M1LN)
+
+ Return(BUF0)
+}
+
+//Name(GUID,UUID("33DB4D5B-1FF7-401C-9657-7441C03DD766"))
+Name(GUID,Buffer(){0x5b, 0x4d, 0xdb, 0x33,
+ 0xf7, 0x1f,
+ 0x1c, 0x40,
+ 0x96, 0x57,
+ 0x74, 0x41, 0xc0, 0x3d, 0xd7, 0x66})
+
+
+Name(SUPP,0) // PCI _OSC Support Field value
+Name(CTRL,0) // PCI _OSC Control Field value
+Name(XCNT, 0) // Variable used in _OSC for counting
+
+Method(_OSC,4,Serialized)
+{ // Check for proper UUID
+ // Save the capabilities buffer
+ Store(Arg3,Local0)
+
+ // Create DWord-adressable fields from the Capabilties Buffer
+ CreateDWordField(Local0,0,CDW1)
+ CreateDWordField(Local0,4,CDW2)
+ CreateDWordField(Local0,8,CDW3)
+
+
+ //
+ // This provides a facility for the PCH reference code to expose USB XHCI controllers to the OS.
+ // Refer to Intel PCH reference code for further details.
+ //
+ if (\_SB.PCI0.XHC.CUID(Arg0)) {
+ Return (\_SB.PCI0.XHC.POSC(Arg1, Arg2, Arg3))
+ } else {
+ If (LGreaterEqual(OSYS,2012)) {
+ If(LEqual(XCNT, 0)) {
+ \_SB.PCI0.XHC.XSEL()
+ Increment(XCNT)
+ }
+ }
+ }
+
+ // Check for proper UUID
+#ifdef AMI_ORIGINAL_FOR_FIX_UUID_INVALID
+ If(LAnd(LEqual(Arg0,GUID),NEXP))
+#else // AMI_ORIGINAL_FOR_FIX_UUID_INVALID
+ If(LEqual(Arg0,GUID))
+#endif // AMI_ORIGINAL_FOR_FIX_UUID_INVALID
+ {
+ // Save Capabilities DWord2 & 3
+ Store(CDW2,SUPP)
+ Store(CDW3,CTRL)
+
+ // You can clear bits in CTRL here if you don't want OS to take
+ // control
+
+// And(CTRL, 0xFFFFFFF8, CTRL) // disable Native hot plug, PME
+
+#ifdef AMI_ORIGINAL_FOR_FIX_UUID_INVALID
+ If(Not(And(CDW1,1))) // Query flag clear?
+ { // Disable GPEs for features granted native control.
+ If(And(CTRL,0x01))
+ {
+ NHPG()
+ }
+ If(And(CTRL,0x04)) // PME control granted?
+ {
+ NPME()
+ }
+ }
+#else // AMI_ORIGINAL_FOR_FIX_UUID_INVALID
+ If (LEqual(NEXP,0))
+ {
+ And(CTRL, 0xFFFFFFF8, CTRL) // disable Native hot plug, PME
+ }
+
+ If (NEXP)
+ {
+ If(Not(And(CDW1,1))) // Query flag clear?
+ { // Disable GPEs for features granted native control.
+ If(And(CTRL,0x01))
+ {
+ NHPG()
+ }
+ If(And(CTRL,0x04)) // PME control granted?
+ {
+ NPME()
+ }
+ }
+ }
+
+#endif // AMI_ORIGINAL_FOR_FIX_UUID_INVALID
+
+ If(LNotEqual(Arg1,One))
+ { // Unknown revision
+ Or(CDW1,0x08,CDW1)
+ }
+
+ If(LNotEqual(CDW3,CTRL))
+ { // Capabilities bits were masked
+ Or(CDW1,0x10,CDW1)
+ }
+ // Update DWORD3 in the buffer
+ Store(CTRL,CDW3)
+ Store(CTRL,OSCC)
+ Return(Local0)
+ } Else {
+ Or(CDW1,4,CDW1) // Unrecognized UUID
+ Return(Local0)
+ }
+} // End _OSC
+
+// Added code for Dual IRQ support. Two set of ACPI IRQ tables were generated.
+// Code has been added to select the appropriate IRQ table by checking the CPUID.
+Scope(\_SB.PCI0)
+{
+ Method(AR00) {
+ Return(\_SB.AR00)
+
+ }
+
+ Method(PR00) {
+ Return(\_SB.PR00)
+ }
+
+#if defined(ASL_PCI_BRIDGE_DISABLE) && (ASL_PCI_BRIDGE_DISABLE == 0)
+ Method(AR01) {
+ Return(\_SB.AR01)
+ }
+
+ Method(PR01) {
+ Return(\_SB.PR01)
+ }
+#endif
+
+#ifdef AMI_ORIGINAL_FOR_DISABLE_PCIE_SLOT
+ Method(AR02) {
+ Return(\_SB.AR02)
+ }
+
+ Method(PR02) {
+ Return(\_SB.PR02)
+ }
+
+ Method(AR04) {
+ Return(\_SB.AR04)
+ }
+
+ Method(PR04) {
+ Return(\_SB.PR04)
+ }
+
+ Method(AR05) {
+ Return(\_SB.AR05)
+ }
+
+ Method(PR05) {
+ Return(\_SB.PR05)
+ }
+
+ Method(AR06) {
+ Return(\_SB.AR06)
+ }
+
+ Method(PR06) {
+ Return(\_SB.PR06)
+ }
+
+ Method(AR07) {
+ Return(\_SB.AR07)
+ }
+
+ Method(PR07) {
+ Return(\_SB.PR07)
+ }
+
+ Method(AR08) {
+ Return(\_SB.AR08)
+ }
+
+ Method(PR08) {
+ Return(\_SB.PR08)
+ }
+
+ Method(AR09) {
+ Return(\_SB.AR09)
+ }
+
+ Method(PR09) {
+ Return(\_SB.PR09)
+ }
+
+ Method(AR0A) {
+ Return(\_SB.AR0A)
+ }
+
+ Method(PR0A) {
+ Return(\_SB.PR0A)
+ }
+
+ Method(AR0B) {
+ Return(\_SB.AR0B)
+ }
+
+ Method(PR0B) {
+ Return(\_SB.PR0B)
+ }
+#else // AMI_ORIGINAL_FOR_DISABLE_PCIE_SLOT
+#if defined(ASL_RC_PEG_0) && (ASL_RC_PEG_0 == 1)
+ Method(AR02) {
+ Return(\_SB.AR02)
+ }
+
+ Method(PR02) {
+ Return(\_SB.PR02)
+ }
+#endif
+
+#if defined (ASL_RC_PORT_0) && (ASL_RC_PORT_0 == 1)
+ Method(AR04) {
+ Return(\_SB.AR04)
+ }
+
+ Method(PR04) {
+ Return(\_SB.PR04)
+ }
+
+#if defined (ASL_RC_PORT_1) && (ASL_RC_PORT_1 == 1)
+ Method(AR05) {
+ Return(\_SB.AR05)
+ }
+
+ Method(PR05) {
+ Return(\_SB.PR05)
+ }
+#endif
+
+#if defined (ASL_RC_PORT_2) && (ASL_RC_PORT_2 == 1)
+ Method(AR06) {
+ Return(\_SB.AR06)
+ }
+
+ Method(PR06) {
+ Return(\_SB.PR06)
+ }
+#endif
+
+#if defined (ASL_RC_PORT_3) && (ASL_RC_PORT_3 == 1)
+ Method(AR07) {
+ Return(\_SB.AR07)
+ }
+
+ Method(PR07) {
+ Return(\_SB.PR07)
+ }
+#endif
+
+#if defined (ASL_RC_PORT_4) && (ASL_RC_PORT_4 == 1)
+ Method(AR08) {
+ Return(\_SB.AR08)
+ }
+
+ Method(PR08) {
+ Return(\_SB.PR08)
+ }
+#endif
+
+#if defined (ASL_RC_PORT_5) && (ASL_RC_PORT_5 == 1)
+ Method(AR09) {
+ Return(\_SB.AR09)
+ }
+
+ Method(PR09) {
+ Return(\_SB.PR09)
+ }
+#endif
+
+#if defined (ASL_RC_PORT_6) && (ASL_RC_PORT_6 == 1)
+ Method(AR0E) {
+ Return(\_SB.AR0E)
+ }
+
+ Method(PR0E) {
+ Return(\_SB.PR0E)
+ }
+#endif
+
+#if defined (ASL_RC_PORT_7) && (ASL_RC_PORT_7 == 1)
+ Method(AR0F) {
+ Return(\_SB.AR0F)
+ }
+
+ Method(PR0F) {
+ Return(\_SB.PR0F)
+ }
+#endif
+#endif
+
+#if defined(ASL_RC_PEG_1) && (ASL_RC_PEG_1 == 1)
+ Method(AR0A) {
+ Return(\_SB.AR0A)
+ }
+
+ Method(PR0A) {
+ Return(\_SB.PR0A)
+ }
+
+#if defined(ASL_RC_PEG_2) && (ASL_RC_PEG_2 == 1)
+ Method(AR0B) {
+ Return(\_SB.AR0B)
+ }
+
+ Method(PR0B) {
+ Return(\_SB.PR0B)
+ }
+#endif
+#endif
+#endif // AMI_ORIGINAL_FOR_DISABLE_PCIE_SLOT
+}
+
+#ifndef AMI_OVERRIDE_FOR_TPM_AREA_REPORT
+Device(TPMX)
+{
+ Name(_HID, EISAID("PNP0C01")) // Hardware Device ID
+ Name(_UID, 1)
+
+ Name(CRS, ResourceTemplate()
+ {
+ Memory32Fixed(ReadOnly, 0xFED40000, 0x5000, TPMR) //Non-writeable
+ })
+
+ Method (_CRS, 0)
+ {
+ Return(CRS)
+ }
+ // if TPM is active, TPM module will report TPM area to OS.
+ Method (_STA, 0)
+ {
+ If(TPMF)
+ {
+ Return(0x00)
+ }
+ Return(0x0F)
+ }
+}
+#endif // AMI_OVERRIDE_FOR_TPM_AREA_REPORT
diff --git a/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaAcpiTables.cif b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaAcpiTables.cif
new file mode 100644
index 0000000..3dc05f6
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaAcpiTables.cif
@@ -0,0 +1,18 @@
+<component>
+ name = "SaAcpiTables"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\SystemAgent\AcpiTables"
+ RefName = "SaAcpiTables"
+[files]
+"SaAcpiTables.sdl"
+"SaAcpiTables.mak"
+"HOST_BUS.ASL"
+"Dmar\Dmar.act"
+"Dmar\Dmar.h"
+"SaAcpiTables.inf"
+"SaAcpiTables_Edk.inf"
+[parts]
+"SaSsdtTables"
+"SgAcpiTablesPeg"
+"SgAcpiTablesPch"
+<endComponent>
diff --git a/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaAcpiTables.inf b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaAcpiTables.inf
new file mode 100644
index 0000000..3439079
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaAcpiTables.inf
@@ -0,0 +1,54 @@
+## @file
+# Component description file for the ACPI tables
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = SaAcpiTables
+FILE_GUID = 27E569D5-0AFC-4D8F-8C90-783AC4A318AB
+COMPONENT_TYPE = ACPITABLE
+FFS_EXT = .ffs
+
+[sources.common]
+ Dmar/Dmar.act
+ Dmar/Dmar.h
+
+[libraries.common]
+
+[includes.common]
+ .
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Include
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/SampleCode/Include
+
+[nmake.common]
diff --git a/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaAcpiTables.mak b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaAcpiTables.mak
new file mode 100644
index 0000000..c4cd7e7
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaAcpiTables.mak
@@ -0,0 +1,41 @@
+all : SaAcpiTables
+
+SaAcpiTables : $(BUILD_DIR)\SaAcpiTables.ffS
+
+SaAcpiTables_Includes = \
+ $(EDK_INCLUDES)\
+ $(INTEL_MCH_INCLUDES)\
+
+SaAcpiTables_Defines = \
+ /D"TIANO_RELEASE_VERSION=0x00080006"\
+
+SaAcpiTables_ACPIS = \
+ $(BUILD_DIR)\Dmar.acpi\
+
+$(BUILD_DIR)\SaAcpiTables.asl: $(BUILD_DIR)\token.mak $(SaAcpiTables_DIR)\SaAcpiTables.mak
+ copy << $@
+!IF "$(TCG2Support)" == "0" || "$(TCG2Support)" == ""
+!IF "$(TCG_SUPPORT)" != "1"
+Name(TPMF, 0x0)
+!ENDIF
+!ENDIF
+<<
+
+$(BUILD_DIR)\Dmar.exe : $(SaAcpiTables_DIR)\Dmar\Dmar.act $(SaAcpiTables_DIR)\Dmar\Dmar.h
+ @CL $(CFLAGS) $(SaAcpiTables_Defines) /Fo$(BUILD_DIR)\ $(SaAcpiTables_Includes) /TC $(SaAcpiTables_DIR)\Dmar\Dmar.act
+ @Link /OUT:$(BUILD_DIR)\Dmar.exe /NODEFAULTLIB /ENTRY:main $(BUILD_DIR)\Dmar.obj
+
+$(BUILD_DIR)\Dmar.acpi : $(BUILD_DIR)\Dmar.exe
+ $(GENACPITABLE) $(BUILD_DIR)\Dmar.exe $(BUILD_DIR)\Dmar.acpi
+
+$(BUILD_DIR)\SaAcpiTables.sec : $(SaAcpiTables_ACPIS)
+ $(GENSECTION) -I $** -O $@ -S EFI_SECTION_RAW
+
+$(BUILD_DIR)\SaAcpiTables.ffs: $(BUILD_DIR)\SaAcpiTables.sec $(SaAcpiTables_DIR)\SaAcpiTables.mak
+ $(MAKE) /f Core\FFS.mak \
+ BUILD_DIR=$(BUILD_DIR) \
+ GUID=27E569D5-0AFC-4D8F-8C90-783AC4A318AB\
+ TYPE=EFI_FV_FILETYPE_FREEFORM \
+ FFS_CHECKSUM=1\
+ RAWFILE=$(BUILD_DIR)\SaAcpiTables.sec FFSFILE=$(BUILD_DIR)\SaAcpiTables.ffs COMPRESS=0 NAME=SaAcpiTables
+
diff --git a/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaAcpiTables.sdl b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaAcpiTables.sdl
new file mode 100644
index 0000000..e122ec8
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaAcpiTables.sdl
@@ -0,0 +1,41 @@
+TOKEN
+ Name = "SaAcpiTables_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable SaAcpiTables support in Project"
+ TokenType = Boolean
+ Master = Yes
+End
+
+PATH
+ Name = "SaAcpiTables_DIR"
+End
+
+TOKEN
+ Name = "GENACPITABLE"
+ Value = "$(INTEL_SYSTEM_AGENT_DIR)\SampleCode\Tools\GenAcpiTable"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+MODULE
+ Help = "Includes SaAcpiTables.mak to Project"
+ File = "SaAcpiTables.mak"
+End
+
+ELINK
+ Name = "/I$(SaAcpiTables_DIR)\Dmar"
+ Parent = "INTEL_MCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\SaAcpiTables.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\SaAcpiTables.asl"
+ Parent = "GENERIC_ASL"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaAcpiTables_Edk.inf b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaAcpiTables_Edk.inf
new file mode 100644
index 0000000..b47548a
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaAcpiTables_Edk.inf
@@ -0,0 +1,54 @@
+## @file
+# Component description file for the ACPI tables (for EDK1117)
+#
+#@copyright
+# Copyright (c) 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = SaAcpiTables
+FILE_GUID = 27E569D5-0AFC-4D8F-8C90-783AC4A318AB
+COMPONENT_TYPE = SA_DMAR_ACPITABLE
+FFS_EXT = .ffs
+
+[sources.common]
+ Dmar/Dmar.act
+ Dmar/Dmar.h
+
+[libraries.common]
+
+[includes.common]
+ .
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Include
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/SampleCode/Include
+
+[nmake.common]
diff --git a/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/INTELGFX.ASL b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/INTELGFX.ASL
new file mode 100644
index 0000000..153afd5
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/INTELGFX.ASL
@@ -0,0 +1,1731 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+
+Module Name:
+
+ INTELGFX.ASL
+
+Abstract:
+
+ IGD OpRegion/Software ACPI Reference Code.
+
+--*/
+
+
+ External(\_SB.PCI0.GFX0.IDAB, MethodObj)
+ External(\_SB.PCI0.GFX0.HWID, MethodObj)
+ External(\ECST, MethodObj)
+ External(HDOS, MethodObj)
+#if !defined(ASL_Remove_SaSsdt_Data_To_Dsdt) || (ASL_Remove_SaSsdt_Data_To_Dsdt == 0)
+ External(\ECON, IntObj)
+ External(\PNHM, IntObj)
+#endif // AMI_OVERRIDE
+ External(OSYS, IntObj)
+ External(SCIS)
+ External(\GUAM, MethodObj)
+ External(DSEN)
+ External(BID)
+ External(BHB)
+ External(BFS2)
+ External(BFS3)
+ External(BFS4)
+
+
+ External(S0ID)
+ External(\ADBG, MethodObj)
+ External(\_SB.PEPD, DeviceObj)
+
+ Method(_DEP){
+ ADBG("GFX0 DEP Call")
+ If(LEqual(S0ID, 1)){
+ ADBG("GFX0 DEP")
+ Return(Package() {\_SB.PEPD})
+ }Else{
+ ADBG("GFX0 DEP NULL")
+ Return(Package(){})
+ }
+ }
+
+ // Enable/Disable Output Switching. In WIN2K/WINXP, _DOS = 0 will
+ // get called during initialization to prepare for an ACPI Display
+ // Switch Event. During an ACPI Display Switch, the OS will call
+ // _DOS = 2 immediately after a Notify=0x80 to temporarily disable
+ // all Display Switching. After ACPI Display Switching is complete,
+ // the OS will call _DOS = 0 to re-enable ACPI Display Switching.
+
+ Method(_DOS,1)
+ {
+ // Store Display Switching and LCD brightness BIOS control bit
+ Store(And(Arg0,7),DSEN)
+
+ If(LEqual(And(Arg0, 0x3), 0)) // If _DOS[1:0]=0
+ {
+ If(CondRefOf(HDOS))
+ {
+ HDOS()
+ }
+ }
+ }
+
+ // Enumerate the Display Environment. This method will return
+ // valid addresses for all display device encoders present in the
+ // system. The Miniport Driver will reject the addresses for every
+ // encoder that does not have an attached display device. After
+ // enumeration is complete, the OS will call the _DGS methods
+ // during a display switch only for the addresses accepted by the
+ // Miniport Driver. For hot-insertion and removal of display
+ // devices, a re-enumeration notification will be required so the
+ // address of the newly present display device will be accepted by
+ // the Miniport Driver.
+
+ Method(_DOD,0)
+ {
+
+ If (CondRefOf(IDAB))
+ {
+ IDAB()
+ }
+ Else
+ {
+ Store(0, NDID)
+
+ If(LNotEqual(DIDL, Zero))
+ {
+ Store(SDDL(DIDL),DID1)
+ }
+ If(LNotEqual(DDL2, Zero))
+ {
+ Store(SDDL(DDL2),DID2)
+ }
+ If(LNotEqual(DDL3, Zero))
+ {
+ Store(SDDL(DDL3),DID3)
+ }
+ If(LNotEqual(DDL4, Zero))
+ {
+ Store(SDDL(DDL4),DID4)
+ }
+ If(LNotEqual(DDL5, Zero))
+ {
+ Store(SDDL(DDL5),DID5)
+ }
+ If(LNotEqual(DDL6, Zero))
+ {
+ Store(SDDL(DDL6),DID6)
+ }
+ If(LNotEqual(DDL7, Zero))
+ {
+ Store(SDDL(DDL7),DID7)
+ }
+ If(LNotEqual(DDL8, Zero))
+ {
+ Store(SDDL(DDL8),DID8)
+ }
+ If(LNotEqual(DDL9, Zero))
+ {
+ Store(SDDL(DDL9),DID9)
+ }
+ If(LNotEqual(DD10, Zero))
+ {
+ Store(SDDL(DD10),DIDA)
+ }
+ If(LNotEqual(DD11, Zero))
+ {
+ Store(SDDL(DD11),DIDB)
+ }
+ If(LNotEqual(DD12, Zero))
+ {
+ Store(SDDL(DD12),DIDC)
+ }
+ If(LNotEqual(DD13, Zero))
+ {
+ Store(SDDL(DD13),DIDD)
+ }
+ If(LNotEqual(DD14, Zero))
+ {
+ Store(SDDL(DD14),DIDE)
+ }
+ If(LNotEqual(DD15, Zero))
+ {
+ Store(SDDL(DD15),DIDF)
+ }
+ }
+
+ // @todo - This level of flexibility is not needed for a true
+ // OEM design. Simply determine the greatest number of
+ // encoders the platform will suppport then remove all
+ // return packages beyond that value. Note that for
+ // current silicon, the maximum number of encoders
+ // possible is 8.
+
+ If(LEqual(NDID,1))
+ {
+ Name(TMP1,Package() {0xFFFFFFFF})
+ Store(Or(0x10000,DID1),Index(TMP1,0))
+ Return(TMP1)
+ }
+
+ If(LEqual(NDID,2))
+ {
+ Name(TMP2,Package() {0xFFFFFFFF,
+ 0xFFFFFFFF})
+ Store(Or(0x10000,DID1),Index(TMP2,0))
+ Store(Or(0x10000,DID2),Index(TMP2,1))
+ Return(TMP2)
+ }
+
+ If(LEqual(NDID,3))
+ {
+ Name(TMP3,Package() {0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF})
+ Store(Or(0x10000,DID1),Index(TMP3,0))
+ Store(Or(0x10000,DID2),Index(TMP3,1))
+ Store(Or(0x10000,DID3),Index(TMP3,2))
+ Return(TMP3)
+ }
+
+ If(LEqual(NDID,4))
+ {
+ Name(TMP4,Package() {0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF})
+ Store(Or(0x10000,DID1),Index(TMP4,0))
+ Store(Or(0x10000,DID2),Index(TMP4,1))
+ Store(Or(0x10000,DID3),Index(TMP4,2))
+ Store(Or(0x10000,DID4),Index(TMP4,3))
+ Return(TMP4)
+ }
+
+ If(LEqual(NDID,5))
+ {
+ Name(TMP5,Package() {0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF})
+ Store(Or(0x10000,DID1),Index(TMP5,0))
+ Store(Or(0x10000,DID2),Index(TMP5,1))
+ Store(Or(0x10000,DID3),Index(TMP5,2))
+ Store(Or(0x10000,DID4),Index(TMP5,3))
+ Store(Or(0x10000,DID5),Index(TMP5,4))
+ Return(TMP5)
+ }
+
+ If(LEqual(NDID,6))
+ {
+ Name(TMP6,Package() {0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF})
+ Store(Or(0x10000,DID1),Index(TMP6,0))
+ Store(Or(0x10000,DID2),Index(TMP6,1))
+ Store(Or(0x10000,DID3),Index(TMP6,2))
+ Store(Or(0x10000,DID4),Index(TMP6,3))
+ Store(Or(0x10000,DID5),Index(TMP6,4))
+ Store(Or(0x10000,DID6),Index(TMP6,5))
+ Return(TMP6)
+ }
+
+ If(LEqual(NDID,7))
+ {
+ Name(TMP7,Package() {0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF})
+ Store(Or(0x10000,DID1),Index(TMP7,0))
+ Store(Or(0x10000,DID2),Index(TMP7,1))
+ Store(Or(0x10000,DID3),Index(TMP7,2))
+ Store(Or(0x10000,DID4),Index(TMP7,3))
+ Store(Or(0x10000,DID5),Index(TMP7,4))
+ Store(Or(0x10000,DID6),Index(TMP7,5))
+ Store(Or(0x10000,DID7),Index(TMP7,6))
+ Return(TMP7)
+ }
+
+ If(LEqual(NDID,8))
+ {
+ Name(TMP8,Package() {0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF})
+ Store(Or(0x10000,DID1),Index(TMP8,0))
+ Store(Or(0x10000,DID2),Index(TMP8,1))
+ Store(Or(0x10000,DID3),Index(TMP8,2))
+ Store(Or(0x10000,DID4),Index(TMP8,3))
+ Store(Or(0x10000,DID5),Index(TMP8,4))
+ Store(Or(0x10000,DID6),Index(TMP8,5))
+ Store(Or(0x10000,DID7),Index(TMP8,6))
+ Store(Or(0x10000,DID8),Index(TMP8,7))
+ Return(TMP8)
+ }
+
+ If(LEqual(NDID,9))
+ {
+ Name(TMP9,Package() {0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF})
+ Store(Or(0x10000,DID1),Index(TMP9,0))
+ Store(Or(0x10000,DID2),Index(TMP9,1))
+ Store(Or(0x10000,DID3),Index(TMP9,2))
+ Store(Or(0x10000,DID4),Index(TMP9,3))
+ Store(Or(0x10000,DID5),Index(TMP9,4))
+ Store(Or(0x10000,DID6),Index(TMP9,5))
+ Store(Or(0x10000,DID7),Index(TMP9,6))
+ Store(Or(0x10000,DID8),Index(TMP9,7))
+ Store(Or(0x10000,DID9),Index(TMP9,8))
+ Return(TMP9)
+ }
+
+ If(LEqual(NDID,0x0A))
+ {
+ Name(TMPA,Package() {0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF})
+ Store(Or(0x10000,DID1),Index(TMPA,0))
+ Store(Or(0x10000,DID2),Index(TMPA,1))
+ Store(Or(0x10000,DID3),Index(TMPA,2))
+ Store(Or(0x10000,DID4),Index(TMPA,3))
+ Store(Or(0x10000,DID5),Index(TMPA,4))
+ Store(Or(0x10000,DID6),Index(TMPA,5))
+ Store(Or(0x10000,DID7),Index(TMPA,6))
+ Store(Or(0x10000,DID8),Index(TMPA,7))
+ Store(Or(0x10000,DID9),Index(TMPA,8))
+ Store(Or(0x10000,DIDA),Index(TMPA,9))
+ Return(TMPA)
+ }
+
+ If(LEqual(NDID,0x0B))
+ {
+ Name(TMPB,Package() {0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF})
+ Store(Or(0x10000,DID1),Index(TMPB,0))
+ Store(Or(0x10000,DID2),Index(TMPB,1))
+ Store(Or(0x10000,DID3),Index(TMPB,2))
+ Store(Or(0x10000,DID4),Index(TMPB,3))
+ Store(Or(0x10000,DID5),Index(TMPB,4))
+ Store(Or(0x10000,DID6),Index(TMPB,5))
+ Store(Or(0x10000,DID7),Index(TMPB,6))
+ Store(Or(0x10000,DID8),Index(TMPB,7))
+ Store(Or(0x10000,DID9),Index(TMPB,8))
+ Store(Or(0x10000,DIDA),Index(TMPB,9))
+ Store(Or(0x10000,DIDB),Index(TMPB,10))
+ Return(TMPB)
+ }
+
+ If(LEqual(NDID,0x0C))
+ {
+ Name(TMPC,Package() {0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF})
+ Store(Or(0x10000,DID1),Index(TMPC,0))
+ Store(Or(0x10000,DID2),Index(TMPC,1))
+ Store(Or(0x10000,DID3),Index(TMPC,2))
+ Store(Or(0x10000,DID4),Index(TMPC,3))
+ Store(Or(0x10000,DID5),Index(TMPC,4))
+ Store(Or(0x10000,DID6),Index(TMPC,5))
+ Store(Or(0x10000,DID7),Index(TMPC,6))
+ Store(Or(0x10000,DID8),Index(TMPC,7))
+ Store(Or(0x10000,DID9),Index(TMPC,8))
+ Store(Or(0x10000,DIDA),Index(TMPC,9))
+ Store(Or(0x10000,DIDB),Index(TMPC,10))
+ Store(Or(0x10000,DIDC),Index(TMPC,11))
+ Return(TMPC)
+ }
+
+ If(LEqual(NDID,0x0D))
+ {
+ Name(TMPD,Package() {0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF})
+ Store(Or(0x10000,DID1),Index(TMPD,0))
+ Store(Or(0x10000,DID2),Index(TMPD,1))
+ Store(Or(0x10000,DID3),Index(TMPD,2))
+ Store(Or(0x10000,DID4),Index(TMPD,3))
+ Store(Or(0x10000,DID5),Index(TMPD,4))
+ Store(Or(0x10000,DID6),Index(TMPD,5))
+ Store(Or(0x10000,DID7),Index(TMPD,6))
+ Store(Or(0x10000,DID8),Index(TMPD,7))
+ Store(Or(0x10000,DID9),Index(TMPD,8))
+ Store(Or(0x10000,DIDA),Index(TMPD,9))
+ Store(Or(0x10000,DIDB),Index(TMPD,10))
+ Store(Or(0x10000,DIDC),Index(TMPD,11))
+ Store(Or(0x10000,DIDD),Index(TMPD,12))
+ Return(TMPD)
+ }
+
+ If(LEqual(NDID,0x0E))
+ {
+ Name(TMPE,Package() {0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF})
+ Store(Or(0x10000,DID1),Index(TMPE,0))
+ Store(Or(0x10000,DID2),Index(TMPE,1))
+ Store(Or(0x10000,DID3),Index(TMPE,2))
+ Store(Or(0x10000,DID4),Index(TMPE,3))
+ Store(Or(0x10000,DID5),Index(TMPE,4))
+ Store(Or(0x10000,DID6),Index(TMPE,5))
+ Store(Or(0x10000,DID7),Index(TMPE,6))
+ Store(Or(0x10000,DID8),Index(TMPE,7))
+ Store(Or(0x10000,DID9),Index(TMPE,8))
+ Store(Or(0x10000,DIDA),Index(TMPE,9))
+ Store(Or(0x10000,DIDB),Index(TMPE,10))
+ Store(Or(0x10000,DIDC),Index(TMPE,11))
+ Store(Or(0x10000,DIDD),Index(TMPE,12))
+ Store(Or(0x10000,DIDE),Index(TMPE,13))
+ Return(TMPE)
+ }
+
+ If(LEqual(NDID,0x0F))
+ {
+
+ Name(TMPF,Package() {0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF,
+ 0xFFFFFFFF})
+ Store(Or(0x10000,DID1),Index(TMPF,0))
+ Store(Or(0x10000,DID2),Index(TMPF,1))
+ Store(Or(0x10000,DID3),Index(TMPF,2))
+ Store(Or(0x10000,DID4),Index(TMPF,3))
+ Store(Or(0x10000,DID5),Index(TMPF,4))
+ Store(Or(0x10000,DID6),Index(TMPF,5))
+ Store(Or(0x10000,DID7),Index(TMPF,6))
+ Store(Or(0x10000,DID8),Index(TMPF,7))
+ Store(Or(0x10000,DID9),Index(TMPF,8))
+ Store(Or(0x10000,DIDA),Index(TMPF,9))
+ Store(Or(0x10000,DIDB),Index(TMPF,10))
+ Store(Or(0x10000,DIDC),Index(TMPF,11))
+ Store(Or(0x10000,DIDD),Index(TMPF,12))
+ Store(Or(0x10000,DIDE),Index(TMPF,13))
+ Store(Or(0x10000,DIDF),Index(TMPF,14))
+ Return(TMPF)
+ }
+
+ // If nothing else, return Unknown LFP.
+ // (Prevents compiler warning.)
+
+ Return(Package() {0x00000400})
+ }
+
+ Device(DD01)
+ {
+
+ // Return Unique ID.
+
+ Method(_ADR,0,Serialized)
+ {
+ If(LEqual(And(0x0F00,DID1),0x400))
+ {
+ Store(0x1, EDPV)
+ Store(NXD1, NXDX)
+ Store(DID1, DIDX)
+ Return(1)
+ }
+ If(LEqual(DID1,0))
+ {
+ Return(1)
+ }
+ Else
+ {
+ Return(And(0xFFFF,DID1))
+ }
+ }
+
+ // Return the Current Status.
+
+ Method(_DCS,0)
+ {
+ Return(CDDS(DID1))
+ }
+
+ // Query Graphics State (active or inactive).
+
+ Method(_DGS,0)
+ {
+ If(LAnd(LEqual(And(SGMD,0x7F),0x01),CondRefOf(SNXD)))
+ {
+ Return (NXD1)
+ }
+ Return(NDDS(DID1))
+ }
+
+ // Device Set State.
+
+ // _DSS Table:
+ //
+ // BIT31 BIT30 Execution
+ // 0 0 Don't implement.
+ // 0 1 Cache change. Nothing to Implement.
+ // 1 0 Don't Implement.
+ // 1 1 Display Switch Complete. Implement.
+
+ Method(_DSS,1)
+ {
+ If(LEqual(And(Arg0,0xC0000000),0xC0000000))
+ {
+
+ // State change was performed by the
+ // Video Drivers. Simply update the
+ // New State.
+
+ Store(NSTE,CSTE)
+ }
+ }
+ }
+
+ Device(DD02)
+ {
+
+ // Return Unique ID.
+
+ Method(_ADR,0,Serialized)
+ {
+ If(LEqual(And(0x0F00,DID2),0x400))
+ {
+ Store(0x2, EDPV)
+ Store(NXD2, NXDX)
+ Store(DID2, DIDX)
+ Return(2)
+ }
+ If(LEqual(DID2,0))
+ {
+ Return(2)
+ }
+ Else
+ {
+ Return(And(0xFFFF,DID2))
+ }
+ }
+
+ // Return the Current Status.
+
+ Method(_DCS,0)
+ {
+ If(LEqual(LIDS,0))
+ {
+ Return(0x0)
+ }
+
+ Return(CDDS(DID2))
+ }
+
+ // Query Graphics State (active or inactive).
+
+ Method(_DGS,0)
+ {
+ // Return the Next State.
+ If(LAnd(LEqual(And(SGMD,0x7F),0x01),CondRefOf(SNXD)))
+ {
+ Return (NXD2)
+ }
+ Return(NDDS(DID2))
+ }
+
+ // Device Set State. (See table above.)
+
+ Method(_DSS,1)
+ {
+ If(LEqual(And(Arg0,0xC0000000),0xC0000000))
+ {
+
+ // State change was performed by the
+ // Video Drivers. Simply update the
+ // New State.
+
+ Store(NSTE,CSTE)
+ }
+ }
+ }
+
+ Device(DD03)
+ {
+
+ // Return Unique ID.
+
+ Method(_ADR,0,Serialized)
+ {
+ If(LEqual(And(0x0F00,DID3),0x400))
+ {
+ Store(0x3, EDPV)
+ Store(NXD3, NXDX)
+ Store(DID3, DIDX)
+ Return(3)
+ }
+ If(LEqual(DID3,0))
+ {
+ Return(3)
+ }
+ Else
+ {
+ Return(And(0xFFFF,DID3))
+ }
+ }
+
+ // Return the Current Status.
+
+ Method(_DCS,0)
+ {
+ If(LEqual(DID3,0))
+ {
+ Return(0x0B)
+ }
+ Else
+ {
+ Return(CDDS(DID3))
+ }
+ }
+
+ // Query Graphics State (active or inactive).
+
+ Method(_DGS,0)
+ {
+ If(LAnd(LEqual(And(SGMD,0x7F),0x01),CondRefOf(SNXD)))
+ {
+ Return (NXD3)
+ }
+ Return(NDDS(DID3))
+ }
+
+ // Device Set State. (See table above.)
+
+ Method(_DSS,1)
+ {
+ If(LEqual(And(Arg0,0xC0000000),0xC0000000))
+ {
+ // State change was performed by the
+ // Video Drivers. Simply update the
+ // New State.
+
+ Store(NSTE,CSTE)
+ }
+ }
+ }
+
+ Device(DD04)
+ {
+
+ // Return Unique ID.
+
+ Method(_ADR,0,Serialized)
+ {
+ If(LEqual(And(0x0F00,DID4),0x400))
+ {
+ Store(0x4, EDPV)
+ Store(NXD4, NXDX)
+ Store(DID4, DIDX)
+ Return(4)
+ }
+ If(LEqual(DID4,0))
+ {
+ Return(4)
+ }
+ Else
+ {
+ Return(And(0xFFFF,DID4))
+ }
+ }
+
+ // Return the Current Status.
+
+ Method(_DCS,0)
+ {
+ If(LEqual(DID4,0))
+ {
+ Return(0x0B)
+ }
+ Else
+ {
+ Return(CDDS(DID4))
+ }
+ }
+
+ // Query Graphics State (active or inactive).
+
+ Method(_DGS,0)
+ {
+ If(LAnd(LEqual(And(SGMD,0x7F),0x01),CondRefOf(SNXD)))
+ {
+ Return (NXD4)
+ }
+ Return(NDDS(DID4))
+ }
+
+ // Device Set State. (See table above.)
+
+ Method(_DSS,1)
+ {
+ If(LEqual(And(Arg0,0xC0000000),0xC0000000))
+ {
+
+ // State change was performed by the
+ // Video Drivers. Simply update the
+ // New State.
+
+ Store(NSTE,CSTE)
+ }
+ }
+ }
+
+
+ Device(DD05)
+ {
+
+ // Return Unique ID.
+
+ Method(_ADR,0,Serialized)
+ {
+ If(LEqual(And(0x0F00,DID5),0x400))
+ {
+ Store(0x5, EDPV)
+ Store(NXD5, NXDX)
+ Store(DID5, DIDX)
+ Return(5)
+ }
+ If(LEqual(DID5,0))
+ {
+ Return(5)
+ }
+ Else
+ {
+ Return(And(0xFFFF,DID5))
+ }
+ }
+
+ // Return the Current Status.
+
+ Method(_DCS,0)
+ {
+ If(LEqual(DID5,0))
+ {
+ Return(0x0B)
+ }
+ Else
+ {
+ Return(CDDS(DID5))
+ }
+ }
+
+ // Query Graphics State (active or inactive).
+
+ Method(_DGS,0)
+ {
+ If(LAnd(LEqual(And(SGMD,0x7F),0x01),CondRefOf(SNXD)))
+ {
+ Return (NXD5)
+ }
+ Return(NDDS(DID5))
+ }
+
+ // Device Set State. (See table above.)
+
+ Method(_DSS,1)
+ {
+ If(LEqual(And(Arg0,0xC0000000),0xC0000000))
+ {
+ // State change was performed by the
+ // Video Drivers. Simply update the
+ // New State.
+
+ Store(NSTE,CSTE)
+ }
+ }
+ }
+
+
+ Device(DD06)
+ {
+
+ // Return Unique ID.
+
+ Method(_ADR,0,Serialized)
+ {
+ If(LEqual(And(0x0F00,DID6),0x400))
+ {
+ Store(0x6, EDPV)
+ Store(NXD6, NXDX)
+ Store(DID6, DIDX)
+ Return(6)
+ }
+ If(LEqual(DID6,0))
+ {
+ Return(6)
+ }
+ Else
+ {
+ Return(And(0xFFFF,DID6))
+ }
+ }
+
+ // Return the Current Status.
+
+ Method(_DCS,0)
+ {
+ If(LEqual(DID6,0))
+ {
+ Return(0x0B)
+ }
+ Else
+ {
+ Return(CDDS(DID6))
+ }
+ }
+
+ // Query Graphics State (active or inactive).
+
+ Method(_DGS,0)
+ {
+ If(LAnd(LEqual(And(SGMD,0x7F),0x01),CondRefOf(SNXD)))
+ {
+ Return (NXD6)
+ }
+ Return(NDDS(DID6))
+ }
+
+ // Device Set State. (See table above.)
+
+ Method(_DSS,1)
+ {
+ If(LEqual(And(Arg0,0xC0000000),0xC0000000))
+ {
+ // State change was performed by the
+ // Video Drivers. Simply update the
+ // New State.
+
+ Store(NSTE,CSTE)
+ }
+ }
+ }
+
+
+ Device(DD07)
+ {
+
+ // Return Unique ID.
+
+ Method(_ADR,0,Serialized)
+ {
+ If(LEqual(And(0x0F00,DID7),0x400))
+ {
+ Store(0x7, EDPV)
+ Store(NXD7, NXDX)
+ Store(DID7, DIDX)
+ Return(7)
+ }
+ If(LEqual(DID7,0))
+ {
+ Return(7)
+ }
+ Else
+ {
+ Return(And(0xFFFF,DID7))
+ }
+ }
+
+ // Return the Current Status.
+
+ Method(_DCS,0)
+ {
+ If(LEqual(DID7,0))
+ {
+ Return(0x0B)
+ }
+ Else
+ {
+ Return(CDDS(DID7))
+ }
+ }
+
+ // Query Graphics State (active or inactive).
+
+ Method(_DGS,0)
+ {
+ If(LAnd(LEqual(And(SGMD,0x7F),0x01),CondRefOf(SNXD)))
+ {
+ Return (NXD7)
+ }
+ Return(NDDS(DID7))
+ }
+
+ // Device Set State. (See table above.)
+
+ Method(_DSS,1)
+ {
+ If(LEqual(And(Arg0,0xC0000000),0xC0000000))
+ {
+ // State change was performed by the
+ // Video Drivers. Simply update the
+ // New State.
+
+ Store(NSTE,CSTE)
+ }
+ }
+ }
+
+
+ Device(DD08)
+ {
+
+ // Return Unique ID.
+
+ Method(_ADR,0,Serialized)
+ {
+ If(LEqual(And(0x0F00,DID8),0x400))
+ {
+ Store(0x8, EDPV)
+ Store(NXD8, NXDX)
+ Store(DID8, DIDX)
+ Return(8)
+ }
+ If(LEqual(DID8,0))
+ {
+ Return(8)
+ }
+ Else
+ {
+ Return(And(0xFFFF,DID8))
+ }
+ }
+
+ // Return the Current Status.
+
+ Method(_DCS,0)
+ {
+ If(LEqual(DID8,0))
+ {
+ Return(0x0B)
+ }
+ Else
+ {
+ Return(CDDS(DID8))
+ }
+ }
+
+ // Query Graphics State (active or inactive).
+
+ Method(_DGS,0)
+ {
+ If(LAnd(LEqual(And(SGMD,0x7F),0x01),CondRefOf(SNXD)))
+ {
+ Return (NXD8)
+ }
+ Return(NDDS(DID8))
+ }
+
+ // Device Set State. (See table above.)
+
+ Method(_DSS,1)
+ {
+ If(LEqual(And(Arg0,0xC0000000),0xC0000000))
+ {
+ // State change was performed by the
+ // Video Drivers. Simply update the
+ // New State.
+
+ Store(NSTE,CSTE)
+ }
+ }
+ }
+
+ Device(DD09)
+ {
+ // Return Unique ID.
+
+ Method(_ADR,0,Serialized)
+ {
+ If(LEqual(And(0x0F00,DID9),0x400))
+ {
+ Store(0x9, EDPV)
+ Store(NXD8, NXDX)
+ Store(DID9, DIDX)
+ Return(9)
+ }
+ If(LEqual(DID9,0))
+ {
+ Return(9)
+ }
+ Else
+ {
+ Return(And(0xFFFF,DID9))
+ }
+ }
+
+ // Return the Current Status.
+
+ Method(_DCS,0)
+ {
+ If(LEqual(DID9,0))
+ {
+ Return(0x0B)
+ }
+ Else
+ {
+ Return(CDDS(DID9))
+ }
+ }
+
+ // Query Graphics State (active or inactive).
+
+ Method(_DGS,0)
+ {
+ If(LAnd(LEqual(And(SGMD,0x7F),0x01),CondRefOf(SNXD)))
+ {
+ Return (NXD8)
+ }
+ Return(NDDS(DID9))
+ }
+
+ // Device Set State. (See table above.)
+
+ Method(_DSS,1)
+ {
+ If(LEqual(And(Arg0,0xC0000000),0xC0000000))
+ {
+ // State change was performed by the
+ // Video Drivers. Simply update the
+ // New State.
+ Store(NSTE,CSTE)
+ }
+ }
+ }
+
+ Device(DD0A)
+ {
+ // Return Unique ID.
+
+ Method(_ADR,0,Serialized)
+ {
+ If(LEqual(And(0x0F00,DIDA),0x400))
+ {
+ Store(0xA, EDPV)
+ Store(NXD8, NXDX)
+ Store(DIDA, DIDX)
+ Return(0x0A)
+ }
+ If(LEqual(DIDA,0))
+ {
+ Return(0x0A)
+ }
+ Else
+ {
+ Return(And(0xFFFF,DIDA))
+ }
+ }
+
+ // Return the Current Status.
+
+ Method(_DCS,0)
+ {
+ If(LEqual(DIDA,0))
+ {
+ Return(0x0B)
+ }
+ Else
+ {
+ Return(CDDS(DIDA))
+ }
+ }
+
+ // Query Graphics State (active or inactive).
+
+ Method(_DGS,0)
+ {
+ If(LAnd(LEqual(And(SGMD,0x7F),0x01),CondRefOf(SNXD)))
+ {
+ Return (NXD8)
+ }
+ Return(NDDS(DIDA))
+ }
+
+ // Device Set State. (See table above.)
+
+ Method(_DSS,1)
+ {
+ If(LEqual(And(Arg0,0xC0000000),0xC0000000))
+ {
+ // State change was performed by the
+ // Video Drivers. Simply update the
+ // New State.
+ Store(NSTE,CSTE)
+ }
+ }
+ }
+
+ Device(DD0B)
+ {
+ // Return Unique ID.
+
+ Method(_ADR,0,Serialized)
+ {
+ If(LEqual(And(0x0F00,DIDB),0x400))
+ {
+ Store(0xB, EDPV)
+ Store(NXD8, NXDX)
+ Store(DIDB, DIDX)
+ Return(0X0B)
+ }
+ If(LEqual(DIDB,0))
+ {
+ Return(0x0B)
+ }
+ Else
+ {
+ Return(And(0xFFFF,DIDB))
+ }
+ }
+
+ // Return the Current Status.
+
+ Method(_DCS,0)
+ {
+ If(LEqual(DIDB,0))
+ {
+ Return(0x0B)
+ }
+ Else
+ {
+ Return(CDDS(DIDB))
+ }
+ }
+
+ // Query Graphics State (active or inactive).
+
+ Method(_DGS,0)
+ {
+ If(LAnd(LEqual(And(SGMD,0x7F),0x01),CondRefOf(SNXD)))
+ {
+ Return (NXD8)
+ }
+ Return(NDDS(DIDB))
+ }
+
+ // Device Set State. (See table above.)
+
+ Method(_DSS,1)
+ {
+ If(LEqual(And(Arg0,0xC0000000),0xC0000000))
+ {
+ // State change was performed by the
+ // Video Drivers. Simply update the
+ // New State.
+ Store(NSTE,CSTE)
+ }
+ }
+ }
+
+ Device(DD0C)
+ {
+ // Return Unique ID.
+
+ Method(_ADR,0,Serialized)
+ {
+ If(LEqual(And(0x0F00,DIDC),0x400))
+ {
+ Store(0xC, EDPV)
+ Store(NXD8, NXDX)
+ Store(DIDC, DIDX)
+ Return(0X0C)
+ }
+ If(LEqual(DIDC,0))
+ {
+ Return(0x0C)
+ }
+ Else
+ {
+ Return(And(0xFFFF,DIDC))
+ }
+ }
+
+ // Return the Current Status.
+
+ Method(_DCS,0)
+ {
+ If(LEqual(DIDC,0))
+ {
+ Return(0x0C)
+ }
+ Else
+ {
+ Return(CDDS(DIDC))
+ }
+ }
+
+ // Query Graphics State (active or inactive).
+
+ Method(_DGS,0)
+ {
+ If(LAnd(LEqual(And(SGMD,0x7F),0x01),CondRefOf(SNXD)))
+ {
+ Return (NXD8)
+ }
+ Return(NDDS(DIDC))
+ }
+
+ // Device Set State. (See table above.)
+
+ Method(_DSS,1)
+ {
+ If(LEqual(And(Arg0,0xC0000000),0xC0000000))
+ {
+ // State change was performed by the
+ // Video Drivers. Simply update the
+ // New State.
+ Store(NSTE,CSTE)
+ }
+ }
+ }
+
+ Device(DD0D)
+ {
+ // Return Unique ID.
+
+ Method(_ADR,0,Serialized)
+ {
+ If(LEqual(And(0x0F00,DIDD),0x400))
+ {
+ Store(0xD, EDPV)
+ Store(NXD8, NXDX)
+ Store(DIDD, DIDX)
+ Return(0X0D)
+ }
+ If(LEqual(DIDD,0))
+ {
+ Return(0x0D)
+ }
+ Else
+ {
+ Return(And(0xFFFF,DIDD))
+ }
+ }
+
+ // Return the Current Status.
+
+ Method(_DCS,0)
+ {
+ If(LEqual(DIDD,0))
+ {
+ Return(0x0D)
+ }
+ Else
+ {
+ Return(CDDS(DIDD))
+ }
+ }
+
+ // Query Graphics State (active or inactive).
+
+ Method(_DGS,0)
+ {
+ If(LAnd(LEqual(And(SGMD,0x7F),0x01),CondRefOf(SNXD)))
+ {
+ Return (NXD8)
+ }
+ Return(NDDS(DIDD))
+ }
+
+ // Device Set State. (See table above.)
+
+ Method(_DSS,1)
+ {
+ If(LEqual(And(Arg0,0xC0000000),0xC0000000))
+ {
+ // State change was performed by the
+ // Video Drivers. Simply update the
+ // New State.
+ Store(NSTE,CSTE)
+ }
+ }
+ }
+
+ Device(DD0E)
+ {
+ // Return Unique ID.
+
+ Method(_ADR,0,Serialized)
+ {
+ If(LEqual(And(0x0F00,DIDE),0x400))
+ {
+ Store(0xE, EDPV)
+ Store(NXD8, NXDX)
+ Store(DIDE, DIDX)
+ Return(0X0E)
+ }
+ If(LEqual(DIDE,0))
+ {
+ Return(0x0E)
+ }
+ Else
+ {
+ Return(And(0xFFFF,DIDE))
+ }
+ }
+
+ // Return the Current Status.
+
+ Method(_DCS,0)
+ {
+ If(LEqual(DIDE,0))
+ {
+ Return(0x0E)
+ }
+ Else
+ {
+ Return(CDDS(DIDE))
+ }
+ }
+
+ // Query Graphics State (active or inactive).
+
+ Method(_DGS,0)
+ {
+ If(LAnd(LEqual(And(SGMD,0x7F),0x01),CondRefOf(SNXD)))
+ {
+ Return (NXD8)
+ }
+ Return(NDDS(DIDE))
+ }
+
+ // Device Set State. (See table above.)
+
+ Method(_DSS,1)
+ {
+ If(LEqual(And(Arg0,0xC0000000),0xC0000000))
+ {
+ // State change was performed by the
+ // Video Drivers. Simply update the
+ // New State.
+ Store(NSTE,CSTE)
+ }
+ }
+ }
+
+ Device(DD0F)
+ {
+ // Return Unique ID.
+
+ Method(_ADR,0,Serialized)
+ {
+ If(LEqual(And(0x0F00,DIDF),0x400))
+ {
+ Store(0xF, EDPV)
+ Store(NXD8, NXDX)
+ Store(DIDF, DIDX)
+ Return(0X0F)
+ }
+ If(LEqual(DIDF,0))
+ {
+ Return(0x0F)
+ }
+ Else
+ {
+ Return(And(0xFFFF,DIDF))
+ }
+ }
+
+ // Return the Current Status.
+
+ Method(_DCS,0)
+ {
+ If(LEqual(DIDC,0))
+ {
+ Return(0x0F)
+ }
+ Else
+ {
+ Return(CDDS(DIDF))
+ }
+ }
+
+ // Query Graphics State (active or inactive).
+
+ Method(_DGS,0)
+ {
+ If(LAnd(LEqual(And(SGMD,0x7F),0x01),CondRefOf(SNXD)))
+ {
+ Return (NXD8)
+ }
+ Return(NDDS(DIDF))
+ }
+
+ // Device Set State. (See table above.)
+
+ Method(_DSS,1)
+ {
+ If(LEqual(And(Arg0,0xC0000000),0xC0000000))
+ {
+ // State change was performed by the
+ // Video Drivers. Simply update the
+ // New State.
+ Store(NSTE,CSTE)
+ }
+ }
+ }
+
+//device for eDP
+ Device(DD1F)
+ {
+ // Return Unique ID.
+
+ Method(_ADR,0,Serialized)
+ {
+ If(LEqual(EDPV, 0x0))
+ {
+ Return(0x1F)
+ }
+ Else
+ {
+ Return(And(0xFFFF,DIDX))
+ }
+ }
+
+ // Return the Current Status.
+
+ Method(_DCS,0)
+ {
+ If(LEqual(EDPV, 0x0))
+ {
+ Return(0x00)
+ }
+ Else
+ {
+ Return(CDDS(DIDX))
+ }
+ }
+
+ // Query Graphics State (active or inactive).
+
+ Method(_DGS,0)
+ {
+ If(LAnd(LEqual(And(SGMD,0x7F),0x01),CondRefOf(SNXD)))
+ {
+ Return (NXDX)
+ }
+ Return(NDDS(DIDX))
+ }
+
+ // Device Set State. (See table above.)
+
+ Method(_DSS,1)
+ {
+ If(LEqual(And(Arg0,0xC0000000),0xC0000000))
+ {
+ // State change was performed by the
+ // Video Drivers. Simply update the
+ // New State.
+ Store(NSTE,CSTE)
+ }
+ }
+ // Query List of Brightness Control Levels Supported.
+
+ Method(_BCL,0)
+ {
+ // List of supported brightness levels in the following sequence.
+
+ // Level when machine has full power.
+ // Level when machine is on batteries.
+ // Other supported levels.
+ Return(Package(){80, 50, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100})
+ }
+
+ // Set the Brightness Level.
+
+ Method (_BCM,1)
+ {
+ // Set the requested level if it is between 0 and 100%.
+
+ If(LAnd(LGreaterEqual(Arg0,0),LLessEqual(Arg0,100)))
+ {
+ \_SB.PCI0.GFX0.AINT(1, Arg0)
+ Store(Arg0,BRTL) // Store Brightness Level.
+ }
+ }
+
+ // Brightness Query Current level.
+
+ Method (_BQC,0)
+ {
+ Return(BRTL)
+ }
+ }
+
+ Method(SDDL,1)
+ {
+ Increment(NDID)
+ Store(And(Arg0,0xF0F),Local0)
+ Or(0x80000000,Local0, Local1)
+ If(LEqual(DIDL,Local0))
+ {
+ Return(Local1)
+ }
+ If(LEqual(DDL2,Local0))
+ {
+ Return(Local1)
+ }
+ If(LEqual(DDL3,Local0))
+ {
+ Return(Local1)
+ }
+ If(LEqual(DDL4,Local0))
+ {
+ Return(Local1)
+ }
+ If(LEqual(DDL5,Local0))
+ {
+ Return(Local1)
+ }
+ If(LEqual(DDL6,Local0))
+ {
+ Return(Local1)
+ }
+ If(LEqual(DDL7,Local0))
+ {
+ Return(Local1)
+ }
+ If(LEqual(DDL8,Local0))
+ {
+ Return(Local1)
+ }
+ If(LEqual(DDL9,Local0))
+ {
+ Return(Local1)
+ }
+ If(LEqual(DD10,Local0))
+ {
+ Return(Local1)
+ }
+ If(LEqual(DD11,Local0))
+ {
+ Return(Local1)
+ }
+ If(LEqual(DD12,Local0))
+ {
+ Return(Local1)
+ }
+ If(LEqual(DD13,Local0))
+ {
+ Return(Local1)
+ }
+ If(LEqual(DD14,Local0))
+ {
+ Return(Local1)
+ }
+ If(LEqual(DD15,Local0))
+ {
+ Return(Local1)
+ }
+ Decrement(NDID) // AMI_OVERRIDE
+ Return(0)
+ }
+
+ Method(CDDS,1)
+ {
+ Store(And(Arg0,0xF0F),Local0)
+
+ If(LEqual(0, Local0))
+ {
+ Return(0x1D)
+ }
+ If(LEqual(CADL, Local0))
+ {
+ Return(0x1F)
+ }
+ If(LEqual(CAL2, Local0))
+ {
+ Return(0x1F)
+ }
+ If(LEqual(CAL3, Local0))
+ {
+ Return(0x1F)
+ }
+ If(LEqual(CAL4, Local0))
+ {
+ Return(0x1F)
+ }
+ If(LEqual(CAL5, Local0))
+ {
+ Return(0x1F)
+ }
+ If(LEqual(CAL6, Local0))
+ {
+ Return(0x1F)
+ }
+ If(LEqual(CAL7, Local0))
+ {
+ Return(0x1F)
+ }
+ If(LEqual(CAL8, Local0))
+ {
+ Return(0x1F)
+ }
+ Return(0x1D)
+ }
+
+ Method(NDDS,1)
+ {
+ Store(And(Arg0,0xF0F),Local0)
+
+ If(LEqual(0, Local0))
+ {
+ Return(0)
+ }
+ If(LEqual(NADL, Local0))
+ {
+ Return(1)
+ }
+ If(LEqual(NDL2, Local0))
+ {
+ Return(1)
+ }
+ If(LEqual(NDL3, Local0))
+ {
+ Return(1)
+ }
+ If(LEqual(NDL4, Local0))
+ {
+ Return(1)
+ }
+ If(LEqual(NDL5, Local0))
+ {
+ Return(1)
+ }
+ If(LEqual(NDL6, Local0))
+ {
+ Return(1)
+ }
+ If(LEqual(NDL7, Local0))
+ {
+ Return(1)
+ }
+ If(LEqual(NDL8, Local0))
+ {
+ Return(1)
+ }
+ Return(0)
+ }
+
+ // Include IGD OpRegion/Software SCI interrupt handler which is use by
+ // the graphics drivers to request data from system BIOS.
+
+ include ("IgdOpRn.ASL")
+//
+// iGfx WA for HSW. Exclude the memory range 20000000-201FFFFF (2MB) and 0x40004000-0x40004FFF (4KB
+//
+Device(\_SB.MEM2)
+{
+ Name(_HID, EISAID("PNP0C01")) // Hardware Device ID
+ Name(_UID, 2)
+
+ Name(CRS2, ResourceTemplate()
+ {
+ Memory32Fixed (ReadWrite, 0x20000000, 0x00200000)
+ Memory32Fixed (ReadWrite, 0x40004000, 0x00001000)
+ })
+
+ Method(_STA,0)
+ {
+ If(IGDS)
+ {
+ If (LEqual(PNHM,0x000306C1))
+ {
+ Return(0xF) // then enabled
+ }
+ }
+ Return(0) // then disabled
+ }
+
+ Method (_CRS, 0)
+ {
+ Return(CRS2)
+ }
+
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/IgdOGBDA.ASL b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/IgdOGBDA.ASL
new file mode 100644
index 0000000..e28ce5c
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/IgdOGBDA.ASL
@@ -0,0 +1,164 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+
+Module Name:
+
+ IgdOGBDA.ASL
+
+Abstract:
+
+ IGD OpRegion/Software SCI Reference Code.
+ This file contains Get BIOS Data Area funciton support for
+ the Integrated Graphics Device (IGD) OpRegion/Software SCI mechanism.
+
+--*/
+
+
+Method (GBDA, 0, Serialized)
+{
+
+ // Supported calls: Sub-function 0
+
+ If (LEqual(GESF, 0))
+ {
+ //<TODO> Update implementation specific supported calls. Reference
+ // code is set to Intel's validated implementation.
+
+ Store(0x0000659, PARM)
+
+ Store(Zero, GESF) // Clear the exit parameter
+ Return(SUCC) // Success
+ }
+
+ // Requested callbacks: Sub-function 1
+
+ If (LEqual(GESF, 1))
+ {
+
+ //<TODO> Update implementation specific system BIOS requested call
+ // back functions. Call back functions are where the driver calls the
+ // system BIOS at function indicated event.
+
+ Store(0x300482, PARM)
+ If(LEqual(S0ID, One)){
+ Or(PARM, 0x100, PARM) //Request Fn 8 callback in CS systems
+ }
+ Store(Zero, GESF) // Clear the exit parameter
+ Return(SUCC) // Success
+ }
+
+ // Get Boot display Preferences: Sub-function 4
+
+ If (LEqual(GESF, 4))
+ {
+
+ //<TODO> Update the implementation specific Get Boot Display
+ // Preferences function.
+
+ And(PARM, 0xEFFF0000, PARM) // PARM[30:16] = Boot device ports
+ And(PARM, ShiftLeft(DeRefOf(Index(DBTB, IBTT)), 16), PARM)
+ Or(IBTT, PARM, PARM) // PARM[7:0] = Boot device type
+
+ Store(Zero, GESF) // Clear the exit parameter
+ Return(SUCC) // Success
+ }
+
+ // Panel details: Sub-function 5
+
+ If (LEqual(GESF, 5))
+ {
+
+ //<TODO> Update the implementation specific Get Panel Details
+ // function.
+
+ Store(IPSC, PARM) // Report the scaling setting
+ Or(PARM, ShiftLeft(IPAT, 8), PARM)
+ Add(PARM, 0x100, PARM) // Adjust panel type, 0 = VBT default
+ Or(PARM, ShiftLeft(LIDS, 16), PARM) // Report the lid state
+ Add(PARM, 0x10000, PARM) // Adjust the lid state, 0 = Unknown
+ Or(PARM, ShiftLeft(IBIA, 20), PARM) // Report the BIA setting
+ Store(Zero, GESF)
+ Return(SUCC)
+ }
+
+ // Internal graphics: Sub-function 7
+
+ If (LEqual(GESF, 7))
+ {
+ Store(GIVD, PARM) // PARM[0] - VGA mode(1=VGA)
+ Xor(PARM, 1, PARM) // Invert the VGA mode polarity
+ Or(PARM, ShiftLeft(GMFN, 1), PARM) // PARM[1] - # IGD PCI functions-1
+ // PARM[3:2] - Reserved
+ // PARM[4] - IGD D3 support(0=cold)
+ // PARM[10:5] - Reserved
+ Or(PARM, ShiftLeft(3, 11), PARM) // PARM[12:11] - DVMT mode(11b = 5.0)
+
+ //
+ // Report DVMT 5.0 Total Graphics memory size.
+ //
+ Or(PARM, ShiftLeft(IDMS, 17), PARM) // Bits 20:17 are for Gfx total memory size
+
+ // If the "Set Internal Graphics" call is supported, the modified
+ // settings flag must be programmed per the specification. This means
+ // that the flag must be set to indicate that system BIOS requests
+ // these settings. Once "Set Internal Graphics" is called, the
+ // modified settings flag must be cleared on all subsequent calls to
+ // this function.
+
+ // Report the graphics frequency based on B0:D2:F0:RF0h[12]. Must
+ // take into account the current VCO.
+
+ Or(ShiftLeft(Derefof(Index(Derefof(Index(CDCT, HVCO)), CDVL)), 21),PARM, PARM)
+
+ Store(1, GESF) // Set the modified settings flag
+ Return(SUCC)
+ }
+
+ // Spread spectrum clocks: Sub-function 10
+
+ If (LEqual(GESF, 10))
+ {
+
+ Store(0, PARM) // Assume SSC is disabled
+
+ If(ISSC)
+ {
+ Or(PARM, 3, PARM) // If SSC enabled, return SSC1+Enabled
+ }
+
+ Store(0, GESF) // Set the modified settings flag
+ Return(SUCC) // Success
+ }
+
+
+ If (LEqual(GESF, 11))
+ {
+ Store(KSV0, PARM) // First four bytes of AKSV
+ Store(KSV1, GESF) // Fifth byte of AKSV
+
+ Return(SUCC) // Success
+ }
+
+ // A call to a reserved "Get BIOS data" function was received.
+
+ Store(Zero, GESF) // Clear the exit parameter
+ Return(CRIT) // Reserved, "Critical failure"
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/IgdOMOBF.ASL b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/IgdOMOBF.ASL
new file mode 100644
index 0000000..07a716b
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/IgdOMOBF.ASL
@@ -0,0 +1,560 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+
+Module Name:
+
+ IgdOMOBF.ASL
+
+Abstract:
+
+ IGD OpRegion/Software SCI Reference Code.
+ This file contains ASL code with the purpose of handling events
+ i.e. hotkeys and other system interrupts.
+
+--*/
+
+
+// Notes:
+// 1. The following routines are to be called from the appropriate event
+// handlers.
+// 2. This code cannot comprehend the exact implementation in the OEM's BIOS.
+// Therefore, an OEM must call these methods from the existing event
+// handler infrastructure. Details on when/why to call each method is
+// included in the method header under the "usage" section.
+
+
+/************************************************************************;
+;* ACPI Notification Methods
+;************************************************************************/
+
+
+/************************************************************************;
+;*
+;* Name: PDRD
+;*
+;* Description: Check if the graphics driver is ready to process
+;* notifications and video extensions.
+;*
+;* Usage: This method is to be called prior to performing any
+;* notifications or handling video extensions.
+;* Ex: If (PDRD()) {Return (FAIL)}
+;*
+;* Input: None
+;*
+;* Output: None
+;*
+;* References: DRDY (Driver ready status), ASLP (Driver recommended
+;* sleep timeout value).
+;*
+;************************************************************************/
+
+External(HNOT, MethodObj)
+
+Method(PDRD)
+{
+
+ // Sleep for ASLP milliseconds if the driver is not ready.
+
+
+ // If DRDY is clear, the driver is not ready. If the return value is
+ // !=0, do not perform any notifications or video extension handling.
+
+ Return(LNot(DRDY))
+}
+
+
+/************************************************************************;
+;*
+;* Name: PSTS
+;*
+;* Description: Check if the graphics driver has completed the previous
+;* "notify" command.
+;*
+;* Usage: This method is called before every "notify" command. A
+;* "notify" should only be set if the driver has completed the
+;* previous command. Else, ignore the event and exit the parent
+;* method.
+;* Ex: If (PSTS()) {Return (FAIL)}
+;*
+;* Input: None
+;*
+;* Output: None
+;*
+;* References: CSTS (Notification status), ASLP (Driver recommended sleep
+;* timeout value).
+;*
+;************************************************************************/
+
+Method(PSTS)
+{
+ If(LGreater(CSTS, 2))
+ {
+ // Sleep for ASLP milliseconds if the status is not "success,
+ // failure, or pending"
+ //
+ Sleep(ASLP)
+ }
+
+ Return(LEqual(CSTS, 3)) // Return True if still Dispatched
+}
+
+
+/************************************************************************;
+;*
+;* Name: GNOT
+;*
+;* Description: Call the appropriate methods to query the graphics driver
+;* status. If all methods return success, do a notification of
+;* the graphics device.
+;*
+;* Usage: This method is to be called when a graphics device
+;* notification is required (display switch hotkey, etc).
+;*
+;* Input: Arg0 = Current event type:
+;* 1 = display switch
+;* 2 = lid
+;* 3 = dock
+;* Arg1 = Notification type:
+;* 0 = Re-enumeration
+;* 0x80 = Display switch
+;*
+;* Output: Returns 0 = success, 1 = failure
+;*
+;* References: PDRD and PSTS methods. OSYS (OS version)
+;*
+;************************************************************************/
+
+Method(GNOT, 2)
+{
+ // Check for 1. Driver loaded, 2. Driver ready.
+ // If any of these cases is not met, skip this event and return failure.
+ //
+ If(PDRD())
+ {
+ Return(0x1) // Return failure if driver not loaded.
+ }
+
+ Store(Arg0, CEVT) // Set up the current event value
+ Store(3, CSTS) // CSTS=BIOS dispatched an event
+
+ If(LAnd(LEqual(CHPD, 0), LEqual(Arg1, 0))) // Do not re-enum if driver supports hotplug
+ {
+ If(LOr(LGreater(OSYS, 2000), LLess(OSYS, 2006)))
+ {
+ //
+ // WINXP requires that the entire PCI Bridge be re-enumerated.
+ //
+ Notify(\_SB.PCI0, Arg1)
+ }
+ Else
+ {
+ //
+ // Re-enumerate the Graphics Device for non-XP operating systems.
+ //
+ Notify(\_SB.PCI0.GFX0, Arg1)
+ }
+ }
+
+ If(CondRefOf(HNOT))
+ {
+ HNOT(Arg0) //Notification handler for Switchable graphics
+ }
+ Else
+ {
+ Notify(\_SB.PCI0.GFX0,0x80)
+ }
+
+ Return(0x0) // Return success
+}
+
+
+/************************************************************************;
+;*
+;* Name: GHDS
+;*
+;* Description: Handle a hotkey display switching event (performs a
+;* Notify(GFX0, 0).
+;*
+;* Usage: This method must be called when a hotkey event occurs and the
+;* purpose of that hotkey is to do a display switch.
+;*
+;* Input: Arg0 = Toggle table number.
+;*
+;* Output: Returns 0 = success, 1 = failure.
+;* CEVT and TIDX are indirect outputs.
+;*
+;* References: TIDX, GNOT
+;*
+;************************************************************************/
+
+Method(GHDS, 1)
+{
+ Store(Arg0, TIDX) // Store the table number
+
+ // Call GNOT for CEVT = 1 = hotkey, notify value = 0
+
+ Return(GNOT(1, 0)) // Return stats from GNOT
+}
+
+
+/************************************************************************;
+;*
+;* Name: GLID
+;*
+;* Description: Handle a lid event (performs the Notify(GFX0, 0), but not the
+;* lid notify).
+;*
+;* Usage: This method must be called when a lid event occurs. A
+;* Notify(LID0, 0x80) must follow the call to this method.
+;*
+;* Input: Arg0 = Lid state:
+;* 0 = All closed
+;* 1 = internal LFP lid open
+;* 2 = external lid open
+;* 3 = both external and internal open
+;*
+;* Output: Returns 0=success, 1=failure.
+;* CLID and CEVT are indirect outputs.
+;*
+;* References: CLID, GNOT
+;*
+;************************************************************************/
+
+Method(GLID, 1)
+{
+
+ If (LEqual(Arg0,1))
+ {
+ Store(3,CLID)
+ }
+ Else
+ {
+ Store(Arg0, CLID)
+ }
+
+ //Store(Arg0, CLID) // Store the current lid state
+
+ // Call GNOT for CEVT=2=Lid, notify value = 0
+
+ if (GNOT(2, 0)) {
+ Or (CLID, 0x80000000, CLID)
+ Return (1) // Return Fail
+ }
+
+ Return (0) // Return Pass
+}
+
+
+/************************************************************************;
+;*
+;* Name: GDCK
+;*
+;* Description: Handle a docking event by updating the current docking status
+;* and doing a notification.
+;*
+;* Usage: This method must be called when a docking event occurs.
+;*
+;* Input: Arg0 = Docking state:
+;* 0 = Undocked
+;* 1 = Docked
+;*
+;* Output: Returns 0=success, 1=failure.
+;* CDCK and CEVT are indirect outputs.
+;*
+;* References: CDCK, GNOT
+;*
+;************************************************************************/
+
+Method(GDCK, 1)
+{
+ Store(Arg0, CDCK) // Store the current dock state
+
+ // Call GNOT for CEVT=4=Dock, notify value = 0
+
+ Return(GNOT(4, 0)) // Return stats from GNOT
+}
+
+
+/************************************************************************;
+;* ASLE Interrupt Methods
+;************************************************************************/
+
+
+/************************************************************************;
+;*
+;* Name: PARD
+;*
+;* Description: Check if the driver is ready to handle ASLE interrupts
+;* generate by the system BIOS.
+;*
+;* Usage: This method must be called before generating each ASLE
+;* interrupt.
+;*
+;* Input: None
+;*
+;* Output: Returns 0 = success, 1 = failure.
+;*
+;* References: ARDY (Driver readiness), ASLP (Driver recommended sleep
+;* timeout value)
+;*
+;************************************************************************/
+
+Method(PARD)
+{
+ If(LNot(ARDY))
+ {
+
+ // Sleep for ASLP milliseconds if the driver is not ready.
+
+ Sleep(ASLP)
+ }
+
+ // If ARDY is clear, the driver is not ready. If the return value is
+ // !=0, do not generate the ASLE interrupt.
+
+ Return(LNot(ARDY))
+}
+
+//
+// Intel Ultrabook Event Handler. Arg0 represents the Ultrabook Event Bit # to pass
+// to the Intel Graphics Driver. Note that this is a serialized method, meaning
+// sumultaneous events are not allowed.
+//
+
+Method(IUEH,1,Serialized)
+{
+ And(IUER,0xC0,IUER) // Clear all button events on entry.
+ XOr(IUER,Shiftleft(1,Arg0),IUER) // Toggle status.
+
+ If(LLessEqual(Arg0,4)) // Button Event?
+ {
+ Return(AINT(5,0)) // Generate event and return status.
+
+ }
+ Else // Indicator Event.
+ {
+ Return(AINT(Arg0,0)) // Generate event and return status.
+ }
+}
+
+/************************************************************************;
+;*
+;* Name: AINT
+;*
+;* Description: Call the appropriate methods to generate an ASLE interrupt.
+;* This process includes ensuring the graphics driver is ready
+;* to process the interrupt, ensuring the driver supports the
+;* interrupt of interest, and passing information about the event
+;* to the graphics driver.
+;*
+;* Usage: This method must called to generate an ASLE interrupt.
+;*
+;* Input: Arg0 = ASLE command function code:
+;* 0 = Set ALS illuminance
+;* 1 = Set backlight brightness
+;* 2 = Do Panel Fitting
+;* 4 = Reserved
+;* 5 = Button Indicator Event
+;* 6 = Convertible Indicator Event
+;* 7 = Docking Indicator Event
+;* Arg1 = If Arg0 = 0, current ALS reading:
+;* 0 = Reading below sensor range
+;* 1-0xFFFE = Current sensor reading
+;* 0xFFFF = Reading above sensor range
+;* Arg1 = If Arg0 = 1, requested backlight percentage
+;*
+;* Output: Returns 0 = success, 1 = failure
+;*
+;* References: PARD method.
+;*
+;************************************************************************/
+
+Method(AINT, 2)
+{
+
+ // Return failure if the requested feature is not supported by the
+ // driver.
+
+ If(LNot(And(TCHE, ShiftLeft(1, Arg0))))
+ {
+ Return(0x1)
+ }
+
+ // Return failure if the driver is not ready to handle an ASLE
+ // interrupt.
+
+ If(PARD())
+ {
+ Return(0x1)
+ }
+
+ // Handle Intel Ultrabook Events.
+
+ If(LAnd(LGreaterEqual(Arg0,5),LLessEqual(Arg0,7)))
+ {
+ Store(ShiftLeft(1,Arg0), ASLC) // Set Ultrbook Event [6:4].
+ Store(0x01, ASLE) // Generate ASLE interrupt
+
+ Store(0,Local2) // Use Local2 as a timeout counter. Intialize to zero.
+
+ While(LAnd(LLess(Local2,250),LNotEqual(ASLC,0))) // Wait 1 second or until Driver ACKs a success.
+ {
+ Sleep(4) // Delay 4 ms.
+ Increment(Local2) // Increment Timeout.
+ }
+
+ Return(0) // Return success
+ }
+
+ // Evaluate the first argument (Panel fitting, backlight brightness, or ALS).
+
+ If(LEqual(Arg0, 2)) // Arg0 = 2, so request a panel fitting mode change.
+ {
+ If(CPFM) // If current mode field is non-zero use it.
+ {
+ And(CPFM, 0x0F, Local0) // Create variables without reserved
+ And(EPFM, 0x0F, Local1) // or valid bits.
+
+ If(LEqual(Local0, 1)) // If current mode is centered,
+ {
+ If(And(Local1, 6)) // and if stretched is enabled,
+ {
+ Store(6, PFIT) // request stretched.
+ }
+ Else // Otherwise,
+ {
+ If(And(Local1, 8)) // if aspect ratio is enabled,
+ {
+ Store(8, PFIT) // request aspect ratio.
+ }
+ Else // Only centered mode is enabled
+ {
+ Store(1, PFIT) // so request centered. (No change.)
+ }
+ }
+ }
+ If(LEqual(Local0, 6)) // If current mode is stretched,
+ {
+ If(And(Local1, 8)) // and if aspect ratio is enabled,
+ {
+ Store(8, PFIT) // request aspect ratio.
+ }
+ Else // Otherwise,
+ {
+ If(And(Local1, 1)) // if centered is enabled,
+ {
+ Store(1, PFIT) // request centered.
+ }
+ Else // Only stretched mode is enabled
+ {
+ Store(6, PFIT) // so request stretched. (No change.)
+ }
+ }
+ }
+ If(LEqual(Local0, 8)) // If current mode is aspect ratio,
+ {
+ If(And(Local1, 1)) // and if centered is enabled,
+ {
+ Store(1, PFIT) // request centered.
+ }
+ Else // Otherwise,
+ {
+ If(And(Local1, 6)) // if stretched is enabled,
+ {
+ Store(6, PFIT) // request stretched.
+ }
+ Else // Only aspect ratio mode is enabled
+ {
+ Store(8, PFIT) // so request aspect ratio. (No change.)
+ }
+ }
+ }
+ }
+
+ // The following code for panel fitting (within the Else condition) is retained for backward compatiblity.
+
+ Else // If CFPM field is zero use PFIT and toggle the
+ {
+ Xor(PFIT,7,PFIT) // mode setting between stretched and centered only.
+ }
+
+ Or(PFIT,0x80000000,PFIT) // Set the valid bit for all cases.
+
+ Store(4, ASLC) // Store "Panel fitting event" to ASLC[31:1]
+ }
+ Else
+ {
+ If(LEqual(Arg0, 1)) // Arg0=1, so set the backlight brightness.
+ {
+ Store(Divide(Multiply(Arg1, 255), 100), BCLP) // Convert from percent to 0-255.
+
+ Or(BCLP, 0x80000000, BCLP) // Set the valid bit.
+
+ Store(2, ASLC) // Store "Backlight control event" to ASLC[31:1]
+ }
+ Else
+ {
+ If(LEqual(Arg0, 0)) // Arg0=0, so set the ALS illuminace
+ {
+ Store(Arg1, ALSI)
+
+ Store(1, ASLC) // Store "ALS event" to ASLC[31:1]
+ }
+ Else
+ {
+ Return(0x1) // Unsupported function
+ }
+ }
+ }
+
+ Store(0x01, ASLE) // Generate ASLE interrupt
+ Return(0x0) // Return success
+}
+
+
+/************************************************************************;
+;*
+;* Name: SCIP
+;*
+;* Description: Checks the presence of the OpRegion and SCI
+;*
+;* Usage: This method is called before other OpRegion methods. The
+;* former "GSMI True/False is not always valid. This method
+;* checks if the OpRegion Version is non-zero and if non-zero,
+;* (present and readable) then checks the GSMI flag.
+;*
+;* Input: None
+;*
+;* Output: Boolean True = SCI present.
+;*
+;* References: None
+;*
+;************************************************************************/
+
+Method(SCIP)
+{
+ If(LNotEqual(OVER,0)) // If OpRegion Version not 0.
+ {
+ Return(LNot(GSMI)) // Return True if SCI.
+ }
+
+ Return(0) // Else Return False.
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/IgdOSBCB.ASL b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/IgdOSBCB.ASL
new file mode 100644
index 0000000..9cb0db6
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/IgdOSBCB.ASL
@@ -0,0 +1,335 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+
+Module Name:
+
+ IgdOSBCB.ASL
+
+Abstract:
+
+ This file contains the system BIOS call back functionality for the
+ OpRegion/Software SCI mechanism.
+
+--*/
+
+
+Method (SBCB, 0, Serialized)
+{
+
+ // Supported Callbacks: Sub-function 0
+
+ If (LEqual(GESF, 0x0))
+ {
+
+ //<TODO> An OEM may support the driver->SBIOS status callbacks, but
+ // the supported callbacks value must be modified. The code that is
+ // executed upon reception of the callbacks must be also be updated
+ // to perform the desired functionality.
+
+ Store(0x00000000, PARM) // No callbacks supported
+ //Store(0x000787FD, PARM) // Used for Intel test implementaion
+
+ // <NOTSAMPLECODE>
+
+ Store(0x000F87DD, PARM)
+
+ // </NOTSAMPLECODE>
+
+ Store(Zero, GESF) // Clear the exit parameter
+ Return(SUCC) // "Success"
+ }
+
+ // BIOS POST Completion: Sub-function 1
+
+ If (LEqual(GESF, 1))
+ {
+ Store(Zero, GESF) // Clear the exit parameter
+ Store(Zero, PARM)
+ Return(SUCC) // Not supported, but no failure
+ }
+
+ // Pre-Hires Set Mode: Sub-function 3
+
+ If (LEqual(GESF, 3))
+ {
+ Store(Zero, GESF) // Clear the exit parameter
+ Store(Zero, PARM)
+ Return(SUCC) // Not supported, but no failure
+ }
+
+ // Post-Hires Set Mode: Sub-function 4
+
+ If (LEqual(GESF, 4))
+ {
+ Store(Zero, GESF) // Clear the exit parameter
+ Store(Zero, PARM)
+ Return(SUCC) // Not supported, but no failure
+ }
+
+ // Display Switch: Sub-function 5
+
+ If (LEqual(GESF, 5))
+ {
+ Store(Zero, GESF) // Clear the exit parameter
+ Store(Zero, PARM)
+ Return(SUCC) // Not supported, but no failure
+ }
+
+ // Adapter Power State: Sub-function 7
+
+ If (LEqual(GESF, 7))
+ {
+ //
+ // Handle Low Power S0 Idle Capability if enabled
+ //
+ If(LEqual(S0ID, One)){
+ //
+ // Call GUAM to trigger CS Entry
+ // If Adapter Power State Notification = D1 (PARM[7:0]=0x01)
+ //
+ If (LEqual (And(PARM,0xFF), 0x01)) {
+ // GUAM - Global User Absent Mode Notification Method
+ \GUAM(One) // 0x01 - Power State Standby (CS Entry)
+ }
+ }
+
+ // Upon notification from driver that the Adapter Power State = D0,
+ // check if previous lid event failed. If it did, retry the lid
+ // event here.
+ If(LEqual(PARM, 0))
+ {
+ Store(CLID, Local0)
+ If(And(0x80000000,Local0))
+ {
+ And(CLID, 0x0000000F, CLID)
+ GLID(CLID)
+ }
+ }
+ Store(Zero, GESF) // Clear the exit parameter
+ Store(Zero, PARM)
+ Return(SUCC) // Not supported, but no failure
+ }
+
+ // Display Power State: Sub-function 8
+
+ If (LEqual(GESF, 8))
+ {
+ //
+ // Handle Low Power S0 Idle Capability if enabled
+ //
+ If(LEqual(S0ID, One)){
+ // Bits [15:8] - Power State
+ // 00h = On
+ // 01h = Standby
+ // 02h = Suspend
+ // 04h = Off
+ // 08h = Reduced On
+ Store(And(ShiftRight(PARM, 8), 0xFF), Local0)
+ //
+ // Call GUAM
+ // If Display Turn ON Notification (PARM [15:8] == 0) for CS Exit
+ //
+ If (LEqual (Local0, 0)) {
+ // GUAM - Global User Absent Mode Notification Method
+ \GUAM(Zero) // 0x00 - Power State On (CS Exit)
+ }
+ }
+ Store(Zero, GESF) // Clear the exit parameter
+ Store(Zero, PARM)
+ Return(SUCC) // Not supported, but no failure
+ }
+
+ // Set Boot Display: Sub-function 9
+
+ If (LEqual(GESF, 9))
+ {
+
+ //<TODO> An OEM may elect to implement this method. In that case,
+ // the input values must be saved into non-volatile storage for
+ // parsing during the next boot. The following Sample code is Intel
+ // validated implementation.
+
+ And(PARM, 0xFF, IBTT) // Save the boot display to NVS
+ Store(Zero, GESF) // Clear the exit parameter
+ Store(Zero, PARM)
+ Return(SUCC) // Reserved, "Critical failure"
+ }
+
+ // Set Panel Details: Sub-function 10 (0Ah)
+
+ If (LEqual(GESF, 10))
+ {
+
+ //<TODO> An OEM may elect to implement this method. In that case,
+ // the input values must be saved into non-volatile storage for
+ // parsing during the next boot. The following Sample code is Intel
+ // validated implementation.
+
+ // Set the panel-related NVRAM variables based the input from the driver.
+
+ And(PARM, 0xFF, IPSC)
+
+ // Change panel type if a change is requested by the driver (Change if
+ // panel type input is non-zero). Zero=No change requested.
+
+ If(And(ShiftRight(PARM, 8), 0xFF))
+ {
+ And(ShiftRight(PARM, 8), 0xFF, IPAT)
+ Decrement(IPAT) // 0 = no change, so fit to CMOS map
+ }
+ And(ShiftRight(PARM, 20), 0x7, IBIA)
+ Store(Zero, GESF) // Clear the exit parameter
+ Store(Zero, PARM)
+ Return(SUCC) // Success
+ }
+
+ // Set Internal Graphics: Sub-function 11 (0Bh)
+
+ If (LEqual(GESF, 11))
+ {
+
+ //<TODO> An OEM may elect to implement this method. In that case,
+ // the input values must be saved into non-volatile storage for
+ // parsing during the next boot. The following Sample code is Intel
+ // validated implementation.
+
+ And(ShiftRight(PARM, 1), 1, IF1E) // Program the function 1 option
+
+ If(And(PARM, ShiftLeft(0xF, 13))) // Use fixed memory if fixed size != 0
+ {
+
+ // Fixed memory
+
+ And(ShiftRight(PARM, 13), 0xF, IDMS) // Program fixed memory size
+ }
+ Else
+ {
+
+ // DVMT memory
+
+ And(ShiftRight(PARM, 17), 0xF, IDMS) // Program fixed memory size
+ }
+ Store(Zero, GESF) // Clear the exit parameter
+ Store(Zero, PARM)
+ Return(SUCC) // Success
+ }
+
+ // Post-Hires to DOS FS: Sub-function 16 (10h)
+
+ If (LEqual(GESF, 16))
+ {
+ Store(Zero, GESF) // Clear the exit parameter
+ Store(Zero, PARM)
+ Return(SUCC) // Not supported, but no failure
+ }
+
+ // APM Complete: Sub-function 17 (11h)
+
+ If (LEqual(GESF, 17))
+ {
+
+ Store(ShiftLeft(LIDS, 8), PARM) // Report the lid state
+ Add(PARM, 0x100, PARM) // Adjust the lid state, 0 = Unknown
+
+ Store(Zero, GESF) // Clear the exit parameter
+ Return(SUCC) // Not supported, but no failure
+ }
+
+ // Set Spread Spectrum Clocks: Sub-function 18 (12h)
+
+ If (LEqual(GESF, 18))
+ {
+
+ //<TODO> An OEM may elect to implement this method. In that case,
+ // the input values must be saved into non-volatile storage for
+ // parsing during the next boot. The following Sample code is Intel
+ // validated implementation.
+
+ If(And(PARM, 1))
+ {
+ If(LEqual(ShiftRight(PARM, 1), 1))
+ {
+ Store(1, ISSC) // Enable HW SSC, only for clock 1
+ }
+ Else
+ {
+ Store(Zero, GESF)
+ Return(CRIT) // Failure, as the SSC clock must be 1
+ }
+ }
+ Else
+ {
+ Store(0, ISSC) // Disable SSC
+ }
+ Store(Zero, GESF) // Clear the exit parameter
+ Store(Zero, PARM)
+ Return(SUCC) // Success
+ }
+
+ // Post VBE/PM Callback: Sub-function 19 (13h)
+
+ If (LEqual(GESF, 19))
+ {
+ Store(Zero, GESF) // Clear the exit parameter
+ Store(Zero, PARM)
+ Return(SUCC) // Not supported, but no failure
+ }
+
+ // Set PAVP Data: Sub-function 20 (14h)
+
+ If (LEqual(GESF, 20))
+ {
+ And(PARM, 0xF, PAVP) // Store PAVP info
+ Store(Zero, GESF) // Clear the exit parameter
+ Store(Zero, PARM)
+ Return(SUCC) // Success
+ }
+
+ // Enable/Disable Audio: Sub-function 21 (15h)
+
+ If (LEqual(GESF, 21))
+ {
+ If(LEqual(PARM,1))
+ {
+ OR (\_SB.PCI0.AUDE, 0x20,\_SB.PCI0.AUDE)
+ \_SB.PCI0.B0D3.ABWA (1)
+ \_SB.PCI0.B0D3.ARST ()
+ \_SB.PCI0.B0D3.ASTR ()
+ \_SB.PCI0.B0D3.AINI ()
+ \_SB.PCI0.B0D3.CXDC ()
+ \_SB.PCI0.B0D3.ABWA (0)
+ Notify(\_SB.PCI0,0)
+ }
+ If(LEqual(PARM,0))
+ {
+ AND (\_SB.PCI0.AUDE, 0xDF,\_SB.PCI0.AUDE)
+ Notify(\_SB.PCI0,0)
+ }
+ Store(Zero, GESF)
+ Store(Zero, PARM)
+ Return(SUCC)
+ }
+
+ // A call to a reserved "System BIOS callbacks" function was received
+
+ Store(Zero, GESF) // Clear the exit parameter
+ Return(SUCC) // Reserved, "Critical failure"
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/IgdOpRn.ASL b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/IgdOpRn.ASL
new file mode 100644
index 0000000..56d3f71
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/IgdOpRn.ASL
@@ -0,0 +1,342 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+
+Module Name:
+
+ IgdOpRn.ASL
+
+Abstract:
+
+ IGD OpRegion/Software SCI Reference Code.
+ This file contains the interrupt handler code for the Integrated
+ Graphics Device (IGD) OpRegion/Software SCI mechanism.
+
+--*/
+
+
+//NOTES:
+//
+// (1) The code contained in this file inherits the scope in which it
+// was included. So BIOS developers must be sure to include this
+// file in the scope associated with the graphics device
+// (ex. \_SB.PCI0.GFX0).
+// (2) Create a _L06 method under the GPE scope to handle the event
+// generated by the graphics driver. The _L06 method must call
+// the GSCI method in this file.
+// (3) The MCHP operation region assumes that _ADR and _BBN names
+// corresponding to bus 0, device0, function 0 have been declared
+// under the PCI0 scope.
+// (4) Before the first execution of the GSCI method, the base address
+// of the GMCH SCI OpRegion must be programmed where the driver can
+// access it. A 32bit scratch register at 0xFC in the IGD PCI
+// configuration space (B0/D2/F0/R0FCh) is used for this purpose.
+
+// Define an OperationRegion to cover the GMCH PCI configuration space as
+// described in the IGD OpRegion specificiation.
+
+Scope(\_SB.PCI0)
+{
+ OperationRegion(MCHP, PCI_Config, 0x40, 0xC0)
+ Field(MCHP, AnyAcc, NoLock, Preserve)
+ {
+ Offset(0x14),
+ AUDE, 8,
+
+ Offset(0x60), // Top of Memory register
+ TASM, 10, // Total system memory (64MB gran)
+ , 6,
+ }
+}
+
+// Define an OperationRegion to cover the IGD PCI configuration space as
+// described in the IGD OpRegion specificiation.
+
+OperationRegion(IGDP, PCI_Config, 0x40, 0xC0)
+Field(IGDP, AnyAcc, NoLock, Preserve)
+{
+ Offset(0x12), // Mirror of gfx control reg
+ , 1,
+ GIVD, 1, // IGD VGA disable bit
+ , 2,
+ GUMA, 3, // Stolen memory size
+ , 9,
+ Offset(0x14),
+ , 4,
+ GMFN, 1, // Gfx function 1 enable
+ , 27,
+ Offset(0xA4),
+ ASLE, 8, // Reg 0xE4, ASLE interrupt register
+ , 24, // Only use first byte of ASLE reg
+ Offset(0xA8), // Reg 0xE8, SWSCI control register
+ GSSE, 1, // Graphics SCI event (1=event pending)
+ GSSB, 14, // Graphics SCI scratchpad bits
+ GSES, 1, // Graphics event select (1=SCI)
+ Offset(0xB0), // Gfx Clk Frequency and Gating Control
+ , 12,
+ CDVL, 1, // Core display clock value
+ , 3, // Graphics Core Display Clock Select
+ Offset(0xB5),
+ LBPC, 8, // Legacy brightness control
+ Offset(0xBC),
+ ASLS, 32, // Reg 0xFC, Address of the IGD OpRegion
+}
+
+// Define an OperationRegion to cover the IGD OpRegion layout.
+
+OperationRegion(IGDM, SystemMemory, ASLB, 0x2000)
+Field(IGDM, AnyAcc, NoLock, Preserve)
+{
+
+ // OpRegion Header
+
+ SIGN, 128, // Signature-"IntelGraphicsMem"
+ SIZE, 32, // OpRegion Size
+ OVER, 32, // OpRegion Version
+ SVER, 256, // System BIOS Version
+ VVER, 128, // VBIOS Version
+ GVER, 128, // Driver version
+ MBOX, 32, // Mailboxes supported
+ DMOD, 32, // Driver Model
+ PCON, 32, // Platform Configuration
+ DVER, 64, // GOP Version
+ // OpRegion Mailbox 1 (Public ACPI Methods)
+ // Note: Mailbox 1 is normally reserved for desktop platforms.
+
+ Offset(0x100),
+ DRDY, 32, // Driver readiness (ACPI notification)
+ CSTS, 32, // Notification status
+ CEVT, 32, // Current event
+ Offset(0x120),
+ DIDL, 32, // Supported display device ID list
+ DDL2, 32, // Allows for 8 devices
+ DDL3, 32,
+ DDL4, 32,
+ DDL5, 32,
+ DDL6, 32,
+ DDL7, 32,
+ DDL8, 32,
+ CPDL, 32, // Currently present display list
+ CPL2, 32, // Allows for 8 devices
+ CPL3, 32,
+ CPL4, 32,
+ CPL5, 32,
+ CPL6, 32,
+ CPL7, 32,
+ CPL8, 32,
+ CADL, 32, // Currently active display list
+ CAL2, 32, // Allows for 8 devices
+ CAL3, 32,
+ CAL4, 32,
+ CAL5, 32,
+ CAL6, 32,
+ CAL7, 32,
+ CAL8, 32,
+ NADL, 32, // Next active display list
+ NDL2, 32, // Allows for 8 devices
+ NDL3, 32,
+ NDL4, 32,
+ NDL5, 32,
+ NDL6, 32,
+ NDL7, 32,
+ NDL8, 32,
+ ASLP, 32, // ASL sleep timeout
+ TIDX, 32, // Toggle table index
+ CHPD, 32, // Current hot plug enable indicator
+ CLID, 32, // Current lid state indicator
+ CDCK, 32, // Current docking state indicator
+ SXSW, 32, // Display switch notify on resume
+ EVTS, 32, // Events supported by ASL (diag only)
+ CNOT, 32, // Current OS notifications (diag only)
+ NRDY, 32,
+ // Extended DIDL list
+ DDL9, 32,
+ DD10, 32,
+ DD11, 32,
+ DD12, 32,
+ DD13, 32,
+ DD14, 32,
+ DD15, 32,
+ //Extended Currently attached Display Device List CPD2
+ CPL9, 32,
+ CP10, 32,
+ CP11, 32,
+ CP12, 32,
+ CP13, 32,
+ CP14, 32,
+ CP15, 32,
+ // OpRegion Mailbox 2 (Software SCI Interface)
+
+ Offset(0x200), // SCIC
+ SCIE, 1, // SCI entry bit (1=call unserviced)
+ GEFC, 4, // Entry function code
+ GXFC, 3, // Exit result
+ GESF, 8, // Entry/exit sub-function/parameter
+ , 16, // SCIC[31:16] reserved
+ Offset(0x204), // PARM
+ PARM, 32, // PARM register (extra parameters)
+ DSLP, 32, // Driver sleep time out
+
+ // OpRegion Mailbox 3 (BIOS to Driver Notification)
+ // Note: Mailbox 3 is normally reserved for desktop platforms.
+
+ Offset(0x300),
+ ARDY, 32, // Driver readiness (power conservation)
+ ASLC, 32, // ASLE interrupt command/status
+ TCHE, 32, // Technology enabled indicator
+ ALSI, 32, // Current ALS illuminance reading
+ BCLP, 32, // Backlight brightness
+ PFIT, 32, // Panel fitting state or request
+ CBLV, 32, // Current brightness level
+ BCLM, 320, // Backlight brightness level duty cycle mapping table
+ CPFM, 32, // Current panel fitting mode
+ EPFM, 32, // Enabled panel fitting modes
+ PLUT, 592, // Optional. 74-byte Panel LUT Table
+ PFMB, 32, // Optional. PWM Frequency and Minimum Brightness
+ CCDV, 32, // Optional. Gamma, Brightness, Contrast values.
+ PCFT, 32, // Optional. Power Conservation Features
+ SROT, 32, // Supported rotation angle.
+ IUER, 32, // Optional. Intel Ultrabook Event Register.
+ FDSP, 64, // Optional. FFS Display Physical address
+ FDSS, 32, // Optional. FFS Display Size
+ STAT, 32, // State Indicator
+
+ // OpRegion Mailbox 4 (VBT)
+
+ Offset(0x400),
+ GVD1, 0xC000, // 6K bytes maximum VBT image
+
+ // OpRegion Mailbox 5 (BIOS to Driver Notification Extension)
+
+ Offset(0x1C00),
+ PHED, 32, // Panel Header
+ BDDC, 2048, // Panel EDID (Max 256 bytes)
+
+}
+
+// Define an OperationRegion to cover the ICH TCO I/O space region for use in
+// clearing the MCH SCI status bit.
+
+/* Defined already by main ASL code, but shown below for reference.
+
+OperationRegion(TCOI,SystemIO,0x1060,0x8)
+Field(TCOI,WordAcc, NoLock, Preserve)
+{
+ Offset(0x04), // TCO status register
+ , 9,
+ SCIS, 1, // TCO DMI SCI status
+ , 6,
+}*/
+
+// Convert boot display type into a port mask.
+
+Name (DBTB, Package()
+{
+ 0x0000, // Automatic
+ 0x0007, // Port-0 : Integrated CRT
+ 0x0038, // Port-1 : DVO-A, or Integrated LVDS
+ 0x01C0, // Port-2 : SDVO-B, or SDVO-B/C
+ 0x0E00, // Port-3 : SDVO-C
+ 0x003F, // [CRT + DVO-A / Integrated LVDS]
+ 0x01C7, // [CRT + SDVO-B] or [CRT + SDVO-B/C]
+ 0x0E07, // [CRT + SDVO-C]
+ 0x01F8, // [DVO-A / Integrated LVDS + SDVO-B]
+ 0x0E38, // [DVO-A / Integrated LVDS + SDVO-C]
+ 0x0FC0, // [SDVO-B + SDVO-C]
+ 0x0000, // Reserved
+ 0x0000, // Reserved
+ 0x0000, // Reserved
+ 0x0000, // Reserved
+ 0x0000, // Reserved
+ 0x7000, // Port-4: Integrated TV
+ 0x7007, // [Integrated TV + CRT]
+ 0x7038, // [Integrated TV + LVDS]
+ 0x71C0, // [Integrated TV + DVOB]
+ 0x7E00 // [Integrated TV + DVOC]
+})
+
+// Core display clock value table.
+
+Name (CDCT, Package()
+{
+ Package() {228, 320},
+ Package() {222, 333},
+ Package() {222, 333},
+ Package() { 0, 0},
+ Package() {222, 333},
+})
+
+// Defined exit result values:
+
+Name (SUCC, 1) // Exit result: Success
+Name (NVLD, 2) // Exit result: Invalid parameter
+Name (CRIT, 4) // Exit result: Critical failure
+Name (NCRT, 6) // Exit result: Non-critical failure
+
+
+/************************************************************************;
+;*
+;* Name: GSCI
+;*
+;* Description: Handles an SCI generated by the graphics driver. The
+;* PARM and SCIC input fields are parsed to determine the
+;* functionality requested by the driver. GBDA or SBCB
+;* is called based on the input data in SCIC.
+;*
+;* Usage: The method must be called in response to a GPE 06 event
+;* which will be generated by the graphics driver.
+;* Ex: Method(\_GPE._L06) {Return(\_SB.PCI0.GFX0.GSCI())}
+;*
+;* Input: PARM and SCIC are indirect inputs
+;*
+;* Output: PARM and SIC are indirect outputs
+;*
+;* References: GBDA (Get BIOS Data method), SBCB (System BIOS Callback
+;* method)
+;*
+;************************************************************************/
+
+Method (GSCI, 0, Serialized)
+{
+ Include("IgdOGbda.asl") // "Get BIOS Data" Functions
+ Include("IgdOSbcb.asl") // "System BIOS CallBacks"
+
+ If (LEqual(GEFC, 4))
+ {
+ Store(GBDA(), GXFC) // Process Get BIOS Data functions
+ }
+
+ If (LEqual(GEFC, 6))
+ {
+ Store(SBCB(), GXFC) // Process BIOS Callback functions
+ }
+
+ Store(0, GEFC) // Wipe out the entry function code
+ Store(1, SCIS) // Clear the MCH SCI status bit in ICH TCO I/O space.
+ Store(0, GSSE) // Clear the SCI generation bit in PCI space.
+ Store(0, SCIE) // Clr SCI serviced bit to signal completion
+
+ Return(Zero)
+}
+
+// Include MOBLFEAT.ASL for mobile systems only. Remove for desktop.
+
+Include("IgdOMobF.asl") // IGD SCI mobile features
+
diff --git a/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/Sa.asl b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/Sa.asl
new file mode 100644
index 0000000..a8f4ee0
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/Sa.asl
@@ -0,0 +1,495 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+
+Module Name:
+
+ Sa.ASL
+
+Abstract:
+
+ Devices definition of SystemAgent ACPI reference code.
+
+--*/
+//AMI_OVERRIDE -->>
+#if !defined(ASL_Remove_SaSsdt_Data_To_Dsdt) || (ASL_Remove_SaSsdt_Data_To_Dsdt == 0)
+#if defined(ASL_RC_PEG_0) && (ASL_RC_PEG_0 == 1)
+External(AR02)
+External(PR02)
+#endif
+#if defined(ASL_RC_PEG_1) && (ASL_RC_PEG_1 == 1)
+External(AR0A)
+External(PR0A)
+#endif
+#if defined(ASL_RC_PEG_2) && (ASL_RC_PEG_2 == 1)
+External(AR0B)
+External(PR0B)
+#endif
+External(PICM)
+External(\GPRW, MethodObj)
+External(\_SB.PCI0, DeviceObj)
+#endif
+//AMI_OVERRIDE --<<
+
+Scope (\_SB.PCI0) {
+ Name(LTRS, 0)
+ Name(OBFS, 0)
+//AMI_OVERRIDE -->>
+#if defined(ASL_RC_PEG_0) && (ASL_RC_PEG_0 == 1)
+ Device(PEG0) { // P.E.G. Root Port D1F0
+ Name(_ADR, 0x00010000)
+ OperationRegion(PEGR,PCI_Config,0xC0,0x30)
+ Field(PEGR,DWordAcc,NoLock,Preserve)
+ {
+ ,16,
+ PSTS, 1, // PME Status
+ offset (44),
+ GENG, 1, // General Message GPE Enable
+ ,1, // Reserved
+ PMEG, 1, // PME GPE Enable
+ }
+ Method(_PRW, 0) { Return(GPRW(0x09, 4)) } // can wakeup from S4 state
+
+ Method(_PSW,1)
+ {
+ If(Arg0)
+ {
+ Store(1,GENG)
+ Store(1,PMEG)
+ }
+ Else
+ {
+ Store(0,GENG)
+ Store(0,PMEG)
+ }
+ }
+ Method(HPME,0,Serialized)
+ {
+ //
+ // Clear PME status bit
+ //
+ Store(1,PSTS)
+ }
+ Method(_PRT,0) {
+ If(PICM) { Return(AR02) }// APIC mode
+ Return (PR02) // PIC Mode
+ } // end _PRT
+ //
+ // Pass LTRx to LTRS so SaPcieDsm.asl can be reused for PEGs.
+ //
+ Method(_INI)
+ {
+ Store (LTRA, LTRS)
+ Store (OBFA, OBFS)
+ }
+ include("SaPcieDsm.ASL")
+
+ Device(PEGP) { // P.E.G. Port Slot x16
+ Name(_ADR, 0x00000000)
+ Method(_PRW, 0) { Return(GPRW(0x09, 4)) } // can wakeup from S4 state
+ } // end "P.E.G. Port Slot x16"
+
+ } // end "P.E.G. Root Port D1F0"
+#endif
+#if defined(ASL_RC_PEG_1) && (ASL_RC_PEG_1 == 1)
+ Device(PEG1) { // P.E.G. Root Port D1F1
+ Name(_ADR, 0x00010001)
+ OperationRegion(PEGR,PCI_Config,0xC0,0x30)
+ Field(PEGR,DWordAcc,NoLock,Preserve)
+ {
+ ,16,
+ PSTS, 1, // PME Status
+ offset (44),
+ GENG, 1, // General Message GPE Enable
+ ,1, // Reserved
+ PMEG, 1, // PME GPE Enable
+ }
+ Method(_PRW, 0) { Return(GPRW(0x09, 4)) } // can wakeup from S4 state
+
+ Method(_PSW,1)
+ {
+ If(Arg0)
+ {
+ Store(1,GENG)
+ Store(1,PMEG)
+ }
+ Else
+ {
+ Store(0,GENG)
+ Store(0,PMEG)
+ }
+ }
+ Method(HPME,0,Serialized)
+ {
+ //
+ // Clear PME status bit
+ //
+ Store(1,PSTS)
+ }
+ Method(_PRT,0) {
+ If(PICM) { Return(AR0A) }// APIC mode
+ Return (PR0A) // PIC Mode
+ } // end _PRT
+
+ Method(_INI)
+ {
+ Store (LTRB, LTRS)
+ Store (OBFB, OBFS)
+ }
+ include("SaPcieDsm.ASL")
+ } // end "P.E.G. Root Port D1F1"
+#endif
+#if defined(ASL_RC_PEG_2) && (ASL_RC_PEG_2 == 1)
+ Device(PEG2) { // P.E.G. Root Port D1F2
+ Name(_ADR, 0x00010002)
+ OperationRegion(PEGR,PCI_Config,0xC0,0x30)
+ Field(PEGR,DWordAcc,NoLock,Preserve)
+ {
+ ,16,
+ PSTS, 1, // PME Status
+ offset (44),
+ GENG, 1, // General Message GPE Enable
+ ,1, // Reserved
+ PMEG, 1, // PME GPE Enable
+ }
+ Method(_PRW, 0) { Return(GPRW(0x09, 4)) } // can wakeup from S4 state
+
+ Method(_PSW,1)
+ {
+ If(Arg0)
+ {
+ Store(1,GENG)
+ Store(1,PMEG)
+ }
+ Else
+ {
+ Store(0,GENG)
+ Store(0,PMEG)
+ }
+ }
+ Method(HPME,0,Serialized)
+ {
+ //
+ // Clear PME status bit
+ //
+ Store(1,PSTS)
+ }
+ Method(_PRT,0) {
+ If(PICM) { Return(AR0B) }// APIC mode
+ Return (PR0B) // PIC Mode
+ } // end _PRT
+
+ Method(_INI)
+ {
+ Store (LTRC, LTRS)
+ Store (OBFC, OBFS)
+ }
+ include("SaPcieDsm.ASL")
+ } // end "P.E.G. Root Port D1F2"
+#endif
+//AMI_OVERRIDE --<<
+ Device(B0D3) { // SA Audio Device
+ Name(_ADR, 0x00030000)
+ Name (BARA, 0x80000000)
+ Name (TBAR, 0x0)
+ Name (TCMD, 0x0)
+ Name (MODB, 0x0)
+ Name (MODC, 0x0)
+
+ Method(_STA,0)
+ {
+ If(LNotEqual(AUVD, 0xFFFF))
+ {
+ Return(0xF) // then enabled
+ }
+ Return(0) // then disabled
+ }
+
+ Method(_INI) {
+ //
+ // Save a valid Audio BAR for the ABWA W/A
+ //
+ If (LAnd (LNotEqual (And(ABAR, 0xFFFFC004), 0xFFFFC004), LNotEqual (And (ABAR, 0xFFFFC000), 0))) {
+ Store (ABAR, BARA)
+ }
+ }
+
+ OperationRegion(RPCS,SystemMemory,\XBAS,0x18040)
+ Field(RPCS,AnyAcc,NoLock,Preserve)
+ {
+ Offset (0x18004),
+ ACMD, 8,
+ Offset (0x18010),
+ ABAR, 32,
+ }
+
+ OperationRegion(RPCZ,PCI_Config,0x00,0x40)
+ Field(RPCZ,DWordAcc,Lock,Preserve)
+ {
+ AUVD, 16,
+ }
+
+ ///
+ /// Restore Audio WAs
+ ///
+ Method (ASTR, 0, Serialized) {
+
+ If (LAnd (LNotEqual (And(ABAR, 0xFFFFC004), 0xFFFFC004), LNotEqual (And (ABAR, 0xFFFFC000), 0))) {
+ And (ABAR, 0xFFFFFFF0, BBAR)
+ Add (BBAR, 0x1000, BBAR)
+ OperationRegion(RPCY,SystemMemory,BBAR, 0x25)
+ Field(RPCY,DWordAcc,NoLock,Preserve)
+ {
+ Offset(0xC),
+ EM4W, 32,
+ Offset(0x10),
+ EMWA, 32,
+ Offset(0x1C),
+ ADWA, 32,
+ }
+
+ Store(AUDA, EMWA)
+ Store(AUDB, ADWA)
+ Store(AUDC, EM4W)
+ }
+
+ }
+
+ ///
+ /// Send the command to the codec via the Immediate Command
+ ///
+ Method (VSTR, 1, Serialized) {
+
+ Name (CONT, 1000)
+ Name (ADDR, 0x80000000)
+
+ Store (Arg0, ADDR)
+ OperationRegion(CCDC,SystemMemory,ADDR,4)
+ Field(CCDC,ByteAcc,NoLock,Preserve)
+ {
+ Offset(0x0),
+ CDEC, 32,
+ }
+
+ If (LAnd (LNotEqual (And(ABAR, 0xFFFFC004), 0xFFFFC004), LNotEqual (And (ABAR, 0xFFFFC000), 0))) {
+ If (LNotEqual (CDEC, 0)) {
+ And (ABAR, 0xFFFFFFF0, BBAR)
+
+ OperationRegion(IPCV,SystemMemory,BBAR,0x70)
+ Field(IPCV,DWordAcc,NoLock,Preserve)
+ {
+ Offset(0x60),
+ AVIC, 32,
+ Offset(0x68),
+ AIRS, 16,
+ }
+
+ Store (1000, CONT)
+ While (LAnd (LEqual(And(AIRS, 0x1), 1), LNotEqual(CONT,0)))
+ {
+ Stall(1)
+ Decrement(CONT)
+ }
+ Or (AIRS, 2, AIRS)
+ Store (CDEC, AVIC)
+ Or (AIRS, 1, AIRS)
+
+ Store (1000, CONT)
+ While (LAnd (LEqual(And(AIRS, 0x1), 1), LNotEqual(CONT,0)))
+ {
+ Stall(1)
+ Decrement(CONT)
+ }
+ }
+ }
+ }
+
+ ///
+ /// Restore Verb Table
+ ///
+ Method (CXDC, 0, Serialized)
+ {
+ Name(IDDX, 0x80000000)
+//AMI_OVERRIDE --- Change name from CADR to CCSA to fix that the system has BsOD issue. It is due to the name(CADR) is conflict with AMI Aptio definition name. >>
+ If (LAnd (LNotEqual (CCSA, 0), LNotEqual (CCNT, 0))) {
+ Store (CCSA, IDDX)
+ While (LLess (IDDX, Add (CCSA, Multiply (CCNT, 4))))
+// If (LAnd (LNotEqual (CADR, 0), LNotEqual (CCNT, 0))) {
+// Store (CADR, IDDX)
+// While (LLess (IDDX, Add (CADR, Multiply (CCNT, 4))))
+//AMI_OVERRIDE --- <<
+ {
+ VSTR (IDDX)
+ Add (IDDX, 4, IDDX)
+ }
+ }
+ }
+
+ ///
+ /// Reset Audio Controller
+ ///
+ Method (ARST, 0, Serialized)
+ {
+ If (LAnd (LNotEqual (And(ABAR, 0xFFFFC004), 0xFFFFC004), LNotEqual (And (ABAR, 0xFFFFC000), 0))) {
+ And (ABAR, 0xFFFFFFF0, BBAR)
+ OperationRegion(IPCV,SystemMemory,BBAR,0xBF)
+ Field(IPCV,AnyAcc,NoLock,Preserve)
+ {
+ Offset(0x08),
+ CRST, 32,
+ Offset(0x4C),
+ CORB, 32,
+ Offset(0x5C),
+ RIRB, 32,
+ Offset(0x80),
+ OSD1, 32,
+ Offset(0xA0),
+ OSD2, 32,
+ }
+ AND (CORB, 0xFFFFFFFD, CORB)
+ AND (RIRB, 0xFFFFFFFD, RIRB)
+ AND (OSD1, 0xFFFFFFFD, OSD1)
+ AND (OSD2, 0xFFFFFFFD, OSD2)
+ AND (CRST, 0xFFFFFFFE, CRST)
+ }
+ }
+
+ ///
+ /// Codec Initialization Programming Sequence
+ ///
+ Method (AINI, 0, Serialized)
+ {
+ Name (CONT, 1000)
+
+ If (LAnd (LNotEqual (And(ABAR, 0xFFFFC004), 0xFFFFC004), LNotEqual (And (ABAR, 0xFFFFC000), 0))) {
+ And (ABAR, 0xFFFFFFF0, BBAR)
+
+ OperationRegion(IPCV,SystemMemory,BBAR,0x70)
+ Field(IPCV,DWordAcc,NoLock,Preserve)
+ {
+ Offset(0x0),
+ GCAP, 16,
+ Offset(0x08),
+ GCTL, 32,
+ Offset(0x0E),
+ SSTS, 8,
+ Offset(0x60),
+ AVIC, 32,
+ Offset(0x68),
+ AIRS, 16,
+ }
+
+ ///
+ /// Step1/2:Reset Controller and wait for reset complete
+ ///
+ Or (GCTL, 1, GCTL)
+ Store (1000, CONT)
+ While (LAnd (LEqual (And (GCTL , 1), 0), LNotEqual (CONT, 0)))
+ {
+ Stall (1)
+ Decrement (CONT)
+ }
+
+ ///
+ /// Step3:
+ /// Read GCAP and write the same value back to
+ /// the register once after Controller Reset# bit is set
+ ///
+ And (GCAP, 0xFFFF, GCAP)
+
+ ///
+ /// Step4:
+ /// Clear the "State Change Status Register" STATESTS bits for
+ /// each of the "SDIN Stat Change Status Flag"
+ ///
+ Or (SSTS, 0xF, SSTS)
+
+ ///
+ /// Step5:
+ /// Turn off the link and poll RESET# bit until it reads back
+ /// as 0 to get hardware reset report
+ ///
+ And (GCTL, 0xFFFFFFFE, GCTL)
+
+ Store (1000, CONT)
+ While (LAnd (LEqual(And(GCTL,1), 1), LNotEqual(CONT,0)))
+ {
+ Stall (1)
+ Decrement (CONT)
+ }
+
+ ///
+ /// Step6:
+ /// Turn on the link and poll RESET# bit until it reads back as 1
+ ///
+ Or (GCTL, 1, GCTL)
+ Store (1000, CONT)
+ While (LAnd (LEqual(And(GCTL,1), 0), LNotEqual(CONT,0)))
+ {
+ Stall (1)
+ Decrement (CONT)
+ }
+ }
+ }
+ ///
+ /// W/A for Audio CdClk restore issue with HDMI hotplug after S3/S4 resume
+ /// Store ABAR temporarily and restore it at the end of Call Back SF 21h
+ ///
+ Method (ABWA, 1, Serialized)
+ {
+ If (Arg0) {
+ If (LOr (LEqual (And(ABAR, 0xFFFFC004), 0xFFFFC004), LEqual (And (ABAR, 0xFFFFC000), 0))) {
+ ///
+ /// if Audio BAR does not have a valid value
+ ///
+ If (LNotEqual (BARA, 0x80000000)) { // but a vaid value has been saved by the _INI or _WAK earlier
+ Store (ABAR, TBAR) // temporarily assign Audio Bar to restore mmio registers
+ Store (ACMD, TCMD)
+ Store (BARA, ABAR)
+ Store (0x06, ACMD)
+ Store (0x01, MODB)
+ }
+ } Else { // Audio BAR has a valid value
+ If (LNotEqual (And (ACMD, 0x06), 0x06)) { // but CMD register is not set to allow writes to mmio registers
+ Store (ACMD, TCMD) // temporarily set CMD register to allow mmio writes
+ Store (0x06, ACMD)
+ Store (0x01, MODC)
+ }
+ }
+ } Else { // Restore the original Audio Bar and Cmd Register
+ If (MODB) {
+ If(LEqual(ABAR, BARA)) {
+ Store (TBAR, ABAR)
+ Store (TCMD, ACMD)
+ }
+ }
+ If (MODC) { // Restore only the Cmd Register
+ Store (TCMD, ACMD)
+ }
+ }
+ }
+ } // end "SA Audio Device"
+
+ Device(GFX0) { // I.G.D
+ Name(_ADR, 0x00020000)
+ include("IntelGfx.ASL")
+ } // end I.G.D
+
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/SaPcieDsm.asl b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/SaPcieDsm.asl
new file mode 100644
index 0000000..613138c
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/SaPcieDsm.asl
@@ -0,0 +1,119 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Haswell *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+ Name(LTRV, Package(){0,0,0,0})
+ Name(OPTS, 0) // SA SETUP options for LTR and OBFF
+
+ //
+ // _DSM Device Specific Method
+ //
+ // Arg0: UUID Unique function identifier
+ // Arg1: Integer Revision Level
+ // Arg2: Integer Function Index (0 = Return Supported Functions)
+ // Arg3: Package Parameters
+ Method(_DSM, 4, Serialized) {
+ //
+ // Switch based on which unique function identifier was passed in
+ //
+ Switch(ToInteger(Arg0)) {
+ //
+ // _DSM Definitions for Latency Tolerance Reporting
+ //
+ // Arguments:
+ // Arg0: UUID: E5C937D0-3553-4d7a-9117-EA4D19C3434D
+ // Arg1: Revision ID: 2
+ // Arg2: Function Index: 6
+ // Arg3: Empty Package
+ //
+ // Return:
+ // A Package of four integers corresponding with the LTR encoding defined
+ // in the PCI Express Base Specification, as follows:
+ // Integer 0: Maximum Snoop Latency Scale
+ // Integer 1: Maximum Snoop Latency Value
+ // Integer 2: Maximum No-Snoop Latency Scale
+ // Integer 3: Maximum No-Snoop Latency Value
+ // These values correspond directly to the LTR Extended Capability Structure
+ // fields described in the PCI Express Base Specification.
+ //
+ Case(ToUUID("E5C937D0-3553-4d7a-9117-EA4D19C3434D")) {
+ //
+ // Switch by function index
+ //
+ Switch(ToInteger(Arg2)) {
+ //
+ // Function Index:0
+ // Standard query - A bitmask of functions supported
+ //
+ Case (0)
+ {
+ if (LEqual(Arg1, 2)){ // test Arg1 for Revision ID: 2
+ Store(1, OPTS) // function 0
+ if (LTRS){
+ Or(OPTS,0x40,OPTS) // function 6
+ }
+ if (OBFS){
+ Or(OPTS,0x10,OPTS) // function 4
+ }
+ Return (OPTS) // bitmask of supported functions: 6, 4, 0.
+ } else {
+ Return (0)
+ }
+ }
+ //
+ // Function Index: 4
+ //
+ Case(4) {
+ if (LEqual(Arg1, 2)){ // test Arg1 for Revision ID: 2
+ if (OBFS){
+ Return (Buffer () {0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0}) // OBFF capable, offset 4[08h]
+ } else {
+ Return (Buffer () {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0})
+ }
+ }
+ }
+ //
+ // Function Index: 6
+ // LTR Extended Capability Structure
+ //
+ Case(6) {
+ if (LEqual(Arg1, 2)){ // test Arg1 for Revision ID: 2
+ if (LTRS){
+ Store(And(ShiftRight(SMSL,10),7), Index(LTRV, 0))
+ Store(And(SMSL,0x3FF), Index(LTRV, 1))
+ Store(And(ShiftRight(SNSL,10),7), Index(LTRV, 2))
+ Store(And(SNSL,0x3FF), Index(LTRV, 3))
+ return (LTRV)
+ } else {
+ Return (0)
+ }
+ }
+ }
+ } // End of switch(Arg2)
+ } // End of case(ToUUID("E5C937D0-3553-4d7a-9117-EA4D19C3434D"))
+ } // End of switch(Arg0)
+ return (Buffer() {0x00})
+ } // End of _DSM
diff --git a/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/SaSsdt.asl b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/SaSsdt.asl
new file mode 100644
index 0000000..0650178
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/SaSsdt.asl
@@ -0,0 +1,172 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 2012 - 2013 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ SaSsdt.asl
+
+Abstract:
+
+ SA SSDT Table ASL code
+
+--*/
+
+
+DefinitionBlock (
+ "SaSsdt.aml",
+ "SSDT",
+ 0x01,
+ "SaSsdt",
+ "SaSsdt ",
+ 0x3000
+ )
+{
+
+ OperationRegion(SANV,SystemMemory,0xFFFF0000,0xAA55)
+ Field(SANV,AnyAcc,Lock,Preserve)
+ {
+ SARV, 32, /// (000) SA RC Revision
+ ASLB, 32, /// (004) IGD OpRegion base address
+ IMON, 8, /// (008) IMON Current Value
+ IGDS, 8, /// (009) IGD State (Primary Display = 1)
+ CADL, 8, /// (010) Current Attached Device List
+ PADL, 8, /// (011) Previous Attached Device List
+ CSTE, 16, /// (012) Current Display State
+ NSTE, 16, /// (014) Next Display State
+ DID9, 32, /// (016) Device Id 9
+ DIDA, 32, /// (020) Device Id 10
+ DIDB, 32, /// (024) Device Id 11
+ IBTT, 8, /// (028) IGD Boot Display Device
+ IPAT, 8, /// (029) IGD Panel Type CMOs option
+ IPSC, 8, /// (030) IGD Panel Scaling
+ IBLC, 8, /// (031) IGD BLC Configuration
+ IBIA, 8, /// (032) IGD BIA Configuration
+ ISSC, 8, /// (033) IGD SSC Configuration
+ IPCF, 8, /// (034) IGD Power Conservation Feature Flag
+ IDMS, 8, /// (035) IGD DVMT Memory Size
+ IF1E, 8, /// (036) IGD Function 1 Enable
+ HVCO, 8, /// (037) HPLL VCO
+ NXD1, 32, /// (038) Next state DID1 for _DGS
+ NXD2, 32, /// (042) Next state DID2 for _DGS
+ NXD3, 32, /// (046) Next state DID3 for _DGS
+ NXD4, 32, /// (050) Next state DID4 for _DGS
+ NXD5, 32, /// (054) Next state DID5 for _DGS
+ NXD6, 32, /// (058) Next state DID6 for _DGS
+ NXD7, 32, /// (062) Next state DID7 for _DGS
+ NXD8, 32, /// (066) Next state DID8 for _DGS
+ GSMI, 8, /// (070) GMCH SMI/SCI mode (0=SCI)
+ PAVP, 8, /// (071) IGD PAVP data
+ LIDS, 8, /// (072) Lid State (Lid Open = 1)
+ KSV0, 32, /// (073) First four bytes of AKSV (mannufacturing mode)
+ KSV1, 8, /// (077) Fifth byte of AKSV (mannufacturing mode)
+ BBAR, 32, /// (078) IGFX Audio (D3F0) MMIO BAR Address
+ BLCS, 8, /// (082) Backlight Control Support
+ BRTL, 8, /// (083) Brightness Level Percentage
+ ALSE, 8, /// (084) ALS Enable
+ ALAF, 8, /// (085) Ambient Light Adjusment Factor
+ LLOW, 8, /// (086) LUX Low Value
+ LHIH, 8, /// (087) LUX High Value
+ ALFP, 8, /// (088) Active LFP
+ AUDA, 32, /// (089) Audio MMIO WA 1
+ AUDB, 32, /// (093) Audio MMIO WA 2
+ AUDC, 32, /// (097) Audio MMIO WA 3
+ DIDC, 32, /// (101) Device Id 12
+ DIDD, 32, /// (105) Device Id 13
+ DIDE, 32, /// (109) Device Id 14
+ DIDF, 32, /// (113) Device Id 15
+//AMI_OVERRIDE --- Change name from CADR to CCSA to fix that the system has BsOD issue. It is due to the name(CADR) is conflict with AMI Aptio definition name. >>
+ CCSA, 32, /// (117) Codec Save Address
+ CCNT, 32, /// (121) Codec Save Count
+//CADR, 32, /// (117) Codec Save Address
+//CCNT, 8, /// (121) Codec Save Count
+//AMI_OVERRIDE --- <<
+ ///
+ /// Switchable Graphics Info
+ ///
+ Offset(200),
+ SGMD, 8, /// (200) SG Mode (0=Disabled, 1=SG Muxed, 2=SG Muxless, 3=DGPU Only)
+ SGFL, 8, /// (201) SG Feature List
+ PWOK, 8, /// (202) dGPU PWROK GPIO assigned
+ HLRS, 8, /// (203) dGPU HLD RST GPIO assigned
+ PWEN, 8, /// (204) dGPU PWR Enable GPIO assigned
+ PRST, 8, /// (205) dGPU Present Detect GPIO assigned
+ CPSP, 32, /// (206) PEG Endpoint Capability Structure Presence (Bit 0: Virtual Channel Capability)
+ EECP, 8, /// (210) PEG Endpoint PCIe Capability Structure Offset
+ EVCP, 16, /// (211) PEG Endpoint Virtual Channel Capability Structure Offset
+ XBAS, 32, /// (213) Any Device's PCIe Config Space Base Address
+ GBAS, 16, /// (217) GPIO Base Address
+ SGGP, 8, /// (219) SG GPIO Support
+ NVGA, 32, /// (220) NVIG opregion address
+ NVHA, 32, /// (224) NVHM opregion address
+ AMDA, 32, /// (228) AMDA opregion address
+ NDID, 8, /// (232) Number of Valid Device IDs
+ DID1, 32, /// (233) Device ID 1
+ DID2, 32, /// (237) Device ID 2
+ DID3, 32, /// (241) Device ID 3
+ DID4, 32, /// (245) Device ID 4
+ DID5, 32, /// (249) Device ID 5
+ DID6, 32, /// (253) Device ID 6
+ DID7, 32, /// (257) Device ID 7
+ DID8, 32, /// (261) Device ID 8
+ OBS1, 32, /// (265) Occupied Buses - from 0 to 31
+ OBS2, 32, /// (269) Occupied Buses - from 32 to 63
+ OBS3, 32, /// (273) Occupied Buses - from 64 to 95
+ OBS4, 32, /// (277) Occupied Buses - from 96 to 127
+ OBS5, 32, /// (281) Occupied Buses - from 128 to 159
+ OBS6, 32, /// (285) Occupied Buses - from 160 to 191
+ OBS7, 32, /// (289) Occupied Buses - from 192 to 223
+ OBS8, 32, /// (293) Occupied Buses - from 224 to 255
+ LTRA, 8, /// (297) Latency Tolerance Reporting Enable
+ OBFA, 8, /// (298) Optimized Buffer Flush and Fill
+ LTRB, 8, /// (299) Latency Tolerance Reporting Enable
+ OBFB, 8, /// (300) Optimized Buffer Flush and Fill
+ LTRC, 8, /// (301) Latency Tolerance Reporting Enable
+ OBFC, 8, /// (302) Optimized Buffer Flush and Fill
+ SMSL, 16, /// (303) SA Peg Latency Tolerance Reporting Max Snoop Latency
+ SNSL, 16, /// (305) SA Peg Latency Tolerance Reporting Max No Snoop Latency
+ P0UB, 8, /// (307) Peg0 Unused Bundle Control
+ P1UB, 8, /// (308) Peg1 Unused Bundle Control
+ P2UB, 8, /// (309) Peg2 Unused Bundle Control
+ EDPV, 8, /// (310) Check for eDP display device
+ NXDX, 32, /// (311) Next state DID for eDP
+ DIDX, 32, /// (315) Device ID for eDP device
+ PCSL, 8, /// (319) The lowest C-state for the package
+ SC7A, 8, /// (316) Run-time C7 Allowed feature (0=Disabled, 1=Enabled)
+// AMI_OVERRIDE...
+ DSEL, 8, /// (319) dGPU Display Select GPIO assigned
+ ESEL, 8, /// (320) dGPU EDID Select GPIO assigned
+ PSEL, 8, /// (321) dGPU PWM Select GPIO assigned
+ MXD1, 32, /// (322) DID1 Mux Setting
+ MXD2, 32, /// (326) DID2 Mux Setting
+ MXD3, 32, /// (330) DID3 Mux Setting
+ MXD4, 32, /// (334) DID4 Mux Setting
+ MXD5, 32, /// (338) DID5 Mux Setting
+ MXD6, 32, /// (342) DID6 Mux Setting
+ MXD7, 32, /// (346) DID7 Mux Setting
+ MXD8, 32, /// (350) DID8 Mux Setting
+ PXFD, 8, /// (354) ATI 5.0 Fixed/Dynamic ATI 5.0 Fixed/Dynamic
+ EBAS, 32, /// (355) Endpoint PCIe Base Address
+ HYSS, 32, /// (359) dGPU SSID for MSHyBrid restore
+// AMI_OVERRIDE...end.
+ }
+#if !defined(ASL_Remove_SaSsdt_Data_To_Dsdt) || (ASL_Remove_SaSsdt_Data_To_Dsdt == 0)
+ include ("Sa.asl")
+#endif // AMI_OVERRIDE
+} \ No newline at end of file
diff --git a/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/SaSsdt.inf b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/SaSsdt.inf
new file mode 100644
index 0000000..e97e019
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/SaSsdt.inf
@@ -0,0 +1,69 @@
+## @file
+# Component description file for the ACPI tables
+#
+#@copyright
+# Copyright (c) 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains an 'Intel Peripheral Driver' and uniquely
+# identified as "Intel Reference Module" and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+
+
+[defines]
+BASE_NAME = SaSsdt
+FILE_GUID = AAA99A23-13B6-4C31-BB8B-299E8EC04FA4
+COMPONENT_TYPE = ACPITABLE
+FFS_EXT = .ffs
+
+[sources.common]
+ SaSsdt.ASL
+
+[libraries.common]
+
+[includes.common]
+ .
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Include
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+# $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/SampleCode/Include
+
+#
+# Edk II Glue Library, some hearder are included by R9 header so have to include
+#
+
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Framework
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[nmake.common]
diff --git a/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/SaSsdtTables.cif b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/SaSsdtTables.cif
new file mode 100644
index 0000000..ef4ae0c
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/SaSsdtTables.cif
@@ -0,0 +1,19 @@
+<component>
+ name = "SaSsdtTables"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\SystemAgent\AcpiTables\SaSsdt\"
+ RefName = "SaSsdtTables"
+[files]
+"IgdOGBDA.ASL"
+"IgdOMOBF.ASL"
+"IgdOpRn.ASL"
+"IgdOSBCB.ASL"
+"INTELGFX.ASL"
+"Sa.asl"
+"SaPcieDsm.asl"
+"SaSsdt.asl"
+"SaSsdt.inf"
+"SaSsdt_Edk.inf"
+"SaSsdtTables.mak"
+"SaSsdtTables.sdl"
+<endComponent>
diff --git a/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/SaSsdtTables.mak b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/SaSsdtTables.mak
new file mode 100644
index 0000000..e44f223
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/SaSsdtTables.mak
@@ -0,0 +1,57 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+#<AMI_FHDR_START>
+#
+# Name: SgAcpiTables.mak
+#
+# Description: MAK file for the ModulePart:SgAcpiTables
+#
+#
+#<AMI_FHDR_END>
+#*************************************************************************
+all : BuildSaSsdt
+
+BuildSaSsdt : $(BUILD_DIR)\SaSsdt.ffs
+
+#-----------------------------------------------------------------------
+# ASL compiler definition
+#-----------------------------------------------------------------------
+IASL = $(SILENT)iasl4.exe
+#-----------------------------------------------------------------------
+$(BUILD_DIR)\SaSsdt.aml : $(INTEL_SASSDT_ASL_FILE)
+ $(CP) /FI$(BUILD_DIR)\tokenasl.h $(INTEL_IgdOGBDA_ASL_FILE) > $(BUILD_DIR)\IgdOGBDA.asl
+ $(CP) /FI$(BUILD_DIR)\tokenasl.h $(INTEL_IgdOMOBF_ASL_FILE) > $(BUILD_DIR)\IgdOMOBF.asl
+ $(CP) /FI$(BUILD_DIR)\tokenasl.h $(INTEL_IgdOPRN_ASL_FILE) > $(BUILD_DIR)\IgdOPRN.asl
+ $(CP) /FI$(BUILD_DIR)\tokenasl.h $(INTEL_IgdOSBCB_ASL_FILE) > $(BUILD_DIR)\IgdOSBCB.asl
+ $(CP) /FI$(BUILD_DIR)\tokenasl.h $(INTEL_INTELGFX_ASL_FILE) > $(BUILD_DIR)\INTELGFX.asl
+ $(CP) /FI$(BUILD_DIR)\tokenasl.h $(INTEL_SA_ASL_FILE) > $(BUILD_DIR)\SA.asl
+ $(CP) /FI$(BUILD_DIR)\tokenasl.h $(INTEL_SAPCIEDSM_ASL_FILE) > $(BUILD_DIR)\SAPCIEDSM.asl
+ $(CP) /FI$(BUILD_DIR)\tokenasl.h $(INTEL_SASSDT_ASL_FILE) > $(BUILD_DIR)\SASSDT.asl
+ $(ASLEXPANDER) $(BUILD_DIR)\SASSDT.asl $(BUILD_DIR)\SASSDT_BUILD.asl $(BUILD_DIR)
+ $(IASL) -p $(BUILD_DIR)\SaSsdt.aml $(BUILD_DIR)\SASSDT_BUILD.asl
+
+
+$(BUILD_DIR)\SaSsdt.sec: $(BUILD_DIR)\SaSsdt.aml
+ $(GENSECTION) -I $*.aml -O $@ -S EFI_SECTION_RAW
+
+$(BUILD_DIR)\SaSsdt.ffs: $(BUILD_DIR)\SaSsdt.sec $(SaSsdtTables_DIR)\SaSsdtTables.mak
+ $(MAKE) /f Core\FFS.mak \
+ BUILD_DIR=$(BUILD_DIR) \
+ GUID=AAA99A23-13B6-4C31-BB8B-299E8EC04FA4\
+ TYPE=EFI_FV_FILETYPE_FREEFORM \
+ FFS_CHECKSUM=1\
+ RAWFILE=$(BUILD_DIR)\SaSsdt.sec FFSFILE=$(BUILD_DIR)\SaSsdt.ffs COMPRESS=0 NAME=SaSsdt
+
diff --git a/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/SaSsdtTables.sdl b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/SaSsdtTables.sdl
new file mode 100644
index 0000000..6e0c223
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/SaSsdtTables.sdl
@@ -0,0 +1,104 @@
+TOKEN
+ Name = "SaSsdtTables_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable SaSsdtTables support in Project"
+End
+
+TOKEN
+ Name = "Remove_SaSsdt_Data_To_Dsdt"
+ Value = "0"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Help = "Remove related SaSsdt acpi data to DSDT"
+End
+
+ELINK
+ Name = "/D Remove_SaSsdt_Data_To_Dsdt"
+ Parent = "INTEL_SA_RC_FLAGS"
+ Token = "Remove_SaSsdt_Data_To_Dsdt" "=" "1"
+ InvokeOrder = AfterParent
+End
+
+MODULE
+ Help = "Includes SgAcpiTables.mak to Project"
+ File = "SaSsdtTables.mak"
+End
+
+PATH
+ Name = "SaSsdtTables_DIR"
+End
+
+ELINK
+ Name = "$(SaSsdtTables_DIR)\Sa.asl"
+ Parent = "INTEL_GENERIC_ASL"
+ Token = "Remove_SaSsdt_Data_To_Dsdt" "=" "1"
+ InvokeOrder = AfterParent
+End
+
+TOKEN
+ Name = "INTEL_IgdOGBDA_ASL_FILE"
+ Value = "$(SaSsdtTables_DIR)\IgdOGBDA.asl"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+TOKEN
+ Name = "INTEL_IgdOMOBF_ASL_FILE"
+ Value = "$(SaSsdtTables_DIR)\IgdOMOBF.asl"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+TOKEN
+ Name = "INTEL_IgdOPRN_ASL_FILE"
+ Value = "$(SaSsdtTables_DIR)\IgdOPRN.asl"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+TOKEN
+ Name = "INTEL_IgdOSBCB_ASL_FILE"
+ Value = "$(SaSsdtTables_DIR)\IgdOSBCB.asl"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+TOKEN
+ Name = "INTEL_INTELGFX_ASL_FILE"
+ Value = "$(SaSsdtTables_DIR)\INTELGFX.asl"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+TOKEN
+ Name = "INTEL_SA_ASL_FILE"
+ Value = "$(SaSsdtTables_DIR)\SA.asl"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+TOKEN
+ Name = "INTEL_SAPCIEDSM_ASL_FILE"
+ Value = "$(SaSsdtTables_DIR)\SAPCIEDSM.asl"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+TOKEN
+ Name = "INTEL_SASSDT_ASL_FILE"
+ Value = "$(SaSsdtTables_DIR)\SASSDT.asl"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\SaSsdt.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/SaSsdt_Edk.inf b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/SaSsdt_Edk.inf
new file mode 100644
index 0000000..4ef6ff6
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SaSsdt/SaSsdt_Edk.inf
@@ -0,0 +1,76 @@
+## @file
+# Component description file for the ACPI tables (for EDK1117)
+#
+#@copyright
+# Copyright (c) 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains an 'Intel Peripheral Driver' and uniquely
+# identified as "Intel Reference Module" and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+
+
+[defines]
+BASE_NAME = SaSsdt
+FILE_GUID = AAA99A23-13B6-4C31-BB8B-299E8EC04FA4
+COMPONENT_TYPE = SA_SSDT_ACPITABLE
+FFS_EXT = .ffs
+
+[sources.common]
+ SaSsdt.ASL
+ Sa.asl
+ IntelGfx.asl
+ IgdOpRn.asl
+ IgdOGBDA.asl
+ IgdOMOBF.asl
+ IgdOSBCB.asl
+ SaPcieDsm.asl
+
+[libraries.common]
+
+[includes.common]
+ .
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Include
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+# $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/SampleCode/Include
+
+#
+# Edk II Glue Library, some hearder are included by R9 header so have to include
+#
+
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Framework
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[nmake.common]
diff --git a/ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Pch/SgAcpiTablesPch.cif b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Pch/SgAcpiTablesPch.cif
new file mode 100644
index 0000000..55ed596
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Pch/SgAcpiTablesPch.cif
@@ -0,0 +1,12 @@
+<component>
+ name = "SgAcpiTablesPch"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\SystemAgent\AcpiTables\SwitchableGraphics\Pch\"
+ RefName = "SgAcpiTablesPch"
+[files]
+"SgAcpiTablesPch.sdl"
+"SgAcpiTablesPch.mak"
+"SgAcpiTablesPch.inf"
+"SgDgpuPch.asl"
+"SgSsdtPch.asl"
+<endComponent>
diff --git a/ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Pch/SgAcpiTablesPch.inf b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Pch/SgAcpiTablesPch.inf
new file mode 100644
index 0000000..5fdc0ea
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Pch/SgAcpiTablesPch.inf
@@ -0,0 +1,69 @@
+## @file
+# Component description file for the ACPI tables
+#
+#@copyright
+# Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains an 'Intel Peripheral Driver' and uniquely
+# identified as "Intel Reference Module" and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+
+
+[defines]
+BASE_NAME = SgAcpiTablesPch
+FILE_GUID = CBCB3817-81E6-497e-87FF-C8FA8F24EC28
+COMPONENT_TYPE = ACPITABLE
+FFS_EXT = .ffs
+
+[sources.common]
+ SgSsdtPch.ASL
+
+[libraries.common]
+
+[includes.common]
+ .
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Include
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/SampleCode/Include
+
+#
+# Edk II Glue Library, some hearder are included by R9 header so have to include
+#
+
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Framework
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[nmake.common]
diff --git a/ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Pch/SgAcpiTablesPch.mak b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Pch/SgAcpiTablesPch.mak
new file mode 100644
index 0000000..4f84b21
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Pch/SgAcpiTablesPch.mak
@@ -0,0 +1,62 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+#<AMI_FHDR_START>
+#
+# Name: SgAcpiTablesPch.mak
+#
+# Description: MAK file for the ModulePart:SgAcpiTablesPch
+#
+#
+#<AMI_FHDR_END>
+#*************************************************************************
+EDK: SGPCHASL
+
+SGPCHASL: $(BUILD_DIR)\SGACPIPCH.ffs
+
+ALLSGPCHSEC = $(BUILD_DIR)\SGACPIPCH.sec
+
+!IFNDEF IASL
+IASL = iasl4.exe # Intel ASL compiler. Supports extended ACPI 2.0 asl objects
+!ENDIF
+
+#-----------------------------------------------------------------------#
+# Process SGPCH asl files
+#-----------------------------------------------------------------------#
+
+$(BUILD_DIR)\SgSsdtPch.asl : $(SGACPIPCH_DIR)\SgSsdtPch.ASL \
+ $(SGACPIPCH_DIR)\SgDgpuPch.ASL
+ $(CP) /I$(SGACPIPCH_DIR) /FItoken.h /C $(SGACPIPCH_DIR)\$(@F) > $@
+# include the token.h if needed to check for SDL flags
+# /FItoken.h
+
+SgAcpiTablesPch_Includes = \
+ $(SGACPIPCH_DIR)\
+
+$(BUILD_DIR)\SgSsdtPch.aml: $(BUILD_DIR)\SgSsdtPch.asl
+ $(SILENT)$(IASL) -I $(SgAcpiTablesPch_Includes) -p $@ $**
+
+$(ALLSGPCHSEC): $(BUILD_DIR)\SgSsdtPch.aml
+ $(GENSECTION) -I $** -O $@ -S EFI_SECTION_RAW
+
+$(BUILD_DIR)\SGACPIPCH.ffs: $(ALLSGPCHSEC) $(SGACPIPCH_DIR)\SgAcpiTablesPch.mak
+ $(MAKE) /f Core\FFS.mak \
+ BUILD_DIR=$(BUILD_DIR) \
+ GUID=CBCB3817-81E6-497e-87FF-C8FA8F24EC28\
+ TYPE=EFI_FV_FILETYPE_FREEFORM \
+ FFS_CHECKSUM=1\
+ RAWFILE=$(ALLSGPCHSEC) FFSFILE=$(BUILD_DIR)\SGACPIPCH.ffs COMPRESS=0 NAME=SGACPIPCH
+
+
diff --git a/ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Pch/SgAcpiTablesPch.sdl b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Pch/SgAcpiTablesPch.sdl
new file mode 100644
index 0000000..94ec922
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Pch/SgAcpiTablesPch.sdl
@@ -0,0 +1,113 @@
+TOKEN
+ Name = SgAcpiTablesPch_SUPPORT
+ Value = 1
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable SgAcpiTablesPch support in Project"
+ Token = "SwitchableGraphics_SUPPORT" "=" "1"
+End
+
+TOKEN
+ Name = "SG_ULT_RPNum"
+ Value = "1"
+ TokenType = Expression
+ TargetMak = Yes
+ TargetH = Yes
+ Token = "SG_ULT_PORT_FUNC" "=" "0"
+ Lock = Yes
+End
+
+TOKEN
+ Name = "SG_ULT_RPNum"
+ Value = "2"
+ TokenType = Expression
+ TargetMak = Yes
+ TargetH = Yes
+ Token = "SG_ULT_PORT_FUNC" "=" "1"
+ Lock = Yes
+End
+
+TOKEN
+ Name = "SG_ULT_RPNum"
+ Value = "3"
+ TokenType = Expression
+ TargetMak = Yes
+ TargetH = Yes
+ Token = "SG_ULT_PORT_FUNC" "=" "2"
+ Lock = Yes
+End
+
+TOKEN
+ Name = "SG_ULT_RPNum"
+ Value = "4"
+ TokenType = Expression
+ TargetMak = Yes
+ TargetH = Yes
+ Token = "SG_ULT_PORT_FUNC" "=" "3"
+ Lock = Yes
+End
+
+TOKEN
+ Name = "SG_ULT_RPNum"
+ Value = "5"
+ TokenType = Expression
+ TargetMak = Yes
+ TargetH = Yes
+ Token = "SG_ULT_PORT_FUNC" "=" "4"
+ Lock = Yes
+End
+
+TOKEN
+ Name = "SG_ULT_RPNum"
+ Value = "6"
+ TokenType = Expression
+ TargetMak = Yes
+ TargetH = Yes
+ Token = "SG_ULT_PORT_FUNC" "=" "5"
+ Lock = Yes
+End
+
+TOKEN
+ Name = "SG_ULT_RPNum"
+ Value = "7"
+ TokenType = Expression
+ TargetMak = Yes
+ TargetH = Yes
+ Token = "SG_ULT_PORT_FUNC" "=" "6"
+ Lock = Yes
+End
+
+TOKEN
+ Name = "SG_ULT_RPNum"
+ Value = "8"
+ TokenType = Expression
+ TargetMak = Yes
+ TargetH = Yes
+ Token = "SG_ULT_PORT_FUNC" "=" "7"
+ Lock =Yes
+End
+
+TOKEN
+ Name = "SG_ULT_RP_NUM"
+ Value = "\_SB.PCI0.RP0$(SG_ULT_RPNum)"
+ TokenType = Expression
+ TargetH = Yes
+ Lock = Yes
+End
+
+MODULE
+ Help = "Includes SgAcpiTablesPch.mak to Project"
+ File = "SgAcpiTablesPch.mak"
+End
+
+PATH
+ Name = "SGACPIPCH_DIR"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\SGACPIPCH.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Pch/SgDgpuPch.asl b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Pch/SgDgpuPch.asl
new file mode 100644
index 0000000..76a9a0e
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Pch/SgDgpuPch.asl
@@ -0,0 +1,847 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - SG Reference Code *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 2010 - 2013 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+External(\_SB.PCI0.GFX0._DOD, MethodObj)
+External(\_SB.PCI0.GFX0.DD01._ADR, MethodObj)
+External(\_SB.PCI0.GFX0.DD02._ADR, MethodObj)
+External(\_SB.PCI0.GFX0.DD03._ADR, MethodObj)
+External(\_SB.PCI0.GFX0.DD04._ADR, MethodObj)
+External(\_SB.PCI0.GFX0.DD05._ADR, MethodObj)
+External(\_SB.PCI0.GFX0.DD06._ADR, MethodObj)
+External(\_SB.PCI0.GFX0.DD07._ADR, MethodObj)
+External(\_SB.PCI0.GFX0.DD08._ADR, MethodObj)
+
+External(\_SB.PCI0.GFX0.DD01._DGS, MethodObj)
+External(\_SB.PCI0.GFX0.DD02._DGS, MethodObj)
+External(\_SB.PCI0.GFX0.DD03._DGS, MethodObj)
+External(\_SB.PCI0.GFX0.DD04._DGS, MethodObj)
+External(\_SB.PCI0.GFX0.DD05._DGS, MethodObj)
+External(\_SB.PCI0.GFX0.DD06._DGS, MethodObj)
+External(\_SB.PCI0.GFX0.DD07._DGS, MethodObj)
+External(\_SB.PCI0.GFX0.DD08._DGS, MethodObj)
+
+External(\_SB.PCI0.GFX0.DD02._DCS, MethodObj)
+
+External(\_SB.PCI0.GFX0.DD02._BCL, MethodObj)
+External(\_SB.PCI0.GFX0.DD02._BQC, MethodObj)
+External(\_SB.PCI0.GFX0.DD02._BCM, MethodObj)
+//AMI override begin
+External(SG_ULT_RP_NUM, DeviceObj)
+//External(\_SB.PCI0.RP05, DeviceObj)
+//AMI override end
+External(\RPA4)
+External(\EECP)
+External(\XBAS)
+External(\GBAS)
+External(\HLRS)
+External(\PWEN)
+External(\SGMD)
+External(\SGGP)
+//AMI override begin
+External(\EBAS)
+External(\HYSS)
+//AMI override end
+//AMI override begin
+Scope(SG_ULT_RP_NUM)
+//Scope(\_SB.PCI0.RP05)
+//AMI override end
+{
+ OperationRegion (MSID, SystemMemory, EBAS, 0x50)
+ Field(MSID, DWordAcc, Lock, Preserve)
+ {
+ VEID, 16,
+ Offset(0x40),
+ NVID, 32,
+ offset(0x4c),
+ ATID, 32,
+ }
+ // Define a Memory Region that will allow access to the PCH root port
+ // Register Block.
+ //
+// OperationRegion(RPCI,PCI_Config,0x00,0xF0)
+// Field(RPCI,DWordAcc,Lock,Preserve)
+// {
+// }
+
+ OperationRegion(RPCX,SystemMemory,Add(Add(\XBAS,0xE0000), ShiftLeft(And(\RPA4,0xF),12)),0x1000)
+ Field(RPCX,DWordAcc,NoLock,Preserve)
+ {
+ Offset(0),
+ PVID, 16,
+ PDID, 16,
+// AMI_OVERRIDE >>>
+ Offset(0x4),
+ CMDR, 8,
+// AMI_OVERRIDE >>>
+ Offset(0x50), // LCTL - Link Control Register of (PCI Express* -> B00:D28:F04)
+ ASPM, 2, // 1:0, ASPM //Not referenced in code
+ , 2,
+ LNKD, 1, // Link Disable
+ // AMI_OVERRIDE >>>
+ Offset(0xA4),
+ D0ST, 2,
+// AMI_OVERRIDE >>>
+ Offset(0x328), //PCIESTS1 - PCI Express Status 1
+ , 19,
+ LNKS, 4, //Link Status (LNKSTAT) {22:19}
+ }
+
+ //-----------------------------------------
+ // Runtime Device Power Management - Begin
+ //-----------------------------------------
+ // Note:
+ // Runtime Device Power Management can be achieved by using _PRx or _PSx or both
+
+ //
+ // Name: PC05
+ // Description: Declare a PowerResource object for RP05 slot device
+ //
+ PowerResource(PC05, 0, 0)
+ {
+ Name(_STA, One)
+
+ Method(_ON, 0, Serialized)
+ {
+
+// AMI_OVERRIDE >>>
+// \_SB.PCI0.RP05.PEGP.HGON()
+ \_SB.PCI0.RP05.PEGP.SGON()
+ Store(0x07, CMDR)
+ Store(0, D0ST)
+
+ If(LEqual(VEID,0x10DE))
+ {
+ Store(HYSS, NVID)
+ }
+ If(LEqual(VEID,0x1002))
+ {
+ Store(HYSS, ATID)
+ }
+// AMI_OVERRIDE <<<
+ Store(One, _STA)
+ }
+
+ Method(_OFF, 0, Serialized)
+ {
+
+// AMI_OVERRIDE >>>
+// \_SB.PCI0.RP05.PEGP.HGOF()
+ \_SB.PCI0.RP05.PEGP.SGOF()
+// AMI_OVERRIDE <<<
+ Store(Zero, _STA)
+ }
+ } //End of PowerResource(PC05, 0, 0)
+
+ Name(_PR0,Package(){PC05})
+ Name(_PR2,Package(){PC05})
+ Name(_PR3,Package(){PC05})
+
+// //
+// // Name: _PS0
+// // Description: D0 Method for RP05 slot device
+// // Input: Nothing
+// // Return: Nothing
+// //
+// Method(_PS0, 0, Serialized)
+// {
+//
+// \_SB.PCI0.RP05.PEGP.HGON()
+// }
+//
+// //
+// // Name: _PS3
+// // Description: D3 Method for RP05 slot device
+// // Input: Nothing
+// // Return: Nothing
+// //
+// Method(_PS3, 0, Serialized)
+// {
+//
+// \_SB.PCI0.RP05.PEGP.HGOF()
+// }
+
+ Method(_S0W, 0)
+ {
+ Return(4) //D3cold is supported
+ }
+
+ //-----------------------------------------
+ // Runtime Device Power Management - End
+ //-----------------------------------------
+
+ Device(PEGP) { // (PCI Express* -> B00:D28:F04) Slot Device D0F0
+ Name(_ADR, 0x00000000)
+ Method(_PRW, 0) { Return(GPRW(0x09, 4)) } // can wakeup from S4 state
+ } // (PCI Express* -> B00:D28:F04) Slot Device D0F0
+
+ Device(PEGA) { // (PCI Express* -> B00:D28:F04) Slot Device D0F1
+ Name(_ADR, 0x00000001)
+
+ OperationRegion(ACAP, PCI_Config, \EECP,0x14)
+ Field(ACAP,DWordAcc, NoLock,Preserve)
+ {
+ Offset(0x10),
+ LCT1, 16, // Link Control register
+ }
+ Method(_PRW, 0) { Return(GPRW(0x09, 4)) } // can wakeup from S4 state
+ } // (PCI Express* -> B00:D28:F04) Slot Device D0F1
+}
+//AMI override begin
+Scope(SG_ULT_RP_NUM.PEGP)
+//Scope(\_SB.PCI0.RP05.PEGP)
+//AMI override end
+{
+ Name (ONOF, 0x1) //Endpoint On-Off flag status. Assume Endpoint is ON by default {1-ON, 0-OFF}
+ Name (IVID, 0xFFFF) //Invalid Vendor ID
+ Name (ELCT, 0x00000000)
+ Name (HVID, 0x0000)
+ Name (HDID, 0x0000)
+
+ OperationRegion (PCIS, PCI_Config, 0x00, 0xF0)
+ Field(PCIS, AnyAcc, Lock, Preserve)
+ {
+ Offset(0x0),
+ DVID, 16,
+ Offset(0xB),
+ CBCC, 8,
+ Offset(0x2C),
+ SVID, 16,
+ SDID, 16,
+ Offset(0x4C),
+ WVID, 16,
+ WDID, 16,
+ }
+
+ OperationRegion(PCAP, PCI_Config, \EECP,0x14)
+ Field(PCAP,DWordAcc, NoLock,Preserve)
+ {
+ Offset(0x10),
+ LCTL, 16, // Link Control register
+ }
+
+ Method (_INI)
+ {
+ //AMI override begin
+ Store (0x0, SG_ULT_RP_NUM.PEGP._ADR)
+ //Store (0x0, \_SB.PCI0.RP05.PEGP._ADR)
+ //AMI override end
+ }
+
+// AMI CHANGE BEGIN.
+ Method(SGON,0,Serialized)
+// Method(HGON,0,Serialized)
+// AMI CHANGE END.
+ {
+
+ //AMI override begin
+ Store("SG_ULT_RP_NUM.PEGP._ON", Debug)
+ //Store("\_SB.PCI0.RP05.PEGP._ON", Debug)
+ //AMI override end
+ If (LEqual(CCHK(1), 0))
+ {
+ Return ()
+ }
+
+ Store(1, ONOF) //Indicate Endpoint is in ON state
+
+ //ACTION TODO:
+ //........................................................................................
+ //While powering up the slot again, the only requirement is that the Reset# should be
+ //de-asserted 100ms after the power to slot is up (Standard requirement as per PCIe spec).
+
+ //Note:
+ //Before power enable, and for 100ms after power enable, the reset should be in hold condition.
+ //The 100 ms time is given for power rails and clocks to become stable.
+ //So during this period, reset must not be released.
+ //........................................................................................
+
+ //Power on the dGPU card
+ SGPO(HLRS, 1) //Assert dGPU_HOLD_RST# {Hold the dGPU Reset}
+ SGPO(PWEN, 1) //Assert dGPU_PWR_EN# {Power on the dGPU}
+
+ Sleep(300) // Wait for 300ms if dGPU_PWROK has h/w issues
+
+ SGPO(HLRS, 0) //Deassert dGPU_HOLD_RST# {Release the dGPU Reset}
+ Sleep(100) // Wait for 100ms
+
+ //Enable x4 Link
+ //This bit should already be set to 0 in the _Off method. But do it anyway.
+ Store(0,LNKD)
+
+ //wait until link has trained to x4. Verify
+ While(LLess(LNKS,7))
+ {
+ Sleep(1)
+ }
+
+ // Re-store the DGPU SSID
+ Store(HVID,WVID)
+ Store(HDID,WDID)
+
+ // Re-store the Link Control register - Common Clock Control and ASPM
+ Or(And(ELCT,0x0043),And(LCTL,0xFFBC),LCTL)
+//AMI override begin
+ Or(And(ELCT,0x0043),And(SG_ULT_RP_NUM.PEGA.LCT1,0xFFBC),SG_ULT_RP_NUM.PEGA.LCT1)
+ //Or(And(ELCT,0x0043),And(\_SB.PCI0.RP05.PEGA.LCT1,0xFFBC),\_SB.PCI0.RP05.PEGA.LCT1)
+
+// Return ()
+// }
+
+// Method(_ON,0,Serialized)
+// {
+
+// HGON()
+//AMI override end
+ //Ask OS to do a PnP rescan
+// AMI CHANGE BEGIN.
+// Notify(SG_ULT_RP_NUM,0)
+// AMI CHANGE END.
+
+// AMI CHANGE BEGIN.
+ Return (1)
+// AMI CHANGE END.
+ }
+
+// AMI CHANGE BEGIN.
+// Method(HGOF,0,Serialized)
+ Method(SGOF,0,Serialized)
+// AMI CHANGE END.
+ {
+
+ If (LEqual(CCHK(0), 0))
+ {
+ Return ()
+ }
+
+ Store(0, ONOF) //Indicate Endpoint is in OFF state
+
+ //ACTION TODO:
+ //........................................................................................
+ //To turn off the power to the slot, all you would need to do is assert the RESET#
+ //and then take off the power using the power enable GPIO.
+ //Once the power goes off, the clock request from the slot to the PCH is also turned off,
+ //so no clocks will be going to the PCIe slot anymore.
+ //........................................................................................
+
+ // Save the Link Control register
+ Store(LCTL,ELCT)
+
+ // Save the DGPU SSID
+ Store(SVID,HVID)
+ Store(SDID,HDID)
+
+ //Force disable the x4 link
+ Store(1, LNKD)
+
+ //Wait till link is actually in disabled state
+ While(LNotEqual(LNKS,0))
+ {
+ Sleep(1)
+ }
+
+ //Power-off the dGPU card
+ SGPO(HLRS, 1) // Assert dGPU_HOLD_RST# (PERST#) {Hold the dGPU Reset}
+ SGPO(PWEN, 0) // Deassert dGPU_PWR_EN# {Power off the dGPU}
+// AMI CHANGE BEGIN.
+// Return ()
+// }
+//
+// Method(_OFF,0,Serialized)
+// {
+//
+// HGOF()
+// AMI CHANGE END.
+ //Ask OS to do a PnP rescan
+// AMI CHANGE BEGIN.
+// Notify(SG_ULT_RP_NUM,0)
+// AMI CHANGE END.
+
+// AMI CHANGE BEGIN.
+ Return (0)
+// AMI CHANGE END.
+ }
+
+ Method(EPON, 0, Serialized)
+ {
+ Store(1, ONOF) //Indicate Endpoint is in ON state
+
+ Return ()
+ }
+
+// AMI CHANGE BEGIN.
+// Method(_STA,0,Serialized)
+ Method(SGST,0,Serialized)
+// AMI CHANGE END.
+ {
+ //
+ // Check SGMode and dGPU Present Detect GPIO for SG system
+ //
+ If(And(SGMD,0x0F))
+ {
+ If(LNotEqual(SGGP,0x01))
+ {
+ Return(0x0F)
+ }
+
+ // To detect dGPU: Check Device is present and which belongs to display controllers type also.
+ If(LNotEqual(DVID,0xFFFF))
+ {
+ If(LEqual(CBCC,0x3)) // Base Class Code 03h which is referring all types of display controllers
+ {
+ Return(0x0F)
+ }
+ }
+
+ Return(0x00)
+ }
+
+ //
+ // For non-SG system check for valid Vendor Id
+ //
+ If(LNotEqual(DVID,0xFFFF))
+ {
+ Return(0x0F)
+ }
+ Return(0x00)
+ }
+
+
+ Method(_DOD,0)
+ {
+ Return (\_SB.PCI0.GFX0._DOD())
+ }
+
+
+ Device(DD01)
+ {
+ Method(_ADR,0,Serialized)
+ {
+ Return(\_SB.PCI0.GFX0.DD01._ADR())
+ }
+
+ // Device Current State.
+ Method(_DCS,0)
+ {
+
+ }
+
+ // Device Get State.
+
+ Method(_DGS,0)
+ {
+ // Return the Next State.
+ Return(\_SB.PCI0.GFX0.DD01._DGS())
+ }
+
+ // Device Set State.
+
+ // _DSS Table:
+ //
+ // BIT31 BIT30 Execution
+ // 0 0 Don't implement.
+ // 0 1 Cache change. Nothing to Implement.
+ // 1 0 Don't Implement.
+ // 1 1 Display Switch Complete. Implement.
+
+ Method(_DSS,1)
+ {
+ // Do nothing here in the OpRegion model. OEMs may choose to
+ // update internal state if necessary.
+ }
+ }
+
+ Device(DD02)
+ {
+ Method(_ADR,0,Serialized)
+ {
+ Return(\_SB.PCI0.GFX0.DD02._ADR())
+ }
+
+ // Device Current State.
+
+ Method(_DCS,0)
+ {
+ // Get the Current Display State.
+ Return(\_SB.PCI0.GFX0.DD02._DCS())
+ }
+
+ // Device Get State.
+
+ Method(_DGS,0)
+ {
+ // Return the Next State.
+ Return(\_SB.PCI0.GFX0.DD02._DGS())
+ }
+
+ // Device Set State.
+
+ Method(_DSS,1)
+ {
+ // Do nothing here in the OpRegion model. OEMs may choose to
+ // update internal state if necessary.
+ }
+
+/*
+ Method(_DDC,1)
+ {
+ If(Lor(LEqual(\_SB.PCI0.GFX0.PHED,1),LEqual(\_SB.PCI0.GFX0.PHED,2)))
+ {
+ Name(DDC2,Buffer (256) {0x0})
+ Store(\_SB.PCI0.GFX0.BDDC,DDC2)
+ Return(DDC2)
+ }
+ Return(Buffer(256){0x0})
+ }
+*/
+ Method(_BCL,0)
+ {
+ Return(\_SB.PCI0.GFX0.DD02._BCL())
+ }
+
+ Method(_BQC,0)
+ {
+ Return(\_SB.PCI0.GFX0.DD02._BQC())
+ }
+
+ Method(_BCM,1)
+ {
+ Return(\_SB.PCI0.GFX0.DD02._BCM(Arg0))
+ }
+
+ }
+
+ Device(DD03)
+ {
+ Method(_ADR,0,Serialized)
+ {
+ Return(\_SB.PCI0.GFX0.DD03._ADR())
+ }
+
+ // Device Current State.
+
+ Method(_DCS,0)
+ {
+ // Get the Current Display State.
+ }
+
+ // Device Get State.
+
+ Method(_DGS,0)
+ {
+ // Return the Next State.
+ Return(\_SB.PCI0.GFX0.DD03._DGS())
+ }
+
+ // Device Set State.
+
+ Method(_DSS,1)
+ {
+ // Do nothing here in the OpRegion model. OEMs may choose to
+ // update internal state if necessary.
+ }
+ }
+
+ Device(DD04)
+ {
+ Method(_ADR,0,Serialized)
+ {
+ Return(\_SB.PCI0.GFX0.DD04._ADR())
+ }
+
+ // Device Current State.
+
+ Method(_DCS,0)
+ {
+ // Get the Current Display State.
+ }
+
+ // Device Get State.
+
+ Method(_DGS,0)
+ {
+ // Return the Next State.
+ Return(\_SB.PCI0.GFX0.DD04._DGS())
+ }
+
+ // Device Set State.
+
+ Method(_DSS,1)
+ {
+ // Do nothing here in the OpRegion model. OEMs may choose to
+ // update internal state if necessary.
+ }
+
+ }
+
+ Device(DD05)
+ {
+ Method(_ADR,0,Serialized)
+ {
+ Return(\_SB.PCI0.GFX0.DD05._ADR())
+ }
+
+ // Device Current State.
+
+ Method(_DCS,0)
+ {
+ // Get the Current Display State.
+ }
+
+ // Device Get State.
+
+ Method(_DGS,0)
+ {
+ // Return the Next State.
+ Return(\_SB.PCI0.GFX0.DD05._DGS())
+ }
+
+ // Device Set State.
+
+ Method(_DSS,1)
+ {
+ // Do nothing here in the OpRegion model. OEMs may choose to
+ // update internal state if necessary.
+ }
+ }
+
+ Device(DD06)
+ {
+ Method(_ADR,0,Serialized)
+ {
+ Return(\_SB.PCI0.GFX0.DD06._ADR())
+ }
+
+ // Device Current State.
+
+ Method(_DCS,0)
+ {
+ // Get the Current Display State.
+ }
+
+ // Device Get State.
+
+ Method(_DGS,0)
+ {
+ // Return the Next State.
+ Return(\_SB.PCI0.GFX0.DD06._DGS())
+ }
+
+ // Device Set State.
+
+ Method(_DSS,1)
+ {
+ // Do nothing here in the OpRegion model. OEMs may choose to
+ // update internal state if necessary.
+ }
+ }
+
+ Device(DD07)
+ {
+ Method(_ADR,0,Serialized)
+ {
+ Return(\_SB.PCI0.GFX0.DD07._ADR())
+ }
+
+ // Device Current State.
+
+ Method(_DCS,0)
+ {
+ // Get the Current Display State.
+ }
+
+ // Device Get State.
+
+ Method(_DGS,0)
+ {
+ // Return the Next State.
+ Return(\_SB.PCI0.GFX0.DD07._DGS())
+ }
+
+ // Device Set State.
+
+ Method(_DSS,1)
+ {
+ // Do nothing here in the OpRegion model. OEMs may choose to
+ // update internal state if necessary.
+ }
+ }
+
+ Device(DD08)
+ {
+ Method(_ADR,0,Serialized)
+ {
+ Return(\_SB.PCI0.GFX0.DD08._ADR())
+ }
+
+ // Device Current State.
+
+ Method(_DCS,0)
+ {
+ // Get the Current Display State.
+ }
+
+ // Device Get State.
+
+ Method(_DGS,0)
+ {
+ // Return the Next State.
+ Return(\_SB.PCI0.GFX0.DD08._DGS())
+ }
+
+ // Device Set State.
+
+ Method(_DSS,1)
+ {
+ // Do nothing here in the OpRegion model. OEMs may choose to
+ // update internal state if necessary.
+ }
+ }
+
+
+ // GPIO Read
+ // Arg0 = GPIO No + GPIO active info. {BIT7 => (1:Active, 0: Not active), BIT6:0 => GPIO No}
+ Method (SGPI,1,Serialized)
+ {
+ If(And(SGMD,0x0F))
+ {
+ If(LEqual(SGGP,0x01))
+ {
+ ShiftRight (Arg0, 7, Local1) //GPIO active info
+ And(Arg0, 0x7F, Arg0) //GPIO No
+
+ // Read the GPIO [GPI_LVL]
+ // Arg0 - GPIO Pin number to read
+ If(LLessEqual(Arg0, 94)){
+ Store( Add(Add(\GBAS,0x100) , Multiply(Arg0,0x08)),Local0 )
+ OperationRegion(LGPI, SystemIo, Local0, 8)
+ Field(LGPI, ByteAcc, NoLock, Preserve) {
+ Offset(0x0),
+ , 30,
+ TEMP, 1
+ }
+
+ Store(TEMP, Local2)
+ }
+
+ //
+ // Check if Active Low
+ //
+ If (LEqual(Local1,0))
+ {
+ Not(Local2, Local2)
+ }
+
+ Return(And(Local2,0x01))
+ }
+ }
+
+ Return(0)
+ }
+
+
+ // GPIO Write
+ // Arg0 = GPIO No + GPIO active info. {BIT7 => (1:Active, 0: Not active), BIT6:0 => GPIO No}
+ // Arg1 = Value (0/1)
+ Method (SGPO,2,Serialized)
+ {
+ If(And(SGMD,0x0F))
+ {
+ If(LEqual(SGGP,0x01))
+ {
+ ShiftRight (Arg0, 7, Local1) //GPIO active info
+ And(Arg0, 0x7F, Arg0) //GPIO No
+
+ //
+ // Check if Active Low
+ //
+ If (LEqual(Local1,0))
+ {
+ Not(Arg1, Arg1)
+ }
+
+ And (Arg1, 0x01, Arg1)
+
+ // Program the GPIO [GPO_LVL]
+ // Arg0 - GPIO Pin number to write
+ // Arg1 - Value to be written
+ If(LLessEqual(Arg0, 94)){
+ Store( Add(Add(\GBAS,0x100) , Multiply(Arg0,0x08)),Local0 )
+ OperationRegion(LGPI, SystemIo, Local0, 8)
+ Field(LGPI, ByteAcc, NoLock, Preserve) {
+ Offset(0x0),
+ , 31,
+ TEMP, 1
+ }
+
+ Store(Arg1,TEMP)
+ }
+ }
+ }
+ }
+
+ //
+ // Name: CCHK
+ // Description: Function to check whether _ON/_OFF sequence is allowed to execute for the given RP05 controller or not
+ // Input: Arg0 -> 0 means _OFF sequence, 1 means _ON sequence
+ // Return: 0 - Don't execute the flow, 1 - Execute the flow
+ //
+ Method(CCHK,1)
+ {
+
+ //Check for RP05 controller presence
+ If(LEqual(PVID, IVID))
+ {
+
+ Return(0)
+ }
+
+ //If Endpoint is not present[already disabled] before executing _OFF then don't call the _OFF method
+ //If Endpoint is present[already enabled] before executing _ON then don't call the _ON method
+ If(LEqual(Arg0, 0))
+ {
+ //_OFF sequence condition check
+ If(LEqual(ONOF, 0))
+ {
+
+ Return(0)
+ }
+ }
+ ElseIf(LEqual(Arg0, 1))
+ {
+ //_ON sequence condition check
+ If(LEqual(ONOF, 1))
+ {
+
+ Return(0)
+ }
+ }
+
+
+ Return(1)
+ } // End of Method(CCHK,1)
+
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Pch/SgSsdtPch.asl b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Pch/SgSsdtPch.asl
new file mode 100644
index 0000000..e65777c
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Pch/SgSsdtPch.asl
@@ -0,0 +1,43 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - SG Reference Code *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+DefinitionBlock (
+ "Sg.aml",
+ "SSDT",
+ 1,
+ "SgRef",
+ "SgPch",
+ 0x1000
+ )
+{
+ External(P8XH, MethodObj)
+ External(GPRW, MethodObj)
+ //AMI override begin
+ //Include("SgDgpuPch.ASL")
+ #include <SgDgpuPch.ASL>
+ //AMI override end
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Peg/SgAcpiTables.inf b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Peg/SgAcpiTables.inf
new file mode 100644
index 0000000..0aaad00
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Peg/SgAcpiTables.inf
@@ -0,0 +1,69 @@
+## @file
+# Component description file for the ACPI tables
+#
+#@copyright
+# Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains an 'Intel Peripheral Driver' and uniquely
+# identified as "Intel Reference Module" and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+
+
+[defines]
+BASE_NAME = SgAcpiTables
+FILE_GUID = CACB3817-81E6-497e-87FF-C8FA8F24EC28
+COMPONENT_TYPE = ACPITABLE
+FFS_EXT = .ffs
+
+[sources.common]
+ SgSsdt.ASL
+
+[libraries.common]
+
+[includes.common]
+ .
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Include
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/SampleCode/Include
+
+#
+# Edk II Glue Library, some hearder are included by R9 header so have to include
+#
+
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Framework
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[nmake.common]
diff --git a/ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Peg/SgAcpiTablesPeg.cif b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Peg/SgAcpiTablesPeg.cif
new file mode 100644
index 0000000..85524cd
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Peg/SgAcpiTablesPeg.cif
@@ -0,0 +1,12 @@
+<component>
+ name = "SgAcpiTablesPeg"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\SystemAgent\AcpiTables\SwitchableGraphics\Peg\"
+ RefName = "SgAcpiTablesPeg"
+[files]
+"SgAcpiTablesPeg.sdl"
+"SgAcpiTablesPeg.mak"
+"SgAcpiTables.inf"
+"SgDgpu.asl"
+"SgSsdt.asl"
+<endComponent>
diff --git a/ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Peg/SgAcpiTablesPeg.mak b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Peg/SgAcpiTablesPeg.mak
new file mode 100644
index 0000000..e67f4a0
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Peg/SgAcpiTablesPeg.mak
@@ -0,0 +1,63 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+#<AMI_FHDR_START>
+#
+# Name: SgAcpiTables.mak
+#
+# Description: MAK file for the ModulePart:SgAcpiTables
+#
+#
+#<AMI_FHDR_END>
+#*************************************************************************
+EDK: SGPEGASL
+
+SGPEGASL: $(BUILD_DIR)\SGACPIPEG.ffs
+
+ALLSGPEGSEC = $(BUILD_DIR)\SGACPIPEG.sec
+
+!IF "$(ACPIPLATFORM_ASL_COMPILER)"==""
+!ERROR It is an invalid path, please check your ASL compiler path.
+!ENDIF
+
+IASL = $(ACPIPLATFORM_ASL_COMPILER)
+
+#-----------------------------------------------------------------------#
+# Process SG asl files
+#-----------------------------------------------------------------------#
+
+$(BUILD_DIR)\SgSsdt.asl : $(SGACPIPEG_DIR)\SgSsdt.ASL \
+ $(SGACPIPEG_DIR)\SgDgpu.ASL
+ $(CP) /I$(SGACPIPEG_DIR) /C $(SGACPIPEG_DIR)\$(@F) > $@
+# include the token.h if needed to check for SDL flags
+# /FItoken.h
+
+SGAcpiTablesPeg_Includes = \
+ $(SGACPIPEG_DIR)\
+
+$(BUILD_DIR)\SgSsdt.aml: $(BUILD_DIR)\SgSsdt.asl
+ $(SILENT)$(IASL) -I $(SGAcpiTablesPeg_Includes) -p $@ $**
+
+$(ALLSGPEGSEC): $(BUILD_DIR)\SgSsdt.aml
+ $(GENSECTION) -I $** -O $@ -S EFI_SECTION_RAW
+
+$(BUILD_DIR)\SGACPIPEG.ffs: $(ALLSGPEGSEC) $(SGACPIPEG_DIR)\SgAcpiTablesPeg.mak
+ $(MAKE) /f Core\FFS.mak \
+ BUILD_DIR=$(BUILD_DIR) \
+ GUID=CACB3817-81E6-497e-87FF-C8FA8F24EC28\
+ TYPE=EFI_FV_FILETYPE_FREEFORM \
+ FFS_CHECKSUM=1\
+ RAWFILE=$(ALLSGPEGSEC) FFSFILE=$(BUILD_DIR)\SGACPIPEG.ffs COMPRESS=0 NAME=SGACPIPEG
+
diff --git a/ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Peg/SgAcpiTablesPeg.sdl b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Peg/SgAcpiTablesPeg.sdl
new file mode 100644
index 0000000..1f2c571
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Peg/SgAcpiTablesPeg.sdl
@@ -0,0 +1,25 @@
+TOKEN
+ Name = "SgAcpiTablesPeg_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable SgAcpiTablesPeg support in Project"
+ Token = "SwitchableGraphics_SUPPORT" "=" "1"
+End
+
+MODULE
+ Help = "Includes SgAcpiTablesPeg.mak to Project"
+ File = "SgAcpiTablesPeg.mak"
+End
+
+PATH
+ Name = "SGACPIPEG_DIR"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\SGACPIPEG.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Peg/SgDgpu.asl b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Peg/SgDgpu.asl
new file mode 100644
index 0000000..1e63dc4
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Peg/SgDgpu.asl
@@ -0,0 +1,1693 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - SG Reference Code *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 2010 - 2013 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+External(\_SB.PCI0.GFX0._DOD, MethodObj)
+External(\_SB.PCI0.GFX0.DD01._ADR, MethodObj)
+External(\_SB.PCI0.GFX0.DD02._ADR, MethodObj)
+External(\_SB.PCI0.GFX0.DD03._ADR, MethodObj)
+External(\_SB.PCI0.GFX0.DD04._ADR, MethodObj)
+External(\_SB.PCI0.GFX0.DD05._ADR, MethodObj)
+External(\_SB.PCI0.GFX0.DD06._ADR, MethodObj)
+External(\_SB.PCI0.GFX0.DD07._ADR, MethodObj)
+External(\_SB.PCI0.GFX0.DD08._ADR, MethodObj)
+
+External(\_SB.PCI0.GFX0.DD01._DGS, MethodObj)
+External(\_SB.PCI0.GFX0.DD02._DGS, MethodObj)
+External(\_SB.PCI0.GFX0.DD03._DGS, MethodObj)
+External(\_SB.PCI0.GFX0.DD04._DGS, MethodObj)
+External(\_SB.PCI0.GFX0.DD05._DGS, MethodObj)
+External(\_SB.PCI0.GFX0.DD06._DGS, MethodObj)
+External(\_SB.PCI0.GFX0.DD07._DGS, MethodObj)
+External(\_SB.PCI0.GFX0.DD08._DGS, MethodObj)
+
+External(\_SB.PCI0.GFX0.DD02._DCS, MethodObj)
+
+External(\_SB.PCI0.GFX0.DD02._BCL, MethodObj)
+External(\_SB.PCI0.GFX0.DD02._BQC, MethodObj)
+External(\_SB.PCI0.GFX0.DD02._BCM, MethodObj)
+External(\_SB.PCI0.PEG0, DeviceObj)
+External(\_SB.PCI0.PEG0.PEGP, DeviceObj)
+External(\_SB.PCI0.PEG0.PEGP._ADR)
+External(\EECP)
+External(\XBAS)
+External(\GBAS)
+External(\HLRS)
+External(\PWEN)
+External(\PWOK)
+External(\SGMD)
+External(\SGGP)
+External(PNHM, IntObj)
+External(P0UB, IntObj)
+External(PCSL, IntObj)
+External(SC7A, IntObj)
+//AMI override begin
+
+External(\EBAS)
+External(\HYSS)
+//AMI override begin end
+Scope(\_SB.PCI0.PEG0)
+//AMI override begin
+{
+ OperationRegion (MSID, SystemMemory, EBAS, 0x50)
+ Field(MSID, DWordAcc, Lock, Preserve)
+ {
+ VEID, 16,
+ Offset(0x40),
+ NVID, 32,
+ offset(0x4c),
+ ATID, 32,
+ }
+//AMI override begin end
+ // Define a Memory Region that will allow access to the PEG root port
+ // Register Block.
+ //
+ //OperationRegion(RPCI,PCI_Config,0x00,0xF0)
+ //Field(RPCI,DWordAcc,Lock,Preserve)
+ //{
+ //}
+
+ OperationRegion(RPCX,SystemMemory,Add(\XBAS,0x8000),0x1000)
+ Field(RPCX,ByteAcc,NoLock,Preserve)
+ {
+ Offset(0),
+ PVID, 16,
+ PDID, 16,
+// AMI_OVERRIDE >>>
+ Offset(0x4),
+ CMDR, 8,
+ Offset(0x84),
+ D0ST, 2,
+// AMI_OVERRIDE >>>
+ Offset(0xAC), // LCAP - Link Capabilities Register
+ , 4,
+ CMLW, 6, // 9:4, Max Link Width
+ Offset(0xB0), // LCTL - Link Control Register
+ ASPM, 2, // 1:0, ASPM //Not referenced in code
+ , 2,
+ LNKD, 1, // Link Disable
+ Offset(0x11A),
+ , 1,
+ VCNP, 1, //VC0RSTS.VC0NP
+ Offset(0x214),
+ , 16,
+ LNKS, 4, //PEGSTS.LKS
+ Offset(0x504),
+ , 16,
+ PCFG, 2, //FUSESCMN.PEG1CFGSEL
+ Offset(0x508),
+ TREN, 1, //TRNEN.TREN
+ Offset(0x91C),
+ , 31,
+ BSP1, 1,
+ Offset(0x93C),
+ , 31,
+ BSP2, 1,
+ Offset(0x95C),
+ , 31,
+ BSP3, 1,
+ Offset(0x97C),
+ , 31,
+ BSP4, 1,
+ Offset(0x99C),
+ , 31,
+ BSP5, 1,
+ Offset(0x9BC),
+ , 31,
+ BSP6, 1,
+ Offset(0x9DC),
+ , 31,
+ BSP7, 1,
+ Offset(0x9FC),
+ , 31,
+ BSP8, 1,
+ Offset(0xC20),
+ , 4,
+ AFES, 2, //AFEOVR.RXSQDETOVR
+ Offset(0xD0C),
+ , 20,
+ LREV, 1, //PEGTST.LANEREVSTS
+ }
+
+ Method(RBP0,1) // ReadBytePEG0
+ {
+ // Function to read pcie byte of Peg0 [0x00/0x01/0x00]
+ //
+ // Arg0 : The offset of pcie config space to be read
+ //
+ Store( Add(Add(\XBAS,0x8000), Arg0) ,Local7)
+ OperationRegion(PCI0, SystemMemory, Local7, 1)
+ Field(PCI0, ByteAcc,NoLock,Preserve)
+ {
+ TEMP, 8
+ }
+ Return(TEMP)
+ } // End of Method(RBP0,1)
+
+ Method(WBP0,2) // WriteBytePEG0
+ {
+ // Function to write pcie byte of Peg0 [0x00/0x01/0x00]
+ //
+ // Arg0 : The offset of pcie config space to be written
+ // Arg1 : Value to be written
+ //
+ Store( Add(Add(\XBAS,0x8000), Arg0) ,Local7)
+ OperationRegion(PCI0, SystemMemory, Local7, 1)
+ Field(PCI0, ByteAcc,NoLock,Preserve)
+ {
+ TEMP, 8
+ }
+ Store(Arg1,TEMP)
+ Return(TEMP)
+ } // End of Method(WBP0,2)
+
+// Method(BSPR,2)
+// {
+ // Function to set/reset powerdown the bundles
+ //
+ // Arg0 : The zero based bundle number
+ // Arg1 : Value to be written
+ //
+// Store( Add(Add(Add(\XBAS,0x8000), 0x91C) , Multiply(Arg0,0x20)),Local7)
+// OperationRegion(PCI0, SystemMemory, Local7, 4)
+// Field(PCI0, DWordAcc,NoLock,Preserve)
+// {
+// Offset(0x0),
+// ,31,
+// TEMP, 1
+// }
+// Store(Arg1,TEMP)
+// } // End of Method(BSPR,2)
+
+ Method(C7OK,1)
+ {
+ // Function to set/reset C7 Allowed
+ //
+ // Arg0 : Value to be written
+ //
+
+ //
+ // Memory window to the Host Bus registers
+ //
+ OperationRegion(MWHB,SystemMemory,\XBAS,0x1000)
+ Field(MWHB,DWordAcc,NoLock,Preserve)
+ {
+ Offset(0x48), // MCHBAR (0:0:0:48)
+ MHEN, 1, // Enable
+ , 14,
+ MHBR, 17, // MCHBAR [31:15]
+ }
+
+ //
+ // Memory window to the registers starting at MCHBAR+5000h.
+ //
+ OperationRegion (MBAR, SystemMemory, Add(ShiftLeft(MHBR,15),0x5000), 0x1000)
+ Field (MBAR, ByteAcc, NoLock, Preserve)
+ {
+ Offset (0xDA8), // BIOS_RESET_CPL (MCHBAR+0x5da8)
+ , 2, //
+ C7AD, 1, // C7 Allowed [2:2]
+ }
+
+ Store(Arg0,C7AD)
+ } // End of Method(C7OK,1)
+
+ //-----------------------------------------
+ // Runtime Device Power Management - Begin
+ //-----------------------------------------
+ // Note:
+ // Runtime Device Power Management can be achieved by using _PRx or _PSx or both
+
+ //
+ // Name: PG00
+ // Description: Declare a PowerResource object for PEG0 slot device
+ //
+ PowerResource(PG00, 0, 0)
+ {
+ Name(_STA, One)
+
+ Method(_ON, 0, Serialized)
+ {
+ //
+ // SA:InternalOnlyBegin
+ //
+ Store("\_SB.PCI0.PEG0.PG00._ON", Debug)
+ //
+ // SA:InternalOnlyEnd
+ //
+
+// AMI_OVERRIDE >>>
+// \_SB.PCI0.PEG0.PEGP._ON()
+ \_SB.PCI0.PEG0.PEGP.SGON()
+ Store(0x07, CMDR)
+ Store(0, D0ST)
+
+ If(LEqual(VEID,0x10DE))
+ {
+ Store(HYSS, NVID)
+ }
+ If(LEqual(VEID,0x1002))
+ {
+ Store(HYSS, ATID)
+ }
+// AMI_OVERRIDE >>>
+ Store(One, _STA)
+ }
+
+ Method(_OFF, 0, Serialized)
+ {
+ //
+ // SA:InternalOnlyBegin
+ //
+ Store("\_SB.PCI0.PEG0.PG00._OFF", Debug)
+ //
+ // SA:InternalOnlyEnd
+ //
+// AMI_OVERRIDE >>>
+// \_SB.PCI0.PEG0.PEGP.HGOF()
+ \_SB.PCI0.PEG0.PEGP.SGOF()
+// AMI_OVERRIDE >>>
+ Store(Zero, _STA)
+ }
+ } //End of PowerResource(PG00, 0, 0)
+
+ Name(_PR0,Package(){PG00})
+ Name(_PR2,Package(){PG00})
+ Name(_PR3,Package(){PG00})
+
+// //
+// // Name: _PS0
+// // Description: D0 Method for PEG0 slot device
+// // Input: Nothing
+// // Return: Nothing
+// //
+// Method(_PS0, 0, Serialized)
+// {
+// //
+// // SA:InternalOnlyBegin
+// //
+// Store("\_SB.PCI0.PEG0._PS0", Debug)
+// //
+// // SA:InternalOnlyEnd
+// //
+//
+// \_SB.PCI0.PEG0.PEGP.HGON()
+// }
+//
+// //
+// // Name: _PS3
+// // Description: D3 Method for PEG0 slot device
+// // Input: Nothing
+// // Return: Nothing
+// //
+// Method(_PS3, 0, Serialized)
+// {
+// //
+// // SA:InternalOnlyBegin
+// //
+// Store("\_SB.PCI0.PEG0._PS3", Debug)
+// //
+// // SA:InternalOnlyEnd
+// //
+//
+// \_SB.PCI0.PEG0.PEGP.HGOF()
+// }
+
+ Method(_S0W, 0)
+ {
+ Return(4) //D3cold is supported
+ }
+
+ //-----------------------------------------
+ // Runtime Device Power Management - End
+ //-----------------------------------------
+
+ Device(PEGA) { // P.E.G. Device D0F1
+ Name(_ADR, 0x00000001)
+
+ OperationRegion(ACAP, PCI_Config, \EECP,0x14)
+ Field(ACAP,DWordAcc, NoLock,Preserve)
+ {
+ Offset(0x10),
+ LCT1, 16, // Link Control register
+ }
+ Method(_PRW, 0) { Return(GPRW(0x09, 4)) } // can wakeup from S4 state
+ } // end "P.E.G. Device D0F1"
+}
+
+Scope(\_SB.PCI0.PEG0.PEGP)
+{
+ Name (ONOF, 0x1) //Endpoint On-Off flag status. Assume Endpoint is ON by default {1-ON, 0-OFF}
+ Name (IVID, 0xFFFF) //Invalid Vendor ID
+ Name (TCNT, 0)
+ Name (LDLY, 100) //100 ms
+ Name (ELCT, 0x00000000)
+ Name (HVID, 0x0000)
+ Name (HDID, 0x0000)
+ Name (FBDL, 0x0) //BndlPwrdnFirst
+ Name (MBDL, 0x0) //MaxBndlPwrdnCount
+ Name (CBDL, 0x0) //BndlPwrdnCount
+ Name (HSTR, 0x0) //HwStrap
+ Name (UULN, 0x0) //UnusedLanes
+ Name (INDX, 0x0)
+ Name (POFF, 0x0)
+ Name (PLEN, 0x0)
+ Name (PDAT, 0x0)
+ Name (WLSB, 0x0)
+ Name (WMSB, 0x0)
+ Name (DMLW, 0x0)
+ Name (DAT0, Buffer() {
+ //Offset Length Data
+
+ //Save-Restore Any Controller fields
+ 0xD8,0x0D, 0x4, 0x00,0x00,0x00,0x00,
+ 0x00,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0x04,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0x08,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0x0C,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0x10,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0x0C,0x08, 0x4, 0x00,0x00,0x00,0x00,
+ 0x20,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0x24,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0x28,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0x2C,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0x30,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0x2C,0x08, 0x4, 0x00,0x00,0x00,0x00,
+ 0x40,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0x44,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0x48,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0x4C,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0x50,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0x4C,0x08, 0x4, 0x00,0x00,0x00,0x00,
+ 0x60,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0x64,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0x68,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0x6C,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0x70,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0x6C,0x08, 0x4, 0x00,0x00,0x00,0x00,
+ 0x80,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0x84,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0x88,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0x8C,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0x90,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0x8C,0x08, 0x4, 0x00,0x00,0x00,0x00,
+ 0xA0,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0xA4,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0xA8,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0xAC,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0xB0,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0xAC,0x08, 0x4, 0x00,0x00,0x00,0x00,
+ 0xC0,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0xC4,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0xC8,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0xCC,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0xD0,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0xCC,0x08, 0x4, 0x00,0x00,0x00,0x00,
+ 0xE0,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0xE4,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0xE8,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0xEC,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0xF0,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0xEC,0x08, 0x4, 0x00,0x00,0x00,0x00,
+ 0x30,0x0C, 0x4, 0x00,0x00,0x00,0x00,
+ 0x00,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0x04,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0x08,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0x0C,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0xA0,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0xA4,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0xA8,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0xAC,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0xB0,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0xB4,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0xB8,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0xBC,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0xC0,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0xC4,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0xC8,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0xCC,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0xD0,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0xD4,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0xD8,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0xDC,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0xE0,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0xE4,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0xE8,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0xEC,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0xF0,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0xF4,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0xF8,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0xFC,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0x10,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0x14,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0x18,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0x1C,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0x20,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0x24,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0x28,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0x2C,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0x30,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0x34,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0x38,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0x3C,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0x40,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0x44,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0x48,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0x4C,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0x50,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0x54,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0x58,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0x5C,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0x60,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0x64,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0x68,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0x6C,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0x70,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0x74,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0x78,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0x7C,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0x80,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0x84,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0x88,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0x8C,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0x90,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0x94,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0x98,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0x9C,0x0A, 0x4, 0x00,0x00,0x00,0x00,
+ 0x18,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0x38,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0x58,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0x78,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0x98,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0xB8,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0xD8,0x09, 0x4, 0x00,0x00,0x00,0x00,
+ 0xF8,0x09, 0x4, 0x00,0x00,0x00,0x00,
+
+ //Save-Restore Appropriate Controller fields
+ 0x24,0x02, 0x4, 0x00,0x00,0x00,0x00,
+ 0xf8,0x01, 0x4, 0x00,0x00,0x00,0x00,
+ 0x60,0x02, 0x4, 0x00,0x00,0x00,0x00,
+ 0x28,0x0C, 0x4, 0x00,0x00,0x00,0x00,
+ 0x38,0x0C, 0x4, 0x00,0x00,0x00,0x00,
+ 0x14,0x0D, 0x4, 0x00,0x00,0x00,0x00,
+ 0x0C,0x00, 0x1, 0x00,
+ 0x19,0x00, 0x1, 0x00,
+ 0x1A,0x00, 0x1, 0x00,
+ 0x1C,0x00, 0x1, 0x00,
+ 0x1D,0x00, 0x1, 0x00,
+ 0x20,0x00, 0x2, 0x00,0x00,
+ 0x22,0x00, 0x2, 0x00,0x00,
+ 0x24,0x00, 0x2, 0x00,0x00,
+ 0x26,0x00, 0x2, 0x00,0x00,
+ 0x28,0x00, 0x4, 0x00,0x00,0x00,0x00,
+ 0x2C,0x00, 0x4, 0x00,0x00,0x00,0x00,
+ 0x3C,0x00, 0x1, 0x00,
+ 0x3D,0x00, 0x1, 0x00,
+ 0x3E,0x00, 0x2, 0x00,0x00,
+ 0x84,0x00, 0x4, 0x00,0x00,0x00,0x00,
+ 0x8C,0x00, 0x4, 0x00,0x00,0x00,0x00,
+ 0x92,0x00, 0x2, 0x00,0x00,
+ 0x94,0x00, 0x4, 0x00,0x00,0x00,0x00,
+ 0x98,0x00, 0x2, 0x00,0x00,
+ 0xA2,0x00, 0x2, 0x00,0x00,
+ 0xA8,0x00, 0x2, 0x00,0x00,
+ 0xAC,0x00, 0x4, 0x00,0x00,0x00,0x00,
+ 0xB0,0x00, 0x2, 0x00,0x00,
+ 0xB4,0x00, 0x4, 0x00,0x00,0x00,0x00,
+ 0xBC,0x00, 0x2, 0x00,0x00,
+ 0xC8,0x00, 0x2, 0x00,0x00,
+ 0xD0,0x00, 0x2, 0x00,0x00,
+ 0xEC,0x00, 0x4, 0x00,0x00,0x00,0x00,
+ 0x14,0x01, 0x4, 0x00,0x00,0x00,0x00,
+ 0x44,0x01, 0x4, 0x00,0x00,0x00,0x00,
+ 0x50,0x01, 0x4, 0x00,0x00,0x00,0x00,
+ 0x58,0x01, 0x4, 0x00,0x00,0x00,0x00,
+ 0x5C,0x01, 0x4, 0x00,0x00,0x00,0x00,
+ 0xFC,0x01, 0x4, 0x00,0x00,0x00,0x00,
+ 0x00,0x02, 0x4, 0x00,0x00,0x00,0x00,
+ 0x04,0x02, 0x4, 0x00,0x00,0x00,0x00,
+ 0x08,0x02, 0x4, 0x00,0x00,0x00,0x00,
+ 0x28,0x02, 0x4, 0x00,0x00,0x00,0x00,
+ 0x2C,0x02, 0x4, 0x00,0x00,0x00,0x00,
+ 0x38,0x02, 0x4, 0x00,0x00,0x00,0x00,
+ 0x40,0x02, 0x4, 0x00,0x00,0x00,0x00,
+ 0x44,0x02, 0x4, 0x00,0x00,0x00,0x00,
+ 0x50,0x02, 0x4, 0x00,0x00,0x00,0x00,
+ 0x58,0x02, 0x4, 0x00,0x00,0x00,0x00,
+ 0x5C,0x02, 0x4, 0x00,0x00,0x00,0x00,
+ 0xD0,0x0C, 0x4, 0x00,0x00,0x00,0x00,
+ 0x34,0x0D, 0x4, 0x00,0x00,0x00,0x00,
+ 0xF4,0x00, 0x4, 0x00,0x00,0x00,0x00,
+ 0xA0,0x0D, 0x4, 0x00,0x00,0x00,0x00,
+ 0xA4,0x0D, 0x4, 0x00,0x00,0x00,0x00,
+ 0xA8,0x0D, 0x4, 0x00,0x00,0x00,0x00,
+ 0xAC,0x0D, 0x4, 0x00,0x00,0x00,0x00,
+ 0xB0,0x0D, 0x4, 0x00,0x00,0x00,0x00,
+ 0xB4,0x0D, 0x4, 0x00,0x00,0x00,0x00,
+ 0xB8,0x0D, 0x4, 0x00,0x00,0x00,0x00,
+ 0xBC,0x0D, 0x4, 0x00,0x00,0x00,0x00,
+ 0xCC,0x01, 0x4, 0x00,0x00,0x00,0x00,
+ 0x04,0x00, 0x2, 0x00,0x00,
+
+ //Final field
+ 0xFF,0xFF, 0x4, 0xFF,0xFF,0xFF,0xFF //Last data
+ })
+
+ Name (DAT1, Buffer() {
+ //Offset Length Data
+
+ //Save-Restore Any Controller fields
+ 0x06,0x00, 0x2, 0xFF,0xFF,
+ 0x1E,0x00, 0x2, 0xFF,0xFF,
+ 0xAA,0x00, 0x2, 0xFF,0xFF,
+ 0xC0,0x00, 0x4, 0xFF,0xFF,0xFF,0xFF,
+ 0xD2,0x00, 0x2, 0xFF,0xFF,
+ 0xC4,0x01, 0x4, 0xFF,0xFF,0xFF,0xFF,
+ 0xD0,0x01, 0x4, 0xFF,0xFF,0xFF,0xFF,
+ 0xF0,0x01, 0x4, 0xFF,0xFF,0xFF,0xFF,
+ 0x9C,0x0D, 0x4, 0xFF,0xFF,0xFF,0xFF,
+ 0xB2,0x00, 0x2, 0xFF,0xFF,
+
+ //Final field
+ 0xFF,0xFF, 0x4, 0xFF,0xFF,0xFF,0xFF //Last data
+ })
+
+ OperationRegion (PCIS, PCI_Config, 0x00, 0xF0)
+ Field(PCIS, DWordAcc, Lock, Preserve)
+ {
+ Offset(0x0),
+ DVID, 16,
+ Offset(0x2C),
+ SVID, 16,
+ SDID, 16,
+ Offset(0x4C),
+ WVID, 16,
+ WDID, 16,
+ }
+
+ OperationRegion( GPR, SystemIO, \GBAS, 0x60 )
+ Field( GPR, ByteAcc, Lock, Preserve )
+ {
+ Offset(0x0C), // GPIO, Level, Bank 0
+ LVL0, 32,
+ Offset(0x38), // GPIO, Level, Bank 1
+ LVL1, 32,
+ Offset(0x48), // GPIO, Level, Bank 2
+ LVL2, 32,
+ }
+
+ OperationRegion(PCAP, PCI_Config, \EECP,0x14)
+ Field(PCAP,DWordAcc, NoLock,Preserve)
+ {
+ Offset(0x0C), // Link Capabilities Register
+ , 4,
+ EMLW, 6, // 9:4, Max Link Width
+ Offset(0x10),
+ LCTL, 16, // Link Control register
+ }
+
+ Method (_INI)
+ {
+ Store (0x0, \_SB.PCI0.PEG0.PEGP._ADR)
+ }
+
+ //GetMaxBundles
+ Method(GMXB,0)
+ {
+ Store (PCFG, HSTR) //HwStrap
+ If (LEqual(HSTR, 3)) //SA_PEG_x16_x0_x0
+ {
+ Store (8, Local0)
+ }
+ Else
+ {
+ Store (4, Local0)
+ }
+
+ Return(Local0)
+ }
+
+ //PowerUpAllBundles
+ Method(PUAB,0)
+ {
+ Store (0, FBDL) //BndlPwrdnFirst
+ Store (0, CBDL) //BndlPwrdnCount
+ Store (PCFG, HSTR) //HwStrap
+ If (LEqual(HSTR, 3)) //SA_PEG_x16_x0_x0
+ {
+ Store (0, FBDL)
+ Store (8, CBDL)
+ }
+ Else
+ {
+ If(LEqual(LREV,0))
+ {
+ Store (0, FBDL)
+ Store (4, CBDL)
+ }
+ Else
+ {
+ Store (4, FBDL)
+ Store (4, CBDL)
+ }
+ }
+
+ Store (1, INDX)
+ If (LNotEqual(CBDL,0))
+ {
+ While(LLessEqual(INDX, CBDL))
+ {
+ If(LEqual(FBDL,0))
+ {
+ Store (0, BSP1)
+ }
+ If(LEqual(FBDL,1))
+ {
+ Store (0, BSP2)
+ }
+ If(LEqual(FBDL,2))
+ {
+ Store (0, BSP3)
+ }
+ If(LEqual(FBDL,3))
+ {
+ Store (0, BSP4)
+ }
+ If(LEqual(FBDL,4))
+ {
+ Store (0, BSP5)
+ }
+ If(LEqual(FBDL,5))
+ {
+ Store (0, BSP6)
+ }
+ If(LEqual(FBDL,6))
+ {
+ Store (0, BSP7)
+ }
+ If(LEqual(FBDL,7))
+ {
+ Store (0, BSP8)
+ }
+ Increment (FBDL)
+ Increment (INDX)
+ }
+ }
+ } // End of Method(PUAB,0)
+
+ // PowerDownUnusedBundles
+ // Arg0 = BndlPwrdnCount
+ Method(PDUB,1)
+ {
+ Store (0, FBDL) //BndlPwrdnFirst
+ Store (Arg0, CBDL) //BndlPwrdnCount
+ If (LEqual(CBDL,0))
+ {
+ // All lanes are used. Do nothing
+ Return
+ }
+
+ If (LEqual(HSTR, 3)) //SA_PEG_x16_x0_x0
+ {
+ If(LEqual(LREV,0))
+ {
+ Store (Subtract(8, CBDL), FBDL) //8 - (UnusedLanes / 2)
+ }
+ Else
+ {
+ Store (0, FBDL)
+ }
+ }
+ Else
+ {
+ If(LEqual(LREV,0))
+ {
+ Store (Subtract(4, CBDL), FBDL) //4 - (UnusedLanes / 2)
+ }
+ Else
+ {
+ Store (4, FBDL)
+ }
+ }
+
+ Store (1, INDX)
+ While(LLessEqual(INDX, CBDL)) //< Check that bundles need to be powered down
+ {
+ If(LEqual(FBDL,0))
+ {
+ Store (1, BSP1)
+ }
+ If(LEqual(FBDL,1))
+ {
+ Store (1, BSP2)
+ }
+ If(LEqual(FBDL,2))
+ {
+ Store (1, BSP3)
+ }
+ If(LEqual(FBDL,3))
+ {
+ Store (1, BSP4)
+ }
+ If(LEqual(FBDL,4))
+ {
+ Store (1, BSP5)
+ }
+ If(LEqual(FBDL,5))
+ {
+ Store (1, BSP6)
+ }
+ If(LEqual(FBDL,6))
+ {
+ Store (1, BSP7)
+ }
+ If(LEqual(FBDL,7))
+ {
+ Store (1, BSP8)
+ }
+ Increment (FBDL)
+ Increment (INDX)
+ }
+ } // End of Method(PDUB,0)
+
+ Method(SPP0,0)
+ {
+ Store (0, INDX)
+ While (1)
+ {
+ Store (DerefOf (Index(DAT0, INDX)), WLSB)
+ Increment (INDX) //Offset is 2 bytes long <First byte-LSB>
+ Store (DerefOf (Index(DAT0, INDX)), WMSB)
+ Increment (INDX) //Offset is 2 bytes long <Second byte-MSB>
+ Store (Or (ShiftLeft (WMSB, 8), WLSB), POFF)
+ Store (DerefOf (Index(DAT0, INDX)), PLEN)
+ Increment (INDX) //Length is 1 byte long
+
+ If(LEqual(POFF,0xFFFF))
+ {
+ Break
+ }
+
+ While (LGreater(PLEN, 0))
+ {
+ Store(RBP0(POFF), Index(DAT0, INDX))
+ Increment (INDX)
+ Increment (POFF)
+ Decrement (PLEN)
+ }
+ }
+ } // End of Method(SPP0,0)
+
+ Method(RPP0,0)
+ {
+ Store (0, INDX)
+ While (1)
+ {
+ Store (DerefOf (Index(DAT0, INDX)), WLSB)
+ Increment (INDX) //Offset is 2 bytes long <First byte-LSB>
+ Store (DerefOf (Index(DAT0, INDX)), WMSB)
+ Increment (INDX) //Offset is 2 bytes long <Second byte-MSB>
+ Store (Or (ShiftLeft (WMSB, 8), WLSB), POFF)
+ Store (DerefOf (Index(DAT0, INDX)), PLEN)
+ Increment (INDX) //Length is 1 byte long
+
+ If(LEqual(POFF,0xFFFF))
+ {
+ Break
+ }
+
+ While (LGreater(PLEN, 0))
+ {
+ WBP0(POFF, DerefOf (Index(DAT0, INDX)))
+ Increment (INDX)
+ Increment (POFF)
+ Decrement (PLEN)
+ }
+ }
+ } // End of Method(RPP0,0)
+
+ Method(CLP0,0)
+ {
+ Store (0, INDX)
+ While (1)
+ {
+ Store (DerefOf (Index(DAT1, INDX)), WLSB)
+ Increment (INDX) //Offset is 2 bytes long <First byte-LSB>
+ Store (DerefOf (Index(DAT1, INDX)), WMSB)
+ Increment (INDX) //Offset is 2 bytes long <Second byte-MSB>
+ Store (Or (ShiftLeft (WMSB, 8), WLSB), POFF)
+ Store (DerefOf (Index(DAT1, INDX)), PLEN)
+ Increment (INDX) //Length is 1 byte long
+
+ If(LEqual(POFF,0xFFFF))
+ {
+ Break
+ }
+
+ While (LGreater(PLEN, 0))
+ {
+ WBP0(POFF, DerefOf (Index(DAT1, INDX)))
+ Increment (INDX)
+ Increment (POFF)
+ Decrement (PLEN)
+ }
+ }
+ } // End of Method(CLP0,0)
+
+// AMI CHANGE BEGIN.
+ Method(SGON,0,Serialized)
+// Method(HGON,0,Serialized)
+// AMI CHANGE END.
+ {
+ //
+ // SA:InternalOnlyBegin
+ //
+ P8XH(0,0xD6)
+ P8XH(1,0x00)
+ Store("\_SB.PCI0.PEG0.PEGP.HGON", Debug)
+ //
+ // SA:InternalOnlyEnd
+ //
+
+ If (LEqual(CCHK(1), 0))
+ {
+ //
+ // SA:InternalOnlyBegin
+ //
+ P8XH(0,0xD6)
+ P8XH(1,0xC0)
+ Store("\_SB.PCI0.PEG0.PEGP.HGON is not allowed to execute ", Debug)
+ //
+ // SA:InternalOnlyEnd
+ //
+ Return ()
+ }
+
+ Store(1, ONOF) //Indicate Endpoint is in ON state
+
+ //Power on the dGPU card
+ SGPO(HLRS, 1) //Assert dGPU_HOLD_RST#
+ SGPO(PWEN, 1) //Assert dGPU_PWR_EN#
+
+// While(LNotEqual(SGPI(PWOK),1)) //Wait until dGPU_PWROK=1
+// {
+// Sleep(1)
+// }
+
+ Sleep(300) // Wait for 300ms if dGPU_PWROK has h/w issues
+
+ SGPO(HLRS, 0) //Deassert dGPU_HOLD_RST#
+ Sleep(100) // Wait for 100ms
+
+ // Software clears BIOS_RESET_CPL.C7_ALLOWED
+ If (LGreaterEqual(PCSL, 4)) //C7 or above
+ {
+ If (LEqual(SC7A, 0x01)) //Run-time C7 Allowed feature setup value = Enabled
+ {
+ C7OK(0)
+
+ // Restore the PEG0 PCIE registers
+ RPP0()
+
+ // Clear the PEG0 errors
+ CLP0()
+ }
+ }
+
+ //Program AFEOVR.RXSQDETOVR
+ //PCIe link disable for Switchable GFx
+ //Additional Power savings: Set 0:1:0 0xc20 BIT4 = 0 & BIT5 = 0
+ Store(0, AFES)
+
+ //Program BND*SPARE.BNDL_PWRDN
+ //PowerOff unused bundles for PEGs
+ //SA:RestrictedContent Ref: HSW_PCIe_HAS_1.0.docx [Table 15 - Bifurcation and reversal port and pin mappings]
+ If (LGreaterEqual(And(PNHM, 0xF), 0x3)) //(CpuSteppingId >= EnumHswC0)
+ {
+ If (LNotEqual(P0UB, 0x00))
+ {
+ //PowerUpAllBundles
+ PUAB()
+
+ //Get BndlPwrdnCount
+ If (LEqual (P0UB, 0xFF)) //AUTO
+ {
+ If (LGreater(CMLW, DMLW))
+ {
+ Subtract (CMLW, DMLW, UULN) //UnusedLanes
+ }
+ Else
+ {
+ Store (0, UULN) //UnusedLanes
+ }
+ Store (Divide(UULN,2), CBDL) //BndlPwrdnCount
+ }
+ ElseIf (LNotEqual (P0UB, 0x00)) //1...8 bundles
+ {
+ Store (P0UB, CBDL) //BndlPwrdnCount
+ }
+
+ //Get MaxBndlPwrdnCount
+ Store(GMXB(), MBDL)
+
+ If (LGreater(CBDL, MBDL))
+ {
+ Store(MBDL, CBDL)
+ }
+
+ //PowerDownUnusedBundles
+ PDUB(CBDL)
+ }
+ }
+
+// AMI CHANGE BEGIN.
+ // Enable controller initial training
+ Store(1, TREN)
+// AMI CHANGE END.
+ //Enable x16 Link
+ //This bit should already be set to 0 in the _Off method. But do it anyway.
+ Store(0,LNKD)
+//AMI_OVERRIDE -->> When runnign a long run test (S3,S4,or _on/_off) with SG on two chips platform, it may happen to BSOD 0x9F. It got different fail rate on different platform.
+ //wait until link has trained to x16. Verify
+ While(LLess(LNKS,7))
+ {
+ Sleep(1)
+ }
+//AMI_OVERRIDE --<< When runnign a long run test (S3,S4,or _on/_off) with SG on two chips platform, it may happen to BSOD 0x9F. It got different fail rate on different platform.
+
+// AMI CHANGE BEGIN.
+ // Enable controller initial training
+ //Store(1, TREN)
+// AMI CHANGE END.
+//AMI_OVERRIDE -->> When runnign a long run test (S3,S4,or _on/_off) with SG on two chips platform, it may happen to BSOD 0x9F. It got different fail rate on different platform.
+// // Wait until the VC negotiation is complete
+// Store(0, TCNT)
+// While(LLess(TCNT, LDLY))
+// {
+// If(LEqual(VCNP,0))
+// {
+// Break
+// }
+//
+// Sleep(16) //In some OS one tick is equal to 1/64 second (15.625ms)
+// Add(TCNT, 16, TCNT)
+// }
+//AMI_OVERRIDE --<< When runnign a long run test (S3,S4,or _on/_off) with SG on two chips platform, it may happen to BSOD 0x9F. It got different fail rate on different platform.
+
+ // Re-store the DGPU SSID
+ Store(HVID,WVID)
+ Store(HDID,WDID)
+
+ // Re-store the Link Control register - Common Clock Control and ASPM
+ Or(And(ELCT,0x0043),And(LCTL,0xFFBC),LCTL)
+ Or(And(ELCT,0x0043),And(\_SB.PCI0.PEG0.PEGA.LCT1,0xFFBC),\_SB.PCI0.PEG0.PEGA.LCT1)
+// AMI CHANGE BEGIN.
+// Return ()
+// }
+//
+// Method(_ON,0,Serialized)
+// {
+ //
+ // SA:InternalOnlyBegin
+ //
+ Store("\_SB.PCI0.PEG0.PEGP._ON", Debug)
+ //
+ // SA:InternalOnlyEnd
+ //
+
+// HGON()
+// AMI CHANGE END
+ //Ask OS to do a PnP rescan
+// AMI CHANGE BEGIN.
+// Notify(\_SB.PCI0.PEG0,0)
+// AMI CHANGE END.
+
+// AMI CHANGE BEGIN.
+ Return (1)
+// AMI CHANGE END.
+ }
+
+// AMI CHANGE BEGIN.
+// Method(HGOF,0,Serialized)
+ Method(SGOF,0,Serialized)
+// AMI CHANGE END.
+ {
+ //
+ // SA:InternalOnlyBegin
+ //
+ P8XH(0,0xD6)
+ P8XH(1,0x0F)
+ Store("\_SB.PCI0.PEG0.PEGP.HGOF", Debug)
+ //
+ // SA:InternalOnlyEnd
+ //
+
+ If (LEqual(CCHK(0), 0))
+ {
+ //
+ // SA:InternalOnlyBegin
+ //
+ P8XH(0,0xD6)
+ P8XH(1,0xCF)
+ Store("\_SB.PCI0.PEG0.PEGP.HGOF is not allowed to execute ", Debug)
+ //
+ // SA:InternalOnlyEnd
+ //
+ Return ()
+ }
+
+ Store(0, ONOF) //Indicate Endpoint is in OFF state
+
+ // Save the Link Control register
+ Store(LCTL,ELCT)
+
+ // Save the DGPU SSID
+ Store(SVID,HVID)
+ Store(SDID,HDID)
+
+ // Save the Endpoint Max Link Width
+ Store(EMLW,DMLW)
+
+ // Software sets BIOS_RESET_CPL.C7_ALLOWED
+ If (LGreaterEqual(PCSL, 4)) //C7 or above
+ {
+ If (LEqual(SC7A, 0x01)) //Run-time C7 Allowed feature setup value = Enabled
+ {
+ // Save the PEG0 PCIE registers
+ SPP0()
+ }
+ }
+
+ //Force disable the x16 link
+ Store(1, LNKD)
+
+ //Wait till link is actually in disabled state
+ Store(0, TCNT)
+ While(LLess(TCNT, LDLY))
+ {
+ If(LEqual(LNKS,0))
+ {
+ Break
+ }
+
+ Sleep(16) //In some OS one tick is equal to 1/64 second (15.625ms)
+ Add(TCNT, 16, TCNT)
+ }
+//AMI_OVERRIDE -->> When runnign a long run test (S3,S4,or _on/_off) with SG on two chips platform, it may happen to BSOD 0x9F. It got different fail rate on different platform.
+ While(LNotEqual(LNKS,0))
+ {
+ Sleep(1)
+ }
+//AMI_OVERRIDE --<< When runnign a long run test (S3,S4,or _on/_off) with SG on two chips platform, it may happen to BSOD 0x9F. It got different fail rate on different platform.
+
+ //Program AFEOVR.RXSQDETOVR
+ //PCIe link disable for Switchable GFx
+ //Additional Power savings: Set 0:1:0 0xc20 BIT4 = 0 & BIT5 = 1
+ Store(2, AFES)
+
+ // PowerOff all bundles for PEGs
+ // Program BND*SPARE.BNDL_PWRDN
+ // SA:RestrictedContent Ref: HSW_PCIe_HAS_1.0.docx [Table 15 - Bifurcation and reversal port and pin mappings]
+ If (LGreaterEqual(And(PNHM, 0xF), 0x3)) //(CpuSteppingId >= EnumHswC0)
+ {
+ If (LNotEqual(P0UB, 0x00))
+ {
+ //Get MaxBndlPwrdnCount
+ Store(GMXB(), MBDL)
+
+ //PowerDownUnusedBundles
+ PDUB(MBDL)
+ }
+ }
+
+ // Software sets BIOS_RESET_CPL.C7_ALLOWED
+ If (LGreaterEqual(PCSL, 4)) //C7 or above
+ {
+ If (LEqual(SC7A, 0x01)) //Run-time C7 Allowed feature setup value = Enabled
+ {
+ C7OK(1)
+ }
+ }
+
+ //Power-off the dGPU card
+ SGPO(HLRS, 1) // Assert dGPU_HOLD_RST# (PERST#)
+ SGPO(PWEN, 0) // Deassert dGPU_PWR_EN#
+// AMI CHANGE BEGIN.
+// Return ()
+// }
+//
+// Method(_OFF,0,Serialized)
+// {
+ //
+ // SA:InternalOnlyBegin
+ //
+ Store("\_SB.PCI0.PEG0.PEGP._OFF", Debug)
+ //
+ // SA:InternalOnlyEnd
+ //
+
+// HGOF()
+//
+// AMI CHANGE BEGIN.
+ //Ask OS to do a PnP rescan
+// AMI CHANGE BEGIN.
+// Notify(\_SB.PCI0.PEG0,0)
+// AMI CHANGE END.
+
+// AMI CHANGE BEGIN
+ Return (0)
+// AMI CHANGE END.
+ }
+
+ Method(EPON, 0, Serialized)
+ {
+ Store(1, ONOF) //Indicate Endpoint is in ON state
+
+ Return ()
+ }
+
+// AMI CHANGE BEGIN.
+// Method(_STA,0,Serialized)
+ Method(SGST,0,Serialized)
+// AMI CHANGE END.
+ {
+ //
+ // Check SGMode and dGPU Present Detect GPIO for SG system
+ //
+ If(And(SGMD,0x0F))
+ {
+ If(LNotEqual(SGGP,0x01))
+ {
+ Return(0x0F)
+ }
+ // Check dGPU_PWROK to detect dGPU.
+ If(LEqual(SGPI(PWOK),1))
+ {
+ Return(0x0F)
+ }
+ Return(0x00)
+ }
+
+ //
+ // For non-SG system check for valid Vendor Id
+ //
+ If(LNotEqual(DVID,0xFFFF))
+ {
+ Return(0x0F)
+ }
+ Return(0x00)
+ }
+
+
+ Method(_DOD,0)
+ {
+ Return (\_SB.PCI0.GFX0._DOD())
+ }
+
+
+ Device(DD01)
+ {
+ Method(_ADR,0,Serialized)
+ {
+ Return(\_SB.PCI0.GFX0.DD01._ADR())
+ }
+
+ // Device Current State.
+ Method(_DCS,0)
+ {
+
+ }
+
+ // Device Get State.
+
+ Method(_DGS,0)
+ {
+ // Return the Next State.
+ Return(\_SB.PCI0.GFX0.DD01._DGS())
+ }
+
+ // Device Set State.
+
+ // _DSS Table:
+ //
+ // BIT31 BIT30 Execution
+ // 0 0 Don't implement.
+ // 0 1 Cache change. Nothing to Implement.
+ // 1 0 Don't Implement.
+ // 1 1 Display Switch Complete. Implement.
+
+ Method(_DSS,1)
+ {
+ // Do nothing here in the OpRegion model. OEMs may choose to
+ // update internal state if necessary.
+ }
+ }
+
+ Device(DD02)
+ {
+ Method(_ADR,0,Serialized)
+ {
+ Return(\_SB.PCI0.GFX0.DD02._ADR())
+ }
+
+ // Device Current State.
+
+ Method(_DCS,0)
+ {
+ // Get the Current Display State.
+ Return(\_SB.PCI0.GFX0.DD02._DCS())
+ }
+
+ // Device Get State.
+
+ Method(_DGS,0)
+ {
+ // Return the Next State.
+ Return(\_SB.PCI0.GFX0.DD02._DGS())
+ }
+
+ // Device Set State.
+
+ Method(_DSS,1)
+ {
+ // Do nothing here in the OpRegion model. OEMs may choose to
+ // update internal state if necessary.
+ }
+
+/*
+ Method(_DDC,1)
+ {
+ If(Lor(LEqual(\_SB.PCI0.GFX0.PHED,1),LEqual(\_SB.PCI0.GFX0.PHED,2)))
+ {
+ Name(DDC2,Buffer (256) {0x0})
+ Store(\_SB.PCI0.GFX0.BDDC,DDC2)
+ Return(DDC2)
+ }
+ Return(Buffer(256){0x0})
+ }
+*/
+ Method(_BCL,0)
+ {
+ Return(\_SB.PCI0.GFX0.DD02._BCL())
+ }
+
+ Method(_BQC,0)
+ {
+ Return(\_SB.PCI0.GFX0.DD02._BQC())
+ }
+
+ Method(_BCM,1)
+ {
+ Return(\_SB.PCI0.GFX0.DD02._BCM(Arg0))
+ }
+
+ }
+
+ Device(DD03)
+ {
+ Method(_ADR,0,Serialized)
+ {
+ Return(\_SB.PCI0.GFX0.DD03._ADR())
+ }
+
+ // Device Current State.
+
+ Method(_DCS,0)
+ {
+ // Get the Current Display State.
+ }
+
+ // Device Get State.
+
+ Method(_DGS,0)
+ {
+ // Return the Next State.
+ Return(\_SB.PCI0.GFX0.DD03._DGS())
+ }
+
+ // Device Set State.
+
+ Method(_DSS,1)
+ {
+ // Do nothing here in the OpRegion model. OEMs may choose to
+ // update internal state if necessary.
+ }
+ }
+
+ Device(DD04)
+ {
+ Method(_ADR,0,Serialized)
+ {
+ Return(\_SB.PCI0.GFX0.DD04._ADR())
+ }
+
+ // Device Current State.
+
+ Method(_DCS,0)
+ {
+ // Get the Current Display State.
+ }
+
+ // Device Get State.
+
+ Method(_DGS,0)
+ {
+ // Return the Next State.
+ Return(\_SB.PCI0.GFX0.DD04._DGS())
+ }
+
+ // Device Set State.
+
+ Method(_DSS,1)
+ {
+ // Do nothing here in the OpRegion model. OEMs may choose to
+ // update internal state if necessary.
+ }
+
+ }
+
+ Device(DD05)
+ {
+ Method(_ADR,0,Serialized)
+ {
+ Return(\_SB.PCI0.GFX0.DD05._ADR())
+ }
+
+ // Device Current State.
+
+ Method(_DCS,0)
+ {
+ // Get the Current Display State.
+ }
+
+ // Device Get State.
+
+ Method(_DGS,0)
+ {
+ // Return the Next State.
+ Return(\_SB.PCI0.GFX0.DD05._DGS())
+ }
+
+ // Device Set State.
+
+ Method(_DSS,1)
+ {
+ // Do nothing here in the OpRegion model. OEMs may choose to
+ // update internal state if necessary.
+ }
+ }
+
+ Device(DD06)
+ {
+ Method(_ADR,0,Serialized)
+ {
+ Return(\_SB.PCI0.GFX0.DD06._ADR())
+ }
+
+ // Device Current State.
+
+ Method(_DCS,0)
+ {
+ // Get the Current Display State.
+ }
+
+ // Device Get State.
+
+ Method(_DGS,0)
+ {
+ // Return the Next State.
+ Return(\_SB.PCI0.GFX0.DD06._DGS())
+ }
+
+ // Device Set State.
+
+ Method(_DSS,1)
+ {
+ // Do nothing here in the OpRegion model. OEMs may choose to
+ // update internal state if necessary.
+ }
+ }
+
+ Device(DD07)
+ {
+ Method(_ADR,0,Serialized)
+ {
+ Return(\_SB.PCI0.GFX0.DD07._ADR())
+ }
+
+ // Device Current State.
+
+ Method(_DCS,0)
+ {
+ // Get the Current Display State.
+ }
+
+ // Device Get State.
+
+ Method(_DGS,0)
+ {
+ // Return the Next State.
+ Return(\_SB.PCI0.GFX0.DD07._DGS())
+ }
+
+ // Device Set State.
+
+ Method(_DSS,1)
+ {
+ // Do nothing here in the OpRegion model. OEMs may choose to
+ // update internal state if necessary.
+ }
+ }
+
+ Device(DD08)
+ {
+ Method(_ADR,0,Serialized)
+ {
+ Return(\_SB.PCI0.GFX0.DD08._ADR())
+ }
+
+ // Device Current State.
+
+ Method(_DCS,0)
+ {
+ // Get the Current Display State.
+ }
+
+ // Device Get State.
+
+ Method(_DGS,0)
+ {
+ // Return the Next State.
+ Return(\_SB.PCI0.GFX0.DD08._DGS())
+ }
+
+ // Device Set State.
+
+ Method(_DSS,1)
+ {
+ // Do nothing here in the OpRegion model. OEMs may choose to
+ // update internal state if necessary.
+ }
+ }
+ // GPIO Read
+ // Arg0 = GPIO No.
+ Method (SGPI,1,Serialized)
+ {
+ If(And(SGMD,0x0F))
+ {
+ If(LEqual(SGGP,0x01))
+ {
+ ShiftRight (Arg0, 7, Local1)
+ And(Arg0, 0x7F, Arg0)
+
+ If (LLess(Arg0,0x20))
+ {
+ Store(\_SB.PCI0.PEG0.PEGP.LVL0, Local0)
+ ShiftRight(Local0, Arg0, Local0)
+ }
+ ElseIf (LLess(Arg0,0x40))
+ {
+ Store(\_SB.PCI0.PEG0.PEGP.LVL1, Local0)
+ ShiftRight(Local0, Subtract(Arg0,0x20), Local0)
+ }
+ Else
+ {
+ Store(\_SB.PCI0.PEG0.PEGP.LVL2, Local0)
+ ShiftRight(Local0, Subtract(Arg0,0x40), Local0)
+ }
+
+ //
+ // Check if Active Low
+ //
+ If (LEqual(Local1,0))
+ {
+ Not(Local0, Local0)
+ }
+
+ Return(And(Local0,0x01))
+ }
+ }
+
+ Return(0)
+ }
+
+ // GPIO Write
+ // Arg0 = GPIO No.
+ // Arg1 = Value (0/1)
+ Method (SGPO,2,Serialized)
+ {
+ If(And(SGMD,0x0F))
+ {
+ If(LEqual(SGGP,0x01))
+ {
+ ShiftRight (Arg0, 7, Local3)
+ And(Arg0, 0x7F, Arg0)
+
+ //
+ // Check if Active Low
+ //
+ If (LEqual(Local3,0))
+ {
+ Not (Arg1, Local3)
+ And (Local3, 0x01, Local3)
+ }
+ Else
+ {
+ And (Arg1, 0x01, Local3)
+ }
+ If (LLess(Arg0,0x20))
+ {
+ ShiftLeft(Local3, Arg0, Local0)
+ ShiftLeft(0x00000001, Arg0, Local1)
+ And(\_SB.PCI0.PEG0.PEGP.LVL0, Not(Local1), Local2)
+ Or(Local2, Local0, \_SB.PCI0.PEG0.PEGP.LVL0)
+ }
+ ElseIf (LLess(Arg0,0x40))
+ {
+ ShiftLeft(Local3, Subtract(Arg0,0x20), Local0)
+ ShiftLeft(0x00000001, Subtract(Arg0,0x20), Local1)
+ And(\_SB.PCI0.PEG0.PEGP.LVL1, Not(Local1), Local2)
+ Or(Local2, Local0, \_SB.PCI0.PEG0.PEGP.LVL1)
+ }
+ Else
+ {
+ ShiftLeft(Local3, Subtract(Arg0,0x40), Local0)
+ ShiftLeft(0x00000001, Subtract(Arg0,0x40), Local1)
+ And(\_SB.PCI0.PEG0.PEGP.LVL2, Not(Local1), Local2)
+ Or(Local2, Local0, \_SB.PCI0.PEG0.PEGP.LVL2)
+ }
+ Return(1)
+ }
+ }
+
+ Return(1)
+ }
+
+ //
+ // Name: CCHK
+ // Description: Function to check whether _ON/_OFF sequence is allowed to execute for the given PEG0 controller or not
+ // Input: Arg0 -> 0 means _OFF sequence, 1 means _ON sequence
+ // Return: 0 - Don't execute the flow, 1 - Execute the flow
+ //
+ Method(CCHK,1)
+ {
+ //
+ // SA:InternalOnlyBegin
+ //
+ Store("CCHK : ", Debug)
+ If(LEqual(Arg0, 0))
+ {
+ Store("_OFF sequence condition check : ", Debug)
+ }
+ ElseIf(LEqual(Arg0, 1))
+ {
+ Store("_ON sequence condition check : ", Debug)
+ }
+ //
+ // SA:InternalOnlyEnd
+ //
+
+ //Check for PEG0 controller presence
+ If(LEqual(PVID, IVID))
+ {
+ //
+ // SA:InternalOnlyBegin
+ //
+ Store("Don't execut the flow. Failed criteria: PEG0 controller is not present", Debug)
+ //
+ // SA:InternalOnlyEnd
+ //
+
+ Return(0)
+ }
+
+ //If Endpoint is not present[already disabled] before executing _OFF then don't call the _OFF method
+ //If Endpoint is present[already enabled] before executing _ON then don't call the _ON method
+ If(LEqual(Arg0, 0))
+ {
+ //_OFF sequence condition check
+ If(LEqual(ONOF, 0))
+ {
+ //
+ // SA:InternalOnlyBegin
+ //
+ Store("Don't execut the flow. Failed criteria: Endpoint is not present[already disabled]", Debug)
+ //
+ // SA:InternalOnlyEnd
+ //
+
+ Return(0)
+ }
+ }
+ ElseIf(LEqual(Arg0, 1))
+ {
+ //_ON sequence condition check
+ If(LEqual(ONOF, 1))
+ {
+ //
+ // SA:InternalOnlyBegin
+ //
+ Store("Don't execut the flow. Failed criteria: Endpoint is present[already enabled]", Debug)
+ //
+ // SA:InternalOnlyEnd
+ //
+
+ Return(0)
+ }
+ }
+
+ //
+ // SA:InternalOnlyBegin
+ //
+ Store("Execute the flow", Debug)
+ //
+ // SA:InternalOnlyEnd
+ //
+
+ Return(1)
+ } // End of Method(CCHK,1)
+
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Peg/SgSsdt.asl b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Peg/SgSsdt.asl
new file mode 100644
index 0000000..9d4e1d1
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/AcpiTables/SwitchableGraphics/Peg/SgSsdt.asl
@@ -0,0 +1,45 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - SG Reference Code *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+DefinitionBlock (
+ "Sg.aml",
+ "SSDT",
+ 1,
+ "SgRef",
+ "SgPeg",
+ 0x1000
+ )
+{
+ External(P8XH, MethodObj)
+ External(GPRW, MethodObj)
+
+// AMI MODIFY BEGIN
+// Include("SgIgpu.ASL")
+// Include("SgDgpu.ASL")
+#include <SgDgpu.ASL>
+// AMI MODIFY END
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.c b/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.c
new file mode 100644
index 0000000..4894c8f
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.c
@@ -0,0 +1,75 @@
+/** @file
+ This code makes the BIOS Data structure available via standard ACPI mechanisms.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+#include "BdatAccessHandler.h"
+
+STATIC EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
+
+/**
+ Entry point of the Bdat Access Handler.
+
+ @param[in] ImageHandle EFI_HANDLE: A handle for the image that is initializing this driver
+ @param[in] SystemTable EFI_SYSTEM_TABLE: A pointer to the EFI system table
+
+ @retval EFI_SUCCESS: Driver initialized successfully
+ @exception EFI_UNSUPPORTED: A needed driver was not located
+ @retval EFI_OUT_OF_RESOURCES: Could not allocate needed resources
+**/
+EFI_STATUS
+BdatAccessHandler (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ VOID *HobList;
+ DXE_PLATFORM_SA_POLICY_PROTOCOL *DxePlatformSaPolicy;
+
+ ///
+ /// Check if the BDAT ACPI table support is enabled in Setup, if not then exit.
+ /// Get the platform setup policy.
+ ///
+ Status = gBS->LocateProtocol (&gDxePlatformSaPolicyGuid, NULL, (VOID **) &DxePlatformSaPolicy);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Get the start of the HOBs.
+ ///
+ Status = EfiGetSystemConfigurationTable (&gEfiHobListGuid, &HobList);
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ return EFI_UNSUPPORTED;
+ }
+ ///
+ /// Locate ACPI table protocol
+ ///
+ Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **) &AcpiTable);
+ ASSERT_EFI_ERROR (Status);
+ ASSERT (AcpiTable != NULL);
+ if (EFI_ERROR (Status)) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ BdatRmtHandler (DxePlatformSaPolicy, HobList, AcpiTable);
+ ///
+ /// ASSERT_EFI_ERROR (Status);
+ ///
+ return Status;
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.cif b/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.cif
new file mode 100644
index 0000000..db14005
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.cif
@@ -0,0 +1,15 @@
+<component>
+ name = "BdatAccessHandler"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\SystemAgent\BdatAccessHandler\Dxe\"
+ RefName = "BdatAccessHandler"
+[files]
+"BdatAccessHandler.sdl"
+"BdatAccessHandler.mak"
+"BdatAccessHandler.c"
+"BdatAccessHandler.h"
+"BdatAccessHandler.dxs"
+"BdatAccessHandler.inf"
+"BdatRmtHandler.c"
+"BdatRmtHandler.h"
+<endComponent>
diff --git a/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.dxs b/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.dxs
new file mode 100644
index 0000000..44b88d0
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.dxs
@@ -0,0 +1,37 @@
+/**
+
+Copyright (c) 1999 - 2011 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+
+Module Name:
+
+ BdatAccessHandler.dxs
+
+Abstract:
+
+ Dependency expression source file.
+
+**/
+
+#include "AutoGen.h"
+#include "DxeDepex.h"
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+
+#include EFI_PROTOCOL_DEPENDENCY (SaPlatformPolicy)
+#include EFI_PROTOCOL_DEPENDENCY (AcpiTable)
+#include EFI_PROTOCOL_DEPENDENCY (SaInfo)
+#endif
+
+DEPENDENCY_START
+ DXE_PLATFORM_SA_POLICY_GUID AND
+ EFI_ACPI_TABLE_PROTOCOL_GUID AND
+ EFI_SA_INFO_PROTOCOL_GUID
+DEPENDENCY_END
diff --git a/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.h b/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.h
new file mode 100644
index 0000000..21e236f
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.h
@@ -0,0 +1,80 @@
+/** @file
+ This code makes the BIOS Data structure available via standard ACPI mechanisms.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+#ifndef _BDAT_ACCESS_HANDLER_H_
+#define _BDAT_ACCESS_HANDLER_H_
+///
+/// External include files do NOT need to be explicitly specified in real EDKII environment.
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "Acpi3_0.h"
+#include "Acpi.h"
+#include "BdatRmtHandler.h"
+#include EFI_GUID_DEFINITION (Hob)
+
+///
+/// Consumed protocols
+///
+#include EFI_PROTOCOL_CONSUMER (AcpiTable)
+#include EFI_PROTOCOL_PRODUCER (BdatAccess)
+#include EFI_PROTOCOL_DEFINITION (SaPlatformPolicy)
+#endif
+///
+/// Ensure proper structure formats
+///
+#pragma pack(push, 1)
+///
+/// BIOS Data ACPI structure
+///
+typedef struct {
+ EFI_ACPI_DESCRIPTION_HEADER Header;
+ EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE BdatGas;
+} EFI_BDAT_ACPI_DESCRIPTION_TABLE;
+
+
+/**
+ Entry point of the Bdat RMT Access Handler.
+
+ @param[in] DxePlatformSaPolicy : A pointer to Dxe platform policy
+ @param[in] HobList : A pointer to the HOB list
+ @param[in] AcpiTable : A pointer to ACPI table
+
+ @retval EFI_SUCCESS: Driver initialized successfully
+ @exception EFI_UNSUPPORTED: A needed driver was not located
+ @retval EFI_OUT_OF_RESOURCES: Could not allocate needed resources
+**/
+EFI_STATUS
+BdatRmtHandler (
+ IN DXE_PLATFORM_SA_POLICY_PROTOCOL *DxePlatformSaPolicy,
+ IN VOID *HobList,
+ IN EFI_ACPI_TABLE_PROTOCOL *AcpiTable
+ )
+;
+///
+/// This is copied from Include\Acpi.h
+///
+#define CREATOR_ID_INTEL 0x4C544E49 /// "LTNI""INTL"(Intel)
+#define CREATOR_REV_INTEL 0x20090903
+
+#pragma pack(pop)
+
+#endif /// _BDAT_ACCESS_HANDLER_H_
diff --git a/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.inf b/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.inf
new file mode 100644
index 0000000..c83318a
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.inf
@@ -0,0 +1,99 @@
+#/*++
+#
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+#
+# Module Name:
+#
+# BdatAccessHandler.inf
+#
+# Abstract:
+#
+# Component description file for the BdatAccessHandler module.
+#
+#--*/
+
+[defines]
+BASE_NAME = BdatAccessHandler
+FILE_GUID = 6DB9486F-6AF6-4090-984D-238482CE3EA4
+COMPONENT_TYPE = BS_DRIVER
+
+[sources.common]
+ BdatAccessHandler.c
+ BdatAccessHandler.h
+ BdatRmtHandler.c
+ BdatRmtHandler.h
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueDxeDriverEntryPoint.c
+
+[includes.common]
+ .
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include/Library
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include/Common
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Guid
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/SaInit/Pei
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/$(PROJECT_SA_MRC)/Pei
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/$(PROJECT_SA_MRC)/Pei/Source/Api
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/$(PROJECT_SA_MRC)/Pei/Source/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/$(PROJECT_SA_MRC)/Pei/Source/Include/MrcRegisters
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)
+ $(EDK_SOURCE)/Foundation/Cpu/Pentium/Include
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include/Library
+
+[libraries.common]
+ EdkFrameworkProtocolLib
+ EdkFrameworkGuidLib
+ EfiGuidLib
+ EdkProtocolLib
+ EdkIIGlueBaseLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueBaseMemoryLib
+ EdkIIGlueDxeReportStatusCodeLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueDxeServicesTableLib
+ EdkIIGlueDxeHobLib
+ IntelSaProtocolLib
+ CpuPlatformLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = BdatAccessHandler.dxs
+
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=BdatAccessHandler
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_BASE_LIB__ \
+ -D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__
+
diff --git a/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.mak b/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.mak
new file mode 100644
index 0000000..c30f7a4
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.mak
@@ -0,0 +1,58 @@
+#---------------------------------------------------------------------------
+# Create PCI Host Bridge DXE Component
+#---------------------------------------------------------------------------
+EDK : BdatAccessHandler
+
+BdatAccessHandler : $(BUILD_DIR)\BdatAccessHandler.mak BdatAccessHandlerBin
+
+$(BUILD_DIR)\BdatAccessHandler.mak : $(BdatAccessHandler_DIR)\BdatAccessHandler.cif $(BUILD_RULES)
+ $(CIF2MAK) $(BdatAccessHandler_DIR)\BdatAccessHandler.cif $(CIF2MAK_DEFAULTS)
+
+BdatAccessHandler_INCLUDES=\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(EDK_INCLUDES)\
+ $(INTEL_MCH_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)
+
+BdatAccessHandler_DEFINES =$(MY_DEFINES)\
+ /D "__EDKII_GLUE_MODULE_ENTRY_POINT__=BdatAccessHandler" \
+ /D __EDKII_GLUE_BASE_LIB__ \
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__\
+ /D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+
+BdatAccessHandler_LIB_LINKS =\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EDKPROTOCOLLIB)\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueUefiRuntimeServicesTableLib_LIB)\
+ $(EdkIIGlueDxeServicesTableLib_LIB)\
+ $(EdkIIGlueDxeHobLib_LIB)\
+ $(INTEL_SA_PROTOCOL_LIB)\
+ $(CpuPlatformLib_LIB)\
+
+BdatAccessHandlerBin : $(BdatAccessHandler_LIB_LINKS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\BdatAccessHandler.mak all\
+ GUID=6DB9486F-6AF6-4090-984D-238482CE3EA4 \
+ ENTRY_POINT=_ModuleEntryPoint \
+ "MY_DEFINES=$(BdatAccessHandler_DEFINES)"\
+ "MY_INCLUDES=$(BdatAccessHandler_INCLUDES)"\
+ TYPE=BS_DRIVER \
+ EDKIIModule=DXEDRIVER\
+ DEPEX1=$(BdatAccessHandler_DIR)\BdatAccessHandler.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX\
+ COMPRESS=1 \ No newline at end of file
diff --git a/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.sdl b/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.sdl
new file mode 100644
index 0000000..4efce7e
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.sdl
@@ -0,0 +1,26 @@
+TOKEN
+ Name = "BdatAccessHandler_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+ Help = "Main switch to enable BdatAccessHandler support in Project"
+ Token = "MRC_BDAT_SUPPORT" "=" "1"
+End
+
+MODULE
+ Help = "Includes BdatAccessHandler.mak to Project"
+ File = "BdatAccessHandler.mak"
+End
+
+PATH
+ Name = "BdatAccessHandler_DIR"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\BdatAccessHandler.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatRmtHandler.c b/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatRmtHandler.c
new file mode 100644
index 0000000..8fbe3d2
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatRmtHandler.c
@@ -0,0 +1,152 @@
+/** @file
+ Copies the memory related timing and configuration information into the
+ Compatible BIOS data (BDAT) table.
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+**/
+
+#include "BdatAccessHandler.h"
+#include "McMain.h"
+
+#ifdef BDAT_SUPPORT
+///
+/// Data definitions & structures
+///
+EFI_GUID gMemoryInitHobGuid = EFI_MEMORY_RESTORE_DATA_GUID;
+
+///
+/// Bdat Access Handler instance data structure
+///
+STATIC EFI_BDAT_ACPI_DESCRIPTION_TABLE mRmtAcpiTable = {
+ EFI_BDAT_TABLE_SIGNATURE, ///< Signature
+ sizeof (EFI_BDAT_ACPI_DESCRIPTION_TABLE), ///< Length
+ 0x01, ///< Revision [01]
+ 0, ///< Checksum
+ ' ', ///< OEM ID
+ ' ', ///< .
+ ' ', ///< .
+ ' ', ///< .
+ ' ', ///< .
+ ' ', ///< .
+ 0, ///< OEM Table ID
+ 0, ///< OEM Revision [0x00000000]
+ 0, ///< Creator ID
+ 0, ///< Creator Revision
+ 0, ///< System Memory Address Space ID
+ 0,
+ 0,
+ 0,
+ EFI_BDAT_ACPI_POINTER,
+};
+#endif
+
+/**
+ Entry point of the Bdat RMT Access Handler.
+
+ @param[in] DxePlatformSaPolicy : A pointer to Dxe platform policy
+ @param[in] HobList : A pointer to the HOB list
+ @param[in] AcpiTable : A pointer to ACPI table
+
+ @retval EFI_SUCCESS: Driver initialized successfully
+ @exception EFI_UNSUPPORTED: A needed driver was not located
+ @retval EFI_OUT_OF_RESOURCES: Could not allocate needed resources
+**/
+EFI_STATUS
+BdatRmtHandler (
+ IN DXE_PLATFORM_SA_POLICY_PROTOCOL *DxePlatformSaPolicy,
+ IN VOID *HobList,
+ IN EFI_ACPI_TABLE_PROTOCOL *AcpiTable
+ )
+{
+#ifdef BDAT_SUPPORT
+ EFI_STATUS Status;
+ VOID *Buffer;
+ RmtData *rmtBdat;
+ HOB_SAVE_MEMORY_DATA *RmtHobData;
+ UINTN AcpiTableKey;
+ UINT64 TempBuffer;
+ UINT16 BufferSize;
+ UINT32 *ScratchPad;
+
+ Buffer = NULL;
+ rmtBdat = NULL;
+ BufferSize = 0;
+ Status = EFI_SUCCESS;
+ if (!DxePlatformSaPolicy->MemoryConfig->RmtBdatEnable) {
+ return EFI_UNSUPPORTED;
+ }
+ ///
+ /// Get the Compatible BIOS structure PMT BDAT from the HOB.
+ ///
+ RmtHobData = GetNextGuidHob (&gMemoryInitHobGuid, HobList);
+ if (RmtHobData == NULL) {
+ return EFI_UNSUPPORTED;
+ }
+ ///
+ /// Allocate and clear memory, in 4kb pages
+ ///
+ BufferSize = sizeof (RmtData);
+
+ Status = (gBS->AllocatePages) (AllocateAnyPages, EfiReservedMemoryType, EFI_SIZE_TO_PAGES (BufferSize), (EFI_PHYSICAL_ADDRESS *) &Buffer);
+ if (EFI_ERROR (Status)) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ ZeroMem (Buffer, BufferSize);
+ ///
+ /// Copy BDAT structure to Reserved memory
+ ///
+ CopyMem (Buffer, &RmtHobData->MrcData.Rmt, BufferSize);
+
+ TempBuffer = EFI_SIGNATURE_64 ('I', 'N', 'T', 'E', 'L', 0, 0, 0);
+ ///
+ /// RMT ACPI table
+ ///
+ DEBUG ((EFI_D_INFO, "In RMT ACPI table\n"));
+ CopyMem (&mRmtAcpiTable.Header.OemId, &TempBuffer, sizeof (mRmtAcpiTable.Header.OemId));
+ mRmtAcpiTable.Header.OemTableId = EFI_SIGNATURE_64 ('H', 'S', 'W', '-', 'L', 'P', 'T', 0);
+ mRmtAcpiTable.Header.CreatorId = CREATOR_ID_INTEL;
+ mRmtAcpiTable.Header.CreatorRevision = CREATOR_REV_INTEL;
+ mRmtAcpiTable.Header.OemRevision = ACPI_BDAT_OEM_REV;
+ ///
+ /// Copy pointer to RMT ACPI BDAT structure and protocol.
+ ///
+ mRmtAcpiTable.BdatGas.Address = (EFI_PHYSICAL_ADDRESS) Buffer;
+ ///
+ /// Install RMT BDAT into RMT ACPI table
+ ///
+ AcpiTableKey = 0;
+ Status = AcpiTable->InstallAcpiTable (
+ AcpiTable,
+ &mRmtAcpiTable,
+ sizeof (EFI_BDAT_ACPI_DESCRIPTION_TABLE),
+ &AcpiTableKey
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Write scratchpad register in MCHBAR space with address of the RMT ACPI BDAT structure.
+ ///
+ ScratchPad = (UINT32 *) ((UINT64) (RmtHobData->MrcData.SysIn.Inputs.MchBarBaseAddress) + NCDECS_CR_SCRATCHPAD_NCU_2_REG);
+ *ScratchPad = (UINT32) ((UINT64) Buffer);
+
+ return Status;
+#else
+ return EFI_UNSUPPORTED;
+#endif
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatRmtHandler.h b/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatRmtHandler.h
new file mode 100644
index 0000000..ce24bff
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatRmtHandler.h
@@ -0,0 +1,33 @@
+/** @file
+ Copies the memory related timing and configuration information into the
+ Compatible BIOS data (BDAT) table.
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+**/
+#ifndef _BdatRmtHandler_h_
+#define _BdatRmtHandler_h_
+#ifndef BDAT_SUPPORT
+#define BDAT_SUPPORT
+#endif
+#include "MemInfoHob.h"
+
+#define EFI_BDAT_TABLE_SIGNATURE EFI_SIGNATURE_32 ('B', 'D', 'A', 'T')
+#define ACPI_BDAT_OEM_REV 0x00001000
+#define EFI_BDAT_ACPI_POINTER 0x0
+
+#endif /// _BdatRmtHandler_h_
diff --git a/ReferenceCode/Chipset/SystemAgent/Guid/AcpiVariable/AcpiVariable.h b/ReferenceCode/Chipset/SystemAgent/Guid/AcpiVariable/AcpiVariable.h
new file mode 100644
index 0000000..6560e70
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Guid/AcpiVariable/AcpiVariable.h
@@ -0,0 +1,80 @@
+/** @file
+ GUIDs used for ACPI variables.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _ACPI_VARIABLE_H_
+#define _ACPI_VARIABLE_H_
+
+///
+/// RC Override: sync from R8HswClientPkg\Guid\AcpiVariable\AcpiVariable.h
+///
+#define EFI_ACPI_VARIABLE_GUID \
+ { \
+ 0xc020489e, 0x6db2, 0x4ef2, 0x9a, 0xa5, 0xca, 0x6, 0xfc, 0x11, 0xd3, 0x6a \
+ }
+
+#define ACPI_GLOBAL_VARIABLE L"AcpiGlobalVariable"
+
+///
+/// The following structure combine all ACPI related variables into one in order
+/// to boost performance
+///
+#pragma pack(1)
+typedef struct {
+ UINT16 Limit;
+ UINTN Base;
+} PSEUDO_DESCRIPTOR;
+#pragma pack()
+
+typedef struct {
+ BOOLEAN APState;
+ BOOLEAN S3BootPath;
+ EFI_PHYSICAL_ADDRESS WakeUpBuffer;
+ EFI_PHYSICAL_ADDRESS GdtrProfile;
+ EFI_PHYSICAL_ADDRESS IdtrProfile;
+ EFI_PHYSICAL_ADDRESS CpuPrivateData;
+ EFI_PHYSICAL_ADDRESS StackAddress;
+ EFI_PHYSICAL_ADDRESS MicrocodePointerBuffer;
+ EFI_PHYSICAL_ADDRESS SmramBase;
+ EFI_PHYSICAL_ADDRESS SmmStartImageBase;
+ UINT32 SmmStartImageSize;
+ UINT32 NumberOfCpus;
+} ACPI_CPU_DATA;
+
+///
+/// Acpi Related variables
+///
+typedef struct {
+ EFI_PHYSICAL_ADDRESS AcpiReservedMemoryBase;
+ UINT32 AcpiReservedMemorySize;
+ EFI_PHYSICAL_ADDRESS S3ReservedLowMemoryBase;
+ EFI_PHYSICAL_ADDRESS AcpiBootScriptTable;
+ EFI_PHYSICAL_ADDRESS RuntimeScriptTableBase;
+ EFI_PHYSICAL_ADDRESS AcpiFacsTable;
+ UINT64 SystemMemoryLength;
+ ACPI_CPU_DATA AcpiCpuData;
+ EFI_PHYSICAL_ADDRESS VideoOpromAddress; ///< VGA OPROM to support Video Re-POST for Linux S3
+ UINT32 VideoOpromSize; ///< VGA OPROM to support Video Re-POST for Linux S3
+ EFI_PHYSICAL_ADDRESS S3DebugBufferAddress; ///< S3 Debug extension
+ EFI_PHYSICAL_ADDRESS S3ResumeNvsEntryPoint; ///< S3 Debug extension
+} ACPI_VARIABLE_SET;
+
+extern EFI_GUID gEfiAcpiVariableGuid;
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/Guid/SaAcpiTableStorage/SaAcpiTableStorage.c b/ReferenceCode/Chipset/SystemAgent/Guid/SaAcpiTableStorage/SaAcpiTableStorage.c
new file mode 100644
index 0000000..a7ebeac
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Guid/SaAcpiTableStorage/SaAcpiTableStorage.c
@@ -0,0 +1,27 @@
+/** @file
+ The GUID definition for SA ACPI table storage file name
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "Tiano.h"
+#include "SaAcpiTableStorage.h"
+
+EFI_GUID gSaAcpiTableStorageGuid = SA_ACPI_TABLE_STORAGE_GUID;
+
+EFI_GUID_STRING
+ (&gIntelSaAcpiTableStorageGuid, "SA ACPI Table Storage File Name", "SA ACPI Table Storage file name GUID");
diff --git a/ReferenceCode/Chipset/SystemAgent/Guid/SaAcpiTableStorage/SaAcpiTableStorage.h b/ReferenceCode/Chipset/SystemAgent/Guid/SaAcpiTableStorage/SaAcpiTableStorage.h
new file mode 100644
index 0000000..cc599a1
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Guid/SaAcpiTableStorage/SaAcpiTableStorage.h
@@ -0,0 +1,31 @@
+/** @file
+ GUID definition for the SA ACPI table storage file name
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _SA_ACPI_TABLE_STORAGE_H_
+#define _SA_ACPI_TABLE_STORAGE_H_
+
+#define SA_ACPI_TABLE_STORAGE_GUID \
+ { \
+ 0x27E569D5, 0xAFC, 0x4D8F, 0x8C, 0x90, 0x78, 0x3A, 0xC4, 0xA3, 0x18, 0xAB \
+ }
+
+extern EFI_GUID gSaAcpiTableStorageGuid;
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/Guid/SaDataHob/SaDataHob.c b/ReferenceCode/Chipset/SystemAgent/Guid/SaDataHob/SaDataHob.c
new file mode 100644
index 0000000..067f02b
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Guid/SaDataHob/SaDataHob.c
@@ -0,0 +1,27 @@
+/** @file
+ The GUID definition for SaDataHob
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+#include "Tiano.h"
+#include "SaDataHob.h"
+
+EFI_GUID gSaDataHobGuid = SA_DATA_HOB_GUID;
+
+EFI_GUID_STRING(&gSaDataHobGuid, "SA Data HOB", "GUID for SA Data HOB");
diff --git a/ReferenceCode/Chipset/SystemAgent/Guid/SaDataHob/SaDataHob.h b/ReferenceCode/Chipset/SystemAgent/Guid/SaDataHob/SaDataHob.h
new file mode 100644
index 0000000..476cb68
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Guid/SaDataHob/SaDataHob.h
@@ -0,0 +1,122 @@
+/** @file
+ The GUID definition for SaDataHob
+
+@copyright
+ Copyright (c) 2012 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+#ifndef _SA_DATA_HOB_H_
+#define _SA_DATA_HOB_H_
+
+#define SA_DATA_HOB_GUID \
+ { \
+ 0x4c10d934, 0x38e6, 0x45a4, 0x9a, 0x24, 0x2a, 0x79, 0xb9, 0x3d, 0xcb, 0x7f \
+ }
+
+extern EFI_GUID gSaDataHobGuid;
+
+#define GP_ENABLE 1
+#define GP_DISABLE 0
+
+#ifndef _PEI_HOB_H_
+#ifndef __HOB__H__
+typedef struct _EFI_HOB_GENERIC_HEADER {
+ UINT16 HobType;
+ UINT16 HobLength;
+ UINT32 Reserved;
+} EFI_HOB_GENERIC_HEADER;
+
+typedef struct _EFI_HOB_GUID_TYPE {
+ EFI_HOB_GENERIC_HEADER Header;
+ EFI_GUID Name;
+ //
+ // Guid specific data goes here
+ //
+} EFI_HOB_GUID_TYPE;
+#endif
+#endif
+
+///
+/// DPR Directory Types
+///
+typedef enum {
+ EnumDprDirectoryTxt = 0,
+ EnumDprDirectoryPfat
+} DPR_DIRECTORY_ELEMENT;
+
+#define DPR_DIRECTORY_TYPE_TXT 0x01
+#define DPR_DIRECTORY_TYPE_PFAT 0x02
+#define DPR_DIRECTORY_MAX 2
+
+///
+/// DPR directory entry definition
+///
+typedef struct {
+ UINT8 Type; ///< DPR Directory Type
+ UINT8 Size; ///< DPR Size in MB
+ UINT32 PhysBase; ///< Physical address - must be 4K aligned (bits 11..0 must be clear)
+ UINT16 Reserved; ///< Must be 0
+} DPR_DIRECTORY_ENTRY;
+
+///
+/// PEG data definition
+///
+typedef struct {
+ UINT32 EndPointVendorIdDeviceId[3]; ///< VID/DID for each PEG controller
+ UINT8 BestPreset[16]; ///< Best preset value for each lane
+ UINT8 PegGen3PresetSearch; ///< Policy value from earlier boot
+ UINT8 PegLinkFailMask; ///< Mask of PEG controllers to ignore
+} SA_PEG_DATA;
+
+///
+/// SgMode settings
+///
+typedef enum {
+ SgModeDisabled = 0,
+ SgModeMuxed,
+ SgModeMuxless,
+ SgModeDgpu,
+ SgModeMax
+} SG_MODE;
+
+///
+/// SA Info HOB
+///
+typedef struct _SG_INFO_HOB {
+ EFI_HOB_GUID_TYPE EfiHobGuidType;
+ UINT8 RevisionId; ///< Revision ID
+ SG_MODE SgMode;
+ BOOLEAN SgGpioSupport; ///< 1=Supported; 0=Not Supported
+ UINT8 SgDgpuPwrOK;
+ UINT8 SgDgpuHoldRst;
+ UINT8 SgDgpuPwrEnable;
+ UINT8 SgDgpuPrsnt;
+ UINT8 PXFixedDynamicMode; // AMI_OVERRIDE_FOR ATI 5.0 Fixed/Dynamic
+} SG_INFO_HOB;
+
+typedef struct {
+ EFI_HOB_GUID_TYPE EfiHobGuidType;
+ DPR_DIRECTORY_ENTRY DprDirectory[DPR_DIRECTORY_MAX];
+ BOOLEAN PegDataValid; ///< TRUE, if PegData contains data from a prior boot
+ SA_PEG_DATA PegData;
+ UINT16 SaIotrapSmiAddress; ///< Store address for Iotrap SMI
+ BOOLEAN InitPcieAspmAfterOprom; ///< Switch for PCIe ASPM initialization after Oprom or before
+ SG_INFO_HOB SgInfo;
+ BOOLEAN PegPlatformResetRequired; ///< if PegPlatformResetRequired=1, platform code should generate a cold/power cycle reset after saving PEG config data into NVRAM
+} SA_DATA_HOB;
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/Guid/SaGuidLib.cif b/ReferenceCode/Chipset/SystemAgent/Guid/SaGuidLib.cif
new file mode 100644
index 0000000..3298df9
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Guid/SaGuidLib.cif
@@ -0,0 +1,19 @@
+<component>
+ name = "SaGuidLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\SystemAgent\Guid\"
+ RefName = "SaGuidLib"
+[files]
+"SaGuidLib.sdl"
+"SaGuidLib.mak"
+"SaGuidLib.inf"
+"AcpiVariable\AcpiVariable.h"
+"SaAcpiTableStorage\SaAcpiTableStorage.h"
+"SaAcpiTableStorage\SaAcpiTableStorage.c"
+"SaDataHob\SaDataHob.h"
+"SaDataHob\SaDataHob.c"
+"SgAcpiTableStorage\SgAcpiTableStorage.h"
+"SgAcpiTableStorage\SgAcpiTableStorage.c"
+"SaSsdtTableStorage\SaSsdtTableStorage.c"
+"SaSsdtTableStorage\SaSsdtTableStorage.h"
+<endComponent>
diff --git a/ReferenceCode/Chipset/SystemAgent/Guid/SaGuidLib.inf b/ReferenceCode/Chipset/SystemAgent/Guid/SaGuidLib.inf
new file mode 100644
index 0000000..9d20582
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Guid/SaGuidLib.inf
@@ -0,0 +1,49 @@
+## @file
+# Component description file for the SA GUID library
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = SaGuidLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ AcpiVariable/AcpiVariable.h
+ SaAcpiTableStorage/SaAcpiTableStorage.h
+ SaAcpiTableStorage/SaAcpiTableStorage.c
+ SgAcpiTableStorage/SgAcpiTableStorage.h
+ SgAcpiTableStorage/SgAcpiTableStorage.c
+ SaDataHob/SaDataHob.h
+ SaDataHob/SaDataHob.c
+ SaSsdtTableStorage/SaSsdtTableStorage.h
+ SaSsdtTableStorage/SaSsdtTableStorage.c
+
+[includes.common]
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+
+[nmake.common]
+C_STD_INCLUDE=
diff --git a/ReferenceCode/Chipset/SystemAgent/Guid/SaGuidLib.mak b/ReferenceCode/Chipset/SystemAgent/Guid/SaGuidLib.mak
new file mode 100644
index 0000000..4d3e7a8
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Guid/SaGuidLib.mak
@@ -0,0 +1,21 @@
+# MAK file for the ModulePart:SaGuidLib
+all : SaGuidLib
+
+$(SaGuidLib_LIB) : SaGuidLib
+
+SaGuidLib : $(BUILD_DIR)\SaGuidLib.mak SaGuidLibBin
+
+$(BUILD_DIR)\SaGuidLib.mak : $(SaGuidLib_DIR)\$(@B).cif $(SaGuidLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(SaGuidLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+SaGuidLibBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDK_DEFAULTS)\
+ /f $(BUILD_DIR)\SaGuidLib.mak all\
+ "MY_INCLUDES=$(EDK_INCLUDES) $(EdkIIGlueLib_INCLUDES)" \
+ TYPE=LIBRARY
+!IF "$(x64_BUILD)"=="1"
+ $(MAKE) /$(MAKEFLAGS) $(EDK_DEFAULTS) BUILD_DIR=$(BUILD_DIR)\IA32\
+ /f $(BUILD_DIR)\SaGuidLib.mak all\
+ "MY_INCLUDES=$(EDK_INCLUDES) $(EdkIIGlueLib_INCLUDES)" \
+ TYPE=PEI_LIBRARY
+!ENDIF
diff --git a/ReferenceCode/Chipset/SystemAgent/Guid/SaGuidLib.sdl b/ReferenceCode/Chipset/SystemAgent/Guid/SaGuidLib.sdl
new file mode 100644
index 0000000..55af4bc
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Guid/SaGuidLib.sdl
@@ -0,0 +1,37 @@
+TOKEN
+ Name = "SaGuidLib_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable SaGuidLib support in Project"
+End
+
+MODULE
+ Help = "Includes SaGuidLib.mak to Project"
+ File = "SaGuidLib.mak"
+End
+
+PATH
+ Name = "SaGuidLib_DIR"
+End
+
+ELINK
+ Name = "/I$(SaGuidLib_DIR)"
+ Parent = "INTEL_MCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(SaGuidLib_DIR)\AcpiVariable"
+ Parent = "INTEL_MCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+TOKEN
+ Name = "SaGuidLib_LIB"
+ Value = "$$(LIB_BUILD_DIR)\SaGuidLib.lib"
+ TokenType = Expression
+ TargetMAK = Yes
+End
diff --git a/ReferenceCode/Chipset/SystemAgent/Guid/SaSsdtTableStorage/SaSsdtTableStorage.c b/ReferenceCode/Chipset/SystemAgent/Guid/SaSsdtTableStorage/SaSsdtTableStorage.c
new file mode 100644
index 0000000..0f0307b
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Guid/SaSsdtTableStorage/SaSsdtTableStorage.c
@@ -0,0 +1,27 @@
+/** @file
+ The GUID definition for SA ACPI table storage file name
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "Tiano.h"
+#include "SaSsdtTableStorage.h"
+
+EFI_GUID gSaSsdtAcpiTableStorageGuid = SA_SSDT_ACPI_TABLE_STORAGE_GUID;
+
+EFI_GUID_STRING
+ (&gSaSsdtAcpiTableStorageGuid, "SA SSDT ACPI Table Storage File Name", "SA SSDT ACPI Table Storage file name GUID");
diff --git a/ReferenceCode/Chipset/SystemAgent/Guid/SaSsdtTableStorage/SaSsdtTableStorage.h b/ReferenceCode/Chipset/SystemAgent/Guid/SaSsdtTableStorage/SaSsdtTableStorage.h
new file mode 100644
index 0000000..1e0b9b1
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Guid/SaSsdtTableStorage/SaSsdtTableStorage.h
@@ -0,0 +1,31 @@
+/** @file
+ GUID definition for the SA SSDT ACPI table storage file name
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _SA_SSDT_TABLE_STORAGE_H_
+#define _SA_SSDT_TABLE_STORAGE_H_
+
+#define SA_SSDT_ACPI_TABLE_STORAGE_GUID \
+ { \
+ 0xAAA99A23, 0x13B6, 0x4C31, 0xBB, 0x8B, 0x29, 0x9E, 0x8E, 0xC0, 0x4F, 0xA4 \
+ }
+
+extern EFI_GUID gSaSsdtAcpiTableStorageGuid;
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/Guid/SgAcpiTableStorage/SgAcpiTableStorage.c b/ReferenceCode/Chipset/SystemAgent/Guid/SgAcpiTableStorage/SgAcpiTableStorage.c
new file mode 100644
index 0000000..5cac632
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Guid/SgAcpiTableStorage/SgAcpiTableStorage.c
@@ -0,0 +1,45 @@
+/** @file
+ The GUID definition for SG ACPI table storage file name
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "EdkIIGlueDxe.h"
+#include "SgAcpiTableStorage.h"
+
+///
+/// Protocol GUID definition for PEG Switchable Graphics
+///
+EFI_GUID gSgAcpiTableStorageGuid = SG_ACPI_TABLE_STORAGE_GUID;
+
+///
+/// Protocol description for PEG Switchable Graphics
+///
+EFI_GUID_STRING
+ (&gIntelSgAcpiTableStorageGuid, "SG ACPI Table Storage File Name", "SG ACPI Table Storage file name GUID");
+
+
+///
+/// Protocol GUID definition for PCH Switchable Graphics
+///
+EFI_GUID gSgAcpiTablePchStorageGuid = SG_ACPI_TABLE_PCH_STORAGE_GUID;
+
+///
+/// Protocol description for PCH Switchable Graphics
+///
+EFI_GUID_STRING
+ (&gSgAcpiTablePchStorageGuid, "SG ACPI Table Pch Storage File Name", "SG ACPI Table Pch Storage file name GUID");
diff --git a/ReferenceCode/Chipset/SystemAgent/Guid/SgAcpiTableStorage/SgAcpiTableStorage.h b/ReferenceCode/Chipset/SystemAgent/Guid/SgAcpiTableStorage/SgAcpiTableStorage.h
new file mode 100644
index 0000000..4aa8d54
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Guid/SgAcpiTableStorage/SgAcpiTableStorage.h
@@ -0,0 +1,50 @@
+/** @file
+ GUID definition for the SG ACPI table storage file name
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _SG_ACPI_TABLE_STORAGE_H_
+#define _SG_ACPI_TABLE_STORAGE_H_
+
+///
+/// {CACB3817-81E6-497e-87FF-C8FA8F24EC28}
+///
+#define SG_ACPI_TABLE_STORAGE_GUID \
+ { \
+ 0xcacb3817, 0x81e6, 0x497e, 0x87, 0xff, 0xc8, 0xfa, 0x8f, 0x24, 0xec, 0x28 \
+ }
+
+extern EFI_GUID gSgAcpiTableStorageGuid;
+
+#endif
+
+
+#ifndef _SG_ACPI_TABLE_PCH_STORAGE_H_
+#define _SG_ACPI_TABLE_PCH_STORAGE_H_
+
+///
+/// {CBCB3817-81E6-497e-87FF-C8FA8F24EC28}
+///
+#define SG_ACPI_TABLE_PCH_STORAGE_GUID \
+ { \
+ 0xcbcb3817, 0x81e6, 0x497e, 0x87, 0xff, 0xc8, 0xfa, 0x8f, 0x24, 0xec, 0x28 \
+ }
+
+extern EFI_GUID gSgAcpiTablePchStorageGuid;
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/Include/DmaRemappingTable.h b/ReferenceCode/Chipset/SystemAgent/Include/DmaRemappingTable.h
new file mode 100644
index 0000000..380a351
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Include/DmaRemappingTable.h
@@ -0,0 +1,115 @@
+/** @file
+ This code defines ACPI DMA Remapping table related definitions.
+ See the System Agent BIOS specification for definition of the table.
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _DMA_REMAPPING_TABLE_H_
+#define _DMA_REMAPPING_TABLE_H_
+
+#include "Tiano.h"
+#include "Acpi3_0.h"
+
+#pragma pack(1)
+///
+/// DMAR table signature
+///
+#define EFI_ACPI_VTD_DMAR_TABLE_SIGNATURE 0x52414D44 ///< "DMAR"
+#define EFI_ACPI_DMAR_TABLE_REVISION 1
+#define EFI_ACPI_DRHD_ENGINE_HEADER_LENGTH 0x10
+#define EFI_ACPI_RMRR_HEADER_LENGTH 0x18
+#define MAX_PCI_DEPTH 5
+
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT16 Reserved;
+ UINT8 EnumId;
+ UINT8 StartBusNumber;
+ UINT8 PciPath[2];
+} EFI_ACPI_DEV_SCOPE_STRUCTURE;
+
+typedef struct {
+ UINT16 Type;
+ UINT16 Length;
+ UINT8 Flags;
+ UINT8 Reserved;
+ UINT16 SegmentNum;
+ EFI_PHYSICAL_ADDRESS RegisterBaseAddress;
+ EFI_ACPI_DEV_SCOPE_STRUCTURE DeviceScope[1];
+} EFI_ACPI_DRHD_ENGINE1_STRUCT;
+
+typedef struct {
+ UINT16 Type;
+ UINT16 Length;
+ UINT8 Flags;
+ UINT8 Reserved;
+ UINT16 SegmentNum;
+ EFI_PHYSICAL_ADDRESS RegisterBaseAddress;
+ EFI_ACPI_DEV_SCOPE_STRUCTURE DeviceScope[9];
+} EFI_ACPI_DRHD_ENGINE2_STRUCT;
+
+typedef struct {
+ UINT16 Type;
+ UINT16 Length;
+ UINT16 Reserved;
+ UINT16 SegmentNum;
+ EFI_PHYSICAL_ADDRESS RmrBaseAddress;
+ EFI_PHYSICAL_ADDRESS RmrLimitAddress;
+ EFI_ACPI_DEV_SCOPE_STRUCTURE DeviceScope[3];
+} EFI_ACPI_RMRR_USB_STRUC;
+
+typedef struct {
+ UINT16 Type;
+ UINT16 Length;
+ UINT16 Reserved;
+ UINT16 SegmentNum;
+ EFI_PHYSICAL_ADDRESS RmrBaseAddress;
+ EFI_PHYSICAL_ADDRESS RmrLimitAddress;
+ EFI_ACPI_DEV_SCOPE_STRUCTURE DeviceScope[1];
+} EFI_ACPI_RMRR_IGD_STRUC;
+
+typedef struct {
+ UINT16 Type;
+ UINT16 Length;
+ UINT8 Reserved[3];
+ UINT8 AcpiDeviceNumber;
+ UINT8 AcpiObjectName[20];
+} EFI_ACPI_ANDD_STRUC;
+
+typedef struct {
+ EFI_ACPI_DESCRIPTION_HEADER Header;
+ UINT8 HostAddressWidth;
+ UINT8 Flags;
+ UINT8 Reserved[10];
+ EFI_ACPI_DRHD_ENGINE1_STRUCT DrhdEngine1;
+ EFI_ACPI_DRHD_ENGINE2_STRUCT DrhdEngine2;
+ EFI_ACPI_RMRR_USB_STRUC RmrrUsb;
+ EFI_ACPI_RMRR_IGD_STRUC RmrrIgd;
+ EFI_ACPI_ANDD_STRUC AnddI2C0;
+ EFI_ACPI_ANDD_STRUC AnddI2C1;
+ EFI_ACPI_ANDD_STRUC AnddSpi0;
+ EFI_ACPI_ANDD_STRUC AnddSpi1;
+ EFI_ACPI_ANDD_STRUC AnddUa00;
+ EFI_ACPI_ANDD_STRUC AnddUa01;
+ EFI_ACPI_ANDD_STRUC AnddSdhc;
+} EFI_ACPI_DMAR_TABLE;
+
+#pragma pack()
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/Include/IntelSaAcpiTables.dsc b/ReferenceCode/Chipset/SystemAgent/Include/IntelSaAcpiTables.dsc
new file mode 100644
index 0000000..fd7a989
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Include/IntelSaAcpiTables.dsc
@@ -0,0 +1,62 @@
+## @file
+# Build description file for building the SA ACPI tables
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[=============================================================================]
+#
+# Instructions for building the MCH ACPI table storage file
+#
+[=============================================================================]
+[Build.Ia32.SA_DMAR_ACPITABLE,Build.x64.SA_DMAR_ACPITABLE]
+#
+# Check if we have any source to work with.
+#
+!IFNDEF SECTIONS
+!IFNDEF ASL_FILES
+!ERROR No ASL source files to build were defined in the INF file
+!ENDIF
+!ENDIF
+
+#
+# Define some macros to simplify changes
+#
+TARGET_FFS_FILE = $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).ffs
+
+#
+# Build FFS file
+#
+$(TARGET_FFS_FILE) : $(SECTIONS)
+ $(GENFFSFILE) -B $(DEST_DIR) -P1 $(DEST_DIR)\$(BASE_NAME).pkg -V
+
+all : $(TARGET_FFS_FILE)
+
+[=============================================================================]
+[Package.SA_DMAR_ACPITABLE.Default]
+PACKAGE.INF
+\[.]
+BASE_NAME = $(BASE_NAME)
+FFS_FILEGUID = $(FILE_GUID)
+FFS_FILETYPE = EFI_FV_FILETYPE_FREEFORM
+FFS_ATTRIB_CHECKSUM = TRUE
+
+IMAGE_SCRIPT =
+{
+ Compress (Dummy) {
+ $(DEST_DIR)\Dmar\Dmar.sec
+ }
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/Include/IntelSaDxe.dsc b/ReferenceCode/Chipset/SystemAgent/Include/IntelSaDxe.dsc
new file mode 100644
index 0000000..06bcb9c
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Include/IntelSaDxe.dsc
@@ -0,0 +1,35 @@
+## @file
+# This is the build description file containing the Iio
+# DXE, Runtime DXE, SMM, legacy support or other later modules.
+#
+# This should be included in a [Components] section of the DSC files for a platform build.
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains an 'Intel Peripheral Driver' and uniquely
+# identified as "Intel Reference Module" and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+
+$(PROJECT_SA_ROOT)\SmbiosMemory\Dxe\SmbiosMemory.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_SA_ROOT)\SmmAccess\Dxe\SmmAccess.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_SA_ROOT)\PciHostBridge\Dxe\PciHostBridge.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_SA_ROOT)\Acpitables\SaAcpiTables_Edk.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_SA_ROOT)\Acpitables\SaSsdt\SaSsdt_Edk.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_SA_ROOT)\SaInit\Dxe\SaInit.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_SA_ROOT)\BdatAccessHandler\Dxe\BdatAccessHandler.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+#
+# Comment out below line if ASPM Init After Oprom was not supported
+#
+$(PROJECT_SA_ROOT)\SaInit\Smm\SaLateInitSmm.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
diff --git a/ReferenceCode/Chipset/SystemAgent/Include/IntelSaDxeLib.dsc b/ReferenceCode/Chipset/SystemAgent/Include/IntelSaDxeLib.dsc
new file mode 100644
index 0000000..9b7fe1f
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Include/IntelSaDxeLib.dsc
@@ -0,0 +1,31 @@
+## @file
+# This is the build description file containing the SA library modules.
+# This should be included in a [Libraries] section of the DSC files for a platform build.
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+$(PROJECT_SA_ROOT)\Protocol\IntelSaProtocolLib.inf
+$(PROJECT_SA_ROOT)\Guid\SaGuidLib.inf
+$(PROJECT_SA_ROOT)\Library\SaPcieLib\Dxe\SaPcieDxeLib.inf
+$(PROJECT_SA_ROOT)\Library\SaPcieLib\Smm\SaPcieSmmLib.inf
+
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+# $(PROJECT_SA_ROOT)\SampleCode\Protocol\IntelSaSampleCodeProtocolLib.inf
diff --git a/ReferenceCode/Chipset/SystemAgent/Include/IntelSaPei.dsc b/ReferenceCode/Chipset/SystemAgent/Include/IntelSaPei.dsc
new file mode 100644
index 0000000..0b1f05f
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Include/IntelSaPei.dsc
@@ -0,0 +1,24 @@
+## @file
+# This is the build description file containing the System Agent PEI modules.
+#
+# This should be included in a [Components] section of the DSC files for a platform build.
+#
+#@copyright
+# Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+$(PROJECT_SA_ROOT)\MemoryInit\Pei\MemoryInit.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_SA_ROOT)\SaInit\Pei\SaInitPeim.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+
diff --git a/ReferenceCode/Chipset/SystemAgent/Include/IntelSaPeiLib.dsc b/ReferenceCode/Chipset/SystemAgent/Include/IntelSaPeiLib.dsc
new file mode 100644
index 0000000..556d529
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Include/IntelSaPeiLib.dsc
@@ -0,0 +1,29 @@
+## @file
+# This is the build description file containing the IIO library modules.
+# This should be included in a [Libraries] section of the DSC files for a platform build.
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+$(PROJECT_SA_ROOT)\Guid\SaGuidLib.inf
+$(PROJECT_SA_ROOT)\Ppi\IntelSaPpiLib.inf
+$(PROJECT_SA_ROOT)\SampleCode\Ppi\IntelSaSampleCodePpiLib.inf
+
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
diff --git a/ReferenceCode/Chipset/SystemAgent/Include/IntelSaSsdtAcpiTables.dsc b/ReferenceCode/Chipset/SystemAgent/Include/IntelSaSsdtAcpiTables.dsc
new file mode 100644
index 0000000..8f3ced6
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Include/IntelSaSsdtAcpiTables.dsc
@@ -0,0 +1,67 @@
+## @file
+# Build description file for building the SA SSDT ACPI tables
+#
+#@copyright
+# Copyright (c) 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[=============================================================================]
+#
+# Instructions for building the SA SSDT ACPI table storage file
+#
+[=============================================================================]
+[Build.Ia32.SA_SSDT_ACPITABLE,Build.x64.SA_SSDT_ACPITABLE]
+#
+# Check if we have any source to work with.
+#
+!IFNDEF SECTIONS
+!IFNDEF ASL_FILES
+!ERROR No ASL source files to build were defined in the INF file
+!ENDIF
+!ENDIF
+
+#
+# Define some macros to simplify changes
+#
+TARGET_FFS_FILE = $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).ffs
+
+$(DEST_DIR)\SaSsdt.sec : $(ASL_SOURCE_FILES) $(ASL_FILES)
+ $(ASL) $(ASL_FLAGS) $(DEST_DIR)\SaSsdt.asl
+ -copy $(DEST_DIR)\SaSsdt.aml $(DEST_DIR)\SaSsdt.acpi
+ $(GENSECTION) -I $(DEST_DIR)\SaSsdt.acpi -O $(DEST_DIR)\SaSsdt.sec -S EFI_SECTION_RAW
+
+#
+# Build FFS file
+#
+$(TARGET_FFS_FILE) : $(SECTIONS) $(DEST_DIR)\SaSsdt.sec
+ $(GENFFSFILE) -B $(DEST_DIR) -P1 $(DEST_DIR)\$(BASE_NAME).pkg -V
+
+all : $(TARGET_FFS_FILE)
+
+[=============================================================================]
+[Package.SA_SSDT_ACPITABLE.Default]
+PACKAGE.INF
+\[.]
+BASE_NAME = $(BASE_NAME)
+FFS_FILEGUID = $(FILE_GUID)
+FFS_FILETYPE = EFI_FV_FILETYPE_FREEFORM
+FFS_ATTRIB_CHECKSUM = TRUE
+
+IMAGE_SCRIPT =
+{
+ Compress (Dummy) {
+ $(DEST_DIR)\SaSsdt.sec
+ }
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/Include/SaAccess.h b/ReferenceCode/Chipset/SystemAgent/Include/SaAccess.h
new file mode 100644
index 0000000..ab0490f
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Include/SaAccess.h
@@ -0,0 +1,290 @@
+/** @file
+ Macros to simplify and abstract the interface to PCI configuration.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _SAACCESS_H_
+#define _SAACCESS_H_
+
+#include "SaRegs.h"
+#include "SaCommonDefinitions.h"
+
+///
+/// SystemAgent Base Address definition
+///
+#ifndef MCH_BASE_ADDRESS
+#define MCH_BASE_ADDRESS 0xfed10000
+#endif
+#ifndef STALL_ONE_MICRO_SECOND
+#define STALL_ONE_MICRO_SECOND 1
+#endif
+#ifndef STALL_ONE_MILLI_SECOND
+#define STALL_ONE_MILLI_SECOND 1000
+#endif
+
+//
+// SA DMI configuration
+//
+#define SA_DMI_MAX_LANE 0x04
+#define SA_DMI_MAX_BUNDLE 0x02
+
+//
+// SA PCI Express* Port configuration
+//
+#define SA_PEG_BUS_NUM 0x00
+#define SA_PEG_DEV_NUM 0x01
+#define SA_PEG10_DEV_NUM SA_PEG_DEV_NUM
+#define SA_PEG10_FUN_NUM 0x00
+#define SA_PEG11_DEV_NUM SA_PEG_DEV_NUM
+#define SA_PEG11_FUN_NUM 0x01
+#define SA_PEG12_DEV_NUM SA_PEG_DEV_NUM
+#define SA_PEG12_FUN_NUM 0x02
+#define SA_PEG_MAX_FUN 0x03
+#define SA_PEG_MAX_LANE 0x10
+#define SA_PEG_MAX_BUNDLE 0x08
+
+#define SA_SWING_HALF 0x1
+#define SA_SWING_FULL 0x2
+
+///
+/// PCI Express* Port configuration Hardware Strapping value
+///
+#define SA_PEG_x8_x4_x4 0x00
+#define SA_PEG_x8_x8_x0 0x02
+#define SA_PEG_x16_x0_x0 0x03
+
+///
+/// System Agent PCI access macros
+///
+///
+/// Device #, Function #
+///
+#define McDevFunPciCfg64(Bus, Dev, Func, Register) MmPci64 (0, Bus, Dev, Func, Register)
+#define McDevFunPciCfg64Or(Bus, Dev, Func, Register, OrData) MmPci64Or (0, Bus, Dev, Func, Register, OrData)
+#define McDevFunPciCfg64And(Bus, Dev, Func, Register, AndData) MmPci64And (0, Bus, Dev, Func, Register, AndData)
+#define McDevFunPciCfg64AndThenOr(Bus, Dev, Func, Register, AndData, OrData) \
+ MmPci64AndThenOr (0, \
+ Bus, \
+ Dev, \
+ Func, \
+ Register, \
+ AndData, \
+ OrData \
+ )
+
+#define McDevFunPciCfg32(Bus, Dev, Func, Register) MmPci32 (0, Bus, Dev, Func, Register)
+#define McDevFunPciCfg32Or(Bus, Dev, Func, Register, OrData) MmPci32Or (0, Bus, Dev, Func, Register, OrData)
+#define McDevFunPciCfg32And(Bus, Dev, Func, Register, AndData) MmPci32And (0, Bus, Dev, Func, Register, AndData)
+#define McDevFunPciCfg32AndThenOr(Bus, Dev, Func, Register, AndData, OrData) \
+ MmPci32AndThenOr (0, \
+ Bus, \
+ Dev, \
+ Func, \
+ Register, \
+ AndData, \
+ OrData \
+ )
+
+#define McDevFunPciCfg16(Bus, Dev, Func, Register) MmPci16 (0, Bus, Dev, Func, Register)
+#define McDevFunPciCfg16Or(Bus, Dev, Func, Register, OrData) MmPci16Or (0, Bus, Dev, Func, Register, OrData)
+#define McDevFunPciCfg16And(Bus, Dev, Func, Register, AndData) MmPci16And (0, Bus, Dev, Func, Register, AndData)
+#define McDevFunPciCfg16AndThenOr(Bus, Dev, Func, Register, AndData, OrData) \
+ MmPci16AndThenOr (0, \
+ Bus, \
+ Dev, \
+ Func, \
+ Register, \
+ AndData, \
+ OrData \
+ )
+
+#define McDevFunPciCfg8(Bus, Dev, Func, Register) MmPci8 (0, Bus, Dev, Func, Register)
+#define McDevFunPciCfg8Or(Bus, Dev, Func, Register, OrData) MmPci8Or (0, Bus, Dev, Func, Register, OrData)
+#define McDevFunPciCfg8And(Bus, Dev, Func, Register, AndData) MmPci8And (0, Bus, Dev, Func, Register, AndData)
+#define McDevFunPciCfg8AndThenOr(Bus, Dev, Func, Register, AndData, OrData) \
+ MmPci8AndThenOr (0, \
+ Bus, \
+ Dev, \
+ Func, \
+ Register, \
+ AndData, \
+ OrData \
+ )
+
+///
+/// Device 0, Function 0
+///
+#define McD0PciCfg64(Register) MmPci64 (0, SA_MC_BUS, 0, 0, Register)
+#define McD0PciCfg64Or(Register, OrData) MmPci64Or (0, SA_MC_BUS, 0, 0, Register, OrData)
+#define McD0PciCfg64And(Register, AndData) MmPci64And (0, SA_MC_BUS, 0, 0, Register, AndData)
+#define McD0PciCfg64AndThenOr(Register, AndData, OrData) MmPci64AndThenOr (0, SA_MC_BUS, 0, 0, Register, AndData, OrData)
+
+#define McD0PciCfg32(Register) MmPci32 (0, SA_MC_BUS, 0, 0, Register)
+#define McD0PciCfg32Or(Register, OrData) MmPci32Or (0, SA_MC_BUS, 0, 0, Register, OrData)
+#define McD0PciCfg32And(Register, AndData) MmPci32And (0, SA_MC_BUS, 0, 0, Register, AndData)
+#define McD0PciCfg32AndThenOr(Register, AndData, OrData) MmPci32AndThenOr (0, SA_MC_BUS, 0, 0, Register, AndData, OrData)
+
+#define McD0PciCfg16(Register) MmPci16 (0, SA_MC_BUS, 0, 0, Register)
+#define McD0PciCfg16Or(Register, OrData) MmPci16Or (0, SA_MC_BUS, 0, 0, Register, OrData)
+#define McD0PciCfg16And(Register, AndData) MmPci16And (0, SA_MC_BUS, 0, 0, Register, AndData)
+#define McD0PciCfg16AndThenOr(Register, AndData, OrData) MmPci16AndThenOr (0, SA_MC_BUS, 0, 0, Register, AndData, OrData)
+
+#define McD0PciCfg8(Register) MmPci8 (0, SA_MC_BUS, 0, 0, Register)
+#define McD0PciCfg8Or(Register, OrData) MmPci8Or (0, SA_MC_BUS, 0, 0, Register, OrData)
+#define McD0PciCfg8And(Register, AndData) MmPci8And (0, SA_MC_BUS, 0, 0, Register, AndData)
+#define McD0PciCfg8AndThenOr(Register, AndData, OrData) MmPci8AndThenOr (0, SA_MC_BUS, 0, 0, Register, AndData, OrData)
+
+///
+/// Device 1, Function 0
+///
+#define McD1PciCfg64(Register) MmPci64 (0, SA_MC_BUS, 1, 0, Register)
+#define McD1PciCfg64Or(Register, OrData) MmPci64Or (0, SA_MC_BUS, 1, 0, Register, OrData)
+#define McD1PciCfg64And(Register, AndData) MmPci64And (0, SA_MC_BUS, 1, 0, Register, AndData)
+#define McD1PciCfg64AndThenOr(Register, AndData, OrData) MmPci64AndThenOr (0, SA_MC_BUS, 1, 0, Register, AndData, OrData)
+
+#define McD1PciCfg32(Register) MmPci32 (0, SA_MC_BUS, 1, 0, Register)
+#define McD1PciCfg32Or(Register, OrData) MmPci32Or (0, SA_MC_BUS, 1, 0, Register, OrData)
+#define McD1PciCfg32And(Register, AndData) MmPci32And (0, SA_MC_BUS, 1, 0, Register, AndData)
+#define McD1PciCfg32AndThenOr(Register, AndData, OrData) MmPci32AndThenOr (0, SA_MC_BUS, 1, 0, Register, AndData, OrData)
+
+#define McD1PciCfg16(Register) MmPci16 (0, SA_MC_BUS, 1, 0, Register)
+#define McD1PciCfg16Or(Register, OrData) MmPci16Or (0, SA_MC_BUS, 1, 0, Register, OrData)
+#define McD1PciCfg16And(Register, AndData) MmPci16And (0, SA_MC_BUS, 1, 0, Register, AndData)
+#define McD1PciCfg16AndThenOr(Register, AndData, OrData) MmPci16AndThenOr (0, SA_MC_BUS, 1, 0, Register, AndData, OrData)
+
+#define McD1PciCfg8(Register) MmPci8 (0, SA_MC_BUS, 1, 0, Register)
+#define McD1PciCfg8Or(Register, OrData) MmPci8Or (0, SA_MC_BUS, 1, 0, Register, OrData)
+#define McD1PciCfg8And(Register, AndData) MmPci8And (0, SA_MC_BUS, 1, 0, Register, AndData)
+#define McD1PciCfg8AndThenOr(Register, AndData, OrData) MmPci8AndThenOr (0, SA_MC_BUS, 1, 0, Register, AndData, OrData)
+
+///
+/// Device 1, Function 1
+///
+#define McD1F1PciCfg64(Register) MmPci64 (0, SA_MC_BUS, 1, 1, Register)
+#define McD1F1PciCfg64Or(Register, OrData) MmPci64Or (0, SA_MC_BUS, 1, 1, Register, OrData)
+#define McD1F1PciCfg64And(Register, AndData) MmPci64And (0, SA_MC_BUS, 1, 1, Register, AndData)
+#define McD1F1PciCfg64AndThenOr(Register, AndData, OrData) MmPci64AndThenOr (0, SA_MC_BUS, 1, 1, Register, AndData, OrData)
+
+#define McD1F1PciCfg32(Register) MmPci32 (0, SA_MC_BUS, 1, 1, Register)
+#define McD1F1PciCfg32Or(Register, OrData) MmPci32Or (0, SA_MC_BUS, 1, 1, Register, OrData)
+#define McD1F1PciCfg32And(Register, AndData) MmPci32And (0, SA_MC_BUS, 1, 1, Register, AndData)
+#define McD1F1PciCfg32AndThenOr(Register, AndData, OrData) MmPci32AndThenOr (0, SA_MC_BUS, 1, 1, Register, AndData, OrData)
+
+#define McD1F1PciCfg16(Register) MmPci16 (0, SA_MC_BUS, 1, 1, Register)
+#define McD1F1PciCfg16Or(Register, OrData) MmPci16Or (0, SA_MC_BUS, 1, 1, Register, OrData)
+#define McD1F1PciCfg16And(Register, AndData) MmPci16And (0, SA_MC_BUS, 1, 1, Register, AndData)
+#define McD1F1PciCfg16AndThenOr(Register, AndData, OrData) MmPci16AndThenOr (0, SA_MC_BUS, 1, 1, Register, AndData, OrData)
+
+#define McD1F1PciCfg8(Register) MmPci8 (0, SA_MC_BUS, 1, 1, Register)
+#define McD1F1PciCfg8Or(Register, OrData) MmPci8Or (0, SA_MC_BUS, 1, 1, Register, OrData)
+#define McD1F1PciCfg8And(Register, AndData) MmPci8And (0, SA_MC_BUS, 1, 1, Register, AndData)
+#define McD1F1PciCfg8AndThenOr(Register, AndData, OrData) MmPci8AndThenOr (0, SA_MC_BUS, 1, 1, Register, AndData, OrData)
+
+///
+/// Device 1, Function 2
+///
+#define McD1F2PciCfg64(Register) MmPci64 (0, SA_MC_BUS, 1, 2, Register)
+#define McD1F2PciCfg64Or(Register, OrData) MmPci64Or (0, SA_MC_BUS, 1, 2, Register, OrData)
+#define McD1F2PciCfg64And(Register, AndData) MmPci64And (0, SA_MC_BUS, 1, 2, Register, AndData)
+#define McD1F2PciCfg64AndThenOr(Register, AndData, OrData) MmPci64AndThenOr (0, SA_MC_BUS, 1, 2, Register, AndData, OrData)
+
+#define McD1F2PciCfg32(Register) MmPci32 (0, SA_MC_BUS, 1, 2, Register)
+#define McD1F2PciCfg32Or(Register, OrData) MmPci32Or (0, SA_MC_BUS, 1, 2, Register, OrData)
+#define McD1F2PciCfg32And(Register, AndData) MmPci32And (0, SA_MC_BUS, 1, 2, Register, AndData)
+#define McD1F2PciCfg32AndThenOr(Register, AndData, OrData) MmPci32AndThenOr (0, SA_MC_BUS, 1, 2, Register, AndData, OrData)
+
+#define McD1F2PciCfg16(Register) MmPci16 (0, SA_MC_BUS, 1, 2, Register)
+#define McD1F2PciCfg16Or(Register, OrData) MmPci16Or (0, SA_MC_BUS, 1, 2, Register, OrData)
+#define McD1F2PciCfg16And(Register, AndData) MmPci16And (0, SA_MC_BUS, 1, 2, Register, AndData)
+#define McD1F2PciCfg16AndThenOr(Register, AndData, OrData) MmPci16AndThenOr (0, SA_MC_BUS, 1, 2, Register, AndData, OrData)
+
+#define McD1F2PciCfg8(Register) MmPci8 (0, SA_MC_BUS, 1, 2, Register)
+#define McD1F2PciCfg8Or(Register, OrData) MmPci8Or (0, SA_MC_BUS, 1, 2, Register, OrData)
+#define McD1F2PciCfg8And(Register, AndData) MmPci8And (0, SA_MC_BUS, 1, 2, Register, AndData)
+#define McD1F2PciCfg8AndThenOr(Register, AndData, OrData) MmPci8AndThenOr (0, SA_MC_BUS, 1, 2, Register, AndData, OrData)
+
+///
+/// Device 2, Function 0
+///
+#define McD2PciCfg64(Register) MmPci64 (0, SA_MC_BUS, 2, 0, Register)
+#define McD2PciCfg64Or(Register, OrData) MmPci64Or (0, SA_MC_BUS, 2, 0, Register, OrData)
+#define McD2PciCfg64And(Register, AndData) MmPci64And (0, SA_MC_BUS, 2, 0, Register, AndData)
+#define McD2PciCfg64AndThenOr(Register, AndData, OrData) MmPci64AndThenOr (0, SA_MC_BUS, 2, 0, Register, AndData, OrData)
+
+#define McD2PciCfg32(Register) MmPci32 (0, SA_MC_BUS, 2, 0, Register)
+#define McD2PciCfg32Or(Register, OrData) MmPci32Or (0, SA_MC_BUS, 2, 0, Register, OrData)
+#define McD2PciCfg32And(Register, AndData) MmPci32And (0, SA_MC_BUS, 2, 0, Register, AndData)
+#define McD2PciCfg32AndThenOr(Register, AndData, OrData) MmPci32AndThenOr (0, SA_MC_BUS, 2, 0, Register, AndData, OrData)
+
+#define McD2PciCfg16(Register) MmPci16 (0, SA_MC_BUS, 2, 0, Register)
+#define McD2PciCfg16Or(Register, OrData) MmPci16Or (0, SA_MC_BUS, 2, 0, Register, OrData)
+#define McD2PciCfg16And(Register, AndData) MmPci16And (0, SA_MC_BUS, 2, 0, Register, AndData)
+#define McD2PciCfg16AndThenOr(Register, AndData, OrData) MmPci16AndThenOr (0, SA_MC_BUS, 2, 0, Register, AndData, OrData)
+
+#define McD2PciCfg8(Register) MmPci8 (0, SA_MC_BUS, 2, 0, Register)
+#define McD2PciCfg8Or(Register, OrData) MmPci8Or (0, SA_MC_BUS, 2, 0, Register, OrData)
+#define McD2PciCfg8And(Register, AndData) MmPci8And (0, SA_MC_BUS, 2, 0, Register, AndData)
+#define McD2PciCfg8AndThenOr(Register, AndData, OrData) MmPci8AndThenOr (0, SA_MC_BUS, 2, 0, Register, AndData, OrData)
+
+///
+/// Device 22, Function 0
+///
+#define PchD22PciCfg32(Register) MmPci32 (0, 0, 22, 0, Register)
+#define PchD22PciCfg32Or(Register, OrData) MmPci32Or (0, 0, 22, 0, Register, OrData)
+#define PchD22PciCfg32And(Register, AndData) MmPci32And (0, 0, 22, 0, Register, AndData)
+#define PchD22PciCfg32AndThenOr(Register, AndData, OrData) MmPci32AndThenOr (0, 0, 22, 0, Register, AndData, OrData)
+
+///
+/// Memory Controller Hub Memory Mapped IO register access
+///
+#define MCH_REGION_BASE (McD0PciCfg64 (R_SA_MCHBAR) &~BIT0)
+#define McMmioAddress(Register) ((UINTN) MCH_REGION_BASE + (UINTN) (Register))
+
+#define McMmio32Ptr(Register) ((volatile UINT32 *) McMmioAddress (Register))
+#define McMmio64Ptr(Register) ((volatile UINT64 *) McMmioAddress (Register))
+
+#define McMmio64(Register) *McMmio64Ptr (Register)
+#define McMmio64Or(Register, OrData) (McMmio64 (Register) |= (UINT64) (OrData))
+#define McMmio64And(Register, AndData) (McMmio64 (Register) &= (UINT64) (AndData))
+#define McMmio64AndThenOr(Register, AndData, OrData) \
+ (McMmio64 (Register) = (McMmio64 (Register) & (UINT64) (AndData)) | (UINT64) (OrData))
+
+#define McMmio32(Register) *McMmio32Ptr (Register)
+#define McMmio32Or(Register, OrData) (McMmio32 (Register) |= (UINT32) (OrData))
+#define McMmio32And(Register, AndData) (McMmio32 (Register) &= (UINT32) (AndData))
+#define McMmio32AndThenOr(Register, AndData, OrData) \
+ (McMmio32 (Register) = (McMmio32 (Register) & (UINT32) (AndData)) | (UINT32) (OrData))
+
+#define McMmio16Ptr(Register) ((volatile UINT16 *) McMmioAddress (Register))
+#define McMmio16(Register) *McMmio16Ptr (Register)
+#define McMmio16Or(Register, OrData) (McMmio16 (Register) |= (UINT16) (OrData))
+#define McMmio16And(Register, AndData) (McMmio16 (Register) &= (UINT16) (AndData))
+#define McMmio16AndThenOr(Register, AndData, OrData) \
+ (McMmio16 (Register) = (McMmio16 (Register) & (UINT16) (AndData)) | (UINT16) (OrData))
+
+#define McMmio8Ptr(Register) ((volatile UINT8 *) McMmioAddress (Register))
+#define McMmio8(Register) *McMmio8Ptr (Register)
+#define McMmio8Or(Register, OrData) (McMmio8 (Register) |= (UINT8) (OrData))
+#define McMmio8And(Register, AndData) (McMmio8 (Register) &= (UINT8) (AndData))
+#define McMmio8AndThenOr(Register, AndData, OrData) \
+ (McMmio8 (Register) = (McMmio8 (Register) & (UINT8) (AndData)) | (UINT8) (OrData))
+
+#define MmioR32(Address) (*(volatile UINT32 *) (UINTN) (Address))
+#define MmioW32(Address, Value) (*(volatile UINT32 *) (UINTN) (Address) = (Value))
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/Include/SaBuildFlags.h b/ReferenceCode/Chipset/SystemAgent/Include/SaBuildFlags.h
new file mode 100644
index 0000000..28ef269
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Include/SaBuildFlags.h
@@ -0,0 +1,37 @@
+/** @file
+ Defines SA build flags
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+#ifndef _SA_BUILD_FLAGS_H_
+#define _SA_BUILD_FLAGS_H_
+
+///
+/// These build flags can be overridden by defining them
+/// in compiling environment variable
+///
+#ifndef SA_PCIE_ASPM_IN_DXE
+#define SA_PCIE_ASPM_IN_DXE 1
+#endif
+
+#ifndef SA_PCIE_ASPM_IN_SMM
+#define SA_PCIE_ASPM_IN_SMM 1
+#endif
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/Include/SaCommonDefinitions.h b/ReferenceCode/Chipset/SystemAgent/Include/SaCommonDefinitions.h
new file mode 100644
index 0000000..cfcb39f
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Include/SaCommonDefinitions.h
@@ -0,0 +1,424 @@
+/** @file
+ This header file provides common definitions just for System Agent using to avoid including extra module's file.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _SA_COMMON_DEFINITIONS_H_
+#define _SA_COMMON_DEFINITIONS_H_
+
+#ifndef PCI_VID
+#define PCI_VID 0x0000 ///< Vendor ID Register
+#define PCI_DID 0x0002 ///< Device ID Register
+#define PCI_CMD 0x0004 ///< PCI Command Register
+#define PCI_STS 0x0006 ///< PCI Status Register
+#define PCI_RID 0x0008 ///< Revision ID Register
+#define PCI_IFT 0x0009 ///< Interface Type
+#define PCI_SCC 0x000A ///< Sub Class Code Register
+#define PCI_BCC 0x000B ///< Base Class Code Register
+#define PCI_CLS 0x000C ///< Cache Line Size
+#define PCI_PMLT 0x000D ///< Primary Master Latency Timer
+#define PCI_HDR 0x000E ///< Header Type Register
+#define PCI_BIST 0x000F ///< Built in Self Test Register
+#define PCI_BAR0 0x0010 ///< Base Address Register 0
+#define PCI_BAR1 0x0014 ///< Base Address Register 1
+#define PCI_BAR2 0x0018 ///< Base Address Register 2
+#define PCI_PBUS 0x0018 ///< Primary Bus Number Register
+#define PCI_SBUS 0x0019 ///< Secondary Bus Number Register
+#define PCI_SUBUS 0x001A ///< Subordinate Bus Number Register
+#define PCI_SMLT 0x001B ///< Secondary Master Latency Timer
+#define PCI_BAR3 0x001C ///< Base Address Register 3
+#define PCI_IOBASE 0x001C ///< I/O base Register
+#define PCI_IOLIMIT 0x001D ///< I/O Limit Register
+#define PCI_SECSTATUS 0x001E ///< Secondary Status Register
+#define PCI_BAR4 0x0020 ///< Base Address Register 4
+#define PCI_MEMBASE 0x0020 ///< Memory Base Register
+#define PCI_MEMLIMIT 0x0022 ///< Memory Limit Register
+#define PCI_BAR5 0x0024 ///< Base Address Register 5
+#define PCI_PRE_MEMBASE 0x0024 ///< Prefetchable memory Base register
+#define PCI_PRE_MEMLIMIT 0x0026 ///< Prefetchable memory Limit register
+#define PCI_PRE_MEMBASE_U 0x0028 ///< Prefetchable memory base upper 32 bits
+#define PCI_PRE_MEMLIMIT_U 0x002C ///< Prefetchable memory limit upper 32 bits
+#define PCI_SVID 0x002C ///< Subsystem Vendor ID
+#define PCI_SID 0x002E ///< Subsystem ID
+#define PCI_IOBASE_U 0x0030 ///< I/O base Upper Register
+#define PCI_IOLIMIT_U 0x0032 ///< I/O Limit Upper Register
+#define PCI_CAPP 0x0034 ///< Capabilities Pointer
+#define PCI_EROM 0x0038 ///< Expansion ROM Base Address
+#define PCI_INTLINE 0x003C ///< Interrupt Line Register
+#define PCI_INTPIN 0x003D ///< Interrupt Pin Register
+#define PCI_MAXGNT 0x003E ///< Max Grant Register
+#define PCI_BRIDGE_CNTL 0x003E ///< Bridge Control Register
+#define PCI_MAXLAT 0x003F ///< Max Latency Register
+#endif
+
+#ifndef BIT0
+#define BIT0 0x0001
+#define BIT1 0x0002
+#define BIT2 0x0004
+#define BIT3 0x0008
+#define BIT4 0x0010
+#define BIT5 0x0020
+#define BIT6 0x0040
+#define BIT7 0x0080
+#define BIT8 0x0100
+#define BIT9 0x0200
+#ifndef BIT10
+#define BIT10 0x0400
+#define BIT11 0x0800
+#define BIT12 0x1000
+#define BIT13 0x2000
+#define BIT14 0x4000
+#define BIT15 0x8000
+#endif
+#define BIT16 0x00010000
+#define BIT17 0x00020000
+#define BIT18 0x00040000
+#define BIT19 0x00080000
+#define BIT20 0x00100000
+#define BIT21 0x00200000
+#define BIT22 0x00400000
+#define BIT23 0x00800000
+#define BIT24 0x01000000
+#define BIT25 0x02000000
+#define BIT26 0x04000000
+#define BIT27 0x08000000
+#define BIT28 0x10000000
+#define BIT29 0x20000000
+#define BIT30 0x40000000
+#define BIT31 0x80000000
+#endif
+#define ERROR_BY_16 (0xEE15)
+#define ERROR_NOT_BY_16 (0xED15)
+
+#define MAX_PCIE_ASPM_OVERRIDE 500
+#define MAX_PCIE_LTR_OVERRIDE 500
+
+///
+/// Common code version reporting structure
+///
+typedef struct {
+ UINT8 Major; ///< Major version number
+ UINT8 Minor; ///< Minor version number
+ UINT8 Rev; ///< Revision number
+ UINT8 Build; ///< Build number
+} CodeVersion;
+
+///
+/// Common Memory mapped Io access macros
+///
+#define MmioAddress(BaseAddr, Register) \
+ ((UINTN) BaseAddr + (UINTN) (Register))
+
+///
+/// Macro to point to a 64 bit MMIO Address
+///
+#define Mmio64Ptr(BaseAddr, Register) \
+ ((volatile UINT64 *) MmioAddress (BaseAddr, Register))
+///
+/// Macro to get the value from a 64 bit MMIO Address
+///
+#define Mmio64(BaseAddr, Register) \
+ *Mmio64Ptr (BaseAddr, Register)
+///
+/// Macro to get a value from a 64 bit MMIO Address, perform a logical OR with
+/// the given data and then write it back to the same address
+///
+#define Mmio64Or(BaseAddr, Register, OrData) \
+ Mmio64 (BaseAddr, Register) = (UINT64) \
+ (Mmio64 (BaseAddr, Register) | (UINT64) (OrData))
+///
+/// Macro to get a value from a 64 bit MMIO Address, perform a logical AND with
+/// the given data and then write it back to the same address
+///
+#define Mmio64And(BaseAddr, Register, AndData) \
+ Mmio64 (BaseAddr, Register) = (UINT64) \
+ (Mmio64 (BaseAddr, Register) & (UINT64) (AndData))
+///
+/// Macro to get a value from a 64 bit MMIO Address, perform a logical AND and
+/// then a OR with the given data and then write it back to the same address
+///
+#define Mmio64AndThenOr(BaseAddr, Register, AndData, OrData) \
+ Mmio64 (BaseAddr, Register) = (UINT64) \
+ ((Mmio64 (BaseAddr, Register) & (UINT64) (AndData)) | (UINT64) (OrData))
+
+///
+/// Macro to point to a 32 bit MMIO Address
+///
+#define Mmio32Ptr(BaseAddr, Register) \
+ ((volatile UINT32 *) MmioAddress (BaseAddr, Register))
+///
+/// Macro to get the value from a 32 bit MMIO Address
+///
+#define Mmio32(BaseAddr, Register) \
+ *Mmio32Ptr (BaseAddr, Register)
+///
+/// Macro to get a value from a 32 bit MMIO Address, perform a logical OR with
+/// the given data and then write it back to the same address
+///
+#define Mmio32Or(BaseAddr, Register, OrData) \
+ Mmio32 (BaseAddr, Register) = (UINT32) \
+ (Mmio32 (BaseAddr, Register) | (UINT32) (OrData))
+///
+/// Macro to get a value from a 32 bit MMIO Address, perform a logical AND with
+/// the given data and then write it back to the same address
+///
+#define Mmio32And(BaseAddr, Register, AndData) \
+ Mmio32 (BaseAddr, Register) = (UINT32) \
+ (Mmio32 (BaseAddr, Register) & (UINT32) (AndData))
+///
+/// Macro to get a value from a 32 bit MMIO Address, perform a logical AND and
+/// then a OR with the given data and then write it back to the same address
+///
+#define Mmio32AndThenOr(BaseAddr, Register, AndData, OrData) \
+ Mmio32 (BaseAddr, Register) = (UINT32) \
+ ((Mmio32 (BaseAddr, Register) & (UINT32) (AndData)) | (UINT32) (OrData))
+
+///
+/// Macro to point to a 16 bit MMIO Address
+///
+#define Mmio16Ptr(BaseAddr, Register) \
+ ((volatile UINT16 *) MmioAddress (BaseAddr, Register))
+///
+/// Macro to get the value from a 16 bit MMIO Address
+///
+#define Mmio16(BaseAddr, Register) \
+ *Mmio16Ptr (BaseAddr, Register)
+///
+/// Macro to get a value from a 16 bit MMIO Address, perform a logical OR with
+/// the given data and then write it back to the same address
+///
+#define Mmio16Or(BaseAddr, Register, OrData) \
+ Mmio16 (BaseAddr, Register) = (UINT16) \
+ (Mmio16 (BaseAddr, Register) | (UINT16) (OrData))
+///
+/// Macro to get a value from a 16 bit MMIO Address, perform a logical AND with
+/// the given data and then write it back to the same address
+///
+#define Mmio16And(BaseAddr, Register, AndData) \
+ Mmio16 (BaseAddr, Register) = (UINT16) \
+ (Mmio16 (BaseAddr, Register) & (UINT16) (AndData))
+///
+/// Macro to get a value from a 16 bit MMIO Address, perform a logical AND and
+/// then a OR with the given data and then write it back to the same address
+///
+#define Mmio16AndThenOr(BaseAddr, Register, AndData, OrData) \
+ Mmio16 (BaseAddr, Register) = (UINT16) \
+ ((Mmio16 (BaseAddr, Register) & (UINT16) (AndData)) | (UINT16) (OrData))
+
+///
+/// Macro to point to a 8 bit MMIO Address
+///
+#define Mmio8Ptr(BaseAddr, Register) \
+ ((volatile UINT8 *) MmioAddress (BaseAddr, Register))
+///
+/// Macro to get the value from a 8 bit MMIO Address
+///
+#define Mmio8(BaseAddr, Register) \
+ *Mmio8Ptr (BaseAddr, Register)
+///
+/// Macro to get a value from a 8 bit MMIO Address, perform a logical OR with
+/// the given data and then write it back to the same address
+///
+#define Mmio8Or(BaseAddr, Register, OrData) \
+ Mmio8 (BaseAddr, Register) = (UINT8) \
+ (Mmio8 (BaseAddr, Register) | (UINT8) (OrData))
+///
+/// Macro to get a value from a 8 bit MMIO Address, perform a logical AND with
+/// the given data and then write it back to the same address
+///
+#define Mmio8And(BaseAddr, Register, AndData) \
+ Mmio8 (BaseAddr, Register) = (UINT8) \
+ (Mmio8 (BaseAddr, Register) & (UINT8) (AndData))
+///
+/// Macro to get a value from a 8 bit MMIO Address, perform a logical AND and
+/// then a OR with the given data and then write it back to the same address
+///
+#define Mmio8AndThenOr(BaseAddr, Register, AndData, OrData) \
+ Mmio8 (BaseAddr, Register) = (UINT8) \
+ ((Mmio8 (BaseAddr, Register) & (UINT8) (AndData)) | (UINT8) (OrData))
+
+///
+/// Common Memory mapped Pci access macros
+///
+#ifndef MmPciAddress
+#define MmPciAddress(Segment, Bus, Device, Function, Register) \
+ ((UINTN) (PciRead32 (PCI_LIB_ADDRESS (0,0,0,0x60)) & 0xFC000000) + \
+ (UINTN) (Bus << 20) + (UINTN) (Device << 15) + (UINTN) \
+ (Function << 12) + (UINTN) (Register))
+#endif
+
+///
+/// Macro to point to a 64 bit PCI Configuration Space Address
+///
+#define MmPci64Ptr(Segment, Bus, Device, Function, Register) \
+ ((volatile UINT64 *) MmPciAddress (Segment, Bus, Device, Function, Register))
+///
+/// Macro to get the value from a 64 bit PCI Configuration Space Address
+///
+#define MmPci64(Segment, Bus, Device, Function, Register) \
+ *MmPci64Ptr (Segment, Bus, Device, Function, Register)
+///
+/// Macro to get a value from a 64 bit PCI Configuration Space Address, perform
+/// a logical OR with the given data and then write it back to the same address
+///
+#define MmPci64Or(Segment, Bus, Device, Function, Register, OrData) \
+ MmPci64 (Segment, Bus, Device, Function, Register) = \
+ (UINT64) (MmPci64 (Segment, Bus, Device, Function, Register) | (UINT64) (OrData))
+///
+/// Macro to get a value from a 64 bit PCI Configuration Space Address, perform
+/// a logical AND with the given data and then write it back to the same address
+///
+#define MmPci64And(Segment, Bus, Device, Function, Register, AndData) \
+ MmPci64 (Segment, \
+ Bus, \
+ Device, \
+ Function, \
+ Register \
+ ) = (UINT64) (MmPci64 (Segment, Bus, Device, Function, Register) & (UINT64) (AndData))
+///
+/// Macro to get a value from a 64 bit PCI Configuration Space Address, perform
+/// a logical AND and then a OR with the given data and then write it back to the
+/// same address
+///
+#define MmPci64AndThenOr(Segment, Bus, Device, Function, Register, AndData, OrData) \
+ MmPci64 (Segment, \
+ Bus, \
+ Device, \
+ Function, \
+ Register \
+ ) = (UINT64) ((MmPci64 (Segment, Bus, Device, Function, Register) & (UINT64) (AndData)) | (UINT64) (OrData))
+
+///
+/// Macro to point to a 32 bit PCI Configuration Space Address
+///
+#define MmPci32Ptr(Segment, Bus, Device, Function, Register) \
+ ((volatile UINT32 *) MmPciAddress (Segment, Bus, Device, Function, Register))
+///
+/// Macro to get the value from a 32 bit PCI Configuration Space Address
+///
+#define MmPci32(Segment, Bus, Device, Function, Register) \
+ *MmPci32Ptr (Segment, Bus, Device, Function, Register)
+///
+/// Macro to get a value from a 32 bit PCI Configuration Space Address, perform
+/// a logical OR with the given data and then write it back to the same address
+///
+#define MmPci32Or(Segment, Bus, Device, Function, Register, OrData) \
+ MmPci32 (Segment, Bus, Device, Function, Register) = \
+ (UINT32) (MmPci32 (Segment, Bus, Device, Function, Register) | (UINT32) (OrData))
+///
+/// Macro to get a value from a 32 bit PCI Configuration Space Address, perform
+/// a logical AND with the given data and then write it back to the same address
+///
+#define MmPci32And(Segment, Bus, Device, Function, Register, AndData) \
+ MmPci32 (Segment, \
+ Bus, \
+ Device, \
+ Function, \
+ Register \
+ ) = (UINT32) (MmPci32 (Segment, Bus, Device, Function, Register) & (UINT32) (AndData))
+///
+/// Macro to get a value from a 32 bit PCI Configuration Space Address, perform
+/// a logical AND and then a OR with the given data and then write it back to the
+/// same address
+///
+#define MmPci32AndThenOr(Segment, Bus, Device, Function, Register, AndData, OrData) \
+ MmPci32 (Segment, \
+ Bus, \
+ Device, \
+ Function, \
+ Register \
+ ) = (UINT32) ((MmPci32 (Segment, Bus, Device, Function, Register) & (UINT32) (AndData)) | (UINT32) (OrData))
+
+///
+/// Macro to point to a 16 bit PCI Configuration Space Address
+///
+#define MmPci16Ptr(Segment, Bus, Device, Function, Register) \
+ ((volatile UINT16 *) MmPciAddress (Segment, Bus, Device, Function, Register))
+///
+/// Macro to get the value from a 16 bit PCI Configuration Space Address
+///
+#define MmPci16(Segment, Bus, Device, Function, Register) \
+ *MmPci16Ptr (Segment, Bus, Device, Function, Register)
+///
+/// Macro to get a value from a 16 bit PCI Configuration Space Address, perform
+/// a logical OR with the given data and then write it back to the same address
+///
+#define MmPci16Or(Segment, Bus, Device, Function, Register, OrData) \
+ MmPci16 (Segment, Bus, Device, Function, Register) = \
+ (UINT16) (MmPci16 (Segment, Bus, Device, Function, Register) | (UINT16) (OrData))
+///
+/// Macro to get a value from a 16 bit PCI Configuration Space Address, perform
+/// a logical AND with the given data and then write it back to the same address
+///
+#define MmPci16And(Segment, Bus, Device, Function, Register, AndData) \
+ MmPci16 (Segment, \
+ Bus, \
+ Device, \
+ Function, \
+ Register \
+ ) = (UINT16) (MmPci16 (Segment, Bus, Device, Function, Register) & (UINT16) (AndData))
+///
+/// Macro to get a value from a 16 bit PCI Configuration Space Address, perform
+/// a logical AND and then a OR with the given data and then write it back to the
+/// same address
+///
+#define MmPci16AndThenOr(Segment, Bus, Device, Function, Register, AndData, OrData) \
+ MmPci16 (Segment, \
+ Bus, \
+ Device, \
+ Function, \
+ Register \
+ ) = (UINT16) ((MmPci16 (Segment, Bus, Device, Function, Register) & (UINT16) (AndData)) | (UINT16) (OrData))
+
+///
+/// Macro to point to a 8 bit PCI Configuration Space Address
+///
+#define MmPci8Ptr(Segment, Bus, Device, Function, Register) \
+ ((volatile UINT8 *) MmPciAddress (Segment, Bus, Device, Function, Register))
+///
+/// Macro to get the value from a 8 bit PCI Configuration Space Address
+///
+#define MmPci8(Segment, Bus, Device, Function, Register) \
+ *MmPci8Ptr (Segment, Bus, Device, Function, Register)
+///
+/// Macro to get a value from a 8 bit PCI Configuration Space Address, perform
+/// a logical OR with the given data and then write it back to the same address
+///
+#define MmPci8Or(Segment, Bus, Device, Function, Register, OrData) \
+ MmPci8 (Segment, Bus, Device, Function, Register) = \
+ (UINT8) (MmPci8 (Segment, Bus, Device, Function, Register) | (UINT8) (OrData))
+///
+/// Macro to get a value from a 8 bit PCI Configuration Space Address, perform
+/// a logical AND with the given data and then write it back to the same address
+///
+#define MmPci8And(Segment, Bus, Device, Function, Register, AndData) \
+ MmPci8 (Segment, Bus, Device, Function, Register) = \
+ (UINT8) (MmPci8 (Segment, Bus, Device, Function, Register) & (UINT8) (AndData))
+///
+/// Macro to get a value from a 8 bit PCI Configuration Space Address, perform
+/// a logical AND and then a OR with the given data and then write it back to the
+/// same address
+///
+#define MmPci8AndThenOr(Segment, Bus, Device, Function, Register, AndData, OrData) \
+ MmPci8 (Segment, \
+ Bus, \
+ Device, \
+ Function, \
+ Register \
+ ) = (UINT8) ((MmPci8 (Segment, Bus, Device, Function, Register) & (UINT8) (AndData)) | (UINT8) (OrData))
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/Include/SaInclude.cif b/ReferenceCode/Chipset/SystemAgent/Include/SaInclude.cif
new file mode 100644
index 0000000..9506fe6
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Include/SaInclude.cif
@@ -0,0 +1,21 @@
+<component>
+ name = "SaInclude"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\SystemAgent\Include\"
+ RefName = "SaInclude"
+[files]
+"SaInclude.sdl"
+"SaAccess.h"
+"SaBuildFlags.h"
+"SaCommonDefinitions.h"
+"SaRegs.h"
+"SaPcieVersion.h"
+"DmaRemappingTable.h"
+"SaPciExpressLib.h"
+"IntelSaPeiLib.dsc"
+"IntelSaSsdtAcpiTables.dsc"
+"IntelSaAcpiTables.dsc"
+"IntelSaDxe.dsc"
+"IntelSaDxeLib.dsc"
+"IntelSaPei.dsc"
+<endComponent>
diff --git a/ReferenceCode/Chipset/SystemAgent/Include/SaInclude.sdl b/ReferenceCode/Chipset/SystemAgent/Include/SaInclude.sdl
new file mode 100644
index 0000000..1dabe74
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Include/SaInclude.sdl
@@ -0,0 +1,15 @@
+TOKEN
+ Name = "SaInclude_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable SaInclude support in Project"
+End
+
+PATH
+ Name = "INTEL_SA_INCLUDE_DIR"
+End
+
+
diff --git a/ReferenceCode/Chipset/SystemAgent/Include/SaPciExpressLib.h b/ReferenceCode/Chipset/SystemAgent/Include/SaPciExpressLib.h
new file mode 100644
index 0000000..69c7307
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Include/SaPciExpressLib.h
@@ -0,0 +1,38 @@
+/** @file
+ Header file for the PCI Express library.
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _SA_PCI_EXPRESS_LIB_H_
+#define _SA_PCI_EXPRESS_LIB_H_
+
+#if defined (EDK_RELEASE_VERSION) && (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueBase.h"
+#endif
+
+/**
+ Gets the base address of PCI Express.
+
+ This internal functions retrieves PCI Express Base Address.
+
+ @return The base address of PCI Express.
+**/
+VOID*
+GetPciExpressBaseAddress (
+ VOID
+);
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/Include/SaPcieVersion.h b/ReferenceCode/Chipset/SystemAgent/Include/SaPcieVersion.h
new file mode 100644
index 0000000..ba05a7b
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Include/SaPcieVersion.h
@@ -0,0 +1,30 @@
+/** @file
+ The System Agent PCIe code version
+
+@copyright
+ Copyright (c) 1999 - 2014 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+#ifndef _SA_PCIE_VERSION_H_
+#define _SA_PCIE_VERSION_H_
+///
+/// Major Minor Rev Build
+/// ----- ----- ----- -----
+///
+1, 9, 0, 0
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/Include/SaRegs.h b/ReferenceCode/Chipset/SystemAgent/Include/SaRegs.h
new file mode 100644
index 0000000..867766f
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Include/SaRegs.h
@@ -0,0 +1,1510 @@
+/** @file
+ Register names for System Agent (SA) registers
+ Conventions:
+ - Prefixes:
+ - Definitions beginning with "R_" are registers
+ - Definitions beginning with "B_" are bits within registers
+ - Definitions beginning with "V_" are meaningful values of bits within the registers
+ - Definitions beginning with "S_" are register sizes
+ - Definitions beginning with "N_" are the bit position
+ - In general, SA registers are denoted by "_SA_" in register names
+ - Registers / bits that are different between SA generations are denoted by
+ "_SA_<generation_name>_" in register/bit names. e.g., "_SA_HSW_"
+ - Registers / bits that are different between SKUs are denoted by "_<SKU_name>"
+ at the end of the register/bit names
+ - Registers / bits of new devices introduced in a SA generation will be just named
+ as "_SA_" without <generation_name> inserted.
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _SA_REGS_H_
+#define _SA_REGS_H_
+
+//
+// Equates to convert Device IDs to Platform IDs
+//
+#define PLATFORM_ID_MOBILE 1
+#define PLATFORM_ID_DESKTOP 0
+#define PLATFORM_ID_UP_SERVER 2
+
+//
+// DEVICE 0 (Memory Controller Hub)
+//
+#define SA_MC_BUS 0x00
+#define SA_MC_DEV 0x00
+#define SA_MC_FUN 0x00
+#define V_SA_MC_VID 0x8086
+#define R_SA_MC_DEVICE_ID 0x02
+#define R_SA_MC_CAPID0_B 0xE8
+
+///
+/// Macros that judge which type a device ID belongs to
+///
+
+///
+/// CPU Mobile SA Device IDs B0:D0:F0
+///
+#define V_SA_DEVICE_ID_MB_0 0x0C04 ///< Haswell Mobile SA DID
+#define V_SA_DEVICE_ID_MB_1 0x0A04 ///< Haswell Ult Mobile SA DID
+#define V_SA_DEVICE_ID_MB_2 0x0D04 ///< Crystalwell Mobile SA DID
+#define V_SA_DEVICE_ID_MB_3 0x0A0C ///< Haswell Ulx Mobile SA DID
+
+///
+/// CPU Desktop SA Device IDs B0:D0:F0
+///
+#define V_SA_DEVICE_ID_DT_0 0x0C00 ///< Haswell Desktop SA DID
+#define V_SA_DEVICE_ID_DT_1 0x0D00 ///< Crystalwell Desktop SA DID
+
+///
+/// CPU Server SA Device IDs B0:D0:F0
+///
+#define V_SA_DEVICE_ID_SVR_0 0x0C08 ///< Haswell Server SA DID
+#define V_SA_DEVICE_ID_SVR_1 0x0D08 ///< Crystalwell Server SA DID
+#ifdef UPSERVER_SUPPORT
+#define V_SA_DEVICE_ID_DT_2 0x0C0C ///< Haswell Marketing SpareAffect SA DID
+#endif
+
+
+///
+/// Device IDs that are Mobile specific B0:D0:F0
+///
+#define IS_SA_DEVICE_ID_MOBILE(DeviceId) \
+ ( \
+ (DeviceId == V_SA_DEVICE_ID_MB_0) || \
+ (DeviceId == V_SA_DEVICE_ID_MB_1) || \
+ (DeviceId == V_SA_DEVICE_ID_MB_2) || \
+ (DeviceId == V_SA_DEVICE_ID_MB_3) \
+ )
+
+///
+/// Device IDs that are Desktop specific B0:D0:F0
+///
+#ifdef UPSERVER_SUPPORT
+#define IS_SA_DEVICE_ID_DESKTOP(DeviceId) \
+ ( \
+ (DeviceId == V_SA_DEVICE_ID_DT_0) || \
+ (DeviceId == V_SA_DEVICE_ID_DT_1) || \
+ (DeviceId == V_SA_DEVICE_ID_DT_2) \
+ )
+#else
+#define IS_SA_DEVICE_ID_DESKTOP(DeviceId) \
+ ( \
+ (DeviceId == V_SA_DEVICE_ID_DT_0) || \
+ (DeviceId == V_SA_DEVICE_ID_DT_1) \
+ )
+#endif
+
+///
+/// Device IDS that are Server specific B0:D0:F0
+///
+#define IS_SA_DEVICE_ID_SERVER(DeviceId) \
+ ( \
+ (DeviceId == V_SA_DEVICE_ID_SVR_0) || \
+ (DeviceId == V_SA_DEVICE_ID_SVR_1) \
+ )
+
+///
+/// Description:
+/// This is the base address for the PCI Express Egress Port MMIO Configuration space. There is no physical memory within this 4KB window that can be addressed. The 4KB reserved by this register does not alias to any PCI 2.3 compliant memory mapped space. On reset, the EGRESS port MMIO configuration space is disabled and must be enabled by writing a 1 to PXPEPBAREN [Dev 0, offset 40h, bit 0].
+/// All the bits in this register are locked in LT mode.
+///
+#define R_SA_PXPEPBAR (0x40)
+///
+/// Description of PXPEPBAREN (0:0)
+/// 0: PXPEPBAR is disabled and does not claim any memory
+/// 1: PXPEPBAR memory mapped accesses are claimed and decoded appropriately
+/// This register is locked by LT.
+///
+#define N_SA_PXPEPBAR_PXPEPBAREN_OFFSET (0x0)
+#define S_SA_PXPEPBAR_PXPEPBAREN_WIDTH (0x1)
+#define B_SA_PXPEPBAR_PXPEPBAREN_MASK (0x1)
+#define V_SA_PXPEPBAR_PXPEPBAREN_DEFAULT (0x0)
+///
+/// Description of PXPEPBAR (12:38)
+/// This field corresponds to bits 38 to 12 of the base address PCI Express Egress Port MMIO configuration space. BIOS will program this register resulting in a base address for a 4KB block of contiguous memory address space. This register ensures that a naturally aligned 4KB space is allocated within the first 512GB of addressable memory space. System Software uses this base address to program the PCI Express Egress Port MMIO register set. All the bits in this register are locked in LT mode.
+///
+#define N_SA_PXPEPBAR_PXPEPBAR_OFFSET (0xc)
+#define S_SA_PXPEPBAR_PXPEPBAR_WIDTH (0x1b)
+#define B_SA_PXPEPBAR_PXPEPBAR_MASK (0x7ffffff000)
+#define V_SA_PXPEPBAR_PXPEPBAR_DEFAULT (0x0)
+
+///
+/// Description:
+/// This is the base address for the Host Memory Mapped Configuration space. There is no physical memory within this 32KB window that can be addressed. The 32KB reserved by this register does not alias to any PCI 2.3 compliant memory mapped space. On reset, the Host MMIO Memory Mapped Configuation space is disabled and must be enabled by writing a 1 to MCHBAREN [Dev 0, offset48h, bit 0].
+/// All the bits in this register are locked in LT mode.
+/// The register space contains memory control, initialization, timing, and buffer strength registers; clocking registers; and power and thermal management registers.
+///
+#define R_SA_MCHBAR (0x48)
+///
+/// Description of MCHBAREN (0:0)
+/// 0: MCHBAR is disabled and does not claim any memory
+/// 1: MCHBAR memory mapped accesses are claimed and decoded appropriately
+/// This register is locked by LT.
+///
+#define N_SA_MCHBAR_MCHBAREN_OFFSET (0x0)
+#define S_SA_MCHBAR_MCHBAREN_WIDTH (0x1)
+#define B_SA_MCHBAR_MCHBAREN_MASK (0x1)
+#define V_SA_MCHBAR_MCHBAREN_DEFAULT (0x0)
+///
+/// Description of MCHBAR (15:38)
+/// This field corresponds to bits 38 to 15 of the base address Host Memory Mapped configuration space. BIOS will program this register resulting in a base address for a 32KB block of contiguous memory address space. This register ensures that a naturally aligned 32KB space is allocated within the first 512GB of addressable memory space. System Software uses this base address to program the Host Memory Mapped register set. All the bits in this register are locked in LT mode.
+///
+#define N_SA_MCHBAR_MCHBAR_OFFSET (0xf)
+#define S_SA_MCHBAR_MCHBAR_WIDTH (0x18)
+#define B_SA_MCHBAR_MCHBAR_MASK (0x7fffff8000ULL)
+#define V_SA_MCHBAR_MCHBAR_DEFAULT (0x0)
+
+///
+/// Description:
+/// All the bits in this register are LT lockable.
+///
+#define R_SA_GGC (0x50)
+///
+/// Description of GGCLCK (0:0)
+/// When set to 1b, this bit will lock all bits in this register.
+///
+#define N_SA_GGC_GGCLCK_OFFSET (0x0)
+#define S_SA_GGC_GGCLCK_WIDTH (0x1)
+#define B_SA_GGC_GGCLCK_MASK (0x1)
+#define V_SA_GGC_GGCLCK_DEFAULT (0x0)
+///
+/// Description of IVD (1:1)
+/// 0: Enable. Device 2 (IGD) claims VGA memory and IO cycles, the Sub-Class Code within Device 2 Class Code register is 00.
+/// 1: Disable. Device 2 (IGD) does not claim VGA cycles (Mem and IO), and the Sub- Class Code field within Device 2 function 0 Class Code register is 80.
+/// BIOS Requirement: BIOS must not set this bit to 0 if the GMS field (bits 7:3 of this register) pre-allocates no memory.
+/// This bit MUST be set to 1 if Device 2 is disabled either via a fuse or fuse override (CAPID0[46] = 1) or via a register (DEVEN[3] = 0).
+/// This register is locked by LT lock.
+///
+#define N_SA_GGC_IVD_OFFSET (0x1)
+#define S_SA_GGC_IVD_WIDTH (0x1)
+#define B_SA_GGC_IVD_MASK (0x2)
+#define V_SA_GGC_IVD_DEFAULT (0x0)
+///
+/// Description of GMS (3:7)
+/// This field is used to select the amount of Main Memory that is pre-allocated to support the Internal Graphics device in VGA (non-linear) and Native (linear) modes. The BIOS ensures that memory is pre-allocated only when Internal graphics is enabled.
+/// This register is also LT lockable.
+/// 00000b: 0MB
+/// 00001b: 32MB
+/// 00010b: 64MB
+/// 00011b: 96MB
+/// 00100b: 128MB
+/// 00101b: 160MB
+/// 00110b: 192MB
+/// 00111b: 224MB
+/// 01000b: 256MB
+/// 01001b: 288MB
+/// 01010b: 320MB
+/// 01011b: 352MB
+/// 01100b: 384MB
+/// 01101b: 416MB
+/// 01110b: 448MB
+/// 01111b: 480MB
+/// 10000b: 512MB
+/// All other values are reserved
+/// Hardware does not clear or set any of these bits automatically based on IGD being disabled/enabled.
+/// BIOS Requirement: BIOS must not set this field to 0h if IVD (bit 1 of this register) is 0.
+///
+#define N_SA_GGC_GMS_OFFSET (0x3)
+#define S_SA_GGC_GMS_WIDTH (0x5)
+#define B_SA_GGC_GMS_MASK (0xf8)
+#define V_SA_GGC_GMS_DEFAULT (0x28)
+#define V_SA_GGC_GMS_DIS 0
+#define V_SA_GGC_GMS_32MB 1
+#define V_SA_GGC_GMS_64MB 2
+#define V_SA_GGC_GMS_96MB 3
+#define V_SA_GGC_GMS_128MB 4
+#define V_SA_GGC_GMS_160MB 5
+#define V_SA_GGC_GMS_192MB 6
+#define V_SA_GGC_GMS_224MB 7
+#define V_SA_GGC_GMS_256MB 8
+#define V_SA_GGC_GMS_288MB 9
+#define V_SA_GGC_GMS_320MB 0x0a
+#define V_SA_GGC_GMS_352MB 0x0b
+#define V_SA_GGC_GMS_384MB 0x0c
+#define V_SA_GGC_GMS_416MB 0x0d
+#define V_SA_GGC_GMS_448MB 0x0e
+#define V_SA_GGC_GMS_480MB 0x0f
+#define V_SA_GGC_GMS_512MB 0x10
+
+///
+/// Description of GGMS (8:9)
+/// This field is used to select the amount of Main Memory that is pre-allocated to support the Internal Graphics Translation Table. The BIOS ensures that memory is pre-allocated only when Internal graphics is enabled.
+/// GSM is assumed to be a contiguous physical DRAM space with DSM, and BIOS needs to allocate a contiguous memory chunk. Hardware will derive the base of GSM from DSM only using the GSM size programmed in the register.
+/// 0h: No memory pre-allocated. GTT cycles (Mem and IO) are not claimed.
+/// 1h: 1 MB of memory pre-allocated for GTT.
+/// 2h: 2 MB of memory pre-allocated for GTT.
+/// 3h: Reserved
+/// Hardware functionality in case of programming this value to Reserved is not guaranteed.
+///
+#define N_SA_GGC_GGMS_OFFSET (0x8)
+#define S_SA_GGC_GGMS_WIDTH (0x2)
+#define B_SA_GGC_GGMS_MASK (0x300)
+#define V_SA_GGC_GGMS_DEFAULT (0x0)
+#define V_SA_GGC_GGMS_DIS 0
+#define V_SA_GGC_GGMS_1MB 1
+#define V_SA_GGC_GGMS_2MB 2
+
+///
+/// Description of VAMEN (14:14)
+/// Enables the use of the iGFX enbines for Versatile Acceleration.
+/// 1 - iGFX engines are in Versatile Acceleration Mode. Device 2 Class Code is 048000h.
+/// 0 - iGFX engines are in iGFX Mode. Device 2 Class Code is 030000h.
+///
+#define N_SA_GGC_VAMEN_OFFSET (0xe)
+#define S_SA_GGC_VAMEN_WIDTH (0x1)
+#define B_SA_GGC_VAMEN_MASK (0x4000)
+#define V_SA_GGC_VAMEN_DEFAULT (0x0)
+
+///
+/// Description:
+/// Allows for enabling/disabling of PCI devices and functions that are within the CPU package. The table below the bit definitions describes the behavior of all combinations of transactions to devices controlled by this register.
+/// All the bits in this register are LT Lockable.
+///
+#define R_SA_DEVEN (0x54)
+///
+/// Description of D0EN (0:0)
+/// Bus 0 Device 0 Function 0 may not be disabled and is therefore hardwired to 1.
+///
+#define N_SA_DEVEN_D0EN_OFFSET (0x0)
+#define S_SA_DEVEN_D0EN_WIDTH (0x1)
+#define B_SA_DEVEN_D0EN_MASK (0x1)
+#define V_SA_DEVEN_D0EN_DEFAULT (0x1)
+///
+/// Description of D1F2EN (1:1)
+/// 0: Bus 0 Device 1 Function 2 is disabled and hidden.
+/// 1: Bus 0 Device 1 Function 2 is enabled and visible.
+/// This bit will remain 0 if PEG12 capability is disabled.
+///
+#define N_SA_DEVEN_D1F2EN_OFFSET (0x1)
+#define S_SA_DEVEN_D1F2EN_WIDTH (0x1)
+#define B_SA_DEVEN_D1F2EN_MASK (0x2)
+#define V_SA_DEVEN_D1F2EN_DEFAULT (0x2)
+///
+/// Description of D1F1EN (2:2)
+/// 0: Bus 0 Device 1 Function 1 is disabled and hidden.
+/// 1: Bus 0 Device 1 Function 1 is enabled and visible.
+/// This bit will remain 0 if PEG11 capability is disabled.
+///
+#define N_SA_DEVEN_D1F1EN_OFFSET (0x2)
+#define S_SA_DEVEN_D1F1EN_WIDTH (0x1)
+#define B_SA_DEVEN_D1F1EN_MASK (0x4)
+#define V_SA_DEVEN_D1F1EN_DEFAULT (0x4)
+///
+/// Description of D1F0EN (3:3)
+/// 0: Bus 0 Device 1 Function 0 is disabled and hidden.
+/// 1: Bus 0 Device 1 Function 0 is enabled and visible.
+/// This bit will remain 0 if PEG10 capability is disabled.
+///
+#define N_SA_DEVEN_D1F0EN_OFFSET (0x3)
+#define S_SA_DEVEN_D1F0EN_WIDTH (0x1)
+#define B_SA_DEVEN_D1F0EN_MASK (0x8)
+#define V_SA_DEVEN_D1F0EN_DEFAULT (0x8)
+///
+/// Description of D2EN (4:4)
+/// 0: Bus 0 Device 2 is disabled and hidden
+/// 1: Bus 0 Device 2 is enabled and visible
+/// This bit will remain 0 if Device 2 capability is disabled.
+///
+#define N_SA_DEVEN_D2EN_OFFSET (0x4)
+#define S_SA_DEVEN_D2EN_WIDTH (0x1)
+#define B_SA_DEVEN_D2EN_MASK (0x10)
+#define V_SA_DEVEN_D2EN_DEFAULT (0x10)
+///
+/// Description of D3EN (5:5)
+/// 0: Bus 0 Device 3 is disabled and hidden
+/// 1: Bus 0 Device 3 is enabled and visible
+/// This bit will remain 0 if Device 3 capability is disabled.
+///
+#define N_SA_DEVEN_D3EN_OFFSET (0x5)
+#define S_SA_DEVEN_D3EN_WIDTH (0x1)
+#define B_SA_DEVEN_D3EN_MASK (0x20)
+#define V_SA_DEVEN_D3EN_DEFAULT (0x20)
+///
+/// Description of D4EN (7:7)
+/// 0: Bus 0 Device 4 is disabled and not visible.
+/// 1: Bus 0 Device 4 is enabled and visible.
+/// This bit will remain 0 if Device 4 capability is disabled.
+///
+#define N_SA_DEVEN_D4EN_OFFSET (0x7)
+#define S_SA_DEVEN_D4EN_WIDTH (0x1)
+#define B_SA_DEVEN_D4EN_MASK (0x80)
+#define V_SA_DEVEN_D4EN_DEFAULT (0x80)
+///
+/// Description of D7EN (14:14)
+/// 0: Bus 0 Device 7 is disabled and not visible.
+/// 1: Bus 0 Device 7 is enabled and visible.
+/// Non-production BIOS code should provide a setup option to enable Bus 0 Device 7. When enabled, Bus 0 Device 7 must be initialized in accordance to standard PCI device initialization procedures.
+///
+#define N_SA_DEVEN_D7EN_OFFSET (0xe)
+#define S_SA_DEVEN_D7EN_WIDTH (0x1)
+#define B_SA_DEVEN_D7EN_MASK (0x4000)
+#define V_SA_DEVEN_D7EN_DEFAULT (0x0)
+///
+/// Description of EPBAREN (27:27)
+/// 0: EPBAR is disabled and does not claim any memory. 1: EPBAR memory mapped accesses are claimed and decoded approprately. This bit is Intel Reserved
+///
+#define N_SA_DEVEN_EPBAREN_OFFSET (0x1b)
+#define S_SA_DEVEN_EPBAREN_WIDTH (0x1)
+#define B_SA_DEVEN_EPBAREN_MASK (0x8000000)
+#define V_SA_DEVEN_EPBAREN_DEFAULT (0x0)
+///
+/// Description of MCHBAREN (28:28)
+/// 0: MCHBAR is disabled and does not claim any memory. 1: MCHBAR memory mapped accesses are claimed and decoded approprately. This bit is Intel Reserved
+///
+#define N_SA_DEVEN_MCHBAREN_OFFSET (0x1c)
+#define S_SA_DEVEN_MCHBAREN_WIDTH (0x1)
+#define B_SA_DEVEN_MCHBAREN_MASK (0x10000000)
+#define V_SA_DEVEN_MCHBAREN_DEFAULT (0x0)
+///
+/// Description of DMIBAREN (29:29)
+/// 0: DMIBAR is disabled and does not claim any memory. 1: DMIBAR memory mapped accesses are claimed and decoded approprately. This bit is Intel Reserved
+///
+#define N_SA_DEVEN_DMIBAREN_OFFSET (0x1d)
+#define S_SA_DEVEN_DMIBAREN_WIDTH (0x1)
+#define B_SA_DEVEN_DMIBAREN_MASK (0x20000000)
+#define V_SA_DEVEN_DMIBAREN_DEFAULT (0x0)
+///
+/// Description of PCIEXBAREN (31:31)
+/// 0: The PCIEXBAR register is disabled. Memory read and write transactions proceed as if there were no PCIEXBAR register. PCIEXBAR bits 31:28 are R/W with no functionality behind them. 1: The PCIEXBAR register is enabled. Memory read and write transactions whose address bits 31:28 match PCIEXBAR 31:28 will be translated to configuration reads and writes within the GMCH. These translated cycles are routed as shown in the table above.
+///
+#define N_SA_DEVEN_PCIEXBAREN_OFFSET (0x1f)
+#define S_SA_DEVEN_PCIEXBAREN_WIDTH (0x1)
+#define B_SA_DEVEN_PCIEXBAREN_MASK (0x80000000)
+#define V_SA_DEVEN_PCIEXBAREN_DEFAULT (0x0)
+///
+/// Description of RSVD (31:31)
+///
+#define N_SA_DEVEN_RSVD_OFFSET (0x1f)
+#define S_SA_DEVEN_RSVD_WIDTH (0x1)
+#define B_SA_DEVEN_RSVD_MASK (0x80000000)
+#define V_SA_DEVEN_RSVD_DEFAULT (0x0)
+
+///
+/// Description
+/// Protected Audio Video Path Control
+/// All the bits in this register are locked by LT. When locked the R/W bits are RO.
+///
+#define R_SA_PAVPC (0x58)
+/// Description of PCME (0:0)
+/// This field enables Protected Content Memory within Graphics Stolen Memory.
+/// This register is locked (becomes read-only) when PAVPLCK = 1b.
+/// This register is read-only (stays at 0b) when PAVP fuse is set to "disabled"
+/// 0: Protected Content Memory is disabled
+/// 1: Protected Content Memory is enabled
+///
+#define N_SA_PAVPC_PCME_OFFSET (0x0)
+#define S_SA_PAVPC_PCME_WIDTH (0x1)
+#define B_SA_PAVPC_PCME_MASK (0x1)
+#define V_SA_PAVPC_PCME_MASK (0x0)
+///
+/// Description of PAVPE (1:1)
+/// 0: PAVP path is disabled
+/// 1: PAVP path is enabled
+/// This register is locked (becomes read-only) when PAVPLCK = 1b
+/// This register is read-only (stays at 0b) when PAVP capability is set to "disabled" as defined by CAPID0_B[PAVPE].
+///
+#define N_SA_PAVPC_PAVPE_OFFSET (0x1)
+#define S_SA_PAVPC_PAVPE_WIDTH (0x1)
+#define B_SA_PAVPC_PAVPE_MASK (0x2)
+#define V_SA_PAVPC_PAVPE_DEFAULT (0x0)
+///
+/// Description of PAVPLCK (2:2)
+/// This bit will lock all writeable contents in this register when set (including itself).
+/// This bit will be locked if PAVP is fused off.
+///
+#define N_SA_PAVPC_PAVPLCK_OFFSET (0x2)
+#define S_SA_PAVPC_PAVPLCK_WIDTH (0x1)
+#define B_SA_PAVPC_PAVPLCK_MASK (0x4)
+#define V_SA_PAVPC_PAVPLCK_DEFAULT (0x0)
+///
+/// Description of HVYMODSEL (3:3)
+/// 1b Serpent Mode
+/// 0b Big PCM Mode
+///
+#define N_SA_PAVPC_HVYMODSEL_OFFSET (0x3)
+#define S_SA_PAVPC_HVYMODSEL_WIDTH (0x1)
+#define B_SA_PAVPC_HVYMODSEL_MASK (0x8)
+#define V_SA_PAVPC_HVYMODSEL_DEFAULT (0x0)
+///
+/// Description of WOPCMSZ (4:5)
+/// 00b - 1MB (default)
+/// 01b - 512KB
+/// 10b - 256KB
+/// 11b - 128KB
+///
+#define N_SA_PAVPC_WOPCMSZ_OFFSET (0x4)
+#define S_SA_PAVPC_WOPCMSZ_WIDTH (0x2)
+#define B_SA_PAVPC_WOPCMSZ_MASK (0x30)
+#define V_SA_PAVPC_WOPCMSZ_DEFAULT (0x0)
+///
+/// Description of PCMBASE (20:31)
+/// This field is used to set the base of Protected Content Memory.
+/// This corresponds to bits 31:20 of the system memory address range, giving a 1MB granularity. This value MUST be at least 1MB above the base and below the top of stolen memory.
+/// This register is locked (becomes read-only) when PAVPE = 1b.
+///
+#define N_SA_PAVPC_PCMBASE_OFFSET (0x14)
+#define S_SA_PAVPC_PCMBASE_WIDTH (0xc)
+#define B_SA_PAVPC_PCMBASE_MASK (0xfff00000)
+#define V_SA_PAVPC_PCMBASE_DEFAULT (0x0)
+
+///
+/// Description:
+/// DMA protected range register
+///
+#define R_SA_DPR (0x5c)
+///
+/// Description of LOCK (0:0)
+/// This bit will lock all writeable settings in this register, including itself.
+///
+#define N_SA_DPR_LOCK_OFFSET (0x0)
+#define S_SA_DPR_LOCK_WIDTH (0x1)
+#define B_SA_DPR_LOCK_MASK (0x1)
+#define V_SA_DPR_LOCK_DEFAULT (0x0)
+///
+/// Description of PRS (1:1)
+/// This field indicates the status of DPR.
+/// 0: DPR protection disabled
+/// 1: DPR protection enabled
+///
+#define N_SA_DPR_PRS_OFFSET (0x1)
+#define S_SA_DPR_PRS_WIDTH (0x1)
+#define B_SA_DPR_PRS_MASK (0x2)
+#define V_SA_DPR_PRS_DEFAULT (0x0)
+///
+/// Description of EPM (2:2)
+/// This field controls DMA accesses to the DMA Protected Range (DPR) region.
+/// 0: DPR is disabled
+/// 1: DPR is enabled. All DMA requests accessing DPR region are blocked.
+/// HW reports the status of DPR enable/disable through the PRS field in this register.
+///
+#define N_SA_DPR_EPM_OFFSET (0x2)
+#define S_SA_DPR_EPM_WIDTH (0x1)
+#define B_SA_DPR_EPM_MASK (0x4)
+#define V_SA_DPR_EPM_DEFAULT (0x0)
+///
+/// Description of DPRSIZE (11:4)
+/// This field is used to specify the size of memory protected from DMA access in MB
+/// The maximum amount of memory that will be protected is 255MB
+/// The Top of protected range is the base of TSEG-1
+///
+#define N_DPR_DPRSIZE_OFFSET (0x4)
+#define V_DPR_DPRSIZE_WIDTH (0x8)
+#define V_DPR_DPRSIZE_MASK (0xFF0)
+#define V_DPR_DPRSIZE_DEFAULT (0x0)
+///
+/// Description of TOPOFDPR (31:20)
+/// This is the Top address 1 of DPR - Base of TSEG
+///
+#define N_SA_DPR_TOPOFDPR_OFFSET (20)
+#define S_SA_DPR_TOPOFDPR_WIDTH (0xC)
+#define B_SA_DPR_TOPOFDPR_MASK (0xFFF00000)
+#define V_SA_DPR_TOPOFDPR_DEFAULT (0x0)
+
+///
+/// Description:
+/// This is the base address for the PCI Express configuration space. This window of addresses contains the 4KB of configuration space for each PCI Express device that can potentially be part of the PCI Express Hierarchy associated with the Uncore. There is no actual physical memory within this window of up to 256MB that can be addressed. The actual size of this range is determined by a field in this register.
+/// Each PCI Express Hierarchy requires a PCI Express BASE register. The Uncore supports one PCI Express Hierarchy. The region reserved by this register does not alias to any PCI2.3 compliant memory mapped space. For example, the range reserved for MCHBAR is outside of PCIEXBAR space.
+/// On reset, this register is disabled and must be enabled by writing a 1 to the enable field in this register. This base address shall be assigned on a boundary consistent with the number of buses (defined by the length field in this register), above TOLUD and still within 39-bit addressable memory space.
+/// The PCI Express Base Address cannot be less than the maximum address written to the Top of physical memory register (TOLUD). Software must guarantee that these ranges do not overlap with known ranges located above TOLUD.
+/// Software must ensure that the sum of the length of the enhanced configuration region + TOLUD + any other known ranges reserved above TOLUD is not greater than the 39-bit addessable limit of 512GB. In general, system implementation and the number of PCI/PCI Express/PCI-X buses supported in the hierarchy will dictate the length of the region.
+/// All the bits in this register are locked in LT mode.
+///
+#define R_SA_PCIEXBAR (0x60)
+///
+/// Description of PCIEXBAREN (0:0)
+/// 0: The PCIEXBAR register is disabled. Memory read and write transactions proceed s if there were no PCIEXBAR register. PCIEXBAR bits 38:26 are R/W with no functionality behind them.
+/// 1: The PCIEXBAR register is enabled. Memory read and write transactions whose address bits 38:26 match PCIEXBAR will be translated to configuration reads and writes within the Uncore. These Translated cycles are routed as shown in the above table.
+/// This register is locked by LT.
+///
+#define N_SA_PCIEXBAR_PCIEXBAREN_OFFSET (0x0)
+#define S_SA_PCIEXBAR_PCIEXBAREN_WIDTH (0x1)
+#define B_SA_PCIEXBAR_PCIEXBAREN_MASK (0x1)
+#define V_SA_PCIEXBAR_PCIEXBAREN_DEFAULT (0x0)
+///
+/// Description of LENGTH (1:2)
+/// This field describes the length of this region.
+/// 00: 256MB (buses 0-255). Bits 38:28 are decoded in the PCI Express Base Address Field.
+/// 01: 128MB (buses 0-127). Bits 38:27 are decoded in the PCI Express Base Address Field.
+/// 10: 64MB (buses 0-63). Bits 38:26 are decoded in the PCI Express Base Address Field.
+/// 11: Reserved.
+/// Thsi register is locked by LT.
+///
+#define N_SA_PCIEXBAR_LENGTH_OFFSET (0x1)
+#define S_SA_PCIEXBAR_LENGTH_WIDTH (0x2)
+#define B_SA_PCIEXBAR_LENGTH_MASK (0x6)
+#define V_SA_PCIEXBAR_LENGTH_DEFAULT (0x0)
+///
+/// Description of ADMSK64 (26:26)
+/// This bit is either part of the PCI Express Base Address (R/W) or part of the Address Mask (RO, read 0b), depending on the value of bits [2:1] in this register.
+///
+#define N_SA_PCIEXBAR_ADMSK64_OFFSET (0x1a)
+#define S_SA_PCIEXBAR_ADMSK64_WIDTH (0x1)
+#define B_SA_PCIEXBAR_ADMSK64_MASK (0x4000000)
+#define V_SA_PCIEXBAR_ADMSK64_DEFAULT (0x0)
+///
+/// Description of ADMSK128 (27:27)
+/// This bit is either part of the PCI Express Base Address (R/W) or part of the Address Mask (RO, read 0b), depending on the value of bits [2:1] in this register.
+///
+#define N_SA_PCIEXBAR_ADMSK128_OFFSET (0x1b)
+#define S_SA_PCIEXBAR_ADMSK128_WIDTH (0x1)
+#define B_SA_PCIEXBAR_ADMSK128_MASK (0x8000000)
+#define V_SA_PCIEXBAR_ADMSK128_DEFAULT (0x0)
+///
+/// Description of PCIEXBAR (28:38)
+/// This field corresponds to bits 38 to 28 of the base address for PCI Express enhanced configuration space. BIOS will program this register resulting in a base address for a contiguous memory address space. The size of the range is defined by bits [2:1] of this register.
+/// This Base address shall be assigned on a boundary consistent with the number of buses (defined by the Length field in this register) above TOLUD and still within the 39-bit addressable memory space. The address bits decoded depend on the length of the region defined by this register.
+/// This register is locked by LT.
+/// The address used to access the PCI Express configuration space for a specific device can be determined as follows:
+/// PCI Express Base Address + Bus Number * 1MB + Device Number * 32KB + Function Number * 4KB
+/// This address is the beginning of the 4KB space that contains both the PCI compatible configuration space and the PCI Express extended configuration space.
+///
+#define N_SA_PCIEXBAR_PCIEXBAR_OFFSET (0x1c)
+#define S_SA_PCIEXBAR_PCIEXBAR_WIDTH (0xb)
+#define B_SA_PCIEXBAR_PCIEXBAR_MASK (0x7ff0000000)
+#define V_SA_PCIEXBAR_PCIEXBAR_DEFAULT (0x0)
+
+///
+/// Description:
+/// This is the base address for the Root Complex configuration space. This window of addresses contains the Root Complex Register set for the PCI Express Hierarchy associated with the Host Bridge. There is no physical memory within this 4KB window that can be addressed. The 4KB reserved by this register does not alias to any PCI 2.3 compliant memory mapped space. On reset, the Root Complex configuration space is disabled and must be enabled by writing a 1 to DMIBAREN [Dev 0, offset 68h, bit 0] All the bits in this register are locked in LT mode.
+///
+#define R_SA_DMIBAR (0x68)
+///
+/// Description of DMIBAREN (0:0)
+/// 0: DMIBAR is disabled and does not claim any memory
+/// 1: DMIBAR memory mapped accesses are claimed and decoded appropriately
+/// This register is locked by LT.
+///
+#define N_SA_DMIBAR_DMIBAREN_OFFSET (0x0)
+#define S_SA_DMIBAR_DMIBAREN_WIDTH (0x1)
+#define B_SA_DMIBAR_DMIBAREN_MASK (0x1)
+#define V_SA_DMIBAR_DMIBAREN_DEFAULT (0x0)
+///
+/// Description of DMIBAR (12:38)
+/// This field corresponds to bits 38 to 12 of the base address DMI configuration space. BIOS will program this register resulting in a base address for a 4KB block of contiguous memory address space. This register ensures that a naturally aligned 4KB space is allocated within the first 512GB of addressable memory space. System Software uses this base address to program the DMI register set. All the Bits in this register are locked in LT mode.
+///
+#define N_SA_DMIBAR_DMIBAR_OFFSET (0xc)
+#define S_SA_DMIBAR_DMIBAR_WIDTH (0x1b)
+#define B_SA_DMIBAR_DMIBAR_MASK (0x7ffffff000)
+#define V_SA_DMIBAR_DMIBAR_DEFAULT (0x0)
+
+///
+/// Description:
+/// This register determines the Base Address register of the memory range that is pre-allocated to the Manageability Engine. Together with the MESEG_MASK register it controls the amount of memory allocated to the ME.
+/// This register must be initialized by the configuration software. For the purpose of address decode address bits A[19:0] are assumed to be 0. Thus, the bottom of the defined memory address range will be aligned to a 1MB boundary.
+/// This register is locked by LT.
+///
+#define R_SA_MESEG_BASE (0x70)
+///
+/// Description of MEBASE (20:38)
+/// Corresponds to A[38:20] of the base address memory range that is allocated to the ME.
+///
+#define N_SA_MESEG_BASE_MEBASE_OFFSET (0x14)
+#define S_SA_MESEG_BASE_MEBASE_WIDTH (0x13)
+#define B_SA_MESEG_BASE_MEBASE_MASK (0x7ffff00000)
+#define V_SA_MESEG_BASE_MEBASE_DEFAULT (0xfffff00000)
+
+///
+/// Description:
+/// This register determines the Mask Address register of the memory range that is pre-allocated to the Manageability Engine. Together with the MESEG_BASE register it controls the amount of memory allocated to the ME.
+/// This register is locked by LT.
+///
+#define R_SA_MESEG_MASK (0x78)
+///
+/// Description of MELCK (10:10)
+/// This field indicates whether all bits in the MESEG_BASE and MESEG_MASK registers are locked. When locked, updates to any field for these registers must be dropped.
+///
+#define N_SA_MESEG_MASK_MELCK_OFFSET (0xa)
+#define S_SA_MESEG_MASK_MELCK_WIDTH (0x1)
+#define B_SA_MESEG_MASK_MELCK_MASK (0x400)
+#define V_SA_MESEG_MASK_MELCK_DEFAULT (0x0)
+///
+/// Description of ME_STLEN_EN (11:11)
+/// Indicates whether the ME stolen Memory range is enabled or not.
+///
+#define N_SA_MESEG_MASK_ME_STLEN_EN_OFFSET (0xb)
+#define S_SA_MESEG_MASK_ME_STLEN_EN_WIDTH (0x1)
+#define B_SA_MESEG_MASK_ME_STLEN_EN_MASK (0x800)
+#define V_SA_MESEG_MASK_ME_STLEN_EN_DEFAULT (0x0)
+///
+/// Description of MEMASK (20:38)
+/// This field indicates the bits that must match MEBASE in order to qualify as an ME Memory Range access.
+/// For example, if the field is set to 7FFFFh, then ME Memory is 1MB in size.
+/// Another example is that if the field is set to 7FFFEh, then ME Memory is 2MB in size.
+/// In other words, the size of ME Memory Range is limited to power of 2 times 1MB.
+///
+#define N_SA_MESEG_MASK_MEMASK_OFFSET (0x14)
+#define S_SA_MESEG_MASK_MEMASK_WIDTH (0x13)
+#define B_SA_MESEG_MASK_MEMASK_MASK (0x7ffff00000)
+#define V_SA_MESEG_MASK_MEMASK_DEFAULT (0x0)
+
+///
+/// Description:
+/// This register controls the read, write and shadowing attributes of the BIOS range from F_0000h to F_FFFFh. The Uncore allows programmable memory attributes on 13 legacy memory segments of various sizes in the 768KB to 1MB address range. Seven Programmable Attribute Map (PAM) registers are used to support these features. Cacheability of these areas is controlled via the MTRR register in the core.
+/// Two bits are used to specify memory attributes for each memory segment. These bits apply to host accesses to the PAM areas. These attributes are:
+/// RE - Read Enable. When RE=1, the host read accesses to the corresponding memory segment are claimed by the Uncore and directed to main memory. Conversely, when RE=0, the host read accesses are directed to DMI.
+/// WE - Write Enable. When WE=1, the host write accesses to the corresponding memory segment are claimed by the Uncore and directed to main memory. Conversely, when WE=0, the host read accesses are directed to DMI.
+/// The RE and WE attributes permit a memory segment to be Read Only, Write Only, Read/Write or Disabled. For example, if a memory segment has RE=1 and WE=0, the segment is Read Only.
+///
+#define R_SA_PAM0 (0x80)
+///
+/// Description of HIENABLE (4:5)
+/// This field controls the steering of read and write cycles that address the BIOS area from 0F_0000h to 0F_FFFFh.
+/// 00: DRAM Disabled. All accesses are directed to DMI.
+/// 01: Read Only. All reads are sent to DRAM, all writes are forwarded to DMI.
+/// 10: Write Only. All writes are sent to DRAM, all reads are serviced by DMI.
+/// 11: Normal DRAM Operation. All reads and writes are serviced by DRAM.
+/// This register is locked by LT.
+///
+#define N_SA_PAM0_HIENABLE_OFFSET (0x4)
+#define S_SA_PAM0_HIENABLE_WIDTH (0x2)
+#define B_SA_PAM0_HIENABLE_MASK (0x30)
+#define V_SA_PAM0_HIENABLE_DEFAULT (0x0)
+
+///
+/// Description:
+/// This register controls the read, write and shadowing attributes of the BIOS range from C_0000h to C_7FFFh. The Uncore allows programmable memory attributes on 13 legacy memory segments of various sizes in the 768KB to 1MB address range. Seven Programmable Attribute Map (PAM) registers are used to support these features. Cacheability of these areas is controlled via the MTRR register in the core.
+/// Two bits are used to specify memory attributes for each memory segment. These bits apply to host accesses to the PAM areas. These attributes are:
+/// RE - Read Enable. When RE=1, the host read accesses to the corresponding memory segment are claimed by the Uncore and directed to main memory. Conversely, when RE=0, the host read accesses are directed to DMI.
+/// WE - Write Enable. When WE=1, the host write accesses to the corresponding memory segment are claimed by the Uncore and directed to main memory. Conversely, when WE=0, the host read accesses are directed to DMI.
+/// The RE and WE attributes permit a memory segment to be Read Only, Write Only, Read/Write or Disabled. For example, if a memory segment has RE=1 and WE=0, the segment is Read Only.
+///
+#define R_SA_PAM1 (0x81)
+///
+/// Description of LOENABLE (0:1)
+/// This field controls the steering of read and write cycles that address the BIOS area from 0C0000h to 0C3FFFh.
+/// 00: DRAM Disabled. All reads are sent to DRAM. All writes are forwarded to DMI.
+/// 01: Read Only. All reads are sent to DRAM. All writes are forwarded to DMI.
+/// 10: Write Only. All writes are sent to DRAM. All reads are serviced by DMI.
+/// 11: Normal DRAM Operation. All reads and writes are serviced by DRAM.
+/// This register is locked by LT.
+///
+#define N_SA_PAM1_LOENABLE_OFFSET (0x0)
+#define S_SA_PAM1_LOENABLE_WIDTH (0x2)
+#define B_SA_PAM1_LOENABLE_MASK (0x3)
+#define V_SA_PAM1_LOENABLE_DEFAULT (0x0)
+///
+/// Description of HIENABLE (4:5)
+/// This field controls the steering of read and write cycles that address the BIOS area from 0C_4000h to 0C_7FFFh.
+/// 00: DRAM Disabled. All accesses are directed to DMI.
+/// 01: Read Only. All reads are sent to DRAM, all writes are forwarded to DMI.
+/// 10: Write Only. All writes are sent to DRAM, all reads are serviced by DMI.
+/// 11: Normal DRAM Operation. All reads and writes are serviced by DRAM.
+/// This register is locked by LT.
+///
+#define N_SA_PAM1_HIENABLE_OFFSET (0x4)
+#define S_SA_PAM1_HIENABLE_WIDTH (0x2)
+#define B_SA_PAM1_HIENABLE_MASK (0x30)
+#define V_SA_PAM1_HIENABLE_DEFAULT (0x0)
+
+///
+/// Description:
+/// This register controls the read, write and shadowing attributes of the BIOS range from C_8000h to C_FFFFh. The Uncore allows programmable memory attributes on 13 legacy memory segments of various sizes in the 768KB to 1MB address range. Seven Programmable Attribute Map (PAM) registers are used to support these features. Cacheability of these areas is controlled via the MTRR register in the core.
+/// Two bits are used to specify memory attributes for each memory segment. These bits apply to host accesses to the PAM areas. These attributes are:
+/// RE - Read Enable. When RE=1, the host read accesses to the corresponding memory segment are claimed by the Uncore and directed to main memory. Conversely, when RE=0, the host read accesses are directed to DMI.
+/// WE - Write Enable. When WE=1, the host write accesses to the corresponding memory segment are claimed by the Uncore and directed to main memory. Conversely, when WE=0, the host read accesses are directed to DMI.
+/// The RE and WE attributes permit a memory segment to be Read Only, Write Only, Read/Write or Disabled. For example, if a memory segment has RE=1 and WE=0, the segment is Read Only.
+///
+#define R_SA_PAM2 (0x82)
+///
+/// Description of LOENABLE (0:1)
+/// This field controls the steering of read and write cycles that address the BIOS area from 0C8000h to 0CBFFFh.
+/// 00: DRAM Disabled. All reads are sent to DRAM. All writes are forwarded to DMI.
+/// 01: Read Only. All reads are sent to DRAM. All writes are forwarded to DMI.
+/// 10: Write Only. All writes are sent to DRAM. All reads are serviced by DMI.
+/// 11: Normal DRAM Operation. All reads and writes are serviced by DRAM.
+/// This register is locked by LT.
+///
+#define N_SA_PAM2_LOENABLE_OFFSET (0x0)
+#define S_SA_PAM2_LOENABLE_WIDTH (0x2)
+#define B_SA_PAM2_LOENABLE_MASK (0x3)
+#define V_SA_PAM2_LOENABLE_DEFAULT (0x0)
+///
+/// Description of HIENABLE (4:5)
+/// This field controls the steering of read and write cycles that address the BIOS area from 0CC000h to 0CFFFFh.
+/// 00: DRAM Disabled. All accesses are directed to DMI.
+/// 01: Read Only. All reads are sent to DRAM, all writes are forwarded to DMI.
+/// 10: Write Only. All writes are sent to DRAM, all reads are serviced by DMI.
+/// 11: Normal DRAM Operation. All reads and writes are serviced by DRAM.
+/// This register is locked by LT.
+///
+#define N_SA_PAM2_HIENABLE_OFFSET (0x4)
+#define S_SA_PAM2_HIENABLE_WIDTH (0x2)
+#define B_SA_PAM2_HIENABLE_MASK (0x30)
+#define V_SA_PAM2_HIENABLE_DEFAULT (0x0)
+
+///
+/// Description:
+/// This register controls the read, write and shadowing attributes of the BIOS range from D0000h to D7FFFh. The Uncore allows programmable memory attributes on 13 legacy memory segments of various sizes in the 768KB to 1MB address range. Seven Programmable Attribute Map (PAM) registers are used to support these features. Cacheability of these areas is controlled via the MTRR register in the core.
+/// Two bits are used to specify memory attributes for each memory segment. These bits apply to host accesses to the PAM areas. These attributes are:
+/// RE - Read Enable. When RE=1, the host read accesses to the corresponding memory segment are claimed by the Uncore and directed to main memory. Conversely, when RE=0, the host read accesses are directed to DMI.
+/// WE - Write Enable. When WE=1, the host write accesses to the corresponding memory segment are claimed by the Uncore and directed to main memory. Conversely, when WE=0, the host read accesses are directed to DMI.
+/// The RE and WE attributes permit a memory segment to be Read Only, Write Only, Read/Write or Disabled. For example, if a memory segment has RE=1 and WE=0, the segment is Read Only.
+///
+#define R_SA_PAM3 (0x83)
+///
+/// Description of LOENABLE (0:1)
+/// This field controls the steering of read and write cycles that address the BIOS area from 0D0000h to 0D3FFFh.
+/// 00: DRAM Disabled. All reads are sent to DRAM. All writes are forwarded to DMI.
+/// 01: Read Only. All reads are sent to DRAM. All writes are forwarded to DMI.
+/// 10: Write Only. All writes are sent to DRAM. All reads are serviced by DMI.
+/// 11: Normal DRAM Operation. All reads and writes are serviced by DRAM.
+/// This register is locked by LT.
+///
+#define N_SA_PAM3_LOENABLE_OFFSET (0x0)
+#define S_SA_PAM3_LOENABLE_WIDTH (0x2)
+#define B_SA_PAM3_LOENABLE_MASK (0x3)
+#define V_SA_PAM3_LOENABLE_DEFAULT (0x0)
+///
+/// Description of HIENABLE (4:5)
+/// This field controls the steering of read and write cycles that address the BIOS area from 0D4000h to 0D7FFFh.
+/// 00: DRAM Disabled. All accesses are directed to DMI.
+/// 01: Read Only. All reads are sent to DRAM, all writes are forwarded to DMI.
+/// 10: Write Only. All writes are sent to DRAM, all reads are serviced by DMI.
+/// 11: Normal DRAM Operation. All reads and writes are serviced by DRAM.
+/// This register is locked by LT.
+///
+#define N_SA_PAM3_HIENABLE_OFFSET (0x4)
+#define S_SA_PAM3_HIENABLE_WIDTH (0x2)
+#define B_SA_PAM3_HIENABLE_MASK (0x30)
+#define V_SA_PAM3_HIENABLE_DEFAULT (0x0)
+
+///
+/// Description:
+/// This register controls the read, write and shadowing attributes of the BIOS range from D8000h to DFFFFh. The Uncore allows programmable memory attributes on 13 legacy memory segments of various sizes in the 768KB to 1MB address range. Seven Programmable Attribute Map (PAM) registers are used to support these features. Cacheability of these areas is controlled via the MTRR register in the core.
+/// Two bits are used to specify memory attributes for each memory segment. These bits apply to host accesses to the PAM areas. These attributes are:
+/// RE - Read Enable. When RE=1, the host read accesses to the corresponding memory segment are claimed by the Uncore and directed to main memory. Conversely, when RE=0, the host read accesses are directed to DMI.
+/// WE - Write Enable. When WE=1, the host write accesses to the corresponding memory segment are claimed by the Uncore and directed to main memory. Conversely, when WE=0, the host read accesses are directed to DMI.
+/// The RE and WE attributes permit a memory segment to be Read Only, Write Only, Read/Write or Disabled. For example, if a memory segment has RE=1 and WE=0, the segment is Read Only.
+///
+#define R_SA_PAM4 (0x84)
+///
+/// Description of LOENABLE (0:1)
+/// This field controls the steering of read and write cycles that address the BIOS area from 0D8000h to 0DBFFFh.
+/// 00: DRAM Disabled. All reads are sent to DRAM. All writes are forwarded to DMI.
+/// 01: Read Only. All reads are sent to DRAM. All writes are forwarded to DMI.
+/// 10: Write Only. All writes are sent to DRAM. All reads are serviced by DMI.
+/// 11: Normal DRAM Operation. All reads and writes are serviced by DRAM.
+/// This register is locked by LT.
+///
+#define N_SA_PAM4_LOENABLE_OFFSET (0x0)
+#define S_SA_PAM4_LOENABLE_WIDTH (0x2)
+#define B_SA_PAM4_LOENABLE_MASK (0x3)
+#define V_SA_PAM4_LOENABLE_DEFAULT (0x0)
+///
+/// Description of HIENABLE (4:5)
+/// This field controls the steering of read and write cycles that address the BIOS area from 0DC000h to 0DFFFFh.
+/// 00: DRAM Disabled. All accesses are directed to DMI.
+/// 01: Read Only. All reads are sent to DRAM, all writes are forwarded to DMI.
+/// 10: Write Only. All writes are sent to DRAM, all reads are serviced by DMI.
+/// 11: Normal DRAM Operation. All reads and writes are serviced by DRAM.
+/// This register is locked by LT.
+///
+#define N_SA_PAM4_HIENABLE_OFFSET (0x4)
+#define S_SA_PAM4_HIENABLE_WIDTH (0x2)
+#define B_SA_PAM4_HIENABLE_MASK (0x30)
+#define V_SA_PAM4_HIENABLE_DEFAULT (0x0)
+
+///
+/// Description:
+/// This register controls the read, write and shadowing attributes of the BIOS range from E_0000h to E_7FFFh. The Uncore allows programmable memory attributes on 13 legacy memory segments of various sizes in the 768KB to 1MB address range. Seven Programmable Attribute Map (PAM) registers are used to support these features. Cacheability of these areas is controlled via the MTRR register in the core.
+/// Two bits are used to specify memory attributes for each memory segment. These bits apply to host accesses to the PAM areas. These attributes are:
+/// RE - Read Enable. When RE=1, the host read accesses to the corresponding memory segment are claimed by the Uncore and directed to main memory. Conversely, when RE=0, the host read accesses are directed to DMI.
+/// WE - Write Enable. When WE=1, the host write accesses to the corresponding memory segment are claimed by the Uncore and directed to main memory. Conversely, when WE=0, the host read accesses are directed to DMI.
+/// The RE and WE attributes permit a memory segment to be Read Only, Write Only, Read/Write or Disabled. For example, if a memory segment has RE=1 and WE=0, the segment is Read Only.
+///
+#define R_SA_PAM5 (0x85)
+///
+/// Description of LOENABLE (0:1)
+/// This field controls the steering of read and write cycles that address the BIOS area from 0E0000h to 0E3FFFh.
+/// 00: DRAM Disabled. All reads are sent to DRAM. All writes are forwarded to DMI.
+/// 01: Read Only. All reads are sent to DRAM. All writes are forwarded to DMI.
+/// 10: Write Only. All writes are sent to DRAM. All reads are serviced by DMI.
+/// 11: Normal DRAM Operation. All reads and writes are serviced by DRAM.
+/// This register is locked by LT.
+///
+#define N_SA_PAM5_LOENABLE_OFFSET (0x0)
+#define S_SA_PAM5_LOENABLE_WIDTH (0x2)
+#define B_SA_PAM5_LOENABLE_MASK (0x3)
+#define V_SA_PAM5_LOENABLE_DEFAULT (0x0)
+///
+/// Description of HIENABLE (4:5)
+/// This field controls the steering of read and write cycles that address the BIOS area from 0E4000h to 0E7FFFh.
+/// 00: DRAM Disabled. All accesses are directed to DMI.
+/// 01: Read Only. All reads are sent to DRAM, all writes are forwarded to DMI.
+/// 10: Write Only. All writes are sent to DRAM, all reads are serviced by DMI.
+/// 11: Normal DRAM Operation. All reads and writes are serviced by DRAM.
+/// This register is locked by LT.
+///
+#define N_SA_PAM5_HIENABLE_OFFSET (0x4)
+#define S_SA_PAM5_HIENABLE_WIDTH (0x2)
+#define B_SA_PAM5_HIENABLE_MASK (0x30)
+#define V_SA_PAM5_HIENABLE_DEFAULT (0x0)
+
+///
+/// Description:
+/// This register controls the read, write and shadowing attributes of the BIOS range from E_8000h to E_FFFFh. The Uncore allows programmable memory attributes on 13 legacy memory segments of various sizes in the 768KB to 1MB address range. Seven Programmable Attribute Map (PAM) registers are used to support these features. Cacheability of these areas is controlled via the MTRR register in the core.
+/// Two bits are used to specify memory attributes for each memory segment. These bits apply to host accesses to the PAM areas. These attributes are:
+/// RE - Read Enable. When RE=1, the host read accesses to the corresponding memory segment are claimed by the Uncore and directed to main memory. Conversely, when RE=0, the host read accesses are directed to DMI.
+/// WE - Write Enable. When WE=1, the host write accesses to the corresponding memory segment are claimed by the Uncore and directed to main memory. Conversely, when WE=0, the host read accesses are directed to DMI.
+/// The RE and WE attributes permit a memory segment to be Read Only, Write Only, Read/Write or Disabled. For example, if a memory segment has RE=1 and WE=0, the segment is Read Only.
+///
+#define R_SA_PAM6 (0x86)
+///
+/// Description of LOENABLE (0:1)
+/// This field controls the steering of read and write cycles that address the BIOS area from 0E8000h to 0EBFFFh.
+/// 00: DRAM Disabled. All reads are sent to DRAM. All writes are forwarded to DMI.
+/// 01: Read Only. All reads are sent to DRAM. All writes are forwarded to DMI.
+/// 10: Write Only. All writes are sent to DRAM. All reads are serviced by DMI.
+/// 11: Normal DRAM Operation. All reads and writes are serviced by DRAM.
+/// This register is locked by LT.
+///
+#define N_SA_PAM6_LOENABLE_OFFSET (0x0)
+#define S_SA_PAM6_LOENABLE_WIDTH (0x2)
+#define B_SA_PAM6_LOENABLE_MASK (0x3)
+#define V_SA_PAM6_LOENABLE_DEFAULT (0x0)
+///
+/// Description of HIENABLE (4:5)
+/// This field controls the steering of read and write cycles that address the BIOS area from 0EC000h to 0EFFFFh.
+/// 00: DRAM Disabled. All accesses are directed to DMI.
+/// 01: Read Only. All reads are sent to DRAM, all writes are forwarded to DMI.
+/// 10: Write Only. All writes are sent to DRAM, all reads are serviced by DMI.
+/// 11: Normal DRAM Operation. All reads and writes are serviced by DRAM.
+/// This register is locked by LT.
+///
+#define N_SA_PAM6_HIENABLE_OFFSET (0x4)
+#define S_SA_PAM6_HIENABLE_WIDTH (0x2)
+#define B_SA_PAM6_HIENABLE_MASK (0x30)
+#define V_SA_PAM6_HIENABLE_DEFAULT (0x0)
+
+#define R_SA_MC_LAC_OFFSET 0x87 ///< Legacy Access Control Register
+#define R_SA_B_HEN 0x80 ///< RW
+///
+/// Description:
+/// The SMRAMC register controls how accesses to Compatible SMRAM spaces are treated. The Open, Close and Lock bits function only when G_SMRAME bit is set to 1. Also, the Open bit must be reset before the Lock bit is set.
+///
+#define R_SA_SMRAMC (0x88)
+///
+/// Description of C_BASE_SEG (0:2)
+/// This field indicates the location of SMM space. SMM DRAM is not remapped. It is simply made visible if the conditions are right to access SMM space, otherwise the access is forwarded to DMI. Only SMM space bewteen A_0000h and B_FFFFh is supported, so this field is hardwired to 010b.
+///
+#define N_SA_SMRAMC_C_BASE_SEG_OFFSET (0x0)
+#define S_SA_SMRAMC_C_BASE_SEG_WIDTH (0x3)
+#define B_SA_SMRAMC_C_BASE_SEG_MASK (0x7)
+#define V_SA_SMRAMC_C_BASE_SEG_DEFAULT (0x2)
+///
+/// Description of G_SMRAME (3:3)
+/// If set to '1', then Compatible SMRAM functions are enabled, providing 128KB of DRAM accessible at the A_0000h address while in SMM. To enable Extended SMRAM function this bit has to be set to 1. Once D_LCK is set, this bit becomes RO.
+///
+#define N_SA_SMRAMC_G_SMRAME_OFFSET (0x3)
+#define S_SA_SMRAMC_G_SMRAME_WIDTH (0x1)
+#define B_SA_SMRAMC_G_SMRAME_MASK (0x8)
+#define V_SA_SMRAMC_G_SMRAME_DEFAULT (0x0)
+///
+/// Description of D_LCK (4:4)
+/// When D_LCK=1, then D_OPEN is reset to 0 and all writeable fields in this register are locked (become RO). D_LCK can be set to 1 via a normal configuration space write but can only be cleared by a Full Reset.
+/// The combination of D_LCK and D_OPEN provide convenience with security. The BIOS can use the D_OPEN function to initialize SMM space and then use D_LCK to "lock down" SMM space in the future so that no application software (or even BIOS itself) can violate the integrity of SMM space, even if the program has knowledge of the D_OPEN function.
+///
+#define N_SA_SMRAMC_D_LCK_OFFSET (0x4)
+#define S_SA_SMRAMC_D_LCK_WIDTH (0x1)
+#define B_SA_SMRAMC_D_LCK_MASK (0x10)
+#define V_SA_SMRAMC_D_LCK_DEFAULT (0x0)
+///
+/// Description of D_CLS (5:5)
+/// When D_CLS = 1, SMM DRAM space is not accessible to data references, even if SMM decode is active. Code references may still access SMM DRAM space. This will allow SMM software to reference through SMM space to update the display even when SMM is mapped over the VGA range. Software should ensure that D_OPEN = 1 and D_CLS = 1 are not set at the same time.
+///
+#define N_SA_SMRAMC_D_CLS_OFFSET (0x5)
+#define S_SA_SMRAMC_D_CLS_WIDTH (0x1)
+#define B_SA_SMRAMC_D_CLS_MASK (0x20)
+#define V_SA_SMRAMC_D_CLS_DEFAULT (0x0)
+///
+/// Description of D_OPEN (6:6)
+/// When D_OPEN = 1 and D_LCK = 0, the SMM DRAM space is made visible even when SMM decode is not active. This is intended to help BIOS initialize SMM space. Software should ensure that D_OPEN = 1 and D_CLS = 1 are not set at the same time.
+///
+#define N_SA_SMRAMC_D_OPEN_OFFSET (0x6)
+#define S_SA_SMRAMC_D_OPEN_WIDTH (0x1)
+#define B_SA_SMRAMC_D_OPEN_MASK (0x40)
+#define V_SA_SMRAMC_D_OPEN_DEFAULT (0x0)
+
+///
+/// Description:
+///
+#define R_SA_REMAPBASE (0x90)
+///
+/// Description of LOCK (0:0)
+/// This bit will lock all writeable settings in this register, including itself.
+///
+#define N_SA_REMAPBASE_LOCK_OFFSET (0x0)
+#define S_SA_REMAPBASE_LOCK_WIDTH (0x1)
+#define B_SA_REMAPBASE_LOCK_MASK (0x1)
+#define V_SA_REMAPBASE_LOCK_DEFAULT (0x0)
+///
+/// Description of REMAPBASE (20:35)
+/// The value in this register defines the lower boundary of the Remap window. The Remap window is inclusive of this address. In the decoder A[19:0] of the Remap Base Address are assumed to be 0's. Thus the bottom of the defined memory range will be aligned to a 1MB boundary.
+/// When the value in this register is greater than the value programmed into the Remap Limit register, the Remap window is disabled.
+/// These bits are LT lockable.
+///
+#define N_SA_REMAPBASE_REMAPBASE_OFFSET (0x14)
+#define S_SA_REMAPBASE_REMAPBASE_WIDTH (0x10)
+#define B_SA_REMAPBASE_REMAPBASE_MASK (0xffff00000)
+#define V_SA_REMAPBASE_REMAPBASE_DEFAULT (0xffff00000)
+
+///
+/// Description:
+///
+#define R_SA_REMAPLIMIT (0x98)
+///
+/// Description of LOCK (0:0)
+/// This bit will lock all writeable settings in this register, including itself.
+///
+#define N_SA_REMAPLIMIT_LOCK_OFFSET (0x0)
+#define S_SA_REMAPLIMIT_LOCK_WIDTH (0x1)
+#define B_SA_REMAPLIMIT_LOCK_MASK (0x1)
+#define V_SA_REMAPLIMIT_LOCK_DEFAULT (0x0)
+///
+/// Description of REMAPLMT (20:35)
+/// The value in this register defines the upper boundary of the Remap window. The Remap window is inclusive of this address. In the decoder A[19:0] of the remap limit address are assumed to be F's. Thus the top of the defined range will be one byte less than a 1MB boundary.
+/// When the value in this register is less than the value programmed into the Remap Base register, the Remap window is disabled.
+/// These Bits are LT lockable.
+///
+#define N_SA_REMAPLIMIT_REMAPLMT_OFFSET (0x14)
+#define S_SA_REMAPLIMIT_REMAPLMT_WIDTH (0x10)
+#define B_SA_REMAPLIMIT_REMAPLMT_MASK (0xffff00000)
+#define V_SA_REMAPLIMIT_REMAPLMT_DEFAULT (0x0)
+
+///
+/// Description:
+/// This Register contains the size of physical memory. BIOS determines the memory size reported to the OS using this Register.
+///
+#define R_SA_TOM (0xa0)
+///
+/// Description of LOCK (0:0)
+/// This bit will lock all writeable settings in this register, including itself.
+///
+#define N_SA_TOM_LOCK_OFFSET (0x0)
+#define S_SA_TOM_LOCK_WIDTH (0x1)
+#define B_SA_TOM_LOCK_MASK (0x1)
+#define V_SA_TOM_LOCK_DEFAULT (0x0)
+
+///
+/// Description of TOM (20:38)
+/// This register reflects the total amount of populated physical memory. This is NOT necessarily the highest main memory address (holes may exist in main memory address map due to addresses allocated for memory mapped IO). These bits correspond to address bits 38:20 (1MB granularity). Bits 19:0 are assumed to be 0. All the bits in this register are locked in LT mode.
+///
+#define N_SA_TOM_TOM_OFFSET (0x14)
+#define S_SA_TOM_TOM_WIDTH (0x13)
+#define B_SA_TOM_TOM_MASK (0x7ffff00000)
+#define V_SA_TOM_TOM_DEFAULT (0x7ffff00000)
+
+///
+/// Description:
+/// This 64 bit register defines the Top of Upper Usable DRAM.
+/// Configuration software must set this value to TOM minus all EP stolen memory if reclaim is disabled. If reclaim is enabled, this value must be set to reclaim limit + 1byte, 1MB aligned, since reclaim limit is 1MB aligned. Address bits 19:0 are assumed to be 000_0000h for the purposes of address comparison. The Host interface positively decodes an address towards DRAM if the incoming address is less than the value programmed in this register and greater than or equal to 4GB.
+/// BIOS Restriction: Minimum value for TOUUD is 4GB.
+/// These bits are LT lockable.
+///
+#define R_SA_TOUUD (0xa8)
+///
+/// Description of LOCK (0:0)
+/// This bit will lock all writeable settings in this register, including itself.
+///
+#define N_SA_TOUUD_LOCK_OFFSET (0x0)
+#define S_SA_TOUUD_LOCK_WIDTH (0x1)
+#define B_SA_TOUUD_LOCK_MASK (0x1)
+#define V_SA_TOUUD_LOCK_DEFAULT (0x0)
+///
+/// Description of TOUUD (20:38)
+/// This register contains bits 38 to 20 of an address one byte above the maximum DRAM memory above 4G that is usable by the operating system. Configuration software must set this value to TOM minus all EP stolen memory if reclaim is disabled. If reclaim is enabled, this value must be set to reclaim limit 1MB aligned since reclaim limit + 1byte is 1MB aligned. Address bits 19:0 are assumed to be 000_0000h for the purposes of address comparison. The Host interface positively decodes an address towards DRAM if the incoming address is less than the value programmed in this register and greater than 4GB.
+/// All the bits in this register are locked in LT mode.
+///
+#define N_SA_TOUUD_TOUUD_OFFSET (0x14)
+#define S_SA_TOUUD_TOUUD_WIDTH (0x13)
+#define B_SA_TOUUD_TOUUD_MASK (0x7ffff00000ULL)
+#define V_SA_TOUUD_TOUUD_DEFAULT (0x0)
+
+///
+/// Description:
+/// This register contains the base address of graphics data stolen DRAM memory. BIOS determines the base of graphics data stolen memory by subtracting the graphics data stolen memory size (PCI Device 0 offset 52 bits 7:4) from TOLUD (PCI Device 0 offset BC bits 31:20).
+///
+#define R_SA_BDSM (0xb0)
+///
+/// Description of LOCK (0:0)
+/// This bit will lock all writeable settings in this register, including itself.
+///
+#define N_SA_BDSM_LOCK_OFFSET (0x0)
+#define S_SA_BDSM_LOCK_WIDTH (0x1)
+#define B_SA_BDSM_LOCK_MASK (0x1)
+#define V_SA_BDSM_LOCK_DEFAULT (0x0)
+///
+/// Description of BDSM (20:31)
+/// This register contains bits 31 to 20 of the base address of stolen DRAM memory. BIOS determines the base of graphics stolen memory by subtracting the graphics stolen memory size (PCI Device 0 offset 52 bits 6:4) from TOLUD (PCI Device 0 offset BC bits 31:20).
+///
+#define N_SA_BDSM_BDSM_OFFSET (0x14)
+#define S_SA_BDSM_BDSM_WIDTH (0xc)
+#define B_SA_BDSM_BDSM_MASK (0xfff00000)
+#define V_SA_BDSM_BDSM_DEFAULT (0x0)
+
+///
+/// Description:
+/// This register contains the base address of stolen DRAM memory for the GTT. BIOS determines the base of GTT stolen memory by subtracting the GTT graphics stolen memory size (PCI Device 0 offset 52 bits 9:8) from the Graphics Base of Data Stolen Memory (PCI Device 0 offset B0 bits 31:20).
+///
+#define R_SA_BGSM (0xb4)
+///
+/// Description of LOCK (0:0)
+/// This bit will lock all writeable settings in this register, including itself.
+///
+#define N_SA_BGSM_LOCK_OFFSET (0x0)
+#define S_SA_BGSM_LOCK_WIDTH (0x1)
+#define B_SA_BGSM_LOCK_MASK (0x1)
+#define V_SA_BGSM_LOCK_DEFAULT (0x0)
+///
+/// Description of BGSM (20:31)
+/// This register contains the base address of stolen DRAM memory for the GTT. BIOS determines the base of GTT stolen memory by subtracting the GTT graphics stolen memory size (PCI Device 0 offset 52 bits 11:8) from the Graphics Base of Data Stolen Memory (PCI Device 0 offset B0 bits 31:20).
+///
+#define N_SA_BGSM_BGSM_OFFSET (0x14)
+#define S_SA_BGSM_BGSM_WIDTH (0xc)
+#define B_SA_BGSM_BGSM_MASK (0xfff00000)
+#define V_SA_BGSM_BGSM_DEFAULT (0x0)
+
+///
+/// Description:
+/// This register contains the base address of TSEG DRAM memory. BIOS determines the base of TSEG memory which must be at or below Graphics Base of GTT Stolen Memory (PCI Device 0 Offset B4 bits 31:20).
+///
+#define R_SA_TSEGMB (0xb8)
+///
+/// Description of LOCK (0:0)
+/// This bit will lock all writeable settings in this register, including itself.
+///
+#define N_SA_TSEGMB_LOCK_OFFSET (0x0)
+#define S_SA_TSEGMB_LOCK_WIDTH (0x1)
+#define B_SA_TSEGMB_LOCK_MASK (0x1)
+#define V_SA_TSEGMB_LOCK_DEFAULT (0x0)
+///
+/// Description of TSEGMB (20:31)
+/// This register contains the base address of TSEG DRAM memory. BIOS determines the base of TSEG memory which must be at or below Graphics Base of GTT Stolen Memory (PCI Device 0 Offset B4 bits 31:20).
+///
+#define N_SA_TSEGMB_TSEGMB_OFFSET (0x14)
+#define S_SA_TSEGMB_TSEGMB_WIDTH (0xc)
+#define B_SA_TSEGMB_TSEGMB_MASK (0xfff00000)
+#define V_SA_TSEGMB_TSEGMB_DEFAULT (0x0)
+
+///
+/// Description:
+/// This register contains the Top of low memory address.
+///
+#define R_SA_TOLUD (0xbc)
+///
+/// Description of LOCK (0:0)
+/// This bit will lock all writeable settings in this register, including itself.
+///
+#define N_SA_TOLUD_LOCK_OFFSET (0x0)
+#define S_SA_TOLUD_LOCK_WIDTH (0x1)
+#define B_SA_TOLUD_LOCK_MASK (0x1)
+#define V_SA_TOLUD_LOCK_DEFAULT (0x0)
+///
+/// Description of TOLUD (20:31)
+/// This register contains bits 31 to 20 of an address one byte above the maximum DRAM memory below 4G that is usable by the operating system. Address bits 31 down to 20 programmed to 01h implies a minimum memory size of 1MB. Configuration software must set this value to the smaller of the following 2 choices: maximum amount memory in the system minus ME stolen memory plus one byte or the minimum address allocated for PCI memory. Address bits 19:0 are assumed to be 0_0000h for the purposes of address comparison. The Host interface positively decodes an address towards DRAM if the incoming address is less than the value programmed in this register.
+/// The Top of Low Usable DRAM is the lowest address above both Graphics Stolen memory and Tseg. BIOS determines the base of Graphics Stolen Memory by subtracting the Graphics Stolen Memory Size from TOLUD and further decrements by Tseg size to determine base of Tseg. All the Bits in this register are locked in LT mode.
+/// This register must be 1MB aligned when reclaim is enabled.
+///
+#define N_SA_TOLUD_TOLUD_OFFSET (0x14)
+#define S_SA_TOLUD_TOLUD_WIDTH (0xc)
+#define B_SA_TOLUD_TOLUD_MASK (0xfff00000)
+#define V_SA_TOLUD_TOLUD_DEFAULT (0x100000)
+
+#define R_SA_MC_ERRSTS_OFFSET 0xC8 ///< Error Status Register
+#define B_GMSWSMI 0x1000 ///< Software SMI
+#define R_SA_MC_ERRCMD_OFFSET 0xCA ///< Error Command Register
+#define R_SA_MC_SKPD_OFFSET 0xDC ///< Scratch Pad Data
+#define R_SA_MC_CAPID0_OFFSET 0xE0 ///< Capability Identification @bug reserved in EDS
+#define R_SA_MC_CAPID0_A_OFFSET 0xE4
+
+//
+// MCHBAR IO Register Offset Equates
+//
+#define R_SA_MCHBAR_PAVPC_OFFSET 0x34 ///< PAPVC
+#define R_SA_MCHBAR_PCIE_CODE_VERSION_OFFSET_HSW 0x5434
+#define R_SA_MCHBAR_BIOS_RESET_CPL_OFFSET 0x5DA8
+#define R_SA_MCHBAR_SAPMCTL_OFFSET 0x5F00
+#define R_SA_MCHBAR_GDXCBAR_OFFSET 0x5420
+#define R_SA_MCHBAR_EDRAMBAR_OFFSET 0x5408
+#define R_SA_MCHBAR_ILTR_OVRD_OFFSET 0x5D30
+#define R_SA_MCHBAR_CRDTCTL0_OFFSET 0x7400
+#define R_SA_MCHBAR_CRDTCTL1_OFFSET 0x7404
+#define R_SA_MCHBAR_CRDTCTL2_OFFSET 0x7408
+#define R_SA_MCHBAR_CRDTCTL3_OFFSET 0x740C
+#define R_SA_MCHBAR_CRDTCTL4_OFFSET 0x7410
+#define R_SA_MCHBAR_CRDTCTL6_OFFSET 0x7418
+#define R_SA_MCHBAR_CRDTCTL8_OFFSET 0x7454
+
+#define V_SA_LTR_MAX_SNOOP_LATENCY_VALUE 0x0846 ///< Intel recommended maximum value for Snoop Latency (70us)
+#define V_SA_LTR_MAX_NON_SNOOP_LATENCY_VALUE 0x0846 ///< Intel recommended maximum value for Non-Snoop Latency (70us)
+
+//
+// Thermal Management Controls
+//
+//
+// Device 1 Memory Mapped IO Register Offset Equates
+//
+#define V_SA_PEG_VID 0x8086
+#define V_SA_PEG_DID 0x2A41
+
+///
+/// Device 1 Register Equates
+///
+#define R_SA_PEG_VID_OFFSET 0x00 ///< Vendor ID
+#define R_SA_PEG_DID_OFFSET 0x02 ///< Device ID
+#define R_SA_PEG_BCTRL_OFFSET 0x3E ///< Bridge Control
+#define R_SA_PEG_SSCAPID_OFFSET 0x88 ///< Subsystem ID and Vendor ID Capabilities IS
+#define R_SA_PEG_SS_OFFSET 0x8C ///< Subsystem ID
+#define R_SA_PEG_MSICAPID_OFFSET 0x90 ///< MSI Capabilities ID
+#define R_SA_PEG_MC_OFFSET 0x92 ///< Message Control
+#define R_SA_PEG_MA_OFFSET 0x94 ///< Message Address
+#define R_SA_PEG_MD_OFFSET 0x98 ///< Message Data
+#define R_SA_PEG_CAPL_OFFSET 0xA0 ///< PEG Capabilities List
+#define R_SA_PEG_CAP_OFFSET 0xA2 ///< PEG Capabilities
+#define R_SA_PEG_DCAP_OFFSET 0xA4 ///< Device Capabilities
+#define R_SA_PEG_DCTL_OFFSET 0xA8 ///< Device Control
+#define R_SA_PEG_DSTS_OFFSET 0xAA ///< Device Status
+#define R_SA_PEG_LCAP_OFFSET 0xAC ///< Link Capabilities
+#define R_SA_PEG_LCTL_OFFSET 0xB0 ///< Link Control
+#define R_SA_PEG_LSTS_OFFSET 0xB2 ///< Link Status
+#define R_SA_PEG_SLOTCAP_OFFSET 0xB4 ///< Slot Capabilities
+#define R_SA_PEG_SLOTCTL_OFFSET 0xB8 ///< Slot Control
+#define R_SA_PEG_SLOTSTS_OFFSET 0xBA ///< Slot Status
+#define R_SA_PEG_RCTL_OFFSET 0xBC ///< Root Control
+#define R_SA_PEG_RSTS_OFFSET 0xC0 ///< Root Status
+#define R_SA_PEG_DCAP2_OFFSET 0xC4 ///< Device Capability 2
+#define R_SA_PEG_DCTL2_OFFSET 0xC8 ///< Device Control 2
+#define R_SA_PEG_LCTL2_OFFSET 0xD0 ///< Link Control 2
+#define R_SA_PEG_LSTS2_OFFSET 0xD2 ///< Link Status 2
+#define R_SA_PEG_PEGLC_OFFSET 0xEC ///< PEG Legacy Control
+#define R_SA_PEG_VCECH_OFFSET 0x100 ///< PEG Virtual Channel Enhanced Capability
+#define R_SA_PEG_VCCAP1_OFFSET 0x104 ///< PEG Port VC Capability
+#define R_SA_PEG_VCCAP2_OFFSET 0x108 ///< PEG Port VC Capability 2
+#define R_SA_PEG_VCCTL_OFFSET 0x10C ///< PEG Port VC Control
+#define R_SA_PEG_VC0RCAP_OFFSET 0x110 ///< PEG VC0 Resource Capability
+#define R_SA_PEG_VC0RCTL0_OFFSET 0x114 ///< PEG VC0 Resource Control
+#define R_SA_PEG_VC0RSTS_OFFSET 0x11A ///< PEG VC0 Resource Status
+#define R_SA_PEG_VC1RCAP_OFFSET 0x11C ///< PEG VC1 Resource Capability
+#define R_SA_PEG_VC1RCTL1_OFFSET 0x120 ///< PEG VC1 Resource Control
+#define R_SA_PEG_VC1RSTS_OFFSET 0x126 ///< PEG VC1 Resource Status
+#define R_SA_PEG_RCLDECH_OFFSET 0x140 ///< PEG Root Complex Link Declaration
+#define R_SA_PEG_ESD_OFFSET 0x144 ///< PEG Element Self Description
+#define R_SA_PEG_LE1D_OFFSET 0x150 ///< PEG Link Entry 1 Description
+#define R_SA_PEG_LE1A_OFFSET 0x158 ///< PEG Link Entry 1 Address
+#define R_SA_PEG_PEGUESTS_OFFSET 0x1C4 ///< PEG Error Status
+#define R_SA_PEG_PEGCESTS_OFFSET 0x1D0 ///< PEG Error Status
+#define R_SA_PEG_PEGSTS_OFFSET 0x214 ///< PEG Status
+#define R_SA_PEG_LTSSMC_OFFSET 0x224 ///< PEG LTSSMC Control
+#define R_SA_PEG_L0SLAT_OFFSET 0x22C ///< PEG L0s Control
+#define R_SA_PEG_CFG2_OFFSET 0x250 ///< PEG Config 2
+#define R_SA_PEG_CFG4_OFFSET 0x258 ///< PEG Config 4
+#define R_SA_PEG_CFG5_OFFSET 0x25C ///< PEG Config 5
+#define R_SA_PEG_CFG6_OFFSET 0x260 ///< PEG Config 6
+#define R_SA_PEG_VC0PRCA_OFFSET 0x308 ///< PEG VC0 Posted
+#define R_SA_PEG_VC0NPRCA_OFFSET 0x314 ///< PEG VC0 Non-Posted
+#define R_SA_PEG_VC0CCL_OFFSET 0x31C ///< PEG Completion Credit Limit
+#define R_SA_PEG_VC01CL_OFFSET 0x320 ///< PEG Chaining Limit
+#define R_SA_PEG_VC1PRCA_OFFSET 0x32C ///< PEG VC1 Posted
+#define R_SA_PEG_VC1NPRCA_OFFSET 0x330 ///< PEG VC1 Non-Posted
+#define R_SA_PEG_REUT_PH_CTR1_OFFSET 0x448 ///< PEG PHY Control
+#define R_SA_PEG_REUT_PH1_PIS_OFFSET 0x464 ///< PEG PH1 PIS
+#define R_SA_PEG_REUT_OVR_CTL_OFFSET 0x490 ///< PEG REUT Override
+#define R_SA_PEG_FUSESCMN_OFFSET 0x504 ///< PEG Fuses
+#define R_SA_PEG_AFEBND0CFG5_OFFSET 0x80C ///< PEG AFE Bundle Config 5
+#define R_SA_PEG_EQPH3_OFFSET 0x814 ///< PEG Phase 3
+#define R_SA_PEG_AFEBND0CFG0_OFFSET 0x900 ///< PEG AFE Bundle Config 0
+#define R_SA_PEG_AFEBND0CFG1_OFFSET 0x904 ///< PEG AFE Bundle Config 1
+#define R_SA_PEG_AFEBND0CFG2_OFFSET 0x908 ///< PEG AFE Bundle Config 2
+#define R_SA_PEG_AFEBND0CFG3_OFFSET 0x90C ///< PEG AFE Bundle Config 3
+#define R_SA_PEG_AFEBND0CFG4_OFFSET 0x910 ///< PEG AFE Bundle Config 4
+#define R_SA_PEG_LOADBUSCTL0_OFFSET 0x914 ///< PEG Load Bus Control
+#define R_SA_PEG_G3CTL0_OFFSET 0x918 ///< PEG Gen3 Control
+#define R_SA_PEG_BND0SPARE_OFFSET 0x91C ///< PEG Bundle 0 Spare Register
+#define R_SA_PEG_AFELN0CFG0_OFFSET 0xA00 ///< PEG AFE Lane Config 0
+#define R_SA_PEG_AFELN0CFG1_OFFSET 0xA04 ///< PEG AFE Lane Config 1
+#define R_SA_PEG_AFEOVR_OFFSET 0xC20 ///< PEG AFE Override
+#define R_SA_PEG_AFE_PWRON_OFFSET 0xC24 ///< PEG AFE Power-on
+#define R_SA_PEG_AFE_PM_TMR_OFFSET 0xC28 ///< PEG AFE PM Timer
+#define R_SA_PEG_CMNRXERR_OFFSET 0xC34 ///< PEG Common Error
+#define R_SA_PEG_CMNSPARE_OFFSET 0xC38 ///< PEG Common Spare
+#define R_SA_PEG_PEGTST_OFFSET 0xD0C ///< PEG TEST
+#define R_SA_PEG_DEBUP2_OFFSET 0xD10 ///< PEG Debug
+#define R_SA_PEG_DEBUP3_OFFSET 0xD14 ///< PEG Debug
+#define R_SA_PEG_PEGCOMLCGCTRL_OFFSET 0xD20 ///< PEG Clock Gating Control
+#define R_SA_PEG_FCLKGTTLLL_OFFSET 0xD24 ///< PEG FCLK Clock Gating
+#define R_SA_PEG_LCTL3_OFFSET 0xD98 ///< PEG Link Control 3
+#define R_SA_PEG_LNERRSTAT_OFFSET 0xD9C ///< PEG Lane Error Status
+#define R_SA_PEG_EQCTL0_1_OFFSET 0xDA0 ///< PEG Lane Equalization
+#define R_SA_PEG_EQCFG_OFFSET 0xDD8 ///< PEG Equalization Config
+#define R_SA_PEG_PLUCTLH0_OFFSET 0xE0C ///< PEG Lane Config
+
+///
+/// Device 2 Register Equates
+//
+// The following equates must be reviewed and revised when the specification is ready.
+//
+#define SA_IGD_BUS 0x00
+#define SA_IGD_DEV 0x02
+#define SA_IGD_FUN_0 0x00
+#define SA_IGD_FUN_1 0x01
+#define SA_IGD_DEV_FUN (SA_IGD_DEV << 3)
+#define SA_IGD_BUS_DEV_FUN (SA_MC_BUS << 8) + SA_IGD_DEV_FUN
+
+#define V_SA_IGD_VID 0x8086
+#define V_SA_IGD_DID 0x2A42
+#define V_SA_IGD_DID_MB 0x0106
+#define V_SA_IGD_DID_MB_1 0x0116
+#define V_SA_IGD_DID_MB_2 0x0126
+#define V_SA_IGD_DID_DT 0x0102
+#define V_SA_IGD_DID_DT_1 0x0112
+#define V_SA_IGD_DID_DT_2 0x0122
+#define V_SA_IGD_DID_DT_3 0x010A
+
+///
+/// For HSW IGD
+///
+#define V_SA_PCI_DEV_2_HSM_ID 0x00C06 ///< Dev2-HSW GT-L Mobile
+#define V_SA_PCI_DEV_2_GT_HSM_ID 0x00C16 ///< Dev2-HSW GT-M Mobile
+#define V_SA_PCI_DEV_2_GT2P_HSM_ID 0x00C26 ///< Dev2-HSW GT-H Mobile
+#define V_SA_PCI_DEV_2_HSD_ID 0x00C02 ///< Dev2-HSW GT-L Desktop
+#define V_SA_PCI_DEV_2_GT_HSD_ID 0x00C12 ///< Dev2-HSW GT-M Desktop
+#define V_SA_PCI_DEV_2_GT2P_HSD_ID 0x00C22 ///< Dev2-HSW GT-H Desktop
+#define V_SA_PCI_DEV_2_HSS_ID 0x00C0A ///< Dev2-HSW GT-L Server
+#define V_SA_PCI_DEV_2_GT_HSS_ID 0x00C1A ///< Dev2-HSW GT-M Server
+#define V_SA_PCI_DEV_2_GT2P_HSS_ID 0x00C2A ///< Dev2-HSW GT-H Server
+
+#define V_SA_PCI_DEV_2_GT1_HSM_ID 0x00406 ///< Dev2-HSW GT1-H Mobile
+#define V_SA_PCI_DEV_2_GT2_HSM_ID 0x00416 ///< Dev2-HSW GT2-M Mobile
+#define V_SA_PCI_DEV_2_GT3_HSM_ID 0x00426 ///< Dev2-HSW GT3-H Mobile
+#define V_SA_PCI_DEV_2_GT1_HSD_ID 0x00402 ///< Dev2-HSW GT1 Desktop
+#define V_SA_PCI_DEV_2_GT2_HSD_ID 0x00412 ///< Dev2-HSW GT2 Desktop
+#define V_SA_PCI_DEV_2_GT3_HSD_ID 0x00422 ///< Dev2-HSW GT3 Desktop
+#define V_SA_PCI_DEV_2_GT15_HSD_ID 0x0041E ///< Dev2-HSW GT1.5 Desktop
+#define V_SA_PCI_DEV_2_GT1_HSS_ID 0x0040A ///< Dev2-HSW GT1 Server
+#define V_SA_PCI_DEV_2_GT2_HSS_ID 0x0041A ///< Dev2-HSW GT2 Server
+#define V_SA_PCI_DEV_2_GT3_HSS_ID 0x0042A ///< Dev2-HSW GT3 Server
+///
+/// For HSW ULT
+///
+#define V_SA_PCI_DEV_2_GT1_HUM_ID 0x00A06 ///< Dev2-HSW ULT GT1 Mobile
+#define V_SA_PCI_DEV_2_GT2_HUM_ID 0x00A16 ///< Dev2-HSW ULT GT2 Mobile
+#define V_SA_PCI_DEV_2_GT3_HUM_ID 0x00A26 ///< Dev2-HSW ULT GT3 Mobile
+#define V_SA_PCI_DEV_2_GT3_HXM_ID 0x00A2E ///< Dev2-HSW ULT GT3 Mobile
+#define V_SA_PCI_DEV_2_GT1_HUD_ID 0x00A02 ///< Dev2-HSW ULT GT1 Desktop
+#define V_SA_PCI_DEV_2_GT2_HUD_ID 0x00A12 ///< Dev2-HSW ULT GT2 Desktop
+#define V_SA_PCI_DEV_2_GT3_HUD_ID 0x00A22 ///< Dev2-HSW ULT GT3 Desktop
+#define V_SA_PCI_DEV_2_GT1_HUS_ID 0x00A0A ///< Dev2-HSW ULT GT1 Server
+#define V_SA_PCI_DEV_2_GT2_HUS_ID 0x00A1A ///< Dev2-HSW ULT GT2 Server
+#define V_SA_PCI_DEV_2_GT3_HUS_ID 0x00A2A ///< Dev2-HSW ULT GT3 Server
+
+///
+/// For CRW IGD
+///
+#define V_SA_PCI_DEV_2_GT1_HSD_CRW 0x00D12 ///< Dev2-HSW DT-GT1
+#define V_SA_PCI_DEV_2_GT2_HSD_CRW 0x00D22 ///< Dev2-HSW DT-GT2
+#define V_SA_PCI_DEV_2_GT3_HSD_CRW 0x00D32 ///< Dev2-HSW DT-GT3
+#define V_SA_PCI_DEV_2_GT1_HSM_CRW 0x00D16 ///< Dev2-HSW MB-GT1
+#define V_SA_PCI_DEV_2_GT2_HSM_CRW 0x00D26 ///< Dev2-HSW MB-GT2
+#define V_SA_PCI_DEV_2_GT3_HSM_CRW 0x00D36 ///< Dev2-HSW MB-GT3
+
+///
+/// For HSW ULX
+///
+#define V_SA_PCI_DEV_2_GT1_HSW_ULX 0x00A0E ///< Dev2-HSW ULX GT1
+#define V_SA_PCI_DEV_2_GT2_HSW_ULX 0x00A1E ///< Dev2-HSW ULX GT2
+
+#define R_SA_IGD_VID 0x00
+#define R_SA_IGD_CMD 0x04
+#define R_SA_IGD_GTTMMADR 0x10
+#define R_SA_IGD_GMADR 0x18
+#define R_SA_IGD_IOBAR 0x20
+
+#define R_SA_IGD_BSM_OFFSET 0x005C ///< Base of Stolen Memory
+#define R_SA_IGD_MSAC_OFFSET 0x0062 ///< Multisize Aperture Control
+#define R_SA_IGD_MSICAPID_OFFSET 0x0090 ///< MSI Capabilities ID
+#define R_SA_IGD_MC_OFFSET 0x0092 ///< Message Control
+#define R_SA_IGD_MA_OFFSET 0x0094 ///< Message Address
+#define R_SA_IGD_MD_OFFSET 0x0098 ///< Message Data
+#define R_SA_IGD_SWSCI_OFFSET 0x00E8
+#define R_SA_IGD_ASLS_OFFSET 0x00FC ///< ASL Storage
+
+//
+// Device 3 Equates
+//
+#define SA_HDA_BUS_NUM 0x00
+#define SA_HDA_DEV_NUM 0x03
+#define SA_HDA_FUN_NUM 0x00
+#define SA_HDA_HDBAR_SIZE (1 << 14)
+#define SA_HDA_HDBARL 0x10
+#define SA_HDA_HDBARU 0x14
+
+///
+/// Maximum number of SDRAM channels supported by the memory controller
+///
+///
+/// Maximum number of SDRAM channels supported by the memory controller
+///
+#define SA_MC_MAX_CHANNELS 2
+///
+/// Maximum number of DIMM sockets supported by each channel
+///
+#define SA_MC_MAX_SLOTS 2
+
+///
+/// Maximum number of sides supported per DIMM
+///
+#define SA_MC_MAX_SIDES 2
+
+///
+/// Maximum number of DIMM sockets supported by the memory controller
+///
+#define SA_MC_MAX_SOCKETS (SA_MC_MAX_CHANNELS * SA_MC_MAX_SLOTS)
+
+///
+/// Maximum number of rows supported by the memory controller
+///
+#define SA_MC_MAX_RANKS (SA_MC_MAX_SOCKETS * SA_MC_MAX_SIDES)
+
+///
+/// Maximum number of rows supported by the memory controller
+///
+#define SA_MC_MAX_ROWS (SA_MC_MAX_SIDES * SA_MC_MAX_SOCKETS)
+
+///
+/// Maximum memory supported by the memory controller
+/// 4 GB in terms of KB
+///
+#define SA_MC_MAX_MEM_CAPACITY (4 * 1024 * 1024)
+
+///
+/// Define the SPD Address for DIMM 0
+///
+#define SA_MC_DIMM0_SPD_ADDRESS 0xA0
+
+///
+/// Internal Graphics Display and Render Clock Freqencies
+///
+#define R_SA_MC_MMIO_GCFGC 0xC8C ///< Graphics Clock Frequency and Gating Control
+#define R_SA_IGD_GCFGC_OFFSET 0x00F0 ///< Graphics Clock Frequency and Gating Control
+#define N_SA_GCFGC_GCRC BIT9 ///< Gate Core Display ClockGate Core Display Clock
+#define B_SA_GCFGC_GCSCS_MASK (BIT19 | BIT18 | BIT17 | BIT16) ///< Graphics Core Sampler Clock Select (GCSCS)
+#define B_SA_GCFGC_GCDCS_MASK (BIT6 | BIT5 | BIT4) ///< Graphics Core Display Clock Select (GCDCS)
+#define B_SA_GCFGC_GCRCS_MASK (BIT3 | BIT2 | BIT1 | BIT0) ///< Graphics Core Render Clock Select (GCRCS)
+#define R_SA_MC_MMIO_IOCKTRR1 0x0B68 ///< IO Circuit Reserve Register 1
+#define R_SA_MCHBAR_GFXPLL0 0x2C30 ///< GFX PLL BIOS
+#define R_SA_MCHBAR_GFXPLL1 0x2C32 ///< GFX PLL BIOS
+#define R_SA_MCHBAR_GFXPLL9 0x2C44 ///< GFX PLL Frequency Change Control
+#define R_SA_MCHBAR_RGVSWCTL 0x1170
+#define R_SA_MCHBAR_VIDCTL 0x11C0
+#define R_SA_MCHBAR_PMCFG 0x1210
+
+///
+/// DMIBAR registers
+///
+#define R_SA_DMIBAR_DMIPVCCAP1_OFFSET 0x4 ///< DMI VC Capabilities 1
+#define R_SA_DMIBAR_DMIVC0RCTL_OFFSET 0x14 ///< DMI VC0 Resource Control
+#define R_SA_DMIBAR_DMIVC0RSTS_OFFSET 0x1A ///< DMI VC0 Status
+#define R_SA_DMIBAR_DMIVC1RCTL_OFFSET 0x20 ///< DMI VC1 Resource Control
+#define R_SA_DMIBAR_DMIVC1RSTS_OFFSET 0x26 ///< DMI VC1 Status
+#define R_SA_DMIBAR_DMIVCPRCTL_OFFSET 0x2C ///< DMI VCp Resource Control
+#define R_SA_DMIBAR_DMIVCPRSTS_OFFSET 0x32 ///< DMI VCp Status
+#define R_SA_DMIBAR_DMIVCMRCTL_OFFSET 0x38 ///< DMI VCm Resource Control
+#define R_SA_DMIBAR_DMIVCMRSTS_OFFSET 0x3E ///< DMI VCm Status
+#define R_SA_DMIBAR_LCAP_OFFSET 0x84 ///< DMI Link Capabilities
+#define R_SA_DMIBAR_LCTL_OFFSET 0x88 ///< DMI Link Control
+#define R_SA_DMIBAR_LSTS_OFFSET 0x8A ///< DMI Link Status
+#define R_SA_DMIBAR_LCTL2_OFFSET 0x98 ///< DMI Link Control 2
+#define R_SA_DMIBAR_DMICC_OFFSET 0x208 ///< DMI Config Control
+#define R_SA_DMIBAR_LTSSMC_OFFSET 0x224 ///< DMI LTSSMC Control
+#define R_SA_DMIBAR_L0SLAT_OFFSET 0x22C ///< DMI L0s Control
+#define R_SA_DMIBAR_CFG4_OFFSET 0x258 ///< DMI Config 4
+#define R_SA_DMIBAR_CFG6_OFFSET 0x260 ///< DMI Config 6
+#define R_SA_DMIBAR_SCRATCHPAD0_OFFSET 0x71C ///< DMI Scratchpad 0
+#define R_SA_DMIBAR_SCRATCHPAD1_OFFSET 0x720 ///< DMI Scratchpad 1
+#define R_SA_DMIBAR_AFEBND0CFG1_OFFSET 0x904 ///< DMI AFE Bundle Config 1
+#define R_SA_DMIBAR_AFEBND0CFG2_OFFSET 0x908 ///< DMI AFE Bundle Config 2
+#define R_SA_DMIBAR_AFELN0CFG0_OFFSET 0xA00 ///< DMI AFE Lane Config 0
+#define R_SA_DMIBAR_CMNSPARE_OFFSET 0xC38 ///< DMI Common Spare
+
+#define N_SA_DMIBAR_DMIVCCTL_EN BIT31
+#define V_SA_DMIBAR_DMIVCCTL_ID (7 << 24) ///< Bit[26:24]
+#define B_SA_DMIBAR_DMIVCCTL_TVM_MASK 0xFE
+#define N_SA_DMIBAR_DMIVCCTL_ID 24
+#define B_SA_DMIBAR_DMISTS_NP BIT1
+
+///
+/// Vt-d Engine base address.
+///
+#define R_SA_MCHBAR_VTD1_OFFSET 0x5400 ///< HW UNIT2 for IGD
+#define R_SA_MCHBAR_VTD2_OFFSET 0x5410 ///< HW UNIT3 for all other - PEG, USB, SATA etc
+
+//
+// VCU Mailbox Definitions
+//
+#define R_SA_MCHBAR_VCU_MAILBOX_INTERFACE_OFFSET 0x6C00
+#define R_SA_MCHBAR_VCU_MAILBOX_DATA_OFFSET 0x6C04
+#define B_SA_MCHBAR_VCU_STATUS_RUN_BUSY BIT31
+#define V_SA_VCU_OPCODE_OPEN_SEQ_REV1 0x1
+#define V_SA_VCU_OPCODE_CLOSE_SEQ_REV1 0x2
+#define V_SA_VCU_OPCODE_READ_VCU_API_VER_ID_REV1 0x5
+#define V_SA_VCU_OPCODE_READ_DATA_REV1 0x6
+#define V_SA_VCU_OPCODE_WRITE_DATA_REV1 0x7
+#define V_SA_VCU_OPCODE_READ_CSR_REV1 0x20
+#define V_SA_VCU_OPCODE_WRITE_CSR_REV1 0x21
+#define V_SA_VCU_OPCODE_READ_MMIO_REV1 0x22
+#define V_SA_VCU_OPCODE_WRITE_MMIO_REV1 0x23
+
+#define V_SA_VCU_OPCODE_OPEN_SEQ_REV2 0x2
+#define V_SA_VCU_OPCODE_CLOSE_SEQ_REV2 0x3
+#define V_SA_VCU_OPCODE_READ_VCU_API_VER_ID_REV2 0x1
+#define V_SA_VCU_OPCODE_READ_DATA_REV2 0x7
+#define V_SA_VCU_OPCODE_WRITE_DATA_REV2 0x8
+#define V_SA_VCU_OPCODE_READ_CSR_REV2 0x13
+#define V_SA_VCU_OPCODE_WRITE_CSR_REV2 0x14
+#define V_SA_VCU_OPCODE_READ_MMIO_REV2 0x15
+#define V_SA_VCU_OPCODE_WRITE_MMIO_REV2 0x16
+
+
+#define V_SA_VCU_SEQID_READ_CSR_REV1 0x6
+#define V_SA_VCU_SEQID_WRITE_CSR_REV1 0x7
+#define V_SA_VCU_SEQID_READ_MMIO_REV1 0x8
+#define V_SA_VCU_SEQID_WRITE_MMIO_REV1 0x9
+
+#define V_SA_VCU_SEQID_READ_CSR_REV2 0x1
+#define V_SA_VCU_SEQID_WRITE_CSR_REV2 0x2
+#define V_SA_VCU_SEQID_READ_MMIO_REV2 0x3
+#define V_SA_VCU_SEQID_WRITE_MMIO_REV2 0x4
+
+#define V_SA_VCU_RESPONSE_SUCCESS 0x40
+#define V_SA_VCU_RESPONSE_BUSY 0x80
+#define V_SA_VCU_RESPONSE_THREADUNAVAILABLE 0x82
+#define V_SA_VCU_RESPONSE_ILLEGAL 0x90
+#define R_SA_VCU_AFECMNCFG0_ADDRESS_REV1 0x0C008018
+#define R_SA_VCU_AFECMNCFG2_ADDRESS_REV1 0x0C088018
+#define R_SA_VCU_AFECMNCFG3_ADDRESS_REV1 0x0C0C8018
+#define R_SA_VCU_AFECMNCFG7_ADDRESS_REV1 0x0C308803
+
+#define R_SA_VCU_AFECMNCFG0_ADDRESS_REV2 0x0C008001
+#define R_SA_VCU_AFECMNCFG2_ADDRESS_REV2 0x0C088001
+#define R_SA_VCU_AFECMNCFG3_ADDRESS_REV2 0x0C0C8001
+#define R_SA_VCU_AFECMNCFG7_ADDRESS_REV2 0x0C308080
+
+///
+/// VCU Miscellaneous Controls
+///
+#define V_SA_VCU_STATUS_BUSY_LIMIT 100
+#define V_SA_VCU_RESPONSE_RETRY_LIMIT 10
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Common/SaPcieLib.c b/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Common/SaPcieLib.c
new file mode 100644
index 0000000..0e83b90
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Common/SaPcieLib.c
@@ -0,0 +1,1780 @@
+/** @file
+ SA PCIE Library
+
+@copyright
+ Copyright (c) 2012 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueBase.h"
+#include "EfiCommon.h"
+#include "SaAccess.h"
+#include "PchAccess.h"
+#include EFI_PROTOCOL_CONSUMER (SaPlatformPolicy)
+#include "SaPcieLib.h"
+#include "CpuRegs.h"
+#include "CpuPlatformLib.h"
+#endif
+
+#define LTR_VALUE_MASK (BIT0 + BIT1 + BIT2 + BIT3 + BIT4 + BIT5 + BIT6 + BIT7 + BIT8 + BIT9)
+#define LTR_SCALE_MASK (BIT10 + BIT11 + BIT12)
+
+///
+/// LTR related macros
+///
+#define LTR_LATENCY_VALUE(x) (x & LTR_VALUE_MASK)
+#define LTR_MULTIPLIER_INDEX(x) ((UINT32)(x & LTR_SCALE_MASK) >> 10)
+
+
+typedef struct {
+ UINT64 BaseAddr;
+ UINT32 Offset;
+ UINT32 AndMask;
+ UINT32 OrMask;
+} BOOT_SCRIPT_REGISTER_SETTING;
+
+///
+/// SA PCI Registers to save for S3 resume
+///
+UINTN mSaChipsetPciRegistersTable[] = {
+ R_SA_DEVEN,
+ R_SA_REMAPBASE + 4,
+ R_SA_REMAPBASE,
+ R_SA_REMAPLIMIT + 4,
+ R_SA_REMAPLIMIT
+};
+//
+// Address values for mSaChipsetPciRegistersSaveTable will be initialized at Runtime inside function
+// SaPcieInitPolicy(). The Address uses the Register Offset from table mSaChipsetPciRegistersTable
+//
+BOOT_SCRIPT_PCI_REGISTER_SAVE mSaChipsetPciRegistersSaveTable[] = {
+ 0, EfiBootScriptWidthUint32, 0, // R_SA_DEVEN
+ 0, EfiBootScriptWidthUint32, 0, // R_SA_REMAPBASE + 4
+ 0, EfiBootScriptWidthUint32, 0, // R_SA_REMAPBASE
+ 0, EfiBootScriptWidthUint32, 0, // R_SA_REMAPLIMIT + 4
+ 0, EfiBootScriptWidthUint32, 0, // R_SA_REMAPLIMIT
+};
+
+///
+/// SA IGFX PCI Registers to save for S3 resume
+///
+UINTN mSaIgfxPciRegistersTable[] = {
+ R_SA_IGD_SWSCI_OFFSET,
+ R_SA_IGD_ASLS_OFFSET,
+ R_SA_IGD_GTTMMADR + 4,
+ R_SA_IGD_GTTMMADR,
+ R_SA_IGD_GMADR + 4,
+ R_SA_IGD_GMADR,
+ R_SA_IGD_IOBAR,
+ R_SA_IGD_CMD
+};
+//
+// Address values for mSaIgfxPciRegistersSaveTable will be initialized at Runtime inside function
+// SaPcieInitPolicy(). The Address uses the Register Offset from table mSaIgfxPciRegistersTable
+//
+BOOT_SCRIPT_PCI_REGISTER_SAVE mSaIgfxPciRegistersSaveTable[] = {
+ 0, EfiBootScriptWidthUint32, 0, // R_SA_IGD_SWSCI_OFFSET
+ 0, EfiBootScriptWidthUint32, 0, // R_SA_IGD_ASLS_OFFSET
+ 0, EfiBootScriptWidthUint32, 0, // R_SA_IGD_GTTMMADR + 4
+ 0, EfiBootScriptWidthUint32, 0, // R_SA_IGD_GTTMMADR
+ 0, EfiBootScriptWidthUint32, 0, // R_SA_IGD_GMADR + 4
+ 0, EfiBootScriptWidthUint32, 0, // R_SA_IGD_GMADR
+ 0, EfiBootScriptWidthUint32, 0, // R_SA_IGD_IOBAR
+ 0, EfiBootScriptWidthUint32, 0, // R_SA_IGD_CMD
+};
+
+/*
+ 4th Gen Intel(R) Core Processor (Haswell) System Agent BIOS Spec 0.7.2
+
+ 13.1.1 SMRAM Locking
+ Lock down SMRAM Space by setting the B0.D0.F0 register offset 088h[4] = '1b'
+
+ 13.2 System Agent configuration Locking.
+ For reliable operation and security, it is strongly recommended that BIOS should lock critical system agent configuration.
+ When the lock bits are set to 1 then all related registers become read only to the CPU.
+
+ For reliable operation and security, it is strongly recommended that BIOS should set the following bits:
+ .Lock GGC from writes by setting the B0.D0.F0 register offset 050[0] = '1b'. (Duplicate of MRC)
+ .Lock DPR by setting the B0.D0.F0 register offset 05Ch[0] = '1b'.
+ .Lock ME memory range configuration by setting the B0.D0.F0 register offset 078h[10] = '1b'. (Duplicate of MRC)
+ .Lock remap base and limit by setting the B0.D0.F0 register offset 090h[0] = '1b' and B0.D0.F0 register offset 098h[0] = '1b' (Duplicate of MRC)
+ .Lock TOM by setting the B0.D0.F0 register offset 0A0h[0] = '1b'. (Duplicate of MRC)
+ .Lock TOUUD by setting the B0.D0.F0 register offset 0A8h[0] = '1b'. (Duplicate of MRC)
+ .Lock BDSM by setting the B0.D0.F0 register offset 0B0h[0] = '1b'. (Duplicate of MRC)
+ .Lock BGSM by setting the B0.D0.F0 register offset 0B4h[0] = '1b'. (Duplicate of MRC)
+ .Lock TSEG Memory Base by setting the B0.D0.F0 register offset 0B8h[0] = '1b'.
+ .Lock TOLUD by setting the B0.D0.F0 register offset 0BCh[0] = '1b'. (Duplicate of MRC)
+ .Lock Memory controller configuration by setting the MCHBAR Offset 50FCh [7:0] = '8Fh'. (Duplicate of MRC)
+ .Lock DDR power/thermal management settings by setting MCHBAR offset 5880h [5] = '1b'
+ .Lock primary channel arbiter weights by setting the MCHBAR Offset 7000h [31] = '1b',
+ MCHBAR Offset 77FCh [0] = '1b', MCHBAR Offset 7FFCh [0] = '1b' and MCHBAR Offset 6800h [31] = '1b'.
+ .Lock UMA GFX by setting the MCHBAR Offset 6020h [0] = '1b'.
+ .Lock PAVP settings by setting MCHBAR Offset 0x5500h [0] = '1b'.
+ .Lock VTDTRK by setting the MCHBAR Offset 63FCh [0] = '1b'.
+ .Read and write back MCHBAR Offset 6008h [31:0]
+ .Read and write back MCHBAR Offset 6030h [31:0]
+ .Read and write back MCHBAR Offset 6034h [31:0]
+ .Lock processor/chipset BAR registers by setting MSR 0x2E7h [0] = '1b' at the end of POST.
+*/
+//
+// BaseAddr values for mSaSecurityRegisters that uses PciExpressBaseAddress will be initialized at
+// Runtime inside function SaPcieInitPolicy().
+//
+BOOT_SCRIPT_REGISTER_SETTING mSaSecurityRegisters[] = {
+ 0, 0x088, 0xFFFFFFFF, BIT4,
+ 0, 0x050, 0xFFFFFFFF, BIT0,
+ 0, 0x05C, 0xFFFFFFFF, BIT0,
+ 0, 0x078, 0xFFFFFFFF, BIT10,
+ 0, 0x090, 0xFFFFFFFF, BIT0,
+ 0, 0x098, 0xFFFFFFFF, BIT0,
+ 0, 0x0A0, 0xFFFFFFFF, BIT0,
+ 0, 0x0A8, 0xFFFFFFFF, BIT0,
+ 0, 0x0B0, 0xFFFFFFFF, BIT0,
+ 0, 0x0B4, 0xFFFFFFFF, BIT0,
+ 0, 0x0B8, 0xFFFFFFFF, BIT0,
+ 0, 0x0BC, 0xFFFFFFFF, BIT0,
+ MCH_BASE_ADDRESS, 0x50FC, 0xFFFFFFFF, 0x8F,
+ MCH_BASE_ADDRESS, 0x5880, 0xFFFFFFFF, BIT5,
+ MCH_BASE_ADDRESS, 0x7000, 0xFFFFFFFF, BIT31,
+ MCH_BASE_ADDRESS, 0x77FC, 0xFFFFFFFF, BIT0,
+ MCH_BASE_ADDRESS, 0x7FFC, 0xFFFFFFFF, BIT0,
+ MCH_BASE_ADDRESS, 0x6800, 0xFFFFFFFF, BIT31,
+ MCH_BASE_ADDRESS, 0x6020, 0xFFFFFFFF, BIT0,
+ MCH_BASE_ADDRESS, 0x5500, 0xFFFFFFFF, BIT0,
+ MCH_BASE_ADDRESS, 0x63FC, 0xFFFFFFFF, BIT0,
+ MCH_BASE_ADDRESS, 0x6008, 0xFFFFFFFF, 0,
+ MCH_BASE_ADDRESS, 0x6030, 0xFFFFFFFF, 0,
+ MCH_BASE_ADDRESS, 0x6034, 0xFFFFFFFF, 0
+};
+
+#ifdef PEG_FLAG
+UINTN mDeviceCapMmBaseSave [MAX_SUPPORTED_ROOT_BRIDGE_NUMBER][MAX_SUPPORTED_DEVICE_NUMBER];
+UINT32 mDeviceExtCapLtrOffsetSave [MAX_SUPPORTED_ROOT_BRIDGE_NUMBER][MAX_SUPPORTED_DEVICE_NUMBER];
+UINT32 mDeviceExtCapVcOffsetSave [MAX_SUPPORTED_ROOT_BRIDGE_NUMBER][MAX_SUPPORTED_DEVICE_NUMBER];
+UINT32 mDeviceBusNumberSave [MAX_SUPPORTED_ROOT_BRIDGE_NUMBER][MAX_SUPPORTED_DEVICE_NUMBER];
+UINT8 mDeviceAspmSave [MAX_SUPPORTED_ROOT_BRIDGE_NUMBER][MAX_SUPPORTED_DEVICE_NUMBER];
+UINT16 mDeviceLtrObffSave [MAX_SUPPORTED_ROOT_BRIDGE_NUMBER][MAX_SUPPORTED_DEVICE_NUMBER];
+UINT16 mDeviceMaxSnoopLatencySave [MAX_SUPPORTED_ROOT_BRIDGE_NUMBER][MAX_SUPPORTED_DEVICE_NUMBER];
+UINT16 mDeviceMaxNoSnoopLatencySave [MAX_SUPPORTED_ROOT_BRIDGE_NUMBER][MAX_SUPPORTED_DEVICE_NUMBER];
+UINT8 mDeviceTcxVc0MappingSave [MAX_SUPPORTED_ROOT_BRIDGE_NUMBER][MAX_SUPPORTED_DEVICE_NUMBER];
+UINT8 mCommonClock [MAX_SUPPORTED_ROOT_BRIDGE_NUMBER] = {0, 0, 0};
+UINT16 mDeviceControlRegisterSave [MAX_SUPPORTED_ROOT_BRIDGE_NUMBER][MAX_SUPPORTED_DEVICE_NUMBER];
+UINT8 mNumberOfDeviceFound [MAX_SUPPORTED_ROOT_BRIDGE_NUMBER] = {0, 0, 0};
+#endif // PEG_FLAG
+
+UINT8 mPAMSave [MAX_PAM_REG_COUNT];
+UINTN mSaChipsetPciRegistersSave [sizeof (mSaChipsetPciRegistersSaveTable) / sizeof (BOOT_SCRIPT_PCI_REGISTER_SAVE)];
+UINTN mSaIgfxPciRegistersSave [sizeof (mSaIgfxPciRegistersSaveTable) / sizeof (BOOT_SCRIPT_PCI_REGISTER_SAVE)];
+UINT8 mSteppingId;
+UINT8 mBridgeId;
+UINT8 mBridgeSteppingId;
+
+///
+/// Store required policy setting in global variables.
+///
+UINT8 mDxePlatformSaPolicyRevision;
+SA_PCIE_ASPM_CONFIG mPegAspmPerPort[MAX_SUPPORTED_ROOT_BRIDGE_NUMBER];
+UINT8 mPegAspmL0sPerPort[MAX_SUPPORTED_ROOT_BRIDGE_NUMBER];
+BOOLEAN mCridEnable;
+BOOLEAN mDevice4Enable;
+PCIE_ASPM_DEV_INFO *mPcieAspmDevsOverride;
+PCIE_LTR_DEV_INFO *mPcieLtrDevsOverride;
+UINT16 mSnoopLatencyOvrValue;
+UINT16 mNonSnoopLatencyOvrValue;
+SA_PCIE_PWR_OPT mPegPwrOpt[SA_PEG_MAX_FUN];
+
+#ifdef EFI_DEBUG
+UINT8 mMaxBusNumberSupported;
+#endif
+EFI_STATUS mEnumStatus;
+
+#ifdef PEG_FLAG
+/**
+ Find the Offset to a given Capabilities ID
+ CAPID list:
+ 0x01 = PCI Power Management Interface
+ 0x04 = Slot Identification
+ 0x05 = MSI Capability
+ 0x10 = PCI Express Capability
+
+ @param[in] Bus - Pci Bus Number
+ @param[in] Device - Pci Device Number
+ @param[in] Function - Pci Function Number
+ @param[in] CapId - CAPID to search for
+
+ @retval 0 - CAPID not found
+ @retval Other - CAPID found, Offset of desired CAPID
+**/
+UINT32
+LibPcieFindCapId (
+ IN UINT8 Bus,
+ IN UINT8 Device,
+ IN UINT8 Function,
+ IN UINT8 CapId
+ )
+{
+ UINT8 CapHeader;
+
+#ifndef AMI_OVERRIDE_FOR_ULT_FASTBOOT
+ CPU_FAMILY CpuFamilyId;
+ CpuFamilyId = GetCpuFamily();
+ if (CpuFamilyId == EnumCpuHswUlt) return 0;
+#endif // AMI_OVERRIDE_FOR_ULT_FASTBOOT
+ ///
+ /// Always start at Offset 0x34
+ ///
+ CapHeader = MmPci8 (0, Bus, Device, Function, PCI_CAPP);
+ if (CapHeader == 0xFF) {
+ return 0;
+ }
+
+ while (CapHeader != 0) {
+ ///
+ /// Bottom 2 bits of the pointers are reserved per PCI Local Bus Spec 2.2
+ ///
+ CapHeader &= ~(BIT1 + BIT0);
+ ///
+ /// Search for desired CapID
+ ///
+ if (MmPci8 (0, Bus, Device, Function, CapHeader) == CapId) {
+ return CapHeader;
+ }
+
+ CapHeader = MmPci8 (0, Bus, Device, Function, CapHeader + 1);
+ }
+
+ return 0;
+}
+
+/**
+ Search and return the offset of desired Pci Express Capability ID
+ CAPID list:
+ 0x0001 = Advanced Error Rreporting Capability
+ 0x0002 = Virtual Channel Capability
+ 0x0003 = Device Serial Number Capability
+ 0x0004 = Power Budgeting Capability
+
+ @param[in] PegBaseAddress - DeviceMmBase which points to PCIe device register space.
+ @param[in] CapId - Extended CAPID to search for
+
+ @retval 0 - CAPID not found
+ @retval Other - CAPID found, Offset of desired CAPID
+**/
+UINT32
+LibPcieFindExtendedCapId (
+ IN UINT32 PegBaseAddress,
+ IN UINT16 CapId
+ )
+{
+ UINT16 CapHeaderOffset;
+ UINT16 CapHeaderId;
+#ifndef AMI_OVERRIDE_FOR_ULT_FASTBOOT
+ CPU_FAMILY CpuFamilyId;
+ CpuFamilyId = GetCpuFamily();
+ if (CpuFamilyId == EnumCpuHswUlt) return 0;
+#endif // AMI_OVERRIDE_FOR_ULT_FASTBOOT
+ ///
+ /// Start to search at Offset 0x100
+ /// Get Capability Header
+ ///
+ CapHeaderId = 0;
+ CapHeaderOffset = 0x100;
+
+ while (CapHeaderOffset != 0 && CapHeaderId != 0xFFFF) {
+ ///
+ /// Search for desired CapID
+ ///
+ CapHeaderId = MmioRead16 (PegBaseAddress + CapHeaderOffset);
+ if (CapHeaderId == CapId) {
+ return CapHeaderOffset;
+ }
+
+ CapHeaderOffset = (MmioRead16 (PegBaseAddress + CapHeaderOffset + 2) >> 4);
+ }
+
+ return 0;
+}
+
+/**
+ Enumerate all end point devices connected to root bridge ports and record their MMIO base address
+
+ @exception EFI_UNSUPPORTED PCIe capability structure not found
+ @retval EFI_SUCCESS All done successfully
+**/
+EFI_STATUS
+EnumerateAllPcieDevices (
+ VOID
+ )
+{
+ UINT32 CapOffset1;
+ UINT32 CapOffset2;
+ UINTN RootPortMmBase;
+ UINT8 SubBusNum;
+ UINT8 BusNum;
+ UINT8 PegBus;
+ UINT8 PegDev;
+ UINT8 PegFunc;
+ UINT8 Bus;
+ UINT8 Dev;
+ UINT8 Func;
+ UINT8 RootBridgeCompleted;
+ UINT8 RootBridgeDeviceNumber [MAX_SUPPORTED_ROOT_BRIDGE_NUMBER] = {1, 1, 1};
+ UINT8 RootBridgeFunctionNumber [MAX_SUPPORTED_ROOT_BRIDGE_NUMBER] = {0, 1, 2};
+
+#ifdef EFI_DEBUG
+ mMaxBusNumberSupported = 0xFF >> ((MmPci32 (0, SA_MC_BUS, SA_MC_DEV, SA_MC_FUN, R_SA_PCIEXBAR) & B_SA_PCIEXBAR_LENGTH_MASK) >> N_SA_PCIEXBAR_LENGTH_OFFSET);
+#endif
+ PegBus = 0;
+ for (RootBridgeCompleted = 0; RootBridgeCompleted < MAX_SUPPORTED_ROOT_BRIDGE_NUMBER; RootBridgeCompleted++) {
+ PegDev = RootBridgeDeviceNumber [RootBridgeCompleted];
+ PegFunc = RootBridgeFunctionNumber [RootBridgeCompleted];
+ if (MmPci16 (0, PegBus, PegDev, PegFunc, PCI_VID) == 0xFFFF) {
+ continue;
+ }
+ ///
+ /// Save Bridge Bus number assignment
+ ///
+ mDeviceBusNumberSave [RootBridgeCompleted][0] = MmPci32 (0, PegBus, PegDev, PegFunc, PCI_PBUS);
+ SaScriptMemWrite (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) MmPciAddress (0, PegBus, PegDev, PegFunc, PCI_PBUS),
+ 1,
+ &mDeviceBusNumberSave [RootBridgeCompleted][0]
+ );
+
+ ///
+ /// Get the pointer to the Port PCI Express Capability Structure.
+ ///
+ CapOffset1 = LibPcieFindCapId (PegBus, PegDev, PegFunc, 0x10);
+ if (CapOffset1 == 0) {
+ DEBUG ((EFI_D_ERROR, "ERROR: Cannot find Root Bridge PCIE capability structure.\n"));
+ return EFI_UNSUPPORTED;
+ }
+
+ ///
+ /// Save root bridge device MM base
+ ///
+ RootPortMmBase = MmPciAddress (0, PegBus, PegDev, PegFunc, 0);
+ mDeviceCapMmBaseSave [RootBridgeCompleted][0] = RootPortMmBase + CapOffset1;
+ DEBUG ((EFI_D_INFO, "Root bridge [B%X|D%X|F%X]:", PegBus, PegDev, PegFunc));
+ DEBUG ((EFI_D_INFO, " mDeviceCapMmBaseSave [%d][0] = 0x%X\n", RootBridgeCompleted, mDeviceCapMmBaseSave [RootBridgeCompleted][0]));
+ mNumberOfDeviceFound [RootBridgeCompleted] ++;
+
+ ///
+ /// Get Secondary bus number and Subordinate bus number for end point device enumeration
+ ///
+ BusNum = MmPci8 (0, PegBus, PegDev, PegFunc, PCI_SBUS);
+ SubBusNum = MmPci8 (0, PegBus, PegDev, PegFunc, PCI_SUBUS);
+ for (Bus = SubBusNum; Bus >= BusNum; Bus--) {
+ for (Dev = 0; Dev < 32; Dev++) {
+ for (Func =0; Func <=7; Func++) {
+ ///
+ /// Read Vendor ID to check if device exists
+ /// if no device exists, then check next device
+ ///
+ if (MmPci16 (0, Bus, Dev, 0, PCI_VID) == 0xFFFF) {
+ ///
+ /// No other functions present if Func0 is not preset
+ ///
+ break;
+ }
+ if (MmPci16 (0, Bus, Dev, Func, PCI_VID) == 0xFFFF) {
+ continue;
+ }
+
+ DEBUG ((EFI_D_INFO, "End point [B%X|D%X|F%X]:", Bus, Dev, Func));
+ CapOffset2 = LibPcieFindCapId (Bus, Dev, Func, 0x10);
+ if (CapOffset2 != 0) {
+ ///
+ /// Save end point device MM base
+ ///
+ if (mNumberOfDeviceFound [RootBridgeCompleted] >= MAX_SUPPORTED_DEVICE_NUMBER) {
+ DEBUG ((EFI_D_ERROR, "ERROR: DeviceMmBaseSave array size not big enough.\n"));
+ return EFI_BUFFER_TOO_SMALL;
+ } else {
+ ///
+ /// Save Downstream Bus number assignment
+ ///
+ mDeviceBusNumberSave [RootBridgeCompleted][mNumberOfDeviceFound [RootBridgeCompleted]] = MmPci32 (0, Bus, Dev, Func, PCI_PBUS);
+ SaScriptMemWrite (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) MmPciAddress (0, Bus, Dev, Func, PCI_PBUS),
+ 1,
+ &mDeviceBusNumberSave [RootBridgeCompleted][mNumberOfDeviceFound [RootBridgeCompleted]]
+ );
+ mDeviceCapMmBaseSave [RootBridgeCompleted][mNumberOfDeviceFound [RootBridgeCompleted]] = MmPciAddress (0, Bus, Dev, Func, 0) + CapOffset2;
+ DEBUG ((EFI_D_INFO, " mDeviceCapMmBaseSave [%d][%d]", RootBridgeCompleted, mNumberOfDeviceFound [RootBridgeCompleted]));
+ DEBUG ((EFI_D_INFO, " = 0x%X\n", mDeviceCapMmBaseSave [RootBridgeCompleted][mNumberOfDeviceFound [RootBridgeCompleted]]));
+ mNumberOfDeviceFound [RootBridgeCompleted] ++;
+ }
+ }
+ }
+ }
+ }
+ DEBUG ((EFI_D_INFO, "mNumberOfDeviceFound [%d] = %d\n", RootBridgeCompleted, mNumberOfDeviceFound [RootBridgeCompleted]));
+ }
+ return EFI_SUCCESS;
+}
+
+/**
+ Initialize VC0 traffic class
+
+ @param[in] RootBridgeCompleted - The first index (point to root bridge) of the device MMIO Base array to select bridge which currently under working or completed.
+ @param[in] EndpointCompleted - The second index (point to end point devices) of the device MMIO Base array to select device which currently under working or completed.
+
+ @exception EFI_UNSUPPORTED - VC capability ID not found
+ @retval EFI_SUCCESS - VC mapping correctly initialized
+**/
+EFI_STATUS
+PcieInitTcxVc0 (
+ IN UINT8 RootBridgeCompleted,
+ IN UINT8 EndpointCompleted
+ )
+{
+ UINT32 Offset;
+ UINT8 Data8And;
+ UINT8 Data8Or;
+ UINT32 PegBaseAddress;
+ UINT8 i;
+ UINT8 CapId[] = {'2','8'};
+
+ Offset = 0;
+ i = 0;
+ PegBaseAddress = (UINT32) (mDeviceCapMmBaseSave [RootBridgeCompleted][EndpointCompleted] & (UINTN) ~0xFF);
+ ///
+ /// Set TCx-VC0 value - map all TCs to VC0
+ ///
+ ///
+ /// Fix for ClientSW s5039821: PTC Gen3 BIOS Test : MFVC Capability test failure
+ ///
+ while ((Offset == 0x0) && (i < sizeof(CapId))) {
+ mDeviceExtCapVcOffsetSave [RootBridgeCompleted][EndpointCompleted] |= LibPcieFindExtendedCapId (PegBaseAddress, CapId[i]);
+ Offset = mDeviceExtCapVcOffsetSave [RootBridgeCompleted][EndpointCompleted];
+ i++;
+ }
+
+ DEBUG ((EFI_D_INFO, "PTC SaPcieLib.c - Offset: 0x%x\n", Offset));
+ if (Offset == 0) {
+ DEBUG ((EFI_D_INFO, "VC ExtCap structure not found on device [0x%08X]\n", PegBaseAddress));
+ return EFI_UNSUPPORTED;
+ }
+
+ Data8And = 0;
+ Data8Or = BIT0 + BIT1 + BIT2 + BIT3 + BIT4 + BIT5 + BIT6 + BIT7;
+ MmioAndThenOr8 (PegBaseAddress + Offset + 0x014, Data8And, Data8Or);
+ SaScriptMemReadWrite (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (PegBaseAddress + Offset + 0x014),
+ &Data8Or,
+ &Data8And
+ );
+ mDeviceTcxVc0MappingSave [RootBridgeCompleted][EndpointCompleted] = MmioRead8 (PegBaseAddress + Offset + 0x014);
+ return EFI_SUCCESS;
+}
+
+/**
+ Sets Common Clock, TCx-VC0 mapping, and Max Payload for PCIe
+**/
+VOID
+SaPcieConfigBeforeOpRom (
+ VOID
+ )
+{
+ UINT8 RootBridgeCompleted;
+ UINT8 EndpointCompleted;
+ UINT16 EndpointMaxPayload;
+ UINTN RootPortPcieCapMmBase;
+ UINTN EndPointPcieCapMmBase;
+ UINT16 Data16And;
+ UINT16 Data16Or;
+ UINT16 MaxPayload [MAX_SUPPORTED_ROOT_BRIDGE_NUMBER];
+
+ for (RootBridgeCompleted = 0; RootBridgeCompleted < MAX_SUPPORTED_ROOT_BRIDGE_NUMBER; RootBridgeCompleted++) {
+ RootPortPcieCapMmBase = mDeviceCapMmBaseSave [RootBridgeCompleted][0];
+ EndPointPcieCapMmBase = mDeviceCapMmBaseSave [RootBridgeCompleted][1];
+
+ if (RootPortPcieCapMmBase == 0) {
+ continue;
+ }
+ ///
+ /// Get the PCIE root Port Max Payload Size support.
+ ///
+ MaxPayload [RootBridgeCompleted] = MmioRead16 (RootPortPcieCapMmBase + 4) & (BIT2 | BIT1 | BIT0);
+ ///
+ /// Check the Port Slot Clock Configuration Bit.
+ ///
+ if ((MmioRead16 (RootPortPcieCapMmBase + 0x012) & BIT12) == 0) {
+ ///
+ /// Indicate CommonClock is not supported on this port
+ ///
+ mCommonClock [RootBridgeCompleted] = 0xFF;
+ DEBUG ((EFI_D_INFO, "CommonClock not supported by root bridge [B%X|D%X|F%X|R%X]\n",
+ (RootPortPcieCapMmBase >> 20) & mMaxBusNumberSupported,
+ (RootPortPcieCapMmBase >> 15) & 0x1F,
+ (RootPortPcieCapMmBase >> 12) & 0x07,
+ (RootPortPcieCapMmBase + 0x012) & 0xFFF));
+ }
+ for (EndpointCompleted = 1; EndpointCompleted < mNumberOfDeviceFound [RootBridgeCompleted]; EndpointCompleted++) {
+ ///
+ /// Set TCx-VC0 mapping on Endpoint
+ ///
+ PcieInitTcxVc0 (RootBridgeCompleted, EndpointCompleted);
+
+ EndPointPcieCapMmBase = mDeviceCapMmBaseSave [RootBridgeCompleted][EndpointCompleted];
+ ///
+ /// Get the end point function Max Payload Size support
+ ///
+ EndpointMaxPayload = MmioRead16 (EndPointPcieCapMmBase + 4) & (BIT2 | BIT1 | BIT0);
+ DEBUG ((EFI_D_INFO, "CAP_MPS of [%X] = %X\n", EndPointPcieCapMmBase + 4, EndpointMaxPayload));
+ ///
+ /// Obtain the minimum Max Payload Size between the PCIE root Port and the end point functions
+ ///
+ if (MaxPayload [RootBridgeCompleted] > EndpointMaxPayload) {
+ MaxPayload [RootBridgeCompleted] = EndpointMaxPayload;
+ }
+ ///
+ /// Check the Endpoint Slot Clock Configuration Bit.
+ ///
+ if ((MmioRead16 (EndPointPcieCapMmBase + 0x012) & BIT12) != 0) {
+ ///
+ /// Common clock is supported, set common clock bit on root port
+ /// and the endpoint
+ ///
+ if (mCommonClock [RootBridgeCompleted] == 0) {
+ MmioOr8 (RootPortPcieCapMmBase + 0x010, BIT6);
+ Data16Or = BIT6;
+ Data16And = (UINT16)~BIT6;
+ SaScriptMemReadWrite (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (RootPortPcieCapMmBase + 0x010),
+ &Data16Or, ///< Data to be ORed
+ &Data16And ///< Data to be ANDed
+ );
+ mCommonClock [RootBridgeCompleted] = 1;
+ DEBUG ((EFI_D_INFO, "Set CommonClock on Root [B%X|D%X|F%X|R%X]\n",
+ (RootPortPcieCapMmBase >> 20) & mMaxBusNumberSupported,
+ (RootPortPcieCapMmBase >> 15) & 0x1F,
+ (RootPortPcieCapMmBase >> 12) & 0x07,
+ (RootPortPcieCapMmBase + 0x010) & 0xFFF));
+ }
+ MmioOr8 (EndPointPcieCapMmBase + 0x010, BIT6);
+ Data16Or = BIT6;
+ Data16And = (UINT16)~BIT6;
+ SaScriptMemReadWrite (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (EndPointPcieCapMmBase + 0x010),
+ &Data16Or, ///< Data to be ORed
+ &Data16And ///< Data to be ANDed
+ );
+ DEBUG ((EFI_D_INFO, "Set CommonClock on Device [B%X|D%X|F%X|R%X]\n",
+ (EndPointPcieCapMmBase >> 20) & mMaxBusNumberSupported,
+ (EndPointPcieCapMmBase >> 15) & 0x1F,
+ (EndPointPcieCapMmBase >> 12) & 0x07,
+ (EndPointPcieCapMmBase + 0x010) & 0xFFF));
+ }
+ }
+ ///
+ /// If common clock supported on root port and endpoint, retrain link
+ ///
+ if (mCommonClock [RootBridgeCompleted] == 1) {
+ DEBUG ((EFI_D_INFO, "CommonClock supported. Retrain link\n"));
+ ///
+ /// Retrain the Link per PCI Express Specification.
+ ///
+ MmioOr8 (RootPortPcieCapMmBase + 0x010, BIT5);
+ Data16Or = BIT5;
+ Data16And = (UINT8) ~BIT5;
+ SaScriptMemReadWrite (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (RootPortPcieCapMmBase + 0x010),
+ &Data16Or,
+ &Data16And
+ );
+ ///
+ /// Wait until Re-Training has completed.
+ ///
+ while ((MmioRead16 (RootPortPcieCapMmBase + 0x012) & BIT11) != 0) {}
+ ///
+ /// Poll until BIT11 clear. 200 ms as polling timeout
+ ///
+ Data16Or = BIT11;
+ Data16And = 0;
+ SaScriptMemPoll (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (RootPortPcieCapMmBase + 0x012),
+ &Data16Or,
+ &Data16And,
+ 1,
+ 200000
+ );
+ }
+
+ ///
+ /// Set Max Payload to all root and end point devices
+ ///
+ MaxPayload [RootBridgeCompleted] <<= 5;
+ EndpointCompleted = 0;
+ while (EndpointCompleted < mNumberOfDeviceFound [RootBridgeCompleted]) {
+ EndPointPcieCapMmBase = mDeviceCapMmBaseSave [RootBridgeCompleted][EndpointCompleted];
+ DEBUG ((EFI_D_INFO, "Set MPS of [%X] to %X\n", EndPointPcieCapMmBase + 0x8, MaxPayload [RootBridgeCompleted]));
+ MmioAndThenOr16 (EndPointPcieCapMmBase + 0x8, (UINT16)~(BIT7 | BIT6 | BIT5), MaxPayload [RootBridgeCompleted]);
+ ///
+ /// S3 Save for Device Control Register on all bridges and devices is done after the OpRom has run in EnableExtendedTag.
+ ///
+ EndpointCompleted ++;
+ }
+ }
+}
+
+/**
+ Calculate ASPM Auto setting value
+
+ @param[in] RootBridgeIndex - Root Bridge Index to select mDeviceCapMmBaseSave array elements for ASPM capability calculation.
+
+ @retval AspmVal - ASPM settings for RP and all EP
+**/
+UINT16
+PcieCalcAspmSettings (
+ IN UINT8 RootBridgeIndex
+ )
+{
+ UINT16 RootPortAspm;
+ UINT16 EndPointAspm;
+ UINT32 PcieAspmDev;
+ UINT16 EndPointVendorId;
+ UINT16 EndPointDeviceId;
+ UINT8 EndPointRevId;
+ UINT16 AspmVal;
+ UINT32 PortLxLat;
+ UINT32 EndPointLxLat;
+ UINT32 LxLat;
+ UINT8 EndpointCompleted;
+ UINTN RootPortPcieCapMmBase;
+ UINT32 RootPortLinkCap;
+ UINTN EndPointPcieCapMmBase;
+ UINT32 EndPointLinkCap;
+ UINT32 EndPointDevCap;
+
+ RootPortPcieCapMmBase = mDeviceCapMmBaseSave [RootBridgeIndex][0];
+ RootPortLinkCap = MmioRead32 (RootPortPcieCapMmBase + 0x0C);
+
+ ///
+ /// Obtain initial ASPM settings from respective port capability registers.
+ ///
+ RootPortAspm = (RootPortLinkCap >> 10) & 3;
+ DEBUG ((EFI_D_INFO, "Root [%X] Aspm capability = %X\n", RootPortPcieCapMmBase + 0xC, RootPortAspm));
+ AspmVal = RootPortAspm;
+ EndpointCompleted = 1;
+
+ while (EndpointCompleted < mNumberOfDeviceFound [RootBridgeIndex]) {
+ EndPointPcieCapMmBase = mDeviceCapMmBaseSave [RootBridgeIndex][EndpointCompleted];
+ EndPointDevCap = MmioRead32 (EndPointPcieCapMmBase + 0x04);
+ EndPointLinkCap = MmioRead32 (EndPointPcieCapMmBase + 0x0C);
+
+ EndPointAspm = (EndPointLinkCap >> 10) & 3;
+ DEBUG ((EFI_D_INFO, "End point [%X] Aspm capability = %X\n", EndPointPcieCapMmBase + 0xC, EndPointAspm));
+ if (mPcieAspmDevsOverride != NULL) {
+ ///
+ /// Mask APMC with values from lookup table.
+ /// RevID of 0xFF applies to all steppings.
+ ///
+ EndPointVendorId = MmioRead16 ((EndPointPcieCapMmBase & (UINTN) ~0xFF) + 0x000);
+ EndPointDeviceId = MmioRead16 ((EndPointPcieCapMmBase & (UINTN) ~0xFF) + 0x002);
+ EndPointRevId = MmioRead8 ((EndPointPcieCapMmBase & (UINTN) ~0xFF) + 0x008);
+ DEBUG ((EFI_D_INFO, "End point [%X] VendorID:DeviceID = %04X:%04X RevID=%02X\n",
+ EndPointPcieCapMmBase, EndPointVendorId, EndPointDeviceId, EndPointRevId));
+ PcieAspmDev = 0;
+ while ((mPcieAspmDevsOverride[PcieAspmDev].VendorId != SA_PCIE_DEV_END_OF_TABLE)
+ && (PcieAspmDev < MAX_PCIE_ASPM_OVERRIDE)) {
+ if ((mPcieAspmDevsOverride[PcieAspmDev].VendorId == EndPointVendorId) &&
+ (mPcieAspmDevsOverride[PcieAspmDev].DeviceId == EndPointDeviceId) &&
+ ((mPcieAspmDevsOverride[PcieAspmDev].RevId == 0xFF) ||
+ (mPcieAspmDevsOverride[PcieAspmDev].RevId == EndPointRevId))) {
+ RootPortAspm &= mPcieAspmDevsOverride[PcieAspmDev].RootApmcMask;
+ EndPointAspm &= mPcieAspmDevsOverride[PcieAspmDev].EndpointApmcMask;
+ break;
+ }
+ PcieAspmDev++;
+ }
+ }
+
+ if (AspmVal > EndPointAspm) {
+ AspmVal = EndPointAspm;
+ ///
+ /// In case L0s and L1 both can't be enabled, return the result now.
+ ///
+ if((AspmVal & 0x03) == 0) {
+ return AspmVal;
+ }
+ }
+ ///
+ /// Check if L1 should be enabled based on port and endpoint L1 exit latency.
+ ///
+ if (AspmVal & BIT1) {
+ if (!(EndPointLinkCap & BIT22) && !(AspmVal & BIT0)) {
+ DEBUG ((EFI_D_INFO, "\nDevice [%X] ASPM Optionality Compliance bit not set!", EndPointPcieCapMmBase));
+ DEBUG ((EFI_D_INFO, "ASPM L1-Only setting is not supported!\n"));
+ AspmVal = 0;
+ return AspmVal;
+ }
+ PortLxLat = RootPortLinkCap & (BIT17 + BIT16 + BIT15);
+ EndPointLxLat = EndPointLinkCap & (BIT17 + BIT16 + BIT15);
+ DEBUG ((EFI_D_INFO, "Root [%X] L1 Exit Latency = %X\n", RootPortPcieCapMmBase + 0xC, PortLxLat >> 15));
+ DEBUG ((EFI_D_INFO, "End [%X] L1 Exit Latency = %X\n", EndPointPcieCapMmBase + 0xC, EndPointLxLat >> 15));
+ LxLat = PortLxLat;
+ if (PortLxLat < EndPointLxLat) {
+ LxLat = EndPointLxLat;
+ }
+ ///
+ /// check if the value is bigger than endpoint L1 acceptable exit latency, if it is
+ /// larger than accepted value, then we should disable L1
+ ///
+ LxLat >>= 6;
+ DEBUG ((EFI_D_INFO, "End [%X] L1 Acceptable Latency = %X\n", EndPointPcieCapMmBase + 0x4,
+ (EndPointDevCap & (BIT11 + BIT10 + BIT9)) >> 9));
+ if (LxLat > (EndPointDevCap & (BIT11 + BIT10 + BIT9))) {
+ AspmVal &= ~BIT1;
+ if((AspmVal & 0x03) == 0) {
+ return AspmVal;
+ }
+ }
+ }
+ ///
+ /// Check if L0s should be enabled based on port and endpoint L0s exit latency.
+ ///
+ if (AspmVal & BIT0) {
+ PortLxLat = RootPortLinkCap & (BIT14 + BIT13 + BIT12);
+ EndPointLxLat = EndPointLinkCap & (BIT14 + BIT13 + BIT12);
+ DEBUG ((EFI_D_INFO, "Root [%X] L0s Exit Latency = %X\n", RootPortPcieCapMmBase + 0xC, PortLxLat >> 12));
+ DEBUG ((EFI_D_INFO, "End [%X] L0s Exit Latency = %X\n", EndPointPcieCapMmBase + 0xC, EndPointLxLat >> 12));
+ LxLat = PortLxLat;
+ if (PortLxLat < EndPointLxLat) {
+ LxLat = EndPointLxLat;
+ }
+ ///
+ /// check if the value is bigger than endpoint L0s acceptable exit latency, if it is
+ /// larger than accepted value, then we should disable L0s
+ ///
+ LxLat >>= 6;
+ DEBUG ((EFI_D_INFO, "End [%X] L0s Acceptable Latency = %X\n", EndPointPcieCapMmBase + 0x4,
+ (EndPointDevCap & (BIT8 + BIT7 + BIT6)) >> 6));
+ if (LxLat > (EndPointDevCap & (BIT8 + BIT7 + BIT6))) {
+ AspmVal &= ~BIT0;
+ if((AspmVal & 0x03) ==0) {
+ return AspmVal;
+ }
+ }
+ }
+ EndpointCompleted ++;
+ }
+ return AspmVal;
+}
+
+/**
+ This function compares the actual latency in LatencyValue1
+ with actual latency in LatencyValue2 programs the minimum
+ back to LatencyValue1, in the required format.
+
+ @param[in] LatencyValue1 - Current latency value
+ @param[in] LatencyValue2 - Latency value from the Table
+**/
+VOID
+DetermineLatencyValue (
+ IN UINT16 *LatencyValue1,
+ IN UINT16 *LatencyValue2
+ )
+{
+ UINT8 Scale1;
+ UINT8 Scale2;
+ UINT64 ActualLatency1 = 0;
+ UINT64 ActualLatency2 = 0;
+ UINT32 Multiplier[6] = {
+ 1,
+ 32,
+ 1024,
+ 32768,
+ 1048576,
+ 33554432
+ };
+
+ Scale1 = LTR_MULTIPLIER_INDEX(*LatencyValue1);
+ Scale2 = LTR_MULTIPLIER_INDEX(*LatencyValue2);
+ if ((Scale1 <= 5) && (Scale2 <= 5)) {
+ ActualLatency1 = LTR_LATENCY_VALUE(*LatencyValue1) * Multiplier[Scale1];
+ ActualLatency2 = LTR_LATENCY_VALUE(*LatencyValue2) * Multiplier[Scale2];
+ }
+
+ ///
+ /// Store the lower latency value and corresponding scale bits back to LatencyValue1
+ /// and set the Force bit
+ ///
+ if ((ActualLatency1 == 0) || ActualLatency1 > ActualLatency2) {
+ *LatencyValue1 = *LatencyValue2;
+ }
+}
+
+/**
+ This function will scan the LTR override table and update the default values for snoop and non-snoop latencies.
+
+ @param[in] PegBaseAddress - DeviceMmBase which points to PCIe device register space.
+**/
+VOID
+ScanLtrOverrideTable (
+ IN UINT32 PegBaseAddress
+ )
+{
+ UINT8 EndPointRevId;
+ UINT16 EndPointVendorId;
+ UINT16 EndPointDeviceId;
+ UINT32 PcieLtrDev;
+
+ EndPointVendorId = MmioRead16 (PegBaseAddress + 0x000);
+ EndPointDeviceId = MmioRead16 (PegBaseAddress + 0x002);
+ EndPointRevId = MmioRead8 (PegBaseAddress + 0x008);
+ if (mPcieLtrDevsOverride != NULL) {
+ PcieLtrDev = 0;
+ while ((mPcieLtrDevsOverride[PcieLtrDev].VendorId != SA_PCIE_DEV_END_OF_TABLE)
+ && (PcieLtrDev < MAX_PCIE_LTR_OVERRIDE)) {
+ if ((mPcieLtrDevsOverride[PcieLtrDev].VendorId == EndPointVendorId) &&
+ (mPcieLtrDevsOverride[PcieLtrDev].DeviceId == EndPointDeviceId) &&
+ ((mPcieLtrDevsOverride[PcieLtrDev].RevId == 0xFF) ||
+ (mPcieLtrDevsOverride[PcieLtrDev].RevId == EndPointRevId))
+ ) {
+ if (mPcieLtrDevsOverride[PcieLtrDev].SnoopLatency & BIT15) {
+ DetermineLatencyValue(&mSnoopLatencyOvrValue, &mPcieLtrDevsOverride[PcieLtrDev].SnoopLatency);
+ }
+ if (mPcieLtrDevsOverride[PcieLtrDev].NonSnoopLatency & BIT15) {
+ DetermineLatencyValue(&mNonSnoopLatencyOvrValue, &mPcieLtrDevsOverride[PcieLtrDev].NonSnoopLatency);
+ }
+ break;
+ }
+ PcieLtrDev++;
+ }
+ }
+}
+
+/**
+ Configure LTR/OBFF on end point device
+
+ @param[in] RootBridgeIndex - Root Bridge index number to select mDeviceCapMmBaseSave array element for end point device MmBase.
+ @param[in] EndpointCompleted - End point device index number to select mDeviceCapMmBaseSave array element for end point device MmBase.
+**/
+VOID
+PcieSetEndpointLtrObff (
+ IN UINT8 RootBridgeIndex,
+ IN UINT8 EndpointCompleted
+ )
+{
+
+ UINT16 Data16Or;
+ UINT16 Data16And;
+ UINT32 DeviceCapabilities2;
+ UINT32 PegBaseAddress;
+ UINTN EndpointCapMmBase;
+ UINT32 ExtendedCapOffset;
+ UINT16 DefaultMaxLatency;
+ UINT8 PegFunc;
+
+ PegFunc = (UINT8) ((mDeviceCapMmBaseSave [RootBridgeIndex][0] >> 12) & 0x07);
+ if (PegFunc >= SA_PEG_MAX_FUN) {
+ DEBUG ((EFI_D_ERROR, "PegFunc out of bound! Exit from PcieSetEndpointLtrObff()!\n"));
+ ASSERT (PegFunc < SA_PEG_MAX_FUN);
+ return;
+ }
+
+ EndpointCapMmBase = mDeviceCapMmBaseSave [RootBridgeIndex][EndpointCompleted];
+ ///
+ /// Scan the LTR override table
+ ///
+ PegBaseAddress = (UINT32) (EndpointCapMmBase & (UINTN) ~0xFF);
+ ScanLtrOverrideTable (PegBaseAddress);
+ DeviceCapabilities2 = MmioRead32 (EndpointCapMmBase + 0x24);
+ Data16And = (UINT16)~(BIT10 + BIT13 + BIT14);
+ Data16Or = 0;
+ ///
+ /// If mSnoopLatencyOvrValue and mNonSnoopLatencyOvrValue has a value of 0, then this endpoint is not
+ /// part of the override table If it supports LTR messaging then enable the capability
+ ///
+ if ((mSnoopLatencyOvrValue == 0) &&
+ (mNonSnoopLatencyOvrValue == 0)) {
+ if (DeviceCapabilities2 & BIT11) {
+ // If PegPortLtrEnable set to true
+ //
+ if (mPegPwrOpt[PegFunc].LtrEnable == 1) {
+ Data16Or |= BIT10;
+ }
+ }
+ }
+ ///
+ /// Check if endpoint device is capable of OBFF using WAKE# signaling
+ ///
+ if ((DeviceCapabilities2 & BIT19) != 0) {
+ if (mPegPwrOpt[PegFunc].ObffEnable == 1) {
+ Data16Or |= BIT14 | BIT13; ///< 11b - Enable OBFF using WAKE# signaling
+ }
+ }
+ DEBUG ((EFI_D_INFO, "Configure LTR/OBFF setting to EndPoint: [0x%x] to value 0x%x\n",
+ EndpointCapMmBase + 0x28, Data16Or));
+ MmioAndThenOr16 (EndpointCapMmBase + 0x28, Data16And, Data16Or);
+ SaScriptMemReadWrite (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (EndpointCapMmBase + 0x28),
+ &Data16Or,
+ &Data16And
+ );
+ mDeviceLtrObffSave [RootBridgeIndex][EndpointCompleted] = MmioRead16 (EndpointCapMmBase + 0x28);
+ ///
+ ///
+ /// Program LTR Max Latencies
+ ///
+ if (DeviceCapabilities2 & BIT11) {
+ if (mPegPwrOpt[PegFunc].LtrEnable == 1) {
+ ///
+ /// Get the pointer to the Endpoint PCI Express Extended Capability Structure.
+ ///
+ mDeviceExtCapLtrOffsetSave [RootBridgeIndex][EndpointCompleted] = LibPcieFindExtendedCapId (PegBaseAddress, 0x18);
+ ExtendedCapOffset = mDeviceExtCapLtrOffsetSave [RootBridgeIndex][EndpointCompleted];
+ Data16And = (UINT16) (~0x1FFF);
+ Data16Or = mSnoopLatencyOvrValue;
+ DefaultMaxLatency = mPegPwrOpt[PegFunc].LtrMaxSnoopLatency;
+ if (ExtendedCapOffset != 0) {
+ DetermineLatencyValue(&Data16Or, &DefaultMaxLatency);
+ MmioAndThenOr16 (PegBaseAddress + ExtendedCapOffset + 4, Data16And, Data16Or);
+ SaScriptMemReadWrite (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PegBaseAddress + ExtendedCapOffset + 4),
+ &Data16Or, ///< Data to be ORed
+ &Data16And ///< Data to be ANDed
+ );
+ mDeviceMaxSnoopLatencySave [RootBridgeIndex][EndpointCompleted] = MmioRead16 (PegBaseAddress + ExtendedCapOffset + 0x4);
+ Data16Or = mNonSnoopLatencyOvrValue;
+ DefaultMaxLatency = mPegPwrOpt[PegFunc].LtrMaxNoSnoopLatency;
+ DetermineLatencyValue(&Data16Or, &DefaultMaxLatency);
+ MmioAndThenOr16 (PegBaseAddress + ExtendedCapOffset + 6, Data16And, Data16Or);
+ SaScriptMemReadWrite (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PegBaseAddress + ExtendedCapOffset + 6),
+ &Data16Or, ///< Data to be ORed
+ &Data16And ///< Data to be ANDed
+ );
+ mDeviceMaxNoSnoopLatencySave [RootBridgeIndex][EndpointCompleted] = MmioRead16 (PegBaseAddress + ExtendedCapOffset + 0x6);
+ } else {
+ DEBUG ((EFI_D_INFO, "LTR ExtCap structure not found on device [0x%08X]\n", PegBaseAddress));
+ }
+ }
+ }
+}
+
+/**
+ This function programs the LTR Override values
+**/
+VOID
+PcieILtrOverride (
+ VOID
+ )
+{
+ UINT64 MchBar;
+ UINT32 Data32And;
+ UINT32 Data32Or;
+
+ MchBar = McD0PciCfg64 (R_SA_MCHBAR) &~BIT0;
+ Data32And = 0x0;
+
+ ///
+ /// Configure Snoop Latency value
+ ///
+ if (mSnoopLatencyOvrValue != 0) {
+ mSnoopLatencyOvrValue |= BIT14;
+ }
+ Data32Or = ((UINT32) (mSnoopLatencyOvrValue << 16));
+
+
+ ///
+ /// Configure Non-Snoop Latency value
+ ///
+ if (mNonSnoopLatencyOvrValue != 0) {
+ mNonSnoopLatencyOvrValue |= BIT14;
+ }
+ Data32Or |= mNonSnoopLatencyOvrValue;
+
+ ///
+ /// Program ILTR_OVRD with latency values
+ ///
+ Mmio32AndThenOr (MchBar, R_SA_MCHBAR_ILTR_OVRD_OFFSET, Data32And, Data32Or);
+ SaScriptMemReadWrite (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (MchBar + R_SA_MCHBAR_ILTR_OVRD_OFFSET),
+ &Data32Or, /// Data to be ORed
+ &Data32And /// Data to be ANDed
+ );
+}
+
+/**
+ This function enumerate devices to apply Peg Aspm settings.
+
+ @param[in] RootBridgeIndex - Root Bridge Index to select mDeviceCapMmBaseSave array elements for ASPM capability calculation.
+ @param[in] AutoFlag - ASPM AUTO calculation mode
+ @param[in] RootPortAspm - ASPM setting for Root port
+ @param[in] EndPointAspm - ASPM setting for End point
+**/
+VOID
+PcieEnumerateDeviceToApplyASPM (
+ IN UINT8 RootBridgeIndex,
+ IN BOOLEAN AutoFlag,
+ IN UINT16 RootPortAspm,
+ IN UINT16 EndPointAspm
+ )
+{
+ UINT16 LinkAspmCap;
+ UINT16 LinkAspmVal;
+ UINT8 EndpointCompleted;
+ UINT32 PegBaseAddress;
+ UINT16 Data16Or;
+ UINT16 Data16And;
+ UINT32 DeviceCapabilities2;
+ UINT8 PegFunc;
+
+ PegFunc = (UINT8) ((mDeviceCapMmBaseSave [RootBridgeIndex][0] >> 12) & 0x07);
+ if (PegFunc >= SA_PEG_MAX_FUN) {
+ DEBUG ((EFI_D_ERROR, "PegFunc out of bound! Exit from PcieEnumerateDeviceToApplyASPM()!\n"));
+ ASSERT (PegFunc < SA_PEG_MAX_FUN);
+ return;
+ }
+
+ if(AutoFlag) {
+ LinkAspmVal = PcieCalcAspmSettings(RootBridgeIndex);
+ RootPortAspm = LinkAspmVal & 0xFF;
+ EndPointAspm = LinkAspmVal & 0xFF;
+ DEBUG ((EFI_D_INFO, "PcieCalcAspmSettings return ASPM value as: %x, apply on both RP and EP\n", RootPortAspm));
+ }
+
+ ///
+ /// Apply to root port first
+ ///
+ MmioAndThenOr16 (mDeviceCapMmBaseSave [RootBridgeIndex][0] + 0x010, (UINT16)~3, RootPortAspm);
+ DEBUG ((EFI_D_INFO, "Apply Aspm settings to Root [%X] to Aspm value: 0x%x\n", mDeviceCapMmBaseSave [RootBridgeIndex][0] + 0x010, RootPortAspm));
+ ///
+ /// Save register setting for S3 resume.
+ ///
+ mDeviceAspmSave [RootBridgeIndex][0] = MmioRead8 (mDeviceCapMmBaseSave [RootBridgeIndex][0] + 0x010);
+ SaScriptMemWrite (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (mDeviceCapMmBaseSave [RootBridgeIndex][0] + 0x010),
+ 1,
+ &mDeviceAspmSave [RootBridgeIndex][0]
+ );
+ ///
+ /// Apply Power Optimizer settings to PEG RootPoints.
+ /// Read DCAP2 to see if LTR/OBFF is supported, program DCTL2 according to policies.
+ ///
+ PegBaseAddress = (UINT32) (mDeviceCapMmBaseSave [RootBridgeIndex][0] & (UINTN) ~0xFF);
+ DeviceCapabilities2 = MmioRead32 (PegBaseAddress + R_SA_PEG_DCAP2_OFFSET);
+ Data16And = (UINT16)~(BIT10 + BIT13 + BIT14);
+ Data16Or = 0;
+
+ if (DeviceCapabilities2 & BIT11) {
+ if (mPegPwrOpt[PegFunc].LtrEnable == 1) {
+ Data16Or |= BIT10;
+ }
+ }
+ ///
+ /// Check if root port support WAKE# signaling
+ ///
+ if ((DeviceCapabilities2 & BIT19) != 0) {
+ if (mPegPwrOpt[PegFunc].ObffEnable == 1) {
+ Data16Or |= BIT14 | BIT13; ///< 11b - Enable OBFF using WAKE#
+ }
+ }
+
+ DEBUG ((EFI_D_INFO, "Configure LTR/OBFF setting to PEG root [0x%x] to value 0x%x\n",
+ PegBaseAddress + R_SA_PEG_DCTL2_OFFSET, Data16Or));
+ MmioAndThenOr16 (PegBaseAddress + R_SA_PEG_DCTL2_OFFSET, Data16And, Data16Or);
+ SaScriptMemReadWrite (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PegBaseAddress + R_SA_PEG_DCTL2_OFFSET),
+ &Data16Or,
+ &Data16And
+ );
+ mDeviceLtrObffSave [RootBridgeIndex][0] = MmioRead16 (PegBaseAddress + R_SA_PEG_DCTL2_OFFSET);
+
+ ///
+ /// Apply to end point devices
+ ///
+ EndpointCompleted = 1;
+ while (EndpointCompleted < mNumberOfDeviceFound [RootBridgeIndex]) {
+ ///
+ /// Read the Link Capability register's ASPM setting and apply ASPM setting to end point device
+ ///
+ LinkAspmCap = (MmioRead16 (mDeviceCapMmBaseSave [RootBridgeIndex][EndpointCompleted] + 0x00C) >> 10) & 3;
+ MmioAndThenOr16 (mDeviceCapMmBaseSave [RootBridgeIndex][EndpointCompleted] + 0x010, (UINT16)~3, EndPointAspm & LinkAspmCap);
+ DEBUG ((EFI_D_INFO, "Apply Aspm settings to device [%X] to Aspm value: 0x%x and in fact set to 0x%x\n", mDeviceCapMmBaseSave [RootBridgeIndex][EndpointCompleted] + 0x10, EndPointAspm, EndPointAspm & LinkAspmCap));
+ ///
+ /// Save register setting for S3 resume.
+ ///
+ mDeviceAspmSave [RootBridgeIndex][EndpointCompleted] = MmioRead8 (mDeviceCapMmBaseSave [RootBridgeIndex][EndpointCompleted] + 0x010);
+ SaScriptMemWrite (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (mDeviceCapMmBaseSave [RootBridgeIndex][EndpointCompleted] + 0x010),
+ 1,
+ &mDeviceAspmSave [RootBridgeIndex][EndpointCompleted]
+ );
+ ///
+ /// Power optimization on end point device
+ ///
+ PcieSetEndpointLtrObff (RootBridgeIndex, EndpointCompleted);
+ EndpointCompleted ++;
+ }
+}
+
+/**
+ This function apply additional settings before ASPM enabling
+
+ @param[in] RootBridgeIndex - Root Bridge Index to select mDeviceCapMmBaseSave array elements for ASPM capability calculation.
+**/
+VOID
+PcieAdditionalSettingBeforeASPM (
+ IN UINT8 RootBridgeIndex
+ )
+{
+ UINT32 Data32Or;
+ UINT32 Data32And;
+
+ if ((mPegAspmPerPort[RootBridgeIndex] != PcieAspmDisabled) && (mCommonClock [RootBridgeIndex] == 1)) {
+ ///
+ /// Enable support for L0s and L1 by programming the `Active State Link
+ /// PM Support' field of the LCAP register at D.F.R 0ACh [11:10] = `11b'.
+ ///
+ MmioOr32 ((mDeviceCapMmBaseSave[RootBridgeIndex][0] & (UINTN) ~0xFF) + 0x0AC, BIT11 | BIT10);
+ Data32Or = (BIT11 | BIT10);
+ Data32And = (UINT32)~(BIT11 | BIT10);
+ SaScriptMemReadWrite (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) ((mDeviceCapMmBaseSave [RootBridgeIndex][0] & (UINTN) ~0xFF) + 0x0AC),
+ &Data32Or, ///< Data to be ORed
+ &Data32And ///< Data to be ANDed
+ );
+
+ ///
+ /// Set D.F.R 0200h [27:26] to `00b'.
+ ///
+ MmioAnd32 ((mDeviceCapMmBaseSave[RootBridgeIndex][0] & (UINTN) ~0xFF) + 0x200, (UINT32) ~(BIT27 | BIT26));
+ Data32Or = 0;
+ Data32And = (UINT32)~(BIT27 | BIT26);
+ SaScriptMemReadWrite (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) ((mDeviceCapMmBaseSave [RootBridgeIndex][0] & (UINTN) ~0xFF) + 0x200),
+ &Data32Or, ///< Data to be ORed
+ &Data32And ///< Data to be ANDed
+ );
+
+ ///
+ /// Set D.F.R 0258 [2] to '1b' for PCI Express 2.0 compliance
+ /// Note: Other fields within this register must not be changed
+ /// while writing to D1.F0.R 0258h [2]
+ ///
+ MmioOr16 ((mDeviceCapMmBaseSave [RootBridgeIndex][0] & (UINTN) ~0xFF) + R_SA_PEG_CFG4_OFFSET, BIT2);
+ Data32Or = BIT2;
+ Data32And = (UINT32)~(BIT2);
+ SaScriptMemReadWrite (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) ((mDeviceCapMmBaseSave [RootBridgeIndex][0] & (UINTN) ~0xFF) + R_SA_PEG_CFG4_OFFSET),
+ &Data32Or, ///< Data to be ORed
+ &Data32And ///< Data to be ANDed
+ );
+ }
+}
+
+/**
+ This function does all SA ASPM initialization
+**/
+VOID
+SaAspm (
+ VOID
+ )
+{
+ BOOLEAN AutoFlag;
+ UINT16 RootPortAspm;
+ UINT16 EndPointAspm;
+ UINT8 PegComplete;
+ SA_PCIE_ASPM_CONFIG PegAspmSetup;
+ UINT8 PegAspmL0sSetup;
+
+ ///
+ /// Scan PEG devices and program ASPM
+ ///
+ for (PegComplete = 0; PegComplete < MAX_SUPPORTED_ROOT_BRIDGE_NUMBER; PegComplete++) {
+ if (mDeviceCapMmBaseSave [PegComplete][0] == 0) {
+ continue;
+ }
+ PegAspmSetup = mPegAspmPerPort[PegComplete];
+ PegAspmL0sSetup = mPegAspmL0sPerPort[PegComplete];
+ RootPortAspm = 0;
+ EndPointAspm = 0;
+ AutoFlag = FALSE;
+
+ PcieAdditionalSettingBeforeASPM (PegComplete);
+ DEBUG ((EFI_D_INFO, "PegAspmSetup[%x]=%x\n", PegComplete, PegAspmSetup));
+ DEBUG ((EFI_D_INFO, "PegAspmL0sSetup[%x]=%x\n", PegComplete, PegAspmL0sSetup));
+ if ((PegAspmSetup != PcieAspmDisabled) && (mCommonClock [PegComplete] == 1)) {
+ ///
+ /// Select L1/L0 programming based on setup questions
+ ///
+ switch(PegAspmSetup) {
+ case PcieAspmL1:///<2
+ case PcieAspmL0sL1:///<3
+ RootPortAspm = L1_SET;
+ EndPointAspm = L1_SET;
+
+ ///
+ /// If L1's only then break, else also program L0's
+ ///
+ if (PegAspmSetup == PcieAspmL1 ) {
+ break;
+ }
+ case PcieAspmL0s:///<1
+ RootPortAspm |= (PegAspmL0sSetup & L0_SET );
+ EndPointAspm |= ((PegAspmL0sSetup >> 1 ) & L0_SET );
+ break;
+ case PcieAspmAutoConfig: ///<4
+ case PcieAspmMax: ///<5
+ AutoFlag = TRUE;
+ break;
+ case PcieAspmDisabled:
+ default:
+ break;
+ }
+ }
+ DEBUG ((EFI_D_INFO, "RootPortAspm=%x\n", RootPortAspm ));
+ DEBUG ((EFI_D_INFO, "EndPointAspm=%x\n", EndPointAspm ));
+ PcieEnumerateDeviceToApplyASPM(PegComplete, AutoFlag, RootPortAspm, EndPointAspm);
+ }
+ ///
+ /// Program override register with final latency values.
+ ///
+ PcieILtrOverride ();
+ return;
+}
+
+/**
+ This function checks PEG end point device for extended tag capability and enables them if they are.
+**/
+VOID
+EnableExtendedTag (
+ VOID
+ )
+{
+ UINT8 RootBridgeCompleted;
+ UINT8 EndpointCompleted;
+ UINTN RootPortPcieCapMmBase;
+ UINTN EndPointPcieCapMmBase;
+ UINTN PcieCapMmBase;
+
+ ///
+ /// Scan PEG devices
+ ///
+ for (RootBridgeCompleted = 0; RootBridgeCompleted < MAX_SUPPORTED_ROOT_BRIDGE_NUMBER; RootBridgeCompleted++) {
+ RootPortPcieCapMmBase = mDeviceCapMmBaseSave [RootBridgeCompleted][0];
+ if (RootPortPcieCapMmBase == 0) {
+ continue;
+ }
+ for (EndpointCompleted = 0; EndpointCompleted < mNumberOfDeviceFound [RootBridgeCompleted]; EndpointCompleted++) {
+ if (EndpointCompleted != 0) {
+ EndPointPcieCapMmBase = mDeviceCapMmBaseSave [RootBridgeCompleted][EndpointCompleted];
+ DEBUG ((EFI_D_INFO, "Extended tag scan End Point [B%X|D%X|F%X|R%X]\n",
+ (EndPointPcieCapMmBase >> 20) & mMaxBusNumberSupported,
+ (EndPointPcieCapMmBase >> 15) & 0x1F,
+ (EndPointPcieCapMmBase >> 12) & 0x07,
+ (EndPointPcieCapMmBase + 0x010) & 0xFFF));
+ ///
+ /// If extended tag is supported, enable it.
+ ///
+ if (((MmioRead32 (EndPointPcieCapMmBase + 0x4)) & BIT5) != 0) {
+ MmioOr16 (EndPointPcieCapMmBase + 0x8, BIT8);
+ DEBUG ((EFI_D_INFO, "Extended tag enabled [B%X|D%X|F%X|R%X]\n",
+ (EndPointPcieCapMmBase >> 20) & mMaxBusNumberSupported,
+ (EndPointPcieCapMmBase >> 15) & 0x1F,
+ (EndPointPcieCapMmBase >> 12) & 0x07,
+ (EndPointPcieCapMmBase + 0x010) & 0xFFF));
+ }
+ }
+ ///
+ /// Save Device Control Register value on all bridges and devices for S3 resume
+ ///
+ PcieCapMmBase = mDeviceCapMmBaseSave [RootBridgeCompleted][EndpointCompleted];
+ mDeviceControlRegisterSave [RootBridgeCompleted][EndpointCompleted] = MmioRead16 (PcieCapMmBase + 0x8);
+ SaScriptMemWrite (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PcieCapMmBase + 0x8),
+ 1,
+ &mDeviceControlRegisterSave [RootBridgeCompleted][EndpointCompleted]
+ );
+ }
+ }
+ return;
+}
+#endif // PEG_FLAG
+
+/**
+ This function saves/restores Chipset registers
+
+ @param[in] IsSaving - TRUE for saving and FALSE for restoring
+ @param[in] PciRegistersSaveTable[] - The register table that has to be saved/restored
+ @param[in] PciRegistersSaveTableSize - Size of above table
+ @param[in] PciRegistersSaveBuffer - A saving/restoring buffer for those register settings.
+**/
+VOID
+SaSaveRestoreChipset (
+ IN BOOLEAN IsSaving,
+ IN BOOT_SCRIPT_PCI_REGISTER_SAVE PciRegistersSaveTable[],
+ IN UINTN PciRegistersSaveTableSize,
+ IN OUT UINTN *PciRegistersSaveBuffer
+)
+{
+ UINT8 Index;
+
+ if (IsSaving == TRUE) {
+ DEBUG ((EFI_D_INFO, "SA Save PCI register settings\n"));
+ ///
+ /// Save SA PCI Registers for S3 resume
+ ///
+ for (Index = 0; Index < PciRegistersSaveTableSize; Index++) {
+ PciRegistersSaveBuffer[Index] = MmioRead32 (PciRegistersSaveTable[Index].Address);
+ SaScriptMemWrite (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) PciRegistersSaveTable[Index].Address,
+ 1,
+ &PciRegistersSaveBuffer[Index]
+ );
+ DEBUG ((EFI_D_INFO, "SA Register = %X, SaPciRegSave = %08X\n", PciRegistersSaveTable[Index].Address, PciRegistersSaveBuffer[Index]));
+ }
+ } else {
+ DEBUG ((EFI_D_INFO, "SA Restore PCI register settings\n"));
+ ///
+ /// Restore SA PCI Registers for S3 resume
+ ///
+ for (Index = 0; Index < PciRegistersSaveTableSize; Index++) {
+ MmioWrite32 (PciRegistersSaveTable[Index].Address, (UINT32) PciRegistersSaveBuffer[Index]);
+ DEBUG ((EFI_D_INFO, "SA Register = %X, SaPciRegSave = %08X\n", PciRegistersSaveTable[Index].Address, PciRegistersSaveBuffer[Index]));
+ }
+ }
+}
+
+/**
+ This function saves/restores platform relative registers
+
+ @param[in] IsSaving - TRUE for saving and FALSE for restoring
+**/
+VOID
+SaSaveRestorePlatform (
+ IN BOOLEAN IsSaving
+)
+{
+ UINT8 Index;
+ UINT8 Data8;
+
+ ///
+ /// Save (or restore) IGFX registers
+ /// When saving, it has to be done after all BAR/Command registers have been assigned.
+ ///
+ if (MmPci16 (0, SA_IGD_BUS, SA_IGD_DEV, SA_IGD_FUN_0, PCI_VID) != 0xFFFF) {
+ SaSaveRestoreChipset (IsSaving, mSaIgfxPciRegistersSaveTable, sizeof (mSaIgfxPciRegistersSaveTable) / sizeof (BOOT_SCRIPT_PCI_REGISTER_SAVE), mSaIgfxPciRegistersSave);
+ }
+
+ if (IsSaving == TRUE) {
+ DEBUG ((EFI_D_INFO, "SA Save platform register settings\n"));
+ ///
+ /// Save PAM register
+ ///
+ for (Index = 0; Index < MAX_PAM_REG_COUNT; Index++) {
+ mPAMSave[Index] = MmPci8 (0, SA_MC_BUS, SA_MC_DEV, SA_MC_FUN, PAM_REG_BASE + Index);
+ SaScriptMemWrite (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) MmPciAddress (0, SA_MC_BUS, SA_MC_DEV, SA_MC_FUN, PAM_REG_BASE + Index),
+ 1,
+ &mPAMSave[Index]
+ );
+ }
+ } else {
+ DEBUG ((EFI_D_INFO, "SA Restore platform register settings\n"));
+ ///
+ /// Restore PAM register
+ ///
+ for (Index = 0; Index < MAX_PAM_REG_COUNT; Index++) {
+ MmPci8 (0, SA_MC_BUS, SA_MC_DEV, SA_MC_FUN, PAM_REG_BASE + Index) = mPAMSave [Index];
+ }
+ }
+ ///
+ /// CRID configuration
+ ///
+ if (mCridEnable == TRUE) {
+ Data8 = CRID_DATA;
+ } else {
+ Data8 = CRID_LOCK;
+ }
+ MmPci8 (0, SA_MC_BUS, SA_MC_DEV, SA_MC_FUN, PCI_RID) = Data8;
+ SaScriptMemWrite (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) MmPciAddress (0, SA_MC_BUS, SA_MC_DEV, SA_MC_FUN, 0x08),
+ 1,
+ &Data8
+ );
+
+}
+
+/**
+ This function does SA security lock
+**/
+VOID
+SaSecurityLock (
+ VOID
+)
+{
+ UINT8 Index;
+ UINT64 BaseAddress;
+ UINT32 RegOffset;
+ UINT32 Data32And;
+ UINT32 Data32Or;
+ CPU_STEPPING CpuSteppingId;
+ CPU_FAMILY CpuFamilyId;
+
+ CpuSteppingId = GetCpuStepping();
+ CpuFamilyId = GetCpuFamily();
+
+ ///
+ /// 17.2 System Agent Security Lock configuration
+ ///
+ DEBUG ((EFI_D_INFO, "SaSecurityLock\n"));
+ for (Index = 0; Index < (sizeof (mSaSecurityRegisters) / sizeof (BOOT_SCRIPT_REGISTER_SETTING)); Index++) {
+ BaseAddress = mSaSecurityRegisters[Index].BaseAddr;
+ RegOffset = mSaSecurityRegisters[Index].Offset;
+ Data32And = mSaSecurityRegisters[Index].AndMask;
+ Data32Or = mSaSecurityRegisters[Index].OrMask;
+
+ if (mDevice4Enable == TRUE) {
+ if (RegOffset == 0x50FC){
+ Data32Or = 0x87; ///< unlock bit3 if Device (0,4,0) is enabbled.
+ }
+ }
+ MmioAndThenOr32 (BaseAddress + RegOffset, Data32And, Data32Or);
+ SaScriptMemReadWrite (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (BaseAddress + RegOffset),
+ &Data32Or, ///< Data to be ORed
+ &Data32And ///< Data to be ANDed
+ );
+ }
+
+ ///
+ /// Lock processor/chipset BAR registers
+ ///
+
+ if (!(((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId <= EnumHswB0) ) ||
+ ((CpuFamilyId == EnumCpuHswUlt) && (CpuSteppingId <= EnumHswUltB0)) ||
+ ((CpuFamilyId == EnumCpuCrw) && (CpuSteppingId <= EnumCrwB0) ) )) {
+ AsmMsrOr64 (0x2e7, 1);
+ }
+}
+
+#ifdef PEG_FLAG
+/**
+ This function handles SA S3 resume
+**/
+VOID
+SaS3Resume (
+ VOID
+)
+{
+ UINT8 PegComplete;
+ UINT8 EndpointCompleted;
+ UINT32 PegBaseAddress;
+
+#ifndef AMI_OVERRIDE_FOR_ULT_FASTBOOT
+ CPU_FAMILY CpuFamilyId;
+ CpuFamilyId = GetCpuFamily();
+ if (CpuFamilyId == EnumCpuHswUlt) return;
+#endif // AMI_OVERRIDE_FOR_ULT_FASTBOOT
+
+ DEBUG ((EFI_D_INFO, "SA S3 resume\n"));
+ if (mEnumStatus == EFI_SUCCESS) {
+ ///
+ /// Restore Bus number assignment first
+ ///
+ for (PegComplete = 0; PegComplete < MAX_SUPPORTED_ROOT_BRIDGE_NUMBER; PegComplete++) {
+ if (mDeviceCapMmBaseSave [PegComplete][0] == 0) {
+ continue;
+ }
+ EndpointCompleted = 0;
+ while (EndpointCompleted < mNumberOfDeviceFound [PegComplete]) {
+ PegBaseAddress = (mDeviceCapMmBaseSave [PegComplete][EndpointCompleted] & (UINTN) ~0xFF);
+ MmioWrite32 (PegBaseAddress + PCI_PBUS, mDeviceBusNumberSave [PegComplete][EndpointCompleted]);
+ DEBUG ((EFI_D_INFO, " Restore Bus number [%X] = %08X\n", PegBaseAddress + PCI_PBUS, MmioRead32 (PegBaseAddress + PCI_PBUS)));
+ EndpointCompleted ++;
+ }
+ }
+ for (PegComplete = 0; PegComplete < MAX_SUPPORTED_ROOT_BRIDGE_NUMBER; PegComplete++) {
+ if (mDeviceCapMmBaseSave [PegComplete][0] == 0) {
+ continue;
+ }
+ PcieAdditionalSettingBeforeASPM (PegComplete);
+ EndpointCompleted = 0;
+ while (EndpointCompleted < mNumberOfDeviceFound [PegComplete]) {
+ PegBaseAddress = (mDeviceCapMmBaseSave [PegComplete][EndpointCompleted] & (UINTN) ~0xFF);
+ ///
+ /// Restore Max Pay Load and Extended Tag
+ ///
+ MmioWrite16 (mDeviceCapMmBaseSave [PegComplete][EndpointCompleted] + 0x8, mDeviceControlRegisterSave [PegComplete][EndpointCompleted]);
+ DEBUG ((EFI_D_INFO, "[B%X|D%X|F%X|R%X] DCTL=%X\n",
+ (mDeviceCapMmBaseSave [PegComplete][EndpointCompleted] >> 20) & mMaxBusNumberSupported,
+ (mDeviceCapMmBaseSave [PegComplete][EndpointCompleted] >> 15) & 0x1F,
+ (mDeviceCapMmBaseSave [PegComplete][EndpointCompleted] >> 12) & 0x07,
+ (mDeviceCapMmBaseSave [PegComplete][EndpointCompleted] + 0x08) & 0xFFF,
+ mDeviceControlRegisterSave [PegComplete][EndpointCompleted]));
+ ///
+ /// Restore ASPM and Common Clock
+ ///
+ MmioWrite8 ((mDeviceCapMmBaseSave [PegComplete][EndpointCompleted] + 0x010), mDeviceAspmSave [PegComplete][EndpointCompleted]);
+ DEBUG ((EFI_D_INFO, "[B%X|D%X|F%X|R%X] ASPM/CommonClock=%X\n",
+ (mDeviceCapMmBaseSave [PegComplete][EndpointCompleted] >> 20) & mMaxBusNumberSupported,
+ (mDeviceCapMmBaseSave [PegComplete][EndpointCompleted] >> 15) & 0x1F,
+ (mDeviceCapMmBaseSave [PegComplete][EndpointCompleted] >> 12) & 0x07,
+ (mDeviceCapMmBaseSave [PegComplete][EndpointCompleted] + 0x10) & 0xFFF,
+ mDeviceAspmSave [PegComplete][EndpointCompleted]));
+ ///
+ /// Restore PEG power optimization.
+ ///
+ MmioAndThenOr16 (mDeviceCapMmBaseSave [PegComplete][EndpointCompleted] + 0x28, (UINT16)~(BIT10 + BIT13 + BIT14), mDeviceLtrObffSave [PegComplete][EndpointCompleted]);
+ DEBUG ((EFI_D_INFO, "[B%X|D%X|F%X|R%X] LTR/OBFF=%X\n",
+ (mDeviceCapMmBaseSave [PegComplete][EndpointCompleted] >> 20) & mMaxBusNumberSupported,
+ (mDeviceCapMmBaseSave [PegComplete][EndpointCompleted] >> 15) & 0x1F,
+ (mDeviceCapMmBaseSave [PegComplete][EndpointCompleted] >> 12) & 0x07,
+ (mDeviceCapMmBaseSave [PegComplete][EndpointCompleted] + 0x28) & 0xFFF,
+ mDeviceLtrObffSave [PegComplete][EndpointCompleted]));
+
+ if (mDeviceExtCapLtrOffsetSave [PegComplete][EndpointCompleted] != 0) {
+ MmioAndThenOr16 (PegBaseAddress + mDeviceExtCapLtrOffsetSave [PegComplete][EndpointCompleted] + 0x4, (UINT16) (~0x1FFF), mDeviceMaxSnoopLatencySave [PegComplete][EndpointCompleted]);
+ DEBUG ((EFI_D_INFO, "[B%X|D%X|F%X|R%X] Max snoop latency=%X\n",
+ ((PegBaseAddress + mDeviceExtCapLtrOffsetSave [PegComplete][EndpointCompleted]) >> 20) & mMaxBusNumberSupported,
+ ((PegBaseAddress + mDeviceExtCapLtrOffsetSave [PegComplete][EndpointCompleted]) >> 15) & 0x1F,
+ ((PegBaseAddress + mDeviceExtCapLtrOffsetSave [PegComplete][EndpointCompleted]) >> 12) & 0x07,
+ (PegBaseAddress + mDeviceExtCapLtrOffsetSave [PegComplete][EndpointCompleted] + 0x4) & 0xFFF,
+ mDeviceMaxSnoopLatencySave [PegComplete][EndpointCompleted]));
+
+ MmioAndThenOr16 ((PegBaseAddress + mDeviceExtCapLtrOffsetSave [PegComplete][EndpointCompleted] + 0x6), (UINT16) (~0x1FFF), mDeviceMaxNoSnoopLatencySave [PegComplete][EndpointCompleted]);
+ DEBUG ((EFI_D_INFO, "[B%X|D%X|F%X|R%X] Max No-snoop latency=%X\n",
+ ((PegBaseAddress + mDeviceExtCapLtrOffsetSave [PegComplete][EndpointCompleted]) >> 20) & mMaxBusNumberSupported,
+ ((PegBaseAddress + mDeviceExtCapLtrOffsetSave [PegComplete][EndpointCompleted]) >> 15) & 0x1F,
+ ((PegBaseAddress + mDeviceExtCapLtrOffsetSave [PegComplete][EndpointCompleted]) >> 12) & 0x07,
+ (PegBaseAddress + mDeviceExtCapLtrOffsetSave [PegComplete][EndpointCompleted] + 0x6) & 0xFFF,
+ mDeviceMaxNoSnoopLatencySave [PegComplete][EndpointCompleted]));
+ }
+ if (mDeviceExtCapVcOffsetSave [PegComplete][EndpointCompleted]) {
+ MmioAndThenOr8 ((mDeviceExtCapVcOffsetSave [PegComplete][EndpointCompleted] + 0x14), 0, mDeviceTcxVc0MappingSave [PegComplete][EndpointCompleted]);
+ DEBUG ((EFI_D_INFO, "[B%X|D%X|F%X|R%X] TCx/VC0 mapping=%X\n",
+ ((PegBaseAddress + mDeviceExtCapLtrOffsetSave [PegComplete][EndpointCompleted]) >> 20) & mMaxBusNumberSupported,
+ ((PegBaseAddress + mDeviceExtCapLtrOffsetSave [PegComplete][EndpointCompleted]) >> 15) & 0x1F,
+ ((PegBaseAddress + mDeviceExtCapLtrOffsetSave [PegComplete][EndpointCompleted]) >> 12) & 0x07,
+ (PegBaseAddress + mDeviceExtCapLtrOffsetSave [PegComplete][EndpointCompleted] + 0x14) & 0xFFF,
+ mDeviceTcxVc0MappingSave [PegComplete][EndpointCompleted]));
+ }
+ EndpointCompleted ++;
+ }
+ ///
+ /// If common clock supported on root port and endpoint, retrain link
+ ///
+ if (mCommonClock [PegComplete] == 1) {
+ DEBUG ((EFI_D_INFO, "Retrain Link for Common Clock\n"));
+ ///
+ /// Retrain the Link per PCI Express Specification.
+ ///
+ MmioOr8 (mDeviceCapMmBaseSave [PegComplete][0] + 0x010, BIT5);
+
+ ///
+ /// Wait until Re-Training has completed.
+ ///
+ while ((MmioRead16 (mDeviceCapMmBaseSave [PegComplete][0] + 0x012) & BIT11) != 0) {}
+ }
+ }
+ }
+ ///
+ /// Re-do this during S3 resume
+ ///
+ PcieILtrOverride ();
+}
+#endif // PEG_FLAG
+
+/**
+ Wrapper function for all SA S3 resume tasks which can be a callback function.
+**/
+VOID
+SaS3ResumeCallback (
+ VOID
+)
+{
+#ifdef PEG_FLAG
+ SaS3Resume ();
+#endif // PEG_FLAG
+ SaSaveRestoreChipset (FALSE, mSaChipsetPciRegistersSaveTable, sizeof (mSaChipsetPciRegistersSaveTable) / sizeof (BOOT_SCRIPT_PCI_REGISTER_SAVE), mSaChipsetPciRegistersSave);
+ SaSaveRestorePlatform (FALSE);
+ SaSecurityLock ();
+}
+
+/**
+ Wrapper function for all SA ASPM tasks and extended tag which can be a callback function.
+**/
+VOID
+SaPcieConfigAfterOpRom (
+ VOID
+)
+{
+
+#ifndef AMI_OVERRIDE_FOR_ULT_FASTBOOT
+ CPU_FAMILY CpuFamilyId;
+ CpuFamilyId = GetCpuFamily();
+ if (CpuFamilyId == EnumCpuHswUlt) return;
+#endif // AMI_OVERRIDE_FOR_ULT_FASTBOOT
+
+#ifdef PEG_FLAG
+ DEBUG ((EFI_D_INFO, "SA ASPM\n"));
+ if (mEnumStatus == EFI_SUCCESS) {
+ SaAspm ();
+ ///
+ /// Device Control Register on all endpoint devices is saved after the OpRom has run in EnableExtendedTag (DXE phase will still use ExitPmAuth)
+ /// This is to prevent duplication of saving this register in different phases.
+ ///
+ EnableExtendedTag ();
+ }
+#endif // PEG_FLAG
+}
+
+/**
+ Wrapper function for all SA enumeration tasks which can be a callback function.
+**/
+VOID
+SaPcieEnumCallback (
+ VOID
+)
+{
+#ifndef AMI_OVERRIDE_FOR_ULT_FASTBOOT
+ CPU_FAMILY CpuFamilyId;
+ CpuFamilyId = GetCpuFamily();
+ if (CpuFamilyId != EnumCpuHswUlt) {
+#endif // AMI_OVERRIDE_FOR_ULT_FASTBOOT
+ DEBUG ((EFI_D_INFO, "SA PCIe enumeration\n"));
+#ifdef PEG_FLAG
+ ///
+ /// Expected to execute in ExitPmAuth point (before OROM)
+ ///
+ mEnumStatus = EnumerateAllPcieDevices ();
+ if (mEnumStatus == EFI_SUCCESS) {
+ SaPcieConfigBeforeOpRom ();
+ }
+#endif // PEG_FLAG
+#ifndef AMI_OVERRIDE_FOR_ULT_FASTBOOT
+ }
+#endif
+ ///
+ /// Save Chipset registers
+ ///
+ SaSaveRestoreChipset (TRUE, mSaChipsetPciRegistersSaveTable, sizeof (mSaChipsetPciRegistersSaveTable) / sizeof (BOOT_SCRIPT_PCI_REGISTER_SAVE), mSaChipsetPciRegistersSave);
+}
+
+/**
+ This function will initialize all required platform policy into global veriables so no need to locate policy protocol during runtime.
+**/
+VOID
+SaPcieInitPolicy (
+ IN DXE_PLATFORM_SA_POLICY_PROTOCOL *DxePlatformSaPolicy
+)
+{
+ UINT8 RootPortCount;
+ UINT8 Index;
+
+ ///
+ /// Initialize module global variables - Stepping ID and Platform Policy
+ ///
+ for (Index = 0; Index < (sizeof (mSaChipsetPciRegistersSaveTable) / sizeof (BOOT_SCRIPT_PCI_REGISTER_SAVE)); Index++) {
+ mSaChipsetPciRegistersSaveTable[Index].Address = MmPciAddress (0, SA_MC_BUS, SA_MC_DEV, SA_MC_FUN, mSaChipsetPciRegistersTable[Index]);
+ }
+
+ for (Index = 0; Index < (sizeof (mSaIgfxPciRegistersSaveTable) / sizeof (BOOT_SCRIPT_PCI_REGISTER_SAVE)); Index++) {
+ mSaIgfxPciRegistersSaveTable[Index].Address = MmPciAddress (0, SA_IGD_BUS, SA_IGD_DEV, SA_IGD_FUN_0, mSaIgfxPciRegistersTable[Index]);
+ }
+
+ for (Index = 0; Index < (sizeof (mSaSecurityRegisters) / sizeof (BOOT_SCRIPT_REGISTER_SETTING)); Index++) {
+ if (mSaSecurityRegisters[Index].BaseAddr != MCH_BASE_ADDRESS) {
+ mSaSecurityRegisters[Index].BaseAddr = (UINTN) MmPciAddress (0,0,0,0,0);
+ }
+ }
+
+ for (RootPortCount = 0; RootPortCount < MAX_SUPPORTED_ROOT_BRIDGE_NUMBER; RootPortCount++) {
+ mPegAspmPerPort[RootPortCount] = DxePlatformSaPolicy->PcieConfig->PegAspm[RootPortCount];
+ mPegAspmL0sPerPort[RootPortCount] = DxePlatformSaPolicy->PcieConfig->PegAspmL0s[RootPortCount];
+ if (DxePlatformSaPolicy->Revision >= DXE_SA_PLATFORM_POLICY_PROTOCOL_REVISION_7) {
+ mPegPwrOpt[RootPortCount] = DxePlatformSaPolicy->PcieConfig->PegPwrOpt[RootPortCount];
+ } else {
+ //
+ // This Platform policy protocol field may not have been initialized.
+ // Initialize a default for RC to use
+ //
+ mPegPwrOpt[RootPortCount].LtrEnable = 1;
+ mPegPwrOpt[RootPortCount].LtrMaxSnoopLatency = V_SA_LTR_MAX_SNOOP_LATENCY_VALUE;
+ mPegPwrOpt[RootPortCount].LtrMaxNoSnoopLatency = V_SA_LTR_MAX_NON_SNOOP_LATENCY_VALUE;
+ mPegPwrOpt[RootPortCount].ObffEnable = 1;
+ }
+ }
+
+ if (DxePlatformSaPolicy->Revision >= DXE_SA_PLATFORM_POLICY_PROTOCOL_REVISION_2) {
+ mPcieAspmDevsOverride = DxePlatformSaPolicy->PcieConfig->PcieAspmDevsOverride;
+ mPcieLtrDevsOverride = DxePlatformSaPolicy->PcieConfig->PcieLtrDevsOverride;
+ }
+ mCridEnable = DxePlatformSaPolicy->MiscConfig->CridEnable;
+ mDevice4Enable = DxePlatformSaPolicy->MiscConfig->Device4Enable;
+ mSteppingId = GetCpuStepping ();
+
+ mBridgeId = (UINT8) (McD0PciCfg16 (R_SA_MC_DEVICE_ID) & 0xF0);
+ mBridgeSteppingId = mBridgeId + mSteppingId;
+
+ ///
+ /// Initialize Snoop and Non-Snoop Latencies
+ ///
+ mSnoopLatencyOvrValue = 0;
+ mNonSnoopLatencyOvrValue = 0;
+
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Common/SaPcieLib.cif b/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Common/SaPcieLib.cif
new file mode 100644
index 0000000..f966a97
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Common/SaPcieLib.cif
@@ -0,0 +1,11 @@
+<component>
+ name = "SaPcieLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\SystemAgent\Library\SaPcieLib\Common\"
+ RefName = "SaPcieLib"
+[files]
+"SaPcieLib.sdl"
+"SaPcieLib.mak"
+"SaPcieLib.h"
+"SaPcieLib.c"
+<endComponent>
diff --git a/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Common/SaPcieLib.h b/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Common/SaPcieLib.h
new file mode 100644
index 0000000..99f19d7
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Common/SaPcieLib.h
@@ -0,0 +1,273 @@
+/** @file
+ Defines and prototypes for the library module
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _SA_PCIE_LIB_H_
+#define _SA_PCIE_LIB_H_
+
+#include "EfiScriptLib.h"
+
+#define MAX_SUPPORTED_ROOT_BRIDGE_NUMBER 3
+#define MAX_SUPPORTED_DEVICE_NUMBER 192
+#define L0_SET BIT0
+#define L1_SET BIT1
+#define MAX_PAM_REG_COUNT 7
+#define PAM_REG_BASE 0x80
+#define CRID_DATA 0x69
+#define CRID_LOCK 0x17
+
+typedef struct {
+ UINT64 Address;
+ EFI_BOOT_SCRIPT_WIDTH Width;
+ UINT32 Value;
+} BOOT_SCRIPT_PCI_REGISTER_SAVE;
+
+EFI_STATUS
+EnumerateAllPcieDevices (
+ VOID
+ )
+/**
+ Enumerate all end point devices connected to root bridge ports and record their MMIO base address
+
+ @param[in] None
+
+ @exception EFI_UNSUPPORTED PCIe capability structure not found
+ @retval EFI_SUCCESS All done successfully
+**/
+;
+
+VOID
+SaPcieConfigBeforeOpRom (
+ VOID
+ )
+/**
+ Sets Common Clock, TCx-VC0 mapping, and Max Payload for PCIe
+
+ @param[in] None
+
+ @retval None
+**/
+;
+
+VOID
+SaAspm (
+ VOID
+ )
+/**
+ This function does all SA ASPM initialization
+
+ @param[in] None
+
+ @retval None
+**/
+;
+
+VOID
+EnableExtendedTag (
+ VOID
+ )
+/**
+ This function checks PEG end point device for extended tag capability and enables them if they are.
+
+ @param[in] None
+
+ @retval None
+**/
+;
+
+VOID
+SaSaveRestoreChipset (
+ IN BOOLEAN IsSaving,
+ IN BOOT_SCRIPT_PCI_REGISTER_SAVE PciRegistersSaveTable[],
+ IN UINTN PciRegistersSaveTableSize,
+ IN OUT UINTN *PciRegistersSaveBuffer
+)
+/**
+ This function saves/restores Chipset registers
+
+ @param[in] IsSaving - TRUE for saving and FALSE for restoring
+ @param[in] PciRegistersSaveTable[] - The register table that has to be saved/restored
+ @param[in] PciRegistersSaveTableSize - Size of above table
+ @param[in] PciRegistersSaveBuffer - A saving/restoring buffer for those register settings.
+
+ @retval None
+**/
+;
+
+VOID
+SaSaveRestorePlatform (
+ IN BOOLEAN IsSaving
+)
+/**
+ This function saves/restores platform relative registers
+
+ @param[in] IsSaving - TRUE for saving and FALSE for restoring
+
+ @retval None
+**/
+;
+
+VOID
+SaSecurityLock (
+ VOID
+)
+/**
+ This function does SA security lock
+
+ @param[in] None
+
+ @retval None
+**/
+;
+
+VOID
+SaS3Resume (
+ VOID
+)
+/**
+ This function handles SA S3 resume
+
+ @param[in] None
+
+ @retval None
+**/
+;
+
+VOID
+SaS3ResumeCallback (
+ VOID
+)
+/**
+ Wrapper function for all SA S3 resume tasks which can be a callback function.
+
+ @param[in] None
+
+ @retval None
+**/
+;
+
+VOID
+SaPcieConfigAfterOpRom (
+ VOID
+)
+/**
+ Wrapper function for all SA ASPM tasks and extended tag which can be a callback function.
+
+ @param[in] None
+
+ @retval None
+**/
+;
+
+VOID
+SaPcieEnumCallback (
+ VOID
+)
+/**
+ Wrapper function for all SA enumeration tasks which can be a callback function.
+
+ @param[in] None
+
+ @retval None
+**/
+;
+
+VOID
+SaPcieInitPolicy (
+ IN DXE_PLATFORM_SA_POLICY_PROTOCOL *DxePlatformSaPolicy
+)
+/**
+ This function will initialize all required platform policy into global veriables so no need to locate policy protocol during runtime.
+
+ @param[in] None
+
+ @retval None
+**/
+;
+
+EFI_STATUS
+SaScriptMemWrite (
+ IN UINT16 TableName,
+ IN EFI_BOOT_SCRIPT_WIDTH Width,
+ IN UINT64 Address,
+ IN UINTN Count,
+ IN VOID *Buffer
+)
+/**
+ Wrapper for boot script with opcode EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE
+
+ @param[in] TableName - Desired boot script table
+ @param[in] Width - The width of the memory operations.
+ @param[in] Address - The base address of the memory operations.
+ @param[in] Count - The number of memory operations to perform.
+ @param[in] Buffer - The source buffer from which to write the data.
+
+ @retval EFI_NOT_FOUND - BootScriptSave Protocol not exist.
+ @retval EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
+**/
+;
+
+EFI_STATUS
+SaScriptMemReadWrite (
+ IN UINT16 TableName,
+ IN EFI_BOOT_SCRIPT_WIDTH Width,
+ IN UINT64 Address,
+ IN VOID *Data,
+ IN VOID *DataMask
+)
+/**
+ Wrapper for boot script with opcode EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE
+
+ @param[in] TableName - Desired boot script table
+ @param[in] Width - The width of the memory operations.
+ @param[in] Address - The base address of the memory operations.
+ @param[in] Data - A pointer to the data to be OR-ed.
+ @param[in] DataMask - A pointer to the data mask to be AND-ed with the data read from the register.
+
+ @retval EFI_NOT_FOUND - BootScriptSave Protocol not exist.
+ @retval EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
+**/
+;
+
+EFI_STATUS
+SaScriptMemPoll (
+ IN UINT16 TableName,
+ IN EFI_BOOT_SCRIPT_WIDTH Width,
+ IN UINT64 Address,
+ IN VOID *BitMask,
+ IN VOID *BitValue,
+ IN UINTN Duration,
+ IN UINTN LoopTimes
+ )
+/**
+ Wrapper for boot script for Polling one memory mapping register
+
+ @param[in] TableName - Desired boot script table
+ @param[in] Width - The width of the memory operations.
+ @param[in] Address - The base address of the memory operations.
+ @param[in] BitMask - A pointer to the bit mask to be AND-ed with the data read from the register.
+ @param[in] BitValue - A pointer to the data value after to be Masked.
+ @param[in] Duration - Duration in microseconds of the stall.
+ @param[in] LoopTimes - The times of the register polling.
+
+ @retval EFI_SUCCESS - The operation was executed successfully
+**/
+;
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Common/SaPcieLib.mak b/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Common/SaPcieLib.mak
new file mode 100644
index 0000000..1228399
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Common/SaPcieLib.mak
@@ -0,0 +1,54 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+# MAK file for the ModulePart:SaPcieLib
+EDK : SaPcieLib
+
+SaPcieLib : $(BUILD_DIR)\SaPcieLib.mak SaPcieLibBin
+
+$(BUILD_DIR)\SaPcieLib.mak : $(SaPcieLib_DIR)\$(@B).cif $(SaPcieLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(SaPcieLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+$(SaPcieLib_LIB) : SaPcieLib
+
+SaPcieLib_INCLUDES=\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(PROJECT_CPU_INCLUDES)\
+ $(INTEL_MCH_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+
+SaPcieLib_DEFINES = \
+ $(CFLAGS) \
+
+SaPcieLibBin:
+ $(MAKE) /$(MAKEFLAGS) $(EDK_DEFAULTS) \
+ /f $(BUILD_DIR)\SaPcieLib.mak all \
+ "MY_INCLUDES=$(SaPcieLib_INCLUDES)" \
+ "CFLAGS=$(SaPcieLib_DEFINES)"\
+ TYPE=LIBRARY LIBRARIES= \
+ LIBRARY_NAME=$(SaPcieLib_LIB)
+
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Common/SaPcieLib.sdl b/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Common/SaPcieLib.sdl
new file mode 100644
index 0000000..ae305ab
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Common/SaPcieLib.sdl
@@ -0,0 +1,29 @@
+
+TOKEN
+ Name = "SaPcieLib_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable SaPcieLib support in Project"
+ TokenType = Boolean
+ TargetMAK = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "SaPcieLib_DIR"
+End
+
+MODULE
+ Help = "Includes SaPcieLib.mak to Project"
+ File = "SaPcieLib.mak"
+End
+
+ELINK
+ Name = "SaPcieLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\SaPcieLib.lib"
+ Parent = "SaPcieLib_LIB"
+ InvokeOrder = AfterParent
+End \ No newline at end of file
diff --git a/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Dxe/SaPcieDxeLib.c b/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Dxe/SaPcieDxeLib.c
new file mode 100644
index 0000000..ccf7775
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Dxe/SaPcieDxeLib.c
@@ -0,0 +1,99 @@
+/** @file
+ This is DXE library code used by Intel System Agent PCIe library
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+#include "EfiScriptLib.h"
+#include EFI_PROTOCOL_CONSUMER (BootScriptSave)
+
+/**
+ Wrapper for boot script with opcode EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE
+
+ @param[in] TableName - Desired boot script table
+ @param[in] Width - The width of the memory operations.
+ @param[in] Address - The base address of the memory operations.
+ @param[in] Count - The number of memory operations to perform.
+ @param[in] Buffer - The source buffer from which to write the data.
+
+ @retval EFI_SUCCESS - Always returns EFI_SUCCESS
+**/
+EFI_STATUS
+SaScriptMemWrite (
+ IN UINT16 TableName,
+ IN EFI_BOOT_SCRIPT_WIDTH Width,
+ IN UINT64 Address,
+ IN UINTN Count,
+ IN VOID *Buffer
+)
+{
+ SCRIPT_MEM_WRITE (TableName, Width, Address, Count, Buffer);
+ return EFI_SUCCESS;
+}
+
+/**
+ Wrapper for boot script with opcode EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE
+
+ @param[in] TableName - Desired boot script table
+ @param[in] Width - The width of the memory operations.
+ @param[in] Address - The base address of the memory operations.
+ @param[in] Data - A pointer to the data to be OR-ed.
+ @param[in] DataMask - A pointer to the data mask to be AND-ed with the data read from the register.
+
+ @retval EFI_SUCCESS - Always returns EFI_SUCCESS
+**/
+EFI_STATUS
+SaScriptMemReadWrite (
+ IN UINT16 TableName,
+ IN EFI_BOOT_SCRIPT_WIDTH Width,
+ IN UINT64 Address,
+ IN VOID *Data,
+ IN VOID *DataMask
+)
+{
+ SCRIPT_MEM_READ_WRITE (TableName, Width, Address, Data, DataMask);
+ return EFI_SUCCESS;
+}
+
+/**
+ Wrapper for boot script for Polling one memory mapping register
+
+ @param[in] TableName - Desired boot script table
+ @param[in] Width - The width of the memory operations.
+ @param[in] Address - The base address of the memory operations.
+ @param[in] BitMask - A pointer to the bit mask to be AND-ed with the data read from the register.
+ @param[in] BitValue - A pointer to the data value after to be Masked.
+ @param[in] Duration - Duration in microseconds of the stall.
+ @param[in] LoopTimes - The times of the register polling.
+
+ @retval EFI_SUCCESS - Always returns EFI_SUCCESS
+**/
+EFI_STATUS
+SaScriptMemPoll (
+ IN UINT16 TableName,
+ IN EFI_BOOT_SCRIPT_WIDTH Width,
+ IN UINT64 Address,
+ IN VOID *BitMask,
+ IN VOID *BitValue,
+ IN UINTN Duration,
+ IN UINTN LoopTimes
+ )
+{
+ SCRIPT_MEM_POLL (TableName, Width, Address, BitMask, BitValue, Duration, LoopTimes);
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Dxe/SaPcieDxeLib.cif b/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Dxe/SaPcieDxeLib.cif
new file mode 100644
index 0000000..1574d65
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Dxe/SaPcieDxeLib.cif
@@ -0,0 +1,11 @@
+<component>
+ name = "SaPcieDxeLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\SystemAgent\Library\SaPcieLib\Dxe\"
+ RefName = "SaPcieDxeLib"
+[files]
+"SaPcieDxeLib.sdl"
+"SaPcieDxeLib.mak"
+"SaPcieDxeLib.c"
+"SaPcieDxeLib.inf"
+<endComponent>
diff --git a/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Dxe/SaPcieDxeLib.inf b/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Dxe/SaPcieDxeLib.inf
new file mode 100644
index 0000000..5ab9c93
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Dxe/SaPcieDxeLib.inf
@@ -0,0 +1,63 @@
+## @file
+# Component description file for the SA PCIE library
+#
+#@copyright
+# Copyright (c) 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = SaPcieDxeLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ ../Common/SaPcieLib.h
+ ../Common/SaPcieLib.c
+ SaPcieDxeLib.c
+
+[includes.common]
+ .
+ $(EDK_SOURCE)/Foundation/Library/Pei/Include
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Library/SaPcieLib/Dxe
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include/Library
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[libraries.common]
+ EdkIIGlueBasePciLibPciExpress
+
+[nmake.common]
+C_FLAGS = $(C_FLAGS)
+C_STD_INCLUDE=
+
+
diff --git a/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Dxe/SaPcieDxeLib.mak b/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Dxe/SaPcieDxeLib.mak
new file mode 100644
index 0000000..fc86ac2
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Dxe/SaPcieDxeLib.mak
@@ -0,0 +1,46 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+# MAK file for the ModulePart:SaPcieDxeLib
+EDK : SaPcieDxeLib
+
+SaPcieDxeLib : $(BUILD_DIR)\SaPcieDxeLib.mak SaPcieDxeLibBin
+
+$(BUILD_DIR)\SaPcieDxeLib.mak : $(SaPcieDxeLib_DIR)\$(@B).cif $(SaPcieDxeLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(SaPcieDxeLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+$(SaPcieDxeLib_LIB) : SaPcieDxeLib
+
+SaPcieDxeLib_DEFINES = \
+ $(CFLAGS) \
+
+SaPcieDxeLibBin: $(SaPcieLib_LIB)
+ $(MAKE) /$(MAKEFLAGS) $(EDK_DEFAULTS) \
+ /f $(BUILD_DIR)\SaPcieDxeLib.mak all \
+ "CFLAGS=$(SaPcieDxeLib_DEFINES)"\
+ TYPE=LIBRARY LIBRARIES= \
+ LIBRARY_NAME=$(SaPcieDxeLib_LIB)
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Dxe/SaPcieDxeLib.sdl b/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Dxe/SaPcieDxeLib.sdl
new file mode 100644
index 0000000..2b306dd
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Dxe/SaPcieDxeLib.sdl
@@ -0,0 +1,33 @@
+TOKEN
+ Name = "SaPcieDxeLib_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable SaPcieDxeLib support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+ Token = "SaPcieLib_SUPPORT" "=" "1"
+# Token = "SA_PCIE_ASPM_IN_DXE" "=" "1"
+End
+
+PATH
+ Name = "SaPcieDxeLib_DIR"
+ Help = "SaPcieDxeLib file source directory"
+End
+
+MODULE
+ File = "SaPcieDxeLib.mak"
+ Help = "Includes SaPcieDxeLib.mak to Project"
+End
+
+ELINK
+ Name = "SaPcieDxeLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\SaPcieDxeLib.lib"
+ Parent = "SaPcieDxeLib_LIB"
+ InvokeOrder = AfterParent
+End \ No newline at end of file
diff --git a/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Smm/SaPcieSmmLib.c b/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Smm/SaPcieSmmLib.c
new file mode 100644
index 0000000..5d44c9c
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Smm/SaPcieSmmLib.c
@@ -0,0 +1,94 @@
+/** @file
+ This is SMM library code used by Intel System Agent PCIe library
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "EfiScriptLib.h"
+
+/**
+ Wrapper for boot script with opcode EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE
+
+ @param[in] TableName - Desired boot script table
+ @param[in] Width - The width of the memory operations.
+ @param[in] Address - The base address of the memory operations.
+ @param[in] Count - The number of memory operations to perform.
+ @param[in] Buffer - The source buffer from which to write the data.
+
+ @retval EFI_SUCCESS - The operation was executed successfully
+**/
+EFI_STATUS
+SaScriptMemWrite (
+ IN UINT16 TableName,
+ IN EFI_BOOT_SCRIPT_WIDTH Width,
+ IN UINT64 Address,
+ IN UINTN Count,
+ IN VOID *Buffer
+)
+{
+ return EFI_SUCCESS;
+}
+
+/**
+ Wrapper for boot script with opcode EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE
+
+ @param[in] TableName - Desired boot script table
+ @param[in] Width - The width of the memory operations.
+ @param[in] Address - The base address of the memory operations.
+ @param[in] Data - A pointer to the data to be OR-ed.
+ @param[in] DataMask - A pointer to the data mask to be AND-ed with the data read from the register.
+
+ @retval EFI_SUCCESS - The operation was executed successfully
+**/
+EFI_STATUS
+SaScriptMemReadWrite (
+ IN UINT16 TableName,
+ IN EFI_BOOT_SCRIPT_WIDTH Width,
+ IN UINT64 Address,
+ IN VOID *Data,
+ IN VOID *DataMask
+)
+{
+ return EFI_SUCCESS;
+}
+
+/**
+ Wrapper for boot script for Polling one memory mapping register
+
+ @param[in] TableName - Desired boot script table
+ @param[in] Width - The width of the memory operations.
+ @param[in] Address - The base address of the memory operations.
+ @param[in] BitMask - A pointer to the bit mask to be AND-ed with the data read from the register.
+ @param[in] BitValue - A pointer to the data value after to be Masked.
+ @param[in] Duration - Duration in microseconds of the stall.
+ @param[in] LoopTimes - The times of the register polling.
+
+ @retval EFI_SUCCESS - The operation was executed successfully
+**/
+EFI_STATUS
+SaScriptMemPoll (
+ IN UINT16 TableName,
+ IN EFI_BOOT_SCRIPT_WIDTH Width,
+ IN UINT64 Address,
+ IN VOID *BitMask,
+ IN VOID *BitValue,
+ IN UINTN Duration,
+ IN UINTN LoopTimes
+ )
+{
+ return EFI_SUCCESS;
+} \ No newline at end of file
diff --git a/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Smm/SaPcieSmmLib.cif b/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Smm/SaPcieSmmLib.cif
new file mode 100644
index 0000000..9fa9ac2
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Smm/SaPcieSmmLib.cif
@@ -0,0 +1,11 @@
+<component>
+ name = "SaPcieSmmLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\SystemAgent\Library\SaPcieLib\Smm\"
+ RefName = "SaPcieSmmLib"
+[files]
+"SaPcieSmmLib.sdl"
+"SaPcieSmmLib.mak"
+"SaPcieSmmLib.c"
+"SaPcieSmmLib.inf"
+<endComponent>
diff --git a/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Smm/SaPcieSmmLib.inf b/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Smm/SaPcieSmmLib.inf
new file mode 100644
index 0000000..97c4c12
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Smm/SaPcieSmmLib.inf
@@ -0,0 +1,63 @@
+## @file
+# Component description file for the SA PCIE library
+#
+#@copyright
+# Copyright (c) 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = SaPcieSmmLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ ../Common/SaPcieLib.h
+ ../Common/SaPcieLib.c
+ SaPcieSmmLib.c
+
+[includes.common]
+ .
+ $(EDK_SOURCE)/Foundation/Library/Pei/Include
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Library/SaPcieLib/Smm
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include/Library
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[libraries.common]
+ EdkIIGlueBasePciLibPciExpress
+
+[nmake.common]
+C_FLAGS = $(C_FLAGS)
+C_STD_INCLUDE=
+
+
diff --git a/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Smm/SaPcieSmmLib.mak b/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Smm/SaPcieSmmLib.mak
new file mode 100644
index 0000000..4d18c76
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Smm/SaPcieSmmLib.mak
@@ -0,0 +1,50 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#---------------------------------------------------------------------------
+# Create SaPcieSmmLib Driver
+#---------------------------------------------------------------------------
+
+# MAK file for the ModulePart:SaPcieSmmLib
+EDK : SaPcieSmmLib
+
+SaPcieSmmLib : $(BUILD_DIR)\SaPcieSmmLib.mak SaPcieSmmLibBin
+
+$(BUILD_DIR)\SaPcieSmmLib.mak : $(SaPcieSmmLib_DIR)\$(@B).cif $(SaPcieSmmLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(SaPcieSmmLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+$(SaPcieSmmLib_LIB) : SaPcieSmmLib
+
+SaPcieSmmLib_DEFINES = \
+ $(CFLAGS) \
+
+SaPcieSmmLibBin: $(SaPcieLib_LIB)
+ $(MAKE) /$(MAKEFLAGS) $(EDK_DEFAULTS) \
+ /f $(BUILD_DIR)\SaPcieSmmLib.mak all \
+ "CFLAGS=$(SaPcieSmmLib_DEFINES)"\
+ TYPE=LIBRARY LIBRARIES= \
+ LIBRARY_NAME=$(SaPcieSmmLib_LIB)
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Smm/SaPcieSmmLib.sdl b/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Smm/SaPcieSmmLib.sdl
new file mode 100644
index 0000000..5641512
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Library/SaPcieLib/Smm/SaPcieSmmLib.sdl
@@ -0,0 +1,34 @@
+TOKEN
+ Name = "SaPcieSmmLib_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable SaPcieSmmLib support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+ Token = "SaPcieLib_SUPPORT" "=" "1"
+# Token = "SA_PCIE_ASPM_IN_SMM" "=" "1"
+End
+
+
+PATH
+ Name = "SaPcieSmmLib_DIR"
+ Help = "SaPcieSmmLib file source directory"
+End
+
+MODULE
+ File = "SaPcieSmmLib.mak"
+ Help = "Includes SaPcieSmmLib.mak to Project"
+End
+
+ELINK
+ Name = "SaPcieSmmLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\SaPcieSmmLib_Lib.lib"
+ Parent = "SaPcieSmmLib_LIB"
+ InvokeOrder = AfterParent
+End \ No newline at end of file
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MemInfoHob.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MemInfoHob.h
new file mode 100644
index 0000000..0ce1f90
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MemInfoHob.h
@@ -0,0 +1,103 @@
+/** @file
+ This file contains definitions required for creation of
+ Memory Info hob.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+**/
+
+///
+/// @todo: Delete #define's and use definitions from SaCommonDefitions.h
+///
+#ifndef _MEM_HOB_H_
+#define _MEM_HOB_H_
+#pragma pack (push, 1)
+
+#include "MrcGlobal.h"
+
+#define EFI_MEMORY_RESTORE_DATA_GUID \
+ {0x87f22dcb,0x7304,0x4105,0xbb,0x7c,0x31,0x71,0x43,0xcc,0xc2,0x3b }
+
+#define MAX_NODE 1
+#define MAX_CH 2
+#define MAX_DIMM 2
+
+#define DDR3_FREQ_AUTO 0
+#define DDR3_FREQ_800 1
+#define DDR3_FREQ_1000 2
+#define DDR3_FREQ_1067 3
+#define DDR3_FREQ_1200 4
+#define DDR3_FREQ_1333 5
+#define DDR3_FREQ_1400 6
+#define DDR3_FREQ_1600 7
+#define DDR3_FREQ_1800 8
+#define DDR3_FREQ_1867 9
+#define DDR3_FREQ_2000 10
+#define DDR3_FREQ_2133 11
+#define DDR3_FREQ_2200 12
+#define DDR3_FREQ_2400 13
+#define DDR3_FREQ_2600 14
+#define DDR3_FREQ_2667 15
+
+///
+/// Host reset states from MRC.
+///
+#define WARM_BOOT 2
+
+#define MCPciD4F0RegBase PCIEX_BASE_ADDRESS + (UINT32) (((PCIEX_LENGTH >> 20) - 1) << 20) + (UINT32) (4 << 15) + (UINT32) (0 << 12)
+#define MCPciD5F0RegBase PCIEX_BASE_ADDRESS + (UINT32) (((PCIEX_LENGTH >> 20) - 1) << 20) + (UINT32) (5 << 15) + (UINT32) (0 << 12)
+
+#define R_MC_CHNL_RANK_PRESENT 0x7C
+#define B_RANK0_PRS BIT0
+#define B_RANK1_PRS BIT1
+#define B_RANK2_PRS BIT4
+#define B_RANK3_PRS BIT5
+
+#ifndef _PEI_HOB_H_
+#ifndef __HOB__H__
+typedef struct _EFI_HOB_GENERIC_HEADER {
+ UINT16 HobType;
+ UINT16 HobLength;
+ UINT32 Reserved;
+} EFI_HOB_GENERIC_HEADER;
+
+typedef struct _EFI_HOB_GUID_TYPE {
+ EFI_HOB_GENERIC_HEADER Header;
+ EFI_GUID Name;
+ ///
+ /// Guid specific data goes here
+ ///
+} EFI_HOB_GUID_TYPE;
+#endif
+#endif
+///
+/// HOB to save MRC Output data and Memory S3_RestoreData
+///
+#define MRC_HOB_SIZE_TOTAL (63 * 1024)
+#if ((defined SSA_FLAG) || (defined MRC_DEBUG_PRINT))
+#define MRC_HOB_SIZE_BUFFER (MRC_HOB_SIZE_TOTAL - sizeof (EFI_HOB_GUID_TYPE) - sizeof (MrcParameters))
+#else
+#define MRC_HOB_SIZE_BUFFER (1)
+#endif
+typedef struct {
+ EFI_HOB_GUID_TYPE EfiHobGuidType;
+ MrcParameters MrcData;
+ UINT8 Buffer[MRC_HOB_SIZE_BUFFER];
+} HOB_SAVE_MEMORY_DATA;
+
+#pragma pack (pop)
+#endif \ No newline at end of file
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MemoryInit.c b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MemoryInit.c
new file mode 100644
index 0000000..2dbc444
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MemoryInit.c
@@ -0,0 +1,2722 @@
+/** @file
+ Memory Initialization PEIM.
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+**/
+
+#include "CpuIA32.h"
+#include "EdkIIGluePeim.h"
+#include "SaAccess.h"
+#include "MemInfoHob.h"
+#include "MemoryInit.h"
+#include "MrcDebugHook.h"
+#include "MrcOemDebugPrint.h"
+#include "MrcOemIo.h"
+#include "MrcOemPlatform.h"
+#include "MrcSaveRestore.h"
+#include "MrcSpdDriver.h"
+#include "McGdxcbar.h"
+#include "CpuRegs.h"
+#include "CpuPlatformLib.h"
+#include "MrcCommon.h"
+#include "TxtLibrary.h"
+#include "PttHciRegs.h"
+
+// The next extern is temporary, including MrcCommon.h causes compile problems.
+extern
+MrcFrequency
+MrcGetCurrentMemoryFrequency (
+ MrcParameters * const MrcData,
+ U32 * const MemoryClock,
+ MrcClockRatio * const Ratio,
+ MrcRefClkSelect * const RefClk
+ );
+
+//
+// Driver Dependent PPI Prototypes
+//
+#include EFI_PPI_DEPENDENCY (BaseMemoryTest)
+#include EFI_PPI_DEPENDENCY (Capsule)
+#include EFI_PPI_DEPENDENCY (PlatformMemoryRange)
+#include EFI_PPI_DEPENDENCY (PlatformMemorySize)
+#include EFI_PPI_DEPENDENCY (SaPlatformPolicy)
+#include EFI_PPI_DEPENDENCY (CpuPlatformPolicy)
+#include EFI_GUID_DEFINITION (TxtInfoHob)
+#include EFI_PPI_DEPENDENCY (Stall)
+#include EFI_PPI_DEPENDENCY (Variable)
+#include EFI_PPI_CONSUMER (Wdt)
+
+//
+// Driver Consumed GUID
+//
+#include EFI_GUID_DEFINITION (AcpiVariable)
+#include EFI_GUID_DEFINITION (MemoryTypeInformation)
+#include EFI_GUID_DEFINITION (SmramMemoryReserve)
+//#ifdef MRC_DEBUG_PRINT
+//#include EFI_GUID_DEFINITION (GlobalVariable)
+//#include EFI_PPI_DEFINITION (DebugMask)
+//#endif // MRC_DEBUG_PRINT
+
+//
+// Driver PPI Definitions
+//
+#ifdef RAPID_START_FLAG
+#include EFI_PPI_DEFINITION (RapidStart)
+#include "RapidStartCommonLib.h"
+#include "RapidStartPeiLib.h"
+#include EFI_PPI_CONSUMER (PchReset)
+#endif // RAPID_START_FLAG
+#include EFI_PPI_DEFINITION (PchInit)
+#include EFI_PPI_DEFINITION (PchMeUma)
+#include "PchMeUma.h"
+#if 0//def MRC_DEBUG_PRINT
+#include "DebugMask.h"
+#endif
+
+#ifndef AMI_OVERRIDE_FOR_NOTIFY_MRC
+#define __HOB__H__
+#include <Ppi\NBPPI.h>
+#endif // AMI_OVERRIDE_FOR_NOTIFY_MRC
+
+//
+// Driver GUID Definitions
+//
+EFI_GUID gMemRestoreDataGuid = EFI_MEMORY_RESTORE_DATA_GUID;
+EFI_GUID gPeiCapsulePpiGuid = PEI_CAPSULE_PPI_GUID;
+EFI_GUID gEfiAcpiVariableGuid = EFI_ACPI_VARIABLE_GUID;
+#if 0//def MRC_DEBUG_PRINT
+EFI_GUID gEfiGenericVariableGuid = EFI_GENERIC_VARIABLE_GUID;
+#endif
+
+
+#ifdef MRC_DEBUG_PRINT
+const UINT8 BootStringFc[] = "BOOT_WITH_FULL_CONFIGURATION";
+const UINT8 BootStringMc[] = "BOOT_WITH_MINIMAL_CONFIGURATION";
+const UINT8 BootStringNc[] = "BOOT_ASSUMING_NO_CONFIGURATION_CHANGES";
+const UINT8 BootStringFcd[] = "BOOT_WITH_FULL_CONFIGURATION_PLUS_DIAGNOSTICS";
+const UINT8 BootStringDs[] = "BOOT_WITH_DEFAULT_SETTINGS";
+const UINT8 BootStringS4[] = "BOOT_ON_S4_RESUME";
+const UINT8 BootStringS5[] = "BOOT_ON_S5_RESUME";
+const UINT8 BootStringS2[] = "BOOT_ON_S2_RESUME";
+const UINT8 BootStringS3[] = "BOOT_ON_S3_RESUME";
+const UINT8 BootStringFu[] = "BOOT_ON_FLASH_UPDATE";
+const UINT8 BootStringRm[] = "BOOT_IN_RECOVERY_MODE";
+const UINT8 BootStringRmm[] = "BOOT_IN_RECOVERY_MODE_MASK";
+const UINT8 BootStringSm[] = "BOOT_SPECIAL_MASK";
+const UINT8 BootStringUnk[] = "BOOT_MODE_UNKNOWN";
+#endif
+
+#ifndef AMI_OVERRIDE_FOR_NOTIFY_MRC
+static EFI_PEI_PPI_DESCRIPTOR mAmiPeiBeforeMrcDesc[] = {
+ { (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), \
+ &gAmiPeiBeforeMrcGuid, \
+ NULL }
+};
+
+static EFI_PEI_PPI_DESCRIPTOR mAmiPeiCompelteMrcDesc[] = {
+ { (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), \
+ &gAmiPeiAfterMrcGuid, \
+ NULL }
+};
+
+static EFI_PEI_PPI_DESCRIPTOR mAmiPeiEndOfMrcDesc[] = {
+ { (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), \
+ &gAmiPeiEndOfMemDetectGuid, \
+ NULL }
+};
+#endif // AMI_OVERRIDE_FOR_NOTIFY_MRC
+
+EFI_PEIM_ENTRY_POINT (PeimMemoryInit);
+
+/**
+ Main starting point for system memory initialization.
+ 1. Get SysBootMode and MrcBootMode
+ 2. Locate SaPlatformPolicy PPI
+ 3. Locate S3DataPtr from SaPlatformPolicy.
+ 4. SaveDataValid := TRUE if S3DataPtr is not NULL.
+ 5. If SysBootMode is BOOT_ON_S3_RESUME and S3Data is not valid:
+ -> ASSERT.
+ 6. If MrcBootMode is Warm boot, but S3 data is not valid :
+ -> change MrcBootMode to Cold boot.
+ 7. If MrcBootMode is Cold boot:
+ -> Run MRC code
+ -> Save S3 Restore Data
+ Else
+ -> Run MRC_S3Resume
+ 8. Run MRC_Done().
+ 9. Install EFI memory HOBs.
+
+ @param[in] FfsHeader - Not used.
+ @param[in] PeiServices - General purpose services available to every PEIM.
+
+ @retval EFI_SUCCESS - Memory initialization completed successfully.
+ @retval EFI_NOT_READY - Cannot locate SA Platform Policy.
+ @retval EFI_NOT_FOUND - No S3 data in S3 Boot Mode.
+ @retval EFI_DEVICE_ERROR - MemoryInit failed or IOSAV Memory test failed.
+**/
+EFI_STATUS
+PeimMemoryInit (
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ PEI_READ_ONLY_VARIABLE_PPI *VariableServices;
+ SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi;
+ HOB_SAVE_MEMORY_DATA *Hob;
+ MrcParameters *MrcData;
+ MrcInput *Inputs;
+ MrcOutput *Outputs;
+ SysSave *SaveSys;
+ MrcSave *Save;
+ MrcCpuModel CpuModel;
+ MrcCpuStepping CpuStep;
+ UINT32 CpuModelStep;
+ BOOLEAN CpuDetected;
+ MrcParameters MrcGlobalData;
+ EFI_STATUS Status;
+ EFI_BOOT_MODE SysBootMode;
+ MrcStatus MrcStatus;
+ MrcBootMode MrcBootMode;
+ MrcVersion Version;
+ BOOLEAN SaveDataValid;
+ UINT32 Crc32;
+ UINT64 SskpdValue;
+#ifdef MRC_DEBUG_PRINT
+ MrcDebug *Debug;
+ const UINT8 *Str;
+#endif
+ PCH_ME_UMA_PPI *PchMeUma;
+ UINT8 InitStat;
+ UINT8 ForceFullTraining;
+ UINT8 OrigMrcBootMode;
+#ifdef RAPID_START_FLAG
+ PCH_RESET_PPI *PchResetPpi;
+ RAPID_START_PPI *RapidStartPpi;
+#endif
+ UINT8 TotalDprSizeMB;
+ UINT32 MemoryClock;
+ MrcClockRatio Ratio;
+ MrcUpmPwrRetrainLimits RetrainLimits[MRC_NUMBER_UPM_PWR_RETRAIN_MARGINS];
+
+ MrcData = &MrcGlobalData;
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ ZeroMem (MrcData, sizeof (MrcParameters));
+ Outputs->UpmPwrRetrainLimits.Pointer = RetrainLimits;
+ MrcOemMemoryCpy (
+ (U8 *) RetrainLimits,
+ (U8 *) InitialLimits,
+ sizeof (MrcUpmPwrRetrainLimits) * MRC_NUMBER_UPM_PWR_RETRAIN_MARGINS
+ );
+
+ //;;## ...AMI_OVERRIDE... Notify BeforeMrc
+ // Install the NB Before Mrc Notify PPI
+ Status = (*PeiServices)->InstallPpi(PeiServices, &mAmiPeiBeforeMrcDesc[0]);
+ ASSERT_EFI_ERROR (Status);
+ //;;## ...AMI_OVERRIDE... Notify BeforeMrc end
+
+ //
+ // Obtain boot mode.
+ //
+ Status = (*PeiServices)->GetBootMode (PeiServices, &SysBootMode);
+ ASSERT_EFI_ERROR (Status);
+
+ if (SysBootMode != BOOT_ON_S3_RESUME) {
+ Status = MrcGetHobForDataStorage (PeiServices, &Hob, sizeof (HOB_SAVE_MEMORY_DATA));
+ ASSERT_EFI_ERROR (Status);
+ } else {
+ Hob = 0;
+ }
+
+#ifdef SSA_FLAG
+ Status = (**PeiServices).LocatePpi (PeiServices, &gSsaBiosCallBacksPpiGuid, 0, NULL, (VOID **) &Inputs->SsaCallbackPpi);
+ if (EFI_SUCCESS != Status) {
+ Inputs->SsaCallbackPpi = 0;
+ }
+ Inputs->Debug.Stream = (U32) PeiServices;
+ Inputs->SsaHeapBase = (U32) &Hob->MrcData;
+ Inputs->SsaHeapSize = MRC_HOB_SIZE_TOTAL - sizeof (EFI_HOB_GUID_TYPE);
+ PEI_DEBUG (((void *) PeiServices, EFI_D_ERROR, "SsaCallbackPpi = %Xh\n", Inputs->SsaCallbackPpi));
+ PEI_DEBUG (((void *) PeiServices, EFI_D_ERROR, "SSA heap. Base = %Xh, Size = %d\n", Inputs->SsaHeapBase, Inputs->SsaHeapSize));
+#endif // SSA_FLAG
+
+ //
+ // Obtain platform policy settings.
+ //
+ Status = (**PeiServices).LocatePpi (PeiServices, &gSaPlatformPolicyPpiGuid, 0, NULL, (VOID **) &SaPlatformPolicyPpi);
+ ASSERT_EFI_ERROR (Status);
+
+ MrcOemDebugHook (MrcData, MRC_INITIALIZATION_START);
+#ifdef MRC_DEBUG_PRINT
+ Debug = &Inputs->Debug;
+#endif
+
+ MRC_DEBUG_MSG_OPEN (
+ Debug,
+ (SaPlatformPolicyPpi->MemConfig->MrcTimeMeasure > 0) ? MSG_LEVEL_TIME : SaPlatformPolicyPpi->MemConfig->SerialDebug,
+ (U32) PeiServices,
+ (SysBootMode == BOOT_ON_S3_RESUME) ? 0 : (U32) &Hob->MrcData,
+ (SysBootMode == BOOT_ON_S3_RESUME) ? 0 : (MRC_HOB_SIZE_TOTAL - sizeof (EFI_HOB_GUID_TYPE))
+ );
+
+ InitStat = 0;
+ ForceFullTraining = 0;
+
+ MrcStatus = mrcSuccess;
+
+ //
+ // Obtain variable services.
+ //
+ Status = (*PeiServices)->LocatePpi (PeiServices, &gPeiReadOnlyVariablePpiGuid, 0, NULL, (VOID **) &VariableServices);
+ ASSERT_EFI_ERROR (Status);
+
+#ifndef TXT_SUPPORT_FLAG
+ //
+ // Unlock memory if it is necessary.
+ //
+ UnlockMemory (MrcData, PeiServices);
+#endif // TXT_SUPPORT_FLAG
+
+ //
+ // Get MRC BootMode
+ //
+ MrcBootMode = (SysBootMode == BOOT_ON_S3_RESUME) ? bmS3 : MrcGetBootMode ();
+
+#ifdef MRC_DEBUG_PRINT
+ if ((SysBootMode == BOOT_ON_S3_RESUME) && (bmCold == MrcGetBootMode ())) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "SysBootMode = %Xh and MrcBootMode = %d - Check PCH SR bit\n",
+ SysBootMode,
+ MrcBootMode
+ );
+ }
+#endif // MRC_DEBUG_PRINT
+
+#ifdef RAPID_START_FLAG
+ //
+ // Locate RapidStart PPI
+ //
+ Status = (*PeiServices)->LocatePpi (PeiServices, &gRapidStartPpiGuid, 0, NULL, &RapidStartPpi);
+ ASSERT_EFI_ERROR (Status);
+#endif // RAPID_START_FLAG
+
+ MrcVersionGet (&Version);
+ MrcVersionPrint (MrcData, &Version);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nSystem boot mode = %Xh\n", SysBootMode);
+#ifdef MRC_DEBUG_PRINT
+ switch (SysBootMode) {
+ case BOOT_WITH_FULL_CONFIGURATION: Str = BootStringFc; break;
+ case BOOT_WITH_MINIMAL_CONFIGURATION: Str = BootStringMc; break;
+ case BOOT_ASSUMING_NO_CONFIGURATION_CHANGES: Str = BootStringNc; break;
+ case BOOT_WITH_FULL_CONFIGURATION_PLUS_DIAGNOSTICS: Str = BootStringFcd; break;
+ case BOOT_WITH_DEFAULT_SETTINGS: Str = BootStringDs; break;
+ case BOOT_ON_S4_RESUME: Str = BootStringS4; break;
+ case BOOT_ON_S5_RESUME: Str = BootStringS5; break;
+ case BOOT_ON_S2_RESUME: Str = BootStringS2; break;
+ case BOOT_ON_S3_RESUME: Str = BootStringS3; break;
+ case BOOT_ON_FLASH_UPDATE: Str = BootStringFu; break;
+ case BOOT_IN_RECOVERY_MODE: Str = BootStringRm; break;
+ case BOOT_IN_RECOVERY_MODE_MASK: Str = BootStringRmm; break;
+ case BOOT_SPECIAL_MASK: Str = BootStringSm; break;
+ default: Str = BootStringUnk; break;
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nSystem boot mode = %s\n", Str);
+#endif //MRC_DEBUG_PRINT
+
+ //
+ // Locate and determine if memory configuration save data is valid.
+ //
+ SaveDataValid = FALSE;
+ if ((SaPlatformPolicyPpi->S3DataPtr != NULL) && (SysBootMode != BOOT_WITH_DEFAULT_SETTINGS)) {
+ SaveSys = (SysSave *) (SaPlatformPolicyPpi->S3DataPtr);
+ Save = &SaveSys->Save;
+ Crc32 = MrcCalculateCrc32 ((U8 *) (&Save->Data), sizeof (MrcSaveData));
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Calc. crc = 0x%x, Header crc = 0x%x\n", Crc32, Save->Header.Crc);
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "S3DataPtr = 0x%x - &MrcData = 0x%x - sizeof (MrcParameters) = 0x%x\n",
+ SaPlatformPolicyPpi->S3DataPtr,
+ &MrcData,
+ sizeof (MrcParameters)
+ );
+
+ if (Crc32 == Save->Header.Crc) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Saved memory configuration data is valid\n");
+ ((*PeiServices)->CopyMem) ((VOID *) &MrcData->SysSave, (VOID *) SaveSys, sizeof (SysSave));
+ SaveDataValid = TRUE;
+ }
+ }
+
+ //
+ // We must have memory configuration save data in order to resume from S3.
+ //
+ if ((SysBootMode == BOOT_ON_S3_RESUME) && (!SaveDataValid)) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "Unable to resume from S3 without valid saved memory configuration data\n");
+ PEI_ASSERT (PeiServices, FALSE);
+ return EFI_NOT_FOUND;
+ }
+
+ //
+ // Locate PchMeUma PPI.
+ //
+ Status = (*PeiServices)->LocatePpi (PeiServices, &gPchMeUmaPpiGuid, 0, NULL, &PchMeUma);
+ ASSERT_EFI_ERROR (Status);
+
+ if (MrcBootMode != bmS3 && MrcBootMode != bmWarm) {
+ //
+ // Check CPU Replaced Status, if so a system non-power cycle reset will be required.
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Calling CpuReplacementCheck\n");
+ Status = PchMeUma->CpuReplacementCheck(PeiServices, FfsHeader, &ForceFullTraining);
+
+ if (ForceFullTraining == 0x1) {
+ SaveDataValid = FALSE;
+ }
+ }
+
+ // Keep track of the original MRC Boot mode before an alternate flow is determined below.
+ OrigMrcBootMode = MrcBootMode;
+
+ CpuModel = GetCpuFamily();
+ CpuStep = GetCpuStepping();
+ CpuModelStep = CpuModel | CpuStep;
+ CpuDetected = (MrcSetCpuInformation (MrcData, CpuModel, CpuStep) == mrcSuccess) ? TRUE : FALSE;
+
+ if (!CpuDetected) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "ERROR: CPU Family/Model/Step %Xh is not supported:\n", CpuModelStep);
+ ASSERT_EFI_ERROR (EFI_DEVICE_ERROR);
+ }
+
+ //
+ // MrcBootMode can ONLY be bmCold, bmWarm or bmS3 at this point.
+ //
+ switch (MrcBootMode) {
+ case bmCold:
+ // Advance the MRC boot mode to fast boot if the following condition is met.
+ if ((SaveDataValid == TRUE) &&
+ (SaPlatformPolicyPpi->MemConfig->MrcFastBoot > 0) &&
+ (ColdBootRequired (MrcData, SaPlatformPolicyPpi)) == FALSE) {
+ MrcBootMode = bmFast;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Fast boot is possible, so forcing it\n");
+ }
+ else {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Cold boot\n");
+ SaveDataValid = FALSE;
+ }
+ break;
+
+ case bmWarm:
+ case bmS3:
+ if (SaveDataValid == FALSE) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_WARNING, "Saved memory configuration data is not valid, forcing a cold boot\n");
+ MrcBootMode = bmCold;
+ break;
+ } else {
+ if (ColdBootRequired (MrcData, SaPlatformPolicyPpi) == TRUE) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_WARNING,
+ "Platform settings or configuration have changed, forcing a cold boot\n"
+ );
+ MrcBootMode = bmCold;
+ SaveDataValid = FALSE;
+ break;
+ }
+ //
+ // Check SSKPD register to determine if Warm Reset occured before MRC was reached during a cold boot.
+ // If so, we need to force the cold boot path.
+ //
+ MrcOemMmioRead64 (PCU_CR_SSKPD_PCU_REG, &SskpdValue, SaPlatformPolicyPpi->PlatformData->MchBar);
+ if ((SskpdValue == 0) && (MrcBootMode == bmWarm)) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_WARNING,
+ "Reset occured in the cold boot path before reaching MRC. Forcing Cold Boot\n"
+ );
+ MrcBootMode = bmCold;
+ SaveDataValid = FALSE;
+ break;
+ }
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s\n", (MrcBootMode == bmS3) ? "Resume from S3" : "Warm reset");
+ break;
+
+ default:
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Cold boot\n");
+ MrcBootMode = bmCold;
+ SaveDataValid = FALSE;
+ break;
+ }
+
+ //
+ // Clear MrcSave if not valid saved data. We don't want to end up with Ghost DIMMs
+ //
+ if (SaveDataValid == FALSE) {
+ ZeroMem (&MrcData->SysSave.Save, sizeof (MrcSave));
+ }
+
+#ifdef MRC_DEBUG_PRINT
+ ((*PeiServices)->CopyMem) ((VOID *) &MrcData->SysIn.Inputs.Debug, Debug, sizeof (MrcDebug));
+ Debug = &Inputs->Debug;
+#endif // MRC_DEBUG_PRINT
+
+ //
+ //Calculate Total DPR Size
+ //
+ CalculateTotalDprMemorySize (PeiServices, &TotalDprSizeMB);
+
+ if(TotalDprSizeMB != 0){
+ Inputs->DprSize = (U32) TotalDprSizeMB;
+ }
+
+ //
+ // Set up the MRC input data structure.
+ //
+ Inputs->BootMode = MrcSetupMrcData (SysBootMode, MrcBootMode, Inputs, PeiServices, SaPlatformPolicyPpi);
+
+ //
+ // Initialize MeStolenSize to 0 before we retrieving from ME FW.
+ //
+ Inputs->MeStolenSize = 0;
+
+#ifdef RAPID_START_FLAG
+ if ((SysBootMode != BOOT_ON_S3_RESUME) && (RapidStartPpi->GetMode (RapidStartPpi) == RapidStartExit)) {
+ //
+ // Need to erase whole memory for Rapid Start Resume
+ //
+ Inputs->OemCleanMemory = TRUE;
+ }
+#endif // RAPID_START_FLAG
+
+ //
+ // ME Stolen Size in MB units
+ //
+ DEBUG ((EFI_D_ERROR, "Calling MeSendUmaSize\n"));
+ Inputs->MeStolenSize = PchMeUma->MeSendUmaSize (PeiServices, FfsHeader);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "ME UMA size = %u MB\n", Inputs->MeStolenSize);
+
+ do {
+ if (Inputs->BootMode == bmCold) {
+ //
+ // Clear DRAM Init Bit if we are doing a cold boot, to prevent hang if a warm reset occurs in the training flow
+ // where an old memory config is saved.
+ //
+ MrcResetDISB ();
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "MRC Start Memory Configuration\n");
+ MrcStatus = MrcStartMemoryConfiguration (MrcData);
+
+ switch (MrcStatus) {
+ case mrcSuccess:
+ break;
+
+ case mrcRetrain:
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "Rerunning training with higher UPM/PWR limits!\n");
+ ZeroMem (Outputs, sizeof (MrcOutput));
+ Outputs->UpmPwrRetrainLimits.Pointer = RetrainLimits;
+ Inputs->Iteration++;
+ break;
+
+ case mrcFrequencyError:
+ MrcGetCurrentMemoryFrequency (MrcData, &MemoryClock, &Ratio, NULL);
+ if (Ratio >= Outputs->Ratio) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "Memory initialization has failed\n");
+ //
+ // Get lower byte and set the error bit
+ //
+#ifndef AMI_OVERRIDE_FOR_MRC_ERROR_REPORT
+ MrcOemDebugHook (MrcData, MrcOemInPort8 (0x80) | MRC_FAILURE_INDICATION);
+#else
+ MrcOemOutPort8 (0x80, MrcOemInPort8 (0x80) | MRC_FAILURE_INDICATION);
+#endif
+ ASSERT_EFI_ERROR (EFI_DEVICE_ERROR);
+ return EFI_DEVICE_ERROR;
+ } else {
+ // Restart memory configuration, using the lower frequency.
+ MrcStatus = mrcColdBootRequired;
+ }
+ // no break;
+
+ case mrcColdBootRequired:
+ if (Inputs->BootMode == bmFast) {
+ // At this point, input structure has limited data.
+ // We need to initialize the input structure for the cold boot.
+ Inputs->BootMode = MrcSetupMrcData (SysBootMode, bmCold, Inputs, PeiServices, SaPlatformPolicyPpi);
+ } else {
+ Inputs->BootMode = bmCold;
+ }
+ break;
+
+ case mrcDimmNotExist:
+ //
+ // Set memory init status = 0x1 and send DRAM Init Done to ME FW,
+ // indicating that no memory exists in the system.
+ //
+ InitStat = 0x1;
+ Status = PchMeUma->MeConfigDidReg (PeiServices, FfsHeader, MrcBootMode, InitStat, Outputs->MemoryMapData.FtpmStolenBase, Inputs->MeStolenSize);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "FtpmStolenBase = 0x%08X \n", Outputs->MemoryMapData.FtpmStolenBase);
+ MrcOemDebugHook (MrcData, MRC_NO_MEMORY_DETECTED);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "There are no DIMMs present in the system\n");
+ //
+ //Indicate to the caller that memory has not been detected.
+ //
+ (*PeiServices)->PeiReportStatusCode (
+ PeiServices,
+ EFI_ERROR_CODE,
+ EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_NONE_DETECTED,
+ 0,
+ NULL,
+ NULL
+ );
+ // no break;
+
+ default:
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "Memory initialization has failed\n");
+ //
+ // Get lower byte and set the error bit
+ //
+#ifndef AMI_OVERRIDE_FOR_MRC_ERROR_REPORT
+ MrcOemDebugHook (MrcData, MrcOemInPort8 (0x80) | MRC_FAILURE_INDICATION);
+#else
+ MrcOemOutPort8 (0x80, MrcOemInPort8 (0x80) | MRC_FAILURE_INDICATION);
+#endif
+ ASSERT_EFI_ERROR (EFI_DEVICE_ERROR);
+ return EFI_DEVICE_ERROR;
+ }
+ } while ((MrcStatus == mrcColdBootRequired) || (MrcStatus == mrcRetrain));
+
+ //
+ // Intel Silicon View Technology (ISVT) IO Reading port 0x84 with AH = 1 for End of MRC
+ //
+#if defined __GNUC__ // GCC compiler
+ __asm__ __volatile__ (
+ "\n\t mov $0x100, %eax"
+ "\n\t in $0x84, %al"
+ );
+#else //MSFT compiler
+ ASM {
+ mov EAX, 100h
+ in AL, 84h
+ }
+#endif
+
+ //
+ // Configure "ME DRAM Init Done Register"
+ //
+ //
+ // ME UMA Size outside of a 0MB-32MB range is not defined or if BDF 0:22:0 is not present, exit.
+ //
+#ifdef RAPID_START_FLAG
+ //
+ // Check wake conditions to determine if a Rapid Start transition is to be performed
+ // and set the RapidStart flag in DID.
+ //
+ if (RapidStartPpi->GetMode (RapidStartPpi) != RapidStartNone) {
+ InitStat |= 0x80;
+ }
+#endif // RAPID_START_FLAG
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Check for Memory Retrain on warm reset -- MrcBootMode=0x%02X OrigBootMode=0x%02X\n", MrcBootMode, OrigMrcBootMode);
+ // On warm reset if memory coherency was not maintained (forced Cold Reset flow), set the DID message
+ // to indicate that memory was not preserved across reset, so that ME will reload the FW from NV memory.
+ if (bmWarm == OrigMrcBootMode && bmCold == MrcBootMode) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Memory retrain occurred during warm reset. Force ME FW reload.\n");
+ // Set the flag to tell FW that memory was not maintained InitStat bits 3:0 = (3).
+ InitStat = (InitStat & 0xF0) | 0x3;
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "ME UMA Size requested: %d MB\n", Inputs->MeStolenSize);
+ if ((Inputs->MeStolenSize > 0x20) || (PchD22PciCfg32 (0x10) == 0xffffffff)) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "Invalid ME UMA Size requested.\n");
+ } else {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Calling MeConfigDidReg\n");
+ Status = PchMeUma->MeConfigDidReg (PeiServices, FfsHeader, MrcBootMode, InitStat, Outputs->MemoryMapData.FtpmStolenBase,Inputs->MeStolenSize);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "MeDramInitDone Complete.\n");
+ }
+
+ //
+ // SATA must be initialized before Rapid Start transition.
+ //
+ //remove for PCH RC updated to V44, the code would be elimated if SA/MRC sync to V44 as well
+ // Status = PchInitPpi->SataInit (PeiServices);
+ // ASSERT_PEI_ERROR (PeiServices, Status);
+
+#ifdef RAPID_START_FLAG
+ //
+ // Perform Rapid Start transition if necessary (BootMode mode may change here!)
+ // Rapid Start requires MRC Fast boot to be enabled for best performance.
+ // In Rapid Start Resume flow if MRC boot mode is not bmFast that means memory
+ // configuration has changed and Rapid Start resume should be aborted.
+ //
+ if ((SaPlatformPolicyPpi->MemConfig->MrcFastBoot) && (RapidStartPpi->GetMode (RapidStartPpi) == RapidStartExit) && (Inputs->BootMode != bmFast)) {
+ DEBUG ((EFI_D_ERROR, "Memory Configuration changed! Rapid Start Resume is aborted!\n"));
+ RapidStartAfterTransition (PeiServices, RapidStartExit, EFI_MEDIA_CHANGED, 0);
+ Status = (*PeiServices)->LocatePpi (
+ PeiServices,
+ &gPchResetPpiGuid,
+ 0,
+ NULL,
+ &PchResetPpi
+ );
+ ASSERT_EFI_ERROR (Status);
+ PchResetPpi->Reset (PchResetPpi, PowerCycleReset);
+ } else {
+ RapidStartPpi->TransitionEntryPoint (RapidStartPpi, &SysBootMode);
+ }
+#endif // RAPID_START_FLAG
+
+#ifndef AMI_OVERRIDE_FOR_NOTIFY_MRC
+ // Install the NB End of Mrc Notify PPI
+ Status = (*PeiServices)->InstallPpi(PeiServices, &mAmiPeiCompelteMrcDesc[0]);
+ ASSERT_EFI_ERROR (Status);
+ DEBUG ((EFI_D_ERROR, "Install Complete MRC Ppi.\n"));
+#endif // AMI_OVERRIDE_FOR_NOTIFY_MRC
+#ifndef AMI_OVERRIDE_FOR_EIP102852
+ Status = (*PeiServices)->GetBootMode( PeiServices, &SysBootMode );
+#endif // AMI_OVERRIDE_FOR_EIP102852
+
+ //
+ // Install EFI memory HOBs
+ //
+ if (SysBootMode == BOOT_ON_S3_RESUME) {
+ Status = InstallS3Memory (Inputs, PeiServices, VariableServices);
+ ASSERT_EFI_ERROR (Status);
+ } else {
+ if ((MrcBootMode == bmCold) || (MrcBootMode == bmFast)) {
+ //
+ // Perform simple memory test.
+ //
+ if (mrcFail == BasicMemoryTest (Inputs)) {
+ MrcOemDebugHook (MrcData, MRC_MEM_INIT_DONE_WITH_ERRORS);
+ ASSERT_EFI_ERROR (EFI_DEVICE_ERROR);
+ return EFI_DEVICE_ERROR;
+ }
+ }
+ MrcData->SaveSize = sizeof (MrcSave);
+#ifdef MRC_DEBUG_PRINT
+ Debug->Current = 0;
+#endif // MRC_DEBUG_PRINT
+ ((*PeiServices)->CopyMem) ((VOID *) &Hob->MrcData, MrcData, sizeof (MrcParameters));
+ ZeroMem ((VOID *) &Hob->Buffer, MRC_HOB_SIZE_BUFFER);
+
+ Status = InstallEfiMemory (Inputs, PeiServices, SysBootMode);
+ ASSERT_EFI_ERROR (Status);
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "MemoryInit Complete.\n");
+ MrcOemDebugHook (MrcData, MRC_MEM_INIT_DONE);
+
+#ifndef AMI_OVERRIDE_FOR_NOTIFY_MRC
+ // Install the NB End of Mrc Notify PPI
+ Status = (*PeiServices)->InstallPpi(PeiServices, &mAmiPeiEndOfMrcDesc[0]);
+ ASSERT_EFI_ERROR (Status);
+#endif // AMI_OVERRIDE_FOR_NOTIFY_MRC
+
+ return Status;
+}
+
+/**
+ This function installs memory for all paths except S3 resume.
+
+ @param[in] Inputs - MRC input structure.
+ @param[in] PeiServices - PEI Services table.
+ @param[in] SysBootMode - The specific boot path that is being followed.
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_OUT_OF_RESOURCES Out of Resources.
+**/
+EFI_STATUS
+InstallEfiMemory (
+ IN const MrcInput *const Inputs,
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_BOOT_MODE SysBootMode
+ )
+{
+ EFI_STATUS Status;
+ UINT8 Index;
+ UINT8 NumRanges;
+ UINT8 SmramIndex;
+ UINT8 SmramRanges;
+ UINT64 PeiMemoryLength;
+ UINT64 RangeLength;
+ UINTN BufferSize;
+ UINTN CapsuleBufferLength;
+ UINTN PeiMemoryIndex;
+ UINTN RequiredMemSize;
+ VOID *CapsuleBuffer;
+ EFI_PEI_HOB_POINTERS Hob;
+ EFI_PHYSICAL_ADDRESS PeiMemoryBaseAddress;
+ EFI_PHYSICAL_ADDRESS TopUseableMemAddr;
+ EFI_PHYSICAL_ADDRESS TopUseableMemSize;
+ EFI_PHYSICAL_ADDRESS Tom;
+ PEI_MEMORY_TEST_OP MemoryTestOp;
+ PEI_BASE_MEMORY_TEST_PPI *BaseMemoryTestPpi;
+ PEI_CAPSULE_PPI *Capsule;
+ PEI_PLATFORM_MEMORY_SIZE_PPI *MemSize;
+ EFI_SMRAM_HOB_DESCRIPTOR_BLOCK *SmramHobDescriptorBlock;
+ EFI_SMRAM_DESCRIPTOR *SmramDescriptor;
+ PEI_DUAL_CHANNEL_DDR_MEMORY_MAP_RANGE MemoryMap[MAX_RANGES];
+ EFI_PHYSICAL_ADDRESS BadMemoryAddress;
+ EFI_RESOURCE_TYPE ResourceType;
+ EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute;
+ const MrcDebug *Debug;
+
+ Debug = &Inputs->Debug;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Install EFI memory.\n");
+
+ //
+ // Get the Memory Map
+ //
+ NumRanges = MAX_RANGES;
+ ZeroMem (MemoryMap, sizeof (PEI_DUAL_CHANNEL_DDR_MEMORY_MAP_RANGE) * NumRanges);
+ Status = GetMemoryMap (PeiServices, (PEI_DUAL_CHANNEL_DDR_MEMORY_MAP_RANGE *) MemoryMap, &NumRanges);
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Find the highest memory range in processor native address space to give to
+ // PEI. Then take the top.
+ // If this algorithm changes, then we need to fix the capsule memory
+ // selection algorithm below.
+ //
+ PeiMemoryBaseAddress = 0;
+
+ //
+ // Query the platform for the minimum memory size.
+ //
+ Status = (*PeiServices)->LocatePpi (PeiServices, &gPeiPlatformMemorySizePpiGuid, 0, NULL, (VOID **) &MemSize);
+ ASSERT_EFI_ERROR (Status);
+
+ Status = MemSize->GetPlatformMemorySize (PeiServices, MemSize, &PeiMemoryLength);
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Get required memory size for ACPI use. This helps to put ACPI memory on the top.
+ //
+ RequiredMemSize = 0;
+ RetrieveRequiredMemorySize (PeiServices, &RequiredMemSize);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Required memory size = %Xh (%u) bytes\n", RequiredMemSize, RequiredMemSize);
+
+ PeiMemoryIndex = 0;
+ for (Index = 0; Index < NumRanges; Index++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Found %016Xh bytes at ", MemoryMap[Index].RangeLength);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%016Xh\n", MemoryMap[Index].PhysicalAddress);
+ if ((MemoryMap[Index].Type == DualChannelDdrMainMemory) &&
+ (MemoryMap[Index].PhysicalAddress + MemoryMap[Index].RangeLength < EFI_MAX_ADDRESS) &&
+ (MemoryMap[Index].PhysicalAddress >= PeiMemoryBaseAddress) &&
+ (MemoryMap[Index].RangeLength >= PeiMemoryLength)) {
+ PeiMemoryBaseAddress = MemoryMap[Index].PhysicalAddress + MemoryMap[Index].RangeLength - PeiMemoryLength;
+ PeiMemoryIndex = Index;
+ }
+ }
+
+ //
+ // Test only the PEI memory if necessary. Some platforms do not require the
+ // Base Memory PEIM to be present.
+ //
+ Status = (*PeiServices)->LocatePpi (PeiServices, &gPeiBaseMemoryTestPpiGuid, 0, NULL, (VOID **) &BaseMemoryTestPpi);
+
+ switch (SysBootMode) {
+
+ case BOOT_WITH_FULL_CONFIGURATION:
+ MemoryTestOp = Quick;
+ break;
+
+ case BOOT_WITH_FULL_CONFIGURATION_PLUS_DIAGNOSTICS:
+ MemoryTestOp = Extensive;
+ break;
+
+ default:
+ MemoryTestOp = Ignore;
+ break;
+ }
+
+ (*PeiServices)->PeiReportStatusCode (
+ PeiServices,
+ EFI_PROGRESS_CODE, // Type
+ EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_PC_TEST, // Value
+ 0, // Instance
+ NULL, // *CallerId OPTIONAL
+ NULL // *Data OPTIONAL
+ );
+
+ Status = BaseMemoryTestPpi->BaseMemoryTest (
+ PeiServices,
+ BaseMemoryTestPpi,
+ PeiMemoryBaseAddress,
+ PeiMemoryLength,
+ MemoryTestOp,
+ &BadMemoryAddress
+ );
+ if (EFI_ERROR (Status)) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "Memory test failure at %lXh.\n", BadMemoryAddress);
+ }
+
+ ASSERT_EFI_ERROR (Status);
+
+ Capsule = NULL;
+ CapsuleBuffer = NULL;
+ CapsuleBufferLength = 0;
+
+ if (SysBootMode == BOOT_ON_FLASH_UPDATE) {
+ Status = (*PeiServices)->LocatePpi (PeiServices, &gPeiCapsulePpiGuid, 0, NULL, (VOID **) &Capsule);
+#ifdef AMI_OVERRIDE_FOR_EIP102852
+ ASSERT_EFI_ERROR (Status);
+#endif // AMI_OVERRIDE_FOR_EIP102852
+
+ if (Status == EFI_SUCCESS) {
+ //
+ // Find the largest memory range excluding that given to PEI.
+ //
+ for (Index = 0; Index < NumRanges; Index++) {
+ if ((MemoryMap[Index].Type == DualChannelDdrMainMemory) &&
+ (MemoryMap[Index].PhysicalAddress + MemoryMap[Index].RangeLength < EFI_MAX_ADDRESS)) {
+ if (Index != PeiMemoryIndex) {
+ if (MemoryMap[Index].RangeLength > CapsuleBufferLength) {
+ CapsuleBuffer = (VOID *) ((UINTN) MemoryMap[Index].PhysicalAddress);
+ CapsuleBufferLength = (UINTN) MemoryMap[Index].RangeLength;
+ }
+ } else {
+ if ((MemoryMap[Index].RangeLength - PeiMemoryLength) >= CapsuleBufferLength) {
+ CapsuleBuffer = (VOID *) ((UINTN) MemoryMap[Index].PhysicalAddress);
+ CapsuleBufferLength = (UINTN) (MemoryMap[Index].RangeLength - PeiMemoryLength);
+ }
+ }
+ }
+ }
+ //
+ // Call the Capsule PPI Coalesce function to coalesce the capsule data.
+ //
+ Status = Capsule->Coalesce (PeiServices, &CapsuleBuffer, &CapsuleBufferLength);
+ }
+ //
+ // If it failed, then NULL out our capsule PPI pointer so that the capsule
+ // HOB does not get created below.
+ //
+ if (Status != EFI_SUCCESS) {
+ Capsule = NULL;
+ }
+ }
+ //
+ // Carve out the top memory reserved for ACPI.
+ //
+ Status = (*PeiServices)->InstallPeiMemory (PeiServices, PeiMemoryBaseAddress, PeiMemoryLength - RequiredMemSize);
+ ASSERT_EFI_ERROR (Status);
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Building RESOURCE_SYSTEM_MEMORY Hob: \n");
+ DEBUG ((EFI_D_ERROR, "PeiMemoryBaseAddress = %lXh, PeiMemoryLength = %lXh\n", PeiMemoryBaseAddress, PeiMemoryLength));
+
+ BuildResourceDescriptorHob (
+ EFI_RESOURCE_SYSTEM_MEMORY,
+ (
+ EFI_RESOURCE_ATTRIBUTE_PRESENT |
+ EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
+ EFI_RESOURCE_ATTRIBUTE_TESTED |
+ EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |
+ EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |
+ EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |
+ EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE
+ ),
+ PeiMemoryBaseAddress,
+ PeiMemoryLength
+ );
+
+ //
+ // Install physical memory descriptor hobs for each memory range.
+ //
+ SmramRanges = 0;
+ for (Index = 0; Index < NumRanges; Index++) {
+ if (MemoryMap[Index].Type == DualChannelDdrMainMemory) {
+ if (Index == PeiMemoryIndex) {
+ //
+ // This is a partially tested Main Memory range, give it to EFI
+ //
+ RangeLength = MemoryMap[Index].RangeLength - PeiMemoryLength;
+ } else {
+ //
+ // This is an untested Main Memory range, give it to EFI.
+ //
+ RangeLength = MemoryMap[Index].RangeLength;
+ }
+ BuildResourceDescriptorHob (
+ EFI_RESOURCE_SYSTEM_MEMORY,
+ (
+ EFI_RESOURCE_ATTRIBUTE_PRESENT |
+ EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
+ //
+ // RC Override: mark <4G available memory as tested to give DXE enough memory space, so that default
+ // memory allocations won't occupy the bins for specific memory types.
+ //
+ EFI_RESOURCE_ATTRIBUTE_TESTED |
+ EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |
+ EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |
+ EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |
+ EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE
+ ),
+ MemoryMap[Index].PhysicalAddress,
+ RangeLength
+ );
+
+ //
+ // Test this memory range
+ //
+ Status = BaseMemoryTestPpi->BaseMemoryTest (
+ PeiServices,
+ BaseMemoryTestPpi,
+ MemoryMap[Index].PhysicalAddress,
+ RangeLength,
+ MemoryTestOp,
+ &BadMemoryAddress
+ );
+ ASSERT_EFI_ERROR (Status);
+ } else {
+ if ((
+ (MemoryMap[Index].Type == DualChannelDdrSmramCacheable) ||
+ (MemoryMap[Index].Type == DualChannelDdrSmramNonCacheable)
+ ) &&
+ (MemoryMap[Index].PhysicalAddress != MC_ABSEG_HSEG_PHYSICAL_START)) {
+ //
+ // Only count and report TSEG.
+ //
+ SmramRanges++;
+ }
+ //
+ // Make sure non-system memory is marked as reserved.
+ //
+ BuildResourceDescriptorHob (
+ EFI_RESOURCE_MEMORY_RESERVED, // MemoryType,
+// 0, // MemoryAttribute
+ (MemoryMap[Index].Type == DualChannelDdrGraphicsMemoryNonCacheable)? EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE : 0,
+ MemoryMap[Index].PhysicalAddress, // MemoryBegin
+ MemoryMap[Index].RangeLength // MemoryLength
+ );
+ }
+ }
+
+ BufferSize = sizeof (EFI_SMRAM_HOB_DESCRIPTOR_BLOCK);
+ if (SmramRanges > 0) {
+ BufferSize += ((SmramRanges - 1) * sizeof (EFI_SMRAM_DESCRIPTOR));
+ }
+
+ Hob.Raw = BuildGuidHob (&gEfiSmmPeiSmramMemoryReserve, BufferSize);
+ if (Hob.Raw == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ SmramHobDescriptorBlock = (void *) (Hob.Raw);
+ SmramHobDescriptorBlock->NumberOfSmmReservedRegions = SmramRanges;
+
+ SmramIndex = 0;
+ for (Index = 0; Index < NumRanges; Index++) {
+ if ((
+ (MemoryMap[Index].Type == DualChannelDdrSmramCacheable) ||
+ (MemoryMap[Index].Type == DualChannelDdrSmramNonCacheable)
+ ) &&
+ (MemoryMap[Index].PhysicalAddress != MC_ABSEG_HSEG_PHYSICAL_START)) {
+ //
+ // This is an SMRAM range (not reporting AB_SEG or H_SEG), create an SMRAM descriptor.
+ //
+ SmramDescriptor = &SmramHobDescriptorBlock->Descriptor[SmramIndex];
+ SmramDescriptor->PhysicalStart = MemoryMap[Index].PhysicalAddress;
+ SmramDescriptor->CpuStart = MemoryMap[Index].CpuAddress;
+
+ //
+ // RangeLength includes alignment adjustment.
+ //
+ if (SmramDescriptor->PhysicalStart < 0x100000) {
+ SmramDescriptor->PhysicalSize = MemoryMap[Index].RangeLength;
+ } else {
+ SmramDescriptor->PhysicalSize = (Inputs->TsegSize - Inputs->IedSize )* 0x100000;
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "TSeg base is %Xh\n", SmramDescriptor->PhysicalStart);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "TSeg SMRAM size is %Xh\n", SmramDescriptor->PhysicalSize);
+
+
+ if (MemoryMap[Index].Type == DualChannelDdrSmramCacheable) {
+ SmramDescriptor->RegionState = EFI_SMRAM_CLOSED | EFI_CACHEABLE;
+ } else {
+ SmramDescriptor->RegionState = EFI_SMRAM_CLOSED;
+ }
+ SmramIndex++;
+ }
+ }
+ //
+ // Get the current "Top of Upper Usable Memory" address from TOUUD.
+ // If TOUUD > 4G, it means memory is re-mapped.
+ //
+ TopUseableMemSize = McD0PciCfg64 (R_SA_TOUUD) & B_SA_TOUUD_TOUUD_MASK;
+ TopUseableMemAddr = MEM_EQU_4GB;
+ Tom = McD0PciCfg64 (R_SA_TOM) & B_SA_TOM_TOM_MASK;
+
+ if (TopUseableMemSize > MEM_EQU_4GB) {
+ //
+ // This is above 4G memory address, give it to EFI.
+ // If memory hob length is above 4G length, cut and separate it.
+ //
+ while ((TopUseableMemSize - MEM_EQU_4GB) > MEM_EQU_4GB) {
+ PEI_DEBUG ((PeiServices, EFI_D_ERROR, "Found 0x100000000 bytes at 0x%016lX\n", TopUseableMemAddr));
+
+ if (Inputs->MemoryTrace && (TopUseableMemAddr + MEM_EQU_4GB > RShiftU64 (Tom, 1))) {
+ //
+ // Mark memory above 4GB as reserved if it's used for Memory Trace
+ //
+ ResourceType = EFI_RESOURCE_MEMORY_RESERVED;
+ ResourceAttribute = 0;
+ } else {
+ ResourceType = EFI_RESOURCE_SYSTEM_MEMORY;
+ ResourceAttribute = EFI_RESOURCE_ATTRIBUTE_PRESENT |
+ EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
+ EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |
+ EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |
+ EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |
+ EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE;
+ }
+ BuildResourceDescriptorHob (
+ ResourceType, // MemoryType,
+ ResourceAttribute, // MemoryAttribute
+ TopUseableMemAddr, // MemoryBegin
+ MEM_EQU_4GB // MemoryLength
+ );
+ TopUseableMemSize = TopUseableMemSize - MEM_EQU_4GB;
+ TopUseableMemAddr = TopUseableMemAddr + MEM_EQU_4GB;
+ }
+ //
+ // Create hob for remaining memory which is above 4G memory address.
+ //
+ if (TopUseableMemSize > MEM_EQU_4GB) {
+ PEI_DEBUG ((PeiServices, EFI_D_ERROR, "Found 0x%016lX bytes at ", TopUseableMemSize - MEM_EQU_4GB));
+ PEI_DEBUG ((PeiServices, EFI_D_ERROR, "0x%016lX\n", TopUseableMemAddr));
+ }
+ if (Inputs->MemoryTrace) {
+ //
+ // Mark memory above 4GB as reserved if it's used for Memory Trace
+ //
+ ResourceType = EFI_RESOURCE_MEMORY_RESERVED;
+ ResourceAttribute = 0;
+ } else {
+ ResourceType = EFI_RESOURCE_SYSTEM_MEMORY;
+ ResourceAttribute = EFI_RESOURCE_ATTRIBUTE_PRESENT |
+ EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
+ EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |
+ EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |
+ EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |
+ EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE;
+ }
+ BuildResourceDescriptorHob (
+ ResourceType, // MemoryType,
+ ResourceAttribute, // MemoryAttribute
+ TopUseableMemAddr, // MemoryBegin
+ (TopUseableMemSize - MEM_EQU_4GB) // MemoryLength
+ );
+ }
+ //
+ // If we found the capsule PPI (and we didn't have errors), then
+ // call the capsule PEIM to allocate memory for the capsule.
+ //
+ if (Capsule != NULL) {
+ Status = Capsule->CreateState (PeiServices, CapsuleBuffer, CapsuleBufferLength);
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This function installs memory for the S3 resume path.
+
+ @param[in] Inputs - Mrc input data structure
+ @param[in] PeiServices - PEI services table.
+ @param[in] VariableServices - Pointer to EFI Variable PPI
+
+ @retval EFI_SUCCESS - The function completed successfully.
+ @retval EFI_OUT_OF_RESOURCES - Out of Resources.
+**/
+EFI_STATUS
+InstallS3Memory (
+ IN const MrcInput *const Inputs,
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_READ_ONLY_VARIABLE_PPI *VariableServices
+)
+{
+ EFI_STATUS Status;
+ UINTN VarSize;
+ UINTN VarAttrib;
+ EFI_PHYSICAL_ADDRESS TopUseableMemAddr;
+ EFI_PHYSICAL_ADDRESS TopUseableMemSize;
+ EFI_PHYSICAL_ADDRESS Tom;
+ UINT64 AcpiVariableSet64;
+ ACPI_VARIABLE_SET *AcpiVariableSet;
+ UINTN S3MemoryBase;
+ UINTN S3MemorySize;
+ UINT8 NumRanges;
+ PEI_DUAL_CHANNEL_DDR_MEMORY_MAP_RANGE MemoryMap[MAX_RANGES];
+ EFI_PEI_HOB_POINTERS Hob;
+ EFI_SMRAM_HOB_DESCRIPTOR_BLOCK *SmramHobDescriptorBlock;
+ EFI_SMRAM_DESCRIPTOR *SmramDescriptor;
+ EFI_RESOURCE_TYPE ResourceType;
+ EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute;
+ UINT8 Index;
+ UINT8 SmramIndex;
+ UINT8 SmramRanges;
+ UINTN BufferSize;
+ const MrcDebug *Debug;
+
+ Debug = &Inputs->Debug;
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Install S3 resume memory.\n");
+ NumRanges = MAX_RANGES;
+ ZeroMem (MemoryMap, sizeof (PEI_DUAL_CHANNEL_DDR_MEMORY_MAP_RANGE) * NumRanges);
+ //
+ // Call to GetMemoryMap to initialize TSEG registers.
+ //
+ Status = GetMemoryMap (PeiServices, (PEI_DUAL_CHANNEL_DDR_MEMORY_MAP_RANGE *) MemoryMap, &NumRanges);
+ ASSERT_EFI_ERROR (Status);
+
+ AcpiVariableSet = NULL;
+ VarSize = sizeof (AcpiVariableSet64);
+ VarAttrib = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE;
+
+ Status = VariableServices->PeiGetVariable (
+ PeiServices,
+ ACPI_GLOBAL_VARIABLE,
+ &gEfiAcpiVariableGuid,
+ &VarAttrib,
+ &VarSize,
+ &AcpiVariableSet64
+ );
+ AcpiVariableSet = (ACPI_VARIABLE_SET *) (UINTN) AcpiVariableSet64;
+
+ if (EFI_ERROR (Status) || (AcpiVariableSet == NULL)) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ BuildGuidDataHob (&gEfiAcpiVariableGuid, AcpiVariableSet, sizeof (ACPI_VARIABLE_SET));
+
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "AcpiVariableSet at = 0x%x. 0x%x\n",
+ AcpiVariableSet,
+ &AcpiVariableSet->AcpiReservedMemoryBase
+ );
+
+ S3MemoryBase = (UINTN) (AcpiVariableSet->AcpiReservedMemoryBase);
+ S3MemorySize = (UINTN) (AcpiVariableSet->AcpiReservedMemorySize);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "S3MemoryBase = 0x%x - S3MemorySize = 0x%x.\n", S3MemoryBase, S3MemorySize);
+ Status = (*PeiServices)->InstallPeiMemory (PeiServices, S3MemoryBase, S3MemorySize);
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Retrieve the system memory length and build memory hob for the system
+ // memory above 1MB, so memory callback can set cache for the system memory
+ // correctly on S3 resume path, just like it does on normal boot path.
+ //
+ PEI_ASSERT (PeiServices, (AcpiVariableSet->SystemMemoryLength - 0x100000) > 0);
+ BuildResourceDescriptorHob (
+ EFI_RESOURCE_SYSTEM_MEMORY,
+ (
+ EFI_RESOURCE_ATTRIBUTE_PRESENT |
+ EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
+ EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |
+ EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |
+ EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |
+ EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE
+ ),
+ 0x100000,
+ AcpiVariableSet->SystemMemoryLength - 0x100000
+ );
+
+ //
+ // Get the current "Top of Upper Usable Memory" address from TOUUD.
+ // If TOUUD > 4G, it means memory is re-mapped.
+ //
+ TopUseableMemSize = McD0PciCfg64 (R_SA_TOUUD) & B_SA_TOUUD_TOUUD_MASK;
+ TopUseableMemAddr = MEM_EQU_4GB;
+ Tom = McD0PciCfg64 (R_SA_TOM) & B_SA_TOM_TOM_MASK;
+
+ if (TopUseableMemSize > MEM_EQU_4GB) {
+ //
+ // This is a above 4G memory, give it to EFI
+ // if memory hob length is above 4G length,cut and separate it.
+ //
+ if (Inputs->MemoryTrace && (TopUseableMemAddr + MEM_EQU_4GB > RShiftU64 (Tom, 1))) {
+ if (Inputs->MemoryTrace) {
+ //
+ // Mark memory above 4GB as reserved if it's used for Memory Trace
+ //
+ ResourceType = EFI_RESOURCE_MEMORY_RESERVED;
+ ResourceAttribute = 0;
+ } else {
+ ResourceType = EFI_RESOURCE_SYSTEM_MEMORY;
+ ResourceAttribute = EFI_RESOURCE_ATTRIBUTE_PRESENT |
+ EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
+ EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |
+ EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |
+ EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |
+ EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE;
+ }
+ BuildResourceDescriptorHob (
+ ResourceType, // MemoryType,
+ ResourceAttribute, // MemoryAttribute
+ TopUseableMemAddr, // MemoryBegin
+ MEM_EQU_4GB // MemoryLength
+ );
+ TopUseableMemSize = TopUseableMemSize - MEM_EQU_4GB;
+ TopUseableMemAddr = TopUseableMemAddr + MEM_EQU_4GB;
+ }
+ //
+ // Create hob for remaining memory which is above 4G memory address.
+ //
+ if (Inputs->MemoryTrace) {
+ //
+ // Mark memory above 4GB as reserved if it's used for Memory Trace
+ //
+ ResourceType = EFI_RESOURCE_MEMORY_RESERVED;
+ ResourceAttribute = 0;
+ } else {
+ ResourceType = EFI_RESOURCE_SYSTEM_MEMORY;
+ ResourceAttribute = EFI_RESOURCE_ATTRIBUTE_PRESENT |
+ EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
+ EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |
+ EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |
+ EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |
+ EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE;
+ }
+ BuildResourceDescriptorHob (
+ ResourceType, // MemoryType,
+ ResourceAttribute, // MemoryAttribute
+ TopUseableMemAddr, // MemoryBegin
+ (TopUseableMemSize - MEM_EQU_4GB) // MemoryLength
+ );
+ }
+
+ //
+ // Report SMRAM ranges
+ //
+
+ SmramRanges = 0;
+ for (Index = 0; Index < NumRanges; Index++) {
+ if ((
+ (MemoryMap[Index].Type == DualChannelDdrSmramCacheable) ||
+ (MemoryMap[Index].Type == DualChannelDdrSmramNonCacheable)
+ ) &&
+ (MemoryMap[Index].PhysicalAddress != MC_ABSEG_HSEG_PHYSICAL_START)
+ ) {
+ //
+ // Only count TSEG
+ //
+ SmramRanges++;
+ }
+ }
+
+ BufferSize = sizeof (EFI_SMRAM_HOB_DESCRIPTOR_BLOCK);
+ if (SmramRanges > 0) {
+ BufferSize += ((SmramRanges - 1) * sizeof (EFI_SMRAM_DESCRIPTOR));
+ }
+
+ Hob.Raw = BuildGuidHob (&gEfiSmmPeiSmramMemoryReserve, BufferSize);
+
+ SmramHobDescriptorBlock = (void *) (Hob.Raw);
+ SmramHobDescriptorBlock->NumberOfSmmReservedRegions = SmramRanges;
+
+ SmramIndex = 0;
+ for (Index = 0; Index < NumRanges; Index++) {
+ if ((
+ (MemoryMap[Index].Type == DualChannelDdrSmramCacheable) ||
+ (MemoryMap[Index].Type == DualChannelDdrSmramNonCacheable)
+ ) &&
+ (MemoryMap[Index].PhysicalAddress != MC_ABSEG_HSEG_PHYSICAL_START)) {
+
+ //
+ // This is an SMRAM range (not reporting AB_SEG or H_SEG, create an SMRAM descriptor
+ //
+ SmramDescriptor = &SmramHobDescriptorBlock->Descriptor[SmramIndex];
+ SmramDescriptor->PhysicalStart = MemoryMap[Index].PhysicalAddress;
+ SmramDescriptor->CpuStart = MemoryMap[Index].CpuAddress;
+
+ //
+ // RangeLength includes alignment adjustment.
+ //
+ if (SmramDescriptor->PhysicalStart < 0x100000) {
+ SmramDescriptor->PhysicalSize = MemoryMap[Index].RangeLength;
+ } else {
+ SmramDescriptor->PhysicalSize = (Inputs->TsegSize - Inputs->IedSize )* 0x100000;
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "TSeg base is %Xh\n", SmramDescriptor->PhysicalStart);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "TSeg SMRAM size is %Xh\n", SmramDescriptor->PhysicalSize);
+
+ if (MemoryMap[Index].Type == DualChannelDdrSmramCacheable) {
+ SmramDescriptor->RegionState = EFI_SMRAM_CLOSED | EFI_CACHEABLE;
+ } else {
+ SmramDescriptor->RegionState = EFI_SMRAM_CLOSED;
+ }
+ SmramIndex++;
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Determine the memory size desired based on HOB memory information.
+
+ @param[in] PeiServices - PEI Services table.
+ @param[in, out] Size - The memory size to return.
+
+ @retval Nothing.
+**/
+void
+RetrieveRequiredMemorySize (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN OUT UINTN *Size
+ )
+{
+ EFI_STATUS Status;
+ EFI_PEI_HOB_POINTERS Hob;
+ EFI_MEMORY_TYPE_INFORMATION *MemoryData;
+ UINT8 Index;
+ UINTN TempPageNum;
+
+ *Size = 0;
+ MemoryData = NULL;
+ Status = (*PeiServices)->GetHobList (PeiServices, (VOID **) &Hob.Raw);
+ while (!END_OF_HOB_LIST (Hob)) {
+ if (Hob.Header->HobType == EFI_HOB_TYPE_GUID_EXTENSION &&
+ CompareGuid (&Hob.Guid->Name, &gEfiMemoryTypeInformationGuid)) {
+ MemoryData = (EFI_MEMORY_TYPE_INFORMATION *) (Hob.Raw + sizeof (EFI_HOB_GENERIC_HEADER) + sizeof (EFI_GUID));
+ break;
+ }
+
+ Hob.Raw = GET_NEXT_HOB (Hob);
+ }
+ //
+ // Platform PEIM should supply the information. Generic PEIM doesn't assume any default value.
+ //
+ if (MemoryData == NULL) {
+ return;
+ }
+
+ TempPageNum = 0;
+ for (Index = 0; MemoryData[Index].Type != EfiMaxMemoryType; Index++) {
+ //
+ // Accumulate default memory size requirements
+ //
+ TempPageNum += MemoryData[Index].NumberOfPages;
+ }
+
+ if (TempPageNum == 0) {
+ return;
+ }
+ //
+ // 16 additional pages are used by DXE memory manager.
+ //
+ *Size = (TempPageNum + 16) * EFI_PAGE_SIZE;
+
+ return;
+}
+
+/**
+ Determine the Total DPR memory size needed based on the DPR directory in the SA Data HOB.
+
+ @param[in] PeiServices - PEI Services table.
+ @param[in, out] Size - The memory size in MB to return.
+
+ @retval Nothing.
+**/
+void
+CalculateTotalDprMemorySize (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN OUT UINT8 *Size
+ )
+{
+ UINT8 DprEntryIndex;
+ SA_DATA_HOB *SaDataHob;
+ DPR_DIRECTORY_ENTRY *DirectoryEntry;
+
+ *Size = 0;
+ DprEntryIndex = 0;
+ DirectoryEntry = NULL;
+ SaDataHob = NULL;
+
+ SaDataHob = GetFirstGuidHob (&gSaDataHobGuid);
+ if (SaDataHob != NULL) {
+ DirectoryEntry = SaDataHob->DprDirectory;
+ while(DprEntryIndex < DPR_DIRECTORY_MAX){
+ *Size += DirectoryEntry->Size;
+ DirectoryEntry++;
+ DprEntryIndex++;
+ }
+ }
+ return;
+}
+
+/**
+ Calculates the bases for each technology consuming the DPR region
+ and updates the SA Data HOB with the appropriate values in the Dpr
+ directory
+
+ @param[in] PeiServices - PEI Services table.
+ @param[in] Base - The memory base to return.
+ @param[in] TotalDprSizeMB - The total DPR size in MB
+
+ @retval Nothing.
+**/
+void
+UpdateDprHobInfo (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PHYSICAL_ADDRESS Base,
+ IN UINT8 TotalDprSizeMB
+ )
+{
+ UINT32 TopOfDpr;
+ UINT8 DprEntryIndex;
+ SA_DATA_HOB *SaDataHob;
+ DPR_DIRECTORY_ENTRY *DirectoryEntry;
+
+ DprEntryIndex = 0;
+ DirectoryEntry = NULL;
+ SaDataHob = NULL;
+ TopOfDpr = (UINT32) Base + (UINT32) LShiftU64(TotalDprSizeMB, 20);
+
+ SaDataHob = GetFirstGuidHob (&gSaDataHobGuid);
+ if (SaDataHob != NULL) {
+ DirectoryEntry = SaDataHob->DprDirectory;
+ while(DprEntryIndex < DPR_DIRECTORY_MAX){
+ switch (DirectoryEntry->Type) {
+ case DPR_DIRECTORY_TYPE_TXT:
+ DirectoryEntry->PhysBase = (UINT32) TopOfDpr - (UINT32) LShiftU64(DirectoryEntry->Size, 20);
+ break;
+ case DPR_DIRECTORY_TYPE_PFAT:
+ DirectoryEntry->PhysBase = (UINT32) Base;
+ break;
+ default:
+ break;
+ }
+ DirectoryEntry++;
+ DprEntryIndex++;
+ }
+ }
+ return;
+}
+
+/**
+ Determine the memory size desired by GDXC
+
+ @param[in] PeiServices - PEI Services table.
+ @param[in, out] MotSize - The MOT memory size
+ @param[in, out] GdxcSize - The GDXC memory size
+
+ @retval Nothing.
+**/
+void
+RetrieveGdxcMemorySize (
+ IN EFI_PEI_SERVICES **PeiServices,
+ OUT UINT64 *MotSize,
+ OUT UINT64 *GdxcSize
+ )
+{
+ UINT32 MchBar;
+ UINT32 GdxcBar;
+ UINT32 TempMotSize;
+ MPCOHTRK_CR_GDXC_MOT_REGION_STRUCT MotRange;
+ MPCOHTRK_CR_GDXC_OCLA_REGION_STRUCT OclaRange;
+
+ *MotSize = 0;
+ *GdxcSize = 0;
+
+ //
+ // Get MchBAR
+ //
+ MchBar = McD0PciCfg32 (R_SA_MCHBAR) & B_SA_MCHBAR_MCHBAR_MASK;
+ //
+ // Get GdxcBar
+ //
+ MrcOemMmioRead (NCDECS_CR_GDXCBAR_NCU_REG, (U32 *) &GdxcBar, MchBar);
+ GdxcBar &= NCDECS_CR_GDXCBAR_NCU_MAX;
+ //
+ // Determine Gdxc size: Includes MOT\PSMI\IOT (OCLA)
+ //
+ MrcOemMmioRead(MPCOHTRK_CR_GDXC_MOT_REGION_REG, (U32 *) &MotRange, GdxcBar);
+ TempMotSize = MotRange.Bits.END_ADDRESS - MotRange.Bits.START_ADDRESS;
+ if (TempMotSize > 0) {
+ *GdxcSize = *MotSize = MrcOemMemoryLeftShiftU64 ((UINT64) (TempMotSize + 1), 23);
+ }
+
+ MrcOemMmioRead(MPCOHTRK_CR_GDXC_OCLA_REGION_REG, (U32 *) &OclaRange, GdxcBar);
+ *GdxcSize += MrcOemMemoryLeftShiftU64 ((UINT64) (OclaRange.Bits.END_ADDRESS - OclaRange.Bits.START_ADDRESS), 23);
+
+ // Add 16MB if some allocated to MOT and/or IOT
+ if (*GdxcSize != 0) {
+ *GdxcSize += (16 << 20);
+ }
+
+ return;
+}
+
+/**
+ This function returns the memory ranges to be enabled, along with information
+ describing how the range should be used. The MemoryMap buffer will be filled in and
+ NumRanges will contain the actual number of memory ranges that are to be enabled.
+
+ @param[in] PeiServices - PEI Services Table.
+ @param[in, out] MemoryMap - Buffer to record details of the memory ranges to be enabled.
+ @param[in, out] NumRanges - On input, this contains the maximum number of memory ranges that
+ can be described in the MemoryMap buffer.
+
+ @retval EFI_SUCCESS - The function completed successfully.
+ @retval EFI_BUFFER_TOO_SMALL - The specified number of ranges is too large.
+**/
+EFI_STATUS
+GetMemoryMap (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN OUT PEI_DUAL_CHANNEL_DDR_MEMORY_MAP_RANGE *MemoryMap,
+ IN OUT UINT8 *NumRanges
+ )
+{
+ BOOLEAN EnableSmram;
+ EFI_PHYSICAL_ADDRESS MemorySize;
+ EFI_PHYSICAL_ADDRESS RowLength;
+ EFI_PHYSICAL_ADDRESS AlignedTsegBase;
+ EFI_PHYSICAL_ADDRESS AlignedGdxcBase;
+ EFI_STATUS Status;
+ PEI_MEMORY_RANGE_GRAPHICS_MEMORY GraphicsMemoryMask;
+ PEI_MEMORY_RANGE_PCI_MEMORY PciMemoryMask;
+ PEI_MEMORY_RANGE_OPTION_ROM OptionRomMask;
+ PEI_MEMORY_RANGE_SMRAM SmramMask;
+ PEI_MEMORY_RANGE_SMRAM TsegMask;
+ PEI_PLATFORM_MEMORY_RANGE_PPI *MemoryRangePpi;
+ UINT32 BlockNum;
+ UINT8 EsmramcRegister;
+ UINT8 ExtendedMemoryIndex;
+ UINT8 Index;
+ UINT8 TotalDprSizeMB;
+ UINT64 GdxcRequiredMemSize;
+ UINT64 GdxcMotMemSize;
+#ifdef PTT_FLAG
+ UINT32 PttSts;
+#endif
+ if ((*NumRanges) < MAX_RANGES) {
+ return EFI_BUFFER_TOO_SMALL;
+ }
+
+ *NumRanges = 0;
+
+ //
+ // Get platform memory range service
+ //
+ Status = (*PeiServices)->LocatePpi (PeiServices, &gPeiPlatformMemoryRangePpiGuid, 0, NULL, (VOID **) &MemoryRangePpi);
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Find out which memory ranges to reserve on this platform
+ //
+ Status = MemoryRangePpi->ChooseRanges (
+ PeiServices,
+ MemoryRangePpi,
+ &OptionRomMask,
+ &SmramMask,
+ &GraphicsMemoryMask,
+ &PciMemoryMask
+ );
+ ASSERT_EFI_ERROR (Status);
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "OptionRomMask = %Xh\n", OptionRomMask);
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "SmramMask = %Xh\n", SmramMask);
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "GraphicsMemoryMask = %Xh\n", GraphicsMemoryMask);
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "PciMemoryMask = %Xh\n", PciMemoryMask);
+ //
+ //
+ // Generate memory ranges for the memory map.
+ //
+ EnableSmram = FALSE;
+ EsmramcRegister = 0;
+ MemorySize = 0;
+ Index = 0;
+
+ //
+ // Get the current "max usable memory" address from TOLUD because we will not
+ // support any memory above 4Gig. Will ignore the memory between 4G and TOUUD.
+ //
+ RowLength = McD0PciCfg32 (R_SA_TOLUD) & B_SA_TOLUD_TOLUD_MASK;
+
+ //
+ // System is very unlikely to work with less than 32MB
+ //
+ PEI_ASSERT (PeiServices, RowLength >= (32 * 1024 * 1024));
+
+ //
+ // Add memory below 640KB to the memory map. Make sure memory between
+ // 640KB and 1MB are reserved, even if not used for SMRAM
+ //
+ MemoryMap[*NumRanges].RowNumber = Index;
+ MemoryMap[*NumRanges].PhysicalAddress = MemorySize;
+ MemoryMap[*NumRanges].CpuAddress = MemorySize;
+ MemoryMap[*NumRanges].RangeLength = 0xA0000;
+ MemoryMap[*NumRanges].Type = DualChannelDdrMainMemory;
+ (*NumRanges)++;
+
+ //
+ // Reserve ABSEG or HSEG SMRAM if needed
+ //
+ if (SmramMask & (PEI_MR_SMRAM_ABSEG_MASK | PEI_MR_SMRAM_HSEG_MASK)) {
+ EnableSmram = TRUE;
+ MemoryMap[*NumRanges].PhysicalAddress = MC_ABSEG_HSEG_PHYSICAL_START;
+ MemoryMap[*NumRanges].RangeLength = MC_ABSEG_HSEG_LENGTH;
+ MemoryMap[*NumRanges].CpuAddress = (SmramMask & PEI_MR_SMRAM_ABSEG_MASK) ?
+ MC_ABSEG_CPU_START :
+ MC_HSEG_CPU_START;
+ //
+ // Chipset only supports cacheable SMRAM.
+ //
+ MemoryMap[*NumRanges].Type = DualChannelDdrSmramNonCacheable;
+ }
+ else {
+ //
+ // Just mark this range reserved.
+ //
+ MemoryMap[*NumRanges].PhysicalAddress = MC_ABSEG_HSEG_PHYSICAL_START;
+ MemoryMap[*NumRanges].CpuAddress = MC_ABSEG_CPU_START;
+ MemoryMap[*NumRanges].RangeLength = 0x60000;
+ MemoryMap[*NumRanges].Type = DualChannelDdrReservedMemory;
+ }
+
+ MemoryMap[*NumRanges].RowNumber = Index;
+ (*NumRanges)++;
+
+ RowLength -= 0x100000;
+ MemorySize = 0x100000;
+
+ //
+ // Add remaining memory to the memory map.
+ //
+ if (RowLength > 0) {
+ MemoryMap[*NumRanges].RowNumber = Index;
+ MemoryMap[*NumRanges].PhysicalAddress = MemorySize;
+ MemoryMap[*NumRanges].CpuAddress = MemorySize;
+ MemoryMap[*NumRanges].RangeLength = RowLength;
+ MemoryMap[*NumRanges].Type = DualChannelDdrMainMemory;
+ (*NumRanges)++;
+ MemorySize += RowLength;
+ }
+
+ ExtendedMemoryIndex = (UINT8) (*NumRanges - 1);
+
+ //
+ // See if we need to trim Graphics Memory out of the highest memory range.
+ //
+ if (GraphicsMemoryMask != PEI_MR_GRAPHICS_MEMORY_NONE) {
+ //
+ // Create the new range for Graphics Memory from the previous SdrDdrMainMemory range.
+ //
+ MemoryMap[*NumRanges].RangeLength = ((GraphicsMemoryMask & PEI_MR_GRAPHICS_MEMORY_SIZE_MASK) * 512 * 1024);
+ MemoryMap[*NumRanges].RowNumber = MemoryMap[ExtendedMemoryIndex].RowNumber;
+ MemorySize -= MemoryMap[*NumRanges].RangeLength;
+ MemoryMap[*NumRanges].PhysicalAddress = MemorySize;
+ MemoryMap[*NumRanges].CpuAddress = MemorySize;
+ MemoryMap[ExtendedMemoryIndex].RangeLength -= MemoryMap[*NumRanges].RangeLength;
+ MemoryMap[*NumRanges].Type = (GraphicsMemoryMask & PEI_MR_GRAPHICS_MEMORY_CACHEABLE) ?
+ DualChannelDdrGraphicsMemoryCacheable : DualChannelDdrGraphicsMemoryNonCacheable;
+
+ (*NumRanges)++;
+ }
+ //
+ // See if we need to trim TSEG out of the highest memory range.
+ //
+ if (SmramMask & PEI_MR_SMRAM_TSEG_MASK) {
+ //
+ // Create the new range for TSEG and remove that range from the previous SdrDdrMainMemory range.
+ //
+ TsegMask = (SmramMask & PEI_MR_SMRAM_SIZE_MASK);
+
+ BlockNum = 1;
+ while (TsegMask) {
+ TsegMask >>= 1;
+ BlockNum <<= 1;
+ }
+
+ BlockNum >>= 1;
+
+ switch (BlockNum) {
+ case PEI_MR_SMRAM_SIZE_1024K_MASK:
+ break;
+
+ case PEI_MR_SMRAM_SIZE_2048K_MASK:
+ break;
+
+ case PEI_MR_SMRAM_SIZE_8192K_MASK:
+ break;
+
+ case PEI_MR_SMRAM_SIZE_16384K_MASK:
+ break;
+
+ case PEI_MR_SMRAM_SIZE_32768K_MASK:
+ break;
+
+ case PEI_MR_SMRAM_SIZE_65536K_MASK:
+ break;
+
+ default:
+ //
+ // Non supported size. Set to 0.
+ //
+ BlockNum = 0;
+ break;
+ }
+
+ if (BlockNum) {
+ EnableSmram = TRUE;
+
+ MemoryMap[*NumRanges].RangeLength = (BlockNum * 128 * 1024);
+ MemoryMap[*NumRanges].RowNumber = MemoryMap[ExtendedMemoryIndex].RowNumber;
+ MemorySize -= MemoryMap[*NumRanges].RangeLength;
+
+ //
+ // MRC aligns TSEG base on 8MB boundary.
+ // Need to adjust memory map accordingly.
+ //
+ AlignedTsegBase = MemorySize & ~(MemoryMap[*NumRanges].RangeLength - 1);
+ MemoryMap[*NumRanges].RangeLength += (MemorySize - AlignedTsegBase);
+ MemorySize = AlignedTsegBase;
+ MemoryMap[*NumRanges].PhysicalAddress = AlignedTsegBase;
+ MemoryMap[*NumRanges].CpuAddress = AlignedTsegBase;
+ MemoryMap[ExtendedMemoryIndex].RangeLength -= MemoryMap[*NumRanges].RangeLength;
+ }
+ //
+ // Chipset only supports cacheable SMRAM.
+ //
+ MemoryMap[*NumRanges].Type = DualChannelDdrSmramCacheable;
+
+ (*NumRanges)++;
+ }
+
+//;;## ...AMI_OVERRIDE... Disable compatible SMM space A00000 and B00000 start.
+#ifndef SMM_THUNK_NO_AB_SEG_FLAG
+ //
+ // Turn on SMRAM if required.
+ //
+ if (EnableSmram) {
+ McD0PciCfg8Or (R_SA_SMRAMC, B_SA_SMRAMC_G_SMRAME_MASK);
+ }
+#endif
+//;;## ...AMI_OVERRIDE... Disable compatible SMM space A00000 and B00000 end.
+ //
+ // Reserve DPR based on Total size required by all technologies using DPR
+ //
+ CalculateTotalDprMemorySize (PeiServices, &TotalDprSizeMB);
+
+ if (TotalDprSizeMB != 0) {
+
+ MemoryMap[*NumRanges].RangeLength = (UINT64) LShiftU64 (TotalDprSizeMB, 20);
+ MemoryMap[*NumRanges].RowNumber = MemoryMap[ExtendedMemoryIndex].RowNumber;
+ MemorySize -= MemoryMap[*NumRanges].RangeLength;
+ MemoryMap[*NumRanges].PhysicalAddress = MemorySize;
+ MemoryMap[*NumRanges].CpuAddress = MemorySize;
+ MemoryMap[ExtendedMemoryIndex].RangeLength -= MemoryMap[*NumRanges].RangeLength;
+ MemoryMap[*NumRanges].Type = DualChannelDdrReservedMemory;
+
+ UpdateDprHobInfo (PeiServices, MemorySize, TotalDprSizeMB);
+
+ (*NumRanges)++;
+ }
+
+ //
+ // Reserve GDXC
+ //
+ RetrieveGdxcMemorySize (PeiServices, &GdxcMotMemSize, &GdxcRequiredMemSize);
+
+ if (GdxcRequiredMemSize) {
+ MemoryMap[*NumRanges].RangeLength = GdxcMotMemSize;
+ MemoryMap[*NumRanges].RowNumber = MemoryMap[ExtendedMemoryIndex].RowNumber;
+ MemorySize -= MemoryMap[*NumRanges].RangeLength;
+
+ //
+ // MRC aligns Mot base on 16MB boundary.
+ // Need to adjust memory map accordingly.
+ //
+ AlignedGdxcBase = MemorySize &~(MRC_BIT24 - 1);
+ //
+ // Now subtract rest of GdxcRequiredMemsize - GdxcMotMemSize
+ //
+ AlignedGdxcBase -= GdxcRequiredMemSize - GdxcMotMemSize;
+ MemoryMap[*NumRanges].RangeLength += (MemorySize - AlignedGdxcBase);
+ MemorySize = AlignedGdxcBase;
+ MemoryMap[*NumRanges].PhysicalAddress = AlignedGdxcBase;
+ MemoryMap[*NumRanges].CpuAddress = AlignedGdxcBase;
+ MemoryMap[ExtendedMemoryIndex].RangeLength -= MemoryMap[*NumRanges].RangeLength;
+ MemoryMap[*NumRanges].Type = DualChannelDdrReservedMemory;
+
+ (*NumRanges)++;
+ }
+
+#ifdef PTT_FLAG
+ if (GetCpuFamily() == cmHSW_ULT) {
+ MrcOemMmioRead (R_PTT_HCI_STS, (U32 *) &PttSts, R_PTT_HCI_BASE_ADDRESS);
+ if ((PttSts & B_PTT_HCI_STS_ENABLED) == B_PTT_HCI_STS_ENABLED) {
+ MemoryMap[*NumRanges].RangeLength = 0x1000;
+ MemoryMap[*NumRanges].RowNumber = MemoryMap[ExtendedMemoryIndex].RowNumber;
+ MemorySize -= MemoryMap[*NumRanges].RangeLength;
+ MemoryMap[*NumRanges].PhysicalAddress = MemorySize;
+ MemoryMap[*NumRanges].CpuAddress = MemorySize;
+ MemoryMap[ExtendedMemoryIndex].RangeLength -= MemoryMap[*NumRanges].RangeLength;
+ MemoryMap[*NumRanges].Type = DualChannelDdrReservedMemory;
+
+ (*NumRanges)++;
+ }
+ }
+#endif
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This function returns a pointer to the allocated hand off buffer.
+
+ @param[in] PeiServices - A pointer to the EFI PEI services table
+ @param[in, out] Hob - A pointer to where to store the pointer to the allocated data buffer.
+ @param[in] Size - The size of the buffer to get.
+
+ @retval EFI_SUCCESS - Hob is successfully built.
+ @retval Others - Error occured while creating the Hob.
+**/
+EFI_STATUS
+MrcGetHobForDataStorage (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN OUT HOB_SAVE_MEMORY_DATA **Hob,
+ IN UINT16 BlockSize
+ )
+{
+ EFI_STATUS Status;
+
+ Status = (*PeiServices)->CreateHob (PeiServices, EFI_HOB_TYPE_GUID_EXTENSION, BlockSize, (VOID **) Hob);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ (*Hob)->EfiHobGuidType.Name = gMemRestoreDataGuid;
+ ZeroMem (&((*Hob)->MrcData), sizeof (MrcParameters));
+ return EFI_SUCCESS;
+}
+
+/**
+ A small memory test to quickly point out severe memory issues.
+
+ @param[in] Inputs - Pointer to the MRC Input data structure
+
+ @retval mrcFail on failure, otherwise mrcSuccess.
+**/
+MrcStatus
+BasicMemoryTest (
+ IN const MrcInput * const Inputs
+ )
+{
+ const UINT32 BlockSize = 0x1000;
+ UINT8 *Addr;
+ UINT8 Pattern;
+ UINT8 Value;
+ UINTN LoopCount;
+ const MrcDebug *Debug;
+
+ Debug = &Inputs->Debug;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Normal mode memory test started.\n");
+
+ Addr = 0;
+ Pattern = 0;
+ while ((UINT32) Addr < BlockSize) {
+ *Addr = Pattern++;
+ Addr++;
+ }
+
+ for (LoopCount = 0; LoopCount < 20; LoopCount++) {
+ Addr = 0;
+ Pattern = 0;
+ while ((UINT32) Addr < BlockSize) {
+ Value = *Addr;
+ if (Value != Pattern) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "!!! Normal mode memory test FAILED !!!\n");
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_ERROR,
+ "Address: %Xh, Expected data: %Xh, Actual data: %Xh.\n",
+ Addr,
+ Pattern,
+ Value
+ );
+ return mrcFail;
+ }
+ Addr++;
+ Pattern++;
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Normal mode memory test passed.\n");
+ return mrcSuccess;
+}
+
+#ifndef TXT_SUPPORT_FLAG
+/**
+ Determines whether or not the platform has executed a TXT launch by
+ examining the TPM Establishment bit.
+
+ @param[in] PeiServices - General purpose services available to every PEIM.
+
+ @retval TRUE - If the TPM establishment bit is asserted.
+ @retval FALSE - If the TPM establishment bit is unasserted.
+**/
+BOOLEAN
+IsEstablishmentBitAsserted (
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ UINT8 Access;
+ UINT16 TimeOutCount;
+ EFI_STATUS Status;
+ PEI_STALL_PPI *StallPpi;
+ Status = (*PeiServices)->LocatePpi (PeiServices, &gPeiStallPpiGuid, 0, NULL, (VOID **) &StallPpi);
+ ASSERT_EFI_ERROR (Status);
+
+
+ //
+ // Set TPM.ACCESS polling timeout about 750ms.
+ //
+ TimeOutCount = TPM_TIME_OUT;
+ do {
+ //
+ // Read TPM status register
+ //
+
+ Access = (*PeiServices)->CpuIo->MemRead8 (
+ PeiServices,
+ (*PeiServices)->CpuIo,
+ TPM_STATUS_REG_ADDRESS
+ );
+
+ //
+ // if TPM.Access == 0xFF, TPM is not present.
+ //
+ if (Access == 0xFF) {
+ return FALSE;
+ }
+ //
+ // Check tpmRegValidSts bit before checking establishment bit.
+ //
+ if ((Access & 0x80) == 0x80) {
+ //
+ // tpmRegValidSts set, we can check establishment bit now.
+ //
+ break;
+ }
+ else {
+ //
+ // Delay 1ms
+ //
+ StallPpi->Stall (PeiServices, StallPpi, 1000);
+ }
+
+ TimeOutCount--;
+ } while (TimeOutCount != 0);
+
+ //
+ // ValidSts is not set.
+ //
+ if ((Access & 0x80) != 0x80) {
+ return FALSE;
+ }
+ //
+ // The bit we're interested in uses negative logic:
+ // If bit 0 == 1 then return False,
+ // Else return True.
+ //
+ return (BOOLEAN) ((Access & 0x1) ? FALSE : TRUE);
+}
+
+/**
+ Unlock memory when security is set and TxT is not enabled.
+
+ @param[in] MrcData - Mrc global data.
+ @param[in] PeiServices - PEI Services Table.
+
+ @retval Nothing
+**/
+void
+UnlockMemory (
+ IN const MrcParameters *const MrcData,
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_CPUID_REGISTER Reg;
+ UINT32 Data32;
+ const MrcDebug *Debug;
+
+ Debug = &MrcData->SysIn.Inputs.Debug;
+
+ Data32 = 0;
+
+ EfiCpuid (1, &Reg);
+ if ((Reg.RegEcx & BIT6)) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Processor supports TXT\n");
+
+ Data32 = CheckSmxCapabilities();
+
+ if (Data32 & BIT0) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Platform / PCH supports TXT\n");
+ if (!(IsEstablishmentBitAsserted (PeiServices))) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Unlock memory\n");
+ EfiWriteMsr (0x2e6, 0);
+ }
+ }
+ else {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Platform / PCH does not support TxT\n");
+ }
+ }
+ else {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Processor does not support TxT\n");
+ }
+}
+#endif // TXT_SUPPORT_FLAG
+
+/**
+ Determine whether a cold reset of the platform is required.
+ Note that the memory configuration saved data must be valid.
+
+ @param[in] MrcData - The MRC "global data" area.
+ @param[in] SaPlatformPolicyPpi - SA Platform Policy structure.
+
+ @retval TRUE if cold reset is required, otherwise returns FALSE.
+**/
+BOOLEAN
+ColdBootRequired (
+ IN const MrcParameters *const MrcData,
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi
+ )
+{
+ const MrcDebug *Debug;
+ const MrcInput *Inputs;
+ const MrcSaveData *SaveData;
+ MEMORY_CONFIGURATION *MemConfig;
+ MrcVersion Version;
+ U32 CurrentCrc;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ SaveData = &MrcData->SysSave.Save.Data;
+ MemConfig = SaPlatformPolicyPpi->MemConfig;
+
+ MrcVersionGet (&Version);
+ CurrentCrc = MrcCalculateCrc32 ((U8 *) MemConfig, sizeof (MEMORY_CONFIGURATION));
+
+ if ((Version.Major != SaveData->Version.Major) ||
+ (Version.Minor != SaveData->Version.Minor) ||
+ (Version.Rev != SaveData->Version.Rev) ||
+ (Version.Build != SaveData->Version.Build)) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "MRC change detected, prev. ver. %u.%u.%u.%u, curr. ver. %u.%u.%u.%u\n",
+ SaveData->Version.Major,
+ SaveData->Version.Minor,
+ SaveData->Version.Rev,
+ SaveData->Version.Build,
+ Version.Major,
+ Version.Minor,
+ Version.Rev,
+ Version.Build
+ );
+ return TRUE;
+ }
+ if ((Inputs->CpuModel != SaveData->CpuModel) || (Inputs->CpuStepping != SaveData->CpuStepping)) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "CPU change detected, prev. CPU %x.%x, curr. CPU %x.%x\n",
+ SaveData->CpuModel,
+ SaveData->CpuStepping,
+ Inputs->CpuModel,
+ Inputs->CpuStepping
+ );
+ return TRUE;
+ }
+ if (CurrentCrc != SaveData->SaMemCfgCrc) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "System Agent input parameter change detected, prev. CRC %xh, curr. CRC %xh.\n",
+ SaveData->SaMemCfgCrc,
+ CurrentCrc
+ );
+
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/**
+ Set up the MRC input data structure.
+
+ @param[in] SysBootMode - Boot mode of the system.
+ @param[in] BootMode - Boot mode of the Mrc.
+ @param[out] Inputs - Pointer to the Mrc Input data structure.
+ @param[in] PeiServices - PEI Services Table.
+ @param[in] SaPlatformPolicyPpi - SA Platform Policy structure.
+
+ @retval Always returns mrcSuccess.
+**/
+MrcBootMode
+MrcSetupMrcData (
+ IN const EFI_BOOT_MODE SysBootMode,
+ IN const MrcBootMode BootMode,
+ OUT MrcInput *const Inputs,
+ IN EFI_PEI_SERVICES **const PeiServices,
+ IN SA_PLATFORM_POLICY_PPI *const SaPlatformPolicyPpi
+ )
+{
+ const MEMORY_CONFIGURATION *MemConfig;
+ const MrcDebug *Debug;
+ MrcControllerIn *ControllerIn;
+ MrcChannelIn *ChannelIn;
+ U16 DeviceId;
+ U8 Controller;
+ U8 Channel;
+ U8 Dimm;
+
+ Debug = &Inputs->Debug;
+ MemConfig = SaPlatformPolicyPpi->MemConfig;
+
+ Inputs->SaMemCfgAddress = (U32) MemConfig;
+ Inputs->SaMemCfgSize = sizeof (MEMORY_CONFIGURATION);
+ Inputs->RefClk = 0;
+ Inputs->Ratio = 0;
+ Inputs->VddVoltage = VDD_INVALID;
+
+ // Setup the memory profile (Standard/XMP/Custom)
+ switch (MemConfig->SpdProfileSelected) {
+#if (SUPPORT_XMP == SUPPORT)
+ case XMPProfile1:
+ Inputs->MemoryProfile = (SysBootMode == BOOT_WITH_DEFAULT_SETTINGS) ? STD_PROFILE : XMP_PROFILE1;
+ break;
+ case XMPProfile2:
+ Inputs->MemoryProfile = (SysBootMode == BOOT_WITH_DEFAULT_SETTINGS) ? STD_PROFILE : XMP_PROFILE2;
+ break;
+#endif // SUPPORT_XMP
+ case UserDefined:
+ if (SysBootMode == BOOT_WITH_DEFAULT_SETTINGS) {
+ Inputs->MemoryProfile = STD_PROFILE;
+ } else {
+ Inputs->MemoryProfile = USER_PROFILE;
+ Inputs->RefClk = MemConfig->RefClk;
+ Inputs->Ratio = MemConfig->Ratio;
+ Inputs->VddVoltage = MemConfig->DDR3Voltage;
+ }
+ break;
+ case Default:
+ default:
+ Inputs->MemoryProfile = STD_PROFILE;
+ break;
+ }
+
+ // Setup the base addresses.
+ Inputs->MchBarBaseAddress = SaPlatformPolicyPpi->PlatformData->MchBar;
+ Inputs->PciEBaseAddress = SaPlatformPolicyPpi->PlatformData->PciExpressBar;
+ Inputs->SmbusBaseAddress = SaPlatformPolicyPpi->PlatformData->SmbusBar;
+ Inputs->GdxcBaseAddress = SaPlatformPolicyPpi->PlatformData->GdxcBar;
+ Inputs->HpetBaseAddress = 0xFED00000;
+
+ //
+ // MMIO size in MB units (below 4GB)
+ //
+ Inputs->MmioSize = SaPlatformPolicyPpi->GtConfig->MmioSize;
+
+ //
+ // DDR maximum frequency
+ //
+ Inputs->FreqMax = MemConfig->DdrFreqLimit;
+
+ //
+ // TSEG Size in MB units
+ //
+ Inputs->TsegSize = (SaPlatformPolicyPpi->PlatformData->TsegSize) >> 20;
+
+ //
+ // Graphics Stolen Size
+ //
+ Inputs->GraphicsGttSize = SaPlatformPolicyPpi->GtConfig->GttSize;
+ // IgdDvmt50PreAlloc value 17 represents 1024M memory - WA for GMS limitation of 5 bits.
+ if (SaPlatformPolicyPpi->GtConfig->IgdDvmt50PreAlloc == 17) {
+ Inputs->GraphicsStolenSize = 32 * 32;
+ } else {
+ Inputs->GraphicsStolenSize = 32 * SaPlatformPolicyPpi->GtConfig->IgdDvmt50PreAlloc;
+ }
+ Inputs->GfxIsVersatileAcceleration = FALSE;
+
+ //
+ //Get RTC time
+ //
+ MrcOemGetRtcTime(&(Inputs->BaseTime.Seconds),&(Inputs->BaseTime.Minutes),
+ &(Inputs->BaseTime.Hours), &(Inputs->BaseTime.DayOfMonth),
+ &(Inputs->BaseTime.Month), &(Inputs->BaseTime.Year) );
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "RTC %u/%u/%u %u:%u:%u\n",
+ Inputs->BaseTime.Month, Inputs->BaseTime.DayOfMonth,
+ Inputs->BaseTime.Year, Inputs->BaseTime.Hours,
+ Inputs->BaseTime.Minutes, Inputs->BaseTime.Seconds);
+
+ //
+ // Get BoardType (Mobile - 0; Desktop/UpServer - 1)
+ //
+ Inputs->BoardType = SaPlatformPolicyPpi->PlatformData->UserBd;
+ DeviceId = McD0PciCfg16 (R_SA_MC_DEVICE_ID);
+ Inputs->MobilePlatform = (IS_SA_DEVICE_ID_MOBILE(DeviceId)) ? TRUE : FALSE;
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "BoardType=%d, MobilePlatform=%d\n", Inputs->BoardType, Inputs->MobilePlatform);
+
+ //
+ // Get memory voltages requested value.
+ //
+ Inputs->VddSettleWaitTime = MemConfig->DDR3VoltageWaitTime;
+ Inputs->VccIomV = 1000; // Assume 1.0 volts
+
+ Inputs->SetRxDqs32 = FALSE;
+ Inputs->McLock = MemConfig->McLock;
+
+ Inputs->Gdxc.GdxcEnable = MemConfig->GdxcEnable; // Enable/disable GDXC support
+ Inputs->Gdxc.GdxcIotSize = MemConfig->GdxcIotSize; // Value in 8MB
+ Inputs->Gdxc.GdxcMotSize = MemConfig->GdxcMotSize; // Value in 8MB
+
+ Inputs->MemoryTrace = MemConfig->MemoryTrace; // Memory Trace to second DDR channel using Stacked Mode
+
+ //
+ // Options for training steps
+ //
+ Inputs->TrainingEnables.ECT = MemConfig->ECT;
+ Inputs->TrainingEnables.SOT = MemConfig->SOT;
+ Inputs->TrainingEnables.RDMPRT = MemConfig->RDMPRT;
+ Inputs->TrainingEnables.RCVET = MemConfig->RCVET;
+ Inputs->TrainingEnables.JWRL = MemConfig->JWRL;
+ Inputs->TrainingEnables.FWRL = MemConfig->FWRL;
+ Inputs->TrainingEnables.WRTC1D = MemConfig->WRTC1D;
+ Inputs->TrainingEnables.RDTC1D = MemConfig->RDTC1D;
+ Inputs->TrainingEnables.DIMMODTT = MemConfig->DIMMODTT;
+ Inputs->TrainingEnables.WRDST = MemConfig->WRDST;
+ Inputs->TrainingEnables.WREQT = MemConfig->WREQT;
+ Inputs->TrainingEnables.RDODTT = MemConfig->RDODTT;
+ Inputs->TrainingEnables.RDEQT = MemConfig->RDEQT;
+ Inputs->TrainingEnables.RDAPT = MemConfig->RDAPT;
+ Inputs->TrainingEnables.WRTC2D = MemConfig->WRTC2D;
+ Inputs->TrainingEnables.RDTC2D = MemConfig->RDTC2D;
+ Inputs->TrainingEnables.WRVC2D = MemConfig->WRVC2D;
+ Inputs->TrainingEnables.RDVC2D = MemConfig->RDVC2D;
+ Inputs->TrainingEnables.LCT = MemConfig->LCT;
+ Inputs->TrainingEnables.RTL = MemConfig->RTL;
+ Inputs->TrainingEnables.TAT = MemConfig->TAT;
+ Inputs->TrainingEnables.RMT = MemConfig->RMT;
+ Inputs->TrainingEnables.MEMTST = MemConfig->MEMTST;
+
+ if (SaPlatformPolicyPpi->Revision >= SA_PLATFORM_POLICY_PPI_REVISION_2) {
+ Inputs->TrainingEnables.DIMMODTT1D = MemConfig->DIMMODTT1D;
+ Inputs->TrainingEnables.WRSRT = MemConfig->WRSRT;
+ Inputs->TrainingEnables.DIMMRONT = MemConfig->DIMMRONT;
+ } else {
+ Inputs->TrainingEnables.DIMMODTT1D = 0;
+ Inputs->TrainingEnables.WRSRT = 0;
+ Inputs->TrainingEnables.DIMMRONT = 1;
+ }
+
+ if (SaPlatformPolicyPpi->Revision >= SA_PLATFORM_POLICY_PPI_REVISION_4) {
+ Inputs->TrainingEnables.CMDVC = MemConfig->CMDVC;
+ Inputs->PowerDownMode = MemConfig->PowerDownMode;
+ Inputs->PwdwnIdleCounter = MemConfig->PwdwnIdleCounter;
+ Inputs->RankInterleave = MemConfig->RankInterleave;
+ Inputs->EnhancedInterleave = MemConfig->EnhancedInterleave;
+ Inputs->WeaklockEn = MemConfig->WeaklockEn;
+ Inputs->EnCmdRate = MemConfig->EnCmdRate;
+ Inputs->CmdTriStateDis = MemConfig->CmdTriStateDis;
+ } else {
+ Inputs->TrainingEnables.CMDVC = 1;
+ Inputs->PowerDownMode = 0xFF;
+ Inputs->PwdwnIdleCounter = 0x40;
+ Inputs->RankInterleave = TRUE;
+ Inputs->EnhancedInterleave = TRUE;
+ Inputs->WeaklockEn = FALSE;
+ Inputs->EnCmdRate = 7;
+ Inputs->CmdTriStateDis = FALSE;
+ }
+
+ if (SaPlatformPolicyPpi->Revision >= SA_PLATFORM_POLICY_PPI_REVISION_5) {
+ Inputs->BClkFrequency = (MemConfig->BClkFrequency < (BCLK_DEFAULT - (10 * 1000 * 1000))) ?
+ BCLK_DEFAULT : ((MemConfig->BClkFrequency / 1000000) * 1000000);
+ } else {
+ Inputs->BClkFrequency = BCLK_DEFAULT;
+ }
+
+ if (SaPlatformPolicyPpi->Revision >= SA_PLATFORM_POLICY_PPI_REVISION_6) {
+ Inputs->TrainingEnables.ALIASCHK = MemConfig->ALIASCHK;
+ } else {
+ Inputs->TrainingEnables.ALIASCHK = 1;
+ }
+
+ if (SaPlatformPolicyPpi->Revision >= SA_PLATFORM_POLICY_PPI_REVISION_9) {
+ Inputs->IedSize = (SaPlatformPolicyPpi->PlatformData->IedSize) >> 20;
+ Inputs->RefreshRate2x = MemConfig->RefreshRate2x; // Tells the MRC to enable 2x Refresh.
+ Inputs->ChHashEnable = MemConfig->ChHashEnable; // Enale/disable CH HASH support
+ Inputs->ChHashMask = MemConfig->ChHashMask; // Addr bits[19:6] to include in Channel XOR function.
+ Inputs->ChHashInterleaveBit = MemConfig->ChHashInterleaveBit; // Valid values are 0 - 3 for BITS 6 -9
+ } else {
+ Inputs->IedSize = 0x04;
+ Inputs->RefreshRate2x = FALSE;
+ Inputs->ChHashEnable = TRUE; // Enale CH HASH support
+ Inputs->ChHashMask = 0x30CE; // Addr bits[19:6] to include in Channel XOR function.
+ Inputs->ChHashInterleaveBit = 1; // Valid values are 0 - 3 for BITS 6 -9
+ }
+
+ if (SaPlatformPolicyPpi->Revision >= SA_PLATFORM_POLICY_PPI_REVISION_10) {
+ //
+ // Options for Thermal settings
+ //
+ Inputs->ThermalEnables.EnableExtts = MemConfig->EnableExtts;
+ Inputs->ThermalEnables.EnableCltm = MemConfig->EnableCltm;
+ Inputs->ThermalEnables.EnableOltm = MemConfig->EnableOltm;
+ Inputs->ThermalEnables.EnablePwrDn = MemConfig->EnablePwrDn;
+#ifdef ULT_FLAG
+ if (Inputs->CpuModel == cmHSW_ULT) {
+ Inputs->ThermalEnables.EnablePwrDnLpddr = MemConfig->EnablePwrDnLpddr;
+ }
+#endif // ULT_FLAG
+ Inputs->ThermalEnables.Refresh2X = MemConfig->Refresh2X;
+ Inputs->ThermalEnables.LpddrThermalSensor = MemConfig->LpddrThermalSensor; // LPDDR MR4 temperature reads
+ Inputs->ThermalEnables.LockPTMregs = MemConfig->LockPTMregs;
+ Inputs->ThermalEnables.UserPowerWeightsEn = MemConfig->UserPowerWeightsEn;
+ Inputs->ThermalEnables.EnergyScaleFact = MemConfig->EnergyScaleFact;
+ Inputs->ThermalEnables.RaplPwrFl[1] = MemConfig->RaplPwrFlCh1;
+ Inputs->ThermalEnables.RaplPwrFl[0] = MemConfig->RaplPwrFlCh0;
+ Inputs->ThermalEnables.RaplLim2Lock = MemConfig->RaplLim2Lock;
+ Inputs->ThermalEnables.RaplLim2WindX = MemConfig->RaplLim2WindX;
+ Inputs->ThermalEnables.RaplLim2WindY = MemConfig->RaplLim2WindY;
+ Inputs->ThermalEnables.RaplLim2Ena = MemConfig->RaplLim2Ena;
+ Inputs->ThermalEnables.RaplLim2Pwr = MemConfig->RaplLim2Pwr;
+ Inputs->ThermalEnables.RaplLim1WindX = MemConfig->RaplLim1WindX;
+ Inputs->ThermalEnables.RaplLim1WindY = MemConfig->RaplLim1WindY;
+ Inputs->ThermalEnables.RaplLim1Ena = MemConfig->RaplLim1Ena;
+ Inputs->ThermalEnables.RaplLim1Pwr = MemConfig->RaplLim1Pwr;
+ Inputs->ThermalEnables.WarmThreshold[0][0] = MemConfig->WarmThresholdCh0Dimm0;
+ Inputs->ThermalEnables.WarmThreshold[0][1] = MemConfig->WarmThresholdCh0Dimm1;
+ Inputs->ThermalEnables.WarmThreshold[1][0] = MemConfig->WarmThresholdCh1Dimm0;
+ Inputs->ThermalEnables.WarmThreshold[1][1] = MemConfig->WarmThresholdCh1Dimm1;
+ Inputs->ThermalEnables.HotThreshold[0][0] = MemConfig->HotThresholdCh0Dimm0;
+ Inputs->ThermalEnables.HotThreshold[0][1] = MemConfig->HotThresholdCh0Dimm1;
+ Inputs->ThermalEnables.HotThreshold[1][0] = MemConfig->HotThresholdCh1Dimm0;
+ Inputs->ThermalEnables.HotThreshold[1][1] = MemConfig->HotThresholdCh1Dimm1;
+ Inputs->ThermalEnables.WarmBudget[0][0] = MemConfig->WarmBudgetCh0Dimm0;
+ Inputs->ThermalEnables.WarmBudget[0][1] = MemConfig->WarmBudgetCh0Dimm1;
+ Inputs->ThermalEnables.WarmBudget[1][0] = MemConfig->WarmBudgetCh1Dimm0;
+ Inputs->ThermalEnables.WarmBudget[1][1] = MemConfig->WarmBudgetCh1Dimm1;
+ Inputs->ThermalEnables.HotBudget[0][0] = MemConfig->HotBudgetCh0Dimm0;
+ Inputs->ThermalEnables.HotBudget[0][1] = MemConfig->HotBudgetCh0Dimm1;
+ Inputs->ThermalEnables.HotBudget[1][0] = MemConfig->HotBudgetCh1Dimm0;
+ Inputs->ThermalEnables.HotBudget[1][1] = MemConfig->HotBudgetCh1Dimm1;
+ Inputs->ThermalEnables.IdleEnergy[0][1] = MemConfig->IdleEnergyCh0Dimm1;
+ Inputs->ThermalEnables.IdleEnergy[0][0] = MemConfig->IdleEnergyCh0Dimm0;
+ Inputs->ThermalEnables.IdleEnergy[1][1] = MemConfig->IdleEnergyCh1Dimm1;
+ Inputs->ThermalEnables.IdleEnergy[1][0] = MemConfig->IdleEnergyCh1Dimm0;
+ Inputs->ThermalEnables.PdEnergy[0][1] = MemConfig->PdEnergyCh0Dimm1;
+ Inputs->ThermalEnables.PdEnergy[0][0] = MemConfig->PdEnergyCh0Dimm0;
+ Inputs->ThermalEnables.PdEnergy[1][1] = MemConfig->PdEnergyCh1Dimm1;
+ Inputs->ThermalEnables.PdEnergy[1][0] = MemConfig->PdEnergyCh1Dimm0;
+ Inputs->ThermalEnables.ActEnergy[0][1] = MemConfig->ActEnergyCh0Dimm1;
+ Inputs->ThermalEnables.ActEnergy[0][0] = MemConfig->ActEnergyCh0Dimm0;
+ Inputs->ThermalEnables.ActEnergy[1][1] = MemConfig->ActEnergyCh1Dimm1;
+ Inputs->ThermalEnables.ActEnergy[1][0] = MemConfig->ActEnergyCh1Dimm0;
+ Inputs->ThermalEnables.RdEnergy[0][1] = MemConfig->RdEnergyCh0Dimm1;
+ Inputs->ThermalEnables.RdEnergy[0][0] = MemConfig->RdEnergyCh0Dimm0;
+ Inputs->ThermalEnables.RdEnergy[1][1] = MemConfig->RdEnergyCh1Dimm1;
+ Inputs->ThermalEnables.RdEnergy[1][0] = MemConfig->RdEnergyCh1Dimm0;
+ Inputs->ThermalEnables.WrEnergy[0][1] = MemConfig->WrEnergyCh0Dimm1;
+ Inputs->ThermalEnables.WrEnergy[0][0] = MemConfig->WrEnergyCh0Dimm0;
+ Inputs->ThermalEnables.WrEnergy[1][1] = MemConfig->WrEnergyCh1Dimm1;
+ Inputs->ThermalEnables.WrEnergy[1][0] = MemConfig->WrEnergyCh1Dimm0;
+ Inputs->ThermalEnables.SrefCfgEna = MemConfig->SrefCfgEna;
+ Inputs->ThermalEnables.SrefCfgIdleTmr = MemConfig->SrefCfgIdleTmr;
+ Inputs->ThermalEnables.ThrtCkeMinDefeat = MemConfig->ThrtCkeMinDefeat;
+ Inputs->ThermalEnables.ThrtCkeMinTmr = MemConfig->ThrtCkeMinTmr;
+#ifdef ULT_FLAG
+ if (Inputs->CpuModel == cmHSW_ULT) {
+ Inputs->ThermalEnables.ThrtCkeMinDefeatLpddr = MemConfig->ThrtCkeMinDefeatLpddr;
+ Inputs->ThermalEnables.ThrtCkeMinTmrLpddr = MemConfig->ThrtCkeMinTmrLpddr;
+ }
+#endif // ULT_FLAG
+ } else {
+ Inputs->ThermalEnables.EnableExtts = 0;
+ Inputs->ThermalEnables.EnableCltm = 0;
+ Inputs->ThermalEnables.EnableOltm = 0;
+ Inputs->ThermalEnables.EnablePwrDn = 1;
+#ifdef ULT_FLAG
+ if (Inputs->CpuModel == cmHSW_ULT) {
+ Inputs->ThermalEnables.EnablePwrDnLpddr = 0;
+ }
+#endif // ULT_FLAG
+ Inputs->ThermalEnables.Refresh2X = 0;
+ Inputs->ThermalEnables.LpddrThermalSensor = 1; // Enable LPDDR MR4 temperature reads
+ Inputs->ThermalEnables.LockPTMregs = 0;
+ Inputs->ThermalEnables.EnergyScaleFact = 3;
+ Inputs->ThermalEnables.RaplLim2Lock = 0;
+ Inputs->ThermalEnables.RaplLim2WindX = 0;
+ Inputs->ThermalEnables.RaplLim2WindY = 0;
+ Inputs->ThermalEnables.RaplLim2Ena = 0;
+ Inputs->ThermalEnables.RaplLim2Pwr = 0;
+ Inputs->ThermalEnables.RaplLim1WindX = 0;
+ Inputs->ThermalEnables.RaplLim1WindY = 0;
+ Inputs->ThermalEnables.RaplLim1Ena = 0;
+ Inputs->ThermalEnables.RaplLim1Pwr = 0;
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ Inputs->ThermalEnables.RaplPwrFl[Channel] = 0;
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ Inputs->ThermalEnables.WarmThreshold[Channel][Dimm] = 0xFF;
+ Inputs->ThermalEnables.HotThreshold[Channel][Dimm] = 0xFF;
+ Inputs->ThermalEnables.WarmBudget[Channel][Dimm] = 0xFF;
+ Inputs->ThermalEnables.HotBudget[Channel][Dimm] = 0xFF;
+ Inputs->ThermalEnables.IdleEnergy[Channel][Dimm] = 0;
+ Inputs->ThermalEnables.PdEnergy[Channel][Dimm] = 0;
+ Inputs->ThermalEnables.ActEnergy[Channel][Dimm] = 0;
+ Inputs->ThermalEnables.RdEnergy[Channel][Dimm] = 0;
+ Inputs->ThermalEnables.WrEnergy[Channel][Dimm] = 0;
+ }
+ }
+ Inputs->ThermalEnables.SrefCfgEna = 1;
+ Inputs->ThermalEnables.SrefCfgIdleTmr = 0x200;
+ Inputs->ThermalEnables.ThrtCkeMinDefeat = 0;
+ Inputs->ThermalEnables.ThrtCkeMinTmr = 0x30;
+#ifdef ULT_FLAG
+ if (Inputs->CpuModel == cmHSW_ULT) {
+ Inputs->ThermalEnables.ThrtCkeMinDefeatLpddr = 1;
+ Inputs->ThermalEnables.ThrtCkeMinTmrLpddr = 0x40;
+ }
+#endif //ULT_FLAG
+ }
+
+ if (SaPlatformPolicyPpi->Revision >= SA_PLATFORM_POLICY_PPI_REVISION_11) {
+ Inputs->AutoSelfRefreshSupport = MemConfig->AutoSelfRefreshSupport;
+ Inputs->ExtTemperatureSupport = MemConfig->ExtTemperatureSupport;
+ Inputs->MaxRttWr = MemConfig->MaxRttWr;
+ } else {
+ Inputs->AutoSelfRefreshSupport = TRUE;
+ Inputs->ExtTemperatureSupport = TRUE;
+ Inputs->MaxRttWr = 0;
+ }
+
+ if (SaPlatformPolicyPpi->Revision >= SA_PLATFORM_POLICY_PPI_REVISION_12) {
+ Inputs->TrainingEnables.RCVENC1D = MemConfig->RCVENC1D;
+ } else {
+ Inputs->TrainingEnables.RCVENC1D = 1;
+ }
+
+ Inputs->TrainingEnables.RMC = (SaPlatformPolicyPpi->Revision >= SA_PLATFORM_POLICY_PPI_REVISION_15) ?
+ MemConfig->RMC : 1;
+
+ Inputs->MrcMode = MrcModeFull;
+ Inputs->Iteration = 0;
+
+ //
+ // Scrambler Suppport.
+ //
+ Inputs->ScramblerEnable = MemConfig->ScramblerSupport;
+
+ //
+ // Remap above 4G Support
+ //
+ Inputs->RemapEnable = MemConfig->RemapEnable;
+
+ // ECC support.
+ Inputs->EccSupport = MemConfig->EccSupport;
+
+ // RMT BDAT support.
+ Inputs->RmtBdatEnable = MemConfig->RmtBdatEnable;
+
+
+#ifdef ULT_FLAG
+ if (Inputs->CpuModel == cmHSW_ULT) {
+ //
+ // Interleaving mode of DQ/DQS pins - depends on board routing
+ //
+ Inputs->DqPinsInterleaved = MemConfig->DqPinsInterleaved;
+
+ //
+ // DRAM ODT is not used
+ //
+ Inputs->LpddrDramOdt = 0;
+
+ //
+ // Initialize the board-specific CMD/CTL/CLK and DQ/DQS mapping for LPDDR3
+ //
+ MrcOemLpddrBoardMapping (Inputs, SaPlatformPolicyPpi->PlatformData->BoardId);
+ }
+#endif // ULT_FLAG
+
+ // Decide which channels and DIMMs are enabled.
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerIn = &Inputs->Controller[Controller];
+ ControllerIn->ChannelCount = 0;
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelIn = &ControllerIn->Channel[Channel];
+ switch (MemConfig->DisableDimmChannel[Channel]) {
+ case 1:
+ ChannelIn->Dimm[0].Status = DIMM_DISABLED;
+ ChannelIn->Dimm[1].Status = DIMM_ENABLED;
+ ChannelIn->Status = CHANNEL_PRESENT;
+ ControllerIn->ChannelCount++;
+ ChannelIn->DimmCount = 1;
+ break;
+ case 2:
+ ChannelIn->Dimm[0].Status = DIMM_ENABLED;
+ ChannelIn->Dimm[1].Status = DIMM_DISABLED;
+ ChannelIn->Status = CHANNEL_PRESENT;
+ ControllerIn->ChannelCount++;
+ ChannelIn->DimmCount = 1;
+ break;
+ case 3:
+ ChannelIn->Dimm[0].Status = DIMM_DISABLED;
+ ChannelIn->Dimm[1].Status = DIMM_DISABLED;
+ ChannelIn->Status = CHANNEL_DISABLED;
+ ChannelIn->DimmCount = 0;
+ break;
+ default:
+ ChannelIn->Dimm[0].Status = DIMM_ENABLED;
+ ChannelIn->Dimm[1].Status = DIMM_ENABLED;
+ ChannelIn->Status = CHANNEL_PRESENT;
+ ControllerIn->ChannelCount++;
+ ChannelIn->DimmCount = 2;
+ break;
+ }
+ }
+ }
+
+ //
+ // Get DIMM SpdBaseAddresses.
+ //
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerIn = &Inputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelIn = &ControllerIn->Channel[Channel];
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ ChannelIn->Dimm[Dimm].SpdAddress =
+ SaPlatformPolicyPpi->PlatformData->SpdAddressTable[(Channel * MAX_DIMMS_IN_CHANNEL) + Dimm];
+ /// @todo Need code to detect disabling of individual DIMMs.
+ }
+ }
+ }
+
+#if (defined MEMORY_DOWN_SUPPORT && (MEMORY_DOWN_SUPPORT > 0))
+ EnableMemoryDown (Inputs, SaPlatformPolicyPpi->PlatformData->BoardId);
+#endif
+
+ switch (BootMode) {
+ case bmWarm:
+ CheckForTimingOverride (Inputs, SaPlatformPolicyPpi);
+ return bmWarm;
+
+ case bmS3:
+ CheckForTimingOverride (Inputs, SaPlatformPolicyPpi);
+ return bmS3;
+
+ case bmFast:
+ //
+ // Read SPD data.
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "FAST BOOT GetSpdData\n");
+ MrcGetSpdData (BootMode, Inputs);
+ CheckForTimingOverride (Inputs, SaPlatformPolicyPpi);
+ return bmFast;
+
+ default:
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "ERROR: Invalid flow specified, defaulting to cold flow\n");
+ // No break. Note that the boot mode changes to bmCold.
+
+ case bmCold:
+ //
+ // Read SPD data.
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "COLD BOOT GetSpdData\n");
+ MrcGetSpdData (BootMode, Inputs);
+ CheckForTimingOverride (Inputs, SaPlatformPolicyPpi);
+ break;
+ }
+
+ return bmCold;
+}
+
+/**
+ Check to see if user defined profile is selected and if it is, then copy the
+ timing settings for this profile to the timing override structure. If user
+ defined profile is not selected, then set the timing override structure to 0.
+
+ Note that even though we set timings on a DIMM by DIMM basis, the controller
+ may force DIMM timings to be the same for all DIMMs in a channel.
+
+ @param[in, out] Inputs - The MRC Input data structure.
+ @param[in] SaPlatformPolicyPpi - The Peim to Peim interface of SaPlatformPolicy.
+
+ @retval Nothing
+**/
+void
+CheckForTimingOverride (
+ IN OUT MrcInput *const Inputs,
+ IN SA_PLATFORM_POLICY_PPI *const SaPlatformPolicyPpi
+ )
+{
+ const MEMORY_CONFIGURATION *MemConfig;
+ MrcControllerIn *ControllerIn;
+ MrcChannelIn *ChannelIn;
+ MrcDimmIn *DimmIn;
+ U8 Controller;
+ U8 Channel;
+ U8 Dimm;
+
+ //
+ // Override DIMM timing settings for customer profile setting.
+ //
+ if (Inputs->MemoryProfile == USER_PROFILE) {
+ MemConfig = SaPlatformPolicyPpi->MemConfig;
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerIn = &Inputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelIn = &ControllerIn->Channel[Channel];
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmIn = &ChannelIn->Dimm[Dimm];
+ DimmIn->Timing.NMode = MemConfig->NModeSupport;
+ DimmIn->Timing.tCL = MemConfig->tCL;
+ DimmIn->Timing.tCWL = MemConfig->tCWL;
+ DimmIn->Timing.tFAW = MemConfig->tFAW;
+ DimmIn->Timing.tRAS = MemConfig->tRAS;
+ DimmIn->Timing.tRC = MemConfig->tRC;
+ DimmIn->Timing.tRCD = MemConfig->tRCD;
+ DimmIn->Timing.tREFI = MemConfig->tREFI;
+ DimmIn->Timing.tRFC = MemConfig->tRFC;
+ DimmIn->Timing.tRP = MemConfig->tRP;
+ if (SaPlatformPolicyPpi->Revision >= SA_PLATFORM_POLICY_PPI_REVISION_6) {
+ DimmIn->Timing.tRPab = MemConfig->tRPab;
+ } else {
+ DimmIn->Timing.tRPab = 0;
+ }
+ DimmIn->Timing.tRRD = MemConfig->tRRD;
+ DimmIn->Timing.tRTP = MemConfig->tRTP;
+ DimmIn->Timing.tWR = MemConfig->tWR;
+ DimmIn->Timing.tWTR = MemConfig->tWTR;
+ }
+ }
+ }
+ }
+
+ return;
+}
+
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MemoryInit.cif b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MemoryInit.cif
new file mode 100644
index 0000000..2aee05c
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MemoryInit.cif
@@ -0,0 +1,102 @@
+<component>
+ name = "MemoryInit"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\SystemAgent\MemoryInit\Pei"
+ RefName = "MemoryInit"
+[files]
+"MemoryInit.sdl"
+"MemoryInit.mak"
+"MemInfoHob.h"
+"MemoryInit.c"
+"MemoryInit.dxs"
+"MemoryInit.h"
+"MemoryInit.inf"
+"MrcDebugHook.h"
+"MrcOemDebugPrint.c"
+"MrcOemDebugPrint.h"
+"MrcOemIo.c"
+"MrcOemIo.h"
+"MrcOemMemory.c"
+"MrcOemMemory.h"
+"MrcOemMmio.c"
+"MrcOemMmio.h"
+"MrcOemPlatform.c"
+"MrcOemPlatform.h"
+"MrcOemSmbus.c"
+"MrcOemSmbus.h"
+"MrcSpdDriver.c"
+"MrcSpdDriver.h"
+"Source\Api\MrcApi.h"
+"Source\Api\MrcBdat.c"
+"Source\Api\MrcBdat.h"
+"Source\Api\MrcGeneral.c"
+"Source\Api\MrcGeneral.h"
+"Source\Api\MrcMemoryScrub.c"
+"Source\Api\MrcMemoryScrub.h"
+"Source\Api\MrcSaveRestore.c"
+"Source\Api\MrcSaveRestore.h"
+"Source\Api\MrcStartMemoryConfiguration.c"
+"Source\Api\MrcStartMemoryConfiguration.h"
+"Source\Include\McAddress.h"
+"Source\Include\MrcCommandTraining.h"
+"Source\Include\MrcCommon.h"
+"Source\Include\MrcCrosser.h"
+"Source\Include\MrcDdr3.h"
+"Source\Include\MrcDdr3Registers.h"
+"Source\Include\MrcGlobal.h"
+"Source\Include\MrcIoControl.h"
+"Source\Include\MrcMcConfiguration.h"
+"Source\Include\MrcMemoryMap.h"
+"Source\Include\MrcOem.h"
+"Source\Include\MrcReset.h"
+"Source\Include\MrcRmtData.h"
+"Source\Include\MrcSpdData.h"
+"Source\Include\MrcTypes.h"
+"Source\Include\MrcVersion.h"
+"Source\Include\MrcRegisters\McGdxcbar.h"
+"Source\Include\MrcRegisters\McIoCkeCtl.h"
+"Source\Include\MrcRegisters\McIoClk.h"
+"Source\Include\MrcRegisters\McIoCmd.h"
+"Source\Include\MrcRegisters\McIoComp.h"
+"Source\Include\MrcRegisters\McIoData.h"
+"Source\Include\MrcRegisters\McMain.h"
+"Source\Include\MrcRegisters\McScramble.h"
+"Source\Include\MrcRegisters\Msa.h"
+"Source\Include\MrcRegisters\Pci000.h"
+"Source\McConfiguration\MrcAddressDecodeConfiguration.c"
+"Source\McConfiguration\MrcAddressDecodeConfiguration.h"
+"Source\McConfiguration\MrcPowerModes.c"
+"Source\McConfiguration\MrcPowerModes.h"
+"Source\McConfiguration\MrcRefreshConfiguration.c"
+"Source\McConfiguration\MrcRefreshConfiguration.h"
+"Source\McConfiguration\MrcSchedulerParameters.c"
+"Source\McConfiguration\MrcSchedulerParameters.h"
+"Source\McConfiguration\MrcTimingConfiguration.c"
+"Source\McConfiguration\MrcTimingConfiguration.h"
+"Source\ReadTraining\MrcReadDqDqs.c"
+"Source\ReadTraining\MrcReadDqDqs.h"
+"Source\ReadTraining\MrcReadReceiveEnable.c"
+"Source\ReadTraining\MrcReadReceiveEnable.h"
+"Source\Services\MrcCommandTraining.c"
+"Source\Services\MrcCommon.c"
+"Source\Services\MrcCrosser.c"
+"Source\Services\MrcDdr3.c"
+"Source\Services\MrcIoControl.c"
+"Source\Services\MrcMcConfiguration.c"
+"Source\Services\MrcMemoryMap.c"
+"Source\Services\MrcReset.c"
+"Source\SpdProcessing\MrcSpdProcessing.c"
+"Source\SpdProcessing\MrcSpdProcessing.h"
+"Source\WriteTraining\MrcWriteDqDqs.c"
+"Source\WriteTraining\MrcWriteDqDqs.h"
+"Source\WriteTraining\MrcWriteLeveling.c"
+"Source\WriteTraining\MrcWriteLeveling.h"
+"MrcSsaServices.c"
+"MrcSsaServices.h"
+"SsaCallbackPeim.h"
+"MrcOemAddrDecode.c"
+"MrcOemAddrDecode.h"
+"Source\AddrDecode\MrcHswMcAddrDecode.c"
+"Source\AddrDecode\MrcHswMcAddrDecode.h"
+"Source\Include\MrcRegisters\PttHciRegs.h"
+<endComponent>
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MemoryInit.dxs b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MemoryInit.dxs
new file mode 100644
index 0000000..7716fdd
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MemoryInit.dxs
@@ -0,0 +1,78 @@
+/**
+
+Copyright (c) 2005-2013 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+
+Module Name:
+
+ MemInit.dxs
+
+Abstract:
+
+ Dependency expression file for Memory Init PEIM.
+
+**/
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "PeimDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+
+#include EFI_PPI_DEPENDENCY (PlatformMemoryRange)
+#include EFI_PPI_DEPENDENCY (BaseMemoryTest)
+#include EFI_PPI_DEPENDENCY (Variable)
+#include EFI_PPI_DEPENDENCY (PlatformMemorySize)
+#include EFI_PPI_DEPENDENCY (Smbus)
+#include EFI_PPI_DEPENDENCY (SaPlatformPolicy)
+#include EFI_PPI_DEPENDENCY (CpuPlatformPolicy)
+#include EFI_PPI_DEPENDENCY (SaPeiInit)
+#include EFI_PPI_CONSUMER (BootMode)
+#include EFI_PPI_DEPENDENCY (Wdt)
+#include EFI_PPI_DEPENDENCY (PchMeUma)
+
+#ifdef TXT_SUPPORT_FLAG
+#include EFI_PPI_DEFINITION (TxtMemoryUnlocked)
+#include EFI_PPI_DEPENDENCY (Stall)
+// #include "ppi\TcgPeiDone.h"
+#endif // TXT_SUPPORT_FLAG
+#ifdef RAPID_START_FLAG
+#include EFI_PPI_DEPENDENCY (RapidStart)
+#endif
+#endif
+
+DEPENDENCY_START
+#ifdef TXT_SUPPORT_FLAG
+ PEI_TXT_MEMORY_UNLOCKED_PPI_GUID AND
+ PEI_STALL_PPI_GUID AND
+#endif // TXT_SUPPORT_FLAG
+ PEI_PLATFORM_MEMORY_RANGE_PPI_GUID AND
+ PEI_BASE_MEMORY_TEST_GUID AND
+ PEI_MASTER_BOOT_MODE_PEIM_PPI AND
+ PEI_READ_ONLY_VARIABLE_ACCESS_PPI_GUID AND
+ PEI_PLATFORM_MEMORY_SIZE_PPI_GUID AND
+ PEI_SMBUS_PPI_GUID AND
+ SA_PLATFORM_POLICY_PPI_GUID AND
+ PEI_CPU_PLATFORM_POLICY_PPI_GUID AND
+ WDT_PPI_GUID AND
+ PCH_ME_UMA_PPI_GUID AND
+#ifdef RAPID_START_FLAG
+ RAPID_START_PPI_GUID AND
+#endif
+ SA_PEI_INIT_PPI_GUID
+DEPENDENCY_END
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MemoryInit.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MemoryInit.h
new file mode 100644
index 0000000..f8071fc
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MemoryInit.h
@@ -0,0 +1,388 @@
+/** @file
+ Memory Initialization PEIM.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#ifndef _MemoryInit_h_
+#define _MemoryInit_h_
+
+#include "EdkIIGluePeim.h"
+#include EFI_PPI_DEPENDENCY (SaPlatformPolicy)
+#include "MemInfoHob.h"
+///
+/// These header files are from MRC
+///
+#include "MrcTypes.h"
+#include "MrcApi.h"
+#include "MrcGlobal.h"
+#include "MrcGeneral.h"
+#include "MrcStartMemoryConfiguration.h"
+
+#include EFI_GUID_DEFINITION (SaDataHob)
+#ifdef SSA_FLAG
+#include "SsaCallbackPeim.h"
+#endif // SSA_FLAG
+
+
+///
+/// SMRAM range definitions
+///
+#define MC_ABSEG_HSEG_PHYSICAL_START 0x000A0000
+#define MC_ABSEG_HSEG_LENGTH 0x00020000
+#define MC_ABSEG_CPU_START 0x000A0000
+#define MC_HSEG_CPU_START 0xFEDA0000
+
+///
+/// See NonDistributed\ReferenceCode\Txt\BiosAcm\Txt.h
+///
+#define TXT_PUBLIC_BASE 0xFED30000
+
+///
+/// Maximum number of memory ranges supported by the memory controller
+///
+#define MAX_RANGES (SA_MC_MAX_ROWS + 8)
+#define MEM_EQU_4GB 0x100000000ULL
+
+///
+/// TPM Status and Time-out
+///
+#define TPM_STATUS_REG_ADDRESS 0xfed40000
+#define TPM_TIME_OUT 750
+
+#define PLATFORM_ID_MOBILE 1
+
+///
+/// Memory range types
+///
+typedef enum {
+ DualChannelDdrMainMemory,
+ DualChannelDdrSmramCacheable,
+ DualChannelDdrSmramNonCacheable,
+ DualChannelDdrGraphicsMemoryCacheable,
+ DualChannelDdrGraphicsMemoryNonCacheable,
+ DualChannelDdrReservedMemory,
+ DualChannelDdrMaxMemoryRangeType
+} PEI_DUAL_CHANNEL_DDR_MEMORY_RANGE_TYPE;
+
+///
+/// Memory map range information
+///
+#pragma pack(push, 1)
+typedef struct {
+ UINT8 RowNumber;
+ EFI_PHYSICAL_ADDRESS PhysicalAddress;
+ EFI_PHYSICAL_ADDRESS CpuAddress;
+ EFI_PHYSICAL_ADDRESS RangeLength;
+ PEI_DUAL_CHANNEL_DDR_MEMORY_RANGE_TYPE Type;
+} PEI_DUAL_CHANNEL_DDR_MEMORY_MAP_RANGE;
+#pragma pack(pop)
+
+/**
+@brief
+ Main starting point for system memory initialization.
+ 1. Get SysBootMode and MrcBootMode
+ 2. Locate SaPlatformPolicy PPI
+ 3. Locate S3DataPtr from SaPlatformPolicy.
+ 4. SaveDataValid := TRUE if S3DataPtr is not NULL.
+ 5. If SysBootMode is BOOT_ON_S3_RESUME and S3Data is not valid:
+ -> ASSERT.
+ 6. If MrcBootMode is Warm boot, but S3 data is not valid :
+ -> change MrcBootMode to Cold boot.
+ 7. If MrcBootMode is Cold boot:
+ -> Run MRC code
+ -> Save S3 Restore Data
+ Else
+ -> Run MRC_S3Resume
+ 8. Run MRC_Done().
+ 9. Install EFI memory HOBs.
+
+ @param[in] FfsHeader - Not used.
+ @param[in] PeiServices - General purpose services available to every PEIM.
+
+ @retval EFI_SUCCESS - Memory initialization completed successfully.
+ @retval EFI_NOT_READY - Cannot locate SA Platform Policy.
+ @retval EFI_NOT_FOUND - No S3 data in S3 Boot Mode.
+ @retval EFI_DEVICE_ERROR - MemoryInit failed or IOSAV Memory test failed.
+**/
+extern
+EFI_STATUS
+PeimMemoryInit (
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+ );
+
+
+/**
+@brief
+ This function installs memory for all paths except S3 resume.
+
+ @param[in] Inputs - MRC input structure.
+ @param[in] PeiServices - PEI Services table.
+ @param[in] SysBootMode - The specific boot path that is being followed.
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_OUT_OF_RESOURCES Out of Resources.
+**/
+extern
+EFI_STATUS
+InstallEfiMemory (
+ IN const MrcInput *const Inputs,
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_BOOT_MODE SysBootMode
+ );
+
+/**
+@brief
+ This function installs memory for the S3 resume path.
+
+ @param[in] Inputs - Mrc input data structure
+ @param[in] PeiServices - PEI services table.
+ @param[in] VariableServices - Pointer to EFI Variable PPI
+
+ @retval EFI_SUCCESS - The function completed successfully.
+ @retval EFI_OUT_OF_RESOURCES - Out of Resources.
+**/
+extern
+EFI_STATUS
+InstallS3Memory (
+ IN const MrcInput *const Inputs,
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_READ_ONLY_VARIABLE_PPI *VariableServices
+);
+
+/**
+@brief
+ Determine the memory size desired based on HOB memory information.
+
+ @param[in] PeiServices - PEI Services table.
+ @param[in, out] Size - The memory size to return.
+
+ @retval Nothing.
+**/
+extern
+void
+RetrieveRequiredMemorySize (
+ IN EFI_PEI_SERVICES **PeiServices,
+ OUT UINTN *Size
+ );
+
+/**
+@brief
+ Determine the Total DPR memory size needed based on the DPR directory in the SA Data HOB.
+
+ @param[in] PeiServices - PEI Services table.
+ @param[in, out] Size - The memory size in MB to return.
+
+ @retval Nothing.
+**/
+extern
+void
+CalculateTotalDprMemorySize (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN OUT UINT8 *Size
+ );
+
+/**
+@brief
+ Calculates the bases for each technology consuming the DPR region
+ and updates the SA Data HOB with the appropriate values in the Dpr
+ directory
+
+ @param[in] PeiServices - PEI Services table.
+ @param[in] Base - The memory base to return.
+ @param[in] TotalDprSizeMB - The total DPR size in MB
+
+ @retval Nothing.
+**/
+extern
+VOID
+UpdateDprHobInfo (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PHYSICAL_ADDRESS Base,
+ IN UINT8 TotalDprSizeMB
+ );
+
+/**
+@brief
+ Determine the memory size desired by GDXC
+
+ @param[in] PeiServices - PEI Services table.
+ @param[in, out] MotSize - The MOT memory size
+ @param[in, out] GdxcSize - The GDXC memory size
+
+ @retval Nothing.
+**/
+extern
+void
+RetrieveGdxcMemorySize (
+ IN EFI_PEI_SERVICES **PeiServices,
+ OUT UINT64 *MotSize,
+ OUT UINT64 *GdxcSize
+ );
+
+/**
+@brief
+ This function returns the memory ranges to be enabled, along with information
+ describing how the range should be used. The MemoryMap buffer will be filled in and
+ NumRanges will contain the actual number of memory ranges that are to be enabled.
+
+ @param[in] PeiServices - PEI Services Table.
+ @param[in, out] MemoryMap - Buffer to record details of the memory ranges to be enabled.
+ @param[in, out] NumRanges - On input, this contains the maximum number of memory ranges that
+ can be described in the MemoryMap buffer.
+
+ @retval EFI_SUCCESS - The function completed successfully.
+ @retval EFI_BUFFER_TOO_SMALL - The specified number of ranges is too large.
+**/
+extern
+EFI_STATUS
+GetMemoryMap (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN OUT PEI_DUAL_CHANNEL_DDR_MEMORY_MAP_RANGE *MemoryMap,
+ IN OUT UINT8 *NumRanges
+ );
+
+/**
+@brief
+ This function returns a pointer to the allocated hand off buffer.
+
+ @param[in] PeiServices - A pointer to the EFI PEI services table
+ @param[in, out] Hob - A pointer to where to store the pointer to the allocated data buffer.
+ @param[in] Size - The size of the buffer to get.
+
+ @retval EFI_SUCCESS - Hob is successfully built.
+ @retval Others - Error occured while creating the Hob.
+**/
+extern
+EFI_STATUS
+MrcGetHobForDataStorage (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN OUT HOB_SAVE_MEMORY_DATA **Hob,
+ IN UINT16 BlockSize
+ );
+
+/**
+@brief
+ A small memory test to quickly point out severe memory issues.
+
+ @param[in] Inputs - Pointer to the MRC Input data structure
+
+ @retval mrcFail on failure, otherwise mrcSuccess.
+**/
+extern
+MrcStatus
+BasicMemoryTest (
+ IN const MrcInput *const Inputs
+ );
+
+#ifndef TXT_SUPPORT_FLAG
+/**
+@brief
+ Determines whether or not the platform has executed a TXT launch by
+ examining the TPM Establishment bit.
+
+ @param[in] PeiServices - General purpose services available to every PEIM.
+
+ @retval TRUE - If the TPM establishment bit is asserted.
+ @retval FALSE - If the TPM establishment bit is unasserted.
+**/
+extern
+BOOLEAN
+IsEstablishmentBitAsserted (
+ IN EFI_PEI_SERVICES **PeiServices
+ );
+
+/**
+@brief
+ Unlock memory when security is set and TxT is not enabled.
+
+ @param[in] MrcData - Mrc global data.
+ @param[in] PeiServices - PEI Services Table.
+
+ @retval Nothing
+**/
+extern
+void
+UnlockMemory (
+ IN const MrcParameters *const MrcData,
+ IN EFI_PEI_SERVICES **PeiServices
+ );
+#endif /// TXT_SUPPORT_FLAG
+/**
+@brief
+ Determine whether a cold reset of the platform is required.
+ Note that the memory configuration saved data must be valid.
+
+ @param[in] MrcData - The MRC "global data" area.
+ @param[in] SaPlatformPolicyPpi - SA Platform Policy structure.
+
+ @retval TRUE if cold reset is required, otherwise returns FALSE.
+**/
+extern
+BOOLEAN
+ColdBootRequired (
+ IN const MrcParameters *const MrcData,
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi
+ );
+
+/**
+@brief
+ Set up the MRC input data structure.
+
+ @param[in] SysBootMode - Boot mode of the system.
+ @param[in] BootMode - Boot mode of the Mrc.
+ @param[out] Inputs - Pointer to the Mrc Input data structure.
+ @param[in] PeiServices - PEI Services Table.
+ @param[in] SaPlatformPolicyPpi - SA Platform Policy structure.
+
+ @retval Always returns mrcSuccess.
+**/
+extern
+MrcBootMode
+MrcSetupMrcData (
+ IN const EFI_BOOT_MODE SysBootMode,
+ IN const MrcBootMode BootMode,
+ OUT MrcInput *const Inputs,
+ IN EFI_PEI_SERVICES **const PeiServices,
+ IN SA_PLATFORM_POLICY_PPI *const SaPlatformPolicyPpi
+ );
+
+/**
+@brief
+ Check to see if user defined profile is selected and if it is, then copy the
+ timing settings for this profile to the timing override structure. If user
+ defined profile is not selected, then set the timing override structure to 0.
+
+ Note that even though we set timings on a DIMM by DIMM basis, the controller
+ may force DIMM timings to be the same for all DIMMs in a channel.
+
+ @param[in, out] Inputs - The MRC Input data structure.
+ @param[in] SaPlatformPolicyPpi - The Peim to Peim interface of SaPlatformPolicy.
+
+ @retval Nothing.
+**/
+extern
+void
+CheckForTimingOverride (
+ IN OUT MrcInput *const Inputs,
+ IN SA_PLATFORM_POLICY_PPI *const SaPlatformPolicyPpi
+ );
+
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MemoryInit.inf b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MemoryInit.inf
new file mode 100644
index 0000000..3ef88b6
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MemoryInit.inf
@@ -0,0 +1,234 @@
+## @file
+# Component description file for MemoryInit
+#
+#@copyright
+# Copyright (c) 1999 - 2014 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+
+[defines]
+BASE_NAME = MemoryInit
+FILE_GUID = 3B42EF57-16D3-44CB-8632-9FDB06B41451
+
+COMPONENT_TYPE = PE32_PEIM
+
+[sources.common]
+ MrcSsaServices.c
+ MrcSsaServices.h
+ MemInfoHob.h
+ MemoryInit.c
+ MemoryInit.h
+ MrcDebugHook.h
+ MrcOemAddrDecode.c
+ MrcOemAddrDecode.h
+ MrcOemDebugPrint.c
+ MrcOemDebugPrint.h
+ MrcOemIo.c
+ MrcOemIo.h
+ MrcOemMemory.c
+ MrcOemMemory.h
+ MrcOemMmio.c
+ MrcOemMmio.h
+ MrcOemPlatform.c
+ MrcOemPlatform.h
+ MrcOemSmbus.c
+ MrcOemSmbus.h
+ MrcSpdDriver.c
+ MrcSpdDriver.h
+ Source/AddrDecode/MrcHswMcAddrDecode.c
+ Source/AddrDecode/MrcHswMcAddrDecode.h
+ Source/Api/MrcApi.h
+ Source/Api/MrcBdat.c
+ Source/Api/MrcBdat.h
+ Source/Api/MrcGeneral.c
+ Source/Api/MrcGeneral.h
+ Source/Api/MrcMemoryScrub.c
+ Source/Api/MrcMemoryScrub.h
+ Source/Api/MrcSaveRestore.c
+ Source/Api/MrcSaveRestore.h
+ Source/Api/MrcStartMemoryConfiguration.c
+ Source/Api/MrcStartMemoryConfiguration.h
+ Source/Include/McAddress.h
+ Source/Include/MrcCommandTraining.h
+ Source/Include/MrcCommon.h
+ Source/Include/MrcCrosser.h
+ Source/Include/MrcDdr3.h
+ Source/Include/MrcDdr3Registers.h
+ Source/Include/MrcIoControl.h
+ Source/Include/MrcMcConfiguration.h
+ Source/Include/MrcMemoryMap.h
+ Source/Include/MrcOem.h
+ Source/Include/MrcReset.h
+ Source/Include/MrcRmtData.h
+ Source/Include/MrcSpdData.h
+ Source/Include/MrcTypes.h
+ Source/Include/MrcVersion.h
+ Source/Include/MrcRegisters/McGdxcbar.h
+ Source/Include/MrcRegisters/McIoCkeCtl.h
+ Source/Include/MrcRegisters/McIoClk.h
+ Source/Include/MrcRegisters/McIoCmd.h
+ Source/Include/MrcRegisters/McIoComp.h
+ Source/Include/MrcRegisters/McIoData.h
+ Source/Include/MrcRegisters/McMain.h
+ Source/Include/MrcRegisters/McScramble.h
+ Source/Include/MrcRegisters/Pci000.h
+ Source/McConfiguration/MrcAddressDecodeConfiguration.c
+ Source/McConfiguration/MrcAddressDecodeConfiguration.h
+ Source/McConfiguration/MrcPowerModes.c
+ Source/McConfiguration/MrcPowerModes.h
+ Source/McConfiguration/MrcRefreshConfiguration.c
+ Source/McConfiguration/MrcRefreshConfiguration.h
+ Source/McConfiguration/MrcSchedulerParameters.c
+ Source/McConfiguration/MrcSchedulerParameters.h
+ Source/McConfiguration/MrcTimingConfiguration.c
+ Source/McConfiguration/MrcTimingConfiguration.h
+ Source/ReadTraining/MrcReadDqDqs.c
+ Source/ReadTraining/MrcReadDqDqs.h
+ Source/ReadTraining/MrcReadReceiveEnable.c
+ Source/ReadTraining/MrcReadReceiveEnable.h
+ Source/Services/MrcCommandTraining.c
+ Source/Services/MrcCommon.c
+ Source/Services/MrcCrosser.c
+ Source/Services/MrcDdr3.c
+ Source/Services/MrcIoControl.c
+ Source/Services/MrcMcConfiguration.c
+ Source/Services/MrcMemoryMap.c
+ Source/Services/MrcReset.c
+ Source/SpdProcessing/MrcSpdProcessing.c
+ Source/SpdProcessing/MrcSpdProcessing.h
+ Source/WriteTraining/MrcWriteDqDqs.c
+ Source/WriteTraining/MrcWriteDqDqs.h
+ Source/WriteTraining/MrcWriteLeveling.c
+ Source/WriteTraining/MrcWriteLeveling.h
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGluePeimEntryPoint.c
+
+[includes.common]
+ .
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/MemoryInit/Pei/Source/AddrDecode
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/MemoryInit/Pei/Source/Api
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/MemoryInit/Pei/Source/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/MemoryInit/Pei/Source/Include/MrcRegisters
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/MemoryInit/Pei/Source/McConfiguration
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/MemoryInit/Pei/Source/ReadTraining
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/MemoryInit/Pei/Source/Services
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/MemoryInit/Pei/Source/SpdProcessing
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/MemoryInit/Pei/Source/WriteTraining
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Ppi/SsaPeiInit
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/PchMeUma
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/PchRegs
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include/Library
+#
+# Uncomment the following RapidStart include directories if RapidStart is supported
+#
+ $(EFI_SOURCE)/$(PROJECT_RAPID_START_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_RAPID_START_ROOT)/Include
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Cpu/Pentium/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include/Library
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include/Common
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include/Pcd
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Pei/Include
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Protocol/DebugMask
+
+
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/SampleCode/
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/SampleCode/Ppi
+#
+# Uncomment the following RapidStart include directories if RapidStart is supported
+#
+ $(EFI_SOURCE)/$(PROJECT_RAPID_START_ROOT)/Samplecode/Library/RapidStartCommonLib
+ $(EFI_SOURCE)/$(PROJECT_RAPID_START_ROOT)/Samplecode/Library/RapidStartPlatformLib/Pei
+
+
+[libraries.common]
+ EdkFrameworkGuidLib
+ EdkFrameworkPpiLib
+ EdkPpiLib
+ EdkGuidLib
+ SAGuidLib
+ $(PROJECT_SA_FAMILY)PpiLib
+ CpuPpiLib
+ CpuGuidLib
+ PeiLib
+ $(PROJECT_SA_FAMILY)SampleCodePpiLib
+ $(PROJECT_PCH_FAMILY)PpiLib
+ MeLibPpi
+ EfiGuidLib
+ EdkIIGlueBaseLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGluePeiDebugLibReportStatusCode
+ EdkIIGluePeiReportStatusCodeLib
+ EdkIIGluePeiServicesLib
+ EdkIIGluePeiMemoryAllocationLib
+ EdkIIGluePeiHobLib
+ EdkIIGluePeiSmbusLib
+ PchPlatformLib
+ EdkIIGlueBasePciLibPciExpress
+ EdkIIGlueBasePrintLib
+#
+# Uncomment the following RapidStart libraries if RapidStart is supported
+#
+# RapidStartCommonLib
+# RapidStartPpiLib
+# RapidStartPeiLib
+ CpuPlatformLib
+ TxtLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = MemoryInit.dxs
+#EcpOverride: add /GL- and macro MDE_CPU_IA32
+ C_FLAGS = $(C_FLAGS) /Oi /Gs65536 /Zi /Gm -DMDE_CPU_IA32
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=PeimMemoryInit\
+ -D __EDKII_GLUE_BASE_LIB__ \
+ -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_PEI_SERVICES_LIB__ \
+ -D __EDKII_GLUE_PEI_MEMORY_ALLOCATION_LIB__ \
+ -D __EDKII_GLUE_PEI_HOB_LIB__ \
+ -D __EDKII_GLUE_PEI_SMBUS_LIB__ \
+ -D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+ -DMEMORY_DOWN_SUPPORT=1
+# Uncomment the following RapidStart flags if RapidStart is supported
+# C_FLAGS = $(C_FLAGS) -DRAPID_START_FLAG
+# C_FLAGS = $(C_FLAGS) -DRAPID_START_NO_SMRAM_INTEGRITY_CHECK
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MemoryInit.mak b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MemoryInit.mak
new file mode 100644
index 0000000..8b79a2a
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MemoryInit.mak
@@ -0,0 +1,110 @@
+# MAK file for the ModulePart:MemoryInit
+
+all: $(BUILD_DIR)\MemoryInit.mak MemoryInitBin
+
+$(BUILD_DIR)\MemoryInit.mak : $(MemoryInit_DIR)\$(@B).cif $(MemoryInit_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(MemoryInit_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+MemoryInitBin_INCLUDES=\
+ $(PROJECT_CPU_INCLUDES) \
+ /I$(NB_BOARD_DIR)\
+ /I$(MemoryInit_DIR) \
+ /I$(MemoryInit_DIR)\Source\Include \
+ /I$(MemoryInit_DIR)\Source\Include\MrcRegisters \
+ /I$(MemoryInit_DIR)\Source\AddrDecode \
+ /I$(MemoryInit_DIR)\Source\Api \
+ /I$(INTEL_SYSTEM_AGENT_DIR)\SampleCode \
+ /I$(MemoryInit_DIR)\Source\ReadTraining \
+ /I$(MemoryInit_DIR)\Source\WriteTraining \
+ /I$(MemoryInit_DIR)\Source\SpdProcessing \
+ /I$(MemoryInit_DIR)\Source\McConfiguration \
+ /I$(MemoryInit_DIR)\Source\AggressiveTraining \
+ /I$(INTEL_SA_PPI_LIB_DIR)\EviPeiInit \
+ /I$(AcpiPlatform_DIR)\Include \
+ /I$(PROJECT_DIR)\Include \
+ $(PchMeUma_INCLUDES) \
+ $(ME_INCLUDES) \
+ $(INTEL_MCH_INCLUDES) \
+ $(INTEL_PCH_INCLUDES) \
+ $(EDK_INCLUDES) \
+ $(TXT_INCLUDES) \
+ $(EdkIIGlueLib_INCLUDES) \
+ $(RAPIDSTART_INCLUDES) \
+ /I$(RapidStartCommonLib_DIR) \
+
+MemoryInitBin_LIBS=\
+ $(AMIPEILIB) \
+ $(CPUIA32LIB) \
+ $(IntelSaSampleCodePpiLib_LIB) \
+ $(EDKPPILIB) \
+ $(EDKGUIDLIB) \
+ $(INTEL_SA_PPI_LIB) \
+ $(MeLibPpi_LIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EdkIIGlueBaseLibIA32_LIB)\
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB) \
+ $(EdkIIGluePeiDebugLibReportStatusCode_LIB) \
+ $(EdkIIGluePeiReportStatusCodeLib_LIB) \
+ $(EdkIIGluePeiServicesLib_LIB) \
+ $(EdkIIGluePeiMemoryAllocationLib_LIB) \
+ $(EdkIIGluePeiHobLib_LIB) \
+ $(EdkIIGluePeiSmbusLib_LIB) \
+ $(PEILIB)\
+ $(RapidStartPpiLib_LIB)\
+ $(RapidStartPeiLib_LIB)\
+ $(RapidStartCommonPeiLib_LIB)\
+ $(PchPlatformPeiLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB) \
+ $(IntelPchPpiLib_LIB)\
+ $(EdkIIGlueBasePrintLib_LIB) \
+ $(CPU_PPI_LIB) \
+ $(CpuPlatformLib_LIB)\
+ $(SaGuidLib_LIB)\
+ $(TxtLib_LIB)
+
+MemoryInitBin_DEFINES=\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=PeimMemoryInit"\
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_PEI_SERVICES_LIB__ \
+ /D __EDKII_GLUE_PEI_MEMORY_ALLOCATION_LIB__ \
+ /D __EDKII_GLUE_PEI_HOB_LIB__ \
+#!IFDEF SOFTSDV_FLAG
+# /D MRC_FLAG_SKIP_TRAINING\
+# /D MRC_FLAG_SKIP_JEDEC_RESET\
+#!ENDIF # SOFTSDV_FLAG
+
+# /DINCLUDE_ME_CODE\
+# /DSFF_SUPPORT\
+# /DDDR2_SUPPORT\
+# /DDDR3_SUPPORT\
+# /DDDR3LV_SUPPORT\
+# /DTHERMAL_SUPPORT\
+# /DPRE_PRODUCTION_WA_SUPPORT\
+# /DREAD_TRAINING_SUPPORT\
+# /DWRITE_TRAINING_SUPPORT\
+# /D"SO_DIMM_SUPPORT=1"
+
+MemoryInitBin: $(MemoryInitBin_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\MemoryInit.mak all\
+ NAME=MemoryInit\
+ MAKEFILE=$(BUILD_DIR)\MemoryInit.mak \
+ "CFLAGS=$(CFLAGS) /Oi /Gs65536 /Zi /Gm" \
+ "MY_INCLUDES=$(MemoryInitBin_INCLUDES)"\
+ "MY_DEFINES=$(MemoryInitBin_DEFINES)"\
+ GUID=3B42EF57-16D3-44CB-8632-9FDB06B41451\
+ ENTRY_POINT=_ModuleEntryPoint\
+ DEPEX1=$(MemoryInit_DIR)\MemoryInit.dxs\
+ DEPEX1_TYPE=EFI_SECTION_PEI_DEPEX\
+ TYPE=PEIM\
+ EDKIIModule=PEIM\
+ COMPRESS=0
+
+#
+# We use the following Microsoft Visual C++ Compiler options:
+# /Oi - Generate intrinsic functions (memset, memcpy etc.)
+# /Gs32768 - Limit stack checking calls to 32KB (default is 4KB)
+# /FAsc - may be used to produce the *.COD files (intermediate assembly)
+#
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MemoryInit.sdl b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MemoryInit.sdl
new file mode 100644
index 0000000..a472857
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MemoryInit.sdl
@@ -0,0 +1,273 @@
+TOKEN
+ Name = "MemoryInit_SUPPORT"
+ Value = "1"
+ Help = "SandyBridge MemoryInit support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+End
+
+TOKEN
+ Name = "MRC_DEBUG_PRINT_SUPPORT"
+ Value = "0"
+ TokenType = Boolean
+ TargetMAK = Yes
+ TargetH = Yes
+ Token = "DEBUG_MODE" "=" "1"
+End
+
+TOKEN
+ Name = "CAR_TOTAL_SIZE"
+ Value = "0x40000"
+ Help = "Total Cache-as-RAM size available (in bytes)"
+ TokenType = Integer
+ TargetEQU = Yes
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "ULT_SUPPORT"
+ Value = "0"
+ TokenType = Boolean
+ TargetMAK = Yes
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "ULT_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetMAK = Yes
+ TargetH = Yes
+ Token = "PCH_SKU" "=" "1"
+End
+
+TOKEN
+ Name = "VP_SUPPORT"
+ Value = "0"
+ TokenType = Boolean
+ TargetMAK = Yes
+End
+
+TOKEN
+ Name = "CTE_SUPPORT"
+ Value = "0"
+ TokenType = Boolean
+ TargetMAK = Yes
+End
+
+TOKEN
+ Name = "SLE_SUPPORT"
+ Value = "0"
+ TokenType = Boolean
+ TargetMAK = Yes
+End
+
+TOKEN
+ Name = "SSA_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetMAK = Yes
+End
+
+TOKEN
+ Name = "EMBEDDED_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetMAK = Yes
+End
+
+TOKEN
+ Name = " "
+ TokenType = Integer
+End
+
+TOKEN
+ Name = "=============== NB MRC Memory Down Tokens =============="
+ TokenType = Expression
+End
+
+TOKEN
+ Name = "MRC_MEMORY_DOWN_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetMAK = Yes
+End
+
+TOKEN
+ Name = "NB_OEM_DIMM1_STATUS"
+ Value = "2"
+ Help = "Memory slot 1 status. 0: Memory Absent, 1: Physical memory slot, 2: Memory down."
+ TokenType = Integer
+ TargetH = Yes
+ Range = "0, 1, 2"
+ Token = "MRC_MEMORY_DOWN_SUPPORT" "=" "1"
+End
+
+TOKEN
+ Name = "NB_OEM_DIMM2_STATUS"
+ Value = "2"
+ Help = "Memory slot 2 status. 0: Memory Absent, 1: Physical memory slot, 2: Memory down."
+ TokenType = Integer
+ TargetH = Yes
+ Range = "0, 1, 2"
+ Token = "MRC_MEMORY_DOWN_SUPPORT" "=" "1"
+End
+
+TOKEN
+ Name = "NB_OEM_DIMM3_STATUS"
+ Value = "2"
+ Help = "Memory slot 3 status. 0: Memory Absent, 1: Physical memory slot, 2: Memory down."
+ TokenType = Integer
+ TargetH = Yes
+ Range = "0, 1, 2"
+ Token = "MRC_MEMORY_DOWN_SUPPORT" "=" "1"
+End
+
+TOKEN
+ Name = "NB_OEM_DIMM4_STATUS"
+ Value = "2"
+ Help = "Memory slot 4 status. 0: Memory Absent, 1: Physical memory slot, 2: Memory down."
+ TokenType = Integer
+ TargetH = Yes
+ Range = "0, 1, 2"
+ Token = "MRC_MEMORY_DOWN_SUPPORT" "=" "1"
+End
+
+TOKEN
+ Name = "NB_OEM_DIMM1_SPD_DATA"
+ Value = "{0x92, 0x10, 0x0B, 0x02, 0x02, 0x11, 0x00, 0x09, 0x03, 0x52, 0x01, 0x08, 0x0A, 0x00, 0xFE, 0x00, 0x69, 0x78, 0x69, 0x30, 0x69, 0x11, 0x18, 0x81, 0x70, 0x03, 0x3C, 0x3C, 0x00, 0xF0, 0x83, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x11, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x98, 0x00, 0x11, 0x11, 0x6B, 0x22, 0x9A, 0x82, 0x11, 0x70}"
+ Help = "SPD data {0-127} = {Offset0, Offset1, Offset2, Offset3, ....}."
+ TokenType = Expression
+ TargetH = Yes
+ Range = "{0-127}"
+ Token = "NB_OEM_DIMM1_STATUS" "=" "2"
+End
+
+TOKEN
+ Name = "NB_OEM_DIMM2_SPD_DATA"
+ Value = "{0x92, 0x10, 0x0B, 0x02, 0x02, 0x11, 0x00, 0x09, 0x03, 0x52, 0x01, 0x08, 0x0A, 0x00, 0xFE, 0x00, 0x69, 0x78, 0x69, 0x30, 0x69, 0x11, 0x18, 0x81, 0x70, 0x03, 0x3C, 0x3C, 0x00, 0xF0, 0x83, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x11, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x98, 0x00, 0x11, 0x11, 0x6B, 0x22, 0x9A, 0x82, 0x11, 0x70}"
+ Help = "SPD data {0-127} = {Offset0, Offset1, Offset2, Offset3, ....}."
+ TokenType = Expression
+ TargetH = Yes
+ Range = "{0-127}"
+ Token = "NB_OEM_DIMM2_STATUS" "=" "2"
+End
+
+TOKEN
+ Name = "NB_OEM_DIMM3_SPD_DATA"
+ Value = "{0x92, 0x10, 0x0B, 0x02, 0x02, 0x11, 0x00, 0x09, 0x03, 0x52, 0x01, 0x08, 0x0A, 0x00, 0xFE, 0x00, 0x69, 0x78, 0x69, 0x30, 0x69, 0x11, 0x18, 0x81, 0x70, 0x03, 0x3C, 0x3C, 0x00, 0xF0, 0x83, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x11, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x98, 0x00, 0x11, 0x11, 0x6B, 0x22, 0x9A, 0x82, 0x11, 0x70}"
+ Help = "SPD data {0-127} = {Offset0, Offset1, Offset2, Offset3, ....}."
+ TokenType = Expression
+ TargetH = Yes
+ Range = "{0-127}"
+ Token = "NB_OEM_DIMM3_STATUS" "=" "2"
+End
+
+TOKEN
+ Name = "NB_OEM_DIMM4_SPD_DATA"
+ Value = "{0x92, 0x10, 0x0B, 0x02, 0x02, 0x11, 0x00, 0x09, 0x03, 0x52, 0x01, 0x08, 0x0A, 0x00, 0xFE, 0x00, 0x69, 0x78, 0x69, 0x30, 0x69, 0x11, 0x18, 0x81, 0x70, 0x03, 0x3C, 0x3C, 0x00, 0xF0, 0x83, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x11, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x98, 0x00, 0x11, 0x11, 0x6B, 0x22, 0x9A, 0x82, 0x11, 0x70}"
+ Help = "SPD data {0-127} = {Offset0, Offset1, Offset2, Offset3, ....}."
+ TokenType = Expression
+ TargetH = Yes
+ Range = "{0-127}"
+ Token = "NB_OEM_DIMM4_STATUS" "=" "2"
+End
+
+PATH
+ Name = "MemoryInit_DIR"
+End
+
+MODULE
+ Help = "Includes MemoryInit.mak to Project"
+ File = "MemoryInit.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\MemoryInit.ffs"
+ Parent = "MEM_INIT_FV_BB"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/D DDR3LV_SUPPORT"
+ Parent = "INTEL_SA_RC_FLAGS"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/D MEMORY_DOWN_SUPPORT=$(MRC_MEMORY_DOWN_SUPPORT)"
+ Parent = "INTEL_SA_RC_FLAGS"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/D TRAD_FLAG"
+ Parent = "INTEL_SA_RC_FLAGS"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/D ULT_FLAG"
+ Parent = "INTEL_SA_RC_FLAGS"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/D VP_FLAG"
+ Parent = "INTEL_SA_RC_FLAGS"
+ Token = "VP_SUPPORT" "=" "1"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/D CTE_FLAG"
+ Parent = "INTEL_SA_RC_FLAGS"
+ Token = "CTE_SUPPORT" "=" "1"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/D SLE_FLAG"
+ Parent = "INTEL_SA_RC_FLAGS"
+ Token = "SLE_SUPPORT" "=" "1"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/D ME_SUPPORT_FLAG"
+ Parent = "INTEL_SA_RC_FLAGS"
+ Token = "iME_SUPPORT" "=" "1"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/D TXT_SUPPORT_FLAG"
+ Parent = "INTEL_SA_RC_FLAGS"
+ Token = "TxtPei_SUPPORT" "=" "1"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/D SSA_FLAG"
+ Parent = "INTEL_SA_RC_FLAGS"
+ Token = "SSA_SUPPORT" "=" "1"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/D EMBEDDED_FLAG"
+ Parent = "INTEL_SA_RC_FLAGS"
+ Token = "EMBEDDED_SUPPORT" "=" "1"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/D SMM_THUNK_NO_AB_SEG_FLAG"
+ Parent = "INTEL_SA_RC_FLAGS"
+ Token = "SMM_THUNK_IN_CSM" "=" "1"
+ Token = "SMM_THUNK_NO_AB_SEG" "=" "0"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcDebugHook.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcDebugHook.h
new file mode 100644
index 0000000..e6ff6fc
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcDebugHook.h
@@ -0,0 +1,210 @@
+/** @file
+ This file defines all the MRC debug hooks.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _MrcDebugHook_h_
+#define _MrcDebugHook_h_
+
+#define MRC_FAILURE_INDICATION (0x0080) /// This value is or'ed with below "*_ERROR" codes
+#define MRC_INITIALIZATION_START (0xDD00)
+
+#define MRC_FAST_BOOT_PERMITTED (0xDD1B)
+#define MRC_FAST_BOOT_PERMITTED_ERROR (MRC_FAST_BOOT_PERMITTED | MRC_FAILURE_INDICATION)
+
+#define MRC_RESTORE_NON_TRAINING (0xDD1C)
+#define MRC_RESTORE_NON_TRAINING_ERROR (MRC_RESTORE_NON_TRAINING | MRC_FAILURE_INDICATION)
+
+#define MRC_PRINT_INPUT_PARAMS (0xDD1D)
+#define MRC_PRINT_INPUT_PARAMS_ERROR (MRC_PRINT_INPUT_PARAMS | MRC_FAILURE_INDICATION)
+
+#define MRC_SET_OVERRIDES_PSPD (0xDD1E)
+#define MRC_SET_OVERRIDES_PSPD_ERROR (MRC_SET_OVERRIDES_PSPD | MRC_FAILURE_INDICATION)
+
+#define MRC_MC_CAPABILITY_PSPD (0xDD1F)
+#define MRC_MC_CAPABILITY_PSPD_ERROR (MRC_MC_CAPABILITY_PSPD | MRC_FAILURE_INDICATION)
+
+#define MRC_SPD_PROCESSING (0xDD20)
+#define MRC_SPD_PROCESSING_ERROR (MRC_SPD_PROCESSING | MRC_FAILURE_INDICATION)
+
+#define MRC_SET_OVERRIDES (0xDD21)
+#define MRC_SET_OVERRIDES_ERROR (MRC_SET_OVERRIDES | MRC_FAILURE_INDICATION)
+
+#define MRC_MC_CAPABILITY (0xDD22)
+#define MRC_MC_CAPABILITY_ERROR (MRC_MC_CAPABILITY | MRC_FAILURE_INDICATION)
+
+#define MRC_MC_CONFIG (0xDD23)
+#define MRC_MC_CONFIG_ERROR (MRC_MC_CONFIG | MRC_FAILURE_INDICATION)
+
+#define MRC_MC_MEMORY_MAP (0xDD24)
+#define MRC_MC_MEMORY_MAP_ERROR (MRC_MC_MEMORY_MAP | MRC_FAILURE_INDICATION)
+
+#define MRC_JEDEC_INIT_LPDDR3 (0xDD25)
+#define MRC_JEDEC_INIT_LPDDR3_ERROR (MRC_JEDEC_INIT_LPDDR3 | MRC_FAILURE_INDICATION)
+
+#define MRC_RESET_SEQUENCE (0xDD26)
+#define MRC_RESET_ERROR (MRC_RESET_SEQUENCE | MRC_FAILURE_INDICATION)
+
+#define MRC_PRE_TRAINING (0xDD27)
+#define MRC_PRE_TRAINING_ERROR (MRC_PRE_TRAINING | MRC_FAILURE_INDICATION)
+
+///
+/// TRAINING STEPS START
+///
+#define MRC_EARLY_COMMAND (0xDD28)
+#define MRC_EARLY_COMMAND_ERROR (MRC_EARLY_COMMAND | MRC_FAILURE_INDICATION)
+
+#define MRC_SENSE_AMP_OFFSET (0xDD29)
+#define MRC_SENSE_AMP_OFFSET_ERROR (MRC_SENSE_AMP_OFFSET | MRC_FAILURE_INDICATION)
+
+#define MRC_READ_MPR (0xDD2A)
+#define MRC_READ_MPR_ERROR (MRC_READ_MPR | MRC_FAILURE_INDICATION)
+
+#define MRC_RECEIVE_ENABLE (0xDD2B)
+#define MRC_RECEIVE_ENABLE_ERROR (MRC_RECEIVE_ENABLE | MRC_FAILURE_INDICATION)
+
+#define MRC_JEDEC_WRITE_LEVELING (0xDD2C)
+#define MRC_JEDEC_WRITE_LEVELING_ERROR (MRC_JEDEC_WRITE_LEVELING | MRC_FAILURE_INDICATION)
+
+#define MRC_WRITE_TIMING_1D (0xDD2E)
+#define MRC_WRITE_TIMING_1D_ERROR (MRC_WRITE_TIMING_1D | MRC_FAILURE_INDICATION)
+
+#define MRC_READ_TIMING_1D (0xDD2F)
+#define MRC_READ_TIMING_1D_ERROR (MRC_READ_TIMING_1D | MRC_FAILURE_INDICATION)
+
+#define MRC_DIMM_ODT (0xDD30)
+#define MRC_DIMM_ODT_ERROR (MRC_DIMM_ODT | MRC_FAILURE_INDICATION)
+
+#define MRC_WRITE_DS (0xDD32)
+#define MRC_WRITE_DS_ERROR (MRC_WRITE_DS | MRC_FAILURE_INDICATION)
+
+#define MRC_WRITE_EQ (0xDD33)
+#define MRC_WRITE_EQ_ERROR (MRC_WRITE_EQ | MRC_FAILURE_INDICATION)
+
+#define MRC_READ_ODT (0xDD35)
+#define MRC_READ_ODT_ERROR (MRC_READ_ODT | MRC_FAILURE_INDICATION)
+
+#define MRC_READ_EQ (0xDD36)
+#define MRC_READ_EQ_ERROR (MRC_READ_EQ | MRC_FAILURE_INDICATION)
+
+#define MRC_READ_AMP_POWER (0xDD37)
+#define MRC_READ_AMP_POWER_ERROR (MRC_READ_AMP_POWER | MRC_FAILURE_INDICATION)
+
+#define MRC_WRITE_TIMING_2D (0xDD38)
+#define MRC_WRITE_TIMING_2D_ERROR (MRC_WRITE_TIMING_2D | MRC_FAILURE_INDICATION)
+
+#define MRC_READ_TIMING_2D (0xDD39)
+#define MRC_READ_TIMING_2D_ERROR (MRC_READ_TIMING_2D | MRC_FAILURE_INDICATION)
+
+#define MRC_CMD_VREF (0xDD3A)
+#define MRC_CMD_VREF_ERROR (MRC_CMD_VREF_2D | MRC_FAILURE_INDICATION)
+
+#define MRC_WRITE_VREF_2D (0xDD3B)
+#define MRC_WRITE_VREF_2D_ERROR (MRC_WRITE_VREF_2D | MRC_FAILURE_INDICATION)
+
+#define MRC_READ_VREF_2D (0xDD3C)
+#define MRC_READ_VREF_2D_ERROR (MRC_READ_VREF_2D | MRC_FAILURE_INDICATION)
+
+#define MRC_POST_TRAINING (0xDD3D)
+#define MRC_POST_TRAINING_ERROR (MRC_POST_TRAINING | MRC_FAILURE_INDICATION)
+
+#define MRC_LATE_COMMAND (0xDD3E)
+#define MRC_LATE_COMMAND_ERROR (MRC_LATE_COMMAND | MRC_FAILURE_INDICATION)
+
+#define MRC_ROUND_TRIP_LAT (0xDD3F)
+#define MRC_ROUND_TRIP_LAT_ERROR (MRC_ROUND_TRIP_LAT | MRC_FAILURE_INDICATION)
+
+#define MRC_TURN_AROUND (0xDD40)
+#define MRC_TURN_AROUND_ERROR (MRC_TURN_AROUND | MRC_FAILURE_INDICATION)
+
+#define MRC_CMP_OPT (0xDD41)
+#define MRC_CMP_OPT_ERROR (MRC_CMP_OPT | MRC_FAILURE_INDICATION)
+
+#define MRC_SAVE_MC_VALUES (0xDD42)
+#define MRC_SAVE_MC_VALUES_ERROR (MRC_SAVE_MC_VALUES | MRC_FAILURE_INDICATION)
+
+#define MRC_RESTORE_TRAINING (0xDD43)
+#define MRC_RESTORE_TRAINING_ERROR (MRC_RESTORE_TRAINING | MRC_FAILURE_INDICATION)
+
+#define MRC_RMT_TOOL (0xDD44)
+#define MRC_RMT_TOOL_ERROR (MRC_RMT_TOOL | MRC_FAILURE_INDICATION)
+
+#define MRC_WRITE_SR (0xDD45)
+#define MRC_WRITE_SR_ERROR (MRC_WRITE_SR | MRC_FAILURE_INDICATION)
+
+#define MRC_DIMM_RON (0xDD46)
+#define MRC_DIMM_RON_ERROR (MRC_DIMM_RON | MRC_FAILURE_INDICATION)
+
+#define MRC_RCVEN_TIMING_1D (0xDD47)
+#define MRC_RCVEN_TIMING_1D_ERROR (MRC_RCVEN_TIMING_1D | MRC_FAILURE_INDICATION)
+
+#define MRC_PWR_MTR (0xDD49)
+#define MRC_PWR_MTR_ERROR (MRC_PWR_MTR | MRC_FAILURE_INDICATION)
+
+#define MRC_MC_ACTIVATE (0xDD50)
+#define MRC_MC_ACTIVATE_ERROR (MRC_MC_ACTIVATE | MRC_FAILURE_INDICATION)
+
+#define MRC_GET_MRC_DATA (0xDD52)
+#define MRC_GET_MRC_DATA_ERROR (MRC_GET_MRC_DATA | MRC_FAILURE_INDICATION)
+
+
+///
+/// To have distinct post codes for debuggin purposes, do not define a training step
+/// value to have the same lower byte value as MRC_MEM_INIT_DONE. This value is
+/// specific to signal the completion of the module. This holds higher signifiance
+/// on systems that do not use the high byte.
+///
+/// #define MRC_DO_NOT_USE (0x__55)
+///
+
+#define MRC_RETRAIN_CHECK (0xDD58)
+#define MRC_RETRAIN_CHECK_ERROR (MRC_RETRAIN_CHECK | MRC_FAILURE_INDICATION)
+
+#define MRC_INIT_IO_DEFAULT (0xDD59)
+#define MRC_INIT_IO_DEFAULT_ERROR (MRC_INIT_IO_DEFAULT | MRC_FAILURE_INDICATION)
+
+#define MRC_ALIAS_CHECK (0xDD5B)
+#define MRC_ALIAS_CHECK_ERROR (MRC_ALIAS_CHECK | MRC_FAILURE_INDICATION)
+
+#define MRC_ECC_CLEAN_START (0xDD5C)
+#define MRC_ECC_CLEAN_ERROR (MRC_ECC_CLEAN_START | MRC_FAILURE_INDICATION)
+
+#define MRC_DONE (0xDD5D)
+#define MRC_DONE_WITH_ERROR (MRC_DONE | MRC_FAILURE_INDICATION)
+
+#define MRC_CPGC_MEMORY_TEST (0xDD5F)
+#define MRC_CPGC_MEMORY_TEST_ERROR (MRC_CPGC_MEMORY_TEST | MRC_FAILURE_INDICATION)
+
+#define MRC_MEMORY_TEST (0xDD68)
+#define MRC_MEMORY_TEST_ERROR (MRC_MEMORY_TEST | MRC_FAILURE_INDICATION)
+
+#define MRC_FILL_RMT_STRUCTURE (0xDD69)
+#define MRC_FILL_RMT_STRUCTURE_ERROR (MRC_FILL_RMT_STRUCTURE | MRC_FAILURE_INDICATION)
+
+#define MRC_SELF_REFRESH_EXIT (0xDD70)
+#define MRC_SELF_REFRESH_EXIT_ERROR (MRC_SELF_REFRESH_EXIT | MRC_FAILURE_INDICATION)
+
+#define MRC_NORMAL_MODE (0xDD71)
+#define MRC_MRC_NORMAL_MODE_ERROR (MRC_NORMAL_MODE | MRC_FAILURE_INDICATION)
+
+#define MRC_NO_MEMORY_DETECTED (0xDD7E | MRC_FAILURE_INDICATION)
+
+#define MRC_MEM_INIT_DONE (0x0055)
+#define MRC_MEM_INIT_DONE_WITH_ERRORS (MRC_MEM_INIT_DONE | MRC_FAILURE_INDICATION)
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemAddrDecode.c b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemAddrDecode.c
new file mode 100644
index 0000000..7c94deb
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemAddrDecode.c
@@ -0,0 +1,232 @@
+/**
+This file contains an 'Intel Peripheral Driver' and uniquely
+identified as "Intel Reference Module" and is
+licensed for Intel CPUs and chipsets under the terms of your
+license agreement with Intel or your vendor. This file may
+be modified by the user, subject to additional terms of the
+license agreement
+
+Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved.
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+@file:
+ MrcOemAddrDecode.c
+
+@brief:
+ Wrapper file for AddrDecode files.
+**/
+
+//
+// Include files
+//
+#include "MrcApi.h"
+#include "MrcGlobal.h"
+#include "MrcOemAddrDecode.h"
+#include "MrcOemIo.h"
+#include "MrcOemMmio.h"
+#include "McAddress.h"
+#include "MrcHswMcAddrDecode.h"
+
+/**
+@brief
+ Address decode function
+ Converts system address to DRAM address
+
+ @param[in] SystemAddress - The 39-bit system address to convert.
+ @param[out] DramAddress - The dram address struct that the system address decodes to.
+
+ @retval Returns 1 if successful, 0 otherwise.
+
+**/
+unsigned char
+MrcMcAddressDecode (
+ IN unsigned long long SystemAddress,
+ OUT ADDRESS_DECODE *DramAddress
+ )
+{
+ unsigned char Status;
+ U32 MchBarBaseAddress;
+ U32 PciEBaseAddress;
+ U32 Offset;
+ MRC_PCI_000_TOLUD_STRUCT Tolud;
+ MRC_PCI_000_REMAPBASE_STRUCT RemapBase;
+ MRC_PCI_000_REMAPLIMIT_STRUCT RemapLimit;
+ MCDECS_CR_CHANNEL_HASH_MCMAIN_STRUCT ChannelHash;
+ MCDECS_CR_MAD_ZR_MCMAIN_STRUCT MadZr;
+ MCDECS_CR_MAD_CHNL_MCMAIN_STRUCT MadChnl;
+ MCDECS_CR_MAD_DIMM_CH0_MCMAIN_STRUCT DimmCh0McMain;
+ MCDECS_CR_MAD_DIMM_CH1_MCMAIN_STRUCT DimmCh1McMain;
+ U16 TempChannel;
+ U16 TempDimm;
+ U16 TempRank;
+ U16 TempBank;
+ U16 TempRow;
+ U16 TempColumn;
+ BOOL IsTcm;
+
+ Status = 0;
+
+ //
+ // Check that MCHBAR is programmed
+ //
+ MrcOemOutPort32 (MrcOemPciIndex (), MrcOemGetPciDeviceAddress (0, 0, 0, MRC_PCI_000_MCHBAR_REG));
+ MchBarBaseAddress = MrcOemInPort32 (MrcOemPciData ());
+
+ if ((MchBarBaseAddress & MRC_BIT0) == MRC_BIT0) {
+ MchBarBaseAddress &= (~MRC_BIT0);
+ } else {
+ return Status;
+ }
+
+ //
+ // Check that PCIEXBAR is programmed
+ //
+ MrcOemOutPort32 (MrcOemPciIndex(), MrcOemGetPciDeviceAddress (0, 0, 0, MRC_PCI_000_PCIEXBAR_REG));
+ PciEBaseAddress = MrcOemInPort32 (MrcOemPciData ());
+
+ if ((PciEBaseAddress & MRC_BIT0) == MRC_BIT0) {
+ PciEBaseAddress &= ~(MRC_BIT2 | MRC_BIT1 | MRC_BIT0);
+ } else {
+ return Status;
+ }
+
+ Offset = MrcOemGetPcieDeviceAddress (0, 0, 0, MRC_PCI_000_TOLUD_REG);
+ MrcOemMmioRead (Offset, &Tolud.Data, PciEBaseAddress);
+ Offset = MrcOemGetPcieDeviceAddress (0, 0, 0, MRC_PCI_000_REMAPBASE_REG);
+ MrcOemMmioRead64 (Offset, &RemapBase.Data, PciEBaseAddress);
+ Offset = MrcOemGetPcieDeviceAddress (0, 0, 0, MRC_PCI_000_REMAPLIMIT_REG);
+ MrcOemMmioRead64 (Offset, &RemapLimit.Data, PciEBaseAddress);
+ MrcOemMmioRead (MCDECS_CR_CHANNEL_HASH_MCMAIN_REG, &ChannelHash.Data, MchBarBaseAddress);
+ MrcOemMmioRead (MCDECS_CR_MAD_ZR_MCMAIN_REG, &MadZr.Data, MchBarBaseAddress);
+ MrcOemMmioRead (MCDECS_CR_MAD_CHNL_MCMAIN_REG, &MadChnl.Data, MchBarBaseAddress);
+ MrcOemMmioRead (MCDECS_CR_MAD_DIMM_CH0_MCMAIN_REG, &DimmCh0McMain.Data, MchBarBaseAddress);
+ MrcOemMmioRead (MCDECS_CR_MAD_DIMM_CH1_MCMAIN_REG, &DimmCh1McMain.Data, MchBarBaseAddress);
+ IsTcm = FALSE;
+
+ Status = MrcHswDecode (
+ SystemAddress,
+ &IsTcm,
+ Tolud.Data,
+ RemapBase.Data,
+ RemapLimit.Data,
+ ChannelHash.Data,
+ MadZr.Data,
+ MadChnl.Data,
+ DimmCh0McMain.Data,
+ DimmCh1McMain.Data,
+ 0,
+ &TempChannel,
+ &TempDimm,
+ &TempRank,
+ &TempBank,
+ &TempRow,
+ &TempColumn
+ );
+ DramAddress->ChannelNumber = (U8) TempChannel;
+ DramAddress->DIMMNumber = (U8) TempDimm;
+ DramAddress->Rank = (U8) TempRank;
+ DramAddress->Bank = (U8) TempBank;
+ DramAddress->RAS = (U16) TempRow;
+ DramAddress->CAS = (U16) TempColumn;
+
+ return Status;
+}
+
+/**
+@brief
+ Address encode function (reverse address decode)
+ DRAM address to system address conversion
+
+ @param[in] DramAddress - The dram address that is converted.
+ @param[out] SystemAddress - The 39-bit system address to convert to.
+
+ @retval Returns 1 if successful, 0 otherwise.
+
+**/
+unsigned char
+MrcMcAddressEncode (
+ IN ADDRESS_DECODE *DramAddress,
+ OUT unsigned long long *SystemAddress
+ )
+{
+ unsigned char Status;
+ U32 MchBarBaseAddress;
+ U32 PciEBaseAddress;
+ U32 Offset;
+ MRC_PCI_000_TOLUD_STRUCT Tolud;
+ MRC_PCI_000_REMAPBASE_STRUCT RemapBase;
+ MRC_PCI_000_REMAPLIMIT_STRUCT RemapLimit;
+ MCDECS_CR_CHANNEL_HASH_MCMAIN_STRUCT ChannelHash;
+ MCDECS_CR_MAD_ZR_MCMAIN_STRUCT MadZr;
+ MCDECS_CR_MAD_CHNL_MCMAIN_STRUCT MadChnl;
+ MCDECS_CR_MAD_DIMM_CH0_MCMAIN_STRUCT DimmCh0McMain;
+ MCDECS_CR_MAD_DIMM_CH1_MCMAIN_STRUCT DimmCh1McMain;
+ BOOL IsTcm;
+
+ Status = 0;
+
+ //
+ // Check that MCHBAR is programmed
+ //
+ MrcOemOutPort32 (MrcOemPciIndex (), MrcOemGetPciDeviceAddress (0, 0, 0, MRC_PCI_000_MCHBAR_REG));
+ MchBarBaseAddress = MrcOemInPort32 (MrcOemPciData ());
+
+ if ((MchBarBaseAddress & MRC_BIT0) == MRC_BIT0) {
+ MchBarBaseAddress &= (~MRC_BIT0);
+ } else {
+ return Status;
+ }
+
+ //
+ // Check that PCIEXBAR is programmed
+ //
+ MrcOemOutPort32 (MrcOemPciIndex(), MrcOemGetPciDeviceAddress (0, 0, 0, MRC_PCI_000_PCIEXBAR_REG));
+ PciEBaseAddress = MrcOemInPort32 (MrcOemPciData ());
+
+ if ((PciEBaseAddress & MRC_BIT0) == MRC_BIT0) {
+ PciEBaseAddress &= ~(MRC_BIT2 | MRC_BIT1 | MRC_BIT0);
+ } else {
+ return Status;
+ }
+
+ Offset = MrcOemGetPcieDeviceAddress (0, 0, 0, MRC_PCI_000_TOLUD_REG);
+ MrcOemMmioRead (Offset, &Tolud.Data, PciEBaseAddress);
+ Offset = MrcOemGetPcieDeviceAddress (0, 0, 0, MRC_PCI_000_REMAPBASE_REG);
+ MrcOemMmioRead64 (Offset, &RemapBase.Data, PciEBaseAddress);
+ Offset = MrcOemGetPcieDeviceAddress (0, 0, 0, MRC_PCI_000_REMAPLIMIT_REG);
+ MrcOemMmioRead64 (Offset, &RemapLimit.Data, PciEBaseAddress);
+ MrcOemMmioRead (MCDECS_CR_CHANNEL_HASH_MCMAIN_REG, &ChannelHash.Data, MchBarBaseAddress);
+ MrcOemMmioRead (MCDECS_CR_MAD_ZR_MCMAIN_REG, &MadZr.Data, MchBarBaseAddress);
+ MrcOemMmioRead (MCDECS_CR_MAD_CHNL_MCMAIN_REG, &MadChnl.Data, MchBarBaseAddress);
+ MrcOemMmioRead (MCDECS_CR_MAD_DIMM_CH0_MCMAIN_REG, &DimmCh0McMain.Data, MchBarBaseAddress);
+ MrcOemMmioRead (MCDECS_CR_MAD_DIMM_CH1_MCMAIN_REG, &DimmCh1McMain.Data, MchBarBaseAddress);
+ IsTcm = FALSE;
+
+ Status = MrcHswEncode (
+ (U16) DramAddress->ChannelNumber,
+ (U16) DramAddress->DIMMNumber,
+ (U16) DramAddress->Rank,
+ (U16) DramAddress->Bank,
+ (U16) DramAddress->RAS,
+ (U16) DramAddress->CAS,
+ Tolud.Data,
+ RemapBase.Data,
+ RemapLimit.Data,
+ ChannelHash.Data,
+ MadZr.Data,
+ MadChnl.Data,
+ DimmCh0McMain.Data,
+ DimmCh1McMain.Data,
+ 0,
+ SystemAddress,
+ &IsTcm
+ );
+
+ return Status;
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemAddrDecode.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemAddrDecode.h
new file mode 100644
index 0000000..7b9f4c9
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemAddrDecode.h
@@ -0,0 +1,79 @@
+/**
+This file contains an 'Intel Peripheral Driver' and uniquely
+identified as "Intel Reference Module" and is
+licensed for Intel CPUs and chipsets under the terms of your
+license agreement with Intel or your vendor. This file may
+be modified by the user, subject to additional terms of the
+license agreement.
+
+Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved.
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+@file:
+ MrcOemAddrDecode.h
+
+@brief:
+ Wrapper file for AddrDecode files.
+
+**/
+#ifndef __MrcOemAddrDecode_h__
+#define __MrcOemAddrDecode_h__
+
+#include "MrcTypes.h"
+
+//
+// Defines used to get code in AddrDecode folder to compile
+//
+#define inline
+
+typedef struct
+{
+ U8 ChannelNumber;
+ U8 DIMMNumber;
+ U8 Rank;
+ U8 Bank;
+ U16 CAS;
+ U16 RAS;
+} ADDRESS_DECODE;
+
+/**
+@brief
+ Address decode function
+ Converts system address to DRAM address
+
+ @param[in] SystemAddress - The 39-bit system address to convert.
+ @param[out] DramAddress - The dram address struct that the system address decodes to.
+
+ @retval Returns 1 if successful, 0 otherwise.
+
+**/
+unsigned char
+MrcMcAddressDecode (
+ IN unsigned long long SystemAddress,
+ OUT ADDRESS_DECODE *DramAddress
+ );
+
+/**
+@brief
+ Address encode function (reverse address decode)
+ DRAM address to system address conversion
+
+ @param[in] DramAddress - The dram address that is converted.
+ @param[out] SystemAddress - The 39-bit system address to convert to.
+
+ @retval Returns 1 if successful, 0 otherwise.
+
+**/
+unsigned char
+MrcMcAddressEncode (
+ IN ADDRESS_DECODE *DramAddress,
+ OUT unsigned long long *SystemAddress
+ );
+
+#endif // __MrcOemAddrDecode_h__
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemDebugPrint.c b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemDebugPrint.c
new file mode 100644
index 0000000..dcae540
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemDebugPrint.c
@@ -0,0 +1,470 @@
+/** @file
+ Output debug messages to the debug port.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+
+**/
+
+#include "MrcTypes.h"
+#ifdef MRC_MINIBIOS_BUILD
+#include "printf.h"
+#else
+#include "EdkIIGluePeim.h"
+#endif // MRC_MINIBIOS_BUILD
+#include "MrcDebugHook.h"
+#include "MrcGlobal.h"
+#include "MrcOemDebugPrint.h"
+#include "MrcOemMemory.h"
+
+#ifdef MRC_DEBUG_PRINT
+#define ASCII_ETX (3)
+
+/**
+@brief
+ Convert an unsigned integer to a string.
+
+ @param[in] Value - Value to work on.
+ @param[out] Str - The return string to print.
+ @param[in] Width - The width of string to print
+ @param[in] Flags - The flag type to print out, like '-' or '+'.
+ @param[in] Base - Number base to work on, as in 10, or 16.
+
+ @retval Number of characters in the resulting string.
+**/
+U32
+OemUintnToStr (
+ IN const U32 Value,
+ OUT char *Str,
+ IN const U32 Width,
+ IN const U32 Flags,
+ IN const U32 Base
+ )
+{
+ char *Ptr;
+ U32 Negative;
+ U32 Int;
+ U32 i;
+ char Prefix;
+ char c;
+ const char Hex[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
+
+ Ptr = Str;
+ if ((Value > MRC_INT32_MAX) && (Flags & MRC_INT_SIGNED)) {
+ Int = ~Value + 1; /* -Value */
+ Negative = 1;
+ } else {
+ Int = Value;
+ Negative = 0;
+ }
+
+ i = 0;
+ do { /* Generate digits in reverse order */
+ i++;
+ *Ptr++ = Hex[Int % Base];
+ if (Flags & MRC_COMMA_TYPE) {
+ if (Base == 16) {
+ if (i % 4 == 0) {
+ *Ptr++ = ',';
+ }
+ } else if (Base == 10) {
+ if ((i % 3) == 0) {
+ *Ptr++ = ',';
+ }
+ }
+ }
+ } while ((Int /= Base) > 0);
+ if (*(Ptr - 1) == ',') {
+ Ptr--;
+ }
+
+ if (Negative) {
+ *Ptr++ = '-';
+ i++;
+ } else if (Flags & MRC_PREFIX_SIGN) {
+ *Ptr++ = '+';
+ i++;
+ }
+
+ if (Flags & MRC_PREFIX_ZERO) {
+ Prefix = '0';
+ } else if (!(Flags & MRC_LEFT_JUSTIFY)) {
+ Prefix = ' ';
+ } else {
+ Prefix = 0x00;
+ }
+
+ if (Prefix != 0x00) {
+ for (i = (int) (Ptr - Str); i < Width; i++) {
+ *Ptr++ = Prefix;
+ }
+ }
+
+ *Ptr = '\0';
+
+ /* Reverse string */
+ while (Str < --Ptr) {
+ c = *Str;
+ *Str++ = *Ptr;
+ *Ptr = c;
+ }
+
+ return i;
+}
+
+/**
+@brief
+ Convert a string to a number.
+
+ @param[in, out] String - String to convert.
+
+ @retval Returns the string in number.
+**/
+U32
+OemStrToNumber (
+ IN OUT char **String
+ )
+{
+ U32 Sum;
+ char *Str;
+
+ Str = *String;
+ if (*Str == '0') {
+ Str++;
+ }
+
+ Sum = 0;
+ while (MRC_ISDIGIT (*Str)) {
+ Sum = Sum * 10 + (*Str++ -'0');
+ }
+
+ *String = Str;
+ return Sum;
+}
+
+/*++
+@brief
+ Format string using specified format specifier. Limited support for sizes other than
+ unsigned 32-bit to save code space. Type overrides like {h | I | I64 | L}
+ are not supported.
+
+ @param[in] Format - String containing characters to print and formatting data.
+ %[flags][width]type
+ [flags] '-' left align
+ [flags] '+' prefix with sign (+ or -)
+ [flags] '0' zero pad numbers
+ [flags] ' ' prefix black in front of postive numbers
+ [width] non negative decimal integer that specifies the width to print a value.
+ [width] '*' get the width from a int argument on the stack.
+ type 'd'|'i' signed decimal integer
+ type 'u' unsigned integer
+ type 'x'|'X' hexidecimal using "ABCDEF"
+ type 'c' print character
+ type 'p' print a pointer to void
+ type 's' print a null terminated string
+ @param[in] Marker - Variable argument marker.
+ @param[in] BufferSize - Size of the buffer, in bytes.
+ @param[in] Buffer - The buffer.
+
+ @retval Number of characters printed.
+**/
+int
+StringFormatter (
+ IN const char *const Format,
+ IN MrcVaList Marker,
+ IN U32 BufferSize,
+ IN OUT U8 *Buffer
+ )
+{
+ char *p;
+ char *String;
+ U32 Width;
+ U32 Flags;
+ U32 CharCount;
+
+ CharCount = 0;
+ if (Format != NULL) {
+ for (p = (char *) Format; *p && (CharCount < BufferSize); p++) {
+ if (*p != '%') {
+ if (*p == MRC_CHAR_LF) {
+ //
+ // Make LF into CR LF
+ //
+ MRC_PUTCC (Buffer, MRC_CHAR_CR, CharCount);
+ }
+
+ MRC_PUTCC (Buffer, *p, CharCount);
+ } else {
+ p++;
+ //
+ // Check for flags
+ //
+ Flags = 0;
+ if (*p == '-') {
+ Flags |= MRC_LEFT_JUSTIFY;
+ } else if (*p == '+') {
+ Flags |= MRC_PREFIX_SIGN;
+ } else if (*p == ' ') {
+ Flags |= MRC_PREFIX_BLANK;
+ }
+
+ if (Flags != 0) {
+ p++;
+ }
+ //
+ // Check for width
+ //
+ if (MRC_ISDIGIT (*p)) {
+ if (*p == '0') {
+ Flags |= MRC_PREFIX_ZERO;
+ }
+
+ Width = OemStrToNumber (&p);
+ } else if (*p == '*') {
+ Width = VA_ARG (Marker, int);
+ p++;
+ } else {
+ Width = 0;
+ }
+
+ if (*p == ',') {
+ Flags |= MRC_COMMA_TYPE;
+ p++;
+ }
+ //
+ // Get type
+ //
+ switch (*p) {
+ case 'd':
+ case 'i':
+ //
+ // Always print as UINTN. Will need extra code to print different widths.
+ //
+ CharCount = CharCount + OemUintnToStr (
+ (U32) VA_ARG (Marker, U32 *),
+ (char *) &Buffer[CharCount],
+ Width,
+ Flags | MRC_INT_SIGNED,
+ 10
+ );
+ break;
+
+ case 'u':
+ //
+ // Always print as UINTN. Will need extra code to print different widths.
+ //
+ CharCount = CharCount + OemUintnToStr ((U32) VA_ARG (Marker, U32 *), (char *) &Buffer[CharCount], Width, Flags, 10);
+ break;
+
+ case 'x':
+ case 'X':
+ case 'p':
+ //
+ // Always print as UINTN. Will need extra code to print different widths.
+ //
+ CharCount = CharCount + OemUintnToStr ((U32) VA_ARG (Marker, U32 *), (char *) &Buffer[CharCount], Width, Flags, 16);
+ break;
+
+ case 'c':
+ MRC_PUTCC (Buffer, VA_ARG (Marker, char), CharCount);
+ Buffer[CharCount] = '\0';
+ break;
+
+ case 's':
+ String = (char *) VA_ARG (Marker, char *);
+ while (*String != '\0') {
+ MRC_PUTCC (Buffer, *String++, CharCount);
+ }
+ break;
+ }
+ }
+ }
+
+ if (CharCount < BufferSize) {
+ MRC_PUTCC (Buffer, '\0', CharCount);
+ } else {
+ Buffer[BufferSize - 1] = '\0';
+ }
+ }
+
+ return CharCount;
+}
+
+/*++
+
+@brief
+ Print to output stream/device. Limited support for sizes other than
+ unsigned 32-bit to save code space. Type overrides like {h | I | I64 | L}
+ are not supported.
+
+ @param[in] Debug - Location to store debug message print information for future use.
+ @param[in] Level - The debug level.
+ @param[in] Format - String containing characters to print and formatting data.
+ %[flags][width]type
+ [flags] '-' left align
+ [flags] '+' prefix with sign (+ or -)
+ [flags] '0' zero pad numbers
+ [flags] ' ' prefix black in front of postive numbers
+ [width] non negative decimal integer that specifies the width to print a value.
+ [width] '*' get the width from a int argument on the stack.
+ type 'd'|'i' signed decimal integer
+ type 'u' unsigned integer
+ type 'x'|'X' hexidecimal using "ABCDEF"
+ type 'c' print character
+ type 'p' print a pointer to void
+ type 's' print a null terminated string
+ @param[in] Marker - Variable argument marker
+
+ @retval Number of characters printed.
+**/
+int
+MrcOemPrintfVaList (
+ IN const MrcDebug *const Debug,
+ IN const MrcDebugMsgLevel Level,
+ IN const char *const Format,
+ IN MrcVaList Marker
+ )
+{
+ MrcDebug *Dbg;
+ U8 *String;
+ U32 CharCount;
+ U8 Buffer[MAX_STRING_LENGTH];
+
+ CharCount = 0;
+ if ((Format != NULL) && (Level != MSG_LEVEL_NEVER)) {
+ if (((Debug->Level == MSG_LEVEL_TIME) && (Level == MSG_LEVEL_TIME)) || ((Debug->Level != MSG_LEVEL_TIME) && (Level <= Debug->Level))) {
+ CharCount = StringFormatter (Format, Marker, sizeof (Buffer), Buffer);
+
+ //
+ // Write the string to the serial log buffer.
+ //
+ if (Debug->Current > 0) {
+ Dbg = (MrcDebug *) Debug;
+ String = Buffer;
+ while (*String != '\0') {
+ if (Dbg->Current >= Dbg->End) {
+ Dbg->Current = Dbg->Start;
+ }
+ *((U8 *) (Dbg->Current)) = *String++;
+ Dbg->Current++;
+ }
+ //
+ // Write a "end of text" marker to the buffer but don't increment the current pointer.
+ //
+ if (Dbg->Current >= Dbg->End) {
+ Dbg->Current = Dbg->Start;
+ }
+ *((U8 *) (Dbg->Current)) = ASCII_ETX;
+ }
+
+ if (Debug->Stream > 0) {
+#ifdef MRC_MINIBIOS_BUILD
+ puts ((char *) Buffer);
+#else
+ PEI_DEBUG (((void *) (Debug->Stream), EFI_D_ERROR, Buffer));
+#endif
+ }
+ }
+ }
+ return CharCount;
+}
+
+/**
+@brief
+ Print to output stream/device. Gets the start Marker for the variable arguments
+ and calls MrcOemPrintfVaList().
+
+ @param[in] Debug - Location to store debug message print information for future use.
+ @param[in] Level - The debug level.
+ @param[in] Format - String containing characters to print and formatting data.
+ %[flags][width]type
+ [flags] '-' left align
+ [flags] '+' prefix with sign (+ or -)
+ [flags] '0' zero pad numbers
+ [flags] ' ' prefix black in front of postive numbers
+ [width] non negative decimal integer that specifies the width to print a value.
+ [width] '*' get the width from a int argument on the stack.
+ type 'd'|'i' signed decimal integer
+ type 'u' unsigned integer
+ type 'x'|'X' hexidecimal using "ABCDEF"
+ type 'c' print character
+ type 'p' print a pointer to void
+ type 's' print a null terminated string
+ @param[in] ... - Variable number of arguments to print
+
+ @retval Number of characters printed.
+**/
+int
+MrcOemPrintf (
+ IN const MrcDebug *const Debug,
+ IN const MrcDebugMsgLevel Level,
+ IN const char *const Format,
+ ...
+ )
+{
+ MrcVaList Marker;
+
+ VA_START (Marker, Format);
+
+ return MrcOemPrintfVaList (Debug, Level, Format, Marker);
+}
+
+/**
+@brief
+ Save the output stream/device. This function must be called prior to debug
+ string output.
+
+ @param[out] Debug - Location to store debug message print information for future use.
+ @param[in] Level - The debug level to set. Messages at or above this level are printed.
+ @param[in] Stream - Pointer to the stream/device to use.
+ @param[in] Buffer - Pointer to the buffer that will be used to 'tee' the data to.
+ @param[in] Size - Size of the 'tee' buffer.
+
+ @retval Nothing.
+**/
+void
+MrcOemFopen (
+ OUT MrcDebug *const Debug,
+ IN const MrcDebugMsgLevel Level,
+ IN U32 Stream,
+ IN U32 Buffer,
+ IN U32 Size
+ )
+{
+ const U8 StringBegin[] = "ISV>";
+ const U8 StringEnd[] = "<ISV";
+
+ Debug->Level = Level;
+ Debug->Stream = Stream;
+ Debug->PostCode[0] = 0;
+ if ((Buffer > 0) && (Size > (sizeof (StringBegin) + sizeof (StringEnd)))) {
+ Debug->Start = Buffer + (sizeof (StringBegin) - 1);
+ Debug->End = Buffer + Size - (sizeof (StringEnd) - 1);
+ Debug->Current = Debug->Start;
+ MrcOemMemorySet ((U8 *) Debug->Start, ' ', Size - (sizeof (StringBegin) + sizeof (StringEnd) - 2));
+ MrcOemMemoryCpy ((U8 *) Buffer, (U8 *) StringBegin, sizeof (StringBegin) - 1);
+ MrcOemMemoryCpy ((U8 *) Debug->End, (U8 *) StringEnd, sizeof (StringEnd) - 1);
+ } else {
+ Debug->Start = 0;
+ Debug->End = 0;
+ Debug->Current = 0;
+ }
+
+ return;
+}
+
+#endif // MRC_DEBUG_PRINT
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemDebugPrint.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemDebugPrint.h
new file mode 100644
index 0000000..9f84cc0
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemDebugPrint.h
@@ -0,0 +1,261 @@
+/** @file
+ Output debug messages to the debug port.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+**/
+
+#ifndef _MrcOemDebugPrint_h_
+#define _MrcOemDebugPrint_h_
+#pragma pack (push, 1)
+
+#include "MrcTypes.h"
+
+typedef char *MrcVaList;
+
+#ifdef EFI_DEBUG
+#define MRC_DEBUG_PRINT (1)
+#endif // EFI_DEBUG
+#define TRANSMIT_HOLDING (0x00)
+
+#define LINE_STATUS (0x05)
+#define TRANS_HOLDING_REG_EMPTY (0x20)
+#define DATA_READY (0x01)
+
+///
+/// com port options
+///
+#define MRC_COM1_BASE (0x3f8)
+#define MRC_COM2_BASE (0x2f8)
+#define MRC_COM3_BASE (0x3e8)
+#define MRC_COM4_BASE (0x2e8)
+
+///
+/// select the platform com port address
+///
+#define GLOBALCOMPORT (MRC_COM1_BASE) ///< 0x3F8-0x3FF
+#ifndef MRC_LEFT_JUSTIFY
+#define MRC_LEFT_JUSTIFY (0x01)
+#endif
+#ifndef MRC_PREFIX_SIGN
+#define MRC_PREFIX_SIGN (0x02)
+#endif
+#ifndef MRC_PREFIX_BLANK
+#define MRC_PREFIX_BLANK (0x04)
+#endif
+#ifndef MRC_COMMA_TYPE
+#define MRC_COMMA_TYPE (0x08)
+#endif
+#ifndef MRC_LONG_TYPE
+#define MRC_LONG_TYPE (0x10)
+#endif
+#ifndef MRC_PREFIX_ZERO
+#define MRC_PREFIX_ZERO (0x20)
+#endif
+#ifndef MRC_INT_SIGNED
+#define MRC_INT_SIGNED (0x40)
+#endif
+
+#define MRC_CHAR_LF (0x0A)
+#define MRC_CHAR_CR (0x0D)
+#define MRC_INT32_MAX (0x7FFFFFFF)
+#define MAX_STRING_LENGTH 160
+#define MRC_PUTCC(_str, _c, _CharCount) { \
+ _str[_CharCount] = _c; \
+ if (_CharCount < (MAX_STRING_LENGTH - 1)) {_CharCount++;}; \
+ }
+#define MRC_ISDIGIT(_c) (((_c) >= '0') && ((_c) <= '9'))
+
+#ifdef MRC_DEBUG_PRINT
+#define MRC_DEBUG_MSG_OPEN(DEBUG, LEVEL, FILE, BUFFER, SIZE) MrcOemFopen (DEBUG, LEVEL, FILE, BUFFER, SIZE)
+#define MRC_DEBUG_MSG(DEBUG, LEVEL, FORMAT, ...) MrcOemPrintf (DEBUG, LEVEL, FORMAT, __VA_ARGS__)
+#define MRC_DEBUG_TEXT(arg) (arg)
+#else
+#define MRC_DEBUG_MSG_OPEN(DEBUG, LEVEL, FILE, BUFFER, SIZE)
+#define MRC_DEBUG_MSG(DEBUG, LEVEL, FORMAT, ...)
+#define MRC_DEBUG_TEXT(arg)
+#endif
+
+typedef enum {
+ MSG_LEVEL_NEVER,
+ MSG_LEVEL_ERROR,
+ MSG_LEVEL_WARNING,
+ MSG_LEVEL_NOTE,
+ MSG_LEVEL_EVENT,
+ MSG_LEVEL_TIME,
+ MSG_LEVEL_ALL = MRC_INT32_MAX
+} MrcDebugMsgLevel;
+
+typedef struct {
+ U32 Stream;
+ U32 Start;
+ U32 End;
+ U32 Current;
+ int Level;
+ U16 PostCode[2];
+} MrcDebug;
+
+/**
+@brief
+ Convert an unsigned integer to a string.
+
+ @param[in] Value - Value to work on.
+ @param[out] Str - The return string to print.
+ @param[in] Width - The width of string to print
+ @param[in] Flags - The flag type to print out, like '-' or '+'.
+ @param[in] Base - Number base to work on, as in 10, or 16.
+
+ @retval Number of characters in the resulting string.
+**/
+extern
+U32
+OemUintnToStr (
+ IN const U32 Value,
+ OUT char *Str,
+ IN const U32 Width,
+ IN const U32 Flags,
+ IN const U32 Base
+ );
+
+/**
+@brief
+ Convert a string to a number.
+
+ @param[in, out] String - String to convert.
+
+ @retval Returns the string in number.
+**/
+extern
+U32
+OemStrToNumber (
+ IN OUT char **String
+ );
+
+/*++
+@brief
+ Format string using specified format specifier. Limited support for sizes other than
+ unsigned 32-bit to save code space. Type overrides like {h | I | I64 | L}
+ are not supported.
+
+ @param[in] Format - String containing characters to print and formatting data.
+ %[flags][width]type
+ [flags] '-' left align
+ [flags] '+' prefix with sign (+ or -)
+ [flags] '0' zero pad numbers
+ [flags] ' ' prefix black in front of postive numbers
+ [width] non negative decimal integer that specifies the width to print a value.
+ [width] '*' get the width from a int argument on the stack.
+ type 'd'|'i' signed decimal integer
+ type 'u' unsigned integer
+ type 'x'|'X' hexidecimal using "ABCDEF"
+ type 'c' print character
+ type 'p' print a pointer to void
+ type 's' print a null terminated string
+ @param[in] Marker - Variable argument marker.
+ @param[in] BufferSize - Size of the buffer, in bytes.
+ @param[in] Buffer - The buffer.
+
+ @retval Number of characters printed.
+**/
+
+extern
+int
+StringFormatter (
+ IN const char *const Format,
+ IN MrcVaList Marker,
+ IN U32 BufferSize,
+ IN OUT U8 *Buffer
+ );
+
+/*++
+
+@brief
+ Print to output stream/device. Limited support for sizes other than
+ unsigned 32-bit to save code space. Type overrides like {h | I | I64 | L}
+ are not supported.
+
+ @param[in] Debug - Location to store debug message print information for future use.
+ @param[in] Level - The debug level.
+ @param[in] Format - String containing characters to print and formatting data.
+ %[flags][width]type
+ [flags] '-' left align
+ [flags] '+' prefix with sign (+ or -)
+ [flags] '0' zero pad numbers
+ [flags] ' ' prefix black in front of postive numbers
+ [width] non negative decimal integer that specifies the width to print a value.
+ [width] '*' get the width from a int argument on the stack.
+ type 'd'|'i' signed decimal integer
+ type 'u' unsigned integer
+ type 'x'|'X' hexidecimal using "ABCDEF"
+ type 'c' print character
+ type 'p' print a pointer to void
+ type 's' print a null terminated string
+ @param[in] Marker - Variable argument marker
+
+ @retval Number of characters printed.
+**/
+extern
+int
+MrcOemPrintfVaList (
+ IN const MrcDebug *const Debug,
+ IN const MrcDebugMsgLevel Level,
+ IN const char *const Format,
+ IN MrcVaList Marker
+ );
+
+/**
+@brief
+ put char in the uart device.
+
+ @param[in] c - char to put in the uart.
+
+ @retval Returns the puted char.
+**/
+extern
+int
+MrcOemPrintf (
+ IN const MrcDebug *const Debug,
+ IN const MrcDebugMsgLevel Level,
+ IN const char *const Format,
+ ...
+ );
+
+/**
+@brief
+ Save the output stream/device. This function must be called prior to debug
+ string output.
+
+ @param[out] Debug - Location to store debug message print information for future use.
+ @param[in] Level - The debug level to set. Messages at or above this level are printed.
+ @param[in] Stream - Pointer to the stream/device to use.
+ @param[in] Buffer - Pointer to the buffer that will be used to 'tee' the data to.
+ @param[in] Size - Size of the 'tee' buffer.
+
+ @retval Nothing.
+**/
+extern
+void
+MrcOemFopen (
+ OUT MrcDebug *const Debug,
+ IN const MrcDebugMsgLevel Level,
+ IN U32 Stream,
+ IN U32 Buffer,
+ IN U32 Size
+ );
+
+#pragma pack (pop)
+#endif //_MrcOemDebugPrint_h_
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemIo.c b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemIo.c
new file mode 100644
index 0000000..3654bef
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemIo.c
@@ -0,0 +1,480 @@
+/** @file
+ This file contains the I/O port related functions.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+
+**/
+
+#ifndef MRC_MINIBIOS_BUILD
+#include <Tiano.h>
+#include <EdkIIGlueIoLib.h>
+#endif // MRC_MINIBIOS_BUILD
+#include "MrcTypes.h"
+#include "MrcOemIo.h"
+#ifdef MRC_MINIBIOS_BUILD
+#include "Io.h"
+#endif // MRC_MINIBIOS_BUILD
+
+/*++
+
+@brief
+ 8 bit I/O port read.
+
+ @param[in] IoAddress - The I/O port read address.
+
+ @retval The value read.
+**/
+U8
+MrcOemInPort8 (
+ IN const U16 IoAddress
+ )
+{
+ return IoRead8 (IoAddress);
+}
+
+/**
+@brief
+ 8 bit I/O port write.
+
+ @param[in] IoAddress - The I/O port read address.
+ @param[in] Data - The value to write.
+
+ @retval Nothing.
+**/
+void
+MrcOemOutPort8 (
+ IN const U16 IoAddress,
+ IN const U8 Data
+ )
+{
+ IoWrite8 (IoAddress, Data);
+}
+
+/**
+@brief
+ 16 bit I/O port read.
+
+ @param[in] IoAddress - The I/O port read address.
+
+ @retval The value read.
+**/
+U16
+MrcOemInPort16 (
+ IN const U16 IoAddress
+ )
+{
+ return IoRead16 (IoAddress);
+}
+
+/**
+@brief
+ 16 bit I/O port write.
+
+ @param[in] IoAddress - The I/O port read address.
+ @param[in] Data - The value to write.
+
+ @retval Nothing.
+**/
+void
+MrcOemOutPort16 (
+ IN const U16 IoAddress,
+ IN const U16 Data
+ )
+{
+ IoWrite16 (IoAddress, Data);
+}
+
+/**
+@brief
+ 32 bit I/O port read.
+
+ @param[in] IoAddress - The I/O port read address.
+
+ @retval The value read.
+**/
+U32
+MrcOemInPort32 (
+ IN const U16 IoAddress
+ )
+{
+ return IoRead32 (IoAddress);
+}
+
+/**
+@brief
+ 32 bit I/O port write.
+
+ @param[in] IoAddress - The I/O port read address.
+ @param[in] Data - The value to write.
+
+ @retval Nothing.
+**/
+void
+MrcOemOutPort32 (
+ IN const U16 IoAddress,
+ IN const U32 Data
+ )
+{
+ IoWrite32 (IoAddress, Data);
+}
+
+/**
+@brief
+ The PCI index address.
+
+ @param[in] None.
+
+ @retval The PCI index address.
+**/
+U16
+MrcOemPciIndex (
+ void
+ )
+{
+ return 0xCF8;
+}
+
+/**
+@brief
+ The PCI data address.
+
+ @param[in] None.
+
+ @retval The PCI data address.
+**/
+U16
+MrcOemPciData (
+ void
+ )
+{
+ return 0xCFC;
+}
+
+/**
+@brief
+ Calculate the PCI device address for the given Bus/Device/Function/Offset.
+
+ @param[in] Bus - PCI bus
+ @param[in] Device - PCI device
+ @param[in] Function - PCI function
+ @param[in] Offset - Offset
+
+ @retval The PCI device address.
+**/
+U32
+MrcOemGetPciDeviceAddress (
+ IN const U8 Bus,
+ IN const U8 Device,
+ IN const U8 Function,
+ IN const U8 Offset
+ )
+{
+ return (
+ ((U32) ((Bus) & 0xFF) << 16) |
+ ((U32) ((Device) & 0x1F) << 11) |
+ ((U32) ((Function) & 0x07) << 8) |
+ ((U32) ((Offset) & 0xFF) << 0) |
+ (1UL << 31));
+}
+
+/**
+@brief
+ Calculate the PCIE device address for the given Bus/Device/Function/Offset.
+
+ @param[in] Bus - PCI bus
+ @param[in] Device - PCI device
+ @param[in] Function - PCI function
+ @param[in] Offset - Offset
+
+ The PCIE device address.
+
+ @retval The PCIe device address
+**/
+U32
+MrcOemGetPcieDeviceAddress (
+ IN const U8 Bus,
+ IN const U8 Device,
+ IN const U8 Function,
+ IN const U8 Offset
+ )
+{
+ return ((U32) Bus << 20) + ((U32) Device << 15) + ((U32) Function << 12) + ((U32) Offset << 0);
+}
+
+/**
+@brief
+ Read 32-bit value from the specified bus/device/function/offset.
+
+ @param[in] bus - PCI bus number.
+ @param[in] device - PCI device number.
+ @param[in] function - PCI function number.
+ @param[in] offset - PCI address offset.
+
+ @retval 32-bit PCI value.
+**/
+U32
+MrcOemPciRead32 (
+ IN const U8 bus,
+ IN const U8 device,
+ IN const U8 function,
+ IN const U8 offset
+ )
+{
+ MrcOemOutPort32 (MrcOemPciIndex (), MrcOemGetPciDeviceAddress (bus, device, function, offset));
+ return MrcOemInPort32 (MrcOemPciData ());
+}
+
+/**
+@brief
+ Check if RTC date and time update is in progress and wait util it's finished.
+ We have at least 244us when "update in progress bit" is seen as low to
+ perform an operation on the RTC.
+
+ @param[in] None.
+
+ @retval Zero on timeout or non-zero and RTC is ready for transaction.
+**/
+U32
+CheckUpdateComplete (
+ void
+ )
+{
+ U32 Timeout;
+
+ //
+ // Wait until RTC "update in progress" bit goes low.
+ //
+ Timeout = 0x0FFFFF;
+ do {
+ MrcOemOutPort8 (RTC_INDEX_REGISTER, CMOS_REGA);
+ if ((MrcOemInPort8 (RTC_TARGET_REGISTER) & RTC_UPDATE_IN_PROGRESS) != RTC_UPDATE_IN_PROGRESS) {
+ break;
+ }
+ } while (--Timeout > 0);
+
+ return Timeout;
+}
+
+/**
+@brief
+ Initializes the RTC.
+
+ @param[in] None.
+
+ @retval Nothing.
+**/
+void
+InitRtc (
+ void
+ )
+{
+ MrcOemOutPort8 (RTC_INDEX_REGISTER, CMOS_REGB);
+ MrcOemOutPort8 (RTC_TARGET_REGISTER, RTC_HOLD | RTC_MODE_24HOUR);
+
+ MrcOemOutPort8 (RTC_INDEX_REGISTER, CMOS_REGA);
+ MrcOemOutPort8 (RTC_TARGET_REGISTER, RTC_CLOCK_DIVIDER | RTC_RATE_SELECT);
+
+ MrcOemOutPort8 (RTC_INDEX_REGISTER, CMOS_REGC);
+ MrcOemInPort8 (RTC_TARGET_REGISTER);
+
+ MrcOemOutPort8 (RTC_INDEX_REGISTER, CMOS_REGD);
+ MrcOemInPort8 (RTC_TARGET_REGISTER);
+
+ MrcOemOutPort8 (RTC_INDEX_REGISTER, CMOS_REGB);
+ MrcOemOutPort8 (RTC_TARGET_REGISTER, RTC_MODE_24HOUR);
+
+ return;
+}
+
+/**
+@brief
+ Returns the current time, as determined by reading the Real Time Clock (RTC) on the platform.
+ Since RTC time is stored in BCD, convert each value to binary.
+
+ @param[out] Seconds - The current second (0-59).
+ @param[out] Minutes - The current minute (0-59).
+ @param[out] Hours - The current hour (0-23).
+ @param[out] DayOfMonth - The current day of the month (1-31).
+ @param[out] Month - The current month (1-12).
+ @param[out] Year - The current year (2000-2099).
+
+ @retval Nothing.
+**/
+void
+MrcOemGetRtcTime (
+ OUT U8 *const Seconds,
+ OUT U8 *const Minutes,
+ OUT U8 *const Hours,
+ OUT U8 *const DayOfMonth,
+ OUT U8 *const Month,
+ OUT U16 *const Year
+ )
+{
+ if (0 == CheckUpdateComplete ()) {
+ InitRtc ();
+ }
+ //
+ // Read seconds
+ //
+ MrcOemOutPort8 (RTC_INDEX_REGISTER, RTC_SECONDS);
+ *Seconds = MrcOemInPort8 (RTC_TARGET_REGISTER);
+
+ //
+ // Read minutes
+ //
+ MrcOemOutPort8 (RTC_INDEX_REGISTER, RTC_MINUTES);
+ *Minutes = MrcOemInPort8 (RTC_TARGET_REGISTER);
+
+ //
+ // Read hours
+ //
+ MrcOemOutPort8 (RTC_INDEX_REGISTER, RTC_HOURS);
+ *Hours = MrcOemInPort8 (RTC_TARGET_REGISTER);
+
+ //
+ // Read day of month
+ //
+ MrcOemOutPort8 (RTC_INDEX_REGISTER, RTC_DAY_OF_MONTH);
+ *DayOfMonth = MrcOemInPort8 (RTC_TARGET_REGISTER);
+
+ //
+ // Read month
+ //
+ MrcOemOutPort8 (RTC_INDEX_REGISTER, RTC_MONTH);
+ *Month = MrcOemInPort8 (RTC_TARGET_REGISTER);
+
+ //
+ // Read year and add current century.
+ //
+ MrcOemOutPort8 (RTC_INDEX_REGISTER, RTC_YEAR);
+ *Year = MrcOemInPort8 (RTC_TARGET_REGISTER);
+
+ *Seconds = BCD2BINARY (*Seconds);
+ *Minutes = BCD2BINARY (*Minutes);
+ *Hours = BCD2BINARY (*Hours);
+ *DayOfMonth = BCD2BINARY (*DayOfMonth);
+ *Month = BCD2BINARY (*Month);
+ *Year = BCD2BINARY (*Year) + CENTURY_OFFSET;
+}
+
+/**
+@brief
+ Read specific RTC/CMOS RAM
+
+ @param[in] Location Point to RTC/CMOS RAM offset for read
+
+ @retval The data of specific location in RTC/CMOS RAM.
+**/
+U8
+RtcRead (
+ IN const U8 Location
+ )
+{
+ U8 RtcIndexPort;
+ U8 RtcDataPort;
+
+ //
+ // CMOS access registers (using alternative access not to handle NMI bit)
+ //
+ if (Location < RTC_BANK_SIZE) {
+ //
+ // First bank
+ //
+ RtcIndexPort = R_PCH_RTC_INDEX_ALT;
+ RtcDataPort = R_PCH_RTC_TARGET_ALT;
+ } else {
+ //
+ // Second bank
+ //
+ RtcIndexPort = R_PCH_RTC_EXT_INDEX_ALT;
+ RtcDataPort = R_PCH_RTC_EXT_TARGET_ALT;
+ }
+
+ MrcOemOutPort8 (RtcIndexPort, Location & RTC_INDEX_MASK);
+ return MrcOemInPort8 (RtcDataPort);
+}
+
+/**
+@brief
+ Write specific RTC/CMOS RAM
+
+ @param[in] Location Point to RTC/CMOS RAM offset for write
+ @param[in] Value The data that will be written to RTC/CMOS RAM
+**/
+void
+RtcWrite (
+ IN const U8 Location,
+ IN const U8 Value
+ )
+{
+ U8 RtcIndexPort;
+ U8 RtcDataPort;
+
+ //
+ // CMOS access registers (using alternative access not to handle NMI bit)
+ //
+ if (Location < RTC_BANK_SIZE) {
+ //
+ // First bank
+ //
+ RtcIndexPort = R_PCH_RTC_INDEX_ALT;
+ RtcDataPort = R_PCH_RTC_TARGET_ALT;
+ } else {
+ //
+ // Second bank
+ //
+ RtcIndexPort = R_PCH_RTC_EXT_INDEX_ALT;
+ RtcDataPort = R_PCH_RTC_EXT_TARGET_ALT;
+ }
+
+ MrcOemOutPort8 (RtcIndexPort, Location & RTC_INDEX_MASK);
+ MrcOemOutPort8 (RtcDataPort, Value);
+}
+
+/**
+@brief
+ Read word from specific RTC/CMOS RAM
+
+ @param[in] Location Point to RTC/CMOS RAM offset for read
+
+ @retval The data of specific location in RTC/CMOS RAM.
+**/
+U16
+RtcRead16 (
+ IN const U8 Location
+ )
+{
+ return RtcRead (Location) | (RtcRead (Location + 1) << 8);
+}
+
+/**
+@brief
+ Write word to specific RTC/CMOS RAM
+
+ @param[in] Location Point to RTC/CMOS RAM offset for write
+ @param[in] Value The data that will be written to RTC/CMOS RAM
+**/
+void
+RtcWrite16 (
+ IN const U8 Location,
+ IN const U16 Value
+ )
+{
+ RtcWrite (Location, (U8) Value);
+ RtcWrite (Location + 1, (U8) (Value >> 8));
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemIo.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemIo.h
new file mode 100644
index 0000000..916077b
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemIo.h
@@ -0,0 +1,353 @@
+/** @file
+ This file contains the I/O port related definitions.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+**/
+
+#ifndef _MrcOemIo_h_
+#define _MrcOemIo_h_
+#pragma pack (push, 1)
+
+#include "MrcTypes.h"
+
+#define RTC_INDEX_REGISTER (0x70)
+#define RTC_TARGET_REGISTER (0x71)
+#define R_PCH_RTC_INDEX_ALT (0x74)
+#define R_PCH_RTC_TARGET_ALT (0x75)
+#define R_PCH_RTC_EXT_INDEX_ALT (0x76)
+#define R_PCH_RTC_EXT_TARGET_ALT (0x77)
+
+#define RTC_INDEX_MASK (0x7F)
+#define RTC_BANK_SIZE (0x80)
+
+#define RTC_SECONDS (0x00)
+#define RTC_MINUTES (0x02)
+#define RTC_HOURS (0x04)
+#define RTC_DAY_OF_MONTH (0x07)
+#define RTC_MONTH (0x08)
+#define RTC_YEAR (0x09)
+#define CMOS_REGA (0x0A)
+#define CMOS_REGB (0x0B)
+#define CMOS_REGC (0x0C)
+#define CMOS_REGD (0x0D)
+
+#define RTC_UPDATE_IN_PROGRESS (0x80)
+#define RTC_HOLD (0x80)
+#define RTC_MODE_24HOUR (0x02)
+#define RTC_CLOCK_DIVIDER (0x20)
+#define RTC_RATE_SELECT (0x06)
+
+#define BCD2BINARY(A) (((((A) >> 4) & 0xF) * 10) + ((A) & 0xF))
+#define CENTURY_OFFSET (2000)
+
+#define MRC_POST_CODE_LOW_BYTE_ADDR (0x48)
+#define MRC_POST_CODE_HIGH_BYTE_ADDR (0x49)
+
+/**
+@brief
+ 8 bit I/O port read.
+
+ @param[in] IoAddress - The I/O port read address.
+
+ @retval The value read.
+**/
+extern
+U8
+MrcOemInPort8 (
+ IN const U16 IoAddress
+ );
+
+/**
+@brief
+ 8 bit I/O port write.
+
+ @param[in] IoAddress - The I/O port read address.
+ @param[in] Data - The value to write.
+
+ @retval Nothing.
+**/
+extern
+void
+MrcOemOutPort8 (
+ IN const U16 IoAddress,
+ IN const U8 Data
+ );
+
+/**
+@brief
+ 16 bit I/O port read.
+
+ @param[in] IoAddress - The I/O port read address.
+
+ @retval The value read.
+**/
+extern
+U16
+MrcOemInPort16 (
+ IN const U16 IoAddress
+ );
+
+/**
+@brief
+ 16 bit I/O port write.
+
+ @param[in] IoAddress - The I/O port read address.
+ @param[in] Data - The value to write.
+
+ @retval Nothing.
+**/
+extern
+void
+MrcOemOutPort16 (
+ IN const U16 IoAddress,
+ IN const U16 Data
+ );
+
+/**
+@brief
+ 32 bit I/O port read.
+
+ @param[in] IoAddress - The I/O port read address.
+
+ @retval The value read.
+**/
+extern
+U32
+MrcOemInPort32 (
+ IN const U16 IoAddress
+ );
+
+/**
+@brief
+ 32 bit I/O port write.
+
+ @param[in] IoAddress - The I/O port read address.
+ @param[in] Data - The value to write.
+
+ @retval Nothing.
+**/
+extern
+void
+MrcOemOutPort32 (
+ IN const U16 IoAddress,
+ IN const U32 Data
+ );
+
+/**
+@brief
+ The PCI index address.
+
+ @param[in] None.
+
+ @retval The PCI index address.
+**/
+extern
+U16
+MrcOemPciIndex (
+ void
+ );
+
+/**
+@brief
+ The PCI data address.
+
+ @param[in] None.
+
+ @retval The PCI data address.
+**/
+extern
+U16
+MrcOemPciData (
+ void
+ );
+
+/**
+@brief
+ Calculate the PCI device address for the given Bus/Device/Function/Offset.
+
+ @param[in] Bus - PCI bus
+ @param[in] Device - PCI device
+ @param[in] Function - PCI function
+ @param[in] Offset - Offset
+
+ @retval The PCI device address.
+**/
+extern
+U32
+MrcOemGetPciDeviceAddress (
+ IN const U8 Bus,
+ IN const U8 Device,
+ IN const U8 Function,
+ IN const U8 Offset
+ );
+
+/**
+@brief
+ Calculate the PCIE device address for the given Bus/Device/Function/Offset.
+
+ @param[in] Bus - PCI bus
+ @param[in] Device - PCI device
+ @param[in] Function - PCI function
+ @param[in] Offset - Offset
+
+ The PCIe device address.
+
+ @retval
+**/
+extern
+U32
+MrcOemGetPcieDeviceAddress (
+ IN const U8 Bus,
+ IN const U8 Device,
+ IN const U8 Function,
+ IN const U8 Offset
+ );
+
+/**
+@brief
+ Read 32-bit value from the specified bus/device/function/offset.
+
+ @param[in] bus - PCI bus number.
+ @param[in] device - PCI device number.
+ @param[in] function - PCI function number.
+ @param[in] offset - PCI address offset.
+
+ @retval 32-bit PCI value.
+**/
+extern
+U32
+MrcOemPciRead32 (
+ IN const U8 bus,
+ IN const U8 device,
+ IN const U8 function,
+ IN const U8 offset
+ );
+
+/**
+@brief
+ Check if RTC date and time update is in progress and wait util it's finished.
+ We have at least 244us when "update in progress bit" is seen as low to
+ perform an operation on the RTC.
+
+ @param[in] None.
+
+ @retval Zero on timeout or non-zero and RTC is ready for transaction.
+**/
+extern
+U32
+CheckUpdateComplete (
+ void
+ );
+
+/**
+@brief
+ Initializes the RTC.
+
+ @param[in] None.
+
+ @retval Nothing.
+**/
+extern
+void
+InitRtc (
+ void
+ );
+
+/**
+@brief
+ Returns the current time, as determined by reading the Real Time Clock (RTC) on the platform.
+ Since RTC time is stored in BCD, convert each value to binary.
+
+ @param[out] Seconds - The current second (0-59).
+ @param[out] Minutes - The current minute (0-59).
+ @param[out] Hours - The current hour (0-23).
+ @param[out] DayOfMonth - The current day of the month (1-31).
+ @param[out] Month - The current month (1-12).
+ @param[out] Year - The current year (2000-2099).
+
+ @retval Nothing.
+**/
+extern
+void
+MrcOemGetRtcTime (
+ OUT U8 *const Seconds,
+ OUT U8 *const Minutes,
+ OUT U8 *const Hours,
+ OUT U8 *const DayOfMonth,
+ OUT U8 *const Month,
+ OUT U16 *const Year
+ );
+
+/**
+@brief
+ Read specific RTC/CMOS RAM
+
+ @param[in] Location Point to RTC/CMOS RAM offset for read
+
+ @retval The data of specific location in RTC/CMOS RAM.
+**/
+extern
+U8
+RtcRead (
+ IN const U8 Location
+ );
+
+/**
+@brief
+ Write specific RTC/CMOS RAM
+
+ @param[in] Location Point to RTC/CMOS RAM offset for write
+ @param[in] Value The data that will be written to RTC/CMOS RAM
+**/
+extern
+void
+RtcWrite (
+ IN const U8 Location,
+ IN const U8 Value
+ );
+
+/**
+@brief
+ Read word from specific RTC/CMOS RAM
+
+ @param[in] Location Point to RTC/CMOS RAM offset for read
+
+ @retval The data of specific location in RTC/CMOS RAM.
+**/
+extern
+U16
+RtcRead16 (
+ IN const U8 Location
+ );
+
+/**
+@brief
+ Write word to specific RTC/CMOS RAM
+
+ @param[in] Location Point to RTC/CMOS RAM offset for write
+ @param[in] Value The data that will be written to RTC/CMOS RAM
+**/
+extern
+void
+RtcWrite16 (
+ IN const U8 Location,
+ IN const U16 Value
+ );
+
+#pragma pack(pop)
+#endif // _MrcOemIo_h_
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemMemory.c b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemMemory.c
new file mode 100644
index 0000000..1d87c42
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemMemory.c
@@ -0,0 +1,198 @@
+/** @file
+ This file contains the memory manipulation functions.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+**/
+
+#ifdef MRC_MINIBIOS_BUILD
+#include "MemoryUtils.h"
+#else
+#include <Tiano.h>
+#include <EdkIIGlueDefinitionChangesBase.h>
+#include <EdkIIGluePeim.h>
+#include <EdkIIGlueBaseMemoryLib.h>
+#endif // MRC_MINIBIOS_BUILD
+#include "MrcTypes.h"
+#include "MrcOemMemory.h"
+
+/**
+@brief
+ Copy the specified number of memory bytes, a byte at a time, from the
+ specified source to the specified destination.
+
+ @param[in, out] Dest - Destination pointer.
+ @param[in] Src - Source pointer.
+ @param[in] NumBytes - The number of bytes to copy.
+
+ @retval Nothing.
+**/
+void
+MrcOemMemoryCpy (
+ IN OUT U8 *Dest,
+ IN U8 *Src,
+ IN U32 NumBytes
+ )
+{
+ CopyMem (Dest, Src, NumBytes);
+ return;
+}
+
+/**
+@brief
+ Sets the specified number of memory bytes, a byte at a time, at the
+ specified destination.
+
+ @param[in, out] Dest - Destination pointer.
+ @param[in] Value - The value to set.
+ @param[in] NumBytes - The number of bytes to set.
+
+ @retval Nothing.
+**/
+void
+MrcOemMemorySet (
+ IN OUT U8 *Dest,
+ IN U32 Value,
+ IN U32 NumBytes
+ )
+{
+ SetMem ((U8 *) Dest, NumBytes, (U8) Value);
+ return;
+}
+
+/**
+@brief
+ Sets the specified number of memory dwords, a dword at a time, at the
+ specified destination.
+
+ @param[in, out] Dest - Destination pointer.
+ @param[in] Value - The value to set.
+ @param[in] NumWords - The number of dwords to set.
+
+ @retval Nothing.
+**/
+void
+MrcOemMemorySetWord (
+ IN OUT U16 *Dest,
+ IN const U16 Value,
+ IN U32 NumWords
+ )
+{
+ while (0 != NumWords--) {
+ *Dest++ = Value;
+ }
+
+ return;
+}
+
+/**
+@brief
+ Sets the specified number of memory dwords, a dword at a time, at the
+ specified destination.
+
+ @param[in, out] Dest - Destination pointer.
+ @param[in] Value - The value to set.
+ @param[in] NumDwords - The number of dwords to set.
+
+ @retval Nothing.
+**/
+void
+MrcOemMemorySetDword (
+ IN OUT U32 *Dest,
+ IN const U32 Value,
+ IN U32 NumDwords
+ )
+{
+ while (0 != NumDwords--) {
+ *Dest++ = Value;
+ }
+
+ return;
+}
+
+/**
+@brief
+ Shift the specified data value left by the specified count.
+
+ @param[in] Data - 64 bit number to shift left.
+ @param[in] Count - Number of bits to shift (0..63)
+
+ @retval The number of bits shifted left.
+**/
+U64
+MrcOemMemoryLeftShiftU64 (
+ IN const U64 Data,
+ IN const U8 Count
+ )
+{
+ return LShiftU64 (Data, Count);
+}
+
+/**
+@brief
+ Shift the specified data value Right by the specified count..
+
+ @param[in] Data - U64 number to shift
+ @param[in] Count - number of bits to shift (0..63)
+
+ @retval Returns the shifted U64 value.
+**/
+U64
+MrcOemMemoryRightShiftU64 (
+ IN const U64 Data,
+ IN const U8 Count
+ )
+{
+ return RShiftU64 (Data, Count);
+}
+
+/**
+@brief
+ this function Multiply U64 with a U32 number. Result is <= 64 bits
+ need to be port for OEM platform requirements.
+
+ @param[in] Multiplicand - U64 number to be multiplied with
+ @param[in] Multiplier - U32 number to multiply
+
+ @retval N/A
+**/
+U64
+MrcOemMemoryMultiplyU64ByU32 (
+ IN const U64 Multiplicand,
+ IN const U32 Multiplier
+ )
+{
+ return MultU64x32 (Multiplicand, Multiplier);
+}
+
+/**
+@brief
+ Divide U64 with a U64 number. Result is <= 32 bits
+
+ @param[in] Dividend - U64 number to be multiplied with
+ @param[in] Divisor - U32 number to multiply
+
+ @retval Returns the quotient result of U32 value.
+**/
+U64
+MrcOemMemoryDivideU64ByU64 (
+ IN const U64 Dividend,
+ IN const U64 Divisor
+ )
+{
+ return (DivU64x64Remainder (Dividend, Divisor, NULL));
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemMemory.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemMemory.h
new file mode 100644
index 0000000..08c6747
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemMemory.h
@@ -0,0 +1,171 @@
+/** @file
+ This file contains the memory manipulation definitions.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+**/
+
+#ifndef _MrcOemMemory_h_
+#define _MrcOemMemory_h_
+#pragma pack (push, 1)
+
+#include "MrcTypes.h"
+
+/**
+@brief
+ Copy the specified number of memory bytes, a byte at a time, from the
+ specified source to the specified destination.
+
+ @param[in, out] Dest - Destination pointer.
+ @param[in] Src - Source pointer.
+ @param[in] NumBytes - The number of bytes to copy.
+
+ @retval Nothing.
+**/
+extern
+void
+MrcOemMemoryCpy (
+ IN OUT U8 *Dest,
+ IN U8 *Src,
+ IN U32 NumBytes
+ );
+
+/**
+@brief
+ Sets the specified number of memory bytes, a byte at a time, at the
+ specified destination.
+
+ @param[in, out] Dest - Destination pointer.
+ @param[in] Value - The value to set.
+ @param[in] NumBytes - The number of bytes to set.
+
+ @retval Nothing.
+**/
+extern
+void
+MrcOemMemorySet (
+ IN OUT U8 *Dest,
+ IN U32 Value,
+ IN U32 NumBytes
+ );
+
+/**
+@brief
+ Sets the specified number of memory dwords, a dword at a time, at the
+ specified destination.
+
+ @param[in, out] Dest - Destination pointer.
+ @param[in] Value - The value to set.
+ @param[in] NumWords - The number of dwords to set.
+
+ @retval Nothing.
+**/
+extern
+void
+MrcOemMemorySetWord (
+ IN OUT U16 *Dest,
+ IN const U16 Value,
+ IN U32 NumWords
+ );
+
+/**
+@brief
+ Sets the specified number of memory dwords, a dword at a time, at the
+ specified destination.
+
+ @param[in, out] Dest - Destination pointer.
+ @param[in] Value - The value to set.
+ @param[in] NumDwords - The number of dwords to set.
+
+ @retval Nothing.
+**/
+extern
+void
+MrcOemMemorySetDword (
+ IN OUT U32 *Dest,
+ IN const U32 Value,
+ IN U32 NumDwords
+ );
+
+/**
+@brief
+ Shift the specified data value left by the specified count.
+
+ @param[in] Data - 64 bit number to shift left.
+ @param[in] Count - Number of bits to shift (0..63)
+
+ @retval The number of bits shifted left.
+**/
+extern
+U64
+MrcOemMemoryLeftShiftU64 (
+ IN const U64 Data,
+ IN const U8 Count
+ );
+
+/**
+@brief
+ Shift the specified data value Right by the specified count..
+
+ @param[in] Data - U64 number to shift
+ @param[in] Count - number of bits to shift (0..63)
+
+ @retval Returns the shifted U64 value.
+**/
+extern
+U64
+MrcOemMemoryRightShiftU64 (
+ IN const U64 Data,
+ IN const U8 Count
+ );
+
+/**
+@brief
+ this function Multiply U64 with a U32 number. Result is <= 64 bits
+ need to be port for OEM platform requirements.
+
+ @param[in] Multiplicand - U64 number to be multiplied with
+ @param[in] Multiplier - U32 number to multiply
+
+ @retval N/A
+**/
+extern
+U64
+MrcOemMemoryMultiplyU64ByU32 (
+ IN const U64 Multiplicand,
+ IN const U32 Multiplier
+ );
+
+/**
+@brief
+ Divide U64 with a U64 number. Result is <= 32 bits
+
+ @param[in] Dividend - U64 number to be multiplied with
+ @param[in] Divisor - U32 number to multiply
+
+ @retval Returns the quotient result of U32 value.
+**/
+extern
+U64
+MrcOemMemoryDivideU64ByU64 (
+ IN const U64 Dividend,
+ IN const U64 Divisor
+ )
+;
+
+#pragma pack (pop)
+#endif // _MrcOemMemory_h_
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemMmio.c b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemMmio.c
new file mode 100644
index 0000000..c2d80e6
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemMmio.c
@@ -0,0 +1,302 @@
+/** @file
+ This file contains the memory mapped I/O manipulation functions.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+**/
+
+#include "MrcTypes.h"
+#include "MrcOemMmio.h"
+
+/**
+@brief
+ Read 64 bits from the Memory Mapped I/O space.
+
+ @param[in] Offset - Offset from the specified base address.
+ @param[out] Value - Where to store the read value.
+ @param[in] BaseAddress - MMIO space base address.
+
+ @retval Nothing.
+**/
+void
+MrcOemMmioRead64 (
+ IN U32 Offset,
+ OUT U64 *Value,
+ IN U32 BaseAddress
+ )
+{
+ U64 MmxSave;
+ U64 *MmioOffset;
+
+ MmioOffset = (U64 *) (Offset + BaseAddress);
+
+#if defined __GNUC__ // GCC compiler
+ __asm__ __volatile__ (
+ "\n\t movq %%mm0, %0"
+ "\n\t movq %2, %%mm0"
+ "\n\t movq %%mm0, %1"
+ "\n\t movq %3, %%mm0"
+ "\n\t emms"
+ : "=m" (MmxSave),
+ "=m" (Value[0])
+ : "m" (MmioOffset[0]),
+ "m" (MmxSave)
+ );
+#else // MSFT compiler
+ ASM {
+
+ ; Save mm0
+ movq MmxSave, mm0
+
+ mov edi, MmioOffset
+
+ movq mm0, QWORD PTR DS:[edi]
+
+ mov edi, Value
+ movq QWORD PTR DS:[edi], mm0
+
+ ; Restore mm0
+ movq mm0, MmxSave
+ emms ; Exit mmx Instruction
+ }
+#endif
+
+ MmioReadCount ();
+ return;
+}
+
+/**
+@brief
+ Read 32 bits from the Memory Mapped I/O space.
+
+ @param[in] Offset - Offset from the specified base address.
+ @param[out] Value - Where to store the read value.
+ @param[in] BaseAddress - MMIO space base address.
+
+ @retval Nothing.
+**/
+void
+MrcOemMmioRead (
+ IN U32 Offset,
+ OUT U32 *Value,
+ IN U32 BaseAddress
+ )
+{
+ *Value = (*((volatile U32 *) (Offset + BaseAddress)));
+ MmioReadCount ();
+ return;
+}
+
+/**
+@brief
+ Read 16 bits from the Memory Mapped I/O space.
+
+ @param[in] Offset - Offset from the specified base address.
+ @param[out] Value - Where to store the read value.
+ @param[in] BaseAddress - MMIO space base address.
+
+ @retval Nothing.
+**/
+void
+MrcOemMmioRead16 (
+ IN U32 Offset,
+ OUT U16 *Value,
+ IN U32 BaseAddress
+ )
+{
+ *Value = (*((volatile U16 *) (Offset + BaseAddress)));
+ MmioReadCount ();
+ return;
+}
+
+/**
+@brief
+ Read 8 bits from the Memory Mapped I/O space.
+
+ @param[in] Offset - Offset from the specified base address.
+ @param[out] Value - Where to store the read value.
+ @param[in] BaseAddress - MMIO space base address.
+
+ @retval Nothing.
+**/
+void
+MrcOemMmioRead8 (
+ IN U32 Offset,
+ OUT U8 *Value,
+ IN U32 BaseAddress
+ )
+{
+ *Value = (*((volatile U8 *) (Offset + BaseAddress)));
+ MmioReadCount ();
+ return;
+}
+
+/**
+@brief
+ Write 64 bits to the Memory Mapped I/O space.
+
+ @param[in] Offset - Offset from the specified base address.
+ @param[in] Value - The value to write.
+ @param[in] BaseAddress - MMIO space base address.
+
+ @retval Nothing.
+**/
+void
+MrcOemMmioWrite64 (
+ IN U32 Offset,
+ IN U64 Value,
+ IN U32 BaseAddress
+ )
+{
+ U64 MmxSave;
+ U64 *MmioOffset;
+
+ MmioOffset = (U64 *) (Offset + BaseAddress);
+
+#if defined __GNUC__ // GCC compiler
+ __asm__ __volatile__ (
+ "\n\t movq %%mm0, %0"
+ "\n\t movq %2, %%mm0"
+ "\n\t movq %%mm0, %1"
+ "\n\t movq %3, %%mm0"
+ "\n\t emms"
+ : "=m" (MmxSave)
+ : "m" (MmioOffset[0]),
+ "m" (Value),
+ "m" (MmxSave)
+ );
+#else //MSFT compiler
+ ASM {
+
+ ; Save mm0
+ movq MmxSave, mm0
+
+ mov edi, MmioOffset
+ movq mm0, Value
+
+ movq QWORD PTR DS:[edi], mm0
+
+ ; Restore mm0
+ movq mm0, MmxSave
+ emms ; Exit mmx Instruction
+
+ }
+#endif
+
+ MmioWriteCount ();
+ return;
+}
+
+/**
+@brief
+ Write 32 bits to the Memory Mapped I/O space.
+
+ @param[in] Offset - Offset from the specified base address.
+ @param[in] Value - The value to write.
+ @param[in] BaseAddress - MMIO space base address.
+
+ @retval Nothing.
+**/
+void
+MrcOemMmioWrite (
+ IN U32 Offset,
+ IN U32 Value,
+ IN U32 BaseAddress
+ )
+{
+ (*((volatile U32 *) (Offset + BaseAddress))) = Value;
+ MmioWriteCount ();
+ return;
+}
+
+/**
+@brief
+ Write 16 bits to the Memory Mapped I/O space.
+
+ @param[in] Offset - Offset from the specified base address.
+ @param[in] Value - The value to write.
+ @param[in] BaseAddress - MMIO space base address.
+
+ @retval Nothing.
+**/
+void
+MrcOemMmioWrite16 (
+ IN U32 Offset,
+ IN U16 Value,
+ IN U32 BaseAddress
+ )
+{
+ (*((volatile U16 *) (Offset + BaseAddress))) = Value;
+ MmioWriteCount ();
+ return;
+}
+
+/**
+@brief
+ Write 8 bits to the Memory Mapped I/O space.
+
+ @param[in] Offset - Offset from the specified base address.
+ @param[in] Value - The value to write.
+ @param[in] BaseAddress - MMIO space base address.
+
+ @retval Nothing.
+**/
+void
+MrcOemMmioWrite8 (
+ IN U32 Offset,
+ IN U8 Value,
+ IN U32 BaseAddress
+ )
+{
+ (*((volatile U8 *) (Offset + BaseAddress))) = Value;
+ MmioWriteCount ();
+ return;
+}
+#ifndef MRC_MINIBIOS_BUILD
+/*++
+
+@brief
+ This function count the number of access to writes MMIO registers.
+
+ @param[in] Nothing.
+
+ @retval Nothing.
+**/
+void
+MmioWriteCount (
+ void
+ )
+{
+ return;
+}
+
+/**
+@brief
+ This function count the number of access to reads MMIO registers.
+
+ @param[in] Nothing.
+
+ @retval Nothing.
+**/
+void
+MmioReadCount (
+ void
+ )
+{
+ return;
+}
+#endif // MRC_MINIBIOS_BUILD
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemMmio.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemMmio.h
new file mode 100644
index 0000000..f5621cd
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemMmio.h
@@ -0,0 +1,192 @@
+/** @file
+
+ This file contains the memory mapped I/O manipulation definitions.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+**/
+
+#ifndef _MrcOemMmio_h_
+#define _MrcOemMmio_h_
+
+#include "MrcTypes.h"
+
+/**
+@brief
+ Read 64 bits from the Memory Mapped I/O space.
+
+ @param[in] Offset - Offset from the specified base address.
+ @param[out] Value - Where to store the read value.
+ @param[in] BaseAddress - MMIO space base address.
+
+ @retval Nothing.
+**/
+extern
+void
+MrcOemMmioRead64 (
+ IN U32 Offset,
+ OUT U64 *Value,
+ IN U32 BaseAddress
+ );
+
+/**
+@brief
+ Read 32 bits from the Memory Mapped I/O space.
+
+ @param[in] Offset - Offset from the specified base address.
+ @param[out] Value - Where to store the read value.
+ @param[in] BaseAddress - MMIO space base address.
+
+ @retval Nothing.
+**/
+extern
+void
+MrcOemMmioRead (
+ IN U32 Offset,
+ OUT U32 *Value,
+ IN U32 BaseAddress
+ );
+
+/**
+@brief
+ Read 16 bits from the Memory Mapped I/O space.
+
+ @param[in] Offset - Offset from the specified base address.
+ @param[out] Value - Where to store the read value.
+ @param[in] BaseAddress - MMIO space base address.
+
+ @retval Nothing.
+**/
+extern
+void
+MrcOemMmioRead16 (
+ IN U32 Offset,
+ OUT U16 *Value,
+ IN U32 BaseAddress
+ );
+
+/**
+@brief
+ Read 8 bits from the Memory Mapped I/O space.
+
+ @param[in] Offset - Offset from the specified base address.
+ @param[out] Value - Where to store the read value.
+ @param[in] BaseAddress - MMIO space base address.
+
+ @retval Nothing.
+**/
+extern
+void
+MrcOemMmioRead8 (
+ IN U32 Offset,
+ OUT U8 *Value,
+ IN U32 BaseAddress
+ );
+
+/**
+@brief
+ Write 64 bits to the Memory Mapped I/O space.
+
+ @param[in] Offset - Offset from the specified base address.
+ @param[in] Value - The value to write.
+ @param[in] BaseAddress - MMIO space base address.
+
+ @retval Nothing
+**/
+extern
+void
+MrcOemMmioWrite64 (
+ IN U32 Offset,
+ IN U64 Value,
+ IN U32 BaseAddress
+ );
+
+/**
+@brief
+ Write 32 bits to the Memory Mapped I/O space.
+
+ @param[in] Offset - Offset from the specified base address.
+ @param[in] Value - The value to write.
+ @param[in] BaseAddress - MMIO space base address.
+
+ @retval Nothing.
+**/
+extern
+void
+MrcOemMmioWrite (
+ IN U32 Offset,
+ IN U32 Value,
+ IN U32 BaseAddress
+ );
+
+/**
+@brief
+ Write 16 bits to the Memory Mapped I/O space.
+
+ @param[in] Offset - Offset from the specified base address.
+ @param[in] Value - The value to write.
+ @param[in] BaseAddress - MMIO space base address.
+
+ @retval Nothing.
+**/
+extern
+void
+MrcOemMmioWrite16 (
+ IN U32 Offset,
+ IN U16 Value,
+ IN U32 BaseAddress
+ );
+
+/**
+@brief
+ Write 8 bits to the Memory Mapped I/O space.
+
+ @param[in] Offset - Offset from the specified base address.
+ @param[in] Value - The value to write.
+ @param[in] BaseAddress - MMIO space base address.
+
+ @retval Nothing.
+**/
+extern
+void
+MrcOemMmioWrite8 (
+ IN U32 Offset,
+ IN U8 Value,
+ IN U32 BaseAddress
+ );
+
+extern
+void
+MmioReadCount (
+ void
+ );
+
+/**
+@brief
+ This function count the number of access to writes MMIO registers.
+
+ @param[in] Nothing
+
+ @retval Nothing
+**/
+extern
+void
+MmioWriteCount (
+ void
+ );
+
+#endif // _MrcOemMmio_h_
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemPlatform.c b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemPlatform.c
new file mode 100644
index 0000000..d095c51
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemPlatform.c
@@ -0,0 +1,2780 @@
+/** @file
+ This file contains platform related functions.
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+
+**/
+
+#ifdef MRC_MINIBIOS_BUILD
+#include "MemoryUtils.h"
+#else
+#include <Tiano.h>
+#include <EdkIIGluePeim.h>
+#include <EdkIIGlueBaseLib.h>
+#include "CpuRegs.h"
+#include "CpuPlatformLib.h"
+#ifdef SSA_FLAG
+#include "SsaCallbackPeim.h"
+extern
+VOID
+SsaBiosInitialize (
+ IN MrcParameters *MrcData
+ );
+#endif // SSA_FLAG
+#endif
+
+//
+// Include files
+//
+#ifndef AMI_OVERRIDE_FOR_MEMORY_DOWN
+#include <Token.h>
+#include "MrcSpdData.h"
+#endif // AMI_OVERRIDE_FOR_MEMORY_DOWN
+#include "MrcTypes.h"
+#include "MrcApi.h"
+#include "McAddress.h"
+#include "MrcCommon.h"
+#include "MrcGlobal.h"
+#include "MrcOem.h"
+#include "MrcOemPlatform.h"
+
+#include "PchRegsLpc.h"
+#include "MrcReset.h"
+
+
+// AMI_OVERRIDE_FOR_UPSERVER_SUPPORT
+#ifdef UPSERVER_SUPPORT
+#include "MrcOemSmbus.h"
+
+const U8 CltmThermalLookUpTable [2][2][2][5] =
+{
+ {// DRAM Density 2Gb
+ {// Frequency 1600
+ // 1 DIMM
+ {6, 6, 6, 6, 6},
+ // 2 DIMMs
+ {7, 7, 7, 6, 6}
+ },
+ {// Frequency 1333
+ // 1 DIMM
+ {5, 5, 5, 5, 5},
+ // 2 DIMMs
+ {6, 6, 6, 6, 5}
+ }
+ },
+ {// DRAM Density 4Gb
+ {// Frequency 1600
+ // 1 DIMM
+ {7, 6, 6, 6, 7},
+ // 2 DIMMs
+ {7, 7, 7, 7, 6}
+ },
+ {// Frequency 1333
+ // 1 DIMM
+ {6, 5, 5, 5, 6},
+ // 2 DIMMs
+ {7, 7, 6, 6, 6}
+ }
+ }
+};
+
+const U16 CltmPowerLookUpTable [2][2][2][8] =
+{
+ {// DRAM Density 2Gb
+ {// Frequency 1600
+ // DIMM Position 1
+
+ {4, 99, 147, 129, 6, 10, 0x18, 0x0C},
+ // DIMM Position 2
+ {3, 182, 203, 64, 3, 5, 0x1B, 0x09}
+ },
+ {// Frequency 1333
+ // DIMM Position 1
+ {4, 102, 160, 121, 7, 11, 0x15, 0x08},
+ // DIMM Position 2
+ {3, 210, 236, 60, 3, 5, 0x18, 0x0C}
+ }
+ },
+ {// DRAM Density 4Gb
+ {// Frequency 1600
+ // DIMM Position 1
+ {4, 111, 158, 132, 8, 12, 0x1B, 0x0E},
+ // DIMM Position 2
+ {3, 188, 209, 66, 4, 6, 0x1D, 0x07}
+ },
+ {// Frequency 1333
+ // DIMM Position 1
+ {4, 115, 171, 124, 9, 13, 0x17, 0x0A},
+ // DIMM Position 2
+ {3, 217, 241, 62, 4, 6, 0x1B, 0x09}
+ }
+ }
+};
+
+#endif
+// AMI_OVERRIDE_FOR_UPSERVER_SUPPORT
+
+#ifdef MRC_DEBUG_PRINT
+extern const char CcdString[];
+const char TrainEnString[] = "TrainingEnables";
+const char GdxcString[] = "Gdxc";
+const char BaseTimeString[] = "BaseTime";
+const char ThermEnString[] = "ThermalEnables";
+#endif // MRC_DEBUG_PRINT
+
+#ifdef ULT_FLAG
+
+//
+// The following section contains board-specific CMD/CTL/CLK and DQ/DQS mapping, needed for LPDDR3
+//
+
+//
+// DQByteMap[0] - ClkDQByteMap:
+// If clock is per rank, program to [0xFF, 0xFF]
+// If clock is shared by 2 ranks, program to [0xFF, 0] or [0, 0xFF]
+// If clock is shared by 2 ranks but does not go to all bytes,
+// Entry[i] defines which DQ bytes Group i services
+// DQByteMap[1] - CmdNDQByteMap: Entry[0] is CmdN/CAA and Entry[1] is CmdN/CAB
+// DQByteMap[2] - CmdSDQByteMap: Entry[0] is CmdS/CAA and Entry[1] is CmdS/CAB
+// DQByteMap[3] - CkeDQByteMap : Entry[0] is CKE /CAA and Entry[1] is CKE /CAB
+// For DDR, DQByteMap[3:1] = [0xFF, 0]
+// DQByteMap[4] - CtlDQByteMap : Always program to [0xFF, 0] since we have 1 CTL / rank
+// Variable only exists to make the code easier to use
+// DQByteMap[5] - CmdVDQByteMap: Always program to [0xFF, 0] since we have 1 CA Vref
+// Variable only exists to make the code easier to use
+//
+
+//
+// DQ byte mapping to CMD/CTL/CLK, from the CPU side - for Sawtooth Peak and Harris Beach
+//
+const U8 DqByteMapRvpCh0[6][2] = {
+ { 0x0F, 0xF0 }, // CLK0 goes to package 0 - Bytes[3:0], CLK1 goes to package 1 - Bytes[7:4]
+ { 0x00, 0xF0 }, // CmdN does not have CAA, CAB goes to Bytes[7:4]
+ { 0x0F, 0xF0 }, // CmdS CAA goes to Bytes[3:0], CmdS CAB goes to Byte[7:4]
+ { 0x0F, 0x00 }, // CKE CAA goes to Bytes[3:0], CKE does not have CAB
+ { 0xFF, 0x00 }, // CTL (CS) goes to all bytes
+ { 0xFF, 0x00 } // CA Vref is one for all bytes
+};
+
+const U8 DqByteMapRvpCh1[6][2] = {
+ { 0x0F, 0xF0 }, // CLK0 goes to package 0 - Bytes[3:0], CLK1 goes to package 1 - Bytes[7:4]
+ { 0x00, 0xF0 }, // CmdN does not have CAA, CAB goes to Bytes[7:4]
+ { 0x0F, 0xF0 }, // CmdS CAA goes to Bytes[3:0], CmdS CAB goes to Byte[7:4]
+ { 0x0F, 0x00 }, // CKE CAA goes to Bytes[3:0], CKE does not have CAB
+ { 0xFF, 0x00 }, // CTL (CS) goes to all bytes
+ { 0xFF, 0x00 } // CA Vref is one for all bytes
+};
+
+//
+// DQ byte mapping to CMD/CTL/CLK, from the CPU side - for Big Creek
+//
+const U8 DqByteMapSvCh0[6][2] = {
+ { 0x0F, 0xF0 }, // CLK0 goes to package 0 - Bytes[3:0], CLK1 goes to package 1 - Bytes[7:4]
+ { 0x00, 0xF0 }, // CmdN does not have CAA, CAB goes to Bytes[7:4]
+ { 0x0F, 0xF0 }, // CmdS CAA goes to Bytes[3:0], CmdS CAB goes to Byte[7:4]
+ { 0x0F, 0x00 }, // CKE CAA goes to Bytes[3:0], CKE does not have CAB
+ { 0xFF, 0x00 }, // CTL (CS) goes to all bytes
+ { 0xFF, 0x00 } // CA Vref is one for all bytes
+};
+
+const U8 DqByteMapSvCh1[6][2] = {
+ { 0xE8, 0x17 }, // CLK0 goes to package 0 - Bytes[3:0], CLK1 goes to package 1 - Bytes[7:4]
+ { 0x00, 0x17 }, // CmdN does not have CAA, CAB goes to Bytes[7:4]
+ { 0xE8, 0x17 }, // CmdS CAA goes to Bytes[3:0], CmdS CAB goes to Byte[7:4]
+ { 0xE8, 0x00 }, // CKE CAA goes to Bytes[3:0], CKE does not have CAB
+ { 0xFF, 0x00 }, // CTL (CS) goes to all bytes
+ { 0xFF, 0x00 } // CA Vref is one for all bytes
+};
+
+//
+// DQS byte swizzling between CPU and DRAM - for Sawtooth Peak and Harris Beach
+//
+const U8 DqsMapCpu2DramRvpCh0[8] = { 2, 0, 1, 3, 6, 4, 7, 5 };
+const U8 DqsMapCpu2DramRvpCh1[8] = { 1, 3, 2, 0, 5, 7, 6, 4 };
+
+//
+// DQS byte swizzling between CPU and DRAM - for Big Creek
+//
+const U8 DqsMapCpu2DramSvCh0[8] = { 0, 1, 2, 3, 5, 6, 7, 4 };
+const U8 DqsMapCpu2DramSvCh1[8] = { 7, 6, 5, 2, 4, 3, 1, 0 };
+
+//
+// DQ bit swizzling between CPU and DRAM - for Sawtooth Peak and Harris Beach
+//
+const U8 DqMapCpu2DramRvpCh0[8][8] = {
+ { 16, 21, 18, 19, 20, 17, 22, 23 }, // Byte 0
+ { 3, 6, 1, 5, 2, 7, 0, 4 }, // Byte 1
+ { 9, 8, 14, 15, 10, 11, 13, 12 }, // Byte 2
+ { 29, 28, 27, 31, 24, 25, 30, 26 }, // Byte 3
+ { 53, 49, 50, 51, 48, 52, 54, 55 }, // Byte 4
+ { 35, 38, 33, 37, 34, 39, 32, 36 }, // Byte 5
+ { 63, 59, 61, 57, 56, 60, 58, 62 }, // Byte 6
+ { 44, 45, 46, 42, 40, 41, 43, 47 } // Byte 7
+};
+const U8 DqMapCpu2DramRvpCh1[8][8] = {
+ { 15, 11, 8, 9, 10, 14, 12, 13 }, // Byte 0
+ { 24, 29, 30, 26, 28, 25, 27, 31 }, // Byte 1
+ { 16, 20, 22, 23, 17, 21, 19, 18 }, // Byte 2
+ { 6, 3, 1, 5, 2, 7, 4, 0 }, // Byte 3
+ { 47, 42, 40, 41, 43, 46, 44, 45 }, // Byte 4
+ { 57, 56, 62, 58, 61, 60, 59, 63 }, // Byte 5
+ { 51, 49, 54, 53, 48, 50, 55, 52 }, // Byte 6
+ { 38, 35, 36, 32, 34, 39, 33, 37 } // Byte 7
+};
+
+//
+// DQ bit swizzling between CPU and DRAM - for Big Creek
+//
+const U8 DqMapCpu2DramSvCh0[8][8] = {
+ { 1, 0, 2, 6, 5, 4, 3, 7 }, // Byte 0
+ { 13, 9, 14, 10, 12, 8, 15, 11 }, // Byte 1
+ { 22, 18, 21, 16, 17, 20, 19, 23 }, // Byte 2
+ { 29, 28, 26, 27, 30, 31, 24, 25 }, // Byte 3
+ { 41, 45, 46, 42, 40, 44, 43, 47 }, // Byte 4
+ { 53, 49, 54, 50, 52, 48, 55, 51 }, // Byte 5
+ { 63, 62, 61, 60, 59, 58, 57, 56 }, // Byte 6
+ { 34, 35, 37, 36, 38, 39, 33, 32 } // Byte 7
+};
+const U8 DqMapCpu2DramSvCh1[8][8] = {
+ { 58, 62, 57, 61, 59, 63, 56, 60 }, // Byte 0
+ { 54, 50, 53, 49, 55, 51, 52, 48 }, // Byte 1
+ { 46, 47, 45, 44, 43, 42, 41, 40 }, // Byte 2
+ { 22, 19, 23, 18, 16, 21, 20, 17 }, // Byte 3
+ { 38, 34, 37, 33, 39, 35, 36, 32 }, // Byte 4
+ { 26, 30, 25, 29, 27, 31, 24, 28 }, // Byte 5
+ { 15, 11, 9, 13, 14, 10, 12, 8 }, // Byte 6
+ { 6, 7, 0, 1, 4, 5, 3, 2 } // Byte 7
+};
+
+#endif // ULT_FLAG
+
+const MrcVddSelect MemoryVoltageTable[] = {
+ //
+ // MB DT MB DT
+ // Voltage // GPIO24/GPIO60 GPIO46 GPIO8/GPIO45
+ //
+ 1650, // 0 0 0
+ 1600, // 0 0 1
+ 1550, // 0 1 0
+ 1503, // 0 1 1
+ 1500, // 1 0 0
+ 1450, // 1 0 1
+ 1400, // 1 1 0
+ 1350 // 1 1 1
+};
+
+/**
+ Gets CPU ratio
+
+ @param[in] Nothing
+
+ @retval Cpu ratio.
+**/
+U32
+MrcGetCpuRatio (
+ void
+ )
+{
+ PCU_CR_PLATFORM_INFO_STRUCT Msr;
+
+ Msr.Data = AsmReadMsr64 (PCU_CR_PLATFORM_INFO);
+ return (Msr.Bits.MAX_NON_TURBO_LIM_RATIO);
+}
+
+/**
+ Gets CPU current time.
+
+ @param[in] Nothing
+
+ @retval The current CPU time in milliseconds.
+**/
+U64
+MrcGetCpuTime (
+ void
+ )
+{
+ U32 TimeBase;
+
+ TimeBase = (1000 * MRC_SYSTEM_BCLK) * MrcGetCpuRatio (); //In Millisec
+ return ((TimeBase == 0) ? 0 : MrcOemMemoryDivideU64ByU64 (AsmReadTsc (), TimeBase));
+}
+
+/**
+ Sets CpuModel and CpuStepping in MrcData based on CpuModelStep.
+
+ @param[out] MrcData - The Mrc Host data structure
+ @param[in] CpuModel - The CPU Family Model.
+ @param[in] CpuStepping - The CPU Stepping.
+
+ @retval - mrcSuccess if the model and stepping is found. Otherwise mrcFail
+**/
+MrcStatus
+MrcSetCpuInformation (
+ OUT MrcParameters *MrcData,
+ IN MrcCpuModel CpuModel,
+ IN MrcCpuStepping CpuStepping
+ )
+{
+ MrcInput *Inputs;
+ MrcDebug *Debug;
+ MrcStatus Status;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ Status = mrcFail;
+
+#ifdef ULT_FLAG
+ if (CpuModel == cmHSW_ULT) {
+ Inputs->CpuModel = cmHSW_ULT;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Haswell ULT:");
+
+ switch (CpuStepping) {
+ case csHswUltB0:
+ Inputs->CpuStepping = csHswUltB0;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " Stepping B0\n");
+ break;
+
+ case csHswUltC0:
+ Inputs->CpuStepping = csHswUltC0;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " Stepping C0\n");
+ break;
+
+ default:
+ Inputs->CpuStepping = csHswUltB0; // @todo: Update for C0.
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_WARNING,
+ "\nWARNING: Unknown CPU stepping, using MRC for last known step. Step = %Xh\n",
+ Inputs->CpuStepping
+ );
+ break;
+ }
+ Status = mrcSuccess;
+ }
+#endif // ULT_FLAG
+
+#ifdef TRAD_FLAG
+ if (CpuModel == cmHSW) {
+ Inputs->CpuModel = cmHSW;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Haswell:");
+
+ switch (CpuStepping) {
+ case csHswA0:
+ Inputs->CpuStepping = csHswA0;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " Stepping A0\n");
+ break;
+
+ case csHswB0:
+ Inputs->CpuStepping = csHswB0;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " Stepping B0\n");
+ break;
+
+ case csHswC0:
+ Inputs->CpuStepping = csHswC0;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " Stepping C0\n");
+ break;
+
+ default:
+ Inputs->CpuStepping = csHswC0;
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_WARNING,
+ "\nWARNING: Unknown CPU stepping, using MRC for last known step. Step = %Xh\n",
+ Inputs->CpuStepping
+ );
+ break;
+ }
+ Status = mrcSuccess;
+ }
+
+ if (CpuModel == cmCRW) {
+ Inputs->CpuModel = cmCRW;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Crystalwell:");
+
+ switch (CpuStepping) {
+ case csCrwB0:
+ Inputs->CpuStepping = csCrwB0;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " Stepping B0\n");
+ break;
+
+ case csCrwC0:
+ Inputs->CpuStepping = csCrwC0;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " Stepping C0\n");
+ break;
+
+ default:
+ Inputs->CpuStepping = csCrwB0; // @todo: Update for C0
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_WARNING,
+ "\nWARNING: Unknown CPU stepping, using MRC for last known step. Step = %Xh\n",
+ Inputs->CpuStepping
+ );
+ break;
+ }
+ Status = mrcSuccess;
+ }
+#endif // TRAD_FLAG
+
+ return Status;
+}
+
+/**
+ Gets a number from the CPU's random number generator.
+
+ @param[in] Nothing
+
+ @retval Random number or zero if random number is not generated or is invalid.
+**/
+U32
+AsmGetRandomNumber (
+ void
+ )
+{
+ U32 Status;
+ U32 RandomNumber;
+
+ // Assembly instruction to read CPU's random number generator
+ // Instruction is only available 100k cycles after reset
+ // rdrand eax
+ // db 0Fh, 0C7h, 0F0h
+#if defined __GNUC__ // GCC compiler
+ __asm__ __volatile__ (
+ "\n\t .byte 0x0F, 0xC7, 0xF0"
+ "\n\t movl %%eax, %0"
+ "\n\t pushf"
+ "\n\t pop %%eax"
+ "\n\t movl %%eax, %1"
+ : "=m" (RandomNumber),
+ "=m" (Status)
+ );
+#else //MSFT compiler
+ ASM {
+ _emit 0x0F
+ _emit 0xC7
+ _emit 0xF0
+ mov RandomNumber, eax
+
+ pushfd
+ pop eax
+ mov Status, eax
+ }
+#endif
+ // If CF is cleared, return 0
+ return (((Status & 1) == 0) ? 0 : RandomNumber);
+}
+
+/**
+ Gets a random number from the CPU's random number generator.
+
+ @param[in] Nothing
+
+ @retval Random number returned by the CPU instruction or generated from real time clock data.
+**/
+U32
+MrcGetRandomNumber (
+ void
+ )
+{
+ U32 RandomNumber;
+ U32 Retry;
+ U16 Year;
+ U8 Month;
+ U8 DayOfMonth;
+ U8 Hours;
+ U8 Minutes;
+ U8 Seconds;
+
+ RandomNumber = 0;
+ for (Retry = 100000; ((Retry != 0) && (RandomNumber == 0)); --Retry) {
+ RandomNumber = AsmGetRandomNumber ();
+ }
+ if ((Retry == 0) && (RandomNumber == 0)) {
+ MrcOemGetRtcTime (&Seconds, &Minutes, &Hours, &DayOfMonth, &Month, &Year);
+ RandomNumber = Seconds + (Minutes * 60) + (Hours * 60 * 60);
+ }
+
+ return (RandomNumber);
+}
+
+/**
+ This function enables 2x Refresh through the mailbox.
+
+ @param[in] MrcData - Pointer to the MRC global data structure
+
+ @retval - Nothing.
+**/
+void
+MrcOemEnable2xRefresh (
+ IN MrcParameters *const MrcData
+ )
+{
+#ifndef MRC_MINIBIOS_BUILD
+ MrcDebug *Debug;
+ MrcMailbox2xRefresh Write2xRefreshData;
+ U32 MailboxStatus;
+
+ Debug = &MrcData->SysIn.Inputs.Debug;
+
+ MailboxRead(MAILBOX_TYPE_PCODE, READ_DDR_FORCE_2X_REFRESH, &Write2xRefreshData.Data, &MailboxStatus);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " Read Write2xRefreshData: 0x%x\n", Write2xRefreshData.Data);
+
+
+ if (!Write2xRefreshData.Bits.Lock_Bit) {
+ Write2xRefreshData.Bits.Lock_Bit = 1;
+ Write2xRefreshData.Bits.Enable_2x_Refresh = 1;
+#ifdef ULT_FLAG
+ if (MrcData->SysOut.Outputs.DdrType == MRC_DDR_TYPE_LPDDR3) {
+ Write2xRefreshData.Bits.LPDDR_Min_MR4 = RefRate2x; // Matches the JEDEC MR4 Encoding.
+ }
+#endif
+ MailboxWrite(MAILBOX_TYPE_PCODE, WRITE_DDR_FORCE_2X_REFRESH, Write2xRefreshData.Data, &MailboxStatus);
+
+ if (MailboxStatus != PCODE_MAILBOX_CC_SUCCESS) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "WRITE_DDR_FORCE_2X_REFRESH failed. MailboxStatus = 0x%x\n", MailboxStatus);
+ } else {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Writing 0x%x to WRITE_DDR_FORCE_2X_REFRESH\n", Write2xRefreshData.Data);
+ }
+ }
+#endif
+}
+
+/**
+ This function changes the DIMM Voltage to the closest desired voltage without
+ going higher. Default wait time is the minimum value of 200us, if more time
+ is needed before deassertion of DIMM Reset#, then change the parameter.
+
+ @param[in, out] MrcData - The MRC "global data" area.
+ @param[in] VddVoltage - Selects the DDR voltage to use, in mV.
+ @param[in, out] VddSettleWaitTime - Time needed for Vdd to settle after the update
+
+ @retval TRUE if a voltage change occurred, otherwise FALSE.
+**/
+BOOL
+MrcOemVDDVoltageCheckAndSwitch (
+ IN OUT MrcParameters *MrcData,
+ IN const MrcVddSelect VddVoltage,
+ IN OUT U32 * const VddSettleWaitTime
+ )
+{
+ MrcInput *Inputs;
+ MrcOutput *Outputs;
+ BOOL Status;
+ U32 GPIOBase;
+ U32 GPIO_In_31_0;
+ U32 GPIO_In_63_32;
+ U32 GPIO_Out_31_0;
+ U32 GPIO_Out_63_32;
+ U32 Current;
+ U8 Index;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ Status = FALSE;
+
+ if (((Inputs->MobilePlatform == TRUE) && (Inputs->BoardType != btUser4)) || (Inputs->MobilePlatform == FALSE)) {
+ //
+ // Read GPIO base.
+ //
+ MrcOemMmioRead (
+ MrcOemGetPcieDeviceAddress (0, PCI_DEVICE_NUMBER_PCH_LPC, 0, R_PCH_LPC_GPIO_BASE),
+ &GPIOBase,
+ Inputs->PciEBaseAddress
+ );
+ GPIOBase &= ~MRC_BIT0;
+
+#ifdef MRC_MINIBIOS_BUILD
+ if ((Inputs->MobilePlatform == TRUE) && (Inputs->BoardType != btUser4)) {
+ //
+ // Setup GPIOs (8,24,46)
+ //
+ GPIO_In_31_0 = MrcOemInPort32 ((U16) (GPIOBase + R_PCH_GPIO_USE_SEL));
+ if ((GPIO_In_31_0 & (MRC_BIT8 | MRC_BIT24)) != (MRC_BIT8 | MRC_BIT24)) {
+ GPIO_In_31_0 |= (MRC_BIT8 | MRC_BIT24);
+ MrcOemOutPort32 ((U16) (GPIOBase + R_PCH_GPIO_USE_SEL), GPIO_In_31_0);
+ }
+
+ GPIO_In_63_32 = MrcOemInPort32 ((U16) (GPIOBase + R_PCH_GPIO_USE_SEL2));
+ if ((GPIO_In_63_32 & MRC_BIT14) != MRC_BIT14) {
+ GPIO_In_63_32 |= MRC_BIT14;
+ MrcOemOutPort32 ((U16) (GPIOBase + R_PCH_GPIO_USE_SEL2), GPIO_In_63_32);
+ }
+
+ GPIO_In_31_0 = MrcOemInPort32 ((U16) (GPIOBase + R_PCH_GPIO_IO_SEL));
+ if ((GPIO_In_31_0 & (MRC_BIT8 | MRC_BIT24)) != 0) {
+ GPIO_In_31_0 &= ~(MRC_BIT8 | MRC_BIT24);
+ MrcOemOutPort32 ((U16) (GPIOBase + R_PCH_GPIO_IO_SEL), GPIO_In_31_0);
+ }
+
+ GPIO_In_63_32 = MrcOemInPort32 ((U16) (GPIOBase + R_PCH_GPIO_IO_SEL2));
+ if ((GPIO_In_63_32 & MRC_BIT14) != 0) {
+ GPIO_In_63_32 &= ~MRC_BIT14;
+ MrcOemOutPort32 ((U16) (GPIOBase + R_PCH_GPIO_IO_SEL2), GPIO_In_63_32);
+ }
+ } else if ((Inputs->MobilePlatform == FALSE) && (Inputs->BoardType == btCRBDT)) {
+ //
+ // Setup GPIOs (45,46,60)
+ //
+ GPIO_In_63_32 = MrcOemInPort32 ((U16) (GPIOBase + R_PCH_GPIO_USE_SEL2));
+ if ((GPIO_In_63_32 & (MRC_BIT28 | MRC_BIT14 | MRC_BIT13)) != (MRC_BIT28 | MRC_BIT14 | MRC_BIT13)) {
+ GPIO_In_63_32 |= (MRC_BIT28 | MRC_BIT14 | MRC_BIT13);
+ MrcOemOutPort32 ((U16) (GPIOBase + R_PCH_GPIO_USE_SEL2), GPIO_In_63_32);
+ }
+
+ GPIO_In_63_32 = MrcOemInPort32 ((U16) (GPIOBase + R_PCH_GPIO_IO_SEL2));
+ if ((GPIO_In_63_32 & (MRC_BIT28 | MRC_BIT14 | MRC_BIT13)) != 0) {
+ GPIO_In_63_32 &= ~(MRC_BIT28 | MRC_BIT14 | MRC_BIT13);
+ MrcOemOutPort32 ((U16) (GPIOBase + R_PCH_GPIO_IO_SEL2), GPIO_In_63_32);
+ }
+ }
+#endif // MRC_MINIBIOS_BUILD
+
+ GPIO_In_31_0 = MrcOemInPort32 ((U16) (GPIOBase + R_PCH_GPIO_LVL));
+ GPIO_In_63_32 = MrcOemInPort32 ((U16) (GPIOBase + R_PCH_GPIO_LVL2));
+ GPIO_Out_31_0 = GPIO_In_31_0;
+ GPIO_Out_63_32 = GPIO_In_63_32;
+
+ for (Index = 0; Index < (sizeof (MemoryVoltageTable) / sizeof (MemoryVoltageTable[0])); Index++) {
+ if (VddVoltage >= MemoryVoltageTable[Index]) {
+ break;
+ }
+ }
+
+#ifdef EMBEDDED_FLAG
+ if (Inputs->BoardType == btCRBEMB) {
+ //
+ // Set GP24 to the required value.
+ //
+ Current = (((GPIO_Out_31_0 & MRC_BIT24) >> 22) ^ MRC_BIT2) | MRC_BIT1 | MRC_BIT0;
+ (Index & MRC_BIT1) ? (GPIO_Out_31_0 &= (~MRC_BIT24)) : (GPIO_Out_31_0 |= MRC_BIT24);
+ } else
+#endif
+
+ if ((Inputs->MobilePlatform == TRUE) && (Inputs->BoardType != btUser4)) {
+ //
+ // Set GP8, GP24, and GP46 to the required value.
+ //
+ Current = (((GPIO_Out_31_0 & MRC_BIT24) >> 22) | ((GPIO_Out_63_32 & MRC_BIT14) >> 13) | ((GPIO_Out_31_0 & MRC_BIT8) >> 8));
+ (Index & MRC_BIT2) ? (GPIO_Out_31_0 |= MRC_BIT24) : (GPIO_Out_31_0 &= (~MRC_BIT24));
+ (Index & MRC_BIT1) ? (GPIO_Out_63_32 |= MRC_BIT14) : (GPIO_Out_63_32 &= (~MRC_BIT14));
+ (Index & MRC_BIT0) ? (GPIO_Out_31_0 |= MRC_BIT8) : (GPIO_Out_31_0 &= (~MRC_BIT8));
+ } else if ((Inputs->MobilePlatform == FALSE) && (Inputs->BoardType == btCRBDT)) {
+ //
+ // Set GP45, GP46, and GP60 to the required value.
+ //
+ Current = (((GPIO_Out_63_32 & MRC_BIT28) >> 26) | ((GPIO_Out_63_32 & MRC_BIT14) >> 13) | ((GPIO_Out_63_32 & MRC_BIT13) >> 13));
+ (Index & MRC_BIT2) ? (GPIO_Out_63_32 |= MRC_BIT28) : (GPIO_Out_63_32 &= (~MRC_BIT28));
+ (Index & MRC_BIT1) ? (GPIO_Out_63_32 |= MRC_BIT14) : (GPIO_Out_63_32 &= (~MRC_BIT14));
+ (Index & MRC_BIT0) ? (GPIO_Out_63_32 |= MRC_BIT13) : (GPIO_Out_63_32 &= (~MRC_BIT13));
+ } else {
+ Current = 4;
+ }
+
+ MRC_DEBUG_MSG (&Inputs->Debug, MSG_LEVEL_NOTE, "Current VddVoltage is %u mV\n", MemoryVoltageTable[Current]);
+ if ((GPIO_In_31_0 != GPIO_Out_31_0) || (GPIO_In_63_32 != GPIO_Out_63_32)) {
+ MRC_DEBUG_MSG (&Inputs->Debug, MSG_LEVEL_NOTE, "**** VddVoltage updated to %u mV\n", VddVoltage);
+ MrcOemOutPort32 ((U16) (GPIOBase + R_PCH_GPIO_LVL), GPIO_Out_31_0);
+ MrcOemOutPort32 ((U16) (GPIOBase + R_PCH_GPIO_LVL2), GPIO_Out_63_32);
+ Status = TRUE;
+ }
+
+ //
+ // Increase the VddSettleWaitTime by the amount requested in the Input structure
+ //
+ *VddSettleWaitTime += Inputs->VddSettleWaitTime;
+
+ //
+ // Either update was already done or change is not necessary every time this is called
+ //
+ Outputs->VddVoltageDone = TRUE;
+ }
+
+ return (Status);
+}
+
+/**
+ Hook before normal mode is enabled.
+
+ @param[in, out] MrcData - The MRC "global data" area.
+
+ @retval Nothing.
+**/
+void
+MrcOemBeforeNormalModeTestMenu (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+
+ return;
+}
+
+/**
+ Hook after normal mode is enabled
+
+ @param[in] MrcData - The MRC "global data" area.
+
+ @retval Nothing.
+**/
+void
+MrcOemAfterNormalModeTestMenu (
+ IN MrcParameters *MrcData
+ )
+{
+
+ MrcThermalOverwrites (MrcData);
+
+ // @todo: Add lates code DDR Thermal Management, throttling control. Also UP CLTT code
+ //
+// AMI_OVERRIDE_FOR_UPSERVER_SUPPORT
+#ifdef UPSERVER_SUPPORT
+ MrcCltmInit (MrcData);
+#endif // UPSERVER_SUPPORT
+// AMI_OVERRIDE_FOR_UPSERVER_SUPPORT
+ return;
+}
+
+/**
+ Overwrite Thermal settings
+
+ @param[in] MrcData - The MRC "global data" area.
+
+ @retval Nothing.
+**/
+void
+MrcThermalOverwrites (
+ IN MrcParameters *MrcData
+ )
+{
+ MrcInput *Inputs;
+ MrcOutput *Outputs;
+ MrcDebug *Debug;
+ MrcDdrType DdrType;
+ ThermalMngmtEn *ThermalEnables;
+ U8 Channel;
+ U32 Offset;
+ PCU_CR_DDR_PTM_CTL_PCU_STRUCT DdrPtmCtl;
+ PCU_CR_DDR_ENERGY_SCALEFACTOR_PCU_STRUCT DdrEnergyScaleFactor;
+ PCU_CR_DDR_RAPL_CHANNEL_POWER_FLOOR_PCU_STRUCT DdrRaplChannelPowerFloor;
+ PCU_CR_DDR_RAPL_LIMIT_PCU_STRUCT DdrRaplLimit;
+ PCU_CR_DDR_WARM_THRESHOLD_CH0_PCU_STRUCT DdrWarmThresholdCh0;
+ PCU_CR_DDR_WARM_THRESHOLD_CH1_PCU_STRUCT DdrWarmThresholdCh1;
+ PCU_CR_DDR_HOT_THRESHOLD_CH0_PCU_STRUCT DdrHotThresholdCh0;
+ PCU_CR_DDR_HOT_THRESHOLD_CH1_PCU_STRUCT DdrHotThresholdCh1;
+ PCU_CR_DDR_WARM_BUDGET_CH0_PCU_STRUCT DdrWarmBudgetCh0;
+ PCU_CR_DDR_WARM_BUDGET_CH1_PCU_STRUCT DdrWarmBudgetCh1;
+ PCU_CR_DDR_HOT_BUDGET_CH0_PCU_STRUCT DdrHotBudgetCh0;
+ PCU_CR_DDR_HOT_BUDGET_CH1_PCU_STRUCT DdrHotBudgetCh1;
+ MCHBAR_CH0_CR_PM_DIMM_IDLE_ENERGY_STRUCT PmDimmIdleEnergy;
+ MCHBAR_CH0_CR_PM_DIMM_PD_ENERGY_STRUCT PmDimmPdEnergy;
+ MCHBAR_CH0_CR_PM_DIMM_ACT_ENERGY_STRUCT PmDimmActEnergy;
+ MCHBAR_CH0_CR_PM_DIMM_RD_ENERGY_STRUCT PmDimmRdEnergy;
+ MCHBAR_CH0_CR_PM_DIMM_WR_ENERGY_STRUCT PmDimmWrEnergy;
+ MCHBAR_CH0_CR_PM_THRT_CKE_MIN_STRUCT PmThrtCkeMin;
+ MCDECS_CR_PM_SREF_CONFIG_MCMAIN_STRUCT PmSrefConfig;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ ThermalEnables = &Inputs->ThermalEnables;
+ Outputs = &MrcData->SysOut.Outputs;
+ DdrType = Outputs->DdrType;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "...Thermal Overwrite ...\n");
+
+ if (Inputs->ThermalEnables.UserPowerWeightsEn) {
+ //
+ // ENERGY SCALE FACTOR
+ //
+ DdrEnergyScaleFactor.Data = 0;
+ DdrEnergyScaleFactor.Bits.SCALEFACTOR = ThermalEnables->EnergyScaleFact;
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "DDR_ENERGY_SCALEFACTOR %Xh: %Xh \n",
+ PCU_CR_DDR_ENERGY_SCALEFACTOR_PCU_REG,
+ DdrEnergyScaleFactor.Data
+ );
+ MrcWriteCR (MrcData, PCU_CR_DDR_ENERGY_SCALEFACTOR_PCU_REG, DdrEnergyScaleFactor.Data);
+
+ //
+ // RAPL POWER FLOOR
+ //
+ DdrRaplChannelPowerFloor.Data = 0;
+ DdrRaplChannelPowerFloor.Bits.CH0 = ThermalEnables->RaplPwrFl[0];
+ DdrRaplChannelPowerFloor.Bits.CH1 = ThermalEnables->RaplPwrFl[1];
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "DDR_RAPL_CHANNEL_POWER_FLOOR %Xh: %Xh \n",
+ PCU_CR_DDR_RAPL_CHANNEL_POWER_FLOOR_PCU_REG,
+ DdrRaplChannelPowerFloor.Data
+ );
+ MrcWriteCR (MrcData, PCU_CR_DDR_RAPL_CHANNEL_POWER_FLOOR_PCU_REG, DdrRaplChannelPowerFloor.Data);
+ }
+
+ //
+ // RAPL LIMIT
+ //
+ DdrRaplLimit.Data = 0;
+ DdrRaplLimit.Bits.LIMIT1_TIME_WINDOW_X = ThermalEnables->RaplLim1WindX;
+ DdrRaplLimit.Bits.LIMIT1_TIME_WINDOW_Y = ThermalEnables->RaplLim1WindY;
+ DdrRaplLimit.Bits.LIMIT1_ENABLE = ThermalEnables->RaplLim1Ena;
+ DdrRaplLimit.Bits.LIMIT1_POWER = ThermalEnables->RaplLim1Pwr;
+ DdrRaplLimit.Bits.LOCKED = ThermalEnables->RaplLim2Lock;
+ DdrRaplLimit.Bits.LIMIT2_TIME_WINDOW_X = ThermalEnables->RaplLim2WindX;
+ DdrRaplLimit.Bits.LIMIT2_TIME_WINDOW_Y = ThermalEnables->RaplLim2WindY;
+ DdrRaplLimit.Bits.LIMIT2_ENABLE = ThermalEnables->RaplLim2Ena;
+ DdrRaplLimit.Bits.LIMIT2_POWER = ThermalEnables->RaplLim2Pwr;
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "DDR_RAPL_LIMIT1 %Xh: %Xh \n",
+ PCU_CR_DDR_RAPL_LIMIT_PCU_REG,
+ DdrRaplLimit.Data32[0]
+ );
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "DDR_RAPL_LIMIT2 %Xh: %Xh \n",
+ PCU_CR_DDR_RAPL_LIMIT_PCU_REG + 4,
+ DdrRaplLimit.Data32[1]
+ );
+ MrcWriteCR (MrcData, PCU_CR_DDR_RAPL_LIMIT_PCU_REG, DdrRaplLimit.Data32[0]);
+ MrcWriteCR (MrcData, PCU_CR_DDR_RAPL_LIMIT_PCU_REG + 4, DdrRaplLimit.Data32[1]);
+
+ //
+ // DDR WARM AND HOT THRESHOLD
+ //
+ DdrWarmThresholdCh0.Data = 0;
+ DdrWarmThresholdCh0.Bits.DIMM1 = ThermalEnables->WarmThreshold[0][1];
+ DdrWarmThresholdCh0.Bits.DIMM0 = ThermalEnables->WarmThreshold[0][0];
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "DDR_WARM_THRESHOLD_CH0 %Xh: %Xh \n",
+ PCU_CR_DDR_WARM_THRESHOLD_CH0_PCU_REG,
+ DdrWarmThresholdCh0.Data
+ );
+ MrcWriteCR (MrcData, PCU_CR_DDR_WARM_THRESHOLD_CH0_PCU_REG, DdrWarmThresholdCh0.Data);
+
+ DdrWarmThresholdCh1.Data = 0;
+ DdrWarmThresholdCh1.Bits.DIMM1 = ThermalEnables->WarmThreshold[1][1];
+ DdrWarmThresholdCh1.Bits.DIMM0 = ThermalEnables->WarmThreshold[1][0];
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "DDR_WARM_THRESHOLD_CH1 %Xh: %Xh \n",
+ PCU_CR_DDR_WARM_THRESHOLD_CH1_PCU_REG,
+ DdrWarmThresholdCh1.Data
+ );
+ MrcWriteCR (MrcData, PCU_CR_DDR_WARM_THRESHOLD_CH1_PCU_REG, DdrWarmThresholdCh1.Data);
+
+ DdrHotThresholdCh0.Data = 0;
+ DdrHotThresholdCh0.Bits.DIMM1 = ThermalEnables->HotThreshold[0][1];
+ DdrHotThresholdCh0.Bits.DIMM0 = ThermalEnables->HotThreshold[0][0];
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "DDR_HOT_THRESHOLD_CH0 %Xh: %Xh \n",
+ PCU_CR_DDR_HOT_THRESHOLD_CH0_PCU_REG,
+ DdrHotThresholdCh0.Data
+ );
+ MrcWriteCR (MrcData, PCU_CR_DDR_HOT_THRESHOLD_CH0_PCU_REG, DdrHotThresholdCh0.Data);
+
+ DdrHotThresholdCh1.Data = 0;
+ DdrHotThresholdCh1.Bits.DIMM1 = ThermalEnables->HotThreshold[1][1];
+ DdrHotThresholdCh1.Bits.DIMM0 = ThermalEnables->HotThreshold[1][0];
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "DDR_HOT_THRESHOLD_CH1 %Xh: %Xh \n",
+ PCU_CR_DDR_HOT_THRESHOLD_CH1_PCU_REG,
+ DdrHotThresholdCh1.Data
+ );
+ MrcWriteCR (MrcData, PCU_CR_DDR_HOT_THRESHOLD_CH1_PCU_REG, DdrHotThresholdCh1.Data);
+
+ //
+ // DDR WARM AND HOT BUDGET
+ //
+ DdrWarmBudgetCh0.Data = 0;
+ DdrWarmBudgetCh0.Bits.DIMM1 = ThermalEnables->WarmBudget[0][1];
+ DdrWarmBudgetCh0.Bits.DIMM0 = ThermalEnables->WarmBudget[0][0];
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "DDR_WARM_BUDGET_CH0 %Xh: %Xh \n",
+ PCU_CR_DDR_WARM_BUDGET_CH0_PCU_REG,
+ DdrWarmBudgetCh0.Data
+ );
+ MrcWriteCR (MrcData, PCU_CR_DDR_WARM_BUDGET_CH0_PCU_REG, DdrWarmBudgetCh0.Data);
+
+ DdrWarmBudgetCh1.Data = 0;
+ DdrWarmBudgetCh1.Bits.DIMM1 = ThermalEnables->WarmBudget[1][1];
+ DdrWarmBudgetCh1.Bits.DIMM0 = ThermalEnables->WarmBudget[1][0];
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "DDR_WARM_BUDGET_CH1 %Xh: %Xh \n",
+ PCU_CR_DDR_WARM_BUDGET_CH1_PCU_REG,
+ DdrWarmBudgetCh1.Data
+ );
+ MrcWriteCR (MrcData, PCU_CR_DDR_WARM_BUDGET_CH1_PCU_REG, DdrWarmBudgetCh1.Data);
+
+ DdrHotBudgetCh0.Data = 0;
+ DdrHotBudgetCh0.Bits.DIMM1 = ThermalEnables->HotBudget[0][1];
+ DdrHotBudgetCh0.Bits.DIMM0 = ThermalEnables->HotBudget[0][0];
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "DDR_HOT_BUDGET_CH0 %Xh: %Xh \n",
+ PCU_CR_DDR_HOT_BUDGET_CH0_PCU_REG,
+ DdrHotBudgetCh0.Data
+ );
+ MrcWriteCR (MrcData, PCU_CR_DDR_HOT_BUDGET_CH0_PCU_REG, DdrHotBudgetCh0.Data);
+
+ DdrHotBudgetCh1.Data = 0;
+ DdrHotBudgetCh1.Bits.DIMM1 = ThermalEnables->HotBudget[1][1];
+ DdrHotBudgetCh1.Bits.DIMM0 = ThermalEnables->HotBudget[1][0];
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "DDR_HOT_BUDGET_CH1 %Xh: %Xh \n",
+ PCU_CR_DDR_HOT_BUDGET_CH1_PCU_REG,
+ DdrHotBudgetCh1.Data
+ );
+ MrcWriteCR (MrcData, PCU_CR_DDR_HOT_BUDGET_CH1_PCU_REG, DdrHotBudgetCh1.Data);
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ if (Inputs->ThermalEnables.UserPowerWeightsEn) {
+ PmDimmIdleEnergy.Data = 0;
+ PmDimmIdleEnergy.Bits.DIMM1_IDLE_ENERGY = ThermalEnables->IdleEnergy[Channel][1];
+ PmDimmIdleEnergy.Bits.DIMM0_IDLE_ENERGY = ThermalEnables->IdleEnergy[Channel][0];
+ Offset = MCHBAR_CH0_CR_PM_DIMM_IDLE_ENERGY_REG +
+ (MCHBAR_CH1_CR_PM_DIMM_IDLE_ENERGY_REG - MCHBAR_CH0_CR_PM_DIMM_IDLE_ENERGY_REG) * Channel;
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "C%u PM_DIMM_IDLE_ENERGY %Xh: %Xh \n",
+ Channel,
+ Offset,
+ PmDimmIdleEnergy.Data
+ );
+ MrcWriteCR (MrcData, Offset, PmDimmIdleEnergy.Data);
+
+ PmDimmPdEnergy.Data = 0;
+ PmDimmPdEnergy.Bits.DIMM1_PD_ENERGY = ThermalEnables->PdEnergy[Channel][1];
+ PmDimmPdEnergy.Bits.DIMM0_PD_ENERGY = ThermalEnables->PdEnergy[Channel][0];
+ Offset = MCHBAR_CH0_CR_PM_DIMM_PD_ENERGY_REG +
+ (MCHBAR_CH1_CR_PM_DIMM_PD_ENERGY_REG - MCHBAR_CH0_CR_PM_DIMM_PD_ENERGY_REG) * Channel;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "C%u PM_DIMM_PD_ENERGY %Xh: %Xh \n", Channel, Offset, PmDimmPdEnergy.Data);
+ MrcWriteCR (MrcData, Offset, PmDimmPdEnergy.Data);
+
+ PmDimmActEnergy.Data = 0;
+ PmDimmActEnergy.Bits.DIMM1_ACT_ENERGY = ThermalEnables->ActEnergy[Channel][1];
+ PmDimmActEnergy.Bits.DIMM0_ACT_ENERGY = ThermalEnables->ActEnergy[Channel][0];
+ Offset = MCHBAR_CH0_CR_PM_DIMM_ACT_ENERGY_REG +
+ (MCHBAR_CH1_CR_PM_DIMM_ACT_ENERGY_REG - MCHBAR_CH0_CR_PM_DIMM_ACT_ENERGY_REG) * Channel;
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "C%u PM_DIMM_ACT_ENERGY %Xh: %Xh \n",
+ Channel,
+ Offset,
+ PmDimmActEnergy.Data
+ );
+ MrcWriteCR (MrcData, Offset, PmDimmActEnergy.Data);
+
+ PmDimmRdEnergy.Data = 0;
+ PmDimmRdEnergy.Bits.DIMM1_RD_ENERGY = ThermalEnables->RdEnergy[Channel][1];
+ PmDimmRdEnergy.Bits.DIMM0_RD_ENERGY = ThermalEnables->RdEnergy[Channel][0];
+ Offset = MCHBAR_CH0_CR_PM_DIMM_RD_ENERGY_REG +
+ (MCHBAR_CH1_CR_PM_DIMM_RD_ENERGY_REG - MCHBAR_CH0_CR_PM_DIMM_RD_ENERGY_REG) * Channel;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "C%u PM_DIMM_RD_ENERGY %Xh: %Xh \n", Channel, Offset, PmDimmRdEnergy.Data);
+ MrcWriteCR (MrcData, Offset, PmDimmRdEnergy.Data);
+
+ PmDimmWrEnergy.Data = 0;
+ PmDimmWrEnergy.Bits.DIMM1_WR_ENERGY = ThermalEnables->WrEnergy[Channel][1];
+ PmDimmWrEnergy.Bits.DIMM0_WR_ENERGY = ThermalEnables->WrEnergy[Channel][0];
+ Offset = MCHBAR_CH0_CR_PM_DIMM_WR_ENERGY_REG +
+ (MCHBAR_CH1_CR_PM_DIMM_WR_ENERGY_REG - MCHBAR_CH0_CR_PM_DIMM_WR_ENERGY_REG) * Channel;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "C%u PM_DIMM_WR_ENERGY %Xh: %Xh \n", Channel, Offset, PmDimmWrEnergy.Data);
+ MrcWriteCR (MrcData, Offset, PmDimmWrEnergy.Data);
+ }
+
+ PmThrtCkeMin.Data = 0;
+#ifdef ULT_FLAG
+ if (DdrType == MRC_DDR_TYPE_LPDDR3) {
+ PmThrtCkeMin.Bits.CKE_MIN_DEFEATURE = ThermalEnables->ThrtCkeMinDefeatLpddr;
+ PmThrtCkeMin.Bits.CKE_MIN = ThermalEnables->ThrtCkeMinTmrLpddr;
+ } else
+#endif // ULT_FLAG
+ {
+ PmThrtCkeMin.Bits.CKE_MIN_DEFEATURE = ThermalEnables->ThrtCkeMinDefeat;
+ PmThrtCkeMin.Bits.CKE_MIN = ThermalEnables->ThrtCkeMinTmr;
+ }
+ Offset = MCHBAR_CH0_CR_PM_THRT_CKE_MIN_REG +
+ (MCHBAR_CH1_CR_PM_THRT_CKE_MIN_REG - MCHBAR_CH0_CR_PM_THRT_CKE_MIN_REG) * Channel;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "C%u PM_THRT_CKE_MIN %Xh: %Xh \n", Channel, Offset, PmThrtCkeMin.Data);
+ MrcWriteCR (MrcData, Offset, PmThrtCkeMin.Data);
+ }
+ }
+
+ PmSrefConfig.Data = 0;
+ PmSrefConfig.Bits.SR_Enable = ThermalEnables->SrefCfgEna;
+ PmSrefConfig.Bits.Idle_timer = ThermalEnables->SrefCfgIdleTmr;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "PM_SREF_CONFIG %Xh: %Xh\n", MCDECS_CR_PM_SREF_CONFIG_MCMAIN_REG, PmSrefConfig.Data);
+ MrcWriteCR (MrcData, MCDECS_CR_PM_SREF_CONFIG_MCMAIN_REG, PmSrefConfig.Data);
+
+ //
+ // POWER THERMAL MANAGEMENT CONTROL
+ //
+ DdrPtmCtl.Data = MrcReadCR (MrcData, PCU_CR_DDR_PTM_CTL_PCU_REG);
+ DdrPtmCtl.Bits.OLTM_ENABLE = ThermalEnables->EnableOltm;
+ DdrPtmCtl.Bits.CLTM_ENABLE = ThermalEnables->EnableCltm;
+ DdrPtmCtl.Bits.EXTTS_ENABLE = ThermalEnables->EnableExtts;
+ DdrPtmCtl.Bits.REFRESH_2X_MODE = ThermalEnables->Refresh2X;
+#ifdef ULT_FLAG
+ if (DdrType == MRC_DDR_TYPE_LPDDR3) {
+ DdrPtmCtl.Bits.PDWN_CONFIG_CTL = ThermalEnables->EnablePwrDnLpddr;
+ //
+ // When enabling 2x Refresh for LPDDR through the Mailbox we must
+ // ensure DDR_PTM_CTL.DISABLE_DRAM_TS = 0. Thus we ignore LpddrThermalSensor.
+ //
+ if (Inputs->RefreshRate2x == FALSE) {
+ DdrPtmCtl.Bits.DISABLE_DRAM_TS = (ThermalEnables->LpddrThermalSensor == 0) ? 1 : 0;
+ } else {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Ignoring ThermalEnables->LpddrThermal Sensor as 2x Refresh is enabled\n");
+ }
+ } else
+#endif // ULT_FLAG
+ {
+ DdrPtmCtl.Bits.PDWN_CONFIG_CTL = ThermalEnables->EnablePwrDn;
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "DDR_PTM_CTL %Xh: %Xh\n", PCU_CR_DDR_PTM_CTL_PCU_REG, DdrPtmCtl.Data);
+ MrcWriteCR (MrcData, PCU_CR_DDR_PTM_CTL_PCU_REG, DdrPtmCtl.Data);
+
+ return;
+}
+
+
+/**
+ this function use by the OEM to do dedicated task during the MRC.
+
+ @param[in] MrcData - include all the MRC data
+ @param[in] OemStatusCommand - A command that indicates the task to perform.
+ @param[in] ptr - general ptr for general use.
+
+ @retval The status of the task.
+**/
+MrcStatus
+MrcOemCheckPoint (
+ IN MrcParameters *MrcData,
+ IN MRC_OemStatusCommand OemStatusCommand,
+ IN void *ptr
+ )
+{
+ MrcInput *Inputs;
+ MrcOutput *Outputs;
+ MrcStatus Status;
+ MrcDdrType DdrType;
+
+ Status = mrcSuccess;
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ DdrType = Outputs->DdrType;
+
+
+ switch (OemStatusCommand) {
+ case OemSpdProcessingRun:
+ break;
+
+ case OemPreTraining:
+ break;
+
+ case OemMcTrainingRun:
+ break;
+
+ case OemEarlyCommandTraining:
+ if (DdrType == MRC_DDR_TYPE_LPDDR3) {
+ Status = mrcSuccess; // This is required for LPDDR
+ } else if (!Inputs->TrainingEnables.ECT) {
+ Status = mrcFail; // Skip this training step
+ }
+ break;
+
+#ifdef ULT_FLAG
+ case OemJedecInitLpddr3: // MrcJedecInitLpddr3
+ if (DdrType == MRC_DDR_TYPE_LPDDR3) {
+ Status = mrcSuccess;
+ } else {
+ Status = mrcFail; // Skip this step for non-LPDDR
+ }
+ break;
+#endif // ULT_FLAG
+
+ case OemSenseAmpTraining:
+ if (!Inputs->TrainingEnables.SOT) {
+ Status = mrcFail; // Skip this training step
+ }
+ break;
+
+ case OemReadMprTraining:
+ if (!Inputs->TrainingEnables.RDMPRT) {
+ Status = mrcFail; // Skip this training step
+ }
+ break;
+
+ case OemReceiveEnable:
+ if (!Inputs->TrainingEnables.RCVET) {
+ Status = mrcFail; // Skip this training step
+ }
+ break;
+
+ case OemJedecWriteLeveling:
+ if (!Inputs->TrainingEnables.JWRL) {
+ Status = mrcFail; // Skip this training step
+ }
+ break;
+
+ case OemWriteLeveling:
+ if (!Inputs->TrainingEnables.FWRL) {
+ Status = mrcFail; // Skip this training step
+ }
+ break;
+
+ case OemWriteDqDqs:
+ if (!Inputs->TrainingEnables.WRTC1D) {
+ Status = mrcFail; // Skip this training step
+ }
+ break;
+
+ case OemReadDqDqs:
+ if (!Inputs->TrainingEnables.RDTC1D) {
+ Status = mrcFail; // Skip this training step
+ }
+ break;
+
+ case OemDimmODTTraining:
+ if (!Inputs->TrainingEnables.DIMMODTT) {
+ Status = mrcFail; // Skip this training step
+ }
+ break;
+
+ case OemDimmRonTraining:
+ if (!Inputs->TrainingEnables.DIMMRONT) {
+ Status = mrcFail; // Skip this training step
+ }
+ break;
+
+ case OemWriteSlewRate:
+ if (!Inputs->TrainingEnables.WRSRT) {
+ Status = mrcFail; // Skip this training step
+ }
+ break;
+
+ case OemDimmODT1dTraining:
+ if (!Inputs->TrainingEnables.DIMMODTT1D) {
+ Status = mrcFail; // Skip this training step
+ }
+ break;
+
+ case OemWriteDriveStrength:
+ if (!Inputs->TrainingEnables.WRDST) {
+ Status = mrcFail; // Skip this training step
+ }
+ break;
+
+ case OemWriteEQTraining:
+ if (!Inputs->TrainingEnables.WREQT) {
+ Status = mrcFail; // Skip this training step
+ }
+ break;
+
+ case OemReadODTTraining:
+ if (!Inputs->TrainingEnables.RDODTT) {
+ Status = mrcFail; // Skip this training step
+ }
+ break;
+
+ case OemReadEQTraining:
+ if (!Inputs->TrainingEnables.RDEQT) {
+ Status = mrcFail; // Skip this training step
+ }
+ break;
+
+ case OemPostTraining:
+ if (DdrType == MRC_DDR_TYPE_LPDDR3) {
+ Status = mrcFail; // Skip this training step
+ break;
+ }
+ break;
+
+ case OemReadAmplifierPower:
+ if (!Inputs->TrainingEnables.RDAPT) {
+ Status = mrcFail; // Skip this training step
+ }
+ break;
+
+ case OemOptimizeComp:
+ break;
+
+ case OemWriteDqDqs2D:
+ if (!Inputs->TrainingEnables.WRTC2D) {
+ Status = mrcFail; // Skip this training step
+ }
+ break;
+
+ case OemReadDqDqs2D:
+ if (!Inputs->TrainingEnables.RDTC2D) {
+ Status = mrcFail; // Skip this training step
+ }
+ break;
+
+ case OemCmdVoltCentering:
+ if (!Inputs->TrainingEnables.CMDVC) {
+ Status = mrcFail; // Skip this training step
+ }
+ break;
+
+ case OemWriteVoltCentering2D:
+ if (!Inputs->TrainingEnables.WRVC2D) {
+ Status = mrcFail; // Skip this training step
+ }
+ break;
+
+ case OemReadVoltCentering2D:
+ if (!Inputs->TrainingEnables.RDVC2D) {
+ Status = mrcFail; // Skip this training step
+ }
+ break;
+
+ case OemLateCommandTraining:
+ if (!Inputs->TrainingEnables.LCT) {
+ Status = mrcFail; // Skip this training step
+ }
+ break;
+
+ case OemRoundTripLatency:
+ if (!Inputs->TrainingEnables.RTL) {
+ Status = mrcFail; // Skip this training step
+ }
+ break;
+
+ case OemTurnAroundTimes:
+ //
+ // @todo: TAT has to be updated for LPDDR3, skip it for now.
+ //
+ if ((!Inputs->TrainingEnables.TAT) || (DdrType == MRC_DDR_TYPE_LPDDR3)) {
+ Status = mrcFail; // Skip this training step
+ }
+ break;
+
+#ifdef ULT_FLAG
+ case OemRcvEnCentering1D:
+ if ((!Inputs->TrainingEnables.RCVENC1D) || (DdrType != MRC_DDR_TYPE_LPDDR3)) {
+ Status = mrcFail; // Skip this step for non-LPDDR
+ }
+ break;
+#endif // ULT_FLAG
+
+ case OemRetrainMarginCheck:
+ if (!Inputs->TrainingEnables.RMC) {
+ Status = mrcFail; // Skip this training step
+ }
+ break;
+
+
+ case OemRmt:
+ if (!Inputs->TrainingEnables.RMT) {
+ Status = mrcFail; // Skip this training step
+ }
+ break;
+
+ case OemMemTest:
+ if (!Inputs->TrainingEnables.MEMTST) {
+ Status = mrcFail; // Skip this training step
+ }
+ break;
+
+ case OemAliasCheck:
+ if (!Inputs->TrainingEnables.ALIASCHK) {
+ Status = mrcFail; // Skip this training step
+ }
+ break;
+
+ case OemBeforeNormalMode:
+ MrcOemBeforeNormalModeTestMenu (MrcData);
+ break;
+
+ case OemAfterNormalMode:
+ MrcOemAfterNormalModeTestMenu (MrcData);
+ break;
+
+ case OemFrequencySetDone:
+#ifdef SSA_FLAG
+#ifndef MRC_MINIBIOS_BUILD
+ SsaBiosInitialize (MrcData);
+#endif
+#endif // SSA_FLAG
+ break;
+
+ default:
+ break;
+ }
+
+ return Status;
+}
+
+/**
+ This function display on port 80 number.
+ It can be different debug interface.
+ This function can be use for any debug ability according to OEM requirements.
+
+ @param[in] MrcData - Mrc Global Data
+ @param[in] DisplayDebugNumber - the number to display on port 80.
+
+ @retval Nothing
+**/
+void
+MrcOemDebugHook (
+ IN MrcParameters *MrcData,
+ IN U16 DisplayDebugNumber
+ )
+{
+ MrcInput *Inputs;
+ U8 temp;
+ U16 BreakCmos;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Inputs->Debug.PostCode[1] = DisplayDebugNumber;
+ MrcOemOutPort16 (0x80, DisplayDebugNumber);
+ MRC_DEBUG_MSG (&Inputs->Debug, MSG_LEVEL_NOTE, "Post Code: 0x%X\n", DisplayDebugNumber);
+
+ //
+ // Check if we should break on this post code.
+ //
+ do {
+ temp = RtcRead (MRC_POST_CODE_LOW_BYTE_ADDR);
+ BreakCmos = (RtcRead (MRC_POST_CODE_HIGH_BYTE_ADDR) << 8) | temp;
+ } while (DisplayDebugNumber == BreakCmos);
+
+#ifdef SSA_FLAG
+#ifndef MRC_MINIBIOS_BUILD
+ if ((void *) (Inputs->SsaCallbackPpi) != NULL) {
+ (((SSA_BIOS_CALLBACKS_PPI *) (Inputs->SsaCallbackPpi))->MrcCheckpoint) ((EFI_PEI_SERVICES **) (Inputs->Debug.Stream), ((SSA_BIOS_CALLBACKS_PPI *)Inputs->SsaCallbackPpi), DisplayDebugNumber, NULL);
+ }
+#endif
+#endif // SSA_FLAG
+
+ return;
+}
+
+#ifdef MRC_DEBUG_PRINT
+/**
+ Print the input parameters to the debug message output port.
+
+ @param[in] MrcData - The MRC global data.
+
+ @retval mrcSuccess
+**/
+MrcStatus
+MrcPrintInputParameters (
+ IN MrcParameters *const MrcData
+ )
+{
+ const MrcDebug *Debug;
+ const MrcInput *Inputs;
+ const MrcControllerIn *ControllerIn;
+ const MrcChannelIn *ChannelIn;
+ const MrcDimmIn *DimmIn;
+ const TrainingStepsEn *TrainingSteps;
+ U8 Controller;
+ U8 Channel;
+ U8 Dimm;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "*************************************\n");
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "*****MRC INPUT PARAMS DUMP START*****\n");
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "*************************************\n");
+ //
+ // The following are system level definitions. All memory controllers in the system are set to these values.
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Debug.Stream : %Xh\n", Inputs->Debug.Stream);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Debug.Level : %Xh\n", Inputs->Debug.Level);
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "FreqMax : %u\n", Inputs->FreqMax);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Ratio : %u\n", Inputs->Ratio);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "RefClk : %uMHz\n", (Inputs->RefClk == MRC_REF_CLOCK_100) ? 100 : 133);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "BClk : %uHz\n", Inputs->BClkFrequency);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "BoardType : %Xh\n", Inputs->BoardType);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "CpuStepping : %Xh\n", Inputs->CpuStepping);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "CpuModel : %Xh\n", Inputs->CpuModel);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "GraphicsStolenSize : %Xh\n", Inputs->GraphicsStolenSize);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "GraphicsGttSize : %Xh\n", Inputs->GraphicsGttSize);
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.Seconds : %u\n", BaseTimeString, Inputs->BaseTime.Seconds);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.Minutes : %u\n", BaseTimeString, Inputs->BaseTime.Minutes);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.Hours : %u\n", BaseTimeString, Inputs->BaseTime.Hours);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.DayOfMonth : %u\n", BaseTimeString, Inputs->BaseTime.DayOfMonth);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.Month : %u\n", BaseTimeString, Inputs->BaseTime.Month);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.Year : %u\n", BaseTimeString, Inputs->BaseTime.Year);
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Iteration : %Xh\n", Inputs->Iteration);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "MrcMode : %Xh\n", Inputs->MrcMode);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "VddVoltage : %u mV\n", Inputs->VddVoltage);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "MemoryProfile : %Xh\n", Inputs->MemoryProfile);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "BootMode : %Xh\n", Inputs->BootMode);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "TxtFlag : %Xh\n", Inputs->TxtFlag);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "MobilePlatform : %Xh\n", Inputs->MobilePlatform);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "EccSupport : %Xh\n", Inputs->EccSupport);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "SetRxDqs32 : %Xh\n", Inputs->SetRxDqs32);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "GfxIsVersatileAcceleration : %Xh\n", Inputs->GfxIsVersatileAcceleration);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "ScramblerEnable : %Xh\n", Inputs->ScramblerEnable);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "McLock : %Xh\n", Inputs->McLock);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "RemapEnable : %Xh\n", Inputs->RemapEnable);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "PowerDownMode : %Xh\n", Inputs->PowerDownMode);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "PwdwnIdleCounter : %Xh\n", Inputs->PwdwnIdleCounter);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "RankInterleave : %Xh\n", Inputs->RankInterleave);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "EnhancedInterleave : %Xh\n", Inputs->EnhancedInterleave);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "WeaklockEn : %Xh\n", Inputs->WeaklockEn);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "EnCmdRate : %Xh\n", Inputs->EnCmdRate);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "CmdTriStateDis : %Xh\n", Inputs->CmdTriStateDis);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "RefreshRate2x : %Xh\n", Inputs->RefreshRate2x);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "BaseAddresses\n");
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " PciE : %Xh\n", Inputs->PciEBaseAddress);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " MchBar : %Xh\n", Inputs->MchBarBaseAddress);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " Smbus : %Xh\n", Inputs->SmbusBaseAddress);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " Gdxc : %Xh\n", Inputs->GdxcBaseAddress);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " Hpet : %Xh\n\n", Inputs->HpetBaseAddress);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "MeStolenSize : %Xh\n", Inputs->MeStolenSize);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "MmioSize : %Xh\n", Inputs->MmioSize);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "TsegSize : %Xh\n", Inputs->TsegSize);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "IedSize : %Xh\n", Inputs->IedSize);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "DprSize : %Xh\n", Inputs->DprSize);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "VddSettleWaitTime : %Xh\n", Inputs->VddSettleWaitTime);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "VccIomV : %Xh\n", Inputs->VccIomV);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "AutoSelfRefreshSupport : %u\n", Inputs->AutoSelfRefreshSupport);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "ExtTemperatureSupport : %u\n", Inputs->ExtTemperatureSupport);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "ChHashEnable : %Xh\n", Inputs->ChHashEnable);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "ChHashMask : %Xh\n", Inputs->ChHashMask);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "ChHashInterleaveBit : %Xh\n", Inputs->ChHashInterleaveBit);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%sEnable : %Xh\n", GdxcString, Inputs->Gdxc.GdxcEnable);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%sIotSize : %Xh\n", GdxcString, Inputs->Gdxc.GdxcIotSize);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%sMotSize : %Xh\n", GdxcString, Inputs->Gdxc.GdxcMotSize);
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "MemoryTrace: %u\n", Inputs->MemoryTrace);
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "*************************************\n");
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "***** MRC TRAINING STEPS *****\n");
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "*************************************\n");
+ TrainingSteps = &Inputs->TrainingEnables;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s : %Xh\n", TrainEnString, Inputs->TrainingEnables);
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.ECT : %u\n", TrainEnString, TrainingSteps->ECT);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.SOT : %u\n", TrainEnString, TrainingSteps->SOT);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.RDMPRT : %u\n", TrainEnString, TrainingSteps->RDMPRT);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.RCVET : %u\n", TrainEnString, TrainingSteps->RCVET);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.JWRL : %u\n", TrainEnString, TrainingSteps->JWRL);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.FWRL : %u\n", TrainEnString, TrainingSteps->FWRL);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.WRTC1D : %u\n", TrainEnString, TrainingSteps->WRTC1D);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.RDTC1D : %u\n", TrainEnString, TrainingSteps->RDTC1D);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.DIMMODTT : %u\n", TrainEnString, TrainingSteps->DIMMODTT);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.WRDST : %u\n", TrainEnString, TrainingSteps->WRDST);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.WREQT : %u\n", TrainEnString, TrainingSteps->WREQT);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.RDODTT : %u\n", TrainEnString, TrainingSteps->RDODTT);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.RDEQT : %u\n", TrainEnString, TrainingSteps->RDEQT);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.RDAPT : %u\n", TrainEnString, TrainingSteps->RDAPT);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.WRTC2D : %u\n", TrainEnString, TrainingSteps->WRTC2D);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.RDTC2D : %u\n", TrainEnString, TrainingSteps->RDTC2D);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.WRVC2D : %u\n", TrainEnString, TrainingSteps->WRVC2D);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.RDVC2D : %u\n", TrainEnString, TrainingSteps->RDVC2D);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.LCT : %u\n", TrainEnString, TrainingSteps->LCT);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.RTL : %u\n", TrainEnString, TrainingSteps->RTL);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.TAT : %u\n", TrainEnString, TrainingSteps->TAT);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.RMT : %u\n", TrainEnString, TrainingSteps->RMT);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.MEMTST : %u\n", TrainEnString, TrainingSteps->MEMTST);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.DIMMODTT1D : %u\n", TrainEnString, TrainingSteps->DIMMODTT1D);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.WRSRT : %u\n", TrainEnString, TrainingSteps->WRSRT);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.DIMMRONT : %u\n", TrainEnString, TrainingSteps->DIMMRONT);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.ALIASCHK : %u\n", TrainEnString, TrainingSteps->ALIASCHK);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.RCVENC1D : %u\n", TrainEnString, TrainingSteps->RCVENC1D);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.RMC : %u\n", TrainEnString, TrainingSteps->RMC);
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "*************************************\n");
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "***** MRC TIMING DATA *****\n");
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "*************************************\n");
+
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerIn = &Inputs->Controller[Controller];
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Controller[%u] ChannelCount : %Xh\n", Controller, ControllerIn->ChannelCount);
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelIn = &ControllerIn->Channel[Channel];
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel[%u].Status : %Xh\n", Channel, ChannelIn->Status);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel[%u].DimmCount : %Xh\n", Channel, ChannelIn->DimmCount);
+
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmIn = &ChannelIn->Dimm[Dimm];
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s %u/%u/%u Status : %Xh\n", CcdString, Controller, Channel, Dimm, DimmIn->Status);
+ if (Inputs->MemoryProfile == USER_PROFILE) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s %u/%u/%u tCK : %u\n", CcdString, Controller, Channel, Dimm, DimmIn->Timing.tCK);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s %u/%u/%u NMode : %u\n", CcdString, Controller, Channel, Dimm, DimmIn->Timing.NMode);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s %u/%u/%u tCL : %u\n", CcdString, Controller, Channel, Dimm, DimmIn->Timing.tCL);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s %u/%u/%u tCWL : %u\n", CcdString, Controller, Channel, Dimm, DimmIn->Timing.tCWL);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s %u/%u/%u tFAW : %u\n", CcdString, Controller, Channel, Dimm, DimmIn->Timing.tFAW);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s %u/%u/%u tRAS : %u\n", CcdString, Controller, Channel, Dimm, DimmIn->Timing.tRAS);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s %u/%u/%u tRC : %u\n", CcdString, Controller, Channel, Dimm, DimmIn->Timing.tRC);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s %u/%u/%u tRCD : %u\n", CcdString, Controller, Channel, Dimm, DimmIn->Timing.tRCD);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s %u/%u/%u tREFI : %u\n", CcdString, Controller, Channel, Dimm, DimmIn->Timing.tREFI);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s %u/%u/%u tRFC : %u\n", CcdString, Controller, Channel, Dimm, DimmIn->Timing.tRFC);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s %u/%u/%u tRP : %u\n", CcdString, Controller, Channel, Dimm, DimmIn->Timing.tRP);
+#ifdef ULT_FLAG
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s %u/%u/%u tRPab : %u\n", CcdString, Controller, Channel, Dimm, DimmIn->Timing.tRPab);
+#endif // ULT_FLAG
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s %u/%u/%u tRRD : %u\n", CcdString, Controller, Channel, Dimm, DimmIn->Timing.tRRD);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s %u/%u/%u tRTP : %u\n", CcdString, Controller, Channel, Dimm, DimmIn->Timing.tRTP);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s %u/%u/%u tWR : %u\n", CcdString, Controller, Channel, Dimm, DimmIn->Timing.tWR);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s %u/%u/%u tWTR : %u\n", CcdString, Controller, Channel, Dimm, DimmIn->Timing.tWTR);
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s %u/%u/%u SpdAddress : %Xh\n", CcdString, Controller, Channel, Dimm, DimmIn->SpdAddress);
+ }
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "*************************************\n");
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "***** THERMAL OVERWRITE *******\n");
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "*************************************\n");
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.EnableExtts : %Xh\n", ThermEnString, Inputs->ThermalEnables.EnableExtts);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.EnableCltm : %Xh\n", ThermEnString, Inputs->ThermalEnables.EnableCltm);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.EnableOltm : %Xh\n", ThermEnString, Inputs->ThermalEnables.EnableOltm);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.EnablePwrDn : %Xh\n", ThermEnString, Inputs->ThermalEnables.EnablePwrDn);
+#ifdef ULT_FLAG
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.EnablePwrDnLpddr: %Xh\n", ThermEnString, Inputs->ThermalEnables.EnablePwrDnLpddr);
+#endif // ULT_FLAG
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.Refresh2X : %Xh\n", ThermEnString, Inputs->ThermalEnables.Refresh2X);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.LpddrThermalSensor: %Xh\n", ThermEnString, Inputs->ThermalEnables.LpddrThermalSensor);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.LockPTMregs : %Xh\n", ThermEnString, Inputs->ThermalEnables.LockPTMregs);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.UserPowerWeightsEn: %Xh\n", ThermEnString, Inputs->ThermalEnables.UserPowerWeightsEn);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.EnergyScaleFact : %Xh\n", ThermEnString, Inputs->ThermalEnables.EnergyScaleFact);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.RaplLim2Lock : %Xh\n", ThermEnString, Inputs->ThermalEnables.RaplLim2Lock);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.RaplLim2WindX : %Xh\n", ThermEnString, Inputs->ThermalEnables.RaplLim2WindX);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.RaplLim2WindY : %Xh\n", ThermEnString, Inputs->ThermalEnables.RaplLim2WindY);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.RaplLim2Ena : %Xh\n", ThermEnString, Inputs->ThermalEnables.RaplLim2Ena);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.RaplLim2Pwr : %Xh\n", ThermEnString, Inputs->ThermalEnables.RaplLim2Pwr);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.RaplLim1WindX : %Xh\n", ThermEnString, Inputs->ThermalEnables.RaplLim1WindX);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.RaplLim1WindY : %Xh\n", ThermEnString, Inputs->ThermalEnables.RaplLim1WindY);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.RaplLim1Ena : %Xh\n", ThermEnString, Inputs->ThermalEnables.RaplLim1Ena);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.RaplLim1Pwr : %Xh\n", ThermEnString, Inputs->ThermalEnables.RaplLim1Pwr);
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.RaplPwrFlCh[%u] : %Xh\n", ThermEnString, Channel, Inputs->ThermalEnables.RaplPwrFl[Channel]);
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.WarmThresholdCh[%u]Dimm[%u] : %Xh\n", ThermEnString, Channel, Dimm, Inputs->ThermalEnables.WarmThreshold[Channel][Dimm]);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.HotThresholdCh[%u]Dimm[%u] : %Xh\n", ThermEnString, Channel, Dimm, Inputs->ThermalEnables.HotThreshold[Channel][Dimm]);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.WarmBudgetCh[%u]Dimm[%u] : %Xh\n", ThermEnString, Channel, Dimm, Inputs->ThermalEnables.WarmBudget[Channel][Dimm]);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.HotBudgetCh[%u]Dimm[%u] : %Xh\n", ThermEnString, Channel, Dimm, Inputs->ThermalEnables.HotBudget[Channel][Dimm]);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.IdleEnergyCh[%u]Dimm[%u] : %Xh\n", ThermEnString, Channel, Dimm, Inputs->ThermalEnables.IdleEnergy[Channel][Dimm]);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.PdEnergyCh[%u]Dimm[%u] : %Xh\n", ThermEnString, Channel, Dimm, Inputs->ThermalEnables.PdEnergy[Channel][Dimm]);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.ActEnergyCh[%u]Dimm[%u] : %Xh\n", ThermEnString, Channel, Dimm, Inputs->ThermalEnables.ActEnergy[Channel][Dimm]);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.RdEnergyCh[%u]Dimm[%u] : %Xh\n", ThermEnString, Channel, Dimm, Inputs->ThermalEnables.RdEnergy[Channel][Dimm]);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.WrEnergyCh[%u]Dimm[%u] : %Xh\n", ThermEnString, Channel, Dimm, Inputs->ThermalEnables.WrEnergy[Channel][Dimm]);
+ }
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.SrefCfgEna : %Xh\n", ThermEnString, Inputs->ThermalEnables.SrefCfgEna);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.SrefCfgIdleTmr : %Xh\n", ThermEnString, Inputs->ThermalEnables.SrefCfgIdleTmr);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.ThrtCkeMinDefeat: %Xh\n", ThermEnString, Inputs->ThermalEnables.ThrtCkeMinDefeat);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.ThrtCkeMinTmr : %Xh\n", ThermEnString, Inputs->ThermalEnables.ThrtCkeMinTmr);
+#ifdef ULT_FLAG
+ if (Inputs->CpuModel == cmHSW_ULT) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.ThrtCkeMinDefeatLpddr: %Xh\n", ThermEnString, Inputs->ThermalEnables.ThrtCkeMinDefeatLpddr);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s.ThrtCkeMinTmrLpddr : %Xh\n", ThermEnString, Inputs->ThermalEnables.ThrtCkeMinTmrLpddr);
+ }
+#endif // ULT_FLAG
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "*************************************\n");
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "*****MRC INPUT PARAMS DUMP END*******\n");
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "*************************************\n\n");
+
+ return mrcSuccess;
+}
+
+/**
+ Print the specified memory to the serial message debug port.
+
+ @param[in] Debug - Serial message debug structure.
+ @param[in] Start - The starting address to dump.
+ @param[in] Size - The amount of data in bytes to dump.
+
+ @retval Nothing.
+**/
+void
+MrcPrintMemory (
+ IN const MrcDebug *const Debug,
+ IN const U8 *const Start,
+ IN const U32 Size
+ )
+{
+ const U8 *Address;
+ const U8 *End;
+ U32 Line;
+ U32 Offset;
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " ");
+ for (Offset = 0; Offset < 16; Offset++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%02X ", ((U32) Start + Offset) % 16);
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+ End = Start + Size;
+ for (Line = 0; Line < ((Size / 16) + 1); Line++) {
+ Address = Start + (Line * 16);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "% 8X: ", Address);
+ for (Offset = 0; Offset < 16; Offset++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, ((Address + Offset) < End) ? "%02X " : " ", Address[Offset]);
+ }
+ for (Offset = 0; (Offset < 16) && ((Address + Offset) < End); Offset++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%c", isprint (Address[Offset]) ? Address[Offset] : '.');
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+ }
+ return;
+}
+#endif
+
+#if (defined MEMORY_DOWN_SUPPORT && (MEMORY_DOWN_SUPPORT > 0))
+
+/******************************************************************************
+ Memory down configuration code starts here.
+ Add SPD, and channel/slot population settings here.
+
+ Even though this is a memory down configuration, the MRC needs to know how
+ the memory appears to the controller, so indicate here which channels are
+ populated. Also, the MRC needs to know which slots are valid, even though
+ there are technically no physical slots in a memory down configuration.
+ The MRC also needs a valid SPD data for the configuration.
+******************************************************************************/
+typedef enum {
+ MEMORY_ABSENT, ///< No memory down and no physical memory slot.
+ MEMORY_SLOT_ONLY, ///< No memory down and a physical memory slot.
+ MEMORY_DOWN_ONLY, ///< Memory down and not a physical memory slot.
+} MemorySlotStatus;
+
+#ifndef AMI_OVERRIDE_FOR_MEMORY_DOWN
+#if defined(NB_OEM_DIMM1_STATUS) && (NB_OEM_DIMM1_STATUS == 0x02)
+static const UINT8 Dimm1SpdTbl[] = NB_OEM_DIMM1_SPD_DATA;
+#endif
+#if defined(NB_OEM_DIMM2_STATUS) && (NB_OEM_DIMM2_STATUS == 0x02)
+static const UINT8 Dimm2SpdTbl[] = NB_OEM_DIMM2_SPD_DATA;
+#endif
+#if defined(NB_OEM_DIMM3_STATUS) && (NB_OEM_DIMM3_STATUS == 0x02)
+static const UINT8 Dimm3SpdTbl[] = NB_OEM_DIMM3_SPD_DATA;
+#endif
+#if defined(NB_OEM_DIMM4_STATUS) && (NB_OEM_DIMM4_STATUS == 0x02)
+static const UINT8 Dimm4SpdTbl[] = NB_OEM_DIMM4_SPD_DATA;
+#endif
+#endif // AMI_OVERRIDE_FOR_MEMORY_DOWN
+///
+/// Example board support
+///
+#ifdef AMI_OVERRIDE_FOR_MEMORY_DOWN
+#define EXAMPLE_BOARD_SUPPORT 0
+#else
+#if (defined MEMORY_DOWN_SUPPORT && (MEMORY_DOWN_SUPPORT == 1))
+#define EXAMPLE_BOARD_SUPPORT 1
+#else
+#define EXAMPLE_BOARD_SUPPORT 0
+#endif // MEMORY_DOWN_SUPPORT
+#endif // AMI_OVERRIDE_FOR_MEMORY_DOWN
+#if (defined EXAMPLE_BOARD_SUPPORT && (EXAMPLE_BOARD_SUPPORT > 0))
+///
+/// For this example board, we have a dual channel, single slot configuration
+/// with the same memory configuration in each channel (DDR3).
+///
+const MemorySlotStatus ExampleSlotStatus[MAX_CHANNEL][MAX_DIMMS_IN_CHANNEL] = {
+#ifndef AMI_OVERRIDE_FOR_MEMORY_DOWN
+ NB_OEM_DIMM1_STATUS, // Channel 0, Slot 0
+ NB_OEM_DIMM2_STATUS, // Channel 0, Slot 1
+ NB_OEM_DIMM3_STATUS, // Channel 1, Slot 0
+ NB_OEM_DIMM4_STATUS, // Channel 1, Slot 1
+#else
+ MEMORY_DOWN_ONLY, ///< Channel 0, Slot 0
+ MEMORY_ABSENT, ///< Channel 0, Slot 1
+ MEMORY_DOWN_ONLY, ///< Channel 1, Slot 0
+ MEMORY_ABSENT, ///< Channel 1, Slot 1
+#endif // AMI_OVERRIDE_FOR_MEMORY_DOWN
+};
+
+const U8 ExampleSpd[] = {
+ 0x92, ///< 0 Number of Serial PD Bytes Written / SPD Device Size / CRC Coverage 1, 2
+ 0x10, ///< 1 SPD Revision
+ 0x0B, ///< 2 DRAM Device Type
+ 0x03, ///< 3 Module Type
+ 0x02, ///< 4 SDRAM Density and Banks
+ 0x11, ///< 5 SDRAM Addressing
+ 0x00, ///< 6 Module Nominal Voltage
+ 0x09, ///< 7 Module Organization
+ 0x03, ///< 8 Module Memory Bus Width
+ 0x52, ///< 9 Fine Timebase (FTB) Dividend / Divisor
+ 0x01, ///< 10 Medium Timebase (MTB) Dividend
+ 0x08, ///< 11 Medium Timebase (MTB) Divisor
+ 0x0A, ///< 12 SDRAM Minimum Cycle Time (tCKmin)
+ 0x00, ///< 13 Reserved0
+ 0xFE, ///< 14 CAS Latencies Supported, Least Significant Byte
+ 0x00, ///< 15 CAS Latencies Supported, Most Significant Byte
+ 0x69, ///< 16 Minimum CAS Latency Time (tAAmin)
+ 0x78, ///< 17 Minimum Write Recovery Time (tWRmin)
+ 0x69, ///< 18 Minimum RAS# to CAS# Delay Time (tRCDmin)
+ 0x30, ///< 19 Minimum Row Active to Row Active Delay Time (tRRDmin)
+ 0x69, ///< 20 Minimum Row Precharge Delay Time (tRPmin)
+ 0x11, ///< 21 Upper Nibbles for tRAS and tRC
+ 0x18, ///< 22 Minimum Active to Precharge Delay Time (tRASmin), Least Significant Byte
+ 0x81, ///< 23 Minimum Active to Active/Refresh Delay Time (tRCmin), Least Significant Byte
+ 0x70, ///< 24 Minimum Refresh Recovery Delay Time (tRFCmin), Least Significant Byte
+ 0x03, ///< 25 Minimum Refresh Recovery Delay Time (tRFCmin), Most Significant Byte
+ 0x3C, ///< 26 Minimum Internal Write to Read Command Delay Time (tWTRmin)
+ 0x3C, ///< 27 Minimum Internal Read to Precharge Command Delay Time (tRTPmin)
+ 0x00, ///< 28 Upper Nibble for tFAW
+ 0xF0, ///< 29 Minimum Four Activate Window Delay Time (tFAWmin)
+ 0x83, ///< 30 SDRAM Optional Features
+ 0x01, ///< 31 SDRAMThermalAndRefreshOptions
+ 0x00, ///< 32 ModuleThermalSensor
+ 0x00, ///< 33 SDRAM Device Type
+ 0x00, ///< 34 Fine Offset for SDRAM Minimum Cycle Time (tCKmin)
+ 0x00, ///< 35 Fine Offset for Minimum CAS Latency Time (tAAmin)
+ 0x00, ///< 36 Fine Offset for Minimum RAS# to CAS# Delay Time (tRCDmin)
+ 0x00, ///< 37 Fine Offset for Minimum Row Precharge Delay Time (tRPmin)
+ 0x00, ///< 38 Fine Offset for Minimum Active to Active/Refresh Delay Time (tRCmin)
+ 0x00, ///< 39
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ///< 40 - 49
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ///< 50 - 59
+ 0, 0, ///< 60 - 61
+ 0x45, ///< 62 Reference Raw Card Used
+ 0x00, ///< 63 Address Mapping from Edge Connector to DRAM
+ 0x00, ///< 64 ThermalHeatSpreaderSolution
+ 0, 0, 0, 0, 0, ///< 65 - 69
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ///< 70 - 79
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ///< 80 - 89
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ///< 90 - 99
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ///< 100 - 109
+ 0, 0, 0, 0, 0, 0, 0, ///< 110 - 116
+ 0x80, ///< 117 Module Manufacturer ID Code, Least Significant Byte
+ 0xCE, ///< 118 Module Manufacturer ID Code, Most Significant Byte
+ 0x01, ///< 119 Module Manufacturing Location
+ 0x11, ///< 120 Module Manufacturing Date Year
+ 0x02, ///< 121 Module Manufacturing Date creation work week
+ 0x44, ///< 122 Module Serial Number A
+ 0x0A, ///< 123 Module Serial Number B
+ 0x83, ///< 124 Module Serial Number C
+ 0x0C, ///< 125 Module Serial Number D
+ 0xA5, ///< 126 CRC A
+ 0x50 ///< 127 CRC B
+};
+#endif // EXAMPLE_BOARD_SUPPORT
+
+
+/**
+ Copies information from the Memory Down SPD structure to the SPD Input structure
+ in the Host structure.
+
+ Setting the SpdBaseAddress to zero means this slot has a memory down configuration.
+ For systems that have both memory down and slots, it is recommended to have the
+ memory down in the slot position farthest from the controller.
+
+ @param[in, out] Inputs - MRC Host Input structure.
+ @param[in] SpdIn - Pointer to the Memory Down SPD structure to copy.
+ @param[in] Slot - Pointer to the Memory Down MemorySlotStatus structure.
+ @param[in] SpdSize - Size of the SPD structure to limit MemoryCpy.
+
+ @retval - Nothing.
+**/
+void
+CopyMemoryDownSpd (
+ IN OUT MrcInput *const Inputs,
+ IN const U8 *SpdIn[MAX_CHANNEL][MAX_DIMMS_IN_CHANNEL],
+ IN const MemorySlotStatus *Slot,
+ IN U16 SpdSize
+ )
+{
+ MrcDimmIn *DimmIn;
+ U8 Channel;
+ U8 Dimm;
+
+ if (SpdIn == NULL || Slot == NULL || SpdSize == 0) {
+ return;
+ }
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++, Slot++) {
+ DimmIn = &Inputs->Controller[0].Channel[Channel].Dimm[Dimm];
+ switch (*Slot) {
+ case MEMORY_DOWN_ONLY:
+ DimmIn->SpdAddress = 0;
+ // Check user request to disable DIMM/rank pair.
+ if (DimmIn->Status != DIMM_DISABLED) {
+ DimmIn->Status = DIMM_ENABLED;
+ MrcOemMemoryCpy ((U8 *) &DimmIn->Spd, (U8 *) SpdIn[Channel][Dimm], SpdSize);
+ MRC_DEBUG_MSG (&Inputs->Debug, MSG_LEVEL_NOTE, "Memory down present on channel %u, dimm %u\n", Channel, Dimm);
+ } else {
+ MRC_DEBUG_MSG (&Inputs->Debug, MSG_LEVEL_NOTE, "Memory down absent on channel %u, dimm %u\n", Channel, Dimm);
+ }
+ break;
+
+ case MEMORY_ABSENT:
+ DimmIn->Status = DIMM_DISABLED;
+ DimmIn->SpdAddress = 0;
+ MRC_DEBUG_MSG (&Inputs->Debug, MSG_LEVEL_NOTE, "Memory down absent on channel %u, dimm %u\n", Channel, Dimm);
+ break;
+
+ case MEMORY_SLOT_ONLY:
+ default:
+ break;
+ }
+ }
+ }
+
+ return;
+}
+
+/**
+ Enables Memory Down support and sets SPD data for all DIMMs needing support.
+
+ @param[in] Inputs - MRC Input data structure.
+ @param[in] BoardId - The ID of the board.
+
+ @retval Nothing
+**/
+void
+EnableMemoryDown (
+ IN MrcInput *const Inputs,
+ IN U16 BoardId
+ )
+{
+ const U8 *SpdIn[MAX_CHANNEL][MAX_DIMMS_IN_CHANNEL];
+ const MemorySlotStatus *Slot;
+ U16 SpdSize;
+ U8 Channel;
+ U8 Dimm;
+#ifndef AMI_OVERRIDE_FOR_MEMORY_DOWN
+ const U8 *DimmSpdTbl = NULL;
+#endif // AMI_OVERRIDE_FOR_MEMORY_DOWN
+
+ Channel = 0;
+ Dimm = 0;
+ SpdSize = 0;
+
+ switch (BoardId) {
+#if (defined EXAMPLE_BOARD_SUPPORT && (EXAMPLE_BOARD_SUPPORT > 0))
+
+ case 0:
+ //
+ // BoardIdExample:
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+#ifndef AMI_OVERRIDE_FOR_MEMORY_DOWN
+#if defined(NB_OEM_DIMM1_STATUS) && (NB_OEM_DIMM1_STATUS == 0x02)
+ if (Channel == 0 && Dimm == 0) {
+ DimmSpdTbl = Dimm1SpdTbl;
+ }
+#endif
+#if defined(NB_OEM_DIMM2_STATUS) && (NB_OEM_DIMM2_STATUS == 0x02)
+ if (Channel == 0 && Dimm == 1) {
+ DimmSpdTbl = Dimm2SpdTbl;
+ }
+#endif
+#if defined(NB_OEM_DIMM3_STATUS) && (NB_OEM_DIMM3_STATUS == 0x02)
+ if (Channel == 1 && Dimm == 0) {
+ DimmSpdTbl = Dimm3SpdTbl;
+ }
+#endif
+#if defined(NB_OEM_DIMM4_STATUS) && (NB_OEM_DIMM4_STATUS == 0x02)
+ if (Channel == 1 && Dimm == 1) {
+ DimmSpdTbl = Dimm4SpdTbl;
+ }
+#endif
+ SpdIn[Channel][Dimm] = DimmSpdTbl;
+ if (DimmSpdTbl != NULL) {
+ DimmSpdTbl = NULL;
+ }
+#else
+ SpdIn[Channel][Dimm] = ExampleSpd;
+#endif // AMI_OVERRIDE_FOR_MEMORY_DOWN
+ }
+ }
+
+ Slot = (const MemorySlotStatus *) &ExampleSlotStatus[0][0];
+ SpdSize = sizeof(ExampleSpd);
+ break;
+#endif // EXAMPLE_BOARD_SUPPORT
+
+
+ //
+ // Add additional boards that support memory down here.
+ //
+
+ //
+ // The default case means the board ID was not recognized. Instead
+ // we set Slot = NULL thus forcing us to read from the SPD.
+ //
+ default:
+ Slot = NULL;
+ }
+
+ CopyMemoryDownSpd (Inputs, SpdIn, Slot, SpdSize);
+
+ return;
+}
+#endif // MEMORY_DOWN_SUPPORT
+
+#ifdef ULT_FLAG
+/**
+ Initialize the board-specific CMD/CTL/CLK and DQ/DQS mapping for LPDDR3.
+
+ @param[in, out] Inputs - MRC Input data structure.
+ @param[in] BoardId - The ID of the board.
+
+ @retval none
+**/
+void
+MrcOemLpddrBoardMapping (
+ IN OUT MrcInput *Inputs,
+ IN U16 BoardId
+ )
+{
+ MrcControllerIn *ControllerIn;
+ U8 *DqByteMapCh0;
+ U8 *DqByteMapCh1;
+ U8 *DqsMapCpu2DramCh0;
+ U8 *DqsMapCpu2DramCh1;
+ U8 *DqMapCpu2DramCh0;
+ U8 *DqMapCpu2DramCh1;
+ U32 Channel;
+ U32 Byte;
+
+
+ ControllerIn = &Inputs->Controller[0];
+ DqByteMapCh0 = NULL;
+ DqByteMapCh1 = NULL;
+ DqsMapCpu2DramCh0 = NULL;
+ DqsMapCpu2DramCh1 = NULL;
+ DqMapCpu2DramCh0 = NULL;
+ DqMapCpu2DramCh1 = NULL;
+
+ //
+ // CKE to Rank mapping: CKE | 0 1 2 3
+ // (same on both channels) --------------
+ // Rank | 0 1 0 1
+ //
+ Inputs->CkeRankMapping = 0xAA;
+
+ //
+ // @todo: pass these via SaPlatformPolicy PPI
+ //
+ DqByteMapCh0 = (U8 *) DqByteMapRvpCh0;
+ DqByteMapCh1 = (U8 *) DqByteMapRvpCh1;
+ DqsMapCpu2DramCh0 = (U8 *) DqsMapCpu2DramRvpCh0;
+ DqsMapCpu2DramCh1 = (U8 *) DqsMapCpu2DramRvpCh1;
+ DqMapCpu2DramCh0 = (U8 *) DqMapCpu2DramRvpCh0;
+ DqMapCpu2DramCh1 = (U8 *) DqMapCpu2DramRvpCh1;
+
+
+ //
+ // DQ byte mapping to CMD/CTL/CLK
+ //
+ MrcOemMemoryCpy ((U8 *) ControllerIn->Channel[0].DQByteMap, DqByteMapCh0, sizeof (DqByteMapRvpCh0));
+ MrcOemMemoryCpy ((U8 *) ControllerIn->Channel[1].DQByteMap, DqByteMapCh1, sizeof (DqByteMapRvpCh1));
+
+ //
+ // DQS byte swizzling between CPU and DRAM
+ //
+ MrcOemMemoryCpy (ControllerIn->Channel[0].DqsMapCpu2Dram, DqsMapCpu2DramCh0, sizeof (DqsMapCpu2DramRvpCh0));
+ MrcOemMemoryCpy (ControllerIn->Channel[1].DqsMapCpu2Dram, DqsMapCpu2DramCh1, sizeof (DqsMapCpu2DramRvpCh1));
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ MRC_DEBUG_MSG (&Inputs->Debug, MSG_LEVEL_ERROR, "Ch %d DqsMapCpu2Dram: ", Channel);
+ for (Byte = 0; Byte < 8; Byte++) {
+ MRC_DEBUG_MSG (&Inputs->Debug, MSG_LEVEL_ERROR, "%d ", ControllerIn->Channel[Channel].DqsMapCpu2Dram[Byte]);
+ }
+ MRC_DEBUG_MSG (&Inputs->Debug, MSG_LEVEL_ERROR, "\n");
+ }
+
+ //
+ // DQ bit swizzling between CPU and DRAM
+ //
+ MrcOemMemoryCpy ((U8 *) ControllerIn->Channel[0].DqMapCpu2Dram, DqMapCpu2DramCh0, sizeof (DqMapCpu2DramRvpCh0));
+ MrcOemMemoryCpy ((U8 *) ControllerIn->Channel[1].DqMapCpu2Dram, DqMapCpu2DramCh1, sizeof (DqMapCpu2DramRvpCh0));
+}
+#endif // ULT_FLAG
+// AMI_OVERRIDE_FOR_UPSERVER_SUPPORT
+#ifdef UPSERVER_SUPPORT
+void
+MrcCltmDisable (
+ MrcParameters *MrcData
+ )
+/*++
+
+Routine Description:
+
+ Disable CLTM configuration register if Outputs->CLTM_SPD_Conf = PROCESS_FAILED
+
+Arguments:
+
+ MrcData - include all the MRC data.
+
+Returns:
+ None
+
+--*/
+{
+ MrcDebug *Debug;
+ PCU_CR_DDR_PTM_CTL_PCU_STRUCT DdrPtmCtl;
+ ThermalMngmtEn *ThermalEnables;
+ MrcInput *Inputs;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ ThermalEnables = &Inputs->ThermalEnables;
+
+ DdrPtmCtl.Data = MrcReadCR (MrcData, PCU_CR_DDR_PTM_CTL_PCU_REG);
+ DdrPtmCtl.Bits.OLTM_ENABLE = ThermalEnables->EnableOltm;//Disable , 0, Not available for UP Platforms
+ DdrPtmCtl.Bits.CLTM_ENABLE = CLTM_DISABLE;//0, Disable.
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "CLTM is Disabled - Exiting.\n");
+ MrcWriteCR (MrcData, PCU_CR_DDR_PTM_CTL_PCU_REG, DdrPtmCtl.Data);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "DDR_PTM_CTL %Xh: %Xh \n", PCU_CR_DDR_PTM_CTL_PCU_REG, MrcReadCR (MrcData, PCU_CR_DDR_PTM_CTL_PCU_REG));
+}
+
+void
+MrcCltmInit (
+ MrcParameters *MrcData
+ )
+/*++
+
+Routine Description:
+
+ CLTM Initialization
+
+Arguments:
+
+ MrcData - include all the MRC data.
+
+Returns:
+ None
+
+--*/
+{
+ MrcInput *Inputs;
+ MrcOutput *Outputs;
+ MrcDebug *Debug;
+ ThermalMngmtEn *ThermalEnables;
+ U8 Controller;
+ U8 Channel, Dimm;
+ U8 OffsetDimm[2];
+ BOOL FirstValue;
+ PCU_CR_DDR_PTM_CTL_PCU_STRUCT DdrPtmCtl;
+ PCU_CR_DDR_ENERGY_SCALEFACTOR_PCU_STRUCT DdrEnergyScaleFactor;
+ PCU_CR_DDR_WARM_THRESHOLD_CH0_PCU_STRUCT DdrWarmThresholdCh0;
+ PCU_CR_DDR_WARM_THRESHOLD_CH1_PCU_STRUCT DdrWarmThresholdCh1;
+ PCU_CR_DDR_HOT_THRESHOLD_CH0_PCU_STRUCT DdrHotThresholdCh0;
+ PCU_CR_DDR_HOT_THRESHOLD_CH1_PCU_STRUCT DdrHotThresholdCh1;
+ PCU_CR_DDR_WARM_BUDGET_CH0_PCU_STRUCT DdrWarmBudgetCh0;
+ PCU_CR_DDR_WARM_BUDGET_CH1_PCU_STRUCT DdrWarmBudgetCh1;
+ PCU_CR_DDR_HOT_BUDGET_CH0_PCU_STRUCT DdrHotBudgetCh0;
+ PCU_CR_DDR_HOT_BUDGET_CH1_PCU_STRUCT DdrHotBudgetCh1;
+ MCHBAR_CH0_CR_PM_DIMM_IDLE_ENERGY_STRUCT PmDimmIdleEnergy;
+ MCHBAR_CH0_CR_PM_DIMM_PD_ENERGY_STRUCT PmDimmPdEnergy;
+ MCHBAR_CH0_CR_PM_DIMM_ACT_ENERGY_STRUCT PmDimmActEnergy;
+ MCHBAR_CH0_CR_PM_DIMM_RD_ENERGY_STRUCT PmDimmRdEnergy;
+ MCHBAR_CH0_CR_PM_DIMM_WR_ENERGY_STRUCT PmDimmWrEnergy;
+ TSOD_CONF_REGISTER_STRUCT TsodConfReg;
+
+ U8 h=0,i = 0, j = 0, k1 =2, k0=2 ; //h=2xRefreshMode i = Density , j = Frequency , k1 = Adjacent DIMM prescence in Channel 1, k0 = Adjacent DIMM prescence in Channel 0
+ U8 iprev = 2, hotThreshold = 0, warmThreshold=0;
+ U8 ControllerSave = CONTROLLER_NOT_LOADED;
+ const U16 *PwrWeight0 = NULL, *PwrWeight1 = NULL ;
+ U16 MtsData = 0, Thigh = 0, Tcrit = 0, Temp = 0;
+ U16 freq=0, density= 0;
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ ThermalEnables = &Inputs->ThermalEnables;
+ Outputs = &MrcData->SysOut.Outputs;
+ TsodConfReg.Data =0;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "MrcCltmInit - Start.\n");
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "EnableCltm %d EccSupport %d - \n", ThermalEnables->EnableCltm, Outputs->EccSupport);
+ if (ThermalEnables->EnableCltm && (Outputs->EccSupport == TRUE)) {
+ FirstValue = FALSE;
+ if(Outputs->CLTM_SPD_Conf == PROCESS_NOT_INITIALIZED) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE,"CLTM_SPD_Config = %u\n",Outputs->CLTM_SPD_Conf);
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ // Check in every DIMM for CLTM capabilities
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+
+ if (Outputs->Controller[Controller].Channel[Channel].Status != CHANNEL_PRESENT) continue;
+
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+
+ if (Outputs->Controller[Controller].Channel[Channel].Dimm[Dimm].Status != DIMM_PRESENT) continue;
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel %d Dimm %d - Check for CLTM Capabilities\n", Channel, Dimm);
+
+ // CHECK CLTM RESTRICTIONS
+
+ // Check ECC support. Do not enable CLTM if not supported.
+ if (Outputs->Controller[Controller].Channel[Channel].Dimm[Dimm].EccSupport == FALSE) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "CLTM is Disable - Channel %d Dimm %d is non ECC - Exiting.\n", Channel, Dimm);
+ Outputs->CLTM_SPD_Conf = PROCESS_FAILED;
+ MrcCltmDisable(MrcData);
+ return;
+ }
+
+ // Check thermal sensor presence. Do not enable CLTM if no sensor.
+ if (Inputs->Controller[Controller].Channel[Channel].Dimm[Dimm].Spd.Ddr3.General.ModuleThermalSensor.Bits.ThermalSensorPresence == 0) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "CLTM is Disable - Channel %d Dimm %d do not have Thermal Sensor Incorporated - Exiting.\n", Channel, Dimm);
+ Outputs->CLTM_SPD_Conf = PROCESS_FAILED;
+ MrcCltmDisable(MrcData);
+ return;
+ }
+/*All dimms will be taken as Raw Card E
+ // Check Refernce Raw Card = E . Do not enable CLTM if no Raw Card.
+ if (Inputs->Controller[Controller].Channel[Channel].Dimm[Dimm].Spd.Ddr3.Module.Unbuffered.ReferenceRawCardUsed.Bits.Card != rcE) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel %d Dimm %d RAW Card is not E - CLTM disable.\n", Channel, Dimm);
+ Outputs->CLTM_SPD_Conf = PROCESS_FAILED;
+ MrcCltmDisable(MrcData);
+ return;
+ }
+*/
+ // Check if UDIMM. Do not enable CLTM if not UDIM
+ if (Inputs->Controller[Controller].Channel[Channel].Dimm[Dimm].Spd.Ddr3.General.ModuleType.Bits.ModuleType != MRC_UDIMM_TYPE_NUMBER) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel %d Dimm %d Module Type is not UDIMM - CLTM disable.\n", Channel, Dimm);
+ Outputs->CLTM_SPD_Conf = PROCESS_FAILED;
+ MrcCltmDisable(MrcData);
+ return;
+ }
+ /* All dimms will be configure as Dual Rank and x8
+ // Check if Dual Rank. Do not enable CLTM if not Dual Rank
+ if (Outputs->Controller[Controller].Channel[Channel].Dimm[Dimm].RankInDIMM != 2) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel %d Dimm %d not Dual Rank - CLTM disable.\n", Channel, Dimm);
+ Outputs->CLTM_SPD_Conf = PROCESS_FAILED;
+ MrcCltmDisable(MrcData);
+ return;
+ }
+
+ // Check if x8. Do not enable CLTM if not x8
+ if (Outputs->Controller[Controller].Channel[Channel].Dimm[Dimm].SdramWidth != 8) {
+ Outputs->CLTM_SPD_Conf = PROCESS_FAILED;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel %d Dimm %d Width is not x8 - CLTM disable.\n", Channel, Dimm);
+ MrcCltmDisable(MrcData);
+ return;
+ }
+*/
+ //switch (Outputs->Controller[Controller].Channel[Channel].Dimm[Dimm].DimmCapacity) {
+ switch (Inputs->Controller[Controller].Channel[Channel].Dimm[Dimm].Spd.Ddr3.General.SdramDensityAndBanks.Bits.Density) {
+ //case 2048:
+ case 3:
+ i = 0;
+ if(FirstValue == FALSE) { iprev = i; }
+ if(iprev != i) {
+ //MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel %d Dimm %d Capacity is 2Gb and different from other previous DIMM - CLTM disable\n", Channel, Dimm);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel %d Dimm %d Density is 2Gb and different from other previous DIMM - configure as 4Gb\n", Channel, Dimm);
+ i = 1;
+ }
+ iprev =i;
+ //MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel %d Dimm %d Capacity is 2Gb\n", Channel, Dimm);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel %d Dimm %d Density is 2Gb\n", Channel, Dimm);
+ break;
+ //case 4096:
+ case 4:
+ i = 1;
+ if(FirstValue == FALSE) { iprev = i; }
+ if(iprev != i) {
+ //MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel %d Dimm %d Capacity is 4Gb and different from other previous DIMM\n", Channel, Dimm);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel %d Dimm %d Density is 4Gb and different from other previous DIMM\n", Channel, Dimm);
+ i = 1;
+ }
+ iprev =i;
+ //MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel %d Dimm %d Capacity is 4Gb\n", Channel, Dimm);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel %d Dimm %d Density is 4Gb\n", Channel, Dimm);
+ break;
+ default:
+ //MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel %d Dimm %d Capacity is different than 4Gb and 2GB - CLTM disable \n", Channel, Dimm);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel %d Dimm %d Density is different than 4Gb and 2GB \n", Channel, Dimm);
+ i = 1;
+ iprev =i;
+ break;
+ }
+
+ if (Outputs->Controller[Controller].Channel[Channel].DimmCount > 1) {
+ if(Channel == 0) {k0 = 1;}
+ else{k1=1;}
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Adjacent DIMM next to Dimm %d in Channel %d.\n", Dimm, Channel);
+ }
+ else {
+ if(Channel == 0) {k0 = 0;}
+ else{k1=0;}
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "No adjacent DIMM next to Dimm %d in Channel %d.\n", Dimm, Channel);
+ }
+
+ // Check if DIMM supports dual refresh
+ if (((Inputs->Controller[Controller].Channel[Channel].Dimm[Dimm].Spd.Ddr3.General.ThermalAndRefreshOptions.Data & (MRC_BIT1 | MRC_BIT0)) == MRC_BIT0)) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel %d Dimm %d Supports 2x Self Refresh\n", Channel, Dimm);
+ } else {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel %d Dimm %d DO NOT Support 2x Self Refresh\n", Channel, Dimm);
+ ThermalEnables->Refresh2X = DISABLE_REFRESH2X;
+
+ }
+ h = ThermalEnables->Refresh2X;
+ FirstValue = TRUE;
+ } //for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++)
+ } //for (Channel = 0; Channel < MAX_CHANNEL; Channel++)
+ }// for Controller
+
+ //Frequency calculated from Common Memory Controller Frequency
+ switch (Outputs->Frequency) {
+ case f1600:
+ j = 0;
+ break;
+ case f1333:
+ j = 1;
+ break;
+ default:
+ j=0;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "MC Frequency is other than 1600 and 1333 - CLTM configure as 1600 .\n");
+ break;
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE,"CLTM_SPD_Config check has finished for first time\n");
+ }
+
+ if((Outputs->CLTM_SPD_Conf != PROCESS_FAILED) && (Outputs->CLTM_SPD_Conf != PROCESS_NOT_INITIALIZED) )
+ {
+ h = (((Outputs->CLTM_SPD_Conf)& (0x0300))>> 8); // mask with 0000 0011 0000 0000 and shift right 8, 2xRefreshMode
+ i = (((Outputs->CLTM_SPD_Conf)& (0x00C0))>> 6); // mask with 0000 0000 1100 0000 and shift right 6, Density index
+ j = (((Outputs->CLTM_SPD_Conf)& (0x0030))>> 4); // mask with 0000 0000 0011 0000 and shift right 4, Frequency
+ k1 = (((Outputs->CLTM_SPD_Conf)& (0x000C))>> 2); //mask 0000 0000 0000 1100 and shift right 2, Adjacent DIMM prescence of channel 1
+ k0 = ((Outputs->CLTM_SPD_Conf)& 0x0003);//mask with 0000 0000 0000 0011, Adjacent DIMM prescence of channel 0
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE,"DIMM variables: 2xRefresh Support, frequency , adjacent, density has been initialized. \n ");
+ }
+ else if (Outputs->CLTM_SPD_Conf == PROCESS_FAILED)
+ {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "CLTM_SPD_Config already executed and Failed\n");
+ MrcCltmDisable(MrcData);
+ return;
+ }
+
+ Outputs->CLTM_SPD_Conf = (h << 8)+ (i << 6) + (j<<4) + (k1<<2) + k0;
+ (i == 0)? (density = 2) : (density = 4);
+ (j == 0)? (freq = 1600) : (freq = 1333);
+
+
+ if ( ((k0==0)||(k0==1)) && ((k1==0)||(k1==1)) ){
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE,"CLTM_SPD_Config interpret = \n 2xRefresh Support = %d , density = 2GB%d, frequency=%d, \n Channel 1 adjacent DIMM=%d, Channel 0 Adjacent DIMM =%d \n",h,density,freq,k1,k0);
+ }
+ else if (k1==2) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE,"CLTM_SPD_Config interpret = \n 2xRefresh Support = %d ,density index=%d, frequency=%d, \n Channel 0 Adjacent DIMM =%d \n",h,density,freq,k0);
+ }
+ else if (k0==2) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE,"CLTM_SPD_Config interpret = \n 2xRefresh Support = %d ,density index=%d, frequency =%d, \n Channel 1 Adjacent DIMM =%d \n",h,density,freq,k1);
+ }
+ else{
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE,"CLTM_SPD_Config interpret incorrectly k1=%d, or k0=%d are incorrect \n",k1,k0);
+ Outputs->CLTM_SPD_Conf = PROCESS_FAILED;
+ MrcCltmDisable(MrcData);
+ return;
+ }
+
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE,"CLTM_SPD_Config = %u\n",Outputs->CLTM_SPD_Conf);
+
+ //Configuration Register of TSOD
+ TsodConfReg.Bits.EVENT_MODE = ThermalEnables->TSOD_EventMode;//Default 1, Interrupt
+ TsodConfReg.Bits.EVENT_POLARITY = ThermalEnables->TSOD_EventPolarity;//Default 0, Low
+ TsodConfReg.Bits.CRICAL_EVENT_ONLY = ThermalEnables->TSOD_CriticalEventOnly;//Default 1, Enable
+ TsodConfReg.Bits.EVENT_OUTPUT_CONTROL = ThermalEnables->TSOD_EventOutputControl; //Default 1, Enable
+ TsodConfReg.Bits.ALARM_WINDOW_LOCK = ThermalEnables->TSOD_AlarmwindowLockBit; //Default 0, Unlock
+ TsodConfReg.Bits.CRITICAL_LOCK = ThermalEnables->TSOD_CriticaltripLockBit; //Default 0, Unlock
+ TsodConfReg.Bits.SHUTDOWNMODE = ThermalEnables->TSOD_ShutdownMode; // Default 0, TSOD Enable
+ TsodConfReg.Bits.HYST_ENABLE = HYST_DISABLE;
+
+
+ DdrWarmThresholdCh0.Data = 0;
+ DdrWarmThresholdCh1.Data = 0;
+ DdrHotThresholdCh0.Data = 0;
+ DdrHotThresholdCh1.Data = 0;
+
+ if (!ThermalEnables->UserThresholdEn) {//Configuration of warm and hot threshold depending of single or dual refresh
+ if(h != DISABLE_REFRESH2X ) {
+ warmThreshold = ( WarmThreshold_2X_MAX_TEMP );
+ hotThreshold = ( HotThreshold_2X_MAX_TEMP );
+
+ }
+ else{
+ warmThreshold = ( WarmThreshold_1X_MAX_TEMP );
+ hotThreshold = ( HotThreshold_1X_MAX_TEMP );
+
+ }
+ }
+
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+
+ //OffsetChannel[Channel] = 0;
+
+ if (Outputs->Controller[Controller].Channel[Channel].Status != CHANNEL_PRESENT) continue;
+
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+
+ OffsetDimm[Dimm] = 0;
+ if (Outputs->Controller[Controller].Channel[Channel].Dimm[Dimm].Status != DIMM_PRESENT) continue;
+ ControllerSave = Controller;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "CLTM Configuration for Channel %d Dimm %d\n", Channel, Dimm);
+
+ // Get offset temperature
+ (Channel ==0) ? (OffsetDimm[Dimm] = CltmThermalLookUpTable[i][j][k0][ThermalEnables->Altitude]): (OffsetDimm[Dimm] = CltmThermalLookUpTable[i][j][k1][ThermalEnables->Altitude]);
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Offset = %d degreeC\n", OffsetDimm[Dimm]);
+
+ if (ThermalEnables->TSOD_ManEn) {
+ Thigh = ((ThermalEnables->TSOD_ThigMax) << 4);
+ Tcrit = ((ThermalEnables->TSOD_TcritMax) << 4);
+
+ }
+ else{
+ Tcrit = (( (CRITICAL_TEMP) - OffsetDimm[Dimm]) << 4);
+ if(h != DISABLE_REFRESH2X ) {
+ Thigh = (( (THOT_2X_MAX_TEMP) - OffsetDimm[Dimm]) << 4);
+ }
+ else{
+ Thigh = (( (THOT_1X_MAX_TEMP) - OffsetDimm[Dimm]) << 4);
+ }
+
+ }
+
+ // SPD Thermal sensor registers Configurations Begin
+ //((SpdDeviceAddress & 0x0F) | THERMAL_MODULE_MASK )
+ //Thermal Sensor Information
+ // MFG ID
+ if (MrcOemSmbusRead16 (Inputs->SmbusBaseAddress, ((Inputs->Controller[Controller].Channel[Channel].Dimm[Dimm].SpdAddress & 0x0F) | THERMAL_MODULE_MASK ), MTS_MFGID, &MtsData) == mrcFail) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Error - Channel %d Dimm %d Temp Sensor NACK\n", Channel, Dimm);
+ } else {
+ Temp = (((MtsData & 0xFF00) >> 8) | ((MtsData & 0x00FF) << 8));
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel %d Dimm %d Temp Sensor Mfg Id = 0x%04X\n", Channel, Dimm, Temp);
+ }
+
+ // SPD thermal sensor DEV ID
+
+ if (MrcOemSmbusRead16 (Inputs->SmbusBaseAddress, ((Inputs->Controller[Controller].Channel[Channel].Dimm[Dimm].SpdAddress & 0x0F) | THERMAL_MODULE_MASK ) , MTS_DID, &MtsData) == mrcFail) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Error - Channel %d Dimm %d Temp Sensor NACK\n", Channel, Dimm);
+ } else {
+ Temp = (((MtsData & 0xFF00) >> 8) | ((MtsData & 0x00FF) << 8));
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel %d Dimm %d Temp Sensor Dev/Rev Id = 0x%04X\n", Channel, Dimm, Temp);
+ }
+
+ // Configuration Register // Disabling Configuration Register
+ MtsData = 0;
+ Temp = (((MtsData & 0xFF00) >> 8) | ((MtsData & 0x00FF) << 8));
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Thermal Sensor Configuration value to be programmed into TS2002 is 0x%X\n", Temp);
+ MrcOemSmbusWrite16 (Inputs->SmbusBaseAddress, ((Inputs->Controller[Controller].Channel[Channel].Dimm[Dimm].SpdAddress & 0x0F) | THERMAL_MODULE_MASK ), MTS_CFG, Temp);
+ MrcOemSmbusRead16 (Inputs->SmbusBaseAddress, ((Inputs->Controller[Controller].Channel[Channel].Dimm[Dimm].SpdAddress & 0x0F) | THERMAL_MODULE_MASK ), MTS_CFG, &MtsData);
+ Temp = (((MtsData & 0xFF00) >> 8) | ((MtsData & 0x00FF) << 8));
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Thermal Sensor Configuration value read from TS2002 is 0x%X\n", MtsData);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Thermal Sensor Configuration value is 0x%X\n", Temp);
+
+ // THigh 0x02
+
+ Temp = (((Thigh & 0xFF00) >> 8) | ((Thigh & 0x00FF) << 8));
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "High Temp value is 0x%X = %d degreeC\n", Thigh, (Thigh >> 4));
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "High Temp value to be programmed into TS2002 is 0x%X\n", Temp);
+ MrcOemSmbusWrite16 (Inputs->SmbusBaseAddress, ((Inputs->Controller[Controller].Channel[Channel].Dimm[Dimm].SpdAddress & 0x0F) | THERMAL_MODULE_MASK ), MTS_THIGH, Temp);
+ MrcOemSmbusRead16 (Inputs->SmbusBaseAddress, ((Inputs->Controller[Controller].Channel[Channel].Dimm[Dimm].SpdAddress & 0x0F) | THERMAL_MODULE_MASK ), MTS_THIGH, &Thigh);
+ Temp = (((Thigh & 0xFF00) >> 8) | ((Thigh & 0x00FF) << 8));
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "High Temp value read from TS2002 is 0x%X\n", Thigh);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "High Temp value is 0x%X = %d degreeC\n", Temp, (Temp >> 4));
+
+
+ // TCrit 0x04
+ Temp = (((Tcrit & 0xFF00) >> 8) | ((Tcrit & 0x00FF) << 8));
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Critical Temp value is 0x%X = %d degreeC\n", Tcrit, (Tcrit >> 4));
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Critical Temp value to be programmed into TS2002 is 0x%X\n", Temp);
+ MrcOemSmbusWrite16 (Inputs->SmbusBaseAddress, ((Inputs->Controller[Controller].Channel[Channel].Dimm[Dimm].SpdAddress & 0x0F) | THERMAL_MODULE_MASK ), MTS_TCRIT, Temp);
+ MrcOemSmbusRead16 (Inputs->SmbusBaseAddress, ((Inputs->Controller[Controller].Channel[Channel].Dimm[Dimm].SpdAddress & 0x0F) | THERMAL_MODULE_MASK ), MTS_TCRIT, &Tcrit);
+ Temp = (((Tcrit & 0xFF00) >> 8) | ((Tcrit & 0x00FF) << 8));
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Critical Temp value read from TS2002 is 0x%X\n", Tcrit);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Critical Temp value is 0x%X = %d degreeC\n", Temp, (Temp >> 4));
+
+ // Configuration Register
+ MtsData = TsodConfReg.Data;
+ Temp = (((MtsData & 0xFF00) >> 8) | ((MtsData & 0x00FF) << 8));
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Thermal Sensor Configuration value is 0x%X\n", MtsData);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Thermal Sensor Configuration value to be programmed into TS2002 is 0x%X\n", Temp);
+ MrcOemSmbusWrite16 (Inputs->SmbusBaseAddress, ((Inputs->Controller[Controller].Channel[Channel].Dimm[Dimm].SpdAddress & 0x0F) | THERMAL_MODULE_MASK ), MTS_CFG, Temp);
+ MrcOemSmbusRead16 (Inputs->SmbusBaseAddress, ((Inputs->Controller[Controller].Channel[Channel].Dimm[Dimm].SpdAddress & 0x0F) | THERMAL_MODULE_MASK ), MTS_CFG, &MtsData);
+ Temp = (((MtsData & 0xFF00) >> 8) | ((MtsData & 0x00FF) << 8));
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Thermal Sensor Configuration value read from TS2002 is 0x%X\n", MtsData);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Thermal Sensor Configuration value is 0x%X\n", Temp);
+ // SPD thermal sensor registers Configurations End
+
+ //Read current temperature of the TSOD 0x05
+ MrcOemSmbusRead16 (Inputs->SmbusBaseAddress, ((Inputs->Controller[Controller].Channel[Channel].Dimm[Dimm].SpdAddress & 0x0F) | THERMAL_MODULE_MASK ), TEMPERATURE_REGISTER, &Thigh);
+ Temp = (((Thigh & 0xFF00) >> 8) | ((Thigh & 0x001F) << 8));//This will get rid of the firt three bits of the register and hold only the themperatur value
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "SMBUS base Address is 0x%X\n", Inputs->SmbusBaseAddress);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "SPD address offset 0x%X of Channel:%d DIMM:%d \n", Inputs->Controller[Controller].Channel[Channel].Dimm[Dimm].SpdAddress & 0x0F, Channel, Dimm);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Module thermal SPD address 0x%X of Channel:%d DIMM:%d\n", ((Inputs->Controller[Controller].Channel[Channel].Dimm[Dimm].SpdAddress & 0x0F) | THERMAL_MODULE_MASK ), Channel, Dimm);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Offset to temperature register 0x%X\n", TEMPERATURE_REGISTER );
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Temperature register value read from TS2002 is 0x%X\n", Thigh);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Current TSOD Temperatur value is 0x%X = %d degreeC\n", Temp, (Temp >> 4));
+
+ //Warm and hot threshold Configuration begin
+ if(!ThermalEnables->UserThresholdEn) {
+
+ if((Channel ==0)&& (Dimm == 0) ) {
+ DdrWarmThresholdCh0.Bits.DIMM0 = warmThreshold;
+ DdrHotThresholdCh0.Bits.DIMM0 = hotThreshold;
+ }
+ if((Channel ==0)&& (Dimm == 1) ) {
+ DdrWarmThresholdCh0.Bits.DIMM1 = warmThreshold;
+ DdrHotThresholdCh0.Bits.DIMM1 = hotThreshold;
+ }
+
+ if((Channel ==1)&& (Dimm == 0) ) {
+ DdrWarmThresholdCh1.Bits.DIMM0 = warmThreshold;
+ DdrHotThresholdCh1.Bits.DIMM0 = hotThreshold;
+ }
+
+ if((Channel ==1)&& (Dimm == 1) ) {
+ DdrWarmThresholdCh1.Bits.DIMM1 = warmThreshold;
+ DdrHotThresholdCh1.Bits.DIMM1 = hotThreshold;
+ }
+
+ }//Warm and hot threshold Configuration End
+
+
+
+ } //for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++)
+
+ } //for (Channel = 0; Channel < MAX_CHANNEL; Channel++)
+ } // for Controller
+
+ if(!ThermalEnables->UserThresholdEn) {//Warm and hot threshold Write Registers begin
+
+ MrcWriteCR (MrcData, PCU_CR_DDR_WARM_THRESHOLD_CH0_PCU_REG, DdrWarmThresholdCh0.Data);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "DDR_WARM_THRESHOLD_CH0 %Xh: %Xh \n", PCU_CR_DDR_WARM_THRESHOLD_CH0_PCU_REG, MrcReadCR (MrcData, PCU_CR_DDR_WARM_THRESHOLD_CH0_PCU_REG));
+
+ MrcWriteCR (MrcData, PCU_CR_DDR_HOT_THRESHOLD_CH0_PCU_REG, DdrHotThresholdCh0.Data);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "DDR_HOT_THRESHOLD_CH0 %Xh: %Xh \n", PCU_CR_DDR_HOT_THRESHOLD_CH0_PCU_REG, MrcReadCR (MrcData, PCU_CR_DDR_HOT_THRESHOLD_CH0_PCU_REG));
+
+ MrcWriteCR (MrcData, PCU_CR_DDR_WARM_THRESHOLD_CH1_PCU_REG, DdrWarmThresholdCh1.Data);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "DDR_WARM_THRESHOLD_CH1 %Xh: %Xh \n", PCU_CR_DDR_WARM_THRESHOLD_CH1_PCU_REG, MrcReadCR (MrcData, PCU_CR_DDR_WARM_THRESHOLD_CH1_PCU_REG));
+
+ MrcWriteCR (MrcData, PCU_CR_DDR_HOT_THRESHOLD_CH1_PCU_REG, DdrHotThresholdCh1.Data);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "DDR_HOT_THRESHOLD_CH1 %Xh: %Xh \n", PCU_CR_DDR_HOT_THRESHOLD_CH1_PCU_REG, MrcReadCR (MrcData, PCU_CR_DDR_HOT_THRESHOLD_CH1_PCU_REG));
+
+
+ }//Warm and hot threshold threshold Write Register End
+
+
+
+
+ ASSERT (ControllerSave != CONTROLLER_NOT_LOADED ); //If no controller is Save The system asserts
+
+
+ if(!ThermalEnables->UserPowerWeightsEn) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "UP Server overriding Power weight Energy registers...\n");
+ DdrEnergyScaleFactor.Data = 0;
+
+ if((k0==0)||(k0==1)) {
+ PwrWeight0 = &CltmPowerLookUpTable[i][j][k0][0];
+ ASSERT(PwrWeight0 != NULL);//If PwrWeight0 is Null the system asserts.
+ DdrEnergyScaleFactor.Bits.SCALEFACTOR = *PwrWeight0;
+ }
+ if((k1==0)||(k1==1)) {
+ PwrWeight1 = &CltmPowerLookUpTable[i][j][k1][0];
+ ASSERT(PwrWeight1 != NULL);//If PwrWeight1 is Null the system asserts.
+ DdrEnergyScaleFactor.Bits.SCALEFACTOR = *PwrWeight1;
+ }
+
+ if ( ((k0==0)||(k0==1)) && ((k1==0)||(k1==1))) {
+ (k0 >= k1) ? (DdrEnergyScaleFactor.Bits.SCALEFACTOR = *PwrWeight0) : (DdrEnergyScaleFactor.Bits.SCALEFACTOR = *PwrWeight1);
+ }
+
+
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "DDR_ENERGY_SCALEFACTOR %Xh: %Xh \n", PCU_CR_DDR_ENERGY_SCALEFACTOR_PCU_REG, DdrEnergyScaleFactor.Data);
+ MrcWriteCR (MrcData, PCU_CR_DDR_ENERGY_SCALEFACTOR_PCU_REG, DdrEnergyScaleFactor.Data);
+
+
+ if((k0==0)||(k0==1)) {PwrWeight0++;}
+ if((k1==0)||(k1==1)) {PwrWeight1++;}
+
+ PmDimmRdEnergy.Data = 0;
+
+ if ((k0==0)||(k0==1)){
+ if (Outputs->Controller[ControllerSave].Channel[0].Dimm[0].Status == DIMM_PRESENT){
+ PmDimmRdEnergy.Bits.DIMM0_RD_ENERGY = *PwrWeight0;
+ }
+ if (Outputs->Controller[ControllerSave].Channel[0].Dimm[1].Status == DIMM_PRESENT){
+ PmDimmRdEnergy.Bits.DIMM1_RD_ENERGY = *PwrWeight0;
+ }
+
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "MCHBAR_CH0_CR_PM_DIMM_RD_ENERGY_REG %Xh: %Xh \n", MCHBAR_CH0_CR_PM_DIMM_RD_ENERGY_REG, PmDimmRdEnergy.Data);
+ MrcWriteCR (MrcData, MCHBAR_CH0_CR_PM_DIMM_RD_ENERGY_REG, PmDimmRdEnergy.Data);
+
+
+ PmDimmRdEnergy.Data = 0;
+
+ if ((k1==0)||(k1==1)){
+ if (Outputs->Controller[ControllerSave].Channel[1].Dimm[0].Status == DIMM_PRESENT){
+ PmDimmRdEnergy.Bits.DIMM0_RD_ENERGY = *PwrWeight1;
+
+ }
+ if (Outputs->Controller[ControllerSave].Channel[1].Dimm[1].Status == DIMM_PRESENT){
+ PmDimmRdEnergy.Bits.DIMM1_RD_ENERGY = *PwrWeight1;
+ }
+
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "MCHBAR_CH1_CR_PM_DIMM_RD_ENERGY_REG %Xh: %Xh \n", MCHBAR_CH1_CR_PM_DIMM_RD_ENERGY_REG, PmDimmRdEnergy.Data);
+ MrcWriteCR (MrcData, MCHBAR_CH1_CR_PM_DIMM_RD_ENERGY_REG, PmDimmRdEnergy.Data);
+
+ if((k0==0)||(k0==1)) {PwrWeight0++;}
+ if((k1==0)||(k1==1)) {PwrWeight1++;}
+ PmDimmWrEnergy.Data = 0;
+
+ if ((k0==0)||(k0==1)){
+ if (Outputs->Controller[ControllerSave].Channel[0].Dimm[0].Status == DIMM_PRESENT){
+ PmDimmWrEnergy.Bits.DIMM0_WR_ENERGY = *PwrWeight0;
+ }
+ if (Outputs->Controller[ControllerSave].Channel[0].Dimm[1].Status == DIMM_PRESENT){
+ PmDimmWrEnergy.Bits.DIMM1_WR_ENERGY = *PwrWeight0;
+ }
+
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "MCHBAR_CH0_CR_PM_DIMM_WR_ENERGY_REG %Xh: %Xh \n", MCHBAR_CH0_CR_PM_DIMM_WR_ENERGY_REG, PmDimmWrEnergy.Data);
+ MrcWriteCR (MrcData, MCHBAR_CH0_CR_PM_DIMM_WR_ENERGY_REG, PmDimmWrEnergy.Data);
+
+ PmDimmWrEnergy.Data = 0;
+
+ if ((k1==0)||(k1==1)){
+ if (Outputs->Controller[ControllerSave].Channel[1].Dimm[0].Status == DIMM_PRESENT){
+ PmDimmWrEnergy.Bits.DIMM0_WR_ENERGY = *PwrWeight1;
+
+ }
+ if (Outputs->Controller[ControllerSave].Channel[1].Dimm[1].Status == DIMM_PRESENT){
+ PmDimmWrEnergy.Bits.DIMM1_WR_ENERGY = *PwrWeight1;
+ }
+
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "MCHBAR_CH1_CR_PM_DIMM_WR_ENERGY_REG %Xh: %Xh \n", MCHBAR_CH1_CR_PM_DIMM_WR_ENERGY_REG, PmDimmWrEnergy.Data);
+ MrcWriteCR (MrcData, MCHBAR_CH1_CR_PM_DIMM_WR_ENERGY_REG, PmDimmWrEnergy.Data);
+
+ if((k0==0)||(k0==1)) {PwrWeight0++;}
+ if((k1==0)||(k1==1)) {PwrWeight1++;}
+ PmDimmActEnergy.Data = 0;
+ if ((k0==0)||(k0==1)){
+ if (Outputs->Controller[ControllerSave].Channel[0].Dimm[0].Status == DIMM_PRESENT){
+ PmDimmActEnergy.Bits.DIMM0_ACT_ENERGY = *PwrWeight0;
+ }
+ if (Outputs->Controller[ControllerSave].Channel[0].Dimm[1].Status == DIMM_PRESENT){
+ PmDimmActEnergy.Bits.DIMM1_ACT_ENERGY = *PwrWeight0;
+ }
+
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "MCHBAR_CH0_CR_PM_DIMM_ACT_ENERGY_REG %Xh: %Xh \n", MCHBAR_CH0_CR_PM_DIMM_ACT_ENERGY_REG, PmDimmActEnergy.Data);
+ MrcWriteCR (MrcData, MCHBAR_CH0_CR_PM_DIMM_ACT_ENERGY_REG, PmDimmActEnergy.Data);
+
+ PmDimmActEnergy.Data = 0;
+ if ((k1==0)||(k1==1)){
+ if (Outputs->Controller[ControllerSave].Channel[1].Dimm[0].Status == DIMM_PRESENT){
+ PmDimmActEnergy.Bits.DIMM0_ACT_ENERGY = *PwrWeight1;
+ }
+ if (Outputs->Controller[ControllerSave].Channel[1].Dimm[1].Status == DIMM_PRESENT){
+ PmDimmActEnergy.Bits.DIMM1_ACT_ENERGY = *PwrWeight1;
+ }
+
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "MCHBAR_CH1_CR_PM_DIMM_ACT_ENERGY_REG %Xh: %Xh \n", MCHBAR_CH1_CR_PM_DIMM_ACT_ENERGY_REG, PmDimmActEnergy.Data);
+ MrcWriteCR (MrcData, MCHBAR_CH1_CR_PM_DIMM_ACT_ENERGY_REG, PmDimmActEnergy.Data);
+
+ if((k0==0)||(k0==1)) {PwrWeight0++;}
+ if((k1==0)||(k1==1)) {PwrWeight1++;}
+ PmDimmIdleEnergy.Data = 0;
+ if ((k0==0)||(k0==1)){
+ if (Outputs->Controller[ControllerSave].Channel[0].Dimm[0].Status == DIMM_PRESENT){
+ PmDimmIdleEnergy.Bits.DIMM0_IDLE_ENERGY = *PwrWeight0;
+ }
+ if (Outputs->Controller[ControllerSave].Channel[0].Dimm[1].Status == DIMM_PRESENT){
+ PmDimmIdleEnergy.Bits.DIMM1_IDLE_ENERGY = *PwrWeight0;
+ }
+
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "MCHBAR_CH0_CR_PM_DIMM_IDLE_ENERGY_REG %Xh: %Xh \n", MCHBAR_CH0_CR_PM_DIMM_IDLE_ENERGY_REG, PmDimmIdleEnergy.Data);
+ MrcWriteCR (MrcData, MCHBAR_CH0_CR_PM_DIMM_IDLE_ENERGY_REG, PmDimmIdleEnergy.Data);
+
+ PmDimmIdleEnergy.Data = 0;
+ if ((k1==0)||(k1==1)){
+ if (Outputs->Controller[ControllerSave].Channel[1].Dimm[0].Status == DIMM_PRESENT){
+ PmDimmIdleEnergy.Bits.DIMM0_IDLE_ENERGY = *PwrWeight1;
+ }
+ if (Outputs->Controller[ControllerSave].Channel[1].Dimm[1].Status == DIMM_PRESENT){
+ PmDimmIdleEnergy.Bits.DIMM1_IDLE_ENERGY = *PwrWeight1;
+ }
+
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "MCHBAR_CH1_CR_PM_DIMM_IDLE_ENERGY_REG %Xh: %Xh \n", MCHBAR_CH1_CR_PM_DIMM_IDLE_ENERGY_REG, PmDimmIdleEnergy.Data);
+ MrcWriteCR (MrcData, MCHBAR_CH1_CR_PM_DIMM_IDLE_ENERGY_REG, PmDimmIdleEnergy.Data);
+
+ if((k0==0)||(k0==1)) {PwrWeight0++;}
+ if((k1==0)||(k1==1)) {PwrWeight1++;}
+ PmDimmPdEnergy.Data = 0;
+ if ((k0==0)||(k0==1)){
+ if (Outputs->Controller[ControllerSave].Channel[0].Dimm[0].Status == DIMM_PRESENT){
+ PmDimmPdEnergy.Bits.DIMM0_PD_ENERGY = *PwrWeight0;
+ }
+ if (Outputs->Controller[ControllerSave].Channel[0].Dimm[1].Status == DIMM_PRESENT){
+ PmDimmPdEnergy.Bits.DIMM1_PD_ENERGY = *PwrWeight0;
+ }
+
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "MCHBAR_CH0_CR_PM_DIMM_PD_ENERGY_REG %Xh: %Xh \n", MCHBAR_CH0_CR_PM_DIMM_PD_ENERGY_REG, PmDimmPdEnergy.Data);
+ MrcWriteCR (MrcData, MCHBAR_CH0_CR_PM_DIMM_PD_ENERGY_REG, PmDimmPdEnergy.Data);
+
+ PmDimmPdEnergy.Data = 0;
+ if ((k1==0)||(k1==1)){
+ if (Outputs->Controller[ControllerSave].Channel[1].Dimm[0].Status == DIMM_PRESENT){
+ PmDimmPdEnergy.Bits.DIMM0_PD_ENERGY = *PwrWeight1;
+ }
+ if (Outputs->Controller[ControllerSave].Channel[1].Dimm[1].Status == DIMM_PRESENT){
+ PmDimmPdEnergy.Bits.DIMM1_PD_ENERGY = *PwrWeight1;
+ }
+
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "MCHBAR_CH1_CR_PM_DIMM_PD_ENERGY_REG %Xh: %Xh \n", MCHBAR_CH1_CR_PM_DIMM_PD_ENERGY_REG, PmDimmPdEnergy.Data);
+ MrcWriteCR (MrcData, MCHBAR_CH1_CR_PM_DIMM_PD_ENERGY_REG, PmDimmPdEnergy.Data);
+
+ }
+
+ if(!ThermalEnables->UserBudgetEn) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "UP Server Overriding Power budget registers...\n");
+
+ if((k0==0)||(k0==1)) {
+ PwrWeight0 = &CltmPowerLookUpTable[i][j][k0][0];
+ PwrWeight0 = PwrWeight0 + WARM_BUDGET_POSITION;
+ ASSERT(PwrWeight0 != NULL);//If PwrWeight0 is Null the system asserts.
+
+ }
+ if((k1==0)||(k1==1)) {
+ PwrWeight1 = &CltmPowerLookUpTable[i][j][k1][0];
+ PwrWeight1 = PwrWeight1 + WARM_BUDGET_POSITION;
+ ASSERT(PwrWeight1 != NULL);//If PwrWeight1 is Null the system asserts.
+
+ }
+
+ DdrWarmBudgetCh0.Data = 0;
+ if ((k0==0)||(k0==1)){
+ if (Outputs->Controller[ControllerSave].Channel[0].Dimm[0].Status == DIMM_PRESENT){
+ DdrWarmBudgetCh0.Bits.DIMM0 = *PwrWeight0;
+ }
+ if (Outputs->Controller[ControllerSave].Channel[0].Dimm[1].Status == DIMM_PRESENT){
+ DdrWarmBudgetCh0.Bits.DIMM1 = *PwrWeight0;
+ }
+
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "DDR_WARM_BUDGET_CH0 %Xh: %Xh \n", PCU_CR_DDR_WARM_BUDGET_CH0_PCU_REG, DdrWarmBudgetCh0.Data);
+ MrcWriteCR (MrcData, PCU_CR_DDR_WARM_BUDGET_CH0_PCU_REG, DdrWarmBudgetCh0.Data);
+
+ DdrWarmBudgetCh1.Data = 0;
+ if ((k1==0)||(k1==1)){
+ if (Outputs->Controller[ControllerSave].Channel[1].Dimm[0].Status == DIMM_PRESENT){
+ DdrWarmBudgetCh1.Bits.DIMM0 = *PwrWeight1;
+ }
+ if (Outputs->Controller[ControllerSave].Channel[1].Dimm[1].Status == DIMM_PRESENT){
+ DdrWarmBudgetCh1.Bits.DIMM1 = *PwrWeight1;
+ }
+
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "DDR_WARM_BUDGET_CH1 %Xh: %Xh \n", PCU_CR_DDR_WARM_BUDGET_CH1_PCU_REG, DdrWarmBudgetCh1.Data);
+ MrcWriteCR (MrcData, PCU_CR_DDR_WARM_BUDGET_CH1_PCU_REG, DdrWarmBudgetCh1.Data);
+
+ if((k0==0)||(k0==1)) {PwrWeight0++;}
+ if((k1==0)||(k1==1)) {PwrWeight1++;}
+ DdrHotBudgetCh0.Data = 0;
+ if ((k0==0)||(k0==1)){
+ if (Outputs->Controller[ControllerSave].Channel[0].Dimm[0].Status == DIMM_PRESENT){
+ DdrHotBudgetCh0.Bits.DIMM0 = *PwrWeight0;
+ }
+ if (Outputs->Controller[ControllerSave].Channel[0].Dimm[1].Status == DIMM_PRESENT){
+ DdrHotBudgetCh0.Bits.DIMM1 = *PwrWeight0;
+ }
+
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "DDR_HOT_BUDGET_CH0 %Xh: %Xh \n", PCU_CR_DDR_HOT_BUDGET_CH0_PCU_REG, DdrHotBudgetCh0.Data);
+ MrcWriteCR (MrcData, PCU_CR_DDR_HOT_BUDGET_CH0_PCU_REG, DdrHotBudgetCh0.Data);
+
+ DdrHotBudgetCh1.Data = 0;
+
+ if ((k1==0)||(k1==1)){
+ if (Outputs->Controller[ControllerSave].Channel[1].Dimm[0].Status == DIMM_PRESENT){
+ DdrHotBudgetCh1.Bits.DIMM0 = *PwrWeight1;
+ }
+ if (Outputs->Controller[ControllerSave].Channel[1].Dimm[1].Status == DIMM_PRESENT){
+ DdrHotBudgetCh1.Bits.DIMM1 = *PwrWeight1;
+ }
+
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "DDR_HOT_BUDGET_CH1 %Xh: %Xh \n", PCU_CR_DDR_HOT_BUDGET_CH1_PCU_REG, DdrHotBudgetCh1.Data);
+ MrcWriteCR (MrcData, PCU_CR_DDR_HOT_BUDGET_CH1_PCU_REG, DdrHotBudgetCh1.Data);
+
+ }
+
+
+ //
+ // POWER THERMAL MANAGEMENT CONTROL
+ //
+ DdrPtmCtl.Data = MrcReadCR (MrcData, PCU_CR_DDR_PTM_CTL_PCU_REG);
+ DdrPtmCtl.Bits.OLTM_ENABLE = ThermalEnables->EnableOltm;//Disable , 0, Not available for UP Platforms
+ DdrPtmCtl.Bits.CLTM_ENABLE = ThermalEnables->EnableCltm;//Default 1
+ DdrPtmCtl.Bits.REFRESH_2X_MODE = ThermalEnables->Refresh2X;//Default 1, REFRESH_2X_WARM_HOT if dimm do not support then equals 0
+ /*
+ DdrPtmCtl.Bits.EXTTS_ENABLE = ThermalEnables->EnableExtts;//Default 0
+ DdrPtmCtl.Bits.PDWN_CONFIG_CTL = ThermalEnables->EnablePwrDn;//Default 1, BIOS is in control of powednmodes
+
+ //DdrPtmCtl.Bits.DISABLE_DRAM_TS = !ThermalEnables->LpddrThermalSensor; //If not ULT this is disable or Value 1
+ */
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "DDR_PTM_CTL %Xh to program: %Xh \n", PCU_CR_DDR_PTM_CTL_PCU_REG, DdrPtmCtl.Data);
+ MrcWriteCR (MrcData, PCU_CR_DDR_PTM_CTL_PCU_REG, DdrPtmCtl.Data);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "DDR_PTM_CTL %Xh: %Xh \n", PCU_CR_DDR_PTM_CTL_PCU_REG, MrcReadCR (MrcData, PCU_CR_DDR_PTM_CTL_PCU_REG));
+
+
+ } else {
+ //
+ // POWER THERMAL MANAGEMENT CONTROL
+ //
+ Outputs->CLTM_SPD_Conf = PROCESS_FAILED;
+ MrcCltmDisable(MrcData);
+ return;
+
+
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "MrcCltmInit - End.\n");
+
+}
+#endif // AMI_OVERRIDE_FOR_UPSERVER_SUPPORT
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemPlatform.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemPlatform.h
new file mode 100644
index 0000000..77006be
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemPlatform.h
@@ -0,0 +1,357 @@
+/** @file
+ This file contains platform related functions.
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _MrcOemPlatform_h_
+#define _MrcOemPlatform_h_
+
+#include "MrcTypes.h"
+#include "MrcApi.h"
+#include "MrcOem.h"
+#include "MrcOemIo.h"
+#include "MrcOemMmio.h"
+#include "MrcWriteDqDqs.h"
+
+#ifdef MRC_MINIBIOS_BUILD
+
+#define GPIO_BASE_ADDRESS (0x800)
+
+#define PLATFORM_MB (0x04)
+#define PLATFORM_SRVER (0x01)
+#define PLATFORM_DT (0x01)
+
+#define SB_BUS (0)
+#define SB_PCI2ISA_DEVICE (31)
+#define SB_PCI2ISA_FUNC (0)
+#define SB_PCI2ISA_BUS_DEV_FUNC ((SB_BUS << 8) + ((SB_PCI2ISA_DEVICE << 3) + SB_PCI2ISA_FUNC))
+#define PCI_LPC_BASE (0x80000000 + (SB_PCI2ISA_BUS_DEV_FUNC << 8))
+
+///
+/// CPU Mobile SA Device IDs B0:D0:F0
+///
+#define MRC_SA_DEVICE_ID_MB_0 0x0C04 ///< Haswell Mobile SA DID
+#define MRC_SA_DEVICE_ID_MB_1 0x0A04 ///< Haswell Ult Mobile SA DID
+#define MRC_SA_DEVICE_ID_MB_2 0x0D04 ///< Crystalwell Mobile SA DID
+
+///
+/// CPU Desktop SA Device IDs B0:D0:F0
+///
+#define MRC_SA_DEVICE_ID_DT_0 0x0C00 ///< Haswell Desktop SA DID
+#define MRC_SA_DEVICE_ID_DT_1 0x0D00 ///< Crystalwell Desktop SA DID
+#define MRC_SA_DEVICE_ID_DT_2 0x0C0C ///< Haswell Marketing SpareAffect SA DID
+
+///
+/// CPU Server SA Device IDs B0:D0:F0
+///
+#define MRC_SA_DEVICE_ID_SVR_0 0x0C08 ///< Haswell Server SA DID
+#define MRC_SA_DEVICE_ID_SVR_1 0x0D08 ///< Crystalwell Server SA DID
+
+#endif // MRC_MINIBIOS_BUILD
+#define MRC_EXIT_VALUE (0xFF)
+#define PCU_CR_PLATFORM_INFO (0xCE)
+#define isprint(a) (((a) >= ' ') && ((a) <= '~') ? (a) : 0)
+
+typedef enum {
+ RefRateLowTempOOS, // Not safe
+ RefRateFourth, // 4x tREFI - Not safe
+ RefRateHalf, // 2x tREFI
+ RefRate1x, // tREFI
+ RefRate2x, // 1/2 tREFI
+ RefRate4x, // 1/4 tREFI
+ RefRate4xDeRateAc, // 1/4 tREFI de-rate AC timing - Not safe
+ RefRateHighTempOOS // Not safe
+} LpddrRefreshRates;
+
+#pragma pack (push, 1)
+typedef union {
+ struct {
+ U32 : 8;
+ U32 MAX_NON_TURBO_LIM_RATIO : 8;
+ U32 : 16;
+ U32 : 32;
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} PCU_CR_PLATFORM_INFO_STRUCT;
+
+typedef union {
+ struct {
+ U32 Enable_2x_Refresh : 1; // Bits 0:0
+ U32 LPDDR_Min_MR4 : 3; // Bits 1:3
+ U32 : 27; // Bits 4:30
+ U32 Lock_Bit : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MrcMailbox2xRefresh;
+#pragma pack (pop)
+/**
+ This function directs pCode to force 2x Refresh through the mailbox.
+
+ @param[in] MrcData - Pointer to the MRC global data structure
+
+ @retval - Nothing.
+**/
+void
+MrcOemEnable2xRefresh (
+ IN MrcParameters *const MrcData
+ );
+
+/**
+ This function changes the DIMM Voltage to the closest desired voltage without
+ going higher. Default wait time is the minimum value of 200us, if more time
+ is needed before deassertion of DIMM Reset#, then change the parameter.
+
+ @param[in, out] MrcData - The MRC "global data" area.
+ @param[in] VddVoltage - Selects the DDR voltage to use, in mV.
+ @param[in, out] VddSettleWaitTime - Time needed for Vdd to settle after the update
+
+ @retval TRUE if a voltage change occurred, otherwise FALSE.
+**/
+extern
+BOOL
+MrcOemVDDVoltageCheckAndSwitch (
+ IN OUT MrcParameters *MrcData,
+ IN const MrcVddSelect VddVoltage,
+ IN OUT U32 * const VddSettleWaitTime
+ );
+
+/**
+@brief
+ Gets CPU ratio - P-State ratio. for get the real time we need to multiply it in B CLK.
+
+ @param[in] Nothing
+
+ @retval U32 - PERF STATUS.
+**/
+extern
+U32
+MrcGetCpuRatio (
+ void
+ );
+
+/**
+@brief
+ Gets CPU current time - rdtsc value.
+ return the result in millisec.
+
+ @param[in] Nothing
+
+ @retval U64 - rdtsc value.
+**/
+extern
+U64
+MrcGetCpuTime (
+ void
+ );
+
+/**
+@brief
+ Sets CpuModel and CpuStepping in MrcData based on CpuModelStep.
+
+ @param[out] MrcData - The Mrc Host data structure
+ @param[in] CpuModel - The CPU Family Model.
+ @param[in] CpuStepping - The CPU Stepping.
+
+ @retval - mrcSuccess if the model and stepping is found. Otherwise mrcFail
+**/
+MrcStatus
+MrcSetCpuInformation (
+ OUT MrcParameters *MrcData,
+ IN MrcCpuModel CpuModel,
+ IN MrcCpuStepping CpuStepping
+ );
+
+/**
+@brief
+ Gets CPU's random number generator.
+ return the GeneratedSeed result.
+
+ @param[in] Nothing
+
+ @retval U32 - GeneratedSeed value.
+**/
+extern
+U32
+MrcGetRandomNumber (
+ void
+ );
+
+/**
+@brief
+ Hook before normal mode is enabled.
+
+ @param[in, out] MrcData - The MRC "global data" area.
+
+ @retval Nothing.
+**/
+extern
+void
+MrcOemBeforeNormalModeTestMenu (
+ IN OUT MrcParameters *const MrcData
+ );
+
+/**
+@brief
+ Hook after normal mode is enabled
+
+ @param[in] MrcData - The MRC "global data" area.
+
+ @retval Nothing.
+**/
+extern
+void
+MrcOemAfterNormalModeTestMenu (
+ IN MrcParameters *MrcData
+ );
+
+/**
+@brief
+ Overwrite Thermal settings
+
+ @param[in] MrcData - The MRC "global data" area.
+
+ @retval Nothing.
+**/
+extern
+void
+MrcThermalOverwrites (
+ IN MrcParameters *MrcData
+ );
+
+
+/**
+@brief
+ this function use by the OEM to do dedicated task during the MRC.
+
+ @param[in] MrcData - include all the MRC data
+ @param[in] OemStatusCommand - A command that indicates the task to perform.
+ @param[in] ptr - general ptr for general use.
+
+ @retval The status of the task.
+**/
+extern
+MrcStatus
+MrcOemCheckPoint (
+ IN MrcParameters *MrcData,
+ IN MRC_OemStatusCommand OemStatusCommand,
+ IN void *ptr
+ );
+
+/**
+@brief
+ This function display on port 80 number.
+ It can be different debug interface.
+ This function can be use for any debug ability according to OEM requirements.
+
+ @param[in] MrcData - Mrc Global Data
+ @param[in] DisplayDebugNumber - the number to display on port 80.
+
+ @retval Nothing
+**/
+extern
+void
+MrcOemDebugHook (
+ IN MrcParameters *MrcData,
+ IN U16 DisplayDebugNumber
+ );
+
+#ifdef UPSERVER_SUPPORT
+void
+MrcCltmInit (
+ MrcParameters *MrcData
+);
+
+void
+MrcCltmDisable (
+ MrcParameters *MrcData
+);
+#endif //UPSERVER_SUPPORT
+
+#ifdef MRC_DEBUG_PRINT
+/**
+@brief
+ Print the input parameters to the debug message output port.
+
+ @param[in] MrcData - The MRC global data.
+
+ @retval mrcSuccess
+**/
+extern
+MrcStatus
+MrcPrintInputParameters (
+ MrcParameters * const MrcData
+ );
+
+/**
+@brief
+ Print the specified memory to the serial message debug port.
+
+ @param[in] Debug - Serial message debug structure.
+ @param[in] Start - The starting address to dump.
+ @param[in] Size - The amount of data in bytes to dump.
+
+ @retval Nothing.
+**/
+extern
+void
+MrcPrintMemory (
+ IN const MrcDebug *const Debug,
+ IN const U8 *const Start,
+ IN const U32 Size
+ );
+#endif
+
+#if (defined MEMORY_DOWN_SUPPORT && (MEMORY_DOWN_SUPPORT > 0))
+/**
+@brief
+ Enables Memory Down support and sets SPD data for all DIMMs needing support.
+
+ @param[in, out] Inputs - MRC Input data structure.
+ @param[in] BoardId - The ID of the board.
+
+ @retval Nothing
+**/
+extern
+void
+EnableMemoryDown (
+ IN OUT MrcInput *const Inputs,
+ IN U16 BoardId
+ );
+#endif // MEMORY_DOWN_SUPPORT
+
+/**
+@brief
+ Initialize the board-specific CMD/CTL/CLK and DQ/DQS mapping for LPDDR3.
+
+ @param[in, out] Inputs - MRC Input data structure.
+ @param[in] BoardId - The ID of the board.
+
+ @retval none
+**/
+void
+MrcOemLpddrBoardMapping (
+ IN OUT MrcInput *Inputs,
+ IN U16 BoardId
+ );
+
+#endif // _MrcOemPlatform_h_
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemSmbus.c b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemSmbus.c
new file mode 100644
index 0000000..3aee432
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemSmbus.c
@@ -0,0 +1,188 @@
+/** @file
+ This file contains SMBus related functions.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+**/
+
+#include "MrcOemSmbus.h"
+
+#ifdef NOSMBUS_BUILD
+///
+/// DDR3 1600 2GB single rank
+///
+const U8 SPDData[] =
+ {0x92, 0x11, 0x0B, 0x02, 0x03, 0x19, 0x02, 0x01, 0x03, 0x11, 0x01, 0x08, 0x0A, 0x00, 0xFE, 0x00, /// 00-15
+ 0x69, 0x78, 0x69, 0x30, 0x69, 0x11, 0x18, 0x81, 0x00, 0x05, 0x3C, 0x3C, 0x00, 0xF0, 0x83, 0x01, /// 16-31
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /// 32-47
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x11, 0x61, 0x00, /// 48-63
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x80 /// 64-73
+};
+#endif
+
+/**
+@brief
+ Perform a byte read from the specified SMBus device address.
+
+ @param[in] SmbusBaseAddress - The SMBus base address.
+ @param[in] SmBusDeviceAddress - SMBus device address to read from.
+ @param[in] Offset - Byte offset to read from.
+ @param[out] Value - Location to store read value.
+
+ @retval: mrcSuccess if the read is successful, otherwise mrcFail and the read data is set to zero.
+**/
+MrcStatus
+MrcOemSmbusRead8 (
+ IN const U32 SmbusBaseAddress,
+ IN const U8 SmBusDeviceAddress,
+ IN const U8 Offset,
+ OUT U8 *const Value
+ )
+{
+ MrcStatus Status;
+ RETURN_STATUS EfiStatus;
+
+#ifdef NOSMBUS_BUILD
+ if (SmBusDeviceAddress == 0xA0) {
+ //
+ // For CH0 - DIMM0 only
+ //
+ *Value = SPDData[Offset];
+ Status = mrcSuccess;
+ } else {
+ Status = mrcFail;
+ }
+
+#else
+ *Value = SmBusReadDataByte (SmBusDeviceAddress | ((U32) Offset << 8), &EfiStatus);
+ if (EfiStatus == RETURN_SUCCESS) {
+ Status = mrcSuccess;
+ } else {
+ Status = mrcFail;
+ }
+#endif // NOSMBUS_BUILD
+
+ if (Status != mrcSuccess) {
+ *Value = 0;
+ }
+
+ return Status;
+}
+
+/**
+@brief
+ Perform a byte write to the specified SMBus device address.
+
+ @param[in] SmbusBaseAddress - The SMBus base address.
+ @param[in] SmBusDeviceAddress - SMBus device address to write to.
+ @param[in] Offset - Byte offset to write to.
+ @param[in] Value - The value to write.
+
+ @retval: mrcSuccess if the write is successful, otherwise mrcFail.
+**/
+MrcStatus
+MrcOemSmbusWrite8 (
+ IN const U32 SmbusBaseAddress,
+ IN const U8 SmBusDeviceAddress,
+ IN const U8 Offset,
+ IN U8 Value
+ )
+{
+
+ MrcStatus Status;
+ RETURN_STATUS EfiStatus;
+
+ SmBusWriteDataByte (SmBusDeviceAddress | ((U32) Offset << 8), Value, &EfiStatus);
+ Status = (EfiStatus == RETURN_SUCCESS) ? mrcSuccess : mrcFail;
+ return Status;
+}
+
+/**
+@brief
+ Perform a word read from the specified SMBus device address.
+
+ @param[in] SmbusBaseAddress - The SMBus base address.
+ @param[in] SmBusDeviceAddress - SMBus device address to read from.
+ @param[in] Offset - Offset to read from.
+ @param[out] Value - Location to store read value.
+
+ @retval: mrcSuccess if the read is successful, otherwise mrcFail and the read data is set to zero.
+**/
+MrcStatus
+MrcOemSmbusRead16 (
+ IN const U32 SmbusBaseAddress,
+ IN const U8 SmBusDeviceAddress,
+ IN const U8 Offset,
+ OUT U16 *const Value
+ )
+{
+ MrcStatus Status;
+ RETURN_STATUS EfiStatus;
+
+#ifdef NOSMBUS_BUILD
+ if (SmBusDeviceAddress == 0xA0) {
+ //
+ // For CH0 - DIMM0 only
+ //
+ *Value = SPDData[Offset];
+ Status = mrcSuccess;
+ } else {
+ Status = mrcFail;
+ }
+
+#else
+ *Value = SmBusReadDataWord (SmBusDeviceAddress | ((U32) Offset << 8), &EfiStatus);
+ if (EfiStatus == RETURN_SUCCESS) {
+ Status = mrcSuccess;
+ } else {
+ Status = mrcFail;
+ }
+#endif // NOSMBUS_BUILD
+
+ if (Status != mrcSuccess) {
+ *Value = 0;
+ }
+
+ return Status;
+}
+
+/**
+@brief
+ Perform a word write to the specified SMBus device address.
+
+ @param[in] SmbusBaseAddress - The SMBus base address.
+ @param[in] SmBusDeviceAddress - SMBus device address to write to.
+ @param[in] Offset - Offset to write to.
+ @param[in] Value - The value to write.
+
+ @retval: mrcSuccess if the write is successful, otherwise mrcFail.
+**/
+MrcStatus
+MrcOemSmbusWrite16 (
+ IN const U32 SmbusBaseAddress,
+ IN const U8 SmBusDeviceAddress,
+ IN const U8 Offset,
+ IN U16 Value
+ )
+{
+ MrcStatus Status;
+ RETURN_STATUS EfiStatus;
+
+ SmBusWriteDataWord (SmBusDeviceAddress | ((U32) Offset << 8), Value, &EfiStatus);
+ Status = (EfiStatus == RETURN_SUCCESS) ? mrcSuccess : mrcFail;
+ return Status;
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemSmbus.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemSmbus.h
new file mode 100644
index 0000000..c6569bd
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcOemSmbus.h
@@ -0,0 +1,119 @@
+/** @file
+ This file contains SMBus related functions.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+**/
+#ifndef _MrcOemSmbus_h_
+#define _MrcOemSmbus_h_
+
+#ifndef MRC_MINIBIOS_BUILD
+#include <Tiano.h>
+#include <EdkIIGlueBaseTypes.h>
+#include <EdkIIGlueSmbusLib.h>
+#endif // MRC_MINIBIOS_BUILD
+#pragma pack (push, 1)
+#include "MrcTypes.h"
+#include "MrcApi.h"
+#include "MrcOemDebugPrint.h"
+
+#ifdef MRC_MINIBIOS_BUILD
+#include "smb.h"
+#endif // MRC_MINIBIOS_BUILD
+
+/**
+@brief
+ Perform a byte read from the specified SMBus device address.
+
+ @param[in] SmbusBaseAddress - The SMBus base address.
+ @param[in] SmBusDeviceAddress - SMBus device address to read from.
+ @param[in] Offset - Byte offset to read from.
+ @param[out] Value - Location to store read value.
+
+ @retval: mrcSuccess if the read is successful, otherwise mrcFail and the read data is set to zero.
+**/
+extern
+MrcStatus
+MrcOemSmbusRead8 (
+ IN const U32 SmbusBaseAddress,
+ IN const U8 SmBusDeviceAddress,
+ IN const U8 Offset,
+ OUT U8 *const Value
+ );
+
+/**
+@brief
+ Perform a byte write to the specified SMBus device address.
+
+ @param[in] SmbusBaseAddress - The SMBus base address.
+ @param[in] SmBusDeviceAddress - SMBus device address to write to.
+ @param[in] Offset - Byte offset to write to.
+ @param[in] Value - The value to write.
+
+ @retval: mrcSuccess if the write is successful, otherwise mrcFail.
+**/
+extern
+MrcStatus
+MrcOemSmbusWrite8 (
+ IN const U32 SmbusBaseAddress,
+ IN const U8 SmBusDeviceAddress,
+ IN const U8 Offset,
+ IN U8 Value
+ );
+
+/**
+@brief
+ Perform a word read from the specified SMBus device address.
+
+ @param[in] SmbusBaseAddress - The SMBus base address.
+ @param[in] SmBusDeviceAddress - SMBus device address to read from.
+ @param[in] Offset - Offset to read from.
+ @param[out] Value - Location to store read value.
+
+ @retval: mrcSuccess if the read is successful, otherwise mrcFail and the read data is set to zero.
+**/
+extern
+MrcStatus
+MrcOemSmbusRead16 (
+ IN const U32 SmbusBaseAddress,
+ IN const U8 SmBusDeviceAddress,
+ IN const U8 Offset,
+ OUT U16 *const Value
+ );
+
+/**
+@brief
+ Perform a word write to the specified SMBus device address.
+
+ @param[in] SmbusBaseAddress - The SMBus base address.
+ @param[in] SmBusDeviceAddress - SMBus device address to write to.
+ @param[in] Offset - Offset to write to.
+ @param[in] Value - The value to write.
+
+ @retval: mrcSuccess if the write is successful, otherwise mrcFail.
+**/
+extern
+MrcStatus
+MrcOemSmbusWrite16 (
+ IN const U32 SmbusBaseAddress,
+ IN const U8 SmBusDeviceAddress,
+ IN const U8 Offset,
+ IN U16 Value
+ );
+
+#pragma pack(pop)
+#endif // _MrcOemSmbus_h_
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcSpdDriver.c b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcSpdDriver.c
new file mode 100644
index 0000000..fe916cc
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcSpdDriver.c
@@ -0,0 +1,291 @@
+/** @file
+
+ This file contains functions that read the SPD data for each DIMM slot over
+ the SMBus interface.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+
+**/
+
+#include "MrcSpdDriver.h"
+#include "MrcSpdProcessing.h"
+
+#define MAX_SPD_PAGE_COUNT (1)
+#define MAX_SPD_PAGE_SIZE (256)
+#define MAX_SPD_SIZE (MAX_SPD_PAGE_SIZE * MAX_SPD_PAGE_COUNT)
+#define SPD_PAGE_ADDRESS_0 (0x6C)
+#define SPD_PAGE_ADDRESS_1 (0x6E)
+
+/**
+@brief
+ Read the SPD data over the SMBus, at the specified SPD address, starting at
+ the specified starting offset and read the given amount of data.
+
+ @param[in, out] Inputs - Mrc Inputs structure
+ @param[in] SpdAddress - SPD SMBUS address
+ @param[in, out] Buffer - Buffer to store the data.
+ @param[in] Start - Starting SPD offset
+ @param[in] Size - The number of bytes of data to read and also the size of the buffer.
+ @param[in, out] Page - The final page that is being pointed to.
+
+ @retval mrcSuccess if the read is successful, otherwise mrcDimmNotExist, which
+ @retval indicates that no slots are populated.
+**/
+static
+MrcStatus
+MrcDoSpdRead (
+ IN OUT MrcInput *const Inputs,
+ IN const U8 SpdAddress,
+ IN OUT U8 *const Buffer,
+ IN const U16 Start,
+ IN U16 Size,
+ IN OUT U8 *Page
+ )
+{
+ MrcDebug *Debug;
+ MrcStatus Status;
+ BOOL PageUpdate;
+ U16 Count;
+ U16 Index;
+
+ Debug = &Inputs->Debug;
+ Status = mrcFail;
+ if ((Buffer != NULL) && (Start < MAX_SPD_SIZE) && ((Start + Size) < MAX_SPD_SIZE)) {
+ Count = 0;
+ PageUpdate = FALSE;
+ while (Size--) {
+ Index = Start + Count;
+ if ((Index / MAX_SPD_PAGE_SIZE) != *Page) {
+ *Page = (U8) (Index / MAX_SPD_PAGE_SIZE);
+ PageUpdate = TRUE;
+ }
+ Index %= MAX_SPD_PAGE_SIZE;
+ if (PageUpdate == TRUE) {
+ PageUpdate = FALSE;
+ MrcOemSmbusWrite8 (Inputs->SmbusBaseAddress, (*Page == 0) ? SPD_PAGE_ADDRESS_0 : SPD_PAGE_ADDRESS_1, 0, 0);
+ }
+ Status = MrcOemSmbusRead8 (Inputs->SmbusBaseAddress, SpdAddress, (U8) Index, &Buffer[Count]);
+ if (mrcSuccess != Status) {
+ break;
+ }
+ Count++;
+ }
+ }
+ return (Status);
+}
+
+/**
+@brief
+ See if there is valid XMP SPD data.
+
+ @param[in] Debug - Mrc debug structure.
+ @param[in, out] Spd - Mrc SPD structure.
+ @param[in] XmpStart - The current offset in the SPD.
+
+ @retval TRUE if valid, FALSE in not.
+**/
+static
+BOOL
+VerifyXmp (
+ IN MrcDebug *Debug,
+ IN OUT MrcSpd *const Spd,
+ IN const U16 XmpStart
+ )
+{
+ SPD_EXTREME_MEMORY_PROFILE_HEADER *Header;
+
+ switch (Spd->Ddr3.General.DramDeviceType.Bits.Type) {
+#if ((SUPPORT_DDR3 == SUPPORT) || (SUPPORT_LPDDR3 == SUPPORT))
+#if (SUPPORT_DDR3 == SUPPORT)
+ case MRC_SPD_DDR3_SDRAM_TYPE_NUMBER:
+#endif
+#if (SUPPORT_LPDDR3 == SUPPORT)
+ case MRC_SPD_LPDDR3_SDRAM_TYPE_NUMBER:
+#endif
+ Header = &Spd->Ddr3.Xmp.Header;
+ break;
+#endif
+ default:
+ return (FALSE);
+ }
+ if (XmpStart == ((U32) (Header) - (U32) Spd)) {
+ if ((XMP_ID_STRING == Header->XmpId) && ((Header->XmpRevision.Data & 0xFE) == 0x12)) {
+ return (TRUE);
+ } else {
+ Header->XmpId = 0;
+ Header->XmpOrgConf.Data = 0;
+ Header->XmpRevision.Data = 0;
+ }
+ } else {
+ return (TRUE);
+ }
+ return (FALSE);
+}
+
+/**
+@brief
+ Read the SPD data over the SMBus, for all DIMM slots and copy the data to the MrcData structure.
+ The SPD data locations read is controlled by the current boot mode.
+
+ @param[in] BootMode - Mrc Boot Mode
+ @param[in, out] Inputs - Mrc Inputs structure
+
+ @retval mrcSuccess if the read is successful, otherwise mrcDimmNotExist, which
+ @retval indicates that no slots are populated.
+**/
+MrcStatus
+MrcGetSpdData (
+ IN const MrcBootMode BootMode,
+ IN OUT MrcInput *const Inputs
+ )
+{
+#pragma pack (push, 1)
+ typedef struct {
+ U16 Start;
+ U16 End;
+ U8 BootMode;
+ U8 Profile;
+ } SpdOffsetTable;
+#pragma pack (pop)
+ const SpdOffsetTable Table3[] = {
+#ifdef ULT_FLAG
+ { 0, 40, (1 << bmCold), (1 << STD_PROFILE) | (1 << XMP_PROFILE1) | (1 << XMP_PROFILE2) | (1 << USER_PROFILE) },
+#else // ULT_FLAG
+ { 0, 38, (1 << bmCold), (1 << STD_PROFILE) | (1 << XMP_PROFILE1) | (1 << XMP_PROFILE2) | (1 << USER_PROFILE) },
+#endif // ULT_FLAG
+ { 60, 63, (1 << bmCold), (1 << STD_PROFILE) | (1 << XMP_PROFILE1) | (1 << XMP_PROFILE2) | (1 << USER_PROFILE) },
+ { SPD3_MANUF_START, SPD3_MANUF_END, (1 << bmCold) | (1 << bmWarm) | (1 << bmFast), (1 << STD_PROFILE) | (1 << XMP_PROFILE1) | (1 << XMP_PROFILE2) | (1 << USER_PROFILE) },
+ { 128, 145, (1 << bmCold), (1 << STD_PROFILE) | (1 << XMP_PROFILE1) | (1 << XMP_PROFILE2) | (1 << USER_PROFILE) },
+#if (SUPPORT_SPD_CRC == SUPPORT)
+ { 39, 59, (1 << bmCold), (1 << STD_PROFILE) | (1 << XMP_PROFILE1) | (1 << XMP_PROFILE2) | (1 << USER_PROFILE) },
+ { 64, 125, (1 << bmCold), (1 << STD_PROFILE) | (1 << XMP_PROFILE1) | (1 << XMP_PROFILE2) | (1 << USER_PROFILE) },
+#endif
+#if SUPPORT_XMP == SUPPORT
+ { 176, 179, (1 << bmCold), (1 << STD_PROFILE) | (1 << XMP_PROFILE1) | (1 << XMP_PROFILE2) | (1 << USER_PROFILE) },
+ { 180, 184, (1 << bmCold), (1 << STD_PROFILE) | (1 << XMP_PROFILE1) | (1 << XMP_PROFILE2) | (1 << USER_PROFILE) },
+ { 185, 215, (1 << bmCold), (1 << STD_PROFILE) | (1 << XMP_PROFILE1) | (1 << XMP_PROFILE2) | (1 << USER_PROFILE) },
+ { 220, 250, (1 << bmCold), (1 << STD_PROFILE) | (1 << XMP_PROFILE1) | (1 << XMP_PROFILE2) | (1 << USER_PROFILE) },
+#endif
+ };
+ MrcDebug *Debug;
+ MrcControllerIn *ControllerIn;
+ MrcChannelIn *ChannelIn;
+ MrcDimmIn *DimmIn;
+ U8 *Buffer;
+ const SpdOffsetTable *Tbl;
+ const SpdOffsetTable *TableSelect;
+ MrcStatus Status;
+ U16 Offset;
+#ifdef MRC_DEBUG_PRINT
+ U16 Line;
+ U16 Address;
+#endif
+ U8 Controller;
+ U8 Channel;
+ U8 Dimm;
+ U8 Count;
+ U8 Index;
+ U8 Stop;
+ U8 Page;
+
+ Debug = &Inputs->Debug;
+ Count = 0;
+ Page = 0;
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerIn = &Inputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelIn = &ControllerIn->Channel[Channel];
+ if (ChannelIn->Status == CHANNEL_PRESENT) {
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ Status = mrcSuccess;
+ DimmIn = &ChannelIn->Dimm[Dimm];
+ if ((DimmIn->Status == DIMM_ENABLED) || (DimmIn->Status == DIMM_DISABLED)) {
+ Buffer = (U8 *) &DimmIn->Spd;
+ if (DimmIn->SpdAddress > 0) {
+ TableSelect = Table3;
+ Stop = (sizeof (Table3) / sizeof (SpdOffsetTable));
+ for (Index = 0; (Status == mrcSuccess) && (Index < Stop); Index++) {
+ Tbl = &TableSelect[Index];
+ if (((1 << BootMode) & Tbl->BootMode) && ((1 << Inputs->MemoryProfile) & Tbl->Profile)) {
+ Status = MrcDoSpdRead (
+ Inputs,
+ DimmIn->SpdAddress,
+ &Buffer[Tbl->Start],
+ Tbl->Start,
+ Tbl->End - Tbl->Start + 1,
+ &Page
+ );
+ if (Status == mrcSuccess) {
+ for (Offset = Tbl->Start; Offset <= Tbl->End; Offset++) {
+ DimmIn->SpdValid[Offset / CHAR_BITS] |= 1 << (Offset % CHAR_BITS);
+ }
+#if SUPPORT_XMP == SUPPORT
+ if (bmCold == BootMode) {
+ if (FALSE == VerifyXmp (Debug, (MrcSpd *) Buffer, Tbl->Start)) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "VerifyXmp FALSE\n"
+ );
+ break;
+ }
+ }
+#endif // SUPPORT_XMP
+ } else {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_WARNING,
+ "ERROR! Fail to read SMB DimmAddress %Xh Offset %Xh - %Xh\n",
+ DimmIn->SpdAddress,
+ Tbl->Start,
+ Tbl->End
+ );
+ } // if (Status...
+ } // if (((1 << BootMode)...
+ } // for (Index...
+ } else { // if (DimmIn->SpdAddress > 0), 0 = MemoryDown, see EnableMemoryDown()
+ Status = mrcSuccess;
+ }
+
+ if (Status == mrcSuccess) {
+ Count++;
+#ifdef MRC_DEBUG_PRINT
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nChannel %d Dimm %d\n", Channel, Dimm);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "SPD: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F\n");
+ for (Line = 0; Line < (sizeof (MrcSpd) / 16); Line++) {
+ Address = Line * 16;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " % 4Xh(% 5u): ", Address, Address);
+ for (Offset = 0; Offset < 16; Offset++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%02X ", Buffer[Address + Offset]);
+ }
+ for (Offset = 0; Offset < 16; Offset++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%c", isprint (Buffer[Address + Offset]) ? Buffer[Address + Offset] : '.');
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+ }
+#endif
+ } else {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_WARNING, "DIMM is not populated on channel %u, slot %u\n", Channel, Dimm);
+ } // if (Status...
+ } // if (DimmIn->Status == DIMM_ENABLED)
+ } // for (Dimm...
+ } // if (ChannelIn->Status...
+ } // for (Channel...
+ } // for (Controller...
+ return ((Count > 0) ? mrcSuccess : mrcDimmNotExist);
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcSpdDriver.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcSpdDriver.h
new file mode 100644
index 0000000..9031f9c
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcSpdDriver.h
@@ -0,0 +1,50 @@
+/** @file
+ This file contains functions that read the SPD data for each DIMM slot over
+ the SMBus interface.
+
+@Copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+#ifndef _MrcSpdDriver_h_
+#define _MrcSpdDriver_h_
+
+#include "MrcTypes.h"
+#include "MrcApi.h"
+#include "MrcGlobal.h"
+#include "MrcOemDebugPrint.h"
+#include "MrcOemSmbus.h"
+
+/**
+@brief
+ Read the SPD data over the SMBus, for all DIMM slots and copy the data to the MrcData structure.
+ The SPD data locations read is controlled by the current boot mode.
+
+ @param[in] BootMode - Mrc Boot Mode
+ @param[in] Inputs - Mrc Inputs structure
+
+ @retval mrcSuccess if the read is successful, otherwise mrcDimmNotExist, which
+ @retval indicates that no slots are populated.
+**/
+extern
+MrcStatus
+MrcGetSpdData (
+ IN const MrcBootMode BootMode,
+ IN OUT MrcInput *const Inputs
+ );
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcSsaServices.c b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcSsaServices.c
new file mode 100644
index 0000000..2a74103
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcSsaServices.c
@@ -0,0 +1,2338 @@
+/**
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+
+@copyright
+ Copyright (c) 2012 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+@file
+ MrcSsaServices.c
+
+@brief
+ This file contains the SSA BIOS services PPI.
+**/
+
+#include "MrcGlobal.h"
+#include "MrcDdr3.h"
+#include "MrcOemDebugPrint.h"
+#include "MrcOemIo.h"
+#include "MrcOemMmio.h"
+#include "MrcOemPlatform.h"
+#include "MrcOemSmbus.h"
+#include "MrcSsaServices.h"
+
+#define MAX_CADB_ENTRIES (16)
+#define REUT_CPGC_OFFSET (0x400)
+#define EXTRA_INDEX_OFFSET (1)
+#define SSA_REVISION_BIOS (('0' << 24) | ('0' << 16) | ('7' << 8) | '5')
+#define SSA_REVISION_COMMON (('0' << 24) | ('0' << 16) | ('7' << 8) | '5')
+#define SSA_REVISION_MEMORY (('0' << 24) | ('0' << 16) | ('7' << 8) | '5')
+#define SPD_SENSOR_BASE_ADDRESS (0x30)
+#define SPD_SENSOR_TEMPERATURE_OFFSET (5)
+
+extern EFI_GUID gSsaBiosServicesPpiGuid;
+
+typedef union {
+ struct {
+ UINT32 Low;
+ UINT32 High;
+ } Data32;
+ UINT64 Data;
+} UINT64_STRUCT;
+
+#ifdef SSA_FLAG
+
+/**
+
+@brief
+ Verify that the indicated socket is present and enabled.
+
+ @param[in] MrcData - Pointer to the MRC global data area.
+ @param[in] Socket - Zero based CPU socket number.
+
+ @retval TRUE if present and enabled, otherwise FALSE.
+
+**/
+static
+BOOLEAN
+IsSocketPresent (
+ const MrcParameters * const MrcData,
+ const UINT8 Socket
+ )
+{
+ return ((Socket < MAX_CPU_SOCKETS) ? TRUE : FALSE);
+}
+
+/**
+
+@brief
+ Verify that the indicated controller is present and enabled.
+
+ @param[in] MrcData - Pointer to the MRC global data area.
+ @param[in] Socket - Zero based CPU socket number.
+ @param[in] Controller - Zero based memory controller number.
+
+ @retval TRUE if present and enabled, otherwise FALSE.
+
+**/
+static
+BOOLEAN
+IsControllerPresent (
+ const MrcParameters * const MrcData,
+ const UINT8 Socket,
+ const UINT8 Controller
+ )
+{
+ return (((IsSocketPresent (MrcData, Socket)) &&
+ (Controller < MAX_CONTROLLERS) &&
+ (MrcData->SysOut.Outputs.Controller[Controller].Status == CONTROLLER_PRESENT)) ?
+ TRUE : FALSE);
+}
+
+/**
+
+@brief
+ Verify that the indicated channel is present and enabled.
+
+ @param[in] MrcData - Pointer to the MRC global data area.
+ @param[in] Socket - Zero based CPU socket number.
+ @param[in] Controller - Zero based memory controller number.
+ @param[in] Channel - Zero based memory channel number.
+
+ @retval TRUE if present and enabled, otherwise FALSE.
+
+**/
+static
+BOOLEAN
+IsChannelPresent (
+ const MrcParameters * const MrcData,
+ const UINT8 Socket,
+ const UINT8 Controller,
+ const UINT8 Channel
+ )
+{
+ return (((IsControllerPresent (MrcData, Socket, Controller)) &&
+ (Channel < MAX_CHANNEL) &&
+ (MrcData->SysOut.Outputs.Controller[Controller].Channel[Channel].Status == CHANNEL_PRESENT)) ?
+ TRUE : FALSE);
+}
+
+/**
+
+@brief
+ Verify that the indicated DIMM is present and enabled.
+
+ @param[in] MrcData - Pointer to the MRC global data area.
+ @param[in] Socket - Zero based CPU socket number.
+ @param[in] Controller - Zero based memory controller number.
+ @param[in] Channel - Zero based memory channel number.
+ @param[in] Dimm - Zero based memory DIMM number.
+
+ @retval TRUE if present and enabled, otherwise FALSE.
+
+**/
+static
+BOOLEAN
+IsDimmPresent (
+ const MrcParameters * const MrcData,
+ const UINT8 Socket,
+ const UINT8 Controller,
+ const UINT8 Channel,
+ const UINT8 Dimm
+ )
+{
+ return (((IsChannelPresent (MrcData, Socket, Controller, Channel)) &&
+ (Dimm < MAX_DIMMS_IN_CHANNEL) &&
+ (MrcData->SysOut.Outputs.Controller[Controller].Channel[Channel].Dimm[Dimm].Status == DIMM_PRESENT)) ?
+ TRUE : FALSE);
+}
+
+/**
+
+@brief
+ Verify that the indicated rank is present and enabled.
+
+ @param[in] MrcData - Pointer to the MRC global data area.
+ @param[in] Socket - Zero based CPU socket number.
+ @param[in] Controller - Zero based memory controller number.
+ @param[in] Channel - Zero based memory channel number.
+ @param[in] Dimm - Zero based memory DIMM number.
+ @param[in] Rank - Zero based memory rank number in the DIMM.
+
+ @retval TRUE if present and enabled, otherwise FALSE.
+
+**/
+static
+BOOLEAN
+IsRankPresent (
+ const MrcParameters * const MrcData,
+ const UINT8 Socket,
+ const UINT8 Controller,
+ const UINT8 Channel,
+ const UINT8 Dimm,
+ const UINT8 Rank
+ )
+{
+ return (((IsDimmPresent (MrcData, Socket, Controller, Channel, Dimm)) &&
+ (Rank < MAX_RANK_IN_DIMM) &&
+ ((MrcData->SysOut.Outputs.Controller[Controller].Channel[Channel].Dimm[Dimm].RankInDIMM - 1) >= Rank)) ?
+ TRUE : FALSE);
+}
+
+/**
+
+@brief
+ Initialize the heap so that malloc and free can be used.
+
+ @param[in] MrcData - Pointer to the MRC global data area.
+
+ @retval TRUE if present and enabled, otherwise FALSE.
+
+**/
+
+static
+BOOLEAN
+InitHeap (
+ const MrcParameters * const MrcData
+ )
+{
+ const MrcInput *Inputs;
+ UINT8 *HeapLimitPtr;
+ HeapBufHeader *HeapBase;
+ UINT8 *BaseAddr;
+
+ Inputs = &MrcData->SysIn.Inputs;
+
+ //
+ // If heap is provided
+ //
+ if (Inputs->SsaHeapSize) {
+ BaseAddr = (UINT8 *) Inputs->SsaHeapBase;
+ HeapLimitPtr = BaseAddr + Inputs->SsaHeapSize;
+
+ //
+ // Initialize the start header
+ //
+ HeapBase = (HeapBufHeader *) BaseAddr;
+ HeapBase->BufBase = BaseAddr + sizeof (HeapBufHeader);
+ HeapBase->BufLimit = Inputs->SsaHeapSize - (2 * sizeof (HeapBufHeader));
+ HeapBase->BufFlags.Data = 0;
+
+ //
+ // Initialize the end header
+ //
+ HeapBase = (HeapBufHeader *) (HeapLimitPtr - sizeof (HeapBufHeader));
+ HeapBase->BufBase = HeapLimitPtr;
+ HeapBase->BufLimit = 0;
+ HeapBase->BufFlags.Bits.HeapEnd = 1;
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/**
+
+@brief
+ Reads a variable-sized value from a memory mapped register using an absolute address.
+ This function takes advantage of any caching implemented by BIOS.
+
+ @param[in, out] PeiServices - An indirect pointer to the PEI Services Table published by the PEI Foundation.
+ @param[in, out] This - Interface pointer that implements the particular SSA_BIOS_SERVICES_PPI instance.
+ @param[in] Width - The size of the value to write.
+ @param[in] Address - Address of the register to be accessed.
+ @param[out] Buffer - Value storage location.
+
+ @retval Nothing.
+
+**/
+static
+VOID
+ReadMem (
+ EFI_PEI_SERVICES **PeiServices,
+ SSA_BIOS_SERVICES_PPI *This,
+ REG_WIDTH Width,
+ EFI_PHYSICAL_ADDRESS Address,
+ VOID *Buffer
+ )
+{
+ MMIO_BUFFER *MmioBuffer;
+
+ MmioBuffer = (MMIO_BUFFER *) Buffer;
+ switch (Width) {
+ case RegWidth8:
+ MrcOemMmioRead8 ((U32) Address, &MmioBuffer->Data8, 0);
+ break;
+
+ case RegWidth16:
+ MrcOemMmioRead16 ((U32) Address, &MmioBuffer->Data16, 0);
+ break;
+
+ case RegWidth32:
+ MrcOemMmioRead ((U32) Address, &MmioBuffer->Data32, 0);
+ break;
+
+ case RegWidth64:
+ MrcOemMmioRead64 ((U32) Address, &MmioBuffer->Data64, 0);
+ break;
+
+ default:
+ break;
+ }
+ return;
+}
+
+/**
+
+@brief
+ Writes a variable sized value to a memory mapped register using an absolute address.
+
+ @param[in, out] PeiServices - An indirect pointer to the PEI Services Table published by the PEI Foundation.
+ @param[in, out] This - Interface pointer that implements the particular SSA_BIOS_SERVICES_PPI instance.
+ @param[in] Width - The size of the value to write.
+ @param[in] Address - Address of the register to be accessed.
+ @param[in] Buffer - Value to write.
+
+ @retval Nothing.
+
+**/
+static
+VOID
+WriteMem (
+ EFI_PEI_SERVICES **PeiServices,
+ SSA_BIOS_SERVICES_PPI *This,
+ REG_WIDTH Width,
+ EFI_PHYSICAL_ADDRESS Address,
+ VOID *Buffer
+ )
+{
+ MMIO_BUFFER *MmioBuffer;
+
+ MmioBuffer = (MMIO_BUFFER *) Buffer;
+ switch (Width) {
+ case RegWidth8:
+ MrcOemMmioWrite8 ((U32) Address, MmioBuffer->Data8, 0);
+ break;
+
+ case RegWidth16:
+ MrcOemMmioWrite16 ((U32) Address, MmioBuffer->Data16, 0);
+ break;
+
+ case RegWidth32:
+ MrcOemMmioWrite ((U32) Address, MmioBuffer->Data32, 0);
+ break;
+
+ case RegWidth64:
+ MrcOemMmioWrite64 ((U32) Address, MmioBuffer->Data64, 0);
+ break;
+
+ default:
+ break;
+ }
+ return;
+}
+
+/**
+
+@brief
+ Reads a variable sized value from I/O.
+ This function takes advantage of any caching implemented by BIOS.
+
+ @param[in, out] PeiServices - An indirect pointer to the PEI Services Table published by the PEI Foundation.
+ @param[in, out] This - Interface pointer that implements the particular SSA_BIOS_SERVICES_PPI instance.
+ @param[in] Width - The size of the value to write.
+ @param[in] Address - Address of the I/O to be accessed.
+ @param[out] Buffer - Value storage location.
+
+ @retval Nothing.
+
+**/
+static
+VOID
+ReadIo (
+ EFI_PEI_SERVICES **PeiServices,
+ SSA_BIOS_SERVICES_PPI *This,
+ REG_WIDTH Width,
+ UINT32 Address,
+ VOID *Buffer
+ )
+{
+ IO_BUFFER *IoBuffer;
+
+ IoBuffer = (IO_BUFFER *) Buffer;
+ switch (Width) {
+ case RegWidth8:
+ IoBuffer->Data8 = MrcOemInPort8 ((UINT16) Address);
+ break;
+
+ case RegWidth16:
+ IoBuffer->Data16 = MrcOemInPort16 ((UINT16) Address);
+ break;
+
+ case RegWidth32:
+ IoBuffer->Data32 = MrcOemInPort32 ((UINT16) Address);
+ break;
+
+ default:
+ break;
+ }
+ return;
+}
+
+/**
+
+@brief
+ Writes a variable sized value to I/O.
+
+ @param[in, out] PeiServices - An indirect pointer to the PEI Services Table published by the PEI Foundation.
+ @param[in, out] This - Interface pointer that implements the particular SSA_BIOS_SERVICES_PPI instance.
+ @param[in] Width - The size of the value to write.
+ @param[in] Address - Address of the I/O to be accessed.
+ @param[in] Buffer - Value to write.
+
+ @retval Nothing.
+
+**/
+static
+VOID
+WriteIo (
+ EFI_PEI_SERVICES **PeiServices,
+ SSA_BIOS_SERVICES_PPI *This,
+ REG_WIDTH Width,
+ UINT32 Address,
+ VOID *Buffer
+ )
+{
+ IO_BUFFER *IoBuffer;
+
+ IoBuffer = (IO_BUFFER *) Buffer;
+ switch (Width) {
+ case RegWidth8:
+ MrcOemOutPort8 ((UINT16) Address, IoBuffer->Data8);
+ break;
+
+ case RegWidth16:
+ MrcOemOutPort16 ((UINT16) Address, IoBuffer->Data16);
+ break;
+
+ case RegWidth32:
+ MrcOemOutPort32 ((UINT16) Address, IoBuffer->Data32);
+ break;
+
+ default:
+ break;
+ }
+ return;
+}
+
+/**
+
+@brief
+ Reads a variable sized value from the PCI config space register.
+ This function takes advantage of any caching implemented by BIOS.
+
+ @param[in, out] PeiServices - An indirect pointer to the PEI Services Table published by the PEI Foundation.
+ @param[in, out] This - Interface pointer that implements the particular SSA_BIOS_SERVICES_PPI instance.
+ @param[in] Width - The size of the value to write.
+ @param[in] Address - Address of the I/O to be accessed. Must be modulo 'Width'.
+ @param[out] Buffer - Value storage location.
+ @param[in] CachedData - If set to TRUE, returns the Cached data (if applicable) for performance. If set to FALSE returns the data read from device.
+
+ @retval Nothing.
+
+**/
+static
+VOID
+ReadPci (
+ EFI_PEI_SERVICES **PeiServices,
+ SSA_BIOS_SERVICES_PPI *This,
+ REG_WIDTH Width,
+ EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS *Address,
+ VOID *Buffer,
+ BOOLEAN CachedData
+ )
+{
+ PCI_BUFFER *PciBuffer;
+ PCI_CONFIG_SPACE PciAddress;
+ UINT32 Value;
+
+ PciBuffer = (PCI_BUFFER *) Buffer;
+ PciAddress.Value = 0;
+ PciAddress.Bits.Bus = Address->Bus;
+ PciAddress.Bits.Device = Address->Device;
+ PciAddress.Bits.Function = Address->Function;
+ PciAddress.Bits.Offset = Address->Register;
+ PciAddress.Bits.Enable = 1;
+ MrcOemOutPort32 (MrcOemPciIndex (), PciAddress.Value);
+ Value = MrcOemInPort32 (MrcOemPciData ());
+
+ switch (Width) {
+ case RegWidth8:
+ PciBuffer->Data8 = (UINT8) Value;
+ break;
+
+ case RegWidth16:
+ PciBuffer->Data16 = (UINT16) Value;
+ break;
+
+ case RegWidth32:
+ PciBuffer->Data32 = Value;
+ break;
+
+ default:
+ break;
+ }
+
+ return;
+}
+
+/**
+
+@brief
+ Writes a variable sized value to the PCI config space register.
+
+ @param[in, out] PeiServices - An indirect pointer to the PEI Services Table published by the PEI Foundation.
+ @param[in, out] This - Interface pointer that implements the particular SSA_BIOS_SERVICES_PPI instance.
+ @param[in] Width - The size of the value to write.
+ @param[in] Address - Address of the I/O to be accessed. Must be modulo 'Width'.
+ @param[in] Buffer - Value to write.
+ @param[in] CachedData - If set to TRUE, returns the Cached data (if applicable) for performance. If set to FALSE returns the data read from device.
+
+ @retval Nothing.
+
+**/
+static
+VOID
+WritePci (
+ EFI_PEI_SERVICES **PeiServices,
+ SSA_BIOS_SERVICES_PPI *This,
+ REG_WIDTH Width,
+ EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS *Address,
+ VOID *Buffer,
+ BOOLEAN CachedData
+ )
+{
+ PCI_BUFFER *PciBuffer;
+ PCI_CONFIG_SPACE PciAddress;
+ BOOLEAN DoIt;
+ UINT32 Value;
+
+ PciBuffer = (PCI_BUFFER *) Buffer;
+ DoIt = TRUE;
+ PciAddress.Value = 0;
+ PciAddress.Bits.Bus = Address->Bus;
+ PciAddress.Bits.Device = Address->Device;
+ PciAddress.Bits.Function = Address->Function;
+ PciAddress.Bits.Offset = Address->Register;
+ PciAddress.Bits.Enable = 1;
+ Value = 0;
+
+ switch (Width) {
+ case RegWidth8:
+ ReadPci (PeiServices, This, RegWidth32, Address, (PCI_BUFFER *) &Value, FALSE);
+ Value &= ~0xFF;
+ Value |= PciBuffer->Data8;
+ break;
+
+ case RegWidth16:
+ ReadPci (PeiServices, This, RegWidth32, Address, (PCI_BUFFER *) &Value, FALSE);
+ Value &= ~0xFFFF;
+ Value |= PciBuffer->Data16;
+ break;
+
+ case RegWidth32:
+ Value = PciBuffer->Data32;
+ break;
+
+ default:
+ Value = 0;
+ DoIt = FALSE;
+ break;
+ }
+
+ if (DoIt) {
+ MrcOemOutPort32 (MrcOemPciIndex (), PciAddress.Value);
+ MrcOemOutPort32 (MrcOemPciData (), Value);
+ }
+
+ return;
+}
+
+/**
+
+@brief
+ Gets a base address to be used in the different memory map or MMIO register access functions.
+
+ @param[in, out] PeiServices - An indirect pointer to the PEI Services Table published by the PEI Foundation.
+ @param[in, out] This - Interface pointer that implements the particular SSA_BIOS_SERVICES_PPI instance.
+ @param[in] Socket - Zero based CPU socket number.
+ @param[in] Controller - Zero based controller number.
+ @param[in] Index - Additional index to locate the register.
+ @param[in] BaseAddressType - Value that indicates the type of base address to be retrieved.
+ @param[in] BaseAddress - Where to write the base address
+
+ @retval Success or error code.
+
+**/
+static
+SSA_STATUS
+GetBaseAddress (
+ EFI_PEI_SERVICES **PeiServices,
+ SSA_BIOS_SERVICES_PPI *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ UINT8 Index,
+ BASE_ADDR_TYPE BaseAddressType,
+ EFI_PHYSICAL_ADDRESS *BaseAddress
+ )
+{
+ MrcParameters *MrcData;
+
+ MrcData = (MrcParameters *) This->SsaMemoryConfig.MrcData;
+ switch (BaseAddressType) {
+ case MCH_BAR:
+ *BaseAddress = IsControllerPresent (MrcData, Socket, Controller) ?
+ MrcData->SysIn.Inputs.MchBarBaseAddress : 0;
+ return (Success);
+ default:
+ break;
+ }
+ return (UnsupportedValue);
+}
+
+/**
+
+@brief
+ Function used to dynamically allocate memory.
+
+ @param[in, out] PeiServices - An indirect pointer to the PEI Services Table published by the PEI Foundation.
+ @param[in, out] This - Interface pointer that implements the particular SSA_BIOS_SERVICES_PPI instance.
+ @param[in] Size - Amount of memory in bytes to allocate.
+
+ @retval Returns a pointer to an allocated memory block on success or NULL on failure.
+
+**/
+static
+VOID *
+Malloc (
+ EFI_PEI_SERVICES **PeiServices,
+ SSA_BIOS_SERVICES_PPI *This,
+ UINT32 Size
+ )
+{
+ MrcInput *Inputs;
+ MrcDebug *Debug;
+ HeapBufHeader *HeaderPtr;
+ HeapBufHeader *NextHeaderPtr;
+ MrcParameters *MrcData;
+
+ MrcData = (MrcParameters *) This->SsaMemoryConfig.MrcData;
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+
+ if ((Size == 0) || (Inputs->SsaHeapSize == 0)) {
+ return NULL;
+ }
+
+ if (Inputs->SsaHeapFlag.Bits.Init == 0) {
+ Inputs->Debug.Current = 0;
+ Inputs->SsaHeapFlag.Bits.Init = 1;
+ InitHeap (MrcData);
+ }
+
+ //
+ // Round size up to a QWORD integral.
+ //
+ Size += sizeof (UINT64) - (Size % sizeof (UINT64));
+
+ //
+ // Check to see if request exceeds available heap size.
+ //
+ if (Size > (Inputs->SsaHeapSize - (3 * sizeof (HeapBufHeader)))) {
+ return NULL;
+ }
+
+ HeaderPtr = (HeapBufHeader *) Inputs->SsaHeapBase;
+
+ //
+ // Walk the heap looking for an available buffer.
+ //
+ while ((HeaderPtr->BufFlags.Bits.Occupied > 0) || (HeaderPtr->BufLimit < Size)) {
+ HeaderPtr = (HeapBufHeader *) (HeaderPtr->BufBase + HeaderPtr->BufLimit);
+ }
+
+ //
+ // Check for the end of heap space.
+ //
+ if (HeaderPtr->BufFlags.Bits.HeapEnd > 0) {
+ return NULL;
+ }
+
+ //
+ // Lock memory for the buffer.
+ //
+ HeaderPtr->BufFlags.Bits.Occupied = 1;
+
+ //
+ // Initialize the current size and next header if required.
+ //
+ if ((HeaderPtr->BufLimit - Size) > sizeof (HeapBufHeader)) {
+ NextHeaderPtr = (HeapBufHeader *) (HeaderPtr->BufBase + Size);
+ NextHeaderPtr->BufBase = (UINT8 *) NextHeaderPtr + sizeof (HeapBufHeader);
+ NextHeaderPtr->BufLimit = HeaderPtr->BufLimit - Size - sizeof (HeapBufHeader);
+ NextHeaderPtr->BufFlags.Data = 0;
+ HeaderPtr->BufLimit = Size;
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "SSA malloc. Base = %Xh, Size = %u\n", HeaderPtr->BufBase, Size);
+ //
+ // Return the current base.
+ //
+ return HeaderPtr->BufBase;
+}
+
+/**
+
+@brief
+ Function used to release memory allocated using Malloc.
+
+ @param[in, out] PeiServices - An indirect pointer to the PEI Services Table published by the PEI Foundation.
+ @param[in, out] This - Interface pointer that implements the particular SSA_BIOS_SERVICES_PPI instance.
+ @param[in] Buffer - The buffer to return to the free pool.
+
+ @retval Nothing.
+
+**/
+static
+VOID
+Free (
+ EFI_PEI_SERVICES **PeiServices,
+ SSA_BIOS_SERVICES_PPI *This,
+ VOID *Buffer
+ )
+{
+ const MrcInput *Inputs;
+ const MrcDebug *Debug;
+ HeapBufHeader *HeaderPtr;
+ HeapBufHeader *TempPtr;
+ MrcParameters *MrcData;
+
+ MrcData = (MrcParameters *) This->SsaMemoryConfig.MrcData;
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ if (Inputs->SsaHeapSize > 0) {
+ //
+ // Initialize a pointer to the given buffer header.
+ //
+ HeaderPtr = (HeapBufHeader *) ((UINT8 *) Buffer - sizeof (HeapBufHeader));
+
+ //
+ // Validate the given pointer before proceeding.
+ //
+ if (HeaderPtr->BufBase == Buffer) {
+ //
+ // Free the given buffer.
+ //
+ HeaderPtr->BufFlags.Bits.Occupied = 0;
+
+ //
+ // Initialize the root header.
+ //
+ HeaderPtr = (HeapBufHeader *) Inputs->SsaHeapBase;
+
+ //
+ // Walk the heap looking for holes to merge.
+ //
+ do {
+ //
+ // Find the next hole.
+ //
+ while (HeaderPtr->BufFlags.Bits.Occupied > 0) {
+ HeaderPtr = (HeapBufHeader *) (HeaderPtr->BufBase + HeaderPtr->BufLimit);
+ }
+
+ //
+ // Check for the end of heap space.
+ //
+ if (HeaderPtr->BufFlags.Bits.HeapEnd > 0) {
+ break;
+ }
+
+ //
+ // Look for adjacent holes to merge.
+ //
+ TempPtr = (HeapBufHeader *) (HeaderPtr->BufBase + HeaderPtr->BufLimit);
+ while ((TempPtr->BufFlags.Bits.Occupied == 0) && (TempPtr->BufFlags.Bits.HeapEnd == 0)) {
+ //
+ // Add this buffer to the current limit and move to the next buffer.
+ //
+ HeaderPtr->BufLimit += TempPtr->BufLimit + sizeof (HeapBufHeader);
+ TempPtr = (HeapBufHeader *) (TempPtr->BufBase + TempPtr->BufLimit);
+ }
+ //
+ // Move to the next buffer.
+ //
+ HeaderPtr = (HeapBufHeader *) (HeaderPtr->BufBase + HeaderPtr->BufLimit);
+
+ } while (HeaderPtr->BufFlags.Bits.HeapEnd == 0);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "SSA free. Base = %Xh\n", Buffer);
+ }
+ }
+ return;
+}
+
+/**
+
+@brief
+ Function used to output debug messages to the output logging device.
+
+ @param[in, out] PeiServices - An indirect pointer to the PEI Services Table published by the PEI Foundation.
+ @param[in, out] This - Interface pointer that implements the particular SSA_BIOS_SERVICES_PPI instance.
+ @param[in] PrintLevel - The severity level of the string.
+ @param[in] FormatString - The reduced set of printf style format specifiers.
+ %[flags][width]type
+ [flags] '-' left align
+ [flags] '+' prefix with sign (+ or -)
+ [flags] '0' zero pad numbers
+ [flags] ' ' prefix black in front of postive numbers
+ [width] non negative decimal integer that specifies the width to print a value.
+ [width] '*' get the width from a int argument on the stack.
+ type 'd'|'i' signed decimal integer
+ type 'u' unsigned integer
+ type 'x'|'X' hexidecimal using "ABCDEF"
+ type 'c' print character
+ type 'p' print a pointer to void
+ type 's' print a null terminated string
+ @param[in] ... - Variable list of output values.
+
+ @retval Nothing.
+
+**/
+static
+VOID
+SsaDebugPrint (
+ EFI_PEI_SERVICES **PeiServices,
+ SSA_BIOS_SERVICES_PPI *This,
+ PRINT_LEVEL PrintLevel,
+ UINT8 *FormatString,
+ ...
+ )
+{
+#ifdef MRC_DEBUG_PRINT
+ MrcVaList Marker;
+ char Buffer[MAX_STRING_LENGTH];
+
+ if (FormatString != NULL) {
+ VA_START (Marker, FormatString);
+ if (StringFormatter (FormatString, Marker, sizeof (Buffer), Buffer) > 0) {
+ DEBUG ((PrintLevel, Buffer));
+ }
+ }
+#endif
+
+ return;
+}
+
+/**
+
+@brief
+ Returns the platform's memory voltage (VDD).
+
+ @param[in, out] PeiServices - An indirect pointer to the PEI Services Table published by the PEI Foundation.
+ @param[in, out] This - Interface pointer that implements the particular SSA_BIOS_SERVICES_PPI instance.
+ @param[out] Voltage - Where the platform's memory voltage (in mV) will be written.
+
+ @retval Success or failure code.
+
+**/
+static
+SSA_STATUS
+GetMemVoltage (
+ EFI_PEI_SERVICES **PeiServices,
+ SSA_BIOS_SERVICES_PPI *This,
+ UINT32 *Voltage
+ )
+{
+ MrcParameters *MrcData;
+
+ MrcData = (MrcParameters *) This->SsaMemoryConfig.MrcData;
+ *Voltage = MrcData->SysOut.Outputs.VddVoltage[MrcData->SysIn.Inputs.MemoryProfile];
+ return (Success);
+}
+
+/**
+
+@brief
+ Sets the platform's memory voltage (VDD).
+
+ @param[in, out] PeiServices - An indirect pointer to the PEI Services Table published by the PEI Foundation.
+ @param[in, out] This - Interface pointer that implements the particular SSA_BIOS_SERVICES_PPI instance.
+ @param[in] Voltage - The requested platform's memory voltage (in mV).
+
+ @retval Success or failure code.
+
+**/
+static
+SSA_STATUS
+SetMemVoltage (
+ EFI_PEI_SERVICES **PeiServices,
+ SSA_BIOS_SERVICES_PPI *This,
+ UINT32 *Voltage
+ )
+{
+ UINT32 VddSettleWaitTime;
+ MrcParameters *MrcData;
+
+ MrcData = (MrcParameters *) This->SsaMemoryConfig.MrcData;
+ VddSettleWaitTime = MIN (MrcData->SysIn.Inputs.VddSettleWaitTime, 200);
+ MrcOemVDDVoltageCheckAndSwitch (MrcData, *Voltage, &VddSettleWaitTime);
+ MrcWait (MrcData, VddSettleWaitTime * HPET_1US);
+ MrcData->SysOut.Outputs.VddVoltage[MrcData->SysIn.Inputs.MemoryProfile] = *Voltage;
+ return (Success);
+}
+
+/**
+
+@brief
+ Returns the temperature of the specified DIMM in whole degree Celsius.
+
+ @param[in, out] PeiServices - An indirect pointer to the PEI Services Table published by the PEI Foundation.
+ @param[in, out] This - Interface pointer that implements the particular SSA_BIOS_SERVICES_PPI instance.
+ @param[in] Socket - Zero based CPU socket number.
+ @param[in] Controller - Zero based controller number.
+ @param[in] Channel - Zero based channel number.
+ @param[in] Dimm - Zero based DIMM number.
+ @param[out] Temperature - Where the DIMM's temperature in whole degree Celsius will be written.
+
+ @retval Success or failure code.
+
+**/
+static
+SSA_STATUS
+GetMemTemp (
+ EFI_PEI_SERVICES **PeiServices,
+ SSA_BIOS_SERVICES_PPI *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ UINT8 Channel,
+ UINT8 Dimm,
+ INT32 *Temperature
+ )
+{
+ const MrcParameters *MrcData;
+ const MrcInput *Inputs;
+ UINT16 Value;
+ UINT8 Address;
+ union {
+ struct {
+ UINT16 Fraction : 4;
+ UINT16 Whole : 8;
+ UINT16 Sign : 1;
+ UINT16 Low : 1;
+ UINT16 High : 1;
+ UINT16 Tcrit : 1;
+ } Bit;
+ UINT16 Data;
+ UINT8 Data8[2];
+ } TsRegisterSet;
+
+ MrcData = (MrcParameters *) This->SsaMemoryConfig.MrcData;
+ Inputs = &MrcData->SysIn.Inputs;
+ if (IsDimmPresent (MrcData, Socket, Controller, Channel, Dimm)) {
+ Address = SPD_SENSOR_BASE_ADDRESS | (Inputs->Controller[Controller].Channel[Channel].Dimm[Dimm].SpdAddress & 0xF);
+ if (mrcSuccess == MrcOemSmbusRead16 (Inputs->SmbusBaseAddress, Address, SPD_SENSOR_TEMPERATURE_OFFSET, &Value)) {
+ // Value read is in big endian format, convert it to little endian.
+ TsRegisterSet.Data = ((Value << 8) & 0xFF00) | ((Value >> 8) & 0xFF);
+ *Temperature = (TsRegisterSet.Bit.Sign) ? ((-1) * TsRegisterSet.Bit.Whole) : TsRegisterSet.Bit.Whole;
+ // SsaDebugPrint (PeiServices, This, SSA_D_INFO, "SSA GetMemTemp %u/%u/%u/%u %04Xh %04Xh %d\n", Socket, Controller, Channel, Dimm, Address, TsRegisterSet.Data, *Temperature);
+ return (Success);
+ }
+ }
+ *Temperature = 0;
+ return (NotAvailable);
+}
+
+/**
+
+@brief
+ Sets the rank's mode register.
+
+ @param[in, out] PeiServices - An indirect pointer to the PEI Services Table published by the PEI Foundation.
+ @param[in, out] This - Interface pointer that implements the particular SSA_BIOS_SERVICES_PPI instance.
+ @param[in] Socket - Zero based CPU socket number.
+ @param[in] Controller - Zero based controller number.
+ @param[in] Channel - Zero based channel number.
+ @param[in] Dimm - Zero based DIMM number.
+ @param[in] Rank - Zero based rank number in the DIMM.
+ @param[in] Address - Zero based mode register number.
+ @param[in] Data - Value to write to the register.
+
+ @retval Success or failure code.
+
+**/
+static
+SSA_STATUS
+WriteMrs (
+ EFI_PEI_SERVICES **PeiServices,
+ SSA_BIOS_SERVICES_PPI *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ UINT8 Channel,
+ UINT8 Dimm,
+ UINT8 Rank,
+ UINT8 Address,
+ UINT16 Data
+ )
+{
+ MrcParameters *MrcData;
+ U8 LogicalRank;
+
+ MrcData = (MrcParameters *) This->SsaMemoryConfig.MrcData;
+ if (IsRankPresent (MrcData, Socket, Controller, Channel, Dimm, Rank)) {
+ LogicalRank = (Dimm * MAX_RANK_IN_DIMM) + Rank;
+#ifdef ULT_FLAG
+ if (MrcData->SysOut.Outputs.DdrType == MRC_DDR_TYPE_LPDDR3) {
+ MrcIssueMrw (MrcData, Channel, LogicalRank, Address, Data, FALSE, FALSE);
+ } else
+#endif
+ {
+ MrcWriteMRSAll (MrcData, Channel, MRC_BIT0 << LogicalRank, Address, &Data);
+ }
+ return (Success);
+ }
+ return (LogicalRankNotSupported);
+}
+
+/**
+
+@brief
+ Restores the rank's mode register using the default value that the MRC has stored away.
+
+ @param[in, out] PeiServices - An indirect pointer to the PEI Services Table published by the PEI Foundation.
+ @param[in, out] This - Interface pointer that implements the particular SSA_BIOS_SERVICES_PPI instance.
+ @param[in] Socket - Zero based CPU socket number.
+ @param[in] Controller - Zero based controller number.
+ @param[in] Channel - Zero based channel number.
+ @param[in] Dimm - Zero based DIMM number.
+ @param[in] Rank - Zero based rank number in the DIMM.
+ @param[in] Address - Zero based mode register number.
+
+ @retval Success or failure code.
+
+**/
+static
+SSA_STATUS
+RestoreMrs (
+ EFI_PEI_SERVICES **PeiServices,
+ SSA_BIOS_SERVICES_PPI *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ UINT8 Channel,
+ UINT8 Dimm,
+ UINT8 Rank,
+ UINT8 Address
+ )
+{
+ MrcParameters *MrcData;
+ UINT16 Data;
+
+ MrcData = (MrcParameters *) This->SsaMemoryConfig.MrcData;
+ Data = MrcData->SysOut.Outputs.Controller[Controller].Channel[Channel].Dimm[Dimm].Rank[Rank].MR[Address];
+ return (WriteMrs (PeiServices, This, Socket, Controller, Channel, Dimm, Rank, Address, Data));
+}
+
+/**
+
+@brief
+ Get the rank's mode register.
+
+ @param[in, out] PeiServices - An indirect pointer to the PEI Services Table published by the PEI Foundation.
+ @param[in, out] This - Interface pointer that implements the particular SSA_BIOS_SERVICES_PPI instance.
+ @param[in] Socket - Zero based CPU socket number.
+ @param[in] Controller - Zero based controller number.
+ @param[in] Channel - Zero based channel number.
+ @param[in] Dimm - Zero based DIMM number.
+ @param[in] Rank - Zero based rank number in the DIMM.
+ @param[in] Address - Zero based mode register number.
+ @param[out] Data - Value read from the register.
+
+ @retval Success or failure code.
+
+**/
+static
+SSA_STATUS
+ReadMrs (
+ EFI_PEI_SERVICES **PeiServices,
+ SSA_BIOS_SERVICES_PPI *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ UINT8 Channel,
+ UINT8 Dimm,
+ UINT8 Rank,
+ UINT8 Address,
+ UINT16 *Data
+ )
+{
+ MrcParameters *MrcData;
+ SSA_STATUS Status;
+
+ MrcData = (MrcParameters *) This->SsaMemoryConfig.MrcData;
+ if (IsRankPresent (MrcData, Socket, Controller, Channel, Dimm, Rank)) {
+ *Data = MrcData->SysOut.Outputs.Controller[Controller].Channel[Channel].Dimm[Dimm].Rank[Rank].MR[Address];
+ Status = Success;
+ } else {
+ *Data = 0;
+ Status = LogicalRankNotSupported;
+ }
+ return (Status);
+}
+
+/**
+
+@brief
+ Returns the DIMM number according to the rank number.
+
+ @param[in, out] PeiServices - An indirect pointer to the PEI Services Table published by the PEI Foundation.
+ @param[in, out] This - Interface pointer that implements the particular SSA_BIOS_SERVICES_PPI instance.
+ @param[in] Socket - Zero based CPU socket number.
+ @param[in] Controller - Zero based controller number.
+ @param[in] Channel - Zero based channel number.
+ @param[in] Rank - Zero based rank number in the channel.
+
+ @retval Returns the zero based DIMM index or FFh on error.
+
+**/
+static
+UINT8
+GetDimmFromLogicalRank (
+ EFI_PEI_SERVICES **PeiServices,
+ SSA_BIOS_SERVICES_PPI *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ UINT8 Channel,
+ UINT8 Rank
+ )
+{
+ MrcParameters *MrcData;
+
+ MrcData = (MrcParameters *) This->SsaMemoryConfig.MrcData;
+ if (IsChannelPresent (MrcData, Socket, Controller, Channel) && (Rank < MAX_RANK_IN_CHANNEL)) {
+ return (Rank / MAX_RANK_IN_DIMM);
+ }
+ return ((UINT8) ~0);
+}
+
+/**
+
+@brief
+ Gets DIMM information.
+
+ @param[in, out] PeiServices - An indirect pointer to the PEI Services Table published by the PEI Foundation.
+ @param[in, out] This - Interface pointer that implements the particular SSA_BIOS_SERVICES_PPI instance.
+ @param[in] Socket - Zero based CPU socket number.
+ @param[in] Controller - Zero based controller number.
+ @param[in] Channel - Zero based channel number.
+ @param[in] Dimm - Zero based DIMM number.
+ @param[in, out] DimmInfoBuffer - Location to store DIMM information.
+
+ @retval Returns DIMM information when a good status code is returned.
+
+**/
+static
+SSA_STATUS
+GetDimmInfo (
+ EFI_PEI_SERVICES **PeiServices,
+ SSA_BIOS_SERVICES_PPI *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ UINT8 Channel,
+ UINT8 Dimm,
+ MrcDimmInfo *DimmInfoBuffer
+ )
+{
+ MrcDimmOut *DimmOut;
+ MrcParameters *MrcData;
+
+ MrcData = (MrcParameters *) This->SsaMemoryConfig.MrcData;
+ if (IsDimmPresent (MrcData, Socket, Controller, Channel, Dimm)) {
+ DimmOut = &MrcData->SysOut.Outputs.Controller[Controller].Channel[Channel].Dimm[Dimm];
+ DimmInfoBuffer->EccSupport = MrcData->SysOut.Outputs.EccSupport;
+ DimmInfoBuffer->DimmCapacity = DimmOut->DimmCapacity;
+ DimmInfoBuffer->RowSize = DimmOut->RowSize;
+ DimmInfoBuffer->ColumnSize = DimmOut->ColumnSize;
+ CopyMem (&DimmInfoBuffer->SerialNumber,
+ &MrcData->SysIn.Inputs.Controller[Controller].Channel[Channel].Dimm[Dimm].Spd.Ddr3.ModuleId,
+ sizeof (SPD_UNIQUE_MODULE_ID));
+ return (Success);
+ } else {
+ SetMem (DimmInfoBuffer, 0, sizeof (MrcDimmInfo));
+ return (NotAvailable);
+ }
+}
+
+/**
+
+@brief
+ Returns the number of ranks in a specific DIMM on a given socket/controller.
+
+ @param[in, out] PeiServices - An indirect pointer to the PEI Services Table published by the PEI Foundation.
+ @param[in, out] This - Interface pointer that implements the particular SSA_BIOS_SERVICES_PPI instance.
+ @param[in] Socket - Zero based CPU socket number.
+ @param[in] Controller - Zero based controller number.
+ @param[in] Channel - Zero based channel number.
+ @param[in] Dimm - Zero based DIMM number.
+
+ @retval Returns the number of ranks in a specific DIMM on a given socket/controller.
+
+**/
+static
+UINT8
+GetRankInDimm (
+ EFI_PEI_SERVICES **PeiServices,
+ SSA_BIOS_SERVICES_PPI *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ UINT8 Channel,
+ UINT8 Dimm
+ )
+{
+ MrcParameters *MrcData;
+
+ MrcData = (MrcParameters *) This->SsaMemoryConfig.MrcData;
+ return ((IsDimmPresent (MrcData, Socket, Controller, Channel, Dimm)) ?
+ MrcData->SysOut.Outputs.Controller[Controller].Channel[Channel].Dimm[Dimm].RankInDIMM : 0);
+}
+
+/**
+
+@brief
+ Returns the bitmask of valid ranks on a given channel.
+
+ @param[in, out] PeiServices - An indirect pointer to the PEI Services Table published by the PEI Foundation.
+ @param[in, out] This - Interface pointer that implements the particular SSA_BIOS_SERVICES_PPI instance.
+ @param[in] Socket - Zero based CPU socket number.
+ @param[in] Controller - Zero based controller number.
+ @param[in] Channel - Zero based channel number.
+
+ @retval Returns the bitmask of valid ranks on a given channel.
+
+**/
+static
+UINT8
+GetLogicalRankBitMask (
+ EFI_PEI_SERVICES **PeiServices,
+ SSA_BIOS_SERVICES_PPI *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ UINT8 Channel
+ )
+{
+ MrcParameters *MrcData;
+
+ MrcData = (MrcParameters *) This->SsaMemoryConfig.MrcData;
+ return ((IsChannelPresent (MrcData, Socket, Controller, Channel)) ?
+ MrcData->SysOut.Outputs.Controller[Controller].Channel[Channel].ValidRankBitMask : 0);
+}
+
+/**
+
+@brief
+ Returns the channel bit mask of the populated channels.
+
+ @param[in, out] PeiServices - An indirect pointer to the PEI Services Table published by the PEI Foundation.
+ @param[in, out] This - Interface pointer that implements the particular SSA_BIOS_SERVICES_PPI instance.
+ @param[in] Socket - Zero based CPU socket number.
+ @param[in] Controller - Zero based controller number.
+
+ @retval Returns the channel bit mask of the populated channels.
+
+**/
+static
+UINT8
+GetChannelBitMask (
+ EFI_PEI_SERVICES **PeiServices,
+ SSA_BIOS_SERVICES_PPI *This,
+ UINT8 Socket,
+ UINT8 Controller
+ )
+{
+ UINT8 Channel;
+ UINT8 ChannelMask;
+ MrcParameters *MrcData;
+
+ MrcData = (MrcParameters *) This->SsaMemoryConfig.MrcData;
+ ChannelMask = 0;
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (IsChannelPresent (MrcData, Socket, Controller, Channel)) {
+ ChannelMask |= (MRC_BIT0 << Channel);
+ }
+ }
+ return (ChannelMask);
+}
+
+/**
+
+@brief
+ Gets information about the system.
+
+ @param[in, out] PeiServices - An indirect pointer to the PEI Services Table published by the PEI Foundation.
+ @param[in, out] This - Interface pointer that implements the particular SSA_BIOS_SERVICES_PPI instance.
+ @param[in, out] SystemInfo - Pointer to buffer to be filled with system information.
+
+ @retval Returns information about the system.
+
+**/
+static
+SSA_STATUS
+GetSystemInfo (
+ EFI_PEI_SERVICES **PeiServices,
+ SSA_BIOS_SERVICES_PPI *This,
+ MrcSystemInfo *SystemInfoBuffer
+ )
+{
+ SystemInfoBuffer->MaxNumberSockets = MAX_CPU_SOCKETS;
+ SystemInfoBuffer->MaxNumberControllers = MAX_CONTROLLERS;
+ SystemInfoBuffer->MaxNumberChannels = MAX_CHANNEL;
+ SystemInfoBuffer->MaxNumberLogicalRanks = MAX_RANK_IN_CHANNEL;
+ SystemInfoBuffer->SocketsBitMask = ((UINT32) (~0)) >> (32 - MAX_CPU_SOCKETS);
+ return (Success);
+}
+
+/**
+
+@brief
+ Get a bit mask representing the present and enabled memory controllers in a CPU socket.
+
+ @param[in, out] PeiServices - An indirect pointer to the PEI Services Table published by the PEI Foundation.
+ @param[in, out] This - Interface pointer that implements the particular SSA_BIOS_SERVICES_PPI instance.
+ @param[in] Socket - Zero based CPU socket number.
+
+ @retval A bit mask representing the present and enabled memory controllers in a CPU socket.
+
+**/
+static
+UINT8
+GetControllerBitMask (
+ EFI_PEI_SERVICES **PeiServices,
+ SSA_BIOS_SERVICES_PPI *This,
+ UINT8 Socket
+ )
+{
+ MrcParameters *MrcData;
+
+ MrcData = (MrcParameters *) This->SsaMemoryConfig.MrcData;
+ return (IsSocketPresent (MrcData, Socket) ? (((UINT8) (~0)) >> (8 - MAX_CONTROLLERS)) : 0);
+}
+
+/**
+
+@brief
+ Function used to reset a DIMM.
+
+ @param[in, out] PeiServices - An indirect pointer to the PEI Services Table published by the PEI Foundation.
+ @param[in, out] This - Interface pointer that implements the particular SSA_BIOS_SERVICES_PPI instance.
+ @param[in] Socket - Zero based CPU socket number.
+ @param[in] Controller - Zero based controller number.
+
+ @retval Nothing.
+
+**/
+static
+VOID
+JedecReset (
+ EFI_PEI_SERVICES **PeiServices,
+ SSA_BIOS_SERVICES_PPI *This,
+ UINT8 Socket,
+ UINT8 Controller
+ )
+{
+ MrcParameters *MrcData;
+
+ MrcData = (MrcParameters *) This->SsaMemoryConfig.MrcData;
+ if (IsControllerPresent (MrcData, Socket, Controller)) {
+ MrcResetSequence (MrcData);
+ }
+ return;
+}
+
+/**
+
+@brief
+ Function returns the low side range of a margin parameter.
+
+ @param[in] IoLevel - Id of the I/O level to access.
+ @param[in] MarginGroup - Id of the margin group. Can be RxDq, TxDq, RxVref or TxVref.
+
+ @retval Function returns the low side range of a margin parameter.
+
+**/
+static
+INT16
+GetMarginParamMin (
+ GSM_LT IoLevel,
+ GSM_GT MarginGroup
+ )
+{
+ INT16 Value;
+
+ switch (MarginGroup) {
+ case RxDqsDelay:
+ case TxDqsDelay:
+ Value = (-31);
+ break;
+
+ case RxVref:
+ case TxVref:
+ Value = (-54);
+ break;
+
+ default:
+ Value = INT16_MIN;
+ break;
+ }
+ return (Value);
+}
+
+/**
+
+@brief
+ Function returns the high side range of a margin parameter.
+
+ @param[in] IoLevel - Id of the I/O level to access.
+ @param[in] MarginGroup - Id of the margin group. Can be RxDq, TxDq, RxVref or TxVref.
+
+ @retval Function returns the high side range of a margin parameter.
+
+**/
+static
+INT16
+GetMarginParamMax (
+ GSM_LT IoLevel,
+ GSM_GT MarginGroup
+ )
+{
+ INT16 Value;
+
+ switch (MarginGroup) {
+ case RxDqsDelay:
+ case TxDqsDelay:
+ Value = 31;
+ break;
+
+ case RxVref:
+ case TxVref:
+ Value = 54;
+ break;
+
+ default:
+ Value = INT16_MAX;
+ break;
+ }
+ return (Value);
+}
+
+/**
+
+@brief
+ Function returns the minimum and maximum offsets that can be applied to the margin group
+ and the time delay in micro seconds for the new value to take effect.
+
+ @param[in, out] PeiServices - An indirect pointer to the PEI Services Table published by the PEI Foundation.
+ @param[in, out] This - Interface pointer that implements the particular SSA_BIOS_SERVICES_PPI instance.
+ @param[in] Socket - Zero based CPU socket number.
+ @param[in] Controller - Zero based controller number.
+ @param[in] Channel - Zero based channel number.
+ @param[in] LogicRank - Zero based rank number in the channel.
+ @param[in] IoLevel - Id of the I/O level to access.
+ @param[in] MarginGroup - Id of the margin group.
+ @param[in] MinOffset - Minimum offset supported by the given margin group.
+ @param[in] MaxOffset - Maximum offset supported by the given margin group.
+ @param[out] Delay - Wait time in micro-seconds that is required for the new setting to take effect.
+
+ @retval Success or error code.
+
+**/
+static
+SSA_STATUS
+GetMarginParamLimits (
+ EFI_PEI_SERVICES **PeiServices,
+ SSA_BIOS_SERVICES_PPI *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ UINT8 Channel,
+ UINT8 LogicRank,
+ GSM_LT IoLevel,
+ GSM_GT MarginGroup,
+ INT16 *MinOffset,
+ INT16 *MaxOffset,
+ UINT16 *Delay
+ )
+{
+ MrcParameters *MrcData;
+
+ MrcData = (MrcParameters *) This->SsaMemoryConfig.MrcData;
+ if (IsRankPresent (MrcData, Socket, Controller, Channel, LogicRank % MAX_RANK_IN_DIMM, LogicRank)) {
+ *MinOffset = GetMarginParamMin (IoLevel, MarginGroup);
+ *MaxOffset = GetMarginParamMax (IoLevel, MarginGroup);
+ *Delay = 0;
+ }
+ return (Success);
+}
+
+/**
+
+@brief
+ Function used to adjust a margin parameter.It will add an offset from the training value
+ (if memory has been trained) or from the default value (if memory has not been trained yet).
+
+ @param[in, out] PeiServices - An indirect pointer to the PEI Services Table published by the PEI Foundation.
+ @param[in, out] This - Interface pointer that implements the particular SSA_BIOS_SERVICES_PPI instance.
+ @param[in] Socket - Zero based CPU socket number.
+ @param[in] Controller - Zero based controller number.
+ @param[in] Channel - Zero based channel number.
+ @param[in] LogicRank - Zero based rank number in the channel.
+ @param[in] IoLevel - Id of the I/O level to access.
+ @param[in] MarginGroup - Id of the margin group. Can be RcvEna(0), RdT(1), WrT(2), WrDqsT(3), RdV(4) or WrV(5).
+ @param[in] Offset - Offset to be applied to the Margin parameter from the nominal.
+
+ @retval Nothing.
+
+**/
+static
+SSA_STATUS
+OffsetMarginParam (
+ EFI_PEI_SERVICES **PeiServices,
+ SSA_BIOS_SERVICES_PPI *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ UINT8 Channel,
+ UINT8 LogicRank,
+ GSM_LT IoLevel,
+ GSM_GT MarginGroup,
+ UINT16 Offset
+ )
+{
+ UINT8 Byte;
+ UINT8 ByteEnd;
+ MrcParameters *MrcData;
+
+ MrcData = (MrcParameters *) This->SsaMemoryConfig.MrcData;
+ if (IsRankPresent (MrcData, Socket, Controller, Channel, LogicRank % MAX_RANK_IN_DIMM, LogicRank)) {
+ if (MarginGroup < WrLevel) {
+ ByteEnd = MrcData->SysOut.Outputs.SdramCount;
+ for (Byte = 0; Byte < ByteEnd; Byte++) {
+ if ((MarginGroup != WrV) || (Byte == 0)) {
+ ChangeMargin(
+ MrcData,
+ MarginGroup, // param
+ (S32) Offset, // value0
+ 0, // value1
+ 0, // EnMultiCast
+ Channel, // ch
+ LogicRank, // rank
+ Byte, // byte
+ 0, // bit
+ 0, // UpdateMrcData
+ 1, // SkipWait
+ MrcRegFileStart
+ );
+ } // if
+ } // for
+ } else {
+ return (UnsupportedValue);
+ } // if
+ } else {
+ return (LogicalRankNotSupported);
+ } // if
+ return (Success);
+}
+
+/**
+
+@brief
+ Function used to write to the Write Data Buffer (WDB).
+
+ @param[in, out] PeiServices - An indirect pointer to the PEI Services Table published by the PEI Foundation.
+ @param[in, out] This - Interface pointer that implements the particular SSA_BIOS_SERVICES_PPI instance.
+ @param[in] Socket - Zero based CPU socket number.
+ @param[in] Controller - Zero based controller number.
+ @param[in] Channel - Zero based channel number.
+ @param[in] Pattern - Buffer containing the WDB pattern.
+ @param[in] CachelineCount - Size of the buffer pattern in term of the count of cachelines.
+ @param[in] StartCachelineIndex - Start offset on the WDB.
+
+ @retval Nothing.
+
+**/
+static
+VOID
+SetWdbPattern (
+ EFI_PEI_SERVICES **PeiServices,
+ SSA_BIOS_SERVICES_PPI *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ UINT8 Channel,
+ UINT64 *Pattern,
+ UINT8 CachelineCount,
+ UINT8 StartCachelineIndex
+ )
+{
+ UINT64_STRUCT *Pointer;
+ MCHBAR_CH0_CR_QCLK_LDAT_PDAT_STRUCT CrQclkLdatPdat;
+ MCHBAR_CH0_CR_QCLK_LDAT_SDAT_STRUCT CrQclkLdatSdat;
+ UINT32 CrQclkLdatDatain0Offset;
+ UINT32 CrQclkLdatDatain1Offset;
+ UINT32 CrQclkLdatSdatOffset;
+ UINT32 CrQclkLdatPdatOffset;
+ UINT8 PatternCachelineIdx;
+ UINT8 Chunk;
+ MrcParameters *MrcData;
+
+ MrcData = (MrcParameters *) This->SsaMemoryConfig.MrcData;
+ if (IsChannelPresent (MrcData, Socket, Controller, Channel)) {
+ CrQclkLdatDatain0Offset = MCHBAR_CH0_CR_QCLK_LDAT_DATAIN_0_REG +
+ ((MCHBAR_CH1_CR_QCLK_LDAT_DATAIN_0_REG - MCHBAR_CH0_CR_QCLK_LDAT_DATAIN_0_REG) * Channel);
+ CrQclkLdatDatain1Offset = MCHBAR_CH0_CR_QCLK_LDAT_DATAIN_1_REG +
+ ((MCHBAR_CH1_CR_QCLK_LDAT_DATAIN_1_REG - MCHBAR_CH0_CR_QCLK_LDAT_DATAIN_1_REG) * Channel);
+ CrQclkLdatSdatOffset = MCHBAR_CH0_CR_QCLK_LDAT_SDAT_REG +
+ ((MCHBAR_CH1_CR_QCLK_LDAT_SDAT_REG - MCHBAR_CH0_CR_QCLK_LDAT_SDAT_REG) * Channel);
+ CrQclkLdatPdatOffset = MCHBAR_CH0_CR_QCLK_LDAT_PDAT_REG +
+ ((MCHBAR_CH1_CR_QCLK_LDAT_PDAT_REG - MCHBAR_CH0_CR_QCLK_LDAT_PDAT_REG) * Channel);
+
+ CrQclkLdatSdat.Data = 0;
+ CrQclkLdatSdat.Bits.MODE = 1;
+
+ CrQclkLdatPdat.Data = 0;
+ CrQclkLdatPdat.Bits.CMDB = MRC_BIT3;
+
+ for (PatternCachelineIdx = 0; PatternCachelineIdx < CachelineCount; PatternCachelineIdx++) {
+ Pointer = (UINT64_STRUCT *) &Pattern[PatternCachelineIdx];
+ for (Chunk = 0; Chunk < MAX_CHUNK_SIZE; Chunk++) {
+ WriteMem (PeiServices, This, RegWidth32, CrQclkLdatDatain0Offset, &Pointer[Chunk].Data32.Low);
+ WriteMem (PeiServices, This, RegWidth32, CrQclkLdatDatain1Offset, &Pointer[Chunk].Data32.High);
+
+ // Set rep = 0, don't want to replicate the data.
+ // Set banksel field to the value of the chunk you want to write the 64 bits to.
+ // Set arraysel = 0 (indicating it is the MC WDB) and mode = 'b01 in the SDAT register.
+ CrQclkLdatSdat.Bits.BANKSEL = Chunk;
+ WriteMem (PeiServices, This, RegWidth32, CrQclkLdatSdatOffset, &CrQclkLdatSdat.Data);
+
+ // Finally, write the PDAT register indicating which cacheline of the WDB you want to write to
+ // by setting fastaddr field to one of the 64 cache lines. Also set cmdb in the pdat register to 4'b1000,
+ // indicating that this is a LDAT write.
+ CrQclkLdatPdat.Bits.FASTADDR = StartCachelineIndex + PatternCachelineIdx;
+ WriteMem (PeiServices, This, RegWidth32, CrQclkLdatPdatOffset, &CrQclkLdatPdat.Data);
+ } // Chunk
+
+ // Turn off LDAT mode after writing to WDB is complete.
+ CrQclkLdatSdat.Data = 0;
+ WriteMem (PeiServices, This, RegWidth32, CrQclkLdatSdatOffset, &CrQclkLdatSdat.Data);
+ } // PatternCachelineIdx
+ }
+ return;
+}
+
+/**
+
+@brief
+ Function used to write to the CADB.
+
+ @param[in, out] PeiServices - An indirect pointer to the PEI Services Table published by the PEI Foundation.
+ @param[in, out] This - Interface pointer that implements the particular SSA_BIOS_SERVICES_PPI instance.
+ @param[in] Socket - Zero based CPU socket number.
+ @param[in] Controller - Zero based controller number.
+ @param[in] Channel - Zero based channel number.
+ @param[in] Pattern - Buffer containing the WDB pattern.
+ @param[in] CachelineCount - Size of the buffer pattern in term of the count of cachelines.
+ @param[in] StartCachelineIndex - Start offset on the WDB.
+
+ @retval Nothing.
+
+**/
+static
+VOID
+SetCadbPattern (
+ EFI_PEI_SERVICES **PeiServices,
+ SSA_BIOS_SERVICES_PPI *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ UINT8 Channel,
+ UINT64 *Pattern,
+ UINT8 CachelineCount,
+ UINT8 StartCachelineIndex
+ )
+{
+ UINT32 Offset;
+ MrcParameters *MrcData;
+
+ MrcData = (MrcParameters *) This->SsaMemoryConfig.MrcData;
+ if (IsChannelPresent (MrcData, Socket, Controller, Channel)) {
+ Offset = MCHBAR_CH0_CR_REUT_CH_PAT_CADB_WRITE_POINTER_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_PAT_CADB_WRITE_POINTER_REG - MCHBAR_CH0_CR_REUT_CH_PAT_CADB_WRITE_POINTER_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, StartCachelineIndex % MAX_CADB_ENTRIES);
+
+ CachelineCount %= MAX_CADB_ENTRIES;
+ Offset = MCHBAR_CH0_CR_REUT_CH_PAT_CADB_PROG_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_PAT_CADB_PROG_REG - MCHBAR_CH0_CR_REUT_CH_PAT_CADB_PROG_REG) * Channel);
+ while (CachelineCount--) {
+ // Write Row. CADB is auto incremented after every write
+ MrcWriteCR64 (MrcData, Offset, *Pattern++);
+ }
+ }
+ return;
+}
+
+/**
+
+@brief
+ Function used to clear the lane error status registers.
+
+ @param[in, out] PeiServices - An indirect pointer to the PEI Services Table published by the PEI Foundation.
+ @param[in, out] This - Interface pointer that implements the particular SSA_BIOS_SERVICES_PPI instance.
+ @param[in] Socket - Zero based CPU socket number.
+ @param[in] Controller - Zero based controller number.
+ @param[in] ChannelMask - Each bit represents a channel to be cleared.
+
+ @retval Nothing.
+
+**/
+static
+SSA_STATUS
+ClearErrorStatus (
+ EFI_PEI_SERVICES **PeiServices,
+ SSA_BIOS_SERVICES_PPI *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ UINT8 ChannelMask
+ )
+{
+ MCHBAR_CH0_CR_REUT_CH_ERR_DATA_STATUS_STRUCT CrReutChErrDataStatus;
+ MrcParameters *MrcData;
+ UINT8 Channel;
+
+ MrcData = (MrcParameters *) This->SsaMemoryConfig.MrcData;
+ if (IsControllerPresent (MrcData, Socket, Controller)) {
+ if (ChannelMask > 0) {
+ Channel = 0;
+ while (ChannelMask) {
+ if ((ChannelMask & 1) && IsChannelPresent (MrcData, Socket, Controller, Channel)) {
+ CrReutChErrDataStatus.Data = 0;
+ WriteMem (
+ PeiServices,
+ This,
+ RegWidth64,
+ MCHBAR_CH0_CR_REUT_CH_ERR_DATA_STATUS_REG +
+ (Channel * (MCHBAR_CH1_CR_REUT_CH_ERR_DATA_STATUS_REG - MCHBAR_CH0_CR_REUT_CH_ERR_DATA_STATUS_REG)),
+ &CrReutChErrDataStatus.Data);
+ }
+ Channel++;
+ ChannelMask >>= 1;
+ }
+ } else {
+ return (UnsupportedValue);
+ }
+ } else {
+ return (ControllerNotSupported);
+ }
+ return (Success);
+}
+
+/**
+
+@brief
+ Function used to clear the error counter register.
+
+ @param[in, out] PeiServices - An indirect pointer to the PEI Services Table published by the PEI Foundation.
+ @param[in, out] This - Interface pointer that implements the particular SSA_BIOS_SERVICES_PPI instance.
+ @param[in] Socket - Zero based CPU socket number.
+ @param[in] Controller - Zero based controller number.
+ @param[in] Channel - Zero based channel number.
+ @param[in] Counter - Zero based counter number.
+
+ @retval Nothing.
+
+**/
+static
+SSA_STATUS
+ClearErrorCounter (
+ EFI_PEI_SERVICES **PeiServices,
+ SSA_BIOS_SERVICES_PPI *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ UINT8 Channel,
+ UINT8 Counter
+ )
+{
+ MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_0_STRUCT CrReutChErrCounterStatus0;
+ UINT32 Offset;
+ UINT8 Byte;
+ MrcParameters *MrcData;
+
+ MrcData = (MrcParameters *) This->SsaMemoryConfig.MrcData;
+ if (IsChannelPresent (MrcData, Socket, Controller, Channel)) {
+ Offset = MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_0_REG +
+ (Channel * (MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_0_REG - MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_0_REG));
+ CrReutChErrCounterStatus0.Data = 0;
+ for (Byte = 0; Byte < MrcData->SysOut.Outputs.SdramCount; Byte++) {
+ WriteMem (PeiServices, This, RegWidth32, Offset, &CrReutChErrCounterStatus0.Data);
+ Offset += MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_1_REG - MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_0_REG;
+ }
+ } else {
+ return (ChannelNotSupported);
+ }
+ return (Success);
+}
+
+/**
+
+@brief
+ Function used to get the DQ lane error status.
+
+ @param[in, out] PeiServices - An indirect pointer to the PEI Services Table published by the PEI Foundation.
+ @param[in, out] This - Interface pointer that implements the particular SSA_BIOS_SERVICES_PPI instance.
+ @param[in] Socket - Zero based CPU socket number.
+ @param[in] Controller - Zero based controller number.
+ @param[in] Channel - Zero based channel number.
+
+ @retval The DQ lane error status..
+
+**/
+static
+UINT64
+GetDqErrorStatus (
+ EFI_PEI_SERVICES **PeiServices,
+ SSA_BIOS_SERVICES_PPI *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ UINT8 Channel
+ )
+{
+ MCHBAR_CH0_CR_REUT_CH_ERR_DATA_STATUS_STRUCT CrReutChErrDataStatus;
+ MrcParameters *MrcData;
+
+ MrcData = (MrcParameters *) This->SsaMemoryConfig.MrcData;
+ CrReutChErrDataStatus.Data = 0;
+ if (IsChannelPresent (MrcData, Socket, Controller, Channel)) {
+ ReadMem (
+ PeiServices,
+ This,
+ RegWidth64,
+ MCHBAR_CH0_CR_REUT_CH_ERR_DATA_STATUS_REG +
+ (Channel * (MCHBAR_CH1_CR_REUT_CH_ERR_DATA_STATUS_REG - MCHBAR_CH0_CR_REUT_CH_ERR_DATA_STATUS_REG)),
+ &CrReutChErrDataStatus.Data);
+ }
+ return (CrReutChErrDataStatus.Data);
+}
+
+/**
+
+@brief
+ Function used to get the ECC lane error status.
+
+ @param[in, out] PeiServices - An indirect pointer to the PEI Services Table published by the PEI Foundation.
+ @param[in, out] This - Interface pointer that implements the particular SSA_BIOS_SERVICES_PPI instance.
+ @param[in] Socket - Zero based CPU socket number.
+ @param[in] Controller - Zero based controller number.
+ @param[in] Channel - Zero based channel number.
+
+ @retval Nothing.
+
+**/
+static
+UINT8
+GetEccErrorStatus (
+ EFI_PEI_SERVICES **PeiServices,
+ SSA_BIOS_SERVICES_PPI *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ UINT8 Channel
+ )
+{
+ MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_STRUCT Status;
+ MrcParameters *MrcData;
+
+ MrcData = (MrcParameters *) This->SsaMemoryConfig.MrcData;
+ Status.Data = 0;
+ if (IsChannelPresent (MrcData, Socket, Controller, Channel)) {
+ ReadMem (
+ PeiServices,
+ This,
+ RegWidth32,
+ MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_REG +
+ (Channel * (MCHBAR_CH1_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_REG -
+ MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_REG)),
+ &Status.Data);
+ }
+ return ((UINT8) Status.Bits.ECC_Error_Status);
+}
+
+/**
+
+@brief
+ Function used to get the ECC lane error status.
+
+ @param[in, out] PeiServices - An indirect pointer to the PEI Services Table published by the PEI Foundation.
+ @param[in, out] This - Interface pointer that implements the particular SSA_BIOS_SERVICES_PPI instance.
+ @param[in] Socket - Zero based CPU socket number.
+ @param[in] Controller - Zero based controller number.
+ @param[in] Channel - Zero based channel number.
+ @param[in] Counter - Zero based counter number.
+ @param[in] CounterMode - Enum that indicates the counter mode to be used. Count on all lanes,
+ count on a particular lane, count on a byte group, count on a particular chunk.
+ @param[in] ModeIndex - Extra index used to provide additional information if needed by the mode selected.
+ This indicates which lane, byte group or chunk has been selected.
+
+ @retval Nothing.
+
+**/
+static
+SSA_STATUS
+SetErrorCounterMode (
+ EFI_PEI_SERVICES **PeiServices,
+ SSA_BIOS_SERVICES_PPI *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ UINT8 Channel,
+ UINT8 Counter,
+ COUNTER_MODE CounterMode,
+ UINT32 ModeIndex
+ )
+{
+ UINT32 Offset;
+ MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_0_STRUCT ReutChErrCounterCtl;
+ MrcParameters *MrcData;
+
+ MrcData = (MrcParameters *) This->SsaMemoryConfig.MrcData;
+ if (IsChannelPresent (MrcData, Socket, Controller, Channel)) {
+ ReutChErrCounterCtl.Data = 0;
+ switch (CounterMode) {
+ case AllLanes:
+ Offset = MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_0_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_0_REG - MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_0_REG) * Channel);
+ break;
+
+ case ParticularLane:
+ case ParticularByteGroup:
+ case ParticularChunk:
+ Offset = MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_0_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_0_REG - MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_0_REG) * Channel) +
+ ((MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_1_REG - MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_0_REG) * Counter);
+ ReutChErrCounterCtl.Bits.Counter_Pointer = ModeIndex;
+ ReutChErrCounterCtl.Bits.Counter_Control = CounterMode;
+ break;
+
+ default:
+ return (UnsupportedValue);
+ }
+ MrcWriteCR (MrcData, Offset, ReutChErrCounterCtl.Data);
+ }
+ return (Success);
+}
+
+/**
+
+@brief
+ Function used to get the error count value for a given channel on a given socket/controller.
+
+ @param[in, out] PeiServices - An indirect pointer to the PEI Services Table published by the PEI Foundation.
+ @param[in, out] This - Interface pointer that implements the particular SSA_BIOS_SERVICES_PPI instance.
+ @param[in] Socket - Zero based CPU socket number.
+ @param[in] Controller - Zero based controller number.
+ @param[in] Channel - Zero based channel number.
+ @param[in] Counter - Zero based counter number.
+
+ @retval Nothing.
+
+**/
+static
+ERROR_COUNT_32BITS
+GetErrorCount (
+ EFI_PEI_SERVICES **PeiServices,
+ SSA_BIOS_SERVICES_PPI *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ UINT8 Channel,
+ UINT8 Counter
+ )
+{
+ MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_0_STRUCT CrReutErrCounterStatus0;
+ ERROR_COUNT_32BITS Count;
+ UINT32 Offset;
+ UINT8 Byte;
+ MrcParameters *MrcData;
+
+ MrcData = (MrcParameters *) This->SsaMemoryConfig.MrcData;
+ Count.Data = 0;
+ if (IsChannelPresent (MrcData, Socket, Controller, Channel)) {
+ Offset = MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_0_REG +
+ (Channel * (MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_0_REG - MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_0_REG));
+ for (Byte = 0; Byte < MrcData->SysOut.Outputs.SdramCount; Byte++) {
+ ReadMem (PeiServices, This, RegWidth32, Offset, &CrReutErrCounterStatus0.Data);
+ Count.Data += CrReutErrCounterStatus0.Data;
+ Offset += MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_1_REG - MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_0_REG;
+ }
+ }
+ if (Count.Data > 0x7FFFFFFF) {
+ Count.Bits.Count = 0x7FFFFFFF;
+ Count.Bits.Overflow = 1;
+ }
+
+ return (Count);
+}
+
+/**
+
+@brief
+ Function used to set the lane validation mask for a give channel on a given socket/controller.
+ Only the lanes with the mask bit set will be checked for errors.
+
+ @param[in, out] PeiServices - An indirect pointer to the PEI Services Table published by the PEI Foundation.
+ @param[in, out] This - Interface pointer that implements the particular SSA_BIOS_SERVICES_PPI instance.
+ @param[in] Socket - Zero based CPU socket number.
+ @param[in] Controller - Zero based controller number.
+ @param[in] Channel - Zero based channel number.
+ @param[in] DqMask - DQ lanes bitmask.
+ @param[in] EccMask - ECC lanes bitmask.
+
+ @retval Nothing.
+
+**/
+static
+VOID
+SetValidationBitMask (
+ EFI_PEI_SERVICES **PeiServices,
+ SSA_BIOS_SERVICES_PPI *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ UINT8 Channel,
+ UINT64 DqMask,
+ UINT8 EccMask
+ )
+{
+ MCHBAR_CH0_CR_REUT_CH_ERR_DATA_MASK_STRUCT CrReutErrDataMask;
+ MCHBAR_CH0_CR_REUT_CH_ERR_ECC_MASK_STRUCT CrReutChErrEccMask;
+ UINT32 Offset;
+ MrcParameters *MrcData;
+
+ MrcData = (MrcParameters *) This->SsaMemoryConfig.MrcData;
+ if (IsChannelPresent (MrcData, Socket, Controller, Channel)) {
+ Offset = MCHBAR_CH0_CR_REUT_CH_ERR_DATA_MASK_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_ERR_DATA_MASK_REG - MCHBAR_CH0_CR_REUT_CH_ERR_DATA_MASK_REG) * Channel);
+ CrReutErrDataMask.Data = ~DqMask;
+ WriteMem (PeiServices, This, RegWidth64, Offset, &CrReutErrDataMask.Data);
+
+ Offset = MCHBAR_CH0_CR_REUT_CH_ERR_ECC_MASK_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_ERR_ECC_MASK_REG - MCHBAR_CH0_CR_REUT_CH_ERR_ECC_MASK_REG) * Channel);
+ CrReutChErrEccMask.Data = ~EccMask;
+ WriteMem (PeiServices, This, RegWidth8, Offset, &CrReutChErrEccMask.Data);
+ }
+ return;
+}
+
+/**
+
+@brief
+ Function used to set the phase mask for a give channel on a given socket/controller.
+ Only the phases with the mask bit set will be checked for errors.
+
+ @param[in, out] PeiServices - An indirect pointer to the PEI Services Table published by the PEI Foundation.
+ @param[in, out] This - Interface pointer that implements the particular SSA_BIOS_SERVICES_PPI instance.
+ @param[in] Socket - Zero based CPU socket number.
+ @param[in] Controller - Zero based controller number.
+ @param[in] Channel - Zero based channel number.
+ @param[in] CachelineMask - Mask for the cacheline to be enabled.
+ @param[in] PhaseMask - Mask for the Phase. One bit for each phase.
+
+ @retval Nothing.
+
+**/
+static
+VOID
+SetValidationPhaseMask (
+ EFI_PEI_SERVICES **PeiServices,
+ SSA_BIOS_SERVICES_PPI *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ UINT8 Channel,
+ UINT8 CachelineMask,
+ UINT8 PhaseMask
+ )
+{
+ MCHBAR_CH0_CR_REUT_CH_ERR_CTL_STRUCT CrReutChErrCtl;
+ UINT32 Offset;
+ MrcParameters *MrcData;
+
+ MrcData = (MrcParameters *) This->SsaMemoryConfig.MrcData;
+ if (IsChannelPresent (MrcData, Socket, Controller, Channel)) {
+ Offset = MCHBAR_CH0_CR_REUT_CH_ERR_CTL_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_ERR_CTL_REG - MCHBAR_CH0_CR_REUT_CH_ERR_CTL_REG) * Channel);
+ CrReutChErrCtl.Data = 0;
+ CrReutChErrCtl.Bits.Selective_Error_Enable_Cacheline = CachelineMask;
+ CrReutChErrCtl.Bits.Selective_Error_Enable_Chunk = PhaseMask;
+ WriteMem (PeiServices, This, RegWidth32, Offset, &CrReutChErrCtl.Data);
+ }
+ return;
+}
+
+/**
+
+@brief
+ Function used to run a point test.
+
+ @param[in, out] PeiServices - An indirect pointer to the PEI Services Table published by the PEI Foundation.
+ @param[in, out] This - Interface pointer that implements the particular SSA_BIOS_SERVICES_PPI instance.
+ @param[in] Socket - Zero based CPU socket number.
+ @param[in] Controller - Zero based controller number.
+ @param[in] TestParameters - Architecture-specific test parameters.
+ @param[in] SkipSetup - Skip the test setup. It is OK to skip the setup after the first test.
+
+ @retval Nothing.
+
+**/
+static
+VOID
+RunPointTest (
+ EFI_PEI_SERVICES **PeiServices,
+ SSA_BIOS_SERVICES_PPI *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ VOID *TestParameters,
+ BOOLEAN SkipSetup
+ )
+{
+ const MRC_REUTAddress ReutAddress = {
+ {0, 0, 0, 0}, // Start
+ {0, 0, 0, 1023}, // Stop
+ {0, 0, 0, 0}, // Order
+ {0, 0, 0, 0}, // IncRate
+ {0, 0, 0, 1} // IncValue
+ };
+ // IncRate, Start, Stop, DQPat
+ const MRC_WDBPattern CWdbPattern = { 16, 0, 1, BasicVA};
+
+ MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_STRUCT CrReutChPatWdbClMuxCfg;
+ MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_STRUCT CrReutChSeqCfgMcMain0;
+ MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_STRUCT CrReutGlobalCtl;
+ MCDFXS_CR_REUT_GLOBAL_ERR_MCMAIN_STRUCT CrReutGlobalErr;
+ MRC_WDBPattern WdbPattern;
+ POINT_TEST_PARAMETERS *Params;
+ UINT32 Offset;
+ UINT16 BurstLength;
+ UINT8 DumArr[7];
+ UINT8 Channel;
+ UINT8 Rank;
+ UINT8 TargetRank;
+ UINT8 LoopCount;
+ MrcParameters *MrcData;
+
+ MrcData = (MrcParameters *) This->SsaMemoryConfig.MrcData;
+ if (IsControllerPresent (MrcData, Socket, Controller)) {
+ CopyMem (&WdbPattern, &CWdbPattern, sizeof (MRC_WDBPattern));
+ SetMem (DumArr, 1, sizeof (DumArr));
+ Params = (POINT_TEST_PARAMETERS *) TestParameters;
+
+ // Program the set up the test for each channel.
+ if (!SkipSetup) {
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (IsChannelPresent (MrcData, Socket, Controller, Channel)) {
+ // Update the WDB pattern incRate, start and stop.
+ WdbPattern.IncRate = Params->WdbIncRates[Channel];
+ WdbPattern.Stop = Params->WdbEnds[Channel];
+
+ // if (aggressor) traffic is WR or RD, need double the burst length to make it overlap with
+ // (victim) loopback traffic.
+ switch (Params->TrafficModes[Channel].Bits.TrafficMode) {
+ case TrafficModeWrite: // PatWr (Write Only)
+ case TrafficModeRead: // PatRd (Read Only)
+ BurstLength = Params->BurstLength * 2;
+ LoopCount = Params->LoopCount + 1;
+ break;
+
+ case TrafficModeWrRd: // PatWrRd (Standard Write/Read Loopback)
+ default:
+ BurstLength = Params->BurstLength;
+ LoopCount = Params->LoopCount;
+ break;
+ }
+ SetupIOTest (MrcData,
+ (MRC_BIT0 << Channel), // ChbitMask,
+ Params->TrafficModes[Channel].Bits.TrafficMode, // CmdPat,
+ BurstLength, // NumCL,
+ LoopCount, // LC,
+ &ReutAddress, // REUTAddress,
+ Params->StopOnErr, // SOE,
+ &WdbPattern, // WDBPattern,
+ Params->EnCadb[Channel], // EnCADB,
+ 0, // EnCKE,
+ 0); // SubSeqWait
+
+ // Set up LFSR or fix pattern modes.
+ if (Params->Modes[Channel].Bits.PatternMode == PatternModeFixed) {
+ // Sequentially walk through the WDB.
+ CrReutChPatWdbClMuxCfg.Data = 0;
+ CrReutChPatWdbClMuxCfg.Bits.Mux2_Control = 1;
+ CrReutChPatWdbClMuxCfg.Bits.Mux1_Control = 1;
+ CrReutChPatWdbClMuxCfg.Bits.Mux0_Control = 1;
+ CrReutChPatWdbClMuxCfg.Bits.ECC_Data_Source_Sel = 1;
+ Offset = MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_REG - MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_REG) * Channel);
+ WriteMem (PeiServices, This, RegWidth32, Offset, &CrReutChPatWdbClMuxCfg.Data);
+ }
+
+ // Update the target rank.
+ TargetRank = 0;
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ // support one rank now
+ if (Params->Ranks[Channel] & (1 << Rank)) {
+ TargetRank = Rank;
+ break;
+ }
+ } // Rank
+ SelectReutRanks (MrcData, Channel, (1 << TargetRank), 0);
+ } // if
+ } // Channel
+
+ // The SetupIOTest() disables channel's global control, we need to enable them.
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (IsChannelPresent (MrcData, Socket, Controller, Channel)) {
+ Offset = MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_REG +
+ ((MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_REG - MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_REG) * Channel);
+ ReadMem (PeiServices, This, RegWidth64, Offset, &CrReutChSeqCfgMcMain0.Data);
+ CrReutChSeqCfgMcMain0.Bits.Global_Control = 1;
+ WriteMem (PeiServices, This, RegWidth64, Offset, &CrReutChSeqCfgMcMain0.Data);
+ } // if
+ } // Channel
+
+ // Run test
+ RunIOTest (MrcData, // MrcParameters *MrcData,
+ 3, // U8 ChbitMask,
+ BasicVA, // U8 DQPat,
+ DumArr, // U8 *SeqLCs,
+ 0, // U8 ClearErrors,
+ 0);
+ } else {
+ // bypassSetup. Only issue test start bit. The not !bypassSetup needed to be called
+ // first to set up the system.
+ CrReutGlobalCtl.Data = 0;
+ CrReutGlobalCtl.Bits.Global_Start_Test = 1;
+ WriteMem (PeiServices, This, RegWidth32, MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_REG, &CrReutGlobalCtl.Data);
+
+ // Wait until channel test done.
+ do {
+ ReadMem (PeiServices, This, RegWidth32, MCDFXS_CR_REUT_GLOBAL_ERR_MCMAIN_REG, &CrReutGlobalErr.Data);
+ }
+ while (!CrReutGlobalErr.Bits.Channel_Test_Done_Status_0 || !CrReutGlobalErr.Bits.Channel_Test_Done_Status_1);
+ }
+ }
+ return;
+}
+
+const SSA_BIOS_SERVICES_PPI SsaBiosServicesConst = {
+ {
+ SSA_REVISION_BIOS,
+ 0, // *SsaCommonConfig
+ 0, // *SsaMemoryConfig
+ },
+ {
+ SSA_REVISION_COMMON,
+ 0, // MrcData
+ ReadMem,
+ WriteMem,
+ ReadIo,
+ WriteIo,
+ ReadPci,
+ WritePci,
+ GetBaseAddress,
+ Malloc,
+ Free,
+ SsaDebugPrint,
+ },
+ {
+ SSA_REVISION_MEMORY,
+ 0, // MrcData
+ GetSystemInfo,
+ GetMemVoltage,
+ SetMemVoltage,
+ GetMemTemp, // @todo: not implemented yet
+ RestoreMrs,
+ WriteMrs,
+ ReadMrs,
+ GetDimmFromLogicalRank,
+ GetDimmInfo,
+ GetRankInDimm,
+ GetLogicalRankBitMask,
+ GetChannelBitMask,
+ GetControllerBitMask,
+ JedecReset,
+ GetMarginParamLimits,
+ OffsetMarginParam,
+ SetWdbPattern,
+ SetCadbPattern,
+ ClearErrorStatus,
+ ClearErrorCounter,
+ GetDqErrorStatus,
+ GetEccErrorStatus,
+ SetErrorCounterMode,
+ GetErrorCount,
+ SetValidationBitMask,
+ SetValidationPhaseMask,
+ RunPointTest
+ }
+};
+
+/**
+
+@brief
+ Initialize the SsaBiosServices data structure.
+
+ @param[in] MrcData - The MRC global data area.
+
+ @retval Nothing
+
+**/
+VOID
+SsaBiosInitialize (
+ IN MrcParameters *MrcData
+ )
+{
+ EFI_PEI_SERVICES **PeiServices;
+ SSA_BIOS_SERVICES_PPI *SsaBiosServicesPpi;
+ EFI_PEI_PPI_DESCRIPTOR *SsaBiosServicesPpiDesc;
+ EFI_STATUS Status;
+
+ SsaBiosServicesPpi = (SSA_BIOS_SERVICES_PPI *) AllocatePool (sizeof (SSA_BIOS_SERVICES_PPI));
+ ASSERT (SsaBiosServicesPpi != NULL);
+ SsaBiosServicesPpiDesc = (EFI_PEI_PPI_DESCRIPTOR *) AllocatePool (sizeof (EFI_PEI_PPI_DESCRIPTOR));
+ ASSERT (SsaBiosServicesPpiDesc != NULL);
+
+ CopyMem (SsaBiosServicesPpi, &SsaBiosServicesConst, sizeof (SSA_BIOS_SERVICES_PPI));
+ SsaBiosServicesPpi->SsaHeader.SsaCommonConfig = &SsaBiosServicesPpi->SsaCommonConfig;
+ SsaBiosServicesPpi->SsaHeader.SsaMemoryConfig = &SsaBiosServicesPpi->SsaMemoryConfig;
+ SsaBiosServicesPpi->SsaCommonConfig.BiosData = MrcData;
+ SsaBiosServicesPpi->SsaMemoryConfig.MrcData = MrcData;
+
+ EfiCommonLibZeroMem (SsaBiosServicesPpiDesc, sizeof (EFI_PEI_PPI_DESCRIPTOR));
+ SsaBiosServicesPpiDesc->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;
+ SsaBiosServicesPpiDesc->Guid = &gSsaBiosServicesPpiGuid;
+ SsaBiosServicesPpiDesc->Ppi = SsaBiosServicesPpi;
+
+ PeiServices = (EFI_PEI_SERVICES **) MrcData->SysIn.Inputs.Debug.Stream;
+ Status = (**PeiServices).InstallPpi (PeiServices, SsaBiosServicesPpiDesc);
+ ASSERT_EFI_ERROR (Status);
+
+ MRC_DEBUG_MSG (&MrcData->SysIn.Inputs.Debug, MSG_LEVEL_NOTE, "SSA Interface ready\n");
+
+ return;
+}
+
+#endif // SSA_FLAG
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcSsaServices.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcSsaServices.h
new file mode 100644
index 0000000..63d70c1
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/MrcSsaServices.h
@@ -0,0 +1,761 @@
+/**
+This file contains an 'Intel Peripheral Driver' and uniquely
+identified as "Intel Reference Module" and is
+licensed for Intel CPUs and chipsets under the terms of your
+license agreement with Intel or your vendor. This file may
+be modified by the user, subject to additional terms of the
+license agreement
+
+Copyright (c) 2012 - 2013 Intel Corporation. All rights reserved.
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+@file
+ MrcSsaServices.h
+
+@brief
+ This file contains the SSA services PPI.
+**/
+#ifndef _MrcSsaServices_h_
+#define _MrcSsaServices_h_
+
+#include "EdkIIGluePeim.h"
+
+#pragma pack (push, 1)
+
+#define INT32_MIN (0x80000000)
+#define INT32_MAX (0x7FFFFFFF)
+#define INT16_MIN (0x8000)
+#define INT16_MAX (0x7FFF)
+#define MAX_CHUNK_SIZE (8)
+#ifndef MAX_CHANNEL
+#define MAX_CHANNEL (2)
+#endif
+
+typedef enum {
+ Success, ///< The function completed successfully.
+ NotYetAvailable, ///< The function is not yet available.
+ NotAvailable, ///< The function is not available or selected DIMM is invalid.
+ UnsupportedValue, ///< A function parameter is incorrect.
+ SocketNotSupported, ///< The desired CPU is not supported or not available in the system.
+ ControllerNotSupported, ///< The desired memory controller is not supported or not available in the CPU.
+ ChannelNotSupported, ///< The desired memory channel is not supported or not available on the controller.
+ LogicalRankNotSupported, ///< The desired memory rank is not supported or not available in the channel.
+ IoLevelNotSupported, ///< The desired I/O level is not supported or not available.
+ MarginGroupNotSupported, ///< The desired margin group is not supported or not available.
+ SsaStatusMax ///< SSA_STATUS structure maximum value.
+} SSA_STATUS;
+
+typedef enum {
+ RegWidth8, ///< An 8-bit register width is selected.
+ RegWidth16, ///< A 16-bit register width is selected.
+ RegWidth32, ///< A 32-bit register width is selected.
+ RegWidth64, ///< A 64-bit register width is selected.
+ RegWidthMax ///< REG_WIDTH structure maximum value.
+} REG_WIDTH;
+
+typedef enum {
+ RecEnDelay, ///< Receive enable delay margin group.
+ RxDqsDelay, ///< Receive DQS delay margin group.
+ RxDqBitDelay, ///< Receive DS bit delay margin group.
+ WrLvlDelay, ///< Write leveling delay margin group.
+ TxDqsDelay, ///< Transmit DQS delay margin group.
+ TxDqDelay, ///< Transmit DQ delay margin group.
+ TxDqBitDelay, ///< Transmit DQ bit delay margin group.
+ RxVref, ///< Receive voltage reference margin group.
+ TxVref, ///< Transmit voltage reference margin group.
+ CmdAll, ///< All command margin group.
+ CmdGrp0, ///< Command 0 margin group.
+ CmdGrp1, ///< Command 1 margin group.
+ CmdGrp2, ///< Command 2 margin group.
+ CtlAll, ///< All control margin group.
+ CtlGrp0, ///< Control 1 margin group.
+ CtlGrp1, ///< Control 2 margin group.
+ CtlGrp2, ///< Control 3 margin group.
+ CtlGrp3, ///< Control 4 margin group.
+ CtlGrp4, ///< Control 5 margin group.
+ CtlGrp5, ///< Control 5 margin group.
+ CkAll, ///< All CK margin group.
+ CmdCtlAll, ///< All command/control margin group.
+ CmdVref, ///< Command voltage reference margin group.
+ GsmGtMax ///< GSM_GT structure maximum value.
+} GSM_GT;
+
+typedef enum {
+ VmseLevel, ///< VMSE I/O level.
+ DdrLevel, ///< DDR I/O level.
+ LrbufLevel, ///< LRBUF I/O level.
+ GsmLtMax ///< GSM_LT structure maximum value.
+} GSM_LT;
+
+typedef enum {
+ AllLanes, ///< All lanes counter mode.
+ ParticularLane, ///< A particular lane counter mode.
+ ParticularByteGroup, ///< A particular byte lane counter mode.
+ ParticularChunk, ///< A particular chunk counter mode.
+ CounterModeMax ///< COUNTER_MODE structure maximum value.
+} COUNTER_MODE;
+
+typedef enum {
+ PatternModeFixed, ///< Fixed pattern mode.
+ PatternModeLsfr, ///< LFSR pattern mode.
+ PatternModeMax ///< PATTERN_MODE structure maximum value.
+} PATTERN_MODE;
+
+typedef enum {
+ TrafficModeWrRd, ///< Write/Read traffic mode.
+ TrafficModeWrite, ///< Write traffic mode.
+ TrafficModeRead, ///< Read traffic mode.
+ TrafficModeMax ///< TRAFFIC_MODE structure maximum value.
+} TRAFFIC_MODE;
+
+typedef enum {
+ MCH_BAR, ///< MCHBAR base address selection.
+ BaseAddrTypeMax ///< BASE_ADDR_TYPE structure maximum value.
+} BASE_ADDR_TYPE;
+
+typedef enum {
+ SSA_D_WARN = EFI_D_WARN, ///< Warnings
+ SSA_D_LOAD = EFI_D_LOAD, ///< Load events
+ SSA_D_INFO = EFI_D_INFO, ///< Informational debug messages
+ SSA_D_EVENT = EFI_D_EVENT, ///< Event messages
+ SSA_D_ERROR = EFI_D_ERROR, ///< Error
+} PRINT_LEVEL;
+
+typedef union {
+ UINT64 Data64; ///< 64-bit MMIO buffer.
+ UINT32 Data32; ///< 32-bit MMIO buffer.
+ UINT16 Data16; ///< 16-bit MMIO buffer.
+ UINT8 Data8; ///< 8-bit MMIO buffer.
+} MMIO_BUFFER;
+
+typedef union {
+ UINT32 Data32; ///< 32-bit I/O buffer.
+ UINT16 Data16; ///< 16-bit I/O buffer.
+ UINT8 Data8; ///< 8-bit I/O buffer.
+} IO_BUFFER;
+
+typedef union {
+ UINT32 Data32; ///< 32-bit PCI buffer.
+ UINT16 Data16; ///< 16-bit PCI buffer.
+ UINT8 Data8; ///< 8-bit PCI buffer.
+} PCI_BUFFER;
+
+typedef union {
+ struct {
+ UINT32 Reserved0 : 2; ///< PCI address pointer reserved value, range 0 to 3.
+ UINT32 Offset : 6; ///< PCI address pointer offset value, range 0 to 63.
+ UINT32 Function : 3; ///< PCI address pointer function value, range 0 to 7.
+ UINT32 Device : 5; ///< PCI address pointer device value, range 0 to 31.
+ UINT32 Bus : 8; ///< PCI address pointer bus value, range 0 to 255.
+ UINT32 Reserved1 : 7; ///< PCI address pointer reserved value, range 0 to 127.
+ UINT32 Enable : 1; ///< PCI address pointer enable flag, 0 = disable, 1 = enable.
+ } Bits;
+ UINT32 Value;
+} PCI_CONFIG_SPACE;
+
+#ifndef _MrcSpdData_h_
+typedef union {
+ struct {
+ UINT16 ContinuationCount : 7; ///< Bits 6:0
+ UINT16 ContinuationParity : 1; ///< Bits 7:7
+ UINT16 LastNonZeroByte : 8; ///< Bits 15:8
+ } Bits;
+ UINT16 Data;
+ UINT8 Data8;
+} SPD_MANUFACTURER_ID_CODE;
+
+typedef struct {
+ UINT8 Location; ///< Module Manufacturing Location
+} SPD_MANUFACTURING_LOCATION;
+
+typedef struct {
+ UINT8 Year; ///< Year represented in BCD (00h = 2000)
+ UINT8 Week; ///< Year represented in BCD (47h = week 47)
+} SPD_MANUFACTURING_DATE;
+
+typedef union {
+ UINT32 Data;
+ UINT16 SerialNumber16[2];
+ UINT8 SerialNumber8[4];
+} SPD_MANUFACTURER_SERIAL_NUMBER;
+
+typedef struct {
+ SPD_MANUFACTURER_ID_CODE IdCode; ///< Module Manufacturer ID Code
+ SPD_MANUFACTURING_LOCATION Location; ///< Module Manufacturing Location
+ SPD_MANUFACTURING_DATE Date; ///< Module Manufacturing Year, in BCD (range: 2000-2255)
+ SPD_MANUFACTURER_SERIAL_NUMBER SerialNumber; ///< Module Serial Number
+} SPD_UNIQUE_MODULE_ID;
+#endif //_MrcSpdData_h_
+
+typedef struct {
+ BOOLEAN EccSupport; ///< TRUE if the DIMM supports ECC, otherwise FALSE.
+ UINT32 DimmCapacity; ///< The DIMM's capacity, in megabytes.
+ UINT32 RowSize; ///< The DIMM's row address size.
+ UINT16 ColumnSize; ///< The DIMM's column address size.
+ SPD_UNIQUE_MODULE_ID SerialNumber; ///< The DIMM's serial number, retrieved from the SPD.
+} MrcDimmInfo;
+
+typedef struct {
+ UINT8 MaxNumberSockets; ///< The maximum number of CPU sockets in a system.
+ UINT8 MaxNumberControllers; ///< The maximum number of memory controllers in a CPU socket.
+ UINT8 MaxNumberChannels; ///< The maximum number of channels in a memory controller.
+ UINT8 MaxNumberLogicalRanks; ///< The maximum number of ranks in a memory channel.
+ UINT32 SocketsBitMask; ///< The bit mask of available CPU sockets.
+} MrcSystemInfo;
+
+typedef union {
+ struct {
+ UINT16 PatternMode : 1; ///< Pattern types. 0 = Fixed, 1 = LSFR.
+ UINT16 : 15; ///< Reserved.
+ } Bits;
+ UINT16 Data;
+} PATTERN_MODES;
+
+typedef union {
+ struct {
+ UINT8 TrafficMode : 2; ///< Traffic modes. 0 = Write/Read, 1 = Write, 2 = Read, 3 = Reserved.
+ UINT8 : 6; ///< Reserved.
+ } Bits;
+ UINT8 Data;
+} TRAFFIC_MODES;
+
+typedef union {
+ struct {
+ UINT32 Count : 31; ///< Error count, range is 0 to 2^31 - 1.
+ UINT32 Overflow : 1; ///< Error count overflow, 0 = no overflow, 1 = overflow.
+ } Bits;
+ UINT32 Data;
+} ERROR_COUNT_32BITS;
+
+typedef struct {
+ UINT16 Ranks[MAX_CHANNEL]; ///< The bit mask of the ranks in a channel to test.
+ TRAFFIC_MODES TrafficModes[MAX_CHANNEL]; ///< Traffic modes. 0 = write/read, 1 = write only, 2 = read only, all other values reserved.
+ PATTERN_MODES Modes[MAX_CHANNEL]; ///< Pattern types. 0 = Fixed, 1 = LSFR.
+ UINT8 WdbIncRates[MAX_CHANNEL]; ///< WDB increment rates.
+ UINT8 WdbEnds[MAX_CHANNEL]; ///< WDB pattern stop.
+ UINT8 EnCadb[MAX_CHANNEL]; ///< Enable CADB.
+ UINT8 LoopCount; ///< Sequence repeat count.
+ UINT16 BurstLength; ///< Burst length.
+ UINT8 StopOnErr; ///< Stop on error.
+} POINT_TEST_PARAMETERS;
+
+typedef
+VOID
+(EFIAPI * WRITE_MEM) (
+ EFI_PEI_SERVICES **PeiServices,
+// SSA_BIOS_SERVICES_PPI *This,
+ VOID *This,
+ REG_WIDTH Width,
+ EFI_PHYSICAL_ADDRESS Address,
+ VOID *Buffer
+ );
+
+typedef
+VOID
+(EFIAPI * READ_MEM) (
+ EFI_PEI_SERVICES **PeiServices,
+// SSA_BIOS_SERVICES_PPI *This,
+ VOID *This,
+ REG_WIDTH Width,
+ EFI_PHYSICAL_ADDRESS Address,
+ VOID *Buffer
+ );
+
+typedef
+VOID
+(EFIAPI * WRITE_IO) (
+ EFI_PEI_SERVICES **PeiServices,
+// SSA_BIOS_SERVICES_PPI *This,
+ VOID *This,
+ REG_WIDTH Width,
+ UINT32 Address,
+ VOID *Buffer
+ );
+
+typedef
+VOID
+(EFIAPI * READ_IO) (
+ EFI_PEI_SERVICES **PeiServices,
+// SSA_BIOS_SERVICES_PPI *This,
+ VOID *This,
+ REG_WIDTH Width,
+ UINT32 Address,
+ VOID *Buffer
+ );
+
+typedef
+VOID
+(EFIAPI * WRITE_PCI) (
+ EFI_PEI_SERVICES **PeiServices,
+// SSA_BIOS_SERVICES_PPI *This,
+ VOID *This,
+ REG_WIDTH Width,
+ EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS *Address,
+ VOID *Buffer,
+ BOOLEAN CachedData
+ );
+
+typedef
+VOID
+(EFIAPI * READ_PCI) (
+ EFI_PEI_SERVICES **PeiServices,
+// SSA_BIOS_SERVICES_PPI *This,
+ VOID *This,
+ REG_WIDTH Width,
+ EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS *Address,
+ VOID *Buffer,
+ BOOLEAN CachedData
+ );
+
+typedef
+SSA_STATUS
+(EFIAPI * GET_BASE_ADDRESS) (
+ EFI_PEI_SERVICES **PeiServices,
+// SSA_BIOS_SERVICES_PPI *This,
+ VOID *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ UINT8 Index,
+ BASE_ADDR_TYPE BaseAddressType,
+ EFI_PHYSICAL_ADDRESS *BaseAddress
+ );
+
+typedef
+SSA_STATUS
+(EFIAPI * GET_MEM_VOLTAGE) (
+ EFI_PEI_SERVICES **PeiServices,
+// SSA_BIOS_SERVICES_PPI *This,
+ VOID *This,
+ UINT32 *Voltage
+ );
+
+typedef
+SSA_STATUS
+(EFIAPI * SET_MEM_VOLTAGE) (
+ EFI_PEI_SERVICES **PeiServices,
+// SSA_BIOS_SERVICES_PPI *This,
+ VOID *This,
+ UINT32 *Voltage
+ );
+
+typedef
+SSA_STATUS
+(EFIAPI * GET_MEM_TEMP) (
+ EFI_PEI_SERVICES **PeiServices,
+// SSA_BIOS_SERVICES_PPI *This,
+ VOID *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ UINT8 Channel,
+ UINT8 Dimm,
+ INT32 *Temperature
+ );
+
+typedef
+VOID
+(EFIAPI * RESTORE_MRS) (
+ EFI_PEI_SERVICES **PeiServices,
+// SSA_BIOS_SERVICES_PPI *This,
+ VOID *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ UINT8 Channel,
+ UINT8 Dimm,
+ UINT8 Rank,
+ UINT8 Address
+ );
+
+typedef
+VOID
+(EFIAPI * WRITE_MRS) (
+ EFI_PEI_SERVICES **PeiServices,
+// SSA_BIOS_SERVICES_PPI *This,
+ VOID *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ UINT8 Channel,
+ UINT8 Dimm,
+ UINT8 Rank,
+ UINT8 Bank,
+ UINT16 Data
+ );
+
+typedef
+VOID
+(EFIAPI * READ_MRS) (
+ EFI_PEI_SERVICES **PeiServices,
+// SSA_BIOS_SERVICES_PPI *This,
+ VOID *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ UINT8 Channel,
+ UINT8 Dimm,
+ UINT8 Rank,
+ UINT8 Address,
+ UINT16 *Data
+ );
+
+typedef
+VOID *
+(EFIAPI * MALLOC) (
+ EFI_PEI_SERVICES **PeiServices,
+// SSA_BIOS_SERVICES_PPI *This,
+ VOID *This,
+ UINT32 Size
+ );
+
+typedef
+VOID
+(EFIAPI * FREE) (
+ EFI_PEI_SERVICES **PeiServices,
+// SSA_BIOS_SERVICES_PPI *This,
+ VOID *This,
+ VOID *Buffer
+ );
+
+typedef
+VOID
+(EFIAPI * DEBUG_PRINT) (
+ EFI_PEI_SERVICES **PeiServices,
+// SSA_BIOS_SERVICES_PPI *This,
+ VOID *This,
+ PRINT_LEVEL PrintLevel,
+ UINT8 *FormatString,
+ ...
+ );
+
+typedef
+UINT8
+(EFIAPI * GET_DIMM_FROM_LOGICAL_RANK) (
+ EFI_PEI_SERVICES **PeiServices,
+// SSA_BIOS_SERVICES_PPI *This,
+ VOID *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ UINT8 Channel,
+ UINT8 Rank
+ );
+
+typedef
+SSA_STATUS
+(EFIAPI * GET_DIMM_INFO) (
+ EFI_PEI_SERVICES **PeiServices,
+// SSA_BIOS_SERVICES_PPI *This,
+ VOID *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ UINT8 Channel,
+ UINT8 Dimm,
+ MrcDimmInfo *DimmInfoBuffer
+ );
+
+typedef
+UINT8
+(EFIAPI * GET_RANK_IN_DIMM) (
+ EFI_PEI_SERVICES **PeiServices,
+// SSA_BIOS_SERVICES_PPI *This,
+ VOID *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ UINT8 Channel,
+ UINT8 Dimm
+ );
+
+typedef
+UINT8
+(EFIAPI * GET_LOGICAL_RANK_BIT_MASK) (
+ EFI_PEI_SERVICES **PeiServices,
+// SSA_BIOS_SERVICES_PPI *This,
+ VOID *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ UINT8 Channel
+ );
+
+typedef
+UINT8
+(EFIAPI * GET_CHANNEL_BIT_MASK) (
+ EFI_PEI_SERVICES **PeiServices,
+// SSA_BIOS_SERVICES_PPI *This,
+ VOID *This,
+ UINT8 Socket,
+ UINT8 Controller
+ );
+
+typedef
+SSA_STATUS
+(EFIAPI * GET_SYSTEM_INFO) (
+ EFI_PEI_SERVICES **PeiServices,
+// SSA_BIOS_SERVICES_PPI *This,
+ VOID *This,
+ MrcSystemInfo *SystemInfoBuffer
+ );
+
+
+typedef
+UINT8
+(EFIAPI * GET_CONTROLLER_BIT_MASK) (
+ EFI_PEI_SERVICES **PeiServices,
+// SSA_BIOS_SERVICES_PPI *This,
+ VOID *This,
+ UINT8 Socket
+ );
+
+typedef
+VOID
+(EFIAPI * JEDEC_RESET) (
+ EFI_PEI_SERVICES **PeiServices,
+// SSA_BIOS_SERVICES_PPI *This,
+ VOID *This,
+ UINT8 Socket,
+ UINT8 Controller
+ );
+
+typedef
+SSA_STATUS
+(EFIAPI * GET_MARGIN_PARAM_LIMITS) (
+ EFI_PEI_SERVICES **PeiServices,
+// SSA_BIOS_SERVICES_PPI *This,
+ VOID *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ UINT8 Channel,
+ UINT8 LogicRank,
+ GSM_LT IoLevel,
+ GSM_GT MarginGroup,
+ INT16 *MinOffset,
+ INT16 *MaxOffset,
+ UINT16 *Delay
+ );
+
+typedef
+VOID
+(EFIAPI * OFFSET_MARGIN_PARAM) (
+ EFI_PEI_SERVICES **PeiServices,
+// SSA_BIOS_SERVICES_PPI *This,
+ VOID *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ UINT8 Channel,
+ UINT8 LogicRank,
+ GSM_LT IoLevel,
+ GSM_GT MarginGroup,
+ UINT16 Offset
+ );
+
+typedef
+VOID
+(EFIAPI * SET_WDB_PATTERN) (
+ EFI_PEI_SERVICES **PeiServices,
+// SSA_BIOS_SERVICES_PPI *This,
+ VOID *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ UINT8 Channel,
+ UINT64 *Pattern,
+ UINT8 CachelineCount,
+ UINT8 StartCachelineIndex
+ );
+
+typedef
+VOID
+(EFIAPI * SET_CADB_PATTERN) (
+ EFI_PEI_SERVICES **PeiServices,
+// SSA_BIOS_SERVICES_PPI *This,
+ VOID *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ UINT8 Channel,
+ UINT64 *Pattern,
+ UINT8 CachelineCount,
+ UINT8 StartCachelineIndex
+ );
+
+typedef
+VOID
+(EFIAPI * CLEAR_ERROR_STATUS) (
+ EFI_PEI_SERVICES **PeiServices,
+// SSA_BIOS_SERVICES_PPI *This,
+ VOID *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ UINT8 ChannelMask
+ );
+
+typedef
+SSA_STATUS
+(EFIAPI * CLEAR_ERROR_COUNTER) (
+ EFI_PEI_SERVICES **PeiServices,
+// SSA_BIOS_SERVICES_PPI *This,
+ VOID *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ UINT8 Channel,
+ UINT8 Counter
+ );
+
+typedef
+UINT64
+(EFIAPI * GET_DQ_ERROR_STATUS) (
+ EFI_PEI_SERVICES **PeiServices,
+// SSA_BIOS_SERVICES_PPI *This,
+ VOID *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ UINT8 Channel
+ );
+
+typedef
+UINT8
+(EFIAPI * GET_ECC_ERROR_STATUS) (
+ EFI_PEI_SERVICES **PeiServices,
+// SSA_BIOS_SERVICES_PPI *This,
+ VOID *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ UINT8 Channel
+ );
+
+typedef
+SSA_STATUS
+(EFIAPI * SET_ERROR_COUNTER_MODE) (
+ EFI_PEI_SERVICES **PeiServices,
+// SSA_BIOS_SERVICES_PPI *This,
+ VOID *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ UINT8 Channel,
+ UINT8 Counter,
+ COUNTER_MODE CounterMode,
+ UINT32 ModeIndex
+ );
+
+typedef
+ERROR_COUNT_32BITS
+(EFIAPI * GET_ERROR_COUNT) (
+ EFI_PEI_SERVICES **PeiServices,
+// SSA_BIOS_SERVICES_PPI *This,
+ VOID *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ UINT8 Channel,
+ UINT8 Counter
+ );
+
+typedef
+VOID
+(EFIAPI * SET_VALIDATION_BIT_MASK) (
+ EFI_PEI_SERVICES **PeiServices,
+// SSA_BIOS_SERVICES_PPI *This,
+ VOID *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ UINT8 Channel,
+ UINT64 DqMask,
+ UINT8 EccMask
+ );
+
+typedef
+VOID
+(EFIAPI * SET_VALIDATION_PHASE_MASK) (
+ EFI_PEI_SERVICES **PeiServices,
+// SSA_BIOS_SERVICES_PPI *This,
+ VOID *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ UINT8 Channel,
+ UINT8 CachelineMask,
+ UINT8 PhaseMask
+ );
+
+typedef
+VOID
+(EFIAPI * RUN_POINT_TEST) (
+ EFI_PEI_SERVICES **PeiServices,
+// SSA_BIOS_SERVICES_PPI *This,
+ VOID *This,
+ UINT8 Socket,
+ UINT8 Controller,
+ VOID *TestParameters,
+ BOOLEAN SkipSetup
+ );
+
+//
+// SSA BIOS Common Configuration
+//
+typedef struct _SSA_COMMON_CONFIG {
+ UINT32 Revision; ///< Incremented when a backwards compatible binary change is made to the PPI.
+ VOID *BiosData; ///< Pointer to the BIOS data buffer.
+ READ_MEM ReadMem; ///< Reads a variable-sized value from a memory mapped register using an absolute address. This function takes advantage of any caching implemented by BIOS.
+ WRITE_MEM WriteMem; ///< Writes a variable-sized value to a memory mapped register using an absolute address. This function takes advantage of any caching implemented by BIOS.
+ READ_IO ReadIo; ///< Reads a variable-sized value from IO. This function takes advantage of any caching implemented by BIOS.
+ WRITE_IO WriteIo; ///< Writes a variable-sized value to IO.
+ READ_PCI ReadPci; ///< Reads a variable-sized value from a PCI config space register. This function takes advantage of any caching implemented by BIOS.
+ WRITE_PCI WritePci; ///< Writes a variable-sized value to a PCI config space register. This function takes advantage of any caching implemented by BIOS.
+ GET_BASE_ADDRESS GetBaseAddress; ///< Gets a base address to be used in the different memory map or IO register access functions.
+ MALLOC Malloc; ///< Function used to dynamically allocate memory.
+ FREE Free; ///< Function used to release memory allocated using Malloc.
+ DEBUG_PRINT DebugPrint; ///< Function used to output debug messages to the output logging device.
+} SSA_COMMON_CONFIG;
+
+//
+// SSA BIOS Memory Configuration
+//
+typedef struct _SSA_MEMORY_CONFIG {
+ UINT32 Revision; ///< Incremented when a backwards compatible binary change is made to the PPI.
+ VOID *MrcData; ///< Pointer to the BIOS data buffer.
+ GET_SYSTEM_INFO GetSystemInfo; ///< Returns system information.
+ GET_MEM_VOLTAGE GetMemVoltage; ///< Returns the platform's memory voltage.
+ SET_MEM_VOLTAGE SetMemVoltage; ///< Sets the platform's memory voltage.
+ GET_MEM_TEMP GetMemTemp; ///< Returns the DIMM's temperature.
+ RESTORE_MRS RestoreMrs; ///< Restore BIOS default DRAM mode register value.
+ WRITE_MRS WriteMrs; ///< Writes DRAM mode register.
+ READ_MRS ReadMrs; ///< Reads DRAM mode register.
+ GET_DIMM_FROM_LOGICAL_RANK GetDimmFromLogicalRank; ///< Return the DIMM number according to the logical rank number.
+ GET_DIMM_INFO GetDimmInfo; ///< Returns DIMM information.
+ GET_RANK_IN_DIMM GetRankInDimm; ///< Return the number of ranks in a specific DIMM on a given controller.
+ GET_LOGICAL_RANK_BIT_MASK GetLogicalRankBitMask; ///< Return the logical rank bit mask of the channel.
+ GET_CHANNEL_BIT_MASK GetChannelBitMask; ///< Return the channel bit mask of the populated channels.
+ GET_CONTROLLER_BIT_MASK GetControllerBitMask; ///< Returns bitmask of available controllers on a given socket.
+ JEDEC_RESET JedecReset; ///< Function used to reset a DIMM.
+ GET_MARGIN_PARAM_LIMITS GetMarginParamLimits; ///< Function returns the low side, high side range and required delay of a margin parameter.
+ OFFSET_MARGIN_PARAM OffsetMarginParam; ///< Function used to adjust a margin parameter.
+ SET_WDB_PATTERN SetWdbPattern; ///< Function used to set up WDB pattern.
+ SET_CADB_PATTERN SetCadbPattern; ///< Function used to set up CADB pattern.
+ CLEAR_ERROR_STATUS ClearErrorStatus; ///< Function used to clear the lane error status registers.
+ CLEAR_ERROR_COUNTER ClearErrorCounter; ///< Function used to clear the error counter register.
+ GET_DQ_ERROR_STATUS GetDqErrorStatus; ///< Function used to get the DQ lane error status.
+ GET_ECC_ERROR_STATUS GetEccErrorStatus; ///< Function used to get the ECC lane error status.
+ SET_ERROR_COUNTER_MODE SetErrorCounterMode; ///< Function used to clear the error counter register.
+ GET_ERROR_COUNT GetErrorCount; ///< Function used to get the error count value for a give channel and counter on a given controller.
+ SET_VALIDATION_BIT_MASK SetValidationBitMask; ///< Function used to set the lane validation mask for a give channel on a given controller. Only the lanes with the mask bit set will be checked for errors.
+ SET_VALIDATION_PHASE_MASK SetValidationPhaseMask; ///< Function used to set the phase mask for a give channel on a given controller. Only the phases with the mask bit set will be checked for errors.
+ RUN_POINT_TEST RunPointTest; ///< Function used to run a point test.
+} SSA_MEMORY_CONFIG;
+
+///
+/// SSA BIOS Services Header
+///
+typedef struct _SSA_BIOS_HEADER {
+ UINT32 Revision; ///< Incremented when a backwards compatible binary change is made to the PPI.
+ SSA_COMMON_CONFIG *SsaCommonConfig; ///< Pointer to the SSA BIOS common functions.
+ SSA_MEMORY_CONFIG *SsaMemoryConfig; ///< Pointer to the SSA BIOS memory related functions.
+} SSA_BIOS_HEADER;
+
+///
+/// SSA BIOS Services PPI
+///
+typedef struct _SSA_BIOS_SERVICES_PPI {
+ SSA_BIOS_HEADER SsaHeader; ///< SSA BIOS Services Header.
+ SSA_COMMON_CONFIG SsaCommonConfig; ///< SSA BIOS common functions.
+ SSA_MEMORY_CONFIG SsaMemoryConfig; ///< SSA BIOS memory related functions.
+} SSA_BIOS_SERVICES_PPI;
+
+#pragma pack (pop)
+#endif // _MrcSsaServices_h_
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/AddrDecode/MrcHswMcAddrDecode.c b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/AddrDecode/MrcHswMcAddrDecode.c
new file mode 100644
index 0000000..57e87fb
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/AddrDecode/MrcHswMcAddrDecode.c
@@ -0,0 +1,1326 @@
+/**
+This file contains an 'Intel Peripheral Driver' and uniquely
+identified as "Intel Reference Module" and is
+licensed for Intel CPUs and chipsets under the terms of your
+license agreement with Intel or your vendor. This file may
+be modified by the user, subject to additional terms of the
+license agreement.
+
+Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved.
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+@file:
+ MrcHswMcAddrDecode.c
+
+@brief:
+ File to support address decoding and encoding
+
+**/
+/*
+
+This file defines functions that perform address decoding, reverse address
+decoding, configuration checking, and configuration printing:
+
+ hswult_mc_addr_decode_config_check() - Checks the values in the registers used
+ for DRAM address decoding for illegal or inconsistent programming.
+ It would be wise to call this function once before using the other
+ functions. Once the configuration/register-programming passes the check,
+ the decode and/or encode functions may be called multiple times.
+
+ hswult_mc_addr_decode() - Decodes system addresses into DRAM addresses and is
+ equivalent to the address decoding performed inside the memory
+ controller.
+
+ hswult_mc_addr_encode() - Performs the reverse of hswult_mc_addr_decode().
+ Translates a DRAM address into a system address.
+
+ hswult_mc_addr_decode_config_info() - Prints to a sring information about the
+ configuration that can be determined from the registers involved in
+ address decoding.
+
+"System address" refers to the 39-bit address presented to the memory controller
+at the memory controller's interface to the IMPH.
+
+"DRAM address" refers to the physical memory location inside the DDR3 memory
+hierarchy:
+-Channel
+ |
+ +-DIMM
+ |
+ +-Rank
+ |
+ +-Bank
+ |
+ +-Row
+ |
+ +-Column
+
+This code was authored with the intention that it comply with the C99 spec.
+This file should be compiled with the -std=c99 command line option if GCC is
+used to compile.
+The checking, decoding, and encoding functions return the bool "false" if they
+fail and return the bool "true" if they succeed. They also print an error
+message explaining the failure to a string for which memory must be allocated
+before calling the function.
+
+A reminder about the bit-widths of data types guaranteed by the C99 spec:
+ - unsigned long long - must be at least 64-bits
+ - unsigned long - must be at least 32-bits
+ - unsigned - must be at least 16-bits, but is often 32.
+ The size will be the "natural" size for the platform
+ architecture.
+
+A reminder about literals:
+ literals are sometimes assumed to be the "natural" size for the platform
+ architecture:
+
+ unsigned long long x = (0x1 << 63);
+
+ result is x = 0, not 0x8000000000000000.
+
+ Solution:
+
+ unsigned long long x = (((unsigned long long) 0x1) << 63);
+
+ Also note that literals that are not the "natural size" must be typed
+ with trailing letters. For example, 0x8000000000000000 must be specified as
+ 0x8000000000000000ULL (note the "ULL" at the end for "unsigned long long").
+
+*/
+
+
+
+#include "MrcHswMcAddrDecode.h"
+
+// size of the hash mask field in the channel hash register
+#define HSW_MC_ADDR_CHANNEL_HASH_MASK_SIZE 14
+
+//
+// Bit-Masks used to remove or test register fields
+//
+#define HSW_MC_ADDR_TOLUD_MASK 0xFFF00000
+#define HSW_MC_ADDR_REMAP_MASK 0x0000007FFFF00000ULL
+#define HSW_MC_ADDR_CHAN_HASH_ENABLE_MASK 0x00800000
+
+// Mask used to add 1's to lower bits of REMAP_LIMIT register
+#define HSW_MC_ADDR_REMAP_LIMIT_LOWER_BITS_MASK 0x00000000000FFFFFULL
+
+// Useful number constants
+#define HSW_MC_256MB_AS_CL (1 << 22)
+#define HSW_MC_512MB_AS_CL (1 << 23)
+#define HSW_MC_1GB_AS_CL (1 << 24)
+#define HSW_MC_2GB_AS_CL (1 << 25)
+#define HSW_MC_4GB_AS_CL (1 << 26)
+#define HSW_MC_8GB_AS_CL (1 << 27)
+
+
+// global variable to control debug messages printed to standard out.
+BOOL g_hswult_mc_addr_debug_messages = FALSE;
+
+//
+// Functions to extract fields from the registers
+//
+
+static inline U64
+get_onec_as_cl (
+ U32 MAD_ZR
+ )
+{
+ return MrcOemMemoryLeftShiftU64 ((((U64) MAD_ZR) & 0x000000FFULL), 22); // [ 7: 0]=8-bits
+}
+
+static inline U64
+get_threec_as_cl (
+ U32 MAD_ZR
+ )
+{
+ return MrcOemMemoryLeftShiftU64 ((((U64) MAD_ZR) & 0x0000FF00ULL), 14); // [15: 8]=8-bits
+}
+
+static inline U64
+get_twobandc_as_cl (
+ U32 MAD_ZR
+ )
+{
+ return MrcOemMemoryLeftShiftU64 ((((U64) MAD_ZR) & 0x00FF0000ULL), 6); // [23:16]=8-bits
+}
+
+static inline U64
+get_bandc_as_cl (
+ U32 MAD_ZR
+ )
+{
+ return MrcOemMemoryRightShiftU64 ((((U64) MAD_ZR) & 0xFF000000ULL), 2); // [31:24]=8-bits
+}
+
+static inline U64
+get_dimm_a_size_as_cl (
+ U32 MAD_DIMM
+ )
+{
+ return MrcOemMemoryLeftShiftU64 ((((U64) MAD_DIMM) & 0x00FFULL), 22); // MAD_DIMM[ 7:0]*256MB >>6
+}
+
+static inline U64
+get_dimm_b_size_as_cl (
+ U32 MAD_DIMM
+ )
+{
+ return MrcOemMemoryLeftShiftU64 ((((U64) MAD_DIMM) & 0xFF00ULL), 14); // MAD_DIMM[15:8]*256MB >>6
+}
+
+static inline BOOL
+get_dimm_a_number_of_ranks (
+ U32 MAD_DIMM
+ )
+{
+ return (BOOL) ((MAD_DIMM >> 17) & 1); // TRUE = 2-ranks, FALSE = 1-rank
+}
+
+static inline BOOL
+get_dimm_b_number_of_ranks (
+ U32 MAD_DIMM
+ )
+{
+ return (BOOL) ((MAD_DIMM >> 18) & 1); // TRUE = 2-ranks, FALSE = 1-rank
+}
+
+static inline U64
+get_dimm_a_rank_size_as_cl (
+ U32 MAD_DIMM
+ )
+{
+ return MrcOemMemoryRightShiftU64 (get_dimm_a_size_as_cl(MAD_DIMM), ((U8) get_dimm_a_number_of_ranks(MAD_DIMM)));
+}
+
+static inline U64
+get_dimm_b_rank_size_as_cl (
+ U32 MAD_DIMM
+ )
+{
+ return MrcOemMemoryRightShiftU64 (get_dimm_b_size_as_cl(MAD_DIMM), ((U8) get_dimm_b_number_of_ranks(MAD_DIMM)));
+}
+
+static inline BOOL
+get_dimm_and_rank_intlv (
+ U32 MAD_DIMM
+ )
+{
+ return (BOOL) ((MAD_DIMM >> 21) & 1); // MAD_DIMM[21:21]
+}
+
+static inline BOOL
+get_high_order_intlv_mode (
+ U32 MAD_DIMM
+ )
+{
+ return (BOOL) ((MAD_DIMM >> 26) & 1); // MAD_DIMM[26:26]
+}
+
+static inline U16
+get_hori_addr (
+ U32 MAD_DIMM
+ )
+{
+ return (U16) ((MAD_DIMM >> 27) & 7); // MAD_DIMM[29:27]
+}
+
+static inline BOOL
+get_enhanced_intlv_mode (
+ U32 MAD_DIMM
+ )
+{
+ return (BOOL) ((MAD_DIMM >> 22) & 1); // MAD_DIMM[22:22]
+}
+
+static inline U16
+get_dimm_a_select (
+ U32 MAD_DIMM
+ )
+{
+ return (U16) ((MAD_DIMM >> 16) & 1);
+}
+
+static inline BOOL
+get_lpddr_mode (
+ U32 MAD_CHNL
+ )
+{
+ return (BOOL) (MAD_CHNL >> 10) & 1;
+}
+
+static inline U16
+get_dimm_a_width (
+ U32 MAD_CHNL,
+ U32 MAD_DIMM
+ )
+{
+ BOOL is_x16 = (BOOL) ((MAD_DIMM >> 19) & 1);
+ return is_x16 ? 16 : (get_lpddr_mode(MAD_CHNL) ? 32 : 8);
+}
+
+static inline U16
+get_dimm_b_width (
+ U32 MAD_CHNL,
+ U32 MAD_DIMM
+ )
+{
+ BOOL is_x16 = (BOOL) ((MAD_DIMM >> 20) & 1);
+ return is_x16 ? 16 : (get_lpddr_mode(MAD_CHNL) ? 32 : 8);
+}
+
+static inline U16
+get_dimm_a_num_col_bits (
+ U32 MAD_CHNL,
+ U32 MAD_DIMM
+ )
+{
+ U16 width;
+ U64 dimm_rank_size_as_cl;
+
+ if (!get_lpddr_mode(MAD_CHNL)) {
+ return 10; // Supported DDR3 DRAM organizations all have 10 column bits
+ }
+
+ // If we got past the above line, we are LPDDR
+
+ width = get_dimm_a_width(MAD_CHNL, MAD_DIMM);
+ dimm_rank_size_as_cl = get_dimm_a_rank_size_as_cl(MAD_DIMM);
+ if (width == 16) {
+ return (dimm_rank_size_as_cl == HSW_MC_1GB_AS_CL) ? 10 : 11; // LPDDR x16 2Gb device has 10 col bits,
+ // the 4 and 8 Gb LPDDR x16s have 11 col bits.
+ }
+ // width == 32
+ return (dimm_rank_size_as_cl == HSW_MC_512MB_AS_CL) ? 9 : 10; // LPDDR x32 2Gb device has 9 col bits,
+ // the 4 and 8 Gb LPDDR x32s have 10 col bits.
+}
+
+static inline U16
+get_dimm_b_num_col_bits (
+ U32 MAD_CHNL,
+ U32 MAD_DIMM
+ )
+{
+ U16 width;
+ U64 dimm_rank_size_as_cl;
+
+ if (!get_lpddr_mode(MAD_CHNL)) {
+ return 10; // Supported DDR3 DRAM organizations all have 10 column bits
+ }
+
+ // If we got past the above line, we are LPDDR
+
+ width = get_dimm_b_width(MAD_CHNL, MAD_DIMM);
+ dimm_rank_size_as_cl = get_dimm_b_rank_size_as_cl(MAD_DIMM);
+ if (width == 16) {
+ return (dimm_rank_size_as_cl == HSW_MC_1GB_AS_CL) ? 10 : 11; // LPDDR x16 2Gb device has 10 col bits,
+ // the 4 and 8 Gb LPDDR x16s have 11 col bits.
+ }
+ // width == 32
+ return (dimm_rank_size_as_cl == HSW_MC_512MB_AS_CL) ? 9 : 10; // LPDDR x32 2Gb device has 9 col bits,
+ // the 4 and 8 Gb LPDDR x32s have 10 col bits.
+}
+
+static inline U16
+get_ch_hash_lsb_mask_bit (
+ U32 CHANNEL_HASH
+ )
+{
+ return (CHANNEL_HASH >> 21) & 3;
+}
+
+static inline U16
+get_ch_hash_mask (
+ U32 CHANNEL_HASH
+ )
+{
+ return CHANNEL_HASH & 0x03FFF;
+}
+
+static inline BOOL
+get_stacked_mode (
+ U32 MAD_CHNL
+ )
+{
+ return (BOOL) ((MAD_CHNL >> 6) & 1);
+}
+
+static inline U16
+get_stacked_encoding (
+ U32 MAD_CHNL
+ )
+{
+ return (U16) (MAD_CHNL >> 7) & 7;
+}
+
+//
+// Functions to aid in common tasks
+//
+
+// convert a cache-line address to a system address
+static inline U64
+cl_to_sys (
+ U64 cache_line
+ )
+{
+ return MrcOemMemoryLeftShiftU64 (cache_line, 6);
+}
+
+// Channel conversion functions. For logical channels: 0=A, 1=B.
+static inline U16
+logical_to_physical_chan (
+ U32 MAD_CHNL,
+ U16 logical_chan
+ )
+{
+ return ((U16) ((MAD_CHNL >> (logical_chan << 1)) & 0x3));
+}
+
+static inline U16
+physical_to_logical_chan (
+ U32 MAD_CHNL,
+ U16 physical_chan
+ )
+{
+ return ((((U16) (MAD_CHNL & 3)) == physical_chan) ? 0 : 1); // 0=A, 1=B
+}
+
+// Function for decode of stacked channel debug feature
+static inline U64
+get_stacked_memory_size (
+ U16 stacked_encoding
+ )
+{
+ return MrcOemMemoryLeftShiftU64 (0x00400000ULL, (U8) stacked_encoding); // 1 << 28 + stacked_encoding - 6 for the cachline align
+}
+
+
+/**
+@brief
+ Address decode function
+ Converts system address to DRAM address
+
+ @param[in] sys_addr - the 39-bit system address to convert
+ @param[in, out] p_is_tcm - is the transaction to sys_addr "traffic class for the manageability engine"
+ @param[in] TOLUD - memory register
+ @param[in] REMAP_BASE - memory register
+ @param[in] REMAP_LIMIT - memory register
+ @param[in] CHANNEL_HASH - memory register
+ @param[in] MAD_ZR - memory register
+ @param[in] MAD_CHNL - memory register
+ @param[in] MAD_DIMM_ch0 - memory register
+ @param[in] MAD_DIMM_ch1 - memory register
+ @param[in] MAD_DIMM_ch2 - memory register
+ @param[out] p_chan - channel sys_addr decodes to
+ @param[out] p_dimm - DIMM sys_addr decodes to
+ @param[out] p_rank - rank sys_addr decodes to
+ @param[out] p_bank - bank sys_addr decodes to
+ @param[out] p_row - row sys_addr decodes to
+ @param[out] p_col - column sys_addr decodes to.
+
+ @retval True if successful.
+
+**/
+BOOL
+MrcHswDecode (
+ IN U64 sys_addr,
+ IN OUT BOOL *p_is_tcm,
+ IN U32 TOLUD,
+ IN U64 REMAP_BASE,
+ IN U64 REMAP_LIMIT,
+ IN U32 CHANNEL_HASH,
+ IN U32 MAD_ZR,
+ IN U32 MAD_CHNL,
+ IN U32 MAD_DIMM_ch0,
+ IN U32 MAD_DIMM_ch1,
+ IN U32 MAD_DIMM_ch2,
+ OUT U16 *p_chan,
+ OUT U16 *p_dimm,
+ OUT U16 *p_rank,
+ OUT U16 *p_bank,
+ OUT U16 *p_row,
+ OUT U16 *p_col
+ )
+{
+ // used to hold the address after the remap zone has been applied to the system address
+ U64 remap_addr; // full address
+ U64 remap_line; // cache-line address
+ // used to hold fields from MAD_ZR, adjusted to cache-line address
+ U64 onec; // 1 * C
+ U64 threec; // 3 * C - top of Zone 0
+ U64 twobandc; // (2 * B) + C - top of Zone 1
+ U64 bandc; // (B + C)
+ // Make a MAD_DIMM array for easy access
+ U32 MAD_DIMM[3];
+ U32 chan_a_mad_dimm; // channel A's MAD_DIMM register
+ U64 gap_limit; // MMIO Gap Limit
+ U64 tom; // Top Of Memory (cache-line address)
+ U16 lsb_mask_bit; // LsbMaskBit field from CHANNEL_HASH register
+ U16 hash_mask; // channel hash mask from CHANNEL_HASH register
+ U16 hash_line; // lower bits of remap_line with hash_mask applied
+ U16 i; // loop counter
+ U64 chan_line; // channel address space (cache-line)
+ U16 chan_select; // 0 = Channel A, 1 = Channel B
+ U32 selected_mad_dimm; // MAD_DIMM for the selected channel
+ BOOL is_lpddr = get_lpddr_mode(MAD_CHNL); // LPDDR or DDR3
+ U16 num_col_bits; // The number of column address bits the DIMM has.
+ U64 dimm_a_size; // sizes of the DIMMs on the channel in cache-lines
+ U64 dimm_b_size;
+ BOOL dimm_and_rank_interleaving; // modes for the selected channel
+ BOOL high_order_rank_interleave;
+ BOOL enhanced_interleave_mode;
+ U16 hori_addr; // bits to use from address for HORI
+ U64 dimm_line; // DIMM address space (cache-line)
+ U16 dimm_select; // 0 = DIMM A, 1 = DIMM B
+ U32 dimm_size; // size of selected DIMM (cache-lines)
+ BOOL dual_rank; // number of ranks on selected DIMM
+ // channel stacking variables
+ BOOL stacked_mode;
+ U64 stacked_size;
+ // temporary values for bit masking and shifting
+ U64 row_mask;
+ U16 rank_bit_shift;
+
+ MAD_DIMM[0] = MAD_DIMM_ch0;
+ MAD_DIMM[1] = MAD_DIMM_ch1;
+ MAD_DIMM[2] = MAD_DIMM_ch2;
+
+ // zero out unused register bits
+ TOLUD &= HSW_MC_ADDR_TOLUD_MASK;
+ REMAP_BASE &= HSW_MC_ADDR_REMAP_MASK;
+ REMAP_LIMIT &= HSW_MC_ADDR_REMAP_MASK;
+
+ // Assume lower bits of REMAP_LIMIT are all 1's.
+ REMAP_LIMIT |= HSW_MC_ADDR_REMAP_LIMIT_LOWER_BITS_MASK;
+
+ //
+ // Register field values are in 256MB granularity.
+ // They are stored here adjusted to cache-line granularity.
+ //
+ onec = get_onec_as_cl (MAD_ZR);
+ threec = get_threec_as_cl (MAD_ZR);
+ twobandc = get_twobandc_as_cl (MAD_ZR);
+ bandc = get_bandc_as_cl (MAD_ZR);
+
+ //
+ // TOM is not directly available in a register. It will be computed by
+ // finding the channel index of channel A, then adding the two DIMM
+ // capacities of that channel together. Technically, this is only needed to
+ // check that the system address is not beyond the amount of memory
+ // available.
+ //
+
+ // Overflow check MAD_DIMM
+ if ((MAD_CHNL & 0x3) > 2) {
+ return FALSE;
+ }
+ chan_a_mad_dimm = MAD_DIMM[MAD_CHNL & 0x3];
+ tom = get_dimm_a_size_as_cl(chan_a_mad_dimm);
+ tom += get_dimm_b_size_as_cl(chan_a_mad_dimm);
+ tom += bandc;
+
+ // remap the address if it is not a TCM transaction and falls inside the remap range
+ remap_addr = sys_addr;
+ if (REMAP_LIMIT > REMAP_BASE) { // check for remap region being enabled
+ gap_limit = ((U64) TOLUD) + REMAP_LIMIT - REMAP_BASE;
+ //
+ // check for address falling in remap region
+ //
+ if ((sys_addr >= REMAP_BASE) && (sys_addr <= REMAP_LIMIT)) { // REMAP_LIMIT is now inclusive
+ if (*p_is_tcm) {
+ if (sys_addr >= cl_to_sys(tom)) {
+ // transaction to sys_addr should not have been TCM.
+ *p_is_tcm = FALSE;
+ return FALSE;
+ }
+ } else {
+ //
+ // The address hit the remap region, so remap the address from the remap
+ // source region (REMAP_BASE to REMAP_LIMIT) to the remap target region
+ // (TOLUD to size-of-gap).
+ //
+ remap_addr -= REMAP_BASE;
+ remap_addr += ((U64) TOLUD);
+ }
+ } else if ((sys_addr >= ((U64) TOLUD)) &&
+ (sys_addr <= gap_limit )) { // check for address falling in MMIO gap created by remap region
+ // transaction to sys_addr should not have been TCM.
+ *p_is_tcm = FALSE;
+ return FALSE;
+ } else {
+ //
+ // transaction to sys_addr should not have been TCM, but the memory
+ // controller will process the request anyway without any problems.
+ //
+ *p_is_tcm = FALSE;
+ }
+ } else {
+ // transaction to sys_addr should not have been TCM, but the memory
+ // controller will process the request anyway without any problems.
+ //
+ *p_is_tcm = FALSE;
+ }
+
+
+ // from now on we will work on cache-line addresses
+ remap_line = MrcOemMemoryRightShiftU64 (remap_addr, 6); // shift off intra-cache-line bits
+
+
+ stacked_mode = get_stacked_mode (MAD_CHNL);
+
+ if (stacked_mode) {
+ //
+ // In stacked mode, check that remapped address is below TOM.
+ //
+ if (remap_line >= tom) {
+ return FALSE;
+ }
+
+ stacked_size = get_stacked_memory_size (get_stacked_encoding(MAD_CHNL));
+
+ chan_select = (remap_line < stacked_size) ? 0 : 1;
+
+ chan_line = remap_line;
+
+
+ chan_select = (remap_line < stacked_size) ? 0 : 1;
+ chan_line = remap_line;
+
+ // If this is channel 1 in stacked mode, then we need to subtract out the channel size (clear
+ // the stacked mode bit)
+ //
+ if (chan_select == 1) {
+ chan_line = chan_line - stacked_size;
+ }
+ } else if (remap_line < threec) { // Zone 0
+ return FALSE;
+ } else if (remap_line < twobandc) { // Zone 1
+ // Determine if the channel hash feature is being used
+ if (CHANNEL_HASH & HSW_MC_ADDR_CHAN_HASH_ENABLE_MASK) { // test enable bit
+ lsb_mask_bit = get_ch_hash_lsb_mask_bit (CHANNEL_HASH);
+ hash_mask = get_ch_hash_mask (CHANNEL_HASH);
+ hash_mask = hash_mask | (1 << lsb_mask_bit); // force the selected lsb_mask_bit to be on
+
+ hash_line = ((U16) remap_line) & hash_mask; // get the bits to XOR for the hash
+ //
+ // Produce chan_select by XORing together all of the bits of hash_line.
+ //
+ // I don't know of a single instruction to do this, so an unrollable
+ // loop will be used.
+ //
+ chan_select = 0;
+ for (i = 0 ; i < HSW_MC_ADDR_CHANNEL_HASH_MASK_SIZE ; i++) {
+ chan_select = chan_select ^ (hash_line >> i);
+ }
+ chan_select = chan_select & 1;
+ //
+ // sys_addr 6 will be shifted off to produce the channel address, so it must
+ // be preserved if it wasn't used in the hash. This is done by moving it to
+ // the position indicated by lsb_mask_bit.
+ //
+ remap_line = remap_line & (~MrcOemMemoryLeftShiftU64 (0x0000000000000001ULL, (U8) lsb_mask_bit)); // zero out lsb_mask_bit
+ remap_line = remap_line | MrcOemMemoryLeftShiftU64 ((remap_line & 1), (U8) lsb_mask_bit); // OR in bit 6 to lsb_mask_bit position
+ } else {
+ chan_select = (U16) (remap_line & 1); // remap_addr[6:6]
+ }
+ chan_line = MrcOemMemoryRightShiftU64 ((remap_line - onec), 1); // right shift by 1 divides by 2
+ } else if (remap_line < tom) { // Zone 2
+ chan_select = 0; // Channel A
+ chan_line = remap_line - bandc;
+ } else { // address was above memory capacity
+ return FALSE;
+ }
+
+ // obtain the physical channel index
+ *p_chan = logical_to_physical_chan (MAD_CHNL, chan_select);
+
+ // Overflow check *p_chan
+ if (*p_chan > 2) {
+ return FALSE;
+ }
+
+ // get the register for the channel we're using
+ selected_mad_dimm = MAD_DIMM[*p_chan];
+
+ // Find the DIMM sizes on our selected channel. adjust to cache-line granularity
+ dimm_a_size = get_dimm_a_size_as_cl (selected_mad_dimm);
+ dimm_b_size = get_dimm_b_size_as_cl (selected_mad_dimm);
+
+ // determine if we are doing DIMM and Rank interleaving
+ dimm_and_rank_interleaving = get_dimm_and_rank_intlv (selected_mad_dimm);
+
+ // determine if we are doing high order rank interleave
+ high_order_rank_interleave = get_high_order_intlv_mode (selected_mad_dimm);
+
+ // determine if we are doing Enhanced Interleave Mode (EIM) (XOR rank & bank bits)
+ enhanced_interleave_mode = get_enhanced_intlv_mode (selected_mad_dimm);
+
+ // DIMM address calculation
+
+ // DIMMs are interleaved for both dimm_and_rank_interleaving and high_order_rank_interleave modes.
+ if (dimm_and_rank_interleaving || high_order_rank_interleave) {
+ if (chan_line < MrcOemMemoryLeftShiftU64 (dimm_b_size, 1)) { // Range 0 limit = 2 * dimm_b_size
+ // 2-way DIMM interleave. Channel address [15:15] is used to select DIMM
+ dimm_select = (U16) (MrcOemMemoryRightShiftU64 (chan_line, 9) & 1);
+
+ // DIMM address is channel address with the interleave bit (15) removed
+ dimm_line = (MrcOemMemoryRightShiftU64 (chan_line, 1) & (~((U64) 0x01FFULL))) |
+ (chan_line & ((U64) 0x01FFULL));
+ } else if (chan_line < (dimm_a_size + dimm_b_size)) { // Range 1 limit
+ // No DIMM interleave. DIMM is the largest DIMM: DIMM A.
+ dimm_select = 0;
+
+ // DIMM address is channel address with DIMM B's contribution removed
+ dimm_line = chan_line - dimm_b_size;
+ } else {
+ return FALSE;
+ }
+ } else { // no DIMM and Rank interleaving
+ dimm_line = chan_line;
+ if (chan_line < dimm_a_size) { // Range 0 limit = dimm_a_size
+ // No DIMM interleave. DIMM is the largest DIMM: DIMM A.
+ dimm_select = 0;
+
+ // DIMM address is channel address
+ } else if (chan_line < (dimm_a_size + dimm_b_size)) { // Range 1 limit
+ // No DIMM interleave. DIMM is the smallest DIMM: DIMM B.
+ dimm_select = 1;
+
+ // DIMM address is channel address with dimm_a_size removed.
+ dimm_line -= dimm_a_size;
+ } else {
+ return FALSE;
+ }
+ }
+
+ // get the physical DIMM index
+ *p_dimm = dimm_select ^ get_dimm_a_select (selected_mad_dimm);
+
+ // get DIMM info
+ dimm_size = (U32) (dimm_select ? dimm_b_size : dimm_a_size);
+ dual_rank = dimm_select ? get_dimm_b_number_of_ranks (selected_mad_dimm):
+ get_dimm_a_number_of_ranks (selected_mad_dimm);
+
+ num_col_bits = dimm_select ? get_dimm_b_num_col_bits (MAD_CHNL, selected_mad_dimm) :
+ get_dimm_a_num_col_bits (MAD_CHNL, selected_mad_dimm);
+
+
+ // DRAM address calculation
+
+ //
+ // Grab the column first (because with HSW-ULT we will shift dimm_line up or
+ // down by 1 based on column size).
+ //
+ // column is DimmAddress[12:3] when 10 column bits are present. [13:3] and
+ // [11:3] for 11 and 9 column bits, respectively.
+ //
+ *p_col = (U16) MrcOemMemoryLeftShiftU64 (dimm_line, 3);
+
+ // The low-order intra-cache-line bits must be added back in.
+ *p_col = *p_col | ((U16) (MrcOemMemoryRightShiftU64 (sys_addr, 3) & 0x7ULL));
+
+ // We picked up extra high-order bits from dimm_line.
+ // Mask off the bits above the column range.
+ //
+ *p_col = *p_col & ((1 << num_col_bits) - 1);
+
+ // Now compute Rank, Bank, and Row
+
+ // The column address bits make up the bottom of the DIMM address space.
+ // With the addition of LPDDR to HSW-ULT, the number column address bits may
+ // change from the standard 10 with DDR3 to 9 or 11 with some of the LPDDR
+ // organizations. The entire DIMM address space can be shifted up or down
+ // with this change, then the bank, rank, and row bits can be extracted as
+ // with the standard 10 column bits.
+ //
+ if (num_col_bits == 9) {
+ dimm_line = MrcOemMemoryLeftShiftU64 (dimm_line, 1); // Shift up as though there were 10.
+ }
+
+ if (num_col_bits == 11) {
+ dimm_line = MrcOemMemoryRightShiftU64 (dimm_line, 1); // Shift down as though there were 10.
+ }
+
+ // high_order_rank_interleave is mutually exclusive with dimm_and_rank_interleaving
+ if (dual_rank && high_order_rank_interleave) {
+ //
+ // Specify which address bit 20-27 to use as the rank interleave bit
+ // 000 = bit 20, 001 = bit 21, ..., 111 = bit 27
+ //
+ hori_addr = get_hori_addr (selected_mad_dimm);
+
+ // Rank is selected by the HORI address field, which chooses a bit from DimmAddress[27:20]
+ *p_rank = (U16) (MrcOemMemoryRightShiftU64 (dimm_line, (U8) (hori_addr + 20 - 6)) & 1);
+
+ // Bank in HORI mode is just like no-rank-interleave
+
+ // bank = DimmAddress[15:13]
+ *p_bank = (U16) (MrcOemMemoryRightShiftU64 (dimm_line, 7) & 7);
+
+ if (enhanced_interleave_mode) {
+ // bank = DimmAddress[15:13] ^ DimmAddress[18:16]
+ *p_bank = *p_bank ^ ((U16) (MrcOemMemoryRightShiftU64 (dimm_line, 10) & 7));
+ }
+
+ // row[15:11] is always DimmAddress[32:28]
+ // row[3:0] is always DimmAddress[19:16]
+ // row[11:4] must make room for the rank bit, wherever hori_addr puts it.
+
+ // Get all row bits plus the rank bit somewhere in there.
+ *p_row = (U16) MrcOemMemoryRightShiftU64 (dimm_line, 10);
+
+ // Create a mask with 1's in the position of the row bits below the rank bit
+ row_mask = (1 << (hori_addr + 4)) - 1;
+
+ // Shift down the upper bits by one to remove the rank bit and recombine with the lower bits
+ *p_row = ((*p_row >> 1) & ((U16) (~row_mask))) | (*p_row & ((U16) row_mask));
+
+ // Mask away any row bits too large for the size of DIMM (only the number of row bits changes with DIMM size).
+ *p_row = *p_row & ((U16) ((dimm_size >> 10) - 1));
+ } else if (dual_rank && dimm_and_rank_interleaving) {
+ if (enhanced_interleave_mode) {
+ //
+ // rank = DimmAddress[15:15] XOR DimmAddress[19:19]
+ // bank = {DimmAddress[16:16],DimmAddress[14:13]} XOR
+ // {DimmAddress[20:20],DimmAddress[18:17]}
+ //
+ // We can just modify the bank rank bits in the dimm_line address.
+ // The rest of the bits will not be affected, neither will further
+ // operations involving dimm_line.
+ //
+ dimm_line = dimm_line ^ (MrcOemMemoryRightShiftU64 (dimm_line, 4) & 0x780ULL);
+ }
+
+ // rank = DimmAddress[15:15]
+ *p_rank = (U16) (MrcOemMemoryRightShiftU64 (dimm_line, 9) & 1);
+
+ // bank = {DimmAddress[16:16],DimmAddress[14:13]}
+ *p_bank = (U16) ((MrcOemMemoryRightShiftU64 (dimm_line, 8) & 4) | (MrcOemMemoryRightShiftU64 (dimm_line, 7) & 3));
+
+ // row = DimmAddress[32..28:17] depending on DIMM size.
+ *p_row = (U16) MrcOemMemoryRightShiftU64 (dimm_line, 11);
+
+ // Mask away any row bits too large for the size of DIMM (only the number of row bits changes with DIMM size).
+ *p_row = *p_row & ((U16) ((dimm_size >> 10) - 1));
+ } else { // single rank or no rank interleaving
+ // for single-rank DIMM, bits above row bits should all be zero
+ row_mask = 0xFFFFFFFFFFFFFC00ULL;
+
+ // rank = one of DimmAddress[32..28] depending on DIMM size, or 0 for single rank.
+ *p_rank = 0;
+ if (dual_rank) {
+ //
+ // When using 11 column bits the HSW ULT supports only 4Gb/8Gb x16 LPDDR devices.
+ // Meaning rank size can be 2GB/4GB, hence since we are in dual rank DIMM, DIMM size is 4GB/8GB.
+ // LPDDR only supports 14/15 row address bits, for 2GB/4GB ranks respectively.
+ // But, DDR3 calculation (always 10 col bits) 2GB/4GB ranks (4GB/8GB DIMMs) uses 15/16 row address bits respectively.
+ // So, we change dimm_size as if we calculate DDR3 to avoid getting 16 row bits and shifted rank position.
+ //
+ if (is_lpddr && (num_col_bits == 11)) {
+ switch( dimm_size ) { // remember: dimm_size is in cache-lines
+ case HSW_MC_4GB_AS_CL:
+ dimm_size = HSW_MC_2GB_AS_CL;
+ break;
+ case HSW_MC_8GB_AS_CL:
+ dimm_size = HSW_MC_4GB_AS_CL;
+ break;
+ default:
+ return FALSE;
+ }
+ }
+ //
+ // When using 9column bits the HSW ULT supports only 2Gb x32 LPDDR devices.
+ // Meaning rank size can be 512MGB, hence since we are in dual rank DIMM, DIMM size is 1GB.
+ // LPDDR only supports 14 row address bits, for 512MB ranks.
+ // But, DDR3 calculation (always 10 col bits) 512MB ranks (1GB DIMMs) uses 13 row address bits.
+ // So, we change dimm_size as if we calculate DDR3 to avoid getting 13 row bits and shifted rank position.
+ //
+ if (is_lpddr && (num_col_bits == 9)) {
+ switch( dimm_size ) { // remember: dimm_size is in cache-lines
+ case HSW_MC_1GB_AS_CL:
+ dimm_size = HSW_MC_2GB_AS_CL;
+ break;
+ default:
+ return FALSE;
+ }
+ }
+
+ switch( dimm_size ) // remember: dimm_size is in cache-lines
+ {
+ case HSW_MC_256MB_AS_CL:
+ return FALSE;
+ case HSW_MC_512MB_AS_CL:
+ rank_bit_shift = 22;
+ row_mask = 0x003FFC00ULL;
+ break;
+ case HSW_MC_1GB_AS_CL:
+ rank_bit_shift = 23;
+ row_mask = 0x007FFC00ULL;
+ break;
+ case HSW_MC_2GB_AS_CL:
+ rank_bit_shift = 24;
+ row_mask = 0x00FFFC00ULL;
+ break;
+ case HSW_MC_4GB_AS_CL:
+ rank_bit_shift = 25;
+ row_mask = 0x01FFFC00ULL;
+ break;
+ case HSW_MC_8GB_AS_CL:
+ rank_bit_shift = 26;
+ row_mask = 0x03FFFC00ULL;
+ break;
+ default:
+ return FALSE;
+ }
+ *p_rank = (U16) MrcOemMemoryRightShiftU64 (dimm_line, (U8) rank_bit_shift) & 1;
+ }
+
+ // bank = DimmAddress[15:13]
+ *p_bank = (U16) (MrcOemMemoryRightShiftU64 (dimm_line, 7) & 7);
+
+ if( enhanced_interleave_mode ) {
+ // bank = DimmAddress[15:13] ^ DimmAddress[18:16]
+ *p_bank = *p_bank ^ ((U16) (MrcOemMemoryRightShiftU64 (dimm_line, 10) & 7));
+ }
+
+ // row = DimmAddress[31..27:16] depending on DIMM size. mask already prepared.
+ row_mask = row_mask & dimm_line; // use row_mask to hold row because it is "U64"
+ row_mask = MrcOemMemoryRightShiftU64 (row_mask, 10); // shift off bank and col bits
+ *p_row = (U16) row_mask;
+ }
+
+ return TRUE;
+}
+
+
+/**
+@brief
+ Address encode function (reverse address decode)
+ DRAM address to system address conversion
+
+ @param[in] p_chan - channel sys_addr to encode
+ @param[in] p_dimm - DIMM sys_addr to encode
+ @param[in] p_rank - rank sys_addr to encode
+ @param[in] p_bank - bank sys_addr to encode
+ @param[in] p_row - row sys_addr to encode
+ @param[in] p_col - column sys_addr to encode. Note: The architecture is limited to
+ half-cache-line granularity for burst order. Therefore the last
+ two bits of the column are ignored.
+ @param[in] TOLUD - memory register
+ @param[in] REMAP_BASE - memory register
+ @param[in] REMAP_LIMIT - memory register
+ @param[in] CHANNEL_HASH - memory register
+ @param[in] MAD_ZR - memory register
+ @param[in] MAD_CHNL - memory register
+ @param[in] MAD_DIMM_ch0 - memory register
+ @param[in] MAD_DIMM_ch1 - memory register
+ @param[in] MAD_DIMM_ch2 - memory register
+ @param[out] sys_addr - the 39-bit system address convert to
+ @param[in, out] p_is_tcm - is the transaction to sys_addr "traffic class for the manageability engine"
+
+ @retval True if successful.
+
+**/
+BOOL
+MrcHswEncode (
+ IN U16 chan,
+ IN U16 dimm,
+ IN U16 rank,
+ IN U16 bank,
+ IN U16 row,
+ IN U16 col,
+ IN U32 TOLUD,
+ IN U64 REMAP_BASE,
+ IN U64 REMAP_LIMIT,
+ IN U32 CHANNEL_HASH,
+ IN U32 MAD_ZR,
+ IN U32 MAD_CHNL,
+ IN U32 MAD_DIMM_ch0,
+ IN U32 MAD_DIMM_ch1,
+ IN U32 MAD_DIMM_ch2,
+ OUT U64 *p_sys_addr,
+ IN OUT BOOL *p_is_tcm
+ )
+{
+ U32 MAD_DIMM; // MAD_DIMM register for chosen channel
+ U64 dimm_select; // DIMM A=0, B=1
+ U64 dimm_size; // size of selected DIMM
+ BOOL dual_rank; // number of ranks on selected DIMM
+ U64 bit_above_row; // one-hot bit to mark the size of the row address
+ BOOL dimm_and_rank_interleaving; // modes for the selected channel
+ BOOL high_order_rank_interleave;
+ BOOL enhanced_interleave_mode;
+ U16 hori_addr; // bits to use from address for HORI
+ U16 row_mask; // used to insert rank bit inbetween row bits in HORI mode
+ U64 dimm_line; // DIMM address space (cache-line)
+ U64 chan_line; // Channel address space (cache-line)
+ U16 num_col_bits; // The number of column address bits the DIMM has.
+ // sizes of the DIMMs on the channel (cache-line)
+ U64 dimm_a_size;
+ U64 dimm_b_size;
+ U16 chan_select; // 0 = Channel A, 1 = Channel B
+ // MAD_ZR register fields
+ U64 bandc; // (B + C)
+ // address before reverse decoding the remap region
+ U64 remap_line; // cache-line
+ U64 remap_addr; // full address
+ // stacked channel variables
+ BOOL stacked_mode;
+ U16 stacked_encoding;
+ U64 stacked_size;
+ U16 lsb_mask_bit; // LsbMaskBit field from CHANNEL_HASH register
+ U16 hash_mask; // channel hash mask from CHANNEL_HASH register
+ U16 hash_line; // lower bits of remap_line with hash_mask applied
+ U16 hash_bit; // bit that gets destroyed in forward decode
+ U16 i; // loop counter
+ U64 top_of_remaped_mem; // used for reverse decode of remap region
+
+ // perform some checks on the inputs
+
+ // illegal channel check
+ if (chan & ~((U16) 1)) {
+ return FALSE;
+ }
+
+ // select our MAD_DIMM register. Ignore channel 2
+ MAD_DIMM = chan ? MAD_DIMM_ch1 : MAD_DIMM_ch0;
+
+ // check for too high of a DIMM index
+ if (dimm & ~((U16) 1)) {
+ return FALSE;
+ }
+
+ // is it DIMM A or B? A=0, B=1
+ dimm_select = (U64) (dimm ^ get_dimm_a_select(MAD_DIMM));
+
+ // get DIMM size
+ dimm_size = dimm_select ? get_dimm_b_size_as_cl (MAD_DIMM) : get_dimm_a_size_as_cl (MAD_DIMM);
+
+ // check if DIMM slot is populated
+ if (dimm_size == 0) {
+ return FALSE;
+ }
+
+ // check for too high of a rank index
+ if (rank & ~((U16) 1)) {
+ return FALSE;
+ }
+
+ // get number of ranks on DIMM
+ dual_rank = dimm_select ? get_dimm_b_number_of_ranks (MAD_DIMM) : get_dimm_a_number_of_ranks (MAD_DIMM);
+
+ // check that rank exists on DIMM
+ if (rank && !dual_rank) {
+ return FALSE;
+ }
+
+ // check for too high of a bank index
+ if (bank & ~((U16) 0x7)) {
+ return FALSE;
+ }
+
+ num_col_bits = dimm_select ? get_dimm_b_num_col_bits (MAD_CHNL, MAD_DIMM) :
+ get_dimm_a_num_col_bits (MAD_CHNL, MAD_DIMM);
+
+ // Set a bit in a position that is one bit higher than the highest row bit
+ // in the DIMM address space (cacheline address).
+ //
+ // Most-Significant-Bits of Supported DRAM Chip Organizations (num bits - 1):
+ //
+ // Type Config Device-Size Row Col Bank Rank-Size
+ // ----- ------ ----------- --- --- ---- ---------
+ // DDR3 x8 512 Mbit 12 9 2 512 MByte
+ // DDR3 x8 1 Gbit 13 9 2 1 GByte
+ // DDR3 x8 2 Gbit 14 9 2 2 GByte
+ // DDR3 x8 4 Gbit 15 9 2 4 GByte
+ // DDR3 x16 512 Mbit 11 9 2 256 MByte
+ // DDR3 x16 1 Gbit 12 9 2 512 MByte
+ // DDR3 x16 2 Gbit 13 9 2 1 GByte
+ // DDR3 x16 4 Gbit 14 9 2 2 GByte
+ // LPDDR x16 2 Gbit 13 9 2 1 GByte
+ // LPDDR x16 4 Gbit 13 10 2 2 GByte
+ // LPDDR x16 8 Gbit 14 10 2 4 GByte
+ // LPDDR x32 2 Gbit 13 8 2 512 MByte
+ // LPDDR x32 4 Gbit 13 9 2 1 GByte
+ // LPDDR x32 8 Gbit 14 9 2 2 GByte
+ //
+ // dimm size (GB) | dimm_size (cache-line)
+ // ---------------+-----------------------
+ // 8 GB | 1<<27
+ // 4 GB | 1<<26
+ // 2 GB | 1<<25
+ // 1 GB | 1<<24
+ // 0.5 GB | 1<<23
+ // 0.25 GB | 1<<22
+ //
+ bit_above_row = MrcOemMemoryRightShiftU64 (dimm_size, (U8) (num_col_bits + ((U16) dual_rank)));
+
+ // Check for unexpected high-order row bits
+ if (row & ~(((U32) bit_above_row) - 1)) {
+ return FALSE;
+ }
+
+ // check for unexpected high-order column bits
+ if (col & ~((((U16) 1) << num_col_bits) - 1)) {
+ return FALSE;
+ }
+
+
+ //
+ // Done with checking. Now reverse decode the address.
+ //
+
+ // determine if we are doing DIMM and Rank interleaving
+ dimm_and_rank_interleaving = get_dimm_and_rank_intlv (MAD_DIMM);
+
+ // determine if we are doing high order rank interleave
+ high_order_rank_interleave = get_high_order_intlv_mode (MAD_DIMM);
+
+ // determine if we are doing Enhanced Interleave Mode (EIM) (XOR rank & bank bits)
+ enhanced_interleave_mode = get_enhanced_intlv_mode (MAD_DIMM);
+
+ // start building the DIMM Address Space (as a cache-line address)
+
+ dimm_line = 0x0ULL;
+
+ // build the rank, bank, and row parts of the DIMM space address
+
+ if (dual_rank && high_order_rank_interleave) {
+ hori_addr = get_hori_addr (MAD_DIMM);
+
+ // Put the row part of the address into the dimm address
+
+ // Create a mask with all 1's in the positions of the row bits below the rank bit
+ row_mask = (1 << (hori_addr + 4)) - 1;
+
+ // Split the row address at the rank bit and put it into the dimm address
+ dimm_line = dimm_line | MrcOemMemoryLeftShiftU64 (((U64) (((row & ~row_mask) << 1) | (row & row_mask))), (16 - 6));
+
+ // put the bank part of the address into the dimm address
+ dimm_line = dimm_line | ((U64) (bank << (13 - 6)));
+
+ // Rank bit goes into the spot specified by hori_addr
+ dimm_line = dimm_line | ((U64) (rank << (20 - 6 + hori_addr)));
+
+ // reverse the XOR operation for enhanced interleave mode
+ //
+ // bank = DimmAddress[15:13] XOR DimmAddress[18:16]
+ //
+ if (enhanced_interleave_mode) {
+ dimm_line = dimm_line ^ MrcOemMemoryRightShiftU64 ((dimm_line & 0x1C00ULL), 3);
+ }
+ } else if (dual_rank && dimm_and_rank_interleaving) {
+ // put in the row part of the address
+ dimm_line = dimm_line | MrcOemMemoryLeftShiftU64 (((U64) row), 11);
+ //
+ // rank = DimmAddress[15:15]
+ // bank = {DimmAddress[16:16],DimmAddress[14:13]}
+ //
+ dimm_line = dimm_line | MrcOemMemoryLeftShiftU64 (((U64) rank), 9);
+ dimm_line = dimm_line | (MrcOemMemoryLeftShiftU64 (((U64) bank), 8) & 0x400ULL) |
+ (MrcOemMemoryLeftShiftU64 (((U64) bank), 7) & 0x180ULL);
+ //
+ // reverse the XOR operation for enhanced interleave mode
+ //
+ // rank = DimmAddress[15:15] XOR DimmAddress[19:19]
+ // bank = {DimmAddress[16:16],DimmAddress[14:13]} XOR
+ // {DimmAddress[20:20],DimmAddress[18:17]}
+ //
+ if (enhanced_interleave_mode) {
+ dimm_line = dimm_line ^ MrcOemMemoryRightShiftU64 ((dimm_line & 0x7800ULL), 4);
+ }
+ } else {
+ // put in the row part of the address
+ dimm_line = dimm_line | ((U64) (row << 10));
+
+ // put in the bank part of the address
+ dimm_line = dimm_line | ((U64) (bank << 7));
+
+ // rank 1 will set the rank bit
+ if (rank) {
+ dimm_line = dimm_line | MrcOemMemoryLeftShiftU64 (bit_above_row, 10);
+ }
+ //
+ // reverse the XOR operation for enhanced interleave mode
+ //
+ // bank = DimmAddress[15:13] XOR DimmAddress[18:16]
+ //
+ if (enhanced_interleave_mode) {
+ dimm_line = dimm_line ^ MrcOemMemoryRightShiftU64 ((dimm_line & 0x1C00ULL), 3);
+ }
+ }
+
+ // The column address bits make up the bottom of the DIMM address space.
+ // With the addition of LPDDR to HSW-ULT, the number column address bits may
+ // change from the standard 10 with DDR3 to 9 or 11 with some of the LPDDR
+ // organizations. The entire DIMM address space can be shifted up or down
+ // with this change, then the column address can be inserted.
+ //
+ if (num_col_bits == 9) {
+ // rank, bank, and row bits are in 10-col-bit locations in dimm_line, shift them down to 9-col-bit locations.
+ dimm_line = MrcOemMemoryRightShiftU64 (dimm_line, 1);
+ }
+
+ if (num_col_bits == 11) {
+ // rank, bank, and row bits are in 10-col-bit locations in dimm_line, shift them up to 11-col-bit locations.
+ dimm_line = MrcOemMemoryLeftShiftU64 (dimm_line, 1);
+ }
+
+ // get the low order DIMM address space bits from the column
+ dimm_line = dimm_line | col >> 3; // no need to mask col because of previous checks
+
+
+
+
+ //
+ // DIMM address to channel address
+ //
+
+ // Find the DIMM sizes on our selected channel. adjust to cache-line granularity
+ dimm_a_size = get_dimm_a_size_as_cl (MAD_DIMM);
+ dimm_b_size = get_dimm_b_size_as_cl (MAD_DIMM);
+
+ //
+ // Both dimm_and_rank_interleaving and high_order_rank_interleave cause DIMM interleaving.
+ //
+ if (dimm_and_rank_interleaving || high_order_rank_interleave) {
+ if (dimm_line < dimm_b_size) { // Range 0 if DIMM address is less than DIMM B's size
+ //
+ // 2-way DIMM interleave. Channel address [15:15] is used to select DIMM.
+ // Need to insert dimm_select bit there.
+ //
+ chan_line = (MrcOemMemoryLeftShiftU64 (dimm_line, 1) & 0xFFFFFFFFFFFFFC00ULL) |
+ MrcOemMemoryLeftShiftU64 (dimm_select, 9) |
+ (dimm_line & 0x01FFULL);
+ } else { // not Range 0, must be Range 1
+ // Channel address is DIMM A address with DIMM B's contribution from Range 0 added in
+ chan_line = dimm_line + dimm_b_size;
+ }
+ } else { // no DIMM and Rank interleaving (nor HORI).
+ chan_line = dimm_line;
+ if (dimm_select) { // DIMM is B
+ chan_line += dimm_a_size;
+ }
+ }
+
+
+ //
+ // Channel address to remaped system address
+ //
+
+ // map physical channel to A or B
+ //
+ chan_select = physical_to_logical_chan (MAD_CHNL, chan);
+
+
+ //
+ // MAD_ZR Register field values are in 256MB granularity.
+ // They are stored here adjusted to cache-line granularity.
+ bandc = get_bandc_as_cl (MAD_ZR);
+
+ // determine if we are in stacked mode; and if so, what the stacked size is.
+ stacked_mode = get_stacked_mode (MAD_CHNL);
+
+ if (stacked_mode) {
+ stacked_encoding = get_stacked_encoding (MAD_CHNL);
+ stacked_size = get_stacked_memory_size (stacked_encoding);
+
+ remap_line = chan_line;
+ //
+ // In stacked mode, the channel is chosen based on the bit corresponding to the
+ // size of the stacked register. Bit-wise 'OR' in the channel selection bit into that
+ // position.
+ //
+ remap_line |= chan_select << (22 + stacked_encoding);
+ } else if (chan_line < bandc) { // Zone 1
+ remap_line = MrcOemMemoryLeftShiftU64 (chan_line, 1);
+
+ // Determine if the channel hash feature is being used
+ if (CHANNEL_HASH & HSW_MC_ADDR_CHAN_HASH_ENABLE_MASK) { // test enable bit
+ lsb_mask_bit = get_ch_hash_lsb_mask_bit (CHANNEL_HASH);
+ hash_mask = get_ch_hash_mask (CHANNEL_HASH);
+
+ // Don't need to force the selected lsb_mask_bit to be on because bit at lsb_mask_bit will be zero
+ //hash_mask = hash_mask | (1 << lsb_mask_bit);
+
+ // Reverse the swap of sys_addr bit 6 with bit pointed to by lsb_mask_bit
+ remap_line = remap_line | (MrcOemMemoryRightShiftU64 (remap_line, (U8) lsb_mask_bit) & 0x0000000000000001ULL); // copy lsb_mask_bit to bit 6
+ remap_line = remap_line & (~MrcOemMemoryLeftShiftU64 (0x0000000000000001ULL, (U8) lsb_mask_bit)); // zero out lsb_mask_bit
+
+ // Get the bits used to produce chan_select, sans the bit at lsb_mask_bit
+ hash_line = ((U16) remap_line) & hash_mask;
+ //
+ // Recreate the value of the bit at lsb_mask_bit by doint the hash
+ // XORs.
+ //
+ hash_bit = 0;
+ for (i = 0 ; i < HSW_MC_ADDR_CHANNEL_HASH_MASK_SIZE ; i++) {
+ hash_bit = hash_bit ^ (hash_line >> i);
+ }
+ hash_bit = hash_bit & 1;
+ //
+ // Recreate the missing bit by XORing the chan_select (the result of
+ // the forward decode).
+ // (If X = A ^ B, then A = X ^ B)
+ //
+ hash_bit = hash_bit ^ chan_select;
+
+ // put the missing bit back into the address
+ remap_line = remap_line | (hash_bit << lsb_mask_bit);
+ } else {
+ // Without the hash, sys_addr[6:6] determines the channel
+ remap_line |= ((U64) chan_select);
+ }
+ } else { // Zone 2
+ remap_line = chan_line + bandc; // This works if we consider C or not.
+ }
+
+
+ // zero out unused register bits
+ TOLUD &= HSW_MC_ADDR_TOLUD_MASK;
+ REMAP_BASE &= HSW_MC_ADDR_REMAP_MASK;
+ REMAP_LIMIT &= HSW_MC_ADDR_REMAP_MASK;
+
+ REMAP_LIMIT |= HSW_MC_ADDR_REMAP_LIMIT_LOWER_BITS_MASK;
+
+ // work on full address instead of cache-line address;
+ remap_addr = MrcOemMemoryLeftShiftU64 (remap_line, 6);
+
+ //
+ // Determine if the address is under the remap zone and therefore must be a
+ // TCM. remap_line can't be at or above TOM (Top Of Memory), so no need to
+ // check that. Simply check if the remap_line is between the base and
+ // limit.
+ //
+ *p_is_tcm = (remap_addr <= REMAP_LIMIT) && (remap_addr >= REMAP_BASE); // b4194941 - REMAP_LIMIT is now inclusive
+
+
+ //
+ // reverse decode the remap region
+ //
+
+ *p_sys_addr = remap_addr; // if the remap doesn't apply system address is remap address
+
+ if (!(*p_is_tcm) && (REMAP_LIMIT > REMAP_BASE)) { // remap doesn't apply if remap zone disabled
+ top_of_remaped_mem = (U64) TOLUD;
+ top_of_remaped_mem += REMAP_LIMIT;
+ top_of_remaped_mem -= REMAP_BASE;
+ if ((remap_addr <= top_of_remaped_mem) && (remap_addr >= ((U64) TOLUD))) {
+ // remap applies. move the address to the remap zone
+ *p_sys_addr -= ((U64) TOLUD);
+ *p_sys_addr += REMAP_BASE;
+ }
+ }
+
+ // restore cache-line chunk order
+ *p_sys_addr = *p_sys_addr | (MrcOemMemoryLeftShiftU64 (((U64) col), 3) & 0x3FULL);
+
+ // successful reverse address decode
+ return TRUE;
+} \ No newline at end of file
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/AddrDecode/MrcHswMcAddrDecode.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/AddrDecode/MrcHswMcAddrDecode.h
new file mode 100644
index 0000000..76eaf3d
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/AddrDecode/MrcHswMcAddrDecode.h
@@ -0,0 +1,129 @@
+/**
+This file contains an 'Intel Peripheral Driver' and uniquely
+identified as "Intel Reference Module" and is
+licensed for Intel CPUs and chipsets under the terms of your
+license agreement with Intel or your vendor. This file may
+be modified by the user, subject to additional terms of the
+license agreement.
+
+Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved.
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+@file:
+ MrcHswMcAddrDecode.h
+
+@brief:
+ File to support address decoding and encoding
+
+**/
+#ifndef _HSWULT_MC_ADDR_DECODE_H_
+#define _HSWULT_MC_ADDR_DECODE_H_
+
+
+#include "MrcOemAddrDecode.h"
+#include "MrcOemMemory.h"
+
+/**
+@brief
+ Address decode function
+ Converts system address to DRAM address
+
+ @param[in] sys_addr - the 39-bit system address to convert
+ @param[in, out] p_is_tcm - is the transaction to sys_addr "traffic class for the manageability engine"
+ @param[in] TOLUD - memory register
+ @param[in] REMAP_BASE - memory register
+ @param[in] REMAP_LIMIT - memory register
+ @param[in] CHANNEL_HASH - memory register
+ @param[in] MAD_ZR - memory register
+ @param[in] MAD_CHNL - memory register
+ @param[in] MAD_DIMM_ch0 - memory register
+ @param[in] MAD_DIMM_ch1 - memory register
+ @param[in] MAD_DIMM_ch2 - memory register
+ @param[out] p_chan - channel sys_addr decodes to
+ @param[out] p_dimm - DIMM sys_addr decodes to
+ @param[out] p_rank - rank sys_addr decodes to
+ @param[out] p_bank - bank sys_addr decodes to
+ @param[out] p_row - row sys_addr decodes to
+ @param[out] p_col - column sys_addr decodes to.
+
+ @retval True if successful.
+
+**/
+BOOL
+MrcHswDecode (
+ IN U64 sys_addr,
+ IN OUT BOOL *p_is_tcm,
+ IN U32 TOLUD,
+ IN U64 REMAP_BASE,
+ IN U64 REMAP_LIMIT,
+ IN U32 CHANNEL_HASH,
+ IN U32 MAD_ZR,
+ IN U32 MAD_CHNL,
+ IN U32 MAD_DIMM_ch0,
+ IN U32 MAD_DIMM_ch1,
+ IN U32 MAD_DIMM_ch2,
+ OUT U16 *p_chan,
+ OUT U16 *p_dimm,
+ OUT U16 *p_rank,
+ OUT U16 *p_bank,
+ OUT U16 *p_row,
+ OUT U16 *p_col
+ );
+
+/**
+@brief
+ Address encode function (reverse address decode)
+ DRAM address to system address conversion
+
+ @param[in] p_chan - channel sys_addr to encode
+ @param[in] p_dimm - DIMM sys_addr to encode
+ @param[in] p_rank - rank sys_addr to encode
+ @param[in] p_bank - bank sys_addr to encode
+ @param[in] p_row - row sys_addr to encode
+ @param[in] p_col - column sys_addr to encode. Note: The architecture is limited to
+ half-cache-line granularity for burst order. Therefore the last
+ two bits of the column are ignored.
+ @param[in] TOLUD - memory register
+ @param[in] REMAP_BASE - memory register
+ @param[in] REMAP_LIMIT - memory register
+ @param[in] CHANNEL_HASH - memory register
+ @param[in] MAD_ZR - memory register
+ @param[in] MAD_CHNL - memory register
+ @param[in] MAD_DIMM_ch0 - memory register
+ @param[in] MAD_DIMM_ch1 - memory register
+ @param[in] MAD_DIMM_ch2 - memory register
+ @param[out] sys_addr - the 39-bit system address convert to
+ @param[in, out] p_is_tcm - is the transaction to sys_addr "traffic class for the manageability engine"
+
+ @retval True if successful.
+
+**/
+BOOL
+MrcHswEncode (
+ IN U16 chan,
+ IN U16 dimm,
+ IN U16 rank,
+ IN U16 bank,
+ IN U16 row,
+ IN U16 col,
+ IN U32 TOLUD,
+ IN U64 REMAP_BASE,
+ IN U64 REMAP_LIMIT,
+ IN U32 CHANNEL_HASH,
+ IN U32 MAD_ZR,
+ IN U32 MAD_CHNL,
+ IN U32 MAD_DIMM_ch0,
+ IN U32 MAD_DIMM_ch1,
+ IN U32 MAD_DIMM_ch2,
+ OUT U64 *p_sys_addr,
+ IN OUT BOOL *p_is_tcm
+ );
+
+
+#endif // _HSWULT_MC_ADDR_DECODE_H_
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcApi.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcApi.h
new file mode 100644
index 0000000..0348c38
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcApi.h
@@ -0,0 +1,280 @@
+/** @file
+ Mrc definition of supported features.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+**/
+
+#ifndef _MrcApi_h_
+#define _MrcApi_h_
+
+#include "MrcTypes.h"
+
+#define HPET_MIN 0x0001 ///< Minimum is one HPET tick = 69.841279ns
+#define HPET_1US 0x000F
+#define HPET_1MS 0x37EF
+
+#define START_TEST_DELAY (2 * HPET_MIN)
+#define IO_RESET_DELAY (2 * HPET_MIN)
+
+#define COMP_INT 0x0A ///< For 10ms
+#define MAX_POSSIBLE_VREF 54 ///< Maximum possible margin for Vref
+#define MAX_POSSIBLE_TIME 31 ///< Maximum possible margin for time
+#define TXEQFULLDRV (0x30) ///< 12 Emphasize legs (not trained)
+#define DIMMRON (ODIC_RZQ_6)
+#define BCLK_DEFAULT (100 * 1000 * 1000)
+
+///
+/// Define the frequencies that may be possible in the memory controller.
+/// Note that not all these values may be supported.
+///
+#define fNoInit (0)
+#define f800 (800)
+#define f1000 (1000)
+#define f1067 (1067)
+#define f1200 (1200)
+#define f1333 (1333)
+#define f1400 (1400)
+#define f1600 (1600)
+#define f1800 (1800)
+#define f1867 (1867)
+#define f2000 (2000)
+#define f2133 (2133)
+#define f2200 (2200)
+#define f2400 (2400)
+#define f2600 (2600)
+#define f2667 (2667)
+#define fUnSupport (0x7FFFFFFF)
+typedef U32 MrcFrequency;
+
+///
+/// Define the memory nominal voltage (VDD).
+/// Note that not all these values may be supported.
+///
+typedef enum {
+ VDD_INVALID,
+ VDD_1_00 = 1000,
+ VDD_1_05 = 1050,
+ VDD_1_10 = 1100,
+ VDD_1_15 = 1150,
+ VDD_1_20 = 1200,
+ VDD_1_25 = 1250,
+ VDD_1_30 = 1300,
+ VDD_1_35 = 1350,
+ VDD_1_40 = 1400,
+ VDD_1_45 = 1450,
+ VDD_1_50 = 1500,
+ VDD_1_55 = 1550,
+ VDD_1_60 = 1600,
+ VDD_1_65 = 1650,
+ VDD_1_70 = 1700,
+ VDD_1_75 = 1750,
+ VDD_1_80 = 1800,
+ VDD_1_85 = 1850,
+ VDD_1_90 = 1900,
+ VDD_1_95 = 1950,
+ VDD_2_00 = 2000,
+ VDD_2_05 = 2050,
+ VDD_2_10 = 2100,
+ VDD_2_15 = 2150,
+ VDD_2_20 = 2200,
+ VDD_2_25 = 2250,
+ VDD_2_30 = 2300,
+ VDD_2_35 = 2350,
+ VDD_2_40 = 2400,
+ VDD_2_45 = 2450,
+ VDD_2_50 = 2500,
+ VDD_2_55 = 2550,
+ VDD_2_60 = 2600,
+ VDD_2_65 = 2650,
+ VDD_2_70 = 2700,
+ VDD_2_75 = 2750,
+ VDD_2_80 = 2800,
+ VDD_2_85 = 2850,
+ VDD_2_90 = 2900,
+ VDD_2_95 = 2950,
+ VDD_MAXIMUM = 0x7FFFFFFF
+} MrcVddSelect;
+
+///
+/// Compile time configuration parameters - START.
+/// The user must set these values for the system.
+///
+#define MAX_EDGES 2 ///< Maximum number of edges.
+#define MAX_BITS 8 ///< BITS per byte.
+#define MAX_MR_IN_DIMM 4 ///< Maximum number of mode registers in a DIMM.
+#define MAX_CPU_SOCKETS 1 ///< The maximum number of CPUs per system.
+#define MAX_CONTROLLERS 1 ///< The maximum number of memory controllers per CPU socket.
+#define MAX_CHANNEL 2 ///< The maximum number of channels per memory controller.
+
+#define MAX_DIMMS_IN_CHANNEL 2 ///< The maximum number of DIMMs per channel.
+
+#define MAX_RANK_IN_DIMM 2 ///< The maximum number of ranks per DIMM.
+#define MAX_RANK_IN_CHANNEL (MAX_DIMMS_IN_CHANNEL * MAX_RANK_IN_DIMM) ///< The maximum number of ranks per channel.
+#define MAX_SDRAM_IN_DIMM 9 ///< The maximum number of SDRAMs per DIMM when ECC is enabled.
+#define MAX_STROBE 18 ///< Number of strobe groups.
+#define MAX_DQ 72 ///< Number of Dq bits used by the rank.
+#define CHAR_BITS 8 ///< Number of bits in a char.
+#define DIMMSIZEMIN 512 ///< The minimum size of DIMM, in MBytes.
+#define DIMMSIZEMAX (16 * 1024) ///< The maximum size of DIMM, in MBytes.
+#define FREQMIN f1067 ///< The minimum valid frequency.
+
+#define SUPPORT_DDR3 SUPPORT ///< SUPPORT means that DDR3 is supported by the MRC.
+#define ULT_SUPPORT_LPDDR3 SUPPORT ///< SUPPORT means that LPDDR3 is supported by the MRC.
+#define TRAD_SUPPORT_LPDDR3 UNSUPPORT ///< SUPPORT means that LPDDR3 is supported by the MRC.
+
+#define SUPPORT_SPD_CRC UNSUPPORT ///< SUPPORT means that the CRC of the DIMMs SPD must match.
+#define SUPPORT_FORCE UNSUPPORT ///< SUPPORT means to force tAA, tRCD, tRP to the same value.
+#define SUPPORT_ALLDIMMS UNSUPPORT ///< SUPPORT means all timings across all DIMMs in the system.
+ ///< UNSUPPORT means all timings across each memory channel's DIMMs.
+#define SUPPORT_XMP SUPPORT ///< SUPPORT means Extreme Memory Profiles are supported, else UNSUPPORT.
+#define SUPPORT_ECC SUPPORT ///< SUPPORT means ECC is suppported, else UNSUPPORT.
+#define SUPPORT_UDIMM SUPPORT ///< SUPPORT means that unbuffered DIMMs are supported, else UNSUPPORT.
+#define SUPPORT_SODIMM SUPPORT ///< SUPPORT means that SO-DIMMs are supported, else UNSUPPORT.
+#define SUPPORT_RDIMM UNSUPPORT ///< SUPPORT means that registered DIMMs are supported, else UNSUPPORT.
+#define SUPPORT_PRIWIDTH_8 UNSUPPORT ///< SUPPORT means that SDRAM primary bus width of 8 is supported by the system.
+#define SUPPORT_PRIWIDTH_16 UNSUPPORT ///< SUPPORT means that SDRAM primary bus width of 16 is supported by the system.
+#define SUPPORT_PRIWIDTH_32 UNSUPPORT ///< SUPPORT means that SDRAM primary bus width of 32 is supported by the system.
+#define SUPPORT_PRIWIDTH_64 SUPPORT ///< SUPPORT means that SDRAM primary bus width of 64 is supported by the system.
+#define SUPPORT_DEVWIDTH_4 UNSUPPORT ///< SUPPORT means that SDRAM device width of 4 is supported by the system.
+#define SUPPORT_DEVWIDTH_8 SUPPORT ///< SUPPORT means that SDRAM device width of 8 is supported by the system.
+#define SUPPORT_DEVWIDTH_16 SUPPORT ///< SUPPORT means that SDRAM device width of 16 is supported by the system.
+#define SUPPORT_DEVWIDTH_32 SUPPORT ///< SUPPORT means that SDRAM device width of 32 is supported by the system.
+#define SUPPORT_COLUMN_9 UNSUPPORT ///< SUPPORT means that 9 bit size is supported by the system.
+
+#define ULT_SUPPORT_COLUMN_10 SUPPORT ///< SUPPORT means that 10 bit size is supported by the system.
+#define ULT_SUPPORT_COLUMN_11 SUPPORT ///< SUPPORT means that 11 bit size is supported by the system.
+#define ULT_SUPPORT_COLUMN_12 SUPPORT ///< SUPPORT means that 12 bit size is supported by the system.
+#define TRAD_SUPPORT_COLUMN_10 SUPPORT ///< SUPPORT means that 10 bit size is supported by the system.
+#define TRAD_SUPPORT_COLUMN_11 UNSUPPORT ///< SUPPORT means that 11 bit size is supported by the system.
+#define TRAD_SUPPORT_COLUMN_12 UNSUPPORT ///< SUPPORT means that 12 bit size is supported by the system.
+
+#define SUPPORT_ROW_12 SUPPORT ///< SUPPORT means that 12 bit size is supported by the system.
+#define SUPPORT_ROW_13 SUPPORT ///< SUPPORT means that 13 bit size is supported by the system.
+#define SUPPORT_ROW_14 SUPPORT ///< SUPPORT means that 14 bit size is supported by the system.
+#define SUPPORT_ROW_15 SUPPORT ///< SUPPORT means that 15 bit size is supported by the system.
+#define SUPPORT_ROW_16 SUPPORT ///< SUPPORT means that 16 bit size is supported by the system.
+#define SUPPORT_BANK_8 SUPPORT ///< SUPPORT means that 8 banks is supported by the system.
+#define SUPPORT_BANK_16 UNSUPPORT ///< SUPPORT means that 16 banks is supported by the system.
+#define SUPPORT_BANK_32 UNSUPPORT ///< SUPPORT means that 32 banks is supported by the system.
+#define SUPPORT_BANK_64 UNSUPPORT ///< SUPPORT means that 64 banks is supported by the system.
+
+#define TAAMINPOSSIBLE 4 ///< tAAmin possible range, in number of tCK cycles.
+#define TAAMAXPOSSIBLE 24
+#define TWRMINPOSSIBLE 5 ///< tWRmin possible range, in number of tCK cycles.
+#define TWRMAXPOSSIBLE 16 ///< tWRmin values of 9, 11, 13 ,15 are not valid for DDR3.
+#define TRCDMINPOSSIBLE 4 ///< tRCDmin possible range, in number of tCK cycles.
+#define TRCDMAXPOSSIBLE 20
+#define TRRDMINPOSSIBLE 4 ///< tRRDmin possible range, in number of tCK cycles.
+#define TRRDSMINPOSSIBLE 4 ///< tRRD_Smin possible range, in number of tCK cycles.
+#define TRRDSMAXPOSSIBLE 65535
+#define TRRDLMINPOSSIBLE 4 ///< tRRD_Lmin possible range, in number of tCK cycles.
+#define TRRDLMAXPOSSIBLE 65535
+#define TRPMINPOSSIBLE 4 ///< tRPmin possible range, in number of tCK cycles.
+#define TRPMAXPOSSIBLE 15
+#define TRPABMINPOSSIBLE 4 ///< tRPabmin possible range, in number of tCK cycles.
+#define TRPABMAXPOSSIBLE 18
+#define TRASMINPOSSIBLE 10 ///< tRASmin possible range, in number of tCK cycles.
+#define TRASMAXPOSSIBLE 40
+#define TRCMINPOSSIBLE 1 ///< tRCmin possible range, in number of tCK cycles.
+#define TRCMAXPOSSIBLE 4095
+#define TRFCMINPOSSIBLE 1 ///< tRFCmin possible range, in number of tCK cycles.
+#define TRFCMAXPOSSIBLE 511
+#define TWTRMINPOSSIBLE 4 ///< tWTRmin possible range, in number of tCK cycles.
+#define TWTRMAXPOSSIBLE 10
+#define TRTPMINPOSSIBLE 4 ///< tRTPmin possible range, in number of tCK cycles.
+#define TRTPMAXPOSSIBLE 15
+#define TFAWMINPOSSIBLE 10 ///< tFAWmin possible range, in number of tCK cycles.
+#define TFAWMAXPOSSIBLE 54
+#define TCWLMINPOSSIBLE 5 ///< tCWLmin possible range, in number of tCK cycles.
+#define TCWLMAXPOSSIBLE 12
+#define TREFIMINPOSSIBLE 1 ///< tREFImin possible range, in number of tCK cycles.
+#define TREFIMAXPOSSIBLE 65535
+#define NMODEMINPOSSIBLE 1 ///< Command rate mode min possible range, in number of tCK cycles.
+#define NMODEMAXPOSSIBLE 3
+
+#define ULT_VDDMINPOSSIBLE 1200 ///< Vdd possible range, in milliVolts.
+#define ULT_VDDMAXPOSSIBLE 1350
+#define TRAD_VDDMINPOSSIBLE 1350 ///< Vdd possible range, in milliVolts.
+#define TRAD_VDDMAXPOSSIBLE 1500
+
+#define SPD3_MANUF_START 117 ///< The starting point for the SPD manufacturing data.
+#define SPD3_MANUF_END 127 ///< The ending point for the SPD manufacturing data.
+#define HOST_BRIDGE_BUS 0 ///< The host bridge bus number.
+#define HOST_BRIDGE_DEVICE 0 ///< The host bridge device number.
+#define HOST_BRIDGE_FUNCTION 0 ///< The host bridge function number.
+#define HOST_BRIDGE_DEVID 0 ///< The host bridge device id offset.
+#define HOST_BRIDGE_REVID 8 ///< The host bridge revision id offset.
+
+#define MEMORY_RATIO_MIN 3 ///< The minimum DDR ratio value that the hardware supports.
+#define MEMORY_RATIO_MAX 15 ///< The maximum DDR ratio value that the hardware supports.
+
+///
+/// Compile time configuration parameters - END.
+///
+
+#if (defined ULT_FLAG && defined TRAD_FLAG)
+#define SUPPORT_LPDDR3 (ULT_SUPPORT_LPDDR3 || TRAD_SUPPORT_LPDDR3)
+#define SUPPORT_COLUMN_10 (ULT_SUPPORT_COLUMN_10 || TRAD_SUPPORT_COLUMN_10)
+#define SUPPORT_COLUMN_11 (ULT_SUPPORT_COLUMN_11 || TRAD_SUPPORT_COLUMN_11)
+#define SUPPORT_COLUMN_12 (ULT_SUPPORT_COLUMN_12 || TRAD_SUPPORT_COLUMN_12)
+#define VDDMINPOSSIBLE MIN (ULT_VDDMINPOSSIBLE, TRAD_VDDMINPOSSIBLE)
+#define VDDMAXPOSSIBLE MAX (ULT_VDDMAXPOSSIBLE, TRAD_VDDMAXPOSSIBLE)
+#elif (defined ULT_FLAG)
+#define SUPPORT_LPDDR3 ULT_SUPPORT_LPDDR3
+#define SUPPORT_COLUMN_10 ULT_SUPPORT_COLUMN_10
+#define SUPPORT_COLUMN_11 ULT_SUPPORT_COLUMN_11
+#define SUPPORT_COLUMN_12 ULT_SUPPORT_COLUMN_12
+#define VDDMINPOSSIBLE ULT_VDDMINPOSSIBLE
+#define VDDMAXPOSSIBLE ULT_VDDMAXPOSSIBLE
+#elif (defined TRAD_FLAG)
+#define SUPPORT_LPDDR3 TRAD_SUPPORT_LPDDR3
+#define SUPPORT_COLUMN_10 TRAD_SUPPORT_COLUMN_10
+#define SUPPORT_COLUMN_11 TRAD_SUPPORT_COLUMN_11
+#define SUPPORT_COLUMN_12 TRAD_SUPPORT_COLUMN_12
+#define VDDMINPOSSIBLE TRAD_VDDMINPOSSIBLE
+#define VDDMAXPOSSIBLE TRAD_VDDMAXPOSSIBLE
+#endif // ULT_FLAG && TRAD_FLAG
+
+#define MRC_ALL_DDR_SUPPORTED ((SUPPORT_DDR4 == SUPPORT) && ((SUPPORT_DDR3 == SUPPORT) || (SUPPORT_LPDDR3 == SUPPORT)))
+#define MRC_DDR3_LPDDR_SUPPORTED ((SUPPORT_DDR3 == SUPPORT) || (SUPPORT_LPDDR3 == SUPPORT))
+
+///
+/// Exit mode
+///
+typedef enum {
+ emSlow = 0,
+ emFast = 1,
+ emAuto = 0xFF,
+} MrcExitMode;
+
+///
+/// System definitions
+///
+#define MRC_SYSTEM_BCLK (100)
+
+///
+/// Register default values
+///
+#define MRC_DIMM_RANK_INTERLEAVE (1)
+#define MRC_ENHANCED_INTERLEAVE_MODE (1)
+#define MRC_HORI_MODE (1)
+
+///
+/// Training definitions
+///
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcBdat.c b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcBdat.c
new file mode 100644
index 0000000..7670487
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcBdat.c
@@ -0,0 +1,529 @@
+/** @file
+ Copies the memory related timing and configuration information into the
+ Compatible BIOS data (BDAT) table.
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+**/
+
+#include "MrcTypes.h"
+#include "MrcApi.h"
+#include "MrcGlobal.h"
+#include "MrcOem.h"
+#include "MrcSpdProcessing.h"
+#include "McAddress.h"
+
+#ifdef BDAT_SUPPORT
+#define TBD 0
+#define CRC_SEED 0
+#define CRC_XOR_MASK 0x1021
+#define MAX_UINT8_VALUE (((1UL) << CHAR_BITS) - 1)
+#define HOST_BRIDGE_BUS 0
+#define HOST_BRIDGE_DEVICE 0
+#define HOST_BRIDGE_FUNCTION 0
+#define HOST_BRIDGE_OFFSET_DEVID 0
+#define HOST_BRIDGE_OFFSET_REVID 8
+#define CopyMem MrcOemMemoryCpy
+#define GetCrc16 GetDimmCrc
+
+typedef U8 UINT8;
+typedef U16 UINT16;
+
+/**
+ @brief
+ Finds the window value for the given DQ value and if it is less than the
+ current value, then save the end point values.
+
+ @param[in, out] Rank1 - Pointer to the first rank training value (left or low).
+ @param[in, out] Rank2 - Pointer to the second rank training value (right or high).
+ @param[in, out] CurrentWindow - The current window value.
+ @param[in] Value1 - The first training value (left or low).
+ @param[in] Value2 - The second training value (right or high).
+
+ @retval Nothing.
+**/
+void
+ConvertDq2Rank (
+ IN OUT UINT8 *Rank1,
+ IN OUT UINT8 *Rank2,
+ IN OUT UINT8 *CurrentWindow,
+ IN const UINT8 Value1,
+ IN const UINT8 Value2
+ )
+{
+ UINT8 Window; // The calculated window value.
+
+ Window = MAX (Value1, Value2) - MIN (Value1, Value2);
+ if (Window < *CurrentWindow) {
+ *CurrentWindow = Window;
+ *Rank1 = Value1;
+ *Rank2 = Value2;
+ } // if
+ return;
+}
+
+/**
+@brief
+ Initialize the memory rank margin area of the RMT_STRUCTURE.
+
+ @param[in] MrcData - The MRC "global data".
+ @param[in, out] RmtRankMargin - Pointer to the start of the rank margin information in the RMT table.
+ @param[in] RmtDq - Pointer to the start of the dq margin information in the RMT table.
+
+ @retval Nothing.
+**/
+void
+MrcFillRmtRankMargin (
+ IN const MrcParameters *MrcData,
+ IN OUT RmtRankMargin *RmtRankMargin,
+ IN RmtDqMargin *RmtDq
+ )
+{
+ RmtDqMargin *RmtDqMargin; // Pointer to the current DQ margin in the RMT structure.
+ UINT8 Dq; // DQ number in the rank.
+ UINT8 DqEnd;
+ UINT8 SmallestWindowRxDq; // The smallest of the Rx DQ windows.
+ UINT8 SmallestWindowTxDq; // The smallest of the Tx DQ windows.
+ UINT8 SmallestWindowRxVref; // The smallest of the Rx Vref windows.
+ UINT8 SmallestWindowTxVref; // The smallest of the Tx Vref windows.
+
+ SmallestWindowRxDq = (UINT8) MAX_UINT8_VALUE;
+ SmallestWindowTxDq = (UINT8) MAX_UINT8_VALUE;
+ SmallestWindowRxVref = (UINT8) MAX_UINT8_VALUE;
+ SmallestWindowTxVref = (UINT8) MAX_UINT8_VALUE;
+ DqEnd = (MrcData->SysOut.Outputs.EccSupport) ? MAX_DQ : (MAX_DQ - MAX_BITS);
+ for (Dq = 0; Dq < DqEnd; Dq++) {
+ RmtDqMargin = &RmtDq[Dq];
+ ConvertDq2Rank (
+ &RmtRankMargin->RxDqLeft,
+ &RmtRankMargin->RxDqRight,
+ &SmallestWindowRxDq,
+ RmtDqMargin->RxDqLeft,
+ RmtDqMargin->RxDqRight
+ );
+ ConvertDq2Rank (
+ &RmtRankMargin->TxDqLeft,
+ &RmtRankMargin->TxDqRight,
+ &SmallestWindowTxDq,
+ RmtDqMargin->TxDqLeft,
+ RmtDqMargin->TxDqRight
+ );
+ ConvertDq2Rank (
+ &RmtRankMargin->RxVrefLow,
+ &RmtRankMargin->RxVrefHigh,
+ &SmallestWindowRxVref,
+ RmtDqMargin->RxVrefLow,
+ RmtDqMargin->RxVrefHigh
+ );
+ ConvertDq2Rank (
+ &RmtRankMargin->TxVrefLow,
+ &RmtRankMargin->TxVrefHigh,
+ &SmallestWindowTxVref,
+ RmtDqMargin->TxVrefLow,
+ RmtDqMargin->TxVrefHigh
+ );
+ } // Dq loop
+ return;
+}
+
+/**
+@brief
+ Initialize the memory DQ area of the RMT_STRUCTURE.
+
+ @param[in, out] RmtDq - Pointer to the start of the DQ information in the RMT table.
+ @param[in] Channel - Specific Channel
+ @param[in] Dimm - Specific Dimm
+ @param[in] Rank - Specific Rank
+ @param[in] MrcData - The MRC "global data".
+
+ @retval Nothing.
+**/
+void
+MrcFillRmtDqMargin (
+ IN OUT RmtDqMargin *RmtDq,
+ IN const UINT8 Controller,
+ IN const UINT8 Channel,
+ IN const UINT8 Dimm,
+ IN const UINT8 Rank,
+ IN const MrcParameters *MrcData
+ )
+{
+ const MrcOutput *Outputs;
+ const MrcChannelOut *ChannelOut;
+ const MrcDqTimeMargin *RxDqMargin; // Pointer to the output portion of the MRC global data area.
+ const MrcDqTimeMargin *TxDqMargin; // Pointer to the output portion of the MRC global data area.
+ const MrcDqVrefMargin *RxVrefDqMargin; // Pointer to the output portion of the MRC global data area.
+ const MrcDqVrefMargin *TxVrefDqMargin; // Pointer to the output portion of the MRC global data area.
+ RmtDqMargin *RmtDqMargin; // Pointer to the current DQ margin in the RMT structure.
+ UINT8 RankInChannel;
+ UINT8 Sdram;
+ UINT8 Dq; // DQ number in the rank.
+ UINT8 DqEnd;
+ UINT8 Bit;
+
+ Outputs = &MrcData->SysOut.Outputs;
+ ChannelOut = &Outputs->Controller[Controller].Channel[Channel];
+ RankInChannel = (Dimm * MAX_RANK_IN_DIMM) + Rank;
+ DqEnd = (Outputs->EccSupport) ? MAX_DQ : (MAX_DQ - MAX_BITS);
+ for (Dq = 0; Dq < DqEnd; Dq++) {
+ Sdram = Dq / CHAR_BITS;
+ Bit = Dq % CHAR_BITS;
+ RxDqMargin = &ChannelOut->RxDqPb[RankInChannel][Sdram][Bit];
+ TxDqMargin = &ChannelOut->TxDqPb[RankInChannel][Sdram][Bit];
+ RxVrefDqMargin = &ChannelOut->RxDqVrefPb[RankInChannel][Sdram][Bit];
+ TxVrefDqMargin = &ChannelOut->TxDqVrefPb[RankInChannel][Sdram][Bit];
+ RmtDqMargin = &RmtDq[Dq];
+ RmtDqMargin->RxDqLeft = RxDqMargin->Left;
+ RmtDqMargin->RxDqRight = RxDqMargin->Right;
+ RmtDqMargin->TxDqLeft = TxDqMargin->Left;
+ RmtDqMargin->TxDqRight = TxDqMargin->Right;
+ RmtDqMargin->RxVrefLow = RxVrefDqMargin->Low;
+ RmtDqMargin->RxVrefHigh = RxVrefDqMargin->High;
+ RmtDqMargin->TxVrefLow = TxVrefDqMargin->Low;
+ RmtDqMargin->TxVrefHigh = TxVrefDqMargin->High;
+ } // Dq loop
+ return;
+}
+
+/**
+@brief
+ Initialize the memory rank training area of the RMT_STRUCTURE.
+
+ @param[in, out] RmtRankTraining - Pointer to the start of the rank training information in the RMT table.
+ @param[in] Channel - Specific Channel
+ @param[in] Dimm - Specific Dimm
+ @param[in] Rank - Specific Rank
+ @param[in] MrcData - The MRC "global data".
+
+ @retval Nothing.
+**/
+void
+MrcFillRmtRankTraining (
+ IN OUT RmtRankTraining *RmtRankTraining,
+ IN const UINT8 Controller,
+ IN const UINT8 Channel,
+ IN const UINT8 Dimm,
+ IN const UINT8 Rank,
+ IN const MrcParameters *MrcData
+ )
+{
+ const MrcOutput *Outputs; // Pointer to the output portion of the MRC global data area.
+ const MrcChannelOut *ChannelOut; // Pointer to the channel portion of the MRC global data area.
+ UINT8 Index;
+ UINT8 RankInChannel;
+ UINT8 Sdram;
+ UINT8 Strobe;
+
+ Outputs = &MrcData->SysOut.Outputs;
+ ChannelOut = &Outputs->Controller[Controller].Channel[Channel];
+ RankInChannel = (Dimm * MAX_RANK_IN_DIMM) + Rank;
+ for (Strobe = 0; Strobe < MAX_STROBE; Strobe++) {
+ Sdram = Strobe / 2;
+ RmtRankTraining->RecEnDelay[Strobe] = ChannelOut->RcvEn[RankInChannel][Sdram];
+ RmtRankTraining->WlDelay[Strobe] = ChannelOut->WlDelay[RankInChannel][Sdram];
+ RmtRankTraining->RxDqDelay[Strobe] = (Strobe % 2)
+ ? ChannelOut->RxDqsN[RankInChannel][Sdram]
+ : ChannelOut->RxDqsP[RankInChannel][Sdram];
+ RmtRankTraining->TxDqDelay[Strobe] = ((U8) (ChannelOut->TxDq[RankInChannel][Sdram] >> 6)) & 7;
+ } // Strobe loop
+ RmtRankTraining->ClkDelay = ChannelOut->ClkPiCode[RankInChannel];
+ RmtRankTraining->CtlDelay = ChannelOut->CtlPiCode[RankInChannel];
+ for (Index = 0; Index < (sizeof (RmtRankTraining->CmdDelay) / sizeof (RmtRankTraining->CmdDelay[0])); Index++) {
+ RmtRankTraining->CmdDelay[Index] = TBD; // Need to implement code.
+ } // Index loop
+ RmtRankTraining->IoLatency = ChannelOut->IoLatency[RankInChannel];
+ RmtRankTraining->Roundtrip = ChannelOut->RTLatency[RankInChannel];
+ return;
+}
+
+/**
+@brief
+ Initialize the memory rank area of the RMT_STRUCTURE.
+
+ @param[in, out] RmtRank - Pointer to the start of the rank information in the RMT table.
+ @param[in] MrcData - The MRC "global data".
+ @param[in] Channel - Current channel number.
+ @param[in] Dimm - Current dimm number.
+
+ @retval Nothing.
+**/
+void
+MrcFillRmtRankStructure (
+ IN OUT RmtRankList *RmtRank,
+ IN const MrcParameters *MrcData,
+ IN UINT8 Controller,
+ IN UINT8 Channel,
+ IN UINT8 Dimm
+)
+{
+ const MrcOutput *Outputs; // Pointer to the output portion of the MRC global data area.
+ const MrcChannelOut *ChannelOut; // Pointer to the DIMM output portion of the MRC global data area.
+ const MrcDimmOut *DimmOut; // Pointer to the DIMM output portion of the MRC global data area.
+ RmtRankList *RmtRankLists; // Pointer to the current rank list in the RMT structure.
+ RmtRankTraining *RmtRankTraining; // Pointer to the current rank training in the RMT structure.
+ UINT8 Rank; // Rank count for sequencing.
+ UINT8 RankInChannel; // Rank number in a channel.
+
+ Outputs = &MrcData->SysOut.Outputs;
+ ChannelOut = &Outputs->Controller[Controller].Channel[Channel];
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ for (Rank = 0; (Rank < MAX_RANK_IN_DIMM) && (Rank < DimmOut->RankInDIMM); Rank++) {
+ RmtRankLists = &RmtRank[Rank];
+ RmtRankTraining = &RmtRankLists->RankTraining;
+ RankInChannel = (Dimm * MAX_RANK_IN_DIMM) + Rank;
+ RmtRankLists->RankEnabled = TRUE;
+ RmtRankLists->RankMarginEnabled = TRUE;
+ RmtRankLists->DqMarginEnabled = TRUE;
+ MrcFillRmtDqMargin (&RmtRankLists->DqMargin[0], Controller, Channel, Dimm, Rank, MrcData);
+ MrcFillRmtRankMargin (MrcData, &RmtRankLists->RankMargin, &RmtRankLists->DqMargin[0]);
+ MrcFillRmtRankTraining (&RmtRankLists->RankTraining, Controller, Channel, Dimm, Rank, MrcData);
+ CopyMem (
+ (UINT8 *) &RmtRankLists->RankMRS.ModeRegister[0],
+ (UINT8 *) &DimmOut->Rank[Rank].MR[0],
+ sizeof (RmtRankMrs)
+ );
+ RmtRankLists->RankMargin.CmdLeft = ChannelOut->Command[RankInChannel].Left;
+ RmtRankLists->RankMargin.CmdRight = ChannelOut->Command[RankInChannel].Right;
+ RmtRankLists->RankMargin.CmdVrefLow = ChannelOut->Command[RankInChannel].Low;
+ RmtRankLists->RankMargin.CmdVrefHigh = ChannelOut->Command[RankInChannel].High;
+ RmtRankLists->RankMargin.RecvenLeft = ChannelOut->ReceiveEnable[RankInChannel].Left;
+ RmtRankLists->RankMargin.RecvenRight = ChannelOut->ReceiveEnable[RankInChannel].Right;
+ RmtRankLists->RankMargin.WrLevelLeft = ChannelOut->WriteLevel[RankInChannel].Left;
+ RmtRankLists->RankMargin.WrLevelRight = ChannelOut->WriteLevel[RankInChannel].Right;
+ } // Rank loop
+ return;
+}
+
+/**
+@brief
+ Initialize the memory dimm area of the RMT_STRUCTURE.
+
+ @param[in, out] RmtDimm - Pointer to the start of the dimm information in the RMT table.
+ @param[in] MrcData - The MRC "global data".
+ @param[in] Channel - Current channel number.
+
+ @retval Nothing.
+**/
+void
+MrcFillRmtDimmStructure (
+ IN OUT RmtDimmList *RmtDimm,
+ IN const MrcParameters *MrcData,
+ IN UINT8 Controller,
+ IN UINT8 Channel
+ )
+{
+ const MrcInput *Inputs; // Pointer to the input portion of the MRC global data area.
+ const MrcDimmIn *DimmIn; // Pointer to the DIMM input portion of the MRC global data area.
+ const MrcSpd *SpdIn; // Pointer to the SPD input portion of the MRC global data area.
+ const MrcOutput *Outputs; // Pointer to the output portion of the MRC global data area.
+ const MrcChannelOut *ChannelOut; // Pointer to the channel output portion of the MRC global data area.
+ const MrcDimmOut *DimmOut; // Pointer to the DIMM output portion of the MRC global data area.
+ RmtDimmList *RmtDimmList; // Pointer to the current DIMM in the RMT structure.
+ RmtSpd *RmtSpdList; // Pointer to the current SPD in the RMT structure.
+ UINT8 Dimm; // Dimm count for sequencing.
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ ChannelOut = &Outputs->Controller[Controller].Channel[Channel];
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ if (DimmOut->Status == DIMM_PRESENT) {
+ RmtDimmList = &RmtDimm[Dimm];
+ RmtSpdList = &RmtDimmList->SpdBytes;
+ DimmIn = &Inputs->Controller[Controller].Channel[Channel].Dimm[Dimm];
+ SpdIn = &DimmIn->Spd;
+ RmtDimmList->DimmEnabled = TRUE;
+ CopyMem ((UINT8 *) &RmtSpdList->SpdData[0], (UINT8 *) SpdIn, 128);
+#if (defined SUPPORT_XMP && SUPPORT_XMP == SUPPORT)
+ CopyMem (&RmtSpdList->SpdData[128], ((UINT8 *) SpdIn) + 128, 128);
+#endif // (defined SUPPORT_XMP && SUPPORT_XMP == SUPPORT)
+ CopyMem ((UINT8 *) &RmtSpdList->SpdValid, (UINT8 *) &DimmIn->SpdValid, sizeof (RmtDimmList->SpdBytes.SpdValid));
+
+ //
+ // Initialize the memory rank area of the RMT_STRUCTURE.
+ //
+ MrcFillRmtRankStructure (&RmtDimmList->RankList[0], MrcData, Controller, Channel, Dimm);
+ } // end if
+ } // Dimm loop
+ return;
+}
+
+/**
+@brief
+ Initialize the memory channel area of the RMT_STRUCTURE.
+
+ @param[in, out] RmtChannel - Pointer to the start of the channel information in the RMT table.
+ @param[in] MrcData - The MRC "global data".
+
+ @retval Nothing.
+**/
+void
+MrcFillRmtChannelStructure (
+ IN OUT RmtChannelList *RmtChannel,
+ IN const MrcParameters *MrcData,
+ IN const UINT8 Controller
+ )
+{
+ const MrcOutput *Outputs; // Pointer to the output portion of the MRC global data area.
+ RmtChannelList *RmtChannelList; // Pointer to the current channel in the RMT structure.
+ UINT8 Channel; // Channel count for sequencing.
+
+ Outputs = &MrcData->SysOut.Outputs;
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (Outputs->Controller[Controller].Channel[Channel].Status == CHANNEL_PRESENT) {
+ RmtChannelList = &RmtChannel[Channel];
+ RmtChannelList->ChannelEnabled = TRUE;
+ RmtChannelList->NumDimmSlot = MAX_DIMMS_IN_CHANNEL;
+
+ //
+ // Initialize the memory DIMM area of the RMT_STRUCTURE.
+ //
+ MrcFillRmtDimmStructure (&RmtChannelList->DimmList[0], MrcData, Controller, Channel);
+ } // end if
+ } // Channel loop
+ return;
+}
+
+/**
+@brief
+ Initialize the memory controller area of the RMT_STRUCTURE.
+
+ @param[in, out] RmtController - Pointer to the start of the controller information in the RMT table.
+ @param[in] MrcData - The MRC "global data".
+
+ @retval Nothing.
+**/
+void
+MrcFillRmtControllerStructure (
+ IN OUT RmtControllerList *RmtController,
+ IN const MrcParameters *MrcData
+ )
+{
+ const MrcInput *Inputs;
+ const MrcOutput *Outputs;
+ RmtControllerList *RmtControllerList;
+ UINT8 Controller;
+ MrcVddSelect VddVoltage;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ VddVoltage = Outputs->VddVoltage[Inputs->MemoryProfile];
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ if (Outputs->Controller[Controller].Status == CONTROLLER_PRESENT) {
+ RmtControllerList = &RmtController[Controller];
+ RmtControllerList->ControllerEnabled = TRUE;
+ RmtControllerList->ControllerDeviceId = Outputs->Controller[Controller].DeviceId;
+ RmtControllerList->ControllerRevisionId = Outputs->Controller[Controller].RevisionId;
+ RmtControllerList->MemoryFrequency = (UINT16) (Outputs->Frequency / 10);
+ RmtControllerList->MemoryVoltage = (UINT16) VddVoltage;
+ //
+ // Step unit = piStep * (tCK / 2048)
+ //
+ RmtControllerList->PiStep = (UINT8) PI_STEP;
+ RmtControllerList->RecvenStep = (UINT8) PI_STEP;
+ RmtControllerList->WrLevelStep = (UINT8) PI_STEP;
+ if (VddVoltage > 0) {
+ //
+ // Step unit = __VrefStep * Vdd / 100
+ //
+ RmtControllerList->RxVrefStep = (UINT16) RX_VREF (VddVoltage);
+ RmtControllerList->TxVrefStep = (UINT16) TX_VREF (VddVoltage);
+ RmtControllerList->CaVrefStep = (UINT16) CA_VREF (VddVoltage);
+ } else {
+ RmtControllerList->RxVrefStep = 0;
+ RmtControllerList->TxVrefStep = 0;
+ RmtControllerList->CaVrefStep = 0;
+ }
+ //
+ // Initialize the memory channel area of the RMT_STRUCTURE.
+ //
+ MrcFillRmtChannelStructure (&RmtControllerList->ChannelList[0], MrcData, Controller);
+ } // Controller loop
+ }
+
+ return;
+}
+
+/**
+@brief
+ Fill the compatible data structure RMT with the information provided by
+ the memory initialization code.
+
+ @param[in, out] MrcData - Constant pointer to the Mrc data structure which conatins the Rmt structure to fill.
+
+ @retval Nothing.
+**/
+MrcStatus
+MrcFillRmtStructure (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ const UINT8 RmtHeaderSign[] = {'B', 'D', 'A', 'T', 'H', 'E', 'A', 'D'};
+ const MrcVersion *Version; // Pointer to the output portion of the MRC global data area.
+ RmtData *Rmt;
+ RmtHeader *RmtHeader; // Pointer to the header data area in the RMT structure.
+ RmtSystem *RmtSystem; // Pointer to the system data area in the RMT structure.
+ const MrcInput *Inputs;
+ MrcOutput *Outputs;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ if (Inputs->RmtBdatEnable) {
+ //
+ // Initialize the header area of the RMT_STRUCTURE.
+ //
+ Rmt = &MrcData->Rmt;
+ RmtHeader = &Rmt->RmtHeader;
+ CopyMem (&RmtHeader->BiosDataSignature[0], (UINT8 *) RmtHeaderSign, sizeof (RmtHeader->BiosDataSignature));
+ RmtHeader->BiosDataStructSize = sizeof (RmtData);
+ RmtHeader->Version.S[PRIMARY_OFFSET] = RMT_PRIMARY_VERSION;
+ RmtHeader->Version.S[SECONDARY_OFFSET] = RMT_SECONDARY_VERSION;
+ RmtHeader->OemOffset = OEM_OFFSET;
+ RmtHeader->Reserved1 = (Inputs->BaseTime.Hours << 16) | (Inputs->BaseTime.Minutes << 8) | Inputs->BaseTime.Seconds;
+ RmtHeader->Reserved2 = (Inputs->BaseTime.Year << 16) | (Inputs->BaseTime.Month << 8) | Inputs->BaseTime.DayOfMonth;
+
+ //
+ // Initialize the system area of the RMT_STRUCTURE.
+ //
+ Version = &Outputs->Version;
+ RmtSystem = &Rmt->RmtSystem;
+ RmtSystem->RefCodeRevision.c.Major = Version->Major;
+ RmtSystem->RefCodeRevision.c.Minor = Version->Minor;
+ RmtSystem->RefCodeRevision.c.Revision = Version->Rev;
+ RmtSystem->RefCodeRevision.c.Build = Version->Build;
+ RmtSystem->MaxController = MAX_CONTROLLERS;
+ RmtSystem->MaxChannel = MAX_CHANNEL;
+ RmtSystem->MaxDimm = MAX_DIMMS_IN_CHANNEL;
+ RmtSystem->MaxRankDimm = MAX_RANK_IN_DIMM;
+ RmtSystem->MaxStrobe = MAX_STROBE;
+ RmtSystem->MaxDq = MAX_DQ;
+ RmtSystem->MarginLoopCount = Outputs->DQPatLC;
+ //
+ // Initialize the memory controller area of the RMT_STRUCTURE.
+ //
+ MrcFillRmtControllerStructure (&RmtSystem->ControllerList[0], MrcData);
+
+ //
+ // Initialize the CRC of the RMT_STRUCTURE.
+ // Ensure that the CRC calculation is the last field initialized.
+ //
+ GetCrc16 ((const UINT8 *const) Rmt, sizeof (RmtData), &Rmt->RmtHeader.Crc16);
+ MrcOemMmioWrite (NCDECS_CR_SCRATCHPAD_NCU_2_REG, (U32) Rmt, Inputs->MchBarBaseAddress);
+ } // end if
+ return mrcSuccess;
+}
+#endif // BDAT_SUPPORT
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcBdat.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcBdat.h
new file mode 100644
index 0000000..a7232ae
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcBdat.h
@@ -0,0 +1,45 @@
+/** @file
+ Copies the memory related timing and configuration information into the
+ Compatible BIOS data (BDAT) table.
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+**/
+
+#ifndef _MrcBdat_h_
+#define _MrcBdat_h_
+#pragma pack(push, 1)
+
+#include "MrcTypes.h"
+#include "MrcApi.h"
+
+/**
+ Fill the compatible data structure RMT with the information provided by
+ the memory initialization code.
+
+ @param[in, out] MrcData - Constant pointer to the Mrc data structure which conatins the Rmt structure to fill.
+
+ @retval Nothing.
+**/
+extern
+MrcStatus
+MrcFillRmtStructure (
+ IN OUT MrcParameters *const MrcData
+ );
+
+#pragma pack(pop)
+#endif // _MrcBdat_h_
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcGeneral.c b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcGeneral.c
new file mode 100644
index 0000000..635c786
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcGeneral.c
@@ -0,0 +1,1577 @@
+/** @file
+ This file all the MRC general API to the MRC wrapper.
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "MrcGeneral.h"
+#include "MrcDdr3.h"
+const MrcVersion cVersion = {
+#include "MrcVersion.h"
+};
+
+#ifdef ULT_FLAG
+//
+// This table is used for LPDDR3 MR5 decoding
+//
+struct {
+ U8 VendorId;
+ char *VendorName;
+} DramVendorList [] = {
+ { 1, "Samsung" },
+ { 3, "Elpida" },
+ { 6, "Hynix" }
+};
+#endif // ULT_FLAG
+
+/**
+@brief
+ Thisfunction performs Software Memory testing
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval Always returns mrcSuccess.
+**/
+MrcStatus
+MrcHwMemTest (
+ IN MrcParameters *const MrcData
+ )
+{
+ MrcStatus Status;
+
+ Status = mrcSuccess;
+
+ return Status;
+}
+
+/**
+@brief
+ This function changes the MC to normal mode, enables the ECC if needed, lock configuration and set PU_MRC_Done.
+ If the ECC is enabled, this function should be called after memory is cleaned.
+
+ @param[in, out] MrcData - Include all MRC global data.
+
+ @retval Always returns mrcSuccess.
+**/
+MrcStatus
+MrcMcActivate (
+ IN MrcParameters *const MrcData
+ )
+{
+ const MrcInput *Inputs;
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ MrcCpuModel CpuModel;
+ MrcCpuStepping CpuStepping;
+ MCHBAR_CH0_CR_CMD_RATE_STRUCT CmdRate;
+ DDRSCRAM_CR_DDRSCRAMBLECH0_STRUCT DdrScramble;
+ MCDECS_CR_MAD_DIMM_CH0_MCMAIN_STRUCT DimmCh0McMain;
+ MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_STRUCT ReutChSeqCfg;
+ PCU_CR_M_COMP_PCU_STRUCT MCompPcu;
+ MCHBAR_CH0_CR_TC_BANK_RANK_A_STRUCT TcBankRankA;
+ U32 Offset;
+ U32 GeneratedSeed;
+ U8 Controller;
+ U8 Channel;
+ U8 Byte;
+ U32 BurstEndOdtDelay;
+#ifdef ULT_FLAG
+ U8 Rank;
+ U8 MaxRcvEn;
+ U8 RcvEnDrift;
+ U8 RcvEnTurnOff;
+ S8 OdtTurnOff;
+#endif // ULT_FLAG
+ BOOL Lpddr;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ Debug = &Inputs->Debug;
+ GeneratedSeed = 0;
+ CpuModel = Inputs->CpuModel;
+ CpuStepping = Inputs->CpuStepping;
+
+ //
+ // Oem hook before normal mode configuration starts
+ //
+ MrcOemCheckPoint (MrcData, OemBeforeNormalMode, NULL);
+
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!(MrcChannelExist (Outputs, Channel))) {
+ continue;
+ }
+
+ ChannelOut = &ControllerOut->Channel[Channel];
+
+ //
+ // Make sure tRDRD (sr, dr, dd) are above 6 for Scrambler W/A
+ //
+ if ((Inputs->ScramblerEnable == TRUE) &&
+ ((CpuModel == cmHSW && CpuStepping < csHswC0) ||
+ (CpuModel == cmHSW_ULT && CpuStepping < csHswUltC0) ||
+ (CpuModel == cmCRW && CpuStepping < csCrwC0)
+ )
+ ) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Increasing tRDRD(sr,dr,dd) by two:\n");
+
+ Offset = MCHBAR_CH0_CR_TC_BANK_RANK_A_REG +
+ (MCHBAR_CH1_CR_TC_BANK_RANK_A_REG - MCHBAR_CH0_CR_TC_BANK_RANK_A_REG) * Channel;
+
+ TcBankRankA.Data = MrcReadCR (MrcData, Offset);
+
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "Initial Value: Channel %d\n tRDRD = 0x%X\n tRDRD_dr = 0x%X\n tRDRD_dd = 0x%X\n",
+ Channel,
+ TcBankRankA.Bits.tRDRD,
+ TcBankRankA.Bits.tRDRD_dr,
+ TcBankRankA.Bits.tRDRD_dd
+ );
+
+ TcBankRankA.Bits.tRDRD = MAX (TcBankRankA.Bits.tRDRD, 6);
+ TcBankRankA.Bits.tRDRD_dr = MAX (TcBankRankA.Bits.tRDRD_dr, 6);
+ TcBankRankA.Bits.tRDRD_dd = MAX (TcBankRankA.Bits.tRDRD_dd, 6);
+
+ MrcWriteCR (MrcData, Offset, TcBankRankA.Data);
+ ChannelOut->MchbarBANKRANKA = TcBankRankA.Data;
+
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "New value: Channel %d\n tRDRD = 0x%X\n tRDRD_dr = 0x%X\n tRDRD_dd = 0x%X\n",
+ Channel,
+ TcBankRankA.Bits.tRDRD,
+ TcBankRankA.Bits.tRDRD_dr,
+ TcBankRankA.Bits.tRDRD_dd
+ );
+ }
+
+ //
+ // Enable Scrambling
+ //
+ if (Inputs->ScramblerEnable == TRUE) {
+ GeneratedSeed = MrcGetRandomNumber ();
+ //
+ // Set Scramble key and enable bits
+ //
+ DdrScramble.Data = 0;
+ DdrScramble.Bits.ScramKey = GeneratedSeed;
+ DdrScramble.Bits.ScramEn = 1;
+ MrcWriteCR (
+ MrcData,
+ DDRSCRAM_CR_DDRSCRAMBLECH0_REG + ((DDRSCRAM_CR_DDRSCRAMBLECH1_REG - DDRSCRAM_CR_DDRSCRAMBLECH0_REG) * Channel),
+ DdrScramble.Data
+ );
+ }
+
+ //
+ // If we are in 1N mode, set Command Rate Limit to 3
+ //
+ if (ChannelOut->Timing[Inputs->MemoryProfile].NMode == 1) {
+ Offset = MCHBAR_CH0_CR_CMD_RATE_REG + ((MCHBAR_CH1_CR_CMD_RATE_REG - MCHBAR_CH0_CR_CMD_RATE_REG) * Channel);
+ CmdRate.Data = MrcReadCR (MrcData, Offset);
+ CmdRate.Bits.enable_cmd_rate_limit = 1;
+ CmdRate.Bits.cmd_rate_limit = 3;
+ CmdRate.Bits.enable_cmd_rate_limit = Inputs->EnCmdRate & 1;
+ CmdRate.Bits.cmd_rate_limit = Inputs->EnCmdRate >> 1;
+ MrcWriteCR (MrcData, Offset, CmdRate.Data);
+ }
+
+ //
+ // Enable the command tri state at the end of the training.
+ //
+ if (!Inputs->CmdTriStateDis) {
+ TcBankRankA.Data = ChannelOut->MchbarBANKRANKA;
+ TcBankRankA.Bits.CMD_3st = 0;
+ ChannelOut->MchbarBANKRANKA = TcBankRankA.Data;
+ MrcWriteCR (
+ MrcData,
+ MCHBAR_CH0_CR_TC_BANK_RANK_A_REG +
+ ((MCHBAR_CH1_CR_TC_BANK_RANK_A_REG - MCHBAR_CH0_CR_TC_BANK_RANK_A_REG) * Channel),
+ ChannelOut->MchbarBANKRANKA
+ );
+ }
+
+ //
+ // set MC to normal mode and clean the odt and cke.
+ //
+ ReutChSeqCfg.Data = 0;
+ ReutChSeqCfg.Bits.Initialization_Mode = NOP_Mode;
+ MrcWriteCR (
+ MrcData,
+ MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_REG +
+ ((MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_REG - MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_REG) * Channel),
+ (U32) ReutChSeqCfg.Data
+ );
+
+ //
+ // set again the rank occupancy
+ //
+ MrcWriteCR8 (
+ MrcData,
+ MCHBAR_CH0_CR_MC_INIT_STATE_REG + ((MCHBAR_CH1_CR_MC_INIT_STATE_REG - MCHBAR_CH0_CR_MC_INIT_STATE_REG) * Channel),
+ ChannelOut->ValidRankBitMask
+ );
+
+ //
+ // Set the MC to ECC mode for all channels if needed.
+ //
+ if (Outputs->EccSupport == TRUE) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "ECC support\n");
+ Offset = MCDECS_CR_MAD_DIMM_CH0_MCMAIN_REG + ((MCDECS_CR_MAD_DIMM_CH1_MCMAIN_REG - MCDECS_CR_MAD_DIMM_CH0_MCMAIN_REG) * Channel);
+ DimmCh0McMain.Data = MrcReadCR (MrcData, Offset);
+ DimmCh0McMain.Bits.ECC = emBothActive;
+ MrcWriteCR (MrcData, Offset, DimmCh0McMain.Data);
+ }
+ }
+ }
+
+ //
+ // Check if LPDDR3 memory is used
+ //
+ Lpddr = (Outputs->DdrType == MRC_DDR_TYPE_LPDDR3);
+
+ //
+ // Update Odt timing, Samp timing and SlaveDLL to minimize power
+ // @todo TAT step is skipped on LPDDR for now.
+ //
+ if ((Inputs->TrainingEnables.TAT == 0) || Lpddr) {
+ UpdateSampOdtTiming (MrcData, 0);
+ }
+#ifdef TRAD_FLAG
+ //
+ // Update Internal clock setting
+ //
+ if ((CpuModel == cmHSW) || (CpuModel == cmCRW)) {
+ UpdateInternalClksOn (MrcData);
+ }
+#endif // TRAD_FLAG
+
+ UpdateSlaveDLLLength (MrcData);
+
+ //
+ // Program BurstEndODTDelay - it should be zero during training steps
+ //
+ BurstEndOdtDelay = ((14300 * 20) / 100 + Outputs->Qclkps / 2) / Outputs->Qclkps;
+ if (BurstEndOdtDelay > 7) {
+ BurstEndOdtDelay = 7;
+ }
+ if (BurstEndOdtDelay < 3) {
+ BurstEndOdtDelay = 0;
+ } else if (BurstEndOdtDelay < 4) {
+ BurstEndOdtDelay = 4;
+ }
+
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ if (CpuModel == cmHSW_ULT) {
+ ChannelOut->DqControl1[Byte].Bits.BurstEndODTDelay = (Lpddr) ? 0 : BurstEndOdtDelay; // Must be Disabled for LPDDR
+ } else if ((CpuModel == cmHSW) && (CpuStepping == csHswA0)) {
+ ChannelOut->DqControl1[Byte].Bits.BurstEndODTDelay = 0;
+ } else {
+ ChannelOut->DqControl1[Byte].Bits.BurstEndODTDelay = BurstEndOdtDelay;
+ }
+ Offset = DDRDATA0CH0_CR_DDRCRDATACONTROL1_REG +
+ ((DDRDATA1CH0_CR_DDRCRDATACONTROL1_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL1_REG) * Byte) +
+ ((DDRDATA0CH1_CR_DDRCRDATACONTROL1_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL1_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, ChannelOut->DqControl1[Byte].Data);
+ }
+ }
+ }
+ }
+
+#ifdef ULT_FLAG
+ if (CpuModel == cmHSW_ULT) {
+ //
+ // Program RxClkStgNum
+ //
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!MrcChannelExist (Outputs, Channel)) {
+ continue;
+ }
+ ChannelOut = &ControllerOut->Channel[Channel];
+ MaxRcvEn = 0;
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if (!MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ continue;
+ }
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ MaxRcvEn = (U8) MAX (MaxRcvEn, ChannelOut->RcvEn[Rank][Byte] / 64);
+ }
+ }
+ RcvEnDrift = (Lpddr) ? (U8) ((tDQSCK_DRIFT + Outputs->Qclkps - 1) / Outputs->Qclkps) : 1;
+ RcvEnTurnOff = MaxRcvEn + (5 - 6) + 1 + 7 + 3 + 3 + 2 + (2 * RcvEnDrift);
+
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ if (ChannelOut->DqControl1[Byte].Bits.LpDdrLongOdtEn) {
+ RcvEnTurnOff ++;
+ }
+
+ OdtTurnOff = MrcSE ((U8) ChannelOut->DqControl1[Byte].Bits.OdtDelay, 4, 8) +
+ (U8) ChannelOut->DqControl1[Byte].Bits.OdtDuration + 14;
+
+ ChannelOut->DqControl2[Byte].Bits.RxClkStgNum = (ChannelOut->DqControl0.Bits.OdtSampExtendEn) ?
+ MAX (ChannelOut->DqControl2[Byte].Bits.RxClkStgNum, RcvEnTurnOff) : MAX (17, OdtTurnOff);
+ Offset = DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG +
+ ((DDRDATA0CH1_CR_DDRCRDATACONTROL2_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG) * Channel) +
+ ((DDRDATA1CH0_CR_DDRCRDATACONTROL2_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG) * Byte);
+ MrcWriteCR (MrcData, Offset, ChannelOut->DqControl2[Byte].Data);
+ }
+ }
+ }
+
+ //
+ // Program DDRPL_CR_DDR_TX_DELAY if Memory Trace is enabled
+ //
+ MrcSetDdrplTxDelay (MrcData);
+ }
+#endif // ULT_FLAG
+
+ //
+ // Enable Periodic Comp with periodic internal = 10uS*2^COMP_INT
+ //
+ MCompPcu.Data = 0;
+ MCompPcu.Bits.COMP_INTERVAL = COMP_INT;
+ MrcWriteCR (MrcData, PCU_CR_M_COMP_PCU_REG, MCompPcu.Data);
+
+ //
+ // Enable the power mode before PCU start working.
+ //
+ MrcPowerModesPostTraining (MrcData);
+
+ //
+ // Set Idle timer and Self Refresh enable bits
+ //
+ EnterSR (MrcData);
+
+ //
+ // Oem hook when normal mode configuration is done
+ //
+ MrcOemCheckPoint (MrcData, OemAfterNormalMode, (void *) &Inputs->McLock);
+
+ if (Inputs->ThermalEnables.UserPowerWeightsEn == 0) {
+ //
+ // Apply power weight values
+ //
+ MrcPowerWeight (MrcData);
+ }
+
+ return mrcSuccess;
+}
+
+/**
+@brief
+ This function enables Normal Mode and configures the Power Down Modes
+ for the boot flows other than Cold Boot.
+
+ @param[in] MrcData - The MRC general data.
+
+ @retval Always returns mrcSuccess.
+**/
+MrcStatus
+MrcNormalMode (
+ IN MrcParameters *const MrcData
+ )
+{
+ MrcOutput *Outputs;
+ U8 Channel;
+ MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_STRUCT ReutChSeqCfg;
+ PCU_CR_M_COMP_PCU_STRUCT MCompPcu;
+
+ Outputs = &MrcData->SysOut.Outputs;
+
+ //
+ // Enable Periodic Comp with periodic internal = 10uS*2^COMP_INT
+ //
+ MCompPcu.Data = 0;
+ MCompPcu.Bits.COMP_INTERVAL = COMP_INT;
+ MrcWriteCR (MrcData, PCU_CR_M_COMP_PCU_REG, MCompPcu.Data);
+ //
+ // Set Normal Operation Mode.
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ ReutChSeqCfg.Data = 0;
+ ReutChSeqCfg.Bits.Initialization_Mode = NOP_Mode;
+ MrcWriteCR (
+ MrcData,
+ MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_REG +
+ ((MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_REG - MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_REG) * Channel),
+ (U32) ReutChSeqCfg.Data
+ );
+ }
+ }
+
+ //
+ // Configure Power Down CR
+ //
+ MrcPowerDownConfig (MrcData);
+
+ return mrcSuccess;
+}
+
+/**
+@brief
+ this function is the last funtion that call from the MRC core.
+ the function set DISB and set the MRC_Done.
+
+ @param[in] MrcData - include all the MRC general data.
+
+ @retval Always returns mrcSuccess.
+**/
+MrcStatus
+MrcDone (
+ IN MrcParameters *const MrcData
+ )
+{
+ const MrcInput *Inputs;
+ const MrcDebug *Debug;
+ MCDECS_CR_MC_INIT_STATE_G_MCMAIN_STRUCT McInitStateG;
+#ifdef ULT_FLAG
+ MrcOutput *Outputs;
+ U32 Channel;
+ U32 Rank;
+ U8 MrrResult[4];
+ U32 MrAddr;
+ U32 Device;
+ U32 Index;
+#endif //ULT_FLAG
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+
+#ifdef ULT_FLAG
+ //
+ // LPDDR: Read MR5 and MR8
+ //
+ Outputs = &MrcData->SysOut.Outputs;
+ if (Outputs->DdrType == MRC_DDR_TYPE_LPDDR3) {
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if (!MrcRankInChannelExist (MrcData, (U8) Rank, (U8) Channel)) {
+ continue;
+ }
+
+ //
+ // MR5 - Manufacturer ID
+ //
+ MrAddr = 5;
+ MrcIssueMrr (MrcData, Channel, Rank, MrAddr, MrrResult);
+ for (Device = 0; Device < 4; Device++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\tDevice[%d]= 0x%02X", Device, MrrResult[Device]);
+ for (Index = 0; Index < sizeof (DramVendorList) / sizeof (DramVendorList[0]); Index++) {
+ if (DramVendorList[Index].VendorId == MrrResult[Device]) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %s\n", DramVendorList[Index].VendorName);
+ }
+ }
+ }
+
+ //
+ // MR8 - I/O Width, Density, Type
+ //
+ MrAddr = 8;
+ MrcIssueMrr (MrcData, Channel, Rank, MrAddr, MrrResult);
+ for (Device = 0; Device < 4; Device++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\tDevice[%d]= 0x%02X - %s\n", Device, MrrResult[Device],
+ (MRC_BIT6 & MrrResult[Device]) ? "x16" : "x32");
+ }
+ }
+ }
+ }
+#endif //ULT_FLAG
+
+ //
+ // Set Idle timer and Self Refresh enable bits
+ // EnterSR (MrcData);
+ //
+ McInitStateG.Data = MrcReadCR (MrcData, MCDECS_CR_MC_INIT_STATE_G_MCMAIN_REG);
+ //
+ // Set refresh enable Bit
+ //
+ McInitStateG.Bits.refresh_enable = 1;
+
+ //
+ // used to know what is the state of the boot mode.
+ //
+ McInitStateG.Bits.pu_mrc_done = 1;
+
+ //
+ // set the MRC_Done bit.
+ //
+ McInitStateG.Bits.mrc_done = 1;
+
+ MrcWriteCR (MrcData, MCDECS_CR_MC_INIT_STATE_G_MCMAIN_REG, McInitStateG.Data);
+
+ //
+ // lock the MC and memory map registers.
+ //
+ McRegistersLock (MrcData);
+
+ //
+ // Poll for to make sure MRC is complete
+ //
+ // wait for mc_init_done
+ // @TODO: Possible infinite loop. Need to add a timeout counter/error handler.
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Waiting for mc_init_done Acknowledge\n");
+ do {
+ McInitStateG.Data = MrcReadCR (MrcData, MCDECS_CR_MC_INIT_STATE_G_MCMAIN_REG);
+ } while (McInitStateG.Bits.mc_init_done_ack == 0);
+ //
+ // move the MRC data to the graphics driver.
+ //
+ MrcWmRegSet (MrcData);
+ return mrcSuccess;
+}
+
+/**
+@brief
+ Print the MRC version to the MRC output device.
+
+ @param[in] Debug - Pointer to the MRC Debug structure.
+ @param[in] Version - The MRC version.
+
+ @retval Nothing.
+**/
+void
+MrcVersionPrint (
+ IN const MrcParameters *MrcData,
+ IN const MrcVersion *Version
+ )
+{
+#ifdef MRC_DEBUG_PRINT
+ const MrcDebug *Debug;
+
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "*********************************************************************\n");
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "** Copyright (c) 2011-2012 Intel Corporation. All rights reserved. **\n");
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "** Haswell memory detection and initialization code. **\n");
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "** Major version number is: %2u **\n", Version->Major);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "** Minor version number is: %2u **\n", Version->Minor);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "** Rev version number is: %2u **\n", Version->Rev);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "** Build number is: %2u **\n", Version->Build);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "*********************************************************************\n");
+#endif
+ return;
+}
+
+/**
+@brief
+ This function return the MRC version.
+
+ @param[out] Version - Location to store the MRC version.
+
+ @retval Nothing.
+**/
+void
+MrcVersionGet (
+ OUT MrcVersion *const Version
+ )
+{
+ if (Version != NULL) {
+ MrcOemMemoryCpy ((U8 *) Version, (U8 *) &cVersion, sizeof (MrcVersion));
+ }
+}
+
+/**
+@brief
+ This function set the MRC vertion to MCDECS_SPARE register.
+ The function need to be call by the wrapper after MrcStartMemoryConfiguration function where the MC CLK enable.
+ The function write:
+ Major number to bits 16-23
+ Minor number to bits 8-15
+ Build number to bits 0 - 7
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval Nothing.
+**/
+MrcStatus
+MrcSetMrcVersion (
+ IN MrcParameters *const MrcData
+ )
+{
+ MrcVersion const *Version;
+ MCDECS_CR_MRC_REVISION_MCMAIN_STRUCT MrcRevision;
+
+ Version = &MrcData->SysOut.Outputs.Version;
+ MrcRevision.Data = (((U32) Version->Major) << 24) |
+ (((U32) Version->Minor) << 16) |
+ (((U32) Version->Rev) << 8) |
+ (((U32) Version->Build));
+
+ MrcWriteCR (MrcData, MCDECS_CR_MRC_REVISION_MCMAIN_REG, MrcRevision.Data);
+ return mrcSuccess;
+}
+
+/**
+@brief
+ This function locks the memory controller and memory map registers.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval Nothing.
+**/
+void
+McRegistersLock (
+ IN MrcParameters *const MrcData
+ )
+{
+ const MrcInput *Inputs;
+ MCDECS_CR_MC_LOCK_MCMAIN_STRUCT McLock;
+ MRC_PCI_000_TOM_STRUCT Tom;
+ MRC_PCI_000_TOLUD_STRUCT Tolud;
+ MRC_PCI_000_TOUUD_STRUCT Touud;
+ MRC_PCI_000_REMAPBASE_STRUCT RemapBase;
+ MRC_PCI_000_REMAPLIMIT_STRUCT RemapLimit;
+// MRC_PCI_000_TSEGMB_STRUCT Tsegmb;
+ MRC_PCI_000_BDSM_STRUCT Bdsm;
+ MRC_PCI_000_BGSM_STRUCT Bgsm;
+ MRC_PCI_000_MESEG_MASK_STRUCT MeSegMask;
+ MRC_PCI_000_GGC_STRUCT Ggc;
+ PCU_CR_DDR_PTM_CTL_PCU_STRUCT DdrPtmCtl;
+ U32 Offset;
+
+ Inputs = &MrcData->SysIn.Inputs;
+
+ //
+ // Lock the memory controller registers.
+ //
+ McLock.Data = 0;
+ McLock.Bits.lock_addr_map = 1;
+ McLock.Bits.lock_mc_config = 1;
+ McLock.Bits.lock_iosav_init = 1;
+ McLock.Bits.lock_pwr_mngment = 1;
+ McLock.Bits.lock_mc_dft = 1;
+ MrcWriteCR (MrcData, MCDECS_CR_MC_LOCK_MCMAIN_REG, McLock.Data);
+
+ MRC_DEBUG_MSG (&Inputs->Debug, MSG_LEVEL_NOTE, "\nMemory controller config is locked\n");
+
+ if (Inputs->McLock) {
+ //
+ // Lock the memory map registers.
+ // Lock TOM.
+ //
+ Offset = MrcOemGetPcieDeviceAddress (0, 0, 0, MRC_PCI_000_TOM_REG);
+ MrcOemMmioRead (Offset, &Tom.Data32.Low.Data, Inputs->PciEBaseAddress);
+ Tom.Data32.Low.Bits.Lock = 1;
+ MrcOemMmioWrite (Offset, Tom.Data32.Low.Data, Inputs->PciEBaseAddress);
+
+ //
+ // Lock TOLUD.
+ //
+ Offset = MrcOemGetPcieDeviceAddress (0, 0, 0, MRC_PCI_000_TOLUD_REG);
+ MrcOemMmioRead (Offset, &Tolud.Data, Inputs->PciEBaseAddress);
+ Tolud.Bits.Lock = 1;
+ MrcOemMmioWrite (Offset, Tolud.Data, Inputs->PciEBaseAddress);
+
+ //
+ // Lock TOUUD.
+ //
+ Offset = MrcOemGetPcieDeviceAddress (0, 0, 0, MRC_PCI_000_TOUUD_REG);
+ MrcOemMmioRead (Offset, &Touud.Data32.Low.Data, Inputs->PciEBaseAddress);
+ Touud.Data32.Low.Bits.Lock = 1;
+ MrcOemMmioWrite (Offset, Touud.Data32.Low.Data, Inputs->PciEBaseAddress);
+
+ //
+ // Lock REMAPBASE.
+ //
+ Offset = MrcOemGetPcieDeviceAddress (0, 0, 0, MRC_PCI_000_REMAPBASE_REG);
+ MrcOemMmioRead (Offset, &RemapBase.Data32.Low.Data, Inputs->PciEBaseAddress);
+ RemapBase.Data32.Low.Bits.Lock = 1;
+ MrcOemMmioWrite (Offset, RemapBase.Data32.Low.Data, Inputs->PciEBaseAddress);
+
+ //
+ // Lock REMAPLIMIT.
+ //
+ Offset = MrcOemGetPcieDeviceAddress (0, 0, 0, MRC_PCI_000_REMAPLIMIT_REG);
+ MrcOemMmioRead (Offset, &RemapLimit.Data32.Low.Data, Inputs->PciEBaseAddress);
+ RemapLimit.Data32.Low.Bits.Lock = 1;
+ MrcOemMmioWrite (Offset, RemapLimit.Data32.Low.Data, Inputs->PciEBaseAddress);
+
+ //
+ // @todo: - Confirm if this has been fixed and are who is locking TSEGMB
+ // Lock TSEGMB.
+ // Rapid Start requires TSEG_BASE access so do not lock it here.
+ //
+ // Offset = MrcOemGetPcieDeviceAddress (0, 0, 0, MRC_PCI_000_TSEGMB_REG);
+ // MrcOemMmioRead (Offset, &Tsegmb.Data, Inputs->PciEBaseAddress);
+ // Tsegmb.Bits.Lock = 1;
+ // MrcOemMmioWrite (Offset, Tsegmb.Data, Inputs->PciEBaseAddress);
+
+ //
+ // Lock DPR register
+ // Rapid Start requires DPR access so do not lock it here.
+ // System Agent RC SaSecurityLock() will lock it during ExitPmAuth callback
+ //
+
+ //
+ // Lock BDSM.
+ //
+ Offset = MrcOemGetPcieDeviceAddress (0, 0, 0, MRC_PCI_000_BDSM_REG);
+ MrcOemMmioRead (Offset, &Bdsm.Data, Inputs->PciEBaseAddress);
+ Bdsm.Bits.Lock = 1;
+ MrcOemMmioWrite (Offset, Bdsm.Data, Inputs->PciEBaseAddress);
+
+ //
+ // Lock BGSM.
+ //
+ Offset = MrcOemGetPcieDeviceAddress (0, 0, 0, MRC_PCI_000_BGSM_REG);
+ MrcOemMmioRead (Offset, &Bgsm.Data, Inputs->PciEBaseAddress);
+ Bgsm.Bits.Lock = 1;
+ MrcOemMmioWrite (Offset, Bgsm.Data, Inputs->PciEBaseAddress);
+
+ //
+ // Lock MESEG_MASK.
+ //
+ Offset = MrcOemGetPcieDeviceAddress (0, 0, 0, MRC_PCI_000_MESEG_MASK_REG);
+ MrcOemMmioRead (Offset, &MeSegMask.Data32.Low.Data, Inputs->PciEBaseAddress);
+ MeSegMask.Data32.Low.Bits.Lock = 1;
+ MrcOemMmioWrite (Offset, MeSegMask.Data32.Low.Data, Inputs->PciEBaseAddress);
+
+ //
+ // Lock GGC.
+ //
+ Offset = MrcOemGetPcieDeviceAddress (0, 0, 0, MRC_PCI_000_GGC_REG);
+ MrcOemMmioRead (Offset, &Ggc.Data, Inputs->PciEBaseAddress);
+ Ggc.Bits.Ggclck = 1;
+ MrcOemMmioWrite (Offset, Ggc.Data, Inputs->PciEBaseAddress);
+
+ //
+ // Lock POWER THERMAL MANAGEMENT CONTROL
+ //
+ DdrPtmCtl.Data = MrcReadCR (MrcData, PCU_CR_DDR_PTM_CTL_PCU_REG);
+ DdrPtmCtl.Bits.LOCK_PTM_REGS_PCU = Inputs->ThermalEnables.LockPTMregs;
+ MrcWriteCR (MrcData, PCU_CR_DDR_PTM_CTL_PCU_REG, DdrPtmCtl.Data);
+
+ MRC_DEBUG_MSG (&Inputs->Debug, MSG_LEVEL_NOTE, "\nMemory map registers are locked\n");
+ }
+
+ return;
+}
+
+/**
+@brief
+ This function returns the recommended MRC boot mode.
+
+ @param[in] void - No arguments
+
+ @retval bmWarm if we are in self refresh and the DISB bit is set, otherwise returns bmCold.
+**/
+MrcBootMode
+MrcGetBootMode (
+ void
+ )
+{
+ MrcBootMode BootMode;
+ U32 Register;
+ U32 ioAddress;
+
+ ioAddress = (U32) MrcOemGetPciDeviceAddress (
+ GENERAL_PM_CONFIGURATION_2_BUS_ADDRESS,
+ GENERAL_PM_CONFIGURATION_2_DEVICE_ADDRESS,
+ GENERAL_PM_CONFIGURATION_2_FUNCTION_ADDRESS,
+ GENERAL_PM_CONFIGURATION_2
+ );
+
+ MrcOemOutPort32 (MrcOemPciIndex (), ioAddress);
+ //
+ // We read 32 bits but we need only 8 bits of GENERAL_PM_CONFIGURATION_2 that start at offset 0xA2 and not 0xA0.
+ //
+ Register = (MrcOemInPort32 (MrcOemPciData ()) >> 16);
+
+ if ((Register & GENERAL_PM_CONFIGURATION_2_MEM_SR_MASK) == GENERAL_PM_CONFIGURATION_2_MEM_SR_MASK &&
+ (Register & GENERAL_PM_CONFIGURATION_2_DISB_MASK) == GENERAL_PM_CONFIGURATION_2_DISB_MASK
+ ) {
+ BootMode = bmWarm;
+ } else {
+ BootMode = bmCold;
+ }
+
+ return BootMode;
+}
+//
+// @todo: - Need to find out if we need it for PCH used in HSW timeframe
+//
+/**
+@brief
+ This function sets the DISB bit in General PM Configuration 2 B:D:F 0,31,0 offset 0xA2.
+
+ @param[in] void - No arguments
+
+ @retval Nothing.
+**/
+void
+MrcSetDISB (
+ void
+ )
+{
+ U32 Register;
+ U32 ioAddress;
+
+ ioAddress = (U32) MrcOemGetPciDeviceAddress (
+ GENERAL_PM_CONFIGURATION_2_BUS_ADDRESS,
+ GENERAL_PM_CONFIGURATION_2_DEVICE_ADDRESS,
+ GENERAL_PM_CONFIGURATION_2_FUNCTION_ADDRESS,
+ GENERAL_PM_CONFIGURATION_2
+ );
+
+ MrcOemOutPort32 (MrcOemPciIndex (), ioAddress);
+ Register = MrcOemInPort32 (MrcOemPciData ());
+
+ //
+ // GENERAL_PM_CONFIGURATION_2 start in A2 and not in A0.
+ //
+ Register |= (GENERAL_PM_CONFIGURATION_2_DISB_MASK << 16);
+
+ MrcOemOutPort32 (MrcOemPciIndex (), ioAddress);
+ MrcOemOutPort32 (MrcOemPciData (), Register);
+}
+
+/**
+@brief
+ This function resets the DISB bit in General PM Configuration 2 B:D:F 0,31,0 offset 0xA2.
+
+ @param[in] void - No arguments
+
+ @retval Nothing.
+**/
+void
+MrcResetDISB (
+ void
+ )
+{
+ U32 Register;
+ U32 ioAddress;
+
+ ioAddress = (U32) MrcOemGetPciDeviceAddress (
+ GENERAL_PM_CONFIGURATION_2_BUS_ADDRESS,
+ GENERAL_PM_CONFIGURATION_2_DEVICE_ADDRESS,
+ GENERAL_PM_CONFIGURATION_2_FUNCTION_ADDRESS,
+ GENERAL_PM_CONFIGURATION_2
+ );
+
+ MrcOemOutPort32 (MrcOemPciIndex (), ioAddress);
+ Register = MrcOemInPort32 (MrcOemPciData ());
+
+ //
+ // GENERAL_PM_CONFIGURATION_2 address is A2 and not A0.
+ //
+ Register &= ((~(GENERAL_PM_CONFIGURATION_2_DISB_MASK)) << 16);
+
+ MrcOemOutPort32 (MrcOemPciIndex (), ioAddress);
+ MrcOemOutPort32 (MrcOemPciData (), Register);
+}
+
+/**
+@brief
+ This function reads the CAPID0 register and sets the memory controller's capability.
+
+ @param[in, out] MrcData - All the MRC global data.
+
+ @retval Returns mrcSuccess if the memory controller's capability has been determined, otherwise returns mrcFail.
+**/
+MrcStatus
+MrcMcCapability (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ const MrcInput *Inputs;
+ const MrcDebug *Debug;
+ MrcSaveData *Save;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ MrcDimmOut *DimmOut;
+ BOOL EccSupport;
+ BOOL IgnoreNonEccDimm;
+ MRC_PCI_000_CAPID0_STRUCT Capid0Reg;
+ MRC_PCI_000_DEVEN_STRUCT Deven;
+ MrcProfile Profile;
+ U32 ChannelCount;
+ U32 DimmCount;
+ U32 Max;
+ U32 Size;
+ U32 ChannelNum;
+ U32 DimmNum;
+ U32 ChDimmCount;
+ U32 Offset;
+ U16 NModeMinimum;
+ U8 Controller;
+ U8 Channel;
+ U8 Dimm;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ Save = &MrcData->SysSave.Save.Data;
+ Debug = &Inputs->Debug;
+ ChDimmCount = MAX_DIMMS_IN_CHANNEL;
+ Profile = Inputs->MemoryProfile;
+
+ //
+ // Obtain the capabilities of the memory controller.
+ //
+ Offset = MrcOemGetPcieDeviceAddress (0, 0, 0, MRC_PCI_000_CAPID0_REG);
+ MrcOemMmioRead (Offset, &Capid0Reg.Data32.A.Data, Inputs->PciEBaseAddress);
+ MrcOemMmioRead (Offset + 4, &Capid0Reg.Data32.B.Data, Inputs->PciEBaseAddress);
+ Save->McCapId.Data = Capid0Reg.Data;
+
+ Offset = MrcOemGetPcieDeviceAddress (0, 0, 0, MRC_PCI_000_DEVEN_REG);
+ MrcOemMmioRead (Offset, &Deven.Data, Inputs->PciEBaseAddress);
+
+ //
+ // Determine if the internal graphics engine is supported.
+ //
+ if ((Capid0Reg.Data32.A.Bits.IGD == 0) && (Deven.Bits.D2EN > 0)) {
+ Outputs->GraphicsStolenSize = Inputs->GraphicsStolenSize;
+ Outputs->GraphicsGttSize = Inputs->GraphicsGttSize;
+ } else {
+ Outputs->GraphicsStolenSize = 0;
+ Outputs->GraphicsGttSize = 0;
+ }
+
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "Memory allocated for IGD = %uMB and for GTT = %uMB.\n",
+ Outputs->GraphicsStolenSize,
+ Outputs->GraphicsGttSize
+ );
+
+ //
+ // Determine the maximum size of memory per channel, based on fuses.
+ //
+ switch (Capid0Reg.Data32.A.Bits.DDRSZ) {
+ case tcs16GB:
+ Outputs->MrcTotalChannelLimit = (16 * 1024);
+ break;
+
+ case tcs8GB:
+ Outputs->MrcTotalChannelLimit = (8 * 1024);
+ break;
+
+ case tcs2GB:
+ Outputs->MrcTotalChannelLimit = (2 * 1024);
+ break;
+
+ case tcs512MB:
+ default:
+ Outputs->MrcTotalChannelLimit = (512);
+ break;
+ }
+
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "Maximum size of memory allowed on a channel = %uMB.\n",
+ Outputs->MrcTotalChannelLimit
+ );
+
+ //
+ // Determine how many channels are supported on this memory controller,
+ // based on fuse and how many channels have DIMMs installed.
+ //
+ ChannelCount = (Capid0Reg.Data32.A.Bits.PDCD == 0) ? MAX_CHANNEL : 1;
+ DimmCount = (Capid0Reg.Data32.A.Bits.DDPCD == 0) ? MAX_DIMMS_IN_CHANNEL : 1;
+
+#ifdef ULT_FLAG
+ if (Inputs->CpuModel == cmHSW_ULT) {
+ //
+ // Only 1DPC is supported on ULT platform
+ //
+ DimmCount = 1;
+ }
+#endif // ULT_FLAG
+
+#ifdef EMBEDDED_FLAG
+ if (Inputs->BoardType == btCRBEMB) {
+ //
+ // Only 1DPC is supported on EMBEDDED platform
+ //
+ DimmCount = 1;
+ }
+#endif
+
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "Number of channels supported = %u\nNumber of DIMMs per channel supported = %u\n",
+ ChannelCount,
+ DimmCount
+ );
+
+ //
+ // Determine the minimum NMode supported on this memory controller.
+ //
+ NModeMinimum = (Capid0Reg.Data32.A.Bits.D1NM == 0) ? 1 : 2;
+
+ //
+ // Determine the ECC capability of the memory controller.
+ //
+ IgnoreNonEccDimm = (Capid0Reg.Data32.A.Bits.FDEE == 0) ? FALSE : TRUE;
+
+ //
+ // Set EccSupport flag to TRUE if we must NOT ignore ECC DIMMs
+ //
+ if (IgnoreNonEccDimm == TRUE) {
+ Outputs->EccSupport = TRUE;
+ EccSupport = TRUE; // FDEE has presedence over ECCDIS
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "ALL DIMMs MUST be ECC capable\n");
+ } else {
+ EccSupport = ((Capid0Reg.Data32.A.Bits.ECCDIS > 0) || (Outputs->EccSupport == FALSE)) ? FALSE : TRUE;
+ }
+ //
+ // Now copy ECC and NMode information to the channel and DIMM results.
+ //
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ if (ChannelOut->Status == CHANNEL_PRESENT) {
+ if ((NModeMinimum >= 2) ||
+ ((Inputs->MemoryProfile == STD_PROFILE) &&
+ ((Outputs->Frequency > f1867) || ((ChannelOut->DimmCount >= 2) && (Outputs->Frequency >= f1333))))) {
+ ChannelOut->Timing[Profile].NMode = MAX (2, ChannelOut->Timing[Profile].NMode);
+ }
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ if (DimmOut->Status == DIMM_PRESENT) {
+ DimmOut->Timing[Profile].NMode = ChannelOut->Timing[Profile].NMode;
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ " %s %u/%u/%u NMode = %u\n",
+ CcdString,
+ Controller,
+ Channel,
+ Dimm,
+ DimmOut->Timing[Profile].NMode
+ );
+ if (EccSupport == TRUE) {
+ if ((DimmOut->EccSupport == FALSE) && (IgnoreNonEccDimm == TRUE)) {
+ DimmOut->Status = DIMM_DISABLED;
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ " %s %u/%u/%u Disabling non-ECC capable DIMM\n",
+ CcdString,
+ Controller,
+ Channel,
+ Dimm
+ );
+ } else if (DimmOut->EccSupport == TRUE) {
+ DimmOut->EccSupport = TRUE;
+ DimmOut->SdramCount = MAX_SDRAM_IN_DIMM;
+ } else {
+ DimmOut->SdramCount = MAX_SDRAM_IN_DIMM - 1;
+ Outputs->EccSupport = FALSE; // Final ECCSupport must be disabled if one DIMM is NOT capable
+ }
+ } else {
+ DimmOut->EccSupport = FALSE;
+ DimmOut->SdramCount = MAX_SDRAM_IN_DIMM - 1;
+ Outputs->EccSupport = FALSE; // Final ECCSupport must be disabled if ECCDIS is set
+ }
+ }
+ }
+ }
+ }
+ }
+
+ //
+ // Update FInal SdramCount
+ //
+ Outputs->SdramCount = (Outputs->EccSupport == TRUE) ? MAX_SDRAM_IN_DIMM : (MAX_SDRAM_IN_DIMM - 1);
+
+ //
+ // Determine the size of memory in each channel.
+ // Also determine the channel with the largest amount.
+ //
+ Max = ChannelNum = Outputs->MemoryMapData.TotalPhysicalMemorySize = 0;
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ Size = 0;
+ if (ChannelOut->Status == CHANNEL_PRESENT) {
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ if (DimmOut->Status == DIMM_PRESENT) {
+ Size += DimmOut->DimmCapacity;
+ }
+ }
+
+ ChannelOut->Capacity = Size;
+ if (Size > Max) {
+ Max = Size;
+ ChannelNum = Channel;
+ ChDimmCount = ChannelOut->DimmCount;
+ } else if ((Size == Max) && (DimmCount == 1)) {
+ //
+ // Choose channel with least amount of DIMMs if 2DPC is disabled
+ //
+ if (ChannelOut->DimmCount < ChDimmCount) {
+ ChDimmCount = ChannelOut->DimmCount;
+ ChannelNum = Channel;
+ }
+ }
+ }
+
+ Outputs->MemoryMapData.TotalPhysicalMemorySize += ChannelOut->Capacity;
+ }
+ }
+
+ if (ChannelCount == 1) {
+ //
+ // Determine which channels are supported on this memory controller.
+ // If fused for one channel, we pick the channel with the most memory.
+ //
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ if ((ChannelOut->Status == CHANNEL_PRESENT) && (Channel != ChannelNum)) {
+ //
+ // Disable Channel don't skip DIMM capacity
+ //
+ MrcChannelDisable (MrcData, (U8) Channel, 0);
+ }
+ }
+
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "Controller configured to one channel, we've selected channel %u.\n",
+ ChannelNum
+ );
+ }
+ }
+
+ if (DimmCount == 1) {
+ //
+ // Determine which DIMMs are supported on this memory controller.
+ // If fused for one DIMM per channel, we pick the DIMM in a channel with the most memory.
+ //
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ Max = Size = DimmNum = 0;
+ if (ChannelOut->Status == CHANNEL_PRESENT) {
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ if (DimmOut->Status == DIMM_PRESENT) {
+ Size = DimmOut->DimmCapacity;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "C%uD%uDimmCapacity = 0x%x\n", Channel, Dimm, DimmOut->DimmCapacity);
+ if (Size > Max) {
+ Max = Size;
+ DimmNum = Dimm;
+ }
+ }
+ }
+
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ if ((DimmOut->Status == DIMM_PRESENT) && (Dimm != DimmNum)) {
+ DimmOut->Status = DIMM_DISABLED;
+ }
+ }
+
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "Controller configured to one DIMM per channel, we've selected channel %u, Dimm %u.\n",
+ Channel,
+ DimmNum
+ );
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "ValidRankBitMask = 0x%x\n", ChannelOut->ValidRankBitMask);
+ }
+ }
+ }
+ }
+
+ //
+ // Now that we know the enabled and disabled DIMM/Channel population,
+ // determine if all enabled DIMMS support ASR.
+ //
+ // It is necessary to have all DIMMS in ASR or no DIMMS in ASR
+ // when enabling 2x Refresh.
+ //
+ if (Inputs->RefreshRate2x == TRUE) {
+ Outputs->AutoSelfRefresh = TRUE;
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerOut = &Outputs->Controller[Controller];
+ if (ControllerOut->Status == CONTROLLER_PRESENT) {
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ if (ChannelOut->Status == CHANNEL_PRESENT) {
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ if ((DimmOut->Status == DIMM_PRESENT) && (DimmOut->AutoSelfRefresh == FALSE)) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "Channel %d, Dimm %d does not support Auto Self Refresh. Disabling ASR since 2x Refresh is enabled!\n",
+ Channel,
+ Dimm
+ );
+ Outputs->AutoSelfRefresh = FALSE;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return mrcSuccess;
+}
+
+/**
+@brief
+ This function reads the CAPID0 register and sets the memory controller's capability.
+
+ @param[in, out] MrcData - All the MRC global data.
+
+ @retval Returns mrcSuccess if the memory controller's capability has been determined, otherwise returns mrcFail.
+**/
+MrcStatus
+MrcMcCapabilityPreSpd (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ const MrcInput *Inputs;
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcFrequency FreqMax;
+ MrcFrequency FreqMax100;
+ MrcFrequency FreqMax133;
+ MrcRefClkSelect RefClk;
+ BOOL Capable;
+ MRC_PCI_000_CAPID0_STRUCT Capid0Reg;
+ U32 Capable100;
+ U32 Capable133;
+ U32 Offset;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ Debug = &Inputs->Debug;
+
+ //
+ // Obtain the capabilities of the memory controller.
+ //
+ Offset = MrcOemGetPcieDeviceAddress (0, 0, 0, MRC_PCI_000_CAPID0_REG);
+ MrcOemMmioRead (Offset, &Capid0Reg.Data32.A.Data, Inputs->PciEBaseAddress);
+ MrcOemMmioRead (Offset + 4, &Capid0Reg.Data32.B.Data, Inputs->PciEBaseAddress);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "CAPID0 = %X_%Xh\n", Capid0Reg.Data32.B.Data, Capid0Reg.Data32.A.Data);
+
+ //
+ // Determine the maximum memory frequency supported and the memory reference clock.
+ //
+ Capable = (Capid0Reg.Data32.A.Bits.DDR_OVERCLOCK > 0) ? TRUE : FALSE;
+ Capable100 = Capid0Reg.Data32.B.Bits.PLL_REF100_CFG;
+ Capable133 = Capid0Reg.Data32.B.Bits.DMFC;
+ Outputs->RefClk = Inputs->RefClk;
+ Outputs->FreqMax = ((Inputs->FreqMax > fNoInit) && (Inputs->FreqMax < fUnSupport)) ? Inputs->FreqMax : f2667;
+
+ if (Capable100 == 0) {
+ Outputs->RefClk = MRC_REF_CLOCK_133;
+ }
+
+ RefClk = Outputs->RefClk;
+ if (Capable) {
+ Capable133 = 0;
+ if (Capable100 > 0) {
+ Capable100 = CAPID0_B_PLL_REF100_CFG_MAX;
+ Outputs->Capable100 = TRUE;
+ }
+ }
+
+ FreqMax100 = (Capable100 == 0) ? fNoInit : MrcRatioToFrequency (MrcData, (MrcClockRatio) Capable100 + 6, MRC_REF_CLOCK_100, BCLK_DEFAULT);
+ FreqMax133 = MrcRatioToFrequency (MrcData, (MrcClockRatio) ((Capable133 == 0) ? 10 : 11 - Capable133), MRC_REF_CLOCK_133, BCLK_DEFAULT);
+ //
+ // If overclocking is supported, then there is no frequency limitation, otherwise check for limitation.
+ // Note 1: If we are using standard memory profile, DIMMS should run at RefClk 133.
+ // Note 2: If the 2 values are equal, then we want to pick RefClk 133.
+ //
+
+ if (Inputs->MemoryProfile == STD_PROFILE) {
+ FreqMax = FreqMax133;
+ RefClk = MRC_REF_CLOCK_133;
+ } else {
+ if (Capable) {
+ FreqMax = (RefClk == MRC_REF_CLOCK_100) ? FreqMax100 : FreqMax133;
+ } else if (FreqMax100 > FreqMax133) {
+ FreqMax = FreqMax100;
+ RefClk = MRC_REF_CLOCK_100;
+ } else {
+ FreqMax = FreqMax133;
+ RefClk = MRC_REF_CLOCK_133;
+ }
+ }
+
+ if (FreqMax < Outputs->FreqMax) {
+ Outputs->FreqMax = FreqMax;
+ Outputs->RefClk = RefClk;
+ }
+
+ Outputs->MemoryClockMax = ConvertFreq2Clock (MrcData, Outputs->FreqMax, NULL);
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "The maximum memory frequency allowed is %u (%ufs)\n", Outputs->FreqMax, Outputs->MemoryClockMax);
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "%uMHz reference clock is selected\n",
+ (Outputs->RefClk == MRC_REF_CLOCK_133) ? 133 : 100
+ );
+
+ return mrcSuccess;
+}
+
+/**
+@brief
+ This function sets the appropriate timing overrides in the output structure
+ prior to Spd processing.
+
+ @param[in, out] MrcData - All the MRC global data.
+
+ @retval Returns mrcSuccess if the timing overrides have been conpleted.
+**/
+MrcStatus
+MrcSetOverridesPreSpd (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ return mrcSuccess;
+}
+
+/**
+@brief
+ This function reads the input data structure and sets the appropriate timing overrides in the output structure.
+
+ @param[in, out] MrcData - All the MRC global data.
+
+ @retval Returns mrcSuccess if the timing overrides have been conpleted.
+**/
+MrcStatus
+MrcSetOverrides (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ const MrcDebug *Debug;
+ const MrcInput *Inputs;
+ MrcOutput *Outputs;
+ MPCOHTRK_CR_GDXC_MOT_REGION_STRUCT GdxcMotRegion;
+ MPCOHTRK_CR_GDXC_OCLA_REGION_STRUCT GdxcOclaRegion;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ Debug = &Inputs->Debug;
+
+ Outputs->EccSupport = Inputs->EccSupport;
+ Outputs->VddVoltageDone = FALSE;
+
+ Outputs->Gdxc.GdxcEnable = Inputs->Gdxc.GdxcEnable;
+
+ //
+ // Read MOT register
+ //
+ MrcOemMmioRead (MPCOHTRK_CR_GDXC_MOT_REGION_REG, &GdxcMotRegion.Data, Inputs->GdxcBaseAddress);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "----- GDXC MOT LOW : 0x%x\n", GdxcMotRegion.Bits.START_ADDRESS);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "----- GDXC MOT UPP : 0x%x\n", GdxcMotRegion.Bits.END_ADDRESS);
+ if (GdxcMotRegion.Bits.START_ADDRESS == 0 && GdxcMotRegion.Bits.END_ADDRESS > 1) {
+ Outputs->Gdxc.GdxcMotSize = (U8) (GdxcMotRegion.Bits.END_ADDRESS);
+ } else {
+ Outputs->Gdxc.GdxcMotSize = Inputs->Gdxc.GdxcMotSize;
+ }
+ //
+ // Read OCLA register
+ //
+ MrcOemMmioRead (MPCOHTRK_CR_GDXC_OCLA_REGION_REG, &GdxcOclaRegion.Data, Inputs->GdxcBaseAddress);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "----- GDXC IOT LOW : 0x%x\n", GdxcOclaRegion.Bits.START_ADDRESS);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "----- GDXC IOT UPP : 0x%x\n", GdxcOclaRegion.Bits.END_ADDRESS);
+
+ if (GdxcOclaRegion.Bits.START_ADDRESS == 0 && GdxcOclaRegion.Bits.END_ADDRESS > 1) {
+ Outputs->Gdxc.GdxcIotSize = (U8) (GdxcOclaRegion.Bits.END_ADDRESS);
+ } else {
+ Outputs->Gdxc.GdxcIotSize = Inputs->Gdxc.GdxcIotSize;
+ }
+
+ return mrcSuccess;
+}
+
+/**
+@brief
+ This function set the WM0-5 values. Those values are be using by the graphics driver.
+ need to be call after PU_MRC_DONE bit is set to 1.
+
+ @param[in] MrcData - include all the MRC data.
+
+ @retval Nothing.
+
+ **/
+void
+MrcWmRegSet (
+ IN MrcParameters *const MrcData
+ )
+{
+ M_PCU_CR_SSKPD_PCU_STRUCT CrSskpdPcu;
+
+ CrSskpdPcu.Data = 0;
+ CrSskpdPcu.Bits.NewWM0 = PCU_CR_SSKPD_PCU_NEW_WM0_DEF;
+ CrSskpdPcu.Bits.WM4 = PCU_CR_SSKPD_PCU_WM4_DEF;
+ CrSskpdPcu.Bits.WM3 = PCU_CR_SSKPD_PCU_WM3_DEF;
+ CrSskpdPcu.Bits.WM2 = PCU_CR_SSKPD_PCU_WM2_DEF;
+ CrSskpdPcu.Bits.WM1 = PCU_CR_SSKPD_PCU_WM1_DEF;
+ CrSskpdPcu.Bits.OldWM0 = PCU_CR_SSKPD_PCU_OLD_WM0_DEF;
+ MrcWriteCR64 (MrcData, PCU_CR_SSKPD_PCU_REG, CrSskpdPcu.Data);
+ return;
+}
+
+
+#ifdef ULT_FLAG
+/**
+@brief
+ Program DDRPL_CR_DDR_TX_DELAY if Memory Trace is enabled
+
+ @param[in] MrcData - The MRC general data.
+
+ @retval None
+**/
+void
+MrcSetDdrplTxDelay (
+ IN MrcParameters *const MrcData
+ )
+{
+ MrcInput *Inputs;
+ MrcOutput *Outputs;
+ MrcChannelOut *ChannelOut;
+ U32 Rank;
+ U32 TxDelay;
+ U32 Roundtrip;
+ U32 tCL;
+ U32 tWCL;
+ U32 CmdDelay;
+ U32 CmdStretch;
+ U32 DecWrd;
+ U32 AddWrDelay;
+ U32 tWCL5_reduction;
+ U32 StretchMode;
+ DDRPL_CR_DDR_TX_DELAY_STRUCT DdrTxDelay;
+ MCHBAR_CH0_CR_SC_ROUNDT_LAT_STRUCT ScRoundtLat;
+ MCHBAR_CH0_CR_SC_WR_ADD_DELAY_STRUCT ScWrAddDelay;
+ MCHBAR_CH0_CR_TC_BANK_RANK_A_STRUCT TcBankRankA;
+ MCHBAR_CH0_CR_TC_BANK_RANK_B_STRUCT TcBankRankB;
+ MCHBAR_CH0_CR_TC_BANK_RANK_D_STRUCT TcBankRankD;
+ MCSCHEDS_CR_STM_CONFIG_STRUCT StmConfig;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+
+ if (!Inputs->MemoryTrace) {
+ return;
+ }
+
+ //
+ // TxDelay(rank) = Roundtrip(rank) - [2*RD_cmd2data_dclk_delay] + [2*Dec_WRD] - additional_wr_delay(rank) - [2*tCWL5_reduction] + [8*(STM - 1)] + Constant(5)
+ //
+ // RD_cmd2data_dclk_delay = tCL + tDQSCK + cmd_delay + cmd_stretch
+ // tCL, tDQSCK - according to JEDEC spec
+ // cmd_delay - MCSCHEDS_CR_TC_BANK_RANK_D. cmd_delay
+ // cmd_stretch - MCSCHEDS_CR_TC_BANK_RANK_A. cmd_stretch (0,1,2 for 1N,2N,3N respectively)
+ //
+ // tCWL5_reduction = (ddr_type==DDR3 && (tCWL + cmd_stretch - Dec_WRD == 5)) ? 1 : 0;
+ //
+ // STM = (STM_mode == SYSTEM ? STM_stf : 1)
+
+ //
+ // Assume we are tracing DDR channel 0 - taking all the timing parameters from Channel 0
+ //
+
+ ChannelOut = &Outputs->Controller[0].Channel[0];
+
+ ScRoundtLat.Data = MrcReadCR (MrcData, MCHBAR_CH0_CR_SC_ROUNDT_LAT_REG);
+ ScWrAddDelay.Data = MrcReadCR (MrcData, MCHBAR_CH0_CR_SC_WR_ADD_DELAY_REG);
+ StmConfig.Data = MrcReadCR (MrcData, MCSCHEDS_CR_STM_CONFIG_REG);
+ TcBankRankA.Data = ChannelOut->MchbarBANKRANKA;
+ TcBankRankB.Data = ChannelOut->MchbarBANKRANKB;
+ TcBankRankD.Data = ChannelOut->MchbarBANKRANKD;
+ tCL = TcBankRankD.UltBits.tCL;
+ tWCL = TcBankRankD.UltBits.tWCL;
+ CmdDelay = TcBankRankD.UltBits.cmd_delay;
+ CmdStretch = TcBankRankA.Bits.CMD_stretch;
+ DecWrd = TcBankRankB.Bits.Dec_WRD;
+
+ if ((Outputs->DdrType == MRC_DDR_TYPE_DDR3) && (tWCL + CmdStretch - DecWrd == 5)) {
+ tWCL5_reduction = 1;
+ } else {
+ tWCL5_reduction = 0;
+ }
+
+ if (StmConfig.Bits.Stretch_mode == 2) {
+ StretchMode = StmConfig.Bits.STF;
+ } else {
+ StretchMode = 1;
+ }
+
+ DdrTxDelay.Data = 0;
+ MRC_DEBUG_MSG (&Inputs->Debug, MSG_LEVEL_NOTE, "TX Delay values for Memory Trace:\n");
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if (!MrcRankInChannelExist (MrcData, (U8) Rank, 0)) {
+ continue;
+ }
+
+ Roundtrip = (ScRoundtLat.Data >> (Rank * 8)) & MCHBAR_CH0_CR_SC_ROUNDT_LAT_Lat_R0D0_MSK;
+ AddWrDelay = (ScWrAddDelay.Data >> (Rank * 2)) & MCHBAR_CH0_CR_SC_WR_ADD_DELAY_D0R0_MSK;
+
+ TxDelay = Roundtrip - (2 * tCL + 1 + 2 * CmdDelay + 2 * CmdStretch) +
+ 2 * DecWrd - 2 * AddWrDelay - 2 * tWCL5_reduction + 8 * (StretchMode - 1) + 5;
+
+ DdrTxDelay.Data |= ((TxDelay & DDRPL_CR_DDR_TX_DELAY_Tx_Delay_R0_MSK) << (Rank * DDRPL_CR_DDR_TX_DELAY_Tx_Delay_R0_WID));
+
+ MRC_DEBUG_MSG (
+ &Inputs->Debug,
+ MSG_LEVEL_NOTE,
+ "Rank%u:\n RT = %u\n tCL = %u\n cmd_delay = %u\n CMD_stretch = %u\n Dec_WRD = %u\n AddWrDelay = %u\n tWCL5_reduction = %u\n STM = %u\n",
+ Rank,
+ Roundtrip,
+ tCL,
+ CmdDelay,
+ CmdStretch,
+ DecWrd,
+ AddWrDelay,
+ tWCL5_reduction,
+ StretchMode
+ );
+ }
+
+ MRC_DEBUG_MSG (&Inputs->Debug, MSG_LEVEL_NOTE, "DDRPL_CR_DDR_TX_DELAY = 0x%08X\n", DdrTxDelay.Data);
+
+ MrcOemMmioWrite (DDRPL_CR_DDR_TX_DELAY_REG, DdrTxDelay.Data, Inputs->GdxcBaseAddress);
+}
+#endif // ULT_FLAG
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcGeneral.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcGeneral.h
new file mode 100644
index 0000000..04bd977
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcGeneral.h
@@ -0,0 +1,303 @@
+/** @file
+ MRC Common / Generic functions
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+#ifndef _MrcGeneral_h_
+#define _MrcGeneral_h_
+
+#include "MrcTypes.h"
+#include "MrcApi.h"
+#include "MrcAddressDecodeConfiguration.h"
+#include "MrcCommon.h"
+#include "MrcCrosser.h"
+#include "MrcDebugHook.h"
+//
+// #include "MrcMemoryClean.h"
+//
+#include "MrcOem.h"
+#include "MrcPowerModes.h"
+//
+// #include "MrcRefreshConfiguration.h"
+//
+#include "MrcSpdProcessing.h"
+
+#define GENERAL_PM_CONFIGURATION_2_BUS_ADDRESS (0)
+#define GENERAL_PM_CONFIGURATION_2_DEVICE_ADDRESS (31)
+#define GENERAL_PM_CONFIGURATION_2_FUNCTION_ADDRESS (0)
+
+#define GENERAL_PM_CONFIGURATION_2 ((0xA2) & (~0x03))
+
+#define GENERAL_PM_CONFIGURATION_2_DISB_OFFSET (0x7)
+#define GENERAL_PM_CONFIGURATION_2_DISB_WIDTH (0x1)
+#define GENERAL_PM_CONFIGURATION_2_DISB_MASK (0x80)
+#define GENERAL_PM_CONFIGURATION_2_DISB_DEFAULT (0x0)
+
+#define GENERAL_PM_CONFIGURATION_2_MEM_SR_OFFSET (0x5)
+#define GENERAL_PM_CONFIGURATION_2_MEM_SR_WIDTH (0x1)
+#define GENERAL_PM_CONFIGURATION_2_MEM_SR_MASK (0x20)
+#define GENERAL_PM_CONFIGURATION_2_MEM_SR_DEFAULT (0x0)
+
+#define MEMORY_TEST_CACHELINE (100) ///< max number can be 100 from one rank
+///
+/// Define the total memory size of a channel.
+///
+typedef enum {
+ tcs16GB, ///< 16 GB per channel
+ tcs8GB, ///< 8 GB
+ tcs2GB, ///< 2 GB
+ tcs512MB ///< 512 MB
+} MrcTotalChannelSize;
+
+extern MrcUpmPwrRetrainLimits InitialLimits[MRC_NUMBER_UPM_PWR_RETRAIN_MARGINS];
+
+/**
+ Thisfunction performs Software Memory testing
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval Always returns mrcSuccess.
+**/
+extern
+MrcStatus
+MrcHwMemTest (
+ IN MrcParameters *const MrcData
+ );
+
+/**
+ This function changes the MC to normal mode, enables the ECC if needed, lock configuration and set PU_MRC_Done.
+ If the ECC is enabled, this function should be called after memory is cleaned.
+
+ @param[in, out] MrcData - Include all MRC global data.
+
+ @retval Always returns mrcSuccess.
+**/
+extern
+MrcStatus
+MrcMcActivate (
+ IN OUT MrcParameters *const MrcData
+ );
+
+/**
+ This function enables Normal Mode and configures the Power Down Modes
+ for the boot flows other than Cold Boot.
+
+ @param[in] MrcData - The MRC general data.
+
+ @retval Always returns mrcSuccess.
+**/
+extern
+MrcStatus
+MrcNormalMode (
+ IN MrcParameters *const MrcData
+ );
+
+/**
+ This function is the last funtion that call from the MRC core.
+ The function set DISB and set the MRC_Done.
+
+ @param[in, out] MrcData - include all the MRC general data.
+
+ @retval Always returns mrcSuccess.
+**/
+extern
+MrcStatus
+MrcDone (
+ IN OUT MrcParameters *const MrcData
+ );
+
+/**
+ Print the MRC version to the MRC output device.
+
+ @param[in] Debug - Pointer to the MRC Debug structure.
+ @param[in] Version - The MRC version.
+
+ @retval Nothing.
+**/
+extern
+void
+MrcVersionPrint (
+ IN const MrcParameters *MrcData,
+ IN const MrcVersion *Version
+ );
+
+/**
+ This function return the MRC version.
+
+ @param[out] Version - Location to store the MRC version.
+
+ @retval Nothing.
+**/
+extern
+void
+MrcVersionGet (
+ OUT MrcVersion *const Version
+ );
+
+/**
+ This function set the MRC vertion to MCDECS_SPARE register.
+ The function need to be call by the wrapper after MrcStartMemoryConfiguration function where the MC CLK enable.
+ The function write:
+ Major number to bits 16-23
+ Minor number to bits 8-15
+ Build number to bits 0 - 7
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval Nothing.
+**/
+extern
+MrcStatus
+MrcSetMrcVersion (
+ IN MrcParameters *const MrcData
+ );
+
+/**
+ This function locks the memory controller and memory map registers.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval Nothing.
+**/
+extern
+void
+McRegistersLock (
+ IN MrcParameters *const MrcData
+ );
+
+/**
+ This function returns the recommended MRC boot mode.
+
+ @param[in] void - No arguments
+
+ @retval bmWarm if we are in self refresh and the DISB bit is set, otherwise returns bmCold.
+**/
+extern
+MrcBootMode
+MrcGetBootMode (
+ void
+ );
+
+/**
+ This function sets the DISB bit in General PM Configuration 2 B:D:F 0,31,0 offset 0xA2.
+
+ @param[in] void - No arguments
+
+ @retval Nothing.
+**/
+extern
+void
+MrcSetDISB (
+ void
+ );
+
+/**
+ This function resets the DISB bit in General PM Configuration 2 B:D:F 0,31,0 offset 0xA2.
+
+ @param[in] void - No arguments
+
+ @retval Nothing.
+**/
+extern
+void
+MrcResetDISB (
+ void
+ );
+
+/**
+ This function reads the CAPID0 register and sets the memory controller's capability.
+
+ @param[in, out] MrcData - All the MRC global data.
+
+ @retval Returns mrcSuccess if the memory controller's capability has been determined, otherwise returns mrcFail.
+**/
+extern
+MrcStatus
+MrcMcCapability (
+ IN OUT MrcParameters *const MrcData
+ );
+
+/**
+ This function reads the CAPID0 register and sets the memory controller's capability.
+
+ @param[in, out] MrcData - All the MRC global data.
+
+ @retval Returns mrcSuccess if the memory controller's capability has been determined, otherwise returns mrcFail.
+**/
+MrcStatus
+MrcMcCapabilityPreSpd (
+ IN OUT MrcParameters *const MrcData
+ );
+
+/**
+ This function sets the appropriate timing overrides in the output structure
+ prior to Spd processing.
+
+ @param[in, out] MrcData - All the MRC global data.
+
+ @retval Returns mrcSuccess if the timing overrides have been conpleted.
+**/
+extern
+MrcStatus
+MrcSetOverridesPreSpd (
+ IN OUT MrcParameters *const MrcData
+ );
+
+/**
+ This function reads the input data structure and sets the appropriate timing overrides in the output structure.
+
+ @param[in, out] MrcData - All the MRC global data.
+
+ @retval Returns mrcSuccess if the timing overrides have been conpleted.
+**/
+extern
+MrcStatus
+MrcSetOverrides (
+ IN OUT MrcParameters *const MrcData
+ );
+
+/**
+ This function set the WM0-5 values. Those values are be using by the graphics driver.
+ need to be call after PU_MRC_DONE bit is set to 1.
+
+ @param[in] MrcData - include all the MRC data.
+
+ @retval Nothing.
+
+ **/
+void
+MrcWmRegSet (
+ IN MrcParameters *const MrcData
+ );
+
+
+/**
+@brief
+ Program DDRPL_CR_DDR_TX_DELAY if Memory Trace is enabled
+
+ @param[in] MrcData - The MRC general data.
+
+ @retval None
+**/
+void
+MrcSetDdrplTxDelay (
+ IN MrcParameters *const MrcData
+ );
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcMemoryScrub.c b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcMemoryScrub.c
new file mode 100644
index 0000000..e140250
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcMemoryScrub.c
@@ -0,0 +1,678 @@
+/** @file
+ This file contains the memory scrubbing and alias checking functions.
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+
+**/
+
+#include "MrcTypes.h"
+#include "MrcApi.h"
+#include "MrcMemoryScrub.h"
+
+/**
+@brief
+ This function sets all the memory to a known value when ECC is enabled and
+ either we are not in warm boot or we are in warm boot and TXT is set.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval mrcSuccess if the clean succeeded, otherwise an error status.
+**/
+MrcStatus
+MrcEccClean (
+ IN MrcParameters *const MrcData
+ )
+{
+ const MrcInput *Inputs;
+ const MrcDebug *Debug;
+ const U8 WrapCarryEn[MrcReutFieldMax] = {0, 0, 0, 0};
+ const U8 WrapTriggerEn[MrcReutFieldMax] = {0, 0, 1, 0}; // Trigger Stop on Bank Wrap
+ const U8 AddrInvertEn[MrcReutFieldMax] = {0, 0, 0, 0};
+ MrcControllerOut *ControllerOut;
+ MrcDimmOut *DimmOut;
+ MrcOutput *Outputs;
+ MrcStatus Status;
+ U32 ReutSubSeqCtl0Data;
+ U8 Pattern;
+ U8 PMask;
+ U8 Rank;
+ U8 Bank;
+ U8 Channel;
+ U8 ActiveChBitMask;
+ U8 RankToDimm;
+ MRC_REUTAddress ReutAddress;
+ MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_STRUCT ReutChSeqCfg;
+ MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_CTRL_STRUCT ReutChPatWdbCl;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerOut = &Outputs->Controller[0];
+ Debug = &Inputs->Debug;
+ Status = mrcSuccess;
+ Pattern = 0;
+ PMask = 0;
+ MrcOemMemorySet ((U8 *) &ReutAddress, 0, sizeof (ReutAddress));
+
+ if ((Outputs->EccSupport == TRUE) || (Inputs->OemCleanMemory == TRUE)) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Scrubbing Memory\n");
+ ReutAddress.IncVal[MrcReutFieldCol] = 1; // Each write is 1 cache line which is 8 column addresses worth of data.
+ ReutAddress.IncVal[MrcReutFieldRow] = 1; // Walk through rows 1 at a time.
+
+ //
+ // Setup the first cache line to zeros.
+ //
+ WriteWDBFixedPattern (MrcData, &Pattern, &PMask, 1, 0);
+
+ //
+ // Setup Reut for both channels.
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!MrcChannelExist (Outputs, Channel)) {
+ continue;
+ }
+
+ //
+ // Write initial Reut Address Values.
+ //
+ MrcProgramSequenceAddress (
+ MrcData,
+ Channel,
+ ReutAddress.Start,
+ NULL, // Stop
+ ReutAddress.Order,
+ ReutAddress.IncRate,
+ ReutAddress.IncVal,
+ WrapTriggerEn,
+ WrapCarryEn,
+ AddrInvertEn,
+ 0, // AddrInvertRate
+ FALSE
+ );
+
+ //
+ // Set Reut to Write
+ //
+ ReutChSeqCfg.Data = 0;
+ ReutChSeqCfg.Bits.Initialization_Mode = REUT_Testing_Mode;
+ ReutChSeqCfg.Bits.Global_Control = 1;
+ ReutChSeqCfg.Bits.Start_Test_Delay = 2;
+ ReutChSeqCfg.Bits.Address_Update_Rate_Mode = 1;
+ ReutChSeqCfg.Bits.Stop_Base_Sequence_On_Wrap_Trigger = 1;
+ MrcWriteCR64 (
+ MrcData,
+ MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_REG +
+ ((MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_REG - MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_REG) * Channel),
+ ReutChSeqCfg.Data
+ );
+
+ //
+ // Program new loopcount registers based on stepping.
+ //
+ if (
+ (Inputs->CpuModel == cmHSW && Inputs->CpuStepping >= csHswC0) ||
+ (Inputs->CpuModel == cmCRW && Inputs->CpuStepping >= csCrwC0) ||
+ (Inputs->CpuModel == cmHSW_ULT && Inputs->CpuStepping >= csHswUltC0) ||
+ (Inputs->CpuModel == cmBDW)
+ ) {
+ MrcWriteCR (
+ MrcData,
+ MCDFXS_CR_REUT_CH_SEQ_LOOPCOUNT_LIMIT_MCMAIN_0_REG +
+ ((MCDFXS_CR_REUT_CH_SEQ_LOOPCOUNT_LIMIT_MCMAIN_1_REG - MCDFXS_CR_REUT_CH_SEQ_LOOPCOUNT_LIMIT_MCMAIN_0_REG)
+ * Channel),
+ 0
+ );
+ }
+
+ //
+ // Set up the Subsequence control.
+ //
+ ReutSubSeqCtl0Data = 0;
+ SetSubsequenceType (MrcData, &ReutSubSeqCtl0Data, BWr);
+ MrcWriteCR (
+ MrcData,
+ MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_REG +
+ ((MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_REG - MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_REG) * Channel),
+ ReutSubSeqCtl0Data
+ );
+
+ //
+ // Program Write Data Buffer Control. Since we are using 1 cache line, we only need
+ // to set the increment scale to linear.
+ //
+ ReutChPatWdbCl.Data = 0;
+ ReutChPatWdbCl.Bits.WDB_Increment_Scale = 1;
+ MrcWriteCR (
+ MrcData,
+ MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_CTRL_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_CTRL_REG - MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_CTRL_REG) * Channel),
+ ReutChPatWdbCl.Data
+ );
+ }
+
+ //
+ // Run Per Rank
+ //
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if ((MRC_BIT0 << Rank) & Outputs->ValidRankMask) {
+ //
+ // Determine the Active Channels
+ //
+ ActiveChBitMask = 0;
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ActiveChBitMask |= SelectReutRanks (MrcData, Channel, MRC_BIT0 << Rank, 0);
+ }
+
+ //
+ // Counter registers are not large enough to walk through 1 Rank for LPDDR3 support due to 11 column bits.
+ // Must walk through memory on a bank loop.
+ //
+ for (Bank = 0; Bank < 8; Bank++) {
+ ReutAddress.Start[MrcReutFieldBank] = Bank;
+ ReutAddress.Stop[MrcReutFieldBank] = Bank;
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (ActiveChBitMask & (MRC_BIT0 << Channel)) {
+ //
+ // Update Bank start/stop
+ //
+ RankToDimm = RANK_TO_DIMM_NUMBER (Rank);
+ DimmOut = &ControllerOut->Channel[Channel].Dimm[RankToDimm];
+ ReutAddress.Stop[MrcReutFieldRow] = (U16) DimmOut->RowSize - 1;
+ ReutAddress.Stop[MrcReutFieldCol] = DimmOut->ColumnSize - WDB_CACHE_LINE_SIZE;
+ ReutAddress.IncRate[MrcReutFieldRow] = DimmOut->ColumnSize / WDB_CACHE_LINE_SIZE;
+ MrcProgramSequenceAddress (
+ MrcData,
+ Channel,
+ ReutAddress.Start,
+ ReutAddress.Stop,
+ NULL, // Order
+ ReutAddress.IncRate,
+ NULL, // IncVal
+ NULL, // WrapTriggerEn
+ NULL, // WrapCarryEn
+ NULL, // AddrInvertEn
+ 0, // AddrInvertRate
+ FALSE
+ );
+ }
+ }
+
+ //
+ // Run the test
+ //
+ Status = MrcRunMemoryScrub (MrcData, ActiveChBitMask);
+ if (Status != mrcSuccess) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Rank %d error!\n", Rank);
+ break;
+ }
+ }
+ }
+
+ if (Status != mrcSuccess) {
+ break;
+ }
+ }
+
+ //
+ // Return to normal operation mode
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ ReutChSeqCfg.Data = 0;
+ ReutChSeqCfg.Bits.Initialization_Mode = NOP_Mode;
+ MrcWriteCR (
+ MrcData,
+ MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_REG +
+ ((MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_REG - MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_REG) * Channel),
+ (U32) ReutChSeqCfg.Data
+ );
+ }
+ }
+
+ if (Status != mrcSuccess) {
+ MrcOemDebugHook (MrcData, MRC_ECC_CLEAN_ERROR);
+ }
+ }
+
+ return Status;
+}
+
+/**
+@brief
+ This function performs a memory alias check.
+
+ @param[in] MrcData - The global host structure
+
+ @retval mrcSuccess or error value.
+**/
+MrcStatus
+MrcAliasCheck (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ const MrcDebug *Debug;
+ const MrcInput *Inputs;
+ const U8 WrapCarryEn[MrcReutFieldMax] = {0, 0, 0, 0};
+ const U8 WrapTriggerEn[MrcReutFieldMax] = {0, 0, 0, 0}; // Trigger Stop on Bank Wrap
+ const U8 AddrInvertEn[MrcReutFieldMax] = {0, 0, 0, 0};
+ const U16 SdramCapacityTable[] = {256, 512, 1024, 2048, 4096, 8192, 16384, 32768}; // Mb
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcDimmOut *DimmOut;
+ MrcStatus Status;
+ MrcDdrType DdrType;
+ BOOL InvalidSpdAddressingCapacity;
+ U32 SdramAddressingCapacity;
+ U32 CrOffset;
+ U16 SdramCapacity;
+ U16 WritesPerPage;
+ U16 ColumnIncValUnaligned;
+ U8 Rank;
+ U8 RankToDimm;
+ U8 Channel;
+ U8 ActiveChBitMask;
+ MRC_REUTAddress ReutAddress;
+ MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_STRUCT ReutChSeqCfg;
+ MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_CTRL_STRUCT ReutChPatWdbCl;
+ MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_STRUCT ReutChPatWdbClMuxCfg;
+ MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_STRUCT ReutSubSeqCtl;
+ MCDECS_CR_MAD_DIMM_CH0_MCMAIN_STRUCT MadDimmCh[MAX_CHANNEL];
+ MCDECS_CR_MAD_DIMM_CH0_MCMAIN_STRUCT MadDimm;
+
+ Outputs = &MrcData->SysOut.Outputs;
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ ControllerOut = &Outputs->Controller[0];
+ Status = mrcSuccess;
+ InvalidSpdAddressingCapacity = FALSE;
+ DdrType = Outputs->DdrType;
+ //
+ // Check to see if the SDRAM Addressing * Primary Bus Width == SDRAM capacity.
+ // If not, report an alias and exit.
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank += MAX_RANK_IN_DIMM) {
+ if (MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ RankToDimm = RANK_TO_DIMM_NUMBER (Rank);
+ DimmOut = &ControllerOut->Channel[Channel].Dimm[RankToDimm];
+ SdramAddressingCapacity = (DimmOut->ColumnSize * DimmOut->RowSize);
+ //
+ // Since the minimum number of row and coulmn bits are 12 and 9 respectivly,
+ // we can shift by 20 to get the result in Mb before multiplying by the bus width.
+ //
+ SdramAddressingCapacity = SdramAddressingCapacity >> 20;
+ SdramAddressingCapacity *= DimmOut->Banks;
+ SdramAddressingCapacity *= (DimmOut->BankGroups > 0) ? DimmOut->BankGroups : 1;
+ SdramAddressingCapacity *= DimmOut->SdramWidth;
+ SdramCapacity = SdramCapacityTable[DimmOut->DensityIndex];
+ if (SdramCapacity != SdramAddressingCapacity) {
+ InvalidSpdAddressingCapacity = TRUE;
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_ERROR,
+ "ERROR: Channel %d Dimm %d SPD SDRAM Adressing Capacity(0x%xMb) does not match SDRAM Capacity(0x%xMb)\nPlease verify:\n",
+ Channel,
+ RankToDimm,
+ SdramAddressingCapacity,
+ SdramCapacity
+ );
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_ERROR,
+ " Capacity: 0x%x\n RowSize: 0x%x\n ColumnSize: 0x%x\n Banks: 0x%x\n Bank Groups: 0x%x\n Device Width: 0x%x\n",
+ SdramCapacity,
+ DimmOut->RowSize,
+ DimmOut->ColumnSize,
+ DimmOut->Banks,
+ DimmOut->BankGroups,
+ DimmOut->SdramWidth
+ );
+ break;
+ }
+ }
+ }
+ }
+ //
+ // Since we will not hang the system, signal that an Alias could exist and return mrcSuccess.
+ //
+ if (TRUE == InvalidSpdAddressingCapacity) {
+ Outputs->SpdSecurityStatus = MrcSpdStatusAliased;
+ return Status;
+ }
+
+ if ((Inputs->CpuModel == cmHSW && Inputs->CpuStepping >= csHswB0) || (Inputs->CpuModel != cmHSW)) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Performing Alias Test\n");
+ MrcOemMemorySet ((U8 *) &ReutAddress, 0, sizeof (ReutAddress));
+
+ //
+ // Determine if we are ECC enabled. If so, disable ECC since the ECC scrub has yet to occur.
+ //
+ if (Outputs->EccSupport == TRUE) {
+ MRC_DEBUG_MSG(Debug, MSG_LEVEL_NOTE, "ECC enabled. Disabling ECC for the test. Must scrub after this!!!\n");
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ CrOffset = MCDECS_CR_MAD_DIMM_CH0_MCMAIN_REG +
+ ((MCDECS_CR_MAD_DIMM_CH1_MCMAIN_REG - MCDECS_CR_MAD_DIMM_CH0_MCMAIN_REG) * Channel);
+
+ MadDimmCh[Channel].Data = MrcReadCR (MrcData, CrOffset);
+ MadDimm.Data = MadDimmCh[Channel].Data;
+ MadDimm.Bits.ECC = emNoEcc;
+ MrcWriteCR (MrcData, CrOffset, MadDimm.Data);
+ }
+ }
+ }
+
+ //
+ // Test Initialization
+ //
+ //
+ // Start with IncRate = 3 so we have 4 column writes per page. This will change with Column Size.
+ // Must have 4 (reg + 1) writes to move to the next LFSR code for unique values.
+ //
+ ReutAddress.IncRate[MrcReutFieldRow] = 3;
+ //
+ // IncVal[Col] is chosen to be 1/4 of the minimum column supported to get 4 writes per page.
+ // Each write is 1 cache line (8 column addresses worth of data).
+ // IncVal is on a cache line basis when programmed. Account for this here ( >> 3).
+ //
+ ColumnIncValUnaligned = MRC_BIT10 >> 2; // divide by 4
+ ReutAddress.IncVal[MrcReutFieldCol] = ColumnIncValUnaligned >> 3; // cache line shift
+ //
+ // Smallest Row address size is 2^12, but Row_Base_Address_Increment is a 12-bit signed field [0-11].
+ // Thus we have to increment by 2^10.
+ //
+ ReutAddress.IncVal[MrcReutFieldRow] = MRC_BIT10;
+ ReutAddress.Stop[MrcReutFieldCol] = 24; // 4 ([0-3] << 3) column writes before wrapping
+ ReutAddress.Start[MrcReutFieldBank] = 1;
+ ReutAddress.Stop[MrcReutFieldBank] = 1;
+
+ //
+ // Setup Reut all present channels.
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!MrcChannelExist (Outputs, Channel)) {
+ continue;
+ }
+
+ //
+ // Write initial Reut Address Values.
+ //
+ MrcProgramSequenceAddress (
+ MrcData,
+ Channel,
+ ReutAddress.Start,
+ NULL, // Stop
+ ReutAddress.Order,
+ ReutAddress.IncRate,
+ ReutAddress.IncVal,
+ WrapTriggerEn,
+ WrapCarryEn,
+ AddrInvertEn,
+ 0,
+ FALSE
+ );
+
+ //
+ // Set Reut to Write
+ //
+ ReutChSeqCfg.Data = 0;
+ ReutChSeqCfg.Bits.Initialization_Mode = REUT_Testing_Mode;
+ ReutChSeqCfg.Bits.Global_Control = 1;
+ ReutChSeqCfg.Bits.Start_Test_Delay = 2;
+ ReutChSeqCfg.Bits.Subsequence_End_Pointer = 1;
+
+ if (
+ (Inputs->CpuModel == cmHSW && Inputs->CpuStepping < csHswC0) ||
+ (Inputs->CpuModel == cmCRW && Inputs->CpuStepping < csCrwC0) ||
+ (Inputs->CpuModel == cmHSW_ULT && Inputs->CpuStepping < csHswUltC0) ||
+ (Inputs->CpuModel == cmBDW)
+ ) {
+ ReutChSeqCfg.Bits.Loopcount = 1;
+ } else {
+ CrOffset = MCDFXS_CR_REUT_CH_SEQ_LOOPCOUNT_LIMIT_MCMAIN_0_REG +
+ ((MCDFXS_CR_REUT_CH_SEQ_LOOPCOUNT_LIMIT_MCMAIN_1_REG - MCDFXS_CR_REUT_CH_SEQ_LOOPCOUNT_LIMIT_MCMAIN_0_REG) *
+ Channel);
+ MrcWriteCR (MrcData, CrOffset, 1);
+ }
+
+ CrOffset = MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_REG +
+ ((MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_REG - MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_REG) * Channel);
+ MrcWriteCR64 (
+ MrcData,
+ CrOffset,
+ ReutChSeqCfg.Data
+ );
+
+ //
+ // Program Write Data Buffer Control.
+ //
+ ReutChPatWdbCl.Data = 0;
+ ReutChPatWdbCl.Bits.WDB_Increment_Scale = 1;
+ MrcWriteCR (
+ MrcData,
+ MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_CTRL_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_CTRL_REG - MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_CTRL_REG) * Channel),
+ ReutChPatWdbCl.Data
+ );
+
+ ReutChPatWdbClMuxCfg.Bits.ECC_Data_Source_Sel = 1;
+ ReutChPatWdbClMuxCfg.Bits.Mux2_Control = LFSRMode;
+ ReutChPatWdbClMuxCfg.Bits.Mux1_Control = LFSRMode;
+ ReutChPatWdbClMuxCfg.Bits.Mux0_Control = LFSRMode;
+ CrOffset = MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_REG - MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_REG) * Channel);
+ MrcWriteCR (MrcData, CrOffset, ReutChPatWdbClMuxCfg.Data);
+ }
+
+ //
+ // Run test Per Dimm
+ //
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank += MAX_RANK_IN_DIMM){
+ if ((MRC_BIT0 << Rank) & Outputs->ValidRankMask) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Testing Dimm %d\n", Rank / 2);
+ //
+ // Determine Active Channels
+ //
+ ActiveChBitMask = 0;
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ActiveChBitMask |= SelectReutRanks (MrcData, Channel, MRC_BIT0 << Rank, 0);
+ //
+ // Update Rank stop address based on DIMM SPD if Active.
+ //
+ if (ActiveChBitMask & (MRC_BIT0 << Channel)) {
+ RankToDimm = RANK_TO_DIMM_NUMBER (Rank);
+ DimmOut = &ControllerOut->Channel[Channel].Dimm[RankToDimm];
+ //
+ // Since we're counting cache lines and won't wrap the row address,
+ // program Row Stop to RowSize - 1 to avoid resetting the current address.
+ // Column must wrap. The wrap occurs on the increment which is after writing,
+ // to that address. Thus, we set wrap to be the last accessed column.
+ //
+ WritesPerPage = DimmOut->ColumnSize / ColumnIncValUnaligned; // Should be >= 4
+ ReutAddress.Stop[MrcReutFieldRow] = (U16) DimmOut->RowSize - 1;
+ ReutAddress.Stop[MrcReutFieldCol] = DimmOut->ColumnSize - ColumnIncValUnaligned;
+ ReutAddress.IncRate[MrcReutFieldRow] = WritesPerPage - 1; // IncRate is +1 the programmed value
+
+ MrcProgramSequenceAddress (
+ MrcData,
+ Channel,
+ NULL,
+ ReutAddress.Stop,
+ NULL,
+ ReutAddress.IncRate,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ 0,
+ FALSE
+ );
+ //
+ // Set up the Subsequence control.
+ //
+ CrOffset = MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_REG +
+ ((MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_REG - MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_REG) * Channel);
+ //
+ // @todo: Review that the settings programmed here are common between the steppings.
+ //
+ ReutSubSeqCtl.Data = 0;
+ ReutSubSeqCtl.Bits.Subsequence_Type = BWr;
+ //
+ // Instead of matching wrap addresses, we will stop on 1 less cache line write from the top.
+ // This works because when aliasing occurs, the physical addressing size must double for row/col.
+ //
+ ReutSubSeqCtl.Bits.Number_of_Cachelines = MrcLog2 (((DimmOut->RowSize / MRC_BIT10) * WritesPerPage) - 1);
+ MrcWriteCR (
+ MrcData,
+ CrOffset,
+ ReutSubSeqCtl.Data
+ );
+
+ CrOffset += MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_REG - MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_REG;
+ ReutSubSeqCtl.Bits.Reset_Current_Base_Address_To_Start = 1;
+ ReutSubSeqCtl.Bits.Subsequence_Type = BRd;
+ MrcWriteCR (
+ MrcData,
+ CrOffset,
+ ReutSubSeqCtl.Data
+ );
+ }
+ }
+
+ //
+ // Run the test
+ //
+ Status = MrcRunMemoryScrub (MrcData, ActiveChBitMask);
+ if (Status != mrcSuccess) {
+ break;
+ }
+ }
+ }
+
+ if (Outputs->EccSupport == TRUE) {
+ MRC_DEBUG_MSG(Debug, MSG_LEVEL_NOTE, "ReEnabling ECC Logic. Must scrub after this!\n");
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ CrOffset = MCDECS_CR_MAD_DIMM_CH0_MCMAIN_REG +
+ ((MCDECS_CR_MAD_DIMM_CH1_MCMAIN_REG - MCDECS_CR_MAD_DIMM_CH0_MCMAIN_REG) * Channel);
+
+ MrcWriteCR (MrcData, CrOffset, MadDimmCh[Channel].Data);
+ }
+ }
+ }
+ //
+ // Wait 4 usec after enabling the ECC IO, needed by HW
+ //
+ MrcWait (MrcData, 4 * HPET_1US);
+
+ //
+ // Return to normal operation mode
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ ReutChSeqCfg.Data = 0;
+ ReutChSeqCfg.Bits.Initialization_Mode = NOP_Mode;
+ MrcWriteCR (
+ MrcData,
+ MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_REG +
+ ((MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_REG - MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_REG) * Channel),
+ (U32) ReutChSeqCfg.Data
+ );
+ }
+ }
+ }
+
+ if (mrcSuccess != Status) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "*** Alias Detected! See REUT Error above. ***\n");
+ Outputs->SpdSecurityStatus = MrcSpdStatusAliased;
+ Status = mrcSuccess;
+ }
+
+ return Status;
+}
+
+/**
+@brief
+ This function runs the srcubbing test reporting any timeouts/errors.
+
+ @param[in] MrcData - The global host structure
+ @param[in] ChBitMask - Bitmask of channels the test is run on.
+
+ @retval mrcSuccess or error value.
+**/
+MrcStatus
+MrcRunMemoryScrub (
+ IN OUT MrcParameters *const MrcData,
+ IN U8 ChBitMask
+ )
+{
+ const MrcDebug *Debug;
+ MrcStatus Status;
+ U8 ErrorStatus;
+ U8 TestDoneStatus;
+ MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_STRUCT ReutGlobalCtl;
+ MCDFXS_CR_REUT_GLOBAL_ERR_MCMAIN_STRUCT ReutGlobalErr;
+ U32 Timer;
+
+ Status = mrcSuccess;
+ Debug = &MrcData->SysIn.Inputs.Debug;
+
+ //
+ // Setup Timer and run the test
+ //
+ Timer = (U32) MrcGetCpuTime() + 10000; // 10 Second timeout
+ ReutGlobalCtl.Data = 0;
+ ReutGlobalCtl.Bits.Global_Start_Test = 1;
+ ReutGlobalCtl.Bits.Global_Clear_Errors = 1;
+ ReutGlobalCtl.Bits.Global_Stop_Test_On_Any_Error = NSOE;
+ MrcWriteCR (MrcData, MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_REG, ReutGlobalCtl.Data);
+
+ //
+ // Wait until Channel test done status matches ChbitMask or TimeoutCounter value reaches 0;
+ //
+ do {
+ ReutGlobalErr.Data = MrcReadCR (MrcData, MCDFXS_CR_REUT_GLOBAL_ERR_MCMAIN_REG);
+ TestDoneStatus = (U8) ((ReutGlobalErr.Bits.Channel_Test_Done_Status_1 << 1) |
+ ReutGlobalErr.Bits.Channel_Test_Done_Status_0);
+ } while (((TestDoneStatus & ChBitMask) != ChBitMask) && ((U32) MrcGetCpuTime () < Timer));
+
+ if ((TestDoneStatus & ChBitMask) != ChBitMask) {
+ Status = mrcDeviceBusy;
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_ERROR,
+ "Timeout occured while running the test: ReutGlobalErr: 0x%X.\n",
+ ReutGlobalErr.Data
+ );
+ }
+
+ ErrorStatus = (U8) ((ReutGlobalErr.Bits.Channel_Error_Status_1 << 1) | ReutGlobalErr.Bits.Channel_Error_Status_0);
+ if (ErrorStatus & ChBitMask) {
+ Status = mrcReutSequenceError;
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_ERROR,
+ "REUT Error: Channel(s):%s%s\n",
+ (ReutGlobalErr.Bits.Channel_Error_Status_0 == 1) ? " 0" : "",
+ (ReutGlobalErr.Bits.Channel_Error_Status_1 == 1) ? " 1" : ""
+ );
+ }
+
+ return Status;
+}
+
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcMemoryScrub.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcMemoryScrub.h
new file mode 100644
index 0000000..d6d1695
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcMemoryScrub.h
@@ -0,0 +1,78 @@
+/** @file
+ This file contains memory scrubbing and alias checking related information.
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+**/
+
+#ifndef _MrcMemoryScrub_h_
+#define _MrcMemoryScrub_h_
+#pragma pack (push, 1)
+
+#include "MrcTypes.h"
+#include "MrcApi.h"
+#include "MrcCommon.h"
+#include "MrcDebugHook.h"
+#include "MrcGlobal.h"
+
+/**
+@brief
+ This function sets all the memory to a known value when ECC is enabled and
+ either we are not in warm boot or we are in warm boot and TXT is set.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval mrcSuccess if the clean succeeded, otherwise an error status.
+**/
+extern
+MrcStatus
+MrcEccClean (
+ IN MrcParameters *const MrcData
+ );
+
+/**
+@brief
+ This function performs a memory alias check.
+
+ @param[in] MrcData - The global host structure
+
+ @retval mrcSuccess or error value.
+**/
+extern
+MrcStatus
+MrcAliasCheck (
+ IN OUT MrcParameters *const MrcData
+ );
+
+/**
+@brief
+ This function runs the srcubbing test reporting any timeouts/errors.
+
+ @param[in] MrcData - The global host structure
+ @param[in] ChBitMask - Bitmask of channels the test is run on.
+
+ @retval mrcSuccess or error value.
+**/
+extern
+MrcStatus
+MrcRunMemoryScrub (
+ IN OUT MrcParameters *const MrcData,
+ IN U8 ChBitMask
+ );
+
+#pragma pack (pop)
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcSaveRestore.c b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcSaveRestore.c
new file mode 100644
index 0000000..89464a5
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcSaveRestore.c
@@ -0,0 +1,481 @@
+/** @file
+
+ Power state and boot mode save and restore data functions.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+
+**/
+
+//
+// Include files
+//
+#include "MrcTypes.h"
+#include "MrcCommon.h"
+#include "MrcGeneral.h"
+#include "MrcGlobal.h"
+#include "MrcOem.h"
+#include "MrcSaveRestore.h"
+#include "MrcSpdProcessing.h"
+
+//
+// ------- IMPORTANT NOTE --------
+// MRC_MC_REGISTER_COUNT in Global.h should match this table.
+// Update this define whenever you add/remove registers from this table.
+//
+// Total register count = 1872 + 624 = 2496
+//
+const SaveDataControl SaveDataArray[] = {
+ {0x0000, 0x003C}, {0x0048, 0x004C}, {0x005C, 0x0078}, // 40h + 8 + 20h = 68h => 104 * 18 = 1872
+ {0x0100, 0x013C}, {0x0148, 0x014C}, {0x015C, 0x0178},
+ {0x0200, 0x023C}, {0x0248, 0x024C}, {0x025C, 0x0278},
+ {0x0300, 0x033C}, {0x0348, 0x034C}, {0x035C, 0x0378},
+ {0x0400, 0x043C}, {0x0448, 0x044C}, {0x045C, 0x0478},
+ {0x0500, 0x053C}, {0x0548, 0x054C}, {0x055C, 0x0578},
+ {0x0600, 0x063C}, {0x0648, 0x064C}, {0x065C, 0x0678},
+ {0x0700, 0x073C}, {0x0748, 0x074C}, {0x075C, 0x0778},
+ {0x0800, 0x083C}, {0x0848, 0x084C}, {0x085C, 0x0878},
+ {0x0900, 0x093C}, {0x0948, 0x094C}, {0x095C, 0x0978},
+ {0x0A00, 0x0A3C}, {0x0A48, 0x0A4C}, {0x0A5C, 0x0A78},
+ {0x0B00, 0x0B3C}, {0x0B48, 0x0B4C}, {0x0B5C, 0x0B78},
+ {0x0C00, 0x0C3C}, {0x0C48, 0x0C4C}, {0x0C5C, 0x0C78},
+ {0x0D00, 0x0D3C}, {0x0D48, 0x0D4C}, {0x0D5C, 0x0D78},
+ {0x0E00, 0x0E3C}, {0x0E48, 0x0E4C}, {0x0E5C, 0x0E78},
+ {0x0F00, 0x0F3C}, {0x0F48, 0x0F4C}, {0x0F5C, 0x0F78},
+ {0x1000, 0x103C}, {0x1048, 0x104C}, {0x105C, 0x1078},
+ {0x1100, 0x113C}, {0x1148, 0x114C}, {0x115C, 0x1178},
+ {0x1204, 0x1208}, // 8
+ {0x1214, 0x121C}, // 12
+ {0x1304, 0x1308}, // 8
+ {0x1314, 0x131C}, // 12
+ {0x1404, 0x140C}, // 12
+ {0x1504, 0x150C}, // 12
+ {0x1808, 0x1810}, // 12
+ {0x1908, 0x1910}, // 12
+ {0x1A04, 0x1A0C}, // 12
+ {0x1B04, 0x1B0C}, // 12
+ {0x1C14, 0x1C1C}, // 12
+ {0x1D14, 0x1D1C}, // 12
+ {0x2000, 0x2008}, // 12
+ {0x3A14, 0x3A1C}, // 12
+ {0x3A24, 0x3A24}, // 4
+ {0x4000, 0x4014}, // 24
+ {0x4024, 0x4028}, // 8
+ {0x40D0, 0x40D0}, // 4
+ {0x4220, 0x4224}, // 8
+ {0x4294, 0x4294}, // 4
+ {0x429C, 0x42A0}, // 8
+ {0x42EC, 0x42FC}, // 20
+ {0x438C, 0x4390}, // 8
+ {0x4328, 0x4328}, // 4
+ {0x4400, 0x4414}, // 24
+ {0x4424, 0x4428}, // 8
+ {0x44D0, 0x44D0}, // 4
+ {0x4620, 0x4624}, // 8
+ {0x4694, 0x4694}, // 4
+ {0x469C, 0x46A0}, // 8
+ {0x46EC, 0x46FC}, // 20
+ {0x4728, 0x4728}, // 4
+ {0x478C, 0x4790}, // 8
+ {0x5884, 0x5888}, // 8
+ {0x5890, 0x589C}, // 16
+ {0x58A4, 0x58A4}, // 4
+ {0x58D0, 0x58E4}, // 24
+ {0x5880, 0x5880}, // 4
+ {0x5000, 0x50DC}, // 224
+ {0x59b8, 0x59b8} // 4
+}; // = 624
+
+/**
+@brief
+ This function verifies that neither CPU fuses or DIMMs have changed.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval mrcSuccess if fast boot is allowed, otherwise mrcColdBootRequired.
+**/
+MrcStatus
+MrcFastBootPermitted (
+ IN MrcParameters *const MrcData
+ )
+{
+ const MrcInput *Inputs;
+ const MrcDimmIn *DimmIn;
+ const U8 *CrcStart;
+ MrcSaveData *Save;
+ MrcDimmOut *DimmSave;
+ MRC_PCI_000_CAPID0_STRUCT Capid0Reg;
+ U32 CrcSize;
+ U8 Controller;
+ U8 Channel;
+ U8 Dimm;
+ U16 DimmCrc;
+ U32 Offset;
+
+ CrcStart = NULL;
+ CrcSize = 0;
+ Inputs = &MrcData->SysIn.Inputs;
+ Save = &MrcData->SysSave.Save.Data;
+
+ //
+ // Obtain the capabilities of the memory controller and see if they have changed.
+ //
+ Offset = MrcOemGetPcieDeviceAddress (0, 0, 0, MRC_PCI_000_CAPID0_REG);
+ MrcOemMmioRead (Offset, &Capid0Reg.Data32.A.Data, Inputs->PciEBaseAddress);
+ MrcOemMmioRead (Offset + 4, &Capid0Reg.Data32.B.Data, Inputs->PciEBaseAddress);
+ if (Capid0Reg.Data != Save->McCapId.Data) {
+ MRC_DEBUG_MSG (&Inputs->Debug, MSG_LEVEL_NOTE, "Capabilities have changed, cold boot required\n");
+ MRC_DEBUG_MSG (
+ &Inputs->Debug,
+ MSG_LEVEL_NOTE,
+ " '%X_%X' --> '%X_%X'\n",
+ Save->McCapId.Data32[1],
+ Save->McCapId.Data32[0],
+ Capid0Reg.Data32.B.Data,
+ Capid0Reg.Data32.A.Data
+ );
+ return mrcColdBootRequired;
+ }
+ //
+ // See if any of the DIMMs have changed.
+ //
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmIn = &Inputs->Controller[Controller].Channel[Channel].Dimm[Dimm];
+ DimmSave = &Save->Controller[Controller].Channel[Channel].Dimm[Dimm];
+ if (DimmIn->Status == DIMM_DISABLED) {
+ DimmCrc = 0;
+ } else {
+ CrcStart = MrcSpdCrcArea (MrcData, Controller, Channel, Dimm, &CrcSize);
+ GetDimmCrc ((const U8 *const) CrcStart, CrcSize, &DimmCrc);
+ }
+
+ if (DimmCrc != DimmSave->Crc) {
+ MRC_DEBUG_MSG (
+ &Inputs->Debug,
+ MSG_LEVEL_NOTE,
+ "Channel %u Dimm %u has changed, cold boot required\n",
+ Channel,
+ Dimm
+ );
+ MRC_DEBUG_MSG (&Inputs->Debug, MSG_LEVEL_NOTE, " DimmCrc %Xh, DimmSave->Crc %Xh\n", DimmCrc, DimmSave->Crc);
+ return mrcColdBootRequired;
+ }
+ }
+ }
+ }
+ //
+ // Set RestoreMRs flag to use trained Opt Param Values for Power Savings.
+ //
+ MrcData->SysOut.Outputs.RestoreMRs = TRUE;
+
+ return mrcSuccess;
+}
+
+/**
+@brief
+ This function saves any values that need to be used during non-cold boots.
+
+ @param[in, out] MrcData - Include all the MRC global data.
+
+ @retval mrcSuccess if the save occurred with no errors, otherwise returns an error code.
+**/
+MrcStatus
+MrcSaveMCValues (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ const SaveDataControl *SaveIt;
+ const MrcInput *Inputs;
+ const MrcControllerIn *ControllerIn;
+ const MrcChannelIn *ChannelIn;
+ const MrcSpd *SpdIn;
+ MrcOutput *Outputs;
+ MrcSaveData *SaveData;
+ MrcSaveHeader *SaveHeader;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ MrcContSave *ControllerSave;
+ MrcChannelSave *ChannelSave;
+ MrcSpdSave *SpdSavePtr;
+ U32 *McRegister;
+ U8 *SpdBegin;
+ MrcProfile Profile;
+ U32 Offset;
+ U32 Index;
+ U32 Value;
+ U8 Controller;
+ U8 Channel;
+ U8 Dimm;
+ U8 CopySize;
+
+ //
+ // Copy channel and DIMM information to the data area that will be saved.
+ //
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ SaveData = &MrcData->SysSave.Save.Data;
+ SaveHeader = &MrcData->SysSave.Save.Header;
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerIn = &Inputs->Controller[Controller];
+ ControllerOut = &Outputs->Controller[Controller];
+ ControllerSave = &SaveData->Controller[Controller];
+ ControllerSave->ChannelCount = ControllerOut->ChannelCount;
+ ControllerSave->Status = ControllerOut->Status;
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelIn = &ControllerIn->Channel[Channel];
+ ChannelOut = &ControllerOut->Channel[Channel];
+ ChannelSave = &ControllerSave->Channel[Channel];
+ ChannelSave->DimmCount = ChannelOut->DimmCount;
+ ChannelSave->ValidRankBitMask = ChannelOut->ValidRankBitMask;
+ ChannelSave->EccSupport = ChannelOut->EccSupport;
+ ChannelSave->Status = ChannelOut->Status;
+ for (Profile = STD_PROFILE; Profile < MAX_PROFILE; Profile++) {
+ MrcOemMemoryCpy ((U8 *) &ChannelSave->Timing[Profile], (U8 *) &ChannelOut->Timing[Profile], sizeof (MrcTiming));
+ }
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ MrcOemMemoryCpy ((U8 *) &ChannelSave->Dimm[Dimm], (U8 *) &ChannelOut->Dimm[Dimm], sizeof (MrcDimmOut));
+ SpdIn = &ChannelIn->Dimm[Dimm].Spd;
+ SpdSavePtr = &ChannelSave->SpdSave[Dimm];
+ {
+ SpdSavePtr->SmbiosData.ModuleType = SpdIn->Ddr3.General.ModuleType;
+ SpdSavePtr->SmbiosData.ModuleMemoryBusWidth = SpdIn->Ddr3.General.ModuleMemoryBusWidth;
+ SpdBegin = (U8 *) &SpdIn->Ddr3.ModuleId;
+ CopySize = sizeof (SpdSavePtr->ManufacturingData.Ddr3Data);
+ }
+ //
+ // Save just enough SPD information so it can be restored during non-cold boot.
+ //
+ MrcOemMemoryCpy ((U8 *) &SpdSavePtr->ManufacturingData, SpdBegin, CopySize);
+ } // for Dimm
+ } // for Channel
+ } // for Controller
+
+ for (Profile = STD_PROFILE; Profile < MAX_PROFILE; Profile++) {
+ SaveData->VddVoltage[Profile] = Outputs->VddVoltage[Profile];
+ }
+
+ //
+ // Copy specified memory controller MMIO registers to the data area that will be saved.
+ //
+ McRegister = SaveData->McRegister;
+ for (Index = 0; Index < (sizeof (SaveDataArray) / sizeof (SaveDataControl)); Index++) {
+ SaveIt = &SaveDataArray[Index];
+ for (Offset = SaveIt->StartMchbarOffset; Offset <= SaveIt->EndMchbarOffset; Offset += sizeof (U32)) {
+ Value = MrcReadCR (MrcData, Offset);
+ *McRegister++ = Value;
+ }
+ }
+
+//
+// ------- IMPORTANT NOTE --------
+// MeStolenSize should not be saved/restored. There is no rule stating that ME FW cannot request a different
+// amount of ME UMA space from one boot to the next. Also, if ME FW is updated/changed, the UMA Size requested
+// from the previous version should not be restored.
+//
+
+ MrcVersionGet (&SaveData->Version);
+ SaveData->CpuModel = Inputs->CpuModel;
+ SaveData->CpuStepping = Inputs->CpuStepping;
+ SaveData->Frequency = Outputs->Frequency;
+ SaveData->MemoryClock = Outputs->MemoryClock;
+ SaveData->Ratio = Outputs->Ratio;
+ SaveData->RefClk = Outputs->RefClk;
+ SaveData->EccSupport = Outputs->EccSupport;
+ SaveData->DdrType = Outputs->DdrType;
+ SaveData->XmpProfileEnable = Outputs->XmpProfileEnable;
+
+ SaveData->SaMemCfgCrc = MrcCalculateCrc32 ((U8 *) Inputs->SaMemCfgAddress, Inputs->SaMemCfgSize);
+ SaveHeader->Crc = MrcCalculateCrc32 ((U8 *) SaveData, sizeof (MrcSaveData));
+ MRC_DEBUG_MSG (&Inputs->Debug, MSG_LEVEL_NOTE, "Saved data CRC = %xh\n", SaveHeader->Crc);
+
+ return mrcSuccess;
+}
+
+/**
+@brief
+ This function copies the non-training information that needs to be restored
+ from the 'save' data structure to the 'Output' data structure.
+
+ @param[in, out] MrcData - include all the MRC global data.
+
+ @retval mrcSuccess if the copy completed with no errors, otherwise returns an error code.
+**/
+MrcStatus
+MrcRestoreNonTrainingValues (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ MrcInput *Inputs;
+ MrcControllerIn *ControllerIn;
+ MrcChannelIn *ChannelIn;
+ MrcSaveData *SaveData;
+ MrcContSave *ControllerSave;
+ MrcChannelSave *ChannelSave;
+ MrcDimmOut *DimmSave;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ MrcDimmOut *DimmOut;
+ MrcSpd *SpdIn;
+ MrcSpdSave *SpdSavePtr;
+ U8 *SpdBegin;
+ MrcProfile Profile;
+ U8 Controller;
+ U8 Channel;
+ U8 Dimm;
+ U8 CopySize;
+
+ SaveData = &MrcData->SysSave.Save.Data;
+ Outputs = &MrcData->SysOut.Outputs;
+ Inputs = &MrcData->SysIn.Inputs;
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerIn = &Inputs->Controller[Controller];
+ ControllerSave = &SaveData->Controller[Controller];
+ ControllerOut = &Outputs->Controller[Controller];
+ ControllerOut->ChannelCount = ControllerSave->ChannelCount;
+ ControllerOut->Status = ControllerSave->Status;
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelIn = &ControllerIn->Channel[Channel];
+ ChannelSave = &ControllerSave->Channel[Channel];
+ ChannelOut = &ControllerOut->Channel[Channel];
+ ChannelOut->DimmCount = ChannelSave->DimmCount;
+ ChannelOut->ValidRankBitMask = ChannelSave->ValidRankBitMask;
+ ChannelOut->EccSupport = ChannelSave->EccSupport;
+ ChannelOut->Status = ChannelSave->Status;
+ for (Profile = STD_PROFILE; Profile < MAX_PROFILE; Profile++) {
+ MrcOemMemoryCpy ((U8 *) &ChannelOut->Timing[Profile], (U8 *) &ChannelSave->Timing[Profile], sizeof (MrcTiming));
+ }
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmSave = &ChannelSave->Dimm[Dimm];
+ if (DimmSave->Status == DIMM_PRESENT || DimmSave->Status == DIMM_DISABLED) {
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ SpdIn = &ChannelIn->Dimm[Dimm].Spd;
+ SpdSavePtr = &ChannelSave->SpdSave[Dimm];
+ MrcOemMemoryCpy ((U8 *) DimmOut, (U8 *) DimmSave, sizeof (MrcDimmOut));
+ {
+ SpdIn->Ddr3.General.ModuleType = SpdSavePtr->SmbiosData.ModuleType;
+ SpdIn->Ddr3.General.ModuleMemoryBusWidth = SpdSavePtr->SmbiosData.ModuleMemoryBusWidth;
+ SpdBegin = (U8 *) &SpdIn->Ddr3.ModuleId;
+ CopySize = sizeof (SpdSavePtr->ManufacturingData.Ddr3Data);
+ }
+ //
+ // Restore just enough SPD information so it can be passed out in the HOB.
+ //
+ MrcOemMemoryCpy (SpdBegin, (U8 *) &SpdSavePtr->ManufacturingData, CopySize);
+ } // if
+ } // for Dimm
+ } // for Channel
+ } // for Controller
+
+ for (Profile = STD_PROFILE; Profile < MAX_PROFILE; Profile++) {
+ Outputs->VddVoltage[Profile] = SaveData->VddVoltage[Profile];
+ }
+
+//
+// ------- IMPORTANT NOTE --------
+// MeStolenSize should not be saved/restored. There is no rule stating that ME FW cannot request a different
+// amount of ME UMA space from one boot to the next. Also, if ME FW is updated/changed, the UMA Size requested
+// from the previous version should not be restored.
+//
+
+ Inputs->CpuModel = SaveData->CpuModel;
+ Inputs->CpuStepping = SaveData->CpuStepping;
+ Outputs->Frequency = SaveData->Frequency;
+ Outputs->MemoryClock = SaveData->MemoryClock;
+ Outputs->Ratio = SaveData->Ratio;
+ Outputs->RefClk = SaveData->RefClk;
+ Outputs->EccSupport = SaveData->EccSupport;
+ Outputs->DdrType = SaveData->DdrType;
+ Outputs->XmpProfileEnable = SaveData->XmpProfileEnable;
+
+ return mrcSuccess;
+}
+
+/**
+@brief
+ This function writes the previously determined training values back to the memory controller.
+
+ @param[in] MrcData - Include all the MRC global data.
+
+ @retval mrcSuccess if the memory controller write back completed with no errors, otherwise returns an error code.
+**/
+MrcStatus
+MrcRestoreTrainingValues (
+ IN MrcParameters *const MrcData
+ )
+{
+ const SaveDataControl *RestoreIt;
+ U32 *McRegister;
+ U32 Offset;
+ U32 Index;
+ U32 Value;
+
+ McRegister = MrcData->SysSave.Save.Data.McRegister;
+ for (Index = 0; Index < (sizeof (SaveDataArray) / sizeof (SaveDataControl)); Index++) {
+ RestoreIt = &SaveDataArray[Index];
+ for (Offset = RestoreIt->StartMchbarOffset; Offset <= RestoreIt->EndMchbarOffset; Offset += sizeof (U32)) {
+ Value = *McRegister++;
+ MrcWriteCR (MrcData, Offset, Value);
+ }
+ }
+
+ return mrcSuccess;
+}
+
+/**
+@brief
+ Calculates a CRC-32 of the specified data buffer.
+
+ @param[in] Data - Pointer to the data buffer.
+ @param[in] DataSize - Size of the data buffer, in bytes.
+
+ @retval The CRC-32 value.
+**/
+U32
+MrcCalculateCrc32 (
+ IN const U8 *const Data,
+ IN const U32 DataSize
+ )
+{
+ U32 i;
+ U32 j;
+ U32 crc;
+ U32 CrcTable[256];
+
+ crc = (U32) (-1);
+
+ //
+ // Initialize the CRC base table.
+ //
+ for (i = 0; i < 256; i++) {
+ CrcTable[i] = i;
+ for (j = 8; j > 0; j--) {
+ CrcTable[i] = (CrcTable[i] & 1) ? (CrcTable[i] >> 1) ^ 0xEDB88320 : CrcTable[i] >> 1;
+ }
+ }
+ //
+ // Calculate the CRC.
+ //
+ for (i = 0; i < DataSize; i++) {
+ crc = (crc >> 8) ^ CrcTable[(U8) crc ^ (Data)[i]];
+ }
+
+ return ~crc;
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcSaveRestore.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcSaveRestore.h
new file mode 100644
index 0000000..e752cd4
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcSaveRestore.h
@@ -0,0 +1,117 @@
+/** @file
+ Power state and boot mode save and restore data functions.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+#ifndef _MrcSaveRestore_h_
+#define _MrcSaveRestore_h_
+#pragma pack(push, 1)
+
+#include "MrcTypes.h"
+#include "MrcGlobal.h"
+
+typedef struct {
+ U16 StartMchbarOffset;
+ U16 EndMchbarOffset;
+} SaveDataControl;
+
+/**
+ This function verifies that neither CPU fuses or DIMMs have changed.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval mrcSuccess if fast boot is allowed, otherwise mrcColdBootRequired.
+**/
+extern
+MrcStatus
+MrcFastBootPermitted (
+ IN MrcParameters *const MrcData
+ );
+
+/**
+ This function saves any values that need to be used during non-cold boots.
+
+ @param[in, out] MrcData - Include all the MRC global data.
+
+ @retval mrcSuccess if the save occurred with no errors, otherwise returns an error code.
+**/
+extern
+MrcStatus
+MrcSaveMCValues (
+ IN OUT MrcParameters *const MrcData
+ );
+
+/**
+@brief
+ This function saves any remaining values that need to be used during non-cold boots.
+
+ @param[in, out] MrcData - Include all the MRC global data.
+
+ @retval mrcSuccess if the save occurred with no errors, otherwise returns an error code.
+**/
+extern
+MrcStatus
+MrcSaveMCValuesFinal (
+ IN OUT MrcParameters *const MrcData
+ );
+
+/**
+ This function copies the non-training information that needs to be restored
+ from the 'save' data structure to the 'Output' data structure.
+
+ @param[in, out] MrcData - include all the MRC global data.
+
+ @retval mrcSuccess if the copy completed with no errors, otherwise returns an error code.
+**/
+extern
+MrcStatus
+MrcRestoreNonTrainingValues (
+ IN OUT MrcParameters *const MrcData
+ );
+
+/**
+ This function writes the previously determined training values back to the memory controller.
+
+ @param[in] MrcData - Include all the MRC global data.
+
+ @retval mrcSuccess if the memory controller write back completed with no errors, otherwise returns an error code.
+**/
+extern
+MrcStatus
+MrcRestoreTrainingValues (
+ IN MrcParameters *const MrcData
+ );
+
+/**
+ Calculates a CRC-32 of the specified data buffer.
+
+ @param[in] Data - Pointer to the data buffer.
+ @param[in] DataSize - Size of the data buffer, in bytes.
+
+ @retval The CRC-32 value.
+**/
+extern
+U32
+MrcCalculateCrc32 (
+ IN const U8 *const Data,
+ IN const U32 DataSize
+ );
+
+#pragma pack(pop)
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcStartMemoryConfiguration.c b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcStartMemoryConfiguration.c
new file mode 100644
index 0000000..063e899
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcStartMemoryConfiguration.c
@@ -0,0 +1,236 @@
+/** @file
+ Starting point for the core memory reference code.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+//
+// Include files
+//
+#include "MrcTypes.h"
+#include "MrcApi.h"
+#include "MrcCommandTraining.h"
+#include "MrcCommon.h"
+#include "MrcCrosser.h"
+#include "MrcDdr3.h"
+#include "MrcDebugHook.h"
+#include "MrcGeneral.h"
+#include "MrcGlobal.h"
+#include "MrcBdat.h"
+#include "MrcMcConfiguration.h"
+#include "MrcMemoryMap.h"
+#include "MrcMemoryScrub.h"
+#include "MrcOem.h"
+#include "MrcReadDqDqs.h"
+#include "MrcReadReceiveEnable.h"
+#include "MrcReset.h"
+#include "MrcSaveRestore.h"
+#include "MrcSpdProcessing.h"
+#include "MrcStartMemoryConfiguration.h"
+#include "MrcWriteDqDqs.h"
+#include "MrcWriteLeveling.h"
+
+/**
+ Print the input parameters to the debug message output port.
+
+ @param[in] MrcData - The MRC global data.
+
+ @retval mrcSuccess
+**/
+
+//
+// Functions:
+//
+const CallTableEntry CallTable[] = {
+ ///
+ /// The functions are executed in the following order, as the policy flag dictates.
+ /// Mrctask, post_code, OEM command, policy_flag, iteration, debug_string
+ ///
+ {MrcFastBootPermitted, MRC_FAST_BOOT_PERMITTED, OemFastBootPermitted, MRC_PF_FAST | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("Fast boot permitted")},
+ {MrcRestoreNonTrainingValues,MRC_RESTORE_NON_TRAINING, OemRestoreNonTraining, MRC_PF_WARM | MRC_PF_S3 | MRC_PF_FAST | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("Restore non-training values")},
+#ifdef MRC_DEBUG_PRINT
+ {MrcPrintInputParameters, MRC_PRINT_INPUT_PARAMS, OemPrintInputParameters,MRC_PF_COLD | MRC_PF_WARM | MRC_PF_FAST | MRC_PF_FULL_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("Print input parameters")},
+#endif // MRC_DEBUG_PRINT
+ {MrcSetOverridesPreSpd, MRC_SET_OVERRIDES_PSPD, OemSetOverridePreSpd, MRC_PF_COLD | MRC_PF_WARM | MRC_PF_S3 | MRC_PF_FAST | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("Pre-SPD Timing overrides")},
+ {MrcMcCapabilityPreSpd, MRC_MC_CAPABILITY_PSPD, OemMcCapabilityPreSpd, MRC_PF_COLD | MRC_PF_WARM | MRC_PF_S3 | MRC_PF_FAST | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("Pre-SPD MC Capabilities")},
+ {MrcSpdProcessing, MRC_SPD_PROCESSING, OemSpdProcessingRun, MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("SPD PROCESSING")},
+ {MrcSetOverrides, MRC_SET_OVERRIDES, OemSetOverride, MRC_PF_COLD | MRC_PF_WARM | MRC_PF_S3 | MRC_PF_FAST | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("Timing overrides")},
+ {MrcMcCapability, MRC_MC_CAPABILITY, OemMcCapability, MRC_PF_COLD | MRC_PF_WARM | MRC_PF_S3 | MRC_PF_FAST | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("MC Capabilities")},
+ {MrcMcConfiguration, MRC_MC_CONFIG, OemMcInitRun, MRC_PF_COLD | MRC_PF_WARM | MRC_PF_S3 | MRC_PF_FAST | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("MC CONFIG")},
+ {MrcSetMemoryMap, MRC_MC_MEMORY_MAP, OemMcMemoryMap, MRC_PF_COLD | MRC_PF_WARM | MRC_PF_S3 | MRC_PF_FAST | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("MC MEMORY MAP")},
+ {MrcResetSequence, MRC_RESET_SEQUENCE, OemMcResetRun, MRC_PF_COLD | MRC_PF_FAST | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("JEDEC RESET")},
+ {MrcPreTraining, MRC_PRE_TRAINING, OemPreTraining, MRC_PF_COLD | MRC_PF_FAST | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("Pre-Training")},
+ {MrcSenseAmpOffsetTraining, MRC_SENSE_AMP_OFFSET, OemSenseAmpTraining, MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("SenseAmp Offset Training")},
+ {MrcEarlyCommandTraining, MRC_EARLY_COMMAND, OemEarlyCommandTraining,MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("Early command training")},
+#ifdef ULT_FLAG
+ {MrcJedecInitLpddr3, MRC_JEDEC_INIT_LPDDR3, OemJedecInitLpddr3, MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("LPDDR3 JEDEC INIT")},
+#endif // ULT_FLAG
+ {MrcReadLevelingTraining, MRC_RECEIVE_ENABLE, OemReceiveEnable, MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("Read Leveling training")},
+ {MrcReadMprTraining, MRC_READ_MPR, OemReadMprTraining, MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("Read MPR training")},
+
+ {MrcJedecWriteLevelingTraining,MRC_JEDEC_WRITE_LEVELING, OemJedecWriteLeveling, MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("Jedec Write Leveling training")},
+
+ {MrcWriteTimingCentering, MRC_WRITE_TIMING_1D, OemWriteDqDqs, MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("Write Timing Centering")},
+ {MrcReadTimingCentering, MRC_READ_TIMING_1D, OemReadDqDqs, MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("Read Timing Centering")},
+
+ {MrcPowerSavingMeter, MRC_PWR_MTR, OemPowerSavingMeter, MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("PowerSavingMeter Base Line Update")},
+ {MrcDimmRonTraining, MRC_DIMM_RON, OemDimmRonTraining, MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("DIMM Ron Training")},
+ {MrcDimmODTTraining, MRC_DIMM_ODT, OemDimmODTTraining, MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("DIMM ODT Training")},
+ {MrcDimmODT1dTraining, MRC_DIMM_ODT, OemDimmODT1dTraining, MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("DIMM ODT 1d Training")},
+
+ {MrcWriteDriveStrength, MRC_WRITE_DS, OemWriteDriveStrength, MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("Write Drive Strength")},
+ {MrcWriteEQTraining, MRC_WRITE_EQ, OemWriteEQTraining, MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("Write Equalization Training")},
+ {MrcReadODTTraining, MRC_READ_ODT, OemReadODTTraining, MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("Read ODT Training")},
+
+ {MrcWriteSlewRate, MRC_WRITE_SR, OemWriteSlewRate, MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("Write Slew Rate")},
+ {MrcReadAmplifierPower, MRC_READ_AMP_POWER, OemReadAmplifierPower, MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("Read Amplifier Power")},
+ {MrcReadEQTraining, MRC_READ_EQ, OemReadEQTraining, MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("Read Equalization Training")},
+ {MrcOptimizeComp, MRC_CMP_OPT, OemOptimizeComp, MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("Comp Optimization Training")},
+//
+/// @attention This sections of tests are left for future testing. Determine later if we can remove.
+// {MrcTestGetMarginBitWrTBit, MRC_ODT_STRETCH_START, OemReadODTTraining, MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("Get the Margins per CHANNEL")},
+// {MrcTestGetBERMarginByteWrT, MRC_READ_START, OemReadEQTraining, MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("Get the Margins per BYTE for RcvEn")},
+// {MrcTestGetBERMarginByteRdT, MRC_READ_START, OemReadAmplifierPower, MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("Get the Margins per BYTE for RdT")},
+// {MrcTestGetBERMarginByteRcvEna, MRC_WRITE_START, OemWriteDqDqs2D, MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("Get the Margins per BYTE for WrT")},
+// {MrcTestGetBERMarginByteWrDqsT, MRC_READ_START, OemReadDqDqs2D, MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("Get the Margins per BYTE for WrdqsT")},
+// {MrcTestGetBERMarginByteWrLevel,MRC_WRITE_START, OemWriteVoltCentering2D,MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("Get the Margins per BYTE for WrLevel")},
+// {MrcTestGetBERMarginCh, MRC_READ_START, OemReadVoltCentering2D, MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("Get the Margins per BIT for WrTBit")},
+// {MrcTestGetMarginBitRdTBit, MRC_READ_START, OemWriteXtalkCancel, MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("Get the Margins per BIT for RdTBit")},
+//
+ {MrcPostTraining, MRC_POST_TRAINING, OemPostTraining, MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("Post-training")},
+ {MrcLateCommandTraining, MRC_LATE_COMMAND, OemLateCommandTraining, MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("Late command training")},
+
+ {MrcCmdVoltageCentering, MRC_CMD_VREF, OemCmdVoltCentering, MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("Command Voltage Centering")},
+ {MrcWriteVoltageCentering2D, MRC_WRITE_VREF_2D, OemWriteVoltCentering2D,MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("Write Voltage Centering 2D")},
+ {MrcReadVoltageCentering2D, MRC_READ_VREF_2D, OemReadVoltCentering2D, MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("Read Voltage Centering 2D")},
+
+ {MrcWriteTimingCentering2D, MRC_WRITE_TIMING_2D, OemWriteDqDqs2D, MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("Write Timing Centering 2D")},
+ {MrcReadTimingCentering2D, MRC_READ_TIMING_2D, OemReadDqDqs2D, MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("Read Timing Centering 2D")},
+
+ {MrcRoundTripLatency, MRC_ROUND_TRIP_LAT, OemRoundTripLatency, MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("Round Trip Latency Training")},
+ {MrcTurnAroundTiming, MRC_TURN_AROUND, OemTurnAroundTimes, MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("Turn Around Trip Training")},
+#ifdef ULT_FLAG
+ {MrcReceiveEnTimingCentering,MRC_RCVEN_TIMING_1D, OemRcvEnCentering1D, MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("Receive Enable Timing Centering")},
+#endif // ULT_FLAG
+ {MrcRetrainMarginCheck, MRC_RETRAIN_CHECK, OemRetrainMarginCheck, MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, 1, MRC_DEBUG_TEXT("Check Margin for Retrain")},
+ {MrcRankMarginTool, MRC_RMT_TOOL, OemRmt, MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("Rank Margin Tool")},
+ {MrcPowerSavingMeter, MRC_PWR_MTR, OemPowerSavingMeter, MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("PowerSavingMeter update")},
+ {MrcMcActivate, MRC_MC_ACTIVATE, OemMrcActivate, MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("MRC activate")},
+ {MrcSaveMCValues, MRC_SAVE_MC_VALUES, OemSaveMCValues, MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("Save MC Values")},
+ {MrcRestoreTrainingValues, MRC_RESTORE_TRAINING, OemRestoreTraining, MRC_PF_WARM | MRC_PF_S3 | MRC_PF_FAST | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("Restore Training Values")},
+#ifdef ULT_FLAG
+ {MrcJedecInitLpddr3, MRC_JEDEC_INIT_LPDDR3, OemJedecInitLpddr3, MRC_PF_FAST | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("LPDDR3 JEDEC INIT")},
+#endif // ULT_FLAG
+ {MrcSelfRefreshExit, MRC_SELF_REFRESH_EXIT, OemSelfRefreshExit, MRC_PF_WARM | MRC_PF_S3 | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("Perform Self Refresh Exit")},
+ {MrcNormalMode, MRC_NORMAL_MODE, OemNormalMode, MRC_PF_WARM | MRC_PF_S3 | MRC_PF_FAST | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("Normal Operation For Non-Cold Boots")},
+/// @attention: MrcAliasCheck must run before any test modifying the WDB entries to zero for memory scrubbing.
+ {MrcAliasCheck, MRC_ALIAS_CHECK, OemAliasCheck, MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("MRC Memory alias check")},
+ {MrcHwMemTest, MRC_CPGC_MEMORY_TEST, OemMemTest, MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("MRC HW Memory testing")},
+ {MrcEccClean, MRC_ECC_CLEAN_START, OemHwMemInit, MRC_PF_COLD | MRC_PF_FAST | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("MRC HW Memory Init")},
+ {MrcDone, MRC_DONE, OemMrcDone, MRC_PF_COLD | MRC_PF_WARM | MRC_PF_S3 | MRC_PF_FAST | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("MRC done")},
+#ifdef BDAT_SUPPORT
+ {MrcFillRmtStructure, MRC_FILL_RMT_STRUCTURE, OemMrcFillRmt, MRC_PF_COLD | MRC_PF_FULL_MRC | MRC_PF_MINI_MRC, MRC_ITERATION_MAX, MRC_DEBUG_TEXT("MRC Fill RMT Structure")},
+#endif
+};
+
+/**
+ Initializes the memory controller and DIMMs.
+
+ @param[in, out] MrcData - Include all MRC global data.
+
+ @retval mrcSuccess if the initalization suceeded, otherwise an error status indicating the failure.
+**/
+MrcStatus
+MrcStartMemoryConfiguration (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ const CallTableEntry *ctptr;
+ const MrcDebug *Debug;
+ const MrcInput *Inputs;
+ MrcOutput *Outputs;
+ U64 start_time;
+ U64 finish_time;
+ U32 ElapsedTime;
+ U32 TotalTime;
+ U16 index;
+ U8 Run;
+ MrcPostCode post_code;
+ MrcStatus MrcStatus;
+
+ //
+ // Time to sequence thru the MRC tasks.
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ Debug = &Inputs->Debug;
+ Outputs->BootMode = Inputs->BootMode;
+ MrcVersionGet (&Outputs->Version);
+ MrcStatus = mrcFail;
+ post_code = MRC_INITIALIZATION_START;
+ Run = 1;
+ TotalTime = 0;
+ for (index = 0; Run && (index < (sizeof (CallTable) / sizeof (CallTableEntry))); index++, post_code++) {
+ ctptr = &CallTable[index];
+ //
+ // Output post code to post code I/O port.
+ //
+ MrcOemDebugHook (MrcData, ((ctptr->post_code_ovr == POST_CODE_NO_OVR) ? post_code : ctptr->post_code_ovr));
+ //
+ // Decide if we need to execute the selected MRC task.
+ if ((NULL != ctptr->mrc_task) && (Inputs->Iteration < ctptr->iteration)) {
+ if (((Inputs->MrcMode == MrcModeFull) && (ctptr->policy_flag & MRC_PF_FULL_MRC))
+ || ((Inputs->MrcMode == MrcModeMini) && (ctptr->policy_flag & MRC_PF_MINI_MRC))) {
+ if (((Outputs->BootMode == bmS3) && (ctptr->policy_flag & MRC_PF_S3))
+ || ((Outputs->BootMode == bmFast) && (ctptr->policy_flag & MRC_PF_FAST))
+ || ((Outputs->BootMode == bmWarm) && (ctptr->policy_flag & MRC_PF_WARM))
+ || ((Outputs->BootMode == bmCold) && (ctptr->policy_flag & MRC_PF_COLD))) {
+ if ((ctptr->oem_cmd < OemNumOfCommands) && (mrcSuccess != MrcOemCheckPoint (MrcData, ctptr->oem_cmd, NULL))) {
+ continue;
+ }
+ //
+ // Output debug string to serial output and execute the MRC task.
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nMRC task -- %s -- Started.\n", ctptr->String);
+ start_time = MrcGetCpuTime ();
+ MrcStatus = ctptr->mrc_task (MrcData);
+ finish_time = MrcGetCpuTime ();
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_ERROR,
+ "MRC task %s -- %s, Status = %Xh.\n",
+ ctptr->String,
+ (mrcSuccess == MrcStatus) ? "SUCCEEDED" : "FAILED",
+ MrcStatus
+ );
+ if (mrcSuccess != MrcStatus) {
+ Run = 0; //Stop task execution on failure.
+ }
+
+ ElapsedTime = (U32) (finish_time - start_time);
+ TotalTime += ElapsedTime;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_TIME, "MRC timer: Task %s took %u msec.\n", ctptr->String, ElapsedTime);
+ }
+ }
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_TIME, "MRC timer: Total time to execute tasks = %u msec.\n", TotalTime);
+
+ return MrcStatus;
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcStartMemoryConfiguration.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcStartMemoryConfiguration.h
new file mode 100644
index 0000000..01aa9d0
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Api/MrcStartMemoryConfiguration.h
@@ -0,0 +1,74 @@
+/** @file
+ Starting point for the core memory reference code.
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+#ifndef __MRC_StartMemoryConfiguration_h__
+#define __MRC_StartMemoryConfiguration_h__
+
+//
+// Include files
+//
+#include "MrcTypes.h"
+#include "MrcApi.h"
+
+typedef U16 MrcPostCode;
+#define POST_CODE_NO_OVR ((1 << ((sizeof (MrcPostCode) * 8) - 1)) + ((1 << ((sizeof (MrcPostCode) * 8) - 1)) - 1))
+
+typedef enum {
+ MRC_PF_NULL, ///< All policy flags turned off.
+ MRC_PF_COLD = (1 << 0), ///< Execute MRC function on cold reset.
+ MRC_PF_FAST = (1 << 1), ///< Execute MRC function on cold reset when S3 data is present.
+ MRC_PF_WARM = (1 << 2), ///< Execute MRC function on warm reset.
+ MRC_PF_S3 = (1 << 3), ///< Execute MRC function on S3 exit.
+ MRC_PF_FULL_MRC = (1 << 4), ///< Execute MRC function when in Full MRC mode.
+ MRC_PF_MINI_MRC = (1 << 5), ///< Execute MRC function when in Mini-MRC mode.
+ MRC_PF_UNUSED = (3 << 6), ///< Unused policy flags.
+ MRC_PF_ALL = (0xF) ///< All policy flags turned off.
+} PFSelector;
+
+typedef U8 PolicyFlag;
+
+#pragma pack(push, 1)
+typedef struct {
+ MrcStatus (*mrc_task) (MrcParameters * const MrcData); ///< Ptr to function to execute, with parameter list.
+ MrcPostCode post_code_ovr; ///< BIOS post code output to the debug port if value <> 0.
+ U32 oem_cmd; ///< OEM function to execute prior to MRC function.
+ PolicyFlag policy_flag; ///< Call table flags
+ MrcIteration iteration; ///< Maximum number of CPU only resets.
+#ifdef MRC_DEBUG_PRINT
+ char *String; ///< Output string describing this task (potentially output to debug serial port).
+#endif // MRC_DEBUG_PRINT
+} CallTableEntry;
+#pragma pack(pop)
+
+/**
+ Initializes the memory controller and DIMMs.
+
+ @param[in, out] MrcData - Include all MRC global data.
+
+ @retval mrcSuccess if the initalization suceeded, otherwise an error status indicating the failure.
+**/
+extern
+MrcStatus
+MrcStartMemoryConfiguration (
+ IN OUT MrcParameters *const MrcData
+ );
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/McAddress.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/McAddress.h
new file mode 100644
index 0000000..ddd677b
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/McAddress.h
@@ -0,0 +1,131 @@
+/** @file
+ The contents of this file has all the memory controller register addresses
+ and register bit fields for the MRC.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef __McAddress_h__
+#define __McAddress_h__
+
+#include "McGdxcbar.h"
+#include "McIoCkeCtl.h"
+#include "McIoClk.h"
+#include "McIoCmd.h"
+#include "McIoComp.h"
+#include "McIoData.h"
+#include "McMain.h"
+#include "McScramble.h"
+#include "Msa.h"
+#include "Pci000.h"
+
+///
+/// The following is a copy of M_PCU_CR_SSKPD_PCU_STRUCT, modified to add in the
+/// definition of the scratch pad bit fields.
+///
+typedef union {
+ struct {
+ U64 OldWM0 : 4; ///< Bits 3:0
+ U64 WM1 : 8; ///< Bits 11:4
+ U64 WM2 : 8; ///< Bits 19:12
+ U64 WM3 : 9; ///< Bits 28:20
+ U64 : 3; ///< Bits 31:29
+ U64 WM4 : 9; ///< Bits 40:32
+ U64 : 15; ///< Bits 55:41
+ U64 NewWM0 : 8; ///< Bits 63:56
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} M_PCU_CR_SSKPD_PCU_STRUCT;
+
+///
+/// Number of microseconds for level 0 old field (0.1us granularity).
+/// 00h 0 us
+/// 01h 0.1 us
+/// Fh 1.5 us
+///
+#define PCU_CR_SSKPD_PCU_OLD_WM0_OFF (0)
+#define PCU_CR_SSKPD_PCU_OLD_WM0_WID (4)
+#define PCU_CR_SSKPD_PCU_OLD_WM0_MSK (0xF)
+#define PCU_CR_SSKPD_PCU_OLD_WM0_MAX (0xF)
+#define PCU_CR_SSKPD_PCU_OLD_WM0_DEF (0xF)
+
+///
+/// Number of microseconds for level 0 new field (0.1us granularity).
+/// 00h 0 us
+/// 01h 0.1 us
+/// FFh 25.5 us
+///
+#define PCU_CR_SSKPD_PCU_NEW_WM0_OFF (56)
+#define PCU_CR_SSKPD_PCU_NEW_WM0_WID (8)
+#define PCU_CR_SSKPD_PCU_NEW_WM0_MSK (0xFF)
+#define PCU_CR_SSKPD_PCU_NEW_WM0_MAX (0xFF)
+#define PCU_CR_SSKPD_PCU_NEW_WM0_DEF (0x14)
+///
+/// Number of microseconds for level 1 (0.5us granularity).
+/// 00h 0 us
+/// 01h 0.5 us
+/// FFh 127.5 us
+///
+#define PCU_CR_SSKPD_PCU_WM1_OFF (4)
+#define PCU_CR_SSKPD_PCU_WM1_WID (8)
+#define PCU_CR_SSKPD_PCU_WM1_MSK (0xFF)
+#define PCU_CR_SSKPD_PCU_WM1_MAX (0xFF)
+#define PCU_CR_SSKPD_PCU_WM1_DEF (4)
+
+///
+/// Number of microseconds for level 2 (0.5us granularity).
+/// 00h 0 us
+/// 01h 0.5 us
+/// FFh 127.5 us
+///
+#define PCU_CR_SSKPD_PCU_WM2_OFF (12)
+#define PCU_CR_SSKPD_PCU_WM2_WID (8)
+#define PCU_CR_SSKPD_PCU_WM2_MSK (0xFF)
+#define PCU_CR_SSKPD_PCU_WM2_MAX (0xFF)
+#define PCU_CR_SSKPD_PCU_WM2_DEF (36)
+
+///
+/// Number of microseconds for level 3 (0.5us granularity).
+/// 00h 0 us
+/// 01h 0.5 us
+/// 01FFh 255.5 us
+///
+#define PCU_CR_SSKPD_PCU_WM3_OFF (20)
+#define PCU_CR_SSKPD_PCU_WM3_WID (9)
+#define PCU_CR_SSKPD_PCU_WM3_MSK (0x1FF)
+#define PCU_CR_SSKPD_PCU_WM3_MAX (0x1FF)
+#define PCU_CR_SSKPD_PCU_WM3_DEF (90)
+
+///
+/// Number of microseconds for level 4 (0.5us granularity).
+/// 00h 0 us
+/// 01h 0.5 us
+/// 01FFh 255.5 us
+///
+#define PCU_CR_SSKPD_PCU_WM4_OFF (32)
+#define PCU_CR_SSKPD_PCU_WM4_WID (9)
+#define PCU_CR_SSKPD_PCU_WM4_MSK (0x1FF)
+#define PCU_CR_SSKPD_PCU_WM4_MAX (0x1FF)
+#define PCU_CR_SSKPD_PCU_WM4_DEF (160)
+
+
+#define NCDECS_CR_GDXCBAR_NCU_MAX (0xFFFFF000)
+
+#endif // __McAddress_h__
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcCommandTraining.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcCommandTraining.h
new file mode 100644
index 0000000..c2b9b4a
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcCommandTraining.h
@@ -0,0 +1,302 @@
+/** @file
+ Command training definitions.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+
+**/
+
+///
+/// Include files
+///
+#ifndef _MrcCommandTraining_h_
+#define _MrcCommandTraining_h_
+
+#include "MrcTypes.h"
+#include "MrcApi.h"
+#include "MrcCommon.h"
+#include "MrcDdr3.h"
+#include "MrcGlobal.h"
+#include "MrcIoControl.h"
+#include "MrcOem.h"
+#include "MrcReadReceiveEnable.h"
+#include "MrcReset.h"
+#include "MrcTimingConfiguration.h"
+
+#define ECT_CLK_START (0)
+#define ECT_CLK_STOP (128)
+
+#define ECT_CLK_STEP (2)
+
+#define ECT_CLK_LOOPS (ECT_CLK_STOP / ECT_CLK_STEP)
+
+#define ECT_DQS_START (-32)
+#define ECT_DQS_STOP (32)
+#define ECT_DQS_STEP (8)
+#define ECT_MIN_WIDTH (16)
+
+/**
+@brief
+ This function performs early command training.
+ Center CTL-CLK timing to allow subsequent steps to work
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - mrcSuccess if it succeeded
+**/
+extern
+MrcStatus
+MrcEarlyCommandTraining (
+ IN MrcParameters *const MrcData
+ );
+
+/**
+@brief
+ This function performs Late command training.
+ Center CMD/CTL-CLK timing using complex patterns.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - If it's a success return mrcSuccess
+**/
+extern
+MrcStatus
+MrcLateCommandTraining (
+ IN MrcParameters *const MrcData
+ );
+
+/**
+@brief
+ Perform Command Voltage Centering.
+
+ @param[in, out] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - if it succeded returns mrcSuccess
+**/
+extern
+MrcStatus
+MrcCmdVoltageCentering (
+ IN OUT MrcParameters *const MrcData
+ );
+
+/**
+@brief
+ Centers Command Timing around a MidPoint
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Iteration - Determines which PI to shift
+ @param[in] Ranks - Valid Rank bit mask
+ @param[in] GroupMask - which LPDDR groups to work on for CMD/CLK/CKE; not used for DDR3
+ @param[in] MidPoint - The MidPoint to center around (per channel)
+
+ @retval Nothing
+**/
+extern
+void
+CmdTimingCentering (
+ IN MrcParameters *const MrcData,
+ IN U8 Iteration,
+ IN U8 Ranks,
+ IN U8 GroupMask,
+ IN U8 MidPoint[MAX_CHANNEL]
+ );
+
+/**
+@brief
+ Use a linear search to find the edges between Low and High
+ if WrapAround = 0: Look for largest passing region between low and high
+ if WrapAround = 1: Look for largest passing region, including wrapping from high to low
+
+ @param[in, out] MrcData - Include all MRC global data.
+ @param[in] Iteration - Determines which PI to shift
+ @param[in] chBitMask - Valid Channel bit mask
+ @param[in] Ranks - Valid Rank bit mask
+ @param[in] GroupMask - which LPDDR groups to work on for CMD/CLK/CKE; not used for DDR3
+ @param[in] Low - Low limit
+ @param[in] High - High limit
+ @param[in] WrapAllowed - Determines the search region
+ @param[in] VrefOffsets - Array of Vref offsets
+ @param[in] SkipPrint - Switch to enable or disable debug printing
+ @param[in] SkipVref - Skip changing CMD Vref offsets, only run test once at the current Vref.
+
+ @retval MrcStatus - If it succeeds return mrcSuccess
+**/
+extern
+void
+CmdLinearFindEdges (
+ IN OUT MrcParameters *const MrcData,
+ IN U8 Iteration,
+ IN U8 chBitMask,
+ IN U8 Ranks,
+ IN U8 GroupMask,
+ IN S8 Low,
+ IN U8 High,
+ IN U8 WrapAllowed,
+ IN S8 *VrefOffsets,
+ IN BOOL SkipPrint,
+ IN BOOL SkipVref
+ );
+
+/**
+@brief
+ Use a binary search to find the edge between Low and High
+ High and Low track passing points
+ if CountUp: Low is a passing point and need to count up to find a failing point
+ if CountDn: High is a passing point and need to count dn to find a failing point
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Iteration - Determines which PI to shift
+ @param[in] ChBitMask - Valid Channel bit mask
+ @param[in] Ranks - Valid Rank bit mask
+ @param[in] GroupMask - which LPDDR groups to work on for CMD/CLK/CKE; not used for DDR3
+ @param[in, out] Low - Low limit
+ @param[in, out] High - High limit
+ @param[in] CountUp - The direction to search
+ @param[in] VrefOffsets - Array of Vref offsets
+
+ @retval Nothing
+**/
+extern
+void
+CmdBinaryFindEdge (
+ IN MrcParameters *const MrcData,
+ IN U8 Iteration,
+ IN U8 ChBitMask,
+ IN U8 Ranks,
+ IN U8 GroupMask,
+ IN OUT U8 *Low,
+ IN OUT U8 *High,
+ IN U8 CountUp,
+ IN S8 *VrefOffsets
+ );
+
+/**
+@brief
+ Shift the CLK/CTL Timing
+ Shift the CMD Timing
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Channel - Channel to shift
+ @param[in] Offset - Offset to shift by
+ @param[in] UpdateHost - Switch to update the host structure
+
+ @retval Nothing
+**/
+extern
+void
+ShiftChannelTiming (
+ IN MrcParameters *const MrcData,
+ IN U8 Channel,
+ IN S32 Offset,
+ IN U8 UpdateHost
+ );
+
+/**
+@brief
+ This function updtes Command Mode register, tXP and Round trip latency
+
+ @param[in, out] MrcData - Include all MRC global data.
+ @param[in] Channel - Channel to perform update to
+ @param[in] OldN - Old N Mode value
+ @param[in] NewN - New N mode value
+
+ @retval Nothing
+**/
+extern
+void
+UpdateCmdNTiming (
+ IN OUT MrcParameters *const MrcData,
+ IN U8 Channel,
+ IN U8 OldN,
+ IN U8 NewN
+ );
+
+#ifdef ULT_FLAG
+
+typedef struct _CADB_LINE {
+ U32 CaHigh;
+ U32 CaLow;
+ U32 ChipSelect;
+} CADB_LINE;
+
+typedef enum {
+ CaTrainingMode41, ///< Enter CA training mode using MRW41
+ CaTrainingMode48, ///< Enter CA training mode using MRW48
+ CaTrainingMode42 ///< Exit CA training mode using MRW42
+} MrcCaTrainingMode;
+
+/**
+@brief
+ Early CA / CS training for LPDDR.
+ Main flow:
+ 1. Put DRAMs in CA training mode using MRW41.
+ 2. Run CS vs. CLK training.
+ 3. Map DQ pins according to the board swizzling.
+ 4. Run CA vs. CLK training.
+ 5. Select optimal CA timings for each CA bus per rank
+
+ @param[in] MrcData - The MRC global data.
+
+ @retval mrcSuccess if succeeded
+**/
+extern
+MrcStatus
+EarlyCommandTrainingLpddr (
+ IN MrcParameters *const MrcData
+ );
+
+/**
+@brief
+ Early CS / CLK training for LPDDR.
+ Main flow:
+ 1. Setup CADB pattern for CS Training.
+ 2. Run CS vs. CLK training.
+ 3. Select optimal CS and CLK timings
+
+ @param[in] MrcData - The MRC global data.
+
+ @retval mrcSuccess if succeeded
+**/
+extern
+MrcStatus
+EarlyChipSelectTraining (
+ IN MrcParameters *const MrcData
+ );
+
+/**
+@brief
+ Sweep right and left from the current point to find the margins.
+
+ @param[in, out] MrcData - Include all MRC global data.
+ @param[in] Iteration - Determines which PI to shift
+ @param[in] ChannelMask - Valid Channel bit mask
+ @param[in] RankMask - Valid Rank bit mask
+ @param[in] DebugPrint - Print debug messages or not
+
+ @retval MrcStatus - If it succeeds return mrcSuccess
+**/
+void
+CmdLinearFindEdgesLpddr (
+ IN OUT MrcParameters *const MrcData,
+ IN U8 Iteration,
+ IN U8 ChannelMask,
+ IN U8 RankMask,
+ IN BOOL DebugPrint
+ );
+
+#endif // ULT_FLAG
+#endif // _MrcCommandTraining_h_
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcCommon.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcCommon.h
new file mode 100644
index 0000000..718c066
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcCommon.h
@@ -0,0 +1,1836 @@
+/** @file
+ This file include all the MRC common data.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _MrcCommon_h_
+#define _MrcCommon_h_
+
+#include "MrcTypes.h"
+#include "MrcApi.h"
+#include "MrcIoControl.h"
+#include "McAddress.h"
+#include "MrcDdr3.h"
+#include "MrcReset.h"
+#include "MrcOem.h"
+#include "MrcOemPlatform.h"
+
+
+///
+/// Convert rank to dimm number
+///
+#ifndef RANK_TO_DIMM_NUMBER
+#define RANK_TO_DIMM_NUMBER(Rank) (Rank / 2)
+#endif
+
+///
+/// Convert rank to real rank number inside dimm
+///
+#ifndef RANK_TO_RANK_NUMBER_IN_DIMM
+#define RANK_TO_RANK_NUMBER_IN_DIMM(Rank) ((Rank % 2) + 1)
+#endif
+
+///
+/// Convert rank and dimm to channel rank number
+///
+#ifndef GET_RANK_NUMBER
+#define GET_RANK_NUMBER(Dimm, Rank) ((Dimm * 2) + Rank)
+#endif
+
+///
+/// Bit operation commands
+///
+#ifndef MRC_MASK
+#define MRC_MASK(offset, width) (((1 << width) - 1) << (offset))
+#endif
+
+#ifndef MRC_MASK_NOT
+#define MRC_MASK_NOT(offset, width) (~(MRC_MASK (offset, width)))
+#endif
+
+#ifndef MRC_CR_UPDATE
+#define MRC_CR_UPDATE(Register, Offset, Width, Value) \
+ (((Register) & MRC_MASK_NOT (Offset, Width)) | ((Value) << (Offset)))
+#endif
+
+#ifndef MRC_CR_DUMP
+#define MRC_CR_DUMP(Register, offset, Width)\
+ (((Register) & (MRC_MASK(offset, Width))) >> offset)
+#endif
+
+#define BER_TARGET 4
+#define BER_LOG_TARGET 7 ///< MRC_Log8(BER_TARGET) = 7
+#define BER_ERROR_MASK 0xFFFF00FF
+
+#define MRC_ASSERT(cond, DEBUG, ...) \
+ if (!(cond)) { \
+ MRC_DEBUG_MSG (DEBUG, MSG_LEVEL_ERROR, __VA_ARGS__); \
+ MRC_DEADLOOP (); \
+ }
+
+///
+/// Cache line size
+///
+#define WDB_CACHE_LINE_SIZE (8)
+
+///
+/// CADB Entries
+///
+#define MRC_NUM_CADB_ENTRIES (8)
+
+///
+/// Number of WDB Mux
+///
+#define MRC_WDB_NUM_MUX_SEEDS (3)
+
+///
+/// Dimm Mode register selection
+///
+typedef enum {
+ mrMR0 = 0,
+ mrMR1,
+ mrMR2,
+ mrMR3,
+ mrMR11 = 11
+} MrcModeRegister;
+
+typedef enum {
+ dDIMM0= 0,
+ dDIMM1
+} MrcDimmType;
+
+typedef enum {
+ cCHANNEL0 = 0,
+ cCHANNEL1
+} MrcChannelType;
+
+typedef enum {
+ rRank0 = 0,
+ rRank1,
+ rRank2,
+ rRank3
+} MrcRank;
+
+typedef enum {
+ ssOne = 0,
+ ssTwo,
+ ssThree,
+ ssFour
+} TSubSequencesNumber;
+
+///
+/// Define ECC mode.
+///
+typedef enum {
+ emNoEcc,
+ emEccIoActive,
+ emEccLogicActive,
+ emBothActive
+} TEccModes;
+
+///
+/// Raw card list
+///
+typedef enum {
+ rcA,
+ rcB,
+ rcC,
+ rcD,
+ rcE,
+ rcF,
+ rcG,
+ rcH,
+} TRawCard;
+
+///
+/// Reut Addressing Parameters
+///
+typedef enum {
+ MrcReutFieldRank,
+ MrcReutFieldBank,
+ MrcReutFieldRow,
+ MrcReutFieldCol,
+ MrcReutFieldMax ///< This must be the last entry in the enum.
+} MrcReutField;
+
+typedef struct {
+ U16 Start[MrcReutFieldMax]; ///< (4, uint16) // Rank, Bank, Row, Col
+ U16 Stop[MrcReutFieldMax]; ///< (4, uint16) // Rank, Bank, Row, Col
+ U8 Order[MrcReutFieldMax]; ///< [4, uint8) // Rank, Bank, Row, Col
+ U32 IncRate[MrcReutFieldMax]; ///< (4, unit32) // Rank, Bank, Row, Col
+ U16 IncVal[MrcReutFieldMax]; ///< (4, unit16) // Rank, Bank, Row, Col
+} MRC_REUTAddress;
+
+typedef struct {
+ U16 IncRate; ///< How quickly the WDB walks through cachelines (uint16)
+ U32 Start; ///< Starting pointer in WDB
+ U32 Stop; ///< Stopping pointer in WDB
+ U8 DQPat; ///< [0:BasicVA, 1:SegmentWDB, 2:CADB, 3:TurnAround,
+ ///< 4: LMNVa, 5: TurnAroundWR, 6: TurnAroundODT
+ ///< 7: CADBCol, 8: CADBRow]
+} MRC_WDBPattern;
+
+typedef enum {
+ BasicVA = 0, ///< Use 2 LFSR VicAggressor pattern with rotation of 10 bits
+ SegmentWDB, ///< Use 2 LFSR VA pattern 10 bit rotation + 3 LFSR VA pattern 6 bit rotation
+ CADB, ///< Do CADB on command/address bus and LMN VA on DQ (power supply noise)
+ TurnAround,
+ LMNVa, ///< Use (LMN aggressor + LFSR Victim) with rotation of 10 bits
+ TurnAroundWR, ///< Run 8 tests, one for each subsequence with RankIncRate = 1/2/2/2/2/2/2/1
+ TurnAroundODT, ///< Run 4 tests, one for each subsequence with RankIncRate = 1/2/1/2
+ CADBCol,
+ CADBRow,
+ RdRdTA, ///< Run 2 tests, one with Trdrd=4 and one with Trdrd=5
+ RdRdTA_All ///< Run 8 tests, Covering tRDRD_sr 4,5,6,7 and tRDRD_dr = Min,+1,+2,+3
+} MrcDqPat;
+
+typedef enum {
+ NSOE = 0, ///< Never Stop On Any Error
+ NTHSOE, ///< Stop on the Nth Any Lane Error
+ ABGSOE, ///< Stop on All Byte Groups Error
+ ALSOE ///< Stop on All Lanes Error
+} TStopOnError;
+
+typedef enum {
+ MrcRegFileRank, ///< Used if ChangeMargin is being called within a Rank loop and the Parameters are Rank based.
+ MrcRegFileStart, ///< Used when changing parameters before the test.
+ MrcRegFileCurrent, ///< Used when changing parameters after the test.
+ MrcRegFileMax ///< This must be the last in the list
+} MrcRegFile;
+
+///
+/// CADB commands
+///
+#define MRS_CMD 0
+#define REF_CMD 1
+#define PRE_CMD 2
+#define ACT_CMD 3
+#define WR_CMD 4
+#define RD_CMD 5
+#define ZQ_CMD 6
+#define NOP_CMD 7
+
+///
+/// REUT Init modes
+///
+#define Idle_Mode 0
+#define REUT_Testing_Mode 1
+#define MRS_Mode 2
+#define NOP_Mode 3 ///< Normal Operation Mode
+
+///
+/// REUT CmdPattern
+///
+#define PatWrRd 0
+#define PatWr 1
+#define PatRd 2
+#define PatRdWrTA 3
+#define PatWrRdTA 4
+#define PatODTTA 5
+#define DimmTest 6
+#define PatCADBCol 7
+#define PatCADBRow 8
+
+///
+/// REUT Mux Control
+///
+#define LMNMode 0
+#define BTBUFFER 1
+#define LFSRMode 2
+
+///
+/// REUT Subsequence types
+///
+#define BRd 0
+#define BWr 1
+#define BRdWr 2
+#define BWrRd 3
+#define ORd 4
+#define OWr 5
+
+///
+/// WDB Patterns
+///
+#define BASIC_VA_PATTERN_SPRED_8 0x01010101
+
+///
+/// DQ time centering param: read or write
+///
+///
+/// Margin params
+///
+
+/*
+ 1D Margin Types:
+ RcvEn: Shifts just RcvEn. Only side effect is it may eat into read dq-dqs for first bit of burst
+ RdT: Shifts read DQS timing, changing where DQ is sampled
+ WrT: Shifts write DQ timing, margining DQ-DQS timing
+ WrDqsT: Shifts write DQS timing, margining both DQ-DQS and DQS-CLK timing
+ RdV: Shifts read Vref voltage for DQ only
+ WrV: Shifts write Vref voltage for DQ only
+ WrLevel: Shifts write DQ and DQS timing, margining only DQS-CLK timing
+ WrTBit: Shifts write DQ per bit timing.
+ RdTBit: Shifts read DQ per bit timing.
+ RdVBit: Shifts read DQ per bit voltage.
+
+ 2D Margin Types (Voltage, Time)
+ RdFan2: Margins both RdV and RdT at { (off, -2/3*off), (off, 2/3*off) }
+ WrFan2: Margins both WrV and WrT at { (off, -2/3*off), (off, 2/3*off) }
+ RdFan3: argins both RdV and RdT at { (off, -2/3*off), (5/4*off, 0), (off, 2/3*off) }
+ WrFan3: Margins both WrV and WrT at { (off, -2/3*off), (5/4*off, 0), (off, 2/3*off) }
+
+ param = {0:RcvEn, 1:RdT, 2:WrT, 3: WrDqsT, 4:RdV, 5:WrV, 6:WrLevel,
+ 8:WrTBit, 9:RdTBit, 10:RdVBit,
+ 16:RdFan2, 17:WrFan2, 32:RdFan3, 32:WrFan3}
+*/
+
+ typedef enum {
+ RcvEna = 0,
+ RdT,
+ WrT,
+ WrDqsT,
+ RdV,
+ WrV,
+ WrLevel,
+ WrTBox,
+ WrTBit,
+ RdTBit,
+ RdVBit, ///< 10
+ RcvEnaX,
+ CmdT,
+ CmdV,
+ RdFan2 = 16,
+ WrFan2 = 17,
+ RdFan3 = 32,
+ WrFan3 = 33,
+ MarginTypeMax
+} MRC_MarginTypes;
+
+typedef enum {
+ OptWrDS = 0,
+ OptRdOdt,
+ OptSComp,
+ OptTComp,
+ OptTxEq,
+ OptRxEq,
+ OptRxBias,
+ OptDimmOdt,
+ OptDimmOdtWr,
+ OptDimmRon,
+ OptDefault
+} TOptParamOffset;
+
+typedef enum {
+ drrd2rd = 0,
+ ddrd2rd,
+ drwr2wr,
+ ddwr2wr,
+ drrd2wr,
+ ddrd2wr,
+ drwr2rd,
+ ddwr2rd,
+ rdodtd,
+ wrodtd,
+ mcodts,
+ mcodtd,
+ rtl,
+ srrd2rd,
+ srrd2wr
+} TOptParamTAT;
+
+///
+/// Self refresh idle timer value
+///
+#define SELF_REFRESH_IDLE_COUNT (0x200)
+
+#define RXF_SELECT_RC_100 (6)
+#define RXF_SELECT_RC_133 (4)
+#define RXF_SELECT_MIN (0)
+#define RXF_SELECT_MAX (4)
+#define RXF_SELECT_MAX_ULT (2)
+
+#ifdef MRC_DEBUG_PRINT
+extern const char CcdString[];
+#endif
+
+///
+/// MRC common functions
+///
+
+/**
+ Return the rank mask in channel if rank exist exist.
+
+ @param[in] MrcData - Pointer to MRC global data.
+ @param[in] Channel - Channel to work on.
+ @param[in] Rank - Rank to check.
+
+ @retval Bit mask of Rank requested if the Rank exists in the system.
+**/
+extern
+U8
+MrcRankInChannelExist (
+ IN MrcParameters *const MrcData,
+ IN const U8 Rank,
+ IN const U8 Channel
+ );
+
+/**
+ Return the number of ranks in specific dimm.
+
+ @param[in] MrcData - Pointer to MRC global data.
+ @param[in] Channel - Channel to work on.
+ @param[in] Dimm - Dimm in channel to return.
+
+ @retval The number of ranks in the dimm.
+**/
+extern
+U8
+MrcGetRankInDimm (
+ IN MrcParameters *const MrcData,
+ IN const U8 Dimm,
+ IN const U8 Channel
+ );
+
+/**
+ Returns whether Channel is or is not present.
+
+ @param[in] Outputs - Pointer to MRC global Output data.
+ @param[in] Channel - Channel to test.
+
+ @retval TRUE - if there is at least one enabled DIMM in the channel.
+ @retval FALSE - if there are no enabled DIMMs in the channel.
+**/
+extern
+BOOL
+MrcChannelExist (
+ IN const MrcOutput *const Outputs,
+ IN const U8 Channel
+ );
+
+/**
+ This function disable channel parameters.
+ After this function the MRC don't use with the channel.
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] ChannelToDisable - Channel to disable.
+ @param[in] SkipDimmCapacity - Switch to skip setting the DimmCapacity to 0 for the dimms in the channel disabled.
+
+ @retval Nothing
+**/
+extern
+void
+MrcChannelDisable (
+ IN MrcParameters *const MrcData,
+ IN const U8 ChannelToDisable,
+ IN const U8 SkipDimmCapacity
+ );
+
+/**
+ Convert the given frequency and reference clock to a clock ratio.
+
+ @param[in] MrcData - Pointer to MRC global data.
+ @param[in] Frequency - The memory frequency.
+ @param[in] RefClk - The memory reference clock.
+ @param[in] BClk - The base system reference clock.
+
+ @retval Returns the memory clock ratio.
+**/
+extern
+MrcClockRatio
+MrcFrequencyToRatio (
+ IN MrcParameters *const MrcData,
+ IN const MrcFrequency Frequency,
+ IN const MrcRefClkSelect RefClk,
+ IN const MrcBClkRef BClk
+ );
+
+/**
+ @brief
+ Convert the given ratio and reference clocks to a memory frequency.
+
+ @param[in] MrcData - Pointer to MRC global data.
+ @param[in] Ratio - The memory ratio.
+ @param[in] RefClk - The memory reference clock.
+ @param[in] BClk - The base system reference clock.
+
+ @retval Returns the memory frequency.
+**/
+extern
+MrcFrequency
+MrcRatioToFrequency (
+ IN MrcParameters *const MrcData,
+ IN const MrcClockRatio Ratio,
+ IN const MrcRefClkSelect RefClk,
+ IN const MrcBClkRef BClk
+ );
+
+/**
+ Convert the given ratio and reference clocks to a memory clock.
+
+ @param[in] Ratio - The memory ratio.
+ @param[in] RefClk - The memory reference clock.
+ @param[in] BClk - The base system reference clock.
+
+ @retval Returns the memory clock in femtoseconds.
+**/
+extern
+U32
+MrcRatioToClock (
+ IN const MrcClockRatio Ratio,
+ IN const MrcRefClkSelect RefClk,
+ IN const MrcBClkRef BClk
+);
+
+/**
+ This function return the DIMM number according to the rank number.
+
+ @param[in] Rank - The requested rank.
+
+ @retval The DIMM number.
+**/
+extern
+U8
+MrcGetDimmFromRank (
+ IN const U8 Rank
+ );
+
+/**
+ This function sets the memory frequency.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval mrcSuccess on success, mrcFrequencyError on error.
+**/
+extern
+MrcStatus
+McFrequencySet (
+ IN MrcParameters * const MrcData
+ );
+
+/**
+ Returns the extrapolated margin to a fixed # of errors (logT)
+ vrefpass is 10x the first passing margin (with no errors) (10x used for int math)
+ Errors at vrefpass/10+1 = log1
+ Errors at vrefpass/10+2 = logT
+
+ @param[in] vrefpass - 10x the first pass margin (w/no errors) (10x used for int match)
+ @param[in] errLog_1 - Errors at vrefpass/10+1
+ @param[in] errLog_2 - Errors at vrefpass/10+2
+ @param[in] errLog_Target - Error target determines extrapolation vs interpolation
+ @param[in, out] *berStats - Used to track interpolation vs extrapolation or if the slope is non-monotonic.
+ NOTE: target would be Interpolation only
+
+ @retval Interpolated/Extrapolated vref with the scale increased by 10.
+**/
+extern
+U32
+interpolateVref (
+ IN U32 vrefpass,
+ IN U32 errLog_1,
+ IN U32 errLog_2,
+ IN U32 errLog_Target,
+ IN OUT U32 *berStats
+ );
+
+/**
+ This function swaps a subfield, within a 32 bit integer value with the specified value.
+
+ @param[in] CurrentValue - 32 bit input value.
+ @param[in] NewValue - 32 bit New value.
+ @param[in] Start - Subfield start bit.
+ @param[in] Length - Subfield length in bits/
+
+ @retval The updated 32 bit value.
+**/
+extern
+U32
+MrcBitSwap (
+ IN U32 CurrentValue,
+ IN const U32 NewValue,
+ IN const U8 Start,
+ IN const U8 Length
+ );
+
+/**
+ This function returns the maximim Rx margin for a given Channel, Rank(s), and byte.
+
+ @param[in] MrcData - Pointer to MRC global data.
+ @param[in] Channel - Channel to calculate max Rx margin.
+ @param[in] RankRx - Rank index. 0xFF causes all ranks to be considered.
+ @param[in] byte - Byte to check.
+ @param[in] sign - Sign of the margins (0 - negative/min, 1 - positive/max).
+ @param[in] MaxMargin - Current max margin value.
+
+ @retval The max Rx margin, either MaxMargin or value from stored margins.
+**/
+extern
+U8
+MrcCalcMaxRxMargin (
+ IN MrcParameters *const MrcData,
+ IN const U8 Channel,
+ IN const U8 RankRx,
+ IN const U8 byte,
+ IN const U8 sign,
+ IN U8 MaxMargin
+ );
+
+/**
+ This function determines if a bit lane[0-7] has seen a pass and a fail in each byte for all channels populated.
+
+ @param[in] MrcData - Pointer to MRC global data.
+ @param[in] chBitmask - Bit mask of channels to consider.
+ @param[in] OnePass - Array of Bit masks marking DQ lanes has had a passing value.
+ @param[in] OneFail - Array of Bit masks marking DQ lanes has had a failing value.
+
+ @retval The AND result of each Channel/byte for OnePass and OneFail.
+**/
+extern
+U8
+MrcAndBytes (
+ IN MrcParameters *const MrcData,
+ IN const U8 chBitmask,
+ IN U8 OnePass[MAX_CHANNEL][MAX_SDRAM_IN_DIMM],
+ IN U8 OneFail[MAX_CHANNEL][MAX_SDRAM_IN_DIMM]
+ );
+
+/**
+ This function Finds the margin for all channels/all bits. The margin sweep is a parameterized
+ Assume REUT test has already been fully setup to run
+ This will unscale the results such that future tests start at the correct point
+ Uses ChangeMargin function to handle a variety cases (Timing, Voltage, Fan, etc.)
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] chBitMask - Channel BIT mask for Channel(s) to work on
+ @param[in] Rank - Rank to work on
+ @param[in,out] marginbit - used as the return data ( real margin measurement, no 10x)
+ marginbit[ch,byte,bit,sign] = abs(Margin)
+ Note: If param == RdTBit/RdVBit/WrVBit, marginbit is also the starting point
+ @param[in,out] marginbyte - provides the starting point on a per byte basis (still 10x)
+ @param[in] param - defines the margin type
+ @param[in] mode - allows for different types of modes for margining
+ {Bit0: PhLock (keep all bytes within in ch in phase),
+ Bit1: Ch2Ch Data out of phase (LFSR seed)
+ Bits 15:2: Reserved}
+ @param[in] MaxMargin - Default Maximum margin
+
+ @retval mrcSuccess if successful, otherwise it returns an error status.
+**/
+extern
+MrcStatus
+MrcGetMarginBit (
+ IN MrcParameters *const MrcData,
+ IN U8 chBitMask,
+ IN U8 Rank,
+ IN OUT U32 marginbit[MAX_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_BITS][MAX_EDGES],
+ IN OUT U32 marginbyte[MAX_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_EDGES],
+ IN U8 param,
+ IN U16 mode,
+ IN U8 MaxMargin
+ );
+
+/**
+ Assume REUT test has already been fully setup to run
+ Finds the margin for all channels/all bytes
+ The margin sweep is parameterized
+ Uses ChangeMargin function to handle a variety of cases (Timing, Voltage, Fan, etc.)
+ mode allows for different types of modes for margining:
+ mode is {Bit0: PhLock (keep all bytes within in ch in phase),
+ Bit1: Ch2Ch Data out of phase (LFSR seed), Bit 15:2: Reserved}
+ marginByte is used as the starting point for the search (10x the actual margin)
+ marginch returns the results (10x the actual margin)
+ Interior: Search inside marginch limits, enabling multiple calls with different setups
+ To reduce repeatibility noise, the returned margins is actually a BER extrapolation
+
+ @param[in] MrcData - The global MrcData
+ @param[in,out] marginByte - Data structure with the latest margin results
+ @param[in] chBitmask - Bit mask of present channels
+ @param[in] Rank - Rank to change margins for
+ @param[in] RankRx - Ranks for Rx margin
+ @param[in] param - parameter to get margins for
+ @param[in] mode - allows for different types of modes for margining:
+ @param[in] BMap - Byte mapping to configure error counter control register
+ @param[in] EnBER - Enable BER extrapolation calculations
+ @param[in] MaxMargin - Max Margin allowed for the parameter
+ @param[in] Interior - Search inside marginch limits, enabling multiple calls with different setups
+ @param[in,out] BERStats - Bit Error Rate Statistics.
+
+ @retval mrcSuccess if successful, otherwise returns an error status.
+**/
+extern
+MrcStatus
+MrcGetBERMarginByte (
+ IN MrcParameters * const MrcData,
+ IN OUT U32 marginByte[MAX_RESULT_TYPE][MAX_RANK_IN_CHANNEL][MAX_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_EDGES],
+ IN U8 chBitmask,
+ IN U8 Rank,
+ IN U8 RankRx,
+ IN U8 param,
+ IN U16 mode,
+ IN U8 *BMap,
+ IN U8 EnBER,
+ IN U8 MaxMargin,
+ IN U8 Interior,
+ IN OUT U32 *BERStats
+ );
+
+/**
+ Assume REUT test has already been fully setup to run
+ Finds the margin for all channels/all bytes
+ The margin sweep is parameterized
+ Uses ChangeMargin function to handle a variety of cases (Timing, Voltage, Fan, etc.)
+ mode allows for different types of modes for margining:
+ mode is {Bit0: PhLock (keep all bytes within in ch in phase),
+ Bit1: Ch2Ch Data out of phase (LFSR seed), Bit 15:2: Reserved}
+ marginCh is used as the starting point for the search (10x the actual margin)
+ marginch returns the results (10x the actual margin)
+ Interior: Search inside marginch limits, enabling multiple calls with different setups
+ To reduce repeatibility noise, the returned margins is actually a BER extrapolation
+
+ @param[in] MrcData - The global MrcData
+ @param[in,out] marginCh - Data structure with the latest margin results
+ @param[in] chBitmask - Bit mask of present channels
+ @param[in] RankRx - Ranks for Rx margin
+ @param[in] Rank - Rank to change margins for
+ @param[in] param - parameter to get margins for
+ @param[in] mode - allows for different types of modes for margining:
+ @param[in] EnBER - Enable BER extrapolation calculations
+ @param[in] MaxMargin - Max Margin allowed for the parameter
+ @param[in] Interior - Search inside marginch limits, enabling multiple calls with different setups
+ @param[in,out] BERStats - Bit Error Rate Statistics.
+
+ @retval mrcSuccess if successful, otherwise returns an error status.
+**/
+extern
+MrcStatus
+MrcGetBERMarginCh (
+ IN MrcParameters *MrcData,
+ IN U32 marginCh[MAX_RESULT_TYPE][MAX_RANK_IN_CHANNEL][MAX_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_EDGES],
+ IN OUT U8 chBitmask,
+ IN U8 RankRx,
+ IN U8 Rank,
+ IN U8 param,
+ IN U16 mode,
+ IN U8 EnBER,
+ IN U8 MaxMargin,
+ IN U8 Interior,
+ IN OUT U32 *BERStats
+ );
+
+/**
+ This function shifts a 32 bit int either positive or negative
+
+ @param[in] Value - Input value to be shifted
+ @param[in] ShiftAmount - Number of bits places to be shifted.
+
+ @retval 0 if ShiftAmount exceeds +/- 31. Otherwise the updated 32 bit value.
+**/
+extern
+U32
+MrcBitShift (
+ IN const U32 Value,
+ IN const S8 ShiftAmount
+ );
+
+/**
+ This function Sign extends OldMSB to NewMSB Bits (Eg: Bit 6 to Bit 7)
+
+ @param[in] CurrentValue - Input value to be shifted
+ @param[in] OldMSB - The original most significant Bit
+ @param[in] NewMSB - The new most significant bit.
+
+ @retval The updated 8 bit value.
+**/
+extern
+U8
+MrcSE (
+ IN U8 CurrentValue,
+ IN const U8 OldMSB,
+ IN const U8 NewMSB
+ );
+
+/**
+ This function calculates the Log base 2 of the value to a maximum of Bits
+
+ @param[in] Value - Input value
+
+ @retval Returns the log base 2 of input value
+**/
+extern
+U8
+MrcLog2 (
+ IN const U32 Value
+ );
+
+/**
+ ***** Has Buffer Overflow for 68-71, 544-575, 4352-4607, ... ****
+ This function calculates the Log base 8 of the Input parameter using integers
+
+ @param[in] Value - Input value
+
+ @retval Returns 10x the log base 8 of input Value
+**/
+extern
+U32
+MrcLog8 (
+ IN U32 Value
+ );
+
+/**
+ This function Sorts Arr from largest to smallest
+
+ @param[in,out] Arr - Array to be sorted
+ @param[in] Channel - Channel to sort.
+ @param[in] lenArr - Length of the array
+
+ @retval Nothing
+**/
+extern
+void
+MrcBsortPerChannel (
+ IN OUT U32 Arr[MAX_CHANNEL][4],
+ IN const U8 Channel,
+ IN const U8 lenArr
+ );
+
+/**
+ This function Sorts Arr from largest to smallest
+
+ @param[in,out] Arr - Array to be sort
+ @param[in] lenArr - Lenght of the array
+
+ @retval Nothing
+**/
+extern
+void
+MrcBsort (
+ IN OUT U32 *const Arr,
+ IN const U8 lenArr
+ );
+
+/**
+ This function calculates the Natural Log of the Input parameter using integers
+
+ @param[in] Input - 100 times a number to get the Natural log from.
+ Max Input Number is 40,000 (without 100x)
+
+ @retval 100 times the actual result. Accurate within +/- 2
+**/
+extern
+U32
+MrcNaturalLog (
+ IN U32 Input
+ );
+
+/**
+ This function calculates the number of bits set to 1 in a 32-bit value.
+
+ @param[in] Input - The value to work on.
+
+ @retval The number of bits set to 1 in Input.
+**/
+extern
+U8
+MrcCountBitsEqOne (
+ IN U32 Input
+ );
+
+/**
+ This function calculates e to the power of of the Input parameter using integers.
+
+ @param[in] Input - 100 times a number to elevate e to.
+
+ @retval 100 times the actual result. Accurate within +/- 2.
+**/
+extern
+U32
+Mrceexp (
+ IN U32 Input
+ );
+
+/**
+ This function writes a 32 bit register.
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Offset - Offset of register from MchBar Base Address.
+ @param[in] Value - Value to write.
+
+ @retval Nothing
+**/
+extern
+void
+MrcWriteCrMulticast (
+ IN MrcParameters *const MrcData,
+ IN const U32 Offset,
+ IN const U32 Value
+ );
+
+/**
+ This function writes a 64 bit register.
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Offset - Offset of register from MchBar Base Address.
+ @param[in] Value - Value to write.
+
+ @retval Nothing
+**/
+extern
+void
+MrcWriteCR64 (
+ IN MrcParameters *const MrcData,
+ IN const U32 Offset,
+ IN const U64 Value
+ );
+
+/**
+ This function writes a 32 bit register.
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Offset - Offset of register from MchBar Base Address.
+ @param[in] Value - Value to write.
+
+ @retval Nothing
+**/
+extern
+void
+MrcWriteCR (
+ IN MrcParameters *const MrcData,
+ IN const U32 Offset,
+ IN const U32 Value
+ );
+
+/**
+ This function writes a 8 bit register.
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Offset - Offset of register from MchBar Base Address.
+ @param[in] Value - The value to write.
+
+ @retval Nothing
+**/
+extern
+void
+MrcWriteCR8 (
+ IN MrcParameters*const MrcData,
+ IN const U32 Offset,
+ IN const U8 Value
+ );
+
+/**
+ This function reads a 64 bit register.
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Offset - Offset of register from MchBar Base Address.
+
+ @retval Value read from the register.
+**/
+extern
+U64
+MrcReadCR64 (
+ IN MrcParameters *const MrcData,
+ IN const U32 Offset
+ );
+
+/**
+ This function reads a 32 bit register.
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Offset - Offset of register from MchBar Base Address.
+
+ @retval Value read from the register
+**/
+extern
+U32
+MrcReadCR (
+ IN MrcParameters *const MrcData,
+ IN const U32 Offset
+ );
+
+/**
+ This function blocks the CPU for the duration specified in HPET Delay time.
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] DelayHPET - time to wait in 69.841279ns
+
+ @retval Nothing
+**/
+extern
+void
+MrcWait (
+ IN MrcParameters *const MrcData,
+ IN U32 DelayHPET
+ );
+
+/**
+ This function forces an RCOMP.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval Nothing
+**/
+extern
+void
+ForceRcomp (
+ IN MrcParameters * const MrcData
+ );
+
+/**
+ This function sets the self refresh idle timer and enables it.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval Nothing
+**/
+extern
+void
+EnterSR (
+ IN MrcParameters * const MrcData
+ );
+
+/**
+ This function sets the self refresh idle timer and disables it.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval Nothing
+**/
+extern
+void
+ExitSR(
+ IN MrcParameters * const MrcData
+ );
+
+/**
+ This function programs the WDB.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval Nothing
+**/
+extern
+void
+SetupWDB(
+ IN MrcParameters * const MrcData
+ );
+
+/*
+ This function will program all present channels with the 3 seeds passed in.
+
+ @param[in] MrcData - Global MRC data structure
+ @param[in] seeds - Array of 3 seeds programmed into PAT_WDB_CL_MUX_PB_RD/WR
+
+ @retval - Nothing
+*/
+extern
+void
+MrcProgramLFSR (
+ IN MrcParameters *const MrcData,
+ IN U32 const seeds[MRC_WDB_NUM_MUX_SEEDS]
+ );
+
+/**
+ This function Write 1 cacheline worth of data to the WDB
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Patterns - Array of bytes. Each bytes represents 8 chunks of the cachelines for 1 lane.
+ Each entry in Patterns represents a different cacheline for a different lane.
+ @param[in] PMask - Array of len Spread uint8. Maps the patterns to the actual DQ lanes.
+ DQ[0] = Patterns[PMask[0]], ... DQ[Spread-1] = Patterns[PMask[Spread-1]]
+ DQ[Spread] = DQ[0], ... DQ[2*Spread-1] = DQ[Spread-1]
+ @param[in] Start - Starting entry in the WDB.
+
+ @retval Nothing
+**/
+extern
+void
+WriteWDBFixedPattern (
+ IN MrcParameters *const MrcData,
+ IN U8 *const Patterns,
+ IN U8 *const PMask,
+ IN const U8 Spread,
+ IN const U16 Start
+ );
+
+/**
+ This rotine performs the following steps:
+ Step 0: Iterate through all VicRots
+ Step 1: Create a compressed vector for a given 32 byte cacheline
+ Each byte has a value of LFSR0=AA/LFSR1=CC/LFSR2=F0
+ Step 2: Expand compressed vector into chunks and 32 bit segments
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] vmask - 32 bit victim mask. 1 indicates this bit should use LFSR0
+ @param[in] amask - 32 bit aggressor mask. 0/1 indicates this bit should use LFSR1/2
+ @param[in] VicRot - Number of times to circular rotate vmask/amask
+ @param[in] Start - Starting entry in the WDB
+
+ @retval Nothing
+**/
+extern
+void
+WriteWDBVAPattern (
+ IN MrcParameters *const MrcData,
+ IN U32 amask,
+ IN U32 vmask,
+ IN const U8 VicRot,
+ IN const U16 Start
+ );
+
+/**
+ Write VA pattern in CADB
+ Use basic VA pattern for CADB with 2 LFSRs. Rotation is manual
+ Bit Order is [CKE[3:0], ODT[3:0], CMD[2:0], CS[3:0], BA[2:0], MA[15:0]]
+ [59:56] [51:48] [42:40] [35:32] [26:24] [15:0]
+
+ NOTE: CKE, ODT and CS are not used in functional mode and are ignored
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Channel - Channel to setup.
+ @param[in] VicSpread - Separation of the Victim Bit.
+ @param[in] VicBit - The Bit to be the Victim.
+ @param[in] LMNEn - To enable LMN counter
+
+ @retval Nothing
+**/
+extern
+void
+SetupCADB (
+ IN MrcParameters *const MrcData,
+ IN const U8 Channel,
+ IN const U8 VicSpread,
+ IN const U8 VicBit,
+ IN const U8 LMNEn
+ );
+
+/**
+ Program the subsequence type field in a given MCDFXS_CR_REUT_CHx_SUBSEQ_CTL_MCMAIN_x_STRUCT register
+
+ @param[in] MrcData - MRC global data
+ @param[in, out] SubSeqCtl - Address of the MCDFXS_CR_REUT_CHx_SUBSEQ_CTL_MCMAIN_x_STRUCT register
+ @param[in] Type - The subsequence type to program
+
+ @retval Nothing.
+**/
+void
+SetSubsequenceType (
+ IN MrcParameters *const MrcData,
+ IN OUT U32 *SubSeqCtl,
+ IN U32 Type
+ );
+
+/*
+ This function handles writing to the REUT Addressing sequence for IO Tests.
+ To not write a certain parameter, pass a NULL pointer to the function.
+
+ @param[in] MrcData - MRC global data structure.
+ @param[in] Channel - Specifies the channel to program.
+ @param[in] StartAddr - Start value for Rank/Bank/Row/Col.
+ @param[in] StopAddr - Stop value for Rank/Bank/Row/Col.
+ @param[in] FieldOrder - Relative order for carry propagates of Rank/Bank/Row/Col.
+ @param[in] IncRate - The number of writes to Rank/Bank/Row/Col before updating the address.
+ Note: The function will handle linear vs exponential and a value of 0 specifies a rate of 1.
+ @param[in] IncValue - The amount to increase Rank/Bank/Row/Col address.
+ @param[in] WrapTriggerEn - Enables wrap trigger for Rank/Bank/Row/Col to enable stopping on subsequence and sequence.
+ @param[in] WrapCarryEn - Enables carry propagation on wrap to the next higest order field
+ @param[in] AddrInvertEn - Enables inverting the Rank/Bank/Row/Col addresses based on AddrInvertRate.
+ @param[in] AddrIvertRate - Exponential rate of address inversion. Only updated if AddrInvertEn != NULL.
+ @param[in] EnableDebug - Enables/Disables debug printing.
+
+ @retval Nothing
+*/
+extern
+void
+MrcProgramSequenceAddress (
+ IN MrcParameters *const MrcData,
+ IN const U8 Channel,
+ IN const U16 StartAddr[MrcReutFieldMax],
+ IN const U16 StopAddr[MrcReutFieldMax],
+ IN const U8 FieldOrder[MrcReutFieldMax],
+ IN const U32 IncRate[MrcReutFieldMax],
+ IN const U16 IncValue[MrcReutFieldMax],
+ IN const U8 WrapTriggerEn[MrcReutFieldMax],
+ IN const U8 WrapCarryEn[MrcReutFieldMax],
+ IN const U8 AddrInvertEn[MrcReutFieldMax],
+ IN const U8 AddrInvertRate,
+ IN const BOOL EnableDebug
+ );
+
+/**
+ Programs all the key registers to define a CPCG test
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] WDBPattern - Structure that stores start, Stop, IncRate and Dqpat for pattern.
+ @param[in] ChbitMask - Channel Bit mak for which test should be setup for.
+ @param[in] CmdPat - [0: PatWrRd (Standard Write/Read Loopback),
+ 1: PatWr (Write Only),
+ 2: PatRd (Read Only),
+ 3: PatRdWrTA (ReadWrite Turnarounds),
+ 4: PatWrRdTA (WriteRead Turnarounds),
+ 5: PatODTTA (ODT Turnaround]
+ @param[in] NumCL - Number of Cache lines
+ @param[in] LC - Loop Count exponent
+ @param[in] REUTAddress - Structure that stores start, stop and increment details for address
+ @param[in] SOE - [0: Never Stop, 1: Stop on Any Lane, 2: Stop on All Byte, 3: Stop on All Lane]
+ @param[in] WDBPattern - Structure that stores start, Stop, IncRate and Dqpat for pattern.
+ @param[in] EnCADB - Enable test to write random deselect packages on bus to create xtalk/isi
+ @param[in] EnCKE - Enable CKE power down by adding 64
+ @param[in] SubSeqWait - # of Dclks to stall at the end of a sub-sequence
+
+ @retval Nothing
+**/
+extern
+void
+SetupIOTest (
+ IN MrcParameters *const MrcData,
+ IN const U8 ChbitMask,
+ IN const U8 CmdPat,
+ IN const U16 NumCL,
+ IN const U8 LC,
+ IN const MRC_REUTAddress *const REUTAddress,
+ IN const U8 SOE,
+ IN MRC_WDBPattern *const WDBPattern,
+ IN const U8 EnCADB,
+ IN const U8 EnCKE,
+ IN U16 SubSeqWait
+ );
+
+/**
+ This function sets up a test with CADB for the given channel mask.
+
+ @param[in,out] MrcData - Pointer to MRC global data.
+ @param[in] ChbitMask - Bit masks of channels to enable for the test.
+ @param[in] LC - Exponential umber of loops to run the test.
+ @param[in] SOE - Error handling switch for test.
+ @param[in] EnCADB - Switch to enable CADB
+ @param[in] EnCKE - Switch to enable CKE.
+
+ @retval Nothing
+**/
+extern
+void
+SetupIOTestCADB (
+ IN OUT MrcParameters *const MrcData,
+ IN const U8 ChbitMask,
+ IN const U8 LC,
+ IN const U8 SOE,
+ IN const U8 EnCADB,
+ IN const U8 EnCKE
+ );
+
+/**
+ This function sets up a basic victim-aggressor test for the given channel mask.
+
+ @param[in,out] MrcData - Pointer to MRC global data.
+ @param[in] ChbitMask - Bit masks of channels to enable for the test.
+ @param[in] LC - Exponential umber of loops to run the test.
+ @param[in] SOE - Error handling switch for test.
+ @param[in] EnCADB - Switch to enable CADB
+ @param[in] EnCKE - Switch to enable CKE.
+ @param[in] Spread - Stopping point of the pattern.
+
+ @retval Nothing
+**/
+extern
+void
+SetupIOTestBasicVA (
+ IN OUT MrcParameters *const MrcData,
+ IN const U8 ChbitMask,
+ IN const U8 LC,
+ IN const U8 SOE,
+ IN const U8 EnCADB,
+ IN const U8 EnCKE,
+ IN const U32 Spread
+ );
+
+/**
+ This function sets up a DQ test for the given channel mask.
+
+ @param[in,out] MrcData - Pointer to MRC global data.
+ @param[in] ChbitMask - Bit masks of channels to enable for the test.
+ @param[in] LC - Exponential umber of loops to run the test.
+ @param[in] SOE - Error handling switch for test.
+ @param[in] EnCADB - Switch to enable CADB
+ @param[in] EnCKE - Switch to enable CKE.
+
+ @retval Nothing
+**/
+extern
+void
+SetupIOTestDQ (
+ IN OUT MrcParameters *const MrcData,
+ IN const U8 ChbitMask,
+ IN const U8 LC,
+ IN const U8 SOE,
+ IN const U8 EnCADB,
+ IN const U8 EnCKE
+ );
+
+/**
+ This function sets up a test with CADB for the given channel mask.
+
+ @param[in,out] MrcData - Pointer to MRC global data.
+ @param[in] ChbitMask - Bit masks of channels to enable for the test.
+ @param[in] LC - Exponential umber of loops to run the test.
+ @param[in] SOE - Error handling switch for test.
+ @param[in] EnCADB - Switch to enable CADB
+ @param[in] EnCKE - Switch to enable CKE.
+
+ @retval Nothing
+**/
+extern
+void
+SetupIOTestC2C (
+ IN OUT MrcParameters *const MrcData,
+ IN const U8 ChbitMask,
+ IN const U8 LC,
+ IN const U8 SOE,
+ IN const U8 EnCADB,
+ IN const U8 EnCKE
+ );
+
+/**
+ This function sets up a MPR test for the given channel mask.
+
+ @param[in,out] MrcData - Pointer to MRC global data.
+ @param[in] ChbitMask - Bit masks of channels to enable for the test.
+ @param[in] LC - Exponential umber of loops to run the test.
+ @param[in] SOE - Error handling switch for test.
+ @param[in] EnCADB - Switch to enable CADB
+ @param[in] EnCKE - Switch to enable CKE.
+
+ @retval Nothing
+**/
+extern
+void
+SetupIOTestMPR (
+ IN OUT MrcParameters *const MrcData,
+ IN const U8 ChbitMask,
+ IN const U8 LC,
+ IN const U8 SOE,
+ IN const U8 EnCADB,
+ IN const U8 EnCKE
+ );
+
+/**
+ Runs one or more REUT tests (based on TestType)
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] ChbitMask - Channel Bit mask for which test should be setup for.
+ @param[in] DQPat - [0: BasicVA
+ 1: SegmentWDB
+ 2: CADB
+ 3: TurnAround
+ 4: LMNVa
+ 5: TurnAroundWR
+ 6: TurnAroundODT
+ 7: RdRdTA]
+ @param[in] SeqLCs - An array of one or more loopcounts.
+ @param[in] ClearErrors - Decision to clear or not errors.
+ @param[in] Mode - Allows for different types of modes for margining
+ {Bit0: PhLock (keep all bytes within in ch in phase),
+ Bit1: Ch2Ch Data out of phase (LFSR seed)
+ Bits 15:2: Reserved}
+
+ @retval Returns ch errors
+**/
+extern
+U8
+RunIOTest (
+ IN MrcParameters *const MrcData,
+ IN const U8 ChbitMask,
+ IN const U8 DQPat,
+ IN const U8 *const SeqLCs,
+ IN const U8 ClearErrors,
+ IN const U16 Mode
+ );
+
+/**
+ Programs REUT to run on the selected physical ranks.
+
+ @param[in] MrcData - Pointer to MRC global data.
+ @param[in] ch - Channel to enable.
+ @param[in] RankBitMask - Bit mask of ranks to enable.
+ @param[in] RankFeatureEnable - RankFeatureEnable is a bit mask that can enable CKE, Refresh or ZQ
+ RankFeatureEnable[0] enables Refresh on all non-selected ranks
+ RankFeatureEnable[1] enables Refresh on all ranks
+ RankFeatureEnable[2] enables ZQ on all non-selected ranks
+ RankFeatureEnable[3] enables ZQ on all ranks
+ RankFeatureEnable[4] enables CKE on all non-selected ranks
+ RankFeatureEnable[5] enables CKE on all ranks
+
+ @retval Bit mask of channel enabled if rank in the channel exists.
+**/
+extern
+U8
+SelectReutRanks (
+ IN MrcParameters *const MrcData,
+ IN const U8 ch,
+ IN U8 RankBitMask,
+ IN const U8 RankFeatureEnable
+ );
+
+/**
+ This routine updates RXTRAINRANK register's specific fields defined by the subfield
+ subfield values:
+ 0 - Update RcvEn - leave other parameter the same
+ 1 - Update RxDqsP - leave other parameter the same
+ 2 - Update RxEq - leave other parameter the same
+ 3 - Update RxDqsN - leave other parameter the same
+ 4 - Update RxVref - leave other parameter the same
+ 5 - Update RxDqsP & RxDqsN - leave other parameter the same
+ FF - leave all parameter the same
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Channel - Defines channel to update
+ @param[in] Rank - Defines rank to update
+ @param[in] Byte - Defines byte to update
+ @param[in] Subfield - Defines the register's field or fields to update
+ @param[in] Value - value to be writen into register fields
+
+ @retval Nothing
+**/
+extern
+void
+UpdateRxT (
+ IN MrcParameters *const MrcData,
+ IN const U8 Channel,
+ IN const U8 Rank,
+ IN const U8 Byte,
+ IN const U8 Subfield,
+ IN const U16 Value
+ );
+
+/**
+ This routine updates TXTRAINRANK register's specific fields defined by the subfield
+ subfield values:
+ 0 - Update TxDq - leave other parameter the same
+ 1 - Update TxDqs - leave other parameter the same
+ 2 - Update TxEq - leave other parameter the same
+ 3 - Update ALL from input value (non from Mrcdata structure)
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Channel - Defines channel to update
+ @param[in] Rank - Defines rank to update
+ @param[in] Byte - Defines byte to update
+ @param[in] Subfield - Defines the register's field or fields to update
+ @param[in] Value - value to be writen into register fields
+
+ @retval Nothing
+**/
+extern
+void
+UpdateTxT (
+ IN MrcParameters *const MrcData,
+ IN const U8 Channel,
+ IN const U8 Rank,
+ IN const U8 Byte,
+ IN const U8 Subfield,
+ IN const U32 Value
+ );
+
+/**
+ Returns the index into the array MarginResult in the MrcOutput structure.
+
+ @param[in] ParamV - Margin parameter
+
+ @retval One of the following values: LastRxV(0), LastRxT (1), LastTxV(2), LastTxT (3), LastRcvEna (4),
+ LastWrLevel (5), LastCmdT (6), LastCmdV (7)
+**/
+extern
+U8
+GetMarginResultType (
+ IN const U8 ParamV
+ );
+
+/**
+ This function Reads MrcData structure and finds the minimum last recorded margin for param
+ Searches across all bytes and ranks in RankMask
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in,out] MarginResult - Data structure with the latest margin results.
+ @param[in] Param - Defines the margin type
+ @param[in] Ranks - Condenses down the results from multiple ranks
+
+ @retval mrcWrongInputParameter if a bad Param is passed in, otherwise mrcSuccess.
+**/
+extern
+MrcStatus
+GetMarginCh (
+ IN MrcParameters *const MrcData,
+ IN OUT U32 MarginResult[MAX_RESULT_TYPE][MAX_RANK_IN_CHANNEL][MAX_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_EDGES],
+ IN const U8 Param,
+ IN const U8 Ranks
+ );
+
+/**
+ Use this function to retrieve the last margin results from MrcData
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in,out] MarginResult - Data structure with the latest margin results.
+ @param[in] Param - Defines the margin type
+ @param[in] RankIn - Which rank of the host structure you want the result returned on
+ @param[in] Ranks - Condenses down the results from multiple ranks
+
+ @retval MarginResult structure has been updated if MrcStatus returns mrcSuccess.
+ @retval Otherwise, mrcWrongInputParameter is returned if an incorrect Param is passed in.
+**/
+extern
+MrcStatus
+GetMarginByte (
+ IN MrcParameters *const MrcData,
+ IN OUT U32 MarginResult[MAX_RESULT_TYPE][MAX_RANK_IN_CHANNEL][MAX_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_EDGES],
+ IN const U8 Param,
+ IN const U8 RankIn,
+ IN const U8 Ranks
+ );
+
+/**
+ This function is use to "unscale" the MrcData last margin point
+ GetMarginByte will scale the results for FAN margin
+ This will unscale the results such that future tests start at the correct point
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in,out] MarginResult - Input array to be unscaled.
+ @param[in] Param - Defines the margin type for proper scale selection.
+ @param[in] Rank - Which rank of the host structure to work on
+
+ @retval mrcSuccess
+**/
+extern
+MrcStatus
+ScaleMarginByte (
+ IN MrcParameters *const MrcData,
+ IN OUT U32 MarginResult[MAX_RESULT_TYPE][MAX_RANK_IN_CHANNEL][MAX_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_EDGES],
+ IN const U8 Param,
+ IN const U8 Rank
+ );
+
+/**
+ This function is used by most margin search functions to change te underlying margin parameter.
+ This function allows single search function to be used for different types of margins with minimal impact.
+ It provides multiple different parameters, including 2D parameters like Read or Write FAN.
+ It can work in either MultiCast or single register mode.
+
+ @param[in,out] MrcData - Include all MRC global data.
+ @param[in] param - Includes parameter(s) to change including two dimentional.
+ @param[in] value0 - Selected value to program margin param to
+ @param[in] value1 - Selected value to program margin param to in 2D mode (FAN mode)
+ @param[in] EnMultiCast - To enable Multicast (broadcast) or single register mode
+ @param[in] channel - Desired Channel
+ @param[in] rankIn - Desired Rank - only used for the RxTBit and TxTBit settings and to propagate RdVref
+ @param[in] byte - Desired byte offset register
+ @param[in] bitIn - Desired bit offset Mrc data strucure if UpdateMrcData is 1
+ @param[in] UpdateMrcData - Used to decide if Mrc host must be updated
+ @param[in] SkipWait - Used to skip wait until all channel are done
+ @param[in] RegFileParam - Used to determine which Rank to download. Passed to MrcDownloadRegFile.
+
+ @retval MrcStatus - if succeeded, return mrcSuccess
+**/
+extern
+MrcStatus
+ChangeMargin (
+ IN OUT MrcParameters *const MrcData,
+ IN const U8 param,
+ IN const S32 value0,
+ IN const S32 value1,
+ IN const U8 EnMultiCast,
+ IN const U8 channel,
+ IN const U8 rankIn,
+ IN const U8 byte,
+ IN const U8 bitIn,
+ IN const U8 UpdateMrcData,
+ IN const U8 SkipWait,
+ IN const MrcRegFile RegFileParam
+ );
+
+/**
+ This function triggers the hardware to download the specified RegFile.
+ The setting of ReadRfRd and ReadRfWr must be mutually exclusive.
+ Only 1 (start download) and 0 (do nothing) are valid values for ReadRfXx.
+
+ @param[in] MrcData - Global MRC Data
+ @param[in] Channel - The Channel to download target.
+ @param[in] ByteMulticast - Enable Multicasting all bytes on that Channel.
+ @param[in] Rank - The Rank download target.
+ @param[in] RegFileParam - Used to determine which Rank to download.
+ MrcRegFileRank - Uses the Rank Parameter.
+ MrcRegFileStart - Uses the Rank in REUT_CH_SEQ_BASE_ADDR_START after decoding logical to physical.
+ MrcRegFileCurrent - Uses the Rank in REUT_CH_SEQ_BASE_ADDR_CURRENT after decoding logical to physical.
+ @param[in] Byte - The Byte download target.
+ @param[in] ReadRfRd - Download the read RegFile. 1 enables, 0 otherwise
+ @param[in] ReadRfWr - Download the write RegFile. 1 enables, 0 otherwise
+
+ @retval MrcStatus - If both ReadRfRd and ReadRfWr are set, the functions returns mrcWrongInputParameters.
+ Otherwise, mrcSuccess.
+**/
+void
+MrcDownloadRegFile (
+ IN MrcParameters * const MrcData,
+ IN const U8 Channel,
+ IN const BOOL ByteMulticast,
+ IN U8 Rank,
+ IN const MrcRegFile RegFileParam,
+ IN const U8 Byte,
+ IN const BOOL ReadRfRd,
+ IN const BOOL ReadRfWr
+ );
+
+/**
+ This procedure is meant to handle basic timing centering, places strobe in the middle of the data eye,
+ for both read and write DQ/DQS using a very robust, linear search algorthim.
+
+ @param[in,out] MrcData - Include all MRC global data.
+ @param[in] chBitMaskIn - Channel bit mask.
+ @param[in] param - {0:RcvEn, 1:RdT, 2:WrT, 3: WrDqsT, 4:RdV, 5:WrV, 6:WrLevel,
+ 8:WrTBit, 9:RdTBit, 10:RdVBit,
+ 16:RdFan2, 17:WrFan2, 32:RdFan3, 32:WrFan3}
+ ONLY RdT and WrT are allowed in this function
+ @param[in] ResetPerBit - Option to Reset PerBit Deskew to middle value before byte training
+ @param[in] loopcount - loop count
+
+ @retval MrcStatus - If succeeded, return mrcSuccess
+**/
+extern
+MrcStatus
+DQTimeCentering1D (
+ IN OUT MrcParameters *const MrcData,
+ IN const U8 chBitMaskIn,
+ IN const U8 param,
+ IN const U8 ResetPerBit,
+ IN const U8 loopcount
+ );
+
+/**
+ This procedure is meant to handle much more complex centering that will use a 2D algorithm to optimize asymetical
+ eyes for both timing and voltage margin.
+
+ @param[in,out] MrcData - Include all MRC global data.
+ @param[in,out] MarginResult - Margin data from centering
+ @param[in] ChBitMaskIn - Channel bit mask.
+ @param[in] param - {0:RcvEn, 1:RdT, 2:WrT, 3: WrDqsT, 4:RdV, 5:WrV, 6:WrLevel,
+ 8:WrTBit, 9:RdTBit, 10:RdVBit,
+ 16:RdFan2, 17:WrFan2, 32:RdFan3, 32:WrFan3}
+ ONLY RdT and WrT are allowed in this function
+ @param[in] EnPerBit - Option to enable per bit margining
+ @param[in] EnRxDutyCycleIn - Phase to center.
+ @param[in] ResetPerBit - Option to Reset PerBit Deskew to middle value before byte training
+ @param[in] LoopCount - loop count
+ @param[in] En2D - Option to only run center at nominal Vref point
+
+ @retval MrcStatus - If succeeded, return mrcSuccess
+**/
+extern
+MrcStatus
+DataTimeCentering2D (
+ IN OUT MrcParameters *const MrcData,
+ IN OUT U32 MarginResult[MAX_RESULT_TYPE][MAX_RANK_IN_CHANNEL][MAX_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_EDGES],
+ IN const U8 ChBitMaskIn,
+ IN const U8 Param,
+ IN const U8 EnPerBit,
+ IN const U8 EnRxDutyCycleIn,
+ IN const U8 ResetPerBit,
+ IN const U8 LoopCount,
+ IN const U8 En2D
+ );
+
+/**
+ Subfunction of 2D Timing Centering
+ Measures paramV margin across ch/bytes and updates the EH/VrefScale variables
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] ChBitMask - Channel Bit mak for which test should be setup for.
+ @param[in] rank - Defines rank to used for MrcData
+ @param[in] ParamV - Margin parameter
+ @param[in] MaxVScale - Maximum Voltage Scale to use
+ @param[in] BMap - Byte mapping to configure error counter control register
+ @param[in,out] EH - Structure that stores start, stop and increment details for address
+ @param[in,out] VrefScale - Parameter to be updated
+ @param[in,out] BERStats - Bit Error Rate Statistics.
+
+ @retval mrcSuccess if successful, otherwise the function returns an error status.
+**/
+extern
+MrcStatus
+DQTimeCenterEH (
+ IN MrcParameters * const MrcData,
+ IN const U8 ChBitMask,
+ IN const U8 rank,
+ IN const U8 ParamV,
+ IN const U8 MaxVScale,
+ IN U8 * const BMap,
+ IN OUT U32 EH[MAX_CHANNEL][MAX_SDRAM_IN_DIMM],
+ IN OUT U32 VrefScale[MAX_CHANNEL][MAX_SDRAM_IN_DIMM],
+ IN OUT U32 * const BERStats
+ );
+
+/**
+ Update the Vref value
+ if VrefType = 0 Updates Ch0 Vref_Dq
+ if VrefType = 1 Updates Ch1 Vref_Dq
+ if VrefType = 2 Updates Vref_CA
+
+ @param[in,out] MrcData - Include all MRC global data.
+ @param[in] VrefType - Determines the Vref to change
+ @param[in] UpdateMrcData - Used to decide if Mrc host must be updated
+ @param[in] Offset - Vref value
+ @param[in] SkipWait - Determines if we will wait for vref to settle after writing to register
+
+ @retval Nothing
+**/
+extern
+void
+UpdateVrefWaitTilStable (
+ IN OUT MrcParameters *const MrcData,
+ IN const U8 VrefType,
+ IN const U8 UpdateMrcData,
+ IN S32 Offset,
+ IN U8 SkipWait
+ );
+
+/**
+ This function is used to move CMD/CTL/CLK/CKE PIs during training
+
+ @param[in,out] MrcData - Include all MRC global data.
+ @param[in] Channel - Channel to shift PI for
+ @param[in] Iteration - Determines which PI to shift:
+ MrcIterationClock = 0
+ MrcIterationCmdN = 1
+ MrcIterationCmdS = 2
+ MrcIterationCke = 3
+ MrcIterationCtl = 4
+ MrcIterationCmdV = 5
+ @param[in] RankMask - Ranks to work on
+ @param[in] GroupMask - which LPDDR groups to work on for CMD/CLK/CKE; not used for DDR3
+ @param[in] NewValue - value to shift in case of CLK Iteration, New value for all other cases
+ @param[in] UpdateHost - Determines if MrcData structure is updated
+
+ @retval Nothing
+**/
+extern
+void
+ShiftPIforCmdTraining (
+ IN OUT MrcParameters *const MrcData,
+ IN const U8 Channel,
+ IN const U8 Iteration,
+ IN const U8 RankMask,
+ IN const U8 GroupMask,
+ IN S32 NewValue,
+ IN const U8 UpdateHost
+ );
+
+/**
+ Shifts RcvEn, WriteLevel and WriteDQS timing for all bytes
+ Usually used when moving the clocks on a channel
+
+ @param[in,out] MrcData - Include all MRC global data.
+ @param[in] Channel - Channel to update
+ @param[in] Rank - Rank to update
+ @param[in] ByteMask - Bytes to update
+ @param[in] Offset - value to shift
+ @param[in] UpdateHost - Determines if MrcData structure is updated
+ @param[in] SkipTx - Determines if TX update should be skipped
+
+ @retval Nothing
+**/
+extern
+void
+ShiftDQPIs (
+ IN OUT MrcParameters *const MrcData,
+ IN const U8 Channel,
+ IN const U8 Rank,
+ IN const U32 ByteMask,
+ IN const S8 Offset,
+ IN const U8 UpdateHost,
+ IN const U8 SkipTx
+ );
+
+/**
+ Retrieve the current memory frequency and clock from the memory controller.
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in, out] MemoryClock - The current memory clock.
+ @param[in, out] Ratio - The current memory ratio setting.
+ @param[in, out] RefClk - The current memory reference clock.
+
+ @retval: The current memory frequency.
+**/
+extern
+MrcFrequency
+MrcGetCurrentMemoryFrequency (
+ IN MrcParameters * const MrcData,
+ IN OUT U32 * const MemoryClock,
+ IN OUT MrcClockRatio * const Ratio,
+ IN OUT MrcRefClkSelect * const RefClk
+ );
+
+#ifdef ULT_FLAG
+/**
+ Translate LPDDR command from CA[9:0] high and low phase to DDR3 MA/BA/CMD.
+ This is needed to program CADB.
+
+ @param[in] CaHigh - CA[9:0] value on the rising clock
+ @param[in] CaLow - CA[9:0] value on the falling clock
+ @param[out] MA - Translated value of MA[15:0]
+ @param[out] BA - Translated value of BA[2:0]
+ @param[out] CMD - Translated value of CMD[2:0] = [RASb, CASb, WEb]
+
+ @retval none
+**/
+extern
+void
+MrcConvertLpddr2Ddr (
+ IN U32 const CaHigh,
+ IN U32 const CaLow,
+ OUT U32 * MA,
+ OUT U32 * BA,
+ OUT U32 * CMD
+ );
+
+/**
+ Run a short CADB sequence on selected channels
+
+ @param[in] MrcData - The MRC global data.
+ @param[in] ChBitMask - channels to work on.
+
+ @retval none
+**/
+extern
+void
+ShortRunCADB (
+ IN MrcParameters * const MrcData,
+ IN U8 ChBitMask
+ );
+
+#endif // ULT_FLAG
+/**
+ Get the Rx Bias values
+
+ @param[in, out] MrcData - Include all MRC global data.
+ @param[in, out] RxFselect - Location to save RxFselect.
+ @param[in, out] RxCBSelect - Location to save RxCBSelect.
+
+ @retval none
+**/
+extern
+void
+GetRxFselect (
+ IN MrcParameters *const MrcData,
+ IN OUT S8 *RxFselect,
+ IN OUT U8 *RxCBSelect
+ );
+
+#endif // _MrcCommon_h_
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcCrosser.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcCrosser.h
new file mode 100644
index 0000000..a0d838a
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcCrosser.h
@@ -0,0 +1,1329 @@
+/** @file
+ This file contains all the crosser training algorithm definitions.
+
+@Copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+**/
+#ifndef _MrcCrosser_h_
+#define _MrcCrosser_h_
+
+//
+// Include files
+//
+#include "MrcTypes.h"
+#include "MrcApi.h"
+#include "McAddress.h"
+#include "MrcCommon.h"
+#include "MrcDdr3.h"
+#include "MrcIoControl.h"
+#include "MrcOem.h"
+#include "MrcReadDqDqs.h"
+#include "MrcWriteDqDqs.h"
+#include "MrcRefreshConfiguration.h"
+#include "MrcTimingConfiguration.h"
+#include "MrcReset.h"
+
+#define MAX_BITS_FOR_OFFSET_TRAINING (MAX_BITS + 1) ///< for ULT offset training done for 8 bits + DQS bit
+
+///
+/// Module Defines
+///
+#define CROSSER_DISABLE_SQUARED_FUNCTION (0)
+#define CROSSER_ENABLE_SQUARED_FUNCTION (1)
+#define CROSSER_MIDDLE_SCALING_1 (1)
+#define CROSSER_OPTIMIZE_LOW_POWER (0)
+#define CROSSER_OPTIMIZE_HIGH_POWER (1)
+#define CROSSER_EXCLUDE_END_POINTS (0)
+#define CROSSER_INCLUDE_END_POINTS (1)
+
+///
+/// Enumerations and Structs
+///
+
+typedef enum {
+ RdOdt,
+ WrDS,
+ WrDSCmd,
+ WrDSCtl,
+ WrDSClk,
+ SCompDq,
+ SCompCmd,
+ SCompCtl,
+ SCompClk,
+ DisOdtStatic
+} TGlobalCompOffset;
+
+typedef enum {
+ RdSAmpOfft,
+ WrDSOfft,
+ RxEqOfft,
+ TxEqOfft,
+ RdOdtOfft,
+ SizeOfTCompOffset
+} TCompOffset;
+
+typedef enum {
+ rd2rdXtalk,
+ rd2wrXtalk,
+ wr2wrXtalk,
+ wr2rdXtalk,
+ AllXtalk
+} CrossTalkModes;
+
+///
+/// These enums index MoreResultsStrings in PrintCalcResultTableCh()
+///
+typedef enum {
+ MrcOptResultBest,
+ MrcOptResultGrdBnd,
+ MrcOptResultOffSel,
+ MrcOptResultScale,
+ MrcOptResultSignal,
+ MrcOptResultNoise,
+ MrcOptResultRatio,
+ MrcOptResultMaxPost,
+ MrcOptResultMinPost,
+ MrcOptResultTicks,
+ MrcOptResultSnrTot,
+
+ MrcOptResultMax
+} MrcOptResultString;
+
+
+#define MaxOptOff (35)
+
+#pragma pack (push, 1)
+typedef struct {
+ U32 EW;
+} OptResult;
+
+typedef struct {
+ U16 Best;
+ S8 GuardBand;
+ U8 Scale[5];
+ U32 Signal[5];
+ U32 Noise[5];
+ U32 Ratio[5];
+ U32 MaxPost[5];
+ U32 MinPost[5];
+ U16 Ticks[5];
+ U64 SNRTotal;
+ U64 MaxR;
+ U64 MinR;
+ U64 Result[MaxOptOff];
+ OptResult Margins[5][MaxOptOff];
+} OptResultsPerByte;
+#pragma pack (pop)
+
+typedef struct {
+ S16 Offset[MAX_CHANNEL][MAX_SDRAM_IN_DIMM];
+ U16 Margins[4][MAX_CHANNEL];
+ U8 TestList[4][MAX_CHANNEL];
+ U8 NumTests;
+ U8 Best;
+} OptOffsetChByte;
+
+typedef struct {
+ U8 RttNom[MAX_CHANNEL][MAX_DIMMS_IN_CHANNEL];
+ U8 RttWr[MAX_CHANNEL][MAX_DIMMS_IN_CHANNEL];
+ S8 GRdOdt;
+ U32 GRdOdtCode;
+} DimmOffset;
+
+typedef struct {
+ U32 CpuPwrRd;
+ U32 DimmPwrRd;
+ U32 CpuPwrWr;
+ U32 DimmPwrWrNT;
+ U32 DimmPwrWrT;
+ U32 ACPowerRd;
+ U32 ACPowerWr;
+ U32 ACPower;
+ U16 CpuPower;
+ U16 DimmPwr;
+ U16 TotPwr;
+} MrcPower;
+
+typedef struct {
+ DimmOffset ODTSet;
+ MrcPower PowerCalc;
+ U16 Test[5][MAX_CHANNEL];
+ OptOffsetChByte BestOptOff[SizeOfTCompOffset][MAX_RANK_IN_CHANNEL];
+ U8 NumTests;
+ U8 TestList[4];
+ U8 OptParamTestList[5];
+ U8 OptParamTestListSize;
+ U16 Points2Trade[5][MAX_CHANNEL];
+} DimmOptPoint;
+
+/**
+ This function implements Sense Amp Offset training.
+ SenseAmp/ODT offset cancellation
+ Find the best "average" point for Vref Control
+ Test Vref point with SampOffset=-7 and Test Vref Point with SampOffset=+7
+ Find Vref on per ch/byte basis where -7 samples all 1 and +7 samples all 0
+
+ @param[in,out] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - if it succeded return mrcSuccess
+**/
+extern
+MrcStatus
+MrcSenseAmpOffsetTraining (
+ IN OUT MrcParameters *const MrcData
+ );
+
+/**
+ This function looks at the margin values stored in the global data structure and checks
+ WrT, WrV, RdT, and RdV to see if they are above the minimum margin required.
+
+ @param[in, out] MrcData - MRC global data.
+
+ @retval mrcSuccess if margins are acceptable.
+ @retval Otherwise, mrcRetrain.
+**/
+MrcStatus
+MrcRetrainMarginCheck (
+ IN OUT MrcParameters *const MrcData
+ );
+
+/**
+ This function implements Dimm Ron training.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - if it succeeds return mrcSuccess
+**/
+extern
+MrcStatus
+MrcDimmRonTraining (
+ IN MrcParameters *const MrcData
+ );
+
+/**
+ This function implements DIMM ODT training.
+ Adjust DIMM RTT_NOM/RTT_WR value to maximize read/write voltage/timing
+
+ RdOdtPriority Needs to be an input parameter
+ option to prioritize the ReadODT setting and attempt to optimize that value first,
+ reducing CPU TDP power (as opposed to system power for the DRAM).
+ For this case, the base value for ReadODT is changed at the compensation block
+ by looking at the following values:
+ RdOdt Global: (50, 64, 84, 110)
+
+ In the case of 2 dpc, the flow will first optimizing RttNom, while keeping RttWr fixed
+ at 60 Ohms (60 Ohms usually gives the best results). It will then try to reduce RttWr
+ to 120 Ohms if possible.
+
+ In the case of 1 dpc, only RttNom is used and only a single pass is required.
+ However, it is important to note that the two channels are completely independent
+ and can have different numbers of dimms populated.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - if it succeed return mrcSuccess
+**/
+extern
+MrcStatus
+MrcDimmODTTraining (
+ IN MrcParameters *const MrcData
+ );
+
+/**
+ This function implements Dimm Odt training.
+ Optimize Dimm Odt value for performance/power
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - If it succeded return mrcSuccess
+**/
+extern
+MrcStatus
+MrcDimmODT1dTraining (
+ IN MrcParameters *const MrcData
+ );
+
+/**
+ This function implements Read Equalization training.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - if it succeeds return mrcSuccess
+**/
+extern
+MrcStatus
+MrcReadEQTraining (
+ IN MrcParameters *const MrcData
+ );
+
+/**
+ This function implements Write (Transmitter) Equalization training.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - if it succeeds return mrcSuccess
+**/
+extern
+MrcStatus
+MrcWriteEQTraining (
+ IN MrcParameters *const MrcData
+ );
+
+/**
+ This function implements Read Amplifier Power training.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - If it succeeds return mrcSuccess
+**/
+extern
+MrcStatus
+MrcReadAmplifierPower (
+ IN MrcParameters *const MrcData
+ );
+
+/**
+ Returns the index into the array OptResult in the MrcOutput structure.
+
+ @param[in] OptParam - Margin parameter
+
+ @retval One of the following values: RdSAmpOfft(0), WrDSOfft (1), RxEqOfft(2), TxEqOfft (3), RdOdtOfft(4)
+**/
+extern
+U8
+GetOptResultType(
+ IN U8 OptParam
+ );
+
+/**
+ This function implements Read ODT training and Write DS.
+ Optimize Read ODT strength for performance & power.
+
+ @param[in,out] MrcData - Include all MRC global data.
+ @param[in,out] BestOff - Structure containg the best offest and margins for th Opt param.
+ @param[in] ChannelMask - Channels to train
+ @param[in] RankMask - Condenses down the results from multiple ranks
+ @param[in] OptParam - Defines the OptParam Offsets.
+ Supported OptParam = [0: WrDS, 1: RdODT, 2: SComp, 3: TComp, 3: TxEq, 4: RxEq,
+ 5: RxBias, 6: DimmOdt, 7: DimmOdtWr]
+ @param[in] TestList - List of margin params that will be tested (up to 4)
+ @param[in] NumTests - The length of TestList
+ @param[in] Scale - List of the relative importance between the 4 tests
+ @param[in] PwrLimitsABC - List of the values for each test margin, above which margin is "adequate"
+ @param[in] Start - Start point of sweeping the Comp values
+ @param[in] Stop - Stop point of sweeping the Comp values
+ @param[in] LoopCount - The number of loops to run in IO tests.
+ @param[in] Repeats - Number of times to repeat the test to average out any noise
+ @param[in] NoPrint - Switch to disable printing.
+ @param[in] SkipOptUpdate - Switch to train but not update Opt settings.
+ @param[in] RdRd2Test - Switch to run with different TA times: possible values are [0, RdRdTA, RdRdTA_All]
+ @param[in] GuardBand - Signed offset to apply to the Opt params best value.
+
+ @retval Nothing
+**/
+extern
+void
+TrainDDROptParam (
+ IN OUT MrcParameters *const MrcData,
+ IN OUT OptOffsetChByte *BestOff,
+ IN U8 ChannelMask,
+ IN U8 RankMask,
+ IN U8 OptParam,
+ IN U8 *TestList,
+ IN U8 NumTests,
+ IN U8 *Scale,
+ IN U16 *PwrLimitsABC,
+ IN S8 Start,
+ IN S8 Stop,
+ IN U8 LoopCount,
+ IN U8 Repeats,
+ IN BOOL NoPrint,
+ IN BOOL SkipOptUpdate,
+ IN U8 RdRd2Test,
+ IN S8 GuardBand
+ );
+
+/**
+ This function implements Read ODT training.
+ Optimize Read ODT strength for performance & power
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - If it succeded return mrcSuccess
+**/
+extern
+MrcStatus
+MrcReadODTTraining (
+ IN MrcParameters *const MrcData
+ );
+
+/**
+ This function is the Write Drive Strength training entry point.
+ This step will optimize write drive strength for performance & power.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - If it succeeds return mrcSuccess
+**/
+extern
+MrcStatus
+MrcWriteDriveStrength (
+ IN MrcParameters *const MrcData
+ );
+
+/**
+ Updates a given ch/Rank/byte combination with a new value for OptParam
+ OptParam can be: WrDS, RdOdt, TComp, SComp, RxEq, TxEq, RxBias or DimmOdt
+ OptParam == OptDefault restore values from Host except Dimms Odt's
+ @param[in,out] MrcData - Include all MRC global data.
+ @param[in] Channel - Channel index to work on.
+ @param[in] Ranks - Condenses down the results from multiple ranks
+ @param[in] Byte - Byte index to work on.
+ @param[in] OptParam - Defines the OptParam Offsets.
+ Supported OptParam = [0: WrDS, 1: RdODT, 2: SComp, 3: TComp, 4: TxEq,
+ 5: RxEq, 6: RxBias, 7: DimmOdt, 8: DimmOdtWr]
+ @param[in] Off - Offset
+ @param[in] UpdateHost - Desides if MrcData has to be updated
+
+ @retval Nothing
+**/
+extern
+void
+UpdateOptParamOffset (
+ IN OUT MrcParameters *const MrcData,
+ IN const U8 Channel,
+ IN const U8 Ranks,
+ IN const U8 Byte,
+ IN const U8 OptParam,
+ IN S16 Off,
+ IN const U8 UpdateHost
+ );
+
+/**
+ Slightly penalize any Asymmetry in margin
+
+ @param[in] NegEdge - Negative edge of the margin
+ @param[in] PosEdge - Positive edge of the margin
+
+ @retval p2p - Width/Height reduced by the asymmetric difference in margin.
+**/
+extern
+U16
+EffectiveMargin (
+ IN const U16 NegEdge,
+ IN const U16 PosEdge
+ );
+
+/**
+ This function does a running average on Margins in two dimentional fashion.
+
+ @param[in,out] Margins - Margins to average
+ @param[in] Test - Selects the Margins to average
+ @param[in] MLen - Determines the Y-Dimension lengths
+ @param[in] XDim - Determines the X-Dimension lengths
+ @param[in] XMin - Used to skip the first elements in the Margin when averaging.
+ @param[in] CScale - Used to place more weight on the center point.
+
+ @retval Nothing
+**/
+extern
+void
+RunningAverage2D (
+ IN OUT U16 Margins[2][24],
+ IN const U8 Test,
+ IN const U8 MLen,
+ IN const U8 XDim,
+ IN const U8 XMin,
+ IN const U8 CScale
+ );
+
+/**
+ Updates a given ch/Rank/byte combination with a new value for OptParam
+ OptParam can be: WrDS, RdOdt, TComp, SComp, RxEq, TxEq, RxBias or DimmOdt
+
+ # Margins: Upto 4 arrays that contain lenMargin elements
+ # Index to the array represents some arbitrary parameter value that we are optimizing
+ # Scale is 4 element array that scales the relative importance on Margins[0] vs. [1] ...
+ # ex: To make Margins[0] twice as important, set Scale = [1, 2, 2, 2]
+ # Since the search optimizes the lowest margin, increasing 1/2/3 makes 0 more important
+ # This function can be used to optimize only Margin[0] by setting Scale = [1, 0, 0, 0]
+ # EnSq = 1 uses a squared function to make the tradeoff between 0/1/2/3 steeper
+ # If AveN > 0, pre-processes the results with a N point running average filter
+ # IncEnds: By setting to 1, the running average will also include the end points
+ # ScaleM: Allows the middle point of the running average to be scaled up
+ #
+ # In addition to optimizing for margin, this function can also optimize for power
+ # PwrLimit is a 4 element array that sets level where pwr is more important than margin
+ # Find any points where ((Margin[0]>PwrLimit[0]) & (Margin[1]>PwrLimit[1]) & ... )
+ # If such points exists and PwrOptHigh = 1, returns point with the highest X value
+ # If such points exists and PwrOptHigh = 0, returns point with the lowest X value
+ # If you don't want to optimize for power, set PwrLimitA and PwrLimitB to large number
+ # Power Optimize still uses the running average filter
+ #
+ # To avoid overflow, this function will automatic scale margins to fit in uint32
+
+ @param[in] MrcData - The global MRC data structure.
+ @param[in,out] OptResByte - Structure containing the optimized results.
+ @param[in] inputMargins - Margins we are optimizing
+ @param[in] MarginsLength - The length of inputMargins
+ @param[in] LenMargin - The length of inputMargins we are optimizing (0 - LenMargin -1).
+ @param[in] Scale - Controls the scaling of the input margin: 1-1, 1-2, ... and so on.
+ @param[in] EnSq - Enables the square root term in the optimization functions.
+ @param[in] AveN - The number of points used for the averaging filter.
+ @param[in] IncEnds - Controls if the endpoints are to be included.
+ @param[in] ScaleM - Controls the scaling of the middle point in 1-D average filter.
+ @param[in] PwrLimit - The power limit above which we only trade-off for power and not margin.
+ @param[in] PwrOptHigh - Controls returning the highest or lowest optimization point.
+ @param[in] GuardBand - Signed offest to check if margin drop is acceptable. Save good guardband
+ in OptResByte.
+
+ @retval Nothing.
+**/
+extern
+void
+FindOptimalTradeOff (
+ IN MrcParameters *const MrcData,
+ IN OUT OptResultsPerByte *OptResByte,
+ IN void *inputMargins,
+ IN U8 MarginsLength,
+ IN S8 LenMargin,
+ IN U8 *Scale,
+ IN U8 EnSq,
+ IN U8 AveN,
+ IN U8 IncEnds,
+ IN U8 ScaleM,
+ IN U16 *PwrLimit,
+ IN U8 PwrOptHigh,
+ IN S8 GuardBand
+ );
+
+/**
+ This function implements Turn Around Timing training.
+ Optimize TA ODT Delay and Duration
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - If it succeeds return mrcSuccess.
+**/
+extern
+MrcStatus
+MrcTurnAroundTiming (
+ IN MrcParameters * const MrcData
+ );
+
+/**
+ General purpose function to optimize an abritray value, OptParam (see list above)
+ OptParam is generally some timing number that impacts performance or power
+ Expects that as OptParam gets smaller*, margins are flat until we hit a cliff
+ This procedure defines a cliff as a reducution of 4 ticks in eye height/width
+ * In the case of mcodts, higher values are actually worst
+ To stress out the timing, xxDDR_CLK is shifted by +/- 15 PI ticks
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] OptParam - Supports Turnaround Timings and ODT Start / Duration
+ @param[in] TestList - List of margin param to check to make sure timing are okay.
+ @param[in] NumTests - The size of TestList
+ @param[in] Start - Start point for this turn around time setting.
+ @param[in] Stop - Stop point for this turnaround time setting.
+ Note that the Start/Stop values are the real values, not the encoded value
+ @param[in] LoopCount - Length of a given test
+ @param[in] Update - Update the CRs and host structure with ideal values
+ @param[in] ClkShifts - Array of Pi clocks to be shifted
+ @param[in] MarginByte - Byte level margins
+ @param[in] NumR2RPhases - Number of PI clock phases
+ @param[in] rank - rank to work on
+ @param[in] RankMask - RankMask to be optimized
+ @param[in] GuardBand - GuardBand to be added to last pass value (to be a bit conservative).
+
+ @retval MrcStatus - If it succeeds return mrcSuccess
+**/
+extern
+MrcStatus
+TrainDDROptParamCliff (
+ IN MrcParameters *const MrcData,
+ IN U8 OptParam,
+ IN U8 TestList[],
+ IN U8 NumTests,
+ IN S8 Start,
+ IN S8 Stop,
+ IN U8 LoopCount,
+ IN U8 Update,
+ IN U32 MarginByte[MAX_RESULT_TYPE][MAX_RANK_IN_CHANNEL][MAX_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_EDGES],
+ IN S8 *ClkShifts,
+ IN U8 NumR2RPhases,
+ IN U8 rank,
+ IN U8 RankMask,
+ IN U8 GuardBand
+ );
+
+/**
+ Sets commnad margins when moving WrT, WrTBox, or WrV
+ NOTE: ONLY one, ResetDDR or SelfRefresh can be set inside this function
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] ChBitMask - Bit mask of populated channels
+ @param[in] Ranks - Bit Mask of populated ranks
+ @param[in] Param - Input parameter to update
+ @param[in] Value0 - value to be added
+ @param[in] Value1 - value to be added
+ @param[in] ResetDDR - Do we reset DDR?
+ @param[in] SelfRefresh - Do we perform Self refresh?
+
+ @retval MrcStatus - If it succeeds return mrcSuccess
+**/
+extern
+void
+SetCmdMargin (
+ IN MrcParameters *const MrcData,
+ IN const U8 ChBitMask,
+ IN const U8 Ranks,
+ IN const U8 Param,
+ IN const U8 Value0,
+ IN const U8 Value1,
+ IN U8 ResetDDR,
+ IN const U8 SelfRefresh
+ );
+
+/**
+ Updates the value for following OptParamCliff variables:
+ drrd2rd=0, ddrd2rd=1, drwr2wr=2, ddwr2wr=3, drrd2wr=4, ddrd2wr=5, drwr2rd=6, ddwr2rd=7,
+ rdodtd=8, wrodtd=9, mcodts=10, mcodtd=11, rtl=12}
+
+ @param[in,out] MrcData - Include all MRC global data.
+ @param[in] Channel - Channel to update the specificed parameter.
+ @param[in] Byte - Byte to update the specified parameter.
+ @param[in] OptParam - Parameter to update.
+ @param[in] Off - Value to offset the current setting.
+ @param[in] UpdateHost - Switch to update the host structure with the new value.
+ @param[in] SkipPrint - Switch to skip debug prints.
+ @param[in] RankMask - Bit mask of Ranks to update.
+
+ @retval Nothing
+**/
+extern
+void
+UpdateTAParamOffset (
+ IN OUT MrcParameters *const MrcData,
+ IN const U8 Channel,
+ IN const U8 Byte,
+ IN const U8 OptParam,
+ IN const U8 Off,
+ IN const U8 UpdateHost,
+ IN const U8 SkipPrint,
+ IN const U8 RankMask
+ );
+
+/**
+ This function applies the new DRAM ODT settings
+ Walks through various optimizations to get the best result with new ODT values
+ This includes WrDS, RdODT, Eq, etc.
+ Updates Best* variables if this point if better than the prior points
+ chDone is both an input and output. Reports which channels have a good enough value
+ if SkipRd is high, it will skip the read related functions (RdODT, RdEq, RdTiming)
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in,out] DimmOptPoints - Structure of all the DIMM ODT optimal settings.
+ @param[in] ChMask - Channel to work on.
+ @param[in] RankMask - Rank to work on.
+ @param[in] skipGRdOdt - Used to skip RdODT.
+ @param[in] RttNom - Rtt_Nom value for each DIMM.
+ @param[in] RttWr - Rtt_Wr value for each DIMM.
+ @param[in] GRdOdt - CPU Global Read ODT.
+ @param[in] OptParamTestList - List of Opt test(Drive Strength, RxBias, TxEq, RxEq) to run.
+ @param[in] OptParamTestListSize - Size of OptParamTestList.
+ @param[in] SubPwrLimits - Switch to apply power limits to the suboptimization.
+ @param[in] skipOptTests - Skips the suboptimization.
+ @param[in] skipOptPrint - Skip printing of the suboptimization steps.
+ @param[in] RdCenter - Switch to recenter read.
+ @param[in] WrCenter - Switch to recenter write.
+ @param[in] inputBestMargin - Array of the best margin for each test.
+ @param[in] MarginsLength - Length of inputBestMargin.
+ @param[in] OffsetPoint - Index inside inputBestMargin to start.
+
+ @retval Nothing.
+**/
+extern
+void
+TrainDimmOdtSetting (
+ IN MrcParameters *const MrcData,
+ IN OUT DimmOptPoint *DimmOptPoints,
+ IN U8 ChMask,
+ IN U8 RankMask,
+ IN U8 skipGRdOdt,
+ IN U8 RttNom[MAX_CHANNEL][MAX_DIMMS_IN_CHANNEL],
+ IN U8 RttWr[MAX_CHANNEL][MAX_DIMMS_IN_CHANNEL],
+ IN S8 GRdOdt,
+ IN U8 *OptParamTestList,
+ IN U8 OptParamTestListSize,
+ IN BOOL SubPwrLimits,
+ IN BOOL skipOptTests,
+ IN BOOL skipOptPrint,
+ IN BOOL RdCenter,
+ IN BOOL WrCenter,
+ IN void *inputBestMargin,
+ IN U8 MarginsLength,
+ IN U8 OffsetPoint
+ );
+
+/**
+ This function applies an offset to the global compensation logic.
+ Reruns Compensation and returns the new comp value
+
+ @param[in,out] MrcData - Include all MRC global data.
+ @param[in] param - Parameter defining the desired global compensation logic
+ @param[in] offset - Value to apply
+ @param[in] UpdateHost - Desides if MrcData has to be updated
+
+ @retval Returns the new comp value.
+**/
+extern
+U32
+UpdateCompGlobalOffset (
+ IN OUT MrcParameters *const MrcData,
+ IN const U8 param,
+ IN const U32 offset,
+ IN const U8 UpdateHost
+ );
+
+/**
+ Programs Delay/Duration for the SenseAmp and MCODT based on RcvEn timing
+ Provide GuardBand > 0 if needed to be more conservative in timing
+ Main goal is to optimize power
+
+ @param[in,out] MrcData - Include all MRC global data.
+ @param[in] GuardBand - Input parameter with more conservative value
+
+ @retval Nothing
+**/
+extern
+void
+UpdateSampOdtTiming(
+ IN OUT MrcParameters *const MrcData,
+ IN const U8 GuardBand
+ );
+
+/**
+ Turns off unused portions of the slave DLL to save power
+
+ @param[in,out] MrcData - Include all MRC global data.
+
+ @retval Nothing
+**/
+extern
+void
+UpdateSlaveDLLLength(
+ IN OUT MrcParameters * const MrcData
+ );
+
+#ifdef TRAD_FLAG
+/**
+ Update Internal clocks on setting if needed.
+
+ @param[in,out] MrcData - Include all MRC global data.
+
+ @retval Nothing
+**/
+extern
+void
+UpdateInternalClksOn (
+ IN OUT MrcParameters *const MrcData
+ );
+#endif // TRAD_FLAG
+
+/**
+ This function Shifts the CMD timing.
+ NOTE: ONLY one, ResetDDR or SelfRefresh can be set inside this function
+
+ @param[in,out] MrcData - Include all MRC global data.
+ @param[in] Ranks - Parameter defining the desired global compensation logic
+ @param[in] offset - per channel Value to shift picode for
+ @param[in] ResetDDR - Do we reset DDR?
+ @param[in] SelfRefresh - Do we perform Self refresh?
+ @param[in] UpdateHost - Determines if MrcData has to be updated
+ @param[in] SkipTx - Determines if TX update should be skipped
+ @todo: SkipTx is NOT USED at this time and we don't skip it anyway
+
+ @retval MrcStatus - If it succeeds return mrcSuccess
+**/
+extern
+MrcStatus
+ShiftCh2Ch (
+ IN OUT MrcParameters *const MrcData,
+ IN const U8 Ranks,
+ IN const U8 *const offset,
+ IN U8 ResetDDR,
+ IN const U8 SelfRefresh,
+ IN const U8 UpdateHost,
+ IN const U8 SkipTx
+ );
+
+/**
+ Programs Delay/Duration for the SenseAmp and MCODT based on RcvEn timing
+ Provide GuardBand > 0 if needed to be more conservative in timing
+ Main goal is to optimize power
+
+ @param[in,out] MrcData - Include all MRC global data.
+ @param[in] ChMask - Channel to work on.
+ @param[in,out] BestDimmOptPoint - Best DIMM Opt settings used to update hardware
+ @param[in] SkipGRdOdt - Switch to skip updating CPU ODT
+ @param[in] SkipDimmOdts - Switch to skip updating DIMM ODT
+ @param[in] SkipBestOffsets - Switch to skip updating Opt settings
+ @param[in] UpdateHost - Switch to skip updating MRC host structure
+
+ @retval Nothing
+**/
+extern
+void
+UpdateOdtsValues(
+ IN OUT MrcParameters *const MrcData,
+ IN U8 ChMask,
+ IN OUT DimmOptPoint *BestDimmOptPoint,
+ IN BOOL SkipGRdOdt,
+ IN BOOL SkipDimmOdts,
+ IN BOOL SkipBestOffsets,
+ IN BOOL UpdateHost
+ );
+
+/**
+ Peform Read Voltage Centering in 2D.
+ Note: This function currently only supports param = RdV
+
+ @param[in,out] MrcData - Include all MRC global data.
+ @param[in,out] MarginByte - Pointer to Marging Results data structure
+ @param[in] ChBitMask - Channel bit mask.
+ @param[in] Param - {0:RcvEn, 1:RdT, 2:WrT, 3: WrDqsT, 4:RdV, 5:WrV, 6:WrLevel,
+ 8:WrTBit, 9:RdTBit, 10:RdVBit,
+ 16:RdFan2, 17:WrFan2, 32:RdFan3, 32:WrFan3}
+ ONLY RdV is allowed in this function
+ @param[in] EnPerBit - Option to enable per bit margining
+ @param[in] ResetPerBit - Option to Reset PerBit Deskew to middle value before byte training
+ @param[in] LoopCount - Loop count
+ @param[in] En2D - Option to only run center at nominal Vref point
+
+ @retval MrcStatus - If it succeded return mrcSuccess
+**/
+extern
+MrcStatus
+ReadVoltageCentering2D (
+ IN OUT MrcParameters *const MrcData,
+ IN OUT U32 MarginByte[MAX_RESULT_TYPE][MAX_RANK_IN_CHANNEL][MAX_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_EDGES],
+ IN U8 ChBitMask,
+ IN U8 Param,
+ IN U8 EnPerBit,
+ IN U8 ResetPerBit,
+ IN U8 LoopCount,
+ IN U8 En2D
+ );
+
+#ifdef MRC_DEBUG_PRINT
+/**
+ Prints OptParam values from CRs and Host structure for all ch/Rank/byte as well as
+ the Best optimization value (if requested)
+ OptWrDS = 0
+ OptRdOd = 1
+ OptSCom = 2
+ OptTComp = 3
+ OptTxEq = 4
+ OptRxEq = 5
+ OptRxBias = 6
+ OptDimmOdt = 7
+ OptDimmOdtWr = 8
+ OptDimmRon = 9
+ OptDefault = 10
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] ChMask - Channel Mask to print the summary for
+ @param[in] RankMask - Rank Mask to print the summary for (in case Rank is not applicable set RankMask = 0xF)
+ @param[in] OptParam - Defines the OptParam Offsets. OptDefault reports all parameters
+ @param[in] OptOff - Structure containg the best offest and margins for the OptParam.
+ If OptOffsetChByte is not available, NullPtr needs to be passed (void *NullPtr)
+ @param[in] OptResult - True/False: Whether to print the Best optimization value
+
+ @retval Nothing
+**/
+extern
+void
+ReadOptParamOffsetSum (
+ IN MrcParameters *const MrcData,
+ IN U8 ChMask,
+ IN U8 RankMask,
+ IN const U8 OptParam,
+ IN OptOffsetChByte *OptOff,
+ IN BOOL OptResult
+ );
+
+/**
+ Reads OptParam value from CRs and Host structure for a given ch/Rank/byte combination
+ OptParam can be: WrDS, RdOdt, TComp, SComp, RxEq, TxEq, RxBias, DIMM Ron, DIMM RttNom or DIMM RttWr
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[out] FinalVal - Pointer to the array consisting of CR value and Host value for a particular
+ OptParam and given ch/Rank/byte combination.
+ @param[in] Channel - Channel index to work on.
+ @param[in] Rank - Rank index to work on (valid only for TxEq and RxEq, for others is ignored)
+ @param[in] Byte - Byte index to work on.
+ @param[in] OptParam - Defines the OptParam Offsets. Supported OptParam =
+ [0: WrDS, 1: RdODT, 2: SComp, 3: TComp, 3: TxEq,
+ 4: RxEq, 5: RxBias, 6: DimmOdt, 7: DimmOdtWr]
+
+ @retval Nothing
+**/
+extern
+void
+ReadOptParamOffset (
+ IN MrcParameters *const MrcData,
+ OUT S16 *FinalVal,
+ IN const U8 Channel,
+ IN const U8 Rank,
+ IN const U8 Byte,
+ IN const U8 OptParam
+ );
+
+/**
+ This function prints the Optimize margin result table
+ e.g: MarginResult[Test][Offset][Channel][Byte][sign]
+
+ @param[in] MrcData - MRC data structure
+ @param[in] ChMask - Channels to print
+ @param[in] ResultArray - Array with saved margin results
+ @param[in] TestNum - Test index
+ @param[in] OffsetsNum - number of offsets
+ @param[in] MidPoint - Zero point
+ @param[in] Edges - 1 edge or 2 edge
+ @param[in] OptParam - Used to convert to the Opt param string for printing
+ @param[in] Param - Margin type to be printed.
+ @param[in] PowerLimits - Power limits to print.
+ @param[in] noPrint - Used to skip printing.
+
+ @retval Nothing
+**/
+extern
+void
+PrintResultTableByte4by24(
+ IN MrcParameters *MrcData,
+ IN U8 ChMask,
+ IN U16 ResultArray[4][24][MAX_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_EDGES],
+ IN U16 TestNum,
+ IN U8 OffsetsNum,
+ IN U8 MidPoint,
+ IN U8 Edges,
+ IN U8 OptParam,
+ IN U8 Param,
+ IN U16 *PowerLimits,
+ IN BOOL noPrint
+ );
+
+/**
+ This function prints the Optimize margin result table
+ e.g: calcResultSummary[MAX_CHANNEL][MAX_SDRAM_IN_DIMM]
+
+ @param[in] MrcData - MRC data structure
+ @param[in] calcResultSummary - The data array [MAX_CHANNEL][MAX_SDRAM_IN_DIMM]
+ @param[in] TestList - Test list
+ @param[in] NumTest - Number of test
+ @param[in] NumOffsets - Number of offsets
+ @param[in] MidPoint - Middle point
+ @param[in] IncEnds - Print ends points
+ @param[in] OptParam - Used to convert to the Opt param string for printing
+ @param[in] OptPower - Opt Power values to be printed
+ @param[in] Channel - Channel to print
+ @param[in] Ranks - Ranks to print
+ @param[in] TrendLine - Switch to print the trend line
+ @param[in] Nibble - take low/high bytes
+ @param[in] perCh - Switch to only print 1 Byte of data
+ @param[in] noPrint - Boolean used to disable printing of results
+
+ @retval Nothing
+**/
+extern
+void
+PrintCalcResultTableCh(
+ IN MrcParameters *const MrcData,
+ IN OptResultsPerByte calcResultSummary[MAX_CHANNEL][MAX_SDRAM_IN_DIMM],
+ IN U8 *TestList,
+ IN U8 NumTest,
+ IN U8 NumOffsets,
+ IN S8 MidPoint,
+ IN BOOL IncEnds,
+ IN U8 OptParam,
+ IN U16 *OptPower,
+ IN U8 Channel,
+ IN U8 Ranks,
+ IN BOOL TrendLine,
+ IN U8 Nibble,
+ IN BOOL perCh,
+ IN BOOL noPrint
+ );
+
+/**
+ This function prints the Optimize margin result table
+ e.g: calcResultSummary[MAX_CHANNEL][MAX_SDRAM_IN_DIMM]
+
+ @param[in] MrcData - MRC data structure
+ @param[in] calcResultSummary - The data array [MAX_CHANNEL][MAX_SDRAM_IN_DIMM]
+ @param[in] DimmOptPoints - add argument and description to function comment
+ @param[in] TestList - Test list
+ @param[in] NumTest - Number of test
+ @param[in] NumOffsets - Number of offsets
+ @param[in] MidPoint - Middle point
+ @param[in] IncEnds - Print ends points
+ @param[in] OptParam - Used to convert to the Opt param string for printing
+ @param[in] Channel - Channel to print
+ @param[in] Ranks - Ranks to print
+ @param[in] TrendLine - Switch to print the trend line
+ @param[in] Nibble - take low/high bytes
+ @param[in] perCh - Switch to only print 1 Byte of data
+
+ @retval Nothing
+**/
+extern
+void
+PrintODTResultTable(
+ IN MrcParameters *const MrcData,
+ IN OptResultsPerByte *calcResultSummary,
+ IN DimmOptPoint *DimmOptPoints,
+ IN U8 NumOffsets,
+ IN S8 MidPoint,
+ IN BOOL IncEnds,
+ IN U8 OptParam,
+ IN U8 Channel,
+ IN U8 Ranks,
+ IN BOOL TrendLine,
+ IN U8 Nibble,
+ IN BOOL perCh
+ );
+
+/**
+ This function will print out the last margin data collected of the Param passed in.
+ It will print both edges of all the requested bytes, Ranks and Channels.
+ NOTE: The function will not check to see if the Rank/Channel exists. It will print out the
+ values stored in the margin array regardless of population status.
+
+ @param[in] MrcData - Global MRC data.
+ @param[in] Param - Parameter of MRC_MarginTypes of which to print the margin.
+ @param[in] ChannelMask - Bit mask of channels to print.
+ @param[in] RankMask - Bit mask of ranks to print.
+ @param[in] ByteMask - Bit mask of bytes to print.
+
+ @retval Nothing.
+**/
+void
+MrcPrintLastMargins (
+ IN MrcParameters *const MrcData,
+ IN const U8 Param,
+ IN const U8 ChannelMask,
+ IN const U8 RankMask,
+ IN const U16 ByteMask
+ );
+#endif // MRC_DEBUG_PRINT
+
+/**
+ This function returns the UPM or PWR limit value for the specified parameter
+
+ @param[in] MrcData - Pointer to MRC global data.
+ @param[in] Param - Margin type
+ @param[in] LimitType - Type of limit: UpmLimit or PowerLimit
+
+ @retval Returns the UPM or PWR limit
+**/
+extern
+U16
+UpmPwrLimitValue (
+ IN MrcParameters *const MrcData,
+ IN U8 Param,
+ IN U8 LimitType
+ );
+
+/**
+ This function will adjust the requested Limit Type of the margin parameter by the signed offset passed in.
+
+ @param[in] MrcData - MRC global data.
+ @param[in] Param - Margin parameter type to adjust.
+ @param[in] LimitType - MRC_MARGIN_LIMIT_TYPE to adjust.
+ @param[in] Offset - The adjustment value.
+
+ @retval U16 - The new value of Param[MRC_MARGIN_LIMIT_TYPE]
+**/
+U16
+MrcUpdateUpmPwrLimits (
+ IN OUT MrcParameters * const MrcData,
+ IN U8 Param,
+ IN U8 LimitType,
+ IN S8 Offset
+ );
+
+/**
+ Calculate Power based on Ron and Rodt
+ Includes both static power from Ron/Rodt and dynamic power from Cpad/Cline
+ The power results here are not absolutely correct but give a reasonable estimate (ie: within 2x) with the proper trends
+ Getting absolutely correct power numbers with simple calculations is fairly difficult given the transmission line nature of the system
+ Driver power is calculated as the amount of power drawn from the CPU pin (do we want this to be thermal power instead?) based on the Ron and ODTeff
+ ODTeff is calculated as both the real, resistive ODT on the bus in parallel with the effective impendence of the cap on the line
+ This effective impedance is how AC power is included in the measurements
+ This better models the real system behavior where the power consumed due to dynamic power reduces as termination strength increases
+ ODT power is calculated as a purely DC term based on Ron and Rodt
+ The final power reported back is a scaled version of the CPU and DRAM power
+ This allows one to weight the CPU vs. DRAM power differently in the optimization function based on what is more important
+ CPU power is generally more important since it can be translated into additional performance
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[out] Results - Results of the Power power calculations
+ @param[in] RonCpu - RON CPU value (ohm)
+ @param[in] RonDimm - RON DIMM value (ohm)
+ @param[in] Rodtcpu - RODT CPU value
+ @param[in] Rodtdram - RODT DRAM value
+ @param[in] Wodtdram - WODT DRAM value
+
+ @retval Nothing
+**/
+extern
+void
+CalcPower(
+ IN MrcParameters *MrcData,
+ OUT MrcPower *Results,
+ IN U16 RonCpu,
+ IN U8 RonDimm,
+ IN U16 Rodtcpu,
+ IN U16 Rodtdram,
+ IN U16 Wodtdram
+ );
+
+/**
+ This function fill the input array (e.g array[ch][rank]) with the power calculation
+ per rank/ch for current sys. setting.
+
+ @param[in] MrcData - MRC data struct;
+ @param[in,out] PwrChRank - Array to fill;
+
+ @retval Nothing
+**/
+extern
+void
+CalcSysPower (
+ IN MrcParameters *const MrcData,
+ IN OUT MrcPower PwrChRank[MAX_CHANNEL][MAX_RANK_IN_CHANNEL]
+ );
+
+/**
+ Calculate Power Trend line based on Cpu and Dimms Ron and Odt's
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Channel - Channel to work on.
+ @param[in] DimmMask - DIMMs to work on.
+ @param[in,out] DimmOptPoints - Structure of all the DIMM ODT optimal settings.
+ @param[in] Points2calc - Data to build the trendline on.
+ @param[in] ArrayLength - Array length of Points2calc.
+ @param[in] LenMargin - The length of inputMargins we are optimizing (0 - LenMargin -1).
+ @param[in] TestList - TestList index in Points2cal: WrVref, RdVref, WrT, RdT
+ @param[in] Scale - Scale to apply per test to Points2calc
+ @param[in] TestListSize - Size of TestList/Scale
+ @param[in] PwrCalc1d - Determines if the power test is 1-D or 2-D.
+ @param[in] PWRTrendSlope - Determines how aggressive the T-line will be.(0%-100%)
+
+ @retval Nothing
+**/
+extern
+void
+CalcPowerTrend(
+ IN MrcParameters *MrcData,
+ IN U8 Channel,
+ IN U8 DimmMask,
+ IN OUT void *DimmOptPoints,
+ IN void *Points2calc,
+ IN U8 ArrayLength,
+ IN U8 LenMargin,
+ IN U8 *TestList,
+ IN U8 *Scale,
+ IN U8 TestListSize,
+ IN BOOL PwrCalc1d,
+ IN U8 PWRTrendSlope
+ );
+
+/**
+ This function returns the Actual Cpu Driver Impedance (1 segment) in ohm.
+
+ @param[in] MrcData - Pointer to MRC global data.
+ @param[in] Offset - Vref Offset (+-8).
+
+ @retval Returns the CPU driver impedance value (for 1 segment)
+**/
+extern
+U16
+CalcDrvImp (
+ IN MrcParameters *const MrcData,
+ IN S8 Offset
+ );
+
+/**
+ This function returns the Actual Cpu Odt termination in ohm.
+
+ @param[in] MrcData - Pointer to MRC global data.
+ @param[in] Offset - Vref Offset (+-16).
+
+ @retval Returns the Odt termination value.
+**/
+extern
+U16
+CalcRdOdt (
+ IN MrcParameters *const MrcData,
+ IN S8 Offset
+ );
+
+/**
+ Calculate Power for the selected Opt param based on
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Channel - Channel to work on
+ @param[in] Rank - Rank to work on
+ @param[in] Byte - Byte to work on
+ @param[in] OptParam - The Opt Parameter to work on
+ @param[in] Offset - The Offset to work on
+ @param[in] CurrentComp - The current Comp code for OptParam
+ @param[in] ReadHost - Switch to read current offset and CompCode from Host structure.
+
+ @retval Calc power in mW
+**/
+extern
+U32
+CalcOptPower(
+ IN MrcParameters *MrcData,
+ IN U8 Channel,
+ IN U8 Rank,
+ IN U8 Byte,
+ IN U8 OptParam,
+ IN S8 Offset,
+ IN S8 CurrentComp,
+ IN BOOL ReadHost
+ );
+
+/**
+ This function implements Write Slew Rate training.
+ Optimize Write Slew Rate for performance & power
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval mrcSuccess
+**/
+extern
+MrcStatus
+MrcWriteSlewRate (
+ IN MrcParameters *const MrcData
+ );
+
+/**
+ This function prints out the Margin eye diagram for ParamT/ParamV.
+
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Channel - Channel to margin.
+ @param[in] Ranks - Bit mask of Ranks to margin.
+ @param[in] ParamT - Time parameter to margin.
+ @param[in] ParamV - Voltage parameter to margin.
+ @param[in] Start - Starting point for margining.
+ @param[in] Stop - Stopping point for margining.
+ @param[in] Repeats - Number of times to repeat the test to average out any noise.
+ @param[in] NoPrint - Switch to skip printing.
+
+ @retval Nothing
+**/
+extern
+void
+EyeMargin (
+ IN MrcParameters *const MrcData,
+ IN U8 Channel,
+ IN U8 Ranks,
+ IN U8 ParamT,
+ IN U8 ParamV,
+ IN S8 Start,
+ IN S8 Stop,
+ IN U16 SearchLimits,
+ IN U8 LoopCount,
+ IN U8 Repeats,
+ IN BOOL NoPrint
+ );
+
+/**
+ This function optimize the digital offsets by reducing the digital
+ offset and apply the difference to the global one.
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Param - Parameter defining the desired digital compensation offset.
+ @param[in] UpdateHost - Decides if MrcData is to be updated.
+
+ @retval The new comp value.
+**/
+extern
+U32
+OptimizeCompOffset (
+ IN MrcParameters *const MrcData,
+ IN const U8 Param,
+ IN const U8 UpdateHost
+ );
+
+/**
+ This function implements the Write Drive Strength optimization for performance and power.
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] ChBitMask - Channel mask to perform training on the Opt Param test list.
+ @param[in] RecenterLC - The loopcount for Write Time recentering.
+ @param[in] OptParamLC - The loopcount for training the Opt Param test list.
+ @param[in] Recenter - Switch which determines if the step recenters Write Timing.
+
+ @retval If it succeeds return mrcSuccess
+**/
+extern
+MrcStatus
+TrainWriteDriveStrength (
+ IN MrcParameters *const MrcData,
+ IN const U8 ChBitMask,
+ IN const U8 RecenterLC,
+ IN const U8 OptParamLC,
+ IN const BOOL Recenter
+ );
+
+/**
+ This step performs Comp Offset optimization on the param list defined in this function.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - mrcSuccess
+**/
+extern
+MrcStatus
+MrcOptimizeComp (
+ IN MrcParameters *const MrcData
+ );
+
+/**
+ This function calculates the percent of power saving from the power optimization steps and
+ updates the proper registers in the PCU. To get the correct base line for this calculation,
+ this routing needs to run first time early in the training in order to update the MrcStruct
+ with the base line. After the power training steps, it will run again to get the actual
+ percent of power saving.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - mrcSuccess
+
+**/
+extern
+MrcStatus
+MrcPowerSavingMeter (
+ IN MrcParameters *const MrcData
+ );
+
+#endif // _MrcCrosser_h_
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcDdr3.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcDdr3.h
new file mode 100644
index 0000000..a1ce4e1
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcDdr3.h
@@ -0,0 +1,449 @@
+/** @file
+ This file includes all the DDR3 specific characteristic definitions.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+
+**/
+#ifndef _MrcDdr3_h_
+#define _MrcDdr3_h_
+
+#include "MrcTypes.h"
+#include "MrcApi.h"
+#include "McAddress.h"
+#include "MrcCommon.h"
+#include "MrcDdr3Registers.h"
+#include "MrcIoControl.h"
+#include "MrcOem.h"
+#include "MrcPowerModes.h"
+#include "MrcRefreshConfiguration.h"
+
+#pragma pack (push, 1)
+///
+/// in write leveling mode Rtt_Nom = Rtt_Wr
+///
+typedef struct {
+ U8 RttWr; ///< Wa - Write ODT on active rank
+ U8 RttNom; ///< Wp - ODT on one of the ranks on passive DIMM during Write operation
+} TOdtValue;
+
+typedef enum {
+ oi1DPC1R = 0,
+ oi1DPC2R,
+ oi2DPC1R1R,
+ oi2DPC1R2R,
+ oi2DPC2R1R,
+ oi2DPC2R2R,
+ oiNotValid
+} TOdtIndex;
+
+typedef enum {
+ ODIC_RZQ_6,
+ ODIC_RZQ_7,
+ ODIC_RSVD_0,
+ ODIC_RSVD_1
+} TOutputDriverImpedanceControl;
+
+///
+/// ZQ Calibration types
+///
+typedef enum {
+ MRC_ZQ_INIT, ///< DDR3: ZQCL with tZQinit, LPDDR3: ZQ Init with tZQinit
+ MRC_ZQ_LONG, ///< DDR3: ZQCL with tZQoper, LPDDR3: ZQ Long with tZQCL
+ MRC_ZQ_SHORT, ///< DDR3: ZQCS with tZQCS, LPDDR3: ZQ Short with tZQCS
+ MRC_ZQ_RESET ///< DDR3: not used, LPDDR3: ZQ Reset with tZQreset
+} MrcZqType;
+
+#ifndef tZQinit
+#define tZQinit (512) ///< define the tZQinit as define in jedec spec
+#endif
+
+#ifndef tWLMRD
+#define tWLMRD (40) ///< First DQS/DQS# rising edge after write leveling mode is programmed.
+#endif
+
+#ifndef tWLOE
+#define tWLOE (40) ///< Write leveling output error the time is 2ns ~ 2 nCK
+#endif
+
+#ifndef tZQCS_TIME
+#define tZQCS_TIME (64) ///< jedec timing
+#endif
+
+#define MRC_DDR3_SDRAM_TYPE_NUMBER (0x0B) ///< use to know the DDR type that data came from Jedec SPD byte 2
+#define MRC_UDIMM_TYPE_NUMBER (0x02) ///< use to know if the DIMM type is UDIMM define in Jedec SPD byte 3
+#define MRC_SOIMM_TYPE_NUMBER (0x03) ///< use to know if the DIMM type is SO-DIMM define in Jedec SPD byte 3
+#define MRC_SDRAM_DEVICE_WIDTH_8 (0x1) ///< use to know if the DDRAM is 8 bits width
+#define MRC_SDRAM_DEVICE_WIDTH_16 (0x2) ///< use to know if the DDRAM is 16 bits width
+#define MRC_PRIMARY_BUS_WIDTH_64 (0x3) ///< use to know if the DIMM primary bus width is not 64
+#define MRC_CL_MAX_OFFSET (0xF) ///< in the spd data include cl from bit 0 to bit 15 each bit represent different support CL
+#define MRC_CL_IN_NANO_SEC (20) ///< define the nax CL value in nano second
+
+/**
+@brief
+ this function reverses MA and BA bits for Rank1
+
+ @param[in] BA - MRS command to be sent
+ @param[in] MA - Value to be sent
+
+ @retval Proper MA and BA BITS.
+**/
+extern
+U32
+MrcMirror (
+ IN U8 BA,
+ IN U16 MA
+ );
+
+/**
+@brief
+ this function writes to CADB
+
+ @param[in] MrcData - include all the MRC data
+ @param[in] Channel - Channel to send command to
+ @param[in] RankMask - Rank mask for which command will be sent to.
+ @param[in] CMD - 0: MRS, 1: REF, 2: PRE, 3: ACT, 4: WR, 5: RD, 6: ZQ, 7: NOP
+ @param[in] BA - MRS command to be sent
+ @param[in] MA - Value to be sent
+ @param[in] Delay - Delay in Dclocks
+
+ @retval MrcStatus
+**/
+extern
+MrcStatus
+MrcWriteCADBCmd (
+ IN MrcParameters *const MrcData,
+ IN const U8 Channel,
+ IN const U8 RankMask,
+ IN const U8 CMD,
+ IN const U8 BA,
+ IN const U16 *const MA,
+ IN const U8 Delay
+ );
+
+/**
+@brief
+ This function sends the proper MRS command for specific ranks as indicated by RankMask
+
+ @param[in] MrcData - include all the MRC data
+ @param[in] Channel - Channel to send command to
+ @param[in] RankMask - Rank mask for which command will be sent to
+ @param[in] MR - MRS command to be sent
+ @param[in] DimmValue - Dimm Values to be sent
+
+ @retval MrcStatus
+**/
+extern
+MrcStatus
+MrcWriteMRSAll (
+ IN MrcParameters *const MrcData,
+ IN const U8 Channel,
+ IN const U8 RankMask,
+ IN const U8 MR,
+ IN const U16 *const DimmValue
+ );
+
+/**
+@brief
+ This function sends the proper MRS command for specific ranks as indicated by RankMask
+
+ @param[in] MrcData - Include all the MRC data
+ @param[in] Channel - Channel to send command to
+ @param[in] RankMask - Rank mask for which command will be sent to
+ @param[in] MR - MRS command to be sent
+ @param[in] Value - Value to be sent
+
+ @retval MrcStatus
+**/
+extern
+MrcStatus
+MrcWriteMRS (
+ IN MrcParameters *const MrcData,
+ IN const U8 Channel,
+ IN const U8 RankMask,
+ IN const U8 MR,
+ IN const U16 Value
+ );
+
+/**
+@brief
+ Issue ZQ calibration command on all ranks.
+ When done, wait appropriate delay depending on the ZQ type.
+
+ @param[in] MrcData - include all the MRC data
+ @param[in] chBitMask - Channel bit mask to be sent to.
+ @param[in] ZqType - Type of ZQ Calibration: see MrcZqType enum
+
+ @retval MrcStatus - mrcSuccess if passes, otherwise an error status
+**/
+extern
+MrcStatus
+MrcIssueZQ (
+ IN MrcParameters *const MrcData,
+ IN const U8 chBitMask,
+ IN const MrcZqType ZqType
+ );
+
+/**
+@brief
+ This function writes the MR2 register for all the ranks and channels
+
+ @param[in, out] MrcData - general data
+ @param[in] Pasr - Partial array self refresh bit A0-A2
+
+ @retval MrcStatus - mrcSuccess if passes, otherwise an error status
+**/
+extern
+MrcStatus
+MrcSetMR2 (
+ IN OUT MrcParameters *const MrcData,
+ IN const U8 Pasr
+ );
+
+/**
+@brief
+ This function writes the MR3 register for all the ranks and channels
+
+ @param[in] MrcData - include all the MRC data
+ @param[in] MPRLoc - MPR Location bit A0-A1
+ @param[in] Mpr - MPR bit A2
+
+ @retval MrcStatus - mrcSuccess if passes, otherwise an error status
+**/
+extern
+MrcStatus
+MrcSetMR3 (
+ IN MrcParameters *const MrcData,
+ IN const U8 MPRLoc,
+ IN const U8 Mpr
+ )
+;
+
+/**
+@brief
+ This function writes the MR1 register for all the ranks and channels
+
+ @param[in, out] MrcData - include all the MRC data
+ @param[in] DLLEnable - DLL enable bit A0
+ @param[in] Odic - Output driver impedance control A5, A1
+ @param[in] AdditiveLatency - Additive latency bit A3-A4
+ @param[in] WlEnable - Write leveling enable bit A7
+ @param[in] Tdqs - TDQS enable bit A11
+ @param[in] Qoff - Qoff bit A12
+
+ @retval MrcStatus - mrcSuccess if passes, otherwise an error status
+**/
+extern
+MrcStatus
+MrcSetMR1 (
+ IN OUT MrcParameters *const MrcData,
+ IN const U8 DLLEnable,
+ IN const U8 Odic,
+ IN const U8 AdditiveLatency,
+ IN const U8 WlEnable,
+ IN const U8 Tdqs,
+ IN const U8 Qoff
+ );
+
+/**
+@brief
+ This function writes the MR0 register for all the ranks
+
+ @param[in, out] MrcData - include all the MRC data
+ @param[in] CommandControl - include the command control params
+ @param[in] BurstLength - Burst length bit A0-A1
+ @param[in] ReadBurstType - Read burst type bit A3
+ @param[in] TestMode - Test mode type bit A7
+ @param[in] DllReset - DLL reset bit A8
+
+ @retval MrcStatus - mrcSuccess if passes, otherwise an error status
+**/
+extern
+MrcStatus
+MrcSetMR0 (
+ IN OUT MrcParameters *const MrcData,
+ IN const U8 Bl,
+ IN const U8 Rbt,
+ IN const U8 Tm,
+ IN const U8 Dll
+ );
+
+/**
+@brief
+ This function return tWLO time. this time is Write leveling output delay.
+
+ @param[in] Frequency - MC frequency.
+
+ @retval tWLO timein nCK.
+**/
+extern
+U32
+GetTwloTime (
+ IN const MrcFrequency Frequency
+ );
+
+/**
+@brief
+ This funtion returns the odt table index for the given Dimm/Channel.
+
+ @param[in] MrcData - Include all the mrc global data.
+ @param[in] Channel - Channel to work on.
+ @param[in] Dimm - Rank to work on.
+
+ @retval OdtValue - iThe pointer to the relevant Odt values.
+**/
+extern
+TOdtValue *
+GetOdtTableIndex (
+ IN MrcParameters *const MrcData,
+ IN const U8 Channel,
+ IN const U8 Dimm
+ );
+
+/**
+@brief
+ This funtion takes the MR1 register value and updates the odt value
+ inside the register.
+
+ @param[in] MrcData - Include all the MRC general data.
+ @param[in] OdtValue - Selected odt index.
+ @param[in] Ddr3ModeRegister - Register to update.
+
+ @retval Ddr3ModeRegister - Updated register
+**/
+extern
+DDR3_MODE_REGISTER_1_STRUCT
+UpdateRttNomValue (
+ IN MrcParameters *const MrcData,
+ IN const U8 OdtValue,
+ IN DDR3_MODE_REGISTER_1_STRUCT Register
+ );
+
+/**
+@brief
+ This function updates the Rtt value in the MR2 value passed in.
+
+ @param[in] MrcData - Include all the MRC general data.
+ @param[in] OdtValue - Selected odt index.
+ @param[in] Ddr3ModeRegister - Register to update.
+
+ @retval Ddr3ModeRegister - Updated MR2 register
+**/
+extern
+DDR3_MODE_REGISTER_2_STRUCT
+UpdateRttWrValue (
+ IN MrcParameters *const MrcData,
+ IN const U8 OdtValue,
+ IN DDR3_MODE_REGISTER_2_STRUCT Ddr3ModeRegister
+ );
+
+/**
+@brief
+ this funtion select the ODT table according OEM/USER decision.
+ In the MRC have 4 table type Mb,Dt,User1,User2.
+ User1,User2 use as internal usage.
+
+ @param[in] MrcData - Include all the MRC general data.
+ @param[in] Dimm - selected DIMM.
+ @param[in] OdtIndex - selected odt index.
+
+ @retval TOdtValue * - Pointer to the relevant table.
+ The return value is NULL if the table could
+ not be found
+**/
+extern
+TOdtValue *
+SelectTable (
+ IN MrcParameters *const MrcData,
+ IN const U8 Dimm,
+ IN const TOdtIndex OdtIndex
+ );
+
+#ifdef ULT_FLAG
+
+/**
+@brief
+ Issue LPDDR MRW (Mode Register Write) command using MRH (Mode Register Handler).
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Channel - the channel to work on
+ @param[in] Rank - the rank to work on
+ @param[in] Address - MRW address
+ @param[in] Data - MRW Data
+ @param[in] InitMrw - when TRUE, command is stretched (used before CA training is done)
+ @param[in] ChipSelect2N - when TRUE, use 2N stretch mode for CS (used before CA training is done)
+
+ @retval mrcSuccess - MRW was sent successfully
+ @retval mrcDeviceBusy - timed out waiting for MRH
+**/
+extern
+MrcStatus
+MrcIssueMrw (
+ IN MrcParameters *const MrcData,
+ IN U32 Channel,
+ IN U32 Rank,
+ IN U32 Address,
+ IN U32 Data,
+ IN BOOL InitMrw,
+ IN BOOL ChipSelect2N
+ );
+
+/**
+@brief
+ Issue LPDDR MRR (Mode Register Read) command using MRH (Mode Register Handler).
+ Use DQ mapping array to deswizzle the MR data.
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Channel - the channel to work on
+ @param[in] Rank - the rank to work on
+ @param[in] Address - MRR address
+ @param[out] Data - MRR Data array per SDRAM device
+
+ @retval mrcSuccess - MRR was executed successfully
+ @retval mrcDeviceBusy - timed out waiting for MRH
+**/
+extern
+MrcStatus
+MrcIssueMrr (
+ IN MrcParameters *const MrcData,
+ IN U32 Channel,
+ IN U32 Rank,
+ IN U32 Address,
+ OUT U8 Data[4]
+ );
+
+/**
+@brief
+ Issue LPDDR PRECHARGE ALL command using CADB.
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Channel - The channel to work on
+ @param[in] RankMask - The rank(s) to work on
+
+ @retval none
+**/
+void
+MrcIssuePrechargeAll (
+ IN MrcParameters *const MrcData,
+ IN const U8 Channel,
+ IN const U8 RankMask
+ );
+
+#endif // ULT_FLAG
+
+#pragma pack (pop)
+#endif // _MrcDdr3_h_
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcDdr3Registers.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcDdr3Registers.h
new file mode 100644
index 0000000..7041495
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcDdr3Registers.h
@@ -0,0 +1,249 @@
+/** @file
+ Include all the DDR3 register definitions.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+**/
+#ifndef _MrcDdr3Registers_h_
+#define _MrcDdr3Registers_h_
+
+#pragma pack(push, 1)
+
+typedef union {
+ struct {
+ U16 BurstLength : 2; ///< Bits 0:1
+ U16 CasLatencyLow : 1; ///< Bits 2:2
+ U16 ReadBurstType : 1; ///< Bits 3:3
+ U16 CasLatencyHigh : 3; ///< Bits 4:6
+ U16 TestMode : 1; ///< Bits 7:7
+ U16 DllReset : 1; ///< Bits 8:8
+ U16 WriteRecovery : 3; ///< Bits 9:11
+ U16 PrechargePdDll : 1; ///< Bits 12:12
+ U16 : 3; ///< Bits 13:15
+ } Bits;
+ U16 Data;
+ U8 Data8[2];
+} DDR3_MODE_REGISTER_0_STRUCT;
+
+typedef union {
+ struct {
+ U16 DllEnable : 1; ///< Bits 0:0
+ U16 ODImpedanceLow : 1; ///< Bits 1:1
+ U16 OdtRttValueLow : 1; ///< Bits 2:2
+ U16 AdditiveLatency : 2; ///< Bits 3:4
+ U16 ODImpedanceHigh : 1; ///< Bits 5:5
+ U16 OdtRttValueMid : 1; ///< Bits 6:6
+ U16 WriteLeveling : 1; ///< Bits 7:7
+ U16 : 1; ///< Bits 8:8
+ U16 OdtRttValueHigh : 1; ///< Bits 9:9
+ U16 : 1; ///< Bits 10:10
+ U16 Tdqs : 1; ///< Bits 11:11
+ U16 Qoff : 1; ///< Bits 12:12
+ U16 : 3; ///< Bits 13:15
+ } Bits;
+ U16 Data;
+ U8 Data8[2];
+} DDR3_MODE_REGISTER_1_STRUCT;
+
+typedef union {
+ struct {
+ U16 PartialArraySR : 3; ///< Bits 0:2
+ U16 CasWriteLatency : 3; ///< Bits 3:5
+ U16 AutoSelfRefresh : 1; ///< Bits 6:6
+ U16 SelfRefreshTemp : 1; ///< Bits 7:7
+ U16 : 1; ///< Bits 8:8
+ U16 DynamicOdt : 2; ///< Bits 9:10
+ U16 : 5; ///< Bits 11:15
+ } Bits;
+ U16 Data;
+ U8 Data8[2];
+} DDR3_MODE_REGISTER_2_STRUCT;
+
+typedef union {
+ struct {
+ U16 MprLocation : 2; ///< Bits 0:1
+ U16 MprOperation : 1; ///< Bits 2:2
+ U16 : 13; ///< Bits 3:15
+ } Bits;
+ U16 Data;
+ U8 Data8[2];
+} DDR3_MODE_REGISTER_3_STRUCT;
+
+///
+/// MR0 register
+///
+#define DDR3_MODE_REGISTER_0_BL_OFF (0)
+#define DDR3_MODE_REGISTER_0_BL_WID (2)
+#define DDR3_MODE_REGISTER_0_BL_MSK (3)
+#define DDR3_MODE_REGISTER_0_BL_MAX (3)
+#define DDR3_MODE_REGISTER_0_BL_DEF (0)
+
+#define DDR3_MODE_REGISTER_0_CL_A2_OFF (2)
+#define DDR3_MODE_REGISTER_0_CL_A2_WID (1)
+#define DDR3_MODE_REGISTER_0_CL_A2_MSK (1)
+#define DDR3_MODE_REGISTER_0_CL_A2_MAX (1)
+#define DDR3_MODE_REGISTER_0_CL_A2_DEF (0)
+
+#define DDR3_MODE_REGISTER_0_RBT_OFF (3)
+#define DDR3_MODE_REGISTER_0_RBT_WID (1)
+#define DDR3_MODE_REGISTER_0_RBT_MSK (1)
+#define DDR3_MODE_REGISTER_0_RBT_MAX (1)
+#define DDR3_MODE_REGISTER_0_RBT_DEF (0)
+
+#define DDR3_MODE_REGISTER_0_CL_OFF (4)
+#define DDR3_MODE_REGISTER_0_CL_WID (3)
+#define DDR3_MODE_REGISTER_0_CL_MSK (7)
+#define DDR3_MODE_REGISTER_0_CL_MAX (7)
+#define DDR3_MODE_REGISTER_0_CL_DEF (0)
+
+#define DDR3_MODE_REGISTER_0_TM_OFF (7)
+#define DDR3_MODE_REGISTER_0_TM_WID (1)
+#define DDR3_MODE_REGISTER_0_TM_MSK (1)
+#define DDR3_MODE_REGISTER_0_TM_MAX (1)
+#define DDR3_MODE_REGISTER_0_TM_DEF (0)
+
+#define DDR3_MODE_REGISTER_0_DLL_OFF (8)
+#define DDR3_MODE_REGISTER_0_DLL_WID (1)
+#define DDR3_MODE_REGISTER_0_DLL_MSK (1)
+#define DDR3_MODE_REGISTER_0_DLL_MAX (1)
+#define DDR3_MODE_REGISTER_0_DLL_DEF (0)
+
+#define DDR3_MODE_REGISTER_0_WR_OFF (9)
+#define DDR3_MODE_REGISTER_0_WR_WID (3)
+#define DDR3_MODE_REGISTER_0_WR_MSK (7)
+#define DDR3_MODE_REGISTER_0_WR_MAX (7)
+#define DDR3_MODE_REGISTER_0_WR_DEF (0)
+
+#define DDR3_MODE_REGISTER_0_PPD_OFF (12)
+#define DDR3_MODE_REGISTER_0_PPD_WID (1)
+#define DDR3_MODE_REGISTER_0_PPD_MSK (1)
+#define DDR3_MODE_REGISTER_0_PPD_MAX (1)
+#define DDR3_MODE_REGISTER_0_PPD_DEF (0)
+
+///
+/// MR1 register
+///
+#define DDR3_MODE_REGISTER_1_DLL_OFF (0)
+#define DDR3_MODE_REGISTER_1_DLL_WID (1)
+#define DDR3_MODE_REGISTER_1_DLL_MSK (1)
+#define DDR3_MODE_REGISTER_1_DLL_MAX (1)
+#define DDR3_MODE_REGISTER_1_DLL_DEF (0)
+
+#define DDR3_MODE_REGISTER_1_D_I_C_A1_OFF (1)
+#define DDR3_MODE_REGISTER_1_D_I_C_A1_WID (1)
+#define DDR3_MODE_REGISTER_1_D_I_C_A1_MSK (1)
+#define DDR3_MODE_REGISTER_1_D_I_C_A1_MAX (1)
+#define DDR3_MODE_REGISTER_1_D_I_C_A1_DEF (0)
+
+#define DDR3_MODE_REGISTER_1_Rtt_Nom_A2_OFF (2)
+#define DDR3_MODE_REGISTER_1_Rtt_Nom_A2_WID (1)
+#define DDR3_MODE_REGISTER_1_Rtt_Nom_A2_MSK (1)
+#define DDR3_MODE_REGISTER_1_Rtt_Nom_A2_MAX (1)
+#define DDR3_MODE_REGISTER_1_Rtt_Nom_A2_DEF (0)
+
+#define DDR3_MODE_REGISTER_1_AL_OFF (3)
+#define DDR3_MODE_REGISTER_1_AL_WID (2)
+#define DDR3_MODE_REGISTER_1_AL_MSK (3)
+#define DDR3_MODE_REGISTER_1_AL_MAX (3)
+#define DDR3_MODE_REGISTER_1_AL_DEF (0)
+
+#define DDR3_MODE_REGISTER_1_D_I_C_A5_OFF (5)
+#define DDR3_MODE_REGISTER_1_D_I_C_A5_WID (1)
+#define DDR3_MODE_REGISTER_1_D_I_C_A5_MSK (1)
+#define DDR3_MODE_REGISTER_1_D_I_C_A5_MAX (1)
+#define DDR3_MODE_REGISTER_1_D_I_C_A5_DEF (0)
+
+#define DDR3_MODE_REGISTER_1_Rtt_Nom_A6_OFF (6)
+#define DDR3_MODE_REGISTER_1_Rtt_Nom_A6_WID (1)
+#define DDR3_MODE_REGISTER_1_Rtt_Nom_A6_MSK (1)
+#define DDR3_MODE_REGISTER_1_Rtt_Nom_A6_MAX (1)
+#define DDR3_MODE_REGISTER_1_Rtt_Nom_A6_DEF (0)
+
+#define DDR3_MODE_REGISTER_1_LEVEL_OFF (7)
+#define DDR3_MODE_REGISTER_1_LEVEL_WID (1)
+#define DDR3_MODE_REGISTER_1_LEVEL_MSK (1)
+#define DDR3_MODE_REGISTER_1_LEVEL_MAX (1)
+#define DDR3_MODE_REGISTER_1_LEVEL_DEF (0)
+
+#define DDR3_MODE_REGISTER_1_Rtt_Nom_A9_OFF (9)
+#define DDR3_MODE_REGISTER_1_Rtt_Nom_A9_WID (1)
+#define DDR3_MODE_REGISTER_1_Rtt_Nom_A9_MSK (1)
+#define DDR3_MODE_REGISTER_1_Rtt_Nom_A9_MAX (1)
+#define DDR3_MODE_REGISTER_1_Rtt_Nom_A9_DEF (0)
+
+#define DDR3_MODE_REGISTER_1_TDQS_OFF (11)
+#define DDR3_MODE_REGISTER_1_TDQS_WID (1)
+#define DDR3_MODE_REGISTER_1_TDQS_MSK (1)
+#define DDR3_MODE_REGISTER_1_TDQS_MAX (1)
+#define DDR3_MODE_REGISTER_1_TDQS_DEF (0)
+
+#define DDR3_MODE_REGISTER_1_Qoff_OFF (12)
+#define DDR3_MODE_REGISTER_1_Qoff_WID (1)
+#define DDR3_MODE_REGISTER_1_Qoff_MSK (1)
+#define DDR3_MODE_REGISTER_1_Qoff_MAX (1)
+#define DDR3_MODE_REGISTER_1_Qoff_DEF (0)
+
+///
+/// MR2 register
+///
+#define DDR3_MODE_REGISTER_2_PASR_OFF (0)
+#define DDR3_MODE_REGISTER_2_PASR_WID (3)
+#define DDR3_MODE_REGISTER_2_PASR_MSK (7)
+#define DDR3_MODE_REGISTER_2_PASR_MAX (7)
+#define DDR3_MODE_REGISTER_2_PASR_DEF (0)
+
+#define DDR3_MODE_REGISTER_2_CWL_OFF (3)
+#define DDR3_MODE_REGISTER_2_CWL_WID (3)
+#define DDR3_MODE_REGISTER_2_CWL_MSK (7)
+#define DDR3_MODE_REGISTER_2_CWL_MAX (7)
+#define DDR3_MODE_REGISTER_2_CWL_DEF (0)
+
+#define DDR3_MODE_REGISTER_2_ASR_OFF (6)
+#define DDR3_MODE_REGISTER_2_ASR_WID (1)
+#define DDR3_MODE_REGISTER_2_ASR_MSK (1)
+#define DDR3_MODE_REGISTER_2_ASR_MAX (1)
+#define DDR3_MODE_REGISTER_2_ASR_DEF (0)
+
+#define DDR3_MODE_REGISTER_2_STR_OFF (7)
+#define DDR3_MODE_REGISTER_2_STR_WID (1)
+#define DDR3_MODE_REGISTER_2_STR_MSK (1)
+#define DDR3_MODE_REGISTER_2_STR_MAX (1)
+#define DDR3_MODE_REGISTER_2_STR_DEF (0)
+
+#define DDR3_MODE_REGISTER_2_Rtt_WR_OFF (9)
+#define DDR3_MODE_REGISTER_2_Rtt_WR_WID (2)
+#define DDR3_MODE_REGISTER_2_Rtt_WR_MSK (3)
+#define DDR3_MODE_REGISTER_2_Rtt_WR_MAX (3)
+#define DDR3_MODE_REGISTER_2_Rtt_WR_DEF (0)
+
+///
+/// MR3 register
+///
+#define DDR3_MODE_REGISTER_3_MPR_LOC_OFF (0)
+#define DDR3_MODE_REGISTER_3_MPR_LOC_WID (2)
+#define DDR3_MODE_REGISTER_3_MPR_LOC_MSK (3)
+#define DDR3_MODE_REGISTER_3_MPR_LOC_MAX (3)
+#define DDR3_MODE_REGISTER_3_MPR_LOC_DEF (0)
+
+#define DDR3_MODE_REGISTER_3_MPR_OFF (2)
+#define DDR3_MODE_REGISTER_3_MPR_WID (1)
+#define DDR3_MODE_REGISTER_3_MPR_MSK (1)
+#define DDR3_MODE_REGISTER_3_MPR_MAX (1)
+#define DDR3_MODE_REGISTER_3_MPR_DEF (0)
+
+#pragma pack (pop)
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcGlobal.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcGlobal.h
new file mode 100644
index 0000000..0264c6a
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcGlobal.h
@@ -0,0 +1,993 @@
+/** @file
+ This file includes all the data structures that the MRC considers "global data".
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _MrcGlobal_h_
+#define _MrcGlobal_h_
+#pragma pack (push, 1)
+
+#include "MrcTypes.h"
+#include "MrcApi.h"
+#include "MrcOemDebugPrint.h"
+#include "MrcRmtData.h"
+#include "MrcSpdData.h"
+#include "McAddress.h"
+
+///
+///***************************************************
+/// Structures common to all "global data" elements.
+///***************************************************
+///
+typedef U8 MrcIteration;
+#define MRC_ITERATION_MAX ((1 << ((sizeof (MrcIteration) * 8) - 1)) + ((1 << ((sizeof (MrcIteration) * 8) - 1)) - 1))
+
+#define MRC_NUMBER_UPM_PWR_RETRAIN_MARGINS (9)
+
+typedef struct {
+ ///
+ ///< Thermal Options
+ ///
+ U8 EnableExtts;
+ U8 EnableCltm;
+ U8 EnableOltm;
+ U8 EnablePwrDn;
+#ifdef ULT_FLAG
+ U8 EnablePwrDnLpddr;
+#endif // ULT_FLAG
+ U8 Refresh2X;
+ U8 LpddrThermalSensor;
+ U8 LockPTMregs;
+ U8 UserPowerWeightsEn;
+
+ U8 EnergyScaleFact;
+ U8 RaplPwrFl[MAX_CHANNEL];
+
+ U8 RaplLim2Lock;
+ U8 RaplLim2WindX;
+ U8 RaplLim2WindY;
+ U8 RaplLim2Ena;
+ U16 RaplLim2Pwr;
+ U8 RaplLim1WindX;
+ U8 RaplLim1WindY;
+ U8 RaplLim1Ena;
+ U16 RaplLim1Pwr;
+
+ U8 WarmThreshold[MAX_CHANNEL][MAX_DIMMS_IN_CHANNEL];
+ U8 HotThreshold[MAX_CHANNEL][MAX_DIMMS_IN_CHANNEL];
+ U8 WarmBudget[MAX_CHANNEL][MAX_DIMMS_IN_CHANNEL];
+ U8 HotBudget[MAX_CHANNEL][MAX_DIMMS_IN_CHANNEL];
+
+ U8 IdleEnergy[MAX_CHANNEL][MAX_DIMMS_IN_CHANNEL];
+ U8 PdEnergy[MAX_CHANNEL][MAX_DIMMS_IN_CHANNEL];
+ U8 ActEnergy[MAX_CHANNEL][MAX_DIMMS_IN_CHANNEL];
+ U8 RdEnergy[MAX_CHANNEL][MAX_DIMMS_IN_CHANNEL];
+ U8 WrEnergy[MAX_CHANNEL][MAX_DIMMS_IN_CHANNEL];
+ U8 SrefCfgEna;
+ U16 SrefCfgIdleTmr;
+ U8 ThrtCkeMinDefeat;
+ U8 ThrtCkeMinTmr;
+#ifdef ULT_FLAG
+ U8 ThrtCkeMinDefeatLpddr;
+ U8 ThrtCkeMinTmrLpddr;
+#endif // ULT_FLAG
+#ifdef UPSERVER_SUPPORT
+ // CLTM and TSOD settings
+ U8 Altitude;
+ U8 UserThresholdEn;
+ U8 UserBudgetEn;
+ U8 TSOD_TcritMax;
+ U8 TSOD_EventMode;
+ U8 TSOD_EventPolarity;
+ U8 TSOD_CriticalEventOnly;
+ U8 TSOD_EventOutputControl;
+ U8 TSOD_AlarmwindowLockBit;
+ U8 TSOD_CriticaltripLockBit;
+ U8 TSOD_ShutdownMode;
+ U8 TSOD_ThigMax;
+ U8 TSOD_ManEn;
+
+#endif
+} ThermalMngmtEn;
+
+
+typedef struct {
+ MrcBool GdxcEnable; ///< GDXC MOT enable
+ U8 GdxcIotSize; ///< IOT size in multiples of 8MEG
+ U8 GdxcMotSize; ///< MOT size in multiples of 8MEG
+} MrcGdxc;
+
+typedef struct {
+ U32 ECT : 1; ///< BIT0 - Early Command Training
+ U32 SOT : 1; ///< BIT1 - Sense Amp Offset Training
+ U32 RDMPRT : 1; ///< BIT2 - Read MPR Training
+ U32 RCVET : 1; ///< BIT3 - Read Leveling Training (RcvEn)
+ U32 JWRL : 1; ///< BIT4 - Jedec Write Leveling
+ U32 FWRL : 1; ///< BIT5 - Functional Write Leveling
+ U32 WRTC1D : 1; ///< BIT6 - Write Timing Centerin 1D
+ U32 RDTC1D : 1; ///< BIT7 - Read Timing Centering 1D
+ U32 DIMMODTT : 1; ///< BIT8 - Dimm ODT Training
+ U32 WRDST : 1; ///< BIT9 - Write Drive Strength Training
+ U32 WREQT : 1; ///< BIT10 - Write Equalization Training
+ U32 RCVENC1D: 1; ///< BIT11 - Receive Enable Centering 1D
+ U32 RDODTT : 1; ///< BIT12 - Read ODT Training
+ U32 RDEQT : 1; ///< BIT13 - Read Equalization Training
+ U32 RDAPT : 1; ///< BIT14 - Read Amplifier Power Training
+ U32 WRTC2D : 1; ///< BIT15 - Write Timing Centerin 2D
+ U32 RDTC2D : 1; ///< BIT16 - Read Timing Centering 2D
+ U32 CMDVC : 1; ///< BIT17 - Command Voltage Centering
+ U32 WRVC2D : 1; ///< BIT18 - Write Voltage Centering 2D
+ U32 RDVC2D : 1; ///< BIT19 - Read Voltage Centering 2D
+ U32 RMC : 1; ///< BIT20 - Retrain Margin Check
+ U32 : 1; ///< BIT21 -
+ U32 LCT : 1; ///< BIT22 - Late Command Training
+ U32 RTL : 1; ///< BIT23 - Round Trip latency
+ U32 TAT : 1; ///< BIT24 - Turn Around Timing
+ U32 RMT : 1; ///< BIT25 - RMT Tool
+ U32 MEMTST : 1; ///< BIT26 - Memory Test
+ U32 DIMMODTT1D : 1; ///< BIT27 - DIMMODTT1d
+ U32 WRSRT : 1; ///< BIT28 - Write Slew Rate Training
+ U32 DIMMRONT : 1; ///< BIT29 - Dimm Ron Training
+ U32 ALIASCHK: 1; ///< BIT30 - SPD Alias Check
+} TrainingStepsEn;
+
+typedef enum {
+ MrcModeFull,
+ MrcModeMini
+} MrcMode;
+
+typedef enum {
+ LastRxV,
+ LastRxT,
+ LastTxV,
+ LastTxT,
+ LastRcvEna,
+ LastWrLevel,
+ LastCmdT,
+ LastCmdV,
+ MAX_RESULT_TYPE
+} MrcMarginResult;
+
+///
+/// Define the MRC recommended boot modes.
+///
+typedef enum {
+ bmCold, ///< Cold boot
+ bmWarm, ///< Warm boot
+ bmS3, ///< S3 resume
+ bmFast, ///< Fast boot
+} MrcBootMode;
+
+///
+/// DIMM SPD Security Status
+///
+typedef enum {
+ MrcSpdStatusGood, ///< Memory is in a secure state.
+ MrcSpdStatusAliased, ///< Memory is aliased.
+
+ MrcSpdStatusLast ///< Must be last in the list
+} MrcSpdStatus;
+
+///
+/// Define the virtual channel.
+///
+typedef enum {
+ vcA, ///< Virtual channel A
+ vcB, ///< Virtual channel B
+} MrcVirtualChannel;
+
+///
+/// Define the board types.
+///
+typedef enum {
+ btCRBMB, ///< 0 - CRB Mobile
+ btCRBDT, ///< 1 - CRB Desktop
+ btUser1, ///< 2 - SV mobile
+ btUser2, ///< 3 - SV desktop
+ btUser3, ///< 4 - SV server?
+ btUser4, ///< 5 - Ult
+ btCRBEMB, ///< 6 - CRB Embedded
+ btUnknown, ///< 7 - Unknown
+} MrcBoardType;
+
+///
+/// Define the CPU family/model.
+///
+typedef enum {
+ cmHSW = 0x306C0, ///< Haswell
+ cmHSW_ULT = 0x40650, ///< Haswell-ULT
+ cmCRW = 0x40660, ///< Crystalwell
+ cmBDW = 0x306D0 ///< Broadwell
+} MrcCpuModel;
+
+///
+/// Define the CPU stepping number.
+///
+typedef enum {
+ ///
+ /// Haswell
+ ///
+ csHswA0 = 1,
+ csHswB0 = 2,
+ csHswC0 = 3,
+ csHswLast = csHswC0,
+
+ ///
+ /// Crystalwell
+ ///
+ csCrwB0 = 0,
+ csCrwC0 = 1,
+ csCrwLast = csCrwC0,
+
+ ///
+ /// Haswell-ULT
+ ///
+ csHswUltB0 = 0,
+ csHswUltC0 = 1,
+ csHswUltLast = csHswUltC0,
+
+ ///
+ /// Broadwell
+ ///
+ csBdwA0 = 0,
+ csBdwLast = csBdwA0
+} MrcCpuStepping;
+
+typedef enum {
+ CONTROLLER_NOT_PRESENT, ///< There is no controller present in the system.
+ CONTROLLER_DISABLED, ///< There is a controller present but it is disabled.
+ CONTROLLER_PRESENT ///< There is a controller present and it is enabled.
+} MrcControllerSts;
+
+typedef enum {
+ CHANNEL_NOT_PRESENT, ///< There is no channel present on the controller.
+ CHANNEL_DISABLED, ///< There is a channel present but it is disabled.
+ CHANNEL_PRESENT ///< There is a channel present and it is enabled.
+} MrcChannelSts;
+
+typedef enum {
+ DIMM_ENABLED, ///< DIMM/rank Pair is enabled, presence TBD
+ DIMM_DISABLED, ///< DIMM/rank Pair is disabled, regardless of presence.
+ DIMM_PRESENT, ///< There is a DIMM present in the slot/rank pair and it will be used.
+ DIMM_NOT_PRESENT ///< There is no DIMM present in the slot/rank pair.
+} MrcDimmSts;
+
+typedef enum {
+ STD_PROFILE, ///< Standard DIMM profile select.
+ USER_PROFILE, ///< User specifies various override values.
+ XMP_PROFILE1, ///< XMP enthusiast settings select (XMP profile #1).
+ XMP_PROFILE2, ///< XMP extreme settings select (XMP profile #2).
+ MAX_PROFILE ///< Delimiter
+} MrcProfile;
+
+typedef enum {
+ MRC_REF_CLOCK_133,
+ MRC_REF_CLOCK_100,
+ MRC_REF_CLOCK_MAXIMUM ///< Delimiter
+} MrcRefClkSelect; ///< This value times the MrcClockRatio determines the MrcFrequency.
+
+typedef U32 MrcBClkRef;
+
+typedef enum {
+ MRC_DDR_TYPE_UNKNOWN,
+ MRC_DDR_TYPE_DDR3,
+ MRC_DDR_TYPE_LPDDR3
+} MrcDdrType;
+
+typedef enum {
+ MRC_MODULE_TYPE_UNKNOWN,
+ MRC_MODULE_TYPE_RDIMM,
+ MRC_MODULE_TYPE_UDIMM,
+ MRC_MODULE_TYPE_SODIMM,
+ MRC_MODULE_MICRO_DIMM,
+ MRC_MODULE_MINI_RDIMM,
+ MRC_MODULE_MINI_UDIMM,
+ MRC_MODULE_MINI_CDIMM,
+ MRC_MODULE_72B_SO_UDIMM,
+ MRC_MODULE_72B_SO_RDIMM,
+ MRC_MODULE_72B_SO_CDIMM,
+ MRC_MODULE_LRDIMM,
+ MRC_MODULE_16B_SO_DIMM,
+ MRC_MODULE_32B_SO_DIMM
+} MrcModuleType;
+
+typedef enum {
+ MrcIterationClock = 0,
+ MrcIterationCmdN = 1,
+ MrcIterationCmdS = 2,
+ MrcIterationCke = 3,
+ MrcIterationCtl = 4,
+ MrcIterationCmdV = 5,
+ MrcIterationMax
+} MrcIterationType;
+
+typedef enum {
+ UpmLimit,
+ PowerLimit,
+ RetrainLimit,
+ MarginLimitMax
+} MRC_MARGIN_LIMIT_TYPE;
+
+typedef U8 MrcClockRatio; ///< This value times the MrcRefClkSelect determines the MrcFrequency.
+typedef U32 MrcGfxDataSize; ///< The size of the stolen graphics data memory, in MBytes.
+typedef U32 MrcGfxGttSize; ///< The size of the graphics translation table, in MBytes.
+
+///
+/// UPM PWR and Retrain Limits
+///
+typedef struct {
+ U8 Param;
+ U16 ParamLimit[MarginLimitMax];
+} MrcUpmPwrRetrainLimits;
+
+typedef union {
+ MrcUpmPwrRetrainLimits *Pointer;
+ U64 Data;
+} MrcUPRLimitPtr;
+
+typedef union {
+ U64 Data;
+ U32 Data32[2];
+} MrcCapId; ///< The memory controller capabilities.
+
+///
+/// MRC version description.
+///
+typedef struct {
+ U8 Major; ///< Major version number
+ U8 Minor; ///< Minor version number
+ U8 Rev; ///< Revision number
+ U8 Build; ///< Build number
+} MrcVersion;
+
+///
+/// Memory map configuration information.
+///
+typedef struct {
+ U32 TomMinusMe;
+ U32 ToludBase;
+ U32 BdsmBase;
+ U32 GttBase;
+ U32 GraphicsControlRegister;
+ U32 TsegBase;
+ MrcBool ReclaimEnable;
+ U32 RemapBase;
+ U32 RemapLimit;
+ U32 TouudBase;
+ U32 TotalPhysicalMemorySize;
+ U32 MeStolenBase;
+ U32 MeStolenSize;
+ U32 GdxcMotBase;
+ U32 GdxcMotSize;
+ U32 GdxcIotBase;
+ U32 GdxcIotSize;
+ U32 DprSize;
+ U32 FtpmStolenBase;
+} MrcMemoryMap;
+
+///
+/// Real time clock information.
+///
+typedef struct {
+ U8 Seconds;
+ U8 Minutes;
+ U8 Hours;
+ U8 DayOfMonth;
+ U8 Month;
+ U16 Year;
+} MrcBaseTime;
+
+///
+/// DIMM timings
+///
+typedef struct {
+ U32 tCK; ///< Memory cycle time, in femtoseconds.
+ U16 NMode; ///< Number of tCK cycles for the channel DIMM's command rate mode.
+ U16 tCL; ///< Number of tCK cycles for the channel DIMM's CAS latency.
+ U16 tCWL; ///< Number of tCK cycles for the channel DIMM's minimum CAS write latency time.
+ U16 tFAW; ///< Number of tCK cycles for the channel DIMM's minimum four activate window delay time.
+ U16 tRAS; ///< Number of tCK cycles for the channel DIMM's minimum active to precharge delay time.
+ U16 tRC; ///< Number of tCK cycles for the channel DIMM's minimum active to active/refresh delay time.
+ U16 tRCD; ///< Number of tCK cycles for the channel DIMM's minimum RAS# to CAS# delay time.
+ U16 tREFI; ///< Number of tCK cycles for the channel DIMM's minimum Average Periodic Refresh Interval.
+ U16 tRFC; ///< Number of tCK cycles for the channel DIMM's minimum refresh recovery delay time.
+ U16 tRFC2; ///< Number of tCK cycles for the channel DIMM's minimum refresh recovery delay time.
+ U16 tRFC4; ///< Number of tCK cycles for the channel DIMM's minimum refresh recovery delay time.
+ U16 tRP; ///< Number of tCK cycles for the channel DIMM's minimum row precharge delay time.
+ U16 tRPab; ///< Number of tCK cycles for the channel DIMM's minimum row precharge delay time for all banks.
+ U16 tRRD; ///< Number of tCK cycles for the channel DIMM's minimum row active to row active delay time.
+ U16 tRRD_L; ///< Number of tCK cycles for the channel DIMM's minimum row active to row active delay time for same bank groups.
+ U16 tRRD_S; ///< Number of tCK cycles for the channel DIMM's minimum row active to row active delay time for different bank groups.
+ U16 tRTP; ///< Number of tCK cycles for the channel DIMM's minimum internal read to precharge command delay time.
+ U16 tWR; ///< Number of tCK cycles for the channel DIMM's minimum write recovery time.
+ U16 tWTR; ///< Number of tCK cycles for the channel DIMM's minimum internal write to read command delay time.
+} MrcTiming;
+
+typedef struct {
+ S32 Mtb; ///< Medium time base.
+ S32 Ftb; ///< Fine time base.
+} MrcTimeBase;
+
+typedef struct {
+ U8 Left; ///< The left side of the timing eye.
+ U8 Center; ///< The center of the timing eye.
+ U8 Right; ///< The right side of the timing eye.
+} MrcDqTimeMargin;
+
+typedef struct {
+ U8 High; ///< The high side of the Vref eye.
+ U8 Center; ///< The center of the Vref eye.
+ U8 Low; ///< The low side of the Vref eye.
+} MrcDqVrefMargin;
+
+typedef struct {
+ U8 Left; ///< The left side of the command eye.
+ U8 Right; ///< The right side of the command eye.
+ U8 High; ///< The high side of the command eye.
+ U8 Low; ///< The low side of the command eye.
+} MrcCommandMargin;
+
+typedef struct {
+ U8 Left; ///< The left side of the receive enable eye.
+ U8 Right; ///< The right side of the receive enableeye.
+} MrcRecvEnMargin;
+
+typedef struct {
+ U8 Left; ///< The left side of the write leveling eye.
+ U8 Right; ///< The right side of the write leveling eye.
+} MrcWrLevelMargin;
+
+#ifdef SSA_FLAG
+typedef struct {
+ U8 *BufBase;
+ U32 BufLimit;
+ union {
+ struct {
+ U8 Occupied : 1;
+ U8 HeapEnd : 1;
+ } Bits;
+ U8 Data;
+ } BufFlags;
+} HeapBufHeader;
+#endif // SSA_FLAG
+
+#if ((defined SSA_FLAG) || (defined MRC_DEBUG_PRINT))
+typedef union {
+ struct {
+ U8 Init : 1; ///< 1 is SSA heap initialized.
+ U8 : 7;
+ } Bits;
+ U8 Data;
+ } SsaHeapFlagType;
+#endif
+
+///
+///*****************************************
+/// Output related "global data" structures.
+///*****************************************
+///
+/// This data structure contains all the "global data" values that are considered output by the MRC.
+/// The following are SDRAM level definitions. All ranks on a rank are set to these values.
+///
+/* Commented out until needed, in order to save space.
+typedef struct {
+} MrcSdramOut;
+*/
+
+///
+/// This data structure contains all the "global data" values that are considered output by the MRC.
+/// The following are rank level definitions. All ranks on a DIMM are set to these values.
+///
+typedef struct {
+//MrcSdramOut Sdram[MAX_SDRAM_IN_DIMM];
+ U16 MR[MAX_MR_IN_DIMM]; ///< DRAM mode register value.
+#ifdef ULT_FLAG
+ U16 MR11; ///< LPDDR3 ODT MR
+#endif
+} MrcRankOut;
+
+///
+/// This data structure contains all the "global data" values that are considered output by the MRC.
+/// The following are DIMM level definitions. All ranks on a DIMM are set to these values.
+///
+typedef struct {
+ MrcDimmSts Status; ///< See MrcDimmSts for the definition of this field.
+ MrcTiming Timing[MAX_PROFILE]; ///< The DIMMs timing values.
+ MrcVddSelect VddVoltage[MAX_PROFILE];///< The voltage (VDD) setting for this DIMM, per profile.
+ MrcBool EccSupport; ///< TRUE if ECC is enabled and supported on this DIMM.
+ MrcBool IgnoreNonEccDimm; ///< TRUE if a DIMM without ECC capability should be ignored.
+ MrcBool AddressMirrored; ///< TRUE if the DIMM is address mirrored.
+ MrcBool SelfRefreshTemp; ///< TRUE if the DIMM supports self refresh extended operating temperature range (SRT).
+ MrcBool AutoSelfRefresh; ///< TRUE if the DIMM supports automatic self refresh (ASR).
+ MrcBool PartialSelfRefresh; ///< TRUE if the DIMM supports Partial Array Self Refresh (PASR).
+ MrcBool OnDieThermalSensor; ///< TRUE if the DIMM supports On-die Thermal Sensor (ODTS) Readout.
+ MrcBool ExtendedTemperRange; ///< TRUE if the DIMM supports Extended Temperature Range (ETR).
+ MrcBool ExtendedTemperRefresh; ///< TRUE if the DIMM supports 1x Extended Temperature Refresh rate, FALSE = 2x.
+ MrcDdrType DdrType; ///< DDR type: DDR3 or LPDDR3
+ MrcModuleType ModuleType; ///< Module type: UDIMM, SO-DIMM, etc.
+ U32 SdramCount; ///< The number of SDRAM components on a DIMM.
+ U32 DimmCapacity; ///< DIMM size in MBytes.
+ U32 RowSize; ///< The DIMMs row address size.
+ U16 ColumnSize; ///< The DIMMs column address size.
+ U16 Crc; ///< Calculated CRC16 of the DIMM's provided SPD. Can be used to detect DIMM change.
+ U8 RankInDIMM; ///< The number of ranks in this DIMM.
+ U8 Banks; ///< Number of banks the DIMM contains.
+ U8 BankGroups; ///< Number of bank groups the DIMM contains.
+ U8 PrimaryBusWidth; ///< DIMM primary bus width.
+ U8 SdramWidth; ///< DIMM SDRAM width.
+ U8 SdramWidthIndex; ///< DIMM SDRAM width index (0 = x4, 1 = x8, 2 = x16, 3 = x32).
+ U8 DensityIndex; ///< Total SDRAM capacity index (0 = 256Mb, 1 = 512Mb, 2 = 1Gb, etc).
+ U8 ReferenceRawCard; ///< Indicates which JEDEC reference design raw card was used as the basis for the module assembly.
+ U8 XmpSupport; ///< Indicates if XMP profiles are supported. 0 = None, 1 = XMP1 only, 2 = XMP2 only, 3 = All.
+ U8 XmpRevision; ///< Indicates the XMP revision of this DIMM. 0 = None, 12h = 1.2, 13h = 1.3.
+ MrcRankOut Rank[MAX_RANK_IN_DIMM];
+} MrcDimmOut;
+
+///
+/// This data structure contains all the "global data" values that are considered output by the MRC.
+/// The following are channel level definitions. All DIMMs on a memory channel are set to these values.
+///
+typedef struct {
+ MrcChannelSts Status; ///< Indicates whether this channel should be used.
+ MrcVirtualChannel VirtualChannel; ///< define the virtual channel type A or B.
+ MrcTiming Timing[MAX_PROFILE]; ///< The channel timing values.
+ MrcTimeBase TimeBase[MAX_DIMMS_IN_CHANNEL][MAX_PROFILE];
+ MrcBool EccSupport; ///< TRUE if ECC is enabled and supported on this channel.
+ U32 Capacity; ///< Amount of memory in this channel, in MBytes.
+ U32 DimmCount; ///< Number of valid DIMMs that exist in the channel.
+ U32 DataOffsetTrain[MAX_SDRAM_IN_DIMM];///< DataOffsetTrain CR
+ U32 DataCompOffset[MAX_SDRAM_IN_DIMM]; ///< DataCompOffset CR
+ DDRDATA0CH0_CR_DDRCRDATACONTROL0_STRUCT DqControl0; ///< DqControl0 CR
+ DDRDATA0CH0_CR_DDRCRDATACONTROL1_STRUCT DqControl1[MAX_SDRAM_IN_DIMM]; ///< DqControl1 CR
+ DDRDATA0CH0_CR_DDRCRDATACONTROL2_STRUCT DqControl2[MAX_SDRAM_IN_DIMM]; ///< DqControl2 CR
+ U32 CkeCmdPiCode[2]; ///< CKE CmdPiCode CR, per group
+ U32 CmdsCmdPiCode[2]; ///< CmdS CmdPiCode CR, per group
+ U32 CmdnCmdPiCode[2]; ///< CmdN CmdPiCode CR, per group
+ U32 MchbarBANK; ///< tRCD tRP tRAS tRDPRE (tRTP) tWRPRE and tRRD values.
+ U32 MchbarBANKRANKA; ///< Mchbar TC Read to Read Turnaround CR
+ U32 MchbarBANKRANKB; ///< Mchbar TC Write to x Turnaround CR
+ U32 MchbarBANKRANKC; ///< Mchbar TC Read to Write Turnaround CR
+ U32 MchbarBANKRANKD; ///< Mchbar TC Write /Read Duration
+ U32 TxXtalk[MAX_SDRAM_IN_DIMM]; ///< TxXtalk Setting
+ U16 TxDqs[MAX_RANK_IN_CHANNEL][MAX_SDRAM_IN_DIMM]; ///< TxDQS PI Code
+ U16 TxDq[MAX_RANK_IN_CHANNEL][MAX_SDRAM_IN_DIMM]; ///< TxDQ Pi Code
+ U16 RcvEn[MAX_RANK_IN_CHANNEL][MAX_SDRAM_IN_DIMM]; ///< RcvEn PI Code
+ U16 WlDelay[MAX_RANK_IN_CHANNEL][MAX_SDRAM_IN_DIMM];
+ U8 ClkPiCode[MAX_RANK_IN_CHANNEL]; ///< CLK ClkPiCode
+ U8 CtlPiCode[MAX_RANK_IN_CHANNEL]; ///< CTL CtlPiCode
+ U8 CkePiCode[MAX_RANK_IN_CHANNEL]; ///< CKE CtlPiCode
+ U8 TxEq[MAX_RANK_IN_CHANNEL][MAX_SDRAM_IN_DIMM]; ///< TxEq Setting
+ MrcCommandMargin Command[MAX_RANK_IN_CHANNEL];
+ MrcDqTimeMargin RxDqPb[MAX_RANK_IN_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_BITS]; ///< Rx PerBit Pi Code
+ MrcDqTimeMargin TxDqPb[MAX_RANK_IN_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_BITS]; ///< Tx PerBit Pi Code
+ MrcDqVrefMargin RxDqVrefPb[MAX_RANK_IN_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_BITS]; ///< Rx PerBit Vref
+ MrcDqVrefMargin TxDqVrefPb[MAX_RANK_IN_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_BITS]; ///< Rx PerBit Vref
+ MrcRecvEnMargin ReceiveEnable[MAX_RANK_IN_CHANNEL]; ///< Receive enable per rank
+ MrcWrLevelMargin WriteLevel[MAX_RANK_IN_CHANNEL]; ///< Write leveling per rank
+ U8 IoLatency[MAX_RANK_IN_CHANNEL]; ///< IOLatency
+ U8 RTLatency[MAX_RANK_IN_CHANNEL]; ///< RoundTripLatency
+ U32 RTIoComp; ///< RoundTrip IO Compensation of the Channel
+ U8 RxVref[MAX_SDRAM_IN_DIMM]; ///< RX Vref in steps of 7.9 mv
+ U8 RxEq[MAX_RANK_IN_CHANNEL][MAX_SDRAM_IN_DIMM]; ///< RxEQ Setting
+ U8 RxDqsP[MAX_RANK_IN_CHANNEL][MAX_SDRAM_IN_DIMM];/// RxDQSP PI Code
+ U8 RxDqsN[MAX_RANK_IN_CHANNEL][MAX_SDRAM_IN_DIMM];/// RxDQSN PI Code
+ U8 RankInChannel; ///< Number of valid ranks that exist in the channel.
+ U8 ValidRankBitMask; ///< Bit map of the populated ranks per channel
+ U8 ValidCkeBitMask; ///< Bit map of the used CKE pins per channel
+ MrcDimmOut Dimm[MAX_DIMMS_IN_CHANNEL];
+} MrcChannelOut;
+
+///
+/// This data structure contains all the "global data" values that are considered output by the MRC.
+/// The following are memory controller level definitions. All channels on a controller are set to these values.
+///
+typedef struct {
+ MrcControllerSts Status; ///< Indicates whether this controller should be used.
+ U16 DeviceId; ///< The PCI device id of this memory controller.
+ U8 RevisionId; ///< The PCI revision id of this memory controller.
+ U8 ChannelCount; ///< Number of valid channels that exist on the controller.
+ MrcChannelOut Channel[MAX_CHANNEL]; ///< The following are channel level definitions.
+} MrcControllerOut;
+
+///
+/// This data structure contains all the "DDR power saving data" values that are considered output by the MRC.
+/// The following are memory controller level definitions. All channels on a controller are set to these values.
+///
+typedef struct {
+ BOOL BaseFlag; ///< Indicates if the base line of power was already calculated.
+ U16 BaseSavingRd; ///< Indicates the base line of power consume by the ddr on read.
+ U16 BaseSavingWr; ///< Indicates the base line of power consume by the ddr on write.
+ U16 BaseSavingCmd; ///< Indicates the base line of power consume by the ddr on command.
+ U16 MrcSavingRd; ///< Indicates the power consume by the ddr on read at the end of MRC.
+ U16 MrcSavingWr; ///< Indicates the power consume by the ddr on write at the end of MRC.
+ U16 MrcSavingCmd; ///< Indicates the power consume by the ddr on command at the end of MRC.
+} MrcOdtPowerSaving;
+
+///
+/// This data structure contains all the "global data" values that are considered output by the MRC.
+/// The following are system level definitions. All memory controllers in the system are set to these values.
+///
+typedef struct {
+ MrcVersion Version; ///< The memory reference code version.
+ MrcFrequency FreqMax; ///< The requested maximum valid frequency.
+ MrcFrequency Frequency; ///< The system's common memory controller frequency.
+ U32 MemoryClockMax; ///< The system's common memory controller maximum clock, in femtoseconds.
+ U32 MemoryClock; ///< The system's common memory controller clock, in femtoseconds.
+ MrcRefClkSelect RefClk; ///< The memory controller is going to use this reference clock.
+ MrcClockRatio Ratio; ///< Request for this memory controller to use this clock ratio.
+ MrcBootMode BootMode; ///< The system's common memory controller boot mode.
+ MrcMemoryMap MemoryMapData; ///< The system's memory map data.
+ MrcGfxDataSize GraphicsStolenSize; ///< Graphics Data Stolen Memory size in MB
+ MrcGfxGttSize GraphicsGttSize; ///< GTT graphics stolen memory size in MB
+ MrcVddSelect VddVoltage[MAX_PROFILE]; ///< The currently running voltage (VDD) setting for all DIMMs in the system, per profile.
+ MrcGdxc Gdxc; ///< GDXC enable and size.
+ MrcBool VddVoltageDone; ///< To determine if VddVoltageDone update has been done already
+ MrcBool EccSupport; ///< TRUE if ECC is enabled and supported on this controller.
+ MrcBool EnDumRd; ///< Enable/Disable Logic Analizer
+ MrcBool RestoreMRs; ///< Enable/Disable restoring
+ MrcBool AsyncOdtDis; ///< Enable Asyncronous ODT
+ MrcBool LpddrEctDone; ///< Set to TRUE once Early Command Training on LPDDR is done, and we can run JEDEC Init
+ MrcBool LpddrJedecInitDone; ///< Set to TRUE once JEDEC Init on LPDDR is done
+ MrcBool XmpProfileEnable; ///< XMP capable DIMMs detected in system (0 = no, 1 = yes).
+ MrcBool Capable100; ///< The MC is capable of 100 reference clock (0 = no, 1 = yes).
+ MrcBool AutoSelfRefresh; ///< Indicates ASR is supported for all the DIMMS for 2xRefresh
+ MrcDdrType DdrType; ///< Current memory type: DDR3 or LPDDR3
+ MrcSpdStatus SpdSecurityStatus; ///< Status variable to inform BIOS that memory contains an alias.
+ U32 MrcTotalChannelLimit; ///< The maximum allowed memory size per channel, in MBytes.
+ U8 SdramCount; ///< The number of SDRAM components on a DIMM.
+ U32 CompCtl0; ///< CompCtl0 CR
+ U32 CompCtl1; ///< CompCtl1 CR
+ U32 DimmVref; ///< DimmVref CR
+ U32 MiscControl0; ///< MiscCOntrol0 CR
+ U16 Qclkps; ///< Qclk period in pS
+ U8 DQPat; ///< Global Variables storing the current DQPat REUT Test
+ S8 DQPatLC; ///< Global Variables storing the current DQPat Loopcount
+ U8 ValidRankMask; ///< Rank bit map - includes both channels
+ U8 ValidChBitMask; ///< Channel bit map of the populated channels
+ MrcUPRLimitPtr UpmPwrRetrainLimits; ///< Pointer to Global UPM/PWR/RETRAIN Limits on the stack the size of MRC_NUMBER_UPM_PWR_RETRAIN_MARGINS
+ U32 MarginResult[MAX_RESULT_TYPE][MAX_RANK_IN_CHANNEL][MAX_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_EDGES]; ///< Stores last margin measurement.
+ MrcControllerOut Controller[MAX_CONTROLLERS];
+ MrcOdtPowerSaving OdtPowerSavingData;
+#ifdef UPSERVER_SUPPORT
+ U16 CLTM_SPD_Conf; ///< CLTM SPD Configuration Done(0 = process not executed, 0xFF = process failed, XX = process save CLTM_SPD_Conf
+#endif ///< CLTM_SPD_Conf = h=2xRefreshState i = Density , j = Frequency , k1 = Adjacent DIMM prescence in Channel 1, k0 = Adjacent DIMM prescence in Channel 0
+} MrcOutput;
+
+///
+///****************************************
+/// Input related "global data" structures.
+///****************************************
+///
+/// This data structure contains all the "global data" values that are considered input by the MRC.
+/// The following are SDRAM level definitions. All ranks on a rank are set to these values.
+///
+/* Commented out until needed, in order to save space.
+typedef struct {
+ U8 Placeholder; ///< TODO: Is there anything that needs to go in here?
+} MrcSdramIn;
+*/
+
+///
+/// This data structure contains all the "global data" values that are considered input by the MRC.
+/// The following are rank level definitions. All ranks on a DIMM are set to these values.
+///
+/* Commented out until needed, in order to save space.
+typedef struct {
+ MrcSdramIn Sdram[MAX_SDRAM_IN_DIMM];
+} MrcRankIn;
+*/
+
+///
+/// This data structure contains all the "global data" values that are considered input by the MRC.
+/// The following are DIMM level definitions. All ranks on a DIMM are set to these values.
+///
+typedef struct {
+ MrcDimmSts Status; ///< Indicates whether this DIMM should be used.
+ U8 SpdValid[sizeof (MrcSpd) / (CHAR_BITS * sizeof (U8))]; ///< Each valid bit maps to SPD byte.
+ MrcSpd Spd; ///< The SPD data for each DIMM. SPDGeneral field = 0 when absent.
+ MrcTiming Timing; ///< The DIMMs requested timing overrides.
+ U8 SpdAddress; ///< The SMBus address for the DIMM's SPD data.
+//MrcRankIn Rank[MAX_RANK_IN_DIMM];
+} MrcDimmIn;
+
+///
+/// This data structure contains all the "global data" values that are considered input by the MRC.
+/// The following are channel level definitions. All DIMMs on a memory channel are set to these values.
+///
+typedef struct {
+ MrcChannelSts Status; ///< Indicates whether this channel should be used.
+ U32 DimmCount; ///< The maximum number of DIMMs on this channel.
+ MrcDimmIn Dimm[MAX_DIMMS_IN_CHANNEL];
+#ifdef ULT_FLAG
+ U8 DqsMapCpu2Dram[8]; ///< Mapping from CPU DQS pins to SDRAM DQS pins
+ U8 DqMapCpu2Dram[8][MAX_BITS]; ///< Mapping from CPU DQ pins to SDRAM DQ pins
+ U8 DQByteMap[MrcIterationMax][2]; ///< Maps which PI clocks are used by what LPDDR DQ Bytes (from CPU side), per group
+ ///< DQByteMap[0] - ClkDQByteMap:
+ ///< If clock is per rank, program to [0xFF, 0xFF]
+ ///< If clock is shared by 2 ranks, program to [0xFF, 0] or [0, 0xFF]
+ ///< If clock is shared by 2 ranks but does not go to all bytes,
+ ///< Entry[i] defines which DQ bytes Group i services
+ ///< DQByteMap[1] - CmdNDQByteMap: Entry[0] is CmdN/CAA and Entry[1] is CmdN/CAB
+ ///< DQByteMap[2] - CmdSDQByteMap: Entry[0] is CmdS/CAA and Entry[1] is CmdS/CAB
+ ///< DQByteMap[3] - CkeDQByteMap : Entry[0] is CKE /CAA and Entry[1] is CKE /CAB
+ ///< For DDR, DQByteMap[3:1] = [0xFF, 0]
+ ///< DQByteMap[4] - CtlDQByteMap : Always program to [0xFF, 0] since we have 1 CTL / rank
+ ///< Variable only exists to make the code easier to use
+ ///< DQByteMap[5] - CmdVDQByteMap: Always program to [0xFF, 0] since we have 1 CA Vref
+ ///< Variable only exists to make the code easier to use
+#endif // ULT_FLAG
+} MrcChannelIn;
+
+///
+/// This data structure contains all the "global data" values that are considered input by the MRC.
+/// The following are memory controller level definitions. All channels on a controller are set to these values.
+///
+typedef struct {
+ MrcControllerSts Status; ///< Indicates whether this controller should be used.
+ U8 ChannelCount; ///< Number of valid channels that are requested on the controller.
+ MrcChannelIn Channel[MAX_CHANNEL]; ///< The following are channel level definitions.
+} MrcControllerIn;
+
+///
+/// This data structure contains all the "global data" values that are considered input by the MRC.
+/// The following are system level definitions. All memory controllers in the system are set to these values.
+///
+typedef struct {
+ MrcDebug Debug;
+ MrcFrequency FreqMax; ///< The requested maximum valid frequency.
+ MrcClockRatio Ratio; ///< Request for this memory controller to use this clock ratio.
+ MrcRefClkSelect RefClk; ///< Request for this memory controller to use this reference clock.
+ MrcBClkRef BClkFrequency; ///< Base reference clock value, in Hertz.
+ MrcBoardType BoardType; ///< define the board type (CRBMB,CRBDT,User1,User2). the OEM can add more boards.
+ MrcCpuStepping CpuStepping; ///< define the CPU stepping.
+ MrcCpuModel CpuModel; ///< define the CPU model.
+ MrcGfxDataSize GraphicsStolenSize; ///< Graphics Data Stolen Memory size in MB
+ MrcGfxGttSize GraphicsGttSize; ///< GTT graphics stolen memory size in MB
+ MrcBaseTime BaseTime; ///< RTC base time.
+ MrcIteration Iteration; ///
+ MrcMode MrcMode; ///< The control for full or MiniBIOS MRC.
+ MrcVddSelect VddVoltage; ///< The requested voltage (VDD) setting.
+ MrcProfile MemoryProfile; ///< The memory profile requested to be used.
+ MrcBootMode BootMode; ///< The requested memory controller boot mode.
+ MrcBool TxtFlag; ///
+ MrcBool MobilePlatform; ///< define Mobile or Desktop platform. true is mobile.
+ MrcBool EccSupport; ///< Tell to the MRC if ECC supporting or not. if false the ecc will not be support even if the DIMM will support in ECC.
+ MrcBool SetRxDqs32; ///
+ MrcBool GfxIsVersatileAcceleration; ///< iGFX engines are in Versatile Acceleration
+ MrcBool ScramblerEnable; ///< Enable/Disable scrambling
+ MrcBool McLock; ///
+ MrcBool RemapEnable; ///
+ MrcBool AutoSelfRefreshSupport; ///< FALSE = No auto self refresh support, TRUE = auto self refresh support.
+ MrcBool ExtTemperatureSupport; ///< FALSE = No extended temperature support, TRUE = extended temperature support.
+ U32 SaMemCfgAddress;
+ U32 SaMemCfgSize;
+ U32 PciEBaseAddress; ///< define the PciE base address.
+ U32 MchBarBaseAddress; ///< define the MCH bar base address.
+ U32 SmbusBaseAddress; ///< This field defines the smbus base address.
+ U32 GdxcBaseAddress; ///< This field defines the GDXC base address.
+ U32 HpetBaseAddress; ///< This field defines the hpet base address.
+ U32 MeStolenSize; ///< define the size that the ME need in MB.
+ U32 MmioSize; ///< define the MMIO size in MB.
+ U32 TsegSize; ///< TSEG size that require by the system in MB.
+ U32 IedSize; ///< IED size that require by the system in MB.
+ U32 DprSize; ///< DPR size required by system in MB.
+ U32 VddSettleWaitTime; ///< The minimum time in nanoseconds to wait for VDD to settle after being changed.
+ U16 VccIomV; ///< VccIO logic voltage in mV.
+ U8 PowerDownMode; ///< Option to select No PD, APD or PPD-DLLoff
+ U8 PwdwnIdleCounter; ///< Option to select the power down Idle counter.
+ MrcBool RankInterleave; ///< Option to Enable Rank Interleave.
+ MrcBool EnhancedInterleave; ///< Option to Enable Enhanced Interleave.
+ MrcBool WeaklockEn; ///< Option to Enable Weaklock for CMD, CTL and CKE
+ U8 EnCmdRate; ///< Option to Enable and select the number of CMDs for 1.5NMode
+ MrcBool CmdTriStateDis; ///< Option to Disable cmd tri-state
+ MrcBool RefreshRate2x; ///< Tells the MRC to enable 2x Refresh.
+ MrcBool ChHashEnable; ///< Option to Enable Channel Hash.
+ U16 ChHashMask; ///< Option to select Address bits[19:6] to include in Channel XOR function.
+ U8 ChHashInterleaveBit; ///< Option to select interleave Address bit. Valid values are 0 - 3 for BITS 6 - 9.
+ ThermalMngmtEn ThermalEnables; ///< Options to Enable Thermal management settings
+ MrcControllerIn Controller[MAX_CONTROLLERS];
+#ifdef SSA_FLAG
+ U32 SsaCallbackPpi;
+#endif // SSA_FLAG
+#if ((defined SSA_FLAG) || (defined MRC_DEBUG_PRINT))
+ U32 SsaHeapBase; ///< Starting address of the SSA services heap space.
+ U32 SsaHeapSize; ///< Size of the SSA services heap space, in bytes.
+ SsaHeapFlagType SsaHeapFlag; ///< Bit 0 = 1 is SSA heap initialized, all other bits reserved.
+#endif
+ MrcGdxc Gdxc; ///< GDXC enable and size.
+ MrcBool MemoryTrace; ///< Option to Enable Memory Trace to second DDR channel using Stacked Mode
+ TrainingStepsEn TrainingEnables; ///< Options to Enable individual training steps
+ MrcBool OemCleanMemory; ///< TRUE to request a memory clean
+ MrcBool RmtBdatEnable; ///< Option to enable output of training results into BDAT.
+#ifdef ULT_FLAG
+ MrcBool DqPinsInterleaved; ///< Interleaving mode of DQ/DQS pins - depends on board routing
+ MrcBool LpddrDramOdt; ///< TRUE if LPDDR DRAM ODT is used - depends on board design
+ U8 CkeRankMapping; ///< [3:0] - Channel 0, [7:4] - Channel 1.
+ ///< Bit [i] specifies which rank CKE[i] goes to.
+#endif
+ U8 MaxRttWr; ///< Maximum DIMM RTT_WR to use in power training 0 = Off, 1 = 120 ohms
+} MrcInput;
+
+///
+///********************************************
+/// Saved data related "global data" structures.
+///********************************************
+///
+
+///
+/// This data structure contains all the "global data" values that are considered to be needed
+/// by the MRC between power state transitions (S0->S3->S0) and also fast and warm boot modes.
+/// The following are channel level definitions.
+///
+typedef struct {
+ MrcChannelSts Status; ///< Indicates whether this channel should be used.
+ MrcBool EccSupport; ///< TRUE if ECC is enabled and supported on this DIMM.
+ U32 DimmCount; ///< Number of valid DIMMs that exist in the channel.
+ U8 ValidRankBitMask; ///< Bit map of the populated ranks per channel
+ MrcTiming Timing[MAX_PROFILE]; ///< The channel timing values.
+ MrcDimmOut Dimm[MAX_DIMMS_IN_CHANNEL];
+ MrcSpdSave SpdSave[MAX_DIMMS_IN_CHANNEL]; ///< Save SPD information needed for SMBIOS structure creation.
+} MrcChannelSave;
+
+///
+/// This data structure contains all the "global data" values that are considered to be needed
+/// by the MRC between power state transitions (S0->S3->S0) and also fast and warm boot modes.
+/// The following are controller level definitions.
+///
+typedef struct {
+ MrcControllerSts Status; ///< Indicates whether this controller should be used.
+ U8 ChannelCount; ///< Number of valid channels that exist on the controller.
+ MrcChannelSave Channel[MAX_CHANNEL];
+} MrcContSave;
+
+///
+/// This data structure contains all the "global data" values that are considered to be needed
+/// by the MRC between power state transitions (S0->S3->S0) and also fast and warm boot modes.
+/// The following are system level definitions.
+///
+typedef struct {
+ U32 Crc; ///< The CRC-32 of the data in this structure.
+} MrcSaveHeader;
+
+//
+// ------- IMPORTANT NOTE --------
+// MRC_MC_REGISTER_COUNT in Global.h should match the table in MrcSaveRestore.c.
+// Update this define whenever you add/remove registers from this table.
+//
+ #define MRC_MC_REGISTER_COUNT (1 + (2496 / sizeof (U32))) ///< The number of MC registers that need to be saved.
+
+typedef struct {
+ MrcCapId McCapId; ///< The memory controller's capabilities.
+ U32 MeStolenSize;
+ U32 McRegister[MRC_MC_REGISTER_COUNT]; ///< The memory controllers registers.
+ MrcCpuStepping CpuStepping; ///< The last cold boot happended with this CPU stepping.
+ MrcCpuModel CpuModel; ///< The last cold boot happended with this CPU model.
+ MrcVersion Version; ///< The last cold boot happended with this MRC version.
+ U32 SaMemCfgCrc; ///< The CRC32 of the system agent memory configuration structure.
+ MrcContSave Controller[MAX_CONTROLLERS];
+ MrcFrequency Frequency; ///< The system's common memory controller frequency.
+ U32 MemoryClock; ///< The system's common memory controller clock, in femtoseconds.
+ MrcRefClkSelect RefClk; ///< The memory controller is going to use this reference clock.
+ MrcClockRatio Ratio; ///< Request for this memory controller to use this clock ratio.
+ MrcVddSelect VddVoltage[MAX_PROFILE]; ///< The voltage (VDD) setting for all DIMMs in the system, per profile.
+ MrcBool EccSupport; ///< TRUE if ECC is enabled and supported on this controller.
+ MrcDdrType DdrType; ///< DDR type: DDR3 or LPDDR3
+ MrcBool XmpProfileEnable; ///< XMP capable DIMMs detected in system (0 = no, 1 = yes).
+#ifdef UPSERVER_SUPPORT
+ U16 CLTM_SPD_Conf; ///< CLTM SPD Configuration Done(0 = process not executed, 0xFF = process failed, XX = process save CLTM_SPD_Conf
+#endif // UPSERVER_SUPPORT ///< CLTM_SPD_Conf = i = Density , j = Frequency , k1 = Adjacent DIMM prescence in Channel 1, k0 = Adjacent DIMM prescence in Channel 0
+} MrcSaveData;
+
+typedef struct {
+ MrcSaveHeader Header; ///< The header portion of the MRC saved data.
+ MrcSaveData Data; ///< The data portion of the MRC saved data.
+} MrcSave;
+
+typedef struct {
+ MrcInput Inputs;
+} SysInput;
+
+typedef struct {
+ MrcOutput Outputs;
+} SysOutput;
+
+typedef struct {
+ MrcSave Save;
+} SysSave;
+
+///
+/// This data structure contains all of the MRC "global data" values.
+///
+typedef struct {
+ U32 SaveSize;
+ SysSave SysSave;
+ SysInput SysIn;
+ SysOutput SysOut;
+ U64 Oem;
+#ifdef BDAT_SUPPORT
+ RmtData Rmt;
+#endif
+} MrcParameters;
+
+#ifdef UPSERVER_SUPPORT
+
+
+
+#define WarmThreshold_1X_MAX_TEMP 83
+#define WarmThreshold_2X_MAX_TEMP 85
+#define HotThreshold_1X_MAX_TEMP 83
+#define HotThreshold_2X_MAX_TEMP 92
+
+
+#define CRITICAL_TEMP 105
+#define THOT_2X_MAX_TEMP 93
+#define THOT_1X_MAX_TEMP 83
+#define DISABLE_REFRESH2X 0
+
+//Power Weight Table Defines
+#define WARM_BUDGET_POSITION 6
+
+// CLTM Process Status Defines
+#define PROCESS_NOT_INITIALIZED 0x0000
+#define PROCESS_FAILED 0xFFFF
+#define CONTROLLER_NOT_LOADED 0xFF
+#define CLTM_DISABLE 0
+
+//CAMARILLO Interrupt Defines
+#define TWOX_REFRESH_INTERRUPT_ENABLE 1
+#define FORCEMEMPR_INTERRUPT_ENABLE 1
+
+//TSE2002 Thermal Sensor Defines
+#define MTS_CAPABILITIES 0
+#define MTS_CFG 1
+#define MTS_THIGH 2
+#define MTS_TLOW 3
+#define MTS_TCRIT 4
+#define TEMPERATURE_REGISTER 5
+#define MTS_MFGID 6
+#define MTS_DID 7
+#define THERMAL_MODULE_MASK 0x30
+
+//TSOD definitions
+#define HYST_DISABLE 0
+
+typedef union {
+ struct {
+ U16 EVENT_MODE : 1; // Bits 0:0
+ U16 EVENT_POLARITY : 1; // Bits 1:1
+ U16 CRICAL_EVENT_ONLY : 1; // Bits 2:2
+ U16 EVENT_OUTPUT_CONTROL : 1; // Bits 3:3
+ U16 EVENT_STATUS : 1; // Bits 4:4
+ U16 CLEAR_EVENT : 1; // Bits 5:5
+ U16 ALARM_WINDOW_LOCK : 1; // Bits 6:6
+ U16 CRITICAL_LOCK : 1; // Bits 7:7
+ U16 SHUTDOWNMODE : 1; // Bits 8:8
+ U16 HYST_ENABLE : 1; // Bits 10:9
+ U16 : 4; // Bits 15:11
+ } Bits;
+ U16 Data;
+} TSOD_CONF_REGISTER_STRUCT;
+
+//#define MTS_CFG_EVENT ((0x01) | (0x04) | (0x08)) //Bit 0 = 1, Bit 1 = 0, Bit 2 = 1, Bit 3 = 1 , Bit8 = 0, Bit 10 =0
+
+#endif //UPSERVER_SUPPORT
+
+
+#pragma pack (pop)
+#endif
+
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcIoControl.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcIoControl.h
new file mode 100644
index 0000000..2d00470
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcIoControl.h
@@ -0,0 +1,44 @@
+/** @file
+ Memory controller IO configuration definition header.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+**/
+#ifndef _MrcIoControl_h_
+#define _MrcIoControl_h_
+
+#include "MrcTypes.h"
+#include "McAddress.h"
+#include "MrcCommon.h"
+#include "MrcGlobal.h"
+
+/**
+@brief
+ Reset the MC IO module. The MC hardware will handle creating the 20 dclk pulse
+ after the bit is set and will also clear the bit.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval mrcSuccess - IO Reset was done successfully
+ @retval mrcDeviceBusy - Timed out waiting for the IO to clear the bit
+**/
+MrcStatus
+IoReset (
+ IN MrcParameters *const MrcData
+ );
+
+#endif // _MrcIoControl_h_
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcMcConfiguration.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcMcConfiguration.h
new file mode 100644
index 0000000..6a094d1
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcMcConfiguration.h
@@ -0,0 +1,114 @@
+/** @file
+ Non training specific memory controller configuration definitions.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+**/
+#ifndef __MrcMcConfiguration_h__
+#define __MrcMcConfiguration_h__
+
+#include "MrcTypes.h"
+#include "MrcApi.h"
+#include "McAddress.h"
+#include "MrcAddressDecodeConfiguration.h"
+#include "MrcCommandTraining.h"
+#include "MrcCommon.h"
+#include "MrcGeneral.h"
+#include "MrcGlobal.h"
+#include "MrcOem.h"
+#include "MrcOemIo.h"
+#include "MrcRefreshConfiguration.h"
+#include "MrcSchedulerParameters.h"
+#include "MrcTimingConfiguration.h"
+
+#define DISABLE_ODT_STATIC (0) ///< May change in the future
+#define CDIEVSSHI (2000) ///< Constant CdieVssHi = 2000 (value in pF)
+#define RCMDREF (100) ///< Constant RcmdRef = 100 (value in ohm)
+
+/**
+@brief
+ This function calculates the two numbers that get you closest to the slope.
+
+ @param[in] Slope - targeted slope (multiplied by 100 for int match)
+
+ @retval Returns the Slope Index to be programmed for VtSlope.
+**/
+extern
+U8
+MrcCalcVtSlopeCode (
+ const U16 Slope
+ );
+
+/**
+@brief
+ This function performs the memory controller configuration non training sequence.
+
+ @param[in, out] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - mrcSuccess if successful or an error status
+**/
+extern
+MrcStatus
+MrcMcConfiguration (
+ MrcParameters *const MrcData
+ );
+
+/**
+@brief
+ This function init all the necessary registers for the training.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval mrcSuccess
+**/
+extern
+MrcStatus
+MrcPreTraining (
+ MrcParameters *const MrcData
+ );
+
+/**
+@brief
+ This function initializes all the necessary registers after main training steps but before LCT.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval mrcSuccess
+**/
+extern
+MrcStatus
+MrcPostTraining (
+ MrcParameters *const MrcData
+ );
+
+/**
+@brief
+ Program PCU_CR_DDR_VOLTAGE register.
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] VddVoltage - Current DDR voltage.
+
+ @retval none
+**/
+extern
+void
+MrcSetPcuDdrVoltage (
+ IN OUT MrcParameters *MrcData,
+ IN MrcVddSelect VddVoltage
+ );
+
+#endif // __MrcMcConfiguration_h__
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcMemoryMap.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcMemoryMap.h
new file mode 100644
index 0000000..0ae9534
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcMemoryMap.h
@@ -0,0 +1,97 @@
+/** @file
+ The physical memory map configuration definitions.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+**/
+#ifndef _MrcMemoryMap_h_
+#define _MrcMemoryMap_h_
+
+#include "MrcTypes.h"
+#include "MrcApi.h"
+#include "McAddress.h"
+#include "MrcCommon.h"
+#include "MrcOem.h"
+
+#define MEM_4GB (0x1000) ///< Define the 4 GB size in 1MB units (1000MB = 1GB).
+
+/**
+@brief
+ After BIOS determines the total physical memory size.
+ Determines TOM which is defined by the total physical memory size.
+ Determines TOM minus the ME memory size. The ME memory size is calculated from MESEG_BASE and MESEG_MASK.
+ Determines MMIO allocation, which is system configuration dependent.
+
+ Determines TOLUD which is the minimum value by comparing between "4GB minus MMIO size" and "TOM minus ME size".
+ Determines Graphics Stolen Base, BDSM by subtracting the graphics data stolen memory size from TOLUD.
+ Graphics Data Stolen Memory size is given by GMS field in GGC register. It must be define before this stage.
+ Determines Graphics GTT Stolen Base, BGSM by subtracting the GTT graphics stolen memory size from BDSM.
+ GTT Stolen Memory size is given by GGMS field in GGC register. It must be define before this stage.
+ Determines TSEG Base, TSEGMB by subtracting TSEG size from BGSM.
+ TSEG should be defined.
+ Remove the memory hole caused by aligning TSEG to a 8MB boundary.
+ Determine whether Memory Reclaim is available. If "TOM minus ME Stolem Memory Size" is greater than the value of TOLUD, then memory reclaim is available to enable.
+ Determine REMAPBASE if reclaim is enabled. This is the maximum value by comparing between 4GB and "TOM minus ME size".
+ Determine REMAPLIMIT () if reclaim is enabled. This is the value of REMAPBASE plus "the difference between the value in TOLUD register and the lower of either 4GB or 'TOM minus ME Stolen memory size", and then minus 1 boundary.
+ Determine TOUUD. TOUUD indicates the address one byte above the maximum DRAM. If relcaim is disabled, this value is calculated by "TOM minus ME stolen size". Otherwise, this value is set to REMAPLIMIT plus 1MB.
+
+ @param[in, out] MrcData - Include all MRC global data. include also the memory map data.
+
+ @retval MrcStatus - if the reset is succeded.
+**/
+extern
+MrcStatus
+MrcSetMemoryMap (
+ MrcParameters *const MrcData
+ );
+
+/**
+
+@brief
+ This function find the total memory in the system.
+ and write it to TotalPhysicalMemorySize in MrcData structure.
+
+ @param[in, out] MrcData - Include all MRC global data.
+
+ @retval Nothing
+**/
+extern
+void
+MrcTotalMemory (
+ MrcParameters *const MrcData
+ );
+
+/**
+
+@brief
+ this function write to the memory init registers.
+
+ @param[in] PciEBaseAddress - Address of the PCI Express BAR
+ @param[in] GdxcBaseAddress - Address of the GDXC BAR
+ @param[in] MemoryMap - Include all the memory map definitions
+
+ @retval Nothing
+**/
+extern
+void
+UpdateMemoryMapRegisters (
+ const U32 PciEBaseAddress,
+ const U32 GdxcBaseAddress,
+ const MrcMemoryMap *const MemoryMap
+ );
+
+#endif // _MrcMemoryMap_h_
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcOem.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcOem.h
new file mode 100644
index 0000000..0742d8d
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcOem.h
@@ -0,0 +1,464 @@
+/** @file
+ This file is the OEM interface to the MRC core.
+ This file includes the OEM MRC implementation and can be changed between projects.
+ Each MRC customer must provide those OEM interfaces.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#ifndef _MrcOem_h_
+#define _MrcOem_h_
+
+#include "MrcTypes.h"
+#include "MrcApi.h"
+#include "MrcGlobal.h"
+
+//
+// OEM MMIO routines
+//
+#include "MrcOemMmio.h"
+
+//
+//////////////////////////////////////////////////////////////////////////////////////
+// OEM debug print routines and types //
+//////////////////////////////////////////////////////////////////////////////////////
+//
+#include "MrcOemDebugPrint.h"
+
+#ifndef MRC_DEBUG_MSG
+#error "MRC_DEBUG_MSG is not defined"
+#endif //MRC_DEBUG_MSG
+///
+//////////////////////////////////////////////////////////////////////////////////////
+/// OEM platform routines and types //
+//////////////////////////////////////////////////////////////////////////////////////
+///
+/// define the oem check points the OEM can define more point and locate them in the code.
+///
+typedef enum {
+ OemFastBootPermitted, ///< before fast boot.
+ OemRestoreNonTraining,
+ OemPrintInputParameters, ///< before printing input parameters
+ OemSpdProcessingRun, ///< before spd processing code
+ OemSetOverridePreSpd, ///< before set overrides pre spd
+ OemMcCapabilityPreSpd, ///< before MC capability pre spd
+ OemSetOverride, ///< before set overrides
+ OemMcCapability, ///< before MC capability
+ OemMcInitRun, ///< before mc init code
+ OemMcMemoryMap, ///< before memory map
+ OemMcResetRun, ///< before jedec reset
+ OemPreTraining, ///< before the training.
+ OemMcTrainingRun, ///< before training code
+ OemEarlyCommandTraining, ///< before Early Command training
+ OemJedecInitLpddr3, ///< before Jedec Init Lpddr3
+ OemSenseAmpTraining, ///< before Sense Amp Training
+ OemReadMprTraining, ///< before Read MPR Training
+ OemReceiveEnable, ///< before Read Leveling
+ OemJedecWriteLeveling, ///< before Jedec Write Leveling
+ OemWriteLeveling, ///< before Functional Write Leveling
+ OemWriteDqDqs, ///< before Write Timing Centering
+ OemReadDqDqs, ///< before Read Timing Centering
+ OemDimmRonTraining, ///< before DIMM Ron algorithm.
+ OemDimmODTTraining, ///< before DIMM ODT algorithm.
+ OemDimmODT1dTraining, ///< before DIMM ODT 1d algorithm.
+ OemWriteDriveStrength, ///< before Write DS
+ OemWriteSlewRate, ///< before Write SR
+ OemWriteEQTraining, ///< before Write Equalization Training
+ OemReadODTTraining, ///< before Read ODT algorithm.
+ OemReadEQTraining, ///< before Read Equalization Training
+ OemReadAmplifierPower, ///< before Read Amplifier Power
+ OemOptimizeComp, ///< before Comp Optimization Training
+ OemPowerSavingMeter, ///< before PowerSavingMeter step
+ OemWriteDqDqs2D, ///< before Write Timing Centering 2D
+ OemReadDqDqs2D, ///< before Read Timing Centering 2D
+ OemCmdVoltCentering, ///< before Command Voltage Centering
+ OemWriteVoltCentering2D, ///< before Write Voltage Centering 2D
+ OemReadVoltCentering2D, ///< before Read Voltage Centering 2D
+ OemLateCommandTraining, ///< before Late Command training
+ OemRoundTripLatency, ///< before Round Trip Latency Traiing
+ OemTurnAroundTimes, ///< before Turn Aorund Times.
+ OemRcvEnCentering1D, ///< before Receive Enable Centring
+ OemSaveMCValues, ///< before saving memory controller values
+ OemRmt, ///< before RMT crosser tool.
+ OemMemTest, ///< before Memory testing
+ OemRestoreTraining, ///< before Restoring Training Values
+ OemSelfRefreshExit, ///< before Self Refresh Exit
+ OemNormalMode, ///< before Normal Mode on non-cold boots.
+ OemAliasCheck, ///< before alias checking on cold boots.
+ OemHwMemInit,
+
+ OemPostTraining, ///< after the training.
+ OemMrcActivate, ///< before MrcActivate call.
+ OemMrcDone, ///< call to MrcOemCheckPoint when MRC was done.
+ OemFrequencySet, ///< do operation before frequency set.
+ OemFrequencySetDone, ///< do operation after frequency set.
+ OemStartMemoryConfiguration,
+ OemBeforeNormalMode, ///< call to MrcOemCheckPoint before normal mode is enalbed
+ OemAfterNormalMode, ///< call to MrcOemCheckPoint after normal mode is enalbed
+ OemMrcFillRmt,
+ OemRetrainMarginCheck,
+ ///
+ ///*********************************************************************************
+ ///
+ OemNumOfCommands ///< Should always be last in the list!
+} MRC_OemStatusCommand;
+
+///
+/// Define the MRC SMBUS devices type.
+///
+typedef enum {
+ datOemSpd_0_0, ///< use for get the device address for channel 0 dimm 0
+ datOemSpd_0_1, ///< use for get the device address for channel 0 dimm 1
+ datOemSpd_1_0, ///< use for get the device address for channel 1 dimm 0
+ datOemSpd_1_1, ///< use for get the device address for channel 1 dimm 1
+ datOemVrefWrite_0, ///< use for get the device address for dimm vref controlled potentiometer channel 0
+ datOemVrefWrite_1, ///< use for get the device address for dimm vref controlled potentiometer channel 1
+ datOemVrefRead ///< use for get the device address for cpu vref controlled potentiometer
+} MRC_OemSmbusDeviceType;
+
+///
+//////////////////////////////////////////////////////////////////////////////////////
+/// OEM IO routines and types //
+//////////////////////////////////////////////////////////////////////////////////////
+///
+
+/**
+ 8 bit I/O port read.
+ Needs to be ported for OEM platform requirements.
+
+ @param[in] Address - the IO read address.
+
+ @retval return the read value.
+**/
+extern
+U8
+MrcOemInPort8 (
+ IN U16 IoAddress
+ );
+
+/**
+ 8 bit I/O port write.
+ Needs to be ported for OEM platform requirements.
+
+ @param[in] IoAddress - The I/O port read address.
+ @param[in] Data - The value to write.
+
+ @retval Nothing
+**/
+extern
+void
+MrcOemOutPort8 (
+ IN U16 IoAddress,
+ IN U8 data
+ );
+
+/**
+ 16 bit I/O port read.
+ Needs to be ported for OEM platform requirements.
+
+ @param[in] IoAddress - The I/O port read address.
+
+ @retval return the read value.
+**/
+extern
+U16
+MrcOemInPort16 (
+ IN U16 IoAddress
+ );
+
+/**
+ 16 bit I/O port write.
+ Needs to be ported for OEM platform requirements.
+
+ @param[in] IoAddress - The I/O port read address.
+ @param[in] Data - The value to write.
+
+ @retval Nothing
+**/
+extern
+void
+MrcOemOutPort16 (
+ IN U16 IoAddress,
+ IN U16 data
+ );
+
+/**
+ 32 bit I/O port read.
+ Needs to be ported for OEM platform requirements.
+
+ @param[in] IoAddress - The I/O port read address.
+
+ @retval The value read.
+**/
+extern
+U32
+MrcOemInPort32 (
+ IN U16 IoAddress
+ );
+
+/**
+ 32 bit I/O port write.
+ Needs to be ported for OEM platform requirements.
+
+ @param[in] IoAddress - The I/O port read address.
+ @param[in] Data - The value to write.
+
+ @retval Nothing
+**/
+extern
+void
+MrcOemOutPort32 (
+ IN U16 IoAddress,
+ IN U32 data
+ );
+
+/**
+ This function return the PCI index address.
+ Needs to be ported for OEM platform requirements.
+
+ @param[in] None.
+
+ @retval The PCI index address.
+**/
+extern
+U16
+MrcOemPciIndex (
+ void
+ );
+
+/**
+ This function return the PCI data address.
+ Needs to be ported for OEM platform requirements.
+
+ @param[in] None
+
+ @retval The PCI data address.
+**/
+extern
+U16
+MrcOemPciData (
+ void
+ );
+
+/**
+ This function return the PCI device address.
+ Needs to be ported for OEM platform requirements.
+
+ @param[in] Bus - PCI bus
+ @param[in] Device - PCI device
+ @param[in] Function - PCI function
+ @param[in] Offset - Offset
+
+ @retval The PCI device address.
+**/
+extern
+U32
+MrcOemGetPciDeviceAddress (
+ IN U8 Bus,
+ IN U8 Device,
+ IN U8 Function,
+ IN U8 Offset
+ );
+
+/**
+ This function return the PCIE device address.
+ Needs to be ported for OEM platform requirements.
+
+ @param[in] Bus - PCI bus
+ @param[in] Device - PCI device
+ @param[in] Function - PCI function
+ @param[in] Offset - Offset
+
+ @retval The PCIe device address.
+**/
+extern
+U32
+MrcOemGetPcieDeviceAddress (
+ IN U8 Bus,
+ IN U8 Device,
+ IN U8 Function,
+ IN U8 Offset
+ );
+
+/**
+ Returns the current time, as determined by reading the Real Time Clock (RTC) on the platform.
+ Since RTC time is stored in BCD, convert each value to binary.
+
+ @param[out] Seconds - The current second (0-59).
+ @param[out] Minutes - The current minute (0-59).
+ @param[out] Hours - The current hour (0-23).
+ @param[out] DayOfMonth - The current day of the month (1-31).
+ @param[out] Month - The current month (1-12).
+ @param[out] Year - The current year (2000-2099).
+
+ @retval Nothing
+**/
+extern
+void
+MrcOemGetRtcTime (
+ U8 *Seconds,
+ U8 *Minutes,
+ U8 *Hours,
+ U8 *DayOfMonth,
+ U8 *Month,
+ U16*Year
+ );
+
+///
+//////////////////////////////////////////////////////////////////////////////////////
+/// OEM Memory routines and types //
+//////////////////////////////////////////////////////////////////////////////////////
+///
+
+/**
+ Copy the specified number of memory bytes, a byte at a time, from the
+ specified source to the specified destination.
+ Needs to be ported for OEM platform requirements.
+
+ @param[in, out] Dest - Destination pointer.
+ @param[in] Src - Source pointer.
+ @param[in] NumBytes - The number of bytes to copy.
+
+ @retval Nothing
+**/
+extern
+void
+MrcOemMemoryCpy (
+ IN OUT U8 *Dest,
+ IN U8 *Src,
+ IN U32 NumBytes
+ );
+
+/**
+ Sets the specified number of memory bytes, a byte at a time, at the
+ specified destination.
+ Needs to be ported for OEM platform requirements.
+
+ @param[in, out] Dest - Destination pointer.
+ @param[in] Value - The value to set.
+ @param[in] NumBytes - The number of bytes to set.
+
+ @retval Nothing
+**/
+extern
+void
+MrcOemMemorySet (
+ IN OUT U8 *Dest,
+ IN U32 Value,
+ IN U32 NumBytes
+ );
+
+/**
+ Sets the specified number of memory dwords, a dword at a time, at the
+ specified destination.
+
+ @param[in, out] Dest - Destination pointer.
+ @param[in] Value - The value to set.
+ @param[in] NumWords - The number of dwords to set.
+
+ @retval Nothing.
+**/
+extern
+void
+MrcOemMemorySetWord (
+ IN OUT U16 *Dest,
+ IN const U16 Value,
+ IN U32 NumWords
+ );
+
+/**
+ Sets the specified number of memory dwords, a dword at a time, at the
+ specified destination.
+
+ @param[in, out] Dest - Destination pointer.
+ @param[in] Value - The value to set.
+ @param[in] NumDwords - The number of dwords to set.
+
+ @retval Nothing.
+**/
+extern
+void
+MrcOemMemorySetDword (
+ IN OUT U32 *Dest,
+ IN const U32 Value,
+ IN U32 NumDwords
+ );
+
+/**
+ Shift the specified data value left by the specified count.
+ Needs to be ported for OEM platform requirements.
+
+ @param[in] Data - 64 bit number to shift left.
+ @param[in] Count - Number of bits to shift (0..63)
+
+ @retval The number of bits shifted left.
+**/
+extern
+U64
+MrcOemMemoryLeftShiftU64 (
+ IN const U64 Data,
+ IN const U8 Count
+ );
+
+/**
+ Shift the specified data value Right by the specified count.
+
+ @param[in] Data - U64 number to shift
+ @param[in] Count - number of bits to shift (0..63)
+
+ @retval Returns the shifted U64 value.
+**/
+extern
+U64
+MrcOemMemoryRightShiftU64 (
+ IN const U64 Data,
+ IN const U8 Count
+ );
+
+/**
+ This function Multiply U64 with a U32 number. Result is <= 64 bits
+ Needs to be ported for OEM platform requirements.
+
+ @param[in] Multiplicand - U64 number to be multiplied with
+ @param[in] Multiplier - U32 number to multiply
+
+ @retval Returns the multiplication result of U64 value.
+**/
+extern
+U64
+MrcOemMemoryMultiplyU64ByU32 (
+ IN const U64 Multiplicand,
+ IN const U32 Multiplier
+ );
+
+/**
+ Divide U64 with a U64 number. Result is <= 32 bits
+
+ @param[in] Dividend - U64 number to be multiplied with
+ @param[in] Divisor - U32 number to multiply
+
+ @retval Returns the quotient result of U64 value.
+**/
+extern
+U64
+MrcOemMemoryDivideU64ByU64 (
+ IN const U64 Dividend,
+ IN const U64 Divisor
+ );
+
+#endif // _MrcOem_h_
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/McGdxcbar.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/McGdxcbar.h
new file mode 100644
index 0000000..fd91eba
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/McGdxcbar.h
@@ -0,0 +1,2849 @@
+/** @file
+ This file was automatically generated. Modify at your own risk.
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef __McGdxcbar_h__
+#define __McGdxcbar_h__
+
+#pragma pack(push, 1)
+#include "MrcTypes.h"
+
+typedef union {
+ struct {
+ U32 Tx_Delay_R0 : 8; // Bits 7:0
+ U32 Tx_Delay_R1 : 8; // Bits 15:8
+ U32 Tx_Delay_R2 : 8; // Bits 23:16
+ U32 Tx_Delay_R3 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRPL_CR_DDR_TX_DELAY_STRUCT;
+
+typedef union {
+ struct {
+ U32 EN_SW_GDXC : 1; // Bits 0:0
+ U32 EN_RING_ADQ : 1; // Bits 1:1
+ U32 EN_RING_BLQ : 1; // Bits 2:2
+ U32 EN_RING_AKQ : 1; // Bits 3:3
+ U32 EN_RING_IVQ : 1; // Bits 4:4
+ U32 EN_IDIQ : 1; // Bits 5:5
+ U32 EN_mc_UCLKQ : 1; // Bits 6:6
+ U32 : 1; // Bits 7:7
+ U32 UP_EN_ADQ : 1; // Bits 8:8
+ U32 DN_EN_ADQ : 1; // Bits 9:9
+ U32 UP_EN_BLQ : 1; // Bits 10:10
+ U32 DN_EN_BLQ : 1; // Bits 11:11
+ U32 UP_EN_AKQ : 1; // Bits 12:12
+ U32 DN_EN_AKQ : 1; // Bits 13:13
+ U32 MOTQ_TIMING_SELECT : 1; // Bits 14:14
+ U32 : 1; // Bits 15:15
+ U32 SPARE : 8; // Bits 23:16
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPCOHTRK_CR_GDXC_SW_ENABLE_STRUCT;
+
+typedef union {
+ struct {
+ U32 EN_Core0_T0 : 1; // Bits 0:0
+ U32 EN_Core0_T1 : 1; // Bits 1:1
+ U32 EN_Core1_T0 : 1; // Bits 2:2
+ U32 EN_Core1_T1 : 1; // Bits 3:3
+ U32 EN_Core2_T0 : 1; // Bits 4:4
+ U32 EN_Core2_T1 : 1; // Bits 5:5
+ U32 EN_Core3_T0 : 1; // Bits 6:6
+ U32 EN_Core3_T1 : 1; // Bits 7:7
+ U32 EN_GT : 1; // Bits 8:8
+ U32 MEM_CHR_RD : 1; // Bits 9:9
+ U32 MEM_CHR_WR : 1; // Bits 10:10
+ U32 MEM_NC : 1; // Bits 11:11
+ U32 EN_CBO_Exp_WB : 1; // Bits 12:12
+ U32 SNP_Access : 1; // Bits 13:13
+ U32 AD_EODLAT : 1; // Bits 14:14
+ U32 : 17; // Bits 31:15
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_STRUCT;
+
+typedef union {
+ struct {
+ U32 CR_CHR_RD : 3; // Bits 2:0
+ U32 CHR_RD_STAT_MOD : 1; // Bits 3:3
+ U32 CR_CHR_WR : 4; // Bits 7:4
+ U32 CR_NC_RD : 3; // Bits 10:8
+ U32 NC_RD_STAT_MOD : 1; // Bits 11:11
+ U32 CR_NC_WR : 4; // Bits 15:12
+ U32 NC_WR_STAT_MOD : 1; // Bits 16:16
+ U32 Data_Core0 : 1; // Bits 17:17
+ U32 Data_Core1 : 1; // Bits 18:18
+ U32 Data_Core2 : 1; // Bits 19:19
+ U32 Data_Core3 : 1; // Bits 20:20
+ U32 Data_CBO : 1; // Bits 21:21
+ U32 Data_GT : 1; // Bits 22:22
+ U32 : 9; // Bits 31:23
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPCOHTRK_CR_GDXC_QUALIFIER_BL_STRUCT;
+
+typedef union {
+ struct {
+ U32 OVF_Global : 1; // Bits 0:0
+ U32 OVF_Ring_AD : 1; // Bits 1:1
+ U32 OVF_Ring_BL : 1; // Bits 2:2
+ U32 OVF_Ring_AK : 1; // Bits 3:3
+ U32 OVF_Ring_IV : 1; // Bits 4:4
+ U32 : 4; // Bits 8:5
+ U32 OVF_IDI_center : 1; // Bits 9:9
+ U32 OVF_mcUCLK : 1; // Bits 10:10
+ U32 OVF_PWR_mcFCLK : 1; // Bits 11:11
+ U32 : 20; // Bits 31:12
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPCOHTRK_CR_GDXC_OVF_STATUS_STRUCT;
+
+typedef union {
+ struct {
+ U32 MEM_PTR : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPCOHTRK_CR_GDXC_MOT_ADDRESS_LO_STRUCT;
+
+typedef union {
+ struct {
+ U32 MEM_PTR : 1; // Bits 0:0
+ U32 BUFFER_WRAP : 1; // Bits 1:1
+ U32 SPARE : 30; // Bits 31:2
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPCOHTRK_CR_GDXC_MOT_ADDRESS_HI_STRUCT;
+
+typedef union {
+ struct {
+ U32 START_ADDRESS : 16; // Bits 15:0
+ U32 END_ADDRESS : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPCOHTRK_CR_GDXC_MOT_REGION_STRUCT;
+
+typedef union {
+ struct {
+ U32 MEM_PTR : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPCOHTRK_CR_GDXC_OCLA_ADDRESS_LO_STRUCT;
+
+typedef union {
+ struct {
+ U32 MEM_PTR : 1; // Bits 0:0
+ U32 BUFFER_WRAP : 1; // Bits 1:1
+ U32 LOCK : 1; // Bits 2:2
+ U32 SPARE : 29; // Bits 31:3
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPCOHTRK_CR_GDXC_OCLA_ADDRESS_HI_STRUCT;
+
+typedef union {
+ struct {
+ U32 START_ADDRESS : 16; // Bits 15:0
+ U32 END_ADDRESS : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPCOHTRK_CR_GDXC_OCLA_REGION_STRUCT;
+
+typedef union {
+ struct {
+ U32 ARM_bits_packet : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_ARM_S0L_STRUCT;
+
+typedef union {
+ struct {
+ U32 ARM_bits_packet : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_ARM_S0H_STRUCT;
+
+typedef union {
+ struct {
+ U32 Mask_bits : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_MASK_S0L_STRUCT;
+
+typedef union {
+ struct {
+ U32 Mask_bits : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_MASK_S0H_STRUCT;
+
+typedef union {
+ struct {
+ U32 ARM_bits_packet : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_ARM_S1L_STRUCT;
+
+typedef union {
+ struct {
+ U32 ARM_bits_packet : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_ARM_S1H_STRUCT;
+
+typedef union {
+ struct {
+ U32 Mask_bits : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_MASK_S1L_STRUCT;
+
+typedef union {
+ struct {
+ U32 Mask_bits : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_MASK_S1H_STRUCT;
+
+typedef union {
+ struct {
+ U32 ARM_bits_packet : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_ARM_S2L_STRUCT;
+
+typedef union {
+ struct {
+ U32 ARM_bits_packet : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_ARM_S2H_STRUCT;
+
+typedef union {
+ struct {
+ U32 Mask_bits : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_MASK_S2L_STRUCT;
+
+typedef union {
+ struct {
+ U32 Mask_bits : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_MASK_S2H_STRUCT;
+
+typedef union {
+ struct {
+ U32 ARM_bits_packet : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_ARM_S3L_STRUCT;
+
+typedef union {
+ struct {
+ U32 ARM_bits_packet : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_ARM_S3H_STRUCT;
+
+typedef union {
+ struct {
+ U32 Mask_bits : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_MASK_S3L_STRUCT;
+
+typedef union {
+ struct {
+ U32 Mask_bits : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_MASK_S3H_STRUCT;
+
+typedef union {
+ struct {
+ U32 ARM_bits_packet : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_ARM_S4L_STRUCT;
+
+typedef union {
+ struct {
+ U32 ARM_bits_packet : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_ARM_S4H_STRUCT;
+
+typedef union {
+ struct {
+ U32 Mask_bits : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_MASK_S4L_STRUCT;
+
+typedef union {
+ struct {
+ U32 Mask_bits : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_MASK_S4H_STRUCT;
+
+typedef union {
+ struct {
+ U32 ARM_bits_packet : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_ARM_S5L_STRUCT;
+
+typedef union {
+ struct {
+ U32 ARM_bits_packet : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_ARM_S5H_STRUCT;
+
+typedef union {
+ struct {
+ U32 Mask_bits : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_MASK_S5L_STRUCT;
+
+typedef union {
+ struct {
+ U32 Mask_bits : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_MASK_S5H_STRUCT;
+
+typedef union {
+ struct {
+ U32 ARM_bits_packet : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_ARM_S6L_STRUCT;
+
+typedef union {
+ struct {
+ U32 ARM_bits_packet : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_ARM_S6H_STRUCT;
+
+typedef union {
+ struct {
+ U32 Mask_bits : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_MASK_S6L_STRUCT;
+
+typedef union {
+ struct {
+ U32 Mask_bits : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_MASK_S6H_STRUCT;
+
+typedef union {
+ struct {
+ U32 ARM_bits_packet : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_ARM_S7L_STRUCT;
+
+typedef union {
+ struct {
+ U32 ARM_bits_packet : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_ARM_S7H_STRUCT;
+
+typedef union {
+ struct {
+ U32 Mask_bits : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_MASK_S7L_STRUCT;
+
+typedef union {
+ struct {
+ U32 Mask_bits : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_MASK_S7H_STRUCT;
+
+typedef union {
+ struct {
+ U32 UX_TMR_BASE_A : 1; // Bits 0:0
+ U32 UX_TMR_BASE_B : 1; // Bits 1:1
+ U32 OVF_ARM_IDI : 1; // Bits 2:2
+ U32 OVF_ARM_HIGH : 5; // Bits 7:3
+ U32 OVF_Mask_HIGH : 5; // Bits 12:8
+ U32 : 5; // Bits 17:13
+ U32 TimerA_units : 3; // Bits 20:18
+ U32 TimerB_units : 3; // Bits 23:21
+ U32 Which_Time_Base : 4; // Bits 27:24
+ U32 Tmr_Or_Cntr_Mode : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_CMD_STRUCT;
+
+typedef union {
+ struct {
+ U32 EN_SW_G_ODLAT : 1; // Bits 0:0
+ U32 : 7; // Bits 7:1
+ U32 EN_S0 : 1; // Bits 8:8
+ U32 EN_S1 : 1; // Bits 9:9
+ U32 EN_S2 : 1; // Bits 10:10
+ U32 EN_S3 : 1; // Bits 11:11
+ U32 EN_S4 : 1; // Bits 12:12
+ U32 EN_S5 : 1; // Bits 13:13
+ U32 EN_S6 : 1; // Bits 14:14
+ U32 EN_S7 : 1; // Bits 15:15
+ U32 MBP_Enable : 1; // Bits 16:16
+ U32 : 15; // Bits 31:17
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_SW_ENABLE_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pulse_or_Sticky_Events : 8; // Bits 7:0
+ U32 Pulse_or_Sticky_MBP : 1; // Bits 8:8
+ U32 Pulse_or_Sticky_TO : 4; // Bits 12:9
+ U32 OVF_ARM_LOW : 3; // Bits 15:13
+ U32 OVF_MASK_LOW : 3; // Bits 18:16
+ U32 Which_MBP_Pin_A : 3; // Bits 21:19
+ U32 Which_MBP_Pin_B : 3; // Bits 24:22
+ U32 Which_MBP_Pin_C : 3; // Bits 27:25
+ U32 Which_MBP_Pin_D : 3; // Bits 30:28
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_MISC_CMD_STRUCT;
+
+typedef union {
+ struct {
+ U32 Ln0Mask : 8; // Bits 7:0
+ U32 Ln1Mask : 8; // Bits 15:8
+ U32 AssertMode : 1; // Bits 16:16
+ U32 CompEn : 1; // Bits 17:17
+ U32 GT_VISA_En : 1; // Bits 18:18
+ U32 : 13; // Bits 31:19
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GDXC_CR_GT_VISA2OCLA_CFG_FILTER_STRUCT;
+
+typedef union {
+ struct {
+ U32 Man_Reset_GDXC : 1; // Bits 0:0
+ U32 Man_Reset_G_ODLAT : 1; // Bits 1:1
+ U32 IOT_Start : 1; // Bits 2:2
+ U32 IOT_Stop : 1; // Bits 3:3
+ U32 IOT_Trigger : 1; // Bits 4:4
+ U32 IOT_Force_Flush : 1; // Bits 5:5
+ U32 : 10; // Bits 15:6
+ U32 SPARE : 8; // Bits 23:16
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GDXC_CR_GDXC_MAN_CONFIG_STRUCT;
+
+typedef union {
+ struct {
+ U32 mbpout : 2; // Bits 1:0
+ U32 : 30; // Bits 31:2
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GDXC_CR_GDXC_ALIGN_STRUCT;
+
+typedef union {
+ struct {
+ U32 AD : 6; // Bits 5:0
+ U32 BLHDR0 : 7; // Bits 12:6
+ U32 BLHDR1ADDR : 6; // Bits 18:13
+ U32 AK : 6; // Bits 24:19
+ U32 IV : 2; // Bits 26:25
+ U32 Wrap : 3; // Bits 29:27
+ U32 MOT : 5; // Bits 34:30
+ U32 IDI : 5; // Bits 39:35
+ U32 FClk : 5; // Bits 44:40
+ U32 UClkMsgCh : 5; // Bits 49:45
+ U32 : 14; // Bits 63:50
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} GDXC_CR_GDXC_RR_ARB_THRESH_STRUCT;
+
+typedef union {
+ struct {
+ U32 Start_Status : 1; // Bits 0:0
+ U32 Trigger_Status : 1; // Bits 1:1
+ U32 Stop_Status : 1; // Bits 2:2
+ U32 Muliple_Hit : 1; // Bits 3:3
+ U32 Bubbles_Status : 6; // Bits 9:4
+ U32 : 22; // Bits 31:10
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GDXC_CR_G_ODLAT_FIRE_STATUS_STRUCT;
+
+typedef union {
+ struct {
+ U32 Delay_count : 25; // Bits 24:0
+ U32 : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GDXC_CR_TRIGGER_TO_STOP_DELAY_STRUCT;
+
+typedef union {
+ struct {
+ U32 Disabled : 1; // Bits 0:0
+ U32 Idle : 1; // Bits 1:1
+ U32 Running : 1; // Bits 2:2
+ U32 IOT_Triggered : 1; // Bits 3:3
+ U32 Sticky_triggered : 1; // Bits 4:4
+ U32 : 1; // Bits 5:5
+ U32 Remaining_count : 25; // Bits 30:6
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GDXC_CR_IOT_STATUS_STRUCT;
+
+typedef union {
+ struct {
+ U32 S0_OclaHdr : 8; // Bits 7:0
+ U32 S1_OclaHdr : 8; // Bits 15:8
+ U32 S2_OclaHdr : 8; // Bits 23:16
+ U32 S3_OclaHdr : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_OCLAHDR_S0TO3_STRUCT;
+
+typedef union {
+ struct {
+ U32 S4_OclaHdr : 8; // Bits 7:0
+ U32 S5_OclaHdr : 8; // Bits 15:8
+ U32 S6_OclaHdr : 8; // Bits 23:16
+ U32 S7_OclaHdr : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_OCLAHDR_S4TO7_STRUCT;
+
+typedef union {
+ struct {
+ U32 S0_FST : 2; // Bits 1:0
+ U32 S1_FST : 2; // Bits 3:2
+ U32 S2_FST : 2; // Bits 5:4
+ U32 S3_FST : 2; // Bits 7:6
+ U32 S4_FST : 2; // Bits 9:8
+ U32 S5_FST : 2; // Bits 11:10
+ U32 S6_FST : 2; // Bits 13:12
+ U32 S7_FST : 2; // Bits 15:14
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_FST_STRUCT;
+
+typedef union {
+ struct {
+ U32 Arm : 8; // Bits 7:0
+ U32 MBP_Arm : 1; // Bits 8:8
+ U32 TO_Arm : 4; // Bits 12:9
+ U32 : 3; // Bits 15:13
+ U32 Mask : 8; // Bits 23:16
+ U32 MBP_Mask : 1; // Bits 24:24
+ U32 TO_Mask : 4; // Bits 28:25
+ U32 : 3; // Bits 31:29
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Arm : 8; // Bits 7:0
+ U32 MBP_Arm : 1; // Bits 8:8
+ U32 TO_Arm : 4; // Bits 12:9
+ U32 : 3; // Bits 15:13
+ U32 Mask : 8; // Bits 23:16
+ U32 MBP_Mask : 1; // Bits 24:24
+ U32 TO_Mask : 4; // Bits 28:25
+ U32 : 3; // Bits 31:29
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Arm : 8; // Bits 7:0
+ U32 MBP_Arm : 1; // Bits 8:8
+ U32 TO_Arm : 4; // Bits 12:9
+ U32 : 3; // Bits 15:13
+ U32 Mask : 8; // Bits 23:16
+ U32 MBP_Mask : 1; // Bits 24:24
+ U32 TO_Mask : 4; // Bits 28:25
+ U32 : 3; // Bits 31:29
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Arm : 8; // Bits 7:0
+ U32 MBP_Arm : 1; // Bits 8:8
+ U32 TO_Arm : 4; // Bits 12:9
+ U32 : 3; // Bits 15:13
+ U32 Mask : 8; // Bits 23:16
+ U32 MBP_Mask : 1; // Bits 24:24
+ U32 TO_Mask : 4; // Bits 28:25
+ U32 : 3; // Bits 31:29
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Arm : 8; // Bits 7:0
+ U32 MBP_Arm : 1; // Bits 8:8
+ U32 TO_Arm : 4; // Bits 12:9
+ U32 : 3; // Bits 15:13
+ U32 Mask : 8; // Bits 23:16
+ U32 MBP_Mask : 1; // Bits 24:24
+ U32 TO_Mask : 4; // Bits 28:25
+ U32 : 3; // Bits 31:29
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B4_STRUCT;
+
+typedef union {
+ struct {
+ U32 Arm : 8; // Bits 7:0
+ U32 MBP_Arm : 1; // Bits 8:8
+ U32 TO_Arm : 4; // Bits 12:9
+ U32 : 3; // Bits 15:13
+ U32 Mask : 8; // Bits 23:16
+ U32 MBP_Mask : 1; // Bits 24:24
+ U32 TO_Mask : 4; // Bits 28:25
+ U32 : 3; // Bits 31:29
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B5_STRUCT;
+
+typedef union {
+ struct {
+ U32 Arm : 8; // Bits 7:0
+ U32 MBP_Arm : 1; // Bits 8:8
+ U32 TO_Arm : 4; // Bits 12:9
+ U32 Stop : 1; // Bits 13:13
+ U32 : 2; // Bits 15:14
+ U32 Mask : 8; // Bits 23:16
+ U32 MBP_Mask : 1; // Bits 24:24
+ U32 TO_Mask : 4; // Bits 28:25
+ U32 Col_Rst : 1; // Bits 29:29
+ U32 Trigger : 1; // Bits 30:30
+ U32 Start : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Arm : 8; // Bits 7:0
+ U32 MBP_Arm : 1; // Bits 8:8
+ U32 TO_Arm : 4; // Bits 12:9
+ U32 : 3; // Bits 15:13
+ U32 Mask : 8; // Bits 23:16
+ U32 MBP_Mask : 1; // Bits 24:24
+ U32 TO_Mask : 4; // Bits 28:25
+ U32 : 3; // Bits 31:29
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Arm : 8; // Bits 7:0
+ U32 MBP_Arm : 1; // Bits 8:8
+ U32 TO_Arm : 4; // Bits 12:9
+ U32 : 3; // Bits 15:13
+ U32 Mask : 8; // Bits 23:16
+ U32 MBP_Mask : 1; // Bits 24:24
+ U32 TO_Mask : 4; // Bits 28:25
+ U32 : 3; // Bits 31:29
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Arm : 8; // Bits 7:0
+ U32 MBP_Arm : 1; // Bits 8:8
+ U32 TO_Arm : 4; // Bits 12:9
+ U32 : 3; // Bits 15:13
+ U32 Mask : 8; // Bits 23:16
+ U32 MBP_Mask : 1; // Bits 24:24
+ U32 TO_Mask : 4; // Bits 28:25
+ U32 : 3; // Bits 31:29
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Arm : 8; // Bits 7:0
+ U32 MBP_Arm : 1; // Bits 8:8
+ U32 TO_Arm : 4; // Bits 12:9
+ U32 : 3; // Bits 15:13
+ U32 Mask : 8; // Bits 23:16
+ U32 MBP_Mask : 1; // Bits 24:24
+ U32 TO_Mask : 4; // Bits 28:25
+ U32 : 3; // Bits 31:29
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Arm : 8; // Bits 7:0
+ U32 MBP_Arm : 1; // Bits 8:8
+ U32 TO_Arm : 4; // Bits 12:9
+ U32 : 3; // Bits 15:13
+ U32 Mask : 8; // Bits 23:16
+ U32 MBP_Mask : 1; // Bits 24:24
+ U32 TO_Mask : 4; // Bits 28:25
+ U32 : 3; // Bits 31:29
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B4_STRUCT;
+
+typedef union {
+ struct {
+ U32 Arm : 8; // Bits 7:0
+ U32 MBP_Arm : 1; // Bits 8:8
+ U32 TO_Arm : 4; // Bits 12:9
+ U32 : 3; // Bits 15:13
+ U32 Mask : 8; // Bits 23:16
+ U32 MBP_Mask : 1; // Bits 24:24
+ U32 TO_Mask : 4; // Bits 28:25
+ U32 : 3; // Bits 31:29
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B5_STRUCT;
+
+typedef union {
+ struct {
+ U32 Arm : 8; // Bits 7:0
+ U32 MBP_Arm : 1; // Bits 8:8
+ U32 TO_Arm : 4; // Bits 12:9
+ U32 Stop : 1; // Bits 13:13
+ U32 : 2; // Bits 15:14
+ U32 Mask : 8; // Bits 23:16
+ U32 MBP_Mask : 1; // Bits 24:24
+ U32 TO_Mask : 4; // Bits 28:25
+ U32 Col_Rst : 1; // Bits 29:29
+ U32 Trigger : 1; // Bits 30:30
+ U32 Start : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B1_STRUCT;
+
+typedef union {
+ struct {
+ U32 B0_Set : 6; // Bits 5:0
+ U32 B0_Rst : 6; // Bits 11:6
+ U32 B1_Set : 6; // Bits 17:12
+ U32 B1_Rst : 6; // Bits 23:18
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_TR_IF_MODE_B0_B1_STRUCT;
+
+typedef union {
+ struct {
+ U32 B2_Set : 6; // Bits 5:0
+ U32 B2_Rst : 6; // Bits 11:6
+ U32 B3_Set : 6; // Bits 17:12
+ U32 B3_Rst : 6; // Bits 23:18
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_TR_IF_MODE_B2_B3_STRUCT;
+
+typedef union {
+ struct {
+ U32 B4_Set : 6; // Bits 5:0
+ U32 B4_Rst : 6; // Bits 11:6
+ U32 B5_Set : 6; // Bits 17:12
+ U32 B5_Rst : 6; // Bits 23:18
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_TR_IF_MODE_B4_B5_STRUCT;
+
+typedef union {
+ struct {
+ U32 ElseIf_ElseIf_B0_Set : 6; // Bits 5:0
+ U32 ElseIf_ElseIf_B0_Rst : 6; // Bits 11:6
+ U32 : 20; // Bits 31:12
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_TR_IF_MODE_B6_B7_STRUCT;
+
+typedef union {
+ struct {
+ U32 B0_Set : 6; // Bits 5:0
+ U32 B0_Rst : 6; // Bits 11:6
+ U32 B1_Set : 6; // Bits 17:12
+ U32 B1_Rst : 6; // Bits 23:18
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B0_B1_STRUCT;
+
+typedef union {
+ struct {
+ U32 B2_Set : 6; // Bits 5:0
+ U32 B2_Rst : 6; // Bits 11:6
+ U32 B3_Set : 6; // Bits 17:12
+ U32 B3_Rst : 6; // Bits 23:18
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B2_B3_STRUCT;
+
+typedef union {
+ struct {
+ U32 B4_Set : 6; // Bits 5:0
+ U32 B4_Rst : 6; // Bits 11:6
+ U32 B5_Set : 6; // Bits 17:12
+ U32 B5_Rst : 6; // Bits 23:18
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B4_B5_STRUCT;
+
+typedef union {
+ struct {
+ U32 ElseIf_ElseIf_B1_Set : 6; // Bits 5:0
+ U32 ElseIf_ElseIf_B1_Rst : 6; // Bits 11:6
+ U32 : 20; // Bits 31:12
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B6_B7_STRUCT;
+
+typedef union {
+ struct {
+ U32 Init_Bits : 6; // Bits 5:0
+ U32 : 26; // Bits 31:6
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_INIT_BUBBLES_STRUCT;
+
+typedef union {
+ struct {
+ U32 ColRst : 6; // Bits 5:0
+ U32 Start : 6; // Bits 11:6
+ U32 Trigger : 6; // Bits 17:12
+ U32 Stop : 6; // Bits 23:18
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_TR_IF_MODE_MISC_STRUCT;
+
+typedef union {
+ struct {
+ U32 ColRst : 6; // Bits 5:0
+ U32 Start : 6; // Bits 11:6
+ U32 Trigger : 6; // Bits 17:12
+ U32 Stop : 6; // Bits 23:18
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_MISC_STRUCT;
+
+typedef union {
+ struct {
+ U32 B0_EN : 4; // Bits 3:0
+ U32 B1_EN : 4; // Bits 7:4
+ U32 B2_EN : 4; // Bits 11:8
+ U32 B3_EN : 4; // Bits 15:12
+ U32 B4_EN : 4; // Bits 19:16
+ U32 B5_EN : 4; // Bits 23:20
+ U32 ELSEIF_ELSEIF_B0_EN : 4; // Bits 27:24
+ U32 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_TR_IF_MODE_TMREN_STRUCT;
+
+typedef union {
+ struct {
+ U32 B0_EN : 4; // Bits 3:0
+ U32 B1_EN : 4; // Bits 7:4
+ U32 B2_EN : 4; // Bits 11:8
+ U32 B3_EN : 4; // Bits 15:12
+ U32 B4_EN : 4; // Bits 19:16
+ U32 B5_EN : 4; // Bits 23:20
+ U32 ELSEIF_ELSEIF_B1_EN : 4; // Bits 27:24
+ U32 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMREN_STRUCT;
+
+typedef union {
+ struct {
+ U32 Timer0_load : 5; // Bits 4:0
+ U32 Timer1_load : 5; // Bits 9:5
+ U32 Timer2_load : 5; // Bits 14:10
+ U32 Timer3_load : 16; // Bits 30:15
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_TIMER_PRELOAD_STRUCT;
+
+typedef union {
+ struct {
+ U32 MOT_PKT : 8; // Bits 7:0
+ U32 : 24; // Bits 31:8
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_MOT_HDR_HIT_STRUCT;
+
+typedef union {
+ struct {
+ U32 B0_RST : 4; // Bits 3:0
+ U32 B1_RST : 4; // Bits 7:4
+ U32 B2_RST : 4; // Bits 11:8
+ U32 B3_RST : 4; // Bits 15:12
+ U32 B4_RST : 4; // Bits 19:16
+ U32 B5_RST : 4; // Bits 23:20
+ U32 ELSEIF_ELSEIF_B0_RST : 4; // Bits 27:24
+ U32 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_TR_IF_MODE_TMRRST_STRUCT;
+
+typedef union {
+ struct {
+ U32 B0_RST : 4; // Bits 3:0
+ U32 B1_RST : 4; // Bits 7:4
+ U32 B2_RST : 4; // Bits 11:8
+ U32 B3_RST : 4; // Bits 15:12
+ U32 B4_RST : 4; // Bits 19:16
+ U32 B5_RST : 4; // Bits 23:20
+ U32 ELSEIF_ELSEIF_B1_RST : 4; // Bits 27:24
+ U32 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMRRST_STRUCT;
+
+typedef union {
+ struct {
+ U32 SPARE : 8; // Bits 7:0
+ U32 : 24; // Bits 31:8
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} GDXC_CR_DEBUP_STRUCT;
+
+typedef union {
+ struct {
+ U32 Ln0Src : 2; // Bits 1:0
+ U32 Ln1Src : 2; // Bits 3:2
+ U32 DEVisaEn : 1; // Bits 4:4
+ U32 : 27; // Bits 31:5
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MSGUTILS_CR_VISA2OCLA_CFG_STRUCT;
+
+#define DDRPL_CR_DDR_TX_DELAY_REG (0x00000C04)
+ #define DDRPL_CR_DDR_TX_DELAY_Tx_Delay_R0_OFF ( 0)
+ #define DDRPL_CR_DDR_TX_DELAY_Tx_Delay_R0_WID ( 8)
+ #define DDRPL_CR_DDR_TX_DELAY_Tx_Delay_R0_MSK (0x000000FF)
+ #define DDRPL_CR_DDR_TX_DELAY_Tx_Delay_R0_MAX (0x000000FF)
+ #define DDRPL_CR_DDR_TX_DELAY_Tx_Delay_R0_DEF (0x00000010)
+ #define DDRPL_CR_DDR_TX_DELAY_Tx_Delay_R1_OFF ( 8)
+ #define DDRPL_CR_DDR_TX_DELAY_Tx_Delay_R1_WID ( 8)
+ #define DDRPL_CR_DDR_TX_DELAY_Tx_Delay_R1_MSK (0x0000FF00)
+ #define DDRPL_CR_DDR_TX_DELAY_Tx_Delay_R1_MAX (0x000000FF)
+ #define DDRPL_CR_DDR_TX_DELAY_Tx_Delay_R1_DEF (0x00000010)
+ #define DDRPL_CR_DDR_TX_DELAY_Tx_Delay_R2_OFF (16)
+ #define DDRPL_CR_DDR_TX_DELAY_Tx_Delay_R2_WID ( 8)
+ #define DDRPL_CR_DDR_TX_DELAY_Tx_Delay_R2_MSK (0x00FF0000)
+ #define DDRPL_CR_DDR_TX_DELAY_Tx_Delay_R2_MAX (0x000000FF)
+ #define DDRPL_CR_DDR_TX_DELAY_Tx_Delay_R2_DEF (0x00000010)
+ #define DDRPL_CR_DDR_TX_DELAY_Tx_Delay_R3_OFF (24)
+ #define DDRPL_CR_DDR_TX_DELAY_Tx_Delay_R3_WID ( 8)
+ #define DDRPL_CR_DDR_TX_DELAY_Tx_Delay_R3_MSK (0xFF000000)
+ #define DDRPL_CR_DDR_TX_DELAY_Tx_Delay_R3_MAX (0x000000FF)
+ #define DDRPL_CR_DDR_TX_DELAY_Tx_Delay_R3_DEF (0x00000010)
+
+#define MPCOHTRK_CR_GDXC_SW_ENABLE_REG (0x00000000)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_EN_SW_GDXC_OFF ( 0)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_EN_SW_GDXC_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_EN_SW_GDXC_MSK (0x00000001)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_EN_SW_GDXC_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_EN_SW_GDXC_DEF (0x00000000)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_EN_RING_ADQ_OFF ( 1)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_EN_RING_ADQ_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_EN_RING_ADQ_MSK (0x00000002)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_EN_RING_ADQ_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_EN_RING_ADQ_DEF (0x00000001)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_EN_RING_BLQ_OFF ( 2)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_EN_RING_BLQ_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_EN_RING_BLQ_MSK (0x00000004)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_EN_RING_BLQ_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_EN_RING_BLQ_DEF (0x00000001)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_EN_RING_AKQ_OFF ( 3)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_EN_RING_AKQ_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_EN_RING_AKQ_MSK (0x00000008)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_EN_RING_AKQ_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_EN_RING_AKQ_DEF (0x00000001)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_EN_RING_IVQ_OFF ( 4)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_EN_RING_IVQ_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_EN_RING_IVQ_MSK (0x00000010)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_EN_RING_IVQ_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_EN_RING_IVQ_DEF (0x00000001)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_EN_IDIQ_OFF ( 5)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_EN_IDIQ_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_EN_IDIQ_MSK (0x00000020)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_EN_IDIQ_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_EN_IDIQ_DEF (0x00000000)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_EN_mc_UCLKQ_OFF ( 6)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_EN_mc_UCLKQ_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_EN_mc_UCLKQ_MSK (0x00000040)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_EN_mc_UCLKQ_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_EN_mc_UCLKQ_DEF (0x00000001)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_UP_EN_ADQ_OFF ( 8)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_UP_EN_ADQ_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_UP_EN_ADQ_MSK (0x00000100)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_UP_EN_ADQ_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_UP_EN_ADQ_DEF (0x00000001)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_DN_EN_ADQ_OFF ( 9)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_DN_EN_ADQ_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_DN_EN_ADQ_MSK (0x00000200)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_DN_EN_ADQ_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_DN_EN_ADQ_DEF (0x00000001)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_UP_EN_BLQ_OFF (10)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_UP_EN_BLQ_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_UP_EN_BLQ_MSK (0x00000400)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_UP_EN_BLQ_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_UP_EN_BLQ_DEF (0x00000001)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_DN_EN_BLQ_OFF (11)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_DN_EN_BLQ_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_DN_EN_BLQ_MSK (0x00000800)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_DN_EN_BLQ_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_DN_EN_BLQ_DEF (0x00000001)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_UP_EN_AKQ_OFF (12)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_UP_EN_AKQ_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_UP_EN_AKQ_MSK (0x00001000)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_UP_EN_AKQ_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_UP_EN_AKQ_DEF (0x00000001)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_DN_EN_AKQ_OFF (13)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_DN_EN_AKQ_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_DN_EN_AKQ_MSK (0x00002000)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_DN_EN_AKQ_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_DN_EN_AKQ_DEF (0x00000001)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_MOTQ_TIMING_SELECT_OFF (14)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_MOTQ_TIMING_SELECT_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_MOTQ_TIMING_SELECT_MSK (0x00004000)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_MOTQ_TIMING_SELECT_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_MOTQ_TIMING_SELECT_DEF (0x00000000)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_SPARE_OFF (16)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_SPARE_WID ( 8)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_SPARE_MSK (0x00FF0000)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_SPARE_MAX (0x000000FF)
+ #define MPCOHTRK_CR_GDXC_SW_ENABLE_SPARE_DEF (0x00000000)
+
+#define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_REG (0x00000004)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_Core0_T0_OFF ( 0)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_Core0_T0_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_Core0_T0_MSK (0x00000001)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_Core0_T0_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_Core0_T0_DEF (0x00000001)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_Core0_T1_OFF ( 1)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_Core0_T1_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_Core0_T1_MSK (0x00000002)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_Core0_T1_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_Core0_T1_DEF (0x00000001)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_Core1_T0_OFF ( 2)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_Core1_T0_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_Core1_T0_MSK (0x00000004)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_Core1_T0_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_Core1_T0_DEF (0x00000001)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_Core1_T1_OFF ( 3)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_Core1_T1_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_Core1_T1_MSK (0x00000008)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_Core1_T1_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_Core1_T1_DEF (0x00000001)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_Core2_T0_OFF ( 4)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_Core2_T0_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_Core2_T0_MSK (0x00000010)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_Core2_T0_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_Core2_T0_DEF (0x00000001)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_Core2_T1_OFF ( 5)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_Core2_T1_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_Core2_T1_MSK (0x00000020)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_Core2_T1_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_Core2_T1_DEF (0x00000001)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_Core3_T0_OFF ( 6)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_Core3_T0_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_Core3_T0_MSK (0x00000040)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_Core3_T0_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_Core3_T0_DEF (0x00000001)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_Core3_T1_OFF ( 7)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_Core3_T1_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_Core3_T1_MSK (0x00000080)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_Core3_T1_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_Core3_T1_DEF (0x00000001)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_GT_OFF ( 8)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_GT_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_GT_MSK (0x00000100)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_GT_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_GT_DEF (0x00000000)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_MEM_CHR_RD_OFF ( 9)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_MEM_CHR_RD_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_MEM_CHR_RD_MSK (0x00000200)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_MEM_CHR_RD_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_MEM_CHR_RD_DEF (0x00000001)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_MEM_CHR_WR_OFF (10)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_MEM_CHR_WR_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_MEM_CHR_WR_MSK (0x00000400)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_MEM_CHR_WR_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_MEM_CHR_WR_DEF (0x00000001)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_MEM_NC_OFF (11)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_MEM_NC_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_MEM_NC_MSK (0x00000800)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_MEM_NC_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_MEM_NC_DEF (0x00000001)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_CBO_Exp_WB_OFF (12)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_CBO_Exp_WB_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_CBO_Exp_WB_MSK (0x00001000)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_CBO_Exp_WB_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_EN_CBO_Exp_WB_DEF (0x00000000)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_SNP_Access_OFF (13)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_SNP_Access_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_SNP_Access_MSK (0x00002000)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_SNP_Access_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_SNP_Access_DEF (0x00000001)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_AD_EODLAT_OFF (14)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_AD_EODLAT_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_AD_EODLAT_MSK (0x00004000)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_AD_EODLAT_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_GLOBAL_AD_EODLAT_DEF (0x00000001)
+
+#define MPCOHTRK_CR_GDXC_QUALIFIER_BL_REG (0x00000008)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_CR_CHR_RD_OFF ( 0)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_CR_CHR_RD_WID ( 3)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_CR_CHR_RD_MSK (0x00000007)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_CR_CHR_RD_MAX (0x00000007)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_CR_CHR_RD_DEF (0x00000000)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_CHR_RD_STAT_MOD_OFF ( 3)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_CHR_RD_STAT_MOD_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_CHR_RD_STAT_MOD_MSK (0x00000008)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_CHR_RD_STAT_MOD_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_CHR_RD_STAT_MOD_DEF (0x00000001)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_CR_CHR_WR_OFF ( 4)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_CR_CHR_WR_WID ( 4)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_CR_CHR_WR_MSK (0x000000F0)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_CR_CHR_WR_MAX (0x0000000F)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_CR_CHR_WR_DEF (0x00000000)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_CR_NC_RD_OFF ( 8)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_CR_NC_RD_WID ( 3)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_CR_NC_RD_MSK (0x00000700)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_CR_NC_RD_MAX (0x00000007)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_CR_NC_RD_DEF (0x00000000)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_NC_RD_STAT_MOD_OFF (11)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_NC_RD_STAT_MOD_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_NC_RD_STAT_MOD_MSK (0x00000800)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_NC_RD_STAT_MOD_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_NC_RD_STAT_MOD_DEF (0x00000001)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_CR_NC_WR_OFF (12)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_CR_NC_WR_WID ( 4)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_CR_NC_WR_MSK (0x0000F000)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_CR_NC_WR_MAX (0x0000000F)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_CR_NC_WR_DEF (0x00000000)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_NC_WR_STAT_MOD_OFF (16)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_NC_WR_STAT_MOD_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_NC_WR_STAT_MOD_MSK (0x00010000)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_NC_WR_STAT_MOD_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_NC_WR_STAT_MOD_DEF (0x00000001)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_Data_Core0_OFF (17)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_Data_Core0_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_Data_Core0_MSK (0x00020000)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_Data_Core0_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_Data_Core0_DEF (0x00000000)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_Data_Core1_OFF (18)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_Data_Core1_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_Data_Core1_MSK (0x00040000)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_Data_Core1_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_Data_Core1_DEF (0x00000000)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_Data_Core2_OFF (19)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_Data_Core2_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_Data_Core2_MSK (0x00080000)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_Data_Core2_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_Data_Core2_DEF (0x00000000)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_Data_Core3_OFF (20)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_Data_Core3_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_Data_Core3_MSK (0x00100000)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_Data_Core3_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_Data_Core3_DEF (0x00000000)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_Data_CBO_OFF (21)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_Data_CBO_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_Data_CBO_MSK (0x00200000)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_Data_CBO_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_Data_CBO_DEF (0x00000000)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_Data_GT_OFF (22)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_Data_GT_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_Data_GT_MSK (0x00400000)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_Data_GT_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_QUALIFIER_BL_Data_GT_DEF (0x00000000)
+
+#define MPCOHTRK_CR_GDXC_OVF_STATUS_REG (0x0000000C)
+ #define MPCOHTRK_CR_GDXC_OVF_STATUS_OVF_Global_OFF ( 0)
+ #define MPCOHTRK_CR_GDXC_OVF_STATUS_OVF_Global_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_OVF_STATUS_OVF_Global_MSK (0x00000001)
+ #define MPCOHTRK_CR_GDXC_OVF_STATUS_OVF_Global_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_OVF_STATUS_OVF_Global_DEF (0x00000000)
+ #define MPCOHTRK_CR_GDXC_OVF_STATUS_OVF_Ring_AD_OFF ( 1)
+ #define MPCOHTRK_CR_GDXC_OVF_STATUS_OVF_Ring_AD_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_OVF_STATUS_OVF_Ring_AD_MSK (0x00000002)
+ #define MPCOHTRK_CR_GDXC_OVF_STATUS_OVF_Ring_AD_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_OVF_STATUS_OVF_Ring_AD_DEF (0x00000000)
+ #define MPCOHTRK_CR_GDXC_OVF_STATUS_OVF_Ring_BL_OFF ( 2)
+ #define MPCOHTRK_CR_GDXC_OVF_STATUS_OVF_Ring_BL_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_OVF_STATUS_OVF_Ring_BL_MSK (0x00000004)
+ #define MPCOHTRK_CR_GDXC_OVF_STATUS_OVF_Ring_BL_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_OVF_STATUS_OVF_Ring_BL_DEF (0x00000000)
+ #define MPCOHTRK_CR_GDXC_OVF_STATUS_OVF_Ring_AK_OFF ( 3)
+ #define MPCOHTRK_CR_GDXC_OVF_STATUS_OVF_Ring_AK_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_OVF_STATUS_OVF_Ring_AK_MSK (0x00000008)
+ #define MPCOHTRK_CR_GDXC_OVF_STATUS_OVF_Ring_AK_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_OVF_STATUS_OVF_Ring_AK_DEF (0x00000000)
+ #define MPCOHTRK_CR_GDXC_OVF_STATUS_OVF_Ring_IV_OFF ( 4)
+ #define MPCOHTRK_CR_GDXC_OVF_STATUS_OVF_Ring_IV_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_OVF_STATUS_OVF_Ring_IV_MSK (0x00000010)
+ #define MPCOHTRK_CR_GDXC_OVF_STATUS_OVF_Ring_IV_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_OVF_STATUS_OVF_Ring_IV_DEF (0x00000000)
+ #define MPCOHTRK_CR_GDXC_OVF_STATUS_OVF_IDI_center_OFF ( 9)
+ #define MPCOHTRK_CR_GDXC_OVF_STATUS_OVF_IDI_center_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_OVF_STATUS_OVF_IDI_center_MSK (0x00000200)
+ #define MPCOHTRK_CR_GDXC_OVF_STATUS_OVF_IDI_center_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_OVF_STATUS_OVF_IDI_center_DEF (0x00000000)
+ #define MPCOHTRK_CR_GDXC_OVF_STATUS_OVF_mcUCLK_OFF (10)
+ #define MPCOHTRK_CR_GDXC_OVF_STATUS_OVF_mcUCLK_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_OVF_STATUS_OVF_mcUCLK_MSK (0x00000400)
+ #define MPCOHTRK_CR_GDXC_OVF_STATUS_OVF_mcUCLK_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_OVF_STATUS_OVF_mcUCLK_DEF (0x00000000)
+ #define MPCOHTRK_CR_GDXC_OVF_STATUS_OVF_PWR_mcFCLK_OFF (11)
+ #define MPCOHTRK_CR_GDXC_OVF_STATUS_OVF_PWR_mcFCLK_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_OVF_STATUS_OVF_PWR_mcFCLK_MSK (0x00000800)
+ #define MPCOHTRK_CR_GDXC_OVF_STATUS_OVF_PWR_mcFCLK_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_OVF_STATUS_OVF_PWR_mcFCLK_DEF (0x00000000)
+
+#define MPCOHTRK_CR_GDXC_MOT_ADDRESS_LO_REG (0x00000010)
+ #define MPCOHTRK_CR_GDXC_MOT_ADDRESS_LO_MEM_PTR_OFF ( 0)
+ #define MPCOHTRK_CR_GDXC_MOT_ADDRESS_LO_MEM_PTR_WID (32)
+ #define MPCOHTRK_CR_GDXC_MOT_ADDRESS_LO_MEM_PTR_MSK (0xFFFFFFFF)
+ #define MPCOHTRK_CR_GDXC_MOT_ADDRESS_LO_MEM_PTR_MAX (0xFFFFFFFF)
+ #define MPCOHTRK_CR_GDXC_MOT_ADDRESS_LO_MEM_PTR_DEF (0x00000000)
+
+#define MPCOHTRK_CR_GDXC_MOT_ADDRESS_HI_REG (0x00000014)
+ #define MPCOHTRK_CR_GDXC_MOT_ADDRESS_HI_MEM_PTR_OFF ( 0)
+ #define MPCOHTRK_CR_GDXC_MOT_ADDRESS_HI_MEM_PTR_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_MOT_ADDRESS_HI_MEM_PTR_MSK (0x00000001)
+ #define MPCOHTRK_CR_GDXC_MOT_ADDRESS_HI_MEM_PTR_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_MOT_ADDRESS_HI_MEM_PTR_DEF (0x00000000)
+ #define MPCOHTRK_CR_GDXC_MOT_ADDRESS_HI_BUFFER_WRAP_OFF ( 1)
+ #define MPCOHTRK_CR_GDXC_MOT_ADDRESS_HI_BUFFER_WRAP_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_MOT_ADDRESS_HI_BUFFER_WRAP_MSK (0x00000002)
+ #define MPCOHTRK_CR_GDXC_MOT_ADDRESS_HI_BUFFER_WRAP_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_MOT_ADDRESS_HI_BUFFER_WRAP_DEF (0x00000000)
+ #define MPCOHTRK_CR_GDXC_MOT_ADDRESS_HI_SPARE_OFF ( 2)
+ #define MPCOHTRK_CR_GDXC_MOT_ADDRESS_HI_SPARE_WID (30)
+ #define MPCOHTRK_CR_GDXC_MOT_ADDRESS_HI_SPARE_MSK (0xFFFFFFFC)
+ #define MPCOHTRK_CR_GDXC_MOT_ADDRESS_HI_SPARE_MAX (0x3FFFFFFF)
+ #define MPCOHTRK_CR_GDXC_MOT_ADDRESS_HI_SPARE_DEF (0x00000000)
+
+#define MPCOHTRK_CR_GDXC_MOT_REGION_REG (0x00000018)
+ #define MPCOHTRK_CR_GDXC_MOT_REGION_START_ADDRESS_OFF ( 0)
+ #define MPCOHTRK_CR_GDXC_MOT_REGION_START_ADDRESS_WID (16)
+ #define MPCOHTRK_CR_GDXC_MOT_REGION_START_ADDRESS_MSK (0x0000FFFF)
+ #define MPCOHTRK_CR_GDXC_MOT_REGION_START_ADDRESS_MAX (0x0000FFFF)
+ #define MPCOHTRK_CR_GDXC_MOT_REGION_START_ADDRESS_DEF (0x00000000)
+ #define MPCOHTRK_CR_GDXC_MOT_REGION_END_ADDRESS_OFF (16)
+ #define MPCOHTRK_CR_GDXC_MOT_REGION_END_ADDRESS_WID (16)
+ #define MPCOHTRK_CR_GDXC_MOT_REGION_END_ADDRESS_MSK (0xFFFF0000)
+ #define MPCOHTRK_CR_GDXC_MOT_REGION_END_ADDRESS_MAX (0x0000FFFF)
+ #define MPCOHTRK_CR_GDXC_MOT_REGION_END_ADDRESS_DEF (0x00000001)
+
+#define MPCOHTRK_CR_GDXC_OCLA_ADDRESS_LO_REG (0x00000020)
+ #define MPCOHTRK_CR_GDXC_OCLA_ADDRESS_LO_MEM_PTR_OFF ( 0)
+ #define MPCOHTRK_CR_GDXC_OCLA_ADDRESS_LO_MEM_PTR_WID (32)
+ #define MPCOHTRK_CR_GDXC_OCLA_ADDRESS_LO_MEM_PTR_MSK (0xFFFFFFFF)
+ #define MPCOHTRK_CR_GDXC_OCLA_ADDRESS_LO_MEM_PTR_MAX (0xFFFFFFFF)
+ #define MPCOHTRK_CR_GDXC_OCLA_ADDRESS_LO_MEM_PTR_DEF (0x00000000)
+
+#define MPCOHTRK_CR_GDXC_OCLA_ADDRESS_HI_REG (0x00000024)
+ #define MPCOHTRK_CR_GDXC_OCLA_ADDRESS_HI_MEM_PTR_OFF ( 0)
+ #define MPCOHTRK_CR_GDXC_OCLA_ADDRESS_HI_MEM_PTR_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_OCLA_ADDRESS_HI_MEM_PTR_MSK (0x00000001)
+ #define MPCOHTRK_CR_GDXC_OCLA_ADDRESS_HI_MEM_PTR_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_OCLA_ADDRESS_HI_MEM_PTR_DEF (0x00000000)
+ #define MPCOHTRK_CR_GDXC_OCLA_ADDRESS_HI_BUFFER_WRAP_OFF ( 1)
+ #define MPCOHTRK_CR_GDXC_OCLA_ADDRESS_HI_BUFFER_WRAP_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_OCLA_ADDRESS_HI_BUFFER_WRAP_MSK (0x00000002)
+ #define MPCOHTRK_CR_GDXC_OCLA_ADDRESS_HI_BUFFER_WRAP_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_OCLA_ADDRESS_HI_BUFFER_WRAP_DEF (0x00000000)
+ #define MPCOHTRK_CR_GDXC_OCLA_ADDRESS_HI_LOCK_OFF ( 2)
+ #define MPCOHTRK_CR_GDXC_OCLA_ADDRESS_HI_LOCK_WID ( 1)
+ #define MPCOHTRK_CR_GDXC_OCLA_ADDRESS_HI_LOCK_MSK (0x00000004)
+ #define MPCOHTRK_CR_GDXC_OCLA_ADDRESS_HI_LOCK_MAX (0x00000001)
+ #define MPCOHTRK_CR_GDXC_OCLA_ADDRESS_HI_LOCK_DEF (0x00000000)
+ #define MPCOHTRK_CR_GDXC_OCLA_ADDRESS_HI_SPARE_OFF ( 3)
+ #define MPCOHTRK_CR_GDXC_OCLA_ADDRESS_HI_SPARE_WID (29)
+ #define MPCOHTRK_CR_GDXC_OCLA_ADDRESS_HI_SPARE_MSK (0xFFFFFFF8)
+ #define MPCOHTRK_CR_GDXC_OCLA_ADDRESS_HI_SPARE_MAX (0x1FFFFFFF)
+ #define MPCOHTRK_CR_GDXC_OCLA_ADDRESS_HI_SPARE_DEF (0x00000000)
+
+#define MPCOHTRK_CR_GDXC_OCLA_REGION_REG (0x00000028)
+ #define MPCOHTRK_CR_GDXC_OCLA_REGION_START_ADDRESS_OFF ( 0)
+ #define MPCOHTRK_CR_GDXC_OCLA_REGION_START_ADDRESS_WID (16)
+ #define MPCOHTRK_CR_GDXC_OCLA_REGION_START_ADDRESS_MSK (0x0000FFFF)
+ #define MPCOHTRK_CR_GDXC_OCLA_REGION_START_ADDRESS_MAX (0x0000FFFF)
+ #define MPCOHTRK_CR_GDXC_OCLA_REGION_START_ADDRESS_DEF (0x00000000)
+ #define MPCOHTRK_CR_GDXC_OCLA_REGION_END_ADDRESS_OFF (16)
+ #define MPCOHTRK_CR_GDXC_OCLA_REGION_END_ADDRESS_WID (16)
+ #define MPCOHTRK_CR_GDXC_OCLA_REGION_END_ADDRESS_MSK (0xFFFF0000)
+ #define MPCOHTRK_CR_GDXC_OCLA_REGION_END_ADDRESS_MAX (0x0000FFFF)
+ #define MPCOHTRK_CR_GDXC_OCLA_REGION_END_ADDRESS_DEF (0x00000001)
+
+#define GODLAT_CR_G_ODLAT_ARM_S0L_REG (0x00000400)
+ #define GODLAT_CR_G_ODLAT_ARM_S0L_ARM_bits_packet_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_ARM_S0L_ARM_bits_packet_WID (32)
+ #define GODLAT_CR_G_ODLAT_ARM_S0L_ARM_bits_packet_MSK (0xFFFFFFFF)
+ #define GODLAT_CR_G_ODLAT_ARM_S0L_ARM_bits_packet_MAX (0xFFFFFFFF)
+
+#define GODLAT_CR_G_ODLAT_ARM_S0H_REG (0x00000404)
+ #define GODLAT_CR_G_ODLAT_ARM_S0H_ARM_bits_packet_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_ARM_S0H_ARM_bits_packet_WID (32)
+ #define GODLAT_CR_G_ODLAT_ARM_S0H_ARM_bits_packet_MSK (0xFFFFFFFF)
+ #define GODLAT_CR_G_ODLAT_ARM_S0H_ARM_bits_packet_MAX (0xFFFFFFFF)
+
+#define GODLAT_CR_G_ODLAT_MASK_S0L_REG (0x00000408)
+ #define GODLAT_CR_G_ODLAT_MASK_S0L_Mask_bits_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_MASK_S0L_Mask_bits_WID (32)
+ #define GODLAT_CR_G_ODLAT_MASK_S0L_Mask_bits_MSK (0xFFFFFFFF)
+ #define GODLAT_CR_G_ODLAT_MASK_S0L_Mask_bits_MAX (0xFFFFFFFF)
+
+#define GODLAT_CR_G_ODLAT_MASK_S0H_REG (0x0000040C)
+ #define GODLAT_CR_G_ODLAT_MASK_S0H_Mask_bits_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_MASK_S0H_Mask_bits_WID (32)
+ #define GODLAT_CR_G_ODLAT_MASK_S0H_Mask_bits_MSK (0xFFFFFFFF)
+ #define GODLAT_CR_G_ODLAT_MASK_S0H_Mask_bits_MAX (0xFFFFFFFF)
+
+#define GODLAT_CR_G_ODLAT_ARM_S1L_REG (0x00000410)
+ #define GODLAT_CR_G_ODLAT_ARM_S1L_ARM_bits_packet_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_ARM_S1L_ARM_bits_packet_WID (32)
+ #define GODLAT_CR_G_ODLAT_ARM_S1L_ARM_bits_packet_MSK (0xFFFFFFFF)
+ #define GODLAT_CR_G_ODLAT_ARM_S1L_ARM_bits_packet_MAX (0xFFFFFFFF)
+
+#define GODLAT_CR_G_ODLAT_ARM_S1H_REG (0x00000414)
+ #define GODLAT_CR_G_ODLAT_ARM_S1H_ARM_bits_packet_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_ARM_S1H_ARM_bits_packet_WID (32)
+ #define GODLAT_CR_G_ODLAT_ARM_S1H_ARM_bits_packet_MSK (0xFFFFFFFF)
+ #define GODLAT_CR_G_ODLAT_ARM_S1H_ARM_bits_packet_MAX (0xFFFFFFFF)
+
+#define GODLAT_CR_G_ODLAT_MASK_S1L_REG (0x00000418)
+ #define GODLAT_CR_G_ODLAT_MASK_S1L_Mask_bits_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_MASK_S1L_Mask_bits_WID (32)
+ #define GODLAT_CR_G_ODLAT_MASK_S1L_Mask_bits_MSK (0xFFFFFFFF)
+ #define GODLAT_CR_G_ODLAT_MASK_S1L_Mask_bits_MAX (0xFFFFFFFF)
+
+#define GODLAT_CR_G_ODLAT_MASK_S1H_REG (0x0000041C)
+ #define GODLAT_CR_G_ODLAT_MASK_S1H_Mask_bits_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_MASK_S1H_Mask_bits_WID (32)
+ #define GODLAT_CR_G_ODLAT_MASK_S1H_Mask_bits_MSK (0xFFFFFFFF)
+ #define GODLAT_CR_G_ODLAT_MASK_S1H_Mask_bits_MAX (0xFFFFFFFF)
+
+#define GODLAT_CR_G_ODLAT_ARM_S2L_REG (0x00000420)
+ #define GODLAT_CR_G_ODLAT_ARM_S2L_ARM_bits_packet_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_ARM_S2L_ARM_bits_packet_WID (32)
+ #define GODLAT_CR_G_ODLAT_ARM_S2L_ARM_bits_packet_MSK (0xFFFFFFFF)
+ #define GODLAT_CR_G_ODLAT_ARM_S2L_ARM_bits_packet_MAX (0xFFFFFFFF)
+
+#define GODLAT_CR_G_ODLAT_ARM_S2H_REG (0x00000424)
+ #define GODLAT_CR_G_ODLAT_ARM_S2H_ARM_bits_packet_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_ARM_S2H_ARM_bits_packet_WID (32)
+ #define GODLAT_CR_G_ODLAT_ARM_S2H_ARM_bits_packet_MSK (0xFFFFFFFF)
+ #define GODLAT_CR_G_ODLAT_ARM_S2H_ARM_bits_packet_MAX (0xFFFFFFFF)
+
+#define GODLAT_CR_G_ODLAT_MASK_S2L_REG (0x00000428)
+ #define GODLAT_CR_G_ODLAT_MASK_S2L_Mask_bits_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_MASK_S2L_Mask_bits_WID (32)
+ #define GODLAT_CR_G_ODLAT_MASK_S2L_Mask_bits_MSK (0xFFFFFFFF)
+ #define GODLAT_CR_G_ODLAT_MASK_S2L_Mask_bits_MAX (0xFFFFFFFF)
+
+#define GODLAT_CR_G_ODLAT_MASK_S2H_REG (0x0000042C)
+ #define GODLAT_CR_G_ODLAT_MASK_S2H_Mask_bits_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_MASK_S2H_Mask_bits_WID (32)
+ #define GODLAT_CR_G_ODLAT_MASK_S2H_Mask_bits_MSK (0xFFFFFFFF)
+ #define GODLAT_CR_G_ODLAT_MASK_S2H_Mask_bits_MAX (0xFFFFFFFF)
+
+#define GODLAT_CR_G_ODLAT_ARM_S3L_REG (0x00000430)
+ #define GODLAT_CR_G_ODLAT_ARM_S3L_ARM_bits_packet_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_ARM_S3L_ARM_bits_packet_WID (32)
+ #define GODLAT_CR_G_ODLAT_ARM_S3L_ARM_bits_packet_MSK (0xFFFFFFFF)
+ #define GODLAT_CR_G_ODLAT_ARM_S3L_ARM_bits_packet_MAX (0xFFFFFFFF)
+
+#define GODLAT_CR_G_ODLAT_ARM_S3H_REG (0x00000434)
+ #define GODLAT_CR_G_ODLAT_ARM_S3H_ARM_bits_packet_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_ARM_S3H_ARM_bits_packet_WID (32)
+ #define GODLAT_CR_G_ODLAT_ARM_S3H_ARM_bits_packet_MSK (0xFFFFFFFF)
+ #define GODLAT_CR_G_ODLAT_ARM_S3H_ARM_bits_packet_MAX (0xFFFFFFFF)
+
+#define GODLAT_CR_G_ODLAT_MASK_S3L_REG (0x00000438)
+ #define GODLAT_CR_G_ODLAT_MASK_S3L_Mask_bits_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_MASK_S3L_Mask_bits_WID (32)
+ #define GODLAT_CR_G_ODLAT_MASK_S3L_Mask_bits_MSK (0xFFFFFFFF)
+ #define GODLAT_CR_G_ODLAT_MASK_S3L_Mask_bits_MAX (0xFFFFFFFF)
+
+#define GODLAT_CR_G_ODLAT_MASK_S3H_REG (0x0000043C)
+ #define GODLAT_CR_G_ODLAT_MASK_S3H_Mask_bits_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_MASK_S3H_Mask_bits_WID (32)
+ #define GODLAT_CR_G_ODLAT_MASK_S3H_Mask_bits_MSK (0xFFFFFFFF)
+ #define GODLAT_CR_G_ODLAT_MASK_S3H_Mask_bits_MAX (0xFFFFFFFF)
+
+#define GODLAT_CR_G_ODLAT_ARM_S4L_REG (0x00000440)
+ #define GODLAT_CR_G_ODLAT_ARM_S4L_ARM_bits_packet_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_ARM_S4L_ARM_bits_packet_WID (32)
+ #define GODLAT_CR_G_ODLAT_ARM_S4L_ARM_bits_packet_MSK (0xFFFFFFFF)
+ #define GODLAT_CR_G_ODLAT_ARM_S4L_ARM_bits_packet_MAX (0xFFFFFFFF)
+
+#define GODLAT_CR_G_ODLAT_ARM_S4H_REG (0x00000444)
+ #define GODLAT_CR_G_ODLAT_ARM_S4H_ARM_bits_packet_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_ARM_S4H_ARM_bits_packet_WID (32)
+ #define GODLAT_CR_G_ODLAT_ARM_S4H_ARM_bits_packet_MSK (0xFFFFFFFF)
+ #define GODLAT_CR_G_ODLAT_ARM_S4H_ARM_bits_packet_MAX (0xFFFFFFFF)
+
+#define GODLAT_CR_G_ODLAT_MASK_S4L_REG (0x00000448)
+ #define GODLAT_CR_G_ODLAT_MASK_S4L_Mask_bits_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_MASK_S4L_Mask_bits_WID (32)
+ #define GODLAT_CR_G_ODLAT_MASK_S4L_Mask_bits_MSK (0xFFFFFFFF)
+ #define GODLAT_CR_G_ODLAT_MASK_S4L_Mask_bits_MAX (0xFFFFFFFF)
+
+#define GODLAT_CR_G_ODLAT_MASK_S4H_REG (0x0000044C)
+ #define GODLAT_CR_G_ODLAT_MASK_S4H_Mask_bits_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_MASK_S4H_Mask_bits_WID (32)
+ #define GODLAT_CR_G_ODLAT_MASK_S4H_Mask_bits_MSK (0xFFFFFFFF)
+ #define GODLAT_CR_G_ODLAT_MASK_S4H_Mask_bits_MAX (0xFFFFFFFF)
+
+#define GODLAT_CR_G_ODLAT_ARM_S5L_REG (0x00000450)
+ #define GODLAT_CR_G_ODLAT_ARM_S5L_ARM_bits_packet_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_ARM_S5L_ARM_bits_packet_WID (32)
+ #define GODLAT_CR_G_ODLAT_ARM_S5L_ARM_bits_packet_MSK (0xFFFFFFFF)
+ #define GODLAT_CR_G_ODLAT_ARM_S5L_ARM_bits_packet_MAX (0xFFFFFFFF)
+
+#define GODLAT_CR_G_ODLAT_ARM_S5H_REG (0x00000454)
+ #define GODLAT_CR_G_ODLAT_ARM_S5H_ARM_bits_packet_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_ARM_S5H_ARM_bits_packet_WID (32)
+ #define GODLAT_CR_G_ODLAT_ARM_S5H_ARM_bits_packet_MSK (0xFFFFFFFF)
+ #define GODLAT_CR_G_ODLAT_ARM_S5H_ARM_bits_packet_MAX (0xFFFFFFFF)
+
+#define GODLAT_CR_G_ODLAT_MASK_S5L_REG (0x00000458)
+ #define GODLAT_CR_G_ODLAT_MASK_S5L_Mask_bits_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_MASK_S5L_Mask_bits_WID (32)
+ #define GODLAT_CR_G_ODLAT_MASK_S5L_Mask_bits_MSK (0xFFFFFFFF)
+ #define GODLAT_CR_G_ODLAT_MASK_S5L_Mask_bits_MAX (0xFFFFFFFF)
+
+#define GODLAT_CR_G_ODLAT_MASK_S5H_REG (0x0000045C)
+ #define GODLAT_CR_G_ODLAT_MASK_S5H_Mask_bits_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_MASK_S5H_Mask_bits_WID (32)
+ #define GODLAT_CR_G_ODLAT_MASK_S5H_Mask_bits_MSK (0xFFFFFFFF)
+ #define GODLAT_CR_G_ODLAT_MASK_S5H_Mask_bits_MAX (0xFFFFFFFF)
+
+#define GODLAT_CR_G_ODLAT_ARM_S6L_REG (0x00000460)
+ #define GODLAT_CR_G_ODLAT_ARM_S6L_ARM_bits_packet_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_ARM_S6L_ARM_bits_packet_WID (32)
+ #define GODLAT_CR_G_ODLAT_ARM_S6L_ARM_bits_packet_MSK (0xFFFFFFFF)
+ #define GODLAT_CR_G_ODLAT_ARM_S6L_ARM_bits_packet_MAX (0xFFFFFFFF)
+
+#define GODLAT_CR_G_ODLAT_ARM_S6H_REG (0x00000464)
+ #define GODLAT_CR_G_ODLAT_ARM_S6H_ARM_bits_packet_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_ARM_S6H_ARM_bits_packet_WID (32)
+ #define GODLAT_CR_G_ODLAT_ARM_S6H_ARM_bits_packet_MSK (0xFFFFFFFF)
+ #define GODLAT_CR_G_ODLAT_ARM_S6H_ARM_bits_packet_MAX (0xFFFFFFFF)
+
+#define GODLAT_CR_G_ODLAT_MASK_S6L_REG (0x00000468)
+ #define GODLAT_CR_G_ODLAT_MASK_S6L_Mask_bits_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_MASK_S6L_Mask_bits_WID (32)
+ #define GODLAT_CR_G_ODLAT_MASK_S6L_Mask_bits_MSK (0xFFFFFFFF)
+ #define GODLAT_CR_G_ODLAT_MASK_S6L_Mask_bits_MAX (0xFFFFFFFF)
+
+#define GODLAT_CR_G_ODLAT_MASK_S6H_REG (0x0000046C)
+ #define GODLAT_CR_G_ODLAT_MASK_S6H_Mask_bits_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_MASK_S6H_Mask_bits_WID (32)
+ #define GODLAT_CR_G_ODLAT_MASK_S6H_Mask_bits_MSK (0xFFFFFFFF)
+ #define GODLAT_CR_G_ODLAT_MASK_S6H_Mask_bits_MAX (0xFFFFFFFF)
+
+#define GODLAT_CR_G_ODLAT_ARM_S7L_REG (0x00000470)
+ #define GODLAT_CR_G_ODLAT_ARM_S7L_ARM_bits_packet_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_ARM_S7L_ARM_bits_packet_WID (32)
+ #define GODLAT_CR_G_ODLAT_ARM_S7L_ARM_bits_packet_MSK (0xFFFFFFFF)
+ #define GODLAT_CR_G_ODLAT_ARM_S7L_ARM_bits_packet_MAX (0xFFFFFFFF)
+
+#define GODLAT_CR_G_ODLAT_ARM_S7H_REG (0x00000474)
+ #define GODLAT_CR_G_ODLAT_ARM_S7H_ARM_bits_packet_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_ARM_S7H_ARM_bits_packet_WID (32)
+ #define GODLAT_CR_G_ODLAT_ARM_S7H_ARM_bits_packet_MSK (0xFFFFFFFF)
+ #define GODLAT_CR_G_ODLAT_ARM_S7H_ARM_bits_packet_MAX (0xFFFFFFFF)
+
+#define GODLAT_CR_G_ODLAT_MASK_S7L_REG (0x00000478)
+ #define GODLAT_CR_G_ODLAT_MASK_S7L_Mask_bits_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_MASK_S7L_Mask_bits_WID (32)
+ #define GODLAT_CR_G_ODLAT_MASK_S7L_Mask_bits_MSK (0xFFFFFFFF)
+ #define GODLAT_CR_G_ODLAT_MASK_S7L_Mask_bits_MAX (0xFFFFFFFF)
+
+#define GODLAT_CR_G_ODLAT_MASK_S7H_REG (0x0000047C)
+ #define GODLAT_CR_G_ODLAT_MASK_S7H_Mask_bits_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_MASK_S7H_Mask_bits_WID (32)
+ #define GODLAT_CR_G_ODLAT_MASK_S7H_Mask_bits_MSK (0xFFFFFFFF)
+ #define GODLAT_CR_G_ODLAT_MASK_S7H_Mask_bits_MAX (0xFFFFFFFF)
+
+#define GODLAT_CR_G_ODLAT_CMD_REG (0x00000480)
+ #define GODLAT_CR_G_ODLAT_CMD_UX_TMR_BASE_A_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_CMD_UX_TMR_BASE_A_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_CMD_UX_TMR_BASE_A_MSK (0x00000001)
+ #define GODLAT_CR_G_ODLAT_CMD_UX_TMR_BASE_A_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_CMD_UX_TMR_BASE_A_DEF (0x00000000)
+ #define GODLAT_CR_G_ODLAT_CMD_UX_TMR_BASE_B_OFF ( 1)
+ #define GODLAT_CR_G_ODLAT_CMD_UX_TMR_BASE_B_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_CMD_UX_TMR_BASE_B_MSK (0x00000002)
+ #define GODLAT_CR_G_ODLAT_CMD_UX_TMR_BASE_B_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_CMD_UX_TMR_BASE_B_DEF (0x00000000)
+ #define GODLAT_CR_G_ODLAT_CMD_OVF_ARM_IDI_OFF ( 2)
+ #define GODLAT_CR_G_ODLAT_CMD_OVF_ARM_IDI_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_CMD_OVF_ARM_IDI_MSK (0x00000004)
+ #define GODLAT_CR_G_ODLAT_CMD_OVF_ARM_IDI_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_CMD_OVF_ARM_IDI_DEF (0x00000000)
+ #define GODLAT_CR_G_ODLAT_CMD_OVF_ARM_HIGH_OFF ( 3)
+ #define GODLAT_CR_G_ODLAT_CMD_OVF_ARM_HIGH_WID ( 5)
+ #define GODLAT_CR_G_ODLAT_CMD_OVF_ARM_HIGH_MSK (0x000000F8)
+ #define GODLAT_CR_G_ODLAT_CMD_OVF_ARM_HIGH_MAX (0x0000001F)
+ #define GODLAT_CR_G_ODLAT_CMD_OVF_ARM_HIGH_DEF (0x00000000)
+ #define GODLAT_CR_G_ODLAT_CMD_OVF_Mask_HIGH_OFF ( 8)
+ #define GODLAT_CR_G_ODLAT_CMD_OVF_Mask_HIGH_WID ( 5)
+ #define GODLAT_CR_G_ODLAT_CMD_OVF_Mask_HIGH_MSK (0x00001F00)
+ #define GODLAT_CR_G_ODLAT_CMD_OVF_Mask_HIGH_MAX (0x0000001F)
+ #define GODLAT_CR_G_ODLAT_CMD_OVF_Mask_HIGH_DEF (0x00000000)
+ #define GODLAT_CR_G_ODLAT_CMD_TimerA_units_OFF (18)
+ #define GODLAT_CR_G_ODLAT_CMD_TimerA_units_WID ( 3)
+ #define GODLAT_CR_G_ODLAT_CMD_TimerA_units_MSK (0x001C0000)
+ #define GODLAT_CR_G_ODLAT_CMD_TimerA_units_MAX (0x00000007)
+ #define GODLAT_CR_G_ODLAT_CMD_TimerA_units_DEF (0x00000000)
+ #define GODLAT_CR_G_ODLAT_CMD_TimerB_units_OFF (21)
+ #define GODLAT_CR_G_ODLAT_CMD_TimerB_units_WID ( 3)
+ #define GODLAT_CR_G_ODLAT_CMD_TimerB_units_MSK (0x00E00000)
+ #define GODLAT_CR_G_ODLAT_CMD_TimerB_units_MAX (0x00000007)
+ #define GODLAT_CR_G_ODLAT_CMD_TimerB_units_DEF (0x00000000)
+ #define GODLAT_CR_G_ODLAT_CMD_Which_Time_Base_OFF (24)
+ #define GODLAT_CR_G_ODLAT_CMD_Which_Time_Base_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_CMD_Which_Time_Base_MSK (0x0F000000)
+ #define GODLAT_CR_G_ODLAT_CMD_Which_Time_Base_MAX (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_CMD_Which_Time_Base_DEF (0x00000000)
+ #define GODLAT_CR_G_ODLAT_CMD_Tmr_Or_Cntr_Mode_OFF (28)
+ #define GODLAT_CR_G_ODLAT_CMD_Tmr_Or_Cntr_Mode_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_CMD_Tmr_Or_Cntr_Mode_MSK (0xF0000000)
+ #define GODLAT_CR_G_ODLAT_CMD_Tmr_Or_Cntr_Mode_MAX (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_CMD_Tmr_Or_Cntr_Mode_DEF (0x00000000)
+
+#define GODLAT_CR_G_ODLAT_SW_ENABLE_REG (0x00000484)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_SW_G_ODLAT_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_SW_G_ODLAT_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_SW_G_ODLAT_MSK (0x00000001)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_SW_G_ODLAT_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_SW_G_ODLAT_DEF (0x00000000)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_S0_OFF ( 8)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_S0_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_S0_MSK (0x00000100)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_S0_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_S0_DEF (0x00000000)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_S1_OFF ( 9)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_S1_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_S1_MSK (0x00000200)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_S1_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_S1_DEF (0x00000000)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_S2_OFF (10)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_S2_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_S2_MSK (0x00000400)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_S2_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_S2_DEF (0x00000000)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_S3_OFF (11)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_S3_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_S3_MSK (0x00000800)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_S3_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_S3_DEF (0x00000000)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_S4_OFF (12)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_S4_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_S4_MSK (0x00001000)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_S4_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_S4_DEF (0x00000000)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_S5_OFF (13)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_S5_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_S5_MSK (0x00002000)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_S5_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_S5_DEF (0x00000000)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_S6_OFF (14)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_S6_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_S6_MSK (0x00004000)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_S6_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_S6_DEF (0x00000000)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_S7_OFF (15)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_S7_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_S7_MSK (0x00008000)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_S7_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_EN_S7_DEF (0x00000000)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_MBP_Enable_OFF (16)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_MBP_Enable_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_MBP_Enable_MSK (0x00010000)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_MBP_Enable_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_SW_ENABLE_MBP_Enable_DEF (0x00000000)
+
+#define GODLAT_CR_G_ODLAT_MISC_CMD_REG (0x0000048C)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_Pulse_or_Sticky_Events_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_Pulse_or_Sticky_Events_WID ( 8)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_Pulse_or_Sticky_Events_MSK (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_Pulse_or_Sticky_Events_MAX (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_Pulse_or_Sticky_Events_DEF (0x00000000)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_Pulse_or_Sticky_MBP_OFF ( 8)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_Pulse_or_Sticky_MBP_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_Pulse_or_Sticky_MBP_MSK (0x00000100)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_Pulse_or_Sticky_MBP_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_Pulse_or_Sticky_MBP_DEF (0x00000000)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_Pulse_or_Sticky_TO_OFF ( 9)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_Pulse_or_Sticky_TO_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_Pulse_or_Sticky_TO_MSK (0x00001E00)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_Pulse_or_Sticky_TO_MAX (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_Pulse_or_Sticky_TO_DEF (0x00000000)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_OVF_ARM_LOW_OFF (13)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_OVF_ARM_LOW_WID ( 3)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_OVF_ARM_LOW_MSK (0x0000E000)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_OVF_ARM_LOW_MAX (0x00000007)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_OVF_ARM_LOW_DEF (0x00000000)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_OVF_MASK_LOW_OFF (16)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_OVF_MASK_LOW_WID ( 3)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_OVF_MASK_LOW_MSK (0x00070000)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_OVF_MASK_LOW_MAX (0x00000007)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_OVF_MASK_LOW_DEF (0x00000000)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_Which_MBP_Pin_A_OFF (19)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_Which_MBP_Pin_A_WID ( 3)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_Which_MBP_Pin_A_MSK (0x00380000)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_Which_MBP_Pin_A_MAX (0x00000007)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_Which_MBP_Pin_A_DEF (0x00000000)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_Which_MBP_Pin_B_OFF (22)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_Which_MBP_Pin_B_WID ( 3)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_Which_MBP_Pin_B_MSK (0x01C00000)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_Which_MBP_Pin_B_MAX (0x00000007)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_Which_MBP_Pin_B_DEF (0x00000000)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_Which_MBP_Pin_C_OFF (25)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_Which_MBP_Pin_C_WID ( 3)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_Which_MBP_Pin_C_MSK (0x0E000000)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_Which_MBP_Pin_C_MAX (0x00000007)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_Which_MBP_Pin_C_DEF (0x00000000)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_Which_MBP_Pin_D_OFF (28)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_Which_MBP_Pin_D_WID ( 3)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_Which_MBP_Pin_D_MSK (0x70000000)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_Which_MBP_Pin_D_MAX (0x00000007)
+ #define GODLAT_CR_G_ODLAT_MISC_CMD_Which_MBP_Pin_D_DEF (0x00000000)
+
+#define GDXC_CR_GT_VISA2OCLA_CFG_FILTER_REG (0x00000500)
+ #define GDXC_CR_GT_VISA2OCLA_CFG_FILTER_Ln0Mask_OFF ( 0)
+ #define GDXC_CR_GT_VISA2OCLA_CFG_FILTER_Ln0Mask_WID ( 8)
+ #define GDXC_CR_GT_VISA2OCLA_CFG_FILTER_Ln0Mask_MSK (0x000000FF)
+ #define GDXC_CR_GT_VISA2OCLA_CFG_FILTER_Ln0Mask_MAX (0x000000FF)
+ #define GDXC_CR_GT_VISA2OCLA_CFG_FILTER_Ln0Mask_DEF (0x00000000)
+ #define GDXC_CR_GT_VISA2OCLA_CFG_FILTER_Ln1Mask_OFF ( 8)
+ #define GDXC_CR_GT_VISA2OCLA_CFG_FILTER_Ln1Mask_WID ( 8)
+ #define GDXC_CR_GT_VISA2OCLA_CFG_FILTER_Ln1Mask_MSK (0x0000FF00)
+ #define GDXC_CR_GT_VISA2OCLA_CFG_FILTER_Ln1Mask_MAX (0x000000FF)
+ #define GDXC_CR_GT_VISA2OCLA_CFG_FILTER_Ln1Mask_DEF (0x00000000)
+ #define GDXC_CR_GT_VISA2OCLA_CFG_FILTER_AssertMode_OFF (16)
+ #define GDXC_CR_GT_VISA2OCLA_CFG_FILTER_AssertMode_WID ( 1)
+ #define GDXC_CR_GT_VISA2OCLA_CFG_FILTER_AssertMode_MSK (0x00010000)
+ #define GDXC_CR_GT_VISA2OCLA_CFG_FILTER_AssertMode_MAX (0x00000001)
+ #define GDXC_CR_GT_VISA2OCLA_CFG_FILTER_AssertMode_DEF (0x00000000)
+ #define GDXC_CR_GT_VISA2OCLA_CFG_FILTER_CompEn_OFF (17)
+ #define GDXC_CR_GT_VISA2OCLA_CFG_FILTER_CompEn_WID ( 1)
+ #define GDXC_CR_GT_VISA2OCLA_CFG_FILTER_CompEn_MSK (0x00020000)
+ #define GDXC_CR_GT_VISA2OCLA_CFG_FILTER_CompEn_MAX (0x00000001)
+ #define GDXC_CR_GT_VISA2OCLA_CFG_FILTER_CompEn_DEF (0x00000001)
+ #define GDXC_CR_GT_VISA2OCLA_CFG_FILTER_GT_VISA_En_OFF (18)
+ #define GDXC_CR_GT_VISA2OCLA_CFG_FILTER_GT_VISA_En_WID ( 1)
+ #define GDXC_CR_GT_VISA2OCLA_CFG_FILTER_GT_VISA_En_MSK (0x00040000)
+ #define GDXC_CR_GT_VISA2OCLA_CFG_FILTER_GT_VISA_En_MAX (0x00000001)
+ #define GDXC_CR_GT_VISA2OCLA_CFG_FILTER_GT_VISA_En_DEF (0x00000000)
+
+#define GDXC_CR_GDXC_MAN_CONFIG_REG (0x00000504)
+ #define GDXC_CR_GDXC_MAN_CONFIG_Man_Reset_GDXC_OFF ( 0)
+ #define GDXC_CR_GDXC_MAN_CONFIG_Man_Reset_GDXC_WID ( 1)
+ #define GDXC_CR_GDXC_MAN_CONFIG_Man_Reset_GDXC_MSK (0x00000001)
+ #define GDXC_CR_GDXC_MAN_CONFIG_Man_Reset_GDXC_MAX (0x00000001)
+ #define GDXC_CR_GDXC_MAN_CONFIG_Man_Reset_GDXC_DEF (0x00000000)
+ #define GDXC_CR_GDXC_MAN_CONFIG_Man_Reset_G_ODLAT_OFF ( 1)
+ #define GDXC_CR_GDXC_MAN_CONFIG_Man_Reset_G_ODLAT_WID ( 1)
+ #define GDXC_CR_GDXC_MAN_CONFIG_Man_Reset_G_ODLAT_MSK (0x00000002)
+ #define GDXC_CR_GDXC_MAN_CONFIG_Man_Reset_G_ODLAT_MAX (0x00000001)
+ #define GDXC_CR_GDXC_MAN_CONFIG_Man_Reset_G_ODLAT_DEF (0x00000000)
+ #define GDXC_CR_GDXC_MAN_CONFIG_IOT_Start_OFF ( 2)
+ #define GDXC_CR_GDXC_MAN_CONFIG_IOT_Start_WID ( 1)
+ #define GDXC_CR_GDXC_MAN_CONFIG_IOT_Start_MSK (0x00000004)
+ #define GDXC_CR_GDXC_MAN_CONFIG_IOT_Start_MAX (0x00000001)
+ #define GDXC_CR_GDXC_MAN_CONFIG_IOT_Start_DEF (0x00000000)
+ #define GDXC_CR_GDXC_MAN_CONFIG_IOT_Stop_OFF ( 3)
+ #define GDXC_CR_GDXC_MAN_CONFIG_IOT_Stop_WID ( 1)
+ #define GDXC_CR_GDXC_MAN_CONFIG_IOT_Stop_MSK (0x00000008)
+ #define GDXC_CR_GDXC_MAN_CONFIG_IOT_Stop_MAX (0x00000001)
+ #define GDXC_CR_GDXC_MAN_CONFIG_IOT_Stop_DEF (0x00000000)
+ #define GDXC_CR_GDXC_MAN_CONFIG_IOT_Trigger_OFF ( 4)
+ #define GDXC_CR_GDXC_MAN_CONFIG_IOT_Trigger_WID ( 1)
+ #define GDXC_CR_GDXC_MAN_CONFIG_IOT_Trigger_MSK (0x00000010)
+ #define GDXC_CR_GDXC_MAN_CONFIG_IOT_Trigger_MAX (0x00000001)
+ #define GDXC_CR_GDXC_MAN_CONFIG_IOT_Trigger_DEF (0x00000000)
+ #define GDXC_CR_GDXC_MAN_CONFIG_IOT_Force_Flush_OFF ( 5)
+ #define GDXC_CR_GDXC_MAN_CONFIG_IOT_Force_Flush_WID ( 1)
+ #define GDXC_CR_GDXC_MAN_CONFIG_IOT_Force_Flush_MSK (0x00000020)
+ #define GDXC_CR_GDXC_MAN_CONFIG_IOT_Force_Flush_MAX (0x00000001)
+ #define GDXC_CR_GDXC_MAN_CONFIG_IOT_Force_Flush_DEF (0x00000000)
+ #define GDXC_CR_GDXC_MAN_CONFIG_SPARE_OFF (16)
+ #define GDXC_CR_GDXC_MAN_CONFIG_SPARE_WID ( 8)
+ #define GDXC_CR_GDXC_MAN_CONFIG_SPARE_MSK (0x00FF0000)
+ #define GDXC_CR_GDXC_MAN_CONFIG_SPARE_MAX (0x000000FF)
+ #define GDXC_CR_GDXC_MAN_CONFIG_SPARE_DEF (0x00000000)
+
+#define GDXC_CR_GDXC_ALIGN_REG (0x00000508)
+ #define GDXC_CR_GDXC_ALIGN_mbpout_OFF ( 0)
+ #define GDXC_CR_GDXC_ALIGN_mbpout_WID ( 2)
+ #define GDXC_CR_GDXC_ALIGN_mbpout_MSK (0x00000003)
+ #define GDXC_CR_GDXC_ALIGN_mbpout_MAX (0x00000003)
+ #define GDXC_CR_GDXC_ALIGN_mbpout_DEF (0x00000001)
+
+#define GDXC_CR_GDXC_RR_ARB_THRESH_REG (0x00000510)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_AD_OFF ( 0)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_AD_WID ( 6)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_AD_MSK (0x0000003F)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_AD_MAX (0x0000003F)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_AD_DEF (0x00000004)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_BLHDR0_OFF ( 6)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_BLHDR0_WID ( 7)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_BLHDR0_MSK (0x00001FC0)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_BLHDR0_MAX (0x0000007F)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_BLHDR0_DEF (0x00000004)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_BLHDR1ADDR_OFF (13)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_BLHDR1ADDR_WID ( 6)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_BLHDR1ADDR_MSK (0x0007E000)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_BLHDR1ADDR_MAX (0x0000003F)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_BLHDR1ADDR_DEF (0x00000008)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_AK_OFF (19)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_AK_WID ( 6)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_AK_MSK (0x01F80000)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_AK_MAX (0x0000003F)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_AK_DEF (0x00000004)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_IV_OFF (25)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_IV_WID ( 2)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_IV_MSK (0x06000000)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_IV_MAX (0x00000003)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_IV_DEF (0x00000003)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_Wrap_OFF (27)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_Wrap_WID ( 3)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_Wrap_MSK (0x38000000)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_Wrap_MAX (0x00000007)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_Wrap_DEF (0x00000002)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_MOT_OFF (30)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_MOT_WID ( 5)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_MOT_MSK (0x7C0000000)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_MOT_MAX (0x0000001F)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_MOT_DEF (0x00000002)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_IDI_OFF (35)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_IDI_WID ( 5)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_IDI_MSK (0xF800000000)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_IDI_MAX (0x0000001F)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_IDI_DEF (0x00000002)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_FClk_OFF (40)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_FClk_WID ( 5)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_FClk_MSK (0x1F0000000000)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_FClk_MAX (0x0000001F)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_FClk_DEF (0x00000002)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_UClkMsgCh_OFF (45)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_UClkMsgCh_WID ( 5)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_UClkMsgCh_MSK (0x3E00000000000)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_UClkMsgCh_MAX (0x0000001F)
+ #define GDXC_CR_GDXC_RR_ARB_THRESH_UClkMsgCh_DEF (0x00000002)
+
+#define GDXC_CR_G_ODLAT_FIRE_STATUS_REG (0x00000518)
+ #define GDXC_CR_G_ODLAT_FIRE_STATUS_Start_Status_OFF ( 0)
+ #define GDXC_CR_G_ODLAT_FIRE_STATUS_Start_Status_WID ( 1)
+ #define GDXC_CR_G_ODLAT_FIRE_STATUS_Start_Status_MSK (0x00000001)
+ #define GDXC_CR_G_ODLAT_FIRE_STATUS_Start_Status_MAX (0x00000001)
+ #define GDXC_CR_G_ODLAT_FIRE_STATUS_Start_Status_DEF (0x00000000)
+ #define GDXC_CR_G_ODLAT_FIRE_STATUS_Trigger_Status_OFF ( 1)
+ #define GDXC_CR_G_ODLAT_FIRE_STATUS_Trigger_Status_WID ( 1)
+ #define GDXC_CR_G_ODLAT_FIRE_STATUS_Trigger_Status_MSK (0x00000002)
+ #define GDXC_CR_G_ODLAT_FIRE_STATUS_Trigger_Status_MAX (0x00000001)
+ #define GDXC_CR_G_ODLAT_FIRE_STATUS_Trigger_Status_DEF (0x00000000)
+ #define GDXC_CR_G_ODLAT_FIRE_STATUS_Stop_Status_OFF ( 2)
+ #define GDXC_CR_G_ODLAT_FIRE_STATUS_Stop_Status_WID ( 1)
+ #define GDXC_CR_G_ODLAT_FIRE_STATUS_Stop_Status_MSK (0x00000004)
+ #define GDXC_CR_G_ODLAT_FIRE_STATUS_Stop_Status_MAX (0x00000001)
+ #define GDXC_CR_G_ODLAT_FIRE_STATUS_Stop_Status_DEF (0x00000000)
+ #define GDXC_CR_G_ODLAT_FIRE_STATUS_Muliple_Hit_OFF ( 3)
+ #define GDXC_CR_G_ODLAT_FIRE_STATUS_Muliple_Hit_WID ( 1)
+ #define GDXC_CR_G_ODLAT_FIRE_STATUS_Muliple_Hit_MSK (0x00000008)
+ #define GDXC_CR_G_ODLAT_FIRE_STATUS_Muliple_Hit_MAX (0x00000001)
+ #define GDXC_CR_G_ODLAT_FIRE_STATUS_Muliple_Hit_DEF (0x00000000)
+ #define GDXC_CR_G_ODLAT_FIRE_STATUS_Bubbles_Status_OFF ( 4)
+ #define GDXC_CR_G_ODLAT_FIRE_STATUS_Bubbles_Status_WID ( 6)
+ #define GDXC_CR_G_ODLAT_FIRE_STATUS_Bubbles_Status_MSK (0x000003F0)
+ #define GDXC_CR_G_ODLAT_FIRE_STATUS_Bubbles_Status_MAX (0x0000003F)
+ #define GDXC_CR_G_ODLAT_FIRE_STATUS_Bubbles_Status_DEF (0x00000000)
+
+#define GDXC_CR_TRIGGER_TO_STOP_DELAY_REG (0x00000520)
+ #define GDXC_CR_TRIGGER_TO_STOP_DELAY_Delay_count_OFF ( 0)
+ #define GDXC_CR_TRIGGER_TO_STOP_DELAY_Delay_count_WID (25)
+ #define GDXC_CR_TRIGGER_TO_STOP_DELAY_Delay_count_MSK (0x01FFFFFF)
+ #define GDXC_CR_TRIGGER_TO_STOP_DELAY_Delay_count_MAX (0x01FFFFFF)
+ #define GDXC_CR_TRIGGER_TO_STOP_DELAY_Delay_count_DEF (0x00000000)
+
+#define GDXC_CR_IOT_STATUS_REG (0x00000524)
+ #define GDXC_CR_IOT_STATUS_Disabled_OFF ( 0)
+ #define GDXC_CR_IOT_STATUS_Disabled_WID ( 1)
+ #define GDXC_CR_IOT_STATUS_Disabled_MSK (0x00000001)
+ #define GDXC_CR_IOT_STATUS_Disabled_MAX (0x00000001)
+ #define GDXC_CR_IOT_STATUS_Disabled_DEF (0x00000001)
+ #define GDXC_CR_IOT_STATUS_Idle_OFF ( 1)
+ #define GDXC_CR_IOT_STATUS_Idle_WID ( 1)
+ #define GDXC_CR_IOT_STATUS_Idle_MSK (0x00000002)
+ #define GDXC_CR_IOT_STATUS_Idle_MAX (0x00000001)
+ #define GDXC_CR_IOT_STATUS_Idle_DEF (0x00000000)
+ #define GDXC_CR_IOT_STATUS_Running_OFF ( 2)
+ #define GDXC_CR_IOT_STATUS_Running_WID ( 1)
+ #define GDXC_CR_IOT_STATUS_Running_MSK (0x00000004)
+ #define GDXC_CR_IOT_STATUS_Running_MAX (0x00000001)
+ #define GDXC_CR_IOT_STATUS_Running_DEF (0x00000000)
+ #define GDXC_CR_IOT_STATUS_IOT_Triggered_OFF ( 3)
+ #define GDXC_CR_IOT_STATUS_IOT_Triggered_WID ( 1)
+ #define GDXC_CR_IOT_STATUS_IOT_Triggered_MSK (0x00000008)
+ #define GDXC_CR_IOT_STATUS_IOT_Triggered_MAX (0x00000001)
+ #define GDXC_CR_IOT_STATUS_IOT_Triggered_DEF (0x00000000)
+ #define GDXC_CR_IOT_STATUS_Sticky_triggered_OFF ( 4)
+ #define GDXC_CR_IOT_STATUS_Sticky_triggered_WID ( 1)
+ #define GDXC_CR_IOT_STATUS_Sticky_triggered_MSK (0x00000010)
+ #define GDXC_CR_IOT_STATUS_Sticky_triggered_MAX (0x00000001)
+ #define GDXC_CR_IOT_STATUS_Sticky_triggered_DEF (0x00000000)
+ #define GDXC_CR_IOT_STATUS_Remaining_count_OFF ( 6)
+ #define GDXC_CR_IOT_STATUS_Remaining_count_WID (25)
+ #define GDXC_CR_IOT_STATUS_Remaining_count_MSK (0x7FFFFFC0)
+ #define GDXC_CR_IOT_STATUS_Remaining_count_MAX (0x01FFFFFF)
+ #define GDXC_CR_IOT_STATUS_Remaining_count_DEF (0x00000000)
+
+#define GODLAT_CR_G_ODLAT_OCLAHDR_S0TO3_REG (0x00000528)
+ #define GODLAT_CR_G_ODLAT_OCLAHDR_S0TO3_S0_OclaHdr_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_OCLAHDR_S0TO3_S0_OclaHdr_WID ( 8)
+ #define GODLAT_CR_G_ODLAT_OCLAHDR_S0TO3_S0_OclaHdr_MSK (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_OCLAHDR_S0TO3_S0_OclaHdr_MAX (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_OCLAHDR_S0TO3_S1_OclaHdr_OFF ( 8)
+ #define GODLAT_CR_G_ODLAT_OCLAHDR_S0TO3_S1_OclaHdr_WID ( 8)
+ #define GODLAT_CR_G_ODLAT_OCLAHDR_S0TO3_S1_OclaHdr_MSK (0x0000FF00)
+ #define GODLAT_CR_G_ODLAT_OCLAHDR_S0TO3_S1_OclaHdr_MAX (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_OCLAHDR_S0TO3_S2_OclaHdr_OFF (16)
+ #define GODLAT_CR_G_ODLAT_OCLAHDR_S0TO3_S2_OclaHdr_WID ( 8)
+ #define GODLAT_CR_G_ODLAT_OCLAHDR_S0TO3_S2_OclaHdr_MSK (0x00FF0000)
+ #define GODLAT_CR_G_ODLAT_OCLAHDR_S0TO3_S2_OclaHdr_MAX (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_OCLAHDR_S0TO3_S3_OclaHdr_OFF (24)
+ #define GODLAT_CR_G_ODLAT_OCLAHDR_S0TO3_S3_OclaHdr_WID ( 8)
+ #define GODLAT_CR_G_ODLAT_OCLAHDR_S0TO3_S3_OclaHdr_MSK (0xFF000000)
+ #define GODLAT_CR_G_ODLAT_OCLAHDR_S0TO3_S3_OclaHdr_MAX (0x000000FF)
+
+#define GODLAT_CR_G_ODLAT_OCLAHDR_S4TO7_REG (0x0000052C)
+ #define GODLAT_CR_G_ODLAT_OCLAHDR_S4TO7_S4_OclaHdr_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_OCLAHDR_S4TO7_S4_OclaHdr_WID ( 8)
+ #define GODLAT_CR_G_ODLAT_OCLAHDR_S4TO7_S4_OclaHdr_MSK (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_OCLAHDR_S4TO7_S4_OclaHdr_MAX (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_OCLAHDR_S4TO7_S5_OclaHdr_OFF ( 8)
+ #define GODLAT_CR_G_ODLAT_OCLAHDR_S4TO7_S5_OclaHdr_WID ( 8)
+ #define GODLAT_CR_G_ODLAT_OCLAHDR_S4TO7_S5_OclaHdr_MSK (0x0000FF00)
+ #define GODLAT_CR_G_ODLAT_OCLAHDR_S4TO7_S5_OclaHdr_MAX (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_OCLAHDR_S4TO7_S6_OclaHdr_OFF (16)
+ #define GODLAT_CR_G_ODLAT_OCLAHDR_S4TO7_S6_OclaHdr_WID ( 8)
+ #define GODLAT_CR_G_ODLAT_OCLAHDR_S4TO7_S6_OclaHdr_MSK (0x00FF0000)
+ #define GODLAT_CR_G_ODLAT_OCLAHDR_S4TO7_S6_OclaHdr_MAX (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_OCLAHDR_S4TO7_S7_OclaHdr_OFF (24)
+ #define GODLAT_CR_G_ODLAT_OCLAHDR_S4TO7_S7_OclaHdr_WID ( 8)
+ #define GODLAT_CR_G_ODLAT_OCLAHDR_S4TO7_S7_OclaHdr_MSK (0xFF000000)
+ #define GODLAT_CR_G_ODLAT_OCLAHDR_S4TO7_S7_OclaHdr_MAX (0x000000FF)
+
+#define GODLAT_CR_G_ODLAT_FST_REG (0x00000530)
+ #define GODLAT_CR_G_ODLAT_FST_S0_FST_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_FST_S0_FST_WID ( 2)
+ #define GODLAT_CR_G_ODLAT_FST_S0_FST_MSK (0x00000003)
+ #define GODLAT_CR_G_ODLAT_FST_S0_FST_MAX (0x00000003)
+ #define GODLAT_CR_G_ODLAT_FST_S1_FST_OFF ( 2)
+ #define GODLAT_CR_G_ODLAT_FST_S1_FST_WID ( 2)
+ #define GODLAT_CR_G_ODLAT_FST_S1_FST_MSK (0x0000000C)
+ #define GODLAT_CR_G_ODLAT_FST_S1_FST_MAX (0x00000003)
+ #define GODLAT_CR_G_ODLAT_FST_S2_FST_OFF ( 4)
+ #define GODLAT_CR_G_ODLAT_FST_S2_FST_WID ( 2)
+ #define GODLAT_CR_G_ODLAT_FST_S2_FST_MSK (0x00000030)
+ #define GODLAT_CR_G_ODLAT_FST_S2_FST_MAX (0x00000003)
+ #define GODLAT_CR_G_ODLAT_FST_S3_FST_OFF ( 6)
+ #define GODLAT_CR_G_ODLAT_FST_S3_FST_WID ( 2)
+ #define GODLAT_CR_G_ODLAT_FST_S3_FST_MSK (0x000000C0)
+ #define GODLAT_CR_G_ODLAT_FST_S3_FST_MAX (0x00000003)
+ #define GODLAT_CR_G_ODLAT_FST_S4_FST_OFF ( 8)
+ #define GODLAT_CR_G_ODLAT_FST_S4_FST_WID ( 2)
+ #define GODLAT_CR_G_ODLAT_FST_S4_FST_MSK (0x00000300)
+ #define GODLAT_CR_G_ODLAT_FST_S4_FST_MAX (0x00000003)
+ #define GODLAT_CR_G_ODLAT_FST_S5_FST_OFF (10)
+ #define GODLAT_CR_G_ODLAT_FST_S5_FST_WID ( 2)
+ #define GODLAT_CR_G_ODLAT_FST_S5_FST_MSK (0x00000C00)
+ #define GODLAT_CR_G_ODLAT_FST_S5_FST_MAX (0x00000003)
+ #define GODLAT_CR_G_ODLAT_FST_S6_FST_OFF (12)
+ #define GODLAT_CR_G_ODLAT_FST_S6_FST_WID ( 2)
+ #define GODLAT_CR_G_ODLAT_FST_S6_FST_MSK (0x00003000)
+ #define GODLAT_CR_G_ODLAT_FST_S6_FST_MAX (0x00000003)
+ #define GODLAT_CR_G_ODLAT_FST_S7_FST_OFF (14)
+ #define GODLAT_CR_G_ODLAT_FST_S7_FST_WID ( 2)
+ #define GODLAT_CR_G_ODLAT_FST_S7_FST_MSK (0x0000C000)
+ #define GODLAT_CR_G_ODLAT_FST_S7_FST_MAX (0x00000003)
+
+#define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B0_REG (0x00000534)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B0_Arm_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B0_Arm_WID ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B0_Arm_MSK (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B0_Arm_MAX (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B0_MBP_Arm_OFF ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B0_MBP_Arm_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B0_MBP_Arm_MSK (0x00000100)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B0_MBP_Arm_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B0_TO_Arm_OFF ( 9)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B0_TO_Arm_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B0_TO_Arm_MSK (0x00001E00)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B0_TO_Arm_MAX (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B0_Mask_OFF (16)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B0_Mask_WID ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B0_Mask_MSK (0x00FF0000)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B0_Mask_MAX (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B0_MBP_Mask_OFF (24)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B0_MBP_Mask_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B0_MBP_Mask_MSK (0x01000000)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B0_MBP_Mask_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B0_TO_Mask_OFF (25)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B0_TO_Mask_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B0_TO_Mask_MSK (0x1E000000)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B0_TO_Mask_MAX (0x0000000F)
+
+#define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B1_REG (0x00000538)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B1_Arm_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B1_Arm_WID ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B1_Arm_MSK (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B1_Arm_MAX (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B1_MBP_Arm_OFF ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B1_MBP_Arm_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B1_MBP_Arm_MSK (0x00000100)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B1_MBP_Arm_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B1_TO_Arm_OFF ( 9)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B1_TO_Arm_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B1_TO_Arm_MSK (0x00001E00)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B1_TO_Arm_MAX (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B1_Mask_OFF (16)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B1_Mask_WID ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B1_Mask_MSK (0x00FF0000)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B1_Mask_MAX (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B1_MBP_Mask_OFF (24)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B1_MBP_Mask_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B1_MBP_Mask_MSK (0x01000000)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B1_MBP_Mask_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B1_TO_Mask_OFF (25)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B1_TO_Mask_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B1_TO_Mask_MSK (0x1E000000)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B1_TO_Mask_MAX (0x0000000F)
+
+#define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B2_REG (0x0000053C)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B2_Arm_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B2_Arm_WID ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B2_Arm_MSK (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B2_Arm_MAX (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B2_MBP_Arm_OFF ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B2_MBP_Arm_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B2_MBP_Arm_MSK (0x00000100)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B2_MBP_Arm_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B2_TO_Arm_OFF ( 9)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B2_TO_Arm_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B2_TO_Arm_MSK (0x00001E00)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B2_TO_Arm_MAX (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B2_Mask_OFF (16)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B2_Mask_WID ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B2_Mask_MSK (0x00FF0000)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B2_Mask_MAX (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B2_MBP_Mask_OFF (24)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B2_MBP_Mask_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B2_MBP_Mask_MSK (0x01000000)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B2_MBP_Mask_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B2_TO_Mask_OFF (25)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B2_TO_Mask_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B2_TO_Mask_MSK (0x1E000000)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B2_TO_Mask_MAX (0x0000000F)
+
+#define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B3_REG (0x00000540)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B3_Arm_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B3_Arm_WID ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B3_Arm_MSK (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B3_Arm_MAX (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B3_MBP_Arm_OFF ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B3_MBP_Arm_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B3_MBP_Arm_MSK (0x00000100)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B3_MBP_Arm_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B3_TO_Arm_OFF ( 9)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B3_TO_Arm_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B3_TO_Arm_MSK (0x00001E00)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B3_TO_Arm_MAX (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B3_Mask_OFF (16)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B3_Mask_WID ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B3_Mask_MSK (0x00FF0000)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B3_Mask_MAX (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B3_MBP_Mask_OFF (24)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B3_MBP_Mask_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B3_MBP_Mask_MSK (0x01000000)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B3_MBP_Mask_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B3_TO_Mask_OFF (25)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B3_TO_Mask_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B3_TO_Mask_MSK (0x1E000000)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B3_TO_Mask_MAX (0x0000000F)
+
+#define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B4_REG (0x00000544)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B4_Arm_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B4_Arm_WID ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B4_Arm_MSK (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B4_Arm_MAX (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B4_MBP_Arm_OFF ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B4_MBP_Arm_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B4_MBP_Arm_MSK (0x00000100)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B4_MBP_Arm_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B4_TO_Arm_OFF ( 9)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B4_TO_Arm_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B4_TO_Arm_MSK (0x00001E00)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B4_TO_Arm_MAX (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B4_Mask_OFF (16)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B4_Mask_WID ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B4_Mask_MSK (0x00FF0000)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B4_Mask_MAX (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B4_MBP_Mask_OFF (24)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B4_MBP_Mask_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B4_MBP_Mask_MSK (0x01000000)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B4_MBP_Mask_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B4_TO_Mask_OFF (25)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B4_TO_Mask_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B4_TO_Mask_MSK (0x1E000000)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B4_TO_Mask_MAX (0x0000000F)
+
+#define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B5_REG (0x00000548)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B5_Arm_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B5_Arm_WID ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B5_Arm_MSK (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B5_Arm_MAX (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B5_MBP_Arm_OFF ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B5_MBP_Arm_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B5_MBP_Arm_MSK (0x00000100)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B5_MBP_Arm_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B5_TO_Arm_OFF ( 9)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B5_TO_Arm_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B5_TO_Arm_MSK (0x00001E00)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B5_TO_Arm_MAX (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B5_Mask_OFF (16)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B5_Mask_WID ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B5_Mask_MSK (0x00FF0000)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B5_Mask_MAX (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B5_MBP_Mask_OFF (24)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B5_MBP_Mask_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B5_MBP_Mask_MSK (0x01000000)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B5_MBP_Mask_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B5_TO_Mask_OFF (25)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B5_TO_Mask_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B5_TO_Mask_MSK (0x1E000000)
+ #define GODLAT_CR_G_ODLAT_TR_IF_ARM_MASK_B5_TO_Mask_MAX (0x0000000F)
+
+#define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B0_REG (0x00000550)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B0_Arm_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B0_Arm_WID ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B0_Arm_MSK (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B0_Arm_MAX (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B0_MBP_Arm_OFF ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B0_MBP_Arm_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B0_MBP_Arm_MSK (0x00000100)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B0_MBP_Arm_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B0_TO_Arm_OFF ( 9)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B0_TO_Arm_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B0_TO_Arm_MSK (0x00001E00)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B0_TO_Arm_MAX (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B0_Stop_OFF (13)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B0_Stop_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B0_Stop_MSK (0x00002000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B0_Stop_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B0_Mask_OFF (16)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B0_Mask_WID ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B0_Mask_MSK (0x00FF0000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B0_Mask_MAX (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B0_MBP_Mask_OFF (24)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B0_MBP_Mask_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B0_MBP_Mask_MSK (0x01000000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B0_MBP_Mask_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B0_TO_Mask_OFF (25)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B0_TO_Mask_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B0_TO_Mask_MSK (0x1E000000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B0_TO_Mask_MAX (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B0_Col_Rst_OFF (29)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B0_Col_Rst_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B0_Col_Rst_MSK (0x20000000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B0_Col_Rst_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B0_Trigger_OFF (30)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B0_Trigger_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B0_Trigger_MSK (0x40000000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B0_Trigger_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B0_Start_OFF (31)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B0_Start_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B0_Start_MSK (0x80000000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B0_Start_MAX (0x00000001)
+
+#define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B0_REG (0x00000554)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B0_Arm_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B0_Arm_WID ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B0_Arm_MSK (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B0_Arm_MAX (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B0_MBP_Arm_OFF ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B0_MBP_Arm_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B0_MBP_Arm_MSK (0x00000100)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B0_MBP_Arm_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B0_TO_Arm_OFF ( 9)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B0_TO_Arm_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B0_TO_Arm_MSK (0x00001E00)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B0_TO_Arm_MAX (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B0_Mask_OFF (16)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B0_Mask_WID ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B0_Mask_MSK (0x00FF0000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B0_Mask_MAX (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B0_MBP_Mask_OFF (24)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B0_MBP_Mask_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B0_MBP_Mask_MSK (0x01000000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B0_MBP_Mask_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B0_TO_Mask_OFF (25)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B0_TO_Mask_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B0_TO_Mask_MSK (0x1E000000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B0_TO_Mask_MAX (0x0000000F)
+
+#define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B1_REG (0x00000558)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B1_Arm_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B1_Arm_WID ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B1_Arm_MSK (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B1_Arm_MAX (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B1_MBP_Arm_OFF ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B1_MBP_Arm_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B1_MBP_Arm_MSK (0x00000100)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B1_MBP_Arm_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B1_TO_Arm_OFF ( 9)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B1_TO_Arm_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B1_TO_Arm_MSK (0x00001E00)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B1_TO_Arm_MAX (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B1_Mask_OFF (16)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B1_Mask_WID ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B1_Mask_MSK (0x00FF0000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B1_Mask_MAX (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B1_MBP_Mask_OFF (24)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B1_MBP_Mask_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B1_MBP_Mask_MSK (0x01000000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B1_MBP_Mask_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B1_TO_Mask_OFF (25)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B1_TO_Mask_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B1_TO_Mask_MSK (0x1E000000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B1_TO_Mask_MAX (0x0000000F)
+
+#define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B2_REG (0x0000055C)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B2_Arm_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B2_Arm_WID ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B2_Arm_MSK (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B2_Arm_MAX (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B2_MBP_Arm_OFF ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B2_MBP_Arm_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B2_MBP_Arm_MSK (0x00000100)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B2_MBP_Arm_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B2_TO_Arm_OFF ( 9)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B2_TO_Arm_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B2_TO_Arm_MSK (0x00001E00)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B2_TO_Arm_MAX (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B2_Mask_OFF (16)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B2_Mask_WID ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B2_Mask_MSK (0x00FF0000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B2_Mask_MAX (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B2_MBP_Mask_OFF (24)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B2_MBP_Mask_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B2_MBP_Mask_MSK (0x01000000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B2_MBP_Mask_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B2_TO_Mask_OFF (25)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B2_TO_Mask_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B2_TO_Mask_MSK (0x1E000000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B2_TO_Mask_MAX (0x0000000F)
+
+#define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B3_REG (0x00000560)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B3_Arm_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B3_Arm_WID ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B3_Arm_MSK (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B3_Arm_MAX (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B3_MBP_Arm_OFF ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B3_MBP_Arm_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B3_MBP_Arm_MSK (0x00000100)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B3_MBP_Arm_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B3_TO_Arm_OFF ( 9)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B3_TO_Arm_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B3_TO_Arm_MSK (0x00001E00)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B3_TO_Arm_MAX (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B3_Mask_OFF (16)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B3_Mask_WID ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B3_Mask_MSK (0x00FF0000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B3_Mask_MAX (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B3_MBP_Mask_OFF (24)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B3_MBP_Mask_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B3_MBP_Mask_MSK (0x01000000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B3_MBP_Mask_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B3_TO_Mask_OFF (25)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B3_TO_Mask_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B3_TO_Mask_MSK (0x1E000000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B3_TO_Mask_MAX (0x0000000F)
+
+#define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B4_REG (0x00000564)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B4_Arm_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B4_Arm_WID ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B4_Arm_MSK (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B4_Arm_MAX (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B4_MBP_Arm_OFF ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B4_MBP_Arm_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B4_MBP_Arm_MSK (0x00000100)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B4_MBP_Arm_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B4_TO_Arm_OFF ( 9)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B4_TO_Arm_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B4_TO_Arm_MSK (0x00001E00)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B4_TO_Arm_MAX (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B4_Mask_OFF (16)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B4_Mask_WID ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B4_Mask_MSK (0x00FF0000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B4_Mask_MAX (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B4_MBP_Mask_OFF (24)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B4_MBP_Mask_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B4_MBP_Mask_MSK (0x01000000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B4_MBP_Mask_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B4_TO_Mask_OFF (25)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B4_TO_Mask_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B4_TO_Mask_MSK (0x1E000000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B4_TO_Mask_MAX (0x0000000F)
+
+#define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B5_REG (0x00000568)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B5_Arm_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B5_Arm_WID ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B5_Arm_MSK (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B5_Arm_MAX (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B5_MBP_Arm_OFF ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B5_MBP_Arm_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B5_MBP_Arm_MSK (0x00000100)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B5_MBP_Arm_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B5_TO_Arm_OFF ( 9)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B5_TO_Arm_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B5_TO_Arm_MSK (0x00001E00)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B5_TO_Arm_MAX (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B5_Mask_OFF (16)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B5_Mask_WID ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B5_Mask_MSK (0x00FF0000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B5_Mask_MAX (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B5_MBP_Mask_OFF (24)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B5_MBP_Mask_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B5_MBP_Mask_MSK (0x01000000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B5_MBP_Mask_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B5_TO_Mask_OFF (25)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B5_TO_Mask_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B5_TO_Mask_MSK (0x1E000000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ARM_MASK_B5_TO_Mask_MAX (0x0000000F)
+
+#define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B1_REG (0x00000570)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B1_Arm_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B1_Arm_WID ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B1_Arm_MSK (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B1_Arm_MAX (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B1_MBP_Arm_OFF ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B1_MBP_Arm_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B1_MBP_Arm_MSK (0x00000100)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B1_MBP_Arm_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B1_TO_Arm_OFF ( 9)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B1_TO_Arm_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B1_TO_Arm_MSK (0x00001E00)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B1_TO_Arm_MAX (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B1_Stop_OFF (13)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B1_Stop_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B1_Stop_MSK (0x00002000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B1_Stop_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B1_Mask_OFF (16)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B1_Mask_WID ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B1_Mask_MSK (0x00FF0000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B1_Mask_MAX (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B1_MBP_Mask_OFF (24)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B1_MBP_Mask_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B1_MBP_Mask_MSK (0x01000000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B1_MBP_Mask_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B1_TO_Mask_OFF (25)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B1_TO_Mask_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B1_TO_Mask_MSK (0x1E000000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B1_TO_Mask_MAX (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B1_Col_Rst_OFF (29)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B1_Col_Rst_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B1_Col_Rst_MSK (0x20000000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B1_Col_Rst_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B1_Trigger_OFF (30)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B1_Trigger_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B1_Trigger_MSK (0x40000000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B1_Trigger_MAX (0x00000001)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B1_Start_OFF (31)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B1_Start_WID ( 1)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B1_Start_MSK (0x80000000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_ELSEIF_ARM_MASK_B1_Start_MAX (0x00000001)
+
+#define GODLAT_CR_G_ODLAT_TR_IF_MODE_B0_B1_REG (0x00000574)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B0_B1_B0_Set_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B0_B1_B0_Set_WID ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B0_B1_B0_Set_MSK (0x0000003F)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B0_B1_B0_Set_MAX (0x0000003F)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B0_B1_B0_Rst_OFF ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B0_B1_B0_Rst_WID ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B0_B1_B0_Rst_MSK (0x00000FC0)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B0_B1_B0_Rst_MAX (0x0000003F)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B0_B1_B1_Set_OFF (12)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B0_B1_B1_Set_WID ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B0_B1_B1_Set_MSK (0x0003F000)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B0_B1_B1_Set_MAX (0x0000003F)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B0_B1_B1_Rst_OFF (18)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B0_B1_B1_Rst_WID ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B0_B1_B1_Rst_MSK (0x00FC0000)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B0_B1_B1_Rst_MAX (0x0000003F)
+
+#define GODLAT_CR_G_ODLAT_TR_IF_MODE_B2_B3_REG (0x00000578)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B2_B3_B2_Set_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B2_B3_B2_Set_WID ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B2_B3_B2_Set_MSK (0x0000003F)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B2_B3_B2_Set_MAX (0x0000003F)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B2_B3_B2_Rst_OFF ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B2_B3_B2_Rst_WID ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B2_B3_B2_Rst_MSK (0x00000FC0)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B2_B3_B2_Rst_MAX (0x0000003F)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B2_B3_B3_Set_OFF (12)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B2_B3_B3_Set_WID ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B2_B3_B3_Set_MSK (0x0003F000)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B2_B3_B3_Set_MAX (0x0000003F)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B2_B3_B3_Rst_OFF (18)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B2_B3_B3_Rst_WID ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B2_B3_B3_Rst_MSK (0x00FC0000)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B2_B3_B3_Rst_MAX (0x0000003F)
+
+#define GODLAT_CR_G_ODLAT_TR_IF_MODE_B4_B5_REG (0x0000057C)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B4_B5_B4_Set_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B4_B5_B4_Set_WID ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B4_B5_B4_Set_MSK (0x0000003F)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B4_B5_B4_Set_MAX (0x0000003F)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B4_B5_B4_Rst_OFF ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B4_B5_B4_Rst_WID ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B4_B5_B4_Rst_MSK (0x00000FC0)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B4_B5_B4_Rst_MAX (0x0000003F)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B4_B5_B5_Set_OFF (12)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B4_B5_B5_Set_WID ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B4_B5_B5_Set_MSK (0x0003F000)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B4_B5_B5_Set_MAX (0x0000003F)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B4_B5_B5_Rst_OFF (18)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B4_B5_B5_Rst_WID ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B4_B5_B5_Rst_MSK (0x00FC0000)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B4_B5_B5_Rst_MAX (0x0000003F)
+
+#define GODLAT_CR_G_ODLAT_TR_IF_MODE_B6_B7_REG (0x00000580)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B6_B7_ElseIf_ElseIf_B0_Set_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B6_B7_ElseIf_ElseIf_B0_Set_WID ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B6_B7_ElseIf_ElseIf_B0_Set_MSK (0x0000003F)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B6_B7_ElseIf_ElseIf_B0_Set_MAX (0x0000003F)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B6_B7_ElseIf_ElseIf_B0_Rst_OFF ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B6_B7_ElseIf_ElseIf_B0_Rst_WID ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B6_B7_ElseIf_ElseIf_B0_Rst_MSK (0x00000FC0)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_B6_B7_ElseIf_ElseIf_B0_Rst_MAX (0x0000003F)
+
+#define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B0_B1_REG (0x00000584)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B0_B1_B0_Set_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B0_B1_B0_Set_WID ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B0_B1_B0_Set_MSK (0x0000003F)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B0_B1_B0_Set_MAX (0x0000003F)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B0_B1_B0_Rst_OFF ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B0_B1_B0_Rst_WID ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B0_B1_B0_Rst_MSK (0x00000FC0)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B0_B1_B0_Rst_MAX (0x0000003F)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B0_B1_B1_Set_OFF (12)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B0_B1_B1_Set_WID ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B0_B1_B1_Set_MSK (0x0003F000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B0_B1_B1_Set_MAX (0x0000003F)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B0_B1_B1_Rst_OFF (18)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B0_B1_B1_Rst_WID ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B0_B1_B1_Rst_MSK (0x00FC0000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B0_B1_B1_Rst_MAX (0x0000003F)
+
+#define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B2_B3_REG (0x00000588)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B2_B3_B2_Set_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B2_B3_B2_Set_WID ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B2_B3_B2_Set_MSK (0x0000003F)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B2_B3_B2_Set_MAX (0x0000003F)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B2_B3_B2_Rst_OFF ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B2_B3_B2_Rst_WID ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B2_B3_B2_Rst_MSK (0x00000FC0)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B2_B3_B2_Rst_MAX (0x0000003F)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B2_B3_B3_Set_OFF (12)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B2_B3_B3_Set_WID ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B2_B3_B3_Set_MSK (0x0003F000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B2_B3_B3_Set_MAX (0x0000003F)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B2_B3_B3_Rst_OFF (18)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B2_B3_B3_Rst_WID ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B2_B3_B3_Rst_MSK (0x00FC0000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B2_B3_B3_Rst_MAX (0x0000003F)
+
+#define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B4_B5_REG (0x0000058C)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B4_B5_B4_Set_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B4_B5_B4_Set_WID ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B4_B5_B4_Set_MSK (0x0000003F)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B4_B5_B4_Set_MAX (0x0000003F)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B4_B5_B4_Rst_OFF ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B4_B5_B4_Rst_WID ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B4_B5_B4_Rst_MSK (0x00000FC0)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B4_B5_B4_Rst_MAX (0x0000003F)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B4_B5_B5_Set_OFF (12)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B4_B5_B5_Set_WID ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B4_B5_B5_Set_MSK (0x0003F000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B4_B5_B5_Set_MAX (0x0000003F)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B4_B5_B5_Rst_OFF (18)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B4_B5_B5_Rst_WID ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B4_B5_B5_Rst_MSK (0x00FC0000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B4_B5_B5_Rst_MAX (0x0000003F)
+
+#define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B6_B7_REG (0x00000590)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B6_B7_ElseIf_ElseIf_B1_Set_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B6_B7_ElseIf_ElseIf_B1_Set_WID ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B6_B7_ElseIf_ElseIf_B1_Set_MSK (0x0000003F)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B6_B7_ElseIf_ElseIf_B1_Set_MAX (0x0000003F)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B6_B7_ElseIf_ElseIf_B1_Rst_OFF ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B6_B7_ElseIf_ElseIf_B1_Rst_WID ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B6_B7_ElseIf_ElseIf_B1_Rst_MSK (0x00000FC0)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_B6_B7_ElseIf_ElseIf_B1_Rst_MAX (0x0000003F)
+
+#define GODLAT_CR_G_ODLAT_INIT_BUBBLES_REG (0x00000594)
+ #define GODLAT_CR_G_ODLAT_INIT_BUBBLES_Init_Bits_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_INIT_BUBBLES_Init_Bits_WID ( 6)
+ #define GODLAT_CR_G_ODLAT_INIT_BUBBLES_Init_Bits_MSK (0x0000003F)
+ #define GODLAT_CR_G_ODLAT_INIT_BUBBLES_Init_Bits_MAX (0x0000003F)
+
+#define GODLAT_CR_G_ODLAT_TR_IF_MODE_MISC_REG (0x00000598)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_MISC_ColRst_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_MISC_ColRst_WID ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_MISC_ColRst_MSK (0x0000003F)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_MISC_ColRst_MAX (0x0000003F)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_MISC_Start_OFF ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_MISC_Start_WID ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_MISC_Start_MSK (0x00000FC0)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_MISC_Start_MAX (0x0000003F)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_MISC_Trigger_OFF (12)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_MISC_Trigger_WID ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_MISC_Trigger_MSK (0x0003F000)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_MISC_Trigger_MAX (0x0000003F)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_MISC_Stop_OFF (18)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_MISC_Stop_WID ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_MISC_Stop_MSK (0x00FC0000)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_MISC_Stop_MAX (0x0000003F)
+
+#define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_MISC_REG (0x0000059C)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_MISC_ColRst_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_MISC_ColRst_WID ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_MISC_ColRst_MSK (0x0000003F)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_MISC_ColRst_MAX (0x0000003F)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_MISC_Start_OFF ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_MISC_Start_WID ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_MISC_Start_MSK (0x00000FC0)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_MISC_Start_MAX (0x0000003F)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_MISC_Trigger_OFF (12)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_MISC_Trigger_WID ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_MISC_Trigger_MSK (0x0003F000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_MISC_Trigger_MAX (0x0000003F)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_MISC_Stop_OFF (18)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_MISC_Stop_WID ( 6)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_MISC_Stop_MSK (0x00FC0000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_MISC_Stop_MAX (0x0000003F)
+
+#define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMREN_REG (0x00000600)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMREN_B0_EN_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMREN_B0_EN_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMREN_B0_EN_MSK (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMREN_B0_EN_MAX (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMREN_B1_EN_OFF ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMREN_B1_EN_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMREN_B1_EN_MSK (0x000000F0)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMREN_B1_EN_MAX (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMREN_B2_EN_OFF ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMREN_B2_EN_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMREN_B2_EN_MSK (0x00000F00)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMREN_B2_EN_MAX (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMREN_B3_EN_OFF (12)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMREN_B3_EN_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMREN_B3_EN_MSK (0x0000F000)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMREN_B3_EN_MAX (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMREN_B4_EN_OFF (16)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMREN_B4_EN_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMREN_B4_EN_MSK (0x000F0000)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMREN_B4_EN_MAX (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMREN_B5_EN_OFF (20)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMREN_B5_EN_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMREN_B5_EN_MSK (0x00F00000)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMREN_B5_EN_MAX (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMREN_ELSEIF_ELSEIF_B0_EN_OFF (24)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMREN_ELSEIF_ELSEIF_B0_EN_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMREN_ELSEIF_ELSEIF_B0_EN_MSK (0x0F000000)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMREN_ELSEIF_ELSEIF_B0_EN_MAX (0x0000000F)
+
+#define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMREN_REG (0x00000604)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMREN_B0_EN_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMREN_B0_EN_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMREN_B0_EN_MSK (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMREN_B0_EN_MAX (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMREN_B1_EN_OFF ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMREN_B1_EN_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMREN_B1_EN_MSK (0x000000F0)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMREN_B1_EN_MAX (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMREN_B2_EN_OFF ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMREN_B2_EN_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMREN_B2_EN_MSK (0x00000F00)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMREN_B2_EN_MAX (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMREN_B3_EN_OFF (12)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMREN_B3_EN_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMREN_B3_EN_MSK (0x0000F000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMREN_B3_EN_MAX (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMREN_B4_EN_OFF (16)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMREN_B4_EN_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMREN_B4_EN_MSK (0x000F0000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMREN_B4_EN_MAX (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMREN_B5_EN_OFF (20)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMREN_B5_EN_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMREN_B5_EN_MSK (0x00F00000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMREN_B5_EN_MAX (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMREN_ELSEIF_ELSEIF_B1_EN_OFF (24)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMREN_ELSEIF_ELSEIF_B1_EN_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMREN_ELSEIF_ELSEIF_B1_EN_MSK (0x0F000000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMREN_ELSEIF_ELSEIF_B1_EN_MAX (0x0000000F)
+
+#define GODLAT_CR_G_ODLAT_TIMER_PRELOAD_REG (0x00000608)
+ #define GODLAT_CR_G_ODLAT_TIMER_PRELOAD_Timer0_load_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_TIMER_PRELOAD_Timer0_load_WID ( 5)
+ #define GODLAT_CR_G_ODLAT_TIMER_PRELOAD_Timer0_load_MSK (0x0000001F)
+ #define GODLAT_CR_G_ODLAT_TIMER_PRELOAD_Timer0_load_MAX (0x0000001F)
+ #define GODLAT_CR_G_ODLAT_TIMER_PRELOAD_Timer0_load_DEF (0x00000000)
+ #define GODLAT_CR_G_ODLAT_TIMER_PRELOAD_Timer1_load_OFF ( 5)
+ #define GODLAT_CR_G_ODLAT_TIMER_PRELOAD_Timer1_load_WID ( 5)
+ #define GODLAT_CR_G_ODLAT_TIMER_PRELOAD_Timer1_load_MSK (0x000003E0)
+ #define GODLAT_CR_G_ODLAT_TIMER_PRELOAD_Timer1_load_MAX (0x0000001F)
+ #define GODLAT_CR_G_ODLAT_TIMER_PRELOAD_Timer1_load_DEF (0x00000000)
+ #define GODLAT_CR_G_ODLAT_TIMER_PRELOAD_Timer2_load_OFF (10)
+ #define GODLAT_CR_G_ODLAT_TIMER_PRELOAD_Timer2_load_WID ( 5)
+ #define GODLAT_CR_G_ODLAT_TIMER_PRELOAD_Timer2_load_MSK (0x00007C00)
+ #define GODLAT_CR_G_ODLAT_TIMER_PRELOAD_Timer2_load_MAX (0x0000001F)
+ #define GODLAT_CR_G_ODLAT_TIMER_PRELOAD_Timer2_load_DEF (0x00000000)
+ #define GODLAT_CR_G_ODLAT_TIMER_PRELOAD_Timer3_load_OFF (15)
+ #define GODLAT_CR_G_ODLAT_TIMER_PRELOAD_Timer3_load_WID (16)
+ #define GODLAT_CR_G_ODLAT_TIMER_PRELOAD_Timer3_load_MSK (0x7FFF8000)
+ #define GODLAT_CR_G_ODLAT_TIMER_PRELOAD_Timer3_load_MAX (0x0000FFFF)
+ #define GODLAT_CR_G_ODLAT_TIMER_PRELOAD_Timer3_load_DEF (0x00000000)
+
+#define GODLAT_CR_G_ODLAT_MOT_HDR_HIT_REG (0x0000060C)
+ #define GODLAT_CR_G_ODLAT_MOT_HDR_HIT_MOT_PKT_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_MOT_HDR_HIT_MOT_PKT_WID ( 8)
+ #define GODLAT_CR_G_ODLAT_MOT_HDR_HIT_MOT_PKT_MSK (0x000000FF)
+ #define GODLAT_CR_G_ODLAT_MOT_HDR_HIT_MOT_PKT_MAX (0x000000FF)
+
+#define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMRRST_REG (0x00000610)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMRRST_B0_RST_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMRRST_B0_RST_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMRRST_B0_RST_MSK (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMRRST_B0_RST_MAX (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMRRST_B1_RST_OFF ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMRRST_B1_RST_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMRRST_B1_RST_MSK (0x000000F0)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMRRST_B1_RST_MAX (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMRRST_B2_RST_OFF ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMRRST_B2_RST_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMRRST_B2_RST_MSK (0x00000F00)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMRRST_B2_RST_MAX (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMRRST_B3_RST_OFF (12)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMRRST_B3_RST_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMRRST_B3_RST_MSK (0x0000F000)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMRRST_B3_RST_MAX (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMRRST_B4_RST_OFF (16)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMRRST_B4_RST_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMRRST_B4_RST_MSK (0x000F0000)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMRRST_B4_RST_MAX (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMRRST_B5_RST_OFF (20)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMRRST_B5_RST_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMRRST_B5_RST_MSK (0x00F00000)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMRRST_B5_RST_MAX (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMRRST_ELSEIF_ELSEIF_B0_RST_OFF (24)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMRRST_ELSEIF_ELSEIF_B0_RST_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMRRST_ELSEIF_ELSEIF_B0_RST_MSK (0x0F000000)
+ #define GODLAT_CR_G_ODLAT_TR_IF_MODE_TMRRST_ELSEIF_ELSEIF_B0_RST_MAX (0x0000000F)
+
+#define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMRRST_REG (0x00000614)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMRRST_B0_RST_OFF ( 0)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMRRST_B0_RST_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMRRST_B0_RST_MSK (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMRRST_B0_RST_MAX (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMRRST_B1_RST_OFF ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMRRST_B1_RST_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMRRST_B1_RST_MSK (0x000000F0)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMRRST_B1_RST_MAX (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMRRST_B2_RST_OFF ( 8)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMRRST_B2_RST_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMRRST_B2_RST_MSK (0x00000F00)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMRRST_B2_RST_MAX (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMRRST_B3_RST_OFF (12)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMRRST_B3_RST_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMRRST_B3_RST_MSK (0x0000F000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMRRST_B3_RST_MAX (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMRRST_B4_RST_OFF (16)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMRRST_B4_RST_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMRRST_B4_RST_MSK (0x000F0000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMRRST_B4_RST_MAX (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMRRST_B5_RST_OFF (20)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMRRST_B5_RST_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMRRST_B5_RST_MSK (0x00F00000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMRRST_B5_RST_MAX (0x0000000F)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMRRST_ELSEIF_ELSEIF_B1_RST_OFF (24)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMRRST_ELSEIF_ELSEIF_B1_RST_WID ( 4)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMRRST_ELSEIF_ELSEIF_B1_RST_MSK (0x0F000000)
+ #define GODLAT_CR_G_ODLAT_TR_ELSEIF_MODE_TMRRST_ELSEIF_ELSEIF_B1_RST_MAX (0x0000000F)
+
+#define GDXC_CR_DEBUP_REG (0x00000700)
+ #define GDXC_CR_DEBUP_SPARE_OFF ( 0)
+ #define GDXC_CR_DEBUP_SPARE_WID ( 8)
+ #define GDXC_CR_DEBUP_SPARE_MSK (0x000000FF)
+ #define GDXC_CR_DEBUP_SPARE_MAX (0x000000FF)
+ #define GDXC_CR_DEBUP_SPARE_DEF (0x00000000)
+
+#define MSGUTILS_CR_VISA2OCLA_CFG_REG (0x00000A04)
+ #define MSGUTILS_CR_VISA2OCLA_CFG_Ln0Src_OFF ( 0)
+ #define MSGUTILS_CR_VISA2OCLA_CFG_Ln0Src_WID ( 2)
+ #define MSGUTILS_CR_VISA2OCLA_CFG_Ln0Src_MSK (0x00000003)
+ #define MSGUTILS_CR_VISA2OCLA_CFG_Ln0Src_MAX (0x00000003)
+ #define MSGUTILS_CR_VISA2OCLA_CFG_Ln0Src_DEF (0x00000002)
+ #define MSGUTILS_CR_VISA2OCLA_CFG_Ln1Src_OFF ( 2)
+ #define MSGUTILS_CR_VISA2OCLA_CFG_Ln1Src_WID ( 2)
+ #define MSGUTILS_CR_VISA2OCLA_CFG_Ln1Src_MSK (0x0000000C)
+ #define MSGUTILS_CR_VISA2OCLA_CFG_Ln1Src_MAX (0x00000003)
+ #define MSGUTILS_CR_VISA2OCLA_CFG_Ln1Src_DEF (0x00000002)
+ #define MSGUTILS_CR_VISA2OCLA_CFG_DEVisaEn_OFF ( 4)
+ #define MSGUTILS_CR_VISA2OCLA_CFG_DEVisaEn_WID ( 1)
+ #define MSGUTILS_CR_VISA2OCLA_CFG_DEVisaEn_MSK (0x00000010)
+ #define MSGUTILS_CR_VISA2OCLA_CFG_DEVisaEn_MAX (0x00000001)
+ #define MSGUTILS_CR_VISA2OCLA_CFG_DEVisaEn_DEF (0x00000000)
+
+#pragma pack(pop)
+#endif // __McGdxcbar_h__
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/McIoCkeCtl.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/McIoCkeCtl.h
new file mode 100644
index 0000000..45afcc5
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/McIoCkeCtl.h
@@ -0,0 +1,2594 @@
+/** @file
+ This file was automatically generated. Modify at your own risk.
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef __McIoCkeCtl_h__
+#define __McIoCkeCtl_h__
+
+#pragma pack(push, 1)
+#include "MrcTypes.h"
+
+typedef union {
+ struct {
+ U32 Scomp : 6; // Bits 5:0
+ U32 TcoComp : 6; // Bits 11:6
+ U32 RcompDrvUp : 6; // Bits 17:12
+ U32 RcompDrvDown : 6; // Bits 23:18
+ U32 LsComp : 3; // Bits 26:24
+ U32 Spare : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCKECTL_CR_DDRCRCTLCOMP_STRUCT;
+
+typedef union {
+ struct {
+ U32 ScompOffset : 5; // Bits 4:0
+ U32 TcoCompOffset : 4; // Bits 8:5
+ U32 RcompDrvUpOffset : 4; // Bits 12:9
+ U32 RcompDrvDownOffset : 4; // Bits 16:13
+ U32 Spare : 15; // Bits 31:17
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCKECTL_CR_DDRCRCTLCOMPOFFSET_STRUCT;
+
+typedef union {
+ struct {
+ U32 CtlPiCode0 : 7; // Bits 6:0
+ U32 CtlPiCode1 : 7; // Bits 13:7
+ U32 CtlPiCode2 : 7; // Bits 20:14
+ U32 CtlPiCode3 : 7; // Bits 27:21
+ U32 CtlXoverEnable : 1; // Bits 28:28
+ U32 Spare : 3; // Bits 31:29
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCKECTL_CR_DDRCRCTLPICODING_STRUCT;
+
+typedef union {
+ struct {
+ U32 RefPi : 4; // Bits 3:0
+ U32 DllMask : 2; // Bits 5:4
+ U32 DllRsvd1 : 1; // Bits 6:6
+ U32 TxOn : 1; // Bits 7:7
+ U32 IntClkOn : 1; // Bits 8:8
+ U32 RepClkOn : 1; // Bits 9:9
+ U32 IOLBCtl : 2; // Bits 11:10
+ U32 OdtMode : 1; // Bits 12:12
+ U32 CmdTxEq : 2; // Bits 14:13
+ U32 EarlyWeakDrive : 2; // Bits 16:15
+ U32 CtlTxEq : 2; // Bits 18:17
+ U32 CtlSRDrv : 2; // Bits 20:19
+ U32 RxVref : 6; // Bits 26:21
+ U32 VccddqHi : 1; // Bits 27:27
+ U32 DllWeakLock : 1; // Bits 28:28
+ U32 LPDDR_Mode : 1; // Bits 29:29
+ U32 LaDrvEnOvrd : 1; // Bits 30:30
+ U32 LPDdrCAA_Dis : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCKECTL_CR_DDRCRCTLCONTROLS_STRUCT;
+
+typedef union {
+ struct {
+ U32 RankEn : 4; // Bits 3:0
+ U32 OdtDisable : 2; // Bits 5:4
+ U32 Spare : 26; // Bits 31:6
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCKECTL_CR_DDRCRCTLRANKSUSED_STRUCT;
+
+typedef union {
+ struct {
+ U32 RunTest : 1; // Bits 0:0
+ U32 Load : 1; // Bits 1:1
+ U32 ModeHVM : 1; // Bits 2:2
+ U32 ModeDV : 1; // Bits 3:3
+ U32 ModeADC : 1; // Bits 4:4
+ U32 LoadCount : 10; // Bits 14:5
+ U32 CountStatus : 10; // Bits 24:15
+ U32 Spare : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCKECTL_CR_DLLPITESTANDADC_STRUCT;
+
+typedef union {
+ struct {
+ U32 Scomp : 6; // Bits 5:0
+ U32 TcoComp : 6; // Bits 11:6
+ U32 RcompDrvUp : 6; // Bits 17:12
+ U32 RcompDrvDown : 6; // Bits 23:18
+ U32 LsComp : 3; // Bits 26:24
+ U32 Spare : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCKECTLCH0_CR_DDRCRCTLCOMP_STRUCT;
+
+typedef union {
+ struct {
+ U32 ScompOffset : 5; // Bits 4:0
+ U32 TcoCompOffset : 4; // Bits 8:5
+ U32 RcompDrvUpOffset : 4; // Bits 12:9
+ U32 RcompDrvDownOffset : 4; // Bits 16:13
+ U32 Spare : 15; // Bits 31:17
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCKECTLCH0_CR_DDRCRCTLCOMPOFFSET_STRUCT;
+
+typedef union {
+ struct {
+ U32 CtlPiCode0 : 7; // Bits 6:0
+ U32 CtlPiCode1 : 7; // Bits 13:7
+ U32 CtlPiCode2 : 7; // Bits 20:14
+ U32 CtlPiCode3 : 7; // Bits 27:21
+ U32 CtlXoverEnable : 1; // Bits 28:28
+ U32 Spare : 3; // Bits 31:29
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCKECTLCH0_CR_DDRCRCTLPICODING_STRUCT;
+
+typedef union {
+ struct {
+ U32 RefPi : 4; // Bits 3:0
+ U32 DllMask : 2; // Bits 5:4
+ U32 DllRsvd1 : 1; // Bits 6:6
+ U32 TxOn : 1; // Bits 7:7
+ U32 IntClkOn : 1; // Bits 8:8
+ U32 RepClkOn : 1; // Bits 9:9
+ U32 IOLBCtl : 2; // Bits 11:10
+ U32 OdtMode : 1; // Bits 12:12
+ U32 CmdTxEq : 2; // Bits 14:13
+ U32 EarlyWeakDrive : 2; // Bits 16:15
+ U32 CtlTxEq : 2; // Bits 18:17
+ U32 CtlSRDrv : 2; // Bits 20:19
+ U32 RxVref : 6; // Bits 26:21
+ U32 VccddqHi : 1; // Bits 27:27
+ U32 DllWeakLock : 1; // Bits 28:28
+ U32 LPDDR_Mode : 1; // Bits 29:29
+ U32 LaDrvEnOvrd : 1; // Bits 30:30
+ U32 LPDdrCAA_Dis : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_STRUCT;
+
+typedef union {
+ struct {
+ U32 RankEn : 4; // Bits 3:0
+ U32 OdtDisable : 2; // Bits 5:4
+ U32 Spare : 26; // Bits 31:6
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCKECTLCH0_CR_DDRCRCTLRANKSUSED_STRUCT;
+
+typedef union {
+ struct {
+ U32 RunTest : 1; // Bits 0:0
+ U32 Load : 1; // Bits 1:1
+ U32 ModeHVM : 1; // Bits 2:2
+ U32 ModeDV : 1; // Bits 3:3
+ U32 ModeADC : 1; // Bits 4:4
+ U32 LoadCount : 10; // Bits 14:5
+ U32 CountStatus : 10; // Bits 24:15
+ U32 Spare : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCKECTLCH0_CR_DLLPITESTANDADC_STRUCT;
+
+typedef union {
+ struct {
+ U32 Scomp : 6; // Bits 5:0
+ U32 TcoComp : 6; // Bits 11:6
+ U32 RcompDrvUp : 6; // Bits 17:12
+ U32 RcompDrvDown : 6; // Bits 23:18
+ U32 LsComp : 3; // Bits 26:24
+ U32 Spare : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCKECTLCH1_CR_DDRCRCTLCOMP_STRUCT;
+
+typedef union {
+ struct {
+ U32 ScompOffset : 5; // Bits 4:0
+ U32 TcoCompOffset : 4; // Bits 8:5
+ U32 RcompDrvUpOffset : 4; // Bits 12:9
+ U32 RcompDrvDownOffset : 4; // Bits 16:13
+ U32 Spare : 15; // Bits 31:17
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCKECTLCH1_CR_DDRCRCTLCOMPOFFSET_STRUCT;
+
+typedef union {
+ struct {
+ U32 CtlPiCode0 : 7; // Bits 6:0
+ U32 CtlPiCode1 : 7; // Bits 13:7
+ U32 CtlPiCode2 : 7; // Bits 20:14
+ U32 CtlPiCode3 : 7; // Bits 27:21
+ U32 CtlXoverEnable : 1; // Bits 28:28
+ U32 Spare : 3; // Bits 31:29
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCKECTLCH1_CR_DDRCRCTLPICODING_STRUCT;
+
+typedef union {
+ struct {
+ U32 RefPi : 4; // Bits 3:0
+ U32 DllMask : 2; // Bits 5:4
+ U32 DllRsvd1 : 1; // Bits 6:6
+ U32 TxOn : 1; // Bits 7:7
+ U32 IntClkOn : 1; // Bits 8:8
+ U32 RepClkOn : 1; // Bits 9:9
+ U32 IOLBCtl : 2; // Bits 11:10
+ U32 OdtMode : 1; // Bits 12:12
+ U32 CmdTxEq : 2; // Bits 14:13
+ U32 EarlyWeakDrive : 2; // Bits 16:15
+ U32 CtlTxEq : 2; // Bits 18:17
+ U32 CtlSRDrv : 2; // Bits 20:19
+ U32 RxVref : 6; // Bits 26:21
+ U32 VccddqHi : 1; // Bits 27:27
+ U32 DllWeakLock : 1; // Bits 28:28
+ U32 LPDDR_Mode : 1; // Bits 29:29
+ U32 LaDrvEnOvrd : 1; // Bits 30:30
+ U32 LPDdrCAA_Dis : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_STRUCT;
+
+typedef union {
+ struct {
+ U32 RankEn : 4; // Bits 3:0
+ U32 OdtDisable : 2; // Bits 5:4
+ U32 Spare : 26; // Bits 31:6
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCKECTLCH1_CR_DDRCRCTLRANKSUSED_STRUCT;
+
+typedef union {
+ struct {
+ U32 RunTest : 1; // Bits 0:0
+ U32 Load : 1; // Bits 1:1
+ U32 ModeHVM : 1; // Bits 2:2
+ U32 ModeDV : 1; // Bits 3:3
+ U32 ModeADC : 1; // Bits 4:4
+ U32 LoadCount : 10; // Bits 14:5
+ U32 CountStatus : 10; // Bits 24:15
+ U32 Spare : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCKECTLCH1_CR_DLLPITESTANDADC_STRUCT;
+
+typedef union {
+ struct {
+ U32 Scomp : 6; // Bits 5:0
+ U32 TcoComp : 6; // Bits 11:6
+ U32 RcompDrvUp : 6; // Bits 17:12
+ U32 RcompDrvDown : 6; // Bits 23:18
+ U32 LsComp : 3; // Bits 26:24
+ U32 Spare : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCKECH0_CR_DDRCRCMDCOMP_STRUCT;
+
+typedef union {
+ struct {
+ U32 ScompOffset : 5; // Bits 4:0
+ U32 TcoCompOffset : 4; // Bits 8:5
+ U32 RcompDrvUpOffset : 4; // Bits 12:9
+ U32 RcompDrvDownOffset : 4; // Bits 16:13
+ U32 Spare : 15; // Bits 31:17
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCKECH0_CR_DDRCRCMDCOMPOFFSET_STRUCT;
+
+typedef union {
+ struct {
+ U32 CmdPi0Code : 7; // Bits 6:0
+ U32 CmdPi1Code : 7; // Bits 13:7
+ U32 Spare : 18; // Bits 31:14
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCKECH0_CR_DDRCRCMDPICODING_STRUCT;
+
+typedef union {
+ struct {
+ U32 Scomp : 6; // Bits 5:0
+ U32 TcoComp : 6; // Bits 11:6
+ U32 RcompDrvUp : 6; // Bits 17:12
+ U32 RcompDrvDown : 6; // Bits 23:18
+ U32 LsComp : 3; // Bits 26:24
+ U32 Spare : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCKECH0_CR_DDRCRCTLCOMP_STRUCT;
+
+typedef union {
+ struct {
+ U32 ScompOffset : 5; // Bits 4:0
+ U32 TcoCompOffset : 4; // Bits 8:5
+ U32 RcompDrvUpOffset : 4; // Bits 12:9
+ U32 RcompDrvDownOffset : 4; // Bits 16:13
+ U32 Spare : 15; // Bits 31:17
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCKECH0_CR_DDRCRCTLCOMPOFFSET_STRUCT;
+
+typedef union {
+ struct {
+ U32 CtlPiCode0 : 7; // Bits 6:0
+ U32 CtlPiCode1 : 7; // Bits 13:7
+ U32 CtlPiCode2 : 7; // Bits 20:14
+ U32 CtlPiCode3 : 7; // Bits 27:21
+ U32 CtlXoverEnable : 1; // Bits 28:28
+ U32 Spare : 3; // Bits 31:29
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCKECH0_CR_DDRCRCTLPICODING_STRUCT;
+
+typedef union {
+ struct {
+ U32 RefPi : 4; // Bits 3:0
+ U32 DllMask : 2; // Bits 5:4
+ U32 DllRsvd1 : 1; // Bits 6:6
+ U32 TxOn : 1; // Bits 7:7
+ U32 IntClkOn : 1; // Bits 8:8
+ U32 RepClkOn : 1; // Bits 9:9
+ U32 IOLBCtl : 2; // Bits 11:10
+ U32 OdtMode : 1; // Bits 12:12
+ U32 CmdTxEq : 2; // Bits 14:13
+ U32 EarlyWeakDrive : 2; // Bits 16:15
+ U32 CtlTxEq : 2; // Bits 18:17
+ U32 CtlSRDrv : 2; // Bits 20:19
+ U32 RxVref : 6; // Bits 26:21
+ U32 VccddqHi : 1; // Bits 27:27
+ U32 DllWeakLock : 1; // Bits 28:28
+ U32 LPDDR_Mode : 1; // Bits 29:29
+ U32 LaDrvEnOvrd : 1; // Bits 30:30
+ U32 LPDdrCAA_Dis : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCKECH0_CR_DDRCRCTLCONTROLS_STRUCT;
+
+typedef union {
+ struct {
+ U32 RankEn : 4; // Bits 3:0
+ U32 OdtDisable : 2; // Bits 5:4
+ U32 Spare : 26; // Bits 31:6
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCKECH0_CR_DDRCRCTLRANKSUSED_STRUCT;
+
+typedef union {
+ struct {
+ U32 RunTest : 1; // Bits 0:0
+ U32 Load : 1; // Bits 1:1
+ U32 ModeHVM : 1; // Bits 2:2
+ U32 ModeDV : 1; // Bits 3:3
+ U32 ModeADC : 1; // Bits 4:4
+ U32 LoadCount : 10; // Bits 14:5
+ U32 CountStatus : 10; // Bits 24:15
+ U32 Spare : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCKECH0_CR_DLLPITESTANDADC_STRUCT;
+
+typedef union {
+ struct {
+ U32 Scomp : 6; // Bits 5:0
+ U32 TcoComp : 6; // Bits 11:6
+ U32 RcompDrvUp : 6; // Bits 17:12
+ U32 RcompDrvDown : 6; // Bits 23:18
+ U32 LsComp : 3; // Bits 26:24
+ U32 Spare : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCKECH1_CR_DDRCRCMDCOMP_STRUCT;
+
+typedef union {
+ struct {
+ U32 ScompOffset : 5; // Bits 4:0
+ U32 TcoCompOffset : 4; // Bits 8:5
+ U32 RcompDrvUpOffset : 4; // Bits 12:9
+ U32 RcompDrvDownOffset : 4; // Bits 16:13
+ U32 Spare : 15; // Bits 31:17
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCKECH1_CR_DDRCRCMDCOMPOFFSET_STRUCT;
+
+typedef union {
+ struct {
+ U32 CmdPi0Code : 7; // Bits 6:0
+ U32 CmdPi1Code : 7; // Bits 13:7
+ U32 Spare : 18; // Bits 31:14
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCKECH1_CR_DDRCRCMDPICODING_STRUCT;
+
+typedef union {
+ struct {
+ U32 Scomp : 6; // Bits 5:0
+ U32 TcoComp : 6; // Bits 11:6
+ U32 RcompDrvUp : 6; // Bits 17:12
+ U32 RcompDrvDown : 6; // Bits 23:18
+ U32 LsComp : 3; // Bits 26:24
+ U32 Spare : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCKECH1_CR_DDRCRCTLCOMP_STRUCT;
+
+typedef union {
+ struct {
+ U32 ScompOffset : 5; // Bits 4:0
+ U32 TcoCompOffset : 4; // Bits 8:5
+ U32 RcompDrvUpOffset : 4; // Bits 12:9
+ U32 RcompDrvDownOffset : 4; // Bits 16:13
+ U32 Spare : 15; // Bits 31:17
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCKECH1_CR_DDRCRCTLCOMPOFFSET_STRUCT;
+
+typedef union {
+ struct {
+ U32 CtlPiCode0 : 7; // Bits 6:0
+ U32 CtlPiCode1 : 7; // Bits 13:7
+ U32 CtlPiCode2 : 7; // Bits 20:14
+ U32 CtlPiCode3 : 7; // Bits 27:21
+ U32 CtlXoverEnable : 1; // Bits 28:28
+ U32 Spare : 3; // Bits 31:29
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCKECH1_CR_DDRCRCTLPICODING_STRUCT;
+
+typedef union {
+ struct {
+ U32 RefPi : 4; // Bits 3:0
+ U32 DllMask : 2; // Bits 5:4
+ U32 DllRsvd1 : 1; // Bits 6:6
+ U32 TxOn : 1; // Bits 7:7
+ U32 IntClkOn : 1; // Bits 8:8
+ U32 RepClkOn : 1; // Bits 9:9
+ U32 IOLBCtl : 2; // Bits 11:10
+ U32 OdtMode : 1; // Bits 12:12
+ U32 CmdTxEq : 2; // Bits 14:13
+ U32 EarlyWeakDrive : 2; // Bits 16:15
+ U32 CtlTxEq : 2; // Bits 18:17
+ U32 CtlSRDrv : 2; // Bits 20:19
+ U32 RxVref : 6; // Bits 26:21
+ U32 VccddqHi : 1; // Bits 27:27
+ U32 DllWeakLock : 1; // Bits 28:28
+ U32 LPDDR_Mode : 1; // Bits 29:29
+ U32 LaDrvEnOvrd : 1; // Bits 30:30
+ U32 LPDdrCAA_Dis : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCKECH1_CR_DDRCRCTLCONTROLS_STRUCT;
+
+typedef union {
+ struct {
+ U32 RankEn : 4; // Bits 3:0
+ U32 OdtDisable : 2; // Bits 5:4
+ U32 Spare : 26; // Bits 31:6
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCKECH1_CR_DDRCRCTLRANKSUSED_STRUCT;
+
+typedef union {
+ struct {
+ U32 RunTest : 1; // Bits 0:0
+ U32 Load : 1; // Bits 1:1
+ U32 ModeHVM : 1; // Bits 2:2
+ U32 ModeDV : 1; // Bits 3:3
+ U32 ModeADC : 1; // Bits 4:4
+ U32 LoadCount : 10; // Bits 14:5
+ U32 CountStatus : 10; // Bits 24:15
+ U32 Spare : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCKECH1_CR_DLLPITESTANDADC_STRUCT;
+
+typedef union {
+ struct {
+ U32 Scomp : 6; // Bits 5:0
+ U32 TcoComp : 6; // Bits 11:6
+ U32 RcompDrvUp : 6; // Bits 17:12
+ U32 RcompDrvDown : 6; // Bits 23:18
+ U32 LsComp : 3; // Bits 26:24
+ U32 Spare : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCTLCH0_CR_DDRCRCTLCOMP_STRUCT;
+
+typedef union {
+ struct {
+ U32 ScompOffset : 5; // Bits 4:0
+ U32 TcoCompOffset : 4; // Bits 8:5
+ U32 RcompDrvUpOffset : 4; // Bits 12:9
+ U32 RcompDrvDownOffset : 4; // Bits 16:13
+ U32 Spare : 15; // Bits 31:17
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCTLCH0_CR_DDRCRCTLCOMPOFFSET_STRUCT;
+
+typedef union {
+ struct {
+ U32 CtlPiCode0 : 7; // Bits 6:0
+ U32 CtlPiCode1 : 7; // Bits 13:7
+ U32 CtlPiCode2 : 7; // Bits 20:14
+ U32 CtlPiCode3 : 7; // Bits 27:21
+ U32 CtlXoverEnable : 1; // Bits 28:28
+ U32 Spare : 3; // Bits 31:29
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCTLCH0_CR_DDRCRCTLPICODING_STRUCT;
+
+typedef union {
+ struct {
+ U32 RefPi : 4; // Bits 3:0
+ U32 DllMask : 2; // Bits 5:4
+ U32 DllRsvd1 : 1; // Bits 6:6
+ U32 TxOn : 1; // Bits 7:7
+ U32 IntClkOn : 1; // Bits 8:8
+ U32 RepClkOn : 1; // Bits 9:9
+ U32 IOLBCtl : 2; // Bits 11:10
+ U32 OdtMode : 1; // Bits 12:12
+ U32 CmdTxEq : 2; // Bits 14:13
+ U32 EarlyWeakDrive : 2; // Bits 16:15
+ U32 CtlTxEq : 2; // Bits 18:17
+ U32 CtlSRDrv : 2; // Bits 20:19
+ U32 RxVref : 6; // Bits 26:21
+ U32 VccddqHi : 1; // Bits 27:27
+ U32 DllWeakLock : 1; // Bits 28:28
+ U32 LPDDR_Mode : 1; // Bits 29:29
+ U32 LaDrvEnOvrd : 1; // Bits 30:30
+ U32 LPDdrCAA_Dis : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCTLCH0_CR_DDRCRCTLCONTROLS_STRUCT;
+
+typedef union {
+ struct {
+ U32 RankEn : 4; // Bits 3:0
+ U32 OdtDisable : 2; // Bits 5:4
+ U32 Spare : 26; // Bits 31:6
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCTLCH0_CR_DDRCRCTLRANKSUSED_STRUCT;
+
+typedef union {
+ struct {
+ U32 RunTest : 1; // Bits 0:0
+ U32 Load : 1; // Bits 1:1
+ U32 ModeHVM : 1; // Bits 2:2
+ U32 ModeDV : 1; // Bits 3:3
+ U32 ModeADC : 1; // Bits 4:4
+ U32 LoadCount : 10; // Bits 14:5
+ U32 CountStatus : 10; // Bits 24:15
+ U32 Spare : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCTLCH0_CR_DLLPITESTANDADC_STRUCT;
+
+typedef union {
+ struct {
+ U32 Scomp : 6; // Bits 5:0
+ U32 TcoComp : 6; // Bits 11:6
+ U32 RcompDrvUp : 6; // Bits 17:12
+ U32 RcompDrvDown : 6; // Bits 23:18
+ U32 LsComp : 3; // Bits 26:24
+ U32 Spare : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCTLCH1_CR_DDRCRCTLCOMP_STRUCT;
+
+typedef union {
+ struct {
+ U32 ScompOffset : 5; // Bits 4:0
+ U32 TcoCompOffset : 4; // Bits 8:5
+ U32 RcompDrvUpOffset : 4; // Bits 12:9
+ U32 RcompDrvDownOffset : 4; // Bits 16:13
+ U32 Spare : 15; // Bits 31:17
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCTLCH1_CR_DDRCRCTLCOMPOFFSET_STRUCT;
+
+typedef union {
+ struct {
+ U32 CtlPiCode0 : 7; // Bits 6:0
+ U32 CtlPiCode1 : 7; // Bits 13:7
+ U32 CtlPiCode2 : 7; // Bits 20:14
+ U32 CtlPiCode3 : 7; // Bits 27:21
+ U32 CtlXoverEnable : 1; // Bits 28:28
+ U32 Spare : 3; // Bits 31:29
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCTLCH1_CR_DDRCRCTLPICODING_STRUCT;
+
+typedef union {
+ struct {
+ U32 RefPi : 4; // Bits 3:0
+ U32 DllMask : 2; // Bits 5:4
+ U32 DllRsvd1 : 1; // Bits 6:6
+ U32 TxOn : 1; // Bits 7:7
+ U32 IntClkOn : 1; // Bits 8:8
+ U32 RepClkOn : 1; // Bits 9:9
+ U32 IOLBCtl : 2; // Bits 11:10
+ U32 OdtMode : 1; // Bits 12:12
+ U32 CmdTxEq : 2; // Bits 14:13
+ U32 EarlyWeakDrive : 2; // Bits 16:15
+ U32 CtlTxEq : 2; // Bits 18:17
+ U32 CtlSRDrv : 2; // Bits 20:19
+ U32 RxVref : 6; // Bits 26:21
+ U32 VccddqHi : 1; // Bits 27:27
+ U32 DllWeakLock : 1; // Bits 28:28
+ U32 LPDDR_Mode : 1; // Bits 29:29
+ U32 LaDrvEnOvrd : 1; // Bits 30:30
+ U32 LPDdrCAA_Dis : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCTLCH1_CR_DDRCRCTLCONTROLS_STRUCT;
+
+typedef union {
+ struct {
+ U32 RankEn : 4; // Bits 3:0
+ U32 OdtDisable : 2; // Bits 5:4
+ U32 Spare : 26; // Bits 31:6
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCTLCH1_CR_DDRCRCTLRANKSUSED_STRUCT;
+
+typedef union {
+ struct {
+ U32 RunTest : 1; // Bits 0:0
+ U32 Load : 1; // Bits 1:1
+ U32 ModeHVM : 1; // Bits 2:2
+ U32 ModeDV : 1; // Bits 3:3
+ U32 ModeADC : 1; // Bits 4:4
+ U32 LoadCount : 10; // Bits 14:5
+ U32 CountStatus : 10; // Bits 24:15
+ U32 Spare : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCTLCH1_CR_DLLPITESTANDADC_STRUCT;
+
+#define DDRCKECTL_CR_DDRCRCTLCOMP_REG (0x00003810)
+ #define DDRCKECTL_CR_DDRCRCTLCOMP_Scomp_OFF ( 0)
+ #define DDRCKECTL_CR_DDRCRCTLCOMP_Scomp_WID ( 6)
+ #define DDRCKECTL_CR_DDRCRCTLCOMP_Scomp_MSK (0x0000003F)
+ #define DDRCKECTL_CR_DDRCRCTLCOMP_Scomp_MAX (0x0000003F)
+ #define DDRCKECTL_CR_DDRCRCTLCOMP_Scomp_DEF (0x00000000)
+ #define DDRCKECTL_CR_DDRCRCTLCOMP_TcoComp_OFF ( 6)
+ #define DDRCKECTL_CR_DDRCRCTLCOMP_TcoComp_WID ( 6)
+ #define DDRCKECTL_CR_DDRCRCTLCOMP_TcoComp_MSK (0x00000FC0)
+ #define DDRCKECTL_CR_DDRCRCTLCOMP_TcoComp_MAX (0x0000003F)
+ #define DDRCKECTL_CR_DDRCRCTLCOMP_TcoComp_DEF (0x00000000)
+ #define DDRCKECTL_CR_DDRCRCTLCOMP_RcompDrvUp_OFF (12)
+ #define DDRCKECTL_CR_DDRCRCTLCOMP_RcompDrvUp_WID ( 6)
+ #define DDRCKECTL_CR_DDRCRCTLCOMP_RcompDrvUp_MSK (0x0003F000)
+ #define DDRCKECTL_CR_DDRCRCTLCOMP_RcompDrvUp_MAX (0x0000003F)
+ #define DDRCKECTL_CR_DDRCRCTLCOMP_RcompDrvUp_DEF (0x00000000)
+ #define DDRCKECTL_CR_DDRCRCTLCOMP_RcompDrvDown_OFF (18)
+ #define DDRCKECTL_CR_DDRCRCTLCOMP_RcompDrvDown_WID ( 6)
+ #define DDRCKECTL_CR_DDRCRCTLCOMP_RcompDrvDown_MSK (0x00FC0000)
+ #define DDRCKECTL_CR_DDRCRCTLCOMP_RcompDrvDown_MAX (0x0000003F)
+ #define DDRCKECTL_CR_DDRCRCTLCOMP_RcompDrvDown_DEF (0x00000000)
+ #define DDRCKECTL_CR_DDRCRCTLCOMP_LsComp_OFF (24)
+ #define DDRCKECTL_CR_DDRCRCTLCOMP_LsComp_WID ( 3)
+ #define DDRCKECTL_CR_DDRCRCTLCOMP_LsComp_MSK (0x07000000)
+ #define DDRCKECTL_CR_DDRCRCTLCOMP_LsComp_MAX (0x00000007)
+ #define DDRCKECTL_CR_DDRCRCTLCOMP_LsComp_DEF (0x00000000)
+ #define DDRCKECTL_CR_DDRCRCTLCOMP_Spare_OFF (27)
+ #define DDRCKECTL_CR_DDRCRCTLCOMP_Spare_WID ( 5)
+ #define DDRCKECTL_CR_DDRCRCTLCOMP_Spare_MSK (0xF8000000)
+ #define DDRCKECTL_CR_DDRCRCTLCOMP_Spare_MAX (0x0000001F)
+ #define DDRCKECTL_CR_DDRCRCTLCOMP_Spare_DEF (0x00000000)
+
+#define DDRCKECTL_CR_DDRCRCTLCOMPOFFSET_REG (0x00003814)
+ #define DDRCKECTL_CR_DDRCRCTLCOMPOFFSET_ScompOffset_OFF ( 0)
+ #define DDRCKECTL_CR_DDRCRCTLCOMPOFFSET_ScompOffset_WID ( 5)
+ #define DDRCKECTL_CR_DDRCRCTLCOMPOFFSET_ScompOffset_MSK (0x0000001F)
+ #define DDRCKECTL_CR_DDRCRCTLCOMPOFFSET_ScompOffset_MAX (0x0000001F)
+ #define DDRCKECTL_CR_DDRCRCTLCOMPOFFSET_ScompOffset_DEF (0x00000000)
+ #define DDRCKECTL_CR_DDRCRCTLCOMPOFFSET_TcoCompOffset_OFF ( 5)
+ #define DDRCKECTL_CR_DDRCRCTLCOMPOFFSET_TcoCompOffset_WID ( 4)
+ #define DDRCKECTL_CR_DDRCRCTLCOMPOFFSET_TcoCompOffset_MSK (0x000001E0)
+ #define DDRCKECTL_CR_DDRCRCTLCOMPOFFSET_TcoCompOffset_MAX (0x0000000F)
+ #define DDRCKECTL_CR_DDRCRCTLCOMPOFFSET_TcoCompOffset_DEF (0x00000000)
+ #define DDRCKECTL_CR_DDRCRCTLCOMPOFFSET_RcompDrvUpOffset_OFF ( 9)
+ #define DDRCKECTL_CR_DDRCRCTLCOMPOFFSET_RcompDrvUpOffset_WID ( 4)
+ #define DDRCKECTL_CR_DDRCRCTLCOMPOFFSET_RcompDrvUpOffset_MSK (0x00001E00)
+ #define DDRCKECTL_CR_DDRCRCTLCOMPOFFSET_RcompDrvUpOffset_MAX (0x0000000F)
+ #define DDRCKECTL_CR_DDRCRCTLCOMPOFFSET_RcompDrvUpOffset_DEF (0x00000000)
+ #define DDRCKECTL_CR_DDRCRCTLCOMPOFFSET_RcompDrvDownOffset_OFF (13)
+ #define DDRCKECTL_CR_DDRCRCTLCOMPOFFSET_RcompDrvDownOffset_WID ( 4)
+ #define DDRCKECTL_CR_DDRCRCTLCOMPOFFSET_RcompDrvDownOffset_MSK (0x0001E000)
+ #define DDRCKECTL_CR_DDRCRCTLCOMPOFFSET_RcompDrvDownOffset_MAX (0x0000000F)
+ #define DDRCKECTL_CR_DDRCRCTLCOMPOFFSET_RcompDrvDownOffset_DEF (0x00000000)
+ #define DDRCKECTL_CR_DDRCRCTLCOMPOFFSET_Spare_OFF (17)
+ #define DDRCKECTL_CR_DDRCRCTLCOMPOFFSET_Spare_WID (15)
+ #define DDRCKECTL_CR_DDRCRCTLCOMPOFFSET_Spare_MSK (0xFFFE0000)
+ #define DDRCKECTL_CR_DDRCRCTLCOMPOFFSET_Spare_MAX (0x00007FFF)
+ #define DDRCKECTL_CR_DDRCRCTLCOMPOFFSET_Spare_DEF (0x00000000)
+
+#define DDRCKECTL_CR_DDRCRCTLPICODING_REG (0x00003818)
+ #define DDRCKECTL_CR_DDRCRCTLPICODING_CtlPiCode0_OFF ( 0)
+ #define DDRCKECTL_CR_DDRCRCTLPICODING_CtlPiCode0_WID ( 7)
+ #define DDRCKECTL_CR_DDRCRCTLPICODING_CtlPiCode0_MSK (0x0000007F)
+ #define DDRCKECTL_CR_DDRCRCTLPICODING_CtlPiCode0_MAX (0x0000007F)
+ #define DDRCKECTL_CR_DDRCRCTLPICODING_CtlPiCode0_DEF (0x00000000)
+ #define DDRCKECTL_CR_DDRCRCTLPICODING_CtlPiCode1_OFF ( 7)
+ #define DDRCKECTL_CR_DDRCRCTLPICODING_CtlPiCode1_WID ( 7)
+ #define DDRCKECTL_CR_DDRCRCTLPICODING_CtlPiCode1_MSK (0x00003F80)
+ #define DDRCKECTL_CR_DDRCRCTLPICODING_CtlPiCode1_MAX (0x0000007F)
+ #define DDRCKECTL_CR_DDRCRCTLPICODING_CtlPiCode1_DEF (0x00000000)
+ #define DDRCKECTL_CR_DDRCRCTLPICODING_CtlPiCode2_OFF (14)
+ #define DDRCKECTL_CR_DDRCRCTLPICODING_CtlPiCode2_WID ( 7)
+ #define DDRCKECTL_CR_DDRCRCTLPICODING_CtlPiCode2_MSK (0x001FC000)
+ #define DDRCKECTL_CR_DDRCRCTLPICODING_CtlPiCode2_MAX (0x0000007F)
+ #define DDRCKECTL_CR_DDRCRCTLPICODING_CtlPiCode2_DEF (0x00000000)
+ #define DDRCKECTL_CR_DDRCRCTLPICODING_CtlPiCode3_OFF (21)
+ #define DDRCKECTL_CR_DDRCRCTLPICODING_CtlPiCode3_WID ( 7)
+ #define DDRCKECTL_CR_DDRCRCTLPICODING_CtlPiCode3_MSK (0x0FE00000)
+ #define DDRCKECTL_CR_DDRCRCTLPICODING_CtlPiCode3_MAX (0x0000007F)
+ #define DDRCKECTL_CR_DDRCRCTLPICODING_CtlPiCode3_DEF (0x00000000)
+ #define DDRCKECTL_CR_DDRCRCTLPICODING_CtlXoverEnable_OFF (28)
+ #define DDRCKECTL_CR_DDRCRCTLPICODING_CtlXoverEnable_WID ( 1)
+ #define DDRCKECTL_CR_DDRCRCTLPICODING_CtlXoverEnable_MSK (0x10000000)
+ #define DDRCKECTL_CR_DDRCRCTLPICODING_CtlXoverEnable_MAX (0x00000001)
+ #define DDRCKECTL_CR_DDRCRCTLPICODING_CtlXoverEnable_DEF (0x00000000)
+ #define DDRCKECTL_CR_DDRCRCTLPICODING_Spare_OFF (29)
+ #define DDRCKECTL_CR_DDRCRCTLPICODING_Spare_WID ( 3)
+ #define DDRCKECTL_CR_DDRCRCTLPICODING_Spare_MSK (0xE0000000)
+ #define DDRCKECTL_CR_DDRCRCTLPICODING_Spare_MAX (0x00000007)
+ #define DDRCKECTL_CR_DDRCRCTLPICODING_Spare_DEF (0x00000000)
+
+#define DDRCKECTL_CR_DDRCRCTLCONTROLS_REG (0x0000381C)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_RefPi_OFF ( 0)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_RefPi_WID ( 4)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_RefPi_MSK (0x0000000F)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_RefPi_MAX (0x0000000F)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_RefPi_DEF (0x00000000)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_DllMask_OFF ( 4)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_DllMask_WID ( 2)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_DllMask_MSK (0x00000030)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_DllMask_MAX (0x00000003)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_DllMask_DEF (0x00000000)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_DllRsvd1_OFF ( 6)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_DllRsvd1_WID ( 1)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_DllRsvd1_MSK (0x00000040)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_DllRsvd1_MAX (0x00000001)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_DllRsvd1_DEF (0x00000000)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_TxOn_OFF ( 7)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_TxOn_WID ( 1)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_TxOn_MSK (0x00000080)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_TxOn_MAX (0x00000001)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_TxOn_DEF (0x00000000)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_IntClkOn_OFF ( 8)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_IntClkOn_WID ( 1)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_IntClkOn_MSK (0x00000100)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_IntClkOn_MAX (0x00000001)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_IntClkOn_DEF (0x00000000)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_RepClkOn_OFF ( 9)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_RepClkOn_WID ( 1)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_RepClkOn_MSK (0x00000200)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_RepClkOn_MAX (0x00000001)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_RepClkOn_DEF (0x00000000)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_IOLBCtl_OFF (10)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_IOLBCtl_WID ( 2)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_IOLBCtl_MSK (0x00000C00)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_IOLBCtl_MAX (0x00000003)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_IOLBCtl_DEF (0x00000000)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_OdtMode_OFF (12)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_OdtMode_WID ( 1)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_OdtMode_MSK (0x00001000)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_OdtMode_MAX (0x00000001)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_OdtMode_DEF (0x00000000)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_CmdTxEq_OFF (13)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_CmdTxEq_WID ( 2)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_CmdTxEq_MSK (0x00006000)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_CmdTxEq_MAX (0x00000003)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_CmdTxEq_DEF (0x00000000)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_EarlyWeakDrive_OFF (15)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_EarlyWeakDrive_WID ( 2)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_EarlyWeakDrive_MSK (0x00018000)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_EarlyWeakDrive_MAX (0x00000003)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_EarlyWeakDrive_DEF (0x00000000)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_CtlTxEq_OFF (17)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_CtlTxEq_WID ( 2)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_CtlTxEq_MSK (0x00060000)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_CtlTxEq_MAX (0x00000003)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_CtlTxEq_DEF (0x00000000)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_CtlSRDrv_OFF (19)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_CtlSRDrv_WID ( 2)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_CtlSRDrv_MSK (0x00180000)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_CtlSRDrv_MAX (0x00000003)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_CtlSRDrv_DEF (0x00000000)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_RxVref_OFF (21)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_RxVref_WID ( 6)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_RxVref_MSK (0x07E00000)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_RxVref_MAX (0x0000003F)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_RxVref_DEF (0x00000000)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_VccddqHi_OFF (27)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_VccddqHi_WID ( 1)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_VccddqHi_MSK (0x08000000)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_VccddqHi_MAX (0x00000001)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_VccddqHi_DEF (0x00000000)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_DllWeakLock_OFF (28)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_DllWeakLock_WID ( 1)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_DllWeakLock_MSK (0x10000000)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_DllWeakLock_MAX (0x00000001)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_DllWeakLock_DEF (0x00000000)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_LPDDR_Mode_OFF (29)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_LPDDR_Mode_WID ( 1)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_LPDDR_Mode_MSK (0x20000000)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_LPDDR_Mode_MAX (0x00000001)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_LPDDR_Mode_DEF (0x00000000)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_LaDrvEnOvrd_OFF (30)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_LaDrvEnOvrd_WID ( 1)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_LaDrvEnOvrd_MSK (0x40000000)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_LaDrvEnOvrd_MAX (0x00000001)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_LaDrvEnOvrd_DEF (0x00000000)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_LPDdrCAA_Dis_OFF (31)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_LPDdrCAA_Dis_WID ( 1)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_LPDdrCAA_Dis_MSK (0x80000000)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_LPDdrCAA_Dis_MAX (0x00000001)
+ #define DDRCKECTL_CR_DDRCRCTLCONTROLS_LPDdrCAA_Dis_DEF (0x00000000)
+
+#define DDRCKECTL_CR_DDRCRCTLRANKSUSED_REG (0x00003820)
+ #define DDRCKECTL_CR_DDRCRCTLRANKSUSED_RankEn_OFF ( 0)
+ #define DDRCKECTL_CR_DDRCRCTLRANKSUSED_RankEn_WID ( 4)
+ #define DDRCKECTL_CR_DDRCRCTLRANKSUSED_RankEn_MSK (0x0000000F)
+ #define DDRCKECTL_CR_DDRCRCTLRANKSUSED_RankEn_MAX (0x0000000F)
+ #define DDRCKECTL_CR_DDRCRCTLRANKSUSED_RankEn_DEF (0x0000000F)
+ #define DDRCKECTL_CR_DDRCRCTLRANKSUSED_OdtDisable_OFF ( 4)
+ #define DDRCKECTL_CR_DDRCRCTLRANKSUSED_OdtDisable_WID ( 2)
+ #define DDRCKECTL_CR_DDRCRCTLRANKSUSED_OdtDisable_MSK (0x00000030)
+ #define DDRCKECTL_CR_DDRCRCTLRANKSUSED_OdtDisable_MAX (0x00000003)
+ #define DDRCKECTL_CR_DDRCRCTLRANKSUSED_OdtDisable_DEF (0x00000000)
+ #define DDRCKECTL_CR_DDRCRCTLRANKSUSED_Spare_OFF ( 6)
+ #define DDRCKECTL_CR_DDRCRCTLRANKSUSED_Spare_WID (26)
+ #define DDRCKECTL_CR_DDRCRCTLRANKSUSED_Spare_MSK (0xFFFFFFC0)
+ #define DDRCKECTL_CR_DDRCRCTLRANKSUSED_Spare_MAX (0x03FFFFFF)
+ #define DDRCKECTL_CR_DDRCRCTLRANKSUSED_Spare_DEF (0x00000000)
+
+#define DDRCKECTL_CR_DLLPITESTANDADC_REG (0x00003824)
+ #define DDRCKECTL_CR_DLLPITESTANDADC_RunTest_OFF ( 0)
+ #define DDRCKECTL_CR_DLLPITESTANDADC_RunTest_WID ( 1)
+ #define DDRCKECTL_CR_DLLPITESTANDADC_RunTest_MSK (0x00000001)
+ #define DDRCKECTL_CR_DLLPITESTANDADC_RunTest_MAX (0x00000001)
+ #define DDRCKECTL_CR_DLLPITESTANDADC_RunTest_DEF (0x00000000)
+ #define DDRCKECTL_CR_DLLPITESTANDADC_Load_OFF ( 1)
+ #define DDRCKECTL_CR_DLLPITESTANDADC_Load_WID ( 1)
+ #define DDRCKECTL_CR_DLLPITESTANDADC_Load_MSK (0x00000002)
+ #define DDRCKECTL_CR_DLLPITESTANDADC_Load_MAX (0x00000001)
+ #define DDRCKECTL_CR_DLLPITESTANDADC_Load_DEF (0x00000000)
+ #define DDRCKECTL_CR_DLLPITESTANDADC_ModeHVM_OFF ( 2)
+ #define DDRCKECTL_CR_DLLPITESTANDADC_ModeHVM_WID ( 1)
+ #define DDRCKECTL_CR_DLLPITESTANDADC_ModeHVM_MSK (0x00000004)
+ #define DDRCKECTL_CR_DLLPITESTANDADC_ModeHVM_MAX (0x00000001)
+ #define DDRCKECTL_CR_DLLPITESTANDADC_ModeHVM_DEF (0x00000000)
+ #define DDRCKECTL_CR_DLLPITESTANDADC_ModeDV_OFF ( 3)
+ #define DDRCKECTL_CR_DLLPITESTANDADC_ModeDV_WID ( 1)
+ #define DDRCKECTL_CR_DLLPITESTANDADC_ModeDV_MSK (0x00000008)
+ #define DDRCKECTL_CR_DLLPITESTANDADC_ModeDV_MAX (0x00000001)
+ #define DDRCKECTL_CR_DLLPITESTANDADC_ModeDV_DEF (0x00000000)
+ #define DDRCKECTL_CR_DLLPITESTANDADC_ModeADC_OFF ( 4)
+ #define DDRCKECTL_CR_DLLPITESTANDADC_ModeADC_WID ( 1)
+ #define DDRCKECTL_CR_DLLPITESTANDADC_ModeADC_MSK (0x00000010)
+ #define DDRCKECTL_CR_DLLPITESTANDADC_ModeADC_MAX (0x00000001)
+ #define DDRCKECTL_CR_DLLPITESTANDADC_ModeADC_DEF (0x00000000)
+ #define DDRCKECTL_CR_DLLPITESTANDADC_LoadCount_OFF ( 5)
+ #define DDRCKECTL_CR_DLLPITESTANDADC_LoadCount_WID (10)
+ #define DDRCKECTL_CR_DLLPITESTANDADC_LoadCount_MSK (0x00007FE0)
+ #define DDRCKECTL_CR_DLLPITESTANDADC_LoadCount_MAX (0x000003FF)
+ #define DDRCKECTL_CR_DLLPITESTANDADC_CountStatus_OFF (15)
+ #define DDRCKECTL_CR_DLLPITESTANDADC_CountStatus_WID (10)
+ #define DDRCKECTL_CR_DLLPITESTANDADC_CountStatus_MSK (0x01FF8000)
+ #define DDRCKECTL_CR_DLLPITESTANDADC_CountStatus_MAX (0x000003FF)
+ #define DDRCKECTL_CR_DLLPITESTANDADC_CountStatus_DEF (0x00000000)
+ #define DDRCKECTL_CR_DLLPITESTANDADC_Spare_OFF (25)
+ #define DDRCKECTL_CR_DLLPITESTANDADC_Spare_WID ( 7)
+ #define DDRCKECTL_CR_DLLPITESTANDADC_Spare_MSK (0xFE000000)
+ #define DDRCKECTL_CR_DLLPITESTANDADC_Spare_MAX (0x0000007F)
+
+#define DDRCKECTLCH0_CR_DDRCRCTLCOMP_REG (0x00003410)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMP_Scomp_OFF ( 0)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMP_Scomp_WID ( 6)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMP_Scomp_MSK (0x0000003F)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMP_Scomp_MAX (0x0000003F)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMP_Scomp_DEF (0x00000000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMP_TcoComp_OFF ( 6)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMP_TcoComp_WID ( 6)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMP_TcoComp_MSK (0x00000FC0)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMP_TcoComp_MAX (0x0000003F)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMP_TcoComp_DEF (0x00000000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMP_RcompDrvUp_OFF (12)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMP_RcompDrvUp_WID ( 6)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMP_RcompDrvUp_MSK (0x0003F000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMP_RcompDrvUp_MAX (0x0000003F)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMP_RcompDrvUp_DEF (0x00000000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMP_RcompDrvDown_OFF (18)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMP_RcompDrvDown_WID ( 6)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMP_RcompDrvDown_MSK (0x00FC0000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMP_RcompDrvDown_MAX (0x0000003F)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMP_RcompDrvDown_DEF (0x00000000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMP_LsComp_OFF (24)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMP_LsComp_WID ( 3)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMP_LsComp_MSK (0x07000000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMP_LsComp_MAX (0x00000007)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMP_LsComp_DEF (0x00000000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMP_Spare_OFF (27)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMP_Spare_WID ( 5)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMP_Spare_MSK (0xF8000000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMP_Spare_MAX (0x0000001F)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMP_Spare_DEF (0x00000000)
+
+#define DDRCKECTLCH0_CR_DDRCRCTLCOMPOFFSET_REG (0x00003414)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMPOFFSET_ScompOffset_OFF ( 0)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMPOFFSET_ScompOffset_WID ( 5)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMPOFFSET_ScompOffset_MSK (0x0000001F)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMPOFFSET_ScompOffset_MAX (0x0000001F)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMPOFFSET_ScompOffset_DEF (0x00000000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMPOFFSET_TcoCompOffset_OFF ( 5)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMPOFFSET_TcoCompOffset_WID ( 4)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMPOFFSET_TcoCompOffset_MSK (0x000001E0)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMPOFFSET_TcoCompOffset_MAX (0x0000000F)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMPOFFSET_TcoCompOffset_DEF (0x00000000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMPOFFSET_RcompDrvUpOffset_OFF ( 9)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMPOFFSET_RcompDrvUpOffset_WID ( 4)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMPOFFSET_RcompDrvUpOffset_MSK (0x00001E00)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMPOFFSET_RcompDrvUpOffset_MAX (0x0000000F)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMPOFFSET_RcompDrvUpOffset_DEF (0x00000000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMPOFFSET_RcompDrvDownOffset_OFF (13)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMPOFFSET_RcompDrvDownOffset_WID ( 4)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMPOFFSET_RcompDrvDownOffset_MSK (0x0001E000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMPOFFSET_RcompDrvDownOffset_MAX (0x0000000F)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMPOFFSET_RcompDrvDownOffset_DEF (0x00000000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMPOFFSET_Spare_OFF (17)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMPOFFSET_Spare_WID (15)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMPOFFSET_Spare_MSK (0xFFFE0000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMPOFFSET_Spare_MAX (0x00007FFF)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCOMPOFFSET_Spare_DEF (0x00000000)
+
+#define DDRCKECTLCH0_CR_DDRCRCTLPICODING_REG (0x00003418)
+ #define DDRCKECTLCH0_CR_DDRCRCTLPICODING_CtlPiCode0_OFF ( 0)
+ #define DDRCKECTLCH0_CR_DDRCRCTLPICODING_CtlPiCode0_WID ( 7)
+ #define DDRCKECTLCH0_CR_DDRCRCTLPICODING_CtlPiCode0_MSK (0x0000007F)
+ #define DDRCKECTLCH0_CR_DDRCRCTLPICODING_CtlPiCode0_MAX (0x0000007F)
+ #define DDRCKECTLCH0_CR_DDRCRCTLPICODING_CtlPiCode0_DEF (0x00000000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLPICODING_CtlPiCode1_OFF ( 7)
+ #define DDRCKECTLCH0_CR_DDRCRCTLPICODING_CtlPiCode1_WID ( 7)
+ #define DDRCKECTLCH0_CR_DDRCRCTLPICODING_CtlPiCode1_MSK (0x00003F80)
+ #define DDRCKECTLCH0_CR_DDRCRCTLPICODING_CtlPiCode1_MAX (0x0000007F)
+ #define DDRCKECTLCH0_CR_DDRCRCTLPICODING_CtlPiCode1_DEF (0x00000000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLPICODING_CtlPiCode2_OFF (14)
+ #define DDRCKECTLCH0_CR_DDRCRCTLPICODING_CtlPiCode2_WID ( 7)
+ #define DDRCKECTLCH0_CR_DDRCRCTLPICODING_CtlPiCode2_MSK (0x001FC000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLPICODING_CtlPiCode2_MAX (0x0000007F)
+ #define DDRCKECTLCH0_CR_DDRCRCTLPICODING_CtlPiCode2_DEF (0x00000000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLPICODING_CtlPiCode3_OFF (21)
+ #define DDRCKECTLCH0_CR_DDRCRCTLPICODING_CtlPiCode3_WID ( 7)
+ #define DDRCKECTLCH0_CR_DDRCRCTLPICODING_CtlPiCode3_MSK (0x0FE00000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLPICODING_CtlPiCode3_MAX (0x0000007F)
+ #define DDRCKECTLCH0_CR_DDRCRCTLPICODING_CtlPiCode3_DEF (0x00000000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLPICODING_CtlXoverEnable_OFF (28)
+ #define DDRCKECTLCH0_CR_DDRCRCTLPICODING_CtlXoverEnable_WID ( 1)
+ #define DDRCKECTLCH0_CR_DDRCRCTLPICODING_CtlXoverEnable_MSK (0x10000000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLPICODING_CtlXoverEnable_MAX (0x00000001)
+ #define DDRCKECTLCH0_CR_DDRCRCTLPICODING_CtlXoverEnable_DEF (0x00000000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLPICODING_Spare_OFF (29)
+ #define DDRCKECTLCH0_CR_DDRCRCTLPICODING_Spare_WID ( 3)
+ #define DDRCKECTLCH0_CR_DDRCRCTLPICODING_Spare_MSK (0xE0000000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLPICODING_Spare_MAX (0x00000007)
+ #define DDRCKECTLCH0_CR_DDRCRCTLPICODING_Spare_DEF (0x00000000)
+
+#define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_REG (0x0000341C)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_RefPi_OFF ( 0)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_RefPi_WID ( 4)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_RefPi_MSK (0x0000000F)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_RefPi_MAX (0x0000000F)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_RefPi_DEF (0x00000000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_DllMask_OFF ( 4)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_DllMask_WID ( 2)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_DllMask_MSK (0x00000030)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_DllMask_MAX (0x00000003)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_DllMask_DEF (0x00000000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_DllRsvd1_OFF ( 6)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_DllRsvd1_WID ( 1)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_DllRsvd1_MSK (0x00000040)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_DllRsvd1_MAX (0x00000001)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_DllRsvd1_DEF (0x00000000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_TxOn_OFF ( 7)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_TxOn_WID ( 1)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_TxOn_MSK (0x00000080)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_TxOn_MAX (0x00000001)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_TxOn_DEF (0x00000000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_IntClkOn_OFF ( 8)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_IntClkOn_WID ( 1)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_IntClkOn_MSK (0x00000100)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_IntClkOn_MAX (0x00000001)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_IntClkOn_DEF (0x00000000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_RepClkOn_OFF ( 9)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_RepClkOn_WID ( 1)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_RepClkOn_MSK (0x00000200)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_RepClkOn_MAX (0x00000001)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_RepClkOn_DEF (0x00000000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_IOLBCtl_OFF (10)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_IOLBCtl_WID ( 2)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_IOLBCtl_MSK (0x00000C00)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_IOLBCtl_MAX (0x00000003)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_IOLBCtl_DEF (0x00000000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_OdtMode_OFF (12)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_OdtMode_WID ( 1)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_OdtMode_MSK (0x00001000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_OdtMode_MAX (0x00000001)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_OdtMode_DEF (0x00000000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_CmdTxEq_OFF (13)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_CmdTxEq_WID ( 2)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_CmdTxEq_MSK (0x00006000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_CmdTxEq_MAX (0x00000003)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_CmdTxEq_DEF (0x00000000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_EarlyWeakDrive_OFF (15)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_EarlyWeakDrive_WID ( 2)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_EarlyWeakDrive_MSK (0x00018000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_EarlyWeakDrive_MAX (0x00000003)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_EarlyWeakDrive_DEF (0x00000000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_CtlTxEq_OFF (17)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_CtlTxEq_WID ( 2)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_CtlTxEq_MSK (0x00060000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_CtlTxEq_MAX (0x00000003)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_CtlTxEq_DEF (0x00000000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_CtlSRDrv_OFF (19)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_CtlSRDrv_WID ( 2)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_CtlSRDrv_MSK (0x00180000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_CtlSRDrv_MAX (0x00000003)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_CtlSRDrv_DEF (0x00000000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_RxVref_OFF (21)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_RxVref_WID ( 6)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_RxVref_MSK (0x07E00000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_RxVref_MAX (0x0000003F)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_RxVref_DEF (0x00000000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_VccddqHi_OFF (27)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_VccddqHi_WID ( 1)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_VccddqHi_MSK (0x08000000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_VccddqHi_MAX (0x00000001)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_VccddqHi_DEF (0x00000000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_DllWeakLock_OFF (28)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_DllWeakLock_WID ( 1)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_DllWeakLock_MSK (0x10000000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_DllWeakLock_MAX (0x00000001)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_DllWeakLock_DEF (0x00000000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_LPDDR_Mode_OFF (29)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_LPDDR_Mode_WID ( 1)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_LPDDR_Mode_MSK (0x20000000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_LPDDR_Mode_MAX (0x00000001)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_LPDDR_Mode_DEF (0x00000000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_LaDrvEnOvrd_OFF (30)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_LaDrvEnOvrd_WID ( 1)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_LaDrvEnOvrd_MSK (0x40000000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_LaDrvEnOvrd_MAX (0x00000001)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_LaDrvEnOvrd_DEF (0x00000000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_LPDdrCAA_Dis_OFF (31)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_LPDdrCAA_Dis_WID ( 1)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_LPDdrCAA_Dis_MSK (0x80000000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_LPDdrCAA_Dis_MAX (0x00000001)
+ #define DDRCKECTLCH0_CR_DDRCRCTLCONTROLS_LPDdrCAA_Dis_DEF (0x00000000)
+
+#define DDRCKECTLCH0_CR_DDRCRCTLRANKSUSED_REG (0x00003420)
+ #define DDRCKECTLCH0_CR_DDRCRCTLRANKSUSED_RankEn_OFF ( 0)
+ #define DDRCKECTLCH0_CR_DDRCRCTLRANKSUSED_RankEn_WID ( 4)
+ #define DDRCKECTLCH0_CR_DDRCRCTLRANKSUSED_RankEn_MSK (0x0000000F)
+ #define DDRCKECTLCH0_CR_DDRCRCTLRANKSUSED_RankEn_MAX (0x0000000F)
+ #define DDRCKECTLCH0_CR_DDRCRCTLRANKSUSED_RankEn_DEF (0x0000000F)
+ #define DDRCKECTLCH0_CR_DDRCRCTLRANKSUSED_OdtDisable_OFF ( 4)
+ #define DDRCKECTLCH0_CR_DDRCRCTLRANKSUSED_OdtDisable_WID ( 2)
+ #define DDRCKECTLCH0_CR_DDRCRCTLRANKSUSED_OdtDisable_MSK (0x00000030)
+ #define DDRCKECTLCH0_CR_DDRCRCTLRANKSUSED_OdtDisable_MAX (0x00000003)
+ #define DDRCKECTLCH0_CR_DDRCRCTLRANKSUSED_OdtDisable_DEF (0x00000000)
+ #define DDRCKECTLCH0_CR_DDRCRCTLRANKSUSED_Spare_OFF ( 6)
+ #define DDRCKECTLCH0_CR_DDRCRCTLRANKSUSED_Spare_WID (26)
+ #define DDRCKECTLCH0_CR_DDRCRCTLRANKSUSED_Spare_MSK (0xFFFFFFC0)
+ #define DDRCKECTLCH0_CR_DDRCRCTLRANKSUSED_Spare_MAX (0x03FFFFFF)
+ #define DDRCKECTLCH0_CR_DDRCRCTLRANKSUSED_Spare_DEF (0x00000000)
+
+#define DDRCKECTLCH0_CR_DLLPITESTANDADC_REG (0x00003424)
+ #define DDRCKECTLCH0_CR_DLLPITESTANDADC_RunTest_OFF ( 0)
+ #define DDRCKECTLCH0_CR_DLLPITESTANDADC_RunTest_WID ( 1)
+ #define DDRCKECTLCH0_CR_DLLPITESTANDADC_RunTest_MSK (0x00000001)
+ #define DDRCKECTLCH0_CR_DLLPITESTANDADC_RunTest_MAX (0x00000001)
+ #define DDRCKECTLCH0_CR_DLLPITESTANDADC_RunTest_DEF (0x00000000)
+ #define DDRCKECTLCH0_CR_DLLPITESTANDADC_Load_OFF ( 1)
+ #define DDRCKECTLCH0_CR_DLLPITESTANDADC_Load_WID ( 1)
+ #define DDRCKECTLCH0_CR_DLLPITESTANDADC_Load_MSK (0x00000002)
+ #define DDRCKECTLCH0_CR_DLLPITESTANDADC_Load_MAX (0x00000001)
+ #define DDRCKECTLCH0_CR_DLLPITESTANDADC_Load_DEF (0x00000000)
+ #define DDRCKECTLCH0_CR_DLLPITESTANDADC_ModeHVM_OFF ( 2)
+ #define DDRCKECTLCH0_CR_DLLPITESTANDADC_ModeHVM_WID ( 1)
+ #define DDRCKECTLCH0_CR_DLLPITESTANDADC_ModeHVM_MSK (0x00000004)
+ #define DDRCKECTLCH0_CR_DLLPITESTANDADC_ModeHVM_MAX (0x00000001)
+ #define DDRCKECTLCH0_CR_DLLPITESTANDADC_ModeHVM_DEF (0x00000000)
+ #define DDRCKECTLCH0_CR_DLLPITESTANDADC_ModeDV_OFF ( 3)
+ #define DDRCKECTLCH0_CR_DLLPITESTANDADC_ModeDV_WID ( 1)
+ #define DDRCKECTLCH0_CR_DLLPITESTANDADC_ModeDV_MSK (0x00000008)
+ #define DDRCKECTLCH0_CR_DLLPITESTANDADC_ModeDV_MAX (0x00000001)
+ #define DDRCKECTLCH0_CR_DLLPITESTANDADC_ModeDV_DEF (0x00000000)
+ #define DDRCKECTLCH0_CR_DLLPITESTANDADC_ModeADC_OFF ( 4)
+ #define DDRCKECTLCH0_CR_DLLPITESTANDADC_ModeADC_WID ( 1)
+ #define DDRCKECTLCH0_CR_DLLPITESTANDADC_ModeADC_MSK (0x00000010)
+ #define DDRCKECTLCH0_CR_DLLPITESTANDADC_ModeADC_MAX (0x00000001)
+ #define DDRCKECTLCH0_CR_DLLPITESTANDADC_ModeADC_DEF (0x00000000)
+ #define DDRCKECTLCH0_CR_DLLPITESTANDADC_LoadCount_OFF ( 5)
+ #define DDRCKECTLCH0_CR_DLLPITESTANDADC_LoadCount_WID (10)
+ #define DDRCKECTLCH0_CR_DLLPITESTANDADC_LoadCount_MSK (0x00007FE0)
+ #define DDRCKECTLCH0_CR_DLLPITESTANDADC_LoadCount_MAX (0x000003FF)
+ #define DDRCKECTLCH0_CR_DLLPITESTANDADC_CountStatus_OFF (15)
+ #define DDRCKECTLCH0_CR_DLLPITESTANDADC_CountStatus_WID (10)
+ #define DDRCKECTLCH0_CR_DLLPITESTANDADC_CountStatus_MSK (0x01FF8000)
+ #define DDRCKECTLCH0_CR_DLLPITESTANDADC_CountStatus_MAX (0x000003FF)
+ #define DDRCKECTLCH0_CR_DLLPITESTANDADC_CountStatus_DEF (0x00000000)
+ #define DDRCKECTLCH0_CR_DLLPITESTANDADC_Spare_OFF (25)
+ #define DDRCKECTLCH0_CR_DLLPITESTANDADC_Spare_WID ( 7)
+ #define DDRCKECTLCH0_CR_DLLPITESTANDADC_Spare_MSK (0xFE000000)
+ #define DDRCKECTLCH0_CR_DLLPITESTANDADC_Spare_MAX (0x0000007F)
+
+#define DDRCKECTLCH1_CR_DDRCRCTLCOMP_REG (0x00003510)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMP_Scomp_OFF ( 0)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMP_Scomp_WID ( 6)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMP_Scomp_MSK (0x0000003F)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMP_Scomp_MAX (0x0000003F)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMP_Scomp_DEF (0x00000000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMP_TcoComp_OFF ( 6)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMP_TcoComp_WID ( 6)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMP_TcoComp_MSK (0x00000FC0)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMP_TcoComp_MAX (0x0000003F)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMP_TcoComp_DEF (0x00000000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMP_RcompDrvUp_OFF (12)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMP_RcompDrvUp_WID ( 6)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMP_RcompDrvUp_MSK (0x0003F000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMP_RcompDrvUp_MAX (0x0000003F)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMP_RcompDrvUp_DEF (0x00000000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMP_RcompDrvDown_OFF (18)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMP_RcompDrvDown_WID ( 6)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMP_RcompDrvDown_MSK (0x00FC0000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMP_RcompDrvDown_MAX (0x0000003F)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMP_RcompDrvDown_DEF (0x00000000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMP_LsComp_OFF (24)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMP_LsComp_WID ( 3)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMP_LsComp_MSK (0x07000000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMP_LsComp_MAX (0x00000007)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMP_LsComp_DEF (0x00000000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMP_Spare_OFF (27)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMP_Spare_WID ( 5)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMP_Spare_MSK (0xF8000000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMP_Spare_MAX (0x0000001F)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMP_Spare_DEF (0x00000000)
+
+#define DDRCKECTLCH1_CR_DDRCRCTLCOMPOFFSET_REG (0x00003514)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMPOFFSET_ScompOffset_OFF ( 0)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMPOFFSET_ScompOffset_WID ( 5)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMPOFFSET_ScompOffset_MSK (0x0000001F)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMPOFFSET_ScompOffset_MAX (0x0000001F)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMPOFFSET_ScompOffset_DEF (0x00000000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMPOFFSET_TcoCompOffset_OFF ( 5)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMPOFFSET_TcoCompOffset_WID ( 4)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMPOFFSET_TcoCompOffset_MSK (0x000001E0)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMPOFFSET_TcoCompOffset_MAX (0x0000000F)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMPOFFSET_TcoCompOffset_DEF (0x00000000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMPOFFSET_RcompDrvUpOffset_OFF ( 9)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMPOFFSET_RcompDrvUpOffset_WID ( 4)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMPOFFSET_RcompDrvUpOffset_MSK (0x00001E00)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMPOFFSET_RcompDrvUpOffset_MAX (0x0000000F)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMPOFFSET_RcompDrvUpOffset_DEF (0x00000000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMPOFFSET_RcompDrvDownOffset_OFF (13)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMPOFFSET_RcompDrvDownOffset_WID ( 4)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMPOFFSET_RcompDrvDownOffset_MSK (0x0001E000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMPOFFSET_RcompDrvDownOffset_MAX (0x0000000F)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMPOFFSET_RcompDrvDownOffset_DEF (0x00000000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMPOFFSET_Spare_OFF (17)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMPOFFSET_Spare_WID (15)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMPOFFSET_Spare_MSK (0xFFFE0000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMPOFFSET_Spare_MAX (0x00007FFF)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCOMPOFFSET_Spare_DEF (0x00000000)
+
+#define DDRCKECTLCH1_CR_DDRCRCTLPICODING_REG (0x00003518)
+ #define DDRCKECTLCH1_CR_DDRCRCTLPICODING_CtlPiCode0_OFF ( 0)
+ #define DDRCKECTLCH1_CR_DDRCRCTLPICODING_CtlPiCode0_WID ( 7)
+ #define DDRCKECTLCH1_CR_DDRCRCTLPICODING_CtlPiCode0_MSK (0x0000007F)
+ #define DDRCKECTLCH1_CR_DDRCRCTLPICODING_CtlPiCode0_MAX (0x0000007F)
+ #define DDRCKECTLCH1_CR_DDRCRCTLPICODING_CtlPiCode0_DEF (0x00000000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLPICODING_CtlPiCode1_OFF ( 7)
+ #define DDRCKECTLCH1_CR_DDRCRCTLPICODING_CtlPiCode1_WID ( 7)
+ #define DDRCKECTLCH1_CR_DDRCRCTLPICODING_CtlPiCode1_MSK (0x00003F80)
+ #define DDRCKECTLCH1_CR_DDRCRCTLPICODING_CtlPiCode1_MAX (0x0000007F)
+ #define DDRCKECTLCH1_CR_DDRCRCTLPICODING_CtlPiCode1_DEF (0x00000000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLPICODING_CtlPiCode2_OFF (14)
+ #define DDRCKECTLCH1_CR_DDRCRCTLPICODING_CtlPiCode2_WID ( 7)
+ #define DDRCKECTLCH1_CR_DDRCRCTLPICODING_CtlPiCode2_MSK (0x001FC000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLPICODING_CtlPiCode2_MAX (0x0000007F)
+ #define DDRCKECTLCH1_CR_DDRCRCTLPICODING_CtlPiCode2_DEF (0x00000000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLPICODING_CtlPiCode3_OFF (21)
+ #define DDRCKECTLCH1_CR_DDRCRCTLPICODING_CtlPiCode3_WID ( 7)
+ #define DDRCKECTLCH1_CR_DDRCRCTLPICODING_CtlPiCode3_MSK (0x0FE00000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLPICODING_CtlPiCode3_MAX (0x0000007F)
+ #define DDRCKECTLCH1_CR_DDRCRCTLPICODING_CtlPiCode3_DEF (0x00000000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLPICODING_CtlXoverEnable_OFF (28)
+ #define DDRCKECTLCH1_CR_DDRCRCTLPICODING_CtlXoverEnable_WID ( 1)
+ #define DDRCKECTLCH1_CR_DDRCRCTLPICODING_CtlXoverEnable_MSK (0x10000000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLPICODING_CtlXoverEnable_MAX (0x00000001)
+ #define DDRCKECTLCH1_CR_DDRCRCTLPICODING_CtlXoverEnable_DEF (0x00000000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLPICODING_Spare_OFF (29)
+ #define DDRCKECTLCH1_CR_DDRCRCTLPICODING_Spare_WID ( 3)
+ #define DDRCKECTLCH1_CR_DDRCRCTLPICODING_Spare_MSK (0xE0000000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLPICODING_Spare_MAX (0x00000007)
+ #define DDRCKECTLCH1_CR_DDRCRCTLPICODING_Spare_DEF (0x00000000)
+
+#define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_REG (0x0000351C)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_RefPi_OFF ( 0)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_RefPi_WID ( 4)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_RefPi_MSK (0x0000000F)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_RefPi_MAX (0x0000000F)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_RefPi_DEF (0x00000000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_DllMask_OFF ( 4)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_DllMask_WID ( 2)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_DllMask_MSK (0x00000030)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_DllMask_MAX (0x00000003)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_DllMask_DEF (0x00000000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_DllRsvd1_OFF ( 6)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_DllRsvd1_WID ( 1)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_DllRsvd1_MSK (0x00000040)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_DllRsvd1_MAX (0x00000001)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_DllRsvd1_DEF (0x00000000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_TxOn_OFF ( 7)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_TxOn_WID ( 1)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_TxOn_MSK (0x00000080)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_TxOn_MAX (0x00000001)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_TxOn_DEF (0x00000000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_IntClkOn_OFF ( 8)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_IntClkOn_WID ( 1)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_IntClkOn_MSK (0x00000100)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_IntClkOn_MAX (0x00000001)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_IntClkOn_DEF (0x00000000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_RepClkOn_OFF ( 9)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_RepClkOn_WID ( 1)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_RepClkOn_MSK (0x00000200)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_RepClkOn_MAX (0x00000001)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_RepClkOn_DEF (0x00000000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_IOLBCtl_OFF (10)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_IOLBCtl_WID ( 2)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_IOLBCtl_MSK (0x00000C00)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_IOLBCtl_MAX (0x00000003)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_IOLBCtl_DEF (0x00000000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_OdtMode_OFF (12)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_OdtMode_WID ( 1)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_OdtMode_MSK (0x00001000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_OdtMode_MAX (0x00000001)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_OdtMode_DEF (0x00000000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_CmdTxEq_OFF (13)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_CmdTxEq_WID ( 2)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_CmdTxEq_MSK (0x00006000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_CmdTxEq_MAX (0x00000003)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_CmdTxEq_DEF (0x00000000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_EarlyWeakDrive_OFF (15)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_EarlyWeakDrive_WID ( 2)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_EarlyWeakDrive_MSK (0x00018000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_EarlyWeakDrive_MAX (0x00000003)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_EarlyWeakDrive_DEF (0x00000000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_CtlTxEq_OFF (17)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_CtlTxEq_WID ( 2)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_CtlTxEq_MSK (0x00060000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_CtlTxEq_MAX (0x00000003)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_CtlTxEq_DEF (0x00000000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_CtlSRDrv_OFF (19)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_CtlSRDrv_WID ( 2)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_CtlSRDrv_MSK (0x00180000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_CtlSRDrv_MAX (0x00000003)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_CtlSRDrv_DEF (0x00000000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_RxVref_OFF (21)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_RxVref_WID ( 6)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_RxVref_MSK (0x07E00000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_RxVref_MAX (0x0000003F)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_RxVref_DEF (0x00000000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_VccddqHi_OFF (27)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_VccddqHi_WID ( 1)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_VccddqHi_MSK (0x08000000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_VccddqHi_MAX (0x00000001)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_VccddqHi_DEF (0x00000000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_DllWeakLock_OFF (28)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_DllWeakLock_WID ( 1)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_DllWeakLock_MSK (0x10000000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_DllWeakLock_MAX (0x00000001)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_DllWeakLock_DEF (0x00000000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_LPDDR_Mode_OFF (29)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_LPDDR_Mode_WID ( 1)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_LPDDR_Mode_MSK (0x20000000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_LPDDR_Mode_MAX (0x00000001)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_LPDDR_Mode_DEF (0x00000000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_LaDrvEnOvrd_OFF (30)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_LaDrvEnOvrd_WID ( 1)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_LaDrvEnOvrd_MSK (0x40000000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_LaDrvEnOvrd_MAX (0x00000001)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_LaDrvEnOvrd_DEF (0x00000000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_LPDdrCAA_Dis_OFF (31)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_LPDdrCAA_Dis_WID ( 1)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_LPDdrCAA_Dis_MSK (0x80000000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_LPDdrCAA_Dis_MAX (0x00000001)
+ #define DDRCKECTLCH1_CR_DDRCRCTLCONTROLS_LPDdrCAA_Dis_DEF (0x00000000)
+
+#define DDRCKECTLCH1_CR_DDRCRCTLRANKSUSED_REG (0x00003520)
+ #define DDRCKECTLCH1_CR_DDRCRCTLRANKSUSED_RankEn_OFF ( 0)
+ #define DDRCKECTLCH1_CR_DDRCRCTLRANKSUSED_RankEn_WID ( 4)
+ #define DDRCKECTLCH1_CR_DDRCRCTLRANKSUSED_RankEn_MSK (0x0000000F)
+ #define DDRCKECTLCH1_CR_DDRCRCTLRANKSUSED_RankEn_MAX (0x0000000F)
+ #define DDRCKECTLCH1_CR_DDRCRCTLRANKSUSED_RankEn_DEF (0x0000000F)
+ #define DDRCKECTLCH1_CR_DDRCRCTLRANKSUSED_OdtDisable_OFF ( 4)
+ #define DDRCKECTLCH1_CR_DDRCRCTLRANKSUSED_OdtDisable_WID ( 2)
+ #define DDRCKECTLCH1_CR_DDRCRCTLRANKSUSED_OdtDisable_MSK (0x00000030)
+ #define DDRCKECTLCH1_CR_DDRCRCTLRANKSUSED_OdtDisable_MAX (0x00000003)
+ #define DDRCKECTLCH1_CR_DDRCRCTLRANKSUSED_OdtDisable_DEF (0x00000000)
+ #define DDRCKECTLCH1_CR_DDRCRCTLRANKSUSED_Spare_OFF ( 6)
+ #define DDRCKECTLCH1_CR_DDRCRCTLRANKSUSED_Spare_WID (26)
+ #define DDRCKECTLCH1_CR_DDRCRCTLRANKSUSED_Spare_MSK (0xFFFFFFC0)
+ #define DDRCKECTLCH1_CR_DDRCRCTLRANKSUSED_Spare_MAX (0x03FFFFFF)
+ #define DDRCKECTLCH1_CR_DDRCRCTLRANKSUSED_Spare_DEF (0x00000000)
+
+#define DDRCKECTLCH1_CR_DLLPITESTANDADC_REG (0x00003524)
+ #define DDRCKECTLCH1_CR_DLLPITESTANDADC_RunTest_OFF ( 0)
+ #define DDRCKECTLCH1_CR_DLLPITESTANDADC_RunTest_WID ( 1)
+ #define DDRCKECTLCH1_CR_DLLPITESTANDADC_RunTest_MSK (0x00000001)
+ #define DDRCKECTLCH1_CR_DLLPITESTANDADC_RunTest_MAX (0x00000001)
+ #define DDRCKECTLCH1_CR_DLLPITESTANDADC_RunTest_DEF (0x00000000)
+ #define DDRCKECTLCH1_CR_DLLPITESTANDADC_Load_OFF ( 1)
+ #define DDRCKECTLCH1_CR_DLLPITESTANDADC_Load_WID ( 1)
+ #define DDRCKECTLCH1_CR_DLLPITESTANDADC_Load_MSK (0x00000002)
+ #define DDRCKECTLCH1_CR_DLLPITESTANDADC_Load_MAX (0x00000001)
+ #define DDRCKECTLCH1_CR_DLLPITESTANDADC_Load_DEF (0x00000000)
+ #define DDRCKECTLCH1_CR_DLLPITESTANDADC_ModeHVM_OFF ( 2)
+ #define DDRCKECTLCH1_CR_DLLPITESTANDADC_ModeHVM_WID ( 1)
+ #define DDRCKECTLCH1_CR_DLLPITESTANDADC_ModeHVM_MSK (0x00000004)
+ #define DDRCKECTLCH1_CR_DLLPITESTANDADC_ModeHVM_MAX (0x00000001)
+ #define DDRCKECTLCH1_CR_DLLPITESTANDADC_ModeHVM_DEF (0x00000000)
+ #define DDRCKECTLCH1_CR_DLLPITESTANDADC_ModeDV_OFF ( 3)
+ #define DDRCKECTLCH1_CR_DLLPITESTANDADC_ModeDV_WID ( 1)
+ #define DDRCKECTLCH1_CR_DLLPITESTANDADC_ModeDV_MSK (0x00000008)
+ #define DDRCKECTLCH1_CR_DLLPITESTANDADC_ModeDV_MAX (0x00000001)
+ #define DDRCKECTLCH1_CR_DLLPITESTANDADC_ModeDV_DEF (0x00000000)
+ #define DDRCKECTLCH1_CR_DLLPITESTANDADC_ModeADC_OFF ( 4)
+ #define DDRCKECTLCH1_CR_DLLPITESTANDADC_ModeADC_WID ( 1)
+ #define DDRCKECTLCH1_CR_DLLPITESTANDADC_ModeADC_MSK (0x00000010)
+ #define DDRCKECTLCH1_CR_DLLPITESTANDADC_ModeADC_MAX (0x00000001)
+ #define DDRCKECTLCH1_CR_DLLPITESTANDADC_ModeADC_DEF (0x00000000)
+ #define DDRCKECTLCH1_CR_DLLPITESTANDADC_LoadCount_OFF ( 5)
+ #define DDRCKECTLCH1_CR_DLLPITESTANDADC_LoadCount_WID (10)
+ #define DDRCKECTLCH1_CR_DLLPITESTANDADC_LoadCount_MSK (0x00007FE0)
+ #define DDRCKECTLCH1_CR_DLLPITESTANDADC_LoadCount_MAX (0x000003FF)
+ #define DDRCKECTLCH1_CR_DLLPITESTANDADC_CountStatus_OFF (15)
+ #define DDRCKECTLCH1_CR_DLLPITESTANDADC_CountStatus_WID (10)
+ #define DDRCKECTLCH1_CR_DLLPITESTANDADC_CountStatus_MSK (0x01FF8000)
+ #define DDRCKECTLCH1_CR_DLLPITESTANDADC_CountStatus_MAX (0x000003FF)
+ #define DDRCKECTLCH1_CR_DLLPITESTANDADC_CountStatus_DEF (0x00000000)
+ #define DDRCKECTLCH1_CR_DLLPITESTANDADC_Spare_OFF (25)
+ #define DDRCKECTLCH1_CR_DLLPITESTANDADC_Spare_WID ( 7)
+ #define DDRCKECTLCH1_CR_DLLPITESTANDADC_Spare_MSK (0xFE000000)
+ #define DDRCKECTLCH1_CR_DLLPITESTANDADC_Spare_MAX (0x0000007F)
+
+#define DDRCKECH0_CR_DDRCRCMDCOMP_REG (0x00001200)
+ #define DDRCKECH0_CR_DDRCRCMDCOMP_Scomp_OFF ( 0)
+ #define DDRCKECH0_CR_DDRCRCMDCOMP_Scomp_WID ( 6)
+ #define DDRCKECH0_CR_DDRCRCMDCOMP_Scomp_MSK (0x0000003F)
+ #define DDRCKECH0_CR_DDRCRCMDCOMP_Scomp_MAX (0x0000003F)
+ #define DDRCKECH0_CR_DDRCRCMDCOMP_Scomp_DEF (0x00000000)
+ #define DDRCKECH0_CR_DDRCRCMDCOMP_TcoComp_OFF ( 6)
+ #define DDRCKECH0_CR_DDRCRCMDCOMP_TcoComp_WID ( 6)
+ #define DDRCKECH0_CR_DDRCRCMDCOMP_TcoComp_MSK (0x00000FC0)
+ #define DDRCKECH0_CR_DDRCRCMDCOMP_TcoComp_MAX (0x0000003F)
+ #define DDRCKECH0_CR_DDRCRCMDCOMP_TcoComp_DEF (0x00000000)
+ #define DDRCKECH0_CR_DDRCRCMDCOMP_RcompDrvUp_OFF (12)
+ #define DDRCKECH0_CR_DDRCRCMDCOMP_RcompDrvUp_WID ( 6)
+ #define DDRCKECH0_CR_DDRCRCMDCOMP_RcompDrvUp_MSK (0x0003F000)
+ #define DDRCKECH0_CR_DDRCRCMDCOMP_RcompDrvUp_MAX (0x0000003F)
+ #define DDRCKECH0_CR_DDRCRCMDCOMP_RcompDrvUp_DEF (0x00000000)
+ #define DDRCKECH0_CR_DDRCRCMDCOMP_RcompDrvDown_OFF (18)
+ #define DDRCKECH0_CR_DDRCRCMDCOMP_RcompDrvDown_WID ( 6)
+ #define DDRCKECH0_CR_DDRCRCMDCOMP_RcompDrvDown_MSK (0x00FC0000)
+ #define DDRCKECH0_CR_DDRCRCMDCOMP_RcompDrvDown_MAX (0x0000003F)
+ #define DDRCKECH0_CR_DDRCRCMDCOMP_RcompDrvDown_DEF (0x00000000)
+ #define DDRCKECH0_CR_DDRCRCMDCOMP_LsComp_OFF (24)
+ #define DDRCKECH0_CR_DDRCRCMDCOMP_LsComp_WID ( 3)
+ #define DDRCKECH0_CR_DDRCRCMDCOMP_LsComp_MSK (0x07000000)
+ #define DDRCKECH0_CR_DDRCRCMDCOMP_LsComp_MAX (0x00000007)
+ #define DDRCKECH0_CR_DDRCRCMDCOMP_LsComp_DEF (0x00000004)
+ #define DDRCKECH0_CR_DDRCRCMDCOMP_Spare_OFF (27)
+ #define DDRCKECH0_CR_DDRCRCMDCOMP_Spare_WID ( 5)
+ #define DDRCKECH0_CR_DDRCRCMDCOMP_Spare_MSK (0xF8000000)
+ #define DDRCKECH0_CR_DDRCRCMDCOMP_Spare_MAX (0x0000001F)
+ #define DDRCKECH0_CR_DDRCRCMDCOMP_Spare_DEF (0x00000000)
+
+#define DDRCKECH0_CR_DDRCRCMDCOMPOFFSET_REG (0x00001204)
+ #define DDRCKECH0_CR_DDRCRCMDCOMPOFFSET_ScompOffset_OFF ( 0)
+ #define DDRCKECH0_CR_DDRCRCMDCOMPOFFSET_ScompOffset_WID ( 5)
+ #define DDRCKECH0_CR_DDRCRCMDCOMPOFFSET_ScompOffset_MSK (0x0000001F)
+ #define DDRCKECH0_CR_DDRCRCMDCOMPOFFSET_ScompOffset_MAX (0x0000001F)
+ #define DDRCKECH0_CR_DDRCRCMDCOMPOFFSET_ScompOffset_DEF (0x00000000)
+ #define DDRCKECH0_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_OFF ( 5)
+ #define DDRCKECH0_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_WID ( 4)
+ #define DDRCKECH0_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_MSK (0x000001E0)
+ #define DDRCKECH0_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_MAX (0x0000000F)
+ #define DDRCKECH0_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_DEF (0x00000000)
+ #define DDRCKECH0_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_OFF ( 9)
+ #define DDRCKECH0_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_WID ( 4)
+ #define DDRCKECH0_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_MSK (0x00001E00)
+ #define DDRCKECH0_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_MAX (0x0000000F)
+ #define DDRCKECH0_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_DEF (0x00000000)
+ #define DDRCKECH0_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_OFF (13)
+ #define DDRCKECH0_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_WID ( 4)
+ #define DDRCKECH0_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_MSK (0x0001E000)
+ #define DDRCKECH0_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_MAX (0x0000000F)
+ #define DDRCKECH0_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_DEF (0x00000000)
+ #define DDRCKECH0_CR_DDRCRCMDCOMPOFFSET_Spare_OFF (17)
+ #define DDRCKECH0_CR_DDRCRCMDCOMPOFFSET_Spare_WID (15)
+ #define DDRCKECH0_CR_DDRCRCMDCOMPOFFSET_Spare_MSK (0xFFFE0000)
+ #define DDRCKECH0_CR_DDRCRCMDCOMPOFFSET_Spare_MAX (0x00007FFF)
+ #define DDRCKECH0_CR_DDRCRCMDCOMPOFFSET_Spare_DEF (0x00000000)
+
+#define DDRCKECH0_CR_DDRCRCMDPICODING_REG (0x00001208)
+ #define DDRCKECH0_CR_DDRCRCMDPICODING_CmdPi0Code_OFF ( 0)
+ #define DDRCKECH0_CR_DDRCRCMDPICODING_CmdPi0Code_WID ( 7)
+ #define DDRCKECH0_CR_DDRCRCMDPICODING_CmdPi0Code_MSK (0x0000007F)
+ #define DDRCKECH0_CR_DDRCRCMDPICODING_CmdPi0Code_MAX (0x0000007F)
+ #define DDRCKECH0_CR_DDRCRCMDPICODING_CmdPi0Code_DEF (0x00000000)
+ #define DDRCKECH0_CR_DDRCRCMDPICODING_CmdPi1Code_OFF ( 7)
+ #define DDRCKECH0_CR_DDRCRCMDPICODING_CmdPi1Code_WID ( 7)
+ #define DDRCKECH0_CR_DDRCRCMDPICODING_CmdPi1Code_MSK (0x00003F80)
+ #define DDRCKECH0_CR_DDRCRCMDPICODING_CmdPi1Code_MAX (0x0000007F)
+ #define DDRCKECH0_CR_DDRCRCMDPICODING_CmdPi1Code_DEF (0x00000000)
+ #define DDRCKECH0_CR_DDRCRCMDPICODING_Spare_OFF (14)
+ #define DDRCKECH0_CR_DDRCRCMDPICODING_Spare_WID (18)
+ #define DDRCKECH0_CR_DDRCRCMDPICODING_Spare_MSK (0xFFFFC000)
+ #define DDRCKECH0_CR_DDRCRCMDPICODING_Spare_MAX (0x0003FFFF)
+ #define DDRCKECH0_CR_DDRCRCMDPICODING_Spare_DEF (0x00000000)
+
+#define DDRCKECH0_CR_DDRCRCTLCOMP_REG (0x00001210)
+ #define DDRCKECH0_CR_DDRCRCTLCOMP_Scomp_OFF ( 0)
+ #define DDRCKECH0_CR_DDRCRCTLCOMP_Scomp_WID ( 6)
+ #define DDRCKECH0_CR_DDRCRCTLCOMP_Scomp_MSK (0x0000003F)
+ #define DDRCKECH0_CR_DDRCRCTLCOMP_Scomp_MAX (0x0000003F)
+ #define DDRCKECH0_CR_DDRCRCTLCOMP_Scomp_DEF (0x00000000)
+ #define DDRCKECH0_CR_DDRCRCTLCOMP_TcoComp_OFF ( 6)
+ #define DDRCKECH0_CR_DDRCRCTLCOMP_TcoComp_WID ( 6)
+ #define DDRCKECH0_CR_DDRCRCTLCOMP_TcoComp_MSK (0x00000FC0)
+ #define DDRCKECH0_CR_DDRCRCTLCOMP_TcoComp_MAX (0x0000003F)
+ #define DDRCKECH0_CR_DDRCRCTLCOMP_TcoComp_DEF (0x00000000)
+ #define DDRCKECH0_CR_DDRCRCTLCOMP_RcompDrvUp_OFF (12)
+ #define DDRCKECH0_CR_DDRCRCTLCOMP_RcompDrvUp_WID ( 6)
+ #define DDRCKECH0_CR_DDRCRCTLCOMP_RcompDrvUp_MSK (0x0003F000)
+ #define DDRCKECH0_CR_DDRCRCTLCOMP_RcompDrvUp_MAX (0x0000003F)
+ #define DDRCKECH0_CR_DDRCRCTLCOMP_RcompDrvUp_DEF (0x00000000)
+ #define DDRCKECH0_CR_DDRCRCTLCOMP_RcompDrvDown_OFF (18)
+ #define DDRCKECH0_CR_DDRCRCTLCOMP_RcompDrvDown_WID ( 6)
+ #define DDRCKECH0_CR_DDRCRCTLCOMP_RcompDrvDown_MSK (0x00FC0000)
+ #define DDRCKECH0_CR_DDRCRCTLCOMP_RcompDrvDown_MAX (0x0000003F)
+ #define DDRCKECH0_CR_DDRCRCTLCOMP_RcompDrvDown_DEF (0x00000000)
+ #define DDRCKECH0_CR_DDRCRCTLCOMP_LsComp_OFF (24)
+ #define DDRCKECH0_CR_DDRCRCTLCOMP_LsComp_WID ( 3)
+ #define DDRCKECH0_CR_DDRCRCTLCOMP_LsComp_MSK (0x07000000)
+ #define DDRCKECH0_CR_DDRCRCTLCOMP_LsComp_MAX (0x00000007)
+ #define DDRCKECH0_CR_DDRCRCTLCOMP_LsComp_DEF (0x00000000)
+ #define DDRCKECH0_CR_DDRCRCTLCOMP_Spare_OFF (27)
+ #define DDRCKECH0_CR_DDRCRCTLCOMP_Spare_WID ( 5)
+ #define DDRCKECH0_CR_DDRCRCTLCOMP_Spare_MSK (0xF8000000)
+ #define DDRCKECH0_CR_DDRCRCTLCOMP_Spare_MAX (0x0000001F)
+ #define DDRCKECH0_CR_DDRCRCTLCOMP_Spare_DEF (0x00000000)
+
+#define DDRCKECH0_CR_DDRCRCTLCOMPOFFSET_REG (0x00001214)
+ #define DDRCKECH0_CR_DDRCRCTLCOMPOFFSET_ScompOffset_OFF ( 0)
+ #define DDRCKECH0_CR_DDRCRCTLCOMPOFFSET_ScompOffset_WID ( 5)
+ #define DDRCKECH0_CR_DDRCRCTLCOMPOFFSET_ScompOffset_MSK (0x0000001F)
+ #define DDRCKECH0_CR_DDRCRCTLCOMPOFFSET_ScompOffset_MAX (0x0000001F)
+ #define DDRCKECH0_CR_DDRCRCTLCOMPOFFSET_ScompOffset_DEF (0x00000000)
+ #define DDRCKECH0_CR_DDRCRCTLCOMPOFFSET_TcoCompOffset_OFF ( 5)
+ #define DDRCKECH0_CR_DDRCRCTLCOMPOFFSET_TcoCompOffset_WID ( 4)
+ #define DDRCKECH0_CR_DDRCRCTLCOMPOFFSET_TcoCompOffset_MSK (0x000001E0)
+ #define DDRCKECH0_CR_DDRCRCTLCOMPOFFSET_TcoCompOffset_MAX (0x0000000F)
+ #define DDRCKECH0_CR_DDRCRCTLCOMPOFFSET_TcoCompOffset_DEF (0x00000000)
+ #define DDRCKECH0_CR_DDRCRCTLCOMPOFFSET_RcompDrvUpOffset_OFF ( 9)
+ #define DDRCKECH0_CR_DDRCRCTLCOMPOFFSET_RcompDrvUpOffset_WID ( 4)
+ #define DDRCKECH0_CR_DDRCRCTLCOMPOFFSET_RcompDrvUpOffset_MSK (0x00001E00)
+ #define DDRCKECH0_CR_DDRCRCTLCOMPOFFSET_RcompDrvUpOffset_MAX (0x0000000F)
+ #define DDRCKECH0_CR_DDRCRCTLCOMPOFFSET_RcompDrvUpOffset_DEF (0x00000000)
+ #define DDRCKECH0_CR_DDRCRCTLCOMPOFFSET_RcompDrvDownOffset_OFF (13)
+ #define DDRCKECH0_CR_DDRCRCTLCOMPOFFSET_RcompDrvDownOffset_WID ( 4)
+ #define DDRCKECH0_CR_DDRCRCTLCOMPOFFSET_RcompDrvDownOffset_MSK (0x0001E000)
+ #define DDRCKECH0_CR_DDRCRCTLCOMPOFFSET_RcompDrvDownOffset_MAX (0x0000000F)
+ #define DDRCKECH0_CR_DDRCRCTLCOMPOFFSET_RcompDrvDownOffset_DEF (0x00000000)
+ #define DDRCKECH0_CR_DDRCRCTLCOMPOFFSET_Spare_OFF (17)
+ #define DDRCKECH0_CR_DDRCRCTLCOMPOFFSET_Spare_WID (15)
+ #define DDRCKECH0_CR_DDRCRCTLCOMPOFFSET_Spare_MSK (0xFFFE0000)
+ #define DDRCKECH0_CR_DDRCRCTLCOMPOFFSET_Spare_MAX (0x00007FFF)
+ #define DDRCKECH0_CR_DDRCRCTLCOMPOFFSET_Spare_DEF (0x00000000)
+
+#define DDRCKECH0_CR_DDRCRCTLPICODING_REG (0x00001218)
+ #define DDRCKECH0_CR_DDRCRCTLPICODING_CtlPiCode0_OFF ( 0)
+ #define DDRCKECH0_CR_DDRCRCTLPICODING_CtlPiCode0_WID ( 7)
+ #define DDRCKECH0_CR_DDRCRCTLPICODING_CtlPiCode0_MSK (0x0000007F)
+ #define DDRCKECH0_CR_DDRCRCTLPICODING_CtlPiCode0_MAX (0x0000007F)
+ #define DDRCKECH0_CR_DDRCRCTLPICODING_CtlPiCode0_DEF (0x00000000)
+ #define DDRCKECH0_CR_DDRCRCTLPICODING_CtlPiCode1_OFF ( 7)
+ #define DDRCKECH0_CR_DDRCRCTLPICODING_CtlPiCode1_WID ( 7)
+ #define DDRCKECH0_CR_DDRCRCTLPICODING_CtlPiCode1_MSK (0x00003F80)
+ #define DDRCKECH0_CR_DDRCRCTLPICODING_CtlPiCode1_MAX (0x0000007F)
+ #define DDRCKECH0_CR_DDRCRCTLPICODING_CtlPiCode1_DEF (0x00000000)
+ #define DDRCKECH0_CR_DDRCRCTLPICODING_CtlPiCode2_OFF (14)
+ #define DDRCKECH0_CR_DDRCRCTLPICODING_CtlPiCode2_WID ( 7)
+ #define DDRCKECH0_CR_DDRCRCTLPICODING_CtlPiCode2_MSK (0x001FC000)
+ #define DDRCKECH0_CR_DDRCRCTLPICODING_CtlPiCode2_MAX (0x0000007F)
+ #define DDRCKECH0_CR_DDRCRCTLPICODING_CtlPiCode2_DEF (0x00000000)
+ #define DDRCKECH0_CR_DDRCRCTLPICODING_CtlPiCode3_OFF (21)
+ #define DDRCKECH0_CR_DDRCRCTLPICODING_CtlPiCode3_WID ( 7)
+ #define DDRCKECH0_CR_DDRCRCTLPICODING_CtlPiCode3_MSK (0x0FE00000)
+ #define DDRCKECH0_CR_DDRCRCTLPICODING_CtlPiCode3_MAX (0x0000007F)
+ #define DDRCKECH0_CR_DDRCRCTLPICODING_CtlPiCode3_DEF (0x00000000)
+ #define DDRCKECH0_CR_DDRCRCTLPICODING_CtlXoverEnable_OFF (28)
+ #define DDRCKECH0_CR_DDRCRCTLPICODING_CtlXoverEnable_WID ( 1)
+ #define DDRCKECH0_CR_DDRCRCTLPICODING_CtlXoverEnable_MSK (0x10000000)
+ #define DDRCKECH0_CR_DDRCRCTLPICODING_CtlXoverEnable_MAX (0x00000001)
+ #define DDRCKECH0_CR_DDRCRCTLPICODING_CtlXoverEnable_DEF (0x00000000)
+ #define DDRCKECH0_CR_DDRCRCTLPICODING_Spare_OFF (29)
+ #define DDRCKECH0_CR_DDRCRCTLPICODING_Spare_WID ( 3)
+ #define DDRCKECH0_CR_DDRCRCTLPICODING_Spare_MSK (0xE0000000)
+ #define DDRCKECH0_CR_DDRCRCTLPICODING_Spare_MAX (0x00000007)
+ #define DDRCKECH0_CR_DDRCRCTLPICODING_Spare_DEF (0x00000000)
+
+#define DDRCKECH0_CR_DDRCRCTLCONTROLS_REG (0x0000121C)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_RefPi_OFF ( 0)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_RefPi_WID ( 4)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_RefPi_MSK (0x0000000F)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_RefPi_MAX (0x0000000F)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_RefPi_DEF (0x00000000)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_DllMask_OFF ( 4)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_DllMask_WID ( 2)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_DllMask_MSK (0x00000030)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_DllMask_MAX (0x00000003)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_DllMask_DEF (0x00000000)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_DllRsvd1_OFF ( 6)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_DllRsvd1_WID ( 1)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_DllRsvd1_MSK (0x00000040)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_DllRsvd1_MAX (0x00000001)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_DllRsvd1_DEF (0x00000000)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_TxOn_OFF ( 7)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_TxOn_WID ( 1)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_TxOn_MSK (0x00000080)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_TxOn_MAX (0x00000001)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_TxOn_DEF (0x00000000)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_IntClkOn_OFF ( 8)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_IntClkOn_WID ( 1)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_IntClkOn_MSK (0x00000100)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_IntClkOn_MAX (0x00000001)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_IntClkOn_DEF (0x00000000)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_RepClkOn_OFF ( 9)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_RepClkOn_WID ( 1)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_RepClkOn_MSK (0x00000200)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_RepClkOn_MAX (0x00000001)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_RepClkOn_DEF (0x00000000)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_IOLBCtl_OFF (10)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_IOLBCtl_WID ( 2)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_IOLBCtl_MSK (0x00000C00)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_IOLBCtl_MAX (0x00000003)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_IOLBCtl_DEF (0x00000000)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_OdtMode_OFF (12)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_OdtMode_WID ( 1)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_OdtMode_MSK (0x00001000)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_OdtMode_MAX (0x00000001)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_OdtMode_DEF (0x00000000)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_CmdTxEq_OFF (13)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_CmdTxEq_WID ( 2)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_CmdTxEq_MSK (0x00006000)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_CmdTxEq_MAX (0x00000003)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_CmdTxEq_DEF (0x00000000)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_EarlyWeakDrive_OFF (15)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_EarlyWeakDrive_WID ( 2)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_EarlyWeakDrive_MSK (0x00018000)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_EarlyWeakDrive_MAX (0x00000003)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_EarlyWeakDrive_DEF (0x00000000)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_CtlTxEq_OFF (17)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_CtlTxEq_WID ( 2)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_CtlTxEq_MSK (0x00060000)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_CtlTxEq_MAX (0x00000003)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_CtlTxEq_DEF (0x00000000)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_CtlSRDrv_OFF (19)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_CtlSRDrv_WID ( 2)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_CtlSRDrv_MSK (0x00180000)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_CtlSRDrv_MAX (0x00000003)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_CtlSRDrv_DEF (0x00000000)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_RxVref_OFF (21)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_RxVref_WID ( 6)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_RxVref_MSK (0x07E00000)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_RxVref_MAX (0x0000003F)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_RxVref_DEF (0x00000000)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_VccddqHi_OFF (27)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_VccddqHi_WID ( 1)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_VccddqHi_MSK (0x08000000)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_VccddqHi_MAX (0x00000001)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_VccddqHi_DEF (0x00000000)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_DllWeakLock_OFF (28)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_DllWeakLock_WID ( 1)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_DllWeakLock_MSK (0x10000000)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_DllWeakLock_MAX (0x00000001)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_DllWeakLock_DEF (0x00000000)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_LPDDR_Mode_OFF (29)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_LPDDR_Mode_WID ( 1)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_LPDDR_Mode_MSK (0x20000000)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_LPDDR_Mode_MAX (0x00000001)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_LPDDR_Mode_DEF (0x00000000)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_LaDrvEnOvrd_OFF (30)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_LaDrvEnOvrd_WID ( 1)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_LaDrvEnOvrd_MSK (0x40000000)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_LaDrvEnOvrd_MAX (0x00000001)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_LaDrvEnOvrd_DEF (0x00000000)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_LPDdrCAA_Dis_OFF (31)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_LPDdrCAA_Dis_WID ( 1)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_LPDdrCAA_Dis_MSK (0x80000000)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_LPDdrCAA_Dis_MAX (0x00000001)
+ #define DDRCKECH0_CR_DDRCRCTLCONTROLS_LPDdrCAA_Dis_DEF (0x00000000)
+
+#define DDRCKECH0_CR_DDRCRCTLRANKSUSED_REG (0x00001220)
+ #define DDRCKECH0_CR_DDRCRCTLRANKSUSED_RankEn_OFF ( 0)
+ #define DDRCKECH0_CR_DDRCRCTLRANKSUSED_RankEn_WID ( 4)
+ #define DDRCKECH0_CR_DDRCRCTLRANKSUSED_RankEn_MSK (0x0000000F)
+ #define DDRCKECH0_CR_DDRCRCTLRANKSUSED_RankEn_MAX (0x0000000F)
+ #define DDRCKECH0_CR_DDRCRCTLRANKSUSED_RankEn_DEF (0x0000000F)
+ #define DDRCKECH0_CR_DDRCRCTLRANKSUSED_OdtDisable_OFF ( 4)
+ #define DDRCKECH0_CR_DDRCRCTLRANKSUSED_OdtDisable_WID ( 2)
+ #define DDRCKECH0_CR_DDRCRCTLRANKSUSED_OdtDisable_MSK (0x00000030)
+ #define DDRCKECH0_CR_DDRCRCTLRANKSUSED_OdtDisable_MAX (0x00000003)
+ #define DDRCKECH0_CR_DDRCRCTLRANKSUSED_OdtDisable_DEF (0x00000000)
+ #define DDRCKECH0_CR_DDRCRCTLRANKSUSED_Spare_OFF ( 6)
+ #define DDRCKECH0_CR_DDRCRCTLRANKSUSED_Spare_WID (26)
+ #define DDRCKECH0_CR_DDRCRCTLRANKSUSED_Spare_MSK (0xFFFFFFC0)
+ #define DDRCKECH0_CR_DDRCRCTLRANKSUSED_Spare_MAX (0x03FFFFFF)
+ #define DDRCKECH0_CR_DDRCRCTLRANKSUSED_Spare_DEF (0x00000000)
+
+#define DDRCKECH0_CR_DLLPITESTANDADC_REG (0x00001224)
+ #define DDRCKECH0_CR_DLLPITESTANDADC_RunTest_OFF ( 0)
+ #define DDRCKECH0_CR_DLLPITESTANDADC_RunTest_WID ( 1)
+ #define DDRCKECH0_CR_DLLPITESTANDADC_RunTest_MSK (0x00000001)
+ #define DDRCKECH0_CR_DLLPITESTANDADC_RunTest_MAX (0x00000001)
+ #define DDRCKECH0_CR_DLLPITESTANDADC_RunTest_DEF (0x00000000)
+ #define DDRCKECH0_CR_DLLPITESTANDADC_Load_OFF ( 1)
+ #define DDRCKECH0_CR_DLLPITESTANDADC_Load_WID ( 1)
+ #define DDRCKECH0_CR_DLLPITESTANDADC_Load_MSK (0x00000002)
+ #define DDRCKECH0_CR_DLLPITESTANDADC_Load_MAX (0x00000001)
+ #define DDRCKECH0_CR_DLLPITESTANDADC_Load_DEF (0x00000000)
+ #define DDRCKECH0_CR_DLLPITESTANDADC_ModeHVM_OFF ( 2)
+ #define DDRCKECH0_CR_DLLPITESTANDADC_ModeHVM_WID ( 1)
+ #define DDRCKECH0_CR_DLLPITESTANDADC_ModeHVM_MSK (0x00000004)
+ #define DDRCKECH0_CR_DLLPITESTANDADC_ModeHVM_MAX (0x00000001)
+ #define DDRCKECH0_CR_DLLPITESTANDADC_ModeHVM_DEF (0x00000000)
+ #define DDRCKECH0_CR_DLLPITESTANDADC_ModeDV_OFF ( 3)
+ #define DDRCKECH0_CR_DLLPITESTANDADC_ModeDV_WID ( 1)
+ #define DDRCKECH0_CR_DLLPITESTANDADC_ModeDV_MSK (0x00000008)
+ #define DDRCKECH0_CR_DLLPITESTANDADC_ModeDV_MAX (0x00000001)
+ #define DDRCKECH0_CR_DLLPITESTANDADC_ModeDV_DEF (0x00000000)
+ #define DDRCKECH0_CR_DLLPITESTANDADC_ModeADC_OFF ( 4)
+ #define DDRCKECH0_CR_DLLPITESTANDADC_ModeADC_WID ( 1)
+ #define DDRCKECH0_CR_DLLPITESTANDADC_ModeADC_MSK (0x00000010)
+ #define DDRCKECH0_CR_DLLPITESTANDADC_ModeADC_MAX (0x00000001)
+ #define DDRCKECH0_CR_DLLPITESTANDADC_ModeADC_DEF (0x00000000)
+ #define DDRCKECH0_CR_DLLPITESTANDADC_LoadCount_OFF ( 5)
+ #define DDRCKECH0_CR_DLLPITESTANDADC_LoadCount_WID (10)
+ #define DDRCKECH0_CR_DLLPITESTANDADC_LoadCount_MSK (0x00007FE0)
+ #define DDRCKECH0_CR_DLLPITESTANDADC_LoadCount_MAX (0x000003FF)
+ #define DDRCKECH0_CR_DLLPITESTANDADC_CountStatus_OFF (15)
+ #define DDRCKECH0_CR_DLLPITESTANDADC_CountStatus_WID (10)
+ #define DDRCKECH0_CR_DLLPITESTANDADC_CountStatus_MSK (0x01FF8000)
+ #define DDRCKECH0_CR_DLLPITESTANDADC_CountStatus_MAX (0x000003FF)
+ #define DDRCKECH0_CR_DLLPITESTANDADC_CountStatus_DEF (0x00000000)
+ #define DDRCKECH0_CR_DLLPITESTANDADC_Spare_OFF (25)
+ #define DDRCKECH0_CR_DLLPITESTANDADC_Spare_WID ( 7)
+ #define DDRCKECH0_CR_DLLPITESTANDADC_Spare_MSK (0xFE000000)
+ #define DDRCKECH0_CR_DLLPITESTANDADC_Spare_MAX (0x0000007F)
+
+#define DDRCKECH1_CR_DDRCRCMDCOMP_REG (0x00001300)
+ #define DDRCKECH1_CR_DDRCRCMDCOMP_Scomp_OFF ( 0)
+ #define DDRCKECH1_CR_DDRCRCMDCOMP_Scomp_WID ( 6)
+ #define DDRCKECH1_CR_DDRCRCMDCOMP_Scomp_MSK (0x0000003F)
+ #define DDRCKECH1_CR_DDRCRCMDCOMP_Scomp_MAX (0x0000003F)
+ #define DDRCKECH1_CR_DDRCRCMDCOMP_Scomp_DEF (0x00000000)
+ #define DDRCKECH1_CR_DDRCRCMDCOMP_TcoComp_OFF ( 6)
+ #define DDRCKECH1_CR_DDRCRCMDCOMP_TcoComp_WID ( 6)
+ #define DDRCKECH1_CR_DDRCRCMDCOMP_TcoComp_MSK (0x00000FC0)
+ #define DDRCKECH1_CR_DDRCRCMDCOMP_TcoComp_MAX (0x0000003F)
+ #define DDRCKECH1_CR_DDRCRCMDCOMP_TcoComp_DEF (0x00000000)
+ #define DDRCKECH1_CR_DDRCRCMDCOMP_RcompDrvUp_OFF (12)
+ #define DDRCKECH1_CR_DDRCRCMDCOMP_RcompDrvUp_WID ( 6)
+ #define DDRCKECH1_CR_DDRCRCMDCOMP_RcompDrvUp_MSK (0x0003F000)
+ #define DDRCKECH1_CR_DDRCRCMDCOMP_RcompDrvUp_MAX (0x0000003F)
+ #define DDRCKECH1_CR_DDRCRCMDCOMP_RcompDrvUp_DEF (0x00000000)
+ #define DDRCKECH1_CR_DDRCRCMDCOMP_RcompDrvDown_OFF (18)
+ #define DDRCKECH1_CR_DDRCRCMDCOMP_RcompDrvDown_WID ( 6)
+ #define DDRCKECH1_CR_DDRCRCMDCOMP_RcompDrvDown_MSK (0x00FC0000)
+ #define DDRCKECH1_CR_DDRCRCMDCOMP_RcompDrvDown_MAX (0x0000003F)
+ #define DDRCKECH1_CR_DDRCRCMDCOMP_RcompDrvDown_DEF (0x00000000)
+ #define DDRCKECH1_CR_DDRCRCMDCOMP_LsComp_OFF (24)
+ #define DDRCKECH1_CR_DDRCRCMDCOMP_LsComp_WID ( 3)
+ #define DDRCKECH1_CR_DDRCRCMDCOMP_LsComp_MSK (0x07000000)
+ #define DDRCKECH1_CR_DDRCRCMDCOMP_LsComp_MAX (0x00000007)
+ #define DDRCKECH1_CR_DDRCRCMDCOMP_LsComp_DEF (0x00000004)
+ #define DDRCKECH1_CR_DDRCRCMDCOMP_Spare_OFF (27)
+ #define DDRCKECH1_CR_DDRCRCMDCOMP_Spare_WID ( 5)
+ #define DDRCKECH1_CR_DDRCRCMDCOMP_Spare_MSK (0xF8000000)
+ #define DDRCKECH1_CR_DDRCRCMDCOMP_Spare_MAX (0x0000001F)
+ #define DDRCKECH1_CR_DDRCRCMDCOMP_Spare_DEF (0x00000000)
+
+#define DDRCKECH1_CR_DDRCRCMDCOMPOFFSET_REG (0x00001304)
+ #define DDRCKECH1_CR_DDRCRCMDCOMPOFFSET_ScompOffset_OFF ( 0)
+ #define DDRCKECH1_CR_DDRCRCMDCOMPOFFSET_ScompOffset_WID ( 5)
+ #define DDRCKECH1_CR_DDRCRCMDCOMPOFFSET_ScompOffset_MSK (0x0000001F)
+ #define DDRCKECH1_CR_DDRCRCMDCOMPOFFSET_ScompOffset_MAX (0x0000001F)
+ #define DDRCKECH1_CR_DDRCRCMDCOMPOFFSET_ScompOffset_DEF (0x00000000)
+ #define DDRCKECH1_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_OFF ( 5)
+ #define DDRCKECH1_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_WID ( 4)
+ #define DDRCKECH1_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_MSK (0x000001E0)
+ #define DDRCKECH1_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_MAX (0x0000000F)
+ #define DDRCKECH1_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_DEF (0x00000000)
+ #define DDRCKECH1_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_OFF ( 9)
+ #define DDRCKECH1_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_WID ( 4)
+ #define DDRCKECH1_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_MSK (0x00001E00)
+ #define DDRCKECH1_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_MAX (0x0000000F)
+ #define DDRCKECH1_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_DEF (0x00000000)
+ #define DDRCKECH1_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_OFF (13)
+ #define DDRCKECH1_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_WID ( 4)
+ #define DDRCKECH1_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_MSK (0x0001E000)
+ #define DDRCKECH1_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_MAX (0x0000000F)
+ #define DDRCKECH1_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_DEF (0x00000000)
+ #define DDRCKECH1_CR_DDRCRCMDCOMPOFFSET_Spare_OFF (17)
+ #define DDRCKECH1_CR_DDRCRCMDCOMPOFFSET_Spare_WID (15)
+ #define DDRCKECH1_CR_DDRCRCMDCOMPOFFSET_Spare_MSK (0xFFFE0000)
+ #define DDRCKECH1_CR_DDRCRCMDCOMPOFFSET_Spare_MAX (0x00007FFF)
+ #define DDRCKECH1_CR_DDRCRCMDCOMPOFFSET_Spare_DEF (0x00000000)
+
+#define DDRCKECH1_CR_DDRCRCMDPICODING_REG (0x00001308)
+ #define DDRCKECH1_CR_DDRCRCMDPICODING_CmdPi0Code_OFF ( 0)
+ #define DDRCKECH1_CR_DDRCRCMDPICODING_CmdPi0Code_WID ( 7)
+ #define DDRCKECH1_CR_DDRCRCMDPICODING_CmdPi0Code_MSK (0x0000007F)
+ #define DDRCKECH1_CR_DDRCRCMDPICODING_CmdPi0Code_MAX (0x0000007F)
+ #define DDRCKECH1_CR_DDRCRCMDPICODING_CmdPi0Code_DEF (0x00000000)
+ #define DDRCKECH1_CR_DDRCRCMDPICODING_CmdPi1Code_OFF ( 7)
+ #define DDRCKECH1_CR_DDRCRCMDPICODING_CmdPi1Code_WID ( 7)
+ #define DDRCKECH1_CR_DDRCRCMDPICODING_CmdPi1Code_MSK (0x00003F80)
+ #define DDRCKECH1_CR_DDRCRCMDPICODING_CmdPi1Code_MAX (0x0000007F)
+ #define DDRCKECH1_CR_DDRCRCMDPICODING_CmdPi1Code_DEF (0x00000000)
+ #define DDRCKECH1_CR_DDRCRCMDPICODING_Spare_OFF (14)
+ #define DDRCKECH1_CR_DDRCRCMDPICODING_Spare_WID (18)
+ #define DDRCKECH1_CR_DDRCRCMDPICODING_Spare_MSK (0xFFFFC000)
+ #define DDRCKECH1_CR_DDRCRCMDPICODING_Spare_MAX (0x0003FFFF)
+ #define DDRCKECH1_CR_DDRCRCMDPICODING_Spare_DEF (0x00000000)
+
+#define DDRCKECH1_CR_DDRCRCTLCOMP_REG (0x00001310)
+ #define DDRCKECH1_CR_DDRCRCTLCOMP_Scomp_OFF ( 0)
+ #define DDRCKECH1_CR_DDRCRCTLCOMP_Scomp_WID ( 6)
+ #define DDRCKECH1_CR_DDRCRCTLCOMP_Scomp_MSK (0x0000003F)
+ #define DDRCKECH1_CR_DDRCRCTLCOMP_Scomp_MAX (0x0000003F)
+ #define DDRCKECH1_CR_DDRCRCTLCOMP_Scomp_DEF (0x00000000)
+ #define DDRCKECH1_CR_DDRCRCTLCOMP_TcoComp_OFF ( 6)
+ #define DDRCKECH1_CR_DDRCRCTLCOMP_TcoComp_WID ( 6)
+ #define DDRCKECH1_CR_DDRCRCTLCOMP_TcoComp_MSK (0x00000FC0)
+ #define DDRCKECH1_CR_DDRCRCTLCOMP_TcoComp_MAX (0x0000003F)
+ #define DDRCKECH1_CR_DDRCRCTLCOMP_TcoComp_DEF (0x00000000)
+ #define DDRCKECH1_CR_DDRCRCTLCOMP_RcompDrvUp_OFF (12)
+ #define DDRCKECH1_CR_DDRCRCTLCOMP_RcompDrvUp_WID ( 6)
+ #define DDRCKECH1_CR_DDRCRCTLCOMP_RcompDrvUp_MSK (0x0003F000)
+ #define DDRCKECH1_CR_DDRCRCTLCOMP_RcompDrvUp_MAX (0x0000003F)
+ #define DDRCKECH1_CR_DDRCRCTLCOMP_RcompDrvUp_DEF (0x00000000)
+ #define DDRCKECH1_CR_DDRCRCTLCOMP_RcompDrvDown_OFF (18)
+ #define DDRCKECH1_CR_DDRCRCTLCOMP_RcompDrvDown_WID ( 6)
+ #define DDRCKECH1_CR_DDRCRCTLCOMP_RcompDrvDown_MSK (0x00FC0000)
+ #define DDRCKECH1_CR_DDRCRCTLCOMP_RcompDrvDown_MAX (0x0000003F)
+ #define DDRCKECH1_CR_DDRCRCTLCOMP_RcompDrvDown_DEF (0x00000000)
+ #define DDRCKECH1_CR_DDRCRCTLCOMP_LsComp_OFF (24)
+ #define DDRCKECH1_CR_DDRCRCTLCOMP_LsComp_WID ( 3)
+ #define DDRCKECH1_CR_DDRCRCTLCOMP_LsComp_MSK (0x07000000)
+ #define DDRCKECH1_CR_DDRCRCTLCOMP_LsComp_MAX (0x00000007)
+ #define DDRCKECH1_CR_DDRCRCTLCOMP_LsComp_DEF (0x00000000)
+ #define DDRCKECH1_CR_DDRCRCTLCOMP_Spare_OFF (27)
+ #define DDRCKECH1_CR_DDRCRCTLCOMP_Spare_WID ( 5)
+ #define DDRCKECH1_CR_DDRCRCTLCOMP_Spare_MSK (0xF8000000)
+ #define DDRCKECH1_CR_DDRCRCTLCOMP_Spare_MAX (0x0000001F)
+ #define DDRCKECH1_CR_DDRCRCTLCOMP_Spare_DEF (0x00000000)
+
+#define DDRCKECH1_CR_DDRCRCTLCOMPOFFSET_REG (0x00001314)
+ #define DDRCKECH1_CR_DDRCRCTLCOMPOFFSET_ScompOffset_OFF ( 0)
+ #define DDRCKECH1_CR_DDRCRCTLCOMPOFFSET_ScompOffset_WID ( 5)
+ #define DDRCKECH1_CR_DDRCRCTLCOMPOFFSET_ScompOffset_MSK (0x0000001F)
+ #define DDRCKECH1_CR_DDRCRCTLCOMPOFFSET_ScompOffset_MAX (0x0000001F)
+ #define DDRCKECH1_CR_DDRCRCTLCOMPOFFSET_ScompOffset_DEF (0x00000000)
+ #define DDRCKECH1_CR_DDRCRCTLCOMPOFFSET_TcoCompOffset_OFF ( 5)
+ #define DDRCKECH1_CR_DDRCRCTLCOMPOFFSET_TcoCompOffset_WID ( 4)
+ #define DDRCKECH1_CR_DDRCRCTLCOMPOFFSET_TcoCompOffset_MSK (0x000001E0)
+ #define DDRCKECH1_CR_DDRCRCTLCOMPOFFSET_TcoCompOffset_MAX (0x0000000F)
+ #define DDRCKECH1_CR_DDRCRCTLCOMPOFFSET_TcoCompOffset_DEF (0x00000000)
+ #define DDRCKECH1_CR_DDRCRCTLCOMPOFFSET_RcompDrvUpOffset_OFF ( 9)
+ #define DDRCKECH1_CR_DDRCRCTLCOMPOFFSET_RcompDrvUpOffset_WID ( 4)
+ #define DDRCKECH1_CR_DDRCRCTLCOMPOFFSET_RcompDrvUpOffset_MSK (0x00001E00)
+ #define DDRCKECH1_CR_DDRCRCTLCOMPOFFSET_RcompDrvUpOffset_MAX (0x0000000F)
+ #define DDRCKECH1_CR_DDRCRCTLCOMPOFFSET_RcompDrvUpOffset_DEF (0x00000000)
+ #define DDRCKECH1_CR_DDRCRCTLCOMPOFFSET_RcompDrvDownOffset_OFF (13)
+ #define DDRCKECH1_CR_DDRCRCTLCOMPOFFSET_RcompDrvDownOffset_WID ( 4)
+ #define DDRCKECH1_CR_DDRCRCTLCOMPOFFSET_RcompDrvDownOffset_MSK (0x0001E000)
+ #define DDRCKECH1_CR_DDRCRCTLCOMPOFFSET_RcompDrvDownOffset_MAX (0x0000000F)
+ #define DDRCKECH1_CR_DDRCRCTLCOMPOFFSET_RcompDrvDownOffset_DEF (0x00000000)
+ #define DDRCKECH1_CR_DDRCRCTLCOMPOFFSET_Spare_OFF (17)
+ #define DDRCKECH1_CR_DDRCRCTLCOMPOFFSET_Spare_WID (15)
+ #define DDRCKECH1_CR_DDRCRCTLCOMPOFFSET_Spare_MSK (0xFFFE0000)
+ #define DDRCKECH1_CR_DDRCRCTLCOMPOFFSET_Spare_MAX (0x00007FFF)
+ #define DDRCKECH1_CR_DDRCRCTLCOMPOFFSET_Spare_DEF (0x00000000)
+
+#define DDRCKECH1_CR_DDRCRCTLPICODING_REG (0x00001318)
+ #define DDRCKECH1_CR_DDRCRCTLPICODING_CtlPiCode0_OFF ( 0)
+ #define DDRCKECH1_CR_DDRCRCTLPICODING_CtlPiCode0_WID ( 7)
+ #define DDRCKECH1_CR_DDRCRCTLPICODING_CtlPiCode0_MSK (0x0000007F)
+ #define DDRCKECH1_CR_DDRCRCTLPICODING_CtlPiCode0_MAX (0x0000007F)
+ #define DDRCKECH1_CR_DDRCRCTLPICODING_CtlPiCode0_DEF (0x00000000)
+ #define DDRCKECH1_CR_DDRCRCTLPICODING_CtlPiCode1_OFF ( 7)
+ #define DDRCKECH1_CR_DDRCRCTLPICODING_CtlPiCode1_WID ( 7)
+ #define DDRCKECH1_CR_DDRCRCTLPICODING_CtlPiCode1_MSK (0x00003F80)
+ #define DDRCKECH1_CR_DDRCRCTLPICODING_CtlPiCode1_MAX (0x0000007F)
+ #define DDRCKECH1_CR_DDRCRCTLPICODING_CtlPiCode1_DEF (0x00000000)
+ #define DDRCKECH1_CR_DDRCRCTLPICODING_CtlPiCode2_OFF (14)
+ #define DDRCKECH1_CR_DDRCRCTLPICODING_CtlPiCode2_WID ( 7)
+ #define DDRCKECH1_CR_DDRCRCTLPICODING_CtlPiCode2_MSK (0x001FC000)
+ #define DDRCKECH1_CR_DDRCRCTLPICODING_CtlPiCode2_MAX (0x0000007F)
+ #define DDRCKECH1_CR_DDRCRCTLPICODING_CtlPiCode2_DEF (0x00000000)
+ #define DDRCKECH1_CR_DDRCRCTLPICODING_CtlPiCode3_OFF (21)
+ #define DDRCKECH1_CR_DDRCRCTLPICODING_CtlPiCode3_WID ( 7)
+ #define DDRCKECH1_CR_DDRCRCTLPICODING_CtlPiCode3_MSK (0x0FE00000)
+ #define DDRCKECH1_CR_DDRCRCTLPICODING_CtlPiCode3_MAX (0x0000007F)
+ #define DDRCKECH1_CR_DDRCRCTLPICODING_CtlPiCode3_DEF (0x00000000)
+ #define DDRCKECH1_CR_DDRCRCTLPICODING_CtlXoverEnable_OFF (28)
+ #define DDRCKECH1_CR_DDRCRCTLPICODING_CtlXoverEnable_WID ( 1)
+ #define DDRCKECH1_CR_DDRCRCTLPICODING_CtlXoverEnable_MSK (0x10000000)
+ #define DDRCKECH1_CR_DDRCRCTLPICODING_CtlXoverEnable_MAX (0x00000001)
+ #define DDRCKECH1_CR_DDRCRCTLPICODING_CtlXoverEnable_DEF (0x00000000)
+ #define DDRCKECH1_CR_DDRCRCTLPICODING_Spare_OFF (29)
+ #define DDRCKECH1_CR_DDRCRCTLPICODING_Spare_WID ( 3)
+ #define DDRCKECH1_CR_DDRCRCTLPICODING_Spare_MSK (0xE0000000)
+ #define DDRCKECH1_CR_DDRCRCTLPICODING_Spare_MAX (0x00000007)
+ #define DDRCKECH1_CR_DDRCRCTLPICODING_Spare_DEF (0x00000000)
+
+#define DDRCKECH1_CR_DDRCRCTLCONTROLS_REG (0x0000131C)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_RefPi_OFF ( 0)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_RefPi_WID ( 4)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_RefPi_MSK (0x0000000F)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_RefPi_MAX (0x0000000F)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_RefPi_DEF (0x00000000)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_DllMask_OFF ( 4)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_DllMask_WID ( 2)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_DllMask_MSK (0x00000030)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_DllMask_MAX (0x00000003)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_DllMask_DEF (0x00000000)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_DllRsvd1_OFF ( 6)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_DllRsvd1_WID ( 1)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_DllRsvd1_MSK (0x00000040)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_DllRsvd1_MAX (0x00000001)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_DllRsvd1_DEF (0x00000000)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_TxOn_OFF ( 7)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_TxOn_WID ( 1)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_TxOn_MSK (0x00000080)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_TxOn_MAX (0x00000001)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_TxOn_DEF (0x00000000)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_IntClkOn_OFF ( 8)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_IntClkOn_WID ( 1)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_IntClkOn_MSK (0x00000100)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_IntClkOn_MAX (0x00000001)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_IntClkOn_DEF (0x00000000)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_RepClkOn_OFF ( 9)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_RepClkOn_WID ( 1)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_RepClkOn_MSK (0x00000200)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_RepClkOn_MAX (0x00000001)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_RepClkOn_DEF (0x00000000)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_IOLBCtl_OFF (10)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_IOLBCtl_WID ( 2)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_IOLBCtl_MSK (0x00000C00)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_IOLBCtl_MAX (0x00000003)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_IOLBCtl_DEF (0x00000000)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_OdtMode_OFF (12)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_OdtMode_WID ( 1)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_OdtMode_MSK (0x00001000)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_OdtMode_MAX (0x00000001)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_OdtMode_DEF (0x00000000)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_CmdTxEq_OFF (13)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_CmdTxEq_WID ( 2)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_CmdTxEq_MSK (0x00006000)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_CmdTxEq_MAX (0x00000003)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_CmdTxEq_DEF (0x00000000)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_EarlyWeakDrive_OFF (15)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_EarlyWeakDrive_WID ( 2)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_EarlyWeakDrive_MSK (0x00018000)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_EarlyWeakDrive_MAX (0x00000003)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_EarlyWeakDrive_DEF (0x00000000)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_CtlTxEq_OFF (17)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_CtlTxEq_WID ( 2)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_CtlTxEq_MSK (0x00060000)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_CtlTxEq_MAX (0x00000003)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_CtlTxEq_DEF (0x00000000)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_CtlSRDrv_OFF (19)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_CtlSRDrv_WID ( 2)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_CtlSRDrv_MSK (0x00180000)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_CtlSRDrv_MAX (0x00000003)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_CtlSRDrv_DEF (0x00000000)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_RxVref_OFF (21)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_RxVref_WID ( 6)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_RxVref_MSK (0x07E00000)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_RxVref_MAX (0x0000003F)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_RxVref_DEF (0x00000000)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_VccddqHi_OFF (27)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_VccddqHi_WID ( 1)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_VccddqHi_MSK (0x08000000)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_VccddqHi_MAX (0x00000001)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_VccddqHi_DEF (0x00000000)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_DllWeakLock_OFF (28)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_DllWeakLock_WID ( 1)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_DllWeakLock_MSK (0x10000000)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_DllWeakLock_MAX (0x00000001)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_DllWeakLock_DEF (0x00000000)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_LPDDR_Mode_OFF (29)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_LPDDR_Mode_WID ( 1)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_LPDDR_Mode_MSK (0x20000000)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_LPDDR_Mode_MAX (0x00000001)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_LPDDR_Mode_DEF (0x00000000)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_LaDrvEnOvrd_OFF (30)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_LaDrvEnOvrd_WID ( 1)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_LaDrvEnOvrd_MSK (0x40000000)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_LaDrvEnOvrd_MAX (0x00000001)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_LaDrvEnOvrd_DEF (0x00000000)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_LPDdrCAA_Dis_OFF (31)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_LPDdrCAA_Dis_WID ( 1)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_LPDdrCAA_Dis_MSK (0x80000000)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_LPDdrCAA_Dis_MAX (0x00000001)
+ #define DDRCKECH1_CR_DDRCRCTLCONTROLS_LPDdrCAA_Dis_DEF (0x00000000)
+
+#define DDRCKECH1_CR_DDRCRCTLRANKSUSED_REG (0x00001320)
+ #define DDRCKECH1_CR_DDRCRCTLRANKSUSED_RankEn_OFF ( 0)
+ #define DDRCKECH1_CR_DDRCRCTLRANKSUSED_RankEn_WID ( 4)
+ #define DDRCKECH1_CR_DDRCRCTLRANKSUSED_RankEn_MSK (0x0000000F)
+ #define DDRCKECH1_CR_DDRCRCTLRANKSUSED_RankEn_MAX (0x0000000F)
+ #define DDRCKECH1_CR_DDRCRCTLRANKSUSED_RankEn_DEF (0x0000000F)
+ #define DDRCKECH1_CR_DDRCRCTLRANKSUSED_OdtDisable_OFF ( 4)
+ #define DDRCKECH1_CR_DDRCRCTLRANKSUSED_OdtDisable_WID ( 2)
+ #define DDRCKECH1_CR_DDRCRCTLRANKSUSED_OdtDisable_MSK (0x00000030)
+ #define DDRCKECH1_CR_DDRCRCTLRANKSUSED_OdtDisable_MAX (0x00000003)
+ #define DDRCKECH1_CR_DDRCRCTLRANKSUSED_OdtDisable_DEF (0x00000000)
+ #define DDRCKECH1_CR_DDRCRCTLRANKSUSED_Spare_OFF ( 6)
+ #define DDRCKECH1_CR_DDRCRCTLRANKSUSED_Spare_WID (26)
+ #define DDRCKECH1_CR_DDRCRCTLRANKSUSED_Spare_MSK (0xFFFFFFC0)
+ #define DDRCKECH1_CR_DDRCRCTLRANKSUSED_Spare_MAX (0x03FFFFFF)
+ #define DDRCKECH1_CR_DDRCRCTLRANKSUSED_Spare_DEF (0x00000000)
+
+#define DDRCKECH1_CR_DLLPITESTANDADC_REG (0x00001324)
+ #define DDRCKECH1_CR_DLLPITESTANDADC_RunTest_OFF ( 0)
+ #define DDRCKECH1_CR_DLLPITESTANDADC_RunTest_WID ( 1)
+ #define DDRCKECH1_CR_DLLPITESTANDADC_RunTest_MSK (0x00000001)
+ #define DDRCKECH1_CR_DLLPITESTANDADC_RunTest_MAX (0x00000001)
+ #define DDRCKECH1_CR_DLLPITESTANDADC_RunTest_DEF (0x00000000)
+ #define DDRCKECH1_CR_DLLPITESTANDADC_Load_OFF ( 1)
+ #define DDRCKECH1_CR_DLLPITESTANDADC_Load_WID ( 1)
+ #define DDRCKECH1_CR_DLLPITESTANDADC_Load_MSK (0x00000002)
+ #define DDRCKECH1_CR_DLLPITESTANDADC_Load_MAX (0x00000001)
+ #define DDRCKECH1_CR_DLLPITESTANDADC_Load_DEF (0x00000000)
+ #define DDRCKECH1_CR_DLLPITESTANDADC_ModeHVM_OFF ( 2)
+ #define DDRCKECH1_CR_DLLPITESTANDADC_ModeHVM_WID ( 1)
+ #define DDRCKECH1_CR_DLLPITESTANDADC_ModeHVM_MSK (0x00000004)
+ #define DDRCKECH1_CR_DLLPITESTANDADC_ModeHVM_MAX (0x00000001)
+ #define DDRCKECH1_CR_DLLPITESTANDADC_ModeHVM_DEF (0x00000000)
+ #define DDRCKECH1_CR_DLLPITESTANDADC_ModeDV_OFF ( 3)
+ #define DDRCKECH1_CR_DLLPITESTANDADC_ModeDV_WID ( 1)
+ #define DDRCKECH1_CR_DLLPITESTANDADC_ModeDV_MSK (0x00000008)
+ #define DDRCKECH1_CR_DLLPITESTANDADC_ModeDV_MAX (0x00000001)
+ #define DDRCKECH1_CR_DLLPITESTANDADC_ModeDV_DEF (0x00000000)
+ #define DDRCKECH1_CR_DLLPITESTANDADC_ModeADC_OFF ( 4)
+ #define DDRCKECH1_CR_DLLPITESTANDADC_ModeADC_WID ( 1)
+ #define DDRCKECH1_CR_DLLPITESTANDADC_ModeADC_MSK (0x00000010)
+ #define DDRCKECH1_CR_DLLPITESTANDADC_ModeADC_MAX (0x00000001)
+ #define DDRCKECH1_CR_DLLPITESTANDADC_ModeADC_DEF (0x00000000)
+ #define DDRCKECH1_CR_DLLPITESTANDADC_LoadCount_OFF ( 5)
+ #define DDRCKECH1_CR_DLLPITESTANDADC_LoadCount_WID (10)
+ #define DDRCKECH1_CR_DLLPITESTANDADC_LoadCount_MSK (0x00007FE0)
+ #define DDRCKECH1_CR_DLLPITESTANDADC_LoadCount_MAX (0x000003FF)
+ #define DDRCKECH1_CR_DLLPITESTANDADC_CountStatus_OFF (15)
+ #define DDRCKECH1_CR_DLLPITESTANDADC_CountStatus_WID (10)
+ #define DDRCKECH1_CR_DLLPITESTANDADC_CountStatus_MSK (0x01FF8000)
+ #define DDRCKECH1_CR_DLLPITESTANDADC_CountStatus_MAX (0x000003FF)
+ #define DDRCKECH1_CR_DLLPITESTANDADC_CountStatus_DEF (0x00000000)
+ #define DDRCKECH1_CR_DLLPITESTANDADC_Spare_OFF (25)
+ #define DDRCKECH1_CR_DLLPITESTANDADC_Spare_WID ( 7)
+ #define DDRCKECH1_CR_DLLPITESTANDADC_Spare_MSK (0xFE000000)
+ #define DDRCKECH1_CR_DLLPITESTANDADC_Spare_MAX (0x0000007F)
+
+#define DDRCTLCH0_CR_DDRCRCTLCOMP_REG (0x00001C10)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMP_Scomp_OFF ( 0)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMP_Scomp_WID ( 6)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMP_Scomp_MSK (0x0000003F)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMP_Scomp_MAX (0x0000003F)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMP_Scomp_DEF (0x00000000)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMP_TcoComp_OFF ( 6)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMP_TcoComp_WID ( 6)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMP_TcoComp_MSK (0x00000FC0)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMP_TcoComp_MAX (0x0000003F)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMP_TcoComp_DEF (0x00000000)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMP_RcompDrvUp_OFF (12)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMP_RcompDrvUp_WID ( 6)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMP_RcompDrvUp_MSK (0x0003F000)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMP_RcompDrvUp_MAX (0x0000003F)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMP_RcompDrvUp_DEF (0x00000000)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMP_RcompDrvDown_OFF (18)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMP_RcompDrvDown_WID ( 6)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMP_RcompDrvDown_MSK (0x00FC0000)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMP_RcompDrvDown_MAX (0x0000003F)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMP_RcompDrvDown_DEF (0x00000000)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMP_LsComp_OFF (24)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMP_LsComp_WID ( 3)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMP_LsComp_MSK (0x07000000)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMP_LsComp_MAX (0x00000007)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMP_LsComp_DEF (0x00000000)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMP_Spare_OFF (27)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMP_Spare_WID ( 5)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMP_Spare_MSK (0xF8000000)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMP_Spare_MAX (0x0000001F)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMP_Spare_DEF (0x00000000)
+
+#define DDRCTLCH0_CR_DDRCRCTLCOMPOFFSET_REG (0x00001C14)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMPOFFSET_ScompOffset_OFF ( 0)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMPOFFSET_ScompOffset_WID ( 5)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMPOFFSET_ScompOffset_MSK (0x0000001F)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMPOFFSET_ScompOffset_MAX (0x0000001F)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMPOFFSET_ScompOffset_DEF (0x00000000)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMPOFFSET_TcoCompOffset_OFF ( 5)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMPOFFSET_TcoCompOffset_WID ( 4)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMPOFFSET_TcoCompOffset_MSK (0x000001E0)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMPOFFSET_TcoCompOffset_MAX (0x0000000F)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMPOFFSET_TcoCompOffset_DEF (0x00000000)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMPOFFSET_RcompDrvUpOffset_OFF ( 9)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMPOFFSET_RcompDrvUpOffset_WID ( 4)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMPOFFSET_RcompDrvUpOffset_MSK (0x00001E00)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMPOFFSET_RcompDrvUpOffset_MAX (0x0000000F)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMPOFFSET_RcompDrvUpOffset_DEF (0x00000000)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMPOFFSET_RcompDrvDownOffset_OFF (13)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMPOFFSET_RcompDrvDownOffset_WID ( 4)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMPOFFSET_RcompDrvDownOffset_MSK (0x0001E000)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMPOFFSET_RcompDrvDownOffset_MAX (0x0000000F)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMPOFFSET_RcompDrvDownOffset_DEF (0x00000000)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMPOFFSET_Spare_OFF (17)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMPOFFSET_Spare_WID (15)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMPOFFSET_Spare_MSK (0xFFFE0000)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMPOFFSET_Spare_MAX (0x00007FFF)
+ #define DDRCTLCH0_CR_DDRCRCTLCOMPOFFSET_Spare_DEF (0x00000000)
+
+#define DDRCTLCH0_CR_DDRCRCTLPICODING_REG (0x00001C18)
+ #define DDRCTLCH0_CR_DDRCRCTLPICODING_CtlPiCode0_OFF ( 0)
+ #define DDRCTLCH0_CR_DDRCRCTLPICODING_CtlPiCode0_WID ( 7)
+ #define DDRCTLCH0_CR_DDRCRCTLPICODING_CtlPiCode0_MSK (0x0000007F)
+ #define DDRCTLCH0_CR_DDRCRCTLPICODING_CtlPiCode0_MAX (0x0000007F)
+ #define DDRCTLCH0_CR_DDRCRCTLPICODING_CtlPiCode0_DEF (0x00000000)
+ #define DDRCTLCH0_CR_DDRCRCTLPICODING_CtlPiCode1_OFF ( 7)
+ #define DDRCTLCH0_CR_DDRCRCTLPICODING_CtlPiCode1_WID ( 7)
+ #define DDRCTLCH0_CR_DDRCRCTLPICODING_CtlPiCode1_MSK (0x00003F80)
+ #define DDRCTLCH0_CR_DDRCRCTLPICODING_CtlPiCode1_MAX (0x0000007F)
+ #define DDRCTLCH0_CR_DDRCRCTLPICODING_CtlPiCode1_DEF (0x00000000)
+ #define DDRCTLCH0_CR_DDRCRCTLPICODING_CtlPiCode2_OFF (14)
+ #define DDRCTLCH0_CR_DDRCRCTLPICODING_CtlPiCode2_WID ( 7)
+ #define DDRCTLCH0_CR_DDRCRCTLPICODING_CtlPiCode2_MSK (0x001FC000)
+ #define DDRCTLCH0_CR_DDRCRCTLPICODING_CtlPiCode2_MAX (0x0000007F)
+ #define DDRCTLCH0_CR_DDRCRCTLPICODING_CtlPiCode2_DEF (0x00000000)
+ #define DDRCTLCH0_CR_DDRCRCTLPICODING_CtlPiCode3_OFF (21)
+ #define DDRCTLCH0_CR_DDRCRCTLPICODING_CtlPiCode3_WID ( 7)
+ #define DDRCTLCH0_CR_DDRCRCTLPICODING_CtlPiCode3_MSK (0x0FE00000)
+ #define DDRCTLCH0_CR_DDRCRCTLPICODING_CtlPiCode3_MAX (0x0000007F)
+ #define DDRCTLCH0_CR_DDRCRCTLPICODING_CtlPiCode3_DEF (0x00000000)
+ #define DDRCTLCH0_CR_DDRCRCTLPICODING_CtlXoverEnable_OFF (28)
+ #define DDRCTLCH0_CR_DDRCRCTLPICODING_CtlXoverEnable_WID ( 1)
+ #define DDRCTLCH0_CR_DDRCRCTLPICODING_CtlXoverEnable_MSK (0x10000000)
+ #define DDRCTLCH0_CR_DDRCRCTLPICODING_CtlXoverEnable_MAX (0x00000001)
+ #define DDRCTLCH0_CR_DDRCRCTLPICODING_CtlXoverEnable_DEF (0x00000000)
+ #define DDRCTLCH0_CR_DDRCRCTLPICODING_Spare_OFF (29)
+ #define DDRCTLCH0_CR_DDRCRCTLPICODING_Spare_WID ( 3)
+ #define DDRCTLCH0_CR_DDRCRCTLPICODING_Spare_MSK (0xE0000000)
+ #define DDRCTLCH0_CR_DDRCRCTLPICODING_Spare_MAX (0x00000007)
+ #define DDRCTLCH0_CR_DDRCRCTLPICODING_Spare_DEF (0x00000000)
+
+#define DDRCTLCH0_CR_DDRCRCTLCONTROLS_REG (0x00001C1C)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_RefPi_OFF ( 0)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_RefPi_WID ( 4)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_RefPi_MSK (0x0000000F)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_RefPi_MAX (0x0000000F)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_RefPi_DEF (0x00000000)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_DllMask_OFF ( 4)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_DllMask_WID ( 2)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_DllMask_MSK (0x00000030)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_DllMask_MAX (0x00000003)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_DllMask_DEF (0x00000000)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_DllRsvd1_OFF ( 6)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_DllRsvd1_WID ( 1)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_DllRsvd1_MSK (0x00000040)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_DllRsvd1_MAX (0x00000001)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_DllRsvd1_DEF (0x00000000)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_TxOn_OFF ( 7)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_TxOn_WID ( 1)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_TxOn_MSK (0x00000080)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_TxOn_MAX (0x00000001)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_TxOn_DEF (0x00000000)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_IntClkOn_OFF ( 8)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_IntClkOn_WID ( 1)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_IntClkOn_MSK (0x00000100)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_IntClkOn_MAX (0x00000001)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_IntClkOn_DEF (0x00000000)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_RepClkOn_OFF ( 9)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_RepClkOn_WID ( 1)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_RepClkOn_MSK (0x00000200)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_RepClkOn_MAX (0x00000001)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_RepClkOn_DEF (0x00000000)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_IOLBCtl_OFF (10)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_IOLBCtl_WID ( 2)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_IOLBCtl_MSK (0x00000C00)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_IOLBCtl_MAX (0x00000003)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_IOLBCtl_DEF (0x00000000)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_OdtMode_OFF (12)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_OdtMode_WID ( 1)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_OdtMode_MSK (0x00001000)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_OdtMode_MAX (0x00000001)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_OdtMode_DEF (0x00000000)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_CmdTxEq_OFF (13)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_CmdTxEq_WID ( 2)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_CmdTxEq_MSK (0x00006000)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_CmdTxEq_MAX (0x00000003)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_CmdTxEq_DEF (0x00000000)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_EarlyWeakDrive_OFF (15)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_EarlyWeakDrive_WID ( 2)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_EarlyWeakDrive_MSK (0x00018000)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_EarlyWeakDrive_MAX (0x00000003)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_EarlyWeakDrive_DEF (0x00000000)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_CtlTxEq_OFF (17)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_CtlTxEq_WID ( 2)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_CtlTxEq_MSK (0x00060000)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_CtlTxEq_MAX (0x00000003)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_CtlTxEq_DEF (0x00000000)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_CtlSRDrv_OFF (19)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_CtlSRDrv_WID ( 2)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_CtlSRDrv_MSK (0x00180000)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_CtlSRDrv_MAX (0x00000003)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_CtlSRDrv_DEF (0x00000000)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_RxVref_OFF (21)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_RxVref_WID ( 6)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_RxVref_MSK (0x07E00000)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_RxVref_MAX (0x0000003F)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_RxVref_DEF (0x00000000)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_VccddqHi_OFF (27)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_VccddqHi_WID ( 1)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_VccddqHi_MSK (0x08000000)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_VccddqHi_MAX (0x00000001)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_VccddqHi_DEF (0x00000000)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_DllWeakLock_OFF (28)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_DllWeakLock_WID ( 1)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_DllWeakLock_MSK (0x10000000)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_DllWeakLock_MAX (0x00000001)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_DllWeakLock_DEF (0x00000000)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_LPDDR_Mode_OFF (29)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_LPDDR_Mode_WID ( 1)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_LPDDR_Mode_MSK (0x20000000)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_LPDDR_Mode_MAX (0x00000001)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_LPDDR_Mode_DEF (0x00000000)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_LaDrvEnOvrd_OFF (30)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_LaDrvEnOvrd_WID ( 1)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_LaDrvEnOvrd_MSK (0x40000000)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_LaDrvEnOvrd_MAX (0x00000001)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_LaDrvEnOvrd_DEF (0x00000000)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_LPDdrCAA_Dis_OFF (31)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_LPDdrCAA_Dis_WID ( 1)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_LPDdrCAA_Dis_MSK (0x80000000)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_LPDdrCAA_Dis_MAX (0x00000001)
+ #define DDRCTLCH0_CR_DDRCRCTLCONTROLS_LPDdrCAA_Dis_DEF (0x00000000)
+
+#define DDRCTLCH0_CR_DDRCRCTLRANKSUSED_REG (0x00001C20)
+ #define DDRCTLCH0_CR_DDRCRCTLRANKSUSED_RankEn_OFF ( 0)
+ #define DDRCTLCH0_CR_DDRCRCTLRANKSUSED_RankEn_WID ( 4)
+ #define DDRCTLCH0_CR_DDRCRCTLRANKSUSED_RankEn_MSK (0x0000000F)
+ #define DDRCTLCH0_CR_DDRCRCTLRANKSUSED_RankEn_MAX (0x0000000F)
+ #define DDRCTLCH0_CR_DDRCRCTLRANKSUSED_RankEn_DEF (0x0000000F)
+ #define DDRCTLCH0_CR_DDRCRCTLRANKSUSED_OdtDisable_OFF ( 4)
+ #define DDRCTLCH0_CR_DDRCRCTLRANKSUSED_OdtDisable_WID ( 2)
+ #define DDRCTLCH0_CR_DDRCRCTLRANKSUSED_OdtDisable_MSK (0x00000030)
+ #define DDRCTLCH0_CR_DDRCRCTLRANKSUSED_OdtDisable_MAX (0x00000003)
+ #define DDRCTLCH0_CR_DDRCRCTLRANKSUSED_OdtDisable_DEF (0x00000000)
+ #define DDRCTLCH0_CR_DDRCRCTLRANKSUSED_Spare_OFF ( 6)
+ #define DDRCTLCH0_CR_DDRCRCTLRANKSUSED_Spare_WID (26)
+ #define DDRCTLCH0_CR_DDRCRCTLRANKSUSED_Spare_MSK (0xFFFFFFC0)
+ #define DDRCTLCH0_CR_DDRCRCTLRANKSUSED_Spare_MAX (0x03FFFFFF)
+ #define DDRCTLCH0_CR_DDRCRCTLRANKSUSED_Spare_DEF (0x00000000)
+
+#define DDRCTLCH0_CR_DLLPITESTANDADC_REG (0x00001C24)
+ #define DDRCTLCH0_CR_DLLPITESTANDADC_RunTest_OFF ( 0)
+ #define DDRCTLCH0_CR_DLLPITESTANDADC_RunTest_WID ( 1)
+ #define DDRCTLCH0_CR_DLLPITESTANDADC_RunTest_MSK (0x00000001)
+ #define DDRCTLCH0_CR_DLLPITESTANDADC_RunTest_MAX (0x00000001)
+ #define DDRCTLCH0_CR_DLLPITESTANDADC_RunTest_DEF (0x00000000)
+ #define DDRCTLCH0_CR_DLLPITESTANDADC_Load_OFF ( 1)
+ #define DDRCTLCH0_CR_DLLPITESTANDADC_Load_WID ( 1)
+ #define DDRCTLCH0_CR_DLLPITESTANDADC_Load_MSK (0x00000002)
+ #define DDRCTLCH0_CR_DLLPITESTANDADC_Load_MAX (0x00000001)
+ #define DDRCTLCH0_CR_DLLPITESTANDADC_Load_DEF (0x00000000)
+ #define DDRCTLCH0_CR_DLLPITESTANDADC_ModeHVM_OFF ( 2)
+ #define DDRCTLCH0_CR_DLLPITESTANDADC_ModeHVM_WID ( 1)
+ #define DDRCTLCH0_CR_DLLPITESTANDADC_ModeHVM_MSK (0x00000004)
+ #define DDRCTLCH0_CR_DLLPITESTANDADC_ModeHVM_MAX (0x00000001)
+ #define DDRCTLCH0_CR_DLLPITESTANDADC_ModeHVM_DEF (0x00000000)
+ #define DDRCTLCH0_CR_DLLPITESTANDADC_ModeDV_OFF ( 3)
+ #define DDRCTLCH0_CR_DLLPITESTANDADC_ModeDV_WID ( 1)
+ #define DDRCTLCH0_CR_DLLPITESTANDADC_ModeDV_MSK (0x00000008)
+ #define DDRCTLCH0_CR_DLLPITESTANDADC_ModeDV_MAX (0x00000001)
+ #define DDRCTLCH0_CR_DLLPITESTANDADC_ModeDV_DEF (0x00000000)
+ #define DDRCTLCH0_CR_DLLPITESTANDADC_ModeADC_OFF ( 4)
+ #define DDRCTLCH0_CR_DLLPITESTANDADC_ModeADC_WID ( 1)
+ #define DDRCTLCH0_CR_DLLPITESTANDADC_ModeADC_MSK (0x00000010)
+ #define DDRCTLCH0_CR_DLLPITESTANDADC_ModeADC_MAX (0x00000001)
+ #define DDRCTLCH0_CR_DLLPITESTANDADC_ModeADC_DEF (0x00000000)
+ #define DDRCTLCH0_CR_DLLPITESTANDADC_LoadCount_OFF ( 5)
+ #define DDRCTLCH0_CR_DLLPITESTANDADC_LoadCount_WID (10)
+ #define DDRCTLCH0_CR_DLLPITESTANDADC_LoadCount_MSK (0x00007FE0)
+ #define DDRCTLCH0_CR_DLLPITESTANDADC_LoadCount_MAX (0x000003FF)
+ #define DDRCTLCH0_CR_DLLPITESTANDADC_CountStatus_OFF (15)
+ #define DDRCTLCH0_CR_DLLPITESTANDADC_CountStatus_WID (10)
+ #define DDRCTLCH0_CR_DLLPITESTANDADC_CountStatus_MSK (0x01FF8000)
+ #define DDRCTLCH0_CR_DLLPITESTANDADC_CountStatus_MAX (0x000003FF)
+ #define DDRCTLCH0_CR_DLLPITESTANDADC_CountStatus_DEF (0x00000000)
+ #define DDRCTLCH0_CR_DLLPITESTANDADC_Spare_OFF (25)
+ #define DDRCTLCH0_CR_DLLPITESTANDADC_Spare_WID ( 7)
+ #define DDRCTLCH0_CR_DLLPITESTANDADC_Spare_MSK (0xFE000000)
+ #define DDRCTLCH0_CR_DLLPITESTANDADC_Spare_MAX (0x0000007F)
+
+#define DDRCTLCH1_CR_DDRCRCTLCOMP_REG (0x00001D10)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMP_Scomp_OFF ( 0)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMP_Scomp_WID ( 6)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMP_Scomp_MSK (0x0000003F)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMP_Scomp_MAX (0x0000003F)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMP_Scomp_DEF (0x00000000)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMP_TcoComp_OFF ( 6)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMP_TcoComp_WID ( 6)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMP_TcoComp_MSK (0x00000FC0)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMP_TcoComp_MAX (0x0000003F)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMP_TcoComp_DEF (0x00000000)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMP_RcompDrvUp_OFF (12)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMP_RcompDrvUp_WID ( 6)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMP_RcompDrvUp_MSK (0x0003F000)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMP_RcompDrvUp_MAX (0x0000003F)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMP_RcompDrvUp_DEF (0x00000000)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMP_RcompDrvDown_OFF (18)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMP_RcompDrvDown_WID ( 6)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMP_RcompDrvDown_MSK (0x00FC0000)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMP_RcompDrvDown_MAX (0x0000003F)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMP_RcompDrvDown_DEF (0x00000000)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMP_LsComp_OFF (24)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMP_LsComp_WID ( 3)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMP_LsComp_MSK (0x07000000)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMP_LsComp_MAX (0x00000007)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMP_LsComp_DEF (0x00000000)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMP_Spare_OFF (27)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMP_Spare_WID ( 5)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMP_Spare_MSK (0xF8000000)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMP_Spare_MAX (0x0000001F)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMP_Spare_DEF (0x00000000)
+
+#define DDRCTLCH1_CR_DDRCRCTLCOMPOFFSET_REG (0x00001D14)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMPOFFSET_ScompOffset_OFF ( 0)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMPOFFSET_ScompOffset_WID ( 5)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMPOFFSET_ScompOffset_MSK (0x0000001F)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMPOFFSET_ScompOffset_MAX (0x0000001F)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMPOFFSET_ScompOffset_DEF (0x00000000)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMPOFFSET_TcoCompOffset_OFF ( 5)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMPOFFSET_TcoCompOffset_WID ( 4)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMPOFFSET_TcoCompOffset_MSK (0x000001E0)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMPOFFSET_TcoCompOffset_MAX (0x0000000F)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMPOFFSET_TcoCompOffset_DEF (0x00000000)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMPOFFSET_RcompDrvUpOffset_OFF ( 9)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMPOFFSET_RcompDrvUpOffset_WID ( 4)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMPOFFSET_RcompDrvUpOffset_MSK (0x00001E00)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMPOFFSET_RcompDrvUpOffset_MAX (0x0000000F)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMPOFFSET_RcompDrvUpOffset_DEF (0x00000000)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMPOFFSET_RcompDrvDownOffset_OFF (13)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMPOFFSET_RcompDrvDownOffset_WID ( 4)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMPOFFSET_RcompDrvDownOffset_MSK (0x0001E000)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMPOFFSET_RcompDrvDownOffset_MAX (0x0000000F)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMPOFFSET_RcompDrvDownOffset_DEF (0x00000000)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMPOFFSET_Spare_OFF (17)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMPOFFSET_Spare_WID (15)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMPOFFSET_Spare_MSK (0xFFFE0000)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMPOFFSET_Spare_MAX (0x00007FFF)
+ #define DDRCTLCH1_CR_DDRCRCTLCOMPOFFSET_Spare_DEF (0x00000000)
+
+#define DDRCTLCH1_CR_DDRCRCTLPICODING_REG (0x00001D18)
+ #define DDRCTLCH1_CR_DDRCRCTLPICODING_CtlPiCode0_OFF ( 0)
+ #define DDRCTLCH1_CR_DDRCRCTLPICODING_CtlPiCode0_WID ( 7)
+ #define DDRCTLCH1_CR_DDRCRCTLPICODING_CtlPiCode0_MSK (0x0000007F)
+ #define DDRCTLCH1_CR_DDRCRCTLPICODING_CtlPiCode0_MAX (0x0000007F)
+ #define DDRCTLCH1_CR_DDRCRCTLPICODING_CtlPiCode0_DEF (0x00000000)
+ #define DDRCTLCH1_CR_DDRCRCTLPICODING_CtlPiCode1_OFF ( 7)
+ #define DDRCTLCH1_CR_DDRCRCTLPICODING_CtlPiCode1_WID ( 7)
+ #define DDRCTLCH1_CR_DDRCRCTLPICODING_CtlPiCode1_MSK (0x00003F80)
+ #define DDRCTLCH1_CR_DDRCRCTLPICODING_CtlPiCode1_MAX (0x0000007F)
+ #define DDRCTLCH1_CR_DDRCRCTLPICODING_CtlPiCode1_DEF (0x00000000)
+ #define DDRCTLCH1_CR_DDRCRCTLPICODING_CtlPiCode2_OFF (14)
+ #define DDRCTLCH1_CR_DDRCRCTLPICODING_CtlPiCode2_WID ( 7)
+ #define DDRCTLCH1_CR_DDRCRCTLPICODING_CtlPiCode2_MSK (0x001FC000)
+ #define DDRCTLCH1_CR_DDRCRCTLPICODING_CtlPiCode2_MAX (0x0000007F)
+ #define DDRCTLCH1_CR_DDRCRCTLPICODING_CtlPiCode2_DEF (0x00000000)
+ #define DDRCTLCH1_CR_DDRCRCTLPICODING_CtlPiCode3_OFF (21)
+ #define DDRCTLCH1_CR_DDRCRCTLPICODING_CtlPiCode3_WID ( 7)
+ #define DDRCTLCH1_CR_DDRCRCTLPICODING_CtlPiCode3_MSK (0x0FE00000)
+ #define DDRCTLCH1_CR_DDRCRCTLPICODING_CtlPiCode3_MAX (0x0000007F)
+ #define DDRCTLCH1_CR_DDRCRCTLPICODING_CtlPiCode3_DEF (0x00000000)
+ #define DDRCTLCH1_CR_DDRCRCTLPICODING_CtlXoverEnable_OFF (28)
+ #define DDRCTLCH1_CR_DDRCRCTLPICODING_CtlXoverEnable_WID ( 1)
+ #define DDRCTLCH1_CR_DDRCRCTLPICODING_CtlXoverEnable_MSK (0x10000000)
+ #define DDRCTLCH1_CR_DDRCRCTLPICODING_CtlXoverEnable_MAX (0x00000001)
+ #define DDRCTLCH1_CR_DDRCRCTLPICODING_CtlXoverEnable_DEF (0x00000000)
+ #define DDRCTLCH1_CR_DDRCRCTLPICODING_Spare_OFF (29)
+ #define DDRCTLCH1_CR_DDRCRCTLPICODING_Spare_WID ( 3)
+ #define DDRCTLCH1_CR_DDRCRCTLPICODING_Spare_MSK (0xE0000000)
+ #define DDRCTLCH1_CR_DDRCRCTLPICODING_Spare_MAX (0x00000007)
+ #define DDRCTLCH1_CR_DDRCRCTLPICODING_Spare_DEF (0x00000000)
+
+#define DDRCTLCH1_CR_DDRCRCTLCONTROLS_REG (0x00001D1C)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_RefPi_OFF ( 0)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_RefPi_WID ( 4)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_RefPi_MSK (0x0000000F)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_RefPi_MAX (0x0000000F)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_RefPi_DEF (0x00000000)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_DllMask_OFF ( 4)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_DllMask_WID ( 2)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_DllMask_MSK (0x00000030)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_DllMask_MAX (0x00000003)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_DllMask_DEF (0x00000000)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_DllRsvd1_OFF ( 6)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_DllRsvd1_WID ( 1)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_DllRsvd1_MSK (0x00000040)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_DllRsvd1_MAX (0x00000001)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_DllRsvd1_DEF (0x00000000)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_TxOn_OFF ( 7)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_TxOn_WID ( 1)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_TxOn_MSK (0x00000080)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_TxOn_MAX (0x00000001)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_TxOn_DEF (0x00000000)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_IntClkOn_OFF ( 8)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_IntClkOn_WID ( 1)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_IntClkOn_MSK (0x00000100)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_IntClkOn_MAX (0x00000001)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_IntClkOn_DEF (0x00000000)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_RepClkOn_OFF ( 9)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_RepClkOn_WID ( 1)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_RepClkOn_MSK (0x00000200)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_RepClkOn_MAX (0x00000001)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_RepClkOn_DEF (0x00000000)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_IOLBCtl_OFF (10)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_IOLBCtl_WID ( 2)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_IOLBCtl_MSK (0x00000C00)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_IOLBCtl_MAX (0x00000003)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_IOLBCtl_DEF (0x00000000)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_OdtMode_OFF (12)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_OdtMode_WID ( 1)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_OdtMode_MSK (0x00001000)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_OdtMode_MAX (0x00000001)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_OdtMode_DEF (0x00000000)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_CmdTxEq_OFF (13)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_CmdTxEq_WID ( 2)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_CmdTxEq_MSK (0x00006000)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_CmdTxEq_MAX (0x00000003)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_CmdTxEq_DEF (0x00000000)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_EarlyWeakDrive_OFF (15)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_EarlyWeakDrive_WID ( 2)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_EarlyWeakDrive_MSK (0x00018000)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_EarlyWeakDrive_MAX (0x00000003)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_EarlyWeakDrive_DEF (0x00000000)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_CtlTxEq_OFF (17)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_CtlTxEq_WID ( 2)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_CtlTxEq_MSK (0x00060000)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_CtlTxEq_MAX (0x00000003)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_CtlTxEq_DEF (0x00000000)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_CtlSRDrv_OFF (19)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_CtlSRDrv_WID ( 2)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_CtlSRDrv_MSK (0x00180000)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_CtlSRDrv_MAX (0x00000003)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_CtlSRDrv_DEF (0x00000000)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_RxVref_OFF (21)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_RxVref_WID ( 6)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_RxVref_MSK (0x07E00000)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_RxVref_MAX (0x0000003F)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_RxVref_DEF (0x00000000)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_VccddqHi_OFF (27)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_VccddqHi_WID ( 1)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_VccddqHi_MSK (0x08000000)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_VccddqHi_MAX (0x00000001)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_VccddqHi_DEF (0x00000000)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_DllWeakLock_OFF (28)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_DllWeakLock_WID ( 1)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_DllWeakLock_MSK (0x10000000)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_DllWeakLock_MAX (0x00000001)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_DllWeakLock_DEF (0x00000000)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_LPDDR_Mode_OFF (29)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_LPDDR_Mode_WID ( 1)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_LPDDR_Mode_MSK (0x20000000)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_LPDDR_Mode_MAX (0x00000001)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_LPDDR_Mode_DEF (0x00000000)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_LaDrvEnOvrd_OFF (30)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_LaDrvEnOvrd_WID ( 1)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_LaDrvEnOvrd_MSK (0x40000000)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_LaDrvEnOvrd_MAX (0x00000001)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_LaDrvEnOvrd_DEF (0x00000000)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_LPDdrCAA_Dis_OFF (31)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_LPDdrCAA_Dis_WID ( 1)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_LPDdrCAA_Dis_MSK (0x80000000)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_LPDdrCAA_Dis_MAX (0x00000001)
+ #define DDRCTLCH1_CR_DDRCRCTLCONTROLS_LPDdrCAA_Dis_DEF (0x00000000)
+
+#define DDRCTLCH1_CR_DDRCRCTLRANKSUSED_REG (0x00001D20)
+ #define DDRCTLCH1_CR_DDRCRCTLRANKSUSED_RankEn_OFF ( 0)
+ #define DDRCTLCH1_CR_DDRCRCTLRANKSUSED_RankEn_WID ( 4)
+ #define DDRCTLCH1_CR_DDRCRCTLRANKSUSED_RankEn_MSK (0x0000000F)
+ #define DDRCTLCH1_CR_DDRCRCTLRANKSUSED_RankEn_MAX (0x0000000F)
+ #define DDRCTLCH1_CR_DDRCRCTLRANKSUSED_RankEn_DEF (0x0000000F)
+ #define DDRCTLCH1_CR_DDRCRCTLRANKSUSED_OdtDisable_OFF ( 4)
+ #define DDRCTLCH1_CR_DDRCRCTLRANKSUSED_OdtDisable_WID ( 2)
+ #define DDRCTLCH1_CR_DDRCRCTLRANKSUSED_OdtDisable_MSK (0x00000030)
+ #define DDRCTLCH1_CR_DDRCRCTLRANKSUSED_OdtDisable_MAX (0x00000003)
+ #define DDRCTLCH1_CR_DDRCRCTLRANKSUSED_OdtDisable_DEF (0x00000000)
+ #define DDRCTLCH1_CR_DDRCRCTLRANKSUSED_Spare_OFF ( 6)
+ #define DDRCTLCH1_CR_DDRCRCTLRANKSUSED_Spare_WID (26)
+ #define DDRCTLCH1_CR_DDRCRCTLRANKSUSED_Spare_MSK (0xFFFFFFC0)
+ #define DDRCTLCH1_CR_DDRCRCTLRANKSUSED_Spare_MAX (0x03FFFFFF)
+ #define DDRCTLCH1_CR_DDRCRCTLRANKSUSED_Spare_DEF (0x00000000)
+
+#define DDRCTLCH1_CR_DLLPITESTANDADC_REG (0x00001D24)
+ #define DDRCTLCH1_CR_DLLPITESTANDADC_RunTest_OFF ( 0)
+ #define DDRCTLCH1_CR_DLLPITESTANDADC_RunTest_WID ( 1)
+ #define DDRCTLCH1_CR_DLLPITESTANDADC_RunTest_MSK (0x00000001)
+ #define DDRCTLCH1_CR_DLLPITESTANDADC_RunTest_MAX (0x00000001)
+ #define DDRCTLCH1_CR_DLLPITESTANDADC_RunTest_DEF (0x00000000)
+ #define DDRCTLCH1_CR_DLLPITESTANDADC_Load_OFF ( 1)
+ #define DDRCTLCH1_CR_DLLPITESTANDADC_Load_WID ( 1)
+ #define DDRCTLCH1_CR_DLLPITESTANDADC_Load_MSK (0x00000002)
+ #define DDRCTLCH1_CR_DLLPITESTANDADC_Load_MAX (0x00000001)
+ #define DDRCTLCH1_CR_DLLPITESTANDADC_Load_DEF (0x00000000)
+ #define DDRCTLCH1_CR_DLLPITESTANDADC_ModeHVM_OFF ( 2)
+ #define DDRCTLCH1_CR_DLLPITESTANDADC_ModeHVM_WID ( 1)
+ #define DDRCTLCH1_CR_DLLPITESTANDADC_ModeHVM_MSK (0x00000004)
+ #define DDRCTLCH1_CR_DLLPITESTANDADC_ModeHVM_MAX (0x00000001)
+ #define DDRCTLCH1_CR_DLLPITESTANDADC_ModeHVM_DEF (0x00000000)
+ #define DDRCTLCH1_CR_DLLPITESTANDADC_ModeDV_OFF ( 3)
+ #define DDRCTLCH1_CR_DLLPITESTANDADC_ModeDV_WID ( 1)
+ #define DDRCTLCH1_CR_DLLPITESTANDADC_ModeDV_MSK (0x00000008)
+ #define DDRCTLCH1_CR_DLLPITESTANDADC_ModeDV_MAX (0x00000001)
+ #define DDRCTLCH1_CR_DLLPITESTANDADC_ModeDV_DEF (0x00000000)
+ #define DDRCTLCH1_CR_DLLPITESTANDADC_ModeADC_OFF ( 4)
+ #define DDRCTLCH1_CR_DLLPITESTANDADC_ModeADC_WID ( 1)
+ #define DDRCTLCH1_CR_DLLPITESTANDADC_ModeADC_MSK (0x00000010)
+ #define DDRCTLCH1_CR_DLLPITESTANDADC_ModeADC_MAX (0x00000001)
+ #define DDRCTLCH1_CR_DLLPITESTANDADC_ModeADC_DEF (0x00000000)
+ #define DDRCTLCH1_CR_DLLPITESTANDADC_LoadCount_OFF ( 5)
+ #define DDRCTLCH1_CR_DLLPITESTANDADC_LoadCount_WID (10)
+ #define DDRCTLCH1_CR_DLLPITESTANDADC_LoadCount_MSK (0x00007FE0)
+ #define DDRCTLCH1_CR_DLLPITESTANDADC_LoadCount_MAX (0x000003FF)
+ #define DDRCTLCH1_CR_DLLPITESTANDADC_CountStatus_OFF (15)
+ #define DDRCTLCH1_CR_DLLPITESTANDADC_CountStatus_WID (10)
+ #define DDRCTLCH1_CR_DLLPITESTANDADC_CountStatus_MSK (0x01FF8000)
+ #define DDRCTLCH1_CR_DLLPITESTANDADC_CountStatus_MAX (0x000003FF)
+ #define DDRCTLCH1_CR_DLLPITESTANDADC_CountStatus_DEF (0x00000000)
+ #define DDRCTLCH1_CR_DLLPITESTANDADC_Spare_OFF (25)
+ #define DDRCTLCH1_CR_DLLPITESTANDADC_Spare_WID ( 7)
+ #define DDRCTLCH1_CR_DLLPITESTANDADC_Spare_MSK (0xFE000000)
+ #define DDRCTLCH1_CR_DLLPITESTANDADC_Spare_MAX (0x0000007F)
+
+#pragma pack(pop)
+#endif // __McIoCkeCtl_h__
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/McIoClk.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/McIoClk.h
new file mode 100644
index 0000000..a190ed0
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/McIoClk.h
@@ -0,0 +1,988 @@
+/** @file
+ This file was automatically generated. Modify at your own risk.
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef __McIoClk_h__
+#define __McIoClk_h__
+
+#pragma pack(push, 1)
+#include "MrcTypes.h"
+
+typedef union {
+ struct {
+ U32 RankEn : 4; // Bits 3:0
+ U32 Spare : 28; // Bits 31:4
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCLK_CR_DDRCRCLKRANKSUSED_STRUCT;
+
+typedef union {
+ struct {
+ U32 Scomp : 5; // Bits 4:0
+ U32 TcoComp : 6; // Bits 10:5
+ U32 RcompDrvUp : 6; // Bits 16:11
+ U32 RcompDrvDown : 6; // Bits 22:17
+ U32 LsComp : 3; // Bits 25:23
+ U32 Spare : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCLK_CR_DDRCRCLKCOMP_STRUCT;
+
+typedef union {
+ struct {
+ U32 ScompOffset : 4; // Bits 3:0
+ U32 TcoCompOffset : 4; // Bits 7:4
+ U32 RcompDrvUpOffset : 4; // Bits 11:8
+ U32 RcompDrvDownOffset : 4; // Bits 15:12
+ U32 Spare : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCLK_CR_DDRCRCLKCOMPOFFSET_STRUCT;
+
+typedef union {
+ struct {
+ U32 PiSettingRank0 : 7; // Bits 6:0
+ U32 PiSettingRank1 : 7; // Bits 13:7
+ U32 PiSettingRank2 : 7; // Bits 20:14
+ U32 PiSettingRank3 : 7; // Bits 27:21
+ U32 Spare : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCLK_CR_DDRCRCLKPICODE_STRUCT;
+
+typedef union {
+ struct {
+ U32 RefPi : 4; // Bits 3:0
+ U32 DllMask : 2; // Bits 5:4
+ U32 DllRsvd1 : 1; // Bits 6:6
+ U32 TxOn : 1; // Bits 7:7
+ U32 IntClkOn : 1; // Bits 8:8
+ U32 RepClkOn : 1; // Bits 9:9
+ U32 IOLBCtl : 2; // Bits 11:10
+ U32 OdtMode : 1; // Bits 12:12
+ U32 Reserved : 8; // Bits 20:13
+ U32 RxVref : 6; // Bits 26:21
+ U32 VccddqHi : 1; // Bits 27:27
+ U32 DllWeakLock : 1; // Bits 28:28
+ U32 LPDDR_Mode : 1; // Bits 29:29
+ U32 Spare : 2; // Bits 31:30
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCLK_CR_DDRCRCLKCONTROLS_STRUCT;
+
+typedef union {
+ struct {
+ U32 RunTest : 1; // Bits 0:0
+ U32 Load : 1; // Bits 1:1
+ U32 ModeHVM : 1; // Bits 2:2
+ U32 ModeDV : 1; // Bits 3:3
+ U32 ModeADC : 1; // Bits 4:4
+ U32 LoadCount : 10; // Bits 14:5
+ U32 CountStatus : 10; // Bits 24:15
+ U32 Spare : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCLK_CR_DLLPITESTANDADC_STRUCT;
+
+typedef union {
+ struct {
+ U32 DllCB : 2; // Bits 1:0
+ U32 Spare : 30; // Bits 31:2
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCLK_CR_DDRCBSTATUS_STRUCT;
+
+typedef union {
+ struct {
+ U32 RankEn : 4; // Bits 3:0
+ U32 Spare : 28; // Bits 31:4
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCLKCH0_CR_DDRCRCLKRANKSUSED_STRUCT;
+
+typedef union {
+ struct {
+ U32 Scomp : 5; // Bits 4:0
+ U32 TcoComp : 6; // Bits 10:5
+ U32 RcompDrvUp : 6; // Bits 16:11
+ U32 RcompDrvDown : 6; // Bits 22:17
+ U32 LsComp : 3; // Bits 25:23
+ U32 Spare : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCLKCH0_CR_DDRCRCLKCOMP_STRUCT;
+
+typedef union {
+ struct {
+ U32 ScompOffset : 4; // Bits 3:0
+ U32 TcoCompOffset : 4; // Bits 7:4
+ U32 RcompDrvUpOffset : 4; // Bits 11:8
+ U32 RcompDrvDownOffset : 4; // Bits 15:12
+ U32 Spare : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCLKCH0_CR_DDRCRCLKCOMPOFFSET_STRUCT;
+
+typedef union {
+ struct {
+ U32 PiSettingRank0 : 7; // Bits 6:0
+ U32 PiSettingRank1 : 7; // Bits 13:7
+ U32 PiSettingRank2 : 7; // Bits 20:14
+ U32 PiSettingRank3 : 7; // Bits 27:21
+ U32 Spare : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCLKCH0_CR_DDRCRCLKPICODE_STRUCT;
+
+typedef union {
+ struct {
+ U32 RefPi : 4; // Bits 3:0
+ U32 DllMask : 2; // Bits 5:4
+ U32 DllRsvd1 : 1; // Bits 6:6
+ U32 TxOn : 1; // Bits 7:7
+ U32 IntClkOn : 1; // Bits 8:8
+ U32 RepClkOn : 1; // Bits 9:9
+ U32 IOLBCtl : 2; // Bits 11:10
+ U32 OdtMode : 1; // Bits 12:12
+ U32 Reserved : 8; // Bits 20:13
+ U32 RxVref : 6; // Bits 26:21
+ U32 VccddqHi : 1; // Bits 27:27
+ U32 DllWeakLock : 1; // Bits 28:28
+ U32 LPDDR_Mode : 1; // Bits 29:29
+ U32 Spare : 2; // Bits 31:30
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCLKCH0_CR_DDRCRCLKCONTROLS_STRUCT;
+
+typedef union {
+ struct {
+ U32 RunTest : 1; // Bits 0:0
+ U32 Load : 1; // Bits 1:1
+ U32 ModeHVM : 1; // Bits 2:2
+ U32 ModeDV : 1; // Bits 3:3
+ U32 ModeADC : 1; // Bits 4:4
+ U32 LoadCount : 10; // Bits 14:5
+ U32 CountStatus : 10; // Bits 24:15
+ U32 Spare : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCLKCH0_CR_DLLPITESTANDADC_STRUCT;
+
+typedef union {
+ struct {
+ U32 DllCB : 2; // Bits 1:0
+ U32 Spare : 30; // Bits 31:2
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCLKCH0_CR_DDRCBSTATUS_STRUCT;
+
+typedef union {
+ struct {
+ U32 RankEn : 4; // Bits 3:0
+ U32 Spare : 28; // Bits 31:4
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCLKCH1_CR_DDRCRCLKRANKSUSED_STRUCT;
+
+typedef union {
+ struct {
+ U32 Scomp : 5; // Bits 4:0
+ U32 TcoComp : 6; // Bits 10:5
+ U32 RcompDrvUp : 6; // Bits 16:11
+ U32 RcompDrvDown : 6; // Bits 22:17
+ U32 LsComp : 3; // Bits 25:23
+ U32 Spare : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCLKCH1_CR_DDRCRCLKCOMP_STRUCT;
+
+typedef union {
+ struct {
+ U32 ScompOffset : 4; // Bits 3:0
+ U32 TcoCompOffset : 4; // Bits 7:4
+ U32 RcompDrvUpOffset : 4; // Bits 11:8
+ U32 RcompDrvDownOffset : 4; // Bits 15:12
+ U32 Spare : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCLKCH1_CR_DDRCRCLKCOMPOFFSET_STRUCT;
+
+typedef union {
+ struct {
+ U32 PiSettingRank0 : 7; // Bits 6:0
+ U32 PiSettingRank1 : 7; // Bits 13:7
+ U32 PiSettingRank2 : 7; // Bits 20:14
+ U32 PiSettingRank3 : 7; // Bits 27:21
+ U32 Spare : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCLKCH1_CR_DDRCRCLKPICODE_STRUCT;
+
+typedef union {
+ struct {
+ U32 RefPi : 4; // Bits 3:0
+ U32 DllMask : 2; // Bits 5:4
+ U32 DllRsvd1 : 1; // Bits 6:6
+ U32 TxOn : 1; // Bits 7:7
+ U32 IntClkOn : 1; // Bits 8:8
+ U32 RepClkOn : 1; // Bits 9:9
+ U32 IOLBCtl : 2; // Bits 11:10
+ U32 OdtMode : 1; // Bits 12:12
+ U32 Reserved : 8; // Bits 20:13
+ U32 RxVref : 6; // Bits 26:21
+ U32 VccddqHi : 1; // Bits 27:27
+ U32 DllWeakLock : 1; // Bits 28:28
+ U32 LPDDR_Mode : 1; // Bits 29:29
+ U32 Spare : 2; // Bits 31:30
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCLKCH1_CR_DDRCRCLKCONTROLS_STRUCT;
+
+typedef union {
+ struct {
+ U32 RunTest : 1; // Bits 0:0
+ U32 Load : 1; // Bits 1:1
+ U32 ModeHVM : 1; // Bits 2:2
+ U32 ModeDV : 1; // Bits 3:3
+ U32 ModeADC : 1; // Bits 4:4
+ U32 LoadCount : 10; // Bits 14:5
+ U32 CountStatus : 10; // Bits 24:15
+ U32 Spare : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCLKCH1_CR_DLLPITESTANDADC_STRUCT;
+
+typedef union {
+ struct {
+ U32 DllCB : 2; // Bits 1:0
+ U32 Spare : 30; // Bits 31:2
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCLKCH1_CR_DDRCBSTATUS_STRUCT;
+
+#define DDRCLK_CR_DDRCRCLKRANKSUSED_REG (0x00003900)
+ #define DDRCLK_CR_DDRCRCLKRANKSUSED_RankEn_OFF ( 0)
+ #define DDRCLK_CR_DDRCRCLKRANKSUSED_RankEn_WID ( 4)
+ #define DDRCLK_CR_DDRCRCLKRANKSUSED_RankEn_MSK (0x0000000F)
+ #define DDRCLK_CR_DDRCRCLKRANKSUSED_RankEn_MAX (0x0000000F)
+ #define DDRCLK_CR_DDRCRCLKRANKSUSED_RankEn_DEF (0x0000000F)
+ #define DDRCLK_CR_DDRCRCLKRANKSUSED_Spare_OFF ( 4)
+ #define DDRCLK_CR_DDRCRCLKRANKSUSED_Spare_WID (28)
+ #define DDRCLK_CR_DDRCRCLKRANKSUSED_Spare_MSK (0xFFFFFFF0)
+ #define DDRCLK_CR_DDRCRCLKRANKSUSED_Spare_MAX (0x0FFFFFFF)
+ #define DDRCLK_CR_DDRCRCLKRANKSUSED_Spare_DEF (0x00000000)
+
+#define DDRCLK_CR_DDRCRCLKCOMP_REG (0x00003904)
+ #define DDRCLK_CR_DDRCRCLKCOMP_Scomp_OFF ( 0)
+ #define DDRCLK_CR_DDRCRCLKCOMP_Scomp_WID ( 5)
+ #define DDRCLK_CR_DDRCRCLKCOMP_Scomp_MSK (0x0000001F)
+ #define DDRCLK_CR_DDRCRCLKCOMP_Scomp_MAX (0x0000001F)
+ #define DDRCLK_CR_DDRCRCLKCOMP_Scomp_DEF (0x00000000)
+ #define DDRCLK_CR_DDRCRCLKCOMP_TcoComp_OFF ( 5)
+ #define DDRCLK_CR_DDRCRCLKCOMP_TcoComp_WID ( 6)
+ #define DDRCLK_CR_DDRCRCLKCOMP_TcoComp_MSK (0x000007E0)
+ #define DDRCLK_CR_DDRCRCLKCOMP_TcoComp_MAX (0x0000003F)
+ #define DDRCLK_CR_DDRCRCLKCOMP_TcoComp_DEF (0x00000000)
+ #define DDRCLK_CR_DDRCRCLKCOMP_RcompDrvUp_OFF (11)
+ #define DDRCLK_CR_DDRCRCLKCOMP_RcompDrvUp_WID ( 6)
+ #define DDRCLK_CR_DDRCRCLKCOMP_RcompDrvUp_MSK (0x0001F800)
+ #define DDRCLK_CR_DDRCRCLKCOMP_RcompDrvUp_MAX (0x0000003F)
+ #define DDRCLK_CR_DDRCRCLKCOMP_RcompDrvUp_DEF (0x00000000)
+ #define DDRCLK_CR_DDRCRCLKCOMP_RcompDrvDown_OFF (17)
+ #define DDRCLK_CR_DDRCRCLKCOMP_RcompDrvDown_WID ( 6)
+ #define DDRCLK_CR_DDRCRCLKCOMP_RcompDrvDown_MSK (0x007E0000)
+ #define DDRCLK_CR_DDRCRCLKCOMP_RcompDrvDown_MAX (0x0000003F)
+ #define DDRCLK_CR_DDRCRCLKCOMP_RcompDrvDown_DEF (0x00000000)
+ #define DDRCLK_CR_DDRCRCLKCOMP_LsComp_OFF (23)
+ #define DDRCLK_CR_DDRCRCLKCOMP_LsComp_WID ( 3)
+ #define DDRCLK_CR_DDRCRCLKCOMP_LsComp_MSK (0x03800000)
+ #define DDRCLK_CR_DDRCRCLKCOMP_LsComp_MAX (0x00000007)
+ #define DDRCLK_CR_DDRCRCLKCOMP_LsComp_DEF (0x00000004)
+ #define DDRCLK_CR_DDRCRCLKCOMP_Spare_OFF (26)
+ #define DDRCLK_CR_DDRCRCLKCOMP_Spare_WID ( 6)
+ #define DDRCLK_CR_DDRCRCLKCOMP_Spare_MSK (0xFC000000)
+ #define DDRCLK_CR_DDRCRCLKCOMP_Spare_MAX (0x0000003F)
+ #define DDRCLK_CR_DDRCRCLKCOMP_Spare_DEF (0x00000000)
+
+#define DDRCLK_CR_DDRCRCLKCOMPOFFSET_REG (0x00003908)
+ #define DDRCLK_CR_DDRCRCLKCOMPOFFSET_ScompOffset_OFF ( 0)
+ #define DDRCLK_CR_DDRCRCLKCOMPOFFSET_ScompOffset_WID ( 4)
+ #define DDRCLK_CR_DDRCRCLKCOMPOFFSET_ScompOffset_MSK (0x0000000F)
+ #define DDRCLK_CR_DDRCRCLKCOMPOFFSET_ScompOffset_MAX (0x0000000F)
+ #define DDRCLK_CR_DDRCRCLKCOMPOFFSET_ScompOffset_DEF (0x00000000)
+ #define DDRCLK_CR_DDRCRCLKCOMPOFFSET_TcoCompOffset_OFF ( 4)
+ #define DDRCLK_CR_DDRCRCLKCOMPOFFSET_TcoCompOffset_WID ( 4)
+ #define DDRCLK_CR_DDRCRCLKCOMPOFFSET_TcoCompOffset_MSK (0x000000F0)
+ #define DDRCLK_CR_DDRCRCLKCOMPOFFSET_TcoCompOffset_MAX (0x0000000F)
+ #define DDRCLK_CR_DDRCRCLKCOMPOFFSET_TcoCompOffset_DEF (0x00000000)
+ #define DDRCLK_CR_DDRCRCLKCOMPOFFSET_RcompDrvUpOffset_OFF ( 8)
+ #define DDRCLK_CR_DDRCRCLKCOMPOFFSET_RcompDrvUpOffset_WID ( 4)
+ #define DDRCLK_CR_DDRCRCLKCOMPOFFSET_RcompDrvUpOffset_MSK (0x00000F00)
+ #define DDRCLK_CR_DDRCRCLKCOMPOFFSET_RcompDrvUpOffset_MAX (0x0000000F)
+ #define DDRCLK_CR_DDRCRCLKCOMPOFFSET_RcompDrvUpOffset_DEF (0x00000000)
+ #define DDRCLK_CR_DDRCRCLKCOMPOFFSET_RcompDrvDownOffset_OFF (12)
+ #define DDRCLK_CR_DDRCRCLKCOMPOFFSET_RcompDrvDownOffset_WID ( 4)
+ #define DDRCLK_CR_DDRCRCLKCOMPOFFSET_RcompDrvDownOffset_MSK (0x0000F000)
+ #define DDRCLK_CR_DDRCRCLKCOMPOFFSET_RcompDrvDownOffset_MAX (0x0000000F)
+ #define DDRCLK_CR_DDRCRCLKCOMPOFFSET_RcompDrvDownOffset_DEF (0x00000000)
+ #define DDRCLK_CR_DDRCRCLKCOMPOFFSET_Spare_OFF (16)
+ #define DDRCLK_CR_DDRCRCLKCOMPOFFSET_Spare_WID (16)
+ #define DDRCLK_CR_DDRCRCLKCOMPOFFSET_Spare_MSK (0xFFFF0000)
+ #define DDRCLK_CR_DDRCRCLKCOMPOFFSET_Spare_MAX (0x0000FFFF)
+ #define DDRCLK_CR_DDRCRCLKCOMPOFFSET_Spare_DEF (0x00000000)
+
+#define DDRCLK_CR_DDRCRCLKPICODE_REG (0x0000390C)
+ #define DDRCLK_CR_DDRCRCLKPICODE_PiSettingRank0_OFF ( 0)
+ #define DDRCLK_CR_DDRCRCLKPICODE_PiSettingRank0_WID ( 7)
+ #define DDRCLK_CR_DDRCRCLKPICODE_PiSettingRank0_MSK (0x0000007F)
+ #define DDRCLK_CR_DDRCRCLKPICODE_PiSettingRank0_MAX (0x0000007F)
+ #define DDRCLK_CR_DDRCRCLKPICODE_PiSettingRank0_DEF (0x00000000)
+ #define DDRCLK_CR_DDRCRCLKPICODE_PiSettingRank1_OFF ( 7)
+ #define DDRCLK_CR_DDRCRCLKPICODE_PiSettingRank1_WID ( 7)
+ #define DDRCLK_CR_DDRCRCLKPICODE_PiSettingRank1_MSK (0x00003F80)
+ #define DDRCLK_CR_DDRCRCLKPICODE_PiSettingRank1_MAX (0x0000007F)
+ #define DDRCLK_CR_DDRCRCLKPICODE_PiSettingRank1_DEF (0x00000000)
+ #define DDRCLK_CR_DDRCRCLKPICODE_PiSettingRank2_OFF (14)
+ #define DDRCLK_CR_DDRCRCLKPICODE_PiSettingRank2_WID ( 7)
+ #define DDRCLK_CR_DDRCRCLKPICODE_PiSettingRank2_MSK (0x001FC000)
+ #define DDRCLK_CR_DDRCRCLKPICODE_PiSettingRank2_MAX (0x0000007F)
+ #define DDRCLK_CR_DDRCRCLKPICODE_PiSettingRank2_DEF (0x00000000)
+ #define DDRCLK_CR_DDRCRCLKPICODE_PiSettingRank3_OFF (21)
+ #define DDRCLK_CR_DDRCRCLKPICODE_PiSettingRank3_WID ( 7)
+ #define DDRCLK_CR_DDRCRCLKPICODE_PiSettingRank3_MSK (0x0FE00000)
+ #define DDRCLK_CR_DDRCRCLKPICODE_PiSettingRank3_MAX (0x0000007F)
+ #define DDRCLK_CR_DDRCRCLKPICODE_PiSettingRank3_DEF (0x00000000)
+ #define DDRCLK_CR_DDRCRCLKPICODE_Spare_OFF (28)
+ #define DDRCLK_CR_DDRCRCLKPICODE_Spare_WID ( 4)
+ #define DDRCLK_CR_DDRCRCLKPICODE_Spare_MSK (0xF0000000)
+ #define DDRCLK_CR_DDRCRCLKPICODE_Spare_MAX (0x0000000F)
+ #define DDRCLK_CR_DDRCRCLKPICODE_Spare_DEF (0x00000000)
+
+#define DDRCLK_CR_DDRCRCLKCONTROLS_REG (0x00003910)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_RefPi_OFF ( 0)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_RefPi_WID ( 4)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_RefPi_MSK (0x0000000F)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_RefPi_MAX (0x0000000F)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_RefPi_DEF (0x00000000)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_DllMask_OFF ( 4)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_DllMask_WID ( 2)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_DllMask_MSK (0x00000030)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_DllMask_MAX (0x00000003)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_DllMask_DEF (0x00000000)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_DllRsvd1_OFF ( 6)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_DllRsvd1_WID ( 1)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_DllRsvd1_MSK (0x00000040)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_DllRsvd1_MAX (0x00000001)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_DllRsvd1_DEF (0x00000000)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_TxOn_OFF ( 7)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_TxOn_WID ( 1)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_TxOn_MSK (0x00000080)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_TxOn_MAX (0x00000001)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_TxOn_DEF (0x00000000)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_IntClkOn_OFF ( 8)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_IntClkOn_WID ( 1)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_IntClkOn_MSK (0x00000100)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_IntClkOn_MAX (0x00000001)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_IntClkOn_DEF (0x00000000)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_RepClkOn_OFF ( 9)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_RepClkOn_WID ( 1)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_RepClkOn_MSK (0x00000200)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_RepClkOn_MAX (0x00000001)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_RepClkOn_DEF (0x00000000)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_IOLBCtl_OFF (10)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_IOLBCtl_WID ( 2)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_IOLBCtl_MSK (0x00000C00)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_IOLBCtl_MAX (0x00000003)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_IOLBCtl_DEF (0x00000000)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_OdtMode_OFF (12)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_OdtMode_WID ( 1)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_OdtMode_MSK (0x00001000)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_OdtMode_MAX (0x00000001)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_OdtMode_DEF (0x00000000)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_Reserved_OFF (13)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_Reserved_WID ( 8)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_Reserved_MSK (0x001FE000)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_Reserved_MAX (0x000000FF)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_Reserved_DEF (0x00000000)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_RxVref_OFF (21)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_RxVref_WID ( 6)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_RxVref_MSK (0x07E00000)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_RxVref_MAX (0x0000003F)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_RxVref_DEF (0x00000000)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_VccddqHi_OFF (27)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_VccddqHi_WID ( 1)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_VccddqHi_MSK (0x08000000)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_VccddqHi_MAX (0x00000001)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_VccddqHi_DEF (0x00000000)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_DllWeakLock_OFF (28)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_DllWeakLock_WID ( 1)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_DllWeakLock_MSK (0x10000000)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_DllWeakLock_MAX (0x00000001)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_DllWeakLock_DEF (0x00000000)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_LPDDR_Mode_OFF (29)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_LPDDR_Mode_WID ( 1)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_LPDDR_Mode_MSK (0x20000000)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_LPDDR_Mode_MAX (0x00000001)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_LPDDR_Mode_DEF (0x00000000)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_Spare_OFF (30)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_Spare_WID ( 2)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_Spare_MSK (0xC0000000)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_Spare_MAX (0x00000003)
+ #define DDRCLK_CR_DDRCRCLKCONTROLS_Spare_DEF (0x00000000)
+
+#define DDRCLK_CR_DLLPITESTANDADC_REG (0x00003914)
+ #define DDRCLK_CR_DLLPITESTANDADC_RunTest_OFF ( 0)
+ #define DDRCLK_CR_DLLPITESTANDADC_RunTest_WID ( 1)
+ #define DDRCLK_CR_DLLPITESTANDADC_RunTest_MSK (0x00000001)
+ #define DDRCLK_CR_DLLPITESTANDADC_RunTest_MAX (0x00000001)
+ #define DDRCLK_CR_DLLPITESTANDADC_RunTest_DEF (0x00000000)
+ #define DDRCLK_CR_DLLPITESTANDADC_Load_OFF ( 1)
+ #define DDRCLK_CR_DLLPITESTANDADC_Load_WID ( 1)
+ #define DDRCLK_CR_DLLPITESTANDADC_Load_MSK (0x00000002)
+ #define DDRCLK_CR_DLLPITESTANDADC_Load_MAX (0x00000001)
+ #define DDRCLK_CR_DLLPITESTANDADC_Load_DEF (0x00000000)
+ #define DDRCLK_CR_DLLPITESTANDADC_ModeHVM_OFF ( 2)
+ #define DDRCLK_CR_DLLPITESTANDADC_ModeHVM_WID ( 1)
+ #define DDRCLK_CR_DLLPITESTANDADC_ModeHVM_MSK (0x00000004)
+ #define DDRCLK_CR_DLLPITESTANDADC_ModeHVM_MAX (0x00000001)
+ #define DDRCLK_CR_DLLPITESTANDADC_ModeHVM_DEF (0x00000000)
+ #define DDRCLK_CR_DLLPITESTANDADC_ModeDV_OFF ( 3)
+ #define DDRCLK_CR_DLLPITESTANDADC_ModeDV_WID ( 1)
+ #define DDRCLK_CR_DLLPITESTANDADC_ModeDV_MSK (0x00000008)
+ #define DDRCLK_CR_DLLPITESTANDADC_ModeDV_MAX (0x00000001)
+ #define DDRCLK_CR_DLLPITESTANDADC_ModeDV_DEF (0x00000000)
+ #define DDRCLK_CR_DLLPITESTANDADC_ModeADC_OFF ( 4)
+ #define DDRCLK_CR_DLLPITESTANDADC_ModeADC_WID ( 1)
+ #define DDRCLK_CR_DLLPITESTANDADC_ModeADC_MSK (0x00000010)
+ #define DDRCLK_CR_DLLPITESTANDADC_ModeADC_MAX (0x00000001)
+ #define DDRCLK_CR_DLLPITESTANDADC_ModeADC_DEF (0x00000000)
+ #define DDRCLK_CR_DLLPITESTANDADC_LoadCount_OFF ( 5)
+ #define DDRCLK_CR_DLLPITESTANDADC_LoadCount_WID (10)
+ #define DDRCLK_CR_DLLPITESTANDADC_LoadCount_MSK (0x00007FE0)
+ #define DDRCLK_CR_DLLPITESTANDADC_LoadCount_MAX (0x000003FF)
+ #define DDRCLK_CR_DLLPITESTANDADC_CountStatus_OFF (15)
+ #define DDRCLK_CR_DLLPITESTANDADC_CountStatus_WID (10)
+ #define DDRCLK_CR_DLLPITESTANDADC_CountStatus_MSK (0x01FF8000)
+ #define DDRCLK_CR_DLLPITESTANDADC_CountStatus_MAX (0x000003FF)
+ #define DDRCLK_CR_DLLPITESTANDADC_CountStatus_DEF (0x00000000)
+ #define DDRCLK_CR_DLLPITESTANDADC_Spare_OFF (25)
+ #define DDRCLK_CR_DLLPITESTANDADC_Spare_WID ( 7)
+ #define DDRCLK_CR_DLLPITESTANDADC_Spare_MSK (0xFE000000)
+ #define DDRCLK_CR_DLLPITESTANDADC_Spare_MAX (0x0000007F)
+
+#define DDRCLK_CR_DDRCBSTATUS_REG (0x00003918)
+ #define DDRCLK_CR_DDRCBSTATUS_DllCB_OFF ( 0)
+ #define DDRCLK_CR_DDRCBSTATUS_DllCB_WID ( 2)
+ #define DDRCLK_CR_DDRCBSTATUS_DllCB_MSK (0x00000003)
+ #define DDRCLK_CR_DDRCBSTATUS_DllCB_MAX (0x00000003)
+ #define DDRCLK_CR_DDRCBSTATUS_DllCB_DEF (0x00000000)
+ #define DDRCLK_CR_DDRCBSTATUS_Spare_OFF ( 2)
+ #define DDRCLK_CR_DDRCBSTATUS_Spare_WID (30)
+ #define DDRCLK_CR_DDRCBSTATUS_Spare_MSK (0xFFFFFFFC)
+ #define DDRCLK_CR_DDRCBSTATUS_Spare_MAX (0x3FFFFFFF)
+ #define DDRCLK_CR_DDRCBSTATUS_Spare_DEF (0x00000000)
+
+#define DDRCLKCH0_CR_DDRCRCLKRANKSUSED_REG (0x00001800)
+ #define DDRCLKCH0_CR_DDRCRCLKRANKSUSED_RankEn_OFF ( 0)
+ #define DDRCLKCH0_CR_DDRCRCLKRANKSUSED_RankEn_WID ( 4)
+ #define DDRCLKCH0_CR_DDRCRCLKRANKSUSED_RankEn_MSK (0x0000000F)
+ #define DDRCLKCH0_CR_DDRCRCLKRANKSUSED_RankEn_MAX (0x0000000F)
+ #define DDRCLKCH0_CR_DDRCRCLKRANKSUSED_RankEn_DEF (0x0000000F)
+ #define DDRCLKCH0_CR_DDRCRCLKRANKSUSED_Spare_OFF ( 4)
+ #define DDRCLKCH0_CR_DDRCRCLKRANKSUSED_Spare_WID (28)
+ #define DDRCLKCH0_CR_DDRCRCLKRANKSUSED_Spare_MSK (0xFFFFFFF0)
+ #define DDRCLKCH0_CR_DDRCRCLKRANKSUSED_Spare_MAX (0x0FFFFFFF)
+ #define DDRCLKCH0_CR_DDRCRCLKRANKSUSED_Spare_DEF (0x00000000)
+
+#define DDRCLKCH0_CR_DDRCRCLKCOMP_REG (0x00001804)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMP_Scomp_OFF ( 0)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMP_Scomp_WID ( 5)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMP_Scomp_MSK (0x0000001F)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMP_Scomp_MAX (0x0000001F)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMP_Scomp_DEF (0x00000000)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMP_TcoComp_OFF ( 5)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMP_TcoComp_WID ( 6)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMP_TcoComp_MSK (0x000007E0)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMP_TcoComp_MAX (0x0000003F)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMP_TcoComp_DEF (0x00000000)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMP_RcompDrvUp_OFF (11)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMP_RcompDrvUp_WID ( 6)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMP_RcompDrvUp_MSK (0x0001F800)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMP_RcompDrvUp_MAX (0x0000003F)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMP_RcompDrvUp_DEF (0x00000000)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMP_RcompDrvDown_OFF (17)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMP_RcompDrvDown_WID ( 6)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMP_RcompDrvDown_MSK (0x007E0000)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMP_RcompDrvDown_MAX (0x0000003F)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMP_RcompDrvDown_DEF (0x00000000)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMP_LsComp_OFF (23)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMP_LsComp_WID ( 3)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMP_LsComp_MSK (0x03800000)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMP_LsComp_MAX (0x00000007)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMP_LsComp_DEF (0x00000004)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMP_Spare_OFF (26)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMP_Spare_WID ( 6)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMP_Spare_MSK (0xFC000000)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMP_Spare_MAX (0x0000003F)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMP_Spare_DEF (0x00000000)
+
+#define DDRCLKCH0_CR_DDRCRCLKCOMPOFFSET_REG (0x00001808)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMPOFFSET_ScompOffset_OFF ( 0)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMPOFFSET_ScompOffset_WID ( 4)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMPOFFSET_ScompOffset_MSK (0x0000000F)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMPOFFSET_ScompOffset_MAX (0x0000000F)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMPOFFSET_ScompOffset_DEF (0x00000000)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMPOFFSET_TcoCompOffset_OFF ( 4)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMPOFFSET_TcoCompOffset_WID ( 4)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMPOFFSET_TcoCompOffset_MSK (0x000000F0)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMPOFFSET_TcoCompOffset_MAX (0x0000000F)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMPOFFSET_TcoCompOffset_DEF (0x00000000)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMPOFFSET_RcompDrvUpOffset_OFF ( 8)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMPOFFSET_RcompDrvUpOffset_WID ( 4)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMPOFFSET_RcompDrvUpOffset_MSK (0x00000F00)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMPOFFSET_RcompDrvUpOffset_MAX (0x0000000F)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMPOFFSET_RcompDrvUpOffset_DEF (0x00000000)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMPOFFSET_RcompDrvDownOffset_OFF (12)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMPOFFSET_RcompDrvDownOffset_WID ( 4)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMPOFFSET_RcompDrvDownOffset_MSK (0x0000F000)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMPOFFSET_RcompDrvDownOffset_MAX (0x0000000F)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMPOFFSET_RcompDrvDownOffset_DEF (0x00000000)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMPOFFSET_Spare_OFF (16)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMPOFFSET_Spare_WID (16)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMPOFFSET_Spare_MSK (0xFFFF0000)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMPOFFSET_Spare_MAX (0x0000FFFF)
+ #define DDRCLKCH0_CR_DDRCRCLKCOMPOFFSET_Spare_DEF (0x00000000)
+
+#define DDRCLKCH0_CR_DDRCRCLKPICODE_REG (0x0000180C)
+ #define DDRCLKCH0_CR_DDRCRCLKPICODE_PiSettingRank0_OFF ( 0)
+ #define DDRCLKCH0_CR_DDRCRCLKPICODE_PiSettingRank0_WID ( 7)
+ #define DDRCLKCH0_CR_DDRCRCLKPICODE_PiSettingRank0_MSK (0x0000007F)
+ #define DDRCLKCH0_CR_DDRCRCLKPICODE_PiSettingRank0_MAX (0x0000007F)
+ #define DDRCLKCH0_CR_DDRCRCLKPICODE_PiSettingRank0_DEF (0x00000000)
+ #define DDRCLKCH0_CR_DDRCRCLKPICODE_PiSettingRank1_OFF ( 7)
+ #define DDRCLKCH0_CR_DDRCRCLKPICODE_PiSettingRank1_WID ( 7)
+ #define DDRCLKCH0_CR_DDRCRCLKPICODE_PiSettingRank1_MSK (0x00003F80)
+ #define DDRCLKCH0_CR_DDRCRCLKPICODE_PiSettingRank1_MAX (0x0000007F)
+ #define DDRCLKCH0_CR_DDRCRCLKPICODE_PiSettingRank1_DEF (0x00000000)
+ #define DDRCLKCH0_CR_DDRCRCLKPICODE_PiSettingRank2_OFF (14)
+ #define DDRCLKCH0_CR_DDRCRCLKPICODE_PiSettingRank2_WID ( 7)
+ #define DDRCLKCH0_CR_DDRCRCLKPICODE_PiSettingRank2_MSK (0x001FC000)
+ #define DDRCLKCH0_CR_DDRCRCLKPICODE_PiSettingRank2_MAX (0x0000007F)
+ #define DDRCLKCH0_CR_DDRCRCLKPICODE_PiSettingRank2_DEF (0x00000000)
+ #define DDRCLKCH0_CR_DDRCRCLKPICODE_PiSettingRank3_OFF (21)
+ #define DDRCLKCH0_CR_DDRCRCLKPICODE_PiSettingRank3_WID ( 7)
+ #define DDRCLKCH0_CR_DDRCRCLKPICODE_PiSettingRank3_MSK (0x0FE00000)
+ #define DDRCLKCH0_CR_DDRCRCLKPICODE_PiSettingRank3_MAX (0x0000007F)
+ #define DDRCLKCH0_CR_DDRCRCLKPICODE_PiSettingRank3_DEF (0x00000000)
+ #define DDRCLKCH0_CR_DDRCRCLKPICODE_Spare_OFF (28)
+ #define DDRCLKCH0_CR_DDRCRCLKPICODE_Spare_WID ( 4)
+ #define DDRCLKCH0_CR_DDRCRCLKPICODE_Spare_MSK (0xF0000000)
+ #define DDRCLKCH0_CR_DDRCRCLKPICODE_Spare_MAX (0x0000000F)
+ #define DDRCLKCH0_CR_DDRCRCLKPICODE_Spare_DEF (0x00000000)
+
+#define DDRCLKCH0_CR_DDRCRCLKCONTROLS_REG (0x00001810)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_RefPi_OFF ( 0)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_RefPi_WID ( 4)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_RefPi_MSK (0x0000000F)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_RefPi_MAX (0x0000000F)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_RefPi_DEF (0x00000000)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_DllMask_OFF ( 4)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_DllMask_WID ( 2)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_DllMask_MSK (0x00000030)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_DllMask_MAX (0x00000003)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_DllMask_DEF (0x00000000)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_DllRsvd1_OFF ( 6)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_DllRsvd1_WID ( 1)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_DllRsvd1_MSK (0x00000040)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_DllRsvd1_MAX (0x00000001)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_DllRsvd1_DEF (0x00000000)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_TxOn_OFF ( 7)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_TxOn_WID ( 1)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_TxOn_MSK (0x00000080)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_TxOn_MAX (0x00000001)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_TxOn_DEF (0x00000000)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_IntClkOn_OFF ( 8)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_IntClkOn_WID ( 1)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_IntClkOn_MSK (0x00000100)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_IntClkOn_MAX (0x00000001)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_IntClkOn_DEF (0x00000000)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_RepClkOn_OFF ( 9)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_RepClkOn_WID ( 1)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_RepClkOn_MSK (0x00000200)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_RepClkOn_MAX (0x00000001)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_RepClkOn_DEF (0x00000000)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_IOLBCtl_OFF (10)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_IOLBCtl_WID ( 2)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_IOLBCtl_MSK (0x00000C00)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_IOLBCtl_MAX (0x00000003)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_IOLBCtl_DEF (0x00000000)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_OdtMode_OFF (12)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_OdtMode_WID ( 1)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_OdtMode_MSK (0x00001000)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_OdtMode_MAX (0x00000001)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_OdtMode_DEF (0x00000000)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_Reserved_OFF (13)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_Reserved_WID ( 8)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_Reserved_MSK (0x001FE000)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_Reserved_MAX (0x000000FF)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_Reserved_DEF (0x00000000)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_RxVref_OFF (21)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_RxVref_WID ( 6)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_RxVref_MSK (0x07E00000)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_RxVref_MAX (0x0000003F)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_RxVref_DEF (0x00000000)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_VccddqHi_OFF (27)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_VccddqHi_WID ( 1)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_VccddqHi_MSK (0x08000000)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_VccddqHi_MAX (0x00000001)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_VccddqHi_DEF (0x00000000)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_DllWeakLock_OFF (28)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_DllWeakLock_WID ( 1)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_DllWeakLock_MSK (0x10000000)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_DllWeakLock_MAX (0x00000001)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_DllWeakLock_DEF (0x00000000)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_LPDDR_Mode_OFF (29)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_LPDDR_Mode_WID ( 1)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_LPDDR_Mode_MSK (0x20000000)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_LPDDR_Mode_MAX (0x00000001)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_LPDDR_Mode_DEF (0x00000000)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_Spare_OFF (30)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_Spare_WID ( 2)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_Spare_MSK (0xC0000000)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_Spare_MAX (0x00000003)
+ #define DDRCLKCH0_CR_DDRCRCLKCONTROLS_Spare_DEF (0x00000000)
+
+#define DDRCLKCH0_CR_DLLPITESTANDADC_REG (0x00001814)
+ #define DDRCLKCH0_CR_DLLPITESTANDADC_RunTest_OFF ( 0)
+ #define DDRCLKCH0_CR_DLLPITESTANDADC_RunTest_WID ( 1)
+ #define DDRCLKCH0_CR_DLLPITESTANDADC_RunTest_MSK (0x00000001)
+ #define DDRCLKCH0_CR_DLLPITESTANDADC_RunTest_MAX (0x00000001)
+ #define DDRCLKCH0_CR_DLLPITESTANDADC_RunTest_DEF (0x00000000)
+ #define DDRCLKCH0_CR_DLLPITESTANDADC_Load_OFF ( 1)
+ #define DDRCLKCH0_CR_DLLPITESTANDADC_Load_WID ( 1)
+ #define DDRCLKCH0_CR_DLLPITESTANDADC_Load_MSK (0x00000002)
+ #define DDRCLKCH0_CR_DLLPITESTANDADC_Load_MAX (0x00000001)
+ #define DDRCLKCH0_CR_DLLPITESTANDADC_Load_DEF (0x00000000)
+ #define DDRCLKCH0_CR_DLLPITESTANDADC_ModeHVM_OFF ( 2)
+ #define DDRCLKCH0_CR_DLLPITESTANDADC_ModeHVM_WID ( 1)
+ #define DDRCLKCH0_CR_DLLPITESTANDADC_ModeHVM_MSK (0x00000004)
+ #define DDRCLKCH0_CR_DLLPITESTANDADC_ModeHVM_MAX (0x00000001)
+ #define DDRCLKCH0_CR_DLLPITESTANDADC_ModeHVM_DEF (0x00000000)
+ #define DDRCLKCH0_CR_DLLPITESTANDADC_ModeDV_OFF ( 3)
+ #define DDRCLKCH0_CR_DLLPITESTANDADC_ModeDV_WID ( 1)
+ #define DDRCLKCH0_CR_DLLPITESTANDADC_ModeDV_MSK (0x00000008)
+ #define DDRCLKCH0_CR_DLLPITESTANDADC_ModeDV_MAX (0x00000001)
+ #define DDRCLKCH0_CR_DLLPITESTANDADC_ModeDV_DEF (0x00000000)
+ #define DDRCLKCH0_CR_DLLPITESTANDADC_ModeADC_OFF ( 4)
+ #define DDRCLKCH0_CR_DLLPITESTANDADC_ModeADC_WID ( 1)
+ #define DDRCLKCH0_CR_DLLPITESTANDADC_ModeADC_MSK (0x00000010)
+ #define DDRCLKCH0_CR_DLLPITESTANDADC_ModeADC_MAX (0x00000001)
+ #define DDRCLKCH0_CR_DLLPITESTANDADC_ModeADC_DEF (0x00000000)
+ #define DDRCLKCH0_CR_DLLPITESTANDADC_LoadCount_OFF ( 5)
+ #define DDRCLKCH0_CR_DLLPITESTANDADC_LoadCount_WID (10)
+ #define DDRCLKCH0_CR_DLLPITESTANDADC_LoadCount_MSK (0x00007FE0)
+ #define DDRCLKCH0_CR_DLLPITESTANDADC_LoadCount_MAX (0x000003FF)
+ #define DDRCLKCH0_CR_DLLPITESTANDADC_CountStatus_OFF (15)
+ #define DDRCLKCH0_CR_DLLPITESTANDADC_CountStatus_WID (10)
+ #define DDRCLKCH0_CR_DLLPITESTANDADC_CountStatus_MSK (0x01FF8000)
+ #define DDRCLKCH0_CR_DLLPITESTANDADC_CountStatus_MAX (0x000003FF)
+ #define DDRCLKCH0_CR_DLLPITESTANDADC_CountStatus_DEF (0x00000000)
+ #define DDRCLKCH0_CR_DLLPITESTANDADC_Spare_OFF (25)
+ #define DDRCLKCH0_CR_DLLPITESTANDADC_Spare_WID ( 7)
+ #define DDRCLKCH0_CR_DLLPITESTANDADC_Spare_MSK (0xFE000000)
+ #define DDRCLKCH0_CR_DLLPITESTANDADC_Spare_MAX (0x0000007F)
+
+#define DDRCLKCH0_CR_DDRCBSTATUS_REG (0x00001818)
+ #define DDRCLKCH0_CR_DDRCBSTATUS_DllCB_OFF ( 0)
+ #define DDRCLKCH0_CR_DDRCBSTATUS_DllCB_WID ( 2)
+ #define DDRCLKCH0_CR_DDRCBSTATUS_DllCB_MSK (0x00000003)
+ #define DDRCLKCH0_CR_DDRCBSTATUS_DllCB_MAX (0x00000003)
+ #define DDRCLKCH0_CR_DDRCBSTATUS_DllCB_DEF (0x00000000)
+ #define DDRCLKCH0_CR_DDRCBSTATUS_Spare_OFF ( 2)
+ #define DDRCLKCH0_CR_DDRCBSTATUS_Spare_WID (30)
+ #define DDRCLKCH0_CR_DDRCBSTATUS_Spare_MSK (0xFFFFFFFC)
+ #define DDRCLKCH0_CR_DDRCBSTATUS_Spare_MAX (0x3FFFFFFF)
+ #define DDRCLKCH0_CR_DDRCBSTATUS_Spare_DEF (0x00000000)
+
+#define DDRCLKCH1_CR_DDRCRCLKRANKSUSED_REG (0x00001900)
+ #define DDRCLKCH1_CR_DDRCRCLKRANKSUSED_RankEn_OFF ( 0)
+ #define DDRCLKCH1_CR_DDRCRCLKRANKSUSED_RankEn_WID ( 4)
+ #define DDRCLKCH1_CR_DDRCRCLKRANKSUSED_RankEn_MSK (0x0000000F)
+ #define DDRCLKCH1_CR_DDRCRCLKRANKSUSED_RankEn_MAX (0x0000000F)
+ #define DDRCLKCH1_CR_DDRCRCLKRANKSUSED_RankEn_DEF (0x0000000F)
+ #define DDRCLKCH1_CR_DDRCRCLKRANKSUSED_Spare_OFF ( 4)
+ #define DDRCLKCH1_CR_DDRCRCLKRANKSUSED_Spare_WID (28)
+ #define DDRCLKCH1_CR_DDRCRCLKRANKSUSED_Spare_MSK (0xFFFFFFF0)
+ #define DDRCLKCH1_CR_DDRCRCLKRANKSUSED_Spare_MAX (0x0FFFFFFF)
+ #define DDRCLKCH1_CR_DDRCRCLKRANKSUSED_Spare_DEF (0x00000000)
+
+#define DDRCLKCH1_CR_DDRCRCLKCOMP_REG (0x00001904)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMP_Scomp_OFF ( 0)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMP_Scomp_WID ( 5)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMP_Scomp_MSK (0x0000001F)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMP_Scomp_MAX (0x0000001F)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMP_Scomp_DEF (0x00000000)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMP_TcoComp_OFF ( 5)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMP_TcoComp_WID ( 6)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMP_TcoComp_MSK (0x000007E0)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMP_TcoComp_MAX (0x0000003F)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMP_TcoComp_DEF (0x00000000)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMP_RcompDrvUp_OFF (11)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMP_RcompDrvUp_WID ( 6)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMP_RcompDrvUp_MSK (0x0001F800)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMP_RcompDrvUp_MAX (0x0000003F)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMP_RcompDrvUp_DEF (0x00000000)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMP_RcompDrvDown_OFF (17)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMP_RcompDrvDown_WID ( 6)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMP_RcompDrvDown_MSK (0x007E0000)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMP_RcompDrvDown_MAX (0x0000003F)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMP_RcompDrvDown_DEF (0x00000000)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMP_LsComp_OFF (23)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMP_LsComp_WID ( 3)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMP_LsComp_MSK (0x03800000)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMP_LsComp_MAX (0x00000007)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMP_LsComp_DEF (0x00000004)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMP_Spare_OFF (26)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMP_Spare_WID ( 6)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMP_Spare_MSK (0xFC000000)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMP_Spare_MAX (0x0000003F)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMP_Spare_DEF (0x00000000)
+
+#define DDRCLKCH1_CR_DDRCRCLKCOMPOFFSET_REG (0x00001908)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMPOFFSET_ScompOffset_OFF ( 0)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMPOFFSET_ScompOffset_WID ( 4)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMPOFFSET_ScompOffset_MSK (0x0000000F)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMPOFFSET_ScompOffset_MAX (0x0000000F)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMPOFFSET_ScompOffset_DEF (0x00000000)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMPOFFSET_TcoCompOffset_OFF ( 4)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMPOFFSET_TcoCompOffset_WID ( 4)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMPOFFSET_TcoCompOffset_MSK (0x000000F0)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMPOFFSET_TcoCompOffset_MAX (0x0000000F)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMPOFFSET_TcoCompOffset_DEF (0x00000000)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMPOFFSET_RcompDrvUpOffset_OFF ( 8)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMPOFFSET_RcompDrvUpOffset_WID ( 4)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMPOFFSET_RcompDrvUpOffset_MSK (0x00000F00)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMPOFFSET_RcompDrvUpOffset_MAX (0x0000000F)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMPOFFSET_RcompDrvUpOffset_DEF (0x00000000)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMPOFFSET_RcompDrvDownOffset_OFF (12)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMPOFFSET_RcompDrvDownOffset_WID ( 4)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMPOFFSET_RcompDrvDownOffset_MSK (0x0000F000)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMPOFFSET_RcompDrvDownOffset_MAX (0x0000000F)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMPOFFSET_RcompDrvDownOffset_DEF (0x00000000)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMPOFFSET_Spare_OFF (16)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMPOFFSET_Spare_WID (16)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMPOFFSET_Spare_MSK (0xFFFF0000)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMPOFFSET_Spare_MAX (0x0000FFFF)
+ #define DDRCLKCH1_CR_DDRCRCLKCOMPOFFSET_Spare_DEF (0x00000000)
+
+#define DDRCLKCH1_CR_DDRCRCLKPICODE_REG (0x0000190C)
+ #define DDRCLKCH1_CR_DDRCRCLKPICODE_PiSettingRank0_OFF ( 0)
+ #define DDRCLKCH1_CR_DDRCRCLKPICODE_PiSettingRank0_WID ( 7)
+ #define DDRCLKCH1_CR_DDRCRCLKPICODE_PiSettingRank0_MSK (0x0000007F)
+ #define DDRCLKCH1_CR_DDRCRCLKPICODE_PiSettingRank0_MAX (0x0000007F)
+ #define DDRCLKCH1_CR_DDRCRCLKPICODE_PiSettingRank0_DEF (0x00000000)
+ #define DDRCLKCH1_CR_DDRCRCLKPICODE_PiSettingRank1_OFF ( 7)
+ #define DDRCLKCH1_CR_DDRCRCLKPICODE_PiSettingRank1_WID ( 7)
+ #define DDRCLKCH1_CR_DDRCRCLKPICODE_PiSettingRank1_MSK (0x00003F80)
+ #define DDRCLKCH1_CR_DDRCRCLKPICODE_PiSettingRank1_MAX (0x0000007F)
+ #define DDRCLKCH1_CR_DDRCRCLKPICODE_PiSettingRank1_DEF (0x00000000)
+ #define DDRCLKCH1_CR_DDRCRCLKPICODE_PiSettingRank2_OFF (14)
+ #define DDRCLKCH1_CR_DDRCRCLKPICODE_PiSettingRank2_WID ( 7)
+ #define DDRCLKCH1_CR_DDRCRCLKPICODE_PiSettingRank2_MSK (0x001FC000)
+ #define DDRCLKCH1_CR_DDRCRCLKPICODE_PiSettingRank2_MAX (0x0000007F)
+ #define DDRCLKCH1_CR_DDRCRCLKPICODE_PiSettingRank2_DEF (0x00000000)
+ #define DDRCLKCH1_CR_DDRCRCLKPICODE_PiSettingRank3_OFF (21)
+ #define DDRCLKCH1_CR_DDRCRCLKPICODE_PiSettingRank3_WID ( 7)
+ #define DDRCLKCH1_CR_DDRCRCLKPICODE_PiSettingRank3_MSK (0x0FE00000)
+ #define DDRCLKCH1_CR_DDRCRCLKPICODE_PiSettingRank3_MAX (0x0000007F)
+ #define DDRCLKCH1_CR_DDRCRCLKPICODE_PiSettingRank3_DEF (0x00000000)
+ #define DDRCLKCH1_CR_DDRCRCLKPICODE_Spare_OFF (28)
+ #define DDRCLKCH1_CR_DDRCRCLKPICODE_Spare_WID ( 4)
+ #define DDRCLKCH1_CR_DDRCRCLKPICODE_Spare_MSK (0xF0000000)
+ #define DDRCLKCH1_CR_DDRCRCLKPICODE_Spare_MAX (0x0000000F)
+ #define DDRCLKCH1_CR_DDRCRCLKPICODE_Spare_DEF (0x00000000)
+
+#define DDRCLKCH1_CR_DDRCRCLKCONTROLS_REG (0x00001910)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_RefPi_OFF ( 0)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_RefPi_WID ( 4)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_RefPi_MSK (0x0000000F)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_RefPi_MAX (0x0000000F)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_RefPi_DEF (0x00000000)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_DllMask_OFF ( 4)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_DllMask_WID ( 2)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_DllMask_MSK (0x00000030)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_DllMask_MAX (0x00000003)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_DllMask_DEF (0x00000000)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_DllRsvd1_OFF ( 6)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_DllRsvd1_WID ( 1)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_DllRsvd1_MSK (0x00000040)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_DllRsvd1_MAX (0x00000001)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_DllRsvd1_DEF (0x00000000)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_TxOn_OFF ( 7)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_TxOn_WID ( 1)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_TxOn_MSK (0x00000080)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_TxOn_MAX (0x00000001)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_TxOn_DEF (0x00000000)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_IntClkOn_OFF ( 8)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_IntClkOn_WID ( 1)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_IntClkOn_MSK (0x00000100)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_IntClkOn_MAX (0x00000001)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_IntClkOn_DEF (0x00000000)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_RepClkOn_OFF ( 9)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_RepClkOn_WID ( 1)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_RepClkOn_MSK (0x00000200)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_RepClkOn_MAX (0x00000001)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_RepClkOn_DEF (0x00000000)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_IOLBCtl_OFF (10)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_IOLBCtl_WID ( 2)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_IOLBCtl_MSK (0x00000C00)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_IOLBCtl_MAX (0x00000003)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_IOLBCtl_DEF (0x00000000)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_OdtMode_OFF (12)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_OdtMode_WID ( 1)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_OdtMode_MSK (0x00001000)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_OdtMode_MAX (0x00000001)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_OdtMode_DEF (0x00000000)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_Reserved_OFF (13)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_Reserved_WID ( 8)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_Reserved_MSK (0x001FE000)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_Reserved_MAX (0x000000FF)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_Reserved_DEF (0x00000000)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_RxVref_OFF (21)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_RxVref_WID ( 6)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_RxVref_MSK (0x07E00000)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_RxVref_MAX (0x0000003F)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_RxVref_DEF (0x00000000)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_VccddqHi_OFF (27)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_VccddqHi_WID ( 1)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_VccddqHi_MSK (0x08000000)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_VccddqHi_MAX (0x00000001)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_VccddqHi_DEF (0x00000000)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_DllWeakLock_OFF (28)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_DllWeakLock_WID ( 1)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_DllWeakLock_MSK (0x10000000)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_DllWeakLock_MAX (0x00000001)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_DllWeakLock_DEF (0x00000000)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_LPDDR_Mode_OFF (29)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_LPDDR_Mode_WID ( 1)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_LPDDR_Mode_MSK (0x20000000)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_LPDDR_Mode_MAX (0x00000001)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_LPDDR_Mode_DEF (0x00000000)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_Spare_OFF (30)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_Spare_WID ( 2)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_Spare_MSK (0xC0000000)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_Spare_MAX (0x00000003)
+ #define DDRCLKCH1_CR_DDRCRCLKCONTROLS_Spare_DEF (0x00000000)
+
+#define DDRCLKCH1_CR_DLLPITESTANDADC_REG (0x00001914)
+ #define DDRCLKCH1_CR_DLLPITESTANDADC_RunTest_OFF ( 0)
+ #define DDRCLKCH1_CR_DLLPITESTANDADC_RunTest_WID ( 1)
+ #define DDRCLKCH1_CR_DLLPITESTANDADC_RunTest_MSK (0x00000001)
+ #define DDRCLKCH1_CR_DLLPITESTANDADC_RunTest_MAX (0x00000001)
+ #define DDRCLKCH1_CR_DLLPITESTANDADC_RunTest_DEF (0x00000000)
+ #define DDRCLKCH1_CR_DLLPITESTANDADC_Load_OFF ( 1)
+ #define DDRCLKCH1_CR_DLLPITESTANDADC_Load_WID ( 1)
+ #define DDRCLKCH1_CR_DLLPITESTANDADC_Load_MSK (0x00000002)
+ #define DDRCLKCH1_CR_DLLPITESTANDADC_Load_MAX (0x00000001)
+ #define DDRCLKCH1_CR_DLLPITESTANDADC_Load_DEF (0x00000000)
+ #define DDRCLKCH1_CR_DLLPITESTANDADC_ModeHVM_OFF ( 2)
+ #define DDRCLKCH1_CR_DLLPITESTANDADC_ModeHVM_WID ( 1)
+ #define DDRCLKCH1_CR_DLLPITESTANDADC_ModeHVM_MSK (0x00000004)
+ #define DDRCLKCH1_CR_DLLPITESTANDADC_ModeHVM_MAX (0x00000001)
+ #define DDRCLKCH1_CR_DLLPITESTANDADC_ModeHVM_DEF (0x00000000)
+ #define DDRCLKCH1_CR_DLLPITESTANDADC_ModeDV_OFF ( 3)
+ #define DDRCLKCH1_CR_DLLPITESTANDADC_ModeDV_WID ( 1)
+ #define DDRCLKCH1_CR_DLLPITESTANDADC_ModeDV_MSK (0x00000008)
+ #define DDRCLKCH1_CR_DLLPITESTANDADC_ModeDV_MAX (0x00000001)
+ #define DDRCLKCH1_CR_DLLPITESTANDADC_ModeDV_DEF (0x00000000)
+ #define DDRCLKCH1_CR_DLLPITESTANDADC_ModeADC_OFF ( 4)
+ #define DDRCLKCH1_CR_DLLPITESTANDADC_ModeADC_WID ( 1)
+ #define DDRCLKCH1_CR_DLLPITESTANDADC_ModeADC_MSK (0x00000010)
+ #define DDRCLKCH1_CR_DLLPITESTANDADC_ModeADC_MAX (0x00000001)
+ #define DDRCLKCH1_CR_DLLPITESTANDADC_ModeADC_DEF (0x00000000)
+ #define DDRCLKCH1_CR_DLLPITESTANDADC_LoadCount_OFF ( 5)
+ #define DDRCLKCH1_CR_DLLPITESTANDADC_LoadCount_WID (10)
+ #define DDRCLKCH1_CR_DLLPITESTANDADC_LoadCount_MSK (0x00007FE0)
+ #define DDRCLKCH1_CR_DLLPITESTANDADC_LoadCount_MAX (0x000003FF)
+ #define DDRCLKCH1_CR_DLLPITESTANDADC_CountStatus_OFF (15)
+ #define DDRCLKCH1_CR_DLLPITESTANDADC_CountStatus_WID (10)
+ #define DDRCLKCH1_CR_DLLPITESTANDADC_CountStatus_MSK (0x01FF8000)
+ #define DDRCLKCH1_CR_DLLPITESTANDADC_CountStatus_MAX (0x000003FF)
+ #define DDRCLKCH1_CR_DLLPITESTANDADC_CountStatus_DEF (0x00000000)
+ #define DDRCLKCH1_CR_DLLPITESTANDADC_Spare_OFF (25)
+ #define DDRCLKCH1_CR_DLLPITESTANDADC_Spare_WID ( 7)
+ #define DDRCLKCH1_CR_DLLPITESTANDADC_Spare_MSK (0xFE000000)
+ #define DDRCLKCH1_CR_DLLPITESTANDADC_Spare_MAX (0x0000007F)
+
+#define DDRCLKCH1_CR_DDRCBSTATUS_REG (0x00001918)
+ #define DDRCLKCH1_CR_DDRCBSTATUS_DllCB_OFF ( 0)
+ #define DDRCLKCH1_CR_DDRCBSTATUS_DllCB_WID ( 2)
+ #define DDRCLKCH1_CR_DDRCBSTATUS_DllCB_MSK (0x00000003)
+ #define DDRCLKCH1_CR_DDRCBSTATUS_DllCB_MAX (0x00000003)
+ #define DDRCLKCH1_CR_DDRCBSTATUS_DllCB_DEF (0x00000000)
+ #define DDRCLKCH1_CR_DDRCBSTATUS_Spare_OFF ( 2)
+ #define DDRCLKCH1_CR_DDRCBSTATUS_Spare_WID (30)
+ #define DDRCLKCH1_CR_DDRCBSTATUS_Spare_MSK (0xFFFFFFFC)
+ #define DDRCLKCH1_CR_DDRCBSTATUS_Spare_MAX (0x3FFFFFFF)
+ #define DDRCLKCH1_CR_DDRCBSTATUS_Spare_DEF (0x00000000)
+
+#pragma pack(pop)
+#endif // __McIoClk_h__
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/McIoCmd.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/McIoCmd.h
new file mode 100644
index 0000000..79c6146
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/McIoCmd.h
@@ -0,0 +1,2002 @@
+/** @file
+ This file was automatically generated. Modify at your own risk.
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef __McIoCmd_h__
+#define __McIoCmd_h__
+
+#pragma pack(push, 1)
+#include "MrcTypes.h"
+
+typedef union {
+ struct {
+ U32 Scomp : 6; // Bits 5:0
+ U32 TcoComp : 6; // Bits 11:6
+ U32 RcompDrvUp : 6; // Bits 17:12
+ U32 RcompDrvDown : 6; // Bits 23:18
+ U32 LsComp : 3; // Bits 26:24
+ U32 Spare : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCMD_CR_DDRCRCMDCOMP_STRUCT;
+
+typedef union {
+ struct {
+ U32 ScompOffset : 5; // Bits 4:0
+ U32 TcoCompOffset : 4; // Bits 8:5
+ U32 RcompDrvUpOffset : 4; // Bits 12:9
+ U32 RcompDrvDownOffset : 4; // Bits 16:13
+ U32 Spare : 15; // Bits 31:17
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCMD_CR_DDRCRCMDCOMPOFFSET_STRUCT;
+
+typedef union {
+ struct {
+ U32 CmdPi0Code : 7; // Bits 6:0
+ U32 CmdPi1Code : 7; // Bits 13:7
+ U32 Spare : 18; // Bits 31:14
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCMD_CR_DDRCRCMDPICODING_STRUCT;
+
+typedef union {
+ struct {
+ U32 RefPi : 4; // Bits 3:0
+ U32 DllMask : 2; // Bits 5:4
+ U32 DllRsvd1 : 1; // Bits 6:6
+ U32 TxOn : 1; // Bits 7:7
+ U32 IntClkOn : 1; // Bits 8:8
+ U32 RepClkOn : 1; // Bits 9:9
+ U32 IOLBCtl : 2; // Bits 11:10
+ U32 OdtMode : 1; // Bits 12:12
+ U32 CmdTxEq : 2; // Bits 14:13
+ U32 EarlyWeakDrive : 2; // Bits 16:15
+ U32 Reserved : 4; // Bits 20:17
+ U32 RxVref : 6; // Bits 26:21
+ U32 VccddqHi : 1; // Bits 27:27
+ U32 DllWeakLock : 1; // Bits 28:28
+ U32 LPDDR_Mode : 1; // Bits 29:29
+ U32 LPDdrCAA_Dis : 1; // Bits 30:30
+ U32 LPDdrCAB_Dis : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCMD_CR_DDRCRCMDCONTROLS_STRUCT;
+
+typedef union {
+ struct {
+ U32 RunTest : 1; // Bits 0:0
+ U32 Load : 1; // Bits 1:1
+ U32 ModeHVM : 1; // Bits 2:2
+ U32 ModeDV : 1; // Bits 3:3
+ U32 ModeADC : 1; // Bits 4:4
+ U32 LoadCount : 10; // Bits 14:5
+ U32 CountStatus : 10; // Bits 24:15
+ U32 Spare : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCMD_CR_DLLPITESTANDADC_STRUCT;
+
+typedef union {
+ struct {
+ U32 Scomp : 6; // Bits 5:0
+ U32 TcoComp : 6; // Bits 11:6
+ U32 RcompDrvUp : 6; // Bits 17:12
+ U32 RcompDrvDown : 6; // Bits 23:18
+ U32 LsComp : 3; // Bits 26:24
+ U32 Spare : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCMDNCH0_CR_DDRCRCMDCOMP_STRUCT;
+
+typedef union {
+ struct {
+ U32 ScompOffset : 5; // Bits 4:0
+ U32 TcoCompOffset : 4; // Bits 8:5
+ U32 RcompDrvUpOffset : 4; // Bits 12:9
+ U32 RcompDrvDownOffset : 4; // Bits 16:13
+ U32 Spare : 15; // Bits 31:17
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCMDNCH0_CR_DDRCRCMDCOMPOFFSET_STRUCT;
+
+typedef union {
+ struct {
+ U32 CmdPi0Code : 7; // Bits 6:0
+ U32 CmdPi1Code : 7; // Bits 13:7
+ U32 Spare : 18; // Bits 31:14
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCMDNCH0_CR_DDRCRCMDPICODING_STRUCT;
+
+typedef union {
+ struct {
+ U32 RefPi : 4; // Bits 3:0
+ U32 DllMask : 2; // Bits 5:4
+ U32 DllRsvd1 : 1; // Bits 6:6
+ U32 TxOn : 1; // Bits 7:7
+ U32 IntClkOn : 1; // Bits 8:8
+ U32 RepClkOn : 1; // Bits 9:9
+ U32 IOLBCtl : 2; // Bits 11:10
+ U32 OdtMode : 1; // Bits 12:12
+ U32 CmdTxEq : 2; // Bits 14:13
+ U32 EarlyWeakDrive : 2; // Bits 16:15
+ U32 Reserved : 4; // Bits 20:17
+ U32 RxVref : 6; // Bits 26:21
+ U32 VccddqHi : 1; // Bits 27:27
+ U32 DllWeakLock : 1; // Bits 28:28
+ U32 LPDDR_Mode : 1; // Bits 29:29
+ U32 LPDdrCAA_Dis : 1; // Bits 30:30
+ U32 LPDdrCAB_Dis : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCMDNCH0_CR_DDRCRCMDCONTROLS_STRUCT;
+
+typedef union {
+ struct {
+ U32 RunTest : 1; // Bits 0:0
+ U32 Load : 1; // Bits 1:1
+ U32 ModeHVM : 1; // Bits 2:2
+ U32 ModeDV : 1; // Bits 3:3
+ U32 ModeADC : 1; // Bits 4:4
+ U32 LoadCount : 10; // Bits 14:5
+ U32 CountStatus : 10; // Bits 24:15
+ U32 Spare : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCMDNCH0_CR_DLLPITESTANDADC_STRUCT;
+
+typedef union {
+ struct {
+ U32 Scomp : 6; // Bits 5:0
+ U32 TcoComp : 6; // Bits 11:6
+ U32 RcompDrvUp : 6; // Bits 17:12
+ U32 RcompDrvDown : 6; // Bits 23:18
+ U32 LsComp : 3; // Bits 26:24
+ U32 Spare : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCMDNCH1_CR_DDRCRCMDCOMP_STRUCT;
+
+typedef union {
+ struct {
+ U32 ScompOffset : 5; // Bits 4:0
+ U32 TcoCompOffset : 4; // Bits 8:5
+ U32 RcompDrvUpOffset : 4; // Bits 12:9
+ U32 RcompDrvDownOffset : 4; // Bits 16:13
+ U32 Spare : 15; // Bits 31:17
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCMDNCH1_CR_DDRCRCMDCOMPOFFSET_STRUCT;
+
+typedef union {
+ struct {
+ U32 CmdPi0Code : 7; // Bits 6:0
+ U32 CmdPi1Code : 7; // Bits 13:7
+ U32 Spare : 18; // Bits 31:14
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCMDNCH1_CR_DDRCRCMDPICODING_STRUCT;
+
+typedef union {
+ struct {
+ U32 RefPi : 4; // Bits 3:0
+ U32 DllMask : 2; // Bits 5:4
+ U32 DllRsvd1 : 1; // Bits 6:6
+ U32 TxOn : 1; // Bits 7:7
+ U32 IntClkOn : 1; // Bits 8:8
+ U32 RepClkOn : 1; // Bits 9:9
+ U32 IOLBCtl : 2; // Bits 11:10
+ U32 OdtMode : 1; // Bits 12:12
+ U32 CmdTxEq : 2; // Bits 14:13
+ U32 EarlyWeakDrive : 2; // Bits 16:15
+ U32 Reserved : 4; // Bits 20:17
+ U32 RxVref : 6; // Bits 26:21
+ U32 VccddqHi : 1; // Bits 27:27
+ U32 DllWeakLock : 1; // Bits 28:28
+ U32 LPDDR_Mode : 1; // Bits 29:29
+ U32 LPDdrCAA_Dis : 1; // Bits 30:30
+ U32 LPDdrCAB_Dis : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCMDNCH1_CR_DDRCRCMDCONTROLS_STRUCT;
+
+typedef union {
+ struct {
+ U32 RunTest : 1; // Bits 0:0
+ U32 Load : 1; // Bits 1:1
+ U32 ModeHVM : 1; // Bits 2:2
+ U32 ModeDV : 1; // Bits 3:3
+ U32 ModeADC : 1; // Bits 4:4
+ U32 LoadCount : 10; // Bits 14:5
+ U32 CountStatus : 10; // Bits 24:15
+ U32 Spare : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCMDNCH1_CR_DLLPITESTANDADC_STRUCT;
+
+typedef union {
+ struct {
+ U32 Scomp : 6; // Bits 5:0
+ U32 TcoComp : 6; // Bits 11:6
+ U32 RcompDrvUp : 6; // Bits 17:12
+ U32 RcompDrvDown : 6; // Bits 23:18
+ U32 LsComp : 3; // Bits 26:24
+ U32 Spare : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCMDSCH0_CR_DDRCRCMDCOMP_STRUCT;
+
+typedef union {
+ struct {
+ U32 ScompOffset : 5; // Bits 4:0
+ U32 TcoCompOffset : 4; // Bits 8:5
+ U32 RcompDrvUpOffset : 4; // Bits 12:9
+ U32 RcompDrvDownOffset : 4; // Bits 16:13
+ U32 Spare : 15; // Bits 31:17
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCMDSCH0_CR_DDRCRCMDCOMPOFFSET_STRUCT;
+
+typedef union {
+ struct {
+ U32 CmdPi0Code : 7; // Bits 6:0
+ U32 CmdPi1Code : 7; // Bits 13:7
+ U32 Spare : 18; // Bits 31:14
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCMDSCH0_CR_DDRCRCMDPICODING_STRUCT;
+
+typedef union {
+ struct {
+ U32 RefPi : 4; // Bits 3:0
+ U32 DllMask : 2; // Bits 5:4
+ U32 DllRsvd1 : 1; // Bits 6:6
+ U32 TxOn : 1; // Bits 7:7
+ U32 IntClkOn : 1; // Bits 8:8
+ U32 RepClkOn : 1; // Bits 9:9
+ U32 IOLBCtl : 2; // Bits 11:10
+ U32 OdtMode : 1; // Bits 12:12
+ U32 CmdTxEq : 2; // Bits 14:13
+ U32 EarlyWeakDrive : 2; // Bits 16:15
+ U32 Reserved : 4; // Bits 20:17
+ U32 RxVref : 6; // Bits 26:21
+ U32 VccddqHi : 1; // Bits 27:27
+ U32 DllWeakLock : 1; // Bits 28:28
+ U32 LPDDR_Mode : 1; // Bits 29:29
+ U32 LPDdrCAA_Dis : 1; // Bits 30:30
+ U32 LPDdrCAB_Dis : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCMDSCH0_CR_DDRCRCMDCONTROLS_STRUCT;
+
+typedef union {
+ struct {
+ U32 RunTest : 1; // Bits 0:0
+ U32 Load : 1; // Bits 1:1
+ U32 ModeHVM : 1; // Bits 2:2
+ U32 ModeDV : 1; // Bits 3:3
+ U32 ModeADC : 1; // Bits 4:4
+ U32 LoadCount : 10; // Bits 14:5
+ U32 CountStatus : 10; // Bits 24:15
+ U32 Spare : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCMDSCH0_CR_DLLPITESTANDADC_STRUCT;
+
+typedef union {
+ struct {
+ U32 Scomp : 6; // Bits 5:0
+ U32 TcoComp : 6; // Bits 11:6
+ U32 RcompDrvUp : 6; // Bits 17:12
+ U32 RcompDrvDown : 6; // Bits 23:18
+ U32 LsComp : 3; // Bits 26:24
+ U32 Spare : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCMDSCH1_CR_DDRCRCMDCOMP_STRUCT;
+
+typedef union {
+ struct {
+ U32 ScompOffset : 5; // Bits 4:0
+ U32 TcoCompOffset : 4; // Bits 8:5
+ U32 RcompDrvUpOffset : 4; // Bits 12:9
+ U32 RcompDrvDownOffset : 4; // Bits 16:13
+ U32 Spare : 15; // Bits 31:17
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCMDSCH1_CR_DDRCRCMDCOMPOFFSET_STRUCT;
+
+typedef union {
+ struct {
+ U32 CmdPi0Code : 7; // Bits 6:0
+ U32 CmdPi1Code : 7; // Bits 13:7
+ U32 Spare : 18; // Bits 31:14
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCMDSCH1_CR_DDRCRCMDPICODING_STRUCT;
+
+typedef union {
+ struct {
+ U32 RefPi : 4; // Bits 3:0
+ U32 DllMask : 2; // Bits 5:4
+ U32 DllRsvd1 : 1; // Bits 6:6
+ U32 TxOn : 1; // Bits 7:7
+ U32 IntClkOn : 1; // Bits 8:8
+ U32 RepClkOn : 1; // Bits 9:9
+ U32 IOLBCtl : 2; // Bits 11:10
+ U32 OdtMode : 1; // Bits 12:12
+ U32 CmdTxEq : 2; // Bits 14:13
+ U32 EarlyWeakDrive : 2; // Bits 16:15
+ U32 Reserved : 4; // Bits 20:17
+ U32 RxVref : 6; // Bits 26:21
+ U32 VccddqHi : 1; // Bits 27:27
+ U32 DllWeakLock : 1; // Bits 28:28
+ U32 LPDDR_Mode : 1; // Bits 29:29
+ U32 LPDdrCAA_Dis : 1; // Bits 30:30
+ U32 LPDdrCAB_Dis : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCMDSCH1_CR_DDRCRCMDCONTROLS_STRUCT;
+
+typedef union {
+ struct {
+ U32 RunTest : 1; // Bits 0:0
+ U32 Load : 1; // Bits 1:1
+ U32 ModeHVM : 1; // Bits 2:2
+ U32 ModeDV : 1; // Bits 3:3
+ U32 ModeADC : 1; // Bits 4:4
+ U32 LoadCount : 10; // Bits 14:5
+ U32 CountStatus : 10; // Bits 24:15
+ U32 Spare : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCMDSCH1_CR_DLLPITESTANDADC_STRUCT;
+
+typedef union {
+ struct {
+ U32 Scomp : 6; // Bits 5:0
+ U32 TcoComp : 6; // Bits 11:6
+ U32 RcompDrvUp : 6; // Bits 17:12
+ U32 RcompDrvDown : 6; // Bits 23:18
+ U32 LsComp : 3; // Bits 26:24
+ U32 Spare : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCMDCH0_CR_DDRCRCMDCOMP_STRUCT;
+
+typedef union {
+ struct {
+ U32 ScompOffset : 5; // Bits 4:0
+ U32 TcoCompOffset : 4; // Bits 8:5
+ U32 RcompDrvUpOffset : 4; // Bits 12:9
+ U32 RcompDrvDownOffset : 4; // Bits 16:13
+ U32 Spare : 15; // Bits 31:17
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCMDCH0_CR_DDRCRCMDCOMPOFFSET_STRUCT;
+
+typedef union {
+ struct {
+ U32 CmdPi0Code : 7; // Bits 6:0
+ U32 CmdPi1Code : 7; // Bits 13:7
+ U32 Spare : 18; // Bits 31:14
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCMDCH0_CR_DDRCRCMDPICODING_STRUCT;
+
+typedef union {
+ struct {
+ U32 RefPi : 4; // Bits 3:0
+ U32 DllMask : 2; // Bits 5:4
+ U32 DllRsvd1 : 1; // Bits 6:6
+ U32 TxOn : 1; // Bits 7:7
+ U32 IntClkOn : 1; // Bits 8:8
+ U32 RepClkOn : 1; // Bits 9:9
+ U32 IOLBCtl : 2; // Bits 11:10
+ U32 OdtMode : 1; // Bits 12:12
+ U32 CmdTxEq : 2; // Bits 14:13
+ U32 EarlyWeakDrive : 2; // Bits 16:15
+ U32 Reserved : 4; // Bits 20:17
+ U32 RxVref : 6; // Bits 26:21
+ U32 VccddqHi : 1; // Bits 27:27
+ U32 DllWeakLock : 1; // Bits 28:28
+ U32 LPDDR_Mode : 1; // Bits 29:29
+ U32 LPDdrCAA_Dis : 1; // Bits 30:30
+ U32 LPDdrCAB_Dis : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCMDCH0_CR_DDRCRCMDCONTROLS_STRUCT;
+
+typedef union {
+ struct {
+ U32 RunTest : 1; // Bits 0:0
+ U32 Load : 1; // Bits 1:1
+ U32 ModeHVM : 1; // Bits 2:2
+ U32 ModeDV : 1; // Bits 3:3
+ U32 ModeADC : 1; // Bits 4:4
+ U32 LoadCount : 10; // Bits 14:5
+ U32 CountStatus : 10; // Bits 24:15
+ U32 Spare : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCMDCH0_CR_DLLPITESTANDADC_STRUCT;
+
+typedef union {
+ struct {
+ U32 Scomp : 6; // Bits 5:0
+ U32 TcoComp : 6; // Bits 11:6
+ U32 RcompDrvUp : 6; // Bits 17:12
+ U32 RcompDrvDown : 6; // Bits 23:18
+ U32 LsComp : 3; // Bits 26:24
+ U32 Spare : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCMDCH1_CR_DDRCRCMDCOMP_STRUCT;
+
+typedef union {
+ struct {
+ U32 ScompOffset : 5; // Bits 4:0
+ U32 TcoCompOffset : 4; // Bits 8:5
+ U32 RcompDrvUpOffset : 4; // Bits 12:9
+ U32 RcompDrvDownOffset : 4; // Bits 16:13
+ U32 Spare : 15; // Bits 31:17
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCMDCH1_CR_DDRCRCMDCOMPOFFSET_STRUCT;
+
+typedef union {
+ struct {
+ U32 CmdPi0Code : 7; // Bits 6:0
+ U32 CmdPi1Code : 7; // Bits 13:7
+ U32 Spare : 18; // Bits 31:14
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCMDCH1_CR_DDRCRCMDPICODING_STRUCT;
+
+typedef union {
+ struct {
+ U32 RefPi : 4; // Bits 3:0
+ U32 DllMask : 2; // Bits 5:4
+ U32 DllRsvd1 : 1; // Bits 6:6
+ U32 TxOn : 1; // Bits 7:7
+ U32 IntClkOn : 1; // Bits 8:8
+ U32 RepClkOn : 1; // Bits 9:9
+ U32 IOLBCtl : 2; // Bits 11:10
+ U32 OdtMode : 1; // Bits 12:12
+ U32 CmdTxEq : 2; // Bits 14:13
+ U32 EarlyWeakDrive : 2; // Bits 16:15
+ U32 Reserved : 4; // Bits 20:17
+ U32 RxVref : 6; // Bits 26:21
+ U32 VccddqHi : 1; // Bits 27:27
+ U32 DllWeakLock : 1; // Bits 28:28
+ U32 LPDDR_Mode : 1; // Bits 29:29
+ U32 LPDdrCAA_Dis : 1; // Bits 30:30
+ U32 LPDdrCAB_Dis : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCMDCH1_CR_DDRCRCMDCONTROLS_STRUCT;
+
+typedef union {
+ struct {
+ U32 RunTest : 1; // Bits 0:0
+ U32 Load : 1; // Bits 1:1
+ U32 ModeHVM : 1; // Bits 2:2
+ U32 ModeDV : 1; // Bits 3:3
+ U32 ModeADC : 1; // Bits 4:4
+ U32 LoadCount : 10; // Bits 14:5
+ U32 CountStatus : 10; // Bits 24:15
+ U32 Spare : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCMDCH1_CR_DLLPITESTANDADC_STRUCT;
+
+#define DDRCMD_CR_DDRCRCMDCOMP_REG (0x00003700)
+ #define DDRCMD_CR_DDRCRCMDCOMP_Scomp_OFF ( 0)
+ #define DDRCMD_CR_DDRCRCMDCOMP_Scomp_WID ( 6)
+ #define DDRCMD_CR_DDRCRCMDCOMP_Scomp_MSK (0x0000003F)
+ #define DDRCMD_CR_DDRCRCMDCOMP_Scomp_MAX (0x0000003F)
+ #define DDRCMD_CR_DDRCRCMDCOMP_Scomp_DEF (0x00000000)
+ #define DDRCMD_CR_DDRCRCMDCOMP_TcoComp_OFF ( 6)
+ #define DDRCMD_CR_DDRCRCMDCOMP_TcoComp_WID ( 6)
+ #define DDRCMD_CR_DDRCRCMDCOMP_TcoComp_MSK (0x00000FC0)
+ #define DDRCMD_CR_DDRCRCMDCOMP_TcoComp_MAX (0x0000003F)
+ #define DDRCMD_CR_DDRCRCMDCOMP_TcoComp_DEF (0x00000000)
+ #define DDRCMD_CR_DDRCRCMDCOMP_RcompDrvUp_OFF (12)
+ #define DDRCMD_CR_DDRCRCMDCOMP_RcompDrvUp_WID ( 6)
+ #define DDRCMD_CR_DDRCRCMDCOMP_RcompDrvUp_MSK (0x0003F000)
+ #define DDRCMD_CR_DDRCRCMDCOMP_RcompDrvUp_MAX (0x0000003F)
+ #define DDRCMD_CR_DDRCRCMDCOMP_RcompDrvUp_DEF (0x00000000)
+ #define DDRCMD_CR_DDRCRCMDCOMP_RcompDrvDown_OFF (18)
+ #define DDRCMD_CR_DDRCRCMDCOMP_RcompDrvDown_WID ( 6)
+ #define DDRCMD_CR_DDRCRCMDCOMP_RcompDrvDown_MSK (0x00FC0000)
+ #define DDRCMD_CR_DDRCRCMDCOMP_RcompDrvDown_MAX (0x0000003F)
+ #define DDRCMD_CR_DDRCRCMDCOMP_RcompDrvDown_DEF (0x00000000)
+ #define DDRCMD_CR_DDRCRCMDCOMP_LsComp_OFF (24)
+ #define DDRCMD_CR_DDRCRCMDCOMP_LsComp_WID ( 3)
+ #define DDRCMD_CR_DDRCRCMDCOMP_LsComp_MSK (0x07000000)
+ #define DDRCMD_CR_DDRCRCMDCOMP_LsComp_MAX (0x00000007)
+ #define DDRCMD_CR_DDRCRCMDCOMP_LsComp_DEF (0x00000004)
+ #define DDRCMD_CR_DDRCRCMDCOMP_Spare_OFF (27)
+ #define DDRCMD_CR_DDRCRCMDCOMP_Spare_WID ( 5)
+ #define DDRCMD_CR_DDRCRCMDCOMP_Spare_MSK (0xF8000000)
+ #define DDRCMD_CR_DDRCRCMDCOMP_Spare_MAX (0x0000001F)
+ #define DDRCMD_CR_DDRCRCMDCOMP_Spare_DEF (0x00000000)
+
+#define DDRCMD_CR_DDRCRCMDCOMPOFFSET_REG (0x00003704)
+ #define DDRCMD_CR_DDRCRCMDCOMPOFFSET_ScompOffset_OFF ( 0)
+ #define DDRCMD_CR_DDRCRCMDCOMPOFFSET_ScompOffset_WID ( 5)
+ #define DDRCMD_CR_DDRCRCMDCOMPOFFSET_ScompOffset_MSK (0x0000001F)
+ #define DDRCMD_CR_DDRCRCMDCOMPOFFSET_ScompOffset_MAX (0x0000001F)
+ #define DDRCMD_CR_DDRCRCMDCOMPOFFSET_ScompOffset_DEF (0x00000000)
+ #define DDRCMD_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_OFF ( 5)
+ #define DDRCMD_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_WID ( 4)
+ #define DDRCMD_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_MSK (0x000001E0)
+ #define DDRCMD_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_MAX (0x0000000F)
+ #define DDRCMD_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_DEF (0x00000000)
+ #define DDRCMD_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_OFF ( 9)
+ #define DDRCMD_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_WID ( 4)
+ #define DDRCMD_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_MSK (0x00001E00)
+ #define DDRCMD_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_MAX (0x0000000F)
+ #define DDRCMD_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_DEF (0x00000000)
+ #define DDRCMD_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_OFF (13)
+ #define DDRCMD_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_WID ( 4)
+ #define DDRCMD_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_MSK (0x0001E000)
+ #define DDRCMD_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_MAX (0x0000000F)
+ #define DDRCMD_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_DEF (0x00000000)
+ #define DDRCMD_CR_DDRCRCMDCOMPOFFSET_Spare_OFF (17)
+ #define DDRCMD_CR_DDRCRCMDCOMPOFFSET_Spare_WID (15)
+ #define DDRCMD_CR_DDRCRCMDCOMPOFFSET_Spare_MSK (0xFFFE0000)
+ #define DDRCMD_CR_DDRCRCMDCOMPOFFSET_Spare_MAX (0x00007FFF)
+ #define DDRCMD_CR_DDRCRCMDCOMPOFFSET_Spare_DEF (0x00000000)
+
+#define DDRCMD_CR_DDRCRCMDPICODING_REG (0x00003708)
+ #define DDRCMD_CR_DDRCRCMDPICODING_CmdPi0Code_OFF ( 0)
+ #define DDRCMD_CR_DDRCRCMDPICODING_CmdPi0Code_WID ( 7)
+ #define DDRCMD_CR_DDRCRCMDPICODING_CmdPi0Code_MSK (0x0000007F)
+ #define DDRCMD_CR_DDRCRCMDPICODING_CmdPi0Code_MAX (0x0000007F)
+ #define DDRCMD_CR_DDRCRCMDPICODING_CmdPi0Code_DEF (0x00000000)
+ #define DDRCMD_CR_DDRCRCMDPICODING_CmdPi1Code_OFF ( 7)
+ #define DDRCMD_CR_DDRCRCMDPICODING_CmdPi1Code_WID ( 7)
+ #define DDRCMD_CR_DDRCRCMDPICODING_CmdPi1Code_MSK (0x00003F80)
+ #define DDRCMD_CR_DDRCRCMDPICODING_CmdPi1Code_MAX (0x0000007F)
+ #define DDRCMD_CR_DDRCRCMDPICODING_CmdPi1Code_DEF (0x00000000)
+ #define DDRCMD_CR_DDRCRCMDPICODING_Spare_OFF (14)
+ #define DDRCMD_CR_DDRCRCMDPICODING_Spare_WID (18)
+ #define DDRCMD_CR_DDRCRCMDPICODING_Spare_MSK (0xFFFFC000)
+ #define DDRCMD_CR_DDRCRCMDPICODING_Spare_MAX (0x0003FFFF)
+ #define DDRCMD_CR_DDRCRCMDPICODING_Spare_DEF (0x00000000)
+
+#define DDRCMD_CR_DDRCRCMDCONTROLS_REG (0x0000370C)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_RefPi_OFF ( 0)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_RefPi_WID ( 4)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_RefPi_MSK (0x0000000F)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_RefPi_MAX (0x0000000F)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_RefPi_DEF (0x00000000)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_DllMask_OFF ( 4)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_DllMask_WID ( 2)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_DllMask_MSK (0x00000030)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_DllMask_MAX (0x00000003)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_DllMask_DEF (0x00000000)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_DllRsvd1_OFF ( 6)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_DllRsvd1_WID ( 1)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_DllRsvd1_MSK (0x00000040)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_DllRsvd1_MAX (0x00000001)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_DllRsvd1_DEF (0x00000000)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_TxOn_OFF ( 7)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_TxOn_WID ( 1)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_TxOn_MSK (0x00000080)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_TxOn_MAX (0x00000001)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_TxOn_DEF (0x00000000)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_IntClkOn_OFF ( 8)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_IntClkOn_WID ( 1)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_IntClkOn_MSK (0x00000100)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_IntClkOn_MAX (0x00000001)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_IntClkOn_DEF (0x00000000)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_RepClkOn_OFF ( 9)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_RepClkOn_WID ( 1)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_RepClkOn_MSK (0x00000200)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_RepClkOn_MAX (0x00000001)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_RepClkOn_DEF (0x00000000)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_IOLBCtl_OFF (10)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_IOLBCtl_WID ( 2)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_IOLBCtl_MSK (0x00000C00)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_IOLBCtl_MAX (0x00000003)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_IOLBCtl_DEF (0x00000000)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_OdtMode_OFF (12)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_OdtMode_WID ( 1)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_OdtMode_MSK (0x00001000)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_OdtMode_MAX (0x00000001)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_OdtMode_DEF (0x00000000)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_CmdTxEq_OFF (13)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_CmdTxEq_WID ( 2)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_CmdTxEq_MSK (0x00006000)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_CmdTxEq_MAX (0x00000003)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_CmdTxEq_DEF (0x00000000)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_EarlyWeakDrive_OFF (15)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_EarlyWeakDrive_WID ( 2)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_EarlyWeakDrive_MSK (0x00018000)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_EarlyWeakDrive_MAX (0x00000003)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_EarlyWeakDrive_DEF (0x00000000)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_Reserved_OFF (17)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_Reserved_WID ( 4)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_Reserved_MSK (0x001E0000)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_Reserved_MAX (0x0000000F)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_Reserved_DEF (0x00000000)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_RxVref_OFF (21)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_RxVref_WID ( 6)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_RxVref_MSK (0x07E00000)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_RxVref_MAX (0x0000003F)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_RxVref_DEF (0x00000000)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_VccddqHi_OFF (27)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_VccddqHi_WID ( 1)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_VccddqHi_MSK (0x08000000)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_VccddqHi_MAX (0x00000001)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_VccddqHi_DEF (0x00000000)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_DllWeakLock_OFF (28)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_DllWeakLock_WID ( 1)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_DllWeakLock_MSK (0x10000000)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_DllWeakLock_MAX (0x00000001)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_DllWeakLock_DEF (0x00000000)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_LPDDR_Mode_OFF (29)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_LPDDR_Mode_WID ( 1)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_LPDDR_Mode_MSK (0x20000000)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_LPDDR_Mode_MAX (0x00000001)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_LPDDR_Mode_DEF (0x00000000)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_LPDdrCAA_Dis_OFF (30)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_LPDdrCAA_Dis_WID ( 1)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_LPDdrCAA_Dis_MSK (0x40000000)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_LPDdrCAA_Dis_MAX (0x00000001)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_LPDdrCAA_Dis_DEF (0x00000000)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_LPDdrCAB_Dis_OFF (31)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_LPDdrCAB_Dis_WID ( 1)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_LPDdrCAB_Dis_MSK (0x80000000)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_LPDdrCAB_Dis_MAX (0x00000001)
+ #define DDRCMD_CR_DDRCRCMDCONTROLS_LPDdrCAB_Dis_DEF (0x00000000)
+
+#define DDRCMD_CR_DLLPITESTANDADC_REG (0x00003724)
+ #define DDRCMD_CR_DLLPITESTANDADC_RunTest_OFF ( 0)
+ #define DDRCMD_CR_DLLPITESTANDADC_RunTest_WID ( 1)
+ #define DDRCMD_CR_DLLPITESTANDADC_RunTest_MSK (0x00000001)
+ #define DDRCMD_CR_DLLPITESTANDADC_RunTest_MAX (0x00000001)
+ #define DDRCMD_CR_DLLPITESTANDADC_RunTest_DEF (0x00000000)
+ #define DDRCMD_CR_DLLPITESTANDADC_Load_OFF ( 1)
+ #define DDRCMD_CR_DLLPITESTANDADC_Load_WID ( 1)
+ #define DDRCMD_CR_DLLPITESTANDADC_Load_MSK (0x00000002)
+ #define DDRCMD_CR_DLLPITESTANDADC_Load_MAX (0x00000001)
+ #define DDRCMD_CR_DLLPITESTANDADC_Load_DEF (0x00000000)
+ #define DDRCMD_CR_DLLPITESTANDADC_ModeHVM_OFF ( 2)
+ #define DDRCMD_CR_DLLPITESTANDADC_ModeHVM_WID ( 1)
+ #define DDRCMD_CR_DLLPITESTANDADC_ModeHVM_MSK (0x00000004)
+ #define DDRCMD_CR_DLLPITESTANDADC_ModeHVM_MAX (0x00000001)
+ #define DDRCMD_CR_DLLPITESTANDADC_ModeHVM_DEF (0x00000000)
+ #define DDRCMD_CR_DLLPITESTANDADC_ModeDV_OFF ( 3)
+ #define DDRCMD_CR_DLLPITESTANDADC_ModeDV_WID ( 1)
+ #define DDRCMD_CR_DLLPITESTANDADC_ModeDV_MSK (0x00000008)
+ #define DDRCMD_CR_DLLPITESTANDADC_ModeDV_MAX (0x00000001)
+ #define DDRCMD_CR_DLLPITESTANDADC_ModeDV_DEF (0x00000000)
+ #define DDRCMD_CR_DLLPITESTANDADC_ModeADC_OFF ( 4)
+ #define DDRCMD_CR_DLLPITESTANDADC_ModeADC_WID ( 1)
+ #define DDRCMD_CR_DLLPITESTANDADC_ModeADC_MSK (0x00000010)
+ #define DDRCMD_CR_DLLPITESTANDADC_ModeADC_MAX (0x00000001)
+ #define DDRCMD_CR_DLLPITESTANDADC_ModeADC_DEF (0x00000000)
+ #define DDRCMD_CR_DLLPITESTANDADC_LoadCount_OFF ( 5)
+ #define DDRCMD_CR_DLLPITESTANDADC_LoadCount_WID (10)
+ #define DDRCMD_CR_DLLPITESTANDADC_LoadCount_MSK (0x00007FE0)
+ #define DDRCMD_CR_DLLPITESTANDADC_LoadCount_MAX (0x000003FF)
+ #define DDRCMD_CR_DLLPITESTANDADC_CountStatus_OFF (15)
+ #define DDRCMD_CR_DLLPITESTANDADC_CountStatus_WID (10)
+ #define DDRCMD_CR_DLLPITESTANDADC_CountStatus_MSK (0x01FF8000)
+ #define DDRCMD_CR_DLLPITESTANDADC_CountStatus_MAX (0x000003FF)
+ #define DDRCMD_CR_DLLPITESTANDADC_CountStatus_DEF (0x00000000)
+ #define DDRCMD_CR_DLLPITESTANDADC_Spare_OFF (25)
+ #define DDRCMD_CR_DLLPITESTANDADC_Spare_WID ( 7)
+ #define DDRCMD_CR_DLLPITESTANDADC_Spare_MSK (0xFE000000)
+ #define DDRCMD_CR_DLLPITESTANDADC_Spare_MAX (0x0000007F)
+
+#define DDRCMDNCH0_CR_DDRCRCMDCOMP_REG (0x00001400)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMP_Scomp_OFF ( 0)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMP_Scomp_WID ( 6)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMP_Scomp_MSK (0x0000003F)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMP_Scomp_MAX (0x0000003F)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMP_Scomp_DEF (0x00000000)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMP_TcoComp_OFF ( 6)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMP_TcoComp_WID ( 6)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMP_TcoComp_MSK (0x00000FC0)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMP_TcoComp_MAX (0x0000003F)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMP_TcoComp_DEF (0x00000000)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMP_RcompDrvUp_OFF (12)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMP_RcompDrvUp_WID ( 6)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMP_RcompDrvUp_MSK (0x0003F000)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMP_RcompDrvUp_MAX (0x0000003F)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMP_RcompDrvUp_DEF (0x00000000)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMP_RcompDrvDown_OFF (18)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMP_RcompDrvDown_WID ( 6)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMP_RcompDrvDown_MSK (0x00FC0000)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMP_RcompDrvDown_MAX (0x0000003F)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMP_RcompDrvDown_DEF (0x00000000)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMP_LsComp_OFF (24)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMP_LsComp_WID ( 3)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMP_LsComp_MSK (0x07000000)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMP_LsComp_MAX (0x00000007)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMP_LsComp_DEF (0x00000004)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMP_Spare_OFF (27)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMP_Spare_WID ( 5)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMP_Spare_MSK (0xF8000000)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMP_Spare_MAX (0x0000001F)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMP_Spare_DEF (0x00000000)
+
+#define DDRCMDNCH0_CR_DDRCRCMDCOMPOFFSET_REG (0x00001404)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMPOFFSET_ScompOffset_OFF ( 0)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMPOFFSET_ScompOffset_WID ( 5)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMPOFFSET_ScompOffset_MSK (0x0000001F)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMPOFFSET_ScompOffset_MAX (0x0000001F)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMPOFFSET_ScompOffset_DEF (0x00000000)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_OFF ( 5)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_WID ( 4)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_MSK (0x000001E0)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_MAX (0x0000000F)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_DEF (0x00000000)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_OFF ( 9)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_WID ( 4)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_MSK (0x00001E00)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_MAX (0x0000000F)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_DEF (0x00000000)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_OFF (13)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_WID ( 4)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_MSK (0x0001E000)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_MAX (0x0000000F)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_DEF (0x00000000)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMPOFFSET_Spare_OFF (17)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMPOFFSET_Spare_WID (15)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMPOFFSET_Spare_MSK (0xFFFE0000)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMPOFFSET_Spare_MAX (0x00007FFF)
+ #define DDRCMDNCH0_CR_DDRCRCMDCOMPOFFSET_Spare_DEF (0x00000000)
+
+#define DDRCMDNCH0_CR_DDRCRCMDPICODING_REG (0x00001408)
+ #define DDRCMDNCH0_CR_DDRCRCMDPICODING_CmdPi0Code_OFF ( 0)
+ #define DDRCMDNCH0_CR_DDRCRCMDPICODING_CmdPi0Code_WID ( 7)
+ #define DDRCMDNCH0_CR_DDRCRCMDPICODING_CmdPi0Code_MSK (0x0000007F)
+ #define DDRCMDNCH0_CR_DDRCRCMDPICODING_CmdPi0Code_MAX (0x0000007F)
+ #define DDRCMDNCH0_CR_DDRCRCMDPICODING_CmdPi0Code_DEF (0x00000000)
+ #define DDRCMDNCH0_CR_DDRCRCMDPICODING_CmdPi1Code_OFF ( 7)
+ #define DDRCMDNCH0_CR_DDRCRCMDPICODING_CmdPi1Code_WID ( 7)
+ #define DDRCMDNCH0_CR_DDRCRCMDPICODING_CmdPi1Code_MSK (0x00003F80)
+ #define DDRCMDNCH0_CR_DDRCRCMDPICODING_CmdPi1Code_MAX (0x0000007F)
+ #define DDRCMDNCH0_CR_DDRCRCMDPICODING_CmdPi1Code_DEF (0x00000000)
+ #define DDRCMDNCH0_CR_DDRCRCMDPICODING_Spare_OFF (14)
+ #define DDRCMDNCH0_CR_DDRCRCMDPICODING_Spare_WID (18)
+ #define DDRCMDNCH0_CR_DDRCRCMDPICODING_Spare_MSK (0xFFFFC000)
+ #define DDRCMDNCH0_CR_DDRCRCMDPICODING_Spare_MAX (0x0003FFFF)
+ #define DDRCMDNCH0_CR_DDRCRCMDPICODING_Spare_DEF (0x00000000)
+
+#define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_REG (0x0000140C)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_RefPi_OFF ( 0)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_RefPi_WID ( 4)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_RefPi_MSK (0x0000000F)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_RefPi_MAX (0x0000000F)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_RefPi_DEF (0x00000000)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_DllMask_OFF ( 4)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_DllMask_WID ( 2)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_DllMask_MSK (0x00000030)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_DllMask_MAX (0x00000003)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_DllMask_DEF (0x00000000)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_DllRsvd1_OFF ( 6)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_DllRsvd1_WID ( 1)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_DllRsvd1_MSK (0x00000040)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_DllRsvd1_MAX (0x00000001)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_DllRsvd1_DEF (0x00000000)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_TxOn_OFF ( 7)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_TxOn_WID ( 1)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_TxOn_MSK (0x00000080)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_TxOn_MAX (0x00000001)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_TxOn_DEF (0x00000000)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_IntClkOn_OFF ( 8)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_IntClkOn_WID ( 1)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_IntClkOn_MSK (0x00000100)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_IntClkOn_MAX (0x00000001)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_IntClkOn_DEF (0x00000000)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_RepClkOn_OFF ( 9)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_RepClkOn_WID ( 1)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_RepClkOn_MSK (0x00000200)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_RepClkOn_MAX (0x00000001)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_RepClkOn_DEF (0x00000000)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_IOLBCtl_OFF (10)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_IOLBCtl_WID ( 2)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_IOLBCtl_MSK (0x00000C00)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_IOLBCtl_MAX (0x00000003)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_IOLBCtl_DEF (0x00000000)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_OdtMode_OFF (12)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_OdtMode_WID ( 1)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_OdtMode_MSK (0x00001000)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_OdtMode_MAX (0x00000001)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_OdtMode_DEF (0x00000000)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_CmdTxEq_OFF (13)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_CmdTxEq_WID ( 2)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_CmdTxEq_MSK (0x00006000)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_CmdTxEq_MAX (0x00000003)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_CmdTxEq_DEF (0x00000000)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_EarlyWeakDrive_OFF (15)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_EarlyWeakDrive_WID ( 2)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_EarlyWeakDrive_MSK (0x00018000)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_EarlyWeakDrive_MAX (0x00000003)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_EarlyWeakDrive_DEF (0x00000000)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_Reserved_OFF (17)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_Reserved_WID ( 4)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_Reserved_MSK (0x001E0000)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_Reserved_MAX (0x0000000F)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_Reserved_DEF (0x00000000)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_RxVref_OFF (21)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_RxVref_WID ( 6)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_RxVref_MSK (0x07E00000)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_RxVref_MAX (0x0000003F)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_RxVref_DEF (0x00000000)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_VccddqHi_OFF (27)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_VccddqHi_WID ( 1)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_VccddqHi_MSK (0x08000000)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_VccddqHi_MAX (0x00000001)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_VccddqHi_DEF (0x00000000)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_DllWeakLock_OFF (28)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_DllWeakLock_WID ( 1)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_DllWeakLock_MSK (0x10000000)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_DllWeakLock_MAX (0x00000001)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_DllWeakLock_DEF (0x00000000)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_LPDDR_Mode_OFF (29)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_LPDDR_Mode_WID ( 1)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_LPDDR_Mode_MSK (0x20000000)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_LPDDR_Mode_MAX (0x00000001)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_LPDDR_Mode_DEF (0x00000000)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_LPDdrCAA_Dis_OFF (30)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_LPDdrCAA_Dis_WID ( 1)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_LPDdrCAA_Dis_MSK (0x40000000)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_LPDdrCAA_Dis_MAX (0x00000001)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_LPDdrCAA_Dis_DEF (0x00000000)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_LPDdrCAB_Dis_OFF (31)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_LPDdrCAB_Dis_WID ( 1)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_LPDdrCAB_Dis_MSK (0x80000000)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_LPDdrCAB_Dis_MAX (0x00000001)
+ #define DDRCMDNCH0_CR_DDRCRCMDCONTROLS_LPDdrCAB_Dis_DEF (0x00000000)
+
+#define DDRCMDNCH0_CR_DLLPITESTANDADC_REG (0x00001424)
+ #define DDRCMDNCH0_CR_DLLPITESTANDADC_RunTest_OFF ( 0)
+ #define DDRCMDNCH0_CR_DLLPITESTANDADC_RunTest_WID ( 1)
+ #define DDRCMDNCH0_CR_DLLPITESTANDADC_RunTest_MSK (0x00000001)
+ #define DDRCMDNCH0_CR_DLLPITESTANDADC_RunTest_MAX (0x00000001)
+ #define DDRCMDNCH0_CR_DLLPITESTANDADC_RunTest_DEF (0x00000000)
+ #define DDRCMDNCH0_CR_DLLPITESTANDADC_Load_OFF ( 1)
+ #define DDRCMDNCH0_CR_DLLPITESTANDADC_Load_WID ( 1)
+ #define DDRCMDNCH0_CR_DLLPITESTANDADC_Load_MSK (0x00000002)
+ #define DDRCMDNCH0_CR_DLLPITESTANDADC_Load_MAX (0x00000001)
+ #define DDRCMDNCH0_CR_DLLPITESTANDADC_Load_DEF (0x00000000)
+ #define DDRCMDNCH0_CR_DLLPITESTANDADC_ModeHVM_OFF ( 2)
+ #define DDRCMDNCH0_CR_DLLPITESTANDADC_ModeHVM_WID ( 1)
+ #define DDRCMDNCH0_CR_DLLPITESTANDADC_ModeHVM_MSK (0x00000004)
+ #define DDRCMDNCH0_CR_DLLPITESTANDADC_ModeHVM_MAX (0x00000001)
+ #define DDRCMDNCH0_CR_DLLPITESTANDADC_ModeHVM_DEF (0x00000000)
+ #define DDRCMDNCH0_CR_DLLPITESTANDADC_ModeDV_OFF ( 3)
+ #define DDRCMDNCH0_CR_DLLPITESTANDADC_ModeDV_WID ( 1)
+ #define DDRCMDNCH0_CR_DLLPITESTANDADC_ModeDV_MSK (0x00000008)
+ #define DDRCMDNCH0_CR_DLLPITESTANDADC_ModeDV_MAX (0x00000001)
+ #define DDRCMDNCH0_CR_DLLPITESTANDADC_ModeDV_DEF (0x00000000)
+ #define DDRCMDNCH0_CR_DLLPITESTANDADC_ModeADC_OFF ( 4)
+ #define DDRCMDNCH0_CR_DLLPITESTANDADC_ModeADC_WID ( 1)
+ #define DDRCMDNCH0_CR_DLLPITESTANDADC_ModeADC_MSK (0x00000010)
+ #define DDRCMDNCH0_CR_DLLPITESTANDADC_ModeADC_MAX (0x00000001)
+ #define DDRCMDNCH0_CR_DLLPITESTANDADC_ModeADC_DEF (0x00000000)
+ #define DDRCMDNCH0_CR_DLLPITESTANDADC_LoadCount_OFF ( 5)
+ #define DDRCMDNCH0_CR_DLLPITESTANDADC_LoadCount_WID (10)
+ #define DDRCMDNCH0_CR_DLLPITESTANDADC_LoadCount_MSK (0x00007FE0)
+ #define DDRCMDNCH0_CR_DLLPITESTANDADC_LoadCount_MAX (0x000003FF)
+ #define DDRCMDNCH0_CR_DLLPITESTANDADC_CountStatus_OFF (15)
+ #define DDRCMDNCH0_CR_DLLPITESTANDADC_CountStatus_WID (10)
+ #define DDRCMDNCH0_CR_DLLPITESTANDADC_CountStatus_MSK (0x01FF8000)
+ #define DDRCMDNCH0_CR_DLLPITESTANDADC_CountStatus_MAX (0x000003FF)
+ #define DDRCMDNCH0_CR_DLLPITESTANDADC_CountStatus_DEF (0x00000000)
+ #define DDRCMDNCH0_CR_DLLPITESTANDADC_Spare_OFF (25)
+ #define DDRCMDNCH0_CR_DLLPITESTANDADC_Spare_WID ( 7)
+ #define DDRCMDNCH0_CR_DLLPITESTANDADC_Spare_MSK (0xFE000000)
+ #define DDRCMDNCH0_CR_DLLPITESTANDADC_Spare_MAX (0x0000007F)
+
+#define DDRCMDNCH1_CR_DDRCRCMDCOMP_REG (0x00001500)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMP_Scomp_OFF ( 0)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMP_Scomp_WID ( 6)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMP_Scomp_MSK (0x0000003F)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMP_Scomp_MAX (0x0000003F)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMP_Scomp_DEF (0x00000000)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMP_TcoComp_OFF ( 6)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMP_TcoComp_WID ( 6)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMP_TcoComp_MSK (0x00000FC0)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMP_TcoComp_MAX (0x0000003F)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMP_TcoComp_DEF (0x00000000)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMP_RcompDrvUp_OFF (12)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMP_RcompDrvUp_WID ( 6)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMP_RcompDrvUp_MSK (0x0003F000)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMP_RcompDrvUp_MAX (0x0000003F)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMP_RcompDrvUp_DEF (0x00000000)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMP_RcompDrvDown_OFF (18)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMP_RcompDrvDown_WID ( 6)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMP_RcompDrvDown_MSK (0x00FC0000)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMP_RcompDrvDown_MAX (0x0000003F)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMP_RcompDrvDown_DEF (0x00000000)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMP_LsComp_OFF (24)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMP_LsComp_WID ( 3)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMP_LsComp_MSK (0x07000000)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMP_LsComp_MAX (0x00000007)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMP_LsComp_DEF (0x00000004)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMP_Spare_OFF (27)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMP_Spare_WID ( 5)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMP_Spare_MSK (0xF8000000)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMP_Spare_MAX (0x0000001F)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMP_Spare_DEF (0x00000000)
+
+#define DDRCMDNCH1_CR_DDRCRCMDCOMPOFFSET_REG (0x00001504)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMPOFFSET_ScompOffset_OFF ( 0)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMPOFFSET_ScompOffset_WID ( 5)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMPOFFSET_ScompOffset_MSK (0x0000001F)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMPOFFSET_ScompOffset_MAX (0x0000001F)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMPOFFSET_ScompOffset_DEF (0x00000000)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_OFF ( 5)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_WID ( 4)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_MSK (0x000001E0)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_MAX (0x0000000F)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_DEF (0x00000000)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_OFF ( 9)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_WID ( 4)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_MSK (0x00001E00)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_MAX (0x0000000F)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_DEF (0x00000000)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_OFF (13)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_WID ( 4)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_MSK (0x0001E000)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_MAX (0x0000000F)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_DEF (0x00000000)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMPOFFSET_Spare_OFF (17)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMPOFFSET_Spare_WID (15)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMPOFFSET_Spare_MSK (0xFFFE0000)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMPOFFSET_Spare_MAX (0x00007FFF)
+ #define DDRCMDNCH1_CR_DDRCRCMDCOMPOFFSET_Spare_DEF (0x00000000)
+
+#define DDRCMDNCH1_CR_DDRCRCMDPICODING_REG (0x00001508)
+ #define DDRCMDNCH1_CR_DDRCRCMDPICODING_CmdPi0Code_OFF ( 0)
+ #define DDRCMDNCH1_CR_DDRCRCMDPICODING_CmdPi0Code_WID ( 7)
+ #define DDRCMDNCH1_CR_DDRCRCMDPICODING_CmdPi0Code_MSK (0x0000007F)
+ #define DDRCMDNCH1_CR_DDRCRCMDPICODING_CmdPi0Code_MAX (0x0000007F)
+ #define DDRCMDNCH1_CR_DDRCRCMDPICODING_CmdPi0Code_DEF (0x00000000)
+ #define DDRCMDNCH1_CR_DDRCRCMDPICODING_CmdPi1Code_OFF ( 7)
+ #define DDRCMDNCH1_CR_DDRCRCMDPICODING_CmdPi1Code_WID ( 7)
+ #define DDRCMDNCH1_CR_DDRCRCMDPICODING_CmdPi1Code_MSK (0x00003F80)
+ #define DDRCMDNCH1_CR_DDRCRCMDPICODING_CmdPi1Code_MAX (0x0000007F)
+ #define DDRCMDNCH1_CR_DDRCRCMDPICODING_CmdPi1Code_DEF (0x00000000)
+ #define DDRCMDNCH1_CR_DDRCRCMDPICODING_Spare_OFF (14)
+ #define DDRCMDNCH1_CR_DDRCRCMDPICODING_Spare_WID (18)
+ #define DDRCMDNCH1_CR_DDRCRCMDPICODING_Spare_MSK (0xFFFFC000)
+ #define DDRCMDNCH1_CR_DDRCRCMDPICODING_Spare_MAX (0x0003FFFF)
+ #define DDRCMDNCH1_CR_DDRCRCMDPICODING_Spare_DEF (0x00000000)
+
+#define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_REG (0x0000150C)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_RefPi_OFF ( 0)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_RefPi_WID ( 4)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_RefPi_MSK (0x0000000F)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_RefPi_MAX (0x0000000F)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_RefPi_DEF (0x00000000)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_DllMask_OFF ( 4)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_DllMask_WID ( 2)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_DllMask_MSK (0x00000030)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_DllMask_MAX (0x00000003)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_DllMask_DEF (0x00000000)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_DllRsvd1_OFF ( 6)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_DllRsvd1_WID ( 1)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_DllRsvd1_MSK (0x00000040)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_DllRsvd1_MAX (0x00000001)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_DllRsvd1_DEF (0x00000000)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_TxOn_OFF ( 7)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_TxOn_WID ( 1)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_TxOn_MSK (0x00000080)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_TxOn_MAX (0x00000001)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_TxOn_DEF (0x00000000)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_IntClkOn_OFF ( 8)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_IntClkOn_WID ( 1)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_IntClkOn_MSK (0x00000100)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_IntClkOn_MAX (0x00000001)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_IntClkOn_DEF (0x00000000)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_RepClkOn_OFF ( 9)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_RepClkOn_WID ( 1)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_RepClkOn_MSK (0x00000200)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_RepClkOn_MAX (0x00000001)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_RepClkOn_DEF (0x00000000)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_IOLBCtl_OFF (10)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_IOLBCtl_WID ( 2)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_IOLBCtl_MSK (0x00000C00)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_IOLBCtl_MAX (0x00000003)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_IOLBCtl_DEF (0x00000000)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_OdtMode_OFF (12)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_OdtMode_WID ( 1)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_OdtMode_MSK (0x00001000)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_OdtMode_MAX (0x00000001)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_OdtMode_DEF (0x00000000)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_CmdTxEq_OFF (13)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_CmdTxEq_WID ( 2)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_CmdTxEq_MSK (0x00006000)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_CmdTxEq_MAX (0x00000003)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_CmdTxEq_DEF (0x00000000)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_EarlyWeakDrive_OFF (15)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_EarlyWeakDrive_WID ( 2)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_EarlyWeakDrive_MSK (0x00018000)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_EarlyWeakDrive_MAX (0x00000003)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_EarlyWeakDrive_DEF (0x00000000)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_Reserved_OFF (17)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_Reserved_WID ( 4)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_Reserved_MSK (0x001E0000)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_Reserved_MAX (0x0000000F)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_Reserved_DEF (0x00000000)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_RxVref_OFF (21)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_RxVref_WID ( 6)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_RxVref_MSK (0x07E00000)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_RxVref_MAX (0x0000003F)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_RxVref_DEF (0x00000000)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_VccddqHi_OFF (27)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_VccddqHi_WID ( 1)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_VccddqHi_MSK (0x08000000)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_VccddqHi_MAX (0x00000001)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_VccddqHi_DEF (0x00000000)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_DllWeakLock_OFF (28)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_DllWeakLock_WID ( 1)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_DllWeakLock_MSK (0x10000000)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_DllWeakLock_MAX (0x00000001)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_DllWeakLock_DEF (0x00000000)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_LPDDR_Mode_OFF (29)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_LPDDR_Mode_WID ( 1)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_LPDDR_Mode_MSK (0x20000000)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_LPDDR_Mode_MAX (0x00000001)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_LPDDR_Mode_DEF (0x00000000)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_LPDdrCAA_Dis_OFF (30)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_LPDdrCAA_Dis_WID ( 1)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_LPDdrCAA_Dis_MSK (0x40000000)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_LPDdrCAA_Dis_MAX (0x00000001)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_LPDdrCAA_Dis_DEF (0x00000000)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_LPDdrCAB_Dis_OFF (31)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_LPDdrCAB_Dis_WID ( 1)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_LPDdrCAB_Dis_MSK (0x80000000)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_LPDdrCAB_Dis_MAX (0x00000001)
+ #define DDRCMDNCH1_CR_DDRCRCMDCONTROLS_LPDdrCAB_Dis_DEF (0x00000000)
+
+#define DDRCMDNCH1_CR_DLLPITESTANDADC_REG (0x00001524)
+ #define DDRCMDNCH1_CR_DLLPITESTANDADC_RunTest_OFF ( 0)
+ #define DDRCMDNCH1_CR_DLLPITESTANDADC_RunTest_WID ( 1)
+ #define DDRCMDNCH1_CR_DLLPITESTANDADC_RunTest_MSK (0x00000001)
+ #define DDRCMDNCH1_CR_DLLPITESTANDADC_RunTest_MAX (0x00000001)
+ #define DDRCMDNCH1_CR_DLLPITESTANDADC_RunTest_DEF (0x00000000)
+ #define DDRCMDNCH1_CR_DLLPITESTANDADC_Load_OFF ( 1)
+ #define DDRCMDNCH1_CR_DLLPITESTANDADC_Load_WID ( 1)
+ #define DDRCMDNCH1_CR_DLLPITESTANDADC_Load_MSK (0x00000002)
+ #define DDRCMDNCH1_CR_DLLPITESTANDADC_Load_MAX (0x00000001)
+ #define DDRCMDNCH1_CR_DLLPITESTANDADC_Load_DEF (0x00000000)
+ #define DDRCMDNCH1_CR_DLLPITESTANDADC_ModeHVM_OFF ( 2)
+ #define DDRCMDNCH1_CR_DLLPITESTANDADC_ModeHVM_WID ( 1)
+ #define DDRCMDNCH1_CR_DLLPITESTANDADC_ModeHVM_MSK (0x00000004)
+ #define DDRCMDNCH1_CR_DLLPITESTANDADC_ModeHVM_MAX (0x00000001)
+ #define DDRCMDNCH1_CR_DLLPITESTANDADC_ModeHVM_DEF (0x00000000)
+ #define DDRCMDNCH1_CR_DLLPITESTANDADC_ModeDV_OFF ( 3)
+ #define DDRCMDNCH1_CR_DLLPITESTANDADC_ModeDV_WID ( 1)
+ #define DDRCMDNCH1_CR_DLLPITESTANDADC_ModeDV_MSK (0x00000008)
+ #define DDRCMDNCH1_CR_DLLPITESTANDADC_ModeDV_MAX (0x00000001)
+ #define DDRCMDNCH1_CR_DLLPITESTANDADC_ModeDV_DEF (0x00000000)
+ #define DDRCMDNCH1_CR_DLLPITESTANDADC_ModeADC_OFF ( 4)
+ #define DDRCMDNCH1_CR_DLLPITESTANDADC_ModeADC_WID ( 1)
+ #define DDRCMDNCH1_CR_DLLPITESTANDADC_ModeADC_MSK (0x00000010)
+ #define DDRCMDNCH1_CR_DLLPITESTANDADC_ModeADC_MAX (0x00000001)
+ #define DDRCMDNCH1_CR_DLLPITESTANDADC_ModeADC_DEF (0x00000000)
+ #define DDRCMDNCH1_CR_DLLPITESTANDADC_LoadCount_OFF ( 5)
+ #define DDRCMDNCH1_CR_DLLPITESTANDADC_LoadCount_WID (10)
+ #define DDRCMDNCH1_CR_DLLPITESTANDADC_LoadCount_MSK (0x00007FE0)
+ #define DDRCMDNCH1_CR_DLLPITESTANDADC_LoadCount_MAX (0x000003FF)
+ #define DDRCMDNCH1_CR_DLLPITESTANDADC_CountStatus_OFF (15)
+ #define DDRCMDNCH1_CR_DLLPITESTANDADC_CountStatus_WID (10)
+ #define DDRCMDNCH1_CR_DLLPITESTANDADC_CountStatus_MSK (0x01FF8000)
+ #define DDRCMDNCH1_CR_DLLPITESTANDADC_CountStatus_MAX (0x000003FF)
+ #define DDRCMDNCH1_CR_DLLPITESTANDADC_CountStatus_DEF (0x00000000)
+ #define DDRCMDNCH1_CR_DLLPITESTANDADC_Spare_OFF (25)
+ #define DDRCMDNCH1_CR_DLLPITESTANDADC_Spare_WID ( 7)
+ #define DDRCMDNCH1_CR_DLLPITESTANDADC_Spare_MSK (0xFE000000)
+ #define DDRCMDNCH1_CR_DLLPITESTANDADC_Spare_MAX (0x0000007F)
+
+#define DDRCMDSCH0_CR_DDRCRCMDCOMP_REG (0x00001A00)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMP_Scomp_OFF ( 0)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMP_Scomp_WID ( 6)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMP_Scomp_MSK (0x0000003F)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMP_Scomp_MAX (0x0000003F)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMP_Scomp_DEF (0x00000000)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMP_TcoComp_OFF ( 6)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMP_TcoComp_WID ( 6)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMP_TcoComp_MSK (0x00000FC0)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMP_TcoComp_MAX (0x0000003F)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMP_TcoComp_DEF (0x00000000)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMP_RcompDrvUp_OFF (12)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMP_RcompDrvUp_WID ( 6)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMP_RcompDrvUp_MSK (0x0003F000)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMP_RcompDrvUp_MAX (0x0000003F)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMP_RcompDrvUp_DEF (0x00000000)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMP_RcompDrvDown_OFF (18)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMP_RcompDrvDown_WID ( 6)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMP_RcompDrvDown_MSK (0x00FC0000)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMP_RcompDrvDown_MAX (0x0000003F)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMP_RcompDrvDown_DEF (0x00000000)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMP_LsComp_OFF (24)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMP_LsComp_WID ( 3)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMP_LsComp_MSK (0x07000000)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMP_LsComp_MAX (0x00000007)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMP_LsComp_DEF (0x00000004)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMP_Spare_OFF (27)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMP_Spare_WID ( 5)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMP_Spare_MSK (0xF8000000)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMP_Spare_MAX (0x0000001F)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMP_Spare_DEF (0x00000000)
+
+#define DDRCMDSCH0_CR_DDRCRCMDCOMPOFFSET_REG (0x00001A04)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMPOFFSET_ScompOffset_OFF ( 0)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMPOFFSET_ScompOffset_WID ( 5)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMPOFFSET_ScompOffset_MSK (0x0000001F)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMPOFFSET_ScompOffset_MAX (0x0000001F)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMPOFFSET_ScompOffset_DEF (0x00000000)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_OFF ( 5)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_WID ( 4)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_MSK (0x000001E0)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_MAX (0x0000000F)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_DEF (0x00000000)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_OFF ( 9)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_WID ( 4)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_MSK (0x00001E00)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_MAX (0x0000000F)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_DEF (0x00000000)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_OFF (13)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_WID ( 4)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_MSK (0x0001E000)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_MAX (0x0000000F)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_DEF (0x00000000)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMPOFFSET_Spare_OFF (17)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMPOFFSET_Spare_WID (15)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMPOFFSET_Spare_MSK (0xFFFE0000)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMPOFFSET_Spare_MAX (0x00007FFF)
+ #define DDRCMDSCH0_CR_DDRCRCMDCOMPOFFSET_Spare_DEF (0x00000000)
+
+#define DDRCMDSCH0_CR_DDRCRCMDPICODING_REG (0x00001A08)
+ #define DDRCMDSCH0_CR_DDRCRCMDPICODING_CmdPi0Code_OFF ( 0)
+ #define DDRCMDSCH0_CR_DDRCRCMDPICODING_CmdPi0Code_WID ( 7)
+ #define DDRCMDSCH0_CR_DDRCRCMDPICODING_CmdPi0Code_MSK (0x0000007F)
+ #define DDRCMDSCH0_CR_DDRCRCMDPICODING_CmdPi0Code_MAX (0x0000007F)
+ #define DDRCMDSCH0_CR_DDRCRCMDPICODING_CmdPi0Code_DEF (0x00000000)
+ #define DDRCMDSCH0_CR_DDRCRCMDPICODING_CmdPi1Code_OFF ( 7)
+ #define DDRCMDSCH0_CR_DDRCRCMDPICODING_CmdPi1Code_WID ( 7)
+ #define DDRCMDSCH0_CR_DDRCRCMDPICODING_CmdPi1Code_MSK (0x00003F80)
+ #define DDRCMDSCH0_CR_DDRCRCMDPICODING_CmdPi1Code_MAX (0x0000007F)
+ #define DDRCMDSCH0_CR_DDRCRCMDPICODING_CmdPi1Code_DEF (0x00000000)
+ #define DDRCMDSCH0_CR_DDRCRCMDPICODING_Spare_OFF (14)
+ #define DDRCMDSCH0_CR_DDRCRCMDPICODING_Spare_WID (18)
+ #define DDRCMDSCH0_CR_DDRCRCMDPICODING_Spare_MSK (0xFFFFC000)
+ #define DDRCMDSCH0_CR_DDRCRCMDPICODING_Spare_MAX (0x0003FFFF)
+ #define DDRCMDSCH0_CR_DDRCRCMDPICODING_Spare_DEF (0x00000000)
+
+#define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_REG (0x00001A0C)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_RefPi_OFF ( 0)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_RefPi_WID ( 4)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_RefPi_MSK (0x0000000F)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_RefPi_MAX (0x0000000F)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_RefPi_DEF (0x00000000)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_DllMask_OFF ( 4)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_DllMask_WID ( 2)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_DllMask_MSK (0x00000030)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_DllMask_MAX (0x00000003)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_DllMask_DEF (0x00000000)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_DllRsvd1_OFF ( 6)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_DllRsvd1_WID ( 1)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_DllRsvd1_MSK (0x00000040)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_DllRsvd1_MAX (0x00000001)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_DllRsvd1_DEF (0x00000000)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_TxOn_OFF ( 7)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_TxOn_WID ( 1)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_TxOn_MSK (0x00000080)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_TxOn_MAX (0x00000001)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_TxOn_DEF (0x00000000)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_IntClkOn_OFF ( 8)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_IntClkOn_WID ( 1)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_IntClkOn_MSK (0x00000100)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_IntClkOn_MAX (0x00000001)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_IntClkOn_DEF (0x00000000)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_RepClkOn_OFF ( 9)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_RepClkOn_WID ( 1)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_RepClkOn_MSK (0x00000200)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_RepClkOn_MAX (0x00000001)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_RepClkOn_DEF (0x00000000)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_IOLBCtl_OFF (10)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_IOLBCtl_WID ( 2)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_IOLBCtl_MSK (0x00000C00)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_IOLBCtl_MAX (0x00000003)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_IOLBCtl_DEF (0x00000000)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_OdtMode_OFF (12)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_OdtMode_WID ( 1)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_OdtMode_MSK (0x00001000)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_OdtMode_MAX (0x00000001)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_OdtMode_DEF (0x00000000)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_CmdTxEq_OFF (13)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_CmdTxEq_WID ( 2)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_CmdTxEq_MSK (0x00006000)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_CmdTxEq_MAX (0x00000003)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_CmdTxEq_DEF (0x00000000)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_EarlyWeakDrive_OFF (15)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_EarlyWeakDrive_WID ( 2)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_EarlyWeakDrive_MSK (0x00018000)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_EarlyWeakDrive_MAX (0x00000003)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_EarlyWeakDrive_DEF (0x00000000)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_Reserved_OFF (17)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_Reserved_WID ( 4)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_Reserved_MSK (0x001E0000)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_Reserved_MAX (0x0000000F)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_Reserved_DEF (0x00000000)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_RxVref_OFF (21)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_RxVref_WID ( 6)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_RxVref_MSK (0x07E00000)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_RxVref_MAX (0x0000003F)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_RxVref_DEF (0x00000000)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_VccddqHi_OFF (27)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_VccddqHi_WID ( 1)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_VccddqHi_MSK (0x08000000)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_VccddqHi_MAX (0x00000001)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_VccddqHi_DEF (0x00000000)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_DllWeakLock_OFF (28)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_DllWeakLock_WID ( 1)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_DllWeakLock_MSK (0x10000000)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_DllWeakLock_MAX (0x00000001)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_DllWeakLock_DEF (0x00000000)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_LPDDR_Mode_OFF (29)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_LPDDR_Mode_WID ( 1)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_LPDDR_Mode_MSK (0x20000000)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_LPDDR_Mode_MAX (0x00000001)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_LPDDR_Mode_DEF (0x00000000)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_LPDdrCAA_Dis_OFF (30)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_LPDdrCAA_Dis_WID ( 1)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_LPDdrCAA_Dis_MSK (0x40000000)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_LPDdrCAA_Dis_MAX (0x00000001)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_LPDdrCAA_Dis_DEF (0x00000000)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_LPDdrCAB_Dis_OFF (31)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_LPDdrCAB_Dis_WID ( 1)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_LPDdrCAB_Dis_MSK (0x80000000)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_LPDdrCAB_Dis_MAX (0x00000001)
+ #define DDRCMDSCH0_CR_DDRCRCMDCONTROLS_LPDdrCAB_Dis_DEF (0x00000000)
+
+#define DDRCMDSCH0_CR_DLLPITESTANDADC_REG (0x00001A24)
+ #define DDRCMDSCH0_CR_DLLPITESTANDADC_RunTest_OFF ( 0)
+ #define DDRCMDSCH0_CR_DLLPITESTANDADC_RunTest_WID ( 1)
+ #define DDRCMDSCH0_CR_DLLPITESTANDADC_RunTest_MSK (0x00000001)
+ #define DDRCMDSCH0_CR_DLLPITESTANDADC_RunTest_MAX (0x00000001)
+ #define DDRCMDSCH0_CR_DLLPITESTANDADC_RunTest_DEF (0x00000000)
+ #define DDRCMDSCH0_CR_DLLPITESTANDADC_Load_OFF ( 1)
+ #define DDRCMDSCH0_CR_DLLPITESTANDADC_Load_WID ( 1)
+ #define DDRCMDSCH0_CR_DLLPITESTANDADC_Load_MSK (0x00000002)
+ #define DDRCMDSCH0_CR_DLLPITESTANDADC_Load_MAX (0x00000001)
+ #define DDRCMDSCH0_CR_DLLPITESTANDADC_Load_DEF (0x00000000)
+ #define DDRCMDSCH0_CR_DLLPITESTANDADC_ModeHVM_OFF ( 2)
+ #define DDRCMDSCH0_CR_DLLPITESTANDADC_ModeHVM_WID ( 1)
+ #define DDRCMDSCH0_CR_DLLPITESTANDADC_ModeHVM_MSK (0x00000004)
+ #define DDRCMDSCH0_CR_DLLPITESTANDADC_ModeHVM_MAX (0x00000001)
+ #define DDRCMDSCH0_CR_DLLPITESTANDADC_ModeHVM_DEF (0x00000000)
+ #define DDRCMDSCH0_CR_DLLPITESTANDADC_ModeDV_OFF ( 3)
+ #define DDRCMDSCH0_CR_DLLPITESTANDADC_ModeDV_WID ( 1)
+ #define DDRCMDSCH0_CR_DLLPITESTANDADC_ModeDV_MSK (0x00000008)
+ #define DDRCMDSCH0_CR_DLLPITESTANDADC_ModeDV_MAX (0x00000001)
+ #define DDRCMDSCH0_CR_DLLPITESTANDADC_ModeDV_DEF (0x00000000)
+ #define DDRCMDSCH0_CR_DLLPITESTANDADC_ModeADC_OFF ( 4)
+ #define DDRCMDSCH0_CR_DLLPITESTANDADC_ModeADC_WID ( 1)
+ #define DDRCMDSCH0_CR_DLLPITESTANDADC_ModeADC_MSK (0x00000010)
+ #define DDRCMDSCH0_CR_DLLPITESTANDADC_ModeADC_MAX (0x00000001)
+ #define DDRCMDSCH0_CR_DLLPITESTANDADC_ModeADC_DEF (0x00000000)
+ #define DDRCMDSCH0_CR_DLLPITESTANDADC_LoadCount_OFF ( 5)
+ #define DDRCMDSCH0_CR_DLLPITESTANDADC_LoadCount_WID (10)
+ #define DDRCMDSCH0_CR_DLLPITESTANDADC_LoadCount_MSK (0x00007FE0)
+ #define DDRCMDSCH0_CR_DLLPITESTANDADC_LoadCount_MAX (0x000003FF)
+ #define DDRCMDSCH0_CR_DLLPITESTANDADC_CountStatus_OFF (15)
+ #define DDRCMDSCH0_CR_DLLPITESTANDADC_CountStatus_WID (10)
+ #define DDRCMDSCH0_CR_DLLPITESTANDADC_CountStatus_MSK (0x01FF8000)
+ #define DDRCMDSCH0_CR_DLLPITESTANDADC_CountStatus_MAX (0x000003FF)
+ #define DDRCMDSCH0_CR_DLLPITESTANDADC_CountStatus_DEF (0x00000000)
+ #define DDRCMDSCH0_CR_DLLPITESTANDADC_Spare_OFF (25)
+ #define DDRCMDSCH0_CR_DLLPITESTANDADC_Spare_WID ( 7)
+ #define DDRCMDSCH0_CR_DLLPITESTANDADC_Spare_MSK (0xFE000000)
+ #define DDRCMDSCH0_CR_DLLPITESTANDADC_Spare_MAX (0x0000007F)
+
+#define DDRCMDSCH1_CR_DDRCRCMDCOMP_REG (0x00001B00)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMP_Scomp_OFF ( 0)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMP_Scomp_WID ( 6)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMP_Scomp_MSK (0x0000003F)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMP_Scomp_MAX (0x0000003F)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMP_Scomp_DEF (0x00000000)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMP_TcoComp_OFF ( 6)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMP_TcoComp_WID ( 6)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMP_TcoComp_MSK (0x00000FC0)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMP_TcoComp_MAX (0x0000003F)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMP_TcoComp_DEF (0x00000000)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMP_RcompDrvUp_OFF (12)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMP_RcompDrvUp_WID ( 6)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMP_RcompDrvUp_MSK (0x0003F000)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMP_RcompDrvUp_MAX (0x0000003F)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMP_RcompDrvUp_DEF (0x00000000)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMP_RcompDrvDown_OFF (18)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMP_RcompDrvDown_WID ( 6)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMP_RcompDrvDown_MSK (0x00FC0000)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMP_RcompDrvDown_MAX (0x0000003F)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMP_RcompDrvDown_DEF (0x00000000)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMP_LsComp_OFF (24)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMP_LsComp_WID ( 3)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMP_LsComp_MSK (0x07000000)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMP_LsComp_MAX (0x00000007)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMP_LsComp_DEF (0x00000004)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMP_Spare_OFF (27)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMP_Spare_WID ( 5)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMP_Spare_MSK (0xF8000000)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMP_Spare_MAX (0x0000001F)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMP_Spare_DEF (0x00000000)
+
+#define DDRCMDSCH1_CR_DDRCRCMDCOMPOFFSET_REG (0x00001B04)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMPOFFSET_ScompOffset_OFF ( 0)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMPOFFSET_ScompOffset_WID ( 5)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMPOFFSET_ScompOffset_MSK (0x0000001F)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMPOFFSET_ScompOffset_MAX (0x0000001F)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMPOFFSET_ScompOffset_DEF (0x00000000)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_OFF ( 5)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_WID ( 4)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_MSK (0x000001E0)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_MAX (0x0000000F)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_DEF (0x00000000)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_OFF ( 9)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_WID ( 4)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_MSK (0x00001E00)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_MAX (0x0000000F)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_DEF (0x00000000)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_OFF (13)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_WID ( 4)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_MSK (0x0001E000)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_MAX (0x0000000F)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_DEF (0x00000000)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMPOFFSET_Spare_OFF (17)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMPOFFSET_Spare_WID (15)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMPOFFSET_Spare_MSK (0xFFFE0000)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMPOFFSET_Spare_MAX (0x00007FFF)
+ #define DDRCMDSCH1_CR_DDRCRCMDCOMPOFFSET_Spare_DEF (0x00000000)
+
+#define DDRCMDSCH1_CR_DDRCRCMDPICODING_REG (0x00001B08)
+ #define DDRCMDSCH1_CR_DDRCRCMDPICODING_CmdPi0Code_OFF ( 0)
+ #define DDRCMDSCH1_CR_DDRCRCMDPICODING_CmdPi0Code_WID ( 7)
+ #define DDRCMDSCH1_CR_DDRCRCMDPICODING_CmdPi0Code_MSK (0x0000007F)
+ #define DDRCMDSCH1_CR_DDRCRCMDPICODING_CmdPi0Code_MAX (0x0000007F)
+ #define DDRCMDSCH1_CR_DDRCRCMDPICODING_CmdPi0Code_DEF (0x00000000)
+ #define DDRCMDSCH1_CR_DDRCRCMDPICODING_CmdPi1Code_OFF ( 7)
+ #define DDRCMDSCH1_CR_DDRCRCMDPICODING_CmdPi1Code_WID ( 7)
+ #define DDRCMDSCH1_CR_DDRCRCMDPICODING_CmdPi1Code_MSK (0x00003F80)
+ #define DDRCMDSCH1_CR_DDRCRCMDPICODING_CmdPi1Code_MAX (0x0000007F)
+ #define DDRCMDSCH1_CR_DDRCRCMDPICODING_CmdPi1Code_DEF (0x00000000)
+ #define DDRCMDSCH1_CR_DDRCRCMDPICODING_Spare_OFF (14)
+ #define DDRCMDSCH1_CR_DDRCRCMDPICODING_Spare_WID (18)
+ #define DDRCMDSCH1_CR_DDRCRCMDPICODING_Spare_MSK (0xFFFFC000)
+ #define DDRCMDSCH1_CR_DDRCRCMDPICODING_Spare_MAX (0x0003FFFF)
+ #define DDRCMDSCH1_CR_DDRCRCMDPICODING_Spare_DEF (0x00000000)
+
+#define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_REG (0x00001B0C)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_RefPi_OFF ( 0)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_RefPi_WID ( 4)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_RefPi_MSK (0x0000000F)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_RefPi_MAX (0x0000000F)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_RefPi_DEF (0x00000000)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_DllMask_OFF ( 4)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_DllMask_WID ( 2)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_DllMask_MSK (0x00000030)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_DllMask_MAX (0x00000003)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_DllMask_DEF (0x00000000)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_DllRsvd1_OFF ( 6)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_DllRsvd1_WID ( 1)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_DllRsvd1_MSK (0x00000040)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_DllRsvd1_MAX (0x00000001)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_DllRsvd1_DEF (0x00000000)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_TxOn_OFF ( 7)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_TxOn_WID ( 1)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_TxOn_MSK (0x00000080)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_TxOn_MAX (0x00000001)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_TxOn_DEF (0x00000000)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_IntClkOn_OFF ( 8)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_IntClkOn_WID ( 1)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_IntClkOn_MSK (0x00000100)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_IntClkOn_MAX (0x00000001)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_IntClkOn_DEF (0x00000000)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_RepClkOn_OFF ( 9)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_RepClkOn_WID ( 1)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_RepClkOn_MSK (0x00000200)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_RepClkOn_MAX (0x00000001)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_RepClkOn_DEF (0x00000000)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_IOLBCtl_OFF (10)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_IOLBCtl_WID ( 2)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_IOLBCtl_MSK (0x00000C00)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_IOLBCtl_MAX (0x00000003)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_IOLBCtl_DEF (0x00000000)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_OdtMode_OFF (12)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_OdtMode_WID ( 1)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_OdtMode_MSK (0x00001000)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_OdtMode_MAX (0x00000001)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_OdtMode_DEF (0x00000000)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_CmdTxEq_OFF (13)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_CmdTxEq_WID ( 2)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_CmdTxEq_MSK (0x00006000)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_CmdTxEq_MAX (0x00000003)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_CmdTxEq_DEF (0x00000000)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_EarlyWeakDrive_OFF (15)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_EarlyWeakDrive_WID ( 2)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_EarlyWeakDrive_MSK (0x00018000)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_EarlyWeakDrive_MAX (0x00000003)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_EarlyWeakDrive_DEF (0x00000000)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_Reserved_OFF (17)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_Reserved_WID ( 4)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_Reserved_MSK (0x001E0000)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_Reserved_MAX (0x0000000F)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_Reserved_DEF (0x00000000)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_RxVref_OFF (21)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_RxVref_WID ( 6)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_RxVref_MSK (0x07E00000)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_RxVref_MAX (0x0000003F)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_RxVref_DEF (0x00000000)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_VccddqHi_OFF (27)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_VccddqHi_WID ( 1)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_VccddqHi_MSK (0x08000000)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_VccddqHi_MAX (0x00000001)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_VccddqHi_DEF (0x00000000)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_DllWeakLock_OFF (28)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_DllWeakLock_WID ( 1)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_DllWeakLock_MSK (0x10000000)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_DllWeakLock_MAX (0x00000001)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_DllWeakLock_DEF (0x00000000)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_LPDDR_Mode_OFF (29)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_LPDDR_Mode_WID ( 1)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_LPDDR_Mode_MSK (0x20000000)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_LPDDR_Mode_MAX (0x00000001)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_LPDDR_Mode_DEF (0x00000000)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_LPDdrCAA_Dis_OFF (30)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_LPDdrCAA_Dis_WID ( 1)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_LPDdrCAA_Dis_MSK (0x40000000)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_LPDdrCAA_Dis_MAX (0x00000001)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_LPDdrCAA_Dis_DEF (0x00000000)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_LPDdrCAB_Dis_OFF (31)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_LPDdrCAB_Dis_WID ( 1)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_LPDdrCAB_Dis_MSK (0x80000000)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_LPDdrCAB_Dis_MAX (0x00000001)
+ #define DDRCMDSCH1_CR_DDRCRCMDCONTROLS_LPDdrCAB_Dis_DEF (0x00000000)
+
+#define DDRCMDSCH1_CR_DLLPITESTANDADC_REG (0x00001B24)
+ #define DDRCMDSCH1_CR_DLLPITESTANDADC_RunTest_OFF ( 0)
+ #define DDRCMDSCH1_CR_DLLPITESTANDADC_RunTest_WID ( 1)
+ #define DDRCMDSCH1_CR_DLLPITESTANDADC_RunTest_MSK (0x00000001)
+ #define DDRCMDSCH1_CR_DLLPITESTANDADC_RunTest_MAX (0x00000001)
+ #define DDRCMDSCH1_CR_DLLPITESTANDADC_RunTest_DEF (0x00000000)
+ #define DDRCMDSCH1_CR_DLLPITESTANDADC_Load_OFF ( 1)
+ #define DDRCMDSCH1_CR_DLLPITESTANDADC_Load_WID ( 1)
+ #define DDRCMDSCH1_CR_DLLPITESTANDADC_Load_MSK (0x00000002)
+ #define DDRCMDSCH1_CR_DLLPITESTANDADC_Load_MAX (0x00000001)
+ #define DDRCMDSCH1_CR_DLLPITESTANDADC_Load_DEF (0x00000000)
+ #define DDRCMDSCH1_CR_DLLPITESTANDADC_ModeHVM_OFF ( 2)
+ #define DDRCMDSCH1_CR_DLLPITESTANDADC_ModeHVM_WID ( 1)
+ #define DDRCMDSCH1_CR_DLLPITESTANDADC_ModeHVM_MSK (0x00000004)
+ #define DDRCMDSCH1_CR_DLLPITESTANDADC_ModeHVM_MAX (0x00000001)
+ #define DDRCMDSCH1_CR_DLLPITESTANDADC_ModeHVM_DEF (0x00000000)
+ #define DDRCMDSCH1_CR_DLLPITESTANDADC_ModeDV_OFF ( 3)
+ #define DDRCMDSCH1_CR_DLLPITESTANDADC_ModeDV_WID ( 1)
+ #define DDRCMDSCH1_CR_DLLPITESTANDADC_ModeDV_MSK (0x00000008)
+ #define DDRCMDSCH1_CR_DLLPITESTANDADC_ModeDV_MAX (0x00000001)
+ #define DDRCMDSCH1_CR_DLLPITESTANDADC_ModeDV_DEF (0x00000000)
+ #define DDRCMDSCH1_CR_DLLPITESTANDADC_ModeADC_OFF ( 4)
+ #define DDRCMDSCH1_CR_DLLPITESTANDADC_ModeADC_WID ( 1)
+ #define DDRCMDSCH1_CR_DLLPITESTANDADC_ModeADC_MSK (0x00000010)
+ #define DDRCMDSCH1_CR_DLLPITESTANDADC_ModeADC_MAX (0x00000001)
+ #define DDRCMDSCH1_CR_DLLPITESTANDADC_ModeADC_DEF (0x00000000)
+ #define DDRCMDSCH1_CR_DLLPITESTANDADC_LoadCount_OFF ( 5)
+ #define DDRCMDSCH1_CR_DLLPITESTANDADC_LoadCount_WID (10)
+ #define DDRCMDSCH1_CR_DLLPITESTANDADC_LoadCount_MSK (0x00007FE0)
+ #define DDRCMDSCH1_CR_DLLPITESTANDADC_LoadCount_MAX (0x000003FF)
+ #define DDRCMDSCH1_CR_DLLPITESTANDADC_CountStatus_OFF (15)
+ #define DDRCMDSCH1_CR_DLLPITESTANDADC_CountStatus_WID (10)
+ #define DDRCMDSCH1_CR_DLLPITESTANDADC_CountStatus_MSK (0x01FF8000)
+ #define DDRCMDSCH1_CR_DLLPITESTANDADC_CountStatus_MAX (0x000003FF)
+ #define DDRCMDSCH1_CR_DLLPITESTANDADC_CountStatus_DEF (0x00000000)
+ #define DDRCMDSCH1_CR_DLLPITESTANDADC_Spare_OFF (25)
+ #define DDRCMDSCH1_CR_DLLPITESTANDADC_Spare_WID ( 7)
+ #define DDRCMDSCH1_CR_DLLPITESTANDADC_Spare_MSK (0xFE000000)
+ #define DDRCMDSCH1_CR_DLLPITESTANDADC_Spare_MAX (0x0000007F)
+
+#define DDRCMDCH0_CR_DDRCRCMDCOMP_REG (0x00003200)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMP_Scomp_OFF ( 0)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMP_Scomp_WID ( 6)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMP_Scomp_MSK (0x0000003F)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMP_Scomp_MAX (0x0000003F)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMP_Scomp_DEF (0x00000000)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMP_TcoComp_OFF ( 6)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMP_TcoComp_WID ( 6)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMP_TcoComp_MSK (0x00000FC0)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMP_TcoComp_MAX (0x0000003F)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMP_TcoComp_DEF (0x00000000)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMP_RcompDrvUp_OFF (12)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMP_RcompDrvUp_WID ( 6)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMP_RcompDrvUp_MSK (0x0003F000)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMP_RcompDrvUp_MAX (0x0000003F)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMP_RcompDrvUp_DEF (0x00000000)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMP_RcompDrvDown_OFF (18)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMP_RcompDrvDown_WID ( 6)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMP_RcompDrvDown_MSK (0x00FC0000)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMP_RcompDrvDown_MAX (0x0000003F)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMP_RcompDrvDown_DEF (0x00000000)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMP_LsComp_OFF (24)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMP_LsComp_WID ( 3)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMP_LsComp_MSK (0x07000000)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMP_LsComp_MAX (0x00000007)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMP_LsComp_DEF (0x00000004)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMP_Spare_OFF (27)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMP_Spare_WID ( 5)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMP_Spare_MSK (0xF8000000)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMP_Spare_MAX (0x0000001F)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMP_Spare_DEF (0x00000000)
+
+#define DDRCMDCH0_CR_DDRCRCMDCOMPOFFSET_REG (0x00003204)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMPOFFSET_ScompOffset_OFF ( 0)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMPOFFSET_ScompOffset_WID ( 5)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMPOFFSET_ScompOffset_MSK (0x0000001F)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMPOFFSET_ScompOffset_MAX (0x0000001F)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMPOFFSET_ScompOffset_DEF (0x00000000)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_OFF ( 5)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_WID ( 4)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_MSK (0x000001E0)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_MAX (0x0000000F)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_DEF (0x00000000)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_OFF ( 9)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_WID ( 4)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_MSK (0x00001E00)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_MAX (0x0000000F)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_DEF (0x00000000)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_OFF (13)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_WID ( 4)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_MSK (0x0001E000)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_MAX (0x0000000F)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_DEF (0x00000000)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMPOFFSET_Spare_OFF (17)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMPOFFSET_Spare_WID (15)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMPOFFSET_Spare_MSK (0xFFFE0000)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMPOFFSET_Spare_MAX (0x00007FFF)
+ #define DDRCMDCH0_CR_DDRCRCMDCOMPOFFSET_Spare_DEF (0x00000000)
+
+#define DDRCMDCH0_CR_DDRCRCMDPICODING_REG (0x00003208)
+ #define DDRCMDCH0_CR_DDRCRCMDPICODING_CmdPi0Code_OFF ( 0)
+ #define DDRCMDCH0_CR_DDRCRCMDPICODING_CmdPi0Code_WID ( 7)
+ #define DDRCMDCH0_CR_DDRCRCMDPICODING_CmdPi0Code_MSK (0x0000007F)
+ #define DDRCMDCH0_CR_DDRCRCMDPICODING_CmdPi0Code_MAX (0x0000007F)
+ #define DDRCMDCH0_CR_DDRCRCMDPICODING_CmdPi0Code_DEF (0x00000000)
+ #define DDRCMDCH0_CR_DDRCRCMDPICODING_CmdPi1Code_OFF ( 7)
+ #define DDRCMDCH0_CR_DDRCRCMDPICODING_CmdPi1Code_WID ( 7)
+ #define DDRCMDCH0_CR_DDRCRCMDPICODING_CmdPi1Code_MSK (0x00003F80)
+ #define DDRCMDCH0_CR_DDRCRCMDPICODING_CmdPi1Code_MAX (0x0000007F)
+ #define DDRCMDCH0_CR_DDRCRCMDPICODING_CmdPi1Code_DEF (0x00000000)
+ #define DDRCMDCH0_CR_DDRCRCMDPICODING_Spare_OFF (14)
+ #define DDRCMDCH0_CR_DDRCRCMDPICODING_Spare_WID (18)
+ #define DDRCMDCH0_CR_DDRCRCMDPICODING_Spare_MSK (0xFFFFC000)
+ #define DDRCMDCH0_CR_DDRCRCMDPICODING_Spare_MAX (0x0003FFFF)
+ #define DDRCMDCH0_CR_DDRCRCMDPICODING_Spare_DEF (0x00000000)
+
+#define DDRCMDCH0_CR_DDRCRCMDCONTROLS_REG (0x0000320C)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_RefPi_OFF ( 0)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_RefPi_WID ( 4)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_RefPi_MSK (0x0000000F)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_RefPi_MAX (0x0000000F)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_RefPi_DEF (0x00000000)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_DllMask_OFF ( 4)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_DllMask_WID ( 2)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_DllMask_MSK (0x00000030)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_DllMask_MAX (0x00000003)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_DllMask_DEF (0x00000000)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_DllRsvd1_OFF ( 6)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_DllRsvd1_WID ( 1)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_DllRsvd1_MSK (0x00000040)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_DllRsvd1_MAX (0x00000001)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_DllRsvd1_DEF (0x00000000)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_TxOn_OFF ( 7)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_TxOn_WID ( 1)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_TxOn_MSK (0x00000080)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_TxOn_MAX (0x00000001)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_TxOn_DEF (0x00000000)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_IntClkOn_OFF ( 8)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_IntClkOn_WID ( 1)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_IntClkOn_MSK (0x00000100)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_IntClkOn_MAX (0x00000001)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_IntClkOn_DEF (0x00000000)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_RepClkOn_OFF ( 9)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_RepClkOn_WID ( 1)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_RepClkOn_MSK (0x00000200)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_RepClkOn_MAX (0x00000001)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_RepClkOn_DEF (0x00000000)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_IOLBCtl_OFF (10)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_IOLBCtl_WID ( 2)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_IOLBCtl_MSK (0x00000C00)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_IOLBCtl_MAX (0x00000003)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_IOLBCtl_DEF (0x00000000)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_OdtMode_OFF (12)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_OdtMode_WID ( 1)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_OdtMode_MSK (0x00001000)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_OdtMode_MAX (0x00000001)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_OdtMode_DEF (0x00000000)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_CmdTxEq_OFF (13)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_CmdTxEq_WID ( 2)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_CmdTxEq_MSK (0x00006000)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_CmdTxEq_MAX (0x00000003)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_CmdTxEq_DEF (0x00000000)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_EarlyWeakDrive_OFF (15)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_EarlyWeakDrive_WID ( 2)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_EarlyWeakDrive_MSK (0x00018000)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_EarlyWeakDrive_MAX (0x00000003)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_EarlyWeakDrive_DEF (0x00000000)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_Reserved_OFF (17)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_Reserved_WID ( 4)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_Reserved_MSK (0x001E0000)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_Reserved_MAX (0x0000000F)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_Reserved_DEF (0x00000000)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_RxVref_OFF (21)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_RxVref_WID ( 6)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_RxVref_MSK (0x07E00000)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_RxVref_MAX (0x0000003F)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_RxVref_DEF (0x00000000)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_VccddqHi_OFF (27)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_VccddqHi_WID ( 1)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_VccddqHi_MSK (0x08000000)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_VccddqHi_MAX (0x00000001)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_VccddqHi_DEF (0x00000000)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_DllWeakLock_OFF (28)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_DllWeakLock_WID ( 1)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_DllWeakLock_MSK (0x10000000)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_DllWeakLock_MAX (0x00000001)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_DllWeakLock_DEF (0x00000000)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_LPDDR_Mode_OFF (29)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_LPDDR_Mode_WID ( 1)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_LPDDR_Mode_MSK (0x20000000)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_LPDDR_Mode_MAX (0x00000001)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_LPDDR_Mode_DEF (0x00000000)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_LPDdrCAA_Dis_OFF (30)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_LPDdrCAA_Dis_WID ( 1)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_LPDdrCAA_Dis_MSK (0x40000000)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_LPDdrCAA_Dis_MAX (0x00000001)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_LPDdrCAA_Dis_DEF (0x00000000)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_LPDdrCAB_Dis_OFF (31)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_LPDdrCAB_Dis_WID ( 1)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_LPDdrCAB_Dis_MSK (0x80000000)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_LPDdrCAB_Dis_MAX (0x00000001)
+ #define DDRCMDCH0_CR_DDRCRCMDCONTROLS_LPDdrCAB_Dis_DEF (0x00000000)
+
+#define DDRCMDCH0_CR_DLLPITESTANDADC_REG (0x00003224)
+ #define DDRCMDCH0_CR_DLLPITESTANDADC_RunTest_OFF ( 0)
+ #define DDRCMDCH0_CR_DLLPITESTANDADC_RunTest_WID ( 1)
+ #define DDRCMDCH0_CR_DLLPITESTANDADC_RunTest_MSK (0x00000001)
+ #define DDRCMDCH0_CR_DLLPITESTANDADC_RunTest_MAX (0x00000001)
+ #define DDRCMDCH0_CR_DLLPITESTANDADC_RunTest_DEF (0x00000000)
+ #define DDRCMDCH0_CR_DLLPITESTANDADC_Load_OFF ( 1)
+ #define DDRCMDCH0_CR_DLLPITESTANDADC_Load_WID ( 1)
+ #define DDRCMDCH0_CR_DLLPITESTANDADC_Load_MSK (0x00000002)
+ #define DDRCMDCH0_CR_DLLPITESTANDADC_Load_MAX (0x00000001)
+ #define DDRCMDCH0_CR_DLLPITESTANDADC_Load_DEF (0x00000000)
+ #define DDRCMDCH0_CR_DLLPITESTANDADC_ModeHVM_OFF ( 2)
+ #define DDRCMDCH0_CR_DLLPITESTANDADC_ModeHVM_WID ( 1)
+ #define DDRCMDCH0_CR_DLLPITESTANDADC_ModeHVM_MSK (0x00000004)
+ #define DDRCMDCH0_CR_DLLPITESTANDADC_ModeHVM_MAX (0x00000001)
+ #define DDRCMDCH0_CR_DLLPITESTANDADC_ModeHVM_DEF (0x00000000)
+ #define DDRCMDCH0_CR_DLLPITESTANDADC_ModeDV_OFF ( 3)
+ #define DDRCMDCH0_CR_DLLPITESTANDADC_ModeDV_WID ( 1)
+ #define DDRCMDCH0_CR_DLLPITESTANDADC_ModeDV_MSK (0x00000008)
+ #define DDRCMDCH0_CR_DLLPITESTANDADC_ModeDV_MAX (0x00000001)
+ #define DDRCMDCH0_CR_DLLPITESTANDADC_ModeDV_DEF (0x00000000)
+ #define DDRCMDCH0_CR_DLLPITESTANDADC_ModeADC_OFF ( 4)
+ #define DDRCMDCH0_CR_DLLPITESTANDADC_ModeADC_WID ( 1)
+ #define DDRCMDCH0_CR_DLLPITESTANDADC_ModeADC_MSK (0x00000010)
+ #define DDRCMDCH0_CR_DLLPITESTANDADC_ModeADC_MAX (0x00000001)
+ #define DDRCMDCH0_CR_DLLPITESTANDADC_ModeADC_DEF (0x00000000)
+ #define DDRCMDCH0_CR_DLLPITESTANDADC_LoadCount_OFF ( 5)
+ #define DDRCMDCH0_CR_DLLPITESTANDADC_LoadCount_WID (10)
+ #define DDRCMDCH0_CR_DLLPITESTANDADC_LoadCount_MSK (0x00007FE0)
+ #define DDRCMDCH0_CR_DLLPITESTANDADC_LoadCount_MAX (0x000003FF)
+ #define DDRCMDCH0_CR_DLLPITESTANDADC_CountStatus_OFF (15)
+ #define DDRCMDCH0_CR_DLLPITESTANDADC_CountStatus_WID (10)
+ #define DDRCMDCH0_CR_DLLPITESTANDADC_CountStatus_MSK (0x01FF8000)
+ #define DDRCMDCH0_CR_DLLPITESTANDADC_CountStatus_MAX (0x000003FF)
+ #define DDRCMDCH0_CR_DLLPITESTANDADC_CountStatus_DEF (0x00000000)
+ #define DDRCMDCH0_CR_DLLPITESTANDADC_Spare_OFF (25)
+ #define DDRCMDCH0_CR_DLLPITESTANDADC_Spare_WID ( 7)
+ #define DDRCMDCH0_CR_DLLPITESTANDADC_Spare_MSK (0xFE000000)
+ #define DDRCMDCH0_CR_DLLPITESTANDADC_Spare_MAX (0x0000007F)
+
+#define DDRCMDCH1_CR_DDRCRCMDCOMP_REG (0x00003300)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMP_Scomp_OFF ( 0)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMP_Scomp_WID ( 6)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMP_Scomp_MSK (0x0000003F)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMP_Scomp_MAX (0x0000003F)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMP_Scomp_DEF (0x00000000)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMP_TcoComp_OFF ( 6)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMP_TcoComp_WID ( 6)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMP_TcoComp_MSK (0x00000FC0)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMP_TcoComp_MAX (0x0000003F)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMP_TcoComp_DEF (0x00000000)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMP_RcompDrvUp_OFF (12)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMP_RcompDrvUp_WID ( 6)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMP_RcompDrvUp_MSK (0x0003F000)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMP_RcompDrvUp_MAX (0x0000003F)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMP_RcompDrvUp_DEF (0x00000000)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMP_RcompDrvDown_OFF (18)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMP_RcompDrvDown_WID ( 6)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMP_RcompDrvDown_MSK (0x00FC0000)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMP_RcompDrvDown_MAX (0x0000003F)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMP_RcompDrvDown_DEF (0x00000000)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMP_LsComp_OFF (24)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMP_LsComp_WID ( 3)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMP_LsComp_MSK (0x07000000)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMP_LsComp_MAX (0x00000007)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMP_LsComp_DEF (0x00000004)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMP_Spare_OFF (27)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMP_Spare_WID ( 5)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMP_Spare_MSK (0xF8000000)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMP_Spare_MAX (0x0000001F)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMP_Spare_DEF (0x00000000)
+
+#define DDRCMDCH1_CR_DDRCRCMDCOMPOFFSET_REG (0x00003304)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMPOFFSET_ScompOffset_OFF ( 0)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMPOFFSET_ScompOffset_WID ( 5)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMPOFFSET_ScompOffset_MSK (0x0000001F)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMPOFFSET_ScompOffset_MAX (0x0000001F)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMPOFFSET_ScompOffset_DEF (0x00000000)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_OFF ( 5)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_WID ( 4)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_MSK (0x000001E0)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_MAX (0x0000000F)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMPOFFSET_TcoCompOffset_DEF (0x00000000)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_OFF ( 9)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_WID ( 4)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_MSK (0x00001E00)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_MAX (0x0000000F)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMPOFFSET_RcompDrvUpOffset_DEF (0x00000000)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_OFF (13)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_WID ( 4)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_MSK (0x0001E000)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_MAX (0x0000000F)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMPOFFSET_RcompDrvDownOffset_DEF (0x00000000)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMPOFFSET_Spare_OFF (17)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMPOFFSET_Spare_WID (15)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMPOFFSET_Spare_MSK (0xFFFE0000)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMPOFFSET_Spare_MAX (0x00007FFF)
+ #define DDRCMDCH1_CR_DDRCRCMDCOMPOFFSET_Spare_DEF (0x00000000)
+
+#define DDRCMDCH1_CR_DDRCRCMDPICODING_REG (0x00003308)
+ #define DDRCMDCH1_CR_DDRCRCMDPICODING_CmdPi0Code_OFF ( 0)
+ #define DDRCMDCH1_CR_DDRCRCMDPICODING_CmdPi0Code_WID ( 7)
+ #define DDRCMDCH1_CR_DDRCRCMDPICODING_CmdPi0Code_MSK (0x0000007F)
+ #define DDRCMDCH1_CR_DDRCRCMDPICODING_CmdPi0Code_MAX (0x0000007F)
+ #define DDRCMDCH1_CR_DDRCRCMDPICODING_CmdPi0Code_DEF (0x00000000)
+ #define DDRCMDCH1_CR_DDRCRCMDPICODING_CmdPi1Code_OFF ( 7)
+ #define DDRCMDCH1_CR_DDRCRCMDPICODING_CmdPi1Code_WID ( 7)
+ #define DDRCMDCH1_CR_DDRCRCMDPICODING_CmdPi1Code_MSK (0x00003F80)
+ #define DDRCMDCH1_CR_DDRCRCMDPICODING_CmdPi1Code_MAX (0x0000007F)
+ #define DDRCMDCH1_CR_DDRCRCMDPICODING_CmdPi1Code_DEF (0x00000000)
+ #define DDRCMDCH1_CR_DDRCRCMDPICODING_Spare_OFF (14)
+ #define DDRCMDCH1_CR_DDRCRCMDPICODING_Spare_WID (18)
+ #define DDRCMDCH1_CR_DDRCRCMDPICODING_Spare_MSK (0xFFFFC000)
+ #define DDRCMDCH1_CR_DDRCRCMDPICODING_Spare_MAX (0x0003FFFF)
+ #define DDRCMDCH1_CR_DDRCRCMDPICODING_Spare_DEF (0x00000000)
+
+#define DDRCMDCH1_CR_DDRCRCMDCONTROLS_REG (0x0000330C)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_RefPi_OFF ( 0)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_RefPi_WID ( 4)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_RefPi_MSK (0x0000000F)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_RefPi_MAX (0x0000000F)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_RefPi_DEF (0x00000000)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_DllMask_OFF ( 4)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_DllMask_WID ( 2)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_DllMask_MSK (0x00000030)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_DllMask_MAX (0x00000003)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_DllMask_DEF (0x00000000)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_DllRsvd1_OFF ( 6)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_DllRsvd1_WID ( 1)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_DllRsvd1_MSK (0x00000040)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_DllRsvd1_MAX (0x00000001)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_DllRsvd1_DEF (0x00000000)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_TxOn_OFF ( 7)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_TxOn_WID ( 1)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_TxOn_MSK (0x00000080)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_TxOn_MAX (0x00000001)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_TxOn_DEF (0x00000000)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_IntClkOn_OFF ( 8)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_IntClkOn_WID ( 1)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_IntClkOn_MSK (0x00000100)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_IntClkOn_MAX (0x00000001)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_IntClkOn_DEF (0x00000000)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_RepClkOn_OFF ( 9)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_RepClkOn_WID ( 1)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_RepClkOn_MSK (0x00000200)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_RepClkOn_MAX (0x00000001)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_RepClkOn_DEF (0x00000000)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_IOLBCtl_OFF (10)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_IOLBCtl_WID ( 2)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_IOLBCtl_MSK (0x00000C00)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_IOLBCtl_MAX (0x00000003)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_IOLBCtl_DEF (0x00000000)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_OdtMode_OFF (12)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_OdtMode_WID ( 1)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_OdtMode_MSK (0x00001000)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_OdtMode_MAX (0x00000001)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_OdtMode_DEF (0x00000000)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_CmdTxEq_OFF (13)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_CmdTxEq_WID ( 2)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_CmdTxEq_MSK (0x00006000)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_CmdTxEq_MAX (0x00000003)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_CmdTxEq_DEF (0x00000000)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_EarlyWeakDrive_OFF (15)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_EarlyWeakDrive_WID ( 2)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_EarlyWeakDrive_MSK (0x00018000)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_EarlyWeakDrive_MAX (0x00000003)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_EarlyWeakDrive_DEF (0x00000000)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_Reserved_OFF (17)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_Reserved_WID ( 4)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_Reserved_MSK (0x001E0000)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_Reserved_MAX (0x0000000F)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_Reserved_DEF (0x00000000)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_RxVref_OFF (21)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_RxVref_WID ( 6)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_RxVref_MSK (0x07E00000)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_RxVref_MAX (0x0000003F)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_RxVref_DEF (0x00000000)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_VccddqHi_OFF (27)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_VccddqHi_WID ( 1)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_VccddqHi_MSK (0x08000000)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_VccddqHi_MAX (0x00000001)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_VccddqHi_DEF (0x00000000)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_DllWeakLock_OFF (28)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_DllWeakLock_WID ( 1)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_DllWeakLock_MSK (0x10000000)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_DllWeakLock_MAX (0x00000001)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_DllWeakLock_DEF (0x00000000)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_LPDDR_Mode_OFF (29)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_LPDDR_Mode_WID ( 1)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_LPDDR_Mode_MSK (0x20000000)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_LPDDR_Mode_MAX (0x00000001)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_LPDDR_Mode_DEF (0x00000000)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_LPDdrCAA_Dis_OFF (30)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_LPDdrCAA_Dis_WID ( 1)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_LPDdrCAA_Dis_MSK (0x40000000)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_LPDdrCAA_Dis_MAX (0x00000001)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_LPDdrCAA_Dis_DEF (0x00000000)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_LPDdrCAB_Dis_OFF (31)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_LPDdrCAB_Dis_WID ( 1)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_LPDdrCAB_Dis_MSK (0x80000000)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_LPDdrCAB_Dis_MAX (0x00000001)
+ #define DDRCMDCH1_CR_DDRCRCMDCONTROLS_LPDdrCAB_Dis_DEF (0x00000000)
+
+#define DDRCMDCH1_CR_DLLPITESTANDADC_REG (0x00003324)
+ #define DDRCMDCH1_CR_DLLPITESTANDADC_RunTest_OFF ( 0)
+ #define DDRCMDCH1_CR_DLLPITESTANDADC_RunTest_WID ( 1)
+ #define DDRCMDCH1_CR_DLLPITESTANDADC_RunTest_MSK (0x00000001)
+ #define DDRCMDCH1_CR_DLLPITESTANDADC_RunTest_MAX (0x00000001)
+ #define DDRCMDCH1_CR_DLLPITESTANDADC_RunTest_DEF (0x00000000)
+ #define DDRCMDCH1_CR_DLLPITESTANDADC_Load_OFF ( 1)
+ #define DDRCMDCH1_CR_DLLPITESTANDADC_Load_WID ( 1)
+ #define DDRCMDCH1_CR_DLLPITESTANDADC_Load_MSK (0x00000002)
+ #define DDRCMDCH1_CR_DLLPITESTANDADC_Load_MAX (0x00000001)
+ #define DDRCMDCH1_CR_DLLPITESTANDADC_Load_DEF (0x00000000)
+ #define DDRCMDCH1_CR_DLLPITESTANDADC_ModeHVM_OFF ( 2)
+ #define DDRCMDCH1_CR_DLLPITESTANDADC_ModeHVM_WID ( 1)
+ #define DDRCMDCH1_CR_DLLPITESTANDADC_ModeHVM_MSK (0x00000004)
+ #define DDRCMDCH1_CR_DLLPITESTANDADC_ModeHVM_MAX (0x00000001)
+ #define DDRCMDCH1_CR_DLLPITESTANDADC_ModeHVM_DEF (0x00000000)
+ #define DDRCMDCH1_CR_DLLPITESTANDADC_ModeDV_OFF ( 3)
+ #define DDRCMDCH1_CR_DLLPITESTANDADC_ModeDV_WID ( 1)
+ #define DDRCMDCH1_CR_DLLPITESTANDADC_ModeDV_MSK (0x00000008)
+ #define DDRCMDCH1_CR_DLLPITESTANDADC_ModeDV_MAX (0x00000001)
+ #define DDRCMDCH1_CR_DLLPITESTANDADC_ModeDV_DEF (0x00000000)
+ #define DDRCMDCH1_CR_DLLPITESTANDADC_ModeADC_OFF ( 4)
+ #define DDRCMDCH1_CR_DLLPITESTANDADC_ModeADC_WID ( 1)
+ #define DDRCMDCH1_CR_DLLPITESTANDADC_ModeADC_MSK (0x00000010)
+ #define DDRCMDCH1_CR_DLLPITESTANDADC_ModeADC_MAX (0x00000001)
+ #define DDRCMDCH1_CR_DLLPITESTANDADC_ModeADC_DEF (0x00000000)
+ #define DDRCMDCH1_CR_DLLPITESTANDADC_LoadCount_OFF ( 5)
+ #define DDRCMDCH1_CR_DLLPITESTANDADC_LoadCount_WID (10)
+ #define DDRCMDCH1_CR_DLLPITESTANDADC_LoadCount_MSK (0x00007FE0)
+ #define DDRCMDCH1_CR_DLLPITESTANDADC_LoadCount_MAX (0x000003FF)
+ #define DDRCMDCH1_CR_DLLPITESTANDADC_CountStatus_OFF (15)
+ #define DDRCMDCH1_CR_DLLPITESTANDADC_CountStatus_WID (10)
+ #define DDRCMDCH1_CR_DLLPITESTANDADC_CountStatus_MSK (0x01FF8000)
+ #define DDRCMDCH1_CR_DLLPITESTANDADC_CountStatus_MAX (0x000003FF)
+ #define DDRCMDCH1_CR_DLLPITESTANDADC_CountStatus_DEF (0x00000000)
+ #define DDRCMDCH1_CR_DLLPITESTANDADC_Spare_OFF (25)
+ #define DDRCMDCH1_CR_DLLPITESTANDADC_Spare_WID ( 7)
+ #define DDRCMDCH1_CR_DLLPITESTANDADC_Spare_MSK (0xFE000000)
+ #define DDRCMDCH1_CR_DLLPITESTANDADC_Spare_MAX (0x0000007F)
+
+#pragma pack(pop)
+#endif // __McIoCmd_h__
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/McIoComp.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/McIoComp.h
new file mode 100644
index 0000000..94eb0f0
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/McIoComp.h
@@ -0,0 +1,648 @@
+/** @file
+ This file was automatically generated. Modify at your own risk.
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef __McIoComp_h__
+#define __McIoComp_h__
+
+#pragma pack(push, 1)
+#include "MrcTypes.h"
+
+typedef union {
+ struct {
+ U32 RcompDrvUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompDrvDown : 6; // Bits 14:9
+ U32 VTComp : 5; // Bits 19:15
+ U32 TcoComp : 6; // Bits 25:20
+ U32 SlewRateComp : 5; // Bits 30:26
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCOMP_CR_DDRCRDATACOMP0_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcompOdtUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompOdtDown : 6; // Bits 14:9
+ U32 Spare1 : 1; // Bits 15:15
+ U32 PanicDrvDn : 6; // Bits 21:16
+ U32 PanicDrvUp : 6; // Bits 27:22
+ U32 LevelShifterComp : 3; // Bits 30:28
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCOMP_CR_DDRCRDATACOMP1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Scomp : 6; // Bits 5:0
+ U32 TcoComp : 6; // Bits 11:6
+ U32 RcompDrvUp : 6; // Bits 17:12
+ U32 RcompDrvDown : 6; // Bits 23:18
+ U32 LsComp : 3; // Bits 26:24
+ U32 Spare : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCOMP_CR_DDRCRCMDCOMP_STRUCT;
+
+typedef union {
+ struct {
+ U32 Scomp : 6; // Bits 5:0
+ U32 TcoComp : 6; // Bits 11:6
+ U32 RcompDrvUp : 6; // Bits 17:12
+ U32 RcompDrvDown : 6; // Bits 23:18
+ U32 LsComp : 4; // Bits 27:24
+ U32 Spare : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCOMP_CR_DDRCRCTLCOMP_STRUCT;
+
+typedef union {
+ struct {
+ U32 Scomp : 5; // Bits 4:0
+ U32 TcoComp : 6; // Bits 10:5
+ U32 RcompDrvUp : 6; // Bits 16:11
+ U32 RcompDrvDown : 6; // Bits 22:17
+ U32 LsComp : 4; // Bits 26:23
+ U32 Spare : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCOMP_CR_DDRCRCLKCOMP_STRUCT;
+
+typedef union {
+ struct {
+ U32 Rsvd : 3; // Bits 2:0
+ U32 DisableOdtStatic : 1; // Bits 3:3
+ U32 DqOdtUpDnOff : 6; // Bits 9:4
+ U32 FixOdtD : 1; // Bits 10:10
+ U32 DqDrvVref : 4; // Bits 14:11
+ U32 DqOdtVref : 5; // Bits 19:15
+ U32 CmdDrvVref : 4; // Bits 23:20
+ U32 CtlDrvVref : 4; // Bits 27:24
+ U32 ClkDrvVref : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCOMP_CR_DDRCRCOMPCTL0_STRUCT;
+
+typedef union {
+ struct {
+ U32 DqScompCells : 4; // Bits 3:0
+ U32 DqScompPC : 1; // Bits 4:4
+ U32 CmdScompCells : 4; // Bits 8:5
+ U32 CmdScompPC : 1; // Bits 9:9
+ U32 CtlScompCells : 4; // Bits 13:10
+ U32 CtlScompPC : 1; // Bits 14:14
+ U32 ClkScompCells : 4; // Bits 18:15
+ U32 ClkScompPC : 1; // Bits 19:19
+ U32 TcoCmdOffset : 4; // Bits 23:20
+ U32 CompClkOn : 1; // Bits 24:24
+ U32 VccddqHi : 1; // Bits 25:25
+ U32 spare : 3; // Bits 28:26
+ U32 DisableQuickComp : 1; // Bits 29:29
+ U32 SinStep : 1; // Bits 30:30
+ U32 SinStepAdv : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCOMP_CR_DDRCRCOMPCTL1_STRUCT;
+
+typedef union {
+ struct {
+ U32 PanicDrvDnVref : 6; // Bits 5:0
+ U32 PanicDrvUpVref : 6; // Bits 11:6
+ U32 VtOffset : 5; // Bits 16:12
+ U32 VtSlopeA : 3; // Bits 19:17
+ U32 VtSlopeB : 3; // Bits 22:20
+ U32 Spare : 9; // Bits 31:23
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCOMP_CR_DDRCRCOMPVSSHI_STRUCT;
+
+typedef union {
+ struct {
+ U32 DqDrvU : 1; // Bits 0:0
+ U32 DqDrvD : 1; // Bits 1:1
+ U32 DqOdtU : 1; // Bits 2:2
+ U32 DqOdtD : 1; // Bits 3:3
+ U32 CmdDrvU : 1; // Bits 4:4
+ U32 CmdDrvD : 1; // Bits 5:5
+ U32 CtlDrvU : 1; // Bits 6:6
+ U32 CtlDrvD : 1; // Bits 7:7
+ U32 ClkDrvU : 1; // Bits 8:8
+ U32 ClkDrvD : 1; // Bits 9:9
+ U32 DqSR : 1; // Bits 10:10
+ U32 CmdSR : 1; // Bits 11:11
+ U32 CtlSR : 1; // Bits 12:12
+ U32 ClkSR : 1; // Bits 13:13
+ U32 DqTcoOff : 1; // Bits 14:14
+ U32 CmdTcoOff : 1; // Bits 15:15
+ U32 DqTco : 1; // Bits 16:16
+ U32 CmdTco : 1; // Bits 17:17
+ U32 CtlTco : 1; // Bits 18:18
+ U32 ClkTco : 1; // Bits 19:19
+ U32 Spare1 : 1; // Bits 20:20
+ U32 PanicDrvUp : 1; // Bits 21:21
+ U32 PanicDrvDn : 1; // Bits 22:22
+ U32 VTComp : 1; // Bits 23:23
+ U32 LsComp : 3; // Bits 26:24
+ U32 Spare2 : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCOMP_CR_DDRCRCOMPOVR_STRUCT;
+
+typedef union {
+ struct {
+ U32 Target : 6; // Bits 5:0
+ U32 HiBWDivider : 2; // Bits 7:6
+ U32 LoBWDivider : 2; // Bits 9:8
+ U32 SampleDivider : 3; // Bits 12:10
+ U32 OpenLoop : 1; // Bits 13:13
+ U32 BWError : 2; // Bits 15:14
+ U32 PanicEn : 1; // Bits 16:16
+ U32 Rsvd : 1; // Bits 17:17
+ U32 PanicVoltage : 4; // Bits 21:18
+ U32 GainBoost : 1; // Bits 22:22
+ U32 SelCode : 1; // Bits 23:23
+ U32 OutputCode : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_STRUCT;
+
+#define DDRCOMP_CR_DDRCRDATACOMP0_REG (0x00003A00)
+ #define DDRCOMP_CR_DDRCRDATACOMP0_RcompDrvUp_OFF ( 0)
+ #define DDRCOMP_CR_DDRCRDATACOMP0_RcompDrvUp_WID ( 6)
+ #define DDRCOMP_CR_DDRCRDATACOMP0_RcompDrvUp_MSK (0x0000003F)
+ #define DDRCOMP_CR_DDRCRDATACOMP0_RcompDrvUp_MAX (0x0000003F)
+ #define DDRCOMP_CR_DDRCRDATACOMP0_Spare0_OFF ( 6)
+ #define DDRCOMP_CR_DDRCRDATACOMP0_Spare0_WID ( 3)
+ #define DDRCOMP_CR_DDRCRDATACOMP0_Spare0_MSK (0x000001C0)
+ #define DDRCOMP_CR_DDRCRDATACOMP0_Spare0_MAX (0x00000007)
+ #define DDRCOMP_CR_DDRCRDATACOMP0_RcompDrvDown_OFF ( 9)
+ #define DDRCOMP_CR_DDRCRDATACOMP0_RcompDrvDown_WID ( 6)
+ #define DDRCOMP_CR_DDRCRDATACOMP0_RcompDrvDown_MSK (0x00007E00)
+ #define DDRCOMP_CR_DDRCRDATACOMP0_RcompDrvDown_MAX (0x0000003F)
+ #define DDRCOMP_CR_DDRCRDATACOMP0_VTComp_OFF (15)
+ #define DDRCOMP_CR_DDRCRDATACOMP0_VTComp_WID ( 5)
+ #define DDRCOMP_CR_DDRCRDATACOMP0_VTComp_MSK (0x000F8000)
+ #define DDRCOMP_CR_DDRCRDATACOMP0_VTComp_MAX (0x0000001F)
+ #define DDRCOMP_CR_DDRCRDATACOMP0_VTComp_DEF (0x00000005)
+ #define DDRCOMP_CR_DDRCRDATACOMP0_TcoComp_OFF (20)
+ #define DDRCOMP_CR_DDRCRDATACOMP0_TcoComp_WID ( 6)
+ #define DDRCOMP_CR_DDRCRDATACOMP0_TcoComp_MSK (0x03F00000)
+ #define DDRCOMP_CR_DDRCRDATACOMP0_TcoComp_MAX (0x0000003F)
+ #define DDRCOMP_CR_DDRCRDATACOMP0_SlewRateComp_OFF (26)
+ #define DDRCOMP_CR_DDRCRDATACOMP0_SlewRateComp_WID ( 5)
+ #define DDRCOMP_CR_DDRCRDATACOMP0_SlewRateComp_MSK (0x7C000000)
+ #define DDRCOMP_CR_DDRCRDATACOMP0_SlewRateComp_MAX (0x0000001F)
+ #define DDRCOMP_CR_DDRCRDATACOMP0_Spare2_OFF (31)
+ #define DDRCOMP_CR_DDRCRDATACOMP0_Spare2_WID ( 1)
+ #define DDRCOMP_CR_DDRCRDATACOMP0_Spare2_MSK (0x80000000)
+ #define DDRCOMP_CR_DDRCRDATACOMP0_Spare2_MAX (0x00000001)
+
+#define DDRCOMP_CR_DDRCRDATACOMP1_REG (0x00003A04)
+ #define DDRCOMP_CR_DDRCRDATACOMP1_RcompOdtUp_OFF ( 0)
+ #define DDRCOMP_CR_DDRCRDATACOMP1_RcompOdtUp_WID ( 6)
+ #define DDRCOMP_CR_DDRCRDATACOMP1_RcompOdtUp_MSK (0x0000003F)
+ #define DDRCOMP_CR_DDRCRDATACOMP1_RcompOdtUp_MAX (0x0000003F)
+ #define DDRCOMP_CR_DDRCRDATACOMP1_Spare0_OFF ( 6)
+ #define DDRCOMP_CR_DDRCRDATACOMP1_Spare0_WID ( 3)
+ #define DDRCOMP_CR_DDRCRDATACOMP1_Spare0_MSK (0x000001C0)
+ #define DDRCOMP_CR_DDRCRDATACOMP1_Spare0_MAX (0x00000007)
+ #define DDRCOMP_CR_DDRCRDATACOMP1_RcompOdtDown_OFF ( 9)
+ #define DDRCOMP_CR_DDRCRDATACOMP1_RcompOdtDown_WID ( 6)
+ #define DDRCOMP_CR_DDRCRDATACOMP1_RcompOdtDown_MSK (0x00007E00)
+ #define DDRCOMP_CR_DDRCRDATACOMP1_RcompOdtDown_MAX (0x0000003F)
+ #define DDRCOMP_CR_DDRCRDATACOMP1_Spare1_OFF (15)
+ #define DDRCOMP_CR_DDRCRDATACOMP1_Spare1_WID ( 1)
+ #define DDRCOMP_CR_DDRCRDATACOMP1_Spare1_MSK (0x00008000)
+ #define DDRCOMP_CR_DDRCRDATACOMP1_Spare1_MAX (0x00000001)
+ #define DDRCOMP_CR_DDRCRDATACOMP1_PanicDrvDn_OFF (16)
+ #define DDRCOMP_CR_DDRCRDATACOMP1_PanicDrvDn_WID ( 6)
+ #define DDRCOMP_CR_DDRCRDATACOMP1_PanicDrvDn_MSK (0x003F0000)
+ #define DDRCOMP_CR_DDRCRDATACOMP1_PanicDrvDn_MAX (0x0000003F)
+ #define DDRCOMP_CR_DDRCRDATACOMP1_PanicDrvDn_DEF (0x00000010)
+ #define DDRCOMP_CR_DDRCRDATACOMP1_PanicDrvUp_OFF (22)
+ #define DDRCOMP_CR_DDRCRDATACOMP1_PanicDrvUp_WID ( 6)
+ #define DDRCOMP_CR_DDRCRDATACOMP1_PanicDrvUp_MSK (0x0FC00000)
+ #define DDRCOMP_CR_DDRCRDATACOMP1_PanicDrvUp_MAX (0x0000003F)
+ #define DDRCOMP_CR_DDRCRDATACOMP1_PanicDrvUp_DEF (0x00000010)
+ #define DDRCOMP_CR_DDRCRDATACOMP1_LevelShifterComp_OFF (28)
+ #define DDRCOMP_CR_DDRCRDATACOMP1_LevelShifterComp_WID ( 3)
+ #define DDRCOMP_CR_DDRCRDATACOMP1_LevelShifterComp_MSK (0x70000000)
+ #define DDRCOMP_CR_DDRCRDATACOMP1_LevelShifterComp_MAX (0x00000007)
+ #define DDRCOMP_CR_DDRCRDATACOMP1_LevelShifterComp_DEF (0x00000004)
+ #define DDRCOMP_CR_DDRCRDATACOMP1_Spare2_OFF (31)
+ #define DDRCOMP_CR_DDRCRDATACOMP1_Spare2_WID ( 1)
+ #define DDRCOMP_CR_DDRCRDATACOMP1_Spare2_MSK (0x80000000)
+ #define DDRCOMP_CR_DDRCRDATACOMP1_Spare2_MAX (0x00000001)
+
+#define DDRCOMP_CR_DDRCRCMDCOMP_REG (0x00003A08)
+ #define DDRCOMP_CR_DDRCRCMDCOMP_Scomp_OFF ( 0)
+ #define DDRCOMP_CR_DDRCRCMDCOMP_Scomp_WID ( 6)
+ #define DDRCOMP_CR_DDRCRCMDCOMP_Scomp_MSK (0x0000003F)
+ #define DDRCOMP_CR_DDRCRCMDCOMP_Scomp_MAX (0x0000003F)
+ #define DDRCOMP_CR_DDRCRCMDCOMP_TcoComp_OFF ( 6)
+ #define DDRCOMP_CR_DDRCRCMDCOMP_TcoComp_WID ( 6)
+ #define DDRCOMP_CR_DDRCRCMDCOMP_TcoComp_MSK (0x00000FC0)
+ #define DDRCOMP_CR_DDRCRCMDCOMP_TcoComp_MAX (0x0000003F)
+ #define DDRCOMP_CR_DDRCRCMDCOMP_RcompDrvUp_OFF (12)
+ #define DDRCOMP_CR_DDRCRCMDCOMP_RcompDrvUp_WID ( 6)
+ #define DDRCOMP_CR_DDRCRCMDCOMP_RcompDrvUp_MSK (0x0003F000)
+ #define DDRCOMP_CR_DDRCRCMDCOMP_RcompDrvUp_MAX (0x0000003F)
+ #define DDRCOMP_CR_DDRCRCMDCOMP_RcompDrvDown_OFF (18)
+ #define DDRCOMP_CR_DDRCRCMDCOMP_RcompDrvDown_WID ( 6)
+ #define DDRCOMP_CR_DDRCRCMDCOMP_RcompDrvDown_MSK (0x00FC0000)
+ #define DDRCOMP_CR_DDRCRCMDCOMP_RcompDrvDown_MAX (0x0000003F)
+ #define DDRCOMP_CR_DDRCRCMDCOMP_LsComp_OFF (24)
+ #define DDRCOMP_CR_DDRCRCMDCOMP_LsComp_WID ( 3)
+ #define DDRCOMP_CR_DDRCRCMDCOMP_LsComp_MSK (0x07000000)
+ #define DDRCOMP_CR_DDRCRCMDCOMP_LsComp_MAX (0x00000007)
+ #define DDRCOMP_CR_DDRCRCMDCOMP_LsComp_DEF (0x00000004)
+ #define DDRCOMP_CR_DDRCRCMDCOMP_Spare_OFF (27)
+ #define DDRCOMP_CR_DDRCRCMDCOMP_Spare_WID ( 5)
+ #define DDRCOMP_CR_DDRCRCMDCOMP_Spare_MSK (0xF8000000)
+ #define DDRCOMP_CR_DDRCRCMDCOMP_Spare_MAX (0x0000001F)
+
+#define DDRCOMP_CR_DDRCRCTLCOMP_REG (0x00003A0C)
+ #define DDRCOMP_CR_DDRCRCTLCOMP_Scomp_OFF ( 0)
+ #define DDRCOMP_CR_DDRCRCTLCOMP_Scomp_WID ( 6)
+ #define DDRCOMP_CR_DDRCRCTLCOMP_Scomp_MSK (0x0000003F)
+ #define DDRCOMP_CR_DDRCRCTLCOMP_Scomp_MAX (0x0000003F)
+ #define DDRCOMP_CR_DDRCRCTLCOMP_TcoComp_OFF ( 6)
+ #define DDRCOMP_CR_DDRCRCTLCOMP_TcoComp_WID ( 6)
+ #define DDRCOMP_CR_DDRCRCTLCOMP_TcoComp_MSK (0x00000FC0)
+ #define DDRCOMP_CR_DDRCRCTLCOMP_TcoComp_MAX (0x0000003F)
+ #define DDRCOMP_CR_DDRCRCTLCOMP_RcompDrvUp_OFF (12)
+ #define DDRCOMP_CR_DDRCRCTLCOMP_RcompDrvUp_WID ( 6)
+ #define DDRCOMP_CR_DDRCRCTLCOMP_RcompDrvUp_MSK (0x0003F000)
+ #define DDRCOMP_CR_DDRCRCTLCOMP_RcompDrvUp_MAX (0x0000003F)
+ #define DDRCOMP_CR_DDRCRCTLCOMP_RcompDrvDown_OFF (18)
+ #define DDRCOMP_CR_DDRCRCTLCOMP_RcompDrvDown_WID ( 6)
+ #define DDRCOMP_CR_DDRCRCTLCOMP_RcompDrvDown_MSK (0x00FC0000)
+ #define DDRCOMP_CR_DDRCRCTLCOMP_RcompDrvDown_MAX (0x0000003F)
+ #define DDRCOMP_CR_DDRCRCTLCOMP_LsComp_OFF (24)
+ #define DDRCOMP_CR_DDRCRCTLCOMP_LsComp_WID ( 4)
+ #define DDRCOMP_CR_DDRCRCTLCOMP_LsComp_MSK (0x0F000000)
+ #define DDRCOMP_CR_DDRCRCTLCOMP_LsComp_MAX (0x0000000F)
+ #define DDRCOMP_CR_DDRCRCTLCOMP_LsComp_DEF (0x00000004)
+ #define DDRCOMP_CR_DDRCRCTLCOMP_Spare_OFF (28)
+ #define DDRCOMP_CR_DDRCRCTLCOMP_Spare_WID ( 4)
+ #define DDRCOMP_CR_DDRCRCTLCOMP_Spare_MSK (0xF0000000)
+ #define DDRCOMP_CR_DDRCRCTLCOMP_Spare_MAX (0x0000000F)
+
+#define DDRCOMP_CR_DDRCRCLKCOMP_REG (0x00003A10)
+ #define DDRCOMP_CR_DDRCRCLKCOMP_Scomp_OFF ( 0)
+ #define DDRCOMP_CR_DDRCRCLKCOMP_Scomp_WID ( 5)
+ #define DDRCOMP_CR_DDRCRCLKCOMP_Scomp_MSK (0x0000001F)
+ #define DDRCOMP_CR_DDRCRCLKCOMP_Scomp_MAX (0x0000001F)
+ #define DDRCOMP_CR_DDRCRCLKCOMP_TcoComp_OFF ( 5)
+ #define DDRCOMP_CR_DDRCRCLKCOMP_TcoComp_WID ( 6)
+ #define DDRCOMP_CR_DDRCRCLKCOMP_TcoComp_MSK (0x000007E0)
+ #define DDRCOMP_CR_DDRCRCLKCOMP_TcoComp_MAX (0x0000003F)
+ #define DDRCOMP_CR_DDRCRCLKCOMP_RcompDrvUp_OFF (11)
+ #define DDRCOMP_CR_DDRCRCLKCOMP_RcompDrvUp_WID ( 6)
+ #define DDRCOMP_CR_DDRCRCLKCOMP_RcompDrvUp_MSK (0x0001F800)
+ #define DDRCOMP_CR_DDRCRCLKCOMP_RcompDrvUp_MAX (0x0000003F)
+ #define DDRCOMP_CR_DDRCRCLKCOMP_RcompDrvDown_OFF (17)
+ #define DDRCOMP_CR_DDRCRCLKCOMP_RcompDrvDown_WID ( 6)
+ #define DDRCOMP_CR_DDRCRCLKCOMP_RcompDrvDown_MSK (0x007E0000)
+ #define DDRCOMP_CR_DDRCRCLKCOMP_RcompDrvDown_MAX (0x0000003F)
+ #define DDRCOMP_CR_DDRCRCLKCOMP_LsComp_OFF (23)
+ #define DDRCOMP_CR_DDRCRCLKCOMP_LsComp_WID ( 4)
+ #define DDRCOMP_CR_DDRCRCLKCOMP_LsComp_MSK (0x07800000)
+ #define DDRCOMP_CR_DDRCRCLKCOMP_LsComp_MAX (0x0000000F)
+ #define DDRCOMP_CR_DDRCRCLKCOMP_LsComp_DEF (0x00000004)
+ #define DDRCOMP_CR_DDRCRCLKCOMP_Spare_OFF (27)
+ #define DDRCOMP_CR_DDRCRCLKCOMP_Spare_WID ( 5)
+ #define DDRCOMP_CR_DDRCRCLKCOMP_Spare_MSK (0xF8000000)
+ #define DDRCOMP_CR_DDRCRCLKCOMP_Spare_MAX (0x0000001F)
+
+#define DDRCOMP_CR_DDRCRCOMPCTL0_REG (0x00003A14)
+ #define DDRCOMP_CR_DDRCRCOMPCTL0_Rsvd_OFF ( 0)
+ #define DDRCOMP_CR_DDRCRCOMPCTL0_Rsvd_WID ( 3)
+ #define DDRCOMP_CR_DDRCRCOMPCTL0_Rsvd_MSK (0x00000007)
+ #define DDRCOMP_CR_DDRCRCOMPCTL0_Rsvd_MAX (0x00000007)
+ #define DDRCOMP_CR_DDRCRCOMPCTL0_DisableOdtStatic_OFF ( 3)
+ #define DDRCOMP_CR_DDRCRCOMPCTL0_DisableOdtStatic_WID ( 1)
+ #define DDRCOMP_CR_DDRCRCOMPCTL0_DisableOdtStatic_MSK (0x00000008)
+ #define DDRCOMP_CR_DDRCRCOMPCTL0_DisableOdtStatic_MAX (0x00000001)
+ #define DDRCOMP_CR_DDRCRCOMPCTL0_DqOdtUpDnOff_OFF ( 4)
+ #define DDRCOMP_CR_DDRCRCOMPCTL0_DqOdtUpDnOff_WID ( 6)
+ #define DDRCOMP_CR_DDRCRCOMPCTL0_DqOdtUpDnOff_MSK (0x000003F0)
+ #define DDRCOMP_CR_DDRCRCOMPCTL0_DqOdtUpDnOff_MAX (0x0000003F)
+ #define DDRCOMP_CR_DDRCRCOMPCTL0_FixOdtD_OFF (10)
+ #define DDRCOMP_CR_DDRCRCOMPCTL0_FixOdtD_WID ( 1)
+ #define DDRCOMP_CR_DDRCRCOMPCTL0_FixOdtD_MSK (0x00000400)
+ #define DDRCOMP_CR_DDRCRCOMPCTL0_FixOdtD_MAX (0x00000001)
+ #define DDRCOMP_CR_DDRCRCOMPCTL0_DqDrvVref_OFF (11)
+ #define DDRCOMP_CR_DDRCRCOMPCTL0_DqDrvVref_WID ( 4)
+ #define DDRCOMP_CR_DDRCRCOMPCTL0_DqDrvVref_MSK (0x00007800)
+ #define DDRCOMP_CR_DDRCRCOMPCTL0_DqDrvVref_MAX (0x0000000F)
+ #define DDRCOMP_CR_DDRCRCOMPCTL0_DqOdtVref_OFF (15)
+ #define DDRCOMP_CR_DDRCRCOMPCTL0_DqOdtVref_WID ( 5)
+ #define DDRCOMP_CR_DDRCRCOMPCTL0_DqOdtVref_MSK (0x000F8000)
+ #define DDRCOMP_CR_DDRCRCOMPCTL0_DqOdtVref_MAX (0x0000001F)
+ #define DDRCOMP_CR_DDRCRCOMPCTL0_CmdDrvVref_OFF (20)
+ #define DDRCOMP_CR_DDRCRCOMPCTL0_CmdDrvVref_WID ( 4)
+ #define DDRCOMP_CR_DDRCRCOMPCTL0_CmdDrvVref_MSK (0x00F00000)
+ #define DDRCOMP_CR_DDRCRCOMPCTL0_CmdDrvVref_MAX (0x0000000F)
+ #define DDRCOMP_CR_DDRCRCOMPCTL0_CtlDrvVref_OFF (24)
+ #define DDRCOMP_CR_DDRCRCOMPCTL0_CtlDrvVref_WID ( 4)
+ #define DDRCOMP_CR_DDRCRCOMPCTL0_CtlDrvVref_MSK (0x0F000000)
+ #define DDRCOMP_CR_DDRCRCOMPCTL0_CtlDrvVref_MAX (0x0000000F)
+ #define DDRCOMP_CR_DDRCRCOMPCTL0_ClkDrvVref_OFF (28)
+ #define DDRCOMP_CR_DDRCRCOMPCTL0_ClkDrvVref_WID ( 4)
+ #define DDRCOMP_CR_DDRCRCOMPCTL0_ClkDrvVref_MSK (0xF0000000)
+ #define DDRCOMP_CR_DDRCRCOMPCTL0_ClkDrvVref_MAX (0x0000000F)
+
+#define DDRCOMP_CR_DDRCRCOMPCTL1_REG (0x00003A18)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_DqScompCells_OFF ( 0)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_DqScompCells_WID ( 4)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_DqScompCells_MSK (0x0000000F)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_DqScompCells_MAX (0x0000000F)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_DqScompPC_OFF ( 4)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_DqScompPC_WID ( 1)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_DqScompPC_MSK (0x00000010)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_DqScompPC_MAX (0x00000001)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_CmdScompCells_OFF ( 5)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_CmdScompCells_WID ( 4)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_CmdScompCells_MSK (0x000001E0)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_CmdScompCells_MAX (0x0000000F)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_CmdScompPC_OFF ( 9)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_CmdScompPC_WID ( 1)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_CmdScompPC_MSK (0x00000200)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_CmdScompPC_MAX (0x00000001)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_CtlScompCells_OFF (10)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_CtlScompCells_WID ( 4)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_CtlScompCells_MSK (0x00003C00)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_CtlScompCells_MAX (0x0000000F)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_CtlScompPC_OFF (14)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_CtlScompPC_WID ( 1)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_CtlScompPC_MSK (0x00004000)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_CtlScompPC_MAX (0x00000001)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_ClkScompCells_OFF (15)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_ClkScompCells_WID ( 4)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_ClkScompCells_MSK (0x00078000)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_ClkScompCells_MAX (0x0000000F)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_ClkScompPC_OFF (19)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_ClkScompPC_WID ( 1)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_ClkScompPC_MSK (0x00080000)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_ClkScompPC_MAX (0x00000001)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_TcoCmdOffset_OFF (20)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_TcoCmdOffset_WID ( 4)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_TcoCmdOffset_MSK (0x00F00000)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_TcoCmdOffset_MAX (0x0000000F)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_CompClkOn_OFF (24)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_CompClkOn_WID ( 1)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_CompClkOn_MSK (0x01000000)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_CompClkOn_MAX (0x00000001)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_VccddqHi_OFF (25)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_VccddqHi_WID ( 1)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_VccddqHi_MSK (0x02000000)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_VccddqHi_MAX (0x00000001)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_spare_OFF (26)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_spare_WID ( 3)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_spare_MSK (0x1C000000)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_spare_MAX (0x00000007)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_DisableQuickComp_OFF (29)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_DisableQuickComp_WID ( 1)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_DisableQuickComp_MSK (0x20000000)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_DisableQuickComp_MAX (0x00000001)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_SinStep_OFF (30)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_SinStep_WID ( 1)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_SinStep_MSK (0x40000000)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_SinStep_MAX (0x00000001)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_SinStepAdv_OFF (31)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_SinStepAdv_WID ( 1)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_SinStepAdv_MSK (0x80000000)
+ #define DDRCOMP_CR_DDRCRCOMPCTL1_SinStepAdv_MAX (0x00000001)
+
+#define DDRCOMP_CR_DDRCRCOMPVSSHI_REG (0x00003A1C)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHI_PanicDrvDnVref_OFF ( 0)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHI_PanicDrvDnVref_WID ( 6)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHI_PanicDrvDnVref_MSK (0x0000003F)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHI_PanicDrvDnVref_MAX (0x0000003F)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHI_PanicDrvUpVref_OFF ( 6)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHI_PanicDrvUpVref_WID ( 6)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHI_PanicDrvUpVref_MSK (0x00000FC0)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHI_PanicDrvUpVref_MAX (0x0000003F)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHI_VtOffset_OFF (12)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHI_VtOffset_WID ( 5)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHI_VtOffset_MSK (0x0001F000)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHI_VtOffset_MAX (0x0000001F)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHI_VtSlopeA_OFF (17)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHI_VtSlopeA_WID ( 3)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHI_VtSlopeA_MSK (0x000E0000)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHI_VtSlopeA_MAX (0x00000007)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHI_VtSlopeB_OFF (20)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHI_VtSlopeB_WID ( 3)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHI_VtSlopeB_MSK (0x00700000)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHI_VtSlopeB_MAX (0x00000007)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHI_Spare_OFF (23)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHI_Spare_WID ( 9)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHI_Spare_MSK (0xFF800000)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHI_Spare_MAX (0x000001FF)
+
+#define DDRCOMP_CR_DDRCRCOMPOVR_REG (0x00003A20)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_DqDrvU_OFF ( 0)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_DqDrvU_WID ( 1)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_DqDrvU_MSK (0x00000001)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_DqDrvU_MAX (0x00000001)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_DqDrvD_OFF ( 1)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_DqDrvD_WID ( 1)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_DqDrvD_MSK (0x00000002)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_DqDrvD_MAX (0x00000001)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_DqOdtU_OFF ( 2)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_DqOdtU_WID ( 1)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_DqOdtU_MSK (0x00000004)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_DqOdtU_MAX (0x00000001)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_DqOdtD_OFF ( 3)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_DqOdtD_WID ( 1)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_DqOdtD_MSK (0x00000008)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_DqOdtD_MAX (0x00000001)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_CmdDrvU_OFF ( 4)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_CmdDrvU_WID ( 1)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_CmdDrvU_MSK (0x00000010)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_CmdDrvU_MAX (0x00000001)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_CmdDrvD_OFF ( 5)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_CmdDrvD_WID ( 1)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_CmdDrvD_MSK (0x00000020)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_CmdDrvD_MAX (0x00000001)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_CtlDrvU_OFF ( 6)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_CtlDrvU_WID ( 1)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_CtlDrvU_MSK (0x00000040)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_CtlDrvU_MAX (0x00000001)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_CtlDrvD_OFF ( 7)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_CtlDrvD_WID ( 1)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_CtlDrvD_MSK (0x00000080)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_CtlDrvD_MAX (0x00000001)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_ClkDrvU_OFF ( 8)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_ClkDrvU_WID ( 1)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_ClkDrvU_MSK (0x00000100)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_ClkDrvU_MAX (0x00000001)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_ClkDrvD_OFF ( 9)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_ClkDrvD_WID ( 1)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_ClkDrvD_MSK (0x00000200)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_ClkDrvD_MAX (0x00000001)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_DqSR_OFF (10)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_DqSR_WID ( 1)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_DqSR_MSK (0x00000400)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_DqSR_MAX (0x00000001)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_CmdSR_OFF (11)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_CmdSR_WID ( 1)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_CmdSR_MSK (0x00000800)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_CmdSR_MAX (0x00000001)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_CtlSR_OFF (12)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_CtlSR_WID ( 1)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_CtlSR_MSK (0x00001000)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_CtlSR_MAX (0x00000001)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_ClkSR_OFF (13)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_ClkSR_WID ( 1)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_ClkSR_MSK (0x00002000)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_ClkSR_MAX (0x00000001)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_DqTcoOff_OFF (14)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_DqTcoOff_WID ( 1)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_DqTcoOff_MSK (0x00004000)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_DqTcoOff_MAX (0x00000001)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_CmdTcoOff_OFF (15)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_CmdTcoOff_WID ( 1)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_CmdTcoOff_MSK (0x00008000)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_CmdTcoOff_MAX (0x00000001)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_DqTco_OFF (16)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_DqTco_WID ( 1)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_DqTco_MSK (0x00010000)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_DqTco_MAX (0x00000001)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_CmdTco_OFF (17)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_CmdTco_WID ( 1)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_CmdTco_MSK (0x00020000)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_CmdTco_MAX (0x00000001)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_CtlTco_OFF (18)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_CtlTco_WID ( 1)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_CtlTco_MSK (0x00040000)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_CtlTco_MAX (0x00000001)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_ClkTco_OFF (19)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_ClkTco_WID ( 1)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_ClkTco_MSK (0x00080000)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_ClkTco_MAX (0x00000001)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_Spare1_OFF (20)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_Spare1_WID ( 1)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_Spare1_MSK (0x00100000)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_Spare1_MAX (0x00000001)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_PanicDrvUp_OFF (21)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_PanicDrvUp_WID ( 1)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_PanicDrvUp_MSK (0x00200000)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_PanicDrvUp_MAX (0x00000001)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_PanicDrvDn_OFF (22)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_PanicDrvDn_WID ( 1)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_PanicDrvDn_MSK (0x00400000)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_PanicDrvDn_MAX (0x00000001)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_VTComp_OFF (23)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_VTComp_WID ( 1)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_VTComp_MSK (0x00800000)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_VTComp_MAX (0x00000001)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_LsComp_OFF (24)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_LsComp_WID ( 3)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_LsComp_MSK (0x07000000)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_LsComp_MAX (0x00000007)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_LsComp_DEF (0x00000004)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_Spare2_OFF (27)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_Spare2_WID ( 5)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_Spare2_MSK (0xF8000000)
+ #define DDRCOMP_CR_DDRCRCOMPOVR_Spare2_MAX (0x0000001F)
+
+#define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_REG (0x00003A24)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_Target_OFF ( 0)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_Target_WID ( 6)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_Target_MSK (0x0000003F)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_Target_MAX (0x0000003F)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_Target_DEF (0x00000038)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_HiBWDivider_OFF ( 6)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_HiBWDivider_WID ( 2)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_HiBWDivider_MSK (0x000000C0)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_HiBWDivider_MAX (0x00000003)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_HiBWDivider_DEF (0x00000000)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_LoBWDivider_OFF ( 8)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_LoBWDivider_WID ( 2)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_LoBWDivider_MSK (0x00000300)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_LoBWDivider_MAX (0x00000003)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_LoBWDivider_DEF (0x00000002)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_SampleDivider_OFF (10)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_SampleDivider_WID ( 3)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_SampleDivider_MSK (0x00001C00)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_SampleDivider_MAX (0x00000007)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_OpenLoop_OFF (13)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_OpenLoop_WID ( 1)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_OpenLoop_MSK (0x00002000)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_OpenLoop_MAX (0x00000001)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_BWError_OFF (14)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_BWError_WID ( 2)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_BWError_MSK (0x0000C000)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_BWError_MAX (0x00000003)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_BWError_DEF (0x00000002)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_PanicEn_OFF (16)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_PanicEn_WID ( 1)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_PanicEn_MSK (0x00010000)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_PanicEn_MAX (0x00000001)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_PanicEn_DEF (0x00000001)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_Rsvd_OFF (17)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_Rsvd_WID ( 1)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_Rsvd_MSK (0x00020000)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_Rsvd_MAX (0x00000001)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_PanicVoltage_OFF (18)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_PanicVoltage_WID ( 4)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_PanicVoltage_MSK (0x003C0000)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_PanicVoltage_MAX (0x0000000F)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_PanicVoltage_DEF (0x00000003)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_GainBoost_OFF (22)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_GainBoost_WID ( 1)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_GainBoost_MSK (0x00400000)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_GainBoost_MAX (0x00000001)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_GainBoost_DEF (0x00000001)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_SelCode_OFF (23)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_SelCode_WID ( 1)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_SelCode_MSK (0x00800000)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_SelCode_MAX (0x00000001)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_OutputCode_OFF (24)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_OutputCode_WID ( 8)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_OutputCode_MSK (0xFF000000)
+ #define DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_OutputCode_MAX (0x000000FF)
+
+#pragma pack(pop)
+#endif // __McIoComp_h__
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/McIoData.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/McIoData.h
new file mode 100644
index 0000000..4e6e898
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/McIoData.h
@@ -0,0 +1,31196 @@
+/** @file
+ This file was automatically generated. Modify at your own risk.
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef __McIoData_h__
+#define __McIoData_h__
+
+#pragma pack(push, 1)
+#include "MrcTypes.h"
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA_CR_RXTRAINRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA_CR_RXTRAINRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA_CR_RXTRAINRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA_CR_RXTRAINRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA_CR_RXPERBITRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA_CR_RXPERBITRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA_CR_RXPERBITRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA_CR_RXPERBITRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA_CR_TXTRAINRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA_CR_TXTRAINRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA_CR_TXTRAINRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA_CR_TXTRAINRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA_CR_TXPERBITRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA_CR_TXPERBITRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA_CR_TXPERBITRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA_CR_TXPERBITRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcompDrvUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompDrvDown : 6; // Bits 14:9
+ U32 VTComp : 5; // Bits 19:15
+ U32 TcoComp : 6; // Bits 25:20
+ U32 SlewRateComp : 5; // Bits 30:26
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA_CR_RCOMPDATA0_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcompOdtUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompOdtDown : 6; // Bits 14:9
+ U32 Spare1 : 1; // Bits 15:15
+ U32 PanicDrvDn : 6; // Bits 21:16
+ U32 PanicDrvUp : 6; // Bits 27:22
+ U32 LevelShifterComp : 3; // Bits 30:28
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA_CR_RCOMPDATA1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA_CR_TXXTALK_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA_CR_RXOFFSETVDQ_STRUCT;
+
+typedef union {
+ struct {
+ U32 Spare : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA_CR_DDRDATARESERVED_STRUCT;
+
+typedef union {
+ struct {
+ U32 DataTrainFeedback : 9; // Bits 8:0
+ U32 Spare : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA_CR_DATATRAINFEEDBACK_STRUCT;
+
+typedef union {
+ struct {
+ U32 RunTest : 1; // Bits 0:0
+ U32 Load : 1; // Bits 1:1
+ U32 ModeHVM : 1; // Bits 2:2
+ U32 ModeDV : 1; // Bits 3:3
+ U32 ModeADC : 1; // Bits 4:4
+ U32 LoadCount : 10; // Bits 14:5
+ U32 CountStatus : 10; // Bits 24:15
+ U32 Spare : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA_CR_DLLPITESTANDADC_STRUCT;
+
+typedef union {
+ struct {
+ U32 DqDrvUpCompOffset : 6; // Bits 5:0
+ U32 DqDrvDownCompOffset : 6; // Bits 11:6
+ U32 DqOdtUpCompOffset : 5; // Bits 16:12
+ U32 DqOdtDownCompOffset : 5; // Bits 21:17
+ U32 DqTcoCompOffset : 5; // Bits 26:22
+ U32 DqSlewRateCompOffset : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA_CR_DDRCRDATAOFFSETCOMP_STRUCT;
+
+typedef union {
+ struct {
+ U32 RefPi : 4; // Bits 3:0
+ U32 DllMask : 2; // Bits 5:4
+ U32 DllWeakLock : 1; // Bits 6:6
+ U32 SdllSegmentDisable : 3; // Bits 9:7
+ U32 RxBiasCtl : 3; // Bits 12:10
+ U32 OdtDelay : 4; // Bits 16:13
+ U32 OdtDuration : 3; // Bits 19:17
+ U32 SenseAmpDelay : 4; // Bits 23:20
+ U32 SenseAmpDuration : 3; // Bits 26:24
+ U32 BurstEndODTDelay : 3; // Bits 29:27
+ U32 LpDdrLongOdtEn : 1; // Bits 30:30
+ U32 Rsvd1 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA_CR_DDRCRDATACONTROL1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxStaggerCtl : 5; // Bits 4:0
+ U32 ForceBiasOn : 1; // Bits 5:5
+ U32 ForceRxOn : 1; // Bits 6:6
+ U32 LeakerComp : 2; // Bits 8:7
+ U32 RxDqsAmpOffset : 4; // Bits 12:9
+ U32 RxClkStgNum : 5; // Bits 17:13
+ U32 WlLongDelEn : 1; // Bits 18:18
+ U32 Spare : 13; // Bits 31:19
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA_CR_DDRCRDATACONTROL2_STRUCT;
+
+typedef union {
+ struct {
+ U32 VrefCtl : 24; // Bits 23:0
+ U32 OutputCode : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA_CR_DDRCRVREFCONTROL_STRUCT;
+
+typedef union {
+ struct {
+ U32 VssHiCtl : 24; // Bits 23:0
+ U32 OutputCode : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA_CR_DDRCRVSSHICONTROL_STRUCT;
+
+typedef union {
+ struct {
+ U32 VssHiOrVrefCtl : 24; // Bits 23:0
+ U32 OutputCode : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA_CR_DDRCRVSSHIORVREFCONTROL_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcvEnOffset : 6; // Bits 5:0
+ U32 RxDqsOffset : 6; // Bits 11:6
+ U32 TxDqOffset : 6; // Bits 17:12
+ U32 TxDqsOffset : 6; // Bits 23:18
+ U32 VrefOffset : 7; // Bits 30:24
+ U32 Spare : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA_CR_DDRCRDATAOFFSETTRAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxTrainingMode : 1; // Bits 0:0
+ U32 WLTrainingMode : 1; // Bits 1:1
+ U32 RLTrainingMode : 1; // Bits 2:2
+ U32 SenseampTrainingMode : 1; // Bits 3:3
+ U32 TxOn : 1; // Bits 4:4
+ U32 RfOn : 1; // Bits 5:5
+ U32 RxPiOn : 1; // Bits 6:6
+ U32 TxPiOn : 1; // Bits 7:7
+ U32 InternalClocksOn : 1; // Bits 8:8
+ U32 RepeaterClocksOn : 1; // Bits 9:9
+ U32 TxDisable : 1; // Bits 10:10
+ U32 RxDisable : 1; // Bits 11:11
+ U32 TxLong : 1; // Bits 12:12
+ U32 RxDqsCtle : 2; // Bits 14:13
+ U32 RxReadPointer : 3; // Bits 17:15
+ U32 DriverSegmentEnable : 1; // Bits 18:18
+ U32 DataVccddqHi : 1; // Bits 19:19
+ U32 ReadRFRd : 1; // Bits 20:20
+ U32 ReadRFWr : 1; // Bits 21:21
+ U32 ReadRFRank : 2; // Bits 23:22
+ U32 ForceOdtOn : 1; // Bits 24:24
+ U32 OdtSampOff : 1; // Bits 25:25
+ U32 DisableOdtStatic : 1; // Bits 26:26
+ U32 DdrCRForceODTOn : 1; // Bits 27:27
+ U32 LPDDR_Mode : 1; // Bits 28:28
+ U32 EnReadPreamble : 1; // Bits 29:29
+ U32 OdtSampExtendEn : 1; // Bits 30:30
+ U32 EarlyRleakEn : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA_CR_DDRCRDATACONTROL0_STRUCT;
+
+typedef union {
+ struct {
+ U32 CAVrefCtl : 7; // Bits 6:0
+ U32 Ch1VrefCtl : 7; // Bits 13:7
+ U32 Ch0VrefCtl : 7; // Bits 20:14
+ U32 EnDimmVrefCA : 1; // Bits 21:21
+ U32 EnDimmVrefCh1 : 1; // Bits 22:22
+ U32 EnDimmVrefCh0 : 1; // Bits 23:23
+ U32 HiZTimerCtrl : 2; // Bits 25:24
+ U32 VccddqHiQnnnH : 1; // Bits 26:26
+ U32 Rsvd : 2; // Bits 28:27
+ U32 caSlowBW : 1; // Bits 29:29
+ U32 ch0SlowBW : 1; // Bits 30:30
+ U32 ch1SlowBW : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA_CR_DDRCRVREFADJUST1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH0_CR_RXTRAINRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH0_CR_RXTRAINRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH0_CR_RXTRAINRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH0_CR_RXTRAINRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH0_CR_RXPERBITRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH0_CR_RXPERBITRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH0_CR_RXPERBITRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH0_CR_RXPERBITRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH0_CR_TXTRAINRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH0_CR_TXTRAINRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH0_CR_TXTRAINRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH0_CR_TXTRAINRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH0_CR_TXPERBITRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH0_CR_TXPERBITRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH0_CR_TXPERBITRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH0_CR_TXPERBITRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcompDrvUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompDrvDown : 6; // Bits 14:9
+ U32 VTComp : 5; // Bits 19:15
+ U32 TcoComp : 6; // Bits 25:20
+ U32 SlewRateComp : 5; // Bits 30:26
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH0_CR_RCOMPDATA0_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcompOdtUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompOdtDown : 6; // Bits 14:9
+ U32 Spare1 : 1; // Bits 15:15
+ U32 PanicDrvDn : 6; // Bits 21:16
+ U32 PanicDrvUp : 6; // Bits 27:22
+ U32 LevelShifterComp : 3; // Bits 30:28
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH0_CR_RCOMPDATA1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH0_CR_TXXTALK_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH0_CR_RXOFFSETVDQ_STRUCT;
+
+typedef union {
+ struct {
+ U32 Spare : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH0_CR_DDRDATARESERVED_STRUCT;
+
+typedef union {
+ struct {
+ U32 DataTrainFeedback : 9; // Bits 8:0
+ U32 Spare : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH0_CR_DATATRAINFEEDBACK_STRUCT;
+
+typedef union {
+ struct {
+ U32 RunTest : 1; // Bits 0:0
+ U32 Load : 1; // Bits 1:1
+ U32 ModeHVM : 1; // Bits 2:2
+ U32 ModeDV : 1; // Bits 3:3
+ U32 ModeADC : 1; // Bits 4:4
+ U32 LoadCount : 10; // Bits 14:5
+ U32 CountStatus : 10; // Bits 24:15
+ U32 Spare : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH0_CR_DLLPITESTANDADC_STRUCT;
+
+typedef union {
+ struct {
+ U32 DqDrvUpCompOffset : 6; // Bits 5:0
+ U32 DqDrvDownCompOffset : 6; // Bits 11:6
+ U32 DqOdtUpCompOffset : 5; // Bits 16:12
+ U32 DqOdtDownCompOffset : 5; // Bits 21:17
+ U32 DqTcoCompOffset : 5; // Bits 26:22
+ U32 DqSlewRateCompOffset : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH0_CR_DDRCRDATAOFFSETCOMP_STRUCT;
+
+typedef union {
+ struct {
+ U32 RefPi : 4; // Bits 3:0
+ U32 DllMask : 2; // Bits 5:4
+ U32 DllWeakLock : 1; // Bits 6:6
+ U32 SdllSegmentDisable : 3; // Bits 9:7
+ U32 RxBiasCtl : 3; // Bits 12:10
+ U32 OdtDelay : 4; // Bits 16:13
+ U32 OdtDuration : 3; // Bits 19:17
+ U32 SenseAmpDelay : 4; // Bits 23:20
+ U32 SenseAmpDuration : 3; // Bits 26:24
+ U32 BurstEndODTDelay : 3; // Bits 29:27
+ U32 LpDdrLongOdtEn : 1; // Bits 30:30
+ U32 Rsvd1 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH0_CR_DDRCRDATACONTROL1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxStaggerCtl : 5; // Bits 4:0
+ U32 ForceBiasOn : 1; // Bits 5:5
+ U32 ForceRxOn : 1; // Bits 6:6
+ U32 LeakerComp : 2; // Bits 8:7
+ U32 RxDqsAmpOffset : 4; // Bits 12:9
+ U32 RxClkStgNum : 5; // Bits 17:13
+ U32 WlLongDelEn : 1; // Bits 18:18
+ U32 Spare : 13; // Bits 31:19
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH0_CR_DDRCRDATACONTROL2_STRUCT;
+
+typedef union {
+ struct {
+ U32 VssHiOrVrefCtl : 24; // Bits 23:0
+ U32 OutputCode : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH0_CR_DDRCRVSSHIORVREFCONTROL_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcvEnOffset : 6; // Bits 5:0
+ U32 RxDqsOffset : 6; // Bits 11:6
+ U32 TxDqOffset : 6; // Bits 17:12
+ U32 TxDqsOffset : 6; // Bits 23:18
+ U32 VrefOffset : 7; // Bits 30:24
+ U32 Spare : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH0_CR_DDRCRDATAOFFSETTRAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxTrainingMode : 1; // Bits 0:0
+ U32 WLTrainingMode : 1; // Bits 1:1
+ U32 RLTrainingMode : 1; // Bits 2:2
+ U32 SenseampTrainingMode : 1; // Bits 3:3
+ U32 TxOn : 1; // Bits 4:4
+ U32 RfOn : 1; // Bits 5:5
+ U32 RxPiOn : 1; // Bits 6:6
+ U32 TxPiOn : 1; // Bits 7:7
+ U32 InternalClocksOn : 1; // Bits 8:8
+ U32 RepeaterClocksOn : 1; // Bits 9:9
+ U32 TxDisable : 1; // Bits 10:10
+ U32 RxDisable : 1; // Bits 11:11
+ U32 TxLong : 1; // Bits 12:12
+ U32 RxDqsCtle : 2; // Bits 14:13
+ U32 RxReadPointer : 3; // Bits 17:15
+ U32 DriverSegmentEnable : 1; // Bits 18:18
+ U32 DataVccddqHi : 1; // Bits 19:19
+ U32 ReadRFRd : 1; // Bits 20:20
+ U32 ReadRFWr : 1; // Bits 21:21
+ U32 ReadRFRank : 2; // Bits 23:22
+ U32 ForceOdtOn : 1; // Bits 24:24
+ U32 OdtSampOff : 1; // Bits 25:25
+ U32 DisableOdtStatic : 1; // Bits 26:26
+ U32 DdrCRForceODTOn : 1; // Bits 27:27
+ U32 LPDDR_Mode : 1; // Bits 28:28
+ U32 EnReadPreamble : 1; // Bits 29:29
+ U32 OdtSampExtendEn : 1; // Bits 30:30
+ U32 EarlyRleakEn : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH0_CR_DDRCRDATACONTROL0_STRUCT;
+
+typedef union {
+ struct {
+ U32 CAVrefCtl : 7; // Bits 6:0
+ U32 Ch1VrefCtl : 7; // Bits 13:7
+ U32 Ch0VrefCtl : 7; // Bits 20:14
+ U32 EnDimmVrefCA : 1; // Bits 21:21
+ U32 EnDimmVrefCh1 : 1; // Bits 22:22
+ U32 EnDimmVrefCh0 : 1; // Bits 23:23
+ U32 HiZTimerCtrl : 2; // Bits 25:24
+ U32 VccddqHiQnnnH : 1; // Bits 26:26
+ U32 Rsvd : 2; // Bits 28:27
+ U32 caSlowBW : 1; // Bits 29:29
+ U32 ch0SlowBW : 1; // Bits 30:30
+ U32 ch1SlowBW : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH0_CR_DDRCRVREFADJUST1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH1_CR_RXTRAINRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH1_CR_RXTRAINRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH1_CR_RXTRAINRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH1_CR_RXTRAINRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH1_CR_RXPERBITRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH1_CR_RXPERBITRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH1_CR_RXPERBITRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH1_CR_RXPERBITRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH1_CR_TXTRAINRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH1_CR_TXTRAINRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH1_CR_TXTRAINRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH1_CR_TXTRAINRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH1_CR_TXPERBITRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH1_CR_TXPERBITRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH1_CR_TXPERBITRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH1_CR_TXPERBITRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcompDrvUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompDrvDown : 6; // Bits 14:9
+ U32 VTComp : 5; // Bits 19:15
+ U32 TcoComp : 6; // Bits 25:20
+ U32 SlewRateComp : 5; // Bits 30:26
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH1_CR_RCOMPDATA0_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcompOdtUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompOdtDown : 6; // Bits 14:9
+ U32 Spare1 : 1; // Bits 15:15
+ U32 PanicDrvDn : 6; // Bits 21:16
+ U32 PanicDrvUp : 6; // Bits 27:22
+ U32 LevelShifterComp : 3; // Bits 30:28
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH1_CR_RCOMPDATA1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH1_CR_TXXTALK_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH1_CR_RXOFFSETVDQ_STRUCT;
+
+typedef union {
+ struct {
+ U32 Spare : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH1_CR_DDRDATARESERVED_STRUCT;
+
+typedef union {
+ struct {
+ U32 DataTrainFeedback : 9; // Bits 8:0
+ U32 Spare : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH1_CR_DATATRAINFEEDBACK_STRUCT;
+
+typedef union {
+ struct {
+ U32 RunTest : 1; // Bits 0:0
+ U32 Load : 1; // Bits 1:1
+ U32 ModeHVM : 1; // Bits 2:2
+ U32 ModeDV : 1; // Bits 3:3
+ U32 ModeADC : 1; // Bits 4:4
+ U32 LoadCount : 10; // Bits 14:5
+ U32 CountStatus : 10; // Bits 24:15
+ U32 Spare : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH1_CR_DLLPITESTANDADC_STRUCT;
+
+typedef union {
+ struct {
+ U32 DqDrvUpCompOffset : 6; // Bits 5:0
+ U32 DqDrvDownCompOffset : 6; // Bits 11:6
+ U32 DqOdtUpCompOffset : 5; // Bits 16:12
+ U32 DqOdtDownCompOffset : 5; // Bits 21:17
+ U32 DqTcoCompOffset : 5; // Bits 26:22
+ U32 DqSlewRateCompOffset : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH1_CR_DDRCRDATAOFFSETCOMP_STRUCT;
+
+typedef union {
+ struct {
+ U32 RefPi : 4; // Bits 3:0
+ U32 DllMask : 2; // Bits 5:4
+ U32 DllWeakLock : 1; // Bits 6:6
+ U32 SdllSegmentDisable : 3; // Bits 9:7
+ U32 RxBiasCtl : 3; // Bits 12:10
+ U32 OdtDelay : 4; // Bits 16:13
+ U32 OdtDuration : 3; // Bits 19:17
+ U32 SenseAmpDelay : 4; // Bits 23:20
+ U32 SenseAmpDuration : 3; // Bits 26:24
+ U32 BurstEndODTDelay : 3; // Bits 29:27
+ U32 LpDdrLongOdtEn : 1; // Bits 30:30
+ U32 Rsvd1 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH1_CR_DDRCRDATACONTROL1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxStaggerCtl : 5; // Bits 4:0
+ U32 ForceBiasOn : 1; // Bits 5:5
+ U32 ForceRxOn : 1; // Bits 6:6
+ U32 LeakerComp : 2; // Bits 8:7
+ U32 RxDqsAmpOffset : 4; // Bits 12:9
+ U32 RxClkStgNum : 5; // Bits 17:13
+ U32 WlLongDelEn : 1; // Bits 18:18
+ U32 Spare : 13; // Bits 31:19
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH1_CR_DDRCRDATACONTROL2_STRUCT;
+
+typedef union {
+ struct {
+ U32 VssHiOrVrefCtl : 24; // Bits 23:0
+ U32 OutputCode : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH1_CR_DDRCRVSSHIORVREFCONTROL_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcvEnOffset : 6; // Bits 5:0
+ U32 RxDqsOffset : 6; // Bits 11:6
+ U32 TxDqOffset : 6; // Bits 17:12
+ U32 TxDqsOffset : 6; // Bits 23:18
+ U32 VrefOffset : 7; // Bits 30:24
+ U32 Spare : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH1_CR_DDRCRDATAOFFSETTRAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxTrainingMode : 1; // Bits 0:0
+ U32 WLTrainingMode : 1; // Bits 1:1
+ U32 RLTrainingMode : 1; // Bits 2:2
+ U32 SenseampTrainingMode : 1; // Bits 3:3
+ U32 TxOn : 1; // Bits 4:4
+ U32 RfOn : 1; // Bits 5:5
+ U32 RxPiOn : 1; // Bits 6:6
+ U32 TxPiOn : 1; // Bits 7:7
+ U32 InternalClocksOn : 1; // Bits 8:8
+ U32 RepeaterClocksOn : 1; // Bits 9:9
+ U32 TxDisable : 1; // Bits 10:10
+ U32 RxDisable : 1; // Bits 11:11
+ U32 TxLong : 1; // Bits 12:12
+ U32 RxDqsCtle : 2; // Bits 14:13
+ U32 RxReadPointer : 3; // Bits 17:15
+ U32 DriverSegmentEnable : 1; // Bits 18:18
+ U32 DataVccddqHi : 1; // Bits 19:19
+ U32 ReadRFRd : 1; // Bits 20:20
+ U32 ReadRFWr : 1; // Bits 21:21
+ U32 ReadRFRank : 2; // Bits 23:22
+ U32 ForceOdtOn : 1; // Bits 24:24
+ U32 OdtSampOff : 1; // Bits 25:25
+ U32 DisableOdtStatic : 1; // Bits 26:26
+ U32 DdrCRForceODTOn : 1; // Bits 27:27
+ U32 LPDDR_Mode : 1; // Bits 28:28
+ U32 EnReadPreamble : 1; // Bits 29:29
+ U32 OdtSampExtendEn : 1; // Bits 30:30
+ U32 EarlyRleakEn : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH1_CR_DDRCRDATACONTROL0_STRUCT;
+
+typedef union {
+ struct {
+ U32 CAVrefCtl : 7; // Bits 6:0
+ U32 Ch1VrefCtl : 7; // Bits 13:7
+ U32 Ch0VrefCtl : 7; // Bits 20:14
+ U32 EnDimmVrefCA : 1; // Bits 21:21
+ U32 EnDimmVrefCh1 : 1; // Bits 22:22
+ U32 EnDimmVrefCh0 : 1; // Bits 23:23
+ U32 HiZTimerCtrl : 2; // Bits 25:24
+ U32 VccddqHiQnnnH : 1; // Bits 26:26
+ U32 Rsvd : 2; // Bits 28:27
+ U32 caSlowBW : 1; // Bits 29:29
+ U32 ch0SlowBW : 1; // Bits 30:30
+ U32 ch1SlowBW : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATACH1_CR_DDRCRVREFADJUST1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH0_CR_RXTRAINRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH0_CR_RXTRAINRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH0_CR_RXTRAINRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH0_CR_RXTRAINRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH0_CR_RXPERBITRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH0_CR_RXPERBITRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH0_CR_RXPERBITRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH0_CR_RXPERBITRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH0_CR_TXTRAINRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH0_CR_TXTRAINRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH0_CR_TXTRAINRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH0_CR_TXTRAINRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH0_CR_TXPERBITRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH0_CR_TXPERBITRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH0_CR_TXPERBITRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH0_CR_TXPERBITRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcompDrvUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompDrvDown : 6; // Bits 14:9
+ U32 VTComp : 5; // Bits 19:15
+ U32 TcoComp : 6; // Bits 25:20
+ U32 SlewRateComp : 5; // Bits 30:26
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH0_CR_RCOMPDATA0_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcompOdtUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompOdtDown : 6; // Bits 14:9
+ U32 Spare1 : 1; // Bits 15:15
+ U32 PanicDrvDn : 6; // Bits 21:16
+ U32 PanicDrvUp : 6; // Bits 27:22
+ U32 LevelShifterComp : 3; // Bits 30:28
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH0_CR_RCOMPDATA1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH0_CR_TXXTALK_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH0_CR_RXOFFSETVDQ_STRUCT;
+
+typedef union {
+ struct {
+ U32 Spare : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH0_CR_DDRDATARESERVED_STRUCT;
+
+typedef union {
+ struct {
+ U32 DataTrainFeedback : 9; // Bits 8:0
+ U32 Spare : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH0_CR_DATATRAINFEEDBACK_STRUCT;
+
+typedef union {
+ struct {
+ U32 RunTest : 1; // Bits 0:0
+ U32 Load : 1; // Bits 1:1
+ U32 ModeHVM : 1; // Bits 2:2
+ U32 ModeDV : 1; // Bits 3:3
+ U32 ModeADC : 1; // Bits 4:4
+ U32 LoadCount : 10; // Bits 14:5
+ U32 CountStatus : 10; // Bits 24:15
+ U32 Spare : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH0_CR_DLLPITESTANDADC_STRUCT;
+
+typedef union {
+ struct {
+ U32 DqDrvUpCompOffset : 6; // Bits 5:0
+ U32 DqDrvDownCompOffset : 6; // Bits 11:6
+ U32 DqOdtUpCompOffset : 5; // Bits 16:12
+ U32 DqOdtDownCompOffset : 5; // Bits 21:17
+ U32 DqTcoCompOffset : 5; // Bits 26:22
+ U32 DqSlewRateCompOffset : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH0_CR_DDRCRDATAOFFSETCOMP_STRUCT;
+
+typedef union {
+ struct {
+ U32 RefPi : 4; // Bits 3:0
+ U32 DllMask : 2; // Bits 5:4
+ U32 DllWeakLock : 1; // Bits 6:6
+ U32 SdllSegmentDisable : 3; // Bits 9:7
+ U32 RxBiasCtl : 3; // Bits 12:10
+ U32 OdtDelay : 4; // Bits 16:13
+ U32 OdtDuration : 3; // Bits 19:17
+ U32 SenseAmpDelay : 4; // Bits 23:20
+ U32 SenseAmpDuration : 3; // Bits 26:24
+ U32 BurstEndODTDelay : 3; // Bits 29:27
+ U32 LpDdrLongOdtEn : 1; // Bits 30:30
+ U32 Rsvd1 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH0_CR_DDRCRDATACONTROL1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxStaggerCtl : 5; // Bits 4:0
+ U32 ForceBiasOn : 1; // Bits 5:5
+ U32 ForceRxOn : 1; // Bits 6:6
+ U32 LeakerComp : 2; // Bits 8:7
+ U32 RxDqsAmpOffset : 4; // Bits 12:9
+ U32 RxClkStgNum : 5; // Bits 17:13
+ U32 WlLongDelEn : 1; // Bits 18:18
+ U32 Spare : 13; // Bits 31:19
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH0_CR_DDRCRDATACONTROL2_STRUCT;
+
+typedef union {
+ struct {
+ U32 VssHiOrVrefCtl : 24; // Bits 23:0
+ U32 OutputCode : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH0_CR_DDRCRVSSHIORVREFCONTROL_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcvEnOffset : 6; // Bits 5:0
+ U32 RxDqsOffset : 6; // Bits 11:6
+ U32 TxDqOffset : 6; // Bits 17:12
+ U32 TxDqsOffset : 6; // Bits 23:18
+ U32 VrefOffset : 7; // Bits 30:24
+ U32 Spare : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH0_CR_DDRCRDATAOFFSETTRAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxTrainingMode : 1; // Bits 0:0
+ U32 WLTrainingMode : 1; // Bits 1:1
+ U32 RLTrainingMode : 1; // Bits 2:2
+ U32 SenseampTrainingMode : 1; // Bits 3:3
+ U32 TxOn : 1; // Bits 4:4
+ U32 RfOn : 1; // Bits 5:5
+ U32 RxPiOn : 1; // Bits 6:6
+ U32 TxPiOn : 1; // Bits 7:7
+ U32 InternalClocksOn : 1; // Bits 8:8
+ U32 RepeaterClocksOn : 1; // Bits 9:9
+ U32 TxDisable : 1; // Bits 10:10
+ U32 RxDisable : 1; // Bits 11:11
+ U32 TxLong : 1; // Bits 12:12
+ U32 RxDqsCtle : 2; // Bits 14:13
+ U32 RxReadPointer : 3; // Bits 17:15
+ U32 DriverSegmentEnable : 1; // Bits 18:18
+ U32 DataVccddqHi : 1; // Bits 19:19
+ U32 ReadRFRd : 1; // Bits 20:20
+ U32 ReadRFWr : 1; // Bits 21:21
+ U32 ReadRFRank : 2; // Bits 23:22
+ U32 ForceOdtOn : 1; // Bits 24:24
+ U32 OdtSampOff : 1; // Bits 25:25
+ U32 DisableOdtStatic : 1; // Bits 26:26
+ U32 DdrCRForceODTOn : 1; // Bits 27:27
+ U32 LPDDR_Mode : 1; // Bits 28:28
+ U32 EnReadPreamble : 1; // Bits 29:29
+ U32 OdtSampExtendEn : 1; // Bits 30:30
+ U32 EarlyRleakEn : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH0_CR_DDRCRDATACONTROL0_STRUCT;
+
+typedef union {
+ struct {
+ U32 CAVrefCtl : 7; // Bits 6:0
+ U32 Ch1VrefCtl : 7; // Bits 13:7
+ U32 Ch0VrefCtl : 7; // Bits 20:14
+ U32 EnDimmVrefCA : 1; // Bits 21:21
+ U32 EnDimmVrefCh1 : 1; // Bits 22:22
+ U32 EnDimmVrefCh0 : 1; // Bits 23:23
+ U32 HiZTimerCtrl : 2; // Bits 25:24
+ U32 VccddqHiQnnnH : 1; // Bits 26:26
+ U32 Rsvd : 2; // Bits 28:27
+ U32 caSlowBW : 1; // Bits 29:29
+ U32 ch0SlowBW : 1; // Bits 30:30
+ U32 ch1SlowBW : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH0_CR_DDRCRVREFADJUST1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH1_CR_RXTRAINRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH1_CR_RXTRAINRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH1_CR_RXTRAINRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH1_CR_RXTRAINRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH1_CR_RXPERBITRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH1_CR_RXPERBITRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH1_CR_RXPERBITRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH1_CR_RXPERBITRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH1_CR_TXTRAINRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH1_CR_TXTRAINRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH1_CR_TXTRAINRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH1_CR_TXTRAINRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH1_CR_TXPERBITRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH1_CR_TXPERBITRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH1_CR_TXPERBITRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH1_CR_TXPERBITRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcompDrvUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompDrvDown : 6; // Bits 14:9
+ U32 VTComp : 5; // Bits 19:15
+ U32 TcoComp : 6; // Bits 25:20
+ U32 SlewRateComp : 5; // Bits 30:26
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH1_CR_RCOMPDATA0_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcompOdtUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompOdtDown : 6; // Bits 14:9
+ U32 Spare1 : 1; // Bits 15:15
+ U32 PanicDrvDn : 6; // Bits 21:16
+ U32 PanicDrvUp : 6; // Bits 27:22
+ U32 LevelShifterComp : 3; // Bits 30:28
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH1_CR_RCOMPDATA1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH1_CR_TXXTALK_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH1_CR_RXOFFSETVDQ_STRUCT;
+
+typedef union {
+ struct {
+ U32 Spare : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH1_CR_DDRDATARESERVED_STRUCT;
+
+typedef union {
+ struct {
+ U32 DataTrainFeedback : 9; // Bits 8:0
+ U32 Spare : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH1_CR_DATATRAINFEEDBACK_STRUCT;
+
+typedef union {
+ struct {
+ U32 RunTest : 1; // Bits 0:0
+ U32 Load : 1; // Bits 1:1
+ U32 ModeHVM : 1; // Bits 2:2
+ U32 ModeDV : 1; // Bits 3:3
+ U32 ModeADC : 1; // Bits 4:4
+ U32 LoadCount : 10; // Bits 14:5
+ U32 CountStatus : 10; // Bits 24:15
+ U32 Spare : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH1_CR_DLLPITESTANDADC_STRUCT;
+
+typedef union {
+ struct {
+ U32 DqDrvUpCompOffset : 6; // Bits 5:0
+ U32 DqDrvDownCompOffset : 6; // Bits 11:6
+ U32 DqOdtUpCompOffset : 5; // Bits 16:12
+ U32 DqOdtDownCompOffset : 5; // Bits 21:17
+ U32 DqTcoCompOffset : 5; // Bits 26:22
+ U32 DqSlewRateCompOffset : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH1_CR_DDRCRDATAOFFSETCOMP_STRUCT;
+
+typedef union {
+ struct {
+ U32 RefPi : 4; // Bits 3:0
+ U32 DllMask : 2; // Bits 5:4
+ U32 DllWeakLock : 1; // Bits 6:6
+ U32 SdllSegmentDisable : 3; // Bits 9:7
+ U32 RxBiasCtl : 3; // Bits 12:10
+ U32 OdtDelay : 4; // Bits 16:13
+ U32 OdtDuration : 3; // Bits 19:17
+ U32 SenseAmpDelay : 4; // Bits 23:20
+ U32 SenseAmpDuration : 3; // Bits 26:24
+ U32 BurstEndODTDelay : 3; // Bits 29:27
+ U32 LpDdrLongOdtEn : 1; // Bits 30:30
+ U32 Rsvd1 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH1_CR_DDRCRDATACONTROL1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxStaggerCtl : 5; // Bits 4:0
+ U32 ForceBiasOn : 1; // Bits 5:5
+ U32 ForceRxOn : 1; // Bits 6:6
+ U32 LeakerComp : 2; // Bits 8:7
+ U32 RxDqsAmpOffset : 4; // Bits 12:9
+ U32 RxClkStgNum : 5; // Bits 17:13
+ U32 WlLongDelEn : 1; // Bits 18:18
+ U32 Spare : 13; // Bits 31:19
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH1_CR_DDRCRDATACONTROL2_STRUCT;
+
+typedef union {
+ struct {
+ U32 VssHiOrVrefCtl : 24; // Bits 23:0
+ U32 OutputCode : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH1_CR_DDRCRVSSHIORVREFCONTROL_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcvEnOffset : 6; // Bits 5:0
+ U32 RxDqsOffset : 6; // Bits 11:6
+ U32 TxDqOffset : 6; // Bits 17:12
+ U32 TxDqsOffset : 6; // Bits 23:18
+ U32 VrefOffset : 7; // Bits 30:24
+ U32 Spare : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH1_CR_DDRCRDATAOFFSETTRAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxTrainingMode : 1; // Bits 0:0
+ U32 WLTrainingMode : 1; // Bits 1:1
+ U32 RLTrainingMode : 1; // Bits 2:2
+ U32 SenseampTrainingMode : 1; // Bits 3:3
+ U32 TxOn : 1; // Bits 4:4
+ U32 RfOn : 1; // Bits 5:5
+ U32 RxPiOn : 1; // Bits 6:6
+ U32 TxPiOn : 1; // Bits 7:7
+ U32 InternalClocksOn : 1; // Bits 8:8
+ U32 RepeaterClocksOn : 1; // Bits 9:9
+ U32 TxDisable : 1; // Bits 10:10
+ U32 RxDisable : 1; // Bits 11:11
+ U32 TxLong : 1; // Bits 12:12
+ U32 RxDqsCtle : 2; // Bits 14:13
+ U32 RxReadPointer : 3; // Bits 17:15
+ U32 DriverSegmentEnable : 1; // Bits 18:18
+ U32 DataVccddqHi : 1; // Bits 19:19
+ U32 ReadRFRd : 1; // Bits 20:20
+ U32 ReadRFWr : 1; // Bits 21:21
+ U32 ReadRFRank : 2; // Bits 23:22
+ U32 ForceOdtOn : 1; // Bits 24:24
+ U32 OdtSampOff : 1; // Bits 25:25
+ U32 DisableOdtStatic : 1; // Bits 26:26
+ U32 DdrCRForceODTOn : 1; // Bits 27:27
+ U32 LPDDR_Mode : 1; // Bits 28:28
+ U32 EnReadPreamble : 1; // Bits 29:29
+ U32 OdtSampExtendEn : 1; // Bits 30:30
+ U32 EarlyRleakEn : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH1_CR_DDRCRDATACONTROL0_STRUCT;
+
+typedef union {
+ struct {
+ U32 CAVrefCtl : 7; // Bits 6:0
+ U32 Ch1VrefCtl : 7; // Bits 13:7
+ U32 Ch0VrefCtl : 7; // Bits 20:14
+ U32 EnDimmVrefCA : 1; // Bits 21:21
+ U32 EnDimmVrefCh1 : 1; // Bits 22:22
+ U32 EnDimmVrefCh0 : 1; // Bits 23:23
+ U32 HiZTimerCtrl : 2; // Bits 25:24
+ U32 VccddqHiQnnnH : 1; // Bits 26:26
+ U32 Rsvd : 2; // Bits 28:27
+ U32 caSlowBW : 1; // Bits 29:29
+ U32 ch0SlowBW : 1; // Bits 30:30
+ U32 ch1SlowBW : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA0CH1_CR_DDRCRVREFADJUST1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH0_CR_RXTRAINRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH0_CR_RXTRAINRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH0_CR_RXTRAINRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH0_CR_RXTRAINRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH0_CR_RXPERBITRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH0_CR_RXPERBITRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH0_CR_RXPERBITRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH0_CR_RXPERBITRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH0_CR_TXTRAINRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH0_CR_TXTRAINRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH0_CR_TXTRAINRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH0_CR_TXTRAINRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH0_CR_TXPERBITRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH0_CR_TXPERBITRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH0_CR_TXPERBITRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH0_CR_TXPERBITRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcompDrvUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompDrvDown : 6; // Bits 14:9
+ U32 VTComp : 5; // Bits 19:15
+ U32 TcoComp : 6; // Bits 25:20
+ U32 SlewRateComp : 5; // Bits 30:26
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH0_CR_RCOMPDATA0_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcompOdtUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompOdtDown : 6; // Bits 14:9
+ U32 Spare1 : 1; // Bits 15:15
+ U32 PanicDrvDn : 6; // Bits 21:16
+ U32 PanicDrvUp : 6; // Bits 27:22
+ U32 LevelShifterComp : 3; // Bits 30:28
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH0_CR_RCOMPDATA1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH0_CR_TXXTALK_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH0_CR_RXOFFSETVDQ_STRUCT;
+
+typedef union {
+ struct {
+ U32 Spare : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH0_CR_DDRDATARESERVED_STRUCT;
+
+typedef union {
+ struct {
+ U32 DataTrainFeedback : 9; // Bits 8:0
+ U32 Spare : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH0_CR_DATATRAINFEEDBACK_STRUCT;
+
+typedef union {
+ struct {
+ U32 RunTest : 1; // Bits 0:0
+ U32 Load : 1; // Bits 1:1
+ U32 ModeHVM : 1; // Bits 2:2
+ U32 ModeDV : 1; // Bits 3:3
+ U32 ModeADC : 1; // Bits 4:4
+ U32 LoadCount : 10; // Bits 14:5
+ U32 CountStatus : 10; // Bits 24:15
+ U32 Spare : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH0_CR_DLLPITESTANDADC_STRUCT;
+
+typedef union {
+ struct {
+ U32 DqDrvUpCompOffset : 6; // Bits 5:0
+ U32 DqDrvDownCompOffset : 6; // Bits 11:6
+ U32 DqOdtUpCompOffset : 5; // Bits 16:12
+ U32 DqOdtDownCompOffset : 5; // Bits 21:17
+ U32 DqTcoCompOffset : 5; // Bits 26:22
+ U32 DqSlewRateCompOffset : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH0_CR_DDRCRDATAOFFSETCOMP_STRUCT;
+
+typedef union {
+ struct {
+ U32 RefPi : 4; // Bits 3:0
+ U32 DllMask : 2; // Bits 5:4
+ U32 DllWeakLock : 1; // Bits 6:6
+ U32 SdllSegmentDisable : 3; // Bits 9:7
+ U32 RxBiasCtl : 3; // Bits 12:10
+ U32 OdtDelay : 4; // Bits 16:13
+ U32 OdtDuration : 3; // Bits 19:17
+ U32 SenseAmpDelay : 4; // Bits 23:20
+ U32 SenseAmpDuration : 3; // Bits 26:24
+ U32 BurstEndODTDelay : 3; // Bits 29:27
+ U32 LpDdrLongOdtEn : 1; // Bits 30:30
+ U32 Rsvd1 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH0_CR_DDRCRDATACONTROL1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxStaggerCtl : 5; // Bits 4:0
+ U32 ForceBiasOn : 1; // Bits 5:5
+ U32 ForceRxOn : 1; // Bits 6:6
+ U32 LeakerComp : 2; // Bits 8:7
+ U32 RxDqsAmpOffset : 4; // Bits 12:9
+ U32 RxClkStgNum : 5; // Bits 17:13
+ U32 WlLongDelEn : 1; // Bits 18:18
+ U32 Spare : 13; // Bits 31:19
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH0_CR_DDRCRDATACONTROL2_STRUCT;
+
+typedef union {
+ struct {
+ U32 VssHiOrVrefCtl : 24; // Bits 23:0
+ U32 OutputCode : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH0_CR_DDRCRVSSHIORVREFCONTROL_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcvEnOffset : 6; // Bits 5:0
+ U32 RxDqsOffset : 6; // Bits 11:6
+ U32 TxDqOffset : 6; // Bits 17:12
+ U32 TxDqsOffset : 6; // Bits 23:18
+ U32 VrefOffset : 7; // Bits 30:24
+ U32 Spare : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH0_CR_DDRCRDATAOFFSETTRAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxTrainingMode : 1; // Bits 0:0
+ U32 WLTrainingMode : 1; // Bits 1:1
+ U32 RLTrainingMode : 1; // Bits 2:2
+ U32 SenseampTrainingMode : 1; // Bits 3:3
+ U32 TxOn : 1; // Bits 4:4
+ U32 RfOn : 1; // Bits 5:5
+ U32 RxPiOn : 1; // Bits 6:6
+ U32 TxPiOn : 1; // Bits 7:7
+ U32 InternalClocksOn : 1; // Bits 8:8
+ U32 RepeaterClocksOn : 1; // Bits 9:9
+ U32 TxDisable : 1; // Bits 10:10
+ U32 RxDisable : 1; // Bits 11:11
+ U32 TxLong : 1; // Bits 12:12
+ U32 RxDqsCtle : 2; // Bits 14:13
+ U32 RxReadPointer : 3; // Bits 17:15
+ U32 DriverSegmentEnable : 1; // Bits 18:18
+ U32 DataVccddqHi : 1; // Bits 19:19
+ U32 ReadRFRd : 1; // Bits 20:20
+ U32 ReadRFWr : 1; // Bits 21:21
+ U32 ReadRFRank : 2; // Bits 23:22
+ U32 ForceOdtOn : 1; // Bits 24:24
+ U32 OdtSampOff : 1; // Bits 25:25
+ U32 DisableOdtStatic : 1; // Bits 26:26
+ U32 DdrCRForceODTOn : 1; // Bits 27:27
+ U32 LPDDR_Mode : 1; // Bits 28:28
+ U32 EnReadPreamble : 1; // Bits 29:29
+ U32 OdtSampExtendEn : 1; // Bits 30:30
+ U32 EarlyRleakEn : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH0_CR_DDRCRDATACONTROL0_STRUCT;
+
+typedef union {
+ struct {
+ U32 CAVrefCtl : 7; // Bits 6:0
+ U32 Ch1VrefCtl : 7; // Bits 13:7
+ U32 Ch0VrefCtl : 7; // Bits 20:14
+ U32 EnDimmVrefCA : 1; // Bits 21:21
+ U32 EnDimmVrefCh1 : 1; // Bits 22:22
+ U32 EnDimmVrefCh0 : 1; // Bits 23:23
+ U32 HiZTimerCtrl : 2; // Bits 25:24
+ U32 VccddqHiQnnnH : 1; // Bits 26:26
+ U32 Rsvd : 2; // Bits 28:27
+ U32 caSlowBW : 1; // Bits 29:29
+ U32 ch0SlowBW : 1; // Bits 30:30
+ U32 ch1SlowBW : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH0_CR_DDRCRVREFADJUST1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH1_CR_RXTRAINRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH1_CR_RXTRAINRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH1_CR_RXTRAINRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH1_CR_RXTRAINRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH1_CR_RXPERBITRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH1_CR_RXPERBITRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH1_CR_RXPERBITRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH1_CR_RXPERBITRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH1_CR_TXTRAINRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH1_CR_TXTRAINRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH1_CR_TXTRAINRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH1_CR_TXTRAINRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH1_CR_TXPERBITRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH1_CR_TXPERBITRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH1_CR_TXPERBITRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH1_CR_TXPERBITRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcompDrvUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompDrvDown : 6; // Bits 14:9
+ U32 VTComp : 5; // Bits 19:15
+ U32 TcoComp : 6; // Bits 25:20
+ U32 SlewRateComp : 5; // Bits 30:26
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH1_CR_RCOMPDATA0_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcompOdtUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompOdtDown : 6; // Bits 14:9
+ U32 Spare1 : 1; // Bits 15:15
+ U32 PanicDrvDn : 6; // Bits 21:16
+ U32 PanicDrvUp : 6; // Bits 27:22
+ U32 LevelShifterComp : 3; // Bits 30:28
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH1_CR_RCOMPDATA1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH1_CR_TXXTALK_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH1_CR_RXOFFSETVDQ_STRUCT;
+
+typedef union {
+ struct {
+ U32 Spare : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH1_CR_DDRDATARESERVED_STRUCT;
+
+typedef union {
+ struct {
+ U32 DataTrainFeedback : 9; // Bits 8:0
+ U32 Spare : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH1_CR_DATATRAINFEEDBACK_STRUCT;
+
+typedef union {
+ struct {
+ U32 RunTest : 1; // Bits 0:0
+ U32 Load : 1; // Bits 1:1
+ U32 ModeHVM : 1; // Bits 2:2
+ U32 ModeDV : 1; // Bits 3:3
+ U32 ModeADC : 1; // Bits 4:4
+ U32 LoadCount : 10; // Bits 14:5
+ U32 CountStatus : 10; // Bits 24:15
+ U32 Spare : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH1_CR_DLLPITESTANDADC_STRUCT;
+
+typedef union {
+ struct {
+ U32 DqDrvUpCompOffset : 6; // Bits 5:0
+ U32 DqDrvDownCompOffset : 6; // Bits 11:6
+ U32 DqOdtUpCompOffset : 5; // Bits 16:12
+ U32 DqOdtDownCompOffset : 5; // Bits 21:17
+ U32 DqTcoCompOffset : 5; // Bits 26:22
+ U32 DqSlewRateCompOffset : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH1_CR_DDRCRDATAOFFSETCOMP_STRUCT;
+
+typedef union {
+ struct {
+ U32 RefPi : 4; // Bits 3:0
+ U32 DllMask : 2; // Bits 5:4
+ U32 DllWeakLock : 1; // Bits 6:6
+ U32 SdllSegmentDisable : 3; // Bits 9:7
+ U32 RxBiasCtl : 3; // Bits 12:10
+ U32 OdtDelay : 4; // Bits 16:13
+ U32 OdtDuration : 3; // Bits 19:17
+ U32 SenseAmpDelay : 4; // Bits 23:20
+ U32 SenseAmpDuration : 3; // Bits 26:24
+ U32 BurstEndODTDelay : 3; // Bits 29:27
+ U32 LpDdrLongOdtEn : 1; // Bits 30:30
+ U32 Rsvd1 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH1_CR_DDRCRDATACONTROL1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxStaggerCtl : 5; // Bits 4:0
+ U32 ForceBiasOn : 1; // Bits 5:5
+ U32 ForceRxOn : 1; // Bits 6:6
+ U32 LeakerComp : 2; // Bits 8:7
+ U32 RxDqsAmpOffset : 4; // Bits 12:9
+ U32 RxClkStgNum : 5; // Bits 17:13
+ U32 WlLongDelEn : 1; // Bits 18:18
+ U32 Spare : 13; // Bits 31:19
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH1_CR_DDRCRDATACONTROL2_STRUCT;
+
+typedef union {
+ struct {
+ U32 VssHiOrVrefCtl : 24; // Bits 23:0
+ U32 OutputCode : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH1_CR_DDRCRVSSHIORVREFCONTROL_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcvEnOffset : 6; // Bits 5:0
+ U32 RxDqsOffset : 6; // Bits 11:6
+ U32 TxDqOffset : 6; // Bits 17:12
+ U32 TxDqsOffset : 6; // Bits 23:18
+ U32 VrefOffset : 7; // Bits 30:24
+ U32 Spare : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH1_CR_DDRCRDATAOFFSETTRAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxTrainingMode : 1; // Bits 0:0
+ U32 WLTrainingMode : 1; // Bits 1:1
+ U32 RLTrainingMode : 1; // Bits 2:2
+ U32 SenseampTrainingMode : 1; // Bits 3:3
+ U32 TxOn : 1; // Bits 4:4
+ U32 RfOn : 1; // Bits 5:5
+ U32 RxPiOn : 1; // Bits 6:6
+ U32 TxPiOn : 1; // Bits 7:7
+ U32 InternalClocksOn : 1; // Bits 8:8
+ U32 RepeaterClocksOn : 1; // Bits 9:9
+ U32 TxDisable : 1; // Bits 10:10
+ U32 RxDisable : 1; // Bits 11:11
+ U32 TxLong : 1; // Bits 12:12
+ U32 RxDqsCtle : 2; // Bits 14:13
+ U32 RxReadPointer : 3; // Bits 17:15
+ U32 DriverSegmentEnable : 1; // Bits 18:18
+ U32 DataVccddqHi : 1; // Bits 19:19
+ U32 ReadRFRd : 1; // Bits 20:20
+ U32 ReadRFWr : 1; // Bits 21:21
+ U32 ReadRFRank : 2; // Bits 23:22
+ U32 ForceOdtOn : 1; // Bits 24:24
+ U32 OdtSampOff : 1; // Bits 25:25
+ U32 DisableOdtStatic : 1; // Bits 26:26
+ U32 DdrCRForceODTOn : 1; // Bits 27:27
+ U32 LPDDR_Mode : 1; // Bits 28:28
+ U32 EnReadPreamble : 1; // Bits 29:29
+ U32 OdtSampExtendEn : 1; // Bits 30:30
+ U32 EarlyRleakEn : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH1_CR_DDRCRDATACONTROL0_STRUCT;
+
+typedef union {
+ struct {
+ U32 CAVrefCtl : 7; // Bits 6:0
+ U32 Ch1VrefCtl : 7; // Bits 13:7
+ U32 Ch0VrefCtl : 7; // Bits 20:14
+ U32 EnDimmVrefCA : 1; // Bits 21:21
+ U32 EnDimmVrefCh1 : 1; // Bits 22:22
+ U32 EnDimmVrefCh0 : 1; // Bits 23:23
+ U32 HiZTimerCtrl : 2; // Bits 25:24
+ U32 VccddqHiQnnnH : 1; // Bits 26:26
+ U32 Rsvd : 2; // Bits 28:27
+ U32 caSlowBW : 1; // Bits 29:29
+ U32 ch0SlowBW : 1; // Bits 30:30
+ U32 ch1SlowBW : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA1CH1_CR_DDRCRVREFADJUST1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH0_CR_RXTRAINRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH0_CR_RXTRAINRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH0_CR_RXTRAINRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH0_CR_RXTRAINRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH0_CR_RXPERBITRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH0_CR_RXPERBITRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH0_CR_RXPERBITRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH0_CR_RXPERBITRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH0_CR_TXTRAINRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH0_CR_TXTRAINRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH0_CR_TXTRAINRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH0_CR_TXTRAINRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH0_CR_TXPERBITRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH0_CR_TXPERBITRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH0_CR_TXPERBITRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH0_CR_TXPERBITRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcompDrvUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompDrvDown : 6; // Bits 14:9
+ U32 VTComp : 5; // Bits 19:15
+ U32 TcoComp : 6; // Bits 25:20
+ U32 SlewRateComp : 5; // Bits 30:26
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH0_CR_RCOMPDATA0_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcompOdtUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompOdtDown : 6; // Bits 14:9
+ U32 Spare1 : 1; // Bits 15:15
+ U32 PanicDrvDn : 6; // Bits 21:16
+ U32 PanicDrvUp : 6; // Bits 27:22
+ U32 LevelShifterComp : 3; // Bits 30:28
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH0_CR_RCOMPDATA1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH0_CR_TXXTALK_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH0_CR_RXOFFSETVDQ_STRUCT;
+
+typedef union {
+ struct {
+ U32 Spare : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH0_CR_DDRDATARESERVED_STRUCT;
+
+typedef union {
+ struct {
+ U32 DataTrainFeedback : 9; // Bits 8:0
+ U32 Spare : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH0_CR_DATATRAINFEEDBACK_STRUCT;
+
+typedef union {
+ struct {
+ U32 RunTest : 1; // Bits 0:0
+ U32 Load : 1; // Bits 1:1
+ U32 ModeHVM : 1; // Bits 2:2
+ U32 ModeDV : 1; // Bits 3:3
+ U32 ModeADC : 1; // Bits 4:4
+ U32 LoadCount : 10; // Bits 14:5
+ U32 CountStatus : 10; // Bits 24:15
+ U32 Spare : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH0_CR_DLLPITESTANDADC_STRUCT;
+
+typedef union {
+ struct {
+ U32 DqDrvUpCompOffset : 6; // Bits 5:0
+ U32 DqDrvDownCompOffset : 6; // Bits 11:6
+ U32 DqOdtUpCompOffset : 5; // Bits 16:12
+ U32 DqOdtDownCompOffset : 5; // Bits 21:17
+ U32 DqTcoCompOffset : 5; // Bits 26:22
+ U32 DqSlewRateCompOffset : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH0_CR_DDRCRDATAOFFSETCOMP_STRUCT;
+
+typedef union {
+ struct {
+ U32 RefPi : 4; // Bits 3:0
+ U32 DllMask : 2; // Bits 5:4
+ U32 DllWeakLock : 1; // Bits 6:6
+ U32 SdllSegmentDisable : 3; // Bits 9:7
+ U32 RxBiasCtl : 3; // Bits 12:10
+ U32 OdtDelay : 4; // Bits 16:13
+ U32 OdtDuration : 3; // Bits 19:17
+ U32 SenseAmpDelay : 4; // Bits 23:20
+ U32 SenseAmpDuration : 3; // Bits 26:24
+ U32 BurstEndODTDelay : 3; // Bits 29:27
+ U32 LpDdrLongOdtEn : 1; // Bits 30:30
+ U32 Rsvd1 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH0_CR_DDRCRDATACONTROL1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxStaggerCtl : 5; // Bits 4:0
+ U32 ForceBiasOn : 1; // Bits 5:5
+ U32 ForceRxOn : 1; // Bits 6:6
+ U32 LeakerComp : 2; // Bits 8:7
+ U32 RxDqsAmpOffset : 4; // Bits 12:9
+ U32 RxClkStgNum : 5; // Bits 17:13
+ U32 WlLongDelEn : 1; // Bits 18:18
+ U32 Spare : 13; // Bits 31:19
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH0_CR_DDRCRDATACONTROL2_STRUCT;
+
+typedef union {
+ struct {
+ U32 VssHiOrVrefCtl : 24; // Bits 23:0
+ U32 OutputCode : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH0_CR_DDRCRVSSHIORVREFCONTROL_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcvEnOffset : 6; // Bits 5:0
+ U32 RxDqsOffset : 6; // Bits 11:6
+ U32 TxDqOffset : 6; // Bits 17:12
+ U32 TxDqsOffset : 6; // Bits 23:18
+ U32 VrefOffset : 7; // Bits 30:24
+ U32 Spare : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH0_CR_DDRCRDATAOFFSETTRAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxTrainingMode : 1; // Bits 0:0
+ U32 WLTrainingMode : 1; // Bits 1:1
+ U32 RLTrainingMode : 1; // Bits 2:2
+ U32 SenseampTrainingMode : 1; // Bits 3:3
+ U32 TxOn : 1; // Bits 4:4
+ U32 RfOn : 1; // Bits 5:5
+ U32 RxPiOn : 1; // Bits 6:6
+ U32 TxPiOn : 1; // Bits 7:7
+ U32 InternalClocksOn : 1; // Bits 8:8
+ U32 RepeaterClocksOn : 1; // Bits 9:9
+ U32 TxDisable : 1; // Bits 10:10
+ U32 RxDisable : 1; // Bits 11:11
+ U32 TxLong : 1; // Bits 12:12
+ U32 RxDqsCtle : 2; // Bits 14:13
+ U32 RxReadPointer : 3; // Bits 17:15
+ U32 DriverSegmentEnable : 1; // Bits 18:18
+ U32 DataVccddqHi : 1; // Bits 19:19
+ U32 ReadRFRd : 1; // Bits 20:20
+ U32 ReadRFWr : 1; // Bits 21:21
+ U32 ReadRFRank : 2; // Bits 23:22
+ U32 ForceOdtOn : 1; // Bits 24:24
+ U32 OdtSampOff : 1; // Bits 25:25
+ U32 DisableOdtStatic : 1; // Bits 26:26
+ U32 DdrCRForceODTOn : 1; // Bits 27:27
+ U32 LPDDR_Mode : 1; // Bits 28:28
+ U32 EnReadPreamble : 1; // Bits 29:29
+ U32 OdtSampExtendEn : 1; // Bits 30:30
+ U32 EarlyRleakEn : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH0_CR_DDRCRDATACONTROL0_STRUCT;
+
+typedef union {
+ struct {
+ U32 CAVrefCtl : 7; // Bits 6:0
+ U32 Ch1VrefCtl : 7; // Bits 13:7
+ U32 Ch0VrefCtl : 7; // Bits 20:14
+ U32 EnDimmVrefCA : 1; // Bits 21:21
+ U32 EnDimmVrefCh1 : 1; // Bits 22:22
+ U32 EnDimmVrefCh0 : 1; // Bits 23:23
+ U32 HiZTimerCtrl : 2; // Bits 25:24
+ U32 VccddqHiQnnnH : 1; // Bits 26:26
+ U32 Rsvd : 2; // Bits 28:27
+ U32 caSlowBW : 1; // Bits 29:29
+ U32 ch0SlowBW : 1; // Bits 30:30
+ U32 ch1SlowBW : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH0_CR_DDRCRVREFADJUST1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH1_CR_RXTRAINRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH1_CR_RXTRAINRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH1_CR_RXTRAINRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH1_CR_RXTRAINRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH1_CR_RXPERBITRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH1_CR_RXPERBITRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH1_CR_RXPERBITRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH1_CR_RXPERBITRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH1_CR_TXTRAINRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH1_CR_TXTRAINRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH1_CR_TXTRAINRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH1_CR_TXTRAINRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH1_CR_TXPERBITRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH1_CR_TXPERBITRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH1_CR_TXPERBITRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH1_CR_TXPERBITRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcompDrvUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompDrvDown : 6; // Bits 14:9
+ U32 VTComp : 5; // Bits 19:15
+ U32 TcoComp : 6; // Bits 25:20
+ U32 SlewRateComp : 5; // Bits 30:26
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH1_CR_RCOMPDATA0_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcompOdtUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompOdtDown : 6; // Bits 14:9
+ U32 Spare1 : 1; // Bits 15:15
+ U32 PanicDrvDn : 6; // Bits 21:16
+ U32 PanicDrvUp : 6; // Bits 27:22
+ U32 LevelShifterComp : 3; // Bits 30:28
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH1_CR_RCOMPDATA1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH1_CR_TXXTALK_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH1_CR_RXOFFSETVDQ_STRUCT;
+
+typedef union {
+ struct {
+ U32 Spare : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH1_CR_DDRDATARESERVED_STRUCT;
+
+typedef union {
+ struct {
+ U32 DataTrainFeedback : 9; // Bits 8:0
+ U32 Spare : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH1_CR_DATATRAINFEEDBACK_STRUCT;
+
+typedef union {
+ struct {
+ U32 RunTest : 1; // Bits 0:0
+ U32 Load : 1; // Bits 1:1
+ U32 ModeHVM : 1; // Bits 2:2
+ U32 ModeDV : 1; // Bits 3:3
+ U32 ModeADC : 1; // Bits 4:4
+ U32 LoadCount : 10; // Bits 14:5
+ U32 CountStatus : 10; // Bits 24:15
+ U32 Spare : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH1_CR_DLLPITESTANDADC_STRUCT;
+
+typedef union {
+ struct {
+ U32 DqDrvUpCompOffset : 6; // Bits 5:0
+ U32 DqDrvDownCompOffset : 6; // Bits 11:6
+ U32 DqOdtUpCompOffset : 5; // Bits 16:12
+ U32 DqOdtDownCompOffset : 5; // Bits 21:17
+ U32 DqTcoCompOffset : 5; // Bits 26:22
+ U32 DqSlewRateCompOffset : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH1_CR_DDRCRDATAOFFSETCOMP_STRUCT;
+
+typedef union {
+ struct {
+ U32 RefPi : 4; // Bits 3:0
+ U32 DllMask : 2; // Bits 5:4
+ U32 DllWeakLock : 1; // Bits 6:6
+ U32 SdllSegmentDisable : 3; // Bits 9:7
+ U32 RxBiasCtl : 3; // Bits 12:10
+ U32 OdtDelay : 4; // Bits 16:13
+ U32 OdtDuration : 3; // Bits 19:17
+ U32 SenseAmpDelay : 4; // Bits 23:20
+ U32 SenseAmpDuration : 3; // Bits 26:24
+ U32 BurstEndODTDelay : 3; // Bits 29:27
+ U32 LpDdrLongOdtEn : 1; // Bits 30:30
+ U32 Rsvd1 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH1_CR_DDRCRDATACONTROL1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxStaggerCtl : 5; // Bits 4:0
+ U32 ForceBiasOn : 1; // Bits 5:5
+ U32 ForceRxOn : 1; // Bits 6:6
+ U32 LeakerComp : 2; // Bits 8:7
+ U32 RxDqsAmpOffset : 4; // Bits 12:9
+ U32 RxClkStgNum : 5; // Bits 17:13
+ U32 WlLongDelEn : 1; // Bits 18:18
+ U32 Spare : 13; // Bits 31:19
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH1_CR_DDRCRDATACONTROL2_STRUCT;
+
+typedef union {
+ struct {
+ U32 VssHiOrVrefCtl : 24; // Bits 23:0
+ U32 OutputCode : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH1_CR_DDRCRVSSHIORVREFCONTROL_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcvEnOffset : 6; // Bits 5:0
+ U32 RxDqsOffset : 6; // Bits 11:6
+ U32 TxDqOffset : 6; // Bits 17:12
+ U32 TxDqsOffset : 6; // Bits 23:18
+ U32 VrefOffset : 7; // Bits 30:24
+ U32 Spare : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH1_CR_DDRCRDATAOFFSETTRAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxTrainingMode : 1; // Bits 0:0
+ U32 WLTrainingMode : 1; // Bits 1:1
+ U32 RLTrainingMode : 1; // Bits 2:2
+ U32 SenseampTrainingMode : 1; // Bits 3:3
+ U32 TxOn : 1; // Bits 4:4
+ U32 RfOn : 1; // Bits 5:5
+ U32 RxPiOn : 1; // Bits 6:6
+ U32 TxPiOn : 1; // Bits 7:7
+ U32 InternalClocksOn : 1; // Bits 8:8
+ U32 RepeaterClocksOn : 1; // Bits 9:9
+ U32 TxDisable : 1; // Bits 10:10
+ U32 RxDisable : 1; // Bits 11:11
+ U32 TxLong : 1; // Bits 12:12
+ U32 RxDqsCtle : 2; // Bits 14:13
+ U32 RxReadPointer : 3; // Bits 17:15
+ U32 DriverSegmentEnable : 1; // Bits 18:18
+ U32 DataVccddqHi : 1; // Bits 19:19
+ U32 ReadRFRd : 1; // Bits 20:20
+ U32 ReadRFWr : 1; // Bits 21:21
+ U32 ReadRFRank : 2; // Bits 23:22
+ U32 ForceOdtOn : 1; // Bits 24:24
+ U32 OdtSampOff : 1; // Bits 25:25
+ U32 DisableOdtStatic : 1; // Bits 26:26
+ U32 DdrCRForceODTOn : 1; // Bits 27:27
+ U32 LPDDR_Mode : 1; // Bits 28:28
+ U32 EnReadPreamble : 1; // Bits 29:29
+ U32 OdtSampExtendEn : 1; // Bits 30:30
+ U32 EarlyRleakEn : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH1_CR_DDRCRDATACONTROL0_STRUCT;
+
+typedef union {
+ struct {
+ U32 CAVrefCtl : 7; // Bits 6:0
+ U32 Ch1VrefCtl : 7; // Bits 13:7
+ U32 Ch0VrefCtl : 7; // Bits 20:14
+ U32 EnDimmVrefCA : 1; // Bits 21:21
+ U32 EnDimmVrefCh1 : 1; // Bits 22:22
+ U32 EnDimmVrefCh0 : 1; // Bits 23:23
+ U32 HiZTimerCtrl : 2; // Bits 25:24
+ U32 VccddqHiQnnnH : 1; // Bits 26:26
+ U32 Rsvd : 2; // Bits 28:27
+ U32 caSlowBW : 1; // Bits 29:29
+ U32 ch0SlowBW : 1; // Bits 30:30
+ U32 ch1SlowBW : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA2CH1_CR_DDRCRVREFADJUST1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH0_CR_RXTRAINRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH0_CR_RXTRAINRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH0_CR_RXTRAINRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH0_CR_RXTRAINRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH0_CR_RXPERBITRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH0_CR_RXPERBITRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH0_CR_RXPERBITRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH0_CR_RXPERBITRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH0_CR_TXTRAINRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH0_CR_TXTRAINRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH0_CR_TXTRAINRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH0_CR_TXTRAINRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH0_CR_TXPERBITRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH0_CR_TXPERBITRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH0_CR_TXPERBITRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH0_CR_TXPERBITRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcompDrvUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompDrvDown : 6; // Bits 14:9
+ U32 VTComp : 5; // Bits 19:15
+ U32 TcoComp : 6; // Bits 25:20
+ U32 SlewRateComp : 5; // Bits 30:26
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH0_CR_RCOMPDATA0_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcompOdtUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompOdtDown : 6; // Bits 14:9
+ U32 Spare1 : 1; // Bits 15:15
+ U32 PanicDrvDn : 6; // Bits 21:16
+ U32 PanicDrvUp : 6; // Bits 27:22
+ U32 LevelShifterComp : 3; // Bits 30:28
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH0_CR_RCOMPDATA1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH0_CR_TXXTALK_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH0_CR_RXOFFSETVDQ_STRUCT;
+
+typedef union {
+ struct {
+ U32 Spare : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH0_CR_DDRDATARESERVED_STRUCT;
+
+typedef union {
+ struct {
+ U32 DataTrainFeedback : 9; // Bits 8:0
+ U32 Spare : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH0_CR_DATATRAINFEEDBACK_STRUCT;
+
+typedef union {
+ struct {
+ U32 RunTest : 1; // Bits 0:0
+ U32 Load : 1; // Bits 1:1
+ U32 ModeHVM : 1; // Bits 2:2
+ U32 ModeDV : 1; // Bits 3:3
+ U32 ModeADC : 1; // Bits 4:4
+ U32 LoadCount : 10; // Bits 14:5
+ U32 CountStatus : 10; // Bits 24:15
+ U32 Spare : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH0_CR_DLLPITESTANDADC_STRUCT;
+
+typedef union {
+ struct {
+ U32 DqDrvUpCompOffset : 6; // Bits 5:0
+ U32 DqDrvDownCompOffset : 6; // Bits 11:6
+ U32 DqOdtUpCompOffset : 5; // Bits 16:12
+ U32 DqOdtDownCompOffset : 5; // Bits 21:17
+ U32 DqTcoCompOffset : 5; // Bits 26:22
+ U32 DqSlewRateCompOffset : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH0_CR_DDRCRDATAOFFSETCOMP_STRUCT;
+
+typedef union {
+ struct {
+ U32 RefPi : 4; // Bits 3:0
+ U32 DllMask : 2; // Bits 5:4
+ U32 DllWeakLock : 1; // Bits 6:6
+ U32 SdllSegmentDisable : 3; // Bits 9:7
+ U32 RxBiasCtl : 3; // Bits 12:10
+ U32 OdtDelay : 4; // Bits 16:13
+ U32 OdtDuration : 3; // Bits 19:17
+ U32 SenseAmpDelay : 4; // Bits 23:20
+ U32 SenseAmpDuration : 3; // Bits 26:24
+ U32 BurstEndODTDelay : 3; // Bits 29:27
+ U32 LpDdrLongOdtEn : 1; // Bits 30:30
+ U32 Rsvd1 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH0_CR_DDRCRDATACONTROL1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxStaggerCtl : 5; // Bits 4:0
+ U32 ForceBiasOn : 1; // Bits 5:5
+ U32 ForceRxOn : 1; // Bits 6:6
+ U32 LeakerComp : 2; // Bits 8:7
+ U32 RxDqsAmpOffset : 4; // Bits 12:9
+ U32 RxClkStgNum : 5; // Bits 17:13
+ U32 WlLongDelEn : 1; // Bits 18:18
+ U32 Spare : 13; // Bits 31:19
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH0_CR_DDRCRDATACONTROL2_STRUCT;
+
+typedef union {
+ struct {
+ U32 VssHiOrVrefCtl : 24; // Bits 23:0
+ U32 OutputCode : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH0_CR_DDRCRVSSHIORVREFCONTROL_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcvEnOffset : 6; // Bits 5:0
+ U32 RxDqsOffset : 6; // Bits 11:6
+ U32 TxDqOffset : 6; // Bits 17:12
+ U32 TxDqsOffset : 6; // Bits 23:18
+ U32 VrefOffset : 7; // Bits 30:24
+ U32 Spare : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH0_CR_DDRCRDATAOFFSETTRAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxTrainingMode : 1; // Bits 0:0
+ U32 WLTrainingMode : 1; // Bits 1:1
+ U32 RLTrainingMode : 1; // Bits 2:2
+ U32 SenseampTrainingMode : 1; // Bits 3:3
+ U32 TxOn : 1; // Bits 4:4
+ U32 RfOn : 1; // Bits 5:5
+ U32 RxPiOn : 1; // Bits 6:6
+ U32 TxPiOn : 1; // Bits 7:7
+ U32 InternalClocksOn : 1; // Bits 8:8
+ U32 RepeaterClocksOn : 1; // Bits 9:9
+ U32 TxDisable : 1; // Bits 10:10
+ U32 RxDisable : 1; // Bits 11:11
+ U32 TxLong : 1; // Bits 12:12
+ U32 RxDqsCtle : 2; // Bits 14:13
+ U32 RxReadPointer : 3; // Bits 17:15
+ U32 DriverSegmentEnable : 1; // Bits 18:18
+ U32 DataVccddqHi : 1; // Bits 19:19
+ U32 ReadRFRd : 1; // Bits 20:20
+ U32 ReadRFWr : 1; // Bits 21:21
+ U32 ReadRFRank : 2; // Bits 23:22
+ U32 ForceOdtOn : 1; // Bits 24:24
+ U32 OdtSampOff : 1; // Bits 25:25
+ U32 DisableOdtStatic : 1; // Bits 26:26
+ U32 DdrCRForceODTOn : 1; // Bits 27:27
+ U32 LPDDR_Mode : 1; // Bits 28:28
+ U32 EnReadPreamble : 1; // Bits 29:29
+ U32 OdtSampExtendEn : 1; // Bits 30:30
+ U32 EarlyRleakEn : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH0_CR_DDRCRDATACONTROL0_STRUCT;
+
+typedef union {
+ struct {
+ U32 CAVrefCtl : 7; // Bits 6:0
+ U32 Ch1VrefCtl : 7; // Bits 13:7
+ U32 Ch0VrefCtl : 7; // Bits 20:14
+ U32 EnDimmVrefCA : 1; // Bits 21:21
+ U32 EnDimmVrefCh1 : 1; // Bits 22:22
+ U32 EnDimmVrefCh0 : 1; // Bits 23:23
+ U32 HiZTimerCtrl : 2; // Bits 25:24
+ U32 VccddqHiQnnnH : 1; // Bits 26:26
+ U32 Rsvd : 2; // Bits 28:27
+ U32 caSlowBW : 1; // Bits 29:29
+ U32 ch0SlowBW : 1; // Bits 30:30
+ U32 ch1SlowBW : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH0_CR_DDRCRVREFADJUST1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH1_CR_RXTRAINRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH1_CR_RXTRAINRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH1_CR_RXTRAINRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH1_CR_RXTRAINRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH1_CR_RXPERBITRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH1_CR_RXPERBITRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH1_CR_RXPERBITRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH1_CR_RXPERBITRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH1_CR_TXTRAINRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH1_CR_TXTRAINRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH1_CR_TXTRAINRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH1_CR_TXTRAINRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH1_CR_TXPERBITRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH1_CR_TXPERBITRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH1_CR_TXPERBITRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH1_CR_TXPERBITRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcompDrvUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompDrvDown : 6; // Bits 14:9
+ U32 VTComp : 5; // Bits 19:15
+ U32 TcoComp : 6; // Bits 25:20
+ U32 SlewRateComp : 5; // Bits 30:26
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH1_CR_RCOMPDATA0_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcompOdtUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompOdtDown : 6; // Bits 14:9
+ U32 Spare1 : 1; // Bits 15:15
+ U32 PanicDrvDn : 6; // Bits 21:16
+ U32 PanicDrvUp : 6; // Bits 27:22
+ U32 LevelShifterComp : 3; // Bits 30:28
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH1_CR_RCOMPDATA1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH1_CR_TXXTALK_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH1_CR_RXOFFSETVDQ_STRUCT;
+
+typedef union {
+ struct {
+ U32 Spare : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH1_CR_DDRDATARESERVED_STRUCT;
+
+typedef union {
+ struct {
+ U32 DataTrainFeedback : 9; // Bits 8:0
+ U32 Spare : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH1_CR_DATATRAINFEEDBACK_STRUCT;
+
+typedef union {
+ struct {
+ U32 RunTest : 1; // Bits 0:0
+ U32 Load : 1; // Bits 1:1
+ U32 ModeHVM : 1; // Bits 2:2
+ U32 ModeDV : 1; // Bits 3:3
+ U32 ModeADC : 1; // Bits 4:4
+ U32 LoadCount : 10; // Bits 14:5
+ U32 CountStatus : 10; // Bits 24:15
+ U32 Spare : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH1_CR_DLLPITESTANDADC_STRUCT;
+
+typedef union {
+ struct {
+ U32 DqDrvUpCompOffset : 6; // Bits 5:0
+ U32 DqDrvDownCompOffset : 6; // Bits 11:6
+ U32 DqOdtUpCompOffset : 5; // Bits 16:12
+ U32 DqOdtDownCompOffset : 5; // Bits 21:17
+ U32 DqTcoCompOffset : 5; // Bits 26:22
+ U32 DqSlewRateCompOffset : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH1_CR_DDRCRDATAOFFSETCOMP_STRUCT;
+
+typedef union {
+ struct {
+ U32 RefPi : 4; // Bits 3:0
+ U32 DllMask : 2; // Bits 5:4
+ U32 DllWeakLock : 1; // Bits 6:6
+ U32 SdllSegmentDisable : 3; // Bits 9:7
+ U32 RxBiasCtl : 3; // Bits 12:10
+ U32 OdtDelay : 4; // Bits 16:13
+ U32 OdtDuration : 3; // Bits 19:17
+ U32 SenseAmpDelay : 4; // Bits 23:20
+ U32 SenseAmpDuration : 3; // Bits 26:24
+ U32 BurstEndODTDelay : 3; // Bits 29:27
+ U32 LpDdrLongOdtEn : 1; // Bits 30:30
+ U32 Rsvd1 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH1_CR_DDRCRDATACONTROL1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxStaggerCtl : 5; // Bits 4:0
+ U32 ForceBiasOn : 1; // Bits 5:5
+ U32 ForceRxOn : 1; // Bits 6:6
+ U32 LeakerComp : 2; // Bits 8:7
+ U32 RxDqsAmpOffset : 4; // Bits 12:9
+ U32 RxClkStgNum : 5; // Bits 17:13
+ U32 WlLongDelEn : 1; // Bits 18:18
+ U32 Spare : 13; // Bits 31:19
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH1_CR_DDRCRDATACONTROL2_STRUCT;
+
+typedef union {
+ struct {
+ U32 VssHiOrVrefCtl : 24; // Bits 23:0
+ U32 OutputCode : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH1_CR_DDRCRVSSHIORVREFCONTROL_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcvEnOffset : 6; // Bits 5:0
+ U32 RxDqsOffset : 6; // Bits 11:6
+ U32 TxDqOffset : 6; // Bits 17:12
+ U32 TxDqsOffset : 6; // Bits 23:18
+ U32 VrefOffset : 7; // Bits 30:24
+ U32 Spare : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH1_CR_DDRCRDATAOFFSETTRAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxTrainingMode : 1; // Bits 0:0
+ U32 WLTrainingMode : 1; // Bits 1:1
+ U32 RLTrainingMode : 1; // Bits 2:2
+ U32 SenseampTrainingMode : 1; // Bits 3:3
+ U32 TxOn : 1; // Bits 4:4
+ U32 RfOn : 1; // Bits 5:5
+ U32 RxPiOn : 1; // Bits 6:6
+ U32 TxPiOn : 1; // Bits 7:7
+ U32 InternalClocksOn : 1; // Bits 8:8
+ U32 RepeaterClocksOn : 1; // Bits 9:9
+ U32 TxDisable : 1; // Bits 10:10
+ U32 RxDisable : 1; // Bits 11:11
+ U32 TxLong : 1; // Bits 12:12
+ U32 RxDqsCtle : 2; // Bits 14:13
+ U32 RxReadPointer : 3; // Bits 17:15
+ U32 DriverSegmentEnable : 1; // Bits 18:18
+ U32 DataVccddqHi : 1; // Bits 19:19
+ U32 ReadRFRd : 1; // Bits 20:20
+ U32 ReadRFWr : 1; // Bits 21:21
+ U32 ReadRFRank : 2; // Bits 23:22
+ U32 ForceOdtOn : 1; // Bits 24:24
+ U32 OdtSampOff : 1; // Bits 25:25
+ U32 DisableOdtStatic : 1; // Bits 26:26
+ U32 DdrCRForceODTOn : 1; // Bits 27:27
+ U32 LPDDR_Mode : 1; // Bits 28:28
+ U32 EnReadPreamble : 1; // Bits 29:29
+ U32 OdtSampExtendEn : 1; // Bits 30:30
+ U32 EarlyRleakEn : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH1_CR_DDRCRDATACONTROL0_STRUCT;
+
+typedef union {
+ struct {
+ U32 CAVrefCtl : 7; // Bits 6:0
+ U32 Ch1VrefCtl : 7; // Bits 13:7
+ U32 Ch0VrefCtl : 7; // Bits 20:14
+ U32 EnDimmVrefCA : 1; // Bits 21:21
+ U32 EnDimmVrefCh1 : 1; // Bits 22:22
+ U32 EnDimmVrefCh0 : 1; // Bits 23:23
+ U32 HiZTimerCtrl : 2; // Bits 25:24
+ U32 VccddqHiQnnnH : 1; // Bits 26:26
+ U32 Rsvd : 2; // Bits 28:27
+ U32 caSlowBW : 1; // Bits 29:29
+ U32 ch0SlowBW : 1; // Bits 30:30
+ U32 ch1SlowBW : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA3CH1_CR_DDRCRVREFADJUST1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH0_CR_RXTRAINRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH0_CR_RXTRAINRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH0_CR_RXTRAINRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH0_CR_RXTRAINRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH0_CR_RXPERBITRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH0_CR_RXPERBITRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH0_CR_RXPERBITRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH0_CR_RXPERBITRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH0_CR_TXTRAINRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH0_CR_TXTRAINRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH0_CR_TXTRAINRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH0_CR_TXTRAINRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH0_CR_TXPERBITRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH0_CR_TXPERBITRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH0_CR_TXPERBITRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH0_CR_TXPERBITRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcompDrvUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompDrvDown : 6; // Bits 14:9
+ U32 VTComp : 5; // Bits 19:15
+ U32 TcoComp : 6; // Bits 25:20
+ U32 SlewRateComp : 5; // Bits 30:26
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH0_CR_RCOMPDATA0_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcompOdtUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompOdtDown : 6; // Bits 14:9
+ U32 Spare1 : 1; // Bits 15:15
+ U32 PanicDrvDn : 6; // Bits 21:16
+ U32 PanicDrvUp : 6; // Bits 27:22
+ U32 LevelShifterComp : 3; // Bits 30:28
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH0_CR_RCOMPDATA1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH0_CR_TXXTALK_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH0_CR_RXOFFSETVDQ_STRUCT;
+
+typedef union {
+ struct {
+ U32 Spare : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH0_CR_DDRDATARESERVED_STRUCT;
+
+typedef union {
+ struct {
+ U32 DataTrainFeedback : 9; // Bits 8:0
+ U32 Spare : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH0_CR_DATATRAINFEEDBACK_STRUCT;
+
+typedef union {
+ struct {
+ U32 RunTest : 1; // Bits 0:0
+ U32 Load : 1; // Bits 1:1
+ U32 ModeHVM : 1; // Bits 2:2
+ U32 ModeDV : 1; // Bits 3:3
+ U32 ModeADC : 1; // Bits 4:4
+ U32 LoadCount : 10; // Bits 14:5
+ U32 CountStatus : 10; // Bits 24:15
+ U32 Spare : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH0_CR_DLLPITESTANDADC_STRUCT;
+
+typedef union {
+ struct {
+ U32 DqDrvUpCompOffset : 6; // Bits 5:0
+ U32 DqDrvDownCompOffset : 6; // Bits 11:6
+ U32 DqOdtUpCompOffset : 5; // Bits 16:12
+ U32 DqOdtDownCompOffset : 5; // Bits 21:17
+ U32 DqTcoCompOffset : 5; // Bits 26:22
+ U32 DqSlewRateCompOffset : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH0_CR_DDRCRDATAOFFSETCOMP_STRUCT;
+
+typedef union {
+ struct {
+ U32 RefPi : 4; // Bits 3:0
+ U32 DllMask : 2; // Bits 5:4
+ U32 DllWeakLock : 1; // Bits 6:6
+ U32 SdllSegmentDisable : 3; // Bits 9:7
+ U32 RxBiasCtl : 3; // Bits 12:10
+ U32 OdtDelay : 4; // Bits 16:13
+ U32 OdtDuration : 3; // Bits 19:17
+ U32 SenseAmpDelay : 4; // Bits 23:20
+ U32 SenseAmpDuration : 3; // Bits 26:24
+ U32 BurstEndODTDelay : 3; // Bits 29:27
+ U32 LpDdrLongOdtEn : 1; // Bits 30:30
+ U32 Rsvd1 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH0_CR_DDRCRDATACONTROL1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxStaggerCtl : 5; // Bits 4:0
+ U32 ForceBiasOn : 1; // Bits 5:5
+ U32 ForceRxOn : 1; // Bits 6:6
+ U32 LeakerComp : 2; // Bits 8:7
+ U32 RxDqsAmpOffset : 4; // Bits 12:9
+ U32 RxClkStgNum : 5; // Bits 17:13
+ U32 WlLongDelEn : 1; // Bits 18:18
+ U32 Spare : 13; // Bits 31:19
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH0_CR_DDRCRDATACONTROL2_STRUCT;
+
+typedef union {
+ struct {
+ U32 VssHiOrVrefCtl : 24; // Bits 23:0
+ U32 OutputCode : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH0_CR_DDRCRVSSHIORVREFCONTROL_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcvEnOffset : 6; // Bits 5:0
+ U32 RxDqsOffset : 6; // Bits 11:6
+ U32 TxDqOffset : 6; // Bits 17:12
+ U32 TxDqsOffset : 6; // Bits 23:18
+ U32 VrefOffset : 7; // Bits 30:24
+ U32 Spare : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH0_CR_DDRCRDATAOFFSETTRAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxTrainingMode : 1; // Bits 0:0
+ U32 WLTrainingMode : 1; // Bits 1:1
+ U32 RLTrainingMode : 1; // Bits 2:2
+ U32 SenseampTrainingMode : 1; // Bits 3:3
+ U32 TxOn : 1; // Bits 4:4
+ U32 RfOn : 1; // Bits 5:5
+ U32 RxPiOn : 1; // Bits 6:6
+ U32 TxPiOn : 1; // Bits 7:7
+ U32 InternalClocksOn : 1; // Bits 8:8
+ U32 RepeaterClocksOn : 1; // Bits 9:9
+ U32 TxDisable : 1; // Bits 10:10
+ U32 RxDisable : 1; // Bits 11:11
+ U32 TxLong : 1; // Bits 12:12
+ U32 RxDqsCtle : 2; // Bits 14:13
+ U32 RxReadPointer : 3; // Bits 17:15
+ U32 DriverSegmentEnable : 1; // Bits 18:18
+ U32 DataVccddqHi : 1; // Bits 19:19
+ U32 ReadRFRd : 1; // Bits 20:20
+ U32 ReadRFWr : 1; // Bits 21:21
+ U32 ReadRFRank : 2; // Bits 23:22
+ U32 ForceOdtOn : 1; // Bits 24:24
+ U32 OdtSampOff : 1; // Bits 25:25
+ U32 DisableOdtStatic : 1; // Bits 26:26
+ U32 DdrCRForceODTOn : 1; // Bits 27:27
+ U32 LPDDR_Mode : 1; // Bits 28:28
+ U32 EnReadPreamble : 1; // Bits 29:29
+ U32 OdtSampExtendEn : 1; // Bits 30:30
+ U32 EarlyRleakEn : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH0_CR_DDRCRDATACONTROL0_STRUCT;
+
+typedef union {
+ struct {
+ U32 CAVrefCtl : 7; // Bits 6:0
+ U32 Ch1VrefCtl : 7; // Bits 13:7
+ U32 Ch0VrefCtl : 7; // Bits 20:14
+ U32 EnDimmVrefCA : 1; // Bits 21:21
+ U32 EnDimmVrefCh1 : 1; // Bits 22:22
+ U32 EnDimmVrefCh0 : 1; // Bits 23:23
+ U32 HiZTimerCtrl : 2; // Bits 25:24
+ U32 VccddqHiQnnnH : 1; // Bits 26:26
+ U32 Rsvd : 2; // Bits 28:27
+ U32 caSlowBW : 1; // Bits 29:29
+ U32 ch0SlowBW : 1; // Bits 30:30
+ U32 ch1SlowBW : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH0_CR_DDRCRVREFADJUST1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH1_CR_RXTRAINRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH1_CR_RXTRAINRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH1_CR_RXTRAINRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH1_CR_RXTRAINRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH1_CR_RXPERBITRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH1_CR_RXPERBITRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH1_CR_RXPERBITRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH1_CR_RXPERBITRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH1_CR_TXTRAINRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH1_CR_TXTRAINRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH1_CR_TXTRAINRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH1_CR_TXTRAINRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH1_CR_TXPERBITRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH1_CR_TXPERBITRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH1_CR_TXPERBITRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH1_CR_TXPERBITRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcompDrvUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompDrvDown : 6; // Bits 14:9
+ U32 VTComp : 5; // Bits 19:15
+ U32 TcoComp : 6; // Bits 25:20
+ U32 SlewRateComp : 5; // Bits 30:26
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH1_CR_RCOMPDATA0_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcompOdtUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompOdtDown : 6; // Bits 14:9
+ U32 Spare1 : 1; // Bits 15:15
+ U32 PanicDrvDn : 6; // Bits 21:16
+ U32 PanicDrvUp : 6; // Bits 27:22
+ U32 LevelShifterComp : 3; // Bits 30:28
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH1_CR_RCOMPDATA1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH1_CR_TXXTALK_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH1_CR_RXOFFSETVDQ_STRUCT;
+
+typedef union {
+ struct {
+ U32 Spare : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH1_CR_DDRDATARESERVED_STRUCT;
+
+typedef union {
+ struct {
+ U32 DataTrainFeedback : 9; // Bits 8:0
+ U32 Spare : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH1_CR_DATATRAINFEEDBACK_STRUCT;
+
+typedef union {
+ struct {
+ U32 RunTest : 1; // Bits 0:0
+ U32 Load : 1; // Bits 1:1
+ U32 ModeHVM : 1; // Bits 2:2
+ U32 ModeDV : 1; // Bits 3:3
+ U32 ModeADC : 1; // Bits 4:4
+ U32 LoadCount : 10; // Bits 14:5
+ U32 CountStatus : 10; // Bits 24:15
+ U32 Spare : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH1_CR_DLLPITESTANDADC_STRUCT;
+
+typedef union {
+ struct {
+ U32 DqDrvUpCompOffset : 6; // Bits 5:0
+ U32 DqDrvDownCompOffset : 6; // Bits 11:6
+ U32 DqOdtUpCompOffset : 5; // Bits 16:12
+ U32 DqOdtDownCompOffset : 5; // Bits 21:17
+ U32 DqTcoCompOffset : 5; // Bits 26:22
+ U32 DqSlewRateCompOffset : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH1_CR_DDRCRDATAOFFSETCOMP_STRUCT;
+
+typedef union {
+ struct {
+ U32 RefPi : 4; // Bits 3:0
+ U32 DllMask : 2; // Bits 5:4
+ U32 DllWeakLock : 1; // Bits 6:6
+ U32 SdllSegmentDisable : 3; // Bits 9:7
+ U32 RxBiasCtl : 3; // Bits 12:10
+ U32 OdtDelay : 4; // Bits 16:13
+ U32 OdtDuration : 3; // Bits 19:17
+ U32 SenseAmpDelay : 4; // Bits 23:20
+ U32 SenseAmpDuration : 3; // Bits 26:24
+ U32 BurstEndODTDelay : 3; // Bits 29:27
+ U32 LpDdrLongOdtEn : 1; // Bits 30:30
+ U32 Rsvd1 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH1_CR_DDRCRDATACONTROL1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxStaggerCtl : 5; // Bits 4:0
+ U32 ForceBiasOn : 1; // Bits 5:5
+ U32 ForceRxOn : 1; // Bits 6:6
+ U32 LeakerComp : 2; // Bits 8:7
+ U32 RxDqsAmpOffset : 4; // Bits 12:9
+ U32 RxClkStgNum : 5; // Bits 17:13
+ U32 WlLongDelEn : 1; // Bits 18:18
+ U32 Spare : 13; // Bits 31:19
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH1_CR_DDRCRDATACONTROL2_STRUCT;
+
+typedef union {
+ struct {
+ U32 VssHiOrVrefCtl : 24; // Bits 23:0
+ U32 OutputCode : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH1_CR_DDRCRVSSHIORVREFCONTROL_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcvEnOffset : 6; // Bits 5:0
+ U32 RxDqsOffset : 6; // Bits 11:6
+ U32 TxDqOffset : 6; // Bits 17:12
+ U32 TxDqsOffset : 6; // Bits 23:18
+ U32 VrefOffset : 7; // Bits 30:24
+ U32 Spare : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH1_CR_DDRCRDATAOFFSETTRAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxTrainingMode : 1; // Bits 0:0
+ U32 WLTrainingMode : 1; // Bits 1:1
+ U32 RLTrainingMode : 1; // Bits 2:2
+ U32 SenseampTrainingMode : 1; // Bits 3:3
+ U32 TxOn : 1; // Bits 4:4
+ U32 RfOn : 1; // Bits 5:5
+ U32 RxPiOn : 1; // Bits 6:6
+ U32 TxPiOn : 1; // Bits 7:7
+ U32 InternalClocksOn : 1; // Bits 8:8
+ U32 RepeaterClocksOn : 1; // Bits 9:9
+ U32 TxDisable : 1; // Bits 10:10
+ U32 RxDisable : 1; // Bits 11:11
+ U32 TxLong : 1; // Bits 12:12
+ U32 RxDqsCtle : 2; // Bits 14:13
+ U32 RxReadPointer : 3; // Bits 17:15
+ U32 DriverSegmentEnable : 1; // Bits 18:18
+ U32 DataVccddqHi : 1; // Bits 19:19
+ U32 ReadRFRd : 1; // Bits 20:20
+ U32 ReadRFWr : 1; // Bits 21:21
+ U32 ReadRFRank : 2; // Bits 23:22
+ U32 ForceOdtOn : 1; // Bits 24:24
+ U32 OdtSampOff : 1; // Bits 25:25
+ U32 DisableOdtStatic : 1; // Bits 26:26
+ U32 DdrCRForceODTOn : 1; // Bits 27:27
+ U32 LPDDR_Mode : 1; // Bits 28:28
+ U32 EnReadPreamble : 1; // Bits 29:29
+ U32 OdtSampExtendEn : 1; // Bits 30:30
+ U32 EarlyRleakEn : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH1_CR_DDRCRDATACONTROL0_STRUCT;
+
+typedef union {
+ struct {
+ U32 CAVrefCtl : 7; // Bits 6:0
+ U32 Ch1VrefCtl : 7; // Bits 13:7
+ U32 Ch0VrefCtl : 7; // Bits 20:14
+ U32 EnDimmVrefCA : 1; // Bits 21:21
+ U32 EnDimmVrefCh1 : 1; // Bits 22:22
+ U32 EnDimmVrefCh0 : 1; // Bits 23:23
+ U32 HiZTimerCtrl : 2; // Bits 25:24
+ U32 VccddqHiQnnnH : 1; // Bits 26:26
+ U32 Rsvd : 2; // Bits 28:27
+ U32 caSlowBW : 1; // Bits 29:29
+ U32 ch0SlowBW : 1; // Bits 30:30
+ U32 ch1SlowBW : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA4CH1_CR_DDRCRVREFADJUST1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH0_CR_RXTRAINRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH0_CR_RXTRAINRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH0_CR_RXTRAINRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH0_CR_RXTRAINRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH0_CR_RXPERBITRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH0_CR_RXPERBITRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH0_CR_RXPERBITRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH0_CR_RXPERBITRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH0_CR_TXTRAINRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH0_CR_TXTRAINRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH0_CR_TXTRAINRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH0_CR_TXTRAINRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH0_CR_TXPERBITRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH0_CR_TXPERBITRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH0_CR_TXPERBITRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH0_CR_TXPERBITRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcompDrvUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompDrvDown : 6; // Bits 14:9
+ U32 VTComp : 5; // Bits 19:15
+ U32 TcoComp : 6; // Bits 25:20
+ U32 SlewRateComp : 5; // Bits 30:26
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH0_CR_RCOMPDATA0_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcompOdtUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompOdtDown : 6; // Bits 14:9
+ U32 Spare1 : 1; // Bits 15:15
+ U32 PanicDrvDn : 6; // Bits 21:16
+ U32 PanicDrvUp : 6; // Bits 27:22
+ U32 LevelShifterComp : 3; // Bits 30:28
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH0_CR_RCOMPDATA1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH0_CR_TXXTALK_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH0_CR_RXOFFSETVDQ_STRUCT;
+
+typedef union {
+ struct {
+ U32 Spare : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH0_CR_DDRDATARESERVED_STRUCT;
+
+typedef union {
+ struct {
+ U32 DataTrainFeedback : 9; // Bits 8:0
+ U32 Spare : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH0_CR_DATATRAINFEEDBACK_STRUCT;
+
+typedef union {
+ struct {
+ U32 RunTest : 1; // Bits 0:0
+ U32 Load : 1; // Bits 1:1
+ U32 ModeHVM : 1; // Bits 2:2
+ U32 ModeDV : 1; // Bits 3:3
+ U32 ModeADC : 1; // Bits 4:4
+ U32 LoadCount : 10; // Bits 14:5
+ U32 CountStatus : 10; // Bits 24:15
+ U32 Spare : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH0_CR_DLLPITESTANDADC_STRUCT;
+
+typedef union {
+ struct {
+ U32 DqDrvUpCompOffset : 6; // Bits 5:0
+ U32 DqDrvDownCompOffset : 6; // Bits 11:6
+ U32 DqOdtUpCompOffset : 5; // Bits 16:12
+ U32 DqOdtDownCompOffset : 5; // Bits 21:17
+ U32 DqTcoCompOffset : 5; // Bits 26:22
+ U32 DqSlewRateCompOffset : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH0_CR_DDRCRDATAOFFSETCOMP_STRUCT;
+
+typedef union {
+ struct {
+ U32 RefPi : 4; // Bits 3:0
+ U32 DllMask : 2; // Bits 5:4
+ U32 DllWeakLock : 1; // Bits 6:6
+ U32 SdllSegmentDisable : 3; // Bits 9:7
+ U32 RxBiasCtl : 3; // Bits 12:10
+ U32 OdtDelay : 4; // Bits 16:13
+ U32 OdtDuration : 3; // Bits 19:17
+ U32 SenseAmpDelay : 4; // Bits 23:20
+ U32 SenseAmpDuration : 3; // Bits 26:24
+ U32 BurstEndODTDelay : 3; // Bits 29:27
+ U32 LpDdrLongOdtEn : 1; // Bits 30:30
+ U32 Rsvd1 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH0_CR_DDRCRDATACONTROL1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxStaggerCtl : 5; // Bits 4:0
+ U32 ForceBiasOn : 1; // Bits 5:5
+ U32 ForceRxOn : 1; // Bits 6:6
+ U32 LeakerComp : 2; // Bits 8:7
+ U32 RxDqsAmpOffset : 4; // Bits 12:9
+ U32 RxClkStgNum : 5; // Bits 17:13
+ U32 WlLongDelEn : 1; // Bits 18:18
+ U32 Spare : 13; // Bits 31:19
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH0_CR_DDRCRDATACONTROL2_STRUCT;
+
+typedef union {
+ struct {
+ U32 VssHiOrVrefCtl : 24; // Bits 23:0
+ U32 OutputCode : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH0_CR_DDRCRVSSHIORVREFCONTROL_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcvEnOffset : 6; // Bits 5:0
+ U32 RxDqsOffset : 6; // Bits 11:6
+ U32 TxDqOffset : 6; // Bits 17:12
+ U32 TxDqsOffset : 6; // Bits 23:18
+ U32 VrefOffset : 7; // Bits 30:24
+ U32 Spare : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH0_CR_DDRCRDATAOFFSETTRAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxTrainingMode : 1; // Bits 0:0
+ U32 WLTrainingMode : 1; // Bits 1:1
+ U32 RLTrainingMode : 1; // Bits 2:2
+ U32 SenseampTrainingMode : 1; // Bits 3:3
+ U32 TxOn : 1; // Bits 4:4
+ U32 RfOn : 1; // Bits 5:5
+ U32 RxPiOn : 1; // Bits 6:6
+ U32 TxPiOn : 1; // Bits 7:7
+ U32 InternalClocksOn : 1; // Bits 8:8
+ U32 RepeaterClocksOn : 1; // Bits 9:9
+ U32 TxDisable : 1; // Bits 10:10
+ U32 RxDisable : 1; // Bits 11:11
+ U32 TxLong : 1; // Bits 12:12
+ U32 RxDqsCtle : 2; // Bits 14:13
+ U32 RxReadPointer : 3; // Bits 17:15
+ U32 DriverSegmentEnable : 1; // Bits 18:18
+ U32 DataVccddqHi : 1; // Bits 19:19
+ U32 ReadRFRd : 1; // Bits 20:20
+ U32 ReadRFWr : 1; // Bits 21:21
+ U32 ReadRFRank : 2; // Bits 23:22
+ U32 ForceOdtOn : 1; // Bits 24:24
+ U32 OdtSampOff : 1; // Bits 25:25
+ U32 DisableOdtStatic : 1; // Bits 26:26
+ U32 DdrCRForceODTOn : 1; // Bits 27:27
+ U32 LPDDR_Mode : 1; // Bits 28:28
+ U32 EnReadPreamble : 1; // Bits 29:29
+ U32 OdtSampExtendEn : 1; // Bits 30:30
+ U32 EarlyRleakEn : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH0_CR_DDRCRDATACONTROL0_STRUCT;
+
+typedef union {
+ struct {
+ U32 CAVrefCtl : 7; // Bits 6:0
+ U32 Ch1VrefCtl : 7; // Bits 13:7
+ U32 Ch0VrefCtl : 7; // Bits 20:14
+ U32 EnDimmVrefCA : 1; // Bits 21:21
+ U32 EnDimmVrefCh1 : 1; // Bits 22:22
+ U32 EnDimmVrefCh0 : 1; // Bits 23:23
+ U32 HiZTimerCtrl : 2; // Bits 25:24
+ U32 VccddqHiQnnnH : 1; // Bits 26:26
+ U32 Rsvd : 2; // Bits 28:27
+ U32 caSlowBW : 1; // Bits 29:29
+ U32 ch0SlowBW : 1; // Bits 30:30
+ U32 ch1SlowBW : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH0_CR_DDRCRVREFADJUST1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH1_CR_RXTRAINRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH1_CR_RXTRAINRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH1_CR_RXTRAINRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH1_CR_RXTRAINRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH1_CR_RXPERBITRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH1_CR_RXPERBITRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH1_CR_RXPERBITRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH1_CR_RXPERBITRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH1_CR_TXTRAINRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH1_CR_TXTRAINRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH1_CR_TXTRAINRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH1_CR_TXTRAINRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH1_CR_TXPERBITRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH1_CR_TXPERBITRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH1_CR_TXPERBITRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH1_CR_TXPERBITRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcompDrvUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompDrvDown : 6; // Bits 14:9
+ U32 VTComp : 5; // Bits 19:15
+ U32 TcoComp : 6; // Bits 25:20
+ U32 SlewRateComp : 5; // Bits 30:26
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH1_CR_RCOMPDATA0_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcompOdtUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompOdtDown : 6; // Bits 14:9
+ U32 Spare1 : 1; // Bits 15:15
+ U32 PanicDrvDn : 6; // Bits 21:16
+ U32 PanicDrvUp : 6; // Bits 27:22
+ U32 LevelShifterComp : 3; // Bits 30:28
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH1_CR_RCOMPDATA1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH1_CR_TXXTALK_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH1_CR_RXOFFSETVDQ_STRUCT;
+
+typedef union {
+ struct {
+ U32 Spare : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH1_CR_DDRDATARESERVED_STRUCT;
+
+typedef union {
+ struct {
+ U32 DataTrainFeedback : 9; // Bits 8:0
+ U32 Spare : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH1_CR_DATATRAINFEEDBACK_STRUCT;
+
+typedef union {
+ struct {
+ U32 RunTest : 1; // Bits 0:0
+ U32 Load : 1; // Bits 1:1
+ U32 ModeHVM : 1; // Bits 2:2
+ U32 ModeDV : 1; // Bits 3:3
+ U32 ModeADC : 1; // Bits 4:4
+ U32 LoadCount : 10; // Bits 14:5
+ U32 CountStatus : 10; // Bits 24:15
+ U32 Spare : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH1_CR_DLLPITESTANDADC_STRUCT;
+
+typedef union {
+ struct {
+ U32 DqDrvUpCompOffset : 6; // Bits 5:0
+ U32 DqDrvDownCompOffset : 6; // Bits 11:6
+ U32 DqOdtUpCompOffset : 5; // Bits 16:12
+ U32 DqOdtDownCompOffset : 5; // Bits 21:17
+ U32 DqTcoCompOffset : 5; // Bits 26:22
+ U32 DqSlewRateCompOffset : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH1_CR_DDRCRDATAOFFSETCOMP_STRUCT;
+
+typedef union {
+ struct {
+ U32 RefPi : 4; // Bits 3:0
+ U32 DllMask : 2; // Bits 5:4
+ U32 DllWeakLock : 1; // Bits 6:6
+ U32 SdllSegmentDisable : 3; // Bits 9:7
+ U32 RxBiasCtl : 3; // Bits 12:10
+ U32 OdtDelay : 4; // Bits 16:13
+ U32 OdtDuration : 3; // Bits 19:17
+ U32 SenseAmpDelay : 4; // Bits 23:20
+ U32 SenseAmpDuration : 3; // Bits 26:24
+ U32 BurstEndODTDelay : 3; // Bits 29:27
+ U32 LpDdrLongOdtEn : 1; // Bits 30:30
+ U32 Rsvd1 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH1_CR_DDRCRDATACONTROL1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxStaggerCtl : 5; // Bits 4:0
+ U32 ForceBiasOn : 1; // Bits 5:5
+ U32 ForceRxOn : 1; // Bits 6:6
+ U32 LeakerComp : 2; // Bits 8:7
+ U32 RxDqsAmpOffset : 4; // Bits 12:9
+ U32 RxClkStgNum : 5; // Bits 17:13
+ U32 WlLongDelEn : 1; // Bits 18:18
+ U32 Spare : 13; // Bits 31:19
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH1_CR_DDRCRDATACONTROL2_STRUCT;
+
+typedef union {
+ struct {
+ U32 VssHiOrVrefCtl : 24; // Bits 23:0
+ U32 OutputCode : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH1_CR_DDRCRVSSHIORVREFCONTROL_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcvEnOffset : 6; // Bits 5:0
+ U32 RxDqsOffset : 6; // Bits 11:6
+ U32 TxDqOffset : 6; // Bits 17:12
+ U32 TxDqsOffset : 6; // Bits 23:18
+ U32 VrefOffset : 7; // Bits 30:24
+ U32 Spare : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH1_CR_DDRCRDATAOFFSETTRAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxTrainingMode : 1; // Bits 0:0
+ U32 WLTrainingMode : 1; // Bits 1:1
+ U32 RLTrainingMode : 1; // Bits 2:2
+ U32 SenseampTrainingMode : 1; // Bits 3:3
+ U32 TxOn : 1; // Bits 4:4
+ U32 RfOn : 1; // Bits 5:5
+ U32 RxPiOn : 1; // Bits 6:6
+ U32 TxPiOn : 1; // Bits 7:7
+ U32 InternalClocksOn : 1; // Bits 8:8
+ U32 RepeaterClocksOn : 1; // Bits 9:9
+ U32 TxDisable : 1; // Bits 10:10
+ U32 RxDisable : 1; // Bits 11:11
+ U32 TxLong : 1; // Bits 12:12
+ U32 RxDqsCtle : 2; // Bits 14:13
+ U32 RxReadPointer : 3; // Bits 17:15
+ U32 DriverSegmentEnable : 1; // Bits 18:18
+ U32 DataVccddqHi : 1; // Bits 19:19
+ U32 ReadRFRd : 1; // Bits 20:20
+ U32 ReadRFWr : 1; // Bits 21:21
+ U32 ReadRFRank : 2; // Bits 23:22
+ U32 ForceOdtOn : 1; // Bits 24:24
+ U32 OdtSampOff : 1; // Bits 25:25
+ U32 DisableOdtStatic : 1; // Bits 26:26
+ U32 DdrCRForceODTOn : 1; // Bits 27:27
+ U32 LPDDR_Mode : 1; // Bits 28:28
+ U32 EnReadPreamble : 1; // Bits 29:29
+ U32 OdtSampExtendEn : 1; // Bits 30:30
+ U32 EarlyRleakEn : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH1_CR_DDRCRDATACONTROL0_STRUCT;
+
+typedef union {
+ struct {
+ U32 CAVrefCtl : 7; // Bits 6:0
+ U32 Ch1VrefCtl : 7; // Bits 13:7
+ U32 Ch0VrefCtl : 7; // Bits 20:14
+ U32 EnDimmVrefCA : 1; // Bits 21:21
+ U32 EnDimmVrefCh1 : 1; // Bits 22:22
+ U32 EnDimmVrefCh0 : 1; // Bits 23:23
+ U32 HiZTimerCtrl : 2; // Bits 25:24
+ U32 VccddqHiQnnnH : 1; // Bits 26:26
+ U32 Rsvd : 2; // Bits 28:27
+ U32 caSlowBW : 1; // Bits 29:29
+ U32 ch0SlowBW : 1; // Bits 30:30
+ U32 ch1SlowBW : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA5CH1_CR_DDRCRVREFADJUST1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH0_CR_RXTRAINRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH0_CR_RXTRAINRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH0_CR_RXTRAINRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH0_CR_RXTRAINRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH0_CR_RXPERBITRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH0_CR_RXPERBITRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH0_CR_RXPERBITRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH0_CR_RXPERBITRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH0_CR_TXTRAINRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH0_CR_TXTRAINRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH0_CR_TXTRAINRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH0_CR_TXTRAINRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH0_CR_TXPERBITRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH0_CR_TXPERBITRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH0_CR_TXPERBITRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH0_CR_TXPERBITRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcompDrvUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompDrvDown : 6; // Bits 14:9
+ U32 VTComp : 5; // Bits 19:15
+ U32 TcoComp : 6; // Bits 25:20
+ U32 SlewRateComp : 5; // Bits 30:26
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH0_CR_RCOMPDATA0_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcompOdtUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompOdtDown : 6; // Bits 14:9
+ U32 Spare1 : 1; // Bits 15:15
+ U32 PanicDrvDn : 6; // Bits 21:16
+ U32 PanicDrvUp : 6; // Bits 27:22
+ U32 LevelShifterComp : 3; // Bits 30:28
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH0_CR_RCOMPDATA1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH0_CR_TXXTALK_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH0_CR_RXOFFSETVDQ_STRUCT;
+
+typedef union {
+ struct {
+ U32 Spare : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH0_CR_DDRDATARESERVED_STRUCT;
+
+typedef union {
+ struct {
+ U32 DataTrainFeedback : 9; // Bits 8:0
+ U32 Spare : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH0_CR_DATATRAINFEEDBACK_STRUCT;
+
+typedef union {
+ struct {
+ U32 RunTest : 1; // Bits 0:0
+ U32 Load : 1; // Bits 1:1
+ U32 ModeHVM : 1; // Bits 2:2
+ U32 ModeDV : 1; // Bits 3:3
+ U32 ModeADC : 1; // Bits 4:4
+ U32 LoadCount : 10; // Bits 14:5
+ U32 CountStatus : 10; // Bits 24:15
+ U32 Spare : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH0_CR_DLLPITESTANDADC_STRUCT;
+
+typedef union {
+ struct {
+ U32 DqDrvUpCompOffset : 6; // Bits 5:0
+ U32 DqDrvDownCompOffset : 6; // Bits 11:6
+ U32 DqOdtUpCompOffset : 5; // Bits 16:12
+ U32 DqOdtDownCompOffset : 5; // Bits 21:17
+ U32 DqTcoCompOffset : 5; // Bits 26:22
+ U32 DqSlewRateCompOffset : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH0_CR_DDRCRDATAOFFSETCOMP_STRUCT;
+
+typedef union {
+ struct {
+ U32 RefPi : 4; // Bits 3:0
+ U32 DllMask : 2; // Bits 5:4
+ U32 DllWeakLock : 1; // Bits 6:6
+ U32 SdllSegmentDisable : 3; // Bits 9:7
+ U32 RxBiasCtl : 3; // Bits 12:10
+ U32 OdtDelay : 4; // Bits 16:13
+ U32 OdtDuration : 3; // Bits 19:17
+ U32 SenseAmpDelay : 4; // Bits 23:20
+ U32 SenseAmpDuration : 3; // Bits 26:24
+ U32 BurstEndODTDelay : 3; // Bits 29:27
+ U32 LpDdrLongOdtEn : 1; // Bits 30:30
+ U32 Rsvd1 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH0_CR_DDRCRDATACONTROL1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxStaggerCtl : 5; // Bits 4:0
+ U32 ForceBiasOn : 1; // Bits 5:5
+ U32 ForceRxOn : 1; // Bits 6:6
+ U32 LeakerComp : 2; // Bits 8:7
+ U32 RxDqsAmpOffset : 4; // Bits 12:9
+ U32 RxClkStgNum : 5; // Bits 17:13
+ U32 WlLongDelEn : 1; // Bits 18:18
+ U32 Spare : 13; // Bits 31:19
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH0_CR_DDRCRDATACONTROL2_STRUCT;
+
+typedef union {
+ struct {
+ U32 VssHiOrVrefCtl : 24; // Bits 23:0
+ U32 OutputCode : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH0_CR_DDRCRVSSHIORVREFCONTROL_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcvEnOffset : 6; // Bits 5:0
+ U32 RxDqsOffset : 6; // Bits 11:6
+ U32 TxDqOffset : 6; // Bits 17:12
+ U32 TxDqsOffset : 6; // Bits 23:18
+ U32 VrefOffset : 7; // Bits 30:24
+ U32 Spare : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH0_CR_DDRCRDATAOFFSETTRAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxTrainingMode : 1; // Bits 0:0
+ U32 WLTrainingMode : 1; // Bits 1:1
+ U32 RLTrainingMode : 1; // Bits 2:2
+ U32 SenseampTrainingMode : 1; // Bits 3:3
+ U32 TxOn : 1; // Bits 4:4
+ U32 RfOn : 1; // Bits 5:5
+ U32 RxPiOn : 1; // Bits 6:6
+ U32 TxPiOn : 1; // Bits 7:7
+ U32 InternalClocksOn : 1; // Bits 8:8
+ U32 RepeaterClocksOn : 1; // Bits 9:9
+ U32 TxDisable : 1; // Bits 10:10
+ U32 RxDisable : 1; // Bits 11:11
+ U32 TxLong : 1; // Bits 12:12
+ U32 RxDqsCtle : 2; // Bits 14:13
+ U32 RxReadPointer : 3; // Bits 17:15
+ U32 DriverSegmentEnable : 1; // Bits 18:18
+ U32 DataVccddqHi : 1; // Bits 19:19
+ U32 ReadRFRd : 1; // Bits 20:20
+ U32 ReadRFWr : 1; // Bits 21:21
+ U32 ReadRFRank : 2; // Bits 23:22
+ U32 ForceOdtOn : 1; // Bits 24:24
+ U32 OdtSampOff : 1; // Bits 25:25
+ U32 DisableOdtStatic : 1; // Bits 26:26
+ U32 DdrCRForceODTOn : 1; // Bits 27:27
+ U32 LPDDR_Mode : 1; // Bits 28:28
+ U32 EnReadPreamble : 1; // Bits 29:29
+ U32 OdtSampExtendEn : 1; // Bits 30:30
+ U32 EarlyRleakEn : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH0_CR_DDRCRDATACONTROL0_STRUCT;
+
+typedef union {
+ struct {
+ U32 CAVrefCtl : 7; // Bits 6:0
+ U32 Ch1VrefCtl : 7; // Bits 13:7
+ U32 Ch0VrefCtl : 7; // Bits 20:14
+ U32 EnDimmVrefCA : 1; // Bits 21:21
+ U32 EnDimmVrefCh1 : 1; // Bits 22:22
+ U32 EnDimmVrefCh0 : 1; // Bits 23:23
+ U32 HiZTimerCtrl : 2; // Bits 25:24
+ U32 VccddqHiQnnnH : 1; // Bits 26:26
+ U32 Rsvd : 2; // Bits 28:27
+ U32 caSlowBW : 1; // Bits 29:29
+ U32 ch0SlowBW : 1; // Bits 30:30
+ U32 ch1SlowBW : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH0_CR_DDRCRVREFADJUST1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH1_CR_RXTRAINRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH1_CR_RXTRAINRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH1_CR_RXTRAINRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH1_CR_RXTRAINRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH1_CR_RXPERBITRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH1_CR_RXPERBITRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH1_CR_RXPERBITRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH1_CR_RXPERBITRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH1_CR_TXTRAINRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH1_CR_TXTRAINRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH1_CR_TXTRAINRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH1_CR_TXTRAINRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH1_CR_TXPERBITRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH1_CR_TXPERBITRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH1_CR_TXPERBITRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH1_CR_TXPERBITRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcompDrvUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompDrvDown : 6; // Bits 14:9
+ U32 VTComp : 5; // Bits 19:15
+ U32 TcoComp : 6; // Bits 25:20
+ U32 SlewRateComp : 5; // Bits 30:26
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH1_CR_RCOMPDATA0_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcompOdtUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompOdtDown : 6; // Bits 14:9
+ U32 Spare1 : 1; // Bits 15:15
+ U32 PanicDrvDn : 6; // Bits 21:16
+ U32 PanicDrvUp : 6; // Bits 27:22
+ U32 LevelShifterComp : 3; // Bits 30:28
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH1_CR_RCOMPDATA1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH1_CR_TXXTALK_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH1_CR_RXOFFSETVDQ_STRUCT;
+
+typedef union {
+ struct {
+ U32 Spare : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH1_CR_DDRDATARESERVED_STRUCT;
+
+typedef union {
+ struct {
+ U32 DataTrainFeedback : 9; // Bits 8:0
+ U32 Spare : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH1_CR_DATATRAINFEEDBACK_STRUCT;
+
+typedef union {
+ struct {
+ U32 RunTest : 1; // Bits 0:0
+ U32 Load : 1; // Bits 1:1
+ U32 ModeHVM : 1; // Bits 2:2
+ U32 ModeDV : 1; // Bits 3:3
+ U32 ModeADC : 1; // Bits 4:4
+ U32 LoadCount : 10; // Bits 14:5
+ U32 CountStatus : 10; // Bits 24:15
+ U32 Spare : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH1_CR_DLLPITESTANDADC_STRUCT;
+
+typedef union {
+ struct {
+ U32 DqDrvUpCompOffset : 6; // Bits 5:0
+ U32 DqDrvDownCompOffset : 6; // Bits 11:6
+ U32 DqOdtUpCompOffset : 5; // Bits 16:12
+ U32 DqOdtDownCompOffset : 5; // Bits 21:17
+ U32 DqTcoCompOffset : 5; // Bits 26:22
+ U32 DqSlewRateCompOffset : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH1_CR_DDRCRDATAOFFSETCOMP_STRUCT;
+
+typedef union {
+ struct {
+ U32 RefPi : 4; // Bits 3:0
+ U32 DllMask : 2; // Bits 5:4
+ U32 DllWeakLock : 1; // Bits 6:6
+ U32 SdllSegmentDisable : 3; // Bits 9:7
+ U32 RxBiasCtl : 3; // Bits 12:10
+ U32 OdtDelay : 4; // Bits 16:13
+ U32 OdtDuration : 3; // Bits 19:17
+ U32 SenseAmpDelay : 4; // Bits 23:20
+ U32 SenseAmpDuration : 3; // Bits 26:24
+ U32 BurstEndODTDelay : 3; // Bits 29:27
+ U32 LpDdrLongOdtEn : 1; // Bits 30:30
+ U32 Rsvd1 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH1_CR_DDRCRDATACONTROL1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxStaggerCtl : 5; // Bits 4:0
+ U32 ForceBiasOn : 1; // Bits 5:5
+ U32 ForceRxOn : 1; // Bits 6:6
+ U32 LeakerComp : 2; // Bits 8:7
+ U32 RxDqsAmpOffset : 4; // Bits 12:9
+ U32 RxClkStgNum : 5; // Bits 17:13
+ U32 WlLongDelEn : 1; // Bits 18:18
+ U32 Spare : 13; // Bits 31:19
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH1_CR_DDRCRDATACONTROL2_STRUCT;
+
+typedef union {
+ struct {
+ U32 VssHiOrVrefCtl : 24; // Bits 23:0
+ U32 OutputCode : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH1_CR_DDRCRVSSHIORVREFCONTROL_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcvEnOffset : 6; // Bits 5:0
+ U32 RxDqsOffset : 6; // Bits 11:6
+ U32 TxDqOffset : 6; // Bits 17:12
+ U32 TxDqsOffset : 6; // Bits 23:18
+ U32 VrefOffset : 7; // Bits 30:24
+ U32 Spare : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH1_CR_DDRCRDATAOFFSETTRAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxTrainingMode : 1; // Bits 0:0
+ U32 WLTrainingMode : 1; // Bits 1:1
+ U32 RLTrainingMode : 1; // Bits 2:2
+ U32 SenseampTrainingMode : 1; // Bits 3:3
+ U32 TxOn : 1; // Bits 4:4
+ U32 RfOn : 1; // Bits 5:5
+ U32 RxPiOn : 1; // Bits 6:6
+ U32 TxPiOn : 1; // Bits 7:7
+ U32 InternalClocksOn : 1; // Bits 8:8
+ U32 RepeaterClocksOn : 1; // Bits 9:9
+ U32 TxDisable : 1; // Bits 10:10
+ U32 RxDisable : 1; // Bits 11:11
+ U32 TxLong : 1; // Bits 12:12
+ U32 RxDqsCtle : 2; // Bits 14:13
+ U32 RxReadPointer : 3; // Bits 17:15
+ U32 DriverSegmentEnable : 1; // Bits 18:18
+ U32 DataVccddqHi : 1; // Bits 19:19
+ U32 ReadRFRd : 1; // Bits 20:20
+ U32 ReadRFWr : 1; // Bits 21:21
+ U32 ReadRFRank : 2; // Bits 23:22
+ U32 ForceOdtOn : 1; // Bits 24:24
+ U32 OdtSampOff : 1; // Bits 25:25
+ U32 DisableOdtStatic : 1; // Bits 26:26
+ U32 DdrCRForceODTOn : 1; // Bits 27:27
+ U32 LPDDR_Mode : 1; // Bits 28:28
+ U32 EnReadPreamble : 1; // Bits 29:29
+ U32 OdtSampExtendEn : 1; // Bits 30:30
+ U32 EarlyRleakEn : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH1_CR_DDRCRDATACONTROL0_STRUCT;
+
+typedef union {
+ struct {
+ U32 CAVrefCtl : 7; // Bits 6:0
+ U32 Ch1VrefCtl : 7; // Bits 13:7
+ U32 Ch0VrefCtl : 7; // Bits 20:14
+ U32 EnDimmVrefCA : 1; // Bits 21:21
+ U32 EnDimmVrefCh1 : 1; // Bits 22:22
+ U32 EnDimmVrefCh0 : 1; // Bits 23:23
+ U32 HiZTimerCtrl : 2; // Bits 25:24
+ U32 VccddqHiQnnnH : 1; // Bits 26:26
+ U32 Rsvd : 2; // Bits 28:27
+ U32 caSlowBW : 1; // Bits 29:29
+ U32 ch0SlowBW : 1; // Bits 30:30
+ U32 ch1SlowBW : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA6CH1_CR_DDRCRVREFADJUST1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH0_CR_RXTRAINRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH0_CR_RXTRAINRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH0_CR_RXTRAINRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH0_CR_RXTRAINRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH0_CR_RXPERBITRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH0_CR_RXPERBITRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH0_CR_RXPERBITRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH0_CR_RXPERBITRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH0_CR_TXTRAINRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH0_CR_TXTRAINRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH0_CR_TXTRAINRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH0_CR_TXTRAINRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH0_CR_TXPERBITRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH0_CR_TXPERBITRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH0_CR_TXPERBITRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH0_CR_TXPERBITRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcompDrvUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompDrvDown : 6; // Bits 14:9
+ U32 VTComp : 5; // Bits 19:15
+ U32 TcoComp : 6; // Bits 25:20
+ U32 SlewRateComp : 5; // Bits 30:26
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH0_CR_RCOMPDATA0_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcompOdtUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompOdtDown : 6; // Bits 14:9
+ U32 Spare1 : 1; // Bits 15:15
+ U32 PanicDrvDn : 6; // Bits 21:16
+ U32 PanicDrvUp : 6; // Bits 27:22
+ U32 LevelShifterComp : 3; // Bits 30:28
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH0_CR_RCOMPDATA1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH0_CR_TXXTALK_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH0_CR_RXOFFSETVDQ_STRUCT;
+
+typedef union {
+ struct {
+ U32 Spare : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH0_CR_DDRDATARESERVED_STRUCT;
+
+typedef union {
+ struct {
+ U32 DataTrainFeedback : 9; // Bits 8:0
+ U32 Spare : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH0_CR_DATATRAINFEEDBACK_STRUCT;
+
+typedef union {
+ struct {
+ U32 RunTest : 1; // Bits 0:0
+ U32 Load : 1; // Bits 1:1
+ U32 ModeHVM : 1; // Bits 2:2
+ U32 ModeDV : 1; // Bits 3:3
+ U32 ModeADC : 1; // Bits 4:4
+ U32 LoadCount : 10; // Bits 14:5
+ U32 CountStatus : 10; // Bits 24:15
+ U32 Spare : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH0_CR_DLLPITESTANDADC_STRUCT;
+
+typedef union {
+ struct {
+ U32 DqDrvUpCompOffset : 6; // Bits 5:0
+ U32 DqDrvDownCompOffset : 6; // Bits 11:6
+ U32 DqOdtUpCompOffset : 5; // Bits 16:12
+ U32 DqOdtDownCompOffset : 5; // Bits 21:17
+ U32 DqTcoCompOffset : 5; // Bits 26:22
+ U32 DqSlewRateCompOffset : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH0_CR_DDRCRDATAOFFSETCOMP_STRUCT;
+
+typedef union {
+ struct {
+ U32 RefPi : 4; // Bits 3:0
+ U32 DllMask : 2; // Bits 5:4
+ U32 DllWeakLock : 1; // Bits 6:6
+ U32 SdllSegmentDisable : 3; // Bits 9:7
+ U32 RxBiasCtl : 3; // Bits 12:10
+ U32 OdtDelay : 4; // Bits 16:13
+ U32 OdtDuration : 3; // Bits 19:17
+ U32 SenseAmpDelay : 4; // Bits 23:20
+ U32 SenseAmpDuration : 3; // Bits 26:24
+ U32 BurstEndODTDelay : 3; // Bits 29:27
+ U32 LpDdrLongOdtEn : 1; // Bits 30:30
+ U32 Rsvd1 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH0_CR_DDRCRDATACONTROL1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxStaggerCtl : 5; // Bits 4:0
+ U32 ForceBiasOn : 1; // Bits 5:5
+ U32 ForceRxOn : 1; // Bits 6:6
+ U32 LeakerComp : 2; // Bits 8:7
+ U32 RxDqsAmpOffset : 4; // Bits 12:9
+ U32 RxClkStgNum : 5; // Bits 17:13
+ U32 WlLongDelEn : 1; // Bits 18:18
+ U32 Spare : 13; // Bits 31:19
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH0_CR_DDRCRDATACONTROL2_STRUCT;
+
+typedef union {
+ struct {
+ U32 VssHiOrVrefCtl : 24; // Bits 23:0
+ U32 OutputCode : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH0_CR_DDRCRVSSHIORVREFCONTROL_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcvEnOffset : 6; // Bits 5:0
+ U32 RxDqsOffset : 6; // Bits 11:6
+ U32 TxDqOffset : 6; // Bits 17:12
+ U32 TxDqsOffset : 6; // Bits 23:18
+ U32 VrefOffset : 7; // Bits 30:24
+ U32 Spare : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH0_CR_DDRCRDATAOFFSETTRAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxTrainingMode : 1; // Bits 0:0
+ U32 WLTrainingMode : 1; // Bits 1:1
+ U32 RLTrainingMode : 1; // Bits 2:2
+ U32 SenseampTrainingMode : 1; // Bits 3:3
+ U32 TxOn : 1; // Bits 4:4
+ U32 RfOn : 1; // Bits 5:5
+ U32 RxPiOn : 1; // Bits 6:6
+ U32 TxPiOn : 1; // Bits 7:7
+ U32 InternalClocksOn : 1; // Bits 8:8
+ U32 RepeaterClocksOn : 1; // Bits 9:9
+ U32 TxDisable : 1; // Bits 10:10
+ U32 RxDisable : 1; // Bits 11:11
+ U32 TxLong : 1; // Bits 12:12
+ U32 RxDqsCtle : 2; // Bits 14:13
+ U32 RxReadPointer : 3; // Bits 17:15
+ U32 DriverSegmentEnable : 1; // Bits 18:18
+ U32 DataVccddqHi : 1; // Bits 19:19
+ U32 ReadRFRd : 1; // Bits 20:20
+ U32 ReadRFWr : 1; // Bits 21:21
+ U32 ReadRFRank : 2; // Bits 23:22
+ U32 ForceOdtOn : 1; // Bits 24:24
+ U32 OdtSampOff : 1; // Bits 25:25
+ U32 DisableOdtStatic : 1; // Bits 26:26
+ U32 DdrCRForceODTOn : 1; // Bits 27:27
+ U32 LPDDR_Mode : 1; // Bits 28:28
+ U32 EnReadPreamble : 1; // Bits 29:29
+ U32 OdtSampExtendEn : 1; // Bits 30:30
+ U32 EarlyRleakEn : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH0_CR_DDRCRDATACONTROL0_STRUCT;
+
+typedef union {
+ struct {
+ U32 CAVrefCtl : 7; // Bits 6:0
+ U32 Ch1VrefCtl : 7; // Bits 13:7
+ U32 Ch0VrefCtl : 7; // Bits 20:14
+ U32 EnDimmVrefCA : 1; // Bits 21:21
+ U32 EnDimmVrefCh1 : 1; // Bits 22:22
+ U32 EnDimmVrefCh0 : 1; // Bits 23:23
+ U32 HiZTimerCtrl : 2; // Bits 25:24
+ U32 VccddqHiQnnnH : 1; // Bits 26:26
+ U32 Rsvd : 2; // Bits 28:27
+ U32 caSlowBW : 1; // Bits 29:29
+ U32 ch0SlowBW : 1; // Bits 30:30
+ U32 ch1SlowBW : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH0_CR_DDRCRVREFADJUST1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH1_CR_RXTRAINRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH1_CR_RXTRAINRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH1_CR_RXTRAINRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH1_CR_RXTRAINRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH1_CR_RXPERBITRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH1_CR_RXPERBITRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH1_CR_RXPERBITRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH1_CR_RXPERBITRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH1_CR_TXTRAINRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH1_CR_TXTRAINRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH1_CR_TXTRAINRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH1_CR_TXTRAINRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH1_CR_TXPERBITRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH1_CR_TXPERBITRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH1_CR_TXPERBITRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH1_CR_TXPERBITRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcompDrvUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompDrvDown : 6; // Bits 14:9
+ U32 VTComp : 5; // Bits 19:15
+ U32 TcoComp : 6; // Bits 25:20
+ U32 SlewRateComp : 5; // Bits 30:26
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH1_CR_RCOMPDATA0_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcompOdtUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompOdtDown : 6; // Bits 14:9
+ U32 Spare1 : 1; // Bits 15:15
+ U32 PanicDrvDn : 6; // Bits 21:16
+ U32 PanicDrvUp : 6; // Bits 27:22
+ U32 LevelShifterComp : 3; // Bits 30:28
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH1_CR_RCOMPDATA1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH1_CR_TXXTALK_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH1_CR_RXOFFSETVDQ_STRUCT;
+
+typedef union {
+ struct {
+ U32 Spare : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH1_CR_DDRDATARESERVED_STRUCT;
+
+typedef union {
+ struct {
+ U32 DataTrainFeedback : 9; // Bits 8:0
+ U32 Spare : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH1_CR_DATATRAINFEEDBACK_STRUCT;
+
+typedef union {
+ struct {
+ U32 RunTest : 1; // Bits 0:0
+ U32 Load : 1; // Bits 1:1
+ U32 ModeHVM : 1; // Bits 2:2
+ U32 ModeDV : 1; // Bits 3:3
+ U32 ModeADC : 1; // Bits 4:4
+ U32 LoadCount : 10; // Bits 14:5
+ U32 CountStatus : 10; // Bits 24:15
+ U32 Spare : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH1_CR_DLLPITESTANDADC_STRUCT;
+
+typedef union {
+ struct {
+ U32 DqDrvUpCompOffset : 6; // Bits 5:0
+ U32 DqDrvDownCompOffset : 6; // Bits 11:6
+ U32 DqOdtUpCompOffset : 5; // Bits 16:12
+ U32 DqOdtDownCompOffset : 5; // Bits 21:17
+ U32 DqTcoCompOffset : 5; // Bits 26:22
+ U32 DqSlewRateCompOffset : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH1_CR_DDRCRDATAOFFSETCOMP_STRUCT;
+
+typedef union {
+ struct {
+ U32 RefPi : 4; // Bits 3:0
+ U32 DllMask : 2; // Bits 5:4
+ U32 DllWeakLock : 1; // Bits 6:6
+ U32 SdllSegmentDisable : 3; // Bits 9:7
+ U32 RxBiasCtl : 3; // Bits 12:10
+ U32 OdtDelay : 4; // Bits 16:13
+ U32 OdtDuration : 3; // Bits 19:17
+ U32 SenseAmpDelay : 4; // Bits 23:20
+ U32 SenseAmpDuration : 3; // Bits 26:24
+ U32 BurstEndODTDelay : 3; // Bits 29:27
+ U32 LpDdrLongOdtEn : 1; // Bits 30:30
+ U32 Rsvd1 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH1_CR_DDRCRDATACONTROL1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxStaggerCtl : 5; // Bits 4:0
+ U32 ForceBiasOn : 1; // Bits 5:5
+ U32 ForceRxOn : 1; // Bits 6:6
+ U32 LeakerComp : 2; // Bits 8:7
+ U32 RxDqsAmpOffset : 4; // Bits 12:9
+ U32 RxClkStgNum : 5; // Bits 17:13
+ U32 WlLongDelEn : 1; // Bits 18:18
+ U32 Spare : 13; // Bits 31:19
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH1_CR_DDRCRDATACONTROL2_STRUCT;
+
+typedef union {
+ struct {
+ U32 VrefCtl : 24; // Bits 23:0
+ U32 OutputCode : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH1_CR_DDRCRVREFCONTROL_STRUCT;
+
+typedef union {
+ struct {
+ U32 VssHiCtl : 24; // Bits 23:0
+ U32 OutputCode : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH1_CR_DDRCRVSSHICONTROL_STRUCT;
+
+typedef union {
+ struct {
+ U32 VssHiOrVrefCtl : 24; // Bits 23:0
+ U32 OutputCode : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH1_CR_DDRCRVSSHIORVREFCONTROL_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcvEnOffset : 6; // Bits 5:0
+ U32 RxDqsOffset : 6; // Bits 11:6
+ U32 TxDqOffset : 6; // Bits 17:12
+ U32 TxDqsOffset : 6; // Bits 23:18
+ U32 VrefOffset : 7; // Bits 30:24
+ U32 Spare : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH1_CR_DDRCRDATAOFFSETTRAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxTrainingMode : 1; // Bits 0:0
+ U32 WLTrainingMode : 1; // Bits 1:1
+ U32 RLTrainingMode : 1; // Bits 2:2
+ U32 SenseampTrainingMode : 1; // Bits 3:3
+ U32 TxOn : 1; // Bits 4:4
+ U32 RfOn : 1; // Bits 5:5
+ U32 RxPiOn : 1; // Bits 6:6
+ U32 TxPiOn : 1; // Bits 7:7
+ U32 InternalClocksOn : 1; // Bits 8:8
+ U32 RepeaterClocksOn : 1; // Bits 9:9
+ U32 TxDisable : 1; // Bits 10:10
+ U32 RxDisable : 1; // Bits 11:11
+ U32 TxLong : 1; // Bits 12:12
+ U32 RxDqsCtle : 2; // Bits 14:13
+ U32 RxReadPointer : 3; // Bits 17:15
+ U32 DriverSegmentEnable : 1; // Bits 18:18
+ U32 DataVccddqHi : 1; // Bits 19:19
+ U32 ReadRFRd : 1; // Bits 20:20
+ U32 ReadRFWr : 1; // Bits 21:21
+ U32 ReadRFRank : 2; // Bits 23:22
+ U32 ForceOdtOn : 1; // Bits 24:24
+ U32 OdtSampOff : 1; // Bits 25:25
+ U32 DisableOdtStatic : 1; // Bits 26:26
+ U32 DdrCRForceODTOn : 1; // Bits 27:27
+ U32 LPDDR_Mode : 1; // Bits 28:28
+ U32 EnReadPreamble : 1; // Bits 29:29
+ U32 OdtSampExtendEn : 1; // Bits 30:30
+ U32 EarlyRleakEn : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH1_CR_DDRCRDATACONTROL0_STRUCT;
+
+typedef union {
+ struct {
+ U32 CAVrefCtl : 7; // Bits 6:0
+ U32 Ch1VrefCtl : 7; // Bits 13:7
+ U32 Ch0VrefCtl : 7; // Bits 20:14
+ U32 EnDimmVrefCA : 1; // Bits 21:21
+ U32 EnDimmVrefCh1 : 1; // Bits 22:22
+ U32 EnDimmVrefCh0 : 1; // Bits 23:23
+ U32 HiZTimerCtrl : 2; // Bits 25:24
+ U32 VccddqHiQnnnH : 1; // Bits 26:26
+ U32 Rsvd : 2; // Bits 28:27
+ U32 caSlowBW : 1; // Bits 29:29
+ U32 ch0SlowBW : 1; // Bits 30:30
+ U32 ch1SlowBW : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA7CH1_CR_DDRCRVREFADJUST1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH0_CR_RXTRAINRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH0_CR_RXTRAINRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH0_CR_RXTRAINRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH0_CR_RXTRAINRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH0_CR_RXPERBITRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH0_CR_RXPERBITRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH0_CR_RXPERBITRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH0_CR_RXPERBITRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH0_CR_TXTRAINRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH0_CR_TXTRAINRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH0_CR_TXTRAINRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH0_CR_TXTRAINRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH0_CR_TXPERBITRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH0_CR_TXPERBITRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH0_CR_TXPERBITRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH0_CR_TXPERBITRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcompDrvUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompDrvDown : 6; // Bits 14:9
+ U32 VTComp : 5; // Bits 19:15
+ U32 TcoComp : 6; // Bits 25:20
+ U32 SlewRateComp : 5; // Bits 30:26
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH0_CR_RCOMPDATA0_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcompOdtUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompOdtDown : 6; // Bits 14:9
+ U32 Spare1 : 1; // Bits 15:15
+ U32 PanicDrvDn : 6; // Bits 21:16
+ U32 PanicDrvUp : 6; // Bits 27:22
+ U32 LevelShifterComp : 3; // Bits 30:28
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH0_CR_RCOMPDATA1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH0_CR_TXXTALK_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH0_CR_RXOFFSETVDQ_STRUCT;
+
+typedef union {
+ struct {
+ U32 Spare : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH0_CR_DDRDATARESERVED_STRUCT;
+
+typedef union {
+ struct {
+ U32 DataTrainFeedback : 9; // Bits 8:0
+ U32 Spare : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH0_CR_DATATRAINFEEDBACK_STRUCT;
+
+typedef union {
+ struct {
+ U32 RunTest : 1; // Bits 0:0
+ U32 Load : 1; // Bits 1:1
+ U32 ModeHVM : 1; // Bits 2:2
+ U32 ModeDV : 1; // Bits 3:3
+ U32 ModeADC : 1; // Bits 4:4
+ U32 LoadCount : 10; // Bits 14:5
+ U32 CountStatus : 10; // Bits 24:15
+ U32 Spare : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH0_CR_DLLPITESTANDADC_STRUCT;
+
+typedef union {
+ struct {
+ U32 DqDrvUpCompOffset : 6; // Bits 5:0
+ U32 DqDrvDownCompOffset : 6; // Bits 11:6
+ U32 DqOdtUpCompOffset : 5; // Bits 16:12
+ U32 DqOdtDownCompOffset : 5; // Bits 21:17
+ U32 DqTcoCompOffset : 5; // Bits 26:22
+ U32 DqSlewRateCompOffset : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH0_CR_DDRCRDATAOFFSETCOMP_STRUCT;
+
+typedef union {
+ struct {
+ U32 RefPi : 4; // Bits 3:0
+ U32 DllMask : 2; // Bits 5:4
+ U32 DllWeakLock : 1; // Bits 6:6
+ U32 SdllSegmentDisable : 3; // Bits 9:7
+ U32 RxBiasCtl : 3; // Bits 12:10
+ U32 OdtDelay : 4; // Bits 16:13
+ U32 OdtDuration : 3; // Bits 19:17
+ U32 SenseAmpDelay : 4; // Bits 23:20
+ U32 SenseAmpDuration : 3; // Bits 26:24
+ U32 BurstEndODTDelay : 3; // Bits 29:27
+ U32 LpDdrLongOdtEn : 1; // Bits 30:30
+ U32 Rsvd1 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH0_CR_DDRCRDATACONTROL1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxStaggerCtl : 5; // Bits 4:0
+ U32 ForceBiasOn : 1; // Bits 5:5
+ U32 ForceRxOn : 1; // Bits 6:6
+ U32 LeakerComp : 2; // Bits 8:7
+ U32 RxDqsAmpOffset : 4; // Bits 12:9
+ U32 RxClkStgNum : 5; // Bits 17:13
+ U32 WlLongDelEn : 1; // Bits 18:18
+ U32 Spare : 13; // Bits 31:19
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH0_CR_DDRCRDATACONTROL2_STRUCT;
+
+typedef union {
+ struct {
+ U32 VssHiOrVrefCtl : 24; // Bits 23:0
+ U32 OutputCode : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH0_CR_DDRCRVSSHIORVREFCONTROL_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcvEnOffset : 6; // Bits 5:0
+ U32 RxDqsOffset : 6; // Bits 11:6
+ U32 TxDqOffset : 6; // Bits 17:12
+ U32 TxDqsOffset : 6; // Bits 23:18
+ U32 VrefOffset : 7; // Bits 30:24
+ U32 Spare : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH0_CR_DDRCRDATAOFFSETTRAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxTrainingMode : 1; // Bits 0:0
+ U32 WLTrainingMode : 1; // Bits 1:1
+ U32 RLTrainingMode : 1; // Bits 2:2
+ U32 SenseampTrainingMode : 1; // Bits 3:3
+ U32 TxOn : 1; // Bits 4:4
+ U32 RfOn : 1; // Bits 5:5
+ U32 RxPiOn : 1; // Bits 6:6
+ U32 TxPiOn : 1; // Bits 7:7
+ U32 InternalClocksOn : 1; // Bits 8:8
+ U32 RepeaterClocksOn : 1; // Bits 9:9
+ U32 TxDisable : 1; // Bits 10:10
+ U32 RxDisable : 1; // Bits 11:11
+ U32 TxLong : 1; // Bits 12:12
+ U32 RxDqsCtle : 2; // Bits 14:13
+ U32 RxReadPointer : 3; // Bits 17:15
+ U32 DriverSegmentEnable : 1; // Bits 18:18
+ U32 DataVccddqHi : 1; // Bits 19:19
+ U32 ReadRFRd : 1; // Bits 20:20
+ U32 ReadRFWr : 1; // Bits 21:21
+ U32 ReadRFRank : 2; // Bits 23:22
+ U32 ForceOdtOn : 1; // Bits 24:24
+ U32 OdtSampOff : 1; // Bits 25:25
+ U32 DisableOdtStatic : 1; // Bits 26:26
+ U32 DdrCRForceODTOn : 1; // Bits 27:27
+ U32 LPDDR_Mode : 1; // Bits 28:28
+ U32 EnReadPreamble : 1; // Bits 29:29
+ U32 OdtSampExtendEn : 1; // Bits 30:30
+ U32 EarlyRleakEn : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH0_CR_DDRCRDATACONTROL0_STRUCT;
+
+typedef union {
+ struct {
+ U32 CAVrefCtl : 7; // Bits 6:0
+ U32 Ch1VrefCtl : 7; // Bits 13:7
+ U32 Ch0VrefCtl : 7; // Bits 20:14
+ U32 EnDimmVrefCA : 1; // Bits 21:21
+ U32 EnDimmVrefCh1 : 1; // Bits 22:22
+ U32 EnDimmVrefCh0 : 1; // Bits 23:23
+ U32 HiZTimerCtrl : 2; // Bits 25:24
+ U32 VccddqHiQnnnH : 1; // Bits 26:26
+ U32 Rsvd : 2; // Bits 28:27
+ U32 caSlowBW : 1; // Bits 29:29
+ U32 ch0SlowBW : 1; // Bits 30:30
+ U32 ch1SlowBW : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH0_CR_DDRCRVREFADJUST1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH1_CR_RXTRAINRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH1_CR_RXTRAINRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH1_CR_RXTRAINRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxRcvEnPi : 9; // Bits 8:0
+ U32 RxDqsPPi : 6; // Bits 14:9
+ U32 RxEq : 5; // Bits 19:15
+ U32 RxDqsNPi : 6; // Bits 25:20
+ U32 RxVref : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH1_CR_RXTRAINRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH1_CR_RXPERBITRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH1_CR_RXPERBITRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH1_CR_RXPERBITRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH1_CR_RXPERBITRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH1_CR_TXTRAINRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH1_CR_TXTRAINRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH1_CR_TXTRAINRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 TxDqDelay : 9; // Bits 8:0
+ U32 TxDqsDelay : 9; // Bits 17:9
+ U32 Spare0 : 2; // Bits 19:18
+ U32 TxEqualization : 6; // Bits 25:20
+ U32 Spare1 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH1_CR_TXTRAINRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH1_CR_TXPERBITRANK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH1_CR_TXPERBITRANK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH1_CR_TXPERBITRANK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH1_CR_TXPERBITRANK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcompDrvUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompDrvDown : 6; // Bits 14:9
+ U32 VTComp : 5; // Bits 19:15
+ U32 TcoComp : 6; // Bits 25:20
+ U32 SlewRateComp : 5; // Bits 30:26
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH1_CR_RCOMPDATA0_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcompOdtUp : 6; // Bits 5:0
+ U32 Spare0 : 3; // Bits 8:6
+ U32 RcompOdtDown : 6; // Bits 14:9
+ U32 Spare1 : 1; // Bits 15:15
+ U32 PanicDrvDn : 6; // Bits 21:16
+ U32 PanicDrvUp : 6; // Bits 27:22
+ U32 LevelShifterComp : 3; // Bits 30:28
+ U32 Spare2 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH1_CR_RCOMPDATA1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH1_CR_TXXTALK_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lane0 : 4; // Bits 3:0
+ U32 Lane1 : 4; // Bits 7:4
+ U32 Lane2 : 4; // Bits 11:8
+ U32 Lane3 : 4; // Bits 15:12
+ U32 Lane4 : 4; // Bits 19:16
+ U32 Lane5 : 4; // Bits 23:20
+ U32 Lane6 : 4; // Bits 27:24
+ U32 Lane7 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH1_CR_RXOFFSETVDQ_STRUCT;
+
+typedef union {
+ struct {
+ U32 Spare : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH1_CR_DDRDATARESERVED_STRUCT;
+
+typedef union {
+ struct {
+ U32 DataTrainFeedback : 9; // Bits 8:0
+ U32 Spare : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH1_CR_DATATRAINFEEDBACK_STRUCT;
+
+typedef union {
+ struct {
+ U32 RunTest : 1; // Bits 0:0
+ U32 Load : 1; // Bits 1:1
+ U32 ModeHVM : 1; // Bits 2:2
+ U32 ModeDV : 1; // Bits 3:3
+ U32 ModeADC : 1; // Bits 4:4
+ U32 LoadCount : 10; // Bits 14:5
+ U32 CountStatus : 10; // Bits 24:15
+ U32 Spare : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH1_CR_DLLPITESTANDADC_STRUCT;
+
+typedef union {
+ struct {
+ U32 DqDrvUpCompOffset : 6; // Bits 5:0
+ U32 DqDrvDownCompOffset : 6; // Bits 11:6
+ U32 DqOdtUpCompOffset : 5; // Bits 16:12
+ U32 DqOdtDownCompOffset : 5; // Bits 21:17
+ U32 DqTcoCompOffset : 5; // Bits 26:22
+ U32 DqSlewRateCompOffset : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH1_CR_DDRCRDATAOFFSETCOMP_STRUCT;
+
+typedef union {
+ struct {
+ U32 RefPi : 4; // Bits 3:0
+ U32 DllMask : 2; // Bits 5:4
+ U32 DllWeakLock : 1; // Bits 6:6
+ U32 SdllSegmentDisable : 3; // Bits 9:7
+ U32 RxBiasCtl : 3; // Bits 12:10
+ U32 OdtDelay : 4; // Bits 16:13
+ U32 OdtDuration : 3; // Bits 19:17
+ U32 SenseAmpDelay : 4; // Bits 23:20
+ U32 SenseAmpDuration : 3; // Bits 26:24
+ U32 BurstEndODTDelay : 3; // Bits 29:27
+ U32 LpDdrLongOdtEn : 1; // Bits 30:30
+ U32 Rsvd1 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH1_CR_DDRCRDATACONTROL1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxStaggerCtl : 5; // Bits 4:0
+ U32 ForceBiasOn : 1; // Bits 5:5
+ U32 ForceRxOn : 1; // Bits 6:6
+ U32 LeakerComp : 2; // Bits 8:7
+ U32 RxDqsAmpOffset : 4; // Bits 12:9
+ U32 RxClkStgNum : 5; // Bits 17:13
+ U32 WlLongDelEn : 1; // Bits 18:18
+ U32 Spare : 13; // Bits 31:19
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH1_CR_DDRCRDATACONTROL2_STRUCT;
+
+typedef union {
+ struct {
+ U32 VssHiOrVrefCtl : 24; // Bits 23:0
+ U32 OutputCode : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH1_CR_DDRCRVSSHIORVREFCONTROL_STRUCT;
+
+typedef union {
+ struct {
+ U32 RcvEnOffset : 6; // Bits 5:0
+ U32 RxDqsOffset : 6; // Bits 11:6
+ U32 TxDqOffset : 6; // Bits 17:12
+ U32 TxDqsOffset : 6; // Bits 23:18
+ U32 VrefOffset : 7; // Bits 30:24
+ U32 Spare : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH1_CR_DDRCRDATAOFFSETTRAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 RxTrainingMode : 1; // Bits 0:0
+ U32 WLTrainingMode : 1; // Bits 1:1
+ U32 RLTrainingMode : 1; // Bits 2:2
+ U32 SenseampTrainingMode : 1; // Bits 3:3
+ U32 TxOn : 1; // Bits 4:4
+ U32 RfOn : 1; // Bits 5:5
+ U32 RxPiOn : 1; // Bits 6:6
+ U32 TxPiOn : 1; // Bits 7:7
+ U32 InternalClocksOn : 1; // Bits 8:8
+ U32 RepeaterClocksOn : 1; // Bits 9:9
+ U32 TxDisable : 1; // Bits 10:10
+ U32 RxDisable : 1; // Bits 11:11
+ U32 TxLong : 1; // Bits 12:12
+ U32 RxDqsCtle : 2; // Bits 14:13
+ U32 RxReadPointer : 3; // Bits 17:15
+ U32 DriverSegmentEnable : 1; // Bits 18:18
+ U32 DataVccddqHi : 1; // Bits 19:19
+ U32 ReadRFRd : 1; // Bits 20:20
+ U32 ReadRFWr : 1; // Bits 21:21
+ U32 ReadRFRank : 2; // Bits 23:22
+ U32 ForceOdtOn : 1; // Bits 24:24
+ U32 OdtSampOff : 1; // Bits 25:25
+ U32 DisableOdtStatic : 1; // Bits 26:26
+ U32 DdrCRForceODTOn : 1; // Bits 27:27
+ U32 LPDDR_Mode : 1; // Bits 28:28
+ U32 EnReadPreamble : 1; // Bits 29:29
+ U32 OdtSampExtendEn : 1; // Bits 30:30
+ U32 EarlyRleakEn : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH1_CR_DDRCRDATACONTROL0_STRUCT;
+
+typedef union {
+ struct {
+ U32 CAVrefCtl : 7; // Bits 6:0
+ U32 Ch1VrefCtl : 7; // Bits 13:7
+ U32 Ch0VrefCtl : 7; // Bits 20:14
+ U32 EnDimmVrefCA : 1; // Bits 21:21
+ U32 EnDimmVrefCh1 : 1; // Bits 22:22
+ U32 EnDimmVrefCh0 : 1; // Bits 23:23
+ U32 HiZTimerCtrl : 2; // Bits 25:24
+ U32 VccddqHiQnnnH : 1; // Bits 26:26
+ U32 Rsvd : 2; // Bits 28:27
+ U32 caSlowBW : 1; // Bits 29:29
+ U32 ch0SlowBW : 1; // Bits 30:30
+ U32 ch1SlowBW : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRDATA8CH1_CR_DDRCRVREFADJUST1_STRUCT;
+
+#define DDRDATA_CR_RXTRAINRANK0_REG (0x00003600)
+ #define DDRDATA_CR_RXTRAINRANK0_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA_CR_RXTRAINRANK0_RxRcvEnPi_WID ( 9)
+ #define DDRDATA_CR_RXTRAINRANK0_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA_CR_RXTRAINRANK0_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA_CR_RXTRAINRANK0_RxDqsPPi_OFF ( 9)
+ #define DDRDATA_CR_RXTRAINRANK0_RxDqsPPi_WID ( 6)
+ #define DDRDATA_CR_RXTRAINRANK0_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA_CR_RXTRAINRANK0_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA_CR_RXTRAINRANK0_RxEq_OFF (15)
+ #define DDRDATA_CR_RXTRAINRANK0_RxEq_WID ( 5)
+ #define DDRDATA_CR_RXTRAINRANK0_RxEq_MSK (0x000F8000)
+ #define DDRDATA_CR_RXTRAINRANK0_RxEq_MAX (0x0000001F)
+ #define DDRDATA_CR_RXTRAINRANK0_RxDqsNPi_OFF (20)
+ #define DDRDATA_CR_RXTRAINRANK0_RxDqsNPi_WID ( 6)
+ #define DDRDATA_CR_RXTRAINRANK0_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA_CR_RXTRAINRANK0_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA_CR_RXTRAINRANK0_RxVref_OFF (26)
+ #define DDRDATA_CR_RXTRAINRANK0_RxVref_WID ( 6)
+ #define DDRDATA_CR_RXTRAINRANK0_RxVref_MSK (0xFC000000)
+ #define DDRDATA_CR_RXTRAINRANK0_RxVref_MAX (0x0000003F)
+
+#define DDRDATA_CR_RXTRAINRANK1_REG (0x00003604)
+ #define DDRDATA_CR_RXTRAINRANK1_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA_CR_RXTRAINRANK1_RxRcvEnPi_WID ( 9)
+ #define DDRDATA_CR_RXTRAINRANK1_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA_CR_RXTRAINRANK1_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA_CR_RXTRAINRANK1_RxDqsPPi_OFF ( 9)
+ #define DDRDATA_CR_RXTRAINRANK1_RxDqsPPi_WID ( 6)
+ #define DDRDATA_CR_RXTRAINRANK1_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA_CR_RXTRAINRANK1_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA_CR_RXTRAINRANK1_RxEq_OFF (15)
+ #define DDRDATA_CR_RXTRAINRANK1_RxEq_WID ( 5)
+ #define DDRDATA_CR_RXTRAINRANK1_RxEq_MSK (0x000F8000)
+ #define DDRDATA_CR_RXTRAINRANK1_RxEq_MAX (0x0000001F)
+ #define DDRDATA_CR_RXTRAINRANK1_RxDqsNPi_OFF (20)
+ #define DDRDATA_CR_RXTRAINRANK1_RxDqsNPi_WID ( 6)
+ #define DDRDATA_CR_RXTRAINRANK1_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA_CR_RXTRAINRANK1_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA_CR_RXTRAINRANK1_RxVref_OFF (26)
+ #define DDRDATA_CR_RXTRAINRANK1_RxVref_WID ( 6)
+ #define DDRDATA_CR_RXTRAINRANK1_RxVref_MSK (0xFC000000)
+ #define DDRDATA_CR_RXTRAINRANK1_RxVref_MAX (0x0000003F)
+
+#define DDRDATA_CR_RXTRAINRANK2_REG (0x00003608)
+ #define DDRDATA_CR_RXTRAINRANK2_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA_CR_RXTRAINRANK2_RxRcvEnPi_WID ( 9)
+ #define DDRDATA_CR_RXTRAINRANK2_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA_CR_RXTRAINRANK2_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA_CR_RXTRAINRANK2_RxDqsPPi_OFF ( 9)
+ #define DDRDATA_CR_RXTRAINRANK2_RxDqsPPi_WID ( 6)
+ #define DDRDATA_CR_RXTRAINRANK2_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA_CR_RXTRAINRANK2_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA_CR_RXTRAINRANK2_RxEq_OFF (15)
+ #define DDRDATA_CR_RXTRAINRANK2_RxEq_WID ( 5)
+ #define DDRDATA_CR_RXTRAINRANK2_RxEq_MSK (0x000F8000)
+ #define DDRDATA_CR_RXTRAINRANK2_RxEq_MAX (0x0000001F)
+ #define DDRDATA_CR_RXTRAINRANK2_RxDqsNPi_OFF (20)
+ #define DDRDATA_CR_RXTRAINRANK2_RxDqsNPi_WID ( 6)
+ #define DDRDATA_CR_RXTRAINRANK2_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA_CR_RXTRAINRANK2_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA_CR_RXTRAINRANK2_RxVref_OFF (26)
+ #define DDRDATA_CR_RXTRAINRANK2_RxVref_WID ( 6)
+ #define DDRDATA_CR_RXTRAINRANK2_RxVref_MSK (0xFC000000)
+ #define DDRDATA_CR_RXTRAINRANK2_RxVref_MAX (0x0000003F)
+
+#define DDRDATA_CR_RXTRAINRANK3_REG (0x0000360C)
+ #define DDRDATA_CR_RXTRAINRANK3_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA_CR_RXTRAINRANK3_RxRcvEnPi_WID ( 9)
+ #define DDRDATA_CR_RXTRAINRANK3_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA_CR_RXTRAINRANK3_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA_CR_RXTRAINRANK3_RxDqsPPi_OFF ( 9)
+ #define DDRDATA_CR_RXTRAINRANK3_RxDqsPPi_WID ( 6)
+ #define DDRDATA_CR_RXTRAINRANK3_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA_CR_RXTRAINRANK3_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA_CR_RXTRAINRANK3_RxEq_OFF (15)
+ #define DDRDATA_CR_RXTRAINRANK3_RxEq_WID ( 5)
+ #define DDRDATA_CR_RXTRAINRANK3_RxEq_MSK (0x000F8000)
+ #define DDRDATA_CR_RXTRAINRANK3_RxEq_MAX (0x0000001F)
+ #define DDRDATA_CR_RXTRAINRANK3_RxDqsNPi_OFF (20)
+ #define DDRDATA_CR_RXTRAINRANK3_RxDqsNPi_WID ( 6)
+ #define DDRDATA_CR_RXTRAINRANK3_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA_CR_RXTRAINRANK3_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA_CR_RXTRAINRANK3_RxVref_OFF (26)
+ #define DDRDATA_CR_RXTRAINRANK3_RxVref_WID ( 6)
+ #define DDRDATA_CR_RXTRAINRANK3_RxVref_MSK (0xFC000000)
+ #define DDRDATA_CR_RXTRAINRANK3_RxVref_MAX (0x0000003F)
+
+#define DDRDATA_CR_RXPERBITRANK0_REG (0x00003610)
+ #define DDRDATA_CR_RXPERBITRANK0_Lane0_OFF ( 0)
+ #define DDRDATA_CR_RXPERBITRANK0_Lane0_WID ( 4)
+ #define DDRDATA_CR_RXPERBITRANK0_Lane0_MSK (0x0000000F)
+ #define DDRDATA_CR_RXPERBITRANK0_Lane0_MAX (0x0000000F)
+ #define DDRDATA_CR_RXPERBITRANK0_Lane1_OFF ( 4)
+ #define DDRDATA_CR_RXPERBITRANK0_Lane1_WID ( 4)
+ #define DDRDATA_CR_RXPERBITRANK0_Lane1_MSK (0x000000F0)
+ #define DDRDATA_CR_RXPERBITRANK0_Lane1_MAX (0x0000000F)
+ #define DDRDATA_CR_RXPERBITRANK0_Lane2_OFF ( 8)
+ #define DDRDATA_CR_RXPERBITRANK0_Lane2_WID ( 4)
+ #define DDRDATA_CR_RXPERBITRANK0_Lane2_MSK (0x00000F00)
+ #define DDRDATA_CR_RXPERBITRANK0_Lane2_MAX (0x0000000F)
+ #define DDRDATA_CR_RXPERBITRANK0_Lane3_OFF (12)
+ #define DDRDATA_CR_RXPERBITRANK0_Lane3_WID ( 4)
+ #define DDRDATA_CR_RXPERBITRANK0_Lane3_MSK (0x0000F000)
+ #define DDRDATA_CR_RXPERBITRANK0_Lane3_MAX (0x0000000F)
+ #define DDRDATA_CR_RXPERBITRANK0_Lane4_OFF (16)
+ #define DDRDATA_CR_RXPERBITRANK0_Lane4_WID ( 4)
+ #define DDRDATA_CR_RXPERBITRANK0_Lane4_MSK (0x000F0000)
+ #define DDRDATA_CR_RXPERBITRANK0_Lane4_MAX (0x0000000F)
+ #define DDRDATA_CR_RXPERBITRANK0_Lane5_OFF (20)
+ #define DDRDATA_CR_RXPERBITRANK0_Lane5_WID ( 4)
+ #define DDRDATA_CR_RXPERBITRANK0_Lane5_MSK (0x00F00000)
+ #define DDRDATA_CR_RXPERBITRANK0_Lane5_MAX (0x0000000F)
+ #define DDRDATA_CR_RXPERBITRANK0_Lane6_OFF (24)
+ #define DDRDATA_CR_RXPERBITRANK0_Lane6_WID ( 4)
+ #define DDRDATA_CR_RXPERBITRANK0_Lane6_MSK (0x0F000000)
+ #define DDRDATA_CR_RXPERBITRANK0_Lane6_MAX (0x0000000F)
+ #define DDRDATA_CR_RXPERBITRANK0_Lane7_OFF (28)
+ #define DDRDATA_CR_RXPERBITRANK0_Lane7_WID ( 4)
+ #define DDRDATA_CR_RXPERBITRANK0_Lane7_MSK (0xF0000000)
+ #define DDRDATA_CR_RXPERBITRANK0_Lane7_MAX (0x0000000F)
+
+#define DDRDATA_CR_RXPERBITRANK1_REG (0x00003614)
+ #define DDRDATA_CR_RXPERBITRANK1_Lane0_OFF ( 0)
+ #define DDRDATA_CR_RXPERBITRANK1_Lane0_WID ( 4)
+ #define DDRDATA_CR_RXPERBITRANK1_Lane0_MSK (0x0000000F)
+ #define DDRDATA_CR_RXPERBITRANK1_Lane0_MAX (0x0000000F)
+ #define DDRDATA_CR_RXPERBITRANK1_Lane1_OFF ( 4)
+ #define DDRDATA_CR_RXPERBITRANK1_Lane1_WID ( 4)
+ #define DDRDATA_CR_RXPERBITRANK1_Lane1_MSK (0x000000F0)
+ #define DDRDATA_CR_RXPERBITRANK1_Lane1_MAX (0x0000000F)
+ #define DDRDATA_CR_RXPERBITRANK1_Lane2_OFF ( 8)
+ #define DDRDATA_CR_RXPERBITRANK1_Lane2_WID ( 4)
+ #define DDRDATA_CR_RXPERBITRANK1_Lane2_MSK (0x00000F00)
+ #define DDRDATA_CR_RXPERBITRANK1_Lane2_MAX (0x0000000F)
+ #define DDRDATA_CR_RXPERBITRANK1_Lane3_OFF (12)
+ #define DDRDATA_CR_RXPERBITRANK1_Lane3_WID ( 4)
+ #define DDRDATA_CR_RXPERBITRANK1_Lane3_MSK (0x0000F000)
+ #define DDRDATA_CR_RXPERBITRANK1_Lane3_MAX (0x0000000F)
+ #define DDRDATA_CR_RXPERBITRANK1_Lane4_OFF (16)
+ #define DDRDATA_CR_RXPERBITRANK1_Lane4_WID ( 4)
+ #define DDRDATA_CR_RXPERBITRANK1_Lane4_MSK (0x000F0000)
+ #define DDRDATA_CR_RXPERBITRANK1_Lane4_MAX (0x0000000F)
+ #define DDRDATA_CR_RXPERBITRANK1_Lane5_OFF (20)
+ #define DDRDATA_CR_RXPERBITRANK1_Lane5_WID ( 4)
+ #define DDRDATA_CR_RXPERBITRANK1_Lane5_MSK (0x00F00000)
+ #define DDRDATA_CR_RXPERBITRANK1_Lane5_MAX (0x0000000F)
+ #define DDRDATA_CR_RXPERBITRANK1_Lane6_OFF (24)
+ #define DDRDATA_CR_RXPERBITRANK1_Lane6_WID ( 4)
+ #define DDRDATA_CR_RXPERBITRANK1_Lane6_MSK (0x0F000000)
+ #define DDRDATA_CR_RXPERBITRANK1_Lane6_MAX (0x0000000F)
+ #define DDRDATA_CR_RXPERBITRANK1_Lane7_OFF (28)
+ #define DDRDATA_CR_RXPERBITRANK1_Lane7_WID ( 4)
+ #define DDRDATA_CR_RXPERBITRANK1_Lane7_MSK (0xF0000000)
+ #define DDRDATA_CR_RXPERBITRANK1_Lane7_MAX (0x0000000F)
+
+#define DDRDATA_CR_RXPERBITRANK2_REG (0x00003618)
+ #define DDRDATA_CR_RXPERBITRANK2_Lane0_OFF ( 0)
+ #define DDRDATA_CR_RXPERBITRANK2_Lane0_WID ( 4)
+ #define DDRDATA_CR_RXPERBITRANK2_Lane0_MSK (0x0000000F)
+ #define DDRDATA_CR_RXPERBITRANK2_Lane0_MAX (0x0000000F)
+ #define DDRDATA_CR_RXPERBITRANK2_Lane1_OFF ( 4)
+ #define DDRDATA_CR_RXPERBITRANK2_Lane1_WID ( 4)
+ #define DDRDATA_CR_RXPERBITRANK2_Lane1_MSK (0x000000F0)
+ #define DDRDATA_CR_RXPERBITRANK2_Lane1_MAX (0x0000000F)
+ #define DDRDATA_CR_RXPERBITRANK2_Lane2_OFF ( 8)
+ #define DDRDATA_CR_RXPERBITRANK2_Lane2_WID ( 4)
+ #define DDRDATA_CR_RXPERBITRANK2_Lane2_MSK (0x00000F00)
+ #define DDRDATA_CR_RXPERBITRANK2_Lane2_MAX (0x0000000F)
+ #define DDRDATA_CR_RXPERBITRANK2_Lane3_OFF (12)
+ #define DDRDATA_CR_RXPERBITRANK2_Lane3_WID ( 4)
+ #define DDRDATA_CR_RXPERBITRANK2_Lane3_MSK (0x0000F000)
+ #define DDRDATA_CR_RXPERBITRANK2_Lane3_MAX (0x0000000F)
+ #define DDRDATA_CR_RXPERBITRANK2_Lane4_OFF (16)
+ #define DDRDATA_CR_RXPERBITRANK2_Lane4_WID ( 4)
+ #define DDRDATA_CR_RXPERBITRANK2_Lane4_MSK (0x000F0000)
+ #define DDRDATA_CR_RXPERBITRANK2_Lane4_MAX (0x0000000F)
+ #define DDRDATA_CR_RXPERBITRANK2_Lane5_OFF (20)
+ #define DDRDATA_CR_RXPERBITRANK2_Lane5_WID ( 4)
+ #define DDRDATA_CR_RXPERBITRANK2_Lane5_MSK (0x00F00000)
+ #define DDRDATA_CR_RXPERBITRANK2_Lane5_MAX (0x0000000F)
+ #define DDRDATA_CR_RXPERBITRANK2_Lane6_OFF (24)
+ #define DDRDATA_CR_RXPERBITRANK2_Lane6_WID ( 4)
+ #define DDRDATA_CR_RXPERBITRANK2_Lane6_MSK (0x0F000000)
+ #define DDRDATA_CR_RXPERBITRANK2_Lane6_MAX (0x0000000F)
+ #define DDRDATA_CR_RXPERBITRANK2_Lane7_OFF (28)
+ #define DDRDATA_CR_RXPERBITRANK2_Lane7_WID ( 4)
+ #define DDRDATA_CR_RXPERBITRANK2_Lane7_MSK (0xF0000000)
+ #define DDRDATA_CR_RXPERBITRANK2_Lane7_MAX (0x0000000F)
+
+#define DDRDATA_CR_RXPERBITRANK3_REG (0x0000361C)
+ #define DDRDATA_CR_RXPERBITRANK3_Lane0_OFF ( 0)
+ #define DDRDATA_CR_RXPERBITRANK3_Lane0_WID ( 4)
+ #define DDRDATA_CR_RXPERBITRANK3_Lane0_MSK (0x0000000F)
+ #define DDRDATA_CR_RXPERBITRANK3_Lane0_MAX (0x0000000F)
+ #define DDRDATA_CR_RXPERBITRANK3_Lane1_OFF ( 4)
+ #define DDRDATA_CR_RXPERBITRANK3_Lane1_WID ( 4)
+ #define DDRDATA_CR_RXPERBITRANK3_Lane1_MSK (0x000000F0)
+ #define DDRDATA_CR_RXPERBITRANK3_Lane1_MAX (0x0000000F)
+ #define DDRDATA_CR_RXPERBITRANK3_Lane2_OFF ( 8)
+ #define DDRDATA_CR_RXPERBITRANK3_Lane2_WID ( 4)
+ #define DDRDATA_CR_RXPERBITRANK3_Lane2_MSK (0x00000F00)
+ #define DDRDATA_CR_RXPERBITRANK3_Lane2_MAX (0x0000000F)
+ #define DDRDATA_CR_RXPERBITRANK3_Lane3_OFF (12)
+ #define DDRDATA_CR_RXPERBITRANK3_Lane3_WID ( 4)
+ #define DDRDATA_CR_RXPERBITRANK3_Lane3_MSK (0x0000F000)
+ #define DDRDATA_CR_RXPERBITRANK3_Lane3_MAX (0x0000000F)
+ #define DDRDATA_CR_RXPERBITRANK3_Lane4_OFF (16)
+ #define DDRDATA_CR_RXPERBITRANK3_Lane4_WID ( 4)
+ #define DDRDATA_CR_RXPERBITRANK3_Lane4_MSK (0x000F0000)
+ #define DDRDATA_CR_RXPERBITRANK3_Lane4_MAX (0x0000000F)
+ #define DDRDATA_CR_RXPERBITRANK3_Lane5_OFF (20)
+ #define DDRDATA_CR_RXPERBITRANK3_Lane5_WID ( 4)
+ #define DDRDATA_CR_RXPERBITRANK3_Lane5_MSK (0x00F00000)
+ #define DDRDATA_CR_RXPERBITRANK3_Lane5_MAX (0x0000000F)
+ #define DDRDATA_CR_RXPERBITRANK3_Lane6_OFF (24)
+ #define DDRDATA_CR_RXPERBITRANK3_Lane6_WID ( 4)
+ #define DDRDATA_CR_RXPERBITRANK3_Lane6_MSK (0x0F000000)
+ #define DDRDATA_CR_RXPERBITRANK3_Lane6_MAX (0x0000000F)
+ #define DDRDATA_CR_RXPERBITRANK3_Lane7_OFF (28)
+ #define DDRDATA_CR_RXPERBITRANK3_Lane7_WID ( 4)
+ #define DDRDATA_CR_RXPERBITRANK3_Lane7_MSK (0xF0000000)
+ #define DDRDATA_CR_RXPERBITRANK3_Lane7_MAX (0x0000000F)
+
+#define DDRDATA_CR_TXTRAINRANK0_REG (0x00003620)
+ #define DDRDATA_CR_TXTRAINRANK0_TxDqDelay_OFF ( 0)
+ #define DDRDATA_CR_TXTRAINRANK0_TxDqDelay_WID ( 9)
+ #define DDRDATA_CR_TXTRAINRANK0_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA_CR_TXTRAINRANK0_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA_CR_TXTRAINRANK0_TxDqsDelay_OFF ( 9)
+ #define DDRDATA_CR_TXTRAINRANK0_TxDqsDelay_WID ( 9)
+ #define DDRDATA_CR_TXTRAINRANK0_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA_CR_TXTRAINRANK0_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA_CR_TXTRAINRANK0_Spare0_OFF (18)
+ #define DDRDATA_CR_TXTRAINRANK0_Spare0_WID ( 2)
+ #define DDRDATA_CR_TXTRAINRANK0_Spare0_MSK (0x000C0000)
+ #define DDRDATA_CR_TXTRAINRANK0_Spare0_MAX (0x00000003)
+ #define DDRDATA_CR_TXTRAINRANK0_TxEqualization_OFF (20)
+ #define DDRDATA_CR_TXTRAINRANK0_TxEqualization_WID ( 6)
+ #define DDRDATA_CR_TXTRAINRANK0_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA_CR_TXTRAINRANK0_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA_CR_TXTRAINRANK0_Spare1_OFF (26)
+ #define DDRDATA_CR_TXTRAINRANK0_Spare1_WID ( 6)
+ #define DDRDATA_CR_TXTRAINRANK0_Spare1_MSK (0xFC000000)
+ #define DDRDATA_CR_TXTRAINRANK0_Spare1_MAX (0x0000003F)
+
+#define DDRDATA_CR_TXTRAINRANK1_REG (0x00003624)
+ #define DDRDATA_CR_TXTRAINRANK1_TxDqDelay_OFF ( 0)
+ #define DDRDATA_CR_TXTRAINRANK1_TxDqDelay_WID ( 9)
+ #define DDRDATA_CR_TXTRAINRANK1_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA_CR_TXTRAINRANK1_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA_CR_TXTRAINRANK1_TxDqsDelay_OFF ( 9)
+ #define DDRDATA_CR_TXTRAINRANK1_TxDqsDelay_WID ( 9)
+ #define DDRDATA_CR_TXTRAINRANK1_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA_CR_TXTRAINRANK1_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA_CR_TXTRAINRANK1_Spare0_OFF (18)
+ #define DDRDATA_CR_TXTRAINRANK1_Spare0_WID ( 2)
+ #define DDRDATA_CR_TXTRAINRANK1_Spare0_MSK (0x000C0000)
+ #define DDRDATA_CR_TXTRAINRANK1_Spare0_MAX (0x00000003)
+ #define DDRDATA_CR_TXTRAINRANK1_TxEqualization_OFF (20)
+ #define DDRDATA_CR_TXTRAINRANK1_TxEqualization_WID ( 6)
+ #define DDRDATA_CR_TXTRAINRANK1_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA_CR_TXTRAINRANK1_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA_CR_TXTRAINRANK1_Spare1_OFF (26)
+ #define DDRDATA_CR_TXTRAINRANK1_Spare1_WID ( 6)
+ #define DDRDATA_CR_TXTRAINRANK1_Spare1_MSK (0xFC000000)
+ #define DDRDATA_CR_TXTRAINRANK1_Spare1_MAX (0x0000003F)
+
+#define DDRDATA_CR_TXTRAINRANK2_REG (0x00003628)
+ #define DDRDATA_CR_TXTRAINRANK2_TxDqDelay_OFF ( 0)
+ #define DDRDATA_CR_TXTRAINRANK2_TxDqDelay_WID ( 9)
+ #define DDRDATA_CR_TXTRAINRANK2_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA_CR_TXTRAINRANK2_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA_CR_TXTRAINRANK2_TxDqsDelay_OFF ( 9)
+ #define DDRDATA_CR_TXTRAINRANK2_TxDqsDelay_WID ( 9)
+ #define DDRDATA_CR_TXTRAINRANK2_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA_CR_TXTRAINRANK2_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA_CR_TXTRAINRANK2_Spare0_OFF (18)
+ #define DDRDATA_CR_TXTRAINRANK2_Spare0_WID ( 2)
+ #define DDRDATA_CR_TXTRAINRANK2_Spare0_MSK (0x000C0000)
+ #define DDRDATA_CR_TXTRAINRANK2_Spare0_MAX (0x00000003)
+ #define DDRDATA_CR_TXTRAINRANK2_TxEqualization_OFF (20)
+ #define DDRDATA_CR_TXTRAINRANK2_TxEqualization_WID ( 6)
+ #define DDRDATA_CR_TXTRAINRANK2_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA_CR_TXTRAINRANK2_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA_CR_TXTRAINRANK2_Spare1_OFF (26)
+ #define DDRDATA_CR_TXTRAINRANK2_Spare1_WID ( 6)
+ #define DDRDATA_CR_TXTRAINRANK2_Spare1_MSK (0xFC000000)
+ #define DDRDATA_CR_TXTRAINRANK2_Spare1_MAX (0x0000003F)
+
+#define DDRDATA_CR_TXTRAINRANK3_REG (0x0000362C)
+ #define DDRDATA_CR_TXTRAINRANK3_TxDqDelay_OFF ( 0)
+ #define DDRDATA_CR_TXTRAINRANK3_TxDqDelay_WID ( 9)
+ #define DDRDATA_CR_TXTRAINRANK3_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA_CR_TXTRAINRANK3_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA_CR_TXTRAINRANK3_TxDqsDelay_OFF ( 9)
+ #define DDRDATA_CR_TXTRAINRANK3_TxDqsDelay_WID ( 9)
+ #define DDRDATA_CR_TXTRAINRANK3_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA_CR_TXTRAINRANK3_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA_CR_TXTRAINRANK3_Spare0_OFF (18)
+ #define DDRDATA_CR_TXTRAINRANK3_Spare0_WID ( 2)
+ #define DDRDATA_CR_TXTRAINRANK3_Spare0_MSK (0x000C0000)
+ #define DDRDATA_CR_TXTRAINRANK3_Spare0_MAX (0x00000003)
+ #define DDRDATA_CR_TXTRAINRANK3_TxEqualization_OFF (20)
+ #define DDRDATA_CR_TXTRAINRANK3_TxEqualization_WID ( 6)
+ #define DDRDATA_CR_TXTRAINRANK3_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA_CR_TXTRAINRANK3_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA_CR_TXTRAINRANK3_Spare1_OFF (26)
+ #define DDRDATA_CR_TXTRAINRANK3_Spare1_WID ( 6)
+ #define DDRDATA_CR_TXTRAINRANK3_Spare1_MSK (0xFC000000)
+ #define DDRDATA_CR_TXTRAINRANK3_Spare1_MAX (0x0000003F)
+
+#define DDRDATA_CR_TXPERBITRANK0_REG (0x00003630)
+ #define DDRDATA_CR_TXPERBITRANK0_Lane0_OFF ( 0)
+ #define DDRDATA_CR_TXPERBITRANK0_Lane0_WID ( 4)
+ #define DDRDATA_CR_TXPERBITRANK0_Lane0_MSK (0x0000000F)
+ #define DDRDATA_CR_TXPERBITRANK0_Lane0_MAX (0x0000000F)
+ #define DDRDATA_CR_TXPERBITRANK0_Lane1_OFF ( 4)
+ #define DDRDATA_CR_TXPERBITRANK0_Lane1_WID ( 4)
+ #define DDRDATA_CR_TXPERBITRANK0_Lane1_MSK (0x000000F0)
+ #define DDRDATA_CR_TXPERBITRANK0_Lane1_MAX (0x0000000F)
+ #define DDRDATA_CR_TXPERBITRANK0_Lane2_OFF ( 8)
+ #define DDRDATA_CR_TXPERBITRANK0_Lane2_WID ( 4)
+ #define DDRDATA_CR_TXPERBITRANK0_Lane2_MSK (0x00000F00)
+ #define DDRDATA_CR_TXPERBITRANK0_Lane2_MAX (0x0000000F)
+ #define DDRDATA_CR_TXPERBITRANK0_Lane3_OFF (12)
+ #define DDRDATA_CR_TXPERBITRANK0_Lane3_WID ( 4)
+ #define DDRDATA_CR_TXPERBITRANK0_Lane3_MSK (0x0000F000)
+ #define DDRDATA_CR_TXPERBITRANK0_Lane3_MAX (0x0000000F)
+ #define DDRDATA_CR_TXPERBITRANK0_Lane4_OFF (16)
+ #define DDRDATA_CR_TXPERBITRANK0_Lane4_WID ( 4)
+ #define DDRDATA_CR_TXPERBITRANK0_Lane4_MSK (0x000F0000)
+ #define DDRDATA_CR_TXPERBITRANK0_Lane4_MAX (0x0000000F)
+ #define DDRDATA_CR_TXPERBITRANK0_Lane5_OFF (20)
+ #define DDRDATA_CR_TXPERBITRANK0_Lane5_WID ( 4)
+ #define DDRDATA_CR_TXPERBITRANK0_Lane5_MSK (0x00F00000)
+ #define DDRDATA_CR_TXPERBITRANK0_Lane5_MAX (0x0000000F)
+ #define DDRDATA_CR_TXPERBITRANK0_Lane6_OFF (24)
+ #define DDRDATA_CR_TXPERBITRANK0_Lane6_WID ( 4)
+ #define DDRDATA_CR_TXPERBITRANK0_Lane6_MSK (0x0F000000)
+ #define DDRDATA_CR_TXPERBITRANK0_Lane6_MAX (0x0000000F)
+ #define DDRDATA_CR_TXPERBITRANK0_Lane7_OFF (28)
+ #define DDRDATA_CR_TXPERBITRANK0_Lane7_WID ( 4)
+ #define DDRDATA_CR_TXPERBITRANK0_Lane7_MSK (0xF0000000)
+ #define DDRDATA_CR_TXPERBITRANK0_Lane7_MAX (0x0000000F)
+
+#define DDRDATA_CR_TXPERBITRANK1_REG (0x00003634)
+ #define DDRDATA_CR_TXPERBITRANK1_Lane0_OFF ( 0)
+ #define DDRDATA_CR_TXPERBITRANK1_Lane0_WID ( 4)
+ #define DDRDATA_CR_TXPERBITRANK1_Lane0_MSK (0x0000000F)
+ #define DDRDATA_CR_TXPERBITRANK1_Lane0_MAX (0x0000000F)
+ #define DDRDATA_CR_TXPERBITRANK1_Lane1_OFF ( 4)
+ #define DDRDATA_CR_TXPERBITRANK1_Lane1_WID ( 4)
+ #define DDRDATA_CR_TXPERBITRANK1_Lane1_MSK (0x000000F0)
+ #define DDRDATA_CR_TXPERBITRANK1_Lane1_MAX (0x0000000F)
+ #define DDRDATA_CR_TXPERBITRANK1_Lane2_OFF ( 8)
+ #define DDRDATA_CR_TXPERBITRANK1_Lane2_WID ( 4)
+ #define DDRDATA_CR_TXPERBITRANK1_Lane2_MSK (0x00000F00)
+ #define DDRDATA_CR_TXPERBITRANK1_Lane2_MAX (0x0000000F)
+ #define DDRDATA_CR_TXPERBITRANK1_Lane3_OFF (12)
+ #define DDRDATA_CR_TXPERBITRANK1_Lane3_WID ( 4)
+ #define DDRDATA_CR_TXPERBITRANK1_Lane3_MSK (0x0000F000)
+ #define DDRDATA_CR_TXPERBITRANK1_Lane3_MAX (0x0000000F)
+ #define DDRDATA_CR_TXPERBITRANK1_Lane4_OFF (16)
+ #define DDRDATA_CR_TXPERBITRANK1_Lane4_WID ( 4)
+ #define DDRDATA_CR_TXPERBITRANK1_Lane4_MSK (0x000F0000)
+ #define DDRDATA_CR_TXPERBITRANK1_Lane4_MAX (0x0000000F)
+ #define DDRDATA_CR_TXPERBITRANK1_Lane5_OFF (20)
+ #define DDRDATA_CR_TXPERBITRANK1_Lane5_WID ( 4)
+ #define DDRDATA_CR_TXPERBITRANK1_Lane5_MSK (0x00F00000)
+ #define DDRDATA_CR_TXPERBITRANK1_Lane5_MAX (0x0000000F)
+ #define DDRDATA_CR_TXPERBITRANK1_Lane6_OFF (24)
+ #define DDRDATA_CR_TXPERBITRANK1_Lane6_WID ( 4)
+ #define DDRDATA_CR_TXPERBITRANK1_Lane6_MSK (0x0F000000)
+ #define DDRDATA_CR_TXPERBITRANK1_Lane6_MAX (0x0000000F)
+ #define DDRDATA_CR_TXPERBITRANK1_Lane7_OFF (28)
+ #define DDRDATA_CR_TXPERBITRANK1_Lane7_WID ( 4)
+ #define DDRDATA_CR_TXPERBITRANK1_Lane7_MSK (0xF0000000)
+ #define DDRDATA_CR_TXPERBITRANK1_Lane7_MAX (0x0000000F)
+
+#define DDRDATA_CR_TXPERBITRANK2_REG (0x00003638)
+ #define DDRDATA_CR_TXPERBITRANK2_Lane0_OFF ( 0)
+ #define DDRDATA_CR_TXPERBITRANK2_Lane0_WID ( 4)
+ #define DDRDATA_CR_TXPERBITRANK2_Lane0_MSK (0x0000000F)
+ #define DDRDATA_CR_TXPERBITRANK2_Lane0_MAX (0x0000000F)
+ #define DDRDATA_CR_TXPERBITRANK2_Lane1_OFF ( 4)
+ #define DDRDATA_CR_TXPERBITRANK2_Lane1_WID ( 4)
+ #define DDRDATA_CR_TXPERBITRANK2_Lane1_MSK (0x000000F0)
+ #define DDRDATA_CR_TXPERBITRANK2_Lane1_MAX (0x0000000F)
+ #define DDRDATA_CR_TXPERBITRANK2_Lane2_OFF ( 8)
+ #define DDRDATA_CR_TXPERBITRANK2_Lane2_WID ( 4)
+ #define DDRDATA_CR_TXPERBITRANK2_Lane2_MSK (0x00000F00)
+ #define DDRDATA_CR_TXPERBITRANK2_Lane2_MAX (0x0000000F)
+ #define DDRDATA_CR_TXPERBITRANK2_Lane3_OFF (12)
+ #define DDRDATA_CR_TXPERBITRANK2_Lane3_WID ( 4)
+ #define DDRDATA_CR_TXPERBITRANK2_Lane3_MSK (0x0000F000)
+ #define DDRDATA_CR_TXPERBITRANK2_Lane3_MAX (0x0000000F)
+ #define DDRDATA_CR_TXPERBITRANK2_Lane4_OFF (16)
+ #define DDRDATA_CR_TXPERBITRANK2_Lane4_WID ( 4)
+ #define DDRDATA_CR_TXPERBITRANK2_Lane4_MSK (0x000F0000)
+ #define DDRDATA_CR_TXPERBITRANK2_Lane4_MAX (0x0000000F)
+ #define DDRDATA_CR_TXPERBITRANK2_Lane5_OFF (20)
+ #define DDRDATA_CR_TXPERBITRANK2_Lane5_WID ( 4)
+ #define DDRDATA_CR_TXPERBITRANK2_Lane5_MSK (0x00F00000)
+ #define DDRDATA_CR_TXPERBITRANK2_Lane5_MAX (0x0000000F)
+ #define DDRDATA_CR_TXPERBITRANK2_Lane6_OFF (24)
+ #define DDRDATA_CR_TXPERBITRANK2_Lane6_WID ( 4)
+ #define DDRDATA_CR_TXPERBITRANK2_Lane6_MSK (0x0F000000)
+ #define DDRDATA_CR_TXPERBITRANK2_Lane6_MAX (0x0000000F)
+ #define DDRDATA_CR_TXPERBITRANK2_Lane7_OFF (28)
+ #define DDRDATA_CR_TXPERBITRANK2_Lane7_WID ( 4)
+ #define DDRDATA_CR_TXPERBITRANK2_Lane7_MSK (0xF0000000)
+ #define DDRDATA_CR_TXPERBITRANK2_Lane7_MAX (0x0000000F)
+
+#define DDRDATA_CR_TXPERBITRANK3_REG (0x0000363C)
+ #define DDRDATA_CR_TXPERBITRANK3_Lane0_OFF ( 0)
+ #define DDRDATA_CR_TXPERBITRANK3_Lane0_WID ( 4)
+ #define DDRDATA_CR_TXPERBITRANK3_Lane0_MSK (0x0000000F)
+ #define DDRDATA_CR_TXPERBITRANK3_Lane0_MAX (0x0000000F)
+ #define DDRDATA_CR_TXPERBITRANK3_Lane1_OFF ( 4)
+ #define DDRDATA_CR_TXPERBITRANK3_Lane1_WID ( 4)
+ #define DDRDATA_CR_TXPERBITRANK3_Lane1_MSK (0x000000F0)
+ #define DDRDATA_CR_TXPERBITRANK3_Lane1_MAX (0x0000000F)
+ #define DDRDATA_CR_TXPERBITRANK3_Lane2_OFF ( 8)
+ #define DDRDATA_CR_TXPERBITRANK3_Lane2_WID ( 4)
+ #define DDRDATA_CR_TXPERBITRANK3_Lane2_MSK (0x00000F00)
+ #define DDRDATA_CR_TXPERBITRANK3_Lane2_MAX (0x0000000F)
+ #define DDRDATA_CR_TXPERBITRANK3_Lane3_OFF (12)
+ #define DDRDATA_CR_TXPERBITRANK3_Lane3_WID ( 4)
+ #define DDRDATA_CR_TXPERBITRANK3_Lane3_MSK (0x0000F000)
+ #define DDRDATA_CR_TXPERBITRANK3_Lane3_MAX (0x0000000F)
+ #define DDRDATA_CR_TXPERBITRANK3_Lane4_OFF (16)
+ #define DDRDATA_CR_TXPERBITRANK3_Lane4_WID ( 4)
+ #define DDRDATA_CR_TXPERBITRANK3_Lane4_MSK (0x000F0000)
+ #define DDRDATA_CR_TXPERBITRANK3_Lane4_MAX (0x0000000F)
+ #define DDRDATA_CR_TXPERBITRANK3_Lane5_OFF (20)
+ #define DDRDATA_CR_TXPERBITRANK3_Lane5_WID ( 4)
+ #define DDRDATA_CR_TXPERBITRANK3_Lane5_MSK (0x00F00000)
+ #define DDRDATA_CR_TXPERBITRANK3_Lane5_MAX (0x0000000F)
+ #define DDRDATA_CR_TXPERBITRANK3_Lane6_OFF (24)
+ #define DDRDATA_CR_TXPERBITRANK3_Lane6_WID ( 4)
+ #define DDRDATA_CR_TXPERBITRANK3_Lane6_MSK (0x0F000000)
+ #define DDRDATA_CR_TXPERBITRANK3_Lane6_MAX (0x0000000F)
+ #define DDRDATA_CR_TXPERBITRANK3_Lane7_OFF (28)
+ #define DDRDATA_CR_TXPERBITRANK3_Lane7_WID ( 4)
+ #define DDRDATA_CR_TXPERBITRANK3_Lane7_MSK (0xF0000000)
+ #define DDRDATA_CR_TXPERBITRANK3_Lane7_MAX (0x0000000F)
+
+#define DDRDATA_CR_RCOMPDATA0_REG (0x00003640)
+ #define DDRDATA_CR_RCOMPDATA0_RcompDrvUp_OFF ( 0)
+ #define DDRDATA_CR_RCOMPDATA0_RcompDrvUp_WID ( 6)
+ #define DDRDATA_CR_RCOMPDATA0_RcompDrvUp_MSK (0x0000003F)
+ #define DDRDATA_CR_RCOMPDATA0_RcompDrvUp_MAX (0x0000003F)
+ #define DDRDATA_CR_RCOMPDATA0_Spare0_OFF ( 6)
+ #define DDRDATA_CR_RCOMPDATA0_Spare0_WID ( 3)
+ #define DDRDATA_CR_RCOMPDATA0_Spare0_MSK (0x000001C0)
+ #define DDRDATA_CR_RCOMPDATA0_Spare0_MAX (0x00000007)
+ #define DDRDATA_CR_RCOMPDATA0_RcompDrvDown_OFF ( 9)
+ #define DDRDATA_CR_RCOMPDATA0_RcompDrvDown_WID ( 6)
+ #define DDRDATA_CR_RCOMPDATA0_RcompDrvDown_MSK (0x00007E00)
+ #define DDRDATA_CR_RCOMPDATA0_RcompDrvDown_MAX (0x0000003F)
+ #define DDRDATA_CR_RCOMPDATA0_VTComp_OFF (15)
+ #define DDRDATA_CR_RCOMPDATA0_VTComp_WID ( 5)
+ #define DDRDATA_CR_RCOMPDATA0_VTComp_MSK (0x000F8000)
+ #define DDRDATA_CR_RCOMPDATA0_VTComp_MAX (0x0000001F)
+ #define DDRDATA_CR_RCOMPDATA0_TcoComp_OFF (20)
+ #define DDRDATA_CR_RCOMPDATA0_TcoComp_WID ( 6)
+ #define DDRDATA_CR_RCOMPDATA0_TcoComp_MSK (0x03F00000)
+ #define DDRDATA_CR_RCOMPDATA0_TcoComp_MAX (0x0000003F)
+ #define DDRDATA_CR_RCOMPDATA0_SlewRateComp_OFF (26)
+ #define DDRDATA_CR_RCOMPDATA0_SlewRateComp_WID ( 5)
+ #define DDRDATA_CR_RCOMPDATA0_SlewRateComp_MSK (0x7C000000)
+ #define DDRDATA_CR_RCOMPDATA0_SlewRateComp_MAX (0x0000001F)
+ #define DDRDATA_CR_RCOMPDATA0_Spare2_OFF (31)
+ #define DDRDATA_CR_RCOMPDATA0_Spare2_WID ( 1)
+ #define DDRDATA_CR_RCOMPDATA0_Spare2_MSK (0x80000000)
+ #define DDRDATA_CR_RCOMPDATA0_Spare2_MAX (0x00000001)
+
+#define DDRDATA_CR_RCOMPDATA1_REG (0x00003644)
+ #define DDRDATA_CR_RCOMPDATA1_RcompOdtUp_OFF ( 0)
+ #define DDRDATA_CR_RCOMPDATA1_RcompOdtUp_WID ( 6)
+ #define DDRDATA_CR_RCOMPDATA1_RcompOdtUp_MSK (0x0000003F)
+ #define DDRDATA_CR_RCOMPDATA1_RcompOdtUp_MAX (0x0000003F)
+ #define DDRDATA_CR_RCOMPDATA1_Spare0_OFF ( 6)
+ #define DDRDATA_CR_RCOMPDATA1_Spare0_WID ( 3)
+ #define DDRDATA_CR_RCOMPDATA1_Spare0_MSK (0x000001C0)
+ #define DDRDATA_CR_RCOMPDATA1_Spare0_MAX (0x00000007)
+ #define DDRDATA_CR_RCOMPDATA1_RcompOdtDown_OFF ( 9)
+ #define DDRDATA_CR_RCOMPDATA1_RcompOdtDown_WID ( 6)
+ #define DDRDATA_CR_RCOMPDATA1_RcompOdtDown_MSK (0x00007E00)
+ #define DDRDATA_CR_RCOMPDATA1_RcompOdtDown_MAX (0x0000003F)
+ #define DDRDATA_CR_RCOMPDATA1_Spare1_OFF (15)
+ #define DDRDATA_CR_RCOMPDATA1_Spare1_WID ( 1)
+ #define DDRDATA_CR_RCOMPDATA1_Spare1_MSK (0x00008000)
+ #define DDRDATA_CR_RCOMPDATA1_Spare1_MAX (0x00000001)
+ #define DDRDATA_CR_RCOMPDATA1_PanicDrvDn_OFF (16)
+ #define DDRDATA_CR_RCOMPDATA1_PanicDrvDn_WID ( 6)
+ #define DDRDATA_CR_RCOMPDATA1_PanicDrvDn_MSK (0x003F0000)
+ #define DDRDATA_CR_RCOMPDATA1_PanicDrvDn_MAX (0x0000003F)
+ #define DDRDATA_CR_RCOMPDATA1_PanicDrvUp_OFF (22)
+ #define DDRDATA_CR_RCOMPDATA1_PanicDrvUp_WID ( 6)
+ #define DDRDATA_CR_RCOMPDATA1_PanicDrvUp_MSK (0x0FC00000)
+ #define DDRDATA_CR_RCOMPDATA1_PanicDrvUp_MAX (0x0000003F)
+ #define DDRDATA_CR_RCOMPDATA1_LevelShifterComp_OFF (28)
+ #define DDRDATA_CR_RCOMPDATA1_LevelShifterComp_WID ( 3)
+ #define DDRDATA_CR_RCOMPDATA1_LevelShifterComp_MSK (0x70000000)
+ #define DDRDATA_CR_RCOMPDATA1_LevelShifterComp_MAX (0x00000007)
+ #define DDRDATA_CR_RCOMPDATA1_Spare2_OFF (31)
+ #define DDRDATA_CR_RCOMPDATA1_Spare2_WID ( 1)
+ #define DDRDATA_CR_RCOMPDATA1_Spare2_MSK (0x80000000)
+ #define DDRDATA_CR_RCOMPDATA1_Spare2_MAX (0x00000001)
+
+#define DDRDATA_CR_TXXTALK_REG (0x00003648)
+ #define DDRDATA_CR_TXXTALK_Lane0_OFF ( 0)
+ #define DDRDATA_CR_TXXTALK_Lane0_WID ( 4)
+ #define DDRDATA_CR_TXXTALK_Lane0_MSK (0x0000000F)
+ #define DDRDATA_CR_TXXTALK_Lane0_MAX (0x0000000F)
+ #define DDRDATA_CR_TXXTALK_Lane1_OFF ( 4)
+ #define DDRDATA_CR_TXXTALK_Lane1_WID ( 4)
+ #define DDRDATA_CR_TXXTALK_Lane1_MSK (0x000000F0)
+ #define DDRDATA_CR_TXXTALK_Lane1_MAX (0x0000000F)
+ #define DDRDATA_CR_TXXTALK_Lane2_OFF ( 8)
+ #define DDRDATA_CR_TXXTALK_Lane2_WID ( 4)
+ #define DDRDATA_CR_TXXTALK_Lane2_MSK (0x00000F00)
+ #define DDRDATA_CR_TXXTALK_Lane2_MAX (0x0000000F)
+ #define DDRDATA_CR_TXXTALK_Lane3_OFF (12)
+ #define DDRDATA_CR_TXXTALK_Lane3_WID ( 4)
+ #define DDRDATA_CR_TXXTALK_Lane3_MSK (0x0000F000)
+ #define DDRDATA_CR_TXXTALK_Lane3_MAX (0x0000000F)
+ #define DDRDATA_CR_TXXTALK_Lane4_OFF (16)
+ #define DDRDATA_CR_TXXTALK_Lane4_WID ( 4)
+ #define DDRDATA_CR_TXXTALK_Lane4_MSK (0x000F0000)
+ #define DDRDATA_CR_TXXTALK_Lane4_MAX (0x0000000F)
+ #define DDRDATA_CR_TXXTALK_Lane5_OFF (20)
+ #define DDRDATA_CR_TXXTALK_Lane5_WID ( 4)
+ #define DDRDATA_CR_TXXTALK_Lane5_MSK (0x00F00000)
+ #define DDRDATA_CR_TXXTALK_Lane5_MAX (0x0000000F)
+ #define DDRDATA_CR_TXXTALK_Lane6_OFF (24)
+ #define DDRDATA_CR_TXXTALK_Lane6_WID ( 4)
+ #define DDRDATA_CR_TXXTALK_Lane6_MSK (0x0F000000)
+ #define DDRDATA_CR_TXXTALK_Lane6_MAX (0x0000000F)
+ #define DDRDATA_CR_TXXTALK_Lane7_OFF (28)
+ #define DDRDATA_CR_TXXTALK_Lane7_WID ( 4)
+ #define DDRDATA_CR_TXXTALK_Lane7_MSK (0xF0000000)
+ #define DDRDATA_CR_TXXTALK_Lane7_MAX (0x0000000F)
+
+#define DDRDATA_CR_RXOFFSETVDQ_REG (0x0000364C)
+ #define DDRDATA_CR_RXOFFSETVDQ_Lane0_OFF ( 0)
+ #define DDRDATA_CR_RXOFFSETVDQ_Lane0_WID ( 4)
+ #define DDRDATA_CR_RXOFFSETVDQ_Lane0_MSK (0x0000000F)
+ #define DDRDATA_CR_RXOFFSETVDQ_Lane0_MAX (0x0000000F)
+ #define DDRDATA_CR_RXOFFSETVDQ_Lane1_OFF ( 4)
+ #define DDRDATA_CR_RXOFFSETVDQ_Lane1_WID ( 4)
+ #define DDRDATA_CR_RXOFFSETVDQ_Lane1_MSK (0x000000F0)
+ #define DDRDATA_CR_RXOFFSETVDQ_Lane1_MAX (0x0000000F)
+ #define DDRDATA_CR_RXOFFSETVDQ_Lane2_OFF ( 8)
+ #define DDRDATA_CR_RXOFFSETVDQ_Lane2_WID ( 4)
+ #define DDRDATA_CR_RXOFFSETVDQ_Lane2_MSK (0x00000F00)
+ #define DDRDATA_CR_RXOFFSETVDQ_Lane2_MAX (0x0000000F)
+ #define DDRDATA_CR_RXOFFSETVDQ_Lane3_OFF (12)
+ #define DDRDATA_CR_RXOFFSETVDQ_Lane3_WID ( 4)
+ #define DDRDATA_CR_RXOFFSETVDQ_Lane3_MSK (0x0000F000)
+ #define DDRDATA_CR_RXOFFSETVDQ_Lane3_MAX (0x0000000F)
+ #define DDRDATA_CR_RXOFFSETVDQ_Lane4_OFF (16)
+ #define DDRDATA_CR_RXOFFSETVDQ_Lane4_WID ( 4)
+ #define DDRDATA_CR_RXOFFSETVDQ_Lane4_MSK (0x000F0000)
+ #define DDRDATA_CR_RXOFFSETVDQ_Lane4_MAX (0x0000000F)
+ #define DDRDATA_CR_RXOFFSETVDQ_Lane5_OFF (20)
+ #define DDRDATA_CR_RXOFFSETVDQ_Lane5_WID ( 4)
+ #define DDRDATA_CR_RXOFFSETVDQ_Lane5_MSK (0x00F00000)
+ #define DDRDATA_CR_RXOFFSETVDQ_Lane5_MAX (0x0000000F)
+ #define DDRDATA_CR_RXOFFSETVDQ_Lane6_OFF (24)
+ #define DDRDATA_CR_RXOFFSETVDQ_Lane6_WID ( 4)
+ #define DDRDATA_CR_RXOFFSETVDQ_Lane6_MSK (0x0F000000)
+ #define DDRDATA_CR_RXOFFSETVDQ_Lane6_MAX (0x0000000F)
+ #define DDRDATA_CR_RXOFFSETVDQ_Lane7_OFF (28)
+ #define DDRDATA_CR_RXOFFSETVDQ_Lane7_WID ( 4)
+ #define DDRDATA_CR_RXOFFSETVDQ_Lane7_MSK (0xF0000000)
+ #define DDRDATA_CR_RXOFFSETVDQ_Lane7_MAX (0x0000000F)
+
+#define DDRDATA_CR_DDRDATARESERVED_REG (0x00003650)
+ #define DDRDATA_CR_DDRDATARESERVED_Spare_OFF ( 0)
+ #define DDRDATA_CR_DDRDATARESERVED_Spare_WID (32)
+ #define DDRDATA_CR_DDRDATARESERVED_Spare_MSK (0xFFFFFFFF)
+ #define DDRDATA_CR_DDRDATARESERVED_Spare_MAX (0xFFFFFFFF)
+
+#define DDRDATA_CR_DATATRAINFEEDBACK_REG (0x00003654)
+ #define DDRDATA_CR_DATATRAINFEEDBACK_DataTrainFeedback_OFF ( 0)
+ #define DDRDATA_CR_DATATRAINFEEDBACK_DataTrainFeedback_WID ( 9)
+ #define DDRDATA_CR_DATATRAINFEEDBACK_DataTrainFeedback_MSK (0x000001FF)
+ #define DDRDATA_CR_DATATRAINFEEDBACK_DataTrainFeedback_MAX (0x000001FF)
+ #define DDRDATA_CR_DATATRAINFEEDBACK_Spare_OFF ( 9)
+ #define DDRDATA_CR_DATATRAINFEEDBACK_Spare_WID (23)
+ #define DDRDATA_CR_DATATRAINFEEDBACK_Spare_MSK (0xFFFFFE00)
+ #define DDRDATA_CR_DATATRAINFEEDBACK_Spare_MAX (0x007FFFFF)
+
+#define DDRDATA_CR_DLLPITESTANDADC_REG (0x00003658)
+ #define DDRDATA_CR_DLLPITESTANDADC_RunTest_OFF ( 0)
+ #define DDRDATA_CR_DLLPITESTANDADC_RunTest_WID ( 1)
+ #define DDRDATA_CR_DLLPITESTANDADC_RunTest_MSK (0x00000001)
+ #define DDRDATA_CR_DLLPITESTANDADC_RunTest_MAX (0x00000001)
+ #define DDRDATA_CR_DLLPITESTANDADC_RunTest_DEF (0x00000000)
+ #define DDRDATA_CR_DLLPITESTANDADC_Load_OFF ( 1)
+ #define DDRDATA_CR_DLLPITESTANDADC_Load_WID ( 1)
+ #define DDRDATA_CR_DLLPITESTANDADC_Load_MSK (0x00000002)
+ #define DDRDATA_CR_DLLPITESTANDADC_Load_MAX (0x00000001)
+ #define DDRDATA_CR_DLLPITESTANDADC_Load_DEF (0x00000000)
+ #define DDRDATA_CR_DLLPITESTANDADC_ModeHVM_OFF ( 2)
+ #define DDRDATA_CR_DLLPITESTANDADC_ModeHVM_WID ( 1)
+ #define DDRDATA_CR_DLLPITESTANDADC_ModeHVM_MSK (0x00000004)
+ #define DDRDATA_CR_DLLPITESTANDADC_ModeHVM_MAX (0x00000001)
+ #define DDRDATA_CR_DLLPITESTANDADC_ModeHVM_DEF (0x00000000)
+ #define DDRDATA_CR_DLLPITESTANDADC_ModeDV_OFF ( 3)
+ #define DDRDATA_CR_DLLPITESTANDADC_ModeDV_WID ( 1)
+ #define DDRDATA_CR_DLLPITESTANDADC_ModeDV_MSK (0x00000008)
+ #define DDRDATA_CR_DLLPITESTANDADC_ModeDV_MAX (0x00000001)
+ #define DDRDATA_CR_DLLPITESTANDADC_ModeDV_DEF (0x00000000)
+ #define DDRDATA_CR_DLLPITESTANDADC_ModeADC_OFF ( 4)
+ #define DDRDATA_CR_DLLPITESTANDADC_ModeADC_WID ( 1)
+ #define DDRDATA_CR_DLLPITESTANDADC_ModeADC_MSK (0x00000010)
+ #define DDRDATA_CR_DLLPITESTANDADC_ModeADC_MAX (0x00000001)
+ #define DDRDATA_CR_DLLPITESTANDADC_ModeADC_DEF (0x00000000)
+ #define DDRDATA_CR_DLLPITESTANDADC_LoadCount_OFF ( 5)
+ #define DDRDATA_CR_DLLPITESTANDADC_LoadCount_WID (10)
+ #define DDRDATA_CR_DLLPITESTANDADC_LoadCount_MSK (0x00007FE0)
+ #define DDRDATA_CR_DLLPITESTANDADC_LoadCount_MAX (0x000003FF)
+ #define DDRDATA_CR_DLLPITESTANDADC_CountStatus_OFF (15)
+ #define DDRDATA_CR_DLLPITESTANDADC_CountStatus_WID (10)
+ #define DDRDATA_CR_DLLPITESTANDADC_CountStatus_MSK (0x01FF8000)
+ #define DDRDATA_CR_DLLPITESTANDADC_CountStatus_MAX (0x000003FF)
+ #define DDRDATA_CR_DLLPITESTANDADC_CountStatus_DEF (0x00000000)
+ #define DDRDATA_CR_DLLPITESTANDADC_Spare_OFF (25)
+ #define DDRDATA_CR_DLLPITESTANDADC_Spare_WID ( 7)
+ #define DDRDATA_CR_DLLPITESTANDADC_Spare_MSK (0xFE000000)
+ #define DDRDATA_CR_DLLPITESTANDADC_Spare_MAX (0x0000007F)
+
+#define DDRDATA_CR_DDRCRDATAOFFSETCOMP_REG (0x0000365C)
+ #define DDRDATA_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_OFF ( 0)
+ #define DDRDATA_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_WID ( 6)
+ #define DDRDATA_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_MSK (0x0000003F)
+ #define DDRDATA_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_MAX (0x0000003F)
+ #define DDRDATA_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_OFF ( 6)
+ #define DDRDATA_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_WID ( 6)
+ #define DDRDATA_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_MSK (0x00000FC0)
+ #define DDRDATA_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_MAX (0x0000003F)
+ #define DDRDATA_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_OFF (12)
+ #define DDRDATA_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_WID ( 5)
+ #define DDRDATA_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_MSK (0x0001F000)
+ #define DDRDATA_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_MAX (0x0000001F)
+ #define DDRDATA_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_OFF (17)
+ #define DDRDATA_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_WID ( 5)
+ #define DDRDATA_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_MSK (0x003E0000)
+ #define DDRDATA_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_MAX (0x0000001F)
+ #define DDRDATA_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_OFF (22)
+ #define DDRDATA_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_WID ( 5)
+ #define DDRDATA_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_MSK (0x07C00000)
+ #define DDRDATA_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_MAX (0x0000001F)
+ #define DDRDATA_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_OFF (27)
+ #define DDRDATA_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_WID ( 5)
+ #define DDRDATA_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_MSK (0xF8000000)
+ #define DDRDATA_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_MAX (0x0000001F)
+ #define DDRDATA_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_DEF (0x00000000)
+
+#define DDRDATA_CR_DDRCRDATACONTROL1_REG (0x00003660)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_RefPi_OFF ( 0)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_RefPi_WID ( 4)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_RefPi_MSK (0x0000000F)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_RefPi_MAX (0x0000000F)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_RefPi_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_DllMask_OFF ( 4)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_DllMask_WID ( 2)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_DllMask_MSK (0x00000030)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_DllMask_MAX (0x00000003)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_DllMask_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_DllWeakLock_OFF ( 6)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_DllWeakLock_WID ( 1)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_DllWeakLock_MSK (0x00000040)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_DllWeakLock_MAX (0x00000001)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_DllWeakLock_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_SdllSegmentDisable_OFF ( 7)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_SdllSegmentDisable_WID ( 3)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_SdllSegmentDisable_MSK (0x00000380)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_SdllSegmentDisable_MAX (0x00000007)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_SdllSegmentDisable_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_RxBiasCtl_OFF (10)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_RxBiasCtl_WID ( 3)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_RxBiasCtl_MSK (0x00001C00)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_RxBiasCtl_MAX (0x00000007)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_RxBiasCtl_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_OdtDelay_OFF (13)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_OdtDelay_WID ( 4)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_OdtDelay_MSK (0x0001E000)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_OdtDelay_MAX (0x0000000F)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_OdtDelay_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_OdtDuration_OFF (17)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_OdtDuration_WID ( 3)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_OdtDuration_MSK (0x000E0000)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_OdtDuration_MAX (0x00000007)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_OdtDuration_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_SenseAmpDelay_OFF (20)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_SenseAmpDelay_WID ( 4)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_SenseAmpDelay_MSK (0x00F00000)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_SenseAmpDelay_MAX (0x0000000F)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_SenseAmpDelay_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_SenseAmpDuration_OFF (24)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_SenseAmpDuration_WID ( 3)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_SenseAmpDuration_MSK (0x07000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_SenseAmpDuration_MAX (0x00000007)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_SenseAmpDuration_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_BurstEndODTDelay_OFF (27)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_BurstEndODTDelay_WID ( 3)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_BurstEndODTDelay_MSK (0x38000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_BurstEndODTDelay_MAX (0x00000007)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_BurstEndODTDelay_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_OFF (30)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_WID ( 1)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_MSK (0x40000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_MAX (0x00000001)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_Rsvd1_OFF (31)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_Rsvd1_WID ( 1)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_Rsvd1_MSK (0x80000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_Rsvd1_MAX (0x00000001)
+ #define DDRDATA_CR_DDRCRDATACONTROL1_Rsvd1_DEF (0x00000000)
+
+#define DDRDATA_CR_DDRCRDATACONTROL2_REG (0x00003664)
+ #define DDRDATA_CR_DDRCRDATACONTROL2_RxStaggerCtl_OFF ( 0)
+ #define DDRDATA_CR_DDRCRDATACONTROL2_RxStaggerCtl_WID ( 5)
+ #define DDRDATA_CR_DDRCRDATACONTROL2_RxStaggerCtl_MSK (0x0000001F)
+ #define DDRDATA_CR_DDRCRDATACONTROL2_RxStaggerCtl_MAX (0x0000001F)
+ #define DDRDATA_CR_DDRCRDATACONTROL2_RxStaggerCtl_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL2_ForceBiasOn_OFF ( 5)
+ #define DDRDATA_CR_DDRCRDATACONTROL2_ForceBiasOn_WID ( 1)
+ #define DDRDATA_CR_DDRCRDATACONTROL2_ForceBiasOn_MSK (0x00000020)
+ #define DDRDATA_CR_DDRCRDATACONTROL2_ForceBiasOn_MAX (0x00000001)
+ #define DDRDATA_CR_DDRCRDATACONTROL2_ForceBiasOn_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL2_ForceRxOn_OFF ( 6)
+ #define DDRDATA_CR_DDRCRDATACONTROL2_ForceRxOn_WID ( 1)
+ #define DDRDATA_CR_DDRCRDATACONTROL2_ForceRxOn_MSK (0x00000040)
+ #define DDRDATA_CR_DDRCRDATACONTROL2_ForceRxOn_MAX (0x00000001)
+ #define DDRDATA_CR_DDRCRDATACONTROL2_ForceRxOn_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL2_LeakerComp_OFF ( 7)
+ #define DDRDATA_CR_DDRCRDATACONTROL2_LeakerComp_WID ( 2)
+ #define DDRDATA_CR_DDRCRDATACONTROL2_LeakerComp_MSK (0x00000180)
+ #define DDRDATA_CR_DDRCRDATACONTROL2_LeakerComp_MAX (0x00000003)
+ #define DDRDATA_CR_DDRCRDATACONTROL2_LeakerComp_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_OFF ( 9)
+ #define DDRDATA_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_WID ( 4)
+ #define DDRDATA_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_MSK (0x00001E00)
+ #define DDRDATA_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_MAX (0x0000000F)
+ #define DDRDATA_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_DEF (0x00000008)
+ #define DDRDATA_CR_DDRCRDATACONTROL2_RxClkStgNum_OFF (13)
+ #define DDRDATA_CR_DDRCRDATACONTROL2_RxClkStgNum_WID ( 5)
+ #define DDRDATA_CR_DDRCRDATACONTROL2_RxClkStgNum_MSK (0x0003E000)
+ #define DDRDATA_CR_DDRCRDATACONTROL2_RxClkStgNum_MAX (0x0000001F)
+ #define DDRDATA_CR_DDRCRDATACONTROL2_RxClkStgNum_DEF (0x00000011)
+ #define DDRDATA_CR_DDRCRDATACONTROL2_WlLongDelEn_OFF (18)
+ #define DDRDATA_CR_DDRCRDATACONTROL2_WlLongDelEn_WID ( 1)
+ #define DDRDATA_CR_DDRCRDATACONTROL2_WlLongDelEn_MSK (0x00040000)
+ #define DDRDATA_CR_DDRCRDATACONTROL2_WlLongDelEn_MAX (0x00000001)
+ #define DDRDATA_CR_DDRCRDATACONTROL2_WlLongDelEn_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL2_Spare_OFF (19)
+ #define DDRDATA_CR_DDRCRDATACONTROL2_Spare_WID (13)
+ #define DDRDATA_CR_DDRCRDATACONTROL2_Spare_MSK (0xFFF80000)
+ #define DDRDATA_CR_DDRCRDATACONTROL2_Spare_MAX (0x00001FFF)
+ #define DDRDATA_CR_DDRCRDATACONTROL2_Spare_DEF (0x00000000)
+
+#define DDRDATA_CR_DDRCRVREFCONTROL_REG (0x00003668)
+ #define DDRDATA_CR_DDRCRVREFCONTROL_VrefCtl_OFF ( 0)
+ #define DDRDATA_CR_DDRCRVREFCONTROL_VrefCtl_WID (24)
+ #define DDRDATA_CR_DDRCRVREFCONTROL_VrefCtl_MSK (0x00FFFFFF)
+ #define DDRDATA_CR_DDRCRVREFCONTROL_VrefCtl_MAX (0x00FFFFFF)
+ #define DDRDATA_CR_DDRCRVREFCONTROL_VrefCtl_DEF (0x000E453A)
+ #define DDRDATA_CR_DDRCRVREFCONTROL_OutputCode_OFF (24)
+ #define DDRDATA_CR_DDRCRVREFCONTROL_OutputCode_WID ( 8)
+ #define DDRDATA_CR_DDRCRVREFCONTROL_OutputCode_MSK (0xFF000000)
+ #define DDRDATA_CR_DDRCRVREFCONTROL_OutputCode_MAX (0x000000FF)
+ #define DDRDATA_CR_DDRCRVREFCONTROL_OutputCode_DEF (0x00000000)
+
+#define DDRDATA_CR_DDRCRVSSHICONTROL_REG (0x0000366C)
+ #define DDRDATA_CR_DDRCRVSSHICONTROL_VssHiCtl_OFF ( 0)
+ #define DDRDATA_CR_DDRCRVSSHICONTROL_VssHiCtl_WID (24)
+ #define DDRDATA_CR_DDRCRVSSHICONTROL_VssHiCtl_MSK (0x00FFFFFF)
+ #define DDRDATA_CR_DDRCRVSSHICONTROL_VssHiCtl_MAX (0x00FFFFFF)
+ #define DDRDATA_CR_DDRCRVSSHICONTROL_VssHiCtl_DEF (0x004D8238)
+ #define DDRDATA_CR_DDRCRVSSHICONTROL_OutputCode_OFF (24)
+ #define DDRDATA_CR_DDRCRVSSHICONTROL_OutputCode_WID ( 8)
+ #define DDRDATA_CR_DDRCRVSSHICONTROL_OutputCode_MSK (0xFF000000)
+ #define DDRDATA_CR_DDRCRVSSHICONTROL_OutputCode_MAX (0x000000FF)
+ #define DDRDATA_CR_DDRCRVSSHICONTROL_OutputCode_DEF (0x00000000)
+
+#define DDRDATA_CR_DDRCRVSSHIORVREFCONTROL_REG (0x0000366C)
+ #define DDRDATA_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_OFF ( 0)
+ #define DDRDATA_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_WID (24)
+ #define DDRDATA_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_MSK (0x00FFFFFF)
+ #define DDRDATA_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_MAX (0x00FFFFFF)
+ #define DDRDATA_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_OFF (24)
+ #define DDRDATA_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_WID ( 8)
+ #define DDRDATA_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_MSK (0xFF000000)
+ #define DDRDATA_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_MAX (0x000000FF)
+ #define DDRDATA_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_DEF (0x00000000)
+
+#define DDRDATA_CR_DDRCRDATAOFFSETTRAIN_REG (0x00003670)
+ #define DDRDATA_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_OFF ( 0)
+ #define DDRDATA_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_WID ( 6)
+ #define DDRDATA_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_MSK (0x0000003F)
+ #define DDRDATA_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_MAX (0x0000003F)
+ #define DDRDATA_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_OFF ( 6)
+ #define DDRDATA_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_WID ( 6)
+ #define DDRDATA_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_MSK (0x00000FC0)
+ #define DDRDATA_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_MAX (0x0000003F)
+ #define DDRDATA_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_OFF (12)
+ #define DDRDATA_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_WID ( 6)
+ #define DDRDATA_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_MSK (0x0003F000)
+ #define DDRDATA_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_MAX (0x0000003F)
+ #define DDRDATA_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_OFF (18)
+ #define DDRDATA_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_WID ( 6)
+ #define DDRDATA_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_MSK (0x00FC0000)
+ #define DDRDATA_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_MAX (0x0000003F)
+ #define DDRDATA_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_OFF (24)
+ #define DDRDATA_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_WID ( 7)
+ #define DDRDATA_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_MSK (0x7F000000)
+ #define DDRDATA_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_MAX (0x0000007F)
+ #define DDRDATA_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATAOFFSETTRAIN_Spare_OFF (31)
+ #define DDRDATA_CR_DDRCRDATAOFFSETTRAIN_Spare_WID ( 1)
+ #define DDRDATA_CR_DDRCRDATAOFFSETTRAIN_Spare_MSK (0x80000000)
+ #define DDRDATA_CR_DDRCRDATAOFFSETTRAIN_Spare_MAX (0x00000001)
+ #define DDRDATA_CR_DDRCRDATAOFFSETTRAIN_Spare_DEF (0x00000000)
+
+#define DDRDATA_CR_DDRCRDATACONTROL0_REG (0x00003674)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_RxTrainingMode_OFF ( 0)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_RxTrainingMode_WID ( 1)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_RxTrainingMode_MSK (0x00000001)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_RxTrainingMode_MAX (0x00000001)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_RxTrainingMode_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_WLTrainingMode_OFF ( 1)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_WLTrainingMode_WID ( 1)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_WLTrainingMode_MSK (0x00000002)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_WLTrainingMode_MAX (0x00000001)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_WLTrainingMode_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_RLTrainingMode_OFF ( 2)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_RLTrainingMode_WID ( 1)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_RLTrainingMode_MSK (0x00000004)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_RLTrainingMode_MAX (0x00000001)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_RLTrainingMode_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_SenseampTrainingMode_OFF ( 3)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_SenseampTrainingMode_WID ( 1)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_SenseampTrainingMode_MSK (0x00000008)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_SenseampTrainingMode_MAX (0x00000001)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_SenseampTrainingMode_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_TxOn_OFF ( 4)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_TxOn_WID ( 1)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_TxOn_MSK (0x00000010)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_TxOn_MAX (0x00000001)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_TxOn_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_RfOn_OFF ( 5)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_RfOn_WID ( 1)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_RfOn_MSK (0x00000020)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_RfOn_MAX (0x00000001)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_RfOn_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_RxPiOn_OFF ( 6)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_RxPiOn_WID ( 1)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_RxPiOn_MSK (0x00000040)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_RxPiOn_MAX (0x00000001)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_RxPiOn_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_TxPiOn_OFF ( 7)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_TxPiOn_WID ( 1)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_TxPiOn_MSK (0x00000080)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_TxPiOn_MAX (0x00000001)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_TxPiOn_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_InternalClocksOn_OFF ( 8)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_InternalClocksOn_WID ( 1)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_InternalClocksOn_MSK (0x00000100)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_InternalClocksOn_MAX (0x00000001)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_InternalClocksOn_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_RepeaterClocksOn_OFF ( 9)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_RepeaterClocksOn_WID ( 1)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_RepeaterClocksOn_MSK (0x00000200)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_RepeaterClocksOn_MAX (0x00000001)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_RepeaterClocksOn_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_TxDisable_OFF (10)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_TxDisable_WID ( 1)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_TxDisable_MSK (0x00000400)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_TxDisable_MAX (0x00000001)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_TxDisable_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_RxDisable_OFF (11)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_RxDisable_WID ( 1)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_RxDisable_MSK (0x00000800)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_RxDisable_MAX (0x00000001)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_RxDisable_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_TxLong_OFF (12)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_TxLong_WID ( 1)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_TxLong_MSK (0x00001000)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_TxLong_MAX (0x00000001)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_TxLong_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_RxDqsCtle_OFF (13)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_RxDqsCtle_WID ( 2)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_RxDqsCtle_MSK (0x00006000)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_RxDqsCtle_MAX (0x00000003)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_RxDqsCtle_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_RxReadPointer_OFF (15)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_RxReadPointer_WID ( 3)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_RxReadPointer_MSK (0x00038000)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_RxReadPointer_MAX (0x00000007)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_RxReadPointer_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_DriverSegmentEnable_OFF (18)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_DriverSegmentEnable_WID ( 1)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_DriverSegmentEnable_MSK (0x00040000)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_DriverSegmentEnable_MAX (0x00000001)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_DriverSegmentEnable_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_DataVccddqHi_OFF (19)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_DataVccddqHi_WID ( 1)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_DataVccddqHi_MSK (0x00080000)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_DataVccddqHi_MAX (0x00000001)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_DataVccddqHi_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_ReadRFRd_OFF (20)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_ReadRFRd_WID ( 1)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_ReadRFRd_MSK (0x00100000)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_ReadRFRd_MAX (0x00000001)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_ReadRFRd_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_ReadRFWr_OFF (21)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_ReadRFWr_WID ( 1)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_ReadRFWr_MSK (0x00200000)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_ReadRFWr_MAX (0x00000001)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_ReadRFWr_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_ReadRFRank_OFF (22)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_ReadRFRank_WID ( 2)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_ReadRFRank_MSK (0x00C00000)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_ReadRFRank_MAX (0x00000003)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_ReadRFRank_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_ForceOdtOn_OFF (24)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_ForceOdtOn_WID ( 1)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_ForceOdtOn_MSK (0x01000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_ForceOdtOn_MAX (0x00000001)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_ForceOdtOn_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_OdtSampOff_OFF (25)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_OdtSampOff_WID ( 1)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_OdtSampOff_MSK (0x02000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_OdtSampOff_MAX (0x00000001)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_OdtSampOff_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_DisableOdtStatic_OFF (26)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_DisableOdtStatic_WID ( 1)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_DisableOdtStatic_MSK (0x04000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_DisableOdtStatic_MAX (0x00000001)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_DisableOdtStatic_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_OFF (27)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_WID ( 1)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_MSK (0x08000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_MAX (0x00000001)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_LPDDR_Mode_OFF (28)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_LPDDR_Mode_WID ( 1)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_LPDDR_Mode_MSK (0x10000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_LPDDR_Mode_MAX (0x00000001)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_LPDDR_Mode_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_EnReadPreamble_OFF (29)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_EnReadPreamble_WID ( 1)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_EnReadPreamble_MSK (0x20000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_EnReadPreamble_MAX (0x00000001)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_EnReadPreamble_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_OdtSampExtendEn_OFF (30)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_OdtSampExtendEn_WID ( 1)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_OdtSampExtendEn_MSK (0x40000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_OdtSampExtendEn_MAX (0x00000001)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_OdtSampExtendEn_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_EarlyRleakEn_OFF (31)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_EarlyRleakEn_WID ( 1)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_EarlyRleakEn_MSK (0x80000000)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_EarlyRleakEn_MAX (0x00000001)
+ #define DDRDATA_CR_DDRCRDATACONTROL0_EarlyRleakEn_DEF (0x00000000)
+
+#define DDRDATA_CR_DDRCRVREFADJUST1_REG (0x00003678)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_CAVrefCtl_OFF ( 0)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_CAVrefCtl_WID ( 7)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_CAVrefCtl_MSK (0x0000007F)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_CAVrefCtl_MAX (0x0000007F)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_CAVrefCtl_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_Ch1VrefCtl_OFF ( 7)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_Ch1VrefCtl_WID ( 7)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_Ch1VrefCtl_MSK (0x00003F80)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_Ch1VrefCtl_MAX (0x0000007F)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_Ch1VrefCtl_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_Ch0VrefCtl_OFF (14)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_Ch0VrefCtl_WID ( 7)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_Ch0VrefCtl_MSK (0x001FC000)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_Ch0VrefCtl_MAX (0x0000007F)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_Ch0VrefCtl_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_EnDimmVrefCA_OFF (21)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_EnDimmVrefCA_WID ( 1)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_EnDimmVrefCA_MSK (0x00200000)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_EnDimmVrefCA_MAX (0x00000001)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_EnDimmVrefCA_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_OFF (22)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_WID ( 1)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_MSK (0x00400000)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_MAX (0x00000001)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_OFF (23)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_WID ( 1)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_MSK (0x00800000)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_MAX (0x00000001)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_HiZTimerCtrl_OFF (24)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_HiZTimerCtrl_WID ( 2)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_HiZTimerCtrl_MSK (0x03000000)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_HiZTimerCtrl_MAX (0x00000003)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_HiZTimerCtrl_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_OFF (26)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_WID ( 1)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_MSK (0x04000000)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_MAX (0x00000001)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_Rsvd_OFF (27)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_Rsvd_WID ( 2)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_Rsvd_MSK (0x18000000)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_Rsvd_MAX (0x00000003)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_Rsvd_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_caSlowBW_OFF (29)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_caSlowBW_WID ( 1)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_caSlowBW_MSK (0x20000000)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_caSlowBW_MAX (0x00000001)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_caSlowBW_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_ch0SlowBW_OFF (30)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_ch0SlowBW_WID ( 1)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_ch0SlowBW_MSK (0x40000000)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_ch0SlowBW_MAX (0x00000001)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_ch0SlowBW_DEF (0x00000000)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_ch1SlowBW_OFF (31)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_ch1SlowBW_WID ( 1)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_ch1SlowBW_MSK (0x80000000)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_ch1SlowBW_MAX (0x00000001)
+ #define DDRDATA_CR_DDRCRVREFADJUST1_ch1SlowBW_DEF (0x00000000)
+
+#define DDRDATACH0_CR_RXTRAINRANK0_REG (0x00003000)
+ #define DDRDATACH0_CR_RXTRAINRANK0_RxRcvEnPi_OFF ( 0)
+ #define DDRDATACH0_CR_RXTRAINRANK0_RxRcvEnPi_WID ( 9)
+ #define DDRDATACH0_CR_RXTRAINRANK0_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATACH0_CR_RXTRAINRANK0_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATACH0_CR_RXTRAINRANK0_RxDqsPPi_OFF ( 9)
+ #define DDRDATACH0_CR_RXTRAINRANK0_RxDqsPPi_WID ( 6)
+ #define DDRDATACH0_CR_RXTRAINRANK0_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATACH0_CR_RXTRAINRANK0_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATACH0_CR_RXTRAINRANK0_RxEq_OFF (15)
+ #define DDRDATACH0_CR_RXTRAINRANK0_RxEq_WID ( 5)
+ #define DDRDATACH0_CR_RXTRAINRANK0_RxEq_MSK (0x000F8000)
+ #define DDRDATACH0_CR_RXTRAINRANK0_RxEq_MAX (0x0000001F)
+ #define DDRDATACH0_CR_RXTRAINRANK0_RxDqsNPi_OFF (20)
+ #define DDRDATACH0_CR_RXTRAINRANK0_RxDqsNPi_WID ( 6)
+ #define DDRDATACH0_CR_RXTRAINRANK0_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATACH0_CR_RXTRAINRANK0_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATACH0_CR_RXTRAINRANK0_RxVref_OFF (26)
+ #define DDRDATACH0_CR_RXTRAINRANK0_RxVref_WID ( 6)
+ #define DDRDATACH0_CR_RXTRAINRANK0_RxVref_MSK (0xFC000000)
+ #define DDRDATACH0_CR_RXTRAINRANK0_RxVref_MAX (0x0000003F)
+
+#define DDRDATACH0_CR_RXTRAINRANK1_REG (0x00003004)
+ #define DDRDATACH0_CR_RXTRAINRANK1_RxRcvEnPi_OFF ( 0)
+ #define DDRDATACH0_CR_RXTRAINRANK1_RxRcvEnPi_WID ( 9)
+ #define DDRDATACH0_CR_RXTRAINRANK1_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATACH0_CR_RXTRAINRANK1_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATACH0_CR_RXTRAINRANK1_RxDqsPPi_OFF ( 9)
+ #define DDRDATACH0_CR_RXTRAINRANK1_RxDqsPPi_WID ( 6)
+ #define DDRDATACH0_CR_RXTRAINRANK1_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATACH0_CR_RXTRAINRANK1_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATACH0_CR_RXTRAINRANK1_RxEq_OFF (15)
+ #define DDRDATACH0_CR_RXTRAINRANK1_RxEq_WID ( 5)
+ #define DDRDATACH0_CR_RXTRAINRANK1_RxEq_MSK (0x000F8000)
+ #define DDRDATACH0_CR_RXTRAINRANK1_RxEq_MAX (0x0000001F)
+ #define DDRDATACH0_CR_RXTRAINRANK1_RxDqsNPi_OFF (20)
+ #define DDRDATACH0_CR_RXTRAINRANK1_RxDqsNPi_WID ( 6)
+ #define DDRDATACH0_CR_RXTRAINRANK1_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATACH0_CR_RXTRAINRANK1_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATACH0_CR_RXTRAINRANK1_RxVref_OFF (26)
+ #define DDRDATACH0_CR_RXTRAINRANK1_RxVref_WID ( 6)
+ #define DDRDATACH0_CR_RXTRAINRANK1_RxVref_MSK (0xFC000000)
+ #define DDRDATACH0_CR_RXTRAINRANK1_RxVref_MAX (0x0000003F)
+
+#define DDRDATACH0_CR_RXTRAINRANK2_REG (0x00003008)
+ #define DDRDATACH0_CR_RXTRAINRANK2_RxRcvEnPi_OFF ( 0)
+ #define DDRDATACH0_CR_RXTRAINRANK2_RxRcvEnPi_WID ( 9)
+ #define DDRDATACH0_CR_RXTRAINRANK2_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATACH0_CR_RXTRAINRANK2_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATACH0_CR_RXTRAINRANK2_RxDqsPPi_OFF ( 9)
+ #define DDRDATACH0_CR_RXTRAINRANK2_RxDqsPPi_WID ( 6)
+ #define DDRDATACH0_CR_RXTRAINRANK2_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATACH0_CR_RXTRAINRANK2_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATACH0_CR_RXTRAINRANK2_RxEq_OFF (15)
+ #define DDRDATACH0_CR_RXTRAINRANK2_RxEq_WID ( 5)
+ #define DDRDATACH0_CR_RXTRAINRANK2_RxEq_MSK (0x000F8000)
+ #define DDRDATACH0_CR_RXTRAINRANK2_RxEq_MAX (0x0000001F)
+ #define DDRDATACH0_CR_RXTRAINRANK2_RxDqsNPi_OFF (20)
+ #define DDRDATACH0_CR_RXTRAINRANK2_RxDqsNPi_WID ( 6)
+ #define DDRDATACH0_CR_RXTRAINRANK2_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATACH0_CR_RXTRAINRANK2_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATACH0_CR_RXTRAINRANK2_RxVref_OFF (26)
+ #define DDRDATACH0_CR_RXTRAINRANK2_RxVref_WID ( 6)
+ #define DDRDATACH0_CR_RXTRAINRANK2_RxVref_MSK (0xFC000000)
+ #define DDRDATACH0_CR_RXTRAINRANK2_RxVref_MAX (0x0000003F)
+
+#define DDRDATACH0_CR_RXTRAINRANK3_REG (0x0000300C)
+ #define DDRDATACH0_CR_RXTRAINRANK3_RxRcvEnPi_OFF ( 0)
+ #define DDRDATACH0_CR_RXTRAINRANK3_RxRcvEnPi_WID ( 9)
+ #define DDRDATACH0_CR_RXTRAINRANK3_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATACH0_CR_RXTRAINRANK3_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATACH0_CR_RXTRAINRANK3_RxDqsPPi_OFF ( 9)
+ #define DDRDATACH0_CR_RXTRAINRANK3_RxDqsPPi_WID ( 6)
+ #define DDRDATACH0_CR_RXTRAINRANK3_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATACH0_CR_RXTRAINRANK3_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATACH0_CR_RXTRAINRANK3_RxEq_OFF (15)
+ #define DDRDATACH0_CR_RXTRAINRANK3_RxEq_WID ( 5)
+ #define DDRDATACH0_CR_RXTRAINRANK3_RxEq_MSK (0x000F8000)
+ #define DDRDATACH0_CR_RXTRAINRANK3_RxEq_MAX (0x0000001F)
+ #define DDRDATACH0_CR_RXTRAINRANK3_RxDqsNPi_OFF (20)
+ #define DDRDATACH0_CR_RXTRAINRANK3_RxDqsNPi_WID ( 6)
+ #define DDRDATACH0_CR_RXTRAINRANK3_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATACH0_CR_RXTRAINRANK3_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATACH0_CR_RXTRAINRANK3_RxVref_OFF (26)
+ #define DDRDATACH0_CR_RXTRAINRANK3_RxVref_WID ( 6)
+ #define DDRDATACH0_CR_RXTRAINRANK3_RxVref_MSK (0xFC000000)
+ #define DDRDATACH0_CR_RXTRAINRANK3_RxVref_MAX (0x0000003F)
+
+#define DDRDATACH0_CR_RXPERBITRANK0_REG (0x00003010)
+ #define DDRDATACH0_CR_RXPERBITRANK0_Lane0_OFF ( 0)
+ #define DDRDATACH0_CR_RXPERBITRANK0_Lane0_WID ( 4)
+ #define DDRDATACH0_CR_RXPERBITRANK0_Lane0_MSK (0x0000000F)
+ #define DDRDATACH0_CR_RXPERBITRANK0_Lane0_MAX (0x0000000F)
+ #define DDRDATACH0_CR_RXPERBITRANK0_Lane1_OFF ( 4)
+ #define DDRDATACH0_CR_RXPERBITRANK0_Lane1_WID ( 4)
+ #define DDRDATACH0_CR_RXPERBITRANK0_Lane1_MSK (0x000000F0)
+ #define DDRDATACH0_CR_RXPERBITRANK0_Lane1_MAX (0x0000000F)
+ #define DDRDATACH0_CR_RXPERBITRANK0_Lane2_OFF ( 8)
+ #define DDRDATACH0_CR_RXPERBITRANK0_Lane2_WID ( 4)
+ #define DDRDATACH0_CR_RXPERBITRANK0_Lane2_MSK (0x00000F00)
+ #define DDRDATACH0_CR_RXPERBITRANK0_Lane2_MAX (0x0000000F)
+ #define DDRDATACH0_CR_RXPERBITRANK0_Lane3_OFF (12)
+ #define DDRDATACH0_CR_RXPERBITRANK0_Lane3_WID ( 4)
+ #define DDRDATACH0_CR_RXPERBITRANK0_Lane3_MSK (0x0000F000)
+ #define DDRDATACH0_CR_RXPERBITRANK0_Lane3_MAX (0x0000000F)
+ #define DDRDATACH0_CR_RXPERBITRANK0_Lane4_OFF (16)
+ #define DDRDATACH0_CR_RXPERBITRANK0_Lane4_WID ( 4)
+ #define DDRDATACH0_CR_RXPERBITRANK0_Lane4_MSK (0x000F0000)
+ #define DDRDATACH0_CR_RXPERBITRANK0_Lane4_MAX (0x0000000F)
+ #define DDRDATACH0_CR_RXPERBITRANK0_Lane5_OFF (20)
+ #define DDRDATACH0_CR_RXPERBITRANK0_Lane5_WID ( 4)
+ #define DDRDATACH0_CR_RXPERBITRANK0_Lane5_MSK (0x00F00000)
+ #define DDRDATACH0_CR_RXPERBITRANK0_Lane5_MAX (0x0000000F)
+ #define DDRDATACH0_CR_RXPERBITRANK0_Lane6_OFF (24)
+ #define DDRDATACH0_CR_RXPERBITRANK0_Lane6_WID ( 4)
+ #define DDRDATACH0_CR_RXPERBITRANK0_Lane6_MSK (0x0F000000)
+ #define DDRDATACH0_CR_RXPERBITRANK0_Lane6_MAX (0x0000000F)
+ #define DDRDATACH0_CR_RXPERBITRANK0_Lane7_OFF (28)
+ #define DDRDATACH0_CR_RXPERBITRANK0_Lane7_WID ( 4)
+ #define DDRDATACH0_CR_RXPERBITRANK0_Lane7_MSK (0xF0000000)
+ #define DDRDATACH0_CR_RXPERBITRANK0_Lane7_MAX (0x0000000F)
+
+#define DDRDATACH0_CR_RXPERBITRANK1_REG (0x00003014)
+ #define DDRDATACH0_CR_RXPERBITRANK1_Lane0_OFF ( 0)
+ #define DDRDATACH0_CR_RXPERBITRANK1_Lane0_WID ( 4)
+ #define DDRDATACH0_CR_RXPERBITRANK1_Lane0_MSK (0x0000000F)
+ #define DDRDATACH0_CR_RXPERBITRANK1_Lane0_MAX (0x0000000F)
+ #define DDRDATACH0_CR_RXPERBITRANK1_Lane1_OFF ( 4)
+ #define DDRDATACH0_CR_RXPERBITRANK1_Lane1_WID ( 4)
+ #define DDRDATACH0_CR_RXPERBITRANK1_Lane1_MSK (0x000000F0)
+ #define DDRDATACH0_CR_RXPERBITRANK1_Lane1_MAX (0x0000000F)
+ #define DDRDATACH0_CR_RXPERBITRANK1_Lane2_OFF ( 8)
+ #define DDRDATACH0_CR_RXPERBITRANK1_Lane2_WID ( 4)
+ #define DDRDATACH0_CR_RXPERBITRANK1_Lane2_MSK (0x00000F00)
+ #define DDRDATACH0_CR_RXPERBITRANK1_Lane2_MAX (0x0000000F)
+ #define DDRDATACH0_CR_RXPERBITRANK1_Lane3_OFF (12)
+ #define DDRDATACH0_CR_RXPERBITRANK1_Lane3_WID ( 4)
+ #define DDRDATACH0_CR_RXPERBITRANK1_Lane3_MSK (0x0000F000)
+ #define DDRDATACH0_CR_RXPERBITRANK1_Lane3_MAX (0x0000000F)
+ #define DDRDATACH0_CR_RXPERBITRANK1_Lane4_OFF (16)
+ #define DDRDATACH0_CR_RXPERBITRANK1_Lane4_WID ( 4)
+ #define DDRDATACH0_CR_RXPERBITRANK1_Lane4_MSK (0x000F0000)
+ #define DDRDATACH0_CR_RXPERBITRANK1_Lane4_MAX (0x0000000F)
+ #define DDRDATACH0_CR_RXPERBITRANK1_Lane5_OFF (20)
+ #define DDRDATACH0_CR_RXPERBITRANK1_Lane5_WID ( 4)
+ #define DDRDATACH0_CR_RXPERBITRANK1_Lane5_MSK (0x00F00000)
+ #define DDRDATACH0_CR_RXPERBITRANK1_Lane5_MAX (0x0000000F)
+ #define DDRDATACH0_CR_RXPERBITRANK1_Lane6_OFF (24)
+ #define DDRDATACH0_CR_RXPERBITRANK1_Lane6_WID ( 4)
+ #define DDRDATACH0_CR_RXPERBITRANK1_Lane6_MSK (0x0F000000)
+ #define DDRDATACH0_CR_RXPERBITRANK1_Lane6_MAX (0x0000000F)
+ #define DDRDATACH0_CR_RXPERBITRANK1_Lane7_OFF (28)
+ #define DDRDATACH0_CR_RXPERBITRANK1_Lane7_WID ( 4)
+ #define DDRDATACH0_CR_RXPERBITRANK1_Lane7_MSK (0xF0000000)
+ #define DDRDATACH0_CR_RXPERBITRANK1_Lane7_MAX (0x0000000F)
+
+#define DDRDATACH0_CR_RXPERBITRANK2_REG (0x00003018)
+ #define DDRDATACH0_CR_RXPERBITRANK2_Lane0_OFF ( 0)
+ #define DDRDATACH0_CR_RXPERBITRANK2_Lane0_WID ( 4)
+ #define DDRDATACH0_CR_RXPERBITRANK2_Lane0_MSK (0x0000000F)
+ #define DDRDATACH0_CR_RXPERBITRANK2_Lane0_MAX (0x0000000F)
+ #define DDRDATACH0_CR_RXPERBITRANK2_Lane1_OFF ( 4)
+ #define DDRDATACH0_CR_RXPERBITRANK2_Lane1_WID ( 4)
+ #define DDRDATACH0_CR_RXPERBITRANK2_Lane1_MSK (0x000000F0)
+ #define DDRDATACH0_CR_RXPERBITRANK2_Lane1_MAX (0x0000000F)
+ #define DDRDATACH0_CR_RXPERBITRANK2_Lane2_OFF ( 8)
+ #define DDRDATACH0_CR_RXPERBITRANK2_Lane2_WID ( 4)
+ #define DDRDATACH0_CR_RXPERBITRANK2_Lane2_MSK (0x00000F00)
+ #define DDRDATACH0_CR_RXPERBITRANK2_Lane2_MAX (0x0000000F)
+ #define DDRDATACH0_CR_RXPERBITRANK2_Lane3_OFF (12)
+ #define DDRDATACH0_CR_RXPERBITRANK2_Lane3_WID ( 4)
+ #define DDRDATACH0_CR_RXPERBITRANK2_Lane3_MSK (0x0000F000)
+ #define DDRDATACH0_CR_RXPERBITRANK2_Lane3_MAX (0x0000000F)
+ #define DDRDATACH0_CR_RXPERBITRANK2_Lane4_OFF (16)
+ #define DDRDATACH0_CR_RXPERBITRANK2_Lane4_WID ( 4)
+ #define DDRDATACH0_CR_RXPERBITRANK2_Lane4_MSK (0x000F0000)
+ #define DDRDATACH0_CR_RXPERBITRANK2_Lane4_MAX (0x0000000F)
+ #define DDRDATACH0_CR_RXPERBITRANK2_Lane5_OFF (20)
+ #define DDRDATACH0_CR_RXPERBITRANK2_Lane5_WID ( 4)
+ #define DDRDATACH0_CR_RXPERBITRANK2_Lane5_MSK (0x00F00000)
+ #define DDRDATACH0_CR_RXPERBITRANK2_Lane5_MAX (0x0000000F)
+ #define DDRDATACH0_CR_RXPERBITRANK2_Lane6_OFF (24)
+ #define DDRDATACH0_CR_RXPERBITRANK2_Lane6_WID ( 4)
+ #define DDRDATACH0_CR_RXPERBITRANK2_Lane6_MSK (0x0F000000)
+ #define DDRDATACH0_CR_RXPERBITRANK2_Lane6_MAX (0x0000000F)
+ #define DDRDATACH0_CR_RXPERBITRANK2_Lane7_OFF (28)
+ #define DDRDATACH0_CR_RXPERBITRANK2_Lane7_WID ( 4)
+ #define DDRDATACH0_CR_RXPERBITRANK2_Lane7_MSK (0xF0000000)
+ #define DDRDATACH0_CR_RXPERBITRANK2_Lane7_MAX (0x0000000F)
+
+#define DDRDATACH0_CR_RXPERBITRANK3_REG (0x0000301C)
+ #define DDRDATACH0_CR_RXPERBITRANK3_Lane0_OFF ( 0)
+ #define DDRDATACH0_CR_RXPERBITRANK3_Lane0_WID ( 4)
+ #define DDRDATACH0_CR_RXPERBITRANK3_Lane0_MSK (0x0000000F)
+ #define DDRDATACH0_CR_RXPERBITRANK3_Lane0_MAX (0x0000000F)
+ #define DDRDATACH0_CR_RXPERBITRANK3_Lane1_OFF ( 4)
+ #define DDRDATACH0_CR_RXPERBITRANK3_Lane1_WID ( 4)
+ #define DDRDATACH0_CR_RXPERBITRANK3_Lane1_MSK (0x000000F0)
+ #define DDRDATACH0_CR_RXPERBITRANK3_Lane1_MAX (0x0000000F)
+ #define DDRDATACH0_CR_RXPERBITRANK3_Lane2_OFF ( 8)
+ #define DDRDATACH0_CR_RXPERBITRANK3_Lane2_WID ( 4)
+ #define DDRDATACH0_CR_RXPERBITRANK3_Lane2_MSK (0x00000F00)
+ #define DDRDATACH0_CR_RXPERBITRANK3_Lane2_MAX (0x0000000F)
+ #define DDRDATACH0_CR_RXPERBITRANK3_Lane3_OFF (12)
+ #define DDRDATACH0_CR_RXPERBITRANK3_Lane3_WID ( 4)
+ #define DDRDATACH0_CR_RXPERBITRANK3_Lane3_MSK (0x0000F000)
+ #define DDRDATACH0_CR_RXPERBITRANK3_Lane3_MAX (0x0000000F)
+ #define DDRDATACH0_CR_RXPERBITRANK3_Lane4_OFF (16)
+ #define DDRDATACH0_CR_RXPERBITRANK3_Lane4_WID ( 4)
+ #define DDRDATACH0_CR_RXPERBITRANK3_Lane4_MSK (0x000F0000)
+ #define DDRDATACH0_CR_RXPERBITRANK3_Lane4_MAX (0x0000000F)
+ #define DDRDATACH0_CR_RXPERBITRANK3_Lane5_OFF (20)
+ #define DDRDATACH0_CR_RXPERBITRANK3_Lane5_WID ( 4)
+ #define DDRDATACH0_CR_RXPERBITRANK3_Lane5_MSK (0x00F00000)
+ #define DDRDATACH0_CR_RXPERBITRANK3_Lane5_MAX (0x0000000F)
+ #define DDRDATACH0_CR_RXPERBITRANK3_Lane6_OFF (24)
+ #define DDRDATACH0_CR_RXPERBITRANK3_Lane6_WID ( 4)
+ #define DDRDATACH0_CR_RXPERBITRANK3_Lane6_MSK (0x0F000000)
+ #define DDRDATACH0_CR_RXPERBITRANK3_Lane6_MAX (0x0000000F)
+ #define DDRDATACH0_CR_RXPERBITRANK3_Lane7_OFF (28)
+ #define DDRDATACH0_CR_RXPERBITRANK3_Lane7_WID ( 4)
+ #define DDRDATACH0_CR_RXPERBITRANK3_Lane7_MSK (0xF0000000)
+ #define DDRDATACH0_CR_RXPERBITRANK3_Lane7_MAX (0x0000000F)
+
+#define DDRDATACH0_CR_TXTRAINRANK0_REG (0x00003020)
+ #define DDRDATACH0_CR_TXTRAINRANK0_TxDqDelay_OFF ( 0)
+ #define DDRDATACH0_CR_TXTRAINRANK0_TxDqDelay_WID ( 9)
+ #define DDRDATACH0_CR_TXTRAINRANK0_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATACH0_CR_TXTRAINRANK0_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATACH0_CR_TXTRAINRANK0_TxDqsDelay_OFF ( 9)
+ #define DDRDATACH0_CR_TXTRAINRANK0_TxDqsDelay_WID ( 9)
+ #define DDRDATACH0_CR_TXTRAINRANK0_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATACH0_CR_TXTRAINRANK0_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATACH0_CR_TXTRAINRANK0_Spare0_OFF (18)
+ #define DDRDATACH0_CR_TXTRAINRANK0_Spare0_WID ( 2)
+ #define DDRDATACH0_CR_TXTRAINRANK0_Spare0_MSK (0x000C0000)
+ #define DDRDATACH0_CR_TXTRAINRANK0_Spare0_MAX (0x00000003)
+ #define DDRDATACH0_CR_TXTRAINRANK0_TxEqualization_OFF (20)
+ #define DDRDATACH0_CR_TXTRAINRANK0_TxEqualization_WID ( 6)
+ #define DDRDATACH0_CR_TXTRAINRANK0_TxEqualization_MSK (0x03F00000)
+ #define DDRDATACH0_CR_TXTRAINRANK0_TxEqualization_MAX (0x0000003F)
+ #define DDRDATACH0_CR_TXTRAINRANK0_Spare1_OFF (26)
+ #define DDRDATACH0_CR_TXTRAINRANK0_Spare1_WID ( 6)
+ #define DDRDATACH0_CR_TXTRAINRANK0_Spare1_MSK (0xFC000000)
+ #define DDRDATACH0_CR_TXTRAINRANK0_Spare1_MAX (0x0000003F)
+
+#define DDRDATACH0_CR_TXTRAINRANK1_REG (0x00003024)
+ #define DDRDATACH0_CR_TXTRAINRANK1_TxDqDelay_OFF ( 0)
+ #define DDRDATACH0_CR_TXTRAINRANK1_TxDqDelay_WID ( 9)
+ #define DDRDATACH0_CR_TXTRAINRANK1_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATACH0_CR_TXTRAINRANK1_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATACH0_CR_TXTRAINRANK1_TxDqsDelay_OFF ( 9)
+ #define DDRDATACH0_CR_TXTRAINRANK1_TxDqsDelay_WID ( 9)
+ #define DDRDATACH0_CR_TXTRAINRANK1_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATACH0_CR_TXTRAINRANK1_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATACH0_CR_TXTRAINRANK1_Spare0_OFF (18)
+ #define DDRDATACH0_CR_TXTRAINRANK1_Spare0_WID ( 2)
+ #define DDRDATACH0_CR_TXTRAINRANK1_Spare0_MSK (0x000C0000)
+ #define DDRDATACH0_CR_TXTRAINRANK1_Spare0_MAX (0x00000003)
+ #define DDRDATACH0_CR_TXTRAINRANK1_TxEqualization_OFF (20)
+ #define DDRDATACH0_CR_TXTRAINRANK1_TxEqualization_WID ( 6)
+ #define DDRDATACH0_CR_TXTRAINRANK1_TxEqualization_MSK (0x03F00000)
+ #define DDRDATACH0_CR_TXTRAINRANK1_TxEqualization_MAX (0x0000003F)
+ #define DDRDATACH0_CR_TXTRAINRANK1_Spare1_OFF (26)
+ #define DDRDATACH0_CR_TXTRAINRANK1_Spare1_WID ( 6)
+ #define DDRDATACH0_CR_TXTRAINRANK1_Spare1_MSK (0xFC000000)
+ #define DDRDATACH0_CR_TXTRAINRANK1_Spare1_MAX (0x0000003F)
+
+#define DDRDATACH0_CR_TXTRAINRANK2_REG (0x00003028)
+ #define DDRDATACH0_CR_TXTRAINRANK2_TxDqDelay_OFF ( 0)
+ #define DDRDATACH0_CR_TXTRAINRANK2_TxDqDelay_WID ( 9)
+ #define DDRDATACH0_CR_TXTRAINRANK2_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATACH0_CR_TXTRAINRANK2_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATACH0_CR_TXTRAINRANK2_TxDqsDelay_OFF ( 9)
+ #define DDRDATACH0_CR_TXTRAINRANK2_TxDqsDelay_WID ( 9)
+ #define DDRDATACH0_CR_TXTRAINRANK2_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATACH0_CR_TXTRAINRANK2_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATACH0_CR_TXTRAINRANK2_Spare0_OFF (18)
+ #define DDRDATACH0_CR_TXTRAINRANK2_Spare0_WID ( 2)
+ #define DDRDATACH0_CR_TXTRAINRANK2_Spare0_MSK (0x000C0000)
+ #define DDRDATACH0_CR_TXTRAINRANK2_Spare0_MAX (0x00000003)
+ #define DDRDATACH0_CR_TXTRAINRANK2_TxEqualization_OFF (20)
+ #define DDRDATACH0_CR_TXTRAINRANK2_TxEqualization_WID ( 6)
+ #define DDRDATACH0_CR_TXTRAINRANK2_TxEqualization_MSK (0x03F00000)
+ #define DDRDATACH0_CR_TXTRAINRANK2_TxEqualization_MAX (0x0000003F)
+ #define DDRDATACH0_CR_TXTRAINRANK2_Spare1_OFF (26)
+ #define DDRDATACH0_CR_TXTRAINRANK2_Spare1_WID ( 6)
+ #define DDRDATACH0_CR_TXTRAINRANK2_Spare1_MSK (0xFC000000)
+ #define DDRDATACH0_CR_TXTRAINRANK2_Spare1_MAX (0x0000003F)
+
+#define DDRDATACH0_CR_TXTRAINRANK3_REG (0x0000302C)
+ #define DDRDATACH0_CR_TXTRAINRANK3_TxDqDelay_OFF ( 0)
+ #define DDRDATACH0_CR_TXTRAINRANK3_TxDqDelay_WID ( 9)
+ #define DDRDATACH0_CR_TXTRAINRANK3_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATACH0_CR_TXTRAINRANK3_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATACH0_CR_TXTRAINRANK3_TxDqsDelay_OFF ( 9)
+ #define DDRDATACH0_CR_TXTRAINRANK3_TxDqsDelay_WID ( 9)
+ #define DDRDATACH0_CR_TXTRAINRANK3_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATACH0_CR_TXTRAINRANK3_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATACH0_CR_TXTRAINRANK3_Spare0_OFF (18)
+ #define DDRDATACH0_CR_TXTRAINRANK3_Spare0_WID ( 2)
+ #define DDRDATACH0_CR_TXTRAINRANK3_Spare0_MSK (0x000C0000)
+ #define DDRDATACH0_CR_TXTRAINRANK3_Spare0_MAX (0x00000003)
+ #define DDRDATACH0_CR_TXTRAINRANK3_TxEqualization_OFF (20)
+ #define DDRDATACH0_CR_TXTRAINRANK3_TxEqualization_WID ( 6)
+ #define DDRDATACH0_CR_TXTRAINRANK3_TxEqualization_MSK (0x03F00000)
+ #define DDRDATACH0_CR_TXTRAINRANK3_TxEqualization_MAX (0x0000003F)
+ #define DDRDATACH0_CR_TXTRAINRANK3_Spare1_OFF (26)
+ #define DDRDATACH0_CR_TXTRAINRANK3_Spare1_WID ( 6)
+ #define DDRDATACH0_CR_TXTRAINRANK3_Spare1_MSK (0xFC000000)
+ #define DDRDATACH0_CR_TXTRAINRANK3_Spare1_MAX (0x0000003F)
+
+#define DDRDATACH0_CR_TXPERBITRANK0_REG (0x00003030)
+ #define DDRDATACH0_CR_TXPERBITRANK0_Lane0_OFF ( 0)
+ #define DDRDATACH0_CR_TXPERBITRANK0_Lane0_WID ( 4)
+ #define DDRDATACH0_CR_TXPERBITRANK0_Lane0_MSK (0x0000000F)
+ #define DDRDATACH0_CR_TXPERBITRANK0_Lane0_MAX (0x0000000F)
+ #define DDRDATACH0_CR_TXPERBITRANK0_Lane1_OFF ( 4)
+ #define DDRDATACH0_CR_TXPERBITRANK0_Lane1_WID ( 4)
+ #define DDRDATACH0_CR_TXPERBITRANK0_Lane1_MSK (0x000000F0)
+ #define DDRDATACH0_CR_TXPERBITRANK0_Lane1_MAX (0x0000000F)
+ #define DDRDATACH0_CR_TXPERBITRANK0_Lane2_OFF ( 8)
+ #define DDRDATACH0_CR_TXPERBITRANK0_Lane2_WID ( 4)
+ #define DDRDATACH0_CR_TXPERBITRANK0_Lane2_MSK (0x00000F00)
+ #define DDRDATACH0_CR_TXPERBITRANK0_Lane2_MAX (0x0000000F)
+ #define DDRDATACH0_CR_TXPERBITRANK0_Lane3_OFF (12)
+ #define DDRDATACH0_CR_TXPERBITRANK0_Lane3_WID ( 4)
+ #define DDRDATACH0_CR_TXPERBITRANK0_Lane3_MSK (0x0000F000)
+ #define DDRDATACH0_CR_TXPERBITRANK0_Lane3_MAX (0x0000000F)
+ #define DDRDATACH0_CR_TXPERBITRANK0_Lane4_OFF (16)
+ #define DDRDATACH0_CR_TXPERBITRANK0_Lane4_WID ( 4)
+ #define DDRDATACH0_CR_TXPERBITRANK0_Lane4_MSK (0x000F0000)
+ #define DDRDATACH0_CR_TXPERBITRANK0_Lane4_MAX (0x0000000F)
+ #define DDRDATACH0_CR_TXPERBITRANK0_Lane5_OFF (20)
+ #define DDRDATACH0_CR_TXPERBITRANK0_Lane5_WID ( 4)
+ #define DDRDATACH0_CR_TXPERBITRANK0_Lane5_MSK (0x00F00000)
+ #define DDRDATACH0_CR_TXPERBITRANK0_Lane5_MAX (0x0000000F)
+ #define DDRDATACH0_CR_TXPERBITRANK0_Lane6_OFF (24)
+ #define DDRDATACH0_CR_TXPERBITRANK0_Lane6_WID ( 4)
+ #define DDRDATACH0_CR_TXPERBITRANK0_Lane6_MSK (0x0F000000)
+ #define DDRDATACH0_CR_TXPERBITRANK0_Lane6_MAX (0x0000000F)
+ #define DDRDATACH0_CR_TXPERBITRANK0_Lane7_OFF (28)
+ #define DDRDATACH0_CR_TXPERBITRANK0_Lane7_WID ( 4)
+ #define DDRDATACH0_CR_TXPERBITRANK0_Lane7_MSK (0xF0000000)
+ #define DDRDATACH0_CR_TXPERBITRANK0_Lane7_MAX (0x0000000F)
+
+#define DDRDATACH0_CR_TXPERBITRANK1_REG (0x00003034)
+ #define DDRDATACH0_CR_TXPERBITRANK1_Lane0_OFF ( 0)
+ #define DDRDATACH0_CR_TXPERBITRANK1_Lane0_WID ( 4)
+ #define DDRDATACH0_CR_TXPERBITRANK1_Lane0_MSK (0x0000000F)
+ #define DDRDATACH0_CR_TXPERBITRANK1_Lane0_MAX (0x0000000F)
+ #define DDRDATACH0_CR_TXPERBITRANK1_Lane1_OFF ( 4)
+ #define DDRDATACH0_CR_TXPERBITRANK1_Lane1_WID ( 4)
+ #define DDRDATACH0_CR_TXPERBITRANK1_Lane1_MSK (0x000000F0)
+ #define DDRDATACH0_CR_TXPERBITRANK1_Lane1_MAX (0x0000000F)
+ #define DDRDATACH0_CR_TXPERBITRANK1_Lane2_OFF ( 8)
+ #define DDRDATACH0_CR_TXPERBITRANK1_Lane2_WID ( 4)
+ #define DDRDATACH0_CR_TXPERBITRANK1_Lane2_MSK (0x00000F00)
+ #define DDRDATACH0_CR_TXPERBITRANK1_Lane2_MAX (0x0000000F)
+ #define DDRDATACH0_CR_TXPERBITRANK1_Lane3_OFF (12)
+ #define DDRDATACH0_CR_TXPERBITRANK1_Lane3_WID ( 4)
+ #define DDRDATACH0_CR_TXPERBITRANK1_Lane3_MSK (0x0000F000)
+ #define DDRDATACH0_CR_TXPERBITRANK1_Lane3_MAX (0x0000000F)
+ #define DDRDATACH0_CR_TXPERBITRANK1_Lane4_OFF (16)
+ #define DDRDATACH0_CR_TXPERBITRANK1_Lane4_WID ( 4)
+ #define DDRDATACH0_CR_TXPERBITRANK1_Lane4_MSK (0x000F0000)
+ #define DDRDATACH0_CR_TXPERBITRANK1_Lane4_MAX (0x0000000F)
+ #define DDRDATACH0_CR_TXPERBITRANK1_Lane5_OFF (20)
+ #define DDRDATACH0_CR_TXPERBITRANK1_Lane5_WID ( 4)
+ #define DDRDATACH0_CR_TXPERBITRANK1_Lane5_MSK (0x00F00000)
+ #define DDRDATACH0_CR_TXPERBITRANK1_Lane5_MAX (0x0000000F)
+ #define DDRDATACH0_CR_TXPERBITRANK1_Lane6_OFF (24)
+ #define DDRDATACH0_CR_TXPERBITRANK1_Lane6_WID ( 4)
+ #define DDRDATACH0_CR_TXPERBITRANK1_Lane6_MSK (0x0F000000)
+ #define DDRDATACH0_CR_TXPERBITRANK1_Lane6_MAX (0x0000000F)
+ #define DDRDATACH0_CR_TXPERBITRANK1_Lane7_OFF (28)
+ #define DDRDATACH0_CR_TXPERBITRANK1_Lane7_WID ( 4)
+ #define DDRDATACH0_CR_TXPERBITRANK1_Lane7_MSK (0xF0000000)
+ #define DDRDATACH0_CR_TXPERBITRANK1_Lane7_MAX (0x0000000F)
+
+#define DDRDATACH0_CR_TXPERBITRANK2_REG (0x00003038)
+ #define DDRDATACH0_CR_TXPERBITRANK2_Lane0_OFF ( 0)
+ #define DDRDATACH0_CR_TXPERBITRANK2_Lane0_WID ( 4)
+ #define DDRDATACH0_CR_TXPERBITRANK2_Lane0_MSK (0x0000000F)
+ #define DDRDATACH0_CR_TXPERBITRANK2_Lane0_MAX (0x0000000F)
+ #define DDRDATACH0_CR_TXPERBITRANK2_Lane1_OFF ( 4)
+ #define DDRDATACH0_CR_TXPERBITRANK2_Lane1_WID ( 4)
+ #define DDRDATACH0_CR_TXPERBITRANK2_Lane1_MSK (0x000000F0)
+ #define DDRDATACH0_CR_TXPERBITRANK2_Lane1_MAX (0x0000000F)
+ #define DDRDATACH0_CR_TXPERBITRANK2_Lane2_OFF ( 8)
+ #define DDRDATACH0_CR_TXPERBITRANK2_Lane2_WID ( 4)
+ #define DDRDATACH0_CR_TXPERBITRANK2_Lane2_MSK (0x00000F00)
+ #define DDRDATACH0_CR_TXPERBITRANK2_Lane2_MAX (0x0000000F)
+ #define DDRDATACH0_CR_TXPERBITRANK2_Lane3_OFF (12)
+ #define DDRDATACH0_CR_TXPERBITRANK2_Lane3_WID ( 4)
+ #define DDRDATACH0_CR_TXPERBITRANK2_Lane3_MSK (0x0000F000)
+ #define DDRDATACH0_CR_TXPERBITRANK2_Lane3_MAX (0x0000000F)
+ #define DDRDATACH0_CR_TXPERBITRANK2_Lane4_OFF (16)
+ #define DDRDATACH0_CR_TXPERBITRANK2_Lane4_WID ( 4)
+ #define DDRDATACH0_CR_TXPERBITRANK2_Lane4_MSK (0x000F0000)
+ #define DDRDATACH0_CR_TXPERBITRANK2_Lane4_MAX (0x0000000F)
+ #define DDRDATACH0_CR_TXPERBITRANK2_Lane5_OFF (20)
+ #define DDRDATACH0_CR_TXPERBITRANK2_Lane5_WID ( 4)
+ #define DDRDATACH0_CR_TXPERBITRANK2_Lane5_MSK (0x00F00000)
+ #define DDRDATACH0_CR_TXPERBITRANK2_Lane5_MAX (0x0000000F)
+ #define DDRDATACH0_CR_TXPERBITRANK2_Lane6_OFF (24)
+ #define DDRDATACH0_CR_TXPERBITRANK2_Lane6_WID ( 4)
+ #define DDRDATACH0_CR_TXPERBITRANK2_Lane6_MSK (0x0F000000)
+ #define DDRDATACH0_CR_TXPERBITRANK2_Lane6_MAX (0x0000000F)
+ #define DDRDATACH0_CR_TXPERBITRANK2_Lane7_OFF (28)
+ #define DDRDATACH0_CR_TXPERBITRANK2_Lane7_WID ( 4)
+ #define DDRDATACH0_CR_TXPERBITRANK2_Lane7_MSK (0xF0000000)
+ #define DDRDATACH0_CR_TXPERBITRANK2_Lane7_MAX (0x0000000F)
+
+#define DDRDATACH0_CR_TXPERBITRANK3_REG (0x0000303C)
+ #define DDRDATACH0_CR_TXPERBITRANK3_Lane0_OFF ( 0)
+ #define DDRDATACH0_CR_TXPERBITRANK3_Lane0_WID ( 4)
+ #define DDRDATACH0_CR_TXPERBITRANK3_Lane0_MSK (0x0000000F)
+ #define DDRDATACH0_CR_TXPERBITRANK3_Lane0_MAX (0x0000000F)
+ #define DDRDATACH0_CR_TXPERBITRANK3_Lane1_OFF ( 4)
+ #define DDRDATACH0_CR_TXPERBITRANK3_Lane1_WID ( 4)
+ #define DDRDATACH0_CR_TXPERBITRANK3_Lane1_MSK (0x000000F0)
+ #define DDRDATACH0_CR_TXPERBITRANK3_Lane1_MAX (0x0000000F)
+ #define DDRDATACH0_CR_TXPERBITRANK3_Lane2_OFF ( 8)
+ #define DDRDATACH0_CR_TXPERBITRANK3_Lane2_WID ( 4)
+ #define DDRDATACH0_CR_TXPERBITRANK3_Lane2_MSK (0x00000F00)
+ #define DDRDATACH0_CR_TXPERBITRANK3_Lane2_MAX (0x0000000F)
+ #define DDRDATACH0_CR_TXPERBITRANK3_Lane3_OFF (12)
+ #define DDRDATACH0_CR_TXPERBITRANK3_Lane3_WID ( 4)
+ #define DDRDATACH0_CR_TXPERBITRANK3_Lane3_MSK (0x0000F000)
+ #define DDRDATACH0_CR_TXPERBITRANK3_Lane3_MAX (0x0000000F)
+ #define DDRDATACH0_CR_TXPERBITRANK3_Lane4_OFF (16)
+ #define DDRDATACH0_CR_TXPERBITRANK3_Lane4_WID ( 4)
+ #define DDRDATACH0_CR_TXPERBITRANK3_Lane4_MSK (0x000F0000)
+ #define DDRDATACH0_CR_TXPERBITRANK3_Lane4_MAX (0x0000000F)
+ #define DDRDATACH0_CR_TXPERBITRANK3_Lane5_OFF (20)
+ #define DDRDATACH0_CR_TXPERBITRANK3_Lane5_WID ( 4)
+ #define DDRDATACH0_CR_TXPERBITRANK3_Lane5_MSK (0x00F00000)
+ #define DDRDATACH0_CR_TXPERBITRANK3_Lane5_MAX (0x0000000F)
+ #define DDRDATACH0_CR_TXPERBITRANK3_Lane6_OFF (24)
+ #define DDRDATACH0_CR_TXPERBITRANK3_Lane6_WID ( 4)
+ #define DDRDATACH0_CR_TXPERBITRANK3_Lane6_MSK (0x0F000000)
+ #define DDRDATACH0_CR_TXPERBITRANK3_Lane6_MAX (0x0000000F)
+ #define DDRDATACH0_CR_TXPERBITRANK3_Lane7_OFF (28)
+ #define DDRDATACH0_CR_TXPERBITRANK3_Lane7_WID ( 4)
+ #define DDRDATACH0_CR_TXPERBITRANK3_Lane7_MSK (0xF0000000)
+ #define DDRDATACH0_CR_TXPERBITRANK3_Lane7_MAX (0x0000000F)
+
+#define DDRDATACH0_CR_RCOMPDATA0_REG (0x00003040)
+ #define DDRDATACH0_CR_RCOMPDATA0_RcompDrvUp_OFF ( 0)
+ #define DDRDATACH0_CR_RCOMPDATA0_RcompDrvUp_WID ( 6)
+ #define DDRDATACH0_CR_RCOMPDATA0_RcompDrvUp_MSK (0x0000003F)
+ #define DDRDATACH0_CR_RCOMPDATA0_RcompDrvUp_MAX (0x0000003F)
+ #define DDRDATACH0_CR_RCOMPDATA0_Spare0_OFF ( 6)
+ #define DDRDATACH0_CR_RCOMPDATA0_Spare0_WID ( 3)
+ #define DDRDATACH0_CR_RCOMPDATA0_Spare0_MSK (0x000001C0)
+ #define DDRDATACH0_CR_RCOMPDATA0_Spare0_MAX (0x00000007)
+ #define DDRDATACH0_CR_RCOMPDATA0_RcompDrvDown_OFF ( 9)
+ #define DDRDATACH0_CR_RCOMPDATA0_RcompDrvDown_WID ( 6)
+ #define DDRDATACH0_CR_RCOMPDATA0_RcompDrvDown_MSK (0x00007E00)
+ #define DDRDATACH0_CR_RCOMPDATA0_RcompDrvDown_MAX (0x0000003F)
+ #define DDRDATACH0_CR_RCOMPDATA0_VTComp_OFF (15)
+ #define DDRDATACH0_CR_RCOMPDATA0_VTComp_WID ( 5)
+ #define DDRDATACH0_CR_RCOMPDATA0_VTComp_MSK (0x000F8000)
+ #define DDRDATACH0_CR_RCOMPDATA0_VTComp_MAX (0x0000001F)
+ #define DDRDATACH0_CR_RCOMPDATA0_TcoComp_OFF (20)
+ #define DDRDATACH0_CR_RCOMPDATA0_TcoComp_WID ( 6)
+ #define DDRDATACH0_CR_RCOMPDATA0_TcoComp_MSK (0x03F00000)
+ #define DDRDATACH0_CR_RCOMPDATA0_TcoComp_MAX (0x0000003F)
+ #define DDRDATACH0_CR_RCOMPDATA0_SlewRateComp_OFF (26)
+ #define DDRDATACH0_CR_RCOMPDATA0_SlewRateComp_WID ( 5)
+ #define DDRDATACH0_CR_RCOMPDATA0_SlewRateComp_MSK (0x7C000000)
+ #define DDRDATACH0_CR_RCOMPDATA0_SlewRateComp_MAX (0x0000001F)
+ #define DDRDATACH0_CR_RCOMPDATA0_Spare2_OFF (31)
+ #define DDRDATACH0_CR_RCOMPDATA0_Spare2_WID ( 1)
+ #define DDRDATACH0_CR_RCOMPDATA0_Spare2_MSK (0x80000000)
+ #define DDRDATACH0_CR_RCOMPDATA0_Spare2_MAX (0x00000001)
+
+#define DDRDATACH0_CR_RCOMPDATA1_REG (0x00003044)
+ #define DDRDATACH0_CR_RCOMPDATA1_RcompOdtUp_OFF ( 0)
+ #define DDRDATACH0_CR_RCOMPDATA1_RcompOdtUp_WID ( 6)
+ #define DDRDATACH0_CR_RCOMPDATA1_RcompOdtUp_MSK (0x0000003F)
+ #define DDRDATACH0_CR_RCOMPDATA1_RcompOdtUp_MAX (0x0000003F)
+ #define DDRDATACH0_CR_RCOMPDATA1_Spare0_OFF ( 6)
+ #define DDRDATACH0_CR_RCOMPDATA1_Spare0_WID ( 3)
+ #define DDRDATACH0_CR_RCOMPDATA1_Spare0_MSK (0x000001C0)
+ #define DDRDATACH0_CR_RCOMPDATA1_Spare0_MAX (0x00000007)
+ #define DDRDATACH0_CR_RCOMPDATA1_RcompOdtDown_OFF ( 9)
+ #define DDRDATACH0_CR_RCOMPDATA1_RcompOdtDown_WID ( 6)
+ #define DDRDATACH0_CR_RCOMPDATA1_RcompOdtDown_MSK (0x00007E00)
+ #define DDRDATACH0_CR_RCOMPDATA1_RcompOdtDown_MAX (0x0000003F)
+ #define DDRDATACH0_CR_RCOMPDATA1_Spare1_OFF (15)
+ #define DDRDATACH0_CR_RCOMPDATA1_Spare1_WID ( 1)
+ #define DDRDATACH0_CR_RCOMPDATA1_Spare1_MSK (0x00008000)
+ #define DDRDATACH0_CR_RCOMPDATA1_Spare1_MAX (0x00000001)
+ #define DDRDATACH0_CR_RCOMPDATA1_PanicDrvDn_OFF (16)
+ #define DDRDATACH0_CR_RCOMPDATA1_PanicDrvDn_WID ( 6)
+ #define DDRDATACH0_CR_RCOMPDATA1_PanicDrvDn_MSK (0x003F0000)
+ #define DDRDATACH0_CR_RCOMPDATA1_PanicDrvDn_MAX (0x0000003F)
+ #define DDRDATACH0_CR_RCOMPDATA1_PanicDrvUp_OFF (22)
+ #define DDRDATACH0_CR_RCOMPDATA1_PanicDrvUp_WID ( 6)
+ #define DDRDATACH0_CR_RCOMPDATA1_PanicDrvUp_MSK (0x0FC00000)
+ #define DDRDATACH0_CR_RCOMPDATA1_PanicDrvUp_MAX (0x0000003F)
+ #define DDRDATACH0_CR_RCOMPDATA1_LevelShifterComp_OFF (28)
+ #define DDRDATACH0_CR_RCOMPDATA1_LevelShifterComp_WID ( 3)
+ #define DDRDATACH0_CR_RCOMPDATA1_LevelShifterComp_MSK (0x70000000)
+ #define DDRDATACH0_CR_RCOMPDATA1_LevelShifterComp_MAX (0x00000007)
+ #define DDRDATACH0_CR_RCOMPDATA1_Spare2_OFF (31)
+ #define DDRDATACH0_CR_RCOMPDATA1_Spare2_WID ( 1)
+ #define DDRDATACH0_CR_RCOMPDATA1_Spare2_MSK (0x80000000)
+ #define DDRDATACH0_CR_RCOMPDATA1_Spare2_MAX (0x00000001)
+
+#define DDRDATACH0_CR_TXXTALK_REG (0x00003048)
+ #define DDRDATACH0_CR_TXXTALK_Lane0_OFF ( 0)
+ #define DDRDATACH0_CR_TXXTALK_Lane0_WID ( 4)
+ #define DDRDATACH0_CR_TXXTALK_Lane0_MSK (0x0000000F)
+ #define DDRDATACH0_CR_TXXTALK_Lane0_MAX (0x0000000F)
+ #define DDRDATACH0_CR_TXXTALK_Lane1_OFF ( 4)
+ #define DDRDATACH0_CR_TXXTALK_Lane1_WID ( 4)
+ #define DDRDATACH0_CR_TXXTALK_Lane1_MSK (0x000000F0)
+ #define DDRDATACH0_CR_TXXTALK_Lane1_MAX (0x0000000F)
+ #define DDRDATACH0_CR_TXXTALK_Lane2_OFF ( 8)
+ #define DDRDATACH0_CR_TXXTALK_Lane2_WID ( 4)
+ #define DDRDATACH0_CR_TXXTALK_Lane2_MSK (0x00000F00)
+ #define DDRDATACH0_CR_TXXTALK_Lane2_MAX (0x0000000F)
+ #define DDRDATACH0_CR_TXXTALK_Lane3_OFF (12)
+ #define DDRDATACH0_CR_TXXTALK_Lane3_WID ( 4)
+ #define DDRDATACH0_CR_TXXTALK_Lane3_MSK (0x0000F000)
+ #define DDRDATACH0_CR_TXXTALK_Lane3_MAX (0x0000000F)
+ #define DDRDATACH0_CR_TXXTALK_Lane4_OFF (16)
+ #define DDRDATACH0_CR_TXXTALK_Lane4_WID ( 4)
+ #define DDRDATACH0_CR_TXXTALK_Lane4_MSK (0x000F0000)
+ #define DDRDATACH0_CR_TXXTALK_Lane4_MAX (0x0000000F)
+ #define DDRDATACH0_CR_TXXTALK_Lane5_OFF (20)
+ #define DDRDATACH0_CR_TXXTALK_Lane5_WID ( 4)
+ #define DDRDATACH0_CR_TXXTALK_Lane5_MSK (0x00F00000)
+ #define DDRDATACH0_CR_TXXTALK_Lane5_MAX (0x0000000F)
+ #define DDRDATACH0_CR_TXXTALK_Lane6_OFF (24)
+ #define DDRDATACH0_CR_TXXTALK_Lane6_WID ( 4)
+ #define DDRDATACH0_CR_TXXTALK_Lane6_MSK (0x0F000000)
+ #define DDRDATACH0_CR_TXXTALK_Lane6_MAX (0x0000000F)
+ #define DDRDATACH0_CR_TXXTALK_Lane7_OFF (28)
+ #define DDRDATACH0_CR_TXXTALK_Lane7_WID ( 4)
+ #define DDRDATACH0_CR_TXXTALK_Lane7_MSK (0xF0000000)
+ #define DDRDATACH0_CR_TXXTALK_Lane7_MAX (0x0000000F)
+
+#define DDRDATACH0_CR_RXOFFSETVDQ_REG (0x0000304C)
+ #define DDRDATACH0_CR_RXOFFSETVDQ_Lane0_OFF ( 0)
+ #define DDRDATACH0_CR_RXOFFSETVDQ_Lane0_WID ( 4)
+ #define DDRDATACH0_CR_RXOFFSETVDQ_Lane0_MSK (0x0000000F)
+ #define DDRDATACH0_CR_RXOFFSETVDQ_Lane0_MAX (0x0000000F)
+ #define DDRDATACH0_CR_RXOFFSETVDQ_Lane1_OFF ( 4)
+ #define DDRDATACH0_CR_RXOFFSETVDQ_Lane1_WID ( 4)
+ #define DDRDATACH0_CR_RXOFFSETVDQ_Lane1_MSK (0x000000F0)
+ #define DDRDATACH0_CR_RXOFFSETVDQ_Lane1_MAX (0x0000000F)
+ #define DDRDATACH0_CR_RXOFFSETVDQ_Lane2_OFF ( 8)
+ #define DDRDATACH0_CR_RXOFFSETVDQ_Lane2_WID ( 4)
+ #define DDRDATACH0_CR_RXOFFSETVDQ_Lane2_MSK (0x00000F00)
+ #define DDRDATACH0_CR_RXOFFSETVDQ_Lane2_MAX (0x0000000F)
+ #define DDRDATACH0_CR_RXOFFSETVDQ_Lane3_OFF (12)
+ #define DDRDATACH0_CR_RXOFFSETVDQ_Lane3_WID ( 4)
+ #define DDRDATACH0_CR_RXOFFSETVDQ_Lane3_MSK (0x0000F000)
+ #define DDRDATACH0_CR_RXOFFSETVDQ_Lane3_MAX (0x0000000F)
+ #define DDRDATACH0_CR_RXOFFSETVDQ_Lane4_OFF (16)
+ #define DDRDATACH0_CR_RXOFFSETVDQ_Lane4_WID ( 4)
+ #define DDRDATACH0_CR_RXOFFSETVDQ_Lane4_MSK (0x000F0000)
+ #define DDRDATACH0_CR_RXOFFSETVDQ_Lane4_MAX (0x0000000F)
+ #define DDRDATACH0_CR_RXOFFSETVDQ_Lane5_OFF (20)
+ #define DDRDATACH0_CR_RXOFFSETVDQ_Lane5_WID ( 4)
+ #define DDRDATACH0_CR_RXOFFSETVDQ_Lane5_MSK (0x00F00000)
+ #define DDRDATACH0_CR_RXOFFSETVDQ_Lane5_MAX (0x0000000F)
+ #define DDRDATACH0_CR_RXOFFSETVDQ_Lane6_OFF (24)
+ #define DDRDATACH0_CR_RXOFFSETVDQ_Lane6_WID ( 4)
+ #define DDRDATACH0_CR_RXOFFSETVDQ_Lane6_MSK (0x0F000000)
+ #define DDRDATACH0_CR_RXOFFSETVDQ_Lane6_MAX (0x0000000F)
+ #define DDRDATACH0_CR_RXOFFSETVDQ_Lane7_OFF (28)
+ #define DDRDATACH0_CR_RXOFFSETVDQ_Lane7_WID ( 4)
+ #define DDRDATACH0_CR_RXOFFSETVDQ_Lane7_MSK (0xF0000000)
+ #define DDRDATACH0_CR_RXOFFSETVDQ_Lane7_MAX (0x0000000F)
+
+#define DDRDATACH0_CR_DDRDATARESERVED_REG (0x00003050)
+ #define DDRDATACH0_CR_DDRDATARESERVED_Spare_OFF ( 0)
+ #define DDRDATACH0_CR_DDRDATARESERVED_Spare_WID (32)
+ #define DDRDATACH0_CR_DDRDATARESERVED_Spare_MSK (0xFFFFFFFF)
+ #define DDRDATACH0_CR_DDRDATARESERVED_Spare_MAX (0xFFFFFFFF)
+
+#define DDRDATACH0_CR_DATATRAINFEEDBACK_REG (0x00003054)
+ #define DDRDATACH0_CR_DATATRAINFEEDBACK_DataTrainFeedback_OFF ( 0)
+ #define DDRDATACH0_CR_DATATRAINFEEDBACK_DataTrainFeedback_WID ( 9)
+ #define DDRDATACH0_CR_DATATRAINFEEDBACK_DataTrainFeedback_MSK (0x000001FF)
+ #define DDRDATACH0_CR_DATATRAINFEEDBACK_DataTrainFeedback_MAX (0x000001FF)
+ #define DDRDATACH0_CR_DATATRAINFEEDBACK_Spare_OFF ( 9)
+ #define DDRDATACH0_CR_DATATRAINFEEDBACK_Spare_WID (23)
+ #define DDRDATACH0_CR_DATATRAINFEEDBACK_Spare_MSK (0xFFFFFE00)
+ #define DDRDATACH0_CR_DATATRAINFEEDBACK_Spare_MAX (0x007FFFFF)
+
+#define DDRDATACH0_CR_DLLPITESTANDADC_REG (0x00003058)
+ #define DDRDATACH0_CR_DLLPITESTANDADC_RunTest_OFF ( 0)
+ #define DDRDATACH0_CR_DLLPITESTANDADC_RunTest_WID ( 1)
+ #define DDRDATACH0_CR_DLLPITESTANDADC_RunTest_MSK (0x00000001)
+ #define DDRDATACH0_CR_DLLPITESTANDADC_RunTest_MAX (0x00000001)
+ #define DDRDATACH0_CR_DLLPITESTANDADC_RunTest_DEF (0x00000000)
+ #define DDRDATACH0_CR_DLLPITESTANDADC_Load_OFF ( 1)
+ #define DDRDATACH0_CR_DLLPITESTANDADC_Load_WID ( 1)
+ #define DDRDATACH0_CR_DLLPITESTANDADC_Load_MSK (0x00000002)
+ #define DDRDATACH0_CR_DLLPITESTANDADC_Load_MAX (0x00000001)
+ #define DDRDATACH0_CR_DLLPITESTANDADC_Load_DEF (0x00000000)
+ #define DDRDATACH0_CR_DLLPITESTANDADC_ModeHVM_OFF ( 2)
+ #define DDRDATACH0_CR_DLLPITESTANDADC_ModeHVM_WID ( 1)
+ #define DDRDATACH0_CR_DLLPITESTANDADC_ModeHVM_MSK (0x00000004)
+ #define DDRDATACH0_CR_DLLPITESTANDADC_ModeHVM_MAX (0x00000001)
+ #define DDRDATACH0_CR_DLLPITESTANDADC_ModeHVM_DEF (0x00000000)
+ #define DDRDATACH0_CR_DLLPITESTANDADC_ModeDV_OFF ( 3)
+ #define DDRDATACH0_CR_DLLPITESTANDADC_ModeDV_WID ( 1)
+ #define DDRDATACH0_CR_DLLPITESTANDADC_ModeDV_MSK (0x00000008)
+ #define DDRDATACH0_CR_DLLPITESTANDADC_ModeDV_MAX (0x00000001)
+ #define DDRDATACH0_CR_DLLPITESTANDADC_ModeDV_DEF (0x00000000)
+ #define DDRDATACH0_CR_DLLPITESTANDADC_ModeADC_OFF ( 4)
+ #define DDRDATACH0_CR_DLLPITESTANDADC_ModeADC_WID ( 1)
+ #define DDRDATACH0_CR_DLLPITESTANDADC_ModeADC_MSK (0x00000010)
+ #define DDRDATACH0_CR_DLLPITESTANDADC_ModeADC_MAX (0x00000001)
+ #define DDRDATACH0_CR_DLLPITESTANDADC_ModeADC_DEF (0x00000000)
+ #define DDRDATACH0_CR_DLLPITESTANDADC_LoadCount_OFF ( 5)
+ #define DDRDATACH0_CR_DLLPITESTANDADC_LoadCount_WID (10)
+ #define DDRDATACH0_CR_DLLPITESTANDADC_LoadCount_MSK (0x00007FE0)
+ #define DDRDATACH0_CR_DLLPITESTANDADC_LoadCount_MAX (0x000003FF)
+ #define DDRDATACH0_CR_DLLPITESTANDADC_CountStatus_OFF (15)
+ #define DDRDATACH0_CR_DLLPITESTANDADC_CountStatus_WID (10)
+ #define DDRDATACH0_CR_DLLPITESTANDADC_CountStatus_MSK (0x01FF8000)
+ #define DDRDATACH0_CR_DLLPITESTANDADC_CountStatus_MAX (0x000003FF)
+ #define DDRDATACH0_CR_DLLPITESTANDADC_CountStatus_DEF (0x00000000)
+ #define DDRDATACH0_CR_DLLPITESTANDADC_Spare_OFF (25)
+ #define DDRDATACH0_CR_DLLPITESTANDADC_Spare_WID ( 7)
+ #define DDRDATACH0_CR_DLLPITESTANDADC_Spare_MSK (0xFE000000)
+ #define DDRDATACH0_CR_DLLPITESTANDADC_Spare_MAX (0x0000007F)
+
+#define DDRDATACH0_CR_DDRCRDATAOFFSETCOMP_REG (0x0000305C)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_OFF ( 0)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_WID ( 6)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_MSK (0x0000003F)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_MAX (0x0000003F)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_OFF ( 6)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_WID ( 6)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_MSK (0x00000FC0)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_MAX (0x0000003F)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_OFF (12)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_WID ( 5)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_MSK (0x0001F000)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_MAX (0x0000001F)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_OFF (17)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_WID ( 5)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_MSK (0x003E0000)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_MAX (0x0000001F)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_OFF (22)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_WID ( 5)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_MSK (0x07C00000)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_MAX (0x0000001F)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_OFF (27)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_WID ( 5)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_MSK (0xF8000000)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_MAX (0x0000001F)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_DEF (0x00000000)
+
+#define DDRDATACH0_CR_DDRCRDATACONTROL1_REG (0x00003060)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_RefPi_OFF ( 0)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_RefPi_WID ( 4)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_RefPi_MSK (0x0000000F)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_RefPi_MAX (0x0000000F)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_RefPi_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_DllMask_OFF ( 4)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_DllMask_WID ( 2)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_DllMask_MSK (0x00000030)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_DllMask_MAX (0x00000003)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_DllMask_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_DllWeakLock_OFF ( 6)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_DllWeakLock_WID ( 1)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_DllWeakLock_MSK (0x00000040)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_DllWeakLock_MAX (0x00000001)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_DllWeakLock_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_OFF ( 7)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_WID ( 3)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_MSK (0x00000380)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_MAX (0x00000007)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_RxBiasCtl_OFF (10)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_RxBiasCtl_WID ( 3)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_RxBiasCtl_MSK (0x00001C00)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_RxBiasCtl_MAX (0x00000007)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_RxBiasCtl_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_OdtDelay_OFF (13)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_OdtDelay_WID ( 4)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_OdtDelay_MSK (0x0001E000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_OdtDelay_MAX (0x0000000F)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_OdtDelay_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_OdtDuration_OFF (17)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_OdtDuration_WID ( 3)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_OdtDuration_MSK (0x000E0000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_OdtDuration_MAX (0x00000007)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_OdtDuration_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_OFF (20)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_WID ( 4)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_MSK (0x00F00000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_MAX (0x0000000F)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_OFF (24)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_WID ( 3)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_MSK (0x07000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_MAX (0x00000007)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_OFF (27)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_WID ( 3)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_MSK (0x38000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_MAX (0x00000007)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_OFF (30)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_WID ( 1)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_MSK (0x40000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_MAX (0x00000001)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_Rsvd1_OFF (31)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_Rsvd1_WID ( 1)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_Rsvd1_MSK (0x80000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_Rsvd1_MAX (0x00000001)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL1_Rsvd1_DEF (0x00000000)
+
+#define DDRDATACH0_CR_DDRCRDATACONTROL2_REG (0x00003064)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_OFF ( 0)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_WID ( 5)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_MSK (0x0000001F)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_MAX (0x0000001F)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL2_ForceBiasOn_OFF ( 5)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL2_ForceBiasOn_WID ( 1)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL2_ForceBiasOn_MSK (0x00000020)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL2_ForceBiasOn_MAX (0x00000001)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL2_ForceBiasOn_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL2_ForceRxOn_OFF ( 6)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL2_ForceRxOn_WID ( 1)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL2_ForceRxOn_MSK (0x00000040)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL2_ForceRxOn_MAX (0x00000001)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL2_ForceRxOn_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL2_LeakerComp_OFF ( 7)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL2_LeakerComp_WID ( 2)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL2_LeakerComp_MSK (0x00000180)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL2_LeakerComp_MAX (0x00000003)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL2_LeakerComp_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_OFF ( 9)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_WID ( 4)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_MSK (0x00001E00)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_MAX (0x0000000F)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_DEF (0x00000008)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL2_RxClkStgNum_OFF (13)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL2_RxClkStgNum_WID ( 5)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL2_RxClkStgNum_MSK (0x0003E000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL2_RxClkStgNum_MAX (0x0000001F)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL2_RxClkStgNum_DEF (0x00000011)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL2_WlLongDelEn_OFF (18)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL2_WlLongDelEn_WID ( 1)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL2_WlLongDelEn_MSK (0x00040000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL2_WlLongDelEn_MAX (0x00000001)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL2_WlLongDelEn_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL2_Spare_OFF (19)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL2_Spare_WID (13)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL2_Spare_MSK (0xFFF80000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL2_Spare_MAX (0x00001FFF)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL2_Spare_DEF (0x00000000)
+
+#define DDRDATACH0_CR_DDRCRVSSHIORVREFCONTROL_REG (0x0000306C)
+ #define DDRDATACH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_OFF ( 0)
+ #define DDRDATACH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_WID (24)
+ #define DDRDATACH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_MSK (0x00FFFFFF)
+ #define DDRDATACH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_MAX (0x00FFFFFF)
+ #define DDRDATACH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_OFF (24)
+ #define DDRDATACH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_WID ( 8)
+ #define DDRDATACH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_MSK (0xFF000000)
+ #define DDRDATACH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_MAX (0x000000FF)
+ #define DDRDATACH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_DEF (0x00000000)
+
+#define DDRDATACH0_CR_DDRCRDATAOFFSETTRAIN_REG (0x00003070)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_OFF ( 0)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_WID ( 6)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_MSK (0x0000003F)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_MAX (0x0000003F)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_OFF ( 6)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_WID ( 6)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_MSK (0x00000FC0)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_MAX (0x0000003F)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_OFF (12)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_WID ( 6)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_MSK (0x0003F000)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_MAX (0x0000003F)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_OFF (18)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_WID ( 6)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_MSK (0x00FC0000)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_MAX (0x0000003F)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_OFF (24)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_WID ( 7)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_MSK (0x7F000000)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_MAX (0x0000007F)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETTRAIN_Spare_OFF (31)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETTRAIN_Spare_WID ( 1)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETTRAIN_Spare_MSK (0x80000000)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETTRAIN_Spare_MAX (0x00000001)
+ #define DDRDATACH0_CR_DDRCRDATAOFFSETTRAIN_Spare_DEF (0x00000000)
+
+#define DDRDATACH0_CR_DDRCRDATACONTROL0_REG (0x00003074)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_RxTrainingMode_OFF ( 0)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_RxTrainingMode_WID ( 1)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_RxTrainingMode_MSK (0x00000001)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_RxTrainingMode_MAX (0x00000001)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_RxTrainingMode_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_WLTrainingMode_OFF ( 1)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_WLTrainingMode_WID ( 1)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_WLTrainingMode_MSK (0x00000002)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_WLTrainingMode_MAX (0x00000001)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_WLTrainingMode_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_RLTrainingMode_OFF ( 2)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_RLTrainingMode_WID ( 1)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_RLTrainingMode_MSK (0x00000004)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_RLTrainingMode_MAX (0x00000001)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_RLTrainingMode_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_OFF ( 3)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_WID ( 1)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_MSK (0x00000008)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_MAX (0x00000001)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_TxOn_OFF ( 4)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_TxOn_WID ( 1)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_TxOn_MSK (0x00000010)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_TxOn_MAX (0x00000001)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_TxOn_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_RfOn_OFF ( 5)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_RfOn_WID ( 1)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_RfOn_MSK (0x00000020)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_RfOn_MAX (0x00000001)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_RfOn_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_RxPiOn_OFF ( 6)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_RxPiOn_WID ( 1)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_RxPiOn_MSK (0x00000040)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_RxPiOn_MAX (0x00000001)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_RxPiOn_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_TxPiOn_OFF ( 7)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_TxPiOn_WID ( 1)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_TxPiOn_MSK (0x00000080)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_TxPiOn_MAX (0x00000001)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_TxPiOn_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_InternalClocksOn_OFF ( 8)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_InternalClocksOn_WID ( 1)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_InternalClocksOn_MSK (0x00000100)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_InternalClocksOn_MAX (0x00000001)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_InternalClocksOn_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_OFF ( 9)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_WID ( 1)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_MSK (0x00000200)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_MAX (0x00000001)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_TxDisable_OFF (10)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_TxDisable_WID ( 1)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_TxDisable_MSK (0x00000400)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_TxDisable_MAX (0x00000001)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_TxDisable_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_RxDisable_OFF (11)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_RxDisable_WID ( 1)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_RxDisable_MSK (0x00000800)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_RxDisable_MAX (0x00000001)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_RxDisable_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_TxLong_OFF (12)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_TxLong_WID ( 1)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_TxLong_MSK (0x00001000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_TxLong_MAX (0x00000001)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_TxLong_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_RxDqsCtle_OFF (13)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_RxDqsCtle_WID ( 2)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_RxDqsCtle_MSK (0x00006000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_RxDqsCtle_MAX (0x00000003)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_RxDqsCtle_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_RxReadPointer_OFF (15)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_RxReadPointer_WID ( 3)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_RxReadPointer_MSK (0x00038000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_RxReadPointer_MAX (0x00000007)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_RxReadPointer_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_OFF (18)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_WID ( 1)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_MSK (0x00040000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_MAX (0x00000001)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_DataVccddqHi_OFF (19)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_DataVccddqHi_WID ( 1)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_DataVccddqHi_MSK (0x00080000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_DataVccddqHi_MAX (0x00000001)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_DataVccddqHi_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_ReadRFRd_OFF (20)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_ReadRFRd_WID ( 1)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_ReadRFRd_MSK (0x00100000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_ReadRFRd_MAX (0x00000001)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_ReadRFRd_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_ReadRFWr_OFF (21)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_ReadRFWr_WID ( 1)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_ReadRFWr_MSK (0x00200000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_ReadRFWr_MAX (0x00000001)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_ReadRFWr_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_ReadRFRank_OFF (22)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_ReadRFRank_WID ( 2)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_ReadRFRank_MSK (0x00C00000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_ReadRFRank_MAX (0x00000003)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_ReadRFRank_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_ForceOdtOn_OFF (24)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_ForceOdtOn_WID ( 1)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_ForceOdtOn_MSK (0x01000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_ForceOdtOn_MAX (0x00000001)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_ForceOdtOn_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_OdtSampOff_OFF (25)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_OdtSampOff_WID ( 1)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_OdtSampOff_MSK (0x02000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_OdtSampOff_MAX (0x00000001)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_OdtSampOff_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_OFF (26)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_WID ( 1)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_MSK (0x04000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_MAX (0x00000001)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_OFF (27)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_WID ( 1)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_MSK (0x08000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_MAX (0x00000001)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_OFF (28)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_WID ( 1)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_MSK (0x10000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_MAX (0x00000001)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_EnReadPreamble_OFF (29)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_EnReadPreamble_WID ( 1)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_EnReadPreamble_MSK (0x20000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_EnReadPreamble_MAX (0x00000001)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_EnReadPreamble_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_OFF (30)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_WID ( 1)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_MSK (0x40000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_MAX (0x00000001)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_OFF (31)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_WID ( 1)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_MSK (0x80000000)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_MAX (0x00000001)
+ #define DDRDATACH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_DEF (0x00000000)
+
+#define DDRDATACH0_CR_DDRCRVREFADJUST1_REG (0x00003078)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_CAVrefCtl_OFF ( 0)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_CAVrefCtl_WID ( 7)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_CAVrefCtl_MSK (0x0000007F)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_CAVrefCtl_MAX (0x0000007F)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_CAVrefCtl_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_OFF ( 7)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_WID ( 7)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_MSK (0x00003F80)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_MAX (0x0000007F)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_OFF (14)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_WID ( 7)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_MSK (0x001FC000)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_MAX (0x0000007F)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_OFF (21)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_WID ( 1)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_MSK (0x00200000)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_MAX (0x00000001)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_OFF (22)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_WID ( 1)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_MSK (0x00400000)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_MAX (0x00000001)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_OFF (23)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_WID ( 1)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_MSK (0x00800000)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_MAX (0x00000001)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_OFF (24)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_WID ( 2)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_MSK (0x03000000)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_MAX (0x00000003)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_OFF (26)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_WID ( 1)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_MSK (0x04000000)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_MAX (0x00000001)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_Rsvd_OFF (27)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_Rsvd_WID ( 2)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_Rsvd_MSK (0x18000000)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_Rsvd_MAX (0x00000003)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_Rsvd_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_caSlowBW_OFF (29)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_caSlowBW_WID ( 1)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_caSlowBW_MSK (0x20000000)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_caSlowBW_MAX (0x00000001)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_caSlowBW_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_ch0SlowBW_OFF (30)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_ch0SlowBW_WID ( 1)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_ch0SlowBW_MSK (0x40000000)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_ch0SlowBW_MAX (0x00000001)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_ch0SlowBW_DEF (0x00000000)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_ch1SlowBW_OFF (31)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_ch1SlowBW_WID ( 1)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_ch1SlowBW_MSK (0x80000000)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_ch1SlowBW_MAX (0x00000001)
+ #define DDRDATACH0_CR_DDRCRVREFADJUST1_ch1SlowBW_DEF (0x00000000)
+
+#define DDRDATACH1_CR_RXTRAINRANK0_REG (0x00003100)
+ #define DDRDATACH1_CR_RXTRAINRANK0_RxRcvEnPi_OFF ( 0)
+ #define DDRDATACH1_CR_RXTRAINRANK0_RxRcvEnPi_WID ( 9)
+ #define DDRDATACH1_CR_RXTRAINRANK0_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATACH1_CR_RXTRAINRANK0_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATACH1_CR_RXTRAINRANK0_RxDqsPPi_OFF ( 9)
+ #define DDRDATACH1_CR_RXTRAINRANK0_RxDqsPPi_WID ( 6)
+ #define DDRDATACH1_CR_RXTRAINRANK0_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATACH1_CR_RXTRAINRANK0_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATACH1_CR_RXTRAINRANK0_RxEq_OFF (15)
+ #define DDRDATACH1_CR_RXTRAINRANK0_RxEq_WID ( 5)
+ #define DDRDATACH1_CR_RXTRAINRANK0_RxEq_MSK (0x000F8000)
+ #define DDRDATACH1_CR_RXTRAINRANK0_RxEq_MAX (0x0000001F)
+ #define DDRDATACH1_CR_RXTRAINRANK0_RxDqsNPi_OFF (20)
+ #define DDRDATACH1_CR_RXTRAINRANK0_RxDqsNPi_WID ( 6)
+ #define DDRDATACH1_CR_RXTRAINRANK0_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATACH1_CR_RXTRAINRANK0_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATACH1_CR_RXTRAINRANK0_RxVref_OFF (26)
+ #define DDRDATACH1_CR_RXTRAINRANK0_RxVref_WID ( 6)
+ #define DDRDATACH1_CR_RXTRAINRANK0_RxVref_MSK (0xFC000000)
+ #define DDRDATACH1_CR_RXTRAINRANK0_RxVref_MAX (0x0000003F)
+
+#define DDRDATACH1_CR_RXTRAINRANK1_REG (0x00003104)
+ #define DDRDATACH1_CR_RXTRAINRANK1_RxRcvEnPi_OFF ( 0)
+ #define DDRDATACH1_CR_RXTRAINRANK1_RxRcvEnPi_WID ( 9)
+ #define DDRDATACH1_CR_RXTRAINRANK1_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATACH1_CR_RXTRAINRANK1_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATACH1_CR_RXTRAINRANK1_RxDqsPPi_OFF ( 9)
+ #define DDRDATACH1_CR_RXTRAINRANK1_RxDqsPPi_WID ( 6)
+ #define DDRDATACH1_CR_RXTRAINRANK1_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATACH1_CR_RXTRAINRANK1_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATACH1_CR_RXTRAINRANK1_RxEq_OFF (15)
+ #define DDRDATACH1_CR_RXTRAINRANK1_RxEq_WID ( 5)
+ #define DDRDATACH1_CR_RXTRAINRANK1_RxEq_MSK (0x000F8000)
+ #define DDRDATACH1_CR_RXTRAINRANK1_RxEq_MAX (0x0000001F)
+ #define DDRDATACH1_CR_RXTRAINRANK1_RxDqsNPi_OFF (20)
+ #define DDRDATACH1_CR_RXTRAINRANK1_RxDqsNPi_WID ( 6)
+ #define DDRDATACH1_CR_RXTRAINRANK1_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATACH1_CR_RXTRAINRANK1_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATACH1_CR_RXTRAINRANK1_RxVref_OFF (26)
+ #define DDRDATACH1_CR_RXTRAINRANK1_RxVref_WID ( 6)
+ #define DDRDATACH1_CR_RXTRAINRANK1_RxVref_MSK (0xFC000000)
+ #define DDRDATACH1_CR_RXTRAINRANK1_RxVref_MAX (0x0000003F)
+
+#define DDRDATACH1_CR_RXTRAINRANK2_REG (0x00003108)
+ #define DDRDATACH1_CR_RXTRAINRANK2_RxRcvEnPi_OFF ( 0)
+ #define DDRDATACH1_CR_RXTRAINRANK2_RxRcvEnPi_WID ( 9)
+ #define DDRDATACH1_CR_RXTRAINRANK2_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATACH1_CR_RXTRAINRANK2_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATACH1_CR_RXTRAINRANK2_RxDqsPPi_OFF ( 9)
+ #define DDRDATACH1_CR_RXTRAINRANK2_RxDqsPPi_WID ( 6)
+ #define DDRDATACH1_CR_RXTRAINRANK2_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATACH1_CR_RXTRAINRANK2_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATACH1_CR_RXTRAINRANK2_RxEq_OFF (15)
+ #define DDRDATACH1_CR_RXTRAINRANK2_RxEq_WID ( 5)
+ #define DDRDATACH1_CR_RXTRAINRANK2_RxEq_MSK (0x000F8000)
+ #define DDRDATACH1_CR_RXTRAINRANK2_RxEq_MAX (0x0000001F)
+ #define DDRDATACH1_CR_RXTRAINRANK2_RxDqsNPi_OFF (20)
+ #define DDRDATACH1_CR_RXTRAINRANK2_RxDqsNPi_WID ( 6)
+ #define DDRDATACH1_CR_RXTRAINRANK2_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATACH1_CR_RXTRAINRANK2_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATACH1_CR_RXTRAINRANK2_RxVref_OFF (26)
+ #define DDRDATACH1_CR_RXTRAINRANK2_RxVref_WID ( 6)
+ #define DDRDATACH1_CR_RXTRAINRANK2_RxVref_MSK (0xFC000000)
+ #define DDRDATACH1_CR_RXTRAINRANK2_RxVref_MAX (0x0000003F)
+
+#define DDRDATACH1_CR_RXTRAINRANK3_REG (0x0000310C)
+ #define DDRDATACH1_CR_RXTRAINRANK3_RxRcvEnPi_OFF ( 0)
+ #define DDRDATACH1_CR_RXTRAINRANK3_RxRcvEnPi_WID ( 9)
+ #define DDRDATACH1_CR_RXTRAINRANK3_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATACH1_CR_RXTRAINRANK3_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATACH1_CR_RXTRAINRANK3_RxDqsPPi_OFF ( 9)
+ #define DDRDATACH1_CR_RXTRAINRANK3_RxDqsPPi_WID ( 6)
+ #define DDRDATACH1_CR_RXTRAINRANK3_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATACH1_CR_RXTRAINRANK3_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATACH1_CR_RXTRAINRANK3_RxEq_OFF (15)
+ #define DDRDATACH1_CR_RXTRAINRANK3_RxEq_WID ( 5)
+ #define DDRDATACH1_CR_RXTRAINRANK3_RxEq_MSK (0x000F8000)
+ #define DDRDATACH1_CR_RXTRAINRANK3_RxEq_MAX (0x0000001F)
+ #define DDRDATACH1_CR_RXTRAINRANK3_RxDqsNPi_OFF (20)
+ #define DDRDATACH1_CR_RXTRAINRANK3_RxDqsNPi_WID ( 6)
+ #define DDRDATACH1_CR_RXTRAINRANK3_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATACH1_CR_RXTRAINRANK3_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATACH1_CR_RXTRAINRANK3_RxVref_OFF (26)
+ #define DDRDATACH1_CR_RXTRAINRANK3_RxVref_WID ( 6)
+ #define DDRDATACH1_CR_RXTRAINRANK3_RxVref_MSK (0xFC000000)
+ #define DDRDATACH1_CR_RXTRAINRANK3_RxVref_MAX (0x0000003F)
+
+#define DDRDATACH1_CR_RXPERBITRANK0_REG (0x00003110)
+ #define DDRDATACH1_CR_RXPERBITRANK0_Lane0_OFF ( 0)
+ #define DDRDATACH1_CR_RXPERBITRANK0_Lane0_WID ( 4)
+ #define DDRDATACH1_CR_RXPERBITRANK0_Lane0_MSK (0x0000000F)
+ #define DDRDATACH1_CR_RXPERBITRANK0_Lane0_MAX (0x0000000F)
+ #define DDRDATACH1_CR_RXPERBITRANK0_Lane1_OFF ( 4)
+ #define DDRDATACH1_CR_RXPERBITRANK0_Lane1_WID ( 4)
+ #define DDRDATACH1_CR_RXPERBITRANK0_Lane1_MSK (0x000000F0)
+ #define DDRDATACH1_CR_RXPERBITRANK0_Lane1_MAX (0x0000000F)
+ #define DDRDATACH1_CR_RXPERBITRANK0_Lane2_OFF ( 8)
+ #define DDRDATACH1_CR_RXPERBITRANK0_Lane2_WID ( 4)
+ #define DDRDATACH1_CR_RXPERBITRANK0_Lane2_MSK (0x00000F00)
+ #define DDRDATACH1_CR_RXPERBITRANK0_Lane2_MAX (0x0000000F)
+ #define DDRDATACH1_CR_RXPERBITRANK0_Lane3_OFF (12)
+ #define DDRDATACH1_CR_RXPERBITRANK0_Lane3_WID ( 4)
+ #define DDRDATACH1_CR_RXPERBITRANK0_Lane3_MSK (0x0000F000)
+ #define DDRDATACH1_CR_RXPERBITRANK0_Lane3_MAX (0x0000000F)
+ #define DDRDATACH1_CR_RXPERBITRANK0_Lane4_OFF (16)
+ #define DDRDATACH1_CR_RXPERBITRANK0_Lane4_WID ( 4)
+ #define DDRDATACH1_CR_RXPERBITRANK0_Lane4_MSK (0x000F0000)
+ #define DDRDATACH1_CR_RXPERBITRANK0_Lane4_MAX (0x0000000F)
+ #define DDRDATACH1_CR_RXPERBITRANK0_Lane5_OFF (20)
+ #define DDRDATACH1_CR_RXPERBITRANK0_Lane5_WID ( 4)
+ #define DDRDATACH1_CR_RXPERBITRANK0_Lane5_MSK (0x00F00000)
+ #define DDRDATACH1_CR_RXPERBITRANK0_Lane5_MAX (0x0000000F)
+ #define DDRDATACH1_CR_RXPERBITRANK0_Lane6_OFF (24)
+ #define DDRDATACH1_CR_RXPERBITRANK0_Lane6_WID ( 4)
+ #define DDRDATACH1_CR_RXPERBITRANK0_Lane6_MSK (0x0F000000)
+ #define DDRDATACH1_CR_RXPERBITRANK0_Lane6_MAX (0x0000000F)
+ #define DDRDATACH1_CR_RXPERBITRANK0_Lane7_OFF (28)
+ #define DDRDATACH1_CR_RXPERBITRANK0_Lane7_WID ( 4)
+ #define DDRDATACH1_CR_RXPERBITRANK0_Lane7_MSK (0xF0000000)
+ #define DDRDATACH1_CR_RXPERBITRANK0_Lane7_MAX (0x0000000F)
+
+#define DDRDATACH1_CR_RXPERBITRANK1_REG (0x00003114)
+ #define DDRDATACH1_CR_RXPERBITRANK1_Lane0_OFF ( 0)
+ #define DDRDATACH1_CR_RXPERBITRANK1_Lane0_WID ( 4)
+ #define DDRDATACH1_CR_RXPERBITRANK1_Lane0_MSK (0x0000000F)
+ #define DDRDATACH1_CR_RXPERBITRANK1_Lane0_MAX (0x0000000F)
+ #define DDRDATACH1_CR_RXPERBITRANK1_Lane1_OFF ( 4)
+ #define DDRDATACH1_CR_RXPERBITRANK1_Lane1_WID ( 4)
+ #define DDRDATACH1_CR_RXPERBITRANK1_Lane1_MSK (0x000000F0)
+ #define DDRDATACH1_CR_RXPERBITRANK1_Lane1_MAX (0x0000000F)
+ #define DDRDATACH1_CR_RXPERBITRANK1_Lane2_OFF ( 8)
+ #define DDRDATACH1_CR_RXPERBITRANK1_Lane2_WID ( 4)
+ #define DDRDATACH1_CR_RXPERBITRANK1_Lane2_MSK (0x00000F00)
+ #define DDRDATACH1_CR_RXPERBITRANK1_Lane2_MAX (0x0000000F)
+ #define DDRDATACH1_CR_RXPERBITRANK1_Lane3_OFF (12)
+ #define DDRDATACH1_CR_RXPERBITRANK1_Lane3_WID ( 4)
+ #define DDRDATACH1_CR_RXPERBITRANK1_Lane3_MSK (0x0000F000)
+ #define DDRDATACH1_CR_RXPERBITRANK1_Lane3_MAX (0x0000000F)
+ #define DDRDATACH1_CR_RXPERBITRANK1_Lane4_OFF (16)
+ #define DDRDATACH1_CR_RXPERBITRANK1_Lane4_WID ( 4)
+ #define DDRDATACH1_CR_RXPERBITRANK1_Lane4_MSK (0x000F0000)
+ #define DDRDATACH1_CR_RXPERBITRANK1_Lane4_MAX (0x0000000F)
+ #define DDRDATACH1_CR_RXPERBITRANK1_Lane5_OFF (20)
+ #define DDRDATACH1_CR_RXPERBITRANK1_Lane5_WID ( 4)
+ #define DDRDATACH1_CR_RXPERBITRANK1_Lane5_MSK (0x00F00000)
+ #define DDRDATACH1_CR_RXPERBITRANK1_Lane5_MAX (0x0000000F)
+ #define DDRDATACH1_CR_RXPERBITRANK1_Lane6_OFF (24)
+ #define DDRDATACH1_CR_RXPERBITRANK1_Lane6_WID ( 4)
+ #define DDRDATACH1_CR_RXPERBITRANK1_Lane6_MSK (0x0F000000)
+ #define DDRDATACH1_CR_RXPERBITRANK1_Lane6_MAX (0x0000000F)
+ #define DDRDATACH1_CR_RXPERBITRANK1_Lane7_OFF (28)
+ #define DDRDATACH1_CR_RXPERBITRANK1_Lane7_WID ( 4)
+ #define DDRDATACH1_CR_RXPERBITRANK1_Lane7_MSK (0xF0000000)
+ #define DDRDATACH1_CR_RXPERBITRANK1_Lane7_MAX (0x0000000F)
+
+#define DDRDATACH1_CR_RXPERBITRANK2_REG (0x00003118)
+ #define DDRDATACH1_CR_RXPERBITRANK2_Lane0_OFF ( 0)
+ #define DDRDATACH1_CR_RXPERBITRANK2_Lane0_WID ( 4)
+ #define DDRDATACH1_CR_RXPERBITRANK2_Lane0_MSK (0x0000000F)
+ #define DDRDATACH1_CR_RXPERBITRANK2_Lane0_MAX (0x0000000F)
+ #define DDRDATACH1_CR_RXPERBITRANK2_Lane1_OFF ( 4)
+ #define DDRDATACH1_CR_RXPERBITRANK2_Lane1_WID ( 4)
+ #define DDRDATACH1_CR_RXPERBITRANK2_Lane1_MSK (0x000000F0)
+ #define DDRDATACH1_CR_RXPERBITRANK2_Lane1_MAX (0x0000000F)
+ #define DDRDATACH1_CR_RXPERBITRANK2_Lane2_OFF ( 8)
+ #define DDRDATACH1_CR_RXPERBITRANK2_Lane2_WID ( 4)
+ #define DDRDATACH1_CR_RXPERBITRANK2_Lane2_MSK (0x00000F00)
+ #define DDRDATACH1_CR_RXPERBITRANK2_Lane2_MAX (0x0000000F)
+ #define DDRDATACH1_CR_RXPERBITRANK2_Lane3_OFF (12)
+ #define DDRDATACH1_CR_RXPERBITRANK2_Lane3_WID ( 4)
+ #define DDRDATACH1_CR_RXPERBITRANK2_Lane3_MSK (0x0000F000)
+ #define DDRDATACH1_CR_RXPERBITRANK2_Lane3_MAX (0x0000000F)
+ #define DDRDATACH1_CR_RXPERBITRANK2_Lane4_OFF (16)
+ #define DDRDATACH1_CR_RXPERBITRANK2_Lane4_WID ( 4)
+ #define DDRDATACH1_CR_RXPERBITRANK2_Lane4_MSK (0x000F0000)
+ #define DDRDATACH1_CR_RXPERBITRANK2_Lane4_MAX (0x0000000F)
+ #define DDRDATACH1_CR_RXPERBITRANK2_Lane5_OFF (20)
+ #define DDRDATACH1_CR_RXPERBITRANK2_Lane5_WID ( 4)
+ #define DDRDATACH1_CR_RXPERBITRANK2_Lane5_MSK (0x00F00000)
+ #define DDRDATACH1_CR_RXPERBITRANK2_Lane5_MAX (0x0000000F)
+ #define DDRDATACH1_CR_RXPERBITRANK2_Lane6_OFF (24)
+ #define DDRDATACH1_CR_RXPERBITRANK2_Lane6_WID ( 4)
+ #define DDRDATACH1_CR_RXPERBITRANK2_Lane6_MSK (0x0F000000)
+ #define DDRDATACH1_CR_RXPERBITRANK2_Lane6_MAX (0x0000000F)
+ #define DDRDATACH1_CR_RXPERBITRANK2_Lane7_OFF (28)
+ #define DDRDATACH1_CR_RXPERBITRANK2_Lane7_WID ( 4)
+ #define DDRDATACH1_CR_RXPERBITRANK2_Lane7_MSK (0xF0000000)
+ #define DDRDATACH1_CR_RXPERBITRANK2_Lane7_MAX (0x0000000F)
+
+#define DDRDATACH1_CR_RXPERBITRANK3_REG (0x0000311C)
+ #define DDRDATACH1_CR_RXPERBITRANK3_Lane0_OFF ( 0)
+ #define DDRDATACH1_CR_RXPERBITRANK3_Lane0_WID ( 4)
+ #define DDRDATACH1_CR_RXPERBITRANK3_Lane0_MSK (0x0000000F)
+ #define DDRDATACH1_CR_RXPERBITRANK3_Lane0_MAX (0x0000000F)
+ #define DDRDATACH1_CR_RXPERBITRANK3_Lane1_OFF ( 4)
+ #define DDRDATACH1_CR_RXPERBITRANK3_Lane1_WID ( 4)
+ #define DDRDATACH1_CR_RXPERBITRANK3_Lane1_MSK (0x000000F0)
+ #define DDRDATACH1_CR_RXPERBITRANK3_Lane1_MAX (0x0000000F)
+ #define DDRDATACH1_CR_RXPERBITRANK3_Lane2_OFF ( 8)
+ #define DDRDATACH1_CR_RXPERBITRANK3_Lane2_WID ( 4)
+ #define DDRDATACH1_CR_RXPERBITRANK3_Lane2_MSK (0x00000F00)
+ #define DDRDATACH1_CR_RXPERBITRANK3_Lane2_MAX (0x0000000F)
+ #define DDRDATACH1_CR_RXPERBITRANK3_Lane3_OFF (12)
+ #define DDRDATACH1_CR_RXPERBITRANK3_Lane3_WID ( 4)
+ #define DDRDATACH1_CR_RXPERBITRANK3_Lane3_MSK (0x0000F000)
+ #define DDRDATACH1_CR_RXPERBITRANK3_Lane3_MAX (0x0000000F)
+ #define DDRDATACH1_CR_RXPERBITRANK3_Lane4_OFF (16)
+ #define DDRDATACH1_CR_RXPERBITRANK3_Lane4_WID ( 4)
+ #define DDRDATACH1_CR_RXPERBITRANK3_Lane4_MSK (0x000F0000)
+ #define DDRDATACH1_CR_RXPERBITRANK3_Lane4_MAX (0x0000000F)
+ #define DDRDATACH1_CR_RXPERBITRANK3_Lane5_OFF (20)
+ #define DDRDATACH1_CR_RXPERBITRANK3_Lane5_WID ( 4)
+ #define DDRDATACH1_CR_RXPERBITRANK3_Lane5_MSK (0x00F00000)
+ #define DDRDATACH1_CR_RXPERBITRANK3_Lane5_MAX (0x0000000F)
+ #define DDRDATACH1_CR_RXPERBITRANK3_Lane6_OFF (24)
+ #define DDRDATACH1_CR_RXPERBITRANK3_Lane6_WID ( 4)
+ #define DDRDATACH1_CR_RXPERBITRANK3_Lane6_MSK (0x0F000000)
+ #define DDRDATACH1_CR_RXPERBITRANK3_Lane6_MAX (0x0000000F)
+ #define DDRDATACH1_CR_RXPERBITRANK3_Lane7_OFF (28)
+ #define DDRDATACH1_CR_RXPERBITRANK3_Lane7_WID ( 4)
+ #define DDRDATACH1_CR_RXPERBITRANK3_Lane7_MSK (0xF0000000)
+ #define DDRDATACH1_CR_RXPERBITRANK3_Lane7_MAX (0x0000000F)
+
+#define DDRDATACH1_CR_TXTRAINRANK0_REG (0x00003120)
+ #define DDRDATACH1_CR_TXTRAINRANK0_TxDqDelay_OFF ( 0)
+ #define DDRDATACH1_CR_TXTRAINRANK0_TxDqDelay_WID ( 9)
+ #define DDRDATACH1_CR_TXTRAINRANK0_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATACH1_CR_TXTRAINRANK0_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATACH1_CR_TXTRAINRANK0_TxDqsDelay_OFF ( 9)
+ #define DDRDATACH1_CR_TXTRAINRANK0_TxDqsDelay_WID ( 9)
+ #define DDRDATACH1_CR_TXTRAINRANK0_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATACH1_CR_TXTRAINRANK0_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATACH1_CR_TXTRAINRANK0_Spare0_OFF (18)
+ #define DDRDATACH1_CR_TXTRAINRANK0_Spare0_WID ( 2)
+ #define DDRDATACH1_CR_TXTRAINRANK0_Spare0_MSK (0x000C0000)
+ #define DDRDATACH1_CR_TXTRAINRANK0_Spare0_MAX (0x00000003)
+ #define DDRDATACH1_CR_TXTRAINRANK0_TxEqualization_OFF (20)
+ #define DDRDATACH1_CR_TXTRAINRANK0_TxEqualization_WID ( 6)
+ #define DDRDATACH1_CR_TXTRAINRANK0_TxEqualization_MSK (0x03F00000)
+ #define DDRDATACH1_CR_TXTRAINRANK0_TxEqualization_MAX (0x0000003F)
+ #define DDRDATACH1_CR_TXTRAINRANK0_Spare1_OFF (26)
+ #define DDRDATACH1_CR_TXTRAINRANK0_Spare1_WID ( 6)
+ #define DDRDATACH1_CR_TXTRAINRANK0_Spare1_MSK (0xFC000000)
+ #define DDRDATACH1_CR_TXTRAINRANK0_Spare1_MAX (0x0000003F)
+
+#define DDRDATACH1_CR_TXTRAINRANK1_REG (0x00003124)
+ #define DDRDATACH1_CR_TXTRAINRANK1_TxDqDelay_OFF ( 0)
+ #define DDRDATACH1_CR_TXTRAINRANK1_TxDqDelay_WID ( 9)
+ #define DDRDATACH1_CR_TXTRAINRANK1_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATACH1_CR_TXTRAINRANK1_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATACH1_CR_TXTRAINRANK1_TxDqsDelay_OFF ( 9)
+ #define DDRDATACH1_CR_TXTRAINRANK1_TxDqsDelay_WID ( 9)
+ #define DDRDATACH1_CR_TXTRAINRANK1_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATACH1_CR_TXTRAINRANK1_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATACH1_CR_TXTRAINRANK1_Spare0_OFF (18)
+ #define DDRDATACH1_CR_TXTRAINRANK1_Spare0_WID ( 2)
+ #define DDRDATACH1_CR_TXTRAINRANK1_Spare0_MSK (0x000C0000)
+ #define DDRDATACH1_CR_TXTRAINRANK1_Spare0_MAX (0x00000003)
+ #define DDRDATACH1_CR_TXTRAINRANK1_TxEqualization_OFF (20)
+ #define DDRDATACH1_CR_TXTRAINRANK1_TxEqualization_WID ( 6)
+ #define DDRDATACH1_CR_TXTRAINRANK1_TxEqualization_MSK (0x03F00000)
+ #define DDRDATACH1_CR_TXTRAINRANK1_TxEqualization_MAX (0x0000003F)
+ #define DDRDATACH1_CR_TXTRAINRANK1_Spare1_OFF (26)
+ #define DDRDATACH1_CR_TXTRAINRANK1_Spare1_WID ( 6)
+ #define DDRDATACH1_CR_TXTRAINRANK1_Spare1_MSK (0xFC000000)
+ #define DDRDATACH1_CR_TXTRAINRANK1_Spare1_MAX (0x0000003F)
+
+#define DDRDATACH1_CR_TXTRAINRANK2_REG (0x00003128)
+ #define DDRDATACH1_CR_TXTRAINRANK2_TxDqDelay_OFF ( 0)
+ #define DDRDATACH1_CR_TXTRAINRANK2_TxDqDelay_WID ( 9)
+ #define DDRDATACH1_CR_TXTRAINRANK2_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATACH1_CR_TXTRAINRANK2_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATACH1_CR_TXTRAINRANK2_TxDqsDelay_OFF ( 9)
+ #define DDRDATACH1_CR_TXTRAINRANK2_TxDqsDelay_WID ( 9)
+ #define DDRDATACH1_CR_TXTRAINRANK2_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATACH1_CR_TXTRAINRANK2_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATACH1_CR_TXTRAINRANK2_Spare0_OFF (18)
+ #define DDRDATACH1_CR_TXTRAINRANK2_Spare0_WID ( 2)
+ #define DDRDATACH1_CR_TXTRAINRANK2_Spare0_MSK (0x000C0000)
+ #define DDRDATACH1_CR_TXTRAINRANK2_Spare0_MAX (0x00000003)
+ #define DDRDATACH1_CR_TXTRAINRANK2_TxEqualization_OFF (20)
+ #define DDRDATACH1_CR_TXTRAINRANK2_TxEqualization_WID ( 6)
+ #define DDRDATACH1_CR_TXTRAINRANK2_TxEqualization_MSK (0x03F00000)
+ #define DDRDATACH1_CR_TXTRAINRANK2_TxEqualization_MAX (0x0000003F)
+ #define DDRDATACH1_CR_TXTRAINRANK2_Spare1_OFF (26)
+ #define DDRDATACH1_CR_TXTRAINRANK2_Spare1_WID ( 6)
+ #define DDRDATACH1_CR_TXTRAINRANK2_Spare1_MSK (0xFC000000)
+ #define DDRDATACH1_CR_TXTRAINRANK2_Spare1_MAX (0x0000003F)
+
+#define DDRDATACH1_CR_TXTRAINRANK3_REG (0x0000312C)
+ #define DDRDATACH1_CR_TXTRAINRANK3_TxDqDelay_OFF ( 0)
+ #define DDRDATACH1_CR_TXTRAINRANK3_TxDqDelay_WID ( 9)
+ #define DDRDATACH1_CR_TXTRAINRANK3_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATACH1_CR_TXTRAINRANK3_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATACH1_CR_TXTRAINRANK3_TxDqsDelay_OFF ( 9)
+ #define DDRDATACH1_CR_TXTRAINRANK3_TxDqsDelay_WID ( 9)
+ #define DDRDATACH1_CR_TXTRAINRANK3_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATACH1_CR_TXTRAINRANK3_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATACH1_CR_TXTRAINRANK3_Spare0_OFF (18)
+ #define DDRDATACH1_CR_TXTRAINRANK3_Spare0_WID ( 2)
+ #define DDRDATACH1_CR_TXTRAINRANK3_Spare0_MSK (0x000C0000)
+ #define DDRDATACH1_CR_TXTRAINRANK3_Spare0_MAX (0x00000003)
+ #define DDRDATACH1_CR_TXTRAINRANK3_TxEqualization_OFF (20)
+ #define DDRDATACH1_CR_TXTRAINRANK3_TxEqualization_WID ( 6)
+ #define DDRDATACH1_CR_TXTRAINRANK3_TxEqualization_MSK (0x03F00000)
+ #define DDRDATACH1_CR_TXTRAINRANK3_TxEqualization_MAX (0x0000003F)
+ #define DDRDATACH1_CR_TXTRAINRANK3_Spare1_OFF (26)
+ #define DDRDATACH1_CR_TXTRAINRANK3_Spare1_WID ( 6)
+ #define DDRDATACH1_CR_TXTRAINRANK3_Spare1_MSK (0xFC000000)
+ #define DDRDATACH1_CR_TXTRAINRANK3_Spare1_MAX (0x0000003F)
+
+#define DDRDATACH1_CR_TXPERBITRANK0_REG (0x00003130)
+ #define DDRDATACH1_CR_TXPERBITRANK0_Lane0_OFF ( 0)
+ #define DDRDATACH1_CR_TXPERBITRANK0_Lane0_WID ( 4)
+ #define DDRDATACH1_CR_TXPERBITRANK0_Lane0_MSK (0x0000000F)
+ #define DDRDATACH1_CR_TXPERBITRANK0_Lane0_MAX (0x0000000F)
+ #define DDRDATACH1_CR_TXPERBITRANK0_Lane1_OFF ( 4)
+ #define DDRDATACH1_CR_TXPERBITRANK0_Lane1_WID ( 4)
+ #define DDRDATACH1_CR_TXPERBITRANK0_Lane1_MSK (0x000000F0)
+ #define DDRDATACH1_CR_TXPERBITRANK0_Lane1_MAX (0x0000000F)
+ #define DDRDATACH1_CR_TXPERBITRANK0_Lane2_OFF ( 8)
+ #define DDRDATACH1_CR_TXPERBITRANK0_Lane2_WID ( 4)
+ #define DDRDATACH1_CR_TXPERBITRANK0_Lane2_MSK (0x00000F00)
+ #define DDRDATACH1_CR_TXPERBITRANK0_Lane2_MAX (0x0000000F)
+ #define DDRDATACH1_CR_TXPERBITRANK0_Lane3_OFF (12)
+ #define DDRDATACH1_CR_TXPERBITRANK0_Lane3_WID ( 4)
+ #define DDRDATACH1_CR_TXPERBITRANK0_Lane3_MSK (0x0000F000)
+ #define DDRDATACH1_CR_TXPERBITRANK0_Lane3_MAX (0x0000000F)
+ #define DDRDATACH1_CR_TXPERBITRANK0_Lane4_OFF (16)
+ #define DDRDATACH1_CR_TXPERBITRANK0_Lane4_WID ( 4)
+ #define DDRDATACH1_CR_TXPERBITRANK0_Lane4_MSK (0x000F0000)
+ #define DDRDATACH1_CR_TXPERBITRANK0_Lane4_MAX (0x0000000F)
+ #define DDRDATACH1_CR_TXPERBITRANK0_Lane5_OFF (20)
+ #define DDRDATACH1_CR_TXPERBITRANK0_Lane5_WID ( 4)
+ #define DDRDATACH1_CR_TXPERBITRANK0_Lane5_MSK (0x00F00000)
+ #define DDRDATACH1_CR_TXPERBITRANK0_Lane5_MAX (0x0000000F)
+ #define DDRDATACH1_CR_TXPERBITRANK0_Lane6_OFF (24)
+ #define DDRDATACH1_CR_TXPERBITRANK0_Lane6_WID ( 4)
+ #define DDRDATACH1_CR_TXPERBITRANK0_Lane6_MSK (0x0F000000)
+ #define DDRDATACH1_CR_TXPERBITRANK0_Lane6_MAX (0x0000000F)
+ #define DDRDATACH1_CR_TXPERBITRANK0_Lane7_OFF (28)
+ #define DDRDATACH1_CR_TXPERBITRANK0_Lane7_WID ( 4)
+ #define DDRDATACH1_CR_TXPERBITRANK0_Lane7_MSK (0xF0000000)
+ #define DDRDATACH1_CR_TXPERBITRANK0_Lane7_MAX (0x0000000F)
+
+#define DDRDATACH1_CR_TXPERBITRANK1_REG (0x00003134)
+ #define DDRDATACH1_CR_TXPERBITRANK1_Lane0_OFF ( 0)
+ #define DDRDATACH1_CR_TXPERBITRANK1_Lane0_WID ( 4)
+ #define DDRDATACH1_CR_TXPERBITRANK1_Lane0_MSK (0x0000000F)
+ #define DDRDATACH1_CR_TXPERBITRANK1_Lane0_MAX (0x0000000F)
+ #define DDRDATACH1_CR_TXPERBITRANK1_Lane1_OFF ( 4)
+ #define DDRDATACH1_CR_TXPERBITRANK1_Lane1_WID ( 4)
+ #define DDRDATACH1_CR_TXPERBITRANK1_Lane1_MSK (0x000000F0)
+ #define DDRDATACH1_CR_TXPERBITRANK1_Lane1_MAX (0x0000000F)
+ #define DDRDATACH1_CR_TXPERBITRANK1_Lane2_OFF ( 8)
+ #define DDRDATACH1_CR_TXPERBITRANK1_Lane2_WID ( 4)
+ #define DDRDATACH1_CR_TXPERBITRANK1_Lane2_MSK (0x00000F00)
+ #define DDRDATACH1_CR_TXPERBITRANK1_Lane2_MAX (0x0000000F)
+ #define DDRDATACH1_CR_TXPERBITRANK1_Lane3_OFF (12)
+ #define DDRDATACH1_CR_TXPERBITRANK1_Lane3_WID ( 4)
+ #define DDRDATACH1_CR_TXPERBITRANK1_Lane3_MSK (0x0000F000)
+ #define DDRDATACH1_CR_TXPERBITRANK1_Lane3_MAX (0x0000000F)
+ #define DDRDATACH1_CR_TXPERBITRANK1_Lane4_OFF (16)
+ #define DDRDATACH1_CR_TXPERBITRANK1_Lane4_WID ( 4)
+ #define DDRDATACH1_CR_TXPERBITRANK1_Lane4_MSK (0x000F0000)
+ #define DDRDATACH1_CR_TXPERBITRANK1_Lane4_MAX (0x0000000F)
+ #define DDRDATACH1_CR_TXPERBITRANK1_Lane5_OFF (20)
+ #define DDRDATACH1_CR_TXPERBITRANK1_Lane5_WID ( 4)
+ #define DDRDATACH1_CR_TXPERBITRANK1_Lane5_MSK (0x00F00000)
+ #define DDRDATACH1_CR_TXPERBITRANK1_Lane5_MAX (0x0000000F)
+ #define DDRDATACH1_CR_TXPERBITRANK1_Lane6_OFF (24)
+ #define DDRDATACH1_CR_TXPERBITRANK1_Lane6_WID ( 4)
+ #define DDRDATACH1_CR_TXPERBITRANK1_Lane6_MSK (0x0F000000)
+ #define DDRDATACH1_CR_TXPERBITRANK1_Lane6_MAX (0x0000000F)
+ #define DDRDATACH1_CR_TXPERBITRANK1_Lane7_OFF (28)
+ #define DDRDATACH1_CR_TXPERBITRANK1_Lane7_WID ( 4)
+ #define DDRDATACH1_CR_TXPERBITRANK1_Lane7_MSK (0xF0000000)
+ #define DDRDATACH1_CR_TXPERBITRANK1_Lane7_MAX (0x0000000F)
+
+#define DDRDATACH1_CR_TXPERBITRANK2_REG (0x00003138)
+ #define DDRDATACH1_CR_TXPERBITRANK2_Lane0_OFF ( 0)
+ #define DDRDATACH1_CR_TXPERBITRANK2_Lane0_WID ( 4)
+ #define DDRDATACH1_CR_TXPERBITRANK2_Lane0_MSK (0x0000000F)
+ #define DDRDATACH1_CR_TXPERBITRANK2_Lane0_MAX (0x0000000F)
+ #define DDRDATACH1_CR_TXPERBITRANK2_Lane1_OFF ( 4)
+ #define DDRDATACH1_CR_TXPERBITRANK2_Lane1_WID ( 4)
+ #define DDRDATACH1_CR_TXPERBITRANK2_Lane1_MSK (0x000000F0)
+ #define DDRDATACH1_CR_TXPERBITRANK2_Lane1_MAX (0x0000000F)
+ #define DDRDATACH1_CR_TXPERBITRANK2_Lane2_OFF ( 8)
+ #define DDRDATACH1_CR_TXPERBITRANK2_Lane2_WID ( 4)
+ #define DDRDATACH1_CR_TXPERBITRANK2_Lane2_MSK (0x00000F00)
+ #define DDRDATACH1_CR_TXPERBITRANK2_Lane2_MAX (0x0000000F)
+ #define DDRDATACH1_CR_TXPERBITRANK2_Lane3_OFF (12)
+ #define DDRDATACH1_CR_TXPERBITRANK2_Lane3_WID ( 4)
+ #define DDRDATACH1_CR_TXPERBITRANK2_Lane3_MSK (0x0000F000)
+ #define DDRDATACH1_CR_TXPERBITRANK2_Lane3_MAX (0x0000000F)
+ #define DDRDATACH1_CR_TXPERBITRANK2_Lane4_OFF (16)
+ #define DDRDATACH1_CR_TXPERBITRANK2_Lane4_WID ( 4)
+ #define DDRDATACH1_CR_TXPERBITRANK2_Lane4_MSK (0x000F0000)
+ #define DDRDATACH1_CR_TXPERBITRANK2_Lane4_MAX (0x0000000F)
+ #define DDRDATACH1_CR_TXPERBITRANK2_Lane5_OFF (20)
+ #define DDRDATACH1_CR_TXPERBITRANK2_Lane5_WID ( 4)
+ #define DDRDATACH1_CR_TXPERBITRANK2_Lane5_MSK (0x00F00000)
+ #define DDRDATACH1_CR_TXPERBITRANK2_Lane5_MAX (0x0000000F)
+ #define DDRDATACH1_CR_TXPERBITRANK2_Lane6_OFF (24)
+ #define DDRDATACH1_CR_TXPERBITRANK2_Lane6_WID ( 4)
+ #define DDRDATACH1_CR_TXPERBITRANK2_Lane6_MSK (0x0F000000)
+ #define DDRDATACH1_CR_TXPERBITRANK2_Lane6_MAX (0x0000000F)
+ #define DDRDATACH1_CR_TXPERBITRANK2_Lane7_OFF (28)
+ #define DDRDATACH1_CR_TXPERBITRANK2_Lane7_WID ( 4)
+ #define DDRDATACH1_CR_TXPERBITRANK2_Lane7_MSK (0xF0000000)
+ #define DDRDATACH1_CR_TXPERBITRANK2_Lane7_MAX (0x0000000F)
+
+#define DDRDATACH1_CR_TXPERBITRANK3_REG (0x0000313C)
+ #define DDRDATACH1_CR_TXPERBITRANK3_Lane0_OFF ( 0)
+ #define DDRDATACH1_CR_TXPERBITRANK3_Lane0_WID ( 4)
+ #define DDRDATACH1_CR_TXPERBITRANK3_Lane0_MSK (0x0000000F)
+ #define DDRDATACH1_CR_TXPERBITRANK3_Lane0_MAX (0x0000000F)
+ #define DDRDATACH1_CR_TXPERBITRANK3_Lane1_OFF ( 4)
+ #define DDRDATACH1_CR_TXPERBITRANK3_Lane1_WID ( 4)
+ #define DDRDATACH1_CR_TXPERBITRANK3_Lane1_MSK (0x000000F0)
+ #define DDRDATACH1_CR_TXPERBITRANK3_Lane1_MAX (0x0000000F)
+ #define DDRDATACH1_CR_TXPERBITRANK3_Lane2_OFF ( 8)
+ #define DDRDATACH1_CR_TXPERBITRANK3_Lane2_WID ( 4)
+ #define DDRDATACH1_CR_TXPERBITRANK3_Lane2_MSK (0x00000F00)
+ #define DDRDATACH1_CR_TXPERBITRANK3_Lane2_MAX (0x0000000F)
+ #define DDRDATACH1_CR_TXPERBITRANK3_Lane3_OFF (12)
+ #define DDRDATACH1_CR_TXPERBITRANK3_Lane3_WID ( 4)
+ #define DDRDATACH1_CR_TXPERBITRANK3_Lane3_MSK (0x0000F000)
+ #define DDRDATACH1_CR_TXPERBITRANK3_Lane3_MAX (0x0000000F)
+ #define DDRDATACH1_CR_TXPERBITRANK3_Lane4_OFF (16)
+ #define DDRDATACH1_CR_TXPERBITRANK3_Lane4_WID ( 4)
+ #define DDRDATACH1_CR_TXPERBITRANK3_Lane4_MSK (0x000F0000)
+ #define DDRDATACH1_CR_TXPERBITRANK3_Lane4_MAX (0x0000000F)
+ #define DDRDATACH1_CR_TXPERBITRANK3_Lane5_OFF (20)
+ #define DDRDATACH1_CR_TXPERBITRANK3_Lane5_WID ( 4)
+ #define DDRDATACH1_CR_TXPERBITRANK3_Lane5_MSK (0x00F00000)
+ #define DDRDATACH1_CR_TXPERBITRANK3_Lane5_MAX (0x0000000F)
+ #define DDRDATACH1_CR_TXPERBITRANK3_Lane6_OFF (24)
+ #define DDRDATACH1_CR_TXPERBITRANK3_Lane6_WID ( 4)
+ #define DDRDATACH1_CR_TXPERBITRANK3_Lane6_MSK (0x0F000000)
+ #define DDRDATACH1_CR_TXPERBITRANK3_Lane6_MAX (0x0000000F)
+ #define DDRDATACH1_CR_TXPERBITRANK3_Lane7_OFF (28)
+ #define DDRDATACH1_CR_TXPERBITRANK3_Lane7_WID ( 4)
+ #define DDRDATACH1_CR_TXPERBITRANK3_Lane7_MSK (0xF0000000)
+ #define DDRDATACH1_CR_TXPERBITRANK3_Lane7_MAX (0x0000000F)
+
+#define DDRDATACH1_CR_RCOMPDATA0_REG (0x00003140)
+ #define DDRDATACH1_CR_RCOMPDATA0_RcompDrvUp_OFF ( 0)
+ #define DDRDATACH1_CR_RCOMPDATA0_RcompDrvUp_WID ( 6)
+ #define DDRDATACH1_CR_RCOMPDATA0_RcompDrvUp_MSK (0x0000003F)
+ #define DDRDATACH1_CR_RCOMPDATA0_RcompDrvUp_MAX (0x0000003F)
+ #define DDRDATACH1_CR_RCOMPDATA0_Spare0_OFF ( 6)
+ #define DDRDATACH1_CR_RCOMPDATA0_Spare0_WID ( 3)
+ #define DDRDATACH1_CR_RCOMPDATA0_Spare0_MSK (0x000001C0)
+ #define DDRDATACH1_CR_RCOMPDATA0_Spare0_MAX (0x00000007)
+ #define DDRDATACH1_CR_RCOMPDATA0_RcompDrvDown_OFF ( 9)
+ #define DDRDATACH1_CR_RCOMPDATA0_RcompDrvDown_WID ( 6)
+ #define DDRDATACH1_CR_RCOMPDATA0_RcompDrvDown_MSK (0x00007E00)
+ #define DDRDATACH1_CR_RCOMPDATA0_RcompDrvDown_MAX (0x0000003F)
+ #define DDRDATACH1_CR_RCOMPDATA0_VTComp_OFF (15)
+ #define DDRDATACH1_CR_RCOMPDATA0_VTComp_WID ( 5)
+ #define DDRDATACH1_CR_RCOMPDATA0_VTComp_MSK (0x000F8000)
+ #define DDRDATACH1_CR_RCOMPDATA0_VTComp_MAX (0x0000001F)
+ #define DDRDATACH1_CR_RCOMPDATA0_TcoComp_OFF (20)
+ #define DDRDATACH1_CR_RCOMPDATA0_TcoComp_WID ( 6)
+ #define DDRDATACH1_CR_RCOMPDATA0_TcoComp_MSK (0x03F00000)
+ #define DDRDATACH1_CR_RCOMPDATA0_TcoComp_MAX (0x0000003F)
+ #define DDRDATACH1_CR_RCOMPDATA0_SlewRateComp_OFF (26)
+ #define DDRDATACH1_CR_RCOMPDATA0_SlewRateComp_WID ( 5)
+ #define DDRDATACH1_CR_RCOMPDATA0_SlewRateComp_MSK (0x7C000000)
+ #define DDRDATACH1_CR_RCOMPDATA0_SlewRateComp_MAX (0x0000001F)
+ #define DDRDATACH1_CR_RCOMPDATA0_Spare2_OFF (31)
+ #define DDRDATACH1_CR_RCOMPDATA0_Spare2_WID ( 1)
+ #define DDRDATACH1_CR_RCOMPDATA0_Spare2_MSK (0x80000000)
+ #define DDRDATACH1_CR_RCOMPDATA0_Spare2_MAX (0x00000001)
+
+#define DDRDATACH1_CR_RCOMPDATA1_REG (0x00003144)
+ #define DDRDATACH1_CR_RCOMPDATA1_RcompOdtUp_OFF ( 0)
+ #define DDRDATACH1_CR_RCOMPDATA1_RcompOdtUp_WID ( 6)
+ #define DDRDATACH1_CR_RCOMPDATA1_RcompOdtUp_MSK (0x0000003F)
+ #define DDRDATACH1_CR_RCOMPDATA1_RcompOdtUp_MAX (0x0000003F)
+ #define DDRDATACH1_CR_RCOMPDATA1_Spare0_OFF ( 6)
+ #define DDRDATACH1_CR_RCOMPDATA1_Spare0_WID ( 3)
+ #define DDRDATACH1_CR_RCOMPDATA1_Spare0_MSK (0x000001C0)
+ #define DDRDATACH1_CR_RCOMPDATA1_Spare0_MAX (0x00000007)
+ #define DDRDATACH1_CR_RCOMPDATA1_RcompOdtDown_OFF ( 9)
+ #define DDRDATACH1_CR_RCOMPDATA1_RcompOdtDown_WID ( 6)
+ #define DDRDATACH1_CR_RCOMPDATA1_RcompOdtDown_MSK (0x00007E00)
+ #define DDRDATACH1_CR_RCOMPDATA1_RcompOdtDown_MAX (0x0000003F)
+ #define DDRDATACH1_CR_RCOMPDATA1_Spare1_OFF (15)
+ #define DDRDATACH1_CR_RCOMPDATA1_Spare1_WID ( 1)
+ #define DDRDATACH1_CR_RCOMPDATA1_Spare1_MSK (0x00008000)
+ #define DDRDATACH1_CR_RCOMPDATA1_Spare1_MAX (0x00000001)
+ #define DDRDATACH1_CR_RCOMPDATA1_PanicDrvDn_OFF (16)
+ #define DDRDATACH1_CR_RCOMPDATA1_PanicDrvDn_WID ( 6)
+ #define DDRDATACH1_CR_RCOMPDATA1_PanicDrvDn_MSK (0x003F0000)
+ #define DDRDATACH1_CR_RCOMPDATA1_PanicDrvDn_MAX (0x0000003F)
+ #define DDRDATACH1_CR_RCOMPDATA1_PanicDrvUp_OFF (22)
+ #define DDRDATACH1_CR_RCOMPDATA1_PanicDrvUp_WID ( 6)
+ #define DDRDATACH1_CR_RCOMPDATA1_PanicDrvUp_MSK (0x0FC00000)
+ #define DDRDATACH1_CR_RCOMPDATA1_PanicDrvUp_MAX (0x0000003F)
+ #define DDRDATACH1_CR_RCOMPDATA1_LevelShifterComp_OFF (28)
+ #define DDRDATACH1_CR_RCOMPDATA1_LevelShifterComp_WID ( 3)
+ #define DDRDATACH1_CR_RCOMPDATA1_LevelShifterComp_MSK (0x70000000)
+ #define DDRDATACH1_CR_RCOMPDATA1_LevelShifterComp_MAX (0x00000007)
+ #define DDRDATACH1_CR_RCOMPDATA1_Spare2_OFF (31)
+ #define DDRDATACH1_CR_RCOMPDATA1_Spare2_WID ( 1)
+ #define DDRDATACH1_CR_RCOMPDATA1_Spare2_MSK (0x80000000)
+ #define DDRDATACH1_CR_RCOMPDATA1_Spare2_MAX (0x00000001)
+
+#define DDRDATACH1_CR_TXXTALK_REG (0x00003148)
+ #define DDRDATACH1_CR_TXXTALK_Lane0_OFF ( 0)
+ #define DDRDATACH1_CR_TXXTALK_Lane0_WID ( 4)
+ #define DDRDATACH1_CR_TXXTALK_Lane0_MSK (0x0000000F)
+ #define DDRDATACH1_CR_TXXTALK_Lane0_MAX (0x0000000F)
+ #define DDRDATACH1_CR_TXXTALK_Lane1_OFF ( 4)
+ #define DDRDATACH1_CR_TXXTALK_Lane1_WID ( 4)
+ #define DDRDATACH1_CR_TXXTALK_Lane1_MSK (0x000000F0)
+ #define DDRDATACH1_CR_TXXTALK_Lane1_MAX (0x0000000F)
+ #define DDRDATACH1_CR_TXXTALK_Lane2_OFF ( 8)
+ #define DDRDATACH1_CR_TXXTALK_Lane2_WID ( 4)
+ #define DDRDATACH1_CR_TXXTALK_Lane2_MSK (0x00000F00)
+ #define DDRDATACH1_CR_TXXTALK_Lane2_MAX (0x0000000F)
+ #define DDRDATACH1_CR_TXXTALK_Lane3_OFF (12)
+ #define DDRDATACH1_CR_TXXTALK_Lane3_WID ( 4)
+ #define DDRDATACH1_CR_TXXTALK_Lane3_MSK (0x0000F000)
+ #define DDRDATACH1_CR_TXXTALK_Lane3_MAX (0x0000000F)
+ #define DDRDATACH1_CR_TXXTALK_Lane4_OFF (16)
+ #define DDRDATACH1_CR_TXXTALK_Lane4_WID ( 4)
+ #define DDRDATACH1_CR_TXXTALK_Lane4_MSK (0x000F0000)
+ #define DDRDATACH1_CR_TXXTALK_Lane4_MAX (0x0000000F)
+ #define DDRDATACH1_CR_TXXTALK_Lane5_OFF (20)
+ #define DDRDATACH1_CR_TXXTALK_Lane5_WID ( 4)
+ #define DDRDATACH1_CR_TXXTALK_Lane5_MSK (0x00F00000)
+ #define DDRDATACH1_CR_TXXTALK_Lane5_MAX (0x0000000F)
+ #define DDRDATACH1_CR_TXXTALK_Lane6_OFF (24)
+ #define DDRDATACH1_CR_TXXTALK_Lane6_WID ( 4)
+ #define DDRDATACH1_CR_TXXTALK_Lane6_MSK (0x0F000000)
+ #define DDRDATACH1_CR_TXXTALK_Lane6_MAX (0x0000000F)
+ #define DDRDATACH1_CR_TXXTALK_Lane7_OFF (28)
+ #define DDRDATACH1_CR_TXXTALK_Lane7_WID ( 4)
+ #define DDRDATACH1_CR_TXXTALK_Lane7_MSK (0xF0000000)
+ #define DDRDATACH1_CR_TXXTALK_Lane7_MAX (0x0000000F)
+
+#define DDRDATACH1_CR_RXOFFSETVDQ_REG (0x0000314C)
+ #define DDRDATACH1_CR_RXOFFSETVDQ_Lane0_OFF ( 0)
+ #define DDRDATACH1_CR_RXOFFSETVDQ_Lane0_WID ( 4)
+ #define DDRDATACH1_CR_RXOFFSETVDQ_Lane0_MSK (0x0000000F)
+ #define DDRDATACH1_CR_RXOFFSETVDQ_Lane0_MAX (0x0000000F)
+ #define DDRDATACH1_CR_RXOFFSETVDQ_Lane1_OFF ( 4)
+ #define DDRDATACH1_CR_RXOFFSETVDQ_Lane1_WID ( 4)
+ #define DDRDATACH1_CR_RXOFFSETVDQ_Lane1_MSK (0x000000F0)
+ #define DDRDATACH1_CR_RXOFFSETVDQ_Lane1_MAX (0x0000000F)
+ #define DDRDATACH1_CR_RXOFFSETVDQ_Lane2_OFF ( 8)
+ #define DDRDATACH1_CR_RXOFFSETVDQ_Lane2_WID ( 4)
+ #define DDRDATACH1_CR_RXOFFSETVDQ_Lane2_MSK (0x00000F00)
+ #define DDRDATACH1_CR_RXOFFSETVDQ_Lane2_MAX (0x0000000F)
+ #define DDRDATACH1_CR_RXOFFSETVDQ_Lane3_OFF (12)
+ #define DDRDATACH1_CR_RXOFFSETVDQ_Lane3_WID ( 4)
+ #define DDRDATACH1_CR_RXOFFSETVDQ_Lane3_MSK (0x0000F000)
+ #define DDRDATACH1_CR_RXOFFSETVDQ_Lane3_MAX (0x0000000F)
+ #define DDRDATACH1_CR_RXOFFSETVDQ_Lane4_OFF (16)
+ #define DDRDATACH1_CR_RXOFFSETVDQ_Lane4_WID ( 4)
+ #define DDRDATACH1_CR_RXOFFSETVDQ_Lane4_MSK (0x000F0000)
+ #define DDRDATACH1_CR_RXOFFSETVDQ_Lane4_MAX (0x0000000F)
+ #define DDRDATACH1_CR_RXOFFSETVDQ_Lane5_OFF (20)
+ #define DDRDATACH1_CR_RXOFFSETVDQ_Lane5_WID ( 4)
+ #define DDRDATACH1_CR_RXOFFSETVDQ_Lane5_MSK (0x00F00000)
+ #define DDRDATACH1_CR_RXOFFSETVDQ_Lane5_MAX (0x0000000F)
+ #define DDRDATACH1_CR_RXOFFSETVDQ_Lane6_OFF (24)
+ #define DDRDATACH1_CR_RXOFFSETVDQ_Lane6_WID ( 4)
+ #define DDRDATACH1_CR_RXOFFSETVDQ_Lane6_MSK (0x0F000000)
+ #define DDRDATACH1_CR_RXOFFSETVDQ_Lane6_MAX (0x0000000F)
+ #define DDRDATACH1_CR_RXOFFSETVDQ_Lane7_OFF (28)
+ #define DDRDATACH1_CR_RXOFFSETVDQ_Lane7_WID ( 4)
+ #define DDRDATACH1_CR_RXOFFSETVDQ_Lane7_MSK (0xF0000000)
+ #define DDRDATACH1_CR_RXOFFSETVDQ_Lane7_MAX (0x0000000F)
+
+#define DDRDATACH1_CR_DDRDATARESERVED_REG (0x00003150)
+ #define DDRDATACH1_CR_DDRDATARESERVED_Spare_OFF ( 0)
+ #define DDRDATACH1_CR_DDRDATARESERVED_Spare_WID (32)
+ #define DDRDATACH1_CR_DDRDATARESERVED_Spare_MSK (0xFFFFFFFF)
+ #define DDRDATACH1_CR_DDRDATARESERVED_Spare_MAX (0xFFFFFFFF)
+
+#define DDRDATACH1_CR_DATATRAINFEEDBACK_REG (0x00003154)
+ #define DDRDATACH1_CR_DATATRAINFEEDBACK_DataTrainFeedback_OFF ( 0)
+ #define DDRDATACH1_CR_DATATRAINFEEDBACK_DataTrainFeedback_WID ( 9)
+ #define DDRDATACH1_CR_DATATRAINFEEDBACK_DataTrainFeedback_MSK (0x000001FF)
+ #define DDRDATACH1_CR_DATATRAINFEEDBACK_DataTrainFeedback_MAX (0x000001FF)
+ #define DDRDATACH1_CR_DATATRAINFEEDBACK_Spare_OFF ( 9)
+ #define DDRDATACH1_CR_DATATRAINFEEDBACK_Spare_WID (23)
+ #define DDRDATACH1_CR_DATATRAINFEEDBACK_Spare_MSK (0xFFFFFE00)
+ #define DDRDATACH1_CR_DATATRAINFEEDBACK_Spare_MAX (0x007FFFFF)
+
+#define DDRDATACH1_CR_DLLPITESTANDADC_REG (0x00003158)
+ #define DDRDATACH1_CR_DLLPITESTANDADC_RunTest_OFF ( 0)
+ #define DDRDATACH1_CR_DLLPITESTANDADC_RunTest_WID ( 1)
+ #define DDRDATACH1_CR_DLLPITESTANDADC_RunTest_MSK (0x00000001)
+ #define DDRDATACH1_CR_DLLPITESTANDADC_RunTest_MAX (0x00000001)
+ #define DDRDATACH1_CR_DLLPITESTANDADC_RunTest_DEF (0x00000000)
+ #define DDRDATACH1_CR_DLLPITESTANDADC_Load_OFF ( 1)
+ #define DDRDATACH1_CR_DLLPITESTANDADC_Load_WID ( 1)
+ #define DDRDATACH1_CR_DLLPITESTANDADC_Load_MSK (0x00000002)
+ #define DDRDATACH1_CR_DLLPITESTANDADC_Load_MAX (0x00000001)
+ #define DDRDATACH1_CR_DLLPITESTANDADC_Load_DEF (0x00000000)
+ #define DDRDATACH1_CR_DLLPITESTANDADC_ModeHVM_OFF ( 2)
+ #define DDRDATACH1_CR_DLLPITESTANDADC_ModeHVM_WID ( 1)
+ #define DDRDATACH1_CR_DLLPITESTANDADC_ModeHVM_MSK (0x00000004)
+ #define DDRDATACH1_CR_DLLPITESTANDADC_ModeHVM_MAX (0x00000001)
+ #define DDRDATACH1_CR_DLLPITESTANDADC_ModeHVM_DEF (0x00000000)
+ #define DDRDATACH1_CR_DLLPITESTANDADC_ModeDV_OFF ( 3)
+ #define DDRDATACH1_CR_DLLPITESTANDADC_ModeDV_WID ( 1)
+ #define DDRDATACH1_CR_DLLPITESTANDADC_ModeDV_MSK (0x00000008)
+ #define DDRDATACH1_CR_DLLPITESTANDADC_ModeDV_MAX (0x00000001)
+ #define DDRDATACH1_CR_DLLPITESTANDADC_ModeDV_DEF (0x00000000)
+ #define DDRDATACH1_CR_DLLPITESTANDADC_ModeADC_OFF ( 4)
+ #define DDRDATACH1_CR_DLLPITESTANDADC_ModeADC_WID ( 1)
+ #define DDRDATACH1_CR_DLLPITESTANDADC_ModeADC_MSK (0x00000010)
+ #define DDRDATACH1_CR_DLLPITESTANDADC_ModeADC_MAX (0x00000001)
+ #define DDRDATACH1_CR_DLLPITESTANDADC_ModeADC_DEF (0x00000000)
+ #define DDRDATACH1_CR_DLLPITESTANDADC_LoadCount_OFF ( 5)
+ #define DDRDATACH1_CR_DLLPITESTANDADC_LoadCount_WID (10)
+ #define DDRDATACH1_CR_DLLPITESTANDADC_LoadCount_MSK (0x00007FE0)
+ #define DDRDATACH1_CR_DLLPITESTANDADC_LoadCount_MAX (0x000003FF)
+ #define DDRDATACH1_CR_DLLPITESTANDADC_CountStatus_OFF (15)
+ #define DDRDATACH1_CR_DLLPITESTANDADC_CountStatus_WID (10)
+ #define DDRDATACH1_CR_DLLPITESTANDADC_CountStatus_MSK (0x01FF8000)
+ #define DDRDATACH1_CR_DLLPITESTANDADC_CountStatus_MAX (0x000003FF)
+ #define DDRDATACH1_CR_DLLPITESTANDADC_CountStatus_DEF (0x00000000)
+ #define DDRDATACH1_CR_DLLPITESTANDADC_Spare_OFF (25)
+ #define DDRDATACH1_CR_DLLPITESTANDADC_Spare_WID ( 7)
+ #define DDRDATACH1_CR_DLLPITESTANDADC_Spare_MSK (0xFE000000)
+ #define DDRDATACH1_CR_DLLPITESTANDADC_Spare_MAX (0x0000007F)
+
+#define DDRDATACH1_CR_DDRCRDATAOFFSETCOMP_REG (0x0000315C)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_OFF ( 0)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_WID ( 6)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_MSK (0x0000003F)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_MAX (0x0000003F)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_OFF ( 6)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_WID ( 6)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_MSK (0x00000FC0)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_MAX (0x0000003F)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_OFF (12)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_WID ( 5)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_MSK (0x0001F000)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_MAX (0x0000001F)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_OFF (17)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_WID ( 5)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_MSK (0x003E0000)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_MAX (0x0000001F)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_OFF (22)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_WID ( 5)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_MSK (0x07C00000)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_MAX (0x0000001F)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_OFF (27)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_WID ( 5)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_MSK (0xF8000000)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_MAX (0x0000001F)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_DEF (0x00000000)
+
+#define DDRDATACH1_CR_DDRCRDATACONTROL1_REG (0x00003160)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_RefPi_OFF ( 0)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_RefPi_WID ( 4)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_RefPi_MSK (0x0000000F)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_RefPi_MAX (0x0000000F)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_RefPi_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_DllMask_OFF ( 4)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_DllMask_WID ( 2)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_DllMask_MSK (0x00000030)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_DllMask_MAX (0x00000003)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_DllMask_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_DllWeakLock_OFF ( 6)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_DllWeakLock_WID ( 1)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_DllWeakLock_MSK (0x00000040)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_DllWeakLock_MAX (0x00000001)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_DllWeakLock_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_OFF ( 7)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_WID ( 3)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_MSK (0x00000380)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_MAX (0x00000007)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_RxBiasCtl_OFF (10)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_RxBiasCtl_WID ( 3)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_RxBiasCtl_MSK (0x00001C00)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_RxBiasCtl_MAX (0x00000007)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_RxBiasCtl_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_OdtDelay_OFF (13)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_OdtDelay_WID ( 4)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_OdtDelay_MSK (0x0001E000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_OdtDelay_MAX (0x0000000F)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_OdtDelay_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_OdtDuration_OFF (17)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_OdtDuration_WID ( 3)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_OdtDuration_MSK (0x000E0000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_OdtDuration_MAX (0x00000007)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_OdtDuration_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_OFF (20)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_WID ( 4)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_MSK (0x00F00000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_MAX (0x0000000F)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_OFF (24)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_WID ( 3)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_MSK (0x07000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_MAX (0x00000007)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_OFF (27)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_WID ( 3)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_MSK (0x38000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_MAX (0x00000007)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_OFF (30)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_WID ( 1)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_MSK (0x40000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_MAX (0x00000001)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_Rsvd1_OFF (31)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_Rsvd1_WID ( 1)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_Rsvd1_MSK (0x80000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_Rsvd1_MAX (0x00000001)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL1_Rsvd1_DEF (0x00000000)
+
+#define DDRDATACH1_CR_DDRCRDATACONTROL2_REG (0x00003164)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_OFF ( 0)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_WID ( 5)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_MSK (0x0000001F)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_MAX (0x0000001F)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL2_ForceBiasOn_OFF ( 5)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL2_ForceBiasOn_WID ( 1)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL2_ForceBiasOn_MSK (0x00000020)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL2_ForceBiasOn_MAX (0x00000001)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL2_ForceBiasOn_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL2_ForceRxOn_OFF ( 6)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL2_ForceRxOn_WID ( 1)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL2_ForceRxOn_MSK (0x00000040)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL2_ForceRxOn_MAX (0x00000001)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL2_ForceRxOn_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL2_LeakerComp_OFF ( 7)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL2_LeakerComp_WID ( 2)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL2_LeakerComp_MSK (0x00000180)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL2_LeakerComp_MAX (0x00000003)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL2_LeakerComp_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_OFF ( 9)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_WID ( 4)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_MSK (0x00001E00)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_MAX (0x0000000F)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_DEF (0x00000008)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL2_RxClkStgNum_OFF (13)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL2_RxClkStgNum_WID ( 5)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL2_RxClkStgNum_MSK (0x0003E000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL2_RxClkStgNum_MAX (0x0000001F)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL2_RxClkStgNum_DEF (0x00000011)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL2_WlLongDelEn_OFF (18)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL2_WlLongDelEn_WID ( 1)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL2_WlLongDelEn_MSK (0x00040000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL2_WlLongDelEn_MAX (0x00000001)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL2_WlLongDelEn_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL2_Spare_OFF (19)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL2_Spare_WID (13)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL2_Spare_MSK (0xFFF80000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL2_Spare_MAX (0x00001FFF)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL2_Spare_DEF (0x00000000)
+
+#define DDRDATACH1_CR_DDRCRVSSHIORVREFCONTROL_REG (0x0000316C)
+ #define DDRDATACH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_OFF ( 0)
+ #define DDRDATACH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_WID (24)
+ #define DDRDATACH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_MSK (0x00FFFFFF)
+ #define DDRDATACH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_MAX (0x00FFFFFF)
+ #define DDRDATACH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_OFF (24)
+ #define DDRDATACH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_WID ( 8)
+ #define DDRDATACH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_MSK (0xFF000000)
+ #define DDRDATACH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_MAX (0x000000FF)
+ #define DDRDATACH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_DEF (0x00000000)
+
+#define DDRDATACH1_CR_DDRCRDATAOFFSETTRAIN_REG (0x00003170)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_OFF ( 0)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_WID ( 6)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_MSK (0x0000003F)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_MAX (0x0000003F)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_OFF ( 6)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_WID ( 6)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_MSK (0x00000FC0)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_MAX (0x0000003F)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_OFF (12)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_WID ( 6)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_MSK (0x0003F000)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_MAX (0x0000003F)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_OFF (18)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_WID ( 6)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_MSK (0x00FC0000)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_MAX (0x0000003F)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_OFF (24)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_WID ( 7)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_MSK (0x7F000000)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_MAX (0x0000007F)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETTRAIN_Spare_OFF (31)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETTRAIN_Spare_WID ( 1)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETTRAIN_Spare_MSK (0x80000000)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETTRAIN_Spare_MAX (0x00000001)
+ #define DDRDATACH1_CR_DDRCRDATAOFFSETTRAIN_Spare_DEF (0x00000000)
+
+#define DDRDATACH1_CR_DDRCRDATACONTROL0_REG (0x00003174)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_RxTrainingMode_OFF ( 0)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_RxTrainingMode_WID ( 1)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_RxTrainingMode_MSK (0x00000001)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_RxTrainingMode_MAX (0x00000001)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_RxTrainingMode_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_WLTrainingMode_OFF ( 1)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_WLTrainingMode_WID ( 1)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_WLTrainingMode_MSK (0x00000002)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_WLTrainingMode_MAX (0x00000001)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_WLTrainingMode_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_RLTrainingMode_OFF ( 2)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_RLTrainingMode_WID ( 1)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_RLTrainingMode_MSK (0x00000004)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_RLTrainingMode_MAX (0x00000001)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_RLTrainingMode_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_OFF ( 3)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_WID ( 1)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_MSK (0x00000008)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_MAX (0x00000001)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_TxOn_OFF ( 4)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_TxOn_WID ( 1)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_TxOn_MSK (0x00000010)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_TxOn_MAX (0x00000001)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_TxOn_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_RfOn_OFF ( 5)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_RfOn_WID ( 1)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_RfOn_MSK (0x00000020)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_RfOn_MAX (0x00000001)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_RfOn_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_RxPiOn_OFF ( 6)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_RxPiOn_WID ( 1)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_RxPiOn_MSK (0x00000040)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_RxPiOn_MAX (0x00000001)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_RxPiOn_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_TxPiOn_OFF ( 7)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_TxPiOn_WID ( 1)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_TxPiOn_MSK (0x00000080)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_TxPiOn_MAX (0x00000001)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_TxPiOn_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_InternalClocksOn_OFF ( 8)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_InternalClocksOn_WID ( 1)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_InternalClocksOn_MSK (0x00000100)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_InternalClocksOn_MAX (0x00000001)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_InternalClocksOn_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_OFF ( 9)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_WID ( 1)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_MSK (0x00000200)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_MAX (0x00000001)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_TxDisable_OFF (10)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_TxDisable_WID ( 1)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_TxDisable_MSK (0x00000400)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_TxDisable_MAX (0x00000001)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_TxDisable_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_RxDisable_OFF (11)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_RxDisable_WID ( 1)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_RxDisable_MSK (0x00000800)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_RxDisable_MAX (0x00000001)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_RxDisable_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_TxLong_OFF (12)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_TxLong_WID ( 1)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_TxLong_MSK (0x00001000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_TxLong_MAX (0x00000001)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_TxLong_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_RxDqsCtle_OFF (13)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_RxDqsCtle_WID ( 2)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_RxDqsCtle_MSK (0x00006000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_RxDqsCtle_MAX (0x00000003)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_RxDqsCtle_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_RxReadPointer_OFF (15)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_RxReadPointer_WID ( 3)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_RxReadPointer_MSK (0x00038000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_RxReadPointer_MAX (0x00000007)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_RxReadPointer_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_OFF (18)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_WID ( 1)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_MSK (0x00040000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_MAX (0x00000001)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_DataVccddqHi_OFF (19)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_DataVccddqHi_WID ( 1)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_DataVccddqHi_MSK (0x00080000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_DataVccddqHi_MAX (0x00000001)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_DataVccddqHi_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_ReadRFRd_OFF (20)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_ReadRFRd_WID ( 1)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_ReadRFRd_MSK (0x00100000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_ReadRFRd_MAX (0x00000001)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_ReadRFRd_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_ReadRFWr_OFF (21)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_ReadRFWr_WID ( 1)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_ReadRFWr_MSK (0x00200000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_ReadRFWr_MAX (0x00000001)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_ReadRFWr_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_ReadRFRank_OFF (22)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_ReadRFRank_WID ( 2)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_ReadRFRank_MSK (0x00C00000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_ReadRFRank_MAX (0x00000003)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_ReadRFRank_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_ForceOdtOn_OFF (24)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_ForceOdtOn_WID ( 1)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_ForceOdtOn_MSK (0x01000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_ForceOdtOn_MAX (0x00000001)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_ForceOdtOn_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_OdtSampOff_OFF (25)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_OdtSampOff_WID ( 1)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_OdtSampOff_MSK (0x02000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_OdtSampOff_MAX (0x00000001)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_OdtSampOff_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_OFF (26)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_WID ( 1)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_MSK (0x04000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_MAX (0x00000001)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_OFF (27)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_WID ( 1)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_MSK (0x08000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_MAX (0x00000001)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_OFF (28)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_WID ( 1)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_MSK (0x10000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_MAX (0x00000001)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_EnReadPreamble_OFF (29)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_EnReadPreamble_WID ( 1)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_EnReadPreamble_MSK (0x20000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_EnReadPreamble_MAX (0x00000001)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_EnReadPreamble_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_OFF (30)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_WID ( 1)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_MSK (0x40000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_MAX (0x00000001)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_OFF (31)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_WID ( 1)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_MSK (0x80000000)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_MAX (0x00000001)
+ #define DDRDATACH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_DEF (0x00000000)
+
+#define DDRDATACH1_CR_DDRCRVREFADJUST1_REG (0x00003178)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_CAVrefCtl_OFF ( 0)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_CAVrefCtl_WID ( 7)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_CAVrefCtl_MSK (0x0000007F)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_CAVrefCtl_MAX (0x0000007F)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_CAVrefCtl_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_OFF ( 7)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_WID ( 7)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_MSK (0x00003F80)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_MAX (0x0000007F)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_OFF (14)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_WID ( 7)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_MSK (0x001FC000)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_MAX (0x0000007F)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_OFF (21)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_WID ( 1)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_MSK (0x00200000)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_MAX (0x00000001)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_OFF (22)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_WID ( 1)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_MSK (0x00400000)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_MAX (0x00000001)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_OFF (23)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_WID ( 1)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_MSK (0x00800000)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_MAX (0x00000001)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_OFF (24)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_WID ( 2)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_MSK (0x03000000)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_MAX (0x00000003)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_OFF (26)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_WID ( 1)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_MSK (0x04000000)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_MAX (0x00000001)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_Rsvd_OFF (27)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_Rsvd_WID ( 2)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_Rsvd_MSK (0x18000000)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_Rsvd_MAX (0x00000003)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_Rsvd_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_caSlowBW_OFF (29)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_caSlowBW_WID ( 1)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_caSlowBW_MSK (0x20000000)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_caSlowBW_MAX (0x00000001)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_caSlowBW_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_ch0SlowBW_OFF (30)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_ch0SlowBW_WID ( 1)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_ch0SlowBW_MSK (0x40000000)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_ch0SlowBW_MAX (0x00000001)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_ch0SlowBW_DEF (0x00000000)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_ch1SlowBW_OFF (31)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_ch1SlowBW_WID ( 1)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_ch1SlowBW_MSK (0x80000000)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_ch1SlowBW_MAX (0x00000001)
+ #define DDRDATACH1_CR_DDRCRVREFADJUST1_ch1SlowBW_DEF (0x00000000)
+
+#define DDRDATA0CH0_CR_RXTRAINRANK0_REG (0x00000000)
+ #define DDRDATA0CH0_CR_RXTRAINRANK0_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA0CH0_CR_RXTRAINRANK0_RxRcvEnPi_WID ( 9)
+ #define DDRDATA0CH0_CR_RXTRAINRANK0_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA0CH0_CR_RXTRAINRANK0_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA0CH0_CR_RXTRAINRANK0_RxDqsPPi_OFF ( 9)
+ #define DDRDATA0CH0_CR_RXTRAINRANK0_RxDqsPPi_WID ( 6)
+ #define DDRDATA0CH0_CR_RXTRAINRANK0_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA0CH0_CR_RXTRAINRANK0_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA0CH0_CR_RXTRAINRANK0_RxEq_OFF (15)
+ #define DDRDATA0CH0_CR_RXTRAINRANK0_RxEq_WID ( 5)
+ #define DDRDATA0CH0_CR_RXTRAINRANK0_RxEq_MSK (0x000F8000)
+ #define DDRDATA0CH0_CR_RXTRAINRANK0_RxEq_MAX (0x0000001F)
+ #define DDRDATA0CH0_CR_RXTRAINRANK0_RxDqsNPi_OFF (20)
+ #define DDRDATA0CH0_CR_RXTRAINRANK0_RxDqsNPi_WID ( 6)
+ #define DDRDATA0CH0_CR_RXTRAINRANK0_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA0CH0_CR_RXTRAINRANK0_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA0CH0_CR_RXTRAINRANK0_RxVref_OFF (26)
+ #define DDRDATA0CH0_CR_RXTRAINRANK0_RxVref_WID ( 6)
+ #define DDRDATA0CH0_CR_RXTRAINRANK0_RxVref_MSK (0xFC000000)
+ #define DDRDATA0CH0_CR_RXTRAINRANK0_RxVref_MAX (0x0000003F)
+
+#define DDRDATA0CH0_CR_RXTRAINRANK1_REG (0x00000004)
+ #define DDRDATA0CH0_CR_RXTRAINRANK1_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA0CH0_CR_RXTRAINRANK1_RxRcvEnPi_WID ( 9)
+ #define DDRDATA0CH0_CR_RXTRAINRANK1_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA0CH0_CR_RXTRAINRANK1_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA0CH0_CR_RXTRAINRANK1_RxDqsPPi_OFF ( 9)
+ #define DDRDATA0CH0_CR_RXTRAINRANK1_RxDqsPPi_WID ( 6)
+ #define DDRDATA0CH0_CR_RXTRAINRANK1_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA0CH0_CR_RXTRAINRANK1_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA0CH0_CR_RXTRAINRANK1_RxEq_OFF (15)
+ #define DDRDATA0CH0_CR_RXTRAINRANK1_RxEq_WID ( 5)
+ #define DDRDATA0CH0_CR_RXTRAINRANK1_RxEq_MSK (0x000F8000)
+ #define DDRDATA0CH0_CR_RXTRAINRANK1_RxEq_MAX (0x0000001F)
+ #define DDRDATA0CH0_CR_RXTRAINRANK1_RxDqsNPi_OFF (20)
+ #define DDRDATA0CH0_CR_RXTRAINRANK1_RxDqsNPi_WID ( 6)
+ #define DDRDATA0CH0_CR_RXTRAINRANK1_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA0CH0_CR_RXTRAINRANK1_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA0CH0_CR_RXTRAINRANK1_RxVref_OFF (26)
+ #define DDRDATA0CH0_CR_RXTRAINRANK1_RxVref_WID ( 6)
+ #define DDRDATA0CH0_CR_RXTRAINRANK1_RxVref_MSK (0xFC000000)
+ #define DDRDATA0CH0_CR_RXTRAINRANK1_RxVref_MAX (0x0000003F)
+
+#define DDRDATA0CH0_CR_RXTRAINRANK2_REG (0x00000008)
+ #define DDRDATA0CH0_CR_RXTRAINRANK2_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA0CH0_CR_RXTRAINRANK2_RxRcvEnPi_WID ( 9)
+ #define DDRDATA0CH0_CR_RXTRAINRANK2_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA0CH0_CR_RXTRAINRANK2_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA0CH0_CR_RXTRAINRANK2_RxDqsPPi_OFF ( 9)
+ #define DDRDATA0CH0_CR_RXTRAINRANK2_RxDqsPPi_WID ( 6)
+ #define DDRDATA0CH0_CR_RXTRAINRANK2_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA0CH0_CR_RXTRAINRANK2_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA0CH0_CR_RXTRAINRANK2_RxEq_OFF (15)
+ #define DDRDATA0CH0_CR_RXTRAINRANK2_RxEq_WID ( 5)
+ #define DDRDATA0CH0_CR_RXTRAINRANK2_RxEq_MSK (0x000F8000)
+ #define DDRDATA0CH0_CR_RXTRAINRANK2_RxEq_MAX (0x0000001F)
+ #define DDRDATA0CH0_CR_RXTRAINRANK2_RxDqsNPi_OFF (20)
+ #define DDRDATA0CH0_CR_RXTRAINRANK2_RxDqsNPi_WID ( 6)
+ #define DDRDATA0CH0_CR_RXTRAINRANK2_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA0CH0_CR_RXTRAINRANK2_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA0CH0_CR_RXTRAINRANK2_RxVref_OFF (26)
+ #define DDRDATA0CH0_CR_RXTRAINRANK2_RxVref_WID ( 6)
+ #define DDRDATA0CH0_CR_RXTRAINRANK2_RxVref_MSK (0xFC000000)
+ #define DDRDATA0CH0_CR_RXTRAINRANK2_RxVref_MAX (0x0000003F)
+
+#define DDRDATA0CH0_CR_RXTRAINRANK3_REG (0x0000000C)
+ #define DDRDATA0CH0_CR_RXTRAINRANK3_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA0CH0_CR_RXTRAINRANK3_RxRcvEnPi_WID ( 9)
+ #define DDRDATA0CH0_CR_RXTRAINRANK3_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA0CH0_CR_RXTRAINRANK3_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA0CH0_CR_RXTRAINRANK3_RxDqsPPi_OFF ( 9)
+ #define DDRDATA0CH0_CR_RXTRAINRANK3_RxDqsPPi_WID ( 6)
+ #define DDRDATA0CH0_CR_RXTRAINRANK3_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA0CH0_CR_RXTRAINRANK3_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA0CH0_CR_RXTRAINRANK3_RxEq_OFF (15)
+ #define DDRDATA0CH0_CR_RXTRAINRANK3_RxEq_WID ( 5)
+ #define DDRDATA0CH0_CR_RXTRAINRANK3_RxEq_MSK (0x000F8000)
+ #define DDRDATA0CH0_CR_RXTRAINRANK3_RxEq_MAX (0x0000001F)
+ #define DDRDATA0CH0_CR_RXTRAINRANK3_RxDqsNPi_OFF (20)
+ #define DDRDATA0CH0_CR_RXTRAINRANK3_RxDqsNPi_WID ( 6)
+ #define DDRDATA0CH0_CR_RXTRAINRANK3_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA0CH0_CR_RXTRAINRANK3_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA0CH0_CR_RXTRAINRANK3_RxVref_OFF (26)
+ #define DDRDATA0CH0_CR_RXTRAINRANK3_RxVref_WID ( 6)
+ #define DDRDATA0CH0_CR_RXTRAINRANK3_RxVref_MSK (0xFC000000)
+ #define DDRDATA0CH0_CR_RXTRAINRANK3_RxVref_MAX (0x0000003F)
+
+#define DDRDATA0CH0_CR_RXPERBITRANK0_REG (0x00000010)
+ #define DDRDATA0CH0_CR_RXPERBITRANK0_Lane0_OFF ( 0)
+ #define DDRDATA0CH0_CR_RXPERBITRANK0_Lane0_WID ( 4)
+ #define DDRDATA0CH0_CR_RXPERBITRANK0_Lane0_MSK (0x0000000F)
+ #define DDRDATA0CH0_CR_RXPERBITRANK0_Lane0_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_RXPERBITRANK0_Lane1_OFF ( 4)
+ #define DDRDATA0CH0_CR_RXPERBITRANK0_Lane1_WID ( 4)
+ #define DDRDATA0CH0_CR_RXPERBITRANK0_Lane1_MSK (0x000000F0)
+ #define DDRDATA0CH0_CR_RXPERBITRANK0_Lane1_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_RXPERBITRANK0_Lane2_OFF ( 8)
+ #define DDRDATA0CH0_CR_RXPERBITRANK0_Lane2_WID ( 4)
+ #define DDRDATA0CH0_CR_RXPERBITRANK0_Lane2_MSK (0x00000F00)
+ #define DDRDATA0CH0_CR_RXPERBITRANK0_Lane2_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_RXPERBITRANK0_Lane3_OFF (12)
+ #define DDRDATA0CH0_CR_RXPERBITRANK0_Lane3_WID ( 4)
+ #define DDRDATA0CH0_CR_RXPERBITRANK0_Lane3_MSK (0x0000F000)
+ #define DDRDATA0CH0_CR_RXPERBITRANK0_Lane3_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_RXPERBITRANK0_Lane4_OFF (16)
+ #define DDRDATA0CH0_CR_RXPERBITRANK0_Lane4_WID ( 4)
+ #define DDRDATA0CH0_CR_RXPERBITRANK0_Lane4_MSK (0x000F0000)
+ #define DDRDATA0CH0_CR_RXPERBITRANK0_Lane4_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_RXPERBITRANK0_Lane5_OFF (20)
+ #define DDRDATA0CH0_CR_RXPERBITRANK0_Lane5_WID ( 4)
+ #define DDRDATA0CH0_CR_RXPERBITRANK0_Lane5_MSK (0x00F00000)
+ #define DDRDATA0CH0_CR_RXPERBITRANK0_Lane5_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_RXPERBITRANK0_Lane6_OFF (24)
+ #define DDRDATA0CH0_CR_RXPERBITRANK0_Lane6_WID ( 4)
+ #define DDRDATA0CH0_CR_RXPERBITRANK0_Lane6_MSK (0x0F000000)
+ #define DDRDATA0CH0_CR_RXPERBITRANK0_Lane6_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_RXPERBITRANK0_Lane7_OFF (28)
+ #define DDRDATA0CH0_CR_RXPERBITRANK0_Lane7_WID ( 4)
+ #define DDRDATA0CH0_CR_RXPERBITRANK0_Lane7_MSK (0xF0000000)
+ #define DDRDATA0CH0_CR_RXPERBITRANK0_Lane7_MAX (0x0000000F)
+
+#define DDRDATA0CH0_CR_RXPERBITRANK1_REG (0x00000014)
+ #define DDRDATA0CH0_CR_RXPERBITRANK1_Lane0_OFF ( 0)
+ #define DDRDATA0CH0_CR_RXPERBITRANK1_Lane0_WID ( 4)
+ #define DDRDATA0CH0_CR_RXPERBITRANK1_Lane0_MSK (0x0000000F)
+ #define DDRDATA0CH0_CR_RXPERBITRANK1_Lane0_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_RXPERBITRANK1_Lane1_OFF ( 4)
+ #define DDRDATA0CH0_CR_RXPERBITRANK1_Lane1_WID ( 4)
+ #define DDRDATA0CH0_CR_RXPERBITRANK1_Lane1_MSK (0x000000F0)
+ #define DDRDATA0CH0_CR_RXPERBITRANK1_Lane1_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_RXPERBITRANK1_Lane2_OFF ( 8)
+ #define DDRDATA0CH0_CR_RXPERBITRANK1_Lane2_WID ( 4)
+ #define DDRDATA0CH0_CR_RXPERBITRANK1_Lane2_MSK (0x00000F00)
+ #define DDRDATA0CH0_CR_RXPERBITRANK1_Lane2_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_RXPERBITRANK1_Lane3_OFF (12)
+ #define DDRDATA0CH0_CR_RXPERBITRANK1_Lane3_WID ( 4)
+ #define DDRDATA0CH0_CR_RXPERBITRANK1_Lane3_MSK (0x0000F000)
+ #define DDRDATA0CH0_CR_RXPERBITRANK1_Lane3_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_RXPERBITRANK1_Lane4_OFF (16)
+ #define DDRDATA0CH0_CR_RXPERBITRANK1_Lane4_WID ( 4)
+ #define DDRDATA0CH0_CR_RXPERBITRANK1_Lane4_MSK (0x000F0000)
+ #define DDRDATA0CH0_CR_RXPERBITRANK1_Lane4_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_RXPERBITRANK1_Lane5_OFF (20)
+ #define DDRDATA0CH0_CR_RXPERBITRANK1_Lane5_WID ( 4)
+ #define DDRDATA0CH0_CR_RXPERBITRANK1_Lane5_MSK (0x00F00000)
+ #define DDRDATA0CH0_CR_RXPERBITRANK1_Lane5_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_RXPERBITRANK1_Lane6_OFF (24)
+ #define DDRDATA0CH0_CR_RXPERBITRANK1_Lane6_WID ( 4)
+ #define DDRDATA0CH0_CR_RXPERBITRANK1_Lane6_MSK (0x0F000000)
+ #define DDRDATA0CH0_CR_RXPERBITRANK1_Lane6_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_RXPERBITRANK1_Lane7_OFF (28)
+ #define DDRDATA0CH0_CR_RXPERBITRANK1_Lane7_WID ( 4)
+ #define DDRDATA0CH0_CR_RXPERBITRANK1_Lane7_MSK (0xF0000000)
+ #define DDRDATA0CH0_CR_RXPERBITRANK1_Lane7_MAX (0x0000000F)
+
+#define DDRDATA0CH0_CR_RXPERBITRANK2_REG (0x00000018)
+ #define DDRDATA0CH0_CR_RXPERBITRANK2_Lane0_OFF ( 0)
+ #define DDRDATA0CH0_CR_RXPERBITRANK2_Lane0_WID ( 4)
+ #define DDRDATA0CH0_CR_RXPERBITRANK2_Lane0_MSK (0x0000000F)
+ #define DDRDATA0CH0_CR_RXPERBITRANK2_Lane0_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_RXPERBITRANK2_Lane1_OFF ( 4)
+ #define DDRDATA0CH0_CR_RXPERBITRANK2_Lane1_WID ( 4)
+ #define DDRDATA0CH0_CR_RXPERBITRANK2_Lane1_MSK (0x000000F0)
+ #define DDRDATA0CH0_CR_RXPERBITRANK2_Lane1_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_RXPERBITRANK2_Lane2_OFF ( 8)
+ #define DDRDATA0CH0_CR_RXPERBITRANK2_Lane2_WID ( 4)
+ #define DDRDATA0CH0_CR_RXPERBITRANK2_Lane2_MSK (0x00000F00)
+ #define DDRDATA0CH0_CR_RXPERBITRANK2_Lane2_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_RXPERBITRANK2_Lane3_OFF (12)
+ #define DDRDATA0CH0_CR_RXPERBITRANK2_Lane3_WID ( 4)
+ #define DDRDATA0CH0_CR_RXPERBITRANK2_Lane3_MSK (0x0000F000)
+ #define DDRDATA0CH0_CR_RXPERBITRANK2_Lane3_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_RXPERBITRANK2_Lane4_OFF (16)
+ #define DDRDATA0CH0_CR_RXPERBITRANK2_Lane4_WID ( 4)
+ #define DDRDATA0CH0_CR_RXPERBITRANK2_Lane4_MSK (0x000F0000)
+ #define DDRDATA0CH0_CR_RXPERBITRANK2_Lane4_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_RXPERBITRANK2_Lane5_OFF (20)
+ #define DDRDATA0CH0_CR_RXPERBITRANK2_Lane5_WID ( 4)
+ #define DDRDATA0CH0_CR_RXPERBITRANK2_Lane5_MSK (0x00F00000)
+ #define DDRDATA0CH0_CR_RXPERBITRANK2_Lane5_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_RXPERBITRANK2_Lane6_OFF (24)
+ #define DDRDATA0CH0_CR_RXPERBITRANK2_Lane6_WID ( 4)
+ #define DDRDATA0CH0_CR_RXPERBITRANK2_Lane6_MSK (0x0F000000)
+ #define DDRDATA0CH0_CR_RXPERBITRANK2_Lane6_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_RXPERBITRANK2_Lane7_OFF (28)
+ #define DDRDATA0CH0_CR_RXPERBITRANK2_Lane7_WID ( 4)
+ #define DDRDATA0CH0_CR_RXPERBITRANK2_Lane7_MSK (0xF0000000)
+ #define DDRDATA0CH0_CR_RXPERBITRANK2_Lane7_MAX (0x0000000F)
+
+#define DDRDATA0CH0_CR_RXPERBITRANK3_REG (0x0000001C)
+ #define DDRDATA0CH0_CR_RXPERBITRANK3_Lane0_OFF ( 0)
+ #define DDRDATA0CH0_CR_RXPERBITRANK3_Lane0_WID ( 4)
+ #define DDRDATA0CH0_CR_RXPERBITRANK3_Lane0_MSK (0x0000000F)
+ #define DDRDATA0CH0_CR_RXPERBITRANK3_Lane0_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_RXPERBITRANK3_Lane1_OFF ( 4)
+ #define DDRDATA0CH0_CR_RXPERBITRANK3_Lane1_WID ( 4)
+ #define DDRDATA0CH0_CR_RXPERBITRANK3_Lane1_MSK (0x000000F0)
+ #define DDRDATA0CH0_CR_RXPERBITRANK3_Lane1_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_RXPERBITRANK3_Lane2_OFF ( 8)
+ #define DDRDATA0CH0_CR_RXPERBITRANK3_Lane2_WID ( 4)
+ #define DDRDATA0CH0_CR_RXPERBITRANK3_Lane2_MSK (0x00000F00)
+ #define DDRDATA0CH0_CR_RXPERBITRANK3_Lane2_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_RXPERBITRANK3_Lane3_OFF (12)
+ #define DDRDATA0CH0_CR_RXPERBITRANK3_Lane3_WID ( 4)
+ #define DDRDATA0CH0_CR_RXPERBITRANK3_Lane3_MSK (0x0000F000)
+ #define DDRDATA0CH0_CR_RXPERBITRANK3_Lane3_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_RXPERBITRANK3_Lane4_OFF (16)
+ #define DDRDATA0CH0_CR_RXPERBITRANK3_Lane4_WID ( 4)
+ #define DDRDATA0CH0_CR_RXPERBITRANK3_Lane4_MSK (0x000F0000)
+ #define DDRDATA0CH0_CR_RXPERBITRANK3_Lane4_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_RXPERBITRANK3_Lane5_OFF (20)
+ #define DDRDATA0CH0_CR_RXPERBITRANK3_Lane5_WID ( 4)
+ #define DDRDATA0CH0_CR_RXPERBITRANK3_Lane5_MSK (0x00F00000)
+ #define DDRDATA0CH0_CR_RXPERBITRANK3_Lane5_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_RXPERBITRANK3_Lane6_OFF (24)
+ #define DDRDATA0CH0_CR_RXPERBITRANK3_Lane6_WID ( 4)
+ #define DDRDATA0CH0_CR_RXPERBITRANK3_Lane6_MSK (0x0F000000)
+ #define DDRDATA0CH0_CR_RXPERBITRANK3_Lane6_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_RXPERBITRANK3_Lane7_OFF (28)
+ #define DDRDATA0CH0_CR_RXPERBITRANK3_Lane7_WID ( 4)
+ #define DDRDATA0CH0_CR_RXPERBITRANK3_Lane7_MSK (0xF0000000)
+ #define DDRDATA0CH0_CR_RXPERBITRANK3_Lane7_MAX (0x0000000F)
+
+#define DDRDATA0CH0_CR_TXTRAINRANK0_REG (0x00000020)
+ #define DDRDATA0CH0_CR_TXTRAINRANK0_TxDqDelay_OFF ( 0)
+ #define DDRDATA0CH0_CR_TXTRAINRANK0_TxDqDelay_WID ( 9)
+ #define DDRDATA0CH0_CR_TXTRAINRANK0_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA0CH0_CR_TXTRAINRANK0_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA0CH0_CR_TXTRAINRANK0_TxDqsDelay_OFF ( 9)
+ #define DDRDATA0CH0_CR_TXTRAINRANK0_TxDqsDelay_WID ( 9)
+ #define DDRDATA0CH0_CR_TXTRAINRANK0_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA0CH0_CR_TXTRAINRANK0_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA0CH0_CR_TXTRAINRANK0_Spare0_OFF (18)
+ #define DDRDATA0CH0_CR_TXTRAINRANK0_Spare0_WID ( 2)
+ #define DDRDATA0CH0_CR_TXTRAINRANK0_Spare0_MSK (0x000C0000)
+ #define DDRDATA0CH0_CR_TXTRAINRANK0_Spare0_MAX (0x00000003)
+ #define DDRDATA0CH0_CR_TXTRAINRANK0_TxEqualization_OFF (20)
+ #define DDRDATA0CH0_CR_TXTRAINRANK0_TxEqualization_WID ( 6)
+ #define DDRDATA0CH0_CR_TXTRAINRANK0_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA0CH0_CR_TXTRAINRANK0_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA0CH0_CR_TXTRAINRANK0_Spare1_OFF (26)
+ #define DDRDATA0CH0_CR_TXTRAINRANK0_Spare1_WID ( 6)
+ #define DDRDATA0CH0_CR_TXTRAINRANK0_Spare1_MSK (0xFC000000)
+ #define DDRDATA0CH0_CR_TXTRAINRANK0_Spare1_MAX (0x0000003F)
+
+#define DDRDATA0CH0_CR_TXTRAINRANK1_REG (0x00000024)
+ #define DDRDATA0CH0_CR_TXTRAINRANK1_TxDqDelay_OFF ( 0)
+ #define DDRDATA0CH0_CR_TXTRAINRANK1_TxDqDelay_WID ( 9)
+ #define DDRDATA0CH0_CR_TXTRAINRANK1_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA0CH0_CR_TXTRAINRANK1_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA0CH0_CR_TXTRAINRANK1_TxDqsDelay_OFF ( 9)
+ #define DDRDATA0CH0_CR_TXTRAINRANK1_TxDqsDelay_WID ( 9)
+ #define DDRDATA0CH0_CR_TXTRAINRANK1_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA0CH0_CR_TXTRAINRANK1_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA0CH0_CR_TXTRAINRANK1_Spare0_OFF (18)
+ #define DDRDATA0CH0_CR_TXTRAINRANK1_Spare0_WID ( 2)
+ #define DDRDATA0CH0_CR_TXTRAINRANK1_Spare0_MSK (0x000C0000)
+ #define DDRDATA0CH0_CR_TXTRAINRANK1_Spare0_MAX (0x00000003)
+ #define DDRDATA0CH0_CR_TXTRAINRANK1_TxEqualization_OFF (20)
+ #define DDRDATA0CH0_CR_TXTRAINRANK1_TxEqualization_WID ( 6)
+ #define DDRDATA0CH0_CR_TXTRAINRANK1_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA0CH0_CR_TXTRAINRANK1_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA0CH0_CR_TXTRAINRANK1_Spare1_OFF (26)
+ #define DDRDATA0CH0_CR_TXTRAINRANK1_Spare1_WID ( 6)
+ #define DDRDATA0CH0_CR_TXTRAINRANK1_Spare1_MSK (0xFC000000)
+ #define DDRDATA0CH0_CR_TXTRAINRANK1_Spare1_MAX (0x0000003F)
+
+#define DDRDATA0CH0_CR_TXTRAINRANK2_REG (0x00000028)
+ #define DDRDATA0CH0_CR_TXTRAINRANK2_TxDqDelay_OFF ( 0)
+ #define DDRDATA0CH0_CR_TXTRAINRANK2_TxDqDelay_WID ( 9)
+ #define DDRDATA0CH0_CR_TXTRAINRANK2_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA0CH0_CR_TXTRAINRANK2_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA0CH0_CR_TXTRAINRANK2_TxDqsDelay_OFF ( 9)
+ #define DDRDATA0CH0_CR_TXTRAINRANK2_TxDqsDelay_WID ( 9)
+ #define DDRDATA0CH0_CR_TXTRAINRANK2_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA0CH0_CR_TXTRAINRANK2_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA0CH0_CR_TXTRAINRANK2_Spare0_OFF (18)
+ #define DDRDATA0CH0_CR_TXTRAINRANK2_Spare0_WID ( 2)
+ #define DDRDATA0CH0_CR_TXTRAINRANK2_Spare0_MSK (0x000C0000)
+ #define DDRDATA0CH0_CR_TXTRAINRANK2_Spare0_MAX (0x00000003)
+ #define DDRDATA0CH0_CR_TXTRAINRANK2_TxEqualization_OFF (20)
+ #define DDRDATA0CH0_CR_TXTRAINRANK2_TxEqualization_WID ( 6)
+ #define DDRDATA0CH0_CR_TXTRAINRANK2_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA0CH0_CR_TXTRAINRANK2_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA0CH0_CR_TXTRAINRANK2_Spare1_OFF (26)
+ #define DDRDATA0CH0_CR_TXTRAINRANK2_Spare1_WID ( 6)
+ #define DDRDATA0CH0_CR_TXTRAINRANK2_Spare1_MSK (0xFC000000)
+ #define DDRDATA0CH0_CR_TXTRAINRANK2_Spare1_MAX (0x0000003F)
+
+#define DDRDATA0CH0_CR_TXTRAINRANK3_REG (0x0000002C)
+ #define DDRDATA0CH0_CR_TXTRAINRANK3_TxDqDelay_OFF ( 0)
+ #define DDRDATA0CH0_CR_TXTRAINRANK3_TxDqDelay_WID ( 9)
+ #define DDRDATA0CH0_CR_TXTRAINRANK3_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA0CH0_CR_TXTRAINRANK3_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA0CH0_CR_TXTRAINRANK3_TxDqsDelay_OFF ( 9)
+ #define DDRDATA0CH0_CR_TXTRAINRANK3_TxDqsDelay_WID ( 9)
+ #define DDRDATA0CH0_CR_TXTRAINRANK3_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA0CH0_CR_TXTRAINRANK3_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA0CH0_CR_TXTRAINRANK3_Spare0_OFF (18)
+ #define DDRDATA0CH0_CR_TXTRAINRANK3_Spare0_WID ( 2)
+ #define DDRDATA0CH0_CR_TXTRAINRANK3_Spare0_MSK (0x000C0000)
+ #define DDRDATA0CH0_CR_TXTRAINRANK3_Spare0_MAX (0x00000003)
+ #define DDRDATA0CH0_CR_TXTRAINRANK3_TxEqualization_OFF (20)
+ #define DDRDATA0CH0_CR_TXTRAINRANK3_TxEqualization_WID ( 6)
+ #define DDRDATA0CH0_CR_TXTRAINRANK3_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA0CH0_CR_TXTRAINRANK3_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA0CH0_CR_TXTRAINRANK3_Spare1_OFF (26)
+ #define DDRDATA0CH0_CR_TXTRAINRANK3_Spare1_WID ( 6)
+ #define DDRDATA0CH0_CR_TXTRAINRANK3_Spare1_MSK (0xFC000000)
+ #define DDRDATA0CH0_CR_TXTRAINRANK3_Spare1_MAX (0x0000003F)
+
+#define DDRDATA0CH0_CR_TXPERBITRANK0_REG (0x00000030)
+ #define DDRDATA0CH0_CR_TXPERBITRANK0_Lane0_OFF ( 0)
+ #define DDRDATA0CH0_CR_TXPERBITRANK0_Lane0_WID ( 4)
+ #define DDRDATA0CH0_CR_TXPERBITRANK0_Lane0_MSK (0x0000000F)
+ #define DDRDATA0CH0_CR_TXPERBITRANK0_Lane0_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_TXPERBITRANK0_Lane1_OFF ( 4)
+ #define DDRDATA0CH0_CR_TXPERBITRANK0_Lane1_WID ( 4)
+ #define DDRDATA0CH0_CR_TXPERBITRANK0_Lane1_MSK (0x000000F0)
+ #define DDRDATA0CH0_CR_TXPERBITRANK0_Lane1_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_TXPERBITRANK0_Lane2_OFF ( 8)
+ #define DDRDATA0CH0_CR_TXPERBITRANK0_Lane2_WID ( 4)
+ #define DDRDATA0CH0_CR_TXPERBITRANK0_Lane2_MSK (0x00000F00)
+ #define DDRDATA0CH0_CR_TXPERBITRANK0_Lane2_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_TXPERBITRANK0_Lane3_OFF (12)
+ #define DDRDATA0CH0_CR_TXPERBITRANK0_Lane3_WID ( 4)
+ #define DDRDATA0CH0_CR_TXPERBITRANK0_Lane3_MSK (0x0000F000)
+ #define DDRDATA0CH0_CR_TXPERBITRANK0_Lane3_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_TXPERBITRANK0_Lane4_OFF (16)
+ #define DDRDATA0CH0_CR_TXPERBITRANK0_Lane4_WID ( 4)
+ #define DDRDATA0CH0_CR_TXPERBITRANK0_Lane4_MSK (0x000F0000)
+ #define DDRDATA0CH0_CR_TXPERBITRANK0_Lane4_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_TXPERBITRANK0_Lane5_OFF (20)
+ #define DDRDATA0CH0_CR_TXPERBITRANK0_Lane5_WID ( 4)
+ #define DDRDATA0CH0_CR_TXPERBITRANK0_Lane5_MSK (0x00F00000)
+ #define DDRDATA0CH0_CR_TXPERBITRANK0_Lane5_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_TXPERBITRANK0_Lane6_OFF (24)
+ #define DDRDATA0CH0_CR_TXPERBITRANK0_Lane6_WID ( 4)
+ #define DDRDATA0CH0_CR_TXPERBITRANK0_Lane6_MSK (0x0F000000)
+ #define DDRDATA0CH0_CR_TXPERBITRANK0_Lane6_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_TXPERBITRANK0_Lane7_OFF (28)
+ #define DDRDATA0CH0_CR_TXPERBITRANK0_Lane7_WID ( 4)
+ #define DDRDATA0CH0_CR_TXPERBITRANK0_Lane7_MSK (0xF0000000)
+ #define DDRDATA0CH0_CR_TXPERBITRANK0_Lane7_MAX (0x0000000F)
+
+#define DDRDATA0CH0_CR_TXPERBITRANK1_REG (0x00000034)
+ #define DDRDATA0CH0_CR_TXPERBITRANK1_Lane0_OFF ( 0)
+ #define DDRDATA0CH0_CR_TXPERBITRANK1_Lane0_WID ( 4)
+ #define DDRDATA0CH0_CR_TXPERBITRANK1_Lane0_MSK (0x0000000F)
+ #define DDRDATA0CH0_CR_TXPERBITRANK1_Lane0_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_TXPERBITRANK1_Lane1_OFF ( 4)
+ #define DDRDATA0CH0_CR_TXPERBITRANK1_Lane1_WID ( 4)
+ #define DDRDATA0CH0_CR_TXPERBITRANK1_Lane1_MSK (0x000000F0)
+ #define DDRDATA0CH0_CR_TXPERBITRANK1_Lane1_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_TXPERBITRANK1_Lane2_OFF ( 8)
+ #define DDRDATA0CH0_CR_TXPERBITRANK1_Lane2_WID ( 4)
+ #define DDRDATA0CH0_CR_TXPERBITRANK1_Lane2_MSK (0x00000F00)
+ #define DDRDATA0CH0_CR_TXPERBITRANK1_Lane2_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_TXPERBITRANK1_Lane3_OFF (12)
+ #define DDRDATA0CH0_CR_TXPERBITRANK1_Lane3_WID ( 4)
+ #define DDRDATA0CH0_CR_TXPERBITRANK1_Lane3_MSK (0x0000F000)
+ #define DDRDATA0CH0_CR_TXPERBITRANK1_Lane3_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_TXPERBITRANK1_Lane4_OFF (16)
+ #define DDRDATA0CH0_CR_TXPERBITRANK1_Lane4_WID ( 4)
+ #define DDRDATA0CH0_CR_TXPERBITRANK1_Lane4_MSK (0x000F0000)
+ #define DDRDATA0CH0_CR_TXPERBITRANK1_Lane4_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_TXPERBITRANK1_Lane5_OFF (20)
+ #define DDRDATA0CH0_CR_TXPERBITRANK1_Lane5_WID ( 4)
+ #define DDRDATA0CH0_CR_TXPERBITRANK1_Lane5_MSK (0x00F00000)
+ #define DDRDATA0CH0_CR_TXPERBITRANK1_Lane5_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_TXPERBITRANK1_Lane6_OFF (24)
+ #define DDRDATA0CH0_CR_TXPERBITRANK1_Lane6_WID ( 4)
+ #define DDRDATA0CH0_CR_TXPERBITRANK1_Lane6_MSK (0x0F000000)
+ #define DDRDATA0CH0_CR_TXPERBITRANK1_Lane6_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_TXPERBITRANK1_Lane7_OFF (28)
+ #define DDRDATA0CH0_CR_TXPERBITRANK1_Lane7_WID ( 4)
+ #define DDRDATA0CH0_CR_TXPERBITRANK1_Lane7_MSK (0xF0000000)
+ #define DDRDATA0CH0_CR_TXPERBITRANK1_Lane7_MAX (0x0000000F)
+
+#define DDRDATA0CH0_CR_TXPERBITRANK2_REG (0x00000038)
+ #define DDRDATA0CH0_CR_TXPERBITRANK2_Lane0_OFF ( 0)
+ #define DDRDATA0CH0_CR_TXPERBITRANK2_Lane0_WID ( 4)
+ #define DDRDATA0CH0_CR_TXPERBITRANK2_Lane0_MSK (0x0000000F)
+ #define DDRDATA0CH0_CR_TXPERBITRANK2_Lane0_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_TXPERBITRANK2_Lane1_OFF ( 4)
+ #define DDRDATA0CH0_CR_TXPERBITRANK2_Lane1_WID ( 4)
+ #define DDRDATA0CH0_CR_TXPERBITRANK2_Lane1_MSK (0x000000F0)
+ #define DDRDATA0CH0_CR_TXPERBITRANK2_Lane1_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_TXPERBITRANK2_Lane2_OFF ( 8)
+ #define DDRDATA0CH0_CR_TXPERBITRANK2_Lane2_WID ( 4)
+ #define DDRDATA0CH0_CR_TXPERBITRANK2_Lane2_MSK (0x00000F00)
+ #define DDRDATA0CH0_CR_TXPERBITRANK2_Lane2_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_TXPERBITRANK2_Lane3_OFF (12)
+ #define DDRDATA0CH0_CR_TXPERBITRANK2_Lane3_WID ( 4)
+ #define DDRDATA0CH0_CR_TXPERBITRANK2_Lane3_MSK (0x0000F000)
+ #define DDRDATA0CH0_CR_TXPERBITRANK2_Lane3_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_TXPERBITRANK2_Lane4_OFF (16)
+ #define DDRDATA0CH0_CR_TXPERBITRANK2_Lane4_WID ( 4)
+ #define DDRDATA0CH0_CR_TXPERBITRANK2_Lane4_MSK (0x000F0000)
+ #define DDRDATA0CH0_CR_TXPERBITRANK2_Lane4_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_TXPERBITRANK2_Lane5_OFF (20)
+ #define DDRDATA0CH0_CR_TXPERBITRANK2_Lane5_WID ( 4)
+ #define DDRDATA0CH0_CR_TXPERBITRANK2_Lane5_MSK (0x00F00000)
+ #define DDRDATA0CH0_CR_TXPERBITRANK2_Lane5_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_TXPERBITRANK2_Lane6_OFF (24)
+ #define DDRDATA0CH0_CR_TXPERBITRANK2_Lane6_WID ( 4)
+ #define DDRDATA0CH0_CR_TXPERBITRANK2_Lane6_MSK (0x0F000000)
+ #define DDRDATA0CH0_CR_TXPERBITRANK2_Lane6_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_TXPERBITRANK2_Lane7_OFF (28)
+ #define DDRDATA0CH0_CR_TXPERBITRANK2_Lane7_WID ( 4)
+ #define DDRDATA0CH0_CR_TXPERBITRANK2_Lane7_MSK (0xF0000000)
+ #define DDRDATA0CH0_CR_TXPERBITRANK2_Lane7_MAX (0x0000000F)
+
+#define DDRDATA0CH0_CR_TXPERBITRANK3_REG (0x0000003C)
+ #define DDRDATA0CH0_CR_TXPERBITRANK3_Lane0_OFF ( 0)
+ #define DDRDATA0CH0_CR_TXPERBITRANK3_Lane0_WID ( 4)
+ #define DDRDATA0CH0_CR_TXPERBITRANK3_Lane0_MSK (0x0000000F)
+ #define DDRDATA0CH0_CR_TXPERBITRANK3_Lane0_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_TXPERBITRANK3_Lane1_OFF ( 4)
+ #define DDRDATA0CH0_CR_TXPERBITRANK3_Lane1_WID ( 4)
+ #define DDRDATA0CH0_CR_TXPERBITRANK3_Lane1_MSK (0x000000F0)
+ #define DDRDATA0CH0_CR_TXPERBITRANK3_Lane1_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_TXPERBITRANK3_Lane2_OFF ( 8)
+ #define DDRDATA0CH0_CR_TXPERBITRANK3_Lane2_WID ( 4)
+ #define DDRDATA0CH0_CR_TXPERBITRANK3_Lane2_MSK (0x00000F00)
+ #define DDRDATA0CH0_CR_TXPERBITRANK3_Lane2_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_TXPERBITRANK3_Lane3_OFF (12)
+ #define DDRDATA0CH0_CR_TXPERBITRANK3_Lane3_WID ( 4)
+ #define DDRDATA0CH0_CR_TXPERBITRANK3_Lane3_MSK (0x0000F000)
+ #define DDRDATA0CH0_CR_TXPERBITRANK3_Lane3_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_TXPERBITRANK3_Lane4_OFF (16)
+ #define DDRDATA0CH0_CR_TXPERBITRANK3_Lane4_WID ( 4)
+ #define DDRDATA0CH0_CR_TXPERBITRANK3_Lane4_MSK (0x000F0000)
+ #define DDRDATA0CH0_CR_TXPERBITRANK3_Lane4_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_TXPERBITRANK3_Lane5_OFF (20)
+ #define DDRDATA0CH0_CR_TXPERBITRANK3_Lane5_WID ( 4)
+ #define DDRDATA0CH0_CR_TXPERBITRANK3_Lane5_MSK (0x00F00000)
+ #define DDRDATA0CH0_CR_TXPERBITRANK3_Lane5_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_TXPERBITRANK3_Lane6_OFF (24)
+ #define DDRDATA0CH0_CR_TXPERBITRANK3_Lane6_WID ( 4)
+ #define DDRDATA0CH0_CR_TXPERBITRANK3_Lane6_MSK (0x0F000000)
+ #define DDRDATA0CH0_CR_TXPERBITRANK3_Lane6_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_TXPERBITRANK3_Lane7_OFF (28)
+ #define DDRDATA0CH0_CR_TXPERBITRANK3_Lane7_WID ( 4)
+ #define DDRDATA0CH0_CR_TXPERBITRANK3_Lane7_MSK (0xF0000000)
+ #define DDRDATA0CH0_CR_TXPERBITRANK3_Lane7_MAX (0x0000000F)
+
+#define DDRDATA0CH0_CR_RCOMPDATA0_REG (0x00000040)
+ #define DDRDATA0CH0_CR_RCOMPDATA0_RcompDrvUp_OFF ( 0)
+ #define DDRDATA0CH0_CR_RCOMPDATA0_RcompDrvUp_WID ( 6)
+ #define DDRDATA0CH0_CR_RCOMPDATA0_RcompDrvUp_MSK (0x0000003F)
+ #define DDRDATA0CH0_CR_RCOMPDATA0_RcompDrvUp_MAX (0x0000003F)
+ #define DDRDATA0CH0_CR_RCOMPDATA0_Spare0_OFF ( 6)
+ #define DDRDATA0CH0_CR_RCOMPDATA0_Spare0_WID ( 3)
+ #define DDRDATA0CH0_CR_RCOMPDATA0_Spare0_MSK (0x000001C0)
+ #define DDRDATA0CH0_CR_RCOMPDATA0_Spare0_MAX (0x00000007)
+ #define DDRDATA0CH0_CR_RCOMPDATA0_RcompDrvDown_OFF ( 9)
+ #define DDRDATA0CH0_CR_RCOMPDATA0_RcompDrvDown_WID ( 6)
+ #define DDRDATA0CH0_CR_RCOMPDATA0_RcompDrvDown_MSK (0x00007E00)
+ #define DDRDATA0CH0_CR_RCOMPDATA0_RcompDrvDown_MAX (0x0000003F)
+ #define DDRDATA0CH0_CR_RCOMPDATA0_VTComp_OFF (15)
+ #define DDRDATA0CH0_CR_RCOMPDATA0_VTComp_WID ( 5)
+ #define DDRDATA0CH0_CR_RCOMPDATA0_VTComp_MSK (0x000F8000)
+ #define DDRDATA0CH0_CR_RCOMPDATA0_VTComp_MAX (0x0000001F)
+ #define DDRDATA0CH0_CR_RCOMPDATA0_TcoComp_OFF (20)
+ #define DDRDATA0CH0_CR_RCOMPDATA0_TcoComp_WID ( 6)
+ #define DDRDATA0CH0_CR_RCOMPDATA0_TcoComp_MSK (0x03F00000)
+ #define DDRDATA0CH0_CR_RCOMPDATA0_TcoComp_MAX (0x0000003F)
+ #define DDRDATA0CH0_CR_RCOMPDATA0_SlewRateComp_OFF (26)
+ #define DDRDATA0CH0_CR_RCOMPDATA0_SlewRateComp_WID ( 5)
+ #define DDRDATA0CH0_CR_RCOMPDATA0_SlewRateComp_MSK (0x7C000000)
+ #define DDRDATA0CH0_CR_RCOMPDATA0_SlewRateComp_MAX (0x0000001F)
+ #define DDRDATA0CH0_CR_RCOMPDATA0_Spare2_OFF (31)
+ #define DDRDATA0CH0_CR_RCOMPDATA0_Spare2_WID ( 1)
+ #define DDRDATA0CH0_CR_RCOMPDATA0_Spare2_MSK (0x80000000)
+ #define DDRDATA0CH0_CR_RCOMPDATA0_Spare2_MAX (0x00000001)
+
+#define DDRDATA0CH0_CR_RCOMPDATA1_REG (0x00000044)
+ #define DDRDATA0CH0_CR_RCOMPDATA1_RcompOdtUp_OFF ( 0)
+ #define DDRDATA0CH0_CR_RCOMPDATA1_RcompOdtUp_WID ( 6)
+ #define DDRDATA0CH0_CR_RCOMPDATA1_RcompOdtUp_MSK (0x0000003F)
+ #define DDRDATA0CH0_CR_RCOMPDATA1_RcompOdtUp_MAX (0x0000003F)
+ #define DDRDATA0CH0_CR_RCOMPDATA1_Spare0_OFF ( 6)
+ #define DDRDATA0CH0_CR_RCOMPDATA1_Spare0_WID ( 3)
+ #define DDRDATA0CH0_CR_RCOMPDATA1_Spare0_MSK (0x000001C0)
+ #define DDRDATA0CH0_CR_RCOMPDATA1_Spare0_MAX (0x00000007)
+ #define DDRDATA0CH0_CR_RCOMPDATA1_RcompOdtDown_OFF ( 9)
+ #define DDRDATA0CH0_CR_RCOMPDATA1_RcompOdtDown_WID ( 6)
+ #define DDRDATA0CH0_CR_RCOMPDATA1_RcompOdtDown_MSK (0x00007E00)
+ #define DDRDATA0CH0_CR_RCOMPDATA1_RcompOdtDown_MAX (0x0000003F)
+ #define DDRDATA0CH0_CR_RCOMPDATA1_Spare1_OFF (15)
+ #define DDRDATA0CH0_CR_RCOMPDATA1_Spare1_WID ( 1)
+ #define DDRDATA0CH0_CR_RCOMPDATA1_Spare1_MSK (0x00008000)
+ #define DDRDATA0CH0_CR_RCOMPDATA1_Spare1_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_RCOMPDATA1_PanicDrvDn_OFF (16)
+ #define DDRDATA0CH0_CR_RCOMPDATA1_PanicDrvDn_WID ( 6)
+ #define DDRDATA0CH0_CR_RCOMPDATA1_PanicDrvDn_MSK (0x003F0000)
+ #define DDRDATA0CH0_CR_RCOMPDATA1_PanicDrvDn_MAX (0x0000003F)
+ #define DDRDATA0CH0_CR_RCOMPDATA1_PanicDrvUp_OFF (22)
+ #define DDRDATA0CH0_CR_RCOMPDATA1_PanicDrvUp_WID ( 6)
+ #define DDRDATA0CH0_CR_RCOMPDATA1_PanicDrvUp_MSK (0x0FC00000)
+ #define DDRDATA0CH0_CR_RCOMPDATA1_PanicDrvUp_MAX (0x0000003F)
+ #define DDRDATA0CH0_CR_RCOMPDATA1_LevelShifterComp_OFF (28)
+ #define DDRDATA0CH0_CR_RCOMPDATA1_LevelShifterComp_WID ( 3)
+ #define DDRDATA0CH0_CR_RCOMPDATA1_LevelShifterComp_MSK (0x70000000)
+ #define DDRDATA0CH0_CR_RCOMPDATA1_LevelShifterComp_MAX (0x00000007)
+ #define DDRDATA0CH0_CR_RCOMPDATA1_Spare2_OFF (31)
+ #define DDRDATA0CH0_CR_RCOMPDATA1_Spare2_WID ( 1)
+ #define DDRDATA0CH0_CR_RCOMPDATA1_Spare2_MSK (0x80000000)
+ #define DDRDATA0CH0_CR_RCOMPDATA1_Spare2_MAX (0x00000001)
+
+#define DDRDATA0CH0_CR_TXXTALK_REG (0x00000048)
+ #define DDRDATA0CH0_CR_TXXTALK_Lane0_OFF ( 0)
+ #define DDRDATA0CH0_CR_TXXTALK_Lane0_WID ( 4)
+ #define DDRDATA0CH0_CR_TXXTALK_Lane0_MSK (0x0000000F)
+ #define DDRDATA0CH0_CR_TXXTALK_Lane0_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_TXXTALK_Lane1_OFF ( 4)
+ #define DDRDATA0CH0_CR_TXXTALK_Lane1_WID ( 4)
+ #define DDRDATA0CH0_CR_TXXTALK_Lane1_MSK (0x000000F0)
+ #define DDRDATA0CH0_CR_TXXTALK_Lane1_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_TXXTALK_Lane2_OFF ( 8)
+ #define DDRDATA0CH0_CR_TXXTALK_Lane2_WID ( 4)
+ #define DDRDATA0CH0_CR_TXXTALK_Lane2_MSK (0x00000F00)
+ #define DDRDATA0CH0_CR_TXXTALK_Lane2_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_TXXTALK_Lane3_OFF (12)
+ #define DDRDATA0CH0_CR_TXXTALK_Lane3_WID ( 4)
+ #define DDRDATA0CH0_CR_TXXTALK_Lane3_MSK (0x0000F000)
+ #define DDRDATA0CH0_CR_TXXTALK_Lane3_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_TXXTALK_Lane4_OFF (16)
+ #define DDRDATA0CH0_CR_TXXTALK_Lane4_WID ( 4)
+ #define DDRDATA0CH0_CR_TXXTALK_Lane4_MSK (0x000F0000)
+ #define DDRDATA0CH0_CR_TXXTALK_Lane4_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_TXXTALK_Lane5_OFF (20)
+ #define DDRDATA0CH0_CR_TXXTALK_Lane5_WID ( 4)
+ #define DDRDATA0CH0_CR_TXXTALK_Lane5_MSK (0x00F00000)
+ #define DDRDATA0CH0_CR_TXXTALK_Lane5_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_TXXTALK_Lane6_OFF (24)
+ #define DDRDATA0CH0_CR_TXXTALK_Lane6_WID ( 4)
+ #define DDRDATA0CH0_CR_TXXTALK_Lane6_MSK (0x0F000000)
+ #define DDRDATA0CH0_CR_TXXTALK_Lane6_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_TXXTALK_Lane7_OFF (28)
+ #define DDRDATA0CH0_CR_TXXTALK_Lane7_WID ( 4)
+ #define DDRDATA0CH0_CR_TXXTALK_Lane7_MSK (0xF0000000)
+ #define DDRDATA0CH0_CR_TXXTALK_Lane7_MAX (0x0000000F)
+
+#define DDRDATA0CH0_CR_RXOFFSETVDQ_REG (0x0000004C)
+ #define DDRDATA0CH0_CR_RXOFFSETVDQ_Lane0_OFF ( 0)
+ #define DDRDATA0CH0_CR_RXOFFSETVDQ_Lane0_WID ( 4)
+ #define DDRDATA0CH0_CR_RXOFFSETVDQ_Lane0_MSK (0x0000000F)
+ #define DDRDATA0CH0_CR_RXOFFSETVDQ_Lane0_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_RXOFFSETVDQ_Lane1_OFF ( 4)
+ #define DDRDATA0CH0_CR_RXOFFSETVDQ_Lane1_WID ( 4)
+ #define DDRDATA0CH0_CR_RXOFFSETVDQ_Lane1_MSK (0x000000F0)
+ #define DDRDATA0CH0_CR_RXOFFSETVDQ_Lane1_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_RXOFFSETVDQ_Lane2_OFF ( 8)
+ #define DDRDATA0CH0_CR_RXOFFSETVDQ_Lane2_WID ( 4)
+ #define DDRDATA0CH0_CR_RXOFFSETVDQ_Lane2_MSK (0x00000F00)
+ #define DDRDATA0CH0_CR_RXOFFSETVDQ_Lane2_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_RXOFFSETVDQ_Lane3_OFF (12)
+ #define DDRDATA0CH0_CR_RXOFFSETVDQ_Lane3_WID ( 4)
+ #define DDRDATA0CH0_CR_RXOFFSETVDQ_Lane3_MSK (0x0000F000)
+ #define DDRDATA0CH0_CR_RXOFFSETVDQ_Lane3_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_RXOFFSETVDQ_Lane4_OFF (16)
+ #define DDRDATA0CH0_CR_RXOFFSETVDQ_Lane4_WID ( 4)
+ #define DDRDATA0CH0_CR_RXOFFSETVDQ_Lane4_MSK (0x000F0000)
+ #define DDRDATA0CH0_CR_RXOFFSETVDQ_Lane4_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_RXOFFSETVDQ_Lane5_OFF (20)
+ #define DDRDATA0CH0_CR_RXOFFSETVDQ_Lane5_WID ( 4)
+ #define DDRDATA0CH0_CR_RXOFFSETVDQ_Lane5_MSK (0x00F00000)
+ #define DDRDATA0CH0_CR_RXOFFSETVDQ_Lane5_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_RXOFFSETVDQ_Lane6_OFF (24)
+ #define DDRDATA0CH0_CR_RXOFFSETVDQ_Lane6_WID ( 4)
+ #define DDRDATA0CH0_CR_RXOFFSETVDQ_Lane6_MSK (0x0F000000)
+ #define DDRDATA0CH0_CR_RXOFFSETVDQ_Lane6_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_RXOFFSETVDQ_Lane7_OFF (28)
+ #define DDRDATA0CH0_CR_RXOFFSETVDQ_Lane7_WID ( 4)
+ #define DDRDATA0CH0_CR_RXOFFSETVDQ_Lane7_MSK (0xF0000000)
+ #define DDRDATA0CH0_CR_RXOFFSETVDQ_Lane7_MAX (0x0000000F)
+
+#define DDRDATA0CH0_CR_DDRDATARESERVED_REG (0x00000050)
+ #define DDRDATA0CH0_CR_DDRDATARESERVED_Spare_OFF ( 0)
+ #define DDRDATA0CH0_CR_DDRDATARESERVED_Spare_WID (32)
+ #define DDRDATA0CH0_CR_DDRDATARESERVED_Spare_MSK (0xFFFFFFFF)
+ #define DDRDATA0CH0_CR_DDRDATARESERVED_Spare_MAX (0xFFFFFFFF)
+
+#define DDRDATA0CH0_CR_DATATRAINFEEDBACK_REG (0x00000054)
+ #define DDRDATA0CH0_CR_DATATRAINFEEDBACK_DataTrainFeedback_OFF ( 0)
+ #define DDRDATA0CH0_CR_DATATRAINFEEDBACK_DataTrainFeedback_WID ( 9)
+ #define DDRDATA0CH0_CR_DATATRAINFEEDBACK_DataTrainFeedback_MSK (0x000001FF)
+ #define DDRDATA0CH0_CR_DATATRAINFEEDBACK_DataTrainFeedback_MAX (0x000001FF)
+ #define DDRDATA0CH0_CR_DATATRAINFEEDBACK_Spare_OFF ( 9)
+ #define DDRDATA0CH0_CR_DATATRAINFEEDBACK_Spare_WID (23)
+ #define DDRDATA0CH0_CR_DATATRAINFEEDBACK_Spare_MSK (0xFFFFFE00)
+ #define DDRDATA0CH0_CR_DATATRAINFEEDBACK_Spare_MAX (0x007FFFFF)
+
+#define DDRDATA0CH0_CR_DLLPITESTANDADC_REG (0x00000058)
+ #define DDRDATA0CH0_CR_DLLPITESTANDADC_RunTest_OFF ( 0)
+ #define DDRDATA0CH0_CR_DLLPITESTANDADC_RunTest_WID ( 1)
+ #define DDRDATA0CH0_CR_DLLPITESTANDADC_RunTest_MSK (0x00000001)
+ #define DDRDATA0CH0_CR_DLLPITESTANDADC_RunTest_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DLLPITESTANDADC_RunTest_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DLLPITESTANDADC_Load_OFF ( 1)
+ #define DDRDATA0CH0_CR_DLLPITESTANDADC_Load_WID ( 1)
+ #define DDRDATA0CH0_CR_DLLPITESTANDADC_Load_MSK (0x00000002)
+ #define DDRDATA0CH0_CR_DLLPITESTANDADC_Load_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DLLPITESTANDADC_Load_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DLLPITESTANDADC_ModeHVM_OFF ( 2)
+ #define DDRDATA0CH0_CR_DLLPITESTANDADC_ModeHVM_WID ( 1)
+ #define DDRDATA0CH0_CR_DLLPITESTANDADC_ModeHVM_MSK (0x00000004)
+ #define DDRDATA0CH0_CR_DLLPITESTANDADC_ModeHVM_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DLLPITESTANDADC_ModeHVM_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DLLPITESTANDADC_ModeDV_OFF ( 3)
+ #define DDRDATA0CH0_CR_DLLPITESTANDADC_ModeDV_WID ( 1)
+ #define DDRDATA0CH0_CR_DLLPITESTANDADC_ModeDV_MSK (0x00000008)
+ #define DDRDATA0CH0_CR_DLLPITESTANDADC_ModeDV_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DLLPITESTANDADC_ModeDV_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DLLPITESTANDADC_ModeADC_OFF ( 4)
+ #define DDRDATA0CH0_CR_DLLPITESTANDADC_ModeADC_WID ( 1)
+ #define DDRDATA0CH0_CR_DLLPITESTANDADC_ModeADC_MSK (0x00000010)
+ #define DDRDATA0CH0_CR_DLLPITESTANDADC_ModeADC_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DLLPITESTANDADC_ModeADC_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DLLPITESTANDADC_LoadCount_OFF ( 5)
+ #define DDRDATA0CH0_CR_DLLPITESTANDADC_LoadCount_WID (10)
+ #define DDRDATA0CH0_CR_DLLPITESTANDADC_LoadCount_MSK (0x00007FE0)
+ #define DDRDATA0CH0_CR_DLLPITESTANDADC_LoadCount_MAX (0x000003FF)
+ #define DDRDATA0CH0_CR_DLLPITESTANDADC_CountStatus_OFF (15)
+ #define DDRDATA0CH0_CR_DLLPITESTANDADC_CountStatus_WID (10)
+ #define DDRDATA0CH0_CR_DLLPITESTANDADC_CountStatus_MSK (0x01FF8000)
+ #define DDRDATA0CH0_CR_DLLPITESTANDADC_CountStatus_MAX (0x000003FF)
+ #define DDRDATA0CH0_CR_DLLPITESTANDADC_CountStatus_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DLLPITESTANDADC_Spare_OFF (25)
+ #define DDRDATA0CH0_CR_DLLPITESTANDADC_Spare_WID ( 7)
+ #define DDRDATA0CH0_CR_DLLPITESTANDADC_Spare_MSK (0xFE000000)
+ #define DDRDATA0CH0_CR_DLLPITESTANDADC_Spare_MAX (0x0000007F)
+
+#define DDRDATA0CH0_CR_DDRCRDATAOFFSETCOMP_REG (0x0000005C)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_OFF ( 0)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_WID ( 6)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_MSK (0x0000003F)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_MAX (0x0000003F)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_OFF ( 6)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_WID ( 6)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_MSK (0x00000FC0)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_MAX (0x0000003F)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_OFF (12)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_WID ( 5)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_MSK (0x0001F000)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_MAX (0x0000001F)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_OFF (17)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_WID ( 5)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_MSK (0x003E0000)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_MAX (0x0000001F)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_OFF (22)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_WID ( 5)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_MSK (0x07C00000)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_MAX (0x0000001F)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_OFF (27)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_WID ( 5)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_MSK (0xF8000000)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_MAX (0x0000001F)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_DEF (0x00000000)
+
+#define DDRDATA0CH0_CR_DDRCRDATACONTROL1_REG (0x00000060)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_RefPi_OFF ( 0)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_RefPi_WID ( 4)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_RefPi_MSK (0x0000000F)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_RefPi_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_RefPi_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_DllMask_OFF ( 4)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_DllMask_WID ( 2)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_DllMask_MSK (0x00000030)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_DllMask_MAX (0x00000003)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_DllMask_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_DllWeakLock_OFF ( 6)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_DllWeakLock_WID ( 1)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_DllWeakLock_MSK (0x00000040)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_DllWeakLock_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_DllWeakLock_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_OFF ( 7)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_WID ( 3)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_MSK (0x00000380)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_MAX (0x00000007)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_OFF (10)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_WID ( 3)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_MSK (0x00001C00)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_MAX (0x00000007)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_OdtDelay_OFF (13)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_OdtDelay_WID ( 4)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_OdtDelay_MSK (0x0001E000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_OdtDelay_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_OdtDelay_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_OdtDuration_OFF (17)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_OdtDuration_WID ( 3)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_OdtDuration_MSK (0x000E0000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_OdtDuration_MAX (0x00000007)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_OdtDuration_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_OFF (20)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_WID ( 4)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_MSK (0x00F00000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_OFF (24)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_WID ( 3)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_MSK (0x07000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_MAX (0x00000007)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_OFF (27)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_WID ( 3)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_MSK (0x38000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_MAX (0x00000007)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_OFF (30)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_WID ( 1)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_MSK (0x40000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_Rsvd1_OFF (31)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_Rsvd1_WID ( 1)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_Rsvd1_MSK (0x80000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_Rsvd1_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL1_Rsvd1_DEF (0x00000000)
+
+#define DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG (0x00000064)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_OFF ( 0)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_WID ( 5)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_MSK (0x0000001F)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_MAX (0x0000001F)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_OFF ( 5)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_WID ( 1)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_MSK (0x00000020)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL2_ForceRxOn_OFF ( 6)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL2_ForceRxOn_WID ( 1)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL2_ForceRxOn_MSK (0x00000040)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL2_ForceRxOn_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL2_ForceRxOn_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL2_LeakerComp_OFF ( 7)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL2_LeakerComp_WID ( 2)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL2_LeakerComp_MSK (0x00000180)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL2_LeakerComp_MAX (0x00000003)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL2_LeakerComp_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_OFF ( 9)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_WID ( 4)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_MSK (0x00001E00)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_MAX (0x0000000F)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_DEF (0x00000008)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_OFF (13)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_WID ( 5)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_MSK (0x0003E000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_MAX (0x0000001F)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_DEF (0x00000011)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_OFF (18)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_WID ( 1)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_MSK (0x00040000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL2_Spare_OFF (19)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL2_Spare_WID (13)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL2_Spare_MSK (0xFFF80000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL2_Spare_MAX (0x00001FFF)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL2_Spare_DEF (0x00000000)
+
+#define DDRDATA0CH0_CR_DDRCRVSSHIORVREFCONTROL_REG (0x0000006C)
+ #define DDRDATA0CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_OFF ( 0)
+ #define DDRDATA0CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_WID (24)
+ #define DDRDATA0CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_MSK (0x00FFFFFF)
+ #define DDRDATA0CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_MAX (0x00FFFFFF)
+ #define DDRDATA0CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_OFF (24)
+ #define DDRDATA0CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_WID ( 8)
+ #define DDRDATA0CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_MSK (0xFF000000)
+ #define DDRDATA0CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_MAX (0x000000FF)
+ #define DDRDATA0CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_DEF (0x00000000)
+
+#define DDRDATA0CH0_CR_DDRCRDATAOFFSETTRAIN_REG (0x00000070)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_OFF ( 0)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_WID ( 6)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_MSK (0x0000003F)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_MAX (0x0000003F)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_OFF ( 6)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_WID ( 6)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_MSK (0x00000FC0)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_MAX (0x0000003F)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_OFF (12)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_WID ( 6)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_MSK (0x0003F000)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_MAX (0x0000003F)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_OFF (18)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_WID ( 6)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_MSK (0x00FC0000)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_MAX (0x0000003F)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_OFF (24)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_WID ( 7)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_MSK (0x7F000000)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_MAX (0x0000007F)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_OFF (31)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_WID ( 1)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_MSK (0x80000000)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_DEF (0x00000000)
+
+#define DDRDATA0CH0_CR_DDRCRDATACONTROL0_REG (0x00000074)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_OFF ( 0)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_WID ( 1)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_MSK (0x00000001)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_OFF ( 1)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_WID ( 1)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_MSK (0x00000002)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_OFF ( 2)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_WID ( 1)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_MSK (0x00000004)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_OFF ( 3)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_WID ( 1)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_MSK (0x00000008)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_TxOn_OFF ( 4)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_TxOn_WID ( 1)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_TxOn_MSK (0x00000010)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_TxOn_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_TxOn_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_RfOn_OFF ( 5)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_RfOn_WID ( 1)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_RfOn_MSK (0x00000020)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_RfOn_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_RfOn_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_RxPiOn_OFF ( 6)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_RxPiOn_WID ( 1)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_RxPiOn_MSK (0x00000040)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_RxPiOn_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_RxPiOn_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_TxPiOn_OFF ( 7)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_TxPiOn_WID ( 1)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_TxPiOn_MSK (0x00000080)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_TxPiOn_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_TxPiOn_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_OFF ( 8)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_WID ( 1)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_MSK (0x00000100)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_OFF ( 9)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_WID ( 1)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_MSK (0x00000200)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_TxDisable_OFF (10)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_TxDisable_WID ( 1)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_TxDisable_MSK (0x00000400)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_TxDisable_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_TxDisable_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_RxDisable_OFF (11)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_RxDisable_WID ( 1)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_RxDisable_MSK (0x00000800)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_RxDisable_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_RxDisable_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_TxLong_OFF (12)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_TxLong_WID ( 1)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_TxLong_MSK (0x00001000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_TxLong_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_TxLong_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_OFF (13)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_WID ( 2)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_MSK (0x00006000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_MAX (0x00000003)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_RxReadPointer_OFF (15)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_RxReadPointer_WID ( 3)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_RxReadPointer_MSK (0x00038000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_RxReadPointer_MAX (0x00000007)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_RxReadPointer_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_OFF (18)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_WID ( 1)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_MSK (0x00040000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_OFF (19)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_WID ( 1)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_MSK (0x00080000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_ReadRFRd_OFF (20)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_ReadRFRd_WID ( 1)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_ReadRFRd_MSK (0x00100000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_ReadRFRd_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_ReadRFRd_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_ReadRFWr_OFF (21)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_ReadRFWr_WID ( 1)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_ReadRFWr_MSK (0x00200000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_ReadRFWr_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_ReadRFWr_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_ReadRFRank_OFF (22)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_ReadRFRank_WID ( 2)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_ReadRFRank_MSK (0x00C00000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_ReadRFRank_MAX (0x00000003)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_ReadRFRank_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_OFF (24)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_WID ( 1)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_MSK (0x01000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_OdtSampOff_OFF (25)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_OdtSampOff_WID ( 1)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_OdtSampOff_MSK (0x02000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_OdtSampOff_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_OdtSampOff_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_OFF (26)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_WID ( 1)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_MSK (0x04000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_OFF (27)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_WID ( 1)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_MSK (0x08000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_OFF (28)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_WID ( 1)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_MSK (0x10000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_OFF (29)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_WID ( 1)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_MSK (0x20000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_OFF (30)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_WID ( 1)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_MSK (0x40000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_OFF (31)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_WID ( 1)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_MSK (0x80000000)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_DEF (0x00000000)
+
+#define DDRDATA0CH0_CR_DDRCRVREFADJUST1_REG (0x00000078)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_OFF ( 0)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_WID ( 7)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_MSK (0x0000007F)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_MAX (0x0000007F)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_OFF ( 7)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_WID ( 7)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_MSK (0x00003F80)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_MAX (0x0000007F)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_OFF (14)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_WID ( 7)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_MSK (0x001FC000)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_MAX (0x0000007F)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_OFF (21)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_WID ( 1)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_MSK (0x00200000)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_OFF (22)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_WID ( 1)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_MSK (0x00400000)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_OFF (23)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_WID ( 1)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_MSK (0x00800000)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_OFF (24)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_WID ( 2)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_MSK (0x03000000)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_MAX (0x00000003)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_OFF (26)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_WID ( 1)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_MSK (0x04000000)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_Rsvd_OFF (27)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_Rsvd_WID ( 2)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_Rsvd_MSK (0x18000000)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_Rsvd_MAX (0x00000003)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_Rsvd_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_caSlowBW_OFF (29)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_caSlowBW_WID ( 1)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_caSlowBW_MSK (0x20000000)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_caSlowBW_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_caSlowBW_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_OFF (30)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_WID ( 1)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_MSK (0x40000000)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_DEF (0x00000000)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_OFF (31)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_WID ( 1)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_MSK (0x80000000)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_MAX (0x00000001)
+ #define DDRDATA0CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_DEF (0x00000000)
+
+#define DDRDATA0CH1_CR_RXTRAINRANK0_REG (0x00000100)
+ #define DDRDATA0CH1_CR_RXTRAINRANK0_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA0CH1_CR_RXTRAINRANK0_RxRcvEnPi_WID ( 9)
+ #define DDRDATA0CH1_CR_RXTRAINRANK0_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA0CH1_CR_RXTRAINRANK0_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA0CH1_CR_RXTRAINRANK0_RxDqsPPi_OFF ( 9)
+ #define DDRDATA0CH1_CR_RXTRAINRANK0_RxDqsPPi_WID ( 6)
+ #define DDRDATA0CH1_CR_RXTRAINRANK0_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA0CH1_CR_RXTRAINRANK0_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA0CH1_CR_RXTRAINRANK0_RxEq_OFF (15)
+ #define DDRDATA0CH1_CR_RXTRAINRANK0_RxEq_WID ( 5)
+ #define DDRDATA0CH1_CR_RXTRAINRANK0_RxEq_MSK (0x000F8000)
+ #define DDRDATA0CH1_CR_RXTRAINRANK0_RxEq_MAX (0x0000001F)
+ #define DDRDATA0CH1_CR_RXTRAINRANK0_RxDqsNPi_OFF (20)
+ #define DDRDATA0CH1_CR_RXTRAINRANK0_RxDqsNPi_WID ( 6)
+ #define DDRDATA0CH1_CR_RXTRAINRANK0_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA0CH1_CR_RXTRAINRANK0_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA0CH1_CR_RXTRAINRANK0_RxVref_OFF (26)
+ #define DDRDATA0CH1_CR_RXTRAINRANK0_RxVref_WID ( 6)
+ #define DDRDATA0CH1_CR_RXTRAINRANK0_RxVref_MSK (0xFC000000)
+ #define DDRDATA0CH1_CR_RXTRAINRANK0_RxVref_MAX (0x0000003F)
+
+#define DDRDATA0CH1_CR_RXTRAINRANK1_REG (0x00000104)
+ #define DDRDATA0CH1_CR_RXTRAINRANK1_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA0CH1_CR_RXTRAINRANK1_RxRcvEnPi_WID ( 9)
+ #define DDRDATA0CH1_CR_RXTRAINRANK1_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA0CH1_CR_RXTRAINRANK1_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA0CH1_CR_RXTRAINRANK1_RxDqsPPi_OFF ( 9)
+ #define DDRDATA0CH1_CR_RXTRAINRANK1_RxDqsPPi_WID ( 6)
+ #define DDRDATA0CH1_CR_RXTRAINRANK1_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA0CH1_CR_RXTRAINRANK1_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA0CH1_CR_RXTRAINRANK1_RxEq_OFF (15)
+ #define DDRDATA0CH1_CR_RXTRAINRANK1_RxEq_WID ( 5)
+ #define DDRDATA0CH1_CR_RXTRAINRANK1_RxEq_MSK (0x000F8000)
+ #define DDRDATA0CH1_CR_RXTRAINRANK1_RxEq_MAX (0x0000001F)
+ #define DDRDATA0CH1_CR_RXTRAINRANK1_RxDqsNPi_OFF (20)
+ #define DDRDATA0CH1_CR_RXTRAINRANK1_RxDqsNPi_WID ( 6)
+ #define DDRDATA0CH1_CR_RXTRAINRANK1_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA0CH1_CR_RXTRAINRANK1_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA0CH1_CR_RXTRAINRANK1_RxVref_OFF (26)
+ #define DDRDATA0CH1_CR_RXTRAINRANK1_RxVref_WID ( 6)
+ #define DDRDATA0CH1_CR_RXTRAINRANK1_RxVref_MSK (0xFC000000)
+ #define DDRDATA0CH1_CR_RXTRAINRANK1_RxVref_MAX (0x0000003F)
+
+#define DDRDATA0CH1_CR_RXTRAINRANK2_REG (0x00000108)
+ #define DDRDATA0CH1_CR_RXTRAINRANK2_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA0CH1_CR_RXTRAINRANK2_RxRcvEnPi_WID ( 9)
+ #define DDRDATA0CH1_CR_RXTRAINRANK2_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA0CH1_CR_RXTRAINRANK2_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA0CH1_CR_RXTRAINRANK2_RxDqsPPi_OFF ( 9)
+ #define DDRDATA0CH1_CR_RXTRAINRANK2_RxDqsPPi_WID ( 6)
+ #define DDRDATA0CH1_CR_RXTRAINRANK2_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA0CH1_CR_RXTRAINRANK2_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA0CH1_CR_RXTRAINRANK2_RxEq_OFF (15)
+ #define DDRDATA0CH1_CR_RXTRAINRANK2_RxEq_WID ( 5)
+ #define DDRDATA0CH1_CR_RXTRAINRANK2_RxEq_MSK (0x000F8000)
+ #define DDRDATA0CH1_CR_RXTRAINRANK2_RxEq_MAX (0x0000001F)
+ #define DDRDATA0CH1_CR_RXTRAINRANK2_RxDqsNPi_OFF (20)
+ #define DDRDATA0CH1_CR_RXTRAINRANK2_RxDqsNPi_WID ( 6)
+ #define DDRDATA0CH1_CR_RXTRAINRANK2_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA0CH1_CR_RXTRAINRANK2_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA0CH1_CR_RXTRAINRANK2_RxVref_OFF (26)
+ #define DDRDATA0CH1_CR_RXTRAINRANK2_RxVref_WID ( 6)
+ #define DDRDATA0CH1_CR_RXTRAINRANK2_RxVref_MSK (0xFC000000)
+ #define DDRDATA0CH1_CR_RXTRAINRANK2_RxVref_MAX (0x0000003F)
+
+#define DDRDATA0CH1_CR_RXTRAINRANK3_REG (0x0000010C)
+ #define DDRDATA0CH1_CR_RXTRAINRANK3_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA0CH1_CR_RXTRAINRANK3_RxRcvEnPi_WID ( 9)
+ #define DDRDATA0CH1_CR_RXTRAINRANK3_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA0CH1_CR_RXTRAINRANK3_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA0CH1_CR_RXTRAINRANK3_RxDqsPPi_OFF ( 9)
+ #define DDRDATA0CH1_CR_RXTRAINRANK3_RxDqsPPi_WID ( 6)
+ #define DDRDATA0CH1_CR_RXTRAINRANK3_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA0CH1_CR_RXTRAINRANK3_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA0CH1_CR_RXTRAINRANK3_RxEq_OFF (15)
+ #define DDRDATA0CH1_CR_RXTRAINRANK3_RxEq_WID ( 5)
+ #define DDRDATA0CH1_CR_RXTRAINRANK3_RxEq_MSK (0x000F8000)
+ #define DDRDATA0CH1_CR_RXTRAINRANK3_RxEq_MAX (0x0000001F)
+ #define DDRDATA0CH1_CR_RXTRAINRANK3_RxDqsNPi_OFF (20)
+ #define DDRDATA0CH1_CR_RXTRAINRANK3_RxDqsNPi_WID ( 6)
+ #define DDRDATA0CH1_CR_RXTRAINRANK3_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA0CH1_CR_RXTRAINRANK3_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA0CH1_CR_RXTRAINRANK3_RxVref_OFF (26)
+ #define DDRDATA0CH1_CR_RXTRAINRANK3_RxVref_WID ( 6)
+ #define DDRDATA0CH1_CR_RXTRAINRANK3_RxVref_MSK (0xFC000000)
+ #define DDRDATA0CH1_CR_RXTRAINRANK3_RxVref_MAX (0x0000003F)
+
+#define DDRDATA0CH1_CR_RXPERBITRANK0_REG (0x00000110)
+ #define DDRDATA0CH1_CR_RXPERBITRANK0_Lane0_OFF ( 0)
+ #define DDRDATA0CH1_CR_RXPERBITRANK0_Lane0_WID ( 4)
+ #define DDRDATA0CH1_CR_RXPERBITRANK0_Lane0_MSK (0x0000000F)
+ #define DDRDATA0CH1_CR_RXPERBITRANK0_Lane0_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_RXPERBITRANK0_Lane1_OFF ( 4)
+ #define DDRDATA0CH1_CR_RXPERBITRANK0_Lane1_WID ( 4)
+ #define DDRDATA0CH1_CR_RXPERBITRANK0_Lane1_MSK (0x000000F0)
+ #define DDRDATA0CH1_CR_RXPERBITRANK0_Lane1_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_RXPERBITRANK0_Lane2_OFF ( 8)
+ #define DDRDATA0CH1_CR_RXPERBITRANK0_Lane2_WID ( 4)
+ #define DDRDATA0CH1_CR_RXPERBITRANK0_Lane2_MSK (0x00000F00)
+ #define DDRDATA0CH1_CR_RXPERBITRANK0_Lane2_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_RXPERBITRANK0_Lane3_OFF (12)
+ #define DDRDATA0CH1_CR_RXPERBITRANK0_Lane3_WID ( 4)
+ #define DDRDATA0CH1_CR_RXPERBITRANK0_Lane3_MSK (0x0000F000)
+ #define DDRDATA0CH1_CR_RXPERBITRANK0_Lane3_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_RXPERBITRANK0_Lane4_OFF (16)
+ #define DDRDATA0CH1_CR_RXPERBITRANK0_Lane4_WID ( 4)
+ #define DDRDATA0CH1_CR_RXPERBITRANK0_Lane4_MSK (0x000F0000)
+ #define DDRDATA0CH1_CR_RXPERBITRANK0_Lane4_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_RXPERBITRANK0_Lane5_OFF (20)
+ #define DDRDATA0CH1_CR_RXPERBITRANK0_Lane5_WID ( 4)
+ #define DDRDATA0CH1_CR_RXPERBITRANK0_Lane5_MSK (0x00F00000)
+ #define DDRDATA0CH1_CR_RXPERBITRANK0_Lane5_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_RXPERBITRANK0_Lane6_OFF (24)
+ #define DDRDATA0CH1_CR_RXPERBITRANK0_Lane6_WID ( 4)
+ #define DDRDATA0CH1_CR_RXPERBITRANK0_Lane6_MSK (0x0F000000)
+ #define DDRDATA0CH1_CR_RXPERBITRANK0_Lane6_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_RXPERBITRANK0_Lane7_OFF (28)
+ #define DDRDATA0CH1_CR_RXPERBITRANK0_Lane7_WID ( 4)
+ #define DDRDATA0CH1_CR_RXPERBITRANK0_Lane7_MSK (0xF0000000)
+ #define DDRDATA0CH1_CR_RXPERBITRANK0_Lane7_MAX (0x0000000F)
+
+#define DDRDATA0CH1_CR_RXPERBITRANK1_REG (0x00000114)
+ #define DDRDATA0CH1_CR_RXPERBITRANK1_Lane0_OFF ( 0)
+ #define DDRDATA0CH1_CR_RXPERBITRANK1_Lane0_WID ( 4)
+ #define DDRDATA0CH1_CR_RXPERBITRANK1_Lane0_MSK (0x0000000F)
+ #define DDRDATA0CH1_CR_RXPERBITRANK1_Lane0_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_RXPERBITRANK1_Lane1_OFF ( 4)
+ #define DDRDATA0CH1_CR_RXPERBITRANK1_Lane1_WID ( 4)
+ #define DDRDATA0CH1_CR_RXPERBITRANK1_Lane1_MSK (0x000000F0)
+ #define DDRDATA0CH1_CR_RXPERBITRANK1_Lane1_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_RXPERBITRANK1_Lane2_OFF ( 8)
+ #define DDRDATA0CH1_CR_RXPERBITRANK1_Lane2_WID ( 4)
+ #define DDRDATA0CH1_CR_RXPERBITRANK1_Lane2_MSK (0x00000F00)
+ #define DDRDATA0CH1_CR_RXPERBITRANK1_Lane2_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_RXPERBITRANK1_Lane3_OFF (12)
+ #define DDRDATA0CH1_CR_RXPERBITRANK1_Lane3_WID ( 4)
+ #define DDRDATA0CH1_CR_RXPERBITRANK1_Lane3_MSK (0x0000F000)
+ #define DDRDATA0CH1_CR_RXPERBITRANK1_Lane3_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_RXPERBITRANK1_Lane4_OFF (16)
+ #define DDRDATA0CH1_CR_RXPERBITRANK1_Lane4_WID ( 4)
+ #define DDRDATA0CH1_CR_RXPERBITRANK1_Lane4_MSK (0x000F0000)
+ #define DDRDATA0CH1_CR_RXPERBITRANK1_Lane4_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_RXPERBITRANK1_Lane5_OFF (20)
+ #define DDRDATA0CH1_CR_RXPERBITRANK1_Lane5_WID ( 4)
+ #define DDRDATA0CH1_CR_RXPERBITRANK1_Lane5_MSK (0x00F00000)
+ #define DDRDATA0CH1_CR_RXPERBITRANK1_Lane5_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_RXPERBITRANK1_Lane6_OFF (24)
+ #define DDRDATA0CH1_CR_RXPERBITRANK1_Lane6_WID ( 4)
+ #define DDRDATA0CH1_CR_RXPERBITRANK1_Lane6_MSK (0x0F000000)
+ #define DDRDATA0CH1_CR_RXPERBITRANK1_Lane6_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_RXPERBITRANK1_Lane7_OFF (28)
+ #define DDRDATA0CH1_CR_RXPERBITRANK1_Lane7_WID ( 4)
+ #define DDRDATA0CH1_CR_RXPERBITRANK1_Lane7_MSK (0xF0000000)
+ #define DDRDATA0CH1_CR_RXPERBITRANK1_Lane7_MAX (0x0000000F)
+
+#define DDRDATA0CH1_CR_RXPERBITRANK2_REG (0x00000118)
+ #define DDRDATA0CH1_CR_RXPERBITRANK2_Lane0_OFF ( 0)
+ #define DDRDATA0CH1_CR_RXPERBITRANK2_Lane0_WID ( 4)
+ #define DDRDATA0CH1_CR_RXPERBITRANK2_Lane0_MSK (0x0000000F)
+ #define DDRDATA0CH1_CR_RXPERBITRANK2_Lane0_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_RXPERBITRANK2_Lane1_OFF ( 4)
+ #define DDRDATA0CH1_CR_RXPERBITRANK2_Lane1_WID ( 4)
+ #define DDRDATA0CH1_CR_RXPERBITRANK2_Lane1_MSK (0x000000F0)
+ #define DDRDATA0CH1_CR_RXPERBITRANK2_Lane1_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_RXPERBITRANK2_Lane2_OFF ( 8)
+ #define DDRDATA0CH1_CR_RXPERBITRANK2_Lane2_WID ( 4)
+ #define DDRDATA0CH1_CR_RXPERBITRANK2_Lane2_MSK (0x00000F00)
+ #define DDRDATA0CH1_CR_RXPERBITRANK2_Lane2_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_RXPERBITRANK2_Lane3_OFF (12)
+ #define DDRDATA0CH1_CR_RXPERBITRANK2_Lane3_WID ( 4)
+ #define DDRDATA0CH1_CR_RXPERBITRANK2_Lane3_MSK (0x0000F000)
+ #define DDRDATA0CH1_CR_RXPERBITRANK2_Lane3_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_RXPERBITRANK2_Lane4_OFF (16)
+ #define DDRDATA0CH1_CR_RXPERBITRANK2_Lane4_WID ( 4)
+ #define DDRDATA0CH1_CR_RXPERBITRANK2_Lane4_MSK (0x000F0000)
+ #define DDRDATA0CH1_CR_RXPERBITRANK2_Lane4_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_RXPERBITRANK2_Lane5_OFF (20)
+ #define DDRDATA0CH1_CR_RXPERBITRANK2_Lane5_WID ( 4)
+ #define DDRDATA0CH1_CR_RXPERBITRANK2_Lane5_MSK (0x00F00000)
+ #define DDRDATA0CH1_CR_RXPERBITRANK2_Lane5_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_RXPERBITRANK2_Lane6_OFF (24)
+ #define DDRDATA0CH1_CR_RXPERBITRANK2_Lane6_WID ( 4)
+ #define DDRDATA0CH1_CR_RXPERBITRANK2_Lane6_MSK (0x0F000000)
+ #define DDRDATA0CH1_CR_RXPERBITRANK2_Lane6_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_RXPERBITRANK2_Lane7_OFF (28)
+ #define DDRDATA0CH1_CR_RXPERBITRANK2_Lane7_WID ( 4)
+ #define DDRDATA0CH1_CR_RXPERBITRANK2_Lane7_MSK (0xF0000000)
+ #define DDRDATA0CH1_CR_RXPERBITRANK2_Lane7_MAX (0x0000000F)
+
+#define DDRDATA0CH1_CR_RXPERBITRANK3_REG (0x0000011C)
+ #define DDRDATA0CH1_CR_RXPERBITRANK3_Lane0_OFF ( 0)
+ #define DDRDATA0CH1_CR_RXPERBITRANK3_Lane0_WID ( 4)
+ #define DDRDATA0CH1_CR_RXPERBITRANK3_Lane0_MSK (0x0000000F)
+ #define DDRDATA0CH1_CR_RXPERBITRANK3_Lane0_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_RXPERBITRANK3_Lane1_OFF ( 4)
+ #define DDRDATA0CH1_CR_RXPERBITRANK3_Lane1_WID ( 4)
+ #define DDRDATA0CH1_CR_RXPERBITRANK3_Lane1_MSK (0x000000F0)
+ #define DDRDATA0CH1_CR_RXPERBITRANK3_Lane1_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_RXPERBITRANK3_Lane2_OFF ( 8)
+ #define DDRDATA0CH1_CR_RXPERBITRANK3_Lane2_WID ( 4)
+ #define DDRDATA0CH1_CR_RXPERBITRANK3_Lane2_MSK (0x00000F00)
+ #define DDRDATA0CH1_CR_RXPERBITRANK3_Lane2_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_RXPERBITRANK3_Lane3_OFF (12)
+ #define DDRDATA0CH1_CR_RXPERBITRANK3_Lane3_WID ( 4)
+ #define DDRDATA0CH1_CR_RXPERBITRANK3_Lane3_MSK (0x0000F000)
+ #define DDRDATA0CH1_CR_RXPERBITRANK3_Lane3_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_RXPERBITRANK3_Lane4_OFF (16)
+ #define DDRDATA0CH1_CR_RXPERBITRANK3_Lane4_WID ( 4)
+ #define DDRDATA0CH1_CR_RXPERBITRANK3_Lane4_MSK (0x000F0000)
+ #define DDRDATA0CH1_CR_RXPERBITRANK3_Lane4_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_RXPERBITRANK3_Lane5_OFF (20)
+ #define DDRDATA0CH1_CR_RXPERBITRANK3_Lane5_WID ( 4)
+ #define DDRDATA0CH1_CR_RXPERBITRANK3_Lane5_MSK (0x00F00000)
+ #define DDRDATA0CH1_CR_RXPERBITRANK3_Lane5_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_RXPERBITRANK3_Lane6_OFF (24)
+ #define DDRDATA0CH1_CR_RXPERBITRANK3_Lane6_WID ( 4)
+ #define DDRDATA0CH1_CR_RXPERBITRANK3_Lane6_MSK (0x0F000000)
+ #define DDRDATA0CH1_CR_RXPERBITRANK3_Lane6_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_RXPERBITRANK3_Lane7_OFF (28)
+ #define DDRDATA0CH1_CR_RXPERBITRANK3_Lane7_WID ( 4)
+ #define DDRDATA0CH1_CR_RXPERBITRANK3_Lane7_MSK (0xF0000000)
+ #define DDRDATA0CH1_CR_RXPERBITRANK3_Lane7_MAX (0x0000000F)
+
+#define DDRDATA0CH1_CR_TXTRAINRANK0_REG (0x00000120)
+ #define DDRDATA0CH1_CR_TXTRAINRANK0_TxDqDelay_OFF ( 0)
+ #define DDRDATA0CH1_CR_TXTRAINRANK0_TxDqDelay_WID ( 9)
+ #define DDRDATA0CH1_CR_TXTRAINRANK0_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA0CH1_CR_TXTRAINRANK0_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA0CH1_CR_TXTRAINRANK0_TxDqsDelay_OFF ( 9)
+ #define DDRDATA0CH1_CR_TXTRAINRANK0_TxDqsDelay_WID ( 9)
+ #define DDRDATA0CH1_CR_TXTRAINRANK0_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA0CH1_CR_TXTRAINRANK0_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA0CH1_CR_TXTRAINRANK0_Spare0_OFF (18)
+ #define DDRDATA0CH1_CR_TXTRAINRANK0_Spare0_WID ( 2)
+ #define DDRDATA0CH1_CR_TXTRAINRANK0_Spare0_MSK (0x000C0000)
+ #define DDRDATA0CH1_CR_TXTRAINRANK0_Spare0_MAX (0x00000003)
+ #define DDRDATA0CH1_CR_TXTRAINRANK0_TxEqualization_OFF (20)
+ #define DDRDATA0CH1_CR_TXTRAINRANK0_TxEqualization_WID ( 6)
+ #define DDRDATA0CH1_CR_TXTRAINRANK0_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA0CH1_CR_TXTRAINRANK0_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA0CH1_CR_TXTRAINRANK0_Spare1_OFF (26)
+ #define DDRDATA0CH1_CR_TXTRAINRANK0_Spare1_WID ( 6)
+ #define DDRDATA0CH1_CR_TXTRAINRANK0_Spare1_MSK (0xFC000000)
+ #define DDRDATA0CH1_CR_TXTRAINRANK0_Spare1_MAX (0x0000003F)
+
+#define DDRDATA0CH1_CR_TXTRAINRANK1_REG (0x00000124)
+ #define DDRDATA0CH1_CR_TXTRAINRANK1_TxDqDelay_OFF ( 0)
+ #define DDRDATA0CH1_CR_TXTRAINRANK1_TxDqDelay_WID ( 9)
+ #define DDRDATA0CH1_CR_TXTRAINRANK1_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA0CH1_CR_TXTRAINRANK1_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA0CH1_CR_TXTRAINRANK1_TxDqsDelay_OFF ( 9)
+ #define DDRDATA0CH1_CR_TXTRAINRANK1_TxDqsDelay_WID ( 9)
+ #define DDRDATA0CH1_CR_TXTRAINRANK1_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA0CH1_CR_TXTRAINRANK1_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA0CH1_CR_TXTRAINRANK1_Spare0_OFF (18)
+ #define DDRDATA0CH1_CR_TXTRAINRANK1_Spare0_WID ( 2)
+ #define DDRDATA0CH1_CR_TXTRAINRANK1_Spare0_MSK (0x000C0000)
+ #define DDRDATA0CH1_CR_TXTRAINRANK1_Spare0_MAX (0x00000003)
+ #define DDRDATA0CH1_CR_TXTRAINRANK1_TxEqualization_OFF (20)
+ #define DDRDATA0CH1_CR_TXTRAINRANK1_TxEqualization_WID ( 6)
+ #define DDRDATA0CH1_CR_TXTRAINRANK1_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA0CH1_CR_TXTRAINRANK1_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA0CH1_CR_TXTRAINRANK1_Spare1_OFF (26)
+ #define DDRDATA0CH1_CR_TXTRAINRANK1_Spare1_WID ( 6)
+ #define DDRDATA0CH1_CR_TXTRAINRANK1_Spare1_MSK (0xFC000000)
+ #define DDRDATA0CH1_CR_TXTRAINRANK1_Spare1_MAX (0x0000003F)
+
+#define DDRDATA0CH1_CR_TXTRAINRANK2_REG (0x00000128)
+ #define DDRDATA0CH1_CR_TXTRAINRANK2_TxDqDelay_OFF ( 0)
+ #define DDRDATA0CH1_CR_TXTRAINRANK2_TxDqDelay_WID ( 9)
+ #define DDRDATA0CH1_CR_TXTRAINRANK2_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA0CH1_CR_TXTRAINRANK2_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA0CH1_CR_TXTRAINRANK2_TxDqsDelay_OFF ( 9)
+ #define DDRDATA0CH1_CR_TXTRAINRANK2_TxDqsDelay_WID ( 9)
+ #define DDRDATA0CH1_CR_TXTRAINRANK2_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA0CH1_CR_TXTRAINRANK2_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA0CH1_CR_TXTRAINRANK2_Spare0_OFF (18)
+ #define DDRDATA0CH1_CR_TXTRAINRANK2_Spare0_WID ( 2)
+ #define DDRDATA0CH1_CR_TXTRAINRANK2_Spare0_MSK (0x000C0000)
+ #define DDRDATA0CH1_CR_TXTRAINRANK2_Spare0_MAX (0x00000003)
+ #define DDRDATA0CH1_CR_TXTRAINRANK2_TxEqualization_OFF (20)
+ #define DDRDATA0CH1_CR_TXTRAINRANK2_TxEqualization_WID ( 6)
+ #define DDRDATA0CH1_CR_TXTRAINRANK2_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA0CH1_CR_TXTRAINRANK2_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA0CH1_CR_TXTRAINRANK2_Spare1_OFF (26)
+ #define DDRDATA0CH1_CR_TXTRAINRANK2_Spare1_WID ( 6)
+ #define DDRDATA0CH1_CR_TXTRAINRANK2_Spare1_MSK (0xFC000000)
+ #define DDRDATA0CH1_CR_TXTRAINRANK2_Spare1_MAX (0x0000003F)
+
+#define DDRDATA0CH1_CR_TXTRAINRANK3_REG (0x0000012C)
+ #define DDRDATA0CH1_CR_TXTRAINRANK3_TxDqDelay_OFF ( 0)
+ #define DDRDATA0CH1_CR_TXTRAINRANK3_TxDqDelay_WID ( 9)
+ #define DDRDATA0CH1_CR_TXTRAINRANK3_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA0CH1_CR_TXTRAINRANK3_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA0CH1_CR_TXTRAINRANK3_TxDqsDelay_OFF ( 9)
+ #define DDRDATA0CH1_CR_TXTRAINRANK3_TxDqsDelay_WID ( 9)
+ #define DDRDATA0CH1_CR_TXTRAINRANK3_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA0CH1_CR_TXTRAINRANK3_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA0CH1_CR_TXTRAINRANK3_Spare0_OFF (18)
+ #define DDRDATA0CH1_CR_TXTRAINRANK3_Spare0_WID ( 2)
+ #define DDRDATA0CH1_CR_TXTRAINRANK3_Spare0_MSK (0x000C0000)
+ #define DDRDATA0CH1_CR_TXTRAINRANK3_Spare0_MAX (0x00000003)
+ #define DDRDATA0CH1_CR_TXTRAINRANK3_TxEqualization_OFF (20)
+ #define DDRDATA0CH1_CR_TXTRAINRANK3_TxEqualization_WID ( 6)
+ #define DDRDATA0CH1_CR_TXTRAINRANK3_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA0CH1_CR_TXTRAINRANK3_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA0CH1_CR_TXTRAINRANK3_Spare1_OFF (26)
+ #define DDRDATA0CH1_CR_TXTRAINRANK3_Spare1_WID ( 6)
+ #define DDRDATA0CH1_CR_TXTRAINRANK3_Spare1_MSK (0xFC000000)
+ #define DDRDATA0CH1_CR_TXTRAINRANK3_Spare1_MAX (0x0000003F)
+
+#define DDRDATA0CH1_CR_TXPERBITRANK0_REG (0x00000130)
+ #define DDRDATA0CH1_CR_TXPERBITRANK0_Lane0_OFF ( 0)
+ #define DDRDATA0CH1_CR_TXPERBITRANK0_Lane0_WID ( 4)
+ #define DDRDATA0CH1_CR_TXPERBITRANK0_Lane0_MSK (0x0000000F)
+ #define DDRDATA0CH1_CR_TXPERBITRANK0_Lane0_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_TXPERBITRANK0_Lane1_OFF ( 4)
+ #define DDRDATA0CH1_CR_TXPERBITRANK0_Lane1_WID ( 4)
+ #define DDRDATA0CH1_CR_TXPERBITRANK0_Lane1_MSK (0x000000F0)
+ #define DDRDATA0CH1_CR_TXPERBITRANK0_Lane1_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_TXPERBITRANK0_Lane2_OFF ( 8)
+ #define DDRDATA0CH1_CR_TXPERBITRANK0_Lane2_WID ( 4)
+ #define DDRDATA0CH1_CR_TXPERBITRANK0_Lane2_MSK (0x00000F00)
+ #define DDRDATA0CH1_CR_TXPERBITRANK0_Lane2_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_TXPERBITRANK0_Lane3_OFF (12)
+ #define DDRDATA0CH1_CR_TXPERBITRANK0_Lane3_WID ( 4)
+ #define DDRDATA0CH1_CR_TXPERBITRANK0_Lane3_MSK (0x0000F000)
+ #define DDRDATA0CH1_CR_TXPERBITRANK0_Lane3_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_TXPERBITRANK0_Lane4_OFF (16)
+ #define DDRDATA0CH1_CR_TXPERBITRANK0_Lane4_WID ( 4)
+ #define DDRDATA0CH1_CR_TXPERBITRANK0_Lane4_MSK (0x000F0000)
+ #define DDRDATA0CH1_CR_TXPERBITRANK0_Lane4_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_TXPERBITRANK0_Lane5_OFF (20)
+ #define DDRDATA0CH1_CR_TXPERBITRANK0_Lane5_WID ( 4)
+ #define DDRDATA0CH1_CR_TXPERBITRANK0_Lane5_MSK (0x00F00000)
+ #define DDRDATA0CH1_CR_TXPERBITRANK0_Lane5_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_TXPERBITRANK0_Lane6_OFF (24)
+ #define DDRDATA0CH1_CR_TXPERBITRANK0_Lane6_WID ( 4)
+ #define DDRDATA0CH1_CR_TXPERBITRANK0_Lane6_MSK (0x0F000000)
+ #define DDRDATA0CH1_CR_TXPERBITRANK0_Lane6_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_TXPERBITRANK0_Lane7_OFF (28)
+ #define DDRDATA0CH1_CR_TXPERBITRANK0_Lane7_WID ( 4)
+ #define DDRDATA0CH1_CR_TXPERBITRANK0_Lane7_MSK (0xF0000000)
+ #define DDRDATA0CH1_CR_TXPERBITRANK0_Lane7_MAX (0x0000000F)
+
+#define DDRDATA0CH1_CR_TXPERBITRANK1_REG (0x00000134)
+ #define DDRDATA0CH1_CR_TXPERBITRANK1_Lane0_OFF ( 0)
+ #define DDRDATA0CH1_CR_TXPERBITRANK1_Lane0_WID ( 4)
+ #define DDRDATA0CH1_CR_TXPERBITRANK1_Lane0_MSK (0x0000000F)
+ #define DDRDATA0CH1_CR_TXPERBITRANK1_Lane0_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_TXPERBITRANK1_Lane1_OFF ( 4)
+ #define DDRDATA0CH1_CR_TXPERBITRANK1_Lane1_WID ( 4)
+ #define DDRDATA0CH1_CR_TXPERBITRANK1_Lane1_MSK (0x000000F0)
+ #define DDRDATA0CH1_CR_TXPERBITRANK1_Lane1_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_TXPERBITRANK1_Lane2_OFF ( 8)
+ #define DDRDATA0CH1_CR_TXPERBITRANK1_Lane2_WID ( 4)
+ #define DDRDATA0CH1_CR_TXPERBITRANK1_Lane2_MSK (0x00000F00)
+ #define DDRDATA0CH1_CR_TXPERBITRANK1_Lane2_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_TXPERBITRANK1_Lane3_OFF (12)
+ #define DDRDATA0CH1_CR_TXPERBITRANK1_Lane3_WID ( 4)
+ #define DDRDATA0CH1_CR_TXPERBITRANK1_Lane3_MSK (0x0000F000)
+ #define DDRDATA0CH1_CR_TXPERBITRANK1_Lane3_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_TXPERBITRANK1_Lane4_OFF (16)
+ #define DDRDATA0CH1_CR_TXPERBITRANK1_Lane4_WID ( 4)
+ #define DDRDATA0CH1_CR_TXPERBITRANK1_Lane4_MSK (0x000F0000)
+ #define DDRDATA0CH1_CR_TXPERBITRANK1_Lane4_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_TXPERBITRANK1_Lane5_OFF (20)
+ #define DDRDATA0CH1_CR_TXPERBITRANK1_Lane5_WID ( 4)
+ #define DDRDATA0CH1_CR_TXPERBITRANK1_Lane5_MSK (0x00F00000)
+ #define DDRDATA0CH1_CR_TXPERBITRANK1_Lane5_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_TXPERBITRANK1_Lane6_OFF (24)
+ #define DDRDATA0CH1_CR_TXPERBITRANK1_Lane6_WID ( 4)
+ #define DDRDATA0CH1_CR_TXPERBITRANK1_Lane6_MSK (0x0F000000)
+ #define DDRDATA0CH1_CR_TXPERBITRANK1_Lane6_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_TXPERBITRANK1_Lane7_OFF (28)
+ #define DDRDATA0CH1_CR_TXPERBITRANK1_Lane7_WID ( 4)
+ #define DDRDATA0CH1_CR_TXPERBITRANK1_Lane7_MSK (0xF0000000)
+ #define DDRDATA0CH1_CR_TXPERBITRANK1_Lane7_MAX (0x0000000F)
+
+#define DDRDATA0CH1_CR_TXPERBITRANK2_REG (0x00000138)
+ #define DDRDATA0CH1_CR_TXPERBITRANK2_Lane0_OFF ( 0)
+ #define DDRDATA0CH1_CR_TXPERBITRANK2_Lane0_WID ( 4)
+ #define DDRDATA0CH1_CR_TXPERBITRANK2_Lane0_MSK (0x0000000F)
+ #define DDRDATA0CH1_CR_TXPERBITRANK2_Lane0_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_TXPERBITRANK2_Lane1_OFF ( 4)
+ #define DDRDATA0CH1_CR_TXPERBITRANK2_Lane1_WID ( 4)
+ #define DDRDATA0CH1_CR_TXPERBITRANK2_Lane1_MSK (0x000000F0)
+ #define DDRDATA0CH1_CR_TXPERBITRANK2_Lane1_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_TXPERBITRANK2_Lane2_OFF ( 8)
+ #define DDRDATA0CH1_CR_TXPERBITRANK2_Lane2_WID ( 4)
+ #define DDRDATA0CH1_CR_TXPERBITRANK2_Lane2_MSK (0x00000F00)
+ #define DDRDATA0CH1_CR_TXPERBITRANK2_Lane2_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_TXPERBITRANK2_Lane3_OFF (12)
+ #define DDRDATA0CH1_CR_TXPERBITRANK2_Lane3_WID ( 4)
+ #define DDRDATA0CH1_CR_TXPERBITRANK2_Lane3_MSK (0x0000F000)
+ #define DDRDATA0CH1_CR_TXPERBITRANK2_Lane3_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_TXPERBITRANK2_Lane4_OFF (16)
+ #define DDRDATA0CH1_CR_TXPERBITRANK2_Lane4_WID ( 4)
+ #define DDRDATA0CH1_CR_TXPERBITRANK2_Lane4_MSK (0x000F0000)
+ #define DDRDATA0CH1_CR_TXPERBITRANK2_Lane4_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_TXPERBITRANK2_Lane5_OFF (20)
+ #define DDRDATA0CH1_CR_TXPERBITRANK2_Lane5_WID ( 4)
+ #define DDRDATA0CH1_CR_TXPERBITRANK2_Lane5_MSK (0x00F00000)
+ #define DDRDATA0CH1_CR_TXPERBITRANK2_Lane5_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_TXPERBITRANK2_Lane6_OFF (24)
+ #define DDRDATA0CH1_CR_TXPERBITRANK2_Lane6_WID ( 4)
+ #define DDRDATA0CH1_CR_TXPERBITRANK2_Lane6_MSK (0x0F000000)
+ #define DDRDATA0CH1_CR_TXPERBITRANK2_Lane6_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_TXPERBITRANK2_Lane7_OFF (28)
+ #define DDRDATA0CH1_CR_TXPERBITRANK2_Lane7_WID ( 4)
+ #define DDRDATA0CH1_CR_TXPERBITRANK2_Lane7_MSK (0xF0000000)
+ #define DDRDATA0CH1_CR_TXPERBITRANK2_Lane7_MAX (0x0000000F)
+
+#define DDRDATA0CH1_CR_TXPERBITRANK3_REG (0x0000013C)
+ #define DDRDATA0CH1_CR_TXPERBITRANK3_Lane0_OFF ( 0)
+ #define DDRDATA0CH1_CR_TXPERBITRANK3_Lane0_WID ( 4)
+ #define DDRDATA0CH1_CR_TXPERBITRANK3_Lane0_MSK (0x0000000F)
+ #define DDRDATA0CH1_CR_TXPERBITRANK3_Lane0_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_TXPERBITRANK3_Lane1_OFF ( 4)
+ #define DDRDATA0CH1_CR_TXPERBITRANK3_Lane1_WID ( 4)
+ #define DDRDATA0CH1_CR_TXPERBITRANK3_Lane1_MSK (0x000000F0)
+ #define DDRDATA0CH1_CR_TXPERBITRANK3_Lane1_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_TXPERBITRANK3_Lane2_OFF ( 8)
+ #define DDRDATA0CH1_CR_TXPERBITRANK3_Lane2_WID ( 4)
+ #define DDRDATA0CH1_CR_TXPERBITRANK3_Lane2_MSK (0x00000F00)
+ #define DDRDATA0CH1_CR_TXPERBITRANK3_Lane2_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_TXPERBITRANK3_Lane3_OFF (12)
+ #define DDRDATA0CH1_CR_TXPERBITRANK3_Lane3_WID ( 4)
+ #define DDRDATA0CH1_CR_TXPERBITRANK3_Lane3_MSK (0x0000F000)
+ #define DDRDATA0CH1_CR_TXPERBITRANK3_Lane3_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_TXPERBITRANK3_Lane4_OFF (16)
+ #define DDRDATA0CH1_CR_TXPERBITRANK3_Lane4_WID ( 4)
+ #define DDRDATA0CH1_CR_TXPERBITRANK3_Lane4_MSK (0x000F0000)
+ #define DDRDATA0CH1_CR_TXPERBITRANK3_Lane4_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_TXPERBITRANK3_Lane5_OFF (20)
+ #define DDRDATA0CH1_CR_TXPERBITRANK3_Lane5_WID ( 4)
+ #define DDRDATA0CH1_CR_TXPERBITRANK3_Lane5_MSK (0x00F00000)
+ #define DDRDATA0CH1_CR_TXPERBITRANK3_Lane5_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_TXPERBITRANK3_Lane6_OFF (24)
+ #define DDRDATA0CH1_CR_TXPERBITRANK3_Lane6_WID ( 4)
+ #define DDRDATA0CH1_CR_TXPERBITRANK3_Lane6_MSK (0x0F000000)
+ #define DDRDATA0CH1_CR_TXPERBITRANK3_Lane6_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_TXPERBITRANK3_Lane7_OFF (28)
+ #define DDRDATA0CH1_CR_TXPERBITRANK3_Lane7_WID ( 4)
+ #define DDRDATA0CH1_CR_TXPERBITRANK3_Lane7_MSK (0xF0000000)
+ #define DDRDATA0CH1_CR_TXPERBITRANK3_Lane7_MAX (0x0000000F)
+
+#define DDRDATA0CH1_CR_RCOMPDATA0_REG (0x00000140)
+ #define DDRDATA0CH1_CR_RCOMPDATA0_RcompDrvUp_OFF ( 0)
+ #define DDRDATA0CH1_CR_RCOMPDATA0_RcompDrvUp_WID ( 6)
+ #define DDRDATA0CH1_CR_RCOMPDATA0_RcompDrvUp_MSK (0x0000003F)
+ #define DDRDATA0CH1_CR_RCOMPDATA0_RcompDrvUp_MAX (0x0000003F)
+ #define DDRDATA0CH1_CR_RCOMPDATA0_Spare0_OFF ( 6)
+ #define DDRDATA0CH1_CR_RCOMPDATA0_Spare0_WID ( 3)
+ #define DDRDATA0CH1_CR_RCOMPDATA0_Spare0_MSK (0x000001C0)
+ #define DDRDATA0CH1_CR_RCOMPDATA0_Spare0_MAX (0x00000007)
+ #define DDRDATA0CH1_CR_RCOMPDATA0_RcompDrvDown_OFF ( 9)
+ #define DDRDATA0CH1_CR_RCOMPDATA0_RcompDrvDown_WID ( 6)
+ #define DDRDATA0CH1_CR_RCOMPDATA0_RcompDrvDown_MSK (0x00007E00)
+ #define DDRDATA0CH1_CR_RCOMPDATA0_RcompDrvDown_MAX (0x0000003F)
+ #define DDRDATA0CH1_CR_RCOMPDATA0_VTComp_OFF (15)
+ #define DDRDATA0CH1_CR_RCOMPDATA0_VTComp_WID ( 5)
+ #define DDRDATA0CH1_CR_RCOMPDATA0_VTComp_MSK (0x000F8000)
+ #define DDRDATA0CH1_CR_RCOMPDATA0_VTComp_MAX (0x0000001F)
+ #define DDRDATA0CH1_CR_RCOMPDATA0_TcoComp_OFF (20)
+ #define DDRDATA0CH1_CR_RCOMPDATA0_TcoComp_WID ( 6)
+ #define DDRDATA0CH1_CR_RCOMPDATA0_TcoComp_MSK (0x03F00000)
+ #define DDRDATA0CH1_CR_RCOMPDATA0_TcoComp_MAX (0x0000003F)
+ #define DDRDATA0CH1_CR_RCOMPDATA0_SlewRateComp_OFF (26)
+ #define DDRDATA0CH1_CR_RCOMPDATA0_SlewRateComp_WID ( 5)
+ #define DDRDATA0CH1_CR_RCOMPDATA0_SlewRateComp_MSK (0x7C000000)
+ #define DDRDATA0CH1_CR_RCOMPDATA0_SlewRateComp_MAX (0x0000001F)
+ #define DDRDATA0CH1_CR_RCOMPDATA0_Spare2_OFF (31)
+ #define DDRDATA0CH1_CR_RCOMPDATA0_Spare2_WID ( 1)
+ #define DDRDATA0CH1_CR_RCOMPDATA0_Spare2_MSK (0x80000000)
+ #define DDRDATA0CH1_CR_RCOMPDATA0_Spare2_MAX (0x00000001)
+
+#define DDRDATA0CH1_CR_RCOMPDATA1_REG (0x00000144)
+ #define DDRDATA0CH1_CR_RCOMPDATA1_RcompOdtUp_OFF ( 0)
+ #define DDRDATA0CH1_CR_RCOMPDATA1_RcompOdtUp_WID ( 6)
+ #define DDRDATA0CH1_CR_RCOMPDATA1_RcompOdtUp_MSK (0x0000003F)
+ #define DDRDATA0CH1_CR_RCOMPDATA1_RcompOdtUp_MAX (0x0000003F)
+ #define DDRDATA0CH1_CR_RCOMPDATA1_Spare0_OFF ( 6)
+ #define DDRDATA0CH1_CR_RCOMPDATA1_Spare0_WID ( 3)
+ #define DDRDATA0CH1_CR_RCOMPDATA1_Spare0_MSK (0x000001C0)
+ #define DDRDATA0CH1_CR_RCOMPDATA1_Spare0_MAX (0x00000007)
+ #define DDRDATA0CH1_CR_RCOMPDATA1_RcompOdtDown_OFF ( 9)
+ #define DDRDATA0CH1_CR_RCOMPDATA1_RcompOdtDown_WID ( 6)
+ #define DDRDATA0CH1_CR_RCOMPDATA1_RcompOdtDown_MSK (0x00007E00)
+ #define DDRDATA0CH1_CR_RCOMPDATA1_RcompOdtDown_MAX (0x0000003F)
+ #define DDRDATA0CH1_CR_RCOMPDATA1_Spare1_OFF (15)
+ #define DDRDATA0CH1_CR_RCOMPDATA1_Spare1_WID ( 1)
+ #define DDRDATA0CH1_CR_RCOMPDATA1_Spare1_MSK (0x00008000)
+ #define DDRDATA0CH1_CR_RCOMPDATA1_Spare1_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_RCOMPDATA1_PanicDrvDn_OFF (16)
+ #define DDRDATA0CH1_CR_RCOMPDATA1_PanicDrvDn_WID ( 6)
+ #define DDRDATA0CH1_CR_RCOMPDATA1_PanicDrvDn_MSK (0x003F0000)
+ #define DDRDATA0CH1_CR_RCOMPDATA1_PanicDrvDn_MAX (0x0000003F)
+ #define DDRDATA0CH1_CR_RCOMPDATA1_PanicDrvUp_OFF (22)
+ #define DDRDATA0CH1_CR_RCOMPDATA1_PanicDrvUp_WID ( 6)
+ #define DDRDATA0CH1_CR_RCOMPDATA1_PanicDrvUp_MSK (0x0FC00000)
+ #define DDRDATA0CH1_CR_RCOMPDATA1_PanicDrvUp_MAX (0x0000003F)
+ #define DDRDATA0CH1_CR_RCOMPDATA1_LevelShifterComp_OFF (28)
+ #define DDRDATA0CH1_CR_RCOMPDATA1_LevelShifterComp_WID ( 3)
+ #define DDRDATA0CH1_CR_RCOMPDATA1_LevelShifterComp_MSK (0x70000000)
+ #define DDRDATA0CH1_CR_RCOMPDATA1_LevelShifterComp_MAX (0x00000007)
+ #define DDRDATA0CH1_CR_RCOMPDATA1_Spare2_OFF (31)
+ #define DDRDATA0CH1_CR_RCOMPDATA1_Spare2_WID ( 1)
+ #define DDRDATA0CH1_CR_RCOMPDATA1_Spare2_MSK (0x80000000)
+ #define DDRDATA0CH1_CR_RCOMPDATA1_Spare2_MAX (0x00000001)
+
+#define DDRDATA0CH1_CR_TXXTALK_REG (0x00000148)
+ #define DDRDATA0CH1_CR_TXXTALK_Lane0_OFF ( 0)
+ #define DDRDATA0CH1_CR_TXXTALK_Lane0_WID ( 4)
+ #define DDRDATA0CH1_CR_TXXTALK_Lane0_MSK (0x0000000F)
+ #define DDRDATA0CH1_CR_TXXTALK_Lane0_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_TXXTALK_Lane1_OFF ( 4)
+ #define DDRDATA0CH1_CR_TXXTALK_Lane1_WID ( 4)
+ #define DDRDATA0CH1_CR_TXXTALK_Lane1_MSK (0x000000F0)
+ #define DDRDATA0CH1_CR_TXXTALK_Lane1_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_TXXTALK_Lane2_OFF ( 8)
+ #define DDRDATA0CH1_CR_TXXTALK_Lane2_WID ( 4)
+ #define DDRDATA0CH1_CR_TXXTALK_Lane2_MSK (0x00000F00)
+ #define DDRDATA0CH1_CR_TXXTALK_Lane2_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_TXXTALK_Lane3_OFF (12)
+ #define DDRDATA0CH1_CR_TXXTALK_Lane3_WID ( 4)
+ #define DDRDATA0CH1_CR_TXXTALK_Lane3_MSK (0x0000F000)
+ #define DDRDATA0CH1_CR_TXXTALK_Lane3_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_TXXTALK_Lane4_OFF (16)
+ #define DDRDATA0CH1_CR_TXXTALK_Lane4_WID ( 4)
+ #define DDRDATA0CH1_CR_TXXTALK_Lane4_MSK (0x000F0000)
+ #define DDRDATA0CH1_CR_TXXTALK_Lane4_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_TXXTALK_Lane5_OFF (20)
+ #define DDRDATA0CH1_CR_TXXTALK_Lane5_WID ( 4)
+ #define DDRDATA0CH1_CR_TXXTALK_Lane5_MSK (0x00F00000)
+ #define DDRDATA0CH1_CR_TXXTALK_Lane5_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_TXXTALK_Lane6_OFF (24)
+ #define DDRDATA0CH1_CR_TXXTALK_Lane6_WID ( 4)
+ #define DDRDATA0CH1_CR_TXXTALK_Lane6_MSK (0x0F000000)
+ #define DDRDATA0CH1_CR_TXXTALK_Lane6_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_TXXTALK_Lane7_OFF (28)
+ #define DDRDATA0CH1_CR_TXXTALK_Lane7_WID ( 4)
+ #define DDRDATA0CH1_CR_TXXTALK_Lane7_MSK (0xF0000000)
+ #define DDRDATA0CH1_CR_TXXTALK_Lane7_MAX (0x0000000F)
+
+#define DDRDATA0CH1_CR_RXOFFSETVDQ_REG (0x0000014C)
+ #define DDRDATA0CH1_CR_RXOFFSETVDQ_Lane0_OFF ( 0)
+ #define DDRDATA0CH1_CR_RXOFFSETVDQ_Lane0_WID ( 4)
+ #define DDRDATA0CH1_CR_RXOFFSETVDQ_Lane0_MSK (0x0000000F)
+ #define DDRDATA0CH1_CR_RXOFFSETVDQ_Lane0_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_RXOFFSETVDQ_Lane1_OFF ( 4)
+ #define DDRDATA0CH1_CR_RXOFFSETVDQ_Lane1_WID ( 4)
+ #define DDRDATA0CH1_CR_RXOFFSETVDQ_Lane1_MSK (0x000000F0)
+ #define DDRDATA0CH1_CR_RXOFFSETVDQ_Lane1_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_RXOFFSETVDQ_Lane2_OFF ( 8)
+ #define DDRDATA0CH1_CR_RXOFFSETVDQ_Lane2_WID ( 4)
+ #define DDRDATA0CH1_CR_RXOFFSETVDQ_Lane2_MSK (0x00000F00)
+ #define DDRDATA0CH1_CR_RXOFFSETVDQ_Lane2_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_RXOFFSETVDQ_Lane3_OFF (12)
+ #define DDRDATA0CH1_CR_RXOFFSETVDQ_Lane3_WID ( 4)
+ #define DDRDATA0CH1_CR_RXOFFSETVDQ_Lane3_MSK (0x0000F000)
+ #define DDRDATA0CH1_CR_RXOFFSETVDQ_Lane3_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_RXOFFSETVDQ_Lane4_OFF (16)
+ #define DDRDATA0CH1_CR_RXOFFSETVDQ_Lane4_WID ( 4)
+ #define DDRDATA0CH1_CR_RXOFFSETVDQ_Lane4_MSK (0x000F0000)
+ #define DDRDATA0CH1_CR_RXOFFSETVDQ_Lane4_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_RXOFFSETVDQ_Lane5_OFF (20)
+ #define DDRDATA0CH1_CR_RXOFFSETVDQ_Lane5_WID ( 4)
+ #define DDRDATA0CH1_CR_RXOFFSETVDQ_Lane5_MSK (0x00F00000)
+ #define DDRDATA0CH1_CR_RXOFFSETVDQ_Lane5_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_RXOFFSETVDQ_Lane6_OFF (24)
+ #define DDRDATA0CH1_CR_RXOFFSETVDQ_Lane6_WID ( 4)
+ #define DDRDATA0CH1_CR_RXOFFSETVDQ_Lane6_MSK (0x0F000000)
+ #define DDRDATA0CH1_CR_RXOFFSETVDQ_Lane6_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_RXOFFSETVDQ_Lane7_OFF (28)
+ #define DDRDATA0CH1_CR_RXOFFSETVDQ_Lane7_WID ( 4)
+ #define DDRDATA0CH1_CR_RXOFFSETVDQ_Lane7_MSK (0xF0000000)
+ #define DDRDATA0CH1_CR_RXOFFSETVDQ_Lane7_MAX (0x0000000F)
+
+#define DDRDATA0CH1_CR_DDRDATARESERVED_REG (0x00000150)
+ #define DDRDATA0CH1_CR_DDRDATARESERVED_Spare_OFF ( 0)
+ #define DDRDATA0CH1_CR_DDRDATARESERVED_Spare_WID (32)
+ #define DDRDATA0CH1_CR_DDRDATARESERVED_Spare_MSK (0xFFFFFFFF)
+ #define DDRDATA0CH1_CR_DDRDATARESERVED_Spare_MAX (0xFFFFFFFF)
+
+#define DDRDATA0CH1_CR_DATATRAINFEEDBACK_REG (0x00000154)
+ #define DDRDATA0CH1_CR_DATATRAINFEEDBACK_DataTrainFeedback_OFF ( 0)
+ #define DDRDATA0CH1_CR_DATATRAINFEEDBACK_DataTrainFeedback_WID ( 9)
+ #define DDRDATA0CH1_CR_DATATRAINFEEDBACK_DataTrainFeedback_MSK (0x000001FF)
+ #define DDRDATA0CH1_CR_DATATRAINFEEDBACK_DataTrainFeedback_MAX (0x000001FF)
+ #define DDRDATA0CH1_CR_DATATRAINFEEDBACK_Spare_OFF ( 9)
+ #define DDRDATA0CH1_CR_DATATRAINFEEDBACK_Spare_WID (23)
+ #define DDRDATA0CH1_CR_DATATRAINFEEDBACK_Spare_MSK (0xFFFFFE00)
+ #define DDRDATA0CH1_CR_DATATRAINFEEDBACK_Spare_MAX (0x007FFFFF)
+
+#define DDRDATA0CH1_CR_DLLPITESTANDADC_REG (0x00000158)
+ #define DDRDATA0CH1_CR_DLLPITESTANDADC_RunTest_OFF ( 0)
+ #define DDRDATA0CH1_CR_DLLPITESTANDADC_RunTest_WID ( 1)
+ #define DDRDATA0CH1_CR_DLLPITESTANDADC_RunTest_MSK (0x00000001)
+ #define DDRDATA0CH1_CR_DLLPITESTANDADC_RunTest_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DLLPITESTANDADC_RunTest_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DLLPITESTANDADC_Load_OFF ( 1)
+ #define DDRDATA0CH1_CR_DLLPITESTANDADC_Load_WID ( 1)
+ #define DDRDATA0CH1_CR_DLLPITESTANDADC_Load_MSK (0x00000002)
+ #define DDRDATA0CH1_CR_DLLPITESTANDADC_Load_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DLLPITESTANDADC_Load_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DLLPITESTANDADC_ModeHVM_OFF ( 2)
+ #define DDRDATA0CH1_CR_DLLPITESTANDADC_ModeHVM_WID ( 1)
+ #define DDRDATA0CH1_CR_DLLPITESTANDADC_ModeHVM_MSK (0x00000004)
+ #define DDRDATA0CH1_CR_DLLPITESTANDADC_ModeHVM_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DLLPITESTANDADC_ModeHVM_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DLLPITESTANDADC_ModeDV_OFF ( 3)
+ #define DDRDATA0CH1_CR_DLLPITESTANDADC_ModeDV_WID ( 1)
+ #define DDRDATA0CH1_CR_DLLPITESTANDADC_ModeDV_MSK (0x00000008)
+ #define DDRDATA0CH1_CR_DLLPITESTANDADC_ModeDV_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DLLPITESTANDADC_ModeDV_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DLLPITESTANDADC_ModeADC_OFF ( 4)
+ #define DDRDATA0CH1_CR_DLLPITESTANDADC_ModeADC_WID ( 1)
+ #define DDRDATA0CH1_CR_DLLPITESTANDADC_ModeADC_MSK (0x00000010)
+ #define DDRDATA0CH1_CR_DLLPITESTANDADC_ModeADC_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DLLPITESTANDADC_ModeADC_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DLLPITESTANDADC_LoadCount_OFF ( 5)
+ #define DDRDATA0CH1_CR_DLLPITESTANDADC_LoadCount_WID (10)
+ #define DDRDATA0CH1_CR_DLLPITESTANDADC_LoadCount_MSK (0x00007FE0)
+ #define DDRDATA0CH1_CR_DLLPITESTANDADC_LoadCount_MAX (0x000003FF)
+ #define DDRDATA0CH1_CR_DLLPITESTANDADC_CountStatus_OFF (15)
+ #define DDRDATA0CH1_CR_DLLPITESTANDADC_CountStatus_WID (10)
+ #define DDRDATA0CH1_CR_DLLPITESTANDADC_CountStatus_MSK (0x01FF8000)
+ #define DDRDATA0CH1_CR_DLLPITESTANDADC_CountStatus_MAX (0x000003FF)
+ #define DDRDATA0CH1_CR_DLLPITESTANDADC_CountStatus_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DLLPITESTANDADC_Spare_OFF (25)
+ #define DDRDATA0CH1_CR_DLLPITESTANDADC_Spare_WID ( 7)
+ #define DDRDATA0CH1_CR_DLLPITESTANDADC_Spare_MSK (0xFE000000)
+ #define DDRDATA0CH1_CR_DLLPITESTANDADC_Spare_MAX (0x0000007F)
+
+#define DDRDATA0CH1_CR_DDRCRDATAOFFSETCOMP_REG (0x0000015C)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_OFF ( 0)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_WID ( 6)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_MSK (0x0000003F)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_MAX (0x0000003F)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_OFF ( 6)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_WID ( 6)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_MSK (0x00000FC0)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_MAX (0x0000003F)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_OFF (12)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_WID ( 5)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_MSK (0x0001F000)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_MAX (0x0000001F)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_OFF (17)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_WID ( 5)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_MSK (0x003E0000)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_MAX (0x0000001F)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_OFF (22)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_WID ( 5)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_MSK (0x07C00000)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_MAX (0x0000001F)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_OFF (27)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_WID ( 5)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_MSK (0xF8000000)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_MAX (0x0000001F)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_DEF (0x00000000)
+
+#define DDRDATA0CH1_CR_DDRCRDATACONTROL1_REG (0x00000160)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_RefPi_OFF ( 0)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_RefPi_WID ( 4)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_RefPi_MSK (0x0000000F)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_RefPi_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_RefPi_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_DllMask_OFF ( 4)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_DllMask_WID ( 2)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_DllMask_MSK (0x00000030)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_DllMask_MAX (0x00000003)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_DllMask_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_DllWeakLock_OFF ( 6)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_DllWeakLock_WID ( 1)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_DllWeakLock_MSK (0x00000040)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_DllWeakLock_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_DllWeakLock_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_OFF ( 7)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_WID ( 3)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_MSK (0x00000380)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_MAX (0x00000007)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_OFF (10)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_WID ( 3)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_MSK (0x00001C00)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_MAX (0x00000007)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_OdtDelay_OFF (13)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_OdtDelay_WID ( 4)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_OdtDelay_MSK (0x0001E000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_OdtDelay_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_OdtDelay_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_OdtDuration_OFF (17)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_OdtDuration_WID ( 3)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_OdtDuration_MSK (0x000E0000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_OdtDuration_MAX (0x00000007)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_OdtDuration_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_OFF (20)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_WID ( 4)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_MSK (0x00F00000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_OFF (24)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_WID ( 3)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_MSK (0x07000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_MAX (0x00000007)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_OFF (27)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_WID ( 3)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_MSK (0x38000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_MAX (0x00000007)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_OFF (30)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_WID ( 1)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_MSK (0x40000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_Rsvd1_OFF (31)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_Rsvd1_WID ( 1)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_Rsvd1_MSK (0x80000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_Rsvd1_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL1_Rsvd1_DEF (0x00000000)
+
+#define DDRDATA0CH1_CR_DDRCRDATACONTROL2_REG (0x00000164)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_OFF ( 0)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_WID ( 5)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_MSK (0x0000001F)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_MAX (0x0000001F)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_OFF ( 5)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_WID ( 1)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_MSK (0x00000020)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL2_ForceRxOn_OFF ( 6)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL2_ForceRxOn_WID ( 1)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL2_ForceRxOn_MSK (0x00000040)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL2_ForceRxOn_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL2_ForceRxOn_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL2_LeakerComp_OFF ( 7)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL2_LeakerComp_WID ( 2)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL2_LeakerComp_MSK (0x00000180)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL2_LeakerComp_MAX (0x00000003)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL2_LeakerComp_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_OFF ( 9)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_WID ( 4)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_MSK (0x00001E00)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_MAX (0x0000000F)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_DEF (0x00000008)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_OFF (13)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_WID ( 5)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_MSK (0x0003E000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_MAX (0x0000001F)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_DEF (0x00000011)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_OFF (18)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_WID ( 1)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_MSK (0x00040000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL2_Spare_OFF (19)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL2_Spare_WID (13)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL2_Spare_MSK (0xFFF80000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL2_Spare_MAX (0x00001FFF)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL2_Spare_DEF (0x00000000)
+
+#define DDRDATA0CH1_CR_DDRCRVSSHIORVREFCONTROL_REG (0x0000016C)
+ #define DDRDATA0CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_OFF ( 0)
+ #define DDRDATA0CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_WID (24)
+ #define DDRDATA0CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_MSK (0x00FFFFFF)
+ #define DDRDATA0CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_MAX (0x00FFFFFF)
+ #define DDRDATA0CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_OFF (24)
+ #define DDRDATA0CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_WID ( 8)
+ #define DDRDATA0CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_MSK (0xFF000000)
+ #define DDRDATA0CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_MAX (0x000000FF)
+ #define DDRDATA0CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_DEF (0x00000000)
+
+#define DDRDATA0CH1_CR_DDRCRDATAOFFSETTRAIN_REG (0x00000170)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_OFF ( 0)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_WID ( 6)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_MSK (0x0000003F)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_MAX (0x0000003F)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_OFF ( 6)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_WID ( 6)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_MSK (0x00000FC0)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_MAX (0x0000003F)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_OFF (12)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_WID ( 6)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_MSK (0x0003F000)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_MAX (0x0000003F)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_OFF (18)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_WID ( 6)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_MSK (0x00FC0000)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_MAX (0x0000003F)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_OFF (24)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_WID ( 7)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_MSK (0x7F000000)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_MAX (0x0000007F)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_OFF (31)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_WID ( 1)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_MSK (0x80000000)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_DEF (0x00000000)
+
+#define DDRDATA0CH1_CR_DDRCRDATACONTROL0_REG (0x00000174)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_OFF ( 0)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_WID ( 1)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_MSK (0x00000001)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_OFF ( 1)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_WID ( 1)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_MSK (0x00000002)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_OFF ( 2)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_WID ( 1)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_MSK (0x00000004)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_OFF ( 3)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_WID ( 1)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_MSK (0x00000008)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_TxOn_OFF ( 4)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_TxOn_WID ( 1)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_TxOn_MSK (0x00000010)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_TxOn_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_TxOn_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_RfOn_OFF ( 5)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_RfOn_WID ( 1)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_RfOn_MSK (0x00000020)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_RfOn_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_RfOn_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_RxPiOn_OFF ( 6)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_RxPiOn_WID ( 1)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_RxPiOn_MSK (0x00000040)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_RxPiOn_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_RxPiOn_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_TxPiOn_OFF ( 7)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_TxPiOn_WID ( 1)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_TxPiOn_MSK (0x00000080)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_TxPiOn_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_TxPiOn_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_OFF ( 8)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_WID ( 1)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_MSK (0x00000100)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_OFF ( 9)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_WID ( 1)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_MSK (0x00000200)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_TxDisable_OFF (10)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_TxDisable_WID ( 1)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_TxDisable_MSK (0x00000400)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_TxDisable_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_TxDisable_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_RxDisable_OFF (11)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_RxDisable_WID ( 1)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_RxDisable_MSK (0x00000800)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_RxDisable_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_RxDisable_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_TxLong_OFF (12)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_TxLong_WID ( 1)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_TxLong_MSK (0x00001000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_TxLong_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_TxLong_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_OFF (13)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_WID ( 2)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_MSK (0x00006000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_MAX (0x00000003)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_RxReadPointer_OFF (15)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_RxReadPointer_WID ( 3)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_RxReadPointer_MSK (0x00038000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_RxReadPointer_MAX (0x00000007)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_RxReadPointer_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_OFF (18)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_WID ( 1)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_MSK (0x00040000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_OFF (19)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_WID ( 1)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_MSK (0x00080000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_ReadRFRd_OFF (20)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_ReadRFRd_WID ( 1)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_ReadRFRd_MSK (0x00100000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_ReadRFRd_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_ReadRFRd_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_ReadRFWr_OFF (21)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_ReadRFWr_WID ( 1)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_ReadRFWr_MSK (0x00200000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_ReadRFWr_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_ReadRFWr_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_ReadRFRank_OFF (22)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_ReadRFRank_WID ( 2)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_ReadRFRank_MSK (0x00C00000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_ReadRFRank_MAX (0x00000003)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_ReadRFRank_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_OFF (24)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_WID ( 1)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_MSK (0x01000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_OdtSampOff_OFF (25)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_OdtSampOff_WID ( 1)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_OdtSampOff_MSK (0x02000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_OdtSampOff_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_OdtSampOff_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_OFF (26)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_WID ( 1)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_MSK (0x04000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_OFF (27)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_WID ( 1)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_MSK (0x08000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_OFF (28)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_WID ( 1)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_MSK (0x10000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_OFF (29)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_WID ( 1)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_MSK (0x20000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_OFF (30)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_WID ( 1)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_MSK (0x40000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_OFF (31)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_WID ( 1)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_MSK (0x80000000)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_DEF (0x00000000)
+
+#define DDRDATA0CH1_CR_DDRCRVREFADJUST1_REG (0x00000178)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_OFF ( 0)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_WID ( 7)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_MSK (0x0000007F)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_MAX (0x0000007F)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_OFF ( 7)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_WID ( 7)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_MSK (0x00003F80)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_MAX (0x0000007F)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_OFF (14)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_WID ( 7)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_MSK (0x001FC000)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_MAX (0x0000007F)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_OFF (21)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_WID ( 1)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_MSK (0x00200000)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_OFF (22)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_WID ( 1)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_MSK (0x00400000)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_OFF (23)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_WID ( 1)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_MSK (0x00800000)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_OFF (24)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_WID ( 2)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_MSK (0x03000000)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_MAX (0x00000003)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_OFF (26)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_WID ( 1)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_MSK (0x04000000)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_Rsvd_OFF (27)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_Rsvd_WID ( 2)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_Rsvd_MSK (0x18000000)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_Rsvd_MAX (0x00000003)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_Rsvd_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_caSlowBW_OFF (29)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_caSlowBW_WID ( 1)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_caSlowBW_MSK (0x20000000)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_caSlowBW_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_caSlowBW_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_OFF (30)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_WID ( 1)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_MSK (0x40000000)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_DEF (0x00000000)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_OFF (31)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_WID ( 1)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_MSK (0x80000000)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_MAX (0x00000001)
+ #define DDRDATA0CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_DEF (0x00000000)
+
+#define DDRDATA1CH0_CR_RXTRAINRANK0_REG (0x00000200)
+ #define DDRDATA1CH0_CR_RXTRAINRANK0_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA1CH0_CR_RXTRAINRANK0_RxRcvEnPi_WID ( 9)
+ #define DDRDATA1CH0_CR_RXTRAINRANK0_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA1CH0_CR_RXTRAINRANK0_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA1CH0_CR_RXTRAINRANK0_RxDqsPPi_OFF ( 9)
+ #define DDRDATA1CH0_CR_RXTRAINRANK0_RxDqsPPi_WID ( 6)
+ #define DDRDATA1CH0_CR_RXTRAINRANK0_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA1CH0_CR_RXTRAINRANK0_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA1CH0_CR_RXTRAINRANK0_RxEq_OFF (15)
+ #define DDRDATA1CH0_CR_RXTRAINRANK0_RxEq_WID ( 5)
+ #define DDRDATA1CH0_CR_RXTRAINRANK0_RxEq_MSK (0x000F8000)
+ #define DDRDATA1CH0_CR_RXTRAINRANK0_RxEq_MAX (0x0000001F)
+ #define DDRDATA1CH0_CR_RXTRAINRANK0_RxDqsNPi_OFF (20)
+ #define DDRDATA1CH0_CR_RXTRAINRANK0_RxDqsNPi_WID ( 6)
+ #define DDRDATA1CH0_CR_RXTRAINRANK0_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA1CH0_CR_RXTRAINRANK0_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA1CH0_CR_RXTRAINRANK0_RxVref_OFF (26)
+ #define DDRDATA1CH0_CR_RXTRAINRANK0_RxVref_WID ( 6)
+ #define DDRDATA1CH0_CR_RXTRAINRANK0_RxVref_MSK (0xFC000000)
+ #define DDRDATA1CH0_CR_RXTRAINRANK0_RxVref_MAX (0x0000003F)
+
+#define DDRDATA1CH0_CR_RXTRAINRANK1_REG (0x00000204)
+ #define DDRDATA1CH0_CR_RXTRAINRANK1_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA1CH0_CR_RXTRAINRANK1_RxRcvEnPi_WID ( 9)
+ #define DDRDATA1CH0_CR_RXTRAINRANK1_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA1CH0_CR_RXTRAINRANK1_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA1CH0_CR_RXTRAINRANK1_RxDqsPPi_OFF ( 9)
+ #define DDRDATA1CH0_CR_RXTRAINRANK1_RxDqsPPi_WID ( 6)
+ #define DDRDATA1CH0_CR_RXTRAINRANK1_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA1CH0_CR_RXTRAINRANK1_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA1CH0_CR_RXTRAINRANK1_RxEq_OFF (15)
+ #define DDRDATA1CH0_CR_RXTRAINRANK1_RxEq_WID ( 5)
+ #define DDRDATA1CH0_CR_RXTRAINRANK1_RxEq_MSK (0x000F8000)
+ #define DDRDATA1CH0_CR_RXTRAINRANK1_RxEq_MAX (0x0000001F)
+ #define DDRDATA1CH0_CR_RXTRAINRANK1_RxDqsNPi_OFF (20)
+ #define DDRDATA1CH0_CR_RXTRAINRANK1_RxDqsNPi_WID ( 6)
+ #define DDRDATA1CH0_CR_RXTRAINRANK1_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA1CH0_CR_RXTRAINRANK1_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA1CH0_CR_RXTRAINRANK1_RxVref_OFF (26)
+ #define DDRDATA1CH0_CR_RXTRAINRANK1_RxVref_WID ( 6)
+ #define DDRDATA1CH0_CR_RXTRAINRANK1_RxVref_MSK (0xFC000000)
+ #define DDRDATA1CH0_CR_RXTRAINRANK1_RxVref_MAX (0x0000003F)
+
+#define DDRDATA1CH0_CR_RXTRAINRANK2_REG (0x00000208)
+ #define DDRDATA1CH0_CR_RXTRAINRANK2_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA1CH0_CR_RXTRAINRANK2_RxRcvEnPi_WID ( 9)
+ #define DDRDATA1CH0_CR_RXTRAINRANK2_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA1CH0_CR_RXTRAINRANK2_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA1CH0_CR_RXTRAINRANK2_RxDqsPPi_OFF ( 9)
+ #define DDRDATA1CH0_CR_RXTRAINRANK2_RxDqsPPi_WID ( 6)
+ #define DDRDATA1CH0_CR_RXTRAINRANK2_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA1CH0_CR_RXTRAINRANK2_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA1CH0_CR_RXTRAINRANK2_RxEq_OFF (15)
+ #define DDRDATA1CH0_CR_RXTRAINRANK2_RxEq_WID ( 5)
+ #define DDRDATA1CH0_CR_RXTRAINRANK2_RxEq_MSK (0x000F8000)
+ #define DDRDATA1CH0_CR_RXTRAINRANK2_RxEq_MAX (0x0000001F)
+ #define DDRDATA1CH0_CR_RXTRAINRANK2_RxDqsNPi_OFF (20)
+ #define DDRDATA1CH0_CR_RXTRAINRANK2_RxDqsNPi_WID ( 6)
+ #define DDRDATA1CH0_CR_RXTRAINRANK2_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA1CH0_CR_RXTRAINRANK2_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA1CH0_CR_RXTRAINRANK2_RxVref_OFF (26)
+ #define DDRDATA1CH0_CR_RXTRAINRANK2_RxVref_WID ( 6)
+ #define DDRDATA1CH0_CR_RXTRAINRANK2_RxVref_MSK (0xFC000000)
+ #define DDRDATA1CH0_CR_RXTRAINRANK2_RxVref_MAX (0x0000003F)
+
+#define DDRDATA1CH0_CR_RXTRAINRANK3_REG (0x0000020C)
+ #define DDRDATA1CH0_CR_RXTRAINRANK3_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA1CH0_CR_RXTRAINRANK3_RxRcvEnPi_WID ( 9)
+ #define DDRDATA1CH0_CR_RXTRAINRANK3_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA1CH0_CR_RXTRAINRANK3_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA1CH0_CR_RXTRAINRANK3_RxDqsPPi_OFF ( 9)
+ #define DDRDATA1CH0_CR_RXTRAINRANK3_RxDqsPPi_WID ( 6)
+ #define DDRDATA1CH0_CR_RXTRAINRANK3_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA1CH0_CR_RXTRAINRANK3_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA1CH0_CR_RXTRAINRANK3_RxEq_OFF (15)
+ #define DDRDATA1CH0_CR_RXTRAINRANK3_RxEq_WID ( 5)
+ #define DDRDATA1CH0_CR_RXTRAINRANK3_RxEq_MSK (0x000F8000)
+ #define DDRDATA1CH0_CR_RXTRAINRANK3_RxEq_MAX (0x0000001F)
+ #define DDRDATA1CH0_CR_RXTRAINRANK3_RxDqsNPi_OFF (20)
+ #define DDRDATA1CH0_CR_RXTRAINRANK3_RxDqsNPi_WID ( 6)
+ #define DDRDATA1CH0_CR_RXTRAINRANK3_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA1CH0_CR_RXTRAINRANK3_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA1CH0_CR_RXTRAINRANK3_RxVref_OFF (26)
+ #define DDRDATA1CH0_CR_RXTRAINRANK3_RxVref_WID ( 6)
+ #define DDRDATA1CH0_CR_RXTRAINRANK3_RxVref_MSK (0xFC000000)
+ #define DDRDATA1CH0_CR_RXTRAINRANK3_RxVref_MAX (0x0000003F)
+
+#define DDRDATA1CH0_CR_RXPERBITRANK0_REG (0x00000210)
+ #define DDRDATA1CH0_CR_RXPERBITRANK0_Lane0_OFF ( 0)
+ #define DDRDATA1CH0_CR_RXPERBITRANK0_Lane0_WID ( 4)
+ #define DDRDATA1CH0_CR_RXPERBITRANK0_Lane0_MSK (0x0000000F)
+ #define DDRDATA1CH0_CR_RXPERBITRANK0_Lane0_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_RXPERBITRANK0_Lane1_OFF ( 4)
+ #define DDRDATA1CH0_CR_RXPERBITRANK0_Lane1_WID ( 4)
+ #define DDRDATA1CH0_CR_RXPERBITRANK0_Lane1_MSK (0x000000F0)
+ #define DDRDATA1CH0_CR_RXPERBITRANK0_Lane1_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_RXPERBITRANK0_Lane2_OFF ( 8)
+ #define DDRDATA1CH0_CR_RXPERBITRANK0_Lane2_WID ( 4)
+ #define DDRDATA1CH0_CR_RXPERBITRANK0_Lane2_MSK (0x00000F00)
+ #define DDRDATA1CH0_CR_RXPERBITRANK0_Lane2_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_RXPERBITRANK0_Lane3_OFF (12)
+ #define DDRDATA1CH0_CR_RXPERBITRANK0_Lane3_WID ( 4)
+ #define DDRDATA1CH0_CR_RXPERBITRANK0_Lane3_MSK (0x0000F000)
+ #define DDRDATA1CH0_CR_RXPERBITRANK0_Lane3_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_RXPERBITRANK0_Lane4_OFF (16)
+ #define DDRDATA1CH0_CR_RXPERBITRANK0_Lane4_WID ( 4)
+ #define DDRDATA1CH0_CR_RXPERBITRANK0_Lane4_MSK (0x000F0000)
+ #define DDRDATA1CH0_CR_RXPERBITRANK0_Lane4_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_RXPERBITRANK0_Lane5_OFF (20)
+ #define DDRDATA1CH0_CR_RXPERBITRANK0_Lane5_WID ( 4)
+ #define DDRDATA1CH0_CR_RXPERBITRANK0_Lane5_MSK (0x00F00000)
+ #define DDRDATA1CH0_CR_RXPERBITRANK0_Lane5_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_RXPERBITRANK0_Lane6_OFF (24)
+ #define DDRDATA1CH0_CR_RXPERBITRANK0_Lane6_WID ( 4)
+ #define DDRDATA1CH0_CR_RXPERBITRANK0_Lane6_MSK (0x0F000000)
+ #define DDRDATA1CH0_CR_RXPERBITRANK0_Lane6_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_RXPERBITRANK0_Lane7_OFF (28)
+ #define DDRDATA1CH0_CR_RXPERBITRANK0_Lane7_WID ( 4)
+ #define DDRDATA1CH0_CR_RXPERBITRANK0_Lane7_MSK (0xF0000000)
+ #define DDRDATA1CH0_CR_RXPERBITRANK0_Lane7_MAX (0x0000000F)
+
+#define DDRDATA1CH0_CR_RXPERBITRANK1_REG (0x00000214)
+ #define DDRDATA1CH0_CR_RXPERBITRANK1_Lane0_OFF ( 0)
+ #define DDRDATA1CH0_CR_RXPERBITRANK1_Lane0_WID ( 4)
+ #define DDRDATA1CH0_CR_RXPERBITRANK1_Lane0_MSK (0x0000000F)
+ #define DDRDATA1CH0_CR_RXPERBITRANK1_Lane0_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_RXPERBITRANK1_Lane1_OFF ( 4)
+ #define DDRDATA1CH0_CR_RXPERBITRANK1_Lane1_WID ( 4)
+ #define DDRDATA1CH0_CR_RXPERBITRANK1_Lane1_MSK (0x000000F0)
+ #define DDRDATA1CH0_CR_RXPERBITRANK1_Lane1_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_RXPERBITRANK1_Lane2_OFF ( 8)
+ #define DDRDATA1CH0_CR_RXPERBITRANK1_Lane2_WID ( 4)
+ #define DDRDATA1CH0_CR_RXPERBITRANK1_Lane2_MSK (0x00000F00)
+ #define DDRDATA1CH0_CR_RXPERBITRANK1_Lane2_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_RXPERBITRANK1_Lane3_OFF (12)
+ #define DDRDATA1CH0_CR_RXPERBITRANK1_Lane3_WID ( 4)
+ #define DDRDATA1CH0_CR_RXPERBITRANK1_Lane3_MSK (0x0000F000)
+ #define DDRDATA1CH0_CR_RXPERBITRANK1_Lane3_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_RXPERBITRANK1_Lane4_OFF (16)
+ #define DDRDATA1CH0_CR_RXPERBITRANK1_Lane4_WID ( 4)
+ #define DDRDATA1CH0_CR_RXPERBITRANK1_Lane4_MSK (0x000F0000)
+ #define DDRDATA1CH0_CR_RXPERBITRANK1_Lane4_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_RXPERBITRANK1_Lane5_OFF (20)
+ #define DDRDATA1CH0_CR_RXPERBITRANK1_Lane5_WID ( 4)
+ #define DDRDATA1CH0_CR_RXPERBITRANK1_Lane5_MSK (0x00F00000)
+ #define DDRDATA1CH0_CR_RXPERBITRANK1_Lane5_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_RXPERBITRANK1_Lane6_OFF (24)
+ #define DDRDATA1CH0_CR_RXPERBITRANK1_Lane6_WID ( 4)
+ #define DDRDATA1CH0_CR_RXPERBITRANK1_Lane6_MSK (0x0F000000)
+ #define DDRDATA1CH0_CR_RXPERBITRANK1_Lane6_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_RXPERBITRANK1_Lane7_OFF (28)
+ #define DDRDATA1CH0_CR_RXPERBITRANK1_Lane7_WID ( 4)
+ #define DDRDATA1CH0_CR_RXPERBITRANK1_Lane7_MSK (0xF0000000)
+ #define DDRDATA1CH0_CR_RXPERBITRANK1_Lane7_MAX (0x0000000F)
+
+#define DDRDATA1CH0_CR_RXPERBITRANK2_REG (0x00000218)
+ #define DDRDATA1CH0_CR_RXPERBITRANK2_Lane0_OFF ( 0)
+ #define DDRDATA1CH0_CR_RXPERBITRANK2_Lane0_WID ( 4)
+ #define DDRDATA1CH0_CR_RXPERBITRANK2_Lane0_MSK (0x0000000F)
+ #define DDRDATA1CH0_CR_RXPERBITRANK2_Lane0_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_RXPERBITRANK2_Lane1_OFF ( 4)
+ #define DDRDATA1CH0_CR_RXPERBITRANK2_Lane1_WID ( 4)
+ #define DDRDATA1CH0_CR_RXPERBITRANK2_Lane1_MSK (0x000000F0)
+ #define DDRDATA1CH0_CR_RXPERBITRANK2_Lane1_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_RXPERBITRANK2_Lane2_OFF ( 8)
+ #define DDRDATA1CH0_CR_RXPERBITRANK2_Lane2_WID ( 4)
+ #define DDRDATA1CH0_CR_RXPERBITRANK2_Lane2_MSK (0x00000F00)
+ #define DDRDATA1CH0_CR_RXPERBITRANK2_Lane2_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_RXPERBITRANK2_Lane3_OFF (12)
+ #define DDRDATA1CH0_CR_RXPERBITRANK2_Lane3_WID ( 4)
+ #define DDRDATA1CH0_CR_RXPERBITRANK2_Lane3_MSK (0x0000F000)
+ #define DDRDATA1CH0_CR_RXPERBITRANK2_Lane3_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_RXPERBITRANK2_Lane4_OFF (16)
+ #define DDRDATA1CH0_CR_RXPERBITRANK2_Lane4_WID ( 4)
+ #define DDRDATA1CH0_CR_RXPERBITRANK2_Lane4_MSK (0x000F0000)
+ #define DDRDATA1CH0_CR_RXPERBITRANK2_Lane4_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_RXPERBITRANK2_Lane5_OFF (20)
+ #define DDRDATA1CH0_CR_RXPERBITRANK2_Lane5_WID ( 4)
+ #define DDRDATA1CH0_CR_RXPERBITRANK2_Lane5_MSK (0x00F00000)
+ #define DDRDATA1CH0_CR_RXPERBITRANK2_Lane5_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_RXPERBITRANK2_Lane6_OFF (24)
+ #define DDRDATA1CH0_CR_RXPERBITRANK2_Lane6_WID ( 4)
+ #define DDRDATA1CH0_CR_RXPERBITRANK2_Lane6_MSK (0x0F000000)
+ #define DDRDATA1CH0_CR_RXPERBITRANK2_Lane6_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_RXPERBITRANK2_Lane7_OFF (28)
+ #define DDRDATA1CH0_CR_RXPERBITRANK2_Lane7_WID ( 4)
+ #define DDRDATA1CH0_CR_RXPERBITRANK2_Lane7_MSK (0xF0000000)
+ #define DDRDATA1CH0_CR_RXPERBITRANK2_Lane7_MAX (0x0000000F)
+
+#define DDRDATA1CH0_CR_RXPERBITRANK3_REG (0x0000021C)
+ #define DDRDATA1CH0_CR_RXPERBITRANK3_Lane0_OFF ( 0)
+ #define DDRDATA1CH0_CR_RXPERBITRANK3_Lane0_WID ( 4)
+ #define DDRDATA1CH0_CR_RXPERBITRANK3_Lane0_MSK (0x0000000F)
+ #define DDRDATA1CH0_CR_RXPERBITRANK3_Lane0_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_RXPERBITRANK3_Lane1_OFF ( 4)
+ #define DDRDATA1CH0_CR_RXPERBITRANK3_Lane1_WID ( 4)
+ #define DDRDATA1CH0_CR_RXPERBITRANK3_Lane1_MSK (0x000000F0)
+ #define DDRDATA1CH0_CR_RXPERBITRANK3_Lane1_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_RXPERBITRANK3_Lane2_OFF ( 8)
+ #define DDRDATA1CH0_CR_RXPERBITRANK3_Lane2_WID ( 4)
+ #define DDRDATA1CH0_CR_RXPERBITRANK3_Lane2_MSK (0x00000F00)
+ #define DDRDATA1CH0_CR_RXPERBITRANK3_Lane2_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_RXPERBITRANK3_Lane3_OFF (12)
+ #define DDRDATA1CH0_CR_RXPERBITRANK3_Lane3_WID ( 4)
+ #define DDRDATA1CH0_CR_RXPERBITRANK3_Lane3_MSK (0x0000F000)
+ #define DDRDATA1CH0_CR_RXPERBITRANK3_Lane3_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_RXPERBITRANK3_Lane4_OFF (16)
+ #define DDRDATA1CH0_CR_RXPERBITRANK3_Lane4_WID ( 4)
+ #define DDRDATA1CH0_CR_RXPERBITRANK3_Lane4_MSK (0x000F0000)
+ #define DDRDATA1CH0_CR_RXPERBITRANK3_Lane4_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_RXPERBITRANK3_Lane5_OFF (20)
+ #define DDRDATA1CH0_CR_RXPERBITRANK3_Lane5_WID ( 4)
+ #define DDRDATA1CH0_CR_RXPERBITRANK3_Lane5_MSK (0x00F00000)
+ #define DDRDATA1CH0_CR_RXPERBITRANK3_Lane5_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_RXPERBITRANK3_Lane6_OFF (24)
+ #define DDRDATA1CH0_CR_RXPERBITRANK3_Lane6_WID ( 4)
+ #define DDRDATA1CH0_CR_RXPERBITRANK3_Lane6_MSK (0x0F000000)
+ #define DDRDATA1CH0_CR_RXPERBITRANK3_Lane6_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_RXPERBITRANK3_Lane7_OFF (28)
+ #define DDRDATA1CH0_CR_RXPERBITRANK3_Lane7_WID ( 4)
+ #define DDRDATA1CH0_CR_RXPERBITRANK3_Lane7_MSK (0xF0000000)
+ #define DDRDATA1CH0_CR_RXPERBITRANK3_Lane7_MAX (0x0000000F)
+
+#define DDRDATA1CH0_CR_TXTRAINRANK0_REG (0x00000220)
+ #define DDRDATA1CH0_CR_TXTRAINRANK0_TxDqDelay_OFF ( 0)
+ #define DDRDATA1CH0_CR_TXTRAINRANK0_TxDqDelay_WID ( 9)
+ #define DDRDATA1CH0_CR_TXTRAINRANK0_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA1CH0_CR_TXTRAINRANK0_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA1CH0_CR_TXTRAINRANK0_TxDqsDelay_OFF ( 9)
+ #define DDRDATA1CH0_CR_TXTRAINRANK0_TxDqsDelay_WID ( 9)
+ #define DDRDATA1CH0_CR_TXTRAINRANK0_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA1CH0_CR_TXTRAINRANK0_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA1CH0_CR_TXTRAINRANK0_Spare0_OFF (18)
+ #define DDRDATA1CH0_CR_TXTRAINRANK0_Spare0_WID ( 2)
+ #define DDRDATA1CH0_CR_TXTRAINRANK0_Spare0_MSK (0x000C0000)
+ #define DDRDATA1CH0_CR_TXTRAINRANK0_Spare0_MAX (0x00000003)
+ #define DDRDATA1CH0_CR_TXTRAINRANK0_TxEqualization_OFF (20)
+ #define DDRDATA1CH0_CR_TXTRAINRANK0_TxEqualization_WID ( 6)
+ #define DDRDATA1CH0_CR_TXTRAINRANK0_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA1CH0_CR_TXTRAINRANK0_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA1CH0_CR_TXTRAINRANK0_Spare1_OFF (26)
+ #define DDRDATA1CH0_CR_TXTRAINRANK0_Spare1_WID ( 6)
+ #define DDRDATA1CH0_CR_TXTRAINRANK0_Spare1_MSK (0xFC000000)
+ #define DDRDATA1CH0_CR_TXTRAINRANK0_Spare1_MAX (0x0000003F)
+
+#define DDRDATA1CH0_CR_TXTRAINRANK1_REG (0x00000224)
+ #define DDRDATA1CH0_CR_TXTRAINRANK1_TxDqDelay_OFF ( 0)
+ #define DDRDATA1CH0_CR_TXTRAINRANK1_TxDqDelay_WID ( 9)
+ #define DDRDATA1CH0_CR_TXTRAINRANK1_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA1CH0_CR_TXTRAINRANK1_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA1CH0_CR_TXTRAINRANK1_TxDqsDelay_OFF ( 9)
+ #define DDRDATA1CH0_CR_TXTRAINRANK1_TxDqsDelay_WID ( 9)
+ #define DDRDATA1CH0_CR_TXTRAINRANK1_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA1CH0_CR_TXTRAINRANK1_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA1CH0_CR_TXTRAINRANK1_Spare0_OFF (18)
+ #define DDRDATA1CH0_CR_TXTRAINRANK1_Spare0_WID ( 2)
+ #define DDRDATA1CH0_CR_TXTRAINRANK1_Spare0_MSK (0x000C0000)
+ #define DDRDATA1CH0_CR_TXTRAINRANK1_Spare0_MAX (0x00000003)
+ #define DDRDATA1CH0_CR_TXTRAINRANK1_TxEqualization_OFF (20)
+ #define DDRDATA1CH0_CR_TXTRAINRANK1_TxEqualization_WID ( 6)
+ #define DDRDATA1CH0_CR_TXTRAINRANK1_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA1CH0_CR_TXTRAINRANK1_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA1CH0_CR_TXTRAINRANK1_Spare1_OFF (26)
+ #define DDRDATA1CH0_CR_TXTRAINRANK1_Spare1_WID ( 6)
+ #define DDRDATA1CH0_CR_TXTRAINRANK1_Spare1_MSK (0xFC000000)
+ #define DDRDATA1CH0_CR_TXTRAINRANK1_Spare1_MAX (0x0000003F)
+
+#define DDRDATA1CH0_CR_TXTRAINRANK2_REG (0x00000228)
+ #define DDRDATA1CH0_CR_TXTRAINRANK2_TxDqDelay_OFF ( 0)
+ #define DDRDATA1CH0_CR_TXTRAINRANK2_TxDqDelay_WID ( 9)
+ #define DDRDATA1CH0_CR_TXTRAINRANK2_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA1CH0_CR_TXTRAINRANK2_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA1CH0_CR_TXTRAINRANK2_TxDqsDelay_OFF ( 9)
+ #define DDRDATA1CH0_CR_TXTRAINRANK2_TxDqsDelay_WID ( 9)
+ #define DDRDATA1CH0_CR_TXTRAINRANK2_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA1CH0_CR_TXTRAINRANK2_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA1CH0_CR_TXTRAINRANK2_Spare0_OFF (18)
+ #define DDRDATA1CH0_CR_TXTRAINRANK2_Spare0_WID ( 2)
+ #define DDRDATA1CH0_CR_TXTRAINRANK2_Spare0_MSK (0x000C0000)
+ #define DDRDATA1CH0_CR_TXTRAINRANK2_Spare0_MAX (0x00000003)
+ #define DDRDATA1CH0_CR_TXTRAINRANK2_TxEqualization_OFF (20)
+ #define DDRDATA1CH0_CR_TXTRAINRANK2_TxEqualization_WID ( 6)
+ #define DDRDATA1CH0_CR_TXTRAINRANK2_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA1CH0_CR_TXTRAINRANK2_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA1CH0_CR_TXTRAINRANK2_Spare1_OFF (26)
+ #define DDRDATA1CH0_CR_TXTRAINRANK2_Spare1_WID ( 6)
+ #define DDRDATA1CH0_CR_TXTRAINRANK2_Spare1_MSK (0xFC000000)
+ #define DDRDATA1CH0_CR_TXTRAINRANK2_Spare1_MAX (0x0000003F)
+
+#define DDRDATA1CH0_CR_TXTRAINRANK3_REG (0x0000022C)
+ #define DDRDATA1CH0_CR_TXTRAINRANK3_TxDqDelay_OFF ( 0)
+ #define DDRDATA1CH0_CR_TXTRAINRANK3_TxDqDelay_WID ( 9)
+ #define DDRDATA1CH0_CR_TXTRAINRANK3_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA1CH0_CR_TXTRAINRANK3_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA1CH0_CR_TXTRAINRANK3_TxDqsDelay_OFF ( 9)
+ #define DDRDATA1CH0_CR_TXTRAINRANK3_TxDqsDelay_WID ( 9)
+ #define DDRDATA1CH0_CR_TXTRAINRANK3_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA1CH0_CR_TXTRAINRANK3_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA1CH0_CR_TXTRAINRANK3_Spare0_OFF (18)
+ #define DDRDATA1CH0_CR_TXTRAINRANK3_Spare0_WID ( 2)
+ #define DDRDATA1CH0_CR_TXTRAINRANK3_Spare0_MSK (0x000C0000)
+ #define DDRDATA1CH0_CR_TXTRAINRANK3_Spare0_MAX (0x00000003)
+ #define DDRDATA1CH0_CR_TXTRAINRANK3_TxEqualization_OFF (20)
+ #define DDRDATA1CH0_CR_TXTRAINRANK3_TxEqualization_WID ( 6)
+ #define DDRDATA1CH0_CR_TXTRAINRANK3_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA1CH0_CR_TXTRAINRANK3_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA1CH0_CR_TXTRAINRANK3_Spare1_OFF (26)
+ #define DDRDATA1CH0_CR_TXTRAINRANK3_Spare1_WID ( 6)
+ #define DDRDATA1CH0_CR_TXTRAINRANK3_Spare1_MSK (0xFC000000)
+ #define DDRDATA1CH0_CR_TXTRAINRANK3_Spare1_MAX (0x0000003F)
+
+#define DDRDATA1CH0_CR_TXPERBITRANK0_REG (0x00000230)
+ #define DDRDATA1CH0_CR_TXPERBITRANK0_Lane0_OFF ( 0)
+ #define DDRDATA1CH0_CR_TXPERBITRANK0_Lane0_WID ( 4)
+ #define DDRDATA1CH0_CR_TXPERBITRANK0_Lane0_MSK (0x0000000F)
+ #define DDRDATA1CH0_CR_TXPERBITRANK0_Lane0_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_TXPERBITRANK0_Lane1_OFF ( 4)
+ #define DDRDATA1CH0_CR_TXPERBITRANK0_Lane1_WID ( 4)
+ #define DDRDATA1CH0_CR_TXPERBITRANK0_Lane1_MSK (0x000000F0)
+ #define DDRDATA1CH0_CR_TXPERBITRANK0_Lane1_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_TXPERBITRANK0_Lane2_OFF ( 8)
+ #define DDRDATA1CH0_CR_TXPERBITRANK0_Lane2_WID ( 4)
+ #define DDRDATA1CH0_CR_TXPERBITRANK0_Lane2_MSK (0x00000F00)
+ #define DDRDATA1CH0_CR_TXPERBITRANK0_Lane2_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_TXPERBITRANK0_Lane3_OFF (12)
+ #define DDRDATA1CH0_CR_TXPERBITRANK0_Lane3_WID ( 4)
+ #define DDRDATA1CH0_CR_TXPERBITRANK0_Lane3_MSK (0x0000F000)
+ #define DDRDATA1CH0_CR_TXPERBITRANK0_Lane3_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_TXPERBITRANK0_Lane4_OFF (16)
+ #define DDRDATA1CH0_CR_TXPERBITRANK0_Lane4_WID ( 4)
+ #define DDRDATA1CH0_CR_TXPERBITRANK0_Lane4_MSK (0x000F0000)
+ #define DDRDATA1CH0_CR_TXPERBITRANK0_Lane4_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_TXPERBITRANK0_Lane5_OFF (20)
+ #define DDRDATA1CH0_CR_TXPERBITRANK0_Lane5_WID ( 4)
+ #define DDRDATA1CH0_CR_TXPERBITRANK0_Lane5_MSK (0x00F00000)
+ #define DDRDATA1CH0_CR_TXPERBITRANK0_Lane5_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_TXPERBITRANK0_Lane6_OFF (24)
+ #define DDRDATA1CH0_CR_TXPERBITRANK0_Lane6_WID ( 4)
+ #define DDRDATA1CH0_CR_TXPERBITRANK0_Lane6_MSK (0x0F000000)
+ #define DDRDATA1CH0_CR_TXPERBITRANK0_Lane6_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_TXPERBITRANK0_Lane7_OFF (28)
+ #define DDRDATA1CH0_CR_TXPERBITRANK0_Lane7_WID ( 4)
+ #define DDRDATA1CH0_CR_TXPERBITRANK0_Lane7_MSK (0xF0000000)
+ #define DDRDATA1CH0_CR_TXPERBITRANK0_Lane7_MAX (0x0000000F)
+
+#define DDRDATA1CH0_CR_TXPERBITRANK1_REG (0x00000234)
+ #define DDRDATA1CH0_CR_TXPERBITRANK1_Lane0_OFF ( 0)
+ #define DDRDATA1CH0_CR_TXPERBITRANK1_Lane0_WID ( 4)
+ #define DDRDATA1CH0_CR_TXPERBITRANK1_Lane0_MSK (0x0000000F)
+ #define DDRDATA1CH0_CR_TXPERBITRANK1_Lane0_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_TXPERBITRANK1_Lane1_OFF ( 4)
+ #define DDRDATA1CH0_CR_TXPERBITRANK1_Lane1_WID ( 4)
+ #define DDRDATA1CH0_CR_TXPERBITRANK1_Lane1_MSK (0x000000F0)
+ #define DDRDATA1CH0_CR_TXPERBITRANK1_Lane1_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_TXPERBITRANK1_Lane2_OFF ( 8)
+ #define DDRDATA1CH0_CR_TXPERBITRANK1_Lane2_WID ( 4)
+ #define DDRDATA1CH0_CR_TXPERBITRANK1_Lane2_MSK (0x00000F00)
+ #define DDRDATA1CH0_CR_TXPERBITRANK1_Lane2_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_TXPERBITRANK1_Lane3_OFF (12)
+ #define DDRDATA1CH0_CR_TXPERBITRANK1_Lane3_WID ( 4)
+ #define DDRDATA1CH0_CR_TXPERBITRANK1_Lane3_MSK (0x0000F000)
+ #define DDRDATA1CH0_CR_TXPERBITRANK1_Lane3_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_TXPERBITRANK1_Lane4_OFF (16)
+ #define DDRDATA1CH0_CR_TXPERBITRANK1_Lane4_WID ( 4)
+ #define DDRDATA1CH0_CR_TXPERBITRANK1_Lane4_MSK (0x000F0000)
+ #define DDRDATA1CH0_CR_TXPERBITRANK1_Lane4_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_TXPERBITRANK1_Lane5_OFF (20)
+ #define DDRDATA1CH0_CR_TXPERBITRANK1_Lane5_WID ( 4)
+ #define DDRDATA1CH0_CR_TXPERBITRANK1_Lane5_MSK (0x00F00000)
+ #define DDRDATA1CH0_CR_TXPERBITRANK1_Lane5_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_TXPERBITRANK1_Lane6_OFF (24)
+ #define DDRDATA1CH0_CR_TXPERBITRANK1_Lane6_WID ( 4)
+ #define DDRDATA1CH0_CR_TXPERBITRANK1_Lane6_MSK (0x0F000000)
+ #define DDRDATA1CH0_CR_TXPERBITRANK1_Lane6_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_TXPERBITRANK1_Lane7_OFF (28)
+ #define DDRDATA1CH0_CR_TXPERBITRANK1_Lane7_WID ( 4)
+ #define DDRDATA1CH0_CR_TXPERBITRANK1_Lane7_MSK (0xF0000000)
+ #define DDRDATA1CH0_CR_TXPERBITRANK1_Lane7_MAX (0x0000000F)
+
+#define DDRDATA1CH0_CR_TXPERBITRANK2_REG (0x00000238)
+ #define DDRDATA1CH0_CR_TXPERBITRANK2_Lane0_OFF ( 0)
+ #define DDRDATA1CH0_CR_TXPERBITRANK2_Lane0_WID ( 4)
+ #define DDRDATA1CH0_CR_TXPERBITRANK2_Lane0_MSK (0x0000000F)
+ #define DDRDATA1CH0_CR_TXPERBITRANK2_Lane0_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_TXPERBITRANK2_Lane1_OFF ( 4)
+ #define DDRDATA1CH0_CR_TXPERBITRANK2_Lane1_WID ( 4)
+ #define DDRDATA1CH0_CR_TXPERBITRANK2_Lane1_MSK (0x000000F0)
+ #define DDRDATA1CH0_CR_TXPERBITRANK2_Lane1_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_TXPERBITRANK2_Lane2_OFF ( 8)
+ #define DDRDATA1CH0_CR_TXPERBITRANK2_Lane2_WID ( 4)
+ #define DDRDATA1CH0_CR_TXPERBITRANK2_Lane2_MSK (0x00000F00)
+ #define DDRDATA1CH0_CR_TXPERBITRANK2_Lane2_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_TXPERBITRANK2_Lane3_OFF (12)
+ #define DDRDATA1CH0_CR_TXPERBITRANK2_Lane3_WID ( 4)
+ #define DDRDATA1CH0_CR_TXPERBITRANK2_Lane3_MSK (0x0000F000)
+ #define DDRDATA1CH0_CR_TXPERBITRANK2_Lane3_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_TXPERBITRANK2_Lane4_OFF (16)
+ #define DDRDATA1CH0_CR_TXPERBITRANK2_Lane4_WID ( 4)
+ #define DDRDATA1CH0_CR_TXPERBITRANK2_Lane4_MSK (0x000F0000)
+ #define DDRDATA1CH0_CR_TXPERBITRANK2_Lane4_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_TXPERBITRANK2_Lane5_OFF (20)
+ #define DDRDATA1CH0_CR_TXPERBITRANK2_Lane5_WID ( 4)
+ #define DDRDATA1CH0_CR_TXPERBITRANK2_Lane5_MSK (0x00F00000)
+ #define DDRDATA1CH0_CR_TXPERBITRANK2_Lane5_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_TXPERBITRANK2_Lane6_OFF (24)
+ #define DDRDATA1CH0_CR_TXPERBITRANK2_Lane6_WID ( 4)
+ #define DDRDATA1CH0_CR_TXPERBITRANK2_Lane6_MSK (0x0F000000)
+ #define DDRDATA1CH0_CR_TXPERBITRANK2_Lane6_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_TXPERBITRANK2_Lane7_OFF (28)
+ #define DDRDATA1CH0_CR_TXPERBITRANK2_Lane7_WID ( 4)
+ #define DDRDATA1CH0_CR_TXPERBITRANK2_Lane7_MSK (0xF0000000)
+ #define DDRDATA1CH0_CR_TXPERBITRANK2_Lane7_MAX (0x0000000F)
+
+#define DDRDATA1CH0_CR_TXPERBITRANK3_REG (0x0000023C)
+ #define DDRDATA1CH0_CR_TXPERBITRANK3_Lane0_OFF ( 0)
+ #define DDRDATA1CH0_CR_TXPERBITRANK3_Lane0_WID ( 4)
+ #define DDRDATA1CH0_CR_TXPERBITRANK3_Lane0_MSK (0x0000000F)
+ #define DDRDATA1CH0_CR_TXPERBITRANK3_Lane0_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_TXPERBITRANK3_Lane1_OFF ( 4)
+ #define DDRDATA1CH0_CR_TXPERBITRANK3_Lane1_WID ( 4)
+ #define DDRDATA1CH0_CR_TXPERBITRANK3_Lane1_MSK (0x000000F0)
+ #define DDRDATA1CH0_CR_TXPERBITRANK3_Lane1_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_TXPERBITRANK3_Lane2_OFF ( 8)
+ #define DDRDATA1CH0_CR_TXPERBITRANK3_Lane2_WID ( 4)
+ #define DDRDATA1CH0_CR_TXPERBITRANK3_Lane2_MSK (0x00000F00)
+ #define DDRDATA1CH0_CR_TXPERBITRANK3_Lane2_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_TXPERBITRANK3_Lane3_OFF (12)
+ #define DDRDATA1CH0_CR_TXPERBITRANK3_Lane3_WID ( 4)
+ #define DDRDATA1CH0_CR_TXPERBITRANK3_Lane3_MSK (0x0000F000)
+ #define DDRDATA1CH0_CR_TXPERBITRANK3_Lane3_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_TXPERBITRANK3_Lane4_OFF (16)
+ #define DDRDATA1CH0_CR_TXPERBITRANK3_Lane4_WID ( 4)
+ #define DDRDATA1CH0_CR_TXPERBITRANK3_Lane4_MSK (0x000F0000)
+ #define DDRDATA1CH0_CR_TXPERBITRANK3_Lane4_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_TXPERBITRANK3_Lane5_OFF (20)
+ #define DDRDATA1CH0_CR_TXPERBITRANK3_Lane5_WID ( 4)
+ #define DDRDATA1CH0_CR_TXPERBITRANK3_Lane5_MSK (0x00F00000)
+ #define DDRDATA1CH0_CR_TXPERBITRANK3_Lane5_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_TXPERBITRANK3_Lane6_OFF (24)
+ #define DDRDATA1CH0_CR_TXPERBITRANK3_Lane6_WID ( 4)
+ #define DDRDATA1CH0_CR_TXPERBITRANK3_Lane6_MSK (0x0F000000)
+ #define DDRDATA1CH0_CR_TXPERBITRANK3_Lane6_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_TXPERBITRANK3_Lane7_OFF (28)
+ #define DDRDATA1CH0_CR_TXPERBITRANK3_Lane7_WID ( 4)
+ #define DDRDATA1CH0_CR_TXPERBITRANK3_Lane7_MSK (0xF0000000)
+ #define DDRDATA1CH0_CR_TXPERBITRANK3_Lane7_MAX (0x0000000F)
+
+#define DDRDATA1CH0_CR_RCOMPDATA0_REG (0x00000240)
+ #define DDRDATA1CH0_CR_RCOMPDATA0_RcompDrvUp_OFF ( 0)
+ #define DDRDATA1CH0_CR_RCOMPDATA0_RcompDrvUp_WID ( 6)
+ #define DDRDATA1CH0_CR_RCOMPDATA0_RcompDrvUp_MSK (0x0000003F)
+ #define DDRDATA1CH0_CR_RCOMPDATA0_RcompDrvUp_MAX (0x0000003F)
+ #define DDRDATA1CH0_CR_RCOMPDATA0_Spare0_OFF ( 6)
+ #define DDRDATA1CH0_CR_RCOMPDATA0_Spare0_WID ( 3)
+ #define DDRDATA1CH0_CR_RCOMPDATA0_Spare0_MSK (0x000001C0)
+ #define DDRDATA1CH0_CR_RCOMPDATA0_Spare0_MAX (0x00000007)
+ #define DDRDATA1CH0_CR_RCOMPDATA0_RcompDrvDown_OFF ( 9)
+ #define DDRDATA1CH0_CR_RCOMPDATA0_RcompDrvDown_WID ( 6)
+ #define DDRDATA1CH0_CR_RCOMPDATA0_RcompDrvDown_MSK (0x00007E00)
+ #define DDRDATA1CH0_CR_RCOMPDATA0_RcompDrvDown_MAX (0x0000003F)
+ #define DDRDATA1CH0_CR_RCOMPDATA0_VTComp_OFF (15)
+ #define DDRDATA1CH0_CR_RCOMPDATA0_VTComp_WID ( 5)
+ #define DDRDATA1CH0_CR_RCOMPDATA0_VTComp_MSK (0x000F8000)
+ #define DDRDATA1CH0_CR_RCOMPDATA0_VTComp_MAX (0x0000001F)
+ #define DDRDATA1CH0_CR_RCOMPDATA0_TcoComp_OFF (20)
+ #define DDRDATA1CH0_CR_RCOMPDATA0_TcoComp_WID ( 6)
+ #define DDRDATA1CH0_CR_RCOMPDATA0_TcoComp_MSK (0x03F00000)
+ #define DDRDATA1CH0_CR_RCOMPDATA0_TcoComp_MAX (0x0000003F)
+ #define DDRDATA1CH0_CR_RCOMPDATA0_SlewRateComp_OFF (26)
+ #define DDRDATA1CH0_CR_RCOMPDATA0_SlewRateComp_WID ( 5)
+ #define DDRDATA1CH0_CR_RCOMPDATA0_SlewRateComp_MSK (0x7C000000)
+ #define DDRDATA1CH0_CR_RCOMPDATA0_SlewRateComp_MAX (0x0000001F)
+ #define DDRDATA1CH0_CR_RCOMPDATA0_Spare2_OFF (31)
+ #define DDRDATA1CH0_CR_RCOMPDATA0_Spare2_WID ( 1)
+ #define DDRDATA1CH0_CR_RCOMPDATA0_Spare2_MSK (0x80000000)
+ #define DDRDATA1CH0_CR_RCOMPDATA0_Spare2_MAX (0x00000001)
+
+#define DDRDATA1CH0_CR_RCOMPDATA1_REG (0x00000244)
+ #define DDRDATA1CH0_CR_RCOMPDATA1_RcompOdtUp_OFF ( 0)
+ #define DDRDATA1CH0_CR_RCOMPDATA1_RcompOdtUp_WID ( 6)
+ #define DDRDATA1CH0_CR_RCOMPDATA1_RcompOdtUp_MSK (0x0000003F)
+ #define DDRDATA1CH0_CR_RCOMPDATA1_RcompOdtUp_MAX (0x0000003F)
+ #define DDRDATA1CH0_CR_RCOMPDATA1_Spare0_OFF ( 6)
+ #define DDRDATA1CH0_CR_RCOMPDATA1_Spare0_WID ( 3)
+ #define DDRDATA1CH0_CR_RCOMPDATA1_Spare0_MSK (0x000001C0)
+ #define DDRDATA1CH0_CR_RCOMPDATA1_Spare0_MAX (0x00000007)
+ #define DDRDATA1CH0_CR_RCOMPDATA1_RcompOdtDown_OFF ( 9)
+ #define DDRDATA1CH0_CR_RCOMPDATA1_RcompOdtDown_WID ( 6)
+ #define DDRDATA1CH0_CR_RCOMPDATA1_RcompOdtDown_MSK (0x00007E00)
+ #define DDRDATA1CH0_CR_RCOMPDATA1_RcompOdtDown_MAX (0x0000003F)
+ #define DDRDATA1CH0_CR_RCOMPDATA1_Spare1_OFF (15)
+ #define DDRDATA1CH0_CR_RCOMPDATA1_Spare1_WID ( 1)
+ #define DDRDATA1CH0_CR_RCOMPDATA1_Spare1_MSK (0x00008000)
+ #define DDRDATA1CH0_CR_RCOMPDATA1_Spare1_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_RCOMPDATA1_PanicDrvDn_OFF (16)
+ #define DDRDATA1CH0_CR_RCOMPDATA1_PanicDrvDn_WID ( 6)
+ #define DDRDATA1CH0_CR_RCOMPDATA1_PanicDrvDn_MSK (0x003F0000)
+ #define DDRDATA1CH0_CR_RCOMPDATA1_PanicDrvDn_MAX (0x0000003F)
+ #define DDRDATA1CH0_CR_RCOMPDATA1_PanicDrvUp_OFF (22)
+ #define DDRDATA1CH0_CR_RCOMPDATA1_PanicDrvUp_WID ( 6)
+ #define DDRDATA1CH0_CR_RCOMPDATA1_PanicDrvUp_MSK (0x0FC00000)
+ #define DDRDATA1CH0_CR_RCOMPDATA1_PanicDrvUp_MAX (0x0000003F)
+ #define DDRDATA1CH0_CR_RCOMPDATA1_LevelShifterComp_OFF (28)
+ #define DDRDATA1CH0_CR_RCOMPDATA1_LevelShifterComp_WID ( 3)
+ #define DDRDATA1CH0_CR_RCOMPDATA1_LevelShifterComp_MSK (0x70000000)
+ #define DDRDATA1CH0_CR_RCOMPDATA1_LevelShifterComp_MAX (0x00000007)
+ #define DDRDATA1CH0_CR_RCOMPDATA1_Spare2_OFF (31)
+ #define DDRDATA1CH0_CR_RCOMPDATA1_Spare2_WID ( 1)
+ #define DDRDATA1CH0_CR_RCOMPDATA1_Spare2_MSK (0x80000000)
+ #define DDRDATA1CH0_CR_RCOMPDATA1_Spare2_MAX (0x00000001)
+
+#define DDRDATA1CH0_CR_TXXTALK_REG (0x00000248)
+ #define DDRDATA1CH0_CR_TXXTALK_Lane0_OFF ( 0)
+ #define DDRDATA1CH0_CR_TXXTALK_Lane0_WID ( 4)
+ #define DDRDATA1CH0_CR_TXXTALK_Lane0_MSK (0x0000000F)
+ #define DDRDATA1CH0_CR_TXXTALK_Lane0_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_TXXTALK_Lane1_OFF ( 4)
+ #define DDRDATA1CH0_CR_TXXTALK_Lane1_WID ( 4)
+ #define DDRDATA1CH0_CR_TXXTALK_Lane1_MSK (0x000000F0)
+ #define DDRDATA1CH0_CR_TXXTALK_Lane1_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_TXXTALK_Lane2_OFF ( 8)
+ #define DDRDATA1CH0_CR_TXXTALK_Lane2_WID ( 4)
+ #define DDRDATA1CH0_CR_TXXTALK_Lane2_MSK (0x00000F00)
+ #define DDRDATA1CH0_CR_TXXTALK_Lane2_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_TXXTALK_Lane3_OFF (12)
+ #define DDRDATA1CH0_CR_TXXTALK_Lane3_WID ( 4)
+ #define DDRDATA1CH0_CR_TXXTALK_Lane3_MSK (0x0000F000)
+ #define DDRDATA1CH0_CR_TXXTALK_Lane3_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_TXXTALK_Lane4_OFF (16)
+ #define DDRDATA1CH0_CR_TXXTALK_Lane4_WID ( 4)
+ #define DDRDATA1CH0_CR_TXXTALK_Lane4_MSK (0x000F0000)
+ #define DDRDATA1CH0_CR_TXXTALK_Lane4_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_TXXTALK_Lane5_OFF (20)
+ #define DDRDATA1CH0_CR_TXXTALK_Lane5_WID ( 4)
+ #define DDRDATA1CH0_CR_TXXTALK_Lane5_MSK (0x00F00000)
+ #define DDRDATA1CH0_CR_TXXTALK_Lane5_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_TXXTALK_Lane6_OFF (24)
+ #define DDRDATA1CH0_CR_TXXTALK_Lane6_WID ( 4)
+ #define DDRDATA1CH0_CR_TXXTALK_Lane6_MSK (0x0F000000)
+ #define DDRDATA1CH0_CR_TXXTALK_Lane6_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_TXXTALK_Lane7_OFF (28)
+ #define DDRDATA1CH0_CR_TXXTALK_Lane7_WID ( 4)
+ #define DDRDATA1CH0_CR_TXXTALK_Lane7_MSK (0xF0000000)
+ #define DDRDATA1CH0_CR_TXXTALK_Lane7_MAX (0x0000000F)
+
+#define DDRDATA1CH0_CR_RXOFFSETVDQ_REG (0x0000024C)
+ #define DDRDATA1CH0_CR_RXOFFSETVDQ_Lane0_OFF ( 0)
+ #define DDRDATA1CH0_CR_RXOFFSETVDQ_Lane0_WID ( 4)
+ #define DDRDATA1CH0_CR_RXOFFSETVDQ_Lane0_MSK (0x0000000F)
+ #define DDRDATA1CH0_CR_RXOFFSETVDQ_Lane0_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_RXOFFSETVDQ_Lane1_OFF ( 4)
+ #define DDRDATA1CH0_CR_RXOFFSETVDQ_Lane1_WID ( 4)
+ #define DDRDATA1CH0_CR_RXOFFSETVDQ_Lane1_MSK (0x000000F0)
+ #define DDRDATA1CH0_CR_RXOFFSETVDQ_Lane1_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_RXOFFSETVDQ_Lane2_OFF ( 8)
+ #define DDRDATA1CH0_CR_RXOFFSETVDQ_Lane2_WID ( 4)
+ #define DDRDATA1CH0_CR_RXOFFSETVDQ_Lane2_MSK (0x00000F00)
+ #define DDRDATA1CH0_CR_RXOFFSETVDQ_Lane2_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_RXOFFSETVDQ_Lane3_OFF (12)
+ #define DDRDATA1CH0_CR_RXOFFSETVDQ_Lane3_WID ( 4)
+ #define DDRDATA1CH0_CR_RXOFFSETVDQ_Lane3_MSK (0x0000F000)
+ #define DDRDATA1CH0_CR_RXOFFSETVDQ_Lane3_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_RXOFFSETVDQ_Lane4_OFF (16)
+ #define DDRDATA1CH0_CR_RXOFFSETVDQ_Lane4_WID ( 4)
+ #define DDRDATA1CH0_CR_RXOFFSETVDQ_Lane4_MSK (0x000F0000)
+ #define DDRDATA1CH0_CR_RXOFFSETVDQ_Lane4_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_RXOFFSETVDQ_Lane5_OFF (20)
+ #define DDRDATA1CH0_CR_RXOFFSETVDQ_Lane5_WID ( 4)
+ #define DDRDATA1CH0_CR_RXOFFSETVDQ_Lane5_MSK (0x00F00000)
+ #define DDRDATA1CH0_CR_RXOFFSETVDQ_Lane5_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_RXOFFSETVDQ_Lane6_OFF (24)
+ #define DDRDATA1CH0_CR_RXOFFSETVDQ_Lane6_WID ( 4)
+ #define DDRDATA1CH0_CR_RXOFFSETVDQ_Lane6_MSK (0x0F000000)
+ #define DDRDATA1CH0_CR_RXOFFSETVDQ_Lane6_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_RXOFFSETVDQ_Lane7_OFF (28)
+ #define DDRDATA1CH0_CR_RXOFFSETVDQ_Lane7_WID ( 4)
+ #define DDRDATA1CH0_CR_RXOFFSETVDQ_Lane7_MSK (0xF0000000)
+ #define DDRDATA1CH0_CR_RXOFFSETVDQ_Lane7_MAX (0x0000000F)
+
+#define DDRDATA1CH0_CR_DDRDATARESERVED_REG (0x00000250)
+ #define DDRDATA1CH0_CR_DDRDATARESERVED_Spare_OFF ( 0)
+ #define DDRDATA1CH0_CR_DDRDATARESERVED_Spare_WID (32)
+ #define DDRDATA1CH0_CR_DDRDATARESERVED_Spare_MSK (0xFFFFFFFF)
+ #define DDRDATA1CH0_CR_DDRDATARESERVED_Spare_MAX (0xFFFFFFFF)
+
+#define DDRDATA1CH0_CR_DATATRAINFEEDBACK_REG (0x00000254)
+ #define DDRDATA1CH0_CR_DATATRAINFEEDBACK_DataTrainFeedback_OFF ( 0)
+ #define DDRDATA1CH0_CR_DATATRAINFEEDBACK_DataTrainFeedback_WID ( 9)
+ #define DDRDATA1CH0_CR_DATATRAINFEEDBACK_DataTrainFeedback_MSK (0x000001FF)
+ #define DDRDATA1CH0_CR_DATATRAINFEEDBACK_DataTrainFeedback_MAX (0x000001FF)
+ #define DDRDATA1CH0_CR_DATATRAINFEEDBACK_Spare_OFF ( 9)
+ #define DDRDATA1CH0_CR_DATATRAINFEEDBACK_Spare_WID (23)
+ #define DDRDATA1CH0_CR_DATATRAINFEEDBACK_Spare_MSK (0xFFFFFE00)
+ #define DDRDATA1CH0_CR_DATATRAINFEEDBACK_Spare_MAX (0x007FFFFF)
+
+#define DDRDATA1CH0_CR_DLLPITESTANDADC_REG (0x00000258)
+ #define DDRDATA1CH0_CR_DLLPITESTANDADC_RunTest_OFF ( 0)
+ #define DDRDATA1CH0_CR_DLLPITESTANDADC_RunTest_WID ( 1)
+ #define DDRDATA1CH0_CR_DLLPITESTANDADC_RunTest_MSK (0x00000001)
+ #define DDRDATA1CH0_CR_DLLPITESTANDADC_RunTest_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DLLPITESTANDADC_RunTest_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DLLPITESTANDADC_Load_OFF ( 1)
+ #define DDRDATA1CH0_CR_DLLPITESTANDADC_Load_WID ( 1)
+ #define DDRDATA1CH0_CR_DLLPITESTANDADC_Load_MSK (0x00000002)
+ #define DDRDATA1CH0_CR_DLLPITESTANDADC_Load_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DLLPITESTANDADC_Load_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DLLPITESTANDADC_ModeHVM_OFF ( 2)
+ #define DDRDATA1CH0_CR_DLLPITESTANDADC_ModeHVM_WID ( 1)
+ #define DDRDATA1CH0_CR_DLLPITESTANDADC_ModeHVM_MSK (0x00000004)
+ #define DDRDATA1CH0_CR_DLLPITESTANDADC_ModeHVM_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DLLPITESTANDADC_ModeHVM_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DLLPITESTANDADC_ModeDV_OFF ( 3)
+ #define DDRDATA1CH0_CR_DLLPITESTANDADC_ModeDV_WID ( 1)
+ #define DDRDATA1CH0_CR_DLLPITESTANDADC_ModeDV_MSK (0x00000008)
+ #define DDRDATA1CH0_CR_DLLPITESTANDADC_ModeDV_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DLLPITESTANDADC_ModeDV_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DLLPITESTANDADC_ModeADC_OFF ( 4)
+ #define DDRDATA1CH0_CR_DLLPITESTANDADC_ModeADC_WID ( 1)
+ #define DDRDATA1CH0_CR_DLLPITESTANDADC_ModeADC_MSK (0x00000010)
+ #define DDRDATA1CH0_CR_DLLPITESTANDADC_ModeADC_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DLLPITESTANDADC_ModeADC_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DLLPITESTANDADC_LoadCount_OFF ( 5)
+ #define DDRDATA1CH0_CR_DLLPITESTANDADC_LoadCount_WID (10)
+ #define DDRDATA1CH0_CR_DLLPITESTANDADC_LoadCount_MSK (0x00007FE0)
+ #define DDRDATA1CH0_CR_DLLPITESTANDADC_LoadCount_MAX (0x000003FF)
+ #define DDRDATA1CH0_CR_DLLPITESTANDADC_CountStatus_OFF (15)
+ #define DDRDATA1CH0_CR_DLLPITESTANDADC_CountStatus_WID (10)
+ #define DDRDATA1CH0_CR_DLLPITESTANDADC_CountStatus_MSK (0x01FF8000)
+ #define DDRDATA1CH0_CR_DLLPITESTANDADC_CountStatus_MAX (0x000003FF)
+ #define DDRDATA1CH0_CR_DLLPITESTANDADC_CountStatus_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DLLPITESTANDADC_Spare_OFF (25)
+ #define DDRDATA1CH0_CR_DLLPITESTANDADC_Spare_WID ( 7)
+ #define DDRDATA1CH0_CR_DLLPITESTANDADC_Spare_MSK (0xFE000000)
+ #define DDRDATA1CH0_CR_DLLPITESTANDADC_Spare_MAX (0x0000007F)
+
+#define DDRDATA1CH0_CR_DDRCRDATAOFFSETCOMP_REG (0x0000025C)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_OFF ( 0)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_WID ( 6)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_MSK (0x0000003F)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_MAX (0x0000003F)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_OFF ( 6)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_WID ( 6)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_MSK (0x00000FC0)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_MAX (0x0000003F)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_OFF (12)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_WID ( 5)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_MSK (0x0001F000)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_MAX (0x0000001F)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_OFF (17)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_WID ( 5)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_MSK (0x003E0000)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_MAX (0x0000001F)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_OFF (22)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_WID ( 5)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_MSK (0x07C00000)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_MAX (0x0000001F)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_OFF (27)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_WID ( 5)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_MSK (0xF8000000)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_MAX (0x0000001F)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_DEF (0x00000000)
+
+#define DDRDATA1CH0_CR_DDRCRDATACONTROL1_REG (0x00000260)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_RefPi_OFF ( 0)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_RefPi_WID ( 4)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_RefPi_MSK (0x0000000F)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_RefPi_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_RefPi_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_DllMask_OFF ( 4)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_DllMask_WID ( 2)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_DllMask_MSK (0x00000030)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_DllMask_MAX (0x00000003)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_DllMask_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_DllWeakLock_OFF ( 6)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_DllWeakLock_WID ( 1)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_DllWeakLock_MSK (0x00000040)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_DllWeakLock_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_DllWeakLock_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_OFF ( 7)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_WID ( 3)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_MSK (0x00000380)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_MAX (0x00000007)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_OFF (10)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_WID ( 3)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_MSK (0x00001C00)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_MAX (0x00000007)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_OdtDelay_OFF (13)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_OdtDelay_WID ( 4)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_OdtDelay_MSK (0x0001E000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_OdtDelay_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_OdtDelay_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_OdtDuration_OFF (17)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_OdtDuration_WID ( 3)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_OdtDuration_MSK (0x000E0000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_OdtDuration_MAX (0x00000007)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_OdtDuration_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_OFF (20)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_WID ( 4)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_MSK (0x00F00000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_OFF (24)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_WID ( 3)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_MSK (0x07000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_MAX (0x00000007)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_OFF (27)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_WID ( 3)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_MSK (0x38000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_MAX (0x00000007)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_OFF (30)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_WID ( 1)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_MSK (0x40000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_Rsvd1_OFF (31)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_Rsvd1_WID ( 1)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_Rsvd1_MSK (0x80000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_Rsvd1_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL1_Rsvd1_DEF (0x00000000)
+
+#define DDRDATA1CH0_CR_DDRCRDATACONTROL2_REG (0x00000264)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_OFF ( 0)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_WID ( 5)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_MSK (0x0000001F)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_MAX (0x0000001F)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_OFF ( 5)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_WID ( 1)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_MSK (0x00000020)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL2_ForceRxOn_OFF ( 6)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL2_ForceRxOn_WID ( 1)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL2_ForceRxOn_MSK (0x00000040)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL2_ForceRxOn_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL2_ForceRxOn_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL2_LeakerComp_OFF ( 7)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL2_LeakerComp_WID ( 2)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL2_LeakerComp_MSK (0x00000180)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL2_LeakerComp_MAX (0x00000003)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL2_LeakerComp_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_OFF ( 9)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_WID ( 4)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_MSK (0x00001E00)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_MAX (0x0000000F)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_DEF (0x00000008)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_OFF (13)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_WID ( 5)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_MSK (0x0003E000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_MAX (0x0000001F)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_DEF (0x00000011)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_OFF (18)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_WID ( 1)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_MSK (0x00040000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL2_Spare_OFF (19)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL2_Spare_WID (13)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL2_Spare_MSK (0xFFF80000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL2_Spare_MAX (0x00001FFF)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL2_Spare_DEF (0x00000000)
+
+#define DDRDATA1CH0_CR_DDRCRVSSHIORVREFCONTROL_REG (0x0000026C)
+ #define DDRDATA1CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_OFF ( 0)
+ #define DDRDATA1CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_WID (24)
+ #define DDRDATA1CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_MSK (0x00FFFFFF)
+ #define DDRDATA1CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_MAX (0x00FFFFFF)
+ #define DDRDATA1CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_OFF (24)
+ #define DDRDATA1CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_WID ( 8)
+ #define DDRDATA1CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_MSK (0xFF000000)
+ #define DDRDATA1CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_MAX (0x000000FF)
+ #define DDRDATA1CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_DEF (0x00000000)
+
+#define DDRDATA1CH0_CR_DDRCRDATAOFFSETTRAIN_REG (0x00000270)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_OFF ( 0)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_WID ( 6)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_MSK (0x0000003F)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_MAX (0x0000003F)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_OFF ( 6)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_WID ( 6)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_MSK (0x00000FC0)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_MAX (0x0000003F)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_OFF (12)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_WID ( 6)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_MSK (0x0003F000)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_MAX (0x0000003F)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_OFF (18)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_WID ( 6)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_MSK (0x00FC0000)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_MAX (0x0000003F)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_OFF (24)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_WID ( 7)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_MSK (0x7F000000)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_MAX (0x0000007F)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_OFF (31)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_WID ( 1)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_MSK (0x80000000)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_DEF (0x00000000)
+
+#define DDRDATA1CH0_CR_DDRCRDATACONTROL0_REG (0x00000274)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_OFF ( 0)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_WID ( 1)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_MSK (0x00000001)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_OFF ( 1)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_WID ( 1)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_MSK (0x00000002)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_OFF ( 2)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_WID ( 1)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_MSK (0x00000004)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_OFF ( 3)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_WID ( 1)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_MSK (0x00000008)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_TxOn_OFF ( 4)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_TxOn_WID ( 1)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_TxOn_MSK (0x00000010)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_TxOn_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_TxOn_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_RfOn_OFF ( 5)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_RfOn_WID ( 1)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_RfOn_MSK (0x00000020)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_RfOn_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_RfOn_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_RxPiOn_OFF ( 6)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_RxPiOn_WID ( 1)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_RxPiOn_MSK (0x00000040)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_RxPiOn_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_RxPiOn_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_TxPiOn_OFF ( 7)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_TxPiOn_WID ( 1)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_TxPiOn_MSK (0x00000080)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_TxPiOn_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_TxPiOn_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_OFF ( 8)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_WID ( 1)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_MSK (0x00000100)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_OFF ( 9)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_WID ( 1)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_MSK (0x00000200)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_TxDisable_OFF (10)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_TxDisable_WID ( 1)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_TxDisable_MSK (0x00000400)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_TxDisable_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_TxDisable_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_RxDisable_OFF (11)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_RxDisable_WID ( 1)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_RxDisable_MSK (0x00000800)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_RxDisable_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_RxDisable_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_TxLong_OFF (12)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_TxLong_WID ( 1)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_TxLong_MSK (0x00001000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_TxLong_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_TxLong_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_OFF (13)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_WID ( 2)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_MSK (0x00006000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_MAX (0x00000003)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_RxReadPointer_OFF (15)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_RxReadPointer_WID ( 3)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_RxReadPointer_MSK (0x00038000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_RxReadPointer_MAX (0x00000007)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_RxReadPointer_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_OFF (18)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_WID ( 1)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_MSK (0x00040000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_OFF (19)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_WID ( 1)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_MSK (0x00080000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_ReadRFRd_OFF (20)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_ReadRFRd_WID ( 1)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_ReadRFRd_MSK (0x00100000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_ReadRFRd_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_ReadRFRd_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_ReadRFWr_OFF (21)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_ReadRFWr_WID ( 1)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_ReadRFWr_MSK (0x00200000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_ReadRFWr_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_ReadRFWr_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_ReadRFRank_OFF (22)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_ReadRFRank_WID ( 2)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_ReadRFRank_MSK (0x00C00000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_ReadRFRank_MAX (0x00000003)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_ReadRFRank_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_OFF (24)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_WID ( 1)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_MSK (0x01000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_OdtSampOff_OFF (25)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_OdtSampOff_WID ( 1)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_OdtSampOff_MSK (0x02000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_OdtSampOff_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_OdtSampOff_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_OFF (26)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_WID ( 1)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_MSK (0x04000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_OFF (27)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_WID ( 1)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_MSK (0x08000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_OFF (28)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_WID ( 1)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_MSK (0x10000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_OFF (29)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_WID ( 1)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_MSK (0x20000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_OFF (30)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_WID ( 1)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_MSK (0x40000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_OFF (31)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_WID ( 1)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_MSK (0x80000000)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_DEF (0x00000000)
+
+#define DDRDATA1CH0_CR_DDRCRVREFADJUST1_REG (0x00000278)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_OFF ( 0)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_WID ( 7)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_MSK (0x0000007F)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_MAX (0x0000007F)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_OFF ( 7)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_WID ( 7)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_MSK (0x00003F80)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_MAX (0x0000007F)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_OFF (14)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_WID ( 7)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_MSK (0x001FC000)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_MAX (0x0000007F)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_OFF (21)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_WID ( 1)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_MSK (0x00200000)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_OFF (22)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_WID ( 1)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_MSK (0x00400000)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_OFF (23)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_WID ( 1)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_MSK (0x00800000)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_OFF (24)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_WID ( 2)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_MSK (0x03000000)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_MAX (0x00000003)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_OFF (26)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_WID ( 1)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_MSK (0x04000000)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_Rsvd_OFF (27)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_Rsvd_WID ( 2)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_Rsvd_MSK (0x18000000)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_Rsvd_MAX (0x00000003)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_Rsvd_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_caSlowBW_OFF (29)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_caSlowBW_WID ( 1)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_caSlowBW_MSK (0x20000000)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_caSlowBW_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_caSlowBW_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_OFF (30)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_WID ( 1)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_MSK (0x40000000)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_DEF (0x00000000)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_OFF (31)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_WID ( 1)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_MSK (0x80000000)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_MAX (0x00000001)
+ #define DDRDATA1CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_DEF (0x00000000)
+
+#define DDRDATA1CH1_CR_RXTRAINRANK0_REG (0x00000300)
+ #define DDRDATA1CH1_CR_RXTRAINRANK0_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA1CH1_CR_RXTRAINRANK0_RxRcvEnPi_WID ( 9)
+ #define DDRDATA1CH1_CR_RXTRAINRANK0_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA1CH1_CR_RXTRAINRANK0_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA1CH1_CR_RXTRAINRANK0_RxDqsPPi_OFF ( 9)
+ #define DDRDATA1CH1_CR_RXTRAINRANK0_RxDqsPPi_WID ( 6)
+ #define DDRDATA1CH1_CR_RXTRAINRANK0_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA1CH1_CR_RXTRAINRANK0_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA1CH1_CR_RXTRAINRANK0_RxEq_OFF (15)
+ #define DDRDATA1CH1_CR_RXTRAINRANK0_RxEq_WID ( 5)
+ #define DDRDATA1CH1_CR_RXTRAINRANK0_RxEq_MSK (0x000F8000)
+ #define DDRDATA1CH1_CR_RXTRAINRANK0_RxEq_MAX (0x0000001F)
+ #define DDRDATA1CH1_CR_RXTRAINRANK0_RxDqsNPi_OFF (20)
+ #define DDRDATA1CH1_CR_RXTRAINRANK0_RxDqsNPi_WID ( 6)
+ #define DDRDATA1CH1_CR_RXTRAINRANK0_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA1CH1_CR_RXTRAINRANK0_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA1CH1_CR_RXTRAINRANK0_RxVref_OFF (26)
+ #define DDRDATA1CH1_CR_RXTRAINRANK0_RxVref_WID ( 6)
+ #define DDRDATA1CH1_CR_RXTRAINRANK0_RxVref_MSK (0xFC000000)
+ #define DDRDATA1CH1_CR_RXTRAINRANK0_RxVref_MAX (0x0000003F)
+
+#define DDRDATA1CH1_CR_RXTRAINRANK1_REG (0x00000304)
+ #define DDRDATA1CH1_CR_RXTRAINRANK1_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA1CH1_CR_RXTRAINRANK1_RxRcvEnPi_WID ( 9)
+ #define DDRDATA1CH1_CR_RXTRAINRANK1_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA1CH1_CR_RXTRAINRANK1_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA1CH1_CR_RXTRAINRANK1_RxDqsPPi_OFF ( 9)
+ #define DDRDATA1CH1_CR_RXTRAINRANK1_RxDqsPPi_WID ( 6)
+ #define DDRDATA1CH1_CR_RXTRAINRANK1_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA1CH1_CR_RXTRAINRANK1_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA1CH1_CR_RXTRAINRANK1_RxEq_OFF (15)
+ #define DDRDATA1CH1_CR_RXTRAINRANK1_RxEq_WID ( 5)
+ #define DDRDATA1CH1_CR_RXTRAINRANK1_RxEq_MSK (0x000F8000)
+ #define DDRDATA1CH1_CR_RXTRAINRANK1_RxEq_MAX (0x0000001F)
+ #define DDRDATA1CH1_CR_RXTRAINRANK1_RxDqsNPi_OFF (20)
+ #define DDRDATA1CH1_CR_RXTRAINRANK1_RxDqsNPi_WID ( 6)
+ #define DDRDATA1CH1_CR_RXTRAINRANK1_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA1CH1_CR_RXTRAINRANK1_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA1CH1_CR_RXTRAINRANK1_RxVref_OFF (26)
+ #define DDRDATA1CH1_CR_RXTRAINRANK1_RxVref_WID ( 6)
+ #define DDRDATA1CH1_CR_RXTRAINRANK1_RxVref_MSK (0xFC000000)
+ #define DDRDATA1CH1_CR_RXTRAINRANK1_RxVref_MAX (0x0000003F)
+
+#define DDRDATA1CH1_CR_RXTRAINRANK2_REG (0x00000308)
+ #define DDRDATA1CH1_CR_RXTRAINRANK2_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA1CH1_CR_RXTRAINRANK2_RxRcvEnPi_WID ( 9)
+ #define DDRDATA1CH1_CR_RXTRAINRANK2_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA1CH1_CR_RXTRAINRANK2_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA1CH1_CR_RXTRAINRANK2_RxDqsPPi_OFF ( 9)
+ #define DDRDATA1CH1_CR_RXTRAINRANK2_RxDqsPPi_WID ( 6)
+ #define DDRDATA1CH1_CR_RXTRAINRANK2_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA1CH1_CR_RXTRAINRANK2_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA1CH1_CR_RXTRAINRANK2_RxEq_OFF (15)
+ #define DDRDATA1CH1_CR_RXTRAINRANK2_RxEq_WID ( 5)
+ #define DDRDATA1CH1_CR_RXTRAINRANK2_RxEq_MSK (0x000F8000)
+ #define DDRDATA1CH1_CR_RXTRAINRANK2_RxEq_MAX (0x0000001F)
+ #define DDRDATA1CH1_CR_RXTRAINRANK2_RxDqsNPi_OFF (20)
+ #define DDRDATA1CH1_CR_RXTRAINRANK2_RxDqsNPi_WID ( 6)
+ #define DDRDATA1CH1_CR_RXTRAINRANK2_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA1CH1_CR_RXTRAINRANK2_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA1CH1_CR_RXTRAINRANK2_RxVref_OFF (26)
+ #define DDRDATA1CH1_CR_RXTRAINRANK2_RxVref_WID ( 6)
+ #define DDRDATA1CH1_CR_RXTRAINRANK2_RxVref_MSK (0xFC000000)
+ #define DDRDATA1CH1_CR_RXTRAINRANK2_RxVref_MAX (0x0000003F)
+
+#define DDRDATA1CH1_CR_RXTRAINRANK3_REG (0x0000030C)
+ #define DDRDATA1CH1_CR_RXTRAINRANK3_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA1CH1_CR_RXTRAINRANK3_RxRcvEnPi_WID ( 9)
+ #define DDRDATA1CH1_CR_RXTRAINRANK3_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA1CH1_CR_RXTRAINRANK3_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA1CH1_CR_RXTRAINRANK3_RxDqsPPi_OFF ( 9)
+ #define DDRDATA1CH1_CR_RXTRAINRANK3_RxDqsPPi_WID ( 6)
+ #define DDRDATA1CH1_CR_RXTRAINRANK3_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA1CH1_CR_RXTRAINRANK3_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA1CH1_CR_RXTRAINRANK3_RxEq_OFF (15)
+ #define DDRDATA1CH1_CR_RXTRAINRANK3_RxEq_WID ( 5)
+ #define DDRDATA1CH1_CR_RXTRAINRANK3_RxEq_MSK (0x000F8000)
+ #define DDRDATA1CH1_CR_RXTRAINRANK3_RxEq_MAX (0x0000001F)
+ #define DDRDATA1CH1_CR_RXTRAINRANK3_RxDqsNPi_OFF (20)
+ #define DDRDATA1CH1_CR_RXTRAINRANK3_RxDqsNPi_WID ( 6)
+ #define DDRDATA1CH1_CR_RXTRAINRANK3_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA1CH1_CR_RXTRAINRANK3_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA1CH1_CR_RXTRAINRANK3_RxVref_OFF (26)
+ #define DDRDATA1CH1_CR_RXTRAINRANK3_RxVref_WID ( 6)
+ #define DDRDATA1CH1_CR_RXTRAINRANK3_RxVref_MSK (0xFC000000)
+ #define DDRDATA1CH1_CR_RXTRAINRANK3_RxVref_MAX (0x0000003F)
+
+#define DDRDATA1CH1_CR_RXPERBITRANK0_REG (0x00000310)
+ #define DDRDATA1CH1_CR_RXPERBITRANK0_Lane0_OFF ( 0)
+ #define DDRDATA1CH1_CR_RXPERBITRANK0_Lane0_WID ( 4)
+ #define DDRDATA1CH1_CR_RXPERBITRANK0_Lane0_MSK (0x0000000F)
+ #define DDRDATA1CH1_CR_RXPERBITRANK0_Lane0_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_RXPERBITRANK0_Lane1_OFF ( 4)
+ #define DDRDATA1CH1_CR_RXPERBITRANK0_Lane1_WID ( 4)
+ #define DDRDATA1CH1_CR_RXPERBITRANK0_Lane1_MSK (0x000000F0)
+ #define DDRDATA1CH1_CR_RXPERBITRANK0_Lane1_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_RXPERBITRANK0_Lane2_OFF ( 8)
+ #define DDRDATA1CH1_CR_RXPERBITRANK0_Lane2_WID ( 4)
+ #define DDRDATA1CH1_CR_RXPERBITRANK0_Lane2_MSK (0x00000F00)
+ #define DDRDATA1CH1_CR_RXPERBITRANK0_Lane2_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_RXPERBITRANK0_Lane3_OFF (12)
+ #define DDRDATA1CH1_CR_RXPERBITRANK0_Lane3_WID ( 4)
+ #define DDRDATA1CH1_CR_RXPERBITRANK0_Lane3_MSK (0x0000F000)
+ #define DDRDATA1CH1_CR_RXPERBITRANK0_Lane3_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_RXPERBITRANK0_Lane4_OFF (16)
+ #define DDRDATA1CH1_CR_RXPERBITRANK0_Lane4_WID ( 4)
+ #define DDRDATA1CH1_CR_RXPERBITRANK0_Lane4_MSK (0x000F0000)
+ #define DDRDATA1CH1_CR_RXPERBITRANK0_Lane4_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_RXPERBITRANK0_Lane5_OFF (20)
+ #define DDRDATA1CH1_CR_RXPERBITRANK0_Lane5_WID ( 4)
+ #define DDRDATA1CH1_CR_RXPERBITRANK0_Lane5_MSK (0x00F00000)
+ #define DDRDATA1CH1_CR_RXPERBITRANK0_Lane5_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_RXPERBITRANK0_Lane6_OFF (24)
+ #define DDRDATA1CH1_CR_RXPERBITRANK0_Lane6_WID ( 4)
+ #define DDRDATA1CH1_CR_RXPERBITRANK0_Lane6_MSK (0x0F000000)
+ #define DDRDATA1CH1_CR_RXPERBITRANK0_Lane6_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_RXPERBITRANK0_Lane7_OFF (28)
+ #define DDRDATA1CH1_CR_RXPERBITRANK0_Lane7_WID ( 4)
+ #define DDRDATA1CH1_CR_RXPERBITRANK0_Lane7_MSK (0xF0000000)
+ #define DDRDATA1CH1_CR_RXPERBITRANK0_Lane7_MAX (0x0000000F)
+
+#define DDRDATA1CH1_CR_RXPERBITRANK1_REG (0x00000314)
+ #define DDRDATA1CH1_CR_RXPERBITRANK1_Lane0_OFF ( 0)
+ #define DDRDATA1CH1_CR_RXPERBITRANK1_Lane0_WID ( 4)
+ #define DDRDATA1CH1_CR_RXPERBITRANK1_Lane0_MSK (0x0000000F)
+ #define DDRDATA1CH1_CR_RXPERBITRANK1_Lane0_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_RXPERBITRANK1_Lane1_OFF ( 4)
+ #define DDRDATA1CH1_CR_RXPERBITRANK1_Lane1_WID ( 4)
+ #define DDRDATA1CH1_CR_RXPERBITRANK1_Lane1_MSK (0x000000F0)
+ #define DDRDATA1CH1_CR_RXPERBITRANK1_Lane1_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_RXPERBITRANK1_Lane2_OFF ( 8)
+ #define DDRDATA1CH1_CR_RXPERBITRANK1_Lane2_WID ( 4)
+ #define DDRDATA1CH1_CR_RXPERBITRANK1_Lane2_MSK (0x00000F00)
+ #define DDRDATA1CH1_CR_RXPERBITRANK1_Lane2_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_RXPERBITRANK1_Lane3_OFF (12)
+ #define DDRDATA1CH1_CR_RXPERBITRANK1_Lane3_WID ( 4)
+ #define DDRDATA1CH1_CR_RXPERBITRANK1_Lane3_MSK (0x0000F000)
+ #define DDRDATA1CH1_CR_RXPERBITRANK1_Lane3_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_RXPERBITRANK1_Lane4_OFF (16)
+ #define DDRDATA1CH1_CR_RXPERBITRANK1_Lane4_WID ( 4)
+ #define DDRDATA1CH1_CR_RXPERBITRANK1_Lane4_MSK (0x000F0000)
+ #define DDRDATA1CH1_CR_RXPERBITRANK1_Lane4_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_RXPERBITRANK1_Lane5_OFF (20)
+ #define DDRDATA1CH1_CR_RXPERBITRANK1_Lane5_WID ( 4)
+ #define DDRDATA1CH1_CR_RXPERBITRANK1_Lane5_MSK (0x00F00000)
+ #define DDRDATA1CH1_CR_RXPERBITRANK1_Lane5_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_RXPERBITRANK1_Lane6_OFF (24)
+ #define DDRDATA1CH1_CR_RXPERBITRANK1_Lane6_WID ( 4)
+ #define DDRDATA1CH1_CR_RXPERBITRANK1_Lane6_MSK (0x0F000000)
+ #define DDRDATA1CH1_CR_RXPERBITRANK1_Lane6_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_RXPERBITRANK1_Lane7_OFF (28)
+ #define DDRDATA1CH1_CR_RXPERBITRANK1_Lane7_WID ( 4)
+ #define DDRDATA1CH1_CR_RXPERBITRANK1_Lane7_MSK (0xF0000000)
+ #define DDRDATA1CH1_CR_RXPERBITRANK1_Lane7_MAX (0x0000000F)
+
+#define DDRDATA1CH1_CR_RXPERBITRANK2_REG (0x00000318)
+ #define DDRDATA1CH1_CR_RXPERBITRANK2_Lane0_OFF ( 0)
+ #define DDRDATA1CH1_CR_RXPERBITRANK2_Lane0_WID ( 4)
+ #define DDRDATA1CH1_CR_RXPERBITRANK2_Lane0_MSK (0x0000000F)
+ #define DDRDATA1CH1_CR_RXPERBITRANK2_Lane0_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_RXPERBITRANK2_Lane1_OFF ( 4)
+ #define DDRDATA1CH1_CR_RXPERBITRANK2_Lane1_WID ( 4)
+ #define DDRDATA1CH1_CR_RXPERBITRANK2_Lane1_MSK (0x000000F0)
+ #define DDRDATA1CH1_CR_RXPERBITRANK2_Lane1_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_RXPERBITRANK2_Lane2_OFF ( 8)
+ #define DDRDATA1CH1_CR_RXPERBITRANK2_Lane2_WID ( 4)
+ #define DDRDATA1CH1_CR_RXPERBITRANK2_Lane2_MSK (0x00000F00)
+ #define DDRDATA1CH1_CR_RXPERBITRANK2_Lane2_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_RXPERBITRANK2_Lane3_OFF (12)
+ #define DDRDATA1CH1_CR_RXPERBITRANK2_Lane3_WID ( 4)
+ #define DDRDATA1CH1_CR_RXPERBITRANK2_Lane3_MSK (0x0000F000)
+ #define DDRDATA1CH1_CR_RXPERBITRANK2_Lane3_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_RXPERBITRANK2_Lane4_OFF (16)
+ #define DDRDATA1CH1_CR_RXPERBITRANK2_Lane4_WID ( 4)
+ #define DDRDATA1CH1_CR_RXPERBITRANK2_Lane4_MSK (0x000F0000)
+ #define DDRDATA1CH1_CR_RXPERBITRANK2_Lane4_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_RXPERBITRANK2_Lane5_OFF (20)
+ #define DDRDATA1CH1_CR_RXPERBITRANK2_Lane5_WID ( 4)
+ #define DDRDATA1CH1_CR_RXPERBITRANK2_Lane5_MSK (0x00F00000)
+ #define DDRDATA1CH1_CR_RXPERBITRANK2_Lane5_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_RXPERBITRANK2_Lane6_OFF (24)
+ #define DDRDATA1CH1_CR_RXPERBITRANK2_Lane6_WID ( 4)
+ #define DDRDATA1CH1_CR_RXPERBITRANK2_Lane6_MSK (0x0F000000)
+ #define DDRDATA1CH1_CR_RXPERBITRANK2_Lane6_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_RXPERBITRANK2_Lane7_OFF (28)
+ #define DDRDATA1CH1_CR_RXPERBITRANK2_Lane7_WID ( 4)
+ #define DDRDATA1CH1_CR_RXPERBITRANK2_Lane7_MSK (0xF0000000)
+ #define DDRDATA1CH1_CR_RXPERBITRANK2_Lane7_MAX (0x0000000F)
+
+#define DDRDATA1CH1_CR_RXPERBITRANK3_REG (0x0000031C)
+ #define DDRDATA1CH1_CR_RXPERBITRANK3_Lane0_OFF ( 0)
+ #define DDRDATA1CH1_CR_RXPERBITRANK3_Lane0_WID ( 4)
+ #define DDRDATA1CH1_CR_RXPERBITRANK3_Lane0_MSK (0x0000000F)
+ #define DDRDATA1CH1_CR_RXPERBITRANK3_Lane0_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_RXPERBITRANK3_Lane1_OFF ( 4)
+ #define DDRDATA1CH1_CR_RXPERBITRANK3_Lane1_WID ( 4)
+ #define DDRDATA1CH1_CR_RXPERBITRANK3_Lane1_MSK (0x000000F0)
+ #define DDRDATA1CH1_CR_RXPERBITRANK3_Lane1_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_RXPERBITRANK3_Lane2_OFF ( 8)
+ #define DDRDATA1CH1_CR_RXPERBITRANK3_Lane2_WID ( 4)
+ #define DDRDATA1CH1_CR_RXPERBITRANK3_Lane2_MSK (0x00000F00)
+ #define DDRDATA1CH1_CR_RXPERBITRANK3_Lane2_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_RXPERBITRANK3_Lane3_OFF (12)
+ #define DDRDATA1CH1_CR_RXPERBITRANK3_Lane3_WID ( 4)
+ #define DDRDATA1CH1_CR_RXPERBITRANK3_Lane3_MSK (0x0000F000)
+ #define DDRDATA1CH1_CR_RXPERBITRANK3_Lane3_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_RXPERBITRANK3_Lane4_OFF (16)
+ #define DDRDATA1CH1_CR_RXPERBITRANK3_Lane4_WID ( 4)
+ #define DDRDATA1CH1_CR_RXPERBITRANK3_Lane4_MSK (0x000F0000)
+ #define DDRDATA1CH1_CR_RXPERBITRANK3_Lane4_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_RXPERBITRANK3_Lane5_OFF (20)
+ #define DDRDATA1CH1_CR_RXPERBITRANK3_Lane5_WID ( 4)
+ #define DDRDATA1CH1_CR_RXPERBITRANK3_Lane5_MSK (0x00F00000)
+ #define DDRDATA1CH1_CR_RXPERBITRANK3_Lane5_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_RXPERBITRANK3_Lane6_OFF (24)
+ #define DDRDATA1CH1_CR_RXPERBITRANK3_Lane6_WID ( 4)
+ #define DDRDATA1CH1_CR_RXPERBITRANK3_Lane6_MSK (0x0F000000)
+ #define DDRDATA1CH1_CR_RXPERBITRANK3_Lane6_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_RXPERBITRANK3_Lane7_OFF (28)
+ #define DDRDATA1CH1_CR_RXPERBITRANK3_Lane7_WID ( 4)
+ #define DDRDATA1CH1_CR_RXPERBITRANK3_Lane7_MSK (0xF0000000)
+ #define DDRDATA1CH1_CR_RXPERBITRANK3_Lane7_MAX (0x0000000F)
+
+#define DDRDATA1CH1_CR_TXTRAINRANK0_REG (0x00000320)
+ #define DDRDATA1CH1_CR_TXTRAINRANK0_TxDqDelay_OFF ( 0)
+ #define DDRDATA1CH1_CR_TXTRAINRANK0_TxDqDelay_WID ( 9)
+ #define DDRDATA1CH1_CR_TXTRAINRANK0_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA1CH1_CR_TXTRAINRANK0_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA1CH1_CR_TXTRAINRANK0_TxDqsDelay_OFF ( 9)
+ #define DDRDATA1CH1_CR_TXTRAINRANK0_TxDqsDelay_WID ( 9)
+ #define DDRDATA1CH1_CR_TXTRAINRANK0_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA1CH1_CR_TXTRAINRANK0_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA1CH1_CR_TXTRAINRANK0_Spare0_OFF (18)
+ #define DDRDATA1CH1_CR_TXTRAINRANK0_Spare0_WID ( 2)
+ #define DDRDATA1CH1_CR_TXTRAINRANK0_Spare0_MSK (0x000C0000)
+ #define DDRDATA1CH1_CR_TXTRAINRANK0_Spare0_MAX (0x00000003)
+ #define DDRDATA1CH1_CR_TXTRAINRANK0_TxEqualization_OFF (20)
+ #define DDRDATA1CH1_CR_TXTRAINRANK0_TxEqualization_WID ( 6)
+ #define DDRDATA1CH1_CR_TXTRAINRANK0_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA1CH1_CR_TXTRAINRANK0_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA1CH1_CR_TXTRAINRANK0_Spare1_OFF (26)
+ #define DDRDATA1CH1_CR_TXTRAINRANK0_Spare1_WID ( 6)
+ #define DDRDATA1CH1_CR_TXTRAINRANK0_Spare1_MSK (0xFC000000)
+ #define DDRDATA1CH1_CR_TXTRAINRANK0_Spare1_MAX (0x0000003F)
+
+#define DDRDATA1CH1_CR_TXTRAINRANK1_REG (0x00000324)
+ #define DDRDATA1CH1_CR_TXTRAINRANK1_TxDqDelay_OFF ( 0)
+ #define DDRDATA1CH1_CR_TXTRAINRANK1_TxDqDelay_WID ( 9)
+ #define DDRDATA1CH1_CR_TXTRAINRANK1_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA1CH1_CR_TXTRAINRANK1_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA1CH1_CR_TXTRAINRANK1_TxDqsDelay_OFF ( 9)
+ #define DDRDATA1CH1_CR_TXTRAINRANK1_TxDqsDelay_WID ( 9)
+ #define DDRDATA1CH1_CR_TXTRAINRANK1_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA1CH1_CR_TXTRAINRANK1_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA1CH1_CR_TXTRAINRANK1_Spare0_OFF (18)
+ #define DDRDATA1CH1_CR_TXTRAINRANK1_Spare0_WID ( 2)
+ #define DDRDATA1CH1_CR_TXTRAINRANK1_Spare0_MSK (0x000C0000)
+ #define DDRDATA1CH1_CR_TXTRAINRANK1_Spare0_MAX (0x00000003)
+ #define DDRDATA1CH1_CR_TXTRAINRANK1_TxEqualization_OFF (20)
+ #define DDRDATA1CH1_CR_TXTRAINRANK1_TxEqualization_WID ( 6)
+ #define DDRDATA1CH1_CR_TXTRAINRANK1_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA1CH1_CR_TXTRAINRANK1_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA1CH1_CR_TXTRAINRANK1_Spare1_OFF (26)
+ #define DDRDATA1CH1_CR_TXTRAINRANK1_Spare1_WID ( 6)
+ #define DDRDATA1CH1_CR_TXTRAINRANK1_Spare1_MSK (0xFC000000)
+ #define DDRDATA1CH1_CR_TXTRAINRANK1_Spare1_MAX (0x0000003F)
+
+#define DDRDATA1CH1_CR_TXTRAINRANK2_REG (0x00000328)
+ #define DDRDATA1CH1_CR_TXTRAINRANK2_TxDqDelay_OFF ( 0)
+ #define DDRDATA1CH1_CR_TXTRAINRANK2_TxDqDelay_WID ( 9)
+ #define DDRDATA1CH1_CR_TXTRAINRANK2_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA1CH1_CR_TXTRAINRANK2_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA1CH1_CR_TXTRAINRANK2_TxDqsDelay_OFF ( 9)
+ #define DDRDATA1CH1_CR_TXTRAINRANK2_TxDqsDelay_WID ( 9)
+ #define DDRDATA1CH1_CR_TXTRAINRANK2_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA1CH1_CR_TXTRAINRANK2_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA1CH1_CR_TXTRAINRANK2_Spare0_OFF (18)
+ #define DDRDATA1CH1_CR_TXTRAINRANK2_Spare0_WID ( 2)
+ #define DDRDATA1CH1_CR_TXTRAINRANK2_Spare0_MSK (0x000C0000)
+ #define DDRDATA1CH1_CR_TXTRAINRANK2_Spare0_MAX (0x00000003)
+ #define DDRDATA1CH1_CR_TXTRAINRANK2_TxEqualization_OFF (20)
+ #define DDRDATA1CH1_CR_TXTRAINRANK2_TxEqualization_WID ( 6)
+ #define DDRDATA1CH1_CR_TXTRAINRANK2_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA1CH1_CR_TXTRAINRANK2_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA1CH1_CR_TXTRAINRANK2_Spare1_OFF (26)
+ #define DDRDATA1CH1_CR_TXTRAINRANK2_Spare1_WID ( 6)
+ #define DDRDATA1CH1_CR_TXTRAINRANK2_Spare1_MSK (0xFC000000)
+ #define DDRDATA1CH1_CR_TXTRAINRANK2_Spare1_MAX (0x0000003F)
+
+#define DDRDATA1CH1_CR_TXTRAINRANK3_REG (0x0000032C)
+ #define DDRDATA1CH1_CR_TXTRAINRANK3_TxDqDelay_OFF ( 0)
+ #define DDRDATA1CH1_CR_TXTRAINRANK3_TxDqDelay_WID ( 9)
+ #define DDRDATA1CH1_CR_TXTRAINRANK3_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA1CH1_CR_TXTRAINRANK3_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA1CH1_CR_TXTRAINRANK3_TxDqsDelay_OFF ( 9)
+ #define DDRDATA1CH1_CR_TXTRAINRANK3_TxDqsDelay_WID ( 9)
+ #define DDRDATA1CH1_CR_TXTRAINRANK3_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA1CH1_CR_TXTRAINRANK3_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA1CH1_CR_TXTRAINRANK3_Spare0_OFF (18)
+ #define DDRDATA1CH1_CR_TXTRAINRANK3_Spare0_WID ( 2)
+ #define DDRDATA1CH1_CR_TXTRAINRANK3_Spare0_MSK (0x000C0000)
+ #define DDRDATA1CH1_CR_TXTRAINRANK3_Spare0_MAX (0x00000003)
+ #define DDRDATA1CH1_CR_TXTRAINRANK3_TxEqualization_OFF (20)
+ #define DDRDATA1CH1_CR_TXTRAINRANK3_TxEqualization_WID ( 6)
+ #define DDRDATA1CH1_CR_TXTRAINRANK3_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA1CH1_CR_TXTRAINRANK3_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA1CH1_CR_TXTRAINRANK3_Spare1_OFF (26)
+ #define DDRDATA1CH1_CR_TXTRAINRANK3_Spare1_WID ( 6)
+ #define DDRDATA1CH1_CR_TXTRAINRANK3_Spare1_MSK (0xFC000000)
+ #define DDRDATA1CH1_CR_TXTRAINRANK3_Spare1_MAX (0x0000003F)
+
+#define DDRDATA1CH1_CR_TXPERBITRANK0_REG (0x00000330)
+ #define DDRDATA1CH1_CR_TXPERBITRANK0_Lane0_OFF ( 0)
+ #define DDRDATA1CH1_CR_TXPERBITRANK0_Lane0_WID ( 4)
+ #define DDRDATA1CH1_CR_TXPERBITRANK0_Lane0_MSK (0x0000000F)
+ #define DDRDATA1CH1_CR_TXPERBITRANK0_Lane0_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_TXPERBITRANK0_Lane1_OFF ( 4)
+ #define DDRDATA1CH1_CR_TXPERBITRANK0_Lane1_WID ( 4)
+ #define DDRDATA1CH1_CR_TXPERBITRANK0_Lane1_MSK (0x000000F0)
+ #define DDRDATA1CH1_CR_TXPERBITRANK0_Lane1_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_TXPERBITRANK0_Lane2_OFF ( 8)
+ #define DDRDATA1CH1_CR_TXPERBITRANK0_Lane2_WID ( 4)
+ #define DDRDATA1CH1_CR_TXPERBITRANK0_Lane2_MSK (0x00000F00)
+ #define DDRDATA1CH1_CR_TXPERBITRANK0_Lane2_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_TXPERBITRANK0_Lane3_OFF (12)
+ #define DDRDATA1CH1_CR_TXPERBITRANK0_Lane3_WID ( 4)
+ #define DDRDATA1CH1_CR_TXPERBITRANK0_Lane3_MSK (0x0000F000)
+ #define DDRDATA1CH1_CR_TXPERBITRANK0_Lane3_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_TXPERBITRANK0_Lane4_OFF (16)
+ #define DDRDATA1CH1_CR_TXPERBITRANK0_Lane4_WID ( 4)
+ #define DDRDATA1CH1_CR_TXPERBITRANK0_Lane4_MSK (0x000F0000)
+ #define DDRDATA1CH1_CR_TXPERBITRANK0_Lane4_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_TXPERBITRANK0_Lane5_OFF (20)
+ #define DDRDATA1CH1_CR_TXPERBITRANK0_Lane5_WID ( 4)
+ #define DDRDATA1CH1_CR_TXPERBITRANK0_Lane5_MSK (0x00F00000)
+ #define DDRDATA1CH1_CR_TXPERBITRANK0_Lane5_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_TXPERBITRANK0_Lane6_OFF (24)
+ #define DDRDATA1CH1_CR_TXPERBITRANK0_Lane6_WID ( 4)
+ #define DDRDATA1CH1_CR_TXPERBITRANK0_Lane6_MSK (0x0F000000)
+ #define DDRDATA1CH1_CR_TXPERBITRANK0_Lane6_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_TXPERBITRANK0_Lane7_OFF (28)
+ #define DDRDATA1CH1_CR_TXPERBITRANK0_Lane7_WID ( 4)
+ #define DDRDATA1CH1_CR_TXPERBITRANK0_Lane7_MSK (0xF0000000)
+ #define DDRDATA1CH1_CR_TXPERBITRANK0_Lane7_MAX (0x0000000F)
+
+#define DDRDATA1CH1_CR_TXPERBITRANK1_REG (0x00000334)
+ #define DDRDATA1CH1_CR_TXPERBITRANK1_Lane0_OFF ( 0)
+ #define DDRDATA1CH1_CR_TXPERBITRANK1_Lane0_WID ( 4)
+ #define DDRDATA1CH1_CR_TXPERBITRANK1_Lane0_MSK (0x0000000F)
+ #define DDRDATA1CH1_CR_TXPERBITRANK1_Lane0_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_TXPERBITRANK1_Lane1_OFF ( 4)
+ #define DDRDATA1CH1_CR_TXPERBITRANK1_Lane1_WID ( 4)
+ #define DDRDATA1CH1_CR_TXPERBITRANK1_Lane1_MSK (0x000000F0)
+ #define DDRDATA1CH1_CR_TXPERBITRANK1_Lane1_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_TXPERBITRANK1_Lane2_OFF ( 8)
+ #define DDRDATA1CH1_CR_TXPERBITRANK1_Lane2_WID ( 4)
+ #define DDRDATA1CH1_CR_TXPERBITRANK1_Lane2_MSK (0x00000F00)
+ #define DDRDATA1CH1_CR_TXPERBITRANK1_Lane2_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_TXPERBITRANK1_Lane3_OFF (12)
+ #define DDRDATA1CH1_CR_TXPERBITRANK1_Lane3_WID ( 4)
+ #define DDRDATA1CH1_CR_TXPERBITRANK1_Lane3_MSK (0x0000F000)
+ #define DDRDATA1CH1_CR_TXPERBITRANK1_Lane3_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_TXPERBITRANK1_Lane4_OFF (16)
+ #define DDRDATA1CH1_CR_TXPERBITRANK1_Lane4_WID ( 4)
+ #define DDRDATA1CH1_CR_TXPERBITRANK1_Lane4_MSK (0x000F0000)
+ #define DDRDATA1CH1_CR_TXPERBITRANK1_Lane4_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_TXPERBITRANK1_Lane5_OFF (20)
+ #define DDRDATA1CH1_CR_TXPERBITRANK1_Lane5_WID ( 4)
+ #define DDRDATA1CH1_CR_TXPERBITRANK1_Lane5_MSK (0x00F00000)
+ #define DDRDATA1CH1_CR_TXPERBITRANK1_Lane5_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_TXPERBITRANK1_Lane6_OFF (24)
+ #define DDRDATA1CH1_CR_TXPERBITRANK1_Lane6_WID ( 4)
+ #define DDRDATA1CH1_CR_TXPERBITRANK1_Lane6_MSK (0x0F000000)
+ #define DDRDATA1CH1_CR_TXPERBITRANK1_Lane6_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_TXPERBITRANK1_Lane7_OFF (28)
+ #define DDRDATA1CH1_CR_TXPERBITRANK1_Lane7_WID ( 4)
+ #define DDRDATA1CH1_CR_TXPERBITRANK1_Lane7_MSK (0xF0000000)
+ #define DDRDATA1CH1_CR_TXPERBITRANK1_Lane7_MAX (0x0000000F)
+
+#define DDRDATA1CH1_CR_TXPERBITRANK2_REG (0x00000338)
+ #define DDRDATA1CH1_CR_TXPERBITRANK2_Lane0_OFF ( 0)
+ #define DDRDATA1CH1_CR_TXPERBITRANK2_Lane0_WID ( 4)
+ #define DDRDATA1CH1_CR_TXPERBITRANK2_Lane0_MSK (0x0000000F)
+ #define DDRDATA1CH1_CR_TXPERBITRANK2_Lane0_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_TXPERBITRANK2_Lane1_OFF ( 4)
+ #define DDRDATA1CH1_CR_TXPERBITRANK2_Lane1_WID ( 4)
+ #define DDRDATA1CH1_CR_TXPERBITRANK2_Lane1_MSK (0x000000F0)
+ #define DDRDATA1CH1_CR_TXPERBITRANK2_Lane1_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_TXPERBITRANK2_Lane2_OFF ( 8)
+ #define DDRDATA1CH1_CR_TXPERBITRANK2_Lane2_WID ( 4)
+ #define DDRDATA1CH1_CR_TXPERBITRANK2_Lane2_MSK (0x00000F00)
+ #define DDRDATA1CH1_CR_TXPERBITRANK2_Lane2_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_TXPERBITRANK2_Lane3_OFF (12)
+ #define DDRDATA1CH1_CR_TXPERBITRANK2_Lane3_WID ( 4)
+ #define DDRDATA1CH1_CR_TXPERBITRANK2_Lane3_MSK (0x0000F000)
+ #define DDRDATA1CH1_CR_TXPERBITRANK2_Lane3_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_TXPERBITRANK2_Lane4_OFF (16)
+ #define DDRDATA1CH1_CR_TXPERBITRANK2_Lane4_WID ( 4)
+ #define DDRDATA1CH1_CR_TXPERBITRANK2_Lane4_MSK (0x000F0000)
+ #define DDRDATA1CH1_CR_TXPERBITRANK2_Lane4_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_TXPERBITRANK2_Lane5_OFF (20)
+ #define DDRDATA1CH1_CR_TXPERBITRANK2_Lane5_WID ( 4)
+ #define DDRDATA1CH1_CR_TXPERBITRANK2_Lane5_MSK (0x00F00000)
+ #define DDRDATA1CH1_CR_TXPERBITRANK2_Lane5_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_TXPERBITRANK2_Lane6_OFF (24)
+ #define DDRDATA1CH1_CR_TXPERBITRANK2_Lane6_WID ( 4)
+ #define DDRDATA1CH1_CR_TXPERBITRANK2_Lane6_MSK (0x0F000000)
+ #define DDRDATA1CH1_CR_TXPERBITRANK2_Lane6_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_TXPERBITRANK2_Lane7_OFF (28)
+ #define DDRDATA1CH1_CR_TXPERBITRANK2_Lane7_WID ( 4)
+ #define DDRDATA1CH1_CR_TXPERBITRANK2_Lane7_MSK (0xF0000000)
+ #define DDRDATA1CH1_CR_TXPERBITRANK2_Lane7_MAX (0x0000000F)
+
+#define DDRDATA1CH1_CR_TXPERBITRANK3_REG (0x0000033C)
+ #define DDRDATA1CH1_CR_TXPERBITRANK3_Lane0_OFF ( 0)
+ #define DDRDATA1CH1_CR_TXPERBITRANK3_Lane0_WID ( 4)
+ #define DDRDATA1CH1_CR_TXPERBITRANK3_Lane0_MSK (0x0000000F)
+ #define DDRDATA1CH1_CR_TXPERBITRANK3_Lane0_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_TXPERBITRANK3_Lane1_OFF ( 4)
+ #define DDRDATA1CH1_CR_TXPERBITRANK3_Lane1_WID ( 4)
+ #define DDRDATA1CH1_CR_TXPERBITRANK3_Lane1_MSK (0x000000F0)
+ #define DDRDATA1CH1_CR_TXPERBITRANK3_Lane1_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_TXPERBITRANK3_Lane2_OFF ( 8)
+ #define DDRDATA1CH1_CR_TXPERBITRANK3_Lane2_WID ( 4)
+ #define DDRDATA1CH1_CR_TXPERBITRANK3_Lane2_MSK (0x00000F00)
+ #define DDRDATA1CH1_CR_TXPERBITRANK3_Lane2_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_TXPERBITRANK3_Lane3_OFF (12)
+ #define DDRDATA1CH1_CR_TXPERBITRANK3_Lane3_WID ( 4)
+ #define DDRDATA1CH1_CR_TXPERBITRANK3_Lane3_MSK (0x0000F000)
+ #define DDRDATA1CH1_CR_TXPERBITRANK3_Lane3_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_TXPERBITRANK3_Lane4_OFF (16)
+ #define DDRDATA1CH1_CR_TXPERBITRANK3_Lane4_WID ( 4)
+ #define DDRDATA1CH1_CR_TXPERBITRANK3_Lane4_MSK (0x000F0000)
+ #define DDRDATA1CH1_CR_TXPERBITRANK3_Lane4_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_TXPERBITRANK3_Lane5_OFF (20)
+ #define DDRDATA1CH1_CR_TXPERBITRANK3_Lane5_WID ( 4)
+ #define DDRDATA1CH1_CR_TXPERBITRANK3_Lane5_MSK (0x00F00000)
+ #define DDRDATA1CH1_CR_TXPERBITRANK3_Lane5_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_TXPERBITRANK3_Lane6_OFF (24)
+ #define DDRDATA1CH1_CR_TXPERBITRANK3_Lane6_WID ( 4)
+ #define DDRDATA1CH1_CR_TXPERBITRANK3_Lane6_MSK (0x0F000000)
+ #define DDRDATA1CH1_CR_TXPERBITRANK3_Lane6_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_TXPERBITRANK3_Lane7_OFF (28)
+ #define DDRDATA1CH1_CR_TXPERBITRANK3_Lane7_WID ( 4)
+ #define DDRDATA1CH1_CR_TXPERBITRANK3_Lane7_MSK (0xF0000000)
+ #define DDRDATA1CH1_CR_TXPERBITRANK3_Lane7_MAX (0x0000000F)
+
+#define DDRDATA1CH1_CR_RCOMPDATA0_REG (0x00000340)
+ #define DDRDATA1CH1_CR_RCOMPDATA0_RcompDrvUp_OFF ( 0)
+ #define DDRDATA1CH1_CR_RCOMPDATA0_RcompDrvUp_WID ( 6)
+ #define DDRDATA1CH1_CR_RCOMPDATA0_RcompDrvUp_MSK (0x0000003F)
+ #define DDRDATA1CH1_CR_RCOMPDATA0_RcompDrvUp_MAX (0x0000003F)
+ #define DDRDATA1CH1_CR_RCOMPDATA0_Spare0_OFF ( 6)
+ #define DDRDATA1CH1_CR_RCOMPDATA0_Spare0_WID ( 3)
+ #define DDRDATA1CH1_CR_RCOMPDATA0_Spare0_MSK (0x000001C0)
+ #define DDRDATA1CH1_CR_RCOMPDATA0_Spare0_MAX (0x00000007)
+ #define DDRDATA1CH1_CR_RCOMPDATA0_RcompDrvDown_OFF ( 9)
+ #define DDRDATA1CH1_CR_RCOMPDATA0_RcompDrvDown_WID ( 6)
+ #define DDRDATA1CH1_CR_RCOMPDATA0_RcompDrvDown_MSK (0x00007E00)
+ #define DDRDATA1CH1_CR_RCOMPDATA0_RcompDrvDown_MAX (0x0000003F)
+ #define DDRDATA1CH1_CR_RCOMPDATA0_VTComp_OFF (15)
+ #define DDRDATA1CH1_CR_RCOMPDATA0_VTComp_WID ( 5)
+ #define DDRDATA1CH1_CR_RCOMPDATA0_VTComp_MSK (0x000F8000)
+ #define DDRDATA1CH1_CR_RCOMPDATA0_VTComp_MAX (0x0000001F)
+ #define DDRDATA1CH1_CR_RCOMPDATA0_TcoComp_OFF (20)
+ #define DDRDATA1CH1_CR_RCOMPDATA0_TcoComp_WID ( 6)
+ #define DDRDATA1CH1_CR_RCOMPDATA0_TcoComp_MSK (0x03F00000)
+ #define DDRDATA1CH1_CR_RCOMPDATA0_TcoComp_MAX (0x0000003F)
+ #define DDRDATA1CH1_CR_RCOMPDATA0_SlewRateComp_OFF (26)
+ #define DDRDATA1CH1_CR_RCOMPDATA0_SlewRateComp_WID ( 5)
+ #define DDRDATA1CH1_CR_RCOMPDATA0_SlewRateComp_MSK (0x7C000000)
+ #define DDRDATA1CH1_CR_RCOMPDATA0_SlewRateComp_MAX (0x0000001F)
+ #define DDRDATA1CH1_CR_RCOMPDATA0_Spare2_OFF (31)
+ #define DDRDATA1CH1_CR_RCOMPDATA0_Spare2_WID ( 1)
+ #define DDRDATA1CH1_CR_RCOMPDATA0_Spare2_MSK (0x80000000)
+ #define DDRDATA1CH1_CR_RCOMPDATA0_Spare2_MAX (0x00000001)
+
+#define DDRDATA1CH1_CR_RCOMPDATA1_REG (0x00000344)
+ #define DDRDATA1CH1_CR_RCOMPDATA1_RcompOdtUp_OFF ( 0)
+ #define DDRDATA1CH1_CR_RCOMPDATA1_RcompOdtUp_WID ( 6)
+ #define DDRDATA1CH1_CR_RCOMPDATA1_RcompOdtUp_MSK (0x0000003F)
+ #define DDRDATA1CH1_CR_RCOMPDATA1_RcompOdtUp_MAX (0x0000003F)
+ #define DDRDATA1CH1_CR_RCOMPDATA1_Spare0_OFF ( 6)
+ #define DDRDATA1CH1_CR_RCOMPDATA1_Spare0_WID ( 3)
+ #define DDRDATA1CH1_CR_RCOMPDATA1_Spare0_MSK (0x000001C0)
+ #define DDRDATA1CH1_CR_RCOMPDATA1_Spare0_MAX (0x00000007)
+ #define DDRDATA1CH1_CR_RCOMPDATA1_RcompOdtDown_OFF ( 9)
+ #define DDRDATA1CH1_CR_RCOMPDATA1_RcompOdtDown_WID ( 6)
+ #define DDRDATA1CH1_CR_RCOMPDATA1_RcompOdtDown_MSK (0x00007E00)
+ #define DDRDATA1CH1_CR_RCOMPDATA1_RcompOdtDown_MAX (0x0000003F)
+ #define DDRDATA1CH1_CR_RCOMPDATA1_Spare1_OFF (15)
+ #define DDRDATA1CH1_CR_RCOMPDATA1_Spare1_WID ( 1)
+ #define DDRDATA1CH1_CR_RCOMPDATA1_Spare1_MSK (0x00008000)
+ #define DDRDATA1CH1_CR_RCOMPDATA1_Spare1_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_RCOMPDATA1_PanicDrvDn_OFF (16)
+ #define DDRDATA1CH1_CR_RCOMPDATA1_PanicDrvDn_WID ( 6)
+ #define DDRDATA1CH1_CR_RCOMPDATA1_PanicDrvDn_MSK (0x003F0000)
+ #define DDRDATA1CH1_CR_RCOMPDATA1_PanicDrvDn_MAX (0x0000003F)
+ #define DDRDATA1CH1_CR_RCOMPDATA1_PanicDrvUp_OFF (22)
+ #define DDRDATA1CH1_CR_RCOMPDATA1_PanicDrvUp_WID ( 6)
+ #define DDRDATA1CH1_CR_RCOMPDATA1_PanicDrvUp_MSK (0x0FC00000)
+ #define DDRDATA1CH1_CR_RCOMPDATA1_PanicDrvUp_MAX (0x0000003F)
+ #define DDRDATA1CH1_CR_RCOMPDATA1_LevelShifterComp_OFF (28)
+ #define DDRDATA1CH1_CR_RCOMPDATA1_LevelShifterComp_WID ( 3)
+ #define DDRDATA1CH1_CR_RCOMPDATA1_LevelShifterComp_MSK (0x70000000)
+ #define DDRDATA1CH1_CR_RCOMPDATA1_LevelShifterComp_MAX (0x00000007)
+ #define DDRDATA1CH1_CR_RCOMPDATA1_Spare2_OFF (31)
+ #define DDRDATA1CH1_CR_RCOMPDATA1_Spare2_WID ( 1)
+ #define DDRDATA1CH1_CR_RCOMPDATA1_Spare2_MSK (0x80000000)
+ #define DDRDATA1CH1_CR_RCOMPDATA1_Spare2_MAX (0x00000001)
+
+#define DDRDATA1CH1_CR_TXXTALK_REG (0x00000348)
+ #define DDRDATA1CH1_CR_TXXTALK_Lane0_OFF ( 0)
+ #define DDRDATA1CH1_CR_TXXTALK_Lane0_WID ( 4)
+ #define DDRDATA1CH1_CR_TXXTALK_Lane0_MSK (0x0000000F)
+ #define DDRDATA1CH1_CR_TXXTALK_Lane0_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_TXXTALK_Lane1_OFF ( 4)
+ #define DDRDATA1CH1_CR_TXXTALK_Lane1_WID ( 4)
+ #define DDRDATA1CH1_CR_TXXTALK_Lane1_MSK (0x000000F0)
+ #define DDRDATA1CH1_CR_TXXTALK_Lane1_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_TXXTALK_Lane2_OFF ( 8)
+ #define DDRDATA1CH1_CR_TXXTALK_Lane2_WID ( 4)
+ #define DDRDATA1CH1_CR_TXXTALK_Lane2_MSK (0x00000F00)
+ #define DDRDATA1CH1_CR_TXXTALK_Lane2_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_TXXTALK_Lane3_OFF (12)
+ #define DDRDATA1CH1_CR_TXXTALK_Lane3_WID ( 4)
+ #define DDRDATA1CH1_CR_TXXTALK_Lane3_MSK (0x0000F000)
+ #define DDRDATA1CH1_CR_TXXTALK_Lane3_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_TXXTALK_Lane4_OFF (16)
+ #define DDRDATA1CH1_CR_TXXTALK_Lane4_WID ( 4)
+ #define DDRDATA1CH1_CR_TXXTALK_Lane4_MSK (0x000F0000)
+ #define DDRDATA1CH1_CR_TXXTALK_Lane4_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_TXXTALK_Lane5_OFF (20)
+ #define DDRDATA1CH1_CR_TXXTALK_Lane5_WID ( 4)
+ #define DDRDATA1CH1_CR_TXXTALK_Lane5_MSK (0x00F00000)
+ #define DDRDATA1CH1_CR_TXXTALK_Lane5_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_TXXTALK_Lane6_OFF (24)
+ #define DDRDATA1CH1_CR_TXXTALK_Lane6_WID ( 4)
+ #define DDRDATA1CH1_CR_TXXTALK_Lane6_MSK (0x0F000000)
+ #define DDRDATA1CH1_CR_TXXTALK_Lane6_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_TXXTALK_Lane7_OFF (28)
+ #define DDRDATA1CH1_CR_TXXTALK_Lane7_WID ( 4)
+ #define DDRDATA1CH1_CR_TXXTALK_Lane7_MSK (0xF0000000)
+ #define DDRDATA1CH1_CR_TXXTALK_Lane7_MAX (0x0000000F)
+
+#define DDRDATA1CH1_CR_RXOFFSETVDQ_REG (0x0000034C)
+ #define DDRDATA1CH1_CR_RXOFFSETVDQ_Lane0_OFF ( 0)
+ #define DDRDATA1CH1_CR_RXOFFSETVDQ_Lane0_WID ( 4)
+ #define DDRDATA1CH1_CR_RXOFFSETVDQ_Lane0_MSK (0x0000000F)
+ #define DDRDATA1CH1_CR_RXOFFSETVDQ_Lane0_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_RXOFFSETVDQ_Lane1_OFF ( 4)
+ #define DDRDATA1CH1_CR_RXOFFSETVDQ_Lane1_WID ( 4)
+ #define DDRDATA1CH1_CR_RXOFFSETVDQ_Lane1_MSK (0x000000F0)
+ #define DDRDATA1CH1_CR_RXOFFSETVDQ_Lane1_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_RXOFFSETVDQ_Lane2_OFF ( 8)
+ #define DDRDATA1CH1_CR_RXOFFSETVDQ_Lane2_WID ( 4)
+ #define DDRDATA1CH1_CR_RXOFFSETVDQ_Lane2_MSK (0x00000F00)
+ #define DDRDATA1CH1_CR_RXOFFSETVDQ_Lane2_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_RXOFFSETVDQ_Lane3_OFF (12)
+ #define DDRDATA1CH1_CR_RXOFFSETVDQ_Lane3_WID ( 4)
+ #define DDRDATA1CH1_CR_RXOFFSETVDQ_Lane3_MSK (0x0000F000)
+ #define DDRDATA1CH1_CR_RXOFFSETVDQ_Lane3_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_RXOFFSETVDQ_Lane4_OFF (16)
+ #define DDRDATA1CH1_CR_RXOFFSETVDQ_Lane4_WID ( 4)
+ #define DDRDATA1CH1_CR_RXOFFSETVDQ_Lane4_MSK (0x000F0000)
+ #define DDRDATA1CH1_CR_RXOFFSETVDQ_Lane4_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_RXOFFSETVDQ_Lane5_OFF (20)
+ #define DDRDATA1CH1_CR_RXOFFSETVDQ_Lane5_WID ( 4)
+ #define DDRDATA1CH1_CR_RXOFFSETVDQ_Lane5_MSK (0x00F00000)
+ #define DDRDATA1CH1_CR_RXOFFSETVDQ_Lane5_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_RXOFFSETVDQ_Lane6_OFF (24)
+ #define DDRDATA1CH1_CR_RXOFFSETVDQ_Lane6_WID ( 4)
+ #define DDRDATA1CH1_CR_RXOFFSETVDQ_Lane6_MSK (0x0F000000)
+ #define DDRDATA1CH1_CR_RXOFFSETVDQ_Lane6_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_RXOFFSETVDQ_Lane7_OFF (28)
+ #define DDRDATA1CH1_CR_RXOFFSETVDQ_Lane7_WID ( 4)
+ #define DDRDATA1CH1_CR_RXOFFSETVDQ_Lane7_MSK (0xF0000000)
+ #define DDRDATA1CH1_CR_RXOFFSETVDQ_Lane7_MAX (0x0000000F)
+
+#define DDRDATA1CH1_CR_DDRDATARESERVED_REG (0x00000350)
+ #define DDRDATA1CH1_CR_DDRDATARESERVED_Spare_OFF ( 0)
+ #define DDRDATA1CH1_CR_DDRDATARESERVED_Spare_WID (32)
+ #define DDRDATA1CH1_CR_DDRDATARESERVED_Spare_MSK (0xFFFFFFFF)
+ #define DDRDATA1CH1_CR_DDRDATARESERVED_Spare_MAX (0xFFFFFFFF)
+
+#define DDRDATA1CH1_CR_DATATRAINFEEDBACK_REG (0x00000354)
+ #define DDRDATA1CH1_CR_DATATRAINFEEDBACK_DataTrainFeedback_OFF ( 0)
+ #define DDRDATA1CH1_CR_DATATRAINFEEDBACK_DataTrainFeedback_WID ( 9)
+ #define DDRDATA1CH1_CR_DATATRAINFEEDBACK_DataTrainFeedback_MSK (0x000001FF)
+ #define DDRDATA1CH1_CR_DATATRAINFEEDBACK_DataTrainFeedback_MAX (0x000001FF)
+ #define DDRDATA1CH1_CR_DATATRAINFEEDBACK_Spare_OFF ( 9)
+ #define DDRDATA1CH1_CR_DATATRAINFEEDBACK_Spare_WID (23)
+ #define DDRDATA1CH1_CR_DATATRAINFEEDBACK_Spare_MSK (0xFFFFFE00)
+ #define DDRDATA1CH1_CR_DATATRAINFEEDBACK_Spare_MAX (0x007FFFFF)
+
+#define DDRDATA1CH1_CR_DLLPITESTANDADC_REG (0x00000358)
+ #define DDRDATA1CH1_CR_DLLPITESTANDADC_RunTest_OFF ( 0)
+ #define DDRDATA1CH1_CR_DLLPITESTANDADC_RunTest_WID ( 1)
+ #define DDRDATA1CH1_CR_DLLPITESTANDADC_RunTest_MSK (0x00000001)
+ #define DDRDATA1CH1_CR_DLLPITESTANDADC_RunTest_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DLLPITESTANDADC_RunTest_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DLLPITESTANDADC_Load_OFF ( 1)
+ #define DDRDATA1CH1_CR_DLLPITESTANDADC_Load_WID ( 1)
+ #define DDRDATA1CH1_CR_DLLPITESTANDADC_Load_MSK (0x00000002)
+ #define DDRDATA1CH1_CR_DLLPITESTANDADC_Load_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DLLPITESTANDADC_Load_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DLLPITESTANDADC_ModeHVM_OFF ( 2)
+ #define DDRDATA1CH1_CR_DLLPITESTANDADC_ModeHVM_WID ( 1)
+ #define DDRDATA1CH1_CR_DLLPITESTANDADC_ModeHVM_MSK (0x00000004)
+ #define DDRDATA1CH1_CR_DLLPITESTANDADC_ModeHVM_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DLLPITESTANDADC_ModeHVM_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DLLPITESTANDADC_ModeDV_OFF ( 3)
+ #define DDRDATA1CH1_CR_DLLPITESTANDADC_ModeDV_WID ( 1)
+ #define DDRDATA1CH1_CR_DLLPITESTANDADC_ModeDV_MSK (0x00000008)
+ #define DDRDATA1CH1_CR_DLLPITESTANDADC_ModeDV_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DLLPITESTANDADC_ModeDV_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DLLPITESTANDADC_ModeADC_OFF ( 4)
+ #define DDRDATA1CH1_CR_DLLPITESTANDADC_ModeADC_WID ( 1)
+ #define DDRDATA1CH1_CR_DLLPITESTANDADC_ModeADC_MSK (0x00000010)
+ #define DDRDATA1CH1_CR_DLLPITESTANDADC_ModeADC_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DLLPITESTANDADC_ModeADC_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DLLPITESTANDADC_LoadCount_OFF ( 5)
+ #define DDRDATA1CH1_CR_DLLPITESTANDADC_LoadCount_WID (10)
+ #define DDRDATA1CH1_CR_DLLPITESTANDADC_LoadCount_MSK (0x00007FE0)
+ #define DDRDATA1CH1_CR_DLLPITESTANDADC_LoadCount_MAX (0x000003FF)
+ #define DDRDATA1CH1_CR_DLLPITESTANDADC_CountStatus_OFF (15)
+ #define DDRDATA1CH1_CR_DLLPITESTANDADC_CountStatus_WID (10)
+ #define DDRDATA1CH1_CR_DLLPITESTANDADC_CountStatus_MSK (0x01FF8000)
+ #define DDRDATA1CH1_CR_DLLPITESTANDADC_CountStatus_MAX (0x000003FF)
+ #define DDRDATA1CH1_CR_DLLPITESTANDADC_CountStatus_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DLLPITESTANDADC_Spare_OFF (25)
+ #define DDRDATA1CH1_CR_DLLPITESTANDADC_Spare_WID ( 7)
+ #define DDRDATA1CH1_CR_DLLPITESTANDADC_Spare_MSK (0xFE000000)
+ #define DDRDATA1CH1_CR_DLLPITESTANDADC_Spare_MAX (0x0000007F)
+
+#define DDRDATA1CH1_CR_DDRCRDATAOFFSETCOMP_REG (0x0000035C)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_OFF ( 0)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_WID ( 6)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_MSK (0x0000003F)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_MAX (0x0000003F)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_OFF ( 6)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_WID ( 6)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_MSK (0x00000FC0)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_MAX (0x0000003F)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_OFF (12)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_WID ( 5)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_MSK (0x0001F000)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_MAX (0x0000001F)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_OFF (17)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_WID ( 5)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_MSK (0x003E0000)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_MAX (0x0000001F)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_OFF (22)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_WID ( 5)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_MSK (0x07C00000)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_MAX (0x0000001F)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_OFF (27)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_WID ( 5)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_MSK (0xF8000000)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_MAX (0x0000001F)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_DEF (0x00000000)
+
+#define DDRDATA1CH1_CR_DDRCRDATACONTROL1_REG (0x00000360)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_RefPi_OFF ( 0)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_RefPi_WID ( 4)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_RefPi_MSK (0x0000000F)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_RefPi_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_RefPi_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_DllMask_OFF ( 4)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_DllMask_WID ( 2)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_DllMask_MSK (0x00000030)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_DllMask_MAX (0x00000003)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_DllMask_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_DllWeakLock_OFF ( 6)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_DllWeakLock_WID ( 1)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_DllWeakLock_MSK (0x00000040)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_DllWeakLock_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_DllWeakLock_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_OFF ( 7)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_WID ( 3)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_MSK (0x00000380)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_MAX (0x00000007)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_OFF (10)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_WID ( 3)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_MSK (0x00001C00)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_MAX (0x00000007)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_OdtDelay_OFF (13)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_OdtDelay_WID ( 4)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_OdtDelay_MSK (0x0001E000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_OdtDelay_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_OdtDelay_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_OdtDuration_OFF (17)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_OdtDuration_WID ( 3)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_OdtDuration_MSK (0x000E0000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_OdtDuration_MAX (0x00000007)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_OdtDuration_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_OFF (20)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_WID ( 4)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_MSK (0x00F00000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_OFF (24)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_WID ( 3)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_MSK (0x07000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_MAX (0x00000007)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_OFF (27)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_WID ( 3)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_MSK (0x38000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_MAX (0x00000007)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_OFF (30)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_WID ( 1)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_MSK (0x40000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_Rsvd1_OFF (31)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_Rsvd1_WID ( 1)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_Rsvd1_MSK (0x80000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_Rsvd1_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL1_Rsvd1_DEF (0x00000000)
+
+#define DDRDATA1CH1_CR_DDRCRDATACONTROL2_REG (0x00000364)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_OFF ( 0)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_WID ( 5)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_MSK (0x0000001F)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_MAX (0x0000001F)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_OFF ( 5)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_WID ( 1)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_MSK (0x00000020)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL2_ForceRxOn_OFF ( 6)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL2_ForceRxOn_WID ( 1)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL2_ForceRxOn_MSK (0x00000040)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL2_ForceRxOn_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL2_ForceRxOn_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL2_LeakerComp_OFF ( 7)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL2_LeakerComp_WID ( 2)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL2_LeakerComp_MSK (0x00000180)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL2_LeakerComp_MAX (0x00000003)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL2_LeakerComp_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_OFF ( 9)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_WID ( 4)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_MSK (0x00001E00)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_MAX (0x0000000F)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_DEF (0x00000008)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_OFF (13)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_WID ( 5)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_MSK (0x0003E000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_MAX (0x0000001F)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_DEF (0x00000011)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_OFF (18)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_WID ( 1)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_MSK (0x00040000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL2_Spare_OFF (19)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL2_Spare_WID (13)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL2_Spare_MSK (0xFFF80000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL2_Spare_MAX (0x00001FFF)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL2_Spare_DEF (0x00000000)
+
+#define DDRDATA1CH1_CR_DDRCRVSSHIORVREFCONTROL_REG (0x0000036C)
+ #define DDRDATA1CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_OFF ( 0)
+ #define DDRDATA1CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_WID (24)
+ #define DDRDATA1CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_MSK (0x00FFFFFF)
+ #define DDRDATA1CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_MAX (0x00FFFFFF)
+ #define DDRDATA1CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_OFF (24)
+ #define DDRDATA1CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_WID ( 8)
+ #define DDRDATA1CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_MSK (0xFF000000)
+ #define DDRDATA1CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_MAX (0x000000FF)
+ #define DDRDATA1CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_DEF (0x00000000)
+
+#define DDRDATA1CH1_CR_DDRCRDATAOFFSETTRAIN_REG (0x00000370)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_OFF ( 0)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_WID ( 6)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_MSK (0x0000003F)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_MAX (0x0000003F)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_OFF ( 6)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_WID ( 6)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_MSK (0x00000FC0)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_MAX (0x0000003F)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_OFF (12)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_WID ( 6)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_MSK (0x0003F000)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_MAX (0x0000003F)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_OFF (18)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_WID ( 6)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_MSK (0x00FC0000)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_MAX (0x0000003F)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_OFF (24)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_WID ( 7)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_MSK (0x7F000000)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_MAX (0x0000007F)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_OFF (31)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_WID ( 1)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_MSK (0x80000000)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_DEF (0x00000000)
+
+#define DDRDATA1CH1_CR_DDRCRDATACONTROL0_REG (0x00000374)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_OFF ( 0)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_WID ( 1)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_MSK (0x00000001)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_OFF ( 1)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_WID ( 1)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_MSK (0x00000002)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_OFF ( 2)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_WID ( 1)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_MSK (0x00000004)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_OFF ( 3)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_WID ( 1)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_MSK (0x00000008)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_TxOn_OFF ( 4)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_TxOn_WID ( 1)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_TxOn_MSK (0x00000010)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_TxOn_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_TxOn_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_RfOn_OFF ( 5)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_RfOn_WID ( 1)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_RfOn_MSK (0x00000020)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_RfOn_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_RfOn_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_RxPiOn_OFF ( 6)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_RxPiOn_WID ( 1)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_RxPiOn_MSK (0x00000040)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_RxPiOn_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_RxPiOn_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_TxPiOn_OFF ( 7)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_TxPiOn_WID ( 1)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_TxPiOn_MSK (0x00000080)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_TxPiOn_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_TxPiOn_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_OFF ( 8)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_WID ( 1)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_MSK (0x00000100)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_OFF ( 9)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_WID ( 1)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_MSK (0x00000200)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_TxDisable_OFF (10)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_TxDisable_WID ( 1)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_TxDisable_MSK (0x00000400)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_TxDisable_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_TxDisable_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_RxDisable_OFF (11)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_RxDisable_WID ( 1)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_RxDisable_MSK (0x00000800)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_RxDisable_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_RxDisable_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_TxLong_OFF (12)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_TxLong_WID ( 1)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_TxLong_MSK (0x00001000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_TxLong_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_TxLong_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_OFF (13)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_WID ( 2)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_MSK (0x00006000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_MAX (0x00000003)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_RxReadPointer_OFF (15)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_RxReadPointer_WID ( 3)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_RxReadPointer_MSK (0x00038000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_RxReadPointer_MAX (0x00000007)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_RxReadPointer_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_OFF (18)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_WID ( 1)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_MSK (0x00040000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_OFF (19)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_WID ( 1)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_MSK (0x00080000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_ReadRFRd_OFF (20)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_ReadRFRd_WID ( 1)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_ReadRFRd_MSK (0x00100000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_ReadRFRd_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_ReadRFRd_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_ReadRFWr_OFF (21)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_ReadRFWr_WID ( 1)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_ReadRFWr_MSK (0x00200000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_ReadRFWr_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_ReadRFWr_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_ReadRFRank_OFF (22)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_ReadRFRank_WID ( 2)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_ReadRFRank_MSK (0x00C00000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_ReadRFRank_MAX (0x00000003)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_ReadRFRank_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_OFF (24)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_WID ( 1)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_MSK (0x01000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_OdtSampOff_OFF (25)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_OdtSampOff_WID ( 1)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_OdtSampOff_MSK (0x02000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_OdtSampOff_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_OdtSampOff_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_OFF (26)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_WID ( 1)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_MSK (0x04000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_OFF (27)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_WID ( 1)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_MSK (0x08000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_OFF (28)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_WID ( 1)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_MSK (0x10000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_OFF (29)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_WID ( 1)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_MSK (0x20000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_OFF (30)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_WID ( 1)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_MSK (0x40000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_OFF (31)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_WID ( 1)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_MSK (0x80000000)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_DEF (0x00000000)
+
+#define DDRDATA1CH1_CR_DDRCRVREFADJUST1_REG (0x00000378)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_OFF ( 0)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_WID ( 7)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_MSK (0x0000007F)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_MAX (0x0000007F)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_OFF ( 7)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_WID ( 7)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_MSK (0x00003F80)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_MAX (0x0000007F)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_OFF (14)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_WID ( 7)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_MSK (0x001FC000)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_MAX (0x0000007F)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_OFF (21)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_WID ( 1)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_MSK (0x00200000)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_OFF (22)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_WID ( 1)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_MSK (0x00400000)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_OFF (23)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_WID ( 1)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_MSK (0x00800000)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_OFF (24)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_WID ( 2)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_MSK (0x03000000)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_MAX (0x00000003)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_OFF (26)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_WID ( 1)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_MSK (0x04000000)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_Rsvd_OFF (27)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_Rsvd_WID ( 2)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_Rsvd_MSK (0x18000000)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_Rsvd_MAX (0x00000003)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_Rsvd_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_caSlowBW_OFF (29)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_caSlowBW_WID ( 1)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_caSlowBW_MSK (0x20000000)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_caSlowBW_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_caSlowBW_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_OFF (30)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_WID ( 1)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_MSK (0x40000000)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_DEF (0x00000000)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_OFF (31)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_WID ( 1)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_MSK (0x80000000)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_MAX (0x00000001)
+ #define DDRDATA1CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_DEF (0x00000000)
+
+#define DDRDATA2CH0_CR_RXTRAINRANK0_REG (0x00000400)
+ #define DDRDATA2CH0_CR_RXTRAINRANK0_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA2CH0_CR_RXTRAINRANK0_RxRcvEnPi_WID ( 9)
+ #define DDRDATA2CH0_CR_RXTRAINRANK0_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA2CH0_CR_RXTRAINRANK0_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA2CH0_CR_RXTRAINRANK0_RxDqsPPi_OFF ( 9)
+ #define DDRDATA2CH0_CR_RXTRAINRANK0_RxDqsPPi_WID ( 6)
+ #define DDRDATA2CH0_CR_RXTRAINRANK0_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA2CH0_CR_RXTRAINRANK0_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA2CH0_CR_RXTRAINRANK0_RxEq_OFF (15)
+ #define DDRDATA2CH0_CR_RXTRAINRANK0_RxEq_WID ( 5)
+ #define DDRDATA2CH0_CR_RXTRAINRANK0_RxEq_MSK (0x000F8000)
+ #define DDRDATA2CH0_CR_RXTRAINRANK0_RxEq_MAX (0x0000001F)
+ #define DDRDATA2CH0_CR_RXTRAINRANK0_RxDqsNPi_OFF (20)
+ #define DDRDATA2CH0_CR_RXTRAINRANK0_RxDqsNPi_WID ( 6)
+ #define DDRDATA2CH0_CR_RXTRAINRANK0_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA2CH0_CR_RXTRAINRANK0_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA2CH0_CR_RXTRAINRANK0_RxVref_OFF (26)
+ #define DDRDATA2CH0_CR_RXTRAINRANK0_RxVref_WID ( 6)
+ #define DDRDATA2CH0_CR_RXTRAINRANK0_RxVref_MSK (0xFC000000)
+ #define DDRDATA2CH0_CR_RXTRAINRANK0_RxVref_MAX (0x0000003F)
+
+#define DDRDATA2CH0_CR_RXTRAINRANK1_REG (0x00000404)
+ #define DDRDATA2CH0_CR_RXTRAINRANK1_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA2CH0_CR_RXTRAINRANK1_RxRcvEnPi_WID ( 9)
+ #define DDRDATA2CH0_CR_RXTRAINRANK1_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA2CH0_CR_RXTRAINRANK1_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA2CH0_CR_RXTRAINRANK1_RxDqsPPi_OFF ( 9)
+ #define DDRDATA2CH0_CR_RXTRAINRANK1_RxDqsPPi_WID ( 6)
+ #define DDRDATA2CH0_CR_RXTRAINRANK1_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA2CH0_CR_RXTRAINRANK1_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA2CH0_CR_RXTRAINRANK1_RxEq_OFF (15)
+ #define DDRDATA2CH0_CR_RXTRAINRANK1_RxEq_WID ( 5)
+ #define DDRDATA2CH0_CR_RXTRAINRANK1_RxEq_MSK (0x000F8000)
+ #define DDRDATA2CH0_CR_RXTRAINRANK1_RxEq_MAX (0x0000001F)
+ #define DDRDATA2CH0_CR_RXTRAINRANK1_RxDqsNPi_OFF (20)
+ #define DDRDATA2CH0_CR_RXTRAINRANK1_RxDqsNPi_WID ( 6)
+ #define DDRDATA2CH0_CR_RXTRAINRANK1_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA2CH0_CR_RXTRAINRANK1_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA2CH0_CR_RXTRAINRANK1_RxVref_OFF (26)
+ #define DDRDATA2CH0_CR_RXTRAINRANK1_RxVref_WID ( 6)
+ #define DDRDATA2CH0_CR_RXTRAINRANK1_RxVref_MSK (0xFC000000)
+ #define DDRDATA2CH0_CR_RXTRAINRANK1_RxVref_MAX (0x0000003F)
+
+#define DDRDATA2CH0_CR_RXTRAINRANK2_REG (0x00000408)
+ #define DDRDATA2CH0_CR_RXTRAINRANK2_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA2CH0_CR_RXTRAINRANK2_RxRcvEnPi_WID ( 9)
+ #define DDRDATA2CH0_CR_RXTRAINRANK2_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA2CH0_CR_RXTRAINRANK2_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA2CH0_CR_RXTRAINRANK2_RxDqsPPi_OFF ( 9)
+ #define DDRDATA2CH0_CR_RXTRAINRANK2_RxDqsPPi_WID ( 6)
+ #define DDRDATA2CH0_CR_RXTRAINRANK2_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA2CH0_CR_RXTRAINRANK2_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA2CH0_CR_RXTRAINRANK2_RxEq_OFF (15)
+ #define DDRDATA2CH0_CR_RXTRAINRANK2_RxEq_WID ( 5)
+ #define DDRDATA2CH0_CR_RXTRAINRANK2_RxEq_MSK (0x000F8000)
+ #define DDRDATA2CH0_CR_RXTRAINRANK2_RxEq_MAX (0x0000001F)
+ #define DDRDATA2CH0_CR_RXTRAINRANK2_RxDqsNPi_OFF (20)
+ #define DDRDATA2CH0_CR_RXTRAINRANK2_RxDqsNPi_WID ( 6)
+ #define DDRDATA2CH0_CR_RXTRAINRANK2_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA2CH0_CR_RXTRAINRANK2_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA2CH0_CR_RXTRAINRANK2_RxVref_OFF (26)
+ #define DDRDATA2CH0_CR_RXTRAINRANK2_RxVref_WID ( 6)
+ #define DDRDATA2CH0_CR_RXTRAINRANK2_RxVref_MSK (0xFC000000)
+ #define DDRDATA2CH0_CR_RXTRAINRANK2_RxVref_MAX (0x0000003F)
+
+#define DDRDATA2CH0_CR_RXTRAINRANK3_REG (0x0000040C)
+ #define DDRDATA2CH0_CR_RXTRAINRANK3_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA2CH0_CR_RXTRAINRANK3_RxRcvEnPi_WID ( 9)
+ #define DDRDATA2CH0_CR_RXTRAINRANK3_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA2CH0_CR_RXTRAINRANK3_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA2CH0_CR_RXTRAINRANK3_RxDqsPPi_OFF ( 9)
+ #define DDRDATA2CH0_CR_RXTRAINRANK3_RxDqsPPi_WID ( 6)
+ #define DDRDATA2CH0_CR_RXTRAINRANK3_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA2CH0_CR_RXTRAINRANK3_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA2CH0_CR_RXTRAINRANK3_RxEq_OFF (15)
+ #define DDRDATA2CH0_CR_RXTRAINRANK3_RxEq_WID ( 5)
+ #define DDRDATA2CH0_CR_RXTRAINRANK3_RxEq_MSK (0x000F8000)
+ #define DDRDATA2CH0_CR_RXTRAINRANK3_RxEq_MAX (0x0000001F)
+ #define DDRDATA2CH0_CR_RXTRAINRANK3_RxDqsNPi_OFF (20)
+ #define DDRDATA2CH0_CR_RXTRAINRANK3_RxDqsNPi_WID ( 6)
+ #define DDRDATA2CH0_CR_RXTRAINRANK3_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA2CH0_CR_RXTRAINRANK3_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA2CH0_CR_RXTRAINRANK3_RxVref_OFF (26)
+ #define DDRDATA2CH0_CR_RXTRAINRANK3_RxVref_WID ( 6)
+ #define DDRDATA2CH0_CR_RXTRAINRANK3_RxVref_MSK (0xFC000000)
+ #define DDRDATA2CH0_CR_RXTRAINRANK3_RxVref_MAX (0x0000003F)
+
+#define DDRDATA2CH0_CR_RXPERBITRANK0_REG (0x00000410)
+ #define DDRDATA2CH0_CR_RXPERBITRANK0_Lane0_OFF ( 0)
+ #define DDRDATA2CH0_CR_RXPERBITRANK0_Lane0_WID ( 4)
+ #define DDRDATA2CH0_CR_RXPERBITRANK0_Lane0_MSK (0x0000000F)
+ #define DDRDATA2CH0_CR_RXPERBITRANK0_Lane0_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_RXPERBITRANK0_Lane1_OFF ( 4)
+ #define DDRDATA2CH0_CR_RXPERBITRANK0_Lane1_WID ( 4)
+ #define DDRDATA2CH0_CR_RXPERBITRANK0_Lane1_MSK (0x000000F0)
+ #define DDRDATA2CH0_CR_RXPERBITRANK0_Lane1_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_RXPERBITRANK0_Lane2_OFF ( 8)
+ #define DDRDATA2CH0_CR_RXPERBITRANK0_Lane2_WID ( 4)
+ #define DDRDATA2CH0_CR_RXPERBITRANK0_Lane2_MSK (0x00000F00)
+ #define DDRDATA2CH0_CR_RXPERBITRANK0_Lane2_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_RXPERBITRANK0_Lane3_OFF (12)
+ #define DDRDATA2CH0_CR_RXPERBITRANK0_Lane3_WID ( 4)
+ #define DDRDATA2CH0_CR_RXPERBITRANK0_Lane3_MSK (0x0000F000)
+ #define DDRDATA2CH0_CR_RXPERBITRANK0_Lane3_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_RXPERBITRANK0_Lane4_OFF (16)
+ #define DDRDATA2CH0_CR_RXPERBITRANK0_Lane4_WID ( 4)
+ #define DDRDATA2CH0_CR_RXPERBITRANK0_Lane4_MSK (0x000F0000)
+ #define DDRDATA2CH0_CR_RXPERBITRANK0_Lane4_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_RXPERBITRANK0_Lane5_OFF (20)
+ #define DDRDATA2CH0_CR_RXPERBITRANK0_Lane5_WID ( 4)
+ #define DDRDATA2CH0_CR_RXPERBITRANK0_Lane5_MSK (0x00F00000)
+ #define DDRDATA2CH0_CR_RXPERBITRANK0_Lane5_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_RXPERBITRANK0_Lane6_OFF (24)
+ #define DDRDATA2CH0_CR_RXPERBITRANK0_Lane6_WID ( 4)
+ #define DDRDATA2CH0_CR_RXPERBITRANK0_Lane6_MSK (0x0F000000)
+ #define DDRDATA2CH0_CR_RXPERBITRANK0_Lane6_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_RXPERBITRANK0_Lane7_OFF (28)
+ #define DDRDATA2CH0_CR_RXPERBITRANK0_Lane7_WID ( 4)
+ #define DDRDATA2CH0_CR_RXPERBITRANK0_Lane7_MSK (0xF0000000)
+ #define DDRDATA2CH0_CR_RXPERBITRANK0_Lane7_MAX (0x0000000F)
+
+#define DDRDATA2CH0_CR_RXPERBITRANK1_REG (0x00000414)
+ #define DDRDATA2CH0_CR_RXPERBITRANK1_Lane0_OFF ( 0)
+ #define DDRDATA2CH0_CR_RXPERBITRANK1_Lane0_WID ( 4)
+ #define DDRDATA2CH0_CR_RXPERBITRANK1_Lane0_MSK (0x0000000F)
+ #define DDRDATA2CH0_CR_RXPERBITRANK1_Lane0_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_RXPERBITRANK1_Lane1_OFF ( 4)
+ #define DDRDATA2CH0_CR_RXPERBITRANK1_Lane1_WID ( 4)
+ #define DDRDATA2CH0_CR_RXPERBITRANK1_Lane1_MSK (0x000000F0)
+ #define DDRDATA2CH0_CR_RXPERBITRANK1_Lane1_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_RXPERBITRANK1_Lane2_OFF ( 8)
+ #define DDRDATA2CH0_CR_RXPERBITRANK1_Lane2_WID ( 4)
+ #define DDRDATA2CH0_CR_RXPERBITRANK1_Lane2_MSK (0x00000F00)
+ #define DDRDATA2CH0_CR_RXPERBITRANK1_Lane2_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_RXPERBITRANK1_Lane3_OFF (12)
+ #define DDRDATA2CH0_CR_RXPERBITRANK1_Lane3_WID ( 4)
+ #define DDRDATA2CH0_CR_RXPERBITRANK1_Lane3_MSK (0x0000F000)
+ #define DDRDATA2CH0_CR_RXPERBITRANK1_Lane3_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_RXPERBITRANK1_Lane4_OFF (16)
+ #define DDRDATA2CH0_CR_RXPERBITRANK1_Lane4_WID ( 4)
+ #define DDRDATA2CH0_CR_RXPERBITRANK1_Lane4_MSK (0x000F0000)
+ #define DDRDATA2CH0_CR_RXPERBITRANK1_Lane4_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_RXPERBITRANK1_Lane5_OFF (20)
+ #define DDRDATA2CH0_CR_RXPERBITRANK1_Lane5_WID ( 4)
+ #define DDRDATA2CH0_CR_RXPERBITRANK1_Lane5_MSK (0x00F00000)
+ #define DDRDATA2CH0_CR_RXPERBITRANK1_Lane5_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_RXPERBITRANK1_Lane6_OFF (24)
+ #define DDRDATA2CH0_CR_RXPERBITRANK1_Lane6_WID ( 4)
+ #define DDRDATA2CH0_CR_RXPERBITRANK1_Lane6_MSK (0x0F000000)
+ #define DDRDATA2CH0_CR_RXPERBITRANK1_Lane6_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_RXPERBITRANK1_Lane7_OFF (28)
+ #define DDRDATA2CH0_CR_RXPERBITRANK1_Lane7_WID ( 4)
+ #define DDRDATA2CH0_CR_RXPERBITRANK1_Lane7_MSK (0xF0000000)
+ #define DDRDATA2CH0_CR_RXPERBITRANK1_Lane7_MAX (0x0000000F)
+
+#define DDRDATA2CH0_CR_RXPERBITRANK2_REG (0x00000418)
+ #define DDRDATA2CH0_CR_RXPERBITRANK2_Lane0_OFF ( 0)
+ #define DDRDATA2CH0_CR_RXPERBITRANK2_Lane0_WID ( 4)
+ #define DDRDATA2CH0_CR_RXPERBITRANK2_Lane0_MSK (0x0000000F)
+ #define DDRDATA2CH0_CR_RXPERBITRANK2_Lane0_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_RXPERBITRANK2_Lane1_OFF ( 4)
+ #define DDRDATA2CH0_CR_RXPERBITRANK2_Lane1_WID ( 4)
+ #define DDRDATA2CH0_CR_RXPERBITRANK2_Lane1_MSK (0x000000F0)
+ #define DDRDATA2CH0_CR_RXPERBITRANK2_Lane1_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_RXPERBITRANK2_Lane2_OFF ( 8)
+ #define DDRDATA2CH0_CR_RXPERBITRANK2_Lane2_WID ( 4)
+ #define DDRDATA2CH0_CR_RXPERBITRANK2_Lane2_MSK (0x00000F00)
+ #define DDRDATA2CH0_CR_RXPERBITRANK2_Lane2_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_RXPERBITRANK2_Lane3_OFF (12)
+ #define DDRDATA2CH0_CR_RXPERBITRANK2_Lane3_WID ( 4)
+ #define DDRDATA2CH0_CR_RXPERBITRANK2_Lane3_MSK (0x0000F000)
+ #define DDRDATA2CH0_CR_RXPERBITRANK2_Lane3_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_RXPERBITRANK2_Lane4_OFF (16)
+ #define DDRDATA2CH0_CR_RXPERBITRANK2_Lane4_WID ( 4)
+ #define DDRDATA2CH0_CR_RXPERBITRANK2_Lane4_MSK (0x000F0000)
+ #define DDRDATA2CH0_CR_RXPERBITRANK2_Lane4_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_RXPERBITRANK2_Lane5_OFF (20)
+ #define DDRDATA2CH0_CR_RXPERBITRANK2_Lane5_WID ( 4)
+ #define DDRDATA2CH0_CR_RXPERBITRANK2_Lane5_MSK (0x00F00000)
+ #define DDRDATA2CH0_CR_RXPERBITRANK2_Lane5_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_RXPERBITRANK2_Lane6_OFF (24)
+ #define DDRDATA2CH0_CR_RXPERBITRANK2_Lane6_WID ( 4)
+ #define DDRDATA2CH0_CR_RXPERBITRANK2_Lane6_MSK (0x0F000000)
+ #define DDRDATA2CH0_CR_RXPERBITRANK2_Lane6_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_RXPERBITRANK2_Lane7_OFF (28)
+ #define DDRDATA2CH0_CR_RXPERBITRANK2_Lane7_WID ( 4)
+ #define DDRDATA2CH0_CR_RXPERBITRANK2_Lane7_MSK (0xF0000000)
+ #define DDRDATA2CH0_CR_RXPERBITRANK2_Lane7_MAX (0x0000000F)
+
+#define DDRDATA2CH0_CR_RXPERBITRANK3_REG (0x0000041C)
+ #define DDRDATA2CH0_CR_RXPERBITRANK3_Lane0_OFF ( 0)
+ #define DDRDATA2CH0_CR_RXPERBITRANK3_Lane0_WID ( 4)
+ #define DDRDATA2CH0_CR_RXPERBITRANK3_Lane0_MSK (0x0000000F)
+ #define DDRDATA2CH0_CR_RXPERBITRANK3_Lane0_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_RXPERBITRANK3_Lane1_OFF ( 4)
+ #define DDRDATA2CH0_CR_RXPERBITRANK3_Lane1_WID ( 4)
+ #define DDRDATA2CH0_CR_RXPERBITRANK3_Lane1_MSK (0x000000F0)
+ #define DDRDATA2CH0_CR_RXPERBITRANK3_Lane1_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_RXPERBITRANK3_Lane2_OFF ( 8)
+ #define DDRDATA2CH0_CR_RXPERBITRANK3_Lane2_WID ( 4)
+ #define DDRDATA2CH0_CR_RXPERBITRANK3_Lane2_MSK (0x00000F00)
+ #define DDRDATA2CH0_CR_RXPERBITRANK3_Lane2_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_RXPERBITRANK3_Lane3_OFF (12)
+ #define DDRDATA2CH0_CR_RXPERBITRANK3_Lane3_WID ( 4)
+ #define DDRDATA2CH0_CR_RXPERBITRANK3_Lane3_MSK (0x0000F000)
+ #define DDRDATA2CH0_CR_RXPERBITRANK3_Lane3_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_RXPERBITRANK3_Lane4_OFF (16)
+ #define DDRDATA2CH0_CR_RXPERBITRANK3_Lane4_WID ( 4)
+ #define DDRDATA2CH0_CR_RXPERBITRANK3_Lane4_MSK (0x000F0000)
+ #define DDRDATA2CH0_CR_RXPERBITRANK3_Lane4_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_RXPERBITRANK3_Lane5_OFF (20)
+ #define DDRDATA2CH0_CR_RXPERBITRANK3_Lane5_WID ( 4)
+ #define DDRDATA2CH0_CR_RXPERBITRANK3_Lane5_MSK (0x00F00000)
+ #define DDRDATA2CH0_CR_RXPERBITRANK3_Lane5_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_RXPERBITRANK3_Lane6_OFF (24)
+ #define DDRDATA2CH0_CR_RXPERBITRANK3_Lane6_WID ( 4)
+ #define DDRDATA2CH0_CR_RXPERBITRANK3_Lane6_MSK (0x0F000000)
+ #define DDRDATA2CH0_CR_RXPERBITRANK3_Lane6_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_RXPERBITRANK3_Lane7_OFF (28)
+ #define DDRDATA2CH0_CR_RXPERBITRANK3_Lane7_WID ( 4)
+ #define DDRDATA2CH0_CR_RXPERBITRANK3_Lane7_MSK (0xF0000000)
+ #define DDRDATA2CH0_CR_RXPERBITRANK3_Lane7_MAX (0x0000000F)
+
+#define DDRDATA2CH0_CR_TXTRAINRANK0_REG (0x00000420)
+ #define DDRDATA2CH0_CR_TXTRAINRANK0_TxDqDelay_OFF ( 0)
+ #define DDRDATA2CH0_CR_TXTRAINRANK0_TxDqDelay_WID ( 9)
+ #define DDRDATA2CH0_CR_TXTRAINRANK0_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA2CH0_CR_TXTRAINRANK0_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA2CH0_CR_TXTRAINRANK0_TxDqsDelay_OFF ( 9)
+ #define DDRDATA2CH0_CR_TXTRAINRANK0_TxDqsDelay_WID ( 9)
+ #define DDRDATA2CH0_CR_TXTRAINRANK0_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA2CH0_CR_TXTRAINRANK0_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA2CH0_CR_TXTRAINRANK0_Spare0_OFF (18)
+ #define DDRDATA2CH0_CR_TXTRAINRANK0_Spare0_WID ( 2)
+ #define DDRDATA2CH0_CR_TXTRAINRANK0_Spare0_MSK (0x000C0000)
+ #define DDRDATA2CH0_CR_TXTRAINRANK0_Spare0_MAX (0x00000003)
+ #define DDRDATA2CH0_CR_TXTRAINRANK0_TxEqualization_OFF (20)
+ #define DDRDATA2CH0_CR_TXTRAINRANK0_TxEqualization_WID ( 6)
+ #define DDRDATA2CH0_CR_TXTRAINRANK0_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA2CH0_CR_TXTRAINRANK0_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA2CH0_CR_TXTRAINRANK0_Spare1_OFF (26)
+ #define DDRDATA2CH0_CR_TXTRAINRANK0_Spare1_WID ( 6)
+ #define DDRDATA2CH0_CR_TXTRAINRANK0_Spare1_MSK (0xFC000000)
+ #define DDRDATA2CH0_CR_TXTRAINRANK0_Spare1_MAX (0x0000003F)
+
+#define DDRDATA2CH0_CR_TXTRAINRANK1_REG (0x00000424)
+ #define DDRDATA2CH0_CR_TXTRAINRANK1_TxDqDelay_OFF ( 0)
+ #define DDRDATA2CH0_CR_TXTRAINRANK1_TxDqDelay_WID ( 9)
+ #define DDRDATA2CH0_CR_TXTRAINRANK1_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA2CH0_CR_TXTRAINRANK1_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA2CH0_CR_TXTRAINRANK1_TxDqsDelay_OFF ( 9)
+ #define DDRDATA2CH0_CR_TXTRAINRANK1_TxDqsDelay_WID ( 9)
+ #define DDRDATA2CH0_CR_TXTRAINRANK1_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA2CH0_CR_TXTRAINRANK1_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA2CH0_CR_TXTRAINRANK1_Spare0_OFF (18)
+ #define DDRDATA2CH0_CR_TXTRAINRANK1_Spare0_WID ( 2)
+ #define DDRDATA2CH0_CR_TXTRAINRANK1_Spare0_MSK (0x000C0000)
+ #define DDRDATA2CH0_CR_TXTRAINRANK1_Spare0_MAX (0x00000003)
+ #define DDRDATA2CH0_CR_TXTRAINRANK1_TxEqualization_OFF (20)
+ #define DDRDATA2CH0_CR_TXTRAINRANK1_TxEqualization_WID ( 6)
+ #define DDRDATA2CH0_CR_TXTRAINRANK1_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA2CH0_CR_TXTRAINRANK1_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA2CH0_CR_TXTRAINRANK1_Spare1_OFF (26)
+ #define DDRDATA2CH0_CR_TXTRAINRANK1_Spare1_WID ( 6)
+ #define DDRDATA2CH0_CR_TXTRAINRANK1_Spare1_MSK (0xFC000000)
+ #define DDRDATA2CH0_CR_TXTRAINRANK1_Spare1_MAX (0x0000003F)
+
+#define DDRDATA2CH0_CR_TXTRAINRANK2_REG (0x00000428)
+ #define DDRDATA2CH0_CR_TXTRAINRANK2_TxDqDelay_OFF ( 0)
+ #define DDRDATA2CH0_CR_TXTRAINRANK2_TxDqDelay_WID ( 9)
+ #define DDRDATA2CH0_CR_TXTRAINRANK2_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA2CH0_CR_TXTRAINRANK2_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA2CH0_CR_TXTRAINRANK2_TxDqsDelay_OFF ( 9)
+ #define DDRDATA2CH0_CR_TXTRAINRANK2_TxDqsDelay_WID ( 9)
+ #define DDRDATA2CH0_CR_TXTRAINRANK2_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA2CH0_CR_TXTRAINRANK2_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA2CH0_CR_TXTRAINRANK2_Spare0_OFF (18)
+ #define DDRDATA2CH0_CR_TXTRAINRANK2_Spare0_WID ( 2)
+ #define DDRDATA2CH0_CR_TXTRAINRANK2_Spare0_MSK (0x000C0000)
+ #define DDRDATA2CH0_CR_TXTRAINRANK2_Spare0_MAX (0x00000003)
+ #define DDRDATA2CH0_CR_TXTRAINRANK2_TxEqualization_OFF (20)
+ #define DDRDATA2CH0_CR_TXTRAINRANK2_TxEqualization_WID ( 6)
+ #define DDRDATA2CH0_CR_TXTRAINRANK2_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA2CH0_CR_TXTRAINRANK2_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA2CH0_CR_TXTRAINRANK2_Spare1_OFF (26)
+ #define DDRDATA2CH0_CR_TXTRAINRANK2_Spare1_WID ( 6)
+ #define DDRDATA2CH0_CR_TXTRAINRANK2_Spare1_MSK (0xFC000000)
+ #define DDRDATA2CH0_CR_TXTRAINRANK2_Spare1_MAX (0x0000003F)
+
+#define DDRDATA2CH0_CR_TXTRAINRANK3_REG (0x0000042C)
+ #define DDRDATA2CH0_CR_TXTRAINRANK3_TxDqDelay_OFF ( 0)
+ #define DDRDATA2CH0_CR_TXTRAINRANK3_TxDqDelay_WID ( 9)
+ #define DDRDATA2CH0_CR_TXTRAINRANK3_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA2CH0_CR_TXTRAINRANK3_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA2CH0_CR_TXTRAINRANK3_TxDqsDelay_OFF ( 9)
+ #define DDRDATA2CH0_CR_TXTRAINRANK3_TxDqsDelay_WID ( 9)
+ #define DDRDATA2CH0_CR_TXTRAINRANK3_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA2CH0_CR_TXTRAINRANK3_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA2CH0_CR_TXTRAINRANK3_Spare0_OFF (18)
+ #define DDRDATA2CH0_CR_TXTRAINRANK3_Spare0_WID ( 2)
+ #define DDRDATA2CH0_CR_TXTRAINRANK3_Spare0_MSK (0x000C0000)
+ #define DDRDATA2CH0_CR_TXTRAINRANK3_Spare0_MAX (0x00000003)
+ #define DDRDATA2CH0_CR_TXTRAINRANK3_TxEqualization_OFF (20)
+ #define DDRDATA2CH0_CR_TXTRAINRANK3_TxEqualization_WID ( 6)
+ #define DDRDATA2CH0_CR_TXTRAINRANK3_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA2CH0_CR_TXTRAINRANK3_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA2CH0_CR_TXTRAINRANK3_Spare1_OFF (26)
+ #define DDRDATA2CH0_CR_TXTRAINRANK3_Spare1_WID ( 6)
+ #define DDRDATA2CH0_CR_TXTRAINRANK3_Spare1_MSK (0xFC000000)
+ #define DDRDATA2CH0_CR_TXTRAINRANK3_Spare1_MAX (0x0000003F)
+
+#define DDRDATA2CH0_CR_TXPERBITRANK0_REG (0x00000430)
+ #define DDRDATA2CH0_CR_TXPERBITRANK0_Lane0_OFF ( 0)
+ #define DDRDATA2CH0_CR_TXPERBITRANK0_Lane0_WID ( 4)
+ #define DDRDATA2CH0_CR_TXPERBITRANK0_Lane0_MSK (0x0000000F)
+ #define DDRDATA2CH0_CR_TXPERBITRANK0_Lane0_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_TXPERBITRANK0_Lane1_OFF ( 4)
+ #define DDRDATA2CH0_CR_TXPERBITRANK0_Lane1_WID ( 4)
+ #define DDRDATA2CH0_CR_TXPERBITRANK0_Lane1_MSK (0x000000F0)
+ #define DDRDATA2CH0_CR_TXPERBITRANK0_Lane1_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_TXPERBITRANK0_Lane2_OFF ( 8)
+ #define DDRDATA2CH0_CR_TXPERBITRANK0_Lane2_WID ( 4)
+ #define DDRDATA2CH0_CR_TXPERBITRANK0_Lane2_MSK (0x00000F00)
+ #define DDRDATA2CH0_CR_TXPERBITRANK0_Lane2_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_TXPERBITRANK0_Lane3_OFF (12)
+ #define DDRDATA2CH0_CR_TXPERBITRANK0_Lane3_WID ( 4)
+ #define DDRDATA2CH0_CR_TXPERBITRANK0_Lane3_MSK (0x0000F000)
+ #define DDRDATA2CH0_CR_TXPERBITRANK0_Lane3_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_TXPERBITRANK0_Lane4_OFF (16)
+ #define DDRDATA2CH0_CR_TXPERBITRANK0_Lane4_WID ( 4)
+ #define DDRDATA2CH0_CR_TXPERBITRANK0_Lane4_MSK (0x000F0000)
+ #define DDRDATA2CH0_CR_TXPERBITRANK0_Lane4_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_TXPERBITRANK0_Lane5_OFF (20)
+ #define DDRDATA2CH0_CR_TXPERBITRANK0_Lane5_WID ( 4)
+ #define DDRDATA2CH0_CR_TXPERBITRANK0_Lane5_MSK (0x00F00000)
+ #define DDRDATA2CH0_CR_TXPERBITRANK0_Lane5_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_TXPERBITRANK0_Lane6_OFF (24)
+ #define DDRDATA2CH0_CR_TXPERBITRANK0_Lane6_WID ( 4)
+ #define DDRDATA2CH0_CR_TXPERBITRANK0_Lane6_MSK (0x0F000000)
+ #define DDRDATA2CH0_CR_TXPERBITRANK0_Lane6_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_TXPERBITRANK0_Lane7_OFF (28)
+ #define DDRDATA2CH0_CR_TXPERBITRANK0_Lane7_WID ( 4)
+ #define DDRDATA2CH0_CR_TXPERBITRANK0_Lane7_MSK (0xF0000000)
+ #define DDRDATA2CH0_CR_TXPERBITRANK0_Lane7_MAX (0x0000000F)
+
+#define DDRDATA2CH0_CR_TXPERBITRANK1_REG (0x00000434)
+ #define DDRDATA2CH0_CR_TXPERBITRANK1_Lane0_OFF ( 0)
+ #define DDRDATA2CH0_CR_TXPERBITRANK1_Lane0_WID ( 4)
+ #define DDRDATA2CH0_CR_TXPERBITRANK1_Lane0_MSK (0x0000000F)
+ #define DDRDATA2CH0_CR_TXPERBITRANK1_Lane0_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_TXPERBITRANK1_Lane1_OFF ( 4)
+ #define DDRDATA2CH0_CR_TXPERBITRANK1_Lane1_WID ( 4)
+ #define DDRDATA2CH0_CR_TXPERBITRANK1_Lane1_MSK (0x000000F0)
+ #define DDRDATA2CH0_CR_TXPERBITRANK1_Lane1_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_TXPERBITRANK1_Lane2_OFF ( 8)
+ #define DDRDATA2CH0_CR_TXPERBITRANK1_Lane2_WID ( 4)
+ #define DDRDATA2CH0_CR_TXPERBITRANK1_Lane2_MSK (0x00000F00)
+ #define DDRDATA2CH0_CR_TXPERBITRANK1_Lane2_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_TXPERBITRANK1_Lane3_OFF (12)
+ #define DDRDATA2CH0_CR_TXPERBITRANK1_Lane3_WID ( 4)
+ #define DDRDATA2CH0_CR_TXPERBITRANK1_Lane3_MSK (0x0000F000)
+ #define DDRDATA2CH0_CR_TXPERBITRANK1_Lane3_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_TXPERBITRANK1_Lane4_OFF (16)
+ #define DDRDATA2CH0_CR_TXPERBITRANK1_Lane4_WID ( 4)
+ #define DDRDATA2CH0_CR_TXPERBITRANK1_Lane4_MSK (0x000F0000)
+ #define DDRDATA2CH0_CR_TXPERBITRANK1_Lane4_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_TXPERBITRANK1_Lane5_OFF (20)
+ #define DDRDATA2CH0_CR_TXPERBITRANK1_Lane5_WID ( 4)
+ #define DDRDATA2CH0_CR_TXPERBITRANK1_Lane5_MSK (0x00F00000)
+ #define DDRDATA2CH0_CR_TXPERBITRANK1_Lane5_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_TXPERBITRANK1_Lane6_OFF (24)
+ #define DDRDATA2CH0_CR_TXPERBITRANK1_Lane6_WID ( 4)
+ #define DDRDATA2CH0_CR_TXPERBITRANK1_Lane6_MSK (0x0F000000)
+ #define DDRDATA2CH0_CR_TXPERBITRANK1_Lane6_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_TXPERBITRANK1_Lane7_OFF (28)
+ #define DDRDATA2CH0_CR_TXPERBITRANK1_Lane7_WID ( 4)
+ #define DDRDATA2CH0_CR_TXPERBITRANK1_Lane7_MSK (0xF0000000)
+ #define DDRDATA2CH0_CR_TXPERBITRANK1_Lane7_MAX (0x0000000F)
+
+#define DDRDATA2CH0_CR_TXPERBITRANK2_REG (0x00000438)
+ #define DDRDATA2CH0_CR_TXPERBITRANK2_Lane0_OFF ( 0)
+ #define DDRDATA2CH0_CR_TXPERBITRANK2_Lane0_WID ( 4)
+ #define DDRDATA2CH0_CR_TXPERBITRANK2_Lane0_MSK (0x0000000F)
+ #define DDRDATA2CH0_CR_TXPERBITRANK2_Lane0_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_TXPERBITRANK2_Lane1_OFF ( 4)
+ #define DDRDATA2CH0_CR_TXPERBITRANK2_Lane1_WID ( 4)
+ #define DDRDATA2CH0_CR_TXPERBITRANK2_Lane1_MSK (0x000000F0)
+ #define DDRDATA2CH0_CR_TXPERBITRANK2_Lane1_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_TXPERBITRANK2_Lane2_OFF ( 8)
+ #define DDRDATA2CH0_CR_TXPERBITRANK2_Lane2_WID ( 4)
+ #define DDRDATA2CH0_CR_TXPERBITRANK2_Lane2_MSK (0x00000F00)
+ #define DDRDATA2CH0_CR_TXPERBITRANK2_Lane2_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_TXPERBITRANK2_Lane3_OFF (12)
+ #define DDRDATA2CH0_CR_TXPERBITRANK2_Lane3_WID ( 4)
+ #define DDRDATA2CH0_CR_TXPERBITRANK2_Lane3_MSK (0x0000F000)
+ #define DDRDATA2CH0_CR_TXPERBITRANK2_Lane3_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_TXPERBITRANK2_Lane4_OFF (16)
+ #define DDRDATA2CH0_CR_TXPERBITRANK2_Lane4_WID ( 4)
+ #define DDRDATA2CH0_CR_TXPERBITRANK2_Lane4_MSK (0x000F0000)
+ #define DDRDATA2CH0_CR_TXPERBITRANK2_Lane4_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_TXPERBITRANK2_Lane5_OFF (20)
+ #define DDRDATA2CH0_CR_TXPERBITRANK2_Lane5_WID ( 4)
+ #define DDRDATA2CH0_CR_TXPERBITRANK2_Lane5_MSK (0x00F00000)
+ #define DDRDATA2CH0_CR_TXPERBITRANK2_Lane5_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_TXPERBITRANK2_Lane6_OFF (24)
+ #define DDRDATA2CH0_CR_TXPERBITRANK2_Lane6_WID ( 4)
+ #define DDRDATA2CH0_CR_TXPERBITRANK2_Lane6_MSK (0x0F000000)
+ #define DDRDATA2CH0_CR_TXPERBITRANK2_Lane6_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_TXPERBITRANK2_Lane7_OFF (28)
+ #define DDRDATA2CH0_CR_TXPERBITRANK2_Lane7_WID ( 4)
+ #define DDRDATA2CH0_CR_TXPERBITRANK2_Lane7_MSK (0xF0000000)
+ #define DDRDATA2CH0_CR_TXPERBITRANK2_Lane7_MAX (0x0000000F)
+
+#define DDRDATA2CH0_CR_TXPERBITRANK3_REG (0x0000043C)
+ #define DDRDATA2CH0_CR_TXPERBITRANK3_Lane0_OFF ( 0)
+ #define DDRDATA2CH0_CR_TXPERBITRANK3_Lane0_WID ( 4)
+ #define DDRDATA2CH0_CR_TXPERBITRANK3_Lane0_MSK (0x0000000F)
+ #define DDRDATA2CH0_CR_TXPERBITRANK3_Lane0_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_TXPERBITRANK3_Lane1_OFF ( 4)
+ #define DDRDATA2CH0_CR_TXPERBITRANK3_Lane1_WID ( 4)
+ #define DDRDATA2CH0_CR_TXPERBITRANK3_Lane1_MSK (0x000000F0)
+ #define DDRDATA2CH0_CR_TXPERBITRANK3_Lane1_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_TXPERBITRANK3_Lane2_OFF ( 8)
+ #define DDRDATA2CH0_CR_TXPERBITRANK3_Lane2_WID ( 4)
+ #define DDRDATA2CH0_CR_TXPERBITRANK3_Lane2_MSK (0x00000F00)
+ #define DDRDATA2CH0_CR_TXPERBITRANK3_Lane2_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_TXPERBITRANK3_Lane3_OFF (12)
+ #define DDRDATA2CH0_CR_TXPERBITRANK3_Lane3_WID ( 4)
+ #define DDRDATA2CH0_CR_TXPERBITRANK3_Lane3_MSK (0x0000F000)
+ #define DDRDATA2CH0_CR_TXPERBITRANK3_Lane3_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_TXPERBITRANK3_Lane4_OFF (16)
+ #define DDRDATA2CH0_CR_TXPERBITRANK3_Lane4_WID ( 4)
+ #define DDRDATA2CH0_CR_TXPERBITRANK3_Lane4_MSK (0x000F0000)
+ #define DDRDATA2CH0_CR_TXPERBITRANK3_Lane4_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_TXPERBITRANK3_Lane5_OFF (20)
+ #define DDRDATA2CH0_CR_TXPERBITRANK3_Lane5_WID ( 4)
+ #define DDRDATA2CH0_CR_TXPERBITRANK3_Lane5_MSK (0x00F00000)
+ #define DDRDATA2CH0_CR_TXPERBITRANK3_Lane5_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_TXPERBITRANK3_Lane6_OFF (24)
+ #define DDRDATA2CH0_CR_TXPERBITRANK3_Lane6_WID ( 4)
+ #define DDRDATA2CH0_CR_TXPERBITRANK3_Lane6_MSK (0x0F000000)
+ #define DDRDATA2CH0_CR_TXPERBITRANK3_Lane6_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_TXPERBITRANK3_Lane7_OFF (28)
+ #define DDRDATA2CH0_CR_TXPERBITRANK3_Lane7_WID ( 4)
+ #define DDRDATA2CH0_CR_TXPERBITRANK3_Lane7_MSK (0xF0000000)
+ #define DDRDATA2CH0_CR_TXPERBITRANK3_Lane7_MAX (0x0000000F)
+
+#define DDRDATA2CH0_CR_RCOMPDATA0_REG (0x00000440)
+ #define DDRDATA2CH0_CR_RCOMPDATA0_RcompDrvUp_OFF ( 0)
+ #define DDRDATA2CH0_CR_RCOMPDATA0_RcompDrvUp_WID ( 6)
+ #define DDRDATA2CH0_CR_RCOMPDATA0_RcompDrvUp_MSK (0x0000003F)
+ #define DDRDATA2CH0_CR_RCOMPDATA0_RcompDrvUp_MAX (0x0000003F)
+ #define DDRDATA2CH0_CR_RCOMPDATA0_Spare0_OFF ( 6)
+ #define DDRDATA2CH0_CR_RCOMPDATA0_Spare0_WID ( 3)
+ #define DDRDATA2CH0_CR_RCOMPDATA0_Spare0_MSK (0x000001C0)
+ #define DDRDATA2CH0_CR_RCOMPDATA0_Spare0_MAX (0x00000007)
+ #define DDRDATA2CH0_CR_RCOMPDATA0_RcompDrvDown_OFF ( 9)
+ #define DDRDATA2CH0_CR_RCOMPDATA0_RcompDrvDown_WID ( 6)
+ #define DDRDATA2CH0_CR_RCOMPDATA0_RcompDrvDown_MSK (0x00007E00)
+ #define DDRDATA2CH0_CR_RCOMPDATA0_RcompDrvDown_MAX (0x0000003F)
+ #define DDRDATA2CH0_CR_RCOMPDATA0_VTComp_OFF (15)
+ #define DDRDATA2CH0_CR_RCOMPDATA0_VTComp_WID ( 5)
+ #define DDRDATA2CH0_CR_RCOMPDATA0_VTComp_MSK (0x000F8000)
+ #define DDRDATA2CH0_CR_RCOMPDATA0_VTComp_MAX (0x0000001F)
+ #define DDRDATA2CH0_CR_RCOMPDATA0_TcoComp_OFF (20)
+ #define DDRDATA2CH0_CR_RCOMPDATA0_TcoComp_WID ( 6)
+ #define DDRDATA2CH0_CR_RCOMPDATA0_TcoComp_MSK (0x03F00000)
+ #define DDRDATA2CH0_CR_RCOMPDATA0_TcoComp_MAX (0x0000003F)
+ #define DDRDATA2CH0_CR_RCOMPDATA0_SlewRateComp_OFF (26)
+ #define DDRDATA2CH0_CR_RCOMPDATA0_SlewRateComp_WID ( 5)
+ #define DDRDATA2CH0_CR_RCOMPDATA0_SlewRateComp_MSK (0x7C000000)
+ #define DDRDATA2CH0_CR_RCOMPDATA0_SlewRateComp_MAX (0x0000001F)
+ #define DDRDATA2CH0_CR_RCOMPDATA0_Spare2_OFF (31)
+ #define DDRDATA2CH0_CR_RCOMPDATA0_Spare2_WID ( 1)
+ #define DDRDATA2CH0_CR_RCOMPDATA0_Spare2_MSK (0x80000000)
+ #define DDRDATA2CH0_CR_RCOMPDATA0_Spare2_MAX (0x00000001)
+
+#define DDRDATA2CH0_CR_RCOMPDATA1_REG (0x00000444)
+ #define DDRDATA2CH0_CR_RCOMPDATA1_RcompOdtUp_OFF ( 0)
+ #define DDRDATA2CH0_CR_RCOMPDATA1_RcompOdtUp_WID ( 6)
+ #define DDRDATA2CH0_CR_RCOMPDATA1_RcompOdtUp_MSK (0x0000003F)
+ #define DDRDATA2CH0_CR_RCOMPDATA1_RcompOdtUp_MAX (0x0000003F)
+ #define DDRDATA2CH0_CR_RCOMPDATA1_Spare0_OFF ( 6)
+ #define DDRDATA2CH0_CR_RCOMPDATA1_Spare0_WID ( 3)
+ #define DDRDATA2CH0_CR_RCOMPDATA1_Spare0_MSK (0x000001C0)
+ #define DDRDATA2CH0_CR_RCOMPDATA1_Spare0_MAX (0x00000007)
+ #define DDRDATA2CH0_CR_RCOMPDATA1_RcompOdtDown_OFF ( 9)
+ #define DDRDATA2CH0_CR_RCOMPDATA1_RcompOdtDown_WID ( 6)
+ #define DDRDATA2CH0_CR_RCOMPDATA1_RcompOdtDown_MSK (0x00007E00)
+ #define DDRDATA2CH0_CR_RCOMPDATA1_RcompOdtDown_MAX (0x0000003F)
+ #define DDRDATA2CH0_CR_RCOMPDATA1_Spare1_OFF (15)
+ #define DDRDATA2CH0_CR_RCOMPDATA1_Spare1_WID ( 1)
+ #define DDRDATA2CH0_CR_RCOMPDATA1_Spare1_MSK (0x00008000)
+ #define DDRDATA2CH0_CR_RCOMPDATA1_Spare1_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_RCOMPDATA1_PanicDrvDn_OFF (16)
+ #define DDRDATA2CH0_CR_RCOMPDATA1_PanicDrvDn_WID ( 6)
+ #define DDRDATA2CH0_CR_RCOMPDATA1_PanicDrvDn_MSK (0x003F0000)
+ #define DDRDATA2CH0_CR_RCOMPDATA1_PanicDrvDn_MAX (0x0000003F)
+ #define DDRDATA2CH0_CR_RCOMPDATA1_PanicDrvUp_OFF (22)
+ #define DDRDATA2CH0_CR_RCOMPDATA1_PanicDrvUp_WID ( 6)
+ #define DDRDATA2CH0_CR_RCOMPDATA1_PanicDrvUp_MSK (0x0FC00000)
+ #define DDRDATA2CH0_CR_RCOMPDATA1_PanicDrvUp_MAX (0x0000003F)
+ #define DDRDATA2CH0_CR_RCOMPDATA1_LevelShifterComp_OFF (28)
+ #define DDRDATA2CH0_CR_RCOMPDATA1_LevelShifterComp_WID ( 3)
+ #define DDRDATA2CH0_CR_RCOMPDATA1_LevelShifterComp_MSK (0x70000000)
+ #define DDRDATA2CH0_CR_RCOMPDATA1_LevelShifterComp_MAX (0x00000007)
+ #define DDRDATA2CH0_CR_RCOMPDATA1_Spare2_OFF (31)
+ #define DDRDATA2CH0_CR_RCOMPDATA1_Spare2_WID ( 1)
+ #define DDRDATA2CH0_CR_RCOMPDATA1_Spare2_MSK (0x80000000)
+ #define DDRDATA2CH0_CR_RCOMPDATA1_Spare2_MAX (0x00000001)
+
+#define DDRDATA2CH0_CR_TXXTALK_REG (0x00000448)
+ #define DDRDATA2CH0_CR_TXXTALK_Lane0_OFF ( 0)
+ #define DDRDATA2CH0_CR_TXXTALK_Lane0_WID ( 4)
+ #define DDRDATA2CH0_CR_TXXTALK_Lane0_MSK (0x0000000F)
+ #define DDRDATA2CH0_CR_TXXTALK_Lane0_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_TXXTALK_Lane1_OFF ( 4)
+ #define DDRDATA2CH0_CR_TXXTALK_Lane1_WID ( 4)
+ #define DDRDATA2CH0_CR_TXXTALK_Lane1_MSK (0x000000F0)
+ #define DDRDATA2CH0_CR_TXXTALK_Lane1_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_TXXTALK_Lane2_OFF ( 8)
+ #define DDRDATA2CH0_CR_TXXTALK_Lane2_WID ( 4)
+ #define DDRDATA2CH0_CR_TXXTALK_Lane2_MSK (0x00000F00)
+ #define DDRDATA2CH0_CR_TXXTALK_Lane2_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_TXXTALK_Lane3_OFF (12)
+ #define DDRDATA2CH0_CR_TXXTALK_Lane3_WID ( 4)
+ #define DDRDATA2CH0_CR_TXXTALK_Lane3_MSK (0x0000F000)
+ #define DDRDATA2CH0_CR_TXXTALK_Lane3_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_TXXTALK_Lane4_OFF (16)
+ #define DDRDATA2CH0_CR_TXXTALK_Lane4_WID ( 4)
+ #define DDRDATA2CH0_CR_TXXTALK_Lane4_MSK (0x000F0000)
+ #define DDRDATA2CH0_CR_TXXTALK_Lane4_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_TXXTALK_Lane5_OFF (20)
+ #define DDRDATA2CH0_CR_TXXTALK_Lane5_WID ( 4)
+ #define DDRDATA2CH0_CR_TXXTALK_Lane5_MSK (0x00F00000)
+ #define DDRDATA2CH0_CR_TXXTALK_Lane5_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_TXXTALK_Lane6_OFF (24)
+ #define DDRDATA2CH0_CR_TXXTALK_Lane6_WID ( 4)
+ #define DDRDATA2CH0_CR_TXXTALK_Lane6_MSK (0x0F000000)
+ #define DDRDATA2CH0_CR_TXXTALK_Lane6_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_TXXTALK_Lane7_OFF (28)
+ #define DDRDATA2CH0_CR_TXXTALK_Lane7_WID ( 4)
+ #define DDRDATA2CH0_CR_TXXTALK_Lane7_MSK (0xF0000000)
+ #define DDRDATA2CH0_CR_TXXTALK_Lane7_MAX (0x0000000F)
+
+#define DDRDATA2CH0_CR_RXOFFSETVDQ_REG (0x0000044C)
+ #define DDRDATA2CH0_CR_RXOFFSETVDQ_Lane0_OFF ( 0)
+ #define DDRDATA2CH0_CR_RXOFFSETVDQ_Lane0_WID ( 4)
+ #define DDRDATA2CH0_CR_RXOFFSETVDQ_Lane0_MSK (0x0000000F)
+ #define DDRDATA2CH0_CR_RXOFFSETVDQ_Lane0_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_RXOFFSETVDQ_Lane1_OFF ( 4)
+ #define DDRDATA2CH0_CR_RXOFFSETVDQ_Lane1_WID ( 4)
+ #define DDRDATA2CH0_CR_RXOFFSETVDQ_Lane1_MSK (0x000000F0)
+ #define DDRDATA2CH0_CR_RXOFFSETVDQ_Lane1_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_RXOFFSETVDQ_Lane2_OFF ( 8)
+ #define DDRDATA2CH0_CR_RXOFFSETVDQ_Lane2_WID ( 4)
+ #define DDRDATA2CH0_CR_RXOFFSETVDQ_Lane2_MSK (0x00000F00)
+ #define DDRDATA2CH0_CR_RXOFFSETVDQ_Lane2_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_RXOFFSETVDQ_Lane3_OFF (12)
+ #define DDRDATA2CH0_CR_RXOFFSETVDQ_Lane3_WID ( 4)
+ #define DDRDATA2CH0_CR_RXOFFSETVDQ_Lane3_MSK (0x0000F000)
+ #define DDRDATA2CH0_CR_RXOFFSETVDQ_Lane3_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_RXOFFSETVDQ_Lane4_OFF (16)
+ #define DDRDATA2CH0_CR_RXOFFSETVDQ_Lane4_WID ( 4)
+ #define DDRDATA2CH0_CR_RXOFFSETVDQ_Lane4_MSK (0x000F0000)
+ #define DDRDATA2CH0_CR_RXOFFSETVDQ_Lane4_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_RXOFFSETVDQ_Lane5_OFF (20)
+ #define DDRDATA2CH0_CR_RXOFFSETVDQ_Lane5_WID ( 4)
+ #define DDRDATA2CH0_CR_RXOFFSETVDQ_Lane5_MSK (0x00F00000)
+ #define DDRDATA2CH0_CR_RXOFFSETVDQ_Lane5_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_RXOFFSETVDQ_Lane6_OFF (24)
+ #define DDRDATA2CH0_CR_RXOFFSETVDQ_Lane6_WID ( 4)
+ #define DDRDATA2CH0_CR_RXOFFSETVDQ_Lane6_MSK (0x0F000000)
+ #define DDRDATA2CH0_CR_RXOFFSETVDQ_Lane6_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_RXOFFSETVDQ_Lane7_OFF (28)
+ #define DDRDATA2CH0_CR_RXOFFSETVDQ_Lane7_WID ( 4)
+ #define DDRDATA2CH0_CR_RXOFFSETVDQ_Lane7_MSK (0xF0000000)
+ #define DDRDATA2CH0_CR_RXOFFSETVDQ_Lane7_MAX (0x0000000F)
+
+#define DDRDATA2CH0_CR_DDRDATARESERVED_REG (0x00000450)
+ #define DDRDATA2CH0_CR_DDRDATARESERVED_Spare_OFF ( 0)
+ #define DDRDATA2CH0_CR_DDRDATARESERVED_Spare_WID (32)
+ #define DDRDATA2CH0_CR_DDRDATARESERVED_Spare_MSK (0xFFFFFFFF)
+ #define DDRDATA2CH0_CR_DDRDATARESERVED_Spare_MAX (0xFFFFFFFF)
+
+#define DDRDATA2CH0_CR_DATATRAINFEEDBACK_REG (0x00000454)
+ #define DDRDATA2CH0_CR_DATATRAINFEEDBACK_DataTrainFeedback_OFF ( 0)
+ #define DDRDATA2CH0_CR_DATATRAINFEEDBACK_DataTrainFeedback_WID ( 9)
+ #define DDRDATA2CH0_CR_DATATRAINFEEDBACK_DataTrainFeedback_MSK (0x000001FF)
+ #define DDRDATA2CH0_CR_DATATRAINFEEDBACK_DataTrainFeedback_MAX (0x000001FF)
+ #define DDRDATA2CH0_CR_DATATRAINFEEDBACK_Spare_OFF ( 9)
+ #define DDRDATA2CH0_CR_DATATRAINFEEDBACK_Spare_WID (23)
+ #define DDRDATA2CH0_CR_DATATRAINFEEDBACK_Spare_MSK (0xFFFFFE00)
+ #define DDRDATA2CH0_CR_DATATRAINFEEDBACK_Spare_MAX (0x007FFFFF)
+
+#define DDRDATA2CH0_CR_DLLPITESTANDADC_REG (0x00000458)
+ #define DDRDATA2CH0_CR_DLLPITESTANDADC_RunTest_OFF ( 0)
+ #define DDRDATA2CH0_CR_DLLPITESTANDADC_RunTest_WID ( 1)
+ #define DDRDATA2CH0_CR_DLLPITESTANDADC_RunTest_MSK (0x00000001)
+ #define DDRDATA2CH0_CR_DLLPITESTANDADC_RunTest_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DLLPITESTANDADC_RunTest_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DLLPITESTANDADC_Load_OFF ( 1)
+ #define DDRDATA2CH0_CR_DLLPITESTANDADC_Load_WID ( 1)
+ #define DDRDATA2CH0_CR_DLLPITESTANDADC_Load_MSK (0x00000002)
+ #define DDRDATA2CH0_CR_DLLPITESTANDADC_Load_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DLLPITESTANDADC_Load_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DLLPITESTANDADC_ModeHVM_OFF ( 2)
+ #define DDRDATA2CH0_CR_DLLPITESTANDADC_ModeHVM_WID ( 1)
+ #define DDRDATA2CH0_CR_DLLPITESTANDADC_ModeHVM_MSK (0x00000004)
+ #define DDRDATA2CH0_CR_DLLPITESTANDADC_ModeHVM_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DLLPITESTANDADC_ModeHVM_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DLLPITESTANDADC_ModeDV_OFF ( 3)
+ #define DDRDATA2CH0_CR_DLLPITESTANDADC_ModeDV_WID ( 1)
+ #define DDRDATA2CH0_CR_DLLPITESTANDADC_ModeDV_MSK (0x00000008)
+ #define DDRDATA2CH0_CR_DLLPITESTANDADC_ModeDV_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DLLPITESTANDADC_ModeDV_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DLLPITESTANDADC_ModeADC_OFF ( 4)
+ #define DDRDATA2CH0_CR_DLLPITESTANDADC_ModeADC_WID ( 1)
+ #define DDRDATA2CH0_CR_DLLPITESTANDADC_ModeADC_MSK (0x00000010)
+ #define DDRDATA2CH0_CR_DLLPITESTANDADC_ModeADC_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DLLPITESTANDADC_ModeADC_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DLLPITESTANDADC_LoadCount_OFF ( 5)
+ #define DDRDATA2CH0_CR_DLLPITESTANDADC_LoadCount_WID (10)
+ #define DDRDATA2CH0_CR_DLLPITESTANDADC_LoadCount_MSK (0x00007FE0)
+ #define DDRDATA2CH0_CR_DLLPITESTANDADC_LoadCount_MAX (0x000003FF)
+ #define DDRDATA2CH0_CR_DLLPITESTANDADC_CountStatus_OFF (15)
+ #define DDRDATA2CH0_CR_DLLPITESTANDADC_CountStatus_WID (10)
+ #define DDRDATA2CH0_CR_DLLPITESTANDADC_CountStatus_MSK (0x01FF8000)
+ #define DDRDATA2CH0_CR_DLLPITESTANDADC_CountStatus_MAX (0x000003FF)
+ #define DDRDATA2CH0_CR_DLLPITESTANDADC_CountStatus_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DLLPITESTANDADC_Spare_OFF (25)
+ #define DDRDATA2CH0_CR_DLLPITESTANDADC_Spare_WID ( 7)
+ #define DDRDATA2CH0_CR_DLLPITESTANDADC_Spare_MSK (0xFE000000)
+ #define DDRDATA2CH0_CR_DLLPITESTANDADC_Spare_MAX (0x0000007F)
+
+#define DDRDATA2CH0_CR_DDRCRDATAOFFSETCOMP_REG (0x0000045C)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_OFF ( 0)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_WID ( 6)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_MSK (0x0000003F)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_MAX (0x0000003F)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_OFF ( 6)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_WID ( 6)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_MSK (0x00000FC0)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_MAX (0x0000003F)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_OFF (12)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_WID ( 5)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_MSK (0x0001F000)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_MAX (0x0000001F)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_OFF (17)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_WID ( 5)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_MSK (0x003E0000)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_MAX (0x0000001F)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_OFF (22)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_WID ( 5)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_MSK (0x07C00000)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_MAX (0x0000001F)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_OFF (27)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_WID ( 5)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_MSK (0xF8000000)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_MAX (0x0000001F)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_DEF (0x00000000)
+
+#define DDRDATA2CH0_CR_DDRCRDATACONTROL1_REG (0x00000460)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_RefPi_OFF ( 0)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_RefPi_WID ( 4)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_RefPi_MSK (0x0000000F)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_RefPi_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_RefPi_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_DllMask_OFF ( 4)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_DllMask_WID ( 2)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_DllMask_MSK (0x00000030)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_DllMask_MAX (0x00000003)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_DllMask_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_DllWeakLock_OFF ( 6)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_DllWeakLock_WID ( 1)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_DllWeakLock_MSK (0x00000040)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_DllWeakLock_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_DllWeakLock_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_OFF ( 7)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_WID ( 3)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_MSK (0x00000380)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_MAX (0x00000007)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_OFF (10)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_WID ( 3)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_MSK (0x00001C00)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_MAX (0x00000007)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_OdtDelay_OFF (13)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_OdtDelay_WID ( 4)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_OdtDelay_MSK (0x0001E000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_OdtDelay_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_OdtDelay_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_OdtDuration_OFF (17)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_OdtDuration_WID ( 3)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_OdtDuration_MSK (0x000E0000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_OdtDuration_MAX (0x00000007)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_OdtDuration_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_OFF (20)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_WID ( 4)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_MSK (0x00F00000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_OFF (24)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_WID ( 3)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_MSK (0x07000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_MAX (0x00000007)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_OFF (27)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_WID ( 3)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_MSK (0x38000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_MAX (0x00000007)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_OFF (30)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_WID ( 1)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_MSK (0x40000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_Rsvd1_OFF (31)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_Rsvd1_WID ( 1)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_Rsvd1_MSK (0x80000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_Rsvd1_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL1_Rsvd1_DEF (0x00000000)
+
+#define DDRDATA2CH0_CR_DDRCRDATACONTROL2_REG (0x00000464)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_OFF ( 0)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_WID ( 5)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_MSK (0x0000001F)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_MAX (0x0000001F)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_OFF ( 5)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_WID ( 1)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_MSK (0x00000020)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL2_ForceRxOn_OFF ( 6)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL2_ForceRxOn_WID ( 1)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL2_ForceRxOn_MSK (0x00000040)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL2_ForceRxOn_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL2_ForceRxOn_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL2_LeakerComp_OFF ( 7)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL2_LeakerComp_WID ( 2)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL2_LeakerComp_MSK (0x00000180)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL2_LeakerComp_MAX (0x00000003)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL2_LeakerComp_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_OFF ( 9)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_WID ( 4)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_MSK (0x00001E00)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_MAX (0x0000000F)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_DEF (0x00000008)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_OFF (13)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_WID ( 5)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_MSK (0x0003E000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_MAX (0x0000001F)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_DEF (0x00000011)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_OFF (18)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_WID ( 1)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_MSK (0x00040000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL2_Spare_OFF (19)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL2_Spare_WID (13)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL2_Spare_MSK (0xFFF80000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL2_Spare_MAX (0x00001FFF)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL2_Spare_DEF (0x00000000)
+
+#define DDRDATA2CH0_CR_DDRCRVSSHIORVREFCONTROL_REG (0x0000046C)
+ #define DDRDATA2CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_OFF ( 0)
+ #define DDRDATA2CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_WID (24)
+ #define DDRDATA2CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_MSK (0x00FFFFFF)
+ #define DDRDATA2CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_MAX (0x00FFFFFF)
+ #define DDRDATA2CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_OFF (24)
+ #define DDRDATA2CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_WID ( 8)
+ #define DDRDATA2CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_MSK (0xFF000000)
+ #define DDRDATA2CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_MAX (0x000000FF)
+ #define DDRDATA2CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_DEF (0x00000000)
+
+#define DDRDATA2CH0_CR_DDRCRDATAOFFSETTRAIN_REG (0x00000470)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_OFF ( 0)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_WID ( 6)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_MSK (0x0000003F)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_MAX (0x0000003F)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_OFF ( 6)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_WID ( 6)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_MSK (0x00000FC0)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_MAX (0x0000003F)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_OFF (12)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_WID ( 6)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_MSK (0x0003F000)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_MAX (0x0000003F)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_OFF (18)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_WID ( 6)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_MSK (0x00FC0000)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_MAX (0x0000003F)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_OFF (24)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_WID ( 7)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_MSK (0x7F000000)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_MAX (0x0000007F)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_OFF (31)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_WID ( 1)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_MSK (0x80000000)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_DEF (0x00000000)
+
+#define DDRDATA2CH0_CR_DDRCRDATACONTROL0_REG (0x00000474)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_OFF ( 0)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_WID ( 1)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_MSK (0x00000001)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_OFF ( 1)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_WID ( 1)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_MSK (0x00000002)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_OFF ( 2)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_WID ( 1)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_MSK (0x00000004)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_OFF ( 3)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_WID ( 1)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_MSK (0x00000008)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_TxOn_OFF ( 4)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_TxOn_WID ( 1)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_TxOn_MSK (0x00000010)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_TxOn_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_TxOn_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_RfOn_OFF ( 5)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_RfOn_WID ( 1)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_RfOn_MSK (0x00000020)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_RfOn_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_RfOn_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_RxPiOn_OFF ( 6)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_RxPiOn_WID ( 1)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_RxPiOn_MSK (0x00000040)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_RxPiOn_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_RxPiOn_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_TxPiOn_OFF ( 7)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_TxPiOn_WID ( 1)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_TxPiOn_MSK (0x00000080)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_TxPiOn_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_TxPiOn_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_OFF ( 8)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_WID ( 1)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_MSK (0x00000100)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_OFF ( 9)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_WID ( 1)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_MSK (0x00000200)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_TxDisable_OFF (10)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_TxDisable_WID ( 1)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_TxDisable_MSK (0x00000400)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_TxDisable_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_TxDisable_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_RxDisable_OFF (11)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_RxDisable_WID ( 1)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_RxDisable_MSK (0x00000800)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_RxDisable_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_RxDisable_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_TxLong_OFF (12)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_TxLong_WID ( 1)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_TxLong_MSK (0x00001000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_TxLong_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_TxLong_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_OFF (13)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_WID ( 2)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_MSK (0x00006000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_MAX (0x00000003)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_RxReadPointer_OFF (15)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_RxReadPointer_WID ( 3)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_RxReadPointer_MSK (0x00038000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_RxReadPointer_MAX (0x00000007)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_RxReadPointer_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_OFF (18)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_WID ( 1)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_MSK (0x00040000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_OFF (19)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_WID ( 1)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_MSK (0x00080000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_ReadRFRd_OFF (20)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_ReadRFRd_WID ( 1)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_ReadRFRd_MSK (0x00100000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_ReadRFRd_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_ReadRFRd_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_ReadRFWr_OFF (21)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_ReadRFWr_WID ( 1)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_ReadRFWr_MSK (0x00200000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_ReadRFWr_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_ReadRFWr_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_ReadRFRank_OFF (22)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_ReadRFRank_WID ( 2)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_ReadRFRank_MSK (0x00C00000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_ReadRFRank_MAX (0x00000003)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_ReadRFRank_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_OFF (24)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_WID ( 1)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_MSK (0x01000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_OdtSampOff_OFF (25)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_OdtSampOff_WID ( 1)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_OdtSampOff_MSK (0x02000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_OdtSampOff_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_OdtSampOff_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_OFF (26)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_WID ( 1)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_MSK (0x04000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_OFF (27)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_WID ( 1)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_MSK (0x08000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_OFF (28)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_WID ( 1)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_MSK (0x10000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_OFF (29)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_WID ( 1)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_MSK (0x20000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_OFF (30)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_WID ( 1)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_MSK (0x40000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_OFF (31)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_WID ( 1)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_MSK (0x80000000)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_DEF (0x00000000)
+
+#define DDRDATA2CH0_CR_DDRCRVREFADJUST1_REG (0x00000478)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_OFF ( 0)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_WID ( 7)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_MSK (0x0000007F)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_MAX (0x0000007F)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_OFF ( 7)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_WID ( 7)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_MSK (0x00003F80)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_MAX (0x0000007F)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_OFF (14)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_WID ( 7)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_MSK (0x001FC000)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_MAX (0x0000007F)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_OFF (21)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_WID ( 1)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_MSK (0x00200000)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_OFF (22)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_WID ( 1)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_MSK (0x00400000)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_OFF (23)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_WID ( 1)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_MSK (0x00800000)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_OFF (24)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_WID ( 2)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_MSK (0x03000000)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_MAX (0x00000003)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_OFF (26)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_WID ( 1)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_MSK (0x04000000)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_Rsvd_OFF (27)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_Rsvd_WID ( 2)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_Rsvd_MSK (0x18000000)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_Rsvd_MAX (0x00000003)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_Rsvd_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_caSlowBW_OFF (29)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_caSlowBW_WID ( 1)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_caSlowBW_MSK (0x20000000)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_caSlowBW_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_caSlowBW_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_OFF (30)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_WID ( 1)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_MSK (0x40000000)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_DEF (0x00000000)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_OFF (31)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_WID ( 1)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_MSK (0x80000000)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_MAX (0x00000001)
+ #define DDRDATA2CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_DEF (0x00000000)
+
+#define DDRDATA2CH1_CR_RXTRAINRANK0_REG (0x00000500)
+ #define DDRDATA2CH1_CR_RXTRAINRANK0_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA2CH1_CR_RXTRAINRANK0_RxRcvEnPi_WID ( 9)
+ #define DDRDATA2CH1_CR_RXTRAINRANK0_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA2CH1_CR_RXTRAINRANK0_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA2CH1_CR_RXTRAINRANK0_RxDqsPPi_OFF ( 9)
+ #define DDRDATA2CH1_CR_RXTRAINRANK0_RxDqsPPi_WID ( 6)
+ #define DDRDATA2CH1_CR_RXTRAINRANK0_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA2CH1_CR_RXTRAINRANK0_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA2CH1_CR_RXTRAINRANK0_RxEq_OFF (15)
+ #define DDRDATA2CH1_CR_RXTRAINRANK0_RxEq_WID ( 5)
+ #define DDRDATA2CH1_CR_RXTRAINRANK0_RxEq_MSK (0x000F8000)
+ #define DDRDATA2CH1_CR_RXTRAINRANK0_RxEq_MAX (0x0000001F)
+ #define DDRDATA2CH1_CR_RXTRAINRANK0_RxDqsNPi_OFF (20)
+ #define DDRDATA2CH1_CR_RXTRAINRANK0_RxDqsNPi_WID ( 6)
+ #define DDRDATA2CH1_CR_RXTRAINRANK0_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA2CH1_CR_RXTRAINRANK0_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA2CH1_CR_RXTRAINRANK0_RxVref_OFF (26)
+ #define DDRDATA2CH1_CR_RXTRAINRANK0_RxVref_WID ( 6)
+ #define DDRDATA2CH1_CR_RXTRAINRANK0_RxVref_MSK (0xFC000000)
+ #define DDRDATA2CH1_CR_RXTRAINRANK0_RxVref_MAX (0x0000003F)
+
+#define DDRDATA2CH1_CR_RXTRAINRANK1_REG (0x00000504)
+ #define DDRDATA2CH1_CR_RXTRAINRANK1_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA2CH1_CR_RXTRAINRANK1_RxRcvEnPi_WID ( 9)
+ #define DDRDATA2CH1_CR_RXTRAINRANK1_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA2CH1_CR_RXTRAINRANK1_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA2CH1_CR_RXTRAINRANK1_RxDqsPPi_OFF ( 9)
+ #define DDRDATA2CH1_CR_RXTRAINRANK1_RxDqsPPi_WID ( 6)
+ #define DDRDATA2CH1_CR_RXTRAINRANK1_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA2CH1_CR_RXTRAINRANK1_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA2CH1_CR_RXTRAINRANK1_RxEq_OFF (15)
+ #define DDRDATA2CH1_CR_RXTRAINRANK1_RxEq_WID ( 5)
+ #define DDRDATA2CH1_CR_RXTRAINRANK1_RxEq_MSK (0x000F8000)
+ #define DDRDATA2CH1_CR_RXTRAINRANK1_RxEq_MAX (0x0000001F)
+ #define DDRDATA2CH1_CR_RXTRAINRANK1_RxDqsNPi_OFF (20)
+ #define DDRDATA2CH1_CR_RXTRAINRANK1_RxDqsNPi_WID ( 6)
+ #define DDRDATA2CH1_CR_RXTRAINRANK1_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA2CH1_CR_RXTRAINRANK1_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA2CH1_CR_RXTRAINRANK1_RxVref_OFF (26)
+ #define DDRDATA2CH1_CR_RXTRAINRANK1_RxVref_WID ( 6)
+ #define DDRDATA2CH1_CR_RXTRAINRANK1_RxVref_MSK (0xFC000000)
+ #define DDRDATA2CH1_CR_RXTRAINRANK1_RxVref_MAX (0x0000003F)
+
+#define DDRDATA2CH1_CR_RXTRAINRANK2_REG (0x00000508)
+ #define DDRDATA2CH1_CR_RXTRAINRANK2_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA2CH1_CR_RXTRAINRANK2_RxRcvEnPi_WID ( 9)
+ #define DDRDATA2CH1_CR_RXTRAINRANK2_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA2CH1_CR_RXTRAINRANK2_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA2CH1_CR_RXTRAINRANK2_RxDqsPPi_OFF ( 9)
+ #define DDRDATA2CH1_CR_RXTRAINRANK2_RxDqsPPi_WID ( 6)
+ #define DDRDATA2CH1_CR_RXTRAINRANK2_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA2CH1_CR_RXTRAINRANK2_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA2CH1_CR_RXTRAINRANK2_RxEq_OFF (15)
+ #define DDRDATA2CH1_CR_RXTRAINRANK2_RxEq_WID ( 5)
+ #define DDRDATA2CH1_CR_RXTRAINRANK2_RxEq_MSK (0x000F8000)
+ #define DDRDATA2CH1_CR_RXTRAINRANK2_RxEq_MAX (0x0000001F)
+ #define DDRDATA2CH1_CR_RXTRAINRANK2_RxDqsNPi_OFF (20)
+ #define DDRDATA2CH1_CR_RXTRAINRANK2_RxDqsNPi_WID ( 6)
+ #define DDRDATA2CH1_CR_RXTRAINRANK2_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA2CH1_CR_RXTRAINRANK2_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA2CH1_CR_RXTRAINRANK2_RxVref_OFF (26)
+ #define DDRDATA2CH1_CR_RXTRAINRANK2_RxVref_WID ( 6)
+ #define DDRDATA2CH1_CR_RXTRAINRANK2_RxVref_MSK (0xFC000000)
+ #define DDRDATA2CH1_CR_RXTRAINRANK2_RxVref_MAX (0x0000003F)
+
+#define DDRDATA2CH1_CR_RXTRAINRANK3_REG (0x0000050C)
+ #define DDRDATA2CH1_CR_RXTRAINRANK3_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA2CH1_CR_RXTRAINRANK3_RxRcvEnPi_WID ( 9)
+ #define DDRDATA2CH1_CR_RXTRAINRANK3_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA2CH1_CR_RXTRAINRANK3_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA2CH1_CR_RXTRAINRANK3_RxDqsPPi_OFF ( 9)
+ #define DDRDATA2CH1_CR_RXTRAINRANK3_RxDqsPPi_WID ( 6)
+ #define DDRDATA2CH1_CR_RXTRAINRANK3_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA2CH1_CR_RXTRAINRANK3_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA2CH1_CR_RXTRAINRANK3_RxEq_OFF (15)
+ #define DDRDATA2CH1_CR_RXTRAINRANK3_RxEq_WID ( 5)
+ #define DDRDATA2CH1_CR_RXTRAINRANK3_RxEq_MSK (0x000F8000)
+ #define DDRDATA2CH1_CR_RXTRAINRANK3_RxEq_MAX (0x0000001F)
+ #define DDRDATA2CH1_CR_RXTRAINRANK3_RxDqsNPi_OFF (20)
+ #define DDRDATA2CH1_CR_RXTRAINRANK3_RxDqsNPi_WID ( 6)
+ #define DDRDATA2CH1_CR_RXTRAINRANK3_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA2CH1_CR_RXTRAINRANK3_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA2CH1_CR_RXTRAINRANK3_RxVref_OFF (26)
+ #define DDRDATA2CH1_CR_RXTRAINRANK3_RxVref_WID ( 6)
+ #define DDRDATA2CH1_CR_RXTRAINRANK3_RxVref_MSK (0xFC000000)
+ #define DDRDATA2CH1_CR_RXTRAINRANK3_RxVref_MAX (0x0000003F)
+
+#define DDRDATA2CH1_CR_RXPERBITRANK0_REG (0x00000510)
+ #define DDRDATA2CH1_CR_RXPERBITRANK0_Lane0_OFF ( 0)
+ #define DDRDATA2CH1_CR_RXPERBITRANK0_Lane0_WID ( 4)
+ #define DDRDATA2CH1_CR_RXPERBITRANK0_Lane0_MSK (0x0000000F)
+ #define DDRDATA2CH1_CR_RXPERBITRANK0_Lane0_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_RXPERBITRANK0_Lane1_OFF ( 4)
+ #define DDRDATA2CH1_CR_RXPERBITRANK0_Lane1_WID ( 4)
+ #define DDRDATA2CH1_CR_RXPERBITRANK0_Lane1_MSK (0x000000F0)
+ #define DDRDATA2CH1_CR_RXPERBITRANK0_Lane1_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_RXPERBITRANK0_Lane2_OFF ( 8)
+ #define DDRDATA2CH1_CR_RXPERBITRANK0_Lane2_WID ( 4)
+ #define DDRDATA2CH1_CR_RXPERBITRANK0_Lane2_MSK (0x00000F00)
+ #define DDRDATA2CH1_CR_RXPERBITRANK0_Lane2_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_RXPERBITRANK0_Lane3_OFF (12)
+ #define DDRDATA2CH1_CR_RXPERBITRANK0_Lane3_WID ( 4)
+ #define DDRDATA2CH1_CR_RXPERBITRANK0_Lane3_MSK (0x0000F000)
+ #define DDRDATA2CH1_CR_RXPERBITRANK0_Lane3_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_RXPERBITRANK0_Lane4_OFF (16)
+ #define DDRDATA2CH1_CR_RXPERBITRANK0_Lane4_WID ( 4)
+ #define DDRDATA2CH1_CR_RXPERBITRANK0_Lane4_MSK (0x000F0000)
+ #define DDRDATA2CH1_CR_RXPERBITRANK0_Lane4_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_RXPERBITRANK0_Lane5_OFF (20)
+ #define DDRDATA2CH1_CR_RXPERBITRANK0_Lane5_WID ( 4)
+ #define DDRDATA2CH1_CR_RXPERBITRANK0_Lane5_MSK (0x00F00000)
+ #define DDRDATA2CH1_CR_RXPERBITRANK0_Lane5_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_RXPERBITRANK0_Lane6_OFF (24)
+ #define DDRDATA2CH1_CR_RXPERBITRANK0_Lane6_WID ( 4)
+ #define DDRDATA2CH1_CR_RXPERBITRANK0_Lane6_MSK (0x0F000000)
+ #define DDRDATA2CH1_CR_RXPERBITRANK0_Lane6_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_RXPERBITRANK0_Lane7_OFF (28)
+ #define DDRDATA2CH1_CR_RXPERBITRANK0_Lane7_WID ( 4)
+ #define DDRDATA2CH1_CR_RXPERBITRANK0_Lane7_MSK (0xF0000000)
+ #define DDRDATA2CH1_CR_RXPERBITRANK0_Lane7_MAX (0x0000000F)
+
+#define DDRDATA2CH1_CR_RXPERBITRANK1_REG (0x00000514)
+ #define DDRDATA2CH1_CR_RXPERBITRANK1_Lane0_OFF ( 0)
+ #define DDRDATA2CH1_CR_RXPERBITRANK1_Lane0_WID ( 4)
+ #define DDRDATA2CH1_CR_RXPERBITRANK1_Lane0_MSK (0x0000000F)
+ #define DDRDATA2CH1_CR_RXPERBITRANK1_Lane0_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_RXPERBITRANK1_Lane1_OFF ( 4)
+ #define DDRDATA2CH1_CR_RXPERBITRANK1_Lane1_WID ( 4)
+ #define DDRDATA2CH1_CR_RXPERBITRANK1_Lane1_MSK (0x000000F0)
+ #define DDRDATA2CH1_CR_RXPERBITRANK1_Lane1_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_RXPERBITRANK1_Lane2_OFF ( 8)
+ #define DDRDATA2CH1_CR_RXPERBITRANK1_Lane2_WID ( 4)
+ #define DDRDATA2CH1_CR_RXPERBITRANK1_Lane2_MSK (0x00000F00)
+ #define DDRDATA2CH1_CR_RXPERBITRANK1_Lane2_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_RXPERBITRANK1_Lane3_OFF (12)
+ #define DDRDATA2CH1_CR_RXPERBITRANK1_Lane3_WID ( 4)
+ #define DDRDATA2CH1_CR_RXPERBITRANK1_Lane3_MSK (0x0000F000)
+ #define DDRDATA2CH1_CR_RXPERBITRANK1_Lane3_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_RXPERBITRANK1_Lane4_OFF (16)
+ #define DDRDATA2CH1_CR_RXPERBITRANK1_Lane4_WID ( 4)
+ #define DDRDATA2CH1_CR_RXPERBITRANK1_Lane4_MSK (0x000F0000)
+ #define DDRDATA2CH1_CR_RXPERBITRANK1_Lane4_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_RXPERBITRANK1_Lane5_OFF (20)
+ #define DDRDATA2CH1_CR_RXPERBITRANK1_Lane5_WID ( 4)
+ #define DDRDATA2CH1_CR_RXPERBITRANK1_Lane5_MSK (0x00F00000)
+ #define DDRDATA2CH1_CR_RXPERBITRANK1_Lane5_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_RXPERBITRANK1_Lane6_OFF (24)
+ #define DDRDATA2CH1_CR_RXPERBITRANK1_Lane6_WID ( 4)
+ #define DDRDATA2CH1_CR_RXPERBITRANK1_Lane6_MSK (0x0F000000)
+ #define DDRDATA2CH1_CR_RXPERBITRANK1_Lane6_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_RXPERBITRANK1_Lane7_OFF (28)
+ #define DDRDATA2CH1_CR_RXPERBITRANK1_Lane7_WID ( 4)
+ #define DDRDATA2CH1_CR_RXPERBITRANK1_Lane7_MSK (0xF0000000)
+ #define DDRDATA2CH1_CR_RXPERBITRANK1_Lane7_MAX (0x0000000F)
+
+#define DDRDATA2CH1_CR_RXPERBITRANK2_REG (0x00000518)
+ #define DDRDATA2CH1_CR_RXPERBITRANK2_Lane0_OFF ( 0)
+ #define DDRDATA2CH1_CR_RXPERBITRANK2_Lane0_WID ( 4)
+ #define DDRDATA2CH1_CR_RXPERBITRANK2_Lane0_MSK (0x0000000F)
+ #define DDRDATA2CH1_CR_RXPERBITRANK2_Lane0_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_RXPERBITRANK2_Lane1_OFF ( 4)
+ #define DDRDATA2CH1_CR_RXPERBITRANK2_Lane1_WID ( 4)
+ #define DDRDATA2CH1_CR_RXPERBITRANK2_Lane1_MSK (0x000000F0)
+ #define DDRDATA2CH1_CR_RXPERBITRANK2_Lane1_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_RXPERBITRANK2_Lane2_OFF ( 8)
+ #define DDRDATA2CH1_CR_RXPERBITRANK2_Lane2_WID ( 4)
+ #define DDRDATA2CH1_CR_RXPERBITRANK2_Lane2_MSK (0x00000F00)
+ #define DDRDATA2CH1_CR_RXPERBITRANK2_Lane2_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_RXPERBITRANK2_Lane3_OFF (12)
+ #define DDRDATA2CH1_CR_RXPERBITRANK2_Lane3_WID ( 4)
+ #define DDRDATA2CH1_CR_RXPERBITRANK2_Lane3_MSK (0x0000F000)
+ #define DDRDATA2CH1_CR_RXPERBITRANK2_Lane3_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_RXPERBITRANK2_Lane4_OFF (16)
+ #define DDRDATA2CH1_CR_RXPERBITRANK2_Lane4_WID ( 4)
+ #define DDRDATA2CH1_CR_RXPERBITRANK2_Lane4_MSK (0x000F0000)
+ #define DDRDATA2CH1_CR_RXPERBITRANK2_Lane4_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_RXPERBITRANK2_Lane5_OFF (20)
+ #define DDRDATA2CH1_CR_RXPERBITRANK2_Lane5_WID ( 4)
+ #define DDRDATA2CH1_CR_RXPERBITRANK2_Lane5_MSK (0x00F00000)
+ #define DDRDATA2CH1_CR_RXPERBITRANK2_Lane5_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_RXPERBITRANK2_Lane6_OFF (24)
+ #define DDRDATA2CH1_CR_RXPERBITRANK2_Lane6_WID ( 4)
+ #define DDRDATA2CH1_CR_RXPERBITRANK2_Lane6_MSK (0x0F000000)
+ #define DDRDATA2CH1_CR_RXPERBITRANK2_Lane6_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_RXPERBITRANK2_Lane7_OFF (28)
+ #define DDRDATA2CH1_CR_RXPERBITRANK2_Lane7_WID ( 4)
+ #define DDRDATA2CH1_CR_RXPERBITRANK2_Lane7_MSK (0xF0000000)
+ #define DDRDATA2CH1_CR_RXPERBITRANK2_Lane7_MAX (0x0000000F)
+
+#define DDRDATA2CH1_CR_RXPERBITRANK3_REG (0x0000051C)
+ #define DDRDATA2CH1_CR_RXPERBITRANK3_Lane0_OFF ( 0)
+ #define DDRDATA2CH1_CR_RXPERBITRANK3_Lane0_WID ( 4)
+ #define DDRDATA2CH1_CR_RXPERBITRANK3_Lane0_MSK (0x0000000F)
+ #define DDRDATA2CH1_CR_RXPERBITRANK3_Lane0_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_RXPERBITRANK3_Lane1_OFF ( 4)
+ #define DDRDATA2CH1_CR_RXPERBITRANK3_Lane1_WID ( 4)
+ #define DDRDATA2CH1_CR_RXPERBITRANK3_Lane1_MSK (0x000000F0)
+ #define DDRDATA2CH1_CR_RXPERBITRANK3_Lane1_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_RXPERBITRANK3_Lane2_OFF ( 8)
+ #define DDRDATA2CH1_CR_RXPERBITRANK3_Lane2_WID ( 4)
+ #define DDRDATA2CH1_CR_RXPERBITRANK3_Lane2_MSK (0x00000F00)
+ #define DDRDATA2CH1_CR_RXPERBITRANK3_Lane2_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_RXPERBITRANK3_Lane3_OFF (12)
+ #define DDRDATA2CH1_CR_RXPERBITRANK3_Lane3_WID ( 4)
+ #define DDRDATA2CH1_CR_RXPERBITRANK3_Lane3_MSK (0x0000F000)
+ #define DDRDATA2CH1_CR_RXPERBITRANK3_Lane3_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_RXPERBITRANK3_Lane4_OFF (16)
+ #define DDRDATA2CH1_CR_RXPERBITRANK3_Lane4_WID ( 4)
+ #define DDRDATA2CH1_CR_RXPERBITRANK3_Lane4_MSK (0x000F0000)
+ #define DDRDATA2CH1_CR_RXPERBITRANK3_Lane4_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_RXPERBITRANK3_Lane5_OFF (20)
+ #define DDRDATA2CH1_CR_RXPERBITRANK3_Lane5_WID ( 4)
+ #define DDRDATA2CH1_CR_RXPERBITRANK3_Lane5_MSK (0x00F00000)
+ #define DDRDATA2CH1_CR_RXPERBITRANK3_Lane5_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_RXPERBITRANK3_Lane6_OFF (24)
+ #define DDRDATA2CH1_CR_RXPERBITRANK3_Lane6_WID ( 4)
+ #define DDRDATA2CH1_CR_RXPERBITRANK3_Lane6_MSK (0x0F000000)
+ #define DDRDATA2CH1_CR_RXPERBITRANK3_Lane6_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_RXPERBITRANK3_Lane7_OFF (28)
+ #define DDRDATA2CH1_CR_RXPERBITRANK3_Lane7_WID ( 4)
+ #define DDRDATA2CH1_CR_RXPERBITRANK3_Lane7_MSK (0xF0000000)
+ #define DDRDATA2CH1_CR_RXPERBITRANK3_Lane7_MAX (0x0000000F)
+
+#define DDRDATA2CH1_CR_TXTRAINRANK0_REG (0x00000520)
+ #define DDRDATA2CH1_CR_TXTRAINRANK0_TxDqDelay_OFF ( 0)
+ #define DDRDATA2CH1_CR_TXTRAINRANK0_TxDqDelay_WID ( 9)
+ #define DDRDATA2CH1_CR_TXTRAINRANK0_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA2CH1_CR_TXTRAINRANK0_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA2CH1_CR_TXTRAINRANK0_TxDqsDelay_OFF ( 9)
+ #define DDRDATA2CH1_CR_TXTRAINRANK0_TxDqsDelay_WID ( 9)
+ #define DDRDATA2CH1_CR_TXTRAINRANK0_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA2CH1_CR_TXTRAINRANK0_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA2CH1_CR_TXTRAINRANK0_Spare0_OFF (18)
+ #define DDRDATA2CH1_CR_TXTRAINRANK0_Spare0_WID ( 2)
+ #define DDRDATA2CH1_CR_TXTRAINRANK0_Spare0_MSK (0x000C0000)
+ #define DDRDATA2CH1_CR_TXTRAINRANK0_Spare0_MAX (0x00000003)
+ #define DDRDATA2CH1_CR_TXTRAINRANK0_TxEqualization_OFF (20)
+ #define DDRDATA2CH1_CR_TXTRAINRANK0_TxEqualization_WID ( 6)
+ #define DDRDATA2CH1_CR_TXTRAINRANK0_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA2CH1_CR_TXTRAINRANK0_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA2CH1_CR_TXTRAINRANK0_Spare1_OFF (26)
+ #define DDRDATA2CH1_CR_TXTRAINRANK0_Spare1_WID ( 6)
+ #define DDRDATA2CH1_CR_TXTRAINRANK0_Spare1_MSK (0xFC000000)
+ #define DDRDATA2CH1_CR_TXTRAINRANK0_Spare1_MAX (0x0000003F)
+
+#define DDRDATA2CH1_CR_TXTRAINRANK1_REG (0x00000524)
+ #define DDRDATA2CH1_CR_TXTRAINRANK1_TxDqDelay_OFF ( 0)
+ #define DDRDATA2CH1_CR_TXTRAINRANK1_TxDqDelay_WID ( 9)
+ #define DDRDATA2CH1_CR_TXTRAINRANK1_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA2CH1_CR_TXTRAINRANK1_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA2CH1_CR_TXTRAINRANK1_TxDqsDelay_OFF ( 9)
+ #define DDRDATA2CH1_CR_TXTRAINRANK1_TxDqsDelay_WID ( 9)
+ #define DDRDATA2CH1_CR_TXTRAINRANK1_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA2CH1_CR_TXTRAINRANK1_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA2CH1_CR_TXTRAINRANK1_Spare0_OFF (18)
+ #define DDRDATA2CH1_CR_TXTRAINRANK1_Spare0_WID ( 2)
+ #define DDRDATA2CH1_CR_TXTRAINRANK1_Spare0_MSK (0x000C0000)
+ #define DDRDATA2CH1_CR_TXTRAINRANK1_Spare0_MAX (0x00000003)
+ #define DDRDATA2CH1_CR_TXTRAINRANK1_TxEqualization_OFF (20)
+ #define DDRDATA2CH1_CR_TXTRAINRANK1_TxEqualization_WID ( 6)
+ #define DDRDATA2CH1_CR_TXTRAINRANK1_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA2CH1_CR_TXTRAINRANK1_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA2CH1_CR_TXTRAINRANK1_Spare1_OFF (26)
+ #define DDRDATA2CH1_CR_TXTRAINRANK1_Spare1_WID ( 6)
+ #define DDRDATA2CH1_CR_TXTRAINRANK1_Spare1_MSK (0xFC000000)
+ #define DDRDATA2CH1_CR_TXTRAINRANK1_Spare1_MAX (0x0000003F)
+
+#define DDRDATA2CH1_CR_TXTRAINRANK2_REG (0x00000528)
+ #define DDRDATA2CH1_CR_TXTRAINRANK2_TxDqDelay_OFF ( 0)
+ #define DDRDATA2CH1_CR_TXTRAINRANK2_TxDqDelay_WID ( 9)
+ #define DDRDATA2CH1_CR_TXTRAINRANK2_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA2CH1_CR_TXTRAINRANK2_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA2CH1_CR_TXTRAINRANK2_TxDqsDelay_OFF ( 9)
+ #define DDRDATA2CH1_CR_TXTRAINRANK2_TxDqsDelay_WID ( 9)
+ #define DDRDATA2CH1_CR_TXTRAINRANK2_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA2CH1_CR_TXTRAINRANK2_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA2CH1_CR_TXTRAINRANK2_Spare0_OFF (18)
+ #define DDRDATA2CH1_CR_TXTRAINRANK2_Spare0_WID ( 2)
+ #define DDRDATA2CH1_CR_TXTRAINRANK2_Spare0_MSK (0x000C0000)
+ #define DDRDATA2CH1_CR_TXTRAINRANK2_Spare0_MAX (0x00000003)
+ #define DDRDATA2CH1_CR_TXTRAINRANK2_TxEqualization_OFF (20)
+ #define DDRDATA2CH1_CR_TXTRAINRANK2_TxEqualization_WID ( 6)
+ #define DDRDATA2CH1_CR_TXTRAINRANK2_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA2CH1_CR_TXTRAINRANK2_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA2CH1_CR_TXTRAINRANK2_Spare1_OFF (26)
+ #define DDRDATA2CH1_CR_TXTRAINRANK2_Spare1_WID ( 6)
+ #define DDRDATA2CH1_CR_TXTRAINRANK2_Spare1_MSK (0xFC000000)
+ #define DDRDATA2CH1_CR_TXTRAINRANK2_Spare1_MAX (0x0000003F)
+
+#define DDRDATA2CH1_CR_TXTRAINRANK3_REG (0x0000052C)
+ #define DDRDATA2CH1_CR_TXTRAINRANK3_TxDqDelay_OFF ( 0)
+ #define DDRDATA2CH1_CR_TXTRAINRANK3_TxDqDelay_WID ( 9)
+ #define DDRDATA2CH1_CR_TXTRAINRANK3_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA2CH1_CR_TXTRAINRANK3_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA2CH1_CR_TXTRAINRANK3_TxDqsDelay_OFF ( 9)
+ #define DDRDATA2CH1_CR_TXTRAINRANK3_TxDqsDelay_WID ( 9)
+ #define DDRDATA2CH1_CR_TXTRAINRANK3_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA2CH1_CR_TXTRAINRANK3_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA2CH1_CR_TXTRAINRANK3_Spare0_OFF (18)
+ #define DDRDATA2CH1_CR_TXTRAINRANK3_Spare0_WID ( 2)
+ #define DDRDATA2CH1_CR_TXTRAINRANK3_Spare0_MSK (0x000C0000)
+ #define DDRDATA2CH1_CR_TXTRAINRANK3_Spare0_MAX (0x00000003)
+ #define DDRDATA2CH1_CR_TXTRAINRANK3_TxEqualization_OFF (20)
+ #define DDRDATA2CH1_CR_TXTRAINRANK3_TxEqualization_WID ( 6)
+ #define DDRDATA2CH1_CR_TXTRAINRANK3_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA2CH1_CR_TXTRAINRANK3_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA2CH1_CR_TXTRAINRANK3_Spare1_OFF (26)
+ #define DDRDATA2CH1_CR_TXTRAINRANK3_Spare1_WID ( 6)
+ #define DDRDATA2CH1_CR_TXTRAINRANK3_Spare1_MSK (0xFC000000)
+ #define DDRDATA2CH1_CR_TXTRAINRANK3_Spare1_MAX (0x0000003F)
+
+#define DDRDATA2CH1_CR_TXPERBITRANK0_REG (0x00000530)
+ #define DDRDATA2CH1_CR_TXPERBITRANK0_Lane0_OFF ( 0)
+ #define DDRDATA2CH1_CR_TXPERBITRANK0_Lane0_WID ( 4)
+ #define DDRDATA2CH1_CR_TXPERBITRANK0_Lane0_MSK (0x0000000F)
+ #define DDRDATA2CH1_CR_TXPERBITRANK0_Lane0_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_TXPERBITRANK0_Lane1_OFF ( 4)
+ #define DDRDATA2CH1_CR_TXPERBITRANK0_Lane1_WID ( 4)
+ #define DDRDATA2CH1_CR_TXPERBITRANK0_Lane1_MSK (0x000000F0)
+ #define DDRDATA2CH1_CR_TXPERBITRANK0_Lane1_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_TXPERBITRANK0_Lane2_OFF ( 8)
+ #define DDRDATA2CH1_CR_TXPERBITRANK0_Lane2_WID ( 4)
+ #define DDRDATA2CH1_CR_TXPERBITRANK0_Lane2_MSK (0x00000F00)
+ #define DDRDATA2CH1_CR_TXPERBITRANK0_Lane2_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_TXPERBITRANK0_Lane3_OFF (12)
+ #define DDRDATA2CH1_CR_TXPERBITRANK0_Lane3_WID ( 4)
+ #define DDRDATA2CH1_CR_TXPERBITRANK0_Lane3_MSK (0x0000F000)
+ #define DDRDATA2CH1_CR_TXPERBITRANK0_Lane3_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_TXPERBITRANK0_Lane4_OFF (16)
+ #define DDRDATA2CH1_CR_TXPERBITRANK0_Lane4_WID ( 4)
+ #define DDRDATA2CH1_CR_TXPERBITRANK0_Lane4_MSK (0x000F0000)
+ #define DDRDATA2CH1_CR_TXPERBITRANK0_Lane4_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_TXPERBITRANK0_Lane5_OFF (20)
+ #define DDRDATA2CH1_CR_TXPERBITRANK0_Lane5_WID ( 4)
+ #define DDRDATA2CH1_CR_TXPERBITRANK0_Lane5_MSK (0x00F00000)
+ #define DDRDATA2CH1_CR_TXPERBITRANK0_Lane5_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_TXPERBITRANK0_Lane6_OFF (24)
+ #define DDRDATA2CH1_CR_TXPERBITRANK0_Lane6_WID ( 4)
+ #define DDRDATA2CH1_CR_TXPERBITRANK0_Lane6_MSK (0x0F000000)
+ #define DDRDATA2CH1_CR_TXPERBITRANK0_Lane6_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_TXPERBITRANK0_Lane7_OFF (28)
+ #define DDRDATA2CH1_CR_TXPERBITRANK0_Lane7_WID ( 4)
+ #define DDRDATA2CH1_CR_TXPERBITRANK0_Lane7_MSK (0xF0000000)
+ #define DDRDATA2CH1_CR_TXPERBITRANK0_Lane7_MAX (0x0000000F)
+
+#define DDRDATA2CH1_CR_TXPERBITRANK1_REG (0x00000534)
+ #define DDRDATA2CH1_CR_TXPERBITRANK1_Lane0_OFF ( 0)
+ #define DDRDATA2CH1_CR_TXPERBITRANK1_Lane0_WID ( 4)
+ #define DDRDATA2CH1_CR_TXPERBITRANK1_Lane0_MSK (0x0000000F)
+ #define DDRDATA2CH1_CR_TXPERBITRANK1_Lane0_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_TXPERBITRANK1_Lane1_OFF ( 4)
+ #define DDRDATA2CH1_CR_TXPERBITRANK1_Lane1_WID ( 4)
+ #define DDRDATA2CH1_CR_TXPERBITRANK1_Lane1_MSK (0x000000F0)
+ #define DDRDATA2CH1_CR_TXPERBITRANK1_Lane1_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_TXPERBITRANK1_Lane2_OFF ( 8)
+ #define DDRDATA2CH1_CR_TXPERBITRANK1_Lane2_WID ( 4)
+ #define DDRDATA2CH1_CR_TXPERBITRANK1_Lane2_MSK (0x00000F00)
+ #define DDRDATA2CH1_CR_TXPERBITRANK1_Lane2_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_TXPERBITRANK1_Lane3_OFF (12)
+ #define DDRDATA2CH1_CR_TXPERBITRANK1_Lane3_WID ( 4)
+ #define DDRDATA2CH1_CR_TXPERBITRANK1_Lane3_MSK (0x0000F000)
+ #define DDRDATA2CH1_CR_TXPERBITRANK1_Lane3_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_TXPERBITRANK1_Lane4_OFF (16)
+ #define DDRDATA2CH1_CR_TXPERBITRANK1_Lane4_WID ( 4)
+ #define DDRDATA2CH1_CR_TXPERBITRANK1_Lane4_MSK (0x000F0000)
+ #define DDRDATA2CH1_CR_TXPERBITRANK1_Lane4_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_TXPERBITRANK1_Lane5_OFF (20)
+ #define DDRDATA2CH1_CR_TXPERBITRANK1_Lane5_WID ( 4)
+ #define DDRDATA2CH1_CR_TXPERBITRANK1_Lane5_MSK (0x00F00000)
+ #define DDRDATA2CH1_CR_TXPERBITRANK1_Lane5_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_TXPERBITRANK1_Lane6_OFF (24)
+ #define DDRDATA2CH1_CR_TXPERBITRANK1_Lane6_WID ( 4)
+ #define DDRDATA2CH1_CR_TXPERBITRANK1_Lane6_MSK (0x0F000000)
+ #define DDRDATA2CH1_CR_TXPERBITRANK1_Lane6_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_TXPERBITRANK1_Lane7_OFF (28)
+ #define DDRDATA2CH1_CR_TXPERBITRANK1_Lane7_WID ( 4)
+ #define DDRDATA2CH1_CR_TXPERBITRANK1_Lane7_MSK (0xF0000000)
+ #define DDRDATA2CH1_CR_TXPERBITRANK1_Lane7_MAX (0x0000000F)
+
+#define DDRDATA2CH1_CR_TXPERBITRANK2_REG (0x00000538)
+ #define DDRDATA2CH1_CR_TXPERBITRANK2_Lane0_OFF ( 0)
+ #define DDRDATA2CH1_CR_TXPERBITRANK2_Lane0_WID ( 4)
+ #define DDRDATA2CH1_CR_TXPERBITRANK2_Lane0_MSK (0x0000000F)
+ #define DDRDATA2CH1_CR_TXPERBITRANK2_Lane0_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_TXPERBITRANK2_Lane1_OFF ( 4)
+ #define DDRDATA2CH1_CR_TXPERBITRANK2_Lane1_WID ( 4)
+ #define DDRDATA2CH1_CR_TXPERBITRANK2_Lane1_MSK (0x000000F0)
+ #define DDRDATA2CH1_CR_TXPERBITRANK2_Lane1_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_TXPERBITRANK2_Lane2_OFF ( 8)
+ #define DDRDATA2CH1_CR_TXPERBITRANK2_Lane2_WID ( 4)
+ #define DDRDATA2CH1_CR_TXPERBITRANK2_Lane2_MSK (0x00000F00)
+ #define DDRDATA2CH1_CR_TXPERBITRANK2_Lane2_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_TXPERBITRANK2_Lane3_OFF (12)
+ #define DDRDATA2CH1_CR_TXPERBITRANK2_Lane3_WID ( 4)
+ #define DDRDATA2CH1_CR_TXPERBITRANK2_Lane3_MSK (0x0000F000)
+ #define DDRDATA2CH1_CR_TXPERBITRANK2_Lane3_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_TXPERBITRANK2_Lane4_OFF (16)
+ #define DDRDATA2CH1_CR_TXPERBITRANK2_Lane4_WID ( 4)
+ #define DDRDATA2CH1_CR_TXPERBITRANK2_Lane4_MSK (0x000F0000)
+ #define DDRDATA2CH1_CR_TXPERBITRANK2_Lane4_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_TXPERBITRANK2_Lane5_OFF (20)
+ #define DDRDATA2CH1_CR_TXPERBITRANK2_Lane5_WID ( 4)
+ #define DDRDATA2CH1_CR_TXPERBITRANK2_Lane5_MSK (0x00F00000)
+ #define DDRDATA2CH1_CR_TXPERBITRANK2_Lane5_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_TXPERBITRANK2_Lane6_OFF (24)
+ #define DDRDATA2CH1_CR_TXPERBITRANK2_Lane6_WID ( 4)
+ #define DDRDATA2CH1_CR_TXPERBITRANK2_Lane6_MSK (0x0F000000)
+ #define DDRDATA2CH1_CR_TXPERBITRANK2_Lane6_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_TXPERBITRANK2_Lane7_OFF (28)
+ #define DDRDATA2CH1_CR_TXPERBITRANK2_Lane7_WID ( 4)
+ #define DDRDATA2CH1_CR_TXPERBITRANK2_Lane7_MSK (0xF0000000)
+ #define DDRDATA2CH1_CR_TXPERBITRANK2_Lane7_MAX (0x0000000F)
+
+#define DDRDATA2CH1_CR_TXPERBITRANK3_REG (0x0000053C)
+ #define DDRDATA2CH1_CR_TXPERBITRANK3_Lane0_OFF ( 0)
+ #define DDRDATA2CH1_CR_TXPERBITRANK3_Lane0_WID ( 4)
+ #define DDRDATA2CH1_CR_TXPERBITRANK3_Lane0_MSK (0x0000000F)
+ #define DDRDATA2CH1_CR_TXPERBITRANK3_Lane0_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_TXPERBITRANK3_Lane1_OFF ( 4)
+ #define DDRDATA2CH1_CR_TXPERBITRANK3_Lane1_WID ( 4)
+ #define DDRDATA2CH1_CR_TXPERBITRANK3_Lane1_MSK (0x000000F0)
+ #define DDRDATA2CH1_CR_TXPERBITRANK3_Lane1_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_TXPERBITRANK3_Lane2_OFF ( 8)
+ #define DDRDATA2CH1_CR_TXPERBITRANK3_Lane2_WID ( 4)
+ #define DDRDATA2CH1_CR_TXPERBITRANK3_Lane2_MSK (0x00000F00)
+ #define DDRDATA2CH1_CR_TXPERBITRANK3_Lane2_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_TXPERBITRANK3_Lane3_OFF (12)
+ #define DDRDATA2CH1_CR_TXPERBITRANK3_Lane3_WID ( 4)
+ #define DDRDATA2CH1_CR_TXPERBITRANK3_Lane3_MSK (0x0000F000)
+ #define DDRDATA2CH1_CR_TXPERBITRANK3_Lane3_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_TXPERBITRANK3_Lane4_OFF (16)
+ #define DDRDATA2CH1_CR_TXPERBITRANK3_Lane4_WID ( 4)
+ #define DDRDATA2CH1_CR_TXPERBITRANK3_Lane4_MSK (0x000F0000)
+ #define DDRDATA2CH1_CR_TXPERBITRANK3_Lane4_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_TXPERBITRANK3_Lane5_OFF (20)
+ #define DDRDATA2CH1_CR_TXPERBITRANK3_Lane5_WID ( 4)
+ #define DDRDATA2CH1_CR_TXPERBITRANK3_Lane5_MSK (0x00F00000)
+ #define DDRDATA2CH1_CR_TXPERBITRANK3_Lane5_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_TXPERBITRANK3_Lane6_OFF (24)
+ #define DDRDATA2CH1_CR_TXPERBITRANK3_Lane6_WID ( 4)
+ #define DDRDATA2CH1_CR_TXPERBITRANK3_Lane6_MSK (0x0F000000)
+ #define DDRDATA2CH1_CR_TXPERBITRANK3_Lane6_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_TXPERBITRANK3_Lane7_OFF (28)
+ #define DDRDATA2CH1_CR_TXPERBITRANK3_Lane7_WID ( 4)
+ #define DDRDATA2CH1_CR_TXPERBITRANK3_Lane7_MSK (0xF0000000)
+ #define DDRDATA2CH1_CR_TXPERBITRANK3_Lane7_MAX (0x0000000F)
+
+#define DDRDATA2CH1_CR_RCOMPDATA0_REG (0x00000540)
+ #define DDRDATA2CH1_CR_RCOMPDATA0_RcompDrvUp_OFF ( 0)
+ #define DDRDATA2CH1_CR_RCOMPDATA0_RcompDrvUp_WID ( 6)
+ #define DDRDATA2CH1_CR_RCOMPDATA0_RcompDrvUp_MSK (0x0000003F)
+ #define DDRDATA2CH1_CR_RCOMPDATA0_RcompDrvUp_MAX (0x0000003F)
+ #define DDRDATA2CH1_CR_RCOMPDATA0_Spare0_OFF ( 6)
+ #define DDRDATA2CH1_CR_RCOMPDATA0_Spare0_WID ( 3)
+ #define DDRDATA2CH1_CR_RCOMPDATA0_Spare0_MSK (0x000001C0)
+ #define DDRDATA2CH1_CR_RCOMPDATA0_Spare0_MAX (0x00000007)
+ #define DDRDATA2CH1_CR_RCOMPDATA0_RcompDrvDown_OFF ( 9)
+ #define DDRDATA2CH1_CR_RCOMPDATA0_RcompDrvDown_WID ( 6)
+ #define DDRDATA2CH1_CR_RCOMPDATA0_RcompDrvDown_MSK (0x00007E00)
+ #define DDRDATA2CH1_CR_RCOMPDATA0_RcompDrvDown_MAX (0x0000003F)
+ #define DDRDATA2CH1_CR_RCOMPDATA0_VTComp_OFF (15)
+ #define DDRDATA2CH1_CR_RCOMPDATA0_VTComp_WID ( 5)
+ #define DDRDATA2CH1_CR_RCOMPDATA0_VTComp_MSK (0x000F8000)
+ #define DDRDATA2CH1_CR_RCOMPDATA0_VTComp_MAX (0x0000001F)
+ #define DDRDATA2CH1_CR_RCOMPDATA0_TcoComp_OFF (20)
+ #define DDRDATA2CH1_CR_RCOMPDATA0_TcoComp_WID ( 6)
+ #define DDRDATA2CH1_CR_RCOMPDATA0_TcoComp_MSK (0x03F00000)
+ #define DDRDATA2CH1_CR_RCOMPDATA0_TcoComp_MAX (0x0000003F)
+ #define DDRDATA2CH1_CR_RCOMPDATA0_SlewRateComp_OFF (26)
+ #define DDRDATA2CH1_CR_RCOMPDATA0_SlewRateComp_WID ( 5)
+ #define DDRDATA2CH1_CR_RCOMPDATA0_SlewRateComp_MSK (0x7C000000)
+ #define DDRDATA2CH1_CR_RCOMPDATA0_SlewRateComp_MAX (0x0000001F)
+ #define DDRDATA2CH1_CR_RCOMPDATA0_Spare2_OFF (31)
+ #define DDRDATA2CH1_CR_RCOMPDATA0_Spare2_WID ( 1)
+ #define DDRDATA2CH1_CR_RCOMPDATA0_Spare2_MSK (0x80000000)
+ #define DDRDATA2CH1_CR_RCOMPDATA0_Spare2_MAX (0x00000001)
+
+#define DDRDATA2CH1_CR_RCOMPDATA1_REG (0x00000544)
+ #define DDRDATA2CH1_CR_RCOMPDATA1_RcompOdtUp_OFF ( 0)
+ #define DDRDATA2CH1_CR_RCOMPDATA1_RcompOdtUp_WID ( 6)
+ #define DDRDATA2CH1_CR_RCOMPDATA1_RcompOdtUp_MSK (0x0000003F)
+ #define DDRDATA2CH1_CR_RCOMPDATA1_RcompOdtUp_MAX (0x0000003F)
+ #define DDRDATA2CH1_CR_RCOMPDATA1_Spare0_OFF ( 6)
+ #define DDRDATA2CH1_CR_RCOMPDATA1_Spare0_WID ( 3)
+ #define DDRDATA2CH1_CR_RCOMPDATA1_Spare0_MSK (0x000001C0)
+ #define DDRDATA2CH1_CR_RCOMPDATA1_Spare0_MAX (0x00000007)
+ #define DDRDATA2CH1_CR_RCOMPDATA1_RcompOdtDown_OFF ( 9)
+ #define DDRDATA2CH1_CR_RCOMPDATA1_RcompOdtDown_WID ( 6)
+ #define DDRDATA2CH1_CR_RCOMPDATA1_RcompOdtDown_MSK (0x00007E00)
+ #define DDRDATA2CH1_CR_RCOMPDATA1_RcompOdtDown_MAX (0x0000003F)
+ #define DDRDATA2CH1_CR_RCOMPDATA1_Spare1_OFF (15)
+ #define DDRDATA2CH1_CR_RCOMPDATA1_Spare1_WID ( 1)
+ #define DDRDATA2CH1_CR_RCOMPDATA1_Spare1_MSK (0x00008000)
+ #define DDRDATA2CH1_CR_RCOMPDATA1_Spare1_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_RCOMPDATA1_PanicDrvDn_OFF (16)
+ #define DDRDATA2CH1_CR_RCOMPDATA1_PanicDrvDn_WID ( 6)
+ #define DDRDATA2CH1_CR_RCOMPDATA1_PanicDrvDn_MSK (0x003F0000)
+ #define DDRDATA2CH1_CR_RCOMPDATA1_PanicDrvDn_MAX (0x0000003F)
+ #define DDRDATA2CH1_CR_RCOMPDATA1_PanicDrvUp_OFF (22)
+ #define DDRDATA2CH1_CR_RCOMPDATA1_PanicDrvUp_WID ( 6)
+ #define DDRDATA2CH1_CR_RCOMPDATA1_PanicDrvUp_MSK (0x0FC00000)
+ #define DDRDATA2CH1_CR_RCOMPDATA1_PanicDrvUp_MAX (0x0000003F)
+ #define DDRDATA2CH1_CR_RCOMPDATA1_LevelShifterComp_OFF (28)
+ #define DDRDATA2CH1_CR_RCOMPDATA1_LevelShifterComp_WID ( 3)
+ #define DDRDATA2CH1_CR_RCOMPDATA1_LevelShifterComp_MSK (0x70000000)
+ #define DDRDATA2CH1_CR_RCOMPDATA1_LevelShifterComp_MAX (0x00000007)
+ #define DDRDATA2CH1_CR_RCOMPDATA1_Spare2_OFF (31)
+ #define DDRDATA2CH1_CR_RCOMPDATA1_Spare2_WID ( 1)
+ #define DDRDATA2CH1_CR_RCOMPDATA1_Spare2_MSK (0x80000000)
+ #define DDRDATA2CH1_CR_RCOMPDATA1_Spare2_MAX (0x00000001)
+
+#define DDRDATA2CH1_CR_TXXTALK_REG (0x00000548)
+ #define DDRDATA2CH1_CR_TXXTALK_Lane0_OFF ( 0)
+ #define DDRDATA2CH1_CR_TXXTALK_Lane0_WID ( 4)
+ #define DDRDATA2CH1_CR_TXXTALK_Lane0_MSK (0x0000000F)
+ #define DDRDATA2CH1_CR_TXXTALK_Lane0_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_TXXTALK_Lane1_OFF ( 4)
+ #define DDRDATA2CH1_CR_TXXTALK_Lane1_WID ( 4)
+ #define DDRDATA2CH1_CR_TXXTALK_Lane1_MSK (0x000000F0)
+ #define DDRDATA2CH1_CR_TXXTALK_Lane1_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_TXXTALK_Lane2_OFF ( 8)
+ #define DDRDATA2CH1_CR_TXXTALK_Lane2_WID ( 4)
+ #define DDRDATA2CH1_CR_TXXTALK_Lane2_MSK (0x00000F00)
+ #define DDRDATA2CH1_CR_TXXTALK_Lane2_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_TXXTALK_Lane3_OFF (12)
+ #define DDRDATA2CH1_CR_TXXTALK_Lane3_WID ( 4)
+ #define DDRDATA2CH1_CR_TXXTALK_Lane3_MSK (0x0000F000)
+ #define DDRDATA2CH1_CR_TXXTALK_Lane3_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_TXXTALK_Lane4_OFF (16)
+ #define DDRDATA2CH1_CR_TXXTALK_Lane4_WID ( 4)
+ #define DDRDATA2CH1_CR_TXXTALK_Lane4_MSK (0x000F0000)
+ #define DDRDATA2CH1_CR_TXXTALK_Lane4_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_TXXTALK_Lane5_OFF (20)
+ #define DDRDATA2CH1_CR_TXXTALK_Lane5_WID ( 4)
+ #define DDRDATA2CH1_CR_TXXTALK_Lane5_MSK (0x00F00000)
+ #define DDRDATA2CH1_CR_TXXTALK_Lane5_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_TXXTALK_Lane6_OFF (24)
+ #define DDRDATA2CH1_CR_TXXTALK_Lane6_WID ( 4)
+ #define DDRDATA2CH1_CR_TXXTALK_Lane6_MSK (0x0F000000)
+ #define DDRDATA2CH1_CR_TXXTALK_Lane6_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_TXXTALK_Lane7_OFF (28)
+ #define DDRDATA2CH1_CR_TXXTALK_Lane7_WID ( 4)
+ #define DDRDATA2CH1_CR_TXXTALK_Lane7_MSK (0xF0000000)
+ #define DDRDATA2CH1_CR_TXXTALK_Lane7_MAX (0x0000000F)
+
+#define DDRDATA2CH1_CR_RXOFFSETVDQ_REG (0x0000054C)
+ #define DDRDATA2CH1_CR_RXOFFSETVDQ_Lane0_OFF ( 0)
+ #define DDRDATA2CH1_CR_RXOFFSETVDQ_Lane0_WID ( 4)
+ #define DDRDATA2CH1_CR_RXOFFSETVDQ_Lane0_MSK (0x0000000F)
+ #define DDRDATA2CH1_CR_RXOFFSETVDQ_Lane0_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_RXOFFSETVDQ_Lane1_OFF ( 4)
+ #define DDRDATA2CH1_CR_RXOFFSETVDQ_Lane1_WID ( 4)
+ #define DDRDATA2CH1_CR_RXOFFSETVDQ_Lane1_MSK (0x000000F0)
+ #define DDRDATA2CH1_CR_RXOFFSETVDQ_Lane1_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_RXOFFSETVDQ_Lane2_OFF ( 8)
+ #define DDRDATA2CH1_CR_RXOFFSETVDQ_Lane2_WID ( 4)
+ #define DDRDATA2CH1_CR_RXOFFSETVDQ_Lane2_MSK (0x00000F00)
+ #define DDRDATA2CH1_CR_RXOFFSETVDQ_Lane2_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_RXOFFSETVDQ_Lane3_OFF (12)
+ #define DDRDATA2CH1_CR_RXOFFSETVDQ_Lane3_WID ( 4)
+ #define DDRDATA2CH1_CR_RXOFFSETVDQ_Lane3_MSK (0x0000F000)
+ #define DDRDATA2CH1_CR_RXOFFSETVDQ_Lane3_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_RXOFFSETVDQ_Lane4_OFF (16)
+ #define DDRDATA2CH1_CR_RXOFFSETVDQ_Lane4_WID ( 4)
+ #define DDRDATA2CH1_CR_RXOFFSETVDQ_Lane4_MSK (0x000F0000)
+ #define DDRDATA2CH1_CR_RXOFFSETVDQ_Lane4_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_RXOFFSETVDQ_Lane5_OFF (20)
+ #define DDRDATA2CH1_CR_RXOFFSETVDQ_Lane5_WID ( 4)
+ #define DDRDATA2CH1_CR_RXOFFSETVDQ_Lane5_MSK (0x00F00000)
+ #define DDRDATA2CH1_CR_RXOFFSETVDQ_Lane5_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_RXOFFSETVDQ_Lane6_OFF (24)
+ #define DDRDATA2CH1_CR_RXOFFSETVDQ_Lane6_WID ( 4)
+ #define DDRDATA2CH1_CR_RXOFFSETVDQ_Lane6_MSK (0x0F000000)
+ #define DDRDATA2CH1_CR_RXOFFSETVDQ_Lane6_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_RXOFFSETVDQ_Lane7_OFF (28)
+ #define DDRDATA2CH1_CR_RXOFFSETVDQ_Lane7_WID ( 4)
+ #define DDRDATA2CH1_CR_RXOFFSETVDQ_Lane7_MSK (0xF0000000)
+ #define DDRDATA2CH1_CR_RXOFFSETVDQ_Lane7_MAX (0x0000000F)
+
+#define DDRDATA2CH1_CR_DDRDATARESERVED_REG (0x00000550)
+ #define DDRDATA2CH1_CR_DDRDATARESERVED_Spare_OFF ( 0)
+ #define DDRDATA2CH1_CR_DDRDATARESERVED_Spare_WID (32)
+ #define DDRDATA2CH1_CR_DDRDATARESERVED_Spare_MSK (0xFFFFFFFF)
+ #define DDRDATA2CH1_CR_DDRDATARESERVED_Spare_MAX (0xFFFFFFFF)
+
+#define DDRDATA2CH1_CR_DATATRAINFEEDBACK_REG (0x00000554)
+ #define DDRDATA2CH1_CR_DATATRAINFEEDBACK_DataTrainFeedback_OFF ( 0)
+ #define DDRDATA2CH1_CR_DATATRAINFEEDBACK_DataTrainFeedback_WID ( 9)
+ #define DDRDATA2CH1_CR_DATATRAINFEEDBACK_DataTrainFeedback_MSK (0x000001FF)
+ #define DDRDATA2CH1_CR_DATATRAINFEEDBACK_DataTrainFeedback_MAX (0x000001FF)
+ #define DDRDATA2CH1_CR_DATATRAINFEEDBACK_Spare_OFF ( 9)
+ #define DDRDATA2CH1_CR_DATATRAINFEEDBACK_Spare_WID (23)
+ #define DDRDATA2CH1_CR_DATATRAINFEEDBACK_Spare_MSK (0xFFFFFE00)
+ #define DDRDATA2CH1_CR_DATATRAINFEEDBACK_Spare_MAX (0x007FFFFF)
+
+#define DDRDATA2CH1_CR_DLLPITESTANDADC_REG (0x00000558)
+ #define DDRDATA2CH1_CR_DLLPITESTANDADC_RunTest_OFF ( 0)
+ #define DDRDATA2CH1_CR_DLLPITESTANDADC_RunTest_WID ( 1)
+ #define DDRDATA2CH1_CR_DLLPITESTANDADC_RunTest_MSK (0x00000001)
+ #define DDRDATA2CH1_CR_DLLPITESTANDADC_RunTest_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DLLPITESTANDADC_RunTest_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DLLPITESTANDADC_Load_OFF ( 1)
+ #define DDRDATA2CH1_CR_DLLPITESTANDADC_Load_WID ( 1)
+ #define DDRDATA2CH1_CR_DLLPITESTANDADC_Load_MSK (0x00000002)
+ #define DDRDATA2CH1_CR_DLLPITESTANDADC_Load_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DLLPITESTANDADC_Load_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DLLPITESTANDADC_ModeHVM_OFF ( 2)
+ #define DDRDATA2CH1_CR_DLLPITESTANDADC_ModeHVM_WID ( 1)
+ #define DDRDATA2CH1_CR_DLLPITESTANDADC_ModeHVM_MSK (0x00000004)
+ #define DDRDATA2CH1_CR_DLLPITESTANDADC_ModeHVM_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DLLPITESTANDADC_ModeHVM_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DLLPITESTANDADC_ModeDV_OFF ( 3)
+ #define DDRDATA2CH1_CR_DLLPITESTANDADC_ModeDV_WID ( 1)
+ #define DDRDATA2CH1_CR_DLLPITESTANDADC_ModeDV_MSK (0x00000008)
+ #define DDRDATA2CH1_CR_DLLPITESTANDADC_ModeDV_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DLLPITESTANDADC_ModeDV_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DLLPITESTANDADC_ModeADC_OFF ( 4)
+ #define DDRDATA2CH1_CR_DLLPITESTANDADC_ModeADC_WID ( 1)
+ #define DDRDATA2CH1_CR_DLLPITESTANDADC_ModeADC_MSK (0x00000010)
+ #define DDRDATA2CH1_CR_DLLPITESTANDADC_ModeADC_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DLLPITESTANDADC_ModeADC_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DLLPITESTANDADC_LoadCount_OFF ( 5)
+ #define DDRDATA2CH1_CR_DLLPITESTANDADC_LoadCount_WID (10)
+ #define DDRDATA2CH1_CR_DLLPITESTANDADC_LoadCount_MSK (0x00007FE0)
+ #define DDRDATA2CH1_CR_DLLPITESTANDADC_LoadCount_MAX (0x000003FF)
+ #define DDRDATA2CH1_CR_DLLPITESTANDADC_CountStatus_OFF (15)
+ #define DDRDATA2CH1_CR_DLLPITESTANDADC_CountStatus_WID (10)
+ #define DDRDATA2CH1_CR_DLLPITESTANDADC_CountStatus_MSK (0x01FF8000)
+ #define DDRDATA2CH1_CR_DLLPITESTANDADC_CountStatus_MAX (0x000003FF)
+ #define DDRDATA2CH1_CR_DLLPITESTANDADC_CountStatus_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DLLPITESTANDADC_Spare_OFF (25)
+ #define DDRDATA2CH1_CR_DLLPITESTANDADC_Spare_WID ( 7)
+ #define DDRDATA2CH1_CR_DLLPITESTANDADC_Spare_MSK (0xFE000000)
+ #define DDRDATA2CH1_CR_DLLPITESTANDADC_Spare_MAX (0x0000007F)
+
+#define DDRDATA2CH1_CR_DDRCRDATAOFFSETCOMP_REG (0x0000055C)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_OFF ( 0)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_WID ( 6)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_MSK (0x0000003F)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_MAX (0x0000003F)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_OFF ( 6)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_WID ( 6)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_MSK (0x00000FC0)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_MAX (0x0000003F)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_OFF (12)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_WID ( 5)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_MSK (0x0001F000)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_MAX (0x0000001F)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_OFF (17)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_WID ( 5)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_MSK (0x003E0000)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_MAX (0x0000001F)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_OFF (22)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_WID ( 5)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_MSK (0x07C00000)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_MAX (0x0000001F)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_OFF (27)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_WID ( 5)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_MSK (0xF8000000)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_MAX (0x0000001F)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_DEF (0x00000000)
+
+#define DDRDATA2CH1_CR_DDRCRDATACONTROL1_REG (0x00000560)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_RefPi_OFF ( 0)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_RefPi_WID ( 4)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_RefPi_MSK (0x0000000F)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_RefPi_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_RefPi_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_DllMask_OFF ( 4)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_DllMask_WID ( 2)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_DllMask_MSK (0x00000030)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_DllMask_MAX (0x00000003)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_DllMask_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_DllWeakLock_OFF ( 6)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_DllWeakLock_WID ( 1)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_DllWeakLock_MSK (0x00000040)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_DllWeakLock_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_DllWeakLock_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_OFF ( 7)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_WID ( 3)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_MSK (0x00000380)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_MAX (0x00000007)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_OFF (10)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_WID ( 3)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_MSK (0x00001C00)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_MAX (0x00000007)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_OdtDelay_OFF (13)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_OdtDelay_WID ( 4)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_OdtDelay_MSK (0x0001E000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_OdtDelay_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_OdtDelay_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_OdtDuration_OFF (17)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_OdtDuration_WID ( 3)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_OdtDuration_MSK (0x000E0000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_OdtDuration_MAX (0x00000007)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_OdtDuration_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_OFF (20)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_WID ( 4)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_MSK (0x00F00000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_OFF (24)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_WID ( 3)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_MSK (0x07000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_MAX (0x00000007)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_OFF (27)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_WID ( 3)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_MSK (0x38000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_MAX (0x00000007)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_OFF (30)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_WID ( 1)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_MSK (0x40000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_Rsvd1_OFF (31)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_Rsvd1_WID ( 1)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_Rsvd1_MSK (0x80000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_Rsvd1_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL1_Rsvd1_DEF (0x00000000)
+
+#define DDRDATA2CH1_CR_DDRCRDATACONTROL2_REG (0x00000564)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_OFF ( 0)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_WID ( 5)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_MSK (0x0000001F)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_MAX (0x0000001F)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_OFF ( 5)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_WID ( 1)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_MSK (0x00000020)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL2_ForceRxOn_OFF ( 6)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL2_ForceRxOn_WID ( 1)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL2_ForceRxOn_MSK (0x00000040)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL2_ForceRxOn_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL2_ForceRxOn_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL2_LeakerComp_OFF ( 7)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL2_LeakerComp_WID ( 2)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL2_LeakerComp_MSK (0x00000180)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL2_LeakerComp_MAX (0x00000003)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL2_LeakerComp_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_OFF ( 9)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_WID ( 4)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_MSK (0x00001E00)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_MAX (0x0000000F)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_DEF (0x00000008)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_OFF (13)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_WID ( 5)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_MSK (0x0003E000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_MAX (0x0000001F)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_DEF (0x00000011)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_OFF (18)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_WID ( 1)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_MSK (0x00040000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL2_Spare_OFF (19)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL2_Spare_WID (13)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL2_Spare_MSK (0xFFF80000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL2_Spare_MAX (0x00001FFF)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL2_Spare_DEF (0x00000000)
+
+#define DDRDATA2CH1_CR_DDRCRVSSHIORVREFCONTROL_REG (0x0000056C)
+ #define DDRDATA2CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_OFF ( 0)
+ #define DDRDATA2CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_WID (24)
+ #define DDRDATA2CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_MSK (0x00FFFFFF)
+ #define DDRDATA2CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_MAX (0x00FFFFFF)
+ #define DDRDATA2CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_OFF (24)
+ #define DDRDATA2CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_WID ( 8)
+ #define DDRDATA2CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_MSK (0xFF000000)
+ #define DDRDATA2CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_MAX (0x000000FF)
+ #define DDRDATA2CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_DEF (0x00000000)
+
+#define DDRDATA2CH1_CR_DDRCRDATAOFFSETTRAIN_REG (0x00000570)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_OFF ( 0)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_WID ( 6)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_MSK (0x0000003F)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_MAX (0x0000003F)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_OFF ( 6)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_WID ( 6)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_MSK (0x00000FC0)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_MAX (0x0000003F)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_OFF (12)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_WID ( 6)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_MSK (0x0003F000)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_MAX (0x0000003F)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_OFF (18)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_WID ( 6)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_MSK (0x00FC0000)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_MAX (0x0000003F)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_OFF (24)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_WID ( 7)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_MSK (0x7F000000)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_MAX (0x0000007F)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_OFF (31)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_WID ( 1)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_MSK (0x80000000)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_DEF (0x00000000)
+
+#define DDRDATA2CH1_CR_DDRCRDATACONTROL0_REG (0x00000574)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_OFF ( 0)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_WID ( 1)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_MSK (0x00000001)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_OFF ( 1)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_WID ( 1)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_MSK (0x00000002)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_OFF ( 2)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_WID ( 1)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_MSK (0x00000004)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_OFF ( 3)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_WID ( 1)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_MSK (0x00000008)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_TxOn_OFF ( 4)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_TxOn_WID ( 1)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_TxOn_MSK (0x00000010)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_TxOn_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_TxOn_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_RfOn_OFF ( 5)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_RfOn_WID ( 1)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_RfOn_MSK (0x00000020)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_RfOn_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_RfOn_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_RxPiOn_OFF ( 6)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_RxPiOn_WID ( 1)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_RxPiOn_MSK (0x00000040)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_RxPiOn_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_RxPiOn_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_TxPiOn_OFF ( 7)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_TxPiOn_WID ( 1)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_TxPiOn_MSK (0x00000080)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_TxPiOn_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_TxPiOn_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_OFF ( 8)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_WID ( 1)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_MSK (0x00000100)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_OFF ( 9)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_WID ( 1)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_MSK (0x00000200)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_TxDisable_OFF (10)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_TxDisable_WID ( 1)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_TxDisable_MSK (0x00000400)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_TxDisable_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_TxDisable_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_RxDisable_OFF (11)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_RxDisable_WID ( 1)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_RxDisable_MSK (0x00000800)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_RxDisable_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_RxDisable_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_TxLong_OFF (12)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_TxLong_WID ( 1)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_TxLong_MSK (0x00001000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_TxLong_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_TxLong_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_OFF (13)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_WID ( 2)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_MSK (0x00006000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_MAX (0x00000003)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_RxReadPointer_OFF (15)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_RxReadPointer_WID ( 3)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_RxReadPointer_MSK (0x00038000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_RxReadPointer_MAX (0x00000007)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_RxReadPointer_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_OFF (18)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_WID ( 1)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_MSK (0x00040000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_OFF (19)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_WID ( 1)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_MSK (0x00080000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_ReadRFRd_OFF (20)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_ReadRFRd_WID ( 1)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_ReadRFRd_MSK (0x00100000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_ReadRFRd_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_ReadRFRd_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_ReadRFWr_OFF (21)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_ReadRFWr_WID ( 1)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_ReadRFWr_MSK (0x00200000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_ReadRFWr_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_ReadRFWr_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_ReadRFRank_OFF (22)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_ReadRFRank_WID ( 2)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_ReadRFRank_MSK (0x00C00000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_ReadRFRank_MAX (0x00000003)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_ReadRFRank_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_OFF (24)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_WID ( 1)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_MSK (0x01000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_OdtSampOff_OFF (25)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_OdtSampOff_WID ( 1)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_OdtSampOff_MSK (0x02000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_OdtSampOff_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_OdtSampOff_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_OFF (26)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_WID ( 1)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_MSK (0x04000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_OFF (27)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_WID ( 1)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_MSK (0x08000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_OFF (28)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_WID ( 1)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_MSK (0x10000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_OFF (29)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_WID ( 1)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_MSK (0x20000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_OFF (30)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_WID ( 1)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_MSK (0x40000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_OFF (31)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_WID ( 1)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_MSK (0x80000000)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_DEF (0x00000000)
+
+#define DDRDATA2CH1_CR_DDRCRVREFADJUST1_REG (0x00000578)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_OFF ( 0)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_WID ( 7)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_MSK (0x0000007F)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_MAX (0x0000007F)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_OFF ( 7)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_WID ( 7)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_MSK (0x00003F80)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_MAX (0x0000007F)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_OFF (14)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_WID ( 7)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_MSK (0x001FC000)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_MAX (0x0000007F)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_OFF (21)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_WID ( 1)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_MSK (0x00200000)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_OFF (22)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_WID ( 1)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_MSK (0x00400000)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_OFF (23)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_WID ( 1)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_MSK (0x00800000)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_OFF (24)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_WID ( 2)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_MSK (0x03000000)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_MAX (0x00000003)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_OFF (26)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_WID ( 1)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_MSK (0x04000000)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_Rsvd_OFF (27)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_Rsvd_WID ( 2)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_Rsvd_MSK (0x18000000)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_Rsvd_MAX (0x00000003)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_Rsvd_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_caSlowBW_OFF (29)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_caSlowBW_WID ( 1)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_caSlowBW_MSK (0x20000000)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_caSlowBW_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_caSlowBW_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_OFF (30)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_WID ( 1)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_MSK (0x40000000)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_DEF (0x00000000)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_OFF (31)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_WID ( 1)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_MSK (0x80000000)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_MAX (0x00000001)
+ #define DDRDATA2CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_DEF (0x00000000)
+
+#define DDRDATA3CH0_CR_RXTRAINRANK0_REG (0x00000600)
+ #define DDRDATA3CH0_CR_RXTRAINRANK0_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA3CH0_CR_RXTRAINRANK0_RxRcvEnPi_WID ( 9)
+ #define DDRDATA3CH0_CR_RXTRAINRANK0_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA3CH0_CR_RXTRAINRANK0_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA3CH0_CR_RXTRAINRANK0_RxDqsPPi_OFF ( 9)
+ #define DDRDATA3CH0_CR_RXTRAINRANK0_RxDqsPPi_WID ( 6)
+ #define DDRDATA3CH0_CR_RXTRAINRANK0_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA3CH0_CR_RXTRAINRANK0_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA3CH0_CR_RXTRAINRANK0_RxEq_OFF (15)
+ #define DDRDATA3CH0_CR_RXTRAINRANK0_RxEq_WID ( 5)
+ #define DDRDATA3CH0_CR_RXTRAINRANK0_RxEq_MSK (0x000F8000)
+ #define DDRDATA3CH0_CR_RXTRAINRANK0_RxEq_MAX (0x0000001F)
+ #define DDRDATA3CH0_CR_RXTRAINRANK0_RxDqsNPi_OFF (20)
+ #define DDRDATA3CH0_CR_RXTRAINRANK0_RxDqsNPi_WID ( 6)
+ #define DDRDATA3CH0_CR_RXTRAINRANK0_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA3CH0_CR_RXTRAINRANK0_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA3CH0_CR_RXTRAINRANK0_RxVref_OFF (26)
+ #define DDRDATA3CH0_CR_RXTRAINRANK0_RxVref_WID ( 6)
+ #define DDRDATA3CH0_CR_RXTRAINRANK0_RxVref_MSK (0xFC000000)
+ #define DDRDATA3CH0_CR_RXTRAINRANK0_RxVref_MAX (0x0000003F)
+
+#define DDRDATA3CH0_CR_RXTRAINRANK1_REG (0x00000604)
+ #define DDRDATA3CH0_CR_RXTRAINRANK1_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA3CH0_CR_RXTRAINRANK1_RxRcvEnPi_WID ( 9)
+ #define DDRDATA3CH0_CR_RXTRAINRANK1_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA3CH0_CR_RXTRAINRANK1_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA3CH0_CR_RXTRAINRANK1_RxDqsPPi_OFF ( 9)
+ #define DDRDATA3CH0_CR_RXTRAINRANK1_RxDqsPPi_WID ( 6)
+ #define DDRDATA3CH0_CR_RXTRAINRANK1_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA3CH0_CR_RXTRAINRANK1_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA3CH0_CR_RXTRAINRANK1_RxEq_OFF (15)
+ #define DDRDATA3CH0_CR_RXTRAINRANK1_RxEq_WID ( 5)
+ #define DDRDATA3CH0_CR_RXTRAINRANK1_RxEq_MSK (0x000F8000)
+ #define DDRDATA3CH0_CR_RXTRAINRANK1_RxEq_MAX (0x0000001F)
+ #define DDRDATA3CH0_CR_RXTRAINRANK1_RxDqsNPi_OFF (20)
+ #define DDRDATA3CH0_CR_RXTRAINRANK1_RxDqsNPi_WID ( 6)
+ #define DDRDATA3CH0_CR_RXTRAINRANK1_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA3CH0_CR_RXTRAINRANK1_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA3CH0_CR_RXTRAINRANK1_RxVref_OFF (26)
+ #define DDRDATA3CH0_CR_RXTRAINRANK1_RxVref_WID ( 6)
+ #define DDRDATA3CH0_CR_RXTRAINRANK1_RxVref_MSK (0xFC000000)
+ #define DDRDATA3CH0_CR_RXTRAINRANK1_RxVref_MAX (0x0000003F)
+
+#define DDRDATA3CH0_CR_RXTRAINRANK2_REG (0x00000608)
+ #define DDRDATA3CH0_CR_RXTRAINRANK2_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA3CH0_CR_RXTRAINRANK2_RxRcvEnPi_WID ( 9)
+ #define DDRDATA3CH0_CR_RXTRAINRANK2_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA3CH0_CR_RXTRAINRANK2_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA3CH0_CR_RXTRAINRANK2_RxDqsPPi_OFF ( 9)
+ #define DDRDATA3CH0_CR_RXTRAINRANK2_RxDqsPPi_WID ( 6)
+ #define DDRDATA3CH0_CR_RXTRAINRANK2_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA3CH0_CR_RXTRAINRANK2_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA3CH0_CR_RXTRAINRANK2_RxEq_OFF (15)
+ #define DDRDATA3CH0_CR_RXTRAINRANK2_RxEq_WID ( 5)
+ #define DDRDATA3CH0_CR_RXTRAINRANK2_RxEq_MSK (0x000F8000)
+ #define DDRDATA3CH0_CR_RXTRAINRANK2_RxEq_MAX (0x0000001F)
+ #define DDRDATA3CH0_CR_RXTRAINRANK2_RxDqsNPi_OFF (20)
+ #define DDRDATA3CH0_CR_RXTRAINRANK2_RxDqsNPi_WID ( 6)
+ #define DDRDATA3CH0_CR_RXTRAINRANK2_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA3CH0_CR_RXTRAINRANK2_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA3CH0_CR_RXTRAINRANK2_RxVref_OFF (26)
+ #define DDRDATA3CH0_CR_RXTRAINRANK2_RxVref_WID ( 6)
+ #define DDRDATA3CH0_CR_RXTRAINRANK2_RxVref_MSK (0xFC000000)
+ #define DDRDATA3CH0_CR_RXTRAINRANK2_RxVref_MAX (0x0000003F)
+
+#define DDRDATA3CH0_CR_RXTRAINRANK3_REG (0x0000060C)
+ #define DDRDATA3CH0_CR_RXTRAINRANK3_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA3CH0_CR_RXTRAINRANK3_RxRcvEnPi_WID ( 9)
+ #define DDRDATA3CH0_CR_RXTRAINRANK3_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA3CH0_CR_RXTRAINRANK3_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA3CH0_CR_RXTRAINRANK3_RxDqsPPi_OFF ( 9)
+ #define DDRDATA3CH0_CR_RXTRAINRANK3_RxDqsPPi_WID ( 6)
+ #define DDRDATA3CH0_CR_RXTRAINRANK3_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA3CH0_CR_RXTRAINRANK3_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA3CH0_CR_RXTRAINRANK3_RxEq_OFF (15)
+ #define DDRDATA3CH0_CR_RXTRAINRANK3_RxEq_WID ( 5)
+ #define DDRDATA3CH0_CR_RXTRAINRANK3_RxEq_MSK (0x000F8000)
+ #define DDRDATA3CH0_CR_RXTRAINRANK3_RxEq_MAX (0x0000001F)
+ #define DDRDATA3CH0_CR_RXTRAINRANK3_RxDqsNPi_OFF (20)
+ #define DDRDATA3CH0_CR_RXTRAINRANK3_RxDqsNPi_WID ( 6)
+ #define DDRDATA3CH0_CR_RXTRAINRANK3_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA3CH0_CR_RXTRAINRANK3_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA3CH0_CR_RXTRAINRANK3_RxVref_OFF (26)
+ #define DDRDATA3CH0_CR_RXTRAINRANK3_RxVref_WID ( 6)
+ #define DDRDATA3CH0_CR_RXTRAINRANK3_RxVref_MSK (0xFC000000)
+ #define DDRDATA3CH0_CR_RXTRAINRANK3_RxVref_MAX (0x0000003F)
+
+#define DDRDATA3CH0_CR_RXPERBITRANK0_REG (0x00000610)
+ #define DDRDATA3CH0_CR_RXPERBITRANK0_Lane0_OFF ( 0)
+ #define DDRDATA3CH0_CR_RXPERBITRANK0_Lane0_WID ( 4)
+ #define DDRDATA3CH0_CR_RXPERBITRANK0_Lane0_MSK (0x0000000F)
+ #define DDRDATA3CH0_CR_RXPERBITRANK0_Lane0_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_RXPERBITRANK0_Lane1_OFF ( 4)
+ #define DDRDATA3CH0_CR_RXPERBITRANK0_Lane1_WID ( 4)
+ #define DDRDATA3CH0_CR_RXPERBITRANK0_Lane1_MSK (0x000000F0)
+ #define DDRDATA3CH0_CR_RXPERBITRANK0_Lane1_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_RXPERBITRANK0_Lane2_OFF ( 8)
+ #define DDRDATA3CH0_CR_RXPERBITRANK0_Lane2_WID ( 4)
+ #define DDRDATA3CH0_CR_RXPERBITRANK0_Lane2_MSK (0x00000F00)
+ #define DDRDATA3CH0_CR_RXPERBITRANK0_Lane2_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_RXPERBITRANK0_Lane3_OFF (12)
+ #define DDRDATA3CH0_CR_RXPERBITRANK0_Lane3_WID ( 4)
+ #define DDRDATA3CH0_CR_RXPERBITRANK0_Lane3_MSK (0x0000F000)
+ #define DDRDATA3CH0_CR_RXPERBITRANK0_Lane3_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_RXPERBITRANK0_Lane4_OFF (16)
+ #define DDRDATA3CH0_CR_RXPERBITRANK0_Lane4_WID ( 4)
+ #define DDRDATA3CH0_CR_RXPERBITRANK0_Lane4_MSK (0x000F0000)
+ #define DDRDATA3CH0_CR_RXPERBITRANK0_Lane4_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_RXPERBITRANK0_Lane5_OFF (20)
+ #define DDRDATA3CH0_CR_RXPERBITRANK0_Lane5_WID ( 4)
+ #define DDRDATA3CH0_CR_RXPERBITRANK0_Lane5_MSK (0x00F00000)
+ #define DDRDATA3CH0_CR_RXPERBITRANK0_Lane5_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_RXPERBITRANK0_Lane6_OFF (24)
+ #define DDRDATA3CH0_CR_RXPERBITRANK0_Lane6_WID ( 4)
+ #define DDRDATA3CH0_CR_RXPERBITRANK0_Lane6_MSK (0x0F000000)
+ #define DDRDATA3CH0_CR_RXPERBITRANK0_Lane6_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_RXPERBITRANK0_Lane7_OFF (28)
+ #define DDRDATA3CH0_CR_RXPERBITRANK0_Lane7_WID ( 4)
+ #define DDRDATA3CH0_CR_RXPERBITRANK0_Lane7_MSK (0xF0000000)
+ #define DDRDATA3CH0_CR_RXPERBITRANK0_Lane7_MAX (0x0000000F)
+
+#define DDRDATA3CH0_CR_RXPERBITRANK1_REG (0x00000614)
+ #define DDRDATA3CH0_CR_RXPERBITRANK1_Lane0_OFF ( 0)
+ #define DDRDATA3CH0_CR_RXPERBITRANK1_Lane0_WID ( 4)
+ #define DDRDATA3CH0_CR_RXPERBITRANK1_Lane0_MSK (0x0000000F)
+ #define DDRDATA3CH0_CR_RXPERBITRANK1_Lane0_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_RXPERBITRANK1_Lane1_OFF ( 4)
+ #define DDRDATA3CH0_CR_RXPERBITRANK1_Lane1_WID ( 4)
+ #define DDRDATA3CH0_CR_RXPERBITRANK1_Lane1_MSK (0x000000F0)
+ #define DDRDATA3CH0_CR_RXPERBITRANK1_Lane1_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_RXPERBITRANK1_Lane2_OFF ( 8)
+ #define DDRDATA3CH0_CR_RXPERBITRANK1_Lane2_WID ( 4)
+ #define DDRDATA3CH0_CR_RXPERBITRANK1_Lane2_MSK (0x00000F00)
+ #define DDRDATA3CH0_CR_RXPERBITRANK1_Lane2_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_RXPERBITRANK1_Lane3_OFF (12)
+ #define DDRDATA3CH0_CR_RXPERBITRANK1_Lane3_WID ( 4)
+ #define DDRDATA3CH0_CR_RXPERBITRANK1_Lane3_MSK (0x0000F000)
+ #define DDRDATA3CH0_CR_RXPERBITRANK1_Lane3_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_RXPERBITRANK1_Lane4_OFF (16)
+ #define DDRDATA3CH0_CR_RXPERBITRANK1_Lane4_WID ( 4)
+ #define DDRDATA3CH0_CR_RXPERBITRANK1_Lane4_MSK (0x000F0000)
+ #define DDRDATA3CH0_CR_RXPERBITRANK1_Lane4_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_RXPERBITRANK1_Lane5_OFF (20)
+ #define DDRDATA3CH0_CR_RXPERBITRANK1_Lane5_WID ( 4)
+ #define DDRDATA3CH0_CR_RXPERBITRANK1_Lane5_MSK (0x00F00000)
+ #define DDRDATA3CH0_CR_RXPERBITRANK1_Lane5_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_RXPERBITRANK1_Lane6_OFF (24)
+ #define DDRDATA3CH0_CR_RXPERBITRANK1_Lane6_WID ( 4)
+ #define DDRDATA3CH0_CR_RXPERBITRANK1_Lane6_MSK (0x0F000000)
+ #define DDRDATA3CH0_CR_RXPERBITRANK1_Lane6_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_RXPERBITRANK1_Lane7_OFF (28)
+ #define DDRDATA3CH0_CR_RXPERBITRANK1_Lane7_WID ( 4)
+ #define DDRDATA3CH0_CR_RXPERBITRANK1_Lane7_MSK (0xF0000000)
+ #define DDRDATA3CH0_CR_RXPERBITRANK1_Lane7_MAX (0x0000000F)
+
+#define DDRDATA3CH0_CR_RXPERBITRANK2_REG (0x00000618)
+ #define DDRDATA3CH0_CR_RXPERBITRANK2_Lane0_OFF ( 0)
+ #define DDRDATA3CH0_CR_RXPERBITRANK2_Lane0_WID ( 4)
+ #define DDRDATA3CH0_CR_RXPERBITRANK2_Lane0_MSK (0x0000000F)
+ #define DDRDATA3CH0_CR_RXPERBITRANK2_Lane0_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_RXPERBITRANK2_Lane1_OFF ( 4)
+ #define DDRDATA3CH0_CR_RXPERBITRANK2_Lane1_WID ( 4)
+ #define DDRDATA3CH0_CR_RXPERBITRANK2_Lane1_MSK (0x000000F0)
+ #define DDRDATA3CH0_CR_RXPERBITRANK2_Lane1_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_RXPERBITRANK2_Lane2_OFF ( 8)
+ #define DDRDATA3CH0_CR_RXPERBITRANK2_Lane2_WID ( 4)
+ #define DDRDATA3CH0_CR_RXPERBITRANK2_Lane2_MSK (0x00000F00)
+ #define DDRDATA3CH0_CR_RXPERBITRANK2_Lane2_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_RXPERBITRANK2_Lane3_OFF (12)
+ #define DDRDATA3CH0_CR_RXPERBITRANK2_Lane3_WID ( 4)
+ #define DDRDATA3CH0_CR_RXPERBITRANK2_Lane3_MSK (0x0000F000)
+ #define DDRDATA3CH0_CR_RXPERBITRANK2_Lane3_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_RXPERBITRANK2_Lane4_OFF (16)
+ #define DDRDATA3CH0_CR_RXPERBITRANK2_Lane4_WID ( 4)
+ #define DDRDATA3CH0_CR_RXPERBITRANK2_Lane4_MSK (0x000F0000)
+ #define DDRDATA3CH0_CR_RXPERBITRANK2_Lane4_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_RXPERBITRANK2_Lane5_OFF (20)
+ #define DDRDATA3CH0_CR_RXPERBITRANK2_Lane5_WID ( 4)
+ #define DDRDATA3CH0_CR_RXPERBITRANK2_Lane5_MSK (0x00F00000)
+ #define DDRDATA3CH0_CR_RXPERBITRANK2_Lane5_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_RXPERBITRANK2_Lane6_OFF (24)
+ #define DDRDATA3CH0_CR_RXPERBITRANK2_Lane6_WID ( 4)
+ #define DDRDATA3CH0_CR_RXPERBITRANK2_Lane6_MSK (0x0F000000)
+ #define DDRDATA3CH0_CR_RXPERBITRANK2_Lane6_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_RXPERBITRANK2_Lane7_OFF (28)
+ #define DDRDATA3CH0_CR_RXPERBITRANK2_Lane7_WID ( 4)
+ #define DDRDATA3CH0_CR_RXPERBITRANK2_Lane7_MSK (0xF0000000)
+ #define DDRDATA3CH0_CR_RXPERBITRANK2_Lane7_MAX (0x0000000F)
+
+#define DDRDATA3CH0_CR_RXPERBITRANK3_REG (0x0000061C)
+ #define DDRDATA3CH0_CR_RXPERBITRANK3_Lane0_OFF ( 0)
+ #define DDRDATA3CH0_CR_RXPERBITRANK3_Lane0_WID ( 4)
+ #define DDRDATA3CH0_CR_RXPERBITRANK3_Lane0_MSK (0x0000000F)
+ #define DDRDATA3CH0_CR_RXPERBITRANK3_Lane0_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_RXPERBITRANK3_Lane1_OFF ( 4)
+ #define DDRDATA3CH0_CR_RXPERBITRANK3_Lane1_WID ( 4)
+ #define DDRDATA3CH0_CR_RXPERBITRANK3_Lane1_MSK (0x000000F0)
+ #define DDRDATA3CH0_CR_RXPERBITRANK3_Lane1_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_RXPERBITRANK3_Lane2_OFF ( 8)
+ #define DDRDATA3CH0_CR_RXPERBITRANK3_Lane2_WID ( 4)
+ #define DDRDATA3CH0_CR_RXPERBITRANK3_Lane2_MSK (0x00000F00)
+ #define DDRDATA3CH0_CR_RXPERBITRANK3_Lane2_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_RXPERBITRANK3_Lane3_OFF (12)
+ #define DDRDATA3CH0_CR_RXPERBITRANK3_Lane3_WID ( 4)
+ #define DDRDATA3CH0_CR_RXPERBITRANK3_Lane3_MSK (0x0000F000)
+ #define DDRDATA3CH0_CR_RXPERBITRANK3_Lane3_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_RXPERBITRANK3_Lane4_OFF (16)
+ #define DDRDATA3CH0_CR_RXPERBITRANK3_Lane4_WID ( 4)
+ #define DDRDATA3CH0_CR_RXPERBITRANK3_Lane4_MSK (0x000F0000)
+ #define DDRDATA3CH0_CR_RXPERBITRANK3_Lane4_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_RXPERBITRANK3_Lane5_OFF (20)
+ #define DDRDATA3CH0_CR_RXPERBITRANK3_Lane5_WID ( 4)
+ #define DDRDATA3CH0_CR_RXPERBITRANK3_Lane5_MSK (0x00F00000)
+ #define DDRDATA3CH0_CR_RXPERBITRANK3_Lane5_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_RXPERBITRANK3_Lane6_OFF (24)
+ #define DDRDATA3CH0_CR_RXPERBITRANK3_Lane6_WID ( 4)
+ #define DDRDATA3CH0_CR_RXPERBITRANK3_Lane6_MSK (0x0F000000)
+ #define DDRDATA3CH0_CR_RXPERBITRANK3_Lane6_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_RXPERBITRANK3_Lane7_OFF (28)
+ #define DDRDATA3CH0_CR_RXPERBITRANK3_Lane7_WID ( 4)
+ #define DDRDATA3CH0_CR_RXPERBITRANK3_Lane7_MSK (0xF0000000)
+ #define DDRDATA3CH0_CR_RXPERBITRANK3_Lane7_MAX (0x0000000F)
+
+#define DDRDATA3CH0_CR_TXTRAINRANK0_REG (0x00000620)
+ #define DDRDATA3CH0_CR_TXTRAINRANK0_TxDqDelay_OFF ( 0)
+ #define DDRDATA3CH0_CR_TXTRAINRANK0_TxDqDelay_WID ( 9)
+ #define DDRDATA3CH0_CR_TXTRAINRANK0_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA3CH0_CR_TXTRAINRANK0_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA3CH0_CR_TXTRAINRANK0_TxDqsDelay_OFF ( 9)
+ #define DDRDATA3CH0_CR_TXTRAINRANK0_TxDqsDelay_WID ( 9)
+ #define DDRDATA3CH0_CR_TXTRAINRANK0_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA3CH0_CR_TXTRAINRANK0_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA3CH0_CR_TXTRAINRANK0_Spare0_OFF (18)
+ #define DDRDATA3CH0_CR_TXTRAINRANK0_Spare0_WID ( 2)
+ #define DDRDATA3CH0_CR_TXTRAINRANK0_Spare0_MSK (0x000C0000)
+ #define DDRDATA3CH0_CR_TXTRAINRANK0_Spare0_MAX (0x00000003)
+ #define DDRDATA3CH0_CR_TXTRAINRANK0_TxEqualization_OFF (20)
+ #define DDRDATA3CH0_CR_TXTRAINRANK0_TxEqualization_WID ( 6)
+ #define DDRDATA3CH0_CR_TXTRAINRANK0_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA3CH0_CR_TXTRAINRANK0_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA3CH0_CR_TXTRAINRANK0_Spare1_OFF (26)
+ #define DDRDATA3CH0_CR_TXTRAINRANK0_Spare1_WID ( 6)
+ #define DDRDATA3CH0_CR_TXTRAINRANK0_Spare1_MSK (0xFC000000)
+ #define DDRDATA3CH0_CR_TXTRAINRANK0_Spare1_MAX (0x0000003F)
+
+#define DDRDATA3CH0_CR_TXTRAINRANK1_REG (0x00000624)
+ #define DDRDATA3CH0_CR_TXTRAINRANK1_TxDqDelay_OFF ( 0)
+ #define DDRDATA3CH0_CR_TXTRAINRANK1_TxDqDelay_WID ( 9)
+ #define DDRDATA3CH0_CR_TXTRAINRANK1_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA3CH0_CR_TXTRAINRANK1_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA3CH0_CR_TXTRAINRANK1_TxDqsDelay_OFF ( 9)
+ #define DDRDATA3CH0_CR_TXTRAINRANK1_TxDqsDelay_WID ( 9)
+ #define DDRDATA3CH0_CR_TXTRAINRANK1_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA3CH0_CR_TXTRAINRANK1_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA3CH0_CR_TXTRAINRANK1_Spare0_OFF (18)
+ #define DDRDATA3CH0_CR_TXTRAINRANK1_Spare0_WID ( 2)
+ #define DDRDATA3CH0_CR_TXTRAINRANK1_Spare0_MSK (0x000C0000)
+ #define DDRDATA3CH0_CR_TXTRAINRANK1_Spare0_MAX (0x00000003)
+ #define DDRDATA3CH0_CR_TXTRAINRANK1_TxEqualization_OFF (20)
+ #define DDRDATA3CH0_CR_TXTRAINRANK1_TxEqualization_WID ( 6)
+ #define DDRDATA3CH0_CR_TXTRAINRANK1_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA3CH0_CR_TXTRAINRANK1_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA3CH0_CR_TXTRAINRANK1_Spare1_OFF (26)
+ #define DDRDATA3CH0_CR_TXTRAINRANK1_Spare1_WID ( 6)
+ #define DDRDATA3CH0_CR_TXTRAINRANK1_Spare1_MSK (0xFC000000)
+ #define DDRDATA3CH0_CR_TXTRAINRANK1_Spare1_MAX (0x0000003F)
+
+#define DDRDATA3CH0_CR_TXTRAINRANK2_REG (0x00000628)
+ #define DDRDATA3CH0_CR_TXTRAINRANK2_TxDqDelay_OFF ( 0)
+ #define DDRDATA3CH0_CR_TXTRAINRANK2_TxDqDelay_WID ( 9)
+ #define DDRDATA3CH0_CR_TXTRAINRANK2_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA3CH0_CR_TXTRAINRANK2_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA3CH0_CR_TXTRAINRANK2_TxDqsDelay_OFF ( 9)
+ #define DDRDATA3CH0_CR_TXTRAINRANK2_TxDqsDelay_WID ( 9)
+ #define DDRDATA3CH0_CR_TXTRAINRANK2_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA3CH0_CR_TXTRAINRANK2_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA3CH0_CR_TXTRAINRANK2_Spare0_OFF (18)
+ #define DDRDATA3CH0_CR_TXTRAINRANK2_Spare0_WID ( 2)
+ #define DDRDATA3CH0_CR_TXTRAINRANK2_Spare0_MSK (0x000C0000)
+ #define DDRDATA3CH0_CR_TXTRAINRANK2_Spare0_MAX (0x00000003)
+ #define DDRDATA3CH0_CR_TXTRAINRANK2_TxEqualization_OFF (20)
+ #define DDRDATA3CH0_CR_TXTRAINRANK2_TxEqualization_WID ( 6)
+ #define DDRDATA3CH0_CR_TXTRAINRANK2_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA3CH0_CR_TXTRAINRANK2_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA3CH0_CR_TXTRAINRANK2_Spare1_OFF (26)
+ #define DDRDATA3CH0_CR_TXTRAINRANK2_Spare1_WID ( 6)
+ #define DDRDATA3CH0_CR_TXTRAINRANK2_Spare1_MSK (0xFC000000)
+ #define DDRDATA3CH0_CR_TXTRAINRANK2_Spare1_MAX (0x0000003F)
+
+#define DDRDATA3CH0_CR_TXTRAINRANK3_REG (0x0000062C)
+ #define DDRDATA3CH0_CR_TXTRAINRANK3_TxDqDelay_OFF ( 0)
+ #define DDRDATA3CH0_CR_TXTRAINRANK3_TxDqDelay_WID ( 9)
+ #define DDRDATA3CH0_CR_TXTRAINRANK3_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA3CH0_CR_TXTRAINRANK3_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA3CH0_CR_TXTRAINRANK3_TxDqsDelay_OFF ( 9)
+ #define DDRDATA3CH0_CR_TXTRAINRANK3_TxDqsDelay_WID ( 9)
+ #define DDRDATA3CH0_CR_TXTRAINRANK3_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA3CH0_CR_TXTRAINRANK3_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA3CH0_CR_TXTRAINRANK3_Spare0_OFF (18)
+ #define DDRDATA3CH0_CR_TXTRAINRANK3_Spare0_WID ( 2)
+ #define DDRDATA3CH0_CR_TXTRAINRANK3_Spare0_MSK (0x000C0000)
+ #define DDRDATA3CH0_CR_TXTRAINRANK3_Spare0_MAX (0x00000003)
+ #define DDRDATA3CH0_CR_TXTRAINRANK3_TxEqualization_OFF (20)
+ #define DDRDATA3CH0_CR_TXTRAINRANK3_TxEqualization_WID ( 6)
+ #define DDRDATA3CH0_CR_TXTRAINRANK3_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA3CH0_CR_TXTRAINRANK3_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA3CH0_CR_TXTRAINRANK3_Spare1_OFF (26)
+ #define DDRDATA3CH0_CR_TXTRAINRANK3_Spare1_WID ( 6)
+ #define DDRDATA3CH0_CR_TXTRAINRANK3_Spare1_MSK (0xFC000000)
+ #define DDRDATA3CH0_CR_TXTRAINRANK3_Spare1_MAX (0x0000003F)
+
+#define DDRDATA3CH0_CR_TXPERBITRANK0_REG (0x00000630)
+ #define DDRDATA3CH0_CR_TXPERBITRANK0_Lane0_OFF ( 0)
+ #define DDRDATA3CH0_CR_TXPERBITRANK0_Lane0_WID ( 4)
+ #define DDRDATA3CH0_CR_TXPERBITRANK0_Lane0_MSK (0x0000000F)
+ #define DDRDATA3CH0_CR_TXPERBITRANK0_Lane0_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_TXPERBITRANK0_Lane1_OFF ( 4)
+ #define DDRDATA3CH0_CR_TXPERBITRANK0_Lane1_WID ( 4)
+ #define DDRDATA3CH0_CR_TXPERBITRANK0_Lane1_MSK (0x000000F0)
+ #define DDRDATA3CH0_CR_TXPERBITRANK0_Lane1_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_TXPERBITRANK0_Lane2_OFF ( 8)
+ #define DDRDATA3CH0_CR_TXPERBITRANK0_Lane2_WID ( 4)
+ #define DDRDATA3CH0_CR_TXPERBITRANK0_Lane2_MSK (0x00000F00)
+ #define DDRDATA3CH0_CR_TXPERBITRANK0_Lane2_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_TXPERBITRANK0_Lane3_OFF (12)
+ #define DDRDATA3CH0_CR_TXPERBITRANK0_Lane3_WID ( 4)
+ #define DDRDATA3CH0_CR_TXPERBITRANK0_Lane3_MSK (0x0000F000)
+ #define DDRDATA3CH0_CR_TXPERBITRANK0_Lane3_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_TXPERBITRANK0_Lane4_OFF (16)
+ #define DDRDATA3CH0_CR_TXPERBITRANK0_Lane4_WID ( 4)
+ #define DDRDATA3CH0_CR_TXPERBITRANK0_Lane4_MSK (0x000F0000)
+ #define DDRDATA3CH0_CR_TXPERBITRANK0_Lane4_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_TXPERBITRANK0_Lane5_OFF (20)
+ #define DDRDATA3CH0_CR_TXPERBITRANK0_Lane5_WID ( 4)
+ #define DDRDATA3CH0_CR_TXPERBITRANK0_Lane5_MSK (0x00F00000)
+ #define DDRDATA3CH0_CR_TXPERBITRANK0_Lane5_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_TXPERBITRANK0_Lane6_OFF (24)
+ #define DDRDATA3CH0_CR_TXPERBITRANK0_Lane6_WID ( 4)
+ #define DDRDATA3CH0_CR_TXPERBITRANK0_Lane6_MSK (0x0F000000)
+ #define DDRDATA3CH0_CR_TXPERBITRANK0_Lane6_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_TXPERBITRANK0_Lane7_OFF (28)
+ #define DDRDATA3CH0_CR_TXPERBITRANK0_Lane7_WID ( 4)
+ #define DDRDATA3CH0_CR_TXPERBITRANK0_Lane7_MSK (0xF0000000)
+ #define DDRDATA3CH0_CR_TXPERBITRANK0_Lane7_MAX (0x0000000F)
+
+#define DDRDATA3CH0_CR_TXPERBITRANK1_REG (0x00000634)
+ #define DDRDATA3CH0_CR_TXPERBITRANK1_Lane0_OFF ( 0)
+ #define DDRDATA3CH0_CR_TXPERBITRANK1_Lane0_WID ( 4)
+ #define DDRDATA3CH0_CR_TXPERBITRANK1_Lane0_MSK (0x0000000F)
+ #define DDRDATA3CH0_CR_TXPERBITRANK1_Lane0_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_TXPERBITRANK1_Lane1_OFF ( 4)
+ #define DDRDATA3CH0_CR_TXPERBITRANK1_Lane1_WID ( 4)
+ #define DDRDATA3CH0_CR_TXPERBITRANK1_Lane1_MSK (0x000000F0)
+ #define DDRDATA3CH0_CR_TXPERBITRANK1_Lane1_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_TXPERBITRANK1_Lane2_OFF ( 8)
+ #define DDRDATA3CH0_CR_TXPERBITRANK1_Lane2_WID ( 4)
+ #define DDRDATA3CH0_CR_TXPERBITRANK1_Lane2_MSK (0x00000F00)
+ #define DDRDATA3CH0_CR_TXPERBITRANK1_Lane2_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_TXPERBITRANK1_Lane3_OFF (12)
+ #define DDRDATA3CH0_CR_TXPERBITRANK1_Lane3_WID ( 4)
+ #define DDRDATA3CH0_CR_TXPERBITRANK1_Lane3_MSK (0x0000F000)
+ #define DDRDATA3CH0_CR_TXPERBITRANK1_Lane3_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_TXPERBITRANK1_Lane4_OFF (16)
+ #define DDRDATA3CH0_CR_TXPERBITRANK1_Lane4_WID ( 4)
+ #define DDRDATA3CH0_CR_TXPERBITRANK1_Lane4_MSK (0x000F0000)
+ #define DDRDATA3CH0_CR_TXPERBITRANK1_Lane4_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_TXPERBITRANK1_Lane5_OFF (20)
+ #define DDRDATA3CH0_CR_TXPERBITRANK1_Lane5_WID ( 4)
+ #define DDRDATA3CH0_CR_TXPERBITRANK1_Lane5_MSK (0x00F00000)
+ #define DDRDATA3CH0_CR_TXPERBITRANK1_Lane5_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_TXPERBITRANK1_Lane6_OFF (24)
+ #define DDRDATA3CH0_CR_TXPERBITRANK1_Lane6_WID ( 4)
+ #define DDRDATA3CH0_CR_TXPERBITRANK1_Lane6_MSK (0x0F000000)
+ #define DDRDATA3CH0_CR_TXPERBITRANK1_Lane6_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_TXPERBITRANK1_Lane7_OFF (28)
+ #define DDRDATA3CH0_CR_TXPERBITRANK1_Lane7_WID ( 4)
+ #define DDRDATA3CH0_CR_TXPERBITRANK1_Lane7_MSK (0xF0000000)
+ #define DDRDATA3CH0_CR_TXPERBITRANK1_Lane7_MAX (0x0000000F)
+
+#define DDRDATA3CH0_CR_TXPERBITRANK2_REG (0x00000638)
+ #define DDRDATA3CH0_CR_TXPERBITRANK2_Lane0_OFF ( 0)
+ #define DDRDATA3CH0_CR_TXPERBITRANK2_Lane0_WID ( 4)
+ #define DDRDATA3CH0_CR_TXPERBITRANK2_Lane0_MSK (0x0000000F)
+ #define DDRDATA3CH0_CR_TXPERBITRANK2_Lane0_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_TXPERBITRANK2_Lane1_OFF ( 4)
+ #define DDRDATA3CH0_CR_TXPERBITRANK2_Lane1_WID ( 4)
+ #define DDRDATA3CH0_CR_TXPERBITRANK2_Lane1_MSK (0x000000F0)
+ #define DDRDATA3CH0_CR_TXPERBITRANK2_Lane1_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_TXPERBITRANK2_Lane2_OFF ( 8)
+ #define DDRDATA3CH0_CR_TXPERBITRANK2_Lane2_WID ( 4)
+ #define DDRDATA3CH0_CR_TXPERBITRANK2_Lane2_MSK (0x00000F00)
+ #define DDRDATA3CH0_CR_TXPERBITRANK2_Lane2_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_TXPERBITRANK2_Lane3_OFF (12)
+ #define DDRDATA3CH0_CR_TXPERBITRANK2_Lane3_WID ( 4)
+ #define DDRDATA3CH0_CR_TXPERBITRANK2_Lane3_MSK (0x0000F000)
+ #define DDRDATA3CH0_CR_TXPERBITRANK2_Lane3_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_TXPERBITRANK2_Lane4_OFF (16)
+ #define DDRDATA3CH0_CR_TXPERBITRANK2_Lane4_WID ( 4)
+ #define DDRDATA3CH0_CR_TXPERBITRANK2_Lane4_MSK (0x000F0000)
+ #define DDRDATA3CH0_CR_TXPERBITRANK2_Lane4_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_TXPERBITRANK2_Lane5_OFF (20)
+ #define DDRDATA3CH0_CR_TXPERBITRANK2_Lane5_WID ( 4)
+ #define DDRDATA3CH0_CR_TXPERBITRANK2_Lane5_MSK (0x00F00000)
+ #define DDRDATA3CH0_CR_TXPERBITRANK2_Lane5_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_TXPERBITRANK2_Lane6_OFF (24)
+ #define DDRDATA3CH0_CR_TXPERBITRANK2_Lane6_WID ( 4)
+ #define DDRDATA3CH0_CR_TXPERBITRANK2_Lane6_MSK (0x0F000000)
+ #define DDRDATA3CH0_CR_TXPERBITRANK2_Lane6_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_TXPERBITRANK2_Lane7_OFF (28)
+ #define DDRDATA3CH0_CR_TXPERBITRANK2_Lane7_WID ( 4)
+ #define DDRDATA3CH0_CR_TXPERBITRANK2_Lane7_MSK (0xF0000000)
+ #define DDRDATA3CH0_CR_TXPERBITRANK2_Lane7_MAX (0x0000000F)
+
+#define DDRDATA3CH0_CR_TXPERBITRANK3_REG (0x0000063C)
+ #define DDRDATA3CH0_CR_TXPERBITRANK3_Lane0_OFF ( 0)
+ #define DDRDATA3CH0_CR_TXPERBITRANK3_Lane0_WID ( 4)
+ #define DDRDATA3CH0_CR_TXPERBITRANK3_Lane0_MSK (0x0000000F)
+ #define DDRDATA3CH0_CR_TXPERBITRANK3_Lane0_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_TXPERBITRANK3_Lane1_OFF ( 4)
+ #define DDRDATA3CH0_CR_TXPERBITRANK3_Lane1_WID ( 4)
+ #define DDRDATA3CH0_CR_TXPERBITRANK3_Lane1_MSK (0x000000F0)
+ #define DDRDATA3CH0_CR_TXPERBITRANK3_Lane1_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_TXPERBITRANK3_Lane2_OFF ( 8)
+ #define DDRDATA3CH0_CR_TXPERBITRANK3_Lane2_WID ( 4)
+ #define DDRDATA3CH0_CR_TXPERBITRANK3_Lane2_MSK (0x00000F00)
+ #define DDRDATA3CH0_CR_TXPERBITRANK3_Lane2_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_TXPERBITRANK3_Lane3_OFF (12)
+ #define DDRDATA3CH0_CR_TXPERBITRANK3_Lane3_WID ( 4)
+ #define DDRDATA3CH0_CR_TXPERBITRANK3_Lane3_MSK (0x0000F000)
+ #define DDRDATA3CH0_CR_TXPERBITRANK3_Lane3_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_TXPERBITRANK3_Lane4_OFF (16)
+ #define DDRDATA3CH0_CR_TXPERBITRANK3_Lane4_WID ( 4)
+ #define DDRDATA3CH0_CR_TXPERBITRANK3_Lane4_MSK (0x000F0000)
+ #define DDRDATA3CH0_CR_TXPERBITRANK3_Lane4_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_TXPERBITRANK3_Lane5_OFF (20)
+ #define DDRDATA3CH0_CR_TXPERBITRANK3_Lane5_WID ( 4)
+ #define DDRDATA3CH0_CR_TXPERBITRANK3_Lane5_MSK (0x00F00000)
+ #define DDRDATA3CH0_CR_TXPERBITRANK3_Lane5_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_TXPERBITRANK3_Lane6_OFF (24)
+ #define DDRDATA3CH0_CR_TXPERBITRANK3_Lane6_WID ( 4)
+ #define DDRDATA3CH0_CR_TXPERBITRANK3_Lane6_MSK (0x0F000000)
+ #define DDRDATA3CH0_CR_TXPERBITRANK3_Lane6_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_TXPERBITRANK3_Lane7_OFF (28)
+ #define DDRDATA3CH0_CR_TXPERBITRANK3_Lane7_WID ( 4)
+ #define DDRDATA3CH0_CR_TXPERBITRANK3_Lane7_MSK (0xF0000000)
+ #define DDRDATA3CH0_CR_TXPERBITRANK3_Lane7_MAX (0x0000000F)
+
+#define DDRDATA3CH0_CR_RCOMPDATA0_REG (0x00000640)
+ #define DDRDATA3CH0_CR_RCOMPDATA0_RcompDrvUp_OFF ( 0)
+ #define DDRDATA3CH0_CR_RCOMPDATA0_RcompDrvUp_WID ( 6)
+ #define DDRDATA3CH0_CR_RCOMPDATA0_RcompDrvUp_MSK (0x0000003F)
+ #define DDRDATA3CH0_CR_RCOMPDATA0_RcompDrvUp_MAX (0x0000003F)
+ #define DDRDATA3CH0_CR_RCOMPDATA0_Spare0_OFF ( 6)
+ #define DDRDATA3CH0_CR_RCOMPDATA0_Spare0_WID ( 3)
+ #define DDRDATA3CH0_CR_RCOMPDATA0_Spare0_MSK (0x000001C0)
+ #define DDRDATA3CH0_CR_RCOMPDATA0_Spare0_MAX (0x00000007)
+ #define DDRDATA3CH0_CR_RCOMPDATA0_RcompDrvDown_OFF ( 9)
+ #define DDRDATA3CH0_CR_RCOMPDATA0_RcompDrvDown_WID ( 6)
+ #define DDRDATA3CH0_CR_RCOMPDATA0_RcompDrvDown_MSK (0x00007E00)
+ #define DDRDATA3CH0_CR_RCOMPDATA0_RcompDrvDown_MAX (0x0000003F)
+ #define DDRDATA3CH0_CR_RCOMPDATA0_VTComp_OFF (15)
+ #define DDRDATA3CH0_CR_RCOMPDATA0_VTComp_WID ( 5)
+ #define DDRDATA3CH0_CR_RCOMPDATA0_VTComp_MSK (0x000F8000)
+ #define DDRDATA3CH0_CR_RCOMPDATA0_VTComp_MAX (0x0000001F)
+ #define DDRDATA3CH0_CR_RCOMPDATA0_TcoComp_OFF (20)
+ #define DDRDATA3CH0_CR_RCOMPDATA0_TcoComp_WID ( 6)
+ #define DDRDATA3CH0_CR_RCOMPDATA0_TcoComp_MSK (0x03F00000)
+ #define DDRDATA3CH0_CR_RCOMPDATA0_TcoComp_MAX (0x0000003F)
+ #define DDRDATA3CH0_CR_RCOMPDATA0_SlewRateComp_OFF (26)
+ #define DDRDATA3CH0_CR_RCOMPDATA0_SlewRateComp_WID ( 5)
+ #define DDRDATA3CH0_CR_RCOMPDATA0_SlewRateComp_MSK (0x7C000000)
+ #define DDRDATA3CH0_CR_RCOMPDATA0_SlewRateComp_MAX (0x0000001F)
+ #define DDRDATA3CH0_CR_RCOMPDATA0_Spare2_OFF (31)
+ #define DDRDATA3CH0_CR_RCOMPDATA0_Spare2_WID ( 1)
+ #define DDRDATA3CH0_CR_RCOMPDATA0_Spare2_MSK (0x80000000)
+ #define DDRDATA3CH0_CR_RCOMPDATA0_Spare2_MAX (0x00000001)
+
+#define DDRDATA3CH0_CR_RCOMPDATA1_REG (0x00000644)
+ #define DDRDATA3CH0_CR_RCOMPDATA1_RcompOdtUp_OFF ( 0)
+ #define DDRDATA3CH0_CR_RCOMPDATA1_RcompOdtUp_WID ( 6)
+ #define DDRDATA3CH0_CR_RCOMPDATA1_RcompOdtUp_MSK (0x0000003F)
+ #define DDRDATA3CH0_CR_RCOMPDATA1_RcompOdtUp_MAX (0x0000003F)
+ #define DDRDATA3CH0_CR_RCOMPDATA1_Spare0_OFF ( 6)
+ #define DDRDATA3CH0_CR_RCOMPDATA1_Spare0_WID ( 3)
+ #define DDRDATA3CH0_CR_RCOMPDATA1_Spare0_MSK (0x000001C0)
+ #define DDRDATA3CH0_CR_RCOMPDATA1_Spare0_MAX (0x00000007)
+ #define DDRDATA3CH0_CR_RCOMPDATA1_RcompOdtDown_OFF ( 9)
+ #define DDRDATA3CH0_CR_RCOMPDATA1_RcompOdtDown_WID ( 6)
+ #define DDRDATA3CH0_CR_RCOMPDATA1_RcompOdtDown_MSK (0x00007E00)
+ #define DDRDATA3CH0_CR_RCOMPDATA1_RcompOdtDown_MAX (0x0000003F)
+ #define DDRDATA3CH0_CR_RCOMPDATA1_Spare1_OFF (15)
+ #define DDRDATA3CH0_CR_RCOMPDATA1_Spare1_WID ( 1)
+ #define DDRDATA3CH0_CR_RCOMPDATA1_Spare1_MSK (0x00008000)
+ #define DDRDATA3CH0_CR_RCOMPDATA1_Spare1_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_RCOMPDATA1_PanicDrvDn_OFF (16)
+ #define DDRDATA3CH0_CR_RCOMPDATA1_PanicDrvDn_WID ( 6)
+ #define DDRDATA3CH0_CR_RCOMPDATA1_PanicDrvDn_MSK (0x003F0000)
+ #define DDRDATA3CH0_CR_RCOMPDATA1_PanicDrvDn_MAX (0x0000003F)
+ #define DDRDATA3CH0_CR_RCOMPDATA1_PanicDrvUp_OFF (22)
+ #define DDRDATA3CH0_CR_RCOMPDATA1_PanicDrvUp_WID ( 6)
+ #define DDRDATA3CH0_CR_RCOMPDATA1_PanicDrvUp_MSK (0x0FC00000)
+ #define DDRDATA3CH0_CR_RCOMPDATA1_PanicDrvUp_MAX (0x0000003F)
+ #define DDRDATA3CH0_CR_RCOMPDATA1_LevelShifterComp_OFF (28)
+ #define DDRDATA3CH0_CR_RCOMPDATA1_LevelShifterComp_WID ( 3)
+ #define DDRDATA3CH0_CR_RCOMPDATA1_LevelShifterComp_MSK (0x70000000)
+ #define DDRDATA3CH0_CR_RCOMPDATA1_LevelShifterComp_MAX (0x00000007)
+ #define DDRDATA3CH0_CR_RCOMPDATA1_Spare2_OFF (31)
+ #define DDRDATA3CH0_CR_RCOMPDATA1_Spare2_WID ( 1)
+ #define DDRDATA3CH0_CR_RCOMPDATA1_Spare2_MSK (0x80000000)
+ #define DDRDATA3CH0_CR_RCOMPDATA1_Spare2_MAX (0x00000001)
+
+#define DDRDATA3CH0_CR_TXXTALK_REG (0x00000648)
+ #define DDRDATA3CH0_CR_TXXTALK_Lane0_OFF ( 0)
+ #define DDRDATA3CH0_CR_TXXTALK_Lane0_WID ( 4)
+ #define DDRDATA3CH0_CR_TXXTALK_Lane0_MSK (0x0000000F)
+ #define DDRDATA3CH0_CR_TXXTALK_Lane0_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_TXXTALK_Lane1_OFF ( 4)
+ #define DDRDATA3CH0_CR_TXXTALK_Lane1_WID ( 4)
+ #define DDRDATA3CH0_CR_TXXTALK_Lane1_MSK (0x000000F0)
+ #define DDRDATA3CH0_CR_TXXTALK_Lane1_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_TXXTALK_Lane2_OFF ( 8)
+ #define DDRDATA3CH0_CR_TXXTALK_Lane2_WID ( 4)
+ #define DDRDATA3CH0_CR_TXXTALK_Lane2_MSK (0x00000F00)
+ #define DDRDATA3CH0_CR_TXXTALK_Lane2_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_TXXTALK_Lane3_OFF (12)
+ #define DDRDATA3CH0_CR_TXXTALK_Lane3_WID ( 4)
+ #define DDRDATA3CH0_CR_TXXTALK_Lane3_MSK (0x0000F000)
+ #define DDRDATA3CH0_CR_TXXTALK_Lane3_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_TXXTALK_Lane4_OFF (16)
+ #define DDRDATA3CH0_CR_TXXTALK_Lane4_WID ( 4)
+ #define DDRDATA3CH0_CR_TXXTALK_Lane4_MSK (0x000F0000)
+ #define DDRDATA3CH0_CR_TXXTALK_Lane4_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_TXXTALK_Lane5_OFF (20)
+ #define DDRDATA3CH0_CR_TXXTALK_Lane5_WID ( 4)
+ #define DDRDATA3CH0_CR_TXXTALK_Lane5_MSK (0x00F00000)
+ #define DDRDATA3CH0_CR_TXXTALK_Lane5_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_TXXTALK_Lane6_OFF (24)
+ #define DDRDATA3CH0_CR_TXXTALK_Lane6_WID ( 4)
+ #define DDRDATA3CH0_CR_TXXTALK_Lane6_MSK (0x0F000000)
+ #define DDRDATA3CH0_CR_TXXTALK_Lane6_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_TXXTALK_Lane7_OFF (28)
+ #define DDRDATA3CH0_CR_TXXTALK_Lane7_WID ( 4)
+ #define DDRDATA3CH0_CR_TXXTALK_Lane7_MSK (0xF0000000)
+ #define DDRDATA3CH0_CR_TXXTALK_Lane7_MAX (0x0000000F)
+
+#define DDRDATA3CH0_CR_RXOFFSETVDQ_REG (0x0000064C)
+ #define DDRDATA3CH0_CR_RXOFFSETVDQ_Lane0_OFF ( 0)
+ #define DDRDATA3CH0_CR_RXOFFSETVDQ_Lane0_WID ( 4)
+ #define DDRDATA3CH0_CR_RXOFFSETVDQ_Lane0_MSK (0x0000000F)
+ #define DDRDATA3CH0_CR_RXOFFSETVDQ_Lane0_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_RXOFFSETVDQ_Lane1_OFF ( 4)
+ #define DDRDATA3CH0_CR_RXOFFSETVDQ_Lane1_WID ( 4)
+ #define DDRDATA3CH0_CR_RXOFFSETVDQ_Lane1_MSK (0x000000F0)
+ #define DDRDATA3CH0_CR_RXOFFSETVDQ_Lane1_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_RXOFFSETVDQ_Lane2_OFF ( 8)
+ #define DDRDATA3CH0_CR_RXOFFSETVDQ_Lane2_WID ( 4)
+ #define DDRDATA3CH0_CR_RXOFFSETVDQ_Lane2_MSK (0x00000F00)
+ #define DDRDATA3CH0_CR_RXOFFSETVDQ_Lane2_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_RXOFFSETVDQ_Lane3_OFF (12)
+ #define DDRDATA3CH0_CR_RXOFFSETVDQ_Lane3_WID ( 4)
+ #define DDRDATA3CH0_CR_RXOFFSETVDQ_Lane3_MSK (0x0000F000)
+ #define DDRDATA3CH0_CR_RXOFFSETVDQ_Lane3_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_RXOFFSETVDQ_Lane4_OFF (16)
+ #define DDRDATA3CH0_CR_RXOFFSETVDQ_Lane4_WID ( 4)
+ #define DDRDATA3CH0_CR_RXOFFSETVDQ_Lane4_MSK (0x000F0000)
+ #define DDRDATA3CH0_CR_RXOFFSETVDQ_Lane4_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_RXOFFSETVDQ_Lane5_OFF (20)
+ #define DDRDATA3CH0_CR_RXOFFSETVDQ_Lane5_WID ( 4)
+ #define DDRDATA3CH0_CR_RXOFFSETVDQ_Lane5_MSK (0x00F00000)
+ #define DDRDATA3CH0_CR_RXOFFSETVDQ_Lane5_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_RXOFFSETVDQ_Lane6_OFF (24)
+ #define DDRDATA3CH0_CR_RXOFFSETVDQ_Lane6_WID ( 4)
+ #define DDRDATA3CH0_CR_RXOFFSETVDQ_Lane6_MSK (0x0F000000)
+ #define DDRDATA3CH0_CR_RXOFFSETVDQ_Lane6_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_RXOFFSETVDQ_Lane7_OFF (28)
+ #define DDRDATA3CH0_CR_RXOFFSETVDQ_Lane7_WID ( 4)
+ #define DDRDATA3CH0_CR_RXOFFSETVDQ_Lane7_MSK (0xF0000000)
+ #define DDRDATA3CH0_CR_RXOFFSETVDQ_Lane7_MAX (0x0000000F)
+
+#define DDRDATA3CH0_CR_DDRDATARESERVED_REG (0x00000650)
+ #define DDRDATA3CH0_CR_DDRDATARESERVED_Spare_OFF ( 0)
+ #define DDRDATA3CH0_CR_DDRDATARESERVED_Spare_WID (32)
+ #define DDRDATA3CH0_CR_DDRDATARESERVED_Spare_MSK (0xFFFFFFFF)
+ #define DDRDATA3CH0_CR_DDRDATARESERVED_Spare_MAX (0xFFFFFFFF)
+
+#define DDRDATA3CH0_CR_DATATRAINFEEDBACK_REG (0x00000654)
+ #define DDRDATA3CH0_CR_DATATRAINFEEDBACK_DataTrainFeedback_OFF ( 0)
+ #define DDRDATA3CH0_CR_DATATRAINFEEDBACK_DataTrainFeedback_WID ( 9)
+ #define DDRDATA3CH0_CR_DATATRAINFEEDBACK_DataTrainFeedback_MSK (0x000001FF)
+ #define DDRDATA3CH0_CR_DATATRAINFEEDBACK_DataTrainFeedback_MAX (0x000001FF)
+ #define DDRDATA3CH0_CR_DATATRAINFEEDBACK_Spare_OFF ( 9)
+ #define DDRDATA3CH0_CR_DATATRAINFEEDBACK_Spare_WID (23)
+ #define DDRDATA3CH0_CR_DATATRAINFEEDBACK_Spare_MSK (0xFFFFFE00)
+ #define DDRDATA3CH0_CR_DATATRAINFEEDBACK_Spare_MAX (0x007FFFFF)
+
+#define DDRDATA3CH0_CR_DLLPITESTANDADC_REG (0x00000658)
+ #define DDRDATA3CH0_CR_DLLPITESTANDADC_RunTest_OFF ( 0)
+ #define DDRDATA3CH0_CR_DLLPITESTANDADC_RunTest_WID ( 1)
+ #define DDRDATA3CH0_CR_DLLPITESTANDADC_RunTest_MSK (0x00000001)
+ #define DDRDATA3CH0_CR_DLLPITESTANDADC_RunTest_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DLLPITESTANDADC_RunTest_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DLLPITESTANDADC_Load_OFF ( 1)
+ #define DDRDATA3CH0_CR_DLLPITESTANDADC_Load_WID ( 1)
+ #define DDRDATA3CH0_CR_DLLPITESTANDADC_Load_MSK (0x00000002)
+ #define DDRDATA3CH0_CR_DLLPITESTANDADC_Load_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DLLPITESTANDADC_Load_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DLLPITESTANDADC_ModeHVM_OFF ( 2)
+ #define DDRDATA3CH0_CR_DLLPITESTANDADC_ModeHVM_WID ( 1)
+ #define DDRDATA3CH0_CR_DLLPITESTANDADC_ModeHVM_MSK (0x00000004)
+ #define DDRDATA3CH0_CR_DLLPITESTANDADC_ModeHVM_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DLLPITESTANDADC_ModeHVM_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DLLPITESTANDADC_ModeDV_OFF ( 3)
+ #define DDRDATA3CH0_CR_DLLPITESTANDADC_ModeDV_WID ( 1)
+ #define DDRDATA3CH0_CR_DLLPITESTANDADC_ModeDV_MSK (0x00000008)
+ #define DDRDATA3CH0_CR_DLLPITESTANDADC_ModeDV_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DLLPITESTANDADC_ModeDV_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DLLPITESTANDADC_ModeADC_OFF ( 4)
+ #define DDRDATA3CH0_CR_DLLPITESTANDADC_ModeADC_WID ( 1)
+ #define DDRDATA3CH0_CR_DLLPITESTANDADC_ModeADC_MSK (0x00000010)
+ #define DDRDATA3CH0_CR_DLLPITESTANDADC_ModeADC_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DLLPITESTANDADC_ModeADC_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DLLPITESTANDADC_LoadCount_OFF ( 5)
+ #define DDRDATA3CH0_CR_DLLPITESTANDADC_LoadCount_WID (10)
+ #define DDRDATA3CH0_CR_DLLPITESTANDADC_LoadCount_MSK (0x00007FE0)
+ #define DDRDATA3CH0_CR_DLLPITESTANDADC_LoadCount_MAX (0x000003FF)
+ #define DDRDATA3CH0_CR_DLLPITESTANDADC_CountStatus_OFF (15)
+ #define DDRDATA3CH0_CR_DLLPITESTANDADC_CountStatus_WID (10)
+ #define DDRDATA3CH0_CR_DLLPITESTANDADC_CountStatus_MSK (0x01FF8000)
+ #define DDRDATA3CH0_CR_DLLPITESTANDADC_CountStatus_MAX (0x000003FF)
+ #define DDRDATA3CH0_CR_DLLPITESTANDADC_CountStatus_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DLLPITESTANDADC_Spare_OFF (25)
+ #define DDRDATA3CH0_CR_DLLPITESTANDADC_Spare_WID ( 7)
+ #define DDRDATA3CH0_CR_DLLPITESTANDADC_Spare_MSK (0xFE000000)
+ #define DDRDATA3CH0_CR_DLLPITESTANDADC_Spare_MAX (0x0000007F)
+
+#define DDRDATA3CH0_CR_DDRCRDATAOFFSETCOMP_REG (0x0000065C)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_OFF ( 0)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_WID ( 6)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_MSK (0x0000003F)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_MAX (0x0000003F)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_OFF ( 6)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_WID ( 6)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_MSK (0x00000FC0)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_MAX (0x0000003F)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_OFF (12)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_WID ( 5)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_MSK (0x0001F000)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_MAX (0x0000001F)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_OFF (17)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_WID ( 5)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_MSK (0x003E0000)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_MAX (0x0000001F)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_OFF (22)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_WID ( 5)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_MSK (0x07C00000)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_MAX (0x0000001F)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_OFF (27)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_WID ( 5)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_MSK (0xF8000000)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_MAX (0x0000001F)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_DEF (0x00000000)
+
+#define DDRDATA3CH0_CR_DDRCRDATACONTROL1_REG (0x00000660)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_RefPi_OFF ( 0)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_RefPi_WID ( 4)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_RefPi_MSK (0x0000000F)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_RefPi_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_RefPi_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_DllMask_OFF ( 4)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_DllMask_WID ( 2)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_DllMask_MSK (0x00000030)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_DllMask_MAX (0x00000003)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_DllMask_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_DllWeakLock_OFF ( 6)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_DllWeakLock_WID ( 1)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_DllWeakLock_MSK (0x00000040)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_DllWeakLock_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_DllWeakLock_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_OFF ( 7)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_WID ( 3)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_MSK (0x00000380)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_MAX (0x00000007)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_OFF (10)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_WID ( 3)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_MSK (0x00001C00)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_MAX (0x00000007)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_OdtDelay_OFF (13)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_OdtDelay_WID ( 4)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_OdtDelay_MSK (0x0001E000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_OdtDelay_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_OdtDelay_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_OdtDuration_OFF (17)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_OdtDuration_WID ( 3)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_OdtDuration_MSK (0x000E0000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_OdtDuration_MAX (0x00000007)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_OdtDuration_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_OFF (20)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_WID ( 4)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_MSK (0x00F00000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_OFF (24)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_WID ( 3)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_MSK (0x07000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_MAX (0x00000007)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_OFF (27)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_WID ( 3)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_MSK (0x38000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_MAX (0x00000007)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_OFF (30)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_WID ( 1)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_MSK (0x40000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_Rsvd1_OFF (31)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_Rsvd1_WID ( 1)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_Rsvd1_MSK (0x80000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_Rsvd1_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL1_Rsvd1_DEF (0x00000000)
+
+#define DDRDATA3CH0_CR_DDRCRDATACONTROL2_REG (0x00000664)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_OFF ( 0)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_WID ( 5)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_MSK (0x0000001F)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_MAX (0x0000001F)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_OFF ( 5)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_WID ( 1)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_MSK (0x00000020)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL2_ForceRxOn_OFF ( 6)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL2_ForceRxOn_WID ( 1)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL2_ForceRxOn_MSK (0x00000040)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL2_ForceRxOn_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL2_ForceRxOn_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL2_LeakerComp_OFF ( 7)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL2_LeakerComp_WID ( 2)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL2_LeakerComp_MSK (0x00000180)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL2_LeakerComp_MAX (0x00000003)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL2_LeakerComp_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_OFF ( 9)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_WID ( 4)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_MSK (0x00001E00)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_MAX (0x0000000F)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_DEF (0x00000008)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_OFF (13)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_WID ( 5)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_MSK (0x0003E000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_MAX (0x0000001F)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_DEF (0x00000011)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_OFF (18)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_WID ( 1)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_MSK (0x00040000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL2_Spare_OFF (19)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL2_Spare_WID (13)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL2_Spare_MSK (0xFFF80000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL2_Spare_MAX (0x00001FFF)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL2_Spare_DEF (0x00000000)
+
+#define DDRDATA3CH0_CR_DDRCRVSSHIORVREFCONTROL_REG (0x0000066C)
+ #define DDRDATA3CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_OFF ( 0)
+ #define DDRDATA3CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_WID (24)
+ #define DDRDATA3CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_MSK (0x00FFFFFF)
+ #define DDRDATA3CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_MAX (0x00FFFFFF)
+ #define DDRDATA3CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_OFF (24)
+ #define DDRDATA3CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_WID ( 8)
+ #define DDRDATA3CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_MSK (0xFF000000)
+ #define DDRDATA3CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_MAX (0x000000FF)
+ #define DDRDATA3CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_DEF (0x00000000)
+
+#define DDRDATA3CH0_CR_DDRCRDATAOFFSETTRAIN_REG (0x00000670)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_OFF ( 0)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_WID ( 6)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_MSK (0x0000003F)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_MAX (0x0000003F)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_OFF ( 6)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_WID ( 6)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_MSK (0x00000FC0)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_MAX (0x0000003F)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_OFF (12)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_WID ( 6)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_MSK (0x0003F000)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_MAX (0x0000003F)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_OFF (18)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_WID ( 6)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_MSK (0x00FC0000)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_MAX (0x0000003F)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_OFF (24)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_WID ( 7)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_MSK (0x7F000000)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_MAX (0x0000007F)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_OFF (31)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_WID ( 1)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_MSK (0x80000000)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_DEF (0x00000000)
+
+#define DDRDATA3CH0_CR_DDRCRDATACONTROL0_REG (0x00000674)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_OFF ( 0)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_WID ( 1)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_MSK (0x00000001)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_OFF ( 1)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_WID ( 1)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_MSK (0x00000002)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_OFF ( 2)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_WID ( 1)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_MSK (0x00000004)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_OFF ( 3)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_WID ( 1)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_MSK (0x00000008)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_TxOn_OFF ( 4)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_TxOn_WID ( 1)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_TxOn_MSK (0x00000010)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_TxOn_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_TxOn_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_RfOn_OFF ( 5)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_RfOn_WID ( 1)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_RfOn_MSK (0x00000020)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_RfOn_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_RfOn_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_RxPiOn_OFF ( 6)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_RxPiOn_WID ( 1)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_RxPiOn_MSK (0x00000040)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_RxPiOn_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_RxPiOn_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_TxPiOn_OFF ( 7)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_TxPiOn_WID ( 1)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_TxPiOn_MSK (0x00000080)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_TxPiOn_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_TxPiOn_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_OFF ( 8)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_WID ( 1)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_MSK (0x00000100)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_OFF ( 9)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_WID ( 1)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_MSK (0x00000200)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_TxDisable_OFF (10)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_TxDisable_WID ( 1)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_TxDisable_MSK (0x00000400)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_TxDisable_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_TxDisable_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_RxDisable_OFF (11)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_RxDisable_WID ( 1)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_RxDisable_MSK (0x00000800)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_RxDisable_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_RxDisable_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_TxLong_OFF (12)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_TxLong_WID ( 1)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_TxLong_MSK (0x00001000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_TxLong_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_TxLong_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_OFF (13)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_WID ( 2)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_MSK (0x00006000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_MAX (0x00000003)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_RxReadPointer_OFF (15)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_RxReadPointer_WID ( 3)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_RxReadPointer_MSK (0x00038000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_RxReadPointer_MAX (0x00000007)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_RxReadPointer_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_OFF (18)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_WID ( 1)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_MSK (0x00040000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_OFF (19)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_WID ( 1)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_MSK (0x00080000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_ReadRFRd_OFF (20)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_ReadRFRd_WID ( 1)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_ReadRFRd_MSK (0x00100000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_ReadRFRd_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_ReadRFRd_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_ReadRFWr_OFF (21)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_ReadRFWr_WID ( 1)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_ReadRFWr_MSK (0x00200000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_ReadRFWr_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_ReadRFWr_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_ReadRFRank_OFF (22)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_ReadRFRank_WID ( 2)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_ReadRFRank_MSK (0x00C00000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_ReadRFRank_MAX (0x00000003)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_ReadRFRank_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_OFF (24)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_WID ( 1)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_MSK (0x01000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_OdtSampOff_OFF (25)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_OdtSampOff_WID ( 1)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_OdtSampOff_MSK (0x02000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_OdtSampOff_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_OdtSampOff_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_OFF (26)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_WID ( 1)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_MSK (0x04000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_OFF (27)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_WID ( 1)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_MSK (0x08000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_OFF (28)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_WID ( 1)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_MSK (0x10000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_OFF (29)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_WID ( 1)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_MSK (0x20000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_OFF (30)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_WID ( 1)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_MSK (0x40000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_OFF (31)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_WID ( 1)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_MSK (0x80000000)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_DEF (0x00000000)
+
+#define DDRDATA3CH0_CR_DDRCRVREFADJUST1_REG (0x00000678)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_OFF ( 0)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_WID ( 7)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_MSK (0x0000007F)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_MAX (0x0000007F)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_OFF ( 7)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_WID ( 7)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_MSK (0x00003F80)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_MAX (0x0000007F)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_OFF (14)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_WID ( 7)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_MSK (0x001FC000)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_MAX (0x0000007F)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_OFF (21)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_WID ( 1)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_MSK (0x00200000)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_OFF (22)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_WID ( 1)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_MSK (0x00400000)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_OFF (23)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_WID ( 1)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_MSK (0x00800000)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_OFF (24)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_WID ( 2)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_MSK (0x03000000)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_MAX (0x00000003)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_OFF (26)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_WID ( 1)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_MSK (0x04000000)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_Rsvd_OFF (27)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_Rsvd_WID ( 2)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_Rsvd_MSK (0x18000000)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_Rsvd_MAX (0x00000003)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_Rsvd_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_caSlowBW_OFF (29)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_caSlowBW_WID ( 1)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_caSlowBW_MSK (0x20000000)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_caSlowBW_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_caSlowBW_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_OFF (30)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_WID ( 1)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_MSK (0x40000000)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_DEF (0x00000000)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_OFF (31)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_WID ( 1)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_MSK (0x80000000)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_MAX (0x00000001)
+ #define DDRDATA3CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_DEF (0x00000000)
+
+#define DDRDATA3CH1_CR_RXTRAINRANK0_REG (0x00000700)
+ #define DDRDATA3CH1_CR_RXTRAINRANK0_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA3CH1_CR_RXTRAINRANK0_RxRcvEnPi_WID ( 9)
+ #define DDRDATA3CH1_CR_RXTRAINRANK0_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA3CH1_CR_RXTRAINRANK0_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA3CH1_CR_RXTRAINRANK0_RxDqsPPi_OFF ( 9)
+ #define DDRDATA3CH1_CR_RXTRAINRANK0_RxDqsPPi_WID ( 6)
+ #define DDRDATA3CH1_CR_RXTRAINRANK0_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA3CH1_CR_RXTRAINRANK0_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA3CH1_CR_RXTRAINRANK0_RxEq_OFF (15)
+ #define DDRDATA3CH1_CR_RXTRAINRANK0_RxEq_WID ( 5)
+ #define DDRDATA3CH1_CR_RXTRAINRANK0_RxEq_MSK (0x000F8000)
+ #define DDRDATA3CH1_CR_RXTRAINRANK0_RxEq_MAX (0x0000001F)
+ #define DDRDATA3CH1_CR_RXTRAINRANK0_RxDqsNPi_OFF (20)
+ #define DDRDATA3CH1_CR_RXTRAINRANK0_RxDqsNPi_WID ( 6)
+ #define DDRDATA3CH1_CR_RXTRAINRANK0_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA3CH1_CR_RXTRAINRANK0_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA3CH1_CR_RXTRAINRANK0_RxVref_OFF (26)
+ #define DDRDATA3CH1_CR_RXTRAINRANK0_RxVref_WID ( 6)
+ #define DDRDATA3CH1_CR_RXTRAINRANK0_RxVref_MSK (0xFC000000)
+ #define DDRDATA3CH1_CR_RXTRAINRANK0_RxVref_MAX (0x0000003F)
+
+#define DDRDATA3CH1_CR_RXTRAINRANK1_REG (0x00000704)
+ #define DDRDATA3CH1_CR_RXTRAINRANK1_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA3CH1_CR_RXTRAINRANK1_RxRcvEnPi_WID ( 9)
+ #define DDRDATA3CH1_CR_RXTRAINRANK1_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA3CH1_CR_RXTRAINRANK1_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA3CH1_CR_RXTRAINRANK1_RxDqsPPi_OFF ( 9)
+ #define DDRDATA3CH1_CR_RXTRAINRANK1_RxDqsPPi_WID ( 6)
+ #define DDRDATA3CH1_CR_RXTRAINRANK1_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA3CH1_CR_RXTRAINRANK1_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA3CH1_CR_RXTRAINRANK1_RxEq_OFF (15)
+ #define DDRDATA3CH1_CR_RXTRAINRANK1_RxEq_WID ( 5)
+ #define DDRDATA3CH1_CR_RXTRAINRANK1_RxEq_MSK (0x000F8000)
+ #define DDRDATA3CH1_CR_RXTRAINRANK1_RxEq_MAX (0x0000001F)
+ #define DDRDATA3CH1_CR_RXTRAINRANK1_RxDqsNPi_OFF (20)
+ #define DDRDATA3CH1_CR_RXTRAINRANK1_RxDqsNPi_WID ( 6)
+ #define DDRDATA3CH1_CR_RXTRAINRANK1_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA3CH1_CR_RXTRAINRANK1_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA3CH1_CR_RXTRAINRANK1_RxVref_OFF (26)
+ #define DDRDATA3CH1_CR_RXTRAINRANK1_RxVref_WID ( 6)
+ #define DDRDATA3CH1_CR_RXTRAINRANK1_RxVref_MSK (0xFC000000)
+ #define DDRDATA3CH1_CR_RXTRAINRANK1_RxVref_MAX (0x0000003F)
+
+#define DDRDATA3CH1_CR_RXTRAINRANK2_REG (0x00000708)
+ #define DDRDATA3CH1_CR_RXTRAINRANK2_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA3CH1_CR_RXTRAINRANK2_RxRcvEnPi_WID ( 9)
+ #define DDRDATA3CH1_CR_RXTRAINRANK2_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA3CH1_CR_RXTRAINRANK2_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA3CH1_CR_RXTRAINRANK2_RxDqsPPi_OFF ( 9)
+ #define DDRDATA3CH1_CR_RXTRAINRANK2_RxDqsPPi_WID ( 6)
+ #define DDRDATA3CH1_CR_RXTRAINRANK2_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA3CH1_CR_RXTRAINRANK2_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA3CH1_CR_RXTRAINRANK2_RxEq_OFF (15)
+ #define DDRDATA3CH1_CR_RXTRAINRANK2_RxEq_WID ( 5)
+ #define DDRDATA3CH1_CR_RXTRAINRANK2_RxEq_MSK (0x000F8000)
+ #define DDRDATA3CH1_CR_RXTRAINRANK2_RxEq_MAX (0x0000001F)
+ #define DDRDATA3CH1_CR_RXTRAINRANK2_RxDqsNPi_OFF (20)
+ #define DDRDATA3CH1_CR_RXTRAINRANK2_RxDqsNPi_WID ( 6)
+ #define DDRDATA3CH1_CR_RXTRAINRANK2_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA3CH1_CR_RXTRAINRANK2_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA3CH1_CR_RXTRAINRANK2_RxVref_OFF (26)
+ #define DDRDATA3CH1_CR_RXTRAINRANK2_RxVref_WID ( 6)
+ #define DDRDATA3CH1_CR_RXTRAINRANK2_RxVref_MSK (0xFC000000)
+ #define DDRDATA3CH1_CR_RXTRAINRANK2_RxVref_MAX (0x0000003F)
+
+#define DDRDATA3CH1_CR_RXTRAINRANK3_REG (0x0000070C)
+ #define DDRDATA3CH1_CR_RXTRAINRANK3_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA3CH1_CR_RXTRAINRANK3_RxRcvEnPi_WID ( 9)
+ #define DDRDATA3CH1_CR_RXTRAINRANK3_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA3CH1_CR_RXTRAINRANK3_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA3CH1_CR_RXTRAINRANK3_RxDqsPPi_OFF ( 9)
+ #define DDRDATA3CH1_CR_RXTRAINRANK3_RxDqsPPi_WID ( 6)
+ #define DDRDATA3CH1_CR_RXTRAINRANK3_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA3CH1_CR_RXTRAINRANK3_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA3CH1_CR_RXTRAINRANK3_RxEq_OFF (15)
+ #define DDRDATA3CH1_CR_RXTRAINRANK3_RxEq_WID ( 5)
+ #define DDRDATA3CH1_CR_RXTRAINRANK3_RxEq_MSK (0x000F8000)
+ #define DDRDATA3CH1_CR_RXTRAINRANK3_RxEq_MAX (0x0000001F)
+ #define DDRDATA3CH1_CR_RXTRAINRANK3_RxDqsNPi_OFF (20)
+ #define DDRDATA3CH1_CR_RXTRAINRANK3_RxDqsNPi_WID ( 6)
+ #define DDRDATA3CH1_CR_RXTRAINRANK3_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA3CH1_CR_RXTRAINRANK3_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA3CH1_CR_RXTRAINRANK3_RxVref_OFF (26)
+ #define DDRDATA3CH1_CR_RXTRAINRANK3_RxVref_WID ( 6)
+ #define DDRDATA3CH1_CR_RXTRAINRANK3_RxVref_MSK (0xFC000000)
+ #define DDRDATA3CH1_CR_RXTRAINRANK3_RxVref_MAX (0x0000003F)
+
+#define DDRDATA3CH1_CR_RXPERBITRANK0_REG (0x00000710)
+ #define DDRDATA3CH1_CR_RXPERBITRANK0_Lane0_OFF ( 0)
+ #define DDRDATA3CH1_CR_RXPERBITRANK0_Lane0_WID ( 4)
+ #define DDRDATA3CH1_CR_RXPERBITRANK0_Lane0_MSK (0x0000000F)
+ #define DDRDATA3CH1_CR_RXPERBITRANK0_Lane0_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_RXPERBITRANK0_Lane1_OFF ( 4)
+ #define DDRDATA3CH1_CR_RXPERBITRANK0_Lane1_WID ( 4)
+ #define DDRDATA3CH1_CR_RXPERBITRANK0_Lane1_MSK (0x000000F0)
+ #define DDRDATA3CH1_CR_RXPERBITRANK0_Lane1_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_RXPERBITRANK0_Lane2_OFF ( 8)
+ #define DDRDATA3CH1_CR_RXPERBITRANK0_Lane2_WID ( 4)
+ #define DDRDATA3CH1_CR_RXPERBITRANK0_Lane2_MSK (0x00000F00)
+ #define DDRDATA3CH1_CR_RXPERBITRANK0_Lane2_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_RXPERBITRANK0_Lane3_OFF (12)
+ #define DDRDATA3CH1_CR_RXPERBITRANK0_Lane3_WID ( 4)
+ #define DDRDATA3CH1_CR_RXPERBITRANK0_Lane3_MSK (0x0000F000)
+ #define DDRDATA3CH1_CR_RXPERBITRANK0_Lane3_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_RXPERBITRANK0_Lane4_OFF (16)
+ #define DDRDATA3CH1_CR_RXPERBITRANK0_Lane4_WID ( 4)
+ #define DDRDATA3CH1_CR_RXPERBITRANK0_Lane4_MSK (0x000F0000)
+ #define DDRDATA3CH1_CR_RXPERBITRANK0_Lane4_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_RXPERBITRANK0_Lane5_OFF (20)
+ #define DDRDATA3CH1_CR_RXPERBITRANK0_Lane5_WID ( 4)
+ #define DDRDATA3CH1_CR_RXPERBITRANK0_Lane5_MSK (0x00F00000)
+ #define DDRDATA3CH1_CR_RXPERBITRANK0_Lane5_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_RXPERBITRANK0_Lane6_OFF (24)
+ #define DDRDATA3CH1_CR_RXPERBITRANK0_Lane6_WID ( 4)
+ #define DDRDATA3CH1_CR_RXPERBITRANK0_Lane6_MSK (0x0F000000)
+ #define DDRDATA3CH1_CR_RXPERBITRANK0_Lane6_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_RXPERBITRANK0_Lane7_OFF (28)
+ #define DDRDATA3CH1_CR_RXPERBITRANK0_Lane7_WID ( 4)
+ #define DDRDATA3CH1_CR_RXPERBITRANK0_Lane7_MSK (0xF0000000)
+ #define DDRDATA3CH1_CR_RXPERBITRANK0_Lane7_MAX (0x0000000F)
+
+#define DDRDATA3CH1_CR_RXPERBITRANK1_REG (0x00000714)
+ #define DDRDATA3CH1_CR_RXPERBITRANK1_Lane0_OFF ( 0)
+ #define DDRDATA3CH1_CR_RXPERBITRANK1_Lane0_WID ( 4)
+ #define DDRDATA3CH1_CR_RXPERBITRANK1_Lane0_MSK (0x0000000F)
+ #define DDRDATA3CH1_CR_RXPERBITRANK1_Lane0_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_RXPERBITRANK1_Lane1_OFF ( 4)
+ #define DDRDATA3CH1_CR_RXPERBITRANK1_Lane1_WID ( 4)
+ #define DDRDATA3CH1_CR_RXPERBITRANK1_Lane1_MSK (0x000000F0)
+ #define DDRDATA3CH1_CR_RXPERBITRANK1_Lane1_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_RXPERBITRANK1_Lane2_OFF ( 8)
+ #define DDRDATA3CH1_CR_RXPERBITRANK1_Lane2_WID ( 4)
+ #define DDRDATA3CH1_CR_RXPERBITRANK1_Lane2_MSK (0x00000F00)
+ #define DDRDATA3CH1_CR_RXPERBITRANK1_Lane2_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_RXPERBITRANK1_Lane3_OFF (12)
+ #define DDRDATA3CH1_CR_RXPERBITRANK1_Lane3_WID ( 4)
+ #define DDRDATA3CH1_CR_RXPERBITRANK1_Lane3_MSK (0x0000F000)
+ #define DDRDATA3CH1_CR_RXPERBITRANK1_Lane3_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_RXPERBITRANK1_Lane4_OFF (16)
+ #define DDRDATA3CH1_CR_RXPERBITRANK1_Lane4_WID ( 4)
+ #define DDRDATA3CH1_CR_RXPERBITRANK1_Lane4_MSK (0x000F0000)
+ #define DDRDATA3CH1_CR_RXPERBITRANK1_Lane4_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_RXPERBITRANK1_Lane5_OFF (20)
+ #define DDRDATA3CH1_CR_RXPERBITRANK1_Lane5_WID ( 4)
+ #define DDRDATA3CH1_CR_RXPERBITRANK1_Lane5_MSK (0x00F00000)
+ #define DDRDATA3CH1_CR_RXPERBITRANK1_Lane5_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_RXPERBITRANK1_Lane6_OFF (24)
+ #define DDRDATA3CH1_CR_RXPERBITRANK1_Lane6_WID ( 4)
+ #define DDRDATA3CH1_CR_RXPERBITRANK1_Lane6_MSK (0x0F000000)
+ #define DDRDATA3CH1_CR_RXPERBITRANK1_Lane6_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_RXPERBITRANK1_Lane7_OFF (28)
+ #define DDRDATA3CH1_CR_RXPERBITRANK1_Lane7_WID ( 4)
+ #define DDRDATA3CH1_CR_RXPERBITRANK1_Lane7_MSK (0xF0000000)
+ #define DDRDATA3CH1_CR_RXPERBITRANK1_Lane7_MAX (0x0000000F)
+
+#define DDRDATA3CH1_CR_RXPERBITRANK2_REG (0x00000718)
+ #define DDRDATA3CH1_CR_RXPERBITRANK2_Lane0_OFF ( 0)
+ #define DDRDATA3CH1_CR_RXPERBITRANK2_Lane0_WID ( 4)
+ #define DDRDATA3CH1_CR_RXPERBITRANK2_Lane0_MSK (0x0000000F)
+ #define DDRDATA3CH1_CR_RXPERBITRANK2_Lane0_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_RXPERBITRANK2_Lane1_OFF ( 4)
+ #define DDRDATA3CH1_CR_RXPERBITRANK2_Lane1_WID ( 4)
+ #define DDRDATA3CH1_CR_RXPERBITRANK2_Lane1_MSK (0x000000F0)
+ #define DDRDATA3CH1_CR_RXPERBITRANK2_Lane1_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_RXPERBITRANK2_Lane2_OFF ( 8)
+ #define DDRDATA3CH1_CR_RXPERBITRANK2_Lane2_WID ( 4)
+ #define DDRDATA3CH1_CR_RXPERBITRANK2_Lane2_MSK (0x00000F00)
+ #define DDRDATA3CH1_CR_RXPERBITRANK2_Lane2_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_RXPERBITRANK2_Lane3_OFF (12)
+ #define DDRDATA3CH1_CR_RXPERBITRANK2_Lane3_WID ( 4)
+ #define DDRDATA3CH1_CR_RXPERBITRANK2_Lane3_MSK (0x0000F000)
+ #define DDRDATA3CH1_CR_RXPERBITRANK2_Lane3_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_RXPERBITRANK2_Lane4_OFF (16)
+ #define DDRDATA3CH1_CR_RXPERBITRANK2_Lane4_WID ( 4)
+ #define DDRDATA3CH1_CR_RXPERBITRANK2_Lane4_MSK (0x000F0000)
+ #define DDRDATA3CH1_CR_RXPERBITRANK2_Lane4_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_RXPERBITRANK2_Lane5_OFF (20)
+ #define DDRDATA3CH1_CR_RXPERBITRANK2_Lane5_WID ( 4)
+ #define DDRDATA3CH1_CR_RXPERBITRANK2_Lane5_MSK (0x00F00000)
+ #define DDRDATA3CH1_CR_RXPERBITRANK2_Lane5_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_RXPERBITRANK2_Lane6_OFF (24)
+ #define DDRDATA3CH1_CR_RXPERBITRANK2_Lane6_WID ( 4)
+ #define DDRDATA3CH1_CR_RXPERBITRANK2_Lane6_MSK (0x0F000000)
+ #define DDRDATA3CH1_CR_RXPERBITRANK2_Lane6_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_RXPERBITRANK2_Lane7_OFF (28)
+ #define DDRDATA3CH1_CR_RXPERBITRANK2_Lane7_WID ( 4)
+ #define DDRDATA3CH1_CR_RXPERBITRANK2_Lane7_MSK (0xF0000000)
+ #define DDRDATA3CH1_CR_RXPERBITRANK2_Lane7_MAX (0x0000000F)
+
+#define DDRDATA3CH1_CR_RXPERBITRANK3_REG (0x0000071C)
+ #define DDRDATA3CH1_CR_RXPERBITRANK3_Lane0_OFF ( 0)
+ #define DDRDATA3CH1_CR_RXPERBITRANK3_Lane0_WID ( 4)
+ #define DDRDATA3CH1_CR_RXPERBITRANK3_Lane0_MSK (0x0000000F)
+ #define DDRDATA3CH1_CR_RXPERBITRANK3_Lane0_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_RXPERBITRANK3_Lane1_OFF ( 4)
+ #define DDRDATA3CH1_CR_RXPERBITRANK3_Lane1_WID ( 4)
+ #define DDRDATA3CH1_CR_RXPERBITRANK3_Lane1_MSK (0x000000F0)
+ #define DDRDATA3CH1_CR_RXPERBITRANK3_Lane1_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_RXPERBITRANK3_Lane2_OFF ( 8)
+ #define DDRDATA3CH1_CR_RXPERBITRANK3_Lane2_WID ( 4)
+ #define DDRDATA3CH1_CR_RXPERBITRANK3_Lane2_MSK (0x00000F00)
+ #define DDRDATA3CH1_CR_RXPERBITRANK3_Lane2_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_RXPERBITRANK3_Lane3_OFF (12)
+ #define DDRDATA3CH1_CR_RXPERBITRANK3_Lane3_WID ( 4)
+ #define DDRDATA3CH1_CR_RXPERBITRANK3_Lane3_MSK (0x0000F000)
+ #define DDRDATA3CH1_CR_RXPERBITRANK3_Lane3_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_RXPERBITRANK3_Lane4_OFF (16)
+ #define DDRDATA3CH1_CR_RXPERBITRANK3_Lane4_WID ( 4)
+ #define DDRDATA3CH1_CR_RXPERBITRANK3_Lane4_MSK (0x000F0000)
+ #define DDRDATA3CH1_CR_RXPERBITRANK3_Lane4_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_RXPERBITRANK3_Lane5_OFF (20)
+ #define DDRDATA3CH1_CR_RXPERBITRANK3_Lane5_WID ( 4)
+ #define DDRDATA3CH1_CR_RXPERBITRANK3_Lane5_MSK (0x00F00000)
+ #define DDRDATA3CH1_CR_RXPERBITRANK3_Lane5_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_RXPERBITRANK3_Lane6_OFF (24)
+ #define DDRDATA3CH1_CR_RXPERBITRANK3_Lane6_WID ( 4)
+ #define DDRDATA3CH1_CR_RXPERBITRANK3_Lane6_MSK (0x0F000000)
+ #define DDRDATA3CH1_CR_RXPERBITRANK3_Lane6_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_RXPERBITRANK3_Lane7_OFF (28)
+ #define DDRDATA3CH1_CR_RXPERBITRANK3_Lane7_WID ( 4)
+ #define DDRDATA3CH1_CR_RXPERBITRANK3_Lane7_MSK (0xF0000000)
+ #define DDRDATA3CH1_CR_RXPERBITRANK3_Lane7_MAX (0x0000000F)
+
+#define DDRDATA3CH1_CR_TXTRAINRANK0_REG (0x00000720)
+ #define DDRDATA3CH1_CR_TXTRAINRANK0_TxDqDelay_OFF ( 0)
+ #define DDRDATA3CH1_CR_TXTRAINRANK0_TxDqDelay_WID ( 9)
+ #define DDRDATA3CH1_CR_TXTRAINRANK0_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA3CH1_CR_TXTRAINRANK0_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA3CH1_CR_TXTRAINRANK0_TxDqsDelay_OFF ( 9)
+ #define DDRDATA3CH1_CR_TXTRAINRANK0_TxDqsDelay_WID ( 9)
+ #define DDRDATA3CH1_CR_TXTRAINRANK0_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA3CH1_CR_TXTRAINRANK0_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA3CH1_CR_TXTRAINRANK0_Spare0_OFF (18)
+ #define DDRDATA3CH1_CR_TXTRAINRANK0_Spare0_WID ( 2)
+ #define DDRDATA3CH1_CR_TXTRAINRANK0_Spare0_MSK (0x000C0000)
+ #define DDRDATA3CH1_CR_TXTRAINRANK0_Spare0_MAX (0x00000003)
+ #define DDRDATA3CH1_CR_TXTRAINRANK0_TxEqualization_OFF (20)
+ #define DDRDATA3CH1_CR_TXTRAINRANK0_TxEqualization_WID ( 6)
+ #define DDRDATA3CH1_CR_TXTRAINRANK0_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA3CH1_CR_TXTRAINRANK0_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA3CH1_CR_TXTRAINRANK0_Spare1_OFF (26)
+ #define DDRDATA3CH1_CR_TXTRAINRANK0_Spare1_WID ( 6)
+ #define DDRDATA3CH1_CR_TXTRAINRANK0_Spare1_MSK (0xFC000000)
+ #define DDRDATA3CH1_CR_TXTRAINRANK0_Spare1_MAX (0x0000003F)
+
+#define DDRDATA3CH1_CR_TXTRAINRANK1_REG (0x00000724)
+ #define DDRDATA3CH1_CR_TXTRAINRANK1_TxDqDelay_OFF ( 0)
+ #define DDRDATA3CH1_CR_TXTRAINRANK1_TxDqDelay_WID ( 9)
+ #define DDRDATA3CH1_CR_TXTRAINRANK1_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA3CH1_CR_TXTRAINRANK1_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA3CH1_CR_TXTRAINRANK1_TxDqsDelay_OFF ( 9)
+ #define DDRDATA3CH1_CR_TXTRAINRANK1_TxDqsDelay_WID ( 9)
+ #define DDRDATA3CH1_CR_TXTRAINRANK1_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA3CH1_CR_TXTRAINRANK1_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA3CH1_CR_TXTRAINRANK1_Spare0_OFF (18)
+ #define DDRDATA3CH1_CR_TXTRAINRANK1_Spare0_WID ( 2)
+ #define DDRDATA3CH1_CR_TXTRAINRANK1_Spare0_MSK (0x000C0000)
+ #define DDRDATA3CH1_CR_TXTRAINRANK1_Spare0_MAX (0x00000003)
+ #define DDRDATA3CH1_CR_TXTRAINRANK1_TxEqualization_OFF (20)
+ #define DDRDATA3CH1_CR_TXTRAINRANK1_TxEqualization_WID ( 6)
+ #define DDRDATA3CH1_CR_TXTRAINRANK1_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA3CH1_CR_TXTRAINRANK1_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA3CH1_CR_TXTRAINRANK1_Spare1_OFF (26)
+ #define DDRDATA3CH1_CR_TXTRAINRANK1_Spare1_WID ( 6)
+ #define DDRDATA3CH1_CR_TXTRAINRANK1_Spare1_MSK (0xFC000000)
+ #define DDRDATA3CH1_CR_TXTRAINRANK1_Spare1_MAX (0x0000003F)
+
+#define DDRDATA3CH1_CR_TXTRAINRANK2_REG (0x00000728)
+ #define DDRDATA3CH1_CR_TXTRAINRANK2_TxDqDelay_OFF ( 0)
+ #define DDRDATA3CH1_CR_TXTRAINRANK2_TxDqDelay_WID ( 9)
+ #define DDRDATA3CH1_CR_TXTRAINRANK2_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA3CH1_CR_TXTRAINRANK2_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA3CH1_CR_TXTRAINRANK2_TxDqsDelay_OFF ( 9)
+ #define DDRDATA3CH1_CR_TXTRAINRANK2_TxDqsDelay_WID ( 9)
+ #define DDRDATA3CH1_CR_TXTRAINRANK2_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA3CH1_CR_TXTRAINRANK2_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA3CH1_CR_TXTRAINRANK2_Spare0_OFF (18)
+ #define DDRDATA3CH1_CR_TXTRAINRANK2_Spare0_WID ( 2)
+ #define DDRDATA3CH1_CR_TXTRAINRANK2_Spare0_MSK (0x000C0000)
+ #define DDRDATA3CH1_CR_TXTRAINRANK2_Spare0_MAX (0x00000003)
+ #define DDRDATA3CH1_CR_TXTRAINRANK2_TxEqualization_OFF (20)
+ #define DDRDATA3CH1_CR_TXTRAINRANK2_TxEqualization_WID ( 6)
+ #define DDRDATA3CH1_CR_TXTRAINRANK2_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA3CH1_CR_TXTRAINRANK2_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA3CH1_CR_TXTRAINRANK2_Spare1_OFF (26)
+ #define DDRDATA3CH1_CR_TXTRAINRANK2_Spare1_WID ( 6)
+ #define DDRDATA3CH1_CR_TXTRAINRANK2_Spare1_MSK (0xFC000000)
+ #define DDRDATA3CH1_CR_TXTRAINRANK2_Spare1_MAX (0x0000003F)
+
+#define DDRDATA3CH1_CR_TXTRAINRANK3_REG (0x0000072C)
+ #define DDRDATA3CH1_CR_TXTRAINRANK3_TxDqDelay_OFF ( 0)
+ #define DDRDATA3CH1_CR_TXTRAINRANK3_TxDqDelay_WID ( 9)
+ #define DDRDATA3CH1_CR_TXTRAINRANK3_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA3CH1_CR_TXTRAINRANK3_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA3CH1_CR_TXTRAINRANK3_TxDqsDelay_OFF ( 9)
+ #define DDRDATA3CH1_CR_TXTRAINRANK3_TxDqsDelay_WID ( 9)
+ #define DDRDATA3CH1_CR_TXTRAINRANK3_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA3CH1_CR_TXTRAINRANK3_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA3CH1_CR_TXTRAINRANK3_Spare0_OFF (18)
+ #define DDRDATA3CH1_CR_TXTRAINRANK3_Spare0_WID ( 2)
+ #define DDRDATA3CH1_CR_TXTRAINRANK3_Spare0_MSK (0x000C0000)
+ #define DDRDATA3CH1_CR_TXTRAINRANK3_Spare0_MAX (0x00000003)
+ #define DDRDATA3CH1_CR_TXTRAINRANK3_TxEqualization_OFF (20)
+ #define DDRDATA3CH1_CR_TXTRAINRANK3_TxEqualization_WID ( 6)
+ #define DDRDATA3CH1_CR_TXTRAINRANK3_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA3CH1_CR_TXTRAINRANK3_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA3CH1_CR_TXTRAINRANK3_Spare1_OFF (26)
+ #define DDRDATA3CH1_CR_TXTRAINRANK3_Spare1_WID ( 6)
+ #define DDRDATA3CH1_CR_TXTRAINRANK3_Spare1_MSK (0xFC000000)
+ #define DDRDATA3CH1_CR_TXTRAINRANK3_Spare1_MAX (0x0000003F)
+
+#define DDRDATA3CH1_CR_TXPERBITRANK0_REG (0x00000730)
+ #define DDRDATA3CH1_CR_TXPERBITRANK0_Lane0_OFF ( 0)
+ #define DDRDATA3CH1_CR_TXPERBITRANK0_Lane0_WID ( 4)
+ #define DDRDATA3CH1_CR_TXPERBITRANK0_Lane0_MSK (0x0000000F)
+ #define DDRDATA3CH1_CR_TXPERBITRANK0_Lane0_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_TXPERBITRANK0_Lane1_OFF ( 4)
+ #define DDRDATA3CH1_CR_TXPERBITRANK0_Lane1_WID ( 4)
+ #define DDRDATA3CH1_CR_TXPERBITRANK0_Lane1_MSK (0x000000F0)
+ #define DDRDATA3CH1_CR_TXPERBITRANK0_Lane1_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_TXPERBITRANK0_Lane2_OFF ( 8)
+ #define DDRDATA3CH1_CR_TXPERBITRANK0_Lane2_WID ( 4)
+ #define DDRDATA3CH1_CR_TXPERBITRANK0_Lane2_MSK (0x00000F00)
+ #define DDRDATA3CH1_CR_TXPERBITRANK0_Lane2_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_TXPERBITRANK0_Lane3_OFF (12)
+ #define DDRDATA3CH1_CR_TXPERBITRANK0_Lane3_WID ( 4)
+ #define DDRDATA3CH1_CR_TXPERBITRANK0_Lane3_MSK (0x0000F000)
+ #define DDRDATA3CH1_CR_TXPERBITRANK0_Lane3_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_TXPERBITRANK0_Lane4_OFF (16)
+ #define DDRDATA3CH1_CR_TXPERBITRANK0_Lane4_WID ( 4)
+ #define DDRDATA3CH1_CR_TXPERBITRANK0_Lane4_MSK (0x000F0000)
+ #define DDRDATA3CH1_CR_TXPERBITRANK0_Lane4_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_TXPERBITRANK0_Lane5_OFF (20)
+ #define DDRDATA3CH1_CR_TXPERBITRANK0_Lane5_WID ( 4)
+ #define DDRDATA3CH1_CR_TXPERBITRANK0_Lane5_MSK (0x00F00000)
+ #define DDRDATA3CH1_CR_TXPERBITRANK0_Lane5_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_TXPERBITRANK0_Lane6_OFF (24)
+ #define DDRDATA3CH1_CR_TXPERBITRANK0_Lane6_WID ( 4)
+ #define DDRDATA3CH1_CR_TXPERBITRANK0_Lane6_MSK (0x0F000000)
+ #define DDRDATA3CH1_CR_TXPERBITRANK0_Lane6_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_TXPERBITRANK0_Lane7_OFF (28)
+ #define DDRDATA3CH1_CR_TXPERBITRANK0_Lane7_WID ( 4)
+ #define DDRDATA3CH1_CR_TXPERBITRANK0_Lane7_MSK (0xF0000000)
+ #define DDRDATA3CH1_CR_TXPERBITRANK0_Lane7_MAX (0x0000000F)
+
+#define DDRDATA3CH1_CR_TXPERBITRANK1_REG (0x00000734)
+ #define DDRDATA3CH1_CR_TXPERBITRANK1_Lane0_OFF ( 0)
+ #define DDRDATA3CH1_CR_TXPERBITRANK1_Lane0_WID ( 4)
+ #define DDRDATA3CH1_CR_TXPERBITRANK1_Lane0_MSK (0x0000000F)
+ #define DDRDATA3CH1_CR_TXPERBITRANK1_Lane0_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_TXPERBITRANK1_Lane1_OFF ( 4)
+ #define DDRDATA3CH1_CR_TXPERBITRANK1_Lane1_WID ( 4)
+ #define DDRDATA3CH1_CR_TXPERBITRANK1_Lane1_MSK (0x000000F0)
+ #define DDRDATA3CH1_CR_TXPERBITRANK1_Lane1_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_TXPERBITRANK1_Lane2_OFF ( 8)
+ #define DDRDATA3CH1_CR_TXPERBITRANK1_Lane2_WID ( 4)
+ #define DDRDATA3CH1_CR_TXPERBITRANK1_Lane2_MSK (0x00000F00)
+ #define DDRDATA3CH1_CR_TXPERBITRANK1_Lane2_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_TXPERBITRANK1_Lane3_OFF (12)
+ #define DDRDATA3CH1_CR_TXPERBITRANK1_Lane3_WID ( 4)
+ #define DDRDATA3CH1_CR_TXPERBITRANK1_Lane3_MSK (0x0000F000)
+ #define DDRDATA3CH1_CR_TXPERBITRANK1_Lane3_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_TXPERBITRANK1_Lane4_OFF (16)
+ #define DDRDATA3CH1_CR_TXPERBITRANK1_Lane4_WID ( 4)
+ #define DDRDATA3CH1_CR_TXPERBITRANK1_Lane4_MSK (0x000F0000)
+ #define DDRDATA3CH1_CR_TXPERBITRANK1_Lane4_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_TXPERBITRANK1_Lane5_OFF (20)
+ #define DDRDATA3CH1_CR_TXPERBITRANK1_Lane5_WID ( 4)
+ #define DDRDATA3CH1_CR_TXPERBITRANK1_Lane5_MSK (0x00F00000)
+ #define DDRDATA3CH1_CR_TXPERBITRANK1_Lane5_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_TXPERBITRANK1_Lane6_OFF (24)
+ #define DDRDATA3CH1_CR_TXPERBITRANK1_Lane6_WID ( 4)
+ #define DDRDATA3CH1_CR_TXPERBITRANK1_Lane6_MSK (0x0F000000)
+ #define DDRDATA3CH1_CR_TXPERBITRANK1_Lane6_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_TXPERBITRANK1_Lane7_OFF (28)
+ #define DDRDATA3CH1_CR_TXPERBITRANK1_Lane7_WID ( 4)
+ #define DDRDATA3CH1_CR_TXPERBITRANK1_Lane7_MSK (0xF0000000)
+ #define DDRDATA3CH1_CR_TXPERBITRANK1_Lane7_MAX (0x0000000F)
+
+#define DDRDATA3CH1_CR_TXPERBITRANK2_REG (0x00000738)
+ #define DDRDATA3CH1_CR_TXPERBITRANK2_Lane0_OFF ( 0)
+ #define DDRDATA3CH1_CR_TXPERBITRANK2_Lane0_WID ( 4)
+ #define DDRDATA3CH1_CR_TXPERBITRANK2_Lane0_MSK (0x0000000F)
+ #define DDRDATA3CH1_CR_TXPERBITRANK2_Lane0_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_TXPERBITRANK2_Lane1_OFF ( 4)
+ #define DDRDATA3CH1_CR_TXPERBITRANK2_Lane1_WID ( 4)
+ #define DDRDATA3CH1_CR_TXPERBITRANK2_Lane1_MSK (0x000000F0)
+ #define DDRDATA3CH1_CR_TXPERBITRANK2_Lane1_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_TXPERBITRANK2_Lane2_OFF ( 8)
+ #define DDRDATA3CH1_CR_TXPERBITRANK2_Lane2_WID ( 4)
+ #define DDRDATA3CH1_CR_TXPERBITRANK2_Lane2_MSK (0x00000F00)
+ #define DDRDATA3CH1_CR_TXPERBITRANK2_Lane2_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_TXPERBITRANK2_Lane3_OFF (12)
+ #define DDRDATA3CH1_CR_TXPERBITRANK2_Lane3_WID ( 4)
+ #define DDRDATA3CH1_CR_TXPERBITRANK2_Lane3_MSK (0x0000F000)
+ #define DDRDATA3CH1_CR_TXPERBITRANK2_Lane3_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_TXPERBITRANK2_Lane4_OFF (16)
+ #define DDRDATA3CH1_CR_TXPERBITRANK2_Lane4_WID ( 4)
+ #define DDRDATA3CH1_CR_TXPERBITRANK2_Lane4_MSK (0x000F0000)
+ #define DDRDATA3CH1_CR_TXPERBITRANK2_Lane4_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_TXPERBITRANK2_Lane5_OFF (20)
+ #define DDRDATA3CH1_CR_TXPERBITRANK2_Lane5_WID ( 4)
+ #define DDRDATA3CH1_CR_TXPERBITRANK2_Lane5_MSK (0x00F00000)
+ #define DDRDATA3CH1_CR_TXPERBITRANK2_Lane5_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_TXPERBITRANK2_Lane6_OFF (24)
+ #define DDRDATA3CH1_CR_TXPERBITRANK2_Lane6_WID ( 4)
+ #define DDRDATA3CH1_CR_TXPERBITRANK2_Lane6_MSK (0x0F000000)
+ #define DDRDATA3CH1_CR_TXPERBITRANK2_Lane6_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_TXPERBITRANK2_Lane7_OFF (28)
+ #define DDRDATA3CH1_CR_TXPERBITRANK2_Lane7_WID ( 4)
+ #define DDRDATA3CH1_CR_TXPERBITRANK2_Lane7_MSK (0xF0000000)
+ #define DDRDATA3CH1_CR_TXPERBITRANK2_Lane7_MAX (0x0000000F)
+
+#define DDRDATA3CH1_CR_TXPERBITRANK3_REG (0x0000073C)
+ #define DDRDATA3CH1_CR_TXPERBITRANK3_Lane0_OFF ( 0)
+ #define DDRDATA3CH1_CR_TXPERBITRANK3_Lane0_WID ( 4)
+ #define DDRDATA3CH1_CR_TXPERBITRANK3_Lane0_MSK (0x0000000F)
+ #define DDRDATA3CH1_CR_TXPERBITRANK3_Lane0_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_TXPERBITRANK3_Lane1_OFF ( 4)
+ #define DDRDATA3CH1_CR_TXPERBITRANK3_Lane1_WID ( 4)
+ #define DDRDATA3CH1_CR_TXPERBITRANK3_Lane1_MSK (0x000000F0)
+ #define DDRDATA3CH1_CR_TXPERBITRANK3_Lane1_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_TXPERBITRANK3_Lane2_OFF ( 8)
+ #define DDRDATA3CH1_CR_TXPERBITRANK3_Lane2_WID ( 4)
+ #define DDRDATA3CH1_CR_TXPERBITRANK3_Lane2_MSK (0x00000F00)
+ #define DDRDATA3CH1_CR_TXPERBITRANK3_Lane2_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_TXPERBITRANK3_Lane3_OFF (12)
+ #define DDRDATA3CH1_CR_TXPERBITRANK3_Lane3_WID ( 4)
+ #define DDRDATA3CH1_CR_TXPERBITRANK3_Lane3_MSK (0x0000F000)
+ #define DDRDATA3CH1_CR_TXPERBITRANK3_Lane3_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_TXPERBITRANK3_Lane4_OFF (16)
+ #define DDRDATA3CH1_CR_TXPERBITRANK3_Lane4_WID ( 4)
+ #define DDRDATA3CH1_CR_TXPERBITRANK3_Lane4_MSK (0x000F0000)
+ #define DDRDATA3CH1_CR_TXPERBITRANK3_Lane4_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_TXPERBITRANK3_Lane5_OFF (20)
+ #define DDRDATA3CH1_CR_TXPERBITRANK3_Lane5_WID ( 4)
+ #define DDRDATA3CH1_CR_TXPERBITRANK3_Lane5_MSK (0x00F00000)
+ #define DDRDATA3CH1_CR_TXPERBITRANK3_Lane5_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_TXPERBITRANK3_Lane6_OFF (24)
+ #define DDRDATA3CH1_CR_TXPERBITRANK3_Lane6_WID ( 4)
+ #define DDRDATA3CH1_CR_TXPERBITRANK3_Lane6_MSK (0x0F000000)
+ #define DDRDATA3CH1_CR_TXPERBITRANK3_Lane6_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_TXPERBITRANK3_Lane7_OFF (28)
+ #define DDRDATA3CH1_CR_TXPERBITRANK3_Lane7_WID ( 4)
+ #define DDRDATA3CH1_CR_TXPERBITRANK3_Lane7_MSK (0xF0000000)
+ #define DDRDATA3CH1_CR_TXPERBITRANK3_Lane7_MAX (0x0000000F)
+
+#define DDRDATA3CH1_CR_RCOMPDATA0_REG (0x00000740)
+ #define DDRDATA3CH1_CR_RCOMPDATA0_RcompDrvUp_OFF ( 0)
+ #define DDRDATA3CH1_CR_RCOMPDATA0_RcompDrvUp_WID ( 6)
+ #define DDRDATA3CH1_CR_RCOMPDATA0_RcompDrvUp_MSK (0x0000003F)
+ #define DDRDATA3CH1_CR_RCOMPDATA0_RcompDrvUp_MAX (0x0000003F)
+ #define DDRDATA3CH1_CR_RCOMPDATA0_Spare0_OFF ( 6)
+ #define DDRDATA3CH1_CR_RCOMPDATA0_Spare0_WID ( 3)
+ #define DDRDATA3CH1_CR_RCOMPDATA0_Spare0_MSK (0x000001C0)
+ #define DDRDATA3CH1_CR_RCOMPDATA0_Spare0_MAX (0x00000007)
+ #define DDRDATA3CH1_CR_RCOMPDATA0_RcompDrvDown_OFF ( 9)
+ #define DDRDATA3CH1_CR_RCOMPDATA0_RcompDrvDown_WID ( 6)
+ #define DDRDATA3CH1_CR_RCOMPDATA0_RcompDrvDown_MSK (0x00007E00)
+ #define DDRDATA3CH1_CR_RCOMPDATA0_RcompDrvDown_MAX (0x0000003F)
+ #define DDRDATA3CH1_CR_RCOMPDATA0_VTComp_OFF (15)
+ #define DDRDATA3CH1_CR_RCOMPDATA0_VTComp_WID ( 5)
+ #define DDRDATA3CH1_CR_RCOMPDATA0_VTComp_MSK (0x000F8000)
+ #define DDRDATA3CH1_CR_RCOMPDATA0_VTComp_MAX (0x0000001F)
+ #define DDRDATA3CH1_CR_RCOMPDATA0_TcoComp_OFF (20)
+ #define DDRDATA3CH1_CR_RCOMPDATA0_TcoComp_WID ( 6)
+ #define DDRDATA3CH1_CR_RCOMPDATA0_TcoComp_MSK (0x03F00000)
+ #define DDRDATA3CH1_CR_RCOMPDATA0_TcoComp_MAX (0x0000003F)
+ #define DDRDATA3CH1_CR_RCOMPDATA0_SlewRateComp_OFF (26)
+ #define DDRDATA3CH1_CR_RCOMPDATA0_SlewRateComp_WID ( 5)
+ #define DDRDATA3CH1_CR_RCOMPDATA0_SlewRateComp_MSK (0x7C000000)
+ #define DDRDATA3CH1_CR_RCOMPDATA0_SlewRateComp_MAX (0x0000001F)
+ #define DDRDATA3CH1_CR_RCOMPDATA0_Spare2_OFF (31)
+ #define DDRDATA3CH1_CR_RCOMPDATA0_Spare2_WID ( 1)
+ #define DDRDATA3CH1_CR_RCOMPDATA0_Spare2_MSK (0x80000000)
+ #define DDRDATA3CH1_CR_RCOMPDATA0_Spare2_MAX (0x00000001)
+
+#define DDRDATA3CH1_CR_RCOMPDATA1_REG (0x00000744)
+ #define DDRDATA3CH1_CR_RCOMPDATA1_RcompOdtUp_OFF ( 0)
+ #define DDRDATA3CH1_CR_RCOMPDATA1_RcompOdtUp_WID ( 6)
+ #define DDRDATA3CH1_CR_RCOMPDATA1_RcompOdtUp_MSK (0x0000003F)
+ #define DDRDATA3CH1_CR_RCOMPDATA1_RcompOdtUp_MAX (0x0000003F)
+ #define DDRDATA3CH1_CR_RCOMPDATA1_Spare0_OFF ( 6)
+ #define DDRDATA3CH1_CR_RCOMPDATA1_Spare0_WID ( 3)
+ #define DDRDATA3CH1_CR_RCOMPDATA1_Spare0_MSK (0x000001C0)
+ #define DDRDATA3CH1_CR_RCOMPDATA1_Spare0_MAX (0x00000007)
+ #define DDRDATA3CH1_CR_RCOMPDATA1_RcompOdtDown_OFF ( 9)
+ #define DDRDATA3CH1_CR_RCOMPDATA1_RcompOdtDown_WID ( 6)
+ #define DDRDATA3CH1_CR_RCOMPDATA1_RcompOdtDown_MSK (0x00007E00)
+ #define DDRDATA3CH1_CR_RCOMPDATA1_RcompOdtDown_MAX (0x0000003F)
+ #define DDRDATA3CH1_CR_RCOMPDATA1_Spare1_OFF (15)
+ #define DDRDATA3CH1_CR_RCOMPDATA1_Spare1_WID ( 1)
+ #define DDRDATA3CH1_CR_RCOMPDATA1_Spare1_MSK (0x00008000)
+ #define DDRDATA3CH1_CR_RCOMPDATA1_Spare1_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_RCOMPDATA1_PanicDrvDn_OFF (16)
+ #define DDRDATA3CH1_CR_RCOMPDATA1_PanicDrvDn_WID ( 6)
+ #define DDRDATA3CH1_CR_RCOMPDATA1_PanicDrvDn_MSK (0x003F0000)
+ #define DDRDATA3CH1_CR_RCOMPDATA1_PanicDrvDn_MAX (0x0000003F)
+ #define DDRDATA3CH1_CR_RCOMPDATA1_PanicDrvUp_OFF (22)
+ #define DDRDATA3CH1_CR_RCOMPDATA1_PanicDrvUp_WID ( 6)
+ #define DDRDATA3CH1_CR_RCOMPDATA1_PanicDrvUp_MSK (0x0FC00000)
+ #define DDRDATA3CH1_CR_RCOMPDATA1_PanicDrvUp_MAX (0x0000003F)
+ #define DDRDATA3CH1_CR_RCOMPDATA1_LevelShifterComp_OFF (28)
+ #define DDRDATA3CH1_CR_RCOMPDATA1_LevelShifterComp_WID ( 3)
+ #define DDRDATA3CH1_CR_RCOMPDATA1_LevelShifterComp_MSK (0x70000000)
+ #define DDRDATA3CH1_CR_RCOMPDATA1_LevelShifterComp_MAX (0x00000007)
+ #define DDRDATA3CH1_CR_RCOMPDATA1_Spare2_OFF (31)
+ #define DDRDATA3CH1_CR_RCOMPDATA1_Spare2_WID ( 1)
+ #define DDRDATA3CH1_CR_RCOMPDATA1_Spare2_MSK (0x80000000)
+ #define DDRDATA3CH1_CR_RCOMPDATA1_Spare2_MAX (0x00000001)
+
+#define DDRDATA3CH1_CR_TXXTALK_REG (0x00000748)
+ #define DDRDATA3CH1_CR_TXXTALK_Lane0_OFF ( 0)
+ #define DDRDATA3CH1_CR_TXXTALK_Lane0_WID ( 4)
+ #define DDRDATA3CH1_CR_TXXTALK_Lane0_MSK (0x0000000F)
+ #define DDRDATA3CH1_CR_TXXTALK_Lane0_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_TXXTALK_Lane1_OFF ( 4)
+ #define DDRDATA3CH1_CR_TXXTALK_Lane1_WID ( 4)
+ #define DDRDATA3CH1_CR_TXXTALK_Lane1_MSK (0x000000F0)
+ #define DDRDATA3CH1_CR_TXXTALK_Lane1_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_TXXTALK_Lane2_OFF ( 8)
+ #define DDRDATA3CH1_CR_TXXTALK_Lane2_WID ( 4)
+ #define DDRDATA3CH1_CR_TXXTALK_Lane2_MSK (0x00000F00)
+ #define DDRDATA3CH1_CR_TXXTALK_Lane2_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_TXXTALK_Lane3_OFF (12)
+ #define DDRDATA3CH1_CR_TXXTALK_Lane3_WID ( 4)
+ #define DDRDATA3CH1_CR_TXXTALK_Lane3_MSK (0x0000F000)
+ #define DDRDATA3CH1_CR_TXXTALK_Lane3_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_TXXTALK_Lane4_OFF (16)
+ #define DDRDATA3CH1_CR_TXXTALK_Lane4_WID ( 4)
+ #define DDRDATA3CH1_CR_TXXTALK_Lane4_MSK (0x000F0000)
+ #define DDRDATA3CH1_CR_TXXTALK_Lane4_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_TXXTALK_Lane5_OFF (20)
+ #define DDRDATA3CH1_CR_TXXTALK_Lane5_WID ( 4)
+ #define DDRDATA3CH1_CR_TXXTALK_Lane5_MSK (0x00F00000)
+ #define DDRDATA3CH1_CR_TXXTALK_Lane5_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_TXXTALK_Lane6_OFF (24)
+ #define DDRDATA3CH1_CR_TXXTALK_Lane6_WID ( 4)
+ #define DDRDATA3CH1_CR_TXXTALK_Lane6_MSK (0x0F000000)
+ #define DDRDATA3CH1_CR_TXXTALK_Lane6_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_TXXTALK_Lane7_OFF (28)
+ #define DDRDATA3CH1_CR_TXXTALK_Lane7_WID ( 4)
+ #define DDRDATA3CH1_CR_TXXTALK_Lane7_MSK (0xF0000000)
+ #define DDRDATA3CH1_CR_TXXTALK_Lane7_MAX (0x0000000F)
+
+#define DDRDATA3CH1_CR_RXOFFSETVDQ_REG (0x0000074C)
+ #define DDRDATA3CH1_CR_RXOFFSETVDQ_Lane0_OFF ( 0)
+ #define DDRDATA3CH1_CR_RXOFFSETVDQ_Lane0_WID ( 4)
+ #define DDRDATA3CH1_CR_RXOFFSETVDQ_Lane0_MSK (0x0000000F)
+ #define DDRDATA3CH1_CR_RXOFFSETVDQ_Lane0_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_RXOFFSETVDQ_Lane1_OFF ( 4)
+ #define DDRDATA3CH1_CR_RXOFFSETVDQ_Lane1_WID ( 4)
+ #define DDRDATA3CH1_CR_RXOFFSETVDQ_Lane1_MSK (0x000000F0)
+ #define DDRDATA3CH1_CR_RXOFFSETVDQ_Lane1_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_RXOFFSETVDQ_Lane2_OFF ( 8)
+ #define DDRDATA3CH1_CR_RXOFFSETVDQ_Lane2_WID ( 4)
+ #define DDRDATA3CH1_CR_RXOFFSETVDQ_Lane2_MSK (0x00000F00)
+ #define DDRDATA3CH1_CR_RXOFFSETVDQ_Lane2_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_RXOFFSETVDQ_Lane3_OFF (12)
+ #define DDRDATA3CH1_CR_RXOFFSETVDQ_Lane3_WID ( 4)
+ #define DDRDATA3CH1_CR_RXOFFSETVDQ_Lane3_MSK (0x0000F000)
+ #define DDRDATA3CH1_CR_RXOFFSETVDQ_Lane3_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_RXOFFSETVDQ_Lane4_OFF (16)
+ #define DDRDATA3CH1_CR_RXOFFSETVDQ_Lane4_WID ( 4)
+ #define DDRDATA3CH1_CR_RXOFFSETVDQ_Lane4_MSK (0x000F0000)
+ #define DDRDATA3CH1_CR_RXOFFSETVDQ_Lane4_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_RXOFFSETVDQ_Lane5_OFF (20)
+ #define DDRDATA3CH1_CR_RXOFFSETVDQ_Lane5_WID ( 4)
+ #define DDRDATA3CH1_CR_RXOFFSETVDQ_Lane5_MSK (0x00F00000)
+ #define DDRDATA3CH1_CR_RXOFFSETVDQ_Lane5_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_RXOFFSETVDQ_Lane6_OFF (24)
+ #define DDRDATA3CH1_CR_RXOFFSETVDQ_Lane6_WID ( 4)
+ #define DDRDATA3CH1_CR_RXOFFSETVDQ_Lane6_MSK (0x0F000000)
+ #define DDRDATA3CH1_CR_RXOFFSETVDQ_Lane6_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_RXOFFSETVDQ_Lane7_OFF (28)
+ #define DDRDATA3CH1_CR_RXOFFSETVDQ_Lane7_WID ( 4)
+ #define DDRDATA3CH1_CR_RXOFFSETVDQ_Lane7_MSK (0xF0000000)
+ #define DDRDATA3CH1_CR_RXOFFSETVDQ_Lane7_MAX (0x0000000F)
+
+#define DDRDATA3CH1_CR_DDRDATARESERVED_REG (0x00000750)
+ #define DDRDATA3CH1_CR_DDRDATARESERVED_Spare_OFF ( 0)
+ #define DDRDATA3CH1_CR_DDRDATARESERVED_Spare_WID (32)
+ #define DDRDATA3CH1_CR_DDRDATARESERVED_Spare_MSK (0xFFFFFFFF)
+ #define DDRDATA3CH1_CR_DDRDATARESERVED_Spare_MAX (0xFFFFFFFF)
+
+#define DDRDATA3CH1_CR_DATATRAINFEEDBACK_REG (0x00000754)
+ #define DDRDATA3CH1_CR_DATATRAINFEEDBACK_DataTrainFeedback_OFF ( 0)
+ #define DDRDATA3CH1_CR_DATATRAINFEEDBACK_DataTrainFeedback_WID ( 9)
+ #define DDRDATA3CH1_CR_DATATRAINFEEDBACK_DataTrainFeedback_MSK (0x000001FF)
+ #define DDRDATA3CH1_CR_DATATRAINFEEDBACK_DataTrainFeedback_MAX (0x000001FF)
+ #define DDRDATA3CH1_CR_DATATRAINFEEDBACK_Spare_OFF ( 9)
+ #define DDRDATA3CH1_CR_DATATRAINFEEDBACK_Spare_WID (23)
+ #define DDRDATA3CH1_CR_DATATRAINFEEDBACK_Spare_MSK (0xFFFFFE00)
+ #define DDRDATA3CH1_CR_DATATRAINFEEDBACK_Spare_MAX (0x007FFFFF)
+
+#define DDRDATA3CH1_CR_DLLPITESTANDADC_REG (0x00000758)
+ #define DDRDATA3CH1_CR_DLLPITESTANDADC_RunTest_OFF ( 0)
+ #define DDRDATA3CH1_CR_DLLPITESTANDADC_RunTest_WID ( 1)
+ #define DDRDATA3CH1_CR_DLLPITESTANDADC_RunTest_MSK (0x00000001)
+ #define DDRDATA3CH1_CR_DLLPITESTANDADC_RunTest_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DLLPITESTANDADC_RunTest_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DLLPITESTANDADC_Load_OFF ( 1)
+ #define DDRDATA3CH1_CR_DLLPITESTANDADC_Load_WID ( 1)
+ #define DDRDATA3CH1_CR_DLLPITESTANDADC_Load_MSK (0x00000002)
+ #define DDRDATA3CH1_CR_DLLPITESTANDADC_Load_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DLLPITESTANDADC_Load_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DLLPITESTANDADC_ModeHVM_OFF ( 2)
+ #define DDRDATA3CH1_CR_DLLPITESTANDADC_ModeHVM_WID ( 1)
+ #define DDRDATA3CH1_CR_DLLPITESTANDADC_ModeHVM_MSK (0x00000004)
+ #define DDRDATA3CH1_CR_DLLPITESTANDADC_ModeHVM_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DLLPITESTANDADC_ModeHVM_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DLLPITESTANDADC_ModeDV_OFF ( 3)
+ #define DDRDATA3CH1_CR_DLLPITESTANDADC_ModeDV_WID ( 1)
+ #define DDRDATA3CH1_CR_DLLPITESTANDADC_ModeDV_MSK (0x00000008)
+ #define DDRDATA3CH1_CR_DLLPITESTANDADC_ModeDV_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DLLPITESTANDADC_ModeDV_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DLLPITESTANDADC_ModeADC_OFF ( 4)
+ #define DDRDATA3CH1_CR_DLLPITESTANDADC_ModeADC_WID ( 1)
+ #define DDRDATA3CH1_CR_DLLPITESTANDADC_ModeADC_MSK (0x00000010)
+ #define DDRDATA3CH1_CR_DLLPITESTANDADC_ModeADC_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DLLPITESTANDADC_ModeADC_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DLLPITESTANDADC_LoadCount_OFF ( 5)
+ #define DDRDATA3CH1_CR_DLLPITESTANDADC_LoadCount_WID (10)
+ #define DDRDATA3CH1_CR_DLLPITESTANDADC_LoadCount_MSK (0x00007FE0)
+ #define DDRDATA3CH1_CR_DLLPITESTANDADC_LoadCount_MAX (0x000003FF)
+ #define DDRDATA3CH1_CR_DLLPITESTANDADC_CountStatus_OFF (15)
+ #define DDRDATA3CH1_CR_DLLPITESTANDADC_CountStatus_WID (10)
+ #define DDRDATA3CH1_CR_DLLPITESTANDADC_CountStatus_MSK (0x01FF8000)
+ #define DDRDATA3CH1_CR_DLLPITESTANDADC_CountStatus_MAX (0x000003FF)
+ #define DDRDATA3CH1_CR_DLLPITESTANDADC_CountStatus_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DLLPITESTANDADC_Spare_OFF (25)
+ #define DDRDATA3CH1_CR_DLLPITESTANDADC_Spare_WID ( 7)
+ #define DDRDATA3CH1_CR_DLLPITESTANDADC_Spare_MSK (0xFE000000)
+ #define DDRDATA3CH1_CR_DLLPITESTANDADC_Spare_MAX (0x0000007F)
+
+#define DDRDATA3CH1_CR_DDRCRDATAOFFSETCOMP_REG (0x0000075C)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_OFF ( 0)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_WID ( 6)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_MSK (0x0000003F)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_MAX (0x0000003F)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_OFF ( 6)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_WID ( 6)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_MSK (0x00000FC0)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_MAX (0x0000003F)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_OFF (12)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_WID ( 5)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_MSK (0x0001F000)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_MAX (0x0000001F)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_OFF (17)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_WID ( 5)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_MSK (0x003E0000)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_MAX (0x0000001F)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_OFF (22)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_WID ( 5)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_MSK (0x07C00000)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_MAX (0x0000001F)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_OFF (27)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_WID ( 5)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_MSK (0xF8000000)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_MAX (0x0000001F)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_DEF (0x00000000)
+
+#define DDRDATA3CH1_CR_DDRCRDATACONTROL1_REG (0x00000760)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_RefPi_OFF ( 0)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_RefPi_WID ( 4)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_RefPi_MSK (0x0000000F)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_RefPi_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_RefPi_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_DllMask_OFF ( 4)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_DllMask_WID ( 2)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_DllMask_MSK (0x00000030)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_DllMask_MAX (0x00000003)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_DllMask_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_DllWeakLock_OFF ( 6)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_DllWeakLock_WID ( 1)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_DllWeakLock_MSK (0x00000040)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_DllWeakLock_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_DllWeakLock_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_OFF ( 7)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_WID ( 3)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_MSK (0x00000380)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_MAX (0x00000007)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_OFF (10)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_WID ( 3)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_MSK (0x00001C00)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_MAX (0x00000007)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_OdtDelay_OFF (13)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_OdtDelay_WID ( 4)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_OdtDelay_MSK (0x0001E000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_OdtDelay_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_OdtDelay_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_OdtDuration_OFF (17)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_OdtDuration_WID ( 3)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_OdtDuration_MSK (0x000E0000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_OdtDuration_MAX (0x00000007)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_OdtDuration_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_OFF (20)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_WID ( 4)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_MSK (0x00F00000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_OFF (24)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_WID ( 3)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_MSK (0x07000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_MAX (0x00000007)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_OFF (27)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_WID ( 3)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_MSK (0x38000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_MAX (0x00000007)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_OFF (30)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_WID ( 1)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_MSK (0x40000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_Rsvd1_OFF (31)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_Rsvd1_WID ( 1)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_Rsvd1_MSK (0x80000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_Rsvd1_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL1_Rsvd1_DEF (0x00000000)
+
+#define DDRDATA3CH1_CR_DDRCRDATACONTROL2_REG (0x00000764)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_OFF ( 0)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_WID ( 5)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_MSK (0x0000001F)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_MAX (0x0000001F)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_OFF ( 5)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_WID ( 1)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_MSK (0x00000020)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL2_ForceRxOn_OFF ( 6)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL2_ForceRxOn_WID ( 1)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL2_ForceRxOn_MSK (0x00000040)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL2_ForceRxOn_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL2_ForceRxOn_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL2_LeakerComp_OFF ( 7)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL2_LeakerComp_WID ( 2)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL2_LeakerComp_MSK (0x00000180)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL2_LeakerComp_MAX (0x00000003)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL2_LeakerComp_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_OFF ( 9)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_WID ( 4)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_MSK (0x00001E00)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_MAX (0x0000000F)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_DEF (0x00000008)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_OFF (13)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_WID ( 5)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_MSK (0x0003E000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_MAX (0x0000001F)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_DEF (0x00000011)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_OFF (18)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_WID ( 1)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_MSK (0x00040000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL2_Spare_OFF (19)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL2_Spare_WID (13)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL2_Spare_MSK (0xFFF80000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL2_Spare_MAX (0x00001FFF)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL2_Spare_DEF (0x00000000)
+
+#define DDRDATA3CH1_CR_DDRCRVSSHIORVREFCONTROL_REG (0x0000076C)
+ #define DDRDATA3CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_OFF ( 0)
+ #define DDRDATA3CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_WID (24)
+ #define DDRDATA3CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_MSK (0x00FFFFFF)
+ #define DDRDATA3CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_MAX (0x00FFFFFF)
+ #define DDRDATA3CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_OFF (24)
+ #define DDRDATA3CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_WID ( 8)
+ #define DDRDATA3CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_MSK (0xFF000000)
+ #define DDRDATA3CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_MAX (0x000000FF)
+ #define DDRDATA3CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_DEF (0x00000000)
+
+#define DDRDATA3CH1_CR_DDRCRDATAOFFSETTRAIN_REG (0x00000770)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_OFF ( 0)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_WID ( 6)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_MSK (0x0000003F)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_MAX (0x0000003F)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_OFF ( 6)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_WID ( 6)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_MSK (0x00000FC0)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_MAX (0x0000003F)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_OFF (12)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_WID ( 6)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_MSK (0x0003F000)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_MAX (0x0000003F)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_OFF (18)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_WID ( 6)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_MSK (0x00FC0000)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_MAX (0x0000003F)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_OFF (24)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_WID ( 7)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_MSK (0x7F000000)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_MAX (0x0000007F)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_OFF (31)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_WID ( 1)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_MSK (0x80000000)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_DEF (0x00000000)
+
+#define DDRDATA3CH1_CR_DDRCRDATACONTROL0_REG (0x00000774)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_OFF ( 0)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_WID ( 1)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_MSK (0x00000001)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_OFF ( 1)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_WID ( 1)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_MSK (0x00000002)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_OFF ( 2)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_WID ( 1)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_MSK (0x00000004)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_OFF ( 3)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_WID ( 1)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_MSK (0x00000008)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_TxOn_OFF ( 4)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_TxOn_WID ( 1)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_TxOn_MSK (0x00000010)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_TxOn_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_TxOn_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_RfOn_OFF ( 5)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_RfOn_WID ( 1)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_RfOn_MSK (0x00000020)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_RfOn_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_RfOn_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_RxPiOn_OFF ( 6)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_RxPiOn_WID ( 1)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_RxPiOn_MSK (0x00000040)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_RxPiOn_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_RxPiOn_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_TxPiOn_OFF ( 7)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_TxPiOn_WID ( 1)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_TxPiOn_MSK (0x00000080)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_TxPiOn_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_TxPiOn_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_OFF ( 8)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_WID ( 1)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_MSK (0x00000100)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_OFF ( 9)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_WID ( 1)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_MSK (0x00000200)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_TxDisable_OFF (10)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_TxDisable_WID ( 1)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_TxDisable_MSK (0x00000400)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_TxDisable_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_TxDisable_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_RxDisable_OFF (11)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_RxDisable_WID ( 1)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_RxDisable_MSK (0x00000800)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_RxDisable_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_RxDisable_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_TxLong_OFF (12)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_TxLong_WID ( 1)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_TxLong_MSK (0x00001000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_TxLong_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_TxLong_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_OFF (13)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_WID ( 2)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_MSK (0x00006000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_MAX (0x00000003)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_RxReadPointer_OFF (15)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_RxReadPointer_WID ( 3)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_RxReadPointer_MSK (0x00038000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_RxReadPointer_MAX (0x00000007)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_RxReadPointer_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_OFF (18)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_WID ( 1)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_MSK (0x00040000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_OFF (19)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_WID ( 1)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_MSK (0x00080000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_ReadRFRd_OFF (20)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_ReadRFRd_WID ( 1)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_ReadRFRd_MSK (0x00100000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_ReadRFRd_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_ReadRFRd_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_ReadRFWr_OFF (21)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_ReadRFWr_WID ( 1)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_ReadRFWr_MSK (0x00200000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_ReadRFWr_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_ReadRFWr_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_ReadRFRank_OFF (22)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_ReadRFRank_WID ( 2)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_ReadRFRank_MSK (0x00C00000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_ReadRFRank_MAX (0x00000003)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_ReadRFRank_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_OFF (24)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_WID ( 1)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_MSK (0x01000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_OdtSampOff_OFF (25)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_OdtSampOff_WID ( 1)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_OdtSampOff_MSK (0x02000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_OdtSampOff_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_OdtSampOff_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_OFF (26)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_WID ( 1)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_MSK (0x04000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_OFF (27)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_WID ( 1)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_MSK (0x08000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_OFF (28)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_WID ( 1)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_MSK (0x10000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_OFF (29)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_WID ( 1)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_MSK (0x20000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_OFF (30)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_WID ( 1)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_MSK (0x40000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_OFF (31)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_WID ( 1)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_MSK (0x80000000)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_DEF (0x00000000)
+
+#define DDRDATA3CH1_CR_DDRCRVREFADJUST1_REG (0x00000778)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_OFF ( 0)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_WID ( 7)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_MSK (0x0000007F)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_MAX (0x0000007F)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_OFF ( 7)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_WID ( 7)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_MSK (0x00003F80)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_MAX (0x0000007F)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_OFF (14)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_WID ( 7)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_MSK (0x001FC000)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_MAX (0x0000007F)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_OFF (21)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_WID ( 1)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_MSK (0x00200000)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_OFF (22)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_WID ( 1)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_MSK (0x00400000)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_OFF (23)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_WID ( 1)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_MSK (0x00800000)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_OFF (24)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_WID ( 2)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_MSK (0x03000000)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_MAX (0x00000003)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_OFF (26)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_WID ( 1)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_MSK (0x04000000)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_Rsvd_OFF (27)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_Rsvd_WID ( 2)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_Rsvd_MSK (0x18000000)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_Rsvd_MAX (0x00000003)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_Rsvd_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_caSlowBW_OFF (29)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_caSlowBW_WID ( 1)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_caSlowBW_MSK (0x20000000)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_caSlowBW_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_caSlowBW_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_OFF (30)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_WID ( 1)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_MSK (0x40000000)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_DEF (0x00000000)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_OFF (31)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_WID ( 1)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_MSK (0x80000000)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_MAX (0x00000001)
+ #define DDRDATA3CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_DEF (0x00000000)
+
+#define DDRDATA4CH0_CR_RXTRAINRANK0_REG (0x00000800)
+ #define DDRDATA4CH0_CR_RXTRAINRANK0_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA4CH0_CR_RXTRAINRANK0_RxRcvEnPi_WID ( 9)
+ #define DDRDATA4CH0_CR_RXTRAINRANK0_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA4CH0_CR_RXTRAINRANK0_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA4CH0_CR_RXTRAINRANK0_RxDqsPPi_OFF ( 9)
+ #define DDRDATA4CH0_CR_RXTRAINRANK0_RxDqsPPi_WID ( 6)
+ #define DDRDATA4CH0_CR_RXTRAINRANK0_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA4CH0_CR_RXTRAINRANK0_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA4CH0_CR_RXTRAINRANK0_RxEq_OFF (15)
+ #define DDRDATA4CH0_CR_RXTRAINRANK0_RxEq_WID ( 5)
+ #define DDRDATA4CH0_CR_RXTRAINRANK0_RxEq_MSK (0x000F8000)
+ #define DDRDATA4CH0_CR_RXTRAINRANK0_RxEq_MAX (0x0000001F)
+ #define DDRDATA4CH0_CR_RXTRAINRANK0_RxDqsNPi_OFF (20)
+ #define DDRDATA4CH0_CR_RXTRAINRANK0_RxDqsNPi_WID ( 6)
+ #define DDRDATA4CH0_CR_RXTRAINRANK0_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA4CH0_CR_RXTRAINRANK0_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA4CH0_CR_RXTRAINRANK0_RxVref_OFF (26)
+ #define DDRDATA4CH0_CR_RXTRAINRANK0_RxVref_WID ( 6)
+ #define DDRDATA4CH0_CR_RXTRAINRANK0_RxVref_MSK (0xFC000000)
+ #define DDRDATA4CH0_CR_RXTRAINRANK0_RxVref_MAX (0x0000003F)
+
+#define DDRDATA4CH0_CR_RXTRAINRANK1_REG (0x00000804)
+ #define DDRDATA4CH0_CR_RXTRAINRANK1_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA4CH0_CR_RXTRAINRANK1_RxRcvEnPi_WID ( 9)
+ #define DDRDATA4CH0_CR_RXTRAINRANK1_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA4CH0_CR_RXTRAINRANK1_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA4CH0_CR_RXTRAINRANK1_RxDqsPPi_OFF ( 9)
+ #define DDRDATA4CH0_CR_RXTRAINRANK1_RxDqsPPi_WID ( 6)
+ #define DDRDATA4CH0_CR_RXTRAINRANK1_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA4CH0_CR_RXTRAINRANK1_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA4CH0_CR_RXTRAINRANK1_RxEq_OFF (15)
+ #define DDRDATA4CH0_CR_RXTRAINRANK1_RxEq_WID ( 5)
+ #define DDRDATA4CH0_CR_RXTRAINRANK1_RxEq_MSK (0x000F8000)
+ #define DDRDATA4CH0_CR_RXTRAINRANK1_RxEq_MAX (0x0000001F)
+ #define DDRDATA4CH0_CR_RXTRAINRANK1_RxDqsNPi_OFF (20)
+ #define DDRDATA4CH0_CR_RXTRAINRANK1_RxDqsNPi_WID ( 6)
+ #define DDRDATA4CH0_CR_RXTRAINRANK1_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA4CH0_CR_RXTRAINRANK1_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA4CH0_CR_RXTRAINRANK1_RxVref_OFF (26)
+ #define DDRDATA4CH0_CR_RXTRAINRANK1_RxVref_WID ( 6)
+ #define DDRDATA4CH0_CR_RXTRAINRANK1_RxVref_MSK (0xFC000000)
+ #define DDRDATA4CH0_CR_RXTRAINRANK1_RxVref_MAX (0x0000003F)
+
+#define DDRDATA4CH0_CR_RXTRAINRANK2_REG (0x00000808)
+ #define DDRDATA4CH0_CR_RXTRAINRANK2_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA4CH0_CR_RXTRAINRANK2_RxRcvEnPi_WID ( 9)
+ #define DDRDATA4CH0_CR_RXTRAINRANK2_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA4CH0_CR_RXTRAINRANK2_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA4CH0_CR_RXTRAINRANK2_RxDqsPPi_OFF ( 9)
+ #define DDRDATA4CH0_CR_RXTRAINRANK2_RxDqsPPi_WID ( 6)
+ #define DDRDATA4CH0_CR_RXTRAINRANK2_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA4CH0_CR_RXTRAINRANK2_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA4CH0_CR_RXTRAINRANK2_RxEq_OFF (15)
+ #define DDRDATA4CH0_CR_RXTRAINRANK2_RxEq_WID ( 5)
+ #define DDRDATA4CH0_CR_RXTRAINRANK2_RxEq_MSK (0x000F8000)
+ #define DDRDATA4CH0_CR_RXTRAINRANK2_RxEq_MAX (0x0000001F)
+ #define DDRDATA4CH0_CR_RXTRAINRANK2_RxDqsNPi_OFF (20)
+ #define DDRDATA4CH0_CR_RXTRAINRANK2_RxDqsNPi_WID ( 6)
+ #define DDRDATA4CH0_CR_RXTRAINRANK2_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA4CH0_CR_RXTRAINRANK2_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA4CH0_CR_RXTRAINRANK2_RxVref_OFF (26)
+ #define DDRDATA4CH0_CR_RXTRAINRANK2_RxVref_WID ( 6)
+ #define DDRDATA4CH0_CR_RXTRAINRANK2_RxVref_MSK (0xFC000000)
+ #define DDRDATA4CH0_CR_RXTRAINRANK2_RxVref_MAX (0x0000003F)
+
+#define DDRDATA4CH0_CR_RXTRAINRANK3_REG (0x0000080C)
+ #define DDRDATA4CH0_CR_RXTRAINRANK3_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA4CH0_CR_RXTRAINRANK3_RxRcvEnPi_WID ( 9)
+ #define DDRDATA4CH0_CR_RXTRAINRANK3_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA4CH0_CR_RXTRAINRANK3_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA4CH0_CR_RXTRAINRANK3_RxDqsPPi_OFF ( 9)
+ #define DDRDATA4CH0_CR_RXTRAINRANK3_RxDqsPPi_WID ( 6)
+ #define DDRDATA4CH0_CR_RXTRAINRANK3_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA4CH0_CR_RXTRAINRANK3_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA4CH0_CR_RXTRAINRANK3_RxEq_OFF (15)
+ #define DDRDATA4CH0_CR_RXTRAINRANK3_RxEq_WID ( 5)
+ #define DDRDATA4CH0_CR_RXTRAINRANK3_RxEq_MSK (0x000F8000)
+ #define DDRDATA4CH0_CR_RXTRAINRANK3_RxEq_MAX (0x0000001F)
+ #define DDRDATA4CH0_CR_RXTRAINRANK3_RxDqsNPi_OFF (20)
+ #define DDRDATA4CH0_CR_RXTRAINRANK3_RxDqsNPi_WID ( 6)
+ #define DDRDATA4CH0_CR_RXTRAINRANK3_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA4CH0_CR_RXTRAINRANK3_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA4CH0_CR_RXTRAINRANK3_RxVref_OFF (26)
+ #define DDRDATA4CH0_CR_RXTRAINRANK3_RxVref_WID ( 6)
+ #define DDRDATA4CH0_CR_RXTRAINRANK3_RxVref_MSK (0xFC000000)
+ #define DDRDATA4CH0_CR_RXTRAINRANK3_RxVref_MAX (0x0000003F)
+
+#define DDRDATA4CH0_CR_RXPERBITRANK0_REG (0x00000810)
+ #define DDRDATA4CH0_CR_RXPERBITRANK0_Lane0_OFF ( 0)
+ #define DDRDATA4CH0_CR_RXPERBITRANK0_Lane0_WID ( 4)
+ #define DDRDATA4CH0_CR_RXPERBITRANK0_Lane0_MSK (0x0000000F)
+ #define DDRDATA4CH0_CR_RXPERBITRANK0_Lane0_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_RXPERBITRANK0_Lane1_OFF ( 4)
+ #define DDRDATA4CH0_CR_RXPERBITRANK0_Lane1_WID ( 4)
+ #define DDRDATA4CH0_CR_RXPERBITRANK0_Lane1_MSK (0x000000F0)
+ #define DDRDATA4CH0_CR_RXPERBITRANK0_Lane1_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_RXPERBITRANK0_Lane2_OFF ( 8)
+ #define DDRDATA4CH0_CR_RXPERBITRANK0_Lane2_WID ( 4)
+ #define DDRDATA4CH0_CR_RXPERBITRANK0_Lane2_MSK (0x00000F00)
+ #define DDRDATA4CH0_CR_RXPERBITRANK0_Lane2_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_RXPERBITRANK0_Lane3_OFF (12)
+ #define DDRDATA4CH0_CR_RXPERBITRANK0_Lane3_WID ( 4)
+ #define DDRDATA4CH0_CR_RXPERBITRANK0_Lane3_MSK (0x0000F000)
+ #define DDRDATA4CH0_CR_RXPERBITRANK0_Lane3_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_RXPERBITRANK0_Lane4_OFF (16)
+ #define DDRDATA4CH0_CR_RXPERBITRANK0_Lane4_WID ( 4)
+ #define DDRDATA4CH0_CR_RXPERBITRANK0_Lane4_MSK (0x000F0000)
+ #define DDRDATA4CH0_CR_RXPERBITRANK0_Lane4_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_RXPERBITRANK0_Lane5_OFF (20)
+ #define DDRDATA4CH0_CR_RXPERBITRANK0_Lane5_WID ( 4)
+ #define DDRDATA4CH0_CR_RXPERBITRANK0_Lane5_MSK (0x00F00000)
+ #define DDRDATA4CH0_CR_RXPERBITRANK0_Lane5_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_RXPERBITRANK0_Lane6_OFF (24)
+ #define DDRDATA4CH0_CR_RXPERBITRANK0_Lane6_WID ( 4)
+ #define DDRDATA4CH0_CR_RXPERBITRANK0_Lane6_MSK (0x0F000000)
+ #define DDRDATA4CH0_CR_RXPERBITRANK0_Lane6_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_RXPERBITRANK0_Lane7_OFF (28)
+ #define DDRDATA4CH0_CR_RXPERBITRANK0_Lane7_WID ( 4)
+ #define DDRDATA4CH0_CR_RXPERBITRANK0_Lane7_MSK (0xF0000000)
+ #define DDRDATA4CH0_CR_RXPERBITRANK0_Lane7_MAX (0x0000000F)
+
+#define DDRDATA4CH0_CR_RXPERBITRANK1_REG (0x00000814)
+ #define DDRDATA4CH0_CR_RXPERBITRANK1_Lane0_OFF ( 0)
+ #define DDRDATA4CH0_CR_RXPERBITRANK1_Lane0_WID ( 4)
+ #define DDRDATA4CH0_CR_RXPERBITRANK1_Lane0_MSK (0x0000000F)
+ #define DDRDATA4CH0_CR_RXPERBITRANK1_Lane0_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_RXPERBITRANK1_Lane1_OFF ( 4)
+ #define DDRDATA4CH0_CR_RXPERBITRANK1_Lane1_WID ( 4)
+ #define DDRDATA4CH0_CR_RXPERBITRANK1_Lane1_MSK (0x000000F0)
+ #define DDRDATA4CH0_CR_RXPERBITRANK1_Lane1_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_RXPERBITRANK1_Lane2_OFF ( 8)
+ #define DDRDATA4CH0_CR_RXPERBITRANK1_Lane2_WID ( 4)
+ #define DDRDATA4CH0_CR_RXPERBITRANK1_Lane2_MSK (0x00000F00)
+ #define DDRDATA4CH0_CR_RXPERBITRANK1_Lane2_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_RXPERBITRANK1_Lane3_OFF (12)
+ #define DDRDATA4CH0_CR_RXPERBITRANK1_Lane3_WID ( 4)
+ #define DDRDATA4CH0_CR_RXPERBITRANK1_Lane3_MSK (0x0000F000)
+ #define DDRDATA4CH0_CR_RXPERBITRANK1_Lane3_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_RXPERBITRANK1_Lane4_OFF (16)
+ #define DDRDATA4CH0_CR_RXPERBITRANK1_Lane4_WID ( 4)
+ #define DDRDATA4CH0_CR_RXPERBITRANK1_Lane4_MSK (0x000F0000)
+ #define DDRDATA4CH0_CR_RXPERBITRANK1_Lane4_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_RXPERBITRANK1_Lane5_OFF (20)
+ #define DDRDATA4CH0_CR_RXPERBITRANK1_Lane5_WID ( 4)
+ #define DDRDATA4CH0_CR_RXPERBITRANK1_Lane5_MSK (0x00F00000)
+ #define DDRDATA4CH0_CR_RXPERBITRANK1_Lane5_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_RXPERBITRANK1_Lane6_OFF (24)
+ #define DDRDATA4CH0_CR_RXPERBITRANK1_Lane6_WID ( 4)
+ #define DDRDATA4CH0_CR_RXPERBITRANK1_Lane6_MSK (0x0F000000)
+ #define DDRDATA4CH0_CR_RXPERBITRANK1_Lane6_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_RXPERBITRANK1_Lane7_OFF (28)
+ #define DDRDATA4CH0_CR_RXPERBITRANK1_Lane7_WID ( 4)
+ #define DDRDATA4CH0_CR_RXPERBITRANK1_Lane7_MSK (0xF0000000)
+ #define DDRDATA4CH0_CR_RXPERBITRANK1_Lane7_MAX (0x0000000F)
+
+#define DDRDATA4CH0_CR_RXPERBITRANK2_REG (0x00000818)
+ #define DDRDATA4CH0_CR_RXPERBITRANK2_Lane0_OFF ( 0)
+ #define DDRDATA4CH0_CR_RXPERBITRANK2_Lane0_WID ( 4)
+ #define DDRDATA4CH0_CR_RXPERBITRANK2_Lane0_MSK (0x0000000F)
+ #define DDRDATA4CH0_CR_RXPERBITRANK2_Lane0_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_RXPERBITRANK2_Lane1_OFF ( 4)
+ #define DDRDATA4CH0_CR_RXPERBITRANK2_Lane1_WID ( 4)
+ #define DDRDATA4CH0_CR_RXPERBITRANK2_Lane1_MSK (0x000000F0)
+ #define DDRDATA4CH0_CR_RXPERBITRANK2_Lane1_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_RXPERBITRANK2_Lane2_OFF ( 8)
+ #define DDRDATA4CH0_CR_RXPERBITRANK2_Lane2_WID ( 4)
+ #define DDRDATA4CH0_CR_RXPERBITRANK2_Lane2_MSK (0x00000F00)
+ #define DDRDATA4CH0_CR_RXPERBITRANK2_Lane2_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_RXPERBITRANK2_Lane3_OFF (12)
+ #define DDRDATA4CH0_CR_RXPERBITRANK2_Lane3_WID ( 4)
+ #define DDRDATA4CH0_CR_RXPERBITRANK2_Lane3_MSK (0x0000F000)
+ #define DDRDATA4CH0_CR_RXPERBITRANK2_Lane3_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_RXPERBITRANK2_Lane4_OFF (16)
+ #define DDRDATA4CH0_CR_RXPERBITRANK2_Lane4_WID ( 4)
+ #define DDRDATA4CH0_CR_RXPERBITRANK2_Lane4_MSK (0x000F0000)
+ #define DDRDATA4CH0_CR_RXPERBITRANK2_Lane4_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_RXPERBITRANK2_Lane5_OFF (20)
+ #define DDRDATA4CH0_CR_RXPERBITRANK2_Lane5_WID ( 4)
+ #define DDRDATA4CH0_CR_RXPERBITRANK2_Lane5_MSK (0x00F00000)
+ #define DDRDATA4CH0_CR_RXPERBITRANK2_Lane5_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_RXPERBITRANK2_Lane6_OFF (24)
+ #define DDRDATA4CH0_CR_RXPERBITRANK2_Lane6_WID ( 4)
+ #define DDRDATA4CH0_CR_RXPERBITRANK2_Lane6_MSK (0x0F000000)
+ #define DDRDATA4CH0_CR_RXPERBITRANK2_Lane6_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_RXPERBITRANK2_Lane7_OFF (28)
+ #define DDRDATA4CH0_CR_RXPERBITRANK2_Lane7_WID ( 4)
+ #define DDRDATA4CH0_CR_RXPERBITRANK2_Lane7_MSK (0xF0000000)
+ #define DDRDATA4CH0_CR_RXPERBITRANK2_Lane7_MAX (0x0000000F)
+
+#define DDRDATA4CH0_CR_RXPERBITRANK3_REG (0x0000081C)
+ #define DDRDATA4CH0_CR_RXPERBITRANK3_Lane0_OFF ( 0)
+ #define DDRDATA4CH0_CR_RXPERBITRANK3_Lane0_WID ( 4)
+ #define DDRDATA4CH0_CR_RXPERBITRANK3_Lane0_MSK (0x0000000F)
+ #define DDRDATA4CH0_CR_RXPERBITRANK3_Lane0_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_RXPERBITRANK3_Lane1_OFF ( 4)
+ #define DDRDATA4CH0_CR_RXPERBITRANK3_Lane1_WID ( 4)
+ #define DDRDATA4CH0_CR_RXPERBITRANK3_Lane1_MSK (0x000000F0)
+ #define DDRDATA4CH0_CR_RXPERBITRANK3_Lane1_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_RXPERBITRANK3_Lane2_OFF ( 8)
+ #define DDRDATA4CH0_CR_RXPERBITRANK3_Lane2_WID ( 4)
+ #define DDRDATA4CH0_CR_RXPERBITRANK3_Lane2_MSK (0x00000F00)
+ #define DDRDATA4CH0_CR_RXPERBITRANK3_Lane2_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_RXPERBITRANK3_Lane3_OFF (12)
+ #define DDRDATA4CH0_CR_RXPERBITRANK3_Lane3_WID ( 4)
+ #define DDRDATA4CH0_CR_RXPERBITRANK3_Lane3_MSK (0x0000F000)
+ #define DDRDATA4CH0_CR_RXPERBITRANK3_Lane3_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_RXPERBITRANK3_Lane4_OFF (16)
+ #define DDRDATA4CH0_CR_RXPERBITRANK3_Lane4_WID ( 4)
+ #define DDRDATA4CH0_CR_RXPERBITRANK3_Lane4_MSK (0x000F0000)
+ #define DDRDATA4CH0_CR_RXPERBITRANK3_Lane4_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_RXPERBITRANK3_Lane5_OFF (20)
+ #define DDRDATA4CH0_CR_RXPERBITRANK3_Lane5_WID ( 4)
+ #define DDRDATA4CH0_CR_RXPERBITRANK3_Lane5_MSK (0x00F00000)
+ #define DDRDATA4CH0_CR_RXPERBITRANK3_Lane5_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_RXPERBITRANK3_Lane6_OFF (24)
+ #define DDRDATA4CH0_CR_RXPERBITRANK3_Lane6_WID ( 4)
+ #define DDRDATA4CH0_CR_RXPERBITRANK3_Lane6_MSK (0x0F000000)
+ #define DDRDATA4CH0_CR_RXPERBITRANK3_Lane6_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_RXPERBITRANK3_Lane7_OFF (28)
+ #define DDRDATA4CH0_CR_RXPERBITRANK3_Lane7_WID ( 4)
+ #define DDRDATA4CH0_CR_RXPERBITRANK3_Lane7_MSK (0xF0000000)
+ #define DDRDATA4CH0_CR_RXPERBITRANK3_Lane7_MAX (0x0000000F)
+
+#define DDRDATA4CH0_CR_TXTRAINRANK0_REG (0x00000820)
+ #define DDRDATA4CH0_CR_TXTRAINRANK0_TxDqDelay_OFF ( 0)
+ #define DDRDATA4CH0_CR_TXTRAINRANK0_TxDqDelay_WID ( 9)
+ #define DDRDATA4CH0_CR_TXTRAINRANK0_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA4CH0_CR_TXTRAINRANK0_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA4CH0_CR_TXTRAINRANK0_TxDqsDelay_OFF ( 9)
+ #define DDRDATA4CH0_CR_TXTRAINRANK0_TxDqsDelay_WID ( 9)
+ #define DDRDATA4CH0_CR_TXTRAINRANK0_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA4CH0_CR_TXTRAINRANK0_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA4CH0_CR_TXTRAINRANK0_Spare0_OFF (18)
+ #define DDRDATA4CH0_CR_TXTRAINRANK0_Spare0_WID ( 2)
+ #define DDRDATA4CH0_CR_TXTRAINRANK0_Spare0_MSK (0x000C0000)
+ #define DDRDATA4CH0_CR_TXTRAINRANK0_Spare0_MAX (0x00000003)
+ #define DDRDATA4CH0_CR_TXTRAINRANK0_TxEqualization_OFF (20)
+ #define DDRDATA4CH0_CR_TXTRAINRANK0_TxEqualization_WID ( 6)
+ #define DDRDATA4CH0_CR_TXTRAINRANK0_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA4CH0_CR_TXTRAINRANK0_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA4CH0_CR_TXTRAINRANK0_Spare1_OFF (26)
+ #define DDRDATA4CH0_CR_TXTRAINRANK0_Spare1_WID ( 6)
+ #define DDRDATA4CH0_CR_TXTRAINRANK0_Spare1_MSK (0xFC000000)
+ #define DDRDATA4CH0_CR_TXTRAINRANK0_Spare1_MAX (0x0000003F)
+
+#define DDRDATA4CH0_CR_TXTRAINRANK1_REG (0x00000824)
+ #define DDRDATA4CH0_CR_TXTRAINRANK1_TxDqDelay_OFF ( 0)
+ #define DDRDATA4CH0_CR_TXTRAINRANK1_TxDqDelay_WID ( 9)
+ #define DDRDATA4CH0_CR_TXTRAINRANK1_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA4CH0_CR_TXTRAINRANK1_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA4CH0_CR_TXTRAINRANK1_TxDqsDelay_OFF ( 9)
+ #define DDRDATA4CH0_CR_TXTRAINRANK1_TxDqsDelay_WID ( 9)
+ #define DDRDATA4CH0_CR_TXTRAINRANK1_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA4CH0_CR_TXTRAINRANK1_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA4CH0_CR_TXTRAINRANK1_Spare0_OFF (18)
+ #define DDRDATA4CH0_CR_TXTRAINRANK1_Spare0_WID ( 2)
+ #define DDRDATA4CH0_CR_TXTRAINRANK1_Spare0_MSK (0x000C0000)
+ #define DDRDATA4CH0_CR_TXTRAINRANK1_Spare0_MAX (0x00000003)
+ #define DDRDATA4CH0_CR_TXTRAINRANK1_TxEqualization_OFF (20)
+ #define DDRDATA4CH0_CR_TXTRAINRANK1_TxEqualization_WID ( 6)
+ #define DDRDATA4CH0_CR_TXTRAINRANK1_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA4CH0_CR_TXTRAINRANK1_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA4CH0_CR_TXTRAINRANK1_Spare1_OFF (26)
+ #define DDRDATA4CH0_CR_TXTRAINRANK1_Spare1_WID ( 6)
+ #define DDRDATA4CH0_CR_TXTRAINRANK1_Spare1_MSK (0xFC000000)
+ #define DDRDATA4CH0_CR_TXTRAINRANK1_Spare1_MAX (0x0000003F)
+
+#define DDRDATA4CH0_CR_TXTRAINRANK2_REG (0x00000828)
+ #define DDRDATA4CH0_CR_TXTRAINRANK2_TxDqDelay_OFF ( 0)
+ #define DDRDATA4CH0_CR_TXTRAINRANK2_TxDqDelay_WID ( 9)
+ #define DDRDATA4CH0_CR_TXTRAINRANK2_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA4CH0_CR_TXTRAINRANK2_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA4CH0_CR_TXTRAINRANK2_TxDqsDelay_OFF ( 9)
+ #define DDRDATA4CH0_CR_TXTRAINRANK2_TxDqsDelay_WID ( 9)
+ #define DDRDATA4CH0_CR_TXTRAINRANK2_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA4CH0_CR_TXTRAINRANK2_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA4CH0_CR_TXTRAINRANK2_Spare0_OFF (18)
+ #define DDRDATA4CH0_CR_TXTRAINRANK2_Spare0_WID ( 2)
+ #define DDRDATA4CH0_CR_TXTRAINRANK2_Spare0_MSK (0x000C0000)
+ #define DDRDATA4CH0_CR_TXTRAINRANK2_Spare0_MAX (0x00000003)
+ #define DDRDATA4CH0_CR_TXTRAINRANK2_TxEqualization_OFF (20)
+ #define DDRDATA4CH0_CR_TXTRAINRANK2_TxEqualization_WID ( 6)
+ #define DDRDATA4CH0_CR_TXTRAINRANK2_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA4CH0_CR_TXTRAINRANK2_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA4CH0_CR_TXTRAINRANK2_Spare1_OFF (26)
+ #define DDRDATA4CH0_CR_TXTRAINRANK2_Spare1_WID ( 6)
+ #define DDRDATA4CH0_CR_TXTRAINRANK2_Spare1_MSK (0xFC000000)
+ #define DDRDATA4CH0_CR_TXTRAINRANK2_Spare1_MAX (0x0000003F)
+
+#define DDRDATA4CH0_CR_TXTRAINRANK3_REG (0x0000082C)
+ #define DDRDATA4CH0_CR_TXTRAINRANK3_TxDqDelay_OFF ( 0)
+ #define DDRDATA4CH0_CR_TXTRAINRANK3_TxDqDelay_WID ( 9)
+ #define DDRDATA4CH0_CR_TXTRAINRANK3_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA4CH0_CR_TXTRAINRANK3_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA4CH0_CR_TXTRAINRANK3_TxDqsDelay_OFF ( 9)
+ #define DDRDATA4CH0_CR_TXTRAINRANK3_TxDqsDelay_WID ( 9)
+ #define DDRDATA4CH0_CR_TXTRAINRANK3_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA4CH0_CR_TXTRAINRANK3_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA4CH0_CR_TXTRAINRANK3_Spare0_OFF (18)
+ #define DDRDATA4CH0_CR_TXTRAINRANK3_Spare0_WID ( 2)
+ #define DDRDATA4CH0_CR_TXTRAINRANK3_Spare0_MSK (0x000C0000)
+ #define DDRDATA4CH0_CR_TXTRAINRANK3_Spare0_MAX (0x00000003)
+ #define DDRDATA4CH0_CR_TXTRAINRANK3_TxEqualization_OFF (20)
+ #define DDRDATA4CH0_CR_TXTRAINRANK3_TxEqualization_WID ( 6)
+ #define DDRDATA4CH0_CR_TXTRAINRANK3_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA4CH0_CR_TXTRAINRANK3_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA4CH0_CR_TXTRAINRANK3_Spare1_OFF (26)
+ #define DDRDATA4CH0_CR_TXTRAINRANK3_Spare1_WID ( 6)
+ #define DDRDATA4CH0_CR_TXTRAINRANK3_Spare1_MSK (0xFC000000)
+ #define DDRDATA4CH0_CR_TXTRAINRANK3_Spare1_MAX (0x0000003F)
+
+#define DDRDATA4CH0_CR_TXPERBITRANK0_REG (0x00000830)
+ #define DDRDATA4CH0_CR_TXPERBITRANK0_Lane0_OFF ( 0)
+ #define DDRDATA4CH0_CR_TXPERBITRANK0_Lane0_WID ( 4)
+ #define DDRDATA4CH0_CR_TXPERBITRANK0_Lane0_MSK (0x0000000F)
+ #define DDRDATA4CH0_CR_TXPERBITRANK0_Lane0_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_TXPERBITRANK0_Lane1_OFF ( 4)
+ #define DDRDATA4CH0_CR_TXPERBITRANK0_Lane1_WID ( 4)
+ #define DDRDATA4CH0_CR_TXPERBITRANK0_Lane1_MSK (0x000000F0)
+ #define DDRDATA4CH0_CR_TXPERBITRANK0_Lane1_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_TXPERBITRANK0_Lane2_OFF ( 8)
+ #define DDRDATA4CH0_CR_TXPERBITRANK0_Lane2_WID ( 4)
+ #define DDRDATA4CH0_CR_TXPERBITRANK0_Lane2_MSK (0x00000F00)
+ #define DDRDATA4CH0_CR_TXPERBITRANK0_Lane2_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_TXPERBITRANK0_Lane3_OFF (12)
+ #define DDRDATA4CH0_CR_TXPERBITRANK0_Lane3_WID ( 4)
+ #define DDRDATA4CH0_CR_TXPERBITRANK0_Lane3_MSK (0x0000F000)
+ #define DDRDATA4CH0_CR_TXPERBITRANK0_Lane3_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_TXPERBITRANK0_Lane4_OFF (16)
+ #define DDRDATA4CH0_CR_TXPERBITRANK0_Lane4_WID ( 4)
+ #define DDRDATA4CH0_CR_TXPERBITRANK0_Lane4_MSK (0x000F0000)
+ #define DDRDATA4CH0_CR_TXPERBITRANK0_Lane4_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_TXPERBITRANK0_Lane5_OFF (20)
+ #define DDRDATA4CH0_CR_TXPERBITRANK0_Lane5_WID ( 4)
+ #define DDRDATA4CH0_CR_TXPERBITRANK0_Lane5_MSK (0x00F00000)
+ #define DDRDATA4CH0_CR_TXPERBITRANK0_Lane5_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_TXPERBITRANK0_Lane6_OFF (24)
+ #define DDRDATA4CH0_CR_TXPERBITRANK0_Lane6_WID ( 4)
+ #define DDRDATA4CH0_CR_TXPERBITRANK0_Lane6_MSK (0x0F000000)
+ #define DDRDATA4CH0_CR_TXPERBITRANK0_Lane6_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_TXPERBITRANK0_Lane7_OFF (28)
+ #define DDRDATA4CH0_CR_TXPERBITRANK0_Lane7_WID ( 4)
+ #define DDRDATA4CH0_CR_TXPERBITRANK0_Lane7_MSK (0xF0000000)
+ #define DDRDATA4CH0_CR_TXPERBITRANK0_Lane7_MAX (0x0000000F)
+
+#define DDRDATA4CH0_CR_TXPERBITRANK1_REG (0x00000834)
+ #define DDRDATA4CH0_CR_TXPERBITRANK1_Lane0_OFF ( 0)
+ #define DDRDATA4CH0_CR_TXPERBITRANK1_Lane0_WID ( 4)
+ #define DDRDATA4CH0_CR_TXPERBITRANK1_Lane0_MSK (0x0000000F)
+ #define DDRDATA4CH0_CR_TXPERBITRANK1_Lane0_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_TXPERBITRANK1_Lane1_OFF ( 4)
+ #define DDRDATA4CH0_CR_TXPERBITRANK1_Lane1_WID ( 4)
+ #define DDRDATA4CH0_CR_TXPERBITRANK1_Lane1_MSK (0x000000F0)
+ #define DDRDATA4CH0_CR_TXPERBITRANK1_Lane1_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_TXPERBITRANK1_Lane2_OFF ( 8)
+ #define DDRDATA4CH0_CR_TXPERBITRANK1_Lane2_WID ( 4)
+ #define DDRDATA4CH0_CR_TXPERBITRANK1_Lane2_MSK (0x00000F00)
+ #define DDRDATA4CH0_CR_TXPERBITRANK1_Lane2_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_TXPERBITRANK1_Lane3_OFF (12)
+ #define DDRDATA4CH0_CR_TXPERBITRANK1_Lane3_WID ( 4)
+ #define DDRDATA4CH0_CR_TXPERBITRANK1_Lane3_MSK (0x0000F000)
+ #define DDRDATA4CH0_CR_TXPERBITRANK1_Lane3_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_TXPERBITRANK1_Lane4_OFF (16)
+ #define DDRDATA4CH0_CR_TXPERBITRANK1_Lane4_WID ( 4)
+ #define DDRDATA4CH0_CR_TXPERBITRANK1_Lane4_MSK (0x000F0000)
+ #define DDRDATA4CH0_CR_TXPERBITRANK1_Lane4_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_TXPERBITRANK1_Lane5_OFF (20)
+ #define DDRDATA4CH0_CR_TXPERBITRANK1_Lane5_WID ( 4)
+ #define DDRDATA4CH0_CR_TXPERBITRANK1_Lane5_MSK (0x00F00000)
+ #define DDRDATA4CH0_CR_TXPERBITRANK1_Lane5_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_TXPERBITRANK1_Lane6_OFF (24)
+ #define DDRDATA4CH0_CR_TXPERBITRANK1_Lane6_WID ( 4)
+ #define DDRDATA4CH0_CR_TXPERBITRANK1_Lane6_MSK (0x0F000000)
+ #define DDRDATA4CH0_CR_TXPERBITRANK1_Lane6_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_TXPERBITRANK1_Lane7_OFF (28)
+ #define DDRDATA4CH0_CR_TXPERBITRANK1_Lane7_WID ( 4)
+ #define DDRDATA4CH0_CR_TXPERBITRANK1_Lane7_MSK (0xF0000000)
+ #define DDRDATA4CH0_CR_TXPERBITRANK1_Lane7_MAX (0x0000000F)
+
+#define DDRDATA4CH0_CR_TXPERBITRANK2_REG (0x00000838)
+ #define DDRDATA4CH0_CR_TXPERBITRANK2_Lane0_OFF ( 0)
+ #define DDRDATA4CH0_CR_TXPERBITRANK2_Lane0_WID ( 4)
+ #define DDRDATA4CH0_CR_TXPERBITRANK2_Lane0_MSK (0x0000000F)
+ #define DDRDATA4CH0_CR_TXPERBITRANK2_Lane0_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_TXPERBITRANK2_Lane1_OFF ( 4)
+ #define DDRDATA4CH0_CR_TXPERBITRANK2_Lane1_WID ( 4)
+ #define DDRDATA4CH0_CR_TXPERBITRANK2_Lane1_MSK (0x000000F0)
+ #define DDRDATA4CH0_CR_TXPERBITRANK2_Lane1_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_TXPERBITRANK2_Lane2_OFF ( 8)
+ #define DDRDATA4CH0_CR_TXPERBITRANK2_Lane2_WID ( 4)
+ #define DDRDATA4CH0_CR_TXPERBITRANK2_Lane2_MSK (0x00000F00)
+ #define DDRDATA4CH0_CR_TXPERBITRANK2_Lane2_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_TXPERBITRANK2_Lane3_OFF (12)
+ #define DDRDATA4CH0_CR_TXPERBITRANK2_Lane3_WID ( 4)
+ #define DDRDATA4CH0_CR_TXPERBITRANK2_Lane3_MSK (0x0000F000)
+ #define DDRDATA4CH0_CR_TXPERBITRANK2_Lane3_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_TXPERBITRANK2_Lane4_OFF (16)
+ #define DDRDATA4CH0_CR_TXPERBITRANK2_Lane4_WID ( 4)
+ #define DDRDATA4CH0_CR_TXPERBITRANK2_Lane4_MSK (0x000F0000)
+ #define DDRDATA4CH0_CR_TXPERBITRANK2_Lane4_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_TXPERBITRANK2_Lane5_OFF (20)
+ #define DDRDATA4CH0_CR_TXPERBITRANK2_Lane5_WID ( 4)
+ #define DDRDATA4CH0_CR_TXPERBITRANK2_Lane5_MSK (0x00F00000)
+ #define DDRDATA4CH0_CR_TXPERBITRANK2_Lane5_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_TXPERBITRANK2_Lane6_OFF (24)
+ #define DDRDATA4CH0_CR_TXPERBITRANK2_Lane6_WID ( 4)
+ #define DDRDATA4CH0_CR_TXPERBITRANK2_Lane6_MSK (0x0F000000)
+ #define DDRDATA4CH0_CR_TXPERBITRANK2_Lane6_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_TXPERBITRANK2_Lane7_OFF (28)
+ #define DDRDATA4CH0_CR_TXPERBITRANK2_Lane7_WID ( 4)
+ #define DDRDATA4CH0_CR_TXPERBITRANK2_Lane7_MSK (0xF0000000)
+ #define DDRDATA4CH0_CR_TXPERBITRANK2_Lane7_MAX (0x0000000F)
+
+#define DDRDATA4CH0_CR_TXPERBITRANK3_REG (0x0000083C)
+ #define DDRDATA4CH0_CR_TXPERBITRANK3_Lane0_OFF ( 0)
+ #define DDRDATA4CH0_CR_TXPERBITRANK3_Lane0_WID ( 4)
+ #define DDRDATA4CH0_CR_TXPERBITRANK3_Lane0_MSK (0x0000000F)
+ #define DDRDATA4CH0_CR_TXPERBITRANK3_Lane0_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_TXPERBITRANK3_Lane1_OFF ( 4)
+ #define DDRDATA4CH0_CR_TXPERBITRANK3_Lane1_WID ( 4)
+ #define DDRDATA4CH0_CR_TXPERBITRANK3_Lane1_MSK (0x000000F0)
+ #define DDRDATA4CH0_CR_TXPERBITRANK3_Lane1_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_TXPERBITRANK3_Lane2_OFF ( 8)
+ #define DDRDATA4CH0_CR_TXPERBITRANK3_Lane2_WID ( 4)
+ #define DDRDATA4CH0_CR_TXPERBITRANK3_Lane2_MSK (0x00000F00)
+ #define DDRDATA4CH0_CR_TXPERBITRANK3_Lane2_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_TXPERBITRANK3_Lane3_OFF (12)
+ #define DDRDATA4CH0_CR_TXPERBITRANK3_Lane3_WID ( 4)
+ #define DDRDATA4CH0_CR_TXPERBITRANK3_Lane3_MSK (0x0000F000)
+ #define DDRDATA4CH0_CR_TXPERBITRANK3_Lane3_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_TXPERBITRANK3_Lane4_OFF (16)
+ #define DDRDATA4CH0_CR_TXPERBITRANK3_Lane4_WID ( 4)
+ #define DDRDATA4CH0_CR_TXPERBITRANK3_Lane4_MSK (0x000F0000)
+ #define DDRDATA4CH0_CR_TXPERBITRANK3_Lane4_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_TXPERBITRANK3_Lane5_OFF (20)
+ #define DDRDATA4CH0_CR_TXPERBITRANK3_Lane5_WID ( 4)
+ #define DDRDATA4CH0_CR_TXPERBITRANK3_Lane5_MSK (0x00F00000)
+ #define DDRDATA4CH0_CR_TXPERBITRANK3_Lane5_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_TXPERBITRANK3_Lane6_OFF (24)
+ #define DDRDATA4CH0_CR_TXPERBITRANK3_Lane6_WID ( 4)
+ #define DDRDATA4CH0_CR_TXPERBITRANK3_Lane6_MSK (0x0F000000)
+ #define DDRDATA4CH0_CR_TXPERBITRANK3_Lane6_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_TXPERBITRANK3_Lane7_OFF (28)
+ #define DDRDATA4CH0_CR_TXPERBITRANK3_Lane7_WID ( 4)
+ #define DDRDATA4CH0_CR_TXPERBITRANK3_Lane7_MSK (0xF0000000)
+ #define DDRDATA4CH0_CR_TXPERBITRANK3_Lane7_MAX (0x0000000F)
+
+#define DDRDATA4CH0_CR_RCOMPDATA0_REG (0x00000840)
+ #define DDRDATA4CH0_CR_RCOMPDATA0_RcompDrvUp_OFF ( 0)
+ #define DDRDATA4CH0_CR_RCOMPDATA0_RcompDrvUp_WID ( 6)
+ #define DDRDATA4CH0_CR_RCOMPDATA0_RcompDrvUp_MSK (0x0000003F)
+ #define DDRDATA4CH0_CR_RCOMPDATA0_RcompDrvUp_MAX (0x0000003F)
+ #define DDRDATA4CH0_CR_RCOMPDATA0_Spare0_OFF ( 6)
+ #define DDRDATA4CH0_CR_RCOMPDATA0_Spare0_WID ( 3)
+ #define DDRDATA4CH0_CR_RCOMPDATA0_Spare0_MSK (0x000001C0)
+ #define DDRDATA4CH0_CR_RCOMPDATA0_Spare0_MAX (0x00000007)
+ #define DDRDATA4CH0_CR_RCOMPDATA0_RcompDrvDown_OFF ( 9)
+ #define DDRDATA4CH0_CR_RCOMPDATA0_RcompDrvDown_WID ( 6)
+ #define DDRDATA4CH0_CR_RCOMPDATA0_RcompDrvDown_MSK (0x00007E00)
+ #define DDRDATA4CH0_CR_RCOMPDATA0_RcompDrvDown_MAX (0x0000003F)
+ #define DDRDATA4CH0_CR_RCOMPDATA0_VTComp_OFF (15)
+ #define DDRDATA4CH0_CR_RCOMPDATA0_VTComp_WID ( 5)
+ #define DDRDATA4CH0_CR_RCOMPDATA0_VTComp_MSK (0x000F8000)
+ #define DDRDATA4CH0_CR_RCOMPDATA0_VTComp_MAX (0x0000001F)
+ #define DDRDATA4CH0_CR_RCOMPDATA0_TcoComp_OFF (20)
+ #define DDRDATA4CH0_CR_RCOMPDATA0_TcoComp_WID ( 6)
+ #define DDRDATA4CH0_CR_RCOMPDATA0_TcoComp_MSK (0x03F00000)
+ #define DDRDATA4CH0_CR_RCOMPDATA0_TcoComp_MAX (0x0000003F)
+ #define DDRDATA4CH0_CR_RCOMPDATA0_SlewRateComp_OFF (26)
+ #define DDRDATA4CH0_CR_RCOMPDATA0_SlewRateComp_WID ( 5)
+ #define DDRDATA4CH0_CR_RCOMPDATA0_SlewRateComp_MSK (0x7C000000)
+ #define DDRDATA4CH0_CR_RCOMPDATA0_SlewRateComp_MAX (0x0000001F)
+ #define DDRDATA4CH0_CR_RCOMPDATA0_Spare2_OFF (31)
+ #define DDRDATA4CH0_CR_RCOMPDATA0_Spare2_WID ( 1)
+ #define DDRDATA4CH0_CR_RCOMPDATA0_Spare2_MSK (0x80000000)
+ #define DDRDATA4CH0_CR_RCOMPDATA0_Spare2_MAX (0x00000001)
+
+#define DDRDATA4CH0_CR_RCOMPDATA1_REG (0x00000844)
+ #define DDRDATA4CH0_CR_RCOMPDATA1_RcompOdtUp_OFF ( 0)
+ #define DDRDATA4CH0_CR_RCOMPDATA1_RcompOdtUp_WID ( 6)
+ #define DDRDATA4CH0_CR_RCOMPDATA1_RcompOdtUp_MSK (0x0000003F)
+ #define DDRDATA4CH0_CR_RCOMPDATA1_RcompOdtUp_MAX (0x0000003F)
+ #define DDRDATA4CH0_CR_RCOMPDATA1_Spare0_OFF ( 6)
+ #define DDRDATA4CH0_CR_RCOMPDATA1_Spare0_WID ( 3)
+ #define DDRDATA4CH0_CR_RCOMPDATA1_Spare0_MSK (0x000001C0)
+ #define DDRDATA4CH0_CR_RCOMPDATA1_Spare0_MAX (0x00000007)
+ #define DDRDATA4CH0_CR_RCOMPDATA1_RcompOdtDown_OFF ( 9)
+ #define DDRDATA4CH0_CR_RCOMPDATA1_RcompOdtDown_WID ( 6)
+ #define DDRDATA4CH0_CR_RCOMPDATA1_RcompOdtDown_MSK (0x00007E00)
+ #define DDRDATA4CH0_CR_RCOMPDATA1_RcompOdtDown_MAX (0x0000003F)
+ #define DDRDATA4CH0_CR_RCOMPDATA1_Spare1_OFF (15)
+ #define DDRDATA4CH0_CR_RCOMPDATA1_Spare1_WID ( 1)
+ #define DDRDATA4CH0_CR_RCOMPDATA1_Spare1_MSK (0x00008000)
+ #define DDRDATA4CH0_CR_RCOMPDATA1_Spare1_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_RCOMPDATA1_PanicDrvDn_OFF (16)
+ #define DDRDATA4CH0_CR_RCOMPDATA1_PanicDrvDn_WID ( 6)
+ #define DDRDATA4CH0_CR_RCOMPDATA1_PanicDrvDn_MSK (0x003F0000)
+ #define DDRDATA4CH0_CR_RCOMPDATA1_PanicDrvDn_MAX (0x0000003F)
+ #define DDRDATA4CH0_CR_RCOMPDATA1_PanicDrvUp_OFF (22)
+ #define DDRDATA4CH0_CR_RCOMPDATA1_PanicDrvUp_WID ( 6)
+ #define DDRDATA4CH0_CR_RCOMPDATA1_PanicDrvUp_MSK (0x0FC00000)
+ #define DDRDATA4CH0_CR_RCOMPDATA1_PanicDrvUp_MAX (0x0000003F)
+ #define DDRDATA4CH0_CR_RCOMPDATA1_LevelShifterComp_OFF (28)
+ #define DDRDATA4CH0_CR_RCOMPDATA1_LevelShifterComp_WID ( 3)
+ #define DDRDATA4CH0_CR_RCOMPDATA1_LevelShifterComp_MSK (0x70000000)
+ #define DDRDATA4CH0_CR_RCOMPDATA1_LevelShifterComp_MAX (0x00000007)
+ #define DDRDATA4CH0_CR_RCOMPDATA1_Spare2_OFF (31)
+ #define DDRDATA4CH0_CR_RCOMPDATA1_Spare2_WID ( 1)
+ #define DDRDATA4CH0_CR_RCOMPDATA1_Spare2_MSK (0x80000000)
+ #define DDRDATA4CH0_CR_RCOMPDATA1_Spare2_MAX (0x00000001)
+
+#define DDRDATA4CH0_CR_TXXTALK_REG (0x00000848)
+ #define DDRDATA4CH0_CR_TXXTALK_Lane0_OFF ( 0)
+ #define DDRDATA4CH0_CR_TXXTALK_Lane0_WID ( 4)
+ #define DDRDATA4CH0_CR_TXXTALK_Lane0_MSK (0x0000000F)
+ #define DDRDATA4CH0_CR_TXXTALK_Lane0_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_TXXTALK_Lane1_OFF ( 4)
+ #define DDRDATA4CH0_CR_TXXTALK_Lane1_WID ( 4)
+ #define DDRDATA4CH0_CR_TXXTALK_Lane1_MSK (0x000000F0)
+ #define DDRDATA4CH0_CR_TXXTALK_Lane1_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_TXXTALK_Lane2_OFF ( 8)
+ #define DDRDATA4CH0_CR_TXXTALK_Lane2_WID ( 4)
+ #define DDRDATA4CH0_CR_TXXTALK_Lane2_MSK (0x00000F00)
+ #define DDRDATA4CH0_CR_TXXTALK_Lane2_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_TXXTALK_Lane3_OFF (12)
+ #define DDRDATA4CH0_CR_TXXTALK_Lane3_WID ( 4)
+ #define DDRDATA4CH0_CR_TXXTALK_Lane3_MSK (0x0000F000)
+ #define DDRDATA4CH0_CR_TXXTALK_Lane3_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_TXXTALK_Lane4_OFF (16)
+ #define DDRDATA4CH0_CR_TXXTALK_Lane4_WID ( 4)
+ #define DDRDATA4CH0_CR_TXXTALK_Lane4_MSK (0x000F0000)
+ #define DDRDATA4CH0_CR_TXXTALK_Lane4_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_TXXTALK_Lane5_OFF (20)
+ #define DDRDATA4CH0_CR_TXXTALK_Lane5_WID ( 4)
+ #define DDRDATA4CH0_CR_TXXTALK_Lane5_MSK (0x00F00000)
+ #define DDRDATA4CH0_CR_TXXTALK_Lane5_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_TXXTALK_Lane6_OFF (24)
+ #define DDRDATA4CH0_CR_TXXTALK_Lane6_WID ( 4)
+ #define DDRDATA4CH0_CR_TXXTALK_Lane6_MSK (0x0F000000)
+ #define DDRDATA4CH0_CR_TXXTALK_Lane6_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_TXXTALK_Lane7_OFF (28)
+ #define DDRDATA4CH0_CR_TXXTALK_Lane7_WID ( 4)
+ #define DDRDATA4CH0_CR_TXXTALK_Lane7_MSK (0xF0000000)
+ #define DDRDATA4CH0_CR_TXXTALK_Lane7_MAX (0x0000000F)
+
+#define DDRDATA4CH0_CR_RXOFFSETVDQ_REG (0x0000084C)
+ #define DDRDATA4CH0_CR_RXOFFSETVDQ_Lane0_OFF ( 0)
+ #define DDRDATA4CH0_CR_RXOFFSETVDQ_Lane0_WID ( 4)
+ #define DDRDATA4CH0_CR_RXOFFSETVDQ_Lane0_MSK (0x0000000F)
+ #define DDRDATA4CH0_CR_RXOFFSETVDQ_Lane0_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_RXOFFSETVDQ_Lane1_OFF ( 4)
+ #define DDRDATA4CH0_CR_RXOFFSETVDQ_Lane1_WID ( 4)
+ #define DDRDATA4CH0_CR_RXOFFSETVDQ_Lane1_MSK (0x000000F0)
+ #define DDRDATA4CH0_CR_RXOFFSETVDQ_Lane1_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_RXOFFSETVDQ_Lane2_OFF ( 8)
+ #define DDRDATA4CH0_CR_RXOFFSETVDQ_Lane2_WID ( 4)
+ #define DDRDATA4CH0_CR_RXOFFSETVDQ_Lane2_MSK (0x00000F00)
+ #define DDRDATA4CH0_CR_RXOFFSETVDQ_Lane2_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_RXOFFSETVDQ_Lane3_OFF (12)
+ #define DDRDATA4CH0_CR_RXOFFSETVDQ_Lane3_WID ( 4)
+ #define DDRDATA4CH0_CR_RXOFFSETVDQ_Lane3_MSK (0x0000F000)
+ #define DDRDATA4CH0_CR_RXOFFSETVDQ_Lane3_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_RXOFFSETVDQ_Lane4_OFF (16)
+ #define DDRDATA4CH0_CR_RXOFFSETVDQ_Lane4_WID ( 4)
+ #define DDRDATA4CH0_CR_RXOFFSETVDQ_Lane4_MSK (0x000F0000)
+ #define DDRDATA4CH0_CR_RXOFFSETVDQ_Lane4_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_RXOFFSETVDQ_Lane5_OFF (20)
+ #define DDRDATA4CH0_CR_RXOFFSETVDQ_Lane5_WID ( 4)
+ #define DDRDATA4CH0_CR_RXOFFSETVDQ_Lane5_MSK (0x00F00000)
+ #define DDRDATA4CH0_CR_RXOFFSETVDQ_Lane5_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_RXOFFSETVDQ_Lane6_OFF (24)
+ #define DDRDATA4CH0_CR_RXOFFSETVDQ_Lane6_WID ( 4)
+ #define DDRDATA4CH0_CR_RXOFFSETVDQ_Lane6_MSK (0x0F000000)
+ #define DDRDATA4CH0_CR_RXOFFSETVDQ_Lane6_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_RXOFFSETVDQ_Lane7_OFF (28)
+ #define DDRDATA4CH0_CR_RXOFFSETVDQ_Lane7_WID ( 4)
+ #define DDRDATA4CH0_CR_RXOFFSETVDQ_Lane7_MSK (0xF0000000)
+ #define DDRDATA4CH0_CR_RXOFFSETVDQ_Lane7_MAX (0x0000000F)
+
+#define DDRDATA4CH0_CR_DDRDATARESERVED_REG (0x00000850)
+ #define DDRDATA4CH0_CR_DDRDATARESERVED_Spare_OFF ( 0)
+ #define DDRDATA4CH0_CR_DDRDATARESERVED_Spare_WID (32)
+ #define DDRDATA4CH0_CR_DDRDATARESERVED_Spare_MSK (0xFFFFFFFF)
+ #define DDRDATA4CH0_CR_DDRDATARESERVED_Spare_MAX (0xFFFFFFFF)
+
+#define DDRDATA4CH0_CR_DATATRAINFEEDBACK_REG (0x00000854)
+ #define DDRDATA4CH0_CR_DATATRAINFEEDBACK_DataTrainFeedback_OFF ( 0)
+ #define DDRDATA4CH0_CR_DATATRAINFEEDBACK_DataTrainFeedback_WID ( 9)
+ #define DDRDATA4CH0_CR_DATATRAINFEEDBACK_DataTrainFeedback_MSK (0x000001FF)
+ #define DDRDATA4CH0_CR_DATATRAINFEEDBACK_DataTrainFeedback_MAX (0x000001FF)
+ #define DDRDATA4CH0_CR_DATATRAINFEEDBACK_Spare_OFF ( 9)
+ #define DDRDATA4CH0_CR_DATATRAINFEEDBACK_Spare_WID (23)
+ #define DDRDATA4CH0_CR_DATATRAINFEEDBACK_Spare_MSK (0xFFFFFE00)
+ #define DDRDATA4CH0_CR_DATATRAINFEEDBACK_Spare_MAX (0x007FFFFF)
+
+#define DDRDATA4CH0_CR_DLLPITESTANDADC_REG (0x00000858)
+ #define DDRDATA4CH0_CR_DLLPITESTANDADC_RunTest_OFF ( 0)
+ #define DDRDATA4CH0_CR_DLLPITESTANDADC_RunTest_WID ( 1)
+ #define DDRDATA4CH0_CR_DLLPITESTANDADC_RunTest_MSK (0x00000001)
+ #define DDRDATA4CH0_CR_DLLPITESTANDADC_RunTest_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DLLPITESTANDADC_RunTest_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DLLPITESTANDADC_Load_OFF ( 1)
+ #define DDRDATA4CH0_CR_DLLPITESTANDADC_Load_WID ( 1)
+ #define DDRDATA4CH0_CR_DLLPITESTANDADC_Load_MSK (0x00000002)
+ #define DDRDATA4CH0_CR_DLLPITESTANDADC_Load_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DLLPITESTANDADC_Load_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DLLPITESTANDADC_ModeHVM_OFF ( 2)
+ #define DDRDATA4CH0_CR_DLLPITESTANDADC_ModeHVM_WID ( 1)
+ #define DDRDATA4CH0_CR_DLLPITESTANDADC_ModeHVM_MSK (0x00000004)
+ #define DDRDATA4CH0_CR_DLLPITESTANDADC_ModeHVM_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DLLPITESTANDADC_ModeHVM_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DLLPITESTANDADC_ModeDV_OFF ( 3)
+ #define DDRDATA4CH0_CR_DLLPITESTANDADC_ModeDV_WID ( 1)
+ #define DDRDATA4CH0_CR_DLLPITESTANDADC_ModeDV_MSK (0x00000008)
+ #define DDRDATA4CH0_CR_DLLPITESTANDADC_ModeDV_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DLLPITESTANDADC_ModeDV_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DLLPITESTANDADC_ModeADC_OFF ( 4)
+ #define DDRDATA4CH0_CR_DLLPITESTANDADC_ModeADC_WID ( 1)
+ #define DDRDATA4CH0_CR_DLLPITESTANDADC_ModeADC_MSK (0x00000010)
+ #define DDRDATA4CH0_CR_DLLPITESTANDADC_ModeADC_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DLLPITESTANDADC_ModeADC_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DLLPITESTANDADC_LoadCount_OFF ( 5)
+ #define DDRDATA4CH0_CR_DLLPITESTANDADC_LoadCount_WID (10)
+ #define DDRDATA4CH0_CR_DLLPITESTANDADC_LoadCount_MSK (0x00007FE0)
+ #define DDRDATA4CH0_CR_DLLPITESTANDADC_LoadCount_MAX (0x000003FF)
+ #define DDRDATA4CH0_CR_DLLPITESTANDADC_CountStatus_OFF (15)
+ #define DDRDATA4CH0_CR_DLLPITESTANDADC_CountStatus_WID (10)
+ #define DDRDATA4CH0_CR_DLLPITESTANDADC_CountStatus_MSK (0x01FF8000)
+ #define DDRDATA4CH0_CR_DLLPITESTANDADC_CountStatus_MAX (0x000003FF)
+ #define DDRDATA4CH0_CR_DLLPITESTANDADC_CountStatus_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DLLPITESTANDADC_Spare_OFF (25)
+ #define DDRDATA4CH0_CR_DLLPITESTANDADC_Spare_WID ( 7)
+ #define DDRDATA4CH0_CR_DLLPITESTANDADC_Spare_MSK (0xFE000000)
+ #define DDRDATA4CH0_CR_DLLPITESTANDADC_Spare_MAX (0x0000007F)
+
+#define DDRDATA4CH0_CR_DDRCRDATAOFFSETCOMP_REG (0x0000085C)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_OFF ( 0)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_WID ( 6)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_MSK (0x0000003F)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_MAX (0x0000003F)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_OFF ( 6)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_WID ( 6)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_MSK (0x00000FC0)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_MAX (0x0000003F)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_OFF (12)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_WID ( 5)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_MSK (0x0001F000)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_MAX (0x0000001F)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_OFF (17)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_WID ( 5)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_MSK (0x003E0000)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_MAX (0x0000001F)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_OFF (22)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_WID ( 5)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_MSK (0x07C00000)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_MAX (0x0000001F)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_OFF (27)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_WID ( 5)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_MSK (0xF8000000)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_MAX (0x0000001F)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_DEF (0x00000000)
+
+#define DDRDATA4CH0_CR_DDRCRDATACONTROL1_REG (0x00000860)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_RefPi_OFF ( 0)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_RefPi_WID ( 4)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_RefPi_MSK (0x0000000F)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_RefPi_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_RefPi_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_DllMask_OFF ( 4)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_DllMask_WID ( 2)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_DllMask_MSK (0x00000030)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_DllMask_MAX (0x00000003)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_DllMask_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_DllWeakLock_OFF ( 6)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_DllWeakLock_WID ( 1)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_DllWeakLock_MSK (0x00000040)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_DllWeakLock_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_DllWeakLock_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_OFF ( 7)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_WID ( 3)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_MSK (0x00000380)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_MAX (0x00000007)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_OFF (10)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_WID ( 3)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_MSK (0x00001C00)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_MAX (0x00000007)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_OdtDelay_OFF (13)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_OdtDelay_WID ( 4)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_OdtDelay_MSK (0x0001E000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_OdtDelay_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_OdtDelay_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_OdtDuration_OFF (17)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_OdtDuration_WID ( 3)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_OdtDuration_MSK (0x000E0000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_OdtDuration_MAX (0x00000007)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_OdtDuration_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_OFF (20)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_WID ( 4)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_MSK (0x00F00000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_OFF (24)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_WID ( 3)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_MSK (0x07000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_MAX (0x00000007)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_OFF (27)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_WID ( 3)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_MSK (0x38000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_MAX (0x00000007)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_OFF (30)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_WID ( 1)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_MSK (0x40000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_Rsvd1_OFF (31)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_Rsvd1_WID ( 1)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_Rsvd1_MSK (0x80000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_Rsvd1_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL1_Rsvd1_DEF (0x00000000)
+
+#define DDRDATA4CH0_CR_DDRCRDATACONTROL2_REG (0x00000864)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_OFF ( 0)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_WID ( 5)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_MSK (0x0000001F)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_MAX (0x0000001F)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_OFF ( 5)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_WID ( 1)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_MSK (0x00000020)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL2_ForceRxOn_OFF ( 6)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL2_ForceRxOn_WID ( 1)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL2_ForceRxOn_MSK (0x00000040)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL2_ForceRxOn_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL2_ForceRxOn_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL2_LeakerComp_OFF ( 7)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL2_LeakerComp_WID ( 2)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL2_LeakerComp_MSK (0x00000180)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL2_LeakerComp_MAX (0x00000003)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL2_LeakerComp_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_OFF ( 9)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_WID ( 4)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_MSK (0x00001E00)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_MAX (0x0000000F)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_DEF (0x00000008)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_OFF (13)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_WID ( 5)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_MSK (0x0003E000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_MAX (0x0000001F)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_DEF (0x00000011)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_OFF (18)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_WID ( 1)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_MSK (0x00040000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL2_Spare_OFF (19)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL2_Spare_WID (13)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL2_Spare_MSK (0xFFF80000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL2_Spare_MAX (0x00001FFF)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL2_Spare_DEF (0x00000000)
+
+#define DDRDATA4CH0_CR_DDRCRVSSHIORVREFCONTROL_REG (0x0000086C)
+ #define DDRDATA4CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_OFF ( 0)
+ #define DDRDATA4CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_WID (24)
+ #define DDRDATA4CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_MSK (0x00FFFFFF)
+ #define DDRDATA4CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_MAX (0x00FFFFFF)
+ #define DDRDATA4CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_OFF (24)
+ #define DDRDATA4CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_WID ( 8)
+ #define DDRDATA4CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_MSK (0xFF000000)
+ #define DDRDATA4CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_MAX (0x000000FF)
+ #define DDRDATA4CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_DEF (0x00000000)
+
+#define DDRDATA4CH0_CR_DDRCRDATAOFFSETTRAIN_REG (0x00000870)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_OFF ( 0)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_WID ( 6)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_MSK (0x0000003F)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_MAX (0x0000003F)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_OFF ( 6)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_WID ( 6)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_MSK (0x00000FC0)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_MAX (0x0000003F)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_OFF (12)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_WID ( 6)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_MSK (0x0003F000)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_MAX (0x0000003F)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_OFF (18)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_WID ( 6)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_MSK (0x00FC0000)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_MAX (0x0000003F)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_OFF (24)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_WID ( 7)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_MSK (0x7F000000)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_MAX (0x0000007F)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_OFF (31)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_WID ( 1)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_MSK (0x80000000)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_DEF (0x00000000)
+
+#define DDRDATA4CH0_CR_DDRCRDATACONTROL0_REG (0x00000874)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_OFF ( 0)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_WID ( 1)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_MSK (0x00000001)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_OFF ( 1)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_WID ( 1)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_MSK (0x00000002)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_OFF ( 2)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_WID ( 1)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_MSK (0x00000004)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_OFF ( 3)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_WID ( 1)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_MSK (0x00000008)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_TxOn_OFF ( 4)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_TxOn_WID ( 1)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_TxOn_MSK (0x00000010)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_TxOn_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_TxOn_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_RfOn_OFF ( 5)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_RfOn_WID ( 1)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_RfOn_MSK (0x00000020)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_RfOn_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_RfOn_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_RxPiOn_OFF ( 6)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_RxPiOn_WID ( 1)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_RxPiOn_MSK (0x00000040)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_RxPiOn_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_RxPiOn_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_TxPiOn_OFF ( 7)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_TxPiOn_WID ( 1)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_TxPiOn_MSK (0x00000080)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_TxPiOn_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_TxPiOn_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_OFF ( 8)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_WID ( 1)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_MSK (0x00000100)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_OFF ( 9)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_WID ( 1)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_MSK (0x00000200)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_TxDisable_OFF (10)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_TxDisable_WID ( 1)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_TxDisable_MSK (0x00000400)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_TxDisable_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_TxDisable_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_RxDisable_OFF (11)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_RxDisable_WID ( 1)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_RxDisable_MSK (0x00000800)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_RxDisable_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_RxDisable_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_TxLong_OFF (12)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_TxLong_WID ( 1)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_TxLong_MSK (0x00001000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_TxLong_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_TxLong_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_OFF (13)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_WID ( 2)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_MSK (0x00006000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_MAX (0x00000003)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_RxReadPointer_OFF (15)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_RxReadPointer_WID ( 3)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_RxReadPointer_MSK (0x00038000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_RxReadPointer_MAX (0x00000007)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_RxReadPointer_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_OFF (18)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_WID ( 1)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_MSK (0x00040000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_OFF (19)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_WID ( 1)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_MSK (0x00080000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_ReadRFRd_OFF (20)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_ReadRFRd_WID ( 1)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_ReadRFRd_MSK (0x00100000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_ReadRFRd_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_ReadRFRd_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_ReadRFWr_OFF (21)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_ReadRFWr_WID ( 1)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_ReadRFWr_MSK (0x00200000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_ReadRFWr_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_ReadRFWr_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_ReadRFRank_OFF (22)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_ReadRFRank_WID ( 2)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_ReadRFRank_MSK (0x00C00000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_ReadRFRank_MAX (0x00000003)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_ReadRFRank_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_OFF (24)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_WID ( 1)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_MSK (0x01000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_OdtSampOff_OFF (25)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_OdtSampOff_WID ( 1)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_OdtSampOff_MSK (0x02000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_OdtSampOff_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_OdtSampOff_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_OFF (26)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_WID ( 1)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_MSK (0x04000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_OFF (27)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_WID ( 1)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_MSK (0x08000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_OFF (28)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_WID ( 1)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_MSK (0x10000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_OFF (29)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_WID ( 1)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_MSK (0x20000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_OFF (30)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_WID ( 1)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_MSK (0x40000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_OFF (31)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_WID ( 1)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_MSK (0x80000000)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_DEF (0x00000000)
+
+#define DDRDATA4CH0_CR_DDRCRVREFADJUST1_REG (0x00000878)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_OFF ( 0)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_WID ( 7)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_MSK (0x0000007F)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_MAX (0x0000007F)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_OFF ( 7)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_WID ( 7)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_MSK (0x00003F80)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_MAX (0x0000007F)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_OFF (14)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_WID ( 7)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_MSK (0x001FC000)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_MAX (0x0000007F)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_OFF (21)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_WID ( 1)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_MSK (0x00200000)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_OFF (22)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_WID ( 1)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_MSK (0x00400000)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_OFF (23)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_WID ( 1)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_MSK (0x00800000)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_OFF (24)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_WID ( 2)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_MSK (0x03000000)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_MAX (0x00000003)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_OFF (26)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_WID ( 1)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_MSK (0x04000000)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_Rsvd_OFF (27)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_Rsvd_WID ( 2)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_Rsvd_MSK (0x18000000)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_Rsvd_MAX (0x00000003)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_Rsvd_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_caSlowBW_OFF (29)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_caSlowBW_WID ( 1)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_caSlowBW_MSK (0x20000000)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_caSlowBW_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_caSlowBW_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_OFF (30)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_WID ( 1)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_MSK (0x40000000)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_DEF (0x00000000)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_OFF (31)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_WID ( 1)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_MSK (0x80000000)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_MAX (0x00000001)
+ #define DDRDATA4CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_DEF (0x00000000)
+
+#define DDRDATA4CH1_CR_RXTRAINRANK0_REG (0x00000900)
+ #define DDRDATA4CH1_CR_RXTRAINRANK0_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA4CH1_CR_RXTRAINRANK0_RxRcvEnPi_WID ( 9)
+ #define DDRDATA4CH1_CR_RXTRAINRANK0_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA4CH1_CR_RXTRAINRANK0_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA4CH1_CR_RXTRAINRANK0_RxDqsPPi_OFF ( 9)
+ #define DDRDATA4CH1_CR_RXTRAINRANK0_RxDqsPPi_WID ( 6)
+ #define DDRDATA4CH1_CR_RXTRAINRANK0_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA4CH1_CR_RXTRAINRANK0_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA4CH1_CR_RXTRAINRANK0_RxEq_OFF (15)
+ #define DDRDATA4CH1_CR_RXTRAINRANK0_RxEq_WID ( 5)
+ #define DDRDATA4CH1_CR_RXTRAINRANK0_RxEq_MSK (0x000F8000)
+ #define DDRDATA4CH1_CR_RXTRAINRANK0_RxEq_MAX (0x0000001F)
+ #define DDRDATA4CH1_CR_RXTRAINRANK0_RxDqsNPi_OFF (20)
+ #define DDRDATA4CH1_CR_RXTRAINRANK0_RxDqsNPi_WID ( 6)
+ #define DDRDATA4CH1_CR_RXTRAINRANK0_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA4CH1_CR_RXTRAINRANK0_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA4CH1_CR_RXTRAINRANK0_RxVref_OFF (26)
+ #define DDRDATA4CH1_CR_RXTRAINRANK0_RxVref_WID ( 6)
+ #define DDRDATA4CH1_CR_RXTRAINRANK0_RxVref_MSK (0xFC000000)
+ #define DDRDATA4CH1_CR_RXTRAINRANK0_RxVref_MAX (0x0000003F)
+
+#define DDRDATA4CH1_CR_RXTRAINRANK1_REG (0x00000904)
+ #define DDRDATA4CH1_CR_RXTRAINRANK1_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA4CH1_CR_RXTRAINRANK1_RxRcvEnPi_WID ( 9)
+ #define DDRDATA4CH1_CR_RXTRAINRANK1_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA4CH1_CR_RXTRAINRANK1_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA4CH1_CR_RXTRAINRANK1_RxDqsPPi_OFF ( 9)
+ #define DDRDATA4CH1_CR_RXTRAINRANK1_RxDqsPPi_WID ( 6)
+ #define DDRDATA4CH1_CR_RXTRAINRANK1_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA4CH1_CR_RXTRAINRANK1_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA4CH1_CR_RXTRAINRANK1_RxEq_OFF (15)
+ #define DDRDATA4CH1_CR_RXTRAINRANK1_RxEq_WID ( 5)
+ #define DDRDATA4CH1_CR_RXTRAINRANK1_RxEq_MSK (0x000F8000)
+ #define DDRDATA4CH1_CR_RXTRAINRANK1_RxEq_MAX (0x0000001F)
+ #define DDRDATA4CH1_CR_RXTRAINRANK1_RxDqsNPi_OFF (20)
+ #define DDRDATA4CH1_CR_RXTRAINRANK1_RxDqsNPi_WID ( 6)
+ #define DDRDATA4CH1_CR_RXTRAINRANK1_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA4CH1_CR_RXTRAINRANK1_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA4CH1_CR_RXTRAINRANK1_RxVref_OFF (26)
+ #define DDRDATA4CH1_CR_RXTRAINRANK1_RxVref_WID ( 6)
+ #define DDRDATA4CH1_CR_RXTRAINRANK1_RxVref_MSK (0xFC000000)
+ #define DDRDATA4CH1_CR_RXTRAINRANK1_RxVref_MAX (0x0000003F)
+
+#define DDRDATA4CH1_CR_RXTRAINRANK2_REG (0x00000908)
+ #define DDRDATA4CH1_CR_RXTRAINRANK2_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA4CH1_CR_RXTRAINRANK2_RxRcvEnPi_WID ( 9)
+ #define DDRDATA4CH1_CR_RXTRAINRANK2_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA4CH1_CR_RXTRAINRANK2_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA4CH1_CR_RXTRAINRANK2_RxDqsPPi_OFF ( 9)
+ #define DDRDATA4CH1_CR_RXTRAINRANK2_RxDqsPPi_WID ( 6)
+ #define DDRDATA4CH1_CR_RXTRAINRANK2_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA4CH1_CR_RXTRAINRANK2_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA4CH1_CR_RXTRAINRANK2_RxEq_OFF (15)
+ #define DDRDATA4CH1_CR_RXTRAINRANK2_RxEq_WID ( 5)
+ #define DDRDATA4CH1_CR_RXTRAINRANK2_RxEq_MSK (0x000F8000)
+ #define DDRDATA4CH1_CR_RXTRAINRANK2_RxEq_MAX (0x0000001F)
+ #define DDRDATA4CH1_CR_RXTRAINRANK2_RxDqsNPi_OFF (20)
+ #define DDRDATA4CH1_CR_RXTRAINRANK2_RxDqsNPi_WID ( 6)
+ #define DDRDATA4CH1_CR_RXTRAINRANK2_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA4CH1_CR_RXTRAINRANK2_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA4CH1_CR_RXTRAINRANK2_RxVref_OFF (26)
+ #define DDRDATA4CH1_CR_RXTRAINRANK2_RxVref_WID ( 6)
+ #define DDRDATA4CH1_CR_RXTRAINRANK2_RxVref_MSK (0xFC000000)
+ #define DDRDATA4CH1_CR_RXTRAINRANK2_RxVref_MAX (0x0000003F)
+
+#define DDRDATA4CH1_CR_RXTRAINRANK3_REG (0x0000090C)
+ #define DDRDATA4CH1_CR_RXTRAINRANK3_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA4CH1_CR_RXTRAINRANK3_RxRcvEnPi_WID ( 9)
+ #define DDRDATA4CH1_CR_RXTRAINRANK3_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA4CH1_CR_RXTRAINRANK3_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA4CH1_CR_RXTRAINRANK3_RxDqsPPi_OFF ( 9)
+ #define DDRDATA4CH1_CR_RXTRAINRANK3_RxDqsPPi_WID ( 6)
+ #define DDRDATA4CH1_CR_RXTRAINRANK3_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA4CH1_CR_RXTRAINRANK3_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA4CH1_CR_RXTRAINRANK3_RxEq_OFF (15)
+ #define DDRDATA4CH1_CR_RXTRAINRANK3_RxEq_WID ( 5)
+ #define DDRDATA4CH1_CR_RXTRAINRANK3_RxEq_MSK (0x000F8000)
+ #define DDRDATA4CH1_CR_RXTRAINRANK3_RxEq_MAX (0x0000001F)
+ #define DDRDATA4CH1_CR_RXTRAINRANK3_RxDqsNPi_OFF (20)
+ #define DDRDATA4CH1_CR_RXTRAINRANK3_RxDqsNPi_WID ( 6)
+ #define DDRDATA4CH1_CR_RXTRAINRANK3_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA4CH1_CR_RXTRAINRANK3_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA4CH1_CR_RXTRAINRANK3_RxVref_OFF (26)
+ #define DDRDATA4CH1_CR_RXTRAINRANK3_RxVref_WID ( 6)
+ #define DDRDATA4CH1_CR_RXTRAINRANK3_RxVref_MSK (0xFC000000)
+ #define DDRDATA4CH1_CR_RXTRAINRANK3_RxVref_MAX (0x0000003F)
+
+#define DDRDATA4CH1_CR_RXPERBITRANK0_REG (0x00000910)
+ #define DDRDATA4CH1_CR_RXPERBITRANK0_Lane0_OFF ( 0)
+ #define DDRDATA4CH1_CR_RXPERBITRANK0_Lane0_WID ( 4)
+ #define DDRDATA4CH1_CR_RXPERBITRANK0_Lane0_MSK (0x0000000F)
+ #define DDRDATA4CH1_CR_RXPERBITRANK0_Lane0_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_RXPERBITRANK0_Lane1_OFF ( 4)
+ #define DDRDATA4CH1_CR_RXPERBITRANK0_Lane1_WID ( 4)
+ #define DDRDATA4CH1_CR_RXPERBITRANK0_Lane1_MSK (0x000000F0)
+ #define DDRDATA4CH1_CR_RXPERBITRANK0_Lane1_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_RXPERBITRANK0_Lane2_OFF ( 8)
+ #define DDRDATA4CH1_CR_RXPERBITRANK0_Lane2_WID ( 4)
+ #define DDRDATA4CH1_CR_RXPERBITRANK0_Lane2_MSK (0x00000F00)
+ #define DDRDATA4CH1_CR_RXPERBITRANK0_Lane2_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_RXPERBITRANK0_Lane3_OFF (12)
+ #define DDRDATA4CH1_CR_RXPERBITRANK0_Lane3_WID ( 4)
+ #define DDRDATA4CH1_CR_RXPERBITRANK0_Lane3_MSK (0x0000F000)
+ #define DDRDATA4CH1_CR_RXPERBITRANK0_Lane3_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_RXPERBITRANK0_Lane4_OFF (16)
+ #define DDRDATA4CH1_CR_RXPERBITRANK0_Lane4_WID ( 4)
+ #define DDRDATA4CH1_CR_RXPERBITRANK0_Lane4_MSK (0x000F0000)
+ #define DDRDATA4CH1_CR_RXPERBITRANK0_Lane4_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_RXPERBITRANK0_Lane5_OFF (20)
+ #define DDRDATA4CH1_CR_RXPERBITRANK0_Lane5_WID ( 4)
+ #define DDRDATA4CH1_CR_RXPERBITRANK0_Lane5_MSK (0x00F00000)
+ #define DDRDATA4CH1_CR_RXPERBITRANK0_Lane5_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_RXPERBITRANK0_Lane6_OFF (24)
+ #define DDRDATA4CH1_CR_RXPERBITRANK0_Lane6_WID ( 4)
+ #define DDRDATA4CH1_CR_RXPERBITRANK0_Lane6_MSK (0x0F000000)
+ #define DDRDATA4CH1_CR_RXPERBITRANK0_Lane6_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_RXPERBITRANK0_Lane7_OFF (28)
+ #define DDRDATA4CH1_CR_RXPERBITRANK0_Lane7_WID ( 4)
+ #define DDRDATA4CH1_CR_RXPERBITRANK0_Lane7_MSK (0xF0000000)
+ #define DDRDATA4CH1_CR_RXPERBITRANK0_Lane7_MAX (0x0000000F)
+
+#define DDRDATA4CH1_CR_RXPERBITRANK1_REG (0x00000914)
+ #define DDRDATA4CH1_CR_RXPERBITRANK1_Lane0_OFF ( 0)
+ #define DDRDATA4CH1_CR_RXPERBITRANK1_Lane0_WID ( 4)
+ #define DDRDATA4CH1_CR_RXPERBITRANK1_Lane0_MSK (0x0000000F)
+ #define DDRDATA4CH1_CR_RXPERBITRANK1_Lane0_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_RXPERBITRANK1_Lane1_OFF ( 4)
+ #define DDRDATA4CH1_CR_RXPERBITRANK1_Lane1_WID ( 4)
+ #define DDRDATA4CH1_CR_RXPERBITRANK1_Lane1_MSK (0x000000F0)
+ #define DDRDATA4CH1_CR_RXPERBITRANK1_Lane1_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_RXPERBITRANK1_Lane2_OFF ( 8)
+ #define DDRDATA4CH1_CR_RXPERBITRANK1_Lane2_WID ( 4)
+ #define DDRDATA4CH1_CR_RXPERBITRANK1_Lane2_MSK (0x00000F00)
+ #define DDRDATA4CH1_CR_RXPERBITRANK1_Lane2_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_RXPERBITRANK1_Lane3_OFF (12)
+ #define DDRDATA4CH1_CR_RXPERBITRANK1_Lane3_WID ( 4)
+ #define DDRDATA4CH1_CR_RXPERBITRANK1_Lane3_MSK (0x0000F000)
+ #define DDRDATA4CH1_CR_RXPERBITRANK1_Lane3_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_RXPERBITRANK1_Lane4_OFF (16)
+ #define DDRDATA4CH1_CR_RXPERBITRANK1_Lane4_WID ( 4)
+ #define DDRDATA4CH1_CR_RXPERBITRANK1_Lane4_MSK (0x000F0000)
+ #define DDRDATA4CH1_CR_RXPERBITRANK1_Lane4_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_RXPERBITRANK1_Lane5_OFF (20)
+ #define DDRDATA4CH1_CR_RXPERBITRANK1_Lane5_WID ( 4)
+ #define DDRDATA4CH1_CR_RXPERBITRANK1_Lane5_MSK (0x00F00000)
+ #define DDRDATA4CH1_CR_RXPERBITRANK1_Lane5_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_RXPERBITRANK1_Lane6_OFF (24)
+ #define DDRDATA4CH1_CR_RXPERBITRANK1_Lane6_WID ( 4)
+ #define DDRDATA4CH1_CR_RXPERBITRANK1_Lane6_MSK (0x0F000000)
+ #define DDRDATA4CH1_CR_RXPERBITRANK1_Lane6_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_RXPERBITRANK1_Lane7_OFF (28)
+ #define DDRDATA4CH1_CR_RXPERBITRANK1_Lane7_WID ( 4)
+ #define DDRDATA4CH1_CR_RXPERBITRANK1_Lane7_MSK (0xF0000000)
+ #define DDRDATA4CH1_CR_RXPERBITRANK1_Lane7_MAX (0x0000000F)
+
+#define DDRDATA4CH1_CR_RXPERBITRANK2_REG (0x00000918)
+ #define DDRDATA4CH1_CR_RXPERBITRANK2_Lane0_OFF ( 0)
+ #define DDRDATA4CH1_CR_RXPERBITRANK2_Lane0_WID ( 4)
+ #define DDRDATA4CH1_CR_RXPERBITRANK2_Lane0_MSK (0x0000000F)
+ #define DDRDATA4CH1_CR_RXPERBITRANK2_Lane0_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_RXPERBITRANK2_Lane1_OFF ( 4)
+ #define DDRDATA4CH1_CR_RXPERBITRANK2_Lane1_WID ( 4)
+ #define DDRDATA4CH1_CR_RXPERBITRANK2_Lane1_MSK (0x000000F0)
+ #define DDRDATA4CH1_CR_RXPERBITRANK2_Lane1_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_RXPERBITRANK2_Lane2_OFF ( 8)
+ #define DDRDATA4CH1_CR_RXPERBITRANK2_Lane2_WID ( 4)
+ #define DDRDATA4CH1_CR_RXPERBITRANK2_Lane2_MSK (0x00000F00)
+ #define DDRDATA4CH1_CR_RXPERBITRANK2_Lane2_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_RXPERBITRANK2_Lane3_OFF (12)
+ #define DDRDATA4CH1_CR_RXPERBITRANK2_Lane3_WID ( 4)
+ #define DDRDATA4CH1_CR_RXPERBITRANK2_Lane3_MSK (0x0000F000)
+ #define DDRDATA4CH1_CR_RXPERBITRANK2_Lane3_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_RXPERBITRANK2_Lane4_OFF (16)
+ #define DDRDATA4CH1_CR_RXPERBITRANK2_Lane4_WID ( 4)
+ #define DDRDATA4CH1_CR_RXPERBITRANK2_Lane4_MSK (0x000F0000)
+ #define DDRDATA4CH1_CR_RXPERBITRANK2_Lane4_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_RXPERBITRANK2_Lane5_OFF (20)
+ #define DDRDATA4CH1_CR_RXPERBITRANK2_Lane5_WID ( 4)
+ #define DDRDATA4CH1_CR_RXPERBITRANK2_Lane5_MSK (0x00F00000)
+ #define DDRDATA4CH1_CR_RXPERBITRANK2_Lane5_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_RXPERBITRANK2_Lane6_OFF (24)
+ #define DDRDATA4CH1_CR_RXPERBITRANK2_Lane6_WID ( 4)
+ #define DDRDATA4CH1_CR_RXPERBITRANK2_Lane6_MSK (0x0F000000)
+ #define DDRDATA4CH1_CR_RXPERBITRANK2_Lane6_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_RXPERBITRANK2_Lane7_OFF (28)
+ #define DDRDATA4CH1_CR_RXPERBITRANK2_Lane7_WID ( 4)
+ #define DDRDATA4CH1_CR_RXPERBITRANK2_Lane7_MSK (0xF0000000)
+ #define DDRDATA4CH1_CR_RXPERBITRANK2_Lane7_MAX (0x0000000F)
+
+#define DDRDATA4CH1_CR_RXPERBITRANK3_REG (0x0000091C)
+ #define DDRDATA4CH1_CR_RXPERBITRANK3_Lane0_OFF ( 0)
+ #define DDRDATA4CH1_CR_RXPERBITRANK3_Lane0_WID ( 4)
+ #define DDRDATA4CH1_CR_RXPERBITRANK3_Lane0_MSK (0x0000000F)
+ #define DDRDATA4CH1_CR_RXPERBITRANK3_Lane0_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_RXPERBITRANK3_Lane1_OFF ( 4)
+ #define DDRDATA4CH1_CR_RXPERBITRANK3_Lane1_WID ( 4)
+ #define DDRDATA4CH1_CR_RXPERBITRANK3_Lane1_MSK (0x000000F0)
+ #define DDRDATA4CH1_CR_RXPERBITRANK3_Lane1_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_RXPERBITRANK3_Lane2_OFF ( 8)
+ #define DDRDATA4CH1_CR_RXPERBITRANK3_Lane2_WID ( 4)
+ #define DDRDATA4CH1_CR_RXPERBITRANK3_Lane2_MSK (0x00000F00)
+ #define DDRDATA4CH1_CR_RXPERBITRANK3_Lane2_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_RXPERBITRANK3_Lane3_OFF (12)
+ #define DDRDATA4CH1_CR_RXPERBITRANK3_Lane3_WID ( 4)
+ #define DDRDATA4CH1_CR_RXPERBITRANK3_Lane3_MSK (0x0000F000)
+ #define DDRDATA4CH1_CR_RXPERBITRANK3_Lane3_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_RXPERBITRANK3_Lane4_OFF (16)
+ #define DDRDATA4CH1_CR_RXPERBITRANK3_Lane4_WID ( 4)
+ #define DDRDATA4CH1_CR_RXPERBITRANK3_Lane4_MSK (0x000F0000)
+ #define DDRDATA4CH1_CR_RXPERBITRANK3_Lane4_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_RXPERBITRANK3_Lane5_OFF (20)
+ #define DDRDATA4CH1_CR_RXPERBITRANK3_Lane5_WID ( 4)
+ #define DDRDATA4CH1_CR_RXPERBITRANK3_Lane5_MSK (0x00F00000)
+ #define DDRDATA4CH1_CR_RXPERBITRANK3_Lane5_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_RXPERBITRANK3_Lane6_OFF (24)
+ #define DDRDATA4CH1_CR_RXPERBITRANK3_Lane6_WID ( 4)
+ #define DDRDATA4CH1_CR_RXPERBITRANK3_Lane6_MSK (0x0F000000)
+ #define DDRDATA4CH1_CR_RXPERBITRANK3_Lane6_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_RXPERBITRANK3_Lane7_OFF (28)
+ #define DDRDATA4CH1_CR_RXPERBITRANK3_Lane7_WID ( 4)
+ #define DDRDATA4CH1_CR_RXPERBITRANK3_Lane7_MSK (0xF0000000)
+ #define DDRDATA4CH1_CR_RXPERBITRANK3_Lane7_MAX (0x0000000F)
+
+#define DDRDATA4CH1_CR_TXTRAINRANK0_REG (0x00000920)
+ #define DDRDATA4CH1_CR_TXTRAINRANK0_TxDqDelay_OFF ( 0)
+ #define DDRDATA4CH1_CR_TXTRAINRANK0_TxDqDelay_WID ( 9)
+ #define DDRDATA4CH1_CR_TXTRAINRANK0_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA4CH1_CR_TXTRAINRANK0_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA4CH1_CR_TXTRAINRANK0_TxDqsDelay_OFF ( 9)
+ #define DDRDATA4CH1_CR_TXTRAINRANK0_TxDqsDelay_WID ( 9)
+ #define DDRDATA4CH1_CR_TXTRAINRANK0_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA4CH1_CR_TXTRAINRANK0_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA4CH1_CR_TXTRAINRANK0_Spare0_OFF (18)
+ #define DDRDATA4CH1_CR_TXTRAINRANK0_Spare0_WID ( 2)
+ #define DDRDATA4CH1_CR_TXTRAINRANK0_Spare0_MSK (0x000C0000)
+ #define DDRDATA4CH1_CR_TXTRAINRANK0_Spare0_MAX (0x00000003)
+ #define DDRDATA4CH1_CR_TXTRAINRANK0_TxEqualization_OFF (20)
+ #define DDRDATA4CH1_CR_TXTRAINRANK0_TxEqualization_WID ( 6)
+ #define DDRDATA4CH1_CR_TXTRAINRANK0_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA4CH1_CR_TXTRAINRANK0_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA4CH1_CR_TXTRAINRANK0_Spare1_OFF (26)
+ #define DDRDATA4CH1_CR_TXTRAINRANK0_Spare1_WID ( 6)
+ #define DDRDATA4CH1_CR_TXTRAINRANK0_Spare1_MSK (0xFC000000)
+ #define DDRDATA4CH1_CR_TXTRAINRANK0_Spare1_MAX (0x0000003F)
+
+#define DDRDATA4CH1_CR_TXTRAINRANK1_REG (0x00000924)
+ #define DDRDATA4CH1_CR_TXTRAINRANK1_TxDqDelay_OFF ( 0)
+ #define DDRDATA4CH1_CR_TXTRAINRANK1_TxDqDelay_WID ( 9)
+ #define DDRDATA4CH1_CR_TXTRAINRANK1_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA4CH1_CR_TXTRAINRANK1_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA4CH1_CR_TXTRAINRANK1_TxDqsDelay_OFF ( 9)
+ #define DDRDATA4CH1_CR_TXTRAINRANK1_TxDqsDelay_WID ( 9)
+ #define DDRDATA4CH1_CR_TXTRAINRANK1_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA4CH1_CR_TXTRAINRANK1_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA4CH1_CR_TXTRAINRANK1_Spare0_OFF (18)
+ #define DDRDATA4CH1_CR_TXTRAINRANK1_Spare0_WID ( 2)
+ #define DDRDATA4CH1_CR_TXTRAINRANK1_Spare0_MSK (0x000C0000)
+ #define DDRDATA4CH1_CR_TXTRAINRANK1_Spare0_MAX (0x00000003)
+ #define DDRDATA4CH1_CR_TXTRAINRANK1_TxEqualization_OFF (20)
+ #define DDRDATA4CH1_CR_TXTRAINRANK1_TxEqualization_WID ( 6)
+ #define DDRDATA4CH1_CR_TXTRAINRANK1_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA4CH1_CR_TXTRAINRANK1_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA4CH1_CR_TXTRAINRANK1_Spare1_OFF (26)
+ #define DDRDATA4CH1_CR_TXTRAINRANK1_Spare1_WID ( 6)
+ #define DDRDATA4CH1_CR_TXTRAINRANK1_Spare1_MSK (0xFC000000)
+ #define DDRDATA4CH1_CR_TXTRAINRANK1_Spare1_MAX (0x0000003F)
+
+#define DDRDATA4CH1_CR_TXTRAINRANK2_REG (0x00000928)
+ #define DDRDATA4CH1_CR_TXTRAINRANK2_TxDqDelay_OFF ( 0)
+ #define DDRDATA4CH1_CR_TXTRAINRANK2_TxDqDelay_WID ( 9)
+ #define DDRDATA4CH1_CR_TXTRAINRANK2_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA4CH1_CR_TXTRAINRANK2_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA4CH1_CR_TXTRAINRANK2_TxDqsDelay_OFF ( 9)
+ #define DDRDATA4CH1_CR_TXTRAINRANK2_TxDqsDelay_WID ( 9)
+ #define DDRDATA4CH1_CR_TXTRAINRANK2_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA4CH1_CR_TXTRAINRANK2_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA4CH1_CR_TXTRAINRANK2_Spare0_OFF (18)
+ #define DDRDATA4CH1_CR_TXTRAINRANK2_Spare0_WID ( 2)
+ #define DDRDATA4CH1_CR_TXTRAINRANK2_Spare0_MSK (0x000C0000)
+ #define DDRDATA4CH1_CR_TXTRAINRANK2_Spare0_MAX (0x00000003)
+ #define DDRDATA4CH1_CR_TXTRAINRANK2_TxEqualization_OFF (20)
+ #define DDRDATA4CH1_CR_TXTRAINRANK2_TxEqualization_WID ( 6)
+ #define DDRDATA4CH1_CR_TXTRAINRANK2_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA4CH1_CR_TXTRAINRANK2_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA4CH1_CR_TXTRAINRANK2_Spare1_OFF (26)
+ #define DDRDATA4CH1_CR_TXTRAINRANK2_Spare1_WID ( 6)
+ #define DDRDATA4CH1_CR_TXTRAINRANK2_Spare1_MSK (0xFC000000)
+ #define DDRDATA4CH1_CR_TXTRAINRANK2_Spare1_MAX (0x0000003F)
+
+#define DDRDATA4CH1_CR_TXTRAINRANK3_REG (0x0000092C)
+ #define DDRDATA4CH1_CR_TXTRAINRANK3_TxDqDelay_OFF ( 0)
+ #define DDRDATA4CH1_CR_TXTRAINRANK3_TxDqDelay_WID ( 9)
+ #define DDRDATA4CH1_CR_TXTRAINRANK3_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA4CH1_CR_TXTRAINRANK3_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA4CH1_CR_TXTRAINRANK3_TxDqsDelay_OFF ( 9)
+ #define DDRDATA4CH1_CR_TXTRAINRANK3_TxDqsDelay_WID ( 9)
+ #define DDRDATA4CH1_CR_TXTRAINRANK3_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA4CH1_CR_TXTRAINRANK3_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA4CH1_CR_TXTRAINRANK3_Spare0_OFF (18)
+ #define DDRDATA4CH1_CR_TXTRAINRANK3_Spare0_WID ( 2)
+ #define DDRDATA4CH1_CR_TXTRAINRANK3_Spare0_MSK (0x000C0000)
+ #define DDRDATA4CH1_CR_TXTRAINRANK3_Spare0_MAX (0x00000003)
+ #define DDRDATA4CH1_CR_TXTRAINRANK3_TxEqualization_OFF (20)
+ #define DDRDATA4CH1_CR_TXTRAINRANK3_TxEqualization_WID ( 6)
+ #define DDRDATA4CH1_CR_TXTRAINRANK3_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA4CH1_CR_TXTRAINRANK3_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA4CH1_CR_TXTRAINRANK3_Spare1_OFF (26)
+ #define DDRDATA4CH1_CR_TXTRAINRANK3_Spare1_WID ( 6)
+ #define DDRDATA4CH1_CR_TXTRAINRANK3_Spare1_MSK (0xFC000000)
+ #define DDRDATA4CH1_CR_TXTRAINRANK3_Spare1_MAX (0x0000003F)
+
+#define DDRDATA4CH1_CR_TXPERBITRANK0_REG (0x00000930)
+ #define DDRDATA4CH1_CR_TXPERBITRANK0_Lane0_OFF ( 0)
+ #define DDRDATA4CH1_CR_TXPERBITRANK0_Lane0_WID ( 4)
+ #define DDRDATA4CH1_CR_TXPERBITRANK0_Lane0_MSK (0x0000000F)
+ #define DDRDATA4CH1_CR_TXPERBITRANK0_Lane0_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_TXPERBITRANK0_Lane1_OFF ( 4)
+ #define DDRDATA4CH1_CR_TXPERBITRANK0_Lane1_WID ( 4)
+ #define DDRDATA4CH1_CR_TXPERBITRANK0_Lane1_MSK (0x000000F0)
+ #define DDRDATA4CH1_CR_TXPERBITRANK0_Lane1_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_TXPERBITRANK0_Lane2_OFF ( 8)
+ #define DDRDATA4CH1_CR_TXPERBITRANK0_Lane2_WID ( 4)
+ #define DDRDATA4CH1_CR_TXPERBITRANK0_Lane2_MSK (0x00000F00)
+ #define DDRDATA4CH1_CR_TXPERBITRANK0_Lane2_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_TXPERBITRANK0_Lane3_OFF (12)
+ #define DDRDATA4CH1_CR_TXPERBITRANK0_Lane3_WID ( 4)
+ #define DDRDATA4CH1_CR_TXPERBITRANK0_Lane3_MSK (0x0000F000)
+ #define DDRDATA4CH1_CR_TXPERBITRANK0_Lane3_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_TXPERBITRANK0_Lane4_OFF (16)
+ #define DDRDATA4CH1_CR_TXPERBITRANK0_Lane4_WID ( 4)
+ #define DDRDATA4CH1_CR_TXPERBITRANK0_Lane4_MSK (0x000F0000)
+ #define DDRDATA4CH1_CR_TXPERBITRANK0_Lane4_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_TXPERBITRANK0_Lane5_OFF (20)
+ #define DDRDATA4CH1_CR_TXPERBITRANK0_Lane5_WID ( 4)
+ #define DDRDATA4CH1_CR_TXPERBITRANK0_Lane5_MSK (0x00F00000)
+ #define DDRDATA4CH1_CR_TXPERBITRANK0_Lane5_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_TXPERBITRANK0_Lane6_OFF (24)
+ #define DDRDATA4CH1_CR_TXPERBITRANK0_Lane6_WID ( 4)
+ #define DDRDATA4CH1_CR_TXPERBITRANK0_Lane6_MSK (0x0F000000)
+ #define DDRDATA4CH1_CR_TXPERBITRANK0_Lane6_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_TXPERBITRANK0_Lane7_OFF (28)
+ #define DDRDATA4CH1_CR_TXPERBITRANK0_Lane7_WID ( 4)
+ #define DDRDATA4CH1_CR_TXPERBITRANK0_Lane7_MSK (0xF0000000)
+ #define DDRDATA4CH1_CR_TXPERBITRANK0_Lane7_MAX (0x0000000F)
+
+#define DDRDATA4CH1_CR_TXPERBITRANK1_REG (0x00000934)
+ #define DDRDATA4CH1_CR_TXPERBITRANK1_Lane0_OFF ( 0)
+ #define DDRDATA4CH1_CR_TXPERBITRANK1_Lane0_WID ( 4)
+ #define DDRDATA4CH1_CR_TXPERBITRANK1_Lane0_MSK (0x0000000F)
+ #define DDRDATA4CH1_CR_TXPERBITRANK1_Lane0_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_TXPERBITRANK1_Lane1_OFF ( 4)
+ #define DDRDATA4CH1_CR_TXPERBITRANK1_Lane1_WID ( 4)
+ #define DDRDATA4CH1_CR_TXPERBITRANK1_Lane1_MSK (0x000000F0)
+ #define DDRDATA4CH1_CR_TXPERBITRANK1_Lane1_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_TXPERBITRANK1_Lane2_OFF ( 8)
+ #define DDRDATA4CH1_CR_TXPERBITRANK1_Lane2_WID ( 4)
+ #define DDRDATA4CH1_CR_TXPERBITRANK1_Lane2_MSK (0x00000F00)
+ #define DDRDATA4CH1_CR_TXPERBITRANK1_Lane2_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_TXPERBITRANK1_Lane3_OFF (12)
+ #define DDRDATA4CH1_CR_TXPERBITRANK1_Lane3_WID ( 4)
+ #define DDRDATA4CH1_CR_TXPERBITRANK1_Lane3_MSK (0x0000F000)
+ #define DDRDATA4CH1_CR_TXPERBITRANK1_Lane3_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_TXPERBITRANK1_Lane4_OFF (16)
+ #define DDRDATA4CH1_CR_TXPERBITRANK1_Lane4_WID ( 4)
+ #define DDRDATA4CH1_CR_TXPERBITRANK1_Lane4_MSK (0x000F0000)
+ #define DDRDATA4CH1_CR_TXPERBITRANK1_Lane4_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_TXPERBITRANK1_Lane5_OFF (20)
+ #define DDRDATA4CH1_CR_TXPERBITRANK1_Lane5_WID ( 4)
+ #define DDRDATA4CH1_CR_TXPERBITRANK1_Lane5_MSK (0x00F00000)
+ #define DDRDATA4CH1_CR_TXPERBITRANK1_Lane5_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_TXPERBITRANK1_Lane6_OFF (24)
+ #define DDRDATA4CH1_CR_TXPERBITRANK1_Lane6_WID ( 4)
+ #define DDRDATA4CH1_CR_TXPERBITRANK1_Lane6_MSK (0x0F000000)
+ #define DDRDATA4CH1_CR_TXPERBITRANK1_Lane6_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_TXPERBITRANK1_Lane7_OFF (28)
+ #define DDRDATA4CH1_CR_TXPERBITRANK1_Lane7_WID ( 4)
+ #define DDRDATA4CH1_CR_TXPERBITRANK1_Lane7_MSK (0xF0000000)
+ #define DDRDATA4CH1_CR_TXPERBITRANK1_Lane7_MAX (0x0000000F)
+
+#define DDRDATA4CH1_CR_TXPERBITRANK2_REG (0x00000938)
+ #define DDRDATA4CH1_CR_TXPERBITRANK2_Lane0_OFF ( 0)
+ #define DDRDATA4CH1_CR_TXPERBITRANK2_Lane0_WID ( 4)
+ #define DDRDATA4CH1_CR_TXPERBITRANK2_Lane0_MSK (0x0000000F)
+ #define DDRDATA4CH1_CR_TXPERBITRANK2_Lane0_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_TXPERBITRANK2_Lane1_OFF ( 4)
+ #define DDRDATA4CH1_CR_TXPERBITRANK2_Lane1_WID ( 4)
+ #define DDRDATA4CH1_CR_TXPERBITRANK2_Lane1_MSK (0x000000F0)
+ #define DDRDATA4CH1_CR_TXPERBITRANK2_Lane1_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_TXPERBITRANK2_Lane2_OFF ( 8)
+ #define DDRDATA4CH1_CR_TXPERBITRANK2_Lane2_WID ( 4)
+ #define DDRDATA4CH1_CR_TXPERBITRANK2_Lane2_MSK (0x00000F00)
+ #define DDRDATA4CH1_CR_TXPERBITRANK2_Lane2_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_TXPERBITRANK2_Lane3_OFF (12)
+ #define DDRDATA4CH1_CR_TXPERBITRANK2_Lane3_WID ( 4)
+ #define DDRDATA4CH1_CR_TXPERBITRANK2_Lane3_MSK (0x0000F000)
+ #define DDRDATA4CH1_CR_TXPERBITRANK2_Lane3_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_TXPERBITRANK2_Lane4_OFF (16)
+ #define DDRDATA4CH1_CR_TXPERBITRANK2_Lane4_WID ( 4)
+ #define DDRDATA4CH1_CR_TXPERBITRANK2_Lane4_MSK (0x000F0000)
+ #define DDRDATA4CH1_CR_TXPERBITRANK2_Lane4_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_TXPERBITRANK2_Lane5_OFF (20)
+ #define DDRDATA4CH1_CR_TXPERBITRANK2_Lane5_WID ( 4)
+ #define DDRDATA4CH1_CR_TXPERBITRANK2_Lane5_MSK (0x00F00000)
+ #define DDRDATA4CH1_CR_TXPERBITRANK2_Lane5_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_TXPERBITRANK2_Lane6_OFF (24)
+ #define DDRDATA4CH1_CR_TXPERBITRANK2_Lane6_WID ( 4)
+ #define DDRDATA4CH1_CR_TXPERBITRANK2_Lane6_MSK (0x0F000000)
+ #define DDRDATA4CH1_CR_TXPERBITRANK2_Lane6_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_TXPERBITRANK2_Lane7_OFF (28)
+ #define DDRDATA4CH1_CR_TXPERBITRANK2_Lane7_WID ( 4)
+ #define DDRDATA4CH1_CR_TXPERBITRANK2_Lane7_MSK (0xF0000000)
+ #define DDRDATA4CH1_CR_TXPERBITRANK2_Lane7_MAX (0x0000000F)
+
+#define DDRDATA4CH1_CR_TXPERBITRANK3_REG (0x0000093C)
+ #define DDRDATA4CH1_CR_TXPERBITRANK3_Lane0_OFF ( 0)
+ #define DDRDATA4CH1_CR_TXPERBITRANK3_Lane0_WID ( 4)
+ #define DDRDATA4CH1_CR_TXPERBITRANK3_Lane0_MSK (0x0000000F)
+ #define DDRDATA4CH1_CR_TXPERBITRANK3_Lane0_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_TXPERBITRANK3_Lane1_OFF ( 4)
+ #define DDRDATA4CH1_CR_TXPERBITRANK3_Lane1_WID ( 4)
+ #define DDRDATA4CH1_CR_TXPERBITRANK3_Lane1_MSK (0x000000F0)
+ #define DDRDATA4CH1_CR_TXPERBITRANK3_Lane1_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_TXPERBITRANK3_Lane2_OFF ( 8)
+ #define DDRDATA4CH1_CR_TXPERBITRANK3_Lane2_WID ( 4)
+ #define DDRDATA4CH1_CR_TXPERBITRANK3_Lane2_MSK (0x00000F00)
+ #define DDRDATA4CH1_CR_TXPERBITRANK3_Lane2_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_TXPERBITRANK3_Lane3_OFF (12)
+ #define DDRDATA4CH1_CR_TXPERBITRANK3_Lane3_WID ( 4)
+ #define DDRDATA4CH1_CR_TXPERBITRANK3_Lane3_MSK (0x0000F000)
+ #define DDRDATA4CH1_CR_TXPERBITRANK3_Lane3_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_TXPERBITRANK3_Lane4_OFF (16)
+ #define DDRDATA4CH1_CR_TXPERBITRANK3_Lane4_WID ( 4)
+ #define DDRDATA4CH1_CR_TXPERBITRANK3_Lane4_MSK (0x000F0000)
+ #define DDRDATA4CH1_CR_TXPERBITRANK3_Lane4_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_TXPERBITRANK3_Lane5_OFF (20)
+ #define DDRDATA4CH1_CR_TXPERBITRANK3_Lane5_WID ( 4)
+ #define DDRDATA4CH1_CR_TXPERBITRANK3_Lane5_MSK (0x00F00000)
+ #define DDRDATA4CH1_CR_TXPERBITRANK3_Lane5_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_TXPERBITRANK3_Lane6_OFF (24)
+ #define DDRDATA4CH1_CR_TXPERBITRANK3_Lane6_WID ( 4)
+ #define DDRDATA4CH1_CR_TXPERBITRANK3_Lane6_MSK (0x0F000000)
+ #define DDRDATA4CH1_CR_TXPERBITRANK3_Lane6_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_TXPERBITRANK3_Lane7_OFF (28)
+ #define DDRDATA4CH1_CR_TXPERBITRANK3_Lane7_WID ( 4)
+ #define DDRDATA4CH1_CR_TXPERBITRANK3_Lane7_MSK (0xF0000000)
+ #define DDRDATA4CH1_CR_TXPERBITRANK3_Lane7_MAX (0x0000000F)
+
+#define DDRDATA4CH1_CR_RCOMPDATA0_REG (0x00000940)
+ #define DDRDATA4CH1_CR_RCOMPDATA0_RcompDrvUp_OFF ( 0)
+ #define DDRDATA4CH1_CR_RCOMPDATA0_RcompDrvUp_WID ( 6)
+ #define DDRDATA4CH1_CR_RCOMPDATA0_RcompDrvUp_MSK (0x0000003F)
+ #define DDRDATA4CH1_CR_RCOMPDATA0_RcompDrvUp_MAX (0x0000003F)
+ #define DDRDATA4CH1_CR_RCOMPDATA0_Spare0_OFF ( 6)
+ #define DDRDATA4CH1_CR_RCOMPDATA0_Spare0_WID ( 3)
+ #define DDRDATA4CH1_CR_RCOMPDATA0_Spare0_MSK (0x000001C0)
+ #define DDRDATA4CH1_CR_RCOMPDATA0_Spare0_MAX (0x00000007)
+ #define DDRDATA4CH1_CR_RCOMPDATA0_RcompDrvDown_OFF ( 9)
+ #define DDRDATA4CH1_CR_RCOMPDATA0_RcompDrvDown_WID ( 6)
+ #define DDRDATA4CH1_CR_RCOMPDATA0_RcompDrvDown_MSK (0x00007E00)
+ #define DDRDATA4CH1_CR_RCOMPDATA0_RcompDrvDown_MAX (0x0000003F)
+ #define DDRDATA4CH1_CR_RCOMPDATA0_VTComp_OFF (15)
+ #define DDRDATA4CH1_CR_RCOMPDATA0_VTComp_WID ( 5)
+ #define DDRDATA4CH1_CR_RCOMPDATA0_VTComp_MSK (0x000F8000)
+ #define DDRDATA4CH1_CR_RCOMPDATA0_VTComp_MAX (0x0000001F)
+ #define DDRDATA4CH1_CR_RCOMPDATA0_TcoComp_OFF (20)
+ #define DDRDATA4CH1_CR_RCOMPDATA0_TcoComp_WID ( 6)
+ #define DDRDATA4CH1_CR_RCOMPDATA0_TcoComp_MSK (0x03F00000)
+ #define DDRDATA4CH1_CR_RCOMPDATA0_TcoComp_MAX (0x0000003F)
+ #define DDRDATA4CH1_CR_RCOMPDATA0_SlewRateComp_OFF (26)
+ #define DDRDATA4CH1_CR_RCOMPDATA0_SlewRateComp_WID ( 5)
+ #define DDRDATA4CH1_CR_RCOMPDATA0_SlewRateComp_MSK (0x7C000000)
+ #define DDRDATA4CH1_CR_RCOMPDATA0_SlewRateComp_MAX (0x0000001F)
+ #define DDRDATA4CH1_CR_RCOMPDATA0_Spare2_OFF (31)
+ #define DDRDATA4CH1_CR_RCOMPDATA0_Spare2_WID ( 1)
+ #define DDRDATA4CH1_CR_RCOMPDATA0_Spare2_MSK (0x80000000)
+ #define DDRDATA4CH1_CR_RCOMPDATA0_Spare2_MAX (0x00000001)
+
+#define DDRDATA4CH1_CR_RCOMPDATA1_REG (0x00000944)
+ #define DDRDATA4CH1_CR_RCOMPDATA1_RcompOdtUp_OFF ( 0)
+ #define DDRDATA4CH1_CR_RCOMPDATA1_RcompOdtUp_WID ( 6)
+ #define DDRDATA4CH1_CR_RCOMPDATA1_RcompOdtUp_MSK (0x0000003F)
+ #define DDRDATA4CH1_CR_RCOMPDATA1_RcompOdtUp_MAX (0x0000003F)
+ #define DDRDATA4CH1_CR_RCOMPDATA1_Spare0_OFF ( 6)
+ #define DDRDATA4CH1_CR_RCOMPDATA1_Spare0_WID ( 3)
+ #define DDRDATA4CH1_CR_RCOMPDATA1_Spare0_MSK (0x000001C0)
+ #define DDRDATA4CH1_CR_RCOMPDATA1_Spare0_MAX (0x00000007)
+ #define DDRDATA4CH1_CR_RCOMPDATA1_RcompOdtDown_OFF ( 9)
+ #define DDRDATA4CH1_CR_RCOMPDATA1_RcompOdtDown_WID ( 6)
+ #define DDRDATA4CH1_CR_RCOMPDATA1_RcompOdtDown_MSK (0x00007E00)
+ #define DDRDATA4CH1_CR_RCOMPDATA1_RcompOdtDown_MAX (0x0000003F)
+ #define DDRDATA4CH1_CR_RCOMPDATA1_Spare1_OFF (15)
+ #define DDRDATA4CH1_CR_RCOMPDATA1_Spare1_WID ( 1)
+ #define DDRDATA4CH1_CR_RCOMPDATA1_Spare1_MSK (0x00008000)
+ #define DDRDATA4CH1_CR_RCOMPDATA1_Spare1_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_RCOMPDATA1_PanicDrvDn_OFF (16)
+ #define DDRDATA4CH1_CR_RCOMPDATA1_PanicDrvDn_WID ( 6)
+ #define DDRDATA4CH1_CR_RCOMPDATA1_PanicDrvDn_MSK (0x003F0000)
+ #define DDRDATA4CH1_CR_RCOMPDATA1_PanicDrvDn_MAX (0x0000003F)
+ #define DDRDATA4CH1_CR_RCOMPDATA1_PanicDrvUp_OFF (22)
+ #define DDRDATA4CH1_CR_RCOMPDATA1_PanicDrvUp_WID ( 6)
+ #define DDRDATA4CH1_CR_RCOMPDATA1_PanicDrvUp_MSK (0x0FC00000)
+ #define DDRDATA4CH1_CR_RCOMPDATA1_PanicDrvUp_MAX (0x0000003F)
+ #define DDRDATA4CH1_CR_RCOMPDATA1_LevelShifterComp_OFF (28)
+ #define DDRDATA4CH1_CR_RCOMPDATA1_LevelShifterComp_WID ( 3)
+ #define DDRDATA4CH1_CR_RCOMPDATA1_LevelShifterComp_MSK (0x70000000)
+ #define DDRDATA4CH1_CR_RCOMPDATA1_LevelShifterComp_MAX (0x00000007)
+ #define DDRDATA4CH1_CR_RCOMPDATA1_Spare2_OFF (31)
+ #define DDRDATA4CH1_CR_RCOMPDATA1_Spare2_WID ( 1)
+ #define DDRDATA4CH1_CR_RCOMPDATA1_Spare2_MSK (0x80000000)
+ #define DDRDATA4CH1_CR_RCOMPDATA1_Spare2_MAX (0x00000001)
+
+#define DDRDATA4CH1_CR_TXXTALK_REG (0x00000948)
+ #define DDRDATA4CH1_CR_TXXTALK_Lane0_OFF ( 0)
+ #define DDRDATA4CH1_CR_TXXTALK_Lane0_WID ( 4)
+ #define DDRDATA4CH1_CR_TXXTALK_Lane0_MSK (0x0000000F)
+ #define DDRDATA4CH1_CR_TXXTALK_Lane0_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_TXXTALK_Lane1_OFF ( 4)
+ #define DDRDATA4CH1_CR_TXXTALK_Lane1_WID ( 4)
+ #define DDRDATA4CH1_CR_TXXTALK_Lane1_MSK (0x000000F0)
+ #define DDRDATA4CH1_CR_TXXTALK_Lane1_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_TXXTALK_Lane2_OFF ( 8)
+ #define DDRDATA4CH1_CR_TXXTALK_Lane2_WID ( 4)
+ #define DDRDATA4CH1_CR_TXXTALK_Lane2_MSK (0x00000F00)
+ #define DDRDATA4CH1_CR_TXXTALK_Lane2_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_TXXTALK_Lane3_OFF (12)
+ #define DDRDATA4CH1_CR_TXXTALK_Lane3_WID ( 4)
+ #define DDRDATA4CH1_CR_TXXTALK_Lane3_MSK (0x0000F000)
+ #define DDRDATA4CH1_CR_TXXTALK_Lane3_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_TXXTALK_Lane4_OFF (16)
+ #define DDRDATA4CH1_CR_TXXTALK_Lane4_WID ( 4)
+ #define DDRDATA4CH1_CR_TXXTALK_Lane4_MSK (0x000F0000)
+ #define DDRDATA4CH1_CR_TXXTALK_Lane4_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_TXXTALK_Lane5_OFF (20)
+ #define DDRDATA4CH1_CR_TXXTALK_Lane5_WID ( 4)
+ #define DDRDATA4CH1_CR_TXXTALK_Lane5_MSK (0x00F00000)
+ #define DDRDATA4CH1_CR_TXXTALK_Lane5_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_TXXTALK_Lane6_OFF (24)
+ #define DDRDATA4CH1_CR_TXXTALK_Lane6_WID ( 4)
+ #define DDRDATA4CH1_CR_TXXTALK_Lane6_MSK (0x0F000000)
+ #define DDRDATA4CH1_CR_TXXTALK_Lane6_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_TXXTALK_Lane7_OFF (28)
+ #define DDRDATA4CH1_CR_TXXTALK_Lane7_WID ( 4)
+ #define DDRDATA4CH1_CR_TXXTALK_Lane7_MSK (0xF0000000)
+ #define DDRDATA4CH1_CR_TXXTALK_Lane7_MAX (0x0000000F)
+
+#define DDRDATA4CH1_CR_RXOFFSETVDQ_REG (0x0000094C)
+ #define DDRDATA4CH1_CR_RXOFFSETVDQ_Lane0_OFF ( 0)
+ #define DDRDATA4CH1_CR_RXOFFSETVDQ_Lane0_WID ( 4)
+ #define DDRDATA4CH1_CR_RXOFFSETVDQ_Lane0_MSK (0x0000000F)
+ #define DDRDATA4CH1_CR_RXOFFSETVDQ_Lane0_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_RXOFFSETVDQ_Lane1_OFF ( 4)
+ #define DDRDATA4CH1_CR_RXOFFSETVDQ_Lane1_WID ( 4)
+ #define DDRDATA4CH1_CR_RXOFFSETVDQ_Lane1_MSK (0x000000F0)
+ #define DDRDATA4CH1_CR_RXOFFSETVDQ_Lane1_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_RXOFFSETVDQ_Lane2_OFF ( 8)
+ #define DDRDATA4CH1_CR_RXOFFSETVDQ_Lane2_WID ( 4)
+ #define DDRDATA4CH1_CR_RXOFFSETVDQ_Lane2_MSK (0x00000F00)
+ #define DDRDATA4CH1_CR_RXOFFSETVDQ_Lane2_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_RXOFFSETVDQ_Lane3_OFF (12)
+ #define DDRDATA4CH1_CR_RXOFFSETVDQ_Lane3_WID ( 4)
+ #define DDRDATA4CH1_CR_RXOFFSETVDQ_Lane3_MSK (0x0000F000)
+ #define DDRDATA4CH1_CR_RXOFFSETVDQ_Lane3_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_RXOFFSETVDQ_Lane4_OFF (16)
+ #define DDRDATA4CH1_CR_RXOFFSETVDQ_Lane4_WID ( 4)
+ #define DDRDATA4CH1_CR_RXOFFSETVDQ_Lane4_MSK (0x000F0000)
+ #define DDRDATA4CH1_CR_RXOFFSETVDQ_Lane4_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_RXOFFSETVDQ_Lane5_OFF (20)
+ #define DDRDATA4CH1_CR_RXOFFSETVDQ_Lane5_WID ( 4)
+ #define DDRDATA4CH1_CR_RXOFFSETVDQ_Lane5_MSK (0x00F00000)
+ #define DDRDATA4CH1_CR_RXOFFSETVDQ_Lane5_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_RXOFFSETVDQ_Lane6_OFF (24)
+ #define DDRDATA4CH1_CR_RXOFFSETVDQ_Lane6_WID ( 4)
+ #define DDRDATA4CH1_CR_RXOFFSETVDQ_Lane6_MSK (0x0F000000)
+ #define DDRDATA4CH1_CR_RXOFFSETVDQ_Lane6_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_RXOFFSETVDQ_Lane7_OFF (28)
+ #define DDRDATA4CH1_CR_RXOFFSETVDQ_Lane7_WID ( 4)
+ #define DDRDATA4CH1_CR_RXOFFSETVDQ_Lane7_MSK (0xF0000000)
+ #define DDRDATA4CH1_CR_RXOFFSETVDQ_Lane7_MAX (0x0000000F)
+
+#define DDRDATA4CH1_CR_DDRDATARESERVED_REG (0x00000950)
+ #define DDRDATA4CH1_CR_DDRDATARESERVED_Spare_OFF ( 0)
+ #define DDRDATA4CH1_CR_DDRDATARESERVED_Spare_WID (32)
+ #define DDRDATA4CH1_CR_DDRDATARESERVED_Spare_MSK (0xFFFFFFFF)
+ #define DDRDATA4CH1_CR_DDRDATARESERVED_Spare_MAX (0xFFFFFFFF)
+
+#define DDRDATA4CH1_CR_DATATRAINFEEDBACK_REG (0x00000954)
+ #define DDRDATA4CH1_CR_DATATRAINFEEDBACK_DataTrainFeedback_OFF ( 0)
+ #define DDRDATA4CH1_CR_DATATRAINFEEDBACK_DataTrainFeedback_WID ( 9)
+ #define DDRDATA4CH1_CR_DATATRAINFEEDBACK_DataTrainFeedback_MSK (0x000001FF)
+ #define DDRDATA4CH1_CR_DATATRAINFEEDBACK_DataTrainFeedback_MAX (0x000001FF)
+ #define DDRDATA4CH1_CR_DATATRAINFEEDBACK_Spare_OFF ( 9)
+ #define DDRDATA4CH1_CR_DATATRAINFEEDBACK_Spare_WID (23)
+ #define DDRDATA4CH1_CR_DATATRAINFEEDBACK_Spare_MSK (0xFFFFFE00)
+ #define DDRDATA4CH1_CR_DATATRAINFEEDBACK_Spare_MAX (0x007FFFFF)
+
+#define DDRDATA4CH1_CR_DLLPITESTANDADC_REG (0x00000958)
+ #define DDRDATA4CH1_CR_DLLPITESTANDADC_RunTest_OFF ( 0)
+ #define DDRDATA4CH1_CR_DLLPITESTANDADC_RunTest_WID ( 1)
+ #define DDRDATA4CH1_CR_DLLPITESTANDADC_RunTest_MSK (0x00000001)
+ #define DDRDATA4CH1_CR_DLLPITESTANDADC_RunTest_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DLLPITESTANDADC_RunTest_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DLLPITESTANDADC_Load_OFF ( 1)
+ #define DDRDATA4CH1_CR_DLLPITESTANDADC_Load_WID ( 1)
+ #define DDRDATA4CH1_CR_DLLPITESTANDADC_Load_MSK (0x00000002)
+ #define DDRDATA4CH1_CR_DLLPITESTANDADC_Load_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DLLPITESTANDADC_Load_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DLLPITESTANDADC_ModeHVM_OFF ( 2)
+ #define DDRDATA4CH1_CR_DLLPITESTANDADC_ModeHVM_WID ( 1)
+ #define DDRDATA4CH1_CR_DLLPITESTANDADC_ModeHVM_MSK (0x00000004)
+ #define DDRDATA4CH1_CR_DLLPITESTANDADC_ModeHVM_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DLLPITESTANDADC_ModeHVM_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DLLPITESTANDADC_ModeDV_OFF ( 3)
+ #define DDRDATA4CH1_CR_DLLPITESTANDADC_ModeDV_WID ( 1)
+ #define DDRDATA4CH1_CR_DLLPITESTANDADC_ModeDV_MSK (0x00000008)
+ #define DDRDATA4CH1_CR_DLLPITESTANDADC_ModeDV_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DLLPITESTANDADC_ModeDV_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DLLPITESTANDADC_ModeADC_OFF ( 4)
+ #define DDRDATA4CH1_CR_DLLPITESTANDADC_ModeADC_WID ( 1)
+ #define DDRDATA4CH1_CR_DLLPITESTANDADC_ModeADC_MSK (0x00000010)
+ #define DDRDATA4CH1_CR_DLLPITESTANDADC_ModeADC_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DLLPITESTANDADC_ModeADC_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DLLPITESTANDADC_LoadCount_OFF ( 5)
+ #define DDRDATA4CH1_CR_DLLPITESTANDADC_LoadCount_WID (10)
+ #define DDRDATA4CH1_CR_DLLPITESTANDADC_LoadCount_MSK (0x00007FE0)
+ #define DDRDATA4CH1_CR_DLLPITESTANDADC_LoadCount_MAX (0x000003FF)
+ #define DDRDATA4CH1_CR_DLLPITESTANDADC_CountStatus_OFF (15)
+ #define DDRDATA4CH1_CR_DLLPITESTANDADC_CountStatus_WID (10)
+ #define DDRDATA4CH1_CR_DLLPITESTANDADC_CountStatus_MSK (0x01FF8000)
+ #define DDRDATA4CH1_CR_DLLPITESTANDADC_CountStatus_MAX (0x000003FF)
+ #define DDRDATA4CH1_CR_DLLPITESTANDADC_CountStatus_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DLLPITESTANDADC_Spare_OFF (25)
+ #define DDRDATA4CH1_CR_DLLPITESTANDADC_Spare_WID ( 7)
+ #define DDRDATA4CH1_CR_DLLPITESTANDADC_Spare_MSK (0xFE000000)
+ #define DDRDATA4CH1_CR_DLLPITESTANDADC_Spare_MAX (0x0000007F)
+
+#define DDRDATA4CH1_CR_DDRCRDATAOFFSETCOMP_REG (0x0000095C)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_OFF ( 0)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_WID ( 6)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_MSK (0x0000003F)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_MAX (0x0000003F)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_OFF ( 6)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_WID ( 6)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_MSK (0x00000FC0)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_MAX (0x0000003F)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_OFF (12)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_WID ( 5)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_MSK (0x0001F000)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_MAX (0x0000001F)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_OFF (17)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_WID ( 5)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_MSK (0x003E0000)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_MAX (0x0000001F)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_OFF (22)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_WID ( 5)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_MSK (0x07C00000)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_MAX (0x0000001F)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_OFF (27)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_WID ( 5)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_MSK (0xF8000000)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_MAX (0x0000001F)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_DEF (0x00000000)
+
+#define DDRDATA4CH1_CR_DDRCRDATACONTROL1_REG (0x00000960)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_RefPi_OFF ( 0)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_RefPi_WID ( 4)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_RefPi_MSK (0x0000000F)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_RefPi_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_RefPi_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_DllMask_OFF ( 4)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_DllMask_WID ( 2)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_DllMask_MSK (0x00000030)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_DllMask_MAX (0x00000003)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_DllMask_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_DllWeakLock_OFF ( 6)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_DllWeakLock_WID ( 1)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_DllWeakLock_MSK (0x00000040)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_DllWeakLock_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_DllWeakLock_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_OFF ( 7)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_WID ( 3)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_MSK (0x00000380)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_MAX (0x00000007)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_OFF (10)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_WID ( 3)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_MSK (0x00001C00)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_MAX (0x00000007)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_OdtDelay_OFF (13)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_OdtDelay_WID ( 4)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_OdtDelay_MSK (0x0001E000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_OdtDelay_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_OdtDelay_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_OdtDuration_OFF (17)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_OdtDuration_WID ( 3)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_OdtDuration_MSK (0x000E0000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_OdtDuration_MAX (0x00000007)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_OdtDuration_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_OFF (20)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_WID ( 4)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_MSK (0x00F00000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_OFF (24)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_WID ( 3)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_MSK (0x07000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_MAX (0x00000007)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_OFF (27)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_WID ( 3)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_MSK (0x38000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_MAX (0x00000007)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_OFF (30)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_WID ( 1)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_MSK (0x40000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_Rsvd1_OFF (31)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_Rsvd1_WID ( 1)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_Rsvd1_MSK (0x80000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_Rsvd1_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL1_Rsvd1_DEF (0x00000000)
+
+#define DDRDATA4CH1_CR_DDRCRDATACONTROL2_REG (0x00000964)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_OFF ( 0)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_WID ( 5)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_MSK (0x0000001F)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_MAX (0x0000001F)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_OFF ( 5)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_WID ( 1)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_MSK (0x00000020)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL2_ForceRxOn_OFF ( 6)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL2_ForceRxOn_WID ( 1)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL2_ForceRxOn_MSK (0x00000040)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL2_ForceRxOn_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL2_ForceRxOn_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL2_LeakerComp_OFF ( 7)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL2_LeakerComp_WID ( 2)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL2_LeakerComp_MSK (0x00000180)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL2_LeakerComp_MAX (0x00000003)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL2_LeakerComp_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_OFF ( 9)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_WID ( 4)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_MSK (0x00001E00)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_MAX (0x0000000F)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_DEF (0x00000008)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_OFF (13)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_WID ( 5)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_MSK (0x0003E000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_MAX (0x0000001F)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_DEF (0x00000011)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_OFF (18)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_WID ( 1)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_MSK (0x00040000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL2_Spare_OFF (19)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL2_Spare_WID (13)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL2_Spare_MSK (0xFFF80000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL2_Spare_MAX (0x00001FFF)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL2_Spare_DEF (0x00000000)
+
+#define DDRDATA4CH1_CR_DDRCRVSSHIORVREFCONTROL_REG (0x0000096C)
+ #define DDRDATA4CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_OFF ( 0)
+ #define DDRDATA4CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_WID (24)
+ #define DDRDATA4CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_MSK (0x00FFFFFF)
+ #define DDRDATA4CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_MAX (0x00FFFFFF)
+ #define DDRDATA4CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_OFF (24)
+ #define DDRDATA4CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_WID ( 8)
+ #define DDRDATA4CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_MSK (0xFF000000)
+ #define DDRDATA4CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_MAX (0x000000FF)
+ #define DDRDATA4CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_DEF (0x00000000)
+
+#define DDRDATA4CH1_CR_DDRCRDATAOFFSETTRAIN_REG (0x00000970)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_OFF ( 0)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_WID ( 6)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_MSK (0x0000003F)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_MAX (0x0000003F)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_OFF ( 6)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_WID ( 6)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_MSK (0x00000FC0)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_MAX (0x0000003F)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_OFF (12)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_WID ( 6)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_MSK (0x0003F000)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_MAX (0x0000003F)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_OFF (18)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_WID ( 6)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_MSK (0x00FC0000)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_MAX (0x0000003F)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_OFF (24)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_WID ( 7)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_MSK (0x7F000000)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_MAX (0x0000007F)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_OFF (31)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_WID ( 1)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_MSK (0x80000000)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_DEF (0x00000000)
+
+#define DDRDATA4CH1_CR_DDRCRDATACONTROL0_REG (0x00000974)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_OFF ( 0)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_WID ( 1)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_MSK (0x00000001)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_OFF ( 1)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_WID ( 1)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_MSK (0x00000002)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_OFF ( 2)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_WID ( 1)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_MSK (0x00000004)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_OFF ( 3)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_WID ( 1)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_MSK (0x00000008)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_TxOn_OFF ( 4)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_TxOn_WID ( 1)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_TxOn_MSK (0x00000010)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_TxOn_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_TxOn_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_RfOn_OFF ( 5)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_RfOn_WID ( 1)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_RfOn_MSK (0x00000020)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_RfOn_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_RfOn_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_RxPiOn_OFF ( 6)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_RxPiOn_WID ( 1)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_RxPiOn_MSK (0x00000040)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_RxPiOn_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_RxPiOn_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_TxPiOn_OFF ( 7)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_TxPiOn_WID ( 1)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_TxPiOn_MSK (0x00000080)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_TxPiOn_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_TxPiOn_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_OFF ( 8)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_WID ( 1)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_MSK (0x00000100)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_OFF ( 9)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_WID ( 1)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_MSK (0x00000200)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_TxDisable_OFF (10)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_TxDisable_WID ( 1)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_TxDisable_MSK (0x00000400)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_TxDisable_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_TxDisable_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_RxDisable_OFF (11)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_RxDisable_WID ( 1)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_RxDisable_MSK (0x00000800)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_RxDisable_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_RxDisable_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_TxLong_OFF (12)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_TxLong_WID ( 1)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_TxLong_MSK (0x00001000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_TxLong_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_TxLong_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_OFF (13)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_WID ( 2)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_MSK (0x00006000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_MAX (0x00000003)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_RxReadPointer_OFF (15)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_RxReadPointer_WID ( 3)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_RxReadPointer_MSK (0x00038000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_RxReadPointer_MAX (0x00000007)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_RxReadPointer_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_OFF (18)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_WID ( 1)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_MSK (0x00040000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_OFF (19)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_WID ( 1)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_MSK (0x00080000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_ReadRFRd_OFF (20)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_ReadRFRd_WID ( 1)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_ReadRFRd_MSK (0x00100000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_ReadRFRd_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_ReadRFRd_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_ReadRFWr_OFF (21)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_ReadRFWr_WID ( 1)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_ReadRFWr_MSK (0x00200000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_ReadRFWr_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_ReadRFWr_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_ReadRFRank_OFF (22)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_ReadRFRank_WID ( 2)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_ReadRFRank_MSK (0x00C00000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_ReadRFRank_MAX (0x00000003)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_ReadRFRank_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_OFF (24)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_WID ( 1)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_MSK (0x01000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_OdtSampOff_OFF (25)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_OdtSampOff_WID ( 1)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_OdtSampOff_MSK (0x02000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_OdtSampOff_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_OdtSampOff_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_OFF (26)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_WID ( 1)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_MSK (0x04000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_OFF (27)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_WID ( 1)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_MSK (0x08000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_OFF (28)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_WID ( 1)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_MSK (0x10000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_OFF (29)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_WID ( 1)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_MSK (0x20000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_OFF (30)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_WID ( 1)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_MSK (0x40000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_OFF (31)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_WID ( 1)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_MSK (0x80000000)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_DEF (0x00000000)
+
+#define DDRDATA4CH1_CR_DDRCRVREFADJUST1_REG (0x00000978)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_OFF ( 0)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_WID ( 7)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_MSK (0x0000007F)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_MAX (0x0000007F)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_OFF ( 7)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_WID ( 7)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_MSK (0x00003F80)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_MAX (0x0000007F)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_OFF (14)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_WID ( 7)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_MSK (0x001FC000)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_MAX (0x0000007F)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_OFF (21)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_WID ( 1)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_MSK (0x00200000)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_OFF (22)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_WID ( 1)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_MSK (0x00400000)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_OFF (23)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_WID ( 1)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_MSK (0x00800000)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_OFF (24)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_WID ( 2)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_MSK (0x03000000)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_MAX (0x00000003)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_OFF (26)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_WID ( 1)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_MSK (0x04000000)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_Rsvd_OFF (27)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_Rsvd_WID ( 2)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_Rsvd_MSK (0x18000000)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_Rsvd_MAX (0x00000003)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_Rsvd_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_caSlowBW_OFF (29)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_caSlowBW_WID ( 1)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_caSlowBW_MSK (0x20000000)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_caSlowBW_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_caSlowBW_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_OFF (30)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_WID ( 1)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_MSK (0x40000000)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_DEF (0x00000000)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_OFF (31)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_WID ( 1)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_MSK (0x80000000)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_MAX (0x00000001)
+ #define DDRDATA4CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_DEF (0x00000000)
+
+#define DDRDATA5CH0_CR_RXTRAINRANK0_REG (0x00000A00)
+ #define DDRDATA5CH0_CR_RXTRAINRANK0_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA5CH0_CR_RXTRAINRANK0_RxRcvEnPi_WID ( 9)
+ #define DDRDATA5CH0_CR_RXTRAINRANK0_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA5CH0_CR_RXTRAINRANK0_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA5CH0_CR_RXTRAINRANK0_RxDqsPPi_OFF ( 9)
+ #define DDRDATA5CH0_CR_RXTRAINRANK0_RxDqsPPi_WID ( 6)
+ #define DDRDATA5CH0_CR_RXTRAINRANK0_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA5CH0_CR_RXTRAINRANK0_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA5CH0_CR_RXTRAINRANK0_RxEq_OFF (15)
+ #define DDRDATA5CH0_CR_RXTRAINRANK0_RxEq_WID ( 5)
+ #define DDRDATA5CH0_CR_RXTRAINRANK0_RxEq_MSK (0x000F8000)
+ #define DDRDATA5CH0_CR_RXTRAINRANK0_RxEq_MAX (0x0000001F)
+ #define DDRDATA5CH0_CR_RXTRAINRANK0_RxDqsNPi_OFF (20)
+ #define DDRDATA5CH0_CR_RXTRAINRANK0_RxDqsNPi_WID ( 6)
+ #define DDRDATA5CH0_CR_RXTRAINRANK0_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA5CH0_CR_RXTRAINRANK0_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA5CH0_CR_RXTRAINRANK0_RxVref_OFF (26)
+ #define DDRDATA5CH0_CR_RXTRAINRANK0_RxVref_WID ( 6)
+ #define DDRDATA5CH0_CR_RXTRAINRANK0_RxVref_MSK (0xFC000000)
+ #define DDRDATA5CH0_CR_RXTRAINRANK0_RxVref_MAX (0x0000003F)
+
+#define DDRDATA5CH0_CR_RXTRAINRANK1_REG (0x00000A04)
+ #define DDRDATA5CH0_CR_RXTRAINRANK1_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA5CH0_CR_RXTRAINRANK1_RxRcvEnPi_WID ( 9)
+ #define DDRDATA5CH0_CR_RXTRAINRANK1_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA5CH0_CR_RXTRAINRANK1_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA5CH0_CR_RXTRAINRANK1_RxDqsPPi_OFF ( 9)
+ #define DDRDATA5CH0_CR_RXTRAINRANK1_RxDqsPPi_WID ( 6)
+ #define DDRDATA5CH0_CR_RXTRAINRANK1_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA5CH0_CR_RXTRAINRANK1_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA5CH0_CR_RXTRAINRANK1_RxEq_OFF (15)
+ #define DDRDATA5CH0_CR_RXTRAINRANK1_RxEq_WID ( 5)
+ #define DDRDATA5CH0_CR_RXTRAINRANK1_RxEq_MSK (0x000F8000)
+ #define DDRDATA5CH0_CR_RXTRAINRANK1_RxEq_MAX (0x0000001F)
+ #define DDRDATA5CH0_CR_RXTRAINRANK1_RxDqsNPi_OFF (20)
+ #define DDRDATA5CH0_CR_RXTRAINRANK1_RxDqsNPi_WID ( 6)
+ #define DDRDATA5CH0_CR_RXTRAINRANK1_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA5CH0_CR_RXTRAINRANK1_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA5CH0_CR_RXTRAINRANK1_RxVref_OFF (26)
+ #define DDRDATA5CH0_CR_RXTRAINRANK1_RxVref_WID ( 6)
+ #define DDRDATA5CH0_CR_RXTRAINRANK1_RxVref_MSK (0xFC000000)
+ #define DDRDATA5CH0_CR_RXTRAINRANK1_RxVref_MAX (0x0000003F)
+
+#define DDRDATA5CH0_CR_RXTRAINRANK2_REG (0x00000A08)
+ #define DDRDATA5CH0_CR_RXTRAINRANK2_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA5CH0_CR_RXTRAINRANK2_RxRcvEnPi_WID ( 9)
+ #define DDRDATA5CH0_CR_RXTRAINRANK2_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA5CH0_CR_RXTRAINRANK2_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA5CH0_CR_RXTRAINRANK2_RxDqsPPi_OFF ( 9)
+ #define DDRDATA5CH0_CR_RXTRAINRANK2_RxDqsPPi_WID ( 6)
+ #define DDRDATA5CH0_CR_RXTRAINRANK2_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA5CH0_CR_RXTRAINRANK2_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA5CH0_CR_RXTRAINRANK2_RxEq_OFF (15)
+ #define DDRDATA5CH0_CR_RXTRAINRANK2_RxEq_WID ( 5)
+ #define DDRDATA5CH0_CR_RXTRAINRANK2_RxEq_MSK (0x000F8000)
+ #define DDRDATA5CH0_CR_RXTRAINRANK2_RxEq_MAX (0x0000001F)
+ #define DDRDATA5CH0_CR_RXTRAINRANK2_RxDqsNPi_OFF (20)
+ #define DDRDATA5CH0_CR_RXTRAINRANK2_RxDqsNPi_WID ( 6)
+ #define DDRDATA5CH0_CR_RXTRAINRANK2_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA5CH0_CR_RXTRAINRANK2_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA5CH0_CR_RXTRAINRANK2_RxVref_OFF (26)
+ #define DDRDATA5CH0_CR_RXTRAINRANK2_RxVref_WID ( 6)
+ #define DDRDATA5CH0_CR_RXTRAINRANK2_RxVref_MSK (0xFC000000)
+ #define DDRDATA5CH0_CR_RXTRAINRANK2_RxVref_MAX (0x0000003F)
+
+#define DDRDATA5CH0_CR_RXTRAINRANK3_REG (0x00000A0C)
+ #define DDRDATA5CH0_CR_RXTRAINRANK3_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA5CH0_CR_RXTRAINRANK3_RxRcvEnPi_WID ( 9)
+ #define DDRDATA5CH0_CR_RXTRAINRANK3_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA5CH0_CR_RXTRAINRANK3_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA5CH0_CR_RXTRAINRANK3_RxDqsPPi_OFF ( 9)
+ #define DDRDATA5CH0_CR_RXTRAINRANK3_RxDqsPPi_WID ( 6)
+ #define DDRDATA5CH0_CR_RXTRAINRANK3_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA5CH0_CR_RXTRAINRANK3_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA5CH0_CR_RXTRAINRANK3_RxEq_OFF (15)
+ #define DDRDATA5CH0_CR_RXTRAINRANK3_RxEq_WID ( 5)
+ #define DDRDATA5CH0_CR_RXTRAINRANK3_RxEq_MSK (0x000F8000)
+ #define DDRDATA5CH0_CR_RXTRAINRANK3_RxEq_MAX (0x0000001F)
+ #define DDRDATA5CH0_CR_RXTRAINRANK3_RxDqsNPi_OFF (20)
+ #define DDRDATA5CH0_CR_RXTRAINRANK3_RxDqsNPi_WID ( 6)
+ #define DDRDATA5CH0_CR_RXTRAINRANK3_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA5CH0_CR_RXTRAINRANK3_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA5CH0_CR_RXTRAINRANK3_RxVref_OFF (26)
+ #define DDRDATA5CH0_CR_RXTRAINRANK3_RxVref_WID ( 6)
+ #define DDRDATA5CH0_CR_RXTRAINRANK3_RxVref_MSK (0xFC000000)
+ #define DDRDATA5CH0_CR_RXTRAINRANK3_RxVref_MAX (0x0000003F)
+
+#define DDRDATA5CH0_CR_RXPERBITRANK0_REG (0x00000A10)
+ #define DDRDATA5CH0_CR_RXPERBITRANK0_Lane0_OFF ( 0)
+ #define DDRDATA5CH0_CR_RXPERBITRANK0_Lane0_WID ( 4)
+ #define DDRDATA5CH0_CR_RXPERBITRANK0_Lane0_MSK (0x0000000F)
+ #define DDRDATA5CH0_CR_RXPERBITRANK0_Lane0_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_RXPERBITRANK0_Lane1_OFF ( 4)
+ #define DDRDATA5CH0_CR_RXPERBITRANK0_Lane1_WID ( 4)
+ #define DDRDATA5CH0_CR_RXPERBITRANK0_Lane1_MSK (0x000000F0)
+ #define DDRDATA5CH0_CR_RXPERBITRANK0_Lane1_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_RXPERBITRANK0_Lane2_OFF ( 8)
+ #define DDRDATA5CH0_CR_RXPERBITRANK0_Lane2_WID ( 4)
+ #define DDRDATA5CH0_CR_RXPERBITRANK0_Lane2_MSK (0x00000F00)
+ #define DDRDATA5CH0_CR_RXPERBITRANK0_Lane2_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_RXPERBITRANK0_Lane3_OFF (12)
+ #define DDRDATA5CH0_CR_RXPERBITRANK0_Lane3_WID ( 4)
+ #define DDRDATA5CH0_CR_RXPERBITRANK0_Lane3_MSK (0x0000F000)
+ #define DDRDATA5CH0_CR_RXPERBITRANK0_Lane3_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_RXPERBITRANK0_Lane4_OFF (16)
+ #define DDRDATA5CH0_CR_RXPERBITRANK0_Lane4_WID ( 4)
+ #define DDRDATA5CH0_CR_RXPERBITRANK0_Lane4_MSK (0x000F0000)
+ #define DDRDATA5CH0_CR_RXPERBITRANK0_Lane4_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_RXPERBITRANK0_Lane5_OFF (20)
+ #define DDRDATA5CH0_CR_RXPERBITRANK0_Lane5_WID ( 4)
+ #define DDRDATA5CH0_CR_RXPERBITRANK0_Lane5_MSK (0x00F00000)
+ #define DDRDATA5CH0_CR_RXPERBITRANK0_Lane5_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_RXPERBITRANK0_Lane6_OFF (24)
+ #define DDRDATA5CH0_CR_RXPERBITRANK0_Lane6_WID ( 4)
+ #define DDRDATA5CH0_CR_RXPERBITRANK0_Lane6_MSK (0x0F000000)
+ #define DDRDATA5CH0_CR_RXPERBITRANK0_Lane6_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_RXPERBITRANK0_Lane7_OFF (28)
+ #define DDRDATA5CH0_CR_RXPERBITRANK0_Lane7_WID ( 4)
+ #define DDRDATA5CH0_CR_RXPERBITRANK0_Lane7_MSK (0xF0000000)
+ #define DDRDATA5CH0_CR_RXPERBITRANK0_Lane7_MAX (0x0000000F)
+
+#define DDRDATA5CH0_CR_RXPERBITRANK1_REG (0x00000A14)
+ #define DDRDATA5CH0_CR_RXPERBITRANK1_Lane0_OFF ( 0)
+ #define DDRDATA5CH0_CR_RXPERBITRANK1_Lane0_WID ( 4)
+ #define DDRDATA5CH0_CR_RXPERBITRANK1_Lane0_MSK (0x0000000F)
+ #define DDRDATA5CH0_CR_RXPERBITRANK1_Lane0_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_RXPERBITRANK1_Lane1_OFF ( 4)
+ #define DDRDATA5CH0_CR_RXPERBITRANK1_Lane1_WID ( 4)
+ #define DDRDATA5CH0_CR_RXPERBITRANK1_Lane1_MSK (0x000000F0)
+ #define DDRDATA5CH0_CR_RXPERBITRANK1_Lane1_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_RXPERBITRANK1_Lane2_OFF ( 8)
+ #define DDRDATA5CH0_CR_RXPERBITRANK1_Lane2_WID ( 4)
+ #define DDRDATA5CH0_CR_RXPERBITRANK1_Lane2_MSK (0x00000F00)
+ #define DDRDATA5CH0_CR_RXPERBITRANK1_Lane2_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_RXPERBITRANK1_Lane3_OFF (12)
+ #define DDRDATA5CH0_CR_RXPERBITRANK1_Lane3_WID ( 4)
+ #define DDRDATA5CH0_CR_RXPERBITRANK1_Lane3_MSK (0x0000F000)
+ #define DDRDATA5CH0_CR_RXPERBITRANK1_Lane3_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_RXPERBITRANK1_Lane4_OFF (16)
+ #define DDRDATA5CH0_CR_RXPERBITRANK1_Lane4_WID ( 4)
+ #define DDRDATA5CH0_CR_RXPERBITRANK1_Lane4_MSK (0x000F0000)
+ #define DDRDATA5CH0_CR_RXPERBITRANK1_Lane4_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_RXPERBITRANK1_Lane5_OFF (20)
+ #define DDRDATA5CH0_CR_RXPERBITRANK1_Lane5_WID ( 4)
+ #define DDRDATA5CH0_CR_RXPERBITRANK1_Lane5_MSK (0x00F00000)
+ #define DDRDATA5CH0_CR_RXPERBITRANK1_Lane5_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_RXPERBITRANK1_Lane6_OFF (24)
+ #define DDRDATA5CH0_CR_RXPERBITRANK1_Lane6_WID ( 4)
+ #define DDRDATA5CH0_CR_RXPERBITRANK1_Lane6_MSK (0x0F000000)
+ #define DDRDATA5CH0_CR_RXPERBITRANK1_Lane6_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_RXPERBITRANK1_Lane7_OFF (28)
+ #define DDRDATA5CH0_CR_RXPERBITRANK1_Lane7_WID ( 4)
+ #define DDRDATA5CH0_CR_RXPERBITRANK1_Lane7_MSK (0xF0000000)
+ #define DDRDATA5CH0_CR_RXPERBITRANK1_Lane7_MAX (0x0000000F)
+
+#define DDRDATA5CH0_CR_RXPERBITRANK2_REG (0x00000A18)
+ #define DDRDATA5CH0_CR_RXPERBITRANK2_Lane0_OFF ( 0)
+ #define DDRDATA5CH0_CR_RXPERBITRANK2_Lane0_WID ( 4)
+ #define DDRDATA5CH0_CR_RXPERBITRANK2_Lane0_MSK (0x0000000F)
+ #define DDRDATA5CH0_CR_RXPERBITRANK2_Lane0_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_RXPERBITRANK2_Lane1_OFF ( 4)
+ #define DDRDATA5CH0_CR_RXPERBITRANK2_Lane1_WID ( 4)
+ #define DDRDATA5CH0_CR_RXPERBITRANK2_Lane1_MSK (0x000000F0)
+ #define DDRDATA5CH0_CR_RXPERBITRANK2_Lane1_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_RXPERBITRANK2_Lane2_OFF ( 8)
+ #define DDRDATA5CH0_CR_RXPERBITRANK2_Lane2_WID ( 4)
+ #define DDRDATA5CH0_CR_RXPERBITRANK2_Lane2_MSK (0x00000F00)
+ #define DDRDATA5CH0_CR_RXPERBITRANK2_Lane2_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_RXPERBITRANK2_Lane3_OFF (12)
+ #define DDRDATA5CH0_CR_RXPERBITRANK2_Lane3_WID ( 4)
+ #define DDRDATA5CH0_CR_RXPERBITRANK2_Lane3_MSK (0x0000F000)
+ #define DDRDATA5CH0_CR_RXPERBITRANK2_Lane3_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_RXPERBITRANK2_Lane4_OFF (16)
+ #define DDRDATA5CH0_CR_RXPERBITRANK2_Lane4_WID ( 4)
+ #define DDRDATA5CH0_CR_RXPERBITRANK2_Lane4_MSK (0x000F0000)
+ #define DDRDATA5CH0_CR_RXPERBITRANK2_Lane4_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_RXPERBITRANK2_Lane5_OFF (20)
+ #define DDRDATA5CH0_CR_RXPERBITRANK2_Lane5_WID ( 4)
+ #define DDRDATA5CH0_CR_RXPERBITRANK2_Lane5_MSK (0x00F00000)
+ #define DDRDATA5CH0_CR_RXPERBITRANK2_Lane5_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_RXPERBITRANK2_Lane6_OFF (24)
+ #define DDRDATA5CH0_CR_RXPERBITRANK2_Lane6_WID ( 4)
+ #define DDRDATA5CH0_CR_RXPERBITRANK2_Lane6_MSK (0x0F000000)
+ #define DDRDATA5CH0_CR_RXPERBITRANK2_Lane6_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_RXPERBITRANK2_Lane7_OFF (28)
+ #define DDRDATA5CH0_CR_RXPERBITRANK2_Lane7_WID ( 4)
+ #define DDRDATA5CH0_CR_RXPERBITRANK2_Lane7_MSK (0xF0000000)
+ #define DDRDATA5CH0_CR_RXPERBITRANK2_Lane7_MAX (0x0000000F)
+
+#define DDRDATA5CH0_CR_RXPERBITRANK3_REG (0x00000A1C)
+ #define DDRDATA5CH0_CR_RXPERBITRANK3_Lane0_OFF ( 0)
+ #define DDRDATA5CH0_CR_RXPERBITRANK3_Lane0_WID ( 4)
+ #define DDRDATA5CH0_CR_RXPERBITRANK3_Lane0_MSK (0x0000000F)
+ #define DDRDATA5CH0_CR_RXPERBITRANK3_Lane0_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_RXPERBITRANK3_Lane1_OFF ( 4)
+ #define DDRDATA5CH0_CR_RXPERBITRANK3_Lane1_WID ( 4)
+ #define DDRDATA5CH0_CR_RXPERBITRANK3_Lane1_MSK (0x000000F0)
+ #define DDRDATA5CH0_CR_RXPERBITRANK3_Lane1_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_RXPERBITRANK3_Lane2_OFF ( 8)
+ #define DDRDATA5CH0_CR_RXPERBITRANK3_Lane2_WID ( 4)
+ #define DDRDATA5CH0_CR_RXPERBITRANK3_Lane2_MSK (0x00000F00)
+ #define DDRDATA5CH0_CR_RXPERBITRANK3_Lane2_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_RXPERBITRANK3_Lane3_OFF (12)
+ #define DDRDATA5CH0_CR_RXPERBITRANK3_Lane3_WID ( 4)
+ #define DDRDATA5CH0_CR_RXPERBITRANK3_Lane3_MSK (0x0000F000)
+ #define DDRDATA5CH0_CR_RXPERBITRANK3_Lane3_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_RXPERBITRANK3_Lane4_OFF (16)
+ #define DDRDATA5CH0_CR_RXPERBITRANK3_Lane4_WID ( 4)
+ #define DDRDATA5CH0_CR_RXPERBITRANK3_Lane4_MSK (0x000F0000)
+ #define DDRDATA5CH0_CR_RXPERBITRANK3_Lane4_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_RXPERBITRANK3_Lane5_OFF (20)
+ #define DDRDATA5CH0_CR_RXPERBITRANK3_Lane5_WID ( 4)
+ #define DDRDATA5CH0_CR_RXPERBITRANK3_Lane5_MSK (0x00F00000)
+ #define DDRDATA5CH0_CR_RXPERBITRANK3_Lane5_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_RXPERBITRANK3_Lane6_OFF (24)
+ #define DDRDATA5CH0_CR_RXPERBITRANK3_Lane6_WID ( 4)
+ #define DDRDATA5CH0_CR_RXPERBITRANK3_Lane6_MSK (0x0F000000)
+ #define DDRDATA5CH0_CR_RXPERBITRANK3_Lane6_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_RXPERBITRANK3_Lane7_OFF (28)
+ #define DDRDATA5CH0_CR_RXPERBITRANK3_Lane7_WID ( 4)
+ #define DDRDATA5CH0_CR_RXPERBITRANK3_Lane7_MSK (0xF0000000)
+ #define DDRDATA5CH0_CR_RXPERBITRANK3_Lane7_MAX (0x0000000F)
+
+#define DDRDATA5CH0_CR_TXTRAINRANK0_REG (0x00000A20)
+ #define DDRDATA5CH0_CR_TXTRAINRANK0_TxDqDelay_OFF ( 0)
+ #define DDRDATA5CH0_CR_TXTRAINRANK0_TxDqDelay_WID ( 9)
+ #define DDRDATA5CH0_CR_TXTRAINRANK0_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA5CH0_CR_TXTRAINRANK0_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA5CH0_CR_TXTRAINRANK0_TxDqsDelay_OFF ( 9)
+ #define DDRDATA5CH0_CR_TXTRAINRANK0_TxDqsDelay_WID ( 9)
+ #define DDRDATA5CH0_CR_TXTRAINRANK0_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA5CH0_CR_TXTRAINRANK0_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA5CH0_CR_TXTRAINRANK0_Spare0_OFF (18)
+ #define DDRDATA5CH0_CR_TXTRAINRANK0_Spare0_WID ( 2)
+ #define DDRDATA5CH0_CR_TXTRAINRANK0_Spare0_MSK (0x000C0000)
+ #define DDRDATA5CH0_CR_TXTRAINRANK0_Spare0_MAX (0x00000003)
+ #define DDRDATA5CH0_CR_TXTRAINRANK0_TxEqualization_OFF (20)
+ #define DDRDATA5CH0_CR_TXTRAINRANK0_TxEqualization_WID ( 6)
+ #define DDRDATA5CH0_CR_TXTRAINRANK0_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA5CH0_CR_TXTRAINRANK0_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA5CH0_CR_TXTRAINRANK0_Spare1_OFF (26)
+ #define DDRDATA5CH0_CR_TXTRAINRANK0_Spare1_WID ( 6)
+ #define DDRDATA5CH0_CR_TXTRAINRANK0_Spare1_MSK (0xFC000000)
+ #define DDRDATA5CH0_CR_TXTRAINRANK0_Spare1_MAX (0x0000003F)
+
+#define DDRDATA5CH0_CR_TXTRAINRANK1_REG (0x00000A24)
+ #define DDRDATA5CH0_CR_TXTRAINRANK1_TxDqDelay_OFF ( 0)
+ #define DDRDATA5CH0_CR_TXTRAINRANK1_TxDqDelay_WID ( 9)
+ #define DDRDATA5CH0_CR_TXTRAINRANK1_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA5CH0_CR_TXTRAINRANK1_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA5CH0_CR_TXTRAINRANK1_TxDqsDelay_OFF ( 9)
+ #define DDRDATA5CH0_CR_TXTRAINRANK1_TxDqsDelay_WID ( 9)
+ #define DDRDATA5CH0_CR_TXTRAINRANK1_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA5CH0_CR_TXTRAINRANK1_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA5CH0_CR_TXTRAINRANK1_Spare0_OFF (18)
+ #define DDRDATA5CH0_CR_TXTRAINRANK1_Spare0_WID ( 2)
+ #define DDRDATA5CH0_CR_TXTRAINRANK1_Spare0_MSK (0x000C0000)
+ #define DDRDATA5CH0_CR_TXTRAINRANK1_Spare0_MAX (0x00000003)
+ #define DDRDATA5CH0_CR_TXTRAINRANK1_TxEqualization_OFF (20)
+ #define DDRDATA5CH0_CR_TXTRAINRANK1_TxEqualization_WID ( 6)
+ #define DDRDATA5CH0_CR_TXTRAINRANK1_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA5CH0_CR_TXTRAINRANK1_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA5CH0_CR_TXTRAINRANK1_Spare1_OFF (26)
+ #define DDRDATA5CH0_CR_TXTRAINRANK1_Spare1_WID ( 6)
+ #define DDRDATA5CH0_CR_TXTRAINRANK1_Spare1_MSK (0xFC000000)
+ #define DDRDATA5CH0_CR_TXTRAINRANK1_Spare1_MAX (0x0000003F)
+
+#define DDRDATA5CH0_CR_TXTRAINRANK2_REG (0x00000A28)
+ #define DDRDATA5CH0_CR_TXTRAINRANK2_TxDqDelay_OFF ( 0)
+ #define DDRDATA5CH0_CR_TXTRAINRANK2_TxDqDelay_WID ( 9)
+ #define DDRDATA5CH0_CR_TXTRAINRANK2_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA5CH0_CR_TXTRAINRANK2_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA5CH0_CR_TXTRAINRANK2_TxDqsDelay_OFF ( 9)
+ #define DDRDATA5CH0_CR_TXTRAINRANK2_TxDqsDelay_WID ( 9)
+ #define DDRDATA5CH0_CR_TXTRAINRANK2_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA5CH0_CR_TXTRAINRANK2_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA5CH0_CR_TXTRAINRANK2_Spare0_OFF (18)
+ #define DDRDATA5CH0_CR_TXTRAINRANK2_Spare0_WID ( 2)
+ #define DDRDATA5CH0_CR_TXTRAINRANK2_Spare0_MSK (0x000C0000)
+ #define DDRDATA5CH0_CR_TXTRAINRANK2_Spare0_MAX (0x00000003)
+ #define DDRDATA5CH0_CR_TXTRAINRANK2_TxEqualization_OFF (20)
+ #define DDRDATA5CH0_CR_TXTRAINRANK2_TxEqualization_WID ( 6)
+ #define DDRDATA5CH0_CR_TXTRAINRANK2_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA5CH0_CR_TXTRAINRANK2_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA5CH0_CR_TXTRAINRANK2_Spare1_OFF (26)
+ #define DDRDATA5CH0_CR_TXTRAINRANK2_Spare1_WID ( 6)
+ #define DDRDATA5CH0_CR_TXTRAINRANK2_Spare1_MSK (0xFC000000)
+ #define DDRDATA5CH0_CR_TXTRAINRANK2_Spare1_MAX (0x0000003F)
+
+#define DDRDATA5CH0_CR_TXTRAINRANK3_REG (0x00000A2C)
+ #define DDRDATA5CH0_CR_TXTRAINRANK3_TxDqDelay_OFF ( 0)
+ #define DDRDATA5CH0_CR_TXTRAINRANK3_TxDqDelay_WID ( 9)
+ #define DDRDATA5CH0_CR_TXTRAINRANK3_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA5CH0_CR_TXTRAINRANK3_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA5CH0_CR_TXTRAINRANK3_TxDqsDelay_OFF ( 9)
+ #define DDRDATA5CH0_CR_TXTRAINRANK3_TxDqsDelay_WID ( 9)
+ #define DDRDATA5CH0_CR_TXTRAINRANK3_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA5CH0_CR_TXTRAINRANK3_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA5CH0_CR_TXTRAINRANK3_Spare0_OFF (18)
+ #define DDRDATA5CH0_CR_TXTRAINRANK3_Spare0_WID ( 2)
+ #define DDRDATA5CH0_CR_TXTRAINRANK3_Spare0_MSK (0x000C0000)
+ #define DDRDATA5CH0_CR_TXTRAINRANK3_Spare0_MAX (0x00000003)
+ #define DDRDATA5CH0_CR_TXTRAINRANK3_TxEqualization_OFF (20)
+ #define DDRDATA5CH0_CR_TXTRAINRANK3_TxEqualization_WID ( 6)
+ #define DDRDATA5CH0_CR_TXTRAINRANK3_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA5CH0_CR_TXTRAINRANK3_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA5CH0_CR_TXTRAINRANK3_Spare1_OFF (26)
+ #define DDRDATA5CH0_CR_TXTRAINRANK3_Spare1_WID ( 6)
+ #define DDRDATA5CH0_CR_TXTRAINRANK3_Spare1_MSK (0xFC000000)
+ #define DDRDATA5CH0_CR_TXTRAINRANK3_Spare1_MAX (0x0000003F)
+
+#define DDRDATA5CH0_CR_TXPERBITRANK0_REG (0x00000A30)
+ #define DDRDATA5CH0_CR_TXPERBITRANK0_Lane0_OFF ( 0)
+ #define DDRDATA5CH0_CR_TXPERBITRANK0_Lane0_WID ( 4)
+ #define DDRDATA5CH0_CR_TXPERBITRANK0_Lane0_MSK (0x0000000F)
+ #define DDRDATA5CH0_CR_TXPERBITRANK0_Lane0_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_TXPERBITRANK0_Lane1_OFF ( 4)
+ #define DDRDATA5CH0_CR_TXPERBITRANK0_Lane1_WID ( 4)
+ #define DDRDATA5CH0_CR_TXPERBITRANK0_Lane1_MSK (0x000000F0)
+ #define DDRDATA5CH0_CR_TXPERBITRANK0_Lane1_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_TXPERBITRANK0_Lane2_OFF ( 8)
+ #define DDRDATA5CH0_CR_TXPERBITRANK0_Lane2_WID ( 4)
+ #define DDRDATA5CH0_CR_TXPERBITRANK0_Lane2_MSK (0x00000F00)
+ #define DDRDATA5CH0_CR_TXPERBITRANK0_Lane2_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_TXPERBITRANK0_Lane3_OFF (12)
+ #define DDRDATA5CH0_CR_TXPERBITRANK0_Lane3_WID ( 4)
+ #define DDRDATA5CH0_CR_TXPERBITRANK0_Lane3_MSK (0x0000F000)
+ #define DDRDATA5CH0_CR_TXPERBITRANK0_Lane3_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_TXPERBITRANK0_Lane4_OFF (16)
+ #define DDRDATA5CH0_CR_TXPERBITRANK0_Lane4_WID ( 4)
+ #define DDRDATA5CH0_CR_TXPERBITRANK0_Lane4_MSK (0x000F0000)
+ #define DDRDATA5CH0_CR_TXPERBITRANK0_Lane4_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_TXPERBITRANK0_Lane5_OFF (20)
+ #define DDRDATA5CH0_CR_TXPERBITRANK0_Lane5_WID ( 4)
+ #define DDRDATA5CH0_CR_TXPERBITRANK0_Lane5_MSK (0x00F00000)
+ #define DDRDATA5CH0_CR_TXPERBITRANK0_Lane5_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_TXPERBITRANK0_Lane6_OFF (24)
+ #define DDRDATA5CH0_CR_TXPERBITRANK0_Lane6_WID ( 4)
+ #define DDRDATA5CH0_CR_TXPERBITRANK0_Lane6_MSK (0x0F000000)
+ #define DDRDATA5CH0_CR_TXPERBITRANK0_Lane6_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_TXPERBITRANK0_Lane7_OFF (28)
+ #define DDRDATA5CH0_CR_TXPERBITRANK0_Lane7_WID ( 4)
+ #define DDRDATA5CH0_CR_TXPERBITRANK0_Lane7_MSK (0xF0000000)
+ #define DDRDATA5CH0_CR_TXPERBITRANK0_Lane7_MAX (0x0000000F)
+
+#define DDRDATA5CH0_CR_TXPERBITRANK1_REG (0x00000A34)
+ #define DDRDATA5CH0_CR_TXPERBITRANK1_Lane0_OFF ( 0)
+ #define DDRDATA5CH0_CR_TXPERBITRANK1_Lane0_WID ( 4)
+ #define DDRDATA5CH0_CR_TXPERBITRANK1_Lane0_MSK (0x0000000F)
+ #define DDRDATA5CH0_CR_TXPERBITRANK1_Lane0_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_TXPERBITRANK1_Lane1_OFF ( 4)
+ #define DDRDATA5CH0_CR_TXPERBITRANK1_Lane1_WID ( 4)
+ #define DDRDATA5CH0_CR_TXPERBITRANK1_Lane1_MSK (0x000000F0)
+ #define DDRDATA5CH0_CR_TXPERBITRANK1_Lane1_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_TXPERBITRANK1_Lane2_OFF ( 8)
+ #define DDRDATA5CH0_CR_TXPERBITRANK1_Lane2_WID ( 4)
+ #define DDRDATA5CH0_CR_TXPERBITRANK1_Lane2_MSK (0x00000F00)
+ #define DDRDATA5CH0_CR_TXPERBITRANK1_Lane2_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_TXPERBITRANK1_Lane3_OFF (12)
+ #define DDRDATA5CH0_CR_TXPERBITRANK1_Lane3_WID ( 4)
+ #define DDRDATA5CH0_CR_TXPERBITRANK1_Lane3_MSK (0x0000F000)
+ #define DDRDATA5CH0_CR_TXPERBITRANK1_Lane3_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_TXPERBITRANK1_Lane4_OFF (16)
+ #define DDRDATA5CH0_CR_TXPERBITRANK1_Lane4_WID ( 4)
+ #define DDRDATA5CH0_CR_TXPERBITRANK1_Lane4_MSK (0x000F0000)
+ #define DDRDATA5CH0_CR_TXPERBITRANK1_Lane4_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_TXPERBITRANK1_Lane5_OFF (20)
+ #define DDRDATA5CH0_CR_TXPERBITRANK1_Lane5_WID ( 4)
+ #define DDRDATA5CH0_CR_TXPERBITRANK1_Lane5_MSK (0x00F00000)
+ #define DDRDATA5CH0_CR_TXPERBITRANK1_Lane5_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_TXPERBITRANK1_Lane6_OFF (24)
+ #define DDRDATA5CH0_CR_TXPERBITRANK1_Lane6_WID ( 4)
+ #define DDRDATA5CH0_CR_TXPERBITRANK1_Lane6_MSK (0x0F000000)
+ #define DDRDATA5CH0_CR_TXPERBITRANK1_Lane6_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_TXPERBITRANK1_Lane7_OFF (28)
+ #define DDRDATA5CH0_CR_TXPERBITRANK1_Lane7_WID ( 4)
+ #define DDRDATA5CH0_CR_TXPERBITRANK1_Lane7_MSK (0xF0000000)
+ #define DDRDATA5CH0_CR_TXPERBITRANK1_Lane7_MAX (0x0000000F)
+
+#define DDRDATA5CH0_CR_TXPERBITRANK2_REG (0x00000A38)
+ #define DDRDATA5CH0_CR_TXPERBITRANK2_Lane0_OFF ( 0)
+ #define DDRDATA5CH0_CR_TXPERBITRANK2_Lane0_WID ( 4)
+ #define DDRDATA5CH0_CR_TXPERBITRANK2_Lane0_MSK (0x0000000F)
+ #define DDRDATA5CH0_CR_TXPERBITRANK2_Lane0_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_TXPERBITRANK2_Lane1_OFF ( 4)
+ #define DDRDATA5CH0_CR_TXPERBITRANK2_Lane1_WID ( 4)
+ #define DDRDATA5CH0_CR_TXPERBITRANK2_Lane1_MSK (0x000000F0)
+ #define DDRDATA5CH0_CR_TXPERBITRANK2_Lane1_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_TXPERBITRANK2_Lane2_OFF ( 8)
+ #define DDRDATA5CH0_CR_TXPERBITRANK2_Lane2_WID ( 4)
+ #define DDRDATA5CH0_CR_TXPERBITRANK2_Lane2_MSK (0x00000F00)
+ #define DDRDATA5CH0_CR_TXPERBITRANK2_Lane2_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_TXPERBITRANK2_Lane3_OFF (12)
+ #define DDRDATA5CH0_CR_TXPERBITRANK2_Lane3_WID ( 4)
+ #define DDRDATA5CH0_CR_TXPERBITRANK2_Lane3_MSK (0x0000F000)
+ #define DDRDATA5CH0_CR_TXPERBITRANK2_Lane3_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_TXPERBITRANK2_Lane4_OFF (16)
+ #define DDRDATA5CH0_CR_TXPERBITRANK2_Lane4_WID ( 4)
+ #define DDRDATA5CH0_CR_TXPERBITRANK2_Lane4_MSK (0x000F0000)
+ #define DDRDATA5CH0_CR_TXPERBITRANK2_Lane4_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_TXPERBITRANK2_Lane5_OFF (20)
+ #define DDRDATA5CH0_CR_TXPERBITRANK2_Lane5_WID ( 4)
+ #define DDRDATA5CH0_CR_TXPERBITRANK2_Lane5_MSK (0x00F00000)
+ #define DDRDATA5CH0_CR_TXPERBITRANK2_Lane5_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_TXPERBITRANK2_Lane6_OFF (24)
+ #define DDRDATA5CH0_CR_TXPERBITRANK2_Lane6_WID ( 4)
+ #define DDRDATA5CH0_CR_TXPERBITRANK2_Lane6_MSK (0x0F000000)
+ #define DDRDATA5CH0_CR_TXPERBITRANK2_Lane6_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_TXPERBITRANK2_Lane7_OFF (28)
+ #define DDRDATA5CH0_CR_TXPERBITRANK2_Lane7_WID ( 4)
+ #define DDRDATA5CH0_CR_TXPERBITRANK2_Lane7_MSK (0xF0000000)
+ #define DDRDATA5CH0_CR_TXPERBITRANK2_Lane7_MAX (0x0000000F)
+
+#define DDRDATA5CH0_CR_TXPERBITRANK3_REG (0x00000A3C)
+ #define DDRDATA5CH0_CR_TXPERBITRANK3_Lane0_OFF ( 0)
+ #define DDRDATA5CH0_CR_TXPERBITRANK3_Lane0_WID ( 4)
+ #define DDRDATA5CH0_CR_TXPERBITRANK3_Lane0_MSK (0x0000000F)
+ #define DDRDATA5CH0_CR_TXPERBITRANK3_Lane0_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_TXPERBITRANK3_Lane1_OFF ( 4)
+ #define DDRDATA5CH0_CR_TXPERBITRANK3_Lane1_WID ( 4)
+ #define DDRDATA5CH0_CR_TXPERBITRANK3_Lane1_MSK (0x000000F0)
+ #define DDRDATA5CH0_CR_TXPERBITRANK3_Lane1_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_TXPERBITRANK3_Lane2_OFF ( 8)
+ #define DDRDATA5CH0_CR_TXPERBITRANK3_Lane2_WID ( 4)
+ #define DDRDATA5CH0_CR_TXPERBITRANK3_Lane2_MSK (0x00000F00)
+ #define DDRDATA5CH0_CR_TXPERBITRANK3_Lane2_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_TXPERBITRANK3_Lane3_OFF (12)
+ #define DDRDATA5CH0_CR_TXPERBITRANK3_Lane3_WID ( 4)
+ #define DDRDATA5CH0_CR_TXPERBITRANK3_Lane3_MSK (0x0000F000)
+ #define DDRDATA5CH0_CR_TXPERBITRANK3_Lane3_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_TXPERBITRANK3_Lane4_OFF (16)
+ #define DDRDATA5CH0_CR_TXPERBITRANK3_Lane4_WID ( 4)
+ #define DDRDATA5CH0_CR_TXPERBITRANK3_Lane4_MSK (0x000F0000)
+ #define DDRDATA5CH0_CR_TXPERBITRANK3_Lane4_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_TXPERBITRANK3_Lane5_OFF (20)
+ #define DDRDATA5CH0_CR_TXPERBITRANK3_Lane5_WID ( 4)
+ #define DDRDATA5CH0_CR_TXPERBITRANK3_Lane5_MSK (0x00F00000)
+ #define DDRDATA5CH0_CR_TXPERBITRANK3_Lane5_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_TXPERBITRANK3_Lane6_OFF (24)
+ #define DDRDATA5CH0_CR_TXPERBITRANK3_Lane6_WID ( 4)
+ #define DDRDATA5CH0_CR_TXPERBITRANK3_Lane6_MSK (0x0F000000)
+ #define DDRDATA5CH0_CR_TXPERBITRANK3_Lane6_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_TXPERBITRANK3_Lane7_OFF (28)
+ #define DDRDATA5CH0_CR_TXPERBITRANK3_Lane7_WID ( 4)
+ #define DDRDATA5CH0_CR_TXPERBITRANK3_Lane7_MSK (0xF0000000)
+ #define DDRDATA5CH0_CR_TXPERBITRANK3_Lane7_MAX (0x0000000F)
+
+#define DDRDATA5CH0_CR_RCOMPDATA0_REG (0x00000A40)
+ #define DDRDATA5CH0_CR_RCOMPDATA0_RcompDrvUp_OFF ( 0)
+ #define DDRDATA5CH0_CR_RCOMPDATA0_RcompDrvUp_WID ( 6)
+ #define DDRDATA5CH0_CR_RCOMPDATA0_RcompDrvUp_MSK (0x0000003F)
+ #define DDRDATA5CH0_CR_RCOMPDATA0_RcompDrvUp_MAX (0x0000003F)
+ #define DDRDATA5CH0_CR_RCOMPDATA0_Spare0_OFF ( 6)
+ #define DDRDATA5CH0_CR_RCOMPDATA0_Spare0_WID ( 3)
+ #define DDRDATA5CH0_CR_RCOMPDATA0_Spare0_MSK (0x000001C0)
+ #define DDRDATA5CH0_CR_RCOMPDATA0_Spare0_MAX (0x00000007)
+ #define DDRDATA5CH0_CR_RCOMPDATA0_RcompDrvDown_OFF ( 9)
+ #define DDRDATA5CH0_CR_RCOMPDATA0_RcompDrvDown_WID ( 6)
+ #define DDRDATA5CH0_CR_RCOMPDATA0_RcompDrvDown_MSK (0x00007E00)
+ #define DDRDATA5CH0_CR_RCOMPDATA0_RcompDrvDown_MAX (0x0000003F)
+ #define DDRDATA5CH0_CR_RCOMPDATA0_VTComp_OFF (15)
+ #define DDRDATA5CH0_CR_RCOMPDATA0_VTComp_WID ( 5)
+ #define DDRDATA5CH0_CR_RCOMPDATA0_VTComp_MSK (0x000F8000)
+ #define DDRDATA5CH0_CR_RCOMPDATA0_VTComp_MAX (0x0000001F)
+ #define DDRDATA5CH0_CR_RCOMPDATA0_TcoComp_OFF (20)
+ #define DDRDATA5CH0_CR_RCOMPDATA0_TcoComp_WID ( 6)
+ #define DDRDATA5CH0_CR_RCOMPDATA0_TcoComp_MSK (0x03F00000)
+ #define DDRDATA5CH0_CR_RCOMPDATA0_TcoComp_MAX (0x0000003F)
+ #define DDRDATA5CH0_CR_RCOMPDATA0_SlewRateComp_OFF (26)
+ #define DDRDATA5CH0_CR_RCOMPDATA0_SlewRateComp_WID ( 5)
+ #define DDRDATA5CH0_CR_RCOMPDATA0_SlewRateComp_MSK (0x7C000000)
+ #define DDRDATA5CH0_CR_RCOMPDATA0_SlewRateComp_MAX (0x0000001F)
+ #define DDRDATA5CH0_CR_RCOMPDATA0_Spare2_OFF (31)
+ #define DDRDATA5CH0_CR_RCOMPDATA0_Spare2_WID ( 1)
+ #define DDRDATA5CH0_CR_RCOMPDATA0_Spare2_MSK (0x80000000)
+ #define DDRDATA5CH0_CR_RCOMPDATA0_Spare2_MAX (0x00000001)
+
+#define DDRDATA5CH0_CR_RCOMPDATA1_REG (0x00000A44)
+ #define DDRDATA5CH0_CR_RCOMPDATA1_RcompOdtUp_OFF ( 0)
+ #define DDRDATA5CH0_CR_RCOMPDATA1_RcompOdtUp_WID ( 6)
+ #define DDRDATA5CH0_CR_RCOMPDATA1_RcompOdtUp_MSK (0x0000003F)
+ #define DDRDATA5CH0_CR_RCOMPDATA1_RcompOdtUp_MAX (0x0000003F)
+ #define DDRDATA5CH0_CR_RCOMPDATA1_Spare0_OFF ( 6)
+ #define DDRDATA5CH0_CR_RCOMPDATA1_Spare0_WID ( 3)
+ #define DDRDATA5CH0_CR_RCOMPDATA1_Spare0_MSK (0x000001C0)
+ #define DDRDATA5CH0_CR_RCOMPDATA1_Spare0_MAX (0x00000007)
+ #define DDRDATA5CH0_CR_RCOMPDATA1_RcompOdtDown_OFF ( 9)
+ #define DDRDATA5CH0_CR_RCOMPDATA1_RcompOdtDown_WID ( 6)
+ #define DDRDATA5CH0_CR_RCOMPDATA1_RcompOdtDown_MSK (0x00007E00)
+ #define DDRDATA5CH0_CR_RCOMPDATA1_RcompOdtDown_MAX (0x0000003F)
+ #define DDRDATA5CH0_CR_RCOMPDATA1_Spare1_OFF (15)
+ #define DDRDATA5CH0_CR_RCOMPDATA1_Spare1_WID ( 1)
+ #define DDRDATA5CH0_CR_RCOMPDATA1_Spare1_MSK (0x00008000)
+ #define DDRDATA5CH0_CR_RCOMPDATA1_Spare1_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_RCOMPDATA1_PanicDrvDn_OFF (16)
+ #define DDRDATA5CH0_CR_RCOMPDATA1_PanicDrvDn_WID ( 6)
+ #define DDRDATA5CH0_CR_RCOMPDATA1_PanicDrvDn_MSK (0x003F0000)
+ #define DDRDATA5CH0_CR_RCOMPDATA1_PanicDrvDn_MAX (0x0000003F)
+ #define DDRDATA5CH0_CR_RCOMPDATA1_PanicDrvUp_OFF (22)
+ #define DDRDATA5CH0_CR_RCOMPDATA1_PanicDrvUp_WID ( 6)
+ #define DDRDATA5CH0_CR_RCOMPDATA1_PanicDrvUp_MSK (0x0FC00000)
+ #define DDRDATA5CH0_CR_RCOMPDATA1_PanicDrvUp_MAX (0x0000003F)
+ #define DDRDATA5CH0_CR_RCOMPDATA1_LevelShifterComp_OFF (28)
+ #define DDRDATA5CH0_CR_RCOMPDATA1_LevelShifterComp_WID ( 3)
+ #define DDRDATA5CH0_CR_RCOMPDATA1_LevelShifterComp_MSK (0x70000000)
+ #define DDRDATA5CH0_CR_RCOMPDATA1_LevelShifterComp_MAX (0x00000007)
+ #define DDRDATA5CH0_CR_RCOMPDATA1_Spare2_OFF (31)
+ #define DDRDATA5CH0_CR_RCOMPDATA1_Spare2_WID ( 1)
+ #define DDRDATA5CH0_CR_RCOMPDATA1_Spare2_MSK (0x80000000)
+ #define DDRDATA5CH0_CR_RCOMPDATA1_Spare2_MAX (0x00000001)
+
+#define DDRDATA5CH0_CR_TXXTALK_REG (0x00000A48)
+ #define DDRDATA5CH0_CR_TXXTALK_Lane0_OFF ( 0)
+ #define DDRDATA5CH0_CR_TXXTALK_Lane0_WID ( 4)
+ #define DDRDATA5CH0_CR_TXXTALK_Lane0_MSK (0x0000000F)
+ #define DDRDATA5CH0_CR_TXXTALK_Lane0_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_TXXTALK_Lane1_OFF ( 4)
+ #define DDRDATA5CH0_CR_TXXTALK_Lane1_WID ( 4)
+ #define DDRDATA5CH0_CR_TXXTALK_Lane1_MSK (0x000000F0)
+ #define DDRDATA5CH0_CR_TXXTALK_Lane1_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_TXXTALK_Lane2_OFF ( 8)
+ #define DDRDATA5CH0_CR_TXXTALK_Lane2_WID ( 4)
+ #define DDRDATA5CH0_CR_TXXTALK_Lane2_MSK (0x00000F00)
+ #define DDRDATA5CH0_CR_TXXTALK_Lane2_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_TXXTALK_Lane3_OFF (12)
+ #define DDRDATA5CH0_CR_TXXTALK_Lane3_WID ( 4)
+ #define DDRDATA5CH0_CR_TXXTALK_Lane3_MSK (0x0000F000)
+ #define DDRDATA5CH0_CR_TXXTALK_Lane3_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_TXXTALK_Lane4_OFF (16)
+ #define DDRDATA5CH0_CR_TXXTALK_Lane4_WID ( 4)
+ #define DDRDATA5CH0_CR_TXXTALK_Lane4_MSK (0x000F0000)
+ #define DDRDATA5CH0_CR_TXXTALK_Lane4_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_TXXTALK_Lane5_OFF (20)
+ #define DDRDATA5CH0_CR_TXXTALK_Lane5_WID ( 4)
+ #define DDRDATA5CH0_CR_TXXTALK_Lane5_MSK (0x00F00000)
+ #define DDRDATA5CH0_CR_TXXTALK_Lane5_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_TXXTALK_Lane6_OFF (24)
+ #define DDRDATA5CH0_CR_TXXTALK_Lane6_WID ( 4)
+ #define DDRDATA5CH0_CR_TXXTALK_Lane6_MSK (0x0F000000)
+ #define DDRDATA5CH0_CR_TXXTALK_Lane6_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_TXXTALK_Lane7_OFF (28)
+ #define DDRDATA5CH0_CR_TXXTALK_Lane7_WID ( 4)
+ #define DDRDATA5CH0_CR_TXXTALK_Lane7_MSK (0xF0000000)
+ #define DDRDATA5CH0_CR_TXXTALK_Lane7_MAX (0x0000000F)
+
+#define DDRDATA5CH0_CR_RXOFFSETVDQ_REG (0x00000A4C)
+ #define DDRDATA5CH0_CR_RXOFFSETVDQ_Lane0_OFF ( 0)
+ #define DDRDATA5CH0_CR_RXOFFSETVDQ_Lane0_WID ( 4)
+ #define DDRDATA5CH0_CR_RXOFFSETVDQ_Lane0_MSK (0x0000000F)
+ #define DDRDATA5CH0_CR_RXOFFSETVDQ_Lane0_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_RXOFFSETVDQ_Lane1_OFF ( 4)
+ #define DDRDATA5CH0_CR_RXOFFSETVDQ_Lane1_WID ( 4)
+ #define DDRDATA5CH0_CR_RXOFFSETVDQ_Lane1_MSK (0x000000F0)
+ #define DDRDATA5CH0_CR_RXOFFSETVDQ_Lane1_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_RXOFFSETVDQ_Lane2_OFF ( 8)
+ #define DDRDATA5CH0_CR_RXOFFSETVDQ_Lane2_WID ( 4)
+ #define DDRDATA5CH0_CR_RXOFFSETVDQ_Lane2_MSK (0x00000F00)
+ #define DDRDATA5CH0_CR_RXOFFSETVDQ_Lane2_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_RXOFFSETVDQ_Lane3_OFF (12)
+ #define DDRDATA5CH0_CR_RXOFFSETVDQ_Lane3_WID ( 4)
+ #define DDRDATA5CH0_CR_RXOFFSETVDQ_Lane3_MSK (0x0000F000)
+ #define DDRDATA5CH0_CR_RXOFFSETVDQ_Lane3_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_RXOFFSETVDQ_Lane4_OFF (16)
+ #define DDRDATA5CH0_CR_RXOFFSETVDQ_Lane4_WID ( 4)
+ #define DDRDATA5CH0_CR_RXOFFSETVDQ_Lane4_MSK (0x000F0000)
+ #define DDRDATA5CH0_CR_RXOFFSETVDQ_Lane4_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_RXOFFSETVDQ_Lane5_OFF (20)
+ #define DDRDATA5CH0_CR_RXOFFSETVDQ_Lane5_WID ( 4)
+ #define DDRDATA5CH0_CR_RXOFFSETVDQ_Lane5_MSK (0x00F00000)
+ #define DDRDATA5CH0_CR_RXOFFSETVDQ_Lane5_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_RXOFFSETVDQ_Lane6_OFF (24)
+ #define DDRDATA5CH0_CR_RXOFFSETVDQ_Lane6_WID ( 4)
+ #define DDRDATA5CH0_CR_RXOFFSETVDQ_Lane6_MSK (0x0F000000)
+ #define DDRDATA5CH0_CR_RXOFFSETVDQ_Lane6_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_RXOFFSETVDQ_Lane7_OFF (28)
+ #define DDRDATA5CH0_CR_RXOFFSETVDQ_Lane7_WID ( 4)
+ #define DDRDATA5CH0_CR_RXOFFSETVDQ_Lane7_MSK (0xF0000000)
+ #define DDRDATA5CH0_CR_RXOFFSETVDQ_Lane7_MAX (0x0000000F)
+
+#define DDRDATA5CH0_CR_DDRDATARESERVED_REG (0x00000A50)
+ #define DDRDATA5CH0_CR_DDRDATARESERVED_Spare_OFF ( 0)
+ #define DDRDATA5CH0_CR_DDRDATARESERVED_Spare_WID (32)
+ #define DDRDATA5CH0_CR_DDRDATARESERVED_Spare_MSK (0xFFFFFFFF)
+ #define DDRDATA5CH0_CR_DDRDATARESERVED_Spare_MAX (0xFFFFFFFF)
+
+#define DDRDATA5CH0_CR_DATATRAINFEEDBACK_REG (0x00000A54)
+ #define DDRDATA5CH0_CR_DATATRAINFEEDBACK_DataTrainFeedback_OFF ( 0)
+ #define DDRDATA5CH0_CR_DATATRAINFEEDBACK_DataTrainFeedback_WID ( 9)
+ #define DDRDATA5CH0_CR_DATATRAINFEEDBACK_DataTrainFeedback_MSK (0x000001FF)
+ #define DDRDATA5CH0_CR_DATATRAINFEEDBACK_DataTrainFeedback_MAX (0x000001FF)
+ #define DDRDATA5CH0_CR_DATATRAINFEEDBACK_Spare_OFF ( 9)
+ #define DDRDATA5CH0_CR_DATATRAINFEEDBACK_Spare_WID (23)
+ #define DDRDATA5CH0_CR_DATATRAINFEEDBACK_Spare_MSK (0xFFFFFE00)
+ #define DDRDATA5CH0_CR_DATATRAINFEEDBACK_Spare_MAX (0x007FFFFF)
+
+#define DDRDATA5CH0_CR_DLLPITESTANDADC_REG (0x00000A58)
+ #define DDRDATA5CH0_CR_DLLPITESTANDADC_RunTest_OFF ( 0)
+ #define DDRDATA5CH0_CR_DLLPITESTANDADC_RunTest_WID ( 1)
+ #define DDRDATA5CH0_CR_DLLPITESTANDADC_RunTest_MSK (0x00000001)
+ #define DDRDATA5CH0_CR_DLLPITESTANDADC_RunTest_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DLLPITESTANDADC_RunTest_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DLLPITESTANDADC_Load_OFF ( 1)
+ #define DDRDATA5CH0_CR_DLLPITESTANDADC_Load_WID ( 1)
+ #define DDRDATA5CH0_CR_DLLPITESTANDADC_Load_MSK (0x00000002)
+ #define DDRDATA5CH0_CR_DLLPITESTANDADC_Load_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DLLPITESTANDADC_Load_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DLLPITESTANDADC_ModeHVM_OFF ( 2)
+ #define DDRDATA5CH0_CR_DLLPITESTANDADC_ModeHVM_WID ( 1)
+ #define DDRDATA5CH0_CR_DLLPITESTANDADC_ModeHVM_MSK (0x00000004)
+ #define DDRDATA5CH0_CR_DLLPITESTANDADC_ModeHVM_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DLLPITESTANDADC_ModeHVM_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DLLPITESTANDADC_ModeDV_OFF ( 3)
+ #define DDRDATA5CH0_CR_DLLPITESTANDADC_ModeDV_WID ( 1)
+ #define DDRDATA5CH0_CR_DLLPITESTANDADC_ModeDV_MSK (0x00000008)
+ #define DDRDATA5CH0_CR_DLLPITESTANDADC_ModeDV_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DLLPITESTANDADC_ModeDV_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DLLPITESTANDADC_ModeADC_OFF ( 4)
+ #define DDRDATA5CH0_CR_DLLPITESTANDADC_ModeADC_WID ( 1)
+ #define DDRDATA5CH0_CR_DLLPITESTANDADC_ModeADC_MSK (0x00000010)
+ #define DDRDATA5CH0_CR_DLLPITESTANDADC_ModeADC_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DLLPITESTANDADC_ModeADC_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DLLPITESTANDADC_LoadCount_OFF ( 5)
+ #define DDRDATA5CH0_CR_DLLPITESTANDADC_LoadCount_WID (10)
+ #define DDRDATA5CH0_CR_DLLPITESTANDADC_LoadCount_MSK (0x00007FE0)
+ #define DDRDATA5CH0_CR_DLLPITESTANDADC_LoadCount_MAX (0x000003FF)
+ #define DDRDATA5CH0_CR_DLLPITESTANDADC_CountStatus_OFF (15)
+ #define DDRDATA5CH0_CR_DLLPITESTANDADC_CountStatus_WID (10)
+ #define DDRDATA5CH0_CR_DLLPITESTANDADC_CountStatus_MSK (0x01FF8000)
+ #define DDRDATA5CH0_CR_DLLPITESTANDADC_CountStatus_MAX (0x000003FF)
+ #define DDRDATA5CH0_CR_DLLPITESTANDADC_CountStatus_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DLLPITESTANDADC_Spare_OFF (25)
+ #define DDRDATA5CH0_CR_DLLPITESTANDADC_Spare_WID ( 7)
+ #define DDRDATA5CH0_CR_DLLPITESTANDADC_Spare_MSK (0xFE000000)
+ #define DDRDATA5CH0_CR_DLLPITESTANDADC_Spare_MAX (0x0000007F)
+
+#define DDRDATA5CH0_CR_DDRCRDATAOFFSETCOMP_REG (0x00000A5C)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_OFF ( 0)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_WID ( 6)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_MSK (0x0000003F)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_MAX (0x0000003F)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_OFF ( 6)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_WID ( 6)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_MSK (0x00000FC0)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_MAX (0x0000003F)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_OFF (12)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_WID ( 5)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_MSK (0x0001F000)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_MAX (0x0000001F)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_OFF (17)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_WID ( 5)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_MSK (0x003E0000)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_MAX (0x0000001F)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_OFF (22)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_WID ( 5)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_MSK (0x07C00000)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_MAX (0x0000001F)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_OFF (27)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_WID ( 5)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_MSK (0xF8000000)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_MAX (0x0000001F)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_DEF (0x00000000)
+
+#define DDRDATA5CH0_CR_DDRCRDATACONTROL1_REG (0x00000A60)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_RefPi_OFF ( 0)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_RefPi_WID ( 4)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_RefPi_MSK (0x0000000F)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_RefPi_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_RefPi_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_DllMask_OFF ( 4)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_DllMask_WID ( 2)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_DllMask_MSK (0x00000030)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_DllMask_MAX (0x00000003)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_DllMask_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_DllWeakLock_OFF ( 6)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_DllWeakLock_WID ( 1)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_DllWeakLock_MSK (0x00000040)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_DllWeakLock_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_DllWeakLock_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_OFF ( 7)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_WID ( 3)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_MSK (0x00000380)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_MAX (0x00000007)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_OFF (10)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_WID ( 3)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_MSK (0x00001C00)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_MAX (0x00000007)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_OdtDelay_OFF (13)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_OdtDelay_WID ( 4)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_OdtDelay_MSK (0x0001E000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_OdtDelay_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_OdtDelay_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_OdtDuration_OFF (17)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_OdtDuration_WID ( 3)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_OdtDuration_MSK (0x000E0000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_OdtDuration_MAX (0x00000007)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_OdtDuration_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_OFF (20)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_WID ( 4)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_MSK (0x00F00000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_OFF (24)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_WID ( 3)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_MSK (0x07000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_MAX (0x00000007)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_OFF (27)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_WID ( 3)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_MSK (0x38000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_MAX (0x00000007)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_OFF (30)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_WID ( 1)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_MSK (0x40000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_Rsvd1_OFF (31)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_Rsvd1_WID ( 1)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_Rsvd1_MSK (0x80000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_Rsvd1_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL1_Rsvd1_DEF (0x00000000)
+
+#define DDRDATA5CH0_CR_DDRCRDATACONTROL2_REG (0x00000A64)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_OFF ( 0)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_WID ( 5)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_MSK (0x0000001F)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_MAX (0x0000001F)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_OFF ( 5)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_WID ( 1)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_MSK (0x00000020)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL2_ForceRxOn_OFF ( 6)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL2_ForceRxOn_WID ( 1)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL2_ForceRxOn_MSK (0x00000040)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL2_ForceRxOn_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL2_ForceRxOn_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL2_LeakerComp_OFF ( 7)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL2_LeakerComp_WID ( 2)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL2_LeakerComp_MSK (0x00000180)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL2_LeakerComp_MAX (0x00000003)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL2_LeakerComp_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_OFF ( 9)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_WID ( 4)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_MSK (0x00001E00)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_MAX (0x0000000F)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_DEF (0x00000008)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_OFF (13)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_WID ( 5)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_MSK (0x0003E000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_MAX (0x0000001F)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_DEF (0x00000011)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_OFF (18)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_WID ( 1)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_MSK (0x00040000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL2_Spare_OFF (19)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL2_Spare_WID (13)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL2_Spare_MSK (0xFFF80000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL2_Spare_MAX (0x00001FFF)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL2_Spare_DEF (0x00000000)
+
+#define DDRDATA5CH0_CR_DDRCRVSSHIORVREFCONTROL_REG (0x00000A6C)
+ #define DDRDATA5CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_OFF ( 0)
+ #define DDRDATA5CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_WID (24)
+ #define DDRDATA5CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_MSK (0x00FFFFFF)
+ #define DDRDATA5CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_MAX (0x00FFFFFF)
+ #define DDRDATA5CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_OFF (24)
+ #define DDRDATA5CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_WID ( 8)
+ #define DDRDATA5CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_MSK (0xFF000000)
+ #define DDRDATA5CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_MAX (0x000000FF)
+ #define DDRDATA5CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_DEF (0x00000000)
+
+#define DDRDATA5CH0_CR_DDRCRDATAOFFSETTRAIN_REG (0x00000A70)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_OFF ( 0)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_WID ( 6)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_MSK (0x0000003F)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_MAX (0x0000003F)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_OFF ( 6)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_WID ( 6)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_MSK (0x00000FC0)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_MAX (0x0000003F)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_OFF (12)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_WID ( 6)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_MSK (0x0003F000)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_MAX (0x0000003F)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_OFF (18)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_WID ( 6)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_MSK (0x00FC0000)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_MAX (0x0000003F)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_OFF (24)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_WID ( 7)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_MSK (0x7F000000)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_MAX (0x0000007F)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_OFF (31)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_WID ( 1)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_MSK (0x80000000)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_DEF (0x00000000)
+
+#define DDRDATA5CH0_CR_DDRCRDATACONTROL0_REG (0x00000A74)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_OFF ( 0)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_WID ( 1)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_MSK (0x00000001)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_OFF ( 1)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_WID ( 1)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_MSK (0x00000002)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_OFF ( 2)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_WID ( 1)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_MSK (0x00000004)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_OFF ( 3)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_WID ( 1)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_MSK (0x00000008)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_TxOn_OFF ( 4)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_TxOn_WID ( 1)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_TxOn_MSK (0x00000010)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_TxOn_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_TxOn_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_RfOn_OFF ( 5)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_RfOn_WID ( 1)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_RfOn_MSK (0x00000020)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_RfOn_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_RfOn_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_RxPiOn_OFF ( 6)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_RxPiOn_WID ( 1)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_RxPiOn_MSK (0x00000040)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_RxPiOn_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_RxPiOn_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_TxPiOn_OFF ( 7)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_TxPiOn_WID ( 1)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_TxPiOn_MSK (0x00000080)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_TxPiOn_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_TxPiOn_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_OFF ( 8)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_WID ( 1)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_MSK (0x00000100)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_OFF ( 9)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_WID ( 1)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_MSK (0x00000200)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_TxDisable_OFF (10)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_TxDisable_WID ( 1)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_TxDisable_MSK (0x00000400)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_TxDisable_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_TxDisable_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_RxDisable_OFF (11)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_RxDisable_WID ( 1)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_RxDisable_MSK (0x00000800)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_RxDisable_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_RxDisable_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_TxLong_OFF (12)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_TxLong_WID ( 1)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_TxLong_MSK (0x00001000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_TxLong_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_TxLong_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_OFF (13)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_WID ( 2)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_MSK (0x00006000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_MAX (0x00000003)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_RxReadPointer_OFF (15)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_RxReadPointer_WID ( 3)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_RxReadPointer_MSK (0x00038000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_RxReadPointer_MAX (0x00000007)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_RxReadPointer_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_OFF (18)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_WID ( 1)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_MSK (0x00040000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_OFF (19)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_WID ( 1)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_MSK (0x00080000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_ReadRFRd_OFF (20)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_ReadRFRd_WID ( 1)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_ReadRFRd_MSK (0x00100000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_ReadRFRd_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_ReadRFRd_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_ReadRFWr_OFF (21)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_ReadRFWr_WID ( 1)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_ReadRFWr_MSK (0x00200000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_ReadRFWr_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_ReadRFWr_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_ReadRFRank_OFF (22)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_ReadRFRank_WID ( 2)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_ReadRFRank_MSK (0x00C00000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_ReadRFRank_MAX (0x00000003)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_ReadRFRank_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_OFF (24)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_WID ( 1)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_MSK (0x01000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_OdtSampOff_OFF (25)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_OdtSampOff_WID ( 1)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_OdtSampOff_MSK (0x02000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_OdtSampOff_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_OdtSampOff_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_OFF (26)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_WID ( 1)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_MSK (0x04000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_OFF (27)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_WID ( 1)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_MSK (0x08000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_OFF (28)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_WID ( 1)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_MSK (0x10000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_OFF (29)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_WID ( 1)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_MSK (0x20000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_OFF (30)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_WID ( 1)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_MSK (0x40000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_OFF (31)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_WID ( 1)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_MSK (0x80000000)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_DEF (0x00000000)
+
+#define DDRDATA5CH0_CR_DDRCRVREFADJUST1_REG (0x00000A78)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_OFF ( 0)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_WID ( 7)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_MSK (0x0000007F)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_MAX (0x0000007F)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_OFF ( 7)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_WID ( 7)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_MSK (0x00003F80)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_MAX (0x0000007F)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_OFF (14)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_WID ( 7)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_MSK (0x001FC000)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_MAX (0x0000007F)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_OFF (21)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_WID ( 1)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_MSK (0x00200000)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_OFF (22)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_WID ( 1)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_MSK (0x00400000)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_OFF (23)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_WID ( 1)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_MSK (0x00800000)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_OFF (24)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_WID ( 2)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_MSK (0x03000000)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_MAX (0x00000003)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_OFF (26)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_WID ( 1)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_MSK (0x04000000)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_Rsvd_OFF (27)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_Rsvd_WID ( 2)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_Rsvd_MSK (0x18000000)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_Rsvd_MAX (0x00000003)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_Rsvd_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_caSlowBW_OFF (29)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_caSlowBW_WID ( 1)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_caSlowBW_MSK (0x20000000)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_caSlowBW_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_caSlowBW_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_OFF (30)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_WID ( 1)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_MSK (0x40000000)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_DEF (0x00000000)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_OFF (31)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_WID ( 1)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_MSK (0x80000000)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_MAX (0x00000001)
+ #define DDRDATA5CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_DEF (0x00000000)
+
+#define DDRDATA5CH1_CR_RXTRAINRANK0_REG (0x00000B00)
+ #define DDRDATA5CH1_CR_RXTRAINRANK0_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA5CH1_CR_RXTRAINRANK0_RxRcvEnPi_WID ( 9)
+ #define DDRDATA5CH1_CR_RXTRAINRANK0_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA5CH1_CR_RXTRAINRANK0_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA5CH1_CR_RXTRAINRANK0_RxDqsPPi_OFF ( 9)
+ #define DDRDATA5CH1_CR_RXTRAINRANK0_RxDqsPPi_WID ( 6)
+ #define DDRDATA5CH1_CR_RXTRAINRANK0_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA5CH1_CR_RXTRAINRANK0_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA5CH1_CR_RXTRAINRANK0_RxEq_OFF (15)
+ #define DDRDATA5CH1_CR_RXTRAINRANK0_RxEq_WID ( 5)
+ #define DDRDATA5CH1_CR_RXTRAINRANK0_RxEq_MSK (0x000F8000)
+ #define DDRDATA5CH1_CR_RXTRAINRANK0_RxEq_MAX (0x0000001F)
+ #define DDRDATA5CH1_CR_RXTRAINRANK0_RxDqsNPi_OFF (20)
+ #define DDRDATA5CH1_CR_RXTRAINRANK0_RxDqsNPi_WID ( 6)
+ #define DDRDATA5CH1_CR_RXTRAINRANK0_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA5CH1_CR_RXTRAINRANK0_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA5CH1_CR_RXTRAINRANK0_RxVref_OFF (26)
+ #define DDRDATA5CH1_CR_RXTRAINRANK0_RxVref_WID ( 6)
+ #define DDRDATA5CH1_CR_RXTRAINRANK0_RxVref_MSK (0xFC000000)
+ #define DDRDATA5CH1_CR_RXTRAINRANK0_RxVref_MAX (0x0000003F)
+
+#define DDRDATA5CH1_CR_RXTRAINRANK1_REG (0x00000B04)
+ #define DDRDATA5CH1_CR_RXTRAINRANK1_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA5CH1_CR_RXTRAINRANK1_RxRcvEnPi_WID ( 9)
+ #define DDRDATA5CH1_CR_RXTRAINRANK1_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA5CH1_CR_RXTRAINRANK1_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA5CH1_CR_RXTRAINRANK1_RxDqsPPi_OFF ( 9)
+ #define DDRDATA5CH1_CR_RXTRAINRANK1_RxDqsPPi_WID ( 6)
+ #define DDRDATA5CH1_CR_RXTRAINRANK1_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA5CH1_CR_RXTRAINRANK1_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA5CH1_CR_RXTRAINRANK1_RxEq_OFF (15)
+ #define DDRDATA5CH1_CR_RXTRAINRANK1_RxEq_WID ( 5)
+ #define DDRDATA5CH1_CR_RXTRAINRANK1_RxEq_MSK (0x000F8000)
+ #define DDRDATA5CH1_CR_RXTRAINRANK1_RxEq_MAX (0x0000001F)
+ #define DDRDATA5CH1_CR_RXTRAINRANK1_RxDqsNPi_OFF (20)
+ #define DDRDATA5CH1_CR_RXTRAINRANK1_RxDqsNPi_WID ( 6)
+ #define DDRDATA5CH1_CR_RXTRAINRANK1_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA5CH1_CR_RXTRAINRANK1_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA5CH1_CR_RXTRAINRANK1_RxVref_OFF (26)
+ #define DDRDATA5CH1_CR_RXTRAINRANK1_RxVref_WID ( 6)
+ #define DDRDATA5CH1_CR_RXTRAINRANK1_RxVref_MSK (0xFC000000)
+ #define DDRDATA5CH1_CR_RXTRAINRANK1_RxVref_MAX (0x0000003F)
+
+#define DDRDATA5CH1_CR_RXTRAINRANK2_REG (0x00000B08)
+ #define DDRDATA5CH1_CR_RXTRAINRANK2_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA5CH1_CR_RXTRAINRANK2_RxRcvEnPi_WID ( 9)
+ #define DDRDATA5CH1_CR_RXTRAINRANK2_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA5CH1_CR_RXTRAINRANK2_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA5CH1_CR_RXTRAINRANK2_RxDqsPPi_OFF ( 9)
+ #define DDRDATA5CH1_CR_RXTRAINRANK2_RxDqsPPi_WID ( 6)
+ #define DDRDATA5CH1_CR_RXTRAINRANK2_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA5CH1_CR_RXTRAINRANK2_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA5CH1_CR_RXTRAINRANK2_RxEq_OFF (15)
+ #define DDRDATA5CH1_CR_RXTRAINRANK2_RxEq_WID ( 5)
+ #define DDRDATA5CH1_CR_RXTRAINRANK2_RxEq_MSK (0x000F8000)
+ #define DDRDATA5CH1_CR_RXTRAINRANK2_RxEq_MAX (0x0000001F)
+ #define DDRDATA5CH1_CR_RXTRAINRANK2_RxDqsNPi_OFF (20)
+ #define DDRDATA5CH1_CR_RXTRAINRANK2_RxDqsNPi_WID ( 6)
+ #define DDRDATA5CH1_CR_RXTRAINRANK2_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA5CH1_CR_RXTRAINRANK2_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA5CH1_CR_RXTRAINRANK2_RxVref_OFF (26)
+ #define DDRDATA5CH1_CR_RXTRAINRANK2_RxVref_WID ( 6)
+ #define DDRDATA5CH1_CR_RXTRAINRANK2_RxVref_MSK (0xFC000000)
+ #define DDRDATA5CH1_CR_RXTRAINRANK2_RxVref_MAX (0x0000003F)
+
+#define DDRDATA5CH1_CR_RXTRAINRANK3_REG (0x00000B0C)
+ #define DDRDATA5CH1_CR_RXTRAINRANK3_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA5CH1_CR_RXTRAINRANK3_RxRcvEnPi_WID ( 9)
+ #define DDRDATA5CH1_CR_RXTRAINRANK3_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA5CH1_CR_RXTRAINRANK3_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA5CH1_CR_RXTRAINRANK3_RxDqsPPi_OFF ( 9)
+ #define DDRDATA5CH1_CR_RXTRAINRANK3_RxDqsPPi_WID ( 6)
+ #define DDRDATA5CH1_CR_RXTRAINRANK3_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA5CH1_CR_RXTRAINRANK3_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA5CH1_CR_RXTRAINRANK3_RxEq_OFF (15)
+ #define DDRDATA5CH1_CR_RXTRAINRANK3_RxEq_WID ( 5)
+ #define DDRDATA5CH1_CR_RXTRAINRANK3_RxEq_MSK (0x000F8000)
+ #define DDRDATA5CH1_CR_RXTRAINRANK3_RxEq_MAX (0x0000001F)
+ #define DDRDATA5CH1_CR_RXTRAINRANK3_RxDqsNPi_OFF (20)
+ #define DDRDATA5CH1_CR_RXTRAINRANK3_RxDqsNPi_WID ( 6)
+ #define DDRDATA5CH1_CR_RXTRAINRANK3_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA5CH1_CR_RXTRAINRANK3_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA5CH1_CR_RXTRAINRANK3_RxVref_OFF (26)
+ #define DDRDATA5CH1_CR_RXTRAINRANK3_RxVref_WID ( 6)
+ #define DDRDATA5CH1_CR_RXTRAINRANK3_RxVref_MSK (0xFC000000)
+ #define DDRDATA5CH1_CR_RXTRAINRANK3_RxVref_MAX (0x0000003F)
+
+#define DDRDATA5CH1_CR_RXPERBITRANK0_REG (0x00000B10)
+ #define DDRDATA5CH1_CR_RXPERBITRANK0_Lane0_OFF ( 0)
+ #define DDRDATA5CH1_CR_RXPERBITRANK0_Lane0_WID ( 4)
+ #define DDRDATA5CH1_CR_RXPERBITRANK0_Lane0_MSK (0x0000000F)
+ #define DDRDATA5CH1_CR_RXPERBITRANK0_Lane0_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_RXPERBITRANK0_Lane1_OFF ( 4)
+ #define DDRDATA5CH1_CR_RXPERBITRANK0_Lane1_WID ( 4)
+ #define DDRDATA5CH1_CR_RXPERBITRANK0_Lane1_MSK (0x000000F0)
+ #define DDRDATA5CH1_CR_RXPERBITRANK0_Lane1_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_RXPERBITRANK0_Lane2_OFF ( 8)
+ #define DDRDATA5CH1_CR_RXPERBITRANK0_Lane2_WID ( 4)
+ #define DDRDATA5CH1_CR_RXPERBITRANK0_Lane2_MSK (0x00000F00)
+ #define DDRDATA5CH1_CR_RXPERBITRANK0_Lane2_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_RXPERBITRANK0_Lane3_OFF (12)
+ #define DDRDATA5CH1_CR_RXPERBITRANK0_Lane3_WID ( 4)
+ #define DDRDATA5CH1_CR_RXPERBITRANK0_Lane3_MSK (0x0000F000)
+ #define DDRDATA5CH1_CR_RXPERBITRANK0_Lane3_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_RXPERBITRANK0_Lane4_OFF (16)
+ #define DDRDATA5CH1_CR_RXPERBITRANK0_Lane4_WID ( 4)
+ #define DDRDATA5CH1_CR_RXPERBITRANK0_Lane4_MSK (0x000F0000)
+ #define DDRDATA5CH1_CR_RXPERBITRANK0_Lane4_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_RXPERBITRANK0_Lane5_OFF (20)
+ #define DDRDATA5CH1_CR_RXPERBITRANK0_Lane5_WID ( 4)
+ #define DDRDATA5CH1_CR_RXPERBITRANK0_Lane5_MSK (0x00F00000)
+ #define DDRDATA5CH1_CR_RXPERBITRANK0_Lane5_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_RXPERBITRANK0_Lane6_OFF (24)
+ #define DDRDATA5CH1_CR_RXPERBITRANK0_Lane6_WID ( 4)
+ #define DDRDATA5CH1_CR_RXPERBITRANK0_Lane6_MSK (0x0F000000)
+ #define DDRDATA5CH1_CR_RXPERBITRANK0_Lane6_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_RXPERBITRANK0_Lane7_OFF (28)
+ #define DDRDATA5CH1_CR_RXPERBITRANK0_Lane7_WID ( 4)
+ #define DDRDATA5CH1_CR_RXPERBITRANK0_Lane7_MSK (0xF0000000)
+ #define DDRDATA5CH1_CR_RXPERBITRANK0_Lane7_MAX (0x0000000F)
+
+#define DDRDATA5CH1_CR_RXPERBITRANK1_REG (0x00000B14)
+ #define DDRDATA5CH1_CR_RXPERBITRANK1_Lane0_OFF ( 0)
+ #define DDRDATA5CH1_CR_RXPERBITRANK1_Lane0_WID ( 4)
+ #define DDRDATA5CH1_CR_RXPERBITRANK1_Lane0_MSK (0x0000000F)
+ #define DDRDATA5CH1_CR_RXPERBITRANK1_Lane0_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_RXPERBITRANK1_Lane1_OFF ( 4)
+ #define DDRDATA5CH1_CR_RXPERBITRANK1_Lane1_WID ( 4)
+ #define DDRDATA5CH1_CR_RXPERBITRANK1_Lane1_MSK (0x000000F0)
+ #define DDRDATA5CH1_CR_RXPERBITRANK1_Lane1_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_RXPERBITRANK1_Lane2_OFF ( 8)
+ #define DDRDATA5CH1_CR_RXPERBITRANK1_Lane2_WID ( 4)
+ #define DDRDATA5CH1_CR_RXPERBITRANK1_Lane2_MSK (0x00000F00)
+ #define DDRDATA5CH1_CR_RXPERBITRANK1_Lane2_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_RXPERBITRANK1_Lane3_OFF (12)
+ #define DDRDATA5CH1_CR_RXPERBITRANK1_Lane3_WID ( 4)
+ #define DDRDATA5CH1_CR_RXPERBITRANK1_Lane3_MSK (0x0000F000)
+ #define DDRDATA5CH1_CR_RXPERBITRANK1_Lane3_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_RXPERBITRANK1_Lane4_OFF (16)
+ #define DDRDATA5CH1_CR_RXPERBITRANK1_Lane4_WID ( 4)
+ #define DDRDATA5CH1_CR_RXPERBITRANK1_Lane4_MSK (0x000F0000)
+ #define DDRDATA5CH1_CR_RXPERBITRANK1_Lane4_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_RXPERBITRANK1_Lane5_OFF (20)
+ #define DDRDATA5CH1_CR_RXPERBITRANK1_Lane5_WID ( 4)
+ #define DDRDATA5CH1_CR_RXPERBITRANK1_Lane5_MSK (0x00F00000)
+ #define DDRDATA5CH1_CR_RXPERBITRANK1_Lane5_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_RXPERBITRANK1_Lane6_OFF (24)
+ #define DDRDATA5CH1_CR_RXPERBITRANK1_Lane6_WID ( 4)
+ #define DDRDATA5CH1_CR_RXPERBITRANK1_Lane6_MSK (0x0F000000)
+ #define DDRDATA5CH1_CR_RXPERBITRANK1_Lane6_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_RXPERBITRANK1_Lane7_OFF (28)
+ #define DDRDATA5CH1_CR_RXPERBITRANK1_Lane7_WID ( 4)
+ #define DDRDATA5CH1_CR_RXPERBITRANK1_Lane7_MSK (0xF0000000)
+ #define DDRDATA5CH1_CR_RXPERBITRANK1_Lane7_MAX (0x0000000F)
+
+#define DDRDATA5CH1_CR_RXPERBITRANK2_REG (0x00000B18)
+ #define DDRDATA5CH1_CR_RXPERBITRANK2_Lane0_OFF ( 0)
+ #define DDRDATA5CH1_CR_RXPERBITRANK2_Lane0_WID ( 4)
+ #define DDRDATA5CH1_CR_RXPERBITRANK2_Lane0_MSK (0x0000000F)
+ #define DDRDATA5CH1_CR_RXPERBITRANK2_Lane0_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_RXPERBITRANK2_Lane1_OFF ( 4)
+ #define DDRDATA5CH1_CR_RXPERBITRANK2_Lane1_WID ( 4)
+ #define DDRDATA5CH1_CR_RXPERBITRANK2_Lane1_MSK (0x000000F0)
+ #define DDRDATA5CH1_CR_RXPERBITRANK2_Lane1_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_RXPERBITRANK2_Lane2_OFF ( 8)
+ #define DDRDATA5CH1_CR_RXPERBITRANK2_Lane2_WID ( 4)
+ #define DDRDATA5CH1_CR_RXPERBITRANK2_Lane2_MSK (0x00000F00)
+ #define DDRDATA5CH1_CR_RXPERBITRANK2_Lane2_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_RXPERBITRANK2_Lane3_OFF (12)
+ #define DDRDATA5CH1_CR_RXPERBITRANK2_Lane3_WID ( 4)
+ #define DDRDATA5CH1_CR_RXPERBITRANK2_Lane3_MSK (0x0000F000)
+ #define DDRDATA5CH1_CR_RXPERBITRANK2_Lane3_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_RXPERBITRANK2_Lane4_OFF (16)
+ #define DDRDATA5CH1_CR_RXPERBITRANK2_Lane4_WID ( 4)
+ #define DDRDATA5CH1_CR_RXPERBITRANK2_Lane4_MSK (0x000F0000)
+ #define DDRDATA5CH1_CR_RXPERBITRANK2_Lane4_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_RXPERBITRANK2_Lane5_OFF (20)
+ #define DDRDATA5CH1_CR_RXPERBITRANK2_Lane5_WID ( 4)
+ #define DDRDATA5CH1_CR_RXPERBITRANK2_Lane5_MSK (0x00F00000)
+ #define DDRDATA5CH1_CR_RXPERBITRANK2_Lane5_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_RXPERBITRANK2_Lane6_OFF (24)
+ #define DDRDATA5CH1_CR_RXPERBITRANK2_Lane6_WID ( 4)
+ #define DDRDATA5CH1_CR_RXPERBITRANK2_Lane6_MSK (0x0F000000)
+ #define DDRDATA5CH1_CR_RXPERBITRANK2_Lane6_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_RXPERBITRANK2_Lane7_OFF (28)
+ #define DDRDATA5CH1_CR_RXPERBITRANK2_Lane7_WID ( 4)
+ #define DDRDATA5CH1_CR_RXPERBITRANK2_Lane7_MSK (0xF0000000)
+ #define DDRDATA5CH1_CR_RXPERBITRANK2_Lane7_MAX (0x0000000F)
+
+#define DDRDATA5CH1_CR_RXPERBITRANK3_REG (0x00000B1C)
+ #define DDRDATA5CH1_CR_RXPERBITRANK3_Lane0_OFF ( 0)
+ #define DDRDATA5CH1_CR_RXPERBITRANK3_Lane0_WID ( 4)
+ #define DDRDATA5CH1_CR_RXPERBITRANK3_Lane0_MSK (0x0000000F)
+ #define DDRDATA5CH1_CR_RXPERBITRANK3_Lane0_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_RXPERBITRANK3_Lane1_OFF ( 4)
+ #define DDRDATA5CH1_CR_RXPERBITRANK3_Lane1_WID ( 4)
+ #define DDRDATA5CH1_CR_RXPERBITRANK3_Lane1_MSK (0x000000F0)
+ #define DDRDATA5CH1_CR_RXPERBITRANK3_Lane1_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_RXPERBITRANK3_Lane2_OFF ( 8)
+ #define DDRDATA5CH1_CR_RXPERBITRANK3_Lane2_WID ( 4)
+ #define DDRDATA5CH1_CR_RXPERBITRANK3_Lane2_MSK (0x00000F00)
+ #define DDRDATA5CH1_CR_RXPERBITRANK3_Lane2_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_RXPERBITRANK3_Lane3_OFF (12)
+ #define DDRDATA5CH1_CR_RXPERBITRANK3_Lane3_WID ( 4)
+ #define DDRDATA5CH1_CR_RXPERBITRANK3_Lane3_MSK (0x0000F000)
+ #define DDRDATA5CH1_CR_RXPERBITRANK3_Lane3_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_RXPERBITRANK3_Lane4_OFF (16)
+ #define DDRDATA5CH1_CR_RXPERBITRANK3_Lane4_WID ( 4)
+ #define DDRDATA5CH1_CR_RXPERBITRANK3_Lane4_MSK (0x000F0000)
+ #define DDRDATA5CH1_CR_RXPERBITRANK3_Lane4_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_RXPERBITRANK3_Lane5_OFF (20)
+ #define DDRDATA5CH1_CR_RXPERBITRANK3_Lane5_WID ( 4)
+ #define DDRDATA5CH1_CR_RXPERBITRANK3_Lane5_MSK (0x00F00000)
+ #define DDRDATA5CH1_CR_RXPERBITRANK3_Lane5_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_RXPERBITRANK3_Lane6_OFF (24)
+ #define DDRDATA5CH1_CR_RXPERBITRANK3_Lane6_WID ( 4)
+ #define DDRDATA5CH1_CR_RXPERBITRANK3_Lane6_MSK (0x0F000000)
+ #define DDRDATA5CH1_CR_RXPERBITRANK3_Lane6_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_RXPERBITRANK3_Lane7_OFF (28)
+ #define DDRDATA5CH1_CR_RXPERBITRANK3_Lane7_WID ( 4)
+ #define DDRDATA5CH1_CR_RXPERBITRANK3_Lane7_MSK (0xF0000000)
+ #define DDRDATA5CH1_CR_RXPERBITRANK3_Lane7_MAX (0x0000000F)
+
+#define DDRDATA5CH1_CR_TXTRAINRANK0_REG (0x00000B20)
+ #define DDRDATA5CH1_CR_TXTRAINRANK0_TxDqDelay_OFF ( 0)
+ #define DDRDATA5CH1_CR_TXTRAINRANK0_TxDqDelay_WID ( 9)
+ #define DDRDATA5CH1_CR_TXTRAINRANK0_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA5CH1_CR_TXTRAINRANK0_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA5CH1_CR_TXTRAINRANK0_TxDqsDelay_OFF ( 9)
+ #define DDRDATA5CH1_CR_TXTRAINRANK0_TxDqsDelay_WID ( 9)
+ #define DDRDATA5CH1_CR_TXTRAINRANK0_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA5CH1_CR_TXTRAINRANK0_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA5CH1_CR_TXTRAINRANK0_Spare0_OFF (18)
+ #define DDRDATA5CH1_CR_TXTRAINRANK0_Spare0_WID ( 2)
+ #define DDRDATA5CH1_CR_TXTRAINRANK0_Spare0_MSK (0x000C0000)
+ #define DDRDATA5CH1_CR_TXTRAINRANK0_Spare0_MAX (0x00000003)
+ #define DDRDATA5CH1_CR_TXTRAINRANK0_TxEqualization_OFF (20)
+ #define DDRDATA5CH1_CR_TXTRAINRANK0_TxEqualization_WID ( 6)
+ #define DDRDATA5CH1_CR_TXTRAINRANK0_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA5CH1_CR_TXTRAINRANK0_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA5CH1_CR_TXTRAINRANK0_Spare1_OFF (26)
+ #define DDRDATA5CH1_CR_TXTRAINRANK0_Spare1_WID ( 6)
+ #define DDRDATA5CH1_CR_TXTRAINRANK0_Spare1_MSK (0xFC000000)
+ #define DDRDATA5CH1_CR_TXTRAINRANK0_Spare1_MAX (0x0000003F)
+
+#define DDRDATA5CH1_CR_TXTRAINRANK1_REG (0x00000B24)
+ #define DDRDATA5CH1_CR_TXTRAINRANK1_TxDqDelay_OFF ( 0)
+ #define DDRDATA5CH1_CR_TXTRAINRANK1_TxDqDelay_WID ( 9)
+ #define DDRDATA5CH1_CR_TXTRAINRANK1_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA5CH1_CR_TXTRAINRANK1_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA5CH1_CR_TXTRAINRANK1_TxDqsDelay_OFF ( 9)
+ #define DDRDATA5CH1_CR_TXTRAINRANK1_TxDqsDelay_WID ( 9)
+ #define DDRDATA5CH1_CR_TXTRAINRANK1_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA5CH1_CR_TXTRAINRANK1_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA5CH1_CR_TXTRAINRANK1_Spare0_OFF (18)
+ #define DDRDATA5CH1_CR_TXTRAINRANK1_Spare0_WID ( 2)
+ #define DDRDATA5CH1_CR_TXTRAINRANK1_Spare0_MSK (0x000C0000)
+ #define DDRDATA5CH1_CR_TXTRAINRANK1_Spare0_MAX (0x00000003)
+ #define DDRDATA5CH1_CR_TXTRAINRANK1_TxEqualization_OFF (20)
+ #define DDRDATA5CH1_CR_TXTRAINRANK1_TxEqualization_WID ( 6)
+ #define DDRDATA5CH1_CR_TXTRAINRANK1_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA5CH1_CR_TXTRAINRANK1_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA5CH1_CR_TXTRAINRANK1_Spare1_OFF (26)
+ #define DDRDATA5CH1_CR_TXTRAINRANK1_Spare1_WID ( 6)
+ #define DDRDATA5CH1_CR_TXTRAINRANK1_Spare1_MSK (0xFC000000)
+ #define DDRDATA5CH1_CR_TXTRAINRANK1_Spare1_MAX (0x0000003F)
+
+#define DDRDATA5CH1_CR_TXTRAINRANK2_REG (0x00000B28)
+ #define DDRDATA5CH1_CR_TXTRAINRANK2_TxDqDelay_OFF ( 0)
+ #define DDRDATA5CH1_CR_TXTRAINRANK2_TxDqDelay_WID ( 9)
+ #define DDRDATA5CH1_CR_TXTRAINRANK2_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA5CH1_CR_TXTRAINRANK2_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA5CH1_CR_TXTRAINRANK2_TxDqsDelay_OFF ( 9)
+ #define DDRDATA5CH1_CR_TXTRAINRANK2_TxDqsDelay_WID ( 9)
+ #define DDRDATA5CH1_CR_TXTRAINRANK2_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA5CH1_CR_TXTRAINRANK2_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA5CH1_CR_TXTRAINRANK2_Spare0_OFF (18)
+ #define DDRDATA5CH1_CR_TXTRAINRANK2_Spare0_WID ( 2)
+ #define DDRDATA5CH1_CR_TXTRAINRANK2_Spare0_MSK (0x000C0000)
+ #define DDRDATA5CH1_CR_TXTRAINRANK2_Spare0_MAX (0x00000003)
+ #define DDRDATA5CH1_CR_TXTRAINRANK2_TxEqualization_OFF (20)
+ #define DDRDATA5CH1_CR_TXTRAINRANK2_TxEqualization_WID ( 6)
+ #define DDRDATA5CH1_CR_TXTRAINRANK2_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA5CH1_CR_TXTRAINRANK2_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA5CH1_CR_TXTRAINRANK2_Spare1_OFF (26)
+ #define DDRDATA5CH1_CR_TXTRAINRANK2_Spare1_WID ( 6)
+ #define DDRDATA5CH1_CR_TXTRAINRANK2_Spare1_MSK (0xFC000000)
+ #define DDRDATA5CH1_CR_TXTRAINRANK2_Spare1_MAX (0x0000003F)
+
+#define DDRDATA5CH1_CR_TXTRAINRANK3_REG (0x00000B2C)
+ #define DDRDATA5CH1_CR_TXTRAINRANK3_TxDqDelay_OFF ( 0)
+ #define DDRDATA5CH1_CR_TXTRAINRANK3_TxDqDelay_WID ( 9)
+ #define DDRDATA5CH1_CR_TXTRAINRANK3_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA5CH1_CR_TXTRAINRANK3_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA5CH1_CR_TXTRAINRANK3_TxDqsDelay_OFF ( 9)
+ #define DDRDATA5CH1_CR_TXTRAINRANK3_TxDqsDelay_WID ( 9)
+ #define DDRDATA5CH1_CR_TXTRAINRANK3_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA5CH1_CR_TXTRAINRANK3_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA5CH1_CR_TXTRAINRANK3_Spare0_OFF (18)
+ #define DDRDATA5CH1_CR_TXTRAINRANK3_Spare0_WID ( 2)
+ #define DDRDATA5CH1_CR_TXTRAINRANK3_Spare0_MSK (0x000C0000)
+ #define DDRDATA5CH1_CR_TXTRAINRANK3_Spare0_MAX (0x00000003)
+ #define DDRDATA5CH1_CR_TXTRAINRANK3_TxEqualization_OFF (20)
+ #define DDRDATA5CH1_CR_TXTRAINRANK3_TxEqualization_WID ( 6)
+ #define DDRDATA5CH1_CR_TXTRAINRANK3_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA5CH1_CR_TXTRAINRANK3_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA5CH1_CR_TXTRAINRANK3_Spare1_OFF (26)
+ #define DDRDATA5CH1_CR_TXTRAINRANK3_Spare1_WID ( 6)
+ #define DDRDATA5CH1_CR_TXTRAINRANK3_Spare1_MSK (0xFC000000)
+ #define DDRDATA5CH1_CR_TXTRAINRANK3_Spare1_MAX (0x0000003F)
+
+#define DDRDATA5CH1_CR_TXPERBITRANK0_REG (0x00000B30)
+ #define DDRDATA5CH1_CR_TXPERBITRANK0_Lane0_OFF ( 0)
+ #define DDRDATA5CH1_CR_TXPERBITRANK0_Lane0_WID ( 4)
+ #define DDRDATA5CH1_CR_TXPERBITRANK0_Lane0_MSK (0x0000000F)
+ #define DDRDATA5CH1_CR_TXPERBITRANK0_Lane0_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_TXPERBITRANK0_Lane1_OFF ( 4)
+ #define DDRDATA5CH1_CR_TXPERBITRANK0_Lane1_WID ( 4)
+ #define DDRDATA5CH1_CR_TXPERBITRANK0_Lane1_MSK (0x000000F0)
+ #define DDRDATA5CH1_CR_TXPERBITRANK0_Lane1_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_TXPERBITRANK0_Lane2_OFF ( 8)
+ #define DDRDATA5CH1_CR_TXPERBITRANK0_Lane2_WID ( 4)
+ #define DDRDATA5CH1_CR_TXPERBITRANK0_Lane2_MSK (0x00000F00)
+ #define DDRDATA5CH1_CR_TXPERBITRANK0_Lane2_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_TXPERBITRANK0_Lane3_OFF (12)
+ #define DDRDATA5CH1_CR_TXPERBITRANK0_Lane3_WID ( 4)
+ #define DDRDATA5CH1_CR_TXPERBITRANK0_Lane3_MSK (0x0000F000)
+ #define DDRDATA5CH1_CR_TXPERBITRANK0_Lane3_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_TXPERBITRANK0_Lane4_OFF (16)
+ #define DDRDATA5CH1_CR_TXPERBITRANK0_Lane4_WID ( 4)
+ #define DDRDATA5CH1_CR_TXPERBITRANK0_Lane4_MSK (0x000F0000)
+ #define DDRDATA5CH1_CR_TXPERBITRANK0_Lane4_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_TXPERBITRANK0_Lane5_OFF (20)
+ #define DDRDATA5CH1_CR_TXPERBITRANK0_Lane5_WID ( 4)
+ #define DDRDATA5CH1_CR_TXPERBITRANK0_Lane5_MSK (0x00F00000)
+ #define DDRDATA5CH1_CR_TXPERBITRANK0_Lane5_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_TXPERBITRANK0_Lane6_OFF (24)
+ #define DDRDATA5CH1_CR_TXPERBITRANK0_Lane6_WID ( 4)
+ #define DDRDATA5CH1_CR_TXPERBITRANK0_Lane6_MSK (0x0F000000)
+ #define DDRDATA5CH1_CR_TXPERBITRANK0_Lane6_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_TXPERBITRANK0_Lane7_OFF (28)
+ #define DDRDATA5CH1_CR_TXPERBITRANK0_Lane7_WID ( 4)
+ #define DDRDATA5CH1_CR_TXPERBITRANK0_Lane7_MSK (0xF0000000)
+ #define DDRDATA5CH1_CR_TXPERBITRANK0_Lane7_MAX (0x0000000F)
+
+#define DDRDATA5CH1_CR_TXPERBITRANK1_REG (0x00000B34)
+ #define DDRDATA5CH1_CR_TXPERBITRANK1_Lane0_OFF ( 0)
+ #define DDRDATA5CH1_CR_TXPERBITRANK1_Lane0_WID ( 4)
+ #define DDRDATA5CH1_CR_TXPERBITRANK1_Lane0_MSK (0x0000000F)
+ #define DDRDATA5CH1_CR_TXPERBITRANK1_Lane0_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_TXPERBITRANK1_Lane1_OFF ( 4)
+ #define DDRDATA5CH1_CR_TXPERBITRANK1_Lane1_WID ( 4)
+ #define DDRDATA5CH1_CR_TXPERBITRANK1_Lane1_MSK (0x000000F0)
+ #define DDRDATA5CH1_CR_TXPERBITRANK1_Lane1_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_TXPERBITRANK1_Lane2_OFF ( 8)
+ #define DDRDATA5CH1_CR_TXPERBITRANK1_Lane2_WID ( 4)
+ #define DDRDATA5CH1_CR_TXPERBITRANK1_Lane2_MSK (0x00000F00)
+ #define DDRDATA5CH1_CR_TXPERBITRANK1_Lane2_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_TXPERBITRANK1_Lane3_OFF (12)
+ #define DDRDATA5CH1_CR_TXPERBITRANK1_Lane3_WID ( 4)
+ #define DDRDATA5CH1_CR_TXPERBITRANK1_Lane3_MSK (0x0000F000)
+ #define DDRDATA5CH1_CR_TXPERBITRANK1_Lane3_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_TXPERBITRANK1_Lane4_OFF (16)
+ #define DDRDATA5CH1_CR_TXPERBITRANK1_Lane4_WID ( 4)
+ #define DDRDATA5CH1_CR_TXPERBITRANK1_Lane4_MSK (0x000F0000)
+ #define DDRDATA5CH1_CR_TXPERBITRANK1_Lane4_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_TXPERBITRANK1_Lane5_OFF (20)
+ #define DDRDATA5CH1_CR_TXPERBITRANK1_Lane5_WID ( 4)
+ #define DDRDATA5CH1_CR_TXPERBITRANK1_Lane5_MSK (0x00F00000)
+ #define DDRDATA5CH1_CR_TXPERBITRANK1_Lane5_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_TXPERBITRANK1_Lane6_OFF (24)
+ #define DDRDATA5CH1_CR_TXPERBITRANK1_Lane6_WID ( 4)
+ #define DDRDATA5CH1_CR_TXPERBITRANK1_Lane6_MSK (0x0F000000)
+ #define DDRDATA5CH1_CR_TXPERBITRANK1_Lane6_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_TXPERBITRANK1_Lane7_OFF (28)
+ #define DDRDATA5CH1_CR_TXPERBITRANK1_Lane7_WID ( 4)
+ #define DDRDATA5CH1_CR_TXPERBITRANK1_Lane7_MSK (0xF0000000)
+ #define DDRDATA5CH1_CR_TXPERBITRANK1_Lane7_MAX (0x0000000F)
+
+#define DDRDATA5CH1_CR_TXPERBITRANK2_REG (0x00000B38)
+ #define DDRDATA5CH1_CR_TXPERBITRANK2_Lane0_OFF ( 0)
+ #define DDRDATA5CH1_CR_TXPERBITRANK2_Lane0_WID ( 4)
+ #define DDRDATA5CH1_CR_TXPERBITRANK2_Lane0_MSK (0x0000000F)
+ #define DDRDATA5CH1_CR_TXPERBITRANK2_Lane0_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_TXPERBITRANK2_Lane1_OFF ( 4)
+ #define DDRDATA5CH1_CR_TXPERBITRANK2_Lane1_WID ( 4)
+ #define DDRDATA5CH1_CR_TXPERBITRANK2_Lane1_MSK (0x000000F0)
+ #define DDRDATA5CH1_CR_TXPERBITRANK2_Lane1_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_TXPERBITRANK2_Lane2_OFF ( 8)
+ #define DDRDATA5CH1_CR_TXPERBITRANK2_Lane2_WID ( 4)
+ #define DDRDATA5CH1_CR_TXPERBITRANK2_Lane2_MSK (0x00000F00)
+ #define DDRDATA5CH1_CR_TXPERBITRANK2_Lane2_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_TXPERBITRANK2_Lane3_OFF (12)
+ #define DDRDATA5CH1_CR_TXPERBITRANK2_Lane3_WID ( 4)
+ #define DDRDATA5CH1_CR_TXPERBITRANK2_Lane3_MSK (0x0000F000)
+ #define DDRDATA5CH1_CR_TXPERBITRANK2_Lane3_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_TXPERBITRANK2_Lane4_OFF (16)
+ #define DDRDATA5CH1_CR_TXPERBITRANK2_Lane4_WID ( 4)
+ #define DDRDATA5CH1_CR_TXPERBITRANK2_Lane4_MSK (0x000F0000)
+ #define DDRDATA5CH1_CR_TXPERBITRANK2_Lane4_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_TXPERBITRANK2_Lane5_OFF (20)
+ #define DDRDATA5CH1_CR_TXPERBITRANK2_Lane5_WID ( 4)
+ #define DDRDATA5CH1_CR_TXPERBITRANK2_Lane5_MSK (0x00F00000)
+ #define DDRDATA5CH1_CR_TXPERBITRANK2_Lane5_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_TXPERBITRANK2_Lane6_OFF (24)
+ #define DDRDATA5CH1_CR_TXPERBITRANK2_Lane6_WID ( 4)
+ #define DDRDATA5CH1_CR_TXPERBITRANK2_Lane6_MSK (0x0F000000)
+ #define DDRDATA5CH1_CR_TXPERBITRANK2_Lane6_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_TXPERBITRANK2_Lane7_OFF (28)
+ #define DDRDATA5CH1_CR_TXPERBITRANK2_Lane7_WID ( 4)
+ #define DDRDATA5CH1_CR_TXPERBITRANK2_Lane7_MSK (0xF0000000)
+ #define DDRDATA5CH1_CR_TXPERBITRANK2_Lane7_MAX (0x0000000F)
+
+#define DDRDATA5CH1_CR_TXPERBITRANK3_REG (0x00000B3C)
+ #define DDRDATA5CH1_CR_TXPERBITRANK3_Lane0_OFF ( 0)
+ #define DDRDATA5CH1_CR_TXPERBITRANK3_Lane0_WID ( 4)
+ #define DDRDATA5CH1_CR_TXPERBITRANK3_Lane0_MSK (0x0000000F)
+ #define DDRDATA5CH1_CR_TXPERBITRANK3_Lane0_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_TXPERBITRANK3_Lane1_OFF ( 4)
+ #define DDRDATA5CH1_CR_TXPERBITRANK3_Lane1_WID ( 4)
+ #define DDRDATA5CH1_CR_TXPERBITRANK3_Lane1_MSK (0x000000F0)
+ #define DDRDATA5CH1_CR_TXPERBITRANK3_Lane1_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_TXPERBITRANK3_Lane2_OFF ( 8)
+ #define DDRDATA5CH1_CR_TXPERBITRANK3_Lane2_WID ( 4)
+ #define DDRDATA5CH1_CR_TXPERBITRANK3_Lane2_MSK (0x00000F00)
+ #define DDRDATA5CH1_CR_TXPERBITRANK3_Lane2_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_TXPERBITRANK3_Lane3_OFF (12)
+ #define DDRDATA5CH1_CR_TXPERBITRANK3_Lane3_WID ( 4)
+ #define DDRDATA5CH1_CR_TXPERBITRANK3_Lane3_MSK (0x0000F000)
+ #define DDRDATA5CH1_CR_TXPERBITRANK3_Lane3_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_TXPERBITRANK3_Lane4_OFF (16)
+ #define DDRDATA5CH1_CR_TXPERBITRANK3_Lane4_WID ( 4)
+ #define DDRDATA5CH1_CR_TXPERBITRANK3_Lane4_MSK (0x000F0000)
+ #define DDRDATA5CH1_CR_TXPERBITRANK3_Lane4_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_TXPERBITRANK3_Lane5_OFF (20)
+ #define DDRDATA5CH1_CR_TXPERBITRANK3_Lane5_WID ( 4)
+ #define DDRDATA5CH1_CR_TXPERBITRANK3_Lane5_MSK (0x00F00000)
+ #define DDRDATA5CH1_CR_TXPERBITRANK3_Lane5_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_TXPERBITRANK3_Lane6_OFF (24)
+ #define DDRDATA5CH1_CR_TXPERBITRANK3_Lane6_WID ( 4)
+ #define DDRDATA5CH1_CR_TXPERBITRANK3_Lane6_MSK (0x0F000000)
+ #define DDRDATA5CH1_CR_TXPERBITRANK3_Lane6_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_TXPERBITRANK3_Lane7_OFF (28)
+ #define DDRDATA5CH1_CR_TXPERBITRANK3_Lane7_WID ( 4)
+ #define DDRDATA5CH1_CR_TXPERBITRANK3_Lane7_MSK (0xF0000000)
+ #define DDRDATA5CH1_CR_TXPERBITRANK3_Lane7_MAX (0x0000000F)
+
+#define DDRDATA5CH1_CR_RCOMPDATA0_REG (0x00000B40)
+ #define DDRDATA5CH1_CR_RCOMPDATA0_RcompDrvUp_OFF ( 0)
+ #define DDRDATA5CH1_CR_RCOMPDATA0_RcompDrvUp_WID ( 6)
+ #define DDRDATA5CH1_CR_RCOMPDATA0_RcompDrvUp_MSK (0x0000003F)
+ #define DDRDATA5CH1_CR_RCOMPDATA0_RcompDrvUp_MAX (0x0000003F)
+ #define DDRDATA5CH1_CR_RCOMPDATA0_Spare0_OFF ( 6)
+ #define DDRDATA5CH1_CR_RCOMPDATA0_Spare0_WID ( 3)
+ #define DDRDATA5CH1_CR_RCOMPDATA0_Spare0_MSK (0x000001C0)
+ #define DDRDATA5CH1_CR_RCOMPDATA0_Spare0_MAX (0x00000007)
+ #define DDRDATA5CH1_CR_RCOMPDATA0_RcompDrvDown_OFF ( 9)
+ #define DDRDATA5CH1_CR_RCOMPDATA0_RcompDrvDown_WID ( 6)
+ #define DDRDATA5CH1_CR_RCOMPDATA0_RcompDrvDown_MSK (0x00007E00)
+ #define DDRDATA5CH1_CR_RCOMPDATA0_RcompDrvDown_MAX (0x0000003F)
+ #define DDRDATA5CH1_CR_RCOMPDATA0_VTComp_OFF (15)
+ #define DDRDATA5CH1_CR_RCOMPDATA0_VTComp_WID ( 5)
+ #define DDRDATA5CH1_CR_RCOMPDATA0_VTComp_MSK (0x000F8000)
+ #define DDRDATA5CH1_CR_RCOMPDATA0_VTComp_MAX (0x0000001F)
+ #define DDRDATA5CH1_CR_RCOMPDATA0_TcoComp_OFF (20)
+ #define DDRDATA5CH1_CR_RCOMPDATA0_TcoComp_WID ( 6)
+ #define DDRDATA5CH1_CR_RCOMPDATA0_TcoComp_MSK (0x03F00000)
+ #define DDRDATA5CH1_CR_RCOMPDATA0_TcoComp_MAX (0x0000003F)
+ #define DDRDATA5CH1_CR_RCOMPDATA0_SlewRateComp_OFF (26)
+ #define DDRDATA5CH1_CR_RCOMPDATA0_SlewRateComp_WID ( 5)
+ #define DDRDATA5CH1_CR_RCOMPDATA0_SlewRateComp_MSK (0x7C000000)
+ #define DDRDATA5CH1_CR_RCOMPDATA0_SlewRateComp_MAX (0x0000001F)
+ #define DDRDATA5CH1_CR_RCOMPDATA0_Spare2_OFF (31)
+ #define DDRDATA5CH1_CR_RCOMPDATA0_Spare2_WID ( 1)
+ #define DDRDATA5CH1_CR_RCOMPDATA0_Spare2_MSK (0x80000000)
+ #define DDRDATA5CH1_CR_RCOMPDATA0_Spare2_MAX (0x00000001)
+
+#define DDRDATA5CH1_CR_RCOMPDATA1_REG (0x00000B44)
+ #define DDRDATA5CH1_CR_RCOMPDATA1_RcompOdtUp_OFF ( 0)
+ #define DDRDATA5CH1_CR_RCOMPDATA1_RcompOdtUp_WID ( 6)
+ #define DDRDATA5CH1_CR_RCOMPDATA1_RcompOdtUp_MSK (0x0000003F)
+ #define DDRDATA5CH1_CR_RCOMPDATA1_RcompOdtUp_MAX (0x0000003F)
+ #define DDRDATA5CH1_CR_RCOMPDATA1_Spare0_OFF ( 6)
+ #define DDRDATA5CH1_CR_RCOMPDATA1_Spare0_WID ( 3)
+ #define DDRDATA5CH1_CR_RCOMPDATA1_Spare0_MSK (0x000001C0)
+ #define DDRDATA5CH1_CR_RCOMPDATA1_Spare0_MAX (0x00000007)
+ #define DDRDATA5CH1_CR_RCOMPDATA1_RcompOdtDown_OFF ( 9)
+ #define DDRDATA5CH1_CR_RCOMPDATA1_RcompOdtDown_WID ( 6)
+ #define DDRDATA5CH1_CR_RCOMPDATA1_RcompOdtDown_MSK (0x00007E00)
+ #define DDRDATA5CH1_CR_RCOMPDATA1_RcompOdtDown_MAX (0x0000003F)
+ #define DDRDATA5CH1_CR_RCOMPDATA1_Spare1_OFF (15)
+ #define DDRDATA5CH1_CR_RCOMPDATA1_Spare1_WID ( 1)
+ #define DDRDATA5CH1_CR_RCOMPDATA1_Spare1_MSK (0x00008000)
+ #define DDRDATA5CH1_CR_RCOMPDATA1_Spare1_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_RCOMPDATA1_PanicDrvDn_OFF (16)
+ #define DDRDATA5CH1_CR_RCOMPDATA1_PanicDrvDn_WID ( 6)
+ #define DDRDATA5CH1_CR_RCOMPDATA1_PanicDrvDn_MSK (0x003F0000)
+ #define DDRDATA5CH1_CR_RCOMPDATA1_PanicDrvDn_MAX (0x0000003F)
+ #define DDRDATA5CH1_CR_RCOMPDATA1_PanicDrvUp_OFF (22)
+ #define DDRDATA5CH1_CR_RCOMPDATA1_PanicDrvUp_WID ( 6)
+ #define DDRDATA5CH1_CR_RCOMPDATA1_PanicDrvUp_MSK (0x0FC00000)
+ #define DDRDATA5CH1_CR_RCOMPDATA1_PanicDrvUp_MAX (0x0000003F)
+ #define DDRDATA5CH1_CR_RCOMPDATA1_LevelShifterComp_OFF (28)
+ #define DDRDATA5CH1_CR_RCOMPDATA1_LevelShifterComp_WID ( 3)
+ #define DDRDATA5CH1_CR_RCOMPDATA1_LevelShifterComp_MSK (0x70000000)
+ #define DDRDATA5CH1_CR_RCOMPDATA1_LevelShifterComp_MAX (0x00000007)
+ #define DDRDATA5CH1_CR_RCOMPDATA1_Spare2_OFF (31)
+ #define DDRDATA5CH1_CR_RCOMPDATA1_Spare2_WID ( 1)
+ #define DDRDATA5CH1_CR_RCOMPDATA1_Spare2_MSK (0x80000000)
+ #define DDRDATA5CH1_CR_RCOMPDATA1_Spare2_MAX (0x00000001)
+
+#define DDRDATA5CH1_CR_TXXTALK_REG (0x00000B48)
+ #define DDRDATA5CH1_CR_TXXTALK_Lane0_OFF ( 0)
+ #define DDRDATA5CH1_CR_TXXTALK_Lane0_WID ( 4)
+ #define DDRDATA5CH1_CR_TXXTALK_Lane0_MSK (0x0000000F)
+ #define DDRDATA5CH1_CR_TXXTALK_Lane0_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_TXXTALK_Lane1_OFF ( 4)
+ #define DDRDATA5CH1_CR_TXXTALK_Lane1_WID ( 4)
+ #define DDRDATA5CH1_CR_TXXTALK_Lane1_MSK (0x000000F0)
+ #define DDRDATA5CH1_CR_TXXTALK_Lane1_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_TXXTALK_Lane2_OFF ( 8)
+ #define DDRDATA5CH1_CR_TXXTALK_Lane2_WID ( 4)
+ #define DDRDATA5CH1_CR_TXXTALK_Lane2_MSK (0x00000F00)
+ #define DDRDATA5CH1_CR_TXXTALK_Lane2_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_TXXTALK_Lane3_OFF (12)
+ #define DDRDATA5CH1_CR_TXXTALK_Lane3_WID ( 4)
+ #define DDRDATA5CH1_CR_TXXTALK_Lane3_MSK (0x0000F000)
+ #define DDRDATA5CH1_CR_TXXTALK_Lane3_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_TXXTALK_Lane4_OFF (16)
+ #define DDRDATA5CH1_CR_TXXTALK_Lane4_WID ( 4)
+ #define DDRDATA5CH1_CR_TXXTALK_Lane4_MSK (0x000F0000)
+ #define DDRDATA5CH1_CR_TXXTALK_Lane4_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_TXXTALK_Lane5_OFF (20)
+ #define DDRDATA5CH1_CR_TXXTALK_Lane5_WID ( 4)
+ #define DDRDATA5CH1_CR_TXXTALK_Lane5_MSK (0x00F00000)
+ #define DDRDATA5CH1_CR_TXXTALK_Lane5_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_TXXTALK_Lane6_OFF (24)
+ #define DDRDATA5CH1_CR_TXXTALK_Lane6_WID ( 4)
+ #define DDRDATA5CH1_CR_TXXTALK_Lane6_MSK (0x0F000000)
+ #define DDRDATA5CH1_CR_TXXTALK_Lane6_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_TXXTALK_Lane7_OFF (28)
+ #define DDRDATA5CH1_CR_TXXTALK_Lane7_WID ( 4)
+ #define DDRDATA5CH1_CR_TXXTALK_Lane7_MSK (0xF0000000)
+ #define DDRDATA5CH1_CR_TXXTALK_Lane7_MAX (0x0000000F)
+
+#define DDRDATA5CH1_CR_RXOFFSETVDQ_REG (0x00000B4C)
+ #define DDRDATA5CH1_CR_RXOFFSETVDQ_Lane0_OFF ( 0)
+ #define DDRDATA5CH1_CR_RXOFFSETVDQ_Lane0_WID ( 4)
+ #define DDRDATA5CH1_CR_RXOFFSETVDQ_Lane0_MSK (0x0000000F)
+ #define DDRDATA5CH1_CR_RXOFFSETVDQ_Lane0_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_RXOFFSETVDQ_Lane1_OFF ( 4)
+ #define DDRDATA5CH1_CR_RXOFFSETVDQ_Lane1_WID ( 4)
+ #define DDRDATA5CH1_CR_RXOFFSETVDQ_Lane1_MSK (0x000000F0)
+ #define DDRDATA5CH1_CR_RXOFFSETVDQ_Lane1_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_RXOFFSETVDQ_Lane2_OFF ( 8)
+ #define DDRDATA5CH1_CR_RXOFFSETVDQ_Lane2_WID ( 4)
+ #define DDRDATA5CH1_CR_RXOFFSETVDQ_Lane2_MSK (0x00000F00)
+ #define DDRDATA5CH1_CR_RXOFFSETVDQ_Lane2_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_RXOFFSETVDQ_Lane3_OFF (12)
+ #define DDRDATA5CH1_CR_RXOFFSETVDQ_Lane3_WID ( 4)
+ #define DDRDATA5CH1_CR_RXOFFSETVDQ_Lane3_MSK (0x0000F000)
+ #define DDRDATA5CH1_CR_RXOFFSETVDQ_Lane3_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_RXOFFSETVDQ_Lane4_OFF (16)
+ #define DDRDATA5CH1_CR_RXOFFSETVDQ_Lane4_WID ( 4)
+ #define DDRDATA5CH1_CR_RXOFFSETVDQ_Lane4_MSK (0x000F0000)
+ #define DDRDATA5CH1_CR_RXOFFSETVDQ_Lane4_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_RXOFFSETVDQ_Lane5_OFF (20)
+ #define DDRDATA5CH1_CR_RXOFFSETVDQ_Lane5_WID ( 4)
+ #define DDRDATA5CH1_CR_RXOFFSETVDQ_Lane5_MSK (0x00F00000)
+ #define DDRDATA5CH1_CR_RXOFFSETVDQ_Lane5_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_RXOFFSETVDQ_Lane6_OFF (24)
+ #define DDRDATA5CH1_CR_RXOFFSETVDQ_Lane6_WID ( 4)
+ #define DDRDATA5CH1_CR_RXOFFSETVDQ_Lane6_MSK (0x0F000000)
+ #define DDRDATA5CH1_CR_RXOFFSETVDQ_Lane6_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_RXOFFSETVDQ_Lane7_OFF (28)
+ #define DDRDATA5CH1_CR_RXOFFSETVDQ_Lane7_WID ( 4)
+ #define DDRDATA5CH1_CR_RXOFFSETVDQ_Lane7_MSK (0xF0000000)
+ #define DDRDATA5CH1_CR_RXOFFSETVDQ_Lane7_MAX (0x0000000F)
+
+#define DDRDATA5CH1_CR_DDRDATARESERVED_REG (0x00000B50)
+ #define DDRDATA5CH1_CR_DDRDATARESERVED_Spare_OFF ( 0)
+ #define DDRDATA5CH1_CR_DDRDATARESERVED_Spare_WID (32)
+ #define DDRDATA5CH1_CR_DDRDATARESERVED_Spare_MSK (0xFFFFFFFF)
+ #define DDRDATA5CH1_CR_DDRDATARESERVED_Spare_MAX (0xFFFFFFFF)
+
+#define DDRDATA5CH1_CR_DATATRAINFEEDBACK_REG (0x00000B54)
+ #define DDRDATA5CH1_CR_DATATRAINFEEDBACK_DataTrainFeedback_OFF ( 0)
+ #define DDRDATA5CH1_CR_DATATRAINFEEDBACK_DataTrainFeedback_WID ( 9)
+ #define DDRDATA5CH1_CR_DATATRAINFEEDBACK_DataTrainFeedback_MSK (0x000001FF)
+ #define DDRDATA5CH1_CR_DATATRAINFEEDBACK_DataTrainFeedback_MAX (0x000001FF)
+ #define DDRDATA5CH1_CR_DATATRAINFEEDBACK_Spare_OFF ( 9)
+ #define DDRDATA5CH1_CR_DATATRAINFEEDBACK_Spare_WID (23)
+ #define DDRDATA5CH1_CR_DATATRAINFEEDBACK_Spare_MSK (0xFFFFFE00)
+ #define DDRDATA5CH1_CR_DATATRAINFEEDBACK_Spare_MAX (0x007FFFFF)
+
+#define DDRDATA5CH1_CR_DLLPITESTANDADC_REG (0x00000B58)
+ #define DDRDATA5CH1_CR_DLLPITESTANDADC_RunTest_OFF ( 0)
+ #define DDRDATA5CH1_CR_DLLPITESTANDADC_RunTest_WID ( 1)
+ #define DDRDATA5CH1_CR_DLLPITESTANDADC_RunTest_MSK (0x00000001)
+ #define DDRDATA5CH1_CR_DLLPITESTANDADC_RunTest_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DLLPITESTANDADC_RunTest_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DLLPITESTANDADC_Load_OFF ( 1)
+ #define DDRDATA5CH1_CR_DLLPITESTANDADC_Load_WID ( 1)
+ #define DDRDATA5CH1_CR_DLLPITESTANDADC_Load_MSK (0x00000002)
+ #define DDRDATA5CH1_CR_DLLPITESTANDADC_Load_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DLLPITESTANDADC_Load_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DLLPITESTANDADC_ModeHVM_OFF ( 2)
+ #define DDRDATA5CH1_CR_DLLPITESTANDADC_ModeHVM_WID ( 1)
+ #define DDRDATA5CH1_CR_DLLPITESTANDADC_ModeHVM_MSK (0x00000004)
+ #define DDRDATA5CH1_CR_DLLPITESTANDADC_ModeHVM_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DLLPITESTANDADC_ModeHVM_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DLLPITESTANDADC_ModeDV_OFF ( 3)
+ #define DDRDATA5CH1_CR_DLLPITESTANDADC_ModeDV_WID ( 1)
+ #define DDRDATA5CH1_CR_DLLPITESTANDADC_ModeDV_MSK (0x00000008)
+ #define DDRDATA5CH1_CR_DLLPITESTANDADC_ModeDV_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DLLPITESTANDADC_ModeDV_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DLLPITESTANDADC_ModeADC_OFF ( 4)
+ #define DDRDATA5CH1_CR_DLLPITESTANDADC_ModeADC_WID ( 1)
+ #define DDRDATA5CH1_CR_DLLPITESTANDADC_ModeADC_MSK (0x00000010)
+ #define DDRDATA5CH1_CR_DLLPITESTANDADC_ModeADC_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DLLPITESTANDADC_ModeADC_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DLLPITESTANDADC_LoadCount_OFF ( 5)
+ #define DDRDATA5CH1_CR_DLLPITESTANDADC_LoadCount_WID (10)
+ #define DDRDATA5CH1_CR_DLLPITESTANDADC_LoadCount_MSK (0x00007FE0)
+ #define DDRDATA5CH1_CR_DLLPITESTANDADC_LoadCount_MAX (0x000003FF)
+ #define DDRDATA5CH1_CR_DLLPITESTANDADC_CountStatus_OFF (15)
+ #define DDRDATA5CH1_CR_DLLPITESTANDADC_CountStatus_WID (10)
+ #define DDRDATA5CH1_CR_DLLPITESTANDADC_CountStatus_MSK (0x01FF8000)
+ #define DDRDATA5CH1_CR_DLLPITESTANDADC_CountStatus_MAX (0x000003FF)
+ #define DDRDATA5CH1_CR_DLLPITESTANDADC_CountStatus_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DLLPITESTANDADC_Spare_OFF (25)
+ #define DDRDATA5CH1_CR_DLLPITESTANDADC_Spare_WID ( 7)
+ #define DDRDATA5CH1_CR_DLLPITESTANDADC_Spare_MSK (0xFE000000)
+ #define DDRDATA5CH1_CR_DLLPITESTANDADC_Spare_MAX (0x0000007F)
+
+#define DDRDATA5CH1_CR_DDRCRDATAOFFSETCOMP_REG (0x00000B5C)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_OFF ( 0)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_WID ( 6)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_MSK (0x0000003F)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_MAX (0x0000003F)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_OFF ( 6)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_WID ( 6)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_MSK (0x00000FC0)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_MAX (0x0000003F)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_OFF (12)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_WID ( 5)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_MSK (0x0001F000)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_MAX (0x0000001F)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_OFF (17)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_WID ( 5)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_MSK (0x003E0000)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_MAX (0x0000001F)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_OFF (22)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_WID ( 5)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_MSK (0x07C00000)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_MAX (0x0000001F)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_OFF (27)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_WID ( 5)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_MSK (0xF8000000)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_MAX (0x0000001F)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_DEF (0x00000000)
+
+#define DDRDATA5CH1_CR_DDRCRDATACONTROL1_REG (0x00000B60)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_RefPi_OFF ( 0)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_RefPi_WID ( 4)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_RefPi_MSK (0x0000000F)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_RefPi_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_RefPi_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_DllMask_OFF ( 4)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_DllMask_WID ( 2)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_DllMask_MSK (0x00000030)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_DllMask_MAX (0x00000003)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_DllMask_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_DllWeakLock_OFF ( 6)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_DllWeakLock_WID ( 1)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_DllWeakLock_MSK (0x00000040)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_DllWeakLock_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_DllWeakLock_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_OFF ( 7)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_WID ( 3)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_MSK (0x00000380)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_MAX (0x00000007)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_OFF (10)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_WID ( 3)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_MSK (0x00001C00)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_MAX (0x00000007)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_OdtDelay_OFF (13)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_OdtDelay_WID ( 4)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_OdtDelay_MSK (0x0001E000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_OdtDelay_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_OdtDelay_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_OdtDuration_OFF (17)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_OdtDuration_WID ( 3)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_OdtDuration_MSK (0x000E0000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_OdtDuration_MAX (0x00000007)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_OdtDuration_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_OFF (20)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_WID ( 4)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_MSK (0x00F00000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_OFF (24)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_WID ( 3)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_MSK (0x07000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_MAX (0x00000007)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_OFF (27)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_WID ( 3)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_MSK (0x38000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_MAX (0x00000007)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_OFF (30)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_WID ( 1)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_MSK (0x40000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_Rsvd1_OFF (31)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_Rsvd1_WID ( 1)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_Rsvd1_MSK (0x80000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_Rsvd1_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL1_Rsvd1_DEF (0x00000000)
+
+#define DDRDATA5CH1_CR_DDRCRDATACONTROL2_REG (0x00000B64)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_OFF ( 0)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_WID ( 5)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_MSK (0x0000001F)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_MAX (0x0000001F)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_OFF ( 5)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_WID ( 1)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_MSK (0x00000020)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL2_ForceRxOn_OFF ( 6)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL2_ForceRxOn_WID ( 1)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL2_ForceRxOn_MSK (0x00000040)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL2_ForceRxOn_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL2_ForceRxOn_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL2_LeakerComp_OFF ( 7)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL2_LeakerComp_WID ( 2)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL2_LeakerComp_MSK (0x00000180)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL2_LeakerComp_MAX (0x00000003)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL2_LeakerComp_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_OFF ( 9)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_WID ( 4)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_MSK (0x00001E00)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_MAX (0x0000000F)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_DEF (0x00000008)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_OFF (13)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_WID ( 5)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_MSK (0x0003E000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_MAX (0x0000001F)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_DEF (0x00000011)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_OFF (18)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_WID ( 1)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_MSK (0x00040000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL2_Spare_OFF (19)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL2_Spare_WID (13)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL2_Spare_MSK (0xFFF80000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL2_Spare_MAX (0x00001FFF)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL2_Spare_DEF (0x00000000)
+
+#define DDRDATA5CH1_CR_DDRCRVSSHIORVREFCONTROL_REG (0x00000B6C)
+ #define DDRDATA5CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_OFF ( 0)
+ #define DDRDATA5CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_WID (24)
+ #define DDRDATA5CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_MSK (0x00FFFFFF)
+ #define DDRDATA5CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_MAX (0x00FFFFFF)
+ #define DDRDATA5CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_OFF (24)
+ #define DDRDATA5CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_WID ( 8)
+ #define DDRDATA5CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_MSK (0xFF000000)
+ #define DDRDATA5CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_MAX (0x000000FF)
+ #define DDRDATA5CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_DEF (0x00000000)
+
+#define DDRDATA5CH1_CR_DDRCRDATAOFFSETTRAIN_REG (0x00000B70)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_OFF ( 0)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_WID ( 6)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_MSK (0x0000003F)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_MAX (0x0000003F)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_OFF ( 6)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_WID ( 6)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_MSK (0x00000FC0)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_MAX (0x0000003F)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_OFF (12)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_WID ( 6)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_MSK (0x0003F000)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_MAX (0x0000003F)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_OFF (18)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_WID ( 6)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_MSK (0x00FC0000)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_MAX (0x0000003F)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_OFF (24)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_WID ( 7)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_MSK (0x7F000000)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_MAX (0x0000007F)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_OFF (31)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_WID ( 1)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_MSK (0x80000000)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_DEF (0x00000000)
+
+#define DDRDATA5CH1_CR_DDRCRDATACONTROL0_REG (0x00000B74)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_OFF ( 0)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_WID ( 1)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_MSK (0x00000001)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_OFF ( 1)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_WID ( 1)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_MSK (0x00000002)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_OFF ( 2)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_WID ( 1)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_MSK (0x00000004)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_OFF ( 3)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_WID ( 1)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_MSK (0x00000008)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_TxOn_OFF ( 4)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_TxOn_WID ( 1)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_TxOn_MSK (0x00000010)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_TxOn_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_TxOn_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_RfOn_OFF ( 5)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_RfOn_WID ( 1)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_RfOn_MSK (0x00000020)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_RfOn_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_RfOn_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_RxPiOn_OFF ( 6)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_RxPiOn_WID ( 1)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_RxPiOn_MSK (0x00000040)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_RxPiOn_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_RxPiOn_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_TxPiOn_OFF ( 7)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_TxPiOn_WID ( 1)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_TxPiOn_MSK (0x00000080)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_TxPiOn_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_TxPiOn_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_OFF ( 8)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_WID ( 1)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_MSK (0x00000100)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_OFF ( 9)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_WID ( 1)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_MSK (0x00000200)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_TxDisable_OFF (10)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_TxDisable_WID ( 1)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_TxDisable_MSK (0x00000400)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_TxDisable_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_TxDisable_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_RxDisable_OFF (11)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_RxDisable_WID ( 1)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_RxDisable_MSK (0x00000800)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_RxDisable_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_RxDisable_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_TxLong_OFF (12)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_TxLong_WID ( 1)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_TxLong_MSK (0x00001000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_TxLong_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_TxLong_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_OFF (13)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_WID ( 2)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_MSK (0x00006000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_MAX (0x00000003)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_RxReadPointer_OFF (15)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_RxReadPointer_WID ( 3)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_RxReadPointer_MSK (0x00038000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_RxReadPointer_MAX (0x00000007)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_RxReadPointer_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_OFF (18)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_WID ( 1)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_MSK (0x00040000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_OFF (19)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_WID ( 1)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_MSK (0x00080000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_ReadRFRd_OFF (20)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_ReadRFRd_WID ( 1)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_ReadRFRd_MSK (0x00100000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_ReadRFRd_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_ReadRFRd_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_ReadRFWr_OFF (21)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_ReadRFWr_WID ( 1)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_ReadRFWr_MSK (0x00200000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_ReadRFWr_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_ReadRFWr_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_ReadRFRank_OFF (22)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_ReadRFRank_WID ( 2)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_ReadRFRank_MSK (0x00C00000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_ReadRFRank_MAX (0x00000003)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_ReadRFRank_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_OFF (24)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_WID ( 1)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_MSK (0x01000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_OdtSampOff_OFF (25)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_OdtSampOff_WID ( 1)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_OdtSampOff_MSK (0x02000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_OdtSampOff_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_OdtSampOff_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_OFF (26)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_WID ( 1)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_MSK (0x04000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_OFF (27)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_WID ( 1)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_MSK (0x08000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_OFF (28)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_WID ( 1)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_MSK (0x10000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_OFF (29)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_WID ( 1)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_MSK (0x20000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_OFF (30)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_WID ( 1)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_MSK (0x40000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_OFF (31)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_WID ( 1)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_MSK (0x80000000)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_DEF (0x00000000)
+
+#define DDRDATA5CH1_CR_DDRCRVREFADJUST1_REG (0x00000B78)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_OFF ( 0)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_WID ( 7)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_MSK (0x0000007F)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_MAX (0x0000007F)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_OFF ( 7)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_WID ( 7)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_MSK (0x00003F80)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_MAX (0x0000007F)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_OFF (14)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_WID ( 7)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_MSK (0x001FC000)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_MAX (0x0000007F)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_OFF (21)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_WID ( 1)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_MSK (0x00200000)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_OFF (22)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_WID ( 1)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_MSK (0x00400000)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_OFF (23)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_WID ( 1)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_MSK (0x00800000)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_OFF (24)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_WID ( 2)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_MSK (0x03000000)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_MAX (0x00000003)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_OFF (26)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_WID ( 1)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_MSK (0x04000000)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_Rsvd_OFF (27)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_Rsvd_WID ( 2)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_Rsvd_MSK (0x18000000)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_Rsvd_MAX (0x00000003)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_Rsvd_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_caSlowBW_OFF (29)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_caSlowBW_WID ( 1)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_caSlowBW_MSK (0x20000000)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_caSlowBW_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_caSlowBW_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_OFF (30)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_WID ( 1)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_MSK (0x40000000)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_DEF (0x00000000)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_OFF (31)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_WID ( 1)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_MSK (0x80000000)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_MAX (0x00000001)
+ #define DDRDATA5CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_DEF (0x00000000)
+
+#define DDRDATA6CH0_CR_RXTRAINRANK0_REG (0x00000C00)
+ #define DDRDATA6CH0_CR_RXTRAINRANK0_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA6CH0_CR_RXTRAINRANK0_RxRcvEnPi_WID ( 9)
+ #define DDRDATA6CH0_CR_RXTRAINRANK0_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA6CH0_CR_RXTRAINRANK0_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA6CH0_CR_RXTRAINRANK0_RxDqsPPi_OFF ( 9)
+ #define DDRDATA6CH0_CR_RXTRAINRANK0_RxDqsPPi_WID ( 6)
+ #define DDRDATA6CH0_CR_RXTRAINRANK0_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA6CH0_CR_RXTRAINRANK0_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA6CH0_CR_RXTRAINRANK0_RxEq_OFF (15)
+ #define DDRDATA6CH0_CR_RXTRAINRANK0_RxEq_WID ( 5)
+ #define DDRDATA6CH0_CR_RXTRAINRANK0_RxEq_MSK (0x000F8000)
+ #define DDRDATA6CH0_CR_RXTRAINRANK0_RxEq_MAX (0x0000001F)
+ #define DDRDATA6CH0_CR_RXTRAINRANK0_RxDqsNPi_OFF (20)
+ #define DDRDATA6CH0_CR_RXTRAINRANK0_RxDqsNPi_WID ( 6)
+ #define DDRDATA6CH0_CR_RXTRAINRANK0_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA6CH0_CR_RXTRAINRANK0_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA6CH0_CR_RXTRAINRANK0_RxVref_OFF (26)
+ #define DDRDATA6CH0_CR_RXTRAINRANK0_RxVref_WID ( 6)
+ #define DDRDATA6CH0_CR_RXTRAINRANK0_RxVref_MSK (0xFC000000)
+ #define DDRDATA6CH0_CR_RXTRAINRANK0_RxVref_MAX (0x0000003F)
+
+#define DDRDATA6CH0_CR_RXTRAINRANK1_REG (0x00000C04)
+ #define DDRDATA6CH0_CR_RXTRAINRANK1_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA6CH0_CR_RXTRAINRANK1_RxRcvEnPi_WID ( 9)
+ #define DDRDATA6CH0_CR_RXTRAINRANK1_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA6CH0_CR_RXTRAINRANK1_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA6CH0_CR_RXTRAINRANK1_RxDqsPPi_OFF ( 9)
+ #define DDRDATA6CH0_CR_RXTRAINRANK1_RxDqsPPi_WID ( 6)
+ #define DDRDATA6CH0_CR_RXTRAINRANK1_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA6CH0_CR_RXTRAINRANK1_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA6CH0_CR_RXTRAINRANK1_RxEq_OFF (15)
+ #define DDRDATA6CH0_CR_RXTRAINRANK1_RxEq_WID ( 5)
+ #define DDRDATA6CH0_CR_RXTRAINRANK1_RxEq_MSK (0x000F8000)
+ #define DDRDATA6CH0_CR_RXTRAINRANK1_RxEq_MAX (0x0000001F)
+ #define DDRDATA6CH0_CR_RXTRAINRANK1_RxDqsNPi_OFF (20)
+ #define DDRDATA6CH0_CR_RXTRAINRANK1_RxDqsNPi_WID ( 6)
+ #define DDRDATA6CH0_CR_RXTRAINRANK1_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA6CH0_CR_RXTRAINRANK1_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA6CH0_CR_RXTRAINRANK1_RxVref_OFF (26)
+ #define DDRDATA6CH0_CR_RXTRAINRANK1_RxVref_WID ( 6)
+ #define DDRDATA6CH0_CR_RXTRAINRANK1_RxVref_MSK (0xFC000000)
+ #define DDRDATA6CH0_CR_RXTRAINRANK1_RxVref_MAX (0x0000003F)
+
+#define DDRDATA6CH0_CR_RXTRAINRANK2_REG (0x00000C08)
+ #define DDRDATA6CH0_CR_RXTRAINRANK2_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA6CH0_CR_RXTRAINRANK2_RxRcvEnPi_WID ( 9)
+ #define DDRDATA6CH0_CR_RXTRAINRANK2_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA6CH0_CR_RXTRAINRANK2_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA6CH0_CR_RXTRAINRANK2_RxDqsPPi_OFF ( 9)
+ #define DDRDATA6CH0_CR_RXTRAINRANK2_RxDqsPPi_WID ( 6)
+ #define DDRDATA6CH0_CR_RXTRAINRANK2_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA6CH0_CR_RXTRAINRANK2_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA6CH0_CR_RXTRAINRANK2_RxEq_OFF (15)
+ #define DDRDATA6CH0_CR_RXTRAINRANK2_RxEq_WID ( 5)
+ #define DDRDATA6CH0_CR_RXTRAINRANK2_RxEq_MSK (0x000F8000)
+ #define DDRDATA6CH0_CR_RXTRAINRANK2_RxEq_MAX (0x0000001F)
+ #define DDRDATA6CH0_CR_RXTRAINRANK2_RxDqsNPi_OFF (20)
+ #define DDRDATA6CH0_CR_RXTRAINRANK2_RxDqsNPi_WID ( 6)
+ #define DDRDATA6CH0_CR_RXTRAINRANK2_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA6CH0_CR_RXTRAINRANK2_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA6CH0_CR_RXTRAINRANK2_RxVref_OFF (26)
+ #define DDRDATA6CH0_CR_RXTRAINRANK2_RxVref_WID ( 6)
+ #define DDRDATA6CH0_CR_RXTRAINRANK2_RxVref_MSK (0xFC000000)
+ #define DDRDATA6CH0_CR_RXTRAINRANK2_RxVref_MAX (0x0000003F)
+
+#define DDRDATA6CH0_CR_RXTRAINRANK3_REG (0x00000C0C)
+ #define DDRDATA6CH0_CR_RXTRAINRANK3_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA6CH0_CR_RXTRAINRANK3_RxRcvEnPi_WID ( 9)
+ #define DDRDATA6CH0_CR_RXTRAINRANK3_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA6CH0_CR_RXTRAINRANK3_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA6CH0_CR_RXTRAINRANK3_RxDqsPPi_OFF ( 9)
+ #define DDRDATA6CH0_CR_RXTRAINRANK3_RxDqsPPi_WID ( 6)
+ #define DDRDATA6CH0_CR_RXTRAINRANK3_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA6CH0_CR_RXTRAINRANK3_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA6CH0_CR_RXTRAINRANK3_RxEq_OFF (15)
+ #define DDRDATA6CH0_CR_RXTRAINRANK3_RxEq_WID ( 5)
+ #define DDRDATA6CH0_CR_RXTRAINRANK3_RxEq_MSK (0x000F8000)
+ #define DDRDATA6CH0_CR_RXTRAINRANK3_RxEq_MAX (0x0000001F)
+ #define DDRDATA6CH0_CR_RXTRAINRANK3_RxDqsNPi_OFF (20)
+ #define DDRDATA6CH0_CR_RXTRAINRANK3_RxDqsNPi_WID ( 6)
+ #define DDRDATA6CH0_CR_RXTRAINRANK3_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA6CH0_CR_RXTRAINRANK3_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA6CH0_CR_RXTRAINRANK3_RxVref_OFF (26)
+ #define DDRDATA6CH0_CR_RXTRAINRANK3_RxVref_WID ( 6)
+ #define DDRDATA6CH0_CR_RXTRAINRANK3_RxVref_MSK (0xFC000000)
+ #define DDRDATA6CH0_CR_RXTRAINRANK3_RxVref_MAX (0x0000003F)
+
+#define DDRDATA6CH0_CR_RXPERBITRANK0_REG (0x00000C10)
+ #define DDRDATA6CH0_CR_RXPERBITRANK0_Lane0_OFF ( 0)
+ #define DDRDATA6CH0_CR_RXPERBITRANK0_Lane0_WID ( 4)
+ #define DDRDATA6CH0_CR_RXPERBITRANK0_Lane0_MSK (0x0000000F)
+ #define DDRDATA6CH0_CR_RXPERBITRANK0_Lane0_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_RXPERBITRANK0_Lane1_OFF ( 4)
+ #define DDRDATA6CH0_CR_RXPERBITRANK0_Lane1_WID ( 4)
+ #define DDRDATA6CH0_CR_RXPERBITRANK0_Lane1_MSK (0x000000F0)
+ #define DDRDATA6CH0_CR_RXPERBITRANK0_Lane1_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_RXPERBITRANK0_Lane2_OFF ( 8)
+ #define DDRDATA6CH0_CR_RXPERBITRANK0_Lane2_WID ( 4)
+ #define DDRDATA6CH0_CR_RXPERBITRANK0_Lane2_MSK (0x00000F00)
+ #define DDRDATA6CH0_CR_RXPERBITRANK0_Lane2_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_RXPERBITRANK0_Lane3_OFF (12)
+ #define DDRDATA6CH0_CR_RXPERBITRANK0_Lane3_WID ( 4)
+ #define DDRDATA6CH0_CR_RXPERBITRANK0_Lane3_MSK (0x0000F000)
+ #define DDRDATA6CH0_CR_RXPERBITRANK0_Lane3_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_RXPERBITRANK0_Lane4_OFF (16)
+ #define DDRDATA6CH0_CR_RXPERBITRANK0_Lane4_WID ( 4)
+ #define DDRDATA6CH0_CR_RXPERBITRANK0_Lane4_MSK (0x000F0000)
+ #define DDRDATA6CH0_CR_RXPERBITRANK0_Lane4_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_RXPERBITRANK0_Lane5_OFF (20)
+ #define DDRDATA6CH0_CR_RXPERBITRANK0_Lane5_WID ( 4)
+ #define DDRDATA6CH0_CR_RXPERBITRANK0_Lane5_MSK (0x00F00000)
+ #define DDRDATA6CH0_CR_RXPERBITRANK0_Lane5_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_RXPERBITRANK0_Lane6_OFF (24)
+ #define DDRDATA6CH0_CR_RXPERBITRANK0_Lane6_WID ( 4)
+ #define DDRDATA6CH0_CR_RXPERBITRANK0_Lane6_MSK (0x0F000000)
+ #define DDRDATA6CH0_CR_RXPERBITRANK0_Lane6_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_RXPERBITRANK0_Lane7_OFF (28)
+ #define DDRDATA6CH0_CR_RXPERBITRANK0_Lane7_WID ( 4)
+ #define DDRDATA6CH0_CR_RXPERBITRANK0_Lane7_MSK (0xF0000000)
+ #define DDRDATA6CH0_CR_RXPERBITRANK0_Lane7_MAX (0x0000000F)
+
+#define DDRDATA6CH0_CR_RXPERBITRANK1_REG (0x00000C14)
+ #define DDRDATA6CH0_CR_RXPERBITRANK1_Lane0_OFF ( 0)
+ #define DDRDATA6CH0_CR_RXPERBITRANK1_Lane0_WID ( 4)
+ #define DDRDATA6CH0_CR_RXPERBITRANK1_Lane0_MSK (0x0000000F)
+ #define DDRDATA6CH0_CR_RXPERBITRANK1_Lane0_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_RXPERBITRANK1_Lane1_OFF ( 4)
+ #define DDRDATA6CH0_CR_RXPERBITRANK1_Lane1_WID ( 4)
+ #define DDRDATA6CH0_CR_RXPERBITRANK1_Lane1_MSK (0x000000F0)
+ #define DDRDATA6CH0_CR_RXPERBITRANK1_Lane1_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_RXPERBITRANK1_Lane2_OFF ( 8)
+ #define DDRDATA6CH0_CR_RXPERBITRANK1_Lane2_WID ( 4)
+ #define DDRDATA6CH0_CR_RXPERBITRANK1_Lane2_MSK (0x00000F00)
+ #define DDRDATA6CH0_CR_RXPERBITRANK1_Lane2_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_RXPERBITRANK1_Lane3_OFF (12)
+ #define DDRDATA6CH0_CR_RXPERBITRANK1_Lane3_WID ( 4)
+ #define DDRDATA6CH0_CR_RXPERBITRANK1_Lane3_MSK (0x0000F000)
+ #define DDRDATA6CH0_CR_RXPERBITRANK1_Lane3_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_RXPERBITRANK1_Lane4_OFF (16)
+ #define DDRDATA6CH0_CR_RXPERBITRANK1_Lane4_WID ( 4)
+ #define DDRDATA6CH0_CR_RXPERBITRANK1_Lane4_MSK (0x000F0000)
+ #define DDRDATA6CH0_CR_RXPERBITRANK1_Lane4_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_RXPERBITRANK1_Lane5_OFF (20)
+ #define DDRDATA6CH0_CR_RXPERBITRANK1_Lane5_WID ( 4)
+ #define DDRDATA6CH0_CR_RXPERBITRANK1_Lane5_MSK (0x00F00000)
+ #define DDRDATA6CH0_CR_RXPERBITRANK1_Lane5_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_RXPERBITRANK1_Lane6_OFF (24)
+ #define DDRDATA6CH0_CR_RXPERBITRANK1_Lane6_WID ( 4)
+ #define DDRDATA6CH0_CR_RXPERBITRANK1_Lane6_MSK (0x0F000000)
+ #define DDRDATA6CH0_CR_RXPERBITRANK1_Lane6_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_RXPERBITRANK1_Lane7_OFF (28)
+ #define DDRDATA6CH0_CR_RXPERBITRANK1_Lane7_WID ( 4)
+ #define DDRDATA6CH0_CR_RXPERBITRANK1_Lane7_MSK (0xF0000000)
+ #define DDRDATA6CH0_CR_RXPERBITRANK1_Lane7_MAX (0x0000000F)
+
+#define DDRDATA6CH0_CR_RXPERBITRANK2_REG (0x00000C18)
+ #define DDRDATA6CH0_CR_RXPERBITRANK2_Lane0_OFF ( 0)
+ #define DDRDATA6CH0_CR_RXPERBITRANK2_Lane0_WID ( 4)
+ #define DDRDATA6CH0_CR_RXPERBITRANK2_Lane0_MSK (0x0000000F)
+ #define DDRDATA6CH0_CR_RXPERBITRANK2_Lane0_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_RXPERBITRANK2_Lane1_OFF ( 4)
+ #define DDRDATA6CH0_CR_RXPERBITRANK2_Lane1_WID ( 4)
+ #define DDRDATA6CH0_CR_RXPERBITRANK2_Lane1_MSK (0x000000F0)
+ #define DDRDATA6CH0_CR_RXPERBITRANK2_Lane1_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_RXPERBITRANK2_Lane2_OFF ( 8)
+ #define DDRDATA6CH0_CR_RXPERBITRANK2_Lane2_WID ( 4)
+ #define DDRDATA6CH0_CR_RXPERBITRANK2_Lane2_MSK (0x00000F00)
+ #define DDRDATA6CH0_CR_RXPERBITRANK2_Lane2_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_RXPERBITRANK2_Lane3_OFF (12)
+ #define DDRDATA6CH0_CR_RXPERBITRANK2_Lane3_WID ( 4)
+ #define DDRDATA6CH0_CR_RXPERBITRANK2_Lane3_MSK (0x0000F000)
+ #define DDRDATA6CH0_CR_RXPERBITRANK2_Lane3_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_RXPERBITRANK2_Lane4_OFF (16)
+ #define DDRDATA6CH0_CR_RXPERBITRANK2_Lane4_WID ( 4)
+ #define DDRDATA6CH0_CR_RXPERBITRANK2_Lane4_MSK (0x000F0000)
+ #define DDRDATA6CH0_CR_RXPERBITRANK2_Lane4_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_RXPERBITRANK2_Lane5_OFF (20)
+ #define DDRDATA6CH0_CR_RXPERBITRANK2_Lane5_WID ( 4)
+ #define DDRDATA6CH0_CR_RXPERBITRANK2_Lane5_MSK (0x00F00000)
+ #define DDRDATA6CH0_CR_RXPERBITRANK2_Lane5_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_RXPERBITRANK2_Lane6_OFF (24)
+ #define DDRDATA6CH0_CR_RXPERBITRANK2_Lane6_WID ( 4)
+ #define DDRDATA6CH0_CR_RXPERBITRANK2_Lane6_MSK (0x0F000000)
+ #define DDRDATA6CH0_CR_RXPERBITRANK2_Lane6_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_RXPERBITRANK2_Lane7_OFF (28)
+ #define DDRDATA6CH0_CR_RXPERBITRANK2_Lane7_WID ( 4)
+ #define DDRDATA6CH0_CR_RXPERBITRANK2_Lane7_MSK (0xF0000000)
+ #define DDRDATA6CH0_CR_RXPERBITRANK2_Lane7_MAX (0x0000000F)
+
+#define DDRDATA6CH0_CR_RXPERBITRANK3_REG (0x00000C1C)
+ #define DDRDATA6CH0_CR_RXPERBITRANK3_Lane0_OFF ( 0)
+ #define DDRDATA6CH0_CR_RXPERBITRANK3_Lane0_WID ( 4)
+ #define DDRDATA6CH0_CR_RXPERBITRANK3_Lane0_MSK (0x0000000F)
+ #define DDRDATA6CH0_CR_RXPERBITRANK3_Lane0_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_RXPERBITRANK3_Lane1_OFF ( 4)
+ #define DDRDATA6CH0_CR_RXPERBITRANK3_Lane1_WID ( 4)
+ #define DDRDATA6CH0_CR_RXPERBITRANK3_Lane1_MSK (0x000000F0)
+ #define DDRDATA6CH0_CR_RXPERBITRANK3_Lane1_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_RXPERBITRANK3_Lane2_OFF ( 8)
+ #define DDRDATA6CH0_CR_RXPERBITRANK3_Lane2_WID ( 4)
+ #define DDRDATA6CH0_CR_RXPERBITRANK3_Lane2_MSK (0x00000F00)
+ #define DDRDATA6CH0_CR_RXPERBITRANK3_Lane2_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_RXPERBITRANK3_Lane3_OFF (12)
+ #define DDRDATA6CH0_CR_RXPERBITRANK3_Lane3_WID ( 4)
+ #define DDRDATA6CH0_CR_RXPERBITRANK3_Lane3_MSK (0x0000F000)
+ #define DDRDATA6CH0_CR_RXPERBITRANK3_Lane3_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_RXPERBITRANK3_Lane4_OFF (16)
+ #define DDRDATA6CH0_CR_RXPERBITRANK3_Lane4_WID ( 4)
+ #define DDRDATA6CH0_CR_RXPERBITRANK3_Lane4_MSK (0x000F0000)
+ #define DDRDATA6CH0_CR_RXPERBITRANK3_Lane4_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_RXPERBITRANK3_Lane5_OFF (20)
+ #define DDRDATA6CH0_CR_RXPERBITRANK3_Lane5_WID ( 4)
+ #define DDRDATA6CH0_CR_RXPERBITRANK3_Lane5_MSK (0x00F00000)
+ #define DDRDATA6CH0_CR_RXPERBITRANK3_Lane5_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_RXPERBITRANK3_Lane6_OFF (24)
+ #define DDRDATA6CH0_CR_RXPERBITRANK3_Lane6_WID ( 4)
+ #define DDRDATA6CH0_CR_RXPERBITRANK3_Lane6_MSK (0x0F000000)
+ #define DDRDATA6CH0_CR_RXPERBITRANK3_Lane6_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_RXPERBITRANK3_Lane7_OFF (28)
+ #define DDRDATA6CH0_CR_RXPERBITRANK3_Lane7_WID ( 4)
+ #define DDRDATA6CH0_CR_RXPERBITRANK3_Lane7_MSK (0xF0000000)
+ #define DDRDATA6CH0_CR_RXPERBITRANK3_Lane7_MAX (0x0000000F)
+
+#define DDRDATA6CH0_CR_TXTRAINRANK0_REG (0x00000C20)
+ #define DDRDATA6CH0_CR_TXTRAINRANK0_TxDqDelay_OFF ( 0)
+ #define DDRDATA6CH0_CR_TXTRAINRANK0_TxDqDelay_WID ( 9)
+ #define DDRDATA6CH0_CR_TXTRAINRANK0_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA6CH0_CR_TXTRAINRANK0_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA6CH0_CR_TXTRAINRANK0_TxDqsDelay_OFF ( 9)
+ #define DDRDATA6CH0_CR_TXTRAINRANK0_TxDqsDelay_WID ( 9)
+ #define DDRDATA6CH0_CR_TXTRAINRANK0_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA6CH0_CR_TXTRAINRANK0_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA6CH0_CR_TXTRAINRANK0_Spare0_OFF (18)
+ #define DDRDATA6CH0_CR_TXTRAINRANK0_Spare0_WID ( 2)
+ #define DDRDATA6CH0_CR_TXTRAINRANK0_Spare0_MSK (0x000C0000)
+ #define DDRDATA6CH0_CR_TXTRAINRANK0_Spare0_MAX (0x00000003)
+ #define DDRDATA6CH0_CR_TXTRAINRANK0_TxEqualization_OFF (20)
+ #define DDRDATA6CH0_CR_TXTRAINRANK0_TxEqualization_WID ( 6)
+ #define DDRDATA6CH0_CR_TXTRAINRANK0_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA6CH0_CR_TXTRAINRANK0_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA6CH0_CR_TXTRAINRANK0_Spare1_OFF (26)
+ #define DDRDATA6CH0_CR_TXTRAINRANK0_Spare1_WID ( 6)
+ #define DDRDATA6CH0_CR_TXTRAINRANK0_Spare1_MSK (0xFC000000)
+ #define DDRDATA6CH0_CR_TXTRAINRANK0_Spare1_MAX (0x0000003F)
+
+#define DDRDATA6CH0_CR_TXTRAINRANK1_REG (0x00000C24)
+ #define DDRDATA6CH0_CR_TXTRAINRANK1_TxDqDelay_OFF ( 0)
+ #define DDRDATA6CH0_CR_TXTRAINRANK1_TxDqDelay_WID ( 9)
+ #define DDRDATA6CH0_CR_TXTRAINRANK1_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA6CH0_CR_TXTRAINRANK1_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA6CH0_CR_TXTRAINRANK1_TxDqsDelay_OFF ( 9)
+ #define DDRDATA6CH0_CR_TXTRAINRANK1_TxDqsDelay_WID ( 9)
+ #define DDRDATA6CH0_CR_TXTRAINRANK1_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA6CH0_CR_TXTRAINRANK1_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA6CH0_CR_TXTRAINRANK1_Spare0_OFF (18)
+ #define DDRDATA6CH0_CR_TXTRAINRANK1_Spare0_WID ( 2)
+ #define DDRDATA6CH0_CR_TXTRAINRANK1_Spare0_MSK (0x000C0000)
+ #define DDRDATA6CH0_CR_TXTRAINRANK1_Spare0_MAX (0x00000003)
+ #define DDRDATA6CH0_CR_TXTRAINRANK1_TxEqualization_OFF (20)
+ #define DDRDATA6CH0_CR_TXTRAINRANK1_TxEqualization_WID ( 6)
+ #define DDRDATA6CH0_CR_TXTRAINRANK1_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA6CH0_CR_TXTRAINRANK1_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA6CH0_CR_TXTRAINRANK1_Spare1_OFF (26)
+ #define DDRDATA6CH0_CR_TXTRAINRANK1_Spare1_WID ( 6)
+ #define DDRDATA6CH0_CR_TXTRAINRANK1_Spare1_MSK (0xFC000000)
+ #define DDRDATA6CH0_CR_TXTRAINRANK1_Spare1_MAX (0x0000003F)
+
+#define DDRDATA6CH0_CR_TXTRAINRANK2_REG (0x00000C28)
+ #define DDRDATA6CH0_CR_TXTRAINRANK2_TxDqDelay_OFF ( 0)
+ #define DDRDATA6CH0_CR_TXTRAINRANK2_TxDqDelay_WID ( 9)
+ #define DDRDATA6CH0_CR_TXTRAINRANK2_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA6CH0_CR_TXTRAINRANK2_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA6CH0_CR_TXTRAINRANK2_TxDqsDelay_OFF ( 9)
+ #define DDRDATA6CH0_CR_TXTRAINRANK2_TxDqsDelay_WID ( 9)
+ #define DDRDATA6CH0_CR_TXTRAINRANK2_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA6CH0_CR_TXTRAINRANK2_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA6CH0_CR_TXTRAINRANK2_Spare0_OFF (18)
+ #define DDRDATA6CH0_CR_TXTRAINRANK2_Spare0_WID ( 2)
+ #define DDRDATA6CH0_CR_TXTRAINRANK2_Spare0_MSK (0x000C0000)
+ #define DDRDATA6CH0_CR_TXTRAINRANK2_Spare0_MAX (0x00000003)
+ #define DDRDATA6CH0_CR_TXTRAINRANK2_TxEqualization_OFF (20)
+ #define DDRDATA6CH0_CR_TXTRAINRANK2_TxEqualization_WID ( 6)
+ #define DDRDATA6CH0_CR_TXTRAINRANK2_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA6CH0_CR_TXTRAINRANK2_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA6CH0_CR_TXTRAINRANK2_Spare1_OFF (26)
+ #define DDRDATA6CH0_CR_TXTRAINRANK2_Spare1_WID ( 6)
+ #define DDRDATA6CH0_CR_TXTRAINRANK2_Spare1_MSK (0xFC000000)
+ #define DDRDATA6CH0_CR_TXTRAINRANK2_Spare1_MAX (0x0000003F)
+
+#define DDRDATA6CH0_CR_TXTRAINRANK3_REG (0x00000C2C)
+ #define DDRDATA6CH0_CR_TXTRAINRANK3_TxDqDelay_OFF ( 0)
+ #define DDRDATA6CH0_CR_TXTRAINRANK3_TxDqDelay_WID ( 9)
+ #define DDRDATA6CH0_CR_TXTRAINRANK3_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA6CH0_CR_TXTRAINRANK3_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA6CH0_CR_TXTRAINRANK3_TxDqsDelay_OFF ( 9)
+ #define DDRDATA6CH0_CR_TXTRAINRANK3_TxDqsDelay_WID ( 9)
+ #define DDRDATA6CH0_CR_TXTRAINRANK3_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA6CH0_CR_TXTRAINRANK3_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA6CH0_CR_TXTRAINRANK3_Spare0_OFF (18)
+ #define DDRDATA6CH0_CR_TXTRAINRANK3_Spare0_WID ( 2)
+ #define DDRDATA6CH0_CR_TXTRAINRANK3_Spare0_MSK (0x000C0000)
+ #define DDRDATA6CH0_CR_TXTRAINRANK3_Spare0_MAX (0x00000003)
+ #define DDRDATA6CH0_CR_TXTRAINRANK3_TxEqualization_OFF (20)
+ #define DDRDATA6CH0_CR_TXTRAINRANK3_TxEqualization_WID ( 6)
+ #define DDRDATA6CH0_CR_TXTRAINRANK3_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA6CH0_CR_TXTRAINRANK3_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA6CH0_CR_TXTRAINRANK3_Spare1_OFF (26)
+ #define DDRDATA6CH0_CR_TXTRAINRANK3_Spare1_WID ( 6)
+ #define DDRDATA6CH0_CR_TXTRAINRANK3_Spare1_MSK (0xFC000000)
+ #define DDRDATA6CH0_CR_TXTRAINRANK3_Spare1_MAX (0x0000003F)
+
+#define DDRDATA6CH0_CR_TXPERBITRANK0_REG (0x00000C30)
+ #define DDRDATA6CH0_CR_TXPERBITRANK0_Lane0_OFF ( 0)
+ #define DDRDATA6CH0_CR_TXPERBITRANK0_Lane0_WID ( 4)
+ #define DDRDATA6CH0_CR_TXPERBITRANK0_Lane0_MSK (0x0000000F)
+ #define DDRDATA6CH0_CR_TXPERBITRANK0_Lane0_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_TXPERBITRANK0_Lane1_OFF ( 4)
+ #define DDRDATA6CH0_CR_TXPERBITRANK0_Lane1_WID ( 4)
+ #define DDRDATA6CH0_CR_TXPERBITRANK0_Lane1_MSK (0x000000F0)
+ #define DDRDATA6CH0_CR_TXPERBITRANK0_Lane1_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_TXPERBITRANK0_Lane2_OFF ( 8)
+ #define DDRDATA6CH0_CR_TXPERBITRANK0_Lane2_WID ( 4)
+ #define DDRDATA6CH0_CR_TXPERBITRANK0_Lane2_MSK (0x00000F00)
+ #define DDRDATA6CH0_CR_TXPERBITRANK0_Lane2_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_TXPERBITRANK0_Lane3_OFF (12)
+ #define DDRDATA6CH0_CR_TXPERBITRANK0_Lane3_WID ( 4)
+ #define DDRDATA6CH0_CR_TXPERBITRANK0_Lane3_MSK (0x0000F000)
+ #define DDRDATA6CH0_CR_TXPERBITRANK0_Lane3_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_TXPERBITRANK0_Lane4_OFF (16)
+ #define DDRDATA6CH0_CR_TXPERBITRANK0_Lane4_WID ( 4)
+ #define DDRDATA6CH0_CR_TXPERBITRANK0_Lane4_MSK (0x000F0000)
+ #define DDRDATA6CH0_CR_TXPERBITRANK0_Lane4_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_TXPERBITRANK0_Lane5_OFF (20)
+ #define DDRDATA6CH0_CR_TXPERBITRANK0_Lane5_WID ( 4)
+ #define DDRDATA6CH0_CR_TXPERBITRANK0_Lane5_MSK (0x00F00000)
+ #define DDRDATA6CH0_CR_TXPERBITRANK0_Lane5_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_TXPERBITRANK0_Lane6_OFF (24)
+ #define DDRDATA6CH0_CR_TXPERBITRANK0_Lane6_WID ( 4)
+ #define DDRDATA6CH0_CR_TXPERBITRANK0_Lane6_MSK (0x0F000000)
+ #define DDRDATA6CH0_CR_TXPERBITRANK0_Lane6_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_TXPERBITRANK0_Lane7_OFF (28)
+ #define DDRDATA6CH0_CR_TXPERBITRANK0_Lane7_WID ( 4)
+ #define DDRDATA6CH0_CR_TXPERBITRANK0_Lane7_MSK (0xF0000000)
+ #define DDRDATA6CH0_CR_TXPERBITRANK0_Lane7_MAX (0x0000000F)
+
+#define DDRDATA6CH0_CR_TXPERBITRANK1_REG (0x00000C34)
+ #define DDRDATA6CH0_CR_TXPERBITRANK1_Lane0_OFF ( 0)
+ #define DDRDATA6CH0_CR_TXPERBITRANK1_Lane0_WID ( 4)
+ #define DDRDATA6CH0_CR_TXPERBITRANK1_Lane0_MSK (0x0000000F)
+ #define DDRDATA6CH0_CR_TXPERBITRANK1_Lane0_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_TXPERBITRANK1_Lane1_OFF ( 4)
+ #define DDRDATA6CH0_CR_TXPERBITRANK1_Lane1_WID ( 4)
+ #define DDRDATA6CH0_CR_TXPERBITRANK1_Lane1_MSK (0x000000F0)
+ #define DDRDATA6CH0_CR_TXPERBITRANK1_Lane1_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_TXPERBITRANK1_Lane2_OFF ( 8)
+ #define DDRDATA6CH0_CR_TXPERBITRANK1_Lane2_WID ( 4)
+ #define DDRDATA6CH0_CR_TXPERBITRANK1_Lane2_MSK (0x00000F00)
+ #define DDRDATA6CH0_CR_TXPERBITRANK1_Lane2_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_TXPERBITRANK1_Lane3_OFF (12)
+ #define DDRDATA6CH0_CR_TXPERBITRANK1_Lane3_WID ( 4)
+ #define DDRDATA6CH0_CR_TXPERBITRANK1_Lane3_MSK (0x0000F000)
+ #define DDRDATA6CH0_CR_TXPERBITRANK1_Lane3_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_TXPERBITRANK1_Lane4_OFF (16)
+ #define DDRDATA6CH0_CR_TXPERBITRANK1_Lane4_WID ( 4)
+ #define DDRDATA6CH0_CR_TXPERBITRANK1_Lane4_MSK (0x000F0000)
+ #define DDRDATA6CH0_CR_TXPERBITRANK1_Lane4_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_TXPERBITRANK1_Lane5_OFF (20)
+ #define DDRDATA6CH0_CR_TXPERBITRANK1_Lane5_WID ( 4)
+ #define DDRDATA6CH0_CR_TXPERBITRANK1_Lane5_MSK (0x00F00000)
+ #define DDRDATA6CH0_CR_TXPERBITRANK1_Lane5_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_TXPERBITRANK1_Lane6_OFF (24)
+ #define DDRDATA6CH0_CR_TXPERBITRANK1_Lane6_WID ( 4)
+ #define DDRDATA6CH0_CR_TXPERBITRANK1_Lane6_MSK (0x0F000000)
+ #define DDRDATA6CH0_CR_TXPERBITRANK1_Lane6_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_TXPERBITRANK1_Lane7_OFF (28)
+ #define DDRDATA6CH0_CR_TXPERBITRANK1_Lane7_WID ( 4)
+ #define DDRDATA6CH0_CR_TXPERBITRANK1_Lane7_MSK (0xF0000000)
+ #define DDRDATA6CH0_CR_TXPERBITRANK1_Lane7_MAX (0x0000000F)
+
+#define DDRDATA6CH0_CR_TXPERBITRANK2_REG (0x00000C38)
+ #define DDRDATA6CH0_CR_TXPERBITRANK2_Lane0_OFF ( 0)
+ #define DDRDATA6CH0_CR_TXPERBITRANK2_Lane0_WID ( 4)
+ #define DDRDATA6CH0_CR_TXPERBITRANK2_Lane0_MSK (0x0000000F)
+ #define DDRDATA6CH0_CR_TXPERBITRANK2_Lane0_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_TXPERBITRANK2_Lane1_OFF ( 4)
+ #define DDRDATA6CH0_CR_TXPERBITRANK2_Lane1_WID ( 4)
+ #define DDRDATA6CH0_CR_TXPERBITRANK2_Lane1_MSK (0x000000F0)
+ #define DDRDATA6CH0_CR_TXPERBITRANK2_Lane1_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_TXPERBITRANK2_Lane2_OFF ( 8)
+ #define DDRDATA6CH0_CR_TXPERBITRANK2_Lane2_WID ( 4)
+ #define DDRDATA6CH0_CR_TXPERBITRANK2_Lane2_MSK (0x00000F00)
+ #define DDRDATA6CH0_CR_TXPERBITRANK2_Lane2_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_TXPERBITRANK2_Lane3_OFF (12)
+ #define DDRDATA6CH0_CR_TXPERBITRANK2_Lane3_WID ( 4)
+ #define DDRDATA6CH0_CR_TXPERBITRANK2_Lane3_MSK (0x0000F000)
+ #define DDRDATA6CH0_CR_TXPERBITRANK2_Lane3_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_TXPERBITRANK2_Lane4_OFF (16)
+ #define DDRDATA6CH0_CR_TXPERBITRANK2_Lane4_WID ( 4)
+ #define DDRDATA6CH0_CR_TXPERBITRANK2_Lane4_MSK (0x000F0000)
+ #define DDRDATA6CH0_CR_TXPERBITRANK2_Lane4_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_TXPERBITRANK2_Lane5_OFF (20)
+ #define DDRDATA6CH0_CR_TXPERBITRANK2_Lane5_WID ( 4)
+ #define DDRDATA6CH0_CR_TXPERBITRANK2_Lane5_MSK (0x00F00000)
+ #define DDRDATA6CH0_CR_TXPERBITRANK2_Lane5_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_TXPERBITRANK2_Lane6_OFF (24)
+ #define DDRDATA6CH0_CR_TXPERBITRANK2_Lane6_WID ( 4)
+ #define DDRDATA6CH0_CR_TXPERBITRANK2_Lane6_MSK (0x0F000000)
+ #define DDRDATA6CH0_CR_TXPERBITRANK2_Lane6_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_TXPERBITRANK2_Lane7_OFF (28)
+ #define DDRDATA6CH0_CR_TXPERBITRANK2_Lane7_WID ( 4)
+ #define DDRDATA6CH0_CR_TXPERBITRANK2_Lane7_MSK (0xF0000000)
+ #define DDRDATA6CH0_CR_TXPERBITRANK2_Lane7_MAX (0x0000000F)
+
+#define DDRDATA6CH0_CR_TXPERBITRANK3_REG (0x00000C3C)
+ #define DDRDATA6CH0_CR_TXPERBITRANK3_Lane0_OFF ( 0)
+ #define DDRDATA6CH0_CR_TXPERBITRANK3_Lane0_WID ( 4)
+ #define DDRDATA6CH0_CR_TXPERBITRANK3_Lane0_MSK (0x0000000F)
+ #define DDRDATA6CH0_CR_TXPERBITRANK3_Lane0_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_TXPERBITRANK3_Lane1_OFF ( 4)
+ #define DDRDATA6CH0_CR_TXPERBITRANK3_Lane1_WID ( 4)
+ #define DDRDATA6CH0_CR_TXPERBITRANK3_Lane1_MSK (0x000000F0)
+ #define DDRDATA6CH0_CR_TXPERBITRANK3_Lane1_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_TXPERBITRANK3_Lane2_OFF ( 8)
+ #define DDRDATA6CH0_CR_TXPERBITRANK3_Lane2_WID ( 4)
+ #define DDRDATA6CH0_CR_TXPERBITRANK3_Lane2_MSK (0x00000F00)
+ #define DDRDATA6CH0_CR_TXPERBITRANK3_Lane2_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_TXPERBITRANK3_Lane3_OFF (12)
+ #define DDRDATA6CH0_CR_TXPERBITRANK3_Lane3_WID ( 4)
+ #define DDRDATA6CH0_CR_TXPERBITRANK3_Lane3_MSK (0x0000F000)
+ #define DDRDATA6CH0_CR_TXPERBITRANK3_Lane3_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_TXPERBITRANK3_Lane4_OFF (16)
+ #define DDRDATA6CH0_CR_TXPERBITRANK3_Lane4_WID ( 4)
+ #define DDRDATA6CH0_CR_TXPERBITRANK3_Lane4_MSK (0x000F0000)
+ #define DDRDATA6CH0_CR_TXPERBITRANK3_Lane4_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_TXPERBITRANK3_Lane5_OFF (20)
+ #define DDRDATA6CH0_CR_TXPERBITRANK3_Lane5_WID ( 4)
+ #define DDRDATA6CH0_CR_TXPERBITRANK3_Lane5_MSK (0x00F00000)
+ #define DDRDATA6CH0_CR_TXPERBITRANK3_Lane5_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_TXPERBITRANK3_Lane6_OFF (24)
+ #define DDRDATA6CH0_CR_TXPERBITRANK3_Lane6_WID ( 4)
+ #define DDRDATA6CH0_CR_TXPERBITRANK3_Lane6_MSK (0x0F000000)
+ #define DDRDATA6CH0_CR_TXPERBITRANK3_Lane6_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_TXPERBITRANK3_Lane7_OFF (28)
+ #define DDRDATA6CH0_CR_TXPERBITRANK3_Lane7_WID ( 4)
+ #define DDRDATA6CH0_CR_TXPERBITRANK3_Lane7_MSK (0xF0000000)
+ #define DDRDATA6CH0_CR_TXPERBITRANK3_Lane7_MAX (0x0000000F)
+
+#define DDRDATA6CH0_CR_RCOMPDATA0_REG (0x00000C40)
+ #define DDRDATA6CH0_CR_RCOMPDATA0_RcompDrvUp_OFF ( 0)
+ #define DDRDATA6CH0_CR_RCOMPDATA0_RcompDrvUp_WID ( 6)
+ #define DDRDATA6CH0_CR_RCOMPDATA0_RcompDrvUp_MSK (0x0000003F)
+ #define DDRDATA6CH0_CR_RCOMPDATA0_RcompDrvUp_MAX (0x0000003F)
+ #define DDRDATA6CH0_CR_RCOMPDATA0_Spare0_OFF ( 6)
+ #define DDRDATA6CH0_CR_RCOMPDATA0_Spare0_WID ( 3)
+ #define DDRDATA6CH0_CR_RCOMPDATA0_Spare0_MSK (0x000001C0)
+ #define DDRDATA6CH0_CR_RCOMPDATA0_Spare0_MAX (0x00000007)
+ #define DDRDATA6CH0_CR_RCOMPDATA0_RcompDrvDown_OFF ( 9)
+ #define DDRDATA6CH0_CR_RCOMPDATA0_RcompDrvDown_WID ( 6)
+ #define DDRDATA6CH0_CR_RCOMPDATA0_RcompDrvDown_MSK (0x00007E00)
+ #define DDRDATA6CH0_CR_RCOMPDATA0_RcompDrvDown_MAX (0x0000003F)
+ #define DDRDATA6CH0_CR_RCOMPDATA0_VTComp_OFF (15)
+ #define DDRDATA6CH0_CR_RCOMPDATA0_VTComp_WID ( 5)
+ #define DDRDATA6CH0_CR_RCOMPDATA0_VTComp_MSK (0x000F8000)
+ #define DDRDATA6CH0_CR_RCOMPDATA0_VTComp_MAX (0x0000001F)
+ #define DDRDATA6CH0_CR_RCOMPDATA0_TcoComp_OFF (20)
+ #define DDRDATA6CH0_CR_RCOMPDATA0_TcoComp_WID ( 6)
+ #define DDRDATA6CH0_CR_RCOMPDATA0_TcoComp_MSK (0x03F00000)
+ #define DDRDATA6CH0_CR_RCOMPDATA0_TcoComp_MAX (0x0000003F)
+ #define DDRDATA6CH0_CR_RCOMPDATA0_SlewRateComp_OFF (26)
+ #define DDRDATA6CH0_CR_RCOMPDATA0_SlewRateComp_WID ( 5)
+ #define DDRDATA6CH0_CR_RCOMPDATA0_SlewRateComp_MSK (0x7C000000)
+ #define DDRDATA6CH0_CR_RCOMPDATA0_SlewRateComp_MAX (0x0000001F)
+ #define DDRDATA6CH0_CR_RCOMPDATA0_Spare2_OFF (31)
+ #define DDRDATA6CH0_CR_RCOMPDATA0_Spare2_WID ( 1)
+ #define DDRDATA6CH0_CR_RCOMPDATA0_Spare2_MSK (0x80000000)
+ #define DDRDATA6CH0_CR_RCOMPDATA0_Spare2_MAX (0x00000001)
+
+#define DDRDATA6CH0_CR_RCOMPDATA1_REG (0x00000C44)
+ #define DDRDATA6CH0_CR_RCOMPDATA1_RcompOdtUp_OFF ( 0)
+ #define DDRDATA6CH0_CR_RCOMPDATA1_RcompOdtUp_WID ( 6)
+ #define DDRDATA6CH0_CR_RCOMPDATA1_RcompOdtUp_MSK (0x0000003F)
+ #define DDRDATA6CH0_CR_RCOMPDATA1_RcompOdtUp_MAX (0x0000003F)
+ #define DDRDATA6CH0_CR_RCOMPDATA1_Spare0_OFF ( 6)
+ #define DDRDATA6CH0_CR_RCOMPDATA1_Spare0_WID ( 3)
+ #define DDRDATA6CH0_CR_RCOMPDATA1_Spare0_MSK (0x000001C0)
+ #define DDRDATA6CH0_CR_RCOMPDATA1_Spare0_MAX (0x00000007)
+ #define DDRDATA6CH0_CR_RCOMPDATA1_RcompOdtDown_OFF ( 9)
+ #define DDRDATA6CH0_CR_RCOMPDATA1_RcompOdtDown_WID ( 6)
+ #define DDRDATA6CH0_CR_RCOMPDATA1_RcompOdtDown_MSK (0x00007E00)
+ #define DDRDATA6CH0_CR_RCOMPDATA1_RcompOdtDown_MAX (0x0000003F)
+ #define DDRDATA6CH0_CR_RCOMPDATA1_Spare1_OFF (15)
+ #define DDRDATA6CH0_CR_RCOMPDATA1_Spare1_WID ( 1)
+ #define DDRDATA6CH0_CR_RCOMPDATA1_Spare1_MSK (0x00008000)
+ #define DDRDATA6CH0_CR_RCOMPDATA1_Spare1_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_RCOMPDATA1_PanicDrvDn_OFF (16)
+ #define DDRDATA6CH0_CR_RCOMPDATA1_PanicDrvDn_WID ( 6)
+ #define DDRDATA6CH0_CR_RCOMPDATA1_PanicDrvDn_MSK (0x003F0000)
+ #define DDRDATA6CH0_CR_RCOMPDATA1_PanicDrvDn_MAX (0x0000003F)
+ #define DDRDATA6CH0_CR_RCOMPDATA1_PanicDrvUp_OFF (22)
+ #define DDRDATA6CH0_CR_RCOMPDATA1_PanicDrvUp_WID ( 6)
+ #define DDRDATA6CH0_CR_RCOMPDATA1_PanicDrvUp_MSK (0x0FC00000)
+ #define DDRDATA6CH0_CR_RCOMPDATA1_PanicDrvUp_MAX (0x0000003F)
+ #define DDRDATA6CH0_CR_RCOMPDATA1_LevelShifterComp_OFF (28)
+ #define DDRDATA6CH0_CR_RCOMPDATA1_LevelShifterComp_WID ( 3)
+ #define DDRDATA6CH0_CR_RCOMPDATA1_LevelShifterComp_MSK (0x70000000)
+ #define DDRDATA6CH0_CR_RCOMPDATA1_LevelShifterComp_MAX (0x00000007)
+ #define DDRDATA6CH0_CR_RCOMPDATA1_Spare2_OFF (31)
+ #define DDRDATA6CH0_CR_RCOMPDATA1_Spare2_WID ( 1)
+ #define DDRDATA6CH0_CR_RCOMPDATA1_Spare2_MSK (0x80000000)
+ #define DDRDATA6CH0_CR_RCOMPDATA1_Spare2_MAX (0x00000001)
+
+#define DDRDATA6CH0_CR_TXXTALK_REG (0x00000C48)
+ #define DDRDATA6CH0_CR_TXXTALK_Lane0_OFF ( 0)
+ #define DDRDATA6CH0_CR_TXXTALK_Lane0_WID ( 4)
+ #define DDRDATA6CH0_CR_TXXTALK_Lane0_MSK (0x0000000F)
+ #define DDRDATA6CH0_CR_TXXTALK_Lane0_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_TXXTALK_Lane1_OFF ( 4)
+ #define DDRDATA6CH0_CR_TXXTALK_Lane1_WID ( 4)
+ #define DDRDATA6CH0_CR_TXXTALK_Lane1_MSK (0x000000F0)
+ #define DDRDATA6CH0_CR_TXXTALK_Lane1_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_TXXTALK_Lane2_OFF ( 8)
+ #define DDRDATA6CH0_CR_TXXTALK_Lane2_WID ( 4)
+ #define DDRDATA6CH0_CR_TXXTALK_Lane2_MSK (0x00000F00)
+ #define DDRDATA6CH0_CR_TXXTALK_Lane2_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_TXXTALK_Lane3_OFF (12)
+ #define DDRDATA6CH0_CR_TXXTALK_Lane3_WID ( 4)
+ #define DDRDATA6CH0_CR_TXXTALK_Lane3_MSK (0x0000F000)
+ #define DDRDATA6CH0_CR_TXXTALK_Lane3_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_TXXTALK_Lane4_OFF (16)
+ #define DDRDATA6CH0_CR_TXXTALK_Lane4_WID ( 4)
+ #define DDRDATA6CH0_CR_TXXTALK_Lane4_MSK (0x000F0000)
+ #define DDRDATA6CH0_CR_TXXTALK_Lane4_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_TXXTALK_Lane5_OFF (20)
+ #define DDRDATA6CH0_CR_TXXTALK_Lane5_WID ( 4)
+ #define DDRDATA6CH0_CR_TXXTALK_Lane5_MSK (0x00F00000)
+ #define DDRDATA6CH0_CR_TXXTALK_Lane5_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_TXXTALK_Lane6_OFF (24)
+ #define DDRDATA6CH0_CR_TXXTALK_Lane6_WID ( 4)
+ #define DDRDATA6CH0_CR_TXXTALK_Lane6_MSK (0x0F000000)
+ #define DDRDATA6CH0_CR_TXXTALK_Lane6_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_TXXTALK_Lane7_OFF (28)
+ #define DDRDATA6CH0_CR_TXXTALK_Lane7_WID ( 4)
+ #define DDRDATA6CH0_CR_TXXTALK_Lane7_MSK (0xF0000000)
+ #define DDRDATA6CH0_CR_TXXTALK_Lane7_MAX (0x0000000F)
+
+#define DDRDATA6CH0_CR_RXOFFSETVDQ_REG (0x00000C4C)
+ #define DDRDATA6CH0_CR_RXOFFSETVDQ_Lane0_OFF ( 0)
+ #define DDRDATA6CH0_CR_RXOFFSETVDQ_Lane0_WID ( 4)
+ #define DDRDATA6CH0_CR_RXOFFSETVDQ_Lane0_MSK (0x0000000F)
+ #define DDRDATA6CH0_CR_RXOFFSETVDQ_Lane0_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_RXOFFSETVDQ_Lane1_OFF ( 4)
+ #define DDRDATA6CH0_CR_RXOFFSETVDQ_Lane1_WID ( 4)
+ #define DDRDATA6CH0_CR_RXOFFSETVDQ_Lane1_MSK (0x000000F0)
+ #define DDRDATA6CH0_CR_RXOFFSETVDQ_Lane1_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_RXOFFSETVDQ_Lane2_OFF ( 8)
+ #define DDRDATA6CH0_CR_RXOFFSETVDQ_Lane2_WID ( 4)
+ #define DDRDATA6CH0_CR_RXOFFSETVDQ_Lane2_MSK (0x00000F00)
+ #define DDRDATA6CH0_CR_RXOFFSETVDQ_Lane2_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_RXOFFSETVDQ_Lane3_OFF (12)
+ #define DDRDATA6CH0_CR_RXOFFSETVDQ_Lane3_WID ( 4)
+ #define DDRDATA6CH0_CR_RXOFFSETVDQ_Lane3_MSK (0x0000F000)
+ #define DDRDATA6CH0_CR_RXOFFSETVDQ_Lane3_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_RXOFFSETVDQ_Lane4_OFF (16)
+ #define DDRDATA6CH0_CR_RXOFFSETVDQ_Lane4_WID ( 4)
+ #define DDRDATA6CH0_CR_RXOFFSETVDQ_Lane4_MSK (0x000F0000)
+ #define DDRDATA6CH0_CR_RXOFFSETVDQ_Lane4_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_RXOFFSETVDQ_Lane5_OFF (20)
+ #define DDRDATA6CH0_CR_RXOFFSETVDQ_Lane5_WID ( 4)
+ #define DDRDATA6CH0_CR_RXOFFSETVDQ_Lane5_MSK (0x00F00000)
+ #define DDRDATA6CH0_CR_RXOFFSETVDQ_Lane5_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_RXOFFSETVDQ_Lane6_OFF (24)
+ #define DDRDATA6CH0_CR_RXOFFSETVDQ_Lane6_WID ( 4)
+ #define DDRDATA6CH0_CR_RXOFFSETVDQ_Lane6_MSK (0x0F000000)
+ #define DDRDATA6CH0_CR_RXOFFSETVDQ_Lane6_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_RXOFFSETVDQ_Lane7_OFF (28)
+ #define DDRDATA6CH0_CR_RXOFFSETVDQ_Lane7_WID ( 4)
+ #define DDRDATA6CH0_CR_RXOFFSETVDQ_Lane7_MSK (0xF0000000)
+ #define DDRDATA6CH0_CR_RXOFFSETVDQ_Lane7_MAX (0x0000000F)
+
+#define DDRDATA6CH0_CR_DDRDATARESERVED_REG (0x00000C50)
+ #define DDRDATA6CH0_CR_DDRDATARESERVED_Spare_OFF ( 0)
+ #define DDRDATA6CH0_CR_DDRDATARESERVED_Spare_WID (32)
+ #define DDRDATA6CH0_CR_DDRDATARESERVED_Spare_MSK (0xFFFFFFFF)
+ #define DDRDATA6CH0_CR_DDRDATARESERVED_Spare_MAX (0xFFFFFFFF)
+
+#define DDRDATA6CH0_CR_DATATRAINFEEDBACK_REG (0x00000C54)
+ #define DDRDATA6CH0_CR_DATATRAINFEEDBACK_DataTrainFeedback_OFF ( 0)
+ #define DDRDATA6CH0_CR_DATATRAINFEEDBACK_DataTrainFeedback_WID ( 9)
+ #define DDRDATA6CH0_CR_DATATRAINFEEDBACK_DataTrainFeedback_MSK (0x000001FF)
+ #define DDRDATA6CH0_CR_DATATRAINFEEDBACK_DataTrainFeedback_MAX (0x000001FF)
+ #define DDRDATA6CH0_CR_DATATRAINFEEDBACK_Spare_OFF ( 9)
+ #define DDRDATA6CH0_CR_DATATRAINFEEDBACK_Spare_WID (23)
+ #define DDRDATA6CH0_CR_DATATRAINFEEDBACK_Spare_MSK (0xFFFFFE00)
+ #define DDRDATA6CH0_CR_DATATRAINFEEDBACK_Spare_MAX (0x007FFFFF)
+
+#define DDRDATA6CH0_CR_DLLPITESTANDADC_REG (0x00000C58)
+ #define DDRDATA6CH0_CR_DLLPITESTANDADC_RunTest_OFF ( 0)
+ #define DDRDATA6CH0_CR_DLLPITESTANDADC_RunTest_WID ( 1)
+ #define DDRDATA6CH0_CR_DLLPITESTANDADC_RunTest_MSK (0x00000001)
+ #define DDRDATA6CH0_CR_DLLPITESTANDADC_RunTest_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DLLPITESTANDADC_RunTest_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DLLPITESTANDADC_Load_OFF ( 1)
+ #define DDRDATA6CH0_CR_DLLPITESTANDADC_Load_WID ( 1)
+ #define DDRDATA6CH0_CR_DLLPITESTANDADC_Load_MSK (0x00000002)
+ #define DDRDATA6CH0_CR_DLLPITESTANDADC_Load_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DLLPITESTANDADC_Load_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DLLPITESTANDADC_ModeHVM_OFF ( 2)
+ #define DDRDATA6CH0_CR_DLLPITESTANDADC_ModeHVM_WID ( 1)
+ #define DDRDATA6CH0_CR_DLLPITESTANDADC_ModeHVM_MSK (0x00000004)
+ #define DDRDATA6CH0_CR_DLLPITESTANDADC_ModeHVM_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DLLPITESTANDADC_ModeHVM_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DLLPITESTANDADC_ModeDV_OFF ( 3)
+ #define DDRDATA6CH0_CR_DLLPITESTANDADC_ModeDV_WID ( 1)
+ #define DDRDATA6CH0_CR_DLLPITESTANDADC_ModeDV_MSK (0x00000008)
+ #define DDRDATA6CH0_CR_DLLPITESTANDADC_ModeDV_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DLLPITESTANDADC_ModeDV_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DLLPITESTANDADC_ModeADC_OFF ( 4)
+ #define DDRDATA6CH0_CR_DLLPITESTANDADC_ModeADC_WID ( 1)
+ #define DDRDATA6CH0_CR_DLLPITESTANDADC_ModeADC_MSK (0x00000010)
+ #define DDRDATA6CH0_CR_DLLPITESTANDADC_ModeADC_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DLLPITESTANDADC_ModeADC_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DLLPITESTANDADC_LoadCount_OFF ( 5)
+ #define DDRDATA6CH0_CR_DLLPITESTANDADC_LoadCount_WID (10)
+ #define DDRDATA6CH0_CR_DLLPITESTANDADC_LoadCount_MSK (0x00007FE0)
+ #define DDRDATA6CH0_CR_DLLPITESTANDADC_LoadCount_MAX (0x000003FF)
+ #define DDRDATA6CH0_CR_DLLPITESTANDADC_CountStatus_OFF (15)
+ #define DDRDATA6CH0_CR_DLLPITESTANDADC_CountStatus_WID (10)
+ #define DDRDATA6CH0_CR_DLLPITESTANDADC_CountStatus_MSK (0x01FF8000)
+ #define DDRDATA6CH0_CR_DLLPITESTANDADC_CountStatus_MAX (0x000003FF)
+ #define DDRDATA6CH0_CR_DLLPITESTANDADC_CountStatus_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DLLPITESTANDADC_Spare_OFF (25)
+ #define DDRDATA6CH0_CR_DLLPITESTANDADC_Spare_WID ( 7)
+ #define DDRDATA6CH0_CR_DLLPITESTANDADC_Spare_MSK (0xFE000000)
+ #define DDRDATA6CH0_CR_DLLPITESTANDADC_Spare_MAX (0x0000007F)
+
+#define DDRDATA6CH0_CR_DDRCRDATAOFFSETCOMP_REG (0x00000C5C)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_OFF ( 0)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_WID ( 6)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_MSK (0x0000003F)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_MAX (0x0000003F)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_OFF ( 6)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_WID ( 6)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_MSK (0x00000FC0)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_MAX (0x0000003F)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_OFF (12)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_WID ( 5)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_MSK (0x0001F000)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_MAX (0x0000001F)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_OFF (17)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_WID ( 5)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_MSK (0x003E0000)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_MAX (0x0000001F)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_OFF (22)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_WID ( 5)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_MSK (0x07C00000)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_MAX (0x0000001F)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_OFF (27)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_WID ( 5)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_MSK (0xF8000000)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_MAX (0x0000001F)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_DEF (0x00000000)
+
+#define DDRDATA6CH0_CR_DDRCRDATACONTROL1_REG (0x00000C60)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_RefPi_OFF ( 0)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_RefPi_WID ( 4)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_RefPi_MSK (0x0000000F)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_RefPi_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_RefPi_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_DllMask_OFF ( 4)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_DllMask_WID ( 2)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_DllMask_MSK (0x00000030)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_DllMask_MAX (0x00000003)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_DllMask_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_DllWeakLock_OFF ( 6)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_DllWeakLock_WID ( 1)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_DllWeakLock_MSK (0x00000040)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_DllWeakLock_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_DllWeakLock_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_OFF ( 7)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_WID ( 3)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_MSK (0x00000380)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_MAX (0x00000007)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_OFF (10)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_WID ( 3)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_MSK (0x00001C00)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_MAX (0x00000007)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_OdtDelay_OFF (13)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_OdtDelay_WID ( 4)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_OdtDelay_MSK (0x0001E000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_OdtDelay_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_OdtDelay_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_OdtDuration_OFF (17)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_OdtDuration_WID ( 3)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_OdtDuration_MSK (0x000E0000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_OdtDuration_MAX (0x00000007)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_OdtDuration_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_OFF (20)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_WID ( 4)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_MSK (0x00F00000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_OFF (24)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_WID ( 3)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_MSK (0x07000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_MAX (0x00000007)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_OFF (27)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_WID ( 3)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_MSK (0x38000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_MAX (0x00000007)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_OFF (30)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_WID ( 1)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_MSK (0x40000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_Rsvd1_OFF (31)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_Rsvd1_WID ( 1)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_Rsvd1_MSK (0x80000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_Rsvd1_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL1_Rsvd1_DEF (0x00000000)
+
+#define DDRDATA6CH0_CR_DDRCRDATACONTROL2_REG (0x00000C64)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_OFF ( 0)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_WID ( 5)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_MSK (0x0000001F)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_MAX (0x0000001F)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_OFF ( 5)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_WID ( 1)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_MSK (0x00000020)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL2_ForceRxOn_OFF ( 6)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL2_ForceRxOn_WID ( 1)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL2_ForceRxOn_MSK (0x00000040)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL2_ForceRxOn_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL2_ForceRxOn_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL2_LeakerComp_OFF ( 7)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL2_LeakerComp_WID ( 2)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL2_LeakerComp_MSK (0x00000180)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL2_LeakerComp_MAX (0x00000003)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL2_LeakerComp_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_OFF ( 9)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_WID ( 4)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_MSK (0x00001E00)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_MAX (0x0000000F)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_DEF (0x00000008)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_OFF (13)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_WID ( 5)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_MSK (0x0003E000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_MAX (0x0000001F)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_DEF (0x00000011)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_OFF (18)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_WID ( 1)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_MSK (0x00040000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL2_Spare_OFF (19)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL2_Spare_WID (13)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL2_Spare_MSK (0xFFF80000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL2_Spare_MAX (0x00001FFF)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL2_Spare_DEF (0x00000000)
+
+#define DDRDATA6CH0_CR_DDRCRVSSHIORVREFCONTROL_REG (0x00000C6C)
+ #define DDRDATA6CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_OFF ( 0)
+ #define DDRDATA6CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_WID (24)
+ #define DDRDATA6CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_MSK (0x00FFFFFF)
+ #define DDRDATA6CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_MAX (0x00FFFFFF)
+ #define DDRDATA6CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_OFF (24)
+ #define DDRDATA6CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_WID ( 8)
+ #define DDRDATA6CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_MSK (0xFF000000)
+ #define DDRDATA6CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_MAX (0x000000FF)
+ #define DDRDATA6CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_DEF (0x00000000)
+
+#define DDRDATA6CH0_CR_DDRCRDATAOFFSETTRAIN_REG (0x00000C70)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_OFF ( 0)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_WID ( 6)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_MSK (0x0000003F)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_MAX (0x0000003F)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_OFF ( 6)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_WID ( 6)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_MSK (0x00000FC0)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_MAX (0x0000003F)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_OFF (12)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_WID ( 6)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_MSK (0x0003F000)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_MAX (0x0000003F)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_OFF (18)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_WID ( 6)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_MSK (0x00FC0000)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_MAX (0x0000003F)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_OFF (24)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_WID ( 7)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_MSK (0x7F000000)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_MAX (0x0000007F)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_OFF (31)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_WID ( 1)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_MSK (0x80000000)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_DEF (0x00000000)
+
+#define DDRDATA6CH0_CR_DDRCRDATACONTROL0_REG (0x00000C74)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_OFF ( 0)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_WID ( 1)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_MSK (0x00000001)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_OFF ( 1)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_WID ( 1)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_MSK (0x00000002)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_OFF ( 2)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_WID ( 1)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_MSK (0x00000004)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_OFF ( 3)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_WID ( 1)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_MSK (0x00000008)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_TxOn_OFF ( 4)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_TxOn_WID ( 1)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_TxOn_MSK (0x00000010)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_TxOn_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_TxOn_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_RfOn_OFF ( 5)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_RfOn_WID ( 1)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_RfOn_MSK (0x00000020)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_RfOn_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_RfOn_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_RxPiOn_OFF ( 6)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_RxPiOn_WID ( 1)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_RxPiOn_MSK (0x00000040)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_RxPiOn_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_RxPiOn_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_TxPiOn_OFF ( 7)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_TxPiOn_WID ( 1)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_TxPiOn_MSK (0x00000080)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_TxPiOn_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_TxPiOn_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_OFF ( 8)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_WID ( 1)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_MSK (0x00000100)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_OFF ( 9)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_WID ( 1)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_MSK (0x00000200)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_TxDisable_OFF (10)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_TxDisable_WID ( 1)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_TxDisable_MSK (0x00000400)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_TxDisable_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_TxDisable_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_RxDisable_OFF (11)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_RxDisable_WID ( 1)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_RxDisable_MSK (0x00000800)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_RxDisable_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_RxDisable_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_TxLong_OFF (12)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_TxLong_WID ( 1)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_TxLong_MSK (0x00001000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_TxLong_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_TxLong_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_OFF (13)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_WID ( 2)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_MSK (0x00006000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_MAX (0x00000003)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_RxReadPointer_OFF (15)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_RxReadPointer_WID ( 3)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_RxReadPointer_MSK (0x00038000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_RxReadPointer_MAX (0x00000007)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_RxReadPointer_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_OFF (18)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_WID ( 1)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_MSK (0x00040000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_OFF (19)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_WID ( 1)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_MSK (0x00080000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_ReadRFRd_OFF (20)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_ReadRFRd_WID ( 1)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_ReadRFRd_MSK (0x00100000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_ReadRFRd_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_ReadRFRd_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_ReadRFWr_OFF (21)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_ReadRFWr_WID ( 1)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_ReadRFWr_MSK (0x00200000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_ReadRFWr_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_ReadRFWr_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_ReadRFRank_OFF (22)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_ReadRFRank_WID ( 2)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_ReadRFRank_MSK (0x00C00000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_ReadRFRank_MAX (0x00000003)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_ReadRFRank_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_OFF (24)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_WID ( 1)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_MSK (0x01000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_OdtSampOff_OFF (25)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_OdtSampOff_WID ( 1)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_OdtSampOff_MSK (0x02000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_OdtSampOff_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_OdtSampOff_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_OFF (26)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_WID ( 1)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_MSK (0x04000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_OFF (27)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_WID ( 1)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_MSK (0x08000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_OFF (28)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_WID ( 1)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_MSK (0x10000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_OFF (29)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_WID ( 1)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_MSK (0x20000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_OFF (30)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_WID ( 1)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_MSK (0x40000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_OFF (31)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_WID ( 1)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_MSK (0x80000000)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_DEF (0x00000000)
+
+#define DDRDATA6CH0_CR_DDRCRVREFADJUST1_REG (0x00000C78)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_OFF ( 0)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_WID ( 7)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_MSK (0x0000007F)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_MAX (0x0000007F)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_OFF ( 7)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_WID ( 7)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_MSK (0x00003F80)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_MAX (0x0000007F)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_OFF (14)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_WID ( 7)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_MSK (0x001FC000)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_MAX (0x0000007F)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_OFF (21)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_WID ( 1)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_MSK (0x00200000)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_OFF (22)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_WID ( 1)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_MSK (0x00400000)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_OFF (23)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_WID ( 1)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_MSK (0x00800000)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_OFF (24)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_WID ( 2)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_MSK (0x03000000)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_MAX (0x00000003)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_OFF (26)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_WID ( 1)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_MSK (0x04000000)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_Rsvd_OFF (27)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_Rsvd_WID ( 2)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_Rsvd_MSK (0x18000000)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_Rsvd_MAX (0x00000003)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_Rsvd_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_caSlowBW_OFF (29)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_caSlowBW_WID ( 1)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_caSlowBW_MSK (0x20000000)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_caSlowBW_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_caSlowBW_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_OFF (30)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_WID ( 1)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_MSK (0x40000000)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_DEF (0x00000000)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_OFF (31)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_WID ( 1)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_MSK (0x80000000)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_MAX (0x00000001)
+ #define DDRDATA6CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_DEF (0x00000000)
+
+#define DDRDATA6CH1_CR_RXTRAINRANK0_REG (0x00000D00)
+ #define DDRDATA6CH1_CR_RXTRAINRANK0_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA6CH1_CR_RXTRAINRANK0_RxRcvEnPi_WID ( 9)
+ #define DDRDATA6CH1_CR_RXTRAINRANK0_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA6CH1_CR_RXTRAINRANK0_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA6CH1_CR_RXTRAINRANK0_RxDqsPPi_OFF ( 9)
+ #define DDRDATA6CH1_CR_RXTRAINRANK0_RxDqsPPi_WID ( 6)
+ #define DDRDATA6CH1_CR_RXTRAINRANK0_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA6CH1_CR_RXTRAINRANK0_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA6CH1_CR_RXTRAINRANK0_RxEq_OFF (15)
+ #define DDRDATA6CH1_CR_RXTRAINRANK0_RxEq_WID ( 5)
+ #define DDRDATA6CH1_CR_RXTRAINRANK0_RxEq_MSK (0x000F8000)
+ #define DDRDATA6CH1_CR_RXTRAINRANK0_RxEq_MAX (0x0000001F)
+ #define DDRDATA6CH1_CR_RXTRAINRANK0_RxDqsNPi_OFF (20)
+ #define DDRDATA6CH1_CR_RXTRAINRANK0_RxDqsNPi_WID ( 6)
+ #define DDRDATA6CH1_CR_RXTRAINRANK0_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA6CH1_CR_RXTRAINRANK0_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA6CH1_CR_RXTRAINRANK0_RxVref_OFF (26)
+ #define DDRDATA6CH1_CR_RXTRAINRANK0_RxVref_WID ( 6)
+ #define DDRDATA6CH1_CR_RXTRAINRANK0_RxVref_MSK (0xFC000000)
+ #define DDRDATA6CH1_CR_RXTRAINRANK0_RxVref_MAX (0x0000003F)
+
+#define DDRDATA6CH1_CR_RXTRAINRANK1_REG (0x00000D04)
+ #define DDRDATA6CH1_CR_RXTRAINRANK1_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA6CH1_CR_RXTRAINRANK1_RxRcvEnPi_WID ( 9)
+ #define DDRDATA6CH1_CR_RXTRAINRANK1_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA6CH1_CR_RXTRAINRANK1_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA6CH1_CR_RXTRAINRANK1_RxDqsPPi_OFF ( 9)
+ #define DDRDATA6CH1_CR_RXTRAINRANK1_RxDqsPPi_WID ( 6)
+ #define DDRDATA6CH1_CR_RXTRAINRANK1_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA6CH1_CR_RXTRAINRANK1_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA6CH1_CR_RXTRAINRANK1_RxEq_OFF (15)
+ #define DDRDATA6CH1_CR_RXTRAINRANK1_RxEq_WID ( 5)
+ #define DDRDATA6CH1_CR_RXTRAINRANK1_RxEq_MSK (0x000F8000)
+ #define DDRDATA6CH1_CR_RXTRAINRANK1_RxEq_MAX (0x0000001F)
+ #define DDRDATA6CH1_CR_RXTRAINRANK1_RxDqsNPi_OFF (20)
+ #define DDRDATA6CH1_CR_RXTRAINRANK1_RxDqsNPi_WID ( 6)
+ #define DDRDATA6CH1_CR_RXTRAINRANK1_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA6CH1_CR_RXTRAINRANK1_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA6CH1_CR_RXTRAINRANK1_RxVref_OFF (26)
+ #define DDRDATA6CH1_CR_RXTRAINRANK1_RxVref_WID ( 6)
+ #define DDRDATA6CH1_CR_RXTRAINRANK1_RxVref_MSK (0xFC000000)
+ #define DDRDATA6CH1_CR_RXTRAINRANK1_RxVref_MAX (0x0000003F)
+
+#define DDRDATA6CH1_CR_RXTRAINRANK2_REG (0x00000D08)
+ #define DDRDATA6CH1_CR_RXTRAINRANK2_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA6CH1_CR_RXTRAINRANK2_RxRcvEnPi_WID ( 9)
+ #define DDRDATA6CH1_CR_RXTRAINRANK2_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA6CH1_CR_RXTRAINRANK2_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA6CH1_CR_RXTRAINRANK2_RxDqsPPi_OFF ( 9)
+ #define DDRDATA6CH1_CR_RXTRAINRANK2_RxDqsPPi_WID ( 6)
+ #define DDRDATA6CH1_CR_RXTRAINRANK2_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA6CH1_CR_RXTRAINRANK2_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA6CH1_CR_RXTRAINRANK2_RxEq_OFF (15)
+ #define DDRDATA6CH1_CR_RXTRAINRANK2_RxEq_WID ( 5)
+ #define DDRDATA6CH1_CR_RXTRAINRANK2_RxEq_MSK (0x000F8000)
+ #define DDRDATA6CH1_CR_RXTRAINRANK2_RxEq_MAX (0x0000001F)
+ #define DDRDATA6CH1_CR_RXTRAINRANK2_RxDqsNPi_OFF (20)
+ #define DDRDATA6CH1_CR_RXTRAINRANK2_RxDqsNPi_WID ( 6)
+ #define DDRDATA6CH1_CR_RXTRAINRANK2_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA6CH1_CR_RXTRAINRANK2_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA6CH1_CR_RXTRAINRANK2_RxVref_OFF (26)
+ #define DDRDATA6CH1_CR_RXTRAINRANK2_RxVref_WID ( 6)
+ #define DDRDATA6CH1_CR_RXTRAINRANK2_RxVref_MSK (0xFC000000)
+ #define DDRDATA6CH1_CR_RXTRAINRANK2_RxVref_MAX (0x0000003F)
+
+#define DDRDATA6CH1_CR_RXTRAINRANK3_REG (0x00000D0C)
+ #define DDRDATA6CH1_CR_RXTRAINRANK3_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA6CH1_CR_RXTRAINRANK3_RxRcvEnPi_WID ( 9)
+ #define DDRDATA6CH1_CR_RXTRAINRANK3_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA6CH1_CR_RXTRAINRANK3_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA6CH1_CR_RXTRAINRANK3_RxDqsPPi_OFF ( 9)
+ #define DDRDATA6CH1_CR_RXTRAINRANK3_RxDqsPPi_WID ( 6)
+ #define DDRDATA6CH1_CR_RXTRAINRANK3_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA6CH1_CR_RXTRAINRANK3_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA6CH1_CR_RXTRAINRANK3_RxEq_OFF (15)
+ #define DDRDATA6CH1_CR_RXTRAINRANK3_RxEq_WID ( 5)
+ #define DDRDATA6CH1_CR_RXTRAINRANK3_RxEq_MSK (0x000F8000)
+ #define DDRDATA6CH1_CR_RXTRAINRANK3_RxEq_MAX (0x0000001F)
+ #define DDRDATA6CH1_CR_RXTRAINRANK3_RxDqsNPi_OFF (20)
+ #define DDRDATA6CH1_CR_RXTRAINRANK3_RxDqsNPi_WID ( 6)
+ #define DDRDATA6CH1_CR_RXTRAINRANK3_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA6CH1_CR_RXTRAINRANK3_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA6CH1_CR_RXTRAINRANK3_RxVref_OFF (26)
+ #define DDRDATA6CH1_CR_RXTRAINRANK3_RxVref_WID ( 6)
+ #define DDRDATA6CH1_CR_RXTRAINRANK3_RxVref_MSK (0xFC000000)
+ #define DDRDATA6CH1_CR_RXTRAINRANK3_RxVref_MAX (0x0000003F)
+
+#define DDRDATA6CH1_CR_RXPERBITRANK0_REG (0x00000D10)
+ #define DDRDATA6CH1_CR_RXPERBITRANK0_Lane0_OFF ( 0)
+ #define DDRDATA6CH1_CR_RXPERBITRANK0_Lane0_WID ( 4)
+ #define DDRDATA6CH1_CR_RXPERBITRANK0_Lane0_MSK (0x0000000F)
+ #define DDRDATA6CH1_CR_RXPERBITRANK0_Lane0_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_RXPERBITRANK0_Lane1_OFF ( 4)
+ #define DDRDATA6CH1_CR_RXPERBITRANK0_Lane1_WID ( 4)
+ #define DDRDATA6CH1_CR_RXPERBITRANK0_Lane1_MSK (0x000000F0)
+ #define DDRDATA6CH1_CR_RXPERBITRANK0_Lane1_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_RXPERBITRANK0_Lane2_OFF ( 8)
+ #define DDRDATA6CH1_CR_RXPERBITRANK0_Lane2_WID ( 4)
+ #define DDRDATA6CH1_CR_RXPERBITRANK0_Lane2_MSK (0x00000F00)
+ #define DDRDATA6CH1_CR_RXPERBITRANK0_Lane2_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_RXPERBITRANK0_Lane3_OFF (12)
+ #define DDRDATA6CH1_CR_RXPERBITRANK0_Lane3_WID ( 4)
+ #define DDRDATA6CH1_CR_RXPERBITRANK0_Lane3_MSK (0x0000F000)
+ #define DDRDATA6CH1_CR_RXPERBITRANK0_Lane3_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_RXPERBITRANK0_Lane4_OFF (16)
+ #define DDRDATA6CH1_CR_RXPERBITRANK0_Lane4_WID ( 4)
+ #define DDRDATA6CH1_CR_RXPERBITRANK0_Lane4_MSK (0x000F0000)
+ #define DDRDATA6CH1_CR_RXPERBITRANK0_Lane4_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_RXPERBITRANK0_Lane5_OFF (20)
+ #define DDRDATA6CH1_CR_RXPERBITRANK0_Lane5_WID ( 4)
+ #define DDRDATA6CH1_CR_RXPERBITRANK0_Lane5_MSK (0x00F00000)
+ #define DDRDATA6CH1_CR_RXPERBITRANK0_Lane5_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_RXPERBITRANK0_Lane6_OFF (24)
+ #define DDRDATA6CH1_CR_RXPERBITRANK0_Lane6_WID ( 4)
+ #define DDRDATA6CH1_CR_RXPERBITRANK0_Lane6_MSK (0x0F000000)
+ #define DDRDATA6CH1_CR_RXPERBITRANK0_Lane6_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_RXPERBITRANK0_Lane7_OFF (28)
+ #define DDRDATA6CH1_CR_RXPERBITRANK0_Lane7_WID ( 4)
+ #define DDRDATA6CH1_CR_RXPERBITRANK0_Lane7_MSK (0xF0000000)
+ #define DDRDATA6CH1_CR_RXPERBITRANK0_Lane7_MAX (0x0000000F)
+
+#define DDRDATA6CH1_CR_RXPERBITRANK1_REG (0x00000D14)
+ #define DDRDATA6CH1_CR_RXPERBITRANK1_Lane0_OFF ( 0)
+ #define DDRDATA6CH1_CR_RXPERBITRANK1_Lane0_WID ( 4)
+ #define DDRDATA6CH1_CR_RXPERBITRANK1_Lane0_MSK (0x0000000F)
+ #define DDRDATA6CH1_CR_RXPERBITRANK1_Lane0_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_RXPERBITRANK1_Lane1_OFF ( 4)
+ #define DDRDATA6CH1_CR_RXPERBITRANK1_Lane1_WID ( 4)
+ #define DDRDATA6CH1_CR_RXPERBITRANK1_Lane1_MSK (0x000000F0)
+ #define DDRDATA6CH1_CR_RXPERBITRANK1_Lane1_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_RXPERBITRANK1_Lane2_OFF ( 8)
+ #define DDRDATA6CH1_CR_RXPERBITRANK1_Lane2_WID ( 4)
+ #define DDRDATA6CH1_CR_RXPERBITRANK1_Lane2_MSK (0x00000F00)
+ #define DDRDATA6CH1_CR_RXPERBITRANK1_Lane2_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_RXPERBITRANK1_Lane3_OFF (12)
+ #define DDRDATA6CH1_CR_RXPERBITRANK1_Lane3_WID ( 4)
+ #define DDRDATA6CH1_CR_RXPERBITRANK1_Lane3_MSK (0x0000F000)
+ #define DDRDATA6CH1_CR_RXPERBITRANK1_Lane3_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_RXPERBITRANK1_Lane4_OFF (16)
+ #define DDRDATA6CH1_CR_RXPERBITRANK1_Lane4_WID ( 4)
+ #define DDRDATA6CH1_CR_RXPERBITRANK1_Lane4_MSK (0x000F0000)
+ #define DDRDATA6CH1_CR_RXPERBITRANK1_Lane4_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_RXPERBITRANK1_Lane5_OFF (20)
+ #define DDRDATA6CH1_CR_RXPERBITRANK1_Lane5_WID ( 4)
+ #define DDRDATA6CH1_CR_RXPERBITRANK1_Lane5_MSK (0x00F00000)
+ #define DDRDATA6CH1_CR_RXPERBITRANK1_Lane5_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_RXPERBITRANK1_Lane6_OFF (24)
+ #define DDRDATA6CH1_CR_RXPERBITRANK1_Lane6_WID ( 4)
+ #define DDRDATA6CH1_CR_RXPERBITRANK1_Lane6_MSK (0x0F000000)
+ #define DDRDATA6CH1_CR_RXPERBITRANK1_Lane6_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_RXPERBITRANK1_Lane7_OFF (28)
+ #define DDRDATA6CH1_CR_RXPERBITRANK1_Lane7_WID ( 4)
+ #define DDRDATA6CH1_CR_RXPERBITRANK1_Lane7_MSK (0xF0000000)
+ #define DDRDATA6CH1_CR_RXPERBITRANK1_Lane7_MAX (0x0000000F)
+
+#define DDRDATA6CH1_CR_RXPERBITRANK2_REG (0x00000D18)
+ #define DDRDATA6CH1_CR_RXPERBITRANK2_Lane0_OFF ( 0)
+ #define DDRDATA6CH1_CR_RXPERBITRANK2_Lane0_WID ( 4)
+ #define DDRDATA6CH1_CR_RXPERBITRANK2_Lane0_MSK (0x0000000F)
+ #define DDRDATA6CH1_CR_RXPERBITRANK2_Lane0_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_RXPERBITRANK2_Lane1_OFF ( 4)
+ #define DDRDATA6CH1_CR_RXPERBITRANK2_Lane1_WID ( 4)
+ #define DDRDATA6CH1_CR_RXPERBITRANK2_Lane1_MSK (0x000000F0)
+ #define DDRDATA6CH1_CR_RXPERBITRANK2_Lane1_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_RXPERBITRANK2_Lane2_OFF ( 8)
+ #define DDRDATA6CH1_CR_RXPERBITRANK2_Lane2_WID ( 4)
+ #define DDRDATA6CH1_CR_RXPERBITRANK2_Lane2_MSK (0x00000F00)
+ #define DDRDATA6CH1_CR_RXPERBITRANK2_Lane2_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_RXPERBITRANK2_Lane3_OFF (12)
+ #define DDRDATA6CH1_CR_RXPERBITRANK2_Lane3_WID ( 4)
+ #define DDRDATA6CH1_CR_RXPERBITRANK2_Lane3_MSK (0x0000F000)
+ #define DDRDATA6CH1_CR_RXPERBITRANK2_Lane3_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_RXPERBITRANK2_Lane4_OFF (16)
+ #define DDRDATA6CH1_CR_RXPERBITRANK2_Lane4_WID ( 4)
+ #define DDRDATA6CH1_CR_RXPERBITRANK2_Lane4_MSK (0x000F0000)
+ #define DDRDATA6CH1_CR_RXPERBITRANK2_Lane4_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_RXPERBITRANK2_Lane5_OFF (20)
+ #define DDRDATA6CH1_CR_RXPERBITRANK2_Lane5_WID ( 4)
+ #define DDRDATA6CH1_CR_RXPERBITRANK2_Lane5_MSK (0x00F00000)
+ #define DDRDATA6CH1_CR_RXPERBITRANK2_Lane5_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_RXPERBITRANK2_Lane6_OFF (24)
+ #define DDRDATA6CH1_CR_RXPERBITRANK2_Lane6_WID ( 4)
+ #define DDRDATA6CH1_CR_RXPERBITRANK2_Lane6_MSK (0x0F000000)
+ #define DDRDATA6CH1_CR_RXPERBITRANK2_Lane6_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_RXPERBITRANK2_Lane7_OFF (28)
+ #define DDRDATA6CH1_CR_RXPERBITRANK2_Lane7_WID ( 4)
+ #define DDRDATA6CH1_CR_RXPERBITRANK2_Lane7_MSK (0xF0000000)
+ #define DDRDATA6CH1_CR_RXPERBITRANK2_Lane7_MAX (0x0000000F)
+
+#define DDRDATA6CH1_CR_RXPERBITRANK3_REG (0x00000D1C)
+ #define DDRDATA6CH1_CR_RXPERBITRANK3_Lane0_OFF ( 0)
+ #define DDRDATA6CH1_CR_RXPERBITRANK3_Lane0_WID ( 4)
+ #define DDRDATA6CH1_CR_RXPERBITRANK3_Lane0_MSK (0x0000000F)
+ #define DDRDATA6CH1_CR_RXPERBITRANK3_Lane0_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_RXPERBITRANK3_Lane1_OFF ( 4)
+ #define DDRDATA6CH1_CR_RXPERBITRANK3_Lane1_WID ( 4)
+ #define DDRDATA6CH1_CR_RXPERBITRANK3_Lane1_MSK (0x000000F0)
+ #define DDRDATA6CH1_CR_RXPERBITRANK3_Lane1_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_RXPERBITRANK3_Lane2_OFF ( 8)
+ #define DDRDATA6CH1_CR_RXPERBITRANK3_Lane2_WID ( 4)
+ #define DDRDATA6CH1_CR_RXPERBITRANK3_Lane2_MSK (0x00000F00)
+ #define DDRDATA6CH1_CR_RXPERBITRANK3_Lane2_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_RXPERBITRANK3_Lane3_OFF (12)
+ #define DDRDATA6CH1_CR_RXPERBITRANK3_Lane3_WID ( 4)
+ #define DDRDATA6CH1_CR_RXPERBITRANK3_Lane3_MSK (0x0000F000)
+ #define DDRDATA6CH1_CR_RXPERBITRANK3_Lane3_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_RXPERBITRANK3_Lane4_OFF (16)
+ #define DDRDATA6CH1_CR_RXPERBITRANK3_Lane4_WID ( 4)
+ #define DDRDATA6CH1_CR_RXPERBITRANK3_Lane4_MSK (0x000F0000)
+ #define DDRDATA6CH1_CR_RXPERBITRANK3_Lane4_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_RXPERBITRANK3_Lane5_OFF (20)
+ #define DDRDATA6CH1_CR_RXPERBITRANK3_Lane5_WID ( 4)
+ #define DDRDATA6CH1_CR_RXPERBITRANK3_Lane5_MSK (0x00F00000)
+ #define DDRDATA6CH1_CR_RXPERBITRANK3_Lane5_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_RXPERBITRANK3_Lane6_OFF (24)
+ #define DDRDATA6CH1_CR_RXPERBITRANK3_Lane6_WID ( 4)
+ #define DDRDATA6CH1_CR_RXPERBITRANK3_Lane6_MSK (0x0F000000)
+ #define DDRDATA6CH1_CR_RXPERBITRANK3_Lane6_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_RXPERBITRANK3_Lane7_OFF (28)
+ #define DDRDATA6CH1_CR_RXPERBITRANK3_Lane7_WID ( 4)
+ #define DDRDATA6CH1_CR_RXPERBITRANK3_Lane7_MSK (0xF0000000)
+ #define DDRDATA6CH1_CR_RXPERBITRANK3_Lane7_MAX (0x0000000F)
+
+#define DDRDATA6CH1_CR_TXTRAINRANK0_REG (0x00000D20)
+ #define DDRDATA6CH1_CR_TXTRAINRANK0_TxDqDelay_OFF ( 0)
+ #define DDRDATA6CH1_CR_TXTRAINRANK0_TxDqDelay_WID ( 9)
+ #define DDRDATA6CH1_CR_TXTRAINRANK0_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA6CH1_CR_TXTRAINRANK0_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA6CH1_CR_TXTRAINRANK0_TxDqsDelay_OFF ( 9)
+ #define DDRDATA6CH1_CR_TXTRAINRANK0_TxDqsDelay_WID ( 9)
+ #define DDRDATA6CH1_CR_TXTRAINRANK0_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA6CH1_CR_TXTRAINRANK0_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA6CH1_CR_TXTRAINRANK0_Spare0_OFF (18)
+ #define DDRDATA6CH1_CR_TXTRAINRANK0_Spare0_WID ( 2)
+ #define DDRDATA6CH1_CR_TXTRAINRANK0_Spare0_MSK (0x000C0000)
+ #define DDRDATA6CH1_CR_TXTRAINRANK0_Spare0_MAX (0x00000003)
+ #define DDRDATA6CH1_CR_TXTRAINRANK0_TxEqualization_OFF (20)
+ #define DDRDATA6CH1_CR_TXTRAINRANK0_TxEqualization_WID ( 6)
+ #define DDRDATA6CH1_CR_TXTRAINRANK0_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA6CH1_CR_TXTRAINRANK0_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA6CH1_CR_TXTRAINRANK0_Spare1_OFF (26)
+ #define DDRDATA6CH1_CR_TXTRAINRANK0_Spare1_WID ( 6)
+ #define DDRDATA6CH1_CR_TXTRAINRANK0_Spare1_MSK (0xFC000000)
+ #define DDRDATA6CH1_CR_TXTRAINRANK0_Spare1_MAX (0x0000003F)
+
+#define DDRDATA6CH1_CR_TXTRAINRANK1_REG (0x00000D24)
+ #define DDRDATA6CH1_CR_TXTRAINRANK1_TxDqDelay_OFF ( 0)
+ #define DDRDATA6CH1_CR_TXTRAINRANK1_TxDqDelay_WID ( 9)
+ #define DDRDATA6CH1_CR_TXTRAINRANK1_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA6CH1_CR_TXTRAINRANK1_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA6CH1_CR_TXTRAINRANK1_TxDqsDelay_OFF ( 9)
+ #define DDRDATA6CH1_CR_TXTRAINRANK1_TxDqsDelay_WID ( 9)
+ #define DDRDATA6CH1_CR_TXTRAINRANK1_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA6CH1_CR_TXTRAINRANK1_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA6CH1_CR_TXTRAINRANK1_Spare0_OFF (18)
+ #define DDRDATA6CH1_CR_TXTRAINRANK1_Spare0_WID ( 2)
+ #define DDRDATA6CH1_CR_TXTRAINRANK1_Spare0_MSK (0x000C0000)
+ #define DDRDATA6CH1_CR_TXTRAINRANK1_Spare0_MAX (0x00000003)
+ #define DDRDATA6CH1_CR_TXTRAINRANK1_TxEqualization_OFF (20)
+ #define DDRDATA6CH1_CR_TXTRAINRANK1_TxEqualization_WID ( 6)
+ #define DDRDATA6CH1_CR_TXTRAINRANK1_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA6CH1_CR_TXTRAINRANK1_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA6CH1_CR_TXTRAINRANK1_Spare1_OFF (26)
+ #define DDRDATA6CH1_CR_TXTRAINRANK1_Spare1_WID ( 6)
+ #define DDRDATA6CH1_CR_TXTRAINRANK1_Spare1_MSK (0xFC000000)
+ #define DDRDATA6CH1_CR_TXTRAINRANK1_Spare1_MAX (0x0000003F)
+
+#define DDRDATA6CH1_CR_TXTRAINRANK2_REG (0x00000D28)
+ #define DDRDATA6CH1_CR_TXTRAINRANK2_TxDqDelay_OFF ( 0)
+ #define DDRDATA6CH1_CR_TXTRAINRANK2_TxDqDelay_WID ( 9)
+ #define DDRDATA6CH1_CR_TXTRAINRANK2_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA6CH1_CR_TXTRAINRANK2_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA6CH1_CR_TXTRAINRANK2_TxDqsDelay_OFF ( 9)
+ #define DDRDATA6CH1_CR_TXTRAINRANK2_TxDqsDelay_WID ( 9)
+ #define DDRDATA6CH1_CR_TXTRAINRANK2_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA6CH1_CR_TXTRAINRANK2_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA6CH1_CR_TXTRAINRANK2_Spare0_OFF (18)
+ #define DDRDATA6CH1_CR_TXTRAINRANK2_Spare0_WID ( 2)
+ #define DDRDATA6CH1_CR_TXTRAINRANK2_Spare0_MSK (0x000C0000)
+ #define DDRDATA6CH1_CR_TXTRAINRANK2_Spare0_MAX (0x00000003)
+ #define DDRDATA6CH1_CR_TXTRAINRANK2_TxEqualization_OFF (20)
+ #define DDRDATA6CH1_CR_TXTRAINRANK2_TxEqualization_WID ( 6)
+ #define DDRDATA6CH1_CR_TXTRAINRANK2_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA6CH1_CR_TXTRAINRANK2_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA6CH1_CR_TXTRAINRANK2_Spare1_OFF (26)
+ #define DDRDATA6CH1_CR_TXTRAINRANK2_Spare1_WID ( 6)
+ #define DDRDATA6CH1_CR_TXTRAINRANK2_Spare1_MSK (0xFC000000)
+ #define DDRDATA6CH1_CR_TXTRAINRANK2_Spare1_MAX (0x0000003F)
+
+#define DDRDATA6CH1_CR_TXTRAINRANK3_REG (0x00000D2C)
+ #define DDRDATA6CH1_CR_TXTRAINRANK3_TxDqDelay_OFF ( 0)
+ #define DDRDATA6CH1_CR_TXTRAINRANK3_TxDqDelay_WID ( 9)
+ #define DDRDATA6CH1_CR_TXTRAINRANK3_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA6CH1_CR_TXTRAINRANK3_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA6CH1_CR_TXTRAINRANK3_TxDqsDelay_OFF ( 9)
+ #define DDRDATA6CH1_CR_TXTRAINRANK3_TxDqsDelay_WID ( 9)
+ #define DDRDATA6CH1_CR_TXTRAINRANK3_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA6CH1_CR_TXTRAINRANK3_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA6CH1_CR_TXTRAINRANK3_Spare0_OFF (18)
+ #define DDRDATA6CH1_CR_TXTRAINRANK3_Spare0_WID ( 2)
+ #define DDRDATA6CH1_CR_TXTRAINRANK3_Spare0_MSK (0x000C0000)
+ #define DDRDATA6CH1_CR_TXTRAINRANK3_Spare0_MAX (0x00000003)
+ #define DDRDATA6CH1_CR_TXTRAINRANK3_TxEqualization_OFF (20)
+ #define DDRDATA6CH1_CR_TXTRAINRANK3_TxEqualization_WID ( 6)
+ #define DDRDATA6CH1_CR_TXTRAINRANK3_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA6CH1_CR_TXTRAINRANK3_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA6CH1_CR_TXTRAINRANK3_Spare1_OFF (26)
+ #define DDRDATA6CH1_CR_TXTRAINRANK3_Spare1_WID ( 6)
+ #define DDRDATA6CH1_CR_TXTRAINRANK3_Spare1_MSK (0xFC000000)
+ #define DDRDATA6CH1_CR_TXTRAINRANK3_Spare1_MAX (0x0000003F)
+
+#define DDRDATA6CH1_CR_TXPERBITRANK0_REG (0x00000D30)
+ #define DDRDATA6CH1_CR_TXPERBITRANK0_Lane0_OFF ( 0)
+ #define DDRDATA6CH1_CR_TXPERBITRANK0_Lane0_WID ( 4)
+ #define DDRDATA6CH1_CR_TXPERBITRANK0_Lane0_MSK (0x0000000F)
+ #define DDRDATA6CH1_CR_TXPERBITRANK0_Lane0_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_TXPERBITRANK0_Lane1_OFF ( 4)
+ #define DDRDATA6CH1_CR_TXPERBITRANK0_Lane1_WID ( 4)
+ #define DDRDATA6CH1_CR_TXPERBITRANK0_Lane1_MSK (0x000000F0)
+ #define DDRDATA6CH1_CR_TXPERBITRANK0_Lane1_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_TXPERBITRANK0_Lane2_OFF ( 8)
+ #define DDRDATA6CH1_CR_TXPERBITRANK0_Lane2_WID ( 4)
+ #define DDRDATA6CH1_CR_TXPERBITRANK0_Lane2_MSK (0x00000F00)
+ #define DDRDATA6CH1_CR_TXPERBITRANK0_Lane2_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_TXPERBITRANK0_Lane3_OFF (12)
+ #define DDRDATA6CH1_CR_TXPERBITRANK0_Lane3_WID ( 4)
+ #define DDRDATA6CH1_CR_TXPERBITRANK0_Lane3_MSK (0x0000F000)
+ #define DDRDATA6CH1_CR_TXPERBITRANK0_Lane3_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_TXPERBITRANK0_Lane4_OFF (16)
+ #define DDRDATA6CH1_CR_TXPERBITRANK0_Lane4_WID ( 4)
+ #define DDRDATA6CH1_CR_TXPERBITRANK0_Lane4_MSK (0x000F0000)
+ #define DDRDATA6CH1_CR_TXPERBITRANK0_Lane4_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_TXPERBITRANK0_Lane5_OFF (20)
+ #define DDRDATA6CH1_CR_TXPERBITRANK0_Lane5_WID ( 4)
+ #define DDRDATA6CH1_CR_TXPERBITRANK0_Lane5_MSK (0x00F00000)
+ #define DDRDATA6CH1_CR_TXPERBITRANK0_Lane5_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_TXPERBITRANK0_Lane6_OFF (24)
+ #define DDRDATA6CH1_CR_TXPERBITRANK0_Lane6_WID ( 4)
+ #define DDRDATA6CH1_CR_TXPERBITRANK0_Lane6_MSK (0x0F000000)
+ #define DDRDATA6CH1_CR_TXPERBITRANK0_Lane6_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_TXPERBITRANK0_Lane7_OFF (28)
+ #define DDRDATA6CH1_CR_TXPERBITRANK0_Lane7_WID ( 4)
+ #define DDRDATA6CH1_CR_TXPERBITRANK0_Lane7_MSK (0xF0000000)
+ #define DDRDATA6CH1_CR_TXPERBITRANK0_Lane7_MAX (0x0000000F)
+
+#define DDRDATA6CH1_CR_TXPERBITRANK1_REG (0x00000D34)
+ #define DDRDATA6CH1_CR_TXPERBITRANK1_Lane0_OFF ( 0)
+ #define DDRDATA6CH1_CR_TXPERBITRANK1_Lane0_WID ( 4)
+ #define DDRDATA6CH1_CR_TXPERBITRANK1_Lane0_MSK (0x0000000F)
+ #define DDRDATA6CH1_CR_TXPERBITRANK1_Lane0_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_TXPERBITRANK1_Lane1_OFF ( 4)
+ #define DDRDATA6CH1_CR_TXPERBITRANK1_Lane1_WID ( 4)
+ #define DDRDATA6CH1_CR_TXPERBITRANK1_Lane1_MSK (0x000000F0)
+ #define DDRDATA6CH1_CR_TXPERBITRANK1_Lane1_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_TXPERBITRANK1_Lane2_OFF ( 8)
+ #define DDRDATA6CH1_CR_TXPERBITRANK1_Lane2_WID ( 4)
+ #define DDRDATA6CH1_CR_TXPERBITRANK1_Lane2_MSK (0x00000F00)
+ #define DDRDATA6CH1_CR_TXPERBITRANK1_Lane2_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_TXPERBITRANK1_Lane3_OFF (12)
+ #define DDRDATA6CH1_CR_TXPERBITRANK1_Lane3_WID ( 4)
+ #define DDRDATA6CH1_CR_TXPERBITRANK1_Lane3_MSK (0x0000F000)
+ #define DDRDATA6CH1_CR_TXPERBITRANK1_Lane3_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_TXPERBITRANK1_Lane4_OFF (16)
+ #define DDRDATA6CH1_CR_TXPERBITRANK1_Lane4_WID ( 4)
+ #define DDRDATA6CH1_CR_TXPERBITRANK1_Lane4_MSK (0x000F0000)
+ #define DDRDATA6CH1_CR_TXPERBITRANK1_Lane4_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_TXPERBITRANK1_Lane5_OFF (20)
+ #define DDRDATA6CH1_CR_TXPERBITRANK1_Lane5_WID ( 4)
+ #define DDRDATA6CH1_CR_TXPERBITRANK1_Lane5_MSK (0x00F00000)
+ #define DDRDATA6CH1_CR_TXPERBITRANK1_Lane5_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_TXPERBITRANK1_Lane6_OFF (24)
+ #define DDRDATA6CH1_CR_TXPERBITRANK1_Lane6_WID ( 4)
+ #define DDRDATA6CH1_CR_TXPERBITRANK1_Lane6_MSK (0x0F000000)
+ #define DDRDATA6CH1_CR_TXPERBITRANK1_Lane6_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_TXPERBITRANK1_Lane7_OFF (28)
+ #define DDRDATA6CH1_CR_TXPERBITRANK1_Lane7_WID ( 4)
+ #define DDRDATA6CH1_CR_TXPERBITRANK1_Lane7_MSK (0xF0000000)
+ #define DDRDATA6CH1_CR_TXPERBITRANK1_Lane7_MAX (0x0000000F)
+
+#define DDRDATA6CH1_CR_TXPERBITRANK2_REG (0x00000D38)
+ #define DDRDATA6CH1_CR_TXPERBITRANK2_Lane0_OFF ( 0)
+ #define DDRDATA6CH1_CR_TXPERBITRANK2_Lane0_WID ( 4)
+ #define DDRDATA6CH1_CR_TXPERBITRANK2_Lane0_MSK (0x0000000F)
+ #define DDRDATA6CH1_CR_TXPERBITRANK2_Lane0_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_TXPERBITRANK2_Lane1_OFF ( 4)
+ #define DDRDATA6CH1_CR_TXPERBITRANK2_Lane1_WID ( 4)
+ #define DDRDATA6CH1_CR_TXPERBITRANK2_Lane1_MSK (0x000000F0)
+ #define DDRDATA6CH1_CR_TXPERBITRANK2_Lane1_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_TXPERBITRANK2_Lane2_OFF ( 8)
+ #define DDRDATA6CH1_CR_TXPERBITRANK2_Lane2_WID ( 4)
+ #define DDRDATA6CH1_CR_TXPERBITRANK2_Lane2_MSK (0x00000F00)
+ #define DDRDATA6CH1_CR_TXPERBITRANK2_Lane2_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_TXPERBITRANK2_Lane3_OFF (12)
+ #define DDRDATA6CH1_CR_TXPERBITRANK2_Lane3_WID ( 4)
+ #define DDRDATA6CH1_CR_TXPERBITRANK2_Lane3_MSK (0x0000F000)
+ #define DDRDATA6CH1_CR_TXPERBITRANK2_Lane3_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_TXPERBITRANK2_Lane4_OFF (16)
+ #define DDRDATA6CH1_CR_TXPERBITRANK2_Lane4_WID ( 4)
+ #define DDRDATA6CH1_CR_TXPERBITRANK2_Lane4_MSK (0x000F0000)
+ #define DDRDATA6CH1_CR_TXPERBITRANK2_Lane4_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_TXPERBITRANK2_Lane5_OFF (20)
+ #define DDRDATA6CH1_CR_TXPERBITRANK2_Lane5_WID ( 4)
+ #define DDRDATA6CH1_CR_TXPERBITRANK2_Lane5_MSK (0x00F00000)
+ #define DDRDATA6CH1_CR_TXPERBITRANK2_Lane5_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_TXPERBITRANK2_Lane6_OFF (24)
+ #define DDRDATA6CH1_CR_TXPERBITRANK2_Lane6_WID ( 4)
+ #define DDRDATA6CH1_CR_TXPERBITRANK2_Lane6_MSK (0x0F000000)
+ #define DDRDATA6CH1_CR_TXPERBITRANK2_Lane6_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_TXPERBITRANK2_Lane7_OFF (28)
+ #define DDRDATA6CH1_CR_TXPERBITRANK2_Lane7_WID ( 4)
+ #define DDRDATA6CH1_CR_TXPERBITRANK2_Lane7_MSK (0xF0000000)
+ #define DDRDATA6CH1_CR_TXPERBITRANK2_Lane7_MAX (0x0000000F)
+
+#define DDRDATA6CH1_CR_TXPERBITRANK3_REG (0x00000D3C)
+ #define DDRDATA6CH1_CR_TXPERBITRANK3_Lane0_OFF ( 0)
+ #define DDRDATA6CH1_CR_TXPERBITRANK3_Lane0_WID ( 4)
+ #define DDRDATA6CH1_CR_TXPERBITRANK3_Lane0_MSK (0x0000000F)
+ #define DDRDATA6CH1_CR_TXPERBITRANK3_Lane0_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_TXPERBITRANK3_Lane1_OFF ( 4)
+ #define DDRDATA6CH1_CR_TXPERBITRANK3_Lane1_WID ( 4)
+ #define DDRDATA6CH1_CR_TXPERBITRANK3_Lane1_MSK (0x000000F0)
+ #define DDRDATA6CH1_CR_TXPERBITRANK3_Lane1_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_TXPERBITRANK3_Lane2_OFF ( 8)
+ #define DDRDATA6CH1_CR_TXPERBITRANK3_Lane2_WID ( 4)
+ #define DDRDATA6CH1_CR_TXPERBITRANK3_Lane2_MSK (0x00000F00)
+ #define DDRDATA6CH1_CR_TXPERBITRANK3_Lane2_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_TXPERBITRANK3_Lane3_OFF (12)
+ #define DDRDATA6CH1_CR_TXPERBITRANK3_Lane3_WID ( 4)
+ #define DDRDATA6CH1_CR_TXPERBITRANK3_Lane3_MSK (0x0000F000)
+ #define DDRDATA6CH1_CR_TXPERBITRANK3_Lane3_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_TXPERBITRANK3_Lane4_OFF (16)
+ #define DDRDATA6CH1_CR_TXPERBITRANK3_Lane4_WID ( 4)
+ #define DDRDATA6CH1_CR_TXPERBITRANK3_Lane4_MSK (0x000F0000)
+ #define DDRDATA6CH1_CR_TXPERBITRANK3_Lane4_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_TXPERBITRANK3_Lane5_OFF (20)
+ #define DDRDATA6CH1_CR_TXPERBITRANK3_Lane5_WID ( 4)
+ #define DDRDATA6CH1_CR_TXPERBITRANK3_Lane5_MSK (0x00F00000)
+ #define DDRDATA6CH1_CR_TXPERBITRANK3_Lane5_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_TXPERBITRANK3_Lane6_OFF (24)
+ #define DDRDATA6CH1_CR_TXPERBITRANK3_Lane6_WID ( 4)
+ #define DDRDATA6CH1_CR_TXPERBITRANK3_Lane6_MSK (0x0F000000)
+ #define DDRDATA6CH1_CR_TXPERBITRANK3_Lane6_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_TXPERBITRANK3_Lane7_OFF (28)
+ #define DDRDATA6CH1_CR_TXPERBITRANK3_Lane7_WID ( 4)
+ #define DDRDATA6CH1_CR_TXPERBITRANK3_Lane7_MSK (0xF0000000)
+ #define DDRDATA6CH1_CR_TXPERBITRANK3_Lane7_MAX (0x0000000F)
+
+#define DDRDATA6CH1_CR_RCOMPDATA0_REG (0x00000D40)
+ #define DDRDATA6CH1_CR_RCOMPDATA0_RcompDrvUp_OFF ( 0)
+ #define DDRDATA6CH1_CR_RCOMPDATA0_RcompDrvUp_WID ( 6)
+ #define DDRDATA6CH1_CR_RCOMPDATA0_RcompDrvUp_MSK (0x0000003F)
+ #define DDRDATA6CH1_CR_RCOMPDATA0_RcompDrvUp_MAX (0x0000003F)
+ #define DDRDATA6CH1_CR_RCOMPDATA0_Spare0_OFF ( 6)
+ #define DDRDATA6CH1_CR_RCOMPDATA0_Spare0_WID ( 3)
+ #define DDRDATA6CH1_CR_RCOMPDATA0_Spare0_MSK (0x000001C0)
+ #define DDRDATA6CH1_CR_RCOMPDATA0_Spare0_MAX (0x00000007)
+ #define DDRDATA6CH1_CR_RCOMPDATA0_RcompDrvDown_OFF ( 9)
+ #define DDRDATA6CH1_CR_RCOMPDATA0_RcompDrvDown_WID ( 6)
+ #define DDRDATA6CH1_CR_RCOMPDATA0_RcompDrvDown_MSK (0x00007E00)
+ #define DDRDATA6CH1_CR_RCOMPDATA0_RcompDrvDown_MAX (0x0000003F)
+ #define DDRDATA6CH1_CR_RCOMPDATA0_VTComp_OFF (15)
+ #define DDRDATA6CH1_CR_RCOMPDATA0_VTComp_WID ( 5)
+ #define DDRDATA6CH1_CR_RCOMPDATA0_VTComp_MSK (0x000F8000)
+ #define DDRDATA6CH1_CR_RCOMPDATA0_VTComp_MAX (0x0000001F)
+ #define DDRDATA6CH1_CR_RCOMPDATA0_TcoComp_OFF (20)
+ #define DDRDATA6CH1_CR_RCOMPDATA0_TcoComp_WID ( 6)
+ #define DDRDATA6CH1_CR_RCOMPDATA0_TcoComp_MSK (0x03F00000)
+ #define DDRDATA6CH1_CR_RCOMPDATA0_TcoComp_MAX (0x0000003F)
+ #define DDRDATA6CH1_CR_RCOMPDATA0_SlewRateComp_OFF (26)
+ #define DDRDATA6CH1_CR_RCOMPDATA0_SlewRateComp_WID ( 5)
+ #define DDRDATA6CH1_CR_RCOMPDATA0_SlewRateComp_MSK (0x7C000000)
+ #define DDRDATA6CH1_CR_RCOMPDATA0_SlewRateComp_MAX (0x0000001F)
+ #define DDRDATA6CH1_CR_RCOMPDATA0_Spare2_OFF (31)
+ #define DDRDATA6CH1_CR_RCOMPDATA0_Spare2_WID ( 1)
+ #define DDRDATA6CH1_CR_RCOMPDATA0_Spare2_MSK (0x80000000)
+ #define DDRDATA6CH1_CR_RCOMPDATA0_Spare2_MAX (0x00000001)
+
+#define DDRDATA6CH1_CR_RCOMPDATA1_REG (0x00000D44)
+ #define DDRDATA6CH1_CR_RCOMPDATA1_RcompOdtUp_OFF ( 0)
+ #define DDRDATA6CH1_CR_RCOMPDATA1_RcompOdtUp_WID ( 6)
+ #define DDRDATA6CH1_CR_RCOMPDATA1_RcompOdtUp_MSK (0x0000003F)
+ #define DDRDATA6CH1_CR_RCOMPDATA1_RcompOdtUp_MAX (0x0000003F)
+ #define DDRDATA6CH1_CR_RCOMPDATA1_Spare0_OFF ( 6)
+ #define DDRDATA6CH1_CR_RCOMPDATA1_Spare0_WID ( 3)
+ #define DDRDATA6CH1_CR_RCOMPDATA1_Spare0_MSK (0x000001C0)
+ #define DDRDATA6CH1_CR_RCOMPDATA1_Spare0_MAX (0x00000007)
+ #define DDRDATA6CH1_CR_RCOMPDATA1_RcompOdtDown_OFF ( 9)
+ #define DDRDATA6CH1_CR_RCOMPDATA1_RcompOdtDown_WID ( 6)
+ #define DDRDATA6CH1_CR_RCOMPDATA1_RcompOdtDown_MSK (0x00007E00)
+ #define DDRDATA6CH1_CR_RCOMPDATA1_RcompOdtDown_MAX (0x0000003F)
+ #define DDRDATA6CH1_CR_RCOMPDATA1_Spare1_OFF (15)
+ #define DDRDATA6CH1_CR_RCOMPDATA1_Spare1_WID ( 1)
+ #define DDRDATA6CH1_CR_RCOMPDATA1_Spare1_MSK (0x00008000)
+ #define DDRDATA6CH1_CR_RCOMPDATA1_Spare1_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_RCOMPDATA1_PanicDrvDn_OFF (16)
+ #define DDRDATA6CH1_CR_RCOMPDATA1_PanicDrvDn_WID ( 6)
+ #define DDRDATA6CH1_CR_RCOMPDATA1_PanicDrvDn_MSK (0x003F0000)
+ #define DDRDATA6CH1_CR_RCOMPDATA1_PanicDrvDn_MAX (0x0000003F)
+ #define DDRDATA6CH1_CR_RCOMPDATA1_PanicDrvUp_OFF (22)
+ #define DDRDATA6CH1_CR_RCOMPDATA1_PanicDrvUp_WID ( 6)
+ #define DDRDATA6CH1_CR_RCOMPDATA1_PanicDrvUp_MSK (0x0FC00000)
+ #define DDRDATA6CH1_CR_RCOMPDATA1_PanicDrvUp_MAX (0x0000003F)
+ #define DDRDATA6CH1_CR_RCOMPDATA1_LevelShifterComp_OFF (28)
+ #define DDRDATA6CH1_CR_RCOMPDATA1_LevelShifterComp_WID ( 3)
+ #define DDRDATA6CH1_CR_RCOMPDATA1_LevelShifterComp_MSK (0x70000000)
+ #define DDRDATA6CH1_CR_RCOMPDATA1_LevelShifterComp_MAX (0x00000007)
+ #define DDRDATA6CH1_CR_RCOMPDATA1_Spare2_OFF (31)
+ #define DDRDATA6CH1_CR_RCOMPDATA1_Spare2_WID ( 1)
+ #define DDRDATA6CH1_CR_RCOMPDATA1_Spare2_MSK (0x80000000)
+ #define DDRDATA6CH1_CR_RCOMPDATA1_Spare2_MAX (0x00000001)
+
+#define DDRDATA6CH1_CR_TXXTALK_REG (0x00000D48)
+ #define DDRDATA6CH1_CR_TXXTALK_Lane0_OFF ( 0)
+ #define DDRDATA6CH1_CR_TXXTALK_Lane0_WID ( 4)
+ #define DDRDATA6CH1_CR_TXXTALK_Lane0_MSK (0x0000000F)
+ #define DDRDATA6CH1_CR_TXXTALK_Lane0_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_TXXTALK_Lane1_OFF ( 4)
+ #define DDRDATA6CH1_CR_TXXTALK_Lane1_WID ( 4)
+ #define DDRDATA6CH1_CR_TXXTALK_Lane1_MSK (0x000000F0)
+ #define DDRDATA6CH1_CR_TXXTALK_Lane1_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_TXXTALK_Lane2_OFF ( 8)
+ #define DDRDATA6CH1_CR_TXXTALK_Lane2_WID ( 4)
+ #define DDRDATA6CH1_CR_TXXTALK_Lane2_MSK (0x00000F00)
+ #define DDRDATA6CH1_CR_TXXTALK_Lane2_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_TXXTALK_Lane3_OFF (12)
+ #define DDRDATA6CH1_CR_TXXTALK_Lane3_WID ( 4)
+ #define DDRDATA6CH1_CR_TXXTALK_Lane3_MSK (0x0000F000)
+ #define DDRDATA6CH1_CR_TXXTALK_Lane3_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_TXXTALK_Lane4_OFF (16)
+ #define DDRDATA6CH1_CR_TXXTALK_Lane4_WID ( 4)
+ #define DDRDATA6CH1_CR_TXXTALK_Lane4_MSK (0x000F0000)
+ #define DDRDATA6CH1_CR_TXXTALK_Lane4_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_TXXTALK_Lane5_OFF (20)
+ #define DDRDATA6CH1_CR_TXXTALK_Lane5_WID ( 4)
+ #define DDRDATA6CH1_CR_TXXTALK_Lane5_MSK (0x00F00000)
+ #define DDRDATA6CH1_CR_TXXTALK_Lane5_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_TXXTALK_Lane6_OFF (24)
+ #define DDRDATA6CH1_CR_TXXTALK_Lane6_WID ( 4)
+ #define DDRDATA6CH1_CR_TXXTALK_Lane6_MSK (0x0F000000)
+ #define DDRDATA6CH1_CR_TXXTALK_Lane6_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_TXXTALK_Lane7_OFF (28)
+ #define DDRDATA6CH1_CR_TXXTALK_Lane7_WID ( 4)
+ #define DDRDATA6CH1_CR_TXXTALK_Lane7_MSK (0xF0000000)
+ #define DDRDATA6CH1_CR_TXXTALK_Lane7_MAX (0x0000000F)
+
+#define DDRDATA6CH1_CR_RXOFFSETVDQ_REG (0x00000D4C)
+ #define DDRDATA6CH1_CR_RXOFFSETVDQ_Lane0_OFF ( 0)
+ #define DDRDATA6CH1_CR_RXOFFSETVDQ_Lane0_WID ( 4)
+ #define DDRDATA6CH1_CR_RXOFFSETVDQ_Lane0_MSK (0x0000000F)
+ #define DDRDATA6CH1_CR_RXOFFSETVDQ_Lane0_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_RXOFFSETVDQ_Lane1_OFF ( 4)
+ #define DDRDATA6CH1_CR_RXOFFSETVDQ_Lane1_WID ( 4)
+ #define DDRDATA6CH1_CR_RXOFFSETVDQ_Lane1_MSK (0x000000F0)
+ #define DDRDATA6CH1_CR_RXOFFSETVDQ_Lane1_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_RXOFFSETVDQ_Lane2_OFF ( 8)
+ #define DDRDATA6CH1_CR_RXOFFSETVDQ_Lane2_WID ( 4)
+ #define DDRDATA6CH1_CR_RXOFFSETVDQ_Lane2_MSK (0x00000F00)
+ #define DDRDATA6CH1_CR_RXOFFSETVDQ_Lane2_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_RXOFFSETVDQ_Lane3_OFF (12)
+ #define DDRDATA6CH1_CR_RXOFFSETVDQ_Lane3_WID ( 4)
+ #define DDRDATA6CH1_CR_RXOFFSETVDQ_Lane3_MSK (0x0000F000)
+ #define DDRDATA6CH1_CR_RXOFFSETVDQ_Lane3_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_RXOFFSETVDQ_Lane4_OFF (16)
+ #define DDRDATA6CH1_CR_RXOFFSETVDQ_Lane4_WID ( 4)
+ #define DDRDATA6CH1_CR_RXOFFSETVDQ_Lane4_MSK (0x000F0000)
+ #define DDRDATA6CH1_CR_RXOFFSETVDQ_Lane4_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_RXOFFSETVDQ_Lane5_OFF (20)
+ #define DDRDATA6CH1_CR_RXOFFSETVDQ_Lane5_WID ( 4)
+ #define DDRDATA6CH1_CR_RXOFFSETVDQ_Lane5_MSK (0x00F00000)
+ #define DDRDATA6CH1_CR_RXOFFSETVDQ_Lane5_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_RXOFFSETVDQ_Lane6_OFF (24)
+ #define DDRDATA6CH1_CR_RXOFFSETVDQ_Lane6_WID ( 4)
+ #define DDRDATA6CH1_CR_RXOFFSETVDQ_Lane6_MSK (0x0F000000)
+ #define DDRDATA6CH1_CR_RXOFFSETVDQ_Lane6_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_RXOFFSETVDQ_Lane7_OFF (28)
+ #define DDRDATA6CH1_CR_RXOFFSETVDQ_Lane7_WID ( 4)
+ #define DDRDATA6CH1_CR_RXOFFSETVDQ_Lane7_MSK (0xF0000000)
+ #define DDRDATA6CH1_CR_RXOFFSETVDQ_Lane7_MAX (0x0000000F)
+
+#define DDRDATA6CH1_CR_DDRDATARESERVED_REG (0x00000D50)
+ #define DDRDATA6CH1_CR_DDRDATARESERVED_Spare_OFF ( 0)
+ #define DDRDATA6CH1_CR_DDRDATARESERVED_Spare_WID (32)
+ #define DDRDATA6CH1_CR_DDRDATARESERVED_Spare_MSK (0xFFFFFFFF)
+ #define DDRDATA6CH1_CR_DDRDATARESERVED_Spare_MAX (0xFFFFFFFF)
+
+#define DDRDATA6CH1_CR_DATATRAINFEEDBACK_REG (0x00000D54)
+ #define DDRDATA6CH1_CR_DATATRAINFEEDBACK_DataTrainFeedback_OFF ( 0)
+ #define DDRDATA6CH1_CR_DATATRAINFEEDBACK_DataTrainFeedback_WID ( 9)
+ #define DDRDATA6CH1_CR_DATATRAINFEEDBACK_DataTrainFeedback_MSK (0x000001FF)
+ #define DDRDATA6CH1_CR_DATATRAINFEEDBACK_DataTrainFeedback_MAX (0x000001FF)
+ #define DDRDATA6CH1_CR_DATATRAINFEEDBACK_Spare_OFF ( 9)
+ #define DDRDATA6CH1_CR_DATATRAINFEEDBACK_Spare_WID (23)
+ #define DDRDATA6CH1_CR_DATATRAINFEEDBACK_Spare_MSK (0xFFFFFE00)
+ #define DDRDATA6CH1_CR_DATATRAINFEEDBACK_Spare_MAX (0x007FFFFF)
+
+#define DDRDATA6CH1_CR_DLLPITESTANDADC_REG (0x00000D58)
+ #define DDRDATA6CH1_CR_DLLPITESTANDADC_RunTest_OFF ( 0)
+ #define DDRDATA6CH1_CR_DLLPITESTANDADC_RunTest_WID ( 1)
+ #define DDRDATA6CH1_CR_DLLPITESTANDADC_RunTest_MSK (0x00000001)
+ #define DDRDATA6CH1_CR_DLLPITESTANDADC_RunTest_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DLLPITESTANDADC_RunTest_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DLLPITESTANDADC_Load_OFF ( 1)
+ #define DDRDATA6CH1_CR_DLLPITESTANDADC_Load_WID ( 1)
+ #define DDRDATA6CH1_CR_DLLPITESTANDADC_Load_MSK (0x00000002)
+ #define DDRDATA6CH1_CR_DLLPITESTANDADC_Load_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DLLPITESTANDADC_Load_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DLLPITESTANDADC_ModeHVM_OFF ( 2)
+ #define DDRDATA6CH1_CR_DLLPITESTANDADC_ModeHVM_WID ( 1)
+ #define DDRDATA6CH1_CR_DLLPITESTANDADC_ModeHVM_MSK (0x00000004)
+ #define DDRDATA6CH1_CR_DLLPITESTANDADC_ModeHVM_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DLLPITESTANDADC_ModeHVM_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DLLPITESTANDADC_ModeDV_OFF ( 3)
+ #define DDRDATA6CH1_CR_DLLPITESTANDADC_ModeDV_WID ( 1)
+ #define DDRDATA6CH1_CR_DLLPITESTANDADC_ModeDV_MSK (0x00000008)
+ #define DDRDATA6CH1_CR_DLLPITESTANDADC_ModeDV_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DLLPITESTANDADC_ModeDV_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DLLPITESTANDADC_ModeADC_OFF ( 4)
+ #define DDRDATA6CH1_CR_DLLPITESTANDADC_ModeADC_WID ( 1)
+ #define DDRDATA6CH1_CR_DLLPITESTANDADC_ModeADC_MSK (0x00000010)
+ #define DDRDATA6CH1_CR_DLLPITESTANDADC_ModeADC_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DLLPITESTANDADC_ModeADC_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DLLPITESTANDADC_LoadCount_OFF ( 5)
+ #define DDRDATA6CH1_CR_DLLPITESTANDADC_LoadCount_WID (10)
+ #define DDRDATA6CH1_CR_DLLPITESTANDADC_LoadCount_MSK (0x00007FE0)
+ #define DDRDATA6CH1_CR_DLLPITESTANDADC_LoadCount_MAX (0x000003FF)
+ #define DDRDATA6CH1_CR_DLLPITESTANDADC_CountStatus_OFF (15)
+ #define DDRDATA6CH1_CR_DLLPITESTANDADC_CountStatus_WID (10)
+ #define DDRDATA6CH1_CR_DLLPITESTANDADC_CountStatus_MSK (0x01FF8000)
+ #define DDRDATA6CH1_CR_DLLPITESTANDADC_CountStatus_MAX (0x000003FF)
+ #define DDRDATA6CH1_CR_DLLPITESTANDADC_CountStatus_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DLLPITESTANDADC_Spare_OFF (25)
+ #define DDRDATA6CH1_CR_DLLPITESTANDADC_Spare_WID ( 7)
+ #define DDRDATA6CH1_CR_DLLPITESTANDADC_Spare_MSK (0xFE000000)
+ #define DDRDATA6CH1_CR_DLLPITESTANDADC_Spare_MAX (0x0000007F)
+
+#define DDRDATA6CH1_CR_DDRCRDATAOFFSETCOMP_REG (0x00000D5C)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_OFF ( 0)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_WID ( 6)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_MSK (0x0000003F)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_MAX (0x0000003F)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_OFF ( 6)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_WID ( 6)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_MSK (0x00000FC0)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_MAX (0x0000003F)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_OFF (12)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_WID ( 5)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_MSK (0x0001F000)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_MAX (0x0000001F)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_OFF (17)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_WID ( 5)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_MSK (0x003E0000)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_MAX (0x0000001F)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_OFF (22)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_WID ( 5)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_MSK (0x07C00000)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_MAX (0x0000001F)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_OFF (27)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_WID ( 5)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_MSK (0xF8000000)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_MAX (0x0000001F)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_DEF (0x00000000)
+
+#define DDRDATA6CH1_CR_DDRCRDATACONTROL1_REG (0x00000D60)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_RefPi_OFF ( 0)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_RefPi_WID ( 4)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_RefPi_MSK (0x0000000F)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_RefPi_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_RefPi_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_DllMask_OFF ( 4)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_DllMask_WID ( 2)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_DllMask_MSK (0x00000030)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_DllMask_MAX (0x00000003)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_DllMask_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_DllWeakLock_OFF ( 6)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_DllWeakLock_WID ( 1)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_DllWeakLock_MSK (0x00000040)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_DllWeakLock_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_DllWeakLock_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_OFF ( 7)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_WID ( 3)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_MSK (0x00000380)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_MAX (0x00000007)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_OFF (10)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_WID ( 3)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_MSK (0x00001C00)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_MAX (0x00000007)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_OdtDelay_OFF (13)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_OdtDelay_WID ( 4)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_OdtDelay_MSK (0x0001E000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_OdtDelay_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_OdtDelay_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_OdtDuration_OFF (17)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_OdtDuration_WID ( 3)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_OdtDuration_MSK (0x000E0000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_OdtDuration_MAX (0x00000007)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_OdtDuration_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_OFF (20)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_WID ( 4)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_MSK (0x00F00000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_OFF (24)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_WID ( 3)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_MSK (0x07000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_MAX (0x00000007)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_OFF (27)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_WID ( 3)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_MSK (0x38000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_MAX (0x00000007)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_OFF (30)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_WID ( 1)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_MSK (0x40000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_Rsvd1_OFF (31)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_Rsvd1_WID ( 1)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_Rsvd1_MSK (0x80000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_Rsvd1_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL1_Rsvd1_DEF (0x00000000)
+
+#define DDRDATA6CH1_CR_DDRCRDATACONTROL2_REG (0x00000D64)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_OFF ( 0)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_WID ( 5)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_MSK (0x0000001F)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_MAX (0x0000001F)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_OFF ( 5)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_WID ( 1)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_MSK (0x00000020)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL2_ForceRxOn_OFF ( 6)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL2_ForceRxOn_WID ( 1)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL2_ForceRxOn_MSK (0x00000040)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL2_ForceRxOn_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL2_ForceRxOn_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL2_LeakerComp_OFF ( 7)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL2_LeakerComp_WID ( 2)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL2_LeakerComp_MSK (0x00000180)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL2_LeakerComp_MAX (0x00000003)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL2_LeakerComp_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_OFF ( 9)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_WID ( 4)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_MSK (0x00001E00)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_MAX (0x0000000F)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_DEF (0x00000008)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_OFF (13)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_WID ( 5)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_MSK (0x0003E000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_MAX (0x0000001F)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_DEF (0x00000011)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_OFF (18)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_WID ( 1)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_MSK (0x00040000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL2_Spare_OFF (19)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL2_Spare_WID (13)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL2_Spare_MSK (0xFFF80000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL2_Spare_MAX (0x00001FFF)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL2_Spare_DEF (0x00000000)
+
+#define DDRDATA6CH1_CR_DDRCRVSSHIORVREFCONTROL_REG (0x00000D6C)
+ #define DDRDATA6CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_OFF ( 0)
+ #define DDRDATA6CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_WID (24)
+ #define DDRDATA6CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_MSK (0x00FFFFFF)
+ #define DDRDATA6CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_MAX (0x00FFFFFF)
+ #define DDRDATA6CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_OFF (24)
+ #define DDRDATA6CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_WID ( 8)
+ #define DDRDATA6CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_MSK (0xFF000000)
+ #define DDRDATA6CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_MAX (0x000000FF)
+ #define DDRDATA6CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_DEF (0x00000000)
+
+#define DDRDATA6CH1_CR_DDRCRDATAOFFSETTRAIN_REG (0x00000D70)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_OFF ( 0)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_WID ( 6)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_MSK (0x0000003F)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_MAX (0x0000003F)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_OFF ( 6)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_WID ( 6)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_MSK (0x00000FC0)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_MAX (0x0000003F)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_OFF (12)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_WID ( 6)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_MSK (0x0003F000)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_MAX (0x0000003F)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_OFF (18)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_WID ( 6)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_MSK (0x00FC0000)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_MAX (0x0000003F)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_OFF (24)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_WID ( 7)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_MSK (0x7F000000)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_MAX (0x0000007F)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_OFF (31)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_WID ( 1)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_MSK (0x80000000)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_DEF (0x00000000)
+
+#define DDRDATA6CH1_CR_DDRCRDATACONTROL0_REG (0x00000D74)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_OFF ( 0)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_WID ( 1)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_MSK (0x00000001)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_OFF ( 1)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_WID ( 1)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_MSK (0x00000002)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_OFF ( 2)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_WID ( 1)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_MSK (0x00000004)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_OFF ( 3)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_WID ( 1)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_MSK (0x00000008)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_TxOn_OFF ( 4)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_TxOn_WID ( 1)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_TxOn_MSK (0x00000010)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_TxOn_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_TxOn_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_RfOn_OFF ( 5)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_RfOn_WID ( 1)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_RfOn_MSK (0x00000020)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_RfOn_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_RfOn_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_RxPiOn_OFF ( 6)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_RxPiOn_WID ( 1)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_RxPiOn_MSK (0x00000040)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_RxPiOn_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_RxPiOn_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_TxPiOn_OFF ( 7)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_TxPiOn_WID ( 1)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_TxPiOn_MSK (0x00000080)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_TxPiOn_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_TxPiOn_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_OFF ( 8)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_WID ( 1)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_MSK (0x00000100)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_OFF ( 9)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_WID ( 1)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_MSK (0x00000200)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_TxDisable_OFF (10)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_TxDisable_WID ( 1)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_TxDisable_MSK (0x00000400)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_TxDisable_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_TxDisable_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_RxDisable_OFF (11)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_RxDisable_WID ( 1)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_RxDisable_MSK (0x00000800)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_RxDisable_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_RxDisable_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_TxLong_OFF (12)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_TxLong_WID ( 1)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_TxLong_MSK (0x00001000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_TxLong_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_TxLong_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_OFF (13)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_WID ( 2)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_MSK (0x00006000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_MAX (0x00000003)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_RxReadPointer_OFF (15)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_RxReadPointer_WID ( 3)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_RxReadPointer_MSK (0x00038000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_RxReadPointer_MAX (0x00000007)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_RxReadPointer_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_OFF (18)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_WID ( 1)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_MSK (0x00040000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_OFF (19)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_WID ( 1)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_MSK (0x00080000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_ReadRFRd_OFF (20)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_ReadRFRd_WID ( 1)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_ReadRFRd_MSK (0x00100000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_ReadRFRd_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_ReadRFRd_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_ReadRFWr_OFF (21)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_ReadRFWr_WID ( 1)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_ReadRFWr_MSK (0x00200000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_ReadRFWr_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_ReadRFWr_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_ReadRFRank_OFF (22)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_ReadRFRank_WID ( 2)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_ReadRFRank_MSK (0x00C00000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_ReadRFRank_MAX (0x00000003)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_ReadRFRank_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_OFF (24)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_WID ( 1)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_MSK (0x01000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_OdtSampOff_OFF (25)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_OdtSampOff_WID ( 1)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_OdtSampOff_MSK (0x02000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_OdtSampOff_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_OdtSampOff_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_OFF (26)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_WID ( 1)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_MSK (0x04000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_OFF (27)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_WID ( 1)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_MSK (0x08000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_OFF (28)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_WID ( 1)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_MSK (0x10000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_OFF (29)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_WID ( 1)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_MSK (0x20000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_OFF (30)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_WID ( 1)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_MSK (0x40000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_OFF (31)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_WID ( 1)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_MSK (0x80000000)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_DEF (0x00000000)
+
+#define DDRDATA6CH1_CR_DDRCRVREFADJUST1_REG (0x00000D78)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_OFF ( 0)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_WID ( 7)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_MSK (0x0000007F)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_MAX (0x0000007F)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_OFF ( 7)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_WID ( 7)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_MSK (0x00003F80)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_MAX (0x0000007F)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_OFF (14)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_WID ( 7)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_MSK (0x001FC000)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_MAX (0x0000007F)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_OFF (21)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_WID ( 1)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_MSK (0x00200000)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_OFF (22)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_WID ( 1)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_MSK (0x00400000)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_OFF (23)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_WID ( 1)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_MSK (0x00800000)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_OFF (24)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_WID ( 2)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_MSK (0x03000000)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_MAX (0x00000003)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_OFF (26)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_WID ( 1)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_MSK (0x04000000)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_Rsvd_OFF (27)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_Rsvd_WID ( 2)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_Rsvd_MSK (0x18000000)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_Rsvd_MAX (0x00000003)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_Rsvd_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_caSlowBW_OFF (29)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_caSlowBW_WID ( 1)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_caSlowBW_MSK (0x20000000)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_caSlowBW_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_caSlowBW_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_OFF (30)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_WID ( 1)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_MSK (0x40000000)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_DEF (0x00000000)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_OFF (31)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_WID ( 1)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_MSK (0x80000000)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_MAX (0x00000001)
+ #define DDRDATA6CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_DEF (0x00000000)
+
+#define DDRDATA7CH0_CR_RXTRAINRANK0_REG (0x00000E00)
+ #define DDRDATA7CH0_CR_RXTRAINRANK0_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA7CH0_CR_RXTRAINRANK0_RxRcvEnPi_WID ( 9)
+ #define DDRDATA7CH0_CR_RXTRAINRANK0_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA7CH0_CR_RXTRAINRANK0_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA7CH0_CR_RXTRAINRANK0_RxDqsPPi_OFF ( 9)
+ #define DDRDATA7CH0_CR_RXTRAINRANK0_RxDqsPPi_WID ( 6)
+ #define DDRDATA7CH0_CR_RXTRAINRANK0_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA7CH0_CR_RXTRAINRANK0_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA7CH0_CR_RXTRAINRANK0_RxEq_OFF (15)
+ #define DDRDATA7CH0_CR_RXTRAINRANK0_RxEq_WID ( 5)
+ #define DDRDATA7CH0_CR_RXTRAINRANK0_RxEq_MSK (0x000F8000)
+ #define DDRDATA7CH0_CR_RXTRAINRANK0_RxEq_MAX (0x0000001F)
+ #define DDRDATA7CH0_CR_RXTRAINRANK0_RxDqsNPi_OFF (20)
+ #define DDRDATA7CH0_CR_RXTRAINRANK0_RxDqsNPi_WID ( 6)
+ #define DDRDATA7CH0_CR_RXTRAINRANK0_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA7CH0_CR_RXTRAINRANK0_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA7CH0_CR_RXTRAINRANK0_RxVref_OFF (26)
+ #define DDRDATA7CH0_CR_RXTRAINRANK0_RxVref_WID ( 6)
+ #define DDRDATA7CH0_CR_RXTRAINRANK0_RxVref_MSK (0xFC000000)
+ #define DDRDATA7CH0_CR_RXTRAINRANK0_RxVref_MAX (0x0000003F)
+
+#define DDRDATA7CH0_CR_RXTRAINRANK1_REG (0x00000E04)
+ #define DDRDATA7CH0_CR_RXTRAINRANK1_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA7CH0_CR_RXTRAINRANK1_RxRcvEnPi_WID ( 9)
+ #define DDRDATA7CH0_CR_RXTRAINRANK1_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA7CH0_CR_RXTRAINRANK1_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA7CH0_CR_RXTRAINRANK1_RxDqsPPi_OFF ( 9)
+ #define DDRDATA7CH0_CR_RXTRAINRANK1_RxDqsPPi_WID ( 6)
+ #define DDRDATA7CH0_CR_RXTRAINRANK1_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA7CH0_CR_RXTRAINRANK1_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA7CH0_CR_RXTRAINRANK1_RxEq_OFF (15)
+ #define DDRDATA7CH0_CR_RXTRAINRANK1_RxEq_WID ( 5)
+ #define DDRDATA7CH0_CR_RXTRAINRANK1_RxEq_MSK (0x000F8000)
+ #define DDRDATA7CH0_CR_RXTRAINRANK1_RxEq_MAX (0x0000001F)
+ #define DDRDATA7CH0_CR_RXTRAINRANK1_RxDqsNPi_OFF (20)
+ #define DDRDATA7CH0_CR_RXTRAINRANK1_RxDqsNPi_WID ( 6)
+ #define DDRDATA7CH0_CR_RXTRAINRANK1_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA7CH0_CR_RXTRAINRANK1_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA7CH0_CR_RXTRAINRANK1_RxVref_OFF (26)
+ #define DDRDATA7CH0_CR_RXTRAINRANK1_RxVref_WID ( 6)
+ #define DDRDATA7CH0_CR_RXTRAINRANK1_RxVref_MSK (0xFC000000)
+ #define DDRDATA7CH0_CR_RXTRAINRANK1_RxVref_MAX (0x0000003F)
+
+#define DDRDATA7CH0_CR_RXTRAINRANK2_REG (0x00000E08)
+ #define DDRDATA7CH0_CR_RXTRAINRANK2_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA7CH0_CR_RXTRAINRANK2_RxRcvEnPi_WID ( 9)
+ #define DDRDATA7CH0_CR_RXTRAINRANK2_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA7CH0_CR_RXTRAINRANK2_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA7CH0_CR_RXTRAINRANK2_RxDqsPPi_OFF ( 9)
+ #define DDRDATA7CH0_CR_RXTRAINRANK2_RxDqsPPi_WID ( 6)
+ #define DDRDATA7CH0_CR_RXTRAINRANK2_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA7CH0_CR_RXTRAINRANK2_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA7CH0_CR_RXTRAINRANK2_RxEq_OFF (15)
+ #define DDRDATA7CH0_CR_RXTRAINRANK2_RxEq_WID ( 5)
+ #define DDRDATA7CH0_CR_RXTRAINRANK2_RxEq_MSK (0x000F8000)
+ #define DDRDATA7CH0_CR_RXTRAINRANK2_RxEq_MAX (0x0000001F)
+ #define DDRDATA7CH0_CR_RXTRAINRANK2_RxDqsNPi_OFF (20)
+ #define DDRDATA7CH0_CR_RXTRAINRANK2_RxDqsNPi_WID ( 6)
+ #define DDRDATA7CH0_CR_RXTRAINRANK2_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA7CH0_CR_RXTRAINRANK2_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA7CH0_CR_RXTRAINRANK2_RxVref_OFF (26)
+ #define DDRDATA7CH0_CR_RXTRAINRANK2_RxVref_WID ( 6)
+ #define DDRDATA7CH0_CR_RXTRAINRANK2_RxVref_MSK (0xFC000000)
+ #define DDRDATA7CH0_CR_RXTRAINRANK2_RxVref_MAX (0x0000003F)
+
+#define DDRDATA7CH0_CR_RXTRAINRANK3_REG (0x00000E0C)
+ #define DDRDATA7CH0_CR_RXTRAINRANK3_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA7CH0_CR_RXTRAINRANK3_RxRcvEnPi_WID ( 9)
+ #define DDRDATA7CH0_CR_RXTRAINRANK3_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA7CH0_CR_RXTRAINRANK3_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA7CH0_CR_RXTRAINRANK3_RxDqsPPi_OFF ( 9)
+ #define DDRDATA7CH0_CR_RXTRAINRANK3_RxDqsPPi_WID ( 6)
+ #define DDRDATA7CH0_CR_RXTRAINRANK3_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA7CH0_CR_RXTRAINRANK3_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA7CH0_CR_RXTRAINRANK3_RxEq_OFF (15)
+ #define DDRDATA7CH0_CR_RXTRAINRANK3_RxEq_WID ( 5)
+ #define DDRDATA7CH0_CR_RXTRAINRANK3_RxEq_MSK (0x000F8000)
+ #define DDRDATA7CH0_CR_RXTRAINRANK3_RxEq_MAX (0x0000001F)
+ #define DDRDATA7CH0_CR_RXTRAINRANK3_RxDqsNPi_OFF (20)
+ #define DDRDATA7CH0_CR_RXTRAINRANK3_RxDqsNPi_WID ( 6)
+ #define DDRDATA7CH0_CR_RXTRAINRANK3_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA7CH0_CR_RXTRAINRANK3_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA7CH0_CR_RXTRAINRANK3_RxVref_OFF (26)
+ #define DDRDATA7CH0_CR_RXTRAINRANK3_RxVref_WID ( 6)
+ #define DDRDATA7CH0_CR_RXTRAINRANK3_RxVref_MSK (0xFC000000)
+ #define DDRDATA7CH0_CR_RXTRAINRANK3_RxVref_MAX (0x0000003F)
+
+#define DDRDATA7CH0_CR_RXPERBITRANK0_REG (0x00000E10)
+ #define DDRDATA7CH0_CR_RXPERBITRANK0_Lane0_OFF ( 0)
+ #define DDRDATA7CH0_CR_RXPERBITRANK0_Lane0_WID ( 4)
+ #define DDRDATA7CH0_CR_RXPERBITRANK0_Lane0_MSK (0x0000000F)
+ #define DDRDATA7CH0_CR_RXPERBITRANK0_Lane0_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_RXPERBITRANK0_Lane1_OFF ( 4)
+ #define DDRDATA7CH0_CR_RXPERBITRANK0_Lane1_WID ( 4)
+ #define DDRDATA7CH0_CR_RXPERBITRANK0_Lane1_MSK (0x000000F0)
+ #define DDRDATA7CH0_CR_RXPERBITRANK0_Lane1_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_RXPERBITRANK0_Lane2_OFF ( 8)
+ #define DDRDATA7CH0_CR_RXPERBITRANK0_Lane2_WID ( 4)
+ #define DDRDATA7CH0_CR_RXPERBITRANK0_Lane2_MSK (0x00000F00)
+ #define DDRDATA7CH0_CR_RXPERBITRANK0_Lane2_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_RXPERBITRANK0_Lane3_OFF (12)
+ #define DDRDATA7CH0_CR_RXPERBITRANK0_Lane3_WID ( 4)
+ #define DDRDATA7CH0_CR_RXPERBITRANK0_Lane3_MSK (0x0000F000)
+ #define DDRDATA7CH0_CR_RXPERBITRANK0_Lane3_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_RXPERBITRANK0_Lane4_OFF (16)
+ #define DDRDATA7CH0_CR_RXPERBITRANK0_Lane4_WID ( 4)
+ #define DDRDATA7CH0_CR_RXPERBITRANK0_Lane4_MSK (0x000F0000)
+ #define DDRDATA7CH0_CR_RXPERBITRANK0_Lane4_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_RXPERBITRANK0_Lane5_OFF (20)
+ #define DDRDATA7CH0_CR_RXPERBITRANK0_Lane5_WID ( 4)
+ #define DDRDATA7CH0_CR_RXPERBITRANK0_Lane5_MSK (0x00F00000)
+ #define DDRDATA7CH0_CR_RXPERBITRANK0_Lane5_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_RXPERBITRANK0_Lane6_OFF (24)
+ #define DDRDATA7CH0_CR_RXPERBITRANK0_Lane6_WID ( 4)
+ #define DDRDATA7CH0_CR_RXPERBITRANK0_Lane6_MSK (0x0F000000)
+ #define DDRDATA7CH0_CR_RXPERBITRANK0_Lane6_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_RXPERBITRANK0_Lane7_OFF (28)
+ #define DDRDATA7CH0_CR_RXPERBITRANK0_Lane7_WID ( 4)
+ #define DDRDATA7CH0_CR_RXPERBITRANK0_Lane7_MSK (0xF0000000)
+ #define DDRDATA7CH0_CR_RXPERBITRANK0_Lane7_MAX (0x0000000F)
+
+#define DDRDATA7CH0_CR_RXPERBITRANK1_REG (0x00000E14)
+ #define DDRDATA7CH0_CR_RXPERBITRANK1_Lane0_OFF ( 0)
+ #define DDRDATA7CH0_CR_RXPERBITRANK1_Lane0_WID ( 4)
+ #define DDRDATA7CH0_CR_RXPERBITRANK1_Lane0_MSK (0x0000000F)
+ #define DDRDATA7CH0_CR_RXPERBITRANK1_Lane0_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_RXPERBITRANK1_Lane1_OFF ( 4)
+ #define DDRDATA7CH0_CR_RXPERBITRANK1_Lane1_WID ( 4)
+ #define DDRDATA7CH0_CR_RXPERBITRANK1_Lane1_MSK (0x000000F0)
+ #define DDRDATA7CH0_CR_RXPERBITRANK1_Lane1_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_RXPERBITRANK1_Lane2_OFF ( 8)
+ #define DDRDATA7CH0_CR_RXPERBITRANK1_Lane2_WID ( 4)
+ #define DDRDATA7CH0_CR_RXPERBITRANK1_Lane2_MSK (0x00000F00)
+ #define DDRDATA7CH0_CR_RXPERBITRANK1_Lane2_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_RXPERBITRANK1_Lane3_OFF (12)
+ #define DDRDATA7CH0_CR_RXPERBITRANK1_Lane3_WID ( 4)
+ #define DDRDATA7CH0_CR_RXPERBITRANK1_Lane3_MSK (0x0000F000)
+ #define DDRDATA7CH0_CR_RXPERBITRANK1_Lane3_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_RXPERBITRANK1_Lane4_OFF (16)
+ #define DDRDATA7CH0_CR_RXPERBITRANK1_Lane4_WID ( 4)
+ #define DDRDATA7CH0_CR_RXPERBITRANK1_Lane4_MSK (0x000F0000)
+ #define DDRDATA7CH0_CR_RXPERBITRANK1_Lane4_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_RXPERBITRANK1_Lane5_OFF (20)
+ #define DDRDATA7CH0_CR_RXPERBITRANK1_Lane5_WID ( 4)
+ #define DDRDATA7CH0_CR_RXPERBITRANK1_Lane5_MSK (0x00F00000)
+ #define DDRDATA7CH0_CR_RXPERBITRANK1_Lane5_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_RXPERBITRANK1_Lane6_OFF (24)
+ #define DDRDATA7CH0_CR_RXPERBITRANK1_Lane6_WID ( 4)
+ #define DDRDATA7CH0_CR_RXPERBITRANK1_Lane6_MSK (0x0F000000)
+ #define DDRDATA7CH0_CR_RXPERBITRANK1_Lane6_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_RXPERBITRANK1_Lane7_OFF (28)
+ #define DDRDATA7CH0_CR_RXPERBITRANK1_Lane7_WID ( 4)
+ #define DDRDATA7CH0_CR_RXPERBITRANK1_Lane7_MSK (0xF0000000)
+ #define DDRDATA7CH0_CR_RXPERBITRANK1_Lane7_MAX (0x0000000F)
+
+#define DDRDATA7CH0_CR_RXPERBITRANK2_REG (0x00000E18)
+ #define DDRDATA7CH0_CR_RXPERBITRANK2_Lane0_OFF ( 0)
+ #define DDRDATA7CH0_CR_RXPERBITRANK2_Lane0_WID ( 4)
+ #define DDRDATA7CH0_CR_RXPERBITRANK2_Lane0_MSK (0x0000000F)
+ #define DDRDATA7CH0_CR_RXPERBITRANK2_Lane0_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_RXPERBITRANK2_Lane1_OFF ( 4)
+ #define DDRDATA7CH0_CR_RXPERBITRANK2_Lane1_WID ( 4)
+ #define DDRDATA7CH0_CR_RXPERBITRANK2_Lane1_MSK (0x000000F0)
+ #define DDRDATA7CH0_CR_RXPERBITRANK2_Lane1_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_RXPERBITRANK2_Lane2_OFF ( 8)
+ #define DDRDATA7CH0_CR_RXPERBITRANK2_Lane2_WID ( 4)
+ #define DDRDATA7CH0_CR_RXPERBITRANK2_Lane2_MSK (0x00000F00)
+ #define DDRDATA7CH0_CR_RXPERBITRANK2_Lane2_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_RXPERBITRANK2_Lane3_OFF (12)
+ #define DDRDATA7CH0_CR_RXPERBITRANK2_Lane3_WID ( 4)
+ #define DDRDATA7CH0_CR_RXPERBITRANK2_Lane3_MSK (0x0000F000)
+ #define DDRDATA7CH0_CR_RXPERBITRANK2_Lane3_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_RXPERBITRANK2_Lane4_OFF (16)
+ #define DDRDATA7CH0_CR_RXPERBITRANK2_Lane4_WID ( 4)
+ #define DDRDATA7CH0_CR_RXPERBITRANK2_Lane4_MSK (0x000F0000)
+ #define DDRDATA7CH0_CR_RXPERBITRANK2_Lane4_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_RXPERBITRANK2_Lane5_OFF (20)
+ #define DDRDATA7CH0_CR_RXPERBITRANK2_Lane5_WID ( 4)
+ #define DDRDATA7CH0_CR_RXPERBITRANK2_Lane5_MSK (0x00F00000)
+ #define DDRDATA7CH0_CR_RXPERBITRANK2_Lane5_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_RXPERBITRANK2_Lane6_OFF (24)
+ #define DDRDATA7CH0_CR_RXPERBITRANK2_Lane6_WID ( 4)
+ #define DDRDATA7CH0_CR_RXPERBITRANK2_Lane6_MSK (0x0F000000)
+ #define DDRDATA7CH0_CR_RXPERBITRANK2_Lane6_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_RXPERBITRANK2_Lane7_OFF (28)
+ #define DDRDATA7CH0_CR_RXPERBITRANK2_Lane7_WID ( 4)
+ #define DDRDATA7CH0_CR_RXPERBITRANK2_Lane7_MSK (0xF0000000)
+ #define DDRDATA7CH0_CR_RXPERBITRANK2_Lane7_MAX (0x0000000F)
+
+#define DDRDATA7CH0_CR_RXPERBITRANK3_REG (0x00000E1C)
+ #define DDRDATA7CH0_CR_RXPERBITRANK3_Lane0_OFF ( 0)
+ #define DDRDATA7CH0_CR_RXPERBITRANK3_Lane0_WID ( 4)
+ #define DDRDATA7CH0_CR_RXPERBITRANK3_Lane0_MSK (0x0000000F)
+ #define DDRDATA7CH0_CR_RXPERBITRANK3_Lane0_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_RXPERBITRANK3_Lane1_OFF ( 4)
+ #define DDRDATA7CH0_CR_RXPERBITRANK3_Lane1_WID ( 4)
+ #define DDRDATA7CH0_CR_RXPERBITRANK3_Lane1_MSK (0x000000F0)
+ #define DDRDATA7CH0_CR_RXPERBITRANK3_Lane1_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_RXPERBITRANK3_Lane2_OFF ( 8)
+ #define DDRDATA7CH0_CR_RXPERBITRANK3_Lane2_WID ( 4)
+ #define DDRDATA7CH0_CR_RXPERBITRANK3_Lane2_MSK (0x00000F00)
+ #define DDRDATA7CH0_CR_RXPERBITRANK3_Lane2_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_RXPERBITRANK3_Lane3_OFF (12)
+ #define DDRDATA7CH0_CR_RXPERBITRANK3_Lane3_WID ( 4)
+ #define DDRDATA7CH0_CR_RXPERBITRANK3_Lane3_MSK (0x0000F000)
+ #define DDRDATA7CH0_CR_RXPERBITRANK3_Lane3_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_RXPERBITRANK3_Lane4_OFF (16)
+ #define DDRDATA7CH0_CR_RXPERBITRANK3_Lane4_WID ( 4)
+ #define DDRDATA7CH0_CR_RXPERBITRANK3_Lane4_MSK (0x000F0000)
+ #define DDRDATA7CH0_CR_RXPERBITRANK3_Lane4_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_RXPERBITRANK3_Lane5_OFF (20)
+ #define DDRDATA7CH0_CR_RXPERBITRANK3_Lane5_WID ( 4)
+ #define DDRDATA7CH0_CR_RXPERBITRANK3_Lane5_MSK (0x00F00000)
+ #define DDRDATA7CH0_CR_RXPERBITRANK3_Lane5_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_RXPERBITRANK3_Lane6_OFF (24)
+ #define DDRDATA7CH0_CR_RXPERBITRANK3_Lane6_WID ( 4)
+ #define DDRDATA7CH0_CR_RXPERBITRANK3_Lane6_MSK (0x0F000000)
+ #define DDRDATA7CH0_CR_RXPERBITRANK3_Lane6_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_RXPERBITRANK3_Lane7_OFF (28)
+ #define DDRDATA7CH0_CR_RXPERBITRANK3_Lane7_WID ( 4)
+ #define DDRDATA7CH0_CR_RXPERBITRANK3_Lane7_MSK (0xF0000000)
+ #define DDRDATA7CH0_CR_RXPERBITRANK3_Lane7_MAX (0x0000000F)
+
+#define DDRDATA7CH0_CR_TXTRAINRANK0_REG (0x00000E20)
+ #define DDRDATA7CH0_CR_TXTRAINRANK0_TxDqDelay_OFF ( 0)
+ #define DDRDATA7CH0_CR_TXTRAINRANK0_TxDqDelay_WID ( 9)
+ #define DDRDATA7CH0_CR_TXTRAINRANK0_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA7CH0_CR_TXTRAINRANK0_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA7CH0_CR_TXTRAINRANK0_TxDqsDelay_OFF ( 9)
+ #define DDRDATA7CH0_CR_TXTRAINRANK0_TxDqsDelay_WID ( 9)
+ #define DDRDATA7CH0_CR_TXTRAINRANK0_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA7CH0_CR_TXTRAINRANK0_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA7CH0_CR_TXTRAINRANK0_Spare0_OFF (18)
+ #define DDRDATA7CH0_CR_TXTRAINRANK0_Spare0_WID ( 2)
+ #define DDRDATA7CH0_CR_TXTRAINRANK0_Spare0_MSK (0x000C0000)
+ #define DDRDATA7CH0_CR_TXTRAINRANK0_Spare0_MAX (0x00000003)
+ #define DDRDATA7CH0_CR_TXTRAINRANK0_TxEqualization_OFF (20)
+ #define DDRDATA7CH0_CR_TXTRAINRANK0_TxEqualization_WID ( 6)
+ #define DDRDATA7CH0_CR_TXTRAINRANK0_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA7CH0_CR_TXTRAINRANK0_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA7CH0_CR_TXTRAINRANK0_Spare1_OFF (26)
+ #define DDRDATA7CH0_CR_TXTRAINRANK0_Spare1_WID ( 6)
+ #define DDRDATA7CH0_CR_TXTRAINRANK0_Spare1_MSK (0xFC000000)
+ #define DDRDATA7CH0_CR_TXTRAINRANK0_Spare1_MAX (0x0000003F)
+
+#define DDRDATA7CH0_CR_TXTRAINRANK1_REG (0x00000E24)
+ #define DDRDATA7CH0_CR_TXTRAINRANK1_TxDqDelay_OFF ( 0)
+ #define DDRDATA7CH0_CR_TXTRAINRANK1_TxDqDelay_WID ( 9)
+ #define DDRDATA7CH0_CR_TXTRAINRANK1_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA7CH0_CR_TXTRAINRANK1_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA7CH0_CR_TXTRAINRANK1_TxDqsDelay_OFF ( 9)
+ #define DDRDATA7CH0_CR_TXTRAINRANK1_TxDqsDelay_WID ( 9)
+ #define DDRDATA7CH0_CR_TXTRAINRANK1_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA7CH0_CR_TXTRAINRANK1_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA7CH0_CR_TXTRAINRANK1_Spare0_OFF (18)
+ #define DDRDATA7CH0_CR_TXTRAINRANK1_Spare0_WID ( 2)
+ #define DDRDATA7CH0_CR_TXTRAINRANK1_Spare0_MSK (0x000C0000)
+ #define DDRDATA7CH0_CR_TXTRAINRANK1_Spare0_MAX (0x00000003)
+ #define DDRDATA7CH0_CR_TXTRAINRANK1_TxEqualization_OFF (20)
+ #define DDRDATA7CH0_CR_TXTRAINRANK1_TxEqualization_WID ( 6)
+ #define DDRDATA7CH0_CR_TXTRAINRANK1_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA7CH0_CR_TXTRAINRANK1_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA7CH0_CR_TXTRAINRANK1_Spare1_OFF (26)
+ #define DDRDATA7CH0_CR_TXTRAINRANK1_Spare1_WID ( 6)
+ #define DDRDATA7CH0_CR_TXTRAINRANK1_Spare1_MSK (0xFC000000)
+ #define DDRDATA7CH0_CR_TXTRAINRANK1_Spare1_MAX (0x0000003F)
+
+#define DDRDATA7CH0_CR_TXTRAINRANK2_REG (0x00000E28)
+ #define DDRDATA7CH0_CR_TXTRAINRANK2_TxDqDelay_OFF ( 0)
+ #define DDRDATA7CH0_CR_TXTRAINRANK2_TxDqDelay_WID ( 9)
+ #define DDRDATA7CH0_CR_TXTRAINRANK2_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA7CH0_CR_TXTRAINRANK2_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA7CH0_CR_TXTRAINRANK2_TxDqsDelay_OFF ( 9)
+ #define DDRDATA7CH0_CR_TXTRAINRANK2_TxDqsDelay_WID ( 9)
+ #define DDRDATA7CH0_CR_TXTRAINRANK2_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA7CH0_CR_TXTRAINRANK2_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA7CH0_CR_TXTRAINRANK2_Spare0_OFF (18)
+ #define DDRDATA7CH0_CR_TXTRAINRANK2_Spare0_WID ( 2)
+ #define DDRDATA7CH0_CR_TXTRAINRANK2_Spare0_MSK (0x000C0000)
+ #define DDRDATA7CH0_CR_TXTRAINRANK2_Spare0_MAX (0x00000003)
+ #define DDRDATA7CH0_CR_TXTRAINRANK2_TxEqualization_OFF (20)
+ #define DDRDATA7CH0_CR_TXTRAINRANK2_TxEqualization_WID ( 6)
+ #define DDRDATA7CH0_CR_TXTRAINRANK2_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA7CH0_CR_TXTRAINRANK2_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA7CH0_CR_TXTRAINRANK2_Spare1_OFF (26)
+ #define DDRDATA7CH0_CR_TXTRAINRANK2_Spare1_WID ( 6)
+ #define DDRDATA7CH0_CR_TXTRAINRANK2_Spare1_MSK (0xFC000000)
+ #define DDRDATA7CH0_CR_TXTRAINRANK2_Spare1_MAX (0x0000003F)
+
+#define DDRDATA7CH0_CR_TXTRAINRANK3_REG (0x00000E2C)
+ #define DDRDATA7CH0_CR_TXTRAINRANK3_TxDqDelay_OFF ( 0)
+ #define DDRDATA7CH0_CR_TXTRAINRANK3_TxDqDelay_WID ( 9)
+ #define DDRDATA7CH0_CR_TXTRAINRANK3_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA7CH0_CR_TXTRAINRANK3_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA7CH0_CR_TXTRAINRANK3_TxDqsDelay_OFF ( 9)
+ #define DDRDATA7CH0_CR_TXTRAINRANK3_TxDqsDelay_WID ( 9)
+ #define DDRDATA7CH0_CR_TXTRAINRANK3_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA7CH0_CR_TXTRAINRANK3_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA7CH0_CR_TXTRAINRANK3_Spare0_OFF (18)
+ #define DDRDATA7CH0_CR_TXTRAINRANK3_Spare0_WID ( 2)
+ #define DDRDATA7CH0_CR_TXTRAINRANK3_Spare0_MSK (0x000C0000)
+ #define DDRDATA7CH0_CR_TXTRAINRANK3_Spare0_MAX (0x00000003)
+ #define DDRDATA7CH0_CR_TXTRAINRANK3_TxEqualization_OFF (20)
+ #define DDRDATA7CH0_CR_TXTRAINRANK3_TxEqualization_WID ( 6)
+ #define DDRDATA7CH0_CR_TXTRAINRANK3_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA7CH0_CR_TXTRAINRANK3_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA7CH0_CR_TXTRAINRANK3_Spare1_OFF (26)
+ #define DDRDATA7CH0_CR_TXTRAINRANK3_Spare1_WID ( 6)
+ #define DDRDATA7CH0_CR_TXTRAINRANK3_Spare1_MSK (0xFC000000)
+ #define DDRDATA7CH0_CR_TXTRAINRANK3_Spare1_MAX (0x0000003F)
+
+#define DDRDATA7CH0_CR_TXPERBITRANK0_REG (0x00000E30)
+ #define DDRDATA7CH0_CR_TXPERBITRANK0_Lane0_OFF ( 0)
+ #define DDRDATA7CH0_CR_TXPERBITRANK0_Lane0_WID ( 4)
+ #define DDRDATA7CH0_CR_TXPERBITRANK0_Lane0_MSK (0x0000000F)
+ #define DDRDATA7CH0_CR_TXPERBITRANK0_Lane0_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_TXPERBITRANK0_Lane1_OFF ( 4)
+ #define DDRDATA7CH0_CR_TXPERBITRANK0_Lane1_WID ( 4)
+ #define DDRDATA7CH0_CR_TXPERBITRANK0_Lane1_MSK (0x000000F0)
+ #define DDRDATA7CH0_CR_TXPERBITRANK0_Lane1_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_TXPERBITRANK0_Lane2_OFF ( 8)
+ #define DDRDATA7CH0_CR_TXPERBITRANK0_Lane2_WID ( 4)
+ #define DDRDATA7CH0_CR_TXPERBITRANK0_Lane2_MSK (0x00000F00)
+ #define DDRDATA7CH0_CR_TXPERBITRANK0_Lane2_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_TXPERBITRANK0_Lane3_OFF (12)
+ #define DDRDATA7CH0_CR_TXPERBITRANK0_Lane3_WID ( 4)
+ #define DDRDATA7CH0_CR_TXPERBITRANK0_Lane3_MSK (0x0000F000)
+ #define DDRDATA7CH0_CR_TXPERBITRANK0_Lane3_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_TXPERBITRANK0_Lane4_OFF (16)
+ #define DDRDATA7CH0_CR_TXPERBITRANK0_Lane4_WID ( 4)
+ #define DDRDATA7CH0_CR_TXPERBITRANK0_Lane4_MSK (0x000F0000)
+ #define DDRDATA7CH0_CR_TXPERBITRANK0_Lane4_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_TXPERBITRANK0_Lane5_OFF (20)
+ #define DDRDATA7CH0_CR_TXPERBITRANK0_Lane5_WID ( 4)
+ #define DDRDATA7CH0_CR_TXPERBITRANK0_Lane5_MSK (0x00F00000)
+ #define DDRDATA7CH0_CR_TXPERBITRANK0_Lane5_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_TXPERBITRANK0_Lane6_OFF (24)
+ #define DDRDATA7CH0_CR_TXPERBITRANK0_Lane6_WID ( 4)
+ #define DDRDATA7CH0_CR_TXPERBITRANK0_Lane6_MSK (0x0F000000)
+ #define DDRDATA7CH0_CR_TXPERBITRANK0_Lane6_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_TXPERBITRANK0_Lane7_OFF (28)
+ #define DDRDATA7CH0_CR_TXPERBITRANK0_Lane7_WID ( 4)
+ #define DDRDATA7CH0_CR_TXPERBITRANK0_Lane7_MSK (0xF0000000)
+ #define DDRDATA7CH0_CR_TXPERBITRANK0_Lane7_MAX (0x0000000F)
+
+#define DDRDATA7CH0_CR_TXPERBITRANK1_REG (0x00000E34)
+ #define DDRDATA7CH0_CR_TXPERBITRANK1_Lane0_OFF ( 0)
+ #define DDRDATA7CH0_CR_TXPERBITRANK1_Lane0_WID ( 4)
+ #define DDRDATA7CH0_CR_TXPERBITRANK1_Lane0_MSK (0x0000000F)
+ #define DDRDATA7CH0_CR_TXPERBITRANK1_Lane0_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_TXPERBITRANK1_Lane1_OFF ( 4)
+ #define DDRDATA7CH0_CR_TXPERBITRANK1_Lane1_WID ( 4)
+ #define DDRDATA7CH0_CR_TXPERBITRANK1_Lane1_MSK (0x000000F0)
+ #define DDRDATA7CH0_CR_TXPERBITRANK1_Lane1_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_TXPERBITRANK1_Lane2_OFF ( 8)
+ #define DDRDATA7CH0_CR_TXPERBITRANK1_Lane2_WID ( 4)
+ #define DDRDATA7CH0_CR_TXPERBITRANK1_Lane2_MSK (0x00000F00)
+ #define DDRDATA7CH0_CR_TXPERBITRANK1_Lane2_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_TXPERBITRANK1_Lane3_OFF (12)
+ #define DDRDATA7CH0_CR_TXPERBITRANK1_Lane3_WID ( 4)
+ #define DDRDATA7CH0_CR_TXPERBITRANK1_Lane3_MSK (0x0000F000)
+ #define DDRDATA7CH0_CR_TXPERBITRANK1_Lane3_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_TXPERBITRANK1_Lane4_OFF (16)
+ #define DDRDATA7CH0_CR_TXPERBITRANK1_Lane4_WID ( 4)
+ #define DDRDATA7CH0_CR_TXPERBITRANK1_Lane4_MSK (0x000F0000)
+ #define DDRDATA7CH0_CR_TXPERBITRANK1_Lane4_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_TXPERBITRANK1_Lane5_OFF (20)
+ #define DDRDATA7CH0_CR_TXPERBITRANK1_Lane5_WID ( 4)
+ #define DDRDATA7CH0_CR_TXPERBITRANK1_Lane5_MSK (0x00F00000)
+ #define DDRDATA7CH0_CR_TXPERBITRANK1_Lane5_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_TXPERBITRANK1_Lane6_OFF (24)
+ #define DDRDATA7CH0_CR_TXPERBITRANK1_Lane6_WID ( 4)
+ #define DDRDATA7CH0_CR_TXPERBITRANK1_Lane6_MSK (0x0F000000)
+ #define DDRDATA7CH0_CR_TXPERBITRANK1_Lane6_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_TXPERBITRANK1_Lane7_OFF (28)
+ #define DDRDATA7CH0_CR_TXPERBITRANK1_Lane7_WID ( 4)
+ #define DDRDATA7CH0_CR_TXPERBITRANK1_Lane7_MSK (0xF0000000)
+ #define DDRDATA7CH0_CR_TXPERBITRANK1_Lane7_MAX (0x0000000F)
+
+#define DDRDATA7CH0_CR_TXPERBITRANK2_REG (0x00000E38)
+ #define DDRDATA7CH0_CR_TXPERBITRANK2_Lane0_OFF ( 0)
+ #define DDRDATA7CH0_CR_TXPERBITRANK2_Lane0_WID ( 4)
+ #define DDRDATA7CH0_CR_TXPERBITRANK2_Lane0_MSK (0x0000000F)
+ #define DDRDATA7CH0_CR_TXPERBITRANK2_Lane0_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_TXPERBITRANK2_Lane1_OFF ( 4)
+ #define DDRDATA7CH0_CR_TXPERBITRANK2_Lane1_WID ( 4)
+ #define DDRDATA7CH0_CR_TXPERBITRANK2_Lane1_MSK (0x000000F0)
+ #define DDRDATA7CH0_CR_TXPERBITRANK2_Lane1_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_TXPERBITRANK2_Lane2_OFF ( 8)
+ #define DDRDATA7CH0_CR_TXPERBITRANK2_Lane2_WID ( 4)
+ #define DDRDATA7CH0_CR_TXPERBITRANK2_Lane2_MSK (0x00000F00)
+ #define DDRDATA7CH0_CR_TXPERBITRANK2_Lane2_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_TXPERBITRANK2_Lane3_OFF (12)
+ #define DDRDATA7CH0_CR_TXPERBITRANK2_Lane3_WID ( 4)
+ #define DDRDATA7CH0_CR_TXPERBITRANK2_Lane3_MSK (0x0000F000)
+ #define DDRDATA7CH0_CR_TXPERBITRANK2_Lane3_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_TXPERBITRANK2_Lane4_OFF (16)
+ #define DDRDATA7CH0_CR_TXPERBITRANK2_Lane4_WID ( 4)
+ #define DDRDATA7CH0_CR_TXPERBITRANK2_Lane4_MSK (0x000F0000)
+ #define DDRDATA7CH0_CR_TXPERBITRANK2_Lane4_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_TXPERBITRANK2_Lane5_OFF (20)
+ #define DDRDATA7CH0_CR_TXPERBITRANK2_Lane5_WID ( 4)
+ #define DDRDATA7CH0_CR_TXPERBITRANK2_Lane5_MSK (0x00F00000)
+ #define DDRDATA7CH0_CR_TXPERBITRANK2_Lane5_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_TXPERBITRANK2_Lane6_OFF (24)
+ #define DDRDATA7CH0_CR_TXPERBITRANK2_Lane6_WID ( 4)
+ #define DDRDATA7CH0_CR_TXPERBITRANK2_Lane6_MSK (0x0F000000)
+ #define DDRDATA7CH0_CR_TXPERBITRANK2_Lane6_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_TXPERBITRANK2_Lane7_OFF (28)
+ #define DDRDATA7CH0_CR_TXPERBITRANK2_Lane7_WID ( 4)
+ #define DDRDATA7CH0_CR_TXPERBITRANK2_Lane7_MSK (0xF0000000)
+ #define DDRDATA7CH0_CR_TXPERBITRANK2_Lane7_MAX (0x0000000F)
+
+#define DDRDATA7CH0_CR_TXPERBITRANK3_REG (0x00000E3C)
+ #define DDRDATA7CH0_CR_TXPERBITRANK3_Lane0_OFF ( 0)
+ #define DDRDATA7CH0_CR_TXPERBITRANK3_Lane0_WID ( 4)
+ #define DDRDATA7CH0_CR_TXPERBITRANK3_Lane0_MSK (0x0000000F)
+ #define DDRDATA7CH0_CR_TXPERBITRANK3_Lane0_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_TXPERBITRANK3_Lane1_OFF ( 4)
+ #define DDRDATA7CH0_CR_TXPERBITRANK3_Lane1_WID ( 4)
+ #define DDRDATA7CH0_CR_TXPERBITRANK3_Lane1_MSK (0x000000F0)
+ #define DDRDATA7CH0_CR_TXPERBITRANK3_Lane1_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_TXPERBITRANK3_Lane2_OFF ( 8)
+ #define DDRDATA7CH0_CR_TXPERBITRANK3_Lane2_WID ( 4)
+ #define DDRDATA7CH0_CR_TXPERBITRANK3_Lane2_MSK (0x00000F00)
+ #define DDRDATA7CH0_CR_TXPERBITRANK3_Lane2_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_TXPERBITRANK3_Lane3_OFF (12)
+ #define DDRDATA7CH0_CR_TXPERBITRANK3_Lane3_WID ( 4)
+ #define DDRDATA7CH0_CR_TXPERBITRANK3_Lane3_MSK (0x0000F000)
+ #define DDRDATA7CH0_CR_TXPERBITRANK3_Lane3_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_TXPERBITRANK3_Lane4_OFF (16)
+ #define DDRDATA7CH0_CR_TXPERBITRANK3_Lane4_WID ( 4)
+ #define DDRDATA7CH0_CR_TXPERBITRANK3_Lane4_MSK (0x000F0000)
+ #define DDRDATA7CH0_CR_TXPERBITRANK3_Lane4_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_TXPERBITRANK3_Lane5_OFF (20)
+ #define DDRDATA7CH0_CR_TXPERBITRANK3_Lane5_WID ( 4)
+ #define DDRDATA7CH0_CR_TXPERBITRANK3_Lane5_MSK (0x00F00000)
+ #define DDRDATA7CH0_CR_TXPERBITRANK3_Lane5_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_TXPERBITRANK3_Lane6_OFF (24)
+ #define DDRDATA7CH0_CR_TXPERBITRANK3_Lane6_WID ( 4)
+ #define DDRDATA7CH0_CR_TXPERBITRANK3_Lane6_MSK (0x0F000000)
+ #define DDRDATA7CH0_CR_TXPERBITRANK3_Lane6_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_TXPERBITRANK3_Lane7_OFF (28)
+ #define DDRDATA7CH0_CR_TXPERBITRANK3_Lane7_WID ( 4)
+ #define DDRDATA7CH0_CR_TXPERBITRANK3_Lane7_MSK (0xF0000000)
+ #define DDRDATA7CH0_CR_TXPERBITRANK3_Lane7_MAX (0x0000000F)
+
+#define DDRDATA7CH0_CR_RCOMPDATA0_REG (0x00000E40)
+ #define DDRDATA7CH0_CR_RCOMPDATA0_RcompDrvUp_OFF ( 0)
+ #define DDRDATA7CH0_CR_RCOMPDATA0_RcompDrvUp_WID ( 6)
+ #define DDRDATA7CH0_CR_RCOMPDATA0_RcompDrvUp_MSK (0x0000003F)
+ #define DDRDATA7CH0_CR_RCOMPDATA0_RcompDrvUp_MAX (0x0000003F)
+ #define DDRDATA7CH0_CR_RCOMPDATA0_Spare0_OFF ( 6)
+ #define DDRDATA7CH0_CR_RCOMPDATA0_Spare0_WID ( 3)
+ #define DDRDATA7CH0_CR_RCOMPDATA0_Spare0_MSK (0x000001C0)
+ #define DDRDATA7CH0_CR_RCOMPDATA0_Spare0_MAX (0x00000007)
+ #define DDRDATA7CH0_CR_RCOMPDATA0_RcompDrvDown_OFF ( 9)
+ #define DDRDATA7CH0_CR_RCOMPDATA0_RcompDrvDown_WID ( 6)
+ #define DDRDATA7CH0_CR_RCOMPDATA0_RcompDrvDown_MSK (0x00007E00)
+ #define DDRDATA7CH0_CR_RCOMPDATA0_RcompDrvDown_MAX (0x0000003F)
+ #define DDRDATA7CH0_CR_RCOMPDATA0_VTComp_OFF (15)
+ #define DDRDATA7CH0_CR_RCOMPDATA0_VTComp_WID ( 5)
+ #define DDRDATA7CH0_CR_RCOMPDATA0_VTComp_MSK (0x000F8000)
+ #define DDRDATA7CH0_CR_RCOMPDATA0_VTComp_MAX (0x0000001F)
+ #define DDRDATA7CH0_CR_RCOMPDATA0_TcoComp_OFF (20)
+ #define DDRDATA7CH0_CR_RCOMPDATA0_TcoComp_WID ( 6)
+ #define DDRDATA7CH0_CR_RCOMPDATA0_TcoComp_MSK (0x03F00000)
+ #define DDRDATA7CH0_CR_RCOMPDATA0_TcoComp_MAX (0x0000003F)
+ #define DDRDATA7CH0_CR_RCOMPDATA0_SlewRateComp_OFF (26)
+ #define DDRDATA7CH0_CR_RCOMPDATA0_SlewRateComp_WID ( 5)
+ #define DDRDATA7CH0_CR_RCOMPDATA0_SlewRateComp_MSK (0x7C000000)
+ #define DDRDATA7CH0_CR_RCOMPDATA0_SlewRateComp_MAX (0x0000001F)
+ #define DDRDATA7CH0_CR_RCOMPDATA0_Spare2_OFF (31)
+ #define DDRDATA7CH0_CR_RCOMPDATA0_Spare2_WID ( 1)
+ #define DDRDATA7CH0_CR_RCOMPDATA0_Spare2_MSK (0x80000000)
+ #define DDRDATA7CH0_CR_RCOMPDATA0_Spare2_MAX (0x00000001)
+
+#define DDRDATA7CH0_CR_RCOMPDATA1_REG (0x00000E44)
+ #define DDRDATA7CH0_CR_RCOMPDATA1_RcompOdtUp_OFF ( 0)
+ #define DDRDATA7CH0_CR_RCOMPDATA1_RcompOdtUp_WID ( 6)
+ #define DDRDATA7CH0_CR_RCOMPDATA1_RcompOdtUp_MSK (0x0000003F)
+ #define DDRDATA7CH0_CR_RCOMPDATA1_RcompOdtUp_MAX (0x0000003F)
+ #define DDRDATA7CH0_CR_RCOMPDATA1_Spare0_OFF ( 6)
+ #define DDRDATA7CH0_CR_RCOMPDATA1_Spare0_WID ( 3)
+ #define DDRDATA7CH0_CR_RCOMPDATA1_Spare0_MSK (0x000001C0)
+ #define DDRDATA7CH0_CR_RCOMPDATA1_Spare0_MAX (0x00000007)
+ #define DDRDATA7CH0_CR_RCOMPDATA1_RcompOdtDown_OFF ( 9)
+ #define DDRDATA7CH0_CR_RCOMPDATA1_RcompOdtDown_WID ( 6)
+ #define DDRDATA7CH0_CR_RCOMPDATA1_RcompOdtDown_MSK (0x00007E00)
+ #define DDRDATA7CH0_CR_RCOMPDATA1_RcompOdtDown_MAX (0x0000003F)
+ #define DDRDATA7CH0_CR_RCOMPDATA1_Spare1_OFF (15)
+ #define DDRDATA7CH0_CR_RCOMPDATA1_Spare1_WID ( 1)
+ #define DDRDATA7CH0_CR_RCOMPDATA1_Spare1_MSK (0x00008000)
+ #define DDRDATA7CH0_CR_RCOMPDATA1_Spare1_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_RCOMPDATA1_PanicDrvDn_OFF (16)
+ #define DDRDATA7CH0_CR_RCOMPDATA1_PanicDrvDn_WID ( 6)
+ #define DDRDATA7CH0_CR_RCOMPDATA1_PanicDrvDn_MSK (0x003F0000)
+ #define DDRDATA7CH0_CR_RCOMPDATA1_PanicDrvDn_MAX (0x0000003F)
+ #define DDRDATA7CH0_CR_RCOMPDATA1_PanicDrvUp_OFF (22)
+ #define DDRDATA7CH0_CR_RCOMPDATA1_PanicDrvUp_WID ( 6)
+ #define DDRDATA7CH0_CR_RCOMPDATA1_PanicDrvUp_MSK (0x0FC00000)
+ #define DDRDATA7CH0_CR_RCOMPDATA1_PanicDrvUp_MAX (0x0000003F)
+ #define DDRDATA7CH0_CR_RCOMPDATA1_LevelShifterComp_OFF (28)
+ #define DDRDATA7CH0_CR_RCOMPDATA1_LevelShifterComp_WID ( 3)
+ #define DDRDATA7CH0_CR_RCOMPDATA1_LevelShifterComp_MSK (0x70000000)
+ #define DDRDATA7CH0_CR_RCOMPDATA1_LevelShifterComp_MAX (0x00000007)
+ #define DDRDATA7CH0_CR_RCOMPDATA1_Spare2_OFF (31)
+ #define DDRDATA7CH0_CR_RCOMPDATA1_Spare2_WID ( 1)
+ #define DDRDATA7CH0_CR_RCOMPDATA1_Spare2_MSK (0x80000000)
+ #define DDRDATA7CH0_CR_RCOMPDATA1_Spare2_MAX (0x00000001)
+
+#define DDRDATA7CH0_CR_TXXTALK_REG (0x00000E48)
+ #define DDRDATA7CH0_CR_TXXTALK_Lane0_OFF ( 0)
+ #define DDRDATA7CH0_CR_TXXTALK_Lane0_WID ( 4)
+ #define DDRDATA7CH0_CR_TXXTALK_Lane0_MSK (0x0000000F)
+ #define DDRDATA7CH0_CR_TXXTALK_Lane0_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_TXXTALK_Lane1_OFF ( 4)
+ #define DDRDATA7CH0_CR_TXXTALK_Lane1_WID ( 4)
+ #define DDRDATA7CH0_CR_TXXTALK_Lane1_MSK (0x000000F0)
+ #define DDRDATA7CH0_CR_TXXTALK_Lane1_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_TXXTALK_Lane2_OFF ( 8)
+ #define DDRDATA7CH0_CR_TXXTALK_Lane2_WID ( 4)
+ #define DDRDATA7CH0_CR_TXXTALK_Lane2_MSK (0x00000F00)
+ #define DDRDATA7CH0_CR_TXXTALK_Lane2_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_TXXTALK_Lane3_OFF (12)
+ #define DDRDATA7CH0_CR_TXXTALK_Lane3_WID ( 4)
+ #define DDRDATA7CH0_CR_TXXTALK_Lane3_MSK (0x0000F000)
+ #define DDRDATA7CH0_CR_TXXTALK_Lane3_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_TXXTALK_Lane4_OFF (16)
+ #define DDRDATA7CH0_CR_TXXTALK_Lane4_WID ( 4)
+ #define DDRDATA7CH0_CR_TXXTALK_Lane4_MSK (0x000F0000)
+ #define DDRDATA7CH0_CR_TXXTALK_Lane4_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_TXXTALK_Lane5_OFF (20)
+ #define DDRDATA7CH0_CR_TXXTALK_Lane5_WID ( 4)
+ #define DDRDATA7CH0_CR_TXXTALK_Lane5_MSK (0x00F00000)
+ #define DDRDATA7CH0_CR_TXXTALK_Lane5_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_TXXTALK_Lane6_OFF (24)
+ #define DDRDATA7CH0_CR_TXXTALK_Lane6_WID ( 4)
+ #define DDRDATA7CH0_CR_TXXTALK_Lane6_MSK (0x0F000000)
+ #define DDRDATA7CH0_CR_TXXTALK_Lane6_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_TXXTALK_Lane7_OFF (28)
+ #define DDRDATA7CH0_CR_TXXTALK_Lane7_WID ( 4)
+ #define DDRDATA7CH0_CR_TXXTALK_Lane7_MSK (0xF0000000)
+ #define DDRDATA7CH0_CR_TXXTALK_Lane7_MAX (0x0000000F)
+
+#define DDRDATA7CH0_CR_RXOFFSETVDQ_REG (0x00000E4C)
+ #define DDRDATA7CH0_CR_RXOFFSETVDQ_Lane0_OFF ( 0)
+ #define DDRDATA7CH0_CR_RXOFFSETVDQ_Lane0_WID ( 4)
+ #define DDRDATA7CH0_CR_RXOFFSETVDQ_Lane0_MSK (0x0000000F)
+ #define DDRDATA7CH0_CR_RXOFFSETVDQ_Lane0_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_RXOFFSETVDQ_Lane1_OFF ( 4)
+ #define DDRDATA7CH0_CR_RXOFFSETVDQ_Lane1_WID ( 4)
+ #define DDRDATA7CH0_CR_RXOFFSETVDQ_Lane1_MSK (0x000000F0)
+ #define DDRDATA7CH0_CR_RXOFFSETVDQ_Lane1_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_RXOFFSETVDQ_Lane2_OFF ( 8)
+ #define DDRDATA7CH0_CR_RXOFFSETVDQ_Lane2_WID ( 4)
+ #define DDRDATA7CH0_CR_RXOFFSETVDQ_Lane2_MSK (0x00000F00)
+ #define DDRDATA7CH0_CR_RXOFFSETVDQ_Lane2_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_RXOFFSETVDQ_Lane3_OFF (12)
+ #define DDRDATA7CH0_CR_RXOFFSETVDQ_Lane3_WID ( 4)
+ #define DDRDATA7CH0_CR_RXOFFSETVDQ_Lane3_MSK (0x0000F000)
+ #define DDRDATA7CH0_CR_RXOFFSETVDQ_Lane3_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_RXOFFSETVDQ_Lane4_OFF (16)
+ #define DDRDATA7CH0_CR_RXOFFSETVDQ_Lane4_WID ( 4)
+ #define DDRDATA7CH0_CR_RXOFFSETVDQ_Lane4_MSK (0x000F0000)
+ #define DDRDATA7CH0_CR_RXOFFSETVDQ_Lane4_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_RXOFFSETVDQ_Lane5_OFF (20)
+ #define DDRDATA7CH0_CR_RXOFFSETVDQ_Lane5_WID ( 4)
+ #define DDRDATA7CH0_CR_RXOFFSETVDQ_Lane5_MSK (0x00F00000)
+ #define DDRDATA7CH0_CR_RXOFFSETVDQ_Lane5_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_RXOFFSETVDQ_Lane6_OFF (24)
+ #define DDRDATA7CH0_CR_RXOFFSETVDQ_Lane6_WID ( 4)
+ #define DDRDATA7CH0_CR_RXOFFSETVDQ_Lane6_MSK (0x0F000000)
+ #define DDRDATA7CH0_CR_RXOFFSETVDQ_Lane6_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_RXOFFSETVDQ_Lane7_OFF (28)
+ #define DDRDATA7CH0_CR_RXOFFSETVDQ_Lane7_WID ( 4)
+ #define DDRDATA7CH0_CR_RXOFFSETVDQ_Lane7_MSK (0xF0000000)
+ #define DDRDATA7CH0_CR_RXOFFSETVDQ_Lane7_MAX (0x0000000F)
+
+#define DDRDATA7CH0_CR_DDRDATARESERVED_REG (0x00000E50)
+ #define DDRDATA7CH0_CR_DDRDATARESERVED_Spare_OFF ( 0)
+ #define DDRDATA7CH0_CR_DDRDATARESERVED_Spare_WID (32)
+ #define DDRDATA7CH0_CR_DDRDATARESERVED_Spare_MSK (0xFFFFFFFF)
+ #define DDRDATA7CH0_CR_DDRDATARESERVED_Spare_MAX (0xFFFFFFFF)
+
+#define DDRDATA7CH0_CR_DATATRAINFEEDBACK_REG (0x00000E54)
+ #define DDRDATA7CH0_CR_DATATRAINFEEDBACK_DataTrainFeedback_OFF ( 0)
+ #define DDRDATA7CH0_CR_DATATRAINFEEDBACK_DataTrainFeedback_WID ( 9)
+ #define DDRDATA7CH0_CR_DATATRAINFEEDBACK_DataTrainFeedback_MSK (0x000001FF)
+ #define DDRDATA7CH0_CR_DATATRAINFEEDBACK_DataTrainFeedback_MAX (0x000001FF)
+ #define DDRDATA7CH0_CR_DATATRAINFEEDBACK_Spare_OFF ( 9)
+ #define DDRDATA7CH0_CR_DATATRAINFEEDBACK_Spare_WID (23)
+ #define DDRDATA7CH0_CR_DATATRAINFEEDBACK_Spare_MSK (0xFFFFFE00)
+ #define DDRDATA7CH0_CR_DATATRAINFEEDBACK_Spare_MAX (0x007FFFFF)
+
+#define DDRDATA7CH0_CR_DLLPITESTANDADC_REG (0x00000E58)
+ #define DDRDATA7CH0_CR_DLLPITESTANDADC_RunTest_OFF ( 0)
+ #define DDRDATA7CH0_CR_DLLPITESTANDADC_RunTest_WID ( 1)
+ #define DDRDATA7CH0_CR_DLLPITESTANDADC_RunTest_MSK (0x00000001)
+ #define DDRDATA7CH0_CR_DLLPITESTANDADC_RunTest_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DLLPITESTANDADC_RunTest_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DLLPITESTANDADC_Load_OFF ( 1)
+ #define DDRDATA7CH0_CR_DLLPITESTANDADC_Load_WID ( 1)
+ #define DDRDATA7CH0_CR_DLLPITESTANDADC_Load_MSK (0x00000002)
+ #define DDRDATA7CH0_CR_DLLPITESTANDADC_Load_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DLLPITESTANDADC_Load_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DLLPITESTANDADC_ModeHVM_OFF ( 2)
+ #define DDRDATA7CH0_CR_DLLPITESTANDADC_ModeHVM_WID ( 1)
+ #define DDRDATA7CH0_CR_DLLPITESTANDADC_ModeHVM_MSK (0x00000004)
+ #define DDRDATA7CH0_CR_DLLPITESTANDADC_ModeHVM_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DLLPITESTANDADC_ModeHVM_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DLLPITESTANDADC_ModeDV_OFF ( 3)
+ #define DDRDATA7CH0_CR_DLLPITESTANDADC_ModeDV_WID ( 1)
+ #define DDRDATA7CH0_CR_DLLPITESTANDADC_ModeDV_MSK (0x00000008)
+ #define DDRDATA7CH0_CR_DLLPITESTANDADC_ModeDV_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DLLPITESTANDADC_ModeDV_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DLLPITESTANDADC_ModeADC_OFF ( 4)
+ #define DDRDATA7CH0_CR_DLLPITESTANDADC_ModeADC_WID ( 1)
+ #define DDRDATA7CH0_CR_DLLPITESTANDADC_ModeADC_MSK (0x00000010)
+ #define DDRDATA7CH0_CR_DLLPITESTANDADC_ModeADC_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DLLPITESTANDADC_ModeADC_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DLLPITESTANDADC_LoadCount_OFF ( 5)
+ #define DDRDATA7CH0_CR_DLLPITESTANDADC_LoadCount_WID (10)
+ #define DDRDATA7CH0_CR_DLLPITESTANDADC_LoadCount_MSK (0x00007FE0)
+ #define DDRDATA7CH0_CR_DLLPITESTANDADC_LoadCount_MAX (0x000003FF)
+ #define DDRDATA7CH0_CR_DLLPITESTANDADC_CountStatus_OFF (15)
+ #define DDRDATA7CH0_CR_DLLPITESTANDADC_CountStatus_WID (10)
+ #define DDRDATA7CH0_CR_DLLPITESTANDADC_CountStatus_MSK (0x01FF8000)
+ #define DDRDATA7CH0_CR_DLLPITESTANDADC_CountStatus_MAX (0x000003FF)
+ #define DDRDATA7CH0_CR_DLLPITESTANDADC_CountStatus_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DLLPITESTANDADC_Spare_OFF (25)
+ #define DDRDATA7CH0_CR_DLLPITESTANDADC_Spare_WID ( 7)
+ #define DDRDATA7CH0_CR_DLLPITESTANDADC_Spare_MSK (0xFE000000)
+ #define DDRDATA7CH0_CR_DLLPITESTANDADC_Spare_MAX (0x0000007F)
+
+#define DDRDATA7CH0_CR_DDRCRDATAOFFSETCOMP_REG (0x00000E5C)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_OFF ( 0)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_WID ( 6)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_MSK (0x0000003F)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_MAX (0x0000003F)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_OFF ( 6)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_WID ( 6)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_MSK (0x00000FC0)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_MAX (0x0000003F)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_OFF (12)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_WID ( 5)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_MSK (0x0001F000)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_MAX (0x0000001F)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_OFF (17)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_WID ( 5)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_MSK (0x003E0000)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_MAX (0x0000001F)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_OFF (22)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_WID ( 5)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_MSK (0x07C00000)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_MAX (0x0000001F)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_OFF (27)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_WID ( 5)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_MSK (0xF8000000)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_MAX (0x0000001F)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_DEF (0x00000000)
+
+#define DDRDATA7CH0_CR_DDRCRDATACONTROL1_REG (0x00000E60)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_RefPi_OFF ( 0)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_RefPi_WID ( 4)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_RefPi_MSK (0x0000000F)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_RefPi_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_RefPi_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_DllMask_OFF ( 4)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_DllMask_WID ( 2)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_DllMask_MSK (0x00000030)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_DllMask_MAX (0x00000003)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_DllMask_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_DllWeakLock_OFF ( 6)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_DllWeakLock_WID ( 1)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_DllWeakLock_MSK (0x00000040)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_DllWeakLock_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_DllWeakLock_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_OFF ( 7)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_WID ( 3)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_MSK (0x00000380)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_MAX (0x00000007)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_OFF (10)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_WID ( 3)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_MSK (0x00001C00)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_MAX (0x00000007)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_OdtDelay_OFF (13)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_OdtDelay_WID ( 4)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_OdtDelay_MSK (0x0001E000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_OdtDelay_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_OdtDelay_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_OdtDuration_OFF (17)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_OdtDuration_WID ( 3)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_OdtDuration_MSK (0x000E0000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_OdtDuration_MAX (0x00000007)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_OdtDuration_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_OFF (20)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_WID ( 4)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_MSK (0x00F00000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_OFF (24)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_WID ( 3)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_MSK (0x07000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_MAX (0x00000007)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_OFF (27)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_WID ( 3)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_MSK (0x38000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_MAX (0x00000007)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_OFF (30)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_WID ( 1)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_MSK (0x40000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_Rsvd1_OFF (31)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_Rsvd1_WID ( 1)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_Rsvd1_MSK (0x80000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_Rsvd1_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL1_Rsvd1_DEF (0x00000000)
+
+#define DDRDATA7CH0_CR_DDRCRDATACONTROL2_REG (0x00000E64)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_OFF ( 0)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_WID ( 5)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_MSK (0x0000001F)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_MAX (0x0000001F)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_OFF ( 5)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_WID ( 1)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_MSK (0x00000020)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL2_ForceRxOn_OFF ( 6)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL2_ForceRxOn_WID ( 1)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL2_ForceRxOn_MSK (0x00000040)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL2_ForceRxOn_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL2_ForceRxOn_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL2_LeakerComp_OFF ( 7)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL2_LeakerComp_WID ( 2)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL2_LeakerComp_MSK (0x00000180)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL2_LeakerComp_MAX (0x00000003)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL2_LeakerComp_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_OFF ( 9)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_WID ( 4)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_MSK (0x00001E00)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_MAX (0x0000000F)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_DEF (0x00000008)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_OFF (13)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_WID ( 5)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_MSK (0x0003E000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_MAX (0x0000001F)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_DEF (0x00000011)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_OFF (18)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_WID ( 1)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_MSK (0x00040000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL2_Spare_OFF (19)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL2_Spare_WID (13)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL2_Spare_MSK (0xFFF80000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL2_Spare_MAX (0x00001FFF)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL2_Spare_DEF (0x00000000)
+
+#define DDRDATA7CH0_CR_DDRCRVSSHIORVREFCONTROL_REG (0x00000E6C)
+ #define DDRDATA7CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_OFF ( 0)
+ #define DDRDATA7CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_WID (24)
+ #define DDRDATA7CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_MSK (0x00FFFFFF)
+ #define DDRDATA7CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_MAX (0x00FFFFFF)
+ #define DDRDATA7CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_OFF (24)
+ #define DDRDATA7CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_WID ( 8)
+ #define DDRDATA7CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_MSK (0xFF000000)
+ #define DDRDATA7CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_MAX (0x000000FF)
+ #define DDRDATA7CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_DEF (0x00000000)
+
+#define DDRDATA7CH0_CR_DDRCRDATAOFFSETTRAIN_REG (0x00000E70)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_OFF ( 0)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_WID ( 6)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_MSK (0x0000003F)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_MAX (0x0000003F)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_OFF ( 6)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_WID ( 6)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_MSK (0x00000FC0)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_MAX (0x0000003F)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_OFF (12)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_WID ( 6)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_MSK (0x0003F000)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_MAX (0x0000003F)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_OFF (18)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_WID ( 6)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_MSK (0x00FC0000)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_MAX (0x0000003F)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_OFF (24)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_WID ( 7)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_MSK (0x7F000000)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_MAX (0x0000007F)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_OFF (31)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_WID ( 1)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_MSK (0x80000000)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_DEF (0x00000000)
+
+#define DDRDATA7CH0_CR_DDRCRDATACONTROL0_REG (0x00000E74)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_OFF ( 0)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_WID ( 1)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_MSK (0x00000001)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_OFF ( 1)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_WID ( 1)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_MSK (0x00000002)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_OFF ( 2)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_WID ( 1)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_MSK (0x00000004)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_OFF ( 3)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_WID ( 1)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_MSK (0x00000008)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_TxOn_OFF ( 4)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_TxOn_WID ( 1)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_TxOn_MSK (0x00000010)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_TxOn_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_TxOn_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_RfOn_OFF ( 5)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_RfOn_WID ( 1)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_RfOn_MSK (0x00000020)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_RfOn_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_RfOn_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_RxPiOn_OFF ( 6)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_RxPiOn_WID ( 1)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_RxPiOn_MSK (0x00000040)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_RxPiOn_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_RxPiOn_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_TxPiOn_OFF ( 7)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_TxPiOn_WID ( 1)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_TxPiOn_MSK (0x00000080)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_TxPiOn_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_TxPiOn_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_OFF ( 8)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_WID ( 1)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_MSK (0x00000100)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_OFF ( 9)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_WID ( 1)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_MSK (0x00000200)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_TxDisable_OFF (10)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_TxDisable_WID ( 1)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_TxDisable_MSK (0x00000400)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_TxDisable_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_TxDisable_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_RxDisable_OFF (11)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_RxDisable_WID ( 1)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_RxDisable_MSK (0x00000800)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_RxDisable_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_RxDisable_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_TxLong_OFF (12)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_TxLong_WID ( 1)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_TxLong_MSK (0x00001000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_TxLong_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_TxLong_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_OFF (13)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_WID ( 2)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_MSK (0x00006000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_MAX (0x00000003)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_RxReadPointer_OFF (15)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_RxReadPointer_WID ( 3)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_RxReadPointer_MSK (0x00038000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_RxReadPointer_MAX (0x00000007)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_RxReadPointer_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_OFF (18)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_WID ( 1)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_MSK (0x00040000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_OFF (19)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_WID ( 1)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_MSK (0x00080000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_ReadRFRd_OFF (20)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_ReadRFRd_WID ( 1)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_ReadRFRd_MSK (0x00100000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_ReadRFRd_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_ReadRFRd_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_ReadRFWr_OFF (21)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_ReadRFWr_WID ( 1)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_ReadRFWr_MSK (0x00200000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_ReadRFWr_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_ReadRFWr_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_ReadRFRank_OFF (22)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_ReadRFRank_WID ( 2)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_ReadRFRank_MSK (0x00C00000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_ReadRFRank_MAX (0x00000003)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_ReadRFRank_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_OFF (24)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_WID ( 1)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_MSK (0x01000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_OdtSampOff_OFF (25)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_OdtSampOff_WID ( 1)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_OdtSampOff_MSK (0x02000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_OdtSampOff_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_OdtSampOff_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_OFF (26)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_WID ( 1)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_MSK (0x04000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_OFF (27)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_WID ( 1)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_MSK (0x08000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_OFF (28)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_WID ( 1)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_MSK (0x10000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_OFF (29)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_WID ( 1)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_MSK (0x20000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_OFF (30)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_WID ( 1)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_MSK (0x40000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_OFF (31)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_WID ( 1)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_MSK (0x80000000)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_DEF (0x00000000)
+
+#define DDRDATA7CH0_CR_DDRCRVREFADJUST1_REG (0x00000E78)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_OFF ( 0)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_WID ( 7)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_MSK (0x0000007F)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_MAX (0x0000007F)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_OFF ( 7)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_WID ( 7)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_MSK (0x00003F80)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_MAX (0x0000007F)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_OFF (14)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_WID ( 7)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_MSK (0x001FC000)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_MAX (0x0000007F)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_OFF (21)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_WID ( 1)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_MSK (0x00200000)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_OFF (22)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_WID ( 1)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_MSK (0x00400000)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_OFF (23)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_WID ( 1)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_MSK (0x00800000)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_OFF (24)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_WID ( 2)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_MSK (0x03000000)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_MAX (0x00000003)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_OFF (26)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_WID ( 1)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_MSK (0x04000000)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_Rsvd_OFF (27)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_Rsvd_WID ( 2)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_Rsvd_MSK (0x18000000)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_Rsvd_MAX (0x00000003)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_Rsvd_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_caSlowBW_OFF (29)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_caSlowBW_WID ( 1)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_caSlowBW_MSK (0x20000000)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_caSlowBW_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_caSlowBW_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_OFF (30)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_WID ( 1)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_MSK (0x40000000)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_DEF (0x00000000)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_OFF (31)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_WID ( 1)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_MSK (0x80000000)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_MAX (0x00000001)
+ #define DDRDATA7CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_DEF (0x00000000)
+
+#define DDRDATA7CH1_CR_RXTRAINRANK0_REG (0x00000F00)
+ #define DDRDATA7CH1_CR_RXTRAINRANK0_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA7CH1_CR_RXTRAINRANK0_RxRcvEnPi_WID ( 9)
+ #define DDRDATA7CH1_CR_RXTRAINRANK0_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA7CH1_CR_RXTRAINRANK0_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA7CH1_CR_RXTRAINRANK0_RxDqsPPi_OFF ( 9)
+ #define DDRDATA7CH1_CR_RXTRAINRANK0_RxDqsPPi_WID ( 6)
+ #define DDRDATA7CH1_CR_RXTRAINRANK0_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA7CH1_CR_RXTRAINRANK0_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA7CH1_CR_RXTRAINRANK0_RxEq_OFF (15)
+ #define DDRDATA7CH1_CR_RXTRAINRANK0_RxEq_WID ( 5)
+ #define DDRDATA7CH1_CR_RXTRAINRANK0_RxEq_MSK (0x000F8000)
+ #define DDRDATA7CH1_CR_RXTRAINRANK0_RxEq_MAX (0x0000001F)
+ #define DDRDATA7CH1_CR_RXTRAINRANK0_RxDqsNPi_OFF (20)
+ #define DDRDATA7CH1_CR_RXTRAINRANK0_RxDqsNPi_WID ( 6)
+ #define DDRDATA7CH1_CR_RXTRAINRANK0_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA7CH1_CR_RXTRAINRANK0_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA7CH1_CR_RXTRAINRANK0_RxVref_OFF (26)
+ #define DDRDATA7CH1_CR_RXTRAINRANK0_RxVref_WID ( 6)
+ #define DDRDATA7CH1_CR_RXTRAINRANK0_RxVref_MSK (0xFC000000)
+ #define DDRDATA7CH1_CR_RXTRAINRANK0_RxVref_MAX (0x0000003F)
+
+#define DDRDATA7CH1_CR_RXTRAINRANK1_REG (0x00000F04)
+ #define DDRDATA7CH1_CR_RXTRAINRANK1_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA7CH1_CR_RXTRAINRANK1_RxRcvEnPi_WID ( 9)
+ #define DDRDATA7CH1_CR_RXTRAINRANK1_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA7CH1_CR_RXTRAINRANK1_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA7CH1_CR_RXTRAINRANK1_RxDqsPPi_OFF ( 9)
+ #define DDRDATA7CH1_CR_RXTRAINRANK1_RxDqsPPi_WID ( 6)
+ #define DDRDATA7CH1_CR_RXTRAINRANK1_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA7CH1_CR_RXTRAINRANK1_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA7CH1_CR_RXTRAINRANK1_RxEq_OFF (15)
+ #define DDRDATA7CH1_CR_RXTRAINRANK1_RxEq_WID ( 5)
+ #define DDRDATA7CH1_CR_RXTRAINRANK1_RxEq_MSK (0x000F8000)
+ #define DDRDATA7CH1_CR_RXTRAINRANK1_RxEq_MAX (0x0000001F)
+ #define DDRDATA7CH1_CR_RXTRAINRANK1_RxDqsNPi_OFF (20)
+ #define DDRDATA7CH1_CR_RXTRAINRANK1_RxDqsNPi_WID ( 6)
+ #define DDRDATA7CH1_CR_RXTRAINRANK1_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA7CH1_CR_RXTRAINRANK1_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA7CH1_CR_RXTRAINRANK1_RxVref_OFF (26)
+ #define DDRDATA7CH1_CR_RXTRAINRANK1_RxVref_WID ( 6)
+ #define DDRDATA7CH1_CR_RXTRAINRANK1_RxVref_MSK (0xFC000000)
+ #define DDRDATA7CH1_CR_RXTRAINRANK1_RxVref_MAX (0x0000003F)
+
+#define DDRDATA7CH1_CR_RXTRAINRANK2_REG (0x00000F08)
+ #define DDRDATA7CH1_CR_RXTRAINRANK2_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA7CH1_CR_RXTRAINRANK2_RxRcvEnPi_WID ( 9)
+ #define DDRDATA7CH1_CR_RXTRAINRANK2_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA7CH1_CR_RXTRAINRANK2_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA7CH1_CR_RXTRAINRANK2_RxDqsPPi_OFF ( 9)
+ #define DDRDATA7CH1_CR_RXTRAINRANK2_RxDqsPPi_WID ( 6)
+ #define DDRDATA7CH1_CR_RXTRAINRANK2_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA7CH1_CR_RXTRAINRANK2_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA7CH1_CR_RXTRAINRANK2_RxEq_OFF (15)
+ #define DDRDATA7CH1_CR_RXTRAINRANK2_RxEq_WID ( 5)
+ #define DDRDATA7CH1_CR_RXTRAINRANK2_RxEq_MSK (0x000F8000)
+ #define DDRDATA7CH1_CR_RXTRAINRANK2_RxEq_MAX (0x0000001F)
+ #define DDRDATA7CH1_CR_RXTRAINRANK2_RxDqsNPi_OFF (20)
+ #define DDRDATA7CH1_CR_RXTRAINRANK2_RxDqsNPi_WID ( 6)
+ #define DDRDATA7CH1_CR_RXTRAINRANK2_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA7CH1_CR_RXTRAINRANK2_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA7CH1_CR_RXTRAINRANK2_RxVref_OFF (26)
+ #define DDRDATA7CH1_CR_RXTRAINRANK2_RxVref_WID ( 6)
+ #define DDRDATA7CH1_CR_RXTRAINRANK2_RxVref_MSK (0xFC000000)
+ #define DDRDATA7CH1_CR_RXTRAINRANK2_RxVref_MAX (0x0000003F)
+
+#define DDRDATA7CH1_CR_RXTRAINRANK3_REG (0x00000F0C)
+ #define DDRDATA7CH1_CR_RXTRAINRANK3_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA7CH1_CR_RXTRAINRANK3_RxRcvEnPi_WID ( 9)
+ #define DDRDATA7CH1_CR_RXTRAINRANK3_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA7CH1_CR_RXTRAINRANK3_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA7CH1_CR_RXTRAINRANK3_RxDqsPPi_OFF ( 9)
+ #define DDRDATA7CH1_CR_RXTRAINRANK3_RxDqsPPi_WID ( 6)
+ #define DDRDATA7CH1_CR_RXTRAINRANK3_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA7CH1_CR_RXTRAINRANK3_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA7CH1_CR_RXTRAINRANK3_RxEq_OFF (15)
+ #define DDRDATA7CH1_CR_RXTRAINRANK3_RxEq_WID ( 5)
+ #define DDRDATA7CH1_CR_RXTRAINRANK3_RxEq_MSK (0x000F8000)
+ #define DDRDATA7CH1_CR_RXTRAINRANK3_RxEq_MAX (0x0000001F)
+ #define DDRDATA7CH1_CR_RXTRAINRANK3_RxDqsNPi_OFF (20)
+ #define DDRDATA7CH1_CR_RXTRAINRANK3_RxDqsNPi_WID ( 6)
+ #define DDRDATA7CH1_CR_RXTRAINRANK3_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA7CH1_CR_RXTRAINRANK3_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA7CH1_CR_RXTRAINRANK3_RxVref_OFF (26)
+ #define DDRDATA7CH1_CR_RXTRAINRANK3_RxVref_WID ( 6)
+ #define DDRDATA7CH1_CR_RXTRAINRANK3_RxVref_MSK (0xFC000000)
+ #define DDRDATA7CH1_CR_RXTRAINRANK3_RxVref_MAX (0x0000003F)
+
+#define DDRDATA7CH1_CR_RXPERBITRANK0_REG (0x00000F10)
+ #define DDRDATA7CH1_CR_RXPERBITRANK0_Lane0_OFF ( 0)
+ #define DDRDATA7CH1_CR_RXPERBITRANK0_Lane0_WID ( 4)
+ #define DDRDATA7CH1_CR_RXPERBITRANK0_Lane0_MSK (0x0000000F)
+ #define DDRDATA7CH1_CR_RXPERBITRANK0_Lane0_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_RXPERBITRANK0_Lane1_OFF ( 4)
+ #define DDRDATA7CH1_CR_RXPERBITRANK0_Lane1_WID ( 4)
+ #define DDRDATA7CH1_CR_RXPERBITRANK0_Lane1_MSK (0x000000F0)
+ #define DDRDATA7CH1_CR_RXPERBITRANK0_Lane1_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_RXPERBITRANK0_Lane2_OFF ( 8)
+ #define DDRDATA7CH1_CR_RXPERBITRANK0_Lane2_WID ( 4)
+ #define DDRDATA7CH1_CR_RXPERBITRANK0_Lane2_MSK (0x00000F00)
+ #define DDRDATA7CH1_CR_RXPERBITRANK0_Lane2_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_RXPERBITRANK0_Lane3_OFF (12)
+ #define DDRDATA7CH1_CR_RXPERBITRANK0_Lane3_WID ( 4)
+ #define DDRDATA7CH1_CR_RXPERBITRANK0_Lane3_MSK (0x0000F000)
+ #define DDRDATA7CH1_CR_RXPERBITRANK0_Lane3_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_RXPERBITRANK0_Lane4_OFF (16)
+ #define DDRDATA7CH1_CR_RXPERBITRANK0_Lane4_WID ( 4)
+ #define DDRDATA7CH1_CR_RXPERBITRANK0_Lane4_MSK (0x000F0000)
+ #define DDRDATA7CH1_CR_RXPERBITRANK0_Lane4_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_RXPERBITRANK0_Lane5_OFF (20)
+ #define DDRDATA7CH1_CR_RXPERBITRANK0_Lane5_WID ( 4)
+ #define DDRDATA7CH1_CR_RXPERBITRANK0_Lane5_MSK (0x00F00000)
+ #define DDRDATA7CH1_CR_RXPERBITRANK0_Lane5_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_RXPERBITRANK0_Lane6_OFF (24)
+ #define DDRDATA7CH1_CR_RXPERBITRANK0_Lane6_WID ( 4)
+ #define DDRDATA7CH1_CR_RXPERBITRANK0_Lane6_MSK (0x0F000000)
+ #define DDRDATA7CH1_CR_RXPERBITRANK0_Lane6_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_RXPERBITRANK0_Lane7_OFF (28)
+ #define DDRDATA7CH1_CR_RXPERBITRANK0_Lane7_WID ( 4)
+ #define DDRDATA7CH1_CR_RXPERBITRANK0_Lane7_MSK (0xF0000000)
+ #define DDRDATA7CH1_CR_RXPERBITRANK0_Lane7_MAX (0x0000000F)
+
+#define DDRDATA7CH1_CR_RXPERBITRANK1_REG (0x00000F14)
+ #define DDRDATA7CH1_CR_RXPERBITRANK1_Lane0_OFF ( 0)
+ #define DDRDATA7CH1_CR_RXPERBITRANK1_Lane0_WID ( 4)
+ #define DDRDATA7CH1_CR_RXPERBITRANK1_Lane0_MSK (0x0000000F)
+ #define DDRDATA7CH1_CR_RXPERBITRANK1_Lane0_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_RXPERBITRANK1_Lane1_OFF ( 4)
+ #define DDRDATA7CH1_CR_RXPERBITRANK1_Lane1_WID ( 4)
+ #define DDRDATA7CH1_CR_RXPERBITRANK1_Lane1_MSK (0x000000F0)
+ #define DDRDATA7CH1_CR_RXPERBITRANK1_Lane1_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_RXPERBITRANK1_Lane2_OFF ( 8)
+ #define DDRDATA7CH1_CR_RXPERBITRANK1_Lane2_WID ( 4)
+ #define DDRDATA7CH1_CR_RXPERBITRANK1_Lane2_MSK (0x00000F00)
+ #define DDRDATA7CH1_CR_RXPERBITRANK1_Lane2_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_RXPERBITRANK1_Lane3_OFF (12)
+ #define DDRDATA7CH1_CR_RXPERBITRANK1_Lane3_WID ( 4)
+ #define DDRDATA7CH1_CR_RXPERBITRANK1_Lane3_MSK (0x0000F000)
+ #define DDRDATA7CH1_CR_RXPERBITRANK1_Lane3_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_RXPERBITRANK1_Lane4_OFF (16)
+ #define DDRDATA7CH1_CR_RXPERBITRANK1_Lane4_WID ( 4)
+ #define DDRDATA7CH1_CR_RXPERBITRANK1_Lane4_MSK (0x000F0000)
+ #define DDRDATA7CH1_CR_RXPERBITRANK1_Lane4_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_RXPERBITRANK1_Lane5_OFF (20)
+ #define DDRDATA7CH1_CR_RXPERBITRANK1_Lane5_WID ( 4)
+ #define DDRDATA7CH1_CR_RXPERBITRANK1_Lane5_MSK (0x00F00000)
+ #define DDRDATA7CH1_CR_RXPERBITRANK1_Lane5_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_RXPERBITRANK1_Lane6_OFF (24)
+ #define DDRDATA7CH1_CR_RXPERBITRANK1_Lane6_WID ( 4)
+ #define DDRDATA7CH1_CR_RXPERBITRANK1_Lane6_MSK (0x0F000000)
+ #define DDRDATA7CH1_CR_RXPERBITRANK1_Lane6_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_RXPERBITRANK1_Lane7_OFF (28)
+ #define DDRDATA7CH1_CR_RXPERBITRANK1_Lane7_WID ( 4)
+ #define DDRDATA7CH1_CR_RXPERBITRANK1_Lane7_MSK (0xF0000000)
+ #define DDRDATA7CH1_CR_RXPERBITRANK1_Lane7_MAX (0x0000000F)
+
+#define DDRDATA7CH1_CR_RXPERBITRANK2_REG (0x00000F18)
+ #define DDRDATA7CH1_CR_RXPERBITRANK2_Lane0_OFF ( 0)
+ #define DDRDATA7CH1_CR_RXPERBITRANK2_Lane0_WID ( 4)
+ #define DDRDATA7CH1_CR_RXPERBITRANK2_Lane0_MSK (0x0000000F)
+ #define DDRDATA7CH1_CR_RXPERBITRANK2_Lane0_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_RXPERBITRANK2_Lane1_OFF ( 4)
+ #define DDRDATA7CH1_CR_RXPERBITRANK2_Lane1_WID ( 4)
+ #define DDRDATA7CH1_CR_RXPERBITRANK2_Lane1_MSK (0x000000F0)
+ #define DDRDATA7CH1_CR_RXPERBITRANK2_Lane1_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_RXPERBITRANK2_Lane2_OFF ( 8)
+ #define DDRDATA7CH1_CR_RXPERBITRANK2_Lane2_WID ( 4)
+ #define DDRDATA7CH1_CR_RXPERBITRANK2_Lane2_MSK (0x00000F00)
+ #define DDRDATA7CH1_CR_RXPERBITRANK2_Lane2_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_RXPERBITRANK2_Lane3_OFF (12)
+ #define DDRDATA7CH1_CR_RXPERBITRANK2_Lane3_WID ( 4)
+ #define DDRDATA7CH1_CR_RXPERBITRANK2_Lane3_MSK (0x0000F000)
+ #define DDRDATA7CH1_CR_RXPERBITRANK2_Lane3_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_RXPERBITRANK2_Lane4_OFF (16)
+ #define DDRDATA7CH1_CR_RXPERBITRANK2_Lane4_WID ( 4)
+ #define DDRDATA7CH1_CR_RXPERBITRANK2_Lane4_MSK (0x000F0000)
+ #define DDRDATA7CH1_CR_RXPERBITRANK2_Lane4_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_RXPERBITRANK2_Lane5_OFF (20)
+ #define DDRDATA7CH1_CR_RXPERBITRANK2_Lane5_WID ( 4)
+ #define DDRDATA7CH1_CR_RXPERBITRANK2_Lane5_MSK (0x00F00000)
+ #define DDRDATA7CH1_CR_RXPERBITRANK2_Lane5_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_RXPERBITRANK2_Lane6_OFF (24)
+ #define DDRDATA7CH1_CR_RXPERBITRANK2_Lane6_WID ( 4)
+ #define DDRDATA7CH1_CR_RXPERBITRANK2_Lane6_MSK (0x0F000000)
+ #define DDRDATA7CH1_CR_RXPERBITRANK2_Lane6_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_RXPERBITRANK2_Lane7_OFF (28)
+ #define DDRDATA7CH1_CR_RXPERBITRANK2_Lane7_WID ( 4)
+ #define DDRDATA7CH1_CR_RXPERBITRANK2_Lane7_MSK (0xF0000000)
+ #define DDRDATA7CH1_CR_RXPERBITRANK2_Lane7_MAX (0x0000000F)
+
+#define DDRDATA7CH1_CR_RXPERBITRANK3_REG (0x00000F1C)
+ #define DDRDATA7CH1_CR_RXPERBITRANK3_Lane0_OFF ( 0)
+ #define DDRDATA7CH1_CR_RXPERBITRANK3_Lane0_WID ( 4)
+ #define DDRDATA7CH1_CR_RXPERBITRANK3_Lane0_MSK (0x0000000F)
+ #define DDRDATA7CH1_CR_RXPERBITRANK3_Lane0_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_RXPERBITRANK3_Lane1_OFF ( 4)
+ #define DDRDATA7CH1_CR_RXPERBITRANK3_Lane1_WID ( 4)
+ #define DDRDATA7CH1_CR_RXPERBITRANK3_Lane1_MSK (0x000000F0)
+ #define DDRDATA7CH1_CR_RXPERBITRANK3_Lane1_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_RXPERBITRANK3_Lane2_OFF ( 8)
+ #define DDRDATA7CH1_CR_RXPERBITRANK3_Lane2_WID ( 4)
+ #define DDRDATA7CH1_CR_RXPERBITRANK3_Lane2_MSK (0x00000F00)
+ #define DDRDATA7CH1_CR_RXPERBITRANK3_Lane2_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_RXPERBITRANK3_Lane3_OFF (12)
+ #define DDRDATA7CH1_CR_RXPERBITRANK3_Lane3_WID ( 4)
+ #define DDRDATA7CH1_CR_RXPERBITRANK3_Lane3_MSK (0x0000F000)
+ #define DDRDATA7CH1_CR_RXPERBITRANK3_Lane3_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_RXPERBITRANK3_Lane4_OFF (16)
+ #define DDRDATA7CH1_CR_RXPERBITRANK3_Lane4_WID ( 4)
+ #define DDRDATA7CH1_CR_RXPERBITRANK3_Lane4_MSK (0x000F0000)
+ #define DDRDATA7CH1_CR_RXPERBITRANK3_Lane4_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_RXPERBITRANK3_Lane5_OFF (20)
+ #define DDRDATA7CH1_CR_RXPERBITRANK3_Lane5_WID ( 4)
+ #define DDRDATA7CH1_CR_RXPERBITRANK3_Lane5_MSK (0x00F00000)
+ #define DDRDATA7CH1_CR_RXPERBITRANK3_Lane5_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_RXPERBITRANK3_Lane6_OFF (24)
+ #define DDRDATA7CH1_CR_RXPERBITRANK3_Lane6_WID ( 4)
+ #define DDRDATA7CH1_CR_RXPERBITRANK3_Lane6_MSK (0x0F000000)
+ #define DDRDATA7CH1_CR_RXPERBITRANK3_Lane6_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_RXPERBITRANK3_Lane7_OFF (28)
+ #define DDRDATA7CH1_CR_RXPERBITRANK3_Lane7_WID ( 4)
+ #define DDRDATA7CH1_CR_RXPERBITRANK3_Lane7_MSK (0xF0000000)
+ #define DDRDATA7CH1_CR_RXPERBITRANK3_Lane7_MAX (0x0000000F)
+
+#define DDRDATA7CH1_CR_TXTRAINRANK0_REG (0x00000F20)
+ #define DDRDATA7CH1_CR_TXTRAINRANK0_TxDqDelay_OFF ( 0)
+ #define DDRDATA7CH1_CR_TXTRAINRANK0_TxDqDelay_WID ( 9)
+ #define DDRDATA7CH1_CR_TXTRAINRANK0_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA7CH1_CR_TXTRAINRANK0_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA7CH1_CR_TXTRAINRANK0_TxDqsDelay_OFF ( 9)
+ #define DDRDATA7CH1_CR_TXTRAINRANK0_TxDqsDelay_WID ( 9)
+ #define DDRDATA7CH1_CR_TXTRAINRANK0_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA7CH1_CR_TXTRAINRANK0_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA7CH1_CR_TXTRAINRANK0_Spare0_OFF (18)
+ #define DDRDATA7CH1_CR_TXTRAINRANK0_Spare0_WID ( 2)
+ #define DDRDATA7CH1_CR_TXTRAINRANK0_Spare0_MSK (0x000C0000)
+ #define DDRDATA7CH1_CR_TXTRAINRANK0_Spare0_MAX (0x00000003)
+ #define DDRDATA7CH1_CR_TXTRAINRANK0_TxEqualization_OFF (20)
+ #define DDRDATA7CH1_CR_TXTRAINRANK0_TxEqualization_WID ( 6)
+ #define DDRDATA7CH1_CR_TXTRAINRANK0_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA7CH1_CR_TXTRAINRANK0_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA7CH1_CR_TXTRAINRANK0_Spare1_OFF (26)
+ #define DDRDATA7CH1_CR_TXTRAINRANK0_Spare1_WID ( 6)
+ #define DDRDATA7CH1_CR_TXTRAINRANK0_Spare1_MSK (0xFC000000)
+ #define DDRDATA7CH1_CR_TXTRAINRANK0_Spare1_MAX (0x0000003F)
+
+#define DDRDATA7CH1_CR_TXTRAINRANK1_REG (0x00000F24)
+ #define DDRDATA7CH1_CR_TXTRAINRANK1_TxDqDelay_OFF ( 0)
+ #define DDRDATA7CH1_CR_TXTRAINRANK1_TxDqDelay_WID ( 9)
+ #define DDRDATA7CH1_CR_TXTRAINRANK1_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA7CH1_CR_TXTRAINRANK1_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA7CH1_CR_TXTRAINRANK1_TxDqsDelay_OFF ( 9)
+ #define DDRDATA7CH1_CR_TXTRAINRANK1_TxDqsDelay_WID ( 9)
+ #define DDRDATA7CH1_CR_TXTRAINRANK1_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA7CH1_CR_TXTRAINRANK1_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA7CH1_CR_TXTRAINRANK1_Spare0_OFF (18)
+ #define DDRDATA7CH1_CR_TXTRAINRANK1_Spare0_WID ( 2)
+ #define DDRDATA7CH1_CR_TXTRAINRANK1_Spare0_MSK (0x000C0000)
+ #define DDRDATA7CH1_CR_TXTRAINRANK1_Spare0_MAX (0x00000003)
+ #define DDRDATA7CH1_CR_TXTRAINRANK1_TxEqualization_OFF (20)
+ #define DDRDATA7CH1_CR_TXTRAINRANK1_TxEqualization_WID ( 6)
+ #define DDRDATA7CH1_CR_TXTRAINRANK1_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA7CH1_CR_TXTRAINRANK1_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA7CH1_CR_TXTRAINRANK1_Spare1_OFF (26)
+ #define DDRDATA7CH1_CR_TXTRAINRANK1_Spare1_WID ( 6)
+ #define DDRDATA7CH1_CR_TXTRAINRANK1_Spare1_MSK (0xFC000000)
+ #define DDRDATA7CH1_CR_TXTRAINRANK1_Spare1_MAX (0x0000003F)
+
+#define DDRDATA7CH1_CR_TXTRAINRANK2_REG (0x00000F28)
+ #define DDRDATA7CH1_CR_TXTRAINRANK2_TxDqDelay_OFF ( 0)
+ #define DDRDATA7CH1_CR_TXTRAINRANK2_TxDqDelay_WID ( 9)
+ #define DDRDATA7CH1_CR_TXTRAINRANK2_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA7CH1_CR_TXTRAINRANK2_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA7CH1_CR_TXTRAINRANK2_TxDqsDelay_OFF ( 9)
+ #define DDRDATA7CH1_CR_TXTRAINRANK2_TxDqsDelay_WID ( 9)
+ #define DDRDATA7CH1_CR_TXTRAINRANK2_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA7CH1_CR_TXTRAINRANK2_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA7CH1_CR_TXTRAINRANK2_Spare0_OFF (18)
+ #define DDRDATA7CH1_CR_TXTRAINRANK2_Spare0_WID ( 2)
+ #define DDRDATA7CH1_CR_TXTRAINRANK2_Spare0_MSK (0x000C0000)
+ #define DDRDATA7CH1_CR_TXTRAINRANK2_Spare0_MAX (0x00000003)
+ #define DDRDATA7CH1_CR_TXTRAINRANK2_TxEqualization_OFF (20)
+ #define DDRDATA7CH1_CR_TXTRAINRANK2_TxEqualization_WID ( 6)
+ #define DDRDATA7CH1_CR_TXTRAINRANK2_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA7CH1_CR_TXTRAINRANK2_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA7CH1_CR_TXTRAINRANK2_Spare1_OFF (26)
+ #define DDRDATA7CH1_CR_TXTRAINRANK2_Spare1_WID ( 6)
+ #define DDRDATA7CH1_CR_TXTRAINRANK2_Spare1_MSK (0xFC000000)
+ #define DDRDATA7CH1_CR_TXTRAINRANK2_Spare1_MAX (0x0000003F)
+
+#define DDRDATA7CH1_CR_TXTRAINRANK3_REG (0x00000F2C)
+ #define DDRDATA7CH1_CR_TXTRAINRANK3_TxDqDelay_OFF ( 0)
+ #define DDRDATA7CH1_CR_TXTRAINRANK3_TxDqDelay_WID ( 9)
+ #define DDRDATA7CH1_CR_TXTRAINRANK3_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA7CH1_CR_TXTRAINRANK3_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA7CH1_CR_TXTRAINRANK3_TxDqsDelay_OFF ( 9)
+ #define DDRDATA7CH1_CR_TXTRAINRANK3_TxDqsDelay_WID ( 9)
+ #define DDRDATA7CH1_CR_TXTRAINRANK3_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA7CH1_CR_TXTRAINRANK3_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA7CH1_CR_TXTRAINRANK3_Spare0_OFF (18)
+ #define DDRDATA7CH1_CR_TXTRAINRANK3_Spare0_WID ( 2)
+ #define DDRDATA7CH1_CR_TXTRAINRANK3_Spare0_MSK (0x000C0000)
+ #define DDRDATA7CH1_CR_TXTRAINRANK3_Spare0_MAX (0x00000003)
+ #define DDRDATA7CH1_CR_TXTRAINRANK3_TxEqualization_OFF (20)
+ #define DDRDATA7CH1_CR_TXTRAINRANK3_TxEqualization_WID ( 6)
+ #define DDRDATA7CH1_CR_TXTRAINRANK3_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA7CH1_CR_TXTRAINRANK3_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA7CH1_CR_TXTRAINRANK3_Spare1_OFF (26)
+ #define DDRDATA7CH1_CR_TXTRAINRANK3_Spare1_WID ( 6)
+ #define DDRDATA7CH1_CR_TXTRAINRANK3_Spare1_MSK (0xFC000000)
+ #define DDRDATA7CH1_CR_TXTRAINRANK3_Spare1_MAX (0x0000003F)
+
+#define DDRDATA7CH1_CR_TXPERBITRANK0_REG (0x00000F30)
+ #define DDRDATA7CH1_CR_TXPERBITRANK0_Lane0_OFF ( 0)
+ #define DDRDATA7CH1_CR_TXPERBITRANK0_Lane0_WID ( 4)
+ #define DDRDATA7CH1_CR_TXPERBITRANK0_Lane0_MSK (0x0000000F)
+ #define DDRDATA7CH1_CR_TXPERBITRANK0_Lane0_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_TXPERBITRANK0_Lane1_OFF ( 4)
+ #define DDRDATA7CH1_CR_TXPERBITRANK0_Lane1_WID ( 4)
+ #define DDRDATA7CH1_CR_TXPERBITRANK0_Lane1_MSK (0x000000F0)
+ #define DDRDATA7CH1_CR_TXPERBITRANK0_Lane1_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_TXPERBITRANK0_Lane2_OFF ( 8)
+ #define DDRDATA7CH1_CR_TXPERBITRANK0_Lane2_WID ( 4)
+ #define DDRDATA7CH1_CR_TXPERBITRANK0_Lane2_MSK (0x00000F00)
+ #define DDRDATA7CH1_CR_TXPERBITRANK0_Lane2_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_TXPERBITRANK0_Lane3_OFF (12)
+ #define DDRDATA7CH1_CR_TXPERBITRANK0_Lane3_WID ( 4)
+ #define DDRDATA7CH1_CR_TXPERBITRANK0_Lane3_MSK (0x0000F000)
+ #define DDRDATA7CH1_CR_TXPERBITRANK0_Lane3_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_TXPERBITRANK0_Lane4_OFF (16)
+ #define DDRDATA7CH1_CR_TXPERBITRANK0_Lane4_WID ( 4)
+ #define DDRDATA7CH1_CR_TXPERBITRANK0_Lane4_MSK (0x000F0000)
+ #define DDRDATA7CH1_CR_TXPERBITRANK0_Lane4_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_TXPERBITRANK0_Lane5_OFF (20)
+ #define DDRDATA7CH1_CR_TXPERBITRANK0_Lane5_WID ( 4)
+ #define DDRDATA7CH1_CR_TXPERBITRANK0_Lane5_MSK (0x00F00000)
+ #define DDRDATA7CH1_CR_TXPERBITRANK0_Lane5_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_TXPERBITRANK0_Lane6_OFF (24)
+ #define DDRDATA7CH1_CR_TXPERBITRANK0_Lane6_WID ( 4)
+ #define DDRDATA7CH1_CR_TXPERBITRANK0_Lane6_MSK (0x0F000000)
+ #define DDRDATA7CH1_CR_TXPERBITRANK0_Lane6_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_TXPERBITRANK0_Lane7_OFF (28)
+ #define DDRDATA7CH1_CR_TXPERBITRANK0_Lane7_WID ( 4)
+ #define DDRDATA7CH1_CR_TXPERBITRANK0_Lane7_MSK (0xF0000000)
+ #define DDRDATA7CH1_CR_TXPERBITRANK0_Lane7_MAX (0x0000000F)
+
+#define DDRDATA7CH1_CR_TXPERBITRANK1_REG (0x00000F34)
+ #define DDRDATA7CH1_CR_TXPERBITRANK1_Lane0_OFF ( 0)
+ #define DDRDATA7CH1_CR_TXPERBITRANK1_Lane0_WID ( 4)
+ #define DDRDATA7CH1_CR_TXPERBITRANK1_Lane0_MSK (0x0000000F)
+ #define DDRDATA7CH1_CR_TXPERBITRANK1_Lane0_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_TXPERBITRANK1_Lane1_OFF ( 4)
+ #define DDRDATA7CH1_CR_TXPERBITRANK1_Lane1_WID ( 4)
+ #define DDRDATA7CH1_CR_TXPERBITRANK1_Lane1_MSK (0x000000F0)
+ #define DDRDATA7CH1_CR_TXPERBITRANK1_Lane1_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_TXPERBITRANK1_Lane2_OFF ( 8)
+ #define DDRDATA7CH1_CR_TXPERBITRANK1_Lane2_WID ( 4)
+ #define DDRDATA7CH1_CR_TXPERBITRANK1_Lane2_MSK (0x00000F00)
+ #define DDRDATA7CH1_CR_TXPERBITRANK1_Lane2_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_TXPERBITRANK1_Lane3_OFF (12)
+ #define DDRDATA7CH1_CR_TXPERBITRANK1_Lane3_WID ( 4)
+ #define DDRDATA7CH1_CR_TXPERBITRANK1_Lane3_MSK (0x0000F000)
+ #define DDRDATA7CH1_CR_TXPERBITRANK1_Lane3_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_TXPERBITRANK1_Lane4_OFF (16)
+ #define DDRDATA7CH1_CR_TXPERBITRANK1_Lane4_WID ( 4)
+ #define DDRDATA7CH1_CR_TXPERBITRANK1_Lane4_MSK (0x000F0000)
+ #define DDRDATA7CH1_CR_TXPERBITRANK1_Lane4_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_TXPERBITRANK1_Lane5_OFF (20)
+ #define DDRDATA7CH1_CR_TXPERBITRANK1_Lane5_WID ( 4)
+ #define DDRDATA7CH1_CR_TXPERBITRANK1_Lane5_MSK (0x00F00000)
+ #define DDRDATA7CH1_CR_TXPERBITRANK1_Lane5_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_TXPERBITRANK1_Lane6_OFF (24)
+ #define DDRDATA7CH1_CR_TXPERBITRANK1_Lane6_WID ( 4)
+ #define DDRDATA7CH1_CR_TXPERBITRANK1_Lane6_MSK (0x0F000000)
+ #define DDRDATA7CH1_CR_TXPERBITRANK1_Lane6_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_TXPERBITRANK1_Lane7_OFF (28)
+ #define DDRDATA7CH1_CR_TXPERBITRANK1_Lane7_WID ( 4)
+ #define DDRDATA7CH1_CR_TXPERBITRANK1_Lane7_MSK (0xF0000000)
+ #define DDRDATA7CH1_CR_TXPERBITRANK1_Lane7_MAX (0x0000000F)
+
+#define DDRDATA7CH1_CR_TXPERBITRANK2_REG (0x00000F38)
+ #define DDRDATA7CH1_CR_TXPERBITRANK2_Lane0_OFF ( 0)
+ #define DDRDATA7CH1_CR_TXPERBITRANK2_Lane0_WID ( 4)
+ #define DDRDATA7CH1_CR_TXPERBITRANK2_Lane0_MSK (0x0000000F)
+ #define DDRDATA7CH1_CR_TXPERBITRANK2_Lane0_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_TXPERBITRANK2_Lane1_OFF ( 4)
+ #define DDRDATA7CH1_CR_TXPERBITRANK2_Lane1_WID ( 4)
+ #define DDRDATA7CH1_CR_TXPERBITRANK2_Lane1_MSK (0x000000F0)
+ #define DDRDATA7CH1_CR_TXPERBITRANK2_Lane1_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_TXPERBITRANK2_Lane2_OFF ( 8)
+ #define DDRDATA7CH1_CR_TXPERBITRANK2_Lane2_WID ( 4)
+ #define DDRDATA7CH1_CR_TXPERBITRANK2_Lane2_MSK (0x00000F00)
+ #define DDRDATA7CH1_CR_TXPERBITRANK2_Lane2_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_TXPERBITRANK2_Lane3_OFF (12)
+ #define DDRDATA7CH1_CR_TXPERBITRANK2_Lane3_WID ( 4)
+ #define DDRDATA7CH1_CR_TXPERBITRANK2_Lane3_MSK (0x0000F000)
+ #define DDRDATA7CH1_CR_TXPERBITRANK2_Lane3_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_TXPERBITRANK2_Lane4_OFF (16)
+ #define DDRDATA7CH1_CR_TXPERBITRANK2_Lane4_WID ( 4)
+ #define DDRDATA7CH1_CR_TXPERBITRANK2_Lane4_MSK (0x000F0000)
+ #define DDRDATA7CH1_CR_TXPERBITRANK2_Lane4_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_TXPERBITRANK2_Lane5_OFF (20)
+ #define DDRDATA7CH1_CR_TXPERBITRANK2_Lane5_WID ( 4)
+ #define DDRDATA7CH1_CR_TXPERBITRANK2_Lane5_MSK (0x00F00000)
+ #define DDRDATA7CH1_CR_TXPERBITRANK2_Lane5_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_TXPERBITRANK2_Lane6_OFF (24)
+ #define DDRDATA7CH1_CR_TXPERBITRANK2_Lane6_WID ( 4)
+ #define DDRDATA7CH1_CR_TXPERBITRANK2_Lane6_MSK (0x0F000000)
+ #define DDRDATA7CH1_CR_TXPERBITRANK2_Lane6_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_TXPERBITRANK2_Lane7_OFF (28)
+ #define DDRDATA7CH1_CR_TXPERBITRANK2_Lane7_WID ( 4)
+ #define DDRDATA7CH1_CR_TXPERBITRANK2_Lane7_MSK (0xF0000000)
+ #define DDRDATA7CH1_CR_TXPERBITRANK2_Lane7_MAX (0x0000000F)
+
+#define DDRDATA7CH1_CR_TXPERBITRANK3_REG (0x00000F3C)
+ #define DDRDATA7CH1_CR_TXPERBITRANK3_Lane0_OFF ( 0)
+ #define DDRDATA7CH1_CR_TXPERBITRANK3_Lane0_WID ( 4)
+ #define DDRDATA7CH1_CR_TXPERBITRANK3_Lane0_MSK (0x0000000F)
+ #define DDRDATA7CH1_CR_TXPERBITRANK3_Lane0_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_TXPERBITRANK3_Lane1_OFF ( 4)
+ #define DDRDATA7CH1_CR_TXPERBITRANK3_Lane1_WID ( 4)
+ #define DDRDATA7CH1_CR_TXPERBITRANK3_Lane1_MSK (0x000000F0)
+ #define DDRDATA7CH1_CR_TXPERBITRANK3_Lane1_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_TXPERBITRANK3_Lane2_OFF ( 8)
+ #define DDRDATA7CH1_CR_TXPERBITRANK3_Lane2_WID ( 4)
+ #define DDRDATA7CH1_CR_TXPERBITRANK3_Lane2_MSK (0x00000F00)
+ #define DDRDATA7CH1_CR_TXPERBITRANK3_Lane2_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_TXPERBITRANK3_Lane3_OFF (12)
+ #define DDRDATA7CH1_CR_TXPERBITRANK3_Lane3_WID ( 4)
+ #define DDRDATA7CH1_CR_TXPERBITRANK3_Lane3_MSK (0x0000F000)
+ #define DDRDATA7CH1_CR_TXPERBITRANK3_Lane3_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_TXPERBITRANK3_Lane4_OFF (16)
+ #define DDRDATA7CH1_CR_TXPERBITRANK3_Lane4_WID ( 4)
+ #define DDRDATA7CH1_CR_TXPERBITRANK3_Lane4_MSK (0x000F0000)
+ #define DDRDATA7CH1_CR_TXPERBITRANK3_Lane4_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_TXPERBITRANK3_Lane5_OFF (20)
+ #define DDRDATA7CH1_CR_TXPERBITRANK3_Lane5_WID ( 4)
+ #define DDRDATA7CH1_CR_TXPERBITRANK3_Lane5_MSK (0x00F00000)
+ #define DDRDATA7CH1_CR_TXPERBITRANK3_Lane5_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_TXPERBITRANK3_Lane6_OFF (24)
+ #define DDRDATA7CH1_CR_TXPERBITRANK3_Lane6_WID ( 4)
+ #define DDRDATA7CH1_CR_TXPERBITRANK3_Lane6_MSK (0x0F000000)
+ #define DDRDATA7CH1_CR_TXPERBITRANK3_Lane6_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_TXPERBITRANK3_Lane7_OFF (28)
+ #define DDRDATA7CH1_CR_TXPERBITRANK3_Lane7_WID ( 4)
+ #define DDRDATA7CH1_CR_TXPERBITRANK3_Lane7_MSK (0xF0000000)
+ #define DDRDATA7CH1_CR_TXPERBITRANK3_Lane7_MAX (0x0000000F)
+
+#define DDRDATA7CH1_CR_RCOMPDATA0_REG (0x00000F40)
+ #define DDRDATA7CH1_CR_RCOMPDATA0_RcompDrvUp_OFF ( 0)
+ #define DDRDATA7CH1_CR_RCOMPDATA0_RcompDrvUp_WID ( 6)
+ #define DDRDATA7CH1_CR_RCOMPDATA0_RcompDrvUp_MSK (0x0000003F)
+ #define DDRDATA7CH1_CR_RCOMPDATA0_RcompDrvUp_MAX (0x0000003F)
+ #define DDRDATA7CH1_CR_RCOMPDATA0_Spare0_OFF ( 6)
+ #define DDRDATA7CH1_CR_RCOMPDATA0_Spare0_WID ( 3)
+ #define DDRDATA7CH1_CR_RCOMPDATA0_Spare0_MSK (0x000001C0)
+ #define DDRDATA7CH1_CR_RCOMPDATA0_Spare0_MAX (0x00000007)
+ #define DDRDATA7CH1_CR_RCOMPDATA0_RcompDrvDown_OFF ( 9)
+ #define DDRDATA7CH1_CR_RCOMPDATA0_RcompDrvDown_WID ( 6)
+ #define DDRDATA7CH1_CR_RCOMPDATA0_RcompDrvDown_MSK (0x00007E00)
+ #define DDRDATA7CH1_CR_RCOMPDATA0_RcompDrvDown_MAX (0x0000003F)
+ #define DDRDATA7CH1_CR_RCOMPDATA0_VTComp_OFF (15)
+ #define DDRDATA7CH1_CR_RCOMPDATA0_VTComp_WID ( 5)
+ #define DDRDATA7CH1_CR_RCOMPDATA0_VTComp_MSK (0x000F8000)
+ #define DDRDATA7CH1_CR_RCOMPDATA0_VTComp_MAX (0x0000001F)
+ #define DDRDATA7CH1_CR_RCOMPDATA0_TcoComp_OFF (20)
+ #define DDRDATA7CH1_CR_RCOMPDATA0_TcoComp_WID ( 6)
+ #define DDRDATA7CH1_CR_RCOMPDATA0_TcoComp_MSK (0x03F00000)
+ #define DDRDATA7CH1_CR_RCOMPDATA0_TcoComp_MAX (0x0000003F)
+ #define DDRDATA7CH1_CR_RCOMPDATA0_SlewRateComp_OFF (26)
+ #define DDRDATA7CH1_CR_RCOMPDATA0_SlewRateComp_WID ( 5)
+ #define DDRDATA7CH1_CR_RCOMPDATA0_SlewRateComp_MSK (0x7C000000)
+ #define DDRDATA7CH1_CR_RCOMPDATA0_SlewRateComp_MAX (0x0000001F)
+ #define DDRDATA7CH1_CR_RCOMPDATA0_Spare2_OFF (31)
+ #define DDRDATA7CH1_CR_RCOMPDATA0_Spare2_WID ( 1)
+ #define DDRDATA7CH1_CR_RCOMPDATA0_Spare2_MSK (0x80000000)
+ #define DDRDATA7CH1_CR_RCOMPDATA0_Spare2_MAX (0x00000001)
+
+#define DDRDATA7CH1_CR_RCOMPDATA1_REG (0x00000F44)
+ #define DDRDATA7CH1_CR_RCOMPDATA1_RcompOdtUp_OFF ( 0)
+ #define DDRDATA7CH1_CR_RCOMPDATA1_RcompOdtUp_WID ( 6)
+ #define DDRDATA7CH1_CR_RCOMPDATA1_RcompOdtUp_MSK (0x0000003F)
+ #define DDRDATA7CH1_CR_RCOMPDATA1_RcompOdtUp_MAX (0x0000003F)
+ #define DDRDATA7CH1_CR_RCOMPDATA1_Spare0_OFF ( 6)
+ #define DDRDATA7CH1_CR_RCOMPDATA1_Spare0_WID ( 3)
+ #define DDRDATA7CH1_CR_RCOMPDATA1_Spare0_MSK (0x000001C0)
+ #define DDRDATA7CH1_CR_RCOMPDATA1_Spare0_MAX (0x00000007)
+ #define DDRDATA7CH1_CR_RCOMPDATA1_RcompOdtDown_OFF ( 9)
+ #define DDRDATA7CH1_CR_RCOMPDATA1_RcompOdtDown_WID ( 6)
+ #define DDRDATA7CH1_CR_RCOMPDATA1_RcompOdtDown_MSK (0x00007E00)
+ #define DDRDATA7CH1_CR_RCOMPDATA1_RcompOdtDown_MAX (0x0000003F)
+ #define DDRDATA7CH1_CR_RCOMPDATA1_Spare1_OFF (15)
+ #define DDRDATA7CH1_CR_RCOMPDATA1_Spare1_WID ( 1)
+ #define DDRDATA7CH1_CR_RCOMPDATA1_Spare1_MSK (0x00008000)
+ #define DDRDATA7CH1_CR_RCOMPDATA1_Spare1_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_RCOMPDATA1_PanicDrvDn_OFF (16)
+ #define DDRDATA7CH1_CR_RCOMPDATA1_PanicDrvDn_WID ( 6)
+ #define DDRDATA7CH1_CR_RCOMPDATA1_PanicDrvDn_MSK (0x003F0000)
+ #define DDRDATA7CH1_CR_RCOMPDATA1_PanicDrvDn_MAX (0x0000003F)
+ #define DDRDATA7CH1_CR_RCOMPDATA1_PanicDrvUp_OFF (22)
+ #define DDRDATA7CH1_CR_RCOMPDATA1_PanicDrvUp_WID ( 6)
+ #define DDRDATA7CH1_CR_RCOMPDATA1_PanicDrvUp_MSK (0x0FC00000)
+ #define DDRDATA7CH1_CR_RCOMPDATA1_PanicDrvUp_MAX (0x0000003F)
+ #define DDRDATA7CH1_CR_RCOMPDATA1_LevelShifterComp_OFF (28)
+ #define DDRDATA7CH1_CR_RCOMPDATA1_LevelShifterComp_WID ( 3)
+ #define DDRDATA7CH1_CR_RCOMPDATA1_LevelShifterComp_MSK (0x70000000)
+ #define DDRDATA7CH1_CR_RCOMPDATA1_LevelShifterComp_MAX (0x00000007)
+ #define DDRDATA7CH1_CR_RCOMPDATA1_Spare2_OFF (31)
+ #define DDRDATA7CH1_CR_RCOMPDATA1_Spare2_WID ( 1)
+ #define DDRDATA7CH1_CR_RCOMPDATA1_Spare2_MSK (0x80000000)
+ #define DDRDATA7CH1_CR_RCOMPDATA1_Spare2_MAX (0x00000001)
+
+#define DDRDATA7CH1_CR_TXXTALK_REG (0x00000F48)
+ #define DDRDATA7CH1_CR_TXXTALK_Lane0_OFF ( 0)
+ #define DDRDATA7CH1_CR_TXXTALK_Lane0_WID ( 4)
+ #define DDRDATA7CH1_CR_TXXTALK_Lane0_MSK (0x0000000F)
+ #define DDRDATA7CH1_CR_TXXTALK_Lane0_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_TXXTALK_Lane1_OFF ( 4)
+ #define DDRDATA7CH1_CR_TXXTALK_Lane1_WID ( 4)
+ #define DDRDATA7CH1_CR_TXXTALK_Lane1_MSK (0x000000F0)
+ #define DDRDATA7CH1_CR_TXXTALK_Lane1_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_TXXTALK_Lane2_OFF ( 8)
+ #define DDRDATA7CH1_CR_TXXTALK_Lane2_WID ( 4)
+ #define DDRDATA7CH1_CR_TXXTALK_Lane2_MSK (0x00000F00)
+ #define DDRDATA7CH1_CR_TXXTALK_Lane2_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_TXXTALK_Lane3_OFF (12)
+ #define DDRDATA7CH1_CR_TXXTALK_Lane3_WID ( 4)
+ #define DDRDATA7CH1_CR_TXXTALK_Lane3_MSK (0x0000F000)
+ #define DDRDATA7CH1_CR_TXXTALK_Lane3_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_TXXTALK_Lane4_OFF (16)
+ #define DDRDATA7CH1_CR_TXXTALK_Lane4_WID ( 4)
+ #define DDRDATA7CH1_CR_TXXTALK_Lane4_MSK (0x000F0000)
+ #define DDRDATA7CH1_CR_TXXTALK_Lane4_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_TXXTALK_Lane5_OFF (20)
+ #define DDRDATA7CH1_CR_TXXTALK_Lane5_WID ( 4)
+ #define DDRDATA7CH1_CR_TXXTALK_Lane5_MSK (0x00F00000)
+ #define DDRDATA7CH1_CR_TXXTALK_Lane5_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_TXXTALK_Lane6_OFF (24)
+ #define DDRDATA7CH1_CR_TXXTALK_Lane6_WID ( 4)
+ #define DDRDATA7CH1_CR_TXXTALK_Lane6_MSK (0x0F000000)
+ #define DDRDATA7CH1_CR_TXXTALK_Lane6_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_TXXTALK_Lane7_OFF (28)
+ #define DDRDATA7CH1_CR_TXXTALK_Lane7_WID ( 4)
+ #define DDRDATA7CH1_CR_TXXTALK_Lane7_MSK (0xF0000000)
+ #define DDRDATA7CH1_CR_TXXTALK_Lane7_MAX (0x0000000F)
+
+#define DDRDATA7CH1_CR_RXOFFSETVDQ_REG (0x00000F4C)
+ #define DDRDATA7CH1_CR_RXOFFSETVDQ_Lane0_OFF ( 0)
+ #define DDRDATA7CH1_CR_RXOFFSETVDQ_Lane0_WID ( 4)
+ #define DDRDATA7CH1_CR_RXOFFSETVDQ_Lane0_MSK (0x0000000F)
+ #define DDRDATA7CH1_CR_RXOFFSETVDQ_Lane0_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_RXOFFSETVDQ_Lane1_OFF ( 4)
+ #define DDRDATA7CH1_CR_RXOFFSETVDQ_Lane1_WID ( 4)
+ #define DDRDATA7CH1_CR_RXOFFSETVDQ_Lane1_MSK (0x000000F0)
+ #define DDRDATA7CH1_CR_RXOFFSETVDQ_Lane1_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_RXOFFSETVDQ_Lane2_OFF ( 8)
+ #define DDRDATA7CH1_CR_RXOFFSETVDQ_Lane2_WID ( 4)
+ #define DDRDATA7CH1_CR_RXOFFSETVDQ_Lane2_MSK (0x00000F00)
+ #define DDRDATA7CH1_CR_RXOFFSETVDQ_Lane2_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_RXOFFSETVDQ_Lane3_OFF (12)
+ #define DDRDATA7CH1_CR_RXOFFSETVDQ_Lane3_WID ( 4)
+ #define DDRDATA7CH1_CR_RXOFFSETVDQ_Lane3_MSK (0x0000F000)
+ #define DDRDATA7CH1_CR_RXOFFSETVDQ_Lane3_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_RXOFFSETVDQ_Lane4_OFF (16)
+ #define DDRDATA7CH1_CR_RXOFFSETVDQ_Lane4_WID ( 4)
+ #define DDRDATA7CH1_CR_RXOFFSETVDQ_Lane4_MSK (0x000F0000)
+ #define DDRDATA7CH1_CR_RXOFFSETVDQ_Lane4_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_RXOFFSETVDQ_Lane5_OFF (20)
+ #define DDRDATA7CH1_CR_RXOFFSETVDQ_Lane5_WID ( 4)
+ #define DDRDATA7CH1_CR_RXOFFSETVDQ_Lane5_MSK (0x00F00000)
+ #define DDRDATA7CH1_CR_RXOFFSETVDQ_Lane5_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_RXOFFSETVDQ_Lane6_OFF (24)
+ #define DDRDATA7CH1_CR_RXOFFSETVDQ_Lane6_WID ( 4)
+ #define DDRDATA7CH1_CR_RXOFFSETVDQ_Lane6_MSK (0x0F000000)
+ #define DDRDATA7CH1_CR_RXOFFSETVDQ_Lane6_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_RXOFFSETVDQ_Lane7_OFF (28)
+ #define DDRDATA7CH1_CR_RXOFFSETVDQ_Lane7_WID ( 4)
+ #define DDRDATA7CH1_CR_RXOFFSETVDQ_Lane7_MSK (0xF0000000)
+ #define DDRDATA7CH1_CR_RXOFFSETVDQ_Lane7_MAX (0x0000000F)
+
+#define DDRDATA7CH1_CR_DDRDATARESERVED_REG (0x00000F50)
+ #define DDRDATA7CH1_CR_DDRDATARESERVED_Spare_OFF ( 0)
+ #define DDRDATA7CH1_CR_DDRDATARESERVED_Spare_WID (32)
+ #define DDRDATA7CH1_CR_DDRDATARESERVED_Spare_MSK (0xFFFFFFFF)
+ #define DDRDATA7CH1_CR_DDRDATARESERVED_Spare_MAX (0xFFFFFFFF)
+
+#define DDRDATA7CH1_CR_DATATRAINFEEDBACK_REG (0x00000F54)
+ #define DDRDATA7CH1_CR_DATATRAINFEEDBACK_DataTrainFeedback_OFF ( 0)
+ #define DDRDATA7CH1_CR_DATATRAINFEEDBACK_DataTrainFeedback_WID ( 9)
+ #define DDRDATA7CH1_CR_DATATRAINFEEDBACK_DataTrainFeedback_MSK (0x000001FF)
+ #define DDRDATA7CH1_CR_DATATRAINFEEDBACK_DataTrainFeedback_MAX (0x000001FF)
+ #define DDRDATA7CH1_CR_DATATRAINFEEDBACK_Spare_OFF ( 9)
+ #define DDRDATA7CH1_CR_DATATRAINFEEDBACK_Spare_WID (23)
+ #define DDRDATA7CH1_CR_DATATRAINFEEDBACK_Spare_MSK (0xFFFFFE00)
+ #define DDRDATA7CH1_CR_DATATRAINFEEDBACK_Spare_MAX (0x007FFFFF)
+
+#define DDRDATA7CH1_CR_DLLPITESTANDADC_REG (0x00000F58)
+ #define DDRDATA7CH1_CR_DLLPITESTANDADC_RunTest_OFF ( 0)
+ #define DDRDATA7CH1_CR_DLLPITESTANDADC_RunTest_WID ( 1)
+ #define DDRDATA7CH1_CR_DLLPITESTANDADC_RunTest_MSK (0x00000001)
+ #define DDRDATA7CH1_CR_DLLPITESTANDADC_RunTest_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DLLPITESTANDADC_RunTest_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DLLPITESTANDADC_Load_OFF ( 1)
+ #define DDRDATA7CH1_CR_DLLPITESTANDADC_Load_WID ( 1)
+ #define DDRDATA7CH1_CR_DLLPITESTANDADC_Load_MSK (0x00000002)
+ #define DDRDATA7CH1_CR_DLLPITESTANDADC_Load_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DLLPITESTANDADC_Load_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DLLPITESTANDADC_ModeHVM_OFF ( 2)
+ #define DDRDATA7CH1_CR_DLLPITESTANDADC_ModeHVM_WID ( 1)
+ #define DDRDATA7CH1_CR_DLLPITESTANDADC_ModeHVM_MSK (0x00000004)
+ #define DDRDATA7CH1_CR_DLLPITESTANDADC_ModeHVM_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DLLPITESTANDADC_ModeHVM_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DLLPITESTANDADC_ModeDV_OFF ( 3)
+ #define DDRDATA7CH1_CR_DLLPITESTANDADC_ModeDV_WID ( 1)
+ #define DDRDATA7CH1_CR_DLLPITESTANDADC_ModeDV_MSK (0x00000008)
+ #define DDRDATA7CH1_CR_DLLPITESTANDADC_ModeDV_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DLLPITESTANDADC_ModeDV_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DLLPITESTANDADC_ModeADC_OFF ( 4)
+ #define DDRDATA7CH1_CR_DLLPITESTANDADC_ModeADC_WID ( 1)
+ #define DDRDATA7CH1_CR_DLLPITESTANDADC_ModeADC_MSK (0x00000010)
+ #define DDRDATA7CH1_CR_DLLPITESTANDADC_ModeADC_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DLLPITESTANDADC_ModeADC_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DLLPITESTANDADC_LoadCount_OFF ( 5)
+ #define DDRDATA7CH1_CR_DLLPITESTANDADC_LoadCount_WID (10)
+ #define DDRDATA7CH1_CR_DLLPITESTANDADC_LoadCount_MSK (0x00007FE0)
+ #define DDRDATA7CH1_CR_DLLPITESTANDADC_LoadCount_MAX (0x000003FF)
+ #define DDRDATA7CH1_CR_DLLPITESTANDADC_CountStatus_OFF (15)
+ #define DDRDATA7CH1_CR_DLLPITESTANDADC_CountStatus_WID (10)
+ #define DDRDATA7CH1_CR_DLLPITESTANDADC_CountStatus_MSK (0x01FF8000)
+ #define DDRDATA7CH1_CR_DLLPITESTANDADC_CountStatus_MAX (0x000003FF)
+ #define DDRDATA7CH1_CR_DLLPITESTANDADC_CountStatus_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DLLPITESTANDADC_Spare_OFF (25)
+ #define DDRDATA7CH1_CR_DLLPITESTANDADC_Spare_WID ( 7)
+ #define DDRDATA7CH1_CR_DLLPITESTANDADC_Spare_MSK (0xFE000000)
+ #define DDRDATA7CH1_CR_DLLPITESTANDADC_Spare_MAX (0x0000007F)
+
+#define DDRDATA7CH1_CR_DDRCRDATAOFFSETCOMP_REG (0x00000F5C)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_OFF ( 0)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_WID ( 6)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_MSK (0x0000003F)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_MAX (0x0000003F)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_OFF ( 6)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_WID ( 6)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_MSK (0x00000FC0)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_MAX (0x0000003F)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_OFF (12)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_WID ( 5)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_MSK (0x0001F000)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_MAX (0x0000001F)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_OFF (17)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_WID ( 5)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_MSK (0x003E0000)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_MAX (0x0000001F)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_OFF (22)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_WID ( 5)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_MSK (0x07C00000)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_MAX (0x0000001F)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_OFF (27)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_WID ( 5)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_MSK (0xF8000000)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_MAX (0x0000001F)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_DEF (0x00000000)
+
+#define DDRDATA7CH1_CR_DDRCRDATACONTROL1_REG (0x00000F60)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_RefPi_OFF ( 0)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_RefPi_WID ( 4)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_RefPi_MSK (0x0000000F)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_RefPi_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_RefPi_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_DllMask_OFF ( 4)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_DllMask_WID ( 2)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_DllMask_MSK (0x00000030)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_DllMask_MAX (0x00000003)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_DllMask_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_DllWeakLock_OFF ( 6)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_DllWeakLock_WID ( 1)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_DllWeakLock_MSK (0x00000040)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_DllWeakLock_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_DllWeakLock_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_OFF ( 7)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_WID ( 3)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_MSK (0x00000380)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_MAX (0x00000007)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_OFF (10)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_WID ( 3)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_MSK (0x00001C00)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_MAX (0x00000007)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_OdtDelay_OFF (13)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_OdtDelay_WID ( 4)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_OdtDelay_MSK (0x0001E000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_OdtDelay_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_OdtDelay_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_OdtDuration_OFF (17)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_OdtDuration_WID ( 3)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_OdtDuration_MSK (0x000E0000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_OdtDuration_MAX (0x00000007)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_OdtDuration_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_OFF (20)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_WID ( 4)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_MSK (0x00F00000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_OFF (24)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_WID ( 3)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_MSK (0x07000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_MAX (0x00000007)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_OFF (27)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_WID ( 3)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_MSK (0x38000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_MAX (0x00000007)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_OFF (30)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_WID ( 1)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_MSK (0x40000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_Rsvd1_OFF (31)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_Rsvd1_WID ( 1)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_Rsvd1_MSK (0x80000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_Rsvd1_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL1_Rsvd1_DEF (0x00000000)
+
+#define DDRDATA7CH1_CR_DDRCRDATACONTROL2_REG (0x00000F64)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_OFF ( 0)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_WID ( 5)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_MSK (0x0000001F)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_MAX (0x0000001F)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_OFF ( 5)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_WID ( 1)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_MSK (0x00000020)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL2_ForceRxOn_OFF ( 6)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL2_ForceRxOn_WID ( 1)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL2_ForceRxOn_MSK (0x00000040)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL2_ForceRxOn_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL2_ForceRxOn_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL2_LeakerComp_OFF ( 7)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL2_LeakerComp_WID ( 2)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL2_LeakerComp_MSK (0x00000180)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL2_LeakerComp_MAX (0x00000003)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL2_LeakerComp_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_OFF ( 9)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_WID ( 4)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_MSK (0x00001E00)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_MAX (0x0000000F)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_DEF (0x00000008)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_OFF (13)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_WID ( 5)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_MSK (0x0003E000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_MAX (0x0000001F)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_DEF (0x00000011)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_OFF (18)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_WID ( 1)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_MSK (0x00040000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL2_Spare_OFF (19)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL2_Spare_WID (13)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL2_Spare_MSK (0xFFF80000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL2_Spare_MAX (0x00001FFF)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL2_Spare_DEF (0x00000000)
+
+#define DDRDATA7CH1_CR_DDRCRVREFCONTROL_REG (0x00000F68)
+ #define DDRDATA7CH1_CR_DDRCRVREFCONTROL_VrefCtl_OFF ( 0)
+ #define DDRDATA7CH1_CR_DDRCRVREFCONTROL_VrefCtl_WID (24)
+ #define DDRDATA7CH1_CR_DDRCRVREFCONTROL_VrefCtl_MSK (0x00FFFFFF)
+ #define DDRDATA7CH1_CR_DDRCRVREFCONTROL_VrefCtl_MAX (0x00FFFFFF)
+ #define DDRDATA7CH1_CR_DDRCRVREFCONTROL_VrefCtl_DEF (0x000E453A)
+ #define DDRDATA7CH1_CR_DDRCRVREFCONTROL_OutputCode_OFF (24)
+ #define DDRDATA7CH1_CR_DDRCRVREFCONTROL_OutputCode_WID ( 8)
+ #define DDRDATA7CH1_CR_DDRCRVREFCONTROL_OutputCode_MSK (0xFF000000)
+ #define DDRDATA7CH1_CR_DDRCRVREFCONTROL_OutputCode_MAX (0x000000FF)
+ #define DDRDATA7CH1_CR_DDRCRVREFCONTROL_OutputCode_DEF (0x00000000)
+
+#define DDRDATA7CH1_CR_DDRCRVSSHICONTROL_REG (0x00000F6C)
+ #define DDRDATA7CH1_CR_DDRCRVSSHICONTROL_VssHiCtl_OFF ( 0)
+ #define DDRDATA7CH1_CR_DDRCRVSSHICONTROL_VssHiCtl_WID (24)
+ #define DDRDATA7CH1_CR_DDRCRVSSHICONTROL_VssHiCtl_MSK (0x00FFFFFF)
+ #define DDRDATA7CH1_CR_DDRCRVSSHICONTROL_VssHiCtl_MAX (0x00FFFFFF)
+ #define DDRDATA7CH1_CR_DDRCRVSSHICONTROL_VssHiCtl_DEF (0x004D8238)
+ #define DDRDATA7CH1_CR_DDRCRVSSHICONTROL_OutputCode_OFF (24)
+ #define DDRDATA7CH1_CR_DDRCRVSSHICONTROL_OutputCode_WID ( 8)
+ #define DDRDATA7CH1_CR_DDRCRVSSHICONTROL_OutputCode_MSK (0xFF000000)
+ #define DDRDATA7CH1_CR_DDRCRVSSHICONTROL_OutputCode_MAX (0x000000FF)
+ #define DDRDATA7CH1_CR_DDRCRVSSHICONTROL_OutputCode_DEF (0x00000000)
+
+#define DDRDATA7CH1_CR_DDRCRVSSHIORVREFCONTROL_REG (0x00000F6C)
+ #define DDRDATA7CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_OFF ( 0)
+ #define DDRDATA7CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_WID (24)
+ #define DDRDATA7CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_MSK (0x00FFFFFF)
+ #define DDRDATA7CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_MAX (0x00FFFFFF)
+ #define DDRDATA7CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_OFF (24)
+ #define DDRDATA7CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_WID ( 8)
+ #define DDRDATA7CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_MSK (0xFF000000)
+ #define DDRDATA7CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_MAX (0x000000FF)
+ #define DDRDATA7CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_DEF (0x00000000)
+
+#define DDRDATA7CH1_CR_DDRCRDATAOFFSETTRAIN_REG (0x00000F70)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_OFF ( 0)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_WID ( 6)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_MSK (0x0000003F)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_MAX (0x0000003F)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_OFF ( 6)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_WID ( 6)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_MSK (0x00000FC0)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_MAX (0x0000003F)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_OFF (12)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_WID ( 6)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_MSK (0x0003F000)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_MAX (0x0000003F)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_OFF (18)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_WID ( 6)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_MSK (0x00FC0000)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_MAX (0x0000003F)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_OFF (24)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_WID ( 7)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_MSK (0x7F000000)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_MAX (0x0000007F)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_OFF (31)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_WID ( 1)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_MSK (0x80000000)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_DEF (0x00000000)
+
+#define DDRDATA7CH1_CR_DDRCRDATACONTROL0_REG (0x00000F74)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_OFF ( 0)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_WID ( 1)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_MSK (0x00000001)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_OFF ( 1)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_WID ( 1)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_MSK (0x00000002)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_OFF ( 2)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_WID ( 1)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_MSK (0x00000004)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_OFF ( 3)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_WID ( 1)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_MSK (0x00000008)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_TxOn_OFF ( 4)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_TxOn_WID ( 1)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_TxOn_MSK (0x00000010)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_TxOn_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_TxOn_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_RfOn_OFF ( 5)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_RfOn_WID ( 1)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_RfOn_MSK (0x00000020)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_RfOn_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_RfOn_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_RxPiOn_OFF ( 6)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_RxPiOn_WID ( 1)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_RxPiOn_MSK (0x00000040)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_RxPiOn_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_RxPiOn_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_TxPiOn_OFF ( 7)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_TxPiOn_WID ( 1)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_TxPiOn_MSK (0x00000080)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_TxPiOn_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_TxPiOn_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_OFF ( 8)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_WID ( 1)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_MSK (0x00000100)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_OFF ( 9)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_WID ( 1)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_MSK (0x00000200)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_TxDisable_OFF (10)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_TxDisable_WID ( 1)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_TxDisable_MSK (0x00000400)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_TxDisable_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_TxDisable_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_RxDisable_OFF (11)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_RxDisable_WID ( 1)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_RxDisable_MSK (0x00000800)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_RxDisable_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_RxDisable_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_TxLong_OFF (12)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_TxLong_WID ( 1)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_TxLong_MSK (0x00001000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_TxLong_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_TxLong_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_OFF (13)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_WID ( 2)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_MSK (0x00006000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_MAX (0x00000003)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_RxReadPointer_OFF (15)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_RxReadPointer_WID ( 3)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_RxReadPointer_MSK (0x00038000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_RxReadPointer_MAX (0x00000007)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_RxReadPointer_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_OFF (18)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_WID ( 1)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_MSK (0x00040000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_OFF (19)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_WID ( 1)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_MSK (0x00080000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_ReadRFRd_OFF (20)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_ReadRFRd_WID ( 1)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_ReadRFRd_MSK (0x00100000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_ReadRFRd_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_ReadRFRd_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_ReadRFWr_OFF (21)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_ReadRFWr_WID ( 1)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_ReadRFWr_MSK (0x00200000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_ReadRFWr_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_ReadRFWr_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_ReadRFRank_OFF (22)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_ReadRFRank_WID ( 2)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_ReadRFRank_MSK (0x00C00000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_ReadRFRank_MAX (0x00000003)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_ReadRFRank_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_OFF (24)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_WID ( 1)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_MSK (0x01000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_OdtSampOff_OFF (25)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_OdtSampOff_WID ( 1)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_OdtSampOff_MSK (0x02000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_OdtSampOff_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_OdtSampOff_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_OFF (26)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_WID ( 1)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_MSK (0x04000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_OFF (27)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_WID ( 1)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_MSK (0x08000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_OFF (28)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_WID ( 1)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_MSK (0x10000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_OFF (29)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_WID ( 1)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_MSK (0x20000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_OFF (30)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_WID ( 1)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_MSK (0x40000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_OFF (31)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_WID ( 1)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_MSK (0x80000000)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_DEF (0x00000000)
+
+#define DDRDATA7CH1_CR_DDRCRVREFADJUST1_REG (0x00000F78)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_OFF ( 0)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_WID ( 7)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_MSK (0x0000007F)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_MAX (0x0000007F)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_OFF ( 7)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_WID ( 7)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_MSK (0x00003F80)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_MAX (0x0000007F)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_OFF (14)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_WID ( 7)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_MSK (0x001FC000)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_MAX (0x0000007F)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_OFF (21)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_WID ( 1)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_MSK (0x00200000)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_OFF (22)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_WID ( 1)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_MSK (0x00400000)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_OFF (23)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_WID ( 1)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_MSK (0x00800000)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_OFF (24)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_WID ( 2)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_MSK (0x03000000)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_MAX (0x00000003)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_OFF (26)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_WID ( 1)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_MSK (0x04000000)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_Rsvd_OFF (27)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_Rsvd_WID ( 2)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_Rsvd_MSK (0x18000000)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_Rsvd_MAX (0x00000003)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_Rsvd_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_caSlowBW_OFF (29)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_caSlowBW_WID ( 1)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_caSlowBW_MSK (0x20000000)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_caSlowBW_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_caSlowBW_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_OFF (30)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_WID ( 1)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_MSK (0x40000000)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_DEF (0x00000000)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_OFF (31)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_WID ( 1)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_MSK (0x80000000)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_MAX (0x00000001)
+ #define DDRDATA7CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_DEF (0x00000000)
+
+#define DDRDATA8CH0_CR_RXTRAINRANK0_REG (0x00001000)
+ #define DDRDATA8CH0_CR_RXTRAINRANK0_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA8CH0_CR_RXTRAINRANK0_RxRcvEnPi_WID ( 9)
+ #define DDRDATA8CH0_CR_RXTRAINRANK0_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA8CH0_CR_RXTRAINRANK0_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA8CH0_CR_RXTRAINRANK0_RxDqsPPi_OFF ( 9)
+ #define DDRDATA8CH0_CR_RXTRAINRANK0_RxDqsPPi_WID ( 6)
+ #define DDRDATA8CH0_CR_RXTRAINRANK0_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA8CH0_CR_RXTRAINRANK0_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA8CH0_CR_RXTRAINRANK0_RxEq_OFF (15)
+ #define DDRDATA8CH0_CR_RXTRAINRANK0_RxEq_WID ( 5)
+ #define DDRDATA8CH0_CR_RXTRAINRANK0_RxEq_MSK (0x000F8000)
+ #define DDRDATA8CH0_CR_RXTRAINRANK0_RxEq_MAX (0x0000001F)
+ #define DDRDATA8CH0_CR_RXTRAINRANK0_RxDqsNPi_OFF (20)
+ #define DDRDATA8CH0_CR_RXTRAINRANK0_RxDqsNPi_WID ( 6)
+ #define DDRDATA8CH0_CR_RXTRAINRANK0_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA8CH0_CR_RXTRAINRANK0_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA8CH0_CR_RXTRAINRANK0_RxVref_OFF (26)
+ #define DDRDATA8CH0_CR_RXTRAINRANK0_RxVref_WID ( 6)
+ #define DDRDATA8CH0_CR_RXTRAINRANK0_RxVref_MSK (0xFC000000)
+ #define DDRDATA8CH0_CR_RXTRAINRANK0_RxVref_MAX (0x0000003F)
+
+#define DDRDATA8CH0_CR_RXTRAINRANK1_REG (0x00001004)
+ #define DDRDATA8CH0_CR_RXTRAINRANK1_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA8CH0_CR_RXTRAINRANK1_RxRcvEnPi_WID ( 9)
+ #define DDRDATA8CH0_CR_RXTRAINRANK1_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA8CH0_CR_RXTRAINRANK1_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA8CH0_CR_RXTRAINRANK1_RxDqsPPi_OFF ( 9)
+ #define DDRDATA8CH0_CR_RXTRAINRANK1_RxDqsPPi_WID ( 6)
+ #define DDRDATA8CH0_CR_RXTRAINRANK1_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA8CH0_CR_RXTRAINRANK1_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA8CH0_CR_RXTRAINRANK1_RxEq_OFF (15)
+ #define DDRDATA8CH0_CR_RXTRAINRANK1_RxEq_WID ( 5)
+ #define DDRDATA8CH0_CR_RXTRAINRANK1_RxEq_MSK (0x000F8000)
+ #define DDRDATA8CH0_CR_RXTRAINRANK1_RxEq_MAX (0x0000001F)
+ #define DDRDATA8CH0_CR_RXTRAINRANK1_RxDqsNPi_OFF (20)
+ #define DDRDATA8CH0_CR_RXTRAINRANK1_RxDqsNPi_WID ( 6)
+ #define DDRDATA8CH0_CR_RXTRAINRANK1_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA8CH0_CR_RXTRAINRANK1_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA8CH0_CR_RXTRAINRANK1_RxVref_OFF (26)
+ #define DDRDATA8CH0_CR_RXTRAINRANK1_RxVref_WID ( 6)
+ #define DDRDATA8CH0_CR_RXTRAINRANK1_RxVref_MSK (0xFC000000)
+ #define DDRDATA8CH0_CR_RXTRAINRANK1_RxVref_MAX (0x0000003F)
+
+#define DDRDATA8CH0_CR_RXTRAINRANK2_REG (0x00001008)
+ #define DDRDATA8CH0_CR_RXTRAINRANK2_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA8CH0_CR_RXTRAINRANK2_RxRcvEnPi_WID ( 9)
+ #define DDRDATA8CH0_CR_RXTRAINRANK2_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA8CH0_CR_RXTRAINRANK2_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA8CH0_CR_RXTRAINRANK2_RxDqsPPi_OFF ( 9)
+ #define DDRDATA8CH0_CR_RXTRAINRANK2_RxDqsPPi_WID ( 6)
+ #define DDRDATA8CH0_CR_RXTRAINRANK2_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA8CH0_CR_RXTRAINRANK2_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA8CH0_CR_RXTRAINRANK2_RxEq_OFF (15)
+ #define DDRDATA8CH0_CR_RXTRAINRANK2_RxEq_WID ( 5)
+ #define DDRDATA8CH0_CR_RXTRAINRANK2_RxEq_MSK (0x000F8000)
+ #define DDRDATA8CH0_CR_RXTRAINRANK2_RxEq_MAX (0x0000001F)
+ #define DDRDATA8CH0_CR_RXTRAINRANK2_RxDqsNPi_OFF (20)
+ #define DDRDATA8CH0_CR_RXTRAINRANK2_RxDqsNPi_WID ( 6)
+ #define DDRDATA8CH0_CR_RXTRAINRANK2_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA8CH0_CR_RXTRAINRANK2_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA8CH0_CR_RXTRAINRANK2_RxVref_OFF (26)
+ #define DDRDATA8CH0_CR_RXTRAINRANK2_RxVref_WID ( 6)
+ #define DDRDATA8CH0_CR_RXTRAINRANK2_RxVref_MSK (0xFC000000)
+ #define DDRDATA8CH0_CR_RXTRAINRANK2_RxVref_MAX (0x0000003F)
+
+#define DDRDATA8CH0_CR_RXTRAINRANK3_REG (0x0000100C)
+ #define DDRDATA8CH0_CR_RXTRAINRANK3_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA8CH0_CR_RXTRAINRANK3_RxRcvEnPi_WID ( 9)
+ #define DDRDATA8CH0_CR_RXTRAINRANK3_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA8CH0_CR_RXTRAINRANK3_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA8CH0_CR_RXTRAINRANK3_RxDqsPPi_OFF ( 9)
+ #define DDRDATA8CH0_CR_RXTRAINRANK3_RxDqsPPi_WID ( 6)
+ #define DDRDATA8CH0_CR_RXTRAINRANK3_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA8CH0_CR_RXTRAINRANK3_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA8CH0_CR_RXTRAINRANK3_RxEq_OFF (15)
+ #define DDRDATA8CH0_CR_RXTRAINRANK3_RxEq_WID ( 5)
+ #define DDRDATA8CH0_CR_RXTRAINRANK3_RxEq_MSK (0x000F8000)
+ #define DDRDATA8CH0_CR_RXTRAINRANK3_RxEq_MAX (0x0000001F)
+ #define DDRDATA8CH0_CR_RXTRAINRANK3_RxDqsNPi_OFF (20)
+ #define DDRDATA8CH0_CR_RXTRAINRANK3_RxDqsNPi_WID ( 6)
+ #define DDRDATA8CH0_CR_RXTRAINRANK3_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA8CH0_CR_RXTRAINRANK3_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA8CH0_CR_RXTRAINRANK3_RxVref_OFF (26)
+ #define DDRDATA8CH0_CR_RXTRAINRANK3_RxVref_WID ( 6)
+ #define DDRDATA8CH0_CR_RXTRAINRANK3_RxVref_MSK (0xFC000000)
+ #define DDRDATA8CH0_CR_RXTRAINRANK3_RxVref_MAX (0x0000003F)
+
+#define DDRDATA8CH0_CR_RXPERBITRANK0_REG (0x00001010)
+ #define DDRDATA8CH0_CR_RXPERBITRANK0_Lane0_OFF ( 0)
+ #define DDRDATA8CH0_CR_RXPERBITRANK0_Lane0_WID ( 4)
+ #define DDRDATA8CH0_CR_RXPERBITRANK0_Lane0_MSK (0x0000000F)
+ #define DDRDATA8CH0_CR_RXPERBITRANK0_Lane0_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_RXPERBITRANK0_Lane1_OFF ( 4)
+ #define DDRDATA8CH0_CR_RXPERBITRANK0_Lane1_WID ( 4)
+ #define DDRDATA8CH0_CR_RXPERBITRANK0_Lane1_MSK (0x000000F0)
+ #define DDRDATA8CH0_CR_RXPERBITRANK0_Lane1_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_RXPERBITRANK0_Lane2_OFF ( 8)
+ #define DDRDATA8CH0_CR_RXPERBITRANK0_Lane2_WID ( 4)
+ #define DDRDATA8CH0_CR_RXPERBITRANK0_Lane2_MSK (0x00000F00)
+ #define DDRDATA8CH0_CR_RXPERBITRANK0_Lane2_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_RXPERBITRANK0_Lane3_OFF (12)
+ #define DDRDATA8CH0_CR_RXPERBITRANK0_Lane3_WID ( 4)
+ #define DDRDATA8CH0_CR_RXPERBITRANK0_Lane3_MSK (0x0000F000)
+ #define DDRDATA8CH0_CR_RXPERBITRANK0_Lane3_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_RXPERBITRANK0_Lane4_OFF (16)
+ #define DDRDATA8CH0_CR_RXPERBITRANK0_Lane4_WID ( 4)
+ #define DDRDATA8CH0_CR_RXPERBITRANK0_Lane4_MSK (0x000F0000)
+ #define DDRDATA8CH0_CR_RXPERBITRANK0_Lane4_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_RXPERBITRANK0_Lane5_OFF (20)
+ #define DDRDATA8CH0_CR_RXPERBITRANK0_Lane5_WID ( 4)
+ #define DDRDATA8CH0_CR_RXPERBITRANK0_Lane5_MSK (0x00F00000)
+ #define DDRDATA8CH0_CR_RXPERBITRANK0_Lane5_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_RXPERBITRANK0_Lane6_OFF (24)
+ #define DDRDATA8CH0_CR_RXPERBITRANK0_Lane6_WID ( 4)
+ #define DDRDATA8CH0_CR_RXPERBITRANK0_Lane6_MSK (0x0F000000)
+ #define DDRDATA8CH0_CR_RXPERBITRANK0_Lane6_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_RXPERBITRANK0_Lane7_OFF (28)
+ #define DDRDATA8CH0_CR_RXPERBITRANK0_Lane7_WID ( 4)
+ #define DDRDATA8CH0_CR_RXPERBITRANK0_Lane7_MSK (0xF0000000)
+ #define DDRDATA8CH0_CR_RXPERBITRANK0_Lane7_MAX (0x0000000F)
+
+#define DDRDATA8CH0_CR_RXPERBITRANK1_REG (0x00001014)
+ #define DDRDATA8CH0_CR_RXPERBITRANK1_Lane0_OFF ( 0)
+ #define DDRDATA8CH0_CR_RXPERBITRANK1_Lane0_WID ( 4)
+ #define DDRDATA8CH0_CR_RXPERBITRANK1_Lane0_MSK (0x0000000F)
+ #define DDRDATA8CH0_CR_RXPERBITRANK1_Lane0_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_RXPERBITRANK1_Lane1_OFF ( 4)
+ #define DDRDATA8CH0_CR_RXPERBITRANK1_Lane1_WID ( 4)
+ #define DDRDATA8CH0_CR_RXPERBITRANK1_Lane1_MSK (0x000000F0)
+ #define DDRDATA8CH0_CR_RXPERBITRANK1_Lane1_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_RXPERBITRANK1_Lane2_OFF ( 8)
+ #define DDRDATA8CH0_CR_RXPERBITRANK1_Lane2_WID ( 4)
+ #define DDRDATA8CH0_CR_RXPERBITRANK1_Lane2_MSK (0x00000F00)
+ #define DDRDATA8CH0_CR_RXPERBITRANK1_Lane2_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_RXPERBITRANK1_Lane3_OFF (12)
+ #define DDRDATA8CH0_CR_RXPERBITRANK1_Lane3_WID ( 4)
+ #define DDRDATA8CH0_CR_RXPERBITRANK1_Lane3_MSK (0x0000F000)
+ #define DDRDATA8CH0_CR_RXPERBITRANK1_Lane3_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_RXPERBITRANK1_Lane4_OFF (16)
+ #define DDRDATA8CH0_CR_RXPERBITRANK1_Lane4_WID ( 4)
+ #define DDRDATA8CH0_CR_RXPERBITRANK1_Lane4_MSK (0x000F0000)
+ #define DDRDATA8CH0_CR_RXPERBITRANK1_Lane4_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_RXPERBITRANK1_Lane5_OFF (20)
+ #define DDRDATA8CH0_CR_RXPERBITRANK1_Lane5_WID ( 4)
+ #define DDRDATA8CH0_CR_RXPERBITRANK1_Lane5_MSK (0x00F00000)
+ #define DDRDATA8CH0_CR_RXPERBITRANK1_Lane5_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_RXPERBITRANK1_Lane6_OFF (24)
+ #define DDRDATA8CH0_CR_RXPERBITRANK1_Lane6_WID ( 4)
+ #define DDRDATA8CH0_CR_RXPERBITRANK1_Lane6_MSK (0x0F000000)
+ #define DDRDATA8CH0_CR_RXPERBITRANK1_Lane6_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_RXPERBITRANK1_Lane7_OFF (28)
+ #define DDRDATA8CH0_CR_RXPERBITRANK1_Lane7_WID ( 4)
+ #define DDRDATA8CH0_CR_RXPERBITRANK1_Lane7_MSK (0xF0000000)
+ #define DDRDATA8CH0_CR_RXPERBITRANK1_Lane7_MAX (0x0000000F)
+
+#define DDRDATA8CH0_CR_RXPERBITRANK2_REG (0x00001018)
+ #define DDRDATA8CH0_CR_RXPERBITRANK2_Lane0_OFF ( 0)
+ #define DDRDATA8CH0_CR_RXPERBITRANK2_Lane0_WID ( 4)
+ #define DDRDATA8CH0_CR_RXPERBITRANK2_Lane0_MSK (0x0000000F)
+ #define DDRDATA8CH0_CR_RXPERBITRANK2_Lane0_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_RXPERBITRANK2_Lane1_OFF ( 4)
+ #define DDRDATA8CH0_CR_RXPERBITRANK2_Lane1_WID ( 4)
+ #define DDRDATA8CH0_CR_RXPERBITRANK2_Lane1_MSK (0x000000F0)
+ #define DDRDATA8CH0_CR_RXPERBITRANK2_Lane1_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_RXPERBITRANK2_Lane2_OFF ( 8)
+ #define DDRDATA8CH0_CR_RXPERBITRANK2_Lane2_WID ( 4)
+ #define DDRDATA8CH0_CR_RXPERBITRANK2_Lane2_MSK (0x00000F00)
+ #define DDRDATA8CH0_CR_RXPERBITRANK2_Lane2_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_RXPERBITRANK2_Lane3_OFF (12)
+ #define DDRDATA8CH0_CR_RXPERBITRANK2_Lane3_WID ( 4)
+ #define DDRDATA8CH0_CR_RXPERBITRANK2_Lane3_MSK (0x0000F000)
+ #define DDRDATA8CH0_CR_RXPERBITRANK2_Lane3_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_RXPERBITRANK2_Lane4_OFF (16)
+ #define DDRDATA8CH0_CR_RXPERBITRANK2_Lane4_WID ( 4)
+ #define DDRDATA8CH0_CR_RXPERBITRANK2_Lane4_MSK (0x000F0000)
+ #define DDRDATA8CH0_CR_RXPERBITRANK2_Lane4_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_RXPERBITRANK2_Lane5_OFF (20)
+ #define DDRDATA8CH0_CR_RXPERBITRANK2_Lane5_WID ( 4)
+ #define DDRDATA8CH0_CR_RXPERBITRANK2_Lane5_MSK (0x00F00000)
+ #define DDRDATA8CH0_CR_RXPERBITRANK2_Lane5_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_RXPERBITRANK2_Lane6_OFF (24)
+ #define DDRDATA8CH0_CR_RXPERBITRANK2_Lane6_WID ( 4)
+ #define DDRDATA8CH0_CR_RXPERBITRANK2_Lane6_MSK (0x0F000000)
+ #define DDRDATA8CH0_CR_RXPERBITRANK2_Lane6_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_RXPERBITRANK2_Lane7_OFF (28)
+ #define DDRDATA8CH0_CR_RXPERBITRANK2_Lane7_WID ( 4)
+ #define DDRDATA8CH0_CR_RXPERBITRANK2_Lane7_MSK (0xF0000000)
+ #define DDRDATA8CH0_CR_RXPERBITRANK2_Lane7_MAX (0x0000000F)
+
+#define DDRDATA8CH0_CR_RXPERBITRANK3_REG (0x0000101C)
+ #define DDRDATA8CH0_CR_RXPERBITRANK3_Lane0_OFF ( 0)
+ #define DDRDATA8CH0_CR_RXPERBITRANK3_Lane0_WID ( 4)
+ #define DDRDATA8CH0_CR_RXPERBITRANK3_Lane0_MSK (0x0000000F)
+ #define DDRDATA8CH0_CR_RXPERBITRANK3_Lane0_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_RXPERBITRANK3_Lane1_OFF ( 4)
+ #define DDRDATA8CH0_CR_RXPERBITRANK3_Lane1_WID ( 4)
+ #define DDRDATA8CH0_CR_RXPERBITRANK3_Lane1_MSK (0x000000F0)
+ #define DDRDATA8CH0_CR_RXPERBITRANK3_Lane1_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_RXPERBITRANK3_Lane2_OFF ( 8)
+ #define DDRDATA8CH0_CR_RXPERBITRANK3_Lane2_WID ( 4)
+ #define DDRDATA8CH0_CR_RXPERBITRANK3_Lane2_MSK (0x00000F00)
+ #define DDRDATA8CH0_CR_RXPERBITRANK3_Lane2_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_RXPERBITRANK3_Lane3_OFF (12)
+ #define DDRDATA8CH0_CR_RXPERBITRANK3_Lane3_WID ( 4)
+ #define DDRDATA8CH0_CR_RXPERBITRANK3_Lane3_MSK (0x0000F000)
+ #define DDRDATA8CH0_CR_RXPERBITRANK3_Lane3_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_RXPERBITRANK3_Lane4_OFF (16)
+ #define DDRDATA8CH0_CR_RXPERBITRANK3_Lane4_WID ( 4)
+ #define DDRDATA8CH0_CR_RXPERBITRANK3_Lane4_MSK (0x000F0000)
+ #define DDRDATA8CH0_CR_RXPERBITRANK3_Lane4_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_RXPERBITRANK3_Lane5_OFF (20)
+ #define DDRDATA8CH0_CR_RXPERBITRANK3_Lane5_WID ( 4)
+ #define DDRDATA8CH0_CR_RXPERBITRANK3_Lane5_MSK (0x00F00000)
+ #define DDRDATA8CH0_CR_RXPERBITRANK3_Lane5_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_RXPERBITRANK3_Lane6_OFF (24)
+ #define DDRDATA8CH0_CR_RXPERBITRANK3_Lane6_WID ( 4)
+ #define DDRDATA8CH0_CR_RXPERBITRANK3_Lane6_MSK (0x0F000000)
+ #define DDRDATA8CH0_CR_RXPERBITRANK3_Lane6_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_RXPERBITRANK3_Lane7_OFF (28)
+ #define DDRDATA8CH0_CR_RXPERBITRANK3_Lane7_WID ( 4)
+ #define DDRDATA8CH0_CR_RXPERBITRANK3_Lane7_MSK (0xF0000000)
+ #define DDRDATA8CH0_CR_RXPERBITRANK3_Lane7_MAX (0x0000000F)
+
+#define DDRDATA8CH0_CR_TXTRAINRANK0_REG (0x00001020)
+ #define DDRDATA8CH0_CR_TXTRAINRANK0_TxDqDelay_OFF ( 0)
+ #define DDRDATA8CH0_CR_TXTRAINRANK0_TxDqDelay_WID ( 9)
+ #define DDRDATA8CH0_CR_TXTRAINRANK0_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA8CH0_CR_TXTRAINRANK0_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA8CH0_CR_TXTRAINRANK0_TxDqsDelay_OFF ( 9)
+ #define DDRDATA8CH0_CR_TXTRAINRANK0_TxDqsDelay_WID ( 9)
+ #define DDRDATA8CH0_CR_TXTRAINRANK0_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA8CH0_CR_TXTRAINRANK0_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA8CH0_CR_TXTRAINRANK0_Spare0_OFF (18)
+ #define DDRDATA8CH0_CR_TXTRAINRANK0_Spare0_WID ( 2)
+ #define DDRDATA8CH0_CR_TXTRAINRANK0_Spare0_MSK (0x000C0000)
+ #define DDRDATA8CH0_CR_TXTRAINRANK0_Spare0_MAX (0x00000003)
+ #define DDRDATA8CH0_CR_TXTRAINRANK0_TxEqualization_OFF (20)
+ #define DDRDATA8CH0_CR_TXTRAINRANK0_TxEqualization_WID ( 6)
+ #define DDRDATA8CH0_CR_TXTRAINRANK0_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA8CH0_CR_TXTRAINRANK0_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA8CH0_CR_TXTRAINRANK0_Spare1_OFF (26)
+ #define DDRDATA8CH0_CR_TXTRAINRANK0_Spare1_WID ( 6)
+ #define DDRDATA8CH0_CR_TXTRAINRANK0_Spare1_MSK (0xFC000000)
+ #define DDRDATA8CH0_CR_TXTRAINRANK0_Spare1_MAX (0x0000003F)
+
+#define DDRDATA8CH0_CR_TXTRAINRANK1_REG (0x00001024)
+ #define DDRDATA8CH0_CR_TXTRAINRANK1_TxDqDelay_OFF ( 0)
+ #define DDRDATA8CH0_CR_TXTRAINRANK1_TxDqDelay_WID ( 9)
+ #define DDRDATA8CH0_CR_TXTRAINRANK1_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA8CH0_CR_TXTRAINRANK1_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA8CH0_CR_TXTRAINRANK1_TxDqsDelay_OFF ( 9)
+ #define DDRDATA8CH0_CR_TXTRAINRANK1_TxDqsDelay_WID ( 9)
+ #define DDRDATA8CH0_CR_TXTRAINRANK1_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA8CH0_CR_TXTRAINRANK1_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA8CH0_CR_TXTRAINRANK1_Spare0_OFF (18)
+ #define DDRDATA8CH0_CR_TXTRAINRANK1_Spare0_WID ( 2)
+ #define DDRDATA8CH0_CR_TXTRAINRANK1_Spare0_MSK (0x000C0000)
+ #define DDRDATA8CH0_CR_TXTRAINRANK1_Spare0_MAX (0x00000003)
+ #define DDRDATA8CH0_CR_TXTRAINRANK1_TxEqualization_OFF (20)
+ #define DDRDATA8CH0_CR_TXTRAINRANK1_TxEqualization_WID ( 6)
+ #define DDRDATA8CH0_CR_TXTRAINRANK1_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA8CH0_CR_TXTRAINRANK1_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA8CH0_CR_TXTRAINRANK1_Spare1_OFF (26)
+ #define DDRDATA8CH0_CR_TXTRAINRANK1_Spare1_WID ( 6)
+ #define DDRDATA8CH0_CR_TXTRAINRANK1_Spare1_MSK (0xFC000000)
+ #define DDRDATA8CH0_CR_TXTRAINRANK1_Spare1_MAX (0x0000003F)
+
+#define DDRDATA8CH0_CR_TXTRAINRANK2_REG (0x00001028)
+ #define DDRDATA8CH0_CR_TXTRAINRANK2_TxDqDelay_OFF ( 0)
+ #define DDRDATA8CH0_CR_TXTRAINRANK2_TxDqDelay_WID ( 9)
+ #define DDRDATA8CH0_CR_TXTRAINRANK2_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA8CH0_CR_TXTRAINRANK2_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA8CH0_CR_TXTRAINRANK2_TxDqsDelay_OFF ( 9)
+ #define DDRDATA8CH0_CR_TXTRAINRANK2_TxDqsDelay_WID ( 9)
+ #define DDRDATA8CH0_CR_TXTRAINRANK2_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA8CH0_CR_TXTRAINRANK2_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA8CH0_CR_TXTRAINRANK2_Spare0_OFF (18)
+ #define DDRDATA8CH0_CR_TXTRAINRANK2_Spare0_WID ( 2)
+ #define DDRDATA8CH0_CR_TXTRAINRANK2_Spare0_MSK (0x000C0000)
+ #define DDRDATA8CH0_CR_TXTRAINRANK2_Spare0_MAX (0x00000003)
+ #define DDRDATA8CH0_CR_TXTRAINRANK2_TxEqualization_OFF (20)
+ #define DDRDATA8CH0_CR_TXTRAINRANK2_TxEqualization_WID ( 6)
+ #define DDRDATA8CH0_CR_TXTRAINRANK2_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA8CH0_CR_TXTRAINRANK2_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA8CH0_CR_TXTRAINRANK2_Spare1_OFF (26)
+ #define DDRDATA8CH0_CR_TXTRAINRANK2_Spare1_WID ( 6)
+ #define DDRDATA8CH0_CR_TXTRAINRANK2_Spare1_MSK (0xFC000000)
+ #define DDRDATA8CH0_CR_TXTRAINRANK2_Spare1_MAX (0x0000003F)
+
+#define DDRDATA8CH0_CR_TXTRAINRANK3_REG (0x0000102C)
+ #define DDRDATA8CH0_CR_TXTRAINRANK3_TxDqDelay_OFF ( 0)
+ #define DDRDATA8CH0_CR_TXTRAINRANK3_TxDqDelay_WID ( 9)
+ #define DDRDATA8CH0_CR_TXTRAINRANK3_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA8CH0_CR_TXTRAINRANK3_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA8CH0_CR_TXTRAINRANK3_TxDqsDelay_OFF ( 9)
+ #define DDRDATA8CH0_CR_TXTRAINRANK3_TxDqsDelay_WID ( 9)
+ #define DDRDATA8CH0_CR_TXTRAINRANK3_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA8CH0_CR_TXTRAINRANK3_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA8CH0_CR_TXTRAINRANK3_Spare0_OFF (18)
+ #define DDRDATA8CH0_CR_TXTRAINRANK3_Spare0_WID ( 2)
+ #define DDRDATA8CH0_CR_TXTRAINRANK3_Spare0_MSK (0x000C0000)
+ #define DDRDATA8CH0_CR_TXTRAINRANK3_Spare0_MAX (0x00000003)
+ #define DDRDATA8CH0_CR_TXTRAINRANK3_TxEqualization_OFF (20)
+ #define DDRDATA8CH0_CR_TXTRAINRANK3_TxEqualization_WID ( 6)
+ #define DDRDATA8CH0_CR_TXTRAINRANK3_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA8CH0_CR_TXTRAINRANK3_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA8CH0_CR_TXTRAINRANK3_Spare1_OFF (26)
+ #define DDRDATA8CH0_CR_TXTRAINRANK3_Spare1_WID ( 6)
+ #define DDRDATA8CH0_CR_TXTRAINRANK3_Spare1_MSK (0xFC000000)
+ #define DDRDATA8CH0_CR_TXTRAINRANK3_Spare1_MAX (0x0000003F)
+
+#define DDRDATA8CH0_CR_TXPERBITRANK0_REG (0x00001030)
+ #define DDRDATA8CH0_CR_TXPERBITRANK0_Lane0_OFF ( 0)
+ #define DDRDATA8CH0_CR_TXPERBITRANK0_Lane0_WID ( 4)
+ #define DDRDATA8CH0_CR_TXPERBITRANK0_Lane0_MSK (0x0000000F)
+ #define DDRDATA8CH0_CR_TXPERBITRANK0_Lane0_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_TXPERBITRANK0_Lane1_OFF ( 4)
+ #define DDRDATA8CH0_CR_TXPERBITRANK0_Lane1_WID ( 4)
+ #define DDRDATA8CH0_CR_TXPERBITRANK0_Lane1_MSK (0x000000F0)
+ #define DDRDATA8CH0_CR_TXPERBITRANK0_Lane1_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_TXPERBITRANK0_Lane2_OFF ( 8)
+ #define DDRDATA8CH0_CR_TXPERBITRANK0_Lane2_WID ( 4)
+ #define DDRDATA8CH0_CR_TXPERBITRANK0_Lane2_MSK (0x00000F00)
+ #define DDRDATA8CH0_CR_TXPERBITRANK0_Lane2_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_TXPERBITRANK0_Lane3_OFF (12)
+ #define DDRDATA8CH0_CR_TXPERBITRANK0_Lane3_WID ( 4)
+ #define DDRDATA8CH0_CR_TXPERBITRANK0_Lane3_MSK (0x0000F000)
+ #define DDRDATA8CH0_CR_TXPERBITRANK0_Lane3_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_TXPERBITRANK0_Lane4_OFF (16)
+ #define DDRDATA8CH0_CR_TXPERBITRANK0_Lane4_WID ( 4)
+ #define DDRDATA8CH0_CR_TXPERBITRANK0_Lane4_MSK (0x000F0000)
+ #define DDRDATA8CH0_CR_TXPERBITRANK0_Lane4_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_TXPERBITRANK0_Lane5_OFF (20)
+ #define DDRDATA8CH0_CR_TXPERBITRANK0_Lane5_WID ( 4)
+ #define DDRDATA8CH0_CR_TXPERBITRANK0_Lane5_MSK (0x00F00000)
+ #define DDRDATA8CH0_CR_TXPERBITRANK0_Lane5_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_TXPERBITRANK0_Lane6_OFF (24)
+ #define DDRDATA8CH0_CR_TXPERBITRANK0_Lane6_WID ( 4)
+ #define DDRDATA8CH0_CR_TXPERBITRANK0_Lane6_MSK (0x0F000000)
+ #define DDRDATA8CH0_CR_TXPERBITRANK0_Lane6_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_TXPERBITRANK0_Lane7_OFF (28)
+ #define DDRDATA8CH0_CR_TXPERBITRANK0_Lane7_WID ( 4)
+ #define DDRDATA8CH0_CR_TXPERBITRANK0_Lane7_MSK (0xF0000000)
+ #define DDRDATA8CH0_CR_TXPERBITRANK0_Lane7_MAX (0x0000000F)
+
+#define DDRDATA8CH0_CR_TXPERBITRANK1_REG (0x00001034)
+ #define DDRDATA8CH0_CR_TXPERBITRANK1_Lane0_OFF ( 0)
+ #define DDRDATA8CH0_CR_TXPERBITRANK1_Lane0_WID ( 4)
+ #define DDRDATA8CH0_CR_TXPERBITRANK1_Lane0_MSK (0x0000000F)
+ #define DDRDATA8CH0_CR_TXPERBITRANK1_Lane0_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_TXPERBITRANK1_Lane1_OFF ( 4)
+ #define DDRDATA8CH0_CR_TXPERBITRANK1_Lane1_WID ( 4)
+ #define DDRDATA8CH0_CR_TXPERBITRANK1_Lane1_MSK (0x000000F0)
+ #define DDRDATA8CH0_CR_TXPERBITRANK1_Lane1_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_TXPERBITRANK1_Lane2_OFF ( 8)
+ #define DDRDATA8CH0_CR_TXPERBITRANK1_Lane2_WID ( 4)
+ #define DDRDATA8CH0_CR_TXPERBITRANK1_Lane2_MSK (0x00000F00)
+ #define DDRDATA8CH0_CR_TXPERBITRANK1_Lane2_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_TXPERBITRANK1_Lane3_OFF (12)
+ #define DDRDATA8CH0_CR_TXPERBITRANK1_Lane3_WID ( 4)
+ #define DDRDATA8CH0_CR_TXPERBITRANK1_Lane3_MSK (0x0000F000)
+ #define DDRDATA8CH0_CR_TXPERBITRANK1_Lane3_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_TXPERBITRANK1_Lane4_OFF (16)
+ #define DDRDATA8CH0_CR_TXPERBITRANK1_Lane4_WID ( 4)
+ #define DDRDATA8CH0_CR_TXPERBITRANK1_Lane4_MSK (0x000F0000)
+ #define DDRDATA8CH0_CR_TXPERBITRANK1_Lane4_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_TXPERBITRANK1_Lane5_OFF (20)
+ #define DDRDATA8CH0_CR_TXPERBITRANK1_Lane5_WID ( 4)
+ #define DDRDATA8CH0_CR_TXPERBITRANK1_Lane5_MSK (0x00F00000)
+ #define DDRDATA8CH0_CR_TXPERBITRANK1_Lane5_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_TXPERBITRANK1_Lane6_OFF (24)
+ #define DDRDATA8CH0_CR_TXPERBITRANK1_Lane6_WID ( 4)
+ #define DDRDATA8CH0_CR_TXPERBITRANK1_Lane6_MSK (0x0F000000)
+ #define DDRDATA8CH0_CR_TXPERBITRANK1_Lane6_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_TXPERBITRANK1_Lane7_OFF (28)
+ #define DDRDATA8CH0_CR_TXPERBITRANK1_Lane7_WID ( 4)
+ #define DDRDATA8CH0_CR_TXPERBITRANK1_Lane7_MSK (0xF0000000)
+ #define DDRDATA8CH0_CR_TXPERBITRANK1_Lane7_MAX (0x0000000F)
+
+#define DDRDATA8CH0_CR_TXPERBITRANK2_REG (0x00001038)
+ #define DDRDATA8CH0_CR_TXPERBITRANK2_Lane0_OFF ( 0)
+ #define DDRDATA8CH0_CR_TXPERBITRANK2_Lane0_WID ( 4)
+ #define DDRDATA8CH0_CR_TXPERBITRANK2_Lane0_MSK (0x0000000F)
+ #define DDRDATA8CH0_CR_TXPERBITRANK2_Lane0_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_TXPERBITRANK2_Lane1_OFF ( 4)
+ #define DDRDATA8CH0_CR_TXPERBITRANK2_Lane1_WID ( 4)
+ #define DDRDATA8CH0_CR_TXPERBITRANK2_Lane1_MSK (0x000000F0)
+ #define DDRDATA8CH0_CR_TXPERBITRANK2_Lane1_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_TXPERBITRANK2_Lane2_OFF ( 8)
+ #define DDRDATA8CH0_CR_TXPERBITRANK2_Lane2_WID ( 4)
+ #define DDRDATA8CH0_CR_TXPERBITRANK2_Lane2_MSK (0x00000F00)
+ #define DDRDATA8CH0_CR_TXPERBITRANK2_Lane2_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_TXPERBITRANK2_Lane3_OFF (12)
+ #define DDRDATA8CH0_CR_TXPERBITRANK2_Lane3_WID ( 4)
+ #define DDRDATA8CH0_CR_TXPERBITRANK2_Lane3_MSK (0x0000F000)
+ #define DDRDATA8CH0_CR_TXPERBITRANK2_Lane3_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_TXPERBITRANK2_Lane4_OFF (16)
+ #define DDRDATA8CH0_CR_TXPERBITRANK2_Lane4_WID ( 4)
+ #define DDRDATA8CH0_CR_TXPERBITRANK2_Lane4_MSK (0x000F0000)
+ #define DDRDATA8CH0_CR_TXPERBITRANK2_Lane4_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_TXPERBITRANK2_Lane5_OFF (20)
+ #define DDRDATA8CH0_CR_TXPERBITRANK2_Lane5_WID ( 4)
+ #define DDRDATA8CH0_CR_TXPERBITRANK2_Lane5_MSK (0x00F00000)
+ #define DDRDATA8CH0_CR_TXPERBITRANK2_Lane5_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_TXPERBITRANK2_Lane6_OFF (24)
+ #define DDRDATA8CH0_CR_TXPERBITRANK2_Lane6_WID ( 4)
+ #define DDRDATA8CH0_CR_TXPERBITRANK2_Lane6_MSK (0x0F000000)
+ #define DDRDATA8CH0_CR_TXPERBITRANK2_Lane6_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_TXPERBITRANK2_Lane7_OFF (28)
+ #define DDRDATA8CH0_CR_TXPERBITRANK2_Lane7_WID ( 4)
+ #define DDRDATA8CH0_CR_TXPERBITRANK2_Lane7_MSK (0xF0000000)
+ #define DDRDATA8CH0_CR_TXPERBITRANK2_Lane7_MAX (0x0000000F)
+
+#define DDRDATA8CH0_CR_TXPERBITRANK3_REG (0x0000103C)
+ #define DDRDATA8CH0_CR_TXPERBITRANK3_Lane0_OFF ( 0)
+ #define DDRDATA8CH0_CR_TXPERBITRANK3_Lane0_WID ( 4)
+ #define DDRDATA8CH0_CR_TXPERBITRANK3_Lane0_MSK (0x0000000F)
+ #define DDRDATA8CH0_CR_TXPERBITRANK3_Lane0_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_TXPERBITRANK3_Lane1_OFF ( 4)
+ #define DDRDATA8CH0_CR_TXPERBITRANK3_Lane1_WID ( 4)
+ #define DDRDATA8CH0_CR_TXPERBITRANK3_Lane1_MSK (0x000000F0)
+ #define DDRDATA8CH0_CR_TXPERBITRANK3_Lane1_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_TXPERBITRANK3_Lane2_OFF ( 8)
+ #define DDRDATA8CH0_CR_TXPERBITRANK3_Lane2_WID ( 4)
+ #define DDRDATA8CH0_CR_TXPERBITRANK3_Lane2_MSK (0x00000F00)
+ #define DDRDATA8CH0_CR_TXPERBITRANK3_Lane2_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_TXPERBITRANK3_Lane3_OFF (12)
+ #define DDRDATA8CH0_CR_TXPERBITRANK3_Lane3_WID ( 4)
+ #define DDRDATA8CH0_CR_TXPERBITRANK3_Lane3_MSK (0x0000F000)
+ #define DDRDATA8CH0_CR_TXPERBITRANK3_Lane3_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_TXPERBITRANK3_Lane4_OFF (16)
+ #define DDRDATA8CH0_CR_TXPERBITRANK3_Lane4_WID ( 4)
+ #define DDRDATA8CH0_CR_TXPERBITRANK3_Lane4_MSK (0x000F0000)
+ #define DDRDATA8CH0_CR_TXPERBITRANK3_Lane4_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_TXPERBITRANK3_Lane5_OFF (20)
+ #define DDRDATA8CH0_CR_TXPERBITRANK3_Lane5_WID ( 4)
+ #define DDRDATA8CH0_CR_TXPERBITRANK3_Lane5_MSK (0x00F00000)
+ #define DDRDATA8CH0_CR_TXPERBITRANK3_Lane5_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_TXPERBITRANK3_Lane6_OFF (24)
+ #define DDRDATA8CH0_CR_TXPERBITRANK3_Lane6_WID ( 4)
+ #define DDRDATA8CH0_CR_TXPERBITRANK3_Lane6_MSK (0x0F000000)
+ #define DDRDATA8CH0_CR_TXPERBITRANK3_Lane6_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_TXPERBITRANK3_Lane7_OFF (28)
+ #define DDRDATA8CH0_CR_TXPERBITRANK3_Lane7_WID ( 4)
+ #define DDRDATA8CH0_CR_TXPERBITRANK3_Lane7_MSK (0xF0000000)
+ #define DDRDATA8CH0_CR_TXPERBITRANK3_Lane7_MAX (0x0000000F)
+
+#define DDRDATA8CH0_CR_RCOMPDATA0_REG (0x00001040)
+ #define DDRDATA8CH0_CR_RCOMPDATA0_RcompDrvUp_OFF ( 0)
+ #define DDRDATA8CH0_CR_RCOMPDATA0_RcompDrvUp_WID ( 6)
+ #define DDRDATA8CH0_CR_RCOMPDATA0_RcompDrvUp_MSK (0x0000003F)
+ #define DDRDATA8CH0_CR_RCOMPDATA0_RcompDrvUp_MAX (0x0000003F)
+ #define DDRDATA8CH0_CR_RCOMPDATA0_Spare0_OFF ( 6)
+ #define DDRDATA8CH0_CR_RCOMPDATA0_Spare0_WID ( 3)
+ #define DDRDATA8CH0_CR_RCOMPDATA0_Spare0_MSK (0x000001C0)
+ #define DDRDATA8CH0_CR_RCOMPDATA0_Spare0_MAX (0x00000007)
+ #define DDRDATA8CH0_CR_RCOMPDATA0_RcompDrvDown_OFF ( 9)
+ #define DDRDATA8CH0_CR_RCOMPDATA0_RcompDrvDown_WID ( 6)
+ #define DDRDATA8CH0_CR_RCOMPDATA0_RcompDrvDown_MSK (0x00007E00)
+ #define DDRDATA8CH0_CR_RCOMPDATA0_RcompDrvDown_MAX (0x0000003F)
+ #define DDRDATA8CH0_CR_RCOMPDATA0_VTComp_OFF (15)
+ #define DDRDATA8CH0_CR_RCOMPDATA0_VTComp_WID ( 5)
+ #define DDRDATA8CH0_CR_RCOMPDATA0_VTComp_MSK (0x000F8000)
+ #define DDRDATA8CH0_CR_RCOMPDATA0_VTComp_MAX (0x0000001F)
+ #define DDRDATA8CH0_CR_RCOMPDATA0_TcoComp_OFF (20)
+ #define DDRDATA8CH0_CR_RCOMPDATA0_TcoComp_WID ( 6)
+ #define DDRDATA8CH0_CR_RCOMPDATA0_TcoComp_MSK (0x03F00000)
+ #define DDRDATA8CH0_CR_RCOMPDATA0_TcoComp_MAX (0x0000003F)
+ #define DDRDATA8CH0_CR_RCOMPDATA0_SlewRateComp_OFF (26)
+ #define DDRDATA8CH0_CR_RCOMPDATA0_SlewRateComp_WID ( 5)
+ #define DDRDATA8CH0_CR_RCOMPDATA0_SlewRateComp_MSK (0x7C000000)
+ #define DDRDATA8CH0_CR_RCOMPDATA0_SlewRateComp_MAX (0x0000001F)
+ #define DDRDATA8CH0_CR_RCOMPDATA0_Spare2_OFF (31)
+ #define DDRDATA8CH0_CR_RCOMPDATA0_Spare2_WID ( 1)
+ #define DDRDATA8CH0_CR_RCOMPDATA0_Spare2_MSK (0x80000000)
+ #define DDRDATA8CH0_CR_RCOMPDATA0_Spare2_MAX (0x00000001)
+
+#define DDRDATA8CH0_CR_RCOMPDATA1_REG (0x00001044)
+ #define DDRDATA8CH0_CR_RCOMPDATA1_RcompOdtUp_OFF ( 0)
+ #define DDRDATA8CH0_CR_RCOMPDATA1_RcompOdtUp_WID ( 6)
+ #define DDRDATA8CH0_CR_RCOMPDATA1_RcompOdtUp_MSK (0x0000003F)
+ #define DDRDATA8CH0_CR_RCOMPDATA1_RcompOdtUp_MAX (0x0000003F)
+ #define DDRDATA8CH0_CR_RCOMPDATA1_Spare0_OFF ( 6)
+ #define DDRDATA8CH0_CR_RCOMPDATA1_Spare0_WID ( 3)
+ #define DDRDATA8CH0_CR_RCOMPDATA1_Spare0_MSK (0x000001C0)
+ #define DDRDATA8CH0_CR_RCOMPDATA1_Spare0_MAX (0x00000007)
+ #define DDRDATA8CH0_CR_RCOMPDATA1_RcompOdtDown_OFF ( 9)
+ #define DDRDATA8CH0_CR_RCOMPDATA1_RcompOdtDown_WID ( 6)
+ #define DDRDATA8CH0_CR_RCOMPDATA1_RcompOdtDown_MSK (0x00007E00)
+ #define DDRDATA8CH0_CR_RCOMPDATA1_RcompOdtDown_MAX (0x0000003F)
+ #define DDRDATA8CH0_CR_RCOMPDATA1_Spare1_OFF (15)
+ #define DDRDATA8CH0_CR_RCOMPDATA1_Spare1_WID ( 1)
+ #define DDRDATA8CH0_CR_RCOMPDATA1_Spare1_MSK (0x00008000)
+ #define DDRDATA8CH0_CR_RCOMPDATA1_Spare1_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_RCOMPDATA1_PanicDrvDn_OFF (16)
+ #define DDRDATA8CH0_CR_RCOMPDATA1_PanicDrvDn_WID ( 6)
+ #define DDRDATA8CH0_CR_RCOMPDATA1_PanicDrvDn_MSK (0x003F0000)
+ #define DDRDATA8CH0_CR_RCOMPDATA1_PanicDrvDn_MAX (0x0000003F)
+ #define DDRDATA8CH0_CR_RCOMPDATA1_PanicDrvUp_OFF (22)
+ #define DDRDATA8CH0_CR_RCOMPDATA1_PanicDrvUp_WID ( 6)
+ #define DDRDATA8CH0_CR_RCOMPDATA1_PanicDrvUp_MSK (0x0FC00000)
+ #define DDRDATA8CH0_CR_RCOMPDATA1_PanicDrvUp_MAX (0x0000003F)
+ #define DDRDATA8CH0_CR_RCOMPDATA1_LevelShifterComp_OFF (28)
+ #define DDRDATA8CH0_CR_RCOMPDATA1_LevelShifterComp_WID ( 3)
+ #define DDRDATA8CH0_CR_RCOMPDATA1_LevelShifterComp_MSK (0x70000000)
+ #define DDRDATA8CH0_CR_RCOMPDATA1_LevelShifterComp_MAX (0x00000007)
+ #define DDRDATA8CH0_CR_RCOMPDATA1_Spare2_OFF (31)
+ #define DDRDATA8CH0_CR_RCOMPDATA1_Spare2_WID ( 1)
+ #define DDRDATA8CH0_CR_RCOMPDATA1_Spare2_MSK (0x80000000)
+ #define DDRDATA8CH0_CR_RCOMPDATA1_Spare2_MAX (0x00000001)
+
+#define DDRDATA8CH0_CR_TXXTALK_REG (0x00001048)
+ #define DDRDATA8CH0_CR_TXXTALK_Lane0_OFF ( 0)
+ #define DDRDATA8CH0_CR_TXXTALK_Lane0_WID ( 4)
+ #define DDRDATA8CH0_CR_TXXTALK_Lane0_MSK (0x0000000F)
+ #define DDRDATA8CH0_CR_TXXTALK_Lane0_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_TXXTALK_Lane1_OFF ( 4)
+ #define DDRDATA8CH0_CR_TXXTALK_Lane1_WID ( 4)
+ #define DDRDATA8CH0_CR_TXXTALK_Lane1_MSK (0x000000F0)
+ #define DDRDATA8CH0_CR_TXXTALK_Lane1_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_TXXTALK_Lane2_OFF ( 8)
+ #define DDRDATA8CH0_CR_TXXTALK_Lane2_WID ( 4)
+ #define DDRDATA8CH0_CR_TXXTALK_Lane2_MSK (0x00000F00)
+ #define DDRDATA8CH0_CR_TXXTALK_Lane2_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_TXXTALK_Lane3_OFF (12)
+ #define DDRDATA8CH0_CR_TXXTALK_Lane3_WID ( 4)
+ #define DDRDATA8CH0_CR_TXXTALK_Lane3_MSK (0x0000F000)
+ #define DDRDATA8CH0_CR_TXXTALK_Lane3_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_TXXTALK_Lane4_OFF (16)
+ #define DDRDATA8CH0_CR_TXXTALK_Lane4_WID ( 4)
+ #define DDRDATA8CH0_CR_TXXTALK_Lane4_MSK (0x000F0000)
+ #define DDRDATA8CH0_CR_TXXTALK_Lane4_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_TXXTALK_Lane5_OFF (20)
+ #define DDRDATA8CH0_CR_TXXTALK_Lane5_WID ( 4)
+ #define DDRDATA8CH0_CR_TXXTALK_Lane5_MSK (0x00F00000)
+ #define DDRDATA8CH0_CR_TXXTALK_Lane5_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_TXXTALK_Lane6_OFF (24)
+ #define DDRDATA8CH0_CR_TXXTALK_Lane6_WID ( 4)
+ #define DDRDATA8CH0_CR_TXXTALK_Lane6_MSK (0x0F000000)
+ #define DDRDATA8CH0_CR_TXXTALK_Lane6_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_TXXTALK_Lane7_OFF (28)
+ #define DDRDATA8CH0_CR_TXXTALK_Lane7_WID ( 4)
+ #define DDRDATA8CH0_CR_TXXTALK_Lane7_MSK (0xF0000000)
+ #define DDRDATA8CH0_CR_TXXTALK_Lane7_MAX (0x0000000F)
+
+#define DDRDATA8CH0_CR_RXOFFSETVDQ_REG (0x0000104C)
+ #define DDRDATA8CH0_CR_RXOFFSETVDQ_Lane0_OFF ( 0)
+ #define DDRDATA8CH0_CR_RXOFFSETVDQ_Lane0_WID ( 4)
+ #define DDRDATA8CH0_CR_RXOFFSETVDQ_Lane0_MSK (0x0000000F)
+ #define DDRDATA8CH0_CR_RXOFFSETVDQ_Lane0_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_RXOFFSETVDQ_Lane1_OFF ( 4)
+ #define DDRDATA8CH0_CR_RXOFFSETVDQ_Lane1_WID ( 4)
+ #define DDRDATA8CH0_CR_RXOFFSETVDQ_Lane1_MSK (0x000000F0)
+ #define DDRDATA8CH0_CR_RXOFFSETVDQ_Lane1_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_RXOFFSETVDQ_Lane2_OFF ( 8)
+ #define DDRDATA8CH0_CR_RXOFFSETVDQ_Lane2_WID ( 4)
+ #define DDRDATA8CH0_CR_RXOFFSETVDQ_Lane2_MSK (0x00000F00)
+ #define DDRDATA8CH0_CR_RXOFFSETVDQ_Lane2_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_RXOFFSETVDQ_Lane3_OFF (12)
+ #define DDRDATA8CH0_CR_RXOFFSETVDQ_Lane3_WID ( 4)
+ #define DDRDATA8CH0_CR_RXOFFSETVDQ_Lane3_MSK (0x0000F000)
+ #define DDRDATA8CH0_CR_RXOFFSETVDQ_Lane3_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_RXOFFSETVDQ_Lane4_OFF (16)
+ #define DDRDATA8CH0_CR_RXOFFSETVDQ_Lane4_WID ( 4)
+ #define DDRDATA8CH0_CR_RXOFFSETVDQ_Lane4_MSK (0x000F0000)
+ #define DDRDATA8CH0_CR_RXOFFSETVDQ_Lane4_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_RXOFFSETVDQ_Lane5_OFF (20)
+ #define DDRDATA8CH0_CR_RXOFFSETVDQ_Lane5_WID ( 4)
+ #define DDRDATA8CH0_CR_RXOFFSETVDQ_Lane5_MSK (0x00F00000)
+ #define DDRDATA8CH0_CR_RXOFFSETVDQ_Lane5_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_RXOFFSETVDQ_Lane6_OFF (24)
+ #define DDRDATA8CH0_CR_RXOFFSETVDQ_Lane6_WID ( 4)
+ #define DDRDATA8CH0_CR_RXOFFSETVDQ_Lane6_MSK (0x0F000000)
+ #define DDRDATA8CH0_CR_RXOFFSETVDQ_Lane6_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_RXOFFSETVDQ_Lane7_OFF (28)
+ #define DDRDATA8CH0_CR_RXOFFSETVDQ_Lane7_WID ( 4)
+ #define DDRDATA8CH0_CR_RXOFFSETVDQ_Lane7_MSK (0xF0000000)
+ #define DDRDATA8CH0_CR_RXOFFSETVDQ_Lane7_MAX (0x0000000F)
+
+#define DDRDATA8CH0_CR_DDRDATARESERVED_REG (0x00001050)
+ #define DDRDATA8CH0_CR_DDRDATARESERVED_Spare_OFF ( 0)
+ #define DDRDATA8CH0_CR_DDRDATARESERVED_Spare_WID (32)
+ #define DDRDATA8CH0_CR_DDRDATARESERVED_Spare_MSK (0xFFFFFFFF)
+ #define DDRDATA8CH0_CR_DDRDATARESERVED_Spare_MAX (0xFFFFFFFF)
+
+#define DDRDATA8CH0_CR_DATATRAINFEEDBACK_REG (0x00001054)
+ #define DDRDATA8CH0_CR_DATATRAINFEEDBACK_DataTrainFeedback_OFF ( 0)
+ #define DDRDATA8CH0_CR_DATATRAINFEEDBACK_DataTrainFeedback_WID ( 9)
+ #define DDRDATA8CH0_CR_DATATRAINFEEDBACK_DataTrainFeedback_MSK (0x000001FF)
+ #define DDRDATA8CH0_CR_DATATRAINFEEDBACK_DataTrainFeedback_MAX (0x000001FF)
+ #define DDRDATA8CH0_CR_DATATRAINFEEDBACK_Spare_OFF ( 9)
+ #define DDRDATA8CH0_CR_DATATRAINFEEDBACK_Spare_WID (23)
+ #define DDRDATA8CH0_CR_DATATRAINFEEDBACK_Spare_MSK (0xFFFFFE00)
+ #define DDRDATA8CH0_CR_DATATRAINFEEDBACK_Spare_MAX (0x007FFFFF)
+
+#define DDRDATA8CH0_CR_DLLPITESTANDADC_REG (0x00001058)
+ #define DDRDATA8CH0_CR_DLLPITESTANDADC_RunTest_OFF ( 0)
+ #define DDRDATA8CH0_CR_DLLPITESTANDADC_RunTest_WID ( 1)
+ #define DDRDATA8CH0_CR_DLLPITESTANDADC_RunTest_MSK (0x00000001)
+ #define DDRDATA8CH0_CR_DLLPITESTANDADC_RunTest_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DLLPITESTANDADC_RunTest_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DLLPITESTANDADC_Load_OFF ( 1)
+ #define DDRDATA8CH0_CR_DLLPITESTANDADC_Load_WID ( 1)
+ #define DDRDATA8CH0_CR_DLLPITESTANDADC_Load_MSK (0x00000002)
+ #define DDRDATA8CH0_CR_DLLPITESTANDADC_Load_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DLLPITESTANDADC_Load_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DLLPITESTANDADC_ModeHVM_OFF ( 2)
+ #define DDRDATA8CH0_CR_DLLPITESTANDADC_ModeHVM_WID ( 1)
+ #define DDRDATA8CH0_CR_DLLPITESTANDADC_ModeHVM_MSK (0x00000004)
+ #define DDRDATA8CH0_CR_DLLPITESTANDADC_ModeHVM_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DLLPITESTANDADC_ModeHVM_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DLLPITESTANDADC_ModeDV_OFF ( 3)
+ #define DDRDATA8CH0_CR_DLLPITESTANDADC_ModeDV_WID ( 1)
+ #define DDRDATA8CH0_CR_DLLPITESTANDADC_ModeDV_MSK (0x00000008)
+ #define DDRDATA8CH0_CR_DLLPITESTANDADC_ModeDV_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DLLPITESTANDADC_ModeDV_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DLLPITESTANDADC_ModeADC_OFF ( 4)
+ #define DDRDATA8CH0_CR_DLLPITESTANDADC_ModeADC_WID ( 1)
+ #define DDRDATA8CH0_CR_DLLPITESTANDADC_ModeADC_MSK (0x00000010)
+ #define DDRDATA8CH0_CR_DLLPITESTANDADC_ModeADC_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DLLPITESTANDADC_ModeADC_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DLLPITESTANDADC_LoadCount_OFF ( 5)
+ #define DDRDATA8CH0_CR_DLLPITESTANDADC_LoadCount_WID (10)
+ #define DDRDATA8CH0_CR_DLLPITESTANDADC_LoadCount_MSK (0x00007FE0)
+ #define DDRDATA8CH0_CR_DLLPITESTANDADC_LoadCount_MAX (0x000003FF)
+ #define DDRDATA8CH0_CR_DLLPITESTANDADC_CountStatus_OFF (15)
+ #define DDRDATA8CH0_CR_DLLPITESTANDADC_CountStatus_WID (10)
+ #define DDRDATA8CH0_CR_DLLPITESTANDADC_CountStatus_MSK (0x01FF8000)
+ #define DDRDATA8CH0_CR_DLLPITESTANDADC_CountStatus_MAX (0x000003FF)
+ #define DDRDATA8CH0_CR_DLLPITESTANDADC_CountStatus_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DLLPITESTANDADC_Spare_OFF (25)
+ #define DDRDATA8CH0_CR_DLLPITESTANDADC_Spare_WID ( 7)
+ #define DDRDATA8CH0_CR_DLLPITESTANDADC_Spare_MSK (0xFE000000)
+ #define DDRDATA8CH0_CR_DLLPITESTANDADC_Spare_MAX (0x0000007F)
+
+#define DDRDATA8CH0_CR_DDRCRDATAOFFSETCOMP_REG (0x0000105C)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_OFF ( 0)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_WID ( 6)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_MSK (0x0000003F)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_MAX (0x0000003F)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_OFF ( 6)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_WID ( 6)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_MSK (0x00000FC0)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_MAX (0x0000003F)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_OFF (12)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_WID ( 5)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_MSK (0x0001F000)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_MAX (0x0000001F)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_OFF (17)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_WID ( 5)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_MSK (0x003E0000)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_MAX (0x0000001F)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_OFF (22)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_WID ( 5)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_MSK (0x07C00000)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_MAX (0x0000001F)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_OFF (27)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_WID ( 5)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_MSK (0xF8000000)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_MAX (0x0000001F)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_DEF (0x00000000)
+
+#define DDRDATA8CH0_CR_DDRCRDATACONTROL1_REG (0x00001060)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_RefPi_OFF ( 0)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_RefPi_WID ( 4)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_RefPi_MSK (0x0000000F)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_RefPi_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_RefPi_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_DllMask_OFF ( 4)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_DllMask_WID ( 2)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_DllMask_MSK (0x00000030)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_DllMask_MAX (0x00000003)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_DllMask_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_DllWeakLock_OFF ( 6)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_DllWeakLock_WID ( 1)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_DllWeakLock_MSK (0x00000040)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_DllWeakLock_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_DllWeakLock_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_OFF ( 7)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_WID ( 3)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_MSK (0x00000380)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_MAX (0x00000007)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_SdllSegmentDisable_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_OFF (10)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_WID ( 3)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_MSK (0x00001C00)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_MAX (0x00000007)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_RxBiasCtl_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_OdtDelay_OFF (13)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_OdtDelay_WID ( 4)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_OdtDelay_MSK (0x0001E000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_OdtDelay_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_OdtDelay_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_OdtDuration_OFF (17)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_OdtDuration_WID ( 3)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_OdtDuration_MSK (0x000E0000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_OdtDuration_MAX (0x00000007)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_OdtDuration_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_OFF (20)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_WID ( 4)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_MSK (0x00F00000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_SenseAmpDelay_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_OFF (24)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_WID ( 3)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_MSK (0x07000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_MAX (0x00000007)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_SenseAmpDuration_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_OFF (27)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_WID ( 3)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_MSK (0x38000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_MAX (0x00000007)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_BurstEndODTDelay_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_OFF (30)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_WID ( 1)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_MSK (0x40000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_Rsvd1_OFF (31)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_Rsvd1_WID ( 1)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_Rsvd1_MSK (0x80000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_Rsvd1_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL1_Rsvd1_DEF (0x00000000)
+
+#define DDRDATA8CH0_CR_DDRCRDATACONTROL2_REG (0x00001064)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_OFF ( 0)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_WID ( 5)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_MSK (0x0000001F)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_MAX (0x0000001F)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL2_RxStaggerCtl_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_OFF ( 5)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_WID ( 1)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_MSK (0x00000020)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL2_ForceRxOn_OFF ( 6)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL2_ForceRxOn_WID ( 1)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL2_ForceRxOn_MSK (0x00000040)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL2_ForceRxOn_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL2_ForceRxOn_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL2_LeakerComp_OFF ( 7)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL2_LeakerComp_WID ( 2)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL2_LeakerComp_MSK (0x00000180)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL2_LeakerComp_MAX (0x00000003)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL2_LeakerComp_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_OFF ( 9)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_WID ( 4)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_MSK (0x00001E00)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_MAX (0x0000000F)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_DEF (0x00000008)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_OFF (13)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_WID ( 5)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_MSK (0x0003E000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_MAX (0x0000001F)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_DEF (0x00000011)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_OFF (18)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_WID ( 1)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_MSK (0x00040000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL2_WlLongDelEn_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL2_Spare_OFF (19)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL2_Spare_WID (13)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL2_Spare_MSK (0xFFF80000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL2_Spare_MAX (0x00001FFF)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL2_Spare_DEF (0x00000000)
+
+#define DDRDATA8CH0_CR_DDRCRVSSHIORVREFCONTROL_REG (0x0000106C)
+ #define DDRDATA8CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_OFF ( 0)
+ #define DDRDATA8CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_WID (24)
+ #define DDRDATA8CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_MSK (0x00FFFFFF)
+ #define DDRDATA8CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_MAX (0x00FFFFFF)
+ #define DDRDATA8CH0_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_OFF (24)
+ #define DDRDATA8CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_WID ( 8)
+ #define DDRDATA8CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_MSK (0xFF000000)
+ #define DDRDATA8CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_MAX (0x000000FF)
+ #define DDRDATA8CH0_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_DEF (0x00000000)
+
+#define DDRDATA8CH0_CR_DDRCRDATAOFFSETTRAIN_REG (0x00001070)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_OFF ( 0)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_WID ( 6)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_MSK (0x0000003F)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_MAX (0x0000003F)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_OFF ( 6)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_WID ( 6)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_MSK (0x00000FC0)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_MAX (0x0000003F)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_OFF (12)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_WID ( 6)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_MSK (0x0003F000)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_MAX (0x0000003F)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_OFF (18)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_WID ( 6)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_MSK (0x00FC0000)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_MAX (0x0000003F)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_OFF (24)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_WID ( 7)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_MSK (0x7F000000)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_MAX (0x0000007F)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_OFF (31)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_WID ( 1)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_MSK (0x80000000)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DDRCRDATAOFFSETTRAIN_Spare_DEF (0x00000000)
+
+#define DDRDATA8CH0_CR_DDRCRDATACONTROL0_REG (0x00001074)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_OFF ( 0)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_WID ( 1)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_MSK (0x00000001)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_RxTrainingMode_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_OFF ( 1)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_WID ( 1)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_MSK (0x00000002)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_WLTrainingMode_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_OFF ( 2)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_WID ( 1)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_MSK (0x00000004)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_RLTrainingMode_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_OFF ( 3)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_WID ( 1)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_MSK (0x00000008)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_SenseampTrainingMode_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_TxOn_OFF ( 4)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_TxOn_WID ( 1)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_TxOn_MSK (0x00000010)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_TxOn_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_TxOn_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_RfOn_OFF ( 5)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_RfOn_WID ( 1)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_RfOn_MSK (0x00000020)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_RfOn_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_RfOn_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_RxPiOn_OFF ( 6)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_RxPiOn_WID ( 1)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_RxPiOn_MSK (0x00000040)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_RxPiOn_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_RxPiOn_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_TxPiOn_OFF ( 7)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_TxPiOn_WID ( 1)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_TxPiOn_MSK (0x00000080)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_TxPiOn_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_TxPiOn_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_OFF ( 8)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_WID ( 1)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_MSK (0x00000100)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_InternalClocksOn_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_OFF ( 9)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_WID ( 1)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_MSK (0x00000200)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_RepeaterClocksOn_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_TxDisable_OFF (10)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_TxDisable_WID ( 1)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_TxDisable_MSK (0x00000400)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_TxDisable_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_TxDisable_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_RxDisable_OFF (11)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_RxDisable_WID ( 1)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_RxDisable_MSK (0x00000800)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_RxDisable_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_RxDisable_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_TxLong_OFF (12)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_TxLong_WID ( 1)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_TxLong_MSK (0x00001000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_TxLong_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_TxLong_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_OFF (13)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_WID ( 2)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_MSK (0x00006000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_MAX (0x00000003)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_RxDqsCtle_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_RxReadPointer_OFF (15)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_RxReadPointer_WID ( 3)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_RxReadPointer_MSK (0x00038000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_RxReadPointer_MAX (0x00000007)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_RxReadPointer_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_OFF (18)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_WID ( 1)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_MSK (0x00040000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_DriverSegmentEnable_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_OFF (19)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_WID ( 1)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_MSK (0x00080000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_DataVccddqHi_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_ReadRFRd_OFF (20)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_ReadRFRd_WID ( 1)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_ReadRFRd_MSK (0x00100000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_ReadRFRd_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_ReadRFRd_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_ReadRFWr_OFF (21)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_ReadRFWr_WID ( 1)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_ReadRFWr_MSK (0x00200000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_ReadRFWr_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_ReadRFWr_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_ReadRFRank_OFF (22)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_ReadRFRank_WID ( 2)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_ReadRFRank_MSK (0x00C00000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_ReadRFRank_MAX (0x00000003)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_ReadRFRank_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_OFF (24)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_WID ( 1)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_MSK (0x01000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_ForceOdtOn_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_OdtSampOff_OFF (25)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_OdtSampOff_WID ( 1)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_OdtSampOff_MSK (0x02000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_OdtSampOff_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_OdtSampOff_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_OFF (26)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_WID ( 1)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_MSK (0x04000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_DisableOdtStatic_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_OFF (27)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_WID ( 1)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_MSK (0x08000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_OFF (28)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_WID ( 1)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_MSK (0x10000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_LPDDR_Mode_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_OFF (29)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_WID ( 1)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_MSK (0x20000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_EnReadPreamble_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_OFF (30)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_WID ( 1)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_MSK (0x40000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_OdtSampExtendEn_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_OFF (31)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_WID ( 1)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_MSK (0x80000000)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DDRCRDATACONTROL0_EarlyRleakEn_DEF (0x00000000)
+
+#define DDRDATA8CH0_CR_DDRCRVREFADJUST1_REG (0x00001078)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_OFF ( 0)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_WID ( 7)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_MSK (0x0000007F)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_MAX (0x0000007F)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_CAVrefCtl_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_OFF ( 7)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_WID ( 7)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_MSK (0x00003F80)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_MAX (0x0000007F)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_Ch1VrefCtl_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_OFF (14)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_WID ( 7)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_MSK (0x001FC000)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_MAX (0x0000007F)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_Ch0VrefCtl_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_OFF (21)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_WID ( 1)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_MSK (0x00200000)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCA_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_OFF (22)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_WID ( 1)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_MSK (0x00400000)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_OFF (23)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_WID ( 1)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_MSK (0x00800000)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_OFF (24)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_WID ( 2)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_MSK (0x03000000)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_MAX (0x00000003)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_HiZTimerCtrl_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_OFF (26)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_WID ( 1)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_MSK (0x04000000)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_Rsvd_OFF (27)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_Rsvd_WID ( 2)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_Rsvd_MSK (0x18000000)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_Rsvd_MAX (0x00000003)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_Rsvd_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_caSlowBW_OFF (29)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_caSlowBW_WID ( 1)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_caSlowBW_MSK (0x20000000)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_caSlowBW_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_caSlowBW_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_OFF (30)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_WID ( 1)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_MSK (0x40000000)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_ch0SlowBW_DEF (0x00000000)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_OFF (31)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_WID ( 1)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_MSK (0x80000000)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_MAX (0x00000001)
+ #define DDRDATA8CH0_CR_DDRCRVREFADJUST1_ch1SlowBW_DEF (0x00000000)
+
+#define DDRDATA8CH1_CR_RXTRAINRANK0_REG (0x00001100)
+ #define DDRDATA8CH1_CR_RXTRAINRANK0_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA8CH1_CR_RXTRAINRANK0_RxRcvEnPi_WID ( 9)
+ #define DDRDATA8CH1_CR_RXTRAINRANK0_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA8CH1_CR_RXTRAINRANK0_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA8CH1_CR_RXTRAINRANK0_RxDqsPPi_OFF ( 9)
+ #define DDRDATA8CH1_CR_RXTRAINRANK0_RxDqsPPi_WID ( 6)
+ #define DDRDATA8CH1_CR_RXTRAINRANK0_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA8CH1_CR_RXTRAINRANK0_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA8CH1_CR_RXTRAINRANK0_RxEq_OFF (15)
+ #define DDRDATA8CH1_CR_RXTRAINRANK0_RxEq_WID ( 5)
+ #define DDRDATA8CH1_CR_RXTRAINRANK0_RxEq_MSK (0x000F8000)
+ #define DDRDATA8CH1_CR_RXTRAINRANK0_RxEq_MAX (0x0000001F)
+ #define DDRDATA8CH1_CR_RXTRAINRANK0_RxDqsNPi_OFF (20)
+ #define DDRDATA8CH1_CR_RXTRAINRANK0_RxDqsNPi_WID ( 6)
+ #define DDRDATA8CH1_CR_RXTRAINRANK0_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA8CH1_CR_RXTRAINRANK0_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA8CH1_CR_RXTRAINRANK0_RxVref_OFF (26)
+ #define DDRDATA8CH1_CR_RXTRAINRANK0_RxVref_WID ( 6)
+ #define DDRDATA8CH1_CR_RXTRAINRANK0_RxVref_MSK (0xFC000000)
+ #define DDRDATA8CH1_CR_RXTRAINRANK0_RxVref_MAX (0x0000003F)
+
+#define DDRDATA8CH1_CR_RXTRAINRANK1_REG (0x00001104)
+ #define DDRDATA8CH1_CR_RXTRAINRANK1_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA8CH1_CR_RXTRAINRANK1_RxRcvEnPi_WID ( 9)
+ #define DDRDATA8CH1_CR_RXTRAINRANK1_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA8CH1_CR_RXTRAINRANK1_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA8CH1_CR_RXTRAINRANK1_RxDqsPPi_OFF ( 9)
+ #define DDRDATA8CH1_CR_RXTRAINRANK1_RxDqsPPi_WID ( 6)
+ #define DDRDATA8CH1_CR_RXTRAINRANK1_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA8CH1_CR_RXTRAINRANK1_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA8CH1_CR_RXTRAINRANK1_RxEq_OFF (15)
+ #define DDRDATA8CH1_CR_RXTRAINRANK1_RxEq_WID ( 5)
+ #define DDRDATA8CH1_CR_RXTRAINRANK1_RxEq_MSK (0x000F8000)
+ #define DDRDATA8CH1_CR_RXTRAINRANK1_RxEq_MAX (0x0000001F)
+ #define DDRDATA8CH1_CR_RXTRAINRANK1_RxDqsNPi_OFF (20)
+ #define DDRDATA8CH1_CR_RXTRAINRANK1_RxDqsNPi_WID ( 6)
+ #define DDRDATA8CH1_CR_RXTRAINRANK1_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA8CH1_CR_RXTRAINRANK1_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA8CH1_CR_RXTRAINRANK1_RxVref_OFF (26)
+ #define DDRDATA8CH1_CR_RXTRAINRANK1_RxVref_WID ( 6)
+ #define DDRDATA8CH1_CR_RXTRAINRANK1_RxVref_MSK (0xFC000000)
+ #define DDRDATA8CH1_CR_RXTRAINRANK1_RxVref_MAX (0x0000003F)
+
+#define DDRDATA8CH1_CR_RXTRAINRANK2_REG (0x00001108)
+ #define DDRDATA8CH1_CR_RXTRAINRANK2_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA8CH1_CR_RXTRAINRANK2_RxRcvEnPi_WID ( 9)
+ #define DDRDATA8CH1_CR_RXTRAINRANK2_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA8CH1_CR_RXTRAINRANK2_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA8CH1_CR_RXTRAINRANK2_RxDqsPPi_OFF ( 9)
+ #define DDRDATA8CH1_CR_RXTRAINRANK2_RxDqsPPi_WID ( 6)
+ #define DDRDATA8CH1_CR_RXTRAINRANK2_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA8CH1_CR_RXTRAINRANK2_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA8CH1_CR_RXTRAINRANK2_RxEq_OFF (15)
+ #define DDRDATA8CH1_CR_RXTRAINRANK2_RxEq_WID ( 5)
+ #define DDRDATA8CH1_CR_RXTRAINRANK2_RxEq_MSK (0x000F8000)
+ #define DDRDATA8CH1_CR_RXTRAINRANK2_RxEq_MAX (0x0000001F)
+ #define DDRDATA8CH1_CR_RXTRAINRANK2_RxDqsNPi_OFF (20)
+ #define DDRDATA8CH1_CR_RXTRAINRANK2_RxDqsNPi_WID ( 6)
+ #define DDRDATA8CH1_CR_RXTRAINRANK2_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA8CH1_CR_RXTRAINRANK2_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA8CH1_CR_RXTRAINRANK2_RxVref_OFF (26)
+ #define DDRDATA8CH1_CR_RXTRAINRANK2_RxVref_WID ( 6)
+ #define DDRDATA8CH1_CR_RXTRAINRANK2_RxVref_MSK (0xFC000000)
+ #define DDRDATA8CH1_CR_RXTRAINRANK2_RxVref_MAX (0x0000003F)
+
+#define DDRDATA8CH1_CR_RXTRAINRANK3_REG (0x0000110C)
+ #define DDRDATA8CH1_CR_RXTRAINRANK3_RxRcvEnPi_OFF ( 0)
+ #define DDRDATA8CH1_CR_RXTRAINRANK3_RxRcvEnPi_WID ( 9)
+ #define DDRDATA8CH1_CR_RXTRAINRANK3_RxRcvEnPi_MSK (0x000001FF)
+ #define DDRDATA8CH1_CR_RXTRAINRANK3_RxRcvEnPi_MAX (0x000001FF)
+ #define DDRDATA8CH1_CR_RXTRAINRANK3_RxDqsPPi_OFF ( 9)
+ #define DDRDATA8CH1_CR_RXTRAINRANK3_RxDqsPPi_WID ( 6)
+ #define DDRDATA8CH1_CR_RXTRAINRANK3_RxDqsPPi_MSK (0x00007E00)
+ #define DDRDATA8CH1_CR_RXTRAINRANK3_RxDqsPPi_MAX (0x0000003F)
+ #define DDRDATA8CH1_CR_RXTRAINRANK3_RxEq_OFF (15)
+ #define DDRDATA8CH1_CR_RXTRAINRANK3_RxEq_WID ( 5)
+ #define DDRDATA8CH1_CR_RXTRAINRANK3_RxEq_MSK (0x000F8000)
+ #define DDRDATA8CH1_CR_RXTRAINRANK3_RxEq_MAX (0x0000001F)
+ #define DDRDATA8CH1_CR_RXTRAINRANK3_RxDqsNPi_OFF (20)
+ #define DDRDATA8CH1_CR_RXTRAINRANK3_RxDqsNPi_WID ( 6)
+ #define DDRDATA8CH1_CR_RXTRAINRANK3_RxDqsNPi_MSK (0x03F00000)
+ #define DDRDATA8CH1_CR_RXTRAINRANK3_RxDqsNPi_MAX (0x0000003F)
+ #define DDRDATA8CH1_CR_RXTRAINRANK3_RxVref_OFF (26)
+ #define DDRDATA8CH1_CR_RXTRAINRANK3_RxVref_WID ( 6)
+ #define DDRDATA8CH1_CR_RXTRAINRANK3_RxVref_MSK (0xFC000000)
+ #define DDRDATA8CH1_CR_RXTRAINRANK3_RxVref_MAX (0x0000003F)
+
+#define DDRDATA8CH1_CR_RXPERBITRANK0_REG (0x00001110)
+ #define DDRDATA8CH1_CR_RXPERBITRANK0_Lane0_OFF ( 0)
+ #define DDRDATA8CH1_CR_RXPERBITRANK0_Lane0_WID ( 4)
+ #define DDRDATA8CH1_CR_RXPERBITRANK0_Lane0_MSK (0x0000000F)
+ #define DDRDATA8CH1_CR_RXPERBITRANK0_Lane0_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_RXPERBITRANK0_Lane1_OFF ( 4)
+ #define DDRDATA8CH1_CR_RXPERBITRANK0_Lane1_WID ( 4)
+ #define DDRDATA8CH1_CR_RXPERBITRANK0_Lane1_MSK (0x000000F0)
+ #define DDRDATA8CH1_CR_RXPERBITRANK0_Lane1_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_RXPERBITRANK0_Lane2_OFF ( 8)
+ #define DDRDATA8CH1_CR_RXPERBITRANK0_Lane2_WID ( 4)
+ #define DDRDATA8CH1_CR_RXPERBITRANK0_Lane2_MSK (0x00000F00)
+ #define DDRDATA8CH1_CR_RXPERBITRANK0_Lane2_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_RXPERBITRANK0_Lane3_OFF (12)
+ #define DDRDATA8CH1_CR_RXPERBITRANK0_Lane3_WID ( 4)
+ #define DDRDATA8CH1_CR_RXPERBITRANK0_Lane3_MSK (0x0000F000)
+ #define DDRDATA8CH1_CR_RXPERBITRANK0_Lane3_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_RXPERBITRANK0_Lane4_OFF (16)
+ #define DDRDATA8CH1_CR_RXPERBITRANK0_Lane4_WID ( 4)
+ #define DDRDATA8CH1_CR_RXPERBITRANK0_Lane4_MSK (0x000F0000)
+ #define DDRDATA8CH1_CR_RXPERBITRANK0_Lane4_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_RXPERBITRANK0_Lane5_OFF (20)
+ #define DDRDATA8CH1_CR_RXPERBITRANK0_Lane5_WID ( 4)
+ #define DDRDATA8CH1_CR_RXPERBITRANK0_Lane5_MSK (0x00F00000)
+ #define DDRDATA8CH1_CR_RXPERBITRANK0_Lane5_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_RXPERBITRANK0_Lane6_OFF (24)
+ #define DDRDATA8CH1_CR_RXPERBITRANK0_Lane6_WID ( 4)
+ #define DDRDATA8CH1_CR_RXPERBITRANK0_Lane6_MSK (0x0F000000)
+ #define DDRDATA8CH1_CR_RXPERBITRANK0_Lane6_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_RXPERBITRANK0_Lane7_OFF (28)
+ #define DDRDATA8CH1_CR_RXPERBITRANK0_Lane7_WID ( 4)
+ #define DDRDATA8CH1_CR_RXPERBITRANK0_Lane7_MSK (0xF0000000)
+ #define DDRDATA8CH1_CR_RXPERBITRANK0_Lane7_MAX (0x0000000F)
+
+#define DDRDATA8CH1_CR_RXPERBITRANK1_REG (0x00001114)
+ #define DDRDATA8CH1_CR_RXPERBITRANK1_Lane0_OFF ( 0)
+ #define DDRDATA8CH1_CR_RXPERBITRANK1_Lane0_WID ( 4)
+ #define DDRDATA8CH1_CR_RXPERBITRANK1_Lane0_MSK (0x0000000F)
+ #define DDRDATA8CH1_CR_RXPERBITRANK1_Lane0_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_RXPERBITRANK1_Lane1_OFF ( 4)
+ #define DDRDATA8CH1_CR_RXPERBITRANK1_Lane1_WID ( 4)
+ #define DDRDATA8CH1_CR_RXPERBITRANK1_Lane1_MSK (0x000000F0)
+ #define DDRDATA8CH1_CR_RXPERBITRANK1_Lane1_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_RXPERBITRANK1_Lane2_OFF ( 8)
+ #define DDRDATA8CH1_CR_RXPERBITRANK1_Lane2_WID ( 4)
+ #define DDRDATA8CH1_CR_RXPERBITRANK1_Lane2_MSK (0x00000F00)
+ #define DDRDATA8CH1_CR_RXPERBITRANK1_Lane2_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_RXPERBITRANK1_Lane3_OFF (12)
+ #define DDRDATA8CH1_CR_RXPERBITRANK1_Lane3_WID ( 4)
+ #define DDRDATA8CH1_CR_RXPERBITRANK1_Lane3_MSK (0x0000F000)
+ #define DDRDATA8CH1_CR_RXPERBITRANK1_Lane3_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_RXPERBITRANK1_Lane4_OFF (16)
+ #define DDRDATA8CH1_CR_RXPERBITRANK1_Lane4_WID ( 4)
+ #define DDRDATA8CH1_CR_RXPERBITRANK1_Lane4_MSK (0x000F0000)
+ #define DDRDATA8CH1_CR_RXPERBITRANK1_Lane4_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_RXPERBITRANK1_Lane5_OFF (20)
+ #define DDRDATA8CH1_CR_RXPERBITRANK1_Lane5_WID ( 4)
+ #define DDRDATA8CH1_CR_RXPERBITRANK1_Lane5_MSK (0x00F00000)
+ #define DDRDATA8CH1_CR_RXPERBITRANK1_Lane5_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_RXPERBITRANK1_Lane6_OFF (24)
+ #define DDRDATA8CH1_CR_RXPERBITRANK1_Lane6_WID ( 4)
+ #define DDRDATA8CH1_CR_RXPERBITRANK1_Lane6_MSK (0x0F000000)
+ #define DDRDATA8CH1_CR_RXPERBITRANK1_Lane6_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_RXPERBITRANK1_Lane7_OFF (28)
+ #define DDRDATA8CH1_CR_RXPERBITRANK1_Lane7_WID ( 4)
+ #define DDRDATA8CH1_CR_RXPERBITRANK1_Lane7_MSK (0xF0000000)
+ #define DDRDATA8CH1_CR_RXPERBITRANK1_Lane7_MAX (0x0000000F)
+
+#define DDRDATA8CH1_CR_RXPERBITRANK2_REG (0x00001118)
+ #define DDRDATA8CH1_CR_RXPERBITRANK2_Lane0_OFF ( 0)
+ #define DDRDATA8CH1_CR_RXPERBITRANK2_Lane0_WID ( 4)
+ #define DDRDATA8CH1_CR_RXPERBITRANK2_Lane0_MSK (0x0000000F)
+ #define DDRDATA8CH1_CR_RXPERBITRANK2_Lane0_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_RXPERBITRANK2_Lane1_OFF ( 4)
+ #define DDRDATA8CH1_CR_RXPERBITRANK2_Lane1_WID ( 4)
+ #define DDRDATA8CH1_CR_RXPERBITRANK2_Lane1_MSK (0x000000F0)
+ #define DDRDATA8CH1_CR_RXPERBITRANK2_Lane1_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_RXPERBITRANK2_Lane2_OFF ( 8)
+ #define DDRDATA8CH1_CR_RXPERBITRANK2_Lane2_WID ( 4)
+ #define DDRDATA8CH1_CR_RXPERBITRANK2_Lane2_MSK (0x00000F00)
+ #define DDRDATA8CH1_CR_RXPERBITRANK2_Lane2_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_RXPERBITRANK2_Lane3_OFF (12)
+ #define DDRDATA8CH1_CR_RXPERBITRANK2_Lane3_WID ( 4)
+ #define DDRDATA8CH1_CR_RXPERBITRANK2_Lane3_MSK (0x0000F000)
+ #define DDRDATA8CH1_CR_RXPERBITRANK2_Lane3_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_RXPERBITRANK2_Lane4_OFF (16)
+ #define DDRDATA8CH1_CR_RXPERBITRANK2_Lane4_WID ( 4)
+ #define DDRDATA8CH1_CR_RXPERBITRANK2_Lane4_MSK (0x000F0000)
+ #define DDRDATA8CH1_CR_RXPERBITRANK2_Lane4_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_RXPERBITRANK2_Lane5_OFF (20)
+ #define DDRDATA8CH1_CR_RXPERBITRANK2_Lane5_WID ( 4)
+ #define DDRDATA8CH1_CR_RXPERBITRANK2_Lane5_MSK (0x00F00000)
+ #define DDRDATA8CH1_CR_RXPERBITRANK2_Lane5_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_RXPERBITRANK2_Lane6_OFF (24)
+ #define DDRDATA8CH1_CR_RXPERBITRANK2_Lane6_WID ( 4)
+ #define DDRDATA8CH1_CR_RXPERBITRANK2_Lane6_MSK (0x0F000000)
+ #define DDRDATA8CH1_CR_RXPERBITRANK2_Lane6_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_RXPERBITRANK2_Lane7_OFF (28)
+ #define DDRDATA8CH1_CR_RXPERBITRANK2_Lane7_WID ( 4)
+ #define DDRDATA8CH1_CR_RXPERBITRANK2_Lane7_MSK (0xF0000000)
+ #define DDRDATA8CH1_CR_RXPERBITRANK2_Lane7_MAX (0x0000000F)
+
+#define DDRDATA8CH1_CR_RXPERBITRANK3_REG (0x0000111C)
+ #define DDRDATA8CH1_CR_RXPERBITRANK3_Lane0_OFF ( 0)
+ #define DDRDATA8CH1_CR_RXPERBITRANK3_Lane0_WID ( 4)
+ #define DDRDATA8CH1_CR_RXPERBITRANK3_Lane0_MSK (0x0000000F)
+ #define DDRDATA8CH1_CR_RXPERBITRANK3_Lane0_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_RXPERBITRANK3_Lane1_OFF ( 4)
+ #define DDRDATA8CH1_CR_RXPERBITRANK3_Lane1_WID ( 4)
+ #define DDRDATA8CH1_CR_RXPERBITRANK3_Lane1_MSK (0x000000F0)
+ #define DDRDATA8CH1_CR_RXPERBITRANK3_Lane1_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_RXPERBITRANK3_Lane2_OFF ( 8)
+ #define DDRDATA8CH1_CR_RXPERBITRANK3_Lane2_WID ( 4)
+ #define DDRDATA8CH1_CR_RXPERBITRANK3_Lane2_MSK (0x00000F00)
+ #define DDRDATA8CH1_CR_RXPERBITRANK3_Lane2_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_RXPERBITRANK3_Lane3_OFF (12)
+ #define DDRDATA8CH1_CR_RXPERBITRANK3_Lane3_WID ( 4)
+ #define DDRDATA8CH1_CR_RXPERBITRANK3_Lane3_MSK (0x0000F000)
+ #define DDRDATA8CH1_CR_RXPERBITRANK3_Lane3_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_RXPERBITRANK3_Lane4_OFF (16)
+ #define DDRDATA8CH1_CR_RXPERBITRANK3_Lane4_WID ( 4)
+ #define DDRDATA8CH1_CR_RXPERBITRANK3_Lane4_MSK (0x000F0000)
+ #define DDRDATA8CH1_CR_RXPERBITRANK3_Lane4_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_RXPERBITRANK3_Lane5_OFF (20)
+ #define DDRDATA8CH1_CR_RXPERBITRANK3_Lane5_WID ( 4)
+ #define DDRDATA8CH1_CR_RXPERBITRANK3_Lane5_MSK (0x00F00000)
+ #define DDRDATA8CH1_CR_RXPERBITRANK3_Lane5_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_RXPERBITRANK3_Lane6_OFF (24)
+ #define DDRDATA8CH1_CR_RXPERBITRANK3_Lane6_WID ( 4)
+ #define DDRDATA8CH1_CR_RXPERBITRANK3_Lane6_MSK (0x0F000000)
+ #define DDRDATA8CH1_CR_RXPERBITRANK3_Lane6_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_RXPERBITRANK3_Lane7_OFF (28)
+ #define DDRDATA8CH1_CR_RXPERBITRANK3_Lane7_WID ( 4)
+ #define DDRDATA8CH1_CR_RXPERBITRANK3_Lane7_MSK (0xF0000000)
+ #define DDRDATA8CH1_CR_RXPERBITRANK3_Lane7_MAX (0x0000000F)
+
+#define DDRDATA8CH1_CR_TXTRAINRANK0_REG (0x00001120)
+ #define DDRDATA8CH1_CR_TXTRAINRANK0_TxDqDelay_OFF ( 0)
+ #define DDRDATA8CH1_CR_TXTRAINRANK0_TxDqDelay_WID ( 9)
+ #define DDRDATA8CH1_CR_TXTRAINRANK0_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA8CH1_CR_TXTRAINRANK0_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA8CH1_CR_TXTRAINRANK0_TxDqsDelay_OFF ( 9)
+ #define DDRDATA8CH1_CR_TXTRAINRANK0_TxDqsDelay_WID ( 9)
+ #define DDRDATA8CH1_CR_TXTRAINRANK0_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA8CH1_CR_TXTRAINRANK0_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA8CH1_CR_TXTRAINRANK0_Spare0_OFF (18)
+ #define DDRDATA8CH1_CR_TXTRAINRANK0_Spare0_WID ( 2)
+ #define DDRDATA8CH1_CR_TXTRAINRANK0_Spare0_MSK (0x000C0000)
+ #define DDRDATA8CH1_CR_TXTRAINRANK0_Spare0_MAX (0x00000003)
+ #define DDRDATA8CH1_CR_TXTRAINRANK0_TxEqualization_OFF (20)
+ #define DDRDATA8CH1_CR_TXTRAINRANK0_TxEqualization_WID ( 6)
+ #define DDRDATA8CH1_CR_TXTRAINRANK0_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA8CH1_CR_TXTRAINRANK0_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA8CH1_CR_TXTRAINRANK0_Spare1_OFF (26)
+ #define DDRDATA8CH1_CR_TXTRAINRANK0_Spare1_WID ( 6)
+ #define DDRDATA8CH1_CR_TXTRAINRANK0_Spare1_MSK (0xFC000000)
+ #define DDRDATA8CH1_CR_TXTRAINRANK0_Spare1_MAX (0x0000003F)
+
+#define DDRDATA8CH1_CR_TXTRAINRANK1_REG (0x00001124)
+ #define DDRDATA8CH1_CR_TXTRAINRANK1_TxDqDelay_OFF ( 0)
+ #define DDRDATA8CH1_CR_TXTRAINRANK1_TxDqDelay_WID ( 9)
+ #define DDRDATA8CH1_CR_TXTRAINRANK1_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA8CH1_CR_TXTRAINRANK1_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA8CH1_CR_TXTRAINRANK1_TxDqsDelay_OFF ( 9)
+ #define DDRDATA8CH1_CR_TXTRAINRANK1_TxDqsDelay_WID ( 9)
+ #define DDRDATA8CH1_CR_TXTRAINRANK1_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA8CH1_CR_TXTRAINRANK1_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA8CH1_CR_TXTRAINRANK1_Spare0_OFF (18)
+ #define DDRDATA8CH1_CR_TXTRAINRANK1_Spare0_WID ( 2)
+ #define DDRDATA8CH1_CR_TXTRAINRANK1_Spare0_MSK (0x000C0000)
+ #define DDRDATA8CH1_CR_TXTRAINRANK1_Spare0_MAX (0x00000003)
+ #define DDRDATA8CH1_CR_TXTRAINRANK1_TxEqualization_OFF (20)
+ #define DDRDATA8CH1_CR_TXTRAINRANK1_TxEqualization_WID ( 6)
+ #define DDRDATA8CH1_CR_TXTRAINRANK1_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA8CH1_CR_TXTRAINRANK1_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA8CH1_CR_TXTRAINRANK1_Spare1_OFF (26)
+ #define DDRDATA8CH1_CR_TXTRAINRANK1_Spare1_WID ( 6)
+ #define DDRDATA8CH1_CR_TXTRAINRANK1_Spare1_MSK (0xFC000000)
+ #define DDRDATA8CH1_CR_TXTRAINRANK1_Spare1_MAX (0x0000003F)
+
+#define DDRDATA8CH1_CR_TXTRAINRANK2_REG (0x00001128)
+ #define DDRDATA8CH1_CR_TXTRAINRANK2_TxDqDelay_OFF ( 0)
+ #define DDRDATA8CH1_CR_TXTRAINRANK2_TxDqDelay_WID ( 9)
+ #define DDRDATA8CH1_CR_TXTRAINRANK2_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA8CH1_CR_TXTRAINRANK2_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA8CH1_CR_TXTRAINRANK2_TxDqsDelay_OFF ( 9)
+ #define DDRDATA8CH1_CR_TXTRAINRANK2_TxDqsDelay_WID ( 9)
+ #define DDRDATA8CH1_CR_TXTRAINRANK2_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA8CH1_CR_TXTRAINRANK2_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA8CH1_CR_TXTRAINRANK2_Spare0_OFF (18)
+ #define DDRDATA8CH1_CR_TXTRAINRANK2_Spare0_WID ( 2)
+ #define DDRDATA8CH1_CR_TXTRAINRANK2_Spare0_MSK (0x000C0000)
+ #define DDRDATA8CH1_CR_TXTRAINRANK2_Spare0_MAX (0x00000003)
+ #define DDRDATA8CH1_CR_TXTRAINRANK2_TxEqualization_OFF (20)
+ #define DDRDATA8CH1_CR_TXTRAINRANK2_TxEqualization_WID ( 6)
+ #define DDRDATA8CH1_CR_TXTRAINRANK2_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA8CH1_CR_TXTRAINRANK2_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA8CH1_CR_TXTRAINRANK2_Spare1_OFF (26)
+ #define DDRDATA8CH1_CR_TXTRAINRANK2_Spare1_WID ( 6)
+ #define DDRDATA8CH1_CR_TXTRAINRANK2_Spare1_MSK (0xFC000000)
+ #define DDRDATA8CH1_CR_TXTRAINRANK2_Spare1_MAX (0x0000003F)
+
+#define DDRDATA8CH1_CR_TXTRAINRANK3_REG (0x0000112C)
+ #define DDRDATA8CH1_CR_TXTRAINRANK3_TxDqDelay_OFF ( 0)
+ #define DDRDATA8CH1_CR_TXTRAINRANK3_TxDqDelay_WID ( 9)
+ #define DDRDATA8CH1_CR_TXTRAINRANK3_TxDqDelay_MSK (0x000001FF)
+ #define DDRDATA8CH1_CR_TXTRAINRANK3_TxDqDelay_MAX (0x000001FF)
+ #define DDRDATA8CH1_CR_TXTRAINRANK3_TxDqsDelay_OFF ( 9)
+ #define DDRDATA8CH1_CR_TXTRAINRANK3_TxDqsDelay_WID ( 9)
+ #define DDRDATA8CH1_CR_TXTRAINRANK3_TxDqsDelay_MSK (0x0003FE00)
+ #define DDRDATA8CH1_CR_TXTRAINRANK3_TxDqsDelay_MAX (0x000001FF)
+ #define DDRDATA8CH1_CR_TXTRAINRANK3_Spare0_OFF (18)
+ #define DDRDATA8CH1_CR_TXTRAINRANK3_Spare0_WID ( 2)
+ #define DDRDATA8CH1_CR_TXTRAINRANK3_Spare0_MSK (0x000C0000)
+ #define DDRDATA8CH1_CR_TXTRAINRANK3_Spare0_MAX (0x00000003)
+ #define DDRDATA8CH1_CR_TXTRAINRANK3_TxEqualization_OFF (20)
+ #define DDRDATA8CH1_CR_TXTRAINRANK3_TxEqualization_WID ( 6)
+ #define DDRDATA8CH1_CR_TXTRAINRANK3_TxEqualization_MSK (0x03F00000)
+ #define DDRDATA8CH1_CR_TXTRAINRANK3_TxEqualization_MAX (0x0000003F)
+ #define DDRDATA8CH1_CR_TXTRAINRANK3_Spare1_OFF (26)
+ #define DDRDATA8CH1_CR_TXTRAINRANK3_Spare1_WID ( 6)
+ #define DDRDATA8CH1_CR_TXTRAINRANK3_Spare1_MSK (0xFC000000)
+ #define DDRDATA8CH1_CR_TXTRAINRANK3_Spare1_MAX (0x0000003F)
+
+#define DDRDATA8CH1_CR_TXPERBITRANK0_REG (0x00001130)
+ #define DDRDATA8CH1_CR_TXPERBITRANK0_Lane0_OFF ( 0)
+ #define DDRDATA8CH1_CR_TXPERBITRANK0_Lane0_WID ( 4)
+ #define DDRDATA8CH1_CR_TXPERBITRANK0_Lane0_MSK (0x0000000F)
+ #define DDRDATA8CH1_CR_TXPERBITRANK0_Lane0_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_TXPERBITRANK0_Lane1_OFF ( 4)
+ #define DDRDATA8CH1_CR_TXPERBITRANK0_Lane1_WID ( 4)
+ #define DDRDATA8CH1_CR_TXPERBITRANK0_Lane1_MSK (0x000000F0)
+ #define DDRDATA8CH1_CR_TXPERBITRANK0_Lane1_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_TXPERBITRANK0_Lane2_OFF ( 8)
+ #define DDRDATA8CH1_CR_TXPERBITRANK0_Lane2_WID ( 4)
+ #define DDRDATA8CH1_CR_TXPERBITRANK0_Lane2_MSK (0x00000F00)
+ #define DDRDATA8CH1_CR_TXPERBITRANK0_Lane2_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_TXPERBITRANK0_Lane3_OFF (12)
+ #define DDRDATA8CH1_CR_TXPERBITRANK0_Lane3_WID ( 4)
+ #define DDRDATA8CH1_CR_TXPERBITRANK0_Lane3_MSK (0x0000F000)
+ #define DDRDATA8CH1_CR_TXPERBITRANK0_Lane3_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_TXPERBITRANK0_Lane4_OFF (16)
+ #define DDRDATA8CH1_CR_TXPERBITRANK0_Lane4_WID ( 4)
+ #define DDRDATA8CH1_CR_TXPERBITRANK0_Lane4_MSK (0x000F0000)
+ #define DDRDATA8CH1_CR_TXPERBITRANK0_Lane4_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_TXPERBITRANK0_Lane5_OFF (20)
+ #define DDRDATA8CH1_CR_TXPERBITRANK0_Lane5_WID ( 4)
+ #define DDRDATA8CH1_CR_TXPERBITRANK0_Lane5_MSK (0x00F00000)
+ #define DDRDATA8CH1_CR_TXPERBITRANK0_Lane5_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_TXPERBITRANK0_Lane6_OFF (24)
+ #define DDRDATA8CH1_CR_TXPERBITRANK0_Lane6_WID ( 4)
+ #define DDRDATA8CH1_CR_TXPERBITRANK0_Lane6_MSK (0x0F000000)
+ #define DDRDATA8CH1_CR_TXPERBITRANK0_Lane6_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_TXPERBITRANK0_Lane7_OFF (28)
+ #define DDRDATA8CH1_CR_TXPERBITRANK0_Lane7_WID ( 4)
+ #define DDRDATA8CH1_CR_TXPERBITRANK0_Lane7_MSK (0xF0000000)
+ #define DDRDATA8CH1_CR_TXPERBITRANK0_Lane7_MAX (0x0000000F)
+
+#define DDRDATA8CH1_CR_TXPERBITRANK1_REG (0x00001134)
+ #define DDRDATA8CH1_CR_TXPERBITRANK1_Lane0_OFF ( 0)
+ #define DDRDATA8CH1_CR_TXPERBITRANK1_Lane0_WID ( 4)
+ #define DDRDATA8CH1_CR_TXPERBITRANK1_Lane0_MSK (0x0000000F)
+ #define DDRDATA8CH1_CR_TXPERBITRANK1_Lane0_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_TXPERBITRANK1_Lane1_OFF ( 4)
+ #define DDRDATA8CH1_CR_TXPERBITRANK1_Lane1_WID ( 4)
+ #define DDRDATA8CH1_CR_TXPERBITRANK1_Lane1_MSK (0x000000F0)
+ #define DDRDATA8CH1_CR_TXPERBITRANK1_Lane1_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_TXPERBITRANK1_Lane2_OFF ( 8)
+ #define DDRDATA8CH1_CR_TXPERBITRANK1_Lane2_WID ( 4)
+ #define DDRDATA8CH1_CR_TXPERBITRANK1_Lane2_MSK (0x00000F00)
+ #define DDRDATA8CH1_CR_TXPERBITRANK1_Lane2_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_TXPERBITRANK1_Lane3_OFF (12)
+ #define DDRDATA8CH1_CR_TXPERBITRANK1_Lane3_WID ( 4)
+ #define DDRDATA8CH1_CR_TXPERBITRANK1_Lane3_MSK (0x0000F000)
+ #define DDRDATA8CH1_CR_TXPERBITRANK1_Lane3_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_TXPERBITRANK1_Lane4_OFF (16)
+ #define DDRDATA8CH1_CR_TXPERBITRANK1_Lane4_WID ( 4)
+ #define DDRDATA8CH1_CR_TXPERBITRANK1_Lane4_MSK (0x000F0000)
+ #define DDRDATA8CH1_CR_TXPERBITRANK1_Lane4_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_TXPERBITRANK1_Lane5_OFF (20)
+ #define DDRDATA8CH1_CR_TXPERBITRANK1_Lane5_WID ( 4)
+ #define DDRDATA8CH1_CR_TXPERBITRANK1_Lane5_MSK (0x00F00000)
+ #define DDRDATA8CH1_CR_TXPERBITRANK1_Lane5_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_TXPERBITRANK1_Lane6_OFF (24)
+ #define DDRDATA8CH1_CR_TXPERBITRANK1_Lane6_WID ( 4)
+ #define DDRDATA8CH1_CR_TXPERBITRANK1_Lane6_MSK (0x0F000000)
+ #define DDRDATA8CH1_CR_TXPERBITRANK1_Lane6_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_TXPERBITRANK1_Lane7_OFF (28)
+ #define DDRDATA8CH1_CR_TXPERBITRANK1_Lane7_WID ( 4)
+ #define DDRDATA8CH1_CR_TXPERBITRANK1_Lane7_MSK (0xF0000000)
+ #define DDRDATA8CH1_CR_TXPERBITRANK1_Lane7_MAX (0x0000000F)
+
+#define DDRDATA8CH1_CR_TXPERBITRANK2_REG (0x00001138)
+ #define DDRDATA8CH1_CR_TXPERBITRANK2_Lane0_OFF ( 0)
+ #define DDRDATA8CH1_CR_TXPERBITRANK2_Lane0_WID ( 4)
+ #define DDRDATA8CH1_CR_TXPERBITRANK2_Lane0_MSK (0x0000000F)
+ #define DDRDATA8CH1_CR_TXPERBITRANK2_Lane0_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_TXPERBITRANK2_Lane1_OFF ( 4)
+ #define DDRDATA8CH1_CR_TXPERBITRANK2_Lane1_WID ( 4)
+ #define DDRDATA8CH1_CR_TXPERBITRANK2_Lane1_MSK (0x000000F0)
+ #define DDRDATA8CH1_CR_TXPERBITRANK2_Lane1_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_TXPERBITRANK2_Lane2_OFF ( 8)
+ #define DDRDATA8CH1_CR_TXPERBITRANK2_Lane2_WID ( 4)
+ #define DDRDATA8CH1_CR_TXPERBITRANK2_Lane2_MSK (0x00000F00)
+ #define DDRDATA8CH1_CR_TXPERBITRANK2_Lane2_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_TXPERBITRANK2_Lane3_OFF (12)
+ #define DDRDATA8CH1_CR_TXPERBITRANK2_Lane3_WID ( 4)
+ #define DDRDATA8CH1_CR_TXPERBITRANK2_Lane3_MSK (0x0000F000)
+ #define DDRDATA8CH1_CR_TXPERBITRANK2_Lane3_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_TXPERBITRANK2_Lane4_OFF (16)
+ #define DDRDATA8CH1_CR_TXPERBITRANK2_Lane4_WID ( 4)
+ #define DDRDATA8CH1_CR_TXPERBITRANK2_Lane4_MSK (0x000F0000)
+ #define DDRDATA8CH1_CR_TXPERBITRANK2_Lane4_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_TXPERBITRANK2_Lane5_OFF (20)
+ #define DDRDATA8CH1_CR_TXPERBITRANK2_Lane5_WID ( 4)
+ #define DDRDATA8CH1_CR_TXPERBITRANK2_Lane5_MSK (0x00F00000)
+ #define DDRDATA8CH1_CR_TXPERBITRANK2_Lane5_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_TXPERBITRANK2_Lane6_OFF (24)
+ #define DDRDATA8CH1_CR_TXPERBITRANK2_Lane6_WID ( 4)
+ #define DDRDATA8CH1_CR_TXPERBITRANK2_Lane6_MSK (0x0F000000)
+ #define DDRDATA8CH1_CR_TXPERBITRANK2_Lane6_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_TXPERBITRANK2_Lane7_OFF (28)
+ #define DDRDATA8CH1_CR_TXPERBITRANK2_Lane7_WID ( 4)
+ #define DDRDATA8CH1_CR_TXPERBITRANK2_Lane7_MSK (0xF0000000)
+ #define DDRDATA8CH1_CR_TXPERBITRANK2_Lane7_MAX (0x0000000F)
+
+#define DDRDATA8CH1_CR_TXPERBITRANK3_REG (0x0000113C)
+ #define DDRDATA8CH1_CR_TXPERBITRANK3_Lane0_OFF ( 0)
+ #define DDRDATA8CH1_CR_TXPERBITRANK3_Lane0_WID ( 4)
+ #define DDRDATA8CH1_CR_TXPERBITRANK3_Lane0_MSK (0x0000000F)
+ #define DDRDATA8CH1_CR_TXPERBITRANK3_Lane0_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_TXPERBITRANK3_Lane1_OFF ( 4)
+ #define DDRDATA8CH1_CR_TXPERBITRANK3_Lane1_WID ( 4)
+ #define DDRDATA8CH1_CR_TXPERBITRANK3_Lane1_MSK (0x000000F0)
+ #define DDRDATA8CH1_CR_TXPERBITRANK3_Lane1_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_TXPERBITRANK3_Lane2_OFF ( 8)
+ #define DDRDATA8CH1_CR_TXPERBITRANK3_Lane2_WID ( 4)
+ #define DDRDATA8CH1_CR_TXPERBITRANK3_Lane2_MSK (0x00000F00)
+ #define DDRDATA8CH1_CR_TXPERBITRANK3_Lane2_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_TXPERBITRANK3_Lane3_OFF (12)
+ #define DDRDATA8CH1_CR_TXPERBITRANK3_Lane3_WID ( 4)
+ #define DDRDATA8CH1_CR_TXPERBITRANK3_Lane3_MSK (0x0000F000)
+ #define DDRDATA8CH1_CR_TXPERBITRANK3_Lane3_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_TXPERBITRANK3_Lane4_OFF (16)
+ #define DDRDATA8CH1_CR_TXPERBITRANK3_Lane4_WID ( 4)
+ #define DDRDATA8CH1_CR_TXPERBITRANK3_Lane4_MSK (0x000F0000)
+ #define DDRDATA8CH1_CR_TXPERBITRANK3_Lane4_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_TXPERBITRANK3_Lane5_OFF (20)
+ #define DDRDATA8CH1_CR_TXPERBITRANK3_Lane5_WID ( 4)
+ #define DDRDATA8CH1_CR_TXPERBITRANK3_Lane5_MSK (0x00F00000)
+ #define DDRDATA8CH1_CR_TXPERBITRANK3_Lane5_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_TXPERBITRANK3_Lane6_OFF (24)
+ #define DDRDATA8CH1_CR_TXPERBITRANK3_Lane6_WID ( 4)
+ #define DDRDATA8CH1_CR_TXPERBITRANK3_Lane6_MSK (0x0F000000)
+ #define DDRDATA8CH1_CR_TXPERBITRANK3_Lane6_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_TXPERBITRANK3_Lane7_OFF (28)
+ #define DDRDATA8CH1_CR_TXPERBITRANK3_Lane7_WID ( 4)
+ #define DDRDATA8CH1_CR_TXPERBITRANK3_Lane7_MSK (0xF0000000)
+ #define DDRDATA8CH1_CR_TXPERBITRANK3_Lane7_MAX (0x0000000F)
+
+#define DDRDATA8CH1_CR_RCOMPDATA0_REG (0x00001140)
+ #define DDRDATA8CH1_CR_RCOMPDATA0_RcompDrvUp_OFF ( 0)
+ #define DDRDATA8CH1_CR_RCOMPDATA0_RcompDrvUp_WID ( 6)
+ #define DDRDATA8CH1_CR_RCOMPDATA0_RcompDrvUp_MSK (0x0000003F)
+ #define DDRDATA8CH1_CR_RCOMPDATA0_RcompDrvUp_MAX (0x0000003F)
+ #define DDRDATA8CH1_CR_RCOMPDATA0_Spare0_OFF ( 6)
+ #define DDRDATA8CH1_CR_RCOMPDATA0_Spare0_WID ( 3)
+ #define DDRDATA8CH1_CR_RCOMPDATA0_Spare0_MSK (0x000001C0)
+ #define DDRDATA8CH1_CR_RCOMPDATA0_Spare0_MAX (0x00000007)
+ #define DDRDATA8CH1_CR_RCOMPDATA0_RcompDrvDown_OFF ( 9)
+ #define DDRDATA8CH1_CR_RCOMPDATA0_RcompDrvDown_WID ( 6)
+ #define DDRDATA8CH1_CR_RCOMPDATA0_RcompDrvDown_MSK (0x00007E00)
+ #define DDRDATA8CH1_CR_RCOMPDATA0_RcompDrvDown_MAX (0x0000003F)
+ #define DDRDATA8CH1_CR_RCOMPDATA0_VTComp_OFF (15)
+ #define DDRDATA8CH1_CR_RCOMPDATA0_VTComp_WID ( 5)
+ #define DDRDATA8CH1_CR_RCOMPDATA0_VTComp_MSK (0x000F8000)
+ #define DDRDATA8CH1_CR_RCOMPDATA0_VTComp_MAX (0x0000001F)
+ #define DDRDATA8CH1_CR_RCOMPDATA0_TcoComp_OFF (20)
+ #define DDRDATA8CH1_CR_RCOMPDATA0_TcoComp_WID ( 6)
+ #define DDRDATA8CH1_CR_RCOMPDATA0_TcoComp_MSK (0x03F00000)
+ #define DDRDATA8CH1_CR_RCOMPDATA0_TcoComp_MAX (0x0000003F)
+ #define DDRDATA8CH1_CR_RCOMPDATA0_SlewRateComp_OFF (26)
+ #define DDRDATA8CH1_CR_RCOMPDATA0_SlewRateComp_WID ( 5)
+ #define DDRDATA8CH1_CR_RCOMPDATA0_SlewRateComp_MSK (0x7C000000)
+ #define DDRDATA8CH1_CR_RCOMPDATA0_SlewRateComp_MAX (0x0000001F)
+ #define DDRDATA8CH1_CR_RCOMPDATA0_Spare2_OFF (31)
+ #define DDRDATA8CH1_CR_RCOMPDATA0_Spare2_WID ( 1)
+ #define DDRDATA8CH1_CR_RCOMPDATA0_Spare2_MSK (0x80000000)
+ #define DDRDATA8CH1_CR_RCOMPDATA0_Spare2_MAX (0x00000001)
+
+#define DDRDATA8CH1_CR_RCOMPDATA1_REG (0x00001144)
+ #define DDRDATA8CH1_CR_RCOMPDATA1_RcompOdtUp_OFF ( 0)
+ #define DDRDATA8CH1_CR_RCOMPDATA1_RcompOdtUp_WID ( 6)
+ #define DDRDATA8CH1_CR_RCOMPDATA1_RcompOdtUp_MSK (0x0000003F)
+ #define DDRDATA8CH1_CR_RCOMPDATA1_RcompOdtUp_MAX (0x0000003F)
+ #define DDRDATA8CH1_CR_RCOMPDATA1_Spare0_OFF ( 6)
+ #define DDRDATA8CH1_CR_RCOMPDATA1_Spare0_WID ( 3)
+ #define DDRDATA8CH1_CR_RCOMPDATA1_Spare0_MSK (0x000001C0)
+ #define DDRDATA8CH1_CR_RCOMPDATA1_Spare0_MAX (0x00000007)
+ #define DDRDATA8CH1_CR_RCOMPDATA1_RcompOdtDown_OFF ( 9)
+ #define DDRDATA8CH1_CR_RCOMPDATA1_RcompOdtDown_WID ( 6)
+ #define DDRDATA8CH1_CR_RCOMPDATA1_RcompOdtDown_MSK (0x00007E00)
+ #define DDRDATA8CH1_CR_RCOMPDATA1_RcompOdtDown_MAX (0x0000003F)
+ #define DDRDATA8CH1_CR_RCOMPDATA1_Spare1_OFF (15)
+ #define DDRDATA8CH1_CR_RCOMPDATA1_Spare1_WID ( 1)
+ #define DDRDATA8CH1_CR_RCOMPDATA1_Spare1_MSK (0x00008000)
+ #define DDRDATA8CH1_CR_RCOMPDATA1_Spare1_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_RCOMPDATA1_PanicDrvDn_OFF (16)
+ #define DDRDATA8CH1_CR_RCOMPDATA1_PanicDrvDn_WID ( 6)
+ #define DDRDATA8CH1_CR_RCOMPDATA1_PanicDrvDn_MSK (0x003F0000)
+ #define DDRDATA8CH1_CR_RCOMPDATA1_PanicDrvDn_MAX (0x0000003F)
+ #define DDRDATA8CH1_CR_RCOMPDATA1_PanicDrvUp_OFF (22)
+ #define DDRDATA8CH1_CR_RCOMPDATA1_PanicDrvUp_WID ( 6)
+ #define DDRDATA8CH1_CR_RCOMPDATA1_PanicDrvUp_MSK (0x0FC00000)
+ #define DDRDATA8CH1_CR_RCOMPDATA1_PanicDrvUp_MAX (0x0000003F)
+ #define DDRDATA8CH1_CR_RCOMPDATA1_LevelShifterComp_OFF (28)
+ #define DDRDATA8CH1_CR_RCOMPDATA1_LevelShifterComp_WID ( 3)
+ #define DDRDATA8CH1_CR_RCOMPDATA1_LevelShifterComp_MSK (0x70000000)
+ #define DDRDATA8CH1_CR_RCOMPDATA1_LevelShifterComp_MAX (0x00000007)
+ #define DDRDATA8CH1_CR_RCOMPDATA1_Spare2_OFF (31)
+ #define DDRDATA8CH1_CR_RCOMPDATA1_Spare2_WID ( 1)
+ #define DDRDATA8CH1_CR_RCOMPDATA1_Spare2_MSK (0x80000000)
+ #define DDRDATA8CH1_CR_RCOMPDATA1_Spare2_MAX (0x00000001)
+
+#define DDRDATA8CH1_CR_TXXTALK_REG (0x00001148)
+ #define DDRDATA8CH1_CR_TXXTALK_Lane0_OFF ( 0)
+ #define DDRDATA8CH1_CR_TXXTALK_Lane0_WID ( 4)
+ #define DDRDATA8CH1_CR_TXXTALK_Lane0_MSK (0x0000000F)
+ #define DDRDATA8CH1_CR_TXXTALK_Lane0_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_TXXTALK_Lane1_OFF ( 4)
+ #define DDRDATA8CH1_CR_TXXTALK_Lane1_WID ( 4)
+ #define DDRDATA8CH1_CR_TXXTALK_Lane1_MSK (0x000000F0)
+ #define DDRDATA8CH1_CR_TXXTALK_Lane1_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_TXXTALK_Lane2_OFF ( 8)
+ #define DDRDATA8CH1_CR_TXXTALK_Lane2_WID ( 4)
+ #define DDRDATA8CH1_CR_TXXTALK_Lane2_MSK (0x00000F00)
+ #define DDRDATA8CH1_CR_TXXTALK_Lane2_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_TXXTALK_Lane3_OFF (12)
+ #define DDRDATA8CH1_CR_TXXTALK_Lane3_WID ( 4)
+ #define DDRDATA8CH1_CR_TXXTALK_Lane3_MSK (0x0000F000)
+ #define DDRDATA8CH1_CR_TXXTALK_Lane3_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_TXXTALK_Lane4_OFF (16)
+ #define DDRDATA8CH1_CR_TXXTALK_Lane4_WID ( 4)
+ #define DDRDATA8CH1_CR_TXXTALK_Lane4_MSK (0x000F0000)
+ #define DDRDATA8CH1_CR_TXXTALK_Lane4_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_TXXTALK_Lane5_OFF (20)
+ #define DDRDATA8CH1_CR_TXXTALK_Lane5_WID ( 4)
+ #define DDRDATA8CH1_CR_TXXTALK_Lane5_MSK (0x00F00000)
+ #define DDRDATA8CH1_CR_TXXTALK_Lane5_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_TXXTALK_Lane6_OFF (24)
+ #define DDRDATA8CH1_CR_TXXTALK_Lane6_WID ( 4)
+ #define DDRDATA8CH1_CR_TXXTALK_Lane6_MSK (0x0F000000)
+ #define DDRDATA8CH1_CR_TXXTALK_Lane6_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_TXXTALK_Lane7_OFF (28)
+ #define DDRDATA8CH1_CR_TXXTALK_Lane7_WID ( 4)
+ #define DDRDATA8CH1_CR_TXXTALK_Lane7_MSK (0xF0000000)
+ #define DDRDATA8CH1_CR_TXXTALK_Lane7_MAX (0x0000000F)
+
+#define DDRDATA8CH1_CR_RXOFFSETVDQ_REG (0x0000114C)
+ #define DDRDATA8CH1_CR_RXOFFSETVDQ_Lane0_OFF ( 0)
+ #define DDRDATA8CH1_CR_RXOFFSETVDQ_Lane0_WID ( 4)
+ #define DDRDATA8CH1_CR_RXOFFSETVDQ_Lane0_MSK (0x0000000F)
+ #define DDRDATA8CH1_CR_RXOFFSETVDQ_Lane0_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_RXOFFSETVDQ_Lane1_OFF ( 4)
+ #define DDRDATA8CH1_CR_RXOFFSETVDQ_Lane1_WID ( 4)
+ #define DDRDATA8CH1_CR_RXOFFSETVDQ_Lane1_MSK (0x000000F0)
+ #define DDRDATA8CH1_CR_RXOFFSETVDQ_Lane1_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_RXOFFSETVDQ_Lane2_OFF ( 8)
+ #define DDRDATA8CH1_CR_RXOFFSETVDQ_Lane2_WID ( 4)
+ #define DDRDATA8CH1_CR_RXOFFSETVDQ_Lane2_MSK (0x00000F00)
+ #define DDRDATA8CH1_CR_RXOFFSETVDQ_Lane2_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_RXOFFSETVDQ_Lane3_OFF (12)
+ #define DDRDATA8CH1_CR_RXOFFSETVDQ_Lane3_WID ( 4)
+ #define DDRDATA8CH1_CR_RXOFFSETVDQ_Lane3_MSK (0x0000F000)
+ #define DDRDATA8CH1_CR_RXOFFSETVDQ_Lane3_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_RXOFFSETVDQ_Lane4_OFF (16)
+ #define DDRDATA8CH1_CR_RXOFFSETVDQ_Lane4_WID ( 4)
+ #define DDRDATA8CH1_CR_RXOFFSETVDQ_Lane4_MSK (0x000F0000)
+ #define DDRDATA8CH1_CR_RXOFFSETVDQ_Lane4_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_RXOFFSETVDQ_Lane5_OFF (20)
+ #define DDRDATA8CH1_CR_RXOFFSETVDQ_Lane5_WID ( 4)
+ #define DDRDATA8CH1_CR_RXOFFSETVDQ_Lane5_MSK (0x00F00000)
+ #define DDRDATA8CH1_CR_RXOFFSETVDQ_Lane5_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_RXOFFSETVDQ_Lane6_OFF (24)
+ #define DDRDATA8CH1_CR_RXOFFSETVDQ_Lane6_WID ( 4)
+ #define DDRDATA8CH1_CR_RXOFFSETVDQ_Lane6_MSK (0x0F000000)
+ #define DDRDATA8CH1_CR_RXOFFSETVDQ_Lane6_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_RXOFFSETVDQ_Lane7_OFF (28)
+ #define DDRDATA8CH1_CR_RXOFFSETVDQ_Lane7_WID ( 4)
+ #define DDRDATA8CH1_CR_RXOFFSETVDQ_Lane7_MSK (0xF0000000)
+ #define DDRDATA8CH1_CR_RXOFFSETVDQ_Lane7_MAX (0x0000000F)
+
+#define DDRDATA8CH1_CR_DDRDATARESERVED_REG (0x00001150)
+ #define DDRDATA8CH1_CR_DDRDATARESERVED_Spare_OFF ( 0)
+ #define DDRDATA8CH1_CR_DDRDATARESERVED_Spare_WID (32)
+ #define DDRDATA8CH1_CR_DDRDATARESERVED_Spare_MSK (0xFFFFFFFF)
+ #define DDRDATA8CH1_CR_DDRDATARESERVED_Spare_MAX (0xFFFFFFFF)
+
+#define DDRDATA8CH1_CR_DATATRAINFEEDBACK_REG (0x00001154)
+ #define DDRDATA8CH1_CR_DATATRAINFEEDBACK_DataTrainFeedback_OFF ( 0)
+ #define DDRDATA8CH1_CR_DATATRAINFEEDBACK_DataTrainFeedback_WID ( 9)
+ #define DDRDATA8CH1_CR_DATATRAINFEEDBACK_DataTrainFeedback_MSK (0x000001FF)
+ #define DDRDATA8CH1_CR_DATATRAINFEEDBACK_DataTrainFeedback_MAX (0x000001FF)
+ #define DDRDATA8CH1_CR_DATATRAINFEEDBACK_Spare_OFF ( 9)
+ #define DDRDATA8CH1_CR_DATATRAINFEEDBACK_Spare_WID (23)
+ #define DDRDATA8CH1_CR_DATATRAINFEEDBACK_Spare_MSK (0xFFFFFE00)
+ #define DDRDATA8CH1_CR_DATATRAINFEEDBACK_Spare_MAX (0x007FFFFF)
+
+#define DDRDATA8CH1_CR_DLLPITESTANDADC_REG (0x00001158)
+ #define DDRDATA8CH1_CR_DLLPITESTANDADC_RunTest_OFF ( 0)
+ #define DDRDATA8CH1_CR_DLLPITESTANDADC_RunTest_WID ( 1)
+ #define DDRDATA8CH1_CR_DLLPITESTANDADC_RunTest_MSK (0x00000001)
+ #define DDRDATA8CH1_CR_DLLPITESTANDADC_RunTest_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DLLPITESTANDADC_RunTest_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DLLPITESTANDADC_Load_OFF ( 1)
+ #define DDRDATA8CH1_CR_DLLPITESTANDADC_Load_WID ( 1)
+ #define DDRDATA8CH1_CR_DLLPITESTANDADC_Load_MSK (0x00000002)
+ #define DDRDATA8CH1_CR_DLLPITESTANDADC_Load_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DLLPITESTANDADC_Load_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DLLPITESTANDADC_ModeHVM_OFF ( 2)
+ #define DDRDATA8CH1_CR_DLLPITESTANDADC_ModeHVM_WID ( 1)
+ #define DDRDATA8CH1_CR_DLLPITESTANDADC_ModeHVM_MSK (0x00000004)
+ #define DDRDATA8CH1_CR_DLLPITESTANDADC_ModeHVM_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DLLPITESTANDADC_ModeHVM_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DLLPITESTANDADC_ModeDV_OFF ( 3)
+ #define DDRDATA8CH1_CR_DLLPITESTANDADC_ModeDV_WID ( 1)
+ #define DDRDATA8CH1_CR_DLLPITESTANDADC_ModeDV_MSK (0x00000008)
+ #define DDRDATA8CH1_CR_DLLPITESTANDADC_ModeDV_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DLLPITESTANDADC_ModeDV_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DLLPITESTANDADC_ModeADC_OFF ( 4)
+ #define DDRDATA8CH1_CR_DLLPITESTANDADC_ModeADC_WID ( 1)
+ #define DDRDATA8CH1_CR_DLLPITESTANDADC_ModeADC_MSK (0x00000010)
+ #define DDRDATA8CH1_CR_DLLPITESTANDADC_ModeADC_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DLLPITESTANDADC_ModeADC_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DLLPITESTANDADC_LoadCount_OFF ( 5)
+ #define DDRDATA8CH1_CR_DLLPITESTANDADC_LoadCount_WID (10)
+ #define DDRDATA8CH1_CR_DLLPITESTANDADC_LoadCount_MSK (0x00007FE0)
+ #define DDRDATA8CH1_CR_DLLPITESTANDADC_LoadCount_MAX (0x000003FF)
+ #define DDRDATA8CH1_CR_DLLPITESTANDADC_CountStatus_OFF (15)
+ #define DDRDATA8CH1_CR_DLLPITESTANDADC_CountStatus_WID (10)
+ #define DDRDATA8CH1_CR_DLLPITESTANDADC_CountStatus_MSK (0x01FF8000)
+ #define DDRDATA8CH1_CR_DLLPITESTANDADC_CountStatus_MAX (0x000003FF)
+ #define DDRDATA8CH1_CR_DLLPITESTANDADC_CountStatus_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DLLPITESTANDADC_Spare_OFF (25)
+ #define DDRDATA8CH1_CR_DLLPITESTANDADC_Spare_WID ( 7)
+ #define DDRDATA8CH1_CR_DLLPITESTANDADC_Spare_MSK (0xFE000000)
+ #define DDRDATA8CH1_CR_DLLPITESTANDADC_Spare_MAX (0x0000007F)
+
+#define DDRDATA8CH1_CR_DDRCRDATAOFFSETCOMP_REG (0x0000115C)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_OFF ( 0)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_WID ( 6)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_MSK (0x0000003F)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_MAX (0x0000003F)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvUpCompOffset_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_OFF ( 6)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_WID ( 6)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_MSK (0x00000FC0)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_MAX (0x0000003F)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETCOMP_DqDrvDownCompOffset_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_OFF (12)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_WID ( 5)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_MSK (0x0001F000)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_MAX (0x0000001F)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtUpCompOffset_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_OFF (17)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_WID ( 5)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_MSK (0x003E0000)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_MAX (0x0000001F)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETCOMP_DqOdtDownCompOffset_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_OFF (22)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_WID ( 5)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_MSK (0x07C00000)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_MAX (0x0000001F)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETCOMP_DqTcoCompOffset_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_OFF (27)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_WID ( 5)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_MSK (0xF8000000)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_MAX (0x0000001F)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETCOMP_DqSlewRateCompOffset_DEF (0x00000000)
+
+#define DDRDATA8CH1_CR_DDRCRDATACONTROL1_REG (0x00001160)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_RefPi_OFF ( 0)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_RefPi_WID ( 4)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_RefPi_MSK (0x0000000F)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_RefPi_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_RefPi_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_DllMask_OFF ( 4)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_DllMask_WID ( 2)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_DllMask_MSK (0x00000030)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_DllMask_MAX (0x00000003)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_DllMask_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_DllWeakLock_OFF ( 6)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_DllWeakLock_WID ( 1)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_DllWeakLock_MSK (0x00000040)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_DllWeakLock_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_DllWeakLock_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_OFF ( 7)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_WID ( 3)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_MSK (0x00000380)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_MAX (0x00000007)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_SdllSegmentDisable_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_OFF (10)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_WID ( 3)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_MSK (0x00001C00)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_MAX (0x00000007)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_RxBiasCtl_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_OdtDelay_OFF (13)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_OdtDelay_WID ( 4)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_OdtDelay_MSK (0x0001E000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_OdtDelay_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_OdtDelay_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_OdtDuration_OFF (17)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_OdtDuration_WID ( 3)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_OdtDuration_MSK (0x000E0000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_OdtDuration_MAX (0x00000007)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_OdtDuration_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_OFF (20)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_WID ( 4)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_MSK (0x00F00000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_SenseAmpDelay_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_OFF (24)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_WID ( 3)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_MSK (0x07000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_MAX (0x00000007)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_SenseAmpDuration_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_OFF (27)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_WID ( 3)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_MSK (0x38000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_MAX (0x00000007)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_BurstEndODTDelay_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_OFF (30)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_WID ( 1)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_MSK (0x40000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_LpDdrLongOdtEn_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_Rsvd1_OFF (31)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_Rsvd1_WID ( 1)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_Rsvd1_MSK (0x80000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_Rsvd1_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL1_Rsvd1_DEF (0x00000000)
+
+#define DDRDATA8CH1_CR_DDRCRDATACONTROL2_REG (0x00001164)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_OFF ( 0)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_WID ( 5)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_MSK (0x0000001F)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_MAX (0x0000001F)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL2_RxStaggerCtl_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_OFF ( 5)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_WID ( 1)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_MSK (0x00000020)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL2_ForceBiasOn_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL2_ForceRxOn_OFF ( 6)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL2_ForceRxOn_WID ( 1)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL2_ForceRxOn_MSK (0x00000040)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL2_ForceRxOn_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL2_ForceRxOn_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL2_LeakerComp_OFF ( 7)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL2_LeakerComp_WID ( 2)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL2_LeakerComp_MSK (0x00000180)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL2_LeakerComp_MAX (0x00000003)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL2_LeakerComp_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_OFF ( 9)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_WID ( 4)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_MSK (0x00001E00)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_MAX (0x0000000F)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_DEF (0x00000008)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_OFF (13)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_WID ( 5)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_MSK (0x0003E000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_MAX (0x0000001F)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL2_RxClkStgNum_DEF (0x00000011)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_OFF (18)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_WID ( 1)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_MSK (0x00040000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL2_WlLongDelEn_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL2_Spare_OFF (19)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL2_Spare_WID (13)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL2_Spare_MSK (0xFFF80000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL2_Spare_MAX (0x00001FFF)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL2_Spare_DEF (0x00000000)
+
+#define DDRDATA8CH1_CR_DDRCRVSSHIORVREFCONTROL_REG (0x0000116C)
+ #define DDRDATA8CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_OFF ( 0)
+ #define DDRDATA8CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_WID (24)
+ #define DDRDATA8CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_MSK (0x00FFFFFF)
+ #define DDRDATA8CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_MAX (0x00FFFFFF)
+ #define DDRDATA8CH1_CR_DDRCRVSSHIORVREFCONTROL_VssHiOrVrefCtl_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_OFF (24)
+ #define DDRDATA8CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_WID ( 8)
+ #define DDRDATA8CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_MSK (0xFF000000)
+ #define DDRDATA8CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_MAX (0x000000FF)
+ #define DDRDATA8CH1_CR_DDRCRVSSHIORVREFCONTROL_OutputCode_DEF (0x00000000)
+
+#define DDRDATA8CH1_CR_DDRCRDATAOFFSETTRAIN_REG (0x00001170)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_OFF ( 0)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_WID ( 6)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_MSK (0x0000003F)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_MAX (0x0000003F)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETTRAIN_RcvEnOffset_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_OFF ( 6)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_WID ( 6)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_MSK (0x00000FC0)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_MAX (0x0000003F)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETTRAIN_RxDqsOffset_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_OFF (12)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_WID ( 6)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_MSK (0x0003F000)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_MAX (0x0000003F)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqOffset_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_OFF (18)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_WID ( 6)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_MSK (0x00FC0000)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_MAX (0x0000003F)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETTRAIN_TxDqsOffset_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_OFF (24)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_WID ( 7)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_MSK (0x7F000000)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_MAX (0x0000007F)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETTRAIN_VrefOffset_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_OFF (31)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_WID ( 1)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_MSK (0x80000000)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DDRCRDATAOFFSETTRAIN_Spare_DEF (0x00000000)
+
+#define DDRDATA8CH1_CR_DDRCRDATACONTROL0_REG (0x00001174)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_OFF ( 0)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_WID ( 1)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_MSK (0x00000001)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_RxTrainingMode_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_OFF ( 1)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_WID ( 1)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_MSK (0x00000002)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_WLTrainingMode_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_OFF ( 2)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_WID ( 1)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_MSK (0x00000004)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_RLTrainingMode_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_OFF ( 3)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_WID ( 1)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_MSK (0x00000008)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_SenseampTrainingMode_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_TxOn_OFF ( 4)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_TxOn_WID ( 1)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_TxOn_MSK (0x00000010)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_TxOn_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_TxOn_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_RfOn_OFF ( 5)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_RfOn_WID ( 1)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_RfOn_MSK (0x00000020)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_RfOn_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_RfOn_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_RxPiOn_OFF ( 6)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_RxPiOn_WID ( 1)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_RxPiOn_MSK (0x00000040)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_RxPiOn_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_RxPiOn_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_TxPiOn_OFF ( 7)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_TxPiOn_WID ( 1)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_TxPiOn_MSK (0x00000080)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_TxPiOn_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_TxPiOn_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_OFF ( 8)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_WID ( 1)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_MSK (0x00000100)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_InternalClocksOn_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_OFF ( 9)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_WID ( 1)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_MSK (0x00000200)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_RepeaterClocksOn_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_TxDisable_OFF (10)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_TxDisable_WID ( 1)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_TxDisable_MSK (0x00000400)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_TxDisable_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_TxDisable_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_RxDisable_OFF (11)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_RxDisable_WID ( 1)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_RxDisable_MSK (0x00000800)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_RxDisable_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_RxDisable_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_TxLong_OFF (12)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_TxLong_WID ( 1)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_TxLong_MSK (0x00001000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_TxLong_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_TxLong_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_OFF (13)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_WID ( 2)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_MSK (0x00006000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_MAX (0x00000003)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_RxDqsCtle_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_RxReadPointer_OFF (15)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_RxReadPointer_WID ( 3)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_RxReadPointer_MSK (0x00038000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_RxReadPointer_MAX (0x00000007)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_RxReadPointer_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_OFF (18)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_WID ( 1)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_MSK (0x00040000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_DriverSegmentEnable_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_OFF (19)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_WID ( 1)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_MSK (0x00080000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_DataVccddqHi_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_ReadRFRd_OFF (20)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_ReadRFRd_WID ( 1)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_ReadRFRd_MSK (0x00100000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_ReadRFRd_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_ReadRFRd_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_ReadRFWr_OFF (21)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_ReadRFWr_WID ( 1)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_ReadRFWr_MSK (0x00200000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_ReadRFWr_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_ReadRFWr_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_ReadRFRank_OFF (22)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_ReadRFRank_WID ( 2)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_ReadRFRank_MSK (0x00C00000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_ReadRFRank_MAX (0x00000003)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_ReadRFRank_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_OFF (24)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_WID ( 1)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_MSK (0x01000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_ForceOdtOn_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_OdtSampOff_OFF (25)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_OdtSampOff_WID ( 1)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_OdtSampOff_MSK (0x02000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_OdtSampOff_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_OdtSampOff_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_OFF (26)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_WID ( 1)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_MSK (0x04000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_DisableOdtStatic_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_OFF (27)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_WID ( 1)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_MSK (0x08000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_DdrCRForceODTOn_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_OFF (28)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_WID ( 1)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_MSK (0x10000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_LPDDR_Mode_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_OFF (29)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_WID ( 1)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_MSK (0x20000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_EnReadPreamble_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_OFF (30)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_WID ( 1)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_MSK (0x40000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_OdtSampExtendEn_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_OFF (31)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_WID ( 1)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_MSK (0x80000000)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DDRCRDATACONTROL0_EarlyRleakEn_DEF (0x00000000)
+
+#define DDRDATA8CH1_CR_DDRCRVREFADJUST1_REG (0x00001178)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_OFF ( 0)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_WID ( 7)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_MSK (0x0000007F)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_MAX (0x0000007F)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_CAVrefCtl_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_OFF ( 7)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_WID ( 7)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_MSK (0x00003F80)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_MAX (0x0000007F)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_Ch1VrefCtl_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_OFF (14)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_WID ( 7)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_MSK (0x001FC000)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_MAX (0x0000007F)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_Ch0VrefCtl_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_OFF (21)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_WID ( 1)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_MSK (0x00200000)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCA_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_OFF (22)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_WID ( 1)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_MSK (0x00400000)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh1_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_OFF (23)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_WID ( 1)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_MSK (0x00800000)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_EnDimmVrefCh0_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_OFF (24)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_WID ( 2)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_MSK (0x03000000)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_MAX (0x00000003)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_HiZTimerCtrl_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_OFF (26)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_WID ( 1)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_MSK (0x04000000)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_VccddqHiQnnnH_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_Rsvd_OFF (27)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_Rsvd_WID ( 2)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_Rsvd_MSK (0x18000000)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_Rsvd_MAX (0x00000003)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_Rsvd_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_caSlowBW_OFF (29)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_caSlowBW_WID ( 1)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_caSlowBW_MSK (0x20000000)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_caSlowBW_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_caSlowBW_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_OFF (30)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_WID ( 1)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_MSK (0x40000000)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_DEF (0x00000000)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_OFF (31)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_WID ( 1)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_MSK (0x80000000)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_MAX (0x00000001)
+ #define DDRDATA8CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_DEF (0x00000000)
+
+#pragma pack(pop)
+#endif // __McIoData_h__
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/McMain.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/McMain.h
new file mode 100644
index 0000000..fa1db62
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/McMain.h
@@ -0,0 +1,19761 @@
+/** @file
+ This file was automatically generated. Modify at your own risk.
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef __McMain_h__
+#define __McMain_h__
+
+#pragma pack(push, 1)
+#include "MrcTypes.h"
+
+typedef union {
+ struct {
+ U32 Global_Start_Test : 1; // Bits 0:0
+ U32 Global_Stop_Test : 1; // Bits 1:1
+ U32 Global_Clear_Errors : 1; // Bits 2:2
+ U32 : 1; // Bits 3:3
+ U32 Global_Stop_Test_On_Any_Error : 1; // Bits 4:4
+ U32 : 27; // Bits 31:5
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 Channel_Error_Status_0 : 1; // Bits 0:0
+ U32 Channel_Error_Status_1 : 1; // Bits 1:1
+ U32 : 14; // Bits 15:2
+ U32 Channel_Test_Done_Status_0 : 1; // Bits 16:16
+ U32 Channel_Test_Done_Status_1 : 1; // Bits 17:17
+ U32 : 14; // Bits 31:18
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_GLOBAL_ERR_MCMAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 Number_of_Cachelines : 7; // Bits 6:0
+ U32 Number_of_Cachelines_Scale : 1; // Bits 7:7
+ U32 Subsequence_Wait : 10; // Bits 17:8
+ U32 : 2; // Bits 19:18
+ U32 Subsequence_Type : 4; // Bits 23:20
+ U32 : 1; // Bits 24:24
+ U32 Save_Current_Base_Address_To_Start : 1; // Bits 25:25
+ U32 Reset_Current_Base_Address_To_Start : 1; // Bits 26:26
+ U32 Data_and_ECC_Address_Inversion : 2; // Bits 28:27
+ U32 : 1; // Bits 29:29
+ U32 Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 Stop_Base_Subsequence_On_Wrap_Trigger : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_STRUCT_HSW_A0;
+
+typedef union {
+ struct {
+ U32 Number_of_Cachelines : 7; // Bits 6:0
+ U32 Number_of_Cachelines_Scale : 1; // Bits 7:7
+ U32 Subsequence_Wait : 10; // Bits 17:8
+ U32 : 2; // Bits 19:18
+ U32 Subsequence_Type : 4; // Bits 23:20
+ U32 : 1; // Bits 24:24
+ U32 Save_Current_Base_Address_To_Start : 1; // Bits 25:25
+ U32 Reset_Current_Base_Address_To_Start : 1; // Bits 26:26
+ U32 Data_and_ECC_Address_Inversion : 2; // Bits 28:27
+ U32 : 1; // Bits 29:29
+ U32 Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 Stop_Base_Subsequence_On_Wrap_Trigger : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_STRUCT_HSW_A0;
+
+typedef union {
+ struct {
+ U32 Number_of_Cachelines : 7; // Bits 6:0
+ U32 Number_of_Cachelines_Scale : 1; // Bits 7:7
+ U32 Subsequence_Wait : 10; // Bits 17:8
+ U32 : 2; // Bits 19:18
+ U32 Subsequence_Type : 4; // Bits 23:20
+ U32 : 1; // Bits 24:24
+ U32 Save_Current_Base_Address_To_Start : 1; // Bits 25:25
+ U32 Reset_Current_Base_Address_To_Start : 1; // Bits 26:26
+ U32 Data_and_ECC_Address_Inversion : 2; // Bits 28:27
+ U32 : 1; // Bits 29:29
+ U32 Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 Stop_Base_Subsequence_On_Wrap_Trigger : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_STRUCT_HSW_A0;
+
+typedef union {
+ struct {
+ U32 Number_of_Cachelines : 7; // Bits 6:0
+ U32 Number_of_Cachelines_Scale : 1; // Bits 7:7
+ U32 Subsequence_Wait : 10; // Bits 17:8
+ U32 : 2; // Bits 19:18
+ U32 Subsequence_Type : 4; // Bits 23:20
+ U32 : 1; // Bits 24:24
+ U32 Save_Current_Base_Address_To_Start : 1; // Bits 25:25
+ U32 Reset_Current_Base_Address_To_Start : 1; // Bits 26:26
+ U32 Data_and_ECC_Address_Inversion : 2; // Bits 28:27
+ U32 : 1; // Bits 29:29
+ U32 Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 Stop_Base_Subsequence_On_Wrap_Trigger : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_STRUCT_HSW_A0;
+
+typedef union {
+ struct {
+ U32 Number_of_Cachelines : 7; // Bits 6:0
+ U32 Number_of_Cachelines_Scale : 1; // Bits 7:7
+ U32 Subsequence_Wait : 10; // Bits 17:8
+ U32 : 2; // Bits 19:18
+ U32 Subsequence_Type : 4; // Bits 23:20
+ U32 : 1; // Bits 24:24
+ U32 Save_Current_Base_Address_To_Start : 1; // Bits 25:25
+ U32 Reset_Current_Base_Address_To_Start : 1; // Bits 26:26
+ U32 Data_and_ECC_Address_Inversion : 2; // Bits 28:27
+ U32 : 1; // Bits 29:29
+ U32 Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 Stop_Base_Subsequence_On_Wrap_Trigger : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_STRUCT_HSW_A0;
+
+typedef union {
+ struct {
+ U32 Number_of_Cachelines : 7; // Bits 6:0
+ U32 Number_of_Cachelines_Scale : 1; // Bits 7:7
+ U32 Subsequence_Wait : 10; // Bits 17:8
+ U32 : 2; // Bits 19:18
+ U32 Subsequence_Type : 4; // Bits 23:20
+ U32 : 1; // Bits 24:24
+ U32 Save_Current_Base_Address_To_Start : 1; // Bits 25:25
+ U32 Reset_Current_Base_Address_To_Start : 1; // Bits 26:26
+ U32 Data_and_ECC_Address_Inversion : 2; // Bits 28:27
+ U32 : 1; // Bits 29:29
+ U32 Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 Stop_Base_Subsequence_On_Wrap_Trigger : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_STRUCT_HSW_A0;
+
+typedef union {
+ struct {
+ U32 Number_of_Cachelines : 7; // Bits 6:0
+ U32 Number_of_Cachelines_Scale : 1; // Bits 7:7
+ U32 Subsequence_Wait : 10; // Bits 17:8
+ U32 : 2; // Bits 19:18
+ U32 Subsequence_Type : 4; // Bits 23:20
+ U32 : 1; // Bits 24:24
+ U32 Save_Current_Base_Address_To_Start : 1; // Bits 25:25
+ U32 Reset_Current_Base_Address_To_Start : 1; // Bits 26:26
+ U32 Data_and_ECC_Address_Inversion : 2; // Bits 28:27
+ U32 : 1; // Bits 29:29
+ U32 Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 Stop_Base_Subsequence_On_Wrap_Trigger : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_STRUCT_HSW_A0;
+
+typedef union {
+ struct {
+ U32 Number_of_Cachelines : 7; // Bits 6:0
+ U32 Number_of_Cachelines_Scale : 1; // Bits 7:7
+ U32 Subsequence_Wait : 10; // Bits 17:8
+ U32 : 2; // Bits 19:18
+ U32 Subsequence_Type : 4; // Bits 23:20
+ U32 : 1; // Bits 24:24
+ U32 Save_Current_Base_Address_To_Start : 1; // Bits 25:25
+ U32 Reset_Current_Base_Address_To_Start : 1; // Bits 26:26
+ U32 Data_and_ECC_Address_Inversion : 2; // Bits 28:27
+ U32 : 1; // Bits 29:29
+ U32 Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 Stop_Base_Subsequence_On_Wrap_Trigger : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_STRUCT_HSW_A0;
+
+typedef union {
+ struct {
+ U32 Number_of_Cachelines : 7; // Bits 6:0
+ U32 Number_of_Cachelines_Scale : 1; // Bits 7:7
+ U32 Subsequence_Wait : 8; // Bits 15:8
+ U32 : 4; // Bits 19:16
+ U32 Subsequence_Type : 4; // Bits 23:20
+ U32 : 1; // Bits 24:24
+ U32 Save_Current_Base_Address_To_Start : 1; // Bits 25:25
+ U32 Reset_Current_Base_Address_To_Start : 1; // Bits 26:26
+ U32 Data_and_ECC_Address_Inversion : 2; // Bits 28:27
+ U32 : 1; // Bits 29:29
+ U32 Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 Stop_Base_Subsequence_On_Wrap_Trigger : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_STRUCT_HSW_A0;
+
+typedef union {
+ struct {
+ U32 Number_of_Cachelines : 7; // Bits 6:0
+ U32 Number_of_Cachelines_Scale : 1; // Bits 7:7
+ U32 Subsequence_Wait : 8; // Bits 15:8
+ U32 : 4; // Bits 19:16
+ U32 Subsequence_Type : 4; // Bits 23:20
+ U32 : 1; // Bits 24:24
+ U32 Save_Current_Base_Address_To_Start : 1; // Bits 25:25
+ U32 Reset_Current_Base_Address_To_Start : 1; // Bits 26:26
+ U32 Data_and_ECC_Address_Inversion : 2; // Bits 28:27
+ U32 : 1; // Bits 29:29
+ U32 Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 Stop_Base_Subsequence_On_Wrap_Trigger : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_STRUCT_HSW_A0;
+
+typedef union {
+ struct {
+ U32 Number_of_Cachelines : 7; // Bits 6:0
+ U32 Number_of_Cachelines_Scale : 1; // Bits 7:7
+ U32 Subsequence_Wait : 8; // Bits 15:8
+ U32 : 4; // Bits 19:16
+ U32 Subsequence_Type : 4; // Bits 23:20
+ U32 : 1; // Bits 24:24
+ U32 Save_Current_Base_Address_To_Start : 1; // Bits 25:25
+ U32 Reset_Current_Base_Address_To_Start : 1; // Bits 26:26
+ U32 Data_and_ECC_Address_Inversion : 2; // Bits 28:27
+ U32 : 1; // Bits 29:29
+ U32 Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 Stop_Base_Subsequence_On_Wrap_Trigger : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_STRUCT_HSW_A0;
+
+typedef union {
+ struct {
+ U32 Number_of_Cachelines : 7; // Bits 6:0
+ U32 Number_of_Cachelines_Scale : 1; // Bits 7:7
+ U32 Subsequence_Wait : 8; // Bits 15:8
+ U32 : 4; // Bits 19:16
+ U32 Subsequence_Type : 4; // Bits 23:20
+ U32 : 1; // Bits 24:24
+ U32 Save_Current_Base_Address_To_Start : 1; // Bits 25:25
+ U32 Reset_Current_Base_Address_To_Start : 1; // Bits 26:26
+ U32 Data_and_ECC_Address_Inversion : 2; // Bits 28:27
+ U32 : 1; // Bits 29:29
+ U32 Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 Stop_Base_Subsequence_On_Wrap_Trigger : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_STRUCT_HSW_A0;
+
+typedef union {
+ struct {
+ U32 Number_of_Cachelines : 7; // Bits 6:0
+ U32 Number_of_Cachelines_Scale : 1; // Bits 7:7
+ U32 Subsequence_Wait : 8; // Bits 15:8
+ U32 : 4; // Bits 19:16
+ U32 Subsequence_Type : 4; // Bits 23:20
+ U32 : 1; // Bits 24:24
+ U32 Save_Current_Base_Address_To_Start : 1; // Bits 25:25
+ U32 Reset_Current_Base_Address_To_Start : 1; // Bits 26:26
+ U32 Data_and_ECC_Address_Inversion : 2; // Bits 28:27
+ U32 : 1; // Bits 29:29
+ U32 Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 Stop_Base_Subsequence_On_Wrap_Trigger : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_STRUCT_HSW_A0;
+
+typedef union {
+ struct {
+ U32 Number_of_Cachelines : 7; // Bits 6:0
+ U32 Number_of_Cachelines_Scale : 1; // Bits 7:7
+ U32 Subsequence_Wait : 8; // Bits 15:8
+ U32 : 4; // Bits 19:16
+ U32 Subsequence_Type : 4; // Bits 23:20
+ U32 : 1; // Bits 24:24
+ U32 Save_Current_Base_Address_To_Start : 1; // Bits 25:25
+ U32 Reset_Current_Base_Address_To_Start : 1; // Bits 26:26
+ U32 Data_and_ECC_Address_Inversion : 2; // Bits 28:27
+ U32 : 1; // Bits 29:29
+ U32 Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 Stop_Base_Subsequence_On_Wrap_Trigger : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_STRUCT_HSW_A0;
+
+typedef union {
+ struct {
+ U32 Number_of_Cachelines : 7; // Bits 6:0
+ U32 Number_of_Cachelines_Scale : 1; // Bits 7:7
+ U32 Subsequence_Wait : 8; // Bits 15:8
+ U32 : 4; // Bits 19:16
+ U32 Subsequence_Type : 4; // Bits 23:20
+ U32 : 1; // Bits 24:24
+ U32 Save_Current_Base_Address_To_Start : 1; // Bits 25:25
+ U32 Reset_Current_Base_Address_To_Start : 1; // Bits 26:26
+ U32 Data_and_ECC_Address_Inversion : 2; // Bits 28:27
+ U32 : 1; // Bits 29:29
+ U32 Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 Stop_Base_Subsequence_On_Wrap_Trigger : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_STRUCT_HSW_A0;
+
+typedef union {
+ struct {
+ U32 Number_of_Cachelines : 7; // Bits 6:0
+ U32 Number_of_Cachelines_Scale : 1; // Bits 7:7
+ U32 Subsequence_Wait : 8; // Bits 15:8
+ U32 : 4; // Bits 19:16
+ U32 Subsequence_Type : 4; // Bits 23:20
+ U32 : 1; // Bits 24:24
+ U32 Save_Current_Base_Address_To_Start : 1; // Bits 25:25
+ U32 Reset_Current_Base_Address_To_Start : 1; // Bits 26:26
+ U32 Data_and_ECC_Address_Inversion : 2; // Bits 28:27
+ U32 : 1; // Bits 29:29
+ U32 Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 Stop_Base_Subsequence_On_Wrap_Trigger : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_STRUCT_HSW_A0;
+
+typedef union {
+ struct {
+ U32 Number_of_Cachelines : 7; // Bits 6:0
+ U32 Number_of_Cachelines_Scale : 1; // Bits 7:7
+ U32 Subsequence_Wait : 14; // Bits 21:8
+ U32 Subsequence_Type : 4; // Bits 25:22
+ U32 Save_Current_Base_Address_To_Start : 1; // Bits 26:26
+ U32 Reset_Current_Base_Address_To_Start : 1; // Bits 27:27
+ U32 Data_and_ECC_Address_Inversion : 2; // Bits 29:28
+ U32 Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 Stop_Base_Subsequence_On_Wrap_Trigger : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Number_of_Cachelines : 7; // Bits 6:0
+ U32 Number_of_Cachelines_Scale : 1; // Bits 7:7
+ U32 Subsequence_Wait : 14; // Bits 21:8
+ U32 Subsequence_Type : 4; // Bits 25:22
+ U32 Save_Current_Base_Address_To_Start : 1; // Bits 26:26
+ U32 Reset_Current_Base_Address_To_Start : 1; // Bits 27:27
+ U32 Data_and_ECC_Address_Inversion : 2; // Bits 29:28
+ U32 Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 Stop_Base_Subsequence_On_Wrap_Trigger : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Number_of_Cachelines : 7; // Bits 6:0
+ U32 Number_of_Cachelines_Scale : 1; // Bits 7:7
+ U32 Subsequence_Wait : 14; // Bits 21:8
+ U32 Subsequence_Type : 4; // Bits 25:22
+ U32 Save_Current_Base_Address_To_Start : 1; // Bits 26:26
+ U32 Reset_Current_Base_Address_To_Start : 1; // Bits 27:27
+ U32 Data_and_ECC_Address_Inversion : 2; // Bits 29:28
+ U32 Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 Stop_Base_Subsequence_On_Wrap_Trigger : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Number_of_Cachelines : 7; // Bits 6:0
+ U32 Number_of_Cachelines_Scale : 1; // Bits 7:7
+ U32 Subsequence_Wait : 14; // Bits 21:8
+ U32 Subsequence_Type : 4; // Bits 25:22
+ U32 Save_Current_Base_Address_To_Start : 1; // Bits 26:26
+ U32 Reset_Current_Base_Address_To_Start : 1; // Bits 27:27
+ U32 Data_and_ECC_Address_Inversion : 2; // Bits 29:28
+ U32 Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 Stop_Base_Subsequence_On_Wrap_Trigger : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Number_of_Cachelines : 7; // Bits 6:0
+ U32 Number_of_Cachelines_Scale : 1; // Bits 7:7
+ U32 Subsequence_Wait : 14; // Bits 21:8
+ U32 Subsequence_Type : 4; // Bits 25:22
+ U32 Save_Current_Base_Address_To_Start : 1; // Bits 26:26
+ U32 Reset_Current_Base_Address_To_Start : 1; // Bits 27:27
+ U32 Data_and_ECC_Address_Inversion : 2; // Bits 29:28
+ U32 Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 Stop_Base_Subsequence_On_Wrap_Trigger : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_STRUCT;
+
+typedef union {
+ struct {
+ U32 Number_of_Cachelines : 7; // Bits 6:0
+ U32 Number_of_Cachelines_Scale : 1; // Bits 7:7
+ U32 Subsequence_Wait : 14; // Bits 21:8
+ U32 Subsequence_Type : 4; // Bits 25:22
+ U32 Save_Current_Base_Address_To_Start : 1; // Bits 26:26
+ U32 Reset_Current_Base_Address_To_Start : 1; // Bits 27:27
+ U32 Data_and_ECC_Address_Inversion : 2; // Bits 29:28
+ U32 Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 Stop_Base_Subsequence_On_Wrap_Trigger : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_STRUCT;
+
+typedef union {
+ struct {
+ U32 Number_of_Cachelines : 7; // Bits 6:0
+ U32 Number_of_Cachelines_Scale : 1; // Bits 7:7
+ U32 Subsequence_Wait : 14; // Bits 21:8
+ U32 Subsequence_Type : 4; // Bits 25:22
+ U32 Save_Current_Base_Address_To_Start : 1; // Bits 26:26
+ U32 Reset_Current_Base_Address_To_Start : 1; // Bits 27:27
+ U32 Data_and_ECC_Address_Inversion : 2; // Bits 29:28
+ U32 Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 Stop_Base_Subsequence_On_Wrap_Trigger : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_STRUCT;
+
+typedef union {
+ struct {
+ U32 Number_of_Cachelines : 7; // Bits 6:0
+ U32 Number_of_Cachelines_Scale : 1; // Bits 7:7
+ U32 Subsequence_Wait : 14; // Bits 21:8
+ U32 Subsequence_Type : 4; // Bits 25:22
+ U32 Save_Current_Base_Address_To_Start : 1; // Bits 26:26
+ U32 Reset_Current_Base_Address_To_Start : 1; // Bits 27:27
+ U32 Data_and_ECC_Address_Inversion : 2; // Bits 29:28
+ U32 Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 Stop_Base_Subsequence_On_Wrap_Trigger : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_STRUCT;
+
+typedef union {
+ struct {
+ U32 Number_of_Cachelines : 7; // Bits 6:0
+ U32 Number_of_Cachelines_Scale : 1; // Bits 7:7
+ U32 Subsequence_Wait : 14; // Bits 21:8
+ U32 Subsequence_Type : 4; // Bits 25:22
+ U32 Save_Current_Base_Address_To_Start : 1; // Bits 26:26
+ U32 Reset_Current_Base_Address_To_Start : 1; // Bits 27:27
+ U32 Data_and_ECC_Address_Inversion : 2; // Bits 29:28
+ U32 Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 Stop_Base_Subsequence_On_Wrap_Trigger : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Number_of_Cachelines : 7; // Bits 6:0
+ U32 Number_of_Cachelines_Scale : 1; // Bits 7:7
+ U32 Subsequence_Wait : 14; // Bits 21:8
+ U32 Subsequence_Type : 4; // Bits 25:22
+ U32 Save_Current_Base_Address_To_Start : 1; // Bits 26:26
+ U32 Reset_Current_Base_Address_To_Start : 1; // Bits 27:27
+ U32 Data_and_ECC_Address_Inversion : 2; // Bits 29:28
+ U32 Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 Stop_Base_Subsequence_On_Wrap_Trigger : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Number_of_Cachelines : 7; // Bits 6:0
+ U32 Number_of_Cachelines_Scale : 1; // Bits 7:7
+ U32 Subsequence_Wait : 14; // Bits 21:8
+ U32 Subsequence_Type : 4; // Bits 25:22
+ U32 Save_Current_Base_Address_To_Start : 1; // Bits 26:26
+ U32 Reset_Current_Base_Address_To_Start : 1; // Bits 27:27
+ U32 Data_and_ECC_Address_Inversion : 2; // Bits 29:28
+ U32 Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 Stop_Base_Subsequence_On_Wrap_Trigger : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Number_of_Cachelines : 7; // Bits 6:0
+ U32 Number_of_Cachelines_Scale : 1; // Bits 7:7
+ U32 Subsequence_Wait : 14; // Bits 21:8
+ U32 Subsequence_Type : 4; // Bits 25:22
+ U32 Save_Current_Base_Address_To_Start : 1; // Bits 26:26
+ U32 Reset_Current_Base_Address_To_Start : 1; // Bits 27:27
+ U32 Data_and_ECC_Address_Inversion : 2; // Bits 29:28
+ U32 Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 Stop_Base_Subsequence_On_Wrap_Trigger : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Number_of_Cachelines : 7; // Bits 6:0
+ U32 Number_of_Cachelines_Scale : 1; // Bits 7:7
+ U32 Subsequence_Wait : 14; // Bits 21:8
+ U32 Subsequence_Type : 4; // Bits 25:22
+ U32 Save_Current_Base_Address_To_Start : 1; // Bits 26:26
+ U32 Reset_Current_Base_Address_To_Start : 1; // Bits 27:27
+ U32 Data_and_ECC_Address_Inversion : 2; // Bits 29:28
+ U32 Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 Stop_Base_Subsequence_On_Wrap_Trigger : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_STRUCT;
+
+typedef union {
+ struct {
+ U32 Number_of_Cachelines : 7; // Bits 6:0
+ U32 Number_of_Cachelines_Scale : 1; // Bits 7:7
+ U32 Subsequence_Wait : 14; // Bits 21:8
+ U32 Subsequence_Type : 4; // Bits 25:22
+ U32 Save_Current_Base_Address_To_Start : 1; // Bits 26:26
+ U32 Reset_Current_Base_Address_To_Start : 1; // Bits 27:27
+ U32 Data_and_ECC_Address_Inversion : 2; // Bits 29:28
+ U32 Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 Stop_Base_Subsequence_On_Wrap_Trigger : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_STRUCT;
+
+typedef union {
+ struct {
+ U32 Number_of_Cachelines : 7; // Bits 6:0
+ U32 Number_of_Cachelines_Scale : 1; // Bits 7:7
+ U32 Subsequence_Wait : 14; // Bits 21:8
+ U32 Subsequence_Type : 4; // Bits 25:22
+ U32 Save_Current_Base_Address_To_Start : 1; // Bits 26:26
+ U32 Reset_Current_Base_Address_To_Start : 1; // Bits 27:27
+ U32 Data_and_ECC_Address_Inversion : 2; // Bits 29:28
+ U32 Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 Stop_Base_Subsequence_On_Wrap_Trigger : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_STRUCT;
+
+typedef union {
+ struct {
+ U32 Number_of_Cachelines : 7; // Bits 6:0
+ U32 Number_of_Cachelines_Scale : 1; // Bits 7:7
+ U32 Subsequence_Wait : 14; // Bits 21:8
+ U32 Subsequence_Type : 4; // Bits 25:22
+ U32 Save_Current_Base_Address_To_Start : 1; // Bits 26:26
+ U32 Reset_Current_Base_Address_To_Start : 1; // Bits 27:27
+ U32 Data_and_ECC_Address_Inversion : 2; // Bits 29:28
+ U32 Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 Stop_Base_Subsequence_On_Wrap_Trigger : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_STRUCT;
+
+typedef union {
+ struct {
+ U32 Offset_Address_Update_Rate : 5; // Bits 4:0
+ U32 : 3; // Bits 7:5
+ U32 Base_Subsequence_Repeat_Rate : 5; // Bits 12:8
+ U32 : 2; // Bits 14:13
+ U32 Column_Offset_Wrap_Trigger_Enable : 1; // Bits 15:15
+ U32 Row_Offset_Wrap_Trigger_Enable : 1; // Bits 16:16
+ U32 : 3; // Bits 19:17
+ U32 Base_Subsequence_Type : 1; // Bits 20:20
+ U32 CADB_Deselect_Enable : 1; // Bits 21:21
+ U32 CADB_Select_Enable : 1; // Bits 22:22
+ U32 CADB_Seeds_Save_Enable : 1; // Bits 23:23
+ U32 Column_Increment_Order : 1; // Bits 24:24
+ U32 : 1; // Bits 25:25
+ U32 Column_Increment_Enable : 1; // Bits 26:26
+ U32 Row_Increment_Order : 1; // Bits 27:27
+ U32 : 1; // Bits 28:28
+ U32 Row_Increment_Enable : 1; // Bits 29:29
+ U32 Base_Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Offset_Address_Update_Rate : 5; // Bits 4:0
+ U32 : 3; // Bits 7:5
+ U32 Base_Subsequence_Repeat_Rate : 5; // Bits 12:8
+ U32 : 2; // Bits 14:13
+ U32 Column_Offset_Wrap_Trigger_Enable : 1; // Bits 15:15
+ U32 Row_Offset_Wrap_Trigger_Enable : 1; // Bits 16:16
+ U32 : 3; // Bits 19:17
+ U32 Base_Subsequence_Type : 1; // Bits 20:20
+ U32 CADB_Deselect_Enable : 1; // Bits 21:21
+ U32 CADB_Select_Enable : 1; // Bits 22:22
+ U32 CADB_Seeds_Save_Enable : 1; // Bits 23:23
+ U32 Column_Increment_Order : 1; // Bits 24:24
+ U32 : 1; // Bits 25:25
+ U32 Column_Increment_Enable : 1; // Bits 26:26
+ U32 Row_Increment_Order : 1; // Bits 27:27
+ U32 : 1; // Bits 28:28
+ U32 Row_Increment_Enable : 1; // Bits 29:29
+ U32 Base_Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Offset_Address_Update_Rate : 5; // Bits 4:0
+ U32 : 3; // Bits 7:5
+ U32 Base_Subsequence_Repeat_Rate : 5; // Bits 12:8
+ U32 : 2; // Bits 14:13
+ U32 Column_Offset_Wrap_Trigger_Enable : 1; // Bits 15:15
+ U32 Row_Offset_Wrap_Trigger_Enable : 1; // Bits 16:16
+ U32 : 3; // Bits 19:17
+ U32 Base_Subsequence_Type : 1; // Bits 20:20
+ U32 CADB_Deselect_Enable : 1; // Bits 21:21
+ U32 CADB_Select_Enable : 1; // Bits 22:22
+ U32 CADB_Seeds_Save_Enable : 1; // Bits 23:23
+ U32 Column_Increment_Order : 1; // Bits 24:24
+ U32 : 1; // Bits 25:25
+ U32 Column_Increment_Enable : 1; // Bits 26:26
+ U32 Row_Increment_Order : 1; // Bits 27:27
+ U32 : 1; // Bits 28:28
+ U32 Row_Increment_Enable : 1; // Bits 29:29
+ U32 Base_Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Offset_Address_Update_Rate : 5; // Bits 4:0
+ U32 : 3; // Bits 7:5
+ U32 Base_Subsequence_Repeat_Rate : 5; // Bits 12:8
+ U32 : 2; // Bits 14:13
+ U32 Column_Offset_Wrap_Trigger_Enable : 1; // Bits 15:15
+ U32 Row_Offset_Wrap_Trigger_Enable : 1; // Bits 16:16
+ U32 : 3; // Bits 19:17
+ U32 Base_Subsequence_Type : 1; // Bits 20:20
+ U32 CADB_Deselect_Enable : 1; // Bits 21:21
+ U32 CADB_Select_Enable : 1; // Bits 22:22
+ U32 CADB_Seeds_Save_Enable : 1; // Bits 23:23
+ U32 Column_Increment_Order : 1; // Bits 24:24
+ U32 : 1; // Bits 25:25
+ U32 Column_Increment_Enable : 1; // Bits 26:26
+ U32 Row_Increment_Order : 1; // Bits 27:27
+ U32 : 1; // Bits 28:28
+ U32 Row_Increment_Enable : 1; // Bits 29:29
+ U32 Base_Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Offset_Address_Update_Rate : 5; // Bits 4:0
+ U32 : 3; // Bits 7:5
+ U32 Base_Subsequence_Repeat_Rate : 5; // Bits 12:8
+ U32 : 2; // Bits 14:13
+ U32 Column_Offset_Wrap_Trigger_Enable : 1; // Bits 15:15
+ U32 Row_Offset_Wrap_Trigger_Enable : 1; // Bits 16:16
+ U32 : 3; // Bits 19:17
+ U32 Base_Subsequence_Type : 1; // Bits 20:20
+ U32 CADB_Deselect_Enable : 1; // Bits 21:21
+ U32 CADB_Select_Enable : 1; // Bits 22:22
+ U32 CADB_Seeds_Save_Enable : 1; // Bits 23:23
+ U32 Column_Increment_Order : 1; // Bits 24:24
+ U32 : 1; // Bits 25:25
+ U32 Column_Increment_Enable : 1; // Bits 26:26
+ U32 Row_Increment_Order : 1; // Bits 27:27
+ U32 : 1; // Bits 28:28
+ U32 Row_Increment_Enable : 1; // Bits 29:29
+ U32 Base_Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_STRUCT;
+
+typedef union {
+ struct {
+ U32 Offset_Address_Update_Rate : 5; // Bits 4:0
+ U32 : 3; // Bits 7:5
+ U32 Base_Subsequence_Repeat_Rate : 5; // Bits 12:8
+ U32 : 2; // Bits 14:13
+ U32 Column_Offset_Wrap_Trigger_Enable : 1; // Bits 15:15
+ U32 Row_Offset_Wrap_Trigger_Enable : 1; // Bits 16:16
+ U32 : 3; // Bits 19:17
+ U32 Base_Subsequence_Type : 1; // Bits 20:20
+ U32 CADB_Deselect_Enable : 1; // Bits 21:21
+ U32 CADB_Select_Enable : 1; // Bits 22:22
+ U32 CADB_Seeds_Save_Enable : 1; // Bits 23:23
+ U32 Column_Increment_Order : 1; // Bits 24:24
+ U32 : 1; // Bits 25:25
+ U32 Column_Increment_Enable : 1; // Bits 26:26
+ U32 Row_Increment_Order : 1; // Bits 27:27
+ U32 : 1; // Bits 28:28
+ U32 Row_Increment_Enable : 1; // Bits 29:29
+ U32 Base_Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_STRUCT;
+
+typedef union {
+ struct {
+ U32 Offset_Address_Update_Rate : 5; // Bits 4:0
+ U32 : 3; // Bits 7:5
+ U32 Base_Subsequence_Repeat_Rate : 5; // Bits 12:8
+ U32 : 2; // Bits 14:13
+ U32 Column_Offset_Wrap_Trigger_Enable : 1; // Bits 15:15
+ U32 Row_Offset_Wrap_Trigger_Enable : 1; // Bits 16:16
+ U32 : 3; // Bits 19:17
+ U32 Base_Subsequence_Type : 1; // Bits 20:20
+ U32 CADB_Deselect_Enable : 1; // Bits 21:21
+ U32 CADB_Select_Enable : 1; // Bits 22:22
+ U32 CADB_Seeds_Save_Enable : 1; // Bits 23:23
+ U32 Column_Increment_Order : 1; // Bits 24:24
+ U32 : 1; // Bits 25:25
+ U32 Column_Increment_Enable : 1; // Bits 26:26
+ U32 Row_Increment_Order : 1; // Bits 27:27
+ U32 : 1; // Bits 28:28
+ U32 Row_Increment_Enable : 1; // Bits 29:29
+ U32 Base_Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_STRUCT;
+
+typedef union {
+ struct {
+ U32 Offset_Address_Update_Rate : 5; // Bits 4:0
+ U32 : 3; // Bits 7:5
+ U32 Base_Subsequence_Repeat_Rate : 5; // Bits 12:8
+ U32 : 2; // Bits 14:13
+ U32 Column_Offset_Wrap_Trigger_Enable : 1; // Bits 15:15
+ U32 Row_Offset_Wrap_Trigger_Enable : 1; // Bits 16:16
+ U32 : 3; // Bits 19:17
+ U32 Base_Subsequence_Type : 1; // Bits 20:20
+ U32 CADB_Deselect_Enable : 1; // Bits 21:21
+ U32 CADB_Select_Enable : 1; // Bits 22:22
+ U32 CADB_Seeds_Save_Enable : 1; // Bits 23:23
+ U32 Column_Increment_Order : 1; // Bits 24:24
+ U32 : 1; // Bits 25:25
+ U32 Column_Increment_Enable : 1; // Bits 26:26
+ U32 Row_Increment_Order : 1; // Bits 27:27
+ U32 : 1; // Bits 28:28
+ U32 Row_Increment_Enable : 1; // Bits 29:29
+ U32 Base_Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_STRUCT;
+
+typedef union {
+ struct {
+ U32 Offset_Address_Update_Rate : 5; // Bits 4:0
+ U32 : 3; // Bits 7:5
+ U32 Base_Subsequence_Repeat_Rate : 5; // Bits 12:8
+ U32 : 2; // Bits 14:13
+ U32 Column_Offset_Wrap_Trigger_Enable : 1; // Bits 15:15
+ U32 Row_Offset_Wrap_Trigger_Enable : 1; // Bits 16:16
+ U32 : 3; // Bits 19:17
+ U32 Base_Subsequence_Type : 1; // Bits 20:20
+ U32 CADB_Deselect_Enable : 1; // Bits 21:21
+ U32 CADB_Select_Enable : 1; // Bits 22:22
+ U32 CADB_Seeds_Save_Enable : 1; // Bits 23:23
+ U32 Column_Increment_Order : 1; // Bits 24:24
+ U32 : 1; // Bits 25:25
+ U32 Column_Increment_Enable : 1; // Bits 26:26
+ U32 Row_Increment_Order : 1; // Bits 27:27
+ U32 : 1; // Bits 28:28
+ U32 Row_Increment_Enable : 1; // Bits 29:29
+ U32 Base_Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Offset_Address_Update_Rate : 5; // Bits 4:0
+ U32 : 3; // Bits 7:5
+ U32 Base_Subsequence_Repeat_Rate : 5; // Bits 12:8
+ U32 : 2; // Bits 14:13
+ U32 Column_Offset_Wrap_Trigger_Enable : 1; // Bits 15:15
+ U32 Row_Offset_Wrap_Trigger_Enable : 1; // Bits 16:16
+ U32 : 3; // Bits 19:17
+ U32 Base_Subsequence_Type : 1; // Bits 20:20
+ U32 CADB_Deselect_Enable : 1; // Bits 21:21
+ U32 CADB_Select_Enable : 1; // Bits 22:22
+ U32 CADB_Seeds_Save_Enable : 1; // Bits 23:23
+ U32 Column_Increment_Order : 1; // Bits 24:24
+ U32 : 1; // Bits 25:25
+ U32 Column_Increment_Enable : 1; // Bits 26:26
+ U32 Row_Increment_Order : 1; // Bits 27:27
+ U32 : 1; // Bits 28:28
+ U32 Row_Increment_Enable : 1; // Bits 29:29
+ U32 Base_Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Offset_Address_Update_Rate : 5; // Bits 4:0
+ U32 : 3; // Bits 7:5
+ U32 Base_Subsequence_Repeat_Rate : 5; // Bits 12:8
+ U32 : 2; // Bits 14:13
+ U32 Column_Offset_Wrap_Trigger_Enable : 1; // Bits 15:15
+ U32 Row_Offset_Wrap_Trigger_Enable : 1; // Bits 16:16
+ U32 : 3; // Bits 19:17
+ U32 Base_Subsequence_Type : 1; // Bits 20:20
+ U32 CADB_Deselect_Enable : 1; // Bits 21:21
+ U32 CADB_Select_Enable : 1; // Bits 22:22
+ U32 CADB_Seeds_Save_Enable : 1; // Bits 23:23
+ U32 Column_Increment_Order : 1; // Bits 24:24
+ U32 : 1; // Bits 25:25
+ U32 Column_Increment_Enable : 1; // Bits 26:26
+ U32 Row_Increment_Order : 1; // Bits 27:27
+ U32 : 1; // Bits 28:28
+ U32 Row_Increment_Enable : 1; // Bits 29:29
+ U32 Base_Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Offset_Address_Update_Rate : 5; // Bits 4:0
+ U32 : 3; // Bits 7:5
+ U32 Base_Subsequence_Repeat_Rate : 5; // Bits 12:8
+ U32 : 2; // Bits 14:13
+ U32 Column_Offset_Wrap_Trigger_Enable : 1; // Bits 15:15
+ U32 Row_Offset_Wrap_Trigger_Enable : 1; // Bits 16:16
+ U32 : 3; // Bits 19:17
+ U32 Base_Subsequence_Type : 1; // Bits 20:20
+ U32 CADB_Deselect_Enable : 1; // Bits 21:21
+ U32 CADB_Select_Enable : 1; // Bits 22:22
+ U32 CADB_Seeds_Save_Enable : 1; // Bits 23:23
+ U32 Column_Increment_Order : 1; // Bits 24:24
+ U32 : 1; // Bits 25:25
+ U32 Column_Increment_Enable : 1; // Bits 26:26
+ U32 Row_Increment_Order : 1; // Bits 27:27
+ U32 : 1; // Bits 28:28
+ U32 Row_Increment_Enable : 1; // Bits 29:29
+ U32 Base_Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Offset_Address_Update_Rate : 5; // Bits 4:0
+ U32 : 3; // Bits 7:5
+ U32 Base_Subsequence_Repeat_Rate : 5; // Bits 12:8
+ U32 : 2; // Bits 14:13
+ U32 Column_Offset_Wrap_Trigger_Enable : 1; // Bits 15:15
+ U32 Row_Offset_Wrap_Trigger_Enable : 1; // Bits 16:16
+ U32 : 3; // Bits 19:17
+ U32 Base_Subsequence_Type : 1; // Bits 20:20
+ U32 CADB_Deselect_Enable : 1; // Bits 21:21
+ U32 CADB_Select_Enable : 1; // Bits 22:22
+ U32 CADB_Seeds_Save_Enable : 1; // Bits 23:23
+ U32 Column_Increment_Order : 1; // Bits 24:24
+ U32 : 1; // Bits 25:25
+ U32 Column_Increment_Enable : 1; // Bits 26:26
+ U32 Row_Increment_Order : 1; // Bits 27:27
+ U32 : 1; // Bits 28:28
+ U32 Row_Increment_Enable : 1; // Bits 29:29
+ U32 Base_Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_STRUCT;
+
+typedef union {
+ struct {
+ U32 Offset_Address_Update_Rate : 5; // Bits 4:0
+ U32 : 3; // Bits 7:5
+ U32 Base_Subsequence_Repeat_Rate : 5; // Bits 12:8
+ U32 : 2; // Bits 14:13
+ U32 Column_Offset_Wrap_Trigger_Enable : 1; // Bits 15:15
+ U32 Row_Offset_Wrap_Trigger_Enable : 1; // Bits 16:16
+ U32 : 3; // Bits 19:17
+ U32 Base_Subsequence_Type : 1; // Bits 20:20
+ U32 CADB_Deselect_Enable : 1; // Bits 21:21
+ U32 CADB_Select_Enable : 1; // Bits 22:22
+ U32 CADB_Seeds_Save_Enable : 1; // Bits 23:23
+ U32 Column_Increment_Order : 1; // Bits 24:24
+ U32 : 1; // Bits 25:25
+ U32 Column_Increment_Enable : 1; // Bits 26:26
+ U32 Row_Increment_Order : 1; // Bits 27:27
+ U32 : 1; // Bits 28:28
+ U32 Row_Increment_Enable : 1; // Bits 29:29
+ U32 Base_Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_STRUCT;
+
+typedef union {
+ struct {
+ U32 Offset_Address_Update_Rate : 5; // Bits 4:0
+ U32 : 3; // Bits 7:5
+ U32 Base_Subsequence_Repeat_Rate : 5; // Bits 12:8
+ U32 : 2; // Bits 14:13
+ U32 Column_Offset_Wrap_Trigger_Enable : 1; // Bits 15:15
+ U32 Row_Offset_Wrap_Trigger_Enable : 1; // Bits 16:16
+ U32 : 3; // Bits 19:17
+ U32 Base_Subsequence_Type : 1; // Bits 20:20
+ U32 CADB_Deselect_Enable : 1; // Bits 21:21
+ U32 CADB_Select_Enable : 1; // Bits 22:22
+ U32 CADB_Seeds_Save_Enable : 1; // Bits 23:23
+ U32 Column_Increment_Order : 1; // Bits 24:24
+ U32 : 1; // Bits 25:25
+ U32 Column_Increment_Enable : 1; // Bits 26:26
+ U32 Row_Increment_Order : 1; // Bits 27:27
+ U32 : 1; // Bits 28:28
+ U32 Row_Increment_Enable : 1; // Bits 29:29
+ U32 Base_Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_STRUCT;
+
+typedef union {
+ struct {
+ U32 Offset_Address_Update_Rate : 5; // Bits 4:0
+ U32 : 3; // Bits 7:5
+ U32 Base_Subsequence_Repeat_Rate : 5; // Bits 12:8
+ U32 : 2; // Bits 14:13
+ U32 Column_Offset_Wrap_Trigger_Enable : 1; // Bits 15:15
+ U32 Row_Offset_Wrap_Trigger_Enable : 1; // Bits 16:16
+ U32 : 3; // Bits 19:17
+ U32 Base_Subsequence_Type : 1; // Bits 20:20
+ U32 CADB_Deselect_Enable : 1; // Bits 21:21
+ U32 CADB_Select_Enable : 1; // Bits 22:22
+ U32 CADB_Seeds_Save_Enable : 1; // Bits 23:23
+ U32 Column_Increment_Order : 1; // Bits 24:24
+ U32 : 1; // Bits 25:25
+ U32 Column_Increment_Enable : 1; // Bits 26:26
+ U32 Row_Increment_Order : 1; // Bits 27:27
+ U32 : 1; // Bits 28:28
+ U32 Row_Increment_Enable : 1; // Bits 29:29
+ U32 Base_Invert_Data_and_ECC : 1; // Bits 30:30
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_STRUCT;
+
+typedef union {
+ struct {
+ U32 : 3; // Bits 2:0
+ U32 Stop_Base_Sequence_On_Wrap_Trigger : 1; // Bits 3:3
+ U32 : 1; // Bits 4:4
+ U32 Address_Update_Rate_Mode : 1; // Bits 5:5
+ U32 : 1; // Bits 6:6
+ U32 Enable_Dummy_Reads : 1; // Bits 7:7
+ U32 : 2; // Bits 9:8
+ U32 Enable_Constant_Write_Strobe : 1; // Bits 10:10
+ U32 Global_Control : 1; // Bits 11:11
+ U32 Initialization_Mode : 2; // Bits 13:12
+ U32 : 2; // Bits 15:14
+ U32 Loopcount : 5; // Bits 20:16 ** Does not exist in C0 **
+ U32 : 3; // Bits 23:21
+ U32 Subsequence_Start_Pointer : 3; // Bits 26:24
+ U32 : 1; // Bits 27:27
+ U32 Subsequence_End_Pointer : 3; // Bits 30:28
+ U32 : 1; // Bits 31:31
+ U32 Start_Test_Delay : 10; // Bits 41:32
+ U32 : 22; // Bits 63:42
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 : 3; // Bits 2:0
+ U32 Stop_Base_Sequence_On_Wrap_Trigger : 1; // Bits 3:3
+ U32 : 1; // Bits 4:4
+ U32 Address_Update_Rate_Mode : 1; // Bits 5:5
+ U32 : 1; // Bits 6:6
+ U32 Enable_Dummy_Reads : 1; // Bits 7:7
+ U32 : 2; // Bits 9:8
+ U32 Enable_Constant_Write_Strobe : 1; // Bits 10:10
+ U32 Global_Control : 1; // Bits 11:11
+ U32 Initialization_Mode : 2; // Bits 13:12
+ U32 : 2; // Bits 15:14
+ U32 Loopcount : 5; // Bits 20:16 ** Does not exist in C0 **
+ U32 : 3; // Bits 23:21
+ U32 Subsequence_Start_Pointer : 3; // Bits 26:24
+ U32 : 1; // Bits 27:27
+ U32 Subsequence_End_Pointer : 3; // Bits 30:28
+ U32 : 1; // Bits 31:31
+ U32 Start_Test_Delay : 10; // Bits 41:32
+ U32 : 22; // Bits 63:42
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Local_Start_Test : 1; // Bits 0:0
+ U32 Local_Stop_Test : 1; // Bits 1:1
+ U32 Local_Clear_Errors : 1; // Bits 2:2
+ U32 : 29; // Bits 31:3
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Local_Start_Test : 1; // Bits 0:0
+ U32 Local_Stop_Test : 1; // Bits 1:1
+ U32 Local_Clear_Errors : 1; // Bits 2:2
+ U32 : 29; // Bits 31:3
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Current_Loopcount : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH_SEQ_LOOPCOUNT_STATUS_MCMAIN_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Current_Loopcount : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH_SEQ_LOOPCOUNT_STATUS_MCMAIN_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Current_Subsequence_Pointer : 3; // Bits 2:0
+ U32 : 29; // Bits 31:3
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH_SEQ_SUBSEQ_PNTR_MCMAIN_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Current_Subsequence_Pointer : 3; // Bits 2:0
+ U32 : 29; // Bits 31:3
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH_SEQ_SUBSEQ_PNTR_MCMAIN_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Current_Cacheline : 16; // Bits 15:0
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH_SEQ_CACHELINE_STATUS_MCMAIN_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Current_Cacheline : 16; // Bits 15:0
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH_SEQ_CACHELINE_STATUS_MCMAIN_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 : 3; // Bits 2:0
+ U32 Column_Address : 8; // Bits 10:3
+ U32 : 13; // Bits 23:11
+ U32 Row_Address : 16; // Bits 39:24
+ U32 : 8; // Bits 47:40
+ U32 Bank_Address : 3; // Bits 50:48
+ U32 : 5; // Bits 55:51
+ U32 Rank_Address : 3; // Bits 58:56
+ U32 : 5; // Bits 63:59
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 : 3; // Bits 2:0
+ U32 Column_Address : 8; // Bits 10:3
+ U32 : 13; // Bits 23:11
+ U32 Row_Address : 16; // Bits 39:24
+ U32 : 8; // Bits 47:40
+ U32 Bank_Address : 3; // Bits 50:48
+ U32 : 5; // Bits 55:51
+ U32 Rank_Address : 3; // Bits 58:56
+ U32 : 5; // Bits 63:59
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 : 3; // Bits 2:0
+ U32 Column_Address : 8; // Bits 10:3
+ U32 : 13; // Bits 23:11
+ U32 Row_Address : 16; // Bits 39:24
+ U32 : 8; // Bits 47:40
+ U32 Bank_Address : 3; // Bits 50:48
+ U32 : 5; // Bits 55:51
+ U32 Rank_Address : 3; // Bits 58:56
+ U32 : 5; // Bits 63:59
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 : 3; // Bits 2:0
+ U32 Column_Address : 8; // Bits 10:3
+ U32 : 13; // Bits 23:11
+ U32 Row_Address : 16; // Bits 39:24
+ U32 : 8; // Bits 47:40
+ U32 Bank_Address : 3; // Bits 50:48
+ U32 : 5; // Bits 55:51
+ U32 Rank_Address : 3; // Bits 58:56
+ U32 : 5; // Bits 63:59
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 : 3; // Bits 2:0
+ U32 Column_Address : 8; // Bits 10:3
+ U32 : 13; // Bits 23:11
+ U32 Row_Address : 16; // Bits 39:24
+ U32 : 8; // Bits 47:40
+ U32 Bank_Address : 3; // Bits 50:48
+ U32 : 5; // Bits 55:51
+ U32 Rank_Address : 3; // Bits 58:56
+ U32 : 5; // Bits 63:59
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 : 3; // Bits 2:0
+ U32 Column_Address : 8; // Bits 10:3
+ U32 : 13; // Bits 23:11
+ U32 Row_Address : 16; // Bits 39:24
+ U32 : 8; // Bits 47:40
+ U32 Bank_Address : 3; // Bits 50:48
+ U32 : 5; // Bits 55:51
+ U32 Rank_Address : 3; // Bits 58:56
+ U32 : 5; // Bits 63:59
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Base_Column_Address_Order : 2; // Bits 1:0
+ U32 Base_Row_Address_Order : 2; // Bits 3:2
+ U32 Base_Bank_Address_Order : 2; // Bits 5:4
+ U32 Base_Rank_Address_Order : 2; // Bits 7:6
+ U32 : 5; // Bits 12:8
+ U32 Base_Address_Invert_Rate : 3; // Bits 15:13
+ U32 : 4; // Bits 19:16
+ U32 Column_Base_Address_Invert_Enable : 1; // Bits 20:20
+ U32 Row_Base_Address_Invert_Enable : 1; // Bits 21:21
+ U32 Bank_Base_Address_Invert_Enable : 1; // Bits 22:22
+ U32 Rank_Base_Address_Invert_Enable : 1; // Bits 23:23
+ U32 Column_Base_Wrap_Trigger_Enable : 1; // Bits 24:24
+ U32 Row_Base_Wrap_Trigger_Enable : 1; // Bits 25:25
+ U32 Bank_Base_Wrap_Trigger_Enable : 1; // Bits 26:26
+ U32 Rank_Base_Wrap_Trigger_Enable : 1; // Bits 27:27
+ U32 Column_Base_Wrap_Carry_Enable : 1; // Bits 28:28
+ U32 Row_Base_Wrap_Carry_Enable : 1; // Bits 29:29
+ U32 Bank_Base_Wrap_Carry_Enable : 1; // Bits 30:30
+ U32 Rank_Base_Wrap_Carry_Enable : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Base_Column_Address_Order : 2; // Bits 1:0
+ U32 Base_Row_Address_Order : 2; // Bits 3:2
+ U32 Base_Bank_Address_Order : 2; // Bits 5:4
+ U32 Base_Rank_Address_Order : 2; // Bits 7:6
+ U32 : 5; // Bits 12:8
+ U32 Base_Address_Invert_Rate : 3; // Bits 15:13
+ U32 : 4; // Bits 19:16
+ U32 Column_Base_Address_Invert_Enable : 1; // Bits 20:20
+ U32 Row_Base_Address_Invert_Enable : 1; // Bits 21:21
+ U32 Bank_Base_Address_Invert_Enable : 1; // Bits 22:22
+ U32 Rank_Base_Address_Invert_Enable : 1; // Bits 23:23
+ U32 Column_Base_Wrap_Trigger_Enable : 1; // Bits 24:24
+ U32 Row_Base_Wrap_Trigger_Enable : 1; // Bits 25:25
+ U32 Bank_Base_Wrap_Trigger_Enable : 1; // Bits 26:26
+ U32 Rank_Base_Wrap_Trigger_Enable : 1; // Bits 27:27
+ U32 Column_Base_Wrap_Carry_Enable : 1; // Bits 28:28
+ U32 Row_Base_Wrap_Carry_Enable : 1; // Bits 29:29
+ U32 Bank_Base_Wrap_Carry_Enable : 1; // Bits 30:30
+ U32 Rank_Base_Wrap_Carry_Enable : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 : 3; // Bits 2:0
+ U32 Column_Base_Address_Increment : 8; // Bits 10:3
+ U32 : 1; // Bits 11:11
+ U32 Column_Base_Address_Update_Rate : 5; // Bits 16:12
+ U32 : 2; // Bits 18:17
+ U32 Column_Base_Address_Update_Scale : 1; // Bits 19:19
+ U32 Row_Base_Address_Increment : 12; // Bits 31:20
+ U32 Row_Base_Address_Update_Rate : 4; // Bits 35:32
+ U32 : 1; // Bits 36:36
+ U32 Row_Base_Address_Update_Scale : 1; // Bits 37:37
+ U32 Bank_Base_Address_Increment : 3; // Bits 40:38
+ U32 : 3; // Bits 43:41
+ U32 Bank_Base_Address_Update_Rate : 5; // Bits 48:44
+ U32 : 2; // Bits 50:49
+ U32 Bank_Base_Address_Update_Scale : 1; // Bits 51:51
+ U32 Rank_Base_Address_Increment : 3; // Bits 54:52
+ U32 : 1; // Bits 55:55
+ U32 Rank_Base_Address_Update_Rate : 5; // Bits 60:56
+ U32 : 2; // Bits 62:61
+ U32 Rank_Base_Address_Update_Scale : 1; // Bits 63:63
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 : 3; // Bits 2:0
+ U32 Column_Base_Address_Increment : 8; // Bits 10:3
+ U32 : 1; // Bits 11:11
+ U32 Column_Base_Address_Update_Rate : 5; // Bits 16:12
+ U32 : 2; // Bits 18:17
+ U32 Column_Base_Address_Update_Scale : 1; // Bits 19:19
+ U32 Row_Base_Address_Increment : 12; // Bits 31:20
+ U32 Row_Base_Address_Update_Rate : 4; // Bits 35:32
+ U32 : 1; // Bits 36:36
+ U32 Row_Base_Address_Update_Scale : 1; // Bits 37:37
+ U32 Bank_Base_Address_Increment : 3; // Bits 40:38
+ U32 : 3; // Bits 43:41
+ U32 Bank_Base_Address_Update_Rate : 5; // Bits 48:44
+ U32 : 2; // Bits 50:49
+ U32 Bank_Base_Address_Update_Scale : 1; // Bits 51:51
+ U32 Rank_Base_Address_Increment : 3; // Bits 54:52
+ U32 : 1; // Bits 55:55
+ U32 Rank_Base_Address_Update_Rate : 5; // Bits 60:56
+ U32 : 2; // Bits 62:61
+ U32 Rank_Base_Address_Update_Scale : 1; // Bits 63:63
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 : 3; // Bits 2:0
+ U32 Column_Address : 8; // Bits 10:3
+ U32 : 13; // Bits 23:11
+ U32 Row_Address : 16; // Bits 39:24
+ U32 : 24; // Bits 63:40
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} MCDFXS_CR_REUT_CH_SEQ_OFFSET_ADDR_CURRENT_MCMAIN_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 : 3; // Bits 2:0
+ U32 Column_Address : 8; // Bits 10:3
+ U32 : 13; // Bits 23:11
+ U32 Row_Address : 16; // Bits 39:24
+ U32 : 24; // Bits 63:40
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} MCDFXS_CR_REUT_CH_SEQ_OFFSET_ADDR_CURRENT_MCMAIN_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Logical_to_Physical_Rank0_Mapping : 2; // Bits 1:0
+ U32 : 2; // Bits 3:2
+ U32 Logical_to_Physical_Rank1_Mapping : 2; // Bits 5:4
+ U32 : 2; // Bits 7:6
+ U32 Logical_to_Physical_Rank2_Mapping : 2; // Bits 9:8
+ U32 : 2; // Bits 11:10
+ U32 Logical_to_Physical_Rank3_Mapping : 2; // Bits 13:12
+ U32 : 2; // Bits 15:14
+ U32 Logical_to_Physical_Rank4_Mapping : 2; // Bits 17:16
+ U32 : 2; // Bits 19:18
+ U32 Logical_to_Physical_Rank5_Mapping : 2; // Bits 21:20
+ U32 : 2; // Bits 23:22
+ U32 Logical_to_Physical_Rank6_Mapping : 2; // Bits 25:24
+ U32 : 2; // Bits 27:26
+ U32 Logical_to_Physical_Rank7_Mapping : 2; // Bits 29:28
+ U32 : 2; // Bits 31:30
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Logical_to_Physical_Rank0_Mapping : 2; // Bits 1:0
+ U32 : 2; // Bits 3:2
+ U32 Logical_to_Physical_Rank1_Mapping : 2; // Bits 5:4
+ U32 : 2; // Bits 7:6
+ U32 Logical_to_Physical_Rank2_Mapping : 2; // Bits 9:8
+ U32 : 2; // Bits 11:10
+ U32 Logical_to_Physical_Rank3_Mapping : 2; // Bits 13:12
+ U32 : 2; // Bits 15:14
+ U32 Logical_to_Physical_Rank4_Mapping : 2; // Bits 17:16
+ U32 : 2; // Bits 19:18
+ U32 Logical_to_Physical_Rank5_Mapping : 2; // Bits 21:20
+ U32 : 2; // Bits 23:22
+ U32 Logical_to_Physical_Rank6_Mapping : 2; // Bits 25:24
+ U32 : 2; // Bits 27:26
+ U32 Logical_to_Physical_Rank7_Mapping : 2; // Bits 29:28
+ U32 : 2; // Bits 31:30
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Logical_to_Physical_Row0_Swizzle : 4; // Bits 3:0
+ U32 : 1; // Bits 4:4
+ U32 Logical_to_Physical_Row1_Swizzle : 4; // Bits 8:5
+ U32 : 1; // Bits 9:9
+ U32 Logical_to_Physical_Row2_Swizzle : 4; // Bits 13:10
+ U32 : 1; // Bits 14:14
+ U32 Logical_to_Physical_Row3_Swizzle : 4; // Bits 18:15
+ U32 : 1; // Bits 19:19
+ U32 Logical_to_Physical_Row4_Swizzle : 4; // Bits 23:20
+ U32 : 1; // Bits 24:24
+ U32 Logical_to_Physical_Row5_Swizzle : 4; // Bits 28:25
+ U32 : 3; // Bits 31:29
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Logical_to_Physical_Row0_Swizzle : 4; // Bits 3:0
+ U32 : 1; // Bits 4:4
+ U32 Logical_to_Physical_Row1_Swizzle : 4; // Bits 8:5
+ U32 : 1; // Bits 9:9
+ U32 Logical_to_Physical_Row2_Swizzle : 4; // Bits 13:10
+ U32 : 1; // Bits 14:14
+ U32 Logical_to_Physical_Row3_Swizzle : 4; // Bits 18:15
+ U32 : 1; // Bits 19:19
+ U32 Logical_to_Physical_Row4_Swizzle : 4; // Bits 23:20
+ U32 : 1; // Bits 24:24
+ U32 Logical_to_Physical_Row5_Swizzle : 4; // Bits 28:25
+ U32 : 3; // Bits 31:29
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Logical_to_Physical_Row6_Swizzle : 4; // Bits 3:0
+ U32 : 1; // Bits 4:4
+ U32 Logical_to_Physical_Row7_Swizzle : 4; // Bits 8:5
+ U32 : 1; // Bits 9:9
+ U32 Logical_to_Physical_Row8_Swizzle : 4; // Bits 13:10
+ U32 : 1; // Bits 14:14
+ U32 Logical_to_Physical_Row9_Swizzle : 4; // Bits 18:15
+ U32 : 1; // Bits 19:19
+ U32 Logical_to_Physical_Row10_Swizzle : 4; // Bits 23:20
+ U32 : 1; // Bits 24:24
+ U32 Logical_to_Physical_Row11_Swizzle : 4; // Bits 28:25
+ U32 : 1; // Bits 29:29
+ U32 Logical_to_Physical_Row12_Swizzle : 4; // Bits 33:30
+ U32 : 1; // Bits 34:34
+ U32 Logical_to_Physical_Row13_Swizzle : 4; // Bits 38:35
+ U32 : 1; // Bits 39:39
+ U32 Logical_to_Physical_Row14_Swizzle : 4; // Bits 43:40
+ U32 : 1; // Bits 44:44
+ U32 Logical_to_Physical_Row15_Swizzle : 4; // Bits 48:45
+ U32 : 15; // Bits 63:49
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Logical_to_Physical_Row6_Swizzle : 4; // Bits 3:0
+ U32 : 1; // Bits 4:4
+ U32 Logical_to_Physical_Row7_Swizzle : 4; // Bits 8:5
+ U32 : 1; // Bits 9:9
+ U32 Logical_to_Physical_Row8_Swizzle : 4; // Bits 13:10
+ U32 : 1; // Bits 14:14
+ U32 Logical_to_Physical_Row9_Swizzle : 4; // Bits 18:15
+ U32 : 1; // Bits 19:19
+ U32 Logical_to_Physical_Row10_Swizzle : 4; // Bits 23:20
+ U32 : 1; // Bits 24:24
+ U32 Logical_to_Physical_Row11_Swizzle : 4; // Bits 28:25
+ U32 : 1; // Bits 29:29
+ U32 Logical_to_Physical_Row12_Swizzle : 4; // Bits 33:30
+ U32 : 1; // Bits 34:34
+ U32 Logical_to_Physical_Row13_Swizzle : 4; // Bits 38:35
+ U32 : 1; // Bits 39:39
+ U32 Logical_to_Physical_Row14_Swizzle : 4; // Bits 43:40
+ U32 : 1; // Bits 44:44
+ U32 Logical_to_Physical_Row15_Swizzle : 4; // Bits 48:45
+ U32 : 15; // Bits 63:49
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Dummy_Read_Row_Current_Address : 16; // Bits 15:0
+ U32 : 8; // Bits 23:16
+ U32 Dummy_Read_Bank_Current_Address : 3; // Bits 26:24
+ U32 : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_ADDRESS_MCMAIN_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Dummy_Read_Row_Current_Address : 16; // Bits 15:0
+ U32 : 8; // Bits 23:16
+ U32 Dummy_Read_Bank_Current_Address : 3; // Bits 26:24
+ U32 : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_ADDRESS_MCMAIN_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Dummy_Read_Bank_Mask : 8; // Bits 7:0
+ U32 : 24; // Bits 31:8
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_MASK_MCMAIN_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Dummy_Read_Bank_Mask : 8; // Bits 7:0
+ U32 : 24; // Bits 31:8
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_MASK_MCMAIN_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 L_DummyRead_Select : 1; // Bits 0:0
+ U32 Enable_Sweep_Frequency : 1; // Bits 1:1
+ U32 : 6; // Bits 7:2
+ U32 L_counter : 8; // Bits 15:8
+ U32 M_counter : 8; // Bits 23:16
+ U32 N_Counter : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 L_DummyRead_Select : 1; // Bits 0:0
+ U32 Enable_Sweep_Frequency : 1; // Bits 1:1
+ U32 : 6; // Bits 7:2
+ U32 L_counter : 8; // Bits 15:8
+ U32 M_counter : 8; // Bits 23:16
+ U32 N_Counter : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 EN_CLK : 1; // Bits 0:0
+ U32 L0_DATA_BYTE_SEL : 7; // Bits 7:1
+ U32 L0_BYP_SEL : 1; // Bits 8:8
+ U32 L1_DATA_BYTE_SEL : 7; // Bits 15:9
+ U32 L1_BYP_SEL : 1; // Bits 16:16
+ U32 : 15; // Bits 31:17
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_VISA_CTL_MCDFXS_MCMAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 Trigger_In_Global_Start : 1; // Bits 0:0
+ U32 Trigger_Out_Global_Start : 1; // Bits 1:1
+ U32 : 5; // Bits 6:2
+ U32 Trigger_Out_On_Error_0 : 1; // Bits 7:7
+ U32 Trigger_Out_On_Error_1 : 1; // Bits 8:8
+ U32 : 6; // Bits 14:9
+ U32 Trigger_Out_On_Channel_Test_Done_Status_0: 1; // Bits 15:15
+ U32 Trigger_Out_On_Channel_Test_Done_Status_1: 1; // Bits 16:16
+ U32 : 15; // Bits 31:17
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH_ERR_TRIGGER_CTL_MCMAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 Loopcount_Limit : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH_SEQ_LOOPCOUNT_LIMIT_MCMAIN_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Loopcount_Limit : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDFXS_CR_REUT_CH_SEQ_LOOPCOUNT_LIMIT_MCMAIN_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 tRCD : 5; // Bits 4:0
+ U32 tRP : 5; // Bits 9:5
+ U32 tRAS : 6; // Bits 15:10
+ U32 tRDPRE : 4; // Bits 19:16
+ U32 tWRPRE : 6; // Bits 25:20
+ U32 tRRD : 4; // Bits 29:26
+ U32 tRPab_ext : 2; // Bits 31:30
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_TC_BANK_STRUCT;
+
+typedef union {
+ struct {
+ U32 tCKE : 4; // Bits 3:0
+ U32 tFAW : 8; // Bits 11:4
+ U32 tRDRD : 3; // Bits 14:12
+ U32 tRDRD_dr : 4; // Bits 18:15
+ U32 tRDRD_dd : 4; // Bits 22:19
+ U32 tRDPDEN : 5; // Bits 27:23
+ U32 : 1; // Bits 28:28
+ U32 CMD_3st : 1; // Bits 29:29
+ U32 CMD_stretch : 2; // Bits 31:30
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_TC_BANK_RANK_A_STRUCT;
+
+typedef union {
+ struct {
+ U32 tWRRD : 6; // Bits 5:0
+ U32 tWRRD_dr : 4; // Bits 9:6
+ U32 tWRRD_dd : 4; // Bits 13:10
+ U32 tWRWR : 3; // Bits 16:14
+ U32 tWRWR_dr : 4; // Bits 20:17
+ U32 tWRWR_dd : 4; // Bits 24:21
+ U32 tWRPDEN : 6; // Bits 30:25
+ U32 Dec_WRD : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_TC_BANK_RANK_B_STRUCT;
+
+typedef union {
+ struct {
+ U32 tXPDLL : 6; // Bits 5:0
+ U32 tXP : 4; // Bits 9:6
+ U32 TAONPD : 4; // Bits 13:10
+ U32 tRDWR : 5; // Bits 18:14
+ U32 tRDWR_dr : 5; // Bits 23:19
+ U32 tRDWR_dd : 5; // Bits 28:24
+ U32 : 3; // Bits 31:29
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_TC_BANK_RANK_C_STRUCT;
+
+typedef union {
+ struct {
+ U32 enable_cmd_rate_limit : 1; // Bits 0:0
+ U32 cmd_rate_limit : 3; // Bits 3:1
+ U32 reset_on_command : 4; // Bits 7:4
+ U32 reset_delay : 4; // Bits 11:8
+ U32 ck_to_cke_delay : 2; // Bits 13:12
+ U32 spare : 17; // Bits 30:14
+ U32 init_mrw_2n_cs : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_CMD_RATE_STRUCT;
+
+typedef union {
+ struct {
+ U32 tCL : 5; // Bits 4:0
+ U32 tWCL : 5; // Bits 9:5
+ U32 tCPDED : 2; // Bits 11:10
+ U32 tPRPDEN : 2; // Bits 13:12
+ U32 Odt_Read_Delay : 3; // Bits 16:14
+ U32 Odt_Read_Duration : 2; // Bits 18:17
+ U32 Odt_Write_Duration : 2; // Bits 20:19
+ U32 : 11; // Bits 31:21
+ } Bits;
+#ifdef ULT_FLAG
+ struct {
+ U32 tCL : 5; // Bits 4:0
+ U32 tWCL : 5; // Bits 9:5
+ U32 tCPDED : 2; // Bits 11:10
+ U32 tPRPDEN : 2; // Bits 13:12
+ U32 Odt_Read_Delay : 3; // Bits 16:14
+ U32 Odt_Read_Duration : 2; // Bits 18:17
+ U32 Odt_Write_Duration : 3; // Bits 21:19
+ U32 Odt_Write_Delay : 3; // Bits 24:22
+ U32 Odt_Always_Rank0 : 1; // Bits 25:25
+ U32 cmd_delay : 2; // Bits 27:26
+ U32 : 4; // Bits 31:28
+ } UltBits;
+#endif //ULT_FLAG
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_TC_BANK_RANK_D_STRUCT;
+
+typedef union {
+ struct {
+ U32 dis_opp_cas : 1; // Bits 0:0
+ U32 dis_opp_is_cas : 1; // Bits 1:1
+ U32 dis_opp_ras : 1; // Bits 2:2
+ U32 dis_opp_is_ras : 1; // Bits 3:3
+ U32 dis_1c_byp : 1; // Bits 4:4
+ U32 dis_2c_byp : 1; // Bits 5:5
+ U32 dis_deprd_opt : 1; // Bits 6:6
+ U32 dis_pt_it : 1; // Bits 7:7
+ U32 dis_prcnt_ring : 1; // Bits 8:8
+ U32 dis_prcnt_sa : 1; // Bits 9:9
+ U32 dis_blkr_ph : 1; // Bits 10:10
+ U32 dis_blkr_pe : 1; // Bits 11:11
+ U32 dis_blkr_pm : 1; // Bits 12:12
+ U32 dis_odt : 1; // Bits 13:13
+ U32 OE_alw_off : 1; // Bits 14:14
+ U32 : 1; // Bits 15:15
+ U32 dis_aom : 1; // Bits 16:16
+ U32 block_rpq : 1; // Bits 17:17
+ U32 block_wpq : 1; // Bits 18:18
+ U32 invert_align : 1; // Bits 19:19
+ U32 dis_write_gap : 1; // Bits 20:20
+ U32 dis_zq : 1; // Bits 21:21
+ U32 dis_tt : 1; // Bits 22:22
+ U32 dis_opp_ref : 1; // Bits 23:23
+ U32 Long_ZQ : 1; // Bits 24:24
+ U32 dis_srx_zq : 1; // Bits 25:25
+ U32 Serialize_ZQ : 1; // Bits 26:26
+ U32 ZQ_fast_exec : 1; // Bits 27:27
+ U32 Dis_DriveNop : 1; // Bits 28:28
+ U32 Pres_WDB_Ent : 1; // Bits 29:29
+ U32 dis_clk_gate : 1; // Bits 30:30
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_SCHED_CBIT_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lat_R0D0 : 6; // Bits 5:0
+ U32 : 2; // Bits 7:6
+ U32 Lat_R1D0 : 6; // Bits 13:8
+ U32 : 2; // Bits 15:14
+ U32 Lat_R0D1 : 6; // Bits 21:16
+ U32 : 2; // Bits 23:22
+ U32 Lat_R1D1 : 6; // Bits 29:24
+ U32 : 2; // Bits 31:30
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_SC_ROUNDT_LAT_STRUCT;
+
+typedef union {
+ struct {
+ U32 IOLAT_R0D0 : 4; // Bits 3:0
+ U32 IOLAT_R1D0 : 4; // Bits 7:4
+ U32 IOLAT_R0D1 : 4; // Bits 11:8
+ U32 IOLAT_R1D1 : 4; // Bits 15:12
+ U32 RT_IOCOMP : 6; // Bits 21:16
+ U32 : 8; // Bits 29:22
+ U32 three_channels : 1; // Bits 30:30
+ U32 DIS_RT_CLK_GATE : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_SC_IO_LATENCY_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATA : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_ROUND_TRIP_DFT_DATA_STRUCT;
+
+typedef union {
+ struct {
+ U32 WDAR : 1; // Bits 0:0
+ U32 safe_mask_sel : 3; // Bits 3:1
+ U32 force_rcv_en : 1; // Bits 4:4
+ U32 : 3; // Bits 7:5
+ U32 DDR_QUAL : 2; // Bits 9:8
+ U32 Qual_length : 2; // Bits 11:10
+ U32 WDB_Block_En : 1; // Bits 12:12
+ U32 RT_DFT_READ_PTR : 4; // Bits 16:13
+ U32 RT_DFT_READ_ENABLE : 1; // Bits 17:17
+ U32 RT_DFT_READ_SEL_ADDR : 1; // Bits 18:18
+ U32 : 13; // Bits 31:19
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_DFT_MISC_STRUCT;
+
+typedef union {
+ struct {
+ U32 ECC : 8; // Bits 7:0
+ U32 RRD_DFT_Mode : 2; // Bits 9:8
+ U32 LFSR_Seed_Index : 5; // Bits 14:10
+ U32 Inversion_Mode : 1; // Bits 15:15
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_READ_RETURN_DFT_STRUCT;
+
+typedef union {
+ struct {
+ U32 dis_imph_error : 1; // Bits 0:0
+ U32 : 7; // Bits 7:1
+ U32 dis_async_odt : 1; // Bits 8:8
+ U32 : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_SCHED_SECOND_CBIT_STRUCT;
+
+typedef union {
+ struct {
+ U32 Mux0_Control : 2; // Bits 1:0
+ U32 : 1; // Bits 2:2
+ U32 Mux1_Control : 2; // Bits 4:3
+ U32 : 1; // Bits 5:5
+ U32 Mux2_Control : 2; // Bits 7:6
+ U32 : 6; // Bits 13:8
+ U32 ECC_Replace_Byte_Control : 1; // Bits 14:14
+ U32 ECC_Data_Source_Sel : 1; // Bits 15:15
+ U32 Save_LFSR_Seed_Rate : 6; // Bits 21:16
+ U32 : 2; // Bits 23:22
+ U32 Reload_LFSR_Seed_Rate : 3; // Bits 26:24
+ U32 : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_STRUCT;
+
+typedef union {
+ struct {
+ U32 WDB_Current_Read_Pointer : 6; // Bits 5:0
+ U32 : 26; // Bits 31:6
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_RD_STATUS_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 24; // Bits 23:0
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 24; // Bits 23:0
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 24; // Bits 23:0
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 24; // Bits 23:0
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 24; // Bits 23:0
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 24; // Bits 23:0
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 24; // Bits 23:0
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 24; // Bits 23:0
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 24; // Bits 23:0
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 24; // Bits 23:0
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 24; // Bits 23:0
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 24; // Bits 23:0
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_2_STRUCT;
+
+typedef union {
+ struct {
+ U32 L_data_select : 1; // Bits 0:0
+ U32 Enable_Sweep_Frequency : 1; // Bits 1:1
+ U32 : 6; // Bits 7:2
+ U32 L_counter : 8; // Bits 15:8
+ U32 M_counter : 8; // Bits 23:16
+ U32 N_counter : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_STRUCT;
+
+typedef union {
+ struct {
+ U32 ECC_Inv_or_DC_Enable : 8; // Bits 7:0
+ U32 : 8; // Bits 15:8
+ U32 Inv_or_DC_Shift_Rate : 4; // Bits 19:16
+ U32 DC_Polarity_Control : 1; // Bits 20:20
+ U32 : 9; // Bits 29:21
+ U32 Inv_or_DC_Control : 1; // Bits 30:30
+ U32 Inv_or_DC_Shift_Enable : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_PAT_WDB_INV_STRUCT;
+
+typedef union {
+ struct {
+ U64 Data_Inv_or_DC_Enable : 64; // Bits 63:0
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} MCSCHEDS_CR_REUT_CH_PAT_WDB_DATA_INV_STRUCT;
+
+typedef union {
+ struct {
+ U32 Stop_on_Nth_Error : 6; // Bits 5:0
+ U32 : 6; // Bits 11:6
+ U32 Stop_On_Error_Control : 2; // Bits 13:12
+ U32 : 2; // Bits 15:14
+ U32 Selective_Error_Enable_Chunk : 8; // Bits 23:16
+ U32 Selective_Error_Enable_Cacheline : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_ERR_CTL_STRUCT;
+
+typedef union {
+ struct {
+ U32 ECC_Error_Mask : 8; // Bits 7:0
+ U32 : 24; // Bits 31:8
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_ERR_ECC_MASK_STRUCT;
+
+typedef union {
+ struct {
+ U32 Stretch_mode : 2; // Bits 1:0
+ U32 : 2; // Bits 3:2
+ U32 STF : 3; // Bits 6:4
+ U32 : 25; // Bits 31:7
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_STM_CONFIG_STRUCT;
+
+typedef union {
+ struct {
+ U32 Priority_count_ring : 10; // Bits 9:0
+ U32 : 6; // Bits 15:10
+ U32 Priority_count_SA : 10; // Bits 25:16
+ U32 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_SC_PR_CNT_CONFIG_STRUCT;
+
+typedef union {
+ struct {
+ U32 PCIT : 8; // Bits 7:0
+ U32 : 24; // Bits 31:8
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_SC_PCIT_STRUCT;
+
+typedef union {
+ struct {
+ U32 PDWN_idle_counter : 12; // Bits 11:0
+ U32 PDWN_mode : 4; // Bits 15:12
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_PM_PDWN_CONFIG_STRUCT;
+
+typedef union {
+ struct {
+ U32 Count : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_ECC_INJECT_COUNT_STRUCT;
+
+typedef union {
+ struct {
+ U32 ECC4ANA_fill : 8; // Bits 7:0
+ U32 ECC4ANA_trigger : 2; // Bits 9:8
+ U32 ECC4ANA_BS : 1; // Bits 10:10
+ U32 ECC_Inject : 3; // Bits 13:11
+ U32 ECC_correction_disable : 1; // Bits 14:14
+ U32 ECC4ANA_Inject : 1; // Bits 15:15
+ U32 DIS_MCA_LOG : 1; // Bits 16:16
+ U32 DIS_PCH_EVENT : 1; // Bits 17:17
+ U32 DIS_PCIE_POISON : 1; // Bits 18:18
+ U32 : 13; // Bits 31:19
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_ECC_DFT_STRUCT;
+
+typedef union {
+ struct {
+ U32 Data : 18; // Bits 17:0
+ U32 : 13; // Bits 30:18
+ U32 VORANGE : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_VISA_CTL_MCSCHEDS_STRUCT;
+
+typedef union {
+ struct {
+ U32 Data : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_VISA_XBAR_MCSCHEDS_STRUCT;
+
+typedef union {
+ struct {
+ U32 CERRSTS : 1; // Bits 0:0
+ U32 MERRSTS : 1; // Bits 1:1
+ U32 : 14; // Bits 15:2
+ U32 ERRSYND : 8; // Bits 23:16
+ U32 ERRCHUNK : 3; // Bits 26:24
+ U32 ERRRANK : 2; // Bits 28:27
+ U32 ERRBANK : 3; // Bits 31:29
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_ECCERRLOG0_STRUCT;
+
+typedef union {
+ struct {
+ U32 ERRROW : 16; // Bits 15:0
+ U32 ERRCOL : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_ECCERRLOG1_STRUCT;
+
+typedef union {
+ struct {
+ U32 D0R0 : 2; // Bits 1:0
+ U32 D0R1 : 2; // Bits 3:2
+ U32 D1R0 : 2; // Bits 5:4
+ U32 D1R1 : 2; // Bits 7:6
+ U32 : 24; // Bits 31:8
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_SC_WR_ADD_DELAY_STRUCT;
+
+typedef union {
+ struct {
+ U32 Dis_Opp_rd : 1; // Bits 0:0
+ U32 ACT_Enable : 1; // Bits 1:1
+ U32 PRE_Enable : 1; // Bits 2:2
+ U32 MAX_RPQ_Cas : 4; // Bits 6:3
+ U32 : 25; // Bits 31:7
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_WMM_READ_CONFIG_STRUCT;
+
+typedef union {
+ struct {
+ U64 Data_Error_Mask : 64; // Bits 63:0
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} MCSCHEDS_CR_REUT_CH_ERR_DATA_MASK_STRUCT;
+
+typedef union {
+ struct {
+ U64 Data_Error_Status : 64; // Bits 63:0
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} MCSCHEDS_CR_REUT_CH_ERR_DATA_STATUS_STRUCT;
+
+typedef union {
+ struct {
+ U32 ECC_Error_Status : 8; // Bits 7:0
+ U32 Chunk_Error_Status : 8; // Bits 15:8
+ U32 Rank_Error_Status : 4; // Bits 19:16
+ U32 : 12; // Bits 31:20
+ U32 Byte_Group_Error_Status : 9; // Bits 40:32
+ U32 : 11; // Bits 51:41
+ U32 WDB_Rd_Chunk_Num_Status : 3; // Bits 54:52
+ U32 : 1; // Bits 55:55
+ U32 Nth_Error : 6; // Bits 61:56
+ U32 : 2; // Bits 63:62
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} MCSCHEDS_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Pointer : 7; // Bits 6:0
+ U32 Counter_Control : 2; // Bits 8:7
+ U32 : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Pointer : 7; // Bits 6:0
+ U32 Counter_Control : 2; // Bits 8:7
+ U32 : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Pointer : 7; // Bits 6:0
+ U32 Counter_Control : 2; // Bits 8:7
+ U32 : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Pointer : 7; // Bits 6:0
+ U32 Counter_Control : 2; // Bits 8:7
+ U32 : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Pointer : 7; // Bits 6:0
+ U32 Counter_Control : 2; // Bits 8:7
+ U32 : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_4_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Pointer : 7; // Bits 6:0
+ U32 Counter_Control : 2; // Bits 8:7
+ U32 : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_5_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Pointer : 7; // Bits 6:0
+ U32 Counter_Control : 2; // Bits 8:7
+ U32 : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_6_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Pointer : 7; // Bits 6:0
+ U32 Counter_Control : 2; // Bits 8:7
+ U32 : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_7_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Pointer : 7; // Bits 6:0
+ U32 Counter_Control : 2; // Bits 8:7
+ U32 : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_8_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Status : 23; // Bits 22:0
+ U32 : 9; // Bits 31:23
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Status : 23; // Bits 22:0
+ U32 : 9; // Bits 31:23
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Status : 23; // Bits 22:0
+ U32 : 9; // Bits 31:23
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Status : 23; // Bits 22:0
+ U32 : 9; // Bits 31:23
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Status : 23; // Bits 22:0
+ U32 : 9; // Bits 31:23
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_4_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Status : 23; // Bits 22:0
+ U32 : 9; // Bits 31:23
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_5_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Status : 23; // Bits 22:0
+ U32 : 9; // Bits 31:23
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_6_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Status : 23; // Bits 22:0
+ U32 : 9; // Bits 31:23
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_7_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Status : 23; // Bits 22:0
+ U32 : 9; // Bits 31:23
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_8_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Overflow_Status : 9; // Bits 8:0
+ U32 : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_ERR_COUNTER_OVERFLOW_STATUS_STRUCT;
+
+typedef union {
+ struct {
+ U32 Column_Address : 10; // Bits 9:0
+ U32 : 14; // Bits 23:10
+ U32 Row_Address : 16; // Bits 39:24
+ U32 : 8; // Bits 47:40
+ U32 Bank_Address : 3; // Bits 50:48
+ U32 : 5; // Bits 55:51
+ U32 Rank_Address : 2; // Bits 57:56
+ U32 : 6; // Bits 63:58
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} MCSCHEDS_CR_REUT_CH_ERROR_ADDR_STRUCT;
+
+typedef union {
+ struct {
+ U32 WDB_Current_Error_Pointer : 6; // Bits 5:0
+ U32 : 26; // Bits 31:6
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_ERR_WDB_CAPTURE_STATUS_STRUCT;
+
+typedef union {
+ struct {
+ U32 Enable_WDB_Error_Capture : 1; // Bits 0:0
+ U32 : 7; // Bits 7:1
+ U32 WDB_Starting_Error_Pointer : 6; // Bits 13:8
+ U32 : 2; // Bits 15:14
+ U32 WDB_Ending_Error_Pointer : 6; // Bits 21:16
+ U32 : 10; // Bits 31:22
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_STRUCT;
+
+typedef union {
+ struct {
+ U32 CKE_Override : 4; // Bits 3:0
+ U32 : 4; // Bits 7:4
+ U32 CKE_En_Start_Test_Sync : 1; // Bits 8:8
+ U32 : 7; // Bits 15:9
+ U32 CKE_On : 4; // Bits 19:16
+ U32 : 12; // Bits 31:20
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_MISC_CKE_CTRL_STRUCT;
+
+typedef union {
+ struct {
+ U32 ODT_Override : 4; // Bits 3:0
+ U32 : 12; // Bits 15:4
+ U32 ODT_On : 4; // Bits 19:16
+ U32 : 11; // Bits 30:20
+ U32 MPR_Train_DDR_On : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_MISC_ODT_CTRL_STRUCT;
+
+typedef union {
+ struct {
+ U32 Enable_CADB_on_Deselect : 1; // Bits 0:0
+ U32 Enable_CADB_Always_On : 1; // Bits 1:1
+ U32 CMD_Deselect_Start : 4; // Bits 5:2
+ U32 CMD_Deselect_Stop : 4; // Bits 9:6
+ U32 Lane_Deselect_Enable : 4; // Bits 13:10
+ U32 CAS_Select_Enable : 2; // Bits 15:14
+ U32 ACT_Select_Enable : 2; // Bits 17:16
+ U32 PRE_Select_Enable : 2; // Bits 19:18
+ U32 Save_Current_Seed : 4; // Bits 23:20
+ U32 Reload_Starting_Seed : 4; // Bits 27:24
+ U32 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_STRUCT;
+
+typedef union {
+ struct {
+ U32 MRS_Gap : 3; // Bits 2:0
+ U32 : 5; // Bits 7:3
+ U32 CADB_MRS_Start_Pointer : 3; // Bits 10:8
+ U32 : 5; // Bits 15:11
+ U32 CADB_MRS_End_Pointer : 3; // Bits 18:16
+ U32 : 5; // Bits 23:19
+ U32 CADB_MRS_Current_Pointer : 3; // Bits 26:24
+ U32 : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_PAT_CADB_MRS_STRUCT;
+
+typedef union {
+ struct {
+ U32 Mux0_Control : 2; // Bits 1:0
+ U32 : 2; // Bits 3:2
+ U32 Mux1_Control : 2; // Bits 5:4
+ U32 : 2; // Bits 7:6
+ U32 Mux2_Control : 2; // Bits 9:8
+ U32 : 6; // Bits 15:10
+ U32 Select_Mux0_Control : 2; // Bits 17:16
+ U32 : 2; // Bits 19:18
+ U32 Select_Mux1_Control : 2; // Bits 21:20
+ U32 : 2; // Bits 23:22
+ U32 Select_Mux2_Control : 2; // Bits 25:24
+ U32 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_CTRL_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 16; // Bits 15:0
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_PB_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 16; // Bits 15:0
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_PB_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 16; // Bits 15:0
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_PB_2_STRUCT;
+
+typedef union {
+ struct {
+ U32 L_data_select : 1; // Bits 0:0
+ U32 Enable_Sweep_Frequency : 1; // Bits 1:1
+ U32 : 6; // Bits 7:2
+ U32 L_counter : 8; // Bits 15:8
+ U32 M_counter : 8; // Bits 23:16
+ U32 N_counter : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_STRUCT;
+
+typedef union {
+ struct {
+ U32 CADB_Write_Pointer : 3; // Bits 2:0
+ U32 : 29; // Bits 31:3
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_PAT_CADB_WRITE_POINTER_STRUCT;
+
+typedef union {
+ struct {
+ U32 CADB_Data_Address : 16; // Bits 15:0
+ U32 : 8; // Bits 23:16
+ U32 CADB_Data_Bank : 3; // Bits 26:24
+ U32 : 5; // Bits 31:27
+ U32 CADB_Data_CS : 4; // Bits 35:32
+ U32 : 4; // Bits 39:36
+ U32 CADB_Data_Control : 3; // Bits 42:40
+ U32 : 5; // Bits 47:43
+ U32 CADB_Data_ODT : 4; // Bits 51:48
+ U32 : 4; // Bits 55:52
+ U32 CADB_Data_CKE : 4; // Bits 59:56
+ U32 : 4; // Bits 63:60
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} MCSCHEDS_CR_REUT_CH_PAT_CADB_PROG_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 16; // Bits 15:0
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 16; // Bits 15:0
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 16; // Bits 15:0
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCSCHEDS_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_2_STRUCT;
+
+typedef union {
+ struct {
+ U32 WDB_Increment_Rate : 5; // Bits 4:0
+ U32 WDB_Increment_Scale : 1; // Bits 5:5
+ U32 : 2; // Bits 7:6
+ U32 WDB_Start_Pointer : 6; // Bits 13:8
+ U32 : 2; // Bits 15:14
+ U32 WDB_End_Pointer : 6; // Bits 21:16
+ U32 : 10; // Bits 31:22
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_REUT_CH_PAT_WDB_CL_CTRL_STRUCT;
+
+typedef union {
+ struct {
+ U32 Refresh_Rank_Mask : 4; // Bits 3:0
+ U32 : 4; // Bits 7:4
+ U32 RefZQ_En_Start_Test_Sync : 1; // Bits 8:8
+ U32 : 22; // Bits 30:9
+ U32 Panic_Refresh_Only : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_REUT_CH_MISC_REFRESH_CTRL_STRUCT;
+
+typedef union {
+ struct {
+ U32 ZQ_Rank_Mask : 4; // Bits 3:0
+ U32 : 27; // Bits 30:4
+ U32 Always_Do_ZQ : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_REUT_CH_MISC_ZQ_CTRL_STRUCT;
+
+#ifdef ULT_FLAG
+typedef union {
+ struct {
+ U32 Rank_0_x32 : 1; // Bits 0:0
+ U32 Rank_1_x32 : 1; // Bits 1:1
+ U32 Rank_2_x32 : 1; // Bits 2:2
+ U32 Rank_3_x32 : 1; // Bits 3:3
+ U32 LPDDR2 : 1; // Bits 4:4
+ U32 : 3; // Bits 7:5
+ U32 MR4_PERIOD : 16; // Bits 23:8
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_LPDDR_MR_PARAMS_STRUCT;
+
+typedef union {
+ struct {
+ U32 Address : 8; // Bits 7:0
+ U32 Data : 8; // Bits 15:8
+ U32 Rank : 2; // Bits 17:16
+ U32 Write : 1; // Bits 18:18
+ U32 Init_MRW : 1; // Bits 19:19
+ U32 : 11; // Bits 30:20
+ U32 Busy : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_LPDDR_MR_COMMAND_STRUCT;
+
+typedef union {
+ struct {
+ U32 Device_0 : 8; // Bits 7:0
+ U32 Device_1 : 8; // Bits 15:8
+ U32 Device_2 : 8; // Bits 23:16
+ U32 Device_3 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_LPDDR_MR_RESULT_STRUCT;
+
+typedef union {
+ struct {
+ U32 Rank_0 : 3; // Bits 2:0
+ U32 : 5; // Bits 7:3
+ U32 Rank_1 : 3; // Bits 10:8
+ U32 : 5; // Bits 15:11
+ U32 Rank_2 : 3; // Bits 18:16
+ U32 : 5; // Bits 23:19
+ U32 Rank_3 : 3; // Bits 26:24
+ U32 : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_LPDDR_MR4_RANK_TEMPERATURE_STRUCT;
+
+typedef union {
+ struct {
+ U32 Bit_0 : 3; // Bits 2:0
+ U32 : 1; // Bits 3:3
+ U32 Bit_1 : 3; // Bits 6:4
+ U32 : 1; // Bits 7:7
+ U32 Bit_2 : 3; // Bits 10:8
+ U32 : 1; // Bits 11:11
+ U32 Bit_16 : 3; // Bits 14:12
+ U32 : 1; // Bits 15:15
+ U32 Bit_17 : 3; // Bits 18:16
+ U32 : 1; // Bits 19:19
+ U32 Bit_18 : 3; // Bits 22:20
+ U32 : 1; // Bits 23:23
+ U32 Byte_0 : 3; // Bits 26:24
+ U32 : 1; // Bits 27:27
+ U32 Byte_2 : 3; // Bits 30:28
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_DESWIZZLE_LOW_STRUCT;
+
+typedef union {
+ struct {
+ U32 Bit_32 : 3; // Bits 2:0
+ U32 : 1; // Bits 3:3
+ U32 Bit_33 : 3; // Bits 6:4
+ U32 : 1; // Bits 7:7
+ U32 Bit_34 : 3; // Bits 10:8
+ U32 : 1; // Bits 11:11
+ U32 Bit_48 : 3; // Bits 14:12
+ U32 : 1; // Bits 15:15
+ U32 Bit_49 : 3; // Bits 18:16
+ U32 : 1; // Bits 19:19
+ U32 Bit_50 : 3; // Bits 22:20
+ U32 : 1; // Bits 23:23
+ U32 Byte_4 : 3; // Bits 26:24
+ U32 : 1; // Bits 27:27
+ U32 Byte_6 : 3; // Bits 30:28
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_DESWIZZLE_HIGH_STRUCT;
+#endif // ULT_FLAG
+
+typedef union {
+ struct {
+ U32 Ref_Interval : 11; // Bits 10:0
+ U32 Ref_Stagger_En : 1; // Bits 11:11
+ U32 Ref_Stagger_Mode : 1; // Bits 12:12
+ U32 Disable_Stolen_Refresh : 1; // Bits 13:13
+ U32 En_Ref_Type_Display : 1; // Bits 14:14
+ U32 : 17; // Bits 31:15
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_MC_REFRESH_STAGGER_STRUCT;
+
+typedef union {
+ struct {
+ U32 ZQCS_period : 8; // Bits 7:0
+ U32 tZQCS : 8; // Bits 15:8
+ U32 : 16; // Bits 31:16
+ } Bits;
+#ifdef ULT_FLAG
+ struct {
+ U32 ZQCS_period : 10; // Bits 9:0
+ U32 tZQCS : 10; // Bits 19:10
+ U32 : 12; // Bits 31:20
+ } UltBits;
+#endif // ULT_FLAG
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_TC_ZQCAL_STRUCT;
+
+typedef union {
+ struct {
+ U32 OREF_RI : 8; // Bits 7:0
+ U32 Refresh_HP_WM : 4; // Bits 11:8
+ U32 Refresh_panic_wm : 4; // Bits 15:12
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_TC_RFP_STRUCT;
+
+typedef union {
+ struct {
+ U32 tREFI : 16; // Bits 15:0
+ U32 tRFC : 9; // Bits 24:16
+ U32 tREFIx9 : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_TC_RFTP_STRUCT;
+
+typedef union {
+ struct {
+ U32 MR2_sh_low : 6; // Bits 5:0
+ U32 SRT_avail : 2; // Bits 7:6
+ U32 MR2_sh_high : 3; // Bits 10:8
+ U32 : 3; // Bits 13:11
+ U32 Addr_bit_swizzle : 2; // Bits 15:14
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_TC_MR2_SHADDOW_STRUCT;
+
+typedef union {
+ struct {
+ U32 Rank_occupancy : 4; // Bits 3:0
+ U32 : 28; // Bits 31:4
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_MC_INIT_STATE_STRUCT;
+
+typedef union {
+ struct {
+ U32 tXSDLL : 12; // Bits 11:0
+ U32 tXS_offset : 4; // Bits 15:12
+ U32 tZQOPER : 10; // Bits 25:16
+ U32 : 2; // Bits 27:26
+ U32 tMOD : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_TC_SRFTP_STRUCT;
+
+typedef union {
+ struct {
+ U32 VISAByteSel : 3; // Bits 2:0
+ U32 : 29; // Bits 31:3
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_WDB_VISA_SEL_STRUCT;
+
+typedef union {
+ struct {
+ U32 FASTADDR : 12; // Bits 11:0
+ U32 : 4; // Bits 15:12
+ U32 ADDREN : 1; // Bits 16:16
+ U32 SEQEN : 1; // Bits 17:17
+ U32 POL0 : 1; // Bits 18:18
+ U32 POL1 : 1; // Bits 19:19
+ U32 CMDA : 4; // Bits 23:20
+ U32 CMDB : 4; // Bits 27:24
+ U32 CMDC : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_DCLK_LDAT_PDAT_STRUCT;
+
+typedef union {
+ struct {
+ U32 BANKSEL : 4; // Bits 3:0
+ U32 : 1; // Bits 4:4
+ U32 ARRAYSEL : 5; // Bits 9:5
+ U32 CMP : 1; // Bits 10:10
+ U32 REP : 1; // Bits 11:11
+ U32 DWORD : 4; // Bits 15:12
+ U32 MODE : 2; // Bits 17:16
+ U32 MPMAP : 6; // Bits 23:18
+ U32 MPBOFFSET : 4; // Bits 27:24
+ U32 STAGE_EN : 1; // Bits 28:28
+ U32 SHADOW : 2; // Bits 30:29
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_DCLK_LDAT_SDAT_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATOUT : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_DCLK_LDAT_DATAOUT_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATIN : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_DCLK_LDAT_DATAIN_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 FASTADDR : 12; // Bits 11:0
+ U32 : 4; // Bits 15:12
+ U32 ADDREN : 1; // Bits 16:16
+ U32 SEQEN : 1; // Bits 17:17
+ U32 POL0 : 1; // Bits 18:18
+ U32 POL1 : 1; // Bits 19:19
+ U32 CMDA : 4; // Bits 23:20
+ U32 CMDB : 4; // Bits 27:24
+ U32 CMDC : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_QCLK_LDAT_PDAT_STRUCT;
+
+typedef union {
+ struct {
+ U32 BANKSEL : 4; // Bits 3:0
+ U32 : 1; // Bits 4:4
+ U32 ARRAYSEL : 5; // Bits 9:5
+ U32 CMP : 1; // Bits 10:10
+ U32 REP : 1; // Bits 11:11
+ U32 DWORD : 4; // Bits 15:12
+ U32 MODE : 2; // Bits 17:16
+ U32 MPMAP : 6; // Bits 23:18
+ U32 MPBOFFSET : 4; // Bits 27:24
+ U32 STAGE_EN : 1; // Bits 28:28
+ U32 SHADOW : 2; // Bits 30:29
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_QCLK_LDAT_SDAT_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATOUT : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_QCLK_LDAT_DATAOUT_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATIN : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_QCLK_LDAT_DATAIN_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATIN : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_QCLK_LDAT_DATAIN_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RPQ_disable : 28; // Bits 27:0
+ U32 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_QUEUE_ENTRY_DISABLE_RPQ_STRUCT;
+
+typedef union {
+ struct {
+ U32 WPQ_disable : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_QUEUE_ENTRY_DISABLE_WPQ_STRUCT;
+
+typedef union {
+ struct {
+ U32 DIMM0_IDLE_ENERGY : 6; // Bits 5:0
+ U32 : 2; // Bits 7:6
+ U32 DIMM1_IDLE_ENERGY : 6; // Bits 13:8
+ U32 : 18; // Bits 31:14
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_PM_DIMM_IDLE_ENERGY_STRUCT;
+
+typedef union {
+ struct {
+ U32 DIMM0_PD_ENERGY : 6; // Bits 5:0
+ U32 : 2; // Bits 7:6
+ U32 DIMM1_PD_ENERGY : 6; // Bits 13:8
+ U32 : 18; // Bits 31:14
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_PM_DIMM_PD_ENERGY_STRUCT;
+
+typedef union {
+ struct {
+ U32 DIMM0_ACT_ENERGY : 8; // Bits 7:0
+ U32 DIMM1_ACT_ENERGY : 8; // Bits 15:8
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_PM_DIMM_ACT_ENERGY_STRUCT;
+
+typedef union {
+ struct {
+ U32 DIMM0_RD_ENERGY : 8; // Bits 7:0
+ U32 DIMM1_RD_ENERGY : 8; // Bits 15:8
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_PM_DIMM_RD_ENERGY_STRUCT;
+
+typedef union {
+ struct {
+ U32 DIMM0_WR_ENERGY : 8; // Bits 7:0
+ U32 DIMM1_WR_ENERGY : 8; // Bits 15:8
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_PM_DIMM_WR_ENERGY_STRUCT;
+
+typedef union {
+ struct {
+ U32 CKE_MIN : 8; // Bits 7:0
+ U32 CKE_MIN_DEFEATURE : 1; // Bits 8:8
+ U32 : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_PM_THRT_CKE_MIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 ODT : 4; // Bits 3:0
+ U32 Web : 1; // Bits 4:4
+ U32 CASb : 1; // Bits 5:5
+ U32 RASb : 1; // Bits 6:6
+ U32 CSb : 4; // Bits 10:7
+ U32 CKE : 4; // Bits 14:11
+ U32 MA : 16; // Bits 30:15
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_ODLAT_CMD_MATCH0_STRUCT;
+
+typedef union {
+ struct {
+ U32 ODT : 4; // Bits 3:0
+ U32 Web : 1; // Bits 4:4
+ U32 CASb : 1; // Bits 5:5
+ U32 RASb : 1; // Bits 6:6
+ U32 CSb : 4; // Bits 10:7
+ U32 CKE : 4; // Bits 14:11
+ U32 MA : 16; // Bits 30:15
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_ODLAT_CMD_MATCH1_STRUCT;
+
+typedef union {
+ struct {
+ U32 ODT : 4; // Bits 3:0
+ U32 Web : 1; // Bits 4:4
+ U32 CASb : 1; // Bits 5:5
+ U32 RASb : 1; // Bits 6:6
+ U32 CSb : 4; // Bits 10:7
+ U32 CKE : 4; // Bits 14:11
+ U32 MA : 16; // Bits 30:15
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_ODLAT_CMD_MATCH2_STRUCT;
+
+typedef union {
+ struct {
+ U32 ODT : 4; // Bits 3:0
+ U32 Web : 1; // Bits 4:4
+ U32 CASb : 1; // Bits 5:5
+ U32 RASb : 1; // Bits 6:6
+ U32 CSb : 4; // Bits 10:7
+ U32 CKE : 4; // Bits 14:11
+ U32 MA : 16; // Bits 30:15
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_ODLAT_CMD_MATCH3_STRUCT;
+
+typedef union {
+ struct {
+ U32 ODT : 4; // Bits 3:0
+ U32 Web : 1; // Bits 4:4
+ U32 CASb : 1; // Bits 5:5
+ U32 RASb : 1; // Bits 6:6
+ U32 CSb : 4; // Bits 10:7
+ U32 CKE : 4; // Bits 14:11
+ U32 MA : 16; // Bits 30:15
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_ODLAT_CMD_MASK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 ODT : 4; // Bits 3:0
+ U32 Web : 1; // Bits 4:4
+ U32 CASb : 1; // Bits 5:5
+ U32 RASb : 1; // Bits 6:6
+ U32 CSb : 4; // Bits 10:7
+ U32 CKE : 4; // Bits 14:11
+ U32 MA : 16; // Bits 30:15
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_ODLAT_CMD_MASK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 ODT : 4; // Bits 3:0
+ U32 Web : 1; // Bits 4:4
+ U32 CASb : 1; // Bits 5:5
+ U32 RASb : 1; // Bits 6:6
+ U32 CSb : 4; // Bits 10:7
+ U32 CKE : 4; // Bits 14:11
+ U32 MA : 16; // Bits 30:15
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_ODLAT_CMD_MASK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 ODT : 4; // Bits 3:0
+ U32 Web : 1; // Bits 4:4
+ U32 CASb : 1; // Bits 5:5
+ U32 RASb : 1; // Bits 6:6
+ U32 CSb : 4; // Bits 10:7
+ U32 CKE : 4; // Bits 14:11
+ U32 MA : 16; // Bits 30:15
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_ODLAT_CMD_MASK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 BankMatch0 : 3; // Bits 2:0
+ U32 BankMatch1 : 3; // Bits 5:3
+ U32 BankMatch2 : 3; // Bits 8:6
+ U32 BankMatch3 : 3; // Bits 11:9
+ U32 BankMask0 : 3; // Bits 14:12
+ U32 BankMask1 : 3; // Bits 17:15
+ U32 BankMask2 : 3; // Bits 20:18
+ U32 BankMask3 : 3; // Bits 23:21
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_ODLAT_CMD_BANK_STRUCT;
+
+typedef union {
+ struct {
+ U32 InputMatch : 4; // Bits 3:0
+ U32 InputInvert : 4; // Bits 7:4
+ U32 CountMatches : 1; // Bits 8:8
+ U32 CounterThreshold : 15; // Bits 23:9
+ U32 CounterAction : 2; // Bits 25:24
+ U32 CounterNextState : 2; // Bits 27:26
+ U32 MatchAction : 2; // Bits 29:28
+ U32 MatchNextState : 2; // Bits 31:30
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_ODLAT_SEQ_LEVEL0_STRUCT;
+
+typedef union {
+ struct {
+ U32 InputMatch : 4; // Bits 3:0
+ U32 InputInvert : 4; // Bits 7:4
+ U32 CountMatches : 1; // Bits 8:8
+ U32 CounterThreshold : 15; // Bits 23:9
+ U32 CounterAction : 2; // Bits 25:24
+ U32 CounterNextState : 2; // Bits 27:26
+ U32 MatchAction : 2; // Bits 29:28
+ U32 MatchNextState : 2; // Bits 31:30
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_ODLAT_SEQ_LEVEL1_STRUCT;
+
+typedef union {
+ struct {
+ U32 InputMatch : 4; // Bits 3:0
+ U32 InputInvert : 4; // Bits 7:4
+ U32 CountMatches : 1; // Bits 8:8
+ U32 CounterThreshold : 15; // Bits 23:9
+ U32 CounterAction : 2; // Bits 25:24
+ U32 CounterNextState : 2; // Bits 27:26
+ U32 MatchAction : 2; // Bits 29:28
+ U32 MatchNextState : 2; // Bits 31:30
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_ODLAT_SEQ_LEVEL2_STRUCT;
+
+typedef union {
+ struct {
+ U32 InputMatch : 4; // Bits 3:0
+ U32 InputInvert : 4; // Bits 7:4
+ U32 CountMatches : 1; // Bits 8:8
+ U32 CounterThreshold : 15; // Bits 23:9
+ U32 CounterAction : 2; // Bits 25:24
+ U32 CounterNextState : 2; // Bits 27:26
+ U32 MatchAction : 2; // Bits 29:28
+ U32 MatchNextState : 2; // Bits 31:30
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_ODLAT_SEQ_LEVEL3_STRUCT;
+
+typedef union {
+ struct {
+ U32 TriggerBlockEnable : 1; // Bits 0:0
+ U32 GlobalCounterThreshold : 16; // Bits 16:1
+ U32 : 15; // Bits 31:17
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_ODLAT_SEQ_GLOBAL_STRUCT;
+
+typedef union {
+ struct {
+ U32 WMM_Enter : 8; // Bits 7:0
+ U32 WMM_Exit : 8; // Bits 15:8
+ U32 WPQ_IS : 8; // Bits 23:16
+ U32 Starve_count : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_SC_WDBWM_STRUCT;
+
+typedef union {
+ struct {
+ U32 Data : 18; // Bits 17:0
+ U32 : 13; // Bits 30:18
+ U32 VORANGE : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCMNTS_CR_VISA_CTL_MCMNTS_STRUCT;
+
+typedef union {
+ struct {
+ U32 CH_A : 2; // Bits 1:0
+ U32 CH_B : 2; // Bits 3:2
+ U32 CH_C : 2; // Bits 5:4
+ U32 STKD_MODE : 1; // Bits 6:6
+ U32 STKD_MODE_CH_BITS : 3; // Bits 9:7
+ U32 LPDDR : 1; // Bits 10:10
+ U32 : 21; // Bits 31:11
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDECS_CR_MAD_CHNL_MCMAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 DIMM_A_Size : 8; // Bits 7:0
+ U32 DIMM_B_Size : 8; // Bits 15:8
+ U32 DAS : 1; // Bits 16:16
+ U32 DANOR : 1; // Bits 17:17
+ U32 DBNOR : 1; // Bits 18:18
+ U32 DAW : 1; // Bits 19:19
+ U32 DBW : 1; // Bits 20:20
+ U32 RI : 1; // Bits 21:21
+ U32 Enh_Interleave : 1; // Bits 22:22
+ U32 : 1; // Bits 23:23
+ U32 ECC : 2; // Bits 25:24
+ U32 HORI : 1; // Bits 26:26
+ U32 HORIAddr : 3; // Bits 29:27
+ U32 : 2; // Bits 31:30
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDECS_CR_MAD_DIMM_CH0_MCMAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 DIMM_A_Size : 8; // Bits 7:0
+ U32 DIMM_B_Size : 8; // Bits 15:8
+ U32 DAS : 1; // Bits 16:16
+ U32 DANOR : 1; // Bits 17:17
+ U32 DBNOR : 1; // Bits 18:18
+ U32 DAW : 1; // Bits 19:19
+ U32 DBW : 1; // Bits 20:20
+ U32 RI : 1; // Bits 21:21
+ U32 Enh_Interleave : 1; // Bits 22:22
+ U32 : 1; // Bits 23:23
+ U32 ECC : 2; // Bits 25:24
+ U32 HORI : 1; // Bits 26:26
+ U32 HORIAddr : 3; // Bits 29:27
+ U32 : 2; // Bits 31:30
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDECS_CR_MAD_DIMM_CH1_MCMAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 DIMM_A_Size : 8; // Bits 7:0
+ U32 DIMM_B_Size : 8; // Bits 15:8
+ U32 DAS : 1; // Bits 16:16
+ U32 DANOR : 1; // Bits 17:17
+ U32 DBNOR : 1; // Bits 18:18
+ U32 DAW : 1; // Bits 19:19
+ U32 DBW : 1; // Bits 20:20
+ U32 RI : 1; // Bits 21:21
+ U32 Enh_Interleave : 1; // Bits 22:22
+ U32 : 1; // Bits 23:23
+ U32 ECC : 2; // Bits 25:24
+ U32 HORI : 1; // Bits 26:26
+ U32 HORIAddr : 3; // Bits 29:27
+ U32 : 2; // Bits 31:30
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDECS_CR_MAD_DIMM_CH2_MCMAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 OneC : 8; // Bits 7:0
+ U32 ThreeC : 8; // Bits 15:8
+ U32 TwoBandC : 8; // Bits 23:16
+ U32 BandC : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDECS_CR_MAD_ZR_MCMAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 spare : 23; // Bits 22:0
+ U32 ovrd_pcu_sr_exit : 1; // Bits 23:23
+ U32 isoch_stall_pattern : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDECS_CR_MCDECS_MISC_MCMAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 increase_rcomp : 1; // Bits 0:0
+ U32 noa_on_ecc : 1; // Bits 1:1
+ U32 noa_demux : 1; // Bits 2:2
+ U32 noa_countctrl : 1; // Bits 3:3
+ U32 : 4; // Bits 7:4
+ U32 psmi_freeze_pwm_counters : 1; // Bits 8:8
+ U32 : 6; // Bits 14:9
+ U32 dis_lp_prefetch : 1; // Bits 15:15
+ U32 : 13; // Bits 28:16
+ U32 dis_reg_clk_gate : 1; // Bits 29:29
+ U32 dis_msg_clk_gate : 1; // Bits 30:30
+ U32 dis_clk_gate : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDECS_CR_MCDECS_CBIT_MCMAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 count : 4; // Bits 3:0
+ U32 : 28; // Bits 31:4
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDECS_CR_SC_IS_CREDIT_MCMAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 Mask : 14; // Bits 13:0
+ U32 : 7; // Bits 20:14
+ U32 LSB_mask_bit : 2; // Bits 22:21
+ U32 Enable : 1; // Bits 23:23
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDECS_CR_CHANNEL_HASH_MCMAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 pu_mrc_done : 1; // Bits 0:0
+ U32 ddr_reset : 1; // Bits 1:1
+ U32 : 1; // Bits 2:2
+ U32 refresh_enable : 1; // Bits 3:3
+ U32 : 1; // Bits 4:4
+ U32 mc_init_done_ack : 1; // Bits 5:5
+ U32 : 1; // Bits 6:6
+ U32 mrc_done : 1; // Bits 7:7
+ U32 safe_sr : 1; // Bits 8:8
+ U32 : 1; // Bits 9:9
+ U32 HVM_Gate_DDR_Reset : 1; // Bits 10:10
+ U32 : 11; // Bits 21:11
+ U32 dclk_enable : 1; // Bits 22:22
+ U32 reset_io : 1; // Bits 23:23
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDECS_CR_MC_INIT_STATE_G_MCMAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 REVISION : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDECS_CR_MRC_REVISION_MCMAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 count : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDECS_CR_PWM_GT_REQCOUNT_MCMAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 count : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDECS_CR_PWM_IA_REQCOUNT_MCMAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 count : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDECS_CR_PWM_IO_REQCOUNT_MCMAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 count : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDECS_CR_PWM_RDDATA_COUNT_MCMAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 count : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDECS_CR_PWM_WRDATA_COUNT_MCMAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 count : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDECS_CR_PWM_COMMAND_COUNT_MCMAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 Idle_timer : 16; // Bits 15:0
+ U32 SR_Enable : 1; // Bits 16:16
+ U32 : 15; // Bits 31:17
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDECS_CR_PM_SREF_CONFIG_MCMAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 Ch_dir : 4; // Bits 3:0
+ U32 : 4; // Bits 7:4
+ U32 MCI_clk_div : 10; // Bits 17:8
+ U32 : 14; // Bits 31:18
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDECS_CR_MCI_CONFIG_MCMAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 stall_until_drain : 1; // Bits 0:0
+ U32 stall_input : 1; // Bits 1:1
+ U32 : 2; // Bits 3:2
+ U32 mc_drained : 1; // Bits 4:4
+ U32 : 3; // Bits 7:5
+ U32 sr_state : 2; // Bits 9:8
+ U32 : 22; // Bits 31:10
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDECS_CR_STALL_DRAIN_MCMAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 RPQ_count : 5; // Bits 4:0
+ U32 : 3; // Bits 7:5
+ U32 WPQ_count : 7; // Bits 14:8
+ U32 : 17; // Bits 31:15
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDECS_CR_QUEUE_CREDIT_C_MCMAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 count : 16; // Bits 15:0
+ U32 First_Rcomp_done : 1; // Bits 16:16
+ U32 : 15; // Bits 31:17
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDECS_CR_RCOMP_TIMER_MCMAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 Address : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDECS_CR_ECC_INJ_ADDR_COMPARE_MCMAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 Mask : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDECS_CR_ECC_INJ_ADDR_MASK_MCMAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 Data : 18; // Bits 17:0
+ U32 : 13; // Bits 30:18
+ U32 VORANGE : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDECS_CR_VISA_CTL_MCDECS_MCMAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 Data : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDECS_CR_VISA_XBAR_MCDECS_MCMAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 lock_addr_map : 1; // Bits 0:0
+ U32 lock_mc_config : 1; // Bits 1:1
+ U32 lock_iosav_init : 1; // Bits 2:2
+ U32 lock_pwr_mngment : 1; // Bits 3:3
+ U32 : 3; // Bits 6:4
+ U32 lock_mc_dft : 1; // Bits 7:7
+ U32 : 24; // Bits 31:8
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCDECS_CR_MC_LOCK_MCMAIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 tRCD : 5; // Bits 4:0
+ U32 tRP : 5; // Bits 9:5
+ U32 tRAS : 6; // Bits 15:10
+ U32 tRDPRE : 4; // Bits 19:16
+ U32 tWRPRE : 6; // Bits 25:20
+ U32 tRRD : 4; // Bits 29:26
+ U32 tRPab_ext : 2; // Bits 31:30
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_TC_BANK_STRUCT;
+
+typedef union {
+ struct {
+ U32 tCKE : 4; // Bits 3:0
+ U32 tFAW : 8; // Bits 11:4
+ U32 tRDRD : 3; // Bits 14:12
+ U32 tRDRD_dr : 4; // Bits 18:15
+ U32 tRDRD_dd : 4; // Bits 22:19
+ U32 tRDPDEN : 5; // Bits 27:23
+ U32 : 1; // Bits 28:28
+ U32 CMD_3st : 1; // Bits 29:29
+ U32 CMD_stretch : 2; // Bits 31:30
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_TC_BANK_RANK_A_STRUCT;
+
+typedef union {
+ struct {
+ U32 tWRRD : 6; // Bits 5:0
+ U32 tWRRD_dr : 4; // Bits 9:6
+ U32 tWRRD_dd : 4; // Bits 13:10
+ U32 tWRWR : 3; // Bits 16:14
+ U32 tWRWR_dr : 4; // Bits 20:17
+ U32 tWRWR_dd : 4; // Bits 24:21
+ U32 tWRPDEN : 6; // Bits 30:25
+ U32 Dec_WRD : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_TC_BANK_RANK_B_STRUCT;
+
+typedef union {
+ struct {
+ U32 tXPDLL : 6; // Bits 5:0
+ U32 tXP : 4; // Bits 9:6
+ U32 TAONPD : 4; // Bits 13:10
+ U32 tRDWR : 5; // Bits 18:14
+ U32 tRDWR_dr : 5; // Bits 23:19
+ U32 tRDWR_dd : 5; // Bits 28:24
+ U32 : 3; // Bits 31:29
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_TC_BANK_RANK_C_STRUCT;
+
+typedef union {
+ struct {
+ U32 enable_cmd_rate_limit : 1; // Bits 0:0
+ U32 cmd_rate_limit : 3; // Bits 3:1
+ U32 reset_on_command : 4; // Bits 7:4
+ U32 reset_delay : 4; // Bits 11:8
+ U32 ck_to_cke_delay : 2; // Bits 13:12
+ U32 spare : 17; // Bits 30:14
+ U32 init_mrw_2n_cs : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_CMD_RATE_STRUCT;
+
+typedef union {
+ struct {
+ U32 tCL : 5; // Bits 4:0
+ U32 tWCL : 5; // Bits 9:5
+ U32 tCPDED : 2; // Bits 11:10
+ U32 tPRPDEN : 2; // Bits 13:12
+ U32 Odt_Read_Delay : 3; // Bits 16:14
+ U32 Odt_Read_Duration : 2; // Bits 18:17
+ U32 Odt_Write_Duration : 2; // Bits 20:19
+ U32 : 11; // Bits 31:21
+ } Bits;
+#ifdef ULT_FLAG
+ struct {
+ U32 tCL : 5; // Bits 4:0
+ U32 tWCL : 5; // Bits 9:5
+ U32 tCPDED : 2; // Bits 11:10
+ U32 tPRPDEN : 2; // Bits 13:12
+ U32 Odt_Read_Delay : 3; // Bits 16:14
+ U32 Odt_Read_Duration : 2; // Bits 18:17
+ U32 Odt_Write_Duration : 3; // Bits 21:19
+ U32 Odt_Write_Delay : 3; // Bits 24:22
+ U32 Odt_Always_Rank0 : 1; // Bits 25:25
+ U32 cmd_delay : 2; // Bits 27:26
+ U32 : 4; // Bits 31:28
+ } UltBits;
+#endif // ULT_FLAG
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_TC_BANK_RANK_D_STRUCT;
+
+typedef union {
+ struct {
+ U32 dis_opp_cas : 1; // Bits 0:0
+ U32 dis_opp_is_cas : 1; // Bits 1:1
+ U32 dis_opp_ras : 1; // Bits 2:2
+ U32 dis_opp_is_ras : 1; // Bits 3:3
+ U32 dis_1c_byp : 1; // Bits 4:4
+ U32 dis_2c_byp : 1; // Bits 5:5
+ U32 dis_deprd_opt : 1; // Bits 6:6
+ U32 dis_pt_it : 1; // Bits 7:7
+ U32 dis_prcnt_ring : 1; // Bits 8:8
+ U32 dis_prcnt_sa : 1; // Bits 9:9
+ U32 dis_blkr_ph : 1; // Bits 10:10
+ U32 dis_blkr_pe : 1; // Bits 11:11
+ U32 dis_blkr_pm : 1; // Bits 12:12
+ U32 dis_odt : 1; // Bits 13:13
+ U32 OE_alw_off : 1; // Bits 14:14
+ U32 : 1; // Bits 15:15
+ U32 dis_aom : 1; // Bits 16:16
+ U32 block_rpq : 1; // Bits 17:17
+ U32 block_wpq : 1; // Bits 18:18
+ U32 invert_align : 1; // Bits 19:19
+ U32 dis_write_gap : 1; // Bits 20:20
+ U32 dis_zq : 1; // Bits 21:21
+ U32 dis_tt : 1; // Bits 22:22
+ U32 dis_opp_ref : 1; // Bits 23:23
+ U32 Long_ZQ : 1; // Bits 24:24
+ U32 dis_srx_zq : 1; // Bits 25:25
+ U32 Serialize_ZQ : 1; // Bits 26:26
+ U32 ZQ_fast_exec : 1; // Bits 27:27
+ U32 Dis_DriveNop : 1; // Bits 28:28
+ U32 Pres_WDB_Ent : 1; // Bits 29:29
+ U32 dis_clk_gate : 1; // Bits 30:30
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_SCHED_CBIT_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lat_R0D0 : 6; // Bits 5:0
+ U32 : 2; // Bits 7:6
+ U32 Lat_R1D0 : 6; // Bits 13:8
+ U32 : 2; // Bits 15:14
+ U32 Lat_R0D1 : 6; // Bits 21:16
+ U32 : 2; // Bits 23:22
+ U32 Lat_R1D1 : 6; // Bits 29:24
+ U32 : 2; // Bits 31:30
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_SC_ROUNDT_LAT_STRUCT;
+
+typedef union {
+ struct {
+ U32 IOLAT_R0D0 : 4; // Bits 3:0
+ U32 IOLAT_R1D0 : 4; // Bits 7:4
+ U32 IOLAT_R0D1 : 4; // Bits 11:8
+ U32 IOLAT_R1D1 : 4; // Bits 15:12
+ U32 RT_IOCOMP : 6; // Bits 21:16
+ U32 : 8; // Bits 29:22
+ U32 three_channels : 1; // Bits 30:30
+ U32 DIS_RT_CLK_GATE : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_SC_IO_LATENCY_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATA : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_ROUND_TRIP_DFT_DATA_STRUCT;
+
+typedef union {
+ struct {
+ U32 WDAR : 1; // Bits 0:0
+ U32 safe_mask_sel : 3; // Bits 3:1
+ U32 force_rcv_en : 1; // Bits 4:4
+ U32 : 3; // Bits 7:5
+ U32 DDR_QUAL : 2; // Bits 9:8
+ U32 Qual_length : 2; // Bits 11:10
+ U32 WDB_Block_En : 1; // Bits 12:12
+ U32 RT_DFT_READ_PTR : 4; // Bits 16:13
+ U32 RT_DFT_READ_ENABLE : 1; // Bits 17:17
+ U32 RT_DFT_READ_SEL_ADDR : 1; // Bits 18:18
+ U32 : 13; // Bits 31:19
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_DFT_MISC_STRUCT;
+
+typedef union {
+ struct {
+ U32 ECC : 8; // Bits 7:0
+ U32 RRD_DFT_Mode : 2; // Bits 9:8
+ U32 LFSR_Seed_Index : 5; // Bits 14:10
+ U32 Inversion_Mode : 1; // Bits 15:15
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_READ_RETURN_DFT_STRUCT;
+
+typedef union {
+ struct {
+ U32 dis_imph_error : 1; // Bits 0:0
+ U32 : 7; // Bits 7:1
+ U32 dis_async_odt : 1; // Bits 8:8
+ U32 : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_SCHED_SECOND_CBIT_STRUCT;
+
+typedef union {
+ struct {
+ U32 Mux0_Control : 2; // Bits 1:0
+ U32 : 1; // Bits 2:2
+ U32 Mux1_Control : 2; // Bits 4:3
+ U32 : 1; // Bits 5:5
+ U32 Mux2_Control : 2; // Bits 7:6
+ U32 : 6; // Bits 13:8
+ U32 ECC_Replace_Byte_Control : 1; // Bits 14:14
+ U32 ECC_Data_Source_Sel : 1; // Bits 15:15
+ U32 Save_LFSR_Seed_Rate : 6; // Bits 21:16
+ U32 : 2; // Bits 23:22
+ U32 Reload_LFSR_Seed_Rate : 3; // Bits 26:24
+ U32 : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_STRUCT;
+
+typedef union {
+ struct {
+ U32 WDB_Current_Read_Pointer : 6; // Bits 5:0
+ U32 : 26; // Bits 31:6
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_RD_STATUS_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 24; // Bits 23:0
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 24; // Bits 23:0
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 24; // Bits 23:0
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 24; // Bits 23:0
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 24; // Bits 23:0
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 24; // Bits 23:0
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 24; // Bits 23:0
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 24; // Bits 23:0
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 24; // Bits 23:0
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 24; // Bits 23:0
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 24; // Bits 23:0
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 24; // Bits 23:0
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_2_STRUCT;
+
+typedef union {
+ struct {
+ U32 L_data_select : 1; // Bits 0:0
+ U32 Enable_Sweep_Frequency : 1; // Bits 1:1
+ U32 : 6; // Bits 7:2
+ U32 L_counter : 8; // Bits 15:8
+ U32 M_counter : 8; // Bits 23:16
+ U32 N_counter : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_STRUCT;
+
+typedef union {
+ struct {
+ U32 ECC_Inv_or_DC_Enable : 8; // Bits 7:0
+ U32 : 8; // Bits 15:8
+ U32 Inv_or_DC_Shift_Rate : 4; // Bits 19:16
+ U32 DC_Polarity_Control : 1; // Bits 20:20
+ U32 : 9; // Bits 29:21
+ U32 Inv_or_DC_Control : 1; // Bits 30:30
+ U32 Inv_or_DC_Shift_Enable : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_PAT_WDB_INV_STRUCT;
+
+typedef union {
+ struct {
+ U64 Data_Inv_or_DC_Enable : 64; // Bits 63:0
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} MCHBAR_CH0_CR_REUT_CH_PAT_WDB_DATA_INV_STRUCT;
+
+typedef union {
+ struct {
+ U32 Stop_on_Nth_Error : 6; // Bits 5:0
+ U32 : 6; // Bits 11:6
+ U32 Stop_On_Error_Control : 2; // Bits 13:12
+ U32 : 2; // Bits 15:14
+ U32 Selective_Error_Enable_Chunk : 8; // Bits 23:16
+ U32 Selective_Error_Enable_Cacheline : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_ERR_CTL_STRUCT;
+
+typedef union {
+ struct {
+ U32 ECC_Error_Mask : 8; // Bits 7:0
+ U32 : 24; // Bits 31:8
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_ERR_ECC_MASK_STRUCT;
+
+typedef union {
+ struct {
+ U32 Stretch_mode : 2; // Bits 1:0
+ U32 : 2; // Bits 3:2
+ U32 STF : 3; // Bits 6:4
+ U32 : 25; // Bits 31:7
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_STM_CONFIG_STRUCT;
+
+typedef union {
+ struct {
+ U32 Priority_count_ring : 10; // Bits 9:0
+ U32 : 6; // Bits 15:10
+ U32 Priority_count_SA : 10; // Bits 25:16
+ U32 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_SC_PR_CNT_CONFIG_STRUCT;
+
+typedef union {
+ struct {
+ U32 PCIT : 8; // Bits 7:0
+ U32 : 24; // Bits 31:8
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_SC_PCIT_STRUCT;
+
+typedef union {
+ struct {
+ U32 PDWN_idle_counter : 12; // Bits 11:0
+ U32 PDWN_mode : 4; // Bits 15:12
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_PM_PDWN_CONFIG_STRUCT;
+
+typedef union {
+ struct {
+ U32 Count : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_ECC_INJECT_COUNT_STRUCT;
+
+typedef union {
+ struct {
+ U32 ECC4ANA_fill : 8; // Bits 7:0
+ U32 ECC4ANA_trigger : 2; // Bits 9:8
+ U32 ECC4ANA_BS : 1; // Bits 10:10
+ U32 ECC_Inject : 3; // Bits 13:11
+ U32 ECC_correction_disable : 1; // Bits 14:14
+ U32 ECC4ANA_Inject : 1; // Bits 15:15
+ U32 DIS_MCA_LOG : 1; // Bits 16:16
+ U32 DIS_PCH_EVENT : 1; // Bits 17:17
+ U32 DIS_PCIE_POISON : 1; // Bits 18:18
+ U32 : 13; // Bits 31:19
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_ECC_DFT_STRUCT;
+
+typedef union {
+ struct {
+ U32 Data : 18; // Bits 17:0
+ U32 : 13; // Bits 30:18
+ U32 VORANGE : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_VISA_CTL_MCSCHEDS_STRUCT;
+
+typedef union {
+ struct {
+ U32 Data : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_VISA_XBAR_MCSCHEDS_STRUCT;
+
+typedef union {
+ struct {
+ U32 CERRSTS : 1; // Bits 0:0
+ U32 MERRSTS : 1; // Bits 1:1
+ U32 : 14; // Bits 15:2
+ U32 ERRSYND : 8; // Bits 23:16
+ U32 ERRCHUNK : 3; // Bits 26:24
+ U32 ERRRANK : 2; // Bits 28:27
+ U32 ERRBANK : 3; // Bits 31:29
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_ECCERRLOG0_STRUCT;
+
+typedef union {
+ struct {
+ U32 ERRROW : 16; // Bits 15:0
+ U32 ERRCOL : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_ECCERRLOG1_STRUCT;
+
+typedef union {
+ struct {
+ U32 D0R0 : 2; // Bits 1:0
+ U32 D0R1 : 2; // Bits 3:2
+ U32 D1R0 : 2; // Bits 5:4
+ U32 D1R1 : 2; // Bits 7:6
+ U32 : 24; // Bits 31:8
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_SC_WR_ADD_DELAY_STRUCT;
+
+typedef union {
+ struct {
+ U32 Dis_Opp_rd : 1; // Bits 0:0
+ U32 ACT_Enable : 1; // Bits 1:1
+ U32 PRE_Enable : 1; // Bits 2:2
+ U32 MAX_RPQ_Cas : 4; // Bits 6:3
+ U32 : 25; // Bits 31:7
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_WMM_READ_CONFIG_STRUCT;
+
+typedef union {
+ struct {
+ U64 Data_Error_Mask : 64; // Bits 63:0
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} MCHBAR_CH0_CR_REUT_CH_ERR_DATA_MASK_STRUCT;
+
+typedef union {
+ struct {
+ U64 Data_Error_Status : 64; // Bits 63:0
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} MCHBAR_CH0_CR_REUT_CH_ERR_DATA_STATUS_STRUCT;
+
+typedef union {
+ struct {
+ U32 ECC_Error_Status : 8; // Bits 7:0
+ U32 Chunk_Error_Status : 8; // Bits 15:8
+ U32 Rank_Error_Status : 4; // Bits 19:16
+ U32 : 12; // Bits 31:20
+ U32 Byte_Group_Error_Status : 9; // Bits 40:32
+ U32 : 11; // Bits 51:41
+ U32 WDB_Rd_Chunk_Num_Status : 3; // Bits 54:52
+ U32 : 1; // Bits 55:55
+ U32 Nth_Error : 6; // Bits 61:56
+ U32 : 2; // Bits 63:62
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Pointer : 7; // Bits 6:0
+ U32 Counter_Control : 2; // Bits 8:7
+ U32 : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Pointer : 7; // Bits 6:0
+ U32 Counter_Control : 2; // Bits 8:7
+ U32 : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Pointer : 7; // Bits 6:0
+ U32 Counter_Control : 2; // Bits 8:7
+ U32 : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Pointer : 7; // Bits 6:0
+ U32 Counter_Control : 2; // Bits 8:7
+ U32 : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Pointer : 7; // Bits 6:0
+ U32 Counter_Control : 2; // Bits 8:7
+ U32 : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_4_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Pointer : 7; // Bits 6:0
+ U32 Counter_Control : 2; // Bits 8:7
+ U32 : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_5_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Pointer : 7; // Bits 6:0
+ U32 Counter_Control : 2; // Bits 8:7
+ U32 : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_6_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Pointer : 7; // Bits 6:0
+ U32 Counter_Control : 2; // Bits 8:7
+ U32 : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_7_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Pointer : 7; // Bits 6:0
+ U32 Counter_Control : 2; // Bits 8:7
+ U32 : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_8_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Status : 23; // Bits 22:0
+ U32 : 9; // Bits 31:23
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Status : 23; // Bits 22:0
+ U32 : 9; // Bits 31:23
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Status : 23; // Bits 22:0
+ U32 : 9; // Bits 31:23
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Status : 23; // Bits 22:0
+ U32 : 9; // Bits 31:23
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Status : 23; // Bits 22:0
+ U32 : 9; // Bits 31:23
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_4_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Status : 23; // Bits 22:0
+ U32 : 9; // Bits 31:23
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_5_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Status : 23; // Bits 22:0
+ U32 : 9; // Bits 31:23
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_6_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Status : 23; // Bits 22:0
+ U32 : 9; // Bits 31:23
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_7_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Status : 23; // Bits 22:0
+ U32 : 9; // Bits 31:23
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_8_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Overflow_Status : 9; // Bits 8:0
+ U32 : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_OVERFLOW_STATUS_STRUCT;
+
+typedef union {
+ struct {
+ U32 Column_Address : 10; // Bits 9:0
+ U32 : 14; // Bits 23:10
+ U32 Row_Address : 16; // Bits 39:24
+ U32 : 8; // Bits 47:40
+ U32 Bank_Address : 3; // Bits 50:48
+ U32 : 5; // Bits 55:51
+ U32 Rank_Address : 2; // Bits 57:56
+ U32 : 6; // Bits 63:58
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} MCHBAR_CH0_CR_REUT_CH_ERROR_ADDR_STRUCT;
+
+typedef union {
+ struct {
+ U32 WDB_Current_Error_Pointer : 6; // Bits 5:0
+ U32 : 26; // Bits 31:6
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_ERR_WDB_CAPTURE_STATUS_STRUCT;
+
+typedef union {
+ struct {
+ U32 Enable_WDB_Error_Capture : 1; // Bits 0:0
+ U32 : 7; // Bits 7:1
+ U32 WDB_Starting_Error_Pointer : 6; // Bits 13:8
+ U32 : 2; // Bits 15:14
+ U32 WDB_Ending_Error_Pointer : 6; // Bits 21:16
+ U32 : 10; // Bits 31:22
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_STRUCT;
+
+typedef union {
+ struct {
+ U32 CKE_Override : 4; // Bits 3:0
+ U32 : 4; // Bits 7:4
+ U32 CKE_En_Start_Test_Sync : 1; // Bits 8:8
+ U32 : 7; // Bits 15:9
+ U32 CKE_On : 4; // Bits 19:16
+ U32 : 12; // Bits 31:20
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_MISC_CKE_CTRL_STRUCT;
+
+typedef union {
+ struct {
+ U32 ODT_Override : 4; // Bits 3:0
+ U32 : 12; // Bits 15:4
+ U32 ODT_On : 4; // Bits 19:16
+ U32 : 11; // Bits 30:20
+ U32 MPR_Train_DDR_On : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_MISC_ODT_CTRL_STRUCT;
+
+typedef union {
+ struct {
+ U32 Enable_CADB_on_Deselect : 1; // Bits 0:0
+ U32 Enable_CADB_Always_On : 1; // Bits 1:1
+ U32 CMD_Deselect_Start : 4; // Bits 5:2
+ U32 CMD_Deselect_Stop : 4; // Bits 9:6
+ U32 Lane_Deselect_Enable : 4; // Bits 13:10
+ U32 CAS_Select_Enable : 2; // Bits 15:14
+ U32 ACT_Select_Enable : 2; // Bits 17:16
+ U32 PRE_Select_Enable : 2; // Bits 19:18
+ U32 Save_Current_Seed : 4; // Bits 23:20
+ U32 Reload_Starting_Seed : 4; // Bits 27:24
+ U32 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_STRUCT;
+
+typedef union {
+ struct {
+ U32 MRS_Gap : 3; // Bits 2:0
+ U32 : 5; // Bits 7:3
+ U32 CADB_MRS_Start_Pointer : 3; // Bits 10:8
+ U32 : 5; // Bits 15:11
+ U32 CADB_MRS_End_Pointer : 3; // Bits 18:16
+ U32 : 5; // Bits 23:19
+ U32 CADB_MRS_Current_Pointer : 3; // Bits 26:24
+ U32 : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MRS_STRUCT;
+
+typedef union {
+ struct {
+ U32 Mux0_Control : 2; // Bits 1:0
+ U32 : 2; // Bits 3:2
+ U32 Mux1_Control : 2; // Bits 5:4
+ U32 : 2; // Bits 7:6
+ U32 Mux2_Control : 2; // Bits 9:8
+ U32 : 6; // Bits 15:10
+ U32 Select_Mux0_Control : 2; // Bits 17:16
+ U32 : 2; // Bits 19:18
+ U32 Select_Mux1_Control : 2; // Bits 21:20
+ U32 : 2; // Bits 23:22
+ U32 Select_Mux2_Control : 2; // Bits 25:24
+ U32 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_CTRL_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 16; // Bits 15:0
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_PB_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 16; // Bits 15:0
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_PB_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 16; // Bits 15:0
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_PB_2_STRUCT;
+
+typedef union {
+ struct {
+ U32 L_data_select : 1; // Bits 0:0
+ U32 Enable_Sweep_Frequency : 1; // Bits 1:1
+ U32 : 6; // Bits 7:2
+ U32 L_counter : 8; // Bits 15:8
+ U32 M_counter : 8; // Bits 23:16
+ U32 N_counter : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_STRUCT;
+
+typedef union {
+ struct {
+ U32 CADB_Write_Pointer : 3; // Bits 2:0
+ U32 : 29; // Bits 31:3
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_PAT_CADB_WRITE_POINTER_STRUCT;
+
+typedef union {
+ struct {
+ U32 CADB_Data_Address : 16; // Bits 15:0
+ U32 : 8; // Bits 23:16
+ U32 CADB_Data_Bank : 3; // Bits 26:24
+ U32 : 5; // Bits 31:27
+ U32 CADB_Data_CS : 4; // Bits 35:32
+ U32 : 4; // Bits 39:36
+ U32 CADB_Data_Control : 3; // Bits 42:40
+ U32 : 5; // Bits 47:43
+ U32 CADB_Data_ODT : 4; // Bits 51:48
+ U32 : 4; // Bits 55:52
+ U32 CADB_Data_CKE : 4; // Bits 59:56
+ U32 : 4; // Bits 63:60
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} MCHBAR_CH0_CR_REUT_CH_PAT_CADB_PROG_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 16; // Bits 15:0
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 16; // Bits 15:0
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 16; // Bits 15:0
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_2_STRUCT;
+
+typedef union {
+ struct {
+ U32 WDB_Increment_Rate : 5; // Bits 4:0
+ U32 WDB_Increment_Scale : 1; // Bits 5:5
+ U32 : 2; // Bits 7:6
+ U32 WDB_Start_Pointer : 6; // Bits 13:8
+ U32 : 2; // Bits 15:14
+ U32 WDB_End_Pointer : 6; // Bits 21:16
+ U32 : 10; // Bits 31:22
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_CTRL_STRUCT;
+
+typedef union {
+ struct {
+ U32 Refresh_Rank_Mask : 4; // Bits 3:0
+ U32 : 4; // Bits 7:4
+ U32 RefZQ_En_Start_Test_Sync : 1; // Bits 8:8
+ U32 : 22; // Bits 30:9
+ U32 Panic_Refresh_Only : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_MISC_REFRESH_CTRL_STRUCT;
+
+typedef union {
+ struct {
+ U32 ZQ_Rank_Mask : 4; // Bits 3:0
+ U32 : 27; // Bits 30:4
+ U32 Always_Do_ZQ : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_REUT_CH_MISC_ZQ_CTRL_STRUCT;
+
+#ifdef ULT_FLAG
+typedef union {
+ struct {
+ U32 Rank_0_x32 : 1; // Bits 0:0
+ U32 Rank_1_x32 : 1; // Bits 1:1
+ U32 Rank_2_x32 : 1; // Bits 2:2
+ U32 Rank_3_x32 : 1; // Bits 3:3
+ U32 LPDDR2 : 1; // Bits 4:4
+ U32 : 3; // Bits 7:5
+ U32 MR4_PERIOD : 16; // Bits 23:8
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_LPDDR_MR_PARAMS_STRUCT;
+
+typedef union {
+ struct {
+ U32 Address : 8; // Bits 7:0
+ U32 Data : 8; // Bits 15:8
+ U32 Rank : 2; // Bits 17:16
+ U32 Write : 1; // Bits 18:18
+ U32 Init_MRW : 1; // Bits 19:19
+ U32 : 11; // Bits 30:20
+ U32 Busy : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_LPDDR_MR_COMMAND_STRUCT;
+
+typedef union {
+ struct {
+ U32 Device_0 : 8; // Bits 7:0
+ U32 Device_1 : 8; // Bits 15:8
+ U32 Device_2 : 8; // Bits 23:16
+ U32 Device_3 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_LPDDR_MR_RESULT_STRUCT;
+
+typedef union {
+ struct {
+ U32 Rank_0 : 3; // Bits 2:0
+ U32 : 5; // Bits 7:3
+ U32 Rank_1 : 3; // Bits 10:8
+ U32 : 5; // Bits 15:11
+ U32 Rank_2 : 3; // Bits 18:16
+ U32 : 5; // Bits 23:19
+ U32 Rank_3 : 3; // Bits 26:24
+ U32 : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_LPDDR_MR4_RANK_TEMPERATURE_STRUCT;
+
+typedef union {
+ struct {
+ U32 Bit_0 : 3; // Bits 2:0
+ U32 : 1; // Bits 3:3
+ U32 Bit_1 : 3; // Bits 6:4
+ U32 : 1; // Bits 7:7
+ U32 Bit_2 : 3; // Bits 10:8
+ U32 : 1; // Bits 11:11
+ U32 Bit_16 : 3; // Bits 14:12
+ U32 : 1; // Bits 15:15
+ U32 Bit_17 : 3; // Bits 18:16
+ U32 : 1; // Bits 19:19
+ U32 Bit_18 : 3; // Bits 22:20
+ U32 : 1; // Bits 23:23
+ U32 Byte_0 : 3; // Bits 26:24
+ U32 : 1; // Bits 27:27
+ U32 Byte_2 : 3; // Bits 30:28
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_DESWIZZLE_LOW_STRUCT;
+
+typedef union {
+ struct {
+ U32 Bit_32 : 3; // Bits 2:0
+ U32 : 1; // Bits 3:3
+ U32 Bit_33 : 3; // Bits 6:4
+ U32 : 1; // Bits 7:7
+ U32 Bit_34 : 3; // Bits 10:8
+ U32 : 1; // Bits 11:11
+ U32 Bit_48 : 3; // Bits 14:12
+ U32 : 1; // Bits 15:15
+ U32 Bit_49 : 3; // Bits 18:16
+ U32 : 1; // Bits 19:19
+ U32 Bit_50 : 3; // Bits 22:20
+ U32 : 1; // Bits 23:23
+ U32 Byte_4 : 3; // Bits 26:24
+ U32 : 1; // Bits 27:27
+ U32 Byte_6 : 3; // Bits 30:28
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_DESWIZZLE_HIGH_STRUCT;
+#endif // ULT_FLAG
+
+typedef union {
+ struct {
+ U32 Ref_Interval : 11; // Bits 10:0
+ U32 Ref_Stagger_En : 1; // Bits 11:11
+ U32 Ref_Stagger_Mode : 1; // Bits 12:12
+ U32 Disable_Stolen_Refresh : 1; // Bits 13:13
+ U32 En_Ref_Type_Display : 1; // Bits 14:14
+ U32 : 17; // Bits 31:15
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_MC_REFRESH_STAGGER_STRUCT;
+
+typedef union {
+ struct {
+ U32 ZQCS_period : 8; // Bits 7:0
+ U32 tZQCS : 8; // Bits 15:8
+ U32 : 16; // Bits 31:16
+ } Bits;
+#ifdef ULT_FLAG
+ struct {
+ U32 ZQCS_period : 10; // Bits 9:0
+ U32 tZQCS : 10; // Bits 19:10
+ U32 : 12; // Bits 31:20
+ } UltBits;
+#endif // ULT_FLAG
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_TC_ZQCAL_STRUCT;
+
+typedef union {
+ struct {
+ U32 OREF_RI : 8; // Bits 7:0
+ U32 Refresh_HP_WM : 4; // Bits 11:8
+ U32 Refresh_panic_wm : 4; // Bits 15:12
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_TC_RFP_STRUCT;
+
+typedef union {
+ struct {
+ U32 tREFI : 16; // Bits 15:0
+ U32 tRFC : 9; // Bits 24:16
+ U32 tREFIx9 : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_TC_RFTP_STRUCT;
+
+typedef union {
+ struct {
+ U32 MR2_sh_low : 6; // Bits 5:0
+ U32 SRT_avail : 2; // Bits 7:6
+ U32 MR2_sh_high : 3; // Bits 10:8
+ U32 : 3; // Bits 13:11
+ U32 Addr_bit_swizzle : 2; // Bits 15:14
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_TC_MR2_SHADDOW_STRUCT;
+
+typedef union {
+ struct {
+ U32 Rank_occupancy : 4; // Bits 3:0
+ U32 : 28; // Bits 31:4
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_MC_INIT_STATE_STRUCT;
+
+typedef union {
+ struct {
+ U32 tXSDLL : 12; // Bits 11:0
+ U32 tXS_offset : 4; // Bits 15:12
+ U32 tZQOPER : 10; // Bits 25:16
+ U32 : 2; // Bits 27:26
+ U32 tMOD : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_TC_SRFTP_STRUCT;
+
+typedef union {
+ struct {
+ U32 VISAByteSel : 3; // Bits 2:0
+ U32 : 29; // Bits 31:3
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_WDB_VISA_SEL_STRUCT;
+
+typedef union {
+ struct {
+ U32 FASTADDR : 12; // Bits 11:0
+ U32 : 4; // Bits 15:12
+ U32 ADDREN : 1; // Bits 16:16
+ U32 SEQEN : 1; // Bits 17:17
+ U32 POL0 : 1; // Bits 18:18
+ U32 POL1 : 1; // Bits 19:19
+ U32 CMDA : 4; // Bits 23:20
+ U32 CMDB : 4; // Bits 27:24
+ U32 CMDC : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_DCLK_LDAT_PDAT_STRUCT;
+
+typedef union {
+ struct {
+ U32 BANKSEL : 4; // Bits 3:0
+ U32 : 1; // Bits 4:4
+ U32 ARRAYSEL : 5; // Bits 9:5
+ U32 CMP : 1; // Bits 10:10
+ U32 REP : 1; // Bits 11:11
+ U32 DWORD : 4; // Bits 15:12
+ U32 MODE : 2; // Bits 17:16
+ U32 MPMAP : 6; // Bits 23:18
+ U32 MPBOFFSET : 4; // Bits 27:24
+ U32 STAGE_EN : 1; // Bits 28:28
+ U32 SHADOW : 2; // Bits 30:29
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_DCLK_LDAT_SDAT_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATOUT : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_DCLK_LDAT_DATAOUT_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATIN : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_DCLK_LDAT_DATAIN_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 FASTADDR : 12; // Bits 11:0
+ U32 : 4; // Bits 15:12
+ U32 ADDREN : 1; // Bits 16:16
+ U32 SEQEN : 1; // Bits 17:17
+ U32 POL0 : 1; // Bits 18:18
+ U32 POL1 : 1; // Bits 19:19
+ U32 CMDA : 4; // Bits 23:20
+ U32 CMDB : 4; // Bits 27:24
+ U32 CMDC : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_QCLK_LDAT_PDAT_STRUCT;
+
+typedef union {
+ struct {
+ U32 BANKSEL : 4; // Bits 3:0
+ U32 : 1; // Bits 4:4
+ U32 ARRAYSEL : 5; // Bits 9:5
+ U32 CMP : 1; // Bits 10:10
+ U32 REP : 1; // Bits 11:11
+ U32 DWORD : 4; // Bits 15:12
+ U32 MODE : 2; // Bits 17:16
+ U32 MPMAP : 6; // Bits 23:18
+ U32 MPBOFFSET : 4; // Bits 27:24
+ U32 STAGE_EN : 1; // Bits 28:28
+ U32 SHADOW : 2; // Bits 30:29
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_QCLK_LDAT_SDAT_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATOUT : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_QCLK_LDAT_DATAOUT_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATIN : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_QCLK_LDAT_DATAIN_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATIN : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_QCLK_LDAT_DATAIN_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RPQ_disable : 28; // Bits 27:0
+ U32 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_QUEUE_ENTRY_DISABLE_RPQ_STRUCT;
+
+typedef union {
+ struct {
+ U32 WPQ_disable : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_QUEUE_ENTRY_DISABLE_WPQ_STRUCT;
+
+typedef union {
+ struct {
+ U32 DIMM0_IDLE_ENERGY : 6; // Bits 5:0
+ U32 : 2; // Bits 7:6
+ U32 DIMM1_IDLE_ENERGY : 6; // Bits 13:8
+ U32 : 18; // Bits 31:14
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_PM_DIMM_IDLE_ENERGY_STRUCT;
+
+typedef union {
+ struct {
+ U32 DIMM0_PD_ENERGY : 6; // Bits 5:0
+ U32 : 2; // Bits 7:6
+ U32 DIMM1_PD_ENERGY : 6; // Bits 13:8
+ U32 : 18; // Bits 31:14
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_PM_DIMM_PD_ENERGY_STRUCT;
+
+typedef union {
+ struct {
+ U32 DIMM0_ACT_ENERGY : 8; // Bits 7:0
+ U32 DIMM1_ACT_ENERGY : 8; // Bits 15:8
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_PM_DIMM_ACT_ENERGY_STRUCT;
+
+typedef union {
+ struct {
+ U32 DIMM0_RD_ENERGY : 8; // Bits 7:0
+ U32 DIMM1_RD_ENERGY : 8; // Bits 15:8
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_PM_DIMM_RD_ENERGY_STRUCT;
+
+typedef union {
+ struct {
+ U32 DIMM0_WR_ENERGY : 8; // Bits 7:0
+ U32 DIMM1_WR_ENERGY : 8; // Bits 15:8
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_PM_DIMM_WR_ENERGY_STRUCT;
+
+typedef union {
+ struct {
+ U32 CKE_MIN : 8; // Bits 7:0
+ U32 CKE_MIN_DEFEATURE : 1; // Bits 8:8
+ U32 : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_PM_THRT_CKE_MIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 ODT : 4; // Bits 3:0
+ U32 Web : 1; // Bits 4:4
+ U32 CASb : 1; // Bits 5:5
+ U32 RASb : 1; // Bits 6:6
+ U32 CSb : 4; // Bits 10:7
+ U32 CKE : 4; // Bits 14:11
+ U32 MA : 16; // Bits 30:15
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_ODLAT_CMD_MATCH0_STRUCT;
+
+typedef union {
+ struct {
+ U32 ODT : 4; // Bits 3:0
+ U32 Web : 1; // Bits 4:4
+ U32 CASb : 1; // Bits 5:5
+ U32 RASb : 1; // Bits 6:6
+ U32 CSb : 4; // Bits 10:7
+ U32 CKE : 4; // Bits 14:11
+ U32 MA : 16; // Bits 30:15
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_ODLAT_CMD_MATCH1_STRUCT;
+
+typedef union {
+ struct {
+ U32 ODT : 4; // Bits 3:0
+ U32 Web : 1; // Bits 4:4
+ U32 CASb : 1; // Bits 5:5
+ U32 RASb : 1; // Bits 6:6
+ U32 CSb : 4; // Bits 10:7
+ U32 CKE : 4; // Bits 14:11
+ U32 MA : 16; // Bits 30:15
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_ODLAT_CMD_MATCH2_STRUCT;
+
+typedef union {
+ struct {
+ U32 ODT : 4; // Bits 3:0
+ U32 Web : 1; // Bits 4:4
+ U32 CASb : 1; // Bits 5:5
+ U32 RASb : 1; // Bits 6:6
+ U32 CSb : 4; // Bits 10:7
+ U32 CKE : 4; // Bits 14:11
+ U32 MA : 16; // Bits 30:15
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_ODLAT_CMD_MATCH3_STRUCT;
+
+typedef union {
+ struct {
+ U32 ODT : 4; // Bits 3:0
+ U32 Web : 1; // Bits 4:4
+ U32 CASb : 1; // Bits 5:5
+ U32 RASb : 1; // Bits 6:6
+ U32 CSb : 4; // Bits 10:7
+ U32 CKE : 4; // Bits 14:11
+ U32 MA : 16; // Bits 30:15
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_ODLAT_CMD_MASK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 ODT : 4; // Bits 3:0
+ U32 Web : 1; // Bits 4:4
+ U32 CASb : 1; // Bits 5:5
+ U32 RASb : 1; // Bits 6:6
+ U32 CSb : 4; // Bits 10:7
+ U32 CKE : 4; // Bits 14:11
+ U32 MA : 16; // Bits 30:15
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_ODLAT_CMD_MASK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 ODT : 4; // Bits 3:0
+ U32 Web : 1; // Bits 4:4
+ U32 CASb : 1; // Bits 5:5
+ U32 RASb : 1; // Bits 6:6
+ U32 CSb : 4; // Bits 10:7
+ U32 CKE : 4; // Bits 14:11
+ U32 MA : 16; // Bits 30:15
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_ODLAT_CMD_MASK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 ODT : 4; // Bits 3:0
+ U32 Web : 1; // Bits 4:4
+ U32 CASb : 1; // Bits 5:5
+ U32 RASb : 1; // Bits 6:6
+ U32 CSb : 4; // Bits 10:7
+ U32 CKE : 4; // Bits 14:11
+ U32 MA : 16; // Bits 30:15
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_ODLAT_CMD_MASK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 BankMatch0 : 3; // Bits 2:0
+ U32 BankMatch1 : 3; // Bits 5:3
+ U32 BankMatch2 : 3; // Bits 8:6
+ U32 BankMatch3 : 3; // Bits 11:9
+ U32 BankMask0 : 3; // Bits 14:12
+ U32 BankMask1 : 3; // Bits 17:15
+ U32 BankMask2 : 3; // Bits 20:18
+ U32 BankMask3 : 3; // Bits 23:21
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_ODLAT_CMD_BANK_STRUCT;
+
+typedef union {
+ struct {
+ U32 InputMatch : 4; // Bits 3:0
+ U32 InputInvert : 4; // Bits 7:4
+ U32 CountMatches : 1; // Bits 8:8
+ U32 CounterThreshold : 15; // Bits 23:9
+ U32 CounterAction : 2; // Bits 25:24
+ U32 CounterNextState : 2; // Bits 27:26
+ U32 MatchAction : 2; // Bits 29:28
+ U32 MatchNextState : 2; // Bits 31:30
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL0_STRUCT;
+
+typedef union {
+ struct {
+ U32 InputMatch : 4; // Bits 3:0
+ U32 InputInvert : 4; // Bits 7:4
+ U32 CountMatches : 1; // Bits 8:8
+ U32 CounterThreshold : 15; // Bits 23:9
+ U32 CounterAction : 2; // Bits 25:24
+ U32 CounterNextState : 2; // Bits 27:26
+ U32 MatchAction : 2; // Bits 29:28
+ U32 MatchNextState : 2; // Bits 31:30
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL1_STRUCT;
+
+typedef union {
+ struct {
+ U32 InputMatch : 4; // Bits 3:0
+ U32 InputInvert : 4; // Bits 7:4
+ U32 CountMatches : 1; // Bits 8:8
+ U32 CounterThreshold : 15; // Bits 23:9
+ U32 CounterAction : 2; // Bits 25:24
+ U32 CounterNextState : 2; // Bits 27:26
+ U32 MatchAction : 2; // Bits 29:28
+ U32 MatchNextState : 2; // Bits 31:30
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL2_STRUCT;
+
+typedef union {
+ struct {
+ U32 InputMatch : 4; // Bits 3:0
+ U32 InputInvert : 4; // Bits 7:4
+ U32 CountMatches : 1; // Bits 8:8
+ U32 CounterThreshold : 15; // Bits 23:9
+ U32 CounterAction : 2; // Bits 25:24
+ U32 CounterNextState : 2; // Bits 27:26
+ U32 MatchAction : 2; // Bits 29:28
+ U32 MatchNextState : 2; // Bits 31:30
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL3_STRUCT;
+
+typedef union {
+ struct {
+ U32 TriggerBlockEnable : 1; // Bits 0:0
+ U32 GlobalCounterThreshold : 16; // Bits 16:1
+ U32 : 15; // Bits 31:17
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_ODLAT_SEQ_GLOBAL_STRUCT;
+
+typedef union {
+ struct {
+ U32 WMM_Enter : 8; // Bits 7:0
+ U32 WMM_Exit : 8; // Bits 15:8
+ U32 WPQ_IS : 8; // Bits 23:16
+ U32 Starve_count : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_SC_WDBWM_STRUCT;
+
+typedef union {
+ struct {
+ U32 Data : 18; // Bits 17:0
+ U32 : 13; // Bits 30:18
+ U32 VORANGE : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH0_CR_VISA_CTL_MCMNTS_STRUCT;
+
+typedef union {
+ struct {
+ U32 tRCD : 5; // Bits 4:0
+ U32 tRP : 5; // Bits 9:5
+ U32 tRAS : 6; // Bits 15:10
+ U32 tRDPRE : 4; // Bits 19:16
+ U32 tWRPRE : 6; // Bits 25:20
+ U32 tRRD : 4; // Bits 29:26
+ U32 tRPab_ext : 2; // Bits 31:30
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_TC_BANK_STRUCT;
+
+typedef union {
+ struct {
+ U32 tCKE : 4; // Bits 3:0
+ U32 tFAW : 8; // Bits 11:4
+ U32 tRDRD : 3; // Bits 14:12
+ U32 tRDRD_dr : 4; // Bits 18:15
+ U32 tRDRD_dd : 4; // Bits 22:19
+ U32 tRDPDEN : 5; // Bits 27:23
+ U32 : 1; // Bits 28:28
+ U32 CMD_3st : 1; // Bits 29:29
+ U32 CMD_stretch : 2; // Bits 31:30
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_TC_BANK_RANK_A_STRUCT;
+
+typedef union {
+ struct {
+ U32 tWRRD : 6; // Bits 5:0
+ U32 tWRRD_dr : 4; // Bits 9:6
+ U32 tWRRD_dd : 4; // Bits 13:10
+ U32 tWRWR : 3; // Bits 16:14
+ U32 tWRWR_dr : 4; // Bits 20:17
+ U32 tWRWR_dd : 4; // Bits 24:21
+ U32 tWRPDEN : 6; // Bits 30:25
+ U32 Dec_WRD : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_TC_BANK_RANK_B_STRUCT;
+
+typedef union {
+ struct {
+ U32 tXPDLL : 6; // Bits 5:0
+ U32 tXP : 4; // Bits 9:6
+ U32 TAONPD : 4; // Bits 13:10
+ U32 tRDWR : 5; // Bits 18:14
+ U32 tRDWR_dr : 5; // Bits 23:19
+ U32 tRDWR_dd : 5; // Bits 28:24
+ U32 : 3; // Bits 31:29
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_TC_BANK_RANK_C_STRUCT;
+
+typedef union {
+ struct {
+ U32 enable_cmd_rate_limit : 1; // Bits 0:0
+ U32 cmd_rate_limit : 3; // Bits 3:1
+ U32 reset_on_command : 4; // Bits 7:4
+ U32 reset_delay : 4; // Bits 11:8
+ U32 ck_to_cke_delay : 2; // Bits 13:12
+ U32 spare : 17; // Bits 30:14
+ U32 init_mrw_2n_cs : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_CMD_RATE_STRUCT;
+
+typedef union {
+ struct {
+ U32 tCL : 5; // Bits 4:0
+ U32 tWCL : 5; // Bits 9:5
+ U32 tCPDED : 2; // Bits 11:10
+ U32 tPRPDEN : 2; // Bits 13:12
+ U32 Odt_Read_Delay : 3; // Bits 16:14
+ U32 Odt_Read_Duration : 2; // Bits 18:17
+ U32 Odt_Write_Duration : 2; // Bits 20:19
+ U32 : 11; // Bits 31:21
+ } Bits;
+#ifdef ULT_FLAG
+ struct {
+ U32 tCL : 5; // Bits 4:0
+ U32 tWCL : 5; // Bits 9:5
+ U32 tCPDED : 2; // Bits 11:10
+ U32 tPRPDEN : 2; // Bits 13:12
+ U32 Odt_Read_Delay : 3; // Bits 16:14
+ U32 Odt_Read_Duration : 2; // Bits 18:17
+ U32 Odt_Write_Duration : 3; // Bits 21:19
+ U32 Odt_Write_Delay : 3; // Bits 24:22
+ U32 Odt_Always_Rank0 : 1; // Bits 25:25
+ U32 cmd_delay : 2; // Bits 27:26
+ U32 : 4; // Bits 31:28
+ } UltBits;
+#endif // ULT_FLAG
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_TC_BANK_RANK_D_STRUCT;
+
+typedef union {
+ struct {
+ U32 dis_opp_cas : 1; // Bits 0:0
+ U32 dis_opp_is_cas : 1; // Bits 1:1
+ U32 dis_opp_ras : 1; // Bits 2:2
+ U32 dis_opp_is_ras : 1; // Bits 3:3
+ U32 dis_1c_byp : 1; // Bits 4:4
+ U32 dis_2c_byp : 1; // Bits 5:5
+ U32 dis_deprd_opt : 1; // Bits 6:6
+ U32 dis_pt_it : 1; // Bits 7:7
+ U32 dis_prcnt_ring : 1; // Bits 8:8
+ U32 dis_prcnt_sa : 1; // Bits 9:9
+ U32 dis_blkr_ph : 1; // Bits 10:10
+ U32 dis_blkr_pe : 1; // Bits 11:11
+ U32 dis_blkr_pm : 1; // Bits 12:12
+ U32 dis_odt : 1; // Bits 13:13
+ U32 OE_alw_off : 1; // Bits 14:14
+ U32 : 1; // Bits 15:15
+ U32 dis_aom : 1; // Bits 16:16
+ U32 block_rpq : 1; // Bits 17:17
+ U32 block_wpq : 1; // Bits 18:18
+ U32 invert_align : 1; // Bits 19:19
+ U32 dis_write_gap : 1; // Bits 20:20
+ U32 dis_zq : 1; // Bits 21:21
+ U32 dis_tt : 1; // Bits 22:22
+ U32 dis_opp_ref : 1; // Bits 23:23
+ U32 Long_ZQ : 1; // Bits 24:24
+ U32 dis_srx_zq : 1; // Bits 25:25
+ U32 Serialize_ZQ : 1; // Bits 26:26
+ U32 ZQ_fast_exec : 1; // Bits 27:27
+ U32 Dis_DriveNop : 1; // Bits 28:28
+ U32 Pres_WDB_Ent : 1; // Bits 29:29
+ U32 dis_clk_gate : 1; // Bits 30:30
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_SCHED_CBIT_STRUCT;
+
+typedef union {
+ struct {
+ U32 Lat_R0D0 : 6; // Bits 5:0
+ U32 : 2; // Bits 7:6
+ U32 Lat_R1D0 : 6; // Bits 13:8
+ U32 : 2; // Bits 15:14
+ U32 Lat_R0D1 : 6; // Bits 21:16
+ U32 : 2; // Bits 23:22
+ U32 Lat_R1D1 : 6; // Bits 29:24
+ U32 : 2; // Bits 31:30
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_SC_ROUNDT_LAT_STRUCT;
+
+typedef union {
+ struct {
+ U32 IOLAT_R0D0 : 4; // Bits 3:0
+ U32 IOLAT_R1D0 : 4; // Bits 7:4
+ U32 IOLAT_R0D1 : 4; // Bits 11:8
+ U32 IOLAT_R1D1 : 4; // Bits 15:12
+ U32 RT_IOCOMP : 6; // Bits 21:16
+ U32 : 8; // Bits 29:22
+ U32 three_channels : 1; // Bits 30:30
+ U32 DIS_RT_CLK_GATE : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_SC_IO_LATENCY_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATA : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_ROUND_TRIP_DFT_DATA_STRUCT;
+
+typedef union {
+ struct {
+ U32 WDAR : 1; // Bits 0:0
+ U32 safe_mask_sel : 3; // Bits 3:1
+ U32 force_rcv_en : 1; // Bits 4:4
+ U32 : 3; // Bits 7:5
+ U32 DDR_QUAL : 2; // Bits 9:8
+ U32 Qual_length : 2; // Bits 11:10
+ U32 WDB_Block_En : 1; // Bits 12:12
+ U32 RT_DFT_READ_PTR : 4; // Bits 16:13
+ U32 RT_DFT_READ_ENABLE : 1; // Bits 17:17
+ U32 RT_DFT_READ_SEL_ADDR : 1; // Bits 18:18
+ U32 : 13; // Bits 31:19
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_DFT_MISC_STRUCT;
+
+typedef union {
+ struct {
+ U32 ECC : 8; // Bits 7:0
+ U32 RRD_DFT_Mode : 2; // Bits 9:8
+ U32 LFSR_Seed_Index : 5; // Bits 14:10
+ U32 Inversion_Mode : 1; // Bits 15:15
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_READ_RETURN_DFT_STRUCT;
+
+typedef union {
+ struct {
+ U32 dis_imph_error : 1; // Bits 0:0
+ U32 : 7; // Bits 7:1
+ U32 dis_async_odt : 1; // Bits 8:8
+ U32 : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_SCHED_SECOND_CBIT_STRUCT;
+
+typedef union {
+ struct {
+ U32 Mux0_Control : 2; // Bits 1:0
+ U32 : 1; // Bits 2:2
+ U32 Mux1_Control : 2; // Bits 4:3
+ U32 : 1; // Bits 5:5
+ U32 Mux2_Control : 2; // Bits 7:6
+ U32 : 6; // Bits 13:8
+ U32 ECC_Replace_Byte_Control : 1; // Bits 14:14
+ U32 ECC_Data_Source_Sel : 1; // Bits 15:15
+ U32 Save_LFSR_Seed_Rate : 6; // Bits 21:16
+ U32 : 2; // Bits 23:22
+ U32 Reload_LFSR_Seed_Rate : 3; // Bits 26:24
+ U32 : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_STRUCT;
+
+typedef union {
+ struct {
+ U32 WDB_Current_Read_Pointer : 6; // Bits 5:0
+ U32 : 26; // Bits 31:6
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_RD_STATUS_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 24; // Bits 23:0
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 24; // Bits 23:0
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 24; // Bits 23:0
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 24; // Bits 23:0
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 24; // Bits 23:0
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 24; // Bits 23:0
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 24; // Bits 23:0
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 24; // Bits 23:0
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 24; // Bits 23:0
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 24; // Bits 23:0
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 24; // Bits 23:0
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 24; // Bits 23:0
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_2_STRUCT;
+
+typedef union {
+ struct {
+ U32 L_data_select : 1; // Bits 0:0
+ U32 Enable_Sweep_Frequency : 1; // Bits 1:1
+ U32 : 6; // Bits 7:2
+ U32 L_counter : 8; // Bits 15:8
+ U32 M_counter : 8; // Bits 23:16
+ U32 N_counter : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_STRUCT;
+
+typedef union {
+ struct {
+ U32 ECC_Inv_or_DC_Enable : 8; // Bits 7:0
+ U32 : 8; // Bits 15:8
+ U32 Inv_or_DC_Shift_Rate : 4; // Bits 19:16
+ U32 DC_Polarity_Control : 1; // Bits 20:20
+ U32 : 9; // Bits 29:21
+ U32 Inv_or_DC_Control : 1; // Bits 30:30
+ U32 Inv_or_DC_Shift_Enable : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_PAT_WDB_INV_STRUCT;
+
+typedef union {
+ struct {
+ U64 Data_Inv_or_DC_Enable : 64; // Bits 63:0
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} MCHBAR_CH1_CR_REUT_CH_PAT_WDB_DATA_INV_STRUCT;
+
+typedef union {
+ struct {
+ U32 Stop_on_Nth_Error : 6; // Bits 5:0
+ U32 : 6; // Bits 11:6
+ U32 Stop_On_Error_Control : 2; // Bits 13:12
+ U32 : 2; // Bits 15:14
+ U32 Selective_Error_Enable_Chunk : 8; // Bits 23:16
+ U32 Selective_Error_Enable_Cacheline : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_ERR_CTL_STRUCT;
+
+typedef union {
+ struct {
+ U32 ECC_Error_Mask : 8; // Bits 7:0
+ U32 : 24; // Bits 31:8
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_ERR_ECC_MASK_STRUCT;
+
+typedef union {
+ struct {
+ U32 Stretch_mode : 2; // Bits 1:0
+ U32 : 2; // Bits 3:2
+ U32 STF : 3; // Bits 6:4
+ U32 : 25; // Bits 31:7
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_STM_CONFIG_STRUCT;
+
+typedef union {
+ struct {
+ U32 Priority_count_ring : 10; // Bits 9:0
+ U32 : 6; // Bits 15:10
+ U32 Priority_count_SA : 10; // Bits 25:16
+ U32 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_SC_PR_CNT_CONFIG_STRUCT;
+
+typedef union {
+ struct {
+ U32 PCIT : 8; // Bits 7:0
+ U32 : 24; // Bits 31:8
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_SC_PCIT_STRUCT;
+
+typedef union {
+ struct {
+ U32 PDWN_idle_counter : 12; // Bits 11:0
+ U32 PDWN_mode : 4; // Bits 15:12
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_PM_PDWN_CONFIG_STRUCT;
+
+typedef union {
+ struct {
+ U32 Count : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_ECC_INJECT_COUNT_STRUCT;
+
+typedef union {
+ struct {
+ U32 ECC4ANA_fill : 8; // Bits 7:0
+ U32 ECC4ANA_trigger : 2; // Bits 9:8
+ U32 ECC4ANA_BS : 1; // Bits 10:10
+ U32 ECC_Inject : 3; // Bits 13:11
+ U32 ECC_correction_disable : 1; // Bits 14:14
+ U32 ECC4ANA_Inject : 1; // Bits 15:15
+ U32 DIS_MCA_LOG : 1; // Bits 16:16
+ U32 DIS_PCH_EVENT : 1; // Bits 17:17
+ U32 DIS_PCIE_POISON : 1; // Bits 18:18
+ U32 : 13; // Bits 31:19
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_ECC_DFT_STRUCT;
+
+typedef union {
+ struct {
+ U32 Data : 18; // Bits 17:0
+ U32 : 13; // Bits 30:18
+ U32 VORANGE : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_VISA_CTL_MCSCHEDS_STRUCT;
+
+typedef union {
+ struct {
+ U32 Data : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_VISA_XBAR_MCSCHEDS_STRUCT;
+
+typedef union {
+ struct {
+ U32 CERRSTS : 1; // Bits 0:0
+ U32 MERRSTS : 1; // Bits 1:1
+ U32 : 14; // Bits 15:2
+ U32 ERRSYND : 8; // Bits 23:16
+ U32 ERRCHUNK : 3; // Bits 26:24
+ U32 ERRRANK : 2; // Bits 28:27
+ U32 ERRBANK : 3; // Bits 31:29
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_ECCERRLOG0_STRUCT;
+
+typedef union {
+ struct {
+ U32 ERRROW : 16; // Bits 15:0
+ U32 ERRCOL : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_ECCERRLOG1_STRUCT;
+
+typedef union {
+ struct {
+ U32 D0R0 : 2; // Bits 1:0
+ U32 D0R1 : 2; // Bits 3:2
+ U32 D1R0 : 2; // Bits 5:4
+ U32 D1R1 : 2; // Bits 7:6
+ U32 : 24; // Bits 31:8
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_SC_WR_ADD_DELAY_STRUCT;
+
+typedef union {
+ struct {
+ U32 Dis_Opp_rd : 1; // Bits 0:0
+ U32 ACT_Enable : 1; // Bits 1:1
+ U32 PRE_Enable : 1; // Bits 2:2
+ U32 MAX_RPQ_Cas : 4; // Bits 6:3
+ U32 : 25; // Bits 31:7
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_WMM_READ_CONFIG_STRUCT;
+
+typedef union {
+ struct {
+ U64 Data_Error_Mask : 64; // Bits 63:0
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} MCHBAR_CH1_CR_REUT_CH_ERR_DATA_MASK_STRUCT;
+
+typedef union {
+ struct {
+ U64 Data_Error_Status : 64; // Bits 63:0
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} MCHBAR_CH1_CR_REUT_CH_ERR_DATA_STATUS_STRUCT;
+
+typedef union {
+ struct {
+ U32 ECC_Error_Status : 8; // Bits 7:0
+ U32 Chunk_Error_Status : 8; // Bits 15:8
+ U32 Rank_Error_Status : 4; // Bits 19:16
+ U32 : 12; // Bits 31:20
+ U32 Byte_Group_Error_Status : 9; // Bits 40:32
+ U32 : 11; // Bits 51:41
+ U32 WDB_Rd_Chunk_Num_Status : 3; // Bits 54:52
+ U32 : 1; // Bits 55:55
+ U32 Nth_Error : 6; // Bits 61:56
+ U32 : 2; // Bits 63:62
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} MCHBAR_CH1_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Pointer : 7; // Bits 6:0
+ U32 Counter_Control : 2; // Bits 8:7
+ U32 : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Pointer : 7; // Bits 6:0
+ U32 Counter_Control : 2; // Bits 8:7
+ U32 : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Pointer : 7; // Bits 6:0
+ U32 Counter_Control : 2; // Bits 8:7
+ U32 : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Pointer : 7; // Bits 6:0
+ U32 Counter_Control : 2; // Bits 8:7
+ U32 : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Pointer : 7; // Bits 6:0
+ U32 Counter_Control : 2; // Bits 8:7
+ U32 : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_4_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Pointer : 7; // Bits 6:0
+ U32 Counter_Control : 2; // Bits 8:7
+ U32 : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_5_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Pointer : 7; // Bits 6:0
+ U32 Counter_Control : 2; // Bits 8:7
+ U32 : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_6_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Pointer : 7; // Bits 6:0
+ U32 Counter_Control : 2; // Bits 8:7
+ U32 : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_7_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Pointer : 7; // Bits 6:0
+ U32 Counter_Control : 2; // Bits 8:7
+ U32 : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_8_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Status : 23; // Bits 22:0
+ U32 : 9; // Bits 31:23
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Status : 23; // Bits 22:0
+ U32 : 9; // Bits 31:23
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Status : 23; // Bits 22:0
+ U32 : 9; // Bits 31:23
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Status : 23; // Bits 22:0
+ U32 : 9; // Bits 31:23
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_3_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Status : 23; // Bits 22:0
+ U32 : 9; // Bits 31:23
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_4_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Status : 23; // Bits 22:0
+ U32 : 9; // Bits 31:23
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_5_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Status : 23; // Bits 22:0
+ U32 : 9; // Bits 31:23
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_6_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Status : 23; // Bits 22:0
+ U32 : 9; // Bits 31:23
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_7_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Status : 23; // Bits 22:0
+ U32 : 9; // Bits 31:23
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_8_STRUCT;
+
+typedef union {
+ struct {
+ U32 Counter_Overflow_Status : 9; // Bits 8:0
+ U32 : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_OVERFLOW_STATUS_STRUCT;
+
+typedef union {
+ struct {
+ U32 Column_Address : 10; // Bits 9:0
+ U32 : 14; // Bits 23:10
+ U32 Row_Address : 16; // Bits 39:24
+ U32 : 8; // Bits 47:40
+ U32 Bank_Address : 3; // Bits 50:48
+ U32 : 5; // Bits 55:51
+ U32 Rank_Address : 2; // Bits 57:56
+ U32 : 6; // Bits 63:58
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} MCHBAR_CH1_CR_REUT_CH_ERROR_ADDR_STRUCT;
+
+typedef union {
+ struct {
+ U32 WDB_Current_Error_Pointer : 6; // Bits 5:0
+ U32 : 26; // Bits 31:6
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_ERR_WDB_CAPTURE_STATUS_STRUCT;
+
+typedef union {
+ struct {
+ U32 Enable_WDB_Error_Capture : 1; // Bits 0:0
+ U32 : 7; // Bits 7:1
+ U32 WDB_Starting_Error_Pointer : 6; // Bits 13:8
+ U32 : 2; // Bits 15:14
+ U32 WDB_Ending_Error_Pointer : 6; // Bits 21:16
+ U32 : 10; // Bits 31:22
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_STRUCT;
+
+typedef union {
+ struct {
+ U32 CKE_Override : 4; // Bits 3:0
+ U32 : 4; // Bits 7:4
+ U32 CKE_En_Start_Test_Sync : 1; // Bits 8:8
+ U32 : 7; // Bits 15:9
+ U32 CKE_On : 4; // Bits 19:16
+ U32 : 12; // Bits 31:20
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_MISC_CKE_CTRL_STRUCT;
+
+typedef union {
+ struct {
+ U32 ODT_Override : 4; // Bits 3:0
+ U32 : 12; // Bits 15:4
+ U32 ODT_On : 4; // Bits 19:16
+ U32 : 11; // Bits 30:20
+ U32 MPR_Train_DDR_On : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_MISC_ODT_CTRL_STRUCT;
+
+typedef union {
+ struct {
+ U32 Enable_CADB_on_Deselect : 1; // Bits 0:0
+ U32 Enable_CADB_Always_On : 1; // Bits 1:1
+ U32 CMD_Deselect_Start : 4; // Bits 5:2
+ U32 CMD_Deselect_Stop : 4; // Bits 9:6
+ U32 Lane_Deselect_Enable : 4; // Bits 13:10
+ U32 CAS_Select_Enable : 2; // Bits 15:14
+ U32 ACT_Select_Enable : 2; // Bits 17:16
+ U32 PRE_Select_Enable : 2; // Bits 19:18
+ U32 Save_Current_Seed : 4; // Bits 23:20
+ U32 Reload_Starting_Seed : 4; // Bits 27:24
+ U32 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_STRUCT;
+
+typedef union {
+ struct {
+ U32 MRS_Gap : 3; // Bits 2:0
+ U32 : 5; // Bits 7:3
+ U32 CADB_MRS_Start_Pointer : 3; // Bits 10:8
+ U32 : 5; // Bits 15:11
+ U32 CADB_MRS_End_Pointer : 3; // Bits 18:16
+ U32 : 5; // Bits 23:19
+ U32 CADB_MRS_Current_Pointer : 3; // Bits 26:24
+ U32 : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MRS_STRUCT;
+
+typedef union {
+ struct {
+ U32 Mux0_Control : 2; // Bits 1:0
+ U32 : 2; // Bits 3:2
+ U32 Mux1_Control : 2; // Bits 5:4
+ U32 : 2; // Bits 7:6
+ U32 Mux2_Control : 2; // Bits 9:8
+ U32 : 6; // Bits 15:10
+ U32 Select_Mux0_Control : 2; // Bits 17:16
+ U32 : 2; // Bits 19:18
+ U32 Select_Mux1_Control : 2; // Bits 21:20
+ U32 : 2; // Bits 23:22
+ U32 Select_Mux2_Control : 2; // Bits 25:24
+ U32 : 6; // Bits 31:26
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_CTRL_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 16; // Bits 15:0
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_PB_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 16; // Bits 15:0
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_PB_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 16; // Bits 15:0
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_PB_2_STRUCT;
+
+typedef union {
+ struct {
+ U32 L_data_select : 1; // Bits 0:0
+ U32 Enable_Sweep_Frequency : 1; // Bits 1:1
+ U32 : 6; // Bits 7:2
+ U32 L_counter : 8; // Bits 15:8
+ U32 M_counter : 8; // Bits 23:16
+ U32 N_counter : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_STRUCT;
+
+typedef union {
+ struct {
+ U32 CADB_Write_Pointer : 3; // Bits 2:0
+ U32 : 29; // Bits 31:3
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_PAT_CADB_WRITE_POINTER_STRUCT;
+
+typedef union {
+ struct {
+ U32 CADB_Data_Address : 16; // Bits 15:0
+ U32 : 8; // Bits 23:16
+ U32 CADB_Data_Bank : 3; // Bits 26:24
+ U32 : 5; // Bits 31:27
+ U32 CADB_Data_CS : 4; // Bits 35:32
+ U32 : 4; // Bits 39:36
+ U32 CADB_Data_Control : 3; // Bits 42:40
+ U32 : 5; // Bits 47:43
+ U32 CADB_Data_ODT : 4; // Bits 51:48
+ U32 : 4; // Bits 55:52
+ U32 CADB_Data_CKE : 4; // Bits 59:56
+ U32 : 4; // Bits 63:60
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} MCHBAR_CH1_CR_REUT_CH_PAT_CADB_PROG_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 16; // Bits 15:0
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 16; // Bits 15:0
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pattern_Buffer : 16; // Bits 15:0
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_2_STRUCT;
+
+typedef union {
+ struct {
+ U32 WDB_Increment_Rate : 5; // Bits 4:0
+ U32 WDB_Increment_Scale : 1; // Bits 5:5
+ U32 : 2; // Bits 7:6
+ U32 WDB_Start_Pointer : 6; // Bits 13:8
+ U32 : 2; // Bits 15:14
+ U32 WDB_End_Pointer : 6; // Bits 21:16
+ U32 : 10; // Bits 31:22
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_CTRL_STRUCT;
+
+typedef union {
+ struct {
+ U32 Refresh_Rank_Mask : 4; // Bits 3:0
+ U32 : 4; // Bits 7:4
+ U32 RefZQ_En_Start_Test_Sync : 1; // Bits 8:8
+ U32 : 22; // Bits 30:9
+ U32 Panic_Refresh_Only : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_MISC_REFRESH_CTRL_STRUCT;
+
+typedef union {
+ struct {
+ U32 ZQ_Rank_Mask : 4; // Bits 3:0
+ U32 : 27; // Bits 30:4
+ U32 Always_Do_ZQ : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_REUT_CH_MISC_ZQ_CTRL_STRUCT;
+
+#ifdef ULT_FLAG
+typedef union {
+ struct {
+ U32 Rank_0_x32 : 1; // Bits 0:0
+ U32 Rank_1_x32 : 1; // Bits 1:1
+ U32 Rank_2_x32 : 1; // Bits 2:2
+ U32 Rank_3_x32 : 1; // Bits 3:3
+ U32 LPDDR2 : 1; // Bits 4:4
+ U32 : 3; // Bits 7:5
+ U32 MR4_PERIOD : 16; // Bits 23:8
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_LPDDR_MR_PARAMS_STRUCT;
+
+typedef union {
+ struct {
+ U32 Address : 8; // Bits 7:0
+ U32 Data : 8; // Bits 15:8
+ U32 Rank : 2; // Bits 17:16
+ U32 Write : 1; // Bits 18:18
+ U32 Init_MRW : 1; // Bits 19:19
+ U32 : 11; // Bits 30:20
+ U32 Busy : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_LPDDR_MR_COMMAND_STRUCT;
+
+typedef union {
+ struct {
+ U32 Device_0 : 8; // Bits 7:0
+ U32 Device_1 : 8; // Bits 15:8
+ U32 Device_2 : 8; // Bits 23:16
+ U32 Device_3 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_LPDDR_MR_RESULT_STRUCT;
+
+typedef union {
+ struct {
+ U32 Rank_0 : 3; // Bits 2:0
+ U32 : 5; // Bits 7:3
+ U32 Rank_1 : 3; // Bits 10:8
+ U32 : 5; // Bits 15:11
+ U32 Rank_2 : 3; // Bits 18:16
+ U32 : 5; // Bits 23:19
+ U32 Rank_3 : 3; // Bits 26:24
+ U32 : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_LPDDR_MR4_RANK_TEMPERATURE_STRUCT;
+
+typedef union {
+ struct {
+ U32 Bit_0 : 3; // Bits 2:0
+ U32 : 1; // Bits 3:3
+ U32 Bit_1 : 3; // Bits 6:4
+ U32 : 1; // Bits 7:7
+ U32 Bit_2 : 3; // Bits 10:8
+ U32 : 1; // Bits 11:11
+ U32 Bit_16 : 3; // Bits 14:12
+ U32 : 1; // Bits 15:15
+ U32 Bit_17 : 3; // Bits 18:16
+ U32 : 1; // Bits 19:19
+ U32 Bit_18 : 3; // Bits 22:20
+ U32 : 1; // Bits 23:23
+ U32 Byte_0 : 3; // Bits 26:24
+ U32 : 1; // Bits 27:27
+ U32 Byte_2 : 3; // Bits 30:28
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_DESWIZZLE_LOW_STRUCT;
+
+typedef union {
+ struct {
+ U32 Bit_32 : 3; // Bits 2:0
+ U32 : 1; // Bits 3:3
+ U32 Bit_33 : 3; // Bits 6:4
+ U32 : 1; // Bits 7:7
+ U32 Bit_34 : 3; // Bits 10:8
+ U32 : 1; // Bits 11:11
+ U32 Bit_48 : 3; // Bits 14:12
+ U32 : 1; // Bits 15:15
+ U32 Bit_49 : 3; // Bits 18:16
+ U32 : 1; // Bits 19:19
+ U32 Bit_50 : 3; // Bits 22:20
+ U32 : 1; // Bits 23:23
+ U32 Byte_4 : 3; // Bits 26:24
+ U32 : 1; // Bits 27:27
+ U32 Byte_6 : 3; // Bits 30:28
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_DESWIZZLE_HIGH_STRUCT;
+#endif // ULT_FLAG
+
+typedef union {
+ struct {
+ U32 Ref_Interval : 11; // Bits 10:0
+ U32 Ref_Stagger_En : 1; // Bits 11:11
+ U32 Ref_Stagger_Mode : 1; // Bits 12:12
+ U32 Disable_Stolen_Refresh : 1; // Bits 13:13
+ U32 En_Ref_Type_Display : 1; // Bits 14:14
+ U32 : 17; // Bits 31:15
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_MC_REFRESH_STAGGER_STRUCT;
+
+typedef union {
+ struct {
+ U32 ZQCS_period : 8; // Bits 7:0
+ U32 tZQCS : 8; // Bits 15:8
+ U32 : 16; // Bits 31:16
+ } Bits;
+#ifdef ULT_FLAG
+ struct {
+ U32 ZQCS_period : 10; // Bits 9:0
+ U32 tZQCS : 10; // Bits 19:10
+ U32 : 12; // Bits 31:20
+ } UltBits;
+#endif //ULT_FLAG
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_TC_ZQCAL_STRUCT;
+
+typedef union {
+ struct {
+ U32 OREF_RI : 8; // Bits 7:0
+ U32 Refresh_HP_WM : 4; // Bits 11:8
+ U32 Refresh_panic_wm : 4; // Bits 15:12
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_TC_RFP_STRUCT;
+
+typedef union {
+ struct {
+ U32 tREFI : 16; // Bits 15:0
+ U32 tRFC : 9; // Bits 24:16
+ U32 tREFIx9 : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_TC_RFTP_STRUCT;
+
+typedef union {
+ struct {
+ U32 MR2_sh_low : 6; // Bits 5:0
+ U32 SRT_avail : 2; // Bits 7:6
+ U32 MR2_sh_high : 3; // Bits 10:8
+ U32 : 3; // Bits 13:11
+ U32 Addr_bit_swizzle : 2; // Bits 15:14
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_TC_MR2_SHADDOW_STRUCT;
+
+typedef union {
+ struct {
+ U32 Rank_occupancy : 4; // Bits 3:0
+ U32 : 28; // Bits 31:4
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_MC_INIT_STATE_STRUCT;
+
+typedef union {
+ struct {
+ U32 tXSDLL : 12; // Bits 11:0
+ U32 tXS_offset : 4; // Bits 15:12
+ U32 tZQOPER : 10; // Bits 25:16
+ U32 : 2; // Bits 27:26
+ U32 tMOD : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_TC_SRFTP_STRUCT;
+
+typedef union {
+ struct {
+ U32 VISAByteSel : 3; // Bits 2:0
+ U32 : 29; // Bits 31:3
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_WDB_VISA_SEL_STRUCT;
+
+typedef union {
+ struct {
+ U32 FASTADDR : 12; // Bits 11:0
+ U32 : 4; // Bits 15:12
+ U32 ADDREN : 1; // Bits 16:16
+ U32 SEQEN : 1; // Bits 17:17
+ U32 POL0 : 1; // Bits 18:18
+ U32 POL1 : 1; // Bits 19:19
+ U32 CMDA : 4; // Bits 23:20
+ U32 CMDB : 4; // Bits 27:24
+ U32 CMDC : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_DCLK_LDAT_PDAT_STRUCT;
+
+typedef union {
+ struct {
+ U32 BANKSEL : 4; // Bits 3:0
+ U32 : 1; // Bits 4:4
+ U32 ARRAYSEL : 5; // Bits 9:5
+ U32 CMP : 1; // Bits 10:10
+ U32 REP : 1; // Bits 11:11
+ U32 DWORD : 4; // Bits 15:12
+ U32 MODE : 2; // Bits 17:16
+ U32 MPMAP : 6; // Bits 23:18
+ U32 MPBOFFSET : 4; // Bits 27:24
+ U32 STAGE_EN : 1; // Bits 28:28
+ U32 SHADOW : 2; // Bits 30:29
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_DCLK_LDAT_SDAT_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATOUT : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_DCLK_LDAT_DATAOUT_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATIN : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_DCLK_LDAT_DATAIN_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 FASTADDR : 12; // Bits 11:0
+ U32 : 4; // Bits 15:12
+ U32 ADDREN : 1; // Bits 16:16
+ U32 SEQEN : 1; // Bits 17:17
+ U32 POL0 : 1; // Bits 18:18
+ U32 POL1 : 1; // Bits 19:19
+ U32 CMDA : 4; // Bits 23:20
+ U32 CMDB : 4; // Bits 27:24
+ U32 CMDC : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_QCLK_LDAT_PDAT_STRUCT;
+
+typedef union {
+ struct {
+ U32 BANKSEL : 4; // Bits 3:0
+ U32 : 1; // Bits 4:4
+ U32 ARRAYSEL : 5; // Bits 9:5
+ U32 CMP : 1; // Bits 10:10
+ U32 REP : 1; // Bits 11:11
+ U32 DWORD : 4; // Bits 15:12
+ U32 MODE : 2; // Bits 17:16
+ U32 MPMAP : 6; // Bits 23:18
+ U32 MPBOFFSET : 4; // Bits 27:24
+ U32 STAGE_EN : 1; // Bits 28:28
+ U32 SHADOW : 2; // Bits 30:29
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_QCLK_LDAT_SDAT_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATOUT : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_QCLK_LDAT_DATAOUT_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATIN : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_QCLK_LDAT_DATAIN_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATIN : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_QCLK_LDAT_DATAIN_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 RPQ_disable : 28; // Bits 27:0
+ U32 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_QUEUE_ENTRY_DISABLE_RPQ_STRUCT;
+
+typedef union {
+ struct {
+ U32 WPQ_disable : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_QUEUE_ENTRY_DISABLE_WPQ_STRUCT;
+
+typedef union {
+ struct {
+ U32 DIMM0_IDLE_ENERGY : 6; // Bits 5:0
+ U32 : 2; // Bits 7:6
+ U32 DIMM1_IDLE_ENERGY : 6; // Bits 13:8
+ U32 : 18; // Bits 31:14
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_PM_DIMM_IDLE_ENERGY_STRUCT;
+
+typedef union {
+ struct {
+ U32 DIMM0_PD_ENERGY : 6; // Bits 5:0
+ U32 : 2; // Bits 7:6
+ U32 DIMM1_PD_ENERGY : 6; // Bits 13:8
+ U32 : 18; // Bits 31:14
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_PM_DIMM_PD_ENERGY_STRUCT;
+
+typedef union {
+ struct {
+ U32 DIMM0_ACT_ENERGY : 8; // Bits 7:0
+ U32 DIMM1_ACT_ENERGY : 8; // Bits 15:8
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_PM_DIMM_ACT_ENERGY_STRUCT;
+
+typedef union {
+ struct {
+ U32 DIMM0_RD_ENERGY : 8; // Bits 7:0
+ U32 DIMM1_RD_ENERGY : 8; // Bits 15:8
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_PM_DIMM_RD_ENERGY_STRUCT;
+
+typedef union {
+ struct {
+ U32 DIMM0_WR_ENERGY : 8; // Bits 7:0
+ U32 DIMM1_WR_ENERGY : 8; // Bits 15:8
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_PM_DIMM_WR_ENERGY_STRUCT;
+
+typedef union {
+ struct {
+ U32 CKE_MIN : 8; // Bits 7:0
+ U32 CKE_MIN_DEFEATURE : 1; // Bits 8:8
+ U32 : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_PM_THRT_CKE_MIN_STRUCT;
+
+typedef union {
+ struct {
+ U32 ODT : 4; // Bits 3:0
+ U32 Web : 1; // Bits 4:4
+ U32 CASb : 1; // Bits 5:5
+ U32 RASb : 1; // Bits 6:6
+ U32 CSb : 4; // Bits 10:7
+ U32 CKE : 4; // Bits 14:11
+ U32 MA : 16; // Bits 30:15
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_ODLAT_CMD_MATCH0_STRUCT;
+
+typedef union {
+ struct {
+ U32 ODT : 4; // Bits 3:0
+ U32 Web : 1; // Bits 4:4
+ U32 CASb : 1; // Bits 5:5
+ U32 RASb : 1; // Bits 6:6
+ U32 CSb : 4; // Bits 10:7
+ U32 CKE : 4; // Bits 14:11
+ U32 MA : 16; // Bits 30:15
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_ODLAT_CMD_MATCH1_STRUCT;
+
+typedef union {
+ struct {
+ U32 ODT : 4; // Bits 3:0
+ U32 Web : 1; // Bits 4:4
+ U32 CASb : 1; // Bits 5:5
+ U32 RASb : 1; // Bits 6:6
+ U32 CSb : 4; // Bits 10:7
+ U32 CKE : 4; // Bits 14:11
+ U32 MA : 16; // Bits 30:15
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_ODLAT_CMD_MATCH2_STRUCT;
+
+typedef union {
+ struct {
+ U32 ODT : 4; // Bits 3:0
+ U32 Web : 1; // Bits 4:4
+ U32 CASb : 1; // Bits 5:5
+ U32 RASb : 1; // Bits 6:6
+ U32 CSb : 4; // Bits 10:7
+ U32 CKE : 4; // Bits 14:11
+ U32 MA : 16; // Bits 30:15
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_ODLAT_CMD_MATCH3_STRUCT;
+
+typedef union {
+ struct {
+ U32 ODT : 4; // Bits 3:0
+ U32 Web : 1; // Bits 4:4
+ U32 CASb : 1; // Bits 5:5
+ U32 RASb : 1; // Bits 6:6
+ U32 CSb : 4; // Bits 10:7
+ U32 CKE : 4; // Bits 14:11
+ U32 MA : 16; // Bits 30:15
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_ODLAT_CMD_MASK0_STRUCT;
+
+typedef union {
+ struct {
+ U32 ODT : 4; // Bits 3:0
+ U32 Web : 1; // Bits 4:4
+ U32 CASb : 1; // Bits 5:5
+ U32 RASb : 1; // Bits 6:6
+ U32 CSb : 4; // Bits 10:7
+ U32 CKE : 4; // Bits 14:11
+ U32 MA : 16; // Bits 30:15
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_ODLAT_CMD_MASK1_STRUCT;
+
+typedef union {
+ struct {
+ U32 ODT : 4; // Bits 3:0
+ U32 Web : 1; // Bits 4:4
+ U32 CASb : 1; // Bits 5:5
+ U32 RASb : 1; // Bits 6:6
+ U32 CSb : 4; // Bits 10:7
+ U32 CKE : 4; // Bits 14:11
+ U32 MA : 16; // Bits 30:15
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_ODLAT_CMD_MASK2_STRUCT;
+
+typedef union {
+ struct {
+ U32 ODT : 4; // Bits 3:0
+ U32 Web : 1; // Bits 4:4
+ U32 CASb : 1; // Bits 5:5
+ U32 RASb : 1; // Bits 6:6
+ U32 CSb : 4; // Bits 10:7
+ U32 CKE : 4; // Bits 14:11
+ U32 MA : 16; // Bits 30:15
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_ODLAT_CMD_MASK3_STRUCT;
+
+typedef union {
+ struct {
+ U32 BankMatch0 : 3; // Bits 2:0
+ U32 BankMatch1 : 3; // Bits 5:3
+ U32 BankMatch2 : 3; // Bits 8:6
+ U32 BankMatch3 : 3; // Bits 11:9
+ U32 BankMask0 : 3; // Bits 14:12
+ U32 BankMask1 : 3; // Bits 17:15
+ U32 BankMask2 : 3; // Bits 20:18
+ U32 BankMask3 : 3; // Bits 23:21
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_ODLAT_CMD_BANK_STRUCT;
+
+typedef union {
+ struct {
+ U32 InputMatch : 4; // Bits 3:0
+ U32 InputInvert : 4; // Bits 7:4
+ U32 CountMatches : 1; // Bits 8:8
+ U32 CounterThreshold : 15; // Bits 23:9
+ U32 CounterAction : 2; // Bits 25:24
+ U32 CounterNextState : 2; // Bits 27:26
+ U32 MatchAction : 2; // Bits 29:28
+ U32 MatchNextState : 2; // Bits 31:30
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL0_STRUCT;
+
+typedef union {
+ struct {
+ U32 InputMatch : 4; // Bits 3:0
+ U32 InputInvert : 4; // Bits 7:4
+ U32 CountMatches : 1; // Bits 8:8
+ U32 CounterThreshold : 15; // Bits 23:9
+ U32 CounterAction : 2; // Bits 25:24
+ U32 CounterNextState : 2; // Bits 27:26
+ U32 MatchAction : 2; // Bits 29:28
+ U32 MatchNextState : 2; // Bits 31:30
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL1_STRUCT;
+
+typedef union {
+ struct {
+ U32 InputMatch : 4; // Bits 3:0
+ U32 InputInvert : 4; // Bits 7:4
+ U32 CountMatches : 1; // Bits 8:8
+ U32 CounterThreshold : 15; // Bits 23:9
+ U32 CounterAction : 2; // Bits 25:24
+ U32 CounterNextState : 2; // Bits 27:26
+ U32 MatchAction : 2; // Bits 29:28
+ U32 MatchNextState : 2; // Bits 31:30
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL2_STRUCT;
+
+typedef union {
+ struct {
+ U32 InputMatch : 4; // Bits 3:0
+ U32 InputInvert : 4; // Bits 7:4
+ U32 CountMatches : 1; // Bits 8:8
+ U32 CounterThreshold : 15; // Bits 23:9
+ U32 CounterAction : 2; // Bits 25:24
+ U32 CounterNextState : 2; // Bits 27:26
+ U32 MatchAction : 2; // Bits 29:28
+ U32 MatchNextState : 2; // Bits 31:30
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL3_STRUCT;
+
+typedef union {
+ struct {
+ U32 TriggerBlockEnable : 1; // Bits 0:0
+ U32 GlobalCounterThreshold : 16; // Bits 16:1
+ U32 : 15; // Bits 31:17
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_ODLAT_SEQ_GLOBAL_STRUCT;
+
+typedef union {
+ struct {
+ U32 WMM_Enter : 8; // Bits 7:0
+ U32 WMM_Exit : 8; // Bits 15:8
+ U32 WPQ_IS : 8; // Bits 23:16
+ U32 Starve_count : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_SC_WDBWM_STRUCT;
+
+typedef union {
+ struct {
+ U32 Data : 18; // Bits 17:0
+ U32 : 13; // Bits 30:18
+ U32 VORANGE : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MCHBAR_CH1_CR_VISA_CTL_MCMNTS_STRUCT;
+
+#define MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_REG (0x00004800)
+ #define MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_Global_Start_Test_OFF ( 0)
+ #define MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_Global_Start_Test_WID ( 1)
+ #define MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_Global_Start_Test_MSK (0x00000001)
+ #define MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_Global_Start_Test_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_Global_Start_Test_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_Global_Stop_Test_OFF ( 1)
+ #define MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_Global_Stop_Test_WID ( 1)
+ #define MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_Global_Stop_Test_MSK (0x00000002)
+ #define MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_Global_Stop_Test_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_Global_Stop_Test_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_Global_Clear_Errors_OFF ( 2)
+ #define MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_Global_Clear_Errors_WID ( 1)
+ #define MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_Global_Clear_Errors_MSK (0x00000004)
+ #define MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_Global_Clear_Errors_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_Global_Clear_Errors_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_Global_Stop_Test_On_Any_Error_OFF ( 4)
+ #define MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_Global_Stop_Test_On_Any_Error_WID ( 1)
+ #define MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_Global_Stop_Test_On_Any_Error_MSK (0x00000010)
+ #define MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_Global_Stop_Test_On_Any_Error_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_Global_Stop_Test_On_Any_Error_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_GLOBAL_ERR_MCMAIN_REG (0x00004804)
+ #define MCDFXS_CR_REUT_GLOBAL_ERR_MCMAIN_Channel_Error_Status_0_OFF ( 0)
+ #define MCDFXS_CR_REUT_GLOBAL_ERR_MCMAIN_Channel_Error_Status_0_WID ( 1)
+ #define MCDFXS_CR_REUT_GLOBAL_ERR_MCMAIN_Channel_Error_Status_0_MSK (0x00000001)
+ #define MCDFXS_CR_REUT_GLOBAL_ERR_MCMAIN_Channel_Error_Status_0_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_GLOBAL_ERR_MCMAIN_Channel_Error_Status_0_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_GLOBAL_ERR_MCMAIN_Channel_Error_Status_1_OFF ( 1)
+ #define MCDFXS_CR_REUT_GLOBAL_ERR_MCMAIN_Channel_Error_Status_1_WID ( 1)
+ #define MCDFXS_CR_REUT_GLOBAL_ERR_MCMAIN_Channel_Error_Status_1_MSK (0x00000002)
+ #define MCDFXS_CR_REUT_GLOBAL_ERR_MCMAIN_Channel_Error_Status_1_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_GLOBAL_ERR_MCMAIN_Channel_Error_Status_1_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_GLOBAL_ERR_MCMAIN_Channel_Test_Done_Status_0_OFF (16)
+ #define MCDFXS_CR_REUT_GLOBAL_ERR_MCMAIN_Channel_Test_Done_Status_0_WID ( 1)
+ #define MCDFXS_CR_REUT_GLOBAL_ERR_MCMAIN_Channel_Test_Done_Status_0_MSK (0x00010000)
+ #define MCDFXS_CR_REUT_GLOBAL_ERR_MCMAIN_Channel_Test_Done_Status_0_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_GLOBAL_ERR_MCMAIN_Channel_Test_Done_Status_0_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_GLOBAL_ERR_MCMAIN_Channel_Test_Done_Status_1_OFF (17)
+ #define MCDFXS_CR_REUT_GLOBAL_ERR_MCMAIN_Channel_Test_Done_Status_1_WID ( 1)
+ #define MCDFXS_CR_REUT_GLOBAL_ERR_MCMAIN_Channel_Test_Done_Status_1_MSK (0x00020000)
+ #define MCDFXS_CR_REUT_GLOBAL_ERR_MCMAIN_Channel_Test_Done_Status_1_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_GLOBAL_ERR_MCMAIN_Channel_Test_Done_Status_1_DEF (0x00000001)
+
+#define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_REG (0x00004808)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Number_of_Cachelines_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Number_of_Cachelines_WID ( 7)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Number_of_Cachelines_MSK (0x0000007F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Number_of_Cachelines_MAX (0x0000007F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Number_of_Cachelines_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Number_of_Cachelines_Scale_OFF ( 7)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Number_of_Cachelines_Scale_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Number_of_Cachelines_Scale_MSK (0x00000080)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Number_of_Cachelines_Scale_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Number_of_Cachelines_Scale_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Subsequence_Wait_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Subsequence_Wait_WID (10)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Subsequence_Wait_MSK (0x0003FF00)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Subsequence_Wait_MAX (0x000003FF)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Subsequence_Wait_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Subsequence_Type_OFF (20)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Subsequence_Type_WID ( 4)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Subsequence_Type_MSK (0x00F00000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Subsequence_Type_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Subsequence_Type_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Save_Current_Base_Address_To_Start_OFF (25)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Save_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Save_Current_Base_Address_To_Start_MSK (0x02000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Save_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Save_Current_Base_Address_To_Start_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Reset_Current_Base_Address_To_Start_OFF (26)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Reset_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Reset_Current_Base_Address_To_Start_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Reset_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Reset_Current_Base_Address_To_Start_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Data_and_ECC_Address_Inversion_OFF (27)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Data_and_ECC_Address_Inversion_WID ( 2)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Data_and_ECC_Address_Inversion_MSK (0x18000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Data_and_ECC_Address_Inversion_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Data_and_ECC_Address_Inversion_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Invert_Data_and_ECC_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_OFF (31)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_MSK (0x80000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_DEF (0x00000000)
+
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Number_of_Cachelines_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Number_of_Cachelines_WID ( 7)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Number_of_Cachelines_MSK (0x0000007F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Number_of_Cachelines_MAX (0x0000007F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Number_of_Cachelines_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Number_of_Cachelines_Scale_OFF ( 7)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Number_of_Cachelines_Scale_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Number_of_Cachelines_Scale_MSK (0x00000080)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Number_of_Cachelines_Scale_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Number_of_Cachelines_Scale_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Subsequence_Wait_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Subsequence_Wait_WID (14)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Subsequence_Wait_MSK (0x003FFF00)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Subsequence_Wait_MAX (0x00003FFF)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Subsequence_Wait_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Subsequence_Type_OFF (22)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Subsequence_Type_WID ( 4)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Subsequence_Type_MSK (0x03C00000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Subsequence_Type_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Subsequence_Type_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Save_Current_Base_Address_To_Start_OFF (26)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Save_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Save_Current_Base_Address_To_Start_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Save_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Save_Current_Base_Address_To_Start_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Reset_Current_Base_Address_To_Start_OFF (27)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Reset_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Reset_Current_Base_Address_To_Start_MSK (0x08000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Reset_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Reset_Current_Base_Address_To_Start_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Data_and_ECC_Address_Inversion_OFF (28)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Data_and_ECC_Address_Inversion_WID ( 2)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Data_and_ECC_Address_Inversion_MSK (0x30000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Data_and_ECC_Address_Inversion_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Data_and_ECC_Address_Inversion_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Invert_Data_and_ECC_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Stop_Base_Subsequence_On_Wrap_Trigger_OFF (31)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Stop_Base_Subsequence_On_Wrap_Trigger_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Stop_Base_Subsequence_On_Wrap_Trigger_MSK (0x80000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Stop_Base_Subsequence_On_Wrap_Trigger_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_Stop_Base_Subsequence_On_Wrap_Trigger_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_REG (0x0000480C)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Number_of_Cachelines_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Number_of_Cachelines_WID ( 7)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Number_of_Cachelines_MSK (0x0000007F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Number_of_Cachelines_MAX (0x0000007F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Number_of_Cachelines_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Number_of_Cachelines_Scale_OFF ( 7)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Number_of_Cachelines_Scale_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Number_of_Cachelines_Scale_MSK (0x00000080)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Number_of_Cachelines_Scale_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Number_of_Cachelines_Scale_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Subsequence_Wait_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Subsequence_Wait_WID (10)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Subsequence_Wait_MSK (0x0003FF00)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Subsequence_Wait_MAX (0x000003FF)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Subsequence_Wait_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Subsequence_Type_OFF (20)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Subsequence_Type_WID ( 4)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Subsequence_Type_MSK (0x00F00000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Subsequence_Type_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Subsequence_Type_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Save_Current_Base_Address_To_Start_OFF (25)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Save_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Save_Current_Base_Address_To_Start_MSK (0x02000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Save_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Save_Current_Base_Address_To_Start_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Reset_Current_Base_Address_To_Start_OFF (26)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Reset_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Reset_Current_Base_Address_To_Start_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Reset_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Reset_Current_Base_Address_To_Start_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Data_and_ECC_Address_Inversion_OFF (27)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Data_and_ECC_Address_Inversion_WID ( 2)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Data_and_ECC_Address_Inversion_MSK (0x18000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Data_and_ECC_Address_Inversion_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Data_and_ECC_Address_Inversion_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Invert_Data_and_ECC_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_OFF (31)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_MSK (0x80000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_DEF (0x00000000)
+
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Number_of_Cachelines_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Number_of_Cachelines_WID ( 7)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Number_of_Cachelines_MSK (0x0000007F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Number_of_Cachelines_MAX (0x0000007F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Number_of_Cachelines_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Number_of_Cachelines_Scale_OFF ( 7)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Number_of_Cachelines_Scale_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Number_of_Cachelines_Scale_MSK (0x00000080)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Number_of_Cachelines_Scale_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Number_of_Cachelines_Scale_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Subsequence_Wait_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Subsequence_Wait_WID (14)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Subsequence_Wait_MSK (0x003FFF00)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Subsequence_Wait_MAX (0x00003FFF)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Subsequence_Wait_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Subsequence_Type_OFF (22)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Subsequence_Type_WID ( 4)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Subsequence_Type_MSK (0x03C00000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Subsequence_Type_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Subsequence_Type_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Save_Current_Base_Address_To_Start_OFF (26)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Save_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Save_Current_Base_Address_To_Start_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Save_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Save_Current_Base_Address_To_Start_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Reset_Current_Base_Address_To_Start_OFF (27)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Reset_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Reset_Current_Base_Address_To_Start_MSK (0x08000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Reset_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Reset_Current_Base_Address_To_Start_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Data_and_ECC_Address_Inversion_OFF (28)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Data_and_ECC_Address_Inversion_WID ( 2)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Data_and_ECC_Address_Inversion_MSK (0x30000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Data_and_ECC_Address_Inversion_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Data_and_ECC_Address_Inversion_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Invert_Data_and_ECC_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Stop_Base_Subsequence_On_Wrap_Trigger_OFF (31)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Stop_Base_Subsequence_On_Wrap_Trigger_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Stop_Base_Subsequence_On_Wrap_Trigger_MSK (0x80000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Stop_Base_Subsequence_On_Wrap_Trigger_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_Stop_Base_Subsequence_On_Wrap_Trigger_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_REG (0x00004810)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Number_of_Cachelines_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Number_of_Cachelines_WID ( 7)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Number_of_Cachelines_MSK (0x0000007F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Number_of_Cachelines_MAX (0x0000007F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Number_of_Cachelines_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Number_of_Cachelines_Scale_OFF ( 7)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Number_of_Cachelines_Scale_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Number_of_Cachelines_Scale_MSK (0x00000080)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Number_of_Cachelines_Scale_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Number_of_Cachelines_Scale_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Subsequence_Wait_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Subsequence_Wait_WID (10)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Subsequence_Wait_MSK (0x0003FF00)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Subsequence_Wait_MAX (0x000003FF)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Subsequence_Wait_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Subsequence_Type_OFF (20)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Subsequence_Type_WID ( 4)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Subsequence_Type_MSK (0x00F00000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Subsequence_Type_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Subsequence_Type_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Save_Current_Base_Address_To_Start_OFF (25)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Save_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Save_Current_Base_Address_To_Start_MSK (0x02000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Save_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Save_Current_Base_Address_To_Start_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Reset_Current_Base_Address_To_Start_OFF (26)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Reset_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Reset_Current_Base_Address_To_Start_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Reset_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Reset_Current_Base_Address_To_Start_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Data_and_ECC_Address_Inversion_OFF (27)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Data_and_ECC_Address_Inversion_WID ( 2)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Data_and_ECC_Address_Inversion_MSK (0x18000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Data_and_ECC_Address_Inversion_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Data_and_ECC_Address_Inversion_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Invert_Data_and_ECC_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_OFF (31)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_MSK (0x80000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_DEF (0x00000000)
+
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Number_of_Cachelines_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Number_of_Cachelines_WID ( 7)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Number_of_Cachelines_MSK (0x0000007F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Number_of_Cachelines_MAX (0x0000007F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Number_of_Cachelines_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Number_of_Cachelines_Scale_OFF ( 7)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Number_of_Cachelines_Scale_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Number_of_Cachelines_Scale_MSK (0x00000080)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Number_of_Cachelines_Scale_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Number_of_Cachelines_Scale_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Subsequence_Wait_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Subsequence_Wait_WID (14)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Subsequence_Wait_MSK (0x003FFF00)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Subsequence_Wait_MAX (0x00003FFF)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Subsequence_Wait_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Subsequence_Type_OFF (22)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Subsequence_Type_WID ( 4)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Subsequence_Type_MSK (0x03C00000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Subsequence_Type_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Subsequence_Type_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Save_Current_Base_Address_To_Start_OFF (26)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Save_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Save_Current_Base_Address_To_Start_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Save_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Save_Current_Base_Address_To_Start_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Reset_Current_Base_Address_To_Start_OFF (27)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Reset_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Reset_Current_Base_Address_To_Start_MSK (0x08000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Reset_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Reset_Current_Base_Address_To_Start_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Data_and_ECC_Address_Inversion_OFF (28)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Data_and_ECC_Address_Inversion_WID ( 2)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Data_and_ECC_Address_Inversion_MSK (0x30000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Data_and_ECC_Address_Inversion_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Data_and_ECC_Address_Inversion_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Invert_Data_and_ECC_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Stop_Base_Subsequence_On_Wrap_Trigger_OFF (31)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Stop_Base_Subsequence_On_Wrap_Trigger_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Stop_Base_Subsequence_On_Wrap_Trigger_MSK (0x80000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Stop_Base_Subsequence_On_Wrap_Trigger_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_2_Stop_Base_Subsequence_On_Wrap_Trigger_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_REG (0x00004814)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Number_of_Cachelines_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Number_of_Cachelines_WID ( 7)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Number_of_Cachelines_MSK (0x0000007F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Number_of_Cachelines_MAX (0x0000007F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Number_of_Cachelines_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Number_of_Cachelines_Scale_OFF ( 7)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Number_of_Cachelines_Scale_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Number_of_Cachelines_Scale_MSK (0x00000080)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Number_of_Cachelines_Scale_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Number_of_Cachelines_Scale_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Subsequence_Wait_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Subsequence_Wait_WID (10)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Subsequence_Wait_MSK (0x0003FF00)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Subsequence_Wait_MAX (0x000003FF)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Subsequence_Wait_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Subsequence_Type_OFF (20)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Subsequence_Type_WID ( 4)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Subsequence_Type_MSK (0x00F00000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Subsequence_Type_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Subsequence_Type_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Save_Current_Base_Address_To_Start_OFF (25)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Save_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Save_Current_Base_Address_To_Start_MSK (0x02000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Save_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Save_Current_Base_Address_To_Start_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Reset_Current_Base_Address_To_Start_OFF (26)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Reset_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Reset_Current_Base_Address_To_Start_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Reset_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Reset_Current_Base_Address_To_Start_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Data_and_ECC_Address_Inversion_OFF (27)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Data_and_ECC_Address_Inversion_WID ( 2)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Data_and_ECC_Address_Inversion_MSK (0x18000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Data_and_ECC_Address_Inversion_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Data_and_ECC_Address_Inversion_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Invert_Data_and_ECC_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_OFF (31)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_MSK (0x80000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_DEF (0x00000000)
+
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Number_of_Cachelines_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Number_of_Cachelines_WID ( 7)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Number_of_Cachelines_MSK (0x0000007F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Number_of_Cachelines_MAX (0x0000007F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Number_of_Cachelines_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Number_of_Cachelines_Scale_OFF ( 7)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Number_of_Cachelines_Scale_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Number_of_Cachelines_Scale_MSK (0x00000080)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Number_of_Cachelines_Scale_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Number_of_Cachelines_Scale_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Subsequence_Wait_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Subsequence_Wait_WID (14)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Subsequence_Wait_MSK (0x003FFF00)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Subsequence_Wait_MAX (0x00003FFF)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Subsequence_Wait_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Subsequence_Type_OFF (22)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Subsequence_Type_WID ( 4)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Subsequence_Type_MSK (0x03C00000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Subsequence_Type_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Subsequence_Type_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Save_Current_Base_Address_To_Start_OFF (26)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Save_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Save_Current_Base_Address_To_Start_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Save_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Save_Current_Base_Address_To_Start_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Reset_Current_Base_Address_To_Start_OFF (27)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Reset_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Reset_Current_Base_Address_To_Start_MSK (0x08000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Reset_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Reset_Current_Base_Address_To_Start_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Data_and_ECC_Address_Inversion_OFF (28)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Data_and_ECC_Address_Inversion_WID ( 2)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Data_and_ECC_Address_Inversion_MSK (0x30000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Data_and_ECC_Address_Inversion_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Data_and_ECC_Address_Inversion_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Invert_Data_and_ECC_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Stop_Base_Subsequence_On_Wrap_Trigger_OFF (31)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Stop_Base_Subsequence_On_Wrap_Trigger_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Stop_Base_Subsequence_On_Wrap_Trigger_MSK (0x80000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Stop_Base_Subsequence_On_Wrap_Trigger_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_3_Stop_Base_Subsequence_On_Wrap_Trigger_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_REG (0x00004818)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Number_of_Cachelines_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Number_of_Cachelines_WID ( 7)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Number_of_Cachelines_MSK (0x0000007F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Number_of_Cachelines_MAX (0x0000007F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Number_of_Cachelines_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Number_of_Cachelines_Scale_OFF ( 7)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Number_of_Cachelines_Scale_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Number_of_Cachelines_Scale_MSK (0x00000080)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Number_of_Cachelines_Scale_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Number_of_Cachelines_Scale_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Subsequence_Wait_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Subsequence_Wait_WID (10)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Subsequence_Wait_MSK (0x0003FF00)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Subsequence_Wait_MAX (0x000003FF)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Subsequence_Wait_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Subsequence_Type_OFF (20)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Subsequence_Type_WID ( 4)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Subsequence_Type_MSK (0x00F00000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Subsequence_Type_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Subsequence_Type_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Save_Current_Base_Address_To_Start_OFF (25)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Save_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Save_Current_Base_Address_To_Start_MSK (0x02000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Save_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Save_Current_Base_Address_To_Start_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Reset_Current_Base_Address_To_Start_OFF (26)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Reset_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Reset_Current_Base_Address_To_Start_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Reset_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Reset_Current_Base_Address_To_Start_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Data_and_ECC_Address_Inversion_OFF (27)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Data_and_ECC_Address_Inversion_WID ( 2)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Data_and_ECC_Address_Inversion_MSK (0x18000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Data_and_ECC_Address_Inversion_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Data_and_ECC_Address_Inversion_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Invert_Data_and_ECC_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_OFF (31)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_MSK (0x80000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_DEF (0x00000000)
+
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Number_of_Cachelines_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Number_of_Cachelines_WID ( 7)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Number_of_Cachelines_MSK (0x0000007F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Number_of_Cachelines_MAX (0x0000007F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Number_of_Cachelines_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Number_of_Cachelines_Scale_OFF ( 7)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Number_of_Cachelines_Scale_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Number_of_Cachelines_Scale_MSK (0x00000080)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Number_of_Cachelines_Scale_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Number_of_Cachelines_Scale_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Subsequence_Wait_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Subsequence_Wait_WID (14)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Subsequence_Wait_MSK (0x003FFF00)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Subsequence_Wait_MAX (0x00003FFF)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Subsequence_Wait_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Subsequence_Type_OFF (22)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Subsequence_Type_WID ( 4)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Subsequence_Type_MSK (0x03C00000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Subsequence_Type_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Subsequence_Type_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Save_Current_Base_Address_To_Start_OFF (26)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Save_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Save_Current_Base_Address_To_Start_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Save_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Save_Current_Base_Address_To_Start_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Reset_Current_Base_Address_To_Start_OFF (27)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Reset_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Reset_Current_Base_Address_To_Start_MSK (0x08000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Reset_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Reset_Current_Base_Address_To_Start_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Data_and_ECC_Address_Inversion_OFF (28)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Data_and_ECC_Address_Inversion_WID ( 2)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Data_and_ECC_Address_Inversion_MSK (0x30000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Data_and_ECC_Address_Inversion_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Data_and_ECC_Address_Inversion_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Invert_Data_and_ECC_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Stop_Base_Subsequence_On_Wrap_Trigger_OFF (31)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Stop_Base_Subsequence_On_Wrap_Trigger_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Stop_Base_Subsequence_On_Wrap_Trigger_MSK (0x80000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Stop_Base_Subsequence_On_Wrap_Trigger_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_4_Stop_Base_Subsequence_On_Wrap_Trigger_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_REG (0x0000481C)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Number_of_Cachelines_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Number_of_Cachelines_WID ( 7)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Number_of_Cachelines_MSK (0x0000007F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Number_of_Cachelines_MAX (0x0000007F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Number_of_Cachelines_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Number_of_Cachelines_Scale_OFF ( 7)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Number_of_Cachelines_Scale_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Number_of_Cachelines_Scale_MSK (0x00000080)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Number_of_Cachelines_Scale_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Number_of_Cachelines_Scale_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Subsequence_Wait_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Subsequence_Wait_WID (10)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Subsequence_Wait_MSK (0x0003FF00)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Subsequence_Wait_MAX (0x000003FF)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Subsequence_Wait_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Subsequence_Type_OFF (20)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Subsequence_Type_WID ( 4)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Subsequence_Type_MSK (0x00F00000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Subsequence_Type_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Subsequence_Type_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Save_Current_Base_Address_To_Start_OFF (25)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Save_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Save_Current_Base_Address_To_Start_MSK (0x02000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Save_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Save_Current_Base_Address_To_Start_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Reset_Current_Base_Address_To_Start_OFF (26)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Reset_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Reset_Current_Base_Address_To_Start_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Reset_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Reset_Current_Base_Address_To_Start_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Data_and_ECC_Address_Inversion_OFF (27)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Data_and_ECC_Address_Inversion_WID ( 2)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Data_and_ECC_Address_Inversion_MSK (0x18000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Data_and_ECC_Address_Inversion_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Data_and_ECC_Address_Inversion_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Invert_Data_and_ECC_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_OFF (31)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_MSK (0x80000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_DEF (0x00000000)
+
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Number_of_Cachelines_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Number_of_Cachelines_WID ( 7)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Number_of_Cachelines_MSK (0x0000007F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Number_of_Cachelines_MAX (0x0000007F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Number_of_Cachelines_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Number_of_Cachelines_Scale_OFF ( 7)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Number_of_Cachelines_Scale_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Number_of_Cachelines_Scale_MSK (0x00000080)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Number_of_Cachelines_Scale_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Number_of_Cachelines_Scale_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Subsequence_Wait_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Subsequence_Wait_WID (14)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Subsequence_Wait_MSK (0x003FFF00)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Subsequence_Wait_MAX (0x00003FFF)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Subsequence_Wait_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Subsequence_Type_OFF (22)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Subsequence_Type_WID ( 4)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Subsequence_Type_MSK (0x03C00000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Subsequence_Type_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Subsequence_Type_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Save_Current_Base_Address_To_Start_OFF (26)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Save_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Save_Current_Base_Address_To_Start_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Save_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Save_Current_Base_Address_To_Start_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Reset_Current_Base_Address_To_Start_OFF (27)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Reset_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Reset_Current_Base_Address_To_Start_MSK (0x08000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Reset_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Reset_Current_Base_Address_To_Start_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Data_and_ECC_Address_Inversion_OFF (28)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Data_and_ECC_Address_Inversion_WID ( 2)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Data_and_ECC_Address_Inversion_MSK (0x30000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Data_and_ECC_Address_Inversion_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Data_and_ECC_Address_Inversion_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Invert_Data_and_ECC_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Stop_Base_Subsequence_On_Wrap_Trigger_OFF (31)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Stop_Base_Subsequence_On_Wrap_Trigger_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Stop_Base_Subsequence_On_Wrap_Trigger_MSK (0x80000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Stop_Base_Subsequence_On_Wrap_Trigger_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_5_Stop_Base_Subsequence_On_Wrap_Trigger_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_REG (0x00004820)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Number_of_Cachelines_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Number_of_Cachelines_WID ( 7)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Number_of_Cachelines_MSK (0x0000007F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Number_of_Cachelines_MAX (0x0000007F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Number_of_Cachelines_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Number_of_Cachelines_Scale_OFF ( 7)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Number_of_Cachelines_Scale_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Number_of_Cachelines_Scale_MSK (0x00000080)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Number_of_Cachelines_Scale_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Number_of_Cachelines_Scale_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Subsequence_Wait_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Subsequence_Wait_WID (10)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Subsequence_Wait_MSK (0x0003FF00)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Subsequence_Wait_MAX (0x000003FF)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Subsequence_Wait_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Subsequence_Type_OFF (20)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Subsequence_Type_WID ( 4)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Subsequence_Type_MSK (0x00F00000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Subsequence_Type_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Subsequence_Type_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Save_Current_Base_Address_To_Start_OFF (25)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Save_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Save_Current_Base_Address_To_Start_MSK (0x02000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Save_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Save_Current_Base_Address_To_Start_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Reset_Current_Base_Address_To_Start_OFF (26)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Reset_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Reset_Current_Base_Address_To_Start_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Reset_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Reset_Current_Base_Address_To_Start_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Data_and_ECC_Address_Inversion_OFF (27)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Data_and_ECC_Address_Inversion_WID ( 2)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Data_and_ECC_Address_Inversion_MSK (0x18000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Data_and_ECC_Address_Inversion_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Data_and_ECC_Address_Inversion_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Invert_Data_and_ECC_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_OFF (31)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_MSK (0x80000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_DEF (0x00000000)
+
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Number_of_Cachelines_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Number_of_Cachelines_WID ( 7)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Number_of_Cachelines_MSK (0x0000007F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Number_of_Cachelines_MAX (0x0000007F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Number_of_Cachelines_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Number_of_Cachelines_Scale_OFF ( 7)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Number_of_Cachelines_Scale_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Number_of_Cachelines_Scale_MSK (0x00000080)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Number_of_Cachelines_Scale_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Number_of_Cachelines_Scale_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Subsequence_Wait_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Subsequence_Wait_WID (14)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Subsequence_Wait_MSK (0x003FFF00)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Subsequence_Wait_MAX (0x00003FFF)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Subsequence_Wait_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Subsequence_Type_OFF (22)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Subsequence_Type_WID ( 4)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Subsequence_Type_MSK (0x03C00000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Subsequence_Type_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Subsequence_Type_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Save_Current_Base_Address_To_Start_OFF (26)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Save_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Save_Current_Base_Address_To_Start_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Save_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Save_Current_Base_Address_To_Start_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Reset_Current_Base_Address_To_Start_OFF (27)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Reset_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Reset_Current_Base_Address_To_Start_MSK (0x08000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Reset_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Reset_Current_Base_Address_To_Start_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Data_and_ECC_Address_Inversion_OFF (28)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Data_and_ECC_Address_Inversion_WID ( 2)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Data_and_ECC_Address_Inversion_MSK (0x30000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Data_and_ECC_Address_Inversion_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Data_and_ECC_Address_Inversion_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Invert_Data_and_ECC_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Stop_Base_Subsequence_On_Wrap_Trigger_OFF (31)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Stop_Base_Subsequence_On_Wrap_Trigger_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Stop_Base_Subsequence_On_Wrap_Trigger_MSK (0x80000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Stop_Base_Subsequence_On_Wrap_Trigger_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_6_Stop_Base_Subsequence_On_Wrap_Trigger_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_REG (0x00004824)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Number_of_Cachelines_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Number_of_Cachelines_WID ( 7)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Number_of_Cachelines_MSK (0x0000007F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Number_of_Cachelines_MAX (0x0000007F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Number_of_Cachelines_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Number_of_Cachelines_Scale_OFF ( 7)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Number_of_Cachelines_Scale_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Number_of_Cachelines_Scale_MSK (0x00000080)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Number_of_Cachelines_Scale_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Number_of_Cachelines_Scale_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Subsequence_Wait_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Subsequence_Wait_WID (10)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Subsequence_Wait_MSK (0x0003FF00)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Subsequence_Wait_MAX (0x000003FF)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Subsequence_Wait_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Subsequence_Type_OFF (20)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Subsequence_Type_WID ( 4)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Subsequence_Type_MSK (0x00F00000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Subsequence_Type_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Subsequence_Type_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Save_Current_Base_Address_To_Start_OFF (25)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Save_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Save_Current_Base_Address_To_Start_MSK (0x02000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Save_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Save_Current_Base_Address_To_Start_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Reset_Current_Base_Address_To_Start_OFF (26)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Reset_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Reset_Current_Base_Address_To_Start_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Reset_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Reset_Current_Base_Address_To_Start_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Data_and_ECC_Address_Inversion_OFF (27)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Data_and_ECC_Address_Inversion_WID ( 2)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Data_and_ECC_Address_Inversion_MSK (0x18000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Data_and_ECC_Address_Inversion_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Data_and_ECC_Address_Inversion_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Invert_Data_and_ECC_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_OFF (31)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_MSK (0x80000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_DEF (0x00000000)
+
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Number_of_Cachelines_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Number_of_Cachelines_WID ( 7)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Number_of_Cachelines_MSK (0x0000007F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Number_of_Cachelines_MAX (0x0000007F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Number_of_Cachelines_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Number_of_Cachelines_Scale_OFF ( 7)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Number_of_Cachelines_Scale_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Number_of_Cachelines_Scale_MSK (0x00000080)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Number_of_Cachelines_Scale_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Number_of_Cachelines_Scale_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Subsequence_Wait_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Subsequence_Wait_WID (14)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Subsequence_Wait_MSK (0x003FFF00)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Subsequence_Wait_MAX (0x00003FFF)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Subsequence_Wait_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Subsequence_Type_OFF (22)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Subsequence_Type_WID ( 4)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Subsequence_Type_MSK (0x03C00000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Subsequence_Type_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Subsequence_Type_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Save_Current_Base_Address_To_Start_OFF (26)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Save_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Save_Current_Base_Address_To_Start_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Save_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Save_Current_Base_Address_To_Start_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Reset_Current_Base_Address_To_Start_OFF (27)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Reset_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Reset_Current_Base_Address_To_Start_MSK (0x08000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Reset_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Reset_Current_Base_Address_To_Start_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Data_and_ECC_Address_Inversion_OFF (28)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Data_and_ECC_Address_Inversion_WID ( 2)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Data_and_ECC_Address_Inversion_MSK (0x30000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Data_and_ECC_Address_Inversion_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Data_and_ECC_Address_Inversion_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Invert_Data_and_ECC_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Stop_Base_Subsequence_On_Wrap_Trigger_OFF (31)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Stop_Base_Subsequence_On_Wrap_Trigger_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Stop_Base_Subsequence_On_Wrap_Trigger_MSK (0x80000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Stop_Base_Subsequence_On_Wrap_Trigger_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_7_Stop_Base_Subsequence_On_Wrap_Trigger_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_REG (0x00004830)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Number_of_Cachelines_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Number_of_Cachelines_WID ( 7)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Number_of_Cachelines_MSK (0x0000007F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Number_of_Cachelines_MAX (0x0000007F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Number_of_Cachelines_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Number_of_Cachelines_Scale_OFF ( 7)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Number_of_Cachelines_Scale_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Number_of_Cachelines_Scale_MSK (0x00000080)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Number_of_Cachelines_Scale_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Number_of_Cachelines_Scale_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Subsequence_Wait_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Subsequence_Wait_WID ( 8)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Subsequence_Wait_MSK (0x0000FF00)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Subsequence_Wait_MAX (0x000000FF)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Subsequence_Wait_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Subsequence_Type_OFF (20)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Subsequence_Type_WID ( 4)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Subsequence_Type_MSK (0x00F00000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Subsequence_Type_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Subsequence_Type_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Save_Current_Base_Address_To_Start_OFF (25)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Save_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Save_Current_Base_Address_To_Start_MSK (0x02000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Save_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Save_Current_Base_Address_To_Start_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Reset_Current_Base_Address_To_Start_OFF (26)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Reset_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Reset_Current_Base_Address_To_Start_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Reset_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Reset_Current_Base_Address_To_Start_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Data_and_ECC_Address_Inversion_OFF (27)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Data_and_ECC_Address_Inversion_WID ( 2)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Data_and_ECC_Address_Inversion_MSK (0x18000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Data_and_ECC_Address_Inversion_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Data_and_ECC_Address_Inversion_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Invert_Data_and_ECC_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_OFF (31)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_MSK (0x80000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_DEF (0x00000000)
+
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Number_of_Cachelines_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Number_of_Cachelines_WID ( 7)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Number_of_Cachelines_MSK (0x0000007F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Number_of_Cachelines_MAX (0x0000007F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Number_of_Cachelines_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Number_of_Cachelines_Scale_OFF ( 7)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Number_of_Cachelines_Scale_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Number_of_Cachelines_Scale_MSK (0x00000080)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Number_of_Cachelines_Scale_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Number_of_Cachelines_Scale_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Subsequence_Wait_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Subsequence_Wait_WID (14)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Subsequence_Wait_MSK (0x003FFF00)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Subsequence_Wait_MAX (0x00003FFF)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Subsequence_Wait_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Subsequence_Type_OFF (22)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Subsequence_Type_WID ( 4)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Subsequence_Type_MSK (0x03C00000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Subsequence_Type_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Subsequence_Type_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Save_Current_Base_Address_To_Start_OFF (26)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Save_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Save_Current_Base_Address_To_Start_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Save_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Save_Current_Base_Address_To_Start_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Reset_Current_Base_Address_To_Start_OFF (27)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Reset_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Reset_Current_Base_Address_To_Start_MSK (0x08000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Reset_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Reset_Current_Base_Address_To_Start_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Data_and_ECC_Address_Inversion_OFF (28)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Data_and_ECC_Address_Inversion_WID ( 2)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Data_and_ECC_Address_Inversion_MSK (0x30000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Data_and_ECC_Address_Inversion_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Data_and_ECC_Address_Inversion_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Invert_Data_and_ECC_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Stop_Base_Subsequence_On_Wrap_Trigger_OFF (31)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Stop_Base_Subsequence_On_Wrap_Trigger_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Stop_Base_Subsequence_On_Wrap_Trigger_MSK (0x80000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Stop_Base_Subsequence_On_Wrap_Trigger_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_Stop_Base_Subsequence_On_Wrap_Trigger_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_REG (0x00004834)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Number_of_Cachelines_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Number_of_Cachelines_WID ( 7)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Number_of_Cachelines_MSK (0x0000007F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Number_of_Cachelines_MAX (0x0000007F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Number_of_Cachelines_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Number_of_Cachelines_Scale_OFF ( 7)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Number_of_Cachelines_Scale_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Number_of_Cachelines_Scale_MSK (0x00000080)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Number_of_Cachelines_Scale_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Number_of_Cachelines_Scale_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Subsequence_Wait_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Subsequence_Wait_WID ( 8)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Subsequence_Wait_MSK (0x0000FF00)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Subsequence_Wait_MAX (0x000000FF)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Subsequence_Wait_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Subsequence_Type_OFF (20)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Subsequence_Type_WID ( 4)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Subsequence_Type_MSK (0x00F00000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Subsequence_Type_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Subsequence_Type_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Save_Current_Base_Address_To_Start_OFF (25)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Save_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Save_Current_Base_Address_To_Start_MSK (0x02000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Save_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Save_Current_Base_Address_To_Start_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Reset_Current_Base_Address_To_Start_OFF (26)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Reset_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Reset_Current_Base_Address_To_Start_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Reset_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Reset_Current_Base_Address_To_Start_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Data_and_ECC_Address_Inversion_OFF (27)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Data_and_ECC_Address_Inversion_WID ( 2)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Data_and_ECC_Address_Inversion_MSK (0x18000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Data_and_ECC_Address_Inversion_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Data_and_ECC_Address_Inversion_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Invert_Data_and_ECC_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_OFF (31)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_MSK (0x80000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_DEF (0x00000000)
+
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Number_of_Cachelines_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Number_of_Cachelines_WID ( 7)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Number_of_Cachelines_MSK (0x0000007F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Number_of_Cachelines_MAX (0x0000007F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Number_of_Cachelines_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Number_of_Cachelines_Scale_OFF ( 7)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Number_of_Cachelines_Scale_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Number_of_Cachelines_Scale_MSK (0x00000080)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Number_of_Cachelines_Scale_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Number_of_Cachelines_Scale_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Subsequence_Wait_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Subsequence_Wait_WID (14)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Subsequence_Wait_MSK (0x003FFF00)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Subsequence_Wait_MAX (0x00003FFF)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Subsequence_Wait_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Subsequence_Type_OFF (22)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Subsequence_Type_WID ( 4)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Subsequence_Type_MSK (0x03C00000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Subsequence_Type_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Subsequence_Type_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Save_Current_Base_Address_To_Start_OFF (26)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Save_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Save_Current_Base_Address_To_Start_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Save_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Save_Current_Base_Address_To_Start_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Reset_Current_Base_Address_To_Start_OFF (27)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Reset_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Reset_Current_Base_Address_To_Start_MSK (0x08000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Reset_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Reset_Current_Base_Address_To_Start_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Data_and_ECC_Address_Inversion_OFF (28)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Data_and_ECC_Address_Inversion_WID ( 2)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Data_and_ECC_Address_Inversion_MSK (0x30000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Data_and_ECC_Address_Inversion_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Data_and_ECC_Address_Inversion_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Invert_Data_and_ECC_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Stop_Base_Subsequence_On_Wrap_Trigger_OFF (31)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Stop_Base_Subsequence_On_Wrap_Trigger_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Stop_Base_Subsequence_On_Wrap_Trigger_MSK (0x80000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Stop_Base_Subsequence_On_Wrap_Trigger_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_1_Stop_Base_Subsequence_On_Wrap_Trigger_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_REG (0x00004838)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Number_of_Cachelines_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Number_of_Cachelines_WID ( 7)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Number_of_Cachelines_MSK (0x0000007F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Number_of_Cachelines_MAX (0x0000007F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Number_of_Cachelines_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Number_of_Cachelines_Scale_OFF ( 7)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Number_of_Cachelines_Scale_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Number_of_Cachelines_Scale_MSK (0x00000080)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Number_of_Cachelines_Scale_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Number_of_Cachelines_Scale_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Subsequence_Wait_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Subsequence_Wait_WID ( 8)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Subsequence_Wait_MSK (0x0000FF00)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Subsequence_Wait_MAX (0x000000FF)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Subsequence_Wait_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Subsequence_Type_OFF (20)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Subsequence_Type_WID ( 4)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Subsequence_Type_MSK (0x00F00000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Subsequence_Type_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Subsequence_Type_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Save_Current_Base_Address_To_Start_OFF (25)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Save_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Save_Current_Base_Address_To_Start_MSK (0x02000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Save_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Save_Current_Base_Address_To_Start_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Reset_Current_Base_Address_To_Start_OFF (26)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Reset_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Reset_Current_Base_Address_To_Start_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Reset_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Reset_Current_Base_Address_To_Start_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Data_and_ECC_Address_Inversion_OFF (27)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Data_and_ECC_Address_Inversion_WID ( 2)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Data_and_ECC_Address_Inversion_MSK (0x18000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Data_and_ECC_Address_Inversion_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Data_and_ECC_Address_Inversion_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Invert_Data_and_ECC_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_OFF (31)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_MSK (0x80000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Stop_Base_Subsequence_On_Wrap_Trigger_DEF (0x00000000)
+
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Number_of_Cachelines_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Number_of_Cachelines_WID ( 7)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Number_of_Cachelines_MSK (0x0000007F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Number_of_Cachelines_MAX (0x0000007F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Number_of_Cachelines_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Number_of_Cachelines_Scale_OFF ( 7)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Number_of_Cachelines_Scale_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Number_of_Cachelines_Scale_MSK (0x00000080)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Number_of_Cachelines_Scale_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Number_of_Cachelines_Scale_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Subsequence_Wait_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Subsequence_Wait_WID (14)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Subsequence_Wait_MSK (0x003FFF00)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Subsequence_Wait_MAX (0x00003FFF)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Subsequence_Wait_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Subsequence_Type_OFF (22)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Subsequence_Type_WID ( 4)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Subsequence_Type_MSK (0x03C00000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Subsequence_Type_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Subsequence_Type_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Save_Current_Base_Address_To_Start_OFF (26)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Save_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Save_Current_Base_Address_To_Start_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Save_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Save_Current_Base_Address_To_Start_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Reset_Current_Base_Address_To_Start_OFF (27)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Reset_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Reset_Current_Base_Address_To_Start_MSK (0x08000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Reset_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Reset_Current_Base_Address_To_Start_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Data_and_ECC_Address_Inversion_OFF (28)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Data_and_ECC_Address_Inversion_WID ( 2)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Data_and_ECC_Address_Inversion_MSK (0x30000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Data_and_ECC_Address_Inversion_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Data_and_ECC_Address_Inversion_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Invert_Data_and_ECC_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Stop_Base_Subsequence_On_Wrap_Trigger_OFF (31)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Stop_Base_Subsequence_On_Wrap_Trigger_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Stop_Base_Subsequence_On_Wrap_Trigger_MSK (0x80000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Stop_Base_Subsequence_On_Wrap_Trigger_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_2_Stop_Base_Subsequence_On_Wrap_Trigger_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_REG (0x0000483C)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Number_of_Cachelines_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Number_of_Cachelines_WID ( 7)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Number_of_Cachelines_MSK (0x0000007F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Number_of_Cachelines_MAX (0x0000007F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Number_of_Cachelines_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Number_of_Cachelines_Scale_OFF ( 7)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Number_of_Cachelines_Scale_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Number_of_Cachelines_Scale_MSK (0x00000080)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Number_of_Cachelines_Scale_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Number_of_Cachelines_Scale_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Subsequence_Wait_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Subsequence_Wait_WID ( 8)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Subsequence_Wait_MSK (0x0000FF00)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Subsequence_Wait_MAX (0x000000FF)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Subsequence_Wait_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Subsequence_Type_OFF (20)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Subsequence_Type_WID ( 4)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Subsequence_Type_MSK (0x00F00000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Subsequence_Type_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Subsequence_Type_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Save_Current_Base_Address_To_Start_OFF (25)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Save_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Save_Current_Base_Address_To_Start_MSK (0x02000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Save_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Save_Current_Base_Address_To_Start_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Reset_Current_Base_Address_To_Start_OFF (26)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Reset_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Reset_Current_Base_Address_To_Start_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Reset_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Reset_Current_Base_Address_To_Start_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Data_and_ECC_Address_Inversion_OFF (27)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Data_and_ECC_Address_Inversion_WID ( 2)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Data_and_ECC_Address_Inversion_MSK (0x18000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Data_and_ECC_Address_Inversion_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Data_and_ECC_Address_Inversion_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Invert_Data_and_ECC_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_OFF (31)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_MSK (0x80000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_DEF (0x00000000)
+
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Number_of_Cachelines_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Number_of_Cachelines_WID ( 7)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Number_of_Cachelines_MSK (0x0000007F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Number_of_Cachelines_MAX (0x0000007F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Number_of_Cachelines_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Number_of_Cachelines_Scale_OFF ( 7)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Number_of_Cachelines_Scale_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Number_of_Cachelines_Scale_MSK (0x00000080)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Number_of_Cachelines_Scale_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Number_of_Cachelines_Scale_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Subsequence_Wait_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Subsequence_Wait_WID (14)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Subsequence_Wait_MSK (0x003FFF00)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Subsequence_Wait_MAX (0x00003FFF)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Subsequence_Wait_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Subsequence_Type_OFF (22)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Subsequence_Type_WID ( 4)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Subsequence_Type_MSK (0x03C00000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Subsequence_Type_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Subsequence_Type_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Save_Current_Base_Address_To_Start_OFF (26)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Save_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Save_Current_Base_Address_To_Start_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Save_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Save_Current_Base_Address_To_Start_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Reset_Current_Base_Address_To_Start_OFF (27)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Reset_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Reset_Current_Base_Address_To_Start_MSK (0x08000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Reset_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Reset_Current_Base_Address_To_Start_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Data_and_ECC_Address_Inversion_OFF (28)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Data_and_ECC_Address_Inversion_WID ( 2)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Data_and_ECC_Address_Inversion_MSK (0x30000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Data_and_ECC_Address_Inversion_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Data_and_ECC_Address_Inversion_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Invert_Data_and_ECC_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Stop_Base_Subsequence_On_Wrap_Trigger_OFF (31)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Stop_Base_Subsequence_On_Wrap_Trigger_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Stop_Base_Subsequence_On_Wrap_Trigger_MSK (0x80000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Stop_Base_Subsequence_On_Wrap_Trigger_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_3_Stop_Base_Subsequence_On_Wrap_Trigger_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_REG (0x00004840)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Number_of_Cachelines_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Number_of_Cachelines_WID ( 7)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Number_of_Cachelines_MSK (0x0000007F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Number_of_Cachelines_MAX (0x0000007F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Number_of_Cachelines_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Number_of_Cachelines_Scale_OFF ( 7)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Number_of_Cachelines_Scale_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Number_of_Cachelines_Scale_MSK (0x00000080)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Number_of_Cachelines_Scale_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Number_of_Cachelines_Scale_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Subsequence_Wait_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Subsequence_Wait_WID ( 8)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Subsequence_Wait_MSK (0x0000FF00)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Subsequence_Wait_MAX (0x000000FF)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Subsequence_Wait_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Subsequence_Type_OFF (20)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Subsequence_Type_WID ( 4)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Subsequence_Type_MSK (0x00F00000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Subsequence_Type_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Subsequence_Type_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Save_Current_Base_Address_To_Start_OFF (25)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Save_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Save_Current_Base_Address_To_Start_MSK (0x02000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Save_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Save_Current_Base_Address_To_Start_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Reset_Current_Base_Address_To_Start_OFF (26)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Reset_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Reset_Current_Base_Address_To_Start_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Reset_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Reset_Current_Base_Address_To_Start_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Data_and_ECC_Address_Inversion_OFF (27)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Data_and_ECC_Address_Inversion_WID ( 2)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Data_and_ECC_Address_Inversion_MSK (0x18000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Data_and_ECC_Address_Inversion_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Data_and_ECC_Address_Inversion_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Invert_Data_and_ECC_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_OFF (31)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_MSK (0x80000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_DEF (0x00000000)
+
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Number_of_Cachelines_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Number_of_Cachelines_WID ( 7)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Number_of_Cachelines_MSK (0x0000007F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Number_of_Cachelines_MAX (0x0000007F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Number_of_Cachelines_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Number_of_Cachelines_Scale_OFF ( 7)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Number_of_Cachelines_Scale_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Number_of_Cachelines_Scale_MSK (0x00000080)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Number_of_Cachelines_Scale_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Number_of_Cachelines_Scale_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Subsequence_Wait_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Subsequence_Wait_WID (14)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Subsequence_Wait_MSK (0x003FFF00)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Subsequence_Wait_MAX (0x00003FFF)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Subsequence_Wait_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Subsequence_Type_OFF (22)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Subsequence_Type_WID ( 4)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Subsequence_Type_MSK (0x03C00000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Subsequence_Type_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Subsequence_Type_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Save_Current_Base_Address_To_Start_OFF (26)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Save_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Save_Current_Base_Address_To_Start_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Save_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Save_Current_Base_Address_To_Start_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Reset_Current_Base_Address_To_Start_OFF (27)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Reset_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Reset_Current_Base_Address_To_Start_MSK (0x08000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Reset_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Reset_Current_Base_Address_To_Start_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Data_and_ECC_Address_Inversion_OFF (28)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Data_and_ECC_Address_Inversion_WID ( 2)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Data_and_ECC_Address_Inversion_MSK (0x30000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Data_and_ECC_Address_Inversion_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Data_and_ECC_Address_Inversion_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Invert_Data_and_ECC_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Stop_Base_Subsequence_On_Wrap_Trigger_OFF (31)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Stop_Base_Subsequence_On_Wrap_Trigger_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Stop_Base_Subsequence_On_Wrap_Trigger_MSK (0x80000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Stop_Base_Subsequence_On_Wrap_Trigger_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_4_Stop_Base_Subsequence_On_Wrap_Trigger_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_REG (0x00004844)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Number_of_Cachelines_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Number_of_Cachelines_WID ( 7)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Number_of_Cachelines_MSK (0x0000007F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Number_of_Cachelines_MAX (0x0000007F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Number_of_Cachelines_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Number_of_Cachelines_Scale_OFF ( 7)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Number_of_Cachelines_Scale_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Number_of_Cachelines_Scale_MSK (0x00000080)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Number_of_Cachelines_Scale_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Number_of_Cachelines_Scale_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Subsequence_Wait_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Subsequence_Wait_WID ( 8)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Subsequence_Wait_MSK (0x0000FF00)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Subsequence_Wait_MAX (0x000000FF)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Subsequence_Wait_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Subsequence_Type_OFF (20)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Subsequence_Type_WID ( 4)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Subsequence_Type_MSK (0x00F00000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Subsequence_Type_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Subsequence_Type_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Save_Current_Base_Address_To_Start_OFF (25)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Save_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Save_Current_Base_Address_To_Start_MSK (0x02000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Save_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Save_Current_Base_Address_To_Start_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Reset_Current_Base_Address_To_Start_OFF (26)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Reset_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Reset_Current_Base_Address_To_Start_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Reset_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Reset_Current_Base_Address_To_Start_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Data_and_ECC_Address_Inversion_OFF (27)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Data_and_ECC_Address_Inversion_WID ( 2)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Data_and_ECC_Address_Inversion_MSK (0x18000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Data_and_ECC_Address_Inversion_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Data_and_ECC_Address_Inversion_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Invert_Data_and_ECC_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_OFF (31)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_MSK (0x80000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_DEF (0x00000000)
+
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Number_of_Cachelines_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Number_of_Cachelines_WID ( 7)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Number_of_Cachelines_MSK (0x0000007F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Number_of_Cachelines_MAX (0x0000007F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Number_of_Cachelines_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Number_of_Cachelines_Scale_OFF ( 7)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Number_of_Cachelines_Scale_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Number_of_Cachelines_Scale_MSK (0x00000080)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Number_of_Cachelines_Scale_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Number_of_Cachelines_Scale_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Subsequence_Wait_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Subsequence_Wait_WID (14)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Subsequence_Wait_MSK (0x003FFF00)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Subsequence_Wait_MAX (0x00003FFF)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Subsequence_Wait_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Subsequence_Type_OFF (22)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Subsequence_Type_WID ( 4)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Subsequence_Type_MSK (0x03C00000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Subsequence_Type_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Subsequence_Type_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Save_Current_Base_Address_To_Start_OFF (26)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Save_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Save_Current_Base_Address_To_Start_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Save_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Save_Current_Base_Address_To_Start_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Reset_Current_Base_Address_To_Start_OFF (27)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Reset_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Reset_Current_Base_Address_To_Start_MSK (0x08000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Reset_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Reset_Current_Base_Address_To_Start_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Data_and_ECC_Address_Inversion_OFF (28)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Data_and_ECC_Address_Inversion_WID ( 2)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Data_and_ECC_Address_Inversion_MSK (0x30000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Data_and_ECC_Address_Inversion_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Data_and_ECC_Address_Inversion_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Invert_Data_and_ECC_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Stop_Base_Subsequence_On_Wrap_Trigger_OFF (31)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Stop_Base_Subsequence_On_Wrap_Trigger_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Stop_Base_Subsequence_On_Wrap_Trigger_MSK (0x80000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Stop_Base_Subsequence_On_Wrap_Trigger_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_5_Stop_Base_Subsequence_On_Wrap_Trigger_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_REG (0x00004848)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Number_of_Cachelines_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Number_of_Cachelines_WID ( 7)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Number_of_Cachelines_MSK (0x0000007F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Number_of_Cachelines_MAX (0x0000007F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Number_of_Cachelines_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Number_of_Cachelines_Scale_OFF ( 7)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Number_of_Cachelines_Scale_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Number_of_Cachelines_Scale_MSK (0x00000080)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Number_of_Cachelines_Scale_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Number_of_Cachelines_Scale_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Subsequence_Wait_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Subsequence_Wait_WID ( 8)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Subsequence_Wait_MSK (0x0000FF00)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Subsequence_Wait_MAX (0x000000FF)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Subsequence_Wait_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Subsequence_Type_OFF (20)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Subsequence_Type_WID ( 4)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Subsequence_Type_MSK (0x00F00000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Subsequence_Type_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Subsequence_Type_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Save_Current_Base_Address_To_Start_OFF (25)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Save_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Save_Current_Base_Address_To_Start_MSK (0x02000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Save_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Save_Current_Base_Address_To_Start_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Reset_Current_Base_Address_To_Start_OFF (26)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Reset_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Reset_Current_Base_Address_To_Start_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Reset_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Reset_Current_Base_Address_To_Start_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Data_and_ECC_Address_Inversion_OFF (27)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Data_and_ECC_Address_Inversion_WID ( 2)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Data_and_ECC_Address_Inversion_MSK (0x18000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Data_and_ECC_Address_Inversion_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Data_and_ECC_Address_Inversion_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Invert_Data_and_ECC_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_OFF (31)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_MSK (0x80000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_DEF (0x00000000)
+
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Number_of_Cachelines_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Number_of_Cachelines_WID ( 7)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Number_of_Cachelines_MSK (0x0000007F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Number_of_Cachelines_MAX (0x0000007F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Number_of_Cachelines_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Number_of_Cachelines_Scale_OFF ( 7)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Number_of_Cachelines_Scale_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Number_of_Cachelines_Scale_MSK (0x00000080)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Number_of_Cachelines_Scale_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Number_of_Cachelines_Scale_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Subsequence_Wait_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Subsequence_Wait_WID (14)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Subsequence_Wait_MSK (0x003FFF00)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Subsequence_Wait_MAX (0x00003FFF)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Subsequence_Wait_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Subsequence_Type_OFF (22)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Subsequence_Type_WID ( 4)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Subsequence_Type_MSK (0x03C00000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Subsequence_Type_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Subsequence_Type_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Save_Current_Base_Address_To_Start_OFF (26)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Save_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Save_Current_Base_Address_To_Start_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Save_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Save_Current_Base_Address_To_Start_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Reset_Current_Base_Address_To_Start_OFF (27)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Reset_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Reset_Current_Base_Address_To_Start_MSK (0x08000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Reset_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Reset_Current_Base_Address_To_Start_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Data_and_ECC_Address_Inversion_OFF (28)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Data_and_ECC_Address_Inversion_WID ( 2)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Data_and_ECC_Address_Inversion_MSK (0x30000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Data_and_ECC_Address_Inversion_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Data_and_ECC_Address_Inversion_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Invert_Data_and_ECC_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Stop_Base_Subsequence_On_Wrap_Trigger_OFF (31)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Stop_Base_Subsequence_On_Wrap_Trigger_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Stop_Base_Subsequence_On_Wrap_Trigger_MSK (0x80000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Stop_Base_Subsequence_On_Wrap_Trigger_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_6_Stop_Base_Subsequence_On_Wrap_Trigger_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_REG (0x0000484C)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Number_of_Cachelines_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Number_of_Cachelines_WID ( 7)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Number_of_Cachelines_MSK (0x0000007F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Number_of_Cachelines_MAX (0x0000007F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Number_of_Cachelines_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Number_of_Cachelines_Scale_OFF ( 7)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Number_of_Cachelines_Scale_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Number_of_Cachelines_Scale_MSK (0x00000080)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Number_of_Cachelines_Scale_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Number_of_Cachelines_Scale_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Subsequence_Wait_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Subsequence_Wait_WID ( 8)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Subsequence_Wait_MSK (0x0000FF00)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Subsequence_Wait_MAX (0x000000FF)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Subsequence_Wait_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Subsequence_Type_OFF (20)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Subsequence_Type_WID ( 4)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Subsequence_Type_MSK (0x00F00000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Subsequence_Type_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Subsequence_Type_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Save_Current_Base_Address_To_Start_OFF (25)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Save_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Save_Current_Base_Address_To_Start_MSK (0x02000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Save_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Save_Current_Base_Address_To_Start_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Reset_Current_Base_Address_To_Start_OFF (26)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Reset_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Reset_Current_Base_Address_To_Start_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Reset_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Reset_Current_Base_Address_To_Start_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Data_and_ECC_Address_Inversion_OFF (27)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Data_and_ECC_Address_Inversion_WID ( 2)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Data_and_ECC_Address_Inversion_MSK (0x18000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Data_and_ECC_Address_Inversion_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Data_and_ECC_Address_Inversion_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Invert_Data_and_ECC_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_OFF (31)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_MSK (0x80000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_HSW_A0_Stop_Base_Subsequence_On_Wrap_Trigger_DEF (0x00000000)
+
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Number_of_Cachelines_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Number_of_Cachelines_WID ( 7)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Number_of_Cachelines_MSK (0x0000007F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Number_of_Cachelines_MAX (0x0000007F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Number_of_Cachelines_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Number_of_Cachelines_Scale_OFF ( 7)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Number_of_Cachelines_Scale_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Number_of_Cachelines_Scale_MSK (0x00000080)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Number_of_Cachelines_Scale_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Number_of_Cachelines_Scale_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Subsequence_Wait_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Subsequence_Wait_WID (14)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Subsequence_Wait_MSK (0x003FFF00)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Subsequence_Wait_MAX (0x00003FFF)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Subsequence_Wait_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Subsequence_Type_OFF (22)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Subsequence_Type_WID ( 4)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Subsequence_Type_MSK (0x03C00000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Subsequence_Type_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Subsequence_Type_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Save_Current_Base_Address_To_Start_OFF (26)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Save_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Save_Current_Base_Address_To_Start_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Save_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Save_Current_Base_Address_To_Start_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Reset_Current_Base_Address_To_Start_OFF (27)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Reset_Current_Base_Address_To_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Reset_Current_Base_Address_To_Start_MSK (0x08000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Reset_Current_Base_Address_To_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Reset_Current_Base_Address_To_Start_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Data_and_ECC_Address_Inversion_OFF (28)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Data_and_ECC_Address_Inversion_WID ( 2)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Data_and_ECC_Address_Inversion_MSK (0x30000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Data_and_ECC_Address_Inversion_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Data_and_ECC_Address_Inversion_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Invert_Data_and_ECC_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Stop_Base_Subsequence_On_Wrap_Trigger_OFF (31)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Stop_Base_Subsequence_On_Wrap_Trigger_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Stop_Base_Subsequence_On_Wrap_Trigger_MSK (0x80000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Stop_Base_Subsequence_On_Wrap_Trigger_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_7_Stop_Base_Subsequence_On_Wrap_Trigger_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_REG (0x00004858)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Offset_Address_Update_Rate_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Offset_Address_Update_Rate_WID ( 5)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Offset_Address_Update_Rate_MSK (0x0000001F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Offset_Address_Update_Rate_MAX (0x0000001F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Offset_Address_Update_Rate_DEF (0x00000002)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Base_Subsequence_Repeat_Rate_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Base_Subsequence_Repeat_Rate_WID ( 5)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Base_Subsequence_Repeat_Rate_MSK (0x00001F00)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Base_Subsequence_Repeat_Rate_MAX (0x0000001F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Base_Subsequence_Repeat_Rate_DEF (0x00000002)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Column_Offset_Wrap_Trigger_Enable_OFF (15)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Column_Offset_Wrap_Trigger_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Column_Offset_Wrap_Trigger_Enable_MSK (0x00008000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Column_Offset_Wrap_Trigger_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Column_Offset_Wrap_Trigger_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Row_Offset_Wrap_Trigger_Enable_OFF (16)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Row_Offset_Wrap_Trigger_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Row_Offset_Wrap_Trigger_Enable_MSK (0x00010000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Row_Offset_Wrap_Trigger_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Row_Offset_Wrap_Trigger_Enable_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Base_Subsequence_Type_OFF (20)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Base_Subsequence_Type_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Base_Subsequence_Type_MSK (0x00100000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Base_Subsequence_Type_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Base_Subsequence_Type_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_CADB_Deselect_Enable_OFF (21)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_CADB_Deselect_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_CADB_Deselect_Enable_MSK (0x00200000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_CADB_Deselect_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_CADB_Deselect_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_CADB_Select_Enable_OFF (22)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_CADB_Select_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_CADB_Select_Enable_MSK (0x00400000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_CADB_Select_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_CADB_Select_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_CADB_Seeds_Save_Enable_OFF (23)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_CADB_Seeds_Save_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_CADB_Seeds_Save_Enable_MSK (0x00800000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_CADB_Seeds_Save_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_CADB_Seeds_Save_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Column_Increment_Order_OFF (24)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Column_Increment_Order_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Column_Increment_Order_MSK (0x01000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Column_Increment_Order_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Column_Increment_Order_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Column_Increment_Enable_OFF (26)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Column_Increment_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Column_Increment_Enable_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Column_Increment_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Column_Increment_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Row_Increment_Order_OFF (27)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Row_Increment_Order_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Row_Increment_Order_MSK (0x08000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Row_Increment_Order_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Row_Increment_Order_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Row_Increment_Enable_OFF (29)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Row_Increment_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Row_Increment_Enable_MSK (0x20000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Row_Increment_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Row_Increment_Enable_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Base_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Base_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Base_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Base_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_0_Base_Invert_Data_and_ECC_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_REG (0x0000485C)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Offset_Address_Update_Rate_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Offset_Address_Update_Rate_WID ( 5)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Offset_Address_Update_Rate_MSK (0x0000001F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Offset_Address_Update_Rate_MAX (0x0000001F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Offset_Address_Update_Rate_DEF (0x00000002)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Base_Subsequence_Repeat_Rate_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Base_Subsequence_Repeat_Rate_WID ( 5)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Base_Subsequence_Repeat_Rate_MSK (0x00001F00)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Base_Subsequence_Repeat_Rate_MAX (0x0000001F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Base_Subsequence_Repeat_Rate_DEF (0x00000002)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Column_Offset_Wrap_Trigger_Enable_OFF (15)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Column_Offset_Wrap_Trigger_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Column_Offset_Wrap_Trigger_Enable_MSK (0x00008000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Column_Offset_Wrap_Trigger_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Column_Offset_Wrap_Trigger_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Row_Offset_Wrap_Trigger_Enable_OFF (16)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Row_Offset_Wrap_Trigger_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Row_Offset_Wrap_Trigger_Enable_MSK (0x00010000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Row_Offset_Wrap_Trigger_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Row_Offset_Wrap_Trigger_Enable_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Base_Subsequence_Type_OFF (20)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Base_Subsequence_Type_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Base_Subsequence_Type_MSK (0x00100000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Base_Subsequence_Type_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Base_Subsequence_Type_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_CADB_Deselect_Enable_OFF (21)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_CADB_Deselect_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_CADB_Deselect_Enable_MSK (0x00200000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_CADB_Deselect_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_CADB_Deselect_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_CADB_Select_Enable_OFF (22)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_CADB_Select_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_CADB_Select_Enable_MSK (0x00400000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_CADB_Select_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_CADB_Select_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_CADB_Seeds_Save_Enable_OFF (23)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_CADB_Seeds_Save_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_CADB_Seeds_Save_Enable_MSK (0x00800000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_CADB_Seeds_Save_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_CADB_Seeds_Save_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Column_Increment_Order_OFF (24)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Column_Increment_Order_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Column_Increment_Order_MSK (0x01000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Column_Increment_Order_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Column_Increment_Order_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Column_Increment_Enable_OFF (26)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Column_Increment_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Column_Increment_Enable_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Column_Increment_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Column_Increment_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Row_Increment_Order_OFF (27)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Row_Increment_Order_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Row_Increment_Order_MSK (0x08000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Row_Increment_Order_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Row_Increment_Order_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Row_Increment_Enable_OFF (29)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Row_Increment_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Row_Increment_Enable_MSK (0x20000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Row_Increment_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Row_Increment_Enable_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Base_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Base_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Base_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Base_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_1_Base_Invert_Data_and_ECC_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_REG (0x00004860)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Offset_Address_Update_Rate_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Offset_Address_Update_Rate_WID ( 5)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Offset_Address_Update_Rate_MSK (0x0000001F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Offset_Address_Update_Rate_MAX (0x0000001F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Offset_Address_Update_Rate_DEF (0x00000002)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Base_Subsequence_Repeat_Rate_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Base_Subsequence_Repeat_Rate_WID ( 5)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Base_Subsequence_Repeat_Rate_MSK (0x00001F00)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Base_Subsequence_Repeat_Rate_MAX (0x0000001F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Base_Subsequence_Repeat_Rate_DEF (0x00000002)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Column_Offset_Wrap_Trigger_Enable_OFF (15)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Column_Offset_Wrap_Trigger_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Column_Offset_Wrap_Trigger_Enable_MSK (0x00008000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Column_Offset_Wrap_Trigger_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Column_Offset_Wrap_Trigger_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Row_Offset_Wrap_Trigger_Enable_OFF (16)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Row_Offset_Wrap_Trigger_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Row_Offset_Wrap_Trigger_Enable_MSK (0x00010000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Row_Offset_Wrap_Trigger_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Row_Offset_Wrap_Trigger_Enable_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Base_Subsequence_Type_OFF (20)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Base_Subsequence_Type_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Base_Subsequence_Type_MSK (0x00100000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Base_Subsequence_Type_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Base_Subsequence_Type_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_CADB_Deselect_Enable_OFF (21)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_CADB_Deselect_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_CADB_Deselect_Enable_MSK (0x00200000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_CADB_Deselect_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_CADB_Deselect_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_CADB_Select_Enable_OFF (22)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_CADB_Select_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_CADB_Select_Enable_MSK (0x00400000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_CADB_Select_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_CADB_Select_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_CADB_Seeds_Save_Enable_OFF (23)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_CADB_Seeds_Save_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_CADB_Seeds_Save_Enable_MSK (0x00800000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_CADB_Seeds_Save_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_CADB_Seeds_Save_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Column_Increment_Order_OFF (24)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Column_Increment_Order_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Column_Increment_Order_MSK (0x01000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Column_Increment_Order_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Column_Increment_Order_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Column_Increment_Enable_OFF (26)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Column_Increment_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Column_Increment_Enable_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Column_Increment_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Column_Increment_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Row_Increment_Order_OFF (27)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Row_Increment_Order_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Row_Increment_Order_MSK (0x08000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Row_Increment_Order_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Row_Increment_Order_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Row_Increment_Enable_OFF (29)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Row_Increment_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Row_Increment_Enable_MSK (0x20000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Row_Increment_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Row_Increment_Enable_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Base_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Base_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Base_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Base_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_2_Base_Invert_Data_and_ECC_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_REG (0x00004864)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Offset_Address_Update_Rate_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Offset_Address_Update_Rate_WID ( 5)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Offset_Address_Update_Rate_MSK (0x0000001F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Offset_Address_Update_Rate_MAX (0x0000001F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Offset_Address_Update_Rate_DEF (0x00000002)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Base_Subsequence_Repeat_Rate_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Base_Subsequence_Repeat_Rate_WID ( 5)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Base_Subsequence_Repeat_Rate_MSK (0x00001F00)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Base_Subsequence_Repeat_Rate_MAX (0x0000001F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Base_Subsequence_Repeat_Rate_DEF (0x00000002)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Column_Offset_Wrap_Trigger_Enable_OFF (15)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Column_Offset_Wrap_Trigger_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Column_Offset_Wrap_Trigger_Enable_MSK (0x00008000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Column_Offset_Wrap_Trigger_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Column_Offset_Wrap_Trigger_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Row_Offset_Wrap_Trigger_Enable_OFF (16)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Row_Offset_Wrap_Trigger_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Row_Offset_Wrap_Trigger_Enable_MSK (0x00010000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Row_Offset_Wrap_Trigger_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Row_Offset_Wrap_Trigger_Enable_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Base_Subsequence_Type_OFF (20)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Base_Subsequence_Type_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Base_Subsequence_Type_MSK (0x00100000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Base_Subsequence_Type_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Base_Subsequence_Type_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_CADB_Deselect_Enable_OFF (21)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_CADB_Deselect_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_CADB_Deselect_Enable_MSK (0x00200000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_CADB_Deselect_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_CADB_Deselect_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_CADB_Select_Enable_OFF (22)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_CADB_Select_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_CADB_Select_Enable_MSK (0x00400000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_CADB_Select_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_CADB_Select_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_CADB_Seeds_Save_Enable_OFF (23)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_CADB_Seeds_Save_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_CADB_Seeds_Save_Enable_MSK (0x00800000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_CADB_Seeds_Save_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_CADB_Seeds_Save_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Column_Increment_Order_OFF (24)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Column_Increment_Order_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Column_Increment_Order_MSK (0x01000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Column_Increment_Order_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Column_Increment_Order_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Column_Increment_Enable_OFF (26)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Column_Increment_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Column_Increment_Enable_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Column_Increment_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Column_Increment_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Row_Increment_Order_OFF (27)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Row_Increment_Order_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Row_Increment_Order_MSK (0x08000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Row_Increment_Order_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Row_Increment_Order_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Row_Increment_Enable_OFF (29)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Row_Increment_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Row_Increment_Enable_MSK (0x20000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Row_Increment_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Row_Increment_Enable_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Base_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Base_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Base_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Base_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_3_Base_Invert_Data_and_ECC_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_REG (0x00004868)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Offset_Address_Update_Rate_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Offset_Address_Update_Rate_WID ( 5)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Offset_Address_Update_Rate_MSK (0x0000001F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Offset_Address_Update_Rate_MAX (0x0000001F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Offset_Address_Update_Rate_DEF (0x00000002)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Base_Subsequence_Repeat_Rate_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Base_Subsequence_Repeat_Rate_WID ( 5)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Base_Subsequence_Repeat_Rate_MSK (0x00001F00)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Base_Subsequence_Repeat_Rate_MAX (0x0000001F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Base_Subsequence_Repeat_Rate_DEF (0x00000002)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Column_Offset_Wrap_Trigger_Enable_OFF (15)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Column_Offset_Wrap_Trigger_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Column_Offset_Wrap_Trigger_Enable_MSK (0x00008000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Column_Offset_Wrap_Trigger_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Column_Offset_Wrap_Trigger_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Row_Offset_Wrap_Trigger_Enable_OFF (16)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Row_Offset_Wrap_Trigger_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Row_Offset_Wrap_Trigger_Enable_MSK (0x00010000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Row_Offset_Wrap_Trigger_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Row_Offset_Wrap_Trigger_Enable_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Base_Subsequence_Type_OFF (20)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Base_Subsequence_Type_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Base_Subsequence_Type_MSK (0x00100000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Base_Subsequence_Type_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Base_Subsequence_Type_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_CADB_Deselect_Enable_OFF (21)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_CADB_Deselect_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_CADB_Deselect_Enable_MSK (0x00200000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_CADB_Deselect_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_CADB_Deselect_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_CADB_Select_Enable_OFF (22)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_CADB_Select_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_CADB_Select_Enable_MSK (0x00400000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_CADB_Select_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_CADB_Select_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_CADB_Seeds_Save_Enable_OFF (23)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_CADB_Seeds_Save_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_CADB_Seeds_Save_Enable_MSK (0x00800000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_CADB_Seeds_Save_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_CADB_Seeds_Save_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Column_Increment_Order_OFF (24)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Column_Increment_Order_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Column_Increment_Order_MSK (0x01000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Column_Increment_Order_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Column_Increment_Order_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Column_Increment_Enable_OFF (26)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Column_Increment_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Column_Increment_Enable_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Column_Increment_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Column_Increment_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Row_Increment_Order_OFF (27)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Row_Increment_Order_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Row_Increment_Order_MSK (0x08000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Row_Increment_Order_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Row_Increment_Order_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Row_Increment_Enable_OFF (29)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Row_Increment_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Row_Increment_Enable_MSK (0x20000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Row_Increment_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Row_Increment_Enable_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Base_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Base_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Base_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Base_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_4_Base_Invert_Data_and_ECC_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_REG (0x0000486C)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Offset_Address_Update_Rate_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Offset_Address_Update_Rate_WID ( 5)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Offset_Address_Update_Rate_MSK (0x0000001F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Offset_Address_Update_Rate_MAX (0x0000001F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Offset_Address_Update_Rate_DEF (0x00000002)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Base_Subsequence_Repeat_Rate_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Base_Subsequence_Repeat_Rate_WID ( 5)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Base_Subsequence_Repeat_Rate_MSK (0x00001F00)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Base_Subsequence_Repeat_Rate_MAX (0x0000001F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Base_Subsequence_Repeat_Rate_DEF (0x00000002)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Column_Offset_Wrap_Trigger_Enable_OFF (15)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Column_Offset_Wrap_Trigger_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Column_Offset_Wrap_Trigger_Enable_MSK (0x00008000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Column_Offset_Wrap_Trigger_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Column_Offset_Wrap_Trigger_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Row_Offset_Wrap_Trigger_Enable_OFF (16)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Row_Offset_Wrap_Trigger_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Row_Offset_Wrap_Trigger_Enable_MSK (0x00010000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Row_Offset_Wrap_Trigger_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Row_Offset_Wrap_Trigger_Enable_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Base_Subsequence_Type_OFF (20)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Base_Subsequence_Type_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Base_Subsequence_Type_MSK (0x00100000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Base_Subsequence_Type_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Base_Subsequence_Type_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_CADB_Deselect_Enable_OFF (21)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_CADB_Deselect_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_CADB_Deselect_Enable_MSK (0x00200000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_CADB_Deselect_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_CADB_Deselect_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_CADB_Select_Enable_OFF (22)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_CADB_Select_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_CADB_Select_Enable_MSK (0x00400000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_CADB_Select_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_CADB_Select_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_CADB_Seeds_Save_Enable_OFF (23)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_CADB_Seeds_Save_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_CADB_Seeds_Save_Enable_MSK (0x00800000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_CADB_Seeds_Save_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_CADB_Seeds_Save_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Column_Increment_Order_OFF (24)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Column_Increment_Order_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Column_Increment_Order_MSK (0x01000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Column_Increment_Order_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Column_Increment_Order_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Column_Increment_Enable_OFF (26)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Column_Increment_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Column_Increment_Enable_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Column_Increment_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Column_Increment_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Row_Increment_Order_OFF (27)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Row_Increment_Order_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Row_Increment_Order_MSK (0x08000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Row_Increment_Order_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Row_Increment_Order_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Row_Increment_Enable_OFF (29)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Row_Increment_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Row_Increment_Enable_MSK (0x20000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Row_Increment_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Row_Increment_Enable_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Base_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Base_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Base_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Base_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_5_Base_Invert_Data_and_ECC_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_REG (0x00004870)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Offset_Address_Update_Rate_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Offset_Address_Update_Rate_WID ( 5)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Offset_Address_Update_Rate_MSK (0x0000001F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Offset_Address_Update_Rate_MAX (0x0000001F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Offset_Address_Update_Rate_DEF (0x00000002)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Base_Subsequence_Repeat_Rate_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Base_Subsequence_Repeat_Rate_WID ( 5)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Base_Subsequence_Repeat_Rate_MSK (0x00001F00)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Base_Subsequence_Repeat_Rate_MAX (0x0000001F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Base_Subsequence_Repeat_Rate_DEF (0x00000002)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Column_Offset_Wrap_Trigger_Enable_OFF (15)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Column_Offset_Wrap_Trigger_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Column_Offset_Wrap_Trigger_Enable_MSK (0x00008000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Column_Offset_Wrap_Trigger_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Column_Offset_Wrap_Trigger_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Row_Offset_Wrap_Trigger_Enable_OFF (16)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Row_Offset_Wrap_Trigger_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Row_Offset_Wrap_Trigger_Enable_MSK (0x00010000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Row_Offset_Wrap_Trigger_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Row_Offset_Wrap_Trigger_Enable_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Base_Subsequence_Type_OFF (20)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Base_Subsequence_Type_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Base_Subsequence_Type_MSK (0x00100000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Base_Subsequence_Type_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Base_Subsequence_Type_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_CADB_Deselect_Enable_OFF (21)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_CADB_Deselect_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_CADB_Deselect_Enable_MSK (0x00200000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_CADB_Deselect_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_CADB_Deselect_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_CADB_Select_Enable_OFF (22)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_CADB_Select_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_CADB_Select_Enable_MSK (0x00400000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_CADB_Select_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_CADB_Select_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_CADB_Seeds_Save_Enable_OFF (23)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_CADB_Seeds_Save_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_CADB_Seeds_Save_Enable_MSK (0x00800000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_CADB_Seeds_Save_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_CADB_Seeds_Save_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Column_Increment_Order_OFF (24)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Column_Increment_Order_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Column_Increment_Order_MSK (0x01000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Column_Increment_Order_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Column_Increment_Order_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Column_Increment_Enable_OFF (26)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Column_Increment_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Column_Increment_Enable_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Column_Increment_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Column_Increment_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Row_Increment_Order_OFF (27)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Row_Increment_Order_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Row_Increment_Order_MSK (0x08000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Row_Increment_Order_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Row_Increment_Order_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Row_Increment_Enable_OFF (29)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Row_Increment_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Row_Increment_Enable_MSK (0x20000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Row_Increment_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Row_Increment_Enable_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Base_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Base_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Base_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Base_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_6_Base_Invert_Data_and_ECC_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_REG (0x00004874)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Offset_Address_Update_Rate_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Offset_Address_Update_Rate_WID ( 5)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Offset_Address_Update_Rate_MSK (0x0000001F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Offset_Address_Update_Rate_MAX (0x0000001F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Offset_Address_Update_Rate_DEF (0x00000002)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Base_Subsequence_Repeat_Rate_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Base_Subsequence_Repeat_Rate_WID ( 5)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Base_Subsequence_Repeat_Rate_MSK (0x00001F00)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Base_Subsequence_Repeat_Rate_MAX (0x0000001F)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Base_Subsequence_Repeat_Rate_DEF (0x00000002)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Column_Offset_Wrap_Trigger_Enable_OFF (15)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Column_Offset_Wrap_Trigger_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Column_Offset_Wrap_Trigger_Enable_MSK (0x00008000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Column_Offset_Wrap_Trigger_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Column_Offset_Wrap_Trigger_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Row_Offset_Wrap_Trigger_Enable_OFF (16)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Row_Offset_Wrap_Trigger_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Row_Offset_Wrap_Trigger_Enable_MSK (0x00010000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Row_Offset_Wrap_Trigger_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Row_Offset_Wrap_Trigger_Enable_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Base_Subsequence_Type_OFF (20)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Base_Subsequence_Type_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Base_Subsequence_Type_MSK (0x00100000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Base_Subsequence_Type_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Base_Subsequence_Type_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_CADB_Deselect_Enable_OFF (21)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_CADB_Deselect_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_CADB_Deselect_Enable_MSK (0x00200000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_CADB_Deselect_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_CADB_Deselect_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_CADB_Select_Enable_OFF (22)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_CADB_Select_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_CADB_Select_Enable_MSK (0x00400000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_CADB_Select_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_CADB_Select_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_CADB_Seeds_Save_Enable_OFF (23)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_CADB_Seeds_Save_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_CADB_Seeds_Save_Enable_MSK (0x00800000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_CADB_Seeds_Save_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_CADB_Seeds_Save_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Column_Increment_Order_OFF (24)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Column_Increment_Order_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Column_Increment_Order_MSK (0x01000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Column_Increment_Order_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Column_Increment_Order_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Column_Increment_Enable_OFF (26)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Column_Increment_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Column_Increment_Enable_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Column_Increment_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Column_Increment_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Row_Increment_Order_OFF (27)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Row_Increment_Order_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Row_Increment_Order_MSK (0x08000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Row_Increment_Order_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Row_Increment_Order_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Row_Increment_Enable_OFF (29)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Row_Increment_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Row_Increment_Enable_MSK (0x20000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Row_Increment_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Row_Increment_Enable_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Base_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Base_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Base_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Base_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH0_SUBSEQ_OFFSET_CTL_MCMAIN_7_Base_Invert_Data_and_ECC_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_REG (0x00004880)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Offset_Address_Update_Rate_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Offset_Address_Update_Rate_WID ( 5)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Offset_Address_Update_Rate_MSK (0x0000001F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Offset_Address_Update_Rate_MAX (0x0000001F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Offset_Address_Update_Rate_DEF (0x00000002)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Base_Subsequence_Repeat_Rate_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Base_Subsequence_Repeat_Rate_WID ( 5)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Base_Subsequence_Repeat_Rate_MSK (0x00001F00)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Base_Subsequence_Repeat_Rate_MAX (0x0000001F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Base_Subsequence_Repeat_Rate_DEF (0x00000002)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Column_Offset_Wrap_Trigger_Enable_OFF (15)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Column_Offset_Wrap_Trigger_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Column_Offset_Wrap_Trigger_Enable_MSK (0x00008000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Column_Offset_Wrap_Trigger_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Column_Offset_Wrap_Trigger_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Row_Offset_Wrap_Trigger_Enable_OFF (16)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Row_Offset_Wrap_Trigger_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Row_Offset_Wrap_Trigger_Enable_MSK (0x00010000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Row_Offset_Wrap_Trigger_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Row_Offset_Wrap_Trigger_Enable_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Base_Subsequence_Type_OFF (20)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Base_Subsequence_Type_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Base_Subsequence_Type_MSK (0x00100000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Base_Subsequence_Type_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Base_Subsequence_Type_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_CADB_Deselect_Enable_OFF (21)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_CADB_Deselect_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_CADB_Deselect_Enable_MSK (0x00200000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_CADB_Deselect_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_CADB_Deselect_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_CADB_Select_Enable_OFF (22)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_CADB_Select_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_CADB_Select_Enable_MSK (0x00400000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_CADB_Select_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_CADB_Select_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_CADB_Seeds_Save_Enable_OFF (23)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_CADB_Seeds_Save_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_CADB_Seeds_Save_Enable_MSK (0x00800000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_CADB_Seeds_Save_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_CADB_Seeds_Save_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Column_Increment_Order_OFF (24)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Column_Increment_Order_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Column_Increment_Order_MSK (0x01000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Column_Increment_Order_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Column_Increment_Order_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Column_Increment_Enable_OFF (26)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Column_Increment_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Column_Increment_Enable_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Column_Increment_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Column_Increment_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Row_Increment_Order_OFF (27)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Row_Increment_Order_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Row_Increment_Order_MSK (0x08000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Row_Increment_Order_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Row_Increment_Order_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Row_Increment_Enable_OFF (29)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Row_Increment_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Row_Increment_Enable_MSK (0x20000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Row_Increment_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Row_Increment_Enable_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Base_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Base_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Base_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Base_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_0_Base_Invert_Data_and_ECC_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_REG (0x00004884)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Offset_Address_Update_Rate_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Offset_Address_Update_Rate_WID ( 5)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Offset_Address_Update_Rate_MSK (0x0000001F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Offset_Address_Update_Rate_MAX (0x0000001F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Offset_Address_Update_Rate_DEF (0x00000002)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Base_Subsequence_Repeat_Rate_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Base_Subsequence_Repeat_Rate_WID ( 5)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Base_Subsequence_Repeat_Rate_MSK (0x00001F00)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Base_Subsequence_Repeat_Rate_MAX (0x0000001F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Base_Subsequence_Repeat_Rate_DEF (0x00000002)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Column_Offset_Wrap_Trigger_Enable_OFF (15)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Column_Offset_Wrap_Trigger_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Column_Offset_Wrap_Trigger_Enable_MSK (0x00008000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Column_Offset_Wrap_Trigger_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Column_Offset_Wrap_Trigger_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Row_Offset_Wrap_Trigger_Enable_OFF (16)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Row_Offset_Wrap_Trigger_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Row_Offset_Wrap_Trigger_Enable_MSK (0x00010000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Row_Offset_Wrap_Trigger_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Row_Offset_Wrap_Trigger_Enable_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Base_Subsequence_Type_OFF (20)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Base_Subsequence_Type_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Base_Subsequence_Type_MSK (0x00100000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Base_Subsequence_Type_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Base_Subsequence_Type_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_CADB_Deselect_Enable_OFF (21)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_CADB_Deselect_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_CADB_Deselect_Enable_MSK (0x00200000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_CADB_Deselect_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_CADB_Deselect_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_CADB_Select_Enable_OFF (22)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_CADB_Select_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_CADB_Select_Enable_MSK (0x00400000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_CADB_Select_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_CADB_Select_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_CADB_Seeds_Save_Enable_OFF (23)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_CADB_Seeds_Save_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_CADB_Seeds_Save_Enable_MSK (0x00800000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_CADB_Seeds_Save_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_CADB_Seeds_Save_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Column_Increment_Order_OFF (24)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Column_Increment_Order_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Column_Increment_Order_MSK (0x01000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Column_Increment_Order_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Column_Increment_Order_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Column_Increment_Enable_OFF (26)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Column_Increment_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Column_Increment_Enable_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Column_Increment_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Column_Increment_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Row_Increment_Order_OFF (27)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Row_Increment_Order_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Row_Increment_Order_MSK (0x08000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Row_Increment_Order_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Row_Increment_Order_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Row_Increment_Enable_OFF (29)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Row_Increment_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Row_Increment_Enable_MSK (0x20000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Row_Increment_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Row_Increment_Enable_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Base_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Base_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Base_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Base_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_1_Base_Invert_Data_and_ECC_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_REG (0x00004888)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Offset_Address_Update_Rate_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Offset_Address_Update_Rate_WID ( 5)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Offset_Address_Update_Rate_MSK (0x0000001F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Offset_Address_Update_Rate_MAX (0x0000001F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Offset_Address_Update_Rate_DEF (0x00000002)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Base_Subsequence_Repeat_Rate_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Base_Subsequence_Repeat_Rate_WID ( 5)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Base_Subsequence_Repeat_Rate_MSK (0x00001F00)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Base_Subsequence_Repeat_Rate_MAX (0x0000001F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Base_Subsequence_Repeat_Rate_DEF (0x00000002)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Column_Offset_Wrap_Trigger_Enable_OFF (15)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Column_Offset_Wrap_Trigger_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Column_Offset_Wrap_Trigger_Enable_MSK (0x00008000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Column_Offset_Wrap_Trigger_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Column_Offset_Wrap_Trigger_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Row_Offset_Wrap_Trigger_Enable_OFF (16)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Row_Offset_Wrap_Trigger_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Row_Offset_Wrap_Trigger_Enable_MSK (0x00010000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Row_Offset_Wrap_Trigger_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Row_Offset_Wrap_Trigger_Enable_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Base_Subsequence_Type_OFF (20)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Base_Subsequence_Type_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Base_Subsequence_Type_MSK (0x00100000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Base_Subsequence_Type_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Base_Subsequence_Type_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_CADB_Deselect_Enable_OFF (21)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_CADB_Deselect_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_CADB_Deselect_Enable_MSK (0x00200000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_CADB_Deselect_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_CADB_Deselect_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_CADB_Select_Enable_OFF (22)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_CADB_Select_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_CADB_Select_Enable_MSK (0x00400000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_CADB_Select_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_CADB_Select_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_CADB_Seeds_Save_Enable_OFF (23)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_CADB_Seeds_Save_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_CADB_Seeds_Save_Enable_MSK (0x00800000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_CADB_Seeds_Save_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_CADB_Seeds_Save_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Column_Increment_Order_OFF (24)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Column_Increment_Order_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Column_Increment_Order_MSK (0x01000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Column_Increment_Order_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Column_Increment_Order_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Column_Increment_Enable_OFF (26)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Column_Increment_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Column_Increment_Enable_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Column_Increment_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Column_Increment_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Row_Increment_Order_OFF (27)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Row_Increment_Order_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Row_Increment_Order_MSK (0x08000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Row_Increment_Order_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Row_Increment_Order_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Row_Increment_Enable_OFF (29)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Row_Increment_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Row_Increment_Enable_MSK (0x20000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Row_Increment_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Row_Increment_Enable_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Base_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Base_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Base_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Base_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_2_Base_Invert_Data_and_ECC_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_REG (0x0000488C)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Offset_Address_Update_Rate_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Offset_Address_Update_Rate_WID ( 5)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Offset_Address_Update_Rate_MSK (0x0000001F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Offset_Address_Update_Rate_MAX (0x0000001F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Offset_Address_Update_Rate_DEF (0x00000002)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Base_Subsequence_Repeat_Rate_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Base_Subsequence_Repeat_Rate_WID ( 5)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Base_Subsequence_Repeat_Rate_MSK (0x00001F00)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Base_Subsequence_Repeat_Rate_MAX (0x0000001F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Base_Subsequence_Repeat_Rate_DEF (0x00000002)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Column_Offset_Wrap_Trigger_Enable_OFF (15)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Column_Offset_Wrap_Trigger_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Column_Offset_Wrap_Trigger_Enable_MSK (0x00008000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Column_Offset_Wrap_Trigger_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Column_Offset_Wrap_Trigger_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Row_Offset_Wrap_Trigger_Enable_OFF (16)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Row_Offset_Wrap_Trigger_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Row_Offset_Wrap_Trigger_Enable_MSK (0x00010000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Row_Offset_Wrap_Trigger_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Row_Offset_Wrap_Trigger_Enable_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Base_Subsequence_Type_OFF (20)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Base_Subsequence_Type_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Base_Subsequence_Type_MSK (0x00100000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Base_Subsequence_Type_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Base_Subsequence_Type_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_CADB_Deselect_Enable_OFF (21)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_CADB_Deselect_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_CADB_Deselect_Enable_MSK (0x00200000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_CADB_Deselect_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_CADB_Deselect_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_CADB_Select_Enable_OFF (22)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_CADB_Select_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_CADB_Select_Enable_MSK (0x00400000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_CADB_Select_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_CADB_Select_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_CADB_Seeds_Save_Enable_OFF (23)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_CADB_Seeds_Save_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_CADB_Seeds_Save_Enable_MSK (0x00800000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_CADB_Seeds_Save_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_CADB_Seeds_Save_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Column_Increment_Order_OFF (24)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Column_Increment_Order_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Column_Increment_Order_MSK (0x01000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Column_Increment_Order_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Column_Increment_Order_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Column_Increment_Enable_OFF (26)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Column_Increment_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Column_Increment_Enable_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Column_Increment_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Column_Increment_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Row_Increment_Order_OFF (27)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Row_Increment_Order_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Row_Increment_Order_MSK (0x08000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Row_Increment_Order_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Row_Increment_Order_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Row_Increment_Enable_OFF (29)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Row_Increment_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Row_Increment_Enable_MSK (0x20000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Row_Increment_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Row_Increment_Enable_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Base_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Base_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Base_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Base_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_3_Base_Invert_Data_and_ECC_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_REG (0x00004890)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Offset_Address_Update_Rate_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Offset_Address_Update_Rate_WID ( 5)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Offset_Address_Update_Rate_MSK (0x0000001F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Offset_Address_Update_Rate_MAX (0x0000001F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Offset_Address_Update_Rate_DEF (0x00000002)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Base_Subsequence_Repeat_Rate_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Base_Subsequence_Repeat_Rate_WID ( 5)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Base_Subsequence_Repeat_Rate_MSK (0x00001F00)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Base_Subsequence_Repeat_Rate_MAX (0x0000001F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Base_Subsequence_Repeat_Rate_DEF (0x00000002)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Column_Offset_Wrap_Trigger_Enable_OFF (15)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Column_Offset_Wrap_Trigger_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Column_Offset_Wrap_Trigger_Enable_MSK (0x00008000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Column_Offset_Wrap_Trigger_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Column_Offset_Wrap_Trigger_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Row_Offset_Wrap_Trigger_Enable_OFF (16)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Row_Offset_Wrap_Trigger_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Row_Offset_Wrap_Trigger_Enable_MSK (0x00010000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Row_Offset_Wrap_Trigger_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Row_Offset_Wrap_Trigger_Enable_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Base_Subsequence_Type_OFF (20)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Base_Subsequence_Type_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Base_Subsequence_Type_MSK (0x00100000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Base_Subsequence_Type_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Base_Subsequence_Type_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_CADB_Deselect_Enable_OFF (21)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_CADB_Deselect_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_CADB_Deselect_Enable_MSK (0x00200000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_CADB_Deselect_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_CADB_Deselect_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_CADB_Select_Enable_OFF (22)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_CADB_Select_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_CADB_Select_Enable_MSK (0x00400000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_CADB_Select_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_CADB_Select_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_CADB_Seeds_Save_Enable_OFF (23)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_CADB_Seeds_Save_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_CADB_Seeds_Save_Enable_MSK (0x00800000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_CADB_Seeds_Save_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_CADB_Seeds_Save_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Column_Increment_Order_OFF (24)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Column_Increment_Order_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Column_Increment_Order_MSK (0x01000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Column_Increment_Order_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Column_Increment_Order_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Column_Increment_Enable_OFF (26)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Column_Increment_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Column_Increment_Enable_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Column_Increment_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Column_Increment_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Row_Increment_Order_OFF (27)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Row_Increment_Order_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Row_Increment_Order_MSK (0x08000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Row_Increment_Order_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Row_Increment_Order_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Row_Increment_Enable_OFF (29)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Row_Increment_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Row_Increment_Enable_MSK (0x20000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Row_Increment_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Row_Increment_Enable_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Base_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Base_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Base_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Base_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_4_Base_Invert_Data_and_ECC_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_REG (0x00004894)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Offset_Address_Update_Rate_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Offset_Address_Update_Rate_WID ( 5)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Offset_Address_Update_Rate_MSK (0x0000001F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Offset_Address_Update_Rate_MAX (0x0000001F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Offset_Address_Update_Rate_DEF (0x00000002)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Base_Subsequence_Repeat_Rate_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Base_Subsequence_Repeat_Rate_WID ( 5)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Base_Subsequence_Repeat_Rate_MSK (0x00001F00)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Base_Subsequence_Repeat_Rate_MAX (0x0000001F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Base_Subsequence_Repeat_Rate_DEF (0x00000002)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Column_Offset_Wrap_Trigger_Enable_OFF (15)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Column_Offset_Wrap_Trigger_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Column_Offset_Wrap_Trigger_Enable_MSK (0x00008000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Column_Offset_Wrap_Trigger_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Column_Offset_Wrap_Trigger_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Row_Offset_Wrap_Trigger_Enable_OFF (16)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Row_Offset_Wrap_Trigger_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Row_Offset_Wrap_Trigger_Enable_MSK (0x00010000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Row_Offset_Wrap_Trigger_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Row_Offset_Wrap_Trigger_Enable_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Base_Subsequence_Type_OFF (20)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Base_Subsequence_Type_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Base_Subsequence_Type_MSK (0x00100000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Base_Subsequence_Type_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Base_Subsequence_Type_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_CADB_Deselect_Enable_OFF (21)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_CADB_Deselect_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_CADB_Deselect_Enable_MSK (0x00200000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_CADB_Deselect_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_CADB_Deselect_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_CADB_Select_Enable_OFF (22)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_CADB_Select_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_CADB_Select_Enable_MSK (0x00400000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_CADB_Select_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_CADB_Select_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_CADB_Seeds_Save_Enable_OFF (23)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_CADB_Seeds_Save_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_CADB_Seeds_Save_Enable_MSK (0x00800000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_CADB_Seeds_Save_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_CADB_Seeds_Save_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Column_Increment_Order_OFF (24)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Column_Increment_Order_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Column_Increment_Order_MSK (0x01000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Column_Increment_Order_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Column_Increment_Order_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Column_Increment_Enable_OFF (26)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Column_Increment_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Column_Increment_Enable_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Column_Increment_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Column_Increment_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Row_Increment_Order_OFF (27)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Row_Increment_Order_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Row_Increment_Order_MSK (0x08000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Row_Increment_Order_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Row_Increment_Order_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Row_Increment_Enable_OFF (29)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Row_Increment_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Row_Increment_Enable_MSK (0x20000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Row_Increment_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Row_Increment_Enable_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Base_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Base_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Base_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Base_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_5_Base_Invert_Data_and_ECC_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_REG (0x00004898)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Offset_Address_Update_Rate_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Offset_Address_Update_Rate_WID ( 5)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Offset_Address_Update_Rate_MSK (0x0000001F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Offset_Address_Update_Rate_MAX (0x0000001F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Offset_Address_Update_Rate_DEF (0x00000002)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Base_Subsequence_Repeat_Rate_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Base_Subsequence_Repeat_Rate_WID ( 5)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Base_Subsequence_Repeat_Rate_MSK (0x00001F00)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Base_Subsequence_Repeat_Rate_MAX (0x0000001F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Base_Subsequence_Repeat_Rate_DEF (0x00000002)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Column_Offset_Wrap_Trigger_Enable_OFF (15)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Column_Offset_Wrap_Trigger_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Column_Offset_Wrap_Trigger_Enable_MSK (0x00008000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Column_Offset_Wrap_Trigger_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Column_Offset_Wrap_Trigger_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Row_Offset_Wrap_Trigger_Enable_OFF (16)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Row_Offset_Wrap_Trigger_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Row_Offset_Wrap_Trigger_Enable_MSK (0x00010000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Row_Offset_Wrap_Trigger_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Row_Offset_Wrap_Trigger_Enable_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Base_Subsequence_Type_OFF (20)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Base_Subsequence_Type_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Base_Subsequence_Type_MSK (0x00100000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Base_Subsequence_Type_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Base_Subsequence_Type_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_CADB_Deselect_Enable_OFF (21)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_CADB_Deselect_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_CADB_Deselect_Enable_MSK (0x00200000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_CADB_Deselect_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_CADB_Deselect_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_CADB_Select_Enable_OFF (22)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_CADB_Select_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_CADB_Select_Enable_MSK (0x00400000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_CADB_Select_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_CADB_Select_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_CADB_Seeds_Save_Enable_OFF (23)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_CADB_Seeds_Save_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_CADB_Seeds_Save_Enable_MSK (0x00800000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_CADB_Seeds_Save_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_CADB_Seeds_Save_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Column_Increment_Order_OFF (24)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Column_Increment_Order_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Column_Increment_Order_MSK (0x01000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Column_Increment_Order_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Column_Increment_Order_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Column_Increment_Enable_OFF (26)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Column_Increment_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Column_Increment_Enable_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Column_Increment_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Column_Increment_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Row_Increment_Order_OFF (27)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Row_Increment_Order_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Row_Increment_Order_MSK (0x08000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Row_Increment_Order_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Row_Increment_Order_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Row_Increment_Enable_OFF (29)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Row_Increment_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Row_Increment_Enable_MSK (0x20000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Row_Increment_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Row_Increment_Enable_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Base_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Base_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Base_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Base_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_6_Base_Invert_Data_and_ECC_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_REG (0x0000489C)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Offset_Address_Update_Rate_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Offset_Address_Update_Rate_WID ( 5)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Offset_Address_Update_Rate_MSK (0x0000001F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Offset_Address_Update_Rate_MAX (0x0000001F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Offset_Address_Update_Rate_DEF (0x00000002)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Base_Subsequence_Repeat_Rate_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Base_Subsequence_Repeat_Rate_WID ( 5)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Base_Subsequence_Repeat_Rate_MSK (0x00001F00)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Base_Subsequence_Repeat_Rate_MAX (0x0000001F)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Base_Subsequence_Repeat_Rate_DEF (0x00000002)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Column_Offset_Wrap_Trigger_Enable_OFF (15)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Column_Offset_Wrap_Trigger_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Column_Offset_Wrap_Trigger_Enable_MSK (0x00008000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Column_Offset_Wrap_Trigger_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Column_Offset_Wrap_Trigger_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Row_Offset_Wrap_Trigger_Enable_OFF (16)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Row_Offset_Wrap_Trigger_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Row_Offset_Wrap_Trigger_Enable_MSK (0x00010000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Row_Offset_Wrap_Trigger_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Row_Offset_Wrap_Trigger_Enable_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Base_Subsequence_Type_OFF (20)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Base_Subsequence_Type_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Base_Subsequence_Type_MSK (0x00100000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Base_Subsequence_Type_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Base_Subsequence_Type_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_CADB_Deselect_Enable_OFF (21)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_CADB_Deselect_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_CADB_Deselect_Enable_MSK (0x00200000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_CADB_Deselect_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_CADB_Deselect_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_CADB_Select_Enable_OFF (22)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_CADB_Select_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_CADB_Select_Enable_MSK (0x00400000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_CADB_Select_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_CADB_Select_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_CADB_Seeds_Save_Enable_OFF (23)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_CADB_Seeds_Save_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_CADB_Seeds_Save_Enable_MSK (0x00800000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_CADB_Seeds_Save_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_CADB_Seeds_Save_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Column_Increment_Order_OFF (24)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Column_Increment_Order_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Column_Increment_Order_MSK (0x01000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Column_Increment_Order_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Column_Increment_Order_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Column_Increment_Enable_OFF (26)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Column_Increment_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Column_Increment_Enable_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Column_Increment_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Column_Increment_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Row_Increment_Order_OFF (27)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Row_Increment_Order_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Row_Increment_Order_MSK (0x08000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Row_Increment_Order_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Row_Increment_Order_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Row_Increment_Enable_OFF (29)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Row_Increment_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Row_Increment_Enable_MSK (0x20000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Row_Increment_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Row_Increment_Enable_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Base_Invert_Data_and_ECC_OFF (30)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Base_Invert_Data_and_ECC_WID ( 1)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Base_Invert_Data_and_ECC_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Base_Invert_Data_and_ECC_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH1_SUBSEQ_OFFSET_CTL_MCMAIN_7_Base_Invert_Data_and_ECC_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_REG (0x000048A8)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Stop_Base_Sequence_On_Wrap_Trigger_OFF ( 3)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Stop_Base_Sequence_On_Wrap_Trigger_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Stop_Base_Sequence_On_Wrap_Trigger_MSK (0x00000008)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Stop_Base_Sequence_On_Wrap_Trigger_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Stop_Base_Sequence_On_Wrap_Trigger_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Address_Update_Rate_Mode_OFF ( 5)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Address_Update_Rate_Mode_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Address_Update_Rate_Mode_MSK (0x00000020)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Address_Update_Rate_Mode_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Address_Update_Rate_Mode_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Enable_Dummy_Reads_OFF ( 7)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Enable_Dummy_Reads_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Enable_Dummy_Reads_MSK (0x00000080)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Enable_Dummy_Reads_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Enable_Dummy_Reads_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Enable_Constant_Write_Strobe_OFF (10)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Enable_Constant_Write_Strobe_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Enable_Constant_Write_Strobe_MSK (0x00000400)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Enable_Constant_Write_Strobe_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Enable_Constant_Write_Strobe_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Global_Control_OFF (11)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Global_Control_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Global_Control_MSK (0x00000800)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Global_Control_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Global_Control_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Initialization_Mode_OFF (12)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Initialization_Mode_WID ( 2)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Initialization_Mode_MSK (0x00003000)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Initialization_Mode_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Initialization_Mode_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Loopcount_OFF (16)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Loopcount_WID ( 5)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Loopcount_MSK (0x001F0000)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Loopcount_MAX (0x0000001F)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Loopcount_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Subsequence_Start_Pointer_OFF (24)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Subsequence_Start_Pointer_WID ( 3)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Subsequence_Start_Pointer_MSK (0x07000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Subsequence_Start_Pointer_MAX (0x00000007)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Subsequence_Start_Pointer_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Subsequence_End_Pointer_OFF (28)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Subsequence_End_Pointer_WID ( 3)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Subsequence_End_Pointer_MSK (0x70000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Subsequence_End_Pointer_MAX (0x00000007)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Subsequence_End_Pointer_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Start_Test_Delay_OFF (32)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Start_Test_Delay_WID (10)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Start_Test_Delay_MSK (0x3FF00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Start_Test_Delay_MAX (0x000003FF)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Start_Test_Delay_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_REG (0x000048B0)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Stop_Base_Sequence_On_Wrap_Trigger_OFF ( 3)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Stop_Base_Sequence_On_Wrap_Trigger_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Stop_Base_Sequence_On_Wrap_Trigger_MSK (0x00000008)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Stop_Base_Sequence_On_Wrap_Trigger_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Stop_Base_Sequence_On_Wrap_Trigger_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Address_Update_Rate_Mode_OFF ( 5)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Address_Update_Rate_Mode_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Address_Update_Rate_Mode_MSK (0x00000020)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Address_Update_Rate_Mode_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Address_Update_Rate_Mode_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Enable_Dummy_Reads_OFF ( 7)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Enable_Dummy_Reads_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Enable_Dummy_Reads_MSK (0x00000080)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Enable_Dummy_Reads_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Enable_Dummy_Reads_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Enable_Constant_Write_Strobe_OFF (10)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Enable_Constant_Write_Strobe_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Enable_Constant_Write_Strobe_MSK (0x00000400)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Enable_Constant_Write_Strobe_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Enable_Constant_Write_Strobe_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Global_Control_OFF (11)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Global_Control_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Global_Control_MSK (0x00000800)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Global_Control_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Global_Control_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Initialization_Mode_OFF (12)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Initialization_Mode_WID ( 2)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Initialization_Mode_MSK (0x00003000)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Initialization_Mode_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Initialization_Mode_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Loopcount_OFF (16)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Loopcount_WID ( 5)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Loopcount_MSK (0x001F0000)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Loopcount_MAX (0x0000001F)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Loopcount_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Subsequence_Start_Pointer_OFF (24)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Subsequence_Start_Pointer_WID ( 3)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Subsequence_Start_Pointer_MSK (0x07000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Subsequence_Start_Pointer_MAX (0x00000007)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Subsequence_Start_Pointer_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Subsequence_End_Pointer_OFF (28)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Subsequence_End_Pointer_WID ( 3)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Subsequence_End_Pointer_MSK (0x70000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Subsequence_End_Pointer_MAX (0x00000007)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Subsequence_End_Pointer_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Start_Test_Delay_OFF (32)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Start_Test_Delay_WID (10)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Start_Test_Delay_MSK (0x3FF00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Start_Test_Delay_MAX (0x000003FF)
+ #define MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_Start_Test_Delay_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_0_REG (0x000048B8)
+ #define MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_0_Local_Start_Test_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_0_Local_Start_Test_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_0_Local_Start_Test_MSK (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_0_Local_Start_Test_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_0_Local_Start_Test_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_0_Local_Stop_Test_OFF ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_0_Local_Stop_Test_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_0_Local_Stop_Test_MSK (0x00000002)
+ #define MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_0_Local_Stop_Test_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_0_Local_Stop_Test_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_0_Local_Clear_Errors_OFF ( 2)
+ #define MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_0_Local_Clear_Errors_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_0_Local_Clear_Errors_MSK (0x00000004)
+ #define MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_0_Local_Clear_Errors_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_0_Local_Clear_Errors_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_1_REG (0x000048BC)
+ #define MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_1_Local_Start_Test_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_1_Local_Start_Test_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_1_Local_Start_Test_MSK (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_1_Local_Start_Test_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_1_Local_Start_Test_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_1_Local_Stop_Test_OFF ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_1_Local_Stop_Test_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_1_Local_Stop_Test_MSK (0x00000002)
+ #define MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_1_Local_Stop_Test_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_1_Local_Stop_Test_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_1_Local_Clear_Errors_OFF ( 2)
+ #define MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_1_Local_Clear_Errors_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_1_Local_Clear_Errors_MSK (0x00000004)
+ #define MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_1_Local_Clear_Errors_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_1_Local_Clear_Errors_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH_SEQ_LOOPCOUNT_STATUS_MCMAIN_0_REG (0x000048C0)
+ #define MCDFXS_CR_REUT_CH_SEQ_LOOPCOUNT_STATUS_MCMAIN_0_Current_Loopcount_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH_SEQ_LOOPCOUNT_STATUS_MCMAIN_0_Current_Loopcount_WID (32)
+ #define MCDFXS_CR_REUT_CH_SEQ_LOOPCOUNT_STATUS_MCMAIN_0_Current_Loopcount_MSK (0xFFFFFFFF)
+ #define MCDFXS_CR_REUT_CH_SEQ_LOOPCOUNT_STATUS_MCMAIN_0_Current_Loopcount_MAX (0xFFFFFFFF)
+ #define MCDFXS_CR_REUT_CH_SEQ_LOOPCOUNT_STATUS_MCMAIN_0_Current_Loopcount_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH_SEQ_LOOPCOUNT_STATUS_MCMAIN_1_REG (0x000048C4)
+ #define MCDFXS_CR_REUT_CH_SEQ_LOOPCOUNT_STATUS_MCMAIN_1_Current_Loopcount_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH_SEQ_LOOPCOUNT_STATUS_MCMAIN_1_Current_Loopcount_WID (32)
+ #define MCDFXS_CR_REUT_CH_SEQ_LOOPCOUNT_STATUS_MCMAIN_1_Current_Loopcount_MSK (0xFFFFFFFF)
+ #define MCDFXS_CR_REUT_CH_SEQ_LOOPCOUNT_STATUS_MCMAIN_1_Current_Loopcount_MAX (0xFFFFFFFF)
+ #define MCDFXS_CR_REUT_CH_SEQ_LOOPCOUNT_STATUS_MCMAIN_1_Current_Loopcount_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH_SEQ_SUBSEQ_PNTR_MCMAIN_0_REG (0x000048C8)
+ #define MCDFXS_CR_REUT_CH_SEQ_SUBSEQ_PNTR_MCMAIN_0_Current_Subsequence_Pointer_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH_SEQ_SUBSEQ_PNTR_MCMAIN_0_Current_Subsequence_Pointer_WID ( 3)
+ #define MCDFXS_CR_REUT_CH_SEQ_SUBSEQ_PNTR_MCMAIN_0_Current_Subsequence_Pointer_MSK (0x00000007)
+ #define MCDFXS_CR_REUT_CH_SEQ_SUBSEQ_PNTR_MCMAIN_0_Current_Subsequence_Pointer_MAX (0x00000007)
+ #define MCDFXS_CR_REUT_CH_SEQ_SUBSEQ_PNTR_MCMAIN_0_Current_Subsequence_Pointer_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH_SEQ_SUBSEQ_PNTR_MCMAIN_1_REG (0x000048CC)
+ #define MCDFXS_CR_REUT_CH_SEQ_SUBSEQ_PNTR_MCMAIN_1_Current_Subsequence_Pointer_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH_SEQ_SUBSEQ_PNTR_MCMAIN_1_Current_Subsequence_Pointer_WID ( 3)
+ #define MCDFXS_CR_REUT_CH_SEQ_SUBSEQ_PNTR_MCMAIN_1_Current_Subsequence_Pointer_MSK (0x00000007)
+ #define MCDFXS_CR_REUT_CH_SEQ_SUBSEQ_PNTR_MCMAIN_1_Current_Subsequence_Pointer_MAX (0x00000007)
+ #define MCDFXS_CR_REUT_CH_SEQ_SUBSEQ_PNTR_MCMAIN_1_Current_Subsequence_Pointer_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH_SEQ_CACHELINE_STATUS_MCMAIN_0_REG (0x000048D0)
+ #define MCDFXS_CR_REUT_CH_SEQ_CACHELINE_STATUS_MCMAIN_0_Current_Cacheline_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH_SEQ_CACHELINE_STATUS_MCMAIN_0_Current_Cacheline_WID (16)
+ #define MCDFXS_CR_REUT_CH_SEQ_CACHELINE_STATUS_MCMAIN_0_Current_Cacheline_MSK (0x0000FFFF)
+ #define MCDFXS_CR_REUT_CH_SEQ_CACHELINE_STATUS_MCMAIN_0_Current_Cacheline_MAX (0x0000FFFF)
+ #define MCDFXS_CR_REUT_CH_SEQ_CACHELINE_STATUS_MCMAIN_0_Current_Cacheline_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH_SEQ_CACHELINE_STATUS_MCMAIN_1_REG (0x000048D4)
+ #define MCDFXS_CR_REUT_CH_SEQ_CACHELINE_STATUS_MCMAIN_1_Current_Cacheline_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH_SEQ_CACHELINE_STATUS_MCMAIN_1_Current_Cacheline_WID (16)
+ #define MCDFXS_CR_REUT_CH_SEQ_CACHELINE_STATUS_MCMAIN_1_Current_Cacheline_MSK (0x0000FFFF)
+ #define MCDFXS_CR_REUT_CH_SEQ_CACHELINE_STATUS_MCMAIN_1_Current_Cacheline_MAX (0x0000FFFF)
+ #define MCDFXS_CR_REUT_CH_SEQ_CACHELINE_STATUS_MCMAIN_1_Current_Cacheline_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_0_REG (0x000048D8)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_0_Column_Address_OFF (3)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_0_Column_Address_WID_A0 (7)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_0_Column_Address_MSK_A0 (0x000003F8)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_0_Column_Address_MAX_A0 (0x0000007F)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_0_Column_Address_WID (8)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_0_Column_Address_MSK (0x000007F8)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_0_Column_Address_MAX (0x000000FF)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_0_Column_Address_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_0_Row_Address_OFF (24)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_0_Row_Address_WID (16)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_0_Row_Address_MSK (0xFFFF000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_0_Row_Address_MAX (0x0000FFFF)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_0_Row_Address_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_0_Bank_Address_OFF (48)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_0_Bank_Address_WID (3)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_0_Bank_Address_MSK (0x7000000000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_0_Bank_Address_MAX (0x00000007)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_0_Bank_Address_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_0_Rank_Address_OFF (56)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_0_Rank_Address_WID (3)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_0_Rank_Address_MSK (0x700000000000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_0_Rank_Address_MAX (0x00000007)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_0_Rank_Address_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_1_REG (0x000048E0)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_1_Column_Address_OFF (3)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_1_Column_Address_WID_A0 (7)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_1_Column_Address_MSK_A0 (0x000003F8)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_1_Column_Address_MAX_A0 (0x0000007F)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_1_Column_Address_WID (8)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_1_Column_Address_MSK (0x000007F8)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_1_Column_Address_MAX (0x000000FF)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_1_Column_Address_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_1_Row_Address_OFF (24)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_1_Row_Address_WID (16)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_1_Row_Address_MSK (0xFFFF000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_1_Row_Address_MAX (0x0000FFFF)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_1_Row_Address_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_1_Bank_Address_OFF (48)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_1_Bank_Address_WID (3)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_1_Bank_Address_MSK (0x7000000000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_1_Bank_Address_MAX (0x00000007)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_1_Bank_Address_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_1_Rank_Address_OFF (56)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_1_Rank_Address_WID (3)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_1_Rank_Address_MSK (0x700000000000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_1_Rank_Address_MAX (0x00000007)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_1_Rank_Address_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_REG (0x000048E8)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_Column_Address_OFF (3)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_Column_Address_WID_A0 (7)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_Column_Address_MSK_A0 (0x000003F8)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_Column_Address_MAX_A0 (0x0000007F)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_Column_Address_DEF_A0 (0x0000007F)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_Column_Address_WID (8)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_Column_Address_MSK (0x000007F8)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_Column_Address_MAX (0x000000FF)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_Column_Address_DEF (0x000000FF)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_Row_Address_OFF (24)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_Row_Address_WID (16)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_Row_Address_MSK (0xFFFF000000ULL)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_Row_Address_MAX (0x0000FFFF)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_Row_Address_DEF (0x0000FFFF)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_Bank_Address_OFF (48)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_Bank_Address_WID (3)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_Bank_Address_MSK (0x7000000000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_Bank_Address_MAX (0x00000007)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_Bank_Address_DEF (0x00000007)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_Rank_Address_OFF (56)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_Rank_Address_WID (3)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_Rank_Address_MSK (0x700000000000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_Rank_Address_MAX (0x00000007)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_Rank_Address_DEF (0x00000007)
+
+#define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_1_REG (0x000048F0)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_1_Column_Address_OFF (3)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_1_Column_Address_WID_A0 (7)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_1_Column_Address_MSK_A0 (0x000003F8)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_1_Column_Address_MAX_A0 (0x0000007F)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_1_Column_Address_DEF_A0 (0x0000007F)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_1_Column_Address_WID (8)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_1_Column_Address_MSK (0x000007F8)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_1_Column_Address_MAX (0x000000FF)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_1_Column_Address_DEF (0x000000FF)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_1_Row_Address_OFF (24)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_1_Row_Address_WID (16)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_1_Row_Address_MSK (0xFFFF000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_1_Row_Address_MAX (0x0000FFFF)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_1_Row_Address_DEF (0x0000FFFF)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_1_Bank_Address_OFF (48)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_1_Bank_Address_WID (3)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_1_Bank_Address_MSK (0x7000000000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_1_Bank_Address_MAX (0x00000007)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_1_Bank_Address_DEF (0x00000007)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_1_Rank_Address_OFF (56)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_1_Rank_Address_WID (3)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_1_Rank_Address_MSK (0x700000000000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_1_Rank_Address_MAX (0x00000007)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_1_Rank_Address_DEF (0x00000007)
+
+#define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_0_REG (0x000048F8)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_0_Column_Address_OFF (3)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_0_Column_Address_WID_A0 (7)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_0_Column_Address_MSK_A0 (0x000003F8)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_0_Column_Address_MAX_A0 (0x0000007F)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_0_Column_Address_WID (8)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_0_Column_Address_MSK (0x000007F8)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_0_Column_Address_MAX (0x000000FF)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_0_Column_Address_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_0_Row_Address_OFF (24)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_0_Row_Address_WID (16)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_0_Row_Address_MSK (0xFFFF000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_0_Row_Address_MAX (0x0000FFFF)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_0_Row_Address_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_0_Bank_Address_OFF (48)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_0_Bank_Address_WID (3)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_0_Bank_Address_MSK (0x7000000000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_0_Bank_Address_MAX (0x00000007)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_0_Bank_Address_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_0_Rank_Address_OFF (56)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_0_Rank_Address_WID (3)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_0_Rank_Address_MSK (0x700000000000000ULL)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_0_Rank_Address_MAX (0x00000007)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_0_Rank_Address_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_1_REG (0x00004900)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_1_Column_Address_OFF (3)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_1_Column_Address_WID_A0 (7)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_1_Column_Address_MSK_A0 (0x000003F8)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_1_Column_Address_MAX_A0 (0x0000007F)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_1_Column_Address_WID (8)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_1_Column_Address_MSK (0x000007F8)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_1_Column_Address_MAX (0x000000FF)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_1_Column_Address_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_1_Row_Address_OFF (24)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_1_Row_Address_WID (16)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_1_Row_Address_MSK (0xFFFF000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_1_Row_Address_MAX (0x0000FFFF)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_1_Row_Address_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_1_Bank_Address_OFF (48)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_1_Bank_Address_WID (3)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_1_Bank_Address_MSK (0x7000000000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_1_Bank_Address_MAX (0x00000007)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_1_Bank_Address_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_1_Rank_Address_OFF (56)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_1_Rank_Address_WID (3)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_1_Rank_Address_MSK (0x700000000000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_1_Rank_Address_MAX (0x00000007)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_1_Rank_Address_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_REG (0x00004908)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Base_Column_Address_Order_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Base_Column_Address_Order_WID ( 2)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Base_Column_Address_Order_MSK (0x00000003)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Base_Column_Address_Order_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Base_Column_Address_Order_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Base_Row_Address_Order_OFF ( 2)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Base_Row_Address_Order_WID ( 2)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Base_Row_Address_Order_MSK (0x0000000C)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Base_Row_Address_Order_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Base_Row_Address_Order_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Base_Bank_Address_Order_OFF ( 4)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Base_Bank_Address_Order_WID ( 2)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Base_Bank_Address_Order_MSK (0x00000030)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Base_Bank_Address_Order_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Base_Bank_Address_Order_DEF (0x00000002)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Base_Rank_Address_Order_OFF ( 6)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Base_Rank_Address_Order_WID ( 2)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Base_Rank_Address_Order_MSK (0x000000C0)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Base_Rank_Address_Order_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Base_Rank_Address_Order_DEF (0x00000003)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Base_Address_Invert_Rate_OFF (13)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Base_Address_Invert_Rate_WID ( 3)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Base_Address_Invert_Rate_MSK (0x0000E000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Base_Address_Invert_Rate_MAX (0x00000007)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Base_Address_Invert_Rate_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Column_Base_Address_Invert_Enable_OFF (20)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Column_Base_Address_Invert_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Column_Base_Address_Invert_Enable_MSK (0x00100000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Column_Base_Address_Invert_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Column_Base_Address_Invert_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Row_Base_Address_Invert_Enable_OFF (21)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Row_Base_Address_Invert_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Row_Base_Address_Invert_Enable_MSK (0x00200000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Row_Base_Address_Invert_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Row_Base_Address_Invert_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Bank_Base_Address_Invert_Enable_OFF (22)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Bank_Base_Address_Invert_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Bank_Base_Address_Invert_Enable_MSK (0x00400000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Bank_Base_Address_Invert_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Bank_Base_Address_Invert_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Rank_Base_Address_Invert_Enable_OFF (23)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Rank_Base_Address_Invert_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Rank_Base_Address_Invert_Enable_MSK (0x00800000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Rank_Base_Address_Invert_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Rank_Base_Address_Invert_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Column_Base_Wrap_Trigger_Enable_OFF (24)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Column_Base_Wrap_Trigger_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Column_Base_Wrap_Trigger_Enable_MSK (0x01000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Column_Base_Wrap_Trigger_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Column_Base_Wrap_Trigger_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Row_Base_Wrap_Trigger_Enable_OFF (25)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Row_Base_Wrap_Trigger_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Row_Base_Wrap_Trigger_Enable_MSK (0x02000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Row_Base_Wrap_Trigger_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Row_Base_Wrap_Trigger_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Bank_Base_Wrap_Trigger_Enable_OFF (26)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Bank_Base_Wrap_Trigger_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Bank_Base_Wrap_Trigger_Enable_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Bank_Base_Wrap_Trigger_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Bank_Base_Wrap_Trigger_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Rank_Base_Wrap_Trigger_Enable_OFF (27)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Rank_Base_Wrap_Trigger_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Rank_Base_Wrap_Trigger_Enable_MSK (0x08000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Rank_Base_Wrap_Trigger_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Rank_Base_Wrap_Trigger_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Column_Base_Wrap_Carry_Enable_OFF (28)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Column_Base_Wrap_Carry_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Column_Base_Wrap_Carry_Enable_MSK (0x10000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Column_Base_Wrap_Carry_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Column_Base_Wrap_Carry_Enable_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Row_Base_Wrap_Carry_Enable_OFF (29)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Row_Base_Wrap_Carry_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Row_Base_Wrap_Carry_Enable_MSK (0x20000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Row_Base_Wrap_Carry_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Row_Base_Wrap_Carry_Enable_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Bank_Base_Wrap_Carry_Enable_OFF (30)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Bank_Base_Wrap_Carry_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Bank_Base_Wrap_Carry_Enable_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Bank_Base_Wrap_Carry_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Bank_Base_Wrap_Carry_Enable_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Rank_Base_Wrap_Carry_Enable_OFF (31)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Rank_Base_Wrap_Carry_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Rank_Base_Wrap_Carry_Enable_MSK (0x80000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Rank_Base_Wrap_Carry_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_Rank_Base_Wrap_Carry_Enable_DEF (0x00000001)
+
+#define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_REG (0x0000490C)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Base_Column_Address_Order_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Base_Column_Address_Order_WID ( 2)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Base_Column_Address_Order_MSK (0x00000003)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Base_Column_Address_Order_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Base_Column_Address_Order_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Base_Row_Address_Order_OFF ( 2)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Base_Row_Address_Order_WID ( 2)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Base_Row_Address_Order_MSK (0x0000000C)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Base_Row_Address_Order_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Base_Row_Address_Order_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Base_Bank_Address_Order_OFF ( 4)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Base_Bank_Address_Order_WID ( 2)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Base_Bank_Address_Order_MSK (0x00000030)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Base_Bank_Address_Order_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Base_Bank_Address_Order_DEF (0x00000002)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Base_Rank_Address_Order_OFF ( 6)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Base_Rank_Address_Order_WID ( 2)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Base_Rank_Address_Order_MSK (0x000000C0)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Base_Rank_Address_Order_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Base_Rank_Address_Order_DEF (0x00000003)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Base_Address_Invert_Rate_OFF (13)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Base_Address_Invert_Rate_WID ( 3)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Base_Address_Invert_Rate_MSK (0x0000E000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Base_Address_Invert_Rate_MAX (0x00000007)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Base_Address_Invert_Rate_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Column_Base_Address_Invert_Enable_OFF (20)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Column_Base_Address_Invert_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Column_Base_Address_Invert_Enable_MSK (0x00100000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Column_Base_Address_Invert_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Column_Base_Address_Invert_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Row_Base_Address_Invert_Enable_OFF (21)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Row_Base_Address_Invert_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Row_Base_Address_Invert_Enable_MSK (0x00200000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Row_Base_Address_Invert_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Row_Base_Address_Invert_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Bank_Base_Address_Invert_Enable_OFF (22)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Bank_Base_Address_Invert_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Bank_Base_Address_Invert_Enable_MSK (0x00400000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Bank_Base_Address_Invert_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Bank_Base_Address_Invert_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Rank_Base_Address_Invert_Enable_OFF (23)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Rank_Base_Address_Invert_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Rank_Base_Address_Invert_Enable_MSK (0x00800000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Rank_Base_Address_Invert_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Rank_Base_Address_Invert_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Column_Base_Wrap_Trigger_Enable_OFF (24)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Column_Base_Wrap_Trigger_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Column_Base_Wrap_Trigger_Enable_MSK (0x01000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Column_Base_Wrap_Trigger_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Column_Base_Wrap_Trigger_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Row_Base_Wrap_Trigger_Enable_OFF (25)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Row_Base_Wrap_Trigger_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Row_Base_Wrap_Trigger_Enable_MSK (0x02000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Row_Base_Wrap_Trigger_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Row_Base_Wrap_Trigger_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Bank_Base_Wrap_Trigger_Enable_OFF (26)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Bank_Base_Wrap_Trigger_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Bank_Base_Wrap_Trigger_Enable_MSK (0x04000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Bank_Base_Wrap_Trigger_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Bank_Base_Wrap_Trigger_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Rank_Base_Wrap_Trigger_Enable_OFF (27)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Rank_Base_Wrap_Trigger_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Rank_Base_Wrap_Trigger_Enable_MSK (0x08000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Rank_Base_Wrap_Trigger_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Rank_Base_Wrap_Trigger_Enable_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Column_Base_Wrap_Carry_Enable_OFF (28)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Column_Base_Wrap_Carry_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Column_Base_Wrap_Carry_Enable_MSK (0x10000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Column_Base_Wrap_Carry_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Column_Base_Wrap_Carry_Enable_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Row_Base_Wrap_Carry_Enable_OFF (29)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Row_Base_Wrap_Carry_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Row_Base_Wrap_Carry_Enable_MSK (0x20000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Row_Base_Wrap_Carry_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Row_Base_Wrap_Carry_Enable_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Bank_Base_Wrap_Carry_Enable_OFF (30)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Bank_Base_Wrap_Carry_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Bank_Base_Wrap_Carry_Enable_MSK (0x40000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Bank_Base_Wrap_Carry_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Bank_Base_Wrap_Carry_Enable_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Rank_Base_Wrap_Carry_Enable_OFF (31)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Rank_Base_Wrap_Carry_Enable_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Rank_Base_Wrap_Carry_Enable_MSK (0x80000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Rank_Base_Wrap_Carry_Enable_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_Rank_Base_Wrap_Carry_Enable_DEF (0x00000001)
+
+#define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_REG (0x00004910)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Column_Base_Address_Increment_OFF (3)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Column_Base_Address_Increment_WID_A0 (7)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Column_Base_Address_Increment_MSK_A0 (0x000003F8)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Column_Base_Address_Increment_MAX_A0 (0x0000007F)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Column_Base_Address_Increment_WID (8)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Column_Base_Address_Increment_MSK (0x000007F8)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Column_Base_Address_Increment_MAX (0x000000FF)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Column_Base_Address_Increment_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Column_Base_Address_Update_Rate_OFF (12)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Column_Base_Address_Update_Rate_WID (5)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Column_Base_Address_Update_Rate_MSK (0x0001F000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Column_Base_Address_Update_Rate_MAX (0x0000001F)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Column_Base_Address_Update_Rate_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Column_Base_Address_Update_Scale_OFF (19)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Column_Base_Address_Update_Scale_WID (1)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Column_Base_Address_Update_Scale_MSK (0x00080000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Column_Base_Address_Update_Scale_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Column_Base_Address_Update_Scale_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Row_Base_Address_Increment_OFF (20)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Row_Base_Address_Increment_WID (12)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Row_Base_Address_Increment_MSK (0xFFF00000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Row_Base_Address_Increment_MAX (0x00000FFF)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Row_Base_Address_Increment_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Row_Base_Address_Update_Rate_OFF (32)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Row_Base_Address_Update_Rate_WID (4)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Row_Base_Address_Update_Rate_MSK (0xF00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Row_Base_Address_Update_Rate_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Row_Base_Address_Update_Rate_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Row_Base_Address_Update_Scale_OFF (37)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Row_Base_Address_Update_Scale_WID (1)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Row_Base_Address_Update_Scale_MSK (0x2000000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Row_Base_Address_Update_Scale_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Row_Base_Address_Update_Scale_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Bank_Base_Address_Increment_OFF (38)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Bank_Base_Address_Increment_WID (3)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Bank_Base_Address_Increment_MSK (0x1C000000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Bank_Base_Address_Increment_MAX (0x00000007)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Bank_Base_Address_Increment_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Bank_Base_Address_Update_Rate_OFF (44)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Bank_Base_Address_Update_Rate_WID (5)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Bank_Base_Address_Update_Rate_MSK (0x1F00000000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Bank_Base_Address_Update_Rate_MAX (0x0000001F)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Bank_Base_Address_Update_Rate_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Bank_Base_Address_Update_Scale_OFF (51)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Bank_Base_Address_Update_Scale_WID (1)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Bank_Base_Address_Update_Scale_MSK (0x8000000000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Bank_Base_Address_Update_Scale_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Bank_Base_Address_Update_Scale_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Rank_Base_Address_Increment_OFF (52)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Rank_Base_Address_Increment_WID (3)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Rank_Base_Address_Increment_MSK (0x70000000000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Rank_Base_Address_Increment_MAX (0x00000007)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Rank_Base_Address_Increment_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Rank_Base_Address_Update_Rate_OFF (56)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Rank_Base_Address_Update_Rate_WID (5)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Rank_Base_Address_Update_Rate_MSK (0x1F00000000000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Rank_Base_Address_Update_Rate_MAX (0x0000001F)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Rank_Base_Address_Update_Rate_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Rank_Base_Address_Update_Scale_OFF (63)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Rank_Base_Address_Update_Scale_WID (1)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Rank_Base_Address_Update_Scale_MSK (0x8000000000000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Rank_Base_Address_Update_Scale_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Rank_Base_Address_Update_Scale_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_REG (0x00004918)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Column_Base_Address_Increment_OFF (3)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Column_Base_Address_Increment_WID_A0 (7)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Column_Base_Address_Increment_MSK_A0 (0x000003F8)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Column_Base_Address_Increment_MAX_A0 (0x0000007F)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Column_Base_Address_Increment_WID (8)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Column_Base_Address_Increment_MSK (0x000007F8)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Column_Base_Address_Increment_MAX (0x000000FF)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Column_Base_Address_Increment_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Column_Base_Address_Update_Rate_OFF (12)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Column_Base_Address_Update_Rate_WID (5)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Column_Base_Address_Update_Rate_MSK (0x0001F000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Column_Base_Address_Update_Rate_MAX (0x0000001F)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Column_Base_Address_Update_Rate_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Column_Base_Address_Update_Scale_OFF (19)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Column_Base_Address_Update_Scale_WID (1)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Column_Base_Address_Update_Scale_MSK (0x00080000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Column_Base_Address_Update_Scale_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Column_Base_Address_Update_Scale_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Row_Base_Address_Increment_OFF (20)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Row_Base_Address_Increment_WID (12)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Row_Base_Address_Increment_MSK (0xFFF00000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Row_Base_Address_Increment_MAX (0x00000FFF)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Row_Base_Address_Increment_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Row_Base_Address_Update_Rate_OFF (32)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Row_Base_Address_Update_Rate_WID (4)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Row_Base_Address_Update_Rate_MSK (0xF00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Row_Base_Address_Update_Rate_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Row_Base_Address_Update_Rate_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Row_Base_Address_Update_Scale_OFF (37)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Row_Base_Address_Update_Scale_WID (1)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Row_Base_Address_Update_Scale_MSK (0x2000000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Row_Base_Address_Update_Scale_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Row_Base_Address_Update_Scale_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Bank_Base_Address_Increment_OFF (38)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Bank_Base_Address_Increment_WID (3)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Bank_Base_Address_Increment_MSK (0x1C000000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Bank_Base_Address_Increment_MAX (0x00000007)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Bank_Base_Address_Increment_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Bank_Base_Address_Update_Rate_OFF (44)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Bank_Base_Address_Update_Rate_WID (5)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Bank_Base_Address_Update_Rate_MSK (0x1F00000000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Bank_Base_Address_Update_Rate_MAX (0x0000001F)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Bank_Base_Address_Update_Rate_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Bank_Base_Address_Update_Scale_OFF (51)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Bank_Base_Address_Update_Scale_WID (1)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Bank_Base_Address_Update_Scale_MSK (0x8000000000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Bank_Base_Address_Update_Scale_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Bank_Base_Address_Update_Scale_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Rank_Base_Address_Increment_OFF (52)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Rank_Base_Address_Increment_WID (3)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Rank_Base_Address_Increment_MSK (0x70000000000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Rank_Base_Address_Increment_MAX (0x00000007)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Rank_Base_Address_Increment_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Rank_Base_Address_Update_Rate_OFF (56)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Rank_Base_Address_Update_Rate_WID (5)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Rank_Base_Address_Update_Rate_MSK (0x1F00000000000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Rank_Base_Address_Update_Rate_MAX (0x0000001F)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Rank_Base_Address_Update_Rate_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Rank_Base_Address_Update_Scale_OFF (63)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Rank_Base_Address_Update_Scale_WID (1)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Rank_Base_Address_Update_Scale_MSK (0x8000000000000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Rank_Base_Address_Update_Scale_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_Rank_Base_Address_Update_Scale_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH_SEQ_OFFSET_ADDR_CURRENT_MCMAIN_0_REG (0x00004920)
+ #define MCDFXS_CR_REUT_CH_SEQ_OFFSET_ADDR_CURRENT_MCMAIN_0_Column_Address_OFF (3)
+ #define MCDFXS_CR_REUT_CH_SEQ_OFFSET_ADDR_CURRENT_MCMAIN_0_Column_Address_WID_A0 (7)
+ #define MCDFXS_CR_REUT_CH_SEQ_OFFSET_ADDR_CURRENT_MCMAIN_0_Column_Address_MSK_A0 (0x000003F8)
+ #define MCDFXS_CR_REUT_CH_SEQ_OFFSET_ADDR_CURRENT_MCMAIN_0_Column_Address_MAX_A0 (0x0000007F)
+ #define MCDFXS_CR_REUT_CH_SEQ_OFFSET_ADDR_CURRENT_MCMAIN_0_Column_Address_WID (8)
+ #define MCDFXS_CR_REUT_CH_SEQ_OFFSET_ADDR_CURRENT_MCMAIN_0_Column_Address_MSK (0x000007F8)
+ #define MCDFXS_CR_REUT_CH_SEQ_OFFSET_ADDR_CURRENT_MCMAIN_0_Column_Address_MAX (0x000000FF)
+ #define MCDFXS_CR_REUT_CH_SEQ_OFFSET_ADDR_CURRENT_MCMAIN_0_Column_Address_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_OFFSET_ADDR_CURRENT_MCMAIN_0_Row_Address_OFF (24)
+ #define MCDFXS_CR_REUT_CH_SEQ_OFFSET_ADDR_CURRENT_MCMAIN_0_Row_Address_WID (16)
+ #define MCDFXS_CR_REUT_CH_SEQ_OFFSET_ADDR_CURRENT_MCMAIN_0_Row_Address_MSK (0xFFFF000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_OFFSET_ADDR_CURRENT_MCMAIN_0_Row_Address_MAX (0x0000FFFF)
+ #define MCDFXS_CR_REUT_CH_SEQ_OFFSET_ADDR_CURRENT_MCMAIN_0_Row_Address_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH_SEQ_OFFSET_ADDR_CURRENT_MCMAIN_1_REG (0x00004928)
+ #define MCDFXS_CR_REUT_CH_SEQ_OFFSET_ADDR_CURRENT_MCMAIN_1_Column_Address_OFF (3)
+ #define MCDFXS_CR_REUT_CH_SEQ_OFFSET_ADDR_CURRENT_MCMAIN_1_Column_Address_WID_A0 (7)
+ #define MCDFXS_CR_REUT_CH_SEQ_OFFSET_ADDR_CURRENT_MCMAIN_1_Column_Address_MSK_A0 (0x000003F8)
+ #define MCDFXS_CR_REUT_CH_SEQ_OFFSET_ADDR_CURRENT_MCMAIN_1_Column_Address_MAX_A0 (0x0000007F)
+ #define MCDFXS_CR_REUT_CH_SEQ_OFFSET_ADDR_CURRENT_MCMAIN_1_Column_Address_WID (8)
+ #define MCDFXS_CR_REUT_CH_SEQ_OFFSET_ADDR_CURRENT_MCMAIN_1_Column_Address_MSK (0x000007F8)
+ #define MCDFXS_CR_REUT_CH_SEQ_OFFSET_ADDR_CURRENT_MCMAIN_1_Column_Address_MAX (0x000000FF)
+ #define MCDFXS_CR_REUT_CH_SEQ_OFFSET_ADDR_CURRENT_MCMAIN_1_Column_Address_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_OFFSET_ADDR_CURRENT_MCMAIN_1_Row_Address_OFF (24)
+ #define MCDFXS_CR_REUT_CH_SEQ_OFFSET_ADDR_CURRENT_MCMAIN_1_Row_Address_WID (16)
+ #define MCDFXS_CR_REUT_CH_SEQ_OFFSET_ADDR_CURRENT_MCMAIN_1_Row_Address_MSK (0xFFFF000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_OFFSET_ADDR_CURRENT_MCMAIN_1_Row_Address_MAX (0x0000FFFF)
+ #define MCDFXS_CR_REUT_CH_SEQ_OFFSET_ADDR_CURRENT_MCMAIN_1_Row_Address_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_REG (0x00004930)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_Logical_to_Physical_Rank0_Mapping_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_Logical_to_Physical_Rank0_Mapping_WID ( 2)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_Logical_to_Physical_Rank0_Mapping_MSK (0x00000003)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_Logical_to_Physical_Rank0_Mapping_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_Logical_to_Physical_Rank0_Mapping_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_Logical_to_Physical_Rank1_Mapping_OFF ( 4)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_Logical_to_Physical_Rank1_Mapping_WID ( 2)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_Logical_to_Physical_Rank1_Mapping_MSK (0x00000030)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_Logical_to_Physical_Rank1_Mapping_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_Logical_to_Physical_Rank1_Mapping_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_Logical_to_Physical_Rank2_Mapping_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_Logical_to_Physical_Rank2_Mapping_WID ( 2)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_Logical_to_Physical_Rank2_Mapping_MSK (0x00000300)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_Logical_to_Physical_Rank2_Mapping_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_Logical_to_Physical_Rank2_Mapping_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_Logical_to_Physical_Rank3_Mapping_OFF (12)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_Logical_to_Physical_Rank3_Mapping_WID ( 2)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_Logical_to_Physical_Rank3_Mapping_MSK (0x00003000)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_Logical_to_Physical_Rank3_Mapping_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_Logical_to_Physical_Rank3_Mapping_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_Logical_to_Physical_Rank4_Mapping_OFF (16)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_Logical_to_Physical_Rank4_Mapping_WID ( 2)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_Logical_to_Physical_Rank4_Mapping_MSK (0x00030000)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_Logical_to_Physical_Rank4_Mapping_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_Logical_to_Physical_Rank4_Mapping_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_Logical_to_Physical_Rank5_Mapping_OFF (20)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_Logical_to_Physical_Rank5_Mapping_WID ( 2)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_Logical_to_Physical_Rank5_Mapping_MSK (0x00300000)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_Logical_to_Physical_Rank5_Mapping_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_Logical_to_Physical_Rank5_Mapping_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_Logical_to_Physical_Rank6_Mapping_OFF (24)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_Logical_to_Physical_Rank6_Mapping_WID ( 2)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_Logical_to_Physical_Rank6_Mapping_MSK (0x03000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_Logical_to_Physical_Rank6_Mapping_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_Logical_to_Physical_Rank6_Mapping_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_Logical_to_Physical_Rank7_Mapping_OFF (28)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_Logical_to_Physical_Rank7_Mapping_WID ( 2)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_Logical_to_Physical_Rank7_Mapping_MSK (0x30000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_Logical_to_Physical_Rank7_Mapping_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_Logical_to_Physical_Rank7_Mapping_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_REG (0x00004934)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_Logical_to_Physical_Rank0_Mapping_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_Logical_to_Physical_Rank0_Mapping_WID ( 2)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_Logical_to_Physical_Rank0_Mapping_MSK (0x00000003)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_Logical_to_Physical_Rank0_Mapping_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_Logical_to_Physical_Rank0_Mapping_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_Logical_to_Physical_Rank1_Mapping_OFF ( 4)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_Logical_to_Physical_Rank1_Mapping_WID ( 2)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_Logical_to_Physical_Rank1_Mapping_MSK (0x00000030)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_Logical_to_Physical_Rank1_Mapping_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_Logical_to_Physical_Rank1_Mapping_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_Logical_to_Physical_Rank2_Mapping_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_Logical_to_Physical_Rank2_Mapping_WID ( 2)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_Logical_to_Physical_Rank2_Mapping_MSK (0x00000300)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_Logical_to_Physical_Rank2_Mapping_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_Logical_to_Physical_Rank2_Mapping_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_Logical_to_Physical_Rank3_Mapping_OFF (12)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_Logical_to_Physical_Rank3_Mapping_WID ( 2)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_Logical_to_Physical_Rank3_Mapping_MSK (0x00003000)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_Logical_to_Physical_Rank3_Mapping_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_Logical_to_Physical_Rank3_Mapping_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_Logical_to_Physical_Rank4_Mapping_OFF (16)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_Logical_to_Physical_Rank4_Mapping_WID ( 2)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_Logical_to_Physical_Rank4_Mapping_MSK (0x00030000)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_Logical_to_Physical_Rank4_Mapping_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_Logical_to_Physical_Rank4_Mapping_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_Logical_to_Physical_Rank5_Mapping_OFF (20)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_Logical_to_Physical_Rank5_Mapping_WID ( 2)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_Logical_to_Physical_Rank5_Mapping_MSK (0x00300000)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_Logical_to_Physical_Rank5_Mapping_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_Logical_to_Physical_Rank5_Mapping_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_Logical_to_Physical_Rank6_Mapping_OFF (24)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_Logical_to_Physical_Rank6_Mapping_WID ( 2)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_Logical_to_Physical_Rank6_Mapping_MSK (0x03000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_Logical_to_Physical_Rank6_Mapping_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_Logical_to_Physical_Rank6_Mapping_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_Logical_to_Physical_Rank7_Mapping_OFF (28)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_Logical_to_Physical_Rank7_Mapping_WID ( 2)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_Logical_to_Physical_Rank7_Mapping_MSK (0x30000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_Logical_to_Physical_Rank7_Mapping_MAX (0x00000003)
+ #define MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_Logical_to_Physical_Rank7_Mapping_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_0_REG (0x00004938)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_0_Logical_to_Physical_Row0_Swizzle_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_0_Logical_to_Physical_Row0_Swizzle_WID ( 4)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_0_Logical_to_Physical_Row0_Swizzle_MSK (0x0000000F)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_0_Logical_to_Physical_Row0_Swizzle_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_0_Logical_to_Physical_Row0_Swizzle_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_0_Logical_to_Physical_Row1_Swizzle_OFF ( 5)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_0_Logical_to_Physical_Row1_Swizzle_WID ( 4)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_0_Logical_to_Physical_Row1_Swizzle_MSK (0x000001E0)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_0_Logical_to_Physical_Row1_Swizzle_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_0_Logical_to_Physical_Row1_Swizzle_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_0_Logical_to_Physical_Row2_Swizzle_OFF (10)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_0_Logical_to_Physical_Row2_Swizzle_WID ( 4)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_0_Logical_to_Physical_Row2_Swizzle_MSK (0x00003C00)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_0_Logical_to_Physical_Row2_Swizzle_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_0_Logical_to_Physical_Row2_Swizzle_DEF (0x00000002)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_0_Logical_to_Physical_Row3_Swizzle_OFF (15)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_0_Logical_to_Physical_Row3_Swizzle_WID ( 4)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_0_Logical_to_Physical_Row3_Swizzle_MSK (0x00078000)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_0_Logical_to_Physical_Row3_Swizzle_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_0_Logical_to_Physical_Row3_Swizzle_DEF (0x00000003)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_0_Logical_to_Physical_Row4_Swizzle_OFF (20)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_0_Logical_to_Physical_Row4_Swizzle_WID ( 4)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_0_Logical_to_Physical_Row4_Swizzle_MSK (0x00F00000)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_0_Logical_to_Physical_Row4_Swizzle_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_0_Logical_to_Physical_Row4_Swizzle_DEF (0x00000004)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_0_Logical_to_Physical_Row5_Swizzle_OFF (25)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_0_Logical_to_Physical_Row5_Swizzle_WID ( 4)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_0_Logical_to_Physical_Row5_Swizzle_MSK (0x1E000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_0_Logical_to_Physical_Row5_Swizzle_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_0_Logical_to_Physical_Row5_Swizzle_DEF (0x00000005)
+
+#define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_1_REG (0x0000493C)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_1_Logical_to_Physical_Row0_Swizzle_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_1_Logical_to_Physical_Row0_Swizzle_WID ( 4)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_1_Logical_to_Physical_Row0_Swizzle_MSK (0x0000000F)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_1_Logical_to_Physical_Row0_Swizzle_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_1_Logical_to_Physical_Row0_Swizzle_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_1_Logical_to_Physical_Row1_Swizzle_OFF ( 5)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_1_Logical_to_Physical_Row1_Swizzle_WID ( 4)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_1_Logical_to_Physical_Row1_Swizzle_MSK (0x000001E0)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_1_Logical_to_Physical_Row1_Swizzle_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_1_Logical_to_Physical_Row1_Swizzle_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_1_Logical_to_Physical_Row2_Swizzle_OFF (10)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_1_Logical_to_Physical_Row2_Swizzle_WID ( 4)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_1_Logical_to_Physical_Row2_Swizzle_MSK (0x00003C00)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_1_Logical_to_Physical_Row2_Swizzle_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_1_Logical_to_Physical_Row2_Swizzle_DEF (0x00000002)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_1_Logical_to_Physical_Row3_Swizzle_OFF (15)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_1_Logical_to_Physical_Row3_Swizzle_WID ( 4)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_1_Logical_to_Physical_Row3_Swizzle_MSK (0x00078000)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_1_Logical_to_Physical_Row3_Swizzle_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_1_Logical_to_Physical_Row3_Swizzle_DEF (0x00000003)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_1_Logical_to_Physical_Row4_Swizzle_OFF (20)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_1_Logical_to_Physical_Row4_Swizzle_WID ( 4)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_1_Logical_to_Physical_Row4_Swizzle_MSK (0x00F00000)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_1_Logical_to_Physical_Row4_Swizzle_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_1_Logical_to_Physical_Row4_Swizzle_DEF (0x00000004)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_1_Logical_to_Physical_Row5_Swizzle_OFF (25)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_1_Logical_to_Physical_Row5_Swizzle_WID ( 4)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_1_Logical_to_Physical_Row5_Swizzle_MSK (0x1E000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_1_Logical_to_Physical_Row5_Swizzle_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_LOWER_MCMAIN_1_Logical_to_Physical_Row5_Swizzle_DEF (0x00000005)
+
+#define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_REG (0x00004940)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row6_Swizzle_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row6_Swizzle_WID ( 4)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row6_Swizzle_MSK (0x0000000F)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row6_Swizzle_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row6_Swizzle_DEF (0x00000006)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row7_Swizzle_OFF ( 5)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row7_Swizzle_WID ( 4)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row7_Swizzle_MSK (0x000001E0)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row7_Swizzle_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row7_Swizzle_DEF (0x00000007)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row8_Swizzle_OFF (10)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row8_Swizzle_WID ( 4)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row8_Swizzle_MSK (0x00003C00)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row8_Swizzle_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row8_Swizzle_DEF (0x00000008)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row9_Swizzle_OFF (15)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row9_Swizzle_WID ( 4)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row9_Swizzle_MSK (0x00078000)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row9_Swizzle_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row9_Swizzle_DEF (0x00000009)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row10_Swizzle_OFF (20)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row10_Swizzle_WID ( 4)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row10_Swizzle_MSK (0x00F00000)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row10_Swizzle_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row10_Swizzle_DEF (0x0000000A)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row11_Swizzle_OFF (25)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row11_Swizzle_WID ( 4)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row11_Swizzle_MSK (0x1E000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row11_Swizzle_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row11_Swizzle_DEF (0x0000000B)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row12_Swizzle_OFF (30)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row12_Swizzle_WID ( 4)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row12_Swizzle_MSK (0x3C0000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row12_Swizzle_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row12_Swizzle_DEF (0x0000000C)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row13_Swizzle_OFF (35)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row13_Swizzle_WID ( 4)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row13_Swizzle_MSK (0x7800000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row13_Swizzle_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row13_Swizzle_DEF (0x0000000D)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row14_Swizzle_OFF (40)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row14_Swizzle_WID ( 4)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row14_Swizzle_MSK (0xF0000000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row14_Swizzle_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row14_Swizzle_DEF (0x0000000E)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row15_Swizzle_OFF (45)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row15_Swizzle_WID ( 4)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row15_Swizzle_MSK (0x1E00000000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row15_Swizzle_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_0_Logical_to_Physical_Row15_Swizzle_DEF (0x0000000F)
+
+#define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_REG (0x00004948)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row6_Swizzle_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row6_Swizzle_WID ( 4)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row6_Swizzle_MSK (0x0000000F)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row6_Swizzle_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row6_Swizzle_DEF (0x00000006)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row7_Swizzle_OFF ( 5)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row7_Swizzle_WID ( 4)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row7_Swizzle_MSK (0x000001E0)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row7_Swizzle_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row7_Swizzle_DEF (0x00000007)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row8_Swizzle_OFF (10)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row8_Swizzle_WID ( 4)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row8_Swizzle_MSK (0x00003C00)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row8_Swizzle_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row8_Swizzle_DEF (0x00000008)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row9_Swizzle_OFF (15)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row9_Swizzle_WID ( 4)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row9_Swizzle_MSK (0x00078000)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row9_Swizzle_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row9_Swizzle_DEF (0x00000009)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row10_Swizzle_OFF (20)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row10_Swizzle_WID ( 4)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row10_Swizzle_MSK (0x00F00000)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row10_Swizzle_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row10_Swizzle_DEF (0x0000000A)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row11_Swizzle_OFF (25)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row11_Swizzle_WID ( 4)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row11_Swizzle_MSK (0x1E000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row11_Swizzle_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row11_Swizzle_DEF (0x0000000B)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row12_Swizzle_OFF (30)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row12_Swizzle_WID ( 4)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row12_Swizzle_MSK (0x3C0000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row12_Swizzle_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row12_Swizzle_DEF (0x0000000C)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row13_Swizzle_OFF (35)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row13_Swizzle_WID ( 4)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row13_Swizzle_MSK (0x7800000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row13_Swizzle_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row13_Swizzle_DEF (0x0000000D)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row14_Swizzle_OFF (40)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row14_Swizzle_WID ( 4)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row14_Swizzle_MSK (0xF0000000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row14_Swizzle_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row14_Swizzle_DEF (0x0000000E)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row15_Swizzle_OFF (45)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row15_Swizzle_WID ( 4)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row15_Swizzle_MSK (0x1E00000000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row15_Swizzle_MAX (0x0000000F)
+ #define MCDFXS_CR_REUT_CH_SEQ_ROW_ADDR_SWIZZLE_UPPER_MCMAIN_1_Logical_to_Physical_Row15_Swizzle_DEF (0x0000000F)
+
+#define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_ADDRESS_MCMAIN_0_REG (0x00004950)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_ADDRESS_MCMAIN_0_Dummy_Read_Row_Current_Address_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_ADDRESS_MCMAIN_0_Dummy_Read_Row_Current_Address_WID (16)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_ADDRESS_MCMAIN_0_Dummy_Read_Row_Current_Address_MSK (0x0000FFFF)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_ADDRESS_MCMAIN_0_Dummy_Read_Row_Current_Address_MAX (0x0000FFFF)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_ADDRESS_MCMAIN_0_Dummy_Read_Row_Current_Address_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_ADDRESS_MCMAIN_0_Dummy_Read_Bank_Current_Address_OFF (24)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_ADDRESS_MCMAIN_0_Dummy_Read_Bank_Current_Address_WID ( 3)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_ADDRESS_MCMAIN_0_Dummy_Read_Bank_Current_Address_MSK (0x07000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_ADDRESS_MCMAIN_0_Dummy_Read_Bank_Current_Address_MAX (0x00000007)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_ADDRESS_MCMAIN_0_Dummy_Read_Bank_Current_Address_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_ADDRESS_MCMAIN_1_REG (0x00004954)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_ADDRESS_MCMAIN_1_Dummy_Read_Row_Current_Address_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_ADDRESS_MCMAIN_1_Dummy_Read_Row_Current_Address_WID (16)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_ADDRESS_MCMAIN_1_Dummy_Read_Row_Current_Address_MSK (0x0000FFFF)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_ADDRESS_MCMAIN_1_Dummy_Read_Row_Current_Address_MAX (0x0000FFFF)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_ADDRESS_MCMAIN_1_Dummy_Read_Row_Current_Address_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_ADDRESS_MCMAIN_1_Dummy_Read_Bank_Current_Address_OFF (24)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_ADDRESS_MCMAIN_1_Dummy_Read_Bank_Current_Address_WID ( 3)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_ADDRESS_MCMAIN_1_Dummy_Read_Bank_Current_Address_MSK (0x07000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_ADDRESS_MCMAIN_1_Dummy_Read_Bank_Current_Address_MAX (0x00000007)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_ADDRESS_MCMAIN_1_Dummy_Read_Bank_Current_Address_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_MASK_MCMAIN_0_REG (0x00004958)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_MASK_MCMAIN_0_Dummy_Read_Bank_Mask_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_MASK_MCMAIN_0_Dummy_Read_Bank_Mask_WID ( 8)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_MASK_MCMAIN_0_Dummy_Read_Bank_Mask_MSK (0x000000FF)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_MASK_MCMAIN_0_Dummy_Read_Bank_Mask_MAX (0x000000FF)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_MASK_MCMAIN_0_Dummy_Read_Bank_Mask_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_MASK_MCMAIN_1_REG (0x0000495C)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_MASK_MCMAIN_1_Dummy_Read_Bank_Mask_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_MASK_MCMAIN_1_Dummy_Read_Bank_Mask_WID ( 8)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_MASK_MCMAIN_1_Dummy_Read_Bank_Mask_MSK (0x000000FF)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_MASK_MCMAIN_1_Dummy_Read_Bank_Mask_MAX (0x000000FF)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_MASK_MCMAIN_1_Dummy_Read_Bank_Mask_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_0_REG (0x00004960)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_0_L_DummyRead_Select_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_0_L_DummyRead_Select_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_0_L_DummyRead_Select_MSK (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_0_L_DummyRead_Select_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_0_L_DummyRead_Select_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_0_Enable_Sweep_Frequency_OFF ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_0_Enable_Sweep_Frequency_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_0_Enable_Sweep_Frequency_MSK (0x00000002)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_0_Enable_Sweep_Frequency_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_0_Enable_Sweep_Frequency_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_0_L_counter_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_0_L_counter_WID ( 8)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_0_L_counter_MSK (0x0000FF00)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_0_L_counter_MAX (0x000000FF)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_0_L_counter_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_0_M_counter_OFF (16)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_0_M_counter_WID ( 8)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_0_M_counter_MSK (0x00FF0000)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_0_M_counter_MAX (0x000000FF)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_0_M_counter_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_0_N_Counter_OFF (24)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_0_N_Counter_WID ( 8)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_0_N_Counter_MSK (0xFF000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_0_N_Counter_MAX (0x000000FF)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_0_N_Counter_DEF (0x00000001)
+
+#define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_1_REG (0x00004964)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_1_L_DummyRead_Select_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_1_L_DummyRead_Select_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_1_L_DummyRead_Select_MSK (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_1_L_DummyRead_Select_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_1_L_DummyRead_Select_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_1_Enable_Sweep_Frequency_OFF ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_1_Enable_Sweep_Frequency_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_1_Enable_Sweep_Frequency_MSK (0x00000002)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_1_Enable_Sweep_Frequency_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_1_Enable_Sweep_Frequency_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_1_L_counter_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_1_L_counter_WID ( 8)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_1_L_counter_MSK (0x0000FF00)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_1_L_counter_MAX (0x000000FF)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_1_L_counter_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_1_M_counter_OFF (16)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_1_M_counter_WID ( 8)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_1_M_counter_MSK (0x00FF0000)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_1_M_counter_MAX (0x000000FF)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_1_M_counter_DEF (0x00000001)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_1_N_Counter_OFF (24)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_1_N_Counter_WID ( 8)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_1_N_Counter_MSK (0xFF000000)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_1_N_Counter_MAX (0x000000FF)
+ #define MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_1_N_Counter_DEF (0x00000001)
+
+#define MCDFXS_CR_VISA_CTL_MCDFXS_MCMAIN_REG (0x00004968)
+ #define MCDFXS_CR_VISA_CTL_MCDFXS_MCMAIN_EN_CLK_OFF ( 0)
+ #define MCDFXS_CR_VISA_CTL_MCDFXS_MCMAIN_EN_CLK_WID ( 1)
+ #define MCDFXS_CR_VISA_CTL_MCDFXS_MCMAIN_EN_CLK_MSK (0x00000001)
+ #define MCDFXS_CR_VISA_CTL_MCDFXS_MCMAIN_EN_CLK_MAX (0x00000001)
+ #define MCDFXS_CR_VISA_CTL_MCDFXS_MCMAIN_EN_CLK_DEF (0x00000000)
+ #define MCDFXS_CR_VISA_CTL_MCDFXS_MCMAIN_L0_DATA_BYTE_SEL_OFF ( 1)
+ #define MCDFXS_CR_VISA_CTL_MCDFXS_MCMAIN_L0_DATA_BYTE_SEL_WID ( 7)
+ #define MCDFXS_CR_VISA_CTL_MCDFXS_MCMAIN_L0_DATA_BYTE_SEL_MSK (0x000000FE)
+ #define MCDFXS_CR_VISA_CTL_MCDFXS_MCMAIN_L0_DATA_BYTE_SEL_MAX (0x0000007F)
+ #define MCDFXS_CR_VISA_CTL_MCDFXS_MCMAIN_L0_DATA_BYTE_SEL_DEF (0x00000000)
+ #define MCDFXS_CR_VISA_CTL_MCDFXS_MCMAIN_L0_BYP_SEL_OFF ( 8)
+ #define MCDFXS_CR_VISA_CTL_MCDFXS_MCMAIN_L0_BYP_SEL_WID ( 1)
+ #define MCDFXS_CR_VISA_CTL_MCDFXS_MCMAIN_L0_BYP_SEL_MSK (0x00000100)
+ #define MCDFXS_CR_VISA_CTL_MCDFXS_MCMAIN_L0_BYP_SEL_MAX (0x00000001)
+ #define MCDFXS_CR_VISA_CTL_MCDFXS_MCMAIN_L0_BYP_SEL_DEF (0x00000000)
+ #define MCDFXS_CR_VISA_CTL_MCDFXS_MCMAIN_L1_DATA_BYTE_SEL_OFF ( 9)
+ #define MCDFXS_CR_VISA_CTL_MCDFXS_MCMAIN_L1_DATA_BYTE_SEL_WID ( 7)
+ #define MCDFXS_CR_VISA_CTL_MCDFXS_MCMAIN_L1_DATA_BYTE_SEL_MSK (0x0000FE00)
+ #define MCDFXS_CR_VISA_CTL_MCDFXS_MCMAIN_L1_DATA_BYTE_SEL_MAX (0x0000007F)
+ #define MCDFXS_CR_VISA_CTL_MCDFXS_MCMAIN_L1_DATA_BYTE_SEL_DEF (0x00000000)
+ #define MCDFXS_CR_VISA_CTL_MCDFXS_MCMAIN_L1_BYP_SEL_OFF (16)
+ #define MCDFXS_CR_VISA_CTL_MCDFXS_MCMAIN_L1_BYP_SEL_WID ( 1)
+ #define MCDFXS_CR_VISA_CTL_MCDFXS_MCMAIN_L1_BYP_SEL_MSK (0x00010000)
+ #define MCDFXS_CR_VISA_CTL_MCDFXS_MCMAIN_L1_BYP_SEL_MAX (0x00000001)
+ #define MCDFXS_CR_VISA_CTL_MCDFXS_MCMAIN_L1_BYP_SEL_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH_ERR_TRIGGER_CTL_MCMAIN_REG (0x0000496C)
+ #define MCDFXS_CR_REUT_CH_ERR_TRIGGER_CTL_MCMAIN_Trigger_In_Global_Start_OFF ( 0)
+ #define MCDFXS_CR_REUT_CH_ERR_TRIGGER_CTL_MCMAIN_Trigger_In_Global_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_ERR_TRIGGER_CTL_MCMAIN_Trigger_In_Global_Start_MSK (0x00000001)
+ #define MCDFXS_CR_REUT_CH_ERR_TRIGGER_CTL_MCMAIN_Trigger_In_Global_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_ERR_TRIGGER_CTL_MCMAIN_Trigger_In_Global_Start_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_ERR_TRIGGER_CTL_MCMAIN_Trigger_Out_Global_Start_OFF ( 1)
+ #define MCDFXS_CR_REUT_CH_ERR_TRIGGER_CTL_MCMAIN_Trigger_Out_Global_Start_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_ERR_TRIGGER_CTL_MCMAIN_Trigger_Out_Global_Start_MSK (0x00000002)
+ #define MCDFXS_CR_REUT_CH_ERR_TRIGGER_CTL_MCMAIN_Trigger_Out_Global_Start_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_ERR_TRIGGER_CTL_MCMAIN_Trigger_Out_Global_Start_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_ERR_TRIGGER_CTL_MCMAIN_Trigger_Out_On_Error_0_OFF ( 7)
+ #define MCDFXS_CR_REUT_CH_ERR_TRIGGER_CTL_MCMAIN_Trigger_Out_On_Error_0_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_ERR_TRIGGER_CTL_MCMAIN_Trigger_Out_On_Error_0_MSK (0x00000080)
+ #define MCDFXS_CR_REUT_CH_ERR_TRIGGER_CTL_MCMAIN_Trigger_Out_On_Error_0_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_ERR_TRIGGER_CTL_MCMAIN_Trigger_Out_On_Error_0_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_ERR_TRIGGER_CTL_MCMAIN_Trigger_Out_On_Error_1_OFF ( 8)
+ #define MCDFXS_CR_REUT_CH_ERR_TRIGGER_CTL_MCMAIN_Trigger_Out_On_Error_1_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_ERR_TRIGGER_CTL_MCMAIN_Trigger_Out_On_Error_1_MSK (0x00000100)
+ #define MCDFXS_CR_REUT_CH_ERR_TRIGGER_CTL_MCMAIN_Trigger_Out_On_Error_1_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_ERR_TRIGGER_CTL_MCMAIN_Trigger_Out_On_Error_1_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_ERR_TRIGGER_CTL_MCMAIN_Trigger_Out_On_Channel_Test_Done_Status_0_OFF (15)
+ #define MCDFXS_CR_REUT_CH_ERR_TRIGGER_CTL_MCMAIN_Trigger_Out_On_Channel_Test_Done_Status_0_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_ERR_TRIGGER_CTL_MCMAIN_Trigger_Out_On_Channel_Test_Done_Status_0_MSK (0x00008000)
+ #define MCDFXS_CR_REUT_CH_ERR_TRIGGER_CTL_MCMAIN_Trigger_Out_On_Channel_Test_Done_Status_0_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_ERR_TRIGGER_CTL_MCMAIN_Trigger_Out_On_Channel_Test_Done_Status_0_DEF (0x00000000)
+ #define MCDFXS_CR_REUT_CH_ERR_TRIGGER_CTL_MCMAIN_Trigger_Out_On_Channel_Test_Done_Status_1_OFF (16)
+ #define MCDFXS_CR_REUT_CH_ERR_TRIGGER_CTL_MCMAIN_Trigger_Out_On_Channel_Test_Done_Status_1_WID ( 1)
+ #define MCDFXS_CR_REUT_CH_ERR_TRIGGER_CTL_MCMAIN_Trigger_Out_On_Channel_Test_Done_Status_1_MSK (0x00010000)
+ #define MCDFXS_CR_REUT_CH_ERR_TRIGGER_CTL_MCMAIN_Trigger_Out_On_Channel_Test_Done_Status_1_MAX (0x00000001)
+ #define MCDFXS_CR_REUT_CH_ERR_TRIGGER_CTL_MCMAIN_Trigger_Out_On_Channel_Test_Done_Status_1_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH_SEQ_LOOPCOUNT_LIMIT_MCMAIN_0_REG (0x00004980)
+ #define MCDFXS_CR_REUT_CH_SEQ_LOOPCOUNT_LIMIT_MCMAIN_0_Loopcount_Limit_OFF (0)
+ #define MCDFXS_CR_REUT_CH_SEQ_LOOPCOUNT_LIMIT_MCMAIN_0_Loopcount_Limit_WID (32)
+ #define MCDFXS_CR_REUT_CH_SEQ_LOOPCOUNT_LIMIT_MCMAIN_0_Loopcount_Limit_MSK (0xFFFFFFFF)
+ #define MCDFXS_CR_REUT_CH_SEQ_LOOPCOUNT_LIMIT_MCMAIN_0_Loopcount_Limit_MAX (0xFFFFFFFF)
+ #define MCDFXS_CR_REUT_CH_SEQ_LOOPCOUNT_LIMIT_MCMAIN_0_Loopcount_Limit_DEF (0x00000000)
+
+#define MCDFXS_CR_REUT_CH_SEQ_LOOPCOUNT_LIMIT_MCMAIN_1_REG (0x00004984)
+ #define MCDFXS_CR_REUT_CH_SEQ_LOOPCOUNT_LIMIT_MCMAIN_1_Loopcount_Limit_OFF (0)
+ #define MCDFXS_CR_REUT_CH_SEQ_LOOPCOUNT_LIMIT_MCMAIN_1_Loopcount_Limit_WID (32)
+ #define MCDFXS_CR_REUT_CH_SEQ_LOOPCOUNT_LIMIT_MCMAIN_1_Loopcount_Limit_MSK (0xFFFFFFFF)
+ #define MCDFXS_CR_REUT_CH_SEQ_LOOPCOUNT_LIMIT_MCMAIN_1_Loopcount_Limit_MAX (0xFFFFFFFF)
+ #define MCDFXS_CR_REUT_CH_SEQ_LOOPCOUNT_LIMIT_MCMAIN_1_Loopcount_Limit_DEF (0x00000000)
+
+#define MCSCHEDS_CR_TC_BANK_REG (0x00004C00)
+ #define MCSCHEDS_CR_TC_BANK_tRCD_OFF ( 0)
+ #define MCSCHEDS_CR_TC_BANK_tRCD_WID ( 5)
+ #define MCSCHEDS_CR_TC_BANK_tRCD_MSK (0x0000001F)
+ #define MCSCHEDS_CR_TC_BANK_tRCD_MAX (0x0000001F)
+ #define MCSCHEDS_CR_TC_BANK_tRCD_DEF (0x00000006)
+ #define MCSCHEDS_CR_TC_BANK_tRP_OFF ( 5)
+ #define MCSCHEDS_CR_TC_BANK_tRP_WID ( 5)
+ #define MCSCHEDS_CR_TC_BANK_tRP_MSK (0x000003E0)
+ #define MCSCHEDS_CR_TC_BANK_tRP_MAX (0x0000001F)
+ #define MCSCHEDS_CR_TC_BANK_tRP_DEF (0x00000006)
+ #define MCSCHEDS_CR_TC_BANK_tRAS_OFF (10)
+ #define MCSCHEDS_CR_TC_BANK_tRAS_WID ( 6)
+ #define MCSCHEDS_CR_TC_BANK_tRAS_MSK (0x0000FC00)
+ #define MCSCHEDS_CR_TC_BANK_tRAS_MAX (0x0000003F)
+ #define MCSCHEDS_CR_TC_BANK_tRAS_DEF (0x00000014)
+ #define MCSCHEDS_CR_TC_BANK_tRDPRE_OFF (16)
+ #define MCSCHEDS_CR_TC_BANK_tRDPRE_WID ( 4)
+ #define MCSCHEDS_CR_TC_BANK_tRDPRE_MSK (0x000F0000)
+ #define MCSCHEDS_CR_TC_BANK_tRDPRE_MAX (0x0000000F)
+ #define MCSCHEDS_CR_TC_BANK_tRDPRE_DEF (0x00000004)
+ #define MCSCHEDS_CR_TC_BANK_tWRPRE_OFF (20)
+ #define MCSCHEDS_CR_TC_BANK_tWRPRE_WID ( 6)
+ #define MCSCHEDS_CR_TC_BANK_tWRPRE_MSK (0x03F00000)
+ #define MCSCHEDS_CR_TC_BANK_tWRPRE_MAX (0x0000003F)
+ #define MCSCHEDS_CR_TC_BANK_tWRPRE_DEF (0x00000004)
+ #define MCSCHEDS_CR_TC_BANK_tRRD_OFF (26)
+ #define MCSCHEDS_CR_TC_BANK_tRRD_WID ( 4)
+ #define MCSCHEDS_CR_TC_BANK_tRRD_MSK (0x3C000000)
+ #define MCSCHEDS_CR_TC_BANK_tRRD_MAX (0x0000000F)
+ #define MCSCHEDS_CR_TC_BANK_tRRD_DEF (0x00000004)
+ #define MCSCHEDS_CR_TC_BANK_tRPab_ext_OFF (30)
+ #define MCSCHEDS_CR_TC_BANK_tRPab_ext_WID ( 2)
+ #define MCSCHEDS_CR_TC_BANK_tRPab_ext_MSK (0xC0000000)
+ #define MCSCHEDS_CR_TC_BANK_tRPab_ext_MAX (0x00000003)
+ #define MCSCHEDS_CR_TC_BANK_tRPab_ext_DEF (0x00000000)
+
+#define MCSCHEDS_CR_TC_BANK_RANK_A_REG (0x00004C04)
+ #define MCSCHEDS_CR_TC_BANK_RANK_A_tCKE_OFF ( 0)
+ #define MCSCHEDS_CR_TC_BANK_RANK_A_tCKE_WID ( 4)
+ #define MCSCHEDS_CR_TC_BANK_RANK_A_tCKE_MSK (0x0000000F)
+ #define MCSCHEDS_CR_TC_BANK_RANK_A_tCKE_MAX (0x0000000F)
+ #define MCSCHEDS_CR_TC_BANK_RANK_A_tCKE_DEF (0x00000003)
+ #define MCSCHEDS_CR_TC_BANK_RANK_A_tFAW_OFF ( 4)
+ #define MCSCHEDS_CR_TC_BANK_RANK_A_tFAW_WID ( 8)
+ #define MCSCHEDS_CR_TC_BANK_RANK_A_tFAW_MSK (0x00000FF0)
+ #define MCSCHEDS_CR_TC_BANK_RANK_A_tFAW_MAX (0x000000FF)
+ #define MCSCHEDS_CR_TC_BANK_RANK_A_tFAW_DEF (0x00000010)
+ #define MCSCHEDS_CR_TC_BANK_RANK_A_tRDRD_OFF (12)
+ #define MCSCHEDS_CR_TC_BANK_RANK_A_tRDRD_WID ( 3)
+ #define MCSCHEDS_CR_TC_BANK_RANK_A_tRDRD_MSK (0x00007000)
+ #define MCSCHEDS_CR_TC_BANK_RANK_A_tRDRD_MAX (0x00000007)
+ #define MCSCHEDS_CR_TC_BANK_RANK_A_tRDRD_DEF (0x00000004)
+ #define MCSCHEDS_CR_TC_BANK_RANK_A_tRDRD_dr_OFF (15)
+ #define MCSCHEDS_CR_TC_BANK_RANK_A_tRDRD_dr_WID ( 4)
+ #define MCSCHEDS_CR_TC_BANK_RANK_A_tRDRD_dr_MSK (0x00078000)
+ #define MCSCHEDS_CR_TC_BANK_RANK_A_tRDRD_dr_MAX (0x0000000F)
+ #define MCSCHEDS_CR_TC_BANK_RANK_A_tRDRD_dr_DEF (0x00000004)
+ #define MCSCHEDS_CR_TC_BANK_RANK_A_tRDRD_dd_OFF (19)
+ #define MCSCHEDS_CR_TC_BANK_RANK_A_tRDRD_dd_WID ( 4)
+ #define MCSCHEDS_CR_TC_BANK_RANK_A_tRDRD_dd_MSK (0x00780000)
+ #define MCSCHEDS_CR_TC_BANK_RANK_A_tRDRD_dd_MAX (0x0000000F)
+ #define MCSCHEDS_CR_TC_BANK_RANK_A_tRDRD_dd_DEF (0x00000004)
+ #define MCSCHEDS_CR_TC_BANK_RANK_A_tRDPDEN_OFF (23)
+ #define MCSCHEDS_CR_TC_BANK_RANK_A_tRDPDEN_WID ( 5)
+ #define MCSCHEDS_CR_TC_BANK_RANK_A_tRDPDEN_MSK (0x0F800000)
+ #define MCSCHEDS_CR_TC_BANK_RANK_A_tRDPDEN_MAX (0x0000001F)
+ #define MCSCHEDS_CR_TC_BANK_RANK_A_tRDPDEN_DEF (0x00000004)
+ #define MCSCHEDS_CR_TC_BANK_RANK_A_CMD_3st_OFF (29)
+ #define MCSCHEDS_CR_TC_BANK_RANK_A_CMD_3st_WID ( 1)
+ #define MCSCHEDS_CR_TC_BANK_RANK_A_CMD_3st_MSK (0x20000000)
+ #define MCSCHEDS_CR_TC_BANK_RANK_A_CMD_3st_MAX (0x00000001)
+ #define MCSCHEDS_CR_TC_BANK_RANK_A_CMD_3st_DEF (0x00000000)
+ #define MCSCHEDS_CR_TC_BANK_RANK_A_CMD_stretch_OFF (30)
+ #define MCSCHEDS_CR_TC_BANK_RANK_A_CMD_stretch_WID ( 2)
+ #define MCSCHEDS_CR_TC_BANK_RANK_A_CMD_stretch_MSK (0xC0000000)
+ #define MCSCHEDS_CR_TC_BANK_RANK_A_CMD_stretch_MAX (0x00000003)
+ #define MCSCHEDS_CR_TC_BANK_RANK_A_CMD_stretch_DEF (0x00000002)
+
+#define MCSCHEDS_CR_TC_BANK_RANK_B_REG (0x00004C08)
+ #define MCSCHEDS_CR_TC_BANK_RANK_B_tWRRD_OFF ( 0)
+ #define MCSCHEDS_CR_TC_BANK_RANK_B_tWRRD_WID ( 6)
+ #define MCSCHEDS_CR_TC_BANK_RANK_B_tWRRD_MSK (0x0000003F)
+ #define MCSCHEDS_CR_TC_BANK_RANK_B_tWRRD_MAX (0x0000003F)
+ #define MCSCHEDS_CR_TC_BANK_RANK_B_tWRRD_DEF (0x00000005)
+ #define MCSCHEDS_CR_TC_BANK_RANK_B_tWRRD_dr_OFF ( 6)
+ #define MCSCHEDS_CR_TC_BANK_RANK_B_tWRRD_dr_WID ( 4)
+ #define MCSCHEDS_CR_TC_BANK_RANK_B_tWRRD_dr_MSK (0x000003C0)
+ #define MCSCHEDS_CR_TC_BANK_RANK_B_tWRRD_dr_MAX (0x0000000F)
+ #define MCSCHEDS_CR_TC_BANK_RANK_B_tWRRD_dr_DEF (0x00000005)
+ #define MCSCHEDS_CR_TC_BANK_RANK_B_tWRRD_dd_OFF (10)
+ #define MCSCHEDS_CR_TC_BANK_RANK_B_tWRRD_dd_WID ( 4)
+ #define MCSCHEDS_CR_TC_BANK_RANK_B_tWRRD_dd_MSK (0x00003C00)
+ #define MCSCHEDS_CR_TC_BANK_RANK_B_tWRRD_dd_MAX (0x0000000F)
+ #define MCSCHEDS_CR_TC_BANK_RANK_B_tWRRD_dd_DEF (0x00000005)
+ #define MCSCHEDS_CR_TC_BANK_RANK_B_tWRWR_OFF (14)
+ #define MCSCHEDS_CR_TC_BANK_RANK_B_tWRWR_WID ( 3)
+ #define MCSCHEDS_CR_TC_BANK_RANK_B_tWRWR_MSK (0x0001C000)
+ #define MCSCHEDS_CR_TC_BANK_RANK_B_tWRWR_MAX (0x00000007)
+ #define MCSCHEDS_CR_TC_BANK_RANK_B_tWRWR_DEF (0x00000005)
+ #define MCSCHEDS_CR_TC_BANK_RANK_B_tWRWR_dr_OFF (17)
+ #define MCSCHEDS_CR_TC_BANK_RANK_B_tWRWR_dr_WID ( 4)
+ #define MCSCHEDS_CR_TC_BANK_RANK_B_tWRWR_dr_MSK (0x001E0000)
+ #define MCSCHEDS_CR_TC_BANK_RANK_B_tWRWR_dr_MAX (0x0000000F)
+ #define MCSCHEDS_CR_TC_BANK_RANK_B_tWRWR_dr_DEF (0x00000005)
+ #define MCSCHEDS_CR_TC_BANK_RANK_B_tWRWR_dd_OFF (21)
+ #define MCSCHEDS_CR_TC_BANK_RANK_B_tWRWR_dd_WID ( 4)
+ #define MCSCHEDS_CR_TC_BANK_RANK_B_tWRWR_dd_MSK (0x01E00000)
+ #define MCSCHEDS_CR_TC_BANK_RANK_B_tWRWR_dd_MAX (0x0000000F)
+ #define MCSCHEDS_CR_TC_BANK_RANK_B_tWRWR_dd_DEF (0x00000005)
+ #define MCSCHEDS_CR_TC_BANK_RANK_B_tWRPDEN_OFF (25)
+ #define MCSCHEDS_CR_TC_BANK_RANK_B_tWRPDEN_WID ( 6)
+ #define MCSCHEDS_CR_TC_BANK_RANK_B_tWRPDEN_MSK (0x7E000000)
+ #define MCSCHEDS_CR_TC_BANK_RANK_B_tWRPDEN_MAX (0x0000003F)
+ #define MCSCHEDS_CR_TC_BANK_RANK_B_tWRPDEN_DEF (0x00000005)
+ #define MCSCHEDS_CR_TC_BANK_RANK_B_Dec_WRD_OFF (31)
+ #define MCSCHEDS_CR_TC_BANK_RANK_B_Dec_WRD_WID ( 1)
+ #define MCSCHEDS_CR_TC_BANK_RANK_B_Dec_WRD_MSK (0x80000000)
+ #define MCSCHEDS_CR_TC_BANK_RANK_B_Dec_WRD_MAX (0x00000001)
+ #define MCSCHEDS_CR_TC_BANK_RANK_B_Dec_WRD_DEF (0x00000000)
+
+#define MCSCHEDS_CR_TC_BANK_RANK_C_REG (0x00004C0C)
+ #define MCSCHEDS_CR_TC_BANK_RANK_C_tXPDLL_OFF ( 0)
+ #define MCSCHEDS_CR_TC_BANK_RANK_C_tXPDLL_WID ( 6)
+ #define MCSCHEDS_CR_TC_BANK_RANK_C_tXPDLL_MSK (0x0000003F)
+ #define MCSCHEDS_CR_TC_BANK_RANK_C_tXPDLL_MAX (0x0000003F)
+ #define MCSCHEDS_CR_TC_BANK_RANK_C_tXPDLL_DEF (0x0000000A)
+ #define MCSCHEDS_CR_TC_BANK_RANK_C_tXP_OFF ( 6)
+ #define MCSCHEDS_CR_TC_BANK_RANK_C_tXP_WID ( 4)
+ #define MCSCHEDS_CR_TC_BANK_RANK_C_tXP_MSK (0x000003C0)
+ #define MCSCHEDS_CR_TC_BANK_RANK_C_tXP_MAX (0x0000000F)
+ #define MCSCHEDS_CR_TC_BANK_RANK_C_tXP_DEF (0x00000003)
+ #define MCSCHEDS_CR_TC_BANK_RANK_C_TAONPD_OFF (10)
+ #define MCSCHEDS_CR_TC_BANK_RANK_C_TAONPD_WID ( 4)
+ #define MCSCHEDS_CR_TC_BANK_RANK_C_TAONPD_MSK (0x00003C00)
+ #define MCSCHEDS_CR_TC_BANK_RANK_C_TAONPD_MAX (0x0000000F)
+ #define MCSCHEDS_CR_TC_BANK_RANK_C_TAONPD_DEF (0x00000009)
+ #define MCSCHEDS_CR_TC_BANK_RANK_C_tRDWR_OFF (14)
+ #define MCSCHEDS_CR_TC_BANK_RANK_C_tRDWR_WID ( 5)
+ #define MCSCHEDS_CR_TC_BANK_RANK_C_tRDWR_MSK (0x0007C000)
+ #define MCSCHEDS_CR_TC_BANK_RANK_C_tRDWR_MAX (0x0000001F)
+ #define MCSCHEDS_CR_TC_BANK_RANK_C_tRDWR_DEF (0x00000005)
+ #define MCSCHEDS_CR_TC_BANK_RANK_C_tRDWR_dr_OFF (19)
+ #define MCSCHEDS_CR_TC_BANK_RANK_C_tRDWR_dr_WID ( 5)
+ #define MCSCHEDS_CR_TC_BANK_RANK_C_tRDWR_dr_MSK (0x00F80000)
+ #define MCSCHEDS_CR_TC_BANK_RANK_C_tRDWR_dr_MAX (0x0000001F)
+ #define MCSCHEDS_CR_TC_BANK_RANK_C_tRDWR_dr_DEF (0x00000005)
+ #define MCSCHEDS_CR_TC_BANK_RANK_C_tRDWR_dd_OFF (24)
+ #define MCSCHEDS_CR_TC_BANK_RANK_C_tRDWR_dd_WID ( 5)
+ #define MCSCHEDS_CR_TC_BANK_RANK_C_tRDWR_dd_MSK (0x1F000000)
+ #define MCSCHEDS_CR_TC_BANK_RANK_C_tRDWR_dd_MAX (0x0000001F)
+ #define MCSCHEDS_CR_TC_BANK_RANK_C_tRDWR_dd_DEF (0x00000005)
+
+#define MCSCHEDS_CR_CMD_RATE_REG (0x00004C10)
+ #define MCSCHEDS_CR_CMD_RATE_enable_cmd_rate_limit_OFF ( 0)
+ #define MCSCHEDS_CR_CMD_RATE_enable_cmd_rate_limit_WID ( 1)
+ #define MCSCHEDS_CR_CMD_RATE_enable_cmd_rate_limit_MSK (0x00000001)
+ #define MCSCHEDS_CR_CMD_RATE_enable_cmd_rate_limit_MAX (0x00000001)
+ #define MCSCHEDS_CR_CMD_RATE_enable_cmd_rate_limit_DEF (0x00000000)
+ #define MCSCHEDS_CR_CMD_RATE_cmd_rate_limit_OFF ( 1)
+ #define MCSCHEDS_CR_CMD_RATE_cmd_rate_limit_WID ( 3)
+ #define MCSCHEDS_CR_CMD_RATE_cmd_rate_limit_MSK (0x0000000E)
+ #define MCSCHEDS_CR_CMD_RATE_cmd_rate_limit_MAX (0x00000007)
+ #define MCSCHEDS_CR_CMD_RATE_cmd_rate_limit_DEF (0x00000004)
+ #define MCSCHEDS_CR_CMD_RATE_reset_on_command_OFF ( 4)
+ #define MCSCHEDS_CR_CMD_RATE_reset_on_command_WID ( 4)
+ #define MCSCHEDS_CR_CMD_RATE_reset_on_command_MSK (0x000000F0)
+ #define MCSCHEDS_CR_CMD_RATE_reset_on_command_MAX (0x0000000F)
+ #define MCSCHEDS_CR_CMD_RATE_reset_on_command_DEF (0x00000000)
+ #define MCSCHEDS_CR_CMD_RATE_reset_delay_OFF ( 8)
+ #define MCSCHEDS_CR_CMD_RATE_reset_delay_WID ( 4)
+ #define MCSCHEDS_CR_CMD_RATE_reset_delay_MSK (0x00000F00)
+ #define MCSCHEDS_CR_CMD_RATE_reset_delay_MAX (0x0000000F)
+ #define MCSCHEDS_CR_CMD_RATE_reset_delay_DEF (0x00000000)
+ #define MCSCHEDS_CR_CMD_RATE_ck_to_cke_delay_OFF (12)
+ #define MCSCHEDS_CR_CMD_RATE_ck_to_cke_delay_WID ( 2)
+ #define MCSCHEDS_CR_CMD_RATE_ck_to_cke_delay_MSK (0x00003000)
+ #define MCSCHEDS_CR_CMD_RATE_ck_to_cke_delay_MAX (0x00000003)
+ #define MCSCHEDS_CR_CMD_RATE_ck_to_cke_delay_DEF (0x00000001)
+ #define MCSCHEDS_CR_CMD_RATE_spare_OFF (14)
+ #define MCSCHEDS_CR_CMD_RATE_spare_WID (17)
+ #define MCSCHEDS_CR_CMD_RATE_spare_MSK (0x7FFFC000)
+ #define MCSCHEDS_CR_CMD_RATE_spare_MAX (0x0001FFFF)
+ #define MCSCHEDS_CR_CMD_RATE_spare_DEF (0x00000000)
+ #define MCSCHEDS_CR_CMD_RATE_init_mrw_2n_cs_OFF (31)
+ #define MCSCHEDS_CR_CMD_RATE_init_mrw_2n_cs_WID ( 1)
+ #define MCSCHEDS_CR_CMD_RATE_init_mrw_2n_cs_MSK (0x80000000)
+ #define MCSCHEDS_CR_CMD_RATE_init_mrw_2n_cs_MAX (0x00000001)
+ #define MCSCHEDS_CR_CMD_RATE_init_mrw_2n_cs_DEF (0x00000000)
+
+#define MCSCHEDS_CR_TC_BANK_RANK_D_REG (0x00004C14)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_tCL_OFF ( 0)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_tCL_WID ( 5)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_tCL_MSK (0x0000001F)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_tCL_MAX (0x0000001F)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_tCL_DEF (0x00000006)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_tWCL_OFF ( 5)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_tWCL_WID ( 5)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_tWCL_MSK (0x000003E0)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_tWCL_MAX (0x0000001F)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_tWCL_DEF (0x00000006)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_tCPDED_OFF (10)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_tCPDED_WID ( 2)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_tCPDED_MSK (0x00000C00)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_tCPDED_MAX (0x00000003)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_tCPDED_DEF (0x00000001)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_tPRPDEN_OFF (12)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_tPRPDEN_WID ( 2)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_tPRPDEN_MSK (0x00003000)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_tPRPDEN_MAX (0x00000003)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_tPRPDEN_DEF (0x00000001)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_Odt_Read_Delay_OFF (14)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_Odt_Read_Delay_WID ( 3)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_Odt_Read_Delay_MSK (0x0001C000)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_Odt_Read_Delay_MAX (0x00000007)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_Odt_Read_Delay_DEF (0x00000000)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_Odt_Read_Duration_OFF (17)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_Odt_Read_Duration_WID ( 2)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_Odt_Read_Duration_MSK (0x00060000)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_Odt_Read_Duration_MAX (0x00000003)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_Odt_Read_Duration_DEF (0x00000000)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_Odt_Write_Duration_OFF (19)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_Odt_Write_Duration_WID ( 2)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_Odt_Write_Duration_MSK (0x00180000)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_Odt_Write_Duration_MAX (0x00000003)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_Odt_Write_Duration_DEF (0x00000000)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_Odt_Write_Duration_Ult_OFF (19)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_Odt_Write_Duration_Ult_WID ( 3)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_Odt_Write_Duration_Ult_MSK (0x00380000)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_Odt_Write_Duration_Ult_MAX (0x00000007)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_Odt_Write_Duration_Ult_DEF (0x00000000)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_Odt_Write_Delay_Ult_OFF (22)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_Odt_Write_Delay_Ult_WID ( 3)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_Odt_Write_Delay_Ult_MSK (0x01C00000)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_Odt_Write_Delay_Ult_MAX (0x00000007)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_Odt_Write_Delay_Ult_DEF (0x00000000)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_Odt_Always_Rank0_Ult_OFF (25)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_Odt_Always_Rank0_Ult_WID ( 1)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_Odt_Always_Rank0_Ult_MSK (0x02000000)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_Odt_Always_Rank0_Ult_MAX (0x00000001)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_Odt_Always_Rank0_Ult_DEF (0x00000000)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_cmd_delay_Ult_OFF (26)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_cmd_delay_Ult_WID ( 2)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_cmd_delay_Ult_MSK (0x0C000000)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_cmd_delay_Ult_MAX (0x00000003)
+ #define MCSCHEDS_CR_TC_BANK_RANK_D_cmd_delay_Ult_DEF (0x00000000)
+
+#define MCSCHEDS_CR_SCHED_CBIT_REG (0x00004C20)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_opp_cas_OFF ( 0)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_opp_cas_WID ( 1)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_opp_cas_MSK (0x00000001)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_opp_cas_MAX (0x00000001)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_opp_cas_DEF (0x00000001)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_opp_is_cas_OFF ( 1)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_opp_is_cas_WID ( 1)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_opp_is_cas_MSK (0x00000002)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_opp_is_cas_MAX (0x00000001)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_opp_is_cas_DEF (0x00000000)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_opp_ras_OFF ( 2)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_opp_ras_WID ( 1)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_opp_ras_MSK (0x00000004)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_opp_ras_MAX (0x00000001)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_opp_ras_DEF (0x00000001)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_opp_is_ras_OFF ( 3)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_opp_is_ras_WID ( 1)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_opp_is_ras_MSK (0x00000008)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_opp_is_ras_MAX (0x00000001)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_opp_is_ras_DEF (0x00000000)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_1c_byp_OFF ( 4)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_1c_byp_WID ( 1)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_1c_byp_MSK (0x00000010)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_1c_byp_MAX (0x00000001)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_1c_byp_DEF (0x00000001)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_2c_byp_OFF ( 5)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_2c_byp_WID ( 1)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_2c_byp_MSK (0x00000020)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_2c_byp_MAX (0x00000001)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_2c_byp_DEF (0x00000000)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_deprd_opt_OFF ( 6)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_deprd_opt_WID ( 1)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_deprd_opt_MSK (0x00000040)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_deprd_opt_MAX (0x00000001)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_deprd_opt_DEF (0x00000000)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_pt_it_OFF ( 7)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_pt_it_WID ( 1)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_pt_it_MSK (0x00000080)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_pt_it_MAX (0x00000001)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_pt_it_DEF (0x00000000)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_prcnt_ring_OFF ( 8)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_prcnt_ring_WID ( 1)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_prcnt_ring_MSK (0x00000100)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_prcnt_ring_MAX (0x00000001)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_prcnt_ring_DEF (0x00000000)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_prcnt_sa_OFF ( 9)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_prcnt_sa_WID ( 1)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_prcnt_sa_MSK (0x00000200)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_prcnt_sa_MAX (0x00000001)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_prcnt_sa_DEF (0x00000000)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_blkr_ph_OFF (10)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_blkr_ph_WID ( 1)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_blkr_ph_MSK (0x00000400)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_blkr_ph_MAX (0x00000001)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_blkr_ph_DEF (0x00000000)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_blkr_pe_OFF (11)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_blkr_pe_WID ( 1)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_blkr_pe_MSK (0x00000800)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_blkr_pe_MAX (0x00000001)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_blkr_pe_DEF (0x00000000)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_blkr_pm_OFF (12)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_blkr_pm_WID ( 1)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_blkr_pm_MSK (0x00001000)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_blkr_pm_MAX (0x00000001)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_blkr_pm_DEF (0x00000000)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_odt_OFF (13)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_odt_WID ( 1)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_odt_MSK (0x00002000)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_odt_MAX (0x00000001)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_odt_DEF (0x00000000)
+ #define MCSCHEDS_CR_SCHED_CBIT_OE_alw_off_OFF (14)
+ #define MCSCHEDS_CR_SCHED_CBIT_OE_alw_off_WID ( 1)
+ #define MCSCHEDS_CR_SCHED_CBIT_OE_alw_off_MSK (0x00004000)
+ #define MCSCHEDS_CR_SCHED_CBIT_OE_alw_off_MAX (0x00000001)
+ #define MCSCHEDS_CR_SCHED_CBIT_OE_alw_off_DEF (0x00000000)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_aom_OFF (16)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_aom_WID ( 1)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_aom_MSK (0x00010000)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_aom_MAX (0x00000001)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_aom_DEF (0x00000000)
+ #define MCSCHEDS_CR_SCHED_CBIT_block_rpq_OFF (17)
+ #define MCSCHEDS_CR_SCHED_CBIT_block_rpq_WID ( 1)
+ #define MCSCHEDS_CR_SCHED_CBIT_block_rpq_MSK (0x00020000)
+ #define MCSCHEDS_CR_SCHED_CBIT_block_rpq_MAX (0x00000001)
+ #define MCSCHEDS_CR_SCHED_CBIT_block_rpq_DEF (0x00000000)
+ #define MCSCHEDS_CR_SCHED_CBIT_block_wpq_OFF (18)
+ #define MCSCHEDS_CR_SCHED_CBIT_block_wpq_WID ( 1)
+ #define MCSCHEDS_CR_SCHED_CBIT_block_wpq_MSK (0x00040000)
+ #define MCSCHEDS_CR_SCHED_CBIT_block_wpq_MAX (0x00000001)
+ #define MCSCHEDS_CR_SCHED_CBIT_block_wpq_DEF (0x00000000)
+ #define MCSCHEDS_CR_SCHED_CBIT_invert_align_OFF (19)
+ #define MCSCHEDS_CR_SCHED_CBIT_invert_align_WID ( 1)
+ #define MCSCHEDS_CR_SCHED_CBIT_invert_align_MSK (0x00080000)
+ #define MCSCHEDS_CR_SCHED_CBIT_invert_align_MAX (0x00000001)
+ #define MCSCHEDS_CR_SCHED_CBIT_invert_align_DEF (0x00000000)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_write_gap_OFF (20)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_write_gap_WID ( 1)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_write_gap_MSK (0x00100000)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_write_gap_MAX (0x00000001)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_write_gap_DEF (0x00000001)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_zq_OFF (21)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_zq_WID ( 1)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_zq_MSK (0x00200000)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_zq_MAX (0x00000001)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_zq_DEF (0x00000000)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_tt_OFF (22)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_tt_WID ( 1)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_tt_MSK (0x00400000)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_tt_MAX (0x00000001)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_tt_DEF (0x00000000)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_opp_ref_OFF (23)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_opp_ref_WID ( 1)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_opp_ref_MSK (0x00800000)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_opp_ref_MAX (0x00000001)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_opp_ref_DEF (0x00000000)
+ #define MCSCHEDS_CR_SCHED_CBIT_Long_ZQ_OFF (24)
+ #define MCSCHEDS_CR_SCHED_CBIT_Long_ZQ_WID ( 1)
+ #define MCSCHEDS_CR_SCHED_CBIT_Long_ZQ_MSK (0x01000000)
+ #define MCSCHEDS_CR_SCHED_CBIT_Long_ZQ_MAX (0x00000001)
+ #define MCSCHEDS_CR_SCHED_CBIT_Long_ZQ_DEF (0x00000000)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_srx_zq_OFF (25)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_srx_zq_WID ( 1)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_srx_zq_MSK (0x02000000)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_srx_zq_MAX (0x00000001)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_srx_zq_DEF (0x00000000)
+ #define MCSCHEDS_CR_SCHED_CBIT_Serialize_ZQ_OFF (26)
+ #define MCSCHEDS_CR_SCHED_CBIT_Serialize_ZQ_WID ( 1)
+ #define MCSCHEDS_CR_SCHED_CBIT_Serialize_ZQ_MSK (0x04000000)
+ #define MCSCHEDS_CR_SCHED_CBIT_Serialize_ZQ_MAX (0x00000001)
+ #define MCSCHEDS_CR_SCHED_CBIT_Serialize_ZQ_DEF (0x00000000)
+ #define MCSCHEDS_CR_SCHED_CBIT_ZQ_fast_exec_OFF (27)
+ #define MCSCHEDS_CR_SCHED_CBIT_ZQ_fast_exec_WID ( 1)
+ #define MCSCHEDS_CR_SCHED_CBIT_ZQ_fast_exec_MSK (0x08000000)
+ #define MCSCHEDS_CR_SCHED_CBIT_ZQ_fast_exec_MAX (0x00000001)
+ #define MCSCHEDS_CR_SCHED_CBIT_ZQ_fast_exec_DEF (0x00000000)
+ #define MCSCHEDS_CR_SCHED_CBIT_Dis_DriveNop_OFF (28)
+ #define MCSCHEDS_CR_SCHED_CBIT_Dis_DriveNop_WID ( 1)
+ #define MCSCHEDS_CR_SCHED_CBIT_Dis_DriveNop_MSK (0x10000000)
+ #define MCSCHEDS_CR_SCHED_CBIT_Dis_DriveNop_MAX (0x00000001)
+ #define MCSCHEDS_CR_SCHED_CBIT_Dis_DriveNop_DEF (0x00000000)
+ #define MCSCHEDS_CR_SCHED_CBIT_Pres_WDB_Ent_OFF (29)
+ #define MCSCHEDS_CR_SCHED_CBIT_Pres_WDB_Ent_WID ( 1)
+ #define MCSCHEDS_CR_SCHED_CBIT_Pres_WDB_Ent_MSK (0x20000000)
+ #define MCSCHEDS_CR_SCHED_CBIT_Pres_WDB_Ent_MAX (0x00000001)
+ #define MCSCHEDS_CR_SCHED_CBIT_Pres_WDB_Ent_DEF (0x00000000)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_clk_gate_OFF (30)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_clk_gate_WID ( 1)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_clk_gate_MSK (0x40000000)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_clk_gate_MAX (0x00000001)
+ #define MCSCHEDS_CR_SCHED_CBIT_dis_clk_gate_DEF (0x00000000)
+
+#define MCSCHEDS_CR_SC_ROUNDT_LAT_REG (0x00004C24)
+ #define MCSCHEDS_CR_SC_ROUNDT_LAT_Lat_R0D0_OFF ( 0)
+ #define MCSCHEDS_CR_SC_ROUNDT_LAT_Lat_R0D0_WID ( 6)
+ #define MCSCHEDS_CR_SC_ROUNDT_LAT_Lat_R0D0_MSK (0x0000003F)
+ #define MCSCHEDS_CR_SC_ROUNDT_LAT_Lat_R0D0_MAX (0x0000003F)
+ #define MCSCHEDS_CR_SC_ROUNDT_LAT_Lat_R0D0_DEF (0x00000020)
+ #define MCSCHEDS_CR_SC_ROUNDT_LAT_Lat_R1D0_OFF ( 8)
+ #define MCSCHEDS_CR_SC_ROUNDT_LAT_Lat_R1D0_WID ( 6)
+ #define MCSCHEDS_CR_SC_ROUNDT_LAT_Lat_R1D0_MSK (0x00003F00)
+ #define MCSCHEDS_CR_SC_ROUNDT_LAT_Lat_R1D0_MAX (0x0000003F)
+ #define MCSCHEDS_CR_SC_ROUNDT_LAT_Lat_R1D0_DEF (0x00000020)
+ #define MCSCHEDS_CR_SC_ROUNDT_LAT_Lat_R0D1_OFF (16)
+ #define MCSCHEDS_CR_SC_ROUNDT_LAT_Lat_R0D1_WID ( 6)
+ #define MCSCHEDS_CR_SC_ROUNDT_LAT_Lat_R0D1_MSK (0x003F0000)
+ #define MCSCHEDS_CR_SC_ROUNDT_LAT_Lat_R0D1_MAX (0x0000003F)
+ #define MCSCHEDS_CR_SC_ROUNDT_LAT_Lat_R0D1_DEF (0x00000020)
+ #define MCSCHEDS_CR_SC_ROUNDT_LAT_Lat_R1D1_OFF (24)
+ #define MCSCHEDS_CR_SC_ROUNDT_LAT_Lat_R1D1_WID ( 6)
+ #define MCSCHEDS_CR_SC_ROUNDT_LAT_Lat_R1D1_MSK (0x3F000000)
+ #define MCSCHEDS_CR_SC_ROUNDT_LAT_Lat_R1D1_MAX (0x0000003F)
+ #define MCSCHEDS_CR_SC_ROUNDT_LAT_Lat_R1D1_DEF (0x00000020)
+
+#define MCSCHEDS_CR_SC_IO_LATENCY_REG (0x00004C28)
+ #define MCSCHEDS_CR_SC_IO_LATENCY_IOLAT_R0D0_OFF ( 0)
+ #define MCSCHEDS_CR_SC_IO_LATENCY_IOLAT_R0D0_WID ( 4)
+ #define MCSCHEDS_CR_SC_IO_LATENCY_IOLAT_R0D0_MSK (0x0000000F)
+ #define MCSCHEDS_CR_SC_IO_LATENCY_IOLAT_R0D0_MAX (0x0000000F)
+ #define MCSCHEDS_CR_SC_IO_LATENCY_IOLAT_R0D0_DEF (0x00000000)
+ #define MCSCHEDS_CR_SC_IO_LATENCY_IOLAT_R1D0_OFF ( 4)
+ #define MCSCHEDS_CR_SC_IO_LATENCY_IOLAT_R1D0_WID ( 4)
+ #define MCSCHEDS_CR_SC_IO_LATENCY_IOLAT_R1D0_MSK (0x000000F0)
+ #define MCSCHEDS_CR_SC_IO_LATENCY_IOLAT_R1D0_MAX (0x0000000F)
+ #define MCSCHEDS_CR_SC_IO_LATENCY_IOLAT_R1D0_DEF (0x00000000)
+ #define MCSCHEDS_CR_SC_IO_LATENCY_IOLAT_R0D1_OFF ( 8)
+ #define MCSCHEDS_CR_SC_IO_LATENCY_IOLAT_R0D1_WID ( 4)
+ #define MCSCHEDS_CR_SC_IO_LATENCY_IOLAT_R0D1_MSK (0x00000F00)
+ #define MCSCHEDS_CR_SC_IO_LATENCY_IOLAT_R0D1_MAX (0x0000000F)
+ #define MCSCHEDS_CR_SC_IO_LATENCY_IOLAT_R0D1_DEF (0x00000000)
+ #define MCSCHEDS_CR_SC_IO_LATENCY_IOLAT_R1D1_OFF (12)
+ #define MCSCHEDS_CR_SC_IO_LATENCY_IOLAT_R1D1_WID ( 4)
+ #define MCSCHEDS_CR_SC_IO_LATENCY_IOLAT_R1D1_MSK (0x0000F000)
+ #define MCSCHEDS_CR_SC_IO_LATENCY_IOLAT_R1D1_MAX (0x0000000F)
+ #define MCSCHEDS_CR_SC_IO_LATENCY_IOLAT_R1D1_DEF (0x00000000)
+ #define MCSCHEDS_CR_SC_IO_LATENCY_RT_IOCOMP_OFF (16)
+ #define MCSCHEDS_CR_SC_IO_LATENCY_RT_IOCOMP_WID ( 6)
+ #define MCSCHEDS_CR_SC_IO_LATENCY_RT_IOCOMP_MSK (0x003F0000)
+ #define MCSCHEDS_CR_SC_IO_LATENCY_RT_IOCOMP_MAX (0x0000003F)
+ #define MCSCHEDS_CR_SC_IO_LATENCY_RT_IOCOMP_DEF (0x0000000E)
+ #define MCSCHEDS_CR_SC_IO_LATENCY_three_channels_OFF (30)
+ #define MCSCHEDS_CR_SC_IO_LATENCY_three_channels_WID ( 1)
+ #define MCSCHEDS_CR_SC_IO_LATENCY_three_channels_MSK (0x40000000)
+ #define MCSCHEDS_CR_SC_IO_LATENCY_three_channels_MAX (0x00000001)
+ #define MCSCHEDS_CR_SC_IO_LATENCY_three_channels_DEF (0x00000000)
+ #define MCSCHEDS_CR_SC_IO_LATENCY_DIS_RT_CLK_GATE_OFF (31)
+ #define MCSCHEDS_CR_SC_IO_LATENCY_DIS_RT_CLK_GATE_WID ( 1)
+ #define MCSCHEDS_CR_SC_IO_LATENCY_DIS_RT_CLK_GATE_MSK (0x80000000)
+ #define MCSCHEDS_CR_SC_IO_LATENCY_DIS_RT_CLK_GATE_MAX (0x00000001)
+ #define MCSCHEDS_CR_SC_IO_LATENCY_DIS_RT_CLK_GATE_DEF (0x00000000)
+
+#define MCSCHEDS_CR_ROUND_TRIP_DFT_DATA_REG (0x00004C2C)
+ #define MCSCHEDS_CR_ROUND_TRIP_DFT_DATA_DATA_OFF ( 0)
+ #define MCSCHEDS_CR_ROUND_TRIP_DFT_DATA_DATA_WID (32)
+ #define MCSCHEDS_CR_ROUND_TRIP_DFT_DATA_DATA_MSK (0xFFFFFFFF)
+ #define MCSCHEDS_CR_ROUND_TRIP_DFT_DATA_DATA_MAX (0xFFFFFFFF)
+ #define MCSCHEDS_CR_ROUND_TRIP_DFT_DATA_DATA_DEF (0x00000000)
+
+#define MCSCHEDS_CR_DFT_MISC_REG (0x00004C30)
+ #define MCSCHEDS_CR_DFT_MISC_WDAR_OFF ( 0)
+ #define MCSCHEDS_CR_DFT_MISC_WDAR_WID ( 1)
+ #define MCSCHEDS_CR_DFT_MISC_WDAR_MSK (0x00000001)
+ #define MCSCHEDS_CR_DFT_MISC_WDAR_MAX (0x00000001)
+ #define MCSCHEDS_CR_DFT_MISC_WDAR_DEF (0x00000000)
+ #define MCSCHEDS_CR_DFT_MISC_safe_mask_sel_OFF ( 1)
+ #define MCSCHEDS_CR_DFT_MISC_safe_mask_sel_WID ( 3)
+ #define MCSCHEDS_CR_DFT_MISC_safe_mask_sel_MSK (0x0000000E)
+ #define MCSCHEDS_CR_DFT_MISC_safe_mask_sel_MAX (0x00000007)
+ #define MCSCHEDS_CR_DFT_MISC_safe_mask_sel_DEF (0x00000000)
+ #define MCSCHEDS_CR_DFT_MISC_force_rcv_en_OFF ( 4)
+ #define MCSCHEDS_CR_DFT_MISC_force_rcv_en_WID ( 1)
+ #define MCSCHEDS_CR_DFT_MISC_force_rcv_en_MSK (0x00000010)
+ #define MCSCHEDS_CR_DFT_MISC_force_rcv_en_MAX (0x00000001)
+ #define MCSCHEDS_CR_DFT_MISC_force_rcv_en_DEF (0x00000000)
+ #define MCSCHEDS_CR_DFT_MISC_DDR_QUAL_OFF ( 8)
+ #define MCSCHEDS_CR_DFT_MISC_DDR_QUAL_WID ( 2)
+ #define MCSCHEDS_CR_DFT_MISC_DDR_QUAL_MSK (0x00000300)
+ #define MCSCHEDS_CR_DFT_MISC_DDR_QUAL_MAX (0x00000003)
+ #define MCSCHEDS_CR_DFT_MISC_DDR_QUAL_DEF (0x00000000)
+ #define MCSCHEDS_CR_DFT_MISC_Qual_length_OFF (10)
+ #define MCSCHEDS_CR_DFT_MISC_Qual_length_WID ( 2)
+ #define MCSCHEDS_CR_DFT_MISC_Qual_length_MSK (0x00000C00)
+ #define MCSCHEDS_CR_DFT_MISC_Qual_length_MAX (0x00000003)
+ #define MCSCHEDS_CR_DFT_MISC_Qual_length_DEF (0x00000000)
+ #define MCSCHEDS_CR_DFT_MISC_WDB_Block_En_OFF (12)
+ #define MCSCHEDS_CR_DFT_MISC_WDB_Block_En_WID ( 1)
+ #define MCSCHEDS_CR_DFT_MISC_WDB_Block_En_MSK (0x00001000)
+ #define MCSCHEDS_CR_DFT_MISC_WDB_Block_En_MAX (0x00000001)
+ #define MCSCHEDS_CR_DFT_MISC_WDB_Block_En_DEF (0x00000000)
+ #define MCSCHEDS_CR_DFT_MISC_RT_DFT_READ_PTR_OFF (13)
+ #define MCSCHEDS_CR_DFT_MISC_RT_DFT_READ_PTR_WID ( 4)
+ #define MCSCHEDS_CR_DFT_MISC_RT_DFT_READ_PTR_MSK (0x0001E000)
+ #define MCSCHEDS_CR_DFT_MISC_RT_DFT_READ_PTR_MAX (0x0000000F)
+ #define MCSCHEDS_CR_DFT_MISC_RT_DFT_READ_PTR_DEF (0x00000000)
+ #define MCSCHEDS_CR_DFT_MISC_RT_DFT_READ_ENABLE_OFF (17)
+ #define MCSCHEDS_CR_DFT_MISC_RT_DFT_READ_ENABLE_WID ( 1)
+ #define MCSCHEDS_CR_DFT_MISC_RT_DFT_READ_ENABLE_MSK (0x00020000)
+ #define MCSCHEDS_CR_DFT_MISC_RT_DFT_READ_ENABLE_MAX (0x00000001)
+ #define MCSCHEDS_CR_DFT_MISC_RT_DFT_READ_ENABLE_DEF (0x00000000)
+ #define MCSCHEDS_CR_DFT_MISC_RT_DFT_READ_SEL_ADDR_OFF (18)
+ #define MCSCHEDS_CR_DFT_MISC_RT_DFT_READ_SEL_ADDR_WID ( 1)
+ #define MCSCHEDS_CR_DFT_MISC_RT_DFT_READ_SEL_ADDR_MSK (0x00040000)
+ #define MCSCHEDS_CR_DFT_MISC_RT_DFT_READ_SEL_ADDR_MAX (0x00000001)
+ #define MCSCHEDS_CR_DFT_MISC_RT_DFT_READ_SEL_ADDR_DEF (0x00000000)
+
+#define MCSCHEDS_CR_READ_RETURN_DFT_REG (0x00004C34)
+ #define MCSCHEDS_CR_READ_RETURN_DFT_ECC_OFF ( 0)
+ #define MCSCHEDS_CR_READ_RETURN_DFT_ECC_WID ( 8)
+ #define MCSCHEDS_CR_READ_RETURN_DFT_ECC_MSK (0x000000FF)
+ #define MCSCHEDS_CR_READ_RETURN_DFT_ECC_MAX (0x000000FF)
+ #define MCSCHEDS_CR_READ_RETURN_DFT_ECC_DEF (0x00000000)
+ #define MCSCHEDS_CR_READ_RETURN_DFT_RRD_DFT_Mode_OFF ( 8)
+ #define MCSCHEDS_CR_READ_RETURN_DFT_RRD_DFT_Mode_WID ( 2)
+ #define MCSCHEDS_CR_READ_RETURN_DFT_RRD_DFT_Mode_MSK (0x00000300)
+ #define MCSCHEDS_CR_READ_RETURN_DFT_RRD_DFT_Mode_MAX (0x00000003)
+ #define MCSCHEDS_CR_READ_RETURN_DFT_RRD_DFT_Mode_DEF (0x00000000)
+ #define MCSCHEDS_CR_READ_RETURN_DFT_LFSR_Seed_Index_OFF (10)
+ #define MCSCHEDS_CR_READ_RETURN_DFT_LFSR_Seed_Index_WID ( 5)
+ #define MCSCHEDS_CR_READ_RETURN_DFT_LFSR_Seed_Index_MSK (0x00007C00)
+ #define MCSCHEDS_CR_READ_RETURN_DFT_LFSR_Seed_Index_MAX (0x0000001F)
+ #define MCSCHEDS_CR_READ_RETURN_DFT_LFSR_Seed_Index_DEF (0x00000000)
+ #define MCSCHEDS_CR_READ_RETURN_DFT_Inversion_Mode_OFF (15)
+ #define MCSCHEDS_CR_READ_RETURN_DFT_Inversion_Mode_WID ( 1)
+ #define MCSCHEDS_CR_READ_RETURN_DFT_Inversion_Mode_MSK (0x00008000)
+ #define MCSCHEDS_CR_READ_RETURN_DFT_Inversion_Mode_MAX (0x00000001)
+ #define MCSCHEDS_CR_READ_RETURN_DFT_Inversion_Mode_DEF (0x00000000)
+
+#define MCSCHEDS_CR_SCHED_SECOND_CBIT_REG (0x00004C38)
+ #define MCSCHEDS_CR_SCHED_SECOND_CBIT_dis_imph_error_OFF ( 0)
+ #define MCSCHEDS_CR_SCHED_SECOND_CBIT_dis_imph_error_WID ( 1)
+ #define MCSCHEDS_CR_SCHED_SECOND_CBIT_dis_imph_error_MSK (0x00000001)
+ #define MCSCHEDS_CR_SCHED_SECOND_CBIT_dis_imph_error_MAX (0x00000001)
+ #define MCSCHEDS_CR_SCHED_SECOND_CBIT_dis_imph_error_DEF (0x00000000)
+ #define MCSCHEDS_CR_SCHED_SECOND_CBIT_dis_async_odt_OFF ( 8)
+ #define MCSCHEDS_CR_SCHED_SECOND_CBIT_dis_async_odt_WID ( 1)
+ #define MCSCHEDS_CR_SCHED_SECOND_CBIT_dis_async_odt_MSK (0x00000100)
+ #define MCSCHEDS_CR_SCHED_SECOND_CBIT_dis_async_odt_MAX (0x00000001)
+ #define MCSCHEDS_CR_SCHED_SECOND_CBIT_dis_async_odt_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_REG (0x00004C40)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux0_Control_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux0_Control_WID ( 2)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux0_Control_MSK (0x00000003)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux0_Control_MAX (0x00000003)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux0_Control_DEF (0x00000001)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux1_Control_OFF ( 3)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux1_Control_WID ( 2)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux1_Control_MSK (0x00000018)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux1_Control_MAX (0x00000003)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux1_Control_DEF (0x00000001)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux2_Control_OFF ( 6)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux2_Control_WID ( 2)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux2_Control_MSK (0x000000C0)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux2_Control_MAX (0x00000003)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux2_Control_DEF (0x00000001)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_ECC_Replace_Byte_Control_OFF (14)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_ECC_Replace_Byte_Control_WID ( 1)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_ECC_Replace_Byte_Control_MSK (0x00004000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_ECC_Replace_Byte_Control_MAX (0x00000001)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_ECC_Replace_Byte_Control_DEF (0x00000001)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_ECC_Data_Source_Sel_OFF (15)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_ECC_Data_Source_Sel_WID ( 1)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_ECC_Data_Source_Sel_MSK (0x00008000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_ECC_Data_Source_Sel_MAX (0x00000001)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_ECC_Data_Source_Sel_DEF (0x00000001)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Save_LFSR_Seed_Rate_OFF (16)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Save_LFSR_Seed_Rate_WID ( 6)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Save_LFSR_Seed_Rate_MSK (0x003F0000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Save_LFSR_Seed_Rate_MAX (0x0000003F)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Save_LFSR_Seed_Rate_DEF (0x00000000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Reload_LFSR_Seed_Rate_OFF (24)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Reload_LFSR_Seed_Rate_WID ( 3)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Reload_LFSR_Seed_Rate_MSK (0x07000000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Reload_LFSR_Seed_Rate_MAX (0x00000007)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Reload_LFSR_Seed_Rate_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_RD_STATUS_REG (0x00004C44)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_RD_STATUS_WDB_Current_Read_Pointer_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_RD_STATUS_WDB_Current_Read_Pointer_WID ( 6)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_RD_STATUS_WDB_Current_Read_Pointer_MSK (0x0000003F)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_RD_STATUS_WDB_Current_Read_Pointer_MAX (0x0000003F)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_RD_STATUS_WDB_Current_Read_Pointer_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_0_REG (0x00004C48)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_0_Pattern_Buffer_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_0_Pattern_Buffer_WID (24)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_0_Pattern_Buffer_MSK (0x00FFFFFF)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_0_Pattern_Buffer_MAX (0x00FFFFFF)
+
+#define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_1_REG (0x00004C4C)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_1_Pattern_Buffer_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_1_Pattern_Buffer_WID (24)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_1_Pattern_Buffer_MSK (0x00FFFFFF)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_1_Pattern_Buffer_MAX (0x00FFFFFF)
+
+#define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_2_REG (0x00004C50)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_2_Pattern_Buffer_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_2_Pattern_Buffer_WID (24)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_2_Pattern_Buffer_MSK (0x00FFFFFF)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_2_Pattern_Buffer_MAX (0x00FFFFFF)
+
+#define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_0_REG (0x00004C54)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_0_Pattern_Buffer_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_0_Pattern_Buffer_WID (24)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_0_Pattern_Buffer_MSK (0x00FFFFFF)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_0_Pattern_Buffer_MAX (0x00FFFFFF)
+
+#define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_1_REG (0x00004C58)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_1_Pattern_Buffer_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_1_Pattern_Buffer_WID (24)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_1_Pattern_Buffer_MSK (0x00FFFFFF)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_1_Pattern_Buffer_MAX (0x00FFFFFF)
+
+#define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_2_REG (0x00004C5C)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_2_Pattern_Buffer_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_2_Pattern_Buffer_WID (24)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_2_Pattern_Buffer_MSK (0x00FFFFFF)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_2_Pattern_Buffer_MAX (0x00FFFFFF)
+
+#define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_0_REG (0x00004C60)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_0_Pattern_Buffer_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_0_Pattern_Buffer_WID (24)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_0_Pattern_Buffer_MSK (0x00FFFFFF)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_0_Pattern_Buffer_MAX (0x00FFFFFF)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_0_Pattern_Buffer_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_1_REG (0x00004C64)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_1_Pattern_Buffer_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_1_Pattern_Buffer_WID (24)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_1_Pattern_Buffer_MSK (0x00FFFFFF)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_1_Pattern_Buffer_MAX (0x00FFFFFF)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_1_Pattern_Buffer_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_2_REG (0x00004C68)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_2_Pattern_Buffer_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_2_Pattern_Buffer_WID (24)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_2_Pattern_Buffer_MSK (0x00FFFFFF)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_2_Pattern_Buffer_MAX (0x00FFFFFF)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_2_Pattern_Buffer_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_0_REG (0x00004C6C)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_0_Pattern_Buffer_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_0_Pattern_Buffer_WID (24)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_0_Pattern_Buffer_MSK (0x00FFFFFF)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_0_Pattern_Buffer_MAX (0x00FFFFFF)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_0_Pattern_Buffer_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_1_REG (0x00004C70)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_1_Pattern_Buffer_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_1_Pattern_Buffer_WID (24)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_1_Pattern_Buffer_MSK (0x00FFFFFF)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_1_Pattern_Buffer_MAX (0x00FFFFFF)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_1_Pattern_Buffer_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_2_REG (0x00004C74)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_2_Pattern_Buffer_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_2_Pattern_Buffer_WID (24)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_2_Pattern_Buffer_MSK (0x00FFFFFF)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_2_Pattern_Buffer_MAX (0x00FFFFFF)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_2_Pattern_Buffer_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_REG (0x00004C78)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_L_data_select_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_L_data_select_WID ( 1)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_L_data_select_MSK (0x00000001)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_L_data_select_MAX (0x00000001)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_L_data_select_DEF (0x00000000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_Enable_Sweep_Frequency_OFF ( 1)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_Enable_Sweep_Frequency_WID ( 1)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_Enable_Sweep_Frequency_MSK (0x00000002)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_Enable_Sweep_Frequency_MAX (0x00000001)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_Enable_Sweep_Frequency_DEF (0x00000000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_L_counter_OFF ( 8)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_L_counter_WID ( 8)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_L_counter_MSK (0x0000FF00)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_L_counter_MAX (0x000000FF)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_L_counter_DEF (0x00000001)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_M_counter_OFF (16)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_M_counter_WID ( 8)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_M_counter_MSK (0x00FF0000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_M_counter_MAX (0x000000FF)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_M_counter_DEF (0x00000001)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_N_counter_OFF (24)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_N_counter_WID ( 8)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_N_counter_MSK (0xFF000000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_N_counter_MAX (0x000000FF)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_N_counter_DEF (0x00000001)
+
+#define MCSCHEDS_CR_REUT_CH_PAT_WDB_INV_REG (0x00004C84)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_INV_ECC_Inv_or_DC_Enable_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_INV_ECC_Inv_or_DC_Enable_WID ( 8)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_INV_ECC_Inv_or_DC_Enable_MSK (0x000000FF)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_INV_ECC_Inv_or_DC_Enable_MAX (0x000000FF)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_INV_ECC_Inv_or_DC_Enable_DEF (0x00000000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Shift_Rate_OFF (16)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Shift_Rate_WID ( 4)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Shift_Rate_MSK (0x000F0000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Shift_Rate_MAX (0x0000000F)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Shift_Rate_DEF (0x00000000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_INV_DC_Polarity_Control_OFF (20)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_INV_DC_Polarity_Control_WID ( 1)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_INV_DC_Polarity_Control_MSK (0x00100000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_INV_DC_Polarity_Control_MAX (0x00000001)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_INV_DC_Polarity_Control_DEF (0x00000000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Control_OFF (30)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Control_WID ( 1)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Control_MSK (0x40000000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Control_MAX (0x00000001)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Control_DEF (0x00000000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Shift_Enable_OFF (31)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Shift_Enable_WID ( 1)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Shift_Enable_MSK (0x80000000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Shift_Enable_MAX (0x00000001)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Shift_Enable_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_PAT_WDB_DATA_INV_REG (0x00004C90)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_DATA_INV_Data_Inv_or_DC_Enable_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_DATA_INV_Data_Inv_or_DC_Enable_WID (64)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_DATA_INV_Data_Inv_or_DC_Enable_MSK (0xFFFFFFFFFFFFFFFF)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_DATA_INV_Data_Inv_or_DC_Enable_MAX (0xFFFFFFFFFFFFFFFF)
+ #define MCSCHEDS_CR_REUT_CH_PAT_WDB_DATA_INV_Data_Inv_or_DC_Enable_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_ERR_CTL_REG (0x00004C98)
+ #define MCSCHEDS_CR_REUT_CH_ERR_CTL_Stop_on_Nth_Error_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_ERR_CTL_Stop_on_Nth_Error_WID ( 6)
+ #define MCSCHEDS_CR_REUT_CH_ERR_CTL_Stop_on_Nth_Error_MSK (0x0000003F)
+ #define MCSCHEDS_CR_REUT_CH_ERR_CTL_Stop_on_Nth_Error_MAX (0x0000003F)
+ #define MCSCHEDS_CR_REUT_CH_ERR_CTL_Stop_on_Nth_Error_DEF (0x00000001)
+ #define MCSCHEDS_CR_REUT_CH_ERR_CTL_Stop_On_Error_Control_OFF (12)
+ #define MCSCHEDS_CR_REUT_CH_ERR_CTL_Stop_On_Error_Control_WID ( 2)
+ #define MCSCHEDS_CR_REUT_CH_ERR_CTL_Stop_On_Error_Control_MSK (0x00003000)
+ #define MCSCHEDS_CR_REUT_CH_ERR_CTL_Stop_On_Error_Control_MAX (0x00000003)
+ #define MCSCHEDS_CR_REUT_CH_ERR_CTL_Stop_On_Error_Control_DEF (0x00000000)
+ #define MCSCHEDS_CR_REUT_CH_ERR_CTL_Selective_Error_Enable_Chunk_OFF (16)
+ #define MCSCHEDS_CR_REUT_CH_ERR_CTL_Selective_Error_Enable_Chunk_WID ( 8)
+ #define MCSCHEDS_CR_REUT_CH_ERR_CTL_Selective_Error_Enable_Chunk_MSK (0x00FF0000)
+ #define MCSCHEDS_CR_REUT_CH_ERR_CTL_Selective_Error_Enable_Chunk_MAX (0x000000FF)
+ #define MCSCHEDS_CR_REUT_CH_ERR_CTL_Selective_Error_Enable_Chunk_DEF (0x000000FF)
+ #define MCSCHEDS_CR_REUT_CH_ERR_CTL_Selective_Error_Enable_Cacheline_OFF (24)
+ #define MCSCHEDS_CR_REUT_CH_ERR_CTL_Selective_Error_Enable_Cacheline_WID ( 8)
+ #define MCSCHEDS_CR_REUT_CH_ERR_CTL_Selective_Error_Enable_Cacheline_MSK (0xFF000000)
+ #define MCSCHEDS_CR_REUT_CH_ERR_CTL_Selective_Error_Enable_Cacheline_MAX (0x000000FF)
+ #define MCSCHEDS_CR_REUT_CH_ERR_CTL_Selective_Error_Enable_Cacheline_DEF (0x000000FF)
+
+#define MCSCHEDS_CR_REUT_CH_ERR_ECC_MASK_REG (0x00004C9C)
+ #define MCSCHEDS_CR_REUT_CH_ERR_ECC_MASK_ECC_Error_Mask_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_ERR_ECC_MASK_ECC_Error_Mask_WID ( 8)
+ #define MCSCHEDS_CR_REUT_CH_ERR_ECC_MASK_ECC_Error_Mask_MSK (0x000000FF)
+ #define MCSCHEDS_CR_REUT_CH_ERR_ECC_MASK_ECC_Error_Mask_MAX (0x000000FF)
+ #define MCSCHEDS_CR_REUT_CH_ERR_ECC_MASK_ECC_Error_Mask_DEF (0x00000000)
+
+#define MCSCHEDS_CR_STM_CONFIG_REG (0x00004CA4)
+ #define MCSCHEDS_CR_STM_CONFIG_Stretch_mode_OFF ( 0)
+ #define MCSCHEDS_CR_STM_CONFIG_Stretch_mode_WID ( 2)
+ #define MCSCHEDS_CR_STM_CONFIG_Stretch_mode_MSK (0x00000003)
+ #define MCSCHEDS_CR_STM_CONFIG_Stretch_mode_MAX (0x00000003)
+ #define MCSCHEDS_CR_STM_CONFIG_Stretch_mode_DEF (0x00000000)
+ #define MCSCHEDS_CR_STM_CONFIG_STF_OFF ( 4)
+ #define MCSCHEDS_CR_STM_CONFIG_STF_WID ( 3)
+ #define MCSCHEDS_CR_STM_CONFIG_STF_MSK (0x00000070)
+ #define MCSCHEDS_CR_STM_CONFIG_STF_MAX (0x00000007)
+ #define MCSCHEDS_CR_STM_CONFIG_STF_DEF (0x00000000)
+
+#define MCSCHEDS_CR_SC_PR_CNT_CONFIG_REG (0x00004CA8)
+ #define MCSCHEDS_CR_SC_PR_CNT_CONFIG_Priority_count_ring_OFF ( 0)
+ #define MCSCHEDS_CR_SC_PR_CNT_CONFIG_Priority_count_ring_WID (10)
+ #define MCSCHEDS_CR_SC_PR_CNT_CONFIG_Priority_count_ring_MSK (0x000003FF)
+ #define MCSCHEDS_CR_SC_PR_CNT_CONFIG_Priority_count_ring_MAX (0x000003FF)
+ #define MCSCHEDS_CR_SC_PR_CNT_CONFIG_Priority_count_ring_DEF (0x00000040)
+ #define MCSCHEDS_CR_SC_PR_CNT_CONFIG_Priority_count_SA_OFF (16)
+ #define MCSCHEDS_CR_SC_PR_CNT_CONFIG_Priority_count_SA_WID (10)
+ #define MCSCHEDS_CR_SC_PR_CNT_CONFIG_Priority_count_SA_MSK (0x03FF0000)
+ #define MCSCHEDS_CR_SC_PR_CNT_CONFIG_Priority_count_SA_MAX (0x000003FF)
+ #define MCSCHEDS_CR_SC_PR_CNT_CONFIG_Priority_count_SA_DEF (0x00000100)
+
+#define MCSCHEDS_CR_SC_PCIT_REG (0x00004CAC)
+ #define MCSCHEDS_CR_SC_PCIT_PCIT_OFF ( 0)
+ #define MCSCHEDS_CR_SC_PCIT_PCIT_WID ( 8)
+ #define MCSCHEDS_CR_SC_PCIT_PCIT_MSK (0x000000FF)
+ #define MCSCHEDS_CR_SC_PCIT_PCIT_MAX (0x000000FF)
+ #define MCSCHEDS_CR_SC_PCIT_PCIT_DEF (0x00000040)
+
+#define MCSCHEDS_CR_PM_PDWN_CONFIG_REG (0x00004CB0)
+ #define MCSCHEDS_CR_PM_PDWN_CONFIG_PDWN_idle_counter_OFF ( 0)
+ #define MCSCHEDS_CR_PM_PDWN_CONFIG_PDWN_idle_counter_WID (12)
+ #define MCSCHEDS_CR_PM_PDWN_CONFIG_PDWN_idle_counter_MSK (0x00000FFF)
+ #define MCSCHEDS_CR_PM_PDWN_CONFIG_PDWN_idle_counter_MAX (0x00000FFF)
+ #define MCSCHEDS_CR_PM_PDWN_CONFIG_PDWN_idle_counter_DEF (0x00000000)
+ #define MCSCHEDS_CR_PM_PDWN_CONFIG_PDWN_mode_OFF (12)
+ #define MCSCHEDS_CR_PM_PDWN_CONFIG_PDWN_mode_WID ( 4)
+ #define MCSCHEDS_CR_PM_PDWN_CONFIG_PDWN_mode_MSK (0x0000F000)
+ #define MCSCHEDS_CR_PM_PDWN_CONFIG_PDWN_mode_MAX (0x0000000F)
+ #define MCSCHEDS_CR_PM_PDWN_CONFIG_PDWN_mode_DEF (0x00000000)
+
+#define MCSCHEDS_CR_ECC_INJECT_COUNT_REG (0x00004CB4)
+ #define MCSCHEDS_CR_ECC_INJECT_COUNT_Count_OFF ( 0)
+ #define MCSCHEDS_CR_ECC_INJECT_COUNT_Count_WID (32)
+ #define MCSCHEDS_CR_ECC_INJECT_COUNT_Count_MSK (0xFFFFFFFF)
+ #define MCSCHEDS_CR_ECC_INJECT_COUNT_Count_MAX (0xFFFFFFFF)
+ #define MCSCHEDS_CR_ECC_INJECT_COUNT_Count_DEF (0xFFFFFFFF)
+
+#define MCSCHEDS_CR_ECC_DFT_REG (0x00004CB8)
+ #define MCSCHEDS_CR_ECC_DFT_ECC4ANA_fill_OFF ( 0)
+ #define MCSCHEDS_CR_ECC_DFT_ECC4ANA_fill_WID ( 8)
+ #define MCSCHEDS_CR_ECC_DFT_ECC4ANA_fill_MSK (0x000000FF)
+ #define MCSCHEDS_CR_ECC_DFT_ECC4ANA_fill_MAX (0x000000FF)
+ #define MCSCHEDS_CR_ECC_DFT_ECC4ANA_fill_DEF (0x00000000)
+ #define MCSCHEDS_CR_ECC_DFT_ECC4ANA_trigger_OFF ( 8)
+ #define MCSCHEDS_CR_ECC_DFT_ECC4ANA_trigger_WID ( 2)
+ #define MCSCHEDS_CR_ECC_DFT_ECC4ANA_trigger_MSK (0x00000300)
+ #define MCSCHEDS_CR_ECC_DFT_ECC4ANA_trigger_MAX (0x00000003)
+ #define MCSCHEDS_CR_ECC_DFT_ECC4ANA_trigger_DEF (0x00000000)
+ #define MCSCHEDS_CR_ECC_DFT_ECC4ANA_BS_OFF (10)
+ #define MCSCHEDS_CR_ECC_DFT_ECC4ANA_BS_WID ( 1)
+ #define MCSCHEDS_CR_ECC_DFT_ECC4ANA_BS_MSK (0x00000400)
+ #define MCSCHEDS_CR_ECC_DFT_ECC4ANA_BS_MAX (0x00000001)
+ #define MCSCHEDS_CR_ECC_DFT_ECC4ANA_BS_DEF (0x00000000)
+ #define MCSCHEDS_CR_ECC_DFT_ECC_Inject_OFF (11)
+ #define MCSCHEDS_CR_ECC_DFT_ECC_Inject_WID ( 3)
+ #define MCSCHEDS_CR_ECC_DFT_ECC_Inject_MSK (0x00003800)
+ #define MCSCHEDS_CR_ECC_DFT_ECC_Inject_MAX (0x00000007)
+ #define MCSCHEDS_CR_ECC_DFT_ECC_Inject_DEF (0x00000000)
+ #define MCSCHEDS_CR_ECC_DFT_ECC_correction_disable_OFF (14)
+ #define MCSCHEDS_CR_ECC_DFT_ECC_correction_disable_WID ( 1)
+ #define MCSCHEDS_CR_ECC_DFT_ECC_correction_disable_MSK (0x00004000)
+ #define MCSCHEDS_CR_ECC_DFT_ECC_correction_disable_MAX (0x00000001)
+ #define MCSCHEDS_CR_ECC_DFT_ECC_correction_disable_DEF (0x00000000)
+ #define MCSCHEDS_CR_ECC_DFT_ECC4ANA_Inject_OFF (15)
+ #define MCSCHEDS_CR_ECC_DFT_ECC4ANA_Inject_WID ( 1)
+ #define MCSCHEDS_CR_ECC_DFT_ECC4ANA_Inject_MSK (0x00008000)
+ #define MCSCHEDS_CR_ECC_DFT_ECC4ANA_Inject_MAX (0x00000001)
+ #define MCSCHEDS_CR_ECC_DFT_ECC4ANA_Inject_DEF (0x00000000)
+ #define MCSCHEDS_CR_ECC_DFT_DIS_MCA_LOG_OFF (16)
+ #define MCSCHEDS_CR_ECC_DFT_DIS_MCA_LOG_WID ( 1)
+ #define MCSCHEDS_CR_ECC_DFT_DIS_MCA_LOG_MSK (0x00010000)
+ #define MCSCHEDS_CR_ECC_DFT_DIS_MCA_LOG_MAX (0x00000001)
+ #define MCSCHEDS_CR_ECC_DFT_DIS_MCA_LOG_DEF (0x00000000)
+ #define MCSCHEDS_CR_ECC_DFT_DIS_PCH_EVENT_OFF (17)
+ #define MCSCHEDS_CR_ECC_DFT_DIS_PCH_EVENT_WID ( 1)
+ #define MCSCHEDS_CR_ECC_DFT_DIS_PCH_EVENT_MSK (0x00020000)
+ #define MCSCHEDS_CR_ECC_DFT_DIS_PCH_EVENT_MAX (0x00000001)
+ #define MCSCHEDS_CR_ECC_DFT_DIS_PCH_EVENT_DEF (0x00000000)
+ #define MCSCHEDS_CR_ECC_DFT_DIS_PCIE_POISON_OFF (18)
+ #define MCSCHEDS_CR_ECC_DFT_DIS_PCIE_POISON_WID ( 1)
+ #define MCSCHEDS_CR_ECC_DFT_DIS_PCIE_POISON_MSK (0x00040000)
+ #define MCSCHEDS_CR_ECC_DFT_DIS_PCIE_POISON_MAX (0x00000001)
+ #define MCSCHEDS_CR_ECC_DFT_DIS_PCIE_POISON_DEF (0x00000000)
+
+#define MCSCHEDS_CR_VISA_CTL_MCSCHEDS_REG (0x00004CC0)
+ #define MCSCHEDS_CR_VISA_CTL_MCSCHEDS_Data_OFF ( 0)
+ #define MCSCHEDS_CR_VISA_CTL_MCSCHEDS_Data_WID (18)
+ #define MCSCHEDS_CR_VISA_CTL_MCSCHEDS_Data_MSK (0x0003FFFF)
+ #define MCSCHEDS_CR_VISA_CTL_MCSCHEDS_Data_MAX (0x0003FFFF)
+ #define MCSCHEDS_CR_VISA_CTL_MCSCHEDS_Data_DEF (0x00000000)
+ #define MCSCHEDS_CR_VISA_CTL_MCSCHEDS_VORANGE_OFF (31)
+ #define MCSCHEDS_CR_VISA_CTL_MCSCHEDS_VORANGE_WID ( 1)
+ #define MCSCHEDS_CR_VISA_CTL_MCSCHEDS_VORANGE_MSK (0x80000000)
+ #define MCSCHEDS_CR_VISA_CTL_MCSCHEDS_VORANGE_MAX (0x00000001)
+ #define MCSCHEDS_CR_VISA_CTL_MCSCHEDS_VORANGE_DEF (0x00000000)
+
+#define MCSCHEDS_CR_VISA_XBAR_MCSCHEDS_REG (0x00004CC4)
+ #define MCSCHEDS_CR_VISA_XBAR_MCSCHEDS_Data_OFF ( 0)
+ #define MCSCHEDS_CR_VISA_XBAR_MCSCHEDS_Data_WID (32)
+ #define MCSCHEDS_CR_VISA_XBAR_MCSCHEDS_Data_MSK (0xFFFFFFFF)
+ #define MCSCHEDS_CR_VISA_XBAR_MCSCHEDS_Data_MAX (0xFFFFFFFF)
+ #define MCSCHEDS_CR_VISA_XBAR_MCSCHEDS_Data_DEF (0x76543210)
+
+#define MCSCHEDS_CR_ECCERRLOG0_REG (0x00004CC8)
+ #define MCSCHEDS_CR_ECCERRLOG0_CERRSTS_OFF ( 0)
+ #define MCSCHEDS_CR_ECCERRLOG0_CERRSTS_WID ( 1)
+ #define MCSCHEDS_CR_ECCERRLOG0_CERRSTS_MSK (0x00000001)
+ #define MCSCHEDS_CR_ECCERRLOG0_CERRSTS_MAX (0x00000001)
+ #define MCSCHEDS_CR_ECCERRLOG0_CERRSTS_DEF (0x00000000)
+ #define MCSCHEDS_CR_ECCERRLOG0_MERRSTS_OFF ( 1)
+ #define MCSCHEDS_CR_ECCERRLOG0_MERRSTS_WID ( 1)
+ #define MCSCHEDS_CR_ECCERRLOG0_MERRSTS_MSK (0x00000002)
+ #define MCSCHEDS_CR_ECCERRLOG0_MERRSTS_MAX (0x00000001)
+ #define MCSCHEDS_CR_ECCERRLOG0_MERRSTS_DEF (0x00000000)
+ #define MCSCHEDS_CR_ECCERRLOG0_ERRSYND_OFF (16)
+ #define MCSCHEDS_CR_ECCERRLOG0_ERRSYND_WID ( 8)
+ #define MCSCHEDS_CR_ECCERRLOG0_ERRSYND_MSK (0x00FF0000)
+ #define MCSCHEDS_CR_ECCERRLOG0_ERRSYND_MAX (0x000000FF)
+ #define MCSCHEDS_CR_ECCERRLOG0_ERRSYND_DEF (0x00000000)
+ #define MCSCHEDS_CR_ECCERRLOG0_ERRCHUNK_OFF (24)
+ #define MCSCHEDS_CR_ECCERRLOG0_ERRCHUNK_WID ( 3)
+ #define MCSCHEDS_CR_ECCERRLOG0_ERRCHUNK_MSK (0x07000000)
+ #define MCSCHEDS_CR_ECCERRLOG0_ERRCHUNK_MAX (0x00000007)
+ #define MCSCHEDS_CR_ECCERRLOG0_ERRCHUNK_DEF (0x00000000)
+ #define MCSCHEDS_CR_ECCERRLOG0_ERRRANK_OFF (27)
+ #define MCSCHEDS_CR_ECCERRLOG0_ERRRANK_WID ( 2)
+ #define MCSCHEDS_CR_ECCERRLOG0_ERRRANK_MSK (0x18000000)
+ #define MCSCHEDS_CR_ECCERRLOG0_ERRRANK_MAX (0x00000003)
+ #define MCSCHEDS_CR_ECCERRLOG0_ERRRANK_DEF (0x00000000)
+ #define MCSCHEDS_CR_ECCERRLOG0_ERRBANK_OFF (29)
+ #define MCSCHEDS_CR_ECCERRLOG0_ERRBANK_WID ( 3)
+ #define MCSCHEDS_CR_ECCERRLOG0_ERRBANK_MSK (0xE0000000)
+ #define MCSCHEDS_CR_ECCERRLOG0_ERRBANK_MAX (0x00000007)
+ #define MCSCHEDS_CR_ECCERRLOG0_ERRBANK_DEF (0x00000000)
+
+#define MCSCHEDS_CR_ECCERRLOG1_REG (0x00004CCC)
+ #define MCSCHEDS_CR_ECCERRLOG1_ERRROW_OFF ( 0)
+ #define MCSCHEDS_CR_ECCERRLOG1_ERRROW_WID (16)
+ #define MCSCHEDS_CR_ECCERRLOG1_ERRROW_MSK (0x0000FFFF)
+ #define MCSCHEDS_CR_ECCERRLOG1_ERRROW_MAX (0x0000FFFF)
+ #define MCSCHEDS_CR_ECCERRLOG1_ERRROW_DEF (0x00000000)
+ #define MCSCHEDS_CR_ECCERRLOG1_ERRCOL_OFF (16)
+ #define MCSCHEDS_CR_ECCERRLOG1_ERRCOL_WID (16)
+ #define MCSCHEDS_CR_ECCERRLOG1_ERRCOL_MSK (0xFFFF0000)
+ #define MCSCHEDS_CR_ECCERRLOG1_ERRCOL_MAX (0x0000FFFF)
+ #define MCSCHEDS_CR_ECCERRLOG1_ERRCOL_DEF (0x00000000)
+
+#define MCSCHEDS_CR_SC_WR_ADD_DELAY_REG (0x00004CD0)
+ #define MCSCHEDS_CR_SC_WR_ADD_DELAY_D0R0_OFF ( 0)
+ #define MCSCHEDS_CR_SC_WR_ADD_DELAY_D0R0_WID ( 2)
+ #define MCSCHEDS_CR_SC_WR_ADD_DELAY_D0R0_MSK (0x00000003)
+ #define MCSCHEDS_CR_SC_WR_ADD_DELAY_D0R0_MAX (0x00000003)
+ #define MCSCHEDS_CR_SC_WR_ADD_DELAY_D0R0_DEF (0x00000000)
+ #define MCSCHEDS_CR_SC_WR_ADD_DELAY_D0R1_OFF ( 2)
+ #define MCSCHEDS_CR_SC_WR_ADD_DELAY_D0R1_WID ( 2)
+ #define MCSCHEDS_CR_SC_WR_ADD_DELAY_D0R1_MSK (0x0000000C)
+ #define MCSCHEDS_CR_SC_WR_ADD_DELAY_D0R1_MAX (0x00000003)
+ #define MCSCHEDS_CR_SC_WR_ADD_DELAY_D0R1_DEF (0x00000000)
+ #define MCSCHEDS_CR_SC_WR_ADD_DELAY_D1R0_OFF ( 4)
+ #define MCSCHEDS_CR_SC_WR_ADD_DELAY_D1R0_WID ( 2)
+ #define MCSCHEDS_CR_SC_WR_ADD_DELAY_D1R0_MSK (0x00000030)
+ #define MCSCHEDS_CR_SC_WR_ADD_DELAY_D1R0_MAX (0x00000003)
+ #define MCSCHEDS_CR_SC_WR_ADD_DELAY_D1R0_DEF (0x00000000)
+ #define MCSCHEDS_CR_SC_WR_ADD_DELAY_D1R1_OFF ( 6)
+ #define MCSCHEDS_CR_SC_WR_ADD_DELAY_D1R1_WID ( 2)
+ #define MCSCHEDS_CR_SC_WR_ADD_DELAY_D1R1_MSK (0x000000C0)
+ #define MCSCHEDS_CR_SC_WR_ADD_DELAY_D1R1_MAX (0x00000003)
+ #define MCSCHEDS_CR_SC_WR_ADD_DELAY_D1R1_DEF (0x00000000)
+
+#define MCSCHEDS_CR_WMM_READ_CONFIG_REG (0x00004CD4)
+ #define MCSCHEDS_CR_WMM_READ_CONFIG_Dis_Opp_rd_OFF ( 0)
+ #define MCSCHEDS_CR_WMM_READ_CONFIG_Dis_Opp_rd_WID ( 1)
+ #define MCSCHEDS_CR_WMM_READ_CONFIG_Dis_Opp_rd_MSK (0x00000001)
+ #define MCSCHEDS_CR_WMM_READ_CONFIG_Dis_Opp_rd_MAX (0x00000001)
+ #define MCSCHEDS_CR_WMM_READ_CONFIG_Dis_Opp_rd_DEF (0x00000000)
+ #define MCSCHEDS_CR_WMM_READ_CONFIG_ACT_Enable_OFF ( 1)
+ #define MCSCHEDS_CR_WMM_READ_CONFIG_ACT_Enable_WID ( 1)
+ #define MCSCHEDS_CR_WMM_READ_CONFIG_ACT_Enable_MSK (0x00000002)
+ #define MCSCHEDS_CR_WMM_READ_CONFIG_ACT_Enable_MAX (0x00000001)
+ #define MCSCHEDS_CR_WMM_READ_CONFIG_ACT_Enable_DEF (0x00000001)
+ #define MCSCHEDS_CR_WMM_READ_CONFIG_PRE_Enable_OFF ( 2)
+ #define MCSCHEDS_CR_WMM_READ_CONFIG_PRE_Enable_WID ( 1)
+ #define MCSCHEDS_CR_WMM_READ_CONFIG_PRE_Enable_MSK (0x00000004)
+ #define MCSCHEDS_CR_WMM_READ_CONFIG_PRE_Enable_MAX (0x00000001)
+ #define MCSCHEDS_CR_WMM_READ_CONFIG_PRE_Enable_DEF (0x00000001)
+ #define MCSCHEDS_CR_WMM_READ_CONFIG_MAX_RPQ_Cas_OFF ( 3)
+ #define MCSCHEDS_CR_WMM_READ_CONFIG_MAX_RPQ_Cas_WID ( 4)
+ #define MCSCHEDS_CR_WMM_READ_CONFIG_MAX_RPQ_Cas_MSK (0x00000078)
+ #define MCSCHEDS_CR_WMM_READ_CONFIG_MAX_RPQ_Cas_MAX (0x0000000F)
+ #define MCSCHEDS_CR_WMM_READ_CONFIG_MAX_RPQ_Cas_DEF (0x00000008)
+
+#define MCSCHEDS_CR_REUT_CH_ERR_DATA_MASK_REG (0x00004CD8)
+ #define MCSCHEDS_CR_REUT_CH_ERR_DATA_MASK_Data_Error_Mask_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_ERR_DATA_MASK_Data_Error_Mask_WID (64)
+ #define MCSCHEDS_CR_REUT_CH_ERR_DATA_MASK_Data_Error_Mask_MSK (0xFFFFFFFFFFFFFFFF)
+ #define MCSCHEDS_CR_REUT_CH_ERR_DATA_MASK_Data_Error_Mask_MAX (0xFFFFFFFFFFFFFFFF)
+ #define MCSCHEDS_CR_REUT_CH_ERR_DATA_MASK_Data_Error_Mask_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_ERR_DATA_STATUS_REG (0x00004CE0)
+ #define MCSCHEDS_CR_REUT_CH_ERR_DATA_STATUS_Data_Error_Status_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_ERR_DATA_STATUS_Data_Error_Status_WID (64)
+ #define MCSCHEDS_CR_REUT_CH_ERR_DATA_STATUS_Data_Error_Status_MSK (0xFFFFFFFFFFFFFFFF)
+ #define MCSCHEDS_CR_REUT_CH_ERR_DATA_STATUS_Data_Error_Status_MAX (0xFFFFFFFFFFFFFFFF)
+ #define MCSCHEDS_CR_REUT_CH_ERR_DATA_STATUS_Data_Error_Status_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_REG (0x00004CE8)
+ #define MCSCHEDS_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_ECC_Error_Status_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_ECC_Error_Status_WID ( 8)
+ #define MCSCHEDS_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_ECC_Error_Status_MSK (0x000000FF)
+ #define MCSCHEDS_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_ECC_Error_Status_MAX (0x000000FF)
+ #define MCSCHEDS_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_ECC_Error_Status_DEF (0x00000000)
+ #define MCSCHEDS_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Chunk_Error_Status_OFF ( 8)
+ #define MCSCHEDS_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Chunk_Error_Status_WID ( 8)
+ #define MCSCHEDS_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Chunk_Error_Status_MSK (0x0000FF00)
+ #define MCSCHEDS_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Chunk_Error_Status_MAX (0x000000FF)
+ #define MCSCHEDS_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Chunk_Error_Status_DEF (0x00000000)
+ #define MCSCHEDS_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Rank_Error_Status_OFF (16)
+ #define MCSCHEDS_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Rank_Error_Status_WID ( 4)
+ #define MCSCHEDS_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Rank_Error_Status_MSK (0x000F0000)
+ #define MCSCHEDS_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Rank_Error_Status_MAX (0x0000000F)
+ #define MCSCHEDS_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Rank_Error_Status_DEF (0x00000000)
+ #define MCSCHEDS_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Byte_Group_Error_Status_OFF (32)
+ #define MCSCHEDS_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Byte_Group_Error_Status_WID ( 9)
+ #define MCSCHEDS_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Byte_Group_Error_Status_MSK (0x1FF00000000)
+ #define MCSCHEDS_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Byte_Group_Error_Status_MAX (0x000001FF)
+ #define MCSCHEDS_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Byte_Group_Error_Status_DEF (0x00000000)
+ #define MCSCHEDS_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_WDB_Rd_Chunk_Num_Status_OFF (52)
+ #define MCSCHEDS_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_WDB_Rd_Chunk_Num_Status_WID ( 3)
+ #define MCSCHEDS_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_WDB_Rd_Chunk_Num_Status_MSK (0x70000000000000)
+ #define MCSCHEDS_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_WDB_Rd_Chunk_Num_Status_MAX (0x00000007)
+ #define MCSCHEDS_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_WDB_Rd_Chunk_Num_Status_DEF (0x00000000)
+ #define MCSCHEDS_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Nth_Error_OFF (56)
+ #define MCSCHEDS_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Nth_Error_WID ( 6)
+ #define MCSCHEDS_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Nth_Error_MSK (0x3F00000000000000)
+ #define MCSCHEDS_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Nth_Error_MAX (0x0000003F)
+ #define MCSCHEDS_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Nth_Error_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_0_REG (0x00004CF0)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_0_Counter_Pointer_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_0_Counter_Pointer_WID ( 7)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_0_Counter_Pointer_MSK (0x0000007F)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_0_Counter_Pointer_MAX (0x0000007F)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_0_Counter_Pointer_DEF (0x0000007F)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_0_Counter_Control_OFF ( 7)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_0_Counter_Control_WID ( 2)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_0_Counter_Control_MSK (0x00000180)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_0_Counter_Control_MAX (0x00000003)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_0_Counter_Control_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_1_REG (0x00004CF4)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_1_Counter_Pointer_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_1_Counter_Pointer_WID ( 7)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_1_Counter_Pointer_MSK (0x0000007F)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_1_Counter_Pointer_MAX (0x0000007F)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_1_Counter_Pointer_DEF (0x0000007F)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_1_Counter_Control_OFF ( 7)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_1_Counter_Control_WID ( 2)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_1_Counter_Control_MSK (0x00000180)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_1_Counter_Control_MAX (0x00000003)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_1_Counter_Control_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_2_REG (0x00004CF8)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_2_Counter_Pointer_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_2_Counter_Pointer_WID ( 7)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_2_Counter_Pointer_MSK (0x0000007F)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_2_Counter_Pointer_MAX (0x0000007F)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_2_Counter_Pointer_DEF (0x0000007F)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_2_Counter_Control_OFF ( 7)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_2_Counter_Control_WID ( 2)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_2_Counter_Control_MSK (0x00000180)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_2_Counter_Control_MAX (0x00000003)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_2_Counter_Control_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_3_REG (0x00004CFC)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_3_Counter_Pointer_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_3_Counter_Pointer_WID ( 7)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_3_Counter_Pointer_MSK (0x0000007F)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_3_Counter_Pointer_MAX (0x0000007F)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_3_Counter_Pointer_DEF (0x0000007F)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_3_Counter_Control_OFF ( 7)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_3_Counter_Control_WID ( 2)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_3_Counter_Control_MSK (0x00000180)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_3_Counter_Control_MAX (0x00000003)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_3_Counter_Control_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_4_REG (0x00004D00)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_4_Counter_Pointer_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_4_Counter_Pointer_WID ( 7)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_4_Counter_Pointer_MSK (0x0000007F)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_4_Counter_Pointer_MAX (0x0000007F)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_4_Counter_Pointer_DEF (0x0000007F)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_4_Counter_Control_OFF ( 7)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_4_Counter_Control_WID ( 2)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_4_Counter_Control_MSK (0x00000180)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_4_Counter_Control_MAX (0x00000003)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_4_Counter_Control_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_5_REG (0x00004D04)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_5_Counter_Pointer_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_5_Counter_Pointer_WID ( 7)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_5_Counter_Pointer_MSK (0x0000007F)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_5_Counter_Pointer_MAX (0x0000007F)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_5_Counter_Pointer_DEF (0x0000007F)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_5_Counter_Control_OFF ( 7)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_5_Counter_Control_WID ( 2)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_5_Counter_Control_MSK (0x00000180)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_5_Counter_Control_MAX (0x00000003)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_5_Counter_Control_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_6_REG (0x00004D08)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_6_Counter_Pointer_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_6_Counter_Pointer_WID ( 7)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_6_Counter_Pointer_MSK (0x0000007F)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_6_Counter_Pointer_MAX (0x0000007F)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_6_Counter_Pointer_DEF (0x0000007F)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_6_Counter_Control_OFF ( 7)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_6_Counter_Control_WID ( 2)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_6_Counter_Control_MSK (0x00000180)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_6_Counter_Control_MAX (0x00000003)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_6_Counter_Control_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_7_REG (0x00004D0C)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_7_Counter_Pointer_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_7_Counter_Pointer_WID ( 7)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_7_Counter_Pointer_MSK (0x0000007F)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_7_Counter_Pointer_MAX (0x0000007F)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_7_Counter_Pointer_DEF (0x0000007F)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_7_Counter_Control_OFF ( 7)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_7_Counter_Control_WID ( 2)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_7_Counter_Control_MSK (0x00000180)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_7_Counter_Control_MAX (0x00000003)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_7_Counter_Control_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_8_REG (0x00004D10)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_8_Counter_Pointer_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_8_Counter_Pointer_WID ( 7)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_8_Counter_Pointer_MSK (0x0000007F)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_8_Counter_Pointer_MAX (0x0000007F)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_8_Counter_Pointer_DEF (0x0000007F)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_8_Counter_Control_OFF ( 7)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_8_Counter_Control_WID ( 2)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_8_Counter_Control_MSK (0x00000180)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_8_Counter_Control_MAX (0x00000003)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_8_Counter_Control_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_0_REG (0x00004D14)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_0_Counter_Status_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_0_Counter_Status_WID (23)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_0_Counter_Status_MSK (0x007FFFFF)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_0_Counter_Status_MAX (0x007FFFFF)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_0_Counter_Status_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_1_REG (0x00004D18)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_1_Counter_Status_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_1_Counter_Status_WID (23)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_1_Counter_Status_MSK (0x007FFFFF)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_1_Counter_Status_MAX (0x007FFFFF)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_1_Counter_Status_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_2_REG (0x00004D1C)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_2_Counter_Status_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_2_Counter_Status_WID (23)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_2_Counter_Status_MSK (0x007FFFFF)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_2_Counter_Status_MAX (0x007FFFFF)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_2_Counter_Status_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_3_REG (0x00004D20)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_3_Counter_Status_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_3_Counter_Status_WID (23)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_3_Counter_Status_MSK (0x007FFFFF)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_3_Counter_Status_MAX (0x007FFFFF)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_3_Counter_Status_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_4_REG (0x00004D24)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_4_Counter_Status_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_4_Counter_Status_WID (23)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_4_Counter_Status_MSK (0x007FFFFF)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_4_Counter_Status_MAX (0x007FFFFF)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_4_Counter_Status_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_5_REG (0x00004D28)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_5_Counter_Status_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_5_Counter_Status_WID (23)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_5_Counter_Status_MSK (0x007FFFFF)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_5_Counter_Status_MAX (0x007FFFFF)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_5_Counter_Status_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_6_REG (0x00004D2C)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_6_Counter_Status_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_6_Counter_Status_WID (23)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_6_Counter_Status_MSK (0x007FFFFF)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_6_Counter_Status_MAX (0x007FFFFF)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_6_Counter_Status_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_7_REG (0x00004D30)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_7_Counter_Status_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_7_Counter_Status_WID (23)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_7_Counter_Status_MSK (0x007FFFFF)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_7_Counter_Status_MAX (0x007FFFFF)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_7_Counter_Status_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_8_REG (0x00004D34)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_8_Counter_Status_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_8_Counter_Status_WID (23)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_8_Counter_Status_MSK (0x007FFFFF)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_8_Counter_Status_MAX (0x007FFFFF)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_STATUS_8_Counter_Status_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_OVERFLOW_STATUS_REG (0x00004D38)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_OVERFLOW_STATUS_Counter_Overflow_Status_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_OVERFLOW_STATUS_Counter_Overflow_Status_WID ( 9)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_OVERFLOW_STATUS_Counter_Overflow_Status_MSK (0x000001FF)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_OVERFLOW_STATUS_Counter_Overflow_Status_MAX (0x000001FF)
+ #define MCSCHEDS_CR_REUT_CH_ERR_COUNTER_OVERFLOW_STATUS_Counter_Overflow_Status_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_ERROR_ADDR_REG (0x00004D80)
+ #define MCSCHEDS_CR_REUT_CH_ERROR_ADDR_Column_Address_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_ERROR_ADDR_Column_Address_WID (10)
+ #define MCSCHEDS_CR_REUT_CH_ERROR_ADDR_Column_Address_MSK (0x000003FF)
+ #define MCSCHEDS_CR_REUT_CH_ERROR_ADDR_Column_Address_MAX (0x000003FF)
+ #define MCSCHEDS_CR_REUT_CH_ERROR_ADDR_Column_Address_DEF (0x00000000)
+ #define MCSCHEDS_CR_REUT_CH_ERROR_ADDR_Row_Address_OFF (24)
+ #define MCSCHEDS_CR_REUT_CH_ERROR_ADDR_Row_Address_WID (16)
+ #define MCSCHEDS_CR_REUT_CH_ERROR_ADDR_Row_Address_MSK (0xFFFF000000)
+ #define MCSCHEDS_CR_REUT_CH_ERROR_ADDR_Row_Address_MAX (0x0000FFFF)
+ #define MCSCHEDS_CR_REUT_CH_ERROR_ADDR_Row_Address_DEF (0x00000000)
+ #define MCSCHEDS_CR_REUT_CH_ERROR_ADDR_Bank_Address_OFF (48)
+ #define MCSCHEDS_CR_REUT_CH_ERROR_ADDR_Bank_Address_WID ( 3)
+ #define MCSCHEDS_CR_REUT_CH_ERROR_ADDR_Bank_Address_MSK (0x7000000000000)
+ #define MCSCHEDS_CR_REUT_CH_ERROR_ADDR_Bank_Address_MAX (0x00000007)
+ #define MCSCHEDS_CR_REUT_CH_ERROR_ADDR_Bank_Address_DEF (0x00000000)
+ #define MCSCHEDS_CR_REUT_CH_ERROR_ADDR_Rank_Address_OFF (56)
+ #define MCSCHEDS_CR_REUT_CH_ERROR_ADDR_Rank_Address_WID ( 2)
+ #define MCSCHEDS_CR_REUT_CH_ERROR_ADDR_Rank_Address_MSK (0x300000000000000)
+ #define MCSCHEDS_CR_REUT_CH_ERROR_ADDR_Rank_Address_MAX (0x00000003)
+ #define MCSCHEDS_CR_REUT_CH_ERROR_ADDR_Rank_Address_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_ERR_WDB_CAPTURE_STATUS_REG (0x00004D88)
+ #define MCSCHEDS_CR_REUT_CH_ERR_WDB_CAPTURE_STATUS_WDB_Current_Error_Pointer_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_ERR_WDB_CAPTURE_STATUS_WDB_Current_Error_Pointer_WID ( 6)
+ #define MCSCHEDS_CR_REUT_CH_ERR_WDB_CAPTURE_STATUS_WDB_Current_Error_Pointer_MSK (0x0000003F)
+ #define MCSCHEDS_CR_REUT_CH_ERR_WDB_CAPTURE_STATUS_WDB_Current_Error_Pointer_MAX (0x0000003F)
+ #define MCSCHEDS_CR_REUT_CH_ERR_WDB_CAPTURE_STATUS_WDB_Current_Error_Pointer_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_REG (0x00004D8C)
+ #define MCSCHEDS_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_Enable_WDB_Error_Capture_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_Enable_WDB_Error_Capture_WID ( 1)
+ #define MCSCHEDS_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_Enable_WDB_Error_Capture_MSK (0x00000001)
+ #define MCSCHEDS_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_Enable_WDB_Error_Capture_MAX (0x00000001)
+ #define MCSCHEDS_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_Enable_WDB_Error_Capture_DEF (0x00000000)
+ #define MCSCHEDS_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_WDB_Starting_Error_Pointer_OFF ( 8)
+ #define MCSCHEDS_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_WDB_Starting_Error_Pointer_WID ( 6)
+ #define MCSCHEDS_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_WDB_Starting_Error_Pointer_MSK (0x00003F00)
+ #define MCSCHEDS_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_WDB_Starting_Error_Pointer_MAX (0x0000003F)
+ #define MCSCHEDS_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_WDB_Starting_Error_Pointer_DEF (0x00000000)
+ #define MCSCHEDS_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_WDB_Ending_Error_Pointer_OFF (16)
+ #define MCSCHEDS_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_WDB_Ending_Error_Pointer_WID ( 6)
+ #define MCSCHEDS_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_WDB_Ending_Error_Pointer_MSK (0x003F0000)
+ #define MCSCHEDS_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_WDB_Ending_Error_Pointer_MAX (0x0000003F)
+ #define MCSCHEDS_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_WDB_Ending_Error_Pointer_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_MISC_CKE_CTRL_REG (0x00004D90)
+ #define MCSCHEDS_CR_REUT_CH_MISC_CKE_CTRL_CKE_Override_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_MISC_CKE_CTRL_CKE_Override_WID ( 4)
+ #define MCSCHEDS_CR_REUT_CH_MISC_CKE_CTRL_CKE_Override_MSK (0x0000000F)
+ #define MCSCHEDS_CR_REUT_CH_MISC_CKE_CTRL_CKE_Override_MAX (0x0000000F)
+ #define MCSCHEDS_CR_REUT_CH_MISC_CKE_CTRL_CKE_Override_DEF (0x0000000F)
+ #define MCSCHEDS_CR_REUT_CH_MISC_CKE_CTRL_CKE_En_Start_Test_Sync_OFF ( 8)
+ #define MCSCHEDS_CR_REUT_CH_MISC_CKE_CTRL_CKE_En_Start_Test_Sync_WID ( 1)
+ #define MCSCHEDS_CR_REUT_CH_MISC_CKE_CTRL_CKE_En_Start_Test_Sync_MSK (0x00000100)
+ #define MCSCHEDS_CR_REUT_CH_MISC_CKE_CTRL_CKE_En_Start_Test_Sync_MAX (0x00000001)
+ #define MCSCHEDS_CR_REUT_CH_MISC_CKE_CTRL_CKE_En_Start_Test_Sync_DEF (0x00000000)
+ #define MCSCHEDS_CR_REUT_CH_MISC_CKE_CTRL_CKE_On_OFF (16)
+ #define MCSCHEDS_CR_REUT_CH_MISC_CKE_CTRL_CKE_On_WID ( 4)
+ #define MCSCHEDS_CR_REUT_CH_MISC_CKE_CTRL_CKE_On_MSK (0x000F0000)
+ #define MCSCHEDS_CR_REUT_CH_MISC_CKE_CTRL_CKE_On_MAX (0x0000000F)
+ #define MCSCHEDS_CR_REUT_CH_MISC_CKE_CTRL_CKE_On_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_MISC_ODT_CTRL_REG (0x00004D94)
+ #define MCSCHEDS_CR_REUT_CH_MISC_ODT_CTRL_ODT_Override_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_MISC_ODT_CTRL_ODT_Override_WID ( 4)
+ #define MCSCHEDS_CR_REUT_CH_MISC_ODT_CTRL_ODT_Override_MSK (0x0000000F)
+ #define MCSCHEDS_CR_REUT_CH_MISC_ODT_CTRL_ODT_Override_MAX (0x0000000F)
+ #define MCSCHEDS_CR_REUT_CH_MISC_ODT_CTRL_ODT_Override_DEF (0x0000000F)
+ #define MCSCHEDS_CR_REUT_CH_MISC_ODT_CTRL_ODT_On_OFF (16)
+ #define MCSCHEDS_CR_REUT_CH_MISC_ODT_CTRL_ODT_On_WID ( 4)
+ #define MCSCHEDS_CR_REUT_CH_MISC_ODT_CTRL_ODT_On_MSK (0x000F0000)
+ #define MCSCHEDS_CR_REUT_CH_MISC_ODT_CTRL_ODT_On_MAX (0x0000000F)
+ #define MCSCHEDS_CR_REUT_CH_MISC_ODT_CTRL_ODT_On_DEF (0x00000000)
+ #define MCSCHEDS_CR_REUT_CH_MISC_ODT_CTRL_MPR_Train_DDR_On_OFF (31)
+ #define MCSCHEDS_CR_REUT_CH_MISC_ODT_CTRL_MPR_Train_DDR_On_WID ( 1)
+ #define MCSCHEDS_CR_REUT_CH_MISC_ODT_CTRL_MPR_Train_DDR_On_MSK (0x80000000)
+ #define MCSCHEDS_CR_REUT_CH_MISC_ODT_CTRL_MPR_Train_DDR_On_MAX (0x00000001)
+ #define MCSCHEDS_CR_REUT_CH_MISC_ODT_CTRL_MPR_Train_DDR_On_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_REG (0x00004D98)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_Enable_CADB_on_Deselect_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_Enable_CADB_on_Deselect_WID ( 1)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_Enable_CADB_on_Deselect_MSK (0x00000001)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_Enable_CADB_on_Deselect_MAX (0x00000001)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_Enable_CADB_on_Deselect_DEF (0x00000000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_Enable_CADB_Always_On_OFF ( 1)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_Enable_CADB_Always_On_WID ( 1)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_Enable_CADB_Always_On_MSK (0x00000002)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_Enable_CADB_Always_On_MAX (0x00000001)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_Enable_CADB_Always_On_DEF (0x00000000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_CMD_Deselect_Start_OFF ( 2)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_CMD_Deselect_Start_WID ( 4)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_CMD_Deselect_Start_MSK (0x0000003C)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_CMD_Deselect_Start_MAX (0x0000000F)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_CMD_Deselect_Start_DEF (0x00000000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_CMD_Deselect_Stop_OFF ( 6)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_CMD_Deselect_Stop_WID ( 4)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_CMD_Deselect_Stop_MSK (0x000003C0)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_CMD_Deselect_Stop_MAX (0x0000000F)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_CMD_Deselect_Stop_DEF (0x00000000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_Lane_Deselect_Enable_OFF ( 10)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_Lane_Deselect_Enable_WID ( 4)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_Lane_Deselect_Enable_MSK (0x00003C00)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_Lane_Deselect_Enable_MAX (0x0000000F)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_Lane_Deselect_Enable_DEF (0x00000000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_CAS_Select_Enable_OFF ( 14)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_CAS_Select_Enable_WID ( 2)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_CAS_Select_Enable_MSK (0x0000C000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_CAS_Select_Enable_MAX (0x00000003)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_CAS_Select_Enable_DEF (0x00000000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_ACT_Select_Enable_OFF ( 16)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_ACT_Select_Enable_WID ( 2)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_ACT_Select_Enable_MSK (0x00030000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_ACT_Select_Enable_MAX (0x00000003)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_ACT_Select_Enable_DEF (0x00000000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_PRE_Select_Enable_OFF ( 18)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_PRE_Select_Enable_WID ( 2)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_PRE_Select_Enable_MSK (0x000C0000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_PRE_Select_Enable_MAX (0x00000003)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_PRE_Select_Enable_DEF (0x00000000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_Save_Current_Seed_OFF ( 20)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_Save_Current_Seed_WID ( 4)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_Save_Current_Seed_MSK (0x00F00000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_Save_Current_Seed_MAX (0x0000000F)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_Save_Current_Seed_DEF (0x00000000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_Reload_Starting_Seed_OFF ( 24)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_Reload_Starting_Seed_WID ( 4)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_Reload_Starting_Seed_MSK (0x0F000000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_Reload_Starting_Seed_MAX (0x0000000F)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_Reload_Starting_Seed_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_PAT_CADB_MRS_REG (0x00004D9C)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MRS_MRS_Gap_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MRS_MRS_Gap_WID ( 3)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MRS_MRS_Gap_MSK (0x00000007)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MRS_MRS_Gap_MAX (0x00000007)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MRS_MRS_Gap_DEF (0x00000002)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_Start_Pointer_OFF ( 8)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_Start_Pointer_WID ( 3)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_Start_Pointer_MSK (0x00000700)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_Start_Pointer_MAX (0x00000007)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_Start_Pointer_DEF (0x00000000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_End_Pointer_OFF (16)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_End_Pointer_WID ( 3)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_End_Pointer_MSK (0x00070000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_End_Pointer_MAX (0x00000007)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_End_Pointer_DEF (0x00000007)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_Current_Pointer_OFF (24)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_Current_Pointer_WID ( 3)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_Current_Pointer_MSK (0x07000000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_Current_Pointer_MAX (0x00000007)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_Current_Pointer_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_CTRL_REG (0x00004DA0)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux0_Control_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux0_Control_WID ( 2)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux0_Control_MSK (0x00000003)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux0_Control_MAX (0x00000003)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux0_Control_DEF (0x00000001)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux1_Control_OFF ( 4)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux1_Control_WID ( 2)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux1_Control_MSK (0x00000030)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux1_Control_MAX (0x00000003)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux1_Control_DEF (0x00000001)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux2_Control_OFF ( 8)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux2_Control_WID ( 2)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux2_Control_MSK (0x00000300)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux2_Control_MAX (0x00000003)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux2_Control_DEF (0x00000001)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux0_Control_OFF ( 16)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux0_Control_WID ( 2)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux0_Control_MSK (0x00030000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux0_Control_MAX (0x00000003)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux0_Control_DEF (0x00000001)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux1_Control_OFF ( 20)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux1_Control_WID ( 2)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux1_Control_MSK (0x00300000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux1_Control_MAX (0x00000003)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux1_Control_DEF (0x00000001)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux2_Control_OFF ( 24)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux2_Control_WID ( 2)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux2_Control_MSK (0x03000000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux2_Control_MAX (0x00000003)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux2_Control_DEF (0x00000001)
+
+#define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_PB_0_REG (0x00004DA4)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_PB_0_Pattern_Buffer_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_PB_0_Pattern_Buffer_WID (16)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_PB_0_Pattern_Buffer_MSK (0x0000FFFF)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_PB_0_Pattern_Buffer_MAX (0x0000FFFF)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_PB_0_Pattern_Buffer_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_PB_1_REG (0x00004DA8)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_PB_1_Pattern_Buffer_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_PB_1_Pattern_Buffer_WID (16)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_PB_1_Pattern_Buffer_MSK (0x0000FFFF)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_PB_1_Pattern_Buffer_MAX (0x0000FFFF)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_PB_1_Pattern_Buffer_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_PB_2_REG (0x00004DAC)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_PB_2_Pattern_Buffer_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_PB_2_Pattern_Buffer_WID (16)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_PB_2_Pattern_Buffer_MSK (0x0000FFFF)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_PB_2_Pattern_Buffer_MAX (0x0000FFFF)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_MUX_PB_2_Pattern_Buffer_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_REG (0x00004DB0)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_L_data_select_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_L_data_select_WID ( 1)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_L_data_select_MSK (0x00000001)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_L_data_select_MAX (0x00000001)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_L_data_select_DEF (0x00000000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_Enable_Sweep_Frequency_OFF ( 1)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_Enable_Sweep_Frequency_WID ( 1)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_Enable_Sweep_Frequency_MSK (0x00000002)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_Enable_Sweep_Frequency_MAX (0x00000001)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_Enable_Sweep_Frequency_DEF (0x00000000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_L_counter_OFF ( 8)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_L_counter_WID ( 8)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_L_counter_MSK (0x0000FF00)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_L_counter_MAX (0x000000FF)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_L_counter_DEF (0x00000001)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_M_counter_OFF (16)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_M_counter_WID ( 8)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_M_counter_MSK (0x00FF0000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_M_counter_MAX (0x000000FF)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_M_counter_DEF (0x00000001)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_N_counter_OFF (24)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_N_counter_WID ( 8)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_N_counter_MSK (0xFF000000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_N_counter_MAX (0x000000FF)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_N_counter_DEF (0x00000001)
+
+#define MCSCHEDS_CR_REUT_CH_PAT_CADB_WRITE_POINTER_REG (0x00004DBC)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_WRITE_POINTER_CADB_Write_Pointer_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_WRITE_POINTER_CADB_Write_Pointer_WID ( 3)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_WRITE_POINTER_CADB_Write_Pointer_MSK (0x00000007)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_WRITE_POINTER_CADB_Write_Pointer_MAX (0x00000007)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_WRITE_POINTER_CADB_Write_Pointer_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_PAT_CADB_PROG_REG (0x00004DC0)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Address_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Address_WID (16)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Address_MSK (0x0000FFFF)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Address_MAX (0x0000FFFF)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Address_DEF (0x00000000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Bank_OFF (24)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Bank_WID ( 3)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Bank_MSK (0x07000000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Bank_MAX (0x00000007)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Bank_DEF (0x00000000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_CS_OFF (32)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_CS_WID ( 4)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_CS_MSK (0xF00000000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_CS_MAX (0x0000000F)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_CS_DEF (0x00000000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Control_OFF (40)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Control_WID ( 3)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Control_MSK (0x70000000000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Control_MAX (0x00000007)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Control_DEF (0x00000000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_ODT_OFF (48)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_ODT_WID ( 4)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_ODT_MSK (0xF000000000000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_ODT_MAX (0x0000000F)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_ODT_DEF (0x00000000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_CKE_OFF (56)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_CKE_WID ( 4)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_CKE_MSK (0xF00000000000000)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_CKE_MAX (0x0000000F)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_CKE_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_0_REG (0x00004DC8)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_0_Pattern_Buffer_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_0_Pattern_Buffer_WID (16)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_0_Pattern_Buffer_MSK (0x0000FFFF)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_0_Pattern_Buffer_MAX (0x0000FFFF)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_0_Pattern_Buffer_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_1_REG (0x00004DCC)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_1_Pattern_Buffer_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_1_Pattern_Buffer_WID (16)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_1_Pattern_Buffer_MSK (0x0000FFFF)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_1_Pattern_Buffer_MAX (0x0000FFFF)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_1_Pattern_Buffer_DEF (0x00000000)
+
+#define MCSCHEDS_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_2_REG (0x00004DD0)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_2_Pattern_Buffer_OFF ( 0)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_2_Pattern_Buffer_WID (16)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_2_Pattern_Buffer_MSK (0x0000FFFF)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_2_Pattern_Buffer_MAX (0x0000FFFF)
+ #define MCSCHEDS_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_2_Pattern_Buffer_DEF (0x00000000)
+
+#define MCMNTS_CR_REUT_CH_PAT_WDB_CL_CTRL_REG (0x00004E00)
+ #define MCMNTS_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Increment_Rate_OFF ( 0)
+ #define MCMNTS_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Increment_Rate_WID ( 5)
+ #define MCMNTS_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Increment_Rate_MSK (0x0000001F)
+ #define MCMNTS_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Increment_Rate_MAX (0x0000001F)
+ #define MCMNTS_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Increment_Rate_DEF (0x00000000)
+ #define MCMNTS_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Increment_Scale_OFF ( 5)
+ #define MCMNTS_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Increment_Scale_WID ( 1)
+ #define MCMNTS_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Increment_Scale_MSK (0x00000020)
+ #define MCMNTS_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Increment_Scale_MAX (0x00000001)
+ #define MCMNTS_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Increment_Scale_DEF (0x00000000)
+ #define MCMNTS_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Start_Pointer_OFF ( 8)
+ #define MCMNTS_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Start_Pointer_WID ( 6)
+ #define MCMNTS_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Start_Pointer_MSK (0x00003F00)
+ #define MCMNTS_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Start_Pointer_MAX (0x0000003F)
+ #define MCMNTS_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Start_Pointer_DEF (0x00000000)
+ #define MCMNTS_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_End_Pointer_OFF (16)
+ #define MCMNTS_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_End_Pointer_WID ( 6)
+ #define MCMNTS_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_End_Pointer_MSK (0x003F0000)
+ #define MCMNTS_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_End_Pointer_MAX (0x0000003F)
+ #define MCMNTS_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_End_Pointer_DEF (0x0000003F)
+
+#define MCMNTS_CR_REUT_CH_MISC_REFRESH_CTRL_REG (0x00004E04)
+ #define MCMNTS_CR_REUT_CH_MISC_REFRESH_CTRL_Refresh_Rank_Mask_OFF ( 0)
+ #define MCMNTS_CR_REUT_CH_MISC_REFRESH_CTRL_Refresh_Rank_Mask_WID ( 4)
+ #define MCMNTS_CR_REUT_CH_MISC_REFRESH_CTRL_Refresh_Rank_Mask_MSK (0x0000000F)
+ #define MCMNTS_CR_REUT_CH_MISC_REFRESH_CTRL_Refresh_Rank_Mask_MAX (0x0000000F)
+ #define MCMNTS_CR_REUT_CH_MISC_REFRESH_CTRL_Refresh_Rank_Mask_DEF (0x00000000)
+ #define MCMNTS_CR_REUT_CH_MISC_REFRESH_CTRL_RefZQ_En_Start_Test_Sync_OFF ( 8)
+ #define MCMNTS_CR_REUT_CH_MISC_REFRESH_CTRL_RefZQ_En_Start_Test_Sync_WID ( 1)
+ #define MCMNTS_CR_REUT_CH_MISC_REFRESH_CTRL_RefZQ_En_Start_Test_Sync_MSK (0x00000100)
+ #define MCMNTS_CR_REUT_CH_MISC_REFRESH_CTRL_RefZQ_En_Start_Test_Sync_MAX (0x00000001)
+ #define MCMNTS_CR_REUT_CH_MISC_REFRESH_CTRL_RefZQ_En_Start_Test_Sync_DEF (0x00000000)
+ #define MCMNTS_CR_REUT_CH_MISC_REFRESH_CTRL_Panic_Refresh_Only_OFF (31)
+ #define MCMNTS_CR_REUT_CH_MISC_REFRESH_CTRL_Panic_Refresh_Only_WID ( 1)
+ #define MCMNTS_CR_REUT_CH_MISC_REFRESH_CTRL_Panic_Refresh_Only_MSK (0x80000000)
+ #define MCMNTS_CR_REUT_CH_MISC_REFRESH_CTRL_Panic_Refresh_Only_MAX (0x00000001)
+ #define MCMNTS_CR_REUT_CH_MISC_REFRESH_CTRL_Panic_Refresh_Only_DEF (0x00000000)
+
+#define MCMNTS_CR_REUT_CH_MISC_ZQ_CTRL_REG (0x00004E08)
+ #define MCMNTS_CR_REUT_CH_MISC_ZQ_CTRL_ZQ_Rank_Mask_OFF ( 0)
+ #define MCMNTS_CR_REUT_CH_MISC_ZQ_CTRL_ZQ_Rank_Mask_WID ( 4)
+ #define MCMNTS_CR_REUT_CH_MISC_ZQ_CTRL_ZQ_Rank_Mask_MSK (0x0000000F)
+ #define MCMNTS_CR_REUT_CH_MISC_ZQ_CTRL_ZQ_Rank_Mask_MAX (0x0000000F)
+ #define MCMNTS_CR_REUT_CH_MISC_ZQ_CTRL_ZQ_Rank_Mask_DEF (0x00000000)
+ #define MCMNTS_CR_REUT_CH_MISC_ZQ_CTRL_Always_Do_ZQ_OFF (31)
+ #define MCMNTS_CR_REUT_CH_MISC_ZQ_CTRL_Always_Do_ZQ_WID ( 1)
+ #define MCMNTS_CR_REUT_CH_MISC_ZQ_CTRL_Always_Do_ZQ_MSK (0x80000000)
+ #define MCMNTS_CR_REUT_CH_MISC_ZQ_CTRL_Always_Do_ZQ_MAX (0x00000001)
+ #define MCMNTS_CR_REUT_CH_MISC_ZQ_CTRL_Always_Do_ZQ_DEF (0x00000000)
+
+#define MCMNTS_CR_LPDDR_MR_PARAMS_REG (0x00004E10)
+ #define MCMNTS_CR_LPDDR_MR_PARAMS_Rank_0_x32_OFF ( 0)
+ #define MCMNTS_CR_LPDDR_MR_PARAMS_Rank_0_x32_WID ( 1)
+ #define MCMNTS_CR_LPDDR_MR_PARAMS_Rank_0_x32_MSK (0x00000001)
+ #define MCMNTS_CR_LPDDR_MR_PARAMS_Rank_0_x32_MAX (0x00000001)
+ #define MCMNTS_CR_LPDDR_MR_PARAMS_Rank_0_x32_DEF (0x00000000)
+ #define MCMNTS_CR_LPDDR_MR_PARAMS_Rank_1_x32_OFF ( 1)
+ #define MCMNTS_CR_LPDDR_MR_PARAMS_Rank_1_x32_WID ( 1)
+ #define MCMNTS_CR_LPDDR_MR_PARAMS_Rank_1_x32_MSK (0x00000002)
+ #define MCMNTS_CR_LPDDR_MR_PARAMS_Rank_1_x32_MAX (0x00000001)
+ #define MCMNTS_CR_LPDDR_MR_PARAMS_Rank_1_x32_DEF (0x00000000)
+ #define MCMNTS_CR_LPDDR_MR_PARAMS_Rank_2_x32_OFF ( 2)
+ #define MCMNTS_CR_LPDDR_MR_PARAMS_Rank_2_x32_WID ( 1)
+ #define MCMNTS_CR_LPDDR_MR_PARAMS_Rank_2_x32_MSK (0x00000004)
+ #define MCMNTS_CR_LPDDR_MR_PARAMS_Rank_2_x32_MAX (0x00000001)
+ #define MCMNTS_CR_LPDDR_MR_PARAMS_Rank_2_x32_DEF (0x00000000)
+ #define MCMNTS_CR_LPDDR_MR_PARAMS_Rank_3_x32_OFF ( 3)
+ #define MCMNTS_CR_LPDDR_MR_PARAMS_Rank_3_x32_WID ( 1)
+ #define MCMNTS_CR_LPDDR_MR_PARAMS_Rank_3_x32_MSK (0x00000008)
+ #define MCMNTS_CR_LPDDR_MR_PARAMS_Rank_3_x32_MAX (0x00000001)
+ #define MCMNTS_CR_LPDDR_MR_PARAMS_Rank_3_x32_DEF (0x00000000)
+ #define MCMNTS_CR_LPDDR_MR_PARAMS_LPDDR2_OFF ( 4)
+ #define MCMNTS_CR_LPDDR_MR_PARAMS_LPDDR2_WID ( 1)
+ #define MCMNTS_CR_LPDDR_MR_PARAMS_LPDDR2_MSK (0x00000010)
+ #define MCMNTS_CR_LPDDR_MR_PARAMS_LPDDR2_MAX (0x00000001)
+ #define MCMNTS_CR_LPDDR_MR_PARAMS_LPDDR2_DEF (0x00000000)
+ #define MCMNTS_CR_LPDDR_MR_PARAMS_MR4_PERIOD_OFF ( 8)
+ #define MCMNTS_CR_LPDDR_MR_PARAMS_MR4_PERIOD_WID (16)
+ #define MCMNTS_CR_LPDDR_MR_PARAMS_MR4_PERIOD_MSK (0x00FFFF00)
+ #define MCMNTS_CR_LPDDR_MR_PARAMS_MR4_PERIOD_MAX (0x0000FFFF)
+ #define MCMNTS_CR_LPDDR_MR_PARAMS_MR4_PERIOD_DEF (0x00000000)
+
+#define MCMNTS_CR_LPDDR_MR_COMMAND_REG (0x00004E14)
+ #define MCMNTS_CR_LPDDR_MR_COMMAND_Address_OFF ( 0)
+ #define MCMNTS_CR_LPDDR_MR_COMMAND_Address_WID ( 8)
+ #define MCMNTS_CR_LPDDR_MR_COMMAND_Address_MSK (0x000000FF)
+ #define MCMNTS_CR_LPDDR_MR_COMMAND_Address_MAX (0x000000FF)
+ #define MCMNTS_CR_LPDDR_MR_COMMAND_Address_DEF (0x00000000)
+ #define MCMNTS_CR_LPDDR_MR_COMMAND_Data_OFF ( 8)
+ #define MCMNTS_CR_LPDDR_MR_COMMAND_Data_WID ( 8)
+ #define MCMNTS_CR_LPDDR_MR_COMMAND_Data_MSK (0x0000FF00)
+ #define MCMNTS_CR_LPDDR_MR_COMMAND_Data_MAX (0x000000FF)
+ #define MCMNTS_CR_LPDDR_MR_COMMAND_Data_DEF (0x00000000)
+ #define MCMNTS_CR_LPDDR_MR_COMMAND_Rank_OFF (16)
+ #define MCMNTS_CR_LPDDR_MR_COMMAND_Rank_WID ( 2)
+ #define MCMNTS_CR_LPDDR_MR_COMMAND_Rank_MSK (0x00030000)
+ #define MCMNTS_CR_LPDDR_MR_COMMAND_Rank_MAX (0x00000003)
+ #define MCMNTS_CR_LPDDR_MR_COMMAND_Rank_DEF (0x00000000)
+ #define MCMNTS_CR_LPDDR_MR_COMMAND_Write_OFF (18)
+ #define MCMNTS_CR_LPDDR_MR_COMMAND_Write_WID ( 1)
+ #define MCMNTS_CR_LPDDR_MR_COMMAND_Write_MSK (0x00040000)
+ #define MCMNTS_CR_LPDDR_MR_COMMAND_Write_MAX (0x00000001)
+ #define MCMNTS_CR_LPDDR_MR_COMMAND_Write_DEF (0x00000000)
+ #define MCMNTS_CR_LPDDR_MR_COMMAND_Init_MRW_OFF (19)
+ #define MCMNTS_CR_LPDDR_MR_COMMAND_Init_MRW_WID ( 1)
+ #define MCMNTS_CR_LPDDR_MR_COMMAND_Init_MRW_MSK (0x00080000)
+ #define MCMNTS_CR_LPDDR_MR_COMMAND_Init_MRW_MAX (0x00000001)
+ #define MCMNTS_CR_LPDDR_MR_COMMAND_Init_MRW_DEF (0x00000000)
+ #define MCMNTS_CR_LPDDR_MR_COMMAND_Busy_OFF (31)
+ #define MCMNTS_CR_LPDDR_MR_COMMAND_Busy_WID ( 1)
+ #define MCMNTS_CR_LPDDR_MR_COMMAND_Busy_MSK (0x80000000)
+ #define MCMNTS_CR_LPDDR_MR_COMMAND_Busy_MAX (0x00000001)
+ #define MCMNTS_CR_LPDDR_MR_COMMAND_Busy_DEF (0x00000000)
+
+#define MCMNTS_CR_LPDDR_MR_RESULT_REG (0x00004E18)
+ #define MCMNTS_CR_LPDDR_MR_RESULT_Device_0_OFF ( 0)
+ #define MCMNTS_CR_LPDDR_MR_RESULT_Device_0_WID ( 8)
+ #define MCMNTS_CR_LPDDR_MR_RESULT_Device_0_MSK (0x000000FF)
+ #define MCMNTS_CR_LPDDR_MR_RESULT_Device_0_MAX (0x000000FF)
+ #define MCMNTS_CR_LPDDR_MR_RESULT_Device_0_DEF (0x00000000)
+ #define MCMNTS_CR_LPDDR_MR_RESULT_Device_1_OFF ( 8)
+ #define MCMNTS_CR_LPDDR_MR_RESULT_Device_1_WID ( 8)
+ #define MCMNTS_CR_LPDDR_MR_RESULT_Device_1_MSK (0x0000FF00)
+ #define MCMNTS_CR_LPDDR_MR_RESULT_Device_1_MAX (0x000000FF)
+ #define MCMNTS_CR_LPDDR_MR_RESULT_Device_1_DEF (0x00000000)
+ #define MCMNTS_CR_LPDDR_MR_RESULT_Device_2_OFF (16)
+ #define MCMNTS_CR_LPDDR_MR_RESULT_Device_2_WID ( 8)
+ #define MCMNTS_CR_LPDDR_MR_RESULT_Device_2_MSK (0x00FF0000)
+ #define MCMNTS_CR_LPDDR_MR_RESULT_Device_2_MAX (0x000000FF)
+ #define MCMNTS_CR_LPDDR_MR_RESULT_Device_2_DEF (0x00000000)
+ #define MCMNTS_CR_LPDDR_MR_RESULT_Device_3_OFF (24)
+ #define MCMNTS_CR_LPDDR_MR_RESULT_Device_3_WID ( 8)
+ #define MCMNTS_CR_LPDDR_MR_RESULT_Device_3_MSK (0xFF000000)
+ #define MCMNTS_CR_LPDDR_MR_RESULT_Device_3_MAX (0x000000FF)
+ #define MCMNTS_CR_LPDDR_MR_RESULT_Device_3_DEF (0x00000000)
+
+#define MCMNTS_CR_LPDDR_MR4_RANK_TEMPERATURE_REG (0x00004E1C)
+ #define MCMNTS_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_0_OFF ( 0)
+ #define MCMNTS_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_0_WID ( 3)
+ #define MCMNTS_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_0_MSK (0x00000007)
+ #define MCMNTS_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_0_MAX (0x00000007)
+ #define MCMNTS_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_0_DEF (0x00000003)
+ #define MCMNTS_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_1_OFF ( 8)
+ #define MCMNTS_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_1_WID ( 3)
+ #define MCMNTS_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_1_MSK (0x00000700)
+ #define MCMNTS_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_1_MAX (0x00000007)
+ #define MCMNTS_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_1_DEF (0x00000003)
+ #define MCMNTS_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_2_OFF (16)
+ #define MCMNTS_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_2_WID ( 3)
+ #define MCMNTS_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_2_MSK (0x00070000)
+ #define MCMNTS_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_2_MAX (0x00000007)
+ #define MCMNTS_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_2_DEF (0x00000003)
+ #define MCMNTS_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_3_OFF (24)
+ #define MCMNTS_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_3_WID ( 3)
+ #define MCMNTS_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_3_MSK (0x07000000)
+ #define MCMNTS_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_3_MAX (0x00000007)
+ #define MCMNTS_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_3_DEF (0x00000003)
+
+#define MCMNTS_CR_DESWIZZLE_LOW_REG (0x00004E20)
+ #define MCMNTS_CR_DESWIZZLE_LOW_Bit_0_OFF ( 0)
+ #define MCMNTS_CR_DESWIZZLE_LOW_Bit_0_WID ( 3)
+ #define MCMNTS_CR_DESWIZZLE_LOW_Bit_0_MSK (0x00000007)
+ #define MCMNTS_CR_DESWIZZLE_LOW_Bit_0_MAX (0x00000007)
+ #define MCMNTS_CR_DESWIZZLE_LOW_Bit_0_DEF (0x00000000)
+ #define MCMNTS_CR_DESWIZZLE_LOW_Bit_1_OFF ( 4)
+ #define MCMNTS_CR_DESWIZZLE_LOW_Bit_1_WID ( 3)
+ #define MCMNTS_CR_DESWIZZLE_LOW_Bit_1_MSK (0x00000070)
+ #define MCMNTS_CR_DESWIZZLE_LOW_Bit_1_MAX (0x00000007)
+ #define MCMNTS_CR_DESWIZZLE_LOW_Bit_1_DEF (0x00000001)
+ #define MCMNTS_CR_DESWIZZLE_LOW_Bit_2_OFF ( 8)
+ #define MCMNTS_CR_DESWIZZLE_LOW_Bit_2_WID ( 3)
+ #define MCMNTS_CR_DESWIZZLE_LOW_Bit_2_MSK (0x00000700)
+ #define MCMNTS_CR_DESWIZZLE_LOW_Bit_2_MAX (0x00000007)
+ #define MCMNTS_CR_DESWIZZLE_LOW_Bit_2_DEF (0x00000002)
+ #define MCMNTS_CR_DESWIZZLE_LOW_Bit_16_OFF (12)
+ #define MCMNTS_CR_DESWIZZLE_LOW_Bit_16_WID ( 3)
+ #define MCMNTS_CR_DESWIZZLE_LOW_Bit_16_MSK (0x00007000)
+ #define MCMNTS_CR_DESWIZZLE_LOW_Bit_16_MAX (0x00000007)
+ #define MCMNTS_CR_DESWIZZLE_LOW_Bit_16_DEF (0x00000000)
+ #define MCMNTS_CR_DESWIZZLE_LOW_Bit_17_OFF (16)
+ #define MCMNTS_CR_DESWIZZLE_LOW_Bit_17_WID ( 3)
+ #define MCMNTS_CR_DESWIZZLE_LOW_Bit_17_MSK (0x00070000)
+ #define MCMNTS_CR_DESWIZZLE_LOW_Bit_17_MAX (0x00000007)
+ #define MCMNTS_CR_DESWIZZLE_LOW_Bit_17_DEF (0x00000001)
+ #define MCMNTS_CR_DESWIZZLE_LOW_Bit_18_OFF (20)
+ #define MCMNTS_CR_DESWIZZLE_LOW_Bit_18_WID ( 3)
+ #define MCMNTS_CR_DESWIZZLE_LOW_Bit_18_MSK (0x00700000)
+ #define MCMNTS_CR_DESWIZZLE_LOW_Bit_18_MAX (0x00000007)
+ #define MCMNTS_CR_DESWIZZLE_LOW_Bit_18_DEF (0x00000002)
+ #define MCMNTS_CR_DESWIZZLE_LOW_Byte_0_OFF (24)
+ #define MCMNTS_CR_DESWIZZLE_LOW_Byte_0_WID ( 3)
+ #define MCMNTS_CR_DESWIZZLE_LOW_Byte_0_MSK (0x07000000)
+ #define MCMNTS_CR_DESWIZZLE_LOW_Byte_0_MAX (0x00000007)
+ #define MCMNTS_CR_DESWIZZLE_LOW_Byte_0_DEF (0x00000000)
+ #define MCMNTS_CR_DESWIZZLE_LOW_Byte_2_OFF (28)
+ #define MCMNTS_CR_DESWIZZLE_LOW_Byte_2_WID ( 3)
+ #define MCMNTS_CR_DESWIZZLE_LOW_Byte_2_MSK (0x70000000)
+ #define MCMNTS_CR_DESWIZZLE_LOW_Byte_2_MAX (0x00000007)
+ #define MCMNTS_CR_DESWIZZLE_LOW_Byte_2_DEF (0x00000002)
+
+#define MCMNTS_CR_DESWIZZLE_HIGH_REG (0x00004E24)
+ #define MCMNTS_CR_DESWIZZLE_HIGH_Bit_32_OFF ( 0)
+ #define MCMNTS_CR_DESWIZZLE_HIGH_Bit_32_WID ( 3)
+ #define MCMNTS_CR_DESWIZZLE_HIGH_Bit_32_MSK (0x00000007)
+ #define MCMNTS_CR_DESWIZZLE_HIGH_Bit_32_MAX (0x00000007)
+ #define MCMNTS_CR_DESWIZZLE_HIGH_Bit_32_DEF (0x00000000)
+ #define MCMNTS_CR_DESWIZZLE_HIGH_Bit_33_OFF ( 4)
+ #define MCMNTS_CR_DESWIZZLE_HIGH_Bit_33_WID ( 3)
+ #define MCMNTS_CR_DESWIZZLE_HIGH_Bit_33_MSK (0x00000070)
+ #define MCMNTS_CR_DESWIZZLE_HIGH_Bit_33_MAX (0x00000007)
+ #define MCMNTS_CR_DESWIZZLE_HIGH_Bit_33_DEF (0x00000001)
+ #define MCMNTS_CR_DESWIZZLE_HIGH_Bit_34_OFF ( 8)
+ #define MCMNTS_CR_DESWIZZLE_HIGH_Bit_34_WID ( 3)
+ #define MCMNTS_CR_DESWIZZLE_HIGH_Bit_34_MSK (0x00000700)
+ #define MCMNTS_CR_DESWIZZLE_HIGH_Bit_34_MAX (0x00000007)
+ #define MCMNTS_CR_DESWIZZLE_HIGH_Bit_34_DEF (0x00000002)
+ #define MCMNTS_CR_DESWIZZLE_HIGH_Bit_48_OFF (12)
+ #define MCMNTS_CR_DESWIZZLE_HIGH_Bit_48_WID ( 3)
+ #define MCMNTS_CR_DESWIZZLE_HIGH_Bit_48_MSK (0x00007000)
+ #define MCMNTS_CR_DESWIZZLE_HIGH_Bit_48_MAX (0x00000007)
+ #define MCMNTS_CR_DESWIZZLE_HIGH_Bit_48_DEF (0x00000000)
+ #define MCMNTS_CR_DESWIZZLE_HIGH_Bit_49_OFF (16)
+ #define MCMNTS_CR_DESWIZZLE_HIGH_Bit_49_WID ( 3)
+ #define MCMNTS_CR_DESWIZZLE_HIGH_Bit_49_MSK (0x00070000)
+ #define MCMNTS_CR_DESWIZZLE_HIGH_Bit_49_MAX (0x00000007)
+ #define MCMNTS_CR_DESWIZZLE_HIGH_Bit_49_DEF (0x00000001)
+ #define MCMNTS_CR_DESWIZZLE_HIGH_Bit_50_OFF (20)
+ #define MCMNTS_CR_DESWIZZLE_HIGH_Bit_50_WID ( 3)
+ #define MCMNTS_CR_DESWIZZLE_HIGH_Bit_50_MSK (0x00700000)
+ #define MCMNTS_CR_DESWIZZLE_HIGH_Bit_50_MAX (0x00000007)
+ #define MCMNTS_CR_DESWIZZLE_HIGH_Bit_50_DEF (0x00000002)
+ #define MCMNTS_CR_DESWIZZLE_HIGH_Byte_4_OFF (24)
+ #define MCMNTS_CR_DESWIZZLE_HIGH_Byte_4_WID ( 3)
+ #define MCMNTS_CR_DESWIZZLE_HIGH_Byte_4_MSK (0x07000000)
+ #define MCMNTS_CR_DESWIZZLE_HIGH_Byte_4_MAX (0x00000007)
+ #define MCMNTS_CR_DESWIZZLE_HIGH_Byte_4_DEF (0x00000004)
+ #define MCMNTS_CR_DESWIZZLE_HIGH_Byte_6_OFF (28)
+ #define MCMNTS_CR_DESWIZZLE_HIGH_Byte_6_WID ( 3)
+ #define MCMNTS_CR_DESWIZZLE_HIGH_Byte_6_MSK (0x70000000)
+ #define MCMNTS_CR_DESWIZZLE_HIGH_Byte_6_MAX (0x00000007)
+ #define MCMNTS_CR_DESWIZZLE_HIGH_Byte_6_DEF (0x00000006)
+
+#define MCMNTS_CR_MC_REFRESH_STAGGER_REG (0x00004E8C)
+ #define MCMNTS_CR_MC_REFRESH_STAGGER_Ref_Interval_OFF ( 0)
+ #define MCMNTS_CR_MC_REFRESH_STAGGER_Ref_Interval_WID (11)
+ #define MCMNTS_CR_MC_REFRESH_STAGGER_Ref_Interval_MSK (0x000007FF)
+ #define MCMNTS_CR_MC_REFRESH_STAGGER_Ref_Interval_MAX (0x000007FF)
+ #define MCMNTS_CR_MC_REFRESH_STAGGER_Ref_Interval_DEF (0x00000000)
+ #define MCMNTS_CR_MC_REFRESH_STAGGER_Ref_Stagger_En_OFF (11)
+ #define MCMNTS_CR_MC_REFRESH_STAGGER_Ref_Stagger_En_WID ( 1)
+ #define MCMNTS_CR_MC_REFRESH_STAGGER_Ref_Stagger_En_MSK (0x00000800)
+ #define MCMNTS_CR_MC_REFRESH_STAGGER_Ref_Stagger_En_MAX (0x00000001)
+ #define MCMNTS_CR_MC_REFRESH_STAGGER_Ref_Stagger_En_DEF (0x00000000)
+ #define MCMNTS_CR_MC_REFRESH_STAGGER_Ref_Stagger_Mode_OFF (12)
+ #define MCMNTS_CR_MC_REFRESH_STAGGER_Ref_Stagger_Mode_WID ( 1)
+ #define MCMNTS_CR_MC_REFRESH_STAGGER_Ref_Stagger_Mode_MSK (0x00001000)
+ #define MCMNTS_CR_MC_REFRESH_STAGGER_Ref_Stagger_Mode_MAX (0x00000001)
+ #define MCMNTS_CR_MC_REFRESH_STAGGER_Ref_Stagger_Mode_DEF (0x00000000)
+ #define MCMNTS_CR_MC_REFRESH_STAGGER_Disable_Stolen_Refresh_OFF (13)
+ #define MCMNTS_CR_MC_REFRESH_STAGGER_Disable_Stolen_Refresh_WID ( 1)
+ #define MCMNTS_CR_MC_REFRESH_STAGGER_Disable_Stolen_Refresh_MSK (0x00002000)
+ #define MCMNTS_CR_MC_REFRESH_STAGGER_Disable_Stolen_Refresh_MAX (0x00000001)
+ #define MCMNTS_CR_MC_REFRESH_STAGGER_Disable_Stolen_Refresh_DEF (0x00000000)
+ #define MCMNTS_CR_MC_REFRESH_STAGGER_En_Ref_Type_Display_OFF (14)
+ #define MCMNTS_CR_MC_REFRESH_STAGGER_En_Ref_Type_Display_WID ( 1)
+ #define MCMNTS_CR_MC_REFRESH_STAGGER_En_Ref_Type_Display_MSK (0x00004000)
+ #define MCMNTS_CR_MC_REFRESH_STAGGER_En_Ref_Type_Display_MAX (0x00000001)
+ #define MCMNTS_CR_MC_REFRESH_STAGGER_En_Ref_Type_Display_DEF (0x00000000)
+
+#define MCMNTS_CR_TC_ZQCAL_REG (0x00004E90)
+ #define MCMNTS_CR_TC_ZQCAL_ZQCS_period_OFF ( 0)
+ #define MCMNTS_CR_TC_ZQCAL_ZQCS_period_WID ( 8)
+ #define MCMNTS_CR_TC_ZQCAL_ZQCS_period_MSK (0x000000FF)
+ #define MCMNTS_CR_TC_ZQCAL_ZQCS_period_MAX (0x000000FF)
+ #define MCMNTS_CR_TC_ZQCAL_ZQCS_period_DEF (0x00000080)
+ #define MCMNTS_CR_TC_ZQCAL_tZQCS_OFF ( 8)
+ #define MCMNTS_CR_TC_ZQCAL_tZQCS_WID ( 8)
+ #define MCMNTS_CR_TC_ZQCAL_tZQCS_MSK (0x0000FF00)
+ #define MCMNTS_CR_TC_ZQCAL_tZQCS_MAX (0x000000FF)
+ #define MCMNTS_CR_TC_ZQCAL_tZQCS_DEF (0x00000040)
+ #define MCMNTS_CR_TC_ZQCAL_ZQCS_period_Ult_OFF ( 0)
+ #define MCMNTS_CR_TC_ZQCAL_ZQCS_period_Ult_WID (10)
+ #define MCMNTS_CR_TC_ZQCAL_ZQCS_period_Ult_MSK (0x000003FF)
+ #define MCMNTS_CR_TC_ZQCAL_ZQCS_period_Ult_MAX (0x000003FF)
+ #define MCMNTS_CR_TC_ZQCAL_ZQCS_period_Ult_DEF (0x00000080)
+ #define MCMNTS_CR_TC_ZQCAL_tZQCS_Ult_OFF (10)
+ #define MCMNTS_CR_TC_ZQCAL_tZQCS_Ult_WID (10)
+ #define MCMNTS_CR_TC_ZQCAL_tZQCS_Ult_MSK (0x000FFC00)
+ #define MCMNTS_CR_TC_ZQCAL_tZQCS_Ult_MAX (0x000003FF)
+ #define MCMNTS_CR_TC_ZQCAL_tZQCS_Ult_DEF (0x00000040)
+
+#define MCMNTS_CR_TC_RFP_REG (0x00004E94)
+ #define MCMNTS_CR_TC_RFP_OREF_RI_OFF ( 0)
+ #define MCMNTS_CR_TC_RFP_OREF_RI_WID ( 8)
+ #define MCMNTS_CR_TC_RFP_OREF_RI_MSK (0x000000FF)
+ #define MCMNTS_CR_TC_RFP_OREF_RI_MAX (0x000000FF)
+ #define MCMNTS_CR_TC_RFP_OREF_RI_DEF (0x0000000F)
+ #define MCMNTS_CR_TC_RFP_Refresh_HP_WM_OFF ( 8)
+ #define MCMNTS_CR_TC_RFP_Refresh_HP_WM_WID ( 4)
+ #define MCMNTS_CR_TC_RFP_Refresh_HP_WM_MSK (0x00000F00)
+ #define MCMNTS_CR_TC_RFP_Refresh_HP_WM_MAX (0x0000000F)
+ #define MCMNTS_CR_TC_RFP_Refresh_HP_WM_DEF (0x00000008)
+ #define MCMNTS_CR_TC_RFP_Refresh_panic_wm_OFF (12)
+ #define MCMNTS_CR_TC_RFP_Refresh_panic_wm_WID ( 4)
+ #define MCMNTS_CR_TC_RFP_Refresh_panic_wm_MSK (0x0000F000)
+ #define MCMNTS_CR_TC_RFP_Refresh_panic_wm_MAX (0x0000000F)
+ #define MCMNTS_CR_TC_RFP_Refresh_panic_wm_DEF (0x00000009)
+
+#define MCMNTS_CR_TC_RFTP_REG (0x00004E98)
+ #define MCMNTS_CR_TC_RFTP_tREFI_OFF ( 0)
+ #define MCMNTS_CR_TC_RFTP_tREFI_WID (16)
+ #define MCMNTS_CR_TC_RFTP_tREFI_MSK (0x0000FFFF)
+ #define MCMNTS_CR_TC_RFTP_tREFI_MAX (0x0000FFFF)
+ #define MCMNTS_CR_TC_RFTP_tREFI_DEF (0x00001004)
+ #define MCMNTS_CR_TC_RFTP_tRFC_OFF (16)
+ #define MCMNTS_CR_TC_RFTP_tRFC_WID ( 9)
+ #define MCMNTS_CR_TC_RFTP_tRFC_MSK (0x01FF0000)
+ #define MCMNTS_CR_TC_RFTP_tRFC_MAX (0x000001FF)
+ #define MCMNTS_CR_TC_RFTP_tRFC_DEF (0x000000B4)
+ #define MCMNTS_CR_TC_RFTP_tREFIx9_OFF (25)
+ #define MCMNTS_CR_TC_RFTP_tREFIx9_WID ( 7)
+ #define MCMNTS_CR_TC_RFTP_tREFIx9_MSK (0xFE000000)
+ #define MCMNTS_CR_TC_RFTP_tREFIx9_MAX (0x0000007F)
+ #define MCMNTS_CR_TC_RFTP_tREFIx9_DEF (0x00000023)
+
+#define MCMNTS_CR_TC_MR2_SHADDOW_REG (0x00004E9C)
+ #define MCMNTS_CR_TC_MR2_SHADDOW_MR2_sh_low_OFF ( 0)
+ #define MCMNTS_CR_TC_MR2_SHADDOW_MR2_sh_low_WID ( 6)
+ #define MCMNTS_CR_TC_MR2_SHADDOW_MR2_sh_low_MSK (0x0000003F)
+ #define MCMNTS_CR_TC_MR2_SHADDOW_MR2_sh_low_MAX (0x0000003F)
+ #define MCMNTS_CR_TC_MR2_SHADDOW_MR2_sh_low_DEF (0x00000000)
+ #define MCMNTS_CR_TC_MR2_SHADDOW_SRT_avail_OFF ( 6)
+ #define MCMNTS_CR_TC_MR2_SHADDOW_SRT_avail_WID ( 2)
+ #define MCMNTS_CR_TC_MR2_SHADDOW_SRT_avail_MSK (0x000000C0)
+ #define MCMNTS_CR_TC_MR2_SHADDOW_SRT_avail_MAX (0x00000003)
+ #define MCMNTS_CR_TC_MR2_SHADDOW_SRT_avail_DEF (0x00000000)
+ #define MCMNTS_CR_TC_MR2_SHADDOW_MR2_sh_high_OFF ( 8)
+ #define MCMNTS_CR_TC_MR2_SHADDOW_MR2_sh_high_WID ( 3)
+ #define MCMNTS_CR_TC_MR2_SHADDOW_MR2_sh_high_MSK (0x00000700)
+ #define MCMNTS_CR_TC_MR2_SHADDOW_MR2_sh_high_MAX (0x00000007)
+ #define MCMNTS_CR_TC_MR2_SHADDOW_MR2_sh_high_DEF (0x00000000)
+ #define MCMNTS_CR_TC_MR2_SHADDOW_Addr_bit_swizzle_OFF (14)
+ #define MCMNTS_CR_TC_MR2_SHADDOW_Addr_bit_swizzle_WID ( 2)
+ #define MCMNTS_CR_TC_MR2_SHADDOW_Addr_bit_swizzle_MSK (0x0000C000)
+ #define MCMNTS_CR_TC_MR2_SHADDOW_Addr_bit_swizzle_MAX (0x00000003)
+ #define MCMNTS_CR_TC_MR2_SHADDOW_Addr_bit_swizzle_DEF (0x00000000)
+
+#define MCMNTS_CR_MC_INIT_STATE_REG (0x00004EA0)
+ #define MCMNTS_CR_MC_INIT_STATE_Rank_occupancy_OFF ( 0)
+ #define MCMNTS_CR_MC_INIT_STATE_Rank_occupancy_WID ( 4)
+ #define MCMNTS_CR_MC_INIT_STATE_Rank_occupancy_MSK (0x0000000F)
+ #define MCMNTS_CR_MC_INIT_STATE_Rank_occupancy_MAX (0x0000000F)
+ #define MCMNTS_CR_MC_INIT_STATE_Rank_occupancy_DEF (0x0000000F)
+
+#define MCMNTS_CR_TC_SRFTP_REG (0x00004EA4)
+ #define MCMNTS_CR_TC_SRFTP_tXSDLL_OFF ( 0)
+ #define MCMNTS_CR_TC_SRFTP_tXSDLL_WID (12)
+ #define MCMNTS_CR_TC_SRFTP_tXSDLL_MSK (0x00000FFF)
+ #define MCMNTS_CR_TC_SRFTP_tXSDLL_MAX (0x00000FFF)
+ #define MCMNTS_CR_TC_SRFTP_tXSDLL_DEF (0x00000200)
+ #define MCMNTS_CR_TC_SRFTP_tXS_offset_OFF (12)
+ #define MCMNTS_CR_TC_SRFTP_tXS_offset_WID ( 4)
+ #define MCMNTS_CR_TC_SRFTP_tXS_offset_MSK (0x0000F000)
+ #define MCMNTS_CR_TC_SRFTP_tXS_offset_MAX (0x0000000F)
+ #define MCMNTS_CR_TC_SRFTP_tXS_offset_DEF (0x0000000B)
+ #define MCMNTS_CR_TC_SRFTP_tZQOPER_OFF (16)
+ #define MCMNTS_CR_TC_SRFTP_tZQOPER_WID (10)
+ #define MCMNTS_CR_TC_SRFTP_tZQOPER_MSK (0x03FF0000)
+ #define MCMNTS_CR_TC_SRFTP_tZQOPER_MAX (0x000003FF)
+ #define MCMNTS_CR_TC_SRFTP_tZQOPER_DEF (0x00000100)
+ #define MCMNTS_CR_TC_SRFTP_tMOD_OFF (28)
+ #define MCMNTS_CR_TC_SRFTP_tMOD_WID ( 4)
+ #define MCMNTS_CR_TC_SRFTP_tMOD_MSK (0xF0000000)
+ #define MCMNTS_CR_TC_SRFTP_tMOD_MAX (0x0000000F)
+ #define MCMNTS_CR_TC_SRFTP_tMOD_DEF (0x00000000)
+
+#define MCMNTS_CR_WDB_VISA_SEL_REG (0x00004EA8)
+ #define MCMNTS_CR_WDB_VISA_SEL_VISAByteSel_OFF ( 0)
+ #define MCMNTS_CR_WDB_VISA_SEL_VISAByteSel_WID ( 3)
+ #define MCMNTS_CR_WDB_VISA_SEL_VISAByteSel_MSK (0x00000007)
+ #define MCMNTS_CR_WDB_VISA_SEL_VISAByteSel_MAX (0x00000007)
+ #define MCMNTS_CR_WDB_VISA_SEL_VISAByteSel_DEF (0x00000000)
+
+#define MCMNTS_CR_DCLK_LDAT_PDAT_REG (0x00004EC0)
+ #define MCMNTS_CR_DCLK_LDAT_PDAT_FASTADDR_OFF ( 0)
+ #define MCMNTS_CR_DCLK_LDAT_PDAT_FASTADDR_WID (12)
+ #define MCMNTS_CR_DCLK_LDAT_PDAT_FASTADDR_MSK (0x00000FFF)
+ #define MCMNTS_CR_DCLK_LDAT_PDAT_FASTADDR_MAX (0x00000FFF)
+ #define MCMNTS_CR_DCLK_LDAT_PDAT_FASTADDR_DEF (0x00000000)
+ #define MCMNTS_CR_DCLK_LDAT_PDAT_ADDREN_OFF (16)
+ #define MCMNTS_CR_DCLK_LDAT_PDAT_ADDREN_WID ( 1)
+ #define MCMNTS_CR_DCLK_LDAT_PDAT_ADDREN_MSK (0x00010000)
+ #define MCMNTS_CR_DCLK_LDAT_PDAT_ADDREN_MAX (0x00000001)
+ #define MCMNTS_CR_DCLK_LDAT_PDAT_ADDREN_DEF (0x00000000)
+ #define MCMNTS_CR_DCLK_LDAT_PDAT_SEQEN_OFF (17)
+ #define MCMNTS_CR_DCLK_LDAT_PDAT_SEQEN_WID ( 1)
+ #define MCMNTS_CR_DCLK_LDAT_PDAT_SEQEN_MSK (0x00020000)
+ #define MCMNTS_CR_DCLK_LDAT_PDAT_SEQEN_MAX (0x00000001)
+ #define MCMNTS_CR_DCLK_LDAT_PDAT_SEQEN_DEF (0x00000000)
+ #define MCMNTS_CR_DCLK_LDAT_PDAT_POL0_OFF (18)
+ #define MCMNTS_CR_DCLK_LDAT_PDAT_POL0_WID ( 1)
+ #define MCMNTS_CR_DCLK_LDAT_PDAT_POL0_MSK (0x00040000)
+ #define MCMNTS_CR_DCLK_LDAT_PDAT_POL0_MAX (0x00000001)
+ #define MCMNTS_CR_DCLK_LDAT_PDAT_POL0_DEF (0x00000000)
+ #define MCMNTS_CR_DCLK_LDAT_PDAT_POL1_OFF (19)
+ #define MCMNTS_CR_DCLK_LDAT_PDAT_POL1_WID ( 1)
+ #define MCMNTS_CR_DCLK_LDAT_PDAT_POL1_MSK (0x00080000)
+ #define MCMNTS_CR_DCLK_LDAT_PDAT_POL1_MAX (0x00000001)
+ #define MCMNTS_CR_DCLK_LDAT_PDAT_POL1_DEF (0x00000000)
+ #define MCMNTS_CR_DCLK_LDAT_PDAT_CMDA_OFF (20)
+ #define MCMNTS_CR_DCLK_LDAT_PDAT_CMDA_WID ( 4)
+ #define MCMNTS_CR_DCLK_LDAT_PDAT_CMDA_MSK (0x00F00000)
+ #define MCMNTS_CR_DCLK_LDAT_PDAT_CMDA_MAX (0x0000000F)
+ #define MCMNTS_CR_DCLK_LDAT_PDAT_CMDA_DEF (0x00000000)
+ #define MCMNTS_CR_DCLK_LDAT_PDAT_CMDB_OFF (24)
+ #define MCMNTS_CR_DCLK_LDAT_PDAT_CMDB_WID ( 4)
+ #define MCMNTS_CR_DCLK_LDAT_PDAT_CMDB_MSK (0x0F000000)
+ #define MCMNTS_CR_DCLK_LDAT_PDAT_CMDB_MAX (0x0000000F)
+ #define MCMNTS_CR_DCLK_LDAT_PDAT_CMDB_DEF (0x00000000)
+ #define MCMNTS_CR_DCLK_LDAT_PDAT_CMDC_OFF (28)
+ #define MCMNTS_CR_DCLK_LDAT_PDAT_CMDC_WID ( 4)
+ #define MCMNTS_CR_DCLK_LDAT_PDAT_CMDC_MSK (0xF0000000)
+ #define MCMNTS_CR_DCLK_LDAT_PDAT_CMDC_MAX (0x0000000F)
+ #define MCMNTS_CR_DCLK_LDAT_PDAT_CMDC_DEF (0x00000000)
+
+#define MCMNTS_CR_DCLK_LDAT_SDAT_REG (0x00004EC4)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_BANKSEL_OFF ( 0)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_BANKSEL_WID ( 4)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_BANKSEL_MSK (0x0000000F)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_BANKSEL_MAX (0x0000000F)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_BANKSEL_DEF (0x00000000)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_ARRAYSEL_OFF ( 5)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_ARRAYSEL_WID ( 5)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_ARRAYSEL_MSK (0x000003E0)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_ARRAYSEL_MAX (0x0000001F)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_ARRAYSEL_DEF (0x00000000)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_CMP_OFF (10)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_CMP_WID ( 1)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_CMP_MSK (0x00000400)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_CMP_MAX (0x00000001)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_CMP_DEF (0x00000000)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_REP_OFF (11)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_REP_WID ( 1)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_REP_MSK (0x00000800)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_REP_MAX (0x00000001)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_REP_DEF (0x00000000)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_DWORD_OFF (12)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_DWORD_WID ( 4)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_DWORD_MSK (0x0000F000)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_DWORD_MAX (0x0000000F)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_DWORD_DEF (0x00000000)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_MODE_OFF (16)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_MODE_WID ( 2)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_MODE_MSK (0x00030000)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_MODE_MAX (0x00000003)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_MODE_DEF (0x00000000)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_MPMAP_OFF (18)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_MPMAP_WID ( 6)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_MPMAP_MSK (0x00FC0000)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_MPMAP_MAX (0x0000003F)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_MPMAP_DEF (0x00000000)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_MPBOFFSET_OFF (24)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_MPBOFFSET_WID ( 4)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_MPBOFFSET_MSK (0x0F000000)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_MPBOFFSET_MAX (0x0000000F)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_MPBOFFSET_DEF (0x00000000)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_STAGE_EN_OFF (28)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_STAGE_EN_WID ( 1)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_STAGE_EN_MSK (0x10000000)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_STAGE_EN_MAX (0x00000001)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_STAGE_EN_DEF (0x00000000)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_SHADOW_OFF (29)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_SHADOW_WID ( 2)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_SHADOW_MSK (0x60000000)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_SHADOW_MAX (0x00000003)
+ #define MCMNTS_CR_DCLK_LDAT_SDAT_SHADOW_DEF (0x00000000)
+
+#define MCMNTS_CR_DCLK_LDAT_DATAOUT_REG (0x00004EC8)
+ #define MCMNTS_CR_DCLK_LDAT_DATAOUT_DATOUT_OFF ( 0)
+ #define MCMNTS_CR_DCLK_LDAT_DATAOUT_DATOUT_WID (32)
+ #define MCMNTS_CR_DCLK_LDAT_DATAOUT_DATOUT_MSK (0xFFFFFFFF)
+ #define MCMNTS_CR_DCLK_LDAT_DATAOUT_DATOUT_MAX (0xFFFFFFFF)
+ #define MCMNTS_CR_DCLK_LDAT_DATAOUT_DATOUT_DEF (0x00000000)
+
+#define MCMNTS_CR_DCLK_LDAT_DATAIN_0_REG (0x00004ECC)
+ #define MCMNTS_CR_DCLK_LDAT_DATAIN_0_DATIN_OFF ( 0)
+ #define MCMNTS_CR_DCLK_LDAT_DATAIN_0_DATIN_WID (32)
+ #define MCMNTS_CR_DCLK_LDAT_DATAIN_0_DATIN_MSK (0xFFFFFFFF)
+ #define MCMNTS_CR_DCLK_LDAT_DATAIN_0_DATIN_MAX (0xFFFFFFFF)
+ #define MCMNTS_CR_DCLK_LDAT_DATAIN_0_DATIN_DEF (0x00000000)
+
+#define MCMNTS_CR_QCLK_LDAT_PDAT_REG (0x00004ED0)
+ #define MCMNTS_CR_QCLK_LDAT_PDAT_FASTADDR_OFF ( 0)
+ #define MCMNTS_CR_QCLK_LDAT_PDAT_FASTADDR_WID (12)
+ #define MCMNTS_CR_QCLK_LDAT_PDAT_FASTADDR_MSK (0x00000FFF)
+ #define MCMNTS_CR_QCLK_LDAT_PDAT_FASTADDR_MAX (0x00000FFF)
+ #define MCMNTS_CR_QCLK_LDAT_PDAT_FASTADDR_DEF (0x00000000)
+ #define MCMNTS_CR_QCLK_LDAT_PDAT_ADDREN_OFF (16)
+ #define MCMNTS_CR_QCLK_LDAT_PDAT_ADDREN_WID ( 1)
+ #define MCMNTS_CR_QCLK_LDAT_PDAT_ADDREN_MSK (0x00010000)
+ #define MCMNTS_CR_QCLK_LDAT_PDAT_ADDREN_MAX (0x00000001)
+ #define MCMNTS_CR_QCLK_LDAT_PDAT_ADDREN_DEF (0x00000000)
+ #define MCMNTS_CR_QCLK_LDAT_PDAT_SEQEN_OFF (17)
+ #define MCMNTS_CR_QCLK_LDAT_PDAT_SEQEN_WID ( 1)
+ #define MCMNTS_CR_QCLK_LDAT_PDAT_SEQEN_MSK (0x00020000)
+ #define MCMNTS_CR_QCLK_LDAT_PDAT_SEQEN_MAX (0x00000001)
+ #define MCMNTS_CR_QCLK_LDAT_PDAT_SEQEN_DEF (0x00000000)
+ #define MCMNTS_CR_QCLK_LDAT_PDAT_POL0_OFF (18)
+ #define MCMNTS_CR_QCLK_LDAT_PDAT_POL0_WID ( 1)
+ #define MCMNTS_CR_QCLK_LDAT_PDAT_POL0_MSK (0x00040000)
+ #define MCMNTS_CR_QCLK_LDAT_PDAT_POL0_MAX (0x00000001)
+ #define MCMNTS_CR_QCLK_LDAT_PDAT_POL0_DEF (0x00000000)
+ #define MCMNTS_CR_QCLK_LDAT_PDAT_POL1_OFF (19)
+ #define MCMNTS_CR_QCLK_LDAT_PDAT_POL1_WID ( 1)
+ #define MCMNTS_CR_QCLK_LDAT_PDAT_POL1_MSK (0x00080000)
+ #define MCMNTS_CR_QCLK_LDAT_PDAT_POL1_MAX (0x00000001)
+ #define MCMNTS_CR_QCLK_LDAT_PDAT_POL1_DEF (0x00000000)
+ #define MCMNTS_CR_QCLK_LDAT_PDAT_CMDA_OFF (20)
+ #define MCMNTS_CR_QCLK_LDAT_PDAT_CMDA_WID ( 4)
+ #define MCMNTS_CR_QCLK_LDAT_PDAT_CMDA_MSK (0x00F00000)
+ #define MCMNTS_CR_QCLK_LDAT_PDAT_CMDA_MAX (0x0000000F)
+ #define MCMNTS_CR_QCLK_LDAT_PDAT_CMDA_DEF (0x00000000)
+ #define MCMNTS_CR_QCLK_LDAT_PDAT_CMDB_OFF (24)
+ #define MCMNTS_CR_QCLK_LDAT_PDAT_CMDB_WID ( 4)
+ #define MCMNTS_CR_QCLK_LDAT_PDAT_CMDB_MSK (0x0F000000)
+ #define MCMNTS_CR_QCLK_LDAT_PDAT_CMDB_MAX (0x0000000F)
+ #define MCMNTS_CR_QCLK_LDAT_PDAT_CMDB_DEF (0x00000000)
+ #define MCMNTS_CR_QCLK_LDAT_PDAT_CMDC_OFF (28)
+ #define MCMNTS_CR_QCLK_LDAT_PDAT_CMDC_WID ( 4)
+ #define MCMNTS_CR_QCLK_LDAT_PDAT_CMDC_MSK (0xF0000000)
+ #define MCMNTS_CR_QCLK_LDAT_PDAT_CMDC_MAX (0x0000000F)
+ #define MCMNTS_CR_QCLK_LDAT_PDAT_CMDC_DEF (0x00000000)
+
+#define MCMNTS_CR_QCLK_LDAT_SDAT_REG (0x00004ED4)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_BANKSEL_OFF ( 0)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_BANKSEL_WID ( 4)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_BANKSEL_MSK (0x0000000F)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_BANKSEL_MAX (0x0000000F)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_BANKSEL_DEF (0x00000000)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_ARRAYSEL_OFF ( 5)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_ARRAYSEL_WID ( 5)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_ARRAYSEL_MSK (0x000003E0)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_ARRAYSEL_MAX (0x0000001F)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_ARRAYSEL_DEF (0x00000000)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_CMP_OFF (10)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_CMP_WID ( 1)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_CMP_MSK (0x00000400)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_CMP_MAX (0x00000001)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_CMP_DEF (0x00000000)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_REP_OFF (11)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_REP_WID ( 1)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_REP_MSK (0x00000800)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_REP_MAX (0x00000001)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_REP_DEF (0x00000000)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_DWORD_OFF (12)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_DWORD_WID ( 4)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_DWORD_MSK (0x0000F000)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_DWORD_MAX (0x0000000F)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_DWORD_DEF (0x00000000)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_MODE_OFF (16)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_MODE_WID ( 2)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_MODE_MSK (0x00030000)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_MODE_MAX (0x00000003)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_MODE_DEF (0x00000000)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_MPMAP_OFF (18)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_MPMAP_WID ( 6)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_MPMAP_MSK (0x00FC0000)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_MPMAP_MAX (0x0000003F)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_MPMAP_DEF (0x00000000)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_MPBOFFSET_OFF (24)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_MPBOFFSET_WID ( 4)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_MPBOFFSET_MSK (0x0F000000)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_MPBOFFSET_MAX (0x0000000F)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_MPBOFFSET_DEF (0x00000000)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_STAGE_EN_OFF (28)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_STAGE_EN_WID ( 1)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_STAGE_EN_MSK (0x10000000)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_STAGE_EN_MAX (0x00000001)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_STAGE_EN_DEF (0x00000000)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_SHADOW_OFF (29)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_SHADOW_WID ( 2)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_SHADOW_MSK (0x60000000)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_SHADOW_MAX (0x00000003)
+ #define MCMNTS_CR_QCLK_LDAT_SDAT_SHADOW_DEF (0x00000000)
+
+#define MCMNTS_CR_QCLK_LDAT_DATAOUT_REG (0x00004ED8)
+ #define MCMNTS_CR_QCLK_LDAT_DATAOUT_DATOUT_OFF ( 0)
+ #define MCMNTS_CR_QCLK_LDAT_DATAOUT_DATOUT_WID (32)
+ #define MCMNTS_CR_QCLK_LDAT_DATAOUT_DATOUT_MSK (0xFFFFFFFF)
+ #define MCMNTS_CR_QCLK_LDAT_DATAOUT_DATOUT_MAX (0xFFFFFFFF)
+ #define MCMNTS_CR_QCLK_LDAT_DATAOUT_DATOUT_DEF (0x00000000)
+
+#define MCMNTS_CR_QCLK_LDAT_DATAIN_0_REG (0x00004EDC)
+ #define MCMNTS_CR_QCLK_LDAT_DATAIN_0_DATIN_OFF ( 0)
+ #define MCMNTS_CR_QCLK_LDAT_DATAIN_0_DATIN_WID (32)
+ #define MCMNTS_CR_QCLK_LDAT_DATAIN_0_DATIN_MSK (0xFFFFFFFF)
+ #define MCMNTS_CR_QCLK_LDAT_DATAIN_0_DATIN_MAX (0xFFFFFFFF)
+ #define MCMNTS_CR_QCLK_LDAT_DATAIN_0_DATIN_DEF (0x00000000)
+
+#define MCMNTS_CR_QCLK_LDAT_DATAIN_1_REG (0x00004EE0)
+ #define MCMNTS_CR_QCLK_LDAT_DATAIN_1_DATIN_OFF ( 0)
+ #define MCMNTS_CR_QCLK_LDAT_DATAIN_1_DATIN_WID (32)
+ #define MCMNTS_CR_QCLK_LDAT_DATAIN_1_DATIN_MSK (0xFFFFFFFF)
+ #define MCMNTS_CR_QCLK_LDAT_DATAIN_1_DATIN_MAX (0xFFFFFFFF)
+ #define MCMNTS_CR_QCLK_LDAT_DATAIN_1_DATIN_DEF (0x00000000)
+
+#define MCMNTS_CR_QUEUE_ENTRY_DISABLE_RPQ_REG (0x00004EE4)
+ #define MCMNTS_CR_QUEUE_ENTRY_DISABLE_RPQ_RPQ_disable_OFF ( 0)
+ #define MCMNTS_CR_QUEUE_ENTRY_DISABLE_RPQ_RPQ_disable_WID (28)
+ #define MCMNTS_CR_QUEUE_ENTRY_DISABLE_RPQ_RPQ_disable_MSK (0x0FFFFFFF)
+ #define MCMNTS_CR_QUEUE_ENTRY_DISABLE_RPQ_RPQ_disable_MAX (0x0FFFFFFF)
+ #define MCMNTS_CR_QUEUE_ENTRY_DISABLE_RPQ_RPQ_disable_DEF (0x00000000)
+
+#define MCMNTS_CR_QUEUE_ENTRY_DISABLE_WPQ_REG (0x00004EE8)
+ #define MCMNTS_CR_QUEUE_ENTRY_DISABLE_WPQ_WPQ_disable_OFF ( 0)
+ #define MCMNTS_CR_QUEUE_ENTRY_DISABLE_WPQ_WPQ_disable_WID (32)
+ #define MCMNTS_CR_QUEUE_ENTRY_DISABLE_WPQ_WPQ_disable_MSK (0xFFFFFFFF)
+ #define MCMNTS_CR_QUEUE_ENTRY_DISABLE_WPQ_WPQ_disable_MAX (0xFFFFFFFF)
+ #define MCMNTS_CR_QUEUE_ENTRY_DISABLE_WPQ_WPQ_disable_DEF (0x00000000)
+
+#define MCMNTS_CR_PM_DIMM_IDLE_ENERGY_REG (0x00004EEC)
+ #define MCMNTS_CR_PM_DIMM_IDLE_ENERGY_DIMM0_IDLE_ENERGY_OFF ( 0)
+ #define MCMNTS_CR_PM_DIMM_IDLE_ENERGY_DIMM0_IDLE_ENERGY_WID ( 6)
+ #define MCMNTS_CR_PM_DIMM_IDLE_ENERGY_DIMM0_IDLE_ENERGY_MSK (0x0000003F)
+ #define MCMNTS_CR_PM_DIMM_IDLE_ENERGY_DIMM0_IDLE_ENERGY_MAX (0x0000003F)
+ #define MCMNTS_CR_PM_DIMM_IDLE_ENERGY_DIMM0_IDLE_ENERGY_DEF (0x00000000)
+ #define MCMNTS_CR_PM_DIMM_IDLE_ENERGY_DIMM1_IDLE_ENERGY_OFF ( 8)
+ #define MCMNTS_CR_PM_DIMM_IDLE_ENERGY_DIMM1_IDLE_ENERGY_WID ( 6)
+ #define MCMNTS_CR_PM_DIMM_IDLE_ENERGY_DIMM1_IDLE_ENERGY_MSK (0x00003F00)
+ #define MCMNTS_CR_PM_DIMM_IDLE_ENERGY_DIMM1_IDLE_ENERGY_MAX (0x0000003F)
+ #define MCMNTS_CR_PM_DIMM_IDLE_ENERGY_DIMM1_IDLE_ENERGY_DEF (0x00000000)
+
+#define MCMNTS_CR_PM_DIMM_PD_ENERGY_REG (0x00004EF0)
+ #define MCMNTS_CR_PM_DIMM_PD_ENERGY_DIMM0_PD_ENERGY_OFF ( 0)
+ #define MCMNTS_CR_PM_DIMM_PD_ENERGY_DIMM0_PD_ENERGY_WID ( 6)
+ #define MCMNTS_CR_PM_DIMM_PD_ENERGY_DIMM0_PD_ENERGY_MSK (0x0000003F)
+ #define MCMNTS_CR_PM_DIMM_PD_ENERGY_DIMM0_PD_ENERGY_MAX (0x0000003F)
+ #define MCMNTS_CR_PM_DIMM_PD_ENERGY_DIMM0_PD_ENERGY_DEF (0x00000000)
+ #define MCMNTS_CR_PM_DIMM_PD_ENERGY_DIMM1_PD_ENERGY_OFF ( 8)
+ #define MCMNTS_CR_PM_DIMM_PD_ENERGY_DIMM1_PD_ENERGY_WID ( 6)
+ #define MCMNTS_CR_PM_DIMM_PD_ENERGY_DIMM1_PD_ENERGY_MSK (0x00003F00)
+ #define MCMNTS_CR_PM_DIMM_PD_ENERGY_DIMM1_PD_ENERGY_MAX (0x0000003F)
+ #define MCMNTS_CR_PM_DIMM_PD_ENERGY_DIMM1_PD_ENERGY_DEF (0x00000000)
+
+#define MCMNTS_CR_PM_DIMM_ACT_ENERGY_REG (0x00004EF4)
+ #define MCMNTS_CR_PM_DIMM_ACT_ENERGY_DIMM0_ACT_ENERGY_OFF ( 0)
+ #define MCMNTS_CR_PM_DIMM_ACT_ENERGY_DIMM0_ACT_ENERGY_WID ( 8)
+ #define MCMNTS_CR_PM_DIMM_ACT_ENERGY_DIMM0_ACT_ENERGY_MSK (0x000000FF)
+ #define MCMNTS_CR_PM_DIMM_ACT_ENERGY_DIMM0_ACT_ENERGY_MAX (0x000000FF)
+ #define MCMNTS_CR_PM_DIMM_ACT_ENERGY_DIMM0_ACT_ENERGY_DEF (0x00000000)
+ #define MCMNTS_CR_PM_DIMM_ACT_ENERGY_DIMM1_ACT_ENERGY_OFF ( 8)
+ #define MCMNTS_CR_PM_DIMM_ACT_ENERGY_DIMM1_ACT_ENERGY_WID ( 8)
+ #define MCMNTS_CR_PM_DIMM_ACT_ENERGY_DIMM1_ACT_ENERGY_MSK (0x0000FF00)
+ #define MCMNTS_CR_PM_DIMM_ACT_ENERGY_DIMM1_ACT_ENERGY_MAX (0x000000FF)
+ #define MCMNTS_CR_PM_DIMM_ACT_ENERGY_DIMM1_ACT_ENERGY_DEF (0x00000000)
+
+#define MCMNTS_CR_PM_DIMM_RD_ENERGY_REG (0x00004EF8)
+ #define MCMNTS_CR_PM_DIMM_RD_ENERGY_DIMM0_RD_ENERGY_OFF ( 0)
+ #define MCMNTS_CR_PM_DIMM_RD_ENERGY_DIMM0_RD_ENERGY_WID ( 8)
+ #define MCMNTS_CR_PM_DIMM_RD_ENERGY_DIMM0_RD_ENERGY_MSK (0x000000FF)
+ #define MCMNTS_CR_PM_DIMM_RD_ENERGY_DIMM0_RD_ENERGY_MAX (0x000000FF)
+ #define MCMNTS_CR_PM_DIMM_RD_ENERGY_DIMM0_RD_ENERGY_DEF (0x00000000)
+ #define MCMNTS_CR_PM_DIMM_RD_ENERGY_DIMM1_RD_ENERGY_OFF ( 8)
+ #define MCMNTS_CR_PM_DIMM_RD_ENERGY_DIMM1_RD_ENERGY_WID ( 8)
+ #define MCMNTS_CR_PM_DIMM_RD_ENERGY_DIMM1_RD_ENERGY_MSK (0x0000FF00)
+ #define MCMNTS_CR_PM_DIMM_RD_ENERGY_DIMM1_RD_ENERGY_MAX (0x000000FF)
+ #define MCMNTS_CR_PM_DIMM_RD_ENERGY_DIMM1_RD_ENERGY_DEF (0x00000000)
+
+#define MCMNTS_CR_PM_DIMM_WR_ENERGY_REG (0x00004EFC)
+ #define MCMNTS_CR_PM_DIMM_WR_ENERGY_DIMM0_WR_ENERGY_OFF ( 0)
+ #define MCMNTS_CR_PM_DIMM_WR_ENERGY_DIMM0_WR_ENERGY_WID ( 8)
+ #define MCMNTS_CR_PM_DIMM_WR_ENERGY_DIMM0_WR_ENERGY_MSK (0x000000FF)
+ #define MCMNTS_CR_PM_DIMM_WR_ENERGY_DIMM0_WR_ENERGY_MAX (0x000000FF)
+ #define MCMNTS_CR_PM_DIMM_WR_ENERGY_DIMM0_WR_ENERGY_DEF (0x00000000)
+ #define MCMNTS_CR_PM_DIMM_WR_ENERGY_DIMM1_WR_ENERGY_OFF ( 8)
+ #define MCMNTS_CR_PM_DIMM_WR_ENERGY_DIMM1_WR_ENERGY_WID ( 8)
+ #define MCMNTS_CR_PM_DIMM_WR_ENERGY_DIMM1_WR_ENERGY_MSK (0x0000FF00)
+ #define MCMNTS_CR_PM_DIMM_WR_ENERGY_DIMM1_WR_ENERGY_MAX (0x000000FF)
+ #define MCMNTS_CR_PM_DIMM_WR_ENERGY_DIMM1_WR_ENERGY_DEF (0x00000000)
+
+#define MCMNTS_CR_PM_THRT_CKE_MIN_REG (0x00004F28)
+ #define MCMNTS_CR_PM_THRT_CKE_MIN_CKE_MIN_OFF ( 0)
+ #define MCMNTS_CR_PM_THRT_CKE_MIN_CKE_MIN_WID ( 8)
+ #define MCMNTS_CR_PM_THRT_CKE_MIN_CKE_MIN_MSK (0x000000FF)
+ #define MCMNTS_CR_PM_THRT_CKE_MIN_CKE_MIN_MAX (0x000000FF)
+ #define MCMNTS_CR_PM_THRT_CKE_MIN_CKE_MIN_DEF (0x00000000)
+ #define MCMNTS_CR_PM_THRT_CKE_MIN_CKE_MIN_DEFEATURE_OFF ( 8)
+ #define MCMNTS_CR_PM_THRT_CKE_MIN_CKE_MIN_DEFEATURE_WID ( 1)
+ #define MCMNTS_CR_PM_THRT_CKE_MIN_CKE_MIN_DEFEATURE_MSK (0x00000100)
+ #define MCMNTS_CR_PM_THRT_CKE_MIN_CKE_MIN_DEFEATURE_MAX (0x00000001)
+ #define MCMNTS_CR_PM_THRT_CKE_MIN_CKE_MIN_DEFEATURE_DEF (0x00000000)
+
+#define MCMNTS_CR_ODLAT_CMD_MATCH0_REG (0x00004F40)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH0_ODT_OFF ( 0)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH0_ODT_WID ( 4)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH0_ODT_MSK (0x0000000F)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH0_ODT_MAX (0x0000000F)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH0_ODT_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH0_Web_OFF ( 4)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH0_Web_WID ( 1)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH0_Web_MSK (0x00000010)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH0_Web_MAX (0x00000001)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH0_Web_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH0_CASb_OFF ( 5)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH0_CASb_WID ( 1)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH0_CASb_MSK (0x00000020)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH0_CASb_MAX (0x00000001)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH0_CASb_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH0_RASb_OFF ( 6)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH0_RASb_WID ( 1)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH0_RASb_MSK (0x00000040)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH0_RASb_MAX (0x00000001)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH0_RASb_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH0_CSb_OFF ( 7)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH0_CSb_WID ( 4)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH0_CSb_MSK (0x00000780)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH0_CSb_MAX (0x0000000F)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH0_CSb_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH0_CKE_OFF (11)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH0_CKE_WID ( 4)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH0_CKE_MSK (0x00007800)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH0_CKE_MAX (0x0000000F)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH0_CKE_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH0_MA_OFF (15)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH0_MA_WID (16)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH0_MA_MSK (0x7FFF8000)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH0_MA_MAX (0x0000FFFF)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH0_MA_DEF (0x00000000)
+
+#define MCMNTS_CR_ODLAT_CMD_MATCH1_REG (0x00004F44)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH1_ODT_OFF ( 0)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH1_ODT_WID ( 4)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH1_ODT_MSK (0x0000000F)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH1_ODT_MAX (0x0000000F)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH1_ODT_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH1_Web_OFF ( 4)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH1_Web_WID ( 1)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH1_Web_MSK (0x00000010)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH1_Web_MAX (0x00000001)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH1_Web_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH1_CASb_OFF ( 5)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH1_CASb_WID ( 1)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH1_CASb_MSK (0x00000020)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH1_CASb_MAX (0x00000001)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH1_CASb_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH1_RASb_OFF ( 6)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH1_RASb_WID ( 1)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH1_RASb_MSK (0x00000040)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH1_RASb_MAX (0x00000001)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH1_RASb_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH1_CSb_OFF ( 7)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH1_CSb_WID ( 4)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH1_CSb_MSK (0x00000780)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH1_CSb_MAX (0x0000000F)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH1_CSb_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH1_CKE_OFF (11)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH1_CKE_WID ( 4)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH1_CKE_MSK (0x00007800)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH1_CKE_MAX (0x0000000F)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH1_CKE_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH1_MA_OFF (15)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH1_MA_WID (16)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH1_MA_MSK (0x7FFF8000)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH1_MA_MAX (0x0000FFFF)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH1_MA_DEF (0x00000000)
+
+#define MCMNTS_CR_ODLAT_CMD_MATCH2_REG (0x00004F48)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH2_ODT_OFF ( 0)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH2_ODT_WID ( 4)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH2_ODT_MSK (0x0000000F)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH2_ODT_MAX (0x0000000F)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH2_ODT_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH2_Web_OFF ( 4)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH2_Web_WID ( 1)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH2_Web_MSK (0x00000010)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH2_Web_MAX (0x00000001)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH2_Web_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH2_CASb_OFF ( 5)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH2_CASb_WID ( 1)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH2_CASb_MSK (0x00000020)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH2_CASb_MAX (0x00000001)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH2_CASb_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH2_RASb_OFF ( 6)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH2_RASb_WID ( 1)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH2_RASb_MSK (0x00000040)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH2_RASb_MAX (0x00000001)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH2_RASb_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH2_CSb_OFF ( 7)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH2_CSb_WID ( 4)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH2_CSb_MSK (0x00000780)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH2_CSb_MAX (0x0000000F)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH2_CSb_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH2_CKE_OFF (11)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH2_CKE_WID ( 4)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH2_CKE_MSK (0x00007800)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH2_CKE_MAX (0x0000000F)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH2_CKE_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH2_MA_OFF (15)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH2_MA_WID (16)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH2_MA_MSK (0x7FFF8000)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH2_MA_MAX (0x0000FFFF)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH2_MA_DEF (0x00000000)
+
+#define MCMNTS_CR_ODLAT_CMD_MATCH3_REG (0x00004F4C)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH3_ODT_OFF ( 0)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH3_ODT_WID ( 4)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH3_ODT_MSK (0x0000000F)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH3_ODT_MAX (0x0000000F)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH3_ODT_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH3_Web_OFF ( 4)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH3_Web_WID ( 1)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH3_Web_MSK (0x00000010)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH3_Web_MAX (0x00000001)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH3_Web_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH3_CASb_OFF ( 5)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH3_CASb_WID ( 1)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH3_CASb_MSK (0x00000020)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH3_CASb_MAX (0x00000001)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH3_CASb_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH3_RASb_OFF ( 6)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH3_RASb_WID ( 1)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH3_RASb_MSK (0x00000040)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH3_RASb_MAX (0x00000001)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH3_RASb_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH3_CSb_OFF ( 7)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH3_CSb_WID ( 4)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH3_CSb_MSK (0x00000780)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH3_CSb_MAX (0x0000000F)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH3_CSb_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH3_CKE_OFF (11)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH3_CKE_WID ( 4)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH3_CKE_MSK (0x00007800)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH3_CKE_MAX (0x0000000F)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH3_CKE_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH3_MA_OFF (15)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH3_MA_WID (16)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH3_MA_MSK (0x7FFF8000)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH3_MA_MAX (0x0000FFFF)
+ #define MCMNTS_CR_ODLAT_CMD_MATCH3_MA_DEF (0x00000000)
+
+#define MCMNTS_CR_ODLAT_CMD_MASK0_REG (0x00004F50)
+ #define MCMNTS_CR_ODLAT_CMD_MASK0_ODT_OFF ( 0)
+ #define MCMNTS_CR_ODLAT_CMD_MASK0_ODT_WID ( 4)
+ #define MCMNTS_CR_ODLAT_CMD_MASK0_ODT_MSK (0x0000000F)
+ #define MCMNTS_CR_ODLAT_CMD_MASK0_ODT_MAX (0x0000000F)
+ #define MCMNTS_CR_ODLAT_CMD_MASK0_ODT_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MASK0_Web_OFF ( 4)
+ #define MCMNTS_CR_ODLAT_CMD_MASK0_Web_WID ( 1)
+ #define MCMNTS_CR_ODLAT_CMD_MASK0_Web_MSK (0x00000010)
+ #define MCMNTS_CR_ODLAT_CMD_MASK0_Web_MAX (0x00000001)
+ #define MCMNTS_CR_ODLAT_CMD_MASK0_Web_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MASK0_CASb_OFF ( 5)
+ #define MCMNTS_CR_ODLAT_CMD_MASK0_CASb_WID ( 1)
+ #define MCMNTS_CR_ODLAT_CMD_MASK0_CASb_MSK (0x00000020)
+ #define MCMNTS_CR_ODLAT_CMD_MASK0_CASb_MAX (0x00000001)
+ #define MCMNTS_CR_ODLAT_CMD_MASK0_CASb_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MASK0_RASb_OFF ( 6)
+ #define MCMNTS_CR_ODLAT_CMD_MASK0_RASb_WID ( 1)
+ #define MCMNTS_CR_ODLAT_CMD_MASK0_RASb_MSK (0x00000040)
+ #define MCMNTS_CR_ODLAT_CMD_MASK0_RASb_MAX (0x00000001)
+ #define MCMNTS_CR_ODLAT_CMD_MASK0_RASb_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MASK0_CSb_OFF ( 7)
+ #define MCMNTS_CR_ODLAT_CMD_MASK0_CSb_WID ( 4)
+ #define MCMNTS_CR_ODLAT_CMD_MASK0_CSb_MSK (0x00000780)
+ #define MCMNTS_CR_ODLAT_CMD_MASK0_CSb_MAX (0x0000000F)
+ #define MCMNTS_CR_ODLAT_CMD_MASK0_CSb_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MASK0_CKE_OFF (11)
+ #define MCMNTS_CR_ODLAT_CMD_MASK0_CKE_WID ( 4)
+ #define MCMNTS_CR_ODLAT_CMD_MASK0_CKE_MSK (0x00007800)
+ #define MCMNTS_CR_ODLAT_CMD_MASK0_CKE_MAX (0x0000000F)
+ #define MCMNTS_CR_ODLAT_CMD_MASK0_CKE_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MASK0_MA_OFF (15)
+ #define MCMNTS_CR_ODLAT_CMD_MASK0_MA_WID (16)
+ #define MCMNTS_CR_ODLAT_CMD_MASK0_MA_MSK (0x7FFF8000)
+ #define MCMNTS_CR_ODLAT_CMD_MASK0_MA_MAX (0x0000FFFF)
+ #define MCMNTS_CR_ODLAT_CMD_MASK0_MA_DEF (0x00000000)
+
+#define MCMNTS_CR_ODLAT_CMD_MASK1_REG (0x00004F54)
+ #define MCMNTS_CR_ODLAT_CMD_MASK1_ODT_OFF ( 0)
+ #define MCMNTS_CR_ODLAT_CMD_MASK1_ODT_WID ( 4)
+ #define MCMNTS_CR_ODLAT_CMD_MASK1_ODT_MSK (0x0000000F)
+ #define MCMNTS_CR_ODLAT_CMD_MASK1_ODT_MAX (0x0000000F)
+ #define MCMNTS_CR_ODLAT_CMD_MASK1_ODT_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MASK1_Web_OFF ( 4)
+ #define MCMNTS_CR_ODLAT_CMD_MASK1_Web_WID ( 1)
+ #define MCMNTS_CR_ODLAT_CMD_MASK1_Web_MSK (0x00000010)
+ #define MCMNTS_CR_ODLAT_CMD_MASK1_Web_MAX (0x00000001)
+ #define MCMNTS_CR_ODLAT_CMD_MASK1_Web_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MASK1_CASb_OFF ( 5)
+ #define MCMNTS_CR_ODLAT_CMD_MASK1_CASb_WID ( 1)
+ #define MCMNTS_CR_ODLAT_CMD_MASK1_CASb_MSK (0x00000020)
+ #define MCMNTS_CR_ODLAT_CMD_MASK1_CASb_MAX (0x00000001)
+ #define MCMNTS_CR_ODLAT_CMD_MASK1_CASb_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MASK1_RASb_OFF ( 6)
+ #define MCMNTS_CR_ODLAT_CMD_MASK1_RASb_WID ( 1)
+ #define MCMNTS_CR_ODLAT_CMD_MASK1_RASb_MSK (0x00000040)
+ #define MCMNTS_CR_ODLAT_CMD_MASK1_RASb_MAX (0x00000001)
+ #define MCMNTS_CR_ODLAT_CMD_MASK1_RASb_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MASK1_CSb_OFF ( 7)
+ #define MCMNTS_CR_ODLAT_CMD_MASK1_CSb_WID ( 4)
+ #define MCMNTS_CR_ODLAT_CMD_MASK1_CSb_MSK (0x00000780)
+ #define MCMNTS_CR_ODLAT_CMD_MASK1_CSb_MAX (0x0000000F)
+ #define MCMNTS_CR_ODLAT_CMD_MASK1_CSb_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MASK1_CKE_OFF (11)
+ #define MCMNTS_CR_ODLAT_CMD_MASK1_CKE_WID ( 4)
+ #define MCMNTS_CR_ODLAT_CMD_MASK1_CKE_MSK (0x00007800)
+ #define MCMNTS_CR_ODLAT_CMD_MASK1_CKE_MAX (0x0000000F)
+ #define MCMNTS_CR_ODLAT_CMD_MASK1_CKE_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MASK1_MA_OFF (15)
+ #define MCMNTS_CR_ODLAT_CMD_MASK1_MA_WID (16)
+ #define MCMNTS_CR_ODLAT_CMD_MASK1_MA_MSK (0x7FFF8000)
+ #define MCMNTS_CR_ODLAT_CMD_MASK1_MA_MAX (0x0000FFFF)
+ #define MCMNTS_CR_ODLAT_CMD_MASK1_MA_DEF (0x00000000)
+
+#define MCMNTS_CR_ODLAT_CMD_MASK2_REG (0x00004F58)
+ #define MCMNTS_CR_ODLAT_CMD_MASK2_ODT_OFF ( 0)
+ #define MCMNTS_CR_ODLAT_CMD_MASK2_ODT_WID ( 4)
+ #define MCMNTS_CR_ODLAT_CMD_MASK2_ODT_MSK (0x0000000F)
+ #define MCMNTS_CR_ODLAT_CMD_MASK2_ODT_MAX (0x0000000F)
+ #define MCMNTS_CR_ODLAT_CMD_MASK2_ODT_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MASK2_Web_OFF ( 4)
+ #define MCMNTS_CR_ODLAT_CMD_MASK2_Web_WID ( 1)
+ #define MCMNTS_CR_ODLAT_CMD_MASK2_Web_MSK (0x00000010)
+ #define MCMNTS_CR_ODLAT_CMD_MASK2_Web_MAX (0x00000001)
+ #define MCMNTS_CR_ODLAT_CMD_MASK2_Web_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MASK2_CASb_OFF ( 5)
+ #define MCMNTS_CR_ODLAT_CMD_MASK2_CASb_WID ( 1)
+ #define MCMNTS_CR_ODLAT_CMD_MASK2_CASb_MSK (0x00000020)
+ #define MCMNTS_CR_ODLAT_CMD_MASK2_CASb_MAX (0x00000001)
+ #define MCMNTS_CR_ODLAT_CMD_MASK2_CASb_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MASK2_RASb_OFF ( 6)
+ #define MCMNTS_CR_ODLAT_CMD_MASK2_RASb_WID ( 1)
+ #define MCMNTS_CR_ODLAT_CMD_MASK2_RASb_MSK (0x00000040)
+ #define MCMNTS_CR_ODLAT_CMD_MASK2_RASb_MAX (0x00000001)
+ #define MCMNTS_CR_ODLAT_CMD_MASK2_RASb_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MASK2_CSb_OFF ( 7)
+ #define MCMNTS_CR_ODLAT_CMD_MASK2_CSb_WID ( 4)
+ #define MCMNTS_CR_ODLAT_CMD_MASK2_CSb_MSK (0x00000780)
+ #define MCMNTS_CR_ODLAT_CMD_MASK2_CSb_MAX (0x0000000F)
+ #define MCMNTS_CR_ODLAT_CMD_MASK2_CSb_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MASK2_CKE_OFF (11)
+ #define MCMNTS_CR_ODLAT_CMD_MASK2_CKE_WID ( 4)
+ #define MCMNTS_CR_ODLAT_CMD_MASK2_CKE_MSK (0x00007800)
+ #define MCMNTS_CR_ODLAT_CMD_MASK2_CKE_MAX (0x0000000F)
+ #define MCMNTS_CR_ODLAT_CMD_MASK2_CKE_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MASK2_MA_OFF (15)
+ #define MCMNTS_CR_ODLAT_CMD_MASK2_MA_WID (16)
+ #define MCMNTS_CR_ODLAT_CMD_MASK2_MA_MSK (0x7FFF8000)
+ #define MCMNTS_CR_ODLAT_CMD_MASK2_MA_MAX (0x0000FFFF)
+ #define MCMNTS_CR_ODLAT_CMD_MASK2_MA_DEF (0x00000000)
+
+#define MCMNTS_CR_ODLAT_CMD_MASK3_REG (0x00004F5C)
+ #define MCMNTS_CR_ODLAT_CMD_MASK3_ODT_OFF ( 0)
+ #define MCMNTS_CR_ODLAT_CMD_MASK3_ODT_WID ( 4)
+ #define MCMNTS_CR_ODLAT_CMD_MASK3_ODT_MSK (0x0000000F)
+ #define MCMNTS_CR_ODLAT_CMD_MASK3_ODT_MAX (0x0000000F)
+ #define MCMNTS_CR_ODLAT_CMD_MASK3_ODT_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MASK3_Web_OFF ( 4)
+ #define MCMNTS_CR_ODLAT_CMD_MASK3_Web_WID ( 1)
+ #define MCMNTS_CR_ODLAT_CMD_MASK3_Web_MSK (0x00000010)
+ #define MCMNTS_CR_ODLAT_CMD_MASK3_Web_MAX (0x00000001)
+ #define MCMNTS_CR_ODLAT_CMD_MASK3_Web_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MASK3_CASb_OFF ( 5)
+ #define MCMNTS_CR_ODLAT_CMD_MASK3_CASb_WID ( 1)
+ #define MCMNTS_CR_ODLAT_CMD_MASK3_CASb_MSK (0x00000020)
+ #define MCMNTS_CR_ODLAT_CMD_MASK3_CASb_MAX (0x00000001)
+ #define MCMNTS_CR_ODLAT_CMD_MASK3_CASb_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MASK3_RASb_OFF ( 6)
+ #define MCMNTS_CR_ODLAT_CMD_MASK3_RASb_WID ( 1)
+ #define MCMNTS_CR_ODLAT_CMD_MASK3_RASb_MSK (0x00000040)
+ #define MCMNTS_CR_ODLAT_CMD_MASK3_RASb_MAX (0x00000001)
+ #define MCMNTS_CR_ODLAT_CMD_MASK3_RASb_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MASK3_CSb_OFF ( 7)
+ #define MCMNTS_CR_ODLAT_CMD_MASK3_CSb_WID ( 4)
+ #define MCMNTS_CR_ODLAT_CMD_MASK3_CSb_MSK (0x00000780)
+ #define MCMNTS_CR_ODLAT_CMD_MASK3_CSb_MAX (0x0000000F)
+ #define MCMNTS_CR_ODLAT_CMD_MASK3_CSb_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MASK3_CKE_OFF (11)
+ #define MCMNTS_CR_ODLAT_CMD_MASK3_CKE_WID ( 4)
+ #define MCMNTS_CR_ODLAT_CMD_MASK3_CKE_MSK (0x00007800)
+ #define MCMNTS_CR_ODLAT_CMD_MASK3_CKE_MAX (0x0000000F)
+ #define MCMNTS_CR_ODLAT_CMD_MASK3_CKE_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_MASK3_MA_OFF (15)
+ #define MCMNTS_CR_ODLAT_CMD_MASK3_MA_WID (16)
+ #define MCMNTS_CR_ODLAT_CMD_MASK3_MA_MSK (0x7FFF8000)
+ #define MCMNTS_CR_ODLAT_CMD_MASK3_MA_MAX (0x0000FFFF)
+ #define MCMNTS_CR_ODLAT_CMD_MASK3_MA_DEF (0x00000000)
+
+#define MCMNTS_CR_ODLAT_CMD_BANK_REG (0x00004F60)
+ #define MCMNTS_CR_ODLAT_CMD_BANK_BankMatch0_OFF ( 0)
+ #define MCMNTS_CR_ODLAT_CMD_BANK_BankMatch0_WID ( 3)
+ #define MCMNTS_CR_ODLAT_CMD_BANK_BankMatch0_MSK (0x00000007)
+ #define MCMNTS_CR_ODLAT_CMD_BANK_BankMatch0_MAX (0x00000007)
+ #define MCMNTS_CR_ODLAT_CMD_BANK_BankMatch0_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_BANK_BankMatch1_OFF ( 3)
+ #define MCMNTS_CR_ODLAT_CMD_BANK_BankMatch1_WID ( 3)
+ #define MCMNTS_CR_ODLAT_CMD_BANK_BankMatch1_MSK (0x00000038)
+ #define MCMNTS_CR_ODLAT_CMD_BANK_BankMatch1_MAX (0x00000007)
+ #define MCMNTS_CR_ODLAT_CMD_BANK_BankMatch1_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_BANK_BankMatch2_OFF ( 6)
+ #define MCMNTS_CR_ODLAT_CMD_BANK_BankMatch2_WID ( 3)
+ #define MCMNTS_CR_ODLAT_CMD_BANK_BankMatch2_MSK (0x000001C0)
+ #define MCMNTS_CR_ODLAT_CMD_BANK_BankMatch2_MAX (0x00000007)
+ #define MCMNTS_CR_ODLAT_CMD_BANK_BankMatch2_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_BANK_BankMatch3_OFF ( 9)
+ #define MCMNTS_CR_ODLAT_CMD_BANK_BankMatch3_WID ( 3)
+ #define MCMNTS_CR_ODLAT_CMD_BANK_BankMatch3_MSK (0x00000E00)
+ #define MCMNTS_CR_ODLAT_CMD_BANK_BankMatch3_MAX (0x00000007)
+ #define MCMNTS_CR_ODLAT_CMD_BANK_BankMatch3_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_BANK_BankMask0_OFF (12)
+ #define MCMNTS_CR_ODLAT_CMD_BANK_BankMask0_WID ( 3)
+ #define MCMNTS_CR_ODLAT_CMD_BANK_BankMask0_MSK (0x00007000)
+ #define MCMNTS_CR_ODLAT_CMD_BANK_BankMask0_MAX (0x00000007)
+ #define MCMNTS_CR_ODLAT_CMD_BANK_BankMask0_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_BANK_BankMask1_OFF (15)
+ #define MCMNTS_CR_ODLAT_CMD_BANK_BankMask1_WID ( 3)
+ #define MCMNTS_CR_ODLAT_CMD_BANK_BankMask1_MSK (0x00038000)
+ #define MCMNTS_CR_ODLAT_CMD_BANK_BankMask1_MAX (0x00000007)
+ #define MCMNTS_CR_ODLAT_CMD_BANK_BankMask1_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_BANK_BankMask2_OFF (18)
+ #define MCMNTS_CR_ODLAT_CMD_BANK_BankMask2_WID ( 3)
+ #define MCMNTS_CR_ODLAT_CMD_BANK_BankMask2_MSK (0x001C0000)
+ #define MCMNTS_CR_ODLAT_CMD_BANK_BankMask2_MAX (0x00000007)
+ #define MCMNTS_CR_ODLAT_CMD_BANK_BankMask2_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_CMD_BANK_BankMask3_OFF (21)
+ #define MCMNTS_CR_ODLAT_CMD_BANK_BankMask3_WID ( 3)
+ #define MCMNTS_CR_ODLAT_CMD_BANK_BankMask3_MSK (0x00E00000)
+ #define MCMNTS_CR_ODLAT_CMD_BANK_BankMask3_MAX (0x00000007)
+ #define MCMNTS_CR_ODLAT_CMD_BANK_BankMask3_DEF (0x00000000)
+
+#define MCMNTS_CR_ODLAT_SEQ_LEVEL0_REG (0x00004F64)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL0_InputMatch_OFF ( 0)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL0_InputMatch_WID ( 4)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL0_InputMatch_MSK (0x0000000F)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL0_InputMatch_MAX (0x0000000F)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL0_InputMatch_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL0_InputInvert_OFF ( 4)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL0_InputInvert_WID ( 4)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL0_InputInvert_MSK (0x000000F0)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL0_InputInvert_MAX (0x0000000F)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL0_InputInvert_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL0_CountMatches_OFF ( 8)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL0_CountMatches_WID ( 1)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL0_CountMatches_MSK (0x00000100)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL0_CountMatches_MAX (0x00000001)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL0_CountMatches_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL0_CounterThreshold_OFF ( 9)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL0_CounterThreshold_WID (15)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL0_CounterThreshold_MSK (0x00FFFE00)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL0_CounterThreshold_MAX (0x00007FFF)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL0_CounterThreshold_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL0_CounterAction_OFF (24)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL0_CounterAction_WID ( 2)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL0_CounterAction_MSK (0x03000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL0_CounterAction_MAX (0x00000003)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL0_CounterAction_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL0_CounterNextState_OFF (26)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL0_CounterNextState_WID ( 2)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL0_CounterNextState_MSK (0x0C000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL0_CounterNextState_MAX (0x00000003)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL0_CounterNextState_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL0_MatchAction_OFF (28)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL0_MatchAction_WID ( 2)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL0_MatchAction_MSK (0x30000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL0_MatchAction_MAX (0x00000003)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL0_MatchAction_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL0_MatchNextState_OFF (30)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL0_MatchNextState_WID ( 2)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL0_MatchNextState_MSK (0xC0000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL0_MatchNextState_MAX (0x00000003)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL0_MatchNextState_DEF (0x00000000)
+
+#define MCMNTS_CR_ODLAT_SEQ_LEVEL1_REG (0x00004F68)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL1_InputMatch_OFF ( 0)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL1_InputMatch_WID ( 4)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL1_InputMatch_MSK (0x0000000F)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL1_InputMatch_MAX (0x0000000F)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL1_InputMatch_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL1_InputInvert_OFF ( 4)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL1_InputInvert_WID ( 4)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL1_InputInvert_MSK (0x000000F0)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL1_InputInvert_MAX (0x0000000F)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL1_InputInvert_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL1_CountMatches_OFF ( 8)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL1_CountMatches_WID ( 1)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL1_CountMatches_MSK (0x00000100)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL1_CountMatches_MAX (0x00000001)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL1_CountMatches_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL1_CounterThreshold_OFF ( 9)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL1_CounterThreshold_WID (15)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL1_CounterThreshold_MSK (0x00FFFE00)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL1_CounterThreshold_MAX (0x00007FFF)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL1_CounterThreshold_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL1_CounterAction_OFF (24)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL1_CounterAction_WID ( 2)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL1_CounterAction_MSK (0x03000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL1_CounterAction_MAX (0x00000003)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL1_CounterAction_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL1_CounterNextState_OFF (26)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL1_CounterNextState_WID ( 2)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL1_CounterNextState_MSK (0x0C000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL1_CounterNextState_MAX (0x00000003)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL1_CounterNextState_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL1_MatchAction_OFF (28)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL1_MatchAction_WID ( 2)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL1_MatchAction_MSK (0x30000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL1_MatchAction_MAX (0x00000003)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL1_MatchAction_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL1_MatchNextState_OFF (30)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL1_MatchNextState_WID ( 2)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL1_MatchNextState_MSK (0xC0000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL1_MatchNextState_MAX (0x00000003)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL1_MatchNextState_DEF (0x00000000)
+
+#define MCMNTS_CR_ODLAT_SEQ_LEVEL2_REG (0x00004F6C)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL2_InputMatch_OFF ( 0)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL2_InputMatch_WID ( 4)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL2_InputMatch_MSK (0x0000000F)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL2_InputMatch_MAX (0x0000000F)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL2_InputMatch_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL2_InputInvert_OFF ( 4)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL2_InputInvert_WID ( 4)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL2_InputInvert_MSK (0x000000F0)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL2_InputInvert_MAX (0x0000000F)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL2_InputInvert_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL2_CountMatches_OFF ( 8)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL2_CountMatches_WID ( 1)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL2_CountMatches_MSK (0x00000100)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL2_CountMatches_MAX (0x00000001)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL2_CountMatches_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL2_CounterThreshold_OFF ( 9)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL2_CounterThreshold_WID (15)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL2_CounterThreshold_MSK (0x00FFFE00)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL2_CounterThreshold_MAX (0x00007FFF)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL2_CounterThreshold_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL2_CounterAction_OFF (24)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL2_CounterAction_WID ( 2)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL2_CounterAction_MSK (0x03000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL2_CounterAction_MAX (0x00000003)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL2_CounterAction_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL2_CounterNextState_OFF (26)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL2_CounterNextState_WID ( 2)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL2_CounterNextState_MSK (0x0C000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL2_CounterNextState_MAX (0x00000003)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL2_CounterNextState_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL2_MatchAction_OFF (28)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL2_MatchAction_WID ( 2)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL2_MatchAction_MSK (0x30000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL2_MatchAction_MAX (0x00000003)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL2_MatchAction_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL2_MatchNextState_OFF (30)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL2_MatchNextState_WID ( 2)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL2_MatchNextState_MSK (0xC0000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL2_MatchNextState_MAX (0x00000003)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL2_MatchNextState_DEF (0x00000000)
+
+#define MCMNTS_CR_ODLAT_SEQ_LEVEL3_REG (0x00004F70)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL3_InputMatch_OFF ( 0)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL3_InputMatch_WID ( 4)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL3_InputMatch_MSK (0x0000000F)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL3_InputMatch_MAX (0x0000000F)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL3_InputMatch_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL3_InputInvert_OFF ( 4)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL3_InputInvert_WID ( 4)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL3_InputInvert_MSK (0x000000F0)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL3_InputInvert_MAX (0x0000000F)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL3_InputInvert_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL3_CountMatches_OFF ( 8)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL3_CountMatches_WID ( 1)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL3_CountMatches_MSK (0x00000100)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL3_CountMatches_MAX (0x00000001)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL3_CountMatches_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL3_CounterThreshold_OFF ( 9)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL3_CounterThreshold_WID (15)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL3_CounterThreshold_MSK (0x00FFFE00)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL3_CounterThreshold_MAX (0x00007FFF)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL3_CounterThreshold_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL3_CounterAction_OFF (24)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL3_CounterAction_WID ( 2)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL3_CounterAction_MSK (0x03000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL3_CounterAction_MAX (0x00000003)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL3_CounterAction_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL3_CounterNextState_OFF (26)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL3_CounterNextState_WID ( 2)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL3_CounterNextState_MSK (0x0C000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL3_CounterNextState_MAX (0x00000003)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL3_CounterNextState_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL3_MatchAction_OFF (28)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL3_MatchAction_WID ( 2)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL3_MatchAction_MSK (0x30000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL3_MatchAction_MAX (0x00000003)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL3_MatchAction_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL3_MatchNextState_OFF (30)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL3_MatchNextState_WID ( 2)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL3_MatchNextState_MSK (0xC0000000)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL3_MatchNextState_MAX (0x00000003)
+ #define MCMNTS_CR_ODLAT_SEQ_LEVEL3_MatchNextState_DEF (0x00000000)
+
+#define MCMNTS_CR_ODLAT_SEQ_GLOBAL_REG (0x00004F74)
+ #define MCMNTS_CR_ODLAT_SEQ_GLOBAL_TriggerBlockEnable_OFF ( 0)
+ #define MCMNTS_CR_ODLAT_SEQ_GLOBAL_TriggerBlockEnable_WID ( 1)
+ #define MCMNTS_CR_ODLAT_SEQ_GLOBAL_TriggerBlockEnable_MSK (0x00000001)
+ #define MCMNTS_CR_ODLAT_SEQ_GLOBAL_TriggerBlockEnable_MAX (0x00000001)
+ #define MCMNTS_CR_ODLAT_SEQ_GLOBAL_TriggerBlockEnable_DEF (0x00000000)
+ #define MCMNTS_CR_ODLAT_SEQ_GLOBAL_GlobalCounterThreshold_OFF ( 1)
+ #define MCMNTS_CR_ODLAT_SEQ_GLOBAL_GlobalCounterThreshold_WID (16)
+ #define MCMNTS_CR_ODLAT_SEQ_GLOBAL_GlobalCounterThreshold_MSK (0x0001FFFE)
+ #define MCMNTS_CR_ODLAT_SEQ_GLOBAL_GlobalCounterThreshold_MAX (0x0000FFFF)
+ #define MCMNTS_CR_ODLAT_SEQ_GLOBAL_GlobalCounterThreshold_DEF (0x00000000)
+
+#define MCMNTS_CR_SC_WDBWM_REG (0x00004F8C)
+ #define MCMNTS_CR_SC_WDBWM_WMM_Enter_OFF ( 0)
+ #define MCMNTS_CR_SC_WDBWM_WMM_Enter_WID ( 8)
+ #define MCMNTS_CR_SC_WDBWM_WMM_Enter_MSK (0x000000FF)
+ #define MCMNTS_CR_SC_WDBWM_WMM_Enter_MAX (0x000000FF)
+ #define MCMNTS_CR_SC_WDBWM_WMM_Enter_DEF (0x00000038)
+ #define MCMNTS_CR_SC_WDBWM_WMM_Exit_OFF ( 8)
+ #define MCMNTS_CR_SC_WDBWM_WMM_Exit_WID ( 8)
+ #define MCMNTS_CR_SC_WDBWM_WMM_Exit_MSK (0x0000FF00)
+ #define MCMNTS_CR_SC_WDBWM_WMM_Exit_MAX (0x000000FF)
+ #define MCMNTS_CR_SC_WDBWM_WMM_Exit_DEF (0x00000030)
+ #define MCMNTS_CR_SC_WDBWM_WPQ_IS_OFF (16)
+ #define MCMNTS_CR_SC_WDBWM_WPQ_IS_WID ( 8)
+ #define MCMNTS_CR_SC_WDBWM_WPQ_IS_MSK (0x00FF0000)
+ #define MCMNTS_CR_SC_WDBWM_WPQ_IS_MAX (0x000000FF)
+ #define MCMNTS_CR_SC_WDBWM_WPQ_IS_DEF (0x0000003C)
+ #define MCMNTS_CR_SC_WDBWM_Starve_count_OFF (24)
+ #define MCMNTS_CR_SC_WDBWM_Starve_count_WID ( 8)
+ #define MCMNTS_CR_SC_WDBWM_Starve_count_MSK (0xFF000000)
+ #define MCMNTS_CR_SC_WDBWM_Starve_count_MAX (0x000000FF)
+ #define MCMNTS_CR_SC_WDBWM_Starve_count_DEF (0x000000FF)
+
+#define MCMNTS_CR_VISA_CTL_MCMNTS_REG (0x00004F90)
+ #define MCMNTS_CR_VISA_CTL_MCMNTS_Data_OFF ( 0)
+ #define MCMNTS_CR_VISA_CTL_MCMNTS_Data_WID (18)
+ #define MCMNTS_CR_VISA_CTL_MCMNTS_Data_MSK (0x0003FFFF)
+ #define MCMNTS_CR_VISA_CTL_MCMNTS_Data_MAX (0x0003FFFF)
+ #define MCMNTS_CR_VISA_CTL_MCMNTS_Data_DEF (0x00000000)
+ #define MCMNTS_CR_VISA_CTL_MCMNTS_VORANGE_OFF (31)
+ #define MCMNTS_CR_VISA_CTL_MCMNTS_VORANGE_WID ( 1)
+ #define MCMNTS_CR_VISA_CTL_MCMNTS_VORANGE_MSK (0x80000000)
+ #define MCMNTS_CR_VISA_CTL_MCMNTS_VORANGE_MAX (0x00000001)
+ #define MCMNTS_CR_VISA_CTL_MCMNTS_VORANGE_DEF (0x00000000)
+
+#define MCDECS_CR_MAD_CHNL_MCMAIN_REG (0x00005000)
+ #define MCDECS_CR_MAD_CHNL_MCMAIN_CH_A_OFF ( 0)
+ #define MCDECS_CR_MAD_CHNL_MCMAIN_CH_A_WID ( 2)
+ #define MCDECS_CR_MAD_CHNL_MCMAIN_CH_A_MSK (0x00000003)
+ #define MCDECS_CR_MAD_CHNL_MCMAIN_CH_A_MAX (0x00000003)
+ #define MCDECS_CR_MAD_CHNL_MCMAIN_CH_A_DEF (0x00000000)
+ #define MCDECS_CR_MAD_CHNL_MCMAIN_CH_B_OFF ( 2)
+ #define MCDECS_CR_MAD_CHNL_MCMAIN_CH_B_WID ( 2)
+ #define MCDECS_CR_MAD_CHNL_MCMAIN_CH_B_MSK (0x0000000C)
+ #define MCDECS_CR_MAD_CHNL_MCMAIN_CH_B_MAX (0x00000003)
+ #define MCDECS_CR_MAD_CHNL_MCMAIN_CH_B_DEF (0x00000001)
+ #define MCDECS_CR_MAD_CHNL_MCMAIN_CH_C_OFF ( 4)
+ #define MCDECS_CR_MAD_CHNL_MCMAIN_CH_C_WID ( 2)
+ #define MCDECS_CR_MAD_CHNL_MCMAIN_CH_C_MSK (0x00000030)
+ #define MCDECS_CR_MAD_CHNL_MCMAIN_CH_C_MAX (0x00000003)
+ #define MCDECS_CR_MAD_CHNL_MCMAIN_CH_C_DEF (0x00000002)
+ #define MCDECS_CR_MAD_CHNL_MCMAIN_STKD_MODE_OFF ( 6)
+ #define MCDECS_CR_MAD_CHNL_MCMAIN_STKD_MODE_WID ( 1)
+ #define MCDECS_CR_MAD_CHNL_MCMAIN_STKD_MODE_MSK (0x00000040)
+ #define MCDECS_CR_MAD_CHNL_MCMAIN_STKD_MODE_MAX (0x00000001)
+ #define MCDECS_CR_MAD_CHNL_MCMAIN_STKD_MODE_DEF (0x00000000)
+ #define MCDECS_CR_MAD_CHNL_MCMAIN_STKD_MODE_CH_BITS_OFF ( 7)
+ #define MCDECS_CR_MAD_CHNL_MCMAIN_STKD_MODE_CH_BITS_WID ( 3)
+ #define MCDECS_CR_MAD_CHNL_MCMAIN_STKD_MODE_CH_BITS_MSK (0x00000380)
+ #define MCDECS_CR_MAD_CHNL_MCMAIN_STKD_MODE_CH_BITS_MAX (0x00000007)
+ #define MCDECS_CR_MAD_CHNL_MCMAIN_STKD_MODE_CH_BITS_DEF (0x00000000)
+ #define MCDECS_CR_MAD_CHNL_MCMAIN_LPDDR_OFF (10)
+ #define MCDECS_CR_MAD_CHNL_MCMAIN_LPDDR_WID ( 1)
+ #define MCDECS_CR_MAD_CHNL_MCMAIN_LPDDR_MSK (0x00000400)
+ #define MCDECS_CR_MAD_CHNL_MCMAIN_LPDDR_MAX (0x00000001)
+ #define MCDECS_CR_MAD_CHNL_MCMAIN_LPDDR_DEF (0x00000000)
+
+#define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_REG (0x00005004)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_DIMM_A_Size_OFF ( 0)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_DIMM_A_Size_WID ( 8)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_DIMM_A_Size_MSK (0x000000FF)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_DIMM_A_Size_MAX (0x000000FF)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_DIMM_A_Size_DEF (0x00000000)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_DIMM_B_Size_OFF ( 8)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_DIMM_B_Size_WID ( 8)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_DIMM_B_Size_MSK (0x0000FF00)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_DIMM_B_Size_MAX (0x000000FF)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_DIMM_B_Size_DEF (0x00000000)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_DAS_OFF (16)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_DAS_WID ( 1)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_DAS_MSK (0x00010000)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_DAS_MAX (0x00000001)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_DAS_DEF (0x00000000)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_DANOR_OFF (17)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_DANOR_WID ( 1)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_DANOR_MSK (0x00020000)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_DANOR_MAX (0x00000001)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_DANOR_DEF (0x00000000)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_DBNOR_OFF (18)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_DBNOR_WID ( 1)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_DBNOR_MSK (0x00040000)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_DBNOR_MAX (0x00000001)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_DBNOR_DEF (0x00000000)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_DAW_OFF (19)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_DAW_WID ( 1)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_DAW_MSK (0x00080000)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_DAW_MAX (0x00000001)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_DAW_DEF (0x00000000)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_DBW_OFF (20)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_DBW_WID ( 1)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_DBW_MSK (0x00100000)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_DBW_MAX (0x00000001)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_DBW_DEF (0x00000000)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_RI_OFF (21)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_RI_WID ( 1)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_RI_MSK (0x00200000)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_RI_MAX (0x00000001)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_RI_DEF (0x00000001)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_Enh_Interleave_OFF (22)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_Enh_Interleave_WID ( 1)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_Enh_Interleave_MSK (0x00400000)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_Enh_Interleave_MAX (0x00000001)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_Enh_Interleave_DEF (0x00000001)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_ECC_OFF (24)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_ECC_WID ( 2)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_ECC_MSK (0x03000000)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_ECC_MAX (0x00000003)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_ECC_DEF (0x00000000)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_HORI_OFF (26)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_HORI_WID ( 1)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_HORI_MSK (0x04000000)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_HORI_MAX (0x00000001)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_HORI_DEF (0x00000000)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_HORIAddr_OFF (27)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_HORIAddr_WID ( 3)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_HORIAddr_MSK (0x38000000)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_HORIAddr_MAX (0x00000007)
+ #define MCDECS_CR_MAD_DIMM_CH0_MCMAIN_HORIAddr_DEF (0x00000000)
+
+#define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_REG (0x00005008)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_DIMM_A_Size_OFF ( 0)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_DIMM_A_Size_WID ( 8)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_DIMM_A_Size_MSK (0x000000FF)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_DIMM_A_Size_MAX (0x000000FF)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_DIMM_A_Size_DEF (0x00000000)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_DIMM_B_Size_OFF ( 8)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_DIMM_B_Size_WID ( 8)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_DIMM_B_Size_MSK (0x0000FF00)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_DIMM_B_Size_MAX (0x000000FF)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_DIMM_B_Size_DEF (0x00000000)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_DAS_OFF (16)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_DAS_WID ( 1)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_DAS_MSK (0x00010000)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_DAS_MAX (0x00000001)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_DAS_DEF (0x00000000)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_DANOR_OFF (17)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_DANOR_WID ( 1)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_DANOR_MSK (0x00020000)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_DANOR_MAX (0x00000001)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_DANOR_DEF (0x00000000)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_DBNOR_OFF (18)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_DBNOR_WID ( 1)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_DBNOR_MSK (0x00040000)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_DBNOR_MAX (0x00000001)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_DBNOR_DEF (0x00000000)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_DAW_OFF (19)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_DAW_WID ( 1)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_DAW_MSK (0x00080000)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_DAW_MAX (0x00000001)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_DAW_DEF (0x00000000)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_DBW_OFF (20)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_DBW_WID ( 1)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_DBW_MSK (0x00100000)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_DBW_MAX (0x00000001)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_DBW_DEF (0x00000000)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_RI_OFF (21)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_RI_WID ( 1)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_RI_MSK (0x00200000)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_RI_MAX (0x00000001)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_RI_DEF (0x00000001)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_Enh_Interleave_OFF (22)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_Enh_Interleave_WID ( 1)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_Enh_Interleave_MSK (0x00400000)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_Enh_Interleave_MAX (0x00000001)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_Enh_Interleave_DEF (0x00000001)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_ECC_OFF (24)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_ECC_WID ( 2)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_ECC_MSK (0x03000000)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_ECC_MAX (0x00000003)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_ECC_DEF (0x00000000)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_HORI_OFF (26)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_HORI_WID ( 1)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_HORI_MSK (0x04000000)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_HORI_MAX (0x00000001)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_HORI_DEF (0x00000000)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_HORIAddr_OFF (27)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_HORIAddr_WID ( 3)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_HORIAddr_MSK (0x38000000)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_HORIAddr_MAX (0x00000007)
+ #define MCDECS_CR_MAD_DIMM_CH1_MCMAIN_HORIAddr_DEF (0x00000000)
+
+#define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_REG (0x0000500C)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_DIMM_A_Size_OFF ( 0)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_DIMM_A_Size_WID ( 8)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_DIMM_A_Size_MSK (0x000000FF)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_DIMM_A_Size_MAX (0x000000FF)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_DIMM_A_Size_DEF (0x00000000)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_DIMM_B_Size_OFF ( 8)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_DIMM_B_Size_WID ( 8)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_DIMM_B_Size_MSK (0x0000FF00)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_DIMM_B_Size_MAX (0x000000FF)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_DIMM_B_Size_DEF (0x00000000)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_DAS_OFF (16)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_DAS_WID ( 1)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_DAS_MSK (0x00010000)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_DAS_MAX (0x00000001)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_DAS_DEF (0x00000000)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_DANOR_OFF (17)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_DANOR_WID ( 1)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_DANOR_MSK (0x00020000)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_DANOR_MAX (0x00000001)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_DANOR_DEF (0x00000000)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_DBNOR_OFF (18)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_DBNOR_WID ( 1)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_DBNOR_MSK (0x00040000)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_DBNOR_MAX (0x00000001)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_DBNOR_DEF (0x00000000)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_DAW_OFF (19)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_DAW_WID ( 1)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_DAW_MSK (0x00080000)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_DAW_MAX (0x00000001)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_DAW_DEF (0x00000000)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_DBW_OFF (20)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_DBW_WID ( 1)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_DBW_MSK (0x00100000)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_DBW_MAX (0x00000001)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_DBW_DEF (0x00000000)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_RI_OFF (21)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_RI_WID ( 1)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_RI_MSK (0x00200000)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_RI_MAX (0x00000001)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_RI_DEF (0x00000001)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_Enh_Interleave_OFF (22)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_Enh_Interleave_WID ( 1)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_Enh_Interleave_MSK (0x00400000)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_Enh_Interleave_MAX (0x00000001)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_Enh_Interleave_DEF (0x00000001)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_ECC_OFF (24)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_ECC_WID ( 2)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_ECC_MSK (0x03000000)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_ECC_MAX (0x00000003)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_ECC_DEF (0x00000000)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_HORI_OFF (26)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_HORI_WID ( 1)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_HORI_MSK (0x04000000)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_HORI_MAX (0x00000001)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_HORI_DEF (0x00000000)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_HORIAddr_OFF (27)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_HORIAddr_WID ( 3)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_HORIAddr_MSK (0x38000000)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_HORIAddr_MAX (0x00000007)
+ #define MCDECS_CR_MAD_DIMM_CH2_MCMAIN_HORIAddr_DEF (0x00000000)
+
+#define MCDECS_CR_MAD_ZR_MCMAIN_REG (0x00005014)
+ #define MCDECS_CR_MAD_ZR_MCMAIN_OneC_OFF ( 0)
+ #define MCDECS_CR_MAD_ZR_MCMAIN_OneC_WID ( 8)
+ #define MCDECS_CR_MAD_ZR_MCMAIN_OneC_MSK (0x000000FF)
+ #define MCDECS_CR_MAD_ZR_MCMAIN_OneC_MAX (0x000000FF)
+ #define MCDECS_CR_MAD_ZR_MCMAIN_OneC_DEF (0x00000000)
+ #define MCDECS_CR_MAD_ZR_MCMAIN_ThreeC_OFF ( 8)
+ #define MCDECS_CR_MAD_ZR_MCMAIN_ThreeC_WID ( 8)
+ #define MCDECS_CR_MAD_ZR_MCMAIN_ThreeC_MSK (0x0000FF00)
+ #define MCDECS_CR_MAD_ZR_MCMAIN_ThreeC_MAX (0x000000FF)
+ #define MCDECS_CR_MAD_ZR_MCMAIN_ThreeC_DEF (0x00000000)
+ #define MCDECS_CR_MAD_ZR_MCMAIN_TwoBandC_OFF (16)
+ #define MCDECS_CR_MAD_ZR_MCMAIN_TwoBandC_WID ( 8)
+ #define MCDECS_CR_MAD_ZR_MCMAIN_TwoBandC_MSK (0x00FF0000)
+ #define MCDECS_CR_MAD_ZR_MCMAIN_TwoBandC_MAX (0x000000FF)
+ #define MCDECS_CR_MAD_ZR_MCMAIN_TwoBandC_DEF (0x00000000)
+ #define MCDECS_CR_MAD_ZR_MCMAIN_BandC_OFF (24)
+ #define MCDECS_CR_MAD_ZR_MCMAIN_BandC_WID ( 8)
+ #define MCDECS_CR_MAD_ZR_MCMAIN_BandC_MSK (0xFF000000)
+ #define MCDECS_CR_MAD_ZR_MCMAIN_BandC_MAX (0x000000FF)
+ #define MCDECS_CR_MAD_ZR_MCMAIN_BandC_DEF (0x00000000)
+
+#define MCDECS_CR_MCDECS_MISC_MCMAIN_REG (0x00005018)
+ #define MCDECS_CR_MCDECS_MISC_MCMAIN_spare_OFF ( 0)
+ #define MCDECS_CR_MCDECS_MISC_MCMAIN_spare_WID (23)
+ #define MCDECS_CR_MCDECS_MISC_MCMAIN_spare_MSK (0x007FFFFF)
+ #define MCDECS_CR_MCDECS_MISC_MCMAIN_spare_MAX (0x007FFFFF)
+ #define MCDECS_CR_MCDECS_MISC_MCMAIN_spare_DEF (0x00000000)
+ #define MCDECS_CR_MCDECS_MISC_MCMAIN_ovrd_pcu_sr_exit_OFF (23)
+ #define MCDECS_CR_MCDECS_MISC_MCMAIN_ovrd_pcu_sr_exit_WID ( 1)
+ #define MCDECS_CR_MCDECS_MISC_MCMAIN_ovrd_pcu_sr_exit_MSK (0x00800000)
+ #define MCDECS_CR_MCDECS_MISC_MCMAIN_ovrd_pcu_sr_exit_MAX (0x00000001)
+ #define MCDECS_CR_MCDECS_MISC_MCMAIN_ovrd_pcu_sr_exit_DEF (0x00000000)
+ #define MCDECS_CR_MCDECS_MISC_MCMAIN_isoch_stall_pattern_OFF (24)
+ #define MCDECS_CR_MCDECS_MISC_MCMAIN_isoch_stall_pattern_WID ( 8)
+ #define MCDECS_CR_MCDECS_MISC_MCMAIN_isoch_stall_pattern_MSK (0xFF000000)
+ #define MCDECS_CR_MCDECS_MISC_MCMAIN_isoch_stall_pattern_MAX (0x000000FF)
+ #define MCDECS_CR_MCDECS_MISC_MCMAIN_isoch_stall_pattern_DEF (0x00000000)
+
+#define MCDECS_CR_MCDECS_CBIT_MCMAIN_REG (0x0000501C)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_increase_rcomp_OFF ( 0)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_increase_rcomp_WID ( 1)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_increase_rcomp_MSK (0x00000001)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_increase_rcomp_MAX (0x00000001)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_increase_rcomp_DEF (0x00000000)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_noa_on_ecc_OFF ( 1)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_noa_on_ecc_WID ( 1)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_noa_on_ecc_MSK (0x00000002)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_noa_on_ecc_MAX (0x00000001)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_noa_on_ecc_DEF (0x00000000)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_noa_demux_OFF ( 2)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_noa_demux_WID ( 1)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_noa_demux_MSK (0x00000004)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_noa_demux_MAX (0x00000001)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_noa_demux_DEF (0x00000000)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_noa_countctrl_OFF ( 3)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_noa_countctrl_WID ( 1)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_noa_countctrl_MSK (0x00000008)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_noa_countctrl_MAX (0x00000001)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_noa_countctrl_DEF (0x00000000)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_psmi_freeze_pwm_counters_OFF ( 8)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_psmi_freeze_pwm_counters_WID ( 1)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_psmi_freeze_pwm_counters_MSK (0x00000100)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_psmi_freeze_pwm_counters_MAX (0x00000001)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_psmi_freeze_pwm_counters_DEF (0x00000000)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_dis_lp_prefetch_OFF (15)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_dis_lp_prefetch_WID ( 1)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_dis_lp_prefetch_MSK (0x00008000)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_dis_lp_prefetch_MAX (0x00000001)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_dis_lp_prefetch_DEF (0x00000000)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_dis_reg_clk_gate_OFF (29)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_dis_reg_clk_gate_WID ( 1)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_dis_reg_clk_gate_MSK (0x20000000)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_dis_reg_clk_gate_MAX (0x00000001)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_dis_reg_clk_gate_DEF (0x00000000)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_dis_msg_clk_gate_OFF (30)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_dis_msg_clk_gate_WID ( 1)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_dis_msg_clk_gate_MSK (0x40000000)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_dis_msg_clk_gate_MAX (0x00000001)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_dis_msg_clk_gate_DEF (0x00000001)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_dis_clk_gate_OFF (31)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_dis_clk_gate_WID ( 1)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_dis_clk_gate_MSK (0x80000000)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_dis_clk_gate_MAX (0x00000001)
+ #define MCDECS_CR_MCDECS_CBIT_MCMAIN_dis_clk_gate_DEF (0x00000000)
+
+#define MCDECS_CR_SC_IS_CREDIT_MCMAIN_REG (0x00005020)
+ #define MCDECS_CR_SC_IS_CREDIT_MCMAIN_count_OFF ( 0)
+ #define MCDECS_CR_SC_IS_CREDIT_MCMAIN_count_WID ( 4)
+ #define MCDECS_CR_SC_IS_CREDIT_MCMAIN_count_MSK (0x0000000F)
+ #define MCDECS_CR_SC_IS_CREDIT_MCMAIN_count_MAX (0x0000000F)
+ #define MCDECS_CR_SC_IS_CREDIT_MCMAIN_count_DEF (0x00000008)
+
+#define MCDECS_CR_CHANNEL_HASH_MCMAIN_REG (0x00005024)
+ #define MCDECS_CR_CHANNEL_HASH_MCMAIN_Mask_OFF ( 0)
+ #define MCDECS_CR_CHANNEL_HASH_MCMAIN_Mask_WID (14)
+ #define MCDECS_CR_CHANNEL_HASH_MCMAIN_Mask_MSK (0x00003FFF)
+ #define MCDECS_CR_CHANNEL_HASH_MCMAIN_Mask_MAX (0x00003FFF)
+ #define MCDECS_CR_CHANNEL_HASH_MCMAIN_Mask_DEF (0x00000000)
+ #define MCDECS_CR_CHANNEL_HASH_MCMAIN_LSB_mask_bit_OFF (21)
+ #define MCDECS_CR_CHANNEL_HASH_MCMAIN_LSB_mask_bit_WID ( 2)
+ #define MCDECS_CR_CHANNEL_HASH_MCMAIN_LSB_mask_bit_MSK (0x00600000)
+ #define MCDECS_CR_CHANNEL_HASH_MCMAIN_LSB_mask_bit_MAX (0x00000003)
+ #define MCDECS_CR_CHANNEL_HASH_MCMAIN_LSB_mask_bit_DEF (0x00000000)
+ #define MCDECS_CR_CHANNEL_HASH_MCMAIN_Enable_OFF (23)
+ #define MCDECS_CR_CHANNEL_HASH_MCMAIN_Enable_WID ( 1)
+ #define MCDECS_CR_CHANNEL_HASH_MCMAIN_Enable_MSK (0x00800000)
+ #define MCDECS_CR_CHANNEL_HASH_MCMAIN_Enable_MAX (0x00000001)
+ #define MCDECS_CR_CHANNEL_HASH_MCMAIN_Enable_DEF (0x00000000)
+
+#define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_REG (0x00005030)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_pu_mrc_done_OFF ( 0)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_pu_mrc_done_WID ( 1)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_pu_mrc_done_MSK (0x00000001)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_pu_mrc_done_MAX (0x00000001)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_pu_mrc_done_DEF (0x00000000)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_ddr_reset_OFF ( 1)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_ddr_reset_WID ( 1)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_ddr_reset_MSK (0x00000002)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_ddr_reset_MAX (0x00000001)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_ddr_reset_DEF (0x00000001)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_refresh_enable_OFF ( 3)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_refresh_enable_WID ( 1)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_refresh_enable_MSK (0x00000008)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_refresh_enable_MAX (0x00000001)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_refresh_enable_DEF (0x00000000)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_mc_init_done_ack_OFF ( 5)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_mc_init_done_ack_WID ( 1)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_mc_init_done_ack_MSK (0x00000020)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_mc_init_done_ack_MAX (0x00000001)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_mc_init_done_ack_DEF (0x00000000)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_mrc_done_OFF ( 7)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_mrc_done_WID ( 1)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_mrc_done_MSK (0x00000080)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_mrc_done_MAX (0x00000001)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_mrc_done_DEF (0x00000000)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_safe_sr_OFF ( 8)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_safe_sr_WID ( 1)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_safe_sr_MSK (0x00000100)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_safe_sr_MAX (0x00000001)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_safe_sr_DEF (0x00000001)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_HVM_Gate_DDR_Reset_OFF (10)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_HVM_Gate_DDR_Reset_WID ( 1)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_HVM_Gate_DDR_Reset_MSK (0x00000400)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_HVM_Gate_DDR_Reset_MAX (0x00000001)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_HVM_Gate_DDR_Reset_DEF (0x00000000)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_dclk_enable_OFF (22)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_dclk_enable_WID ( 1)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_dclk_enable_MSK (0x00400000)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_dclk_enable_MAX (0x00000001)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_dclk_enable_DEF (0x00000000)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_reset_io_OFF (23)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_reset_io_WID ( 1)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_reset_io_MSK (0x00800000)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_reset_io_MAX (0x00000001)
+ #define MCDECS_CR_MC_INIT_STATE_G_MCMAIN_reset_io_DEF (0x00000000)
+
+#define MCDECS_CR_MRC_REVISION_MCMAIN_REG (0x00005034)
+ #define MCDECS_CR_MRC_REVISION_MCMAIN_REVISION_OFF ( 0)
+ #define MCDECS_CR_MRC_REVISION_MCMAIN_REVISION_WID (32)
+ #define MCDECS_CR_MRC_REVISION_MCMAIN_REVISION_MSK (0xFFFFFFFF)
+ #define MCDECS_CR_MRC_REVISION_MCMAIN_REVISION_MAX (0xFFFFFFFF)
+ #define MCDECS_CR_MRC_REVISION_MCMAIN_REVISION_DEF (0x00000000)
+
+#define MCDECS_CR_PWM_GT_REQCOUNT_MCMAIN_REG (0x00005040)
+ #define MCDECS_CR_PWM_GT_REQCOUNT_MCMAIN_count_OFF ( 0)
+ #define MCDECS_CR_PWM_GT_REQCOUNT_MCMAIN_count_WID (32)
+ #define MCDECS_CR_PWM_GT_REQCOUNT_MCMAIN_count_MSK (0xFFFFFFFF)
+ #define MCDECS_CR_PWM_GT_REQCOUNT_MCMAIN_count_MAX (0xFFFFFFFF)
+ #define MCDECS_CR_PWM_GT_REQCOUNT_MCMAIN_count_DEF (0x00000000)
+
+#define MCDECS_CR_PWM_IA_REQCOUNT_MCMAIN_REG (0x00005044)
+ #define MCDECS_CR_PWM_IA_REQCOUNT_MCMAIN_count_OFF ( 0)
+ #define MCDECS_CR_PWM_IA_REQCOUNT_MCMAIN_count_WID (32)
+ #define MCDECS_CR_PWM_IA_REQCOUNT_MCMAIN_count_MSK (0xFFFFFFFF)
+ #define MCDECS_CR_PWM_IA_REQCOUNT_MCMAIN_count_MAX (0xFFFFFFFF)
+ #define MCDECS_CR_PWM_IA_REQCOUNT_MCMAIN_count_DEF (0x00000000)
+
+#define MCDECS_CR_PWM_IO_REQCOUNT_MCMAIN_REG (0x00005048)
+ #define MCDECS_CR_PWM_IO_REQCOUNT_MCMAIN_count_OFF ( 0)
+ #define MCDECS_CR_PWM_IO_REQCOUNT_MCMAIN_count_WID (32)
+ #define MCDECS_CR_PWM_IO_REQCOUNT_MCMAIN_count_MSK (0xFFFFFFFF)
+ #define MCDECS_CR_PWM_IO_REQCOUNT_MCMAIN_count_MAX (0xFFFFFFFF)
+ #define MCDECS_CR_PWM_IO_REQCOUNT_MCMAIN_count_DEF (0x00000000)
+
+#define MCDECS_CR_PWM_RDDATA_COUNT_MCMAIN_REG (0x00005050)
+ #define MCDECS_CR_PWM_RDDATA_COUNT_MCMAIN_count_OFF ( 0)
+ #define MCDECS_CR_PWM_RDDATA_COUNT_MCMAIN_count_WID (32)
+ #define MCDECS_CR_PWM_RDDATA_COUNT_MCMAIN_count_MSK (0xFFFFFFFF)
+ #define MCDECS_CR_PWM_RDDATA_COUNT_MCMAIN_count_MAX (0xFFFFFFFF)
+ #define MCDECS_CR_PWM_RDDATA_COUNT_MCMAIN_count_DEF (0x00000000)
+
+#define MCDECS_CR_PWM_WRDATA_COUNT_MCMAIN_REG (0x00005054)
+ #define MCDECS_CR_PWM_WRDATA_COUNT_MCMAIN_count_OFF ( 0)
+ #define MCDECS_CR_PWM_WRDATA_COUNT_MCMAIN_count_WID (32)
+ #define MCDECS_CR_PWM_WRDATA_COUNT_MCMAIN_count_MSK (0xFFFFFFFF)
+ #define MCDECS_CR_PWM_WRDATA_COUNT_MCMAIN_count_MAX (0xFFFFFFFF)
+ #define MCDECS_CR_PWM_WRDATA_COUNT_MCMAIN_count_DEF (0x00000000)
+
+#define MCDECS_CR_PWM_COMMAND_COUNT_MCMAIN_REG (0x00005058)
+ #define MCDECS_CR_PWM_COMMAND_COUNT_MCMAIN_count_OFF ( 0)
+ #define MCDECS_CR_PWM_COMMAND_COUNT_MCMAIN_count_WID (32)
+ #define MCDECS_CR_PWM_COMMAND_COUNT_MCMAIN_count_MSK (0xFFFFFFFF)
+ #define MCDECS_CR_PWM_COMMAND_COUNT_MCMAIN_count_MAX (0xFFFFFFFF)
+ #define MCDECS_CR_PWM_COMMAND_COUNT_MCMAIN_count_DEF (0x00000000)
+
+#define MCDECS_CR_PM_SREF_CONFIG_MCMAIN_REG (0x00005060)
+ #define MCDECS_CR_PM_SREF_CONFIG_MCMAIN_Idle_timer_OFF ( 0)
+ #define MCDECS_CR_PM_SREF_CONFIG_MCMAIN_Idle_timer_WID (16)
+ #define MCDECS_CR_PM_SREF_CONFIG_MCMAIN_Idle_timer_MSK (0x0000FFFF)
+ #define MCDECS_CR_PM_SREF_CONFIG_MCMAIN_Idle_timer_MAX (0x0000FFFF)
+ #define MCDECS_CR_PM_SREF_CONFIG_MCMAIN_Idle_timer_DEF (0x00000200)
+ #define MCDECS_CR_PM_SREF_CONFIG_MCMAIN_SR_Enable_OFF (16)
+ #define MCDECS_CR_PM_SREF_CONFIG_MCMAIN_SR_Enable_WID ( 1)
+ #define MCDECS_CR_PM_SREF_CONFIG_MCMAIN_SR_Enable_MSK (0x00010000)
+ #define MCDECS_CR_PM_SREF_CONFIG_MCMAIN_SR_Enable_MAX (0x00000001)
+ #define MCDECS_CR_PM_SREF_CONFIG_MCMAIN_SR_Enable_DEF (0x00000001)
+
+#define MCDECS_CR_MCI_CONFIG_MCMAIN_REG (0x00005070)
+ #define MCDECS_CR_MCI_CONFIG_MCMAIN_Ch_dir_OFF ( 0)
+ #define MCDECS_CR_MCI_CONFIG_MCMAIN_Ch_dir_WID ( 4)
+ #define MCDECS_CR_MCI_CONFIG_MCMAIN_Ch_dir_MSK (0x0000000F)
+ #define MCDECS_CR_MCI_CONFIG_MCMAIN_Ch_dir_MAX (0x0000000F)
+ #define MCDECS_CR_MCI_CONFIG_MCMAIN_Ch_dir_DEF (0x00000000)
+ #define MCDECS_CR_MCI_CONFIG_MCMAIN_MCI_clk_div_OFF ( 8)
+ #define MCDECS_CR_MCI_CONFIG_MCMAIN_MCI_clk_div_WID (10)
+ #define MCDECS_CR_MCI_CONFIG_MCMAIN_MCI_clk_div_MSK (0x0003FF00)
+ #define MCDECS_CR_MCI_CONFIG_MCMAIN_MCI_clk_div_MAX (0x000003FF)
+ #define MCDECS_CR_MCI_CONFIG_MCMAIN_MCI_clk_div_DEF (0x00000000)
+
+#define MCDECS_CR_STALL_DRAIN_MCMAIN_REG (0x00005074)
+ #define MCDECS_CR_STALL_DRAIN_MCMAIN_stall_until_drain_OFF ( 0)
+ #define MCDECS_CR_STALL_DRAIN_MCMAIN_stall_until_drain_WID ( 1)
+ #define MCDECS_CR_STALL_DRAIN_MCMAIN_stall_until_drain_MSK (0x00000001)
+ #define MCDECS_CR_STALL_DRAIN_MCMAIN_stall_until_drain_MAX (0x00000001)
+ #define MCDECS_CR_STALL_DRAIN_MCMAIN_stall_until_drain_DEF (0x00000000)
+ #define MCDECS_CR_STALL_DRAIN_MCMAIN_stall_input_OFF ( 1)
+ #define MCDECS_CR_STALL_DRAIN_MCMAIN_stall_input_WID ( 1)
+ #define MCDECS_CR_STALL_DRAIN_MCMAIN_stall_input_MSK (0x00000002)
+ #define MCDECS_CR_STALL_DRAIN_MCMAIN_stall_input_MAX (0x00000001)
+ #define MCDECS_CR_STALL_DRAIN_MCMAIN_stall_input_DEF (0x00000000)
+ #define MCDECS_CR_STALL_DRAIN_MCMAIN_mc_drained_OFF ( 4)
+ #define MCDECS_CR_STALL_DRAIN_MCMAIN_mc_drained_WID ( 1)
+ #define MCDECS_CR_STALL_DRAIN_MCMAIN_mc_drained_MSK (0x00000010)
+ #define MCDECS_CR_STALL_DRAIN_MCMAIN_mc_drained_MAX (0x00000001)
+ #define MCDECS_CR_STALL_DRAIN_MCMAIN_mc_drained_DEF (0x00000000)
+ #define MCDECS_CR_STALL_DRAIN_MCMAIN_sr_state_OFF ( 8)
+ #define MCDECS_CR_STALL_DRAIN_MCMAIN_sr_state_WID ( 2)
+ #define MCDECS_CR_STALL_DRAIN_MCMAIN_sr_state_MSK (0x00000300)
+ #define MCDECS_CR_STALL_DRAIN_MCMAIN_sr_state_MAX (0x00000003)
+ #define MCDECS_CR_STALL_DRAIN_MCMAIN_sr_state_DEF (0x00000000)
+
+#define MCDECS_CR_QUEUE_CREDIT_C_MCMAIN_REG (0x00005080)
+ #define MCDECS_CR_QUEUE_CREDIT_C_MCMAIN_RPQ_count_OFF ( 0)
+ #define MCDECS_CR_QUEUE_CREDIT_C_MCMAIN_RPQ_count_WID ( 5)
+ #define MCDECS_CR_QUEUE_CREDIT_C_MCMAIN_RPQ_count_MSK (0x0000001F)
+ #define MCDECS_CR_QUEUE_CREDIT_C_MCMAIN_RPQ_count_MAX (0x0000001F)
+ #define MCDECS_CR_QUEUE_CREDIT_C_MCMAIN_RPQ_count_DEF (0x0000001C)
+ #define MCDECS_CR_QUEUE_CREDIT_C_MCMAIN_WPQ_count_OFF ( 8)
+ #define MCDECS_CR_QUEUE_CREDIT_C_MCMAIN_WPQ_count_WID ( 7)
+ #define MCDECS_CR_QUEUE_CREDIT_C_MCMAIN_WPQ_count_MSK (0x00007F00)
+ #define MCDECS_CR_QUEUE_CREDIT_C_MCMAIN_WPQ_count_MAX (0x0000007F)
+ #define MCDECS_CR_QUEUE_CREDIT_C_MCMAIN_WPQ_count_DEF (0x00000040)
+
+#define MCDECS_CR_RCOMP_TIMER_MCMAIN_REG (0x00005084)
+ #define MCDECS_CR_RCOMP_TIMER_MCMAIN_count_OFF ( 0)
+ #define MCDECS_CR_RCOMP_TIMER_MCMAIN_count_WID (16)
+ #define MCDECS_CR_RCOMP_TIMER_MCMAIN_count_MSK (0x0000FFFF)
+ #define MCDECS_CR_RCOMP_TIMER_MCMAIN_count_MAX (0x0000FFFF)
+ #define MCDECS_CR_RCOMP_TIMER_MCMAIN_count_DEF (0x00000CFF)
+ #define MCDECS_CR_RCOMP_TIMER_MCMAIN_First_Rcomp_done_OFF (16)
+ #define MCDECS_CR_RCOMP_TIMER_MCMAIN_First_Rcomp_done_WID ( 1)
+ #define MCDECS_CR_RCOMP_TIMER_MCMAIN_First_Rcomp_done_MSK (0x00010000)
+ #define MCDECS_CR_RCOMP_TIMER_MCMAIN_First_Rcomp_done_MAX (0x00000001)
+ #define MCDECS_CR_RCOMP_TIMER_MCMAIN_First_Rcomp_done_DEF (0x00000000)
+
+#define MCDECS_CR_ECC_INJ_ADDR_COMPARE_MCMAIN_REG (0x00005090)
+ #define MCDECS_CR_ECC_INJ_ADDR_COMPARE_MCMAIN_Address_OFF ( 0)
+ #define MCDECS_CR_ECC_INJ_ADDR_COMPARE_MCMAIN_Address_WID (32)
+ #define MCDECS_CR_ECC_INJ_ADDR_COMPARE_MCMAIN_Address_MSK (0xFFFFFFFF)
+ #define MCDECS_CR_ECC_INJ_ADDR_COMPARE_MCMAIN_Address_MAX (0xFFFFFFFF)
+ #define MCDECS_CR_ECC_INJ_ADDR_COMPARE_MCMAIN_Address_DEF (0x00000000)
+
+#define MCDECS_CR_ECC_INJ_ADDR_MASK_MCMAIN_REG (0x00005094)
+ #define MCDECS_CR_ECC_INJ_ADDR_MASK_MCMAIN_Mask_OFF ( 0)
+ #define MCDECS_CR_ECC_INJ_ADDR_MASK_MCMAIN_Mask_WID (32)
+ #define MCDECS_CR_ECC_INJ_ADDR_MASK_MCMAIN_Mask_MSK (0xFFFFFFFF)
+ #define MCDECS_CR_ECC_INJ_ADDR_MASK_MCMAIN_Mask_MAX (0xFFFFFFFF)
+ #define MCDECS_CR_ECC_INJ_ADDR_MASK_MCMAIN_Mask_DEF (0xFFFFFFFF)
+
+#define MCDECS_CR_VISA_CTL_MCDECS_MCMAIN_REG (0x000050A0)
+ #define MCDECS_CR_VISA_CTL_MCDECS_MCMAIN_Data_OFF ( 0)
+ #define MCDECS_CR_VISA_CTL_MCDECS_MCMAIN_Data_WID (18)
+ #define MCDECS_CR_VISA_CTL_MCDECS_MCMAIN_Data_MSK (0x0003FFFF)
+ #define MCDECS_CR_VISA_CTL_MCDECS_MCMAIN_Data_MAX (0x0003FFFF)
+ #define MCDECS_CR_VISA_CTL_MCDECS_MCMAIN_Data_DEF (0x00000000)
+ #define MCDECS_CR_VISA_CTL_MCDECS_MCMAIN_VORANGE_OFF (31)
+ #define MCDECS_CR_VISA_CTL_MCDECS_MCMAIN_VORANGE_WID ( 1)
+ #define MCDECS_CR_VISA_CTL_MCDECS_MCMAIN_VORANGE_MSK (0x80000000)
+ #define MCDECS_CR_VISA_CTL_MCDECS_MCMAIN_VORANGE_MAX (0x00000001)
+ #define MCDECS_CR_VISA_CTL_MCDECS_MCMAIN_VORANGE_DEF (0x00000000)
+
+#define MCDECS_CR_VISA_XBAR_MCDECS_MCMAIN_REG (0x000050A4)
+ #define MCDECS_CR_VISA_XBAR_MCDECS_MCMAIN_Data_OFF ( 0)
+ #define MCDECS_CR_VISA_XBAR_MCDECS_MCMAIN_Data_WID (32)
+ #define MCDECS_CR_VISA_XBAR_MCDECS_MCMAIN_Data_MSK (0xFFFFFFFF)
+ #define MCDECS_CR_VISA_XBAR_MCDECS_MCMAIN_Data_MAX (0xFFFFFFFF)
+ #define MCDECS_CR_VISA_XBAR_MCDECS_MCMAIN_Data_DEF (0x76543210)
+
+#define MCDECS_CR_MC_LOCK_MCMAIN_REG (0x000050FC)
+ #define MCDECS_CR_MC_LOCK_MCMAIN_lock_addr_map_OFF ( 0)
+ #define MCDECS_CR_MC_LOCK_MCMAIN_lock_addr_map_WID ( 1)
+ #define MCDECS_CR_MC_LOCK_MCMAIN_lock_addr_map_MSK (0x00000001)
+ #define MCDECS_CR_MC_LOCK_MCMAIN_lock_addr_map_MAX (0x00000001)
+ #define MCDECS_CR_MC_LOCK_MCMAIN_lock_addr_map_DEF (0x00000000)
+ #define MCDECS_CR_MC_LOCK_MCMAIN_lock_mc_config_OFF ( 1)
+ #define MCDECS_CR_MC_LOCK_MCMAIN_lock_mc_config_WID ( 1)
+ #define MCDECS_CR_MC_LOCK_MCMAIN_lock_mc_config_MSK (0x00000002)
+ #define MCDECS_CR_MC_LOCK_MCMAIN_lock_mc_config_MAX (0x00000001)
+ #define MCDECS_CR_MC_LOCK_MCMAIN_lock_mc_config_DEF (0x00000000)
+ #define MCDECS_CR_MC_LOCK_MCMAIN_lock_iosav_init_OFF ( 2)
+ #define MCDECS_CR_MC_LOCK_MCMAIN_lock_iosav_init_WID ( 1)
+ #define MCDECS_CR_MC_LOCK_MCMAIN_lock_iosav_init_MSK (0x00000004)
+ #define MCDECS_CR_MC_LOCK_MCMAIN_lock_iosav_init_MAX (0x00000001)
+ #define MCDECS_CR_MC_LOCK_MCMAIN_lock_iosav_init_DEF (0x00000000)
+ #define MCDECS_CR_MC_LOCK_MCMAIN_lock_pwr_mngment_OFF ( 3)
+ #define MCDECS_CR_MC_LOCK_MCMAIN_lock_pwr_mngment_WID ( 1)
+ #define MCDECS_CR_MC_LOCK_MCMAIN_lock_pwr_mngment_MSK (0x00000008)
+ #define MCDECS_CR_MC_LOCK_MCMAIN_lock_pwr_mngment_MAX (0x00000001)
+ #define MCDECS_CR_MC_LOCK_MCMAIN_lock_pwr_mngment_DEF (0x00000000)
+ #define MCDECS_CR_MC_LOCK_MCMAIN_lock_mc_dft_OFF ( 7)
+ #define MCDECS_CR_MC_LOCK_MCMAIN_lock_mc_dft_WID ( 1)
+ #define MCDECS_CR_MC_LOCK_MCMAIN_lock_mc_dft_MSK (0x00000080)
+ #define MCDECS_CR_MC_LOCK_MCMAIN_lock_mc_dft_MAX (0x00000001)
+ #define MCDECS_CR_MC_LOCK_MCMAIN_lock_mc_dft_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_TC_BANK_REG (0x00004000)
+ #define MCHBAR_CH0_CR_TC_BANK_tRCD_OFF ( 0)
+ #define MCHBAR_CH0_CR_TC_BANK_tRCD_WID ( 5)
+ #define MCHBAR_CH0_CR_TC_BANK_tRCD_MSK (0x0000001F)
+ #define MCHBAR_CH0_CR_TC_BANK_tRCD_MAX (0x0000001F)
+ #define MCHBAR_CH0_CR_TC_BANK_tRCD_DEF (0x00000006)
+ #define MCHBAR_CH0_CR_TC_BANK_tRP_OFF ( 5)
+ #define MCHBAR_CH0_CR_TC_BANK_tRP_WID ( 5)
+ #define MCHBAR_CH0_CR_TC_BANK_tRP_MSK (0x000003E0)
+ #define MCHBAR_CH0_CR_TC_BANK_tRP_MAX (0x0000001F)
+ #define MCHBAR_CH0_CR_TC_BANK_tRP_DEF (0x00000006)
+ #define MCHBAR_CH0_CR_TC_BANK_tRAS_OFF (10)
+ #define MCHBAR_CH0_CR_TC_BANK_tRAS_WID ( 6)
+ #define MCHBAR_CH0_CR_TC_BANK_tRAS_MSK (0x0000FC00)
+ #define MCHBAR_CH0_CR_TC_BANK_tRAS_MAX (0x0000003F)
+ #define MCHBAR_CH0_CR_TC_BANK_tRAS_DEF (0x00000014)
+ #define MCHBAR_CH0_CR_TC_BANK_tRDPRE_OFF (16)
+ #define MCHBAR_CH0_CR_TC_BANK_tRDPRE_WID ( 4)
+ #define MCHBAR_CH0_CR_TC_BANK_tRDPRE_MSK (0x000F0000)
+ #define MCHBAR_CH0_CR_TC_BANK_tRDPRE_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_TC_BANK_tRDPRE_DEF (0x00000004)
+ #define MCHBAR_CH0_CR_TC_BANK_tWRPRE_OFF (20)
+ #define MCHBAR_CH0_CR_TC_BANK_tWRPRE_WID ( 6)
+ #define MCHBAR_CH0_CR_TC_BANK_tWRPRE_MSK (0x03F00000)
+ #define MCHBAR_CH0_CR_TC_BANK_tWRPRE_MAX (0x0000003F)
+ #define MCHBAR_CH0_CR_TC_BANK_tWRPRE_DEF (0x00000004)
+ #define MCHBAR_CH0_CR_TC_BANK_tRRD_OFF (26)
+ #define MCHBAR_CH0_CR_TC_BANK_tRRD_WID ( 4)
+ #define MCHBAR_CH0_CR_TC_BANK_tRRD_MSK (0x3C000000)
+ #define MCHBAR_CH0_CR_TC_BANK_tRRD_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_TC_BANK_tRRD_DEF (0x00000004)
+ #define MCHBAR_CH0_CR_TC_BANK_tRPab_ext_OFF (30)
+ #define MCHBAR_CH0_CR_TC_BANK_tRPab_ext_WID ( 2)
+ #define MCHBAR_CH0_CR_TC_BANK_tRPab_ext_MSK (0xC0000000)
+ #define MCHBAR_CH0_CR_TC_BANK_tRPab_ext_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_TC_BANK_tRPab_ext_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_TC_BANK_RANK_A_REG (0x00004004)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_A_tCKE_OFF ( 0)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_A_tCKE_WID ( 4)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_A_tCKE_MSK (0x0000000F)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_A_tCKE_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_A_tCKE_DEF (0x00000003)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_A_tFAW_OFF ( 4)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_A_tFAW_WID ( 8)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_A_tFAW_MSK (0x00000FF0)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_A_tFAW_MAX (0x000000FF)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_A_tFAW_DEF (0x00000010)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_A_tRDRD_OFF (12)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_A_tRDRD_WID ( 3)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_A_tRDRD_MSK (0x00007000)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_A_tRDRD_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_A_tRDRD_DEF (0x00000004)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_A_tRDRD_dr_OFF (15)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_A_tRDRD_dr_WID ( 4)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_A_tRDRD_dr_MSK (0x00078000)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_A_tRDRD_dr_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_A_tRDRD_dr_DEF (0x00000004)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_A_tRDRD_dd_OFF (19)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_A_tRDRD_dd_WID ( 4)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_A_tRDRD_dd_MSK (0x00780000)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_A_tRDRD_dd_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_A_tRDRD_dd_DEF (0x00000004)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_A_tRDPDEN_OFF (23)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_A_tRDPDEN_WID ( 5)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_A_tRDPDEN_MSK (0x0F800000)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_A_tRDPDEN_MAX (0x0000001F)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_A_tRDPDEN_DEF (0x00000004)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_A_CMD_3st_OFF (29)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_A_CMD_3st_WID ( 1)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_A_CMD_3st_MSK (0x20000000)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_A_CMD_3st_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_A_CMD_3st_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_A_CMD_stretch_OFF (30)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_A_CMD_stretch_WID ( 2)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_A_CMD_stretch_MSK (0xC0000000)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_A_CMD_stretch_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_A_CMD_stretch_DEF (0x00000002)
+
+#define MCHBAR_CH0_CR_TC_BANK_RANK_B_REG (0x00004008)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRRD_OFF ( 0)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRRD_WID ( 6)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRRD_MSK (0x0000003F)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRRD_MAX (0x0000003F)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRRD_DEF (0x00000005)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRRD_dr_OFF ( 6)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRRD_dr_WID ( 4)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRRD_dr_MSK (0x000003C0)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRRD_dr_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRRD_dr_DEF (0x00000005)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRRD_dd_OFF (10)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRRD_dd_WID ( 4)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRRD_dd_MSK (0x00003C00)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRRD_dd_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRRD_dd_DEF (0x00000005)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRWR_OFF (14)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRWR_WID ( 3)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRWR_MSK (0x0001C000)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRWR_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRWR_DEF (0x00000005)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRWR_dr_OFF (17)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRWR_dr_WID ( 4)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRWR_dr_MSK (0x001E0000)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRWR_dr_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRWR_dr_DEF (0x00000005)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRWR_dd_OFF (21)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRWR_dd_WID ( 4)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRWR_dd_MSK (0x01E00000)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRWR_dd_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRWR_dd_DEF (0x00000005)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRPDEN_OFF (25)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRPDEN_WID ( 6)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRPDEN_MSK (0x7E000000)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRPDEN_MAX (0x0000003F)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRPDEN_DEF (0x00000005)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_B_Dec_WRD_OFF (31)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_B_Dec_WRD_WID ( 1)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_B_Dec_WRD_MSK (0x80000000)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_B_Dec_WRD_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_B_Dec_WRD_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_TC_BANK_RANK_C_REG (0x0000400C)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_C_tXPDLL_OFF ( 0)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_C_tXPDLL_WID ( 6)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_C_tXPDLL_MSK (0x0000003F)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_C_tXPDLL_MAX (0x0000003F)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_C_tXPDLL_DEF (0x0000000A)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_C_tXP_OFF ( 6)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_C_tXP_WID ( 4)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_C_tXP_MSK (0x000003C0)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_C_tXP_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_C_tXP_DEF (0x00000003)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_C_TAONPD_OFF (10)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_C_TAONPD_WID ( 4)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_C_TAONPD_MSK (0x00003C00)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_C_TAONPD_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_C_TAONPD_DEF (0x00000009)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_C_tRDWR_OFF (14)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_C_tRDWR_WID ( 5)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_C_tRDWR_MSK (0x0007C000)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_C_tRDWR_MAX (0x0000001F)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_C_tRDWR_DEF (0x00000005)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_C_tRDWR_dr_OFF (19)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_C_tRDWR_dr_WID ( 5)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_C_tRDWR_dr_MSK (0x00F80000)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_C_tRDWR_dr_MAX (0x0000001F)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_C_tRDWR_dr_DEF (0x00000005)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_C_tRDWR_dd_OFF (24)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_C_tRDWR_dd_WID ( 5)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_C_tRDWR_dd_MSK (0x1F000000)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_C_tRDWR_dd_MAX (0x0000001F)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_C_tRDWR_dd_DEF (0x00000005)
+
+#define MCHBAR_CH0_CR_CMD_RATE_REG (0x00004010)
+ #define MCHBAR_CH0_CR_CMD_RATE_enable_cmd_rate_limit_OFF ( 0)
+ #define MCHBAR_CH0_CR_CMD_RATE_enable_cmd_rate_limit_WID ( 1)
+ #define MCHBAR_CH0_CR_CMD_RATE_enable_cmd_rate_limit_MSK (0x00000001)
+ #define MCHBAR_CH0_CR_CMD_RATE_enable_cmd_rate_limit_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_CMD_RATE_enable_cmd_rate_limit_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_CMD_RATE_cmd_rate_limit_OFF ( 1)
+ #define MCHBAR_CH0_CR_CMD_RATE_cmd_rate_limit_WID ( 3)
+ #define MCHBAR_CH0_CR_CMD_RATE_cmd_rate_limit_MSK (0x0000000E)
+ #define MCHBAR_CH0_CR_CMD_RATE_cmd_rate_limit_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_CMD_RATE_cmd_rate_limit_DEF (0x00000004)
+ #define MCHBAR_CH0_CR_CMD_RATE_reset_on_command_OFF ( 4)
+ #define MCHBAR_CH0_CR_CMD_RATE_reset_on_command_WID ( 4)
+ #define MCHBAR_CH0_CR_CMD_RATE_reset_on_command_MSK (0x000000F0)
+ #define MCHBAR_CH0_CR_CMD_RATE_reset_on_command_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_CMD_RATE_reset_on_command_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_CMD_RATE_reset_delay_OFF ( 8)
+ #define MCHBAR_CH0_CR_CMD_RATE_reset_delay_WID ( 4)
+ #define MCHBAR_CH0_CR_CMD_RATE_reset_delay_MSK (0x00000F00)
+ #define MCHBAR_CH0_CR_CMD_RATE_reset_delay_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_CMD_RATE_reset_delay_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_CMD_RATE_ck_to_cke_delay_OFF (12)
+ #define MCHBAR_CH0_CR_CMD_RATE_ck_to_cke_delay_WID ( 2)
+ #define MCHBAR_CH0_CR_CMD_RATE_ck_to_cke_delay_MSK (0x00003000)
+ #define MCHBAR_CH0_CR_CMD_RATE_ck_to_cke_delay_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_CMD_RATE_ck_to_cke_delay_DEF (0x00000001)
+ #define MCHBAR_CH0_CR_CMD_RATE_spare_OFF (14)
+ #define MCHBAR_CH0_CR_CMD_RATE_spare_WID (17)
+ #define MCHBAR_CH0_CR_CMD_RATE_spare_MSK (0x7FFFC000)
+ #define MCHBAR_CH0_CR_CMD_RATE_spare_MAX (0x0001FFFF)
+ #define MCHBAR_CH0_CR_CMD_RATE_spare_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_CMD_RATE_init_mrw_2n_cs_OFF (31)
+ #define MCHBAR_CH0_CR_CMD_RATE_init_mrw_2n_cs_WID ( 1)
+ #define MCHBAR_CH0_CR_CMD_RATE_init_mrw_2n_cs_MSK (0x80000000)
+ #define MCHBAR_CH0_CR_CMD_RATE_init_mrw_2n_cs_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_CMD_RATE_init_mrw_2n_cs_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_TC_BANK_RANK_D_REG (0x00004014)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_tCL_OFF ( 0)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_tCL_WID ( 5)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_tCL_MSK (0x0000001F)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_tCL_MAX (0x0000001F)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_tCL_DEF (0x00000006)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_tWCL_OFF ( 5)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_tWCL_WID ( 5)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_tWCL_MSK (0x000003E0)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_tWCL_MAX (0x0000001F)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_tWCL_DEF (0x00000006)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_tCPDED_OFF (10)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_tCPDED_WID ( 2)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_tCPDED_MSK (0x00000C00)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_tCPDED_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_tCPDED_DEF (0x00000001)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_tPRPDEN_OFF (12)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_tPRPDEN_WID ( 2)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_tPRPDEN_MSK (0x00003000)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_tPRPDEN_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_tPRPDEN_DEF (0x00000001)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_Odt_Read_Delay_OFF (14)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_Odt_Read_Delay_WID ( 3)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_Odt_Read_Delay_MSK (0x0001C000)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_Odt_Read_Delay_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_Odt_Read_Delay_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_Odt_Read_Duration_OFF (17)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_Odt_Read_Duration_WID ( 2)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_Odt_Read_Duration_MSK (0x00060000)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_Odt_Read_Duration_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_Odt_Read_Duration_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_Odt_Write_Duration_OFF (19)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_Odt_Write_Duration_WID ( 2)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_Odt_Write_Duration_MSK (0x00180000)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_Odt_Write_Duration_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_Odt_Write_Duration_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_Odt_Write_Duration_Ult_OFF (19)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_Odt_Write_Duration_Ult_WID ( 3)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_Odt_Write_Duration_Ult_MSK (0x00380000)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_Odt_Write_Duration_Ult_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_Odt_Write_Duration_Ult_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_Odt_Write_Delay_Ult_OFF (22)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_Odt_Write_Delay_Ult_WID ( 3)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_Odt_Write_Delay_Ult_MSK (0x01C00000)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_Odt_Write_Delay_Ult_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_Odt_Write_Delay_Ult_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_Odt_Always_Rank0_Ult_OFF (25)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_Odt_Always_Rank0_Ult_WID ( 1)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_Odt_Always_Rank0_Ult_MSK (0x02000000)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_Odt_Always_Rank0_Ult_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_Odt_Always_Rank0_Ult_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_cmd_delay_Ult_OFF (26)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_cmd_delay_Ult_WID ( 2)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_cmd_delay_Ult_MSK (0x0C000000)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_cmd_delay_Ult_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_TC_BANK_RANK_D_cmd_delay_Ult_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_SCHED_CBIT_REG (0x00004020)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_opp_cas_OFF ( 0)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_opp_cas_WID ( 1)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_opp_cas_MSK (0x00000001)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_opp_cas_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_opp_cas_DEF (0x00000001)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_opp_is_cas_OFF ( 1)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_opp_is_cas_WID ( 1)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_opp_is_cas_MSK (0x00000002)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_opp_is_cas_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_opp_is_cas_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_opp_ras_OFF ( 2)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_opp_ras_WID ( 1)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_opp_ras_MSK (0x00000004)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_opp_ras_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_opp_ras_DEF (0x00000001)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_opp_is_ras_OFF ( 3)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_opp_is_ras_WID ( 1)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_opp_is_ras_MSK (0x00000008)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_opp_is_ras_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_opp_is_ras_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_1c_byp_OFF ( 4)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_1c_byp_WID ( 1)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_1c_byp_MSK (0x00000010)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_1c_byp_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_1c_byp_DEF (0x00000001)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_2c_byp_OFF ( 5)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_2c_byp_WID ( 1)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_2c_byp_MSK (0x00000020)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_2c_byp_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_2c_byp_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_deprd_opt_OFF ( 6)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_deprd_opt_WID ( 1)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_deprd_opt_MSK (0x00000040)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_deprd_opt_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_deprd_opt_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_pt_it_OFF ( 7)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_pt_it_WID ( 1)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_pt_it_MSK (0x00000080)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_pt_it_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_pt_it_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_prcnt_ring_OFF ( 8)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_prcnt_ring_WID ( 1)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_prcnt_ring_MSK (0x00000100)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_prcnt_ring_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_prcnt_ring_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_prcnt_sa_OFF ( 9)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_prcnt_sa_WID ( 1)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_prcnt_sa_MSK (0x00000200)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_prcnt_sa_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_prcnt_sa_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_blkr_ph_OFF (10)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_blkr_ph_WID ( 1)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_blkr_ph_MSK (0x00000400)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_blkr_ph_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_blkr_ph_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_blkr_pe_OFF (11)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_blkr_pe_WID ( 1)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_blkr_pe_MSK (0x00000800)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_blkr_pe_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_blkr_pe_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_blkr_pm_OFF (12)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_blkr_pm_WID ( 1)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_blkr_pm_MSK (0x00001000)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_blkr_pm_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_blkr_pm_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_odt_OFF (13)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_odt_WID ( 1)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_odt_MSK (0x00002000)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_odt_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_odt_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_OE_alw_off_OFF (14)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_OE_alw_off_WID ( 1)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_OE_alw_off_MSK (0x00004000)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_OE_alw_off_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_OE_alw_off_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_aom_OFF (16)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_aom_WID ( 1)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_aom_MSK (0x00010000)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_aom_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_aom_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_block_rpq_OFF (17)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_block_rpq_WID ( 1)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_block_rpq_MSK (0x00020000)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_block_rpq_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_block_rpq_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_block_wpq_OFF (18)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_block_wpq_WID ( 1)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_block_wpq_MSK (0x00040000)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_block_wpq_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_block_wpq_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_invert_align_OFF (19)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_invert_align_WID ( 1)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_invert_align_MSK (0x00080000)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_invert_align_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_invert_align_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_write_gap_OFF (20)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_write_gap_WID ( 1)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_write_gap_MSK (0x00100000)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_write_gap_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_write_gap_DEF (0x00000001)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_zq_OFF (21)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_zq_WID ( 1)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_zq_MSK (0x00200000)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_zq_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_zq_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_tt_OFF (22)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_tt_WID ( 1)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_tt_MSK (0x00400000)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_tt_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_tt_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_opp_ref_OFF (23)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_opp_ref_WID ( 1)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_opp_ref_MSK (0x00800000)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_opp_ref_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_opp_ref_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_Long_ZQ_OFF (24)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_Long_ZQ_WID ( 1)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_Long_ZQ_MSK (0x01000000)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_Long_ZQ_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_Long_ZQ_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_srx_zq_OFF (25)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_srx_zq_WID ( 1)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_srx_zq_MSK (0x02000000)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_srx_zq_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_srx_zq_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_Serialize_ZQ_OFF (26)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_Serialize_ZQ_WID ( 1)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_Serialize_ZQ_MSK (0x04000000)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_Serialize_ZQ_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_Serialize_ZQ_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_ZQ_fast_exec_OFF (27)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_ZQ_fast_exec_WID ( 1)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_ZQ_fast_exec_MSK (0x08000000)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_ZQ_fast_exec_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_ZQ_fast_exec_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_Dis_DriveNop_OFF (28)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_Dis_DriveNop_WID ( 1)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_Dis_DriveNop_MSK (0x10000000)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_Dis_DriveNop_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_Dis_DriveNop_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_Pres_WDB_Ent_OFF (29)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_Pres_WDB_Ent_WID ( 1)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_Pres_WDB_Ent_MSK (0x20000000)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_Pres_WDB_Ent_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_Pres_WDB_Ent_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_clk_gate_OFF (30)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_clk_gate_WID ( 1)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_clk_gate_MSK (0x40000000)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_clk_gate_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_SCHED_CBIT_dis_clk_gate_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_SC_ROUNDT_LAT_REG (0x00004024)
+ #define MCHBAR_CH0_CR_SC_ROUNDT_LAT_Lat_R0D0_OFF ( 0)
+ #define MCHBAR_CH0_CR_SC_ROUNDT_LAT_Lat_R0D0_WID ( 6)
+ #define MCHBAR_CH0_CR_SC_ROUNDT_LAT_Lat_R0D0_MSK (0x0000003F)
+ #define MCHBAR_CH0_CR_SC_ROUNDT_LAT_Lat_R0D0_MAX (0x0000003F)
+ #define MCHBAR_CH0_CR_SC_ROUNDT_LAT_Lat_R0D0_DEF (0x00000020)
+ #define MCHBAR_CH0_CR_SC_ROUNDT_LAT_Lat_R1D0_OFF ( 8)
+ #define MCHBAR_CH0_CR_SC_ROUNDT_LAT_Lat_R1D0_WID ( 6)
+ #define MCHBAR_CH0_CR_SC_ROUNDT_LAT_Lat_R1D0_MSK (0x00003F00)
+ #define MCHBAR_CH0_CR_SC_ROUNDT_LAT_Lat_R1D0_MAX (0x0000003F)
+ #define MCHBAR_CH0_CR_SC_ROUNDT_LAT_Lat_R1D0_DEF (0x00000020)
+ #define MCHBAR_CH0_CR_SC_ROUNDT_LAT_Lat_R0D1_OFF (16)
+ #define MCHBAR_CH0_CR_SC_ROUNDT_LAT_Lat_R0D1_WID ( 6)
+ #define MCHBAR_CH0_CR_SC_ROUNDT_LAT_Lat_R0D1_MSK (0x003F0000)
+ #define MCHBAR_CH0_CR_SC_ROUNDT_LAT_Lat_R0D1_MAX (0x0000003F)
+ #define MCHBAR_CH0_CR_SC_ROUNDT_LAT_Lat_R0D1_DEF (0x00000020)
+ #define MCHBAR_CH0_CR_SC_ROUNDT_LAT_Lat_R1D1_OFF (24)
+ #define MCHBAR_CH0_CR_SC_ROUNDT_LAT_Lat_R1D1_WID ( 6)
+ #define MCHBAR_CH0_CR_SC_ROUNDT_LAT_Lat_R1D1_MSK (0x3F000000)
+ #define MCHBAR_CH0_CR_SC_ROUNDT_LAT_Lat_R1D1_MAX (0x0000003F)
+ #define MCHBAR_CH0_CR_SC_ROUNDT_LAT_Lat_R1D1_DEF (0x00000020)
+
+#define MCHBAR_CH0_CR_SC_IO_LATENCY_REG (0x00004028)
+ #define MCHBAR_CH0_CR_SC_IO_LATENCY_IOLAT_R0D0_OFF ( 0)
+ #define MCHBAR_CH0_CR_SC_IO_LATENCY_IOLAT_R0D0_WID ( 4)
+ #define MCHBAR_CH0_CR_SC_IO_LATENCY_IOLAT_R0D0_MSK (0x0000000F)
+ #define MCHBAR_CH0_CR_SC_IO_LATENCY_IOLAT_R0D0_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_SC_IO_LATENCY_IOLAT_R0D0_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_SC_IO_LATENCY_IOLAT_R1D0_OFF ( 4)
+ #define MCHBAR_CH0_CR_SC_IO_LATENCY_IOLAT_R1D0_WID ( 4)
+ #define MCHBAR_CH0_CR_SC_IO_LATENCY_IOLAT_R1D0_MSK (0x000000F0)
+ #define MCHBAR_CH0_CR_SC_IO_LATENCY_IOLAT_R1D0_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_SC_IO_LATENCY_IOLAT_R1D0_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_SC_IO_LATENCY_IOLAT_R0D1_OFF ( 8)
+ #define MCHBAR_CH0_CR_SC_IO_LATENCY_IOLAT_R0D1_WID ( 4)
+ #define MCHBAR_CH0_CR_SC_IO_LATENCY_IOLAT_R0D1_MSK (0x00000F00)
+ #define MCHBAR_CH0_CR_SC_IO_LATENCY_IOLAT_R0D1_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_SC_IO_LATENCY_IOLAT_R0D1_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_SC_IO_LATENCY_IOLAT_R1D1_OFF (12)
+ #define MCHBAR_CH0_CR_SC_IO_LATENCY_IOLAT_R1D1_WID ( 4)
+ #define MCHBAR_CH0_CR_SC_IO_LATENCY_IOLAT_R1D1_MSK (0x0000F000)
+ #define MCHBAR_CH0_CR_SC_IO_LATENCY_IOLAT_R1D1_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_SC_IO_LATENCY_IOLAT_R1D1_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_SC_IO_LATENCY_RT_IOCOMP_OFF (16)
+ #define MCHBAR_CH0_CR_SC_IO_LATENCY_RT_IOCOMP_WID ( 6)
+ #define MCHBAR_CH0_CR_SC_IO_LATENCY_RT_IOCOMP_MSK (0x003F0000)
+ #define MCHBAR_CH0_CR_SC_IO_LATENCY_RT_IOCOMP_MAX (0x0000003F)
+ #define MCHBAR_CH0_CR_SC_IO_LATENCY_RT_IOCOMP_DEF (0x0000000E)
+ #define MCHBAR_CH0_CR_SC_IO_LATENCY_three_channels_OFF (30)
+ #define MCHBAR_CH0_CR_SC_IO_LATENCY_three_channels_WID ( 1)
+ #define MCHBAR_CH0_CR_SC_IO_LATENCY_three_channels_MSK (0x40000000)
+ #define MCHBAR_CH0_CR_SC_IO_LATENCY_three_channels_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_SC_IO_LATENCY_three_channels_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_SC_IO_LATENCY_DIS_RT_CLK_GATE_OFF (31)
+ #define MCHBAR_CH0_CR_SC_IO_LATENCY_DIS_RT_CLK_GATE_WID ( 1)
+ #define MCHBAR_CH0_CR_SC_IO_LATENCY_DIS_RT_CLK_GATE_MSK (0x80000000)
+ #define MCHBAR_CH0_CR_SC_IO_LATENCY_DIS_RT_CLK_GATE_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_SC_IO_LATENCY_DIS_RT_CLK_GATE_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_ROUND_TRIP_DFT_DATA_REG (0x0000402C)
+ #define MCHBAR_CH0_CR_ROUND_TRIP_DFT_DATA_DATA_OFF ( 0)
+ #define MCHBAR_CH0_CR_ROUND_TRIP_DFT_DATA_DATA_WID (32)
+ #define MCHBAR_CH0_CR_ROUND_TRIP_DFT_DATA_DATA_MSK (0xFFFFFFFF)
+ #define MCHBAR_CH0_CR_ROUND_TRIP_DFT_DATA_DATA_MAX (0xFFFFFFFF)
+ #define MCHBAR_CH0_CR_ROUND_TRIP_DFT_DATA_DATA_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_DFT_MISC_REG (0x00004030)
+ #define MCHBAR_CH0_CR_DFT_MISC_WDAR_OFF ( 0)
+ #define MCHBAR_CH0_CR_DFT_MISC_WDAR_WID ( 1)
+ #define MCHBAR_CH0_CR_DFT_MISC_WDAR_MSK (0x00000001)
+ #define MCHBAR_CH0_CR_DFT_MISC_WDAR_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_DFT_MISC_WDAR_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_DFT_MISC_safe_mask_sel_OFF ( 1)
+ #define MCHBAR_CH0_CR_DFT_MISC_safe_mask_sel_WID ( 3)
+ #define MCHBAR_CH0_CR_DFT_MISC_safe_mask_sel_MSK (0x0000000E)
+ #define MCHBAR_CH0_CR_DFT_MISC_safe_mask_sel_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_DFT_MISC_safe_mask_sel_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_DFT_MISC_force_rcv_en_OFF ( 4)
+ #define MCHBAR_CH0_CR_DFT_MISC_force_rcv_en_WID ( 1)
+ #define MCHBAR_CH0_CR_DFT_MISC_force_rcv_en_MSK (0x00000010)
+ #define MCHBAR_CH0_CR_DFT_MISC_force_rcv_en_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_DFT_MISC_force_rcv_en_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_DFT_MISC_DDR_QUAL_OFF ( 8)
+ #define MCHBAR_CH0_CR_DFT_MISC_DDR_QUAL_WID ( 2)
+ #define MCHBAR_CH0_CR_DFT_MISC_DDR_QUAL_MSK (0x00000300)
+ #define MCHBAR_CH0_CR_DFT_MISC_DDR_QUAL_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_DFT_MISC_DDR_QUAL_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_DFT_MISC_Qual_length_OFF (10)
+ #define MCHBAR_CH0_CR_DFT_MISC_Qual_length_WID ( 2)
+ #define MCHBAR_CH0_CR_DFT_MISC_Qual_length_MSK (0x00000C00)
+ #define MCHBAR_CH0_CR_DFT_MISC_Qual_length_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_DFT_MISC_Qual_length_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_DFT_MISC_WDB_Block_En_OFF (12)
+ #define MCHBAR_CH0_CR_DFT_MISC_WDB_Block_En_WID ( 1)
+ #define MCHBAR_CH0_CR_DFT_MISC_WDB_Block_En_MSK (0x00001000)
+ #define MCHBAR_CH0_CR_DFT_MISC_WDB_Block_En_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_DFT_MISC_WDB_Block_En_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_DFT_MISC_RT_DFT_READ_PTR_OFF (13)
+ #define MCHBAR_CH0_CR_DFT_MISC_RT_DFT_READ_PTR_WID ( 4)
+ #define MCHBAR_CH0_CR_DFT_MISC_RT_DFT_READ_PTR_MSK (0x0001E000)
+ #define MCHBAR_CH0_CR_DFT_MISC_RT_DFT_READ_PTR_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_DFT_MISC_RT_DFT_READ_PTR_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_DFT_MISC_RT_DFT_READ_ENABLE_OFF (17)
+ #define MCHBAR_CH0_CR_DFT_MISC_RT_DFT_READ_ENABLE_WID ( 1)
+ #define MCHBAR_CH0_CR_DFT_MISC_RT_DFT_READ_ENABLE_MSK (0x00020000)
+ #define MCHBAR_CH0_CR_DFT_MISC_RT_DFT_READ_ENABLE_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_DFT_MISC_RT_DFT_READ_ENABLE_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_DFT_MISC_RT_DFT_READ_SEL_ADDR_OFF (18)
+ #define MCHBAR_CH0_CR_DFT_MISC_RT_DFT_READ_SEL_ADDR_WID ( 1)
+ #define MCHBAR_CH0_CR_DFT_MISC_RT_DFT_READ_SEL_ADDR_MSK (0x00040000)
+ #define MCHBAR_CH0_CR_DFT_MISC_RT_DFT_READ_SEL_ADDR_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_DFT_MISC_RT_DFT_READ_SEL_ADDR_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_READ_RETURN_DFT_REG (0x00004034)
+ #define MCHBAR_CH0_CR_READ_RETURN_DFT_ECC_OFF ( 0)
+ #define MCHBAR_CH0_CR_READ_RETURN_DFT_ECC_WID ( 8)
+ #define MCHBAR_CH0_CR_READ_RETURN_DFT_ECC_MSK (0x000000FF)
+ #define MCHBAR_CH0_CR_READ_RETURN_DFT_ECC_MAX (0x000000FF)
+ #define MCHBAR_CH0_CR_READ_RETURN_DFT_ECC_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_READ_RETURN_DFT_RRD_DFT_Mode_OFF ( 8)
+ #define MCHBAR_CH0_CR_READ_RETURN_DFT_RRD_DFT_Mode_WID ( 2)
+ #define MCHBAR_CH0_CR_READ_RETURN_DFT_RRD_DFT_Mode_MSK (0x00000300)
+ #define MCHBAR_CH0_CR_READ_RETURN_DFT_RRD_DFT_Mode_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_READ_RETURN_DFT_RRD_DFT_Mode_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_READ_RETURN_DFT_LFSR_Seed_Index_OFF (10)
+ #define MCHBAR_CH0_CR_READ_RETURN_DFT_LFSR_Seed_Index_WID ( 5)
+ #define MCHBAR_CH0_CR_READ_RETURN_DFT_LFSR_Seed_Index_MSK (0x00007C00)
+ #define MCHBAR_CH0_CR_READ_RETURN_DFT_LFSR_Seed_Index_MAX (0x0000001F)
+ #define MCHBAR_CH0_CR_READ_RETURN_DFT_LFSR_Seed_Index_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_READ_RETURN_DFT_Inversion_Mode_OFF (15)
+ #define MCHBAR_CH0_CR_READ_RETURN_DFT_Inversion_Mode_WID ( 1)
+ #define MCHBAR_CH0_CR_READ_RETURN_DFT_Inversion_Mode_MSK (0x00008000)
+ #define MCHBAR_CH0_CR_READ_RETURN_DFT_Inversion_Mode_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_READ_RETURN_DFT_Inversion_Mode_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_SCHED_SECOND_CBIT_REG (0x00004038)
+ #define MCHBAR_CH0_CR_SCHED_SECOND_CBIT_dis_imph_error_OFF ( 0)
+ #define MCHBAR_CH0_CR_SCHED_SECOND_CBIT_dis_imph_error_WID ( 1)
+ #define MCHBAR_CH0_CR_SCHED_SECOND_CBIT_dis_imph_error_MSK (0x00000001)
+ #define MCHBAR_CH0_CR_SCHED_SECOND_CBIT_dis_imph_error_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_SCHED_SECOND_CBIT_dis_imph_error_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_SCHED_SECOND_CBIT_dis_async_odt_OFF ( 8)
+ #define MCHBAR_CH0_CR_SCHED_SECOND_CBIT_dis_async_odt_WID ( 1)
+ #define MCHBAR_CH0_CR_SCHED_SECOND_CBIT_dis_async_odt_MSK (0x00000100)
+ #define MCHBAR_CH0_CR_SCHED_SECOND_CBIT_dis_async_odt_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_SCHED_SECOND_CBIT_dis_async_odt_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_REG (0x00004040)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux0_Control_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux0_Control_WID ( 2)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux0_Control_MSK (0x00000003)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux0_Control_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux0_Control_DEF (0x00000001)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux1_Control_OFF ( 3)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux1_Control_WID ( 2)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux1_Control_MSK (0x00000018)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux1_Control_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux1_Control_DEF (0x00000001)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux2_Control_OFF ( 6)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux2_Control_WID ( 2)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux2_Control_MSK (0x000000C0)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux2_Control_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux2_Control_DEF (0x00000001)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_ECC_Replace_Byte_Control_OFF (14)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_ECC_Replace_Byte_Control_WID ( 1)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_ECC_Replace_Byte_Control_MSK (0x00004000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_ECC_Replace_Byte_Control_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_ECC_Replace_Byte_Control_DEF (0x00000001)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_ECC_Data_Source_Sel_OFF (15)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_ECC_Data_Source_Sel_WID ( 1)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_ECC_Data_Source_Sel_MSK (0x00008000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_ECC_Data_Source_Sel_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_ECC_Data_Source_Sel_DEF (0x00000001)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Save_LFSR_Seed_Rate_OFF (16)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Save_LFSR_Seed_Rate_WID ( 6)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Save_LFSR_Seed_Rate_MSK (0x003F0000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Save_LFSR_Seed_Rate_MAX (0x0000003F)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Save_LFSR_Seed_Rate_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Reload_LFSR_Seed_Rate_OFF (24)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Reload_LFSR_Seed_Rate_WID ( 3)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Reload_LFSR_Seed_Rate_MSK (0x07000000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Reload_LFSR_Seed_Rate_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Reload_LFSR_Seed_Rate_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_RD_STATUS_REG (0x00004044)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_RD_STATUS_WDB_Current_Read_Pointer_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_RD_STATUS_WDB_Current_Read_Pointer_WID ( 6)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_RD_STATUS_WDB_Current_Read_Pointer_MSK (0x0000003F)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_RD_STATUS_WDB_Current_Read_Pointer_MAX (0x0000003F)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_RD_STATUS_WDB_Current_Read_Pointer_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_0_REG (0x00004048)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_0_Pattern_Buffer_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_0_Pattern_Buffer_WID (24)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_0_Pattern_Buffer_MSK (0x00FFFFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_0_Pattern_Buffer_MAX (0x00FFFFFF)
+
+#define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_1_REG (0x0000404C)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_1_Pattern_Buffer_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_1_Pattern_Buffer_WID (24)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_1_Pattern_Buffer_MSK (0x00FFFFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_1_Pattern_Buffer_MAX (0x00FFFFFF)
+
+#define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_2_REG (0x00004050)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_2_Pattern_Buffer_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_2_Pattern_Buffer_WID (24)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_2_Pattern_Buffer_MSK (0x00FFFFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_2_Pattern_Buffer_MAX (0x00FFFFFF)
+
+#define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_0_REG (0x00004054)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_0_Pattern_Buffer_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_0_Pattern_Buffer_WID (24)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_0_Pattern_Buffer_MSK (0x00FFFFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_0_Pattern_Buffer_MAX (0x00FFFFFF)
+
+#define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_1_REG (0x00004058)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_1_Pattern_Buffer_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_1_Pattern_Buffer_WID (24)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_1_Pattern_Buffer_MSK (0x00FFFFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_1_Pattern_Buffer_MAX (0x00FFFFFF)
+
+#define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_2_REG (0x0000405C)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_2_Pattern_Buffer_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_2_Pattern_Buffer_WID (24)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_2_Pattern_Buffer_MSK (0x00FFFFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_2_Pattern_Buffer_MAX (0x00FFFFFF)
+
+#define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_0_REG (0x00004060)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_0_Pattern_Buffer_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_0_Pattern_Buffer_WID (24)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_0_Pattern_Buffer_MSK (0x00FFFFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_0_Pattern_Buffer_MAX (0x00FFFFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_0_Pattern_Buffer_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_1_REG (0x00004064)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_1_Pattern_Buffer_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_1_Pattern_Buffer_WID (24)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_1_Pattern_Buffer_MSK (0x00FFFFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_1_Pattern_Buffer_MAX (0x00FFFFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_1_Pattern_Buffer_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_2_REG (0x00004068)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_2_Pattern_Buffer_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_2_Pattern_Buffer_WID (24)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_2_Pattern_Buffer_MSK (0x00FFFFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_2_Pattern_Buffer_MAX (0x00FFFFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_2_Pattern_Buffer_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_0_REG (0x0000406C)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_0_Pattern_Buffer_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_0_Pattern_Buffer_WID (24)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_0_Pattern_Buffer_MSK (0x00FFFFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_0_Pattern_Buffer_MAX (0x00FFFFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_0_Pattern_Buffer_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_1_REG (0x00004070)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_1_Pattern_Buffer_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_1_Pattern_Buffer_WID (24)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_1_Pattern_Buffer_MSK (0x00FFFFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_1_Pattern_Buffer_MAX (0x00FFFFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_1_Pattern_Buffer_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_2_REG (0x00004074)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_2_Pattern_Buffer_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_2_Pattern_Buffer_WID (24)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_2_Pattern_Buffer_MSK (0x00FFFFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_2_Pattern_Buffer_MAX (0x00FFFFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_2_Pattern_Buffer_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_REG (0x00004078)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_L_data_select_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_L_data_select_WID ( 1)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_L_data_select_MSK (0x00000001)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_L_data_select_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_L_data_select_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_Enable_Sweep_Frequency_OFF ( 1)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_Enable_Sweep_Frequency_WID ( 1)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_Enable_Sweep_Frequency_MSK (0x00000002)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_Enable_Sweep_Frequency_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_Enable_Sweep_Frequency_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_L_counter_OFF ( 8)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_L_counter_WID ( 8)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_L_counter_MSK (0x0000FF00)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_L_counter_MAX (0x000000FF)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_L_counter_DEF (0x00000001)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_M_counter_OFF (16)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_M_counter_WID ( 8)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_M_counter_MSK (0x00FF0000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_M_counter_MAX (0x000000FF)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_M_counter_DEF (0x00000001)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_N_counter_OFF (24)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_N_counter_WID ( 8)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_N_counter_MSK (0xFF000000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_N_counter_MAX (0x000000FF)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_N_counter_DEF (0x00000001)
+
+#define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_INV_REG (0x00004084)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_INV_ECC_Inv_or_DC_Enable_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_INV_ECC_Inv_or_DC_Enable_WID ( 8)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_INV_ECC_Inv_or_DC_Enable_MSK (0x000000FF)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_INV_ECC_Inv_or_DC_Enable_MAX (0x000000FF)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_INV_ECC_Inv_or_DC_Enable_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Shift_Rate_OFF (16)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Shift_Rate_WID ( 4)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Shift_Rate_MSK (0x000F0000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Shift_Rate_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Shift_Rate_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_INV_DC_Polarity_Control_OFF (20)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_INV_DC_Polarity_Control_WID ( 1)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_INV_DC_Polarity_Control_MSK (0x00100000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_INV_DC_Polarity_Control_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_INV_DC_Polarity_Control_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Control_OFF (30)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Control_WID ( 1)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Control_MSK (0x40000000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Control_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Control_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Shift_Enable_OFF (31)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Shift_Enable_WID ( 1)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Shift_Enable_MSK (0x80000000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Shift_Enable_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Shift_Enable_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_DATA_INV_REG (0x00004090)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_DATA_INV_Data_Inv_or_DC_Enable_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_DATA_INV_Data_Inv_or_DC_Enable_WID (64)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_DATA_INV_Data_Inv_or_DC_Enable_MSK (0xFFFFFFFFFFFFFFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_DATA_INV_Data_Inv_or_DC_Enable_MAX (0xFFFFFFFFFFFFFFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_DATA_INV_Data_Inv_or_DC_Enable_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_ERR_CTL_REG (0x00004098)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_CTL_Stop_on_Nth_Error_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_CTL_Stop_on_Nth_Error_WID ( 6)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_CTL_Stop_on_Nth_Error_MSK (0x0000003F)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_CTL_Stop_on_Nth_Error_MAX (0x0000003F)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_CTL_Stop_on_Nth_Error_DEF (0x00000001)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_CTL_Stop_On_Error_Control_OFF (12)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_CTL_Stop_On_Error_Control_WID ( 2)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_CTL_Stop_On_Error_Control_MSK (0x00003000)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_CTL_Stop_On_Error_Control_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_CTL_Stop_On_Error_Control_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_CTL_Selective_Error_Enable_Chunk_OFF (16)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_CTL_Selective_Error_Enable_Chunk_WID ( 8)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_CTL_Selective_Error_Enable_Chunk_MSK (0x00FF0000)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_CTL_Selective_Error_Enable_Chunk_MAX (0x000000FF)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_CTL_Selective_Error_Enable_Chunk_DEF (0x000000FF)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_CTL_Selective_Error_Enable_Cacheline_OFF (24)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_CTL_Selective_Error_Enable_Cacheline_WID ( 8)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_CTL_Selective_Error_Enable_Cacheline_MSK (0xFF000000)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_CTL_Selective_Error_Enable_Cacheline_MAX (0x000000FF)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_CTL_Selective_Error_Enable_Cacheline_DEF (0x000000FF)
+
+#define MCHBAR_CH0_CR_REUT_CH_ERR_ECC_MASK_REG (0x0000409C)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_ECC_MASK_ECC_Error_Mask_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_ECC_MASK_ECC_Error_Mask_WID ( 8)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_ECC_MASK_ECC_Error_Mask_MSK (0x000000FF)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_ECC_MASK_ECC_Error_Mask_MAX (0x000000FF)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_ECC_MASK_ECC_Error_Mask_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_STM_CONFIG_REG (0x000040A4)
+ #define MCHBAR_CH0_CR_STM_CONFIG_Stretch_mode_OFF ( 0)
+ #define MCHBAR_CH0_CR_STM_CONFIG_Stretch_mode_WID ( 2)
+ #define MCHBAR_CH0_CR_STM_CONFIG_Stretch_mode_MSK (0x00000003)
+ #define MCHBAR_CH0_CR_STM_CONFIG_Stretch_mode_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_STM_CONFIG_Stretch_mode_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_STM_CONFIG_STF_OFF ( 4)
+ #define MCHBAR_CH0_CR_STM_CONFIG_STF_WID ( 3)
+ #define MCHBAR_CH0_CR_STM_CONFIG_STF_MSK (0x00000070)
+ #define MCHBAR_CH0_CR_STM_CONFIG_STF_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_STM_CONFIG_STF_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_SC_PR_CNT_CONFIG_REG (0x000040A8)
+ #define MCHBAR_CH0_CR_SC_PR_CNT_CONFIG_Priority_count_ring_OFF ( 0)
+ #define MCHBAR_CH0_CR_SC_PR_CNT_CONFIG_Priority_count_ring_WID (10)
+ #define MCHBAR_CH0_CR_SC_PR_CNT_CONFIG_Priority_count_ring_MSK (0x000003FF)
+ #define MCHBAR_CH0_CR_SC_PR_CNT_CONFIG_Priority_count_ring_MAX (0x000003FF)
+ #define MCHBAR_CH0_CR_SC_PR_CNT_CONFIG_Priority_count_ring_DEF (0x00000040)
+ #define MCHBAR_CH0_CR_SC_PR_CNT_CONFIG_Priority_count_SA_OFF (16)
+ #define MCHBAR_CH0_CR_SC_PR_CNT_CONFIG_Priority_count_SA_WID (10)
+ #define MCHBAR_CH0_CR_SC_PR_CNT_CONFIG_Priority_count_SA_MSK (0x03FF0000)
+ #define MCHBAR_CH0_CR_SC_PR_CNT_CONFIG_Priority_count_SA_MAX (0x000003FF)
+ #define MCHBAR_CH0_CR_SC_PR_CNT_CONFIG_Priority_count_SA_DEF (0x00000100)
+
+#define MCHBAR_CH0_CR_SC_PCIT_REG (0x000040AC)
+ #define MCHBAR_CH0_CR_SC_PCIT_PCIT_OFF ( 0)
+ #define MCHBAR_CH0_CR_SC_PCIT_PCIT_WID ( 8)
+ #define MCHBAR_CH0_CR_SC_PCIT_PCIT_MSK (0x000000FF)
+ #define MCHBAR_CH0_CR_SC_PCIT_PCIT_MAX (0x000000FF)
+ #define MCHBAR_CH0_CR_SC_PCIT_PCIT_DEF (0x00000040)
+
+#define MCHBAR_CH0_CR_PM_PDWN_CONFIG_REG (0x000040B0)
+ #define MCHBAR_CH0_CR_PM_PDWN_CONFIG_PDWN_idle_counter_OFF ( 0)
+ #define MCHBAR_CH0_CR_PM_PDWN_CONFIG_PDWN_idle_counter_WID (12)
+ #define MCHBAR_CH0_CR_PM_PDWN_CONFIG_PDWN_idle_counter_MSK (0x00000FFF)
+ #define MCHBAR_CH0_CR_PM_PDWN_CONFIG_PDWN_idle_counter_MAX (0x00000FFF)
+ #define MCHBAR_CH0_CR_PM_PDWN_CONFIG_PDWN_idle_counter_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_PM_PDWN_CONFIG_PDWN_mode_OFF (12)
+ #define MCHBAR_CH0_CR_PM_PDWN_CONFIG_PDWN_mode_WID ( 4)
+ #define MCHBAR_CH0_CR_PM_PDWN_CONFIG_PDWN_mode_MSK (0x0000F000)
+ #define MCHBAR_CH0_CR_PM_PDWN_CONFIG_PDWN_mode_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_PM_PDWN_CONFIG_PDWN_mode_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_ECC_INJECT_COUNT_REG (0x000040B4)
+ #define MCHBAR_CH0_CR_ECC_INJECT_COUNT_Count_OFF ( 0)
+ #define MCHBAR_CH0_CR_ECC_INJECT_COUNT_Count_WID (32)
+ #define MCHBAR_CH0_CR_ECC_INJECT_COUNT_Count_MSK (0xFFFFFFFF)
+ #define MCHBAR_CH0_CR_ECC_INJECT_COUNT_Count_MAX (0xFFFFFFFF)
+ #define MCHBAR_CH0_CR_ECC_INJECT_COUNT_Count_DEF (0xFFFFFFFF)
+
+#define MCHBAR_CH0_CR_ECC_DFT_REG (0x000040B8)
+ #define MCHBAR_CH0_CR_ECC_DFT_ECC4ANA_fill_OFF ( 0)
+ #define MCHBAR_CH0_CR_ECC_DFT_ECC4ANA_fill_WID ( 8)
+ #define MCHBAR_CH0_CR_ECC_DFT_ECC4ANA_fill_MSK (0x000000FF)
+ #define MCHBAR_CH0_CR_ECC_DFT_ECC4ANA_fill_MAX (0x000000FF)
+ #define MCHBAR_CH0_CR_ECC_DFT_ECC4ANA_fill_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ECC_DFT_ECC4ANA_trigger_OFF ( 8)
+ #define MCHBAR_CH0_CR_ECC_DFT_ECC4ANA_trigger_WID ( 2)
+ #define MCHBAR_CH0_CR_ECC_DFT_ECC4ANA_trigger_MSK (0x00000300)
+ #define MCHBAR_CH0_CR_ECC_DFT_ECC4ANA_trigger_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_ECC_DFT_ECC4ANA_trigger_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ECC_DFT_ECC4ANA_BS_OFF (10)
+ #define MCHBAR_CH0_CR_ECC_DFT_ECC4ANA_BS_WID ( 1)
+ #define MCHBAR_CH0_CR_ECC_DFT_ECC4ANA_BS_MSK (0x00000400)
+ #define MCHBAR_CH0_CR_ECC_DFT_ECC4ANA_BS_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_ECC_DFT_ECC4ANA_BS_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ECC_DFT_ECC_Inject_OFF (11)
+ #define MCHBAR_CH0_CR_ECC_DFT_ECC_Inject_WID ( 3)
+ #define MCHBAR_CH0_CR_ECC_DFT_ECC_Inject_MSK (0x00003800)
+ #define MCHBAR_CH0_CR_ECC_DFT_ECC_Inject_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_ECC_DFT_ECC_Inject_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ECC_DFT_ECC_correction_disable_OFF (14)
+ #define MCHBAR_CH0_CR_ECC_DFT_ECC_correction_disable_WID ( 1)
+ #define MCHBAR_CH0_CR_ECC_DFT_ECC_correction_disable_MSK (0x00004000)
+ #define MCHBAR_CH0_CR_ECC_DFT_ECC_correction_disable_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_ECC_DFT_ECC_correction_disable_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ECC_DFT_ECC4ANA_Inject_OFF (15)
+ #define MCHBAR_CH0_CR_ECC_DFT_ECC4ANA_Inject_WID ( 1)
+ #define MCHBAR_CH0_CR_ECC_DFT_ECC4ANA_Inject_MSK (0x00008000)
+ #define MCHBAR_CH0_CR_ECC_DFT_ECC4ANA_Inject_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_ECC_DFT_ECC4ANA_Inject_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ECC_DFT_DIS_MCA_LOG_OFF (16)
+ #define MCHBAR_CH0_CR_ECC_DFT_DIS_MCA_LOG_WID ( 1)
+ #define MCHBAR_CH0_CR_ECC_DFT_DIS_MCA_LOG_MSK (0x00010000)
+ #define MCHBAR_CH0_CR_ECC_DFT_DIS_MCA_LOG_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_ECC_DFT_DIS_MCA_LOG_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ECC_DFT_DIS_PCH_EVENT_OFF (17)
+ #define MCHBAR_CH0_CR_ECC_DFT_DIS_PCH_EVENT_WID ( 1)
+ #define MCHBAR_CH0_CR_ECC_DFT_DIS_PCH_EVENT_MSK (0x00020000)
+ #define MCHBAR_CH0_CR_ECC_DFT_DIS_PCH_EVENT_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_ECC_DFT_DIS_PCH_EVENT_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ECC_DFT_DIS_PCIE_POISON_OFF (18)
+ #define MCHBAR_CH0_CR_ECC_DFT_DIS_PCIE_POISON_WID ( 1)
+ #define MCHBAR_CH0_CR_ECC_DFT_DIS_PCIE_POISON_MSK (0x00040000)
+ #define MCHBAR_CH0_CR_ECC_DFT_DIS_PCIE_POISON_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_ECC_DFT_DIS_PCIE_POISON_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_VISA_CTL_MCSCHEDS_REG (0x000040C0)
+ #define MCHBAR_CH0_CR_VISA_CTL_MCSCHEDS_Data_OFF ( 0)
+ #define MCHBAR_CH0_CR_VISA_CTL_MCSCHEDS_Data_WID (18)
+ #define MCHBAR_CH0_CR_VISA_CTL_MCSCHEDS_Data_MSK (0x0003FFFF)
+ #define MCHBAR_CH0_CR_VISA_CTL_MCSCHEDS_Data_MAX (0x0003FFFF)
+ #define MCHBAR_CH0_CR_VISA_CTL_MCSCHEDS_Data_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_VISA_CTL_MCSCHEDS_VORANGE_OFF (31)
+ #define MCHBAR_CH0_CR_VISA_CTL_MCSCHEDS_VORANGE_WID ( 1)
+ #define MCHBAR_CH0_CR_VISA_CTL_MCSCHEDS_VORANGE_MSK (0x80000000)
+ #define MCHBAR_CH0_CR_VISA_CTL_MCSCHEDS_VORANGE_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_VISA_CTL_MCSCHEDS_VORANGE_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_VISA_XBAR_MCSCHEDS_REG (0x000040C4)
+ #define MCHBAR_CH0_CR_VISA_XBAR_MCSCHEDS_Data_OFF ( 0)
+ #define MCHBAR_CH0_CR_VISA_XBAR_MCSCHEDS_Data_WID (32)
+ #define MCHBAR_CH0_CR_VISA_XBAR_MCSCHEDS_Data_MSK (0xFFFFFFFF)
+ #define MCHBAR_CH0_CR_VISA_XBAR_MCSCHEDS_Data_MAX (0xFFFFFFFF)
+ #define MCHBAR_CH0_CR_VISA_XBAR_MCSCHEDS_Data_DEF (0x76543210)
+
+#define MCHBAR_CH0_CR_ECCERRLOG0_REG (0x000040C8)
+ #define MCHBAR_CH0_CR_ECCERRLOG0_CERRSTS_OFF ( 0)
+ #define MCHBAR_CH0_CR_ECCERRLOG0_CERRSTS_WID ( 1)
+ #define MCHBAR_CH0_CR_ECCERRLOG0_CERRSTS_MSK (0x00000001)
+ #define MCHBAR_CH0_CR_ECCERRLOG0_CERRSTS_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_ECCERRLOG0_CERRSTS_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ECCERRLOG0_MERRSTS_OFF ( 1)
+ #define MCHBAR_CH0_CR_ECCERRLOG0_MERRSTS_WID ( 1)
+ #define MCHBAR_CH0_CR_ECCERRLOG0_MERRSTS_MSK (0x00000002)
+ #define MCHBAR_CH0_CR_ECCERRLOG0_MERRSTS_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_ECCERRLOG0_MERRSTS_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ECCERRLOG0_ERRSYND_OFF (16)
+ #define MCHBAR_CH0_CR_ECCERRLOG0_ERRSYND_WID ( 8)
+ #define MCHBAR_CH0_CR_ECCERRLOG0_ERRSYND_MSK (0x00FF0000)
+ #define MCHBAR_CH0_CR_ECCERRLOG0_ERRSYND_MAX (0x000000FF)
+ #define MCHBAR_CH0_CR_ECCERRLOG0_ERRSYND_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ECCERRLOG0_ERRCHUNK_OFF (24)
+ #define MCHBAR_CH0_CR_ECCERRLOG0_ERRCHUNK_WID ( 3)
+ #define MCHBAR_CH0_CR_ECCERRLOG0_ERRCHUNK_MSK (0x07000000)
+ #define MCHBAR_CH0_CR_ECCERRLOG0_ERRCHUNK_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_ECCERRLOG0_ERRCHUNK_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ECCERRLOG0_ERRRANK_OFF (27)
+ #define MCHBAR_CH0_CR_ECCERRLOG0_ERRRANK_WID ( 2)
+ #define MCHBAR_CH0_CR_ECCERRLOG0_ERRRANK_MSK (0x18000000)
+ #define MCHBAR_CH0_CR_ECCERRLOG0_ERRRANK_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_ECCERRLOG0_ERRRANK_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ECCERRLOG0_ERRBANK_OFF (29)
+ #define MCHBAR_CH0_CR_ECCERRLOG0_ERRBANK_WID ( 3)
+ #define MCHBAR_CH0_CR_ECCERRLOG0_ERRBANK_MSK (0xE0000000)
+ #define MCHBAR_CH0_CR_ECCERRLOG0_ERRBANK_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_ECCERRLOG0_ERRBANK_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_ECCERRLOG1_REG (0x000040CC)
+ #define MCHBAR_CH0_CR_ECCERRLOG1_ERRROW_OFF ( 0)
+ #define MCHBAR_CH0_CR_ECCERRLOG1_ERRROW_WID (16)
+ #define MCHBAR_CH0_CR_ECCERRLOG1_ERRROW_MSK (0x0000FFFF)
+ #define MCHBAR_CH0_CR_ECCERRLOG1_ERRROW_MAX (0x0000FFFF)
+ #define MCHBAR_CH0_CR_ECCERRLOG1_ERRROW_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ECCERRLOG1_ERRCOL_OFF (16)
+ #define MCHBAR_CH0_CR_ECCERRLOG1_ERRCOL_WID (16)
+ #define MCHBAR_CH0_CR_ECCERRLOG1_ERRCOL_MSK (0xFFFF0000)
+ #define MCHBAR_CH0_CR_ECCERRLOG1_ERRCOL_MAX (0x0000FFFF)
+ #define MCHBAR_CH0_CR_ECCERRLOG1_ERRCOL_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_SC_WR_ADD_DELAY_REG (0x000040D0)
+ #define MCHBAR_CH0_CR_SC_WR_ADD_DELAY_D0R0_OFF ( 0)
+ #define MCHBAR_CH0_CR_SC_WR_ADD_DELAY_D0R0_WID ( 2)
+ #define MCHBAR_CH0_CR_SC_WR_ADD_DELAY_D0R0_MSK (0x00000003)
+ #define MCHBAR_CH0_CR_SC_WR_ADD_DELAY_D0R0_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_SC_WR_ADD_DELAY_D0R0_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_SC_WR_ADD_DELAY_D0R1_OFF ( 2)
+ #define MCHBAR_CH0_CR_SC_WR_ADD_DELAY_D0R1_WID ( 2)
+ #define MCHBAR_CH0_CR_SC_WR_ADD_DELAY_D0R1_MSK (0x0000000C)
+ #define MCHBAR_CH0_CR_SC_WR_ADD_DELAY_D0R1_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_SC_WR_ADD_DELAY_D0R1_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_SC_WR_ADD_DELAY_D1R0_OFF ( 4)
+ #define MCHBAR_CH0_CR_SC_WR_ADD_DELAY_D1R0_WID ( 2)
+ #define MCHBAR_CH0_CR_SC_WR_ADD_DELAY_D1R0_MSK (0x00000030)
+ #define MCHBAR_CH0_CR_SC_WR_ADD_DELAY_D1R0_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_SC_WR_ADD_DELAY_D1R0_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_SC_WR_ADD_DELAY_D1R1_OFF ( 6)
+ #define MCHBAR_CH0_CR_SC_WR_ADD_DELAY_D1R1_WID ( 2)
+ #define MCHBAR_CH0_CR_SC_WR_ADD_DELAY_D1R1_MSK (0x000000C0)
+ #define MCHBAR_CH0_CR_SC_WR_ADD_DELAY_D1R1_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_SC_WR_ADD_DELAY_D1R1_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_WMM_READ_CONFIG_REG (0x000040D4)
+ #define MCHBAR_CH0_CR_WMM_READ_CONFIG_Dis_Opp_rd_OFF ( 0)
+ #define MCHBAR_CH0_CR_WMM_READ_CONFIG_Dis_Opp_rd_WID ( 1)
+ #define MCHBAR_CH0_CR_WMM_READ_CONFIG_Dis_Opp_rd_MSK (0x00000001)
+ #define MCHBAR_CH0_CR_WMM_READ_CONFIG_Dis_Opp_rd_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_WMM_READ_CONFIG_Dis_Opp_rd_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_WMM_READ_CONFIG_ACT_Enable_OFF ( 1)
+ #define MCHBAR_CH0_CR_WMM_READ_CONFIG_ACT_Enable_WID ( 1)
+ #define MCHBAR_CH0_CR_WMM_READ_CONFIG_ACT_Enable_MSK (0x00000002)
+ #define MCHBAR_CH0_CR_WMM_READ_CONFIG_ACT_Enable_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_WMM_READ_CONFIG_ACT_Enable_DEF (0x00000001)
+ #define MCHBAR_CH0_CR_WMM_READ_CONFIG_PRE_Enable_OFF ( 2)
+ #define MCHBAR_CH0_CR_WMM_READ_CONFIG_PRE_Enable_WID ( 1)
+ #define MCHBAR_CH0_CR_WMM_READ_CONFIG_PRE_Enable_MSK (0x00000004)
+ #define MCHBAR_CH0_CR_WMM_READ_CONFIG_PRE_Enable_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_WMM_READ_CONFIG_PRE_Enable_DEF (0x00000001)
+ #define MCHBAR_CH0_CR_WMM_READ_CONFIG_MAX_RPQ_Cas_OFF ( 3)
+ #define MCHBAR_CH0_CR_WMM_READ_CONFIG_MAX_RPQ_Cas_WID ( 4)
+ #define MCHBAR_CH0_CR_WMM_READ_CONFIG_MAX_RPQ_Cas_MSK (0x00000078)
+ #define MCHBAR_CH0_CR_WMM_READ_CONFIG_MAX_RPQ_Cas_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_WMM_READ_CONFIG_MAX_RPQ_Cas_DEF (0x00000008)
+
+#define MCHBAR_CH0_CR_REUT_CH_ERR_DATA_MASK_REG (0x000040D8)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_DATA_MASK_Data_Error_Mask_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_DATA_MASK_Data_Error_Mask_WID (64)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_DATA_MASK_Data_Error_Mask_MSK (0xFFFFFFFFFFFFFFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_DATA_MASK_Data_Error_Mask_MAX (0xFFFFFFFFFFFFFFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_DATA_MASK_Data_Error_Mask_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_ERR_DATA_STATUS_REG (0x000040E0)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_DATA_STATUS_Data_Error_Status_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_DATA_STATUS_Data_Error_Status_WID (64)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_DATA_STATUS_Data_Error_Status_MSK (0xFFFFFFFFFFFFFFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_DATA_STATUS_Data_Error_Status_MAX (0xFFFFFFFFFFFFFFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_DATA_STATUS_Data_Error_Status_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_REG (0x000040E8)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_ECC_Error_Status_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_ECC_Error_Status_WID ( 8)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_ECC_Error_Status_MSK (0x000000FF)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_ECC_Error_Status_MAX (0x000000FF)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_ECC_Error_Status_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Chunk_Error_Status_OFF ( 8)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Chunk_Error_Status_WID ( 8)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Chunk_Error_Status_MSK (0x0000FF00)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Chunk_Error_Status_MAX (0x000000FF)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Chunk_Error_Status_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Rank_Error_Status_OFF (16)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Rank_Error_Status_WID ( 4)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Rank_Error_Status_MSK (0x000F0000)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Rank_Error_Status_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Rank_Error_Status_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Byte_Group_Error_Status_OFF (32)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Byte_Group_Error_Status_WID ( 9)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Byte_Group_Error_Status_MSK (0x1FF00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Byte_Group_Error_Status_MAX (0x000001FF)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Byte_Group_Error_Status_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_WDB_Rd_Chunk_Num_Status_OFF (52)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_WDB_Rd_Chunk_Num_Status_WID ( 3)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_WDB_Rd_Chunk_Num_Status_MSK (0x70000000000000)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_WDB_Rd_Chunk_Num_Status_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_WDB_Rd_Chunk_Num_Status_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Nth_Error_OFF (56)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Nth_Error_WID ( 6)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Nth_Error_MSK (0x3F00000000000000)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Nth_Error_MAX (0x0000003F)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Nth_Error_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_0_REG (0x000040F0)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_0_Counter_Pointer_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_0_Counter_Pointer_WID ( 7)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_0_Counter_Pointer_MSK (0x0000007F)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_0_Counter_Pointer_MAX (0x0000007F)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_0_Counter_Pointer_DEF (0x0000007F)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_0_Counter_Control_OFF ( 7)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_0_Counter_Control_WID ( 2)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_0_Counter_Control_MSK (0x00000180)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_0_Counter_Control_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_0_Counter_Control_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_1_REG (0x000040F4)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_1_Counter_Pointer_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_1_Counter_Pointer_WID ( 7)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_1_Counter_Pointer_MSK (0x0000007F)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_1_Counter_Pointer_MAX (0x0000007F)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_1_Counter_Pointer_DEF (0x0000007F)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_1_Counter_Control_OFF ( 7)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_1_Counter_Control_WID ( 2)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_1_Counter_Control_MSK (0x00000180)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_1_Counter_Control_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_1_Counter_Control_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_2_REG (0x000040F8)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_2_Counter_Pointer_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_2_Counter_Pointer_WID ( 7)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_2_Counter_Pointer_MSK (0x0000007F)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_2_Counter_Pointer_MAX (0x0000007F)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_2_Counter_Pointer_DEF (0x0000007F)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_2_Counter_Control_OFF ( 7)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_2_Counter_Control_WID ( 2)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_2_Counter_Control_MSK (0x00000180)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_2_Counter_Control_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_2_Counter_Control_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_3_REG (0x000040FC)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_3_Counter_Pointer_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_3_Counter_Pointer_WID ( 7)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_3_Counter_Pointer_MSK (0x0000007F)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_3_Counter_Pointer_MAX (0x0000007F)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_3_Counter_Pointer_DEF (0x0000007F)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_3_Counter_Control_OFF ( 7)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_3_Counter_Control_WID ( 2)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_3_Counter_Control_MSK (0x00000180)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_3_Counter_Control_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_3_Counter_Control_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_4_REG (0x00004100)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_4_Counter_Pointer_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_4_Counter_Pointer_WID ( 7)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_4_Counter_Pointer_MSK (0x0000007F)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_4_Counter_Pointer_MAX (0x0000007F)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_4_Counter_Pointer_DEF (0x0000007F)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_4_Counter_Control_OFF ( 7)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_4_Counter_Control_WID ( 2)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_4_Counter_Control_MSK (0x00000180)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_4_Counter_Control_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_4_Counter_Control_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_5_REG (0x00004104)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_5_Counter_Pointer_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_5_Counter_Pointer_WID ( 7)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_5_Counter_Pointer_MSK (0x0000007F)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_5_Counter_Pointer_MAX (0x0000007F)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_5_Counter_Pointer_DEF (0x0000007F)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_5_Counter_Control_OFF ( 7)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_5_Counter_Control_WID ( 2)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_5_Counter_Control_MSK (0x00000180)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_5_Counter_Control_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_5_Counter_Control_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_6_REG (0x00004108)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_6_Counter_Pointer_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_6_Counter_Pointer_WID ( 7)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_6_Counter_Pointer_MSK (0x0000007F)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_6_Counter_Pointer_MAX (0x0000007F)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_6_Counter_Pointer_DEF (0x0000007F)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_6_Counter_Control_OFF ( 7)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_6_Counter_Control_WID ( 2)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_6_Counter_Control_MSK (0x00000180)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_6_Counter_Control_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_6_Counter_Control_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_7_REG (0x0000410C)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_7_Counter_Pointer_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_7_Counter_Pointer_WID ( 7)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_7_Counter_Pointer_MSK (0x0000007F)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_7_Counter_Pointer_MAX (0x0000007F)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_7_Counter_Pointer_DEF (0x0000007F)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_7_Counter_Control_OFF ( 7)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_7_Counter_Control_WID ( 2)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_7_Counter_Control_MSK (0x00000180)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_7_Counter_Control_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_7_Counter_Control_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_8_REG (0x00004110)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_8_Counter_Pointer_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_8_Counter_Pointer_WID ( 7)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_8_Counter_Pointer_MSK (0x0000007F)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_8_Counter_Pointer_MAX (0x0000007F)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_8_Counter_Pointer_DEF (0x0000007F)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_8_Counter_Control_OFF ( 7)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_8_Counter_Control_WID ( 2)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_8_Counter_Control_MSK (0x00000180)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_8_Counter_Control_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_8_Counter_Control_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_0_REG (0x00004114)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_0_Counter_Status_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_0_Counter_Status_WID (23)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_0_Counter_Status_MSK (0x007FFFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_0_Counter_Status_MAX (0x007FFFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_0_Counter_Status_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_1_REG (0x00004118)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_1_Counter_Status_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_1_Counter_Status_WID (23)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_1_Counter_Status_MSK (0x007FFFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_1_Counter_Status_MAX (0x007FFFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_1_Counter_Status_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_2_REG (0x0000411C)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_2_Counter_Status_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_2_Counter_Status_WID (23)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_2_Counter_Status_MSK (0x007FFFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_2_Counter_Status_MAX (0x007FFFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_2_Counter_Status_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_3_REG (0x00004120)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_3_Counter_Status_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_3_Counter_Status_WID (23)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_3_Counter_Status_MSK (0x007FFFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_3_Counter_Status_MAX (0x007FFFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_3_Counter_Status_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_4_REG (0x00004124)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_4_Counter_Status_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_4_Counter_Status_WID (23)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_4_Counter_Status_MSK (0x007FFFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_4_Counter_Status_MAX (0x007FFFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_4_Counter_Status_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_5_REG (0x00004128)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_5_Counter_Status_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_5_Counter_Status_WID (23)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_5_Counter_Status_MSK (0x007FFFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_5_Counter_Status_MAX (0x007FFFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_5_Counter_Status_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_6_REG (0x0000412C)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_6_Counter_Status_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_6_Counter_Status_WID (23)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_6_Counter_Status_MSK (0x007FFFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_6_Counter_Status_MAX (0x007FFFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_6_Counter_Status_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_7_REG (0x00004130)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_7_Counter_Status_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_7_Counter_Status_WID (23)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_7_Counter_Status_MSK (0x007FFFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_7_Counter_Status_MAX (0x007FFFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_7_Counter_Status_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_8_REG (0x00004134)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_8_Counter_Status_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_8_Counter_Status_WID (23)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_8_Counter_Status_MSK (0x007FFFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_8_Counter_Status_MAX (0x007FFFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_8_Counter_Status_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_OVERFLOW_STATUS_REG (0x00004138)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_OVERFLOW_STATUS_Counter_Overflow_Status_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_OVERFLOW_STATUS_Counter_Overflow_Status_WID ( 9)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_OVERFLOW_STATUS_Counter_Overflow_Status_MSK (0x000001FF)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_OVERFLOW_STATUS_Counter_Overflow_Status_MAX (0x000001FF)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_OVERFLOW_STATUS_Counter_Overflow_Status_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_ERROR_ADDR_REG (0x00004180)
+ #define MCHBAR_CH0_CR_REUT_CH_ERROR_ADDR_Column_Address_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_ERROR_ADDR_Column_Address_WID (10)
+ #define MCHBAR_CH0_CR_REUT_CH_ERROR_ADDR_Column_Address_MSK (0x000003FF)
+ #define MCHBAR_CH0_CR_REUT_CH_ERROR_ADDR_Column_Address_MAX (0x000003FF)
+ #define MCHBAR_CH0_CR_REUT_CH_ERROR_ADDR_Column_Address_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_ERROR_ADDR_Row_Address_OFF (24)
+ #define MCHBAR_CH0_CR_REUT_CH_ERROR_ADDR_Row_Address_WID (16)
+ #define MCHBAR_CH0_CR_REUT_CH_ERROR_ADDR_Row_Address_MSK (0xFFFF000000)
+ #define MCHBAR_CH0_CR_REUT_CH_ERROR_ADDR_Row_Address_MAX (0x0000FFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_ERROR_ADDR_Row_Address_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_ERROR_ADDR_Bank_Address_OFF (48)
+ #define MCHBAR_CH0_CR_REUT_CH_ERROR_ADDR_Bank_Address_WID ( 3)
+ #define MCHBAR_CH0_CR_REUT_CH_ERROR_ADDR_Bank_Address_MSK (0x7000000000000)
+ #define MCHBAR_CH0_CR_REUT_CH_ERROR_ADDR_Bank_Address_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_REUT_CH_ERROR_ADDR_Bank_Address_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_ERROR_ADDR_Rank_Address_OFF (56)
+ #define MCHBAR_CH0_CR_REUT_CH_ERROR_ADDR_Rank_Address_WID ( 2)
+ #define MCHBAR_CH0_CR_REUT_CH_ERROR_ADDR_Rank_Address_MSK (0x300000000000000)
+ #define MCHBAR_CH0_CR_REUT_CH_ERROR_ADDR_Rank_Address_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_REUT_CH_ERROR_ADDR_Rank_Address_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_ERR_WDB_CAPTURE_STATUS_REG (0x00004188)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_WDB_CAPTURE_STATUS_WDB_Current_Error_Pointer_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_WDB_CAPTURE_STATUS_WDB_Current_Error_Pointer_WID ( 6)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_WDB_CAPTURE_STATUS_WDB_Current_Error_Pointer_MSK (0x0000003F)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_WDB_CAPTURE_STATUS_WDB_Current_Error_Pointer_MAX (0x0000003F)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_WDB_CAPTURE_STATUS_WDB_Current_Error_Pointer_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_REG (0x0000418C)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_Enable_WDB_Error_Capture_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_Enable_WDB_Error_Capture_WID ( 1)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_Enable_WDB_Error_Capture_MSK (0x00000001)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_Enable_WDB_Error_Capture_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_Enable_WDB_Error_Capture_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_WDB_Starting_Error_Pointer_OFF ( 8)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_WDB_Starting_Error_Pointer_WID ( 6)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_WDB_Starting_Error_Pointer_MSK (0x00003F00)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_WDB_Starting_Error_Pointer_MAX (0x0000003F)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_WDB_Starting_Error_Pointer_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_WDB_Ending_Error_Pointer_OFF (16)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_WDB_Ending_Error_Pointer_WID ( 6)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_WDB_Ending_Error_Pointer_MSK (0x003F0000)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_WDB_Ending_Error_Pointer_MAX (0x0000003F)
+ #define MCHBAR_CH0_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_WDB_Ending_Error_Pointer_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_MISC_CKE_CTRL_REG (0x00004190)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_CKE_CTRL_CKE_Override_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_CKE_CTRL_CKE_Override_WID ( 4)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_CKE_CTRL_CKE_Override_MSK (0x0000000F)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_CKE_CTRL_CKE_Override_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_CKE_CTRL_CKE_Override_DEF (0x0000000F)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_CKE_CTRL_CKE_En_Start_Test_Sync_OFF ( 8)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_CKE_CTRL_CKE_En_Start_Test_Sync_WID ( 1)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_CKE_CTRL_CKE_En_Start_Test_Sync_MSK (0x00000100)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_CKE_CTRL_CKE_En_Start_Test_Sync_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_CKE_CTRL_CKE_En_Start_Test_Sync_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_CKE_CTRL_CKE_On_OFF (16)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_CKE_CTRL_CKE_On_WID ( 4)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_CKE_CTRL_CKE_On_MSK (0x000F0000)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_CKE_CTRL_CKE_On_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_CKE_CTRL_CKE_On_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_MISC_ODT_CTRL_REG (0x00004194)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_ODT_CTRL_ODT_Override_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_ODT_CTRL_ODT_Override_WID ( 4)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_ODT_CTRL_ODT_Override_MSK (0x0000000F)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_ODT_CTRL_ODT_Override_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_ODT_CTRL_ODT_Override_DEF (0x0000000F)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_ODT_CTRL_ODT_On_OFF (16)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_ODT_CTRL_ODT_On_WID ( 4)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_ODT_CTRL_ODT_On_MSK (0x000F0000)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_ODT_CTRL_ODT_On_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_ODT_CTRL_ODT_On_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_ODT_CTRL_MPR_Train_DDR_On_OFF (31)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_ODT_CTRL_MPR_Train_DDR_On_WID ( 1)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_ODT_CTRL_MPR_Train_DDR_On_MSK (0x80000000)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_ODT_CTRL_MPR_Train_DDR_On_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_ODT_CTRL_MPR_Train_DDR_On_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_REG (0x00004198)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_Enable_CADB_on_Deselect_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_Enable_CADB_on_Deselect_WID ( 1)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_Enable_CADB_on_Deselect_MSK (0x00000001)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_Enable_CADB_on_Deselect_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_Enable_CADB_on_Deselect_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_Enable_CADB_Always_On_OFF ( 1)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_Enable_CADB_Always_On_WID ( 1)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_Enable_CADB_Always_On_MSK (0x00000002)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_Enable_CADB_Always_On_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_Enable_CADB_Always_On_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_CMD_Deselect_Start_OFF ( 2)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_CMD_Deselect_Start_WID ( 4)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_CMD_Deselect_Start_MSK (0x0000003C)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_CMD_Deselect_Start_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_CMD_Deselect_Start_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_CMD_Deselect_Stop_OFF ( 6)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_CMD_Deselect_Stop_WID ( 4)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_CMD_Deselect_Stop_MSK (0x000003C0)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_CMD_Deselect_Stop_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_CMD_Deselect_Stop_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_Lane_Deselect_Enable_OFF ( 10)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_Lane_Deselect_Enable_WID ( 4)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_Lane_Deselect_Enable_MSK (0x00003C00)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_Lane_Deselect_Enable_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_Lane_Deselect_Enable_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_CAS_Select_Enable_OFF ( 14)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_CAS_Select_Enable_WID ( 2)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_CAS_Select_Enable_MSK (0x0000C000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_CAS_Select_Enable_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_CAS_Select_Enable_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_ACT_Select_Enable_OFF ( 16)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_ACT_Select_Enable_WID ( 2)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_ACT_Select_Enable_MSK (0x00030000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_ACT_Select_Enable_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_ACT_Select_Enable_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_PRE_Select_Enable_OFF ( 18)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_PRE_Select_Enable_WID ( 2)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_PRE_Select_Enable_MSK (0x000C0000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_PRE_Select_Enable_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_PRE_Select_Enable_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_Save_Current_Seed_OFF ( 20)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_Save_Current_Seed_WID ( 4)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_Save_Current_Seed_MSK (0x00F00000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_Save_Current_Seed_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_Save_Current_Seed_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_Reload_Starting_Seed_OFF ( 24)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_Reload_Starting_Seed_WID ( 4)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_Reload_Starting_Seed_MSK (0x0F000000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_Reload_Starting_Seed_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_Reload_Starting_Seed_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MRS_REG (0x0000419C)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MRS_MRS_Gap_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MRS_MRS_Gap_WID ( 3)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MRS_MRS_Gap_MSK (0x00000007)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MRS_MRS_Gap_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MRS_MRS_Gap_DEF (0x00000002)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_Start_Pointer_OFF ( 8)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_Start_Pointer_WID ( 3)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_Start_Pointer_MSK (0x00000700)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_Start_Pointer_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_Start_Pointer_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_End_Pointer_OFF (16)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_End_Pointer_WID ( 3)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_End_Pointer_MSK (0x00070000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_End_Pointer_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_End_Pointer_DEF (0x00000007)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_Current_Pointer_OFF (24)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_Current_Pointer_WID ( 3)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_Current_Pointer_MSK (0x07000000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_Current_Pointer_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_Current_Pointer_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_CTRL_REG (0x000041A0)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux0_Control_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux0_Control_WID ( 2)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux0_Control_MSK (0x00000003)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux0_Control_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux0_Control_DEF (0x00000001)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux1_Control_OFF ( 4)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux1_Control_WID ( 2)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux1_Control_MSK (0x00000030)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux1_Control_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux1_Control_DEF (0x00000001)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux2_Control_OFF ( 8)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux2_Control_WID ( 2)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux2_Control_MSK (0x00000300)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux2_Control_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux2_Control_DEF (0x00000001)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux0_Control_OFF ( 16)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux0_Control_WID ( 2)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux0_Control_MSK (0x00030000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux0_Control_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux0_Control_DEF (0x00000001)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux1_Control_OFF ( 20)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux1_Control_WID ( 2)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux1_Control_MSK (0x00300000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux1_Control_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux1_Control_DEF (0x00000001)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux2_Control_OFF ( 24)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux2_Control_WID ( 2)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux2_Control_MSK (0x03000000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux2_Control_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux2_Control_DEF (0x00000001)
+
+#define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_PB_0_REG (0x000041A4)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_PB_0_Pattern_Buffer_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_PB_0_Pattern_Buffer_WID (16)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_PB_0_Pattern_Buffer_MSK (0x0000FFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_PB_0_Pattern_Buffer_MAX (0x0000FFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_PB_0_Pattern_Buffer_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_PB_1_REG (0x000041A8)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_PB_1_Pattern_Buffer_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_PB_1_Pattern_Buffer_WID (16)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_PB_1_Pattern_Buffer_MSK (0x0000FFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_PB_1_Pattern_Buffer_MAX (0x0000FFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_PB_1_Pattern_Buffer_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_PB_2_REG (0x000041AC)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_PB_2_Pattern_Buffer_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_PB_2_Pattern_Buffer_WID (16)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_PB_2_Pattern_Buffer_MSK (0x0000FFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_PB_2_Pattern_Buffer_MAX (0x0000FFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_PB_2_Pattern_Buffer_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_REG (0x000041B0)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_L_data_select_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_L_data_select_WID ( 1)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_L_data_select_MSK (0x00000001)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_L_data_select_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_L_data_select_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_Enable_Sweep_Frequency_OFF ( 1)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_Enable_Sweep_Frequency_WID ( 1)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_Enable_Sweep_Frequency_MSK (0x00000002)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_Enable_Sweep_Frequency_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_Enable_Sweep_Frequency_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_L_counter_OFF ( 8)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_L_counter_WID ( 8)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_L_counter_MSK (0x0000FF00)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_L_counter_MAX (0x000000FF)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_L_counter_DEF (0x00000001)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_M_counter_OFF (16)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_M_counter_WID ( 8)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_M_counter_MSK (0x00FF0000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_M_counter_MAX (0x000000FF)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_M_counter_DEF (0x00000001)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_N_counter_OFF (24)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_N_counter_WID ( 8)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_N_counter_MSK (0xFF000000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_N_counter_MAX (0x000000FF)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_N_counter_DEF (0x00000001)
+
+#define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_WRITE_POINTER_REG (0x000041BC)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_WRITE_POINTER_CADB_Write_Pointer_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_WRITE_POINTER_CADB_Write_Pointer_WID ( 3)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_WRITE_POINTER_CADB_Write_Pointer_MSK (0x00000007)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_WRITE_POINTER_CADB_Write_Pointer_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_WRITE_POINTER_CADB_Write_Pointer_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_0_REG (0x000041C8)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_0_Pattern_Buffer_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_0_Pattern_Buffer_WID (16)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_0_Pattern_Buffer_MSK (0x0000FFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_0_Pattern_Buffer_MAX (0x0000FFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_0_Pattern_Buffer_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_1_REG (0x000041CC)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_1_Pattern_Buffer_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_1_Pattern_Buffer_WID (16)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_1_Pattern_Buffer_MSK (0x0000FFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_1_Pattern_Buffer_MAX (0x0000FFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_1_Pattern_Buffer_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_2_REG (0x000041D0)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_2_Pattern_Buffer_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_2_Pattern_Buffer_WID (16)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_2_Pattern_Buffer_MSK (0x0000FFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_2_Pattern_Buffer_MAX (0x0000FFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_2_Pattern_Buffer_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_PROG_REG (0x000041C0)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Address_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Address_WID (16)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Address_MSK (0x0000FFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Address_MAX (0x0000FFFF)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Address_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Bank_OFF (24)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Bank_WID ( 3)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Bank_MSK (0x07000000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Bank_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Bank_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_CS_OFF (32)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_CS_WID ( 4)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_CS_MSK (0xF00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_CS_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_CS_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Control_OFF (40)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Control_WID ( 3)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Control_MSK (0x70000000000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Control_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Control_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_ODT_OFF (48)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_ODT_WID ( 4)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_ODT_MSK (0xF000000000000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_ODT_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_ODT_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_CKE_OFF (56)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_CKE_WID ( 4)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_CKE_MSK (0xF00000000000000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_CKE_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_CKE_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_CTRL_REG (0x00004200)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Increment_Rate_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Increment_Rate_WID ( 5)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Increment_Rate_MSK (0x0000001F)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Increment_Rate_MAX (0x0000001F)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Increment_Rate_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Increment_Scale_OFF ( 5)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Increment_Scale_WID ( 1)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Increment_Scale_MSK (0x00000020)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Increment_Scale_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Increment_Scale_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Start_Pointer_OFF ( 8)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Start_Pointer_WID ( 6)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Start_Pointer_MSK (0x00003F00)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Start_Pointer_MAX (0x0000003F)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Start_Pointer_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_End_Pointer_OFF (16)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_End_Pointer_WID ( 6)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_End_Pointer_MSK (0x003F0000)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_End_Pointer_MAX (0x0000003F)
+ #define MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_End_Pointer_DEF (0x0000003F)
+
+#define MCHBAR_CH0_CR_REUT_CH_MISC_REFRESH_CTRL_REG (0x00004204)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_REFRESH_CTRL_Refresh_Rank_Mask_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_REFRESH_CTRL_Refresh_Rank_Mask_WID ( 4)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_REFRESH_CTRL_Refresh_Rank_Mask_MSK (0x0000000F)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_REFRESH_CTRL_Refresh_Rank_Mask_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_REFRESH_CTRL_Refresh_Rank_Mask_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_REFRESH_CTRL_RefZQ_En_Start_Test_Sync_OFF ( 8)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_REFRESH_CTRL_RefZQ_En_Start_Test_Sync_WID ( 1)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_REFRESH_CTRL_RefZQ_En_Start_Test_Sync_MSK (0x00000100)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_REFRESH_CTRL_RefZQ_En_Start_Test_Sync_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_REFRESH_CTRL_RefZQ_En_Start_Test_Sync_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_REFRESH_CTRL_Panic_Refresh_Only_OFF (31)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_REFRESH_CTRL_Panic_Refresh_Only_WID ( 1)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_REFRESH_CTRL_Panic_Refresh_Only_MSK (0x80000000)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_REFRESH_CTRL_Panic_Refresh_Only_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_REFRESH_CTRL_Panic_Refresh_Only_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_REUT_CH_MISC_ZQ_CTRL_REG (0x00004208)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_ZQ_CTRL_ZQ_Rank_Mask_OFF ( 0)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_ZQ_CTRL_ZQ_Rank_Mask_WID ( 4)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_ZQ_CTRL_ZQ_Rank_Mask_MSK (0x0000000F)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_ZQ_CTRL_ZQ_Rank_Mask_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_ZQ_CTRL_ZQ_Rank_Mask_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_ZQ_CTRL_Always_Do_ZQ_OFF (31)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_ZQ_CTRL_Always_Do_ZQ_WID ( 1)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_ZQ_CTRL_Always_Do_ZQ_MSK (0x80000000)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_ZQ_CTRL_Always_Do_ZQ_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_REUT_CH_MISC_ZQ_CTRL_Always_Do_ZQ_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_LPDDR_MR_PARAMS_REG (0x00004210)
+ #define MCHBAR_CH0_CR_LPDDR_MR_PARAMS_Rank_0_x32_OFF ( 0)
+ #define MCHBAR_CH0_CR_LPDDR_MR_PARAMS_Rank_0_x32_WID ( 1)
+ #define MCHBAR_CH0_CR_LPDDR_MR_PARAMS_Rank_0_x32_MSK (0x00000001)
+ #define MCHBAR_CH0_CR_LPDDR_MR_PARAMS_Rank_0_x32_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_LPDDR_MR_PARAMS_Rank_0_x32_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_LPDDR_MR_PARAMS_Rank_1_x32_OFF ( 1)
+ #define MCHBAR_CH0_CR_LPDDR_MR_PARAMS_Rank_1_x32_WID ( 1)
+ #define MCHBAR_CH0_CR_LPDDR_MR_PARAMS_Rank_1_x32_MSK (0x00000002)
+ #define MCHBAR_CH0_CR_LPDDR_MR_PARAMS_Rank_1_x32_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_LPDDR_MR_PARAMS_Rank_1_x32_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_LPDDR_MR_PARAMS_Rank_2_x32_OFF ( 2)
+ #define MCHBAR_CH0_CR_LPDDR_MR_PARAMS_Rank_2_x32_WID ( 1)
+ #define MCHBAR_CH0_CR_LPDDR_MR_PARAMS_Rank_2_x32_MSK (0x00000004)
+ #define MCHBAR_CH0_CR_LPDDR_MR_PARAMS_Rank_2_x32_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_LPDDR_MR_PARAMS_Rank_2_x32_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_LPDDR_MR_PARAMS_Rank_3_x32_OFF ( 3)
+ #define MCHBAR_CH0_CR_LPDDR_MR_PARAMS_Rank_3_x32_WID ( 1)
+ #define MCHBAR_CH0_CR_LPDDR_MR_PARAMS_Rank_3_x32_MSK (0x00000008)
+ #define MCHBAR_CH0_CR_LPDDR_MR_PARAMS_Rank_3_x32_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_LPDDR_MR_PARAMS_Rank_3_x32_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_LPDDR_MR_PARAMS_LPDDR2_OFF ( 4)
+ #define MCHBAR_CH0_CR_LPDDR_MR_PARAMS_LPDDR2_WID ( 1)
+ #define MCHBAR_CH0_CR_LPDDR_MR_PARAMS_LPDDR2_MSK (0x00000010)
+ #define MCHBAR_CH0_CR_LPDDR_MR_PARAMS_LPDDR2_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_LPDDR_MR_PARAMS_LPDDR2_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_LPDDR_MR_PARAMS_MR4_PERIOD_OFF ( 8)
+ #define MCHBAR_CH0_CR_LPDDR_MR_PARAMS_MR4_PERIOD_WID (16)
+ #define MCHBAR_CH0_CR_LPDDR_MR_PARAMS_MR4_PERIOD_MSK (0x00FFFF00)
+ #define MCHBAR_CH0_CR_LPDDR_MR_PARAMS_MR4_PERIOD_MAX (0x0000FFFF)
+ #define MCHBAR_CH0_CR_LPDDR_MR_PARAMS_MR4_PERIOD_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_LPDDR_MR_COMMAND_REG (0x00004214)
+ #define MCHBAR_CH0_CR_LPDDR_MR_COMMAND_Address_OFF ( 0)
+ #define MCHBAR_CH0_CR_LPDDR_MR_COMMAND_Address_WID ( 8)
+ #define MCHBAR_CH0_CR_LPDDR_MR_COMMAND_Address_MSK (0x000000FF)
+ #define MCHBAR_CH0_CR_LPDDR_MR_COMMAND_Address_MAX (0x000000FF)
+ #define MCHBAR_CH0_CR_LPDDR_MR_COMMAND_Address_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_LPDDR_MR_COMMAND_Data_OFF ( 8)
+ #define MCHBAR_CH0_CR_LPDDR_MR_COMMAND_Data_WID ( 8)
+ #define MCHBAR_CH0_CR_LPDDR_MR_COMMAND_Data_MSK (0x0000FF00)
+ #define MCHBAR_CH0_CR_LPDDR_MR_COMMAND_Data_MAX (0x000000FF)
+ #define MCHBAR_CH0_CR_LPDDR_MR_COMMAND_Data_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_LPDDR_MR_COMMAND_Rank_OFF (16)
+ #define MCHBAR_CH0_CR_LPDDR_MR_COMMAND_Rank_WID ( 2)
+ #define MCHBAR_CH0_CR_LPDDR_MR_COMMAND_Rank_MSK (0x00030000)
+ #define MCHBAR_CH0_CR_LPDDR_MR_COMMAND_Rank_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_LPDDR_MR_COMMAND_Rank_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_LPDDR_MR_COMMAND_Write_OFF (18)
+ #define MCHBAR_CH0_CR_LPDDR_MR_COMMAND_Write_WID ( 1)
+ #define MCHBAR_CH0_CR_LPDDR_MR_COMMAND_Write_MSK (0x00040000)
+ #define MCHBAR_CH0_CR_LPDDR_MR_COMMAND_Write_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_LPDDR_MR_COMMAND_Write_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_LPDDR_MR_COMMAND_Init_MRW_OFF (19)
+ #define MCHBAR_CH0_CR_LPDDR_MR_COMMAND_Init_MRW_WID ( 1)
+ #define MCHBAR_CH0_CR_LPDDR_MR_COMMAND_Init_MRW_MSK (0x00080000)
+ #define MCHBAR_CH0_CR_LPDDR_MR_COMMAND_Init_MRW_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_LPDDR_MR_COMMAND_Init_MRW_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_LPDDR_MR_COMMAND_Busy_OFF (31)
+ #define MCHBAR_CH0_CR_LPDDR_MR_COMMAND_Busy_WID ( 1)
+ #define MCHBAR_CH0_CR_LPDDR_MR_COMMAND_Busy_MSK (0x80000000)
+ #define MCHBAR_CH0_CR_LPDDR_MR_COMMAND_Busy_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_LPDDR_MR_COMMAND_Busy_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_LPDDR_MR_RESULT_REG (0x00004218)
+ #define MCHBAR_CH0_CR_LPDDR_MR_RESULT_Device_0_OFF ( 0)
+ #define MCHBAR_CH0_CR_LPDDR_MR_RESULT_Device_0_WID ( 8)
+ #define MCHBAR_CH0_CR_LPDDR_MR_RESULT_Device_0_MSK (0x000000FF)
+ #define MCHBAR_CH0_CR_LPDDR_MR_RESULT_Device_0_MAX (0x000000FF)
+ #define MCHBAR_CH0_CR_LPDDR_MR_RESULT_Device_0_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_LPDDR_MR_RESULT_Device_1_OFF ( 8)
+ #define MCHBAR_CH0_CR_LPDDR_MR_RESULT_Device_1_WID ( 8)
+ #define MCHBAR_CH0_CR_LPDDR_MR_RESULT_Device_1_MSK (0x0000FF00)
+ #define MCHBAR_CH0_CR_LPDDR_MR_RESULT_Device_1_MAX (0x000000FF)
+ #define MCHBAR_CH0_CR_LPDDR_MR_RESULT_Device_1_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_LPDDR_MR_RESULT_Device_2_OFF (16)
+ #define MCHBAR_CH0_CR_LPDDR_MR_RESULT_Device_2_WID ( 8)
+ #define MCHBAR_CH0_CR_LPDDR_MR_RESULT_Device_2_MSK (0x00FF0000)
+ #define MCHBAR_CH0_CR_LPDDR_MR_RESULT_Device_2_MAX (0x000000FF)
+ #define MCHBAR_CH0_CR_LPDDR_MR_RESULT_Device_2_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_LPDDR_MR_RESULT_Device_3_OFF (24)
+ #define MCHBAR_CH0_CR_LPDDR_MR_RESULT_Device_3_WID ( 8)
+ #define MCHBAR_CH0_CR_LPDDR_MR_RESULT_Device_3_MSK (0xFF000000)
+ #define MCHBAR_CH0_CR_LPDDR_MR_RESULT_Device_3_MAX (0x000000FF)
+ #define MCHBAR_CH0_CR_LPDDR_MR_RESULT_Device_3_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_LPDDR_MR4_RANK_TEMPERATURE_REG (0x0000421C)
+ #define MCHBAR_CH0_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_0_OFF ( 0)
+ #define MCHBAR_CH0_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_0_WID ( 3)
+ #define MCHBAR_CH0_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_0_MSK (0x00000007)
+ #define MCHBAR_CH0_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_0_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_0_DEF (0x00000003)
+ #define MCHBAR_CH0_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_1_OFF ( 8)
+ #define MCHBAR_CH0_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_1_WID ( 3)
+ #define MCHBAR_CH0_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_1_MSK (0x00000700)
+ #define MCHBAR_CH0_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_1_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_1_DEF (0x00000003)
+ #define MCHBAR_CH0_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_2_OFF (16)
+ #define MCHBAR_CH0_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_2_WID ( 3)
+ #define MCHBAR_CH0_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_2_MSK (0x00070000)
+ #define MCHBAR_CH0_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_2_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_2_DEF (0x00000003)
+ #define MCHBAR_CH0_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_3_OFF (24)
+ #define MCHBAR_CH0_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_3_WID ( 3)
+ #define MCHBAR_CH0_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_3_MSK (0x07000000)
+ #define MCHBAR_CH0_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_3_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_3_DEF (0x00000003)
+
+#define MCHBAR_CH0_CR_DESWIZZLE_LOW_REG (0x00004220)
+ #define MCHBAR_CH0_CR_DESWIZZLE_LOW_Bit_0_OFF ( 0)
+ #define MCHBAR_CH0_CR_DESWIZZLE_LOW_Bit_0_WID ( 3)
+ #define MCHBAR_CH0_CR_DESWIZZLE_LOW_Bit_0_MSK (0x00000007)
+ #define MCHBAR_CH0_CR_DESWIZZLE_LOW_Bit_0_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_DESWIZZLE_LOW_Bit_0_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_DESWIZZLE_LOW_Bit_1_OFF ( 4)
+ #define MCHBAR_CH0_CR_DESWIZZLE_LOW_Bit_1_WID ( 3)
+ #define MCHBAR_CH0_CR_DESWIZZLE_LOW_Bit_1_MSK (0x00000070)
+ #define MCHBAR_CH0_CR_DESWIZZLE_LOW_Bit_1_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_DESWIZZLE_LOW_Bit_1_DEF (0x00000001)
+ #define MCHBAR_CH0_CR_DESWIZZLE_LOW_Bit_2_OFF ( 8)
+ #define MCHBAR_CH0_CR_DESWIZZLE_LOW_Bit_2_WID ( 3)
+ #define MCHBAR_CH0_CR_DESWIZZLE_LOW_Bit_2_MSK (0x00000700)
+ #define MCHBAR_CH0_CR_DESWIZZLE_LOW_Bit_2_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_DESWIZZLE_LOW_Bit_2_DEF (0x00000002)
+ #define MCHBAR_CH0_CR_DESWIZZLE_LOW_Bit_16_OFF (12)
+ #define MCHBAR_CH0_CR_DESWIZZLE_LOW_Bit_16_WID ( 3)
+ #define MCHBAR_CH0_CR_DESWIZZLE_LOW_Bit_16_MSK (0x00007000)
+ #define MCHBAR_CH0_CR_DESWIZZLE_LOW_Bit_16_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_DESWIZZLE_LOW_Bit_16_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_DESWIZZLE_LOW_Bit_17_OFF (16)
+ #define MCHBAR_CH0_CR_DESWIZZLE_LOW_Bit_17_WID ( 3)
+ #define MCHBAR_CH0_CR_DESWIZZLE_LOW_Bit_17_MSK (0x00070000)
+ #define MCHBAR_CH0_CR_DESWIZZLE_LOW_Bit_17_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_DESWIZZLE_LOW_Bit_17_DEF (0x00000001)
+ #define MCHBAR_CH0_CR_DESWIZZLE_LOW_Bit_18_OFF (20)
+ #define MCHBAR_CH0_CR_DESWIZZLE_LOW_Bit_18_WID ( 3)
+ #define MCHBAR_CH0_CR_DESWIZZLE_LOW_Bit_18_MSK (0x00700000)
+ #define MCHBAR_CH0_CR_DESWIZZLE_LOW_Bit_18_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_DESWIZZLE_LOW_Bit_18_DEF (0x00000002)
+ #define MCHBAR_CH0_CR_DESWIZZLE_LOW_Byte_0_OFF (24)
+ #define MCHBAR_CH0_CR_DESWIZZLE_LOW_Byte_0_WID ( 3)
+ #define MCHBAR_CH0_CR_DESWIZZLE_LOW_Byte_0_MSK (0x07000000)
+ #define MCHBAR_CH0_CR_DESWIZZLE_LOW_Byte_0_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_DESWIZZLE_LOW_Byte_0_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_DESWIZZLE_LOW_Byte_2_OFF (28)
+ #define MCHBAR_CH0_CR_DESWIZZLE_LOW_Byte_2_WID ( 3)
+ #define MCHBAR_CH0_CR_DESWIZZLE_LOW_Byte_2_MSK (0x70000000)
+ #define MCHBAR_CH0_CR_DESWIZZLE_LOW_Byte_2_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_DESWIZZLE_LOW_Byte_2_DEF (0x00000002)
+
+#define MCHBAR_CH0_CR_DESWIZZLE_HIGH_REG (0x00004224)
+ #define MCHBAR_CH0_CR_DESWIZZLE_HIGH_Bit_32_OFF ( 0)
+ #define MCHBAR_CH0_CR_DESWIZZLE_HIGH_Bit_32_WID ( 3)
+ #define MCHBAR_CH0_CR_DESWIZZLE_HIGH_Bit_32_MSK (0x00000007)
+ #define MCHBAR_CH0_CR_DESWIZZLE_HIGH_Bit_32_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_DESWIZZLE_HIGH_Bit_32_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_DESWIZZLE_HIGH_Bit_33_OFF ( 4)
+ #define MCHBAR_CH0_CR_DESWIZZLE_HIGH_Bit_33_WID ( 3)
+ #define MCHBAR_CH0_CR_DESWIZZLE_HIGH_Bit_33_MSK (0x00000070)
+ #define MCHBAR_CH0_CR_DESWIZZLE_HIGH_Bit_33_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_DESWIZZLE_HIGH_Bit_33_DEF (0x00000001)
+ #define MCHBAR_CH0_CR_DESWIZZLE_HIGH_Bit_34_OFF ( 8)
+ #define MCHBAR_CH0_CR_DESWIZZLE_HIGH_Bit_34_WID ( 3)
+ #define MCHBAR_CH0_CR_DESWIZZLE_HIGH_Bit_34_MSK (0x00000700)
+ #define MCHBAR_CH0_CR_DESWIZZLE_HIGH_Bit_34_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_DESWIZZLE_HIGH_Bit_34_DEF (0x00000002)
+ #define MCHBAR_CH0_CR_DESWIZZLE_HIGH_Bit_48_OFF (12)
+ #define MCHBAR_CH0_CR_DESWIZZLE_HIGH_Bit_48_WID ( 3)
+ #define MCHBAR_CH0_CR_DESWIZZLE_HIGH_Bit_48_MSK (0x00007000)
+ #define MCHBAR_CH0_CR_DESWIZZLE_HIGH_Bit_48_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_DESWIZZLE_HIGH_Bit_48_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_DESWIZZLE_HIGH_Bit_49_OFF (16)
+ #define MCHBAR_CH0_CR_DESWIZZLE_HIGH_Bit_49_WID ( 3)
+ #define MCHBAR_CH0_CR_DESWIZZLE_HIGH_Bit_49_MSK (0x00070000)
+ #define MCHBAR_CH0_CR_DESWIZZLE_HIGH_Bit_49_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_DESWIZZLE_HIGH_Bit_49_DEF (0x00000001)
+ #define MCHBAR_CH0_CR_DESWIZZLE_HIGH_Bit_50_OFF (20)
+ #define MCHBAR_CH0_CR_DESWIZZLE_HIGH_Bit_50_WID ( 3)
+ #define MCHBAR_CH0_CR_DESWIZZLE_HIGH_Bit_50_MSK (0x00700000)
+ #define MCHBAR_CH0_CR_DESWIZZLE_HIGH_Bit_50_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_DESWIZZLE_HIGH_Bit_50_DEF (0x00000002)
+ #define MCHBAR_CH0_CR_DESWIZZLE_HIGH_Byte_4_OFF (24)
+ #define MCHBAR_CH0_CR_DESWIZZLE_HIGH_Byte_4_WID ( 3)
+ #define MCHBAR_CH0_CR_DESWIZZLE_HIGH_Byte_4_MSK (0x07000000)
+ #define MCHBAR_CH0_CR_DESWIZZLE_HIGH_Byte_4_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_DESWIZZLE_HIGH_Byte_4_DEF (0x00000004)
+ #define MCHBAR_CH0_CR_DESWIZZLE_HIGH_Byte_6_OFF (28)
+ #define MCHBAR_CH0_CR_DESWIZZLE_HIGH_Byte_6_WID ( 3)
+ #define MCHBAR_CH0_CR_DESWIZZLE_HIGH_Byte_6_MSK (0x70000000)
+ #define MCHBAR_CH0_CR_DESWIZZLE_HIGH_Byte_6_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_DESWIZZLE_HIGH_Byte_6_DEF (0x00000006)
+
+#define MCHBAR_CH0_CR_MC_REFRESH_STAGGER_REG (0x0000428C)
+ #define MCHBAR_CH0_CR_MC_REFRESH_STAGGER_Ref_Interval_OFF ( 0)
+ #define MCHBAR_CH0_CR_MC_REFRESH_STAGGER_Ref_Interval_WID (11)
+ #define MCHBAR_CH0_CR_MC_REFRESH_STAGGER_Ref_Interval_MSK (0x000007FF)
+ #define MCHBAR_CH0_CR_MC_REFRESH_STAGGER_Ref_Interval_MAX (0x000007FF)
+ #define MCHBAR_CH0_CR_MC_REFRESH_STAGGER_Ref_Interval_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_MC_REFRESH_STAGGER_Ref_Stagger_En_OFF (11)
+ #define MCHBAR_CH0_CR_MC_REFRESH_STAGGER_Ref_Stagger_En_WID ( 1)
+ #define MCHBAR_CH0_CR_MC_REFRESH_STAGGER_Ref_Stagger_En_MSK (0x00000800)
+ #define MCHBAR_CH0_CR_MC_REFRESH_STAGGER_Ref_Stagger_En_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_MC_REFRESH_STAGGER_Ref_Stagger_En_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_MC_REFRESH_STAGGER_Ref_Stagger_Mode_OFF (12)
+ #define MCHBAR_CH0_CR_MC_REFRESH_STAGGER_Ref_Stagger_Mode_WID ( 1)
+ #define MCHBAR_CH0_CR_MC_REFRESH_STAGGER_Ref_Stagger_Mode_MSK (0x00001000)
+ #define MCHBAR_CH0_CR_MC_REFRESH_STAGGER_Ref_Stagger_Mode_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_MC_REFRESH_STAGGER_Ref_Stagger_Mode_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_MC_REFRESH_STAGGER_Disable_Stolen_Refresh_OFF (13)
+ #define MCHBAR_CH0_CR_MC_REFRESH_STAGGER_Disable_Stolen_Refresh_WID ( 1)
+ #define MCHBAR_CH0_CR_MC_REFRESH_STAGGER_Disable_Stolen_Refresh_MSK (0x00002000)
+ #define MCHBAR_CH0_CR_MC_REFRESH_STAGGER_Disable_Stolen_Refresh_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_MC_REFRESH_STAGGER_Disable_Stolen_Refresh_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_MC_REFRESH_STAGGER_En_Ref_Type_Display_OFF (14)
+ #define MCHBAR_CH0_CR_MC_REFRESH_STAGGER_En_Ref_Type_Display_WID ( 1)
+ #define MCHBAR_CH0_CR_MC_REFRESH_STAGGER_En_Ref_Type_Display_MSK (0x00004000)
+ #define MCHBAR_CH0_CR_MC_REFRESH_STAGGER_En_Ref_Type_Display_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_MC_REFRESH_STAGGER_En_Ref_Type_Display_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_TC_ZQCAL_REG (0x00004290)
+ #define MCHBAR_CH0_CR_TC_ZQCAL_ZQCS_period_OFF ( 0)
+ #define MCHBAR_CH0_CR_TC_ZQCAL_ZQCS_period_WID ( 8)
+ #define MCHBAR_CH0_CR_TC_ZQCAL_ZQCS_period_MSK (0x000000FF)
+ #define MCHBAR_CH0_CR_TC_ZQCAL_ZQCS_period_MAX (0x000000FF)
+ #define MCHBAR_CH0_CR_TC_ZQCAL_ZQCS_period_DEF (0x00000080)
+ #define MCHBAR_CH0_CR_TC_ZQCAL_tZQCS_OFF ( 8)
+ #define MCHBAR_CH0_CR_TC_ZQCAL_tZQCS_WID ( 8)
+ #define MCHBAR_CH0_CR_TC_ZQCAL_tZQCS_MSK (0x0000FF00)
+ #define MCHBAR_CH0_CR_TC_ZQCAL_tZQCS_MAX (0x000000FF)
+ #define MCHBAR_CH0_CR_TC_ZQCAL_tZQCS_DEF (0x00000040)
+ #define MCHBAR_CH0_CR_TC_ZQCAL_ZQCS_period_Ult_OFF ( 0)
+ #define MCHBAR_CH0_CR_TC_ZQCAL_ZQCS_period_Ult_WID (10)
+ #define MCHBAR_CH0_CR_TC_ZQCAL_ZQCS_period_Ult_MSK (0x000003FF)
+ #define MCHBAR_CH0_CR_TC_ZQCAL_ZQCS_period_Ult_MAX (0x000003FF)
+ #define MCHBAR_CH0_CR_TC_ZQCAL_ZQCS_period_Ult_DEF (0x00000080)
+ #define MCHBAR_CH0_CR_TC_ZQCAL_tZQCS_Ult_OFF (10)
+ #define MCHBAR_CH0_CR_TC_ZQCAL_tZQCS_Ult_WID (10)
+ #define MCHBAR_CH0_CR_TC_ZQCAL_tZQCS_Ult_MSK (0x000FFC00)
+ #define MCHBAR_CH0_CR_TC_ZQCAL_tZQCS_Ult_MAX (0x000003FF)
+ #define MCHBAR_CH0_CR_TC_ZQCAL_tZQCS_Ult_DEF (0x00000040)
+
+#define MCHBAR_CH0_CR_TC_RFP_REG (0x00004294)
+ #define MCHBAR_CH0_CR_TC_RFP_OREF_RI_OFF ( 0)
+ #define MCHBAR_CH0_CR_TC_RFP_OREF_RI_WID ( 8)
+ #define MCHBAR_CH0_CR_TC_RFP_OREF_RI_MSK (0x000000FF)
+ #define MCHBAR_CH0_CR_TC_RFP_OREF_RI_MAX (0x000000FF)
+ #define MCHBAR_CH0_CR_TC_RFP_OREF_RI_DEF (0x0000000F)
+ #define MCHBAR_CH0_CR_TC_RFP_Refresh_HP_WM_OFF ( 8)
+ #define MCHBAR_CH0_CR_TC_RFP_Refresh_HP_WM_WID ( 4)
+ #define MCHBAR_CH0_CR_TC_RFP_Refresh_HP_WM_MSK (0x00000F00)
+ #define MCHBAR_CH0_CR_TC_RFP_Refresh_HP_WM_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_TC_RFP_Refresh_HP_WM_DEF (0x00000008)
+ #define MCHBAR_CH0_CR_TC_RFP_Refresh_panic_wm_OFF (12)
+ #define MCHBAR_CH0_CR_TC_RFP_Refresh_panic_wm_WID ( 4)
+ #define MCHBAR_CH0_CR_TC_RFP_Refresh_panic_wm_MSK (0x0000F000)
+ #define MCHBAR_CH0_CR_TC_RFP_Refresh_panic_wm_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_TC_RFP_Refresh_panic_wm_DEF (0x00000009)
+
+#define MCHBAR_CH0_CR_TC_RFTP_REG (0x00004298)
+ #define MCHBAR_CH0_CR_TC_RFTP_tREFI_OFF ( 0)
+ #define MCHBAR_CH0_CR_TC_RFTP_tREFI_WID (16)
+ #define MCHBAR_CH0_CR_TC_RFTP_tREFI_MSK (0x0000FFFF)
+ #define MCHBAR_CH0_CR_TC_RFTP_tREFI_MAX (0x0000FFFF)
+ #define MCHBAR_CH0_CR_TC_RFTP_tREFI_DEF (0x00001004)
+ #define MCHBAR_CH0_CR_TC_RFTP_tRFC_OFF (16)
+ #define MCHBAR_CH0_CR_TC_RFTP_tRFC_WID ( 9)
+ #define MCHBAR_CH0_CR_TC_RFTP_tRFC_MSK (0x01FF0000)
+ #define MCHBAR_CH0_CR_TC_RFTP_tRFC_MAX (0x000001FF)
+ #define MCHBAR_CH0_CR_TC_RFTP_tRFC_DEF (0x000000B4)
+ #define MCHBAR_CH0_CR_TC_RFTP_tREFIx9_OFF (25)
+ #define MCHBAR_CH0_CR_TC_RFTP_tREFIx9_WID ( 7)
+ #define MCHBAR_CH0_CR_TC_RFTP_tREFIx9_MSK (0xFE000000)
+ #define MCHBAR_CH0_CR_TC_RFTP_tREFIx9_MAX (0x0000007F)
+ #define MCHBAR_CH0_CR_TC_RFTP_tREFIx9_DEF (0x00000023)
+
+#define MCHBAR_CH0_CR_TC_MR2_SHADDOW_REG (0x0000429C)
+ #define MCHBAR_CH0_CR_TC_MR2_SHADDOW_MR2_sh_low_OFF ( 0)
+ #define MCHBAR_CH0_CR_TC_MR2_SHADDOW_MR2_sh_low_WID ( 6)
+ #define MCHBAR_CH0_CR_TC_MR2_SHADDOW_MR2_sh_low_MSK (0x0000003F)
+ #define MCHBAR_CH0_CR_TC_MR2_SHADDOW_MR2_sh_low_MAX (0x0000003F)
+ #define MCHBAR_CH0_CR_TC_MR2_SHADDOW_MR2_sh_low_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_TC_MR2_SHADDOW_SRT_avail_OFF ( 6)
+ #define MCHBAR_CH0_CR_TC_MR2_SHADDOW_SRT_avail_WID ( 2)
+ #define MCHBAR_CH0_CR_TC_MR2_SHADDOW_SRT_avail_MSK (0x000000C0)
+ #define MCHBAR_CH0_CR_TC_MR2_SHADDOW_SRT_avail_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_TC_MR2_SHADDOW_SRT_avail_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_TC_MR2_SHADDOW_MR2_sh_high_OFF ( 8)
+ #define MCHBAR_CH0_CR_TC_MR2_SHADDOW_MR2_sh_high_WID ( 3)
+ #define MCHBAR_CH0_CR_TC_MR2_SHADDOW_MR2_sh_high_MSK (0x00000700)
+ #define MCHBAR_CH0_CR_TC_MR2_SHADDOW_MR2_sh_high_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_TC_MR2_SHADDOW_MR2_sh_high_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_TC_MR2_SHADDOW_Addr_bit_swizzle_OFF (14)
+ #define MCHBAR_CH0_CR_TC_MR2_SHADDOW_Addr_bit_swizzle_WID ( 2)
+ #define MCHBAR_CH0_CR_TC_MR2_SHADDOW_Addr_bit_swizzle_MSK (0x0000C000)
+ #define MCHBAR_CH0_CR_TC_MR2_SHADDOW_Addr_bit_swizzle_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_TC_MR2_SHADDOW_Addr_bit_swizzle_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_MC_INIT_STATE_REG (0x000042A0)
+ #define MCHBAR_CH0_CR_MC_INIT_STATE_Rank_occupancy_OFF ( 0)
+ #define MCHBAR_CH0_CR_MC_INIT_STATE_Rank_occupancy_WID ( 4)
+ #define MCHBAR_CH0_CR_MC_INIT_STATE_Rank_occupancy_MSK (0x0000000F)
+ #define MCHBAR_CH0_CR_MC_INIT_STATE_Rank_occupancy_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_MC_INIT_STATE_Rank_occupancy_DEF (0x0000000F)
+
+#define MCHBAR_CH0_CR_TC_SRFTP_REG (0x000042A4)
+ #define MCHBAR_CH0_CR_TC_SRFTP_tXSDLL_OFF ( 0)
+ #define MCHBAR_CH0_CR_TC_SRFTP_tXSDLL_WID (12)
+ #define MCHBAR_CH0_CR_TC_SRFTP_tXSDLL_MSK (0x00000FFF)
+ #define MCHBAR_CH0_CR_TC_SRFTP_tXSDLL_MAX (0x00000FFF)
+ #define MCHBAR_CH0_CR_TC_SRFTP_tXSDLL_DEF (0x00000200)
+ #define MCHBAR_CH0_CR_TC_SRFTP_tXS_offset_OFF (12)
+ #define MCHBAR_CH0_CR_TC_SRFTP_tXS_offset_WID ( 4)
+ #define MCHBAR_CH0_CR_TC_SRFTP_tXS_offset_MSK (0x0000F000)
+ #define MCHBAR_CH0_CR_TC_SRFTP_tXS_offset_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_TC_SRFTP_tXS_offset_DEF (0x0000000B)
+ #define MCHBAR_CH0_CR_TC_SRFTP_tZQOPER_OFF (16)
+ #define MCHBAR_CH0_CR_TC_SRFTP_tZQOPER_WID (10)
+ #define MCHBAR_CH0_CR_TC_SRFTP_tZQOPER_MSK (0x03FF0000)
+ #define MCHBAR_CH0_CR_TC_SRFTP_tZQOPER_MAX (0x000003FF)
+ #define MCHBAR_CH0_CR_TC_SRFTP_tZQOPER_DEF (0x00000100)
+ #define MCHBAR_CH0_CR_TC_SRFTP_tMOD_OFF (28)
+ #define MCHBAR_CH0_CR_TC_SRFTP_tMOD_WID ( 4)
+ #define MCHBAR_CH0_CR_TC_SRFTP_tMOD_MSK (0xF0000000)
+ #define MCHBAR_CH0_CR_TC_SRFTP_tMOD_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_TC_SRFTP_tMOD_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_WDB_VISA_SEL_REG (0x000042A8)
+ #define MCHBAR_CH0_CR_WDB_VISA_SEL_VISAByteSel_OFF ( 0)
+ #define MCHBAR_CH0_CR_WDB_VISA_SEL_VISAByteSel_WID ( 3)
+ #define MCHBAR_CH0_CR_WDB_VISA_SEL_VISAByteSel_MSK (0x00000007)
+ #define MCHBAR_CH0_CR_WDB_VISA_SEL_VISAByteSel_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_WDB_VISA_SEL_VISAByteSel_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_DCLK_LDAT_PDAT_REG (0x000042C0)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_PDAT_FASTADDR_OFF ( 0)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_PDAT_FASTADDR_WID (12)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_PDAT_FASTADDR_MSK (0x00000FFF)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_PDAT_FASTADDR_MAX (0x00000FFF)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_PDAT_FASTADDR_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_PDAT_ADDREN_OFF (16)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_PDAT_ADDREN_WID ( 1)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_PDAT_ADDREN_MSK (0x00010000)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_PDAT_ADDREN_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_PDAT_ADDREN_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_PDAT_SEQEN_OFF (17)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_PDAT_SEQEN_WID ( 1)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_PDAT_SEQEN_MSK (0x00020000)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_PDAT_SEQEN_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_PDAT_SEQEN_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_PDAT_POL0_OFF (18)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_PDAT_POL0_WID ( 1)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_PDAT_POL0_MSK (0x00040000)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_PDAT_POL0_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_PDAT_POL0_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_PDAT_POL1_OFF (19)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_PDAT_POL1_WID ( 1)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_PDAT_POL1_MSK (0x00080000)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_PDAT_POL1_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_PDAT_POL1_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_PDAT_CMDA_OFF (20)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_PDAT_CMDA_WID ( 4)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_PDAT_CMDA_MSK (0x00F00000)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_PDAT_CMDA_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_PDAT_CMDA_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_PDAT_CMDB_OFF (24)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_PDAT_CMDB_WID ( 4)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_PDAT_CMDB_MSK (0x0F000000)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_PDAT_CMDB_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_PDAT_CMDB_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_PDAT_CMDC_OFF (28)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_PDAT_CMDC_WID ( 4)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_PDAT_CMDC_MSK (0xF0000000)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_PDAT_CMDC_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_PDAT_CMDC_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_REG (0x000042C4)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_BANKSEL_OFF ( 0)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_BANKSEL_WID ( 4)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_BANKSEL_MSK (0x0000000F)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_BANKSEL_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_BANKSEL_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_ARRAYSEL_OFF ( 5)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_ARRAYSEL_WID ( 5)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_ARRAYSEL_MSK (0x000003E0)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_ARRAYSEL_MAX (0x0000001F)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_ARRAYSEL_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_CMP_OFF (10)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_CMP_WID ( 1)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_CMP_MSK (0x00000400)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_CMP_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_CMP_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_REP_OFF (11)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_REP_WID ( 1)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_REP_MSK (0x00000800)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_REP_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_REP_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_DWORD_OFF (12)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_DWORD_WID ( 4)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_DWORD_MSK (0x0000F000)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_DWORD_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_DWORD_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_MODE_OFF (16)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_MODE_WID ( 2)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_MODE_MSK (0x00030000)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_MODE_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_MODE_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_MPMAP_OFF (18)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_MPMAP_WID ( 6)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_MPMAP_MSK (0x00FC0000)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_MPMAP_MAX (0x0000003F)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_MPMAP_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_MPBOFFSET_OFF (24)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_MPBOFFSET_WID ( 4)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_MPBOFFSET_MSK (0x0F000000)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_MPBOFFSET_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_MPBOFFSET_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_STAGE_EN_OFF (28)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_STAGE_EN_WID ( 1)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_STAGE_EN_MSK (0x10000000)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_STAGE_EN_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_STAGE_EN_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_SHADOW_OFF (29)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_SHADOW_WID ( 2)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_SHADOW_MSK (0x60000000)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_SHADOW_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_SDAT_SHADOW_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_DCLK_LDAT_DATAOUT_REG (0x000042C8)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_DATAOUT_DATOUT_OFF ( 0)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_DATAOUT_DATOUT_WID (32)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_DATAOUT_DATOUT_MSK (0xFFFFFFFF)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_DATAOUT_DATOUT_MAX (0xFFFFFFFF)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_DATAOUT_DATOUT_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_DCLK_LDAT_DATAIN_0_REG (0x000042CC)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_DATAIN_0_DATIN_OFF ( 0)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_DATAIN_0_DATIN_WID (32)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_DATAIN_0_DATIN_MSK (0xFFFFFFFF)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_DATAIN_0_DATIN_MAX (0xFFFFFFFF)
+ #define MCHBAR_CH0_CR_DCLK_LDAT_DATAIN_0_DATIN_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_QCLK_LDAT_PDAT_REG (0x000042D0)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_PDAT_FASTADDR_OFF ( 0)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_PDAT_FASTADDR_WID (12)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_PDAT_FASTADDR_MSK (0x00000FFF)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_PDAT_FASTADDR_MAX (0x00000FFF)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_PDAT_FASTADDR_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_PDAT_ADDREN_OFF (16)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_PDAT_ADDREN_WID ( 1)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_PDAT_ADDREN_MSK (0x00010000)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_PDAT_ADDREN_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_PDAT_ADDREN_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_PDAT_SEQEN_OFF (17)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_PDAT_SEQEN_WID ( 1)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_PDAT_SEQEN_MSK (0x00020000)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_PDAT_SEQEN_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_PDAT_SEQEN_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_PDAT_POL0_OFF (18)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_PDAT_POL0_WID ( 1)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_PDAT_POL0_MSK (0x00040000)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_PDAT_POL0_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_PDAT_POL0_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_PDAT_POL1_OFF (19)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_PDAT_POL1_WID ( 1)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_PDAT_POL1_MSK (0x00080000)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_PDAT_POL1_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_PDAT_POL1_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_PDAT_CMDA_OFF (20)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_PDAT_CMDA_WID ( 4)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_PDAT_CMDA_MSK (0x00F00000)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_PDAT_CMDA_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_PDAT_CMDA_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_PDAT_CMDB_OFF (24)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_PDAT_CMDB_WID ( 4)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_PDAT_CMDB_MSK (0x0F000000)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_PDAT_CMDB_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_PDAT_CMDB_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_PDAT_CMDC_OFF (28)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_PDAT_CMDC_WID ( 4)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_PDAT_CMDC_MSK (0xF0000000)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_PDAT_CMDC_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_PDAT_CMDC_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_REG (0x000042D4)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_BANKSEL_OFF ( 0)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_BANKSEL_WID ( 4)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_BANKSEL_MSK (0x0000000F)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_BANKSEL_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_BANKSEL_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_ARRAYSEL_OFF ( 5)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_ARRAYSEL_WID ( 5)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_ARRAYSEL_MSK (0x000003E0)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_ARRAYSEL_MAX (0x0000001F)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_ARRAYSEL_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_CMP_OFF (10)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_CMP_WID ( 1)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_CMP_MSK (0x00000400)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_CMP_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_CMP_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_REP_OFF (11)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_REP_WID ( 1)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_REP_MSK (0x00000800)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_REP_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_REP_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_DWORD_OFF (12)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_DWORD_WID ( 4)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_DWORD_MSK (0x0000F000)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_DWORD_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_DWORD_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_MODE_OFF (16)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_MODE_WID ( 2)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_MODE_MSK (0x00030000)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_MODE_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_MODE_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_MPMAP_OFF (18)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_MPMAP_WID ( 6)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_MPMAP_MSK (0x00FC0000)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_MPMAP_MAX (0x0000003F)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_MPMAP_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_MPBOFFSET_OFF (24)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_MPBOFFSET_WID ( 4)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_MPBOFFSET_MSK (0x0F000000)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_MPBOFFSET_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_MPBOFFSET_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_STAGE_EN_OFF (28)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_STAGE_EN_WID ( 1)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_STAGE_EN_MSK (0x10000000)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_STAGE_EN_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_STAGE_EN_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_SHADOW_OFF (29)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_SHADOW_WID ( 2)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_SHADOW_MSK (0x60000000)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_SHADOW_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_SDAT_SHADOW_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_QCLK_LDAT_DATAOUT_REG (0x000042D8)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_DATAOUT_DATOUT_OFF ( 0)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_DATAOUT_DATOUT_WID (32)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_DATAOUT_DATOUT_MSK (0xFFFFFFFF)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_DATAOUT_DATOUT_MAX (0xFFFFFFFF)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_DATAOUT_DATOUT_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_QCLK_LDAT_DATAIN_0_REG (0x000042DC)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_DATAIN_0_DATIN_OFF ( 0)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_DATAIN_0_DATIN_WID (32)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_DATAIN_0_DATIN_MSK (0xFFFFFFFF)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_DATAIN_0_DATIN_MAX (0xFFFFFFFF)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_DATAIN_0_DATIN_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_QCLK_LDAT_DATAIN_1_REG (0x000042E0)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_DATAIN_1_DATIN_OFF ( 0)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_DATAIN_1_DATIN_WID (32)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_DATAIN_1_DATIN_MSK (0xFFFFFFFF)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_DATAIN_1_DATIN_MAX (0xFFFFFFFF)
+ #define MCHBAR_CH0_CR_QCLK_LDAT_DATAIN_1_DATIN_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_QUEUE_ENTRY_DISABLE_RPQ_REG (0x000042E4)
+ #define MCHBAR_CH0_CR_QUEUE_ENTRY_DISABLE_RPQ_RPQ_disable_OFF ( 0)
+ #define MCHBAR_CH0_CR_QUEUE_ENTRY_DISABLE_RPQ_RPQ_disable_WID (28)
+ #define MCHBAR_CH0_CR_QUEUE_ENTRY_DISABLE_RPQ_RPQ_disable_MSK (0x0FFFFFFF)
+ #define MCHBAR_CH0_CR_QUEUE_ENTRY_DISABLE_RPQ_RPQ_disable_MAX (0x0FFFFFFF)
+ #define MCHBAR_CH0_CR_QUEUE_ENTRY_DISABLE_RPQ_RPQ_disable_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_QUEUE_ENTRY_DISABLE_WPQ_REG (0x000042E8)
+ #define MCHBAR_CH0_CR_QUEUE_ENTRY_DISABLE_WPQ_WPQ_disable_OFF ( 0)
+ #define MCHBAR_CH0_CR_QUEUE_ENTRY_DISABLE_WPQ_WPQ_disable_WID (32)
+ #define MCHBAR_CH0_CR_QUEUE_ENTRY_DISABLE_WPQ_WPQ_disable_MSK (0xFFFFFFFF)
+ #define MCHBAR_CH0_CR_QUEUE_ENTRY_DISABLE_WPQ_WPQ_disable_MAX (0xFFFFFFFF)
+ #define MCHBAR_CH0_CR_QUEUE_ENTRY_DISABLE_WPQ_WPQ_disable_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_PM_DIMM_IDLE_ENERGY_REG (0x000042EC)
+ #define MCHBAR_CH0_CR_PM_DIMM_IDLE_ENERGY_DIMM0_IDLE_ENERGY_OFF ( 0)
+ #define MCHBAR_CH0_CR_PM_DIMM_IDLE_ENERGY_DIMM0_IDLE_ENERGY_WID ( 6)
+ #define MCHBAR_CH0_CR_PM_DIMM_IDLE_ENERGY_DIMM0_IDLE_ENERGY_MSK (0x0000003F)
+ #define MCHBAR_CH0_CR_PM_DIMM_IDLE_ENERGY_DIMM0_IDLE_ENERGY_MAX (0x0000003F)
+ #define MCHBAR_CH0_CR_PM_DIMM_IDLE_ENERGY_DIMM0_IDLE_ENERGY_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_PM_DIMM_IDLE_ENERGY_DIMM1_IDLE_ENERGY_OFF ( 8)
+ #define MCHBAR_CH0_CR_PM_DIMM_IDLE_ENERGY_DIMM1_IDLE_ENERGY_WID ( 6)
+ #define MCHBAR_CH0_CR_PM_DIMM_IDLE_ENERGY_DIMM1_IDLE_ENERGY_MSK (0x00003F00)
+ #define MCHBAR_CH0_CR_PM_DIMM_IDLE_ENERGY_DIMM1_IDLE_ENERGY_MAX (0x0000003F)
+ #define MCHBAR_CH0_CR_PM_DIMM_IDLE_ENERGY_DIMM1_IDLE_ENERGY_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_PM_DIMM_PD_ENERGY_REG (0x000042F0)
+ #define MCHBAR_CH0_CR_PM_DIMM_PD_ENERGY_DIMM0_PD_ENERGY_OFF ( 0)
+ #define MCHBAR_CH0_CR_PM_DIMM_PD_ENERGY_DIMM0_PD_ENERGY_WID ( 6)
+ #define MCHBAR_CH0_CR_PM_DIMM_PD_ENERGY_DIMM0_PD_ENERGY_MSK (0x0000003F)
+ #define MCHBAR_CH0_CR_PM_DIMM_PD_ENERGY_DIMM0_PD_ENERGY_MAX (0x0000003F)
+ #define MCHBAR_CH0_CR_PM_DIMM_PD_ENERGY_DIMM0_PD_ENERGY_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_PM_DIMM_PD_ENERGY_DIMM1_PD_ENERGY_OFF ( 8)
+ #define MCHBAR_CH0_CR_PM_DIMM_PD_ENERGY_DIMM1_PD_ENERGY_WID ( 6)
+ #define MCHBAR_CH0_CR_PM_DIMM_PD_ENERGY_DIMM1_PD_ENERGY_MSK (0x00003F00)
+ #define MCHBAR_CH0_CR_PM_DIMM_PD_ENERGY_DIMM1_PD_ENERGY_MAX (0x0000003F)
+ #define MCHBAR_CH0_CR_PM_DIMM_PD_ENERGY_DIMM1_PD_ENERGY_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_PM_DIMM_ACT_ENERGY_REG (0x000042F4)
+ #define MCHBAR_CH0_CR_PM_DIMM_ACT_ENERGY_DIMM0_ACT_ENERGY_OFF ( 0)
+ #define MCHBAR_CH0_CR_PM_DIMM_ACT_ENERGY_DIMM0_ACT_ENERGY_WID ( 8)
+ #define MCHBAR_CH0_CR_PM_DIMM_ACT_ENERGY_DIMM0_ACT_ENERGY_MSK (0x000000FF)
+ #define MCHBAR_CH0_CR_PM_DIMM_ACT_ENERGY_DIMM0_ACT_ENERGY_MAX (0x000000FF)
+ #define MCHBAR_CH0_CR_PM_DIMM_ACT_ENERGY_DIMM0_ACT_ENERGY_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_PM_DIMM_ACT_ENERGY_DIMM1_ACT_ENERGY_OFF ( 8)
+ #define MCHBAR_CH0_CR_PM_DIMM_ACT_ENERGY_DIMM1_ACT_ENERGY_WID ( 8)
+ #define MCHBAR_CH0_CR_PM_DIMM_ACT_ENERGY_DIMM1_ACT_ENERGY_MSK (0x0000FF00)
+ #define MCHBAR_CH0_CR_PM_DIMM_ACT_ENERGY_DIMM1_ACT_ENERGY_MAX (0x000000FF)
+ #define MCHBAR_CH0_CR_PM_DIMM_ACT_ENERGY_DIMM1_ACT_ENERGY_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_PM_DIMM_RD_ENERGY_REG (0x000042F8)
+ #define MCHBAR_CH0_CR_PM_DIMM_RD_ENERGY_DIMM0_RD_ENERGY_OFF ( 0)
+ #define MCHBAR_CH0_CR_PM_DIMM_RD_ENERGY_DIMM0_RD_ENERGY_WID ( 8)
+ #define MCHBAR_CH0_CR_PM_DIMM_RD_ENERGY_DIMM0_RD_ENERGY_MSK (0x000000FF)
+ #define MCHBAR_CH0_CR_PM_DIMM_RD_ENERGY_DIMM0_RD_ENERGY_MAX (0x000000FF)
+ #define MCHBAR_CH0_CR_PM_DIMM_RD_ENERGY_DIMM0_RD_ENERGY_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_PM_DIMM_RD_ENERGY_DIMM1_RD_ENERGY_OFF ( 8)
+ #define MCHBAR_CH0_CR_PM_DIMM_RD_ENERGY_DIMM1_RD_ENERGY_WID ( 8)
+ #define MCHBAR_CH0_CR_PM_DIMM_RD_ENERGY_DIMM1_RD_ENERGY_MSK (0x0000FF00)
+ #define MCHBAR_CH0_CR_PM_DIMM_RD_ENERGY_DIMM1_RD_ENERGY_MAX (0x000000FF)
+ #define MCHBAR_CH0_CR_PM_DIMM_RD_ENERGY_DIMM1_RD_ENERGY_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_PM_DIMM_WR_ENERGY_REG (0x000042FC)
+ #define MCHBAR_CH0_CR_PM_DIMM_WR_ENERGY_DIMM0_WR_ENERGY_OFF ( 0)
+ #define MCHBAR_CH0_CR_PM_DIMM_WR_ENERGY_DIMM0_WR_ENERGY_WID ( 8)
+ #define MCHBAR_CH0_CR_PM_DIMM_WR_ENERGY_DIMM0_WR_ENERGY_MSK (0x000000FF)
+ #define MCHBAR_CH0_CR_PM_DIMM_WR_ENERGY_DIMM0_WR_ENERGY_MAX (0x000000FF)
+ #define MCHBAR_CH0_CR_PM_DIMM_WR_ENERGY_DIMM0_WR_ENERGY_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_PM_DIMM_WR_ENERGY_DIMM1_WR_ENERGY_OFF ( 8)
+ #define MCHBAR_CH0_CR_PM_DIMM_WR_ENERGY_DIMM1_WR_ENERGY_WID ( 8)
+ #define MCHBAR_CH0_CR_PM_DIMM_WR_ENERGY_DIMM1_WR_ENERGY_MSK (0x0000FF00)
+ #define MCHBAR_CH0_CR_PM_DIMM_WR_ENERGY_DIMM1_WR_ENERGY_MAX (0x000000FF)
+ #define MCHBAR_CH0_CR_PM_DIMM_WR_ENERGY_DIMM1_WR_ENERGY_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_PM_THRT_CKE_MIN_REG (0x00004328)
+ #define MCHBAR_CH0_CR_PM_THRT_CKE_MIN_CKE_MIN_OFF ( 0)
+ #define MCHBAR_CH0_CR_PM_THRT_CKE_MIN_CKE_MIN_WID ( 8)
+ #define MCHBAR_CH0_CR_PM_THRT_CKE_MIN_CKE_MIN_MSK (0x000000FF)
+ #define MCHBAR_CH0_CR_PM_THRT_CKE_MIN_CKE_MIN_MAX (0x000000FF)
+ #define MCHBAR_CH0_CR_PM_THRT_CKE_MIN_CKE_MIN_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_PM_THRT_CKE_MIN_CKE_MIN_DEFEATURE_OFF ( 8)
+ #define MCHBAR_CH0_CR_PM_THRT_CKE_MIN_CKE_MIN_DEFEATURE_WID ( 1)
+ #define MCHBAR_CH0_CR_PM_THRT_CKE_MIN_CKE_MIN_DEFEATURE_MSK (0x00000100)
+ #define MCHBAR_CH0_CR_PM_THRT_CKE_MIN_CKE_MIN_DEFEATURE_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_PM_THRT_CKE_MIN_CKE_MIN_DEFEATURE_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_ODLAT_CMD_MATCH0_REG (0x00004340)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH0_ODT_OFF ( 0)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH0_ODT_WID ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH0_ODT_MSK (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH0_ODT_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH0_ODT_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH0_Web_OFF ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH0_Web_WID ( 1)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH0_Web_MSK (0x00000010)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH0_Web_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH0_Web_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH0_CASb_OFF ( 5)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH0_CASb_WID ( 1)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH0_CASb_MSK (0x00000020)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH0_CASb_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH0_CASb_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH0_RASb_OFF ( 6)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH0_RASb_WID ( 1)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH0_RASb_MSK (0x00000040)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH0_RASb_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH0_RASb_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH0_CSb_OFF ( 7)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH0_CSb_WID ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH0_CSb_MSK (0x00000780)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH0_CSb_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH0_CSb_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH0_CKE_OFF (11)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH0_CKE_WID ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH0_CKE_MSK (0x00007800)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH0_CKE_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH0_CKE_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH0_MA_OFF (15)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH0_MA_WID (16)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH0_MA_MSK (0x7FFF8000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH0_MA_MAX (0x0000FFFF)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH0_MA_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_ODLAT_CMD_MATCH1_REG (0x00004344)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH1_ODT_OFF ( 0)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH1_ODT_WID ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH1_ODT_MSK (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH1_ODT_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH1_ODT_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH1_Web_OFF ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH1_Web_WID ( 1)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH1_Web_MSK (0x00000010)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH1_Web_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH1_Web_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH1_CASb_OFF ( 5)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH1_CASb_WID ( 1)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH1_CASb_MSK (0x00000020)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH1_CASb_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH1_CASb_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH1_RASb_OFF ( 6)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH1_RASb_WID ( 1)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH1_RASb_MSK (0x00000040)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH1_RASb_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH1_RASb_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH1_CSb_OFF ( 7)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH1_CSb_WID ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH1_CSb_MSK (0x00000780)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH1_CSb_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH1_CSb_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH1_CKE_OFF (11)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH1_CKE_WID ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH1_CKE_MSK (0x00007800)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH1_CKE_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH1_CKE_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH1_MA_OFF (15)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH1_MA_WID (16)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH1_MA_MSK (0x7FFF8000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH1_MA_MAX (0x0000FFFF)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH1_MA_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_ODLAT_CMD_MATCH2_REG (0x00004348)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH2_ODT_OFF ( 0)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH2_ODT_WID ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH2_ODT_MSK (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH2_ODT_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH2_ODT_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH2_Web_OFF ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH2_Web_WID ( 1)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH2_Web_MSK (0x00000010)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH2_Web_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH2_Web_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH2_CASb_OFF ( 5)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH2_CASb_WID ( 1)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH2_CASb_MSK (0x00000020)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH2_CASb_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH2_CASb_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH2_RASb_OFF ( 6)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH2_RASb_WID ( 1)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH2_RASb_MSK (0x00000040)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH2_RASb_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH2_RASb_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH2_CSb_OFF ( 7)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH2_CSb_WID ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH2_CSb_MSK (0x00000780)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH2_CSb_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH2_CSb_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH2_CKE_OFF (11)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH2_CKE_WID ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH2_CKE_MSK (0x00007800)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH2_CKE_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH2_CKE_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH2_MA_OFF (15)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH2_MA_WID (16)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH2_MA_MSK (0x7FFF8000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH2_MA_MAX (0x0000FFFF)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH2_MA_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_ODLAT_CMD_MATCH3_REG (0x0000434C)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH3_ODT_OFF ( 0)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH3_ODT_WID ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH3_ODT_MSK (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH3_ODT_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH3_ODT_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH3_Web_OFF ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH3_Web_WID ( 1)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH3_Web_MSK (0x00000010)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH3_Web_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH3_Web_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH3_CASb_OFF ( 5)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH3_CASb_WID ( 1)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH3_CASb_MSK (0x00000020)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH3_CASb_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH3_CASb_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH3_RASb_OFF ( 6)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH3_RASb_WID ( 1)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH3_RASb_MSK (0x00000040)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH3_RASb_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH3_RASb_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH3_CSb_OFF ( 7)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH3_CSb_WID ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH3_CSb_MSK (0x00000780)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH3_CSb_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH3_CSb_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH3_CKE_OFF (11)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH3_CKE_WID ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH3_CKE_MSK (0x00007800)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH3_CKE_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH3_CKE_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH3_MA_OFF (15)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH3_MA_WID (16)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH3_MA_MSK (0x7FFF8000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH3_MA_MAX (0x0000FFFF)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MATCH3_MA_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_ODLAT_CMD_MASK0_REG (0x00004350)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK0_ODT_OFF ( 0)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK0_ODT_WID ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK0_ODT_MSK (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK0_ODT_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK0_ODT_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK0_Web_OFF ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK0_Web_WID ( 1)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK0_Web_MSK (0x00000010)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK0_Web_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK0_Web_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK0_CASb_OFF ( 5)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK0_CASb_WID ( 1)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK0_CASb_MSK (0x00000020)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK0_CASb_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK0_CASb_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK0_RASb_OFF ( 6)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK0_RASb_WID ( 1)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK0_RASb_MSK (0x00000040)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK0_RASb_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK0_RASb_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK0_CSb_OFF ( 7)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK0_CSb_WID ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK0_CSb_MSK (0x00000780)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK0_CSb_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK0_CSb_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK0_CKE_OFF (11)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK0_CKE_WID ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK0_CKE_MSK (0x00007800)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK0_CKE_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK0_CKE_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK0_MA_OFF (15)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK0_MA_WID (16)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK0_MA_MSK (0x7FFF8000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK0_MA_MAX (0x0000FFFF)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK0_MA_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_ODLAT_CMD_MASK1_REG (0x00004354)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK1_ODT_OFF ( 0)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK1_ODT_WID ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK1_ODT_MSK (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK1_ODT_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK1_ODT_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK1_Web_OFF ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK1_Web_WID ( 1)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK1_Web_MSK (0x00000010)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK1_Web_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK1_Web_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK1_CASb_OFF ( 5)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK1_CASb_WID ( 1)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK1_CASb_MSK (0x00000020)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK1_CASb_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK1_CASb_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK1_RASb_OFF ( 6)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK1_RASb_WID ( 1)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK1_RASb_MSK (0x00000040)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK1_RASb_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK1_RASb_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK1_CSb_OFF ( 7)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK1_CSb_WID ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK1_CSb_MSK (0x00000780)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK1_CSb_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK1_CSb_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK1_CKE_OFF (11)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK1_CKE_WID ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK1_CKE_MSK (0x00007800)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK1_CKE_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK1_CKE_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK1_MA_OFF (15)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK1_MA_WID (16)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK1_MA_MSK (0x7FFF8000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK1_MA_MAX (0x0000FFFF)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK1_MA_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_ODLAT_CMD_MASK2_REG (0x00004358)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK2_ODT_OFF ( 0)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK2_ODT_WID ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK2_ODT_MSK (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK2_ODT_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK2_ODT_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK2_Web_OFF ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK2_Web_WID ( 1)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK2_Web_MSK (0x00000010)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK2_Web_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK2_Web_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK2_CASb_OFF ( 5)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK2_CASb_WID ( 1)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK2_CASb_MSK (0x00000020)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK2_CASb_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK2_CASb_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK2_RASb_OFF ( 6)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK2_RASb_WID ( 1)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK2_RASb_MSK (0x00000040)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK2_RASb_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK2_RASb_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK2_CSb_OFF ( 7)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK2_CSb_WID ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK2_CSb_MSK (0x00000780)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK2_CSb_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK2_CSb_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK2_CKE_OFF (11)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK2_CKE_WID ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK2_CKE_MSK (0x00007800)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK2_CKE_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK2_CKE_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK2_MA_OFF (15)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK2_MA_WID (16)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK2_MA_MSK (0x7FFF8000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK2_MA_MAX (0x0000FFFF)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK2_MA_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_ODLAT_CMD_MASK3_REG (0x0000435C)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK3_ODT_OFF ( 0)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK3_ODT_WID ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK3_ODT_MSK (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK3_ODT_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK3_ODT_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK3_Web_OFF ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK3_Web_WID ( 1)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK3_Web_MSK (0x00000010)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK3_Web_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK3_Web_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK3_CASb_OFF ( 5)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK3_CASb_WID ( 1)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK3_CASb_MSK (0x00000020)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK3_CASb_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK3_CASb_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK3_RASb_OFF ( 6)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK3_RASb_WID ( 1)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK3_RASb_MSK (0x00000040)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK3_RASb_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK3_RASb_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK3_CSb_OFF ( 7)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK3_CSb_WID ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK3_CSb_MSK (0x00000780)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK3_CSb_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK3_CSb_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK3_CKE_OFF (11)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK3_CKE_WID ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK3_CKE_MSK (0x00007800)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK3_CKE_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK3_CKE_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK3_MA_OFF (15)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK3_MA_WID (16)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK3_MA_MSK (0x7FFF8000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK3_MA_MAX (0x0000FFFF)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_MASK3_MA_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_ODLAT_CMD_BANK_REG (0x00004360)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_BANK_BankMatch0_OFF ( 0)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_BANK_BankMatch0_WID ( 3)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_BANK_BankMatch0_MSK (0x00000007)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_BANK_BankMatch0_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_BANK_BankMatch0_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_BANK_BankMatch1_OFF ( 3)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_BANK_BankMatch1_WID ( 3)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_BANK_BankMatch1_MSK (0x00000038)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_BANK_BankMatch1_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_BANK_BankMatch1_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_BANK_BankMatch2_OFF ( 6)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_BANK_BankMatch2_WID ( 3)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_BANK_BankMatch2_MSK (0x000001C0)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_BANK_BankMatch2_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_BANK_BankMatch2_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_BANK_BankMatch3_OFF ( 9)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_BANK_BankMatch3_WID ( 3)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_BANK_BankMatch3_MSK (0x00000E00)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_BANK_BankMatch3_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_BANK_BankMatch3_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_BANK_BankMask0_OFF (12)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_BANK_BankMask0_WID ( 3)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_BANK_BankMask0_MSK (0x00007000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_BANK_BankMask0_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_BANK_BankMask0_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_BANK_BankMask1_OFF (15)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_BANK_BankMask1_WID ( 3)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_BANK_BankMask1_MSK (0x00038000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_BANK_BankMask1_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_BANK_BankMask1_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_BANK_BankMask2_OFF (18)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_BANK_BankMask2_WID ( 3)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_BANK_BankMask2_MSK (0x001C0000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_BANK_BankMask2_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_BANK_BankMask2_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_BANK_BankMask3_OFF (21)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_BANK_BankMask3_WID ( 3)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_BANK_BankMask3_MSK (0x00E00000)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_BANK_BankMask3_MAX (0x00000007)
+ #define MCHBAR_CH0_CR_ODLAT_CMD_BANK_BankMask3_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL0_REG (0x00004364)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL0_InputMatch_OFF ( 0)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL0_InputMatch_WID ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL0_InputMatch_MSK (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL0_InputMatch_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL0_InputMatch_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL0_InputInvert_OFF ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL0_InputInvert_WID ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL0_InputInvert_MSK (0x000000F0)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL0_InputInvert_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL0_InputInvert_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL0_CountMatches_OFF ( 8)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL0_CountMatches_WID ( 1)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL0_CountMatches_MSK (0x00000100)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL0_CountMatches_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL0_CountMatches_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL0_CounterThreshold_OFF ( 9)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL0_CounterThreshold_WID (15)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL0_CounterThreshold_MSK (0x00FFFE00)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL0_CounterThreshold_MAX (0x00007FFF)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL0_CounterThreshold_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL0_CounterAction_OFF (24)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL0_CounterAction_WID ( 2)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL0_CounterAction_MSK (0x03000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL0_CounterAction_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL0_CounterAction_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL0_CounterNextState_OFF (26)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL0_CounterNextState_WID ( 2)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL0_CounterNextState_MSK (0x0C000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL0_CounterNextState_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL0_CounterNextState_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL0_MatchAction_OFF (28)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL0_MatchAction_WID ( 2)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL0_MatchAction_MSK (0x30000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL0_MatchAction_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL0_MatchAction_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL0_MatchNextState_OFF (30)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL0_MatchNextState_WID ( 2)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL0_MatchNextState_MSK (0xC0000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL0_MatchNextState_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL0_MatchNextState_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL1_REG (0x00004368)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL1_InputMatch_OFF ( 0)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL1_InputMatch_WID ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL1_InputMatch_MSK (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL1_InputMatch_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL1_InputMatch_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL1_InputInvert_OFF ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL1_InputInvert_WID ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL1_InputInvert_MSK (0x000000F0)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL1_InputInvert_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL1_InputInvert_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL1_CountMatches_OFF ( 8)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL1_CountMatches_WID ( 1)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL1_CountMatches_MSK (0x00000100)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL1_CountMatches_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL1_CountMatches_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL1_CounterThreshold_OFF ( 9)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL1_CounterThreshold_WID (15)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL1_CounterThreshold_MSK (0x00FFFE00)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL1_CounterThreshold_MAX (0x00007FFF)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL1_CounterThreshold_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL1_CounterAction_OFF (24)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL1_CounterAction_WID ( 2)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL1_CounterAction_MSK (0x03000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL1_CounterAction_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL1_CounterAction_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL1_CounterNextState_OFF (26)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL1_CounterNextState_WID ( 2)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL1_CounterNextState_MSK (0x0C000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL1_CounterNextState_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL1_CounterNextState_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL1_MatchAction_OFF (28)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL1_MatchAction_WID ( 2)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL1_MatchAction_MSK (0x30000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL1_MatchAction_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL1_MatchAction_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL1_MatchNextState_OFF (30)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL1_MatchNextState_WID ( 2)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL1_MatchNextState_MSK (0xC0000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL1_MatchNextState_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL1_MatchNextState_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL2_REG (0x0000436C)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL2_InputMatch_OFF ( 0)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL2_InputMatch_WID ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL2_InputMatch_MSK (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL2_InputMatch_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL2_InputMatch_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL2_InputInvert_OFF ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL2_InputInvert_WID ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL2_InputInvert_MSK (0x000000F0)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL2_InputInvert_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL2_InputInvert_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL2_CountMatches_OFF ( 8)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL2_CountMatches_WID ( 1)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL2_CountMatches_MSK (0x00000100)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL2_CountMatches_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL2_CountMatches_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL2_CounterThreshold_OFF ( 9)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL2_CounterThreshold_WID (15)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL2_CounterThreshold_MSK (0x00FFFE00)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL2_CounterThreshold_MAX (0x00007FFF)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL2_CounterThreshold_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL2_CounterAction_OFF (24)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL2_CounterAction_WID ( 2)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL2_CounterAction_MSK (0x03000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL2_CounterAction_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL2_CounterAction_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL2_CounterNextState_OFF (26)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL2_CounterNextState_WID ( 2)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL2_CounterNextState_MSK (0x0C000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL2_CounterNextState_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL2_CounterNextState_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL2_MatchAction_OFF (28)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL2_MatchAction_WID ( 2)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL2_MatchAction_MSK (0x30000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL2_MatchAction_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL2_MatchAction_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL2_MatchNextState_OFF (30)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL2_MatchNextState_WID ( 2)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL2_MatchNextState_MSK (0xC0000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL2_MatchNextState_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL2_MatchNextState_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL3_REG (0x00004370)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL3_InputMatch_OFF ( 0)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL3_InputMatch_WID ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL3_InputMatch_MSK (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL3_InputMatch_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL3_InputMatch_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL3_InputInvert_OFF ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL3_InputInvert_WID ( 4)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL3_InputInvert_MSK (0x000000F0)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL3_InputInvert_MAX (0x0000000F)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL3_InputInvert_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL3_CountMatches_OFF ( 8)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL3_CountMatches_WID ( 1)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL3_CountMatches_MSK (0x00000100)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL3_CountMatches_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL3_CountMatches_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL3_CounterThreshold_OFF ( 9)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL3_CounterThreshold_WID (15)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL3_CounterThreshold_MSK (0x00FFFE00)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL3_CounterThreshold_MAX (0x00007FFF)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL3_CounterThreshold_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL3_CounterAction_OFF (24)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL3_CounterAction_WID ( 2)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL3_CounterAction_MSK (0x03000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL3_CounterAction_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL3_CounterAction_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL3_CounterNextState_OFF (26)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL3_CounterNextState_WID ( 2)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL3_CounterNextState_MSK (0x0C000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL3_CounterNextState_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL3_CounterNextState_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL3_MatchAction_OFF (28)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL3_MatchAction_WID ( 2)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL3_MatchAction_MSK (0x30000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL3_MatchAction_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL3_MatchAction_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL3_MatchNextState_OFF (30)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL3_MatchNextState_WID ( 2)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL3_MatchNextState_MSK (0xC0000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL3_MatchNextState_MAX (0x00000003)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_LEVEL3_MatchNextState_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_ODLAT_SEQ_GLOBAL_REG (0x00004374)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_GLOBAL_TriggerBlockEnable_OFF ( 0)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_GLOBAL_TriggerBlockEnable_WID ( 1)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_GLOBAL_TriggerBlockEnable_MSK (0x00000001)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_GLOBAL_TriggerBlockEnable_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_GLOBAL_TriggerBlockEnable_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_GLOBAL_GlobalCounterThreshold_OFF ( 1)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_GLOBAL_GlobalCounterThreshold_WID (16)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_GLOBAL_GlobalCounterThreshold_MSK (0x0001FFFE)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_GLOBAL_GlobalCounterThreshold_MAX (0x0000FFFF)
+ #define MCHBAR_CH0_CR_ODLAT_SEQ_GLOBAL_GlobalCounterThreshold_DEF (0x00000000)
+
+#define MCHBAR_CH0_CR_SC_WDBWM_REG (0x0000438C)
+ #define MCHBAR_CH0_CR_SC_WDBWM_WMM_Enter_OFF ( 0)
+ #define MCHBAR_CH0_CR_SC_WDBWM_WMM_Enter_WID ( 8)
+ #define MCHBAR_CH0_CR_SC_WDBWM_WMM_Enter_MSK (0x000000FF)
+ #define MCHBAR_CH0_CR_SC_WDBWM_WMM_Enter_MAX (0x000000FF)
+ #define MCHBAR_CH0_CR_SC_WDBWM_WMM_Enter_DEF (0x00000038)
+ #define MCHBAR_CH0_CR_SC_WDBWM_WMM_Exit_OFF ( 8)
+ #define MCHBAR_CH0_CR_SC_WDBWM_WMM_Exit_WID ( 8)
+ #define MCHBAR_CH0_CR_SC_WDBWM_WMM_Exit_MSK (0x0000FF00)
+ #define MCHBAR_CH0_CR_SC_WDBWM_WMM_Exit_MAX (0x000000FF)
+ #define MCHBAR_CH0_CR_SC_WDBWM_WMM_Exit_DEF (0x00000030)
+ #define MCHBAR_CH0_CR_SC_WDBWM_WPQ_IS_OFF (16)
+ #define MCHBAR_CH0_CR_SC_WDBWM_WPQ_IS_WID ( 8)
+ #define MCHBAR_CH0_CR_SC_WDBWM_WPQ_IS_MSK (0x00FF0000)
+ #define MCHBAR_CH0_CR_SC_WDBWM_WPQ_IS_MAX (0x000000FF)
+ #define MCHBAR_CH0_CR_SC_WDBWM_WPQ_IS_DEF (0x0000003C)
+ #define MCHBAR_CH0_CR_SC_WDBWM_Starve_count_OFF (24)
+ #define MCHBAR_CH0_CR_SC_WDBWM_Starve_count_WID ( 8)
+ #define MCHBAR_CH0_CR_SC_WDBWM_Starve_count_MSK (0xFF000000)
+ #define MCHBAR_CH0_CR_SC_WDBWM_Starve_count_MAX (0x000000FF)
+ #define MCHBAR_CH0_CR_SC_WDBWM_Starve_count_DEF (0x000000FF)
+
+#define MCHBAR_CH0_CR_VISA_CTL_MCMNTS_REG (0x00004390)
+ #define MCHBAR_CH0_CR_VISA_CTL_MCMNTS_Data_OFF ( 0)
+ #define MCHBAR_CH0_CR_VISA_CTL_MCMNTS_Data_WID (18)
+ #define MCHBAR_CH0_CR_VISA_CTL_MCMNTS_Data_MSK (0x0003FFFF)
+ #define MCHBAR_CH0_CR_VISA_CTL_MCMNTS_Data_MAX (0x0003FFFF)
+ #define MCHBAR_CH0_CR_VISA_CTL_MCMNTS_Data_DEF (0x00000000)
+ #define MCHBAR_CH0_CR_VISA_CTL_MCMNTS_VORANGE_OFF (31)
+ #define MCHBAR_CH0_CR_VISA_CTL_MCMNTS_VORANGE_WID ( 1)
+ #define MCHBAR_CH0_CR_VISA_CTL_MCMNTS_VORANGE_MSK (0x80000000)
+ #define MCHBAR_CH0_CR_VISA_CTL_MCMNTS_VORANGE_MAX (0x00000001)
+ #define MCHBAR_CH0_CR_VISA_CTL_MCMNTS_VORANGE_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_TC_BANK_REG (0x00004400)
+ #define MCHBAR_CH1_CR_TC_BANK_tRCD_OFF ( 0)
+ #define MCHBAR_CH1_CR_TC_BANK_tRCD_WID ( 5)
+ #define MCHBAR_CH1_CR_TC_BANK_tRCD_MSK (0x0000001F)
+ #define MCHBAR_CH1_CR_TC_BANK_tRCD_MAX (0x0000001F)
+ #define MCHBAR_CH1_CR_TC_BANK_tRCD_DEF (0x00000006)
+ #define MCHBAR_CH1_CR_TC_BANK_tRP_OFF ( 5)
+ #define MCHBAR_CH1_CR_TC_BANK_tRP_WID ( 5)
+ #define MCHBAR_CH1_CR_TC_BANK_tRP_MSK (0x000003E0)
+ #define MCHBAR_CH1_CR_TC_BANK_tRP_MAX (0x0000001F)
+ #define MCHBAR_CH1_CR_TC_BANK_tRP_DEF (0x00000006)
+ #define MCHBAR_CH1_CR_TC_BANK_tRAS_OFF (10)
+ #define MCHBAR_CH1_CR_TC_BANK_tRAS_WID ( 6)
+ #define MCHBAR_CH1_CR_TC_BANK_tRAS_MSK (0x0000FC00)
+ #define MCHBAR_CH1_CR_TC_BANK_tRAS_MAX (0x0000003F)
+ #define MCHBAR_CH1_CR_TC_BANK_tRAS_DEF (0x00000014)
+ #define MCHBAR_CH1_CR_TC_BANK_tRDPRE_OFF (16)
+ #define MCHBAR_CH1_CR_TC_BANK_tRDPRE_WID ( 4)
+ #define MCHBAR_CH1_CR_TC_BANK_tRDPRE_MSK (0x000F0000)
+ #define MCHBAR_CH1_CR_TC_BANK_tRDPRE_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_TC_BANK_tRDPRE_DEF (0x00000004)
+ #define MCHBAR_CH1_CR_TC_BANK_tWRPRE_OFF (20)
+ #define MCHBAR_CH1_CR_TC_BANK_tWRPRE_WID ( 6)
+ #define MCHBAR_CH1_CR_TC_BANK_tWRPRE_MSK (0x03F00000)
+ #define MCHBAR_CH1_CR_TC_BANK_tWRPRE_MAX (0x0000003F)
+ #define MCHBAR_CH1_CR_TC_BANK_tWRPRE_DEF (0x00000004)
+ #define MCHBAR_CH1_CR_TC_BANK_tRRD_OFF (26)
+ #define MCHBAR_CH1_CR_TC_BANK_tRRD_WID ( 4)
+ #define MCHBAR_CH1_CR_TC_BANK_tRRD_MSK (0x3C000000)
+ #define MCHBAR_CH1_CR_TC_BANK_tRRD_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_TC_BANK_tRRD_DEF (0x00000004)
+ #define MCHBAR_CH1_CR_TC_BANK_tRPab_ext_OFF (30)
+ #define MCHBAR_CH1_CR_TC_BANK_tRPab_ext_WID ( 2)
+ #define MCHBAR_CH1_CR_TC_BANK_tRPab_ext_MSK (0xC0000000)
+ #define MCHBAR_CH1_CR_TC_BANK_tRPab_ext_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_TC_BANK_tRPab_ext_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_TC_BANK_RANK_A_REG (0x00004404)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_A_tCKE_OFF ( 0)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_A_tCKE_WID ( 4)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_A_tCKE_MSK (0x0000000F)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_A_tCKE_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_A_tCKE_DEF (0x00000003)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_A_tFAW_OFF ( 4)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_A_tFAW_WID ( 8)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_A_tFAW_MSK (0x00000FF0)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_A_tFAW_MAX (0x000000FF)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_A_tFAW_DEF (0x00000010)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_A_tRDRD_OFF (12)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_A_tRDRD_WID ( 3)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_A_tRDRD_MSK (0x00007000)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_A_tRDRD_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_A_tRDRD_DEF (0x00000004)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_A_tRDRD_dr_OFF (15)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_A_tRDRD_dr_WID ( 4)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_A_tRDRD_dr_MSK (0x00078000)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_A_tRDRD_dr_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_A_tRDRD_dr_DEF (0x00000004)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_A_tRDRD_dd_OFF (19)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_A_tRDRD_dd_WID ( 4)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_A_tRDRD_dd_MSK (0x00780000)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_A_tRDRD_dd_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_A_tRDRD_dd_DEF (0x00000004)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_A_tRDPDEN_OFF (23)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_A_tRDPDEN_WID ( 5)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_A_tRDPDEN_MSK (0x0F800000)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_A_tRDPDEN_MAX (0x0000001F)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_A_tRDPDEN_DEF (0x00000004)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_A_CMD_3st_OFF (29)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_A_CMD_3st_WID ( 1)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_A_CMD_3st_MSK (0x20000000)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_A_CMD_3st_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_A_CMD_3st_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_A_CMD_stretch_OFF (30)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_A_CMD_stretch_WID ( 2)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_A_CMD_stretch_MSK (0xC0000000)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_A_CMD_stretch_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_A_CMD_stretch_DEF (0x00000002)
+
+#define MCHBAR_CH1_CR_TC_BANK_RANK_B_REG (0x00004408)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_B_tWRRD_OFF ( 0)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_B_tWRRD_WID ( 6)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_B_tWRRD_MSK (0x0000003F)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_B_tWRRD_MAX (0x0000003F)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_B_tWRRD_DEF (0x00000005)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_B_tWRRD_dr_OFF ( 6)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_B_tWRRD_dr_WID ( 4)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_B_tWRRD_dr_MSK (0x000003C0)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_B_tWRRD_dr_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_B_tWRRD_dr_DEF (0x00000005)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_B_tWRRD_dd_OFF (10)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_B_tWRRD_dd_WID ( 4)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_B_tWRRD_dd_MSK (0x00003C00)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_B_tWRRD_dd_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_B_tWRRD_dd_DEF (0x00000005)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_B_tWRWR_OFF (14)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_B_tWRWR_WID ( 3)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_B_tWRWR_MSK (0x0001C000)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_B_tWRWR_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_B_tWRWR_DEF (0x00000005)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_B_tWRWR_dr_OFF (17)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_B_tWRWR_dr_WID ( 4)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_B_tWRWR_dr_MSK (0x001E0000)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_B_tWRWR_dr_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_B_tWRWR_dr_DEF (0x00000005)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_B_tWRWR_dd_OFF (21)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_B_tWRWR_dd_WID ( 4)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_B_tWRWR_dd_MSK (0x01E00000)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_B_tWRWR_dd_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_B_tWRWR_dd_DEF (0x00000005)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_B_tWRPDEN_OFF (25)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_B_tWRPDEN_WID ( 6)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_B_tWRPDEN_MSK (0x7E000000)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_B_tWRPDEN_MAX (0x0000003F)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_B_tWRPDEN_DEF (0x00000005)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_B_Dec_WRD_OFF (31)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_B_Dec_WRD_WID ( 1)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_B_Dec_WRD_MSK (0x80000000)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_B_Dec_WRD_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_B_Dec_WRD_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_TC_BANK_RANK_C_REG (0x0000440C)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_C_tXPDLL_OFF ( 0)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_C_tXPDLL_WID ( 6)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_C_tXPDLL_MSK (0x0000003F)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_C_tXPDLL_MAX (0x0000003F)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_C_tXPDLL_DEF (0x0000000A)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_C_tXP_OFF ( 6)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_C_tXP_WID ( 4)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_C_tXP_MSK (0x000003C0)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_C_tXP_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_C_tXP_DEF (0x00000003)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_C_TAONPD_OFF (10)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_C_TAONPD_WID ( 4)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_C_TAONPD_MSK (0x00003C00)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_C_TAONPD_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_C_TAONPD_DEF (0x00000009)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_C_tRDWR_OFF (14)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_C_tRDWR_WID ( 5)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_C_tRDWR_MSK (0x0007C000)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_C_tRDWR_MAX (0x0000001F)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_C_tRDWR_DEF (0x00000005)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_C_tRDWR_dr_OFF (19)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_C_tRDWR_dr_WID ( 5)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_C_tRDWR_dr_MSK (0x00F80000)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_C_tRDWR_dr_MAX (0x0000001F)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_C_tRDWR_dr_DEF (0x00000005)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_C_tRDWR_dd_OFF (24)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_C_tRDWR_dd_WID ( 5)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_C_tRDWR_dd_MSK (0x1F000000)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_C_tRDWR_dd_MAX (0x0000001F)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_C_tRDWR_dd_DEF (0x00000005)
+
+#define MCHBAR_CH1_CR_CMD_RATE_REG (0x00004410)
+ #define MCHBAR_CH1_CR_CMD_RATE_enable_cmd_rate_limit_OFF ( 0)
+ #define MCHBAR_CH1_CR_CMD_RATE_enable_cmd_rate_limit_WID ( 1)
+ #define MCHBAR_CH1_CR_CMD_RATE_enable_cmd_rate_limit_MSK (0x00000001)
+ #define MCHBAR_CH1_CR_CMD_RATE_enable_cmd_rate_limit_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_CMD_RATE_enable_cmd_rate_limit_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_CMD_RATE_cmd_rate_limit_OFF ( 1)
+ #define MCHBAR_CH1_CR_CMD_RATE_cmd_rate_limit_WID ( 3)
+ #define MCHBAR_CH1_CR_CMD_RATE_cmd_rate_limit_MSK (0x0000000E)
+ #define MCHBAR_CH1_CR_CMD_RATE_cmd_rate_limit_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_CMD_RATE_cmd_rate_limit_DEF (0x00000004)
+ #define MCHBAR_CH1_CR_CMD_RATE_reset_on_command_OFF ( 4)
+ #define MCHBAR_CH1_CR_CMD_RATE_reset_on_command_WID ( 4)
+ #define MCHBAR_CH1_CR_CMD_RATE_reset_on_command_MSK (0x000000F0)
+ #define MCHBAR_CH1_CR_CMD_RATE_reset_on_command_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_CMD_RATE_reset_on_command_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_CMD_RATE_reset_delay_OFF ( 8)
+ #define MCHBAR_CH1_CR_CMD_RATE_reset_delay_WID ( 4)
+ #define MCHBAR_CH1_CR_CMD_RATE_reset_delay_MSK (0x00000F00)
+ #define MCHBAR_CH1_CR_CMD_RATE_reset_delay_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_CMD_RATE_reset_delay_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_CMD_RATE_ck_to_cke_delay_OFF (12)
+ #define MCHBAR_CH1_CR_CMD_RATE_ck_to_cke_delay_WID ( 2)
+ #define MCHBAR_CH1_CR_CMD_RATE_ck_to_cke_delay_MSK (0x00003000)
+ #define MCHBAR_CH1_CR_CMD_RATE_ck_to_cke_delay_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_CMD_RATE_ck_to_cke_delay_DEF (0x00000001)
+ #define MCHBAR_CH1_CR_CMD_RATE_spare_OFF (14)
+ #define MCHBAR_CH1_CR_CMD_RATE_spare_WID (17)
+ #define MCHBAR_CH1_CR_CMD_RATE_spare_MSK (0x7FFFC000)
+ #define MCHBAR_CH1_CR_CMD_RATE_spare_MAX (0x0001FFFF)
+ #define MCHBAR_CH1_CR_CMD_RATE_spare_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_CMD_RATE_init_mrw_2n_cs_OFF (31)
+ #define MCHBAR_CH1_CR_CMD_RATE_init_mrw_2n_cs_WID ( 1)
+ #define MCHBAR_CH1_CR_CMD_RATE_init_mrw_2n_cs_MSK (0x80000000)
+ #define MCHBAR_CH1_CR_CMD_RATE_init_mrw_2n_cs_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_CMD_RATE_init_mrw_2n_cs_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_TC_BANK_RANK_D_REG (0x00004414)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_tCL_OFF ( 0)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_tCL_WID ( 5)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_tCL_MSK (0x0000001F)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_tCL_MAX (0x0000001F)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_tCL_DEF (0x00000006)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_tWCL_OFF ( 5)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_tWCL_WID ( 5)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_tWCL_MSK (0x000003E0)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_tWCL_MAX (0x0000001F)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_tWCL_DEF (0x00000006)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_tCPDED_OFF (10)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_tCPDED_WID ( 2)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_tCPDED_MSK (0x00000C00)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_tCPDED_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_tCPDED_DEF (0x00000001)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_tPRPDEN_OFF (12)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_tPRPDEN_WID ( 2)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_tPRPDEN_MSK (0x00003000)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_tPRPDEN_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_tPRPDEN_DEF (0x00000001)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_Odt_Read_Delay_OFF (14)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_Odt_Read_Delay_WID ( 3)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_Odt_Read_Delay_MSK (0x0001C000)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_Odt_Read_Delay_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_Odt_Read_Delay_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_Odt_Read_Duration_OFF (17)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_Odt_Read_Duration_WID ( 2)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_Odt_Read_Duration_MSK (0x00060000)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_Odt_Read_Duration_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_Odt_Read_Duration_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_Odt_Write_Duration_OFF (19)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_Odt_Write_Duration_WID ( 2)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_Odt_Write_Duration_MSK (0x00180000)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_Odt_Write_Duration_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_Odt_Write_Duration_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_Odt_Write_Duration_Ult_OFF (19)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_Odt_Write_Duration_Ult_WID ( 3)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_Odt_Write_Duration_Ult_MSK (0x00380000)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_Odt_Write_Duration_Ult_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_Odt_Write_Duration_Ult_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_Odt_Write_Delay_Ult_OFF (22)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_Odt_Write_Delay_Ult_WID ( 3)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_Odt_Write_Delay_Ult_MSK (0x01C00000)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_Odt_Write_Delay_Ult_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_Odt_Write_Delay_Ult_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_Odt_Always_Rank0_Ult_OFF (25)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_Odt_Always_Rank0_Ult_WID ( 1)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_Odt_Always_Rank0_Ult_MSK (0x02000000)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_Odt_Always_Rank0_Ult_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_Odt_Always_Rank0_Ult_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_cmd_delay_Ult_OFF (26)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_cmd_delay_Ult_WID ( 2)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_cmd_delay_Ult_MSK (0x0C000000)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_cmd_delay_Ult_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_TC_BANK_RANK_D_cmd_delay_Ult_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_SCHED_CBIT_REG (0x00004420)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_opp_cas_OFF ( 0)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_opp_cas_WID ( 1)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_opp_cas_MSK (0x00000001)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_opp_cas_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_opp_cas_DEF (0x00000001)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_opp_is_cas_OFF ( 1)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_opp_is_cas_WID ( 1)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_opp_is_cas_MSK (0x00000002)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_opp_is_cas_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_opp_is_cas_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_opp_ras_OFF ( 2)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_opp_ras_WID ( 1)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_opp_ras_MSK (0x00000004)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_opp_ras_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_opp_ras_DEF (0x00000001)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_opp_is_ras_OFF ( 3)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_opp_is_ras_WID ( 1)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_opp_is_ras_MSK (0x00000008)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_opp_is_ras_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_opp_is_ras_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_1c_byp_OFF ( 4)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_1c_byp_WID ( 1)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_1c_byp_MSK (0x00000010)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_1c_byp_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_1c_byp_DEF (0x00000001)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_2c_byp_OFF ( 5)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_2c_byp_WID ( 1)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_2c_byp_MSK (0x00000020)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_2c_byp_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_2c_byp_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_deprd_opt_OFF ( 6)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_deprd_opt_WID ( 1)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_deprd_opt_MSK (0x00000040)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_deprd_opt_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_deprd_opt_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_pt_it_OFF ( 7)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_pt_it_WID ( 1)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_pt_it_MSK (0x00000080)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_pt_it_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_pt_it_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_prcnt_ring_OFF ( 8)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_prcnt_ring_WID ( 1)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_prcnt_ring_MSK (0x00000100)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_prcnt_ring_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_prcnt_ring_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_prcnt_sa_OFF ( 9)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_prcnt_sa_WID ( 1)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_prcnt_sa_MSK (0x00000200)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_prcnt_sa_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_prcnt_sa_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_blkr_ph_OFF (10)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_blkr_ph_WID ( 1)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_blkr_ph_MSK (0x00000400)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_blkr_ph_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_blkr_ph_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_blkr_pe_OFF (11)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_blkr_pe_WID ( 1)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_blkr_pe_MSK (0x00000800)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_blkr_pe_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_blkr_pe_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_blkr_pm_OFF (12)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_blkr_pm_WID ( 1)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_blkr_pm_MSK (0x00001000)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_blkr_pm_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_blkr_pm_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_odt_OFF (13)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_odt_WID ( 1)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_odt_MSK (0x00002000)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_odt_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_odt_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_OE_alw_off_OFF (14)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_OE_alw_off_WID ( 1)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_OE_alw_off_MSK (0x00004000)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_OE_alw_off_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_OE_alw_off_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_aom_OFF (16)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_aom_WID ( 1)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_aom_MSK (0x00010000)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_aom_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_aom_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_block_rpq_OFF (17)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_block_rpq_WID ( 1)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_block_rpq_MSK (0x00020000)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_block_rpq_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_block_rpq_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_block_wpq_OFF (18)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_block_wpq_WID ( 1)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_block_wpq_MSK (0x00040000)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_block_wpq_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_block_wpq_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_invert_align_OFF (19)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_invert_align_WID ( 1)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_invert_align_MSK (0x00080000)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_invert_align_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_invert_align_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_write_gap_OFF (20)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_write_gap_WID ( 1)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_write_gap_MSK (0x00100000)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_write_gap_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_write_gap_DEF (0x00000001)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_zq_OFF (21)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_zq_WID ( 1)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_zq_MSK (0x00200000)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_zq_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_zq_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_tt_OFF (22)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_tt_WID ( 1)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_tt_MSK (0x00400000)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_tt_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_tt_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_opp_ref_OFF (23)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_opp_ref_WID ( 1)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_opp_ref_MSK (0x00800000)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_opp_ref_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_opp_ref_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_Long_ZQ_OFF (24)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_Long_ZQ_WID ( 1)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_Long_ZQ_MSK (0x01000000)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_Long_ZQ_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_Long_ZQ_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_srx_zq_OFF (25)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_srx_zq_WID ( 1)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_srx_zq_MSK (0x02000000)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_srx_zq_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_srx_zq_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_Serialize_ZQ_OFF (26)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_Serialize_ZQ_WID ( 1)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_Serialize_ZQ_MSK (0x04000000)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_Serialize_ZQ_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_Serialize_ZQ_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_ZQ_fast_exec_OFF (27)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_ZQ_fast_exec_WID ( 1)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_ZQ_fast_exec_MSK (0x08000000)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_ZQ_fast_exec_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_ZQ_fast_exec_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_Dis_DriveNop_OFF (28)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_Dis_DriveNop_WID ( 1)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_Dis_DriveNop_MSK (0x10000000)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_Dis_DriveNop_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_Dis_DriveNop_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_Pres_WDB_Ent_OFF (29)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_Pres_WDB_Ent_WID ( 1)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_Pres_WDB_Ent_MSK (0x20000000)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_Pres_WDB_Ent_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_Pres_WDB_Ent_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_clk_gate_OFF (30)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_clk_gate_WID ( 1)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_clk_gate_MSK (0x40000000)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_clk_gate_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_SCHED_CBIT_dis_clk_gate_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_SC_ROUNDT_LAT_REG (0x00004424)
+ #define MCHBAR_CH1_CR_SC_ROUNDT_LAT_Lat_R0D0_OFF ( 0)
+ #define MCHBAR_CH1_CR_SC_ROUNDT_LAT_Lat_R0D0_WID ( 6)
+ #define MCHBAR_CH1_CR_SC_ROUNDT_LAT_Lat_R0D0_MSK (0x0000003F)
+ #define MCHBAR_CH1_CR_SC_ROUNDT_LAT_Lat_R0D0_MAX (0x0000003F)
+ #define MCHBAR_CH1_CR_SC_ROUNDT_LAT_Lat_R0D0_DEF (0x00000020)
+ #define MCHBAR_CH1_CR_SC_ROUNDT_LAT_Lat_R1D0_OFF ( 8)
+ #define MCHBAR_CH1_CR_SC_ROUNDT_LAT_Lat_R1D0_WID ( 6)
+ #define MCHBAR_CH1_CR_SC_ROUNDT_LAT_Lat_R1D0_MSK (0x00003F00)
+ #define MCHBAR_CH1_CR_SC_ROUNDT_LAT_Lat_R1D0_MAX (0x0000003F)
+ #define MCHBAR_CH1_CR_SC_ROUNDT_LAT_Lat_R1D0_DEF (0x00000020)
+ #define MCHBAR_CH1_CR_SC_ROUNDT_LAT_Lat_R0D1_OFF (16)
+ #define MCHBAR_CH1_CR_SC_ROUNDT_LAT_Lat_R0D1_WID ( 6)
+ #define MCHBAR_CH1_CR_SC_ROUNDT_LAT_Lat_R0D1_MSK (0x003F0000)
+ #define MCHBAR_CH1_CR_SC_ROUNDT_LAT_Lat_R0D1_MAX (0x0000003F)
+ #define MCHBAR_CH1_CR_SC_ROUNDT_LAT_Lat_R0D1_DEF (0x00000020)
+ #define MCHBAR_CH1_CR_SC_ROUNDT_LAT_Lat_R1D1_OFF (24)
+ #define MCHBAR_CH1_CR_SC_ROUNDT_LAT_Lat_R1D1_WID ( 6)
+ #define MCHBAR_CH1_CR_SC_ROUNDT_LAT_Lat_R1D1_MSK (0x3F000000)
+ #define MCHBAR_CH1_CR_SC_ROUNDT_LAT_Lat_R1D1_MAX (0x0000003F)
+ #define MCHBAR_CH1_CR_SC_ROUNDT_LAT_Lat_R1D1_DEF (0x00000020)
+
+#define MCHBAR_CH1_CR_SC_IO_LATENCY_REG (0x00004428)
+ #define MCHBAR_CH1_CR_SC_IO_LATENCY_IOLAT_R0D0_OFF ( 0)
+ #define MCHBAR_CH1_CR_SC_IO_LATENCY_IOLAT_R0D0_WID ( 4)
+ #define MCHBAR_CH1_CR_SC_IO_LATENCY_IOLAT_R0D0_MSK (0x0000000F)
+ #define MCHBAR_CH1_CR_SC_IO_LATENCY_IOLAT_R0D0_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_SC_IO_LATENCY_IOLAT_R0D0_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_SC_IO_LATENCY_IOLAT_R1D0_OFF ( 4)
+ #define MCHBAR_CH1_CR_SC_IO_LATENCY_IOLAT_R1D0_WID ( 4)
+ #define MCHBAR_CH1_CR_SC_IO_LATENCY_IOLAT_R1D0_MSK (0x000000F0)
+ #define MCHBAR_CH1_CR_SC_IO_LATENCY_IOLAT_R1D0_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_SC_IO_LATENCY_IOLAT_R1D0_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_SC_IO_LATENCY_IOLAT_R0D1_OFF ( 8)
+ #define MCHBAR_CH1_CR_SC_IO_LATENCY_IOLAT_R0D1_WID ( 4)
+ #define MCHBAR_CH1_CR_SC_IO_LATENCY_IOLAT_R0D1_MSK (0x00000F00)
+ #define MCHBAR_CH1_CR_SC_IO_LATENCY_IOLAT_R0D1_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_SC_IO_LATENCY_IOLAT_R0D1_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_SC_IO_LATENCY_IOLAT_R1D1_OFF (12)
+ #define MCHBAR_CH1_CR_SC_IO_LATENCY_IOLAT_R1D1_WID ( 4)
+ #define MCHBAR_CH1_CR_SC_IO_LATENCY_IOLAT_R1D1_MSK (0x0000F000)
+ #define MCHBAR_CH1_CR_SC_IO_LATENCY_IOLAT_R1D1_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_SC_IO_LATENCY_IOLAT_R1D1_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_SC_IO_LATENCY_RT_IOCOMP_OFF (16)
+ #define MCHBAR_CH1_CR_SC_IO_LATENCY_RT_IOCOMP_WID ( 6)
+ #define MCHBAR_CH1_CR_SC_IO_LATENCY_RT_IOCOMP_MSK (0x003F0000)
+ #define MCHBAR_CH1_CR_SC_IO_LATENCY_RT_IOCOMP_MAX (0x0000003F)
+ #define MCHBAR_CH1_CR_SC_IO_LATENCY_RT_IOCOMP_DEF (0x0000000E)
+ #define MCHBAR_CH1_CR_SC_IO_LATENCY_three_channels_OFF (30)
+ #define MCHBAR_CH1_CR_SC_IO_LATENCY_three_channels_WID ( 1)
+ #define MCHBAR_CH1_CR_SC_IO_LATENCY_three_channels_MSK (0x40000000)
+ #define MCHBAR_CH1_CR_SC_IO_LATENCY_three_channels_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_SC_IO_LATENCY_three_channels_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_SC_IO_LATENCY_DIS_RT_CLK_GATE_OFF (31)
+ #define MCHBAR_CH1_CR_SC_IO_LATENCY_DIS_RT_CLK_GATE_WID ( 1)
+ #define MCHBAR_CH1_CR_SC_IO_LATENCY_DIS_RT_CLK_GATE_MSK (0x80000000)
+ #define MCHBAR_CH1_CR_SC_IO_LATENCY_DIS_RT_CLK_GATE_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_SC_IO_LATENCY_DIS_RT_CLK_GATE_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_ROUND_TRIP_DFT_DATA_REG (0x0000442C)
+ #define MCHBAR_CH1_CR_ROUND_TRIP_DFT_DATA_DATA_OFF ( 0)
+ #define MCHBAR_CH1_CR_ROUND_TRIP_DFT_DATA_DATA_WID (32)
+ #define MCHBAR_CH1_CR_ROUND_TRIP_DFT_DATA_DATA_MSK (0xFFFFFFFF)
+ #define MCHBAR_CH1_CR_ROUND_TRIP_DFT_DATA_DATA_MAX (0xFFFFFFFF)
+ #define MCHBAR_CH1_CR_ROUND_TRIP_DFT_DATA_DATA_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_DFT_MISC_REG (0x00004430)
+ #define MCHBAR_CH1_CR_DFT_MISC_WDAR_OFF ( 0)
+ #define MCHBAR_CH1_CR_DFT_MISC_WDAR_WID ( 1)
+ #define MCHBAR_CH1_CR_DFT_MISC_WDAR_MSK (0x00000001)
+ #define MCHBAR_CH1_CR_DFT_MISC_WDAR_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_DFT_MISC_WDAR_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_DFT_MISC_safe_mask_sel_OFF ( 1)
+ #define MCHBAR_CH1_CR_DFT_MISC_safe_mask_sel_WID ( 3)
+ #define MCHBAR_CH1_CR_DFT_MISC_safe_mask_sel_MSK (0x0000000E)
+ #define MCHBAR_CH1_CR_DFT_MISC_safe_mask_sel_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_DFT_MISC_safe_mask_sel_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_DFT_MISC_force_rcv_en_OFF ( 4)
+ #define MCHBAR_CH1_CR_DFT_MISC_force_rcv_en_WID ( 1)
+ #define MCHBAR_CH1_CR_DFT_MISC_force_rcv_en_MSK (0x00000010)
+ #define MCHBAR_CH1_CR_DFT_MISC_force_rcv_en_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_DFT_MISC_force_rcv_en_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_DFT_MISC_DDR_QUAL_OFF ( 8)
+ #define MCHBAR_CH1_CR_DFT_MISC_DDR_QUAL_WID ( 2)
+ #define MCHBAR_CH1_CR_DFT_MISC_DDR_QUAL_MSK (0x00000300)
+ #define MCHBAR_CH1_CR_DFT_MISC_DDR_QUAL_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_DFT_MISC_DDR_QUAL_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_DFT_MISC_Qual_length_OFF (10)
+ #define MCHBAR_CH1_CR_DFT_MISC_Qual_length_WID ( 2)
+ #define MCHBAR_CH1_CR_DFT_MISC_Qual_length_MSK (0x00000C00)
+ #define MCHBAR_CH1_CR_DFT_MISC_Qual_length_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_DFT_MISC_Qual_length_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_DFT_MISC_WDB_Block_En_OFF (12)
+ #define MCHBAR_CH1_CR_DFT_MISC_WDB_Block_En_WID ( 1)
+ #define MCHBAR_CH1_CR_DFT_MISC_WDB_Block_En_MSK (0x00001000)
+ #define MCHBAR_CH1_CR_DFT_MISC_WDB_Block_En_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_DFT_MISC_WDB_Block_En_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_DFT_MISC_RT_DFT_READ_PTR_OFF (13)
+ #define MCHBAR_CH1_CR_DFT_MISC_RT_DFT_READ_PTR_WID ( 4)
+ #define MCHBAR_CH1_CR_DFT_MISC_RT_DFT_READ_PTR_MSK (0x0001E000)
+ #define MCHBAR_CH1_CR_DFT_MISC_RT_DFT_READ_PTR_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_DFT_MISC_RT_DFT_READ_PTR_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_DFT_MISC_RT_DFT_READ_ENABLE_OFF (17)
+ #define MCHBAR_CH1_CR_DFT_MISC_RT_DFT_READ_ENABLE_WID ( 1)
+ #define MCHBAR_CH1_CR_DFT_MISC_RT_DFT_READ_ENABLE_MSK (0x00020000)
+ #define MCHBAR_CH1_CR_DFT_MISC_RT_DFT_READ_ENABLE_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_DFT_MISC_RT_DFT_READ_ENABLE_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_DFT_MISC_RT_DFT_READ_SEL_ADDR_OFF (18)
+ #define MCHBAR_CH1_CR_DFT_MISC_RT_DFT_READ_SEL_ADDR_WID ( 1)
+ #define MCHBAR_CH1_CR_DFT_MISC_RT_DFT_READ_SEL_ADDR_MSK (0x00040000)
+ #define MCHBAR_CH1_CR_DFT_MISC_RT_DFT_READ_SEL_ADDR_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_DFT_MISC_RT_DFT_READ_SEL_ADDR_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_READ_RETURN_DFT_REG (0x00004434)
+ #define MCHBAR_CH1_CR_READ_RETURN_DFT_ECC_OFF ( 0)
+ #define MCHBAR_CH1_CR_READ_RETURN_DFT_ECC_WID ( 8)
+ #define MCHBAR_CH1_CR_READ_RETURN_DFT_ECC_MSK (0x000000FF)
+ #define MCHBAR_CH1_CR_READ_RETURN_DFT_ECC_MAX (0x000000FF)
+ #define MCHBAR_CH1_CR_READ_RETURN_DFT_ECC_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_READ_RETURN_DFT_RRD_DFT_Mode_OFF ( 8)
+ #define MCHBAR_CH1_CR_READ_RETURN_DFT_RRD_DFT_Mode_WID ( 2)
+ #define MCHBAR_CH1_CR_READ_RETURN_DFT_RRD_DFT_Mode_MSK (0x00000300)
+ #define MCHBAR_CH1_CR_READ_RETURN_DFT_RRD_DFT_Mode_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_READ_RETURN_DFT_RRD_DFT_Mode_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_READ_RETURN_DFT_LFSR_Seed_Index_OFF (10)
+ #define MCHBAR_CH1_CR_READ_RETURN_DFT_LFSR_Seed_Index_WID ( 5)
+ #define MCHBAR_CH1_CR_READ_RETURN_DFT_LFSR_Seed_Index_MSK (0x00007C00)
+ #define MCHBAR_CH1_CR_READ_RETURN_DFT_LFSR_Seed_Index_MAX (0x0000001F)
+ #define MCHBAR_CH1_CR_READ_RETURN_DFT_LFSR_Seed_Index_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_READ_RETURN_DFT_Inversion_Mode_OFF (15)
+ #define MCHBAR_CH1_CR_READ_RETURN_DFT_Inversion_Mode_WID ( 1)
+ #define MCHBAR_CH1_CR_READ_RETURN_DFT_Inversion_Mode_MSK (0x00008000)
+ #define MCHBAR_CH1_CR_READ_RETURN_DFT_Inversion_Mode_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_READ_RETURN_DFT_Inversion_Mode_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_SCHED_SECOND_CBIT_REG (0x00004438)
+ #define MCHBAR_CH1_CR_SCHED_SECOND_CBIT_dis_imph_error_OFF ( 0)
+ #define MCHBAR_CH1_CR_SCHED_SECOND_CBIT_dis_imph_error_WID ( 1)
+ #define MCHBAR_CH1_CR_SCHED_SECOND_CBIT_dis_imph_error_MSK (0x00000001)
+ #define MCHBAR_CH1_CR_SCHED_SECOND_CBIT_dis_imph_error_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_SCHED_SECOND_CBIT_dis_imph_error_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_SCHED_SECOND_CBIT_dis_async_odt_OFF ( 8)
+ #define MCHBAR_CH1_CR_SCHED_SECOND_CBIT_dis_async_odt_WID ( 1)
+ #define MCHBAR_CH1_CR_SCHED_SECOND_CBIT_dis_async_odt_MSK (0x00000100)
+ #define MCHBAR_CH1_CR_SCHED_SECOND_CBIT_dis_async_odt_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_SCHED_SECOND_CBIT_dis_async_odt_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_REG (0x00004440)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux0_Control_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux0_Control_WID ( 2)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux0_Control_MSK (0x00000003)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux0_Control_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux0_Control_DEF (0x00000001)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux1_Control_OFF ( 3)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux1_Control_WID ( 2)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux1_Control_MSK (0x00000018)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux1_Control_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux1_Control_DEF (0x00000001)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux2_Control_OFF ( 6)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux2_Control_WID ( 2)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux2_Control_MSK (0x000000C0)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux2_Control_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Mux2_Control_DEF (0x00000001)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_ECC_Replace_Byte_Control_OFF (14)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_ECC_Replace_Byte_Control_WID ( 1)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_ECC_Replace_Byte_Control_MSK (0x00004000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_ECC_Replace_Byte_Control_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_ECC_Replace_Byte_Control_DEF (0x00000001)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_ECC_Data_Source_Sel_OFF (15)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_ECC_Data_Source_Sel_WID ( 1)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_ECC_Data_Source_Sel_MSK (0x00008000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_ECC_Data_Source_Sel_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_ECC_Data_Source_Sel_DEF (0x00000001)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Save_LFSR_Seed_Rate_OFF (16)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Save_LFSR_Seed_Rate_WID ( 6)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Save_LFSR_Seed_Rate_MSK (0x003F0000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Save_LFSR_Seed_Rate_MAX (0x0000003F)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Save_LFSR_Seed_Rate_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Reload_LFSR_Seed_Rate_OFF (24)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Reload_LFSR_Seed_Rate_WID ( 3)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Reload_LFSR_Seed_Rate_MSK (0x07000000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Reload_LFSR_Seed_Rate_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_Reload_LFSR_Seed_Rate_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_RD_STATUS_REG (0x00004444)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_RD_STATUS_WDB_Current_Read_Pointer_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_RD_STATUS_WDB_Current_Read_Pointer_WID ( 6)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_RD_STATUS_WDB_Current_Read_Pointer_MSK (0x0000003F)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_RD_STATUS_WDB_Current_Read_Pointer_MAX (0x0000003F)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_RD_STATUS_WDB_Current_Read_Pointer_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_0_REG (0x00004448)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_0_Pattern_Buffer_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_0_Pattern_Buffer_WID (24)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_0_Pattern_Buffer_MSK (0x00FFFFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_0_Pattern_Buffer_MAX (0x00FFFFFF)
+
+#define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_1_REG (0x0000444C)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_1_Pattern_Buffer_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_1_Pattern_Buffer_WID (24)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_1_Pattern_Buffer_MSK (0x00FFFFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_1_Pattern_Buffer_MAX (0x00FFFFFF)
+
+#define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_2_REG (0x00004450)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_2_Pattern_Buffer_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_2_Pattern_Buffer_WID (24)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_2_Pattern_Buffer_MSK (0x00FFFFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_2_Pattern_Buffer_MAX (0x00FFFFFF)
+
+#define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_0_REG (0x00004454)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_0_Pattern_Buffer_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_0_Pattern_Buffer_WID (24)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_0_Pattern_Buffer_MSK (0x00FFFFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_0_Pattern_Buffer_MAX (0x00FFFFFF)
+
+#define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_1_REG (0x00004458)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_1_Pattern_Buffer_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_1_Pattern_Buffer_WID (24)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_1_Pattern_Buffer_MSK (0x00FFFFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_1_Pattern_Buffer_MAX (0x00FFFFFF)
+
+#define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_2_REG (0x0000445C)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_2_Pattern_Buffer_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_2_Pattern_Buffer_WID (24)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_2_Pattern_Buffer_MSK (0x00FFFFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_2_Pattern_Buffer_MAX (0x00FFFFFF)
+
+#define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_0_REG (0x00004460)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_0_Pattern_Buffer_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_0_Pattern_Buffer_WID (24)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_0_Pattern_Buffer_MSK (0x00FFFFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_0_Pattern_Buffer_MAX (0x00FFFFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_0_Pattern_Buffer_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_1_REG (0x00004464)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_1_Pattern_Buffer_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_1_Pattern_Buffer_WID (24)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_1_Pattern_Buffer_MSK (0x00FFFFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_1_Pattern_Buffer_MAX (0x00FFFFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_1_Pattern_Buffer_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_2_REG (0x00004468)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_2_Pattern_Buffer_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_2_Pattern_Buffer_WID (24)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_2_Pattern_Buffer_MSK (0x00FFFFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_2_Pattern_Buffer_MAX (0x00FFFFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_WR_2_Pattern_Buffer_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_0_REG (0x0000446C)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_0_Pattern_Buffer_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_0_Pattern_Buffer_WID (24)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_0_Pattern_Buffer_MSK (0x00FFFFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_0_Pattern_Buffer_MAX (0x00FFFFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_0_Pattern_Buffer_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_1_REG (0x00004470)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_1_Pattern_Buffer_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_1_Pattern_Buffer_WID (24)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_1_Pattern_Buffer_MSK (0x00FFFFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_1_Pattern_Buffer_MAX (0x00FFFFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_1_Pattern_Buffer_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_2_REG (0x00004474)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_2_Pattern_Buffer_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_2_Pattern_Buffer_WID (24)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_2_Pattern_Buffer_MSK (0x00FFFFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_2_Pattern_Buffer_MAX (0x00FFFFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_STATUS_RD_2_Pattern_Buffer_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_REG (0x00004478)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_L_data_select_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_L_data_select_WID ( 1)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_L_data_select_MSK (0x00000001)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_L_data_select_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_L_data_select_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_Enable_Sweep_Frequency_OFF ( 1)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_Enable_Sweep_Frequency_WID ( 1)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_Enable_Sweep_Frequency_MSK (0x00000002)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_Enable_Sweep_Frequency_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_Enable_Sweep_Frequency_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_L_counter_OFF ( 8)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_L_counter_WID ( 8)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_L_counter_MSK (0x0000FF00)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_L_counter_MAX (0x000000FF)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_L_counter_DEF (0x00000001)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_M_counter_OFF (16)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_M_counter_WID ( 8)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_M_counter_MSK (0x00FF0000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_M_counter_MAX (0x000000FF)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_M_counter_DEF (0x00000001)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_N_counter_OFF (24)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_N_counter_WID ( 8)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_N_counter_MSK (0xFF000000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_N_counter_MAX (0x000000FF)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_N_counter_DEF (0x00000001)
+
+#define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_INV_REG (0x00004484)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_INV_ECC_Inv_or_DC_Enable_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_INV_ECC_Inv_or_DC_Enable_WID ( 8)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_INV_ECC_Inv_or_DC_Enable_MSK (0x000000FF)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_INV_ECC_Inv_or_DC_Enable_MAX (0x000000FF)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_INV_ECC_Inv_or_DC_Enable_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Shift_Rate_OFF (16)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Shift_Rate_WID ( 4)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Shift_Rate_MSK (0x000F0000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Shift_Rate_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Shift_Rate_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_INV_DC_Polarity_Control_OFF (20)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_INV_DC_Polarity_Control_WID ( 1)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_INV_DC_Polarity_Control_MSK (0x00100000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_INV_DC_Polarity_Control_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_INV_DC_Polarity_Control_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Control_OFF (30)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Control_WID ( 1)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Control_MSK (0x40000000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Control_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Control_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Shift_Enable_OFF (31)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Shift_Enable_WID ( 1)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Shift_Enable_MSK (0x80000000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Shift_Enable_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_INV_Inv_or_DC_Shift_Enable_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_DATA_INV_REG (0x00004490)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_DATA_INV_Data_Inv_or_DC_Enable_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_DATA_INV_Data_Inv_or_DC_Enable_WID (64)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_DATA_INV_Data_Inv_or_DC_Enable_MSK (0xFFFFFFFFFFFFFFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_DATA_INV_Data_Inv_or_DC_Enable_MAX (0xFFFFFFFFFFFFFFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_DATA_INV_Data_Inv_or_DC_Enable_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_ERR_CTL_REG (0x00004498)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_CTL_Stop_on_Nth_Error_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_CTL_Stop_on_Nth_Error_WID ( 6)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_CTL_Stop_on_Nth_Error_MSK (0x0000003F)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_CTL_Stop_on_Nth_Error_MAX (0x0000003F)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_CTL_Stop_on_Nth_Error_DEF (0x00000001)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_CTL_Stop_On_Error_Control_OFF (12)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_CTL_Stop_On_Error_Control_WID ( 2)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_CTL_Stop_On_Error_Control_MSK (0x00003000)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_CTL_Stop_On_Error_Control_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_CTL_Stop_On_Error_Control_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_CTL_Selective_Error_Enable_Chunk_OFF (16)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_CTL_Selective_Error_Enable_Chunk_WID ( 8)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_CTL_Selective_Error_Enable_Chunk_MSK (0x00FF0000)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_CTL_Selective_Error_Enable_Chunk_MAX (0x000000FF)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_CTL_Selective_Error_Enable_Chunk_DEF (0x000000FF)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_CTL_Selective_Error_Enable_Cacheline_OFF (24)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_CTL_Selective_Error_Enable_Cacheline_WID ( 8)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_CTL_Selective_Error_Enable_Cacheline_MSK (0xFF000000)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_CTL_Selective_Error_Enable_Cacheline_MAX (0x000000FF)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_CTL_Selective_Error_Enable_Cacheline_DEF (0x000000FF)
+
+#define MCHBAR_CH1_CR_REUT_CH_ERR_ECC_MASK_REG (0x0000449C)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_ECC_MASK_ECC_Error_Mask_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_ECC_MASK_ECC_Error_Mask_WID ( 8)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_ECC_MASK_ECC_Error_Mask_MSK (0x000000FF)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_ECC_MASK_ECC_Error_Mask_MAX (0x000000FF)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_ECC_MASK_ECC_Error_Mask_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_STM_CONFIG_REG (0x000044A4)
+ #define MCHBAR_CH1_CR_STM_CONFIG_Stretch_mode_OFF ( 0)
+ #define MCHBAR_CH1_CR_STM_CONFIG_Stretch_mode_WID ( 2)
+ #define MCHBAR_CH1_CR_STM_CONFIG_Stretch_mode_MSK (0x00000003)
+ #define MCHBAR_CH1_CR_STM_CONFIG_Stretch_mode_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_STM_CONFIG_Stretch_mode_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_STM_CONFIG_STF_OFF ( 4)
+ #define MCHBAR_CH1_CR_STM_CONFIG_STF_WID ( 3)
+ #define MCHBAR_CH1_CR_STM_CONFIG_STF_MSK (0x00000070)
+ #define MCHBAR_CH1_CR_STM_CONFIG_STF_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_STM_CONFIG_STF_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_SC_PR_CNT_CONFIG_REG (0x000044A8)
+ #define MCHBAR_CH1_CR_SC_PR_CNT_CONFIG_Priority_count_ring_OFF ( 0)
+ #define MCHBAR_CH1_CR_SC_PR_CNT_CONFIG_Priority_count_ring_WID (10)
+ #define MCHBAR_CH1_CR_SC_PR_CNT_CONFIG_Priority_count_ring_MSK (0x000003FF)
+ #define MCHBAR_CH1_CR_SC_PR_CNT_CONFIG_Priority_count_ring_MAX (0x000003FF)
+ #define MCHBAR_CH1_CR_SC_PR_CNT_CONFIG_Priority_count_ring_DEF (0x00000040)
+ #define MCHBAR_CH1_CR_SC_PR_CNT_CONFIG_Priority_count_SA_OFF (16)
+ #define MCHBAR_CH1_CR_SC_PR_CNT_CONFIG_Priority_count_SA_WID (10)
+ #define MCHBAR_CH1_CR_SC_PR_CNT_CONFIG_Priority_count_SA_MSK (0x03FF0000)
+ #define MCHBAR_CH1_CR_SC_PR_CNT_CONFIG_Priority_count_SA_MAX (0x000003FF)
+ #define MCHBAR_CH1_CR_SC_PR_CNT_CONFIG_Priority_count_SA_DEF (0x00000100)
+
+#define MCHBAR_CH1_CR_SC_PCIT_REG (0x000044AC)
+ #define MCHBAR_CH1_CR_SC_PCIT_PCIT_OFF ( 0)
+ #define MCHBAR_CH1_CR_SC_PCIT_PCIT_WID ( 8)
+ #define MCHBAR_CH1_CR_SC_PCIT_PCIT_MSK (0x000000FF)
+ #define MCHBAR_CH1_CR_SC_PCIT_PCIT_MAX (0x000000FF)
+ #define MCHBAR_CH1_CR_SC_PCIT_PCIT_DEF (0x00000040)
+
+#define MCHBAR_CH1_CR_PM_PDWN_CONFIG_REG (0x000044B0)
+ #define MCHBAR_CH1_CR_PM_PDWN_CONFIG_PDWN_idle_counter_OFF ( 0)
+ #define MCHBAR_CH1_CR_PM_PDWN_CONFIG_PDWN_idle_counter_WID (12)
+ #define MCHBAR_CH1_CR_PM_PDWN_CONFIG_PDWN_idle_counter_MSK (0x00000FFF)
+ #define MCHBAR_CH1_CR_PM_PDWN_CONFIG_PDWN_idle_counter_MAX (0x00000FFF)
+ #define MCHBAR_CH1_CR_PM_PDWN_CONFIG_PDWN_idle_counter_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_PM_PDWN_CONFIG_PDWN_mode_OFF (12)
+ #define MCHBAR_CH1_CR_PM_PDWN_CONFIG_PDWN_mode_WID ( 4)
+ #define MCHBAR_CH1_CR_PM_PDWN_CONFIG_PDWN_mode_MSK (0x0000F000)
+ #define MCHBAR_CH1_CR_PM_PDWN_CONFIG_PDWN_mode_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_PM_PDWN_CONFIG_PDWN_mode_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_ECC_INJECT_COUNT_REG (0x000044B4)
+ #define MCHBAR_CH1_CR_ECC_INJECT_COUNT_Count_OFF ( 0)
+ #define MCHBAR_CH1_CR_ECC_INJECT_COUNT_Count_WID (32)
+ #define MCHBAR_CH1_CR_ECC_INJECT_COUNT_Count_MSK (0xFFFFFFFF)
+ #define MCHBAR_CH1_CR_ECC_INJECT_COUNT_Count_MAX (0xFFFFFFFF)
+ #define MCHBAR_CH1_CR_ECC_INJECT_COUNT_Count_DEF (0xFFFFFFFF)
+
+#define MCHBAR_CH1_CR_ECC_DFT_REG (0x000044B8)
+ #define MCHBAR_CH1_CR_ECC_DFT_ECC4ANA_fill_OFF ( 0)
+ #define MCHBAR_CH1_CR_ECC_DFT_ECC4ANA_fill_WID ( 8)
+ #define MCHBAR_CH1_CR_ECC_DFT_ECC4ANA_fill_MSK (0x000000FF)
+ #define MCHBAR_CH1_CR_ECC_DFT_ECC4ANA_fill_MAX (0x000000FF)
+ #define MCHBAR_CH1_CR_ECC_DFT_ECC4ANA_fill_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ECC_DFT_ECC4ANA_trigger_OFF ( 8)
+ #define MCHBAR_CH1_CR_ECC_DFT_ECC4ANA_trigger_WID ( 2)
+ #define MCHBAR_CH1_CR_ECC_DFT_ECC4ANA_trigger_MSK (0x00000300)
+ #define MCHBAR_CH1_CR_ECC_DFT_ECC4ANA_trigger_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_ECC_DFT_ECC4ANA_trigger_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ECC_DFT_ECC4ANA_BS_OFF (10)
+ #define MCHBAR_CH1_CR_ECC_DFT_ECC4ANA_BS_WID ( 1)
+ #define MCHBAR_CH1_CR_ECC_DFT_ECC4ANA_BS_MSK (0x00000400)
+ #define MCHBAR_CH1_CR_ECC_DFT_ECC4ANA_BS_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_ECC_DFT_ECC4ANA_BS_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ECC_DFT_ECC_Inject_OFF (11)
+ #define MCHBAR_CH1_CR_ECC_DFT_ECC_Inject_WID ( 3)
+ #define MCHBAR_CH1_CR_ECC_DFT_ECC_Inject_MSK (0x00003800)
+ #define MCHBAR_CH1_CR_ECC_DFT_ECC_Inject_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_ECC_DFT_ECC_Inject_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ECC_DFT_ECC_correction_disable_OFF (14)
+ #define MCHBAR_CH1_CR_ECC_DFT_ECC_correction_disable_WID ( 1)
+ #define MCHBAR_CH1_CR_ECC_DFT_ECC_correction_disable_MSK (0x00004000)
+ #define MCHBAR_CH1_CR_ECC_DFT_ECC_correction_disable_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_ECC_DFT_ECC_correction_disable_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ECC_DFT_ECC4ANA_Inject_OFF (15)
+ #define MCHBAR_CH1_CR_ECC_DFT_ECC4ANA_Inject_WID ( 1)
+ #define MCHBAR_CH1_CR_ECC_DFT_ECC4ANA_Inject_MSK (0x00008000)
+ #define MCHBAR_CH1_CR_ECC_DFT_ECC4ANA_Inject_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_ECC_DFT_ECC4ANA_Inject_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ECC_DFT_DIS_MCA_LOG_OFF (16)
+ #define MCHBAR_CH1_CR_ECC_DFT_DIS_MCA_LOG_WID ( 1)
+ #define MCHBAR_CH1_CR_ECC_DFT_DIS_MCA_LOG_MSK (0x00010000)
+ #define MCHBAR_CH1_CR_ECC_DFT_DIS_MCA_LOG_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_ECC_DFT_DIS_MCA_LOG_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ECC_DFT_DIS_PCH_EVENT_OFF (17)
+ #define MCHBAR_CH1_CR_ECC_DFT_DIS_PCH_EVENT_WID ( 1)
+ #define MCHBAR_CH1_CR_ECC_DFT_DIS_PCH_EVENT_MSK (0x00020000)
+ #define MCHBAR_CH1_CR_ECC_DFT_DIS_PCH_EVENT_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_ECC_DFT_DIS_PCH_EVENT_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ECC_DFT_DIS_PCIE_POISON_OFF (18)
+ #define MCHBAR_CH1_CR_ECC_DFT_DIS_PCIE_POISON_WID ( 1)
+ #define MCHBAR_CH1_CR_ECC_DFT_DIS_PCIE_POISON_MSK (0x00040000)
+ #define MCHBAR_CH1_CR_ECC_DFT_DIS_PCIE_POISON_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_ECC_DFT_DIS_PCIE_POISON_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_VISA_CTL_MCSCHEDS_REG (0x000044C0)
+ #define MCHBAR_CH1_CR_VISA_CTL_MCSCHEDS_Data_OFF ( 0)
+ #define MCHBAR_CH1_CR_VISA_CTL_MCSCHEDS_Data_WID (18)
+ #define MCHBAR_CH1_CR_VISA_CTL_MCSCHEDS_Data_MSK (0x0003FFFF)
+ #define MCHBAR_CH1_CR_VISA_CTL_MCSCHEDS_Data_MAX (0x0003FFFF)
+ #define MCHBAR_CH1_CR_VISA_CTL_MCSCHEDS_Data_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_VISA_CTL_MCSCHEDS_VORANGE_OFF (31)
+ #define MCHBAR_CH1_CR_VISA_CTL_MCSCHEDS_VORANGE_WID ( 1)
+ #define MCHBAR_CH1_CR_VISA_CTL_MCSCHEDS_VORANGE_MSK (0x80000000)
+ #define MCHBAR_CH1_CR_VISA_CTL_MCSCHEDS_VORANGE_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_VISA_CTL_MCSCHEDS_VORANGE_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_VISA_XBAR_MCSCHEDS_REG (0x000044C4)
+ #define MCHBAR_CH1_CR_VISA_XBAR_MCSCHEDS_Data_OFF ( 0)
+ #define MCHBAR_CH1_CR_VISA_XBAR_MCSCHEDS_Data_WID (32)
+ #define MCHBAR_CH1_CR_VISA_XBAR_MCSCHEDS_Data_MSK (0xFFFFFFFF)
+ #define MCHBAR_CH1_CR_VISA_XBAR_MCSCHEDS_Data_MAX (0xFFFFFFFF)
+ #define MCHBAR_CH1_CR_VISA_XBAR_MCSCHEDS_Data_DEF (0x76543210)
+
+#define MCHBAR_CH1_CR_ECCERRLOG0_REG (0x000044C8)
+ #define MCHBAR_CH1_CR_ECCERRLOG0_CERRSTS_OFF ( 0)
+ #define MCHBAR_CH1_CR_ECCERRLOG0_CERRSTS_WID ( 1)
+ #define MCHBAR_CH1_CR_ECCERRLOG0_CERRSTS_MSK (0x00000001)
+ #define MCHBAR_CH1_CR_ECCERRLOG0_CERRSTS_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_ECCERRLOG0_CERRSTS_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ECCERRLOG0_MERRSTS_OFF ( 1)
+ #define MCHBAR_CH1_CR_ECCERRLOG0_MERRSTS_WID ( 1)
+ #define MCHBAR_CH1_CR_ECCERRLOG0_MERRSTS_MSK (0x00000002)
+ #define MCHBAR_CH1_CR_ECCERRLOG0_MERRSTS_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_ECCERRLOG0_MERRSTS_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ECCERRLOG0_ERRSYND_OFF (16)
+ #define MCHBAR_CH1_CR_ECCERRLOG0_ERRSYND_WID ( 8)
+ #define MCHBAR_CH1_CR_ECCERRLOG0_ERRSYND_MSK (0x00FF0000)
+ #define MCHBAR_CH1_CR_ECCERRLOG0_ERRSYND_MAX (0x000000FF)
+ #define MCHBAR_CH1_CR_ECCERRLOG0_ERRSYND_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ECCERRLOG0_ERRCHUNK_OFF (24)
+ #define MCHBAR_CH1_CR_ECCERRLOG0_ERRCHUNK_WID ( 3)
+ #define MCHBAR_CH1_CR_ECCERRLOG0_ERRCHUNK_MSK (0x07000000)
+ #define MCHBAR_CH1_CR_ECCERRLOG0_ERRCHUNK_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_ECCERRLOG0_ERRCHUNK_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ECCERRLOG0_ERRRANK_OFF (27)
+ #define MCHBAR_CH1_CR_ECCERRLOG0_ERRRANK_WID ( 2)
+ #define MCHBAR_CH1_CR_ECCERRLOG0_ERRRANK_MSK (0x18000000)
+ #define MCHBAR_CH1_CR_ECCERRLOG0_ERRRANK_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_ECCERRLOG0_ERRRANK_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ECCERRLOG0_ERRBANK_OFF (29)
+ #define MCHBAR_CH1_CR_ECCERRLOG0_ERRBANK_WID ( 3)
+ #define MCHBAR_CH1_CR_ECCERRLOG0_ERRBANK_MSK (0xE0000000)
+ #define MCHBAR_CH1_CR_ECCERRLOG0_ERRBANK_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_ECCERRLOG0_ERRBANK_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_ECCERRLOG1_REG (0x000044CC)
+ #define MCHBAR_CH1_CR_ECCERRLOG1_ERRROW_OFF ( 0)
+ #define MCHBAR_CH1_CR_ECCERRLOG1_ERRROW_WID (16)
+ #define MCHBAR_CH1_CR_ECCERRLOG1_ERRROW_MSK (0x0000FFFF)
+ #define MCHBAR_CH1_CR_ECCERRLOG1_ERRROW_MAX (0x0000FFFF)
+ #define MCHBAR_CH1_CR_ECCERRLOG1_ERRROW_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ECCERRLOG1_ERRCOL_OFF (16)
+ #define MCHBAR_CH1_CR_ECCERRLOG1_ERRCOL_WID (16)
+ #define MCHBAR_CH1_CR_ECCERRLOG1_ERRCOL_MSK (0xFFFF0000)
+ #define MCHBAR_CH1_CR_ECCERRLOG1_ERRCOL_MAX (0x0000FFFF)
+ #define MCHBAR_CH1_CR_ECCERRLOG1_ERRCOL_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_SC_WR_ADD_DELAY_REG (0x000044D0)
+ #define MCHBAR_CH1_CR_SC_WR_ADD_DELAY_D0R0_OFF ( 0)
+ #define MCHBAR_CH1_CR_SC_WR_ADD_DELAY_D0R0_WID ( 2)
+ #define MCHBAR_CH1_CR_SC_WR_ADD_DELAY_D0R0_MSK (0x00000003)
+ #define MCHBAR_CH1_CR_SC_WR_ADD_DELAY_D0R0_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_SC_WR_ADD_DELAY_D0R0_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_SC_WR_ADD_DELAY_D0R1_OFF ( 2)
+ #define MCHBAR_CH1_CR_SC_WR_ADD_DELAY_D0R1_WID ( 2)
+ #define MCHBAR_CH1_CR_SC_WR_ADD_DELAY_D0R1_MSK (0x0000000C)
+ #define MCHBAR_CH1_CR_SC_WR_ADD_DELAY_D0R1_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_SC_WR_ADD_DELAY_D0R1_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_SC_WR_ADD_DELAY_D1R0_OFF ( 4)
+ #define MCHBAR_CH1_CR_SC_WR_ADD_DELAY_D1R0_WID ( 2)
+ #define MCHBAR_CH1_CR_SC_WR_ADD_DELAY_D1R0_MSK (0x00000030)
+ #define MCHBAR_CH1_CR_SC_WR_ADD_DELAY_D1R0_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_SC_WR_ADD_DELAY_D1R0_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_SC_WR_ADD_DELAY_D1R1_OFF ( 6)
+ #define MCHBAR_CH1_CR_SC_WR_ADD_DELAY_D1R1_WID ( 2)
+ #define MCHBAR_CH1_CR_SC_WR_ADD_DELAY_D1R1_MSK (0x000000C0)
+ #define MCHBAR_CH1_CR_SC_WR_ADD_DELAY_D1R1_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_SC_WR_ADD_DELAY_D1R1_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_WMM_READ_CONFIG_REG (0x000044D4)
+ #define MCHBAR_CH1_CR_WMM_READ_CONFIG_Dis_Opp_rd_OFF ( 0)
+ #define MCHBAR_CH1_CR_WMM_READ_CONFIG_Dis_Opp_rd_WID ( 1)
+ #define MCHBAR_CH1_CR_WMM_READ_CONFIG_Dis_Opp_rd_MSK (0x00000001)
+ #define MCHBAR_CH1_CR_WMM_READ_CONFIG_Dis_Opp_rd_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_WMM_READ_CONFIG_Dis_Opp_rd_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_WMM_READ_CONFIG_ACT_Enable_OFF ( 1)
+ #define MCHBAR_CH1_CR_WMM_READ_CONFIG_ACT_Enable_WID ( 1)
+ #define MCHBAR_CH1_CR_WMM_READ_CONFIG_ACT_Enable_MSK (0x00000002)
+ #define MCHBAR_CH1_CR_WMM_READ_CONFIG_ACT_Enable_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_WMM_READ_CONFIG_ACT_Enable_DEF (0x00000001)
+ #define MCHBAR_CH1_CR_WMM_READ_CONFIG_PRE_Enable_OFF ( 2)
+ #define MCHBAR_CH1_CR_WMM_READ_CONFIG_PRE_Enable_WID ( 1)
+ #define MCHBAR_CH1_CR_WMM_READ_CONFIG_PRE_Enable_MSK (0x00000004)
+ #define MCHBAR_CH1_CR_WMM_READ_CONFIG_PRE_Enable_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_WMM_READ_CONFIG_PRE_Enable_DEF (0x00000001)
+ #define MCHBAR_CH1_CR_WMM_READ_CONFIG_MAX_RPQ_Cas_OFF ( 3)
+ #define MCHBAR_CH1_CR_WMM_READ_CONFIG_MAX_RPQ_Cas_WID ( 4)
+ #define MCHBAR_CH1_CR_WMM_READ_CONFIG_MAX_RPQ_Cas_MSK (0x00000078)
+ #define MCHBAR_CH1_CR_WMM_READ_CONFIG_MAX_RPQ_Cas_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_WMM_READ_CONFIG_MAX_RPQ_Cas_DEF (0x00000008)
+
+#define MCHBAR_CH1_CR_REUT_CH_ERR_DATA_MASK_REG (0x000044D8)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_DATA_MASK_Data_Error_Mask_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_DATA_MASK_Data_Error_Mask_WID (64)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_DATA_MASK_Data_Error_Mask_MSK (0xFFFFFFFFFFFFFFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_DATA_MASK_Data_Error_Mask_MAX (0xFFFFFFFFFFFFFFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_DATA_MASK_Data_Error_Mask_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_ERR_DATA_STATUS_REG (0x000044E0)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_DATA_STATUS_Data_Error_Status_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_DATA_STATUS_Data_Error_Status_WID (64)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_DATA_STATUS_Data_Error_Status_MSK (0xFFFFFFFFFFFFFFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_DATA_STATUS_Data_Error_Status_MAX (0xFFFFFFFFFFFFFFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_DATA_STATUS_Data_Error_Status_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_REG (0x000044E8)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_ECC_Error_Status_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_ECC_Error_Status_WID ( 8)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_ECC_Error_Status_MSK (0x000000FF)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_ECC_Error_Status_MAX (0x000000FF)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_ECC_Error_Status_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Chunk_Error_Status_OFF ( 8)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Chunk_Error_Status_WID ( 8)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Chunk_Error_Status_MSK (0x0000FF00)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Chunk_Error_Status_MAX (0x000000FF)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Chunk_Error_Status_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Rank_Error_Status_OFF (16)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Rank_Error_Status_WID ( 4)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Rank_Error_Status_MSK (0x000F0000)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Rank_Error_Status_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Rank_Error_Status_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Byte_Group_Error_Status_OFF (32)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Byte_Group_Error_Status_WID ( 9)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Byte_Group_Error_Status_MSK (0x1FF00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Byte_Group_Error_Status_MAX (0x000001FF)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Byte_Group_Error_Status_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_WDB_Rd_Chunk_Num_Status_OFF (52)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_WDB_Rd_Chunk_Num_Status_WID ( 3)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_WDB_Rd_Chunk_Num_Status_MSK (0x70000000000000)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_WDB_Rd_Chunk_Num_Status_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_WDB_Rd_Chunk_Num_Status_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Nth_Error_OFF (56)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Nth_Error_WID ( 6)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Nth_Error_MSK (0x3F00000000000000)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Nth_Error_MAX (0x0000003F)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_Nth_Error_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_0_REG (0x000044F0)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_0_Counter_Pointer_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_0_Counter_Pointer_WID ( 7)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_0_Counter_Pointer_MSK (0x0000007F)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_0_Counter_Pointer_MAX (0x0000007F)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_0_Counter_Pointer_DEF (0x0000007F)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_0_Counter_Control_OFF ( 7)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_0_Counter_Control_WID ( 2)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_0_Counter_Control_MSK (0x00000180)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_0_Counter_Control_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_0_Counter_Control_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_1_REG (0x000044F4)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_1_Counter_Pointer_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_1_Counter_Pointer_WID ( 7)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_1_Counter_Pointer_MSK (0x0000007F)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_1_Counter_Pointer_MAX (0x0000007F)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_1_Counter_Pointer_DEF (0x0000007F)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_1_Counter_Control_OFF ( 7)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_1_Counter_Control_WID ( 2)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_1_Counter_Control_MSK (0x00000180)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_1_Counter_Control_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_1_Counter_Control_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_2_REG (0x000044F8)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_2_Counter_Pointer_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_2_Counter_Pointer_WID ( 7)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_2_Counter_Pointer_MSK (0x0000007F)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_2_Counter_Pointer_MAX (0x0000007F)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_2_Counter_Pointer_DEF (0x0000007F)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_2_Counter_Control_OFF ( 7)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_2_Counter_Control_WID ( 2)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_2_Counter_Control_MSK (0x00000180)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_2_Counter_Control_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_2_Counter_Control_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_3_REG (0x000044FC)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_3_Counter_Pointer_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_3_Counter_Pointer_WID ( 7)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_3_Counter_Pointer_MSK (0x0000007F)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_3_Counter_Pointer_MAX (0x0000007F)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_3_Counter_Pointer_DEF (0x0000007F)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_3_Counter_Control_OFF ( 7)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_3_Counter_Control_WID ( 2)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_3_Counter_Control_MSK (0x00000180)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_3_Counter_Control_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_3_Counter_Control_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_4_REG (0x00004500)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_4_Counter_Pointer_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_4_Counter_Pointer_WID ( 7)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_4_Counter_Pointer_MSK (0x0000007F)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_4_Counter_Pointer_MAX (0x0000007F)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_4_Counter_Pointer_DEF (0x0000007F)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_4_Counter_Control_OFF ( 7)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_4_Counter_Control_WID ( 2)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_4_Counter_Control_MSK (0x00000180)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_4_Counter_Control_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_4_Counter_Control_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_5_REG (0x00004504)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_5_Counter_Pointer_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_5_Counter_Pointer_WID ( 7)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_5_Counter_Pointer_MSK (0x0000007F)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_5_Counter_Pointer_MAX (0x0000007F)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_5_Counter_Pointer_DEF (0x0000007F)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_5_Counter_Control_OFF ( 7)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_5_Counter_Control_WID ( 2)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_5_Counter_Control_MSK (0x00000180)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_5_Counter_Control_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_5_Counter_Control_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_6_REG (0x00004508)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_6_Counter_Pointer_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_6_Counter_Pointer_WID ( 7)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_6_Counter_Pointer_MSK (0x0000007F)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_6_Counter_Pointer_MAX (0x0000007F)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_6_Counter_Pointer_DEF (0x0000007F)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_6_Counter_Control_OFF ( 7)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_6_Counter_Control_WID ( 2)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_6_Counter_Control_MSK (0x00000180)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_6_Counter_Control_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_6_Counter_Control_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_7_REG (0x0000450C)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_7_Counter_Pointer_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_7_Counter_Pointer_WID ( 7)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_7_Counter_Pointer_MSK (0x0000007F)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_7_Counter_Pointer_MAX (0x0000007F)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_7_Counter_Pointer_DEF (0x0000007F)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_7_Counter_Control_OFF ( 7)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_7_Counter_Control_WID ( 2)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_7_Counter_Control_MSK (0x00000180)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_7_Counter_Control_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_7_Counter_Control_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_8_REG (0x00004510)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_8_Counter_Pointer_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_8_Counter_Pointer_WID ( 7)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_8_Counter_Pointer_MSK (0x0000007F)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_8_Counter_Pointer_MAX (0x0000007F)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_8_Counter_Pointer_DEF (0x0000007F)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_8_Counter_Control_OFF ( 7)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_8_Counter_Control_WID ( 2)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_8_Counter_Control_MSK (0x00000180)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_8_Counter_Control_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_8_Counter_Control_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_0_REG (0x00004514)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_0_Counter_Status_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_0_Counter_Status_WID (23)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_0_Counter_Status_MSK (0x007FFFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_0_Counter_Status_MAX (0x007FFFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_0_Counter_Status_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_1_REG (0x00004518)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_1_Counter_Status_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_1_Counter_Status_WID (23)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_1_Counter_Status_MSK (0x007FFFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_1_Counter_Status_MAX (0x007FFFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_1_Counter_Status_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_2_REG (0x0000451C)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_2_Counter_Status_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_2_Counter_Status_WID (23)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_2_Counter_Status_MSK (0x007FFFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_2_Counter_Status_MAX (0x007FFFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_2_Counter_Status_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_3_REG (0x00004520)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_3_Counter_Status_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_3_Counter_Status_WID (23)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_3_Counter_Status_MSK (0x007FFFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_3_Counter_Status_MAX (0x007FFFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_3_Counter_Status_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_4_REG (0x00004524)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_4_Counter_Status_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_4_Counter_Status_WID (23)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_4_Counter_Status_MSK (0x007FFFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_4_Counter_Status_MAX (0x007FFFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_4_Counter_Status_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_5_REG (0x00004528)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_5_Counter_Status_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_5_Counter_Status_WID (23)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_5_Counter_Status_MSK (0x007FFFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_5_Counter_Status_MAX (0x007FFFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_5_Counter_Status_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_6_REG (0x0000452C)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_6_Counter_Status_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_6_Counter_Status_WID (23)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_6_Counter_Status_MSK (0x007FFFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_6_Counter_Status_MAX (0x007FFFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_6_Counter_Status_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_7_REG (0x00004530)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_7_Counter_Status_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_7_Counter_Status_WID (23)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_7_Counter_Status_MSK (0x007FFFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_7_Counter_Status_MAX (0x007FFFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_7_Counter_Status_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_8_REG (0x00004534)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_8_Counter_Status_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_8_Counter_Status_WID (23)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_8_Counter_Status_MSK (0x007FFFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_8_Counter_Status_MAX (0x007FFFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_8_Counter_Status_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_OVERFLOW_STATUS_REG (0x00004538)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_OVERFLOW_STATUS_Counter_Overflow_Status_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_OVERFLOW_STATUS_Counter_Overflow_Status_WID ( 9)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_OVERFLOW_STATUS_Counter_Overflow_Status_MSK (0x000001FF)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_OVERFLOW_STATUS_Counter_Overflow_Status_MAX (0x000001FF)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_OVERFLOW_STATUS_Counter_Overflow_Status_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_ERROR_ADDR_REG (0x00004580)
+ #define MCHBAR_CH1_CR_REUT_CH_ERROR_ADDR_Column_Address_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_ERROR_ADDR_Column_Address_WID (10)
+ #define MCHBAR_CH1_CR_REUT_CH_ERROR_ADDR_Column_Address_MSK (0x000003FF)
+ #define MCHBAR_CH1_CR_REUT_CH_ERROR_ADDR_Column_Address_MAX (0x000003FF)
+ #define MCHBAR_CH1_CR_REUT_CH_ERROR_ADDR_Column_Address_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_ERROR_ADDR_Row_Address_OFF (24)
+ #define MCHBAR_CH1_CR_REUT_CH_ERROR_ADDR_Row_Address_WID (16)
+ #define MCHBAR_CH1_CR_REUT_CH_ERROR_ADDR_Row_Address_MSK (0xFFFF000000)
+ #define MCHBAR_CH1_CR_REUT_CH_ERROR_ADDR_Row_Address_MAX (0x0000FFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_ERROR_ADDR_Row_Address_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_ERROR_ADDR_Bank_Address_OFF (48)
+ #define MCHBAR_CH1_CR_REUT_CH_ERROR_ADDR_Bank_Address_WID ( 3)
+ #define MCHBAR_CH1_CR_REUT_CH_ERROR_ADDR_Bank_Address_MSK (0x7000000000000)
+ #define MCHBAR_CH1_CR_REUT_CH_ERROR_ADDR_Bank_Address_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_REUT_CH_ERROR_ADDR_Bank_Address_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_ERROR_ADDR_Rank_Address_OFF (56)
+ #define MCHBAR_CH1_CR_REUT_CH_ERROR_ADDR_Rank_Address_WID ( 2)
+ #define MCHBAR_CH1_CR_REUT_CH_ERROR_ADDR_Rank_Address_MSK (0x300000000000000)
+ #define MCHBAR_CH1_CR_REUT_CH_ERROR_ADDR_Rank_Address_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_REUT_CH_ERROR_ADDR_Rank_Address_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_ERR_WDB_CAPTURE_STATUS_REG (0x00004588)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_WDB_CAPTURE_STATUS_WDB_Current_Error_Pointer_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_WDB_CAPTURE_STATUS_WDB_Current_Error_Pointer_WID ( 6)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_WDB_CAPTURE_STATUS_WDB_Current_Error_Pointer_MSK (0x0000003F)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_WDB_CAPTURE_STATUS_WDB_Current_Error_Pointer_MAX (0x0000003F)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_WDB_CAPTURE_STATUS_WDB_Current_Error_Pointer_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_REG (0x0000458C)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_Enable_WDB_Error_Capture_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_Enable_WDB_Error_Capture_WID ( 1)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_Enable_WDB_Error_Capture_MSK (0x00000001)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_Enable_WDB_Error_Capture_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_Enable_WDB_Error_Capture_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_WDB_Starting_Error_Pointer_OFF ( 8)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_WDB_Starting_Error_Pointer_WID ( 6)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_WDB_Starting_Error_Pointer_MSK (0x00003F00)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_WDB_Starting_Error_Pointer_MAX (0x0000003F)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_WDB_Starting_Error_Pointer_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_WDB_Ending_Error_Pointer_OFF (16)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_WDB_Ending_Error_Pointer_WID ( 6)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_WDB_Ending_Error_Pointer_MSK (0x003F0000)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_WDB_Ending_Error_Pointer_MAX (0x0000003F)
+ #define MCHBAR_CH1_CR_REUT_CH_ERR_WDB_CAPTURE_CTL_WDB_Ending_Error_Pointer_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_MISC_CKE_CTRL_REG (0x00004590)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_CKE_CTRL_CKE_Override_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_CKE_CTRL_CKE_Override_WID ( 4)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_CKE_CTRL_CKE_Override_MSK (0x0000000F)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_CKE_CTRL_CKE_Override_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_CKE_CTRL_CKE_Override_DEF (0x0000000F)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_CKE_CTRL_CKE_En_Start_Test_Sync_OFF ( 8)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_CKE_CTRL_CKE_En_Start_Test_Sync_WID ( 1)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_CKE_CTRL_CKE_En_Start_Test_Sync_MSK (0x00000100)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_CKE_CTRL_CKE_En_Start_Test_Sync_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_CKE_CTRL_CKE_En_Start_Test_Sync_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_CKE_CTRL_CKE_On_OFF (16)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_CKE_CTRL_CKE_On_WID ( 4)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_CKE_CTRL_CKE_On_MSK (0x000F0000)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_CKE_CTRL_CKE_On_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_CKE_CTRL_CKE_On_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_MISC_ODT_CTRL_REG (0x00004594)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_ODT_CTRL_ODT_Override_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_ODT_CTRL_ODT_Override_WID ( 4)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_ODT_CTRL_ODT_Override_MSK (0x0000000F)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_ODT_CTRL_ODT_Override_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_ODT_CTRL_ODT_Override_DEF (0x0000000F)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_ODT_CTRL_ODT_On_OFF (16)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_ODT_CTRL_ODT_On_WID ( 4)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_ODT_CTRL_ODT_On_MSK (0x000F0000)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_ODT_CTRL_ODT_On_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_ODT_CTRL_ODT_On_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_ODT_CTRL_MPR_Train_DDR_On_OFF (31)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_ODT_CTRL_MPR_Train_DDR_On_WID ( 1)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_ODT_CTRL_MPR_Train_DDR_On_MSK (0x80000000)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_ODT_CTRL_MPR_Train_DDR_On_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_ODT_CTRL_MPR_Train_DDR_On_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_REG (0x00004598)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_Enable_CADB_on_Deselect_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_Enable_CADB_on_Deselect_WID ( 1)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_Enable_CADB_on_Deselect_MSK (0x00000001)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_Enable_CADB_on_Deselect_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_Enable_CADB_on_Deselect_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_Enable_CADB_Always_On_OFF ( 1)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_Enable_CADB_Always_On_WID ( 1)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_Enable_CADB_Always_On_MSK (0x00000002)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_Enable_CADB_Always_On_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_Enable_CADB_Always_On_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_CMD_Deselect_Start_OFF ( 2)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_CMD_Deselect_Start_WID ( 4)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_CMD_Deselect_Start_MSK (0x0000003C)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_CMD_Deselect_Start_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_CMD_Deselect_Start_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_CMD_Deselect_Stop_OFF ( 6)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_CMD_Deselect_Stop_WID ( 4)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_CMD_Deselect_Stop_MSK (0x000003C0)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_CMD_Deselect_Stop_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_CMD_Deselect_Stop_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_Lane_Deselect_Enable_OFF ( 10)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_Lane_Deselect_Enable_WID ( 4)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_Lane_Deselect_Enable_MSK (0x00003C00)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_Lane_Deselect_Enable_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_Lane_Deselect_Enable_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_CAS_Select_Enable_OFF ( 14)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_CAS_Select_Enable_WID ( 2)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_CAS_Select_Enable_MSK (0x0000C000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_CAS_Select_Enable_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_CAS_Select_Enable_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_ACT_Select_Enable_OFF ( 16)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_ACT_Select_Enable_WID ( 2)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_ACT_Select_Enable_MSK (0x00030000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_ACT_Select_Enable_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_ACT_Select_Enable_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_PRE_Select_Enable_OFF ( 18)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_PRE_Select_Enable_WID ( 2)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_PRE_Select_Enable_MSK (0x000C0000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_PRE_Select_Enable_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_PRE_Select_Enable_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_Save_Current_Seed_OFF ( 20)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_Save_Current_Seed_WID ( 4)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_Save_Current_Seed_MSK (0x00F00000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_Save_Current_Seed_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_Save_Current_Seed_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_Reload_Starting_Seed_OFF ( 24)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_Reload_Starting_Seed_WID ( 4)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_Reload_Starting_Seed_MSK (0x0F000000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_Reload_Starting_Seed_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_Reload_Starting_Seed_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MRS_REG (0x0000459C)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MRS_MRS_Gap_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MRS_MRS_Gap_WID ( 3)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MRS_MRS_Gap_MSK (0x00000007)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MRS_MRS_Gap_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MRS_MRS_Gap_DEF (0x00000002)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_Start_Pointer_OFF ( 8)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_Start_Pointer_WID ( 3)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_Start_Pointer_MSK (0x00000700)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_Start_Pointer_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_Start_Pointer_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_End_Pointer_OFF (16)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_End_Pointer_WID ( 3)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_End_Pointer_MSK (0x00070000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_End_Pointer_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_End_Pointer_DEF (0x00000007)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_Current_Pointer_OFF (24)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_Current_Pointer_WID ( 3)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_Current_Pointer_MSK (0x07000000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_Current_Pointer_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MRS_CADB_MRS_Current_Pointer_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_CTRL_REG (0x000045A0)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux0_Control_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux0_Control_WID ( 2)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux0_Control_MSK (0x00000003)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux0_Control_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux0_Control_DEF (0x00000001)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux1_Control_OFF ( 4)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux1_Control_WID ( 2)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux1_Control_MSK (0x00000030)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux1_Control_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux1_Control_DEF (0x00000001)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux2_Control_OFF ( 8)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux2_Control_WID ( 2)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux2_Control_MSK (0x00000300)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux2_Control_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_CTRL_Mux2_Control_DEF (0x00000001)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux0_Control_OFF ( 16)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux0_Control_WID ( 2)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux0_Control_MSK (0x00030000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux0_Control_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux0_Control_DEF (0x00000001)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux1_Control_OFF ( 20)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux1_Control_WID ( 2)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux1_Control_MSK (0x00300000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux1_Control_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux1_Control_DEF (0x00000001)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux2_Control_OFF ( 24)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux2_Control_WID ( 2)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux2_Control_MSK (0x03000000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux2_Control_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_CTRL_Select_Mux2_Control_DEF (0x00000001)
+
+#define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_PB_0_REG (0x000045A4)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_PB_0_Pattern_Buffer_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_PB_0_Pattern_Buffer_WID (16)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_PB_0_Pattern_Buffer_MSK (0x0000FFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_PB_0_Pattern_Buffer_MAX (0x0000FFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_PB_0_Pattern_Buffer_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_PB_1_REG (0x000045A8)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_PB_1_Pattern_Buffer_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_PB_1_Pattern_Buffer_WID (16)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_PB_1_Pattern_Buffer_MSK (0x0000FFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_PB_1_Pattern_Buffer_MAX (0x0000FFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_PB_1_Pattern_Buffer_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_PB_2_REG (0x000045AC)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_PB_2_Pattern_Buffer_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_PB_2_Pattern_Buffer_WID (16)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_PB_2_Pattern_Buffer_MSK (0x0000FFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_PB_2_Pattern_Buffer_MAX (0x0000FFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_PB_2_Pattern_Buffer_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_REG (0x000045B0)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_L_data_select_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_L_data_select_WID ( 1)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_L_data_select_MSK (0x00000001)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_L_data_select_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_L_data_select_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_Enable_Sweep_Frequency_OFF ( 1)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_Enable_Sweep_Frequency_WID ( 1)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_Enable_Sweep_Frequency_MSK (0x00000002)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_Enable_Sweep_Frequency_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_Enable_Sweep_Frequency_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_L_counter_OFF ( 8)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_L_counter_WID ( 8)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_L_counter_MSK (0x0000FF00)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_L_counter_MAX (0x000000FF)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_L_counter_DEF (0x00000001)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_M_counter_OFF (16)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_M_counter_WID ( 8)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_M_counter_MSK (0x00FF0000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_M_counter_MAX (0x000000FF)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_M_counter_DEF (0x00000001)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_N_counter_OFF (24)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_N_counter_WID ( 8)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_N_counter_MSK (0xFF000000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_N_counter_MAX (0x000000FF)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_N_counter_DEF (0x00000001)
+
+#define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_WRITE_POINTER_REG (0x000045BC)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_WRITE_POINTER_CADB_Write_Pointer_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_WRITE_POINTER_CADB_Write_Pointer_WID ( 3)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_WRITE_POINTER_CADB_Write_Pointer_MSK (0x00000007)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_WRITE_POINTER_CADB_Write_Pointer_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_WRITE_POINTER_CADB_Write_Pointer_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_PROG_REG (0x000045C0)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Address_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Address_WID (16)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Address_MSK (0x0000FFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Address_MAX (0x0000FFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Address_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Bank_OFF (24)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Bank_WID ( 3)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Bank_MSK (0x07000000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Bank_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Bank_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_CS_OFF (32)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_CS_WID ( 4)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_CS_MSK (0xF00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_CS_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_CS_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Control_OFF (40)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Control_WID ( 3)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Control_MSK (0x70000000000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Control_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_Control_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_ODT_OFF (48)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_ODT_WID ( 4)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_ODT_MSK (0xF000000000000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_ODT_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_ODT_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_CKE_OFF (56)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_CKE_WID ( 4)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_CKE_MSK (0xF00000000000000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_CKE_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_PROG_CADB_Data_CKE_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_0_REG (0x000045C8)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_0_Pattern_Buffer_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_0_Pattern_Buffer_WID (16)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_0_Pattern_Buffer_MSK (0x0000FFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_0_Pattern_Buffer_MAX (0x0000FFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_0_Pattern_Buffer_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_1_REG (0x000045CC)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_1_Pattern_Buffer_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_1_Pattern_Buffer_WID (16)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_1_Pattern_Buffer_MSK (0x0000FFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_1_Pattern_Buffer_MAX (0x0000FFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_1_Pattern_Buffer_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_2_REG (0x000045D0)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_2_Pattern_Buffer_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_2_Pattern_Buffer_WID (16)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_2_Pattern_Buffer_MSK (0x0000FFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_2_Pattern_Buffer_MAX (0x0000FFFF)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_CADB_SEL_MUX_PB_2_Pattern_Buffer_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_CTRL_REG (0x00004600)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Increment_Rate_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Increment_Rate_WID ( 5)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Increment_Rate_MSK (0x0000001F)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Increment_Rate_MAX (0x0000001F)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Increment_Rate_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Increment_Scale_OFF ( 5)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Increment_Scale_WID ( 1)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Increment_Scale_MSK (0x00000020)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Increment_Scale_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Increment_Scale_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Start_Pointer_OFF ( 8)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Start_Pointer_WID ( 6)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Start_Pointer_MSK (0x00003F00)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Start_Pointer_MAX (0x0000003F)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Start_Pointer_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_End_Pointer_OFF (16)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_End_Pointer_WID ( 6)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_End_Pointer_MSK (0x003F0000)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_End_Pointer_MAX (0x0000003F)
+ #define MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_End_Pointer_DEF (0x0000003F)
+
+#define MCHBAR_CH1_CR_REUT_CH_MISC_REFRESH_CTRL_REG (0x00004604)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_REFRESH_CTRL_Refresh_Rank_Mask_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_REFRESH_CTRL_Refresh_Rank_Mask_WID ( 4)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_REFRESH_CTRL_Refresh_Rank_Mask_MSK (0x0000000F)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_REFRESH_CTRL_Refresh_Rank_Mask_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_REFRESH_CTRL_Refresh_Rank_Mask_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_REFRESH_CTRL_RefZQ_En_Start_Test_Sync_OFF ( 8)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_REFRESH_CTRL_RefZQ_En_Start_Test_Sync_WID ( 1)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_REFRESH_CTRL_RefZQ_En_Start_Test_Sync_MSK (0x00000100)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_REFRESH_CTRL_RefZQ_En_Start_Test_Sync_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_REFRESH_CTRL_RefZQ_En_Start_Test_Sync_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_REFRESH_CTRL_Panic_Refresh_Only_OFF (31)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_REFRESH_CTRL_Panic_Refresh_Only_WID ( 1)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_REFRESH_CTRL_Panic_Refresh_Only_MSK (0x80000000)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_REFRESH_CTRL_Panic_Refresh_Only_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_REFRESH_CTRL_Panic_Refresh_Only_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_REUT_CH_MISC_ZQ_CTRL_REG (0x00004608)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_ZQ_CTRL_ZQ_Rank_Mask_OFF ( 0)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_ZQ_CTRL_ZQ_Rank_Mask_WID ( 4)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_ZQ_CTRL_ZQ_Rank_Mask_MSK (0x0000000F)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_ZQ_CTRL_ZQ_Rank_Mask_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_ZQ_CTRL_ZQ_Rank_Mask_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_ZQ_CTRL_Always_Do_ZQ_OFF (31)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_ZQ_CTRL_Always_Do_ZQ_WID ( 1)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_ZQ_CTRL_Always_Do_ZQ_MSK (0x80000000)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_ZQ_CTRL_Always_Do_ZQ_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_REUT_CH_MISC_ZQ_CTRL_Always_Do_ZQ_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_LPDDR_MR_PARAMS_REG (0x00004610)
+ #define MCHBAR_CH1_CR_LPDDR_MR_PARAMS_Rank_0_x32_OFF ( 0)
+ #define MCHBAR_CH1_CR_LPDDR_MR_PARAMS_Rank_0_x32_WID ( 1)
+ #define MCHBAR_CH1_CR_LPDDR_MR_PARAMS_Rank_0_x32_MSK (0x00000001)
+ #define MCHBAR_CH1_CR_LPDDR_MR_PARAMS_Rank_0_x32_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_LPDDR_MR_PARAMS_Rank_0_x32_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_LPDDR_MR_PARAMS_Rank_1_x32_OFF ( 1)
+ #define MCHBAR_CH1_CR_LPDDR_MR_PARAMS_Rank_1_x32_WID ( 1)
+ #define MCHBAR_CH1_CR_LPDDR_MR_PARAMS_Rank_1_x32_MSK (0x00000002)
+ #define MCHBAR_CH1_CR_LPDDR_MR_PARAMS_Rank_1_x32_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_LPDDR_MR_PARAMS_Rank_1_x32_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_LPDDR_MR_PARAMS_Rank_2_x32_OFF ( 2)
+ #define MCHBAR_CH1_CR_LPDDR_MR_PARAMS_Rank_2_x32_WID ( 1)
+ #define MCHBAR_CH1_CR_LPDDR_MR_PARAMS_Rank_2_x32_MSK (0x00000004)
+ #define MCHBAR_CH1_CR_LPDDR_MR_PARAMS_Rank_2_x32_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_LPDDR_MR_PARAMS_Rank_2_x32_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_LPDDR_MR_PARAMS_Rank_3_x32_OFF ( 3)
+ #define MCHBAR_CH1_CR_LPDDR_MR_PARAMS_Rank_3_x32_WID ( 1)
+ #define MCHBAR_CH1_CR_LPDDR_MR_PARAMS_Rank_3_x32_MSK (0x00000008)
+ #define MCHBAR_CH1_CR_LPDDR_MR_PARAMS_Rank_3_x32_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_LPDDR_MR_PARAMS_Rank_3_x32_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_LPDDR_MR_PARAMS_LPDDR2_OFF ( 4)
+ #define MCHBAR_CH1_CR_LPDDR_MR_PARAMS_LPDDR2_WID ( 1)
+ #define MCHBAR_CH1_CR_LPDDR_MR_PARAMS_LPDDR2_MSK (0x00000010)
+ #define MCHBAR_CH1_CR_LPDDR_MR_PARAMS_LPDDR2_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_LPDDR_MR_PARAMS_LPDDR2_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_LPDDR_MR_PARAMS_MR4_PERIOD_OFF ( 8)
+ #define MCHBAR_CH1_CR_LPDDR_MR_PARAMS_MR4_PERIOD_WID (16)
+ #define MCHBAR_CH1_CR_LPDDR_MR_PARAMS_MR4_PERIOD_MSK (0x00FFFF00)
+ #define MCHBAR_CH1_CR_LPDDR_MR_PARAMS_MR4_PERIOD_MAX (0x0000FFFF)
+ #define MCHBAR_CH1_CR_LPDDR_MR_PARAMS_MR4_PERIOD_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_LPDDR_MR_COMMAND_REG (0x00004614)
+ #define MCHBAR_CH1_CR_LPDDR_MR_COMMAND_Address_OFF ( 0)
+ #define MCHBAR_CH1_CR_LPDDR_MR_COMMAND_Address_WID ( 8)
+ #define MCHBAR_CH1_CR_LPDDR_MR_COMMAND_Address_MSK (0x000000FF)
+ #define MCHBAR_CH1_CR_LPDDR_MR_COMMAND_Address_MAX (0x000000FF)
+ #define MCHBAR_CH1_CR_LPDDR_MR_COMMAND_Address_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_LPDDR_MR_COMMAND_Data_OFF ( 8)
+ #define MCHBAR_CH1_CR_LPDDR_MR_COMMAND_Data_WID ( 8)
+ #define MCHBAR_CH1_CR_LPDDR_MR_COMMAND_Data_MSK (0x0000FF00)
+ #define MCHBAR_CH1_CR_LPDDR_MR_COMMAND_Data_MAX (0x000000FF)
+ #define MCHBAR_CH1_CR_LPDDR_MR_COMMAND_Data_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_LPDDR_MR_COMMAND_Rank_OFF (16)
+ #define MCHBAR_CH1_CR_LPDDR_MR_COMMAND_Rank_WID ( 2)
+ #define MCHBAR_CH1_CR_LPDDR_MR_COMMAND_Rank_MSK (0x00030000)
+ #define MCHBAR_CH1_CR_LPDDR_MR_COMMAND_Rank_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_LPDDR_MR_COMMAND_Rank_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_LPDDR_MR_COMMAND_Write_OFF (18)
+ #define MCHBAR_CH1_CR_LPDDR_MR_COMMAND_Write_WID ( 1)
+ #define MCHBAR_CH1_CR_LPDDR_MR_COMMAND_Write_MSK (0x00040000)
+ #define MCHBAR_CH1_CR_LPDDR_MR_COMMAND_Write_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_LPDDR_MR_COMMAND_Write_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_LPDDR_MR_COMMAND_Init_MRW_OFF (19)
+ #define MCHBAR_CH1_CR_LPDDR_MR_COMMAND_Init_MRW_WID ( 1)
+ #define MCHBAR_CH1_CR_LPDDR_MR_COMMAND_Init_MRW_MSK (0x00080000)
+ #define MCHBAR_CH1_CR_LPDDR_MR_COMMAND_Init_MRW_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_LPDDR_MR_COMMAND_Init_MRW_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_LPDDR_MR_COMMAND_Busy_OFF (31)
+ #define MCHBAR_CH1_CR_LPDDR_MR_COMMAND_Busy_WID ( 1)
+ #define MCHBAR_CH1_CR_LPDDR_MR_COMMAND_Busy_MSK (0x80000000)
+ #define MCHBAR_CH1_CR_LPDDR_MR_COMMAND_Busy_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_LPDDR_MR_COMMAND_Busy_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_LPDDR_MR_RESULT_REG (0x00004618)
+ #define MCHBAR_CH1_CR_LPDDR_MR_RESULT_Device_0_OFF ( 0)
+ #define MCHBAR_CH1_CR_LPDDR_MR_RESULT_Device_0_WID ( 8)
+ #define MCHBAR_CH1_CR_LPDDR_MR_RESULT_Device_0_MSK (0x000000FF)
+ #define MCHBAR_CH1_CR_LPDDR_MR_RESULT_Device_0_MAX (0x000000FF)
+ #define MCHBAR_CH1_CR_LPDDR_MR_RESULT_Device_0_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_LPDDR_MR_RESULT_Device_1_OFF ( 8)
+ #define MCHBAR_CH1_CR_LPDDR_MR_RESULT_Device_1_WID ( 8)
+ #define MCHBAR_CH1_CR_LPDDR_MR_RESULT_Device_1_MSK (0x0000FF00)
+ #define MCHBAR_CH1_CR_LPDDR_MR_RESULT_Device_1_MAX (0x000000FF)
+ #define MCHBAR_CH1_CR_LPDDR_MR_RESULT_Device_1_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_LPDDR_MR_RESULT_Device_2_OFF (16)
+ #define MCHBAR_CH1_CR_LPDDR_MR_RESULT_Device_2_WID ( 8)
+ #define MCHBAR_CH1_CR_LPDDR_MR_RESULT_Device_2_MSK (0x00FF0000)
+ #define MCHBAR_CH1_CR_LPDDR_MR_RESULT_Device_2_MAX (0x000000FF)
+ #define MCHBAR_CH1_CR_LPDDR_MR_RESULT_Device_2_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_LPDDR_MR_RESULT_Device_3_OFF (24)
+ #define MCHBAR_CH1_CR_LPDDR_MR_RESULT_Device_3_WID ( 8)
+ #define MCHBAR_CH1_CR_LPDDR_MR_RESULT_Device_3_MSK (0xFF000000)
+ #define MCHBAR_CH1_CR_LPDDR_MR_RESULT_Device_3_MAX (0x000000FF)
+ #define MCHBAR_CH1_CR_LPDDR_MR_RESULT_Device_3_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_LPDDR_MR4_RANK_TEMPERATURE_REG (0x0000461C)
+ #define MCHBAR_CH1_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_0_OFF ( 0)
+ #define MCHBAR_CH1_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_0_WID ( 3)
+ #define MCHBAR_CH1_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_0_MSK (0x00000007)
+ #define MCHBAR_CH1_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_0_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_0_DEF (0x00000003)
+ #define MCHBAR_CH1_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_1_OFF ( 8)
+ #define MCHBAR_CH1_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_1_WID ( 3)
+ #define MCHBAR_CH1_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_1_MSK (0x00000700)
+ #define MCHBAR_CH1_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_1_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_1_DEF (0x00000003)
+ #define MCHBAR_CH1_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_2_OFF (16)
+ #define MCHBAR_CH1_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_2_WID ( 3)
+ #define MCHBAR_CH1_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_2_MSK (0x00070000)
+ #define MCHBAR_CH1_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_2_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_2_DEF (0x00000003)
+ #define MCHBAR_CH1_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_3_OFF (24)
+ #define MCHBAR_CH1_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_3_WID ( 3)
+ #define MCHBAR_CH1_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_3_MSK (0x07000000)
+ #define MCHBAR_CH1_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_3_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_LPDDR_MR4_RANK_TEMPERATURE_Rank_3_DEF (0x00000003)
+
+#define MCHBAR_CH1_CR_DESWIZZLE_LOW_REG (0x00004620)
+ #define MCHBAR_CH1_CR_DESWIZZLE_LOW_Bit_0_OFF ( 0)
+ #define MCHBAR_CH1_CR_DESWIZZLE_LOW_Bit_0_WID ( 3)
+ #define MCHBAR_CH1_CR_DESWIZZLE_LOW_Bit_0_MSK (0x00000007)
+ #define MCHBAR_CH1_CR_DESWIZZLE_LOW_Bit_0_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_DESWIZZLE_LOW_Bit_0_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_DESWIZZLE_LOW_Bit_1_OFF ( 4)
+ #define MCHBAR_CH1_CR_DESWIZZLE_LOW_Bit_1_WID ( 3)
+ #define MCHBAR_CH1_CR_DESWIZZLE_LOW_Bit_1_MSK (0x00000070)
+ #define MCHBAR_CH1_CR_DESWIZZLE_LOW_Bit_1_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_DESWIZZLE_LOW_Bit_1_DEF (0x00000001)
+ #define MCHBAR_CH1_CR_DESWIZZLE_LOW_Bit_2_OFF ( 8)
+ #define MCHBAR_CH1_CR_DESWIZZLE_LOW_Bit_2_WID ( 3)
+ #define MCHBAR_CH1_CR_DESWIZZLE_LOW_Bit_2_MSK (0x00000700)
+ #define MCHBAR_CH1_CR_DESWIZZLE_LOW_Bit_2_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_DESWIZZLE_LOW_Bit_2_DEF (0x00000002)
+ #define MCHBAR_CH1_CR_DESWIZZLE_LOW_Bit_16_OFF (12)
+ #define MCHBAR_CH1_CR_DESWIZZLE_LOW_Bit_16_WID ( 3)
+ #define MCHBAR_CH1_CR_DESWIZZLE_LOW_Bit_16_MSK (0x00007000)
+ #define MCHBAR_CH1_CR_DESWIZZLE_LOW_Bit_16_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_DESWIZZLE_LOW_Bit_16_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_DESWIZZLE_LOW_Bit_17_OFF (16)
+ #define MCHBAR_CH1_CR_DESWIZZLE_LOW_Bit_17_WID ( 3)
+ #define MCHBAR_CH1_CR_DESWIZZLE_LOW_Bit_17_MSK (0x00070000)
+ #define MCHBAR_CH1_CR_DESWIZZLE_LOW_Bit_17_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_DESWIZZLE_LOW_Bit_17_DEF (0x00000001)
+ #define MCHBAR_CH1_CR_DESWIZZLE_LOW_Bit_18_OFF (20)
+ #define MCHBAR_CH1_CR_DESWIZZLE_LOW_Bit_18_WID ( 3)
+ #define MCHBAR_CH1_CR_DESWIZZLE_LOW_Bit_18_MSK (0x00700000)
+ #define MCHBAR_CH1_CR_DESWIZZLE_LOW_Bit_18_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_DESWIZZLE_LOW_Bit_18_DEF (0x00000002)
+ #define MCHBAR_CH1_CR_DESWIZZLE_LOW_Byte_0_OFF (24)
+ #define MCHBAR_CH1_CR_DESWIZZLE_LOW_Byte_0_WID ( 3)
+ #define MCHBAR_CH1_CR_DESWIZZLE_LOW_Byte_0_MSK (0x07000000)
+ #define MCHBAR_CH1_CR_DESWIZZLE_LOW_Byte_0_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_DESWIZZLE_LOW_Byte_0_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_DESWIZZLE_LOW_Byte_2_OFF (28)
+ #define MCHBAR_CH1_CR_DESWIZZLE_LOW_Byte_2_WID ( 3)
+ #define MCHBAR_CH1_CR_DESWIZZLE_LOW_Byte_2_MSK (0x70000000)
+ #define MCHBAR_CH1_CR_DESWIZZLE_LOW_Byte_2_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_DESWIZZLE_LOW_Byte_2_DEF (0x00000002)
+
+#define MCHBAR_CH1_CR_DESWIZZLE_HIGH_REG (0x00004624)
+ #define MCHBAR_CH1_CR_DESWIZZLE_HIGH_Bit_32_OFF ( 0)
+ #define MCHBAR_CH1_CR_DESWIZZLE_HIGH_Bit_32_WID ( 3)
+ #define MCHBAR_CH1_CR_DESWIZZLE_HIGH_Bit_32_MSK (0x00000007)
+ #define MCHBAR_CH1_CR_DESWIZZLE_HIGH_Bit_32_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_DESWIZZLE_HIGH_Bit_32_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_DESWIZZLE_HIGH_Bit_33_OFF ( 4)
+ #define MCHBAR_CH1_CR_DESWIZZLE_HIGH_Bit_33_WID ( 3)
+ #define MCHBAR_CH1_CR_DESWIZZLE_HIGH_Bit_33_MSK (0x00000070)
+ #define MCHBAR_CH1_CR_DESWIZZLE_HIGH_Bit_33_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_DESWIZZLE_HIGH_Bit_33_DEF (0x00000001)
+ #define MCHBAR_CH1_CR_DESWIZZLE_HIGH_Bit_34_OFF ( 8)
+ #define MCHBAR_CH1_CR_DESWIZZLE_HIGH_Bit_34_WID ( 3)
+ #define MCHBAR_CH1_CR_DESWIZZLE_HIGH_Bit_34_MSK (0x00000700)
+ #define MCHBAR_CH1_CR_DESWIZZLE_HIGH_Bit_34_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_DESWIZZLE_HIGH_Bit_34_DEF (0x00000002)
+ #define MCHBAR_CH1_CR_DESWIZZLE_HIGH_Bit_48_OFF (12)
+ #define MCHBAR_CH1_CR_DESWIZZLE_HIGH_Bit_48_WID ( 3)
+ #define MCHBAR_CH1_CR_DESWIZZLE_HIGH_Bit_48_MSK (0x00007000)
+ #define MCHBAR_CH1_CR_DESWIZZLE_HIGH_Bit_48_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_DESWIZZLE_HIGH_Bit_48_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_DESWIZZLE_HIGH_Bit_49_OFF (16)
+ #define MCHBAR_CH1_CR_DESWIZZLE_HIGH_Bit_49_WID ( 3)
+ #define MCHBAR_CH1_CR_DESWIZZLE_HIGH_Bit_49_MSK (0x00070000)
+ #define MCHBAR_CH1_CR_DESWIZZLE_HIGH_Bit_49_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_DESWIZZLE_HIGH_Bit_49_DEF (0x00000001)
+ #define MCHBAR_CH1_CR_DESWIZZLE_HIGH_Bit_50_OFF (20)
+ #define MCHBAR_CH1_CR_DESWIZZLE_HIGH_Bit_50_WID ( 3)
+ #define MCHBAR_CH1_CR_DESWIZZLE_HIGH_Bit_50_MSK (0x00700000)
+ #define MCHBAR_CH1_CR_DESWIZZLE_HIGH_Bit_50_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_DESWIZZLE_HIGH_Bit_50_DEF (0x00000002)
+ #define MCHBAR_CH1_CR_DESWIZZLE_HIGH_Byte_4_OFF (24)
+ #define MCHBAR_CH1_CR_DESWIZZLE_HIGH_Byte_4_WID ( 3)
+ #define MCHBAR_CH1_CR_DESWIZZLE_HIGH_Byte_4_MSK (0x07000000)
+ #define MCHBAR_CH1_CR_DESWIZZLE_HIGH_Byte_4_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_DESWIZZLE_HIGH_Byte_4_DEF (0x00000004)
+ #define MCHBAR_CH1_CR_DESWIZZLE_HIGH_Byte_6_OFF (28)
+ #define MCHBAR_CH1_CR_DESWIZZLE_HIGH_Byte_6_WID ( 3)
+ #define MCHBAR_CH1_CR_DESWIZZLE_HIGH_Byte_6_MSK (0x70000000)
+ #define MCHBAR_CH1_CR_DESWIZZLE_HIGH_Byte_6_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_DESWIZZLE_HIGH_Byte_6_DEF (0x00000006)
+
+#define MCHBAR_CH1_CR_MC_REFRESH_STAGGER_REG (0x0000468C)
+ #define MCHBAR_CH1_CR_MC_REFRESH_STAGGER_Ref_Interval_OFF ( 0)
+ #define MCHBAR_CH1_CR_MC_REFRESH_STAGGER_Ref_Interval_WID (11)
+ #define MCHBAR_CH1_CR_MC_REFRESH_STAGGER_Ref_Interval_MSK (0x000007FF)
+ #define MCHBAR_CH1_CR_MC_REFRESH_STAGGER_Ref_Interval_MAX (0x000007FF)
+ #define MCHBAR_CH1_CR_MC_REFRESH_STAGGER_Ref_Interval_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_MC_REFRESH_STAGGER_Ref_Stagger_En_OFF (11)
+ #define MCHBAR_CH1_CR_MC_REFRESH_STAGGER_Ref_Stagger_En_WID ( 1)
+ #define MCHBAR_CH1_CR_MC_REFRESH_STAGGER_Ref_Stagger_En_MSK (0x00000800)
+ #define MCHBAR_CH1_CR_MC_REFRESH_STAGGER_Ref_Stagger_En_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_MC_REFRESH_STAGGER_Ref_Stagger_En_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_MC_REFRESH_STAGGER_Ref_Stagger_Mode_OFF (12)
+ #define MCHBAR_CH1_CR_MC_REFRESH_STAGGER_Ref_Stagger_Mode_WID ( 1)
+ #define MCHBAR_CH1_CR_MC_REFRESH_STAGGER_Ref_Stagger_Mode_MSK (0x00001000)
+ #define MCHBAR_CH1_CR_MC_REFRESH_STAGGER_Ref_Stagger_Mode_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_MC_REFRESH_STAGGER_Ref_Stagger_Mode_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_MC_REFRESH_STAGGER_Disable_Stolen_Refresh_OFF (13)
+ #define MCHBAR_CH1_CR_MC_REFRESH_STAGGER_Disable_Stolen_Refresh_WID ( 1)
+ #define MCHBAR_CH1_CR_MC_REFRESH_STAGGER_Disable_Stolen_Refresh_MSK (0x00002000)
+ #define MCHBAR_CH1_CR_MC_REFRESH_STAGGER_Disable_Stolen_Refresh_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_MC_REFRESH_STAGGER_Disable_Stolen_Refresh_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_MC_REFRESH_STAGGER_En_Ref_Type_Display_OFF (14)
+ #define MCHBAR_CH1_CR_MC_REFRESH_STAGGER_En_Ref_Type_Display_WID ( 1)
+ #define MCHBAR_CH1_CR_MC_REFRESH_STAGGER_En_Ref_Type_Display_MSK (0x00004000)
+ #define MCHBAR_CH1_CR_MC_REFRESH_STAGGER_En_Ref_Type_Display_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_MC_REFRESH_STAGGER_En_Ref_Type_Display_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_TC_ZQCAL_REG (0x00004690)
+ #define MCHBAR_CH1_CR_TC_ZQCAL_ZQCS_period_OFF ( 0)
+ #define MCHBAR_CH1_CR_TC_ZQCAL_ZQCS_period_WID ( 8)
+ #define MCHBAR_CH1_CR_TC_ZQCAL_ZQCS_period_MSK (0x000000FF)
+ #define MCHBAR_CH1_CR_TC_ZQCAL_ZQCS_period_MAX (0x000000FF)
+ #define MCHBAR_CH1_CR_TC_ZQCAL_ZQCS_period_DEF (0x00000080)
+ #define MCHBAR_CH1_CR_TC_ZQCAL_tZQCS_OFF ( 8)
+ #define MCHBAR_CH1_CR_TC_ZQCAL_tZQCS_WID ( 8)
+ #define MCHBAR_CH1_CR_TC_ZQCAL_tZQCS_MSK (0x0000FF00)
+ #define MCHBAR_CH1_CR_TC_ZQCAL_tZQCS_MAX (0x000000FF)
+ #define MCHBAR_CH1_CR_TC_ZQCAL_tZQCS_DEF (0x00000040)
+ #define MCHBAR_CH1_CR_TC_ZQCAL_ZQCS_period_Ult_OFF ( 0)
+ #define MCHBAR_CH1_CR_TC_ZQCAL_ZQCS_period_Ult_WID (10)
+ #define MCHBAR_CH1_CR_TC_ZQCAL_ZQCS_period_Ult_MSK (0x000003FF)
+ #define MCHBAR_CH1_CR_TC_ZQCAL_ZQCS_period_Ult_MAX (0x000003FF)
+ #define MCHBAR_CH1_CR_TC_ZQCAL_ZQCS_period_Ult_DEF (0x00000080)
+ #define MCHBAR_CH1_CR_TC_ZQCAL_tZQCS_Ult_OFF (10)
+ #define MCHBAR_CH1_CR_TC_ZQCAL_tZQCS_Ult_WID (10)
+ #define MCHBAR_CH1_CR_TC_ZQCAL_tZQCS_Ult_MSK (0x000FFC00)
+ #define MCHBAR_CH1_CR_TC_ZQCAL_tZQCS_Ult_MAX (0x000003FF)
+ #define MCHBAR_CH1_CR_TC_ZQCAL_tZQCS_Ult_DEF (0x00000040)
+
+#define MCHBAR_CH1_CR_TC_RFP_REG (0x00004694)
+ #define MCHBAR_CH1_CR_TC_RFP_OREF_RI_OFF ( 0)
+ #define MCHBAR_CH1_CR_TC_RFP_OREF_RI_WID ( 8)
+ #define MCHBAR_CH1_CR_TC_RFP_OREF_RI_MSK (0x000000FF)
+ #define MCHBAR_CH1_CR_TC_RFP_OREF_RI_MAX (0x000000FF)
+ #define MCHBAR_CH1_CR_TC_RFP_OREF_RI_DEF (0x0000000F)
+ #define MCHBAR_CH1_CR_TC_RFP_Refresh_HP_WM_OFF ( 8)
+ #define MCHBAR_CH1_CR_TC_RFP_Refresh_HP_WM_WID ( 4)
+ #define MCHBAR_CH1_CR_TC_RFP_Refresh_HP_WM_MSK (0x00000F00)
+ #define MCHBAR_CH1_CR_TC_RFP_Refresh_HP_WM_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_TC_RFP_Refresh_HP_WM_DEF (0x00000008)
+ #define MCHBAR_CH1_CR_TC_RFP_Refresh_panic_wm_OFF (12)
+ #define MCHBAR_CH1_CR_TC_RFP_Refresh_panic_wm_WID ( 4)
+ #define MCHBAR_CH1_CR_TC_RFP_Refresh_panic_wm_MSK (0x0000F000)
+ #define MCHBAR_CH1_CR_TC_RFP_Refresh_panic_wm_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_TC_RFP_Refresh_panic_wm_DEF (0x00000009)
+
+#define MCHBAR_CH1_CR_TC_RFTP_REG (0x00004698)
+ #define MCHBAR_CH1_CR_TC_RFTP_tREFI_OFF ( 0)
+ #define MCHBAR_CH1_CR_TC_RFTP_tREFI_WID (16)
+ #define MCHBAR_CH1_CR_TC_RFTP_tREFI_MSK (0x0000FFFF)
+ #define MCHBAR_CH1_CR_TC_RFTP_tREFI_MAX (0x0000FFFF)
+ #define MCHBAR_CH1_CR_TC_RFTP_tREFI_DEF (0x00001004)
+ #define MCHBAR_CH1_CR_TC_RFTP_tRFC_OFF (16)
+ #define MCHBAR_CH1_CR_TC_RFTP_tRFC_WID ( 9)
+ #define MCHBAR_CH1_CR_TC_RFTP_tRFC_MSK (0x01FF0000)
+ #define MCHBAR_CH1_CR_TC_RFTP_tRFC_MAX (0x000001FF)
+ #define MCHBAR_CH1_CR_TC_RFTP_tRFC_DEF (0x000000B4)
+ #define MCHBAR_CH1_CR_TC_RFTP_tREFIx9_OFF (25)
+ #define MCHBAR_CH1_CR_TC_RFTP_tREFIx9_WID ( 7)
+ #define MCHBAR_CH1_CR_TC_RFTP_tREFIx9_MSK (0xFE000000)
+ #define MCHBAR_CH1_CR_TC_RFTP_tREFIx9_MAX (0x0000007F)
+ #define MCHBAR_CH1_CR_TC_RFTP_tREFIx9_DEF (0x00000023)
+
+#define MCHBAR_CH1_CR_TC_MR2_SHADDOW_REG (0x0000469C)
+ #define MCHBAR_CH1_CR_TC_MR2_SHADDOW_MR2_sh_low_OFF ( 0)
+ #define MCHBAR_CH1_CR_TC_MR2_SHADDOW_MR2_sh_low_WID ( 6)
+ #define MCHBAR_CH1_CR_TC_MR2_SHADDOW_MR2_sh_low_MSK (0x0000003F)
+ #define MCHBAR_CH1_CR_TC_MR2_SHADDOW_MR2_sh_low_MAX (0x0000003F)
+ #define MCHBAR_CH1_CR_TC_MR2_SHADDOW_MR2_sh_low_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_TC_MR2_SHADDOW_SRT_avail_OFF ( 6)
+ #define MCHBAR_CH1_CR_TC_MR2_SHADDOW_SRT_avail_WID ( 2)
+ #define MCHBAR_CH1_CR_TC_MR2_SHADDOW_SRT_avail_MSK (0x000000C0)
+ #define MCHBAR_CH1_CR_TC_MR2_SHADDOW_SRT_avail_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_TC_MR2_SHADDOW_SRT_avail_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_TC_MR2_SHADDOW_MR2_sh_high_OFF ( 8)
+ #define MCHBAR_CH1_CR_TC_MR2_SHADDOW_MR2_sh_high_WID ( 3)
+ #define MCHBAR_CH1_CR_TC_MR2_SHADDOW_MR2_sh_high_MSK (0x00000700)
+ #define MCHBAR_CH1_CR_TC_MR2_SHADDOW_MR2_sh_high_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_TC_MR2_SHADDOW_MR2_sh_high_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_TC_MR2_SHADDOW_Addr_bit_swizzle_OFF (14)
+ #define MCHBAR_CH1_CR_TC_MR2_SHADDOW_Addr_bit_swizzle_WID ( 2)
+ #define MCHBAR_CH1_CR_TC_MR2_SHADDOW_Addr_bit_swizzle_MSK (0x0000C000)
+ #define MCHBAR_CH1_CR_TC_MR2_SHADDOW_Addr_bit_swizzle_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_TC_MR2_SHADDOW_Addr_bit_swizzle_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_MC_INIT_STATE_REG (0x000046A0)
+ #define MCHBAR_CH1_CR_MC_INIT_STATE_Rank_occupancy_OFF ( 0)
+ #define MCHBAR_CH1_CR_MC_INIT_STATE_Rank_occupancy_WID ( 4)
+ #define MCHBAR_CH1_CR_MC_INIT_STATE_Rank_occupancy_MSK (0x0000000F)
+ #define MCHBAR_CH1_CR_MC_INIT_STATE_Rank_occupancy_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_MC_INIT_STATE_Rank_occupancy_DEF (0x0000000F)
+
+#define MCHBAR_CH1_CR_TC_SRFTP_REG (0x000046A4)
+ #define MCHBAR_CH1_CR_TC_SRFTP_tXSDLL_OFF ( 0)
+ #define MCHBAR_CH1_CR_TC_SRFTP_tXSDLL_WID (12)
+ #define MCHBAR_CH1_CR_TC_SRFTP_tXSDLL_MSK (0x00000FFF)
+ #define MCHBAR_CH1_CR_TC_SRFTP_tXSDLL_MAX (0x00000FFF)
+ #define MCHBAR_CH1_CR_TC_SRFTP_tXSDLL_DEF (0x00000200)
+ #define MCHBAR_CH1_CR_TC_SRFTP_tXS_offset_OFF (12)
+ #define MCHBAR_CH1_CR_TC_SRFTP_tXS_offset_WID ( 4)
+ #define MCHBAR_CH1_CR_TC_SRFTP_tXS_offset_MSK (0x0000F000)
+ #define MCHBAR_CH1_CR_TC_SRFTP_tXS_offset_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_TC_SRFTP_tXS_offset_DEF (0x0000000B)
+ #define MCHBAR_CH1_CR_TC_SRFTP_tZQOPER_OFF (16)
+ #define MCHBAR_CH1_CR_TC_SRFTP_tZQOPER_WID (10)
+ #define MCHBAR_CH1_CR_TC_SRFTP_tZQOPER_MSK (0x03FF0000)
+ #define MCHBAR_CH1_CR_TC_SRFTP_tZQOPER_MAX (0x000003FF)
+ #define MCHBAR_CH1_CR_TC_SRFTP_tZQOPER_DEF (0x00000100)
+ #define MCHBAR_CH1_CR_TC_SRFTP_tMOD_OFF (28)
+ #define MCHBAR_CH1_CR_TC_SRFTP_tMOD_WID ( 4)
+ #define MCHBAR_CH1_CR_TC_SRFTP_tMOD_MSK (0xF0000000)
+ #define MCHBAR_CH1_CR_TC_SRFTP_tMOD_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_TC_SRFTP_tMOD_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_WDB_VISA_SEL_REG (0x000046A8)
+ #define MCHBAR_CH1_CR_WDB_VISA_SEL_VISAByteSel_OFF ( 0)
+ #define MCHBAR_CH1_CR_WDB_VISA_SEL_VISAByteSel_WID ( 3)
+ #define MCHBAR_CH1_CR_WDB_VISA_SEL_VISAByteSel_MSK (0x00000007)
+ #define MCHBAR_CH1_CR_WDB_VISA_SEL_VISAByteSel_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_WDB_VISA_SEL_VISAByteSel_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_DCLK_LDAT_PDAT_REG (0x000046C0)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_PDAT_FASTADDR_OFF ( 0)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_PDAT_FASTADDR_WID (12)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_PDAT_FASTADDR_MSK (0x00000FFF)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_PDAT_FASTADDR_MAX (0x00000FFF)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_PDAT_FASTADDR_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_PDAT_ADDREN_OFF (16)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_PDAT_ADDREN_WID ( 1)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_PDAT_ADDREN_MSK (0x00010000)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_PDAT_ADDREN_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_PDAT_ADDREN_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_PDAT_SEQEN_OFF (17)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_PDAT_SEQEN_WID ( 1)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_PDAT_SEQEN_MSK (0x00020000)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_PDAT_SEQEN_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_PDAT_SEQEN_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_PDAT_POL0_OFF (18)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_PDAT_POL0_WID ( 1)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_PDAT_POL0_MSK (0x00040000)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_PDAT_POL0_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_PDAT_POL0_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_PDAT_POL1_OFF (19)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_PDAT_POL1_WID ( 1)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_PDAT_POL1_MSK (0x00080000)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_PDAT_POL1_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_PDAT_POL1_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_PDAT_CMDA_OFF (20)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_PDAT_CMDA_WID ( 4)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_PDAT_CMDA_MSK (0x00F00000)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_PDAT_CMDA_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_PDAT_CMDA_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_PDAT_CMDB_OFF (24)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_PDAT_CMDB_WID ( 4)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_PDAT_CMDB_MSK (0x0F000000)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_PDAT_CMDB_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_PDAT_CMDB_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_PDAT_CMDC_OFF (28)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_PDAT_CMDC_WID ( 4)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_PDAT_CMDC_MSK (0xF0000000)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_PDAT_CMDC_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_PDAT_CMDC_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_REG (0x000046C4)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_BANKSEL_OFF ( 0)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_BANKSEL_WID ( 4)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_BANKSEL_MSK (0x0000000F)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_BANKSEL_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_BANKSEL_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_ARRAYSEL_OFF ( 5)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_ARRAYSEL_WID ( 5)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_ARRAYSEL_MSK (0x000003E0)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_ARRAYSEL_MAX (0x0000001F)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_ARRAYSEL_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_CMP_OFF (10)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_CMP_WID ( 1)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_CMP_MSK (0x00000400)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_CMP_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_CMP_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_REP_OFF (11)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_REP_WID ( 1)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_REP_MSK (0x00000800)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_REP_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_REP_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_DWORD_OFF (12)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_DWORD_WID ( 4)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_DWORD_MSK (0x0000F000)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_DWORD_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_DWORD_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_MODE_OFF (16)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_MODE_WID ( 2)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_MODE_MSK (0x00030000)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_MODE_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_MODE_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_MPMAP_OFF (18)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_MPMAP_WID ( 6)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_MPMAP_MSK (0x00FC0000)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_MPMAP_MAX (0x0000003F)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_MPMAP_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_MPBOFFSET_OFF (24)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_MPBOFFSET_WID ( 4)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_MPBOFFSET_MSK (0x0F000000)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_MPBOFFSET_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_MPBOFFSET_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_STAGE_EN_OFF (28)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_STAGE_EN_WID ( 1)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_STAGE_EN_MSK (0x10000000)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_STAGE_EN_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_STAGE_EN_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_SHADOW_OFF (29)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_SHADOW_WID ( 2)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_SHADOW_MSK (0x60000000)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_SHADOW_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_SDAT_SHADOW_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_DCLK_LDAT_DATAOUT_REG (0x000046C8)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_DATAOUT_DATOUT_OFF ( 0)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_DATAOUT_DATOUT_WID (32)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_DATAOUT_DATOUT_MSK (0xFFFFFFFF)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_DATAOUT_DATOUT_MAX (0xFFFFFFFF)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_DATAOUT_DATOUT_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_DCLK_LDAT_DATAIN_0_REG (0x000046CC)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_DATAIN_0_DATIN_OFF ( 0)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_DATAIN_0_DATIN_WID (32)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_DATAIN_0_DATIN_MSK (0xFFFFFFFF)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_DATAIN_0_DATIN_MAX (0xFFFFFFFF)
+ #define MCHBAR_CH1_CR_DCLK_LDAT_DATAIN_0_DATIN_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_QCLK_LDAT_PDAT_REG (0x000046D0)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_PDAT_FASTADDR_OFF ( 0)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_PDAT_FASTADDR_WID (12)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_PDAT_FASTADDR_MSK (0x00000FFF)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_PDAT_FASTADDR_MAX (0x00000FFF)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_PDAT_FASTADDR_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_PDAT_ADDREN_OFF (16)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_PDAT_ADDREN_WID ( 1)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_PDAT_ADDREN_MSK (0x00010000)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_PDAT_ADDREN_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_PDAT_ADDREN_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_PDAT_SEQEN_OFF (17)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_PDAT_SEQEN_WID ( 1)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_PDAT_SEQEN_MSK (0x00020000)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_PDAT_SEQEN_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_PDAT_SEQEN_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_PDAT_POL0_OFF (18)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_PDAT_POL0_WID ( 1)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_PDAT_POL0_MSK (0x00040000)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_PDAT_POL0_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_PDAT_POL0_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_PDAT_POL1_OFF (19)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_PDAT_POL1_WID ( 1)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_PDAT_POL1_MSK (0x00080000)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_PDAT_POL1_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_PDAT_POL1_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_PDAT_CMDA_OFF (20)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_PDAT_CMDA_WID ( 4)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_PDAT_CMDA_MSK (0x00F00000)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_PDAT_CMDA_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_PDAT_CMDA_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_PDAT_CMDB_OFF (24)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_PDAT_CMDB_WID ( 4)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_PDAT_CMDB_MSK (0x0F000000)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_PDAT_CMDB_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_PDAT_CMDB_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_PDAT_CMDC_OFF (28)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_PDAT_CMDC_WID ( 4)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_PDAT_CMDC_MSK (0xF0000000)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_PDAT_CMDC_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_PDAT_CMDC_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_REG (0x000046D4)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_BANKSEL_OFF ( 0)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_BANKSEL_WID ( 4)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_BANKSEL_MSK (0x0000000F)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_BANKSEL_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_BANKSEL_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_ARRAYSEL_OFF ( 5)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_ARRAYSEL_WID ( 5)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_ARRAYSEL_MSK (0x000003E0)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_ARRAYSEL_MAX (0x0000001F)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_ARRAYSEL_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_CMP_OFF (10)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_CMP_WID ( 1)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_CMP_MSK (0x00000400)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_CMP_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_CMP_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_REP_OFF (11)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_REP_WID ( 1)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_REP_MSK (0x00000800)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_REP_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_REP_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_DWORD_OFF (12)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_DWORD_WID ( 4)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_DWORD_MSK (0x0000F000)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_DWORD_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_DWORD_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_MODE_OFF (16)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_MODE_WID ( 2)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_MODE_MSK (0x00030000)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_MODE_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_MODE_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_MPMAP_OFF (18)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_MPMAP_WID ( 6)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_MPMAP_MSK (0x00FC0000)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_MPMAP_MAX (0x0000003F)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_MPMAP_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_MPBOFFSET_OFF (24)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_MPBOFFSET_WID ( 4)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_MPBOFFSET_MSK (0x0F000000)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_MPBOFFSET_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_MPBOFFSET_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_STAGE_EN_OFF (28)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_STAGE_EN_WID ( 1)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_STAGE_EN_MSK (0x10000000)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_STAGE_EN_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_STAGE_EN_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_SHADOW_OFF (29)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_SHADOW_WID ( 2)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_SHADOW_MSK (0x60000000)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_SHADOW_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_SDAT_SHADOW_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_QCLK_LDAT_DATAOUT_REG (0x000046D8)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_DATAOUT_DATOUT_OFF ( 0)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_DATAOUT_DATOUT_WID (32)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_DATAOUT_DATOUT_MSK (0xFFFFFFFF)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_DATAOUT_DATOUT_MAX (0xFFFFFFFF)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_DATAOUT_DATOUT_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_QCLK_LDAT_DATAIN_0_REG (0x000046DC)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_DATAIN_0_DATIN_OFF ( 0)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_DATAIN_0_DATIN_WID (32)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_DATAIN_0_DATIN_MSK (0xFFFFFFFF)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_DATAIN_0_DATIN_MAX (0xFFFFFFFF)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_DATAIN_0_DATIN_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_QCLK_LDAT_DATAIN_1_REG (0x000046E0)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_DATAIN_1_DATIN_OFF ( 0)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_DATAIN_1_DATIN_WID (32)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_DATAIN_1_DATIN_MSK (0xFFFFFFFF)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_DATAIN_1_DATIN_MAX (0xFFFFFFFF)
+ #define MCHBAR_CH1_CR_QCLK_LDAT_DATAIN_1_DATIN_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_QUEUE_ENTRY_DISABLE_RPQ_REG (0x000046E4)
+ #define MCHBAR_CH1_CR_QUEUE_ENTRY_DISABLE_RPQ_RPQ_disable_OFF ( 0)
+ #define MCHBAR_CH1_CR_QUEUE_ENTRY_DISABLE_RPQ_RPQ_disable_WID (28)
+ #define MCHBAR_CH1_CR_QUEUE_ENTRY_DISABLE_RPQ_RPQ_disable_MSK (0x0FFFFFFF)
+ #define MCHBAR_CH1_CR_QUEUE_ENTRY_DISABLE_RPQ_RPQ_disable_MAX (0x0FFFFFFF)
+ #define MCHBAR_CH1_CR_QUEUE_ENTRY_DISABLE_RPQ_RPQ_disable_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_QUEUE_ENTRY_DISABLE_WPQ_REG (0x000046E8)
+ #define MCHBAR_CH1_CR_QUEUE_ENTRY_DISABLE_WPQ_WPQ_disable_OFF ( 0)
+ #define MCHBAR_CH1_CR_QUEUE_ENTRY_DISABLE_WPQ_WPQ_disable_WID (32)
+ #define MCHBAR_CH1_CR_QUEUE_ENTRY_DISABLE_WPQ_WPQ_disable_MSK (0xFFFFFFFF)
+ #define MCHBAR_CH1_CR_QUEUE_ENTRY_DISABLE_WPQ_WPQ_disable_MAX (0xFFFFFFFF)
+ #define MCHBAR_CH1_CR_QUEUE_ENTRY_DISABLE_WPQ_WPQ_disable_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_PM_DIMM_IDLE_ENERGY_REG (0x000046EC)
+ #define MCHBAR_CH1_CR_PM_DIMM_IDLE_ENERGY_DIMM0_IDLE_ENERGY_OFF ( 0)
+ #define MCHBAR_CH1_CR_PM_DIMM_IDLE_ENERGY_DIMM0_IDLE_ENERGY_WID ( 6)
+ #define MCHBAR_CH1_CR_PM_DIMM_IDLE_ENERGY_DIMM0_IDLE_ENERGY_MSK (0x0000003F)
+ #define MCHBAR_CH1_CR_PM_DIMM_IDLE_ENERGY_DIMM0_IDLE_ENERGY_MAX (0x0000003F)
+ #define MCHBAR_CH1_CR_PM_DIMM_IDLE_ENERGY_DIMM0_IDLE_ENERGY_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_PM_DIMM_IDLE_ENERGY_DIMM1_IDLE_ENERGY_OFF ( 8)
+ #define MCHBAR_CH1_CR_PM_DIMM_IDLE_ENERGY_DIMM1_IDLE_ENERGY_WID ( 6)
+ #define MCHBAR_CH1_CR_PM_DIMM_IDLE_ENERGY_DIMM1_IDLE_ENERGY_MSK (0x00003F00)
+ #define MCHBAR_CH1_CR_PM_DIMM_IDLE_ENERGY_DIMM1_IDLE_ENERGY_MAX (0x0000003F)
+ #define MCHBAR_CH1_CR_PM_DIMM_IDLE_ENERGY_DIMM1_IDLE_ENERGY_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_PM_DIMM_PD_ENERGY_REG (0x000046F0)
+ #define MCHBAR_CH1_CR_PM_DIMM_PD_ENERGY_DIMM0_PD_ENERGY_OFF ( 0)
+ #define MCHBAR_CH1_CR_PM_DIMM_PD_ENERGY_DIMM0_PD_ENERGY_WID ( 6)
+ #define MCHBAR_CH1_CR_PM_DIMM_PD_ENERGY_DIMM0_PD_ENERGY_MSK (0x0000003F)
+ #define MCHBAR_CH1_CR_PM_DIMM_PD_ENERGY_DIMM0_PD_ENERGY_MAX (0x0000003F)
+ #define MCHBAR_CH1_CR_PM_DIMM_PD_ENERGY_DIMM0_PD_ENERGY_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_PM_DIMM_PD_ENERGY_DIMM1_PD_ENERGY_OFF ( 8)
+ #define MCHBAR_CH1_CR_PM_DIMM_PD_ENERGY_DIMM1_PD_ENERGY_WID ( 6)
+ #define MCHBAR_CH1_CR_PM_DIMM_PD_ENERGY_DIMM1_PD_ENERGY_MSK (0x00003F00)
+ #define MCHBAR_CH1_CR_PM_DIMM_PD_ENERGY_DIMM1_PD_ENERGY_MAX (0x0000003F)
+ #define MCHBAR_CH1_CR_PM_DIMM_PD_ENERGY_DIMM1_PD_ENERGY_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_PM_DIMM_ACT_ENERGY_REG (0x000046F4)
+ #define MCHBAR_CH1_CR_PM_DIMM_ACT_ENERGY_DIMM0_ACT_ENERGY_OFF ( 0)
+ #define MCHBAR_CH1_CR_PM_DIMM_ACT_ENERGY_DIMM0_ACT_ENERGY_WID ( 8)
+ #define MCHBAR_CH1_CR_PM_DIMM_ACT_ENERGY_DIMM0_ACT_ENERGY_MSK (0x000000FF)
+ #define MCHBAR_CH1_CR_PM_DIMM_ACT_ENERGY_DIMM0_ACT_ENERGY_MAX (0x000000FF)
+ #define MCHBAR_CH1_CR_PM_DIMM_ACT_ENERGY_DIMM0_ACT_ENERGY_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_PM_DIMM_ACT_ENERGY_DIMM1_ACT_ENERGY_OFF ( 8)
+ #define MCHBAR_CH1_CR_PM_DIMM_ACT_ENERGY_DIMM1_ACT_ENERGY_WID ( 8)
+ #define MCHBAR_CH1_CR_PM_DIMM_ACT_ENERGY_DIMM1_ACT_ENERGY_MSK (0x0000FF00)
+ #define MCHBAR_CH1_CR_PM_DIMM_ACT_ENERGY_DIMM1_ACT_ENERGY_MAX (0x000000FF)
+ #define MCHBAR_CH1_CR_PM_DIMM_ACT_ENERGY_DIMM1_ACT_ENERGY_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_PM_DIMM_RD_ENERGY_REG (0x000046F8)
+ #define MCHBAR_CH1_CR_PM_DIMM_RD_ENERGY_DIMM0_RD_ENERGY_OFF ( 0)
+ #define MCHBAR_CH1_CR_PM_DIMM_RD_ENERGY_DIMM0_RD_ENERGY_WID ( 8)
+ #define MCHBAR_CH1_CR_PM_DIMM_RD_ENERGY_DIMM0_RD_ENERGY_MSK (0x000000FF)
+ #define MCHBAR_CH1_CR_PM_DIMM_RD_ENERGY_DIMM0_RD_ENERGY_MAX (0x000000FF)
+ #define MCHBAR_CH1_CR_PM_DIMM_RD_ENERGY_DIMM0_RD_ENERGY_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_PM_DIMM_RD_ENERGY_DIMM1_RD_ENERGY_OFF ( 8)
+ #define MCHBAR_CH1_CR_PM_DIMM_RD_ENERGY_DIMM1_RD_ENERGY_WID ( 8)
+ #define MCHBAR_CH1_CR_PM_DIMM_RD_ENERGY_DIMM1_RD_ENERGY_MSK (0x0000FF00)
+ #define MCHBAR_CH1_CR_PM_DIMM_RD_ENERGY_DIMM1_RD_ENERGY_MAX (0x000000FF)
+ #define MCHBAR_CH1_CR_PM_DIMM_RD_ENERGY_DIMM1_RD_ENERGY_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_PM_DIMM_WR_ENERGY_REG (0x000046FC)
+ #define MCHBAR_CH1_CR_PM_DIMM_WR_ENERGY_DIMM0_WR_ENERGY_OFF ( 0)
+ #define MCHBAR_CH1_CR_PM_DIMM_WR_ENERGY_DIMM0_WR_ENERGY_WID ( 8)
+ #define MCHBAR_CH1_CR_PM_DIMM_WR_ENERGY_DIMM0_WR_ENERGY_MSK (0x000000FF)
+ #define MCHBAR_CH1_CR_PM_DIMM_WR_ENERGY_DIMM0_WR_ENERGY_MAX (0x000000FF)
+ #define MCHBAR_CH1_CR_PM_DIMM_WR_ENERGY_DIMM0_WR_ENERGY_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_PM_DIMM_WR_ENERGY_DIMM1_WR_ENERGY_OFF ( 8)
+ #define MCHBAR_CH1_CR_PM_DIMM_WR_ENERGY_DIMM1_WR_ENERGY_WID ( 8)
+ #define MCHBAR_CH1_CR_PM_DIMM_WR_ENERGY_DIMM1_WR_ENERGY_MSK (0x0000FF00)
+ #define MCHBAR_CH1_CR_PM_DIMM_WR_ENERGY_DIMM1_WR_ENERGY_MAX (0x000000FF)
+ #define MCHBAR_CH1_CR_PM_DIMM_WR_ENERGY_DIMM1_WR_ENERGY_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_PM_THRT_CKE_MIN_REG (0x00004728)
+ #define MCHBAR_CH1_CR_PM_THRT_CKE_MIN_CKE_MIN_OFF ( 0)
+ #define MCHBAR_CH1_CR_PM_THRT_CKE_MIN_CKE_MIN_WID ( 8)
+ #define MCHBAR_CH1_CR_PM_THRT_CKE_MIN_CKE_MIN_MSK (0x000000FF)
+ #define MCHBAR_CH1_CR_PM_THRT_CKE_MIN_CKE_MIN_MAX (0x000000FF)
+ #define MCHBAR_CH1_CR_PM_THRT_CKE_MIN_CKE_MIN_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_PM_THRT_CKE_MIN_CKE_MIN_DEFEATURE_OFF ( 8)
+ #define MCHBAR_CH1_CR_PM_THRT_CKE_MIN_CKE_MIN_DEFEATURE_WID ( 1)
+ #define MCHBAR_CH1_CR_PM_THRT_CKE_MIN_CKE_MIN_DEFEATURE_MSK (0x00000100)
+ #define MCHBAR_CH1_CR_PM_THRT_CKE_MIN_CKE_MIN_DEFEATURE_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_PM_THRT_CKE_MIN_CKE_MIN_DEFEATURE_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_ODLAT_CMD_MATCH0_REG (0x00004740)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH0_ODT_OFF ( 0)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH0_ODT_WID ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH0_ODT_MSK (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH0_ODT_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH0_ODT_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH0_Web_OFF ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH0_Web_WID ( 1)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH0_Web_MSK (0x00000010)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH0_Web_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH0_Web_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH0_CASb_OFF ( 5)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH0_CASb_WID ( 1)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH0_CASb_MSK (0x00000020)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH0_CASb_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH0_CASb_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH0_RASb_OFF ( 6)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH0_RASb_WID ( 1)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH0_RASb_MSK (0x00000040)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH0_RASb_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH0_RASb_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH0_CSb_OFF ( 7)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH0_CSb_WID ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH0_CSb_MSK (0x00000780)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH0_CSb_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH0_CSb_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH0_CKE_OFF (11)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH0_CKE_WID ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH0_CKE_MSK (0x00007800)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH0_CKE_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH0_CKE_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH0_MA_OFF (15)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH0_MA_WID (16)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH0_MA_MSK (0x7FFF8000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH0_MA_MAX (0x0000FFFF)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH0_MA_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_ODLAT_CMD_MATCH1_REG (0x00004744)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH1_ODT_OFF ( 0)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH1_ODT_WID ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH1_ODT_MSK (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH1_ODT_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH1_ODT_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH1_Web_OFF ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH1_Web_WID ( 1)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH1_Web_MSK (0x00000010)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH1_Web_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH1_Web_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH1_CASb_OFF ( 5)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH1_CASb_WID ( 1)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH1_CASb_MSK (0x00000020)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH1_CASb_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH1_CASb_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH1_RASb_OFF ( 6)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH1_RASb_WID ( 1)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH1_RASb_MSK (0x00000040)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH1_RASb_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH1_RASb_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH1_CSb_OFF ( 7)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH1_CSb_WID ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH1_CSb_MSK (0x00000780)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH1_CSb_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH1_CSb_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH1_CKE_OFF (11)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH1_CKE_WID ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH1_CKE_MSK (0x00007800)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH1_CKE_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH1_CKE_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH1_MA_OFF (15)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH1_MA_WID (16)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH1_MA_MSK (0x7FFF8000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH1_MA_MAX (0x0000FFFF)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH1_MA_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_ODLAT_CMD_MATCH2_REG (0x00004748)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH2_ODT_OFF ( 0)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH2_ODT_WID ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH2_ODT_MSK (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH2_ODT_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH2_ODT_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH2_Web_OFF ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH2_Web_WID ( 1)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH2_Web_MSK (0x00000010)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH2_Web_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH2_Web_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH2_CASb_OFF ( 5)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH2_CASb_WID ( 1)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH2_CASb_MSK (0x00000020)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH2_CASb_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH2_CASb_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH2_RASb_OFF ( 6)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH2_RASb_WID ( 1)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH2_RASb_MSK (0x00000040)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH2_RASb_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH2_RASb_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH2_CSb_OFF ( 7)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH2_CSb_WID ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH2_CSb_MSK (0x00000780)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH2_CSb_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH2_CSb_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH2_CKE_OFF (11)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH2_CKE_WID ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH2_CKE_MSK (0x00007800)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH2_CKE_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH2_CKE_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH2_MA_OFF (15)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH2_MA_WID (16)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH2_MA_MSK (0x7FFF8000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH2_MA_MAX (0x0000FFFF)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH2_MA_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_ODLAT_CMD_MATCH3_REG (0x0000474C)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH3_ODT_OFF ( 0)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH3_ODT_WID ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH3_ODT_MSK (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH3_ODT_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH3_ODT_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH3_Web_OFF ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH3_Web_WID ( 1)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH3_Web_MSK (0x00000010)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH3_Web_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH3_Web_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH3_CASb_OFF ( 5)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH3_CASb_WID ( 1)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH3_CASb_MSK (0x00000020)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH3_CASb_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH3_CASb_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH3_RASb_OFF ( 6)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH3_RASb_WID ( 1)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH3_RASb_MSK (0x00000040)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH3_RASb_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH3_RASb_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH3_CSb_OFF ( 7)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH3_CSb_WID ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH3_CSb_MSK (0x00000780)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH3_CSb_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH3_CSb_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH3_CKE_OFF (11)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH3_CKE_WID ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH3_CKE_MSK (0x00007800)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH3_CKE_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH3_CKE_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH3_MA_OFF (15)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH3_MA_WID (16)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH3_MA_MSK (0x7FFF8000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH3_MA_MAX (0x0000FFFF)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MATCH3_MA_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_ODLAT_CMD_MASK0_REG (0x00004750)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK0_ODT_OFF ( 0)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK0_ODT_WID ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK0_ODT_MSK (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK0_ODT_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK0_ODT_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK0_Web_OFF ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK0_Web_WID ( 1)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK0_Web_MSK (0x00000010)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK0_Web_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK0_Web_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK0_CASb_OFF ( 5)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK0_CASb_WID ( 1)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK0_CASb_MSK (0x00000020)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK0_CASb_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK0_CASb_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK0_RASb_OFF ( 6)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK0_RASb_WID ( 1)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK0_RASb_MSK (0x00000040)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK0_RASb_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK0_RASb_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK0_CSb_OFF ( 7)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK0_CSb_WID ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK0_CSb_MSK (0x00000780)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK0_CSb_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK0_CSb_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK0_CKE_OFF (11)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK0_CKE_WID ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK0_CKE_MSK (0x00007800)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK0_CKE_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK0_CKE_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK0_MA_OFF (15)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK0_MA_WID (16)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK0_MA_MSK (0x7FFF8000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK0_MA_MAX (0x0000FFFF)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK0_MA_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_ODLAT_CMD_MASK1_REG (0x00004754)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK1_ODT_OFF ( 0)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK1_ODT_WID ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK1_ODT_MSK (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK1_ODT_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK1_ODT_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK1_Web_OFF ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK1_Web_WID ( 1)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK1_Web_MSK (0x00000010)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK1_Web_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK1_Web_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK1_CASb_OFF ( 5)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK1_CASb_WID ( 1)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK1_CASb_MSK (0x00000020)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK1_CASb_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK1_CASb_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK1_RASb_OFF ( 6)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK1_RASb_WID ( 1)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK1_RASb_MSK (0x00000040)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK1_RASb_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK1_RASb_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK1_CSb_OFF ( 7)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK1_CSb_WID ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK1_CSb_MSK (0x00000780)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK1_CSb_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK1_CSb_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK1_CKE_OFF (11)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK1_CKE_WID ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK1_CKE_MSK (0x00007800)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK1_CKE_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK1_CKE_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK1_MA_OFF (15)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK1_MA_WID (16)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK1_MA_MSK (0x7FFF8000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK1_MA_MAX (0x0000FFFF)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK1_MA_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_ODLAT_CMD_MASK2_REG (0x00004758)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK2_ODT_OFF ( 0)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK2_ODT_WID ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK2_ODT_MSK (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK2_ODT_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK2_ODT_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK2_Web_OFF ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK2_Web_WID ( 1)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK2_Web_MSK (0x00000010)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK2_Web_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK2_Web_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK2_CASb_OFF ( 5)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK2_CASb_WID ( 1)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK2_CASb_MSK (0x00000020)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK2_CASb_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK2_CASb_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK2_RASb_OFF ( 6)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK2_RASb_WID ( 1)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK2_RASb_MSK (0x00000040)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK2_RASb_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK2_RASb_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK2_CSb_OFF ( 7)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK2_CSb_WID ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK2_CSb_MSK (0x00000780)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK2_CSb_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK2_CSb_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK2_CKE_OFF (11)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK2_CKE_WID ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK2_CKE_MSK (0x00007800)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK2_CKE_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK2_CKE_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK2_MA_OFF (15)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK2_MA_WID (16)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK2_MA_MSK (0x7FFF8000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK2_MA_MAX (0x0000FFFF)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK2_MA_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_ODLAT_CMD_MASK3_REG (0x0000475C)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK3_ODT_OFF ( 0)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK3_ODT_WID ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK3_ODT_MSK (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK3_ODT_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK3_ODT_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK3_Web_OFF ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK3_Web_WID ( 1)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK3_Web_MSK (0x00000010)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK3_Web_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK3_Web_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK3_CASb_OFF ( 5)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK3_CASb_WID ( 1)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK3_CASb_MSK (0x00000020)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK3_CASb_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK3_CASb_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK3_RASb_OFF ( 6)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK3_RASb_WID ( 1)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK3_RASb_MSK (0x00000040)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK3_RASb_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK3_RASb_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK3_CSb_OFF ( 7)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK3_CSb_WID ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK3_CSb_MSK (0x00000780)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK3_CSb_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK3_CSb_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK3_CKE_OFF (11)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK3_CKE_WID ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK3_CKE_MSK (0x00007800)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK3_CKE_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK3_CKE_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK3_MA_OFF (15)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK3_MA_WID (16)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK3_MA_MSK (0x7FFF8000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK3_MA_MAX (0x0000FFFF)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_MASK3_MA_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_ODLAT_CMD_BANK_REG (0x00004760)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_BANK_BankMatch0_OFF ( 0)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_BANK_BankMatch0_WID ( 3)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_BANK_BankMatch0_MSK (0x00000007)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_BANK_BankMatch0_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_BANK_BankMatch0_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_BANK_BankMatch1_OFF ( 3)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_BANK_BankMatch1_WID ( 3)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_BANK_BankMatch1_MSK (0x00000038)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_BANK_BankMatch1_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_BANK_BankMatch1_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_BANK_BankMatch2_OFF ( 6)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_BANK_BankMatch2_WID ( 3)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_BANK_BankMatch2_MSK (0x000001C0)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_BANK_BankMatch2_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_BANK_BankMatch2_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_BANK_BankMatch3_OFF ( 9)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_BANK_BankMatch3_WID ( 3)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_BANK_BankMatch3_MSK (0x00000E00)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_BANK_BankMatch3_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_BANK_BankMatch3_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_BANK_BankMask0_OFF (12)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_BANK_BankMask0_WID ( 3)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_BANK_BankMask0_MSK (0x00007000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_BANK_BankMask0_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_BANK_BankMask0_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_BANK_BankMask1_OFF (15)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_BANK_BankMask1_WID ( 3)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_BANK_BankMask1_MSK (0x00038000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_BANK_BankMask1_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_BANK_BankMask1_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_BANK_BankMask2_OFF (18)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_BANK_BankMask2_WID ( 3)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_BANK_BankMask2_MSK (0x001C0000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_BANK_BankMask2_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_BANK_BankMask2_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_BANK_BankMask3_OFF (21)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_BANK_BankMask3_WID ( 3)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_BANK_BankMask3_MSK (0x00E00000)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_BANK_BankMask3_MAX (0x00000007)
+ #define MCHBAR_CH1_CR_ODLAT_CMD_BANK_BankMask3_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL0_REG (0x00004764)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL0_InputMatch_OFF ( 0)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL0_InputMatch_WID ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL0_InputMatch_MSK (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL0_InputMatch_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL0_InputMatch_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL0_InputInvert_OFF ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL0_InputInvert_WID ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL0_InputInvert_MSK (0x000000F0)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL0_InputInvert_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL0_InputInvert_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL0_CountMatches_OFF ( 8)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL0_CountMatches_WID ( 1)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL0_CountMatches_MSK (0x00000100)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL0_CountMatches_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL0_CountMatches_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL0_CounterThreshold_OFF ( 9)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL0_CounterThreshold_WID (15)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL0_CounterThreshold_MSK (0x00FFFE00)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL0_CounterThreshold_MAX (0x00007FFF)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL0_CounterThreshold_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL0_CounterAction_OFF (24)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL0_CounterAction_WID ( 2)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL0_CounterAction_MSK (0x03000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL0_CounterAction_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL0_CounterAction_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL0_CounterNextState_OFF (26)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL0_CounterNextState_WID ( 2)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL0_CounterNextState_MSK (0x0C000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL0_CounterNextState_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL0_CounterNextState_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL0_MatchAction_OFF (28)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL0_MatchAction_WID ( 2)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL0_MatchAction_MSK (0x30000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL0_MatchAction_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL0_MatchAction_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL0_MatchNextState_OFF (30)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL0_MatchNextState_WID ( 2)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL0_MatchNextState_MSK (0xC0000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL0_MatchNextState_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL0_MatchNextState_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL1_REG (0x00004768)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL1_InputMatch_OFF ( 0)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL1_InputMatch_WID ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL1_InputMatch_MSK (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL1_InputMatch_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL1_InputMatch_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL1_InputInvert_OFF ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL1_InputInvert_WID ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL1_InputInvert_MSK (0x000000F0)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL1_InputInvert_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL1_InputInvert_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL1_CountMatches_OFF ( 8)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL1_CountMatches_WID ( 1)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL1_CountMatches_MSK (0x00000100)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL1_CountMatches_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL1_CountMatches_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL1_CounterThreshold_OFF ( 9)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL1_CounterThreshold_WID (15)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL1_CounterThreshold_MSK (0x00FFFE00)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL1_CounterThreshold_MAX (0x00007FFF)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL1_CounterThreshold_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL1_CounterAction_OFF (24)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL1_CounterAction_WID ( 2)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL1_CounterAction_MSK (0x03000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL1_CounterAction_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL1_CounterAction_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL1_CounterNextState_OFF (26)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL1_CounterNextState_WID ( 2)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL1_CounterNextState_MSK (0x0C000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL1_CounterNextState_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL1_CounterNextState_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL1_MatchAction_OFF (28)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL1_MatchAction_WID ( 2)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL1_MatchAction_MSK (0x30000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL1_MatchAction_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL1_MatchAction_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL1_MatchNextState_OFF (30)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL1_MatchNextState_WID ( 2)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL1_MatchNextState_MSK (0xC0000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL1_MatchNextState_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL1_MatchNextState_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL2_REG (0x0000476C)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL2_InputMatch_OFF ( 0)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL2_InputMatch_WID ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL2_InputMatch_MSK (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL2_InputMatch_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL2_InputMatch_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL2_InputInvert_OFF ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL2_InputInvert_WID ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL2_InputInvert_MSK (0x000000F0)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL2_InputInvert_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL2_InputInvert_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL2_CountMatches_OFF ( 8)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL2_CountMatches_WID ( 1)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL2_CountMatches_MSK (0x00000100)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL2_CountMatches_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL2_CountMatches_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL2_CounterThreshold_OFF ( 9)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL2_CounterThreshold_WID (15)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL2_CounterThreshold_MSK (0x00FFFE00)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL2_CounterThreshold_MAX (0x00007FFF)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL2_CounterThreshold_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL2_CounterAction_OFF (24)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL2_CounterAction_WID ( 2)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL2_CounterAction_MSK (0x03000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL2_CounterAction_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL2_CounterAction_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL2_CounterNextState_OFF (26)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL2_CounterNextState_WID ( 2)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL2_CounterNextState_MSK (0x0C000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL2_CounterNextState_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL2_CounterNextState_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL2_MatchAction_OFF (28)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL2_MatchAction_WID ( 2)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL2_MatchAction_MSK (0x30000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL2_MatchAction_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL2_MatchAction_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL2_MatchNextState_OFF (30)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL2_MatchNextState_WID ( 2)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL2_MatchNextState_MSK (0xC0000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL2_MatchNextState_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL2_MatchNextState_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL3_REG (0x00004770)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL3_InputMatch_OFF ( 0)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL3_InputMatch_WID ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL3_InputMatch_MSK (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL3_InputMatch_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL3_InputMatch_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL3_InputInvert_OFF ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL3_InputInvert_WID ( 4)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL3_InputInvert_MSK (0x000000F0)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL3_InputInvert_MAX (0x0000000F)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL3_InputInvert_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL3_CountMatches_OFF ( 8)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL3_CountMatches_WID ( 1)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL3_CountMatches_MSK (0x00000100)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL3_CountMatches_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL3_CountMatches_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL3_CounterThreshold_OFF ( 9)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL3_CounterThreshold_WID (15)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL3_CounterThreshold_MSK (0x00FFFE00)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL3_CounterThreshold_MAX (0x00007FFF)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL3_CounterThreshold_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL3_CounterAction_OFF (24)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL3_CounterAction_WID ( 2)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL3_CounterAction_MSK (0x03000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL3_CounterAction_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL3_CounterAction_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL3_CounterNextState_OFF (26)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL3_CounterNextState_WID ( 2)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL3_CounterNextState_MSK (0x0C000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL3_CounterNextState_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL3_CounterNextState_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL3_MatchAction_OFF (28)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL3_MatchAction_WID ( 2)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL3_MatchAction_MSK (0x30000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL3_MatchAction_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL3_MatchAction_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL3_MatchNextState_OFF (30)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL3_MatchNextState_WID ( 2)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL3_MatchNextState_MSK (0xC0000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL3_MatchNextState_MAX (0x00000003)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_LEVEL3_MatchNextState_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_ODLAT_SEQ_GLOBAL_REG (0x00004774)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_GLOBAL_TriggerBlockEnable_OFF ( 0)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_GLOBAL_TriggerBlockEnable_WID ( 1)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_GLOBAL_TriggerBlockEnable_MSK (0x00000001)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_GLOBAL_TriggerBlockEnable_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_GLOBAL_TriggerBlockEnable_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_GLOBAL_GlobalCounterThreshold_OFF ( 1)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_GLOBAL_GlobalCounterThreshold_WID (16)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_GLOBAL_GlobalCounterThreshold_MSK (0x0001FFFE)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_GLOBAL_GlobalCounterThreshold_MAX (0x0000FFFF)
+ #define MCHBAR_CH1_CR_ODLAT_SEQ_GLOBAL_GlobalCounterThreshold_DEF (0x00000000)
+
+#define MCHBAR_CH1_CR_SC_WDBWM_REG (0x0000478C)
+ #define MCHBAR_CH1_CR_SC_WDBWM_WMM_Enter_OFF ( 0)
+ #define MCHBAR_CH1_CR_SC_WDBWM_WMM_Enter_WID ( 8)
+ #define MCHBAR_CH1_CR_SC_WDBWM_WMM_Enter_MSK (0x000000FF)
+ #define MCHBAR_CH1_CR_SC_WDBWM_WMM_Enter_MAX (0x000000FF)
+ #define MCHBAR_CH1_CR_SC_WDBWM_WMM_Enter_DEF (0x00000038)
+ #define MCHBAR_CH1_CR_SC_WDBWM_WMM_Exit_OFF ( 8)
+ #define MCHBAR_CH1_CR_SC_WDBWM_WMM_Exit_WID ( 8)
+ #define MCHBAR_CH1_CR_SC_WDBWM_WMM_Exit_MSK (0x0000FF00)
+ #define MCHBAR_CH1_CR_SC_WDBWM_WMM_Exit_MAX (0x000000FF)
+ #define MCHBAR_CH1_CR_SC_WDBWM_WMM_Exit_DEF (0x00000030)
+ #define MCHBAR_CH1_CR_SC_WDBWM_WPQ_IS_OFF (16)
+ #define MCHBAR_CH1_CR_SC_WDBWM_WPQ_IS_WID ( 8)
+ #define MCHBAR_CH1_CR_SC_WDBWM_WPQ_IS_MSK (0x00FF0000)
+ #define MCHBAR_CH1_CR_SC_WDBWM_WPQ_IS_MAX (0x000000FF)
+ #define MCHBAR_CH1_CR_SC_WDBWM_WPQ_IS_DEF (0x0000003C)
+ #define MCHBAR_CH1_CR_SC_WDBWM_Starve_count_OFF (24)
+ #define MCHBAR_CH1_CR_SC_WDBWM_Starve_count_WID ( 8)
+ #define MCHBAR_CH1_CR_SC_WDBWM_Starve_count_MSK (0xFF000000)
+ #define MCHBAR_CH1_CR_SC_WDBWM_Starve_count_MAX (0x000000FF)
+ #define MCHBAR_CH1_CR_SC_WDBWM_Starve_count_DEF (0x000000FF)
+
+#define MCHBAR_CH1_CR_VISA_CTL_MCMNTS_REG (0x00004790)
+ #define MCHBAR_CH1_CR_VISA_CTL_MCMNTS_Data_OFF ( 0)
+ #define MCHBAR_CH1_CR_VISA_CTL_MCMNTS_Data_WID (18)
+ #define MCHBAR_CH1_CR_VISA_CTL_MCMNTS_Data_MSK (0x0003FFFF)
+ #define MCHBAR_CH1_CR_VISA_CTL_MCMNTS_Data_MAX (0x0003FFFF)
+ #define MCHBAR_CH1_CR_VISA_CTL_MCMNTS_Data_DEF (0x00000000)
+ #define MCHBAR_CH1_CR_VISA_CTL_MCMNTS_VORANGE_OFF (31)
+ #define MCHBAR_CH1_CR_VISA_CTL_MCMNTS_VORANGE_WID ( 1)
+ #define MCHBAR_CH1_CR_VISA_CTL_MCMNTS_VORANGE_MSK (0x80000000)
+ #define MCHBAR_CH1_CR_VISA_CTL_MCMNTS_VORANGE_MAX (0x00000001)
+ #define MCHBAR_CH1_CR_VISA_CTL_MCMNTS_VORANGE_DEF (0x00000000)
+
+#pragma pack(pop)
+#endif // __McMain_h__
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/McScramble.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/McScramble.h
new file mode 100644
index 0000000..a387610
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/McScramble.h
@@ -0,0 +1,148 @@
+/** @file
+ This file was automatically generated. Modify at your own risk.
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef __McScramble_h__
+#define __McScramble_h__
+
+#pragma pack(push, 1)
+#include "MrcTypes.h"
+
+typedef union {
+ struct {
+ U32 ScramEn : 1; // Bits 0:0
+ U32 ScramKey : 16; // Bits 16:1
+ U32 Spare : 15; // Bits 31:17
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRSCRAM_CR_DDRSCRAMBLECH0_STRUCT;
+
+typedef union {
+ struct {
+ U32 ScramEn : 1; // Bits 0:0
+ U32 ScramKey : 16; // Bits 16:1
+ U32 Spare : 15; // Bits 31:17
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRSCRAM_CR_DDRSCRAMBLECH1_STRUCT;
+
+typedef union {
+ struct {
+ U32 WL_WakeCycles : 2; // Bits 1:0
+ U32 WL_SleepCycles : 3; // Bits 4:2
+ U32 ForceCompUpdate : 1; // Bits 5:5
+ U32 WeakLock_Latency : 4; // Bits 9:6
+ U32 DdrNoChInterleave : 1; // Bits 10:10
+ U32 LPDDR_Mode : 1; // Bits 11:11
+ U32 CKEMappingCh0 : 4; // Bits 15:12
+ U32 CKEMappingCh1 : 4; // Bits 19:16
+ U32 Spare : 12; // Bits 31:20
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DDRSCRAM_CR_DDRMISCCONTROL0_STRUCT;
+
+#define DDRSCRAM_CR_DDRSCRAMBLECH0_REG (0x00002000)
+ #define DDRSCRAM_CR_DDRSCRAMBLECH0_ScramEn_OFF ( 0)
+ #define DDRSCRAM_CR_DDRSCRAMBLECH0_ScramEn_WID ( 1)
+ #define DDRSCRAM_CR_DDRSCRAMBLECH0_ScramEn_MSK (0x00000001)
+ #define DDRSCRAM_CR_DDRSCRAMBLECH0_ScramEn_MAX (0x00000001)
+ #define DDRSCRAM_CR_DDRSCRAMBLECH0_ScramEn_DEF (0x00000000)
+ #define DDRSCRAM_CR_DDRSCRAMBLECH0_ScramKey_OFF ( 1)
+ #define DDRSCRAM_CR_DDRSCRAMBLECH0_ScramKey_WID (16)
+ #define DDRSCRAM_CR_DDRSCRAMBLECH0_ScramKey_MSK (0x0001FFFE)
+ #define DDRSCRAM_CR_DDRSCRAMBLECH0_ScramKey_MAX (0x0000FFFF)
+ #define DDRSCRAM_CR_DDRSCRAMBLECH0_ScramKey_DEF (0x00000000)
+ #define DDRSCRAM_CR_DDRSCRAMBLECH0_Spare_OFF (17)
+ #define DDRSCRAM_CR_DDRSCRAMBLECH0_Spare_WID (15)
+ #define DDRSCRAM_CR_DDRSCRAMBLECH0_Spare_MSK (0xFFFE0000)
+ #define DDRSCRAM_CR_DDRSCRAMBLECH0_Spare_MAX (0x00007FFF)
+ #define DDRSCRAM_CR_DDRSCRAMBLECH0_Spare_DEF (0x00000000)
+
+#define DDRSCRAM_CR_DDRSCRAMBLECH1_REG (0x00002004)
+ #define DDRSCRAM_CR_DDRSCRAMBLECH1_ScramEn_OFF ( 0)
+ #define DDRSCRAM_CR_DDRSCRAMBLECH1_ScramEn_WID ( 1)
+ #define DDRSCRAM_CR_DDRSCRAMBLECH1_ScramEn_MSK (0x00000001)
+ #define DDRSCRAM_CR_DDRSCRAMBLECH1_ScramEn_MAX (0x00000001)
+ #define DDRSCRAM_CR_DDRSCRAMBLECH1_ScramEn_DEF (0x00000000)
+ #define DDRSCRAM_CR_DDRSCRAMBLECH1_ScramKey_OFF ( 1)
+ #define DDRSCRAM_CR_DDRSCRAMBLECH1_ScramKey_WID (16)
+ #define DDRSCRAM_CR_DDRSCRAMBLECH1_ScramKey_MSK (0x0001FFFE)
+ #define DDRSCRAM_CR_DDRSCRAMBLECH1_ScramKey_MAX (0x0000FFFF)
+ #define DDRSCRAM_CR_DDRSCRAMBLECH1_ScramKey_DEF (0x00000000)
+ #define DDRSCRAM_CR_DDRSCRAMBLECH1_Spare_OFF (17)
+ #define DDRSCRAM_CR_DDRSCRAMBLECH1_Spare_WID (15)
+ #define DDRSCRAM_CR_DDRSCRAMBLECH1_Spare_MSK (0xFFFE0000)
+ #define DDRSCRAM_CR_DDRSCRAMBLECH1_Spare_MAX (0x00007FFF)
+ #define DDRSCRAM_CR_DDRSCRAMBLECH1_Spare_DEF (0x00000000)
+
+#define DDRSCRAM_CR_DDRMISCCONTROL0_REG (0x00002008)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_WL_WakeCycles_OFF ( 0)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_WL_WakeCycles_WID ( 2)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_WL_WakeCycles_MSK (0x00000003)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_WL_WakeCycles_MAX (0x00000003)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_WL_WakeCycles_DEF (0x00000000)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_WL_SleepCycles_OFF ( 2)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_WL_SleepCycles_WID ( 3)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_WL_SleepCycles_MSK (0x0000001C)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_WL_SleepCycles_MAX (0x00000007)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_WL_SleepCycles_DEF (0x00000000)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_ForceCompUpdate_OFF ( 5)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_ForceCompUpdate_WID ( 1)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_ForceCompUpdate_MSK (0x00000020)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_ForceCompUpdate_MAX (0x00000001)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_ForceCompUpdate_DEF (0x00000000)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_WeakLock_Latency_OFF ( 6)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_WeakLock_Latency_WID ( 4)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_WeakLock_Latency_MSK (0x000003C0)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_WeakLock_Latency_MAX (0x0000000F)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_WeakLock_Latency_DEF (0x0000000C)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_DdrNoChInterleave_OFF (10)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_DdrNoChInterleave_WID ( 1)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_DdrNoChInterleave_MSK (0x00000400)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_DdrNoChInterleave_MAX (0x00000001)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_DdrNoChInterleave_DEF (0x00000000)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_LPDDR_Mode_OFF (11)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_LPDDR_Mode_WID ( 1)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_LPDDR_Mode_MSK (0x00000800)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_LPDDR_Mode_MAX (0x00000001)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_LPDDR_Mode_DEF (0x00000000)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_CKEMappingCh0_OFF (12)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_CKEMappingCh0_WID ( 4)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_CKEMappingCh0_MSK (0x0000F000)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_CKEMappingCh0_MAX (0x0000000F)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_CKEMappingCh0_DEF (0x0000000A)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_CKEMappingCh1_OFF (16)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_CKEMappingCh1_WID ( 4)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_CKEMappingCh1_MSK (0x000F0000)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_CKEMappingCh1_MAX (0x0000000F)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_CKEMappingCh1_DEF (0x0000000A)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_Spare_OFF (20)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_Spare_WID (12)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_Spare_MSK (0xFFF00000)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_Spare_MAX (0x00000FFF)
+ #define DDRSCRAM_CR_DDRMISCCONTROL0_Spare_DEF (0x00000000)
+
+#pragma pack(pop)
+#endif // __McScramble_h__
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/Msa.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/Msa.h
new file mode 100644
index 0000000..ed8e90d
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/Msa.h
@@ -0,0 +1,6827 @@
+/** @file
+ This file was automatically generated. Modify at your own risk.
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef __Msa_h__
+#define __Msa_h__
+
+#pragma pack(push, 1)
+#include "MrcTypes.h"
+
+typedef union {
+ struct {
+ U32 GFXVTBAREN : 1; // Bits 0:0
+ U32 : 11; // Bits 11:1
+ U32 GFXVTBAR : 27; // Bits 38:12
+ U32 : 25; // Bits 63:39
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} NCDECS_CR_GFXVTBAR_NCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 EDRAMBAREN : 1; // Bits 0:0
+ U32 : 13; // Bits 13:1
+ U32 EDRAMBAR : 25; // Bits 38:14
+ U32 : 25; // Bits 63:39
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} NCDECS_CR_EDRAMBAR_NCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 VTVC0BAREN : 1; // Bits 0:0
+ U32 : 11; // Bits 11:1
+ U32 VTVC0BAR : 27; // Bits 38:12
+ U32 : 25; // Bits 63:39
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} NCDECS_CR_VTDPVC0BAR_NCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 RdrModSel : 3; // Bits 2:0
+ U32 ClastChkSmpMod : 1; // Bits 3:3
+ U32 LogFltClustMod : 1; // Bits 4:4
+ U32 LogFlatClustOvrEn : 1; // Bits 5:5
+ U32 HashModCtr : 3; // Bits 8:6
+ U32 : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} NCDECS_CR_INTRDIRCTL_NCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 : 28; // Bits 27:0
+ U32 PLIM : 3; // Bits 30:28
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} NCDECS_CR_NCUCTL0_NCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 GDXCBAREN : 1; // Bits 0:0
+ U32 : 11; // Bits 11:1
+ U32 GDXCBAR : 27; // Bits 38:12
+ U32 : 25; // Bits 63:39
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} NCDECS_CR_GDXCBAR_NCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 Data : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} NCDECS_CR_SCRATCHPAD_NCU_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 Data : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} NCDECS_CR_SCRATCHPAD_NCU_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 Data : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} NCDECS_CR_SCRATCHPAD_NCU_2_STRUCT;
+
+typedef union {
+ struct {
+ U32 Data : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} NCDECS_CR_SCRATCHPAD_NCU_3_STRUCT;
+
+typedef union {
+ struct {
+ U32 LOCK : 1; // Bits 0:0
+ U32 : 19; // Bits 19:1
+ U32 OFFSET : 12; // Bits 31:20
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} NCDECS_CR_PAVPMSGOFFST_NCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 VCPVTDLIM : 3; // Bits 2:0
+ U32 : 29; // Bits 31:3
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPVTDTRK_CR_VTDLIM_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 : 3; // Bits 2:0
+ U32 DEVNUM : 5; // Bits 7:3
+ U32 BUSNUM : 8; // Bits 15:8
+ U32 : 15; // Bits 30:16
+ U32 HDAUD_EN : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPVTDTRK_CR_HDAUDRID_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 : 20; // Bits 19:0
+ U32 UMAB : 19; // Bits 38:20
+ U32 : 25; // Bits 63:39
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} MPVTDTRK_CR_UMAGFXBASE_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 : 20; // Bits 19:0
+ U32 UMAL : 19; // Bits 38:20
+ U32 : 25; // Bits 63:39
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} MPVTDTRK_CR_UMAGFXLIMIT_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 LCK : 1; // Bits 0:0
+ U32 : 9; // Bits 9:1
+ U32 PEG10EN : 1; // Bits 10:10
+ U32 PEG11EN : 1; // Bits 11:11
+ U32 PEG12EN : 1; // Bits 12:12
+ U32 DMIEN : 1; // Bits 13:13
+ U32 : 18; // Bits 31:14
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPVTDTRK_CR_UMAGFXCTL_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 FUNNUM : 3; // Bits 2:0
+ U32 DEVNUM : 5; // Bits 7:3
+ U32 BUSNUM : 8; // Bits 15:8
+ U32 BARNUM : 3; // Bits 18:16
+ U32 : 13; // Bits 31:19
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPVTDTRK_CR_VDMBDFBARKVM_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 FUNNUM : 3; // Bits 2:0
+ U32 DEVNUM : 5; // Bits 7:3
+ U32 BUSNUM : 8; // Bits 15:8
+ U32 BARNUM : 3; // Bits 18:16
+ U32 : 13; // Bits 31:19
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPVTDTRK_CR_VDMBDFBARPAVP_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATA : 18; // Bits 17:0
+ U32 : 13; // Bits 30:18
+ U32 VORANGE : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPVTDTRK_CR_VISA_CTL_MPVTDTLBS_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATA : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPVTDTRK_CR_VISA_XBAR_MPVTDTLBS_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATA : 18; // Bits 17:0
+ U32 : 13; // Bits 30:18
+ U32 VORANGE : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPVTDTRK_CR_VISA_CTL_MPVTMISCS_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATA : 18; // Bits 17:0
+ U32 : 13; // Bits 30:18
+ U32 VORANGE : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPVTDTRK_CR_VISA_CTL_MPVTTRKS_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 VC : 4; // Bits 3:0
+ U32 FMT_CMDTYPE : 6; // Bits 9:4
+ U32 TC : 4; // Bits 13:10
+ U32 CHAIN : 1; // Bits 14:14
+ U32 NS : 1; // Bits 15:15
+ U32 RO : 1; // Bits 16:16
+ U32 LENGTH : 5; // Bits 21:17
+ U32 EP : 1; // Bits 22:22
+ U32 AT : 2; // Bits 24:23
+ U32 : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPVTDTRK_CR_PRIMUP_MASK1_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 RQID : 16; // Bits 15:0
+ U32 TAG : 8; // Bits 23:16
+ U32 LBEFBE_MSGTYPE : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPVTDTRK_CR_PRIMUP_MASK2_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 ADDR_31_0 : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPVTDTRK_CR_PRIMUP_MASK3_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 ADDR_63_32 : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPVTDTRK_CR_PRIMUP_MASK4_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 VC : 4; // Bits 3:0
+ U32 FMT_CMDTYPE : 6; // Bits 9:4
+ U32 TC : 4; // Bits 13:10
+ U32 CHAIN : 1; // Bits 14:14
+ U32 NS : 1; // Bits 15:15
+ U32 RO : 1; // Bits 16:16
+ U32 LENGTH : 5; // Bits 21:17
+ U32 EP : 1; // Bits 22:22
+ U32 AT : 2; // Bits 24:23
+ U32 : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPVTDTRK_CR_PRIMUP_COMP1_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 RQID : 16; // Bits 15:0
+ U32 TAG : 8; // Bits 23:16
+ U32 LBEFBE_MSGTYPE : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPVTDTRK_CR_PRIMUP_COMP2_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 ADDR_31_0 : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPVTDTRK_CR_PRIMUP_COMP3_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 ADDR_63_32 : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPVTDTRK_CR_PRIMUP_COMP4_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 ENABLE : 1; // Bits 0:0
+ U32 TRIGGERED : 1; // Bits 1:1
+ U32 STALL_DNARB : 1; // Bits 2:2
+ U32 STALL_UPARB : 1; // Bits 3:3
+ U32 STALL_SNPARB : 1; // Bits 4:4
+ U32 : 18; // Bits 22:5
+ U32 STALL_DELAY : 9; // Bits 31:23
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPVTDTRK_CR_PRIMUP_TRIGGER_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 PEG2DMIDIS : 1; // Bits 0:0
+ U32 EOIB : 1; // Bits 1:1
+ U32 MSIBYPDIS : 1; // Bits 2:2
+ U32 : 1; // Bits 3:3
+ U32 PHLDDIS : 1; // Bits 4:4
+ U32 : 1; // Bits 5:5
+ U32 BKSNPDIS : 1; // Bits 6:6
+ U32 FRCVC0SNP : 1; // Bits 7:7
+ U32 FRCVCPSNP : 1; // Bits 8:8
+ U32 PHLDBLKDIS : 1; // Bits 9:9
+ U32 BLKWRPOSTVC1 : 1; // Bits 10:10
+ U32 DIS_VLW_PEG : 1; // Bits 11:11
+ U32 SPECRDDIS : 1; // Bits 12:12
+ U32 IR_RSRV_CTL : 1; // Bits 13:13
+ U32 RSVD : 18; // Bits 31:14
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPVTDTRK_CR_HCTL0_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 : 4; // Bits 3:0
+ U64 REGBAR : 35; // Bits 38:4
+ U32 : 25; // Bits 63:39
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} MPVTDTRK_CR_REGBAR_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 THERMAL_MONITOR_STATUS : 1; // Bits 0:0
+ U32 THERMAL_MONITOR_LOG : 1; // Bits 1:1
+ U32 PROCHOT_STATUS : 1; // Bits 2:2
+ U32 PROCHOT_LOG : 1; // Bits 3:3
+ U32 OUT_OF_SPEC_STATUS : 1; // Bits 4:4
+ U32 OUT_OF_SPEC_LOG : 1; // Bits 5:5
+ U32 THRESHOLD1_STATUS : 1; // Bits 6:6
+ U32 THRESHOLD1_LOG : 1; // Bits 7:7
+ U32 THRESHOLD2_STATUS : 1; // Bits 8:8
+ U32 THRESHOLD2_LOG : 1; // Bits 9:9
+ U32 POWER_LIMITATION_STATUS : 1; // Bits 10:10
+ U32 POWER_LIMITATION_LOG : 1; // Bits 11:11
+ U32 : 4; // Bits 15:12
+ U32 Temperature : 7; // Bits 22:16
+ U32 : 4; // Bits 26:23
+ U32 Resolution : 4; // Bits 30:27
+ U32 Valid : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 WARM_THRESHOLD_STATUS : 1; // Bits 0:0
+ U32 WARM_THRESHOLD_LOG : 1; // Bits 1:1
+ U32 HOT_THRESHOLD_STATUS : 1; // Bits 2:2
+ U32 HOT_THRESHOLD_LOG : 1; // Bits 3:3
+ U32 REFRESH2X_STATUS : 1; // Bits 4:4
+ U32 REFRESH2X_LOG : 1; // Bits 5:5
+ U32 FORCEMEMPR_STATUS : 1; // Bits 6:6
+ U32 FORCEMEMPR_LOG : 1; // Bits 7:7
+ U32 THRESHOLD1_STATUS : 1; // Bits 8:8
+ U32 THRESHOLD1_LOG : 1; // Bits 9:9
+ U32 THRESHOLD2_STATUS : 1; // Bits 10:10
+ U32 THRESHOLD2_LOG : 1; // Bits 11:11
+ U32 : 20; // Bits 31:12
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 LOCK : 1; // Bits 0:0
+ U32 : 31; // Bits 31:1
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPVTDTRK_CR_VTDTRKLCK_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 RDLIM : 3; // Bits 2:0
+ U32 : 1; // Bits 3:3
+ U32 WRLIM : 3; // Bits 6:4
+ U32 : 24; // Bits 30:7
+ U32 LOCK : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPCBOTRK_CR_REQLIM_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 VCPNPLIM : 3; // Bits 2:0
+ U32 : 1; // Bits 3:3
+ U32 VCPPLIM : 3; // Bits 6:4
+ U32 : 1; // Bits 7:7
+ U32 VCMNPLIM : 3; // Bits 10:8
+ U32 : 1; // Bits 11:11
+ U32 VCMPLIM : 3; // Bits 14:12
+ U32 : 1; // Bits 15:15
+ U32 VCPCMPLIM : 3; // Bits 18:16
+ U32 : 1; // Bits 19:19
+ U32 VCMCMPLIM : 3; // Bits 22:20
+ U32 : 8; // Bits 30:23
+ U32 LOCK : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} HUBS_CR_DMIVCLIM_HUBS_STRUCT;
+
+typedef union {
+ struct {
+ U32 P0 : 1; // Bits 0:0
+ U32 P1 : 1; // Bits 1:1
+ U32 P2 : 1; // Bits 2:2
+ U32 P3 : 1; // Bits 3:3
+ U32 : 28; // Bits 31:4
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} HUBS_CR_HUB0_PWRDN_OVRD_HUBS_STRUCT;
+
+typedef union {
+ struct {
+ U32 P0 : 1; // Bits 0:0
+ U32 P1 : 1; // Bits 1:1
+ U32 P2 : 1; // Bits 2:2
+ U32 P3 : 1; // Bits 3:3
+ U32 : 28; // Bits 31:4
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} HUBS_CR_HUB1_PWRDN_OVRD_HUBS_STRUCT;
+
+typedef union {
+ struct {
+ U32 P0 : 1; // Bits 0:0
+ U32 P1 : 1; // Bits 1:1
+ U32 P2 : 1; // Bits 2:2
+ U32 P3 : 1; // Bits 3:3
+ U32 : 28; // Bits 31:4
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} HUBS_CR_HUB2_PWRDN_OVRD_HUBS_STRUCT;
+
+typedef union {
+ struct {
+ U32 BLK_GNT_P0 : 1; // Bits 0:0
+ U32 BLK_GNT_P1 : 1; // Bits 1:1
+ U32 BLK_GNT_P2 : 1; // Bits 2:2
+ U32 BLK_PUT_P0 : 1; // Bits 3:3
+ U32 BLK_PUT_P1 : 1; // Bits 4:4
+ U32 BLK_PUT_P2 : 1; // Bits 5:5
+ U32 BLK_PUT_P3 : 1; // Bits 6:6
+ U32 NO_CHAIN_P0 : 1; // Bits 7:7
+ U32 NO_CHAIN_P1 : 1; // Bits 8:8
+ U32 NO_CHAIN_P2 : 1; // Bits 9:9
+ U32 SLOW_UP_P0 : 1; // Bits 10:10
+ U32 SLOW_UP_P1 : 1; // Bits 11:11
+ U32 SLOW_UP_P2 : 1; // Bits 12:12
+ U32 SLOW_DN_P0 : 1; // Bits 13:13
+ U32 SLOW_DN_P1 : 1; // Bits 14:14
+ U32 SLOW_DN_P2 : 1; // Bits 15:15
+ U32 SLOW_DN_P3 : 1; // Bits 16:16
+ U32 SLOWER_CMD : 1; // Bits 17:17
+ U32 DMI_NOPUSH : 1; // Bits 18:18
+ U32 RO_PASS_NP : 1; // Bits 19:19
+ U32 RST_CRD_P3 : 1; // Bits 20:20
+ U32 : 11; // Bits 31:21
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} HUBS_CR_HUB0_DEFEATURE_HUBS_STRUCT;
+
+typedef union {
+ struct {
+ U32 BLK_GNT_P1 : 1; // Bits 0:0
+ U32 BLK_GNT_P2 : 1; // Bits 1:1
+ U32 BLK_PUT_P0 : 1; // Bits 2:2
+ U32 BLK_PUT_P1 : 1; // Bits 3:3
+ U32 BLK_PUT_P2 : 1; // Bits 4:4
+ U32 BLK_PUT_P3 : 1; // Bits 5:5
+ U32 NO_CHAIN_P1 : 1; // Bits 6:6
+ U32 NO_CHAIN_P2 : 1; // Bits 7:7
+ U32 SLOW_UP_P0 : 1; // Bits 8:8
+ U32 SLOW_UP_P1 : 1; // Bits 9:9
+ U32 SLOW_UP_P2 : 1; // Bits 10:10
+ U32 SLOW_DN_P1 : 1; // Bits 11:11
+ U32 SLOW_DN_P2 : 1; // Bits 12:12
+ U32 SLOW_DN_P3 : 1; // Bits 13:13
+ U32 SLOWER_CMD : 1; // Bits 14:14
+ U32 RO_PASS_NP : 1; // Bits 15:15
+ U32 RST_CRD_P0 : 1; // Bits 16:16
+ U32 RST_CRD_P3 : 1; // Bits 17:17
+ U32 : 14; // Bits 31:18
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} HUBS_CR_HUB1_DEFEATURE_HUBS_STRUCT;
+
+typedef union {
+ struct {
+ U32 BLK_GNT_P1 : 1; // Bits 0:0
+ U32 BLK_GNT_P2 : 1; // Bits 1:1
+ U32 BLK_PUT_P0 : 1; // Bits 2:2
+ U32 BLK_PUT_P1 : 1; // Bits 3:3
+ U32 BLK_PUT_P2 : 1; // Bits 4:4
+ U32 NO_CHAIN_P1 : 1; // Bits 5:5
+ U32 NO_CHAIN_P2 : 1; // Bits 6:6
+ U32 SLOW_UP_P0 : 1; // Bits 7:7
+ U32 SLOW_UP_P1 : 1; // Bits 8:8
+ U32 SLOW_UP_P2 : 1; // Bits 9:9
+ U32 SLOW_DN_P1 : 1; // Bits 10:10
+ U32 SLOW_DN_P2 : 1; // Bits 11:11
+ U32 SLOWER_CMD : 1; // Bits 12:12
+ U32 RST_CRD_P0 : 1; // Bits 13:13
+ U32 : 18; // Bits 31:14
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} HUBS_CR_HUB2_DEFEATURE_HUBS_STRUCT;
+
+typedef union {
+ struct {
+ U32 PCIPWRGAT : 1; // Bits 0:0
+ U32 : 31; // Bits 31:1
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} HUBS_CR_PEGCTL_HUBS_STRUCT;
+
+typedef union {
+ struct {
+ U32 H0_EMPTY : 1; // Bits 0:0
+ U32 H1_EMPTY : 1; // Bits 1:1
+ U32 H2_EMPTY : 1; // Bits 2:2
+ U32 : 29; // Bits 31:3
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} HUBS_CR_HUB_EMPTY_HUBS_STRUCT;
+
+typedef union {
+ struct {
+ U32 REQ_VLD_P0 : 1; // Bits 0:0
+ U32 REQ_VLD_P1 : 1; // Bits 1:1
+ U32 REQ_VLD_P2 : 1; // Bits 2:2
+ U32 REQ_VLD_P3 : 1; // Bits 3:3
+ U32 TNX_VLD_P0 : 1; // Bits 4:4
+ U32 TNX_VLD_P1 : 1; // Bits 5:5
+ U32 TNX_VLD_P2 : 1; // Bits 6:6
+ U32 TNX_VLD_P3 : 1; // Bits 7:7
+ U32 : 24; // Bits 31:8
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} HUBS_CR_HUB0_STATUS_HUBS_STRUCT;
+
+typedef union {
+ struct {
+ U32 REQ_VLD_P0 : 1; // Bits 0:0
+ U32 REQ_VLD_P1 : 1; // Bits 1:1
+ U32 REQ_VLD_P2 : 1; // Bits 2:2
+ U32 REQ_VLD_P3 : 1; // Bits 3:3
+ U32 TNX_VLD_P0 : 1; // Bits 4:4
+ U32 TNX_VLD_P1 : 1; // Bits 5:5
+ U32 TNX_VLD_P2 : 1; // Bits 6:6
+ U32 TNX_VLD_P3 : 1; // Bits 7:7
+ U32 : 24; // Bits 31:8
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} HUBS_CR_HUB1_STATUS_HUBS_STRUCT;
+
+typedef union {
+ struct {
+ U32 REQ_VLD_P0 : 1; // Bits 0:0
+ U32 REQ_VLD_P1 : 1; // Bits 1:1
+ U32 REQ_VLD_P2 : 1; // Bits 2:2
+ U32 REQ_VLD_P3 : 1; // Bits 3:3
+ U32 TNX_VLD_P0 : 1; // Bits 4:4
+ U32 TNX_VLD_P1 : 1; // Bits 5:5
+ U32 TNX_VLD_P2 : 1; // Bits 6:6
+ U32 TNX_VLD_P3 : 1; // Bits 7:7
+ U32 : 24; // Bits 31:8
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} HUBS_CR_HUB2_STATUS_HUBS_STRUCT;
+
+typedef union {
+ struct {
+ U32 Data : 18; // Bits 17:0
+ U32 : 13; // Bits 30:18
+ U32 VORANGE : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} HUBS_CR_VISA_CTL_SABHUB0S_HUBS_STRUCT;
+
+typedef union {
+ struct {
+ U32 Data : 18; // Bits 17:0
+ U32 : 13; // Bits 30:18
+ U32 VORANGE : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} HUBS_CR_VISA_CTL_SABHUB1S_HUBS_STRUCT;
+
+typedef union {
+ struct {
+ U32 Data : 18; // Bits 17:0
+ U32 : 13; // Bits 30:18
+ U32 VORANGE : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} HUBS_CR_VISA_CTL_SABHUB2S_HUBS_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATA : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} HUBS_CR_MBOX_WR_DATA_HUBS_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATA : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} HUBS_CR_MBOX_RD_DATA_HUBS_STRUCT;
+
+typedef union {
+ struct {
+ U32 ADDR : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} HUBS_CR_MBOX_ADDR_LO_HUBS_STRUCT;
+
+typedef union {
+ struct {
+ U32 ADDR : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} HUBS_CR_MBOX_ADDR_HI_HUBS_STRUCT;
+
+typedef union {
+ struct {
+ U32 FBE : 4; // Bits 3:0
+ U32 LBE : 4; // Bits 7:4
+ U32 TAG : 8; // Bits 15:8
+ U32 RQID : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} HUBS_CR_MBOX_CMD_LO_HUBS_STRUCT;
+
+typedef union {
+ struct {
+ U32 AT : 2; // Bits 1:0
+ U32 POISON : 1; // Bits 2:2
+ U32 LENGTH : 5; // Bits 7:3
+ U32 RELAXED : 1; // Bits 8:8
+ U32 NOSNOOP : 1; // Bits 9:9
+ U32 CHAIN : 1; // Bits 10:10
+ U32 CTYPE : 5; // Bits 15:11
+ U32 FMT : 2; // Bits 17:16
+ U32 TC : 4; // Bits 21:18
+ U32 RESERVED : 2; // Bits 23:22
+ U32 DMI_PRIV : 1; // Bits 24:24
+ U32 CHID : 4; // Bits 28:25
+ U32 RTYPE : 2; // Bits 30:29
+ U32 START : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} HUBS_CR_MBOX_CMD_HI_HUBS_STRUCT;
+
+typedef union {
+ struct {
+ U32 ENABLE : 1; // Bits 0:0
+ U32 LOCK_IA : 1; // Bits 1:1
+ U32 RESET : 1; // Bits 2:2
+ U32 BLK_CYCLES : 6; // Bits 8:3
+ U32 WR_DWORD_SEL : 4; // Bits 12:9
+ U32 RD_DWORD_SEL : 4; // Bits 16:13
+ U32 RPT_CMD_CNT : 6; // Bits 22:17
+ U32 RPT_NXT_ADDR : 1; // Bits 23:23
+ U32 RPT_NXT_PAGE : 1; // Bits 24:24
+ U32 DIS_CMP_INV : 1; // Bits 25:25
+ U32 FSM_STATE : 4; // Bits 29:26
+ U32 P2P_ALL : 1; // Bits 30:30
+ U32 SPARE : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} HUBS_CR_MBOX_CFG_HUBS_STRUCT;
+
+typedef union {
+ struct {
+ U32 FSM_STATE : 4; // Bits 3:0
+ U32 RPT_CMD_CNT : 6; // Bits 9:4
+ U32 OPCODE : 7; // Bits 16:10
+ U32 WR_DWORD_SEL : 4; // Bits 20:17
+ U32 RD_DWORD_SEL : 4; // Bits 24:21
+ U32 P2P_RD_UP : 1; // Bits 25:25
+ U32 P2P_RD_DN : 1; // Bits 26:26
+ U32 SPARE : 5; // Bits 31:27
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} HUBS_CR_MBOX_STATUS_HUBS_STRUCT;
+
+typedef union {
+ struct {
+ U32 XTM_CHID : 9; // Bits 8:0
+ U32 NP : 1; // Bits 9:9
+ U32 PC : 1; // Bits 10:10
+ U32 : 21; // Bits 31:11
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} HUBS_CR_HUB0_BLOCK_UP_HUBS_STRUCT;
+
+typedef union {
+ struct {
+ U32 DMIVC0_PMIN : 3; // Bits 2:0
+ U32 P10VC0_PMIN : 3; // Bits 5:3
+ U32 P11VC0_PMIN : 3; // Bits 8:6
+ U32 P12VC0_PMIN : 3; // Bits 11:9
+ U32 DEVC0_PMIN : 3; // Bits 14:12
+ U32 DMIVCP_PMIN : 3; // Bits 17:15
+ U32 DMIVCM_PMIN : 3; // Bits 20:18
+ U32 DMIVC1_PMIN : 3; // Bits 23:21
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPRDRTRN_CR_CRDTCTL0_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 DMIVC0_NPMIN : 3; // Bits 2:0
+ U32 P10VC0_NPMIN : 3; // Bits 5:3
+ U32 P11VC0_NPMIN : 3; // Bits 8:6
+ U32 P12VC0_NPMIN : 3; // Bits 11:9
+ U32 DEVC0_NPMIN : 3; // Bits 14:12
+ U32 DMIVCP_NPMIN : 3; // Bits 17:15
+ U32 DMIVCM_NPMIN : 3; // Bits 20:18
+ U32 DMIVC1_NPMIN : 3; // Bits 23:21
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPRDRTRN_CR_CRDTCTL1_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 DMIVC0_RRMIN : 3; // Bits 2:0
+ U32 P10VC0_RRMIN : 3; // Bits 5:3
+ U32 P11VC0_RRMIN : 3; // Bits 8:6
+ U32 P12VC0_RRMIN : 3; // Bits 11:9
+ U32 DEVC0_RRMIN : 3; // Bits 14:12
+ U32 DMIVCP_RRMIN : 3; // Bits 17:15
+ U32 DMIVCM_RRMIN : 3; // Bits 20:18
+ U32 DMIVC1_RRMIN : 3; // Bits 23:21
+ U32 DEVC1_RRMIN : 6; // Bits 29:24
+ U32 : 2; // Bits 31:30
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPRDRTRN_CR_CRDTCTL2_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 IOTRK_SHRD : 6; // Bits 5:0
+ U32 RRTRK_SHRD : 7; // Bits 12:6
+ U32 : 19; // Bits 31:13
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPRDRTRN_CR_CRDTCTL3_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 DMIVC0_PMAX : 5; // Bits 4:0
+ U32 P10VC0_PMAX : 5; // Bits 9:5
+ U32 P11VC0_PMAX : 5; // Bits 14:10
+ U32 P12VC0_PMAX : 5; // Bits 19:15
+ U32 DEVC0_PMAX : 5; // Bits 24:20
+ U32 : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPRDRTRN_CR_CRDTCTL4_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 DMIVCP_PMAX : 5; // Bits 4:0
+ U32 DMIVCM_PMAX : 5; // Bits 9:5
+ U32 DMIVC1_PMAX : 5; // Bits 14:10
+ U32 : 17; // Bits 31:15
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPRDRTRN_CR_CRDTCTL5_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 DMIVC0_NPMAX : 5; // Bits 4:0
+ U32 P10VC0_NPMAX : 5; // Bits 9:5
+ U32 P11VC0_NPMAX : 5; // Bits 14:10
+ U32 P12VC0_NPMAX : 5; // Bits 19:15
+ U32 DEVC0_NPMAX : 5; // Bits 24:20
+ U32 : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPRDRTRN_CR_CRDTCTL6_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 DMIVCP_NPMAX : 5; // Bits 4:0
+ U32 DMIVCM_NPMAX : 5; // Bits 9:5
+ U32 DMIVC1_NPMAX : 5; // Bits 14:10
+ U32 : 17; // Bits 31:15
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPRDRTRN_CR_CRDTCTL7_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATA : 18; // Bits 17:0
+ U32 : 13; // Bits 30:18
+ U32 VORANGE : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPRDRTRN_CR_VISA_CTL_MPIORDTRKS_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATA : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPRDRTRN_CR_VISA_XBAR_MPIORDTRKS_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATA : 18; // Bits 17:0
+ U32 : 13; // Bits 30:18
+ U32 VORANGE : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPRDRTRN_CR_VISA_CTL_MPIOTRKS_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 VC : 4; // Bits 3:0
+ U32 FMT_CMDTYPE : 6; // Bits 9:4
+ U32 TC : 4; // Bits 13:10
+ U32 NS : 1; // Bits 14:14
+ U32 RO : 1; // Bits 15:15
+ U32 LENGTH : 5; // Bits 20:16
+ U32 EP : 1; // Bits 21:21
+ U32 : 10; // Bits 31:22
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPRDRTRN_CR_PRIMDN_MASK1_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 RQID : 16; // Bits 15:0
+ U32 TAG : 8; // Bits 23:16
+ U32 LBEFBE_MSGTYPE : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPRDRTRN_CR_PRIMDN_MASK2_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 ADDR_31_0 : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPRDRTRN_CR_PRIMDN_MASK3_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 ADDR_63_32 : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPRDRTRN_CR_PRIMDN_MASK4_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 VC : 4; // Bits 3:0
+ U32 FMT_CMDTYPE : 6; // Bits 9:4
+ U32 TC : 4; // Bits 13:10
+ U32 EP : 1; // Bits 14:14
+ U32 NS : 1; // Bits 15:15
+ U32 RO : 1; // Bits 16:16
+ U32 LENGTH : 5; // Bits 21:17
+ U32 : 10; // Bits 31:22
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPRDRTRN_CR_PRIMDN_COMP1_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 RQID : 16; // Bits 15:0
+ U32 TAG : 8; // Bits 23:16
+ U32 LBEFBE_MSGTYPE : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPRDRTRN_CR_PRIMDN_COMP2_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 ADDR_31_0 : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPRDRTRN_CR_PRIMDN_COMP3_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 ADDR_63_32 : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPRDRTRN_CR_PRIMDN_COMP4_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 ENABLE : 1; // Bits 0:0
+ U32 TRIGGERED : 1; // Bits 1:1
+ U32 STALL_DNARB : 1; // Bits 2:2
+ U32 : 20; // Bits 22:3
+ U32 STALL_DELAY : 9; // Bits 31:23
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPRDRTRN_CR_PRIMDN_TRIGGER_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 DMIVC0_RRMAX : 6; // Bits 5:0
+ U32 P10VC0_RRMAX : 6; // Bits 11:6
+ U32 P11VC0_RRMAX : 6; // Bits 17:12
+ U32 P12VC0_RRMAX : 6; // Bits 23:18
+ U32 DEVC0_RRMAX : 6; // Bits 29:24
+ U32 : 2; // Bits 31:30
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPRDRTRN_CR_CRDTCTL8_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 DMIVCP_RRMAX : 6; // Bits 5:0
+ U32 DMIVCM_RRMAX : 6; // Bits 11:6
+ U32 DMIVC1_RRMAX : 6; // Bits 17:12
+ U32 DEVC1_RRMAX : 6; // Bits 23:18
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPRDRTRN_CR_CRDTCTL9_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 LIM : 16; // Bits 15:0
+ U32 MSK : 3; // Bits 18:16
+ U32 : 13; // Bits 31:19
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPRDRTRN_CR_PCIE_POPUP_CTL_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 FUNNUM : 3; // Bits 2:0
+ U32 DEVNUM : 5; // Bits 7:3
+ U32 BUSNUM : 8; // Bits 15:8
+ U32 BARNUM : 3; // Bits 18:16
+ U32 : 13; // Bits 31:19
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPRDRTRN_CR_VDMBDFBARSSKU_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 LOCK : 1; // Bits 0:0
+ U32 : 31; // Bits 31:1
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPRDRTRN_CR_CRDTLCK_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 VCPNPLIM : 3; // Bits 2:0
+ U32 : 1; // Bits 3:3
+ U32 VCPPLIM : 3; // Bits 6:4
+ U32 : 1; // Bits 7:7
+ U32 VCMNPLIM : 3; // Bits 10:8
+ U32 : 1; // Bits 11:11
+ U32 VCMPLIM : 3; // Bits 14:12
+ U32 : 1; // Bits 15:15
+ U32 VC0VTDLIM : 3; // Bits 18:16
+ U32 : 1; // Bits 19:19
+ U32 VCPVTDLIM : 3; // Bits 22:20
+ U32 : 9; // Bits 31:23
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPMCARB_CR_VCLIM0_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 IARD : 3; // Bits 2:0
+ U32 : 1; // Bits 3:3
+ U32 IAWR : 3; // Bits 6:4
+ U32 : 1; // Bits 7:7
+ U32 VTDL3 : 3; // Bits 10:8
+ U32 : 1; // Bits 11:11
+ U32 VTDNL3 : 3; // Bits 14:12
+ U32 : 17; // Bits 31:15
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPMCARB_CR_VCLIM1_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 VC1_WR_CNFLT : 1; // Bits 0:0
+ U32 VC1_RD_CNFLT : 1; // Bits 1:1
+ U32 : 30; // Bits 31:2
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPMCARB_CR_ATMC_STS_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATA : 18; // Bits 17:0
+ U32 : 13; // Bits 30:18
+ U32 VORANGE : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPMCARB_CR_VISA_CTL_MPMCARBS_F_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATA : 18; // Bits 17:0
+ U32 : 13; // Bits 30:18
+ U32 VORANGE : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPMCARB_CR_VISA_CTL_MPMCARBS_D_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 LOCK : 1; // Bits 0:0
+ U32 : 31; // Bits 31:1
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MPMCARB_CR_MCARBLCK_IMPH_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATA : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_CAMARILLO_MAILBOX_DATA0_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATA : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_CAMARILLO_MAILBOX_DATA1_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 COMMAND : 8; // Bits 7:0
+ U32 ADDR_CNTL : 21; // Bits 28:8
+ U32 : 2; // Bits 30:29
+ U32 RUN_BUSY : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_CAMARILLO_MAILBOX_INTERFACE_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 HIGH_TEMP_INT_ENABLE : 1; // Bits 0:0
+ U32 LOW_TEMP_INT_ENABLE : 1; // Bits 1:1
+ U32 PROCHOT_INT_ENABLE : 1; // Bits 2:2
+ U32 : 1; // Bits 3:3
+ U32 OUT_OF_SPEC_INT_ENABLE : 1; // Bits 4:4
+ U32 : 3; // Bits 7:5
+ U32 THRESHOLD_1_REL_TEMP : 7; // Bits 14:8
+ U32 THRESHOLD_1_INT_ENABLE : 1; // Bits 15:15
+ U32 THRESHOLD_2_REL_TEMP : 7; // Bits 22:16
+ U32 THRESHOLD_2_INT_ENABLE : 1; // Bits 23:23
+ U32 POWER_INT_ENABLE : 1; // Bits 24:24
+ U32 : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 OLTM_ENABLE : 1; // Bits 0:0
+ U32 CLTM_ENABLE : 1; // Bits 1:1
+ U32 REFRESH_2X_MODE : 2; // Bits 3:2
+ U32 EXTTS_ENABLE : 1; // Bits 4:4
+ U32 LOCK_PTM_REGS_PCU : 1; // Bits 5:5
+ U32 PDWN_CONFIG_CTL : 1; // Bits 6:6
+ U32 DISABLE_DRAM_TS : 1; // Bits 7:7
+ U32 : 24; // Bits 31:8
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_DDR_PTM_CTL_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 SCALEFACTOR : 3; // Bits 2:0
+ U32 : 29; // Bits 31:3
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_DDR_ENERGY_SCALEFACTOR_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 CH0 : 8; // Bits 7:0
+ U32 CH1 : 8; // Bits 15:8
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_DDR_RAPL_CHANNEL_POWER_FLOOR_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 CH0_DIMM0 : 2; // Bits 1:0
+ U32 CH0_DIMM1 : 2; // Bits 3:2
+ U32 : 4; // Bits 7:4
+ U32 CH1_DIMM0 : 2; // Bits 9:8
+ U32 CH1_DIMM1 : 2; // Bits 11:10
+ U32 : 20; // Bits 31:12
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_DDR_THERM_PERDIMM_STATUS_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 DIMM0 : 8; // Bits 7:0
+ U32 DIMM1 : 8; // Bits 15:8
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_DDR_WARM_THRESHOLD_CH0_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 DIMM0 : 8; // Bits 7:0
+ U32 DIMM1 : 8; // Bits 15:8
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_DDR_WARM_THRESHOLD_CH1_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 DIMM0 : 8; // Bits 7:0
+ U32 DIMM1 : 8; // Bits 15:8
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_DDR_HOT_THRESHOLD_CH0_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 DIMM0 : 8; // Bits 7:0
+ U32 DIMM1 : 8; // Bits 15:8
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_DDR_HOT_THRESHOLD_CH1_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 ENABLE_WARM_INTERRUPT : 1; // Bits 0:0
+ U32 : 1; // Bits 1:1
+ U32 ENABLE_HOT_INTERRUPT : 1; // Bits 2:2
+ U32 : 1; // Bits 3:3
+ U32 ENABLE_2X_REFRESH_INTERRUPT : 1; // Bits 4:4
+ U32 : 3; // Bits 7:5
+ U32 ENABLE_THRESHOLD1_INTERRUPT : 1; // Bits 8:8
+ U32 : 1; // Bits 9:9
+ U32 ENABLE_THRESHOLD2_INTERRUPT : 1; // Bits 10:10
+ U32 : 5; // Bits 15:11
+ U32 POLICY_FREE_THRESHOLD1 : 8; // Bits 23:16
+ U32 POLICY_FREE_THRESHOLD2 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_DDR_THERM_CAMARILLO_INTERRUPT_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 DDR_VOLTAGE : 3; // Bits 2:0
+ U32 : 29; // Bits 31:3
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_DDR_VOLTAGE_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 THERM_MARGIN : 16; // Bits 15:0
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_PACKAGE_THERM_MARGIN_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 DIMM0 : 8; // Bits 7:0
+ U32 DIMM1 : 8; // Bits 15:8
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_DDR_DIMM_TEMPERATURE_CH0_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 DIMM0 : 8; // Bits 7:0
+ U32 DIMM1 : 8; // Bits 15:8
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_DDR_DIMM_TEMPERATURE_CH1_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 TEMPERATURE : 8; // Bits 7:0
+ U32 : 24; // Bits 31:8
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_DDR_DIMM_HOTTEST_ABSOLUTE_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 TEMPERATURE : 8; // Bits 7:0
+ U32 : 24; // Bits 31:8
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_DDR_DIMM_HOTTEST_RELATIVE_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 DIMM0 : 16; // Bits 15:0
+ U32 DIMM1 : 16; // Bits 31:16
+ U32 : 32; // Bits 63:32
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} PCU_CR_DDR_THROTTLE_DURATION_CH0_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 DIMM0 : 16; // Bits 15:0
+ U32 DIMM1 : 16; // Bits 31:16
+ U32 : 32; // Bits 63:32
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} PCU_CR_DDR_THROTTLE_DURATION_CH1_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 DIMM0 : 8; // Bits 7:0
+ U32 DIMM1 : 8; // Bits 15:8
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_DDR_WARM_BUDGET_CH0_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 DIMM0 : 8; // Bits 7:0
+ U32 DIMM1 : 8; // Bits 15:8
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_DDR_WARM_BUDGET_CH1_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 DIMM0 : 8; // Bits 7:0
+ U32 DIMM1 : 8; // Bits 15:8
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_DDR_HOT_BUDGET_CH0_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 DIMM0 : 8; // Bits 7:0
+ U32 DIMM1 : 8; // Bits 15:8
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_DDR_HOT_BUDGET_CH1_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 LIMIT1_POWER : 15; // Bits 14:0
+ U32 LIMIT1_ENABLE : 1; // Bits 15:15
+ U32 : 1; // Bits 16:16
+ U32 LIMIT1_TIME_WINDOW_Y : 5; // Bits 21:17
+ U32 LIMIT1_TIME_WINDOW_X : 2; // Bits 23:22
+ U32 : 8; // Bits 31:24
+ U32 LIMIT2_POWER : 15; // Bits 46:32
+ U32 LIMIT2_ENABLE : 1; // Bits 47:47
+ U32 : 1; // Bits 48:48
+ U32 LIMIT2_TIME_WINDOW_Y : 5; // Bits 53:49
+ U32 LIMIT2_TIME_WINDOW_X : 2; // Bits 55:54
+ U32 : 7; // Bits 62:56
+ U32 LOCKED : 1; // Bits 63:63
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} PCU_CR_DDR_RAPL_LIMIT_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 JOULES_CONSUMED : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_DDR_ENERGY_STATUS_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 DURATION : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_DDR_RAPL_PERF_STATUS_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 COUNTS : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_PACKAGE_RAPL_PERF_STATUS_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 IA_MIN_RATIO_REQUEST : 8; // Bits 7:0
+ U32 CLR_MIN_RATIO_REQUEST : 8; // Bits 15:8
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_GT_RATIOS_OVERRIDE_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 DDR_ACCESS_TIME : 14; // Bits 13:0
+ U32 RESERVED : 1; // Bits 14:14
+ U32 CLR_ACCESS_TIME : 14; // Bits 28:15
+ U32 NON_SNOOP_THRESHOLD_RESOLUTION : 1; // Bits 29:29
+ U32 SLOW_SNOOP_THRESHOLD_RESOLUTION : 1; // Bits 30:30
+ U32 FAST_SNOOP_THRESHOLD_RESOLUTION : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_PKGC_LTR_LATENCY_MEASUREMENTS_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 PROCHOT_STATUS : 1; // Bits 0:0
+ U32 THERMAL_STATUS : 1; // Bits 1:1
+ U32 SPARE_IA_2 : 1; // Bits 2:2
+ U32 PBM_PL1_STATUS : 1; // Bits 3:3
+ U32 PBM_PL2_STATUS : 1; // Bits 4:4
+ U32 PBM_PLIA_STATUS : 1; // Bits 5:5
+ U32 SPARE_IA_6 : 1; // Bits 6:6
+ U32 GTDRIVER_STATUS : 1; // Bits 7:7
+ U32 VR_THERMALERT_STATUS : 1; // Bits 8:8
+ U32 FUSE_MAX_TURBO_LIMIT_STATUS : 1; // Bits 9:9
+ U32 EDP_ICC_STATUS : 1; // Bits 10:10
+ U32 TURBO_ATTEN_STATUS : 1; // Bits 11:11
+ U32 SPARE_IA_12 : 1; // Bits 12:12
+ U32 SPARE_IA_13 : 1; // Bits 13:13
+ U32 SPARE_IA_14 : 1; // Bits 14:14
+ U32 SPARE_IA_15 : 1; // Bits 15:15
+ U32 PROCHOT_LOG : 1; // Bits 16:16
+ U32 THERMAL_LOG : 1; // Bits 17:17
+ U32 SPARE_IA_LOG_2 : 1; // Bits 18:18
+ U32 PBM_PL1_LOG : 1; // Bits 19:19
+ U32 PBM_PL2_LOG : 1; // Bits 20:20
+ U32 PBM_PLIA_LOG : 1; // Bits 21:21
+ U32 SPARE_IA_LOG_6 : 1; // Bits 22:22
+ U32 GTDRIVER_LOG : 1; // Bits 23:23
+ U32 VR_THERMALERT_LOG : 1; // Bits 24:24
+ U32 FUSE_MAX_TURBO_LIMIT_LOG : 1; // Bits 25:25
+ U32 EDP_ICC_LOG : 1; // Bits 26:26
+ U32 TURBO_ATTEN_LOG : 1; // Bits 27:27
+ U32 SPARE_IA_LOG_12 : 1; // Bits 28:28
+ U32 SPARE_IA_LOG_13 : 1; // Bits 29:29
+ U32 SPARE_IA_LOG_14 : 1; // Bits 30:30
+ U32 SPARE_IA_LOG_15 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_IA_PERF_LIMIT_REASONS_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 PROCHOT_STATUS : 1; // Bits 0:0
+ U32 THERMAL_STATUS : 1; // Bits 1:1
+ U32 SPARE_GT_2 : 1; // Bits 2:2
+ U32 PBM_PL1_STATUS : 1; // Bits 3:3
+ U32 PBM_PL2_STATUS : 1; // Bits 4:4
+ U32 PBM_PLGT_STATUS : 1; // Bits 5:5
+ U32 SPARE_GT_6 : 1; // Bits 6:6
+ U32 SPARE_GT_7 : 1; // Bits 7:7
+ U32 VR_THERMALERT_STATUS : 1; // Bits 8:8
+ U32 SPARE_GT_9 : 1; // Bits 9:9
+ U32 EDP_ICC_STATUS : 1; // Bits 10:10
+ U32 SPARE_GT_11 : 1; // Bits 11:11
+ U32 SPARE_GT_12 : 1; // Bits 12:12
+ U32 SPARE_GT_13 : 1; // Bits 13:13
+ U32 SPARE_GT_14 : 1; // Bits 14:14
+ U32 SPARE_GT_15 : 1; // Bits 15:15
+ U32 PROCHOT_LOG : 1; // Bits 16:16
+ U32 THERMAL_LOG : 1; // Bits 17:17
+ U32 SPARE_GT_LOG_2 : 1; // Bits 18:18
+ U32 PBM_PL1_LOG : 1; // Bits 19:19
+ U32 PBM_PL2_LOG : 1; // Bits 20:20
+ U32 PBM_PLGT_LOG : 1; // Bits 21:21
+ U32 SPARE_GT_LOG_6 : 1; // Bits 22:22
+ U32 SPARE_GT_LOG_7 : 1; // Bits 23:23
+ U32 VR_THERMALERT_LOG : 1; // Bits 24:24
+ U32 SPARE_GT_LOG_9 : 1; // Bits 25:25
+ U32 EDP_ICC_LOG : 1; // Bits 26:26
+ U32 SPARE_GT_LOG_11 : 1; // Bits 27:27
+ U32 SPARE_GT_LOG_12 : 1; // Bits 28:28
+ U32 SPARE_GT_LOG_13 : 1; // Bits 29:29
+ U32 SPARE_GT_LOG_14 : 1; // Bits 30:30
+ U32 SPARE_GT_LOG_15 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_GT_PERF_LIMIT_REASONS_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 PROCHOT_STATUS : 1; // Bits 0:0
+ U32 THERMAL_STATUS : 1; // Bits 1:1
+ U32 SPARE_CLR_2 : 1; // Bits 2:2
+ U32 PBM_PL1_STATUS : 1; // Bits 3:3
+ U32 PBM_PL2_STATUS : 1; // Bits 4:4
+ U32 SPARE_CLR_5 : 1; // Bits 5:5
+ U32 SPARE_CLR_6 : 1; // Bits 6:6
+ U32 SPARE_CLR_7 : 1; // Bits 7:7
+ U32 VR_THERMALERT_STATUS : 1; // Bits 8:8
+ U32 SPARE_CLR_9 : 1; // Bits 9:9
+ U32 EDP_ICC_STATUS : 1; // Bits 10:10
+ U32 SPARE_CLR_11 : 1; // Bits 11:11
+ U32 SPARE_CLR_12 : 1; // Bits 12:12
+ U32 SPARE_CLR_13 : 1; // Bits 13:13
+ U32 SPARE_CLR_14 : 1; // Bits 14:14
+ U32 SPARE_CLR_15 : 1; // Bits 15:15
+ U32 PROCHOT_LOG : 1; // Bits 16:16
+ U32 THERMAL_LOG : 1; // Bits 17:17
+ U32 SPARE_CLR_LOG_2 : 1; // Bits 18:18
+ U32 PBM_PL1_LOG : 1; // Bits 19:19
+ U32 PBM_PL2_LOG : 1; // Bits 20:20
+ U32 SPARE_CLR_LOG_5 : 1; // Bits 21:21
+ U32 SPARE_CLR_LOG_6 : 1; // Bits 22:22
+ U32 SPARE_CLR_LOG_7 : 1; // Bits 23:23
+ U32 VR_THERMALERT_LOG : 1; // Bits 24:24
+ U32 SPARE_CLR_LOG_9 : 1; // Bits 25:25
+ U32 EDP_ICC_LOG : 1; // Bits 26:26
+ U32 SPARE_CLR_LOG_11 : 1; // Bits 27:27
+ U32 SPARE_CLR_LOG_12 : 1; // Bits 28:28
+ U32 SPARE_CLR_LOG_13 : 1; // Bits 29:29
+ U32 SPARE_CLR_LOG_14 : 1; // Bits 30:30
+ U32 SPARE_CLR_LOG_15 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 PRIPTP : 5; // Bits 4:0
+ U32 : 27; // Bits 31:5
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_PRIP_TURBO_PLCY_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 SECPTP : 5; // Bits 4:0
+ U32 : 27; // Bits 31:5
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_SECP_TURBO_PLCY_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATA : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_PRIP_NRG_STTS_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATA : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_SECP_NRG_STTS_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 PKG_TDP : 15; // Bits 14:0
+ U32 : 1; // Bits 15:15
+ U32 PKG_MIN_PWR : 15; // Bits 30:16
+ U32 : 1; // Bits 31:31
+ U32 PKG_MAX_PWR : 15; // Bits 46:32
+ U32 : 1; // Bits 47:47
+ U32 PKG_MAX_WIN : 7; // Bits 54:48
+ U32 : 9; // Bits 63:55
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} PCU_CR_PACKAGE_POWER_SKU_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 PWR_UNIT : 4; // Bits 3:0
+ U32 : 4; // Bits 7:4
+ U32 ENERGY_UNIT : 5; // Bits 12:8
+ U32 : 3; // Bits 15:13
+ U32 TIME_UNIT : 4; // Bits 19:16
+ U32 : 12; // Bits 31:20
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_PACKAGE_POWER_SKU_UNIT_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATA : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_PACKAGE_ENERGY_STATUS_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATA : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_GT_IO_BUSYNESS_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATA : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_GT_VIDEO_BUSYNESS_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 RP_STATE_VOLTAGE : 8; // Bits 7:0
+ U32 RP_STATE_RATIO : 8; // Bits 15:8
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_GT_PERF_STATUS_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U64 : 50; // Bits 49:0
+ U32 PLATFORMID : 3; // Bits 52:50
+ U32 : 11; // Bits 63:53
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} PCU_CR_PLATFORM_ID_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 : 8; // Bits 7:0
+ U32 MAX_NON_TURBO_LIM_RATIO : 8; // Bits 15:8
+ U32 SMM_SAVE_CAP : 1; // Bits 16:16
+ U32 : 7; // Bits 23:17
+ U32 OCVOLT_OVRD_AVAIL : 1; // Bits 24:24
+ U32 FIVR_RFI_TUNING_AVAIL : 1; // Bits 25:25
+ U32 DCU_16K_MODE_AVAIL : 1; // Bits 26:26
+ U32 SAMPLE_PART : 1; // Bits 27:27
+ U32 PRG_TURBO_RATIO_EN : 1; // Bits 28:28
+ U32 PRG_TDP_LIM_EN : 1; // Bits 29:29
+ U32 PRG_TJ_OFFSET_EN : 1; // Bits 30:30
+ U32 CPUID_FAULTING_EN : 1; // Bits 31:31
+ U32 LPM_SUPPORT : 1; // Bits 32:32
+ U32 CONFIG_TDP_LEVELS : 2; // Bits 34:33
+ U32 PFAT_ENABLE : 1; // Bits 35:35
+ U32 : 1; // Bits 36:36
+ U32 TIMED_MWAIT_ENABLE : 1; // Bits 37:37
+ U32 : 2; // Bits 39:38
+ U32 MAX_EFFICIENCY_RATIO : 8; // Bits 47:40
+ U32 MIN_OPERATING_RATIO : 8; // Bits 55:48
+ U32 : 8; // Bits 63:56
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} PCU_CR_PLATFORM_INFO_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATA : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_PP1_C0_CORE_CLOCK_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATA : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_PP0_ANY_THREAD_ACTIVITY_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATA : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_PP0_EFFICIENT_CYCLES_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATA : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_PP0_THREAD_ACTIVITY_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATA : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_PP1_ANY_THREAD_ACTIVITY_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATA : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_PP1_EFFICIENT_CYCLES_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATA : 8; // Bits 7:0
+ U32 : 24; // Bits 31:8
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_PACKAGE_TEMPERATURE_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATA : 8; // Bits 7:0
+ U32 : 24; // Bits 31:8
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_PP0_TEMPERATURE_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATA : 8; // Bits 7:0
+ U32 : 24; // Bits 31:8
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_PP1_TEMPERATURE_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 TIME_VAL : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_PCU_REFERENCE_CLOCK_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 RESERVED : 1; // Bits 0:0
+ U32 VALID : 1; // Bits 1:1
+ U32 RESERVED_BITS : 4; // Bits 5:2
+ U32 OD : 1; // Bits 6:6
+ U32 IM : 1; // Bits 7:7
+ U32 NEXT_DEVICE_ACTIVITY : 21; // Bits 28:8
+ U32 : 3; // Bits 31:29
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_DEVICE_SHARED_IDLE_DURATION_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 USED : 1; // Bits 0:0
+ U32 VALID : 1; // Bits 1:1
+ U32 RESERVED_BITS : 4; // Bits 5:2
+ U32 OD : 1; // Bits 6:6
+ U32 IM : 1; // Bits 7:7
+ U32 NEXT_DEVICE_ACTIVITY : 21; // Bits 28:8
+ U32 : 3; // Bits 31:29
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_DEVICE_DEDICATED_IDLE_DURATION_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 PSTT_LIM : 8; // Bits 7:0
+ U32 PSTT_MIN : 8; // Bits 15:8
+ U32 : 15; // Bits 30:16
+ U32 LOCK : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_P_STATE_LIMITS_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 RPSTT_LIM : 8; // Bits 7:0
+ U32 : 24; // Bits 31:8
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_RP_STATE_LIMITS_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 RP0_CAP : 8; // Bits 7:0
+ U32 RP1_CAP : 8; // Bits 15:8
+ U32 RPN_CAP : 8; // Bits 23:16
+ U32 : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_RP_STATE_CAP_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 : 8; // Bits 7:0
+ U32 FAN_TEMP_TARGET_OFST : 8; // Bits 15:8
+ U32 REF_TEMP : 8; // Bits 23:16
+ U32 TJ_MAX_TCC_OFFSET : 4; // Bits 27:24
+ U32 : 4; // Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_TEMPERATURE_TARGET_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 PKG_PWR_LIM_1 : 15; // Bits 14:0
+ U32 PKG_PWR_LIM_1_EN : 1; // Bits 15:15
+ U32 PKG_CLMP_LIM_1 : 1; // Bits 16:16
+ U32 PKG_PWR_LIM_1_TIME : 7; // Bits 23:17
+ U32 : 8; // Bits 31:24
+ U32 PKG_PWR_LIM_2 : 15; // Bits 46:32
+ U32 PKG_PWR_LIM_2_EN : 1; // Bits 47:47
+ U32 PKG_CLMP_LIM_2 : 1; // Bits 48:48
+ U32 PKG_PWR_LIM_2_TIME : 7; // Bits 55:49
+ U32 : 7; // Bits 62:56
+ U32 PKG_PWR_LIM_LOCK : 1; // Bits 63:63
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} PCU_CR_PACKAGE_RAPL_LIMIT_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 IA_PP_PWR_LIM : 15; // Bits 14:0
+ U32 PWR_LIM_CTRL_EN : 1; // Bits 15:15
+ U32 PP_CLAMP_LIM : 1; // Bits 16:16
+ U32 CTRL_TIME_WIN : 7; // Bits 23:17
+ U32 : 7; // Bits 30:24
+ U32 PP_PWR_LIM_LOCK : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_PRIP_TURBO_PWR_LIM_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 NON_IA_PP_PWR_LIM : 15; // Bits 14:0
+ U32 PWR_LIM_CTRL_EN : 1; // Bits 15:15
+ U32 PP_CLAMP_LIM : 1; // Bits 16:16
+ U32 CTRL_TIME_WIN : 7; // Bits 23:17
+ U32 : 7; // Bits 30:24
+ U32 SP_PWR_LIM_LOCK : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_SECP_TURBO_PWR_LIM_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 CURRENT_LIMIT : 13; // Bits 12:0
+ U32 : 18; // Bits 30:13
+ U32 LOCK : 1; // Bits 31:31
+ U32 PSI1_THRESHOLD : 10; // Bits 41:32
+ U32 PSI2_THRESHOLD : 10; // Bits 51:42
+ U32 PSI3_THRESHOLD : 10; // Bits 61:52
+ U32 RESERVED : 2; // Bits 63:62
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} PCU_CR_VR_CURRENT_CONFIG_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 MRC_Saving_Rd : 8; // Bits 7:0
+ U32 MRC_Saving_Wt : 8; // Bits 15:8
+ U32 MRC_Saving_Cmd : 8; // Bits 23:16
+ U32 RESERVED : 8; // Bits 31:24
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_MRC_ODT_POWER_SAVING_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 THERMAL_MONITOR_STATUS : 1; // Bits 0:0
+ U32 THERMAL_MONITOR_LOG : 1; // Bits 1:1
+ U32 PROCHOT_STATUS : 1; // Bits 2:2
+ U32 PROCHOT_LOG : 1; // Bits 3:3
+ U32 OUT_OF_SPEC_STATUS : 1; // Bits 4:4
+ U32 OUT_OF_SPEC_LOG : 1; // Bits 5:5
+ U32 THRESHOLD1_STATUS : 1; // Bits 6:6
+ U32 THRESHOLD1_LOG : 1; // Bits 7:7
+ U32 THRESHOLD2_STATUS : 1; // Bits 8:8
+ U32 THRESHOLD2_LOG : 1; // Bits 9:9
+ U32 POWER_LIMITATION_STATUS : 1; // Bits 10:10
+ U32 POWER_LIMITATION_LOG : 1; // Bits 11:11
+ U32 : 4; // Bits 15:12
+ U32 TEMPERATURE : 7; // Bits 22:16
+ U32 : 4; // Bits 26:23
+ U32 RESOLUTION : 4; // Bits 30:27
+ U32 VALID : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_THERM_STATUS_GT_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 HIGH_TEMP_INT_ENABLE : 1; // Bits 0:0
+ U32 LOW_TEMP_INT_ENABLE : 1; // Bits 1:1
+ U32 PROCHOT_INT_ENABLE : 1; // Bits 2:2
+ U32 : 1; // Bits 3:3
+ U32 OUT_OF_SPEC_INT_ENABLE : 1; // Bits 4:4
+ U32 : 3; // Bits 7:5
+ U32 THRESHOLD_1_REL_TEMP : 7; // Bits 14:8
+ U32 THRESHOLD_1_INT_ENABLE : 1; // Bits 15:15
+ U32 THRESHOLD_2_REL_TEMP : 7; // Bits 22:16
+ U32 THRESHOLD_2_INT_ENABLE : 1; // Bits 23:23
+ U32 POWER_INT_ENABLE : 1; // Bits 24:24
+ U32 : 7; // Bits 31:25
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_THERM_INTERRUPT_GT_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 RESERVED : 1; // Bits 0:0
+ U32 VALID : 1; // Bits 1:1
+ U32 RESERVED_BITS : 4; // Bits 5:2
+ U32 OD : 1; // Bits 6:6
+ U32 IM : 1; // Bits 7:7
+ U32 NEXT_DEVICE_ACTIVITY : 21; // Bits 28:8
+ U32 DISABLE_MDID_EVALUATION : 1; // Bits 29:29
+ U32 FORCE_MDID_OVERRIDE : 1; // Bits 30:30
+ U32 : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_DEVICE_IDLE_DURATION_OVERRIDE_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 VALUE : 10; // Bits 9:0
+ U32 MULTIPLIER : 3; // Bits 12:10
+ U32 : 2; // Bits 14:13
+ U32 VALID : 1; // Bits 15:15
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_GRAPHICS_INTERRUPT_RESPONSE_TIME_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 : 4; // Bits 3:0
+ U32 PECI_CMD : 8; // Bits 11:4
+ U32 : 20; // Bits 31:12
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_CHAP_CONFIG_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 FREQ_TH1 : 6; // Bits 5:0
+ U32 : 2; // Bits 7:6
+ U32 FREQ_TH2 : 6; // Bits 13:8
+ U32 : 2; // Bits 15:14
+ U32 FREQ_TH3 : 6; // Bits 21:16
+ U32 : 10; // Bits 31:22
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_CHAP_THRESHOLD2_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 DEBUG_ENERGY_PP0_VALUE : 10; // Bits 9:0
+ U32 DEBUG_ENERGY_PP1_VALUE : 10; // Bits 19:10
+ U32 DEBUG_ENERGY_SA_VALUE : 10; // Bits 29:20
+ U32 : 2; // Bits 31:30
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_ENERGY_DEBUG_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U64 SKPD : 64; // Bits 63:0
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} PCU_CR_SSKPD_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 PPDN_INIT : 12; // Bits 11:0
+ U32 : 20; // Bits 31:12
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_C2C3TT_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 DDR_TIMER_VALUE : 13; // Bits 12:0
+ U32 : 19; // Bits 31:13
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_C2_DDR_TT_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 NSTL : 10; // Bits 9:0
+ U32 MULTIPLIER : 3; // Bits 12:10
+ U32 : 1; // Bits 13:13
+ U32 FORCE_NL : 1; // Bits 14:14
+ U32 NL_V : 1; // Bits 15:15
+ U32 SXL : 10; // Bits 25:16
+ U32 SXLM : 3; // Bits 28:26
+ U32 : 1; // Bits 29:29
+ U32 FORCE_SXL : 1; // Bits 30:30
+ U32 SXL_V : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_PCIE_ILTR_OVRD_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 NL_VALUE : 10; // Bits 9:0
+ U32 NL_SCALE : 3; // Bits 12:10
+ U32 NL_RESERVED : 2; // Bits 14:13
+ U32 NL_VALID : 1; // Bits 15:15
+ U32 SXL_VALUE : 10; // Bits 25:16
+ U32 SXL_SCALE : 3; // Bits 28:26
+ U32 SXL_RESERVED : 2; // Bits 30:29
+ U32 SXL_VALID : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_PCIE_ILTR_VAL_PCU_0_STRUCT;
+
+typedef union {
+ struct {
+ U32 NL_VALUE : 10; // Bits 9:0
+ U32 NL_SCALE : 3; // Bits 12:10
+ U32 NL_RESERVED : 2; // Bits 14:13
+ U32 NL_VALID : 1; // Bits 15:15
+ U32 SXL_VALUE : 10; // Bits 25:16
+ U32 SXL_SCALE : 3; // Bits 28:26
+ U32 SXL_RESERVED : 2; // Bits 30:29
+ U32 SXL_VALID : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_PCIE_ILTR_VAL_PCU_1_STRUCT;
+
+typedef union {
+ struct {
+ U32 NL_VALUE : 10; // Bits 9:0
+ U32 NL_SCALE : 3; // Bits 12:10
+ U32 NL_RESERVED : 2; // Bits 14:13
+ U32 NL_VALID : 1; // Bits 15:15
+ U32 SXL_VALUE : 10; // Bits 25:16
+ U32 SXL_SCALE : 3; // Bits 28:26
+ U32 SXL_RESERVED : 2; // Bits 30:29
+ U32 SXL_VALID : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_PCIE_ILTR_VAL_PCU_2_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATA : 18; // Bits 17:0
+ U32 : 13; // Bits 30:18
+ U32 VORANGE : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_VISA_CTL_PTPCFSMS_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATA : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_VISA_XBAR_PTPCFSMS_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATA : 18; // Bits 17:0
+ U32 : 13; // Bits 30:18
+ U32 VORANGE : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_VISA_CTL_PTPCIOREGS_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATA : 32; // Bits 31:0
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_BIOS_MAILBOX_DATA_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 COMMAND : 8; // Bits 7:0
+ U32 ADDR : 21; // Bits 28:8
+ U32 : 2; // Bits 30:29
+ U32 RUN_BUSY : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_BIOS_MAILBOX_INTERFACE_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 RST_CPL : 1; // Bits 0:0
+ U32 PCIE_ENUMERATION_DONE : 1; // Bits 1:1
+ U32 C7_ALLOWED : 1; // Bits 2:2
+ U32 : 29; // Bits 31:3
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_BIOS_RESET_CPL_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 REQ_DATA : 4; // Bits 3:0
+ U32 REQ_TYPE : 4; // Bits 7:4
+ U32 : 23; // Bits 30:8
+ U32 RUN_BUSY : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_MC_BIOS_REQ_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 MC_FREQ : 4; // Bits 3:0
+ U32 : 28; // Bits 31:4
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_MC_BIOS_DATA_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 SACG_ENA : 1; // Bits 0:0
+ U32 MPLL_OFF_ENA : 1; // Bits 1:1
+ U32 PPLL_OFF_ENA : 1; // Bits 2:2
+ U32 : 5; // Bits 7:3
+ U32 SACG_SEN : 1; // Bits 8:8
+ U32 MPLL_OFF_SEN : 1; // Bits 9:9
+ U32 MDLL_OFF_SEN : 1; // Bits 10:10
+ U32 SACG_SREXIT : 1; // Bits 11:11
+ U32 NSWAKE_SREXIT : 1; // Bits 12:12
+ U32 SACG_MPLL : 1; // Bits 13:13
+ U32 MPLL_ON_DE : 1; // Bits 14:14
+ U32 MDLL_ON_DE : 1; // Bits 15:15
+ U32 : 16; // Bits 31:16
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_SAPMCTL_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 COMP_DISABLE : 1; // Bits 0:0
+ U32 COMP_INTERVAL : 4; // Bits 4:1
+ U32 : 3; // Bits 7:5
+ U32 COMP_FORCE : 1; // Bits 8:8
+ U32 : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_P_COMP_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 COMP_DISABLE : 1; // Bits 0:0
+ U32 COMP_INTERVAL : 4; // Bits 4:1
+ U32 : 3; // Bits 7:5
+ U32 COMP_FORCE : 1; // Bits 8:8
+ U32 : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_M_COMP_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 COMP_DISABLE : 1; // Bits 0:0
+ U32 COMP_INTERVAL : 4; // Bits 4:1
+ U32 : 3; // Bits 7:5
+ U32 COMP_FORCE : 1; // Bits 8:8
+ U32 : 23; // Bits 31:9
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_D_COMP_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 TDP_RATIO : 8; // Bits 7:0
+ U32 : 24; // Bits 31:8
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_CONFIG_TDP_NOMINAL_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 PKG_TDP : 15; // Bits 14:0
+ U32 : 1; // Bits 15:15
+ U32 TDP_RATIO : 8; // Bits 23:16
+ U32 : 8; // Bits 31:24
+ U32 PKG_MAX_PWR : 15; // Bits 46:32
+ U32 PKG_MIN_PWR : 16; // Bits 62:47
+ U32 : 1; // Bits 63:63
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} PCU_CR_CONFIG_TDP_LEVEL1_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 PKG_TDP : 15; // Bits 14:0
+ U32 : 1; // Bits 15:15
+ U32 TDP_RATIO : 8; // Bits 23:16
+ U32 : 8; // Bits 31:24
+ U32 PKG_MAX_PWR : 15; // Bits 46:32
+ U32 PKG_MIN_PWR : 16; // Bits 62:47
+ U32 : 1; // Bits 63:63
+ } Bits;
+ U64 Data;
+ U32 Data32[2];
+ U16 Data16[4];
+ U8 Data8[8];
+} PCU_CR_CONFIG_TDP_LEVEL2_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 TDP_LEVEL : 2; // Bits 1:0
+ U32 : 29; // Bits 30:2
+ U32 CONFIG_TDP_LOCK : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_CONFIG_TDP_CONTROL_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 MAX_NON_TURBO_RATIO : 8; // Bits 7:0
+ U32 : 23; // Bits 30:8
+ U32 TURBO_ACTIVATION_RATIO_LOCK : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PCU_CR_TURBO_ACTIVATION_RATIO_PCU_STRUCT;
+
+typedef union {
+ struct {
+ U32 DATA : 18; // Bits 17:0
+ U32 : 13; // Bits 30:18
+ U32 VORANGE : 1; // Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} DRNG_CR_VISA_CTL_DRNGCTLS_DRNG_STRUCT;
+
+#define NCDECS_CR_GFXVTBAR_NCU_REG (0x00005400)
+ #define NCDECS_CR_GFXVTBAR_NCU_GFXVTBAREN_OFF ( 0)
+ #define NCDECS_CR_GFXVTBAR_NCU_GFXVTBAREN_WID ( 1)
+ #define NCDECS_CR_GFXVTBAR_NCU_GFXVTBAREN_MSK (0x00000001)
+ #define NCDECS_CR_GFXVTBAR_NCU_GFXVTBAREN_MAX (0x00000001)
+ #define NCDECS_CR_GFXVTBAR_NCU_GFXVTBAREN_DEF (0x00000000)
+ #define NCDECS_CR_GFXVTBAR_NCU_GFXVTBAR_OFF (12)
+ #define NCDECS_CR_GFXVTBAR_NCU_GFXVTBAR_WID (27)
+ #define NCDECS_CR_GFXVTBAR_NCU_GFXVTBAR_MSK (0x7FFFFFF000)
+ #define NCDECS_CR_GFXVTBAR_NCU_GFXVTBAR_MAX (0x07FFFFFF)
+ #define NCDECS_CR_GFXVTBAR_NCU_GFXVTBAR_DEF (0x00000000)
+
+#define NCDECS_CR_EDRAMBAR_NCU_REG (0x00005408)
+ #define NCDECS_CR_EDRAMBAR_NCU_EDRAMBAREN_OFF ( 0)
+ #define NCDECS_CR_EDRAMBAR_NCU_EDRAMBAREN_WID ( 1)
+ #define NCDECS_CR_EDRAMBAR_NCU_EDRAMBAREN_MSK (0x00000001)
+ #define NCDECS_CR_EDRAMBAR_NCU_EDRAMBAREN_MAX (0x00000001)
+ #define NCDECS_CR_EDRAMBAR_NCU_EDRAMBAREN_DEF (0x00000000)
+ #define NCDECS_CR_EDRAMBAR_NCU_EDRAMBAR_OFF (14)
+ #define NCDECS_CR_EDRAMBAR_NCU_EDRAMBAR_WID (25)
+ #define NCDECS_CR_EDRAMBAR_NCU_EDRAMBAR_MSK (0x7FFFFFC000)
+ #define NCDECS_CR_EDRAMBAR_NCU_EDRAMBAR_MAX (0x01FFFFFF)
+ #define NCDECS_CR_EDRAMBAR_NCU_EDRAMBAR_DEF (0x00000000)
+
+#define NCDECS_CR_VTDPVC0BAR_NCU_REG (0x00005410)
+ #define NCDECS_CR_VTDPVC0BAR_NCU_VTVC0BAREN_OFF ( 0)
+ #define NCDECS_CR_VTDPVC0BAR_NCU_VTVC0BAREN_WID ( 1)
+ #define NCDECS_CR_VTDPVC0BAR_NCU_VTVC0BAREN_MSK (0x00000001)
+ #define NCDECS_CR_VTDPVC0BAR_NCU_VTVC0BAREN_MAX (0x00000001)
+ #define NCDECS_CR_VTDPVC0BAR_NCU_VTVC0BAREN_DEF (0x00000000)
+ #define NCDECS_CR_VTDPVC0BAR_NCU_VTVC0BAR_OFF (12)
+ #define NCDECS_CR_VTDPVC0BAR_NCU_VTVC0BAR_WID (27)
+ #define NCDECS_CR_VTDPVC0BAR_NCU_VTVC0BAR_MSK (0x7FFFFFF000)
+ #define NCDECS_CR_VTDPVC0BAR_NCU_VTVC0BAR_MAX (0x07FFFFFF)
+ #define NCDECS_CR_VTDPVC0BAR_NCU_VTVC0BAR_DEF (0x00000000)
+
+#define NCDECS_CR_INTRDIRCTL_NCU_REG (0x00005418)
+ #define NCDECS_CR_INTRDIRCTL_NCU_RdrModSel_OFF ( 0)
+ #define NCDECS_CR_INTRDIRCTL_NCU_RdrModSel_WID ( 3)
+ #define NCDECS_CR_INTRDIRCTL_NCU_RdrModSel_MSK (0x00000007)
+ #define NCDECS_CR_INTRDIRCTL_NCU_RdrModSel_MAX (0x00000007)
+ #define NCDECS_CR_INTRDIRCTL_NCU_RdrModSel_DEF (0x00000000)
+ #define NCDECS_CR_INTRDIRCTL_NCU_ClastChkSmpMod_OFF ( 3)
+ #define NCDECS_CR_INTRDIRCTL_NCU_ClastChkSmpMod_WID ( 1)
+ #define NCDECS_CR_INTRDIRCTL_NCU_ClastChkSmpMod_MSK (0x00000008)
+ #define NCDECS_CR_INTRDIRCTL_NCU_ClastChkSmpMod_MAX (0x00000001)
+ #define NCDECS_CR_INTRDIRCTL_NCU_ClastChkSmpMod_DEF (0x00000000)
+ #define NCDECS_CR_INTRDIRCTL_NCU_LogFltClustMod_OFF ( 4)
+ #define NCDECS_CR_INTRDIRCTL_NCU_LogFltClustMod_WID ( 1)
+ #define NCDECS_CR_INTRDIRCTL_NCU_LogFltClustMod_MSK (0x00000010)
+ #define NCDECS_CR_INTRDIRCTL_NCU_LogFltClustMod_MAX (0x00000001)
+ #define NCDECS_CR_INTRDIRCTL_NCU_LogFltClustMod_DEF (0x00000000)
+ #define NCDECS_CR_INTRDIRCTL_NCU_LogFlatClustOvrEn_OFF ( 5)
+ #define NCDECS_CR_INTRDIRCTL_NCU_LogFlatClustOvrEn_WID ( 1)
+ #define NCDECS_CR_INTRDIRCTL_NCU_LogFlatClustOvrEn_MSK (0x00000020)
+ #define NCDECS_CR_INTRDIRCTL_NCU_LogFlatClustOvrEn_MAX (0x00000001)
+ #define NCDECS_CR_INTRDIRCTL_NCU_LogFlatClustOvrEn_DEF (0x00000000)
+ #define NCDECS_CR_INTRDIRCTL_NCU_HashModCtr_OFF ( 6)
+ #define NCDECS_CR_INTRDIRCTL_NCU_HashModCtr_WID ( 3)
+ #define NCDECS_CR_INTRDIRCTL_NCU_HashModCtr_MSK (0x000001C0)
+ #define NCDECS_CR_INTRDIRCTL_NCU_HashModCtr_MAX (0x00000007)
+ #define NCDECS_CR_INTRDIRCTL_NCU_HashModCtr_DEF (0x00000000)
+
+#define NCDECS_CR_NCUCTL0_NCU_REG (0x0000541C)
+ #define NCDECS_CR_NCUCTL0_NCU_PLIM_OFF (28)
+ #define NCDECS_CR_NCUCTL0_NCU_PLIM_WID ( 3)
+ #define NCDECS_CR_NCUCTL0_NCU_PLIM_MSK (0x70000000)
+ #define NCDECS_CR_NCUCTL0_NCU_PLIM_MAX (0x00000007)
+ #define NCDECS_CR_NCUCTL0_NCU_PLIM_DEF (0x00000003)
+
+#define NCDECS_CR_GDXCBAR_NCU_REG (0x00005420)
+ #define NCDECS_CR_GDXCBAR_NCU_GDXCBAREN_OFF ( 0)
+ #define NCDECS_CR_GDXCBAR_NCU_GDXCBAREN_WID ( 1)
+ #define NCDECS_CR_GDXCBAR_NCU_GDXCBAREN_MSK (0x00000001)
+ #define NCDECS_CR_GDXCBAR_NCU_GDXCBAREN_MAX (0x00000001)
+ #define NCDECS_CR_GDXCBAR_NCU_GDXCBAREN_DEF (0x00000000)
+ #define NCDECS_CR_GDXCBAR_NCU_GDXCBAR_OFF (12)
+ #define NCDECS_CR_GDXCBAR_NCU_GDXCBAR_WID (27)
+ #define NCDECS_CR_GDXCBAR_NCU_GDXCBAR_MSK (0x7FFFFFF000)
+ #define NCDECS_CR_GDXCBAR_NCU_GDXCBAR_MAX (0x07FFFFFF)
+ #define NCDECS_CR_GDXCBAR_NCU_GDXCBAR_DEF (0x00000000)
+
+#define NCDECS_CR_SCRATCHPAD_NCU_0_REG (0x00005428)
+ #define NCDECS_CR_SCRATCHPAD_NCU_0_Data_OFF ( 0)
+ #define NCDECS_CR_SCRATCHPAD_NCU_0_Data_WID (32)
+ #define NCDECS_CR_SCRATCHPAD_NCU_0_Data_MSK (0xFFFFFFFF)
+ #define NCDECS_CR_SCRATCHPAD_NCU_0_Data_MAX (0xFFFFFFFF)
+ #define NCDECS_CR_SCRATCHPAD_NCU_0_Data_DEF (0x00000000)
+
+#define NCDECS_CR_SCRATCHPAD_NCU_1_REG (0x0000542C)
+ #define NCDECS_CR_SCRATCHPAD_NCU_1_Data_OFF ( 0)
+ #define NCDECS_CR_SCRATCHPAD_NCU_1_Data_WID (32)
+ #define NCDECS_CR_SCRATCHPAD_NCU_1_Data_MSK (0xFFFFFFFF)
+ #define NCDECS_CR_SCRATCHPAD_NCU_1_Data_MAX (0xFFFFFFFF)
+ #define NCDECS_CR_SCRATCHPAD_NCU_1_Data_DEF (0x00000000)
+
+#define NCDECS_CR_SCRATCHPAD_NCU_2_REG (0x00005430)
+ #define NCDECS_CR_SCRATCHPAD_NCU_2_Data_OFF ( 0)
+ #define NCDECS_CR_SCRATCHPAD_NCU_2_Data_WID (32)
+ #define NCDECS_CR_SCRATCHPAD_NCU_2_Data_MSK (0xFFFFFFFF)
+ #define NCDECS_CR_SCRATCHPAD_NCU_2_Data_MAX (0xFFFFFFFF)
+ #define NCDECS_CR_SCRATCHPAD_NCU_2_Data_DEF (0x00000000)
+
+#define NCDECS_CR_SCRATCHPAD_NCU_3_REG (0x00005434)
+ #define NCDECS_CR_SCRATCHPAD_NCU_3_Data_OFF ( 0)
+ #define NCDECS_CR_SCRATCHPAD_NCU_3_Data_WID (32)
+ #define NCDECS_CR_SCRATCHPAD_NCU_3_Data_MSK (0xFFFFFFFF)
+ #define NCDECS_CR_SCRATCHPAD_NCU_3_Data_MAX (0xFFFFFFFF)
+ #define NCDECS_CR_SCRATCHPAD_NCU_3_Data_DEF (0x00000000)
+
+#define NCDECS_CR_PAVPMSGOFFST_NCU_REG (0x00005500)
+ #define NCDECS_CR_PAVPMSGOFFST_NCU_LOCK_OFF ( 0)
+ #define NCDECS_CR_PAVPMSGOFFST_NCU_LOCK_WID ( 1)
+ #define NCDECS_CR_PAVPMSGOFFST_NCU_LOCK_MSK (0x00000001)
+ #define NCDECS_CR_PAVPMSGOFFST_NCU_LOCK_MAX (0x00000001)
+ #define NCDECS_CR_PAVPMSGOFFST_NCU_LOCK_DEF (0x00000000)
+ #define NCDECS_CR_PAVPMSGOFFST_NCU_OFFSET_OFF (20)
+ #define NCDECS_CR_PAVPMSGOFFST_NCU_OFFSET_WID (12)
+ #define NCDECS_CR_PAVPMSGOFFST_NCU_OFFSET_MSK (0xFFF00000)
+ #define NCDECS_CR_PAVPMSGOFFST_NCU_OFFSET_MAX (0x00000FFF)
+ #define NCDECS_CR_PAVPMSGOFFST_NCU_OFFSET_DEF (0x00000000)
+
+#define MPVTDTRK_CR_VTDLIM_IMPH_REG (0x00006000)
+ #define MPVTDTRK_CR_VTDLIM_IMPH_VCPVTDLIM_OFF ( 0)
+ #define MPVTDTRK_CR_VTDLIM_IMPH_VCPVTDLIM_WID ( 3)
+ #define MPVTDTRK_CR_VTDLIM_IMPH_VCPVTDLIM_MSK (0x00000007)
+ #define MPVTDTRK_CR_VTDLIM_IMPH_VCPVTDLIM_MAX (0x00000007)
+ #define MPVTDTRK_CR_VTDLIM_IMPH_VCPVTDLIM_DEF (0x00000004)
+
+#define MPVTDTRK_CR_HDAUDRID_IMPH_REG (0x00006008)
+ #define MPVTDTRK_CR_HDAUDRID_IMPH_DEVNUM_OFF ( 3)
+ #define MPVTDTRK_CR_HDAUDRID_IMPH_DEVNUM_WID ( 5)
+ #define MPVTDTRK_CR_HDAUDRID_IMPH_DEVNUM_MSK (0x000000F8)
+ #define MPVTDTRK_CR_HDAUDRID_IMPH_DEVNUM_MAX (0x0000001F)
+ #define MPVTDTRK_CR_HDAUDRID_IMPH_DEVNUM_DEF (0x0000001B)
+ #define MPVTDTRK_CR_HDAUDRID_IMPH_BUSNUM_OFF ( 8)
+ #define MPVTDTRK_CR_HDAUDRID_IMPH_BUSNUM_WID ( 8)
+ #define MPVTDTRK_CR_HDAUDRID_IMPH_BUSNUM_MSK (0x0000FF00)
+ #define MPVTDTRK_CR_HDAUDRID_IMPH_BUSNUM_MAX (0x000000FF)
+ #define MPVTDTRK_CR_HDAUDRID_IMPH_BUSNUM_DEF (0x00000000)
+ #define MPVTDTRK_CR_HDAUDRID_IMPH_HDAUD_EN_OFF (31)
+ #define MPVTDTRK_CR_HDAUDRID_IMPH_HDAUD_EN_WID ( 1)
+ #define MPVTDTRK_CR_HDAUDRID_IMPH_HDAUD_EN_MSK (0x80000000)
+ #define MPVTDTRK_CR_HDAUDRID_IMPH_HDAUD_EN_MAX (0x00000001)
+ #define MPVTDTRK_CR_HDAUDRID_IMPH_HDAUD_EN_DEF (0x00000001)
+
+#define MPVTDTRK_CR_UMAGFXBASE_IMPH_REG (0x00006010)
+ #define MPVTDTRK_CR_UMAGFXBASE_IMPH_UMAB_OFF (20)
+ #define MPVTDTRK_CR_UMAGFXBASE_IMPH_UMAB_WID (19)
+ #define MPVTDTRK_CR_UMAGFXBASE_IMPH_UMAB_MSK (0x7FFFF00000)
+ #define MPVTDTRK_CR_UMAGFXBASE_IMPH_UMAB_MAX (0x0007FFFF)
+ #define MPVTDTRK_CR_UMAGFXBASE_IMPH_UMAB_DEF (0x0007FFFF)
+
+#define MPVTDTRK_CR_UMAGFXLIMIT_IMPH_REG (0x00006018)
+ #define MPVTDTRK_CR_UMAGFXLIMIT_IMPH_UMAL_OFF (20)
+ #define MPVTDTRK_CR_UMAGFXLIMIT_IMPH_UMAL_WID (19)
+ #define MPVTDTRK_CR_UMAGFXLIMIT_IMPH_UMAL_MSK (0x7FFFF00000)
+ #define MPVTDTRK_CR_UMAGFXLIMIT_IMPH_UMAL_MAX (0x0007FFFF)
+ #define MPVTDTRK_CR_UMAGFXLIMIT_IMPH_UMAL_DEF (0x00000000)
+
+#define MPVTDTRK_CR_UMAGFXCTL_IMPH_REG (0x00006020)
+ #define MPVTDTRK_CR_UMAGFXCTL_IMPH_LCK_OFF ( 0)
+ #define MPVTDTRK_CR_UMAGFXCTL_IMPH_LCK_WID ( 1)
+ #define MPVTDTRK_CR_UMAGFXCTL_IMPH_LCK_MSK (0x00000001)
+ #define MPVTDTRK_CR_UMAGFXCTL_IMPH_LCK_MAX (0x00000001)
+ #define MPVTDTRK_CR_UMAGFXCTL_IMPH_LCK_DEF (0x00000000)
+ #define MPVTDTRK_CR_UMAGFXCTL_IMPH_PEG10EN_OFF (10)
+ #define MPVTDTRK_CR_UMAGFXCTL_IMPH_PEG10EN_WID ( 1)
+ #define MPVTDTRK_CR_UMAGFXCTL_IMPH_PEG10EN_MSK (0x00000400)
+ #define MPVTDTRK_CR_UMAGFXCTL_IMPH_PEG10EN_MAX (0x00000001)
+ #define MPVTDTRK_CR_UMAGFXCTL_IMPH_PEG10EN_DEF (0x00000000)
+ #define MPVTDTRK_CR_UMAGFXCTL_IMPH_PEG11EN_OFF (11)
+ #define MPVTDTRK_CR_UMAGFXCTL_IMPH_PEG11EN_WID ( 1)
+ #define MPVTDTRK_CR_UMAGFXCTL_IMPH_PEG11EN_MSK (0x00000800)
+ #define MPVTDTRK_CR_UMAGFXCTL_IMPH_PEG11EN_MAX (0x00000001)
+ #define MPVTDTRK_CR_UMAGFXCTL_IMPH_PEG11EN_DEF (0x00000000)
+ #define MPVTDTRK_CR_UMAGFXCTL_IMPH_PEG12EN_OFF (12)
+ #define MPVTDTRK_CR_UMAGFXCTL_IMPH_PEG12EN_WID ( 1)
+ #define MPVTDTRK_CR_UMAGFXCTL_IMPH_PEG12EN_MSK (0x00001000)
+ #define MPVTDTRK_CR_UMAGFXCTL_IMPH_PEG12EN_MAX (0x00000001)
+ #define MPVTDTRK_CR_UMAGFXCTL_IMPH_PEG12EN_DEF (0x00000000)
+ #define MPVTDTRK_CR_UMAGFXCTL_IMPH_DMIEN_OFF (13)
+ #define MPVTDTRK_CR_UMAGFXCTL_IMPH_DMIEN_WID ( 1)
+ #define MPVTDTRK_CR_UMAGFXCTL_IMPH_DMIEN_MSK (0x00002000)
+ #define MPVTDTRK_CR_UMAGFXCTL_IMPH_DMIEN_MAX (0x00000001)
+ #define MPVTDTRK_CR_UMAGFXCTL_IMPH_DMIEN_DEF (0x00000000)
+
+#define MPVTDTRK_CR_VDMBDFBARKVM_IMPH_REG (0x00006030)
+ #define MPVTDTRK_CR_VDMBDFBARKVM_IMPH_FUNNUM_OFF ( 0)
+ #define MPVTDTRK_CR_VDMBDFBARKVM_IMPH_FUNNUM_WID ( 3)
+ #define MPVTDTRK_CR_VDMBDFBARKVM_IMPH_FUNNUM_MSK (0x00000007)
+ #define MPVTDTRK_CR_VDMBDFBARKVM_IMPH_FUNNUM_MAX (0x00000007)
+ #define MPVTDTRK_CR_VDMBDFBARKVM_IMPH_FUNNUM_DEF (0x00000000)
+ #define MPVTDTRK_CR_VDMBDFBARKVM_IMPH_DEVNUM_OFF ( 3)
+ #define MPVTDTRK_CR_VDMBDFBARKVM_IMPH_DEVNUM_WID ( 5)
+ #define MPVTDTRK_CR_VDMBDFBARKVM_IMPH_DEVNUM_MSK (0x000000F8)
+ #define MPVTDTRK_CR_VDMBDFBARKVM_IMPH_DEVNUM_MAX (0x0000001F)
+ #define MPVTDTRK_CR_VDMBDFBARKVM_IMPH_DEVNUM_DEF (0x00000016)
+ #define MPVTDTRK_CR_VDMBDFBARKVM_IMPH_BUSNUM_OFF ( 8)
+ #define MPVTDTRK_CR_VDMBDFBARKVM_IMPH_BUSNUM_WID ( 8)
+ #define MPVTDTRK_CR_VDMBDFBARKVM_IMPH_BUSNUM_MSK (0x0000FF00)
+ #define MPVTDTRK_CR_VDMBDFBARKVM_IMPH_BUSNUM_MAX (0x000000FF)
+ #define MPVTDTRK_CR_VDMBDFBARKVM_IMPH_BUSNUM_DEF (0x00000000)
+ #define MPVTDTRK_CR_VDMBDFBARKVM_IMPH_BARNUM_OFF (16)
+ #define MPVTDTRK_CR_VDMBDFBARKVM_IMPH_BARNUM_WID ( 3)
+ #define MPVTDTRK_CR_VDMBDFBARKVM_IMPH_BARNUM_MSK (0x00070000)
+ #define MPVTDTRK_CR_VDMBDFBARKVM_IMPH_BARNUM_MAX (0x00000007)
+ #define MPVTDTRK_CR_VDMBDFBARKVM_IMPH_BARNUM_DEF (0x00000007)
+
+#define MPVTDTRK_CR_VDMBDFBARPAVP_IMPH_REG (0x00006034)
+ #define MPVTDTRK_CR_VDMBDFBARPAVP_IMPH_FUNNUM_OFF ( 0)
+ #define MPVTDTRK_CR_VDMBDFBARPAVP_IMPH_FUNNUM_WID ( 3)
+ #define MPVTDTRK_CR_VDMBDFBARPAVP_IMPH_FUNNUM_MSK (0x00000007)
+ #define MPVTDTRK_CR_VDMBDFBARPAVP_IMPH_FUNNUM_MAX (0x00000007)
+ #define MPVTDTRK_CR_VDMBDFBARPAVP_IMPH_FUNNUM_DEF (0x00000000)
+ #define MPVTDTRK_CR_VDMBDFBARPAVP_IMPH_DEVNUM_OFF ( 3)
+ #define MPVTDTRK_CR_VDMBDFBARPAVP_IMPH_DEVNUM_WID ( 5)
+ #define MPVTDTRK_CR_VDMBDFBARPAVP_IMPH_DEVNUM_MSK (0x000000F8)
+ #define MPVTDTRK_CR_VDMBDFBARPAVP_IMPH_DEVNUM_MAX (0x0000001F)
+ #define MPVTDTRK_CR_VDMBDFBARPAVP_IMPH_DEVNUM_DEF (0x00000016)
+ #define MPVTDTRK_CR_VDMBDFBARPAVP_IMPH_BUSNUM_OFF ( 8)
+ #define MPVTDTRK_CR_VDMBDFBARPAVP_IMPH_BUSNUM_WID ( 8)
+ #define MPVTDTRK_CR_VDMBDFBARPAVP_IMPH_BUSNUM_MSK (0x0000FF00)
+ #define MPVTDTRK_CR_VDMBDFBARPAVP_IMPH_BUSNUM_MAX (0x000000FF)
+ #define MPVTDTRK_CR_VDMBDFBARPAVP_IMPH_BUSNUM_DEF (0x00000000)
+ #define MPVTDTRK_CR_VDMBDFBARPAVP_IMPH_BARNUM_OFF (16)
+ #define MPVTDTRK_CR_VDMBDFBARPAVP_IMPH_BARNUM_WID ( 3)
+ #define MPVTDTRK_CR_VDMBDFBARPAVP_IMPH_BARNUM_MSK (0x00070000)
+ #define MPVTDTRK_CR_VDMBDFBARPAVP_IMPH_BARNUM_MAX (0x00000007)
+ #define MPVTDTRK_CR_VDMBDFBARPAVP_IMPH_BARNUM_DEF (0x00000007)
+
+#define MPVTDTRK_CR_VISA_CTL_MPVTDTLBS_IMPH_REG (0x00006040)
+ #define MPVTDTRK_CR_VISA_CTL_MPVTDTLBS_IMPH_DATA_OFF ( 0)
+ #define MPVTDTRK_CR_VISA_CTL_MPVTDTLBS_IMPH_DATA_WID (18)
+ #define MPVTDTRK_CR_VISA_CTL_MPVTDTLBS_IMPH_DATA_MSK (0x0003FFFF)
+ #define MPVTDTRK_CR_VISA_CTL_MPVTDTLBS_IMPH_DATA_MAX (0x0003FFFF)
+ #define MPVTDTRK_CR_VISA_CTL_MPVTDTLBS_IMPH_DATA_DEF (0x00000000)
+ #define MPVTDTRK_CR_VISA_CTL_MPVTDTLBS_IMPH_VORANGE_OFF (31)
+ #define MPVTDTRK_CR_VISA_CTL_MPVTDTLBS_IMPH_VORANGE_WID ( 1)
+ #define MPVTDTRK_CR_VISA_CTL_MPVTDTLBS_IMPH_VORANGE_MSK (0x80000000)
+ #define MPVTDTRK_CR_VISA_CTL_MPVTDTLBS_IMPH_VORANGE_MAX (0x00000001)
+ #define MPVTDTRK_CR_VISA_CTL_MPVTDTLBS_IMPH_VORANGE_DEF (0x00000000)
+
+#define MPVTDTRK_CR_VISA_XBAR_MPVTDTLBS_IMPH_REG (0x00006044)
+ #define MPVTDTRK_CR_VISA_XBAR_MPVTDTLBS_IMPH_DATA_OFF ( 0)
+ #define MPVTDTRK_CR_VISA_XBAR_MPVTDTLBS_IMPH_DATA_WID (32)
+ #define MPVTDTRK_CR_VISA_XBAR_MPVTDTLBS_IMPH_DATA_MSK (0xFFFFFFFF)
+ #define MPVTDTRK_CR_VISA_XBAR_MPVTDTLBS_IMPH_DATA_MAX (0xFFFFFFFF)
+ #define MPVTDTRK_CR_VISA_XBAR_MPVTDTLBS_IMPH_DATA_DEF (0x76543210)
+
+#define MPVTDTRK_CR_VISA_CTL_MPVTMISCS_IMPH_REG (0x00006048)
+ #define MPVTDTRK_CR_VISA_CTL_MPVTMISCS_IMPH_DATA_OFF ( 0)
+ #define MPVTDTRK_CR_VISA_CTL_MPVTMISCS_IMPH_DATA_WID (18)
+ #define MPVTDTRK_CR_VISA_CTL_MPVTMISCS_IMPH_DATA_MSK (0x0003FFFF)
+ #define MPVTDTRK_CR_VISA_CTL_MPVTMISCS_IMPH_DATA_MAX (0x0003FFFF)
+ #define MPVTDTRK_CR_VISA_CTL_MPVTMISCS_IMPH_DATA_DEF (0x00000000)
+ #define MPVTDTRK_CR_VISA_CTL_MPVTMISCS_IMPH_VORANGE_OFF (31)
+ #define MPVTDTRK_CR_VISA_CTL_MPVTMISCS_IMPH_VORANGE_WID ( 1)
+ #define MPVTDTRK_CR_VISA_CTL_MPVTMISCS_IMPH_VORANGE_MSK (0x80000000)
+ #define MPVTDTRK_CR_VISA_CTL_MPVTMISCS_IMPH_VORANGE_MAX (0x00000001)
+ #define MPVTDTRK_CR_VISA_CTL_MPVTMISCS_IMPH_VORANGE_DEF (0x00000000)
+
+#define MPVTDTRK_CR_VISA_CTL_MPVTTRKS_IMPH_REG (0x0000604C)
+ #define MPVTDTRK_CR_VISA_CTL_MPVTTRKS_IMPH_DATA_OFF ( 0)
+ #define MPVTDTRK_CR_VISA_CTL_MPVTTRKS_IMPH_DATA_WID (18)
+ #define MPVTDTRK_CR_VISA_CTL_MPVTTRKS_IMPH_DATA_MSK (0x0003FFFF)
+ #define MPVTDTRK_CR_VISA_CTL_MPVTTRKS_IMPH_DATA_MAX (0x0003FFFF)
+ #define MPVTDTRK_CR_VISA_CTL_MPVTTRKS_IMPH_DATA_DEF (0x00000000)
+ #define MPVTDTRK_CR_VISA_CTL_MPVTTRKS_IMPH_VORANGE_OFF (31)
+ #define MPVTDTRK_CR_VISA_CTL_MPVTTRKS_IMPH_VORANGE_WID ( 1)
+ #define MPVTDTRK_CR_VISA_CTL_MPVTTRKS_IMPH_VORANGE_MSK (0x80000000)
+ #define MPVTDTRK_CR_VISA_CTL_MPVTTRKS_IMPH_VORANGE_MAX (0x00000001)
+ #define MPVTDTRK_CR_VISA_CTL_MPVTTRKS_IMPH_VORANGE_DEF (0x00000000)
+
+#define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_REG (0x00006050)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_VC_OFF ( 0)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_VC_WID ( 4)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_VC_MSK (0x0000000F)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_VC_MAX (0x0000000F)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_VC_DEF (0x00000000)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_FMT_CMDTYPE_OFF ( 4)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_FMT_CMDTYPE_WID ( 6)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_FMT_CMDTYPE_MSK (0x000003F0)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_FMT_CMDTYPE_MAX (0x0000003F)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_FMT_CMDTYPE_DEF (0x00000000)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_TC_OFF (10)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_TC_WID ( 4)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_TC_MSK (0x00003C00)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_TC_MAX (0x0000000F)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_TC_DEF (0x00000000)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_CHAIN_OFF (14)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_CHAIN_WID ( 1)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_CHAIN_MSK (0x00004000)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_CHAIN_MAX (0x00000001)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_CHAIN_DEF (0x00000000)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_NS_OFF (15)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_NS_WID ( 1)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_NS_MSK (0x00008000)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_NS_MAX (0x00000001)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_NS_DEF (0x00000000)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_RO_OFF (16)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_RO_WID ( 1)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_RO_MSK (0x00010000)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_RO_MAX (0x00000001)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_RO_DEF (0x00000000)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_LENGTH_OFF (17)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_LENGTH_WID ( 5)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_LENGTH_MSK (0x003E0000)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_LENGTH_MAX (0x0000001F)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_LENGTH_DEF (0x00000000)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_EP_OFF (22)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_EP_WID ( 1)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_EP_MSK (0x00400000)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_EP_MAX (0x00000001)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_EP_DEF (0x00000000)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_AT_OFF (23)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_AT_WID ( 2)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_AT_MSK (0x01800000)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_AT_MAX (0x00000003)
+ #define MPVTDTRK_CR_PRIMUP_MASK1_IMPH_AT_DEF (0x00000000)
+
+#define MPVTDTRK_CR_PRIMUP_MASK2_IMPH_REG (0x00006054)
+ #define MPVTDTRK_CR_PRIMUP_MASK2_IMPH_RQID_OFF ( 0)
+ #define MPVTDTRK_CR_PRIMUP_MASK2_IMPH_RQID_WID (16)
+ #define MPVTDTRK_CR_PRIMUP_MASK2_IMPH_RQID_MSK (0x0000FFFF)
+ #define MPVTDTRK_CR_PRIMUP_MASK2_IMPH_RQID_MAX (0x0000FFFF)
+ #define MPVTDTRK_CR_PRIMUP_MASK2_IMPH_RQID_DEF (0x00000000)
+ #define MPVTDTRK_CR_PRIMUP_MASK2_IMPH_TAG_OFF (16)
+ #define MPVTDTRK_CR_PRIMUP_MASK2_IMPH_TAG_WID ( 8)
+ #define MPVTDTRK_CR_PRIMUP_MASK2_IMPH_TAG_MSK (0x00FF0000)
+ #define MPVTDTRK_CR_PRIMUP_MASK2_IMPH_TAG_MAX (0x000000FF)
+ #define MPVTDTRK_CR_PRIMUP_MASK2_IMPH_TAG_DEF (0x00000000)
+ #define MPVTDTRK_CR_PRIMUP_MASK2_IMPH_LBEFBE_MSGTYPE_OFF (24)
+ #define MPVTDTRK_CR_PRIMUP_MASK2_IMPH_LBEFBE_MSGTYPE_WID ( 8)
+ #define MPVTDTRK_CR_PRIMUP_MASK2_IMPH_LBEFBE_MSGTYPE_MSK (0xFF000000)
+ #define MPVTDTRK_CR_PRIMUP_MASK2_IMPH_LBEFBE_MSGTYPE_MAX (0x000000FF)
+ #define MPVTDTRK_CR_PRIMUP_MASK2_IMPH_LBEFBE_MSGTYPE_DEF (0x00000000)
+
+#define MPVTDTRK_CR_PRIMUP_MASK3_IMPH_REG (0x00006058)
+ #define MPVTDTRK_CR_PRIMUP_MASK3_IMPH_ADDR_31_0_OFF ( 0)
+ #define MPVTDTRK_CR_PRIMUP_MASK3_IMPH_ADDR_31_0_WID (32)
+ #define MPVTDTRK_CR_PRIMUP_MASK3_IMPH_ADDR_31_0_MSK (0xFFFFFFFF)
+ #define MPVTDTRK_CR_PRIMUP_MASK3_IMPH_ADDR_31_0_MAX (0xFFFFFFFF)
+ #define MPVTDTRK_CR_PRIMUP_MASK3_IMPH_ADDR_31_0_DEF (0x00000000)
+
+#define MPVTDTRK_CR_PRIMUP_MASK4_IMPH_REG (0x0000605C)
+ #define MPVTDTRK_CR_PRIMUP_MASK4_IMPH_ADDR_63_32_OFF ( 0)
+ #define MPVTDTRK_CR_PRIMUP_MASK4_IMPH_ADDR_63_32_WID (32)
+ #define MPVTDTRK_CR_PRIMUP_MASK4_IMPH_ADDR_63_32_MSK (0xFFFFFFFF)
+ #define MPVTDTRK_CR_PRIMUP_MASK4_IMPH_ADDR_63_32_MAX (0xFFFFFFFF)
+ #define MPVTDTRK_CR_PRIMUP_MASK4_IMPH_ADDR_63_32_DEF (0x00000000)
+
+#define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_REG (0x00006060)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_VC_OFF ( 0)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_VC_WID ( 4)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_VC_MSK (0x0000000F)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_VC_MAX (0x0000000F)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_VC_DEF (0x00000000)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_FMT_CMDTYPE_OFF ( 4)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_FMT_CMDTYPE_WID ( 6)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_FMT_CMDTYPE_MSK (0x000003F0)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_FMT_CMDTYPE_MAX (0x0000003F)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_FMT_CMDTYPE_DEF (0x00000000)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_TC_OFF (10)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_TC_WID ( 4)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_TC_MSK (0x00003C00)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_TC_MAX (0x0000000F)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_TC_DEF (0x00000000)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_CHAIN_OFF (14)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_CHAIN_WID ( 1)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_CHAIN_MSK (0x00004000)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_CHAIN_MAX (0x00000001)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_CHAIN_DEF (0x00000000)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_NS_OFF (15)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_NS_WID ( 1)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_NS_MSK (0x00008000)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_NS_MAX (0x00000001)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_NS_DEF (0x00000000)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_RO_OFF (16)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_RO_WID ( 1)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_RO_MSK (0x00010000)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_RO_MAX (0x00000001)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_RO_DEF (0x00000000)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_LENGTH_OFF (17)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_LENGTH_WID ( 5)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_LENGTH_MSK (0x003E0000)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_LENGTH_MAX (0x0000001F)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_LENGTH_DEF (0x00000000)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_EP_OFF (22)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_EP_WID ( 1)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_EP_MSK (0x00400000)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_EP_MAX (0x00000001)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_EP_DEF (0x00000000)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_AT_OFF (23)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_AT_WID ( 2)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_AT_MSK (0x01800000)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_AT_MAX (0x00000003)
+ #define MPVTDTRK_CR_PRIMUP_COMP1_IMPH_AT_DEF (0x00000000)
+
+#define MPVTDTRK_CR_PRIMUP_COMP2_IMPH_REG (0x00006064)
+ #define MPVTDTRK_CR_PRIMUP_COMP2_IMPH_RQID_OFF ( 0)
+ #define MPVTDTRK_CR_PRIMUP_COMP2_IMPH_RQID_WID (16)
+ #define MPVTDTRK_CR_PRIMUP_COMP2_IMPH_RQID_MSK (0x0000FFFF)
+ #define MPVTDTRK_CR_PRIMUP_COMP2_IMPH_RQID_MAX (0x0000FFFF)
+ #define MPVTDTRK_CR_PRIMUP_COMP2_IMPH_RQID_DEF (0x00000000)
+ #define MPVTDTRK_CR_PRIMUP_COMP2_IMPH_TAG_OFF (16)
+ #define MPVTDTRK_CR_PRIMUP_COMP2_IMPH_TAG_WID ( 8)
+ #define MPVTDTRK_CR_PRIMUP_COMP2_IMPH_TAG_MSK (0x00FF0000)
+ #define MPVTDTRK_CR_PRIMUP_COMP2_IMPH_TAG_MAX (0x000000FF)
+ #define MPVTDTRK_CR_PRIMUP_COMP2_IMPH_TAG_DEF (0x00000000)
+ #define MPVTDTRK_CR_PRIMUP_COMP2_IMPH_LBEFBE_MSGTYPE_OFF (24)
+ #define MPVTDTRK_CR_PRIMUP_COMP2_IMPH_LBEFBE_MSGTYPE_WID ( 8)
+ #define MPVTDTRK_CR_PRIMUP_COMP2_IMPH_LBEFBE_MSGTYPE_MSK (0xFF000000)
+ #define MPVTDTRK_CR_PRIMUP_COMP2_IMPH_LBEFBE_MSGTYPE_MAX (0x000000FF)
+ #define MPVTDTRK_CR_PRIMUP_COMP2_IMPH_LBEFBE_MSGTYPE_DEF (0x00000000)
+
+#define MPVTDTRK_CR_PRIMUP_COMP3_IMPH_REG (0x00006068)
+ #define MPVTDTRK_CR_PRIMUP_COMP3_IMPH_ADDR_31_0_OFF ( 0)
+ #define MPVTDTRK_CR_PRIMUP_COMP3_IMPH_ADDR_31_0_WID (32)
+ #define MPVTDTRK_CR_PRIMUP_COMP3_IMPH_ADDR_31_0_MSK (0xFFFFFFFF)
+ #define MPVTDTRK_CR_PRIMUP_COMP3_IMPH_ADDR_31_0_MAX (0xFFFFFFFF)
+ #define MPVTDTRK_CR_PRIMUP_COMP3_IMPH_ADDR_31_0_DEF (0x00000000)
+
+#define MPVTDTRK_CR_PRIMUP_COMP4_IMPH_REG (0x0000606C)
+ #define MPVTDTRK_CR_PRIMUP_COMP4_IMPH_ADDR_63_32_OFF ( 0)
+ #define MPVTDTRK_CR_PRIMUP_COMP4_IMPH_ADDR_63_32_WID (32)
+ #define MPVTDTRK_CR_PRIMUP_COMP4_IMPH_ADDR_63_32_MSK (0xFFFFFFFF)
+ #define MPVTDTRK_CR_PRIMUP_COMP4_IMPH_ADDR_63_32_MAX (0xFFFFFFFF)
+ #define MPVTDTRK_CR_PRIMUP_COMP4_IMPH_ADDR_63_32_DEF (0x00000000)
+
+#define MPVTDTRK_CR_PRIMUP_TRIGGER_IMPH_REG (0x00006070)
+ #define MPVTDTRK_CR_PRIMUP_TRIGGER_IMPH_ENABLE_OFF ( 0)
+ #define MPVTDTRK_CR_PRIMUP_TRIGGER_IMPH_ENABLE_WID ( 1)
+ #define MPVTDTRK_CR_PRIMUP_TRIGGER_IMPH_ENABLE_MSK (0x00000001)
+ #define MPVTDTRK_CR_PRIMUP_TRIGGER_IMPH_ENABLE_MAX (0x00000001)
+ #define MPVTDTRK_CR_PRIMUP_TRIGGER_IMPH_ENABLE_DEF (0x00000000)
+ #define MPVTDTRK_CR_PRIMUP_TRIGGER_IMPH_TRIGGERED_OFF ( 1)
+ #define MPVTDTRK_CR_PRIMUP_TRIGGER_IMPH_TRIGGERED_WID ( 1)
+ #define MPVTDTRK_CR_PRIMUP_TRIGGER_IMPH_TRIGGERED_MSK (0x00000002)
+ #define MPVTDTRK_CR_PRIMUP_TRIGGER_IMPH_TRIGGERED_MAX (0x00000001)
+ #define MPVTDTRK_CR_PRIMUP_TRIGGER_IMPH_TRIGGERED_DEF (0x00000000)
+ #define MPVTDTRK_CR_PRIMUP_TRIGGER_IMPH_STALL_DNARB_OFF ( 2)
+ #define MPVTDTRK_CR_PRIMUP_TRIGGER_IMPH_STALL_DNARB_WID ( 1)
+ #define MPVTDTRK_CR_PRIMUP_TRIGGER_IMPH_STALL_DNARB_MSK (0x00000004)
+ #define MPVTDTRK_CR_PRIMUP_TRIGGER_IMPH_STALL_DNARB_MAX (0x00000001)
+ #define MPVTDTRK_CR_PRIMUP_TRIGGER_IMPH_STALL_DNARB_DEF (0x00000000)
+ #define MPVTDTRK_CR_PRIMUP_TRIGGER_IMPH_STALL_UPARB_OFF ( 3)
+ #define MPVTDTRK_CR_PRIMUP_TRIGGER_IMPH_STALL_UPARB_WID ( 1)
+ #define MPVTDTRK_CR_PRIMUP_TRIGGER_IMPH_STALL_UPARB_MSK (0x00000008)
+ #define MPVTDTRK_CR_PRIMUP_TRIGGER_IMPH_STALL_UPARB_MAX (0x00000001)
+ #define MPVTDTRK_CR_PRIMUP_TRIGGER_IMPH_STALL_UPARB_DEF (0x00000000)
+ #define MPVTDTRK_CR_PRIMUP_TRIGGER_IMPH_STALL_SNPARB_OFF ( 4)
+ #define MPVTDTRK_CR_PRIMUP_TRIGGER_IMPH_STALL_SNPARB_WID ( 1)
+ #define MPVTDTRK_CR_PRIMUP_TRIGGER_IMPH_STALL_SNPARB_MSK (0x00000010)
+ #define MPVTDTRK_CR_PRIMUP_TRIGGER_IMPH_STALL_SNPARB_MAX (0x00000001)
+ #define MPVTDTRK_CR_PRIMUP_TRIGGER_IMPH_STALL_SNPARB_DEF (0x00000000)
+ #define MPVTDTRK_CR_PRIMUP_TRIGGER_IMPH_STALL_DELAY_OFF (23)
+ #define MPVTDTRK_CR_PRIMUP_TRIGGER_IMPH_STALL_DELAY_WID ( 9)
+ #define MPVTDTRK_CR_PRIMUP_TRIGGER_IMPH_STALL_DELAY_MSK (0xFF800000)
+ #define MPVTDTRK_CR_PRIMUP_TRIGGER_IMPH_STALL_DELAY_MAX (0x000001FF)
+ #define MPVTDTRK_CR_PRIMUP_TRIGGER_IMPH_STALL_DELAY_DEF (0x00000000)
+
+#define MPVTDTRK_CR_HCTL0_IMPH_REG (0x00006100)
+ #define MPVTDTRK_CR_HCTL0_IMPH_PEG2DMIDIS_OFF ( 0)
+ #define MPVTDTRK_CR_HCTL0_IMPH_PEG2DMIDIS_WID ( 1)
+ #define MPVTDTRK_CR_HCTL0_IMPH_PEG2DMIDIS_MSK (0x00000001)
+ #define MPVTDTRK_CR_HCTL0_IMPH_PEG2DMIDIS_MAX (0x00000001)
+ #define MPVTDTRK_CR_HCTL0_IMPH_PEG2DMIDIS_DEF (0x00000000)
+ #define MPVTDTRK_CR_HCTL0_IMPH_EOIB_OFF ( 1)
+ #define MPVTDTRK_CR_HCTL0_IMPH_EOIB_WID ( 1)
+ #define MPVTDTRK_CR_HCTL0_IMPH_EOIB_MSK (0x00000002)
+ #define MPVTDTRK_CR_HCTL0_IMPH_EOIB_MAX (0x00000001)
+ #define MPVTDTRK_CR_HCTL0_IMPH_EOIB_DEF (0x00000000)
+ #define MPVTDTRK_CR_HCTL0_IMPH_MSIBYPDIS_OFF ( 2)
+ #define MPVTDTRK_CR_HCTL0_IMPH_MSIBYPDIS_WID ( 1)
+ #define MPVTDTRK_CR_HCTL0_IMPH_MSIBYPDIS_MSK (0x00000004)
+ #define MPVTDTRK_CR_HCTL0_IMPH_MSIBYPDIS_MAX (0x00000001)
+ #define MPVTDTRK_CR_HCTL0_IMPH_MSIBYPDIS_DEF (0x00000000)
+ #define MPVTDTRK_CR_HCTL0_IMPH_PHLDDIS_OFF ( 4)
+ #define MPVTDTRK_CR_HCTL0_IMPH_PHLDDIS_WID ( 1)
+ #define MPVTDTRK_CR_HCTL0_IMPH_PHLDDIS_MSK (0x00000010)
+ #define MPVTDTRK_CR_HCTL0_IMPH_PHLDDIS_MAX (0x00000001)
+ #define MPVTDTRK_CR_HCTL0_IMPH_PHLDDIS_DEF (0x00000000)
+ #define MPVTDTRK_CR_HCTL0_IMPH_BKSNPDIS_OFF ( 6)
+ #define MPVTDTRK_CR_HCTL0_IMPH_BKSNPDIS_WID ( 1)
+ #define MPVTDTRK_CR_HCTL0_IMPH_BKSNPDIS_MSK (0x00000040)
+ #define MPVTDTRK_CR_HCTL0_IMPH_BKSNPDIS_MAX (0x00000001)
+ #define MPVTDTRK_CR_HCTL0_IMPH_BKSNPDIS_DEF (0x00000000)
+ #define MPVTDTRK_CR_HCTL0_IMPH_FRCVC0SNP_OFF ( 7)
+ #define MPVTDTRK_CR_HCTL0_IMPH_FRCVC0SNP_WID ( 1)
+ #define MPVTDTRK_CR_HCTL0_IMPH_FRCVC0SNP_MSK (0x00000080)
+ #define MPVTDTRK_CR_HCTL0_IMPH_FRCVC0SNP_MAX (0x00000001)
+ #define MPVTDTRK_CR_HCTL0_IMPH_FRCVC0SNP_DEF (0x00000000)
+ #define MPVTDTRK_CR_HCTL0_IMPH_FRCVCPSNP_OFF ( 8)
+ #define MPVTDTRK_CR_HCTL0_IMPH_FRCVCPSNP_WID ( 1)
+ #define MPVTDTRK_CR_HCTL0_IMPH_FRCVCPSNP_MSK (0x00000100)
+ #define MPVTDTRK_CR_HCTL0_IMPH_FRCVCPSNP_MAX (0x00000001)
+ #define MPVTDTRK_CR_HCTL0_IMPH_FRCVCPSNP_DEF (0x00000000)
+ #define MPVTDTRK_CR_HCTL0_IMPH_PHLDBLKDIS_OFF ( 9)
+ #define MPVTDTRK_CR_HCTL0_IMPH_PHLDBLKDIS_WID ( 1)
+ #define MPVTDTRK_CR_HCTL0_IMPH_PHLDBLKDIS_MSK (0x00000200)
+ #define MPVTDTRK_CR_HCTL0_IMPH_PHLDBLKDIS_MAX (0x00000001)
+ #define MPVTDTRK_CR_HCTL0_IMPH_PHLDBLKDIS_DEF (0x00000000)
+ #define MPVTDTRK_CR_HCTL0_IMPH_BLKWRPOSTVC1_OFF (10)
+ #define MPVTDTRK_CR_HCTL0_IMPH_BLKWRPOSTVC1_WID ( 1)
+ #define MPVTDTRK_CR_HCTL0_IMPH_BLKWRPOSTVC1_MSK (0x00000400)
+ #define MPVTDTRK_CR_HCTL0_IMPH_BLKWRPOSTVC1_MAX (0x00000001)
+ #define MPVTDTRK_CR_HCTL0_IMPH_BLKWRPOSTVC1_DEF (0x00000000)
+ #define MPVTDTRK_CR_HCTL0_IMPH_DIS_VLW_PEG_OFF (11)
+ #define MPVTDTRK_CR_HCTL0_IMPH_DIS_VLW_PEG_WID ( 1)
+ #define MPVTDTRK_CR_HCTL0_IMPH_DIS_VLW_PEG_MSK (0x00000800)
+ #define MPVTDTRK_CR_HCTL0_IMPH_DIS_VLW_PEG_MAX (0x00000001)
+ #define MPVTDTRK_CR_HCTL0_IMPH_DIS_VLW_PEG_DEF (0x00000000)
+ #define MPVTDTRK_CR_HCTL0_IMPH_SPECRDDIS_OFF (12)
+ #define MPVTDTRK_CR_HCTL0_IMPH_SPECRDDIS_WID ( 1)
+ #define MPVTDTRK_CR_HCTL0_IMPH_SPECRDDIS_MSK (0x00001000)
+ #define MPVTDTRK_CR_HCTL0_IMPH_SPECRDDIS_MAX (0x00000001)
+ #define MPVTDTRK_CR_HCTL0_IMPH_SPECRDDIS_DEF (0x00000000)
+ #define MPVTDTRK_CR_HCTL0_IMPH_IR_RSRV_CTL_OFF (13)
+ #define MPVTDTRK_CR_HCTL0_IMPH_IR_RSRV_CTL_WID ( 1)
+ #define MPVTDTRK_CR_HCTL0_IMPH_IR_RSRV_CTL_MSK (0x00002000)
+ #define MPVTDTRK_CR_HCTL0_IMPH_IR_RSRV_CTL_MAX (0x00000001)
+ #define MPVTDTRK_CR_HCTL0_IMPH_IR_RSRV_CTL_DEF (0x00000000)
+ #define MPVTDTRK_CR_HCTL0_IMPH_RSVD_OFF (14)
+ #define MPVTDTRK_CR_HCTL0_IMPH_RSVD_WID (18)
+ #define MPVTDTRK_CR_HCTL0_IMPH_RSVD_MSK (0xFFFFC000)
+ #define MPVTDTRK_CR_HCTL0_IMPH_RSVD_MAX (0x0003FFFF)
+ #define MPVTDTRK_CR_HCTL0_IMPH_RSVD_DEF (0x00000000)
+
+#define MPVTDTRK_CR_REGBAR_IMPH_REG (0x00006110)
+ #define MPVTDTRK_CR_REGBAR_IMPH_REGBAR_OFF ( 4)
+ #define MPVTDTRK_CR_REGBAR_IMPH_REGBAR_WID (35)
+ #define MPVTDTRK_CR_REGBAR_IMPH_REGBAR_MSK (0x7FFFFFFFF0)
+ #define MPVTDTRK_CR_REGBAR_IMPH_REGBAR_MAX (0x7FFFFFFFF)
+ #define MPVTDTRK_CR_REGBAR_IMPH_REGBAR_DEF (0x00000000)
+
+#define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_REG (0x00006200)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_THERMAL_MONITOR_STATUS_OFF ( 0)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_THERMAL_MONITOR_STATUS_WID ( 1)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_THERMAL_MONITOR_STATUS_MSK (0x00000001)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_THERMAL_MONITOR_STATUS_MAX (0x00000001)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_THERMAL_MONITOR_STATUS_DEF (0x00000000)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_THERMAL_MONITOR_LOG_OFF ( 1)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_THERMAL_MONITOR_LOG_WID ( 1)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_THERMAL_MONITOR_LOG_MSK (0x00000002)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_THERMAL_MONITOR_LOG_MAX (0x00000001)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_THERMAL_MONITOR_LOG_DEF (0x00000000)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_PROCHOT_STATUS_OFF ( 2)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_PROCHOT_STATUS_WID ( 1)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_PROCHOT_STATUS_MSK (0x00000004)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_PROCHOT_STATUS_MAX (0x00000001)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_PROCHOT_STATUS_DEF (0x00000000)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_PROCHOT_LOG_OFF ( 3)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_PROCHOT_LOG_WID ( 1)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_PROCHOT_LOG_MSK (0x00000008)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_PROCHOT_LOG_MAX (0x00000001)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_PROCHOT_LOG_DEF (0x00000000)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_OUT_OF_SPEC_STATUS_OFF ( 4)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_OUT_OF_SPEC_STATUS_WID ( 1)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_OUT_OF_SPEC_STATUS_MSK (0x00000010)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_OUT_OF_SPEC_STATUS_MAX (0x00000001)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_OUT_OF_SPEC_STATUS_DEF (0x00000000)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_OUT_OF_SPEC_LOG_OFF ( 5)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_OUT_OF_SPEC_LOG_WID ( 1)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_OUT_OF_SPEC_LOG_MSK (0x00000020)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_OUT_OF_SPEC_LOG_MAX (0x00000001)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_OUT_OF_SPEC_LOG_DEF (0x00000000)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_THRESHOLD1_STATUS_OFF ( 6)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_THRESHOLD1_STATUS_WID ( 1)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_THRESHOLD1_STATUS_MSK (0x00000040)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_THRESHOLD1_STATUS_MAX (0x00000001)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_THRESHOLD1_STATUS_DEF (0x00000000)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_THRESHOLD1_LOG_OFF ( 7)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_THRESHOLD1_LOG_WID ( 1)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_THRESHOLD1_LOG_MSK (0x00000080)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_THRESHOLD1_LOG_MAX (0x00000001)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_THRESHOLD1_LOG_DEF (0x00000000)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_THRESHOLD2_STATUS_OFF ( 8)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_THRESHOLD2_STATUS_WID ( 1)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_THRESHOLD2_STATUS_MSK (0x00000100)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_THRESHOLD2_STATUS_MAX (0x00000001)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_THRESHOLD2_STATUS_DEF (0x00000000)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_THRESHOLD2_LOG_OFF ( 9)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_THRESHOLD2_LOG_WID ( 1)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_THRESHOLD2_LOG_MSK (0x00000200)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_THRESHOLD2_LOG_MAX (0x00000001)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_THRESHOLD2_LOG_DEF (0x00000000)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_POWER_LIMITATION_STATUS_OFF (10)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_POWER_LIMITATION_STATUS_WID ( 1)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_POWER_LIMITATION_STATUS_MSK (0x00000400)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_POWER_LIMITATION_STATUS_MAX (0x00000001)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_POWER_LIMITATION_STATUS_DEF (0x00000000)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_POWER_LIMITATION_LOG_OFF (11)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_POWER_LIMITATION_LOG_WID ( 1)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_POWER_LIMITATION_LOG_MSK (0x00000800)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_POWER_LIMITATION_LOG_MAX (0x00000001)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_POWER_LIMITATION_LOG_DEF (0x00000000)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_Temperature_OFF (16)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_Temperature_WID ( 7)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_Temperature_MSK (0x007F0000)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_Temperature_MAX (0x0000007F)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_Temperature_DEF (0x00000000)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_Resolution_OFF (27)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_Resolution_WID ( 4)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_Resolution_MSK (0x78000000)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_Resolution_MAX (0x0000000F)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_Resolution_DEF (0x00000001)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_Valid_OFF (31)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_Valid_WID ( 1)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_Valid_MSK (0x80000000)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_Valid_MAX (0x00000001)
+ #define MPVTDTRK_CR_PKG_THERM_CAMARILLO_STATUS_IMPH_Valid_DEF (0x00000000)
+
+#define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_REG (0x00006204)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_WARM_THRESHOLD_STATUS_OFF ( 0)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_WARM_THRESHOLD_STATUS_WID ( 1)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_WARM_THRESHOLD_STATUS_MSK (0x00000001)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_WARM_THRESHOLD_STATUS_MAX (0x00000001)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_WARM_THRESHOLD_STATUS_DEF (0x00000000)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_WARM_THRESHOLD_LOG_OFF ( 1)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_WARM_THRESHOLD_LOG_WID ( 1)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_WARM_THRESHOLD_LOG_MSK (0x00000002)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_WARM_THRESHOLD_LOG_MAX (0x00000001)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_WARM_THRESHOLD_LOG_DEF (0x00000000)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_HOT_THRESHOLD_STATUS_OFF ( 2)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_HOT_THRESHOLD_STATUS_WID ( 1)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_HOT_THRESHOLD_STATUS_MSK (0x00000004)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_HOT_THRESHOLD_STATUS_MAX (0x00000001)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_HOT_THRESHOLD_STATUS_DEF (0x00000000)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_HOT_THRESHOLD_LOG_OFF ( 3)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_HOT_THRESHOLD_LOG_WID ( 1)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_HOT_THRESHOLD_LOG_MSK (0x00000008)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_HOT_THRESHOLD_LOG_MAX (0x00000001)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_HOT_THRESHOLD_LOG_DEF (0x00000000)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_REFRESH2X_STATUS_OFF ( 4)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_REFRESH2X_STATUS_WID ( 1)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_REFRESH2X_STATUS_MSK (0x00000010)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_REFRESH2X_STATUS_MAX (0x00000001)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_REFRESH2X_STATUS_DEF (0x00000000)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_REFRESH2X_LOG_OFF ( 5)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_REFRESH2X_LOG_WID ( 1)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_REFRESH2X_LOG_MSK (0x00000020)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_REFRESH2X_LOG_MAX (0x00000001)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_REFRESH2X_LOG_DEF (0x00000000)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_FORCEMEMPR_STATUS_OFF ( 6)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_FORCEMEMPR_STATUS_WID ( 1)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_FORCEMEMPR_STATUS_MSK (0x00000040)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_FORCEMEMPR_STATUS_MAX (0x00000001)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_FORCEMEMPR_STATUS_DEF (0x00000000)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_FORCEMEMPR_LOG_OFF ( 7)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_FORCEMEMPR_LOG_WID ( 1)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_FORCEMEMPR_LOG_MSK (0x00000080)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_FORCEMEMPR_LOG_MAX (0x00000001)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_FORCEMEMPR_LOG_DEF (0x00000000)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_THRESHOLD1_STATUS_OFF ( 8)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_THRESHOLD1_STATUS_WID ( 1)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_THRESHOLD1_STATUS_MSK (0x00000100)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_THRESHOLD1_STATUS_MAX (0x00000001)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_THRESHOLD1_STATUS_DEF (0x00000000)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_THRESHOLD1_LOG_OFF ( 9)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_THRESHOLD1_LOG_WID ( 1)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_THRESHOLD1_LOG_MSK (0x00000200)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_THRESHOLD1_LOG_MAX (0x00000001)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_THRESHOLD1_LOG_DEF (0x00000000)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_THRESHOLD2_STATUS_OFF (10)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_THRESHOLD2_STATUS_WID ( 1)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_THRESHOLD2_STATUS_MSK (0x00000400)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_THRESHOLD2_STATUS_MAX (0x00000001)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_THRESHOLD2_STATUS_DEF (0x00000000)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_THRESHOLD2_LOG_OFF (11)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_THRESHOLD2_LOG_WID ( 1)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_THRESHOLD2_LOG_MSK (0x00000800)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_THRESHOLD2_LOG_MAX (0x00000001)
+ #define MPVTDTRK_CR_DDR_THERM_CAMARILLO_STATUS_IMPH_THRESHOLD2_LOG_DEF (0x00000000)
+
+#define MPVTDTRK_CR_VTDTRKLCK_IMPH_REG (0x000063FC)
+ #define MPVTDTRK_CR_VTDTRKLCK_IMPH_LOCK_OFF ( 0)
+ #define MPVTDTRK_CR_VTDTRKLCK_IMPH_LOCK_WID ( 1)
+ #define MPVTDTRK_CR_VTDTRKLCK_IMPH_LOCK_MSK (0x00000001)
+ #define MPVTDTRK_CR_VTDTRKLCK_IMPH_LOCK_MAX (0x00000001)
+ #define MPVTDTRK_CR_VTDTRKLCK_IMPH_LOCK_DEF (0x00000000)
+
+#define MPCBOTRK_CR_REQLIM_IMPH_REG (0x00006800)
+ #define MPCBOTRK_CR_REQLIM_IMPH_RDLIM_OFF ( 0)
+ #define MPCBOTRK_CR_REQLIM_IMPH_RDLIM_WID ( 3)
+ #define MPCBOTRK_CR_REQLIM_IMPH_RDLIM_MSK (0x00000007)
+ #define MPCBOTRK_CR_REQLIM_IMPH_RDLIM_MAX (0x00000007)
+ #define MPCBOTRK_CR_REQLIM_IMPH_RDLIM_DEF (0x00000004)
+ #define MPCBOTRK_CR_REQLIM_IMPH_WRLIM_OFF ( 4)
+ #define MPCBOTRK_CR_REQLIM_IMPH_WRLIM_WID ( 3)
+ #define MPCBOTRK_CR_REQLIM_IMPH_WRLIM_MSK (0x00000070)
+ #define MPCBOTRK_CR_REQLIM_IMPH_WRLIM_MAX (0x00000007)
+ #define MPCBOTRK_CR_REQLIM_IMPH_WRLIM_DEF (0x00000004)
+ #define MPCBOTRK_CR_REQLIM_IMPH_LOCK_OFF (31)
+ #define MPCBOTRK_CR_REQLIM_IMPH_LOCK_WID ( 1)
+ #define MPCBOTRK_CR_REQLIM_IMPH_LOCK_MSK (0x80000000)
+ #define MPCBOTRK_CR_REQLIM_IMPH_LOCK_MAX (0x00000001)
+ #define MPCBOTRK_CR_REQLIM_IMPH_LOCK_DEF (0x00000000)
+
+#define HUBS_CR_DMIVCLIM_HUBS_REG (0x00007000)
+ #define HUBS_CR_DMIVCLIM_HUBS_VCPNPLIM_OFF ( 0)
+ #define HUBS_CR_DMIVCLIM_HUBS_VCPNPLIM_WID ( 3)
+ #define HUBS_CR_DMIVCLIM_HUBS_VCPNPLIM_MSK (0x00000007)
+ #define HUBS_CR_DMIVCLIM_HUBS_VCPNPLIM_MAX (0x00000007)
+ #define HUBS_CR_DMIVCLIM_HUBS_VCPNPLIM_DEF (0x00000004)
+ #define HUBS_CR_DMIVCLIM_HUBS_VCPPLIM_OFF ( 4)
+ #define HUBS_CR_DMIVCLIM_HUBS_VCPPLIM_WID ( 3)
+ #define HUBS_CR_DMIVCLIM_HUBS_VCPPLIM_MSK (0x00000070)
+ #define HUBS_CR_DMIVCLIM_HUBS_VCPPLIM_MAX (0x00000007)
+ #define HUBS_CR_DMIVCLIM_HUBS_VCPPLIM_DEF (0x00000004)
+ #define HUBS_CR_DMIVCLIM_HUBS_VCMNPLIM_OFF ( 8)
+ #define HUBS_CR_DMIVCLIM_HUBS_VCMNPLIM_WID ( 3)
+ #define HUBS_CR_DMIVCLIM_HUBS_VCMNPLIM_MSK (0x00000700)
+ #define HUBS_CR_DMIVCLIM_HUBS_VCMNPLIM_MAX (0x00000007)
+ #define HUBS_CR_DMIVCLIM_HUBS_VCMNPLIM_DEF (0x00000004)
+ #define HUBS_CR_DMIVCLIM_HUBS_VCMPLIM_OFF (12)
+ #define HUBS_CR_DMIVCLIM_HUBS_VCMPLIM_WID ( 3)
+ #define HUBS_CR_DMIVCLIM_HUBS_VCMPLIM_MSK (0x00007000)
+ #define HUBS_CR_DMIVCLIM_HUBS_VCMPLIM_MAX (0x00000007)
+ #define HUBS_CR_DMIVCLIM_HUBS_VCMPLIM_DEF (0x00000004)
+ #define HUBS_CR_DMIVCLIM_HUBS_VCPCMPLIM_OFF (16)
+ #define HUBS_CR_DMIVCLIM_HUBS_VCPCMPLIM_WID ( 3)
+ #define HUBS_CR_DMIVCLIM_HUBS_VCPCMPLIM_MSK (0x00070000)
+ #define HUBS_CR_DMIVCLIM_HUBS_VCPCMPLIM_MAX (0x00000007)
+ #define HUBS_CR_DMIVCLIM_HUBS_VCPCMPLIM_DEF (0x00000004)
+ #define HUBS_CR_DMIVCLIM_HUBS_VCMCMPLIM_OFF (20)
+ #define HUBS_CR_DMIVCLIM_HUBS_VCMCMPLIM_WID ( 3)
+ #define HUBS_CR_DMIVCLIM_HUBS_VCMCMPLIM_MSK (0x00700000)
+ #define HUBS_CR_DMIVCLIM_HUBS_VCMCMPLIM_MAX (0x00000007)
+ #define HUBS_CR_DMIVCLIM_HUBS_VCMCMPLIM_DEF (0x00000004)
+ #define HUBS_CR_DMIVCLIM_HUBS_LOCK_OFF (31)
+ #define HUBS_CR_DMIVCLIM_HUBS_LOCK_WID ( 1)
+ #define HUBS_CR_DMIVCLIM_HUBS_LOCK_MSK (0x80000000)
+ #define HUBS_CR_DMIVCLIM_HUBS_LOCK_MAX (0x00000001)
+ #define HUBS_CR_DMIVCLIM_HUBS_LOCK_DEF (0x00000000)
+
+#define HUBS_CR_HUB0_PWRDN_OVRD_HUBS_REG (0x00007010)
+ #define HUBS_CR_HUB0_PWRDN_OVRD_HUBS_P0_OFF ( 0)
+ #define HUBS_CR_HUB0_PWRDN_OVRD_HUBS_P0_WID ( 1)
+ #define HUBS_CR_HUB0_PWRDN_OVRD_HUBS_P0_MSK (0x00000001)
+ #define HUBS_CR_HUB0_PWRDN_OVRD_HUBS_P0_MAX (0x00000001)
+ #define HUBS_CR_HUB0_PWRDN_OVRD_HUBS_P0_DEF (0x00000000)
+ #define HUBS_CR_HUB0_PWRDN_OVRD_HUBS_P1_OFF ( 1)
+ #define HUBS_CR_HUB0_PWRDN_OVRD_HUBS_P1_WID ( 1)
+ #define HUBS_CR_HUB0_PWRDN_OVRD_HUBS_P1_MSK (0x00000002)
+ #define HUBS_CR_HUB0_PWRDN_OVRD_HUBS_P1_MAX (0x00000001)
+ #define HUBS_CR_HUB0_PWRDN_OVRD_HUBS_P1_DEF (0x00000000)
+ #define HUBS_CR_HUB0_PWRDN_OVRD_HUBS_P2_OFF ( 2)
+ #define HUBS_CR_HUB0_PWRDN_OVRD_HUBS_P2_WID ( 1)
+ #define HUBS_CR_HUB0_PWRDN_OVRD_HUBS_P2_MSK (0x00000004)
+ #define HUBS_CR_HUB0_PWRDN_OVRD_HUBS_P2_MAX (0x00000001)
+ #define HUBS_CR_HUB0_PWRDN_OVRD_HUBS_P2_DEF (0x00000000)
+ #define HUBS_CR_HUB0_PWRDN_OVRD_HUBS_P3_OFF ( 3)
+ #define HUBS_CR_HUB0_PWRDN_OVRD_HUBS_P3_WID ( 1)
+ #define HUBS_CR_HUB0_PWRDN_OVRD_HUBS_P3_MSK (0x00000008)
+ #define HUBS_CR_HUB0_PWRDN_OVRD_HUBS_P3_MAX (0x00000001)
+ #define HUBS_CR_HUB0_PWRDN_OVRD_HUBS_P3_DEF (0x00000000)
+
+#define HUBS_CR_HUB1_PWRDN_OVRD_HUBS_REG (0x00007014)
+ #define HUBS_CR_HUB1_PWRDN_OVRD_HUBS_P0_OFF ( 0)
+ #define HUBS_CR_HUB1_PWRDN_OVRD_HUBS_P0_WID ( 1)
+ #define HUBS_CR_HUB1_PWRDN_OVRD_HUBS_P0_MSK (0x00000001)
+ #define HUBS_CR_HUB1_PWRDN_OVRD_HUBS_P0_MAX (0x00000001)
+ #define HUBS_CR_HUB1_PWRDN_OVRD_HUBS_P0_DEF (0x00000000)
+ #define HUBS_CR_HUB1_PWRDN_OVRD_HUBS_P1_OFF ( 1)
+ #define HUBS_CR_HUB1_PWRDN_OVRD_HUBS_P1_WID ( 1)
+ #define HUBS_CR_HUB1_PWRDN_OVRD_HUBS_P1_MSK (0x00000002)
+ #define HUBS_CR_HUB1_PWRDN_OVRD_HUBS_P1_MAX (0x00000001)
+ #define HUBS_CR_HUB1_PWRDN_OVRD_HUBS_P1_DEF (0x00000000)
+ #define HUBS_CR_HUB1_PWRDN_OVRD_HUBS_P2_OFF ( 2)
+ #define HUBS_CR_HUB1_PWRDN_OVRD_HUBS_P2_WID ( 1)
+ #define HUBS_CR_HUB1_PWRDN_OVRD_HUBS_P2_MSK (0x00000004)
+ #define HUBS_CR_HUB1_PWRDN_OVRD_HUBS_P2_MAX (0x00000001)
+ #define HUBS_CR_HUB1_PWRDN_OVRD_HUBS_P2_DEF (0x00000000)
+ #define HUBS_CR_HUB1_PWRDN_OVRD_HUBS_P3_OFF ( 3)
+ #define HUBS_CR_HUB1_PWRDN_OVRD_HUBS_P3_WID ( 1)
+ #define HUBS_CR_HUB1_PWRDN_OVRD_HUBS_P3_MSK (0x00000008)
+ #define HUBS_CR_HUB1_PWRDN_OVRD_HUBS_P3_MAX (0x00000001)
+ #define HUBS_CR_HUB1_PWRDN_OVRD_HUBS_P3_DEF (0x00000000)
+
+#define HUBS_CR_HUB2_PWRDN_OVRD_HUBS_REG (0x00007018)
+ #define HUBS_CR_HUB2_PWRDN_OVRD_HUBS_P0_OFF ( 0)
+ #define HUBS_CR_HUB2_PWRDN_OVRD_HUBS_P0_WID ( 1)
+ #define HUBS_CR_HUB2_PWRDN_OVRD_HUBS_P0_MSK (0x00000001)
+ #define HUBS_CR_HUB2_PWRDN_OVRD_HUBS_P0_MAX (0x00000001)
+ #define HUBS_CR_HUB2_PWRDN_OVRD_HUBS_P0_DEF (0x00000000)
+ #define HUBS_CR_HUB2_PWRDN_OVRD_HUBS_P1_OFF ( 1)
+ #define HUBS_CR_HUB2_PWRDN_OVRD_HUBS_P1_WID ( 1)
+ #define HUBS_CR_HUB2_PWRDN_OVRD_HUBS_P1_MSK (0x00000002)
+ #define HUBS_CR_HUB2_PWRDN_OVRD_HUBS_P1_MAX (0x00000001)
+ #define HUBS_CR_HUB2_PWRDN_OVRD_HUBS_P1_DEF (0x00000000)
+ #define HUBS_CR_HUB2_PWRDN_OVRD_HUBS_P2_OFF ( 2)
+ #define HUBS_CR_HUB2_PWRDN_OVRD_HUBS_P2_WID ( 1)
+ #define HUBS_CR_HUB2_PWRDN_OVRD_HUBS_P2_MSK (0x00000004)
+ #define HUBS_CR_HUB2_PWRDN_OVRD_HUBS_P2_MAX (0x00000001)
+ #define HUBS_CR_HUB2_PWRDN_OVRD_HUBS_P2_DEF (0x00000000)
+ #define HUBS_CR_HUB2_PWRDN_OVRD_HUBS_P3_OFF ( 3)
+ #define HUBS_CR_HUB2_PWRDN_OVRD_HUBS_P3_WID ( 1)
+ #define HUBS_CR_HUB2_PWRDN_OVRD_HUBS_P3_MSK (0x00000008)
+ #define HUBS_CR_HUB2_PWRDN_OVRD_HUBS_P3_MAX (0x00000001)
+ #define HUBS_CR_HUB2_PWRDN_OVRD_HUBS_P3_DEF (0x00000000)
+
+#define HUBS_CR_HUB0_DEFEATURE_HUBS_REG (0x0000701C)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_BLK_GNT_P0_OFF ( 0)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_BLK_GNT_P0_WID ( 1)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_BLK_GNT_P0_MSK (0x00000001)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_BLK_GNT_P0_MAX (0x00000001)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_BLK_GNT_P0_DEF (0x00000000)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_BLK_GNT_P1_OFF ( 1)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_BLK_GNT_P1_WID ( 1)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_BLK_GNT_P1_MSK (0x00000002)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_BLK_GNT_P1_MAX (0x00000001)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_BLK_GNT_P1_DEF (0x00000000)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_BLK_GNT_P2_OFF ( 2)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_BLK_GNT_P2_WID ( 1)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_BLK_GNT_P2_MSK (0x00000004)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_BLK_GNT_P2_MAX (0x00000001)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_BLK_GNT_P2_DEF (0x00000000)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_BLK_PUT_P0_OFF ( 3)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_BLK_PUT_P0_WID ( 1)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_BLK_PUT_P0_MSK (0x00000008)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_BLK_PUT_P0_MAX (0x00000001)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_BLK_PUT_P0_DEF (0x00000000)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_BLK_PUT_P1_OFF ( 4)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_BLK_PUT_P1_WID ( 1)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_BLK_PUT_P1_MSK (0x00000010)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_BLK_PUT_P1_MAX (0x00000001)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_BLK_PUT_P1_DEF (0x00000000)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_BLK_PUT_P2_OFF ( 5)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_BLK_PUT_P2_WID ( 1)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_BLK_PUT_P2_MSK (0x00000020)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_BLK_PUT_P2_MAX (0x00000001)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_BLK_PUT_P2_DEF (0x00000000)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_BLK_PUT_P3_OFF ( 6)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_BLK_PUT_P3_WID ( 1)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_BLK_PUT_P3_MSK (0x00000040)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_BLK_PUT_P3_MAX (0x00000001)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_BLK_PUT_P3_DEF (0x00000000)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_NO_CHAIN_P0_OFF ( 7)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_NO_CHAIN_P0_WID ( 1)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_NO_CHAIN_P0_MSK (0x00000080)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_NO_CHAIN_P0_MAX (0x00000001)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_NO_CHAIN_P0_DEF (0x00000000)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_NO_CHAIN_P1_OFF ( 8)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_NO_CHAIN_P1_WID ( 1)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_NO_CHAIN_P1_MSK (0x00000100)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_NO_CHAIN_P1_MAX (0x00000001)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_NO_CHAIN_P1_DEF (0x00000000)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_NO_CHAIN_P2_OFF ( 9)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_NO_CHAIN_P2_WID ( 1)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_NO_CHAIN_P2_MSK (0x00000200)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_NO_CHAIN_P2_MAX (0x00000001)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_NO_CHAIN_P2_DEF (0x00000000)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_SLOW_UP_P0_OFF (10)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_SLOW_UP_P0_WID ( 1)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_SLOW_UP_P0_MSK (0x00000400)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_SLOW_UP_P0_MAX (0x00000001)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_SLOW_UP_P0_DEF (0x00000000)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_SLOW_UP_P1_OFF (11)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_SLOW_UP_P1_WID ( 1)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_SLOW_UP_P1_MSK (0x00000800)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_SLOW_UP_P1_MAX (0x00000001)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_SLOW_UP_P1_DEF (0x00000000)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_SLOW_UP_P2_OFF (12)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_SLOW_UP_P2_WID ( 1)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_SLOW_UP_P2_MSK (0x00001000)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_SLOW_UP_P2_MAX (0x00000001)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_SLOW_UP_P2_DEF (0x00000000)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_SLOW_DN_P0_OFF (13)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_SLOW_DN_P0_WID ( 1)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_SLOW_DN_P0_MSK (0x00002000)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_SLOW_DN_P0_MAX (0x00000001)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_SLOW_DN_P0_DEF (0x00000000)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_SLOW_DN_P1_OFF (14)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_SLOW_DN_P1_WID ( 1)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_SLOW_DN_P1_MSK (0x00004000)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_SLOW_DN_P1_MAX (0x00000001)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_SLOW_DN_P1_DEF (0x00000000)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_SLOW_DN_P2_OFF (15)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_SLOW_DN_P2_WID ( 1)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_SLOW_DN_P2_MSK (0x00008000)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_SLOW_DN_P2_MAX (0x00000001)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_SLOW_DN_P2_DEF (0x00000000)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_SLOW_DN_P3_OFF (16)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_SLOW_DN_P3_WID ( 1)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_SLOW_DN_P3_MSK (0x00010000)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_SLOW_DN_P3_MAX (0x00000001)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_SLOW_DN_P3_DEF (0x00000000)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_SLOWER_CMD_OFF (17)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_SLOWER_CMD_WID ( 1)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_SLOWER_CMD_MSK (0x00020000)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_SLOWER_CMD_MAX (0x00000001)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_SLOWER_CMD_DEF (0x00000000)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_DMI_NOPUSH_OFF (18)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_DMI_NOPUSH_WID ( 1)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_DMI_NOPUSH_MSK (0x00040000)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_DMI_NOPUSH_MAX (0x00000001)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_DMI_NOPUSH_DEF (0x00000000)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_RO_PASS_NP_OFF (19)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_RO_PASS_NP_WID ( 1)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_RO_PASS_NP_MSK (0x00080000)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_RO_PASS_NP_MAX (0x00000001)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_RO_PASS_NP_DEF (0x00000000)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_RST_CRD_P3_OFF (20)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_RST_CRD_P3_WID ( 1)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_RST_CRD_P3_MSK (0x00100000)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_RST_CRD_P3_MAX (0x00000001)
+ #define HUBS_CR_HUB0_DEFEATURE_HUBS_RST_CRD_P3_DEF (0x00000000)
+
+#define HUBS_CR_HUB1_DEFEATURE_HUBS_REG (0x00007020)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_BLK_GNT_P1_OFF ( 0)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_BLK_GNT_P1_WID ( 1)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_BLK_GNT_P1_MSK (0x00000001)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_BLK_GNT_P1_MAX (0x00000001)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_BLK_GNT_P1_DEF (0x00000000)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_BLK_GNT_P2_OFF ( 1)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_BLK_GNT_P2_WID ( 1)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_BLK_GNT_P2_MSK (0x00000002)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_BLK_GNT_P2_MAX (0x00000001)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_BLK_GNT_P2_DEF (0x00000000)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_BLK_PUT_P0_OFF ( 2)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_BLK_PUT_P0_WID ( 1)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_BLK_PUT_P0_MSK (0x00000004)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_BLK_PUT_P0_MAX (0x00000001)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_BLK_PUT_P0_DEF (0x00000000)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_BLK_PUT_P1_OFF ( 3)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_BLK_PUT_P1_WID ( 1)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_BLK_PUT_P1_MSK (0x00000008)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_BLK_PUT_P1_MAX (0x00000001)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_BLK_PUT_P1_DEF (0x00000000)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_BLK_PUT_P2_OFF ( 4)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_BLK_PUT_P2_WID ( 1)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_BLK_PUT_P2_MSK (0x00000010)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_BLK_PUT_P2_MAX (0x00000001)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_BLK_PUT_P2_DEF (0x00000000)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_BLK_PUT_P3_OFF ( 5)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_BLK_PUT_P3_WID ( 1)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_BLK_PUT_P3_MSK (0x00000020)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_BLK_PUT_P3_MAX (0x00000001)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_BLK_PUT_P3_DEF (0x00000000)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_NO_CHAIN_P1_OFF ( 6)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_NO_CHAIN_P1_WID ( 1)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_NO_CHAIN_P1_MSK (0x00000040)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_NO_CHAIN_P1_MAX (0x00000001)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_NO_CHAIN_P1_DEF (0x00000000)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_NO_CHAIN_P2_OFF ( 7)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_NO_CHAIN_P2_WID ( 1)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_NO_CHAIN_P2_MSK (0x00000080)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_NO_CHAIN_P2_MAX (0x00000001)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_NO_CHAIN_P2_DEF (0x00000000)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_SLOW_UP_P0_OFF ( 8)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_SLOW_UP_P0_WID ( 1)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_SLOW_UP_P0_MSK (0x00000100)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_SLOW_UP_P0_MAX (0x00000001)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_SLOW_UP_P0_DEF (0x00000000)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_SLOW_UP_P1_OFF ( 9)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_SLOW_UP_P1_WID ( 1)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_SLOW_UP_P1_MSK (0x00000200)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_SLOW_UP_P1_MAX (0x00000001)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_SLOW_UP_P1_DEF (0x00000000)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_SLOW_UP_P2_OFF (10)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_SLOW_UP_P2_WID ( 1)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_SLOW_UP_P2_MSK (0x00000400)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_SLOW_UP_P2_MAX (0x00000001)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_SLOW_UP_P2_DEF (0x00000000)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_SLOW_DN_P1_OFF (11)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_SLOW_DN_P1_WID ( 1)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_SLOW_DN_P1_MSK (0x00000800)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_SLOW_DN_P1_MAX (0x00000001)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_SLOW_DN_P1_DEF (0x00000000)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_SLOW_DN_P2_OFF (12)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_SLOW_DN_P2_WID ( 1)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_SLOW_DN_P2_MSK (0x00001000)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_SLOW_DN_P2_MAX (0x00000001)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_SLOW_DN_P2_DEF (0x00000000)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_SLOW_DN_P3_OFF (13)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_SLOW_DN_P3_WID ( 1)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_SLOW_DN_P3_MSK (0x00002000)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_SLOW_DN_P3_MAX (0x00000001)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_SLOW_DN_P3_DEF (0x00000000)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_SLOWER_CMD_OFF (14)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_SLOWER_CMD_WID ( 1)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_SLOWER_CMD_MSK (0x00004000)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_SLOWER_CMD_MAX (0x00000001)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_SLOWER_CMD_DEF (0x00000000)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_RO_PASS_NP_OFF (15)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_RO_PASS_NP_WID ( 1)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_RO_PASS_NP_MSK (0x00008000)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_RO_PASS_NP_MAX (0x00000001)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_RO_PASS_NP_DEF (0x00000000)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_RST_CRD_P0_OFF (16)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_RST_CRD_P0_WID ( 1)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_RST_CRD_P0_MSK (0x00010000)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_RST_CRD_P0_MAX (0x00000001)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_RST_CRD_P0_DEF (0x00000000)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_RST_CRD_P3_OFF (17)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_RST_CRD_P3_WID ( 1)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_RST_CRD_P3_MSK (0x00020000)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_RST_CRD_P3_MAX (0x00000001)
+ #define HUBS_CR_HUB1_DEFEATURE_HUBS_RST_CRD_P3_DEF (0x00000000)
+
+#define HUBS_CR_HUB2_DEFEATURE_HUBS_REG (0x00007024)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_BLK_GNT_P1_OFF ( 0)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_BLK_GNT_P1_WID ( 1)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_BLK_GNT_P1_MSK (0x00000001)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_BLK_GNT_P1_MAX (0x00000001)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_BLK_GNT_P1_DEF (0x00000000)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_BLK_GNT_P2_OFF ( 1)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_BLK_GNT_P2_WID ( 1)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_BLK_GNT_P2_MSK (0x00000002)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_BLK_GNT_P2_MAX (0x00000001)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_BLK_GNT_P2_DEF (0x00000000)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_BLK_PUT_P0_OFF ( 2)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_BLK_PUT_P0_WID ( 1)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_BLK_PUT_P0_MSK (0x00000004)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_BLK_PUT_P0_MAX (0x00000001)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_BLK_PUT_P0_DEF (0x00000000)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_BLK_PUT_P1_OFF ( 3)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_BLK_PUT_P1_WID ( 1)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_BLK_PUT_P1_MSK (0x00000008)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_BLK_PUT_P1_MAX (0x00000001)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_BLK_PUT_P1_DEF (0x00000000)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_BLK_PUT_P2_OFF ( 4)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_BLK_PUT_P2_WID ( 1)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_BLK_PUT_P2_MSK (0x00000010)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_BLK_PUT_P2_MAX (0x00000001)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_BLK_PUT_P2_DEF (0x00000000)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_NO_CHAIN_P1_OFF ( 5)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_NO_CHAIN_P1_WID ( 1)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_NO_CHAIN_P1_MSK (0x00000020)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_NO_CHAIN_P1_MAX (0x00000001)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_NO_CHAIN_P1_DEF (0x00000000)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_NO_CHAIN_P2_OFF ( 6)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_NO_CHAIN_P2_WID ( 1)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_NO_CHAIN_P2_MSK (0x00000040)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_NO_CHAIN_P2_MAX (0x00000001)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_NO_CHAIN_P2_DEF (0x00000000)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_SLOW_UP_P0_OFF ( 7)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_SLOW_UP_P0_WID ( 1)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_SLOW_UP_P0_MSK (0x00000080)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_SLOW_UP_P0_MAX (0x00000001)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_SLOW_UP_P0_DEF (0x00000000)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_SLOW_UP_P1_OFF ( 8)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_SLOW_UP_P1_WID ( 1)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_SLOW_UP_P1_MSK (0x00000100)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_SLOW_UP_P1_MAX (0x00000001)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_SLOW_UP_P1_DEF (0x00000000)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_SLOW_UP_P2_OFF ( 9)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_SLOW_UP_P2_WID ( 1)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_SLOW_UP_P2_MSK (0x00000200)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_SLOW_UP_P2_MAX (0x00000001)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_SLOW_UP_P2_DEF (0x00000000)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_SLOW_DN_P1_OFF (10)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_SLOW_DN_P1_WID ( 1)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_SLOW_DN_P1_MSK (0x00000400)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_SLOW_DN_P1_MAX (0x00000001)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_SLOW_DN_P1_DEF (0x00000000)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_SLOW_DN_P2_OFF (11)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_SLOW_DN_P2_WID ( 1)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_SLOW_DN_P2_MSK (0x00000800)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_SLOW_DN_P2_MAX (0x00000001)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_SLOW_DN_P2_DEF (0x00000000)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_SLOWER_CMD_OFF (12)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_SLOWER_CMD_WID ( 1)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_SLOWER_CMD_MSK (0x00001000)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_SLOWER_CMD_MAX (0x00000001)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_SLOWER_CMD_DEF (0x00000000)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_RST_CRD_P0_OFF (13)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_RST_CRD_P0_WID ( 1)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_RST_CRD_P0_MSK (0x00002000)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_RST_CRD_P0_MAX (0x00000001)
+ #define HUBS_CR_HUB2_DEFEATURE_HUBS_RST_CRD_P0_DEF (0x00000000)
+
+#define HUBS_CR_PEGCTL_HUBS_REG (0x00007028)
+ #define HUBS_CR_PEGCTL_HUBS_PCIPWRGAT_OFF ( 0)
+ #define HUBS_CR_PEGCTL_HUBS_PCIPWRGAT_WID ( 1)
+ #define HUBS_CR_PEGCTL_HUBS_PCIPWRGAT_MSK (0x00000001)
+ #define HUBS_CR_PEGCTL_HUBS_PCIPWRGAT_MAX (0x00000001)
+ #define HUBS_CR_PEGCTL_HUBS_PCIPWRGAT_DEF (0x00000000)
+
+#define HUBS_CR_HUB_EMPTY_HUBS_REG (0x0000702C)
+ #define HUBS_CR_HUB_EMPTY_HUBS_H0_EMPTY_OFF ( 0)
+ #define HUBS_CR_HUB_EMPTY_HUBS_H0_EMPTY_WID ( 1)
+ #define HUBS_CR_HUB_EMPTY_HUBS_H0_EMPTY_MSK (0x00000001)
+ #define HUBS_CR_HUB_EMPTY_HUBS_H0_EMPTY_MAX (0x00000001)
+ #define HUBS_CR_HUB_EMPTY_HUBS_H0_EMPTY_DEF (0x00000001)
+ #define HUBS_CR_HUB_EMPTY_HUBS_H1_EMPTY_OFF ( 1)
+ #define HUBS_CR_HUB_EMPTY_HUBS_H1_EMPTY_WID ( 1)
+ #define HUBS_CR_HUB_EMPTY_HUBS_H1_EMPTY_MSK (0x00000002)
+ #define HUBS_CR_HUB_EMPTY_HUBS_H1_EMPTY_MAX (0x00000001)
+ #define HUBS_CR_HUB_EMPTY_HUBS_H1_EMPTY_DEF (0x00000001)
+ #define HUBS_CR_HUB_EMPTY_HUBS_H2_EMPTY_OFF ( 2)
+ #define HUBS_CR_HUB_EMPTY_HUBS_H2_EMPTY_WID ( 1)
+ #define HUBS_CR_HUB_EMPTY_HUBS_H2_EMPTY_MSK (0x00000004)
+ #define HUBS_CR_HUB_EMPTY_HUBS_H2_EMPTY_MAX (0x00000001)
+ #define HUBS_CR_HUB_EMPTY_HUBS_H2_EMPTY_DEF (0x00000001)
+
+#define HUBS_CR_HUB0_STATUS_HUBS_REG (0x00007030)
+ #define HUBS_CR_HUB0_STATUS_HUBS_REQ_VLD_P0_OFF ( 0)
+ #define HUBS_CR_HUB0_STATUS_HUBS_REQ_VLD_P0_WID ( 1)
+ #define HUBS_CR_HUB0_STATUS_HUBS_REQ_VLD_P0_MSK (0x00000001)
+ #define HUBS_CR_HUB0_STATUS_HUBS_REQ_VLD_P0_MAX (0x00000001)
+ #define HUBS_CR_HUB0_STATUS_HUBS_REQ_VLD_P0_DEF (0x00000000)
+ #define HUBS_CR_HUB0_STATUS_HUBS_REQ_VLD_P1_OFF ( 1)
+ #define HUBS_CR_HUB0_STATUS_HUBS_REQ_VLD_P1_WID ( 1)
+ #define HUBS_CR_HUB0_STATUS_HUBS_REQ_VLD_P1_MSK (0x00000002)
+ #define HUBS_CR_HUB0_STATUS_HUBS_REQ_VLD_P1_MAX (0x00000001)
+ #define HUBS_CR_HUB0_STATUS_HUBS_REQ_VLD_P1_DEF (0x00000000)
+ #define HUBS_CR_HUB0_STATUS_HUBS_REQ_VLD_P2_OFF ( 2)
+ #define HUBS_CR_HUB0_STATUS_HUBS_REQ_VLD_P2_WID ( 1)
+ #define HUBS_CR_HUB0_STATUS_HUBS_REQ_VLD_P2_MSK (0x00000004)
+ #define HUBS_CR_HUB0_STATUS_HUBS_REQ_VLD_P2_MAX (0x00000001)
+ #define HUBS_CR_HUB0_STATUS_HUBS_REQ_VLD_P2_DEF (0x00000000)
+ #define HUBS_CR_HUB0_STATUS_HUBS_REQ_VLD_P3_OFF ( 3)
+ #define HUBS_CR_HUB0_STATUS_HUBS_REQ_VLD_P3_WID ( 1)
+ #define HUBS_CR_HUB0_STATUS_HUBS_REQ_VLD_P3_MSK (0x00000008)
+ #define HUBS_CR_HUB0_STATUS_HUBS_REQ_VLD_P3_MAX (0x00000001)
+ #define HUBS_CR_HUB0_STATUS_HUBS_REQ_VLD_P3_DEF (0x00000000)
+ #define HUBS_CR_HUB0_STATUS_HUBS_TNX_VLD_P0_OFF ( 4)
+ #define HUBS_CR_HUB0_STATUS_HUBS_TNX_VLD_P0_WID ( 1)
+ #define HUBS_CR_HUB0_STATUS_HUBS_TNX_VLD_P0_MSK (0x00000010)
+ #define HUBS_CR_HUB0_STATUS_HUBS_TNX_VLD_P0_MAX (0x00000001)
+ #define HUBS_CR_HUB0_STATUS_HUBS_TNX_VLD_P0_DEF (0x00000000)
+ #define HUBS_CR_HUB0_STATUS_HUBS_TNX_VLD_P1_OFF ( 5)
+ #define HUBS_CR_HUB0_STATUS_HUBS_TNX_VLD_P1_WID ( 1)
+ #define HUBS_CR_HUB0_STATUS_HUBS_TNX_VLD_P1_MSK (0x00000020)
+ #define HUBS_CR_HUB0_STATUS_HUBS_TNX_VLD_P1_MAX (0x00000001)
+ #define HUBS_CR_HUB0_STATUS_HUBS_TNX_VLD_P1_DEF (0x00000000)
+ #define HUBS_CR_HUB0_STATUS_HUBS_TNX_VLD_P2_OFF ( 6)
+ #define HUBS_CR_HUB0_STATUS_HUBS_TNX_VLD_P2_WID ( 1)
+ #define HUBS_CR_HUB0_STATUS_HUBS_TNX_VLD_P2_MSK (0x00000040)
+ #define HUBS_CR_HUB0_STATUS_HUBS_TNX_VLD_P2_MAX (0x00000001)
+ #define HUBS_CR_HUB0_STATUS_HUBS_TNX_VLD_P2_DEF (0x00000000)
+ #define HUBS_CR_HUB0_STATUS_HUBS_TNX_VLD_P3_OFF ( 7)
+ #define HUBS_CR_HUB0_STATUS_HUBS_TNX_VLD_P3_WID ( 1)
+ #define HUBS_CR_HUB0_STATUS_HUBS_TNX_VLD_P3_MSK (0x00000080)
+ #define HUBS_CR_HUB0_STATUS_HUBS_TNX_VLD_P3_MAX (0x00000001)
+ #define HUBS_CR_HUB0_STATUS_HUBS_TNX_VLD_P3_DEF (0x00000000)
+
+#define HUBS_CR_HUB1_STATUS_HUBS_REG (0x00007034)
+ #define HUBS_CR_HUB1_STATUS_HUBS_REQ_VLD_P0_OFF ( 0)
+ #define HUBS_CR_HUB1_STATUS_HUBS_REQ_VLD_P0_WID ( 1)
+ #define HUBS_CR_HUB1_STATUS_HUBS_REQ_VLD_P0_MSK (0x00000001)
+ #define HUBS_CR_HUB1_STATUS_HUBS_REQ_VLD_P0_MAX (0x00000001)
+ #define HUBS_CR_HUB1_STATUS_HUBS_REQ_VLD_P0_DEF (0x00000000)
+ #define HUBS_CR_HUB1_STATUS_HUBS_REQ_VLD_P1_OFF ( 1)
+ #define HUBS_CR_HUB1_STATUS_HUBS_REQ_VLD_P1_WID ( 1)
+ #define HUBS_CR_HUB1_STATUS_HUBS_REQ_VLD_P1_MSK (0x00000002)
+ #define HUBS_CR_HUB1_STATUS_HUBS_REQ_VLD_P1_MAX (0x00000001)
+ #define HUBS_CR_HUB1_STATUS_HUBS_REQ_VLD_P1_DEF (0x00000000)
+ #define HUBS_CR_HUB1_STATUS_HUBS_REQ_VLD_P2_OFF ( 2)
+ #define HUBS_CR_HUB1_STATUS_HUBS_REQ_VLD_P2_WID ( 1)
+ #define HUBS_CR_HUB1_STATUS_HUBS_REQ_VLD_P2_MSK (0x00000004)
+ #define HUBS_CR_HUB1_STATUS_HUBS_REQ_VLD_P2_MAX (0x00000001)
+ #define HUBS_CR_HUB1_STATUS_HUBS_REQ_VLD_P2_DEF (0x00000000)
+ #define HUBS_CR_HUB1_STATUS_HUBS_REQ_VLD_P3_OFF ( 3)
+ #define HUBS_CR_HUB1_STATUS_HUBS_REQ_VLD_P3_WID ( 1)
+ #define HUBS_CR_HUB1_STATUS_HUBS_REQ_VLD_P3_MSK (0x00000008)
+ #define HUBS_CR_HUB1_STATUS_HUBS_REQ_VLD_P3_MAX (0x00000001)
+ #define HUBS_CR_HUB1_STATUS_HUBS_REQ_VLD_P3_DEF (0x00000000)
+ #define HUBS_CR_HUB1_STATUS_HUBS_TNX_VLD_P0_OFF ( 4)
+ #define HUBS_CR_HUB1_STATUS_HUBS_TNX_VLD_P0_WID ( 1)
+ #define HUBS_CR_HUB1_STATUS_HUBS_TNX_VLD_P0_MSK (0x00000010)
+ #define HUBS_CR_HUB1_STATUS_HUBS_TNX_VLD_P0_MAX (0x00000001)
+ #define HUBS_CR_HUB1_STATUS_HUBS_TNX_VLD_P0_DEF (0x00000000)
+ #define HUBS_CR_HUB1_STATUS_HUBS_TNX_VLD_P1_OFF ( 5)
+ #define HUBS_CR_HUB1_STATUS_HUBS_TNX_VLD_P1_WID ( 1)
+ #define HUBS_CR_HUB1_STATUS_HUBS_TNX_VLD_P1_MSK (0x00000020)
+ #define HUBS_CR_HUB1_STATUS_HUBS_TNX_VLD_P1_MAX (0x00000001)
+ #define HUBS_CR_HUB1_STATUS_HUBS_TNX_VLD_P1_DEF (0x00000000)
+ #define HUBS_CR_HUB1_STATUS_HUBS_TNX_VLD_P2_OFF ( 6)
+ #define HUBS_CR_HUB1_STATUS_HUBS_TNX_VLD_P2_WID ( 1)
+ #define HUBS_CR_HUB1_STATUS_HUBS_TNX_VLD_P2_MSK (0x00000040)
+ #define HUBS_CR_HUB1_STATUS_HUBS_TNX_VLD_P2_MAX (0x00000001)
+ #define HUBS_CR_HUB1_STATUS_HUBS_TNX_VLD_P2_DEF (0x00000000)
+ #define HUBS_CR_HUB1_STATUS_HUBS_TNX_VLD_P3_OFF ( 7)
+ #define HUBS_CR_HUB1_STATUS_HUBS_TNX_VLD_P3_WID ( 1)
+ #define HUBS_CR_HUB1_STATUS_HUBS_TNX_VLD_P3_MSK (0x00000080)
+ #define HUBS_CR_HUB1_STATUS_HUBS_TNX_VLD_P3_MAX (0x00000001)
+ #define HUBS_CR_HUB1_STATUS_HUBS_TNX_VLD_P3_DEF (0x00000000)
+
+#define HUBS_CR_HUB2_STATUS_HUBS_REG (0x00007038)
+ #define HUBS_CR_HUB2_STATUS_HUBS_REQ_VLD_P0_OFF ( 0)
+ #define HUBS_CR_HUB2_STATUS_HUBS_REQ_VLD_P0_WID ( 1)
+ #define HUBS_CR_HUB2_STATUS_HUBS_REQ_VLD_P0_MSK (0x00000001)
+ #define HUBS_CR_HUB2_STATUS_HUBS_REQ_VLD_P0_MAX (0x00000001)
+ #define HUBS_CR_HUB2_STATUS_HUBS_REQ_VLD_P0_DEF (0x00000000)
+ #define HUBS_CR_HUB2_STATUS_HUBS_REQ_VLD_P1_OFF ( 1)
+ #define HUBS_CR_HUB2_STATUS_HUBS_REQ_VLD_P1_WID ( 1)
+ #define HUBS_CR_HUB2_STATUS_HUBS_REQ_VLD_P1_MSK (0x00000002)
+ #define HUBS_CR_HUB2_STATUS_HUBS_REQ_VLD_P1_MAX (0x00000001)
+ #define HUBS_CR_HUB2_STATUS_HUBS_REQ_VLD_P1_DEF (0x00000000)
+ #define HUBS_CR_HUB2_STATUS_HUBS_REQ_VLD_P2_OFF ( 2)
+ #define HUBS_CR_HUB2_STATUS_HUBS_REQ_VLD_P2_WID ( 1)
+ #define HUBS_CR_HUB2_STATUS_HUBS_REQ_VLD_P2_MSK (0x00000004)
+ #define HUBS_CR_HUB2_STATUS_HUBS_REQ_VLD_P2_MAX (0x00000001)
+ #define HUBS_CR_HUB2_STATUS_HUBS_REQ_VLD_P2_DEF (0x00000000)
+ #define HUBS_CR_HUB2_STATUS_HUBS_REQ_VLD_P3_OFF ( 3)
+ #define HUBS_CR_HUB2_STATUS_HUBS_REQ_VLD_P3_WID ( 1)
+ #define HUBS_CR_HUB2_STATUS_HUBS_REQ_VLD_P3_MSK (0x00000008)
+ #define HUBS_CR_HUB2_STATUS_HUBS_REQ_VLD_P3_MAX (0x00000001)
+ #define HUBS_CR_HUB2_STATUS_HUBS_REQ_VLD_P3_DEF (0x00000000)
+ #define HUBS_CR_HUB2_STATUS_HUBS_TNX_VLD_P0_OFF ( 4)
+ #define HUBS_CR_HUB2_STATUS_HUBS_TNX_VLD_P0_WID ( 1)
+ #define HUBS_CR_HUB2_STATUS_HUBS_TNX_VLD_P0_MSK (0x00000010)
+ #define HUBS_CR_HUB2_STATUS_HUBS_TNX_VLD_P0_MAX (0x00000001)
+ #define HUBS_CR_HUB2_STATUS_HUBS_TNX_VLD_P0_DEF (0x00000000)
+ #define HUBS_CR_HUB2_STATUS_HUBS_TNX_VLD_P1_OFF ( 5)
+ #define HUBS_CR_HUB2_STATUS_HUBS_TNX_VLD_P1_WID ( 1)
+ #define HUBS_CR_HUB2_STATUS_HUBS_TNX_VLD_P1_MSK (0x00000020)
+ #define HUBS_CR_HUB2_STATUS_HUBS_TNX_VLD_P1_MAX (0x00000001)
+ #define HUBS_CR_HUB2_STATUS_HUBS_TNX_VLD_P1_DEF (0x00000000)
+ #define HUBS_CR_HUB2_STATUS_HUBS_TNX_VLD_P2_OFF ( 6)
+ #define HUBS_CR_HUB2_STATUS_HUBS_TNX_VLD_P2_WID ( 1)
+ #define HUBS_CR_HUB2_STATUS_HUBS_TNX_VLD_P2_MSK (0x00000040)
+ #define HUBS_CR_HUB2_STATUS_HUBS_TNX_VLD_P2_MAX (0x00000001)
+ #define HUBS_CR_HUB2_STATUS_HUBS_TNX_VLD_P2_DEF (0x00000000)
+ #define HUBS_CR_HUB2_STATUS_HUBS_TNX_VLD_P3_OFF ( 7)
+ #define HUBS_CR_HUB2_STATUS_HUBS_TNX_VLD_P3_WID ( 1)
+ #define HUBS_CR_HUB2_STATUS_HUBS_TNX_VLD_P3_MSK (0x00000080)
+ #define HUBS_CR_HUB2_STATUS_HUBS_TNX_VLD_P3_MAX (0x00000001)
+ #define HUBS_CR_HUB2_STATUS_HUBS_TNX_VLD_P3_DEF (0x00000000)
+
+#define HUBS_CR_VISA_CTL_SABHUB0S_HUBS_REG (0x00007100)
+ #define HUBS_CR_VISA_CTL_SABHUB0S_HUBS_Data_OFF ( 0)
+ #define HUBS_CR_VISA_CTL_SABHUB0S_HUBS_Data_WID (18)
+ #define HUBS_CR_VISA_CTL_SABHUB0S_HUBS_Data_MSK (0x0003FFFF)
+ #define HUBS_CR_VISA_CTL_SABHUB0S_HUBS_Data_MAX (0x0003FFFF)
+ #define HUBS_CR_VISA_CTL_SABHUB0S_HUBS_Data_DEF (0x00000000)
+ #define HUBS_CR_VISA_CTL_SABHUB0S_HUBS_VORANGE_OFF (31)
+ #define HUBS_CR_VISA_CTL_SABHUB0S_HUBS_VORANGE_WID ( 1)
+ #define HUBS_CR_VISA_CTL_SABHUB0S_HUBS_VORANGE_MSK (0x80000000)
+ #define HUBS_CR_VISA_CTL_SABHUB0S_HUBS_VORANGE_MAX (0x00000001)
+ #define HUBS_CR_VISA_CTL_SABHUB0S_HUBS_VORANGE_DEF (0x00000000)
+
+#define HUBS_CR_VISA_CTL_SABHUB1S_HUBS_REG (0x00007110)
+ #define HUBS_CR_VISA_CTL_SABHUB1S_HUBS_Data_OFF ( 0)
+ #define HUBS_CR_VISA_CTL_SABHUB1S_HUBS_Data_WID (18)
+ #define HUBS_CR_VISA_CTL_SABHUB1S_HUBS_Data_MSK (0x0003FFFF)
+ #define HUBS_CR_VISA_CTL_SABHUB1S_HUBS_Data_MAX (0x0003FFFF)
+ #define HUBS_CR_VISA_CTL_SABHUB1S_HUBS_Data_DEF (0x00000000)
+ #define HUBS_CR_VISA_CTL_SABHUB1S_HUBS_VORANGE_OFF (31)
+ #define HUBS_CR_VISA_CTL_SABHUB1S_HUBS_VORANGE_WID ( 1)
+ #define HUBS_CR_VISA_CTL_SABHUB1S_HUBS_VORANGE_MSK (0x80000000)
+ #define HUBS_CR_VISA_CTL_SABHUB1S_HUBS_VORANGE_MAX (0x00000001)
+ #define HUBS_CR_VISA_CTL_SABHUB1S_HUBS_VORANGE_DEF (0x00000000)
+
+#define HUBS_CR_VISA_CTL_SABHUB2S_HUBS_REG (0x00007120)
+ #define HUBS_CR_VISA_CTL_SABHUB2S_HUBS_Data_OFF ( 0)
+ #define HUBS_CR_VISA_CTL_SABHUB2S_HUBS_Data_WID (18)
+ #define HUBS_CR_VISA_CTL_SABHUB2S_HUBS_Data_MSK (0x0003FFFF)
+ #define HUBS_CR_VISA_CTL_SABHUB2S_HUBS_Data_MAX (0x0003FFFF)
+ #define HUBS_CR_VISA_CTL_SABHUB2S_HUBS_Data_DEF (0x00000000)
+ #define HUBS_CR_VISA_CTL_SABHUB2S_HUBS_VORANGE_OFF (31)
+ #define HUBS_CR_VISA_CTL_SABHUB2S_HUBS_VORANGE_WID ( 1)
+ #define HUBS_CR_VISA_CTL_SABHUB2S_HUBS_VORANGE_MSK (0x80000000)
+ #define HUBS_CR_VISA_CTL_SABHUB2S_HUBS_VORANGE_MAX (0x00000001)
+ #define HUBS_CR_VISA_CTL_SABHUB2S_HUBS_VORANGE_DEF (0x00000000)
+
+#define HUBS_CR_MBOX_WR_DATA_HUBS_REG (0x00007124)
+ #define HUBS_CR_MBOX_WR_DATA_HUBS_DATA_OFF ( 0)
+ #define HUBS_CR_MBOX_WR_DATA_HUBS_DATA_WID (32)
+ #define HUBS_CR_MBOX_WR_DATA_HUBS_DATA_MSK (0xFFFFFFFF)
+ #define HUBS_CR_MBOX_WR_DATA_HUBS_DATA_MAX (0xFFFFFFFF)
+ #define HUBS_CR_MBOX_WR_DATA_HUBS_DATA_DEF (0x00000000)
+
+#define HUBS_CR_MBOX_RD_DATA_HUBS_REG (0x00007128)
+ #define HUBS_CR_MBOX_RD_DATA_HUBS_DATA_OFF ( 0)
+ #define HUBS_CR_MBOX_RD_DATA_HUBS_DATA_WID (32)
+ #define HUBS_CR_MBOX_RD_DATA_HUBS_DATA_MSK (0xFFFFFFFF)
+ #define HUBS_CR_MBOX_RD_DATA_HUBS_DATA_MAX (0xFFFFFFFF)
+ #define HUBS_CR_MBOX_RD_DATA_HUBS_DATA_DEF (0x00000000)
+
+#define HUBS_CR_MBOX_ADDR_LO_HUBS_REG (0x0000712C)
+ #define HUBS_CR_MBOX_ADDR_LO_HUBS_ADDR_OFF ( 0)
+ #define HUBS_CR_MBOX_ADDR_LO_HUBS_ADDR_WID (32)
+ #define HUBS_CR_MBOX_ADDR_LO_HUBS_ADDR_MSK (0xFFFFFFFF)
+ #define HUBS_CR_MBOX_ADDR_LO_HUBS_ADDR_MAX (0xFFFFFFFF)
+ #define HUBS_CR_MBOX_ADDR_LO_HUBS_ADDR_DEF (0x00000000)
+
+#define HUBS_CR_MBOX_ADDR_HI_HUBS_REG (0x00007130)
+ #define HUBS_CR_MBOX_ADDR_HI_HUBS_ADDR_OFF ( 0)
+ #define HUBS_CR_MBOX_ADDR_HI_HUBS_ADDR_WID (32)
+ #define HUBS_CR_MBOX_ADDR_HI_HUBS_ADDR_MSK (0xFFFFFFFF)
+ #define HUBS_CR_MBOX_ADDR_HI_HUBS_ADDR_MAX (0xFFFFFFFF)
+ #define HUBS_CR_MBOX_ADDR_HI_HUBS_ADDR_DEF (0x00000000)
+
+#define HUBS_CR_MBOX_CMD_LO_HUBS_REG (0x00007134)
+ #define HUBS_CR_MBOX_CMD_LO_HUBS_FBE_OFF ( 0)
+ #define HUBS_CR_MBOX_CMD_LO_HUBS_FBE_WID ( 4)
+ #define HUBS_CR_MBOX_CMD_LO_HUBS_FBE_MSK (0x0000000F)
+ #define HUBS_CR_MBOX_CMD_LO_HUBS_FBE_MAX (0x0000000F)
+ #define HUBS_CR_MBOX_CMD_LO_HUBS_FBE_DEF (0x00000000)
+ #define HUBS_CR_MBOX_CMD_LO_HUBS_LBE_OFF ( 4)
+ #define HUBS_CR_MBOX_CMD_LO_HUBS_LBE_WID ( 4)
+ #define HUBS_CR_MBOX_CMD_LO_HUBS_LBE_MSK (0x000000F0)
+ #define HUBS_CR_MBOX_CMD_LO_HUBS_LBE_MAX (0x0000000F)
+ #define HUBS_CR_MBOX_CMD_LO_HUBS_LBE_DEF (0x00000000)
+ #define HUBS_CR_MBOX_CMD_LO_HUBS_TAG_OFF ( 8)
+ #define HUBS_CR_MBOX_CMD_LO_HUBS_TAG_WID ( 8)
+ #define HUBS_CR_MBOX_CMD_LO_HUBS_TAG_MSK (0x0000FF00)
+ #define HUBS_CR_MBOX_CMD_LO_HUBS_TAG_MAX (0x000000FF)
+ #define HUBS_CR_MBOX_CMD_LO_HUBS_TAG_DEF (0x00000000)
+ #define HUBS_CR_MBOX_CMD_LO_HUBS_RQID_OFF (16)
+ #define HUBS_CR_MBOX_CMD_LO_HUBS_RQID_WID (16)
+ #define HUBS_CR_MBOX_CMD_LO_HUBS_RQID_MSK (0xFFFF0000)
+ #define HUBS_CR_MBOX_CMD_LO_HUBS_RQID_MAX (0x0000FFFF)
+ #define HUBS_CR_MBOX_CMD_LO_HUBS_RQID_DEF (0x00000000)
+
+#define HUBS_CR_MBOX_CMD_HI_HUBS_REG (0x00007138)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_AT_OFF ( 0)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_AT_WID ( 2)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_AT_MSK (0x00000003)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_AT_MAX (0x00000003)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_AT_DEF (0x00000000)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_POISON_OFF ( 2)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_POISON_WID ( 1)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_POISON_MSK (0x00000004)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_POISON_MAX (0x00000001)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_POISON_DEF (0x00000000)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_LENGTH_OFF ( 3)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_LENGTH_WID ( 5)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_LENGTH_MSK (0x000000F8)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_LENGTH_MAX (0x0000001F)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_LENGTH_DEF (0x00000000)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_RELAXED_OFF ( 8)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_RELAXED_WID ( 1)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_RELAXED_MSK (0x00000100)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_RELAXED_MAX (0x00000001)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_RELAXED_DEF (0x00000000)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_NOSNOOP_OFF ( 9)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_NOSNOOP_WID ( 1)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_NOSNOOP_MSK (0x00000200)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_NOSNOOP_MAX (0x00000001)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_NOSNOOP_DEF (0x00000000)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_CHAIN_OFF (10)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_CHAIN_WID ( 1)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_CHAIN_MSK (0x00000400)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_CHAIN_MAX (0x00000001)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_CHAIN_DEF (0x00000000)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_CTYPE_OFF (11)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_CTYPE_WID ( 5)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_CTYPE_MSK (0x0000F800)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_CTYPE_MAX (0x0000001F)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_CTYPE_DEF (0x00000000)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_FMT_OFF (16)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_FMT_WID ( 2)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_FMT_MSK (0x00030000)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_FMT_MAX (0x00000003)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_FMT_DEF (0x00000000)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_TC_OFF (18)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_TC_WID ( 4)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_TC_MSK (0x003C0000)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_TC_MAX (0x0000000F)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_TC_DEF (0x00000000)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_RESERVED_OFF (22)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_RESERVED_WID ( 2)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_RESERVED_MSK (0x00C00000)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_RESERVED_MAX (0x00000003)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_RESERVED_DEF (0x00000000)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_DMI_PRIV_OFF (24)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_DMI_PRIV_WID ( 1)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_DMI_PRIV_MSK (0x01000000)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_DMI_PRIV_MAX (0x00000001)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_DMI_PRIV_DEF (0x00000000)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_CHID_OFF (25)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_CHID_WID ( 4)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_CHID_MSK (0x1E000000)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_CHID_MAX (0x0000000F)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_CHID_DEF (0x00000000)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_RTYPE_OFF (29)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_RTYPE_WID ( 2)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_RTYPE_MSK (0x60000000)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_RTYPE_MAX (0x00000003)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_RTYPE_DEF (0x00000000)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_START_OFF (31)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_START_WID ( 1)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_START_MSK (0x80000000)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_START_MAX (0x00000001)
+ #define HUBS_CR_MBOX_CMD_HI_HUBS_START_DEF (0x00000000)
+
+#define HUBS_CR_MBOX_CFG_HUBS_REG (0x0000713C)
+ #define HUBS_CR_MBOX_CFG_HUBS_ENABLE_OFF ( 0)
+ #define HUBS_CR_MBOX_CFG_HUBS_ENABLE_WID ( 1)
+ #define HUBS_CR_MBOX_CFG_HUBS_ENABLE_MSK (0x00000001)
+ #define HUBS_CR_MBOX_CFG_HUBS_ENABLE_MAX (0x00000001)
+ #define HUBS_CR_MBOX_CFG_HUBS_ENABLE_DEF (0x00000000)
+ #define HUBS_CR_MBOX_CFG_HUBS_LOCK_IA_OFF ( 1)
+ #define HUBS_CR_MBOX_CFG_HUBS_LOCK_IA_WID ( 1)
+ #define HUBS_CR_MBOX_CFG_HUBS_LOCK_IA_MSK (0x00000002)
+ #define HUBS_CR_MBOX_CFG_HUBS_LOCK_IA_MAX (0x00000001)
+ #define HUBS_CR_MBOX_CFG_HUBS_LOCK_IA_DEF (0x00000001)
+ #define HUBS_CR_MBOX_CFG_HUBS_RESET_OFF ( 2)
+ #define HUBS_CR_MBOX_CFG_HUBS_RESET_WID ( 1)
+ #define HUBS_CR_MBOX_CFG_HUBS_RESET_MSK (0x00000004)
+ #define HUBS_CR_MBOX_CFG_HUBS_RESET_MAX (0x00000001)
+ #define HUBS_CR_MBOX_CFG_HUBS_RESET_DEF (0x00000000)
+ #define HUBS_CR_MBOX_CFG_HUBS_BLK_CYCLES_OFF ( 3)
+ #define HUBS_CR_MBOX_CFG_HUBS_BLK_CYCLES_WID ( 6)
+ #define HUBS_CR_MBOX_CFG_HUBS_BLK_CYCLES_MSK (0x000001F8)
+ #define HUBS_CR_MBOX_CFG_HUBS_BLK_CYCLES_MAX (0x0000003F)
+ #define HUBS_CR_MBOX_CFG_HUBS_BLK_CYCLES_DEF (0x00000000)
+ #define HUBS_CR_MBOX_CFG_HUBS_WR_DWORD_SEL_OFF ( 9)
+ #define HUBS_CR_MBOX_CFG_HUBS_WR_DWORD_SEL_WID ( 4)
+ #define HUBS_CR_MBOX_CFG_HUBS_WR_DWORD_SEL_MSK (0x00001E00)
+ #define HUBS_CR_MBOX_CFG_HUBS_WR_DWORD_SEL_MAX (0x0000000F)
+ #define HUBS_CR_MBOX_CFG_HUBS_WR_DWORD_SEL_DEF (0x00000000)
+ #define HUBS_CR_MBOX_CFG_HUBS_RD_DWORD_SEL_OFF (13)
+ #define HUBS_CR_MBOX_CFG_HUBS_RD_DWORD_SEL_WID ( 4)
+ #define HUBS_CR_MBOX_CFG_HUBS_RD_DWORD_SEL_MSK (0x0001E000)
+ #define HUBS_CR_MBOX_CFG_HUBS_RD_DWORD_SEL_MAX (0x0000000F)
+ #define HUBS_CR_MBOX_CFG_HUBS_RD_DWORD_SEL_DEF (0x00000000)
+ #define HUBS_CR_MBOX_CFG_HUBS_RPT_CMD_CNT_OFF (17)
+ #define HUBS_CR_MBOX_CFG_HUBS_RPT_CMD_CNT_WID ( 6)
+ #define HUBS_CR_MBOX_CFG_HUBS_RPT_CMD_CNT_MSK (0x007E0000)
+ #define HUBS_CR_MBOX_CFG_HUBS_RPT_CMD_CNT_MAX (0x0000003F)
+ #define HUBS_CR_MBOX_CFG_HUBS_RPT_CMD_CNT_DEF (0x00000000)
+ #define HUBS_CR_MBOX_CFG_HUBS_RPT_NXT_ADDR_OFF (23)
+ #define HUBS_CR_MBOX_CFG_HUBS_RPT_NXT_ADDR_WID ( 1)
+ #define HUBS_CR_MBOX_CFG_HUBS_RPT_NXT_ADDR_MSK (0x00800000)
+ #define HUBS_CR_MBOX_CFG_HUBS_RPT_NXT_ADDR_MAX (0x00000001)
+ #define HUBS_CR_MBOX_CFG_HUBS_RPT_NXT_ADDR_DEF (0x00000000)
+ #define HUBS_CR_MBOX_CFG_HUBS_RPT_NXT_PAGE_OFF (24)
+ #define HUBS_CR_MBOX_CFG_HUBS_RPT_NXT_PAGE_WID ( 1)
+ #define HUBS_CR_MBOX_CFG_HUBS_RPT_NXT_PAGE_MSK (0x01000000)
+ #define HUBS_CR_MBOX_CFG_HUBS_RPT_NXT_PAGE_MAX (0x00000001)
+ #define HUBS_CR_MBOX_CFG_HUBS_RPT_NXT_PAGE_DEF (0x00000000)
+ #define HUBS_CR_MBOX_CFG_HUBS_DIS_CMP_INV_OFF (25)
+ #define HUBS_CR_MBOX_CFG_HUBS_DIS_CMP_INV_WID ( 1)
+ #define HUBS_CR_MBOX_CFG_HUBS_DIS_CMP_INV_MSK (0x02000000)
+ #define HUBS_CR_MBOX_CFG_HUBS_DIS_CMP_INV_MAX (0x00000001)
+ #define HUBS_CR_MBOX_CFG_HUBS_DIS_CMP_INV_DEF (0x00000000)
+ #define HUBS_CR_MBOX_CFG_HUBS_FSM_STATE_OFF (26)
+ #define HUBS_CR_MBOX_CFG_HUBS_FSM_STATE_WID ( 4)
+ #define HUBS_CR_MBOX_CFG_HUBS_FSM_STATE_MSK (0x3C000000)
+ #define HUBS_CR_MBOX_CFG_HUBS_FSM_STATE_MAX (0x0000000F)
+ #define HUBS_CR_MBOX_CFG_HUBS_FSM_STATE_DEF (0x00000000)
+ #define HUBS_CR_MBOX_CFG_HUBS_P2P_ALL_OFF (30)
+ #define HUBS_CR_MBOX_CFG_HUBS_P2P_ALL_WID ( 1)
+ #define HUBS_CR_MBOX_CFG_HUBS_P2P_ALL_MSK (0x40000000)
+ #define HUBS_CR_MBOX_CFG_HUBS_P2P_ALL_MAX (0x00000001)
+ #define HUBS_CR_MBOX_CFG_HUBS_P2P_ALL_DEF (0x00000000)
+ #define HUBS_CR_MBOX_CFG_HUBS_SPARE_OFF (31)
+ #define HUBS_CR_MBOX_CFG_HUBS_SPARE_WID ( 1)
+ #define HUBS_CR_MBOX_CFG_HUBS_SPARE_MSK (0x80000000)
+ #define HUBS_CR_MBOX_CFG_HUBS_SPARE_MAX (0x00000001)
+ #define HUBS_CR_MBOX_CFG_HUBS_SPARE_DEF (0x00000000)
+
+#define HUBS_CR_MBOX_STATUS_HUBS_REG (0x00007140)
+ #define HUBS_CR_MBOX_STATUS_HUBS_FSM_STATE_OFF ( 0)
+ #define HUBS_CR_MBOX_STATUS_HUBS_FSM_STATE_WID ( 4)
+ #define HUBS_CR_MBOX_STATUS_HUBS_FSM_STATE_MSK (0x0000000F)
+ #define HUBS_CR_MBOX_STATUS_HUBS_FSM_STATE_MAX (0x0000000F)
+ #define HUBS_CR_MBOX_STATUS_HUBS_FSM_STATE_DEF (0x00000000)
+ #define HUBS_CR_MBOX_STATUS_HUBS_RPT_CMD_CNT_OFF ( 4)
+ #define HUBS_CR_MBOX_STATUS_HUBS_RPT_CMD_CNT_WID ( 6)
+ #define HUBS_CR_MBOX_STATUS_HUBS_RPT_CMD_CNT_MSK (0x000003F0)
+ #define HUBS_CR_MBOX_STATUS_HUBS_RPT_CMD_CNT_MAX (0x0000003F)
+ #define HUBS_CR_MBOX_STATUS_HUBS_RPT_CMD_CNT_DEF (0x00000000)
+ #define HUBS_CR_MBOX_STATUS_HUBS_OPCODE_OFF (10)
+ #define HUBS_CR_MBOX_STATUS_HUBS_OPCODE_WID ( 7)
+ #define HUBS_CR_MBOX_STATUS_HUBS_OPCODE_MSK (0x0001FC00)
+ #define HUBS_CR_MBOX_STATUS_HUBS_OPCODE_MAX (0x0000007F)
+ #define HUBS_CR_MBOX_STATUS_HUBS_OPCODE_DEF (0x00000000)
+ #define HUBS_CR_MBOX_STATUS_HUBS_WR_DWORD_SEL_OFF (17)
+ #define HUBS_CR_MBOX_STATUS_HUBS_WR_DWORD_SEL_WID ( 4)
+ #define HUBS_CR_MBOX_STATUS_HUBS_WR_DWORD_SEL_MSK (0x001E0000)
+ #define HUBS_CR_MBOX_STATUS_HUBS_WR_DWORD_SEL_MAX (0x0000000F)
+ #define HUBS_CR_MBOX_STATUS_HUBS_WR_DWORD_SEL_DEF (0x00000000)
+ #define HUBS_CR_MBOX_STATUS_HUBS_RD_DWORD_SEL_OFF (21)
+ #define HUBS_CR_MBOX_STATUS_HUBS_RD_DWORD_SEL_WID ( 4)
+ #define HUBS_CR_MBOX_STATUS_HUBS_RD_DWORD_SEL_MSK (0x01E00000)
+ #define HUBS_CR_MBOX_STATUS_HUBS_RD_DWORD_SEL_MAX (0x0000000F)
+ #define HUBS_CR_MBOX_STATUS_HUBS_RD_DWORD_SEL_DEF (0x00000000)
+ #define HUBS_CR_MBOX_STATUS_HUBS_P2P_RD_UP_OFF (25)
+ #define HUBS_CR_MBOX_STATUS_HUBS_P2P_RD_UP_WID ( 1)
+ #define HUBS_CR_MBOX_STATUS_HUBS_P2P_RD_UP_MSK (0x02000000)
+ #define HUBS_CR_MBOX_STATUS_HUBS_P2P_RD_UP_MAX (0x00000001)
+ #define HUBS_CR_MBOX_STATUS_HUBS_P2P_RD_UP_DEF (0x00000000)
+ #define HUBS_CR_MBOX_STATUS_HUBS_P2P_RD_DN_OFF (26)
+ #define HUBS_CR_MBOX_STATUS_HUBS_P2P_RD_DN_WID ( 1)
+ #define HUBS_CR_MBOX_STATUS_HUBS_P2P_RD_DN_MSK (0x04000000)
+ #define HUBS_CR_MBOX_STATUS_HUBS_P2P_RD_DN_MAX (0x00000001)
+ #define HUBS_CR_MBOX_STATUS_HUBS_P2P_RD_DN_DEF (0x00000000)
+ #define HUBS_CR_MBOX_STATUS_HUBS_SPARE_OFF (27)
+ #define HUBS_CR_MBOX_STATUS_HUBS_SPARE_WID ( 5)
+ #define HUBS_CR_MBOX_STATUS_HUBS_SPARE_MSK (0xF8000000)
+ #define HUBS_CR_MBOX_STATUS_HUBS_SPARE_MAX (0x0000001F)
+ #define HUBS_CR_MBOX_STATUS_HUBS_SPARE_DEF (0x00000000)
+
+#define HUBS_CR_HUB0_BLOCK_UP_HUBS_REG (0x00007144)
+ #define HUBS_CR_HUB0_BLOCK_UP_HUBS_XTM_CHID_OFF ( 0)
+ #define HUBS_CR_HUB0_BLOCK_UP_HUBS_XTM_CHID_WID ( 9)
+ #define HUBS_CR_HUB0_BLOCK_UP_HUBS_XTM_CHID_MSK (0x000001FF)
+ #define HUBS_CR_HUB0_BLOCK_UP_HUBS_XTM_CHID_MAX (0x000001FF)
+ #define HUBS_CR_HUB0_BLOCK_UP_HUBS_XTM_CHID_DEF (0x00000000)
+ #define HUBS_CR_HUB0_BLOCK_UP_HUBS_NP_OFF ( 9)
+ #define HUBS_CR_HUB0_BLOCK_UP_HUBS_NP_WID ( 1)
+ #define HUBS_CR_HUB0_BLOCK_UP_HUBS_NP_MSK (0x00000200)
+ #define HUBS_CR_HUB0_BLOCK_UP_HUBS_NP_MAX (0x00000001)
+ #define HUBS_CR_HUB0_BLOCK_UP_HUBS_NP_DEF (0x00000000)
+ #define HUBS_CR_HUB0_BLOCK_UP_HUBS_PC_OFF (10)
+ #define HUBS_CR_HUB0_BLOCK_UP_HUBS_PC_WID ( 1)
+ #define HUBS_CR_HUB0_BLOCK_UP_HUBS_PC_MSK (0x00000400)
+ #define HUBS_CR_HUB0_BLOCK_UP_HUBS_PC_MAX (0x00000001)
+ #define HUBS_CR_HUB0_BLOCK_UP_HUBS_PC_DEF (0x00000000)
+
+#define MPRDRTRN_CR_CRDTCTL0_IMPH_REG (0x00007400)
+ #define MPRDRTRN_CR_CRDTCTL0_IMPH_DMIVC0_PMIN_OFF ( 0)
+ #define MPRDRTRN_CR_CRDTCTL0_IMPH_DMIVC0_PMIN_WID ( 3)
+ #define MPRDRTRN_CR_CRDTCTL0_IMPH_DMIVC0_PMIN_MSK (0x00000007)
+ #define MPRDRTRN_CR_CRDTCTL0_IMPH_DMIVC0_PMIN_MAX (0x00000007)
+ #define MPRDRTRN_CR_CRDTCTL0_IMPH_P10VC0_PMIN_OFF ( 3)
+ #define MPRDRTRN_CR_CRDTCTL0_IMPH_P10VC0_PMIN_WID ( 3)
+ #define MPRDRTRN_CR_CRDTCTL0_IMPH_P10VC0_PMIN_MSK (0x00000038)
+ #define MPRDRTRN_CR_CRDTCTL0_IMPH_P10VC0_PMIN_MAX (0x00000007)
+ #define MPRDRTRN_CR_CRDTCTL0_IMPH_P11VC0_PMIN_OFF ( 6)
+ #define MPRDRTRN_CR_CRDTCTL0_IMPH_P11VC0_PMIN_WID ( 3)
+ #define MPRDRTRN_CR_CRDTCTL0_IMPH_P11VC0_PMIN_MSK (0x000001C0)
+ #define MPRDRTRN_CR_CRDTCTL0_IMPH_P11VC0_PMIN_MAX (0x00000007)
+ #define MPRDRTRN_CR_CRDTCTL0_IMPH_P12VC0_PMIN_OFF ( 9)
+ #define MPRDRTRN_CR_CRDTCTL0_IMPH_P12VC0_PMIN_WID ( 3)
+ #define MPRDRTRN_CR_CRDTCTL0_IMPH_P12VC0_PMIN_MSK (0x00000E00)
+ #define MPRDRTRN_CR_CRDTCTL0_IMPH_P12VC0_PMIN_MAX (0x00000007)
+ #define MPRDRTRN_CR_CRDTCTL0_IMPH_DEVC0_PMIN_OFF (12)
+ #define MPRDRTRN_CR_CRDTCTL0_IMPH_DEVC0_PMIN_WID ( 3)
+ #define MPRDRTRN_CR_CRDTCTL0_IMPH_DEVC0_PMIN_MSK (0x00007000)
+ #define MPRDRTRN_CR_CRDTCTL0_IMPH_DEVC0_PMIN_MAX (0x00000007)
+ #define MPRDRTRN_CR_CRDTCTL0_IMPH_DMIVCP_PMIN_OFF (15)
+ #define MPRDRTRN_CR_CRDTCTL0_IMPH_DMIVCP_PMIN_WID ( 3)
+ #define MPRDRTRN_CR_CRDTCTL0_IMPH_DMIVCP_PMIN_MSK (0x00038000)
+ #define MPRDRTRN_CR_CRDTCTL0_IMPH_DMIVCP_PMIN_MAX (0x00000007)
+ #define MPRDRTRN_CR_CRDTCTL0_IMPH_DMIVCM_PMIN_OFF (18)
+ #define MPRDRTRN_CR_CRDTCTL0_IMPH_DMIVCM_PMIN_WID ( 3)
+ #define MPRDRTRN_CR_CRDTCTL0_IMPH_DMIVCM_PMIN_MSK (0x001C0000)
+ #define MPRDRTRN_CR_CRDTCTL0_IMPH_DMIVCM_PMIN_MAX (0x00000007)
+ #define MPRDRTRN_CR_CRDTCTL0_IMPH_DMIVC1_PMIN_OFF (21)
+ #define MPRDRTRN_CR_CRDTCTL0_IMPH_DMIVC1_PMIN_WID ( 3)
+ #define MPRDRTRN_CR_CRDTCTL0_IMPH_DMIVC1_PMIN_MSK (0x00E00000)
+ #define MPRDRTRN_CR_CRDTCTL0_IMPH_DMIVC1_PMIN_MAX (0x00000007)
+
+#define MPRDRTRN_CR_CRDTCTL1_IMPH_REG (0x00007404)
+ #define MPRDRTRN_CR_CRDTCTL1_IMPH_DMIVC0_NPMIN_OFF ( 0)
+ #define MPRDRTRN_CR_CRDTCTL1_IMPH_DMIVC0_NPMIN_WID ( 3)
+ #define MPRDRTRN_CR_CRDTCTL1_IMPH_DMIVC0_NPMIN_MSK (0x00000007)
+ #define MPRDRTRN_CR_CRDTCTL1_IMPH_DMIVC0_NPMIN_MAX (0x00000007)
+ #define MPRDRTRN_CR_CRDTCTL1_IMPH_P10VC0_NPMIN_OFF ( 3)
+ #define MPRDRTRN_CR_CRDTCTL1_IMPH_P10VC0_NPMIN_WID ( 3)
+ #define MPRDRTRN_CR_CRDTCTL1_IMPH_P10VC0_NPMIN_MSK (0x00000038)
+ #define MPRDRTRN_CR_CRDTCTL1_IMPH_P10VC0_NPMIN_MAX (0x00000007)
+ #define MPRDRTRN_CR_CRDTCTL1_IMPH_P11VC0_NPMIN_OFF ( 6)
+ #define MPRDRTRN_CR_CRDTCTL1_IMPH_P11VC0_NPMIN_WID ( 3)
+ #define MPRDRTRN_CR_CRDTCTL1_IMPH_P11VC0_NPMIN_MSK (0x000001C0)
+ #define MPRDRTRN_CR_CRDTCTL1_IMPH_P11VC0_NPMIN_MAX (0x00000007)
+ #define MPRDRTRN_CR_CRDTCTL1_IMPH_P12VC0_NPMIN_OFF ( 9)
+ #define MPRDRTRN_CR_CRDTCTL1_IMPH_P12VC0_NPMIN_WID ( 3)
+ #define MPRDRTRN_CR_CRDTCTL1_IMPH_P12VC0_NPMIN_MSK (0x00000E00)
+ #define MPRDRTRN_CR_CRDTCTL1_IMPH_P12VC0_NPMIN_MAX (0x00000007)
+ #define MPRDRTRN_CR_CRDTCTL1_IMPH_DEVC0_NPMIN_OFF (12)
+ #define MPRDRTRN_CR_CRDTCTL1_IMPH_DEVC0_NPMIN_WID ( 3)
+ #define MPRDRTRN_CR_CRDTCTL1_IMPH_DEVC0_NPMIN_MSK (0x00007000)
+ #define MPRDRTRN_CR_CRDTCTL1_IMPH_DEVC0_NPMIN_MAX (0x00000007)
+ #define MPRDRTRN_CR_CRDTCTL1_IMPH_DMIVCP_NPMIN_OFF (15)
+ #define MPRDRTRN_CR_CRDTCTL1_IMPH_DMIVCP_NPMIN_WID ( 3)
+ #define MPRDRTRN_CR_CRDTCTL1_IMPH_DMIVCP_NPMIN_MSK (0x00038000)
+ #define MPRDRTRN_CR_CRDTCTL1_IMPH_DMIVCP_NPMIN_MAX (0x00000007)
+ #define MPRDRTRN_CR_CRDTCTL1_IMPH_DMIVCM_NPMIN_OFF (18)
+ #define MPRDRTRN_CR_CRDTCTL1_IMPH_DMIVCM_NPMIN_WID ( 3)
+ #define MPRDRTRN_CR_CRDTCTL1_IMPH_DMIVCM_NPMIN_MSK (0x001C0000)
+ #define MPRDRTRN_CR_CRDTCTL1_IMPH_DMIVCM_NPMIN_MAX (0x00000007)
+ #define MPRDRTRN_CR_CRDTCTL1_IMPH_DMIVC1_NPMIN_OFF (21)
+ #define MPRDRTRN_CR_CRDTCTL1_IMPH_DMIVC1_NPMIN_WID ( 3)
+ #define MPRDRTRN_CR_CRDTCTL1_IMPH_DMIVC1_NPMIN_MSK (0x00E00000)
+ #define MPRDRTRN_CR_CRDTCTL1_IMPH_DMIVC1_NPMIN_MAX (0x00000007)
+
+#define MPRDRTRN_CR_CRDTCTL2_IMPH_REG (0x00007408)
+ #define MPRDRTRN_CR_CRDTCTL2_IMPH_DMIVC0_RRMIN_OFF ( 0)
+ #define MPRDRTRN_CR_CRDTCTL2_IMPH_DMIVC0_RRMIN_WID ( 3)
+ #define MPRDRTRN_CR_CRDTCTL2_IMPH_DMIVC0_RRMIN_MSK (0x00000007)
+ #define MPRDRTRN_CR_CRDTCTL2_IMPH_DMIVC0_RRMIN_MAX (0x00000007)
+ #define MPRDRTRN_CR_CRDTCTL2_IMPH_P10VC0_RRMIN_OFF ( 3)
+ #define MPRDRTRN_CR_CRDTCTL2_IMPH_P10VC0_RRMIN_WID ( 3)
+ #define MPRDRTRN_CR_CRDTCTL2_IMPH_P10VC0_RRMIN_MSK (0x00000038)
+ #define MPRDRTRN_CR_CRDTCTL2_IMPH_P10VC0_RRMIN_MAX (0x00000007)
+ #define MPRDRTRN_CR_CRDTCTL2_IMPH_P11VC0_RRMIN_OFF ( 6)
+ #define MPRDRTRN_CR_CRDTCTL2_IMPH_P11VC0_RRMIN_WID ( 3)
+ #define MPRDRTRN_CR_CRDTCTL2_IMPH_P11VC0_RRMIN_MSK (0x000001C0)
+ #define MPRDRTRN_CR_CRDTCTL2_IMPH_P11VC0_RRMIN_MAX (0x00000007)
+ #define MPRDRTRN_CR_CRDTCTL2_IMPH_P12VC0_RRMIN_OFF ( 9)
+ #define MPRDRTRN_CR_CRDTCTL2_IMPH_P12VC0_RRMIN_WID ( 3)
+ #define MPRDRTRN_CR_CRDTCTL2_IMPH_P12VC0_RRMIN_MSK (0x00000E00)
+ #define MPRDRTRN_CR_CRDTCTL2_IMPH_P12VC0_RRMIN_MAX (0x00000007)
+ #define MPRDRTRN_CR_CRDTCTL2_IMPH_DEVC0_RRMIN_OFF (12)
+ #define MPRDRTRN_CR_CRDTCTL2_IMPH_DEVC0_RRMIN_WID ( 3)
+ #define MPRDRTRN_CR_CRDTCTL2_IMPH_DEVC0_RRMIN_MSK (0x00007000)
+ #define MPRDRTRN_CR_CRDTCTL2_IMPH_DEVC0_RRMIN_MAX (0x00000007)
+ #define MPRDRTRN_CR_CRDTCTL2_IMPH_DMIVCP_RRMIN_OFF (15)
+ #define MPRDRTRN_CR_CRDTCTL2_IMPH_DMIVCP_RRMIN_WID ( 3)
+ #define MPRDRTRN_CR_CRDTCTL2_IMPH_DMIVCP_RRMIN_MSK (0x00038000)
+ #define MPRDRTRN_CR_CRDTCTL2_IMPH_DMIVCP_RRMIN_MAX (0x00000007)
+ #define MPRDRTRN_CR_CRDTCTL2_IMPH_DMIVCM_RRMIN_OFF (18)
+ #define MPRDRTRN_CR_CRDTCTL2_IMPH_DMIVCM_RRMIN_WID ( 3)
+ #define MPRDRTRN_CR_CRDTCTL2_IMPH_DMIVCM_RRMIN_MSK (0x001C0000)
+ #define MPRDRTRN_CR_CRDTCTL2_IMPH_DMIVCM_RRMIN_MAX (0x00000007)
+ #define MPRDRTRN_CR_CRDTCTL2_IMPH_DMIVC1_RRMIN_OFF (21)
+ #define MPRDRTRN_CR_CRDTCTL2_IMPH_DMIVC1_RRMIN_WID ( 3)
+ #define MPRDRTRN_CR_CRDTCTL2_IMPH_DMIVC1_RRMIN_MSK (0x00E00000)
+ #define MPRDRTRN_CR_CRDTCTL2_IMPH_DMIVC1_RRMIN_MAX (0x00000007)
+ #define MPRDRTRN_CR_CRDTCTL2_IMPH_DEVC1_RRMIN_OFF (24)
+ #define MPRDRTRN_CR_CRDTCTL2_IMPH_DEVC1_RRMIN_WID ( 6)
+ #define MPRDRTRN_CR_CRDTCTL2_IMPH_DEVC1_RRMIN_MSK (0x3F000000)
+ #define MPRDRTRN_CR_CRDTCTL2_IMPH_DEVC1_RRMIN_MAX (0x0000003F)
+
+#define MPRDRTRN_CR_CRDTCTL3_IMPH_REG (0x0000740C)
+ #define MPRDRTRN_CR_CRDTCTL3_IMPH_IOTRK_SHRD_OFF ( 0)
+ #define MPRDRTRN_CR_CRDTCTL3_IMPH_IOTRK_SHRD_WID ( 6)
+ #define MPRDRTRN_CR_CRDTCTL3_IMPH_IOTRK_SHRD_MSK (0x0000003F)
+ #define MPRDRTRN_CR_CRDTCTL3_IMPH_IOTRK_SHRD_MAX (0x0000003F)
+ #define MPRDRTRN_CR_CRDTCTL3_IMPH_RRTRK_SHRD_OFF ( 6)
+ #define MPRDRTRN_CR_CRDTCTL3_IMPH_RRTRK_SHRD_WID ( 7)
+ #define MPRDRTRN_CR_CRDTCTL3_IMPH_RRTRK_SHRD_MSK (0x00001FC0)
+ #define MPRDRTRN_CR_CRDTCTL3_IMPH_RRTRK_SHRD_MAX (0x0000007F)
+
+#define MPRDRTRN_CR_CRDTCTL4_IMPH_REG (0x00007410)
+ #define MPRDRTRN_CR_CRDTCTL4_IMPH_DMIVC0_PMAX_OFF ( 0)
+ #define MPRDRTRN_CR_CRDTCTL4_IMPH_DMIVC0_PMAX_WID ( 5)
+ #define MPRDRTRN_CR_CRDTCTL4_IMPH_DMIVC0_PMAX_MSK (0x0000001F)
+ #define MPRDRTRN_CR_CRDTCTL4_IMPH_DMIVC0_PMAX_MAX (0x0000001F)
+ #define MPRDRTRN_CR_CRDTCTL4_IMPH_P10VC0_PMAX_OFF ( 5)
+ #define MPRDRTRN_CR_CRDTCTL4_IMPH_P10VC0_PMAX_WID ( 5)
+ #define MPRDRTRN_CR_CRDTCTL4_IMPH_P10VC0_PMAX_MSK (0x000003E0)
+ #define MPRDRTRN_CR_CRDTCTL4_IMPH_P10VC0_PMAX_MAX (0x0000001F)
+ #define MPRDRTRN_CR_CRDTCTL4_IMPH_P11VC0_PMAX_OFF (10)
+ #define MPRDRTRN_CR_CRDTCTL4_IMPH_P11VC0_PMAX_WID ( 5)
+ #define MPRDRTRN_CR_CRDTCTL4_IMPH_P11VC0_PMAX_MSK (0x00007C00)
+ #define MPRDRTRN_CR_CRDTCTL4_IMPH_P11VC0_PMAX_MAX (0x0000001F)
+ #define MPRDRTRN_CR_CRDTCTL4_IMPH_P12VC0_PMAX_OFF (15)
+ #define MPRDRTRN_CR_CRDTCTL4_IMPH_P12VC0_PMAX_WID ( 5)
+ #define MPRDRTRN_CR_CRDTCTL4_IMPH_P12VC0_PMAX_MSK (0x000F8000)
+ #define MPRDRTRN_CR_CRDTCTL4_IMPH_P12VC0_PMAX_MAX (0x0000001F)
+ #define MPRDRTRN_CR_CRDTCTL4_IMPH_DEVC0_PMAX_OFF (20)
+ #define MPRDRTRN_CR_CRDTCTL4_IMPH_DEVC0_PMAX_WID ( 5)
+ #define MPRDRTRN_CR_CRDTCTL4_IMPH_DEVC0_PMAX_MSK (0x01F00000)
+ #define MPRDRTRN_CR_CRDTCTL4_IMPH_DEVC0_PMAX_MAX (0x0000001F)
+
+#define MPRDRTRN_CR_CRDTCTL5_IMPH_REG (0x00007414)
+ #define MPRDRTRN_CR_CRDTCTL5_IMPH_DMIVCP_PMAX_OFF ( 0)
+ #define MPRDRTRN_CR_CRDTCTL5_IMPH_DMIVCP_PMAX_WID ( 5)
+ #define MPRDRTRN_CR_CRDTCTL5_IMPH_DMIVCP_PMAX_MSK (0x0000001F)
+ #define MPRDRTRN_CR_CRDTCTL5_IMPH_DMIVCP_PMAX_MAX (0x0000001F)
+ #define MPRDRTRN_CR_CRDTCTL5_IMPH_DMIVCM_PMAX_OFF ( 5)
+ #define MPRDRTRN_CR_CRDTCTL5_IMPH_DMIVCM_PMAX_WID ( 5)
+ #define MPRDRTRN_CR_CRDTCTL5_IMPH_DMIVCM_PMAX_MSK (0x000003E0)
+ #define MPRDRTRN_CR_CRDTCTL5_IMPH_DMIVCM_PMAX_MAX (0x0000001F)
+ #define MPRDRTRN_CR_CRDTCTL5_IMPH_DMIVC1_PMAX_OFF (10)
+ #define MPRDRTRN_CR_CRDTCTL5_IMPH_DMIVC1_PMAX_WID ( 5)
+ #define MPRDRTRN_CR_CRDTCTL5_IMPH_DMIVC1_PMAX_MSK (0x00007C00)
+ #define MPRDRTRN_CR_CRDTCTL5_IMPH_DMIVC1_PMAX_MAX (0x0000001F)
+
+#define MPRDRTRN_CR_CRDTCTL6_IMPH_REG (0x00007418)
+ #define MPRDRTRN_CR_CRDTCTL6_IMPH_DMIVC0_NPMAX_OFF ( 0)
+ #define MPRDRTRN_CR_CRDTCTL6_IMPH_DMIVC0_NPMAX_WID ( 5)
+ #define MPRDRTRN_CR_CRDTCTL6_IMPH_DMIVC0_NPMAX_MSK (0x0000001F)
+ #define MPRDRTRN_CR_CRDTCTL6_IMPH_DMIVC0_NPMAX_MAX (0x0000001F)
+ #define MPRDRTRN_CR_CRDTCTL6_IMPH_P10VC0_NPMAX_OFF ( 5)
+ #define MPRDRTRN_CR_CRDTCTL6_IMPH_P10VC0_NPMAX_WID ( 5)
+ #define MPRDRTRN_CR_CRDTCTL6_IMPH_P10VC0_NPMAX_MSK (0x000003E0)
+ #define MPRDRTRN_CR_CRDTCTL6_IMPH_P10VC0_NPMAX_MAX (0x0000001F)
+ #define MPRDRTRN_CR_CRDTCTL6_IMPH_P11VC0_NPMAX_OFF (10)
+ #define MPRDRTRN_CR_CRDTCTL6_IMPH_P11VC0_NPMAX_WID ( 5)
+ #define MPRDRTRN_CR_CRDTCTL6_IMPH_P11VC0_NPMAX_MSK (0x00007C00)
+ #define MPRDRTRN_CR_CRDTCTL6_IMPH_P11VC0_NPMAX_MAX (0x0000001F)
+ #define MPRDRTRN_CR_CRDTCTL6_IMPH_P12VC0_NPMAX_OFF (15)
+ #define MPRDRTRN_CR_CRDTCTL6_IMPH_P12VC0_NPMAX_WID ( 5)
+ #define MPRDRTRN_CR_CRDTCTL6_IMPH_P12VC0_NPMAX_MSK (0x000F8000)
+ #define MPRDRTRN_CR_CRDTCTL6_IMPH_P12VC0_NPMAX_MAX (0x0000001F)
+ #define MPRDRTRN_CR_CRDTCTL6_IMPH_DEVC0_NPMAX_OFF (20)
+ #define MPRDRTRN_CR_CRDTCTL6_IMPH_DEVC0_NPMAX_WID ( 5)
+ #define MPRDRTRN_CR_CRDTCTL6_IMPH_DEVC0_NPMAX_MSK (0x01F00000)
+ #define MPRDRTRN_CR_CRDTCTL6_IMPH_DEVC0_NPMAX_MAX (0x0000001F)
+
+#define MPRDRTRN_CR_CRDTCTL7_IMPH_REG (0x0000741C)
+ #define MPRDRTRN_CR_CRDTCTL7_IMPH_DMIVCP_NPMAX_OFF ( 0)
+ #define MPRDRTRN_CR_CRDTCTL7_IMPH_DMIVCP_NPMAX_WID ( 5)
+ #define MPRDRTRN_CR_CRDTCTL7_IMPH_DMIVCP_NPMAX_MSK (0x0000001F)
+ #define MPRDRTRN_CR_CRDTCTL7_IMPH_DMIVCP_NPMAX_MAX (0x0000001F)
+ #define MPRDRTRN_CR_CRDTCTL7_IMPH_DMIVCM_NPMAX_OFF ( 5)
+ #define MPRDRTRN_CR_CRDTCTL7_IMPH_DMIVCM_NPMAX_WID ( 5)
+ #define MPRDRTRN_CR_CRDTCTL7_IMPH_DMIVCM_NPMAX_MSK (0x000003E0)
+ #define MPRDRTRN_CR_CRDTCTL7_IMPH_DMIVCM_NPMAX_MAX (0x0000001F)
+ #define MPRDRTRN_CR_CRDTCTL7_IMPH_DMIVC1_NPMAX_OFF (10)
+ #define MPRDRTRN_CR_CRDTCTL7_IMPH_DMIVC1_NPMAX_WID ( 5)
+ #define MPRDRTRN_CR_CRDTCTL7_IMPH_DMIVC1_NPMAX_MSK (0x00007C00)
+ #define MPRDRTRN_CR_CRDTCTL7_IMPH_DMIVC1_NPMAX_MAX (0x0000001F)
+
+#define MPRDRTRN_CR_VISA_CTL_MPIORDTRKS_IMPH_REG (0x00007420)
+ #define MPRDRTRN_CR_VISA_CTL_MPIORDTRKS_IMPH_DATA_OFF ( 0)
+ #define MPRDRTRN_CR_VISA_CTL_MPIORDTRKS_IMPH_DATA_WID (18)
+ #define MPRDRTRN_CR_VISA_CTL_MPIORDTRKS_IMPH_DATA_MSK (0x0003FFFF)
+ #define MPRDRTRN_CR_VISA_CTL_MPIORDTRKS_IMPH_DATA_MAX (0x0003FFFF)
+ #define MPRDRTRN_CR_VISA_CTL_MPIORDTRKS_IMPH_DATA_DEF (0x00000000)
+ #define MPRDRTRN_CR_VISA_CTL_MPIORDTRKS_IMPH_VORANGE_OFF (31)
+ #define MPRDRTRN_CR_VISA_CTL_MPIORDTRKS_IMPH_VORANGE_WID ( 1)
+ #define MPRDRTRN_CR_VISA_CTL_MPIORDTRKS_IMPH_VORANGE_MSK (0x80000000)
+ #define MPRDRTRN_CR_VISA_CTL_MPIORDTRKS_IMPH_VORANGE_MAX (0x00000001)
+ #define MPRDRTRN_CR_VISA_CTL_MPIORDTRKS_IMPH_VORANGE_DEF (0x00000000)
+
+#define MPRDRTRN_CR_VISA_XBAR_MPIORDTRKS_IMPH_REG (0x00007424)
+ #define MPRDRTRN_CR_VISA_XBAR_MPIORDTRKS_IMPH_DATA_OFF ( 0)
+ #define MPRDRTRN_CR_VISA_XBAR_MPIORDTRKS_IMPH_DATA_WID (32)
+ #define MPRDRTRN_CR_VISA_XBAR_MPIORDTRKS_IMPH_DATA_MSK (0xFFFFFFFF)
+ #define MPRDRTRN_CR_VISA_XBAR_MPIORDTRKS_IMPH_DATA_MAX (0xFFFFFFFF)
+ #define MPRDRTRN_CR_VISA_XBAR_MPIORDTRKS_IMPH_DATA_DEF (0x76543210)
+
+#define MPRDRTRN_CR_VISA_CTL_MPIOTRKS_IMPH_REG (0x00007428)
+ #define MPRDRTRN_CR_VISA_CTL_MPIOTRKS_IMPH_DATA_OFF ( 0)
+ #define MPRDRTRN_CR_VISA_CTL_MPIOTRKS_IMPH_DATA_WID (18)
+ #define MPRDRTRN_CR_VISA_CTL_MPIOTRKS_IMPH_DATA_MSK (0x0003FFFF)
+ #define MPRDRTRN_CR_VISA_CTL_MPIOTRKS_IMPH_DATA_MAX (0x0003FFFF)
+ #define MPRDRTRN_CR_VISA_CTL_MPIOTRKS_IMPH_DATA_DEF (0x00000000)
+ #define MPRDRTRN_CR_VISA_CTL_MPIOTRKS_IMPH_VORANGE_OFF (31)
+ #define MPRDRTRN_CR_VISA_CTL_MPIOTRKS_IMPH_VORANGE_WID ( 1)
+ #define MPRDRTRN_CR_VISA_CTL_MPIOTRKS_IMPH_VORANGE_MSK (0x80000000)
+ #define MPRDRTRN_CR_VISA_CTL_MPIOTRKS_IMPH_VORANGE_MAX (0x00000001)
+ #define MPRDRTRN_CR_VISA_CTL_MPIOTRKS_IMPH_VORANGE_DEF (0x00000000)
+
+#define MPRDRTRN_CR_PRIMDN_MASK1_IMPH_REG (0x00007430)
+ #define MPRDRTRN_CR_PRIMDN_MASK1_IMPH_VC_OFF ( 0)
+ #define MPRDRTRN_CR_PRIMDN_MASK1_IMPH_VC_WID ( 4)
+ #define MPRDRTRN_CR_PRIMDN_MASK1_IMPH_VC_MSK (0x0000000F)
+ #define MPRDRTRN_CR_PRIMDN_MASK1_IMPH_VC_MAX (0x0000000F)
+ #define MPRDRTRN_CR_PRIMDN_MASK1_IMPH_VC_DEF (0x00000000)
+ #define MPRDRTRN_CR_PRIMDN_MASK1_IMPH_FMT_CMDTYPE_OFF ( 4)
+ #define MPRDRTRN_CR_PRIMDN_MASK1_IMPH_FMT_CMDTYPE_WID ( 6)
+ #define MPRDRTRN_CR_PRIMDN_MASK1_IMPH_FMT_CMDTYPE_MSK (0x000003F0)
+ #define MPRDRTRN_CR_PRIMDN_MASK1_IMPH_FMT_CMDTYPE_MAX (0x0000003F)
+ #define MPRDRTRN_CR_PRIMDN_MASK1_IMPH_FMT_CMDTYPE_DEF (0x00000000)
+ #define MPRDRTRN_CR_PRIMDN_MASK1_IMPH_TC_OFF (10)
+ #define MPRDRTRN_CR_PRIMDN_MASK1_IMPH_TC_WID ( 4)
+ #define MPRDRTRN_CR_PRIMDN_MASK1_IMPH_TC_MSK (0x00003C00)
+ #define MPRDRTRN_CR_PRIMDN_MASK1_IMPH_TC_MAX (0x0000000F)
+ #define MPRDRTRN_CR_PRIMDN_MASK1_IMPH_TC_DEF (0x00000000)
+ #define MPRDRTRN_CR_PRIMDN_MASK1_IMPH_NS_OFF (14)
+ #define MPRDRTRN_CR_PRIMDN_MASK1_IMPH_NS_WID ( 1)
+ #define MPRDRTRN_CR_PRIMDN_MASK1_IMPH_NS_MSK (0x00004000)
+ #define MPRDRTRN_CR_PRIMDN_MASK1_IMPH_NS_MAX (0x00000001)
+ #define MPRDRTRN_CR_PRIMDN_MASK1_IMPH_NS_DEF (0x00000000)
+ #define MPRDRTRN_CR_PRIMDN_MASK1_IMPH_RO_OFF (15)
+ #define MPRDRTRN_CR_PRIMDN_MASK1_IMPH_RO_WID ( 1)
+ #define MPRDRTRN_CR_PRIMDN_MASK1_IMPH_RO_MSK (0x00008000)
+ #define MPRDRTRN_CR_PRIMDN_MASK1_IMPH_RO_MAX (0x00000001)
+ #define MPRDRTRN_CR_PRIMDN_MASK1_IMPH_RO_DEF (0x00000000)
+ #define MPRDRTRN_CR_PRIMDN_MASK1_IMPH_LENGTH_OFF (16)
+ #define MPRDRTRN_CR_PRIMDN_MASK1_IMPH_LENGTH_WID ( 5)
+ #define MPRDRTRN_CR_PRIMDN_MASK1_IMPH_LENGTH_MSK (0x001F0000)
+ #define MPRDRTRN_CR_PRIMDN_MASK1_IMPH_LENGTH_MAX (0x0000001F)
+ #define MPRDRTRN_CR_PRIMDN_MASK1_IMPH_LENGTH_DEF (0x00000000)
+ #define MPRDRTRN_CR_PRIMDN_MASK1_IMPH_EP_OFF (21)
+ #define MPRDRTRN_CR_PRIMDN_MASK1_IMPH_EP_WID ( 1)
+ #define MPRDRTRN_CR_PRIMDN_MASK1_IMPH_EP_MSK (0x00200000)
+ #define MPRDRTRN_CR_PRIMDN_MASK1_IMPH_EP_MAX (0x00000001)
+ #define MPRDRTRN_CR_PRIMDN_MASK1_IMPH_EP_DEF (0x00000000)
+
+#define MPRDRTRN_CR_PRIMDN_MASK2_IMPH_REG (0x00007434)
+ #define MPRDRTRN_CR_PRIMDN_MASK2_IMPH_RQID_OFF ( 0)
+ #define MPRDRTRN_CR_PRIMDN_MASK2_IMPH_RQID_WID (16)
+ #define MPRDRTRN_CR_PRIMDN_MASK2_IMPH_RQID_MSK (0x0000FFFF)
+ #define MPRDRTRN_CR_PRIMDN_MASK2_IMPH_RQID_MAX (0x0000FFFF)
+ #define MPRDRTRN_CR_PRIMDN_MASK2_IMPH_RQID_DEF (0x00000000)
+ #define MPRDRTRN_CR_PRIMDN_MASK2_IMPH_TAG_OFF (16)
+ #define MPRDRTRN_CR_PRIMDN_MASK2_IMPH_TAG_WID ( 8)
+ #define MPRDRTRN_CR_PRIMDN_MASK2_IMPH_TAG_MSK (0x00FF0000)
+ #define MPRDRTRN_CR_PRIMDN_MASK2_IMPH_TAG_MAX (0x000000FF)
+ #define MPRDRTRN_CR_PRIMDN_MASK2_IMPH_TAG_DEF (0x00000000)
+ #define MPRDRTRN_CR_PRIMDN_MASK2_IMPH_LBEFBE_MSGTYPE_OFF (24)
+ #define MPRDRTRN_CR_PRIMDN_MASK2_IMPH_LBEFBE_MSGTYPE_WID ( 8)
+ #define MPRDRTRN_CR_PRIMDN_MASK2_IMPH_LBEFBE_MSGTYPE_MSK (0xFF000000)
+ #define MPRDRTRN_CR_PRIMDN_MASK2_IMPH_LBEFBE_MSGTYPE_MAX (0x000000FF)
+ #define MPRDRTRN_CR_PRIMDN_MASK2_IMPH_LBEFBE_MSGTYPE_DEF (0x00000000)
+
+#define MPRDRTRN_CR_PRIMDN_MASK3_IMPH_REG (0x00007438)
+ #define MPRDRTRN_CR_PRIMDN_MASK3_IMPH_ADDR_31_0_OFF ( 0)
+ #define MPRDRTRN_CR_PRIMDN_MASK3_IMPH_ADDR_31_0_WID (32)
+ #define MPRDRTRN_CR_PRIMDN_MASK3_IMPH_ADDR_31_0_MSK (0xFFFFFFFF)
+ #define MPRDRTRN_CR_PRIMDN_MASK3_IMPH_ADDR_31_0_MAX (0xFFFFFFFF)
+ #define MPRDRTRN_CR_PRIMDN_MASK3_IMPH_ADDR_31_0_DEF (0x00000000)
+
+#define MPRDRTRN_CR_PRIMDN_MASK4_IMPH_REG (0x0000743C)
+ #define MPRDRTRN_CR_PRIMDN_MASK4_IMPH_ADDR_63_32_OFF ( 0)
+ #define MPRDRTRN_CR_PRIMDN_MASK4_IMPH_ADDR_63_32_WID (32)
+ #define MPRDRTRN_CR_PRIMDN_MASK4_IMPH_ADDR_63_32_MSK (0xFFFFFFFF)
+ #define MPRDRTRN_CR_PRIMDN_MASK4_IMPH_ADDR_63_32_MAX (0xFFFFFFFF)
+ #define MPRDRTRN_CR_PRIMDN_MASK4_IMPH_ADDR_63_32_DEF (0x00000000)
+
+#define MPRDRTRN_CR_PRIMDN_COMP1_IMPH_REG (0x00007440)
+ #define MPRDRTRN_CR_PRIMDN_COMP1_IMPH_VC_OFF ( 0)
+ #define MPRDRTRN_CR_PRIMDN_COMP1_IMPH_VC_WID ( 4)
+ #define MPRDRTRN_CR_PRIMDN_COMP1_IMPH_VC_MSK (0x0000000F)
+ #define MPRDRTRN_CR_PRIMDN_COMP1_IMPH_VC_MAX (0x0000000F)
+ #define MPRDRTRN_CR_PRIMDN_COMP1_IMPH_VC_DEF (0x00000000)
+ #define MPRDRTRN_CR_PRIMDN_COMP1_IMPH_FMT_CMDTYPE_OFF ( 4)
+ #define MPRDRTRN_CR_PRIMDN_COMP1_IMPH_FMT_CMDTYPE_WID ( 6)
+ #define MPRDRTRN_CR_PRIMDN_COMP1_IMPH_FMT_CMDTYPE_MSK (0x000003F0)
+ #define MPRDRTRN_CR_PRIMDN_COMP1_IMPH_FMT_CMDTYPE_MAX (0x0000003F)
+ #define MPRDRTRN_CR_PRIMDN_COMP1_IMPH_FMT_CMDTYPE_DEF (0x00000000)
+ #define MPRDRTRN_CR_PRIMDN_COMP1_IMPH_TC_OFF (10)
+ #define MPRDRTRN_CR_PRIMDN_COMP1_IMPH_TC_WID ( 4)
+ #define MPRDRTRN_CR_PRIMDN_COMP1_IMPH_TC_MSK (0x00003C00)
+ #define MPRDRTRN_CR_PRIMDN_COMP1_IMPH_TC_MAX (0x0000000F)
+ #define MPRDRTRN_CR_PRIMDN_COMP1_IMPH_TC_DEF (0x00000000)
+ #define MPRDRTRN_CR_PRIMDN_COMP1_IMPH_EP_OFF (14)
+ #define MPRDRTRN_CR_PRIMDN_COMP1_IMPH_EP_WID ( 1)
+ #define MPRDRTRN_CR_PRIMDN_COMP1_IMPH_EP_MSK (0x00004000)
+ #define MPRDRTRN_CR_PRIMDN_COMP1_IMPH_EP_MAX (0x00000001)
+ #define MPRDRTRN_CR_PRIMDN_COMP1_IMPH_EP_DEF (0x00000000)
+ #define MPRDRTRN_CR_PRIMDN_COMP1_IMPH_NS_OFF (15)
+ #define MPRDRTRN_CR_PRIMDN_COMP1_IMPH_NS_WID ( 1)
+ #define MPRDRTRN_CR_PRIMDN_COMP1_IMPH_NS_MSK (0x00008000)
+ #define MPRDRTRN_CR_PRIMDN_COMP1_IMPH_NS_MAX (0x00000001)
+ #define MPRDRTRN_CR_PRIMDN_COMP1_IMPH_NS_DEF (0x00000000)
+ #define MPRDRTRN_CR_PRIMDN_COMP1_IMPH_RO_OFF (16)
+ #define MPRDRTRN_CR_PRIMDN_COMP1_IMPH_RO_WID ( 1)
+ #define MPRDRTRN_CR_PRIMDN_COMP1_IMPH_RO_MSK (0x00010000)
+ #define MPRDRTRN_CR_PRIMDN_COMP1_IMPH_RO_MAX (0x00000001)
+ #define MPRDRTRN_CR_PRIMDN_COMP1_IMPH_RO_DEF (0x00000000)
+ #define MPRDRTRN_CR_PRIMDN_COMP1_IMPH_LENGTH_OFF (17)
+ #define MPRDRTRN_CR_PRIMDN_COMP1_IMPH_LENGTH_WID ( 5)
+ #define MPRDRTRN_CR_PRIMDN_COMP1_IMPH_LENGTH_MSK (0x003E0000)
+ #define MPRDRTRN_CR_PRIMDN_COMP1_IMPH_LENGTH_MAX (0x0000001F)
+ #define MPRDRTRN_CR_PRIMDN_COMP1_IMPH_LENGTH_DEF (0x00000000)
+
+#define MPRDRTRN_CR_PRIMDN_COMP2_IMPH_REG (0x00007444)
+ #define MPRDRTRN_CR_PRIMDN_COMP2_IMPH_RQID_OFF ( 0)
+ #define MPRDRTRN_CR_PRIMDN_COMP2_IMPH_RQID_WID (16)
+ #define MPRDRTRN_CR_PRIMDN_COMP2_IMPH_RQID_MSK (0x0000FFFF)
+ #define MPRDRTRN_CR_PRIMDN_COMP2_IMPH_RQID_MAX (0x0000FFFF)
+ #define MPRDRTRN_CR_PRIMDN_COMP2_IMPH_RQID_DEF (0x00000000)
+ #define MPRDRTRN_CR_PRIMDN_COMP2_IMPH_TAG_OFF (16)
+ #define MPRDRTRN_CR_PRIMDN_COMP2_IMPH_TAG_WID ( 8)
+ #define MPRDRTRN_CR_PRIMDN_COMP2_IMPH_TAG_MSK (0x00FF0000)
+ #define MPRDRTRN_CR_PRIMDN_COMP2_IMPH_TAG_MAX (0x000000FF)
+ #define MPRDRTRN_CR_PRIMDN_COMP2_IMPH_TAG_DEF (0x00000000)
+ #define MPRDRTRN_CR_PRIMDN_COMP2_IMPH_LBEFBE_MSGTYPE_OFF (24)
+ #define MPRDRTRN_CR_PRIMDN_COMP2_IMPH_LBEFBE_MSGTYPE_WID ( 8)
+ #define MPRDRTRN_CR_PRIMDN_COMP2_IMPH_LBEFBE_MSGTYPE_MSK (0xFF000000)
+ #define MPRDRTRN_CR_PRIMDN_COMP2_IMPH_LBEFBE_MSGTYPE_MAX (0x000000FF)
+ #define MPRDRTRN_CR_PRIMDN_COMP2_IMPH_LBEFBE_MSGTYPE_DEF (0x00000000)
+
+#define MPRDRTRN_CR_PRIMDN_COMP3_IMPH_REG (0x00007448)
+ #define MPRDRTRN_CR_PRIMDN_COMP3_IMPH_ADDR_31_0_OFF ( 0)
+ #define MPRDRTRN_CR_PRIMDN_COMP3_IMPH_ADDR_31_0_WID (32)
+ #define MPRDRTRN_CR_PRIMDN_COMP3_IMPH_ADDR_31_0_MSK (0xFFFFFFFF)
+ #define MPRDRTRN_CR_PRIMDN_COMP3_IMPH_ADDR_31_0_MAX (0xFFFFFFFF)
+ #define MPRDRTRN_CR_PRIMDN_COMP3_IMPH_ADDR_31_0_DEF (0x00000000)
+
+#define MPRDRTRN_CR_PRIMDN_COMP4_IMPH_REG (0x0000744C)
+ #define MPRDRTRN_CR_PRIMDN_COMP4_IMPH_ADDR_63_32_OFF ( 0)
+ #define MPRDRTRN_CR_PRIMDN_COMP4_IMPH_ADDR_63_32_WID (32)
+ #define MPRDRTRN_CR_PRIMDN_COMP4_IMPH_ADDR_63_32_MSK (0xFFFFFFFF)
+ #define MPRDRTRN_CR_PRIMDN_COMP4_IMPH_ADDR_63_32_MAX (0xFFFFFFFF)
+ #define MPRDRTRN_CR_PRIMDN_COMP4_IMPH_ADDR_63_32_DEF (0x00000000)
+
+#define MPRDRTRN_CR_PRIMDN_TRIGGER_IMPH_REG (0x00007450)
+ #define MPRDRTRN_CR_PRIMDN_TRIGGER_IMPH_ENABLE_OFF ( 0)
+ #define MPRDRTRN_CR_PRIMDN_TRIGGER_IMPH_ENABLE_WID ( 1)
+ #define MPRDRTRN_CR_PRIMDN_TRIGGER_IMPH_ENABLE_MSK (0x00000001)
+ #define MPRDRTRN_CR_PRIMDN_TRIGGER_IMPH_ENABLE_MAX (0x00000001)
+ #define MPRDRTRN_CR_PRIMDN_TRIGGER_IMPH_ENABLE_DEF (0x00000000)
+ #define MPRDRTRN_CR_PRIMDN_TRIGGER_IMPH_TRIGGERED_OFF ( 1)
+ #define MPRDRTRN_CR_PRIMDN_TRIGGER_IMPH_TRIGGERED_WID ( 1)
+ #define MPRDRTRN_CR_PRIMDN_TRIGGER_IMPH_TRIGGERED_MSK (0x00000002)
+ #define MPRDRTRN_CR_PRIMDN_TRIGGER_IMPH_TRIGGERED_MAX (0x00000001)
+ #define MPRDRTRN_CR_PRIMDN_TRIGGER_IMPH_TRIGGERED_DEF (0x00000000)
+ #define MPRDRTRN_CR_PRIMDN_TRIGGER_IMPH_STALL_DNARB_OFF ( 2)
+ #define MPRDRTRN_CR_PRIMDN_TRIGGER_IMPH_STALL_DNARB_WID ( 1)
+ #define MPRDRTRN_CR_PRIMDN_TRIGGER_IMPH_STALL_DNARB_MSK (0x00000004)
+ #define MPRDRTRN_CR_PRIMDN_TRIGGER_IMPH_STALL_DNARB_MAX (0x00000001)
+ #define MPRDRTRN_CR_PRIMDN_TRIGGER_IMPH_STALL_DNARB_DEF (0x00000000)
+ #define MPRDRTRN_CR_PRIMDN_TRIGGER_IMPH_STALL_DELAY_OFF (23)
+ #define MPRDRTRN_CR_PRIMDN_TRIGGER_IMPH_STALL_DELAY_WID ( 9)
+ #define MPRDRTRN_CR_PRIMDN_TRIGGER_IMPH_STALL_DELAY_MSK (0xFF800000)
+ #define MPRDRTRN_CR_PRIMDN_TRIGGER_IMPH_STALL_DELAY_MAX (0x000001FF)
+ #define MPRDRTRN_CR_PRIMDN_TRIGGER_IMPH_STALL_DELAY_DEF (0x00000000)
+
+#define MPRDRTRN_CR_CRDTCTL8_IMPH_REG (0x00007454)
+ #define MPRDRTRN_CR_CRDTCTL8_IMPH_DMIVC0_RRMAX_OFF ( 0)
+ #define MPRDRTRN_CR_CRDTCTL8_IMPH_DMIVC0_RRMAX_WID ( 6)
+ #define MPRDRTRN_CR_CRDTCTL8_IMPH_DMIVC0_RRMAX_MSK (0x0000003F)
+ #define MPRDRTRN_CR_CRDTCTL8_IMPH_DMIVC0_RRMAX_MAX (0x0000003F)
+ #define MPRDRTRN_CR_CRDTCTL8_IMPH_P10VC0_RRMAX_OFF ( 6)
+ #define MPRDRTRN_CR_CRDTCTL8_IMPH_P10VC0_RRMAX_WID ( 6)
+ #define MPRDRTRN_CR_CRDTCTL8_IMPH_P10VC0_RRMAX_MSK (0x00000FC0)
+ #define MPRDRTRN_CR_CRDTCTL8_IMPH_P10VC0_RRMAX_MAX (0x0000003F)
+ #define MPRDRTRN_CR_CRDTCTL8_IMPH_P11VC0_RRMAX_OFF (12)
+ #define MPRDRTRN_CR_CRDTCTL8_IMPH_P11VC0_RRMAX_WID ( 6)
+ #define MPRDRTRN_CR_CRDTCTL8_IMPH_P11VC0_RRMAX_MSK (0x0003F000)
+ #define MPRDRTRN_CR_CRDTCTL8_IMPH_P11VC0_RRMAX_MAX (0x0000003F)
+ #define MPRDRTRN_CR_CRDTCTL8_IMPH_P12VC0_RRMAX_OFF (18)
+ #define MPRDRTRN_CR_CRDTCTL8_IMPH_P12VC0_RRMAX_WID ( 6)
+ #define MPRDRTRN_CR_CRDTCTL8_IMPH_P12VC0_RRMAX_MSK (0x00FC0000)
+ #define MPRDRTRN_CR_CRDTCTL8_IMPH_P12VC0_RRMAX_MAX (0x0000003F)
+ #define MPRDRTRN_CR_CRDTCTL8_IMPH_DEVC0_RRMAX_OFF (24)
+ #define MPRDRTRN_CR_CRDTCTL8_IMPH_DEVC0_RRMAX_WID ( 6)
+ #define MPRDRTRN_CR_CRDTCTL8_IMPH_DEVC0_RRMAX_MSK (0x3F000000)
+ #define MPRDRTRN_CR_CRDTCTL8_IMPH_DEVC0_RRMAX_MAX (0x0000003F)
+
+#define MPRDRTRN_CR_CRDTCTL9_IMPH_REG (0x00007458)
+ #define MPRDRTRN_CR_CRDTCTL9_IMPH_DMIVCP_RRMAX_OFF ( 0)
+ #define MPRDRTRN_CR_CRDTCTL9_IMPH_DMIVCP_RRMAX_WID ( 6)
+ #define MPRDRTRN_CR_CRDTCTL9_IMPH_DMIVCP_RRMAX_MSK (0x0000003F)
+ #define MPRDRTRN_CR_CRDTCTL9_IMPH_DMIVCP_RRMAX_MAX (0x0000003F)
+ #define MPRDRTRN_CR_CRDTCTL9_IMPH_DMIVCM_RRMAX_OFF ( 6)
+ #define MPRDRTRN_CR_CRDTCTL9_IMPH_DMIVCM_RRMAX_WID ( 6)
+ #define MPRDRTRN_CR_CRDTCTL9_IMPH_DMIVCM_RRMAX_MSK (0x00000FC0)
+ #define MPRDRTRN_CR_CRDTCTL9_IMPH_DMIVCM_RRMAX_MAX (0x0000003F)
+ #define MPRDRTRN_CR_CRDTCTL9_IMPH_DMIVC1_RRMAX_OFF (12)
+ #define MPRDRTRN_CR_CRDTCTL9_IMPH_DMIVC1_RRMAX_WID ( 6)
+ #define MPRDRTRN_CR_CRDTCTL9_IMPH_DMIVC1_RRMAX_MSK (0x0003F000)
+ #define MPRDRTRN_CR_CRDTCTL9_IMPH_DMIVC1_RRMAX_MAX (0x0000003F)
+ #define MPRDRTRN_CR_CRDTCTL9_IMPH_DEVC1_RRMAX_OFF (18)
+ #define MPRDRTRN_CR_CRDTCTL9_IMPH_DEVC1_RRMAX_WID ( 6)
+ #define MPRDRTRN_CR_CRDTCTL9_IMPH_DEVC1_RRMAX_MSK (0x00FC0000)
+ #define MPRDRTRN_CR_CRDTCTL9_IMPH_DEVC1_RRMAX_MAX (0x0000003F)
+
+#define MPRDRTRN_CR_PCIE_POPUP_CTL_IMPH_REG (0x00007500)
+ #define MPRDRTRN_CR_PCIE_POPUP_CTL_IMPH_LIM_OFF ( 0)
+ #define MPRDRTRN_CR_PCIE_POPUP_CTL_IMPH_LIM_WID (16)
+ #define MPRDRTRN_CR_PCIE_POPUP_CTL_IMPH_LIM_MSK (0x0000FFFF)
+ #define MPRDRTRN_CR_PCIE_POPUP_CTL_IMPH_LIM_MAX (0x0000FFFF)
+ #define MPRDRTRN_CR_PCIE_POPUP_CTL_IMPH_LIM_DEF (0x00000000)
+ #define MPRDRTRN_CR_PCIE_POPUP_CTL_IMPH_MSK_OFF (16)
+ #define MPRDRTRN_CR_PCIE_POPUP_CTL_IMPH_MSK_WID ( 3)
+ #define MPRDRTRN_CR_PCIE_POPUP_CTL_IMPH_MSK_MSK (0x00070000)
+ #define MPRDRTRN_CR_PCIE_POPUP_CTL_IMPH_MSK_MAX (0x00000007)
+ #define MPRDRTRN_CR_PCIE_POPUP_CTL_IMPH_MSK_DEF (0x00000007)
+
+#define MPRDRTRN_CR_VDMBDFBARSSKU_IMPH_REG (0x00007504)
+ #define MPRDRTRN_CR_VDMBDFBARSSKU_IMPH_FUNNUM_OFF ( 0)
+ #define MPRDRTRN_CR_VDMBDFBARSSKU_IMPH_FUNNUM_WID ( 3)
+ #define MPRDRTRN_CR_VDMBDFBARSSKU_IMPH_FUNNUM_MSK (0x00000007)
+ #define MPRDRTRN_CR_VDMBDFBARSSKU_IMPH_FUNNUM_MAX (0x00000007)
+ #define MPRDRTRN_CR_VDMBDFBARSSKU_IMPH_FUNNUM_DEF (0x00000000)
+ #define MPRDRTRN_CR_VDMBDFBARSSKU_IMPH_DEVNUM_OFF ( 3)
+ #define MPRDRTRN_CR_VDMBDFBARSSKU_IMPH_DEVNUM_WID ( 5)
+ #define MPRDRTRN_CR_VDMBDFBARSSKU_IMPH_DEVNUM_MSK (0x000000F8)
+ #define MPRDRTRN_CR_VDMBDFBARSSKU_IMPH_DEVNUM_MAX (0x0000001F)
+ #define MPRDRTRN_CR_VDMBDFBARSSKU_IMPH_DEVNUM_DEF (0x00000016)
+ #define MPRDRTRN_CR_VDMBDFBARSSKU_IMPH_BUSNUM_OFF ( 8)
+ #define MPRDRTRN_CR_VDMBDFBARSSKU_IMPH_BUSNUM_WID ( 8)
+ #define MPRDRTRN_CR_VDMBDFBARSSKU_IMPH_BUSNUM_MSK (0x0000FF00)
+ #define MPRDRTRN_CR_VDMBDFBARSSKU_IMPH_BUSNUM_MAX (0x000000FF)
+ #define MPRDRTRN_CR_VDMBDFBARSSKU_IMPH_BUSNUM_DEF (0x00000000)
+ #define MPRDRTRN_CR_VDMBDFBARSSKU_IMPH_BARNUM_OFF (16)
+ #define MPRDRTRN_CR_VDMBDFBARSSKU_IMPH_BARNUM_WID ( 3)
+ #define MPRDRTRN_CR_VDMBDFBARSSKU_IMPH_BARNUM_MSK (0x00070000)
+ #define MPRDRTRN_CR_VDMBDFBARSSKU_IMPH_BARNUM_MAX (0x00000007)
+ #define MPRDRTRN_CR_VDMBDFBARSSKU_IMPH_BARNUM_DEF (0x00000007)
+
+#define MPRDRTRN_CR_CRDTLCK_IMPH_REG (0x000077FC)
+ #define MPRDRTRN_CR_CRDTLCK_IMPH_LOCK_OFF ( 0)
+ #define MPRDRTRN_CR_CRDTLCK_IMPH_LOCK_WID ( 1)
+ #define MPRDRTRN_CR_CRDTLCK_IMPH_LOCK_MSK (0x00000001)
+ #define MPRDRTRN_CR_CRDTLCK_IMPH_LOCK_MAX (0x00000001)
+ #define MPRDRTRN_CR_CRDTLCK_IMPH_LOCK_DEF (0x00000000)
+
+#define MPMCARB_CR_VCLIM0_IMPH_REG (0x00007800)
+ #define MPMCARB_CR_VCLIM0_IMPH_VCPNPLIM_OFF ( 0)
+ #define MPMCARB_CR_VCLIM0_IMPH_VCPNPLIM_WID ( 3)
+ #define MPMCARB_CR_VCLIM0_IMPH_VCPNPLIM_MSK (0x00000007)
+ #define MPMCARB_CR_VCLIM0_IMPH_VCPNPLIM_MAX (0x00000007)
+ #define MPMCARB_CR_VCLIM0_IMPH_VCPNPLIM_DEF (0x00000004)
+ #define MPMCARB_CR_VCLIM0_IMPH_VCPPLIM_OFF ( 4)
+ #define MPMCARB_CR_VCLIM0_IMPH_VCPPLIM_WID ( 3)
+ #define MPMCARB_CR_VCLIM0_IMPH_VCPPLIM_MSK (0x00000070)
+ #define MPMCARB_CR_VCLIM0_IMPH_VCPPLIM_MAX (0x00000007)
+ #define MPMCARB_CR_VCLIM0_IMPH_VCPPLIM_DEF (0x00000004)
+ #define MPMCARB_CR_VCLIM0_IMPH_VCMNPLIM_OFF ( 8)
+ #define MPMCARB_CR_VCLIM0_IMPH_VCMNPLIM_WID ( 3)
+ #define MPMCARB_CR_VCLIM0_IMPH_VCMNPLIM_MSK (0x00000700)
+ #define MPMCARB_CR_VCLIM0_IMPH_VCMNPLIM_MAX (0x00000007)
+ #define MPMCARB_CR_VCLIM0_IMPH_VCMNPLIM_DEF (0x00000004)
+ #define MPMCARB_CR_VCLIM0_IMPH_VCMPLIM_OFF (12)
+ #define MPMCARB_CR_VCLIM0_IMPH_VCMPLIM_WID ( 3)
+ #define MPMCARB_CR_VCLIM0_IMPH_VCMPLIM_MSK (0x00007000)
+ #define MPMCARB_CR_VCLIM0_IMPH_VCMPLIM_MAX (0x00000007)
+ #define MPMCARB_CR_VCLIM0_IMPH_VCMPLIM_DEF (0x00000004)
+ #define MPMCARB_CR_VCLIM0_IMPH_VC0VTDLIM_OFF (16)
+ #define MPMCARB_CR_VCLIM0_IMPH_VC0VTDLIM_WID ( 3)
+ #define MPMCARB_CR_VCLIM0_IMPH_VC0VTDLIM_MSK (0x00070000)
+ #define MPMCARB_CR_VCLIM0_IMPH_VC0VTDLIM_MAX (0x00000007)
+ #define MPMCARB_CR_VCLIM0_IMPH_VC0VTDLIM_DEF (0x00000004)
+ #define MPMCARB_CR_VCLIM0_IMPH_VCPVTDLIM_OFF (20)
+ #define MPMCARB_CR_VCLIM0_IMPH_VCPVTDLIM_WID ( 3)
+ #define MPMCARB_CR_VCLIM0_IMPH_VCPVTDLIM_MSK (0x00700000)
+ #define MPMCARB_CR_VCLIM0_IMPH_VCPVTDLIM_MAX (0x00000007)
+ #define MPMCARB_CR_VCLIM0_IMPH_VCPVTDLIM_DEF (0x00000004)
+
+#define MPMCARB_CR_VCLIM1_IMPH_REG (0x00007804)
+ #define MPMCARB_CR_VCLIM1_IMPH_IARD_OFF ( 0)
+ #define MPMCARB_CR_VCLIM1_IMPH_IARD_WID ( 3)
+ #define MPMCARB_CR_VCLIM1_IMPH_IARD_MSK (0x00000007)
+ #define MPMCARB_CR_VCLIM1_IMPH_IARD_MAX (0x00000007)
+ #define MPMCARB_CR_VCLIM1_IMPH_IARD_DEF (0x00000004)
+ #define MPMCARB_CR_VCLIM1_IMPH_IAWR_OFF ( 4)
+ #define MPMCARB_CR_VCLIM1_IMPH_IAWR_WID ( 3)
+ #define MPMCARB_CR_VCLIM1_IMPH_IAWR_MSK (0x00000070)
+ #define MPMCARB_CR_VCLIM1_IMPH_IAWR_MAX (0x00000007)
+ #define MPMCARB_CR_VCLIM1_IMPH_IAWR_DEF (0x00000004)
+ #define MPMCARB_CR_VCLIM1_IMPH_VTDL3_OFF ( 8)
+ #define MPMCARB_CR_VCLIM1_IMPH_VTDL3_WID ( 3)
+ #define MPMCARB_CR_VCLIM1_IMPH_VTDL3_MSK (0x00000700)
+ #define MPMCARB_CR_VCLIM1_IMPH_VTDL3_MAX (0x00000007)
+ #define MPMCARB_CR_VCLIM1_IMPH_VTDL3_DEF (0x00000004)
+ #define MPMCARB_CR_VCLIM1_IMPH_VTDNL3_OFF (12)
+ #define MPMCARB_CR_VCLIM1_IMPH_VTDNL3_WID ( 3)
+ #define MPMCARB_CR_VCLIM1_IMPH_VTDNL3_MSK (0x00007000)
+ #define MPMCARB_CR_VCLIM1_IMPH_VTDNL3_MAX (0x00000007)
+ #define MPMCARB_CR_VCLIM1_IMPH_VTDNL3_DEF (0x00000004)
+
+#define MPMCARB_CR_ATMC_STS_IMPH_REG (0x00007808)
+ #define MPMCARB_CR_ATMC_STS_IMPH_VC1_WR_CNFLT_OFF ( 0)
+ #define MPMCARB_CR_ATMC_STS_IMPH_VC1_WR_CNFLT_WID ( 1)
+ #define MPMCARB_CR_ATMC_STS_IMPH_VC1_WR_CNFLT_MSK (0x00000001)
+ #define MPMCARB_CR_ATMC_STS_IMPH_VC1_WR_CNFLT_MAX (0x00000001)
+ #define MPMCARB_CR_ATMC_STS_IMPH_VC1_WR_CNFLT_DEF (0x00000000)
+ #define MPMCARB_CR_ATMC_STS_IMPH_VC1_RD_CNFLT_OFF ( 1)
+ #define MPMCARB_CR_ATMC_STS_IMPH_VC1_RD_CNFLT_WID ( 1)
+ #define MPMCARB_CR_ATMC_STS_IMPH_VC1_RD_CNFLT_MSK (0x00000002)
+ #define MPMCARB_CR_ATMC_STS_IMPH_VC1_RD_CNFLT_MAX (0x00000001)
+ #define MPMCARB_CR_ATMC_STS_IMPH_VC1_RD_CNFLT_DEF (0x00000000)
+
+#define MPMCARB_CR_VISA_CTL_MPMCARBS_F_IMPH_REG (0x00007820)
+ #define MPMCARB_CR_VISA_CTL_MPMCARBS_F_IMPH_DATA_OFF ( 0)
+ #define MPMCARB_CR_VISA_CTL_MPMCARBS_F_IMPH_DATA_WID (18)
+ #define MPMCARB_CR_VISA_CTL_MPMCARBS_F_IMPH_DATA_MSK (0x0003FFFF)
+ #define MPMCARB_CR_VISA_CTL_MPMCARBS_F_IMPH_DATA_MAX (0x0003FFFF)
+ #define MPMCARB_CR_VISA_CTL_MPMCARBS_F_IMPH_DATA_DEF (0x00000000)
+ #define MPMCARB_CR_VISA_CTL_MPMCARBS_F_IMPH_VORANGE_OFF (31)
+ #define MPMCARB_CR_VISA_CTL_MPMCARBS_F_IMPH_VORANGE_WID ( 1)
+ #define MPMCARB_CR_VISA_CTL_MPMCARBS_F_IMPH_VORANGE_MSK (0x80000000)
+ #define MPMCARB_CR_VISA_CTL_MPMCARBS_F_IMPH_VORANGE_MAX (0x00000001)
+ #define MPMCARB_CR_VISA_CTL_MPMCARBS_F_IMPH_VORANGE_DEF (0x00000000)
+
+#define MPMCARB_CR_VISA_CTL_MPMCARBS_D_IMPH_REG (0x00007824)
+ #define MPMCARB_CR_VISA_CTL_MPMCARBS_D_IMPH_DATA_OFF ( 0)
+ #define MPMCARB_CR_VISA_CTL_MPMCARBS_D_IMPH_DATA_WID (18)
+ #define MPMCARB_CR_VISA_CTL_MPMCARBS_D_IMPH_DATA_MSK (0x0003FFFF)
+ #define MPMCARB_CR_VISA_CTL_MPMCARBS_D_IMPH_DATA_MAX (0x0003FFFF)
+ #define MPMCARB_CR_VISA_CTL_MPMCARBS_D_IMPH_DATA_DEF (0x00000000)
+ #define MPMCARB_CR_VISA_CTL_MPMCARBS_D_IMPH_VORANGE_OFF (31)
+ #define MPMCARB_CR_VISA_CTL_MPMCARBS_D_IMPH_VORANGE_WID ( 1)
+ #define MPMCARB_CR_VISA_CTL_MPMCARBS_D_IMPH_VORANGE_MSK (0x80000000)
+ #define MPMCARB_CR_VISA_CTL_MPMCARBS_D_IMPH_VORANGE_MAX (0x00000001)
+ #define MPMCARB_CR_VISA_CTL_MPMCARBS_D_IMPH_VORANGE_DEF (0x00000000)
+
+#define MPMCARB_CR_MCARBLCK_IMPH_REG (0x00007FFC)
+ #define MPMCARB_CR_MCARBLCK_IMPH_LOCK_OFF ( 0)
+ #define MPMCARB_CR_MCARBLCK_IMPH_LOCK_WID ( 1)
+ #define MPMCARB_CR_MCARBLCK_IMPH_LOCK_MSK (0x00000001)
+ #define MPMCARB_CR_MCARBLCK_IMPH_LOCK_MAX (0x00000001)
+ #define MPMCARB_CR_MCARBLCK_IMPH_LOCK_DEF (0x00000000)
+
+#define PCU_CR_CAMARILLO_MAILBOX_DATA0_PCU_REG (0x00005810)
+ #define PCU_CR_CAMARILLO_MAILBOX_DATA0_PCU_DATA_OFF ( 0)
+ #define PCU_CR_CAMARILLO_MAILBOX_DATA0_PCU_DATA_WID (32)
+ #define PCU_CR_CAMARILLO_MAILBOX_DATA0_PCU_DATA_MSK (0xFFFFFFFF)
+ #define PCU_CR_CAMARILLO_MAILBOX_DATA0_PCU_DATA_MAX (0xFFFFFFFF)
+ #define PCU_CR_CAMARILLO_MAILBOX_DATA0_PCU_DATA_DEF (0x00000000)
+
+#define PCU_CR_CAMARILLO_MAILBOX_DATA1_PCU_REG (0x00005814)
+ #define PCU_CR_CAMARILLO_MAILBOX_DATA1_PCU_DATA_OFF ( 0)
+ #define PCU_CR_CAMARILLO_MAILBOX_DATA1_PCU_DATA_WID (32)
+ #define PCU_CR_CAMARILLO_MAILBOX_DATA1_PCU_DATA_MSK (0xFFFFFFFF)
+ #define PCU_CR_CAMARILLO_MAILBOX_DATA1_PCU_DATA_MAX (0xFFFFFFFF)
+ #define PCU_CR_CAMARILLO_MAILBOX_DATA1_PCU_DATA_DEF (0x00000000)
+
+#define PCU_CR_CAMARILLO_MAILBOX_INTERFACE_PCU_REG (0x00005818)
+ #define PCU_CR_CAMARILLO_MAILBOX_INTERFACE_PCU_COMMAND_OFF ( 0)
+ #define PCU_CR_CAMARILLO_MAILBOX_INTERFACE_PCU_COMMAND_WID ( 8)
+ #define PCU_CR_CAMARILLO_MAILBOX_INTERFACE_PCU_COMMAND_MSK (0x000000FF)
+ #define PCU_CR_CAMARILLO_MAILBOX_INTERFACE_PCU_COMMAND_MAX (0x000000FF)
+ #define PCU_CR_CAMARILLO_MAILBOX_INTERFACE_PCU_COMMAND_DEF (0x00000000)
+ #define PCU_CR_CAMARILLO_MAILBOX_INTERFACE_PCU_ADDR_CNTL_OFF ( 8)
+ #define PCU_CR_CAMARILLO_MAILBOX_INTERFACE_PCU_ADDR_CNTL_WID (21)
+ #define PCU_CR_CAMARILLO_MAILBOX_INTERFACE_PCU_ADDR_CNTL_MSK (0x1FFFFF00)
+ #define PCU_CR_CAMARILLO_MAILBOX_INTERFACE_PCU_ADDR_CNTL_MAX (0x001FFFFF)
+ #define PCU_CR_CAMARILLO_MAILBOX_INTERFACE_PCU_ADDR_CNTL_DEF (0x00000000)
+ #define PCU_CR_CAMARILLO_MAILBOX_INTERFACE_PCU_RUN_BUSY_OFF (31)
+ #define PCU_CR_CAMARILLO_MAILBOX_INTERFACE_PCU_RUN_BUSY_WID ( 1)
+ #define PCU_CR_CAMARILLO_MAILBOX_INTERFACE_PCU_RUN_BUSY_MSK (0x80000000)
+ #define PCU_CR_CAMARILLO_MAILBOX_INTERFACE_PCU_RUN_BUSY_MAX (0x00000001)
+ #define PCU_CR_CAMARILLO_MAILBOX_INTERFACE_PCU_RUN_BUSY_DEF (0x00000000)
+
+#define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_REG (0x00005820)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_HIGH_TEMP_INT_ENABLE_OFF ( 0)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_HIGH_TEMP_INT_ENABLE_WID ( 1)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_HIGH_TEMP_INT_ENABLE_MSK (0x00000001)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_HIGH_TEMP_INT_ENABLE_MAX (0x00000001)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_HIGH_TEMP_INT_ENABLE_DEF (0x00000000)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_LOW_TEMP_INT_ENABLE_OFF ( 1)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_LOW_TEMP_INT_ENABLE_WID ( 1)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_LOW_TEMP_INT_ENABLE_MSK (0x00000002)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_LOW_TEMP_INT_ENABLE_MAX (0x00000001)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_LOW_TEMP_INT_ENABLE_DEF (0x00000000)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_PROCHOT_INT_ENABLE_OFF ( 2)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_PROCHOT_INT_ENABLE_WID ( 1)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_PROCHOT_INT_ENABLE_MSK (0x00000004)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_PROCHOT_INT_ENABLE_MAX (0x00000001)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_PROCHOT_INT_ENABLE_DEF (0x00000000)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_OUT_OF_SPEC_INT_ENABLE_OFF ( 4)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_OUT_OF_SPEC_INT_ENABLE_WID ( 1)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_OUT_OF_SPEC_INT_ENABLE_MSK (0x00000010)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_OUT_OF_SPEC_INT_ENABLE_MAX (0x00000001)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_OUT_OF_SPEC_INT_ENABLE_DEF (0x00000000)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_THRESHOLD_1_REL_TEMP_OFF ( 8)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_THRESHOLD_1_REL_TEMP_WID ( 7)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_THRESHOLD_1_REL_TEMP_MSK (0x00007F00)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_THRESHOLD_1_REL_TEMP_MAX (0x0000007F)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_THRESHOLD_1_REL_TEMP_DEF (0x00000000)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_THRESHOLD_1_INT_ENABLE_OFF (15)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_THRESHOLD_1_INT_ENABLE_WID ( 1)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_THRESHOLD_1_INT_ENABLE_MSK (0x00008000)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_THRESHOLD_1_INT_ENABLE_MAX (0x00000001)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_THRESHOLD_1_INT_ENABLE_DEF (0x00000000)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_THRESHOLD_2_REL_TEMP_OFF (16)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_THRESHOLD_2_REL_TEMP_WID ( 7)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_THRESHOLD_2_REL_TEMP_MSK (0x007F0000)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_THRESHOLD_2_REL_TEMP_MAX (0x0000007F)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_THRESHOLD_2_REL_TEMP_DEF (0x00000000)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_THRESHOLD_2_INT_ENABLE_OFF (23)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_THRESHOLD_2_INT_ENABLE_WID ( 1)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_THRESHOLD_2_INT_ENABLE_MSK (0x00800000)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_THRESHOLD_2_INT_ENABLE_MAX (0x00000001)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_THRESHOLD_2_INT_ENABLE_DEF (0x00000000)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_POWER_INT_ENABLE_OFF (24)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_POWER_INT_ENABLE_WID ( 1)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_POWER_INT_ENABLE_MSK (0x01000000)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_POWER_INT_ENABLE_MAX (0x00000001)
+ #define PCU_CR_PACKAGE_THERM_CAMARILLO_INTERRUPT_PCU_POWER_INT_ENABLE_DEF (0x00000000)
+
+#define PCU_CR_DDR_PTM_CTL_PCU_REG (0x00005880)
+ #define PCU_CR_DDR_PTM_CTL_PCU_OLTM_ENABLE_OFF ( 0)
+ #define PCU_CR_DDR_PTM_CTL_PCU_OLTM_ENABLE_WID ( 1)
+ #define PCU_CR_DDR_PTM_CTL_PCU_OLTM_ENABLE_MSK (0x00000001)
+ #define PCU_CR_DDR_PTM_CTL_PCU_OLTM_ENABLE_MAX (0x00000001)
+ #define PCU_CR_DDR_PTM_CTL_PCU_OLTM_ENABLE_DEF (0x00000000)
+ #define PCU_CR_DDR_PTM_CTL_PCU_CLTM_ENABLE_OFF ( 1)
+ #define PCU_CR_DDR_PTM_CTL_PCU_CLTM_ENABLE_WID ( 1)
+ #define PCU_CR_DDR_PTM_CTL_PCU_CLTM_ENABLE_MSK (0x00000002)
+ #define PCU_CR_DDR_PTM_CTL_PCU_CLTM_ENABLE_MAX (0x00000001)
+ #define PCU_CR_DDR_PTM_CTL_PCU_CLTM_ENABLE_DEF (0x00000000)
+ #define PCU_CR_DDR_PTM_CTL_PCU_REFRESH_2X_MODE_OFF ( 2)
+ #define PCU_CR_DDR_PTM_CTL_PCU_REFRESH_2X_MODE_WID ( 2)
+ #define PCU_CR_DDR_PTM_CTL_PCU_REFRESH_2X_MODE_MSK (0x0000000C)
+ #define PCU_CR_DDR_PTM_CTL_PCU_REFRESH_2X_MODE_MAX (0x00000003)
+ #define PCU_CR_DDR_PTM_CTL_PCU_REFRESH_2X_MODE_DEF (0x00000000)
+ #define PCU_CR_DDR_PTM_CTL_PCU_EXTTS_ENABLE_OFF ( 4)
+ #define PCU_CR_DDR_PTM_CTL_PCU_EXTTS_ENABLE_WID ( 1)
+ #define PCU_CR_DDR_PTM_CTL_PCU_EXTTS_ENABLE_MSK (0x00000010)
+ #define PCU_CR_DDR_PTM_CTL_PCU_EXTTS_ENABLE_MAX (0x00000001)
+ #define PCU_CR_DDR_PTM_CTL_PCU_EXTTS_ENABLE_DEF (0x00000000)
+ #define PCU_CR_DDR_PTM_CTL_PCU_LOCK_PTM_REGS_PCU_OFF ( 5)
+ #define PCU_CR_DDR_PTM_CTL_PCU_LOCK_PTM_REGS_PCU_WID ( 1)
+ #define PCU_CR_DDR_PTM_CTL_PCU_LOCK_PTM_REGS_PCU_MSK (0x00000020)
+ #define PCU_CR_DDR_PTM_CTL_PCU_LOCK_PTM_REGS_PCU_MAX (0x00000001)
+ #define PCU_CR_DDR_PTM_CTL_PCU_LOCK_PTM_REGS_PCU_DEF (0x00000000)
+ #define PCU_CR_DDR_PTM_CTL_PCU_PDWN_CONFIG_CTL_OFF ( 6)
+ #define PCU_CR_DDR_PTM_CTL_PCU_PDWN_CONFIG_CTL_WID ( 1)
+ #define PCU_CR_DDR_PTM_CTL_PCU_PDWN_CONFIG_CTL_MSK (0x00000040)
+ #define PCU_CR_DDR_PTM_CTL_PCU_PDWN_CONFIG_CTL_MAX (0x00000001)
+ #define PCU_CR_DDR_PTM_CTL_PCU_PDWN_CONFIG_CTL_DEF (0x00000000)
+ #define PCU_CR_DDR_PTM_CTL_PCU_DISABLE_DRAM_TS_OFF ( 7)
+ #define PCU_CR_DDR_PTM_CTL_PCU_DISABLE_DRAM_TS_WID ( 1)
+ #define PCU_CR_DDR_PTM_CTL_PCU_DISABLE_DRAM_TS_MSK (0x00000080)
+ #define PCU_CR_DDR_PTM_CTL_PCU_DISABLE_DRAM_TS_MAX (0x00000001)
+ #define PCU_CR_DDR_PTM_CTL_PCU_DISABLE_DRAM_TS_DEF (0x00000000)
+
+#define PCU_CR_DDR_ENERGY_SCALEFACTOR_PCU_REG (0x00005884)
+ #define PCU_CR_DDR_ENERGY_SCALEFACTOR_PCU_SCALEFACTOR_OFF ( 0)
+ #define PCU_CR_DDR_ENERGY_SCALEFACTOR_PCU_SCALEFACTOR_WID ( 3)
+ #define PCU_CR_DDR_ENERGY_SCALEFACTOR_PCU_SCALEFACTOR_MSK (0x00000007)
+ #define PCU_CR_DDR_ENERGY_SCALEFACTOR_PCU_SCALEFACTOR_MAX (0x00000007)
+ #define PCU_CR_DDR_ENERGY_SCALEFACTOR_PCU_SCALEFACTOR_DEF (0x00000003)
+
+#define PCU_CR_DDR_RAPL_CHANNEL_POWER_FLOOR_PCU_REG (0x00005888)
+ #define PCU_CR_DDR_RAPL_CHANNEL_POWER_FLOOR_PCU_CH0_OFF ( 0)
+ #define PCU_CR_DDR_RAPL_CHANNEL_POWER_FLOOR_PCU_CH0_WID ( 8)
+ #define PCU_CR_DDR_RAPL_CHANNEL_POWER_FLOOR_PCU_CH0_MSK (0x000000FF)
+ #define PCU_CR_DDR_RAPL_CHANNEL_POWER_FLOOR_PCU_CH0_MAX (0x000000FF)
+ #define PCU_CR_DDR_RAPL_CHANNEL_POWER_FLOOR_PCU_CH0_DEF (0x00000000)
+ #define PCU_CR_DDR_RAPL_CHANNEL_POWER_FLOOR_PCU_CH1_OFF ( 8)
+ #define PCU_CR_DDR_RAPL_CHANNEL_POWER_FLOOR_PCU_CH1_WID ( 8)
+ #define PCU_CR_DDR_RAPL_CHANNEL_POWER_FLOOR_PCU_CH1_MSK (0x0000FF00)
+ #define PCU_CR_DDR_RAPL_CHANNEL_POWER_FLOOR_PCU_CH1_MAX (0x000000FF)
+ #define PCU_CR_DDR_RAPL_CHANNEL_POWER_FLOOR_PCU_CH1_DEF (0x00000000)
+
+#define PCU_CR_DDR_THERM_PERDIMM_STATUS_PCU_REG (0x0000588C)
+ #define PCU_CR_DDR_THERM_PERDIMM_STATUS_PCU_CH0_DIMM0_OFF ( 0)
+ #define PCU_CR_DDR_THERM_PERDIMM_STATUS_PCU_CH0_DIMM0_WID ( 2)
+ #define PCU_CR_DDR_THERM_PERDIMM_STATUS_PCU_CH0_DIMM0_MSK (0x00000003)
+ #define PCU_CR_DDR_THERM_PERDIMM_STATUS_PCU_CH0_DIMM0_MAX (0x00000003)
+ #define PCU_CR_DDR_THERM_PERDIMM_STATUS_PCU_CH0_DIMM0_DEF (0x00000000)
+ #define PCU_CR_DDR_THERM_PERDIMM_STATUS_PCU_CH0_DIMM1_OFF ( 2)
+ #define PCU_CR_DDR_THERM_PERDIMM_STATUS_PCU_CH0_DIMM1_WID ( 2)
+ #define PCU_CR_DDR_THERM_PERDIMM_STATUS_PCU_CH0_DIMM1_MSK (0x0000000C)
+ #define PCU_CR_DDR_THERM_PERDIMM_STATUS_PCU_CH0_DIMM1_MAX (0x00000003)
+ #define PCU_CR_DDR_THERM_PERDIMM_STATUS_PCU_CH0_DIMM1_DEF (0x00000000)
+ #define PCU_CR_DDR_THERM_PERDIMM_STATUS_PCU_CH1_DIMM0_OFF ( 8)
+ #define PCU_CR_DDR_THERM_PERDIMM_STATUS_PCU_CH1_DIMM0_WID ( 2)
+ #define PCU_CR_DDR_THERM_PERDIMM_STATUS_PCU_CH1_DIMM0_MSK (0x00000300)
+ #define PCU_CR_DDR_THERM_PERDIMM_STATUS_PCU_CH1_DIMM0_MAX (0x00000003)
+ #define PCU_CR_DDR_THERM_PERDIMM_STATUS_PCU_CH1_DIMM0_DEF (0x00000000)
+ #define PCU_CR_DDR_THERM_PERDIMM_STATUS_PCU_CH1_DIMM1_OFF (10)
+ #define PCU_CR_DDR_THERM_PERDIMM_STATUS_PCU_CH1_DIMM1_WID ( 2)
+ #define PCU_CR_DDR_THERM_PERDIMM_STATUS_PCU_CH1_DIMM1_MSK (0x00000C00)
+ #define PCU_CR_DDR_THERM_PERDIMM_STATUS_PCU_CH1_DIMM1_MAX (0x00000003)
+ #define PCU_CR_DDR_THERM_PERDIMM_STATUS_PCU_CH1_DIMM1_DEF (0x00000000)
+
+#define PCU_CR_DDR_WARM_THRESHOLD_CH0_PCU_REG (0x00005890)
+ #define PCU_CR_DDR_WARM_THRESHOLD_CH0_PCU_DIMM0_OFF ( 0)
+ #define PCU_CR_DDR_WARM_THRESHOLD_CH0_PCU_DIMM0_WID ( 8)
+ #define PCU_CR_DDR_WARM_THRESHOLD_CH0_PCU_DIMM0_MSK (0x000000FF)
+ #define PCU_CR_DDR_WARM_THRESHOLD_CH0_PCU_DIMM0_MAX (0x000000FF)
+ #define PCU_CR_DDR_WARM_THRESHOLD_CH0_PCU_DIMM0_DEF (0x000000FF)
+ #define PCU_CR_DDR_WARM_THRESHOLD_CH0_PCU_DIMM1_OFF ( 8)
+ #define PCU_CR_DDR_WARM_THRESHOLD_CH0_PCU_DIMM1_WID ( 8)
+ #define PCU_CR_DDR_WARM_THRESHOLD_CH0_PCU_DIMM1_MSK (0x0000FF00)
+ #define PCU_CR_DDR_WARM_THRESHOLD_CH0_PCU_DIMM1_MAX (0x000000FF)
+ #define PCU_CR_DDR_WARM_THRESHOLD_CH0_PCU_DIMM1_DEF (0x000000FF)
+
+#define PCU_CR_DDR_WARM_THRESHOLD_CH1_PCU_REG (0x00005894)
+ #define PCU_CR_DDR_WARM_THRESHOLD_CH1_PCU_DIMM0_OFF ( 0)
+ #define PCU_CR_DDR_WARM_THRESHOLD_CH1_PCU_DIMM0_WID ( 8)
+ #define PCU_CR_DDR_WARM_THRESHOLD_CH1_PCU_DIMM0_MSK (0x000000FF)
+ #define PCU_CR_DDR_WARM_THRESHOLD_CH1_PCU_DIMM0_MAX (0x000000FF)
+ #define PCU_CR_DDR_WARM_THRESHOLD_CH1_PCU_DIMM0_DEF (0x000000FF)
+ #define PCU_CR_DDR_WARM_THRESHOLD_CH1_PCU_DIMM1_OFF ( 8)
+ #define PCU_CR_DDR_WARM_THRESHOLD_CH1_PCU_DIMM1_WID ( 8)
+ #define PCU_CR_DDR_WARM_THRESHOLD_CH1_PCU_DIMM1_MSK (0x0000FF00)
+ #define PCU_CR_DDR_WARM_THRESHOLD_CH1_PCU_DIMM1_MAX (0x000000FF)
+ #define PCU_CR_DDR_WARM_THRESHOLD_CH1_PCU_DIMM1_DEF (0x000000FF)
+
+#define PCU_CR_DDR_HOT_THRESHOLD_CH0_PCU_REG (0x00005898)
+ #define PCU_CR_DDR_HOT_THRESHOLD_CH0_PCU_DIMM0_OFF ( 0)
+ #define PCU_CR_DDR_HOT_THRESHOLD_CH0_PCU_DIMM0_WID ( 8)
+ #define PCU_CR_DDR_HOT_THRESHOLD_CH0_PCU_DIMM0_MSK (0x000000FF)
+ #define PCU_CR_DDR_HOT_THRESHOLD_CH0_PCU_DIMM0_MAX (0x000000FF)
+ #define PCU_CR_DDR_HOT_THRESHOLD_CH0_PCU_DIMM0_DEF (0x000000FF)
+ #define PCU_CR_DDR_HOT_THRESHOLD_CH0_PCU_DIMM1_OFF ( 8)
+ #define PCU_CR_DDR_HOT_THRESHOLD_CH0_PCU_DIMM1_WID ( 8)
+ #define PCU_CR_DDR_HOT_THRESHOLD_CH0_PCU_DIMM1_MSK (0x0000FF00)
+ #define PCU_CR_DDR_HOT_THRESHOLD_CH0_PCU_DIMM1_MAX (0x000000FF)
+ #define PCU_CR_DDR_HOT_THRESHOLD_CH0_PCU_DIMM1_DEF (0x000000FF)
+
+#define PCU_CR_DDR_HOT_THRESHOLD_CH1_PCU_REG (0x0000589C)
+ #define PCU_CR_DDR_HOT_THRESHOLD_CH1_PCU_DIMM0_OFF ( 0)
+ #define PCU_CR_DDR_HOT_THRESHOLD_CH1_PCU_DIMM0_WID ( 8)
+ #define PCU_CR_DDR_HOT_THRESHOLD_CH1_PCU_DIMM0_MSK (0x000000FF)
+ #define PCU_CR_DDR_HOT_THRESHOLD_CH1_PCU_DIMM0_MAX (0x000000FF)
+ #define PCU_CR_DDR_HOT_THRESHOLD_CH1_PCU_DIMM0_DEF (0x000000FF)
+ #define PCU_CR_DDR_HOT_THRESHOLD_CH1_PCU_DIMM1_OFF ( 8)
+ #define PCU_CR_DDR_HOT_THRESHOLD_CH1_PCU_DIMM1_WID ( 8)
+ #define PCU_CR_DDR_HOT_THRESHOLD_CH1_PCU_DIMM1_MSK (0x0000FF00)
+ #define PCU_CR_DDR_HOT_THRESHOLD_CH1_PCU_DIMM1_MAX (0x000000FF)
+ #define PCU_CR_DDR_HOT_THRESHOLD_CH1_PCU_DIMM1_DEF (0x000000FF)
+
+#define PCU_CR_DDR_THERM_CAMARILLO_INTERRUPT_PCU_REG (0x000058A0)
+ #define PCU_CR_DDR_THERM_CAMARILLO_INTERRUPT_PCU_ENABLE_WARM_INTERRUPT_OFF ( 0)
+ #define PCU_CR_DDR_THERM_CAMARILLO_INTERRUPT_PCU_ENABLE_WARM_INTERRUPT_WID ( 1)
+ #define PCU_CR_DDR_THERM_CAMARILLO_INTERRUPT_PCU_ENABLE_WARM_INTERRUPT_MSK (0x00000001)
+ #define PCU_CR_DDR_THERM_CAMARILLO_INTERRUPT_PCU_ENABLE_WARM_INTERRUPT_MAX (0x00000001)
+ #define PCU_CR_DDR_THERM_CAMARILLO_INTERRUPT_PCU_ENABLE_WARM_INTERRUPT_DEF (0x00000000)
+ #define PCU_CR_DDR_THERM_CAMARILLO_INTERRUPT_PCU_ENABLE_HOT_INTERRUPT_OFF ( 2)
+ #define PCU_CR_DDR_THERM_CAMARILLO_INTERRUPT_PCU_ENABLE_HOT_INTERRUPT_WID ( 1)
+ #define PCU_CR_DDR_THERM_CAMARILLO_INTERRUPT_PCU_ENABLE_HOT_INTERRUPT_MSK (0x00000004)
+ #define PCU_CR_DDR_THERM_CAMARILLO_INTERRUPT_PCU_ENABLE_HOT_INTERRUPT_MAX (0x00000001)
+ #define PCU_CR_DDR_THERM_CAMARILLO_INTERRUPT_PCU_ENABLE_HOT_INTERRUPT_DEF (0x00000000)
+ #define PCU_CR_DDR_THERM_CAMARILLO_INTERRUPT_PCU_ENABLE_2X_REFRESH_INTERRUPT_OFF ( 4)
+ #define PCU_CR_DDR_THERM_CAMARILLO_INTERRUPT_PCU_ENABLE_2X_REFRESH_INTERRUPT_WID ( 1)
+ #define PCU_CR_DDR_THERM_CAMARILLO_INTERRUPT_PCU_ENABLE_2X_REFRESH_INTERRUPT_MSK (0x00000010)
+ #define PCU_CR_DDR_THERM_CAMARILLO_INTERRUPT_PCU_ENABLE_2X_REFRESH_INTERRUPT_MAX (0x00000001)
+ #define PCU_CR_DDR_THERM_CAMARILLO_INTERRUPT_PCU_ENABLE_2X_REFRESH_INTERRUPT_DEF (0x00000000)
+ #define PCU_CR_DDR_THERM_CAMARILLO_INTERRUPT_PCU_ENABLE_THRESHOLD1_INTERRUPT_OFF ( 8)
+ #define PCU_CR_DDR_THERM_CAMARILLO_INTERRUPT_PCU_ENABLE_THRESHOLD1_INTERRUPT_WID ( 1)
+ #define PCU_CR_DDR_THERM_CAMARILLO_INTERRUPT_PCU_ENABLE_THRESHOLD1_INTERRUPT_MSK (0x00000100)
+ #define PCU_CR_DDR_THERM_CAMARILLO_INTERRUPT_PCU_ENABLE_THRESHOLD1_INTERRUPT_MAX (0x00000001)
+ #define PCU_CR_DDR_THERM_CAMARILLO_INTERRUPT_PCU_ENABLE_THRESHOLD1_INTERRUPT_DEF (0x00000000)
+ #define PCU_CR_DDR_THERM_CAMARILLO_INTERRUPT_PCU_ENABLE_THRESHOLD2_INTERRUPT_OFF (10)
+ #define PCU_CR_DDR_THERM_CAMARILLO_INTERRUPT_PCU_ENABLE_THRESHOLD2_INTERRUPT_WID ( 1)
+ #define PCU_CR_DDR_THERM_CAMARILLO_INTERRUPT_PCU_ENABLE_THRESHOLD2_INTERRUPT_MSK (0x00000400)
+ #define PCU_CR_DDR_THERM_CAMARILLO_INTERRUPT_PCU_ENABLE_THRESHOLD2_INTERRUPT_MAX (0x00000001)
+ #define PCU_CR_DDR_THERM_CAMARILLO_INTERRUPT_PCU_ENABLE_THRESHOLD2_INTERRUPT_DEF (0x00000000)
+ #define PCU_CR_DDR_THERM_CAMARILLO_INTERRUPT_PCU_POLICY_FREE_THRESHOLD1_OFF (16)
+ #define PCU_CR_DDR_THERM_CAMARILLO_INTERRUPT_PCU_POLICY_FREE_THRESHOLD1_WID ( 8)
+ #define PCU_CR_DDR_THERM_CAMARILLO_INTERRUPT_PCU_POLICY_FREE_THRESHOLD1_MSK (0x00FF0000)
+ #define PCU_CR_DDR_THERM_CAMARILLO_INTERRUPT_PCU_POLICY_FREE_THRESHOLD1_MAX (0x000000FF)
+ #define PCU_CR_DDR_THERM_CAMARILLO_INTERRUPT_PCU_POLICY_FREE_THRESHOLD1_DEF (0x00000000)
+ #define PCU_CR_DDR_THERM_CAMARILLO_INTERRUPT_PCU_POLICY_FREE_THRESHOLD2_OFF (24)
+ #define PCU_CR_DDR_THERM_CAMARILLO_INTERRUPT_PCU_POLICY_FREE_THRESHOLD2_WID ( 8)
+ #define PCU_CR_DDR_THERM_CAMARILLO_INTERRUPT_PCU_POLICY_FREE_THRESHOLD2_MSK (0xFF000000)
+ #define PCU_CR_DDR_THERM_CAMARILLO_INTERRUPT_PCU_POLICY_FREE_THRESHOLD2_MAX (0x000000FF)
+ #define PCU_CR_DDR_THERM_CAMARILLO_INTERRUPT_PCU_POLICY_FREE_THRESHOLD2_DEF (0x00000000)
+
+#define PCU_CR_DDR_VOLTAGE_PCU_REG (0x000058A4)
+ #define PCU_CR_DDR_VOLTAGE_PCU_DDR_VOLTAGE_OFF ( 0)
+ #define PCU_CR_DDR_VOLTAGE_PCU_DDR_VOLTAGE_WID ( 3)
+ #define PCU_CR_DDR_VOLTAGE_PCU_DDR_VOLTAGE_MSK (0x00000007)
+ #define PCU_CR_DDR_VOLTAGE_PCU_DDR_VOLTAGE_MAX (0x00000007)
+ #define PCU_CR_DDR_VOLTAGE_PCU_DDR_VOLTAGE_DEF (0x00000000)
+
+#define PCU_CR_PACKAGE_THERM_MARGIN_PCU_REG (0x000058A8)
+ #define PCU_CR_PACKAGE_THERM_MARGIN_PCU_THERM_MARGIN_OFF ( 0)
+ #define PCU_CR_PACKAGE_THERM_MARGIN_PCU_THERM_MARGIN_WID (16)
+ #define PCU_CR_PACKAGE_THERM_MARGIN_PCU_THERM_MARGIN_MSK (0x0000FFFF)
+ #define PCU_CR_PACKAGE_THERM_MARGIN_PCU_THERM_MARGIN_MAX (0x0000FFFF)
+ #define PCU_CR_PACKAGE_THERM_MARGIN_PCU_THERM_MARGIN_DEF (0x00007F00)
+
+#define PCU_CR_DDR_DIMM_TEMPERATURE_CH0_PCU_REG (0x000058B0)
+ #define PCU_CR_DDR_DIMM_TEMPERATURE_CH0_PCU_DIMM0_OFF ( 0)
+ #define PCU_CR_DDR_DIMM_TEMPERATURE_CH0_PCU_DIMM0_WID ( 8)
+ #define PCU_CR_DDR_DIMM_TEMPERATURE_CH0_PCU_DIMM0_MSK (0x000000FF)
+ #define PCU_CR_DDR_DIMM_TEMPERATURE_CH0_PCU_DIMM0_MAX (0x000000FF)
+ #define PCU_CR_DDR_DIMM_TEMPERATURE_CH0_PCU_DIMM0_DEF (0x00000000)
+ #define PCU_CR_DDR_DIMM_TEMPERATURE_CH0_PCU_DIMM1_OFF ( 8)
+ #define PCU_CR_DDR_DIMM_TEMPERATURE_CH0_PCU_DIMM1_WID ( 8)
+ #define PCU_CR_DDR_DIMM_TEMPERATURE_CH0_PCU_DIMM1_MSK (0x0000FF00)
+ #define PCU_CR_DDR_DIMM_TEMPERATURE_CH0_PCU_DIMM1_MAX (0x000000FF)
+ #define PCU_CR_DDR_DIMM_TEMPERATURE_CH0_PCU_DIMM1_DEF (0x00000000)
+
+#define PCU_CR_DDR_DIMM_TEMPERATURE_CH1_PCU_REG (0x000058B4)
+ #define PCU_CR_DDR_DIMM_TEMPERATURE_CH1_PCU_DIMM0_OFF ( 0)
+ #define PCU_CR_DDR_DIMM_TEMPERATURE_CH1_PCU_DIMM0_WID ( 8)
+ #define PCU_CR_DDR_DIMM_TEMPERATURE_CH1_PCU_DIMM0_MSK (0x000000FF)
+ #define PCU_CR_DDR_DIMM_TEMPERATURE_CH1_PCU_DIMM0_MAX (0x000000FF)
+ #define PCU_CR_DDR_DIMM_TEMPERATURE_CH1_PCU_DIMM0_DEF (0x00000000)
+ #define PCU_CR_DDR_DIMM_TEMPERATURE_CH1_PCU_DIMM1_OFF ( 8)
+ #define PCU_CR_DDR_DIMM_TEMPERATURE_CH1_PCU_DIMM1_WID ( 8)
+ #define PCU_CR_DDR_DIMM_TEMPERATURE_CH1_PCU_DIMM1_MSK (0x0000FF00)
+ #define PCU_CR_DDR_DIMM_TEMPERATURE_CH1_PCU_DIMM1_MAX (0x000000FF)
+ #define PCU_CR_DDR_DIMM_TEMPERATURE_CH1_PCU_DIMM1_DEF (0x00000000)
+
+#define PCU_CR_DDR_DIMM_HOTTEST_ABSOLUTE_PCU_REG (0x000058B8)
+ #define PCU_CR_DDR_DIMM_HOTTEST_ABSOLUTE_PCU_TEMPERATURE_OFF ( 0)
+ #define PCU_CR_DDR_DIMM_HOTTEST_ABSOLUTE_PCU_TEMPERATURE_WID ( 8)
+ #define PCU_CR_DDR_DIMM_HOTTEST_ABSOLUTE_PCU_TEMPERATURE_MSK (0x000000FF)
+ #define PCU_CR_DDR_DIMM_HOTTEST_ABSOLUTE_PCU_TEMPERATURE_MAX (0x000000FF)
+ #define PCU_CR_DDR_DIMM_HOTTEST_ABSOLUTE_PCU_TEMPERATURE_DEF (0x00000000)
+
+#define PCU_CR_DDR_DIMM_HOTTEST_RELATIVE_PCU_REG (0x000058BC)
+ #define PCU_CR_DDR_DIMM_HOTTEST_RELATIVE_PCU_TEMPERATURE_OFF ( 0)
+ #define PCU_CR_DDR_DIMM_HOTTEST_RELATIVE_PCU_TEMPERATURE_WID ( 8)
+ #define PCU_CR_DDR_DIMM_HOTTEST_RELATIVE_PCU_TEMPERATURE_MSK (0x000000FF)
+ #define PCU_CR_DDR_DIMM_HOTTEST_RELATIVE_PCU_TEMPERATURE_MAX (0x000000FF)
+ #define PCU_CR_DDR_DIMM_HOTTEST_RELATIVE_PCU_TEMPERATURE_DEF (0x0000007F)
+
+#define PCU_CR_DDR_THROTTLE_DURATION_CH0_PCU_REG (0x000058C0)
+ #define PCU_CR_DDR_THROTTLE_DURATION_CH0_PCU_DIMM0_OFF ( 0)
+ #define PCU_CR_DDR_THROTTLE_DURATION_CH0_PCU_DIMM0_WID (16)
+ #define PCU_CR_DDR_THROTTLE_DURATION_CH0_PCU_DIMM0_MSK (0x0000FFFF)
+ #define PCU_CR_DDR_THROTTLE_DURATION_CH0_PCU_DIMM0_MAX (0x0000FFFF)
+ #define PCU_CR_DDR_THROTTLE_DURATION_CH0_PCU_DIMM0_DEF (0x00000000)
+ #define PCU_CR_DDR_THROTTLE_DURATION_CH0_PCU_DIMM1_OFF (16)
+ #define PCU_CR_DDR_THROTTLE_DURATION_CH0_PCU_DIMM1_WID (16)
+ #define PCU_CR_DDR_THROTTLE_DURATION_CH0_PCU_DIMM1_MSK (0xFFFF0000)
+ #define PCU_CR_DDR_THROTTLE_DURATION_CH0_PCU_DIMM1_MAX (0x0000FFFF)
+ #define PCU_CR_DDR_THROTTLE_DURATION_CH0_PCU_DIMM1_DEF (0x00000000)
+
+#define PCU_CR_DDR_THROTTLE_DURATION_CH1_PCU_REG (0x000058C8)
+ #define PCU_CR_DDR_THROTTLE_DURATION_CH1_PCU_DIMM0_OFF ( 0)
+ #define PCU_CR_DDR_THROTTLE_DURATION_CH1_PCU_DIMM0_WID (16)
+ #define PCU_CR_DDR_THROTTLE_DURATION_CH1_PCU_DIMM0_MSK (0x0000FFFF)
+ #define PCU_CR_DDR_THROTTLE_DURATION_CH1_PCU_DIMM0_MAX (0x0000FFFF)
+ #define PCU_CR_DDR_THROTTLE_DURATION_CH1_PCU_DIMM0_DEF (0x00000000)
+ #define PCU_CR_DDR_THROTTLE_DURATION_CH1_PCU_DIMM1_OFF (16)
+ #define PCU_CR_DDR_THROTTLE_DURATION_CH1_PCU_DIMM1_WID (16)
+ #define PCU_CR_DDR_THROTTLE_DURATION_CH1_PCU_DIMM1_MSK (0xFFFF0000)
+ #define PCU_CR_DDR_THROTTLE_DURATION_CH1_PCU_DIMM1_MAX (0x0000FFFF)
+ #define PCU_CR_DDR_THROTTLE_DURATION_CH1_PCU_DIMM1_DEF (0x00000000)
+
+#define PCU_CR_DDR_WARM_BUDGET_CH0_PCU_REG (0x000058D0)
+ #define PCU_CR_DDR_WARM_BUDGET_CH0_PCU_DIMM0_OFF ( 0)
+ #define PCU_CR_DDR_WARM_BUDGET_CH0_PCU_DIMM0_WID ( 8)
+ #define PCU_CR_DDR_WARM_BUDGET_CH0_PCU_DIMM0_MSK (0x000000FF)
+ #define PCU_CR_DDR_WARM_BUDGET_CH0_PCU_DIMM0_MAX (0x000000FF)
+ #define PCU_CR_DDR_WARM_BUDGET_CH0_PCU_DIMM0_DEF (0x000000FF)
+ #define PCU_CR_DDR_WARM_BUDGET_CH0_PCU_DIMM1_OFF ( 8)
+ #define PCU_CR_DDR_WARM_BUDGET_CH0_PCU_DIMM1_WID ( 8)
+ #define PCU_CR_DDR_WARM_BUDGET_CH0_PCU_DIMM1_MSK (0x0000FF00)
+ #define PCU_CR_DDR_WARM_BUDGET_CH0_PCU_DIMM1_MAX (0x000000FF)
+ #define PCU_CR_DDR_WARM_BUDGET_CH0_PCU_DIMM1_DEF (0x000000FF)
+
+#define PCU_CR_DDR_WARM_BUDGET_CH1_PCU_REG (0x000058D4)
+ #define PCU_CR_DDR_WARM_BUDGET_CH1_PCU_DIMM0_OFF ( 0)
+ #define PCU_CR_DDR_WARM_BUDGET_CH1_PCU_DIMM0_WID ( 8)
+ #define PCU_CR_DDR_WARM_BUDGET_CH1_PCU_DIMM0_MSK (0x000000FF)
+ #define PCU_CR_DDR_WARM_BUDGET_CH1_PCU_DIMM0_MAX (0x000000FF)
+ #define PCU_CR_DDR_WARM_BUDGET_CH1_PCU_DIMM0_DEF (0x000000FF)
+ #define PCU_CR_DDR_WARM_BUDGET_CH1_PCU_DIMM1_OFF ( 8)
+ #define PCU_CR_DDR_WARM_BUDGET_CH1_PCU_DIMM1_WID ( 8)
+ #define PCU_CR_DDR_WARM_BUDGET_CH1_PCU_DIMM1_MSK (0x0000FF00)
+ #define PCU_CR_DDR_WARM_BUDGET_CH1_PCU_DIMM1_MAX (0x000000FF)
+ #define PCU_CR_DDR_WARM_BUDGET_CH1_PCU_DIMM1_DEF (0x000000FF)
+
+#define PCU_CR_DDR_HOT_BUDGET_CH0_PCU_REG (0x000058D8)
+ #define PCU_CR_DDR_HOT_BUDGET_CH0_PCU_DIMM0_OFF ( 0)
+ #define PCU_CR_DDR_HOT_BUDGET_CH0_PCU_DIMM0_WID ( 8)
+ #define PCU_CR_DDR_HOT_BUDGET_CH0_PCU_DIMM0_MSK (0x000000FF)
+ #define PCU_CR_DDR_HOT_BUDGET_CH0_PCU_DIMM0_MAX (0x000000FF)
+ #define PCU_CR_DDR_HOT_BUDGET_CH0_PCU_DIMM0_DEF (0x000000FF)
+ #define PCU_CR_DDR_HOT_BUDGET_CH0_PCU_DIMM1_OFF ( 8)
+ #define PCU_CR_DDR_HOT_BUDGET_CH0_PCU_DIMM1_WID ( 8)
+ #define PCU_CR_DDR_HOT_BUDGET_CH0_PCU_DIMM1_MSK (0x0000FF00)
+ #define PCU_CR_DDR_HOT_BUDGET_CH0_PCU_DIMM1_MAX (0x000000FF)
+ #define PCU_CR_DDR_HOT_BUDGET_CH0_PCU_DIMM1_DEF (0x000000FF)
+
+#define PCU_CR_DDR_HOT_BUDGET_CH1_PCU_REG (0x000058DC)
+ #define PCU_CR_DDR_HOT_BUDGET_CH1_PCU_DIMM0_OFF ( 0)
+ #define PCU_CR_DDR_HOT_BUDGET_CH1_PCU_DIMM0_WID ( 8)
+ #define PCU_CR_DDR_HOT_BUDGET_CH1_PCU_DIMM0_MSK (0x000000FF)
+ #define PCU_CR_DDR_HOT_BUDGET_CH1_PCU_DIMM0_MAX (0x000000FF)
+ #define PCU_CR_DDR_HOT_BUDGET_CH1_PCU_DIMM0_DEF (0x000000FF)
+ #define PCU_CR_DDR_HOT_BUDGET_CH1_PCU_DIMM1_OFF ( 8)
+ #define PCU_CR_DDR_HOT_BUDGET_CH1_PCU_DIMM1_WID ( 8)
+ #define PCU_CR_DDR_HOT_BUDGET_CH1_PCU_DIMM1_MSK (0x0000FF00)
+ #define PCU_CR_DDR_HOT_BUDGET_CH1_PCU_DIMM1_MAX (0x000000FF)
+ #define PCU_CR_DDR_HOT_BUDGET_CH1_PCU_DIMM1_DEF (0x000000FF)
+
+#define PCU_CR_DDR_RAPL_LIMIT_PCU_REG (0x000058E0)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LIMIT1_POWER_OFF ( 0)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LIMIT1_POWER_WID (15)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LIMIT1_POWER_MSK (0x00007FFF)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LIMIT1_POWER_MAX (0x00007FFF)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LIMIT1_POWER_DEF (0x00000000)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LIMIT1_ENABLE_OFF (15)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LIMIT1_ENABLE_WID ( 1)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LIMIT1_ENABLE_MSK (0x00008000)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LIMIT1_ENABLE_MAX (0x00000001)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LIMIT1_ENABLE_DEF (0x00000000)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LIMIT1_TIME_WINDOW_Y_OFF (17)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LIMIT1_TIME_WINDOW_Y_WID ( 5)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LIMIT1_TIME_WINDOW_Y_MSK (0x003E0000)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LIMIT1_TIME_WINDOW_Y_MAX (0x0000001F)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LIMIT1_TIME_WINDOW_Y_DEF (0x00000000)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LIMIT1_TIME_WINDOW_X_OFF (22)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LIMIT1_TIME_WINDOW_X_WID ( 2)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LIMIT1_TIME_WINDOW_X_MSK (0x00C00000)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LIMIT1_TIME_WINDOW_X_MAX (0x00000003)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LIMIT1_TIME_WINDOW_X_DEF (0x00000000)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LIMIT2_POWER_OFF (32)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LIMIT2_POWER_WID (15)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LIMIT2_POWER_MSK (0x7FFF00000000)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LIMIT2_POWER_MAX (0x00007FFF)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LIMIT2_POWER_DEF (0x00000000)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LIMIT2_ENABLE_OFF (47)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LIMIT2_ENABLE_WID ( 1)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LIMIT2_ENABLE_MSK (0x800000000000)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LIMIT2_ENABLE_MAX (0x00000001)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LIMIT2_ENABLE_DEF (0x00000000)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LIMIT2_TIME_WINDOW_Y_OFF (49)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LIMIT2_TIME_WINDOW_Y_WID ( 5)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LIMIT2_TIME_WINDOW_Y_MSK (0x3E000000000000)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LIMIT2_TIME_WINDOW_Y_MAX (0x0000001F)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LIMIT2_TIME_WINDOW_Y_DEF (0x00000000)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LIMIT2_TIME_WINDOW_X_OFF (54)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LIMIT2_TIME_WINDOW_X_WID ( 2)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LIMIT2_TIME_WINDOW_X_MSK (0xC0000000000000)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LIMIT2_TIME_WINDOW_X_MAX (0x00000003)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LIMIT2_TIME_WINDOW_X_DEF (0x00000000)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LOCKED_OFF (63)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LOCKED_WID ( 1)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LOCKED_MSK (0x8000000000000000)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LOCKED_MAX (0x00000001)
+ #define PCU_CR_DDR_RAPL_LIMIT_PCU_LOCKED_DEF (0x00000000)
+
+#define PCU_CR_DDR_ENERGY_STATUS_PCU_REG (0x000058E8)
+ #define PCU_CR_DDR_ENERGY_STATUS_PCU_JOULES_CONSUMED_OFF ( 0)
+ #define PCU_CR_DDR_ENERGY_STATUS_PCU_JOULES_CONSUMED_WID (32)
+ #define PCU_CR_DDR_ENERGY_STATUS_PCU_JOULES_CONSUMED_MSK (0xFFFFFFFF)
+ #define PCU_CR_DDR_ENERGY_STATUS_PCU_JOULES_CONSUMED_MAX (0xFFFFFFFF)
+ #define PCU_CR_DDR_ENERGY_STATUS_PCU_JOULES_CONSUMED_DEF (0x00000000)
+
+#define PCU_CR_DDR_RAPL_PERF_STATUS_PCU_REG (0x000058EC)
+ #define PCU_CR_DDR_RAPL_PERF_STATUS_PCU_DURATION_OFF ( 0)
+ #define PCU_CR_DDR_RAPL_PERF_STATUS_PCU_DURATION_WID (32)
+ #define PCU_CR_DDR_RAPL_PERF_STATUS_PCU_DURATION_MSK (0xFFFFFFFF)
+ #define PCU_CR_DDR_RAPL_PERF_STATUS_PCU_DURATION_MAX (0xFFFFFFFF)
+ #define PCU_CR_DDR_RAPL_PERF_STATUS_PCU_DURATION_DEF (0x00000000)
+
+#define PCU_CR_PACKAGE_RAPL_PERF_STATUS_PCU_REG (0x000058F0)
+ #define PCU_CR_PACKAGE_RAPL_PERF_STATUS_PCU_COUNTS_OFF ( 0)
+ #define PCU_CR_PACKAGE_RAPL_PERF_STATUS_PCU_COUNTS_WID (32)
+ #define PCU_CR_PACKAGE_RAPL_PERF_STATUS_PCU_COUNTS_MSK (0xFFFFFFFF)
+ #define PCU_CR_PACKAGE_RAPL_PERF_STATUS_PCU_COUNTS_MAX (0xFFFFFFFF)
+ #define PCU_CR_PACKAGE_RAPL_PERF_STATUS_PCU_COUNTS_DEF (0x00000000)
+
+#define PCU_CR_GT_RATIOS_OVERRIDE_PCU_REG (0x000058F4)
+ #define PCU_CR_GT_RATIOS_OVERRIDE_PCU_IA_MIN_RATIO_REQUEST_OFF ( 0)
+ #define PCU_CR_GT_RATIOS_OVERRIDE_PCU_IA_MIN_RATIO_REQUEST_WID ( 8)
+ #define PCU_CR_GT_RATIOS_OVERRIDE_PCU_IA_MIN_RATIO_REQUEST_MSK (0x000000FF)
+ #define PCU_CR_GT_RATIOS_OVERRIDE_PCU_IA_MIN_RATIO_REQUEST_MAX (0x000000FF)
+ #define PCU_CR_GT_RATIOS_OVERRIDE_PCU_IA_MIN_RATIO_REQUEST_DEF (0x00000000)
+ #define PCU_CR_GT_RATIOS_OVERRIDE_PCU_CLR_MIN_RATIO_REQUEST_OFF ( 8)
+ #define PCU_CR_GT_RATIOS_OVERRIDE_PCU_CLR_MIN_RATIO_REQUEST_WID ( 8)
+ #define PCU_CR_GT_RATIOS_OVERRIDE_PCU_CLR_MIN_RATIO_REQUEST_MSK (0x0000FF00)
+ #define PCU_CR_GT_RATIOS_OVERRIDE_PCU_CLR_MIN_RATIO_REQUEST_MAX (0x000000FF)
+ #define PCU_CR_GT_RATIOS_OVERRIDE_PCU_CLR_MIN_RATIO_REQUEST_DEF (0x00000000)
+
+#define PCU_CR_PKGC_LTR_LATENCY_MEASUREMENTS_PCU_REG (0x000058F8)
+ #define PCU_CR_PKGC_LTR_LATENCY_MEASUREMENTS_PCU_DDR_ACCESS_TIME_OFF ( 0)
+ #define PCU_CR_PKGC_LTR_LATENCY_MEASUREMENTS_PCU_DDR_ACCESS_TIME_WID (14)
+ #define PCU_CR_PKGC_LTR_LATENCY_MEASUREMENTS_PCU_DDR_ACCESS_TIME_MSK (0x00003FFF)
+ #define PCU_CR_PKGC_LTR_LATENCY_MEASUREMENTS_PCU_DDR_ACCESS_TIME_MAX (0x00003FFF)
+ #define PCU_CR_PKGC_LTR_LATENCY_MEASUREMENTS_PCU_DDR_ACCESS_TIME_DEF (0x00000000)
+ #define PCU_CR_PKGC_LTR_LATENCY_MEASUREMENTS_PCU_RESERVED_OFF (14)
+ #define PCU_CR_PKGC_LTR_LATENCY_MEASUREMENTS_PCU_RESERVED_WID ( 1)
+ #define PCU_CR_PKGC_LTR_LATENCY_MEASUREMENTS_PCU_RESERVED_MSK (0x00004000)
+ #define PCU_CR_PKGC_LTR_LATENCY_MEASUREMENTS_PCU_RESERVED_MAX (0x00000001)
+ #define PCU_CR_PKGC_LTR_LATENCY_MEASUREMENTS_PCU_RESERVED_DEF (0x00000000)
+ #define PCU_CR_PKGC_LTR_LATENCY_MEASUREMENTS_PCU_CLR_ACCESS_TIME_OFF (15)
+ #define PCU_CR_PKGC_LTR_LATENCY_MEASUREMENTS_PCU_CLR_ACCESS_TIME_WID (14)
+ #define PCU_CR_PKGC_LTR_LATENCY_MEASUREMENTS_PCU_CLR_ACCESS_TIME_MSK (0x1FFF8000)
+ #define PCU_CR_PKGC_LTR_LATENCY_MEASUREMENTS_PCU_CLR_ACCESS_TIME_MAX (0x00003FFF)
+ #define PCU_CR_PKGC_LTR_LATENCY_MEASUREMENTS_PCU_CLR_ACCESS_TIME_DEF (0x00000000)
+ #define PCU_CR_PKGC_LTR_LATENCY_MEASUREMENTS_PCU_NON_SNOOP_THRESHOLD_RESOLUTION_OFF (29)
+ #define PCU_CR_PKGC_LTR_LATENCY_MEASUREMENTS_PCU_NON_SNOOP_THRESHOLD_RESOLUTION_WID ( 1)
+ #define PCU_CR_PKGC_LTR_LATENCY_MEASUREMENTS_PCU_NON_SNOOP_THRESHOLD_RESOLUTION_MSK (0x20000000)
+ #define PCU_CR_PKGC_LTR_LATENCY_MEASUREMENTS_PCU_NON_SNOOP_THRESHOLD_RESOLUTION_MAX (0x00000001)
+ #define PCU_CR_PKGC_LTR_LATENCY_MEASUREMENTS_PCU_NON_SNOOP_THRESHOLD_RESOLUTION_DEF (0x00000000)
+ #define PCU_CR_PKGC_LTR_LATENCY_MEASUREMENTS_PCU_SLOW_SNOOP_THRESHOLD_RESOLUTION_OFF (30)
+ #define PCU_CR_PKGC_LTR_LATENCY_MEASUREMENTS_PCU_SLOW_SNOOP_THRESHOLD_RESOLUTION_WID ( 1)
+ #define PCU_CR_PKGC_LTR_LATENCY_MEASUREMENTS_PCU_SLOW_SNOOP_THRESHOLD_RESOLUTION_MSK (0x40000000)
+ #define PCU_CR_PKGC_LTR_LATENCY_MEASUREMENTS_PCU_SLOW_SNOOP_THRESHOLD_RESOLUTION_MAX (0x00000001)
+ #define PCU_CR_PKGC_LTR_LATENCY_MEASUREMENTS_PCU_SLOW_SNOOP_THRESHOLD_RESOLUTION_DEF (0x00000000)
+ #define PCU_CR_PKGC_LTR_LATENCY_MEASUREMENTS_PCU_FAST_SNOOP_THRESHOLD_RESOLUTION_OFF (31)
+ #define PCU_CR_PKGC_LTR_LATENCY_MEASUREMENTS_PCU_FAST_SNOOP_THRESHOLD_RESOLUTION_WID ( 1)
+ #define PCU_CR_PKGC_LTR_LATENCY_MEASUREMENTS_PCU_FAST_SNOOP_THRESHOLD_RESOLUTION_MSK (0x80000000)
+ #define PCU_CR_PKGC_LTR_LATENCY_MEASUREMENTS_PCU_FAST_SNOOP_THRESHOLD_RESOLUTION_MAX (0x00000001)
+ #define PCU_CR_PKGC_LTR_LATENCY_MEASUREMENTS_PCU_FAST_SNOOP_THRESHOLD_RESOLUTION_DEF (0x00000000)
+
+#define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_REG (0x000058FC)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_PROCHOT_STATUS_OFF ( 0)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_PROCHOT_STATUS_WID ( 1)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_PROCHOT_STATUS_MSK (0x00000001)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_PROCHOT_STATUS_MAX (0x00000001)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_PROCHOT_STATUS_DEF (0x00000000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_THERMAL_STATUS_OFF ( 1)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_THERMAL_STATUS_WID ( 1)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_THERMAL_STATUS_MSK (0x00000002)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_THERMAL_STATUS_MAX (0x00000001)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_THERMAL_STATUS_DEF (0x00000000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_2_OFF ( 2)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_2_WID ( 1)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_2_MSK (0x00000004)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_2_MAX (0x00000001)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_2_DEF (0x00000000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_PBM_PL1_STATUS_OFF ( 3)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_PBM_PL1_STATUS_WID ( 1)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_PBM_PL1_STATUS_MSK (0x00000008)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_PBM_PL1_STATUS_MAX (0x00000001)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_PBM_PL1_STATUS_DEF (0x00000000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_PBM_PL2_STATUS_OFF ( 4)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_PBM_PL2_STATUS_WID ( 1)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_PBM_PL2_STATUS_MSK (0x00000010)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_PBM_PL2_STATUS_MAX (0x00000001)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_PBM_PL2_STATUS_DEF (0x00000000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_PBM_PLIA_STATUS_OFF ( 5)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_PBM_PLIA_STATUS_WID ( 1)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_PBM_PLIA_STATUS_MSK (0x00000020)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_PBM_PLIA_STATUS_MAX (0x00000001)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_PBM_PLIA_STATUS_DEF (0x00000000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_6_OFF ( 6)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_6_WID ( 1)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_6_MSK (0x00000040)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_6_MAX (0x00000001)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_6_DEF (0x00000000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_GTDRIVER_STATUS_OFF ( 7)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_GTDRIVER_STATUS_WID ( 1)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_GTDRIVER_STATUS_MSK (0x00000080)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_GTDRIVER_STATUS_MAX (0x00000001)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_GTDRIVER_STATUS_DEF (0x00000000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_VR_THERMALERT_STATUS_OFF ( 8)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_VR_THERMALERT_STATUS_WID ( 1)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_VR_THERMALERT_STATUS_MSK (0x00000100)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_VR_THERMALERT_STATUS_MAX (0x00000001)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_VR_THERMALERT_STATUS_DEF (0x00000000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_FUSE_MAX_TURBO_LIMIT_STATUS_OFF ( 9)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_FUSE_MAX_TURBO_LIMIT_STATUS_WID ( 1)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_FUSE_MAX_TURBO_LIMIT_STATUS_MSK (0x00000200)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_FUSE_MAX_TURBO_LIMIT_STATUS_MAX (0x00000001)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_FUSE_MAX_TURBO_LIMIT_STATUS_DEF (0x00000000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_EDP_ICC_STATUS_OFF (10)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_EDP_ICC_STATUS_WID ( 1)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_EDP_ICC_STATUS_MSK (0x00000400)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_EDP_ICC_STATUS_MAX (0x00000001)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_EDP_ICC_STATUS_DEF (0x00000000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_TURBO_ATTEN_STATUS_OFF (11)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_TURBO_ATTEN_STATUS_WID ( 1)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_TURBO_ATTEN_STATUS_MSK (0x00000800)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_TURBO_ATTEN_STATUS_MAX (0x00000001)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_TURBO_ATTEN_STATUS_DEF (0x00000000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_12_OFF (12)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_12_WID ( 1)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_12_MSK (0x00001000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_12_MAX (0x00000001)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_12_DEF (0x00000000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_13_OFF (13)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_13_WID ( 1)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_13_MSK (0x00002000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_13_MAX (0x00000001)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_13_DEF (0x00000000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_14_OFF (14)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_14_WID ( 1)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_14_MSK (0x00004000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_14_MAX (0x00000001)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_14_DEF (0x00000000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_15_OFF (15)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_15_WID ( 1)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_15_MSK (0x00008000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_15_MAX (0x00000001)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_15_DEF (0x00000000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_PROCHOT_LOG_OFF (16)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_PROCHOT_LOG_WID ( 1)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_PROCHOT_LOG_MSK (0x00010000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_PROCHOT_LOG_MAX (0x00000001)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_PROCHOT_LOG_DEF (0x00000000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_THERMAL_LOG_OFF (17)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_THERMAL_LOG_WID ( 1)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_THERMAL_LOG_MSK (0x00020000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_THERMAL_LOG_MAX (0x00000001)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_THERMAL_LOG_DEF (0x00000000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_LOG_2_OFF (18)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_LOG_2_WID ( 1)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_LOG_2_MSK (0x00040000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_LOG_2_MAX (0x00000001)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_LOG_2_DEF (0x00000000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_PBM_PL1_LOG_OFF (19)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_PBM_PL1_LOG_WID ( 1)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_PBM_PL1_LOG_MSK (0x00080000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_PBM_PL1_LOG_MAX (0x00000001)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_PBM_PL1_LOG_DEF (0x00000000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_PBM_PL2_LOG_OFF (20)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_PBM_PL2_LOG_WID ( 1)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_PBM_PL2_LOG_MSK (0x00100000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_PBM_PL2_LOG_MAX (0x00000001)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_PBM_PL2_LOG_DEF (0x00000000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_PBM_PLIA_LOG_OFF (21)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_PBM_PLIA_LOG_WID ( 1)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_PBM_PLIA_LOG_MSK (0x00200000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_PBM_PLIA_LOG_MAX (0x00000001)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_PBM_PLIA_LOG_DEF (0x00000000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_LOG_6_OFF (22)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_LOG_6_WID ( 1)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_LOG_6_MSK (0x00400000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_LOG_6_MAX (0x00000001)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_LOG_6_DEF (0x00000000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_GTDRIVER_LOG_OFF (23)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_GTDRIVER_LOG_WID ( 1)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_GTDRIVER_LOG_MSK (0x00800000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_GTDRIVER_LOG_MAX (0x00000001)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_GTDRIVER_LOG_DEF (0x00000000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_VR_THERMALERT_LOG_OFF (24)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_VR_THERMALERT_LOG_WID ( 1)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_VR_THERMALERT_LOG_MSK (0x01000000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_VR_THERMALERT_LOG_MAX (0x00000001)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_VR_THERMALERT_LOG_DEF (0x00000000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_FUSE_MAX_TURBO_LIMIT_LOG_OFF (25)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_FUSE_MAX_TURBO_LIMIT_LOG_WID ( 1)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_FUSE_MAX_TURBO_LIMIT_LOG_MSK (0x02000000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_FUSE_MAX_TURBO_LIMIT_LOG_MAX (0x00000001)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_FUSE_MAX_TURBO_LIMIT_LOG_DEF (0x00000000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_EDP_ICC_LOG_OFF (26)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_EDP_ICC_LOG_WID ( 1)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_EDP_ICC_LOG_MSK (0x04000000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_EDP_ICC_LOG_MAX (0x00000001)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_EDP_ICC_LOG_DEF (0x00000000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_TURBO_ATTEN_LOG_OFF (27)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_TURBO_ATTEN_LOG_WID ( 1)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_TURBO_ATTEN_LOG_MSK (0x08000000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_TURBO_ATTEN_LOG_MAX (0x00000001)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_TURBO_ATTEN_LOG_DEF (0x00000000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_LOG_12_OFF (28)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_LOG_12_WID ( 1)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_LOG_12_MSK (0x10000000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_LOG_12_MAX (0x00000001)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_LOG_12_DEF (0x00000000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_LOG_13_OFF (29)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_LOG_13_WID ( 1)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_LOG_13_MSK (0x20000000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_LOG_13_MAX (0x00000001)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_LOG_13_DEF (0x00000000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_LOG_14_OFF (30)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_LOG_14_WID ( 1)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_LOG_14_MSK (0x40000000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_LOG_14_MAX (0x00000001)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_LOG_14_DEF (0x00000000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_LOG_15_OFF (31)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_LOG_15_WID ( 1)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_LOG_15_MSK (0x80000000)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_LOG_15_MAX (0x00000001)
+ #define PCU_CR_IA_PERF_LIMIT_REASONS_PCU_SPARE_IA_LOG_15_DEF (0x00000000)
+
+#define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_REG (0x00005900)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_PROCHOT_STATUS_OFF ( 0)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_PROCHOT_STATUS_WID ( 1)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_PROCHOT_STATUS_MSK (0x00000001)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_PROCHOT_STATUS_MAX (0x00000001)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_PROCHOT_STATUS_DEF (0x00000000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_THERMAL_STATUS_OFF ( 1)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_THERMAL_STATUS_WID ( 1)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_THERMAL_STATUS_MSK (0x00000002)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_THERMAL_STATUS_MAX (0x00000001)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_THERMAL_STATUS_DEF (0x00000000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_2_OFF ( 2)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_2_WID ( 1)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_2_MSK (0x00000004)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_2_MAX (0x00000001)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_2_DEF (0x00000000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_PBM_PL1_STATUS_OFF ( 3)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_PBM_PL1_STATUS_WID ( 1)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_PBM_PL1_STATUS_MSK (0x00000008)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_PBM_PL1_STATUS_MAX (0x00000001)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_PBM_PL1_STATUS_DEF (0x00000000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_PBM_PL2_STATUS_OFF ( 4)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_PBM_PL2_STATUS_WID ( 1)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_PBM_PL2_STATUS_MSK (0x00000010)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_PBM_PL2_STATUS_MAX (0x00000001)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_PBM_PL2_STATUS_DEF (0x00000000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_PBM_PLGT_STATUS_OFF ( 5)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_PBM_PLGT_STATUS_WID ( 1)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_PBM_PLGT_STATUS_MSK (0x00000020)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_PBM_PLGT_STATUS_MAX (0x00000001)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_PBM_PLGT_STATUS_DEF (0x00000000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_6_OFF ( 6)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_6_WID ( 1)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_6_MSK (0x00000040)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_6_MAX (0x00000001)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_6_DEF (0x00000000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_7_OFF ( 7)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_7_WID ( 1)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_7_MSK (0x00000080)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_7_MAX (0x00000001)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_7_DEF (0x00000000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_VR_THERMALERT_STATUS_OFF ( 8)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_VR_THERMALERT_STATUS_WID ( 1)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_VR_THERMALERT_STATUS_MSK (0x00000100)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_VR_THERMALERT_STATUS_MAX (0x00000001)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_VR_THERMALERT_STATUS_DEF (0x00000000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_9_OFF ( 9)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_9_WID ( 1)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_9_MSK (0x00000200)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_9_MAX (0x00000001)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_9_DEF (0x00000000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_EDP_ICC_STATUS_OFF (10)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_EDP_ICC_STATUS_WID ( 1)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_EDP_ICC_STATUS_MSK (0x00000400)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_EDP_ICC_STATUS_MAX (0x00000001)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_EDP_ICC_STATUS_DEF (0x00000000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_11_OFF (11)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_11_WID ( 1)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_11_MSK (0x00000800)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_11_MAX (0x00000001)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_11_DEF (0x00000000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_12_OFF (12)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_12_WID ( 1)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_12_MSK (0x00001000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_12_MAX (0x00000001)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_12_DEF (0x00000000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_13_OFF (13)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_13_WID ( 1)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_13_MSK (0x00002000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_13_MAX (0x00000001)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_13_DEF (0x00000000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_14_OFF (14)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_14_WID ( 1)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_14_MSK (0x00004000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_14_MAX (0x00000001)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_14_DEF (0x00000000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_15_OFF (15)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_15_WID ( 1)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_15_MSK (0x00008000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_15_MAX (0x00000001)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_15_DEF (0x00000000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_PROCHOT_LOG_OFF (16)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_PROCHOT_LOG_WID ( 1)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_PROCHOT_LOG_MSK (0x00010000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_PROCHOT_LOG_MAX (0x00000001)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_PROCHOT_LOG_DEF (0x00000000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_THERMAL_LOG_OFF (17)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_THERMAL_LOG_WID ( 1)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_THERMAL_LOG_MSK (0x00020000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_THERMAL_LOG_MAX (0x00000001)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_THERMAL_LOG_DEF (0x00000000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_2_OFF (18)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_2_WID ( 1)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_2_MSK (0x00040000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_2_MAX (0x00000001)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_2_DEF (0x00000000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_PBM_PL1_LOG_OFF (19)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_PBM_PL1_LOG_WID ( 1)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_PBM_PL1_LOG_MSK (0x00080000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_PBM_PL1_LOG_MAX (0x00000001)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_PBM_PL1_LOG_DEF (0x00000000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_PBM_PL2_LOG_OFF (20)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_PBM_PL2_LOG_WID ( 1)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_PBM_PL2_LOG_MSK (0x00100000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_PBM_PL2_LOG_MAX (0x00000001)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_PBM_PL2_LOG_DEF (0x00000000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_PBM_PLGT_LOG_OFF (21)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_PBM_PLGT_LOG_WID ( 1)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_PBM_PLGT_LOG_MSK (0x00200000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_PBM_PLGT_LOG_MAX (0x00000001)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_PBM_PLGT_LOG_DEF (0x00000000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_6_OFF (22)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_6_WID ( 1)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_6_MSK (0x00400000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_6_MAX (0x00000001)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_6_DEF (0x00000000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_7_OFF (23)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_7_WID ( 1)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_7_MSK (0x00800000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_7_MAX (0x00000001)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_7_DEF (0x00000000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_VR_THERMALERT_LOG_OFF (24)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_VR_THERMALERT_LOG_WID ( 1)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_VR_THERMALERT_LOG_MSK (0x01000000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_VR_THERMALERT_LOG_MAX (0x00000001)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_VR_THERMALERT_LOG_DEF (0x00000000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_9_OFF (25)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_9_WID ( 1)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_9_MSK (0x02000000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_9_MAX (0x00000001)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_9_DEF (0x00000000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_EDP_ICC_LOG_OFF (26)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_EDP_ICC_LOG_WID ( 1)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_EDP_ICC_LOG_MSK (0x04000000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_EDP_ICC_LOG_MAX (0x00000001)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_EDP_ICC_LOG_DEF (0x00000000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_11_OFF (27)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_11_WID ( 1)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_11_MSK (0x08000000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_11_MAX (0x00000001)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_11_DEF (0x00000000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_12_OFF (28)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_12_WID ( 1)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_12_MSK (0x10000000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_12_MAX (0x00000001)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_12_DEF (0x00000000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_13_OFF (29)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_13_WID ( 1)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_13_MSK (0x20000000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_13_MAX (0x00000001)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_13_DEF (0x00000000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_14_OFF (30)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_14_WID ( 1)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_14_MSK (0x40000000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_14_MAX (0x00000001)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_14_DEF (0x00000000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_15_OFF (31)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_15_WID ( 1)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_15_MSK (0x80000000)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_15_MAX (0x00000001)
+ #define PCU_CR_GT_PERF_LIMIT_REASONS_PCU_SPARE_GT_LOG_15_DEF (0x00000000)
+
+#define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_REG (0x00005904)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_PROCHOT_STATUS_OFF ( 0)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_PROCHOT_STATUS_WID ( 1)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_PROCHOT_STATUS_MSK (0x00000001)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_PROCHOT_STATUS_MAX (0x00000001)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_PROCHOT_STATUS_DEF (0x00000000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_THERMAL_STATUS_OFF ( 1)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_THERMAL_STATUS_WID ( 1)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_THERMAL_STATUS_MSK (0x00000002)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_THERMAL_STATUS_MAX (0x00000001)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_THERMAL_STATUS_DEF (0x00000000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_2_OFF ( 2)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_2_WID ( 1)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_2_MSK (0x00000004)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_2_MAX (0x00000001)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_2_DEF (0x00000000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_PBM_PL1_STATUS_OFF ( 3)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_PBM_PL1_STATUS_WID ( 1)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_PBM_PL1_STATUS_MSK (0x00000008)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_PBM_PL1_STATUS_MAX (0x00000001)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_PBM_PL1_STATUS_DEF (0x00000000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_PBM_PL2_STATUS_OFF ( 4)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_PBM_PL2_STATUS_WID ( 1)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_PBM_PL2_STATUS_MSK (0x00000010)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_PBM_PL2_STATUS_MAX (0x00000001)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_PBM_PL2_STATUS_DEF (0x00000000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_5_OFF ( 5)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_5_WID ( 1)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_5_MSK (0x00000020)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_5_MAX (0x00000001)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_5_DEF (0x00000000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_6_OFF ( 6)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_6_WID ( 1)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_6_MSK (0x00000040)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_6_MAX (0x00000001)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_6_DEF (0x00000000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_7_OFF ( 7)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_7_WID ( 1)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_7_MSK (0x00000080)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_7_MAX (0x00000001)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_7_DEF (0x00000000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_VR_THERMALERT_STATUS_OFF ( 8)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_VR_THERMALERT_STATUS_WID ( 1)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_VR_THERMALERT_STATUS_MSK (0x00000100)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_VR_THERMALERT_STATUS_MAX (0x00000001)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_VR_THERMALERT_STATUS_DEF (0x00000000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_9_OFF ( 9)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_9_WID ( 1)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_9_MSK (0x00000200)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_9_MAX (0x00000001)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_9_DEF (0x00000000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_EDP_ICC_STATUS_OFF (10)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_EDP_ICC_STATUS_WID ( 1)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_EDP_ICC_STATUS_MSK (0x00000400)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_EDP_ICC_STATUS_MAX (0x00000001)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_EDP_ICC_STATUS_DEF (0x00000000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_11_OFF (11)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_11_WID ( 1)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_11_MSK (0x00000800)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_11_MAX (0x00000001)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_11_DEF (0x00000000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_12_OFF (12)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_12_WID ( 1)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_12_MSK (0x00001000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_12_MAX (0x00000001)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_12_DEF (0x00000000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_13_OFF (13)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_13_WID ( 1)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_13_MSK (0x00002000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_13_MAX (0x00000001)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_13_DEF (0x00000000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_14_OFF (14)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_14_WID ( 1)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_14_MSK (0x00004000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_14_MAX (0x00000001)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_14_DEF (0x00000000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_15_OFF (15)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_15_WID ( 1)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_15_MSK (0x00008000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_15_MAX (0x00000001)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_15_DEF (0x00000000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_PROCHOT_LOG_OFF (16)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_PROCHOT_LOG_WID ( 1)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_PROCHOT_LOG_MSK (0x00010000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_PROCHOT_LOG_MAX (0x00000001)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_PROCHOT_LOG_DEF (0x00000000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_THERMAL_LOG_OFF (17)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_THERMAL_LOG_WID ( 1)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_THERMAL_LOG_MSK (0x00020000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_THERMAL_LOG_MAX (0x00000001)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_THERMAL_LOG_DEF (0x00000000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_2_OFF (18)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_2_WID ( 1)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_2_MSK (0x00040000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_2_MAX (0x00000001)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_2_DEF (0x00000000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_PBM_PL1_LOG_OFF (19)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_PBM_PL1_LOG_WID ( 1)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_PBM_PL1_LOG_MSK (0x00080000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_PBM_PL1_LOG_MAX (0x00000001)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_PBM_PL1_LOG_DEF (0x00000000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_PBM_PL2_LOG_OFF (20)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_PBM_PL2_LOG_WID ( 1)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_PBM_PL2_LOG_MSK (0x00100000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_PBM_PL2_LOG_MAX (0x00000001)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_PBM_PL2_LOG_DEF (0x00000000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_5_OFF (21)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_5_WID ( 1)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_5_MSK (0x00200000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_5_MAX (0x00000001)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_5_DEF (0x00000000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_6_OFF (22)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_6_WID ( 1)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_6_MSK (0x00400000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_6_MAX (0x00000001)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_6_DEF (0x00000000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_7_OFF (23)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_7_WID ( 1)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_7_MSK (0x00800000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_7_MAX (0x00000001)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_7_DEF (0x00000000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_VR_THERMALERT_LOG_OFF (24)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_VR_THERMALERT_LOG_WID ( 1)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_VR_THERMALERT_LOG_MSK (0x01000000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_VR_THERMALERT_LOG_MAX (0x00000001)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_VR_THERMALERT_LOG_DEF (0x00000000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_9_OFF (25)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_9_WID ( 1)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_9_MSK (0x02000000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_9_MAX (0x00000001)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_9_DEF (0x00000000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_EDP_ICC_LOG_OFF (26)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_EDP_ICC_LOG_WID ( 1)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_EDP_ICC_LOG_MSK (0x04000000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_EDP_ICC_LOG_MAX (0x00000001)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_EDP_ICC_LOG_DEF (0x00000000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_11_OFF (27)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_11_WID ( 1)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_11_MSK (0x08000000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_11_MAX (0x00000001)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_11_DEF (0x00000000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_12_OFF (28)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_12_WID ( 1)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_12_MSK (0x10000000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_12_MAX (0x00000001)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_12_DEF (0x00000000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_13_OFF (29)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_13_WID ( 1)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_13_MSK (0x20000000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_13_MAX (0x00000001)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_13_DEF (0x00000000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_14_OFF (30)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_14_WID ( 1)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_14_MSK (0x40000000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_14_MAX (0x00000001)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_14_DEF (0x00000000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_15_OFF (31)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_15_WID ( 1)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_15_MSK (0x80000000)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_15_MAX (0x00000001)
+ #define PCU_CR_CLR_PERF_LIMIT_REASONS_PCU_SPARE_CLR_LOG_15_DEF (0x00000000)
+
+#define PCU_CR_PRIP_TURBO_PLCY_PCU_REG (0x00005920)
+ #define PCU_CR_PRIP_TURBO_PLCY_PCU_PRIPTP_OFF ( 0)
+ #define PCU_CR_PRIP_TURBO_PLCY_PCU_PRIPTP_WID ( 5)
+ #define PCU_CR_PRIP_TURBO_PLCY_PCU_PRIPTP_MSK (0x0000001F)
+ #define PCU_CR_PRIP_TURBO_PLCY_PCU_PRIPTP_MAX (0x0000001F)
+ #define PCU_CR_PRIP_TURBO_PLCY_PCU_PRIPTP_DEF (0x00000000)
+
+#define PCU_CR_SECP_TURBO_PLCY_PCU_REG (0x00005924)
+ #define PCU_CR_SECP_TURBO_PLCY_PCU_SECPTP_OFF ( 0)
+ #define PCU_CR_SECP_TURBO_PLCY_PCU_SECPTP_WID ( 5)
+ #define PCU_CR_SECP_TURBO_PLCY_PCU_SECPTP_MSK (0x0000001F)
+ #define PCU_CR_SECP_TURBO_PLCY_PCU_SECPTP_MAX (0x0000001F)
+ #define PCU_CR_SECP_TURBO_PLCY_PCU_SECPTP_DEF (0x00000010)
+
+#define PCU_CR_PRIP_NRG_STTS_PCU_REG (0x00005928)
+ #define PCU_CR_PRIP_NRG_STTS_PCU_DATA_OFF ( 0)
+ #define PCU_CR_PRIP_NRG_STTS_PCU_DATA_WID (32)
+ #define PCU_CR_PRIP_NRG_STTS_PCU_DATA_MSK (0xFFFFFFFF)
+ #define PCU_CR_PRIP_NRG_STTS_PCU_DATA_MAX (0xFFFFFFFF)
+ #define PCU_CR_PRIP_NRG_STTS_PCU_DATA_DEF (0x00000000)
+
+#define PCU_CR_SECP_NRG_STTS_PCU_REG (0x0000592C)
+ #define PCU_CR_SECP_NRG_STTS_PCU_DATA_OFF ( 0)
+ #define PCU_CR_SECP_NRG_STTS_PCU_DATA_WID (32)
+ #define PCU_CR_SECP_NRG_STTS_PCU_DATA_MSK (0xFFFFFFFF)
+ #define PCU_CR_SECP_NRG_STTS_PCU_DATA_MAX (0xFFFFFFFF)
+ #define PCU_CR_SECP_NRG_STTS_PCU_DATA_DEF (0x00000000)
+
+#define PCU_CR_PACKAGE_POWER_SKU_PCU_REG (0x00005930)
+ #define PCU_CR_PACKAGE_POWER_SKU_PCU_PKG_TDP_OFF ( 0)
+ #define PCU_CR_PACKAGE_POWER_SKU_PCU_PKG_TDP_WID (15)
+ #define PCU_CR_PACKAGE_POWER_SKU_PCU_PKG_TDP_MSK (0x00007FFF)
+ #define PCU_CR_PACKAGE_POWER_SKU_PCU_PKG_TDP_MAX (0x00007FFF)
+ #define PCU_CR_PACKAGE_POWER_SKU_PCU_PKG_TDP_DEF (0x00000118)
+ #define PCU_CR_PACKAGE_POWER_SKU_PCU_PKG_MIN_PWR_OFF (16)
+ #define PCU_CR_PACKAGE_POWER_SKU_PCU_PKG_MIN_PWR_WID (15)
+ #define PCU_CR_PACKAGE_POWER_SKU_PCU_PKG_MIN_PWR_MSK (0x7FFF0000)
+ #define PCU_CR_PACKAGE_POWER_SKU_PCU_PKG_MIN_PWR_MAX (0x00007FFF)
+ #define PCU_CR_PACKAGE_POWER_SKU_PCU_PKG_MIN_PWR_DEF (0x00000060)
+ #define PCU_CR_PACKAGE_POWER_SKU_PCU_PKG_MAX_PWR_OFF (32)
+ #define PCU_CR_PACKAGE_POWER_SKU_PCU_PKG_MAX_PWR_WID (15)
+ #define PCU_CR_PACKAGE_POWER_SKU_PCU_PKG_MAX_PWR_MSK (0x7FFF00000000)
+ #define PCU_CR_PACKAGE_POWER_SKU_PCU_PKG_MAX_PWR_MAX (0x00007FFF)
+ #define PCU_CR_PACKAGE_POWER_SKU_PCU_PKG_MAX_PWR_DEF (0x00000240)
+ #define PCU_CR_PACKAGE_POWER_SKU_PCU_PKG_MAX_WIN_OFF (48)
+ #define PCU_CR_PACKAGE_POWER_SKU_PCU_PKG_MAX_WIN_WID ( 7)
+ #define PCU_CR_PACKAGE_POWER_SKU_PCU_PKG_MAX_WIN_MSK (0x7F000000000000)
+ #define PCU_CR_PACKAGE_POWER_SKU_PCU_PKG_MAX_WIN_MAX (0x0000007F)
+ #define PCU_CR_PACKAGE_POWER_SKU_PCU_PKG_MAX_WIN_DEF (0x00000012)
+
+#define PCU_CR_PACKAGE_POWER_SKU_UNIT_PCU_REG (0x00005938)
+ #define PCU_CR_PACKAGE_POWER_SKU_UNIT_PCU_PWR_UNIT_OFF ( 0)
+ #define PCU_CR_PACKAGE_POWER_SKU_UNIT_PCU_PWR_UNIT_WID ( 4)
+ #define PCU_CR_PACKAGE_POWER_SKU_UNIT_PCU_PWR_UNIT_MSK (0x0000000F)
+ #define PCU_CR_PACKAGE_POWER_SKU_UNIT_PCU_PWR_UNIT_MAX (0x0000000F)
+ #define PCU_CR_PACKAGE_POWER_SKU_UNIT_PCU_PWR_UNIT_DEF (0x00000003)
+ #define PCU_CR_PACKAGE_POWER_SKU_UNIT_PCU_ENERGY_UNIT_OFF ( 8)
+ #define PCU_CR_PACKAGE_POWER_SKU_UNIT_PCU_ENERGY_UNIT_WID ( 5)
+ #define PCU_CR_PACKAGE_POWER_SKU_UNIT_PCU_ENERGY_UNIT_MSK (0x00001F00)
+ #define PCU_CR_PACKAGE_POWER_SKU_UNIT_PCU_ENERGY_UNIT_MAX (0x0000001F)
+ #define PCU_CR_PACKAGE_POWER_SKU_UNIT_PCU_ENERGY_UNIT_DEF (0x0000000E)
+ #define PCU_CR_PACKAGE_POWER_SKU_UNIT_PCU_TIME_UNIT_OFF (16)
+ #define PCU_CR_PACKAGE_POWER_SKU_UNIT_PCU_TIME_UNIT_WID ( 4)
+ #define PCU_CR_PACKAGE_POWER_SKU_UNIT_PCU_TIME_UNIT_MSK (0x000F0000)
+ #define PCU_CR_PACKAGE_POWER_SKU_UNIT_PCU_TIME_UNIT_MAX (0x0000000F)
+ #define PCU_CR_PACKAGE_POWER_SKU_UNIT_PCU_TIME_UNIT_DEF (0x0000000A)
+
+#define PCU_CR_PACKAGE_ENERGY_STATUS_PCU_REG (0x0000593C)
+ #define PCU_CR_PACKAGE_ENERGY_STATUS_PCU_DATA_OFF ( 0)
+ #define PCU_CR_PACKAGE_ENERGY_STATUS_PCU_DATA_WID (32)
+ #define PCU_CR_PACKAGE_ENERGY_STATUS_PCU_DATA_MSK (0xFFFFFFFF)
+ #define PCU_CR_PACKAGE_ENERGY_STATUS_PCU_DATA_MAX (0xFFFFFFFF)
+ #define PCU_CR_PACKAGE_ENERGY_STATUS_PCU_DATA_DEF (0x00000000)
+
+#define PCU_CR_GT_IO_BUSYNESS_PCU_REG (0x00005940)
+ #define PCU_CR_GT_IO_BUSYNESS_PCU_DATA_OFF ( 0)
+ #define PCU_CR_GT_IO_BUSYNESS_PCU_DATA_WID (32)
+ #define PCU_CR_GT_IO_BUSYNESS_PCU_DATA_MSK (0xFFFFFFFF)
+ #define PCU_CR_GT_IO_BUSYNESS_PCU_DATA_MAX (0xFFFFFFFF)
+ #define PCU_CR_GT_IO_BUSYNESS_PCU_DATA_DEF (0x00000000)
+
+#define PCU_CR_GT_VIDEO_BUSYNESS_PCU_REG (0x00005944)
+ #define PCU_CR_GT_VIDEO_BUSYNESS_PCU_DATA_OFF ( 0)
+ #define PCU_CR_GT_VIDEO_BUSYNESS_PCU_DATA_WID (32)
+ #define PCU_CR_GT_VIDEO_BUSYNESS_PCU_DATA_MSK (0xFFFFFFFF)
+ #define PCU_CR_GT_VIDEO_BUSYNESS_PCU_DATA_MAX (0xFFFFFFFF)
+ #define PCU_CR_GT_VIDEO_BUSYNESS_PCU_DATA_DEF (0x00000000)
+
+#define PCU_CR_GT_PERF_STATUS_PCU_REG (0x00005948)
+ #define PCU_CR_GT_PERF_STATUS_PCU_RP_STATE_VOLTAGE_OFF ( 0)
+ #define PCU_CR_GT_PERF_STATUS_PCU_RP_STATE_VOLTAGE_WID ( 8)
+ #define PCU_CR_GT_PERF_STATUS_PCU_RP_STATE_VOLTAGE_MSK (0x000000FF)
+ #define PCU_CR_GT_PERF_STATUS_PCU_RP_STATE_VOLTAGE_MAX (0x000000FF)
+ #define PCU_CR_GT_PERF_STATUS_PCU_RP_STATE_VOLTAGE_DEF (0x00000000)
+ #define PCU_CR_GT_PERF_STATUS_PCU_RP_STATE_RATIO_OFF ( 8)
+ #define PCU_CR_GT_PERF_STATUS_PCU_RP_STATE_RATIO_WID ( 8)
+ #define PCU_CR_GT_PERF_STATUS_PCU_RP_STATE_RATIO_MSK (0x0000FF00)
+ #define PCU_CR_GT_PERF_STATUS_PCU_RP_STATE_RATIO_MAX (0x000000FF)
+ #define PCU_CR_GT_PERF_STATUS_PCU_RP_STATE_RATIO_DEF (0x00000000)
+
+#define PCU_CR_PLATFORM_ID_PCU_REG (0x00005950)
+ #define PCU_CR_PLATFORM_ID_PCU_PLATFORMID_OFF (50)
+ #define PCU_CR_PLATFORM_ID_PCU_PLATFORMID_WID ( 3)
+ #define PCU_CR_PLATFORM_ID_PCU_PLATFORMID_MSK (0x1C000000000000)
+ #define PCU_CR_PLATFORM_ID_PCU_PLATFORMID_MAX (0x00000007)
+ #define PCU_CR_PLATFORM_ID_PCU_PLATFORMID_DEF (0x00000000)
+
+#define PCU_CR_PLATFORM_INFO_PCU_REG (0x00005958)
+ #define PCU_CR_PLATFORM_INFO_PCU_MAX_NON_TURBO_LIM_RATIO_OFF ( 8)
+ #define PCU_CR_PLATFORM_INFO_PCU_MAX_NON_TURBO_LIM_RATIO_WID ( 8)
+ #define PCU_CR_PLATFORM_INFO_PCU_MAX_NON_TURBO_LIM_RATIO_MSK (0x0000FF00)
+ #define PCU_CR_PLATFORM_INFO_PCU_MAX_NON_TURBO_LIM_RATIO_MAX (0x000000FF)
+ #define PCU_CR_PLATFORM_INFO_PCU_MAX_NON_TURBO_LIM_RATIO_DEF (0x00000000)
+ #define PCU_CR_PLATFORM_INFO_PCU_SMM_SAVE_CAP_OFF (16)
+ #define PCU_CR_PLATFORM_INFO_PCU_SMM_SAVE_CAP_WID ( 1)
+ #define PCU_CR_PLATFORM_INFO_PCU_SMM_SAVE_CAP_MSK (0x00010000)
+ #define PCU_CR_PLATFORM_INFO_PCU_SMM_SAVE_CAP_MAX (0x00000001)
+ #define PCU_CR_PLATFORM_INFO_PCU_SMM_SAVE_CAP_DEF (0x00000001)
+ #define PCU_CR_PLATFORM_INFO_PCU_OCVOLT_OVRD_AVAIL_OFF (24)
+ #define PCU_CR_PLATFORM_INFO_PCU_OCVOLT_OVRD_AVAIL_WID ( 1)
+ #define PCU_CR_PLATFORM_INFO_PCU_OCVOLT_OVRD_AVAIL_MSK (0x01000000)
+ #define PCU_CR_PLATFORM_INFO_PCU_OCVOLT_OVRD_AVAIL_MAX (0x00000001)
+ #define PCU_CR_PLATFORM_INFO_PCU_OCVOLT_OVRD_AVAIL_DEF (0x00000000)
+ #define PCU_CR_PLATFORM_INFO_PCU_FIVR_RFI_TUNING_AVAIL_OFF (25)
+ #define PCU_CR_PLATFORM_INFO_PCU_FIVR_RFI_TUNING_AVAIL_WID ( 1)
+ #define PCU_CR_PLATFORM_INFO_PCU_FIVR_RFI_TUNING_AVAIL_MSK (0x02000000)
+ #define PCU_CR_PLATFORM_INFO_PCU_FIVR_RFI_TUNING_AVAIL_MAX (0x00000001)
+ #define PCU_CR_PLATFORM_INFO_PCU_FIVR_RFI_TUNING_AVAIL_DEF (0x00000000)
+ #define PCU_CR_PLATFORM_INFO_PCU_DCU_16K_MODE_AVAIL_OFF (26)
+ #define PCU_CR_PLATFORM_INFO_PCU_DCU_16K_MODE_AVAIL_WID ( 1)
+ #define PCU_CR_PLATFORM_INFO_PCU_DCU_16K_MODE_AVAIL_MSK (0x04000000)
+ #define PCU_CR_PLATFORM_INFO_PCU_DCU_16K_MODE_AVAIL_MAX (0x00000001)
+ #define PCU_CR_PLATFORM_INFO_PCU_DCU_16K_MODE_AVAIL_DEF (0x00000000)
+ #define PCU_CR_PLATFORM_INFO_PCU_SAMPLE_PART_OFF (27)
+ #define PCU_CR_PLATFORM_INFO_PCU_SAMPLE_PART_WID ( 1)
+ #define PCU_CR_PLATFORM_INFO_PCU_SAMPLE_PART_MSK (0x08000000)
+ #define PCU_CR_PLATFORM_INFO_PCU_SAMPLE_PART_MAX (0x00000001)
+ #define PCU_CR_PLATFORM_INFO_PCU_SAMPLE_PART_DEF (0x00000000)
+ #define PCU_CR_PLATFORM_INFO_PCU_PRG_TURBO_RATIO_EN_OFF (28)
+ #define PCU_CR_PLATFORM_INFO_PCU_PRG_TURBO_RATIO_EN_WID ( 1)
+ #define PCU_CR_PLATFORM_INFO_PCU_PRG_TURBO_RATIO_EN_MSK (0x10000000)
+ #define PCU_CR_PLATFORM_INFO_PCU_PRG_TURBO_RATIO_EN_MAX (0x00000001)
+ #define PCU_CR_PLATFORM_INFO_PCU_PRG_TURBO_RATIO_EN_DEF (0x00000001)
+ #define PCU_CR_PLATFORM_INFO_PCU_PRG_TDP_LIM_EN_OFF (29)
+ #define PCU_CR_PLATFORM_INFO_PCU_PRG_TDP_LIM_EN_WID ( 1)
+ #define PCU_CR_PLATFORM_INFO_PCU_PRG_TDP_LIM_EN_MSK (0x20000000)
+ #define PCU_CR_PLATFORM_INFO_PCU_PRG_TDP_LIM_EN_MAX (0x00000001)
+ #define PCU_CR_PLATFORM_INFO_PCU_PRG_TDP_LIM_EN_DEF (0x00000001)
+ #define PCU_CR_PLATFORM_INFO_PCU_PRG_TJ_OFFSET_EN_OFF (30)
+ #define PCU_CR_PLATFORM_INFO_PCU_PRG_TJ_OFFSET_EN_WID ( 1)
+ #define PCU_CR_PLATFORM_INFO_PCU_PRG_TJ_OFFSET_EN_MSK (0x40000000)
+ #define PCU_CR_PLATFORM_INFO_PCU_PRG_TJ_OFFSET_EN_MAX (0x00000001)
+ #define PCU_CR_PLATFORM_INFO_PCU_PRG_TJ_OFFSET_EN_DEF (0x00000001)
+ #define PCU_CR_PLATFORM_INFO_PCU_CPUID_FAULTING_EN_OFF (31)
+ #define PCU_CR_PLATFORM_INFO_PCU_CPUID_FAULTING_EN_WID ( 1)
+ #define PCU_CR_PLATFORM_INFO_PCU_CPUID_FAULTING_EN_MSK (0x80000000)
+ #define PCU_CR_PLATFORM_INFO_PCU_CPUID_FAULTING_EN_MAX (0x00000001)
+ #define PCU_CR_PLATFORM_INFO_PCU_CPUID_FAULTING_EN_DEF (0x00000001)
+ #define PCU_CR_PLATFORM_INFO_PCU_LPM_SUPPORT_OFF (32)
+ #define PCU_CR_PLATFORM_INFO_PCU_LPM_SUPPORT_WID ( 1)
+ #define PCU_CR_PLATFORM_INFO_PCU_LPM_SUPPORT_MSK (0x100000000)
+ #define PCU_CR_PLATFORM_INFO_PCU_LPM_SUPPORT_MAX (0x00000001)
+ #define PCU_CR_PLATFORM_INFO_PCU_LPM_SUPPORT_DEF (0x00000000)
+ #define PCU_CR_PLATFORM_INFO_PCU_CONFIG_TDP_LEVELS_OFF (33)
+ #define PCU_CR_PLATFORM_INFO_PCU_CONFIG_TDP_LEVELS_WID ( 2)
+ #define PCU_CR_PLATFORM_INFO_PCU_CONFIG_TDP_LEVELS_MSK (0x600000000)
+ #define PCU_CR_PLATFORM_INFO_PCU_CONFIG_TDP_LEVELS_MAX (0x00000003)
+ #define PCU_CR_PLATFORM_INFO_PCU_CONFIG_TDP_LEVELS_DEF (0x00000000)
+ #define PCU_CR_PLATFORM_INFO_PCU_PFAT_ENABLE_OFF (35)
+ #define PCU_CR_PLATFORM_INFO_PCU_PFAT_ENABLE_WID ( 1)
+ #define PCU_CR_PLATFORM_INFO_PCU_PFAT_ENABLE_MSK (0x800000000)
+ #define PCU_CR_PLATFORM_INFO_PCU_PFAT_ENABLE_MAX (0x00000001)
+ #define PCU_CR_PLATFORM_INFO_PCU_PFAT_ENABLE_DEF (0x00000000)
+ #define PCU_CR_PLATFORM_INFO_PCU_TIMED_MWAIT_ENABLE_OFF (37)
+ #define PCU_CR_PLATFORM_INFO_PCU_TIMED_MWAIT_ENABLE_WID ( 1)
+ #define PCU_CR_PLATFORM_INFO_PCU_TIMED_MWAIT_ENABLE_MSK (0x2000000000)
+ #define PCU_CR_PLATFORM_INFO_PCU_TIMED_MWAIT_ENABLE_MAX (0x00000001)
+ #define PCU_CR_PLATFORM_INFO_PCU_TIMED_MWAIT_ENABLE_DEF (0x00000000)
+ #define PCU_CR_PLATFORM_INFO_PCU_MAX_EFFICIENCY_RATIO_OFF (40)
+ #define PCU_CR_PLATFORM_INFO_PCU_MAX_EFFICIENCY_RATIO_WID ( 8)
+ #define PCU_CR_PLATFORM_INFO_PCU_MAX_EFFICIENCY_RATIO_MSK (0xFF0000000000)
+ #define PCU_CR_PLATFORM_INFO_PCU_MAX_EFFICIENCY_RATIO_MAX (0x000000FF)
+ #define PCU_CR_PLATFORM_INFO_PCU_MAX_EFFICIENCY_RATIO_DEF (0x00000000)
+ #define PCU_CR_PLATFORM_INFO_PCU_MIN_OPERATING_RATIO_OFF (48)
+ #define PCU_CR_PLATFORM_INFO_PCU_MIN_OPERATING_RATIO_WID ( 8)
+ #define PCU_CR_PLATFORM_INFO_PCU_MIN_OPERATING_RATIO_MSK (0xFF000000000000)
+ #define PCU_CR_PLATFORM_INFO_PCU_MIN_OPERATING_RATIO_MAX (0x000000FF)
+ #define PCU_CR_PLATFORM_INFO_PCU_MIN_OPERATING_RATIO_DEF (0x00000008)
+
+#define PCU_CR_PP1_C0_CORE_CLOCK_PCU_REG (0x00005960)
+ #define PCU_CR_PP1_C0_CORE_CLOCK_PCU_DATA_OFF ( 0)
+ #define PCU_CR_PP1_C0_CORE_CLOCK_PCU_DATA_WID (32)
+ #define PCU_CR_PP1_C0_CORE_CLOCK_PCU_DATA_MSK (0xFFFFFFFF)
+ #define PCU_CR_PP1_C0_CORE_CLOCK_PCU_DATA_MAX (0xFFFFFFFF)
+ #define PCU_CR_PP1_C0_CORE_CLOCK_PCU_DATA_DEF (0x00000000)
+
+#define PCU_CR_PP0_ANY_THREAD_ACTIVITY_PCU_REG (0x00005964)
+ #define PCU_CR_PP0_ANY_THREAD_ACTIVITY_PCU_DATA_OFF ( 0)
+ #define PCU_CR_PP0_ANY_THREAD_ACTIVITY_PCU_DATA_WID (32)
+ #define PCU_CR_PP0_ANY_THREAD_ACTIVITY_PCU_DATA_MSK (0xFFFFFFFF)
+ #define PCU_CR_PP0_ANY_THREAD_ACTIVITY_PCU_DATA_MAX (0xFFFFFFFF)
+ #define PCU_CR_PP0_ANY_THREAD_ACTIVITY_PCU_DATA_DEF (0x00000000)
+
+#define PCU_CR_PP0_EFFICIENT_CYCLES_PCU_REG (0x00005968)
+ #define PCU_CR_PP0_EFFICIENT_CYCLES_PCU_DATA_OFF ( 0)
+ #define PCU_CR_PP0_EFFICIENT_CYCLES_PCU_DATA_WID (32)
+ #define PCU_CR_PP0_EFFICIENT_CYCLES_PCU_DATA_MSK (0xFFFFFFFF)
+ #define PCU_CR_PP0_EFFICIENT_CYCLES_PCU_DATA_MAX (0xFFFFFFFF)
+ #define PCU_CR_PP0_EFFICIENT_CYCLES_PCU_DATA_DEF (0x00000000)
+
+#define PCU_CR_PP0_THREAD_ACTIVITY_PCU_REG (0x0000596C)
+ #define PCU_CR_PP0_THREAD_ACTIVITY_PCU_DATA_OFF ( 0)
+ #define PCU_CR_PP0_THREAD_ACTIVITY_PCU_DATA_WID (32)
+ #define PCU_CR_PP0_THREAD_ACTIVITY_PCU_DATA_MSK (0xFFFFFFFF)
+ #define PCU_CR_PP0_THREAD_ACTIVITY_PCU_DATA_MAX (0xFFFFFFFF)
+ #define PCU_CR_PP0_THREAD_ACTIVITY_PCU_DATA_DEF (0x00000000)
+
+#define PCU_CR_PP1_ANY_THREAD_ACTIVITY_PCU_REG (0x00005970)
+ #define PCU_CR_PP1_ANY_THREAD_ACTIVITY_PCU_DATA_OFF ( 0)
+ #define PCU_CR_PP1_ANY_THREAD_ACTIVITY_PCU_DATA_WID (32)
+ #define PCU_CR_PP1_ANY_THREAD_ACTIVITY_PCU_DATA_MSK (0xFFFFFFFF)
+ #define PCU_CR_PP1_ANY_THREAD_ACTIVITY_PCU_DATA_MAX (0xFFFFFFFF)
+ #define PCU_CR_PP1_ANY_THREAD_ACTIVITY_PCU_DATA_DEF (0x00000000)
+
+#define PCU_CR_PP1_EFFICIENT_CYCLES_PCU_REG (0x00005974)
+ #define PCU_CR_PP1_EFFICIENT_CYCLES_PCU_DATA_OFF ( 0)
+ #define PCU_CR_PP1_EFFICIENT_CYCLES_PCU_DATA_WID (32)
+ #define PCU_CR_PP1_EFFICIENT_CYCLES_PCU_DATA_MSK (0xFFFFFFFF)
+ #define PCU_CR_PP1_EFFICIENT_CYCLES_PCU_DATA_MAX (0xFFFFFFFF)
+ #define PCU_CR_PP1_EFFICIENT_CYCLES_PCU_DATA_DEF (0x00000000)
+
+#define PCU_CR_PACKAGE_TEMPERATURE_PCU_REG (0x00005978)
+ #define PCU_CR_PACKAGE_TEMPERATURE_PCU_DATA_OFF ( 0)
+ #define PCU_CR_PACKAGE_TEMPERATURE_PCU_DATA_WID ( 8)
+ #define PCU_CR_PACKAGE_TEMPERATURE_PCU_DATA_MSK (0x000000FF)
+ #define PCU_CR_PACKAGE_TEMPERATURE_PCU_DATA_MAX (0x000000FF)
+ #define PCU_CR_PACKAGE_TEMPERATURE_PCU_DATA_DEF (0x00000000)
+
+#define PCU_CR_PP0_TEMPERATURE_PCU_REG (0x0000597C)
+ #define PCU_CR_PP0_TEMPERATURE_PCU_DATA_OFF ( 0)
+ #define PCU_CR_PP0_TEMPERATURE_PCU_DATA_WID ( 8)
+ #define PCU_CR_PP0_TEMPERATURE_PCU_DATA_MSK (0x000000FF)
+ #define PCU_CR_PP0_TEMPERATURE_PCU_DATA_MAX (0x000000FF)
+ #define PCU_CR_PP0_TEMPERATURE_PCU_DATA_DEF (0x00000000)
+
+#define PCU_CR_PP1_TEMPERATURE_PCU_REG (0x00005980)
+ #define PCU_CR_PP1_TEMPERATURE_PCU_DATA_OFF ( 0)
+ #define PCU_CR_PP1_TEMPERATURE_PCU_DATA_WID ( 8)
+ #define PCU_CR_PP1_TEMPERATURE_PCU_DATA_MSK (0x000000FF)
+ #define PCU_CR_PP1_TEMPERATURE_PCU_DATA_MAX (0x000000FF)
+ #define PCU_CR_PP1_TEMPERATURE_PCU_DATA_DEF (0x00000000)
+
+#define PCU_CR_PCU_REFERENCE_CLOCK_PCU_REG (0x00005984)
+ #define PCU_CR_PCU_REFERENCE_CLOCK_PCU_TIME_VAL_OFF ( 0)
+ #define PCU_CR_PCU_REFERENCE_CLOCK_PCU_TIME_VAL_WID (32)
+ #define PCU_CR_PCU_REFERENCE_CLOCK_PCU_TIME_VAL_MSK (0xFFFFFFFF)
+ #define PCU_CR_PCU_REFERENCE_CLOCK_PCU_TIME_VAL_MAX (0xFFFFFFFF)
+ #define PCU_CR_PCU_REFERENCE_CLOCK_PCU_TIME_VAL_DEF (0x00000000)
+
+#define PCU_CR_DEVICE_SHARED_IDLE_DURATION_PCU_REG (0x00005988)
+ #define PCU_CR_DEVICE_SHARED_IDLE_DURATION_PCU_RESERVED_OFF ( 0)
+ #define PCU_CR_DEVICE_SHARED_IDLE_DURATION_PCU_RESERVED_WID ( 1)
+ #define PCU_CR_DEVICE_SHARED_IDLE_DURATION_PCU_RESERVED_MSK (0x00000001)
+ #define PCU_CR_DEVICE_SHARED_IDLE_DURATION_PCU_RESERVED_MAX (0x00000001)
+ #define PCU_CR_DEVICE_SHARED_IDLE_DURATION_PCU_RESERVED_DEF (0x00000000)
+ #define PCU_CR_DEVICE_SHARED_IDLE_DURATION_PCU_VALID_OFF ( 1)
+ #define PCU_CR_DEVICE_SHARED_IDLE_DURATION_PCU_VALID_WID ( 1)
+ #define PCU_CR_DEVICE_SHARED_IDLE_DURATION_PCU_VALID_MSK (0x00000002)
+ #define PCU_CR_DEVICE_SHARED_IDLE_DURATION_PCU_VALID_MAX (0x00000001)
+ #define PCU_CR_DEVICE_SHARED_IDLE_DURATION_PCU_VALID_DEF (0x00000000)
+ #define PCU_CR_DEVICE_SHARED_IDLE_DURATION_PCU_RESERVED_BITS_OFF ( 2)
+ #define PCU_CR_DEVICE_SHARED_IDLE_DURATION_PCU_RESERVED_BITS_WID ( 4)
+ #define PCU_CR_DEVICE_SHARED_IDLE_DURATION_PCU_RESERVED_BITS_MSK (0x0000003C)
+ #define PCU_CR_DEVICE_SHARED_IDLE_DURATION_PCU_RESERVED_BITS_MAX (0x0000000F)
+ #define PCU_CR_DEVICE_SHARED_IDLE_DURATION_PCU_RESERVED_BITS_DEF (0x00000000)
+ #define PCU_CR_DEVICE_SHARED_IDLE_DURATION_PCU_OD_OFF ( 6)
+ #define PCU_CR_DEVICE_SHARED_IDLE_DURATION_PCU_OD_WID ( 1)
+ #define PCU_CR_DEVICE_SHARED_IDLE_DURATION_PCU_OD_MSK (0x00000040)
+ #define PCU_CR_DEVICE_SHARED_IDLE_DURATION_PCU_OD_MAX (0x00000001)
+ #define PCU_CR_DEVICE_SHARED_IDLE_DURATION_PCU_OD_DEF (0x00000000)
+ #define PCU_CR_DEVICE_SHARED_IDLE_DURATION_PCU_IM_OFF ( 7)
+ #define PCU_CR_DEVICE_SHARED_IDLE_DURATION_PCU_IM_WID ( 1)
+ #define PCU_CR_DEVICE_SHARED_IDLE_DURATION_PCU_IM_MSK (0x00000080)
+ #define PCU_CR_DEVICE_SHARED_IDLE_DURATION_PCU_IM_MAX (0x00000001)
+ #define PCU_CR_DEVICE_SHARED_IDLE_DURATION_PCU_IM_DEF (0x00000000)
+ #define PCU_CR_DEVICE_SHARED_IDLE_DURATION_PCU_NEXT_DEVICE_ACTIVITY_OFF ( 8)
+ #define PCU_CR_DEVICE_SHARED_IDLE_DURATION_PCU_NEXT_DEVICE_ACTIVITY_WID (21)
+ #define PCU_CR_DEVICE_SHARED_IDLE_DURATION_PCU_NEXT_DEVICE_ACTIVITY_MSK (0x1FFFFF00)
+ #define PCU_CR_DEVICE_SHARED_IDLE_DURATION_PCU_NEXT_DEVICE_ACTIVITY_MAX (0x001FFFFF)
+ #define PCU_CR_DEVICE_SHARED_IDLE_DURATION_PCU_NEXT_DEVICE_ACTIVITY_DEF (0x00000000)
+
+#define PCU_CR_DEVICE_DEDICATED_IDLE_DURATION_PCU_REG (0x0000598C)
+ #define PCU_CR_DEVICE_DEDICATED_IDLE_DURATION_PCU_USED_OFF ( 0)
+ #define PCU_CR_DEVICE_DEDICATED_IDLE_DURATION_PCU_USED_WID ( 1)
+ #define PCU_CR_DEVICE_DEDICATED_IDLE_DURATION_PCU_USED_MSK (0x00000001)
+ #define PCU_CR_DEVICE_DEDICATED_IDLE_DURATION_PCU_USED_MAX (0x00000001)
+ #define PCU_CR_DEVICE_DEDICATED_IDLE_DURATION_PCU_USED_DEF (0x00000000)
+ #define PCU_CR_DEVICE_DEDICATED_IDLE_DURATION_PCU_VALID_OFF ( 1)
+ #define PCU_CR_DEVICE_DEDICATED_IDLE_DURATION_PCU_VALID_WID ( 1)
+ #define PCU_CR_DEVICE_DEDICATED_IDLE_DURATION_PCU_VALID_MSK (0x00000002)
+ #define PCU_CR_DEVICE_DEDICATED_IDLE_DURATION_PCU_VALID_MAX (0x00000001)
+ #define PCU_CR_DEVICE_DEDICATED_IDLE_DURATION_PCU_VALID_DEF (0x00000000)
+ #define PCU_CR_DEVICE_DEDICATED_IDLE_DURATION_PCU_RESERVED_BITS_OFF ( 2)
+ #define PCU_CR_DEVICE_DEDICATED_IDLE_DURATION_PCU_RESERVED_BITS_WID ( 4)
+ #define PCU_CR_DEVICE_DEDICATED_IDLE_DURATION_PCU_RESERVED_BITS_MSK (0x0000003C)
+ #define PCU_CR_DEVICE_DEDICATED_IDLE_DURATION_PCU_RESERVED_BITS_MAX (0x0000000F)
+ #define PCU_CR_DEVICE_DEDICATED_IDLE_DURATION_PCU_RESERVED_BITS_DEF (0x00000000)
+ #define PCU_CR_DEVICE_DEDICATED_IDLE_DURATION_PCU_OD_OFF ( 6)
+ #define PCU_CR_DEVICE_DEDICATED_IDLE_DURATION_PCU_OD_WID ( 1)
+ #define PCU_CR_DEVICE_DEDICATED_IDLE_DURATION_PCU_OD_MSK (0x00000040)
+ #define PCU_CR_DEVICE_DEDICATED_IDLE_DURATION_PCU_OD_MAX (0x00000001)
+ #define PCU_CR_DEVICE_DEDICATED_IDLE_DURATION_PCU_OD_DEF (0x00000000)
+ #define PCU_CR_DEVICE_DEDICATED_IDLE_DURATION_PCU_IM_OFF ( 7)
+ #define PCU_CR_DEVICE_DEDICATED_IDLE_DURATION_PCU_IM_WID ( 1)
+ #define PCU_CR_DEVICE_DEDICATED_IDLE_DURATION_PCU_IM_MSK (0x00000080)
+ #define PCU_CR_DEVICE_DEDICATED_IDLE_DURATION_PCU_IM_MAX (0x00000001)
+ #define PCU_CR_DEVICE_DEDICATED_IDLE_DURATION_PCU_IM_DEF (0x00000000)
+ #define PCU_CR_DEVICE_DEDICATED_IDLE_DURATION_PCU_NEXT_DEVICE_ACTIVITY_OFF ( 8)
+ #define PCU_CR_DEVICE_DEDICATED_IDLE_DURATION_PCU_NEXT_DEVICE_ACTIVITY_WID (21)
+ #define PCU_CR_DEVICE_DEDICATED_IDLE_DURATION_PCU_NEXT_DEVICE_ACTIVITY_MSK (0x1FFFFF00)
+ #define PCU_CR_DEVICE_DEDICATED_IDLE_DURATION_PCU_NEXT_DEVICE_ACTIVITY_MAX (0x001FFFFF)
+ #define PCU_CR_DEVICE_DEDICATED_IDLE_DURATION_PCU_NEXT_DEVICE_ACTIVITY_DEF (0x00000000)
+
+#define PCU_CR_P_STATE_LIMITS_PCU_REG (0x00005990)
+ #define PCU_CR_P_STATE_LIMITS_PCU_PSTT_LIM_OFF ( 0)
+ #define PCU_CR_P_STATE_LIMITS_PCU_PSTT_LIM_WID ( 8)
+ #define PCU_CR_P_STATE_LIMITS_PCU_PSTT_LIM_MSK (0x000000FF)
+ #define PCU_CR_P_STATE_LIMITS_PCU_PSTT_LIM_MAX (0x000000FF)
+ #define PCU_CR_P_STATE_LIMITS_PCU_PSTT_LIM_DEF (0x000000FF)
+ #define PCU_CR_P_STATE_LIMITS_PCU_PSTT_MIN_OFF ( 8)
+ #define PCU_CR_P_STATE_LIMITS_PCU_PSTT_MIN_WID ( 8)
+ #define PCU_CR_P_STATE_LIMITS_PCU_PSTT_MIN_MSK (0x0000FF00)
+ #define PCU_CR_P_STATE_LIMITS_PCU_PSTT_MIN_MAX (0x000000FF)
+ #define PCU_CR_P_STATE_LIMITS_PCU_PSTT_MIN_DEF (0x00000000)
+ #define PCU_CR_P_STATE_LIMITS_PCU_LOCK_OFF (31)
+ #define PCU_CR_P_STATE_LIMITS_PCU_LOCK_WID ( 1)
+ #define PCU_CR_P_STATE_LIMITS_PCU_LOCK_MSK (0x80000000)
+ #define PCU_CR_P_STATE_LIMITS_PCU_LOCK_MAX (0x00000001)
+ #define PCU_CR_P_STATE_LIMITS_PCU_LOCK_DEF (0x00000000)
+
+#define PCU_CR_RP_STATE_LIMITS_PCU_REG (0x00005994)
+ #define PCU_CR_RP_STATE_LIMITS_PCU_RPSTT_LIM_OFF ( 0)
+ #define PCU_CR_RP_STATE_LIMITS_PCU_RPSTT_LIM_WID ( 8)
+ #define PCU_CR_RP_STATE_LIMITS_PCU_RPSTT_LIM_MSK (0x000000FF)
+ #define PCU_CR_RP_STATE_LIMITS_PCU_RPSTT_LIM_MAX (0x000000FF)
+ #define PCU_CR_RP_STATE_LIMITS_PCU_RPSTT_LIM_DEF (0x000000FF)
+
+#define PCU_CR_RP_STATE_CAP_PCU_REG (0x00005998)
+ #define PCU_CR_RP_STATE_CAP_PCU_RP0_CAP_OFF ( 0)
+ #define PCU_CR_RP_STATE_CAP_PCU_RP0_CAP_WID ( 8)
+ #define PCU_CR_RP_STATE_CAP_PCU_RP0_CAP_MSK (0x000000FF)
+ #define PCU_CR_RP_STATE_CAP_PCU_RP0_CAP_MAX (0x000000FF)
+ #define PCU_CR_RP_STATE_CAP_PCU_RP0_CAP_DEF (0x00000000)
+ #define PCU_CR_RP_STATE_CAP_PCU_RP1_CAP_OFF ( 8)
+ #define PCU_CR_RP_STATE_CAP_PCU_RP1_CAP_WID ( 8)
+ #define PCU_CR_RP_STATE_CAP_PCU_RP1_CAP_MSK (0x0000FF00)
+ #define PCU_CR_RP_STATE_CAP_PCU_RP1_CAP_MAX (0x000000FF)
+ #define PCU_CR_RP_STATE_CAP_PCU_RP1_CAP_DEF (0x00000000)
+ #define PCU_CR_RP_STATE_CAP_PCU_RPN_CAP_OFF (16)
+ #define PCU_CR_RP_STATE_CAP_PCU_RPN_CAP_WID ( 8)
+ #define PCU_CR_RP_STATE_CAP_PCU_RPN_CAP_MSK (0x00FF0000)
+ #define PCU_CR_RP_STATE_CAP_PCU_RPN_CAP_MAX (0x000000FF)
+ #define PCU_CR_RP_STATE_CAP_PCU_RPN_CAP_DEF (0x00000000)
+
+#define PCU_CR_TEMPERATURE_TARGET_PCU_REG (0x0000599C)
+ #define PCU_CR_TEMPERATURE_TARGET_PCU_FAN_TEMP_TARGET_OFST_OFF ( 8)
+ #define PCU_CR_TEMPERATURE_TARGET_PCU_FAN_TEMP_TARGET_OFST_WID ( 8)
+ #define PCU_CR_TEMPERATURE_TARGET_PCU_FAN_TEMP_TARGET_OFST_MSK (0x0000FF00)
+ #define PCU_CR_TEMPERATURE_TARGET_PCU_FAN_TEMP_TARGET_OFST_MAX (0x000000FF)
+ #define PCU_CR_TEMPERATURE_TARGET_PCU_FAN_TEMP_TARGET_OFST_DEF (0x00000000)
+ #define PCU_CR_TEMPERATURE_TARGET_PCU_REF_TEMP_OFF (16)
+ #define PCU_CR_TEMPERATURE_TARGET_PCU_REF_TEMP_WID ( 8)
+ #define PCU_CR_TEMPERATURE_TARGET_PCU_REF_TEMP_MSK (0x00FF0000)
+ #define PCU_CR_TEMPERATURE_TARGET_PCU_REF_TEMP_MAX (0x000000FF)
+ #define PCU_CR_TEMPERATURE_TARGET_PCU_REF_TEMP_DEF (0x00000000)
+ #define PCU_CR_TEMPERATURE_TARGET_PCU_TJ_MAX_TCC_OFFSET_OFF (24)
+ #define PCU_CR_TEMPERATURE_TARGET_PCU_TJ_MAX_TCC_OFFSET_WID ( 4)
+ #define PCU_CR_TEMPERATURE_TARGET_PCU_TJ_MAX_TCC_OFFSET_MSK (0x0F000000)
+ #define PCU_CR_TEMPERATURE_TARGET_PCU_TJ_MAX_TCC_OFFSET_MAX (0x0000000F)
+ #define PCU_CR_TEMPERATURE_TARGET_PCU_TJ_MAX_TCC_OFFSET_DEF (0x00000000)
+
+#define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_REG (0x000059A0)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_PWR_LIM_1_OFF ( 0)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_PWR_LIM_1_WID (15)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_PWR_LIM_1_MSK (0x00007FFF)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_PWR_LIM_1_MAX (0x00007FFF)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_PWR_LIM_1_DEF (0x00000000)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_PWR_LIM_1_EN_OFF (15)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_PWR_LIM_1_EN_WID ( 1)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_PWR_LIM_1_EN_MSK (0x00008000)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_PWR_LIM_1_EN_MAX (0x00000001)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_PWR_LIM_1_EN_DEF (0x00000000)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_CLMP_LIM_1_OFF (16)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_CLMP_LIM_1_WID ( 1)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_CLMP_LIM_1_MSK (0x00010000)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_CLMP_LIM_1_MAX (0x00000001)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_CLMP_LIM_1_DEF (0x00000000)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_PWR_LIM_1_TIME_OFF (17)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_PWR_LIM_1_TIME_WID ( 7)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_PWR_LIM_1_TIME_MSK (0x00FE0000)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_PWR_LIM_1_TIME_MAX (0x0000007F)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_PWR_LIM_1_TIME_DEF (0x00000000)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_PWR_LIM_2_OFF (32)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_PWR_LIM_2_WID (15)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_PWR_LIM_2_MSK (0x7FFF00000000)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_PWR_LIM_2_MAX (0x00007FFF)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_PWR_LIM_2_DEF (0x00000000)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_PWR_LIM_2_EN_OFF (47)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_PWR_LIM_2_EN_WID ( 1)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_PWR_LIM_2_EN_MSK (0x800000000000)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_PWR_LIM_2_EN_MAX (0x00000001)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_PWR_LIM_2_EN_DEF (0x00000000)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_CLMP_LIM_2_OFF (48)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_CLMP_LIM_2_WID ( 1)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_CLMP_LIM_2_MSK (0x1000000000000)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_CLMP_LIM_2_MAX (0x00000001)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_CLMP_LIM_2_DEF (0x00000000)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_PWR_LIM_2_TIME_OFF (49)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_PWR_LIM_2_TIME_WID ( 7)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_PWR_LIM_2_TIME_MSK (0xFE000000000000)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_PWR_LIM_2_TIME_MAX (0x0000007F)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_PWR_LIM_2_TIME_DEF (0x00000000)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_PWR_LIM_LOCK_OFF (63)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_PWR_LIM_LOCK_WID ( 1)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_PWR_LIM_LOCK_MSK (0x8000000000000000)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_PWR_LIM_LOCK_MAX (0x00000001)
+ #define PCU_CR_PACKAGE_RAPL_LIMIT_PCU_PKG_PWR_LIM_LOCK_DEF (0x00000000)
+
+#define PCU_CR_PRIP_TURBO_PWR_LIM_PCU_REG (0x000059A8)
+ #define PCU_CR_PRIP_TURBO_PWR_LIM_PCU_IA_PP_PWR_LIM_OFF ( 0)
+ #define PCU_CR_PRIP_TURBO_PWR_LIM_PCU_IA_PP_PWR_LIM_WID (15)
+ #define PCU_CR_PRIP_TURBO_PWR_LIM_PCU_IA_PP_PWR_LIM_MSK (0x00007FFF)
+ #define PCU_CR_PRIP_TURBO_PWR_LIM_PCU_IA_PP_PWR_LIM_MAX (0x00007FFF)
+ #define PCU_CR_PRIP_TURBO_PWR_LIM_PCU_IA_PP_PWR_LIM_DEF (0x00000000)
+ #define PCU_CR_PRIP_TURBO_PWR_LIM_PCU_PWR_LIM_CTRL_EN_OFF (15)
+ #define PCU_CR_PRIP_TURBO_PWR_LIM_PCU_PWR_LIM_CTRL_EN_WID ( 1)
+ #define PCU_CR_PRIP_TURBO_PWR_LIM_PCU_PWR_LIM_CTRL_EN_MSK (0x00008000)
+ #define PCU_CR_PRIP_TURBO_PWR_LIM_PCU_PWR_LIM_CTRL_EN_MAX (0x00000001)
+ #define PCU_CR_PRIP_TURBO_PWR_LIM_PCU_PWR_LIM_CTRL_EN_DEF (0x00000000)
+ #define PCU_CR_PRIP_TURBO_PWR_LIM_PCU_PP_CLAMP_LIM_OFF (16)
+ #define PCU_CR_PRIP_TURBO_PWR_LIM_PCU_PP_CLAMP_LIM_WID ( 1)
+ #define PCU_CR_PRIP_TURBO_PWR_LIM_PCU_PP_CLAMP_LIM_MSK (0x00010000)
+ #define PCU_CR_PRIP_TURBO_PWR_LIM_PCU_PP_CLAMP_LIM_MAX (0x00000001)
+ #define PCU_CR_PRIP_TURBO_PWR_LIM_PCU_PP_CLAMP_LIM_DEF (0x00000000)
+ #define PCU_CR_PRIP_TURBO_PWR_LIM_PCU_CTRL_TIME_WIN_OFF (17)
+ #define PCU_CR_PRIP_TURBO_PWR_LIM_PCU_CTRL_TIME_WIN_WID ( 7)
+ #define PCU_CR_PRIP_TURBO_PWR_LIM_PCU_CTRL_TIME_WIN_MSK (0x00FE0000)
+ #define PCU_CR_PRIP_TURBO_PWR_LIM_PCU_CTRL_TIME_WIN_MAX (0x0000007F)
+ #define PCU_CR_PRIP_TURBO_PWR_LIM_PCU_CTRL_TIME_WIN_DEF (0x00000000)
+ #define PCU_CR_PRIP_TURBO_PWR_LIM_PCU_PP_PWR_LIM_LOCK_OFF (31)
+ #define PCU_CR_PRIP_TURBO_PWR_LIM_PCU_PP_PWR_LIM_LOCK_WID ( 1)
+ #define PCU_CR_PRIP_TURBO_PWR_LIM_PCU_PP_PWR_LIM_LOCK_MSK (0x80000000)
+ #define PCU_CR_PRIP_TURBO_PWR_LIM_PCU_PP_PWR_LIM_LOCK_MAX (0x00000001)
+ #define PCU_CR_PRIP_TURBO_PWR_LIM_PCU_PP_PWR_LIM_LOCK_DEF (0x00000000)
+
+#define PCU_CR_SECP_TURBO_PWR_LIM_PCU_REG (0x000059AC)
+ #define PCU_CR_SECP_TURBO_PWR_LIM_PCU_NON_IA_PP_PWR_LIM_OFF ( 0)
+ #define PCU_CR_SECP_TURBO_PWR_LIM_PCU_NON_IA_PP_PWR_LIM_WID (15)
+ #define PCU_CR_SECP_TURBO_PWR_LIM_PCU_NON_IA_PP_PWR_LIM_MSK (0x00007FFF)
+ #define PCU_CR_SECP_TURBO_PWR_LIM_PCU_NON_IA_PP_PWR_LIM_MAX (0x00007FFF)
+ #define PCU_CR_SECP_TURBO_PWR_LIM_PCU_NON_IA_PP_PWR_LIM_DEF (0x00000000)
+ #define PCU_CR_SECP_TURBO_PWR_LIM_PCU_PWR_LIM_CTRL_EN_OFF (15)
+ #define PCU_CR_SECP_TURBO_PWR_LIM_PCU_PWR_LIM_CTRL_EN_WID ( 1)
+ #define PCU_CR_SECP_TURBO_PWR_LIM_PCU_PWR_LIM_CTRL_EN_MSK (0x00008000)
+ #define PCU_CR_SECP_TURBO_PWR_LIM_PCU_PWR_LIM_CTRL_EN_MAX (0x00000001)
+ #define PCU_CR_SECP_TURBO_PWR_LIM_PCU_PWR_LIM_CTRL_EN_DEF (0x00000000)
+ #define PCU_CR_SECP_TURBO_PWR_LIM_PCU_PP_CLAMP_LIM_OFF (16)
+ #define PCU_CR_SECP_TURBO_PWR_LIM_PCU_PP_CLAMP_LIM_WID ( 1)
+ #define PCU_CR_SECP_TURBO_PWR_LIM_PCU_PP_CLAMP_LIM_MSK (0x00010000)
+ #define PCU_CR_SECP_TURBO_PWR_LIM_PCU_PP_CLAMP_LIM_MAX (0x00000001)
+ #define PCU_CR_SECP_TURBO_PWR_LIM_PCU_PP_CLAMP_LIM_DEF (0x00000000)
+ #define PCU_CR_SECP_TURBO_PWR_LIM_PCU_CTRL_TIME_WIN_OFF (17)
+ #define PCU_CR_SECP_TURBO_PWR_LIM_PCU_CTRL_TIME_WIN_WID ( 7)
+ #define PCU_CR_SECP_TURBO_PWR_LIM_PCU_CTRL_TIME_WIN_MSK (0x00FE0000)
+ #define PCU_CR_SECP_TURBO_PWR_LIM_PCU_CTRL_TIME_WIN_MAX (0x0000007F)
+ #define PCU_CR_SECP_TURBO_PWR_LIM_PCU_CTRL_TIME_WIN_DEF (0x00000000)
+ #define PCU_CR_SECP_TURBO_PWR_LIM_PCU_SP_PWR_LIM_LOCK_OFF (31)
+ #define PCU_CR_SECP_TURBO_PWR_LIM_PCU_SP_PWR_LIM_LOCK_WID ( 1)
+ #define PCU_CR_SECP_TURBO_PWR_LIM_PCU_SP_PWR_LIM_LOCK_MSK (0x80000000)
+ #define PCU_CR_SECP_TURBO_PWR_LIM_PCU_SP_PWR_LIM_LOCK_MAX (0x00000001)
+ #define PCU_CR_SECP_TURBO_PWR_LIM_PCU_SP_PWR_LIM_LOCK_DEF (0x00000000)
+
+#define PCU_CR_VR_CURRENT_CONFIG_PCU_REG (0x000059B0)
+ #define PCU_CR_VR_CURRENT_CONFIG_PCU_CURRENT_LIMIT_OFF ( 0)
+ #define PCU_CR_VR_CURRENT_CONFIG_PCU_CURRENT_LIMIT_WID (13)
+ #define PCU_CR_VR_CURRENT_CONFIG_PCU_CURRENT_LIMIT_MSK (0x00001FFF)
+ #define PCU_CR_VR_CURRENT_CONFIG_PCU_CURRENT_LIMIT_MAX (0x00001FFF)
+ #define PCU_CR_VR_CURRENT_CONFIG_PCU_CURRENT_LIMIT_DEF (0x00000190)
+ #define PCU_CR_VR_CURRENT_CONFIG_PCU_LOCK_OFF (31)
+ #define PCU_CR_VR_CURRENT_CONFIG_PCU_LOCK_WID ( 1)
+ #define PCU_CR_VR_CURRENT_CONFIG_PCU_LOCK_MSK (0x80000000)
+ #define PCU_CR_VR_CURRENT_CONFIG_PCU_LOCK_MAX (0x00000001)
+ #define PCU_CR_VR_CURRENT_CONFIG_PCU_LOCK_DEF (0x00000000)
+ #define PCU_CR_VR_CURRENT_CONFIG_PCU_PSI1_THRESHOLD_OFF (32)
+ #define PCU_CR_VR_CURRENT_CONFIG_PCU_PSI1_THRESHOLD_WID (10)
+ #define PCU_CR_VR_CURRENT_CONFIG_PCU_PSI1_THRESHOLD_MSK (0x3FF00000000)
+ #define PCU_CR_VR_CURRENT_CONFIG_PCU_PSI1_THRESHOLD_MAX (0x000003FF)
+ #define PCU_CR_VR_CURRENT_CONFIG_PCU_PSI1_THRESHOLD_DEF (0x00000000)
+ #define PCU_CR_VR_CURRENT_CONFIG_PCU_PSI2_THRESHOLD_OFF (42)
+ #define PCU_CR_VR_CURRENT_CONFIG_PCU_PSI2_THRESHOLD_WID (10)
+ #define PCU_CR_VR_CURRENT_CONFIG_PCU_PSI2_THRESHOLD_MSK (0xFFC0000000000)
+ #define PCU_CR_VR_CURRENT_CONFIG_PCU_PSI2_THRESHOLD_MAX (0x000003FF)
+ #define PCU_CR_VR_CURRENT_CONFIG_PCU_PSI2_THRESHOLD_DEF (0x00000000)
+ #define PCU_CR_VR_CURRENT_CONFIG_PCU_PSI3_THRESHOLD_OFF (52)
+ #define PCU_CR_VR_CURRENT_CONFIG_PCU_PSI3_THRESHOLD_WID (10)
+ #define PCU_CR_VR_CURRENT_CONFIG_PCU_PSI3_THRESHOLD_MSK (0x3FF0000000000000)
+ #define PCU_CR_VR_CURRENT_CONFIG_PCU_PSI3_THRESHOLD_MAX (0x000003FF)
+ #define PCU_CR_VR_CURRENT_CONFIG_PCU_PSI3_THRESHOLD_DEF (0x00000000)
+ #define PCU_CR_VR_CURRENT_CONFIG_PCU_RESERVED_OFF (62)
+ #define PCU_CR_VR_CURRENT_CONFIG_PCU_RESERVED_WID ( 2)
+ #define PCU_CR_VR_CURRENT_CONFIG_PCU_RESERVED_MSK (0xC000000000000000)
+ #define PCU_CR_VR_CURRENT_CONFIG_PCU_RESERVED_MAX (0x00000003)
+ #define PCU_CR_VR_CURRENT_CONFIG_PCU_RESERVED_DEF (0x00000000)
+
+#define PCU_CR_MRC_ODT_POWER_SAVING_PCU_REG (0x000059B8)
+ #define PCU_CR_MRC_ODT_POWER_SAVING_PCU_MRC_Saving_Rd_OFF ( 0)
+ #define PCU_CR_MRC_ODT_POWER_SAVING_PCU_MRC_Saving_Rd_WID ( 8)
+ #define PCU_CR_MRC_ODT_POWER_SAVING_PCU_MRC_Saving_Rd_MSK (0x000000FF)
+ #define PCU_CR_MRC_ODT_POWER_SAVING_PCU_MRC_Saving_Rd_MAX (0x000000FF)
+ #define PCU_CR_MRC_ODT_POWER_SAVING_PCU_MRC_Saving_Rd_DEF (0x00000000)
+ #define PCU_CR_MRC_ODT_POWER_SAVING_PCU_MRC_Saving_Wt_OFF ( 8)
+ #define PCU_CR_MRC_ODT_POWER_SAVING_PCU_MRC_Saving_Wt_WID ( 8)
+ #define PCU_CR_MRC_ODT_POWER_SAVING_PCU_MRC_Saving_Wt_MSK (0x0000FF00)
+ #define PCU_CR_MRC_ODT_POWER_SAVING_PCU_MRC_Saving_Wt_MAX (0x000000FF)
+ #define PCU_CR_MRC_ODT_POWER_SAVING_PCU_MRC_Saving_Wt_DEF (0x00000000)
+ #define PCU_CR_MRC_ODT_POWER_SAVING_PCU_MRC_Saving_Cmd_OFF (16)
+ #define PCU_CR_MRC_ODT_POWER_SAVING_PCU_MRC_Saving_Cmd_WID ( 8)
+ #define PCU_CR_MRC_ODT_POWER_SAVING_PCU_MRC_Saving_Cmd_MSK (0x00FF0000)
+ #define PCU_CR_MRC_ODT_POWER_SAVING_PCU_MRC_Saving_Cmd_MAX (0x000000FF)
+ #define PCU_CR_MRC_ODT_POWER_SAVING_PCU_MRC_Saving_Cmd_DEF (0x00000000)
+ #define PCU_CR_MRC_ODT_POWER_SAVING_PCU_RESERVED_OFF (24)
+ #define PCU_CR_MRC_ODT_POWER_SAVING_PCU_RESERVED_WID ( 8)
+ #define PCU_CR_MRC_ODT_POWER_SAVING_PCU_RESERVED_MSK (0xFF000000)
+ #define PCU_CR_MRC_ODT_POWER_SAVING_PCU_RESERVED_MAX (0x000000FF)
+ #define PCU_CR_MRC_ODT_POWER_SAVING_PCU_RESERVED_DEF (0x00000000)
+
+#define PCU_CR_THERM_STATUS_GT_PCU_REG (0x000059C0)
+ #define PCU_CR_THERM_STATUS_GT_PCU_THERMAL_MONITOR_STATUS_OFF ( 0)
+ #define PCU_CR_THERM_STATUS_GT_PCU_THERMAL_MONITOR_STATUS_WID ( 1)
+ #define PCU_CR_THERM_STATUS_GT_PCU_THERMAL_MONITOR_STATUS_MSK (0x00000001)
+ #define PCU_CR_THERM_STATUS_GT_PCU_THERMAL_MONITOR_STATUS_MAX (0x00000001)
+ #define PCU_CR_THERM_STATUS_GT_PCU_THERMAL_MONITOR_STATUS_DEF (0x00000000)
+ #define PCU_CR_THERM_STATUS_GT_PCU_THERMAL_MONITOR_LOG_OFF ( 1)
+ #define PCU_CR_THERM_STATUS_GT_PCU_THERMAL_MONITOR_LOG_WID ( 1)
+ #define PCU_CR_THERM_STATUS_GT_PCU_THERMAL_MONITOR_LOG_MSK (0x00000002)
+ #define PCU_CR_THERM_STATUS_GT_PCU_THERMAL_MONITOR_LOG_MAX (0x00000001)
+ #define PCU_CR_THERM_STATUS_GT_PCU_THERMAL_MONITOR_LOG_DEF (0x00000000)
+ #define PCU_CR_THERM_STATUS_GT_PCU_PROCHOT_STATUS_OFF ( 2)
+ #define PCU_CR_THERM_STATUS_GT_PCU_PROCHOT_STATUS_WID ( 1)
+ #define PCU_CR_THERM_STATUS_GT_PCU_PROCHOT_STATUS_MSK (0x00000004)
+ #define PCU_CR_THERM_STATUS_GT_PCU_PROCHOT_STATUS_MAX (0x00000001)
+ #define PCU_CR_THERM_STATUS_GT_PCU_PROCHOT_STATUS_DEF (0x00000000)
+ #define PCU_CR_THERM_STATUS_GT_PCU_PROCHOT_LOG_OFF ( 3)
+ #define PCU_CR_THERM_STATUS_GT_PCU_PROCHOT_LOG_WID ( 1)
+ #define PCU_CR_THERM_STATUS_GT_PCU_PROCHOT_LOG_MSK (0x00000008)
+ #define PCU_CR_THERM_STATUS_GT_PCU_PROCHOT_LOG_MAX (0x00000001)
+ #define PCU_CR_THERM_STATUS_GT_PCU_PROCHOT_LOG_DEF (0x00000000)
+ #define PCU_CR_THERM_STATUS_GT_PCU_OUT_OF_SPEC_STATUS_OFF ( 4)
+ #define PCU_CR_THERM_STATUS_GT_PCU_OUT_OF_SPEC_STATUS_WID ( 1)
+ #define PCU_CR_THERM_STATUS_GT_PCU_OUT_OF_SPEC_STATUS_MSK (0x00000010)
+ #define PCU_CR_THERM_STATUS_GT_PCU_OUT_OF_SPEC_STATUS_MAX (0x00000001)
+ #define PCU_CR_THERM_STATUS_GT_PCU_OUT_OF_SPEC_STATUS_DEF (0x00000000)
+ #define PCU_CR_THERM_STATUS_GT_PCU_OUT_OF_SPEC_LOG_OFF ( 5)
+ #define PCU_CR_THERM_STATUS_GT_PCU_OUT_OF_SPEC_LOG_WID ( 1)
+ #define PCU_CR_THERM_STATUS_GT_PCU_OUT_OF_SPEC_LOG_MSK (0x00000020)
+ #define PCU_CR_THERM_STATUS_GT_PCU_OUT_OF_SPEC_LOG_MAX (0x00000001)
+ #define PCU_CR_THERM_STATUS_GT_PCU_OUT_OF_SPEC_LOG_DEF (0x00000000)
+ #define PCU_CR_THERM_STATUS_GT_PCU_THRESHOLD1_STATUS_OFF ( 6)
+ #define PCU_CR_THERM_STATUS_GT_PCU_THRESHOLD1_STATUS_WID ( 1)
+ #define PCU_CR_THERM_STATUS_GT_PCU_THRESHOLD1_STATUS_MSK (0x00000040)
+ #define PCU_CR_THERM_STATUS_GT_PCU_THRESHOLD1_STATUS_MAX (0x00000001)
+ #define PCU_CR_THERM_STATUS_GT_PCU_THRESHOLD1_STATUS_DEF (0x00000000)
+ #define PCU_CR_THERM_STATUS_GT_PCU_THRESHOLD1_LOG_OFF ( 7)
+ #define PCU_CR_THERM_STATUS_GT_PCU_THRESHOLD1_LOG_WID ( 1)
+ #define PCU_CR_THERM_STATUS_GT_PCU_THRESHOLD1_LOG_MSK (0x00000080)
+ #define PCU_CR_THERM_STATUS_GT_PCU_THRESHOLD1_LOG_MAX (0x00000001)
+ #define PCU_CR_THERM_STATUS_GT_PCU_THRESHOLD1_LOG_DEF (0x00000000)
+ #define PCU_CR_THERM_STATUS_GT_PCU_THRESHOLD2_STATUS_OFF ( 8)
+ #define PCU_CR_THERM_STATUS_GT_PCU_THRESHOLD2_STATUS_WID ( 1)
+ #define PCU_CR_THERM_STATUS_GT_PCU_THRESHOLD2_STATUS_MSK (0x00000100)
+ #define PCU_CR_THERM_STATUS_GT_PCU_THRESHOLD2_STATUS_MAX (0x00000001)
+ #define PCU_CR_THERM_STATUS_GT_PCU_THRESHOLD2_STATUS_DEF (0x00000000)
+ #define PCU_CR_THERM_STATUS_GT_PCU_THRESHOLD2_LOG_OFF ( 9)
+ #define PCU_CR_THERM_STATUS_GT_PCU_THRESHOLD2_LOG_WID ( 1)
+ #define PCU_CR_THERM_STATUS_GT_PCU_THRESHOLD2_LOG_MSK (0x00000200)
+ #define PCU_CR_THERM_STATUS_GT_PCU_THRESHOLD2_LOG_MAX (0x00000001)
+ #define PCU_CR_THERM_STATUS_GT_PCU_THRESHOLD2_LOG_DEF (0x00000000)
+ #define PCU_CR_THERM_STATUS_GT_PCU_POWER_LIMITATION_STATUS_OFF (10)
+ #define PCU_CR_THERM_STATUS_GT_PCU_POWER_LIMITATION_STATUS_WID ( 1)
+ #define PCU_CR_THERM_STATUS_GT_PCU_POWER_LIMITATION_STATUS_MSK (0x00000400)
+ #define PCU_CR_THERM_STATUS_GT_PCU_POWER_LIMITATION_STATUS_MAX (0x00000001)
+ #define PCU_CR_THERM_STATUS_GT_PCU_POWER_LIMITATION_STATUS_DEF (0x00000000)
+ #define PCU_CR_THERM_STATUS_GT_PCU_POWER_LIMITATION_LOG_OFF (11)
+ #define PCU_CR_THERM_STATUS_GT_PCU_POWER_LIMITATION_LOG_WID ( 1)
+ #define PCU_CR_THERM_STATUS_GT_PCU_POWER_LIMITATION_LOG_MSK (0x00000800)
+ #define PCU_CR_THERM_STATUS_GT_PCU_POWER_LIMITATION_LOG_MAX (0x00000001)
+ #define PCU_CR_THERM_STATUS_GT_PCU_POWER_LIMITATION_LOG_DEF (0x00000000)
+ #define PCU_CR_THERM_STATUS_GT_PCU_TEMPERATURE_OFF (16)
+ #define PCU_CR_THERM_STATUS_GT_PCU_TEMPERATURE_WID ( 7)
+ #define PCU_CR_THERM_STATUS_GT_PCU_TEMPERATURE_MSK (0x007F0000)
+ #define PCU_CR_THERM_STATUS_GT_PCU_TEMPERATURE_MAX (0x0000007F)
+ #define PCU_CR_THERM_STATUS_GT_PCU_TEMPERATURE_DEF (0x00000000)
+ #define PCU_CR_THERM_STATUS_GT_PCU_RESOLUTION_OFF (27)
+ #define PCU_CR_THERM_STATUS_GT_PCU_RESOLUTION_WID ( 4)
+ #define PCU_CR_THERM_STATUS_GT_PCU_RESOLUTION_MSK (0x78000000)
+ #define PCU_CR_THERM_STATUS_GT_PCU_RESOLUTION_MAX (0x0000000F)
+ #define PCU_CR_THERM_STATUS_GT_PCU_RESOLUTION_DEF (0x00000001)
+ #define PCU_CR_THERM_STATUS_GT_PCU_VALID_OFF (31)
+ #define PCU_CR_THERM_STATUS_GT_PCU_VALID_WID ( 1)
+ #define PCU_CR_THERM_STATUS_GT_PCU_VALID_MSK (0x80000000)
+ #define PCU_CR_THERM_STATUS_GT_PCU_VALID_MAX (0x00000001)
+ #define PCU_CR_THERM_STATUS_GT_PCU_VALID_DEF (0x00000000)
+
+#define PCU_CR_THERM_INTERRUPT_GT_PCU_REG (0x000059C4)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_HIGH_TEMP_INT_ENABLE_OFF ( 0)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_HIGH_TEMP_INT_ENABLE_WID ( 1)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_HIGH_TEMP_INT_ENABLE_MSK (0x00000001)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_HIGH_TEMP_INT_ENABLE_MAX (0x00000001)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_HIGH_TEMP_INT_ENABLE_DEF (0x00000000)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_LOW_TEMP_INT_ENABLE_OFF ( 1)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_LOW_TEMP_INT_ENABLE_WID ( 1)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_LOW_TEMP_INT_ENABLE_MSK (0x00000002)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_LOW_TEMP_INT_ENABLE_MAX (0x00000001)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_LOW_TEMP_INT_ENABLE_DEF (0x00000000)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_PROCHOT_INT_ENABLE_OFF ( 2)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_PROCHOT_INT_ENABLE_WID ( 1)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_PROCHOT_INT_ENABLE_MSK (0x00000004)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_PROCHOT_INT_ENABLE_MAX (0x00000001)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_PROCHOT_INT_ENABLE_DEF (0x00000000)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_OUT_OF_SPEC_INT_ENABLE_OFF ( 4)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_OUT_OF_SPEC_INT_ENABLE_WID ( 1)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_OUT_OF_SPEC_INT_ENABLE_MSK (0x00000010)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_OUT_OF_SPEC_INT_ENABLE_MAX (0x00000001)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_OUT_OF_SPEC_INT_ENABLE_DEF (0x00000000)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_THRESHOLD_1_REL_TEMP_OFF ( 8)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_THRESHOLD_1_REL_TEMP_WID ( 7)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_THRESHOLD_1_REL_TEMP_MSK (0x00007F00)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_THRESHOLD_1_REL_TEMP_MAX (0x0000007F)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_THRESHOLD_1_REL_TEMP_DEF (0x00000000)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_THRESHOLD_1_INT_ENABLE_OFF (15)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_THRESHOLD_1_INT_ENABLE_WID ( 1)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_THRESHOLD_1_INT_ENABLE_MSK (0x00008000)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_THRESHOLD_1_INT_ENABLE_MAX (0x00000001)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_THRESHOLD_1_INT_ENABLE_DEF (0x00000000)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_THRESHOLD_2_REL_TEMP_OFF (16)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_THRESHOLD_2_REL_TEMP_WID ( 7)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_THRESHOLD_2_REL_TEMP_MSK (0x007F0000)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_THRESHOLD_2_REL_TEMP_MAX (0x0000007F)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_THRESHOLD_2_REL_TEMP_DEF (0x00000000)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_THRESHOLD_2_INT_ENABLE_OFF (23)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_THRESHOLD_2_INT_ENABLE_WID ( 1)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_THRESHOLD_2_INT_ENABLE_MSK (0x00800000)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_THRESHOLD_2_INT_ENABLE_MAX (0x00000001)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_THRESHOLD_2_INT_ENABLE_DEF (0x00000000)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_POWER_INT_ENABLE_OFF (24)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_POWER_INT_ENABLE_WID ( 1)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_POWER_INT_ENABLE_MSK (0x01000000)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_POWER_INT_ENABLE_MAX (0x00000001)
+ #define PCU_CR_THERM_INTERRUPT_GT_PCU_POWER_INT_ENABLE_DEF (0x00000000)
+
+#define PCU_CR_DEVICE_IDLE_DURATION_OVERRIDE_PCU_REG (0x000059C8)
+ #define PCU_CR_DEVICE_IDLE_DURATION_OVERRIDE_PCU_RESERVED_OFF ( 0)
+ #define PCU_CR_DEVICE_IDLE_DURATION_OVERRIDE_PCU_RESERVED_WID ( 1)
+ #define PCU_CR_DEVICE_IDLE_DURATION_OVERRIDE_PCU_RESERVED_MSK (0x00000001)
+ #define PCU_CR_DEVICE_IDLE_DURATION_OVERRIDE_PCU_RESERVED_MAX (0x00000001)
+ #define PCU_CR_DEVICE_IDLE_DURATION_OVERRIDE_PCU_RESERVED_DEF (0x00000000)
+ #define PCU_CR_DEVICE_IDLE_DURATION_OVERRIDE_PCU_VALID_OFF ( 1)
+ #define PCU_CR_DEVICE_IDLE_DURATION_OVERRIDE_PCU_VALID_WID ( 1)
+ #define PCU_CR_DEVICE_IDLE_DURATION_OVERRIDE_PCU_VALID_MSK (0x00000002)
+ #define PCU_CR_DEVICE_IDLE_DURATION_OVERRIDE_PCU_VALID_MAX (0x00000001)
+ #define PCU_CR_DEVICE_IDLE_DURATION_OVERRIDE_PCU_VALID_DEF (0x00000000)
+ #define PCU_CR_DEVICE_IDLE_DURATION_OVERRIDE_PCU_RESERVED_BITS_OFF ( 2)
+ #define PCU_CR_DEVICE_IDLE_DURATION_OVERRIDE_PCU_RESERVED_BITS_WID ( 4)
+ #define PCU_CR_DEVICE_IDLE_DURATION_OVERRIDE_PCU_RESERVED_BITS_MSK (0x0000003C)
+ #define PCU_CR_DEVICE_IDLE_DURATION_OVERRIDE_PCU_RESERVED_BITS_MAX (0x0000000F)
+ #define PCU_CR_DEVICE_IDLE_DURATION_OVERRIDE_PCU_RESERVED_BITS_DEF (0x00000000)
+ #define PCU_CR_DEVICE_IDLE_DURATION_OVERRIDE_PCU_OD_OFF ( 6)
+ #define PCU_CR_DEVICE_IDLE_DURATION_OVERRIDE_PCU_OD_WID ( 1)
+ #define PCU_CR_DEVICE_IDLE_DURATION_OVERRIDE_PCU_OD_MSK (0x00000040)
+ #define PCU_CR_DEVICE_IDLE_DURATION_OVERRIDE_PCU_OD_MAX (0x00000001)
+ #define PCU_CR_DEVICE_IDLE_DURATION_OVERRIDE_PCU_OD_DEF (0x00000000)
+ #define PCU_CR_DEVICE_IDLE_DURATION_OVERRIDE_PCU_IM_OFF ( 7)
+ #define PCU_CR_DEVICE_IDLE_DURATION_OVERRIDE_PCU_IM_WID ( 1)
+ #define PCU_CR_DEVICE_IDLE_DURATION_OVERRIDE_PCU_IM_MSK (0x00000080)
+ #define PCU_CR_DEVICE_IDLE_DURATION_OVERRIDE_PCU_IM_MAX (0x00000001)
+ #define PCU_CR_DEVICE_IDLE_DURATION_OVERRIDE_PCU_IM_DEF (0x00000000)
+ #define PCU_CR_DEVICE_IDLE_DURATION_OVERRIDE_PCU_NEXT_DEVICE_ACTIVITY_OFF ( 8)
+ #define PCU_CR_DEVICE_IDLE_DURATION_OVERRIDE_PCU_NEXT_DEVICE_ACTIVITY_WID (21)
+ #define PCU_CR_DEVICE_IDLE_DURATION_OVERRIDE_PCU_NEXT_DEVICE_ACTIVITY_MSK (0x1FFFFF00)
+ #define PCU_CR_DEVICE_IDLE_DURATION_OVERRIDE_PCU_NEXT_DEVICE_ACTIVITY_MAX (0x001FFFFF)
+ #define PCU_CR_DEVICE_IDLE_DURATION_OVERRIDE_PCU_NEXT_DEVICE_ACTIVITY_DEF (0x00000000)
+ #define PCU_CR_DEVICE_IDLE_DURATION_OVERRIDE_PCU_DISABLE_MDID_EVALUATION_OFF (29)
+ #define PCU_CR_DEVICE_IDLE_DURATION_OVERRIDE_PCU_DISABLE_MDID_EVALUATION_WID ( 1)
+ #define PCU_CR_DEVICE_IDLE_DURATION_OVERRIDE_PCU_DISABLE_MDID_EVALUATION_MSK (0x20000000)
+ #define PCU_CR_DEVICE_IDLE_DURATION_OVERRIDE_PCU_DISABLE_MDID_EVALUATION_MAX (0x00000001)
+ #define PCU_CR_DEVICE_IDLE_DURATION_OVERRIDE_PCU_DISABLE_MDID_EVALUATION_DEF (0x00000000)
+ #define PCU_CR_DEVICE_IDLE_DURATION_OVERRIDE_PCU_FORCE_MDID_OVERRIDE_OFF (30)
+ #define PCU_CR_DEVICE_IDLE_DURATION_OVERRIDE_PCU_FORCE_MDID_OVERRIDE_WID ( 1)
+ #define PCU_CR_DEVICE_IDLE_DURATION_OVERRIDE_PCU_FORCE_MDID_OVERRIDE_MSK (0x40000000)
+ #define PCU_CR_DEVICE_IDLE_DURATION_OVERRIDE_PCU_FORCE_MDID_OVERRIDE_MAX (0x00000001)
+ #define PCU_CR_DEVICE_IDLE_DURATION_OVERRIDE_PCU_FORCE_MDID_OVERRIDE_DEF (0x00000000)
+
+#define PCU_CR_GRAPHICS_INTERRUPT_RESPONSE_TIME_PCU_REG (0x000059D0)
+ #define PCU_CR_GRAPHICS_INTERRUPT_RESPONSE_TIME_PCU_VALUE_OFF ( 0)
+ #define PCU_CR_GRAPHICS_INTERRUPT_RESPONSE_TIME_PCU_VALUE_WID (10)
+ #define PCU_CR_GRAPHICS_INTERRUPT_RESPONSE_TIME_PCU_VALUE_MSK (0x000003FF)
+ #define PCU_CR_GRAPHICS_INTERRUPT_RESPONSE_TIME_PCU_VALUE_MAX (0x000003FF)
+ #define PCU_CR_GRAPHICS_INTERRUPT_RESPONSE_TIME_PCU_VALUE_DEF (0x00000000)
+ #define PCU_CR_GRAPHICS_INTERRUPT_RESPONSE_TIME_PCU_MULTIPLIER_OFF (10)
+ #define PCU_CR_GRAPHICS_INTERRUPT_RESPONSE_TIME_PCU_MULTIPLIER_WID ( 3)
+ #define PCU_CR_GRAPHICS_INTERRUPT_RESPONSE_TIME_PCU_MULTIPLIER_MSK (0x00001C00)
+ #define PCU_CR_GRAPHICS_INTERRUPT_RESPONSE_TIME_PCU_MULTIPLIER_MAX (0x00000007)
+ #define PCU_CR_GRAPHICS_INTERRUPT_RESPONSE_TIME_PCU_MULTIPLIER_DEF (0x00000000)
+ #define PCU_CR_GRAPHICS_INTERRUPT_RESPONSE_TIME_PCU_VALID_OFF (15)
+ #define PCU_CR_GRAPHICS_INTERRUPT_RESPONSE_TIME_PCU_VALID_WID ( 1)
+ #define PCU_CR_GRAPHICS_INTERRUPT_RESPONSE_TIME_PCU_VALID_MSK (0x00008000)
+ #define PCU_CR_GRAPHICS_INTERRUPT_RESPONSE_TIME_PCU_VALID_MAX (0x00000001)
+ #define PCU_CR_GRAPHICS_INTERRUPT_RESPONSE_TIME_PCU_VALID_DEF (0x00000000)
+
+#define PCU_CR_CHAP_CONFIG_PCU_REG (0x00005A00)
+ #define PCU_CR_CHAP_CONFIG_PCU_PECI_CMD_OFF ( 4)
+ #define PCU_CR_CHAP_CONFIG_PCU_PECI_CMD_WID ( 8)
+ #define PCU_CR_CHAP_CONFIG_PCU_PECI_CMD_MSK (0x00000FF0)
+ #define PCU_CR_CHAP_CONFIG_PCU_PECI_CMD_MAX (0x000000FF)
+ #define PCU_CR_CHAP_CONFIG_PCU_PECI_CMD_DEF (0x00000000)
+
+#define PCU_CR_CHAP_THRESHOLD2_PCU_REG (0x00005A08)
+ #define PCU_CR_CHAP_THRESHOLD2_PCU_FREQ_TH1_OFF ( 0)
+ #define PCU_CR_CHAP_THRESHOLD2_PCU_FREQ_TH1_WID ( 6)
+ #define PCU_CR_CHAP_THRESHOLD2_PCU_FREQ_TH1_MSK (0x0000003F)
+ #define PCU_CR_CHAP_THRESHOLD2_PCU_FREQ_TH1_MAX (0x0000003F)
+ #define PCU_CR_CHAP_THRESHOLD2_PCU_FREQ_TH1_DEF (0x00000000)
+ #define PCU_CR_CHAP_THRESHOLD2_PCU_FREQ_TH2_OFF ( 8)
+ #define PCU_CR_CHAP_THRESHOLD2_PCU_FREQ_TH2_WID ( 6)
+ #define PCU_CR_CHAP_THRESHOLD2_PCU_FREQ_TH2_MSK (0x00003F00)
+ #define PCU_CR_CHAP_THRESHOLD2_PCU_FREQ_TH2_MAX (0x0000003F)
+ #define PCU_CR_CHAP_THRESHOLD2_PCU_FREQ_TH2_DEF (0x00000000)
+ #define PCU_CR_CHAP_THRESHOLD2_PCU_FREQ_TH3_OFF (16)
+ #define PCU_CR_CHAP_THRESHOLD2_PCU_FREQ_TH3_WID ( 6)
+ #define PCU_CR_CHAP_THRESHOLD2_PCU_FREQ_TH3_MSK (0x003F0000)
+ #define PCU_CR_CHAP_THRESHOLD2_PCU_FREQ_TH3_MAX (0x0000003F)
+ #define PCU_CR_CHAP_THRESHOLD2_PCU_FREQ_TH3_DEF (0x00000000)
+
+#define PCU_CR_ENERGY_DEBUG_PCU_REG (0x00005B04)
+ #define PCU_CR_ENERGY_DEBUG_PCU_DEBUG_ENERGY_PP0_VALUE_OFF ( 0)
+ #define PCU_CR_ENERGY_DEBUG_PCU_DEBUG_ENERGY_PP0_VALUE_WID (10)
+ #define PCU_CR_ENERGY_DEBUG_PCU_DEBUG_ENERGY_PP0_VALUE_MSK (0x000003FF)
+ #define PCU_CR_ENERGY_DEBUG_PCU_DEBUG_ENERGY_PP0_VALUE_MAX (0x000003FF)
+ #define PCU_CR_ENERGY_DEBUG_PCU_DEBUG_ENERGY_PP0_VALUE_DEF (0x00000000)
+ #define PCU_CR_ENERGY_DEBUG_PCU_DEBUG_ENERGY_PP1_VALUE_OFF (10)
+ #define PCU_CR_ENERGY_DEBUG_PCU_DEBUG_ENERGY_PP1_VALUE_WID (10)
+ #define PCU_CR_ENERGY_DEBUG_PCU_DEBUG_ENERGY_PP1_VALUE_MSK (0x000FFC00)
+ #define PCU_CR_ENERGY_DEBUG_PCU_DEBUG_ENERGY_PP1_VALUE_MAX (0x000003FF)
+ #define PCU_CR_ENERGY_DEBUG_PCU_DEBUG_ENERGY_PP1_VALUE_DEF (0x00000000)
+ #define PCU_CR_ENERGY_DEBUG_PCU_DEBUG_ENERGY_SA_VALUE_OFF (20)
+ #define PCU_CR_ENERGY_DEBUG_PCU_DEBUG_ENERGY_SA_VALUE_WID (10)
+ #define PCU_CR_ENERGY_DEBUG_PCU_DEBUG_ENERGY_SA_VALUE_MSK (0x3FF00000)
+ #define PCU_CR_ENERGY_DEBUG_PCU_DEBUG_ENERGY_SA_VALUE_MAX (0x000003FF)
+ #define PCU_CR_ENERGY_DEBUG_PCU_DEBUG_ENERGY_SA_VALUE_DEF (0x00000000)
+
+#define PCU_CR_SSKPD_PCU_REG (0x00005D10)
+ #define PCU_CR_SSKPD_PCU_SKPD_OFF ( 0)
+ #define PCU_CR_SSKPD_PCU_SKPD_WID (64)
+ #define PCU_CR_SSKPD_PCU_SKPD_MSK (0xFFFFFFFFFFFFFFFF)
+ #define PCU_CR_SSKPD_PCU_SKPD_MAX (0xFFFFFFFFFFFFFFFF)
+ #define PCU_CR_SSKPD_PCU_SKPD_DEF (0x00000000)
+
+#define PCU_CR_C2C3TT_PCU_REG (0x00005D20)
+ #define PCU_CR_C2C3TT_PCU_PPDN_INIT_OFF ( 0)
+ #define PCU_CR_C2C3TT_PCU_PPDN_INIT_WID (12)
+ #define PCU_CR_C2C3TT_PCU_PPDN_INIT_MSK (0x00000FFF)
+ #define PCU_CR_C2C3TT_PCU_PPDN_INIT_MAX (0x00000FFF)
+ #define PCU_CR_C2C3TT_PCU_PPDN_INIT_DEF (0x00000005)
+
+#define PCU_CR_C2_DDR_TT_PCU_REG (0x00005D24)
+ #define PCU_CR_C2_DDR_TT_PCU_DDR_TIMER_VALUE_OFF ( 0)
+ #define PCU_CR_C2_DDR_TT_PCU_DDR_TIMER_VALUE_WID (13)
+ #define PCU_CR_C2_DDR_TT_PCU_DDR_TIMER_VALUE_MSK (0x00001FFF)
+ #define PCU_CR_C2_DDR_TT_PCU_DDR_TIMER_VALUE_MAX (0x00001FFF)
+ #define PCU_CR_C2_DDR_TT_PCU_DDR_TIMER_VALUE_DEF (0x000001F4)
+
+#define PCU_CR_PCIE_ILTR_OVRD_PCU_REG (0x00005D30)
+ #define PCU_CR_PCIE_ILTR_OVRD_PCU_NSTL_OFF ( 0)
+ #define PCU_CR_PCIE_ILTR_OVRD_PCU_NSTL_WID (10)
+ #define PCU_CR_PCIE_ILTR_OVRD_PCU_NSTL_MSK (0x000003FF)
+ #define PCU_CR_PCIE_ILTR_OVRD_PCU_NSTL_MAX (0x000003FF)
+ #define PCU_CR_PCIE_ILTR_OVRD_PCU_NSTL_DEF (0x00000000)
+ #define PCU_CR_PCIE_ILTR_OVRD_PCU_MULTIPLIER_OFF (10)
+ #define PCU_CR_PCIE_ILTR_OVRD_PCU_MULTIPLIER_WID ( 3)
+ #define PCU_CR_PCIE_ILTR_OVRD_PCU_MULTIPLIER_MSK (0x00001C00)
+ #define PCU_CR_PCIE_ILTR_OVRD_PCU_MULTIPLIER_MAX (0x00000007)
+ #define PCU_CR_PCIE_ILTR_OVRD_PCU_MULTIPLIER_DEF (0x00000000)
+ #define PCU_CR_PCIE_ILTR_OVRD_PCU_FORCE_NL_OFF (14)
+ #define PCU_CR_PCIE_ILTR_OVRD_PCU_FORCE_NL_WID ( 1)
+ #define PCU_CR_PCIE_ILTR_OVRD_PCU_FORCE_NL_MSK (0x00004000)
+ #define PCU_CR_PCIE_ILTR_OVRD_PCU_FORCE_NL_MAX (0x00000001)
+ #define PCU_CR_PCIE_ILTR_OVRD_PCU_FORCE_NL_DEF (0x00000000)
+ #define PCU_CR_PCIE_ILTR_OVRD_PCU_NL_V_OFF (15)
+ #define PCU_CR_PCIE_ILTR_OVRD_PCU_NL_V_WID ( 1)
+ #define PCU_CR_PCIE_ILTR_OVRD_PCU_NL_V_MSK (0x00008000)
+ #define PCU_CR_PCIE_ILTR_OVRD_PCU_NL_V_MAX (0x00000001)
+ #define PCU_CR_PCIE_ILTR_OVRD_PCU_NL_V_DEF (0x00000000)
+ #define PCU_CR_PCIE_ILTR_OVRD_PCU_SXL_OFF (16)
+ #define PCU_CR_PCIE_ILTR_OVRD_PCU_SXL_WID (10)
+ #define PCU_CR_PCIE_ILTR_OVRD_PCU_SXL_MSK (0x03FF0000)
+ #define PCU_CR_PCIE_ILTR_OVRD_PCU_SXL_MAX (0x000003FF)
+ #define PCU_CR_PCIE_ILTR_OVRD_PCU_SXL_DEF (0x00000000)
+ #define PCU_CR_PCIE_ILTR_OVRD_PCU_SXLM_OFF (26)
+ #define PCU_CR_PCIE_ILTR_OVRD_PCU_SXLM_WID ( 3)
+ #define PCU_CR_PCIE_ILTR_OVRD_PCU_SXLM_MSK (0x1C000000)
+ #define PCU_CR_PCIE_ILTR_OVRD_PCU_SXLM_MAX (0x00000007)
+ #define PCU_CR_PCIE_ILTR_OVRD_PCU_SXLM_DEF (0x00000000)
+ #define PCU_CR_PCIE_ILTR_OVRD_PCU_FORCE_SXL_OFF (30)
+ #define PCU_CR_PCIE_ILTR_OVRD_PCU_FORCE_SXL_WID ( 1)
+ #define PCU_CR_PCIE_ILTR_OVRD_PCU_FORCE_SXL_MSK (0x40000000)
+ #define PCU_CR_PCIE_ILTR_OVRD_PCU_FORCE_SXL_MAX (0x00000001)
+ #define PCU_CR_PCIE_ILTR_OVRD_PCU_FORCE_SXL_DEF (0x00000000)
+ #define PCU_CR_PCIE_ILTR_OVRD_PCU_SXL_V_OFF (31)
+ #define PCU_CR_PCIE_ILTR_OVRD_PCU_SXL_V_WID ( 1)
+ #define PCU_CR_PCIE_ILTR_OVRD_PCU_SXL_V_MSK (0x80000000)
+ #define PCU_CR_PCIE_ILTR_OVRD_PCU_SXL_V_MAX (0x00000001)
+ #define PCU_CR_PCIE_ILTR_OVRD_PCU_SXL_V_DEF (0x00000000)
+
+#define PCU_CR_PCIE_ILTR_VAL_PCU_0_REG (0x00005D34)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_0_NL_VALUE_OFF ( 0)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_0_NL_VALUE_WID (10)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_0_NL_VALUE_MSK (0x000003FF)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_0_NL_VALUE_MAX (0x000003FF)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_0_NL_VALUE_DEF (0x00000000)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_0_NL_SCALE_OFF (10)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_0_NL_SCALE_WID ( 3)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_0_NL_SCALE_MSK (0x00001C00)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_0_NL_SCALE_MAX (0x00000007)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_0_NL_SCALE_DEF (0x00000000)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_0_NL_RESERVED_OFF (13)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_0_NL_RESERVED_WID ( 2)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_0_NL_RESERVED_MSK (0x00006000)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_0_NL_RESERVED_MAX (0x00000003)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_0_NL_RESERVED_DEF (0x00000000)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_0_NL_VALID_OFF (15)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_0_NL_VALID_WID ( 1)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_0_NL_VALID_MSK (0x00008000)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_0_NL_VALID_MAX (0x00000001)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_0_NL_VALID_DEF (0x00000000)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_0_SXL_VALUE_OFF (16)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_0_SXL_VALUE_WID (10)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_0_SXL_VALUE_MSK (0x03FF0000)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_0_SXL_VALUE_MAX (0x000003FF)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_0_SXL_VALUE_DEF (0x00000000)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_0_SXL_SCALE_OFF (26)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_0_SXL_SCALE_WID ( 3)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_0_SXL_SCALE_MSK (0x1C000000)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_0_SXL_SCALE_MAX (0x00000007)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_0_SXL_SCALE_DEF (0x00000000)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_0_SXL_RESERVED_OFF (29)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_0_SXL_RESERVED_WID ( 2)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_0_SXL_RESERVED_MSK (0x60000000)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_0_SXL_RESERVED_MAX (0x00000003)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_0_SXL_RESERVED_DEF (0x00000000)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_0_SXL_VALID_OFF (31)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_0_SXL_VALID_WID ( 1)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_0_SXL_VALID_MSK (0x80000000)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_0_SXL_VALID_MAX (0x00000001)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_0_SXL_VALID_DEF (0x00000000)
+
+#define PCU_CR_PCIE_ILTR_VAL_PCU_1_REG (0x00005D38)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_1_NL_VALUE_OFF ( 0)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_1_NL_VALUE_WID (10)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_1_NL_VALUE_MSK (0x000003FF)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_1_NL_VALUE_MAX (0x000003FF)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_1_NL_VALUE_DEF (0x00000000)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_1_NL_SCALE_OFF (10)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_1_NL_SCALE_WID ( 3)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_1_NL_SCALE_MSK (0x00001C00)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_1_NL_SCALE_MAX (0x00000007)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_1_NL_SCALE_DEF (0x00000000)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_1_NL_RESERVED_OFF (13)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_1_NL_RESERVED_WID ( 2)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_1_NL_RESERVED_MSK (0x00006000)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_1_NL_RESERVED_MAX (0x00000003)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_1_NL_RESERVED_DEF (0x00000000)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_1_NL_VALID_OFF (15)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_1_NL_VALID_WID ( 1)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_1_NL_VALID_MSK (0x00008000)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_1_NL_VALID_MAX (0x00000001)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_1_NL_VALID_DEF (0x00000000)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_1_SXL_VALUE_OFF (16)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_1_SXL_VALUE_WID (10)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_1_SXL_VALUE_MSK (0x03FF0000)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_1_SXL_VALUE_MAX (0x000003FF)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_1_SXL_VALUE_DEF (0x00000000)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_1_SXL_SCALE_OFF (26)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_1_SXL_SCALE_WID ( 3)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_1_SXL_SCALE_MSK (0x1C000000)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_1_SXL_SCALE_MAX (0x00000007)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_1_SXL_SCALE_DEF (0x00000000)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_1_SXL_RESERVED_OFF (29)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_1_SXL_RESERVED_WID ( 2)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_1_SXL_RESERVED_MSK (0x60000000)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_1_SXL_RESERVED_MAX (0x00000003)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_1_SXL_RESERVED_DEF (0x00000000)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_1_SXL_VALID_OFF (31)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_1_SXL_VALID_WID ( 1)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_1_SXL_VALID_MSK (0x80000000)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_1_SXL_VALID_MAX (0x00000001)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_1_SXL_VALID_DEF (0x00000000)
+
+#define PCU_CR_PCIE_ILTR_VAL_PCU_2_REG (0x00005D3C)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_2_NL_VALUE_OFF ( 0)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_2_NL_VALUE_WID (10)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_2_NL_VALUE_MSK (0x000003FF)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_2_NL_VALUE_MAX (0x000003FF)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_2_NL_VALUE_DEF (0x00000000)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_2_NL_SCALE_OFF (10)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_2_NL_SCALE_WID ( 3)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_2_NL_SCALE_MSK (0x00001C00)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_2_NL_SCALE_MAX (0x00000007)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_2_NL_SCALE_DEF (0x00000000)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_2_NL_RESERVED_OFF (13)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_2_NL_RESERVED_WID ( 2)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_2_NL_RESERVED_MSK (0x00006000)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_2_NL_RESERVED_MAX (0x00000003)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_2_NL_RESERVED_DEF (0x00000000)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_2_NL_VALID_OFF (15)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_2_NL_VALID_WID ( 1)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_2_NL_VALID_MSK (0x00008000)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_2_NL_VALID_MAX (0x00000001)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_2_NL_VALID_DEF (0x00000000)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_2_SXL_VALUE_OFF (16)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_2_SXL_VALUE_WID (10)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_2_SXL_VALUE_MSK (0x03FF0000)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_2_SXL_VALUE_MAX (0x000003FF)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_2_SXL_VALUE_DEF (0x00000000)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_2_SXL_SCALE_OFF (26)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_2_SXL_SCALE_WID ( 3)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_2_SXL_SCALE_MSK (0x1C000000)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_2_SXL_SCALE_MAX (0x00000007)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_2_SXL_SCALE_DEF (0x00000000)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_2_SXL_RESERVED_OFF (29)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_2_SXL_RESERVED_WID ( 2)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_2_SXL_RESERVED_MSK (0x60000000)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_2_SXL_RESERVED_MAX (0x00000003)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_2_SXL_RESERVED_DEF (0x00000000)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_2_SXL_VALID_OFF (31)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_2_SXL_VALID_WID ( 1)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_2_SXL_VALID_MSK (0x80000000)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_2_SXL_VALID_MAX (0x00000001)
+ #define PCU_CR_PCIE_ILTR_VAL_PCU_2_SXL_VALID_DEF (0x00000000)
+
+#define PCU_CR_VISA_CTL_PTPCFSMS_PCU_REG (0x00005D40)
+ #define PCU_CR_VISA_CTL_PTPCFSMS_PCU_DATA_OFF ( 0)
+ #define PCU_CR_VISA_CTL_PTPCFSMS_PCU_DATA_WID (18)
+ #define PCU_CR_VISA_CTL_PTPCFSMS_PCU_DATA_MSK (0x0003FFFF)
+ #define PCU_CR_VISA_CTL_PTPCFSMS_PCU_DATA_MAX (0x0003FFFF)
+ #define PCU_CR_VISA_CTL_PTPCFSMS_PCU_DATA_DEF (0x00000000)
+ #define PCU_CR_VISA_CTL_PTPCFSMS_PCU_VORANGE_OFF (31)
+ #define PCU_CR_VISA_CTL_PTPCFSMS_PCU_VORANGE_WID ( 1)
+ #define PCU_CR_VISA_CTL_PTPCFSMS_PCU_VORANGE_MSK (0x80000000)
+ #define PCU_CR_VISA_CTL_PTPCFSMS_PCU_VORANGE_MAX (0x00000001)
+ #define PCU_CR_VISA_CTL_PTPCFSMS_PCU_VORANGE_DEF (0x00000000)
+
+#define PCU_CR_VISA_XBAR_PTPCFSMS_PCU_REG (0x00005D44)
+ #define PCU_CR_VISA_XBAR_PTPCFSMS_PCU_DATA_OFF ( 0)
+ #define PCU_CR_VISA_XBAR_PTPCFSMS_PCU_DATA_WID (32)
+ #define PCU_CR_VISA_XBAR_PTPCFSMS_PCU_DATA_MSK (0xFFFFFFFF)
+ #define PCU_CR_VISA_XBAR_PTPCFSMS_PCU_DATA_MAX (0xFFFFFFFF)
+ #define PCU_CR_VISA_XBAR_PTPCFSMS_PCU_DATA_DEF (0x76543210)
+
+#define PCU_CR_VISA_CTL_PTPCIOREGS_PCU_REG (0x00005D48)
+ #define PCU_CR_VISA_CTL_PTPCIOREGS_PCU_DATA_OFF ( 0)
+ #define PCU_CR_VISA_CTL_PTPCIOREGS_PCU_DATA_WID (18)
+ #define PCU_CR_VISA_CTL_PTPCIOREGS_PCU_DATA_MSK (0x0003FFFF)
+ #define PCU_CR_VISA_CTL_PTPCIOREGS_PCU_DATA_MAX (0x0003FFFF)
+ #define PCU_CR_VISA_CTL_PTPCIOREGS_PCU_DATA_DEF (0x00000000)
+ #define PCU_CR_VISA_CTL_PTPCIOREGS_PCU_VORANGE_OFF (31)
+ #define PCU_CR_VISA_CTL_PTPCIOREGS_PCU_VORANGE_WID ( 1)
+ #define PCU_CR_VISA_CTL_PTPCIOREGS_PCU_VORANGE_MSK (0x80000000)
+ #define PCU_CR_VISA_CTL_PTPCIOREGS_PCU_VORANGE_MAX (0x00000001)
+ #define PCU_CR_VISA_CTL_PTPCIOREGS_PCU_VORANGE_DEF (0x00000000)
+
+#define PCU_CR_BIOS_MAILBOX_DATA_PCU_REG (0x00005DA0)
+ #define PCU_CR_BIOS_MAILBOX_DATA_PCU_DATA_OFF ( 0)
+ #define PCU_CR_BIOS_MAILBOX_DATA_PCU_DATA_WID (32)
+ #define PCU_CR_BIOS_MAILBOX_DATA_PCU_DATA_MSK (0xFFFFFFFF)
+ #define PCU_CR_BIOS_MAILBOX_DATA_PCU_DATA_MAX (0xFFFFFFFF)
+ #define PCU_CR_BIOS_MAILBOX_DATA_PCU_DATA_DEF (0x00000000)
+
+#define PCU_CR_BIOS_MAILBOX_INTERFACE_PCU_REG (0x00005DA4)
+ #define PCU_CR_BIOS_MAILBOX_INTERFACE_PCU_COMMAND_OFF ( 0)
+ #define PCU_CR_BIOS_MAILBOX_INTERFACE_PCU_COMMAND_WID ( 8)
+ #define PCU_CR_BIOS_MAILBOX_INTERFACE_PCU_COMMAND_MSK (0x000000FF)
+ #define PCU_CR_BIOS_MAILBOX_INTERFACE_PCU_COMMAND_MAX (0x000000FF)
+ #define PCU_CR_BIOS_MAILBOX_INTERFACE_PCU_COMMAND_DEF (0x00000000)
+ #define PCU_CR_BIOS_MAILBOX_INTERFACE_PCU_ADDR_OFF ( 8)
+ #define PCU_CR_BIOS_MAILBOX_INTERFACE_PCU_ADDR_WID (21)
+ #define PCU_CR_BIOS_MAILBOX_INTERFACE_PCU_ADDR_MSK (0x1FFFFF00)
+ #define PCU_CR_BIOS_MAILBOX_INTERFACE_PCU_ADDR_MAX (0x001FFFFF)
+ #define PCU_CR_BIOS_MAILBOX_INTERFACE_PCU_ADDR_DEF (0x00000000)
+ #define PCU_CR_BIOS_MAILBOX_INTERFACE_PCU_RUN_BUSY_OFF (31)
+ #define PCU_CR_BIOS_MAILBOX_INTERFACE_PCU_RUN_BUSY_WID ( 1)
+ #define PCU_CR_BIOS_MAILBOX_INTERFACE_PCU_RUN_BUSY_MSK (0x80000000)
+ #define PCU_CR_BIOS_MAILBOX_INTERFACE_PCU_RUN_BUSY_MAX (0x00000001)
+ #define PCU_CR_BIOS_MAILBOX_INTERFACE_PCU_RUN_BUSY_DEF (0x00000000)
+
+#define PCU_CR_BIOS_RESET_CPL_PCU_REG (0x00005DA8)
+ #define PCU_CR_BIOS_RESET_CPL_PCU_RST_CPL_OFF ( 0)
+ #define PCU_CR_BIOS_RESET_CPL_PCU_RST_CPL_WID ( 1)
+ #define PCU_CR_BIOS_RESET_CPL_PCU_RST_CPL_MSK (0x00000001)
+ #define PCU_CR_BIOS_RESET_CPL_PCU_RST_CPL_MAX (0x00000001)
+ #define PCU_CR_BIOS_RESET_CPL_PCU_RST_CPL_DEF (0x00000000)
+ #define PCU_CR_BIOS_RESET_CPL_PCU_PCIE_ENUMERATION_DONE_OFF ( 1)
+ #define PCU_CR_BIOS_RESET_CPL_PCU_PCIE_ENUMERATION_DONE_WID ( 1)
+ #define PCU_CR_BIOS_RESET_CPL_PCU_PCIE_ENUMERATION_DONE_MSK (0x00000002)
+ #define PCU_CR_BIOS_RESET_CPL_PCU_PCIE_ENUMERATION_DONE_MAX (0x00000001)
+ #define PCU_CR_BIOS_RESET_CPL_PCU_PCIE_ENUMERATION_DONE_DEF (0x00000000)
+ #define PCU_CR_BIOS_RESET_CPL_PCU_C7_ALLOWED_OFF ( 2)
+ #define PCU_CR_BIOS_RESET_CPL_PCU_C7_ALLOWED_WID ( 1)
+ #define PCU_CR_BIOS_RESET_CPL_PCU_C7_ALLOWED_MSK (0x00000004)
+ #define PCU_CR_BIOS_RESET_CPL_PCU_C7_ALLOWED_MAX (0x00000001)
+ #define PCU_CR_BIOS_RESET_CPL_PCU_C7_ALLOWED_DEF (0x00000000)
+
+#define PCU_CR_MC_BIOS_REQ_PCU_REG (0x00005E00)
+ #define PCU_CR_MC_BIOS_REQ_PCU_REQ_DATA_OFF ( 0)
+ #define PCU_CR_MC_BIOS_REQ_PCU_REQ_DATA_WID ( 4)
+ #define PCU_CR_MC_BIOS_REQ_PCU_REQ_DATA_MSK (0x0000000F)
+ #define PCU_CR_MC_BIOS_REQ_PCU_REQ_DATA_MAX (0x0000000F)
+ #define PCU_CR_MC_BIOS_REQ_PCU_REQ_DATA_DEF (0x00000000)
+ #define PCU_CR_MC_BIOS_REQ_PCU_REQ_TYPE_OFF ( 4)
+ #define PCU_CR_MC_BIOS_REQ_PCU_REQ_TYPE_WID ( 4)
+ #define PCU_CR_MC_BIOS_REQ_PCU_REQ_TYPE_MSK (0x000000F0)
+ #define PCU_CR_MC_BIOS_REQ_PCU_REQ_TYPE_MAX (0x0000000F)
+ #define PCU_CR_MC_BIOS_REQ_PCU_REQ_TYPE_DEF (0x00000000)
+ #define PCU_CR_MC_BIOS_REQ_PCU_RUN_BUSY_OFF (31)
+ #define PCU_CR_MC_BIOS_REQ_PCU_RUN_BUSY_WID ( 1)
+ #define PCU_CR_MC_BIOS_REQ_PCU_RUN_BUSY_MSK (0x80000000)
+ #define PCU_CR_MC_BIOS_REQ_PCU_RUN_BUSY_MAX (0x00000001)
+ #define PCU_CR_MC_BIOS_REQ_PCU_RUN_BUSY_DEF (0x00000000)
+
+#define PCU_CR_MC_BIOS_DATA_PCU_REG (0x00005E04)
+ #define PCU_CR_MC_BIOS_DATA_PCU_MC_FREQ_OFF ( 0)
+ #define PCU_CR_MC_BIOS_DATA_PCU_MC_FREQ_WID ( 4)
+ #define PCU_CR_MC_BIOS_DATA_PCU_MC_FREQ_MSK (0x0000000F)
+ #define PCU_CR_MC_BIOS_DATA_PCU_MC_FREQ_MAX (0x0000000F)
+ #define PCU_CR_MC_BIOS_DATA_PCU_MC_FREQ_DEF (0x00000000)
+
+#define PCU_CR_SAPMCTL_PCU_REG (0x00005F00)
+ #define PCU_CR_SAPMCTL_PCU_SACG_ENA_OFF ( 0)
+ #define PCU_CR_SAPMCTL_PCU_SACG_ENA_WID ( 1)
+ #define PCU_CR_SAPMCTL_PCU_SACG_ENA_MSK (0x00000001)
+ #define PCU_CR_SAPMCTL_PCU_SACG_ENA_MAX (0x00000001)
+ #define PCU_CR_SAPMCTL_PCU_SACG_ENA_DEF (0x00000000)
+ #define PCU_CR_SAPMCTL_PCU_MPLL_OFF_ENA_OFF ( 1)
+ #define PCU_CR_SAPMCTL_PCU_MPLL_OFF_ENA_WID ( 1)
+ #define PCU_CR_SAPMCTL_PCU_MPLL_OFF_ENA_MSK (0x00000002)
+ #define PCU_CR_SAPMCTL_PCU_MPLL_OFF_ENA_MAX (0x00000001)
+ #define PCU_CR_SAPMCTL_PCU_MPLL_OFF_ENA_DEF (0x00000001)
+ #define PCU_CR_SAPMCTL_PCU_PPLL_OFF_ENA_OFF ( 2)
+ #define PCU_CR_SAPMCTL_PCU_PPLL_OFF_ENA_WID ( 1)
+ #define PCU_CR_SAPMCTL_PCU_PPLL_OFF_ENA_MSK (0x00000004)
+ #define PCU_CR_SAPMCTL_PCU_PPLL_OFF_ENA_MAX (0x00000001)
+ #define PCU_CR_SAPMCTL_PCU_PPLL_OFF_ENA_DEF (0x00000001)
+ #define PCU_CR_SAPMCTL_PCU_SACG_SEN_OFF ( 8)
+ #define PCU_CR_SAPMCTL_PCU_SACG_SEN_WID ( 1)
+ #define PCU_CR_SAPMCTL_PCU_SACG_SEN_MSK (0x00000100)
+ #define PCU_CR_SAPMCTL_PCU_SACG_SEN_MAX (0x00000001)
+ #define PCU_CR_SAPMCTL_PCU_SACG_SEN_DEF (0x00000001)
+ #define PCU_CR_SAPMCTL_PCU_MPLL_OFF_SEN_OFF ( 9)
+ #define PCU_CR_SAPMCTL_PCU_MPLL_OFF_SEN_WID ( 1)
+ #define PCU_CR_SAPMCTL_PCU_MPLL_OFF_SEN_MSK (0x00000200)
+ #define PCU_CR_SAPMCTL_PCU_MPLL_OFF_SEN_MAX (0x00000001)
+ #define PCU_CR_SAPMCTL_PCU_MPLL_OFF_SEN_DEF (0x00000000)
+ #define PCU_CR_SAPMCTL_PCU_MDLL_OFF_SEN_OFF (10)
+ #define PCU_CR_SAPMCTL_PCU_MDLL_OFF_SEN_WID ( 1)
+ #define PCU_CR_SAPMCTL_PCU_MDLL_OFF_SEN_MSK (0x00000400)
+ #define PCU_CR_SAPMCTL_PCU_MDLL_OFF_SEN_MAX (0x00000001)
+ #define PCU_CR_SAPMCTL_PCU_MDLL_OFF_SEN_DEF (0x00000000)
+ #define PCU_CR_SAPMCTL_PCU_SACG_SREXIT_OFF (11)
+ #define PCU_CR_SAPMCTL_PCU_SACG_SREXIT_WID ( 1)
+ #define PCU_CR_SAPMCTL_PCU_SACG_SREXIT_MSK (0x00000800)
+ #define PCU_CR_SAPMCTL_PCU_SACG_SREXIT_MAX (0x00000001)
+ #define PCU_CR_SAPMCTL_PCU_SACG_SREXIT_DEF (0x00000000)
+ #define PCU_CR_SAPMCTL_PCU_NSWAKE_SREXIT_OFF (12)
+ #define PCU_CR_SAPMCTL_PCU_NSWAKE_SREXIT_WID ( 1)
+ #define PCU_CR_SAPMCTL_PCU_NSWAKE_SREXIT_MSK (0x00001000)
+ #define PCU_CR_SAPMCTL_PCU_NSWAKE_SREXIT_MAX (0x00000001)
+ #define PCU_CR_SAPMCTL_PCU_NSWAKE_SREXIT_DEF (0x00000000)
+ #define PCU_CR_SAPMCTL_PCU_SACG_MPLL_OFF (13)
+ #define PCU_CR_SAPMCTL_PCU_SACG_MPLL_WID ( 1)
+ #define PCU_CR_SAPMCTL_PCU_SACG_MPLL_MSK (0x00002000)
+ #define PCU_CR_SAPMCTL_PCU_SACG_MPLL_MAX (0x00000001)
+ #define PCU_CR_SAPMCTL_PCU_SACG_MPLL_DEF (0x00000001)
+ #define PCU_CR_SAPMCTL_PCU_MPLL_ON_DE_OFF (14)
+ #define PCU_CR_SAPMCTL_PCU_MPLL_ON_DE_WID ( 1)
+ #define PCU_CR_SAPMCTL_PCU_MPLL_ON_DE_MSK (0x00004000)
+ #define PCU_CR_SAPMCTL_PCU_MPLL_ON_DE_MAX (0x00000001)
+ #define PCU_CR_SAPMCTL_PCU_MPLL_ON_DE_DEF (0x00000000)
+ #define PCU_CR_SAPMCTL_PCU_MDLL_ON_DE_OFF (15)
+ #define PCU_CR_SAPMCTL_PCU_MDLL_ON_DE_WID ( 1)
+ #define PCU_CR_SAPMCTL_PCU_MDLL_ON_DE_MSK (0x00008000)
+ #define PCU_CR_SAPMCTL_PCU_MDLL_ON_DE_MAX (0x00000001)
+ #define PCU_CR_SAPMCTL_PCU_MDLL_ON_DE_DEF (0x00000000)
+
+#define PCU_CR_P_COMP_PCU_REG (0x00005F04)
+ #define PCU_CR_P_COMP_PCU_COMP_DISABLE_OFF ( 0)
+ #define PCU_CR_P_COMP_PCU_COMP_DISABLE_WID ( 1)
+ #define PCU_CR_P_COMP_PCU_COMP_DISABLE_MSK (0x00000001)
+ #define PCU_CR_P_COMP_PCU_COMP_DISABLE_MAX (0x00000001)
+ #define PCU_CR_P_COMP_PCU_COMP_DISABLE_DEF (0x00000000)
+ #define PCU_CR_P_COMP_PCU_COMP_INTERVAL_OFF ( 1)
+ #define PCU_CR_P_COMP_PCU_COMP_INTERVAL_WID ( 4)
+ #define PCU_CR_P_COMP_PCU_COMP_INTERVAL_MSK (0x0000001E)
+ #define PCU_CR_P_COMP_PCU_COMP_INTERVAL_MAX (0x0000000F)
+ #define PCU_CR_P_COMP_PCU_COMP_INTERVAL_DEF (0x00000008)
+ #define PCU_CR_P_COMP_PCU_COMP_FORCE_OFF ( 8)
+ #define PCU_CR_P_COMP_PCU_COMP_FORCE_WID ( 1)
+ #define PCU_CR_P_COMP_PCU_COMP_FORCE_MSK (0x00000100)
+ #define PCU_CR_P_COMP_PCU_COMP_FORCE_MAX (0x00000001)
+ #define PCU_CR_P_COMP_PCU_COMP_FORCE_DEF (0x00000000)
+
+#define PCU_CR_M_COMP_PCU_REG (0x00005F08)
+ #define PCU_CR_M_COMP_PCU_COMP_DISABLE_OFF ( 0)
+ #define PCU_CR_M_COMP_PCU_COMP_DISABLE_WID ( 1)
+ #define PCU_CR_M_COMP_PCU_COMP_DISABLE_MSK (0x00000001)
+ #define PCU_CR_M_COMP_PCU_COMP_DISABLE_MAX (0x00000001)
+ #define PCU_CR_M_COMP_PCU_COMP_DISABLE_DEF (0x00000000)
+ #define PCU_CR_M_COMP_PCU_COMP_INTERVAL_OFF ( 1)
+ #define PCU_CR_M_COMP_PCU_COMP_INTERVAL_WID ( 4)
+ #define PCU_CR_M_COMP_PCU_COMP_INTERVAL_MSK (0x0000001E)
+ #define PCU_CR_M_COMP_PCU_COMP_INTERVAL_MAX (0x0000000F)
+ #define PCU_CR_M_COMP_PCU_COMP_INTERVAL_DEF (0x0000000D)
+ #define PCU_CR_M_COMP_PCU_COMP_FORCE_OFF ( 8)
+ #define PCU_CR_M_COMP_PCU_COMP_FORCE_WID ( 1)
+ #define PCU_CR_M_COMP_PCU_COMP_FORCE_MSK (0x00000100)
+ #define PCU_CR_M_COMP_PCU_COMP_FORCE_MAX (0x00000001)
+ #define PCU_CR_M_COMP_PCU_COMP_FORCE_DEF (0x00000000)
+
+#define PCU_CR_D_COMP_PCU_REG (0x00005F0C)
+ #define PCU_CR_D_COMP_PCU_COMP_DISABLE_OFF ( 0)
+ #define PCU_CR_D_COMP_PCU_COMP_DISABLE_WID ( 1)
+ #define PCU_CR_D_COMP_PCU_COMP_DISABLE_MSK (0x00000001)
+ #define PCU_CR_D_COMP_PCU_COMP_DISABLE_MAX (0x00000001)
+ #define PCU_CR_D_COMP_PCU_COMP_DISABLE_DEF (0x00000000)
+ #define PCU_CR_D_COMP_PCU_COMP_INTERVAL_OFF ( 1)
+ #define PCU_CR_D_COMP_PCU_COMP_INTERVAL_WID ( 4)
+ #define PCU_CR_D_COMP_PCU_COMP_INTERVAL_MSK (0x0000001E)
+ #define PCU_CR_D_COMP_PCU_COMP_INTERVAL_MAX (0x0000000F)
+ #define PCU_CR_D_COMP_PCU_COMP_INTERVAL_DEF (0x00000008)
+ #define PCU_CR_D_COMP_PCU_COMP_FORCE_OFF ( 8)
+ #define PCU_CR_D_COMP_PCU_COMP_FORCE_WID ( 1)
+ #define PCU_CR_D_COMP_PCU_COMP_FORCE_MSK (0x00000100)
+ #define PCU_CR_D_COMP_PCU_COMP_FORCE_MAX (0x00000001)
+ #define PCU_CR_D_COMP_PCU_COMP_FORCE_DEF (0x00000000)
+
+#define PCU_CR_CONFIG_TDP_NOMINAL_PCU_REG (0x00005F3C)
+ #define PCU_CR_CONFIG_TDP_NOMINAL_PCU_TDP_RATIO_OFF ( 0)
+ #define PCU_CR_CONFIG_TDP_NOMINAL_PCU_TDP_RATIO_WID ( 8)
+ #define PCU_CR_CONFIG_TDP_NOMINAL_PCU_TDP_RATIO_MSK (0x000000FF)
+ #define PCU_CR_CONFIG_TDP_NOMINAL_PCU_TDP_RATIO_MAX (0x000000FF)
+ #define PCU_CR_CONFIG_TDP_NOMINAL_PCU_TDP_RATIO_DEF (0x00000000)
+
+#define PCU_CR_CONFIG_TDP_LEVEL1_PCU_REG (0x00005F40)
+ #define PCU_CR_CONFIG_TDP_LEVEL1_PCU_PKG_TDP_OFF ( 0)
+ #define PCU_CR_CONFIG_TDP_LEVEL1_PCU_PKG_TDP_WID (15)
+ #define PCU_CR_CONFIG_TDP_LEVEL1_PCU_PKG_TDP_MSK (0x00007FFF)
+ #define PCU_CR_CONFIG_TDP_LEVEL1_PCU_PKG_TDP_MAX (0x00007FFF)
+ #define PCU_CR_CONFIG_TDP_LEVEL1_PCU_PKG_TDP_DEF (0x00000000)
+ #define PCU_CR_CONFIG_TDP_LEVEL1_PCU_TDP_RATIO_OFF (16)
+ #define PCU_CR_CONFIG_TDP_LEVEL1_PCU_TDP_RATIO_WID ( 8)
+ #define PCU_CR_CONFIG_TDP_LEVEL1_PCU_TDP_RATIO_MSK (0x00FF0000)
+ #define PCU_CR_CONFIG_TDP_LEVEL1_PCU_TDP_RATIO_MAX (0x000000FF)
+ #define PCU_CR_CONFIG_TDP_LEVEL1_PCU_TDP_RATIO_DEF (0x00000000)
+ #define PCU_CR_CONFIG_TDP_LEVEL1_PCU_PKG_MAX_PWR_OFF (32)
+ #define PCU_CR_CONFIG_TDP_LEVEL1_PCU_PKG_MAX_PWR_WID (15)
+ #define PCU_CR_CONFIG_TDP_LEVEL1_PCU_PKG_MAX_PWR_MSK (0x7FFF00000000)
+ #define PCU_CR_CONFIG_TDP_LEVEL1_PCU_PKG_MAX_PWR_MAX (0x00007FFF)
+ #define PCU_CR_CONFIG_TDP_LEVEL1_PCU_PKG_MAX_PWR_DEF (0x00000000)
+ #define PCU_CR_CONFIG_TDP_LEVEL1_PCU_PKG_MIN_PWR_OFF (47)
+ #define PCU_CR_CONFIG_TDP_LEVEL1_PCU_PKG_MIN_PWR_WID (16)
+ #define PCU_CR_CONFIG_TDP_LEVEL1_PCU_PKG_MIN_PWR_MSK (0x7FFF800000000000)
+ #define PCU_CR_CONFIG_TDP_LEVEL1_PCU_PKG_MIN_PWR_MAX (0x0000FFFF)
+ #define PCU_CR_CONFIG_TDP_LEVEL1_PCU_PKG_MIN_PWR_DEF (0x00000000)
+
+#define PCU_CR_CONFIG_TDP_LEVEL2_PCU_REG (0x00005F48)
+ #define PCU_CR_CONFIG_TDP_LEVEL2_PCU_PKG_TDP_OFF ( 0)
+ #define PCU_CR_CONFIG_TDP_LEVEL2_PCU_PKG_TDP_WID (15)
+ #define PCU_CR_CONFIG_TDP_LEVEL2_PCU_PKG_TDP_MSK (0x00007FFF)
+ #define PCU_CR_CONFIG_TDP_LEVEL2_PCU_PKG_TDP_MAX (0x00007FFF)
+ #define PCU_CR_CONFIG_TDP_LEVEL2_PCU_PKG_TDP_DEF (0x00000000)
+ #define PCU_CR_CONFIG_TDP_LEVEL2_PCU_TDP_RATIO_OFF (16)
+ #define PCU_CR_CONFIG_TDP_LEVEL2_PCU_TDP_RATIO_WID ( 8)
+ #define PCU_CR_CONFIG_TDP_LEVEL2_PCU_TDP_RATIO_MSK (0x00FF0000)
+ #define PCU_CR_CONFIG_TDP_LEVEL2_PCU_TDP_RATIO_MAX (0x000000FF)
+ #define PCU_CR_CONFIG_TDP_LEVEL2_PCU_TDP_RATIO_DEF (0x00000000)
+ #define PCU_CR_CONFIG_TDP_LEVEL2_PCU_PKG_MAX_PWR_OFF (32)
+ #define PCU_CR_CONFIG_TDP_LEVEL2_PCU_PKG_MAX_PWR_WID (15)
+ #define PCU_CR_CONFIG_TDP_LEVEL2_PCU_PKG_MAX_PWR_MSK (0x7FFF00000000)
+ #define PCU_CR_CONFIG_TDP_LEVEL2_PCU_PKG_MAX_PWR_MAX (0x00007FFF)
+ #define PCU_CR_CONFIG_TDP_LEVEL2_PCU_PKG_MAX_PWR_DEF (0x00000000)
+ #define PCU_CR_CONFIG_TDP_LEVEL2_PCU_PKG_MIN_PWR_OFF (47)
+ #define PCU_CR_CONFIG_TDP_LEVEL2_PCU_PKG_MIN_PWR_WID (16)
+ #define PCU_CR_CONFIG_TDP_LEVEL2_PCU_PKG_MIN_PWR_MSK (0x7FFF800000000000)
+ #define PCU_CR_CONFIG_TDP_LEVEL2_PCU_PKG_MIN_PWR_MAX (0x0000FFFF)
+ #define PCU_CR_CONFIG_TDP_LEVEL2_PCU_PKG_MIN_PWR_DEF (0x00000000)
+
+#define PCU_CR_CONFIG_TDP_CONTROL_PCU_REG (0x00005F50)
+ #define PCU_CR_CONFIG_TDP_CONTROL_PCU_TDP_LEVEL_OFF ( 0)
+ #define PCU_CR_CONFIG_TDP_CONTROL_PCU_TDP_LEVEL_WID ( 2)
+ #define PCU_CR_CONFIG_TDP_CONTROL_PCU_TDP_LEVEL_MSK (0x00000003)
+ #define PCU_CR_CONFIG_TDP_CONTROL_PCU_TDP_LEVEL_MAX (0x00000003)
+ #define PCU_CR_CONFIG_TDP_CONTROL_PCU_TDP_LEVEL_DEF (0x00000000)
+ #define PCU_CR_CONFIG_TDP_CONTROL_PCU_CONFIG_TDP_LOCK_OFF (31)
+ #define PCU_CR_CONFIG_TDP_CONTROL_PCU_CONFIG_TDP_LOCK_WID ( 1)
+ #define PCU_CR_CONFIG_TDP_CONTROL_PCU_CONFIG_TDP_LOCK_MSK (0x80000000)
+ #define PCU_CR_CONFIG_TDP_CONTROL_PCU_CONFIG_TDP_LOCK_MAX (0x00000001)
+ #define PCU_CR_CONFIG_TDP_CONTROL_PCU_CONFIG_TDP_LOCK_DEF (0x00000000)
+
+#define PCU_CR_TURBO_ACTIVATION_RATIO_PCU_REG (0x00005F54)
+ #define PCU_CR_TURBO_ACTIVATION_RATIO_PCU_MAX_NON_TURBO_RATIO_OFF ( 0)
+ #define PCU_CR_TURBO_ACTIVATION_RATIO_PCU_MAX_NON_TURBO_RATIO_WID ( 8)
+ #define PCU_CR_TURBO_ACTIVATION_RATIO_PCU_MAX_NON_TURBO_RATIO_MSK (0x000000FF)
+ #define PCU_CR_TURBO_ACTIVATION_RATIO_PCU_MAX_NON_TURBO_RATIO_MAX (0x000000FF)
+ #define PCU_CR_TURBO_ACTIVATION_RATIO_PCU_MAX_NON_TURBO_RATIO_DEF (0x00000000)
+ #define PCU_CR_TURBO_ACTIVATION_RATIO_PCU_TURBO_ACTIVATION_RATIO_LOCK_OFF (31)
+ #define PCU_CR_TURBO_ACTIVATION_RATIO_PCU_TURBO_ACTIVATION_RATIO_LOCK_WID ( 1)
+ #define PCU_CR_TURBO_ACTIVATION_RATIO_PCU_TURBO_ACTIVATION_RATIO_LOCK_MSK (0x80000000)
+ #define PCU_CR_TURBO_ACTIVATION_RATIO_PCU_TURBO_ACTIVATION_RATIO_LOCK_MAX (0x00000001)
+ #define PCU_CR_TURBO_ACTIVATION_RATIO_PCU_TURBO_ACTIVATION_RATIO_LOCK_DEF (0x00000000)
+
+#define DRNG_CR_VISA_CTL_DRNGCTLS_DRNG_REG (0x00006680)
+ #define DRNG_CR_VISA_CTL_DRNGCTLS_DRNG_DATA_OFF ( 0)
+ #define DRNG_CR_VISA_CTL_DRNGCTLS_DRNG_DATA_WID (18)
+ #define DRNG_CR_VISA_CTL_DRNGCTLS_DRNG_DATA_MSK (0x0003FFFF)
+ #define DRNG_CR_VISA_CTL_DRNGCTLS_DRNG_DATA_MAX (0x0003FFFF)
+ #define DRNG_CR_VISA_CTL_DRNGCTLS_DRNG_DATA_DEF (0x00000000)
+ #define DRNG_CR_VISA_CTL_DRNGCTLS_DRNG_VORANGE_OFF (31)
+ #define DRNG_CR_VISA_CTL_DRNGCTLS_DRNG_VORANGE_WID ( 1)
+ #define DRNG_CR_VISA_CTL_DRNGCTLS_DRNG_VORANGE_MSK (0x80000000)
+ #define DRNG_CR_VISA_CTL_DRNGCTLS_DRNG_VORANGE_MAX (0x00000001)
+ #define DRNG_CR_VISA_CTL_DRNGCTLS_DRNG_VORANGE_DEF (0x00000000)
+
+#pragma pack(pop)
+#endif // __Msa_h__
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/Pci000.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/Pci000.h
new file mode 100644
index 0000000..050187b
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/Pci000.h
@@ -0,0 +1,970 @@
+/*++ @file
+ PCI bus 0, device 0, function 0 register definitions
+
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+--*/
+
+#ifndef _Pci000_h_
+#define _Pci000_h_
+#pragma pack (push, 1)
+#include "MrcTypes.h"
+
+typedef union {
+ struct {
+ U32 Mchbaren : 1; /// Bits 0:0
+ U32 : 14; /// Bits 14:1
+ U32 Mchbar : 17; /// Bits 31:15
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MRC_PCI_000_MCHBAR_LOW_STRUCT;
+
+typedef union {
+ struct {
+ U32 Mchbar : 7; /// Bits 38:32
+ U32 : 25; /// Bits 63:39
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MRC_PCI_000_MCHBAR_HIGH_STRUCT;
+
+typedef union {
+ struct {
+ U64 Mchbaren : 1; /// Bits 0:0
+ U64 : 14; /// Bits 14:1
+ U64 Mchbar : 24; /// Bits 38:15
+ U64 : 25; /// Bits 63:39
+ } Bits;
+ U64 Data;
+ struct {
+ MRC_PCI_000_MCHBAR_LOW_STRUCT Low;
+ MRC_PCI_000_MCHBAR_HIGH_STRUCT High;
+ } Data32;
+} MRC_PCI_000_MCHBAR_STRUCT;
+
+#define MRC_PCI_000_MCHBAR_REG (0x48)
+ #define MCHBAR_MCHBAREN_OFF (0)
+ #define MCHBAR_MCHBAREN_WID (1)
+ #define MCHBAR_MCHBAREN_MSK (0x1)
+ #define MCHBAR_MCHBAREN_MAX (0x1)
+ #define MCHBAR_MCHBAREN_DEF (0x0)
+ #define MCHBAR_MCHBAR_OFF (15)
+ #define MCHBAR_MCHBAR_WID (24)
+ #define MCHBAR_MCHBAR_MSK (0x0000007FFFFF8000)
+ #define MCHBAR_MCHBAR_MAX (0xFFFFFF)
+ #define MCHBAR_MCHBAR_DEF (0x0)
+
+typedef union {
+ struct {
+ U32 Ggclck : 1; /// Bits 0:0
+ U32 Ivd : 1; /// Bits 1:1
+ U32 : 1; /// Bits 2:2
+ U32 Gms : 5; /// Bits 7:3
+ U32 Ggms : 2; /// Bits 9:8
+ U32 : 4; /// Bits 13:10
+ U32 Vamen : 1; /// Bits 14:14
+ U32 : 17; /// Bits 31:15
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MRC_PCI_000_GGC_STRUCT;
+
+#define MRC_PCI_000_GGC_REG (0x50)
+ #define GGC_GGCLCK_OFF (0)
+ #define GGC_GGCLCK_WID (1)
+ #define GGC_GGCLCK_MSK (0x1)
+ #define GGC_GGCLCK_MAX (0x1)
+ #define GGC_GGCLCK_DEF (0x0)
+ #define GGC_IVD_OFF (1)
+ #define GGC_IVD_WID (1)
+ #define GGC_IVD_MSK (0x2)
+ #define GGC_IVD_MAX (0x1)
+ #define GGC_IVD_DEF (0x0)
+ #define GGC_GMS_OFF (3)
+ #define GGC_GMS_WID (5)
+ #define GGC_GMS_MSK (0xF8)
+ #define GGC_GMS_MAX (0x1F)
+ #define GGC_GMS_DEF (0x5)
+ #define GGC_GGMS_OFF (8)
+ #define GGC_GGMS_WID (2)
+ #define GGC_GGMS_MSK (0x300)
+ #define GGC_GGMS_MAX (0x3)
+ #define GGC_GGMS_DEF (0x0)
+ #define GGC_VAMEN_OFF (0xe)
+ #define GGC_VAMEN_WID (0x1)
+ #define GGC_VAMEN_MSK (0x4000)
+ #define GGC_VAMEN_MAX (0x1)
+ #define GGC_VAMEN_DEF (0x0)
+
+typedef union {
+ struct {
+ U32 D0EN : 1; /// Bits 0:0
+ U32 D1F2EN : 1; /// Bits 1:1
+ U32 D1F1EN : 1; /// Bits 2:2
+ U32 D1F0EN : 1; /// Bits 3:3
+ U32 D2EN : 1; /// Bits 4:4
+ U32 D3EN : 1; /// Bits 5:5
+ U32 : 1; /// Bits 6:6
+ U32 D4EN : 1; /// Bits 7:7
+ U32 : 6; /// Bits 13:8
+ U32 D7EN : 1; /// Bits 14:14
+ U32 : 17; /// Bits 31:15
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MRC_PCI_000_DEVEN_STRUCT;
+
+#define MRC_PCI_000_DEVEN_REG (0x54)
+ #define DEVEN_D0EN_OFF (0)
+ #define DEVEN_D0EN_WID (1)
+ #define DEVEN_D0EN_MSK (0x1)
+ #define DEVEN_D0EN_MAX (0x1)
+ #define DEVEN_D0EN_DEF (0x1)
+ #define DEVEN_D1F2EN_OFF (1)
+ #define DEVEN_D1F2EN_WID (1)
+ #define DEVEN_D1F2EN_MSK (0x2)
+ #define DEVEN_D1F2EN_MAX (0x1)
+ #define DEVEN_D1F2EN_DEF (0x1)
+ #define DEVEN_D1F1EN_OFF (2)
+ #define DEVEN_D1F1EN_WID (1)
+ #define DEVEN_D1F1EN_MSK (0x4)
+ #define DEVEN_D1F1EN_MAX (0x1)
+ #define DEVEN_D1F1EN_DEF (0x1)
+ #define DEVEN_D1F0EN_OFF (3)
+ #define DEVEN_D1F0EN_WID (1)
+ #define DEVEN_D1F0EN_MSK (0x8)
+ #define DEVEN_D1F0EN_MAX (0x1)
+ #define DEVEN_D1F0EN_DEF (0x1)
+ #define DEVEN_D2EN_OFF (4)
+ #define DEVEN_D2EN_WID (1)
+ #define DEVEN_D2EN_MSK (0x10)
+ #define DEVEN_D2EN_MAX (0x1)
+ #define DEVEN_D2EN_DEF (0x1)
+ #define DEVEN_D3EN_OFF (5)
+ #define DEVEN_D3EN_WID (1)
+ #define DEVEN_D3EN_MSK (0x20)
+ #define DEVEN_D3EN_MAX (0x1)
+ #define DEVEN_D3EN_DEF (0x1)
+ #define DEVEN_D4EN_OFF (7)
+ #define DEVEN_D4EN_WID (1)
+ #define DEVEN_D4EN_MSK (0x80)
+ #define DEVEN_D4EN_MAX (0x1)
+ #define DEVEN_D4EN_DEF (0x1)
+ #define DEVEN_D7EN_OFF (14)
+ #define DEVEN_D7EN_WID (1)
+ #define DEVEN_D7EN_MSK (0x4000)
+ #define DEVEN_D7EN_MAX (0x1)
+ #define DEVEN_D7EN_DEF (0x0)
+
+typedef union {
+ struct {
+ U32 Pciexbaren : 1; /// Bits 0:0
+ U32 Length : 2; /// Bits 2:1
+ U32 : 23; /// Bits 25:3
+ U32 Admsk64 : 1; /// Bits 26:26
+ U32 Admsk128 : 1; /// Bits 27:27
+ U32 Pciexbar : 4; /// Bits 31:28
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MRC_PCI_000_PCIEXBAR_LOW_STRUCT;
+
+typedef union {
+ struct {
+ U32 Pciexbar : 7; /// Bits 38:32
+ U32 : 25; /// Bits 63:39
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MRC_PCI_000_PCIEXBAR_HIGH_STRUCT;
+
+typedef union {
+ struct {
+ U64 Pciexbaren : 1; /// Bits 0:0
+ U64 Length : 2; /// Bits 2:1
+ U64 : 23; /// Bits 25:3
+ U64 Admsk64 : 1; /// Bits 26:26
+ U64 Admsk128 : 1; /// Bits 27:27
+ U64 Pciexbar : 11; /// Bits 38:28
+ U64 : 25; /// Bits 63:39
+ } Bits;
+ U64 Data;
+ struct {
+ MRC_PCI_000_PCIEXBAR_LOW_STRUCT Low;
+ MRC_PCI_000_PCIEXBAR_HIGH_STRUCT High;
+ } Data32;
+} MRC_PCI_000_PCIEXBAR_STRUCT;
+
+#define MRC_PCI_000_PCIEXBAR_REG (0x60)
+ #define PCIEXBAR_PCIEXBAREN_OFF (0)
+ #define PCIEXBAR_PCIEXBAREN_WID (1)
+ #define PCIEXBAR_PCIEXBAREN_MSK (0x1)
+ #define PCIEXBAR_PCIEXBAREN_MAX (0x1)
+ #define PCIEXBAR_PCIEXBAREN_DEF (0x0)
+ #define PCIEXBAR_LENGTH_OFF (1)
+ #define PCIEXBAR_LENGTH_WID (2)
+ #define PCIEXBAR_LENGTH_MSK (0x6)
+ #define PCIEXBAR_LENGTH_MAX (0x3)
+ #define PCIEXBAR_LENGTH_DEF (0x0)
+ #define PCIEXBAR_ADMSK64_OFF (26)
+ #define PCIEXBAR_ADMSK64_WID (1)
+ #define PCIEXBAR_ADMSK64_MSK (0x4000000)
+ #define PCIEXBAR_ADMSK64_MAX (0x1)
+ #define PCIEXBAR_ADMSK64_DEF (0x1)
+ #define PCIEXBAR_ADMSK128_OFF (27)
+ #define PCIEXBAR_ADMSK128_WID (1)
+ #define PCIEXBAR_ADMSK128_MSK (0x8000000)
+ #define PCIEXBAR_ADMSK128_MAX (0x1)
+ #define PCIEXBAR_ADMSK128_DEF (0x1)
+ #define PCIEXBAR_PCIEXBAR_OFF (28)
+ #define PCIEXBAR_PCIEXBAR_WID (11)
+ #define PCIEXBAR_PCIEXBAR_MSK (0x7FF0000000)
+ #define PCIEXBAR_PCIEXBAR_MAX (0x7FF)
+ #define PCIEXBAR_PCIEXBAR_DEF (0x0)
+
+typedef union {
+ struct {
+ U32 : 20; /// Bits 19:0
+ U32 Value : 12; /// Bits 31:20
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MRC_PCI_000_MESEG_BASE_LOW_STRUCT;
+
+typedef union {
+ struct {
+ U32 Value : 7; /// Bits 38:32
+ U32 : 25; /// Bits 63:39
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MRC_PCI_000_MESEG_BASE_HIGH_STRUCT;
+
+typedef union {
+ struct {
+ U64 : 20; /// Bits 19:0
+ U64 Value : 19; /// Bits 38:20
+ U64 : 25; /// Bits 63:39
+ } Bits;
+ U64 Data;
+ struct {
+ MRC_PCI_000_MESEG_BASE_LOW_STRUCT Low;
+ MRC_PCI_000_MESEG_BASE_HIGH_STRUCT High;
+ } Data32;
+} MRC_PCI_000_MESEG_BASE_STRUCT;
+
+#define MRC_PCI_000_MESEG_BASE_REG (0x70)
+ #define MESEG_BASE_MEBASE_OFF (20)
+ #define MESEG_BASE_MEBASE_WID (19)
+ #define MESEG_BASE_MEBASE_MSK (0x7FFFF00000)
+ #define MESEG_BASE_MEBASE_MAX (0x7FFFF)
+ #define MESEG_BASE_MEBASE_DEF (0x7FFFF)
+
+typedef union {
+ struct {
+ U32 : 10; /// Bits 9:0
+ U32 Lock : 1; /// Bits 10:10
+ U32 Enable : 1; /// Bits 11:11
+ U32 : 8; /// Bits 19:12
+ U32 Value : 12; /// Bits 31:20
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MRC_PCI_000_MESEG_MASK_LOW_STRUCT;
+
+typedef union {
+ struct {
+ U32 Value : 7; /// Bits 38:32
+ U32 : 25; /// Bits 63:39
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MRC_PCI_000_MESEG_MASK_HIGH_STRUCT;
+
+typedef union {
+ struct {
+ U64 : 10; /// Bits 9:0
+ U64 Lock : 1; /// Bits 10:10
+ U64 Enable : 1; /// Bits 11:11
+ U64 : 8; /// Bits 19:12
+ U64 Value : 19; /// Bits 38:20
+ U64 : 25; /// Bits 63:39
+ } Bits;
+ U64 Data;
+ struct {
+ MRC_PCI_000_MESEG_MASK_LOW_STRUCT Low;
+ MRC_PCI_000_MESEG_MASK_HIGH_STRUCT High;
+ } Data32;
+} MRC_PCI_000_MESEG_MASK_STRUCT;
+
+#define MRC_PCI_000_MESEG_MASK_REG (0x78)
+ #define MESEG_MASK_MELCK_OFF (10)
+ #define MESEG_MASK_MELCK_WID (1)
+ #define MESEG_MASK_MELCK_MSK (0x400)
+ #define MESEG_MASK_MELCK_MAX (1)
+ #define MESEG_MASK_MELCK_DEF (0x0)
+ #define MESEG_MASK_ME_STLEN_EN_OFF (11)
+ #define MESEG_MASK_ME_STLEN_EN_WID (1)
+ #define MESEG_MASK_ME_STLEN_EN_MSK (0x800)
+ #define MESEG_MASK_ME_STLEN_EN_MAX (0x1)
+ #define MESEG_MASK_ME_STLEN_EN_DEF (0x0)
+ #define MESEG_MASK_MEMASK_OFF (20)
+ #define MESEG_MASK_MEMASK_WID (19)
+ #define MESEG_MASK_MEMASK_MSK (0x7FFFF00000)
+ #define MESEG_MASK_MEMASK_MAX (0x7FFFF)
+ #define MESEG_MASK_MEMASK_DEF (0x0)
+
+typedef union {
+ struct {
+ U32 Lock : 1; /// Bits 0:0
+ U32 : 19; /// Bits 19:1
+ U32 Value : 12; /// Bits 31:20
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MRC_PCI_000_REMAPBASE_LOW_STRUCT;
+
+typedef union {
+ struct {
+ U32 Value : 7; /// Bits 38:32
+ U32 : 25; /// Bits 63:39
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MRC_PCI_000_REMAPBASE_HIGH_STRUCT;
+
+typedef union {
+ struct {
+ U64 Lock : 1; /// Bits 0:0
+ U64 : 19; /// Bits 19:1
+ U64 Value : 19; /// Bits 38:20
+ U64 : 25; /// Bits 63:39
+ } Bits;
+ U64 Data;
+ struct {
+ MRC_PCI_000_REMAPBASE_LOW_STRUCT Low;
+ MRC_PCI_000_REMAPBASE_HIGH_STRUCT High;
+ } Data32;
+} MRC_PCI_000_REMAPBASE_STRUCT;
+
+#define MRC_PCI_000_REMAPBASE_REG (0x90)
+ #define REMAPBASE_LOCK_OFF (0)
+ #define REMAPBASE_LOCK_WID (1)
+ #define REMAPBASE_LOCK_MSK (0x1)
+ #define REMAPBASE_LOCK_MAX (0x1)
+ #define REMAPBASE_LOCK_DEF (0x0)
+ #define REMAPBASE_REMAPBASE_OFF (20)
+ #define REMAPBASE_REMAPBASE_WID (19)
+ #define REMAPBASE_REMAPBASE_MSK (0x7FFFF00000)
+ #define REMAPBASE_REMAPBASE_MAX (0x7FFFF)
+ #define REMAPBASE_REMAPBASE_DEF (0xFFFFF)
+
+typedef union {
+ struct {
+ U32 Lock : 1; /// Bits 0:0
+ U32 : 19; /// Bits 19:1
+ U32 Value : 12; /// Bits 31:20
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MRC_PCI_000_REMAPLIMIT_LOW_STRUCT;
+
+typedef union {
+ struct {
+ U32 Value : 7; /// Bits 38:32
+ U32 : 25; /// Bits 63:39
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MRC_PCI_000_REMAPLIMIT_HIGH_STRUCT;
+
+typedef union {
+ struct {
+ U64 Lock : 1; /// Bits 0:0
+ U64 : 19; /// Bits 19:1
+ U64 Value : 19; /// Bits 38:20
+ U64 : 25; /// Bits 63:39
+ } Bits;
+ U64 Data;
+ struct {
+ MRC_PCI_000_REMAPLIMIT_LOW_STRUCT Low;
+ MRC_PCI_000_REMAPLIMIT_HIGH_STRUCT High;
+ } Data32;
+} MRC_PCI_000_REMAPLIMIT_STRUCT;
+
+#define MRC_PCI_000_REMAPLIMIT_REG (0x98)
+ #define REMAPLIMIT_LOCK_OFF (0)
+ #define REMAPLIMIT_LOCK_WID (1)
+ #define REMAPLIMIT_LOCK_MSK (0x1)
+ #define REMAPLIMIT_LOCK_MAX (0x1)
+ #define REMAPLIMIT_LOCK_DEF (0x0)
+ #define REMAPLIMIT_REMAPLMT_OFF (20)
+ #define REMAPLIMIT_REMAPLMT_WID (19)
+ #define REMAPLIMIT_REMAPLMT_MSK (0x7FFFF00000)
+ #define REMAPLIMIT_REMAPLMT_MAX (0x7FFFF)
+ #define REMAPLIMIT_REMAPLMT_DEF (0x0)
+
+typedef union {
+ struct {
+ U32 Lock : 1; /// Bits 0:0
+ U32 : 19; /// Bits 19:1
+ U32 Value : 12; /// Bits 31:20
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MRC_PCI_000_TOM_LOW_STRUCT;
+
+typedef union {
+ struct {
+ U32 Value : 7; /// Bits 38:32
+ U32 : 25; /// Bits 63:39
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MRC_PCI_000_TOM_HIGH_STRUCT;
+
+typedef union {
+ struct {
+ U64 Lock : 1; /// Bits 0:0
+ U64 : 19; /// Bits 19:1
+ U64 Value : 19; /// Bits 38:20
+ U64 : 25; /// Bits 63:39
+ } Bits;
+ U64 Data;
+ struct {
+ MRC_PCI_000_TOM_LOW_STRUCT Low;
+ MRC_PCI_000_TOM_HIGH_STRUCT High;
+ } Data32;
+} MRC_PCI_000_TOM_STRUCT;
+
+#define MRC_PCI_000_TOM_REG (0xA0)
+ #define TOM_LOCK_OFF (0)
+ #define TOM_LOCK_WID (1)
+ #define TOM_LOCK_MSK (0x1)
+ #define TOM_LOCK_MAX (0x1)
+ #define TOM_LOCK_DEF (0x0)
+ #define TOM_TOM_OFF (20)
+ #define TOM_TOM_WID (19)
+ #define TOM_TOM_MSK (0x7FFFF00000)
+ #define TOM_TOM_MAX (0x7FFFF)
+ #define TOM_TOM_DEF (0x7FFFF)
+
+typedef union {
+ struct {
+ U32 Lock : 1; /// Bits 0:0
+ U32 : 19; /// Bits 19:1
+ U32 Value : 12; /// Bits 31:20
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MRC_PCI_000_TOUUD_LOW_STRUCT;
+
+typedef union {
+ struct {
+ U32 Value : 7; /// Bits 38:32
+ U32 : 25; /// Bits 63:39
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MRC_PCI_000_TOUUD_HIGH_STRUCT;
+
+typedef union {
+ struct {
+ U64 Lock : 1; /// Bits 0:0
+ U64 : 19; /// Bits 19:1
+ U64 Value : 19; /// Bits 38:20
+ U64 : 25; /// Bits 63:39
+ } Bits;
+ U64 Data;
+ struct {
+ MRC_PCI_000_TOUUD_LOW_STRUCT Low;
+ MRC_PCI_000_TOUUD_HIGH_STRUCT High;
+ } Data32;
+} MRC_PCI_000_TOUUD_STRUCT;
+
+#define MRC_PCI_000_TOUUD_REG (0xA8)
+ #define TOUUD_LOCK_OFF (0)
+ #define TOUUD_LOCK_WID (1)
+ #define TOUUD_LOCK_MSK (0x1)
+ #define TOUUD_LOCK_MAX (0x1)
+ #define TOUUD_LOCK_DEF (0x0)
+ #define TOUUD_TOUUD_OFF (20)
+ #define TOUUD_TOUUD_WID (19)
+ #define TOUUD_TOUUD_MSK (0x7FFFF00000)
+ #define TOUUD_TOUUD_MAX (0x7FFFF)
+ #define TOUUD_TOUUD_DEF (0x0)
+
+typedef union {
+ struct {
+ U32 Lock : 1; /// Bits 0:0
+ U32 : 19; /// Bits 19:1
+ U32 Value : 12; /// Bits 31:20
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MRC_PCI_000_BDSM_STRUCT;
+
+#define MRC_PCI_000_BDSM_REG (0xB0)
+ #define BDSM_LOCK_OFF (0)
+ #define BDSM_LOCK_WID (1)
+ #define BDSM_LOCK_MSK (0x1)
+ #define BDSM_LOCK_MAX (0x1)
+ #define BDSM_LOCK_DEF (0x0)
+ #define BDSM_BDSM_OFF (20)
+ #define BDSM_BDSM_WID (12)
+ #define BDSM_BDSM_MSK (0xFFF00000)
+ #define BDSM_BDSM_MAX (0xFFF)
+ #define BDSM_BDSM_DEF (0x0)
+
+typedef union {
+ struct {
+ U32 Lock : 1; /// Bits 0:0
+ U32 : 19; /// Bits 19:1
+ U32 Value : 12; /// Bits 31:20
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MRC_PCI_000_BGSM_STRUCT;
+
+#define MRC_PCI_000_BGSM_REG (0xB4)
+ #define BGSM_LOCK_OFF (0)
+ #define BGSM_LOCK_WID (1)
+ #define BGSM_LOCK_MSK (0x1)
+ #define BGSM_LOCK_MAX (0x1)
+ #define BGSM_LOCK_DEF (0x0)
+ #define BGSM_BGSM_OFF (20)
+ #define BGSM_BGSM_WID (12)
+ #define BGSM_BGSM_MSK (0xFFF00000)
+ #define BGSM_BGSM_MAX (0xFFF)
+ #define BGSM_BGSM_DEF (0x001)
+
+typedef union {
+ struct {
+ U32 Lock : 1; /// Bits 0:0
+ U32 : 19; /// Bits 19:1
+ U32 Value : 12; /// Bits 31:20
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MRC_PCI_000_TSEGMB_STRUCT;
+
+#define MRC_PCI_000_TSEGMB_REG (0xB8)
+ #define TSEGMB_LOCK_OFF (0)
+ #define TSEGMB_LOCK_WID (1)
+ #define TSEGMB_LOCK_MSK (0x1)
+ #define TSEGMB_LOCK_MAX (0x1)
+ #define TSEGMB_LOCK_DEF (0x0)
+ #define TSEGMB_TSEGMB_OFF (20)
+ #define TSEGMB_TSEGMB_WID (12)
+ #define TSEGMB_TSEGMB_MSK (0xFFF00000)
+ #define TSEGMB_TSEGMB_MAX (0xFFF)
+ #define TSEGMB_TSEGMB_DEF (0x0)
+
+typedef union {
+ struct {
+ U32 Lock : 1; /// Bits 0:0
+ U32 Prs : 1; /// Bits 1:1
+ U32 Epm : 1; /// Bits 2:2
+ U32 : 1; /// Bits 3:3
+ U32 Dprsize : 8; /// Bits 11:4
+ U32 : 20; /// Bits 31:12
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MRC_PCI_000_DPR_STRUCT;
+
+#define MRC_PCI_000_DPR_REG (0x5c)
+ #define DPR_LOCK_OFF (0)
+ #define DPR_LOCK_WID (1)
+ #define DPR_LOCK_MSK (0x1)
+ #define DPR_LOCK_MAX (0x1)
+ #define DPR_LOCK_DEF (0x0)
+ #define DPR_EPM_OFF (2)
+ #define DPR_EPM_WID (1)
+ #define DPR_EPM_MSK (0x4)
+ #define DPR_EPM_MAX (0x1)
+ #define DPR_EPM_DEF (0x0)
+
+typedef union {
+ struct {
+ U32 Lock : 1; /// Bits 0:0
+ U32 : 19; /// Bits 19:1
+ U32 Value : 12; /// Bits 31:20
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MRC_PCI_000_TOLUD_STRUCT;
+
+#define MRC_PCI_000_TOLUD_REG (0xBC)
+ #define TOLUD_LOCK_OFF (0)
+ #define TOLUD_LOCK_WID (1)
+ #define TOLUD_LOCK_MSK (0x1)
+ #define TOLUD_LOCK_MAX (0x1)
+ #define TOLUD_LOCK_DEF (0x0)
+ #define TOLUD_TOLUD_OFF (20)
+ #define TOLUD_TOLUD_WID (12)
+ #define TOLUD_TOLUD_MSK (0xFFF00000)
+ #define TOLUD_TOLUD_MAX (0xFFF)
+ #define TOLUD_TOLUD_DEF (0x001)
+
+typedef union {
+ struct {
+ U32 DDR3L_EN : 1; /// Bits 0:0
+ U32 DDR_WRTVREF : 1; /// Bits 1:1
+ U32 OC_ENABLED_DSKU : 1; /// Bits 2:2
+ U32 DDR_OVERCLOCK : 1; /// Bits 3:3
+ U32 CRID : 4; /// Bits 7:4
+ U32 CDID : 2; /// Bits 9:8
+ U32 DIDOE : 1; /// Bits 10:10
+ U32 IGD : 1; /// Bits 11:11
+ U32 PDCD : 1; /// Bits 12:12
+ U32 X2APIC_EN : 1; /// Bits 13:13
+ U32 DDPCD : 1; /// Bits 14:14
+ U32 CDD : 1; /// Bits 15:15
+ U32 FUFRD : 1; /// Bits 16:16
+ U32 D1NM : 1; /// Bits 17:17
+ U32 PCIE_RATIO_DIS : 1; /// Bits 18:18
+ U32 DDRSZ : 2; /// Bits 20:19
+ U32 PEGG2DIS : 1; /// Bits 21:21
+ U32 DMIG2DIS : 1; /// Bits 22:22
+ U32 VTDDD : 1; /// Bits 23:23
+ U32 FDEE : 1; /// Bits 24:24
+ U32 ECCDIS : 1; /// Bits 25:25
+ U32 DW : 1; /// Bits 26:26
+ U32 PELWUD : 1; /// Bits 27:27
+ U32 PEG10D : 1; /// Bits 28:28
+ U32 PEG11D : 1; /// Bits 29:29
+ U32 PEG12D : 1; /// Bits 30:30
+ U32 DHDAD : 1; /// Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MRC_PCI_000_CAPID0_A_STRUCT;
+
+#define MRC_PCI_000_CAPID0_REG (0xE4)
+#define MRC_PCI_000_CAPID0_A_REG (0xE4)
+ #define CAPID0_A_DDR3L_EN_OFF (0)
+ #define CAPID0_A_DDR3L_EN_WID (1)
+ #define CAPID0_A_DDR3L_EN_MSK (0x1)
+ #define CAPID0_A_DDR3L_EN_MAX (0x1)
+ #define CAPID0_A_DDR3L_EN_DEF (0x0)
+ #define CAPID0_A_DDR_WRTVREF_OFF (0x0)
+ #define CAPID0_A_DDR_WRTVREF_WID (0x1)
+ #define CAPID0_A_DDR_WRTVREF_MSK (0x1)
+ #define CAPID0_A_DDR_WRTVREF_MAX (0x1)
+ #define CAPID0_A_DDR_WRTVREF_DEF (0x0)
+ #define CAPID0_A_DDR_OVERCLOCK_OFF (3)
+ #define CAPID0_A_DDR_OVERCLOCK_WID (1)
+ #define CAPID0_A_DDR_OVERCLOCK_MSK (0x8)
+ #define CAPID0_A_DDR_OVERCLOCK_MAX (0x1)
+ #define CAPID0_A_DDR_OVERCLOCK_DEF (0x0)
+ #define CAPID0_A_CRID_OFF (4)
+ #define CAPID0_A_CRID_WID (4)
+ #define CAPID0_A_CRID_MSK (0xF0)
+ #define CAPID0_A_CRID_MAX (0xF)
+ #define CAPID0_A_CRID_DEF (0x0)
+ #define CAPID0_A_CDID_OFF (8)
+ #define CAPID0_A_CDID_WID (2)
+ #define CAPID0_A_CDID_MSK (0x300)
+ #define CAPID0_A_CDID_MAX (0x3)
+ #define CAPID0_A_CDID_DEF (0x0)
+ #define CAPID0_A_DIDOE_OFF (10)
+ #define CAPID0_A_DIDOE_WID (1)
+ #define CAPID0_A_DIDOE_MSK (0x400)
+ #define CAPID0_A_DIDOE_MAX (0x1)
+ #define CAPID0_A_DIDOE_DEF (0x0)
+ #define CAPID0_A_IGD_OFF (11)
+ #define CAPID0_A_IGD_WID (1)
+ #define CAPID0_A_IGD_MSK (0x800)
+ #define CAPID0_A_IGD_MAX (0x1)
+ #define CAPID0_A_IGD_DEF (0x0)
+ #define CAPID0_A_PDCD_OFF (12)
+ #define CAPID0_A_PDCD_WID (1)
+ #define CAPID0_A_PDCD_MSK (0x1000)
+ #define CAPID0_A_PDCD_MAX (0x1)
+ #define CAPID0_A_PDCD_DEF (0x0)
+ #define CAPID0_A_X2APIC_EN_OFF (13)
+ #define CAPID0_A_X2APIC_EN_WID (1)
+ #define CAPID0_A_X2APIC_EN_MSK (0x2000)
+ #define CAPID0_A_X2APIC_EN_MAX (0x1)
+ #define CAPID0_A_X2APIC_EN_DEF (0x0)
+ #define CAPID0_A_DDPCD_OFF (14)
+ #define CAPID0_A_DDPCD_WID (1)
+ #define CAPID0_A_DDPCD_MSK (0x4000)
+ #define CAPID0_A_DDPCD_MAX (0x1)
+ #define CAPID0_A_DDPCD_DEF (0x0)
+ #define CAPID0_A_CDD_OFF (15)
+ #define CAPID0_A_CDD_WID (1)
+ #define CAPID0_A_CDD_MSK (0x8000)
+ #define CAPID0_A_CDD_MAX (0x1)
+ #define CAPID0_A_CDD_DEF (0x0)
+ #define CAPID0_A_FUFRD_OFF (16)
+ #define CAPID0_A_FUFRD_WID (1)
+ #define CAPID0_A_FUFRD_MSK (0x10000)
+ #define CAPID0_A_FUFRD_MAX (0x1)
+ #define CAPID0_A_FUFRD_DEF (0x0)
+ #define CAPID0_A_D1NM_OFF (17)
+ #define CAPID0_A_D1NM_WID (1)
+ #define CAPID0_A_D1NM_MSK (0x20000)
+ #define CAPID0_A_D1NM_MAX (0x1)
+ #define CAPID0_A_D1NM_DEF (0x0)
+ #define CAPID0_A_PEGX16D_OFF (18)
+ #define CAPID0_A_PEGX16D_WID (1)
+ #define CAPID0_A_PEGX16D_MSK (0x40000)
+ #define CAPID0_A_PEGX16D_MAX (0x1)
+ #define CAPID0_A_PEGX16D_DEF (0x0)
+ #define CAPID0_A_DDRSZ_OFF (19)
+ #define CAPID0_A_DDRSZ_WID (2)
+ #define CAPID0_A_DDRSZ_MSK (0x180000)
+ #define CAPID0_A_DDRSZ_MAX (0x3)
+ #define CAPID0_A_DDRSZ_DEF (0x0)
+ #define CAPID0_A_PEGG2DIS_OFF (21)
+ #define CAPID0_A_PEGG2DIS_WID (1)
+ #define CAPID0_A_PEGG2DIS_MSK (0x200000)
+ #define CAPID0_A_PEGG2DIS_MAX (0x1)
+ #define CAPID0_A_PEGG2DIS_DEF (0x0)
+ #define CAPID0_A_DMIG2DIS_OFF (22)
+ #define CAPID0_A_DMIG2DIS_WID (1)
+ #define CAPID0_A_DMIG2DIS_MSK (0x400000)
+ #define CAPID0_A_DMIG2DIS_MAX (0x1)
+ #define CAPID0_A_DMIG2DIS_DEF (0x0)
+ #define CAPID0_A_VTDD_OFF (23)
+ #define CAPID0_A_VTDD_WID (1)
+ #define CAPID0_A_VTDD_MSK (0x800000)
+ #define CAPID0_A_VTDD_MAX (0x1)
+ #define CAPID0_A_VTDD_DEF (0x0)
+ #define CAPID0_A_FDEE_OFF (24)
+ #define CAPID0_A_FDEE_WID (1)
+ #define CAPID0_A_FDEE_MSK (0x1000000)
+ #define CAPID0_A_FDEE_MAX (0x1)
+ #define CAPID0_A_FDEE_DEF (0x0)
+ #define CAPID0_A_ECCDIS_OFF (25)
+ #define CAPID0_A_ECCDIS_WID (1)
+ #define CAPID0_A_ECCDIS_MSK (0x2000000)
+ #define CAPID0_A_ECCDIS_MAX (0x1)
+ #define CAPID0_A_ECCDIS_DEF (0x0)
+ #define CAPID0_A_DW_OFF (26)
+ #define CAPID0_A_DW_WID (1)
+ #define CAPID0_A_DW_MSK (0x4000000)
+ #define CAPID0_A_DW_MAX (0x1)
+ #define CAPID0_A_DW_DEF (0x0)
+ #define CAPID0_A_PELWUD_OFF (27)
+ #define CAPID0_A_PELWUD_WID (1)
+ #define CAPID0_A_PELWUD_MSK (0x8000000)
+ #define CAPID0_A_PELWUD_MAX (0x1)
+ #define CAPID0_A_PELWUD_DEF (0x0)
+ #define CAPID0_A_PEG10D_OFF (28)
+ #define CAPID0_A_PEG10D_WID (1)
+ #define CAPID0_A_PEG10D_MSK (0x10000000)
+ #define CAPID0_A_PEG10D_MAX (0x1)
+ #define CAPID0_A_PEG10D_DEF (0x0)
+ #define CAPID0_A_PEG11D_OFF (29)
+ #define CAPID0_A_PEG11D_WID (1)
+ #define CAPID0_A_PEG11D_MSK (0x20000000)
+ #define CAPID0_A_PEG11D_MAX (0x1)
+ #define CAPID0_A_PEG11D_DEF (0x0)
+ #define CAPID0_A_PEG12D_OFF (30)
+ #define CAPID0_A_PEG12D_WID (1)
+ #define CAPID0_A_PEG12D_MSK (0x40000000)
+ #define CAPID0_A_PEG12D_MAX (0x1)
+ #define CAPID0_A_PEG12D_DEF (0x0)
+
+typedef union {
+ struct {
+ U32 SPEGFX1 : 1; /// Bits 0:0
+ U32 DPEGFX1 : 1; /// Bits 1:1
+ U32 : 2; /// Bits 3:2
+ U32 DMFC : 3; /// Bits 6:4
+ U32 DDD : 1; /// Bits 7:7
+ U32 : 3; /// Bits 10:8
+ U32 HDCPD : 1; /// Bits 11:11
+ U32 : 4; /// Bits 15:12
+ U32 PEGX16D : 1; /// Bits 16:16
+ U32 ADDGFXCAP : 1; /// Bits 17:17
+ U32 ADDGFXEN : 1; /// Bits 18:18
+ U32 PKGTYP : 1; /// Bits 19:19
+ U32 PEGG3_DIS : 1; /// Bits 20:20
+ U32 PLL_REF100_CFG : 3; /// Bits 23:21
+ U32 SOFTBIN : 1; /// Bits 24:24
+ U32 CACHESZ : 3; /// Bits 27:25
+ U32 SMT : 1; /// Bits 28:28
+ U32 OC_ENABLED_SSKU : 1; /// Bits 29:29
+ U32 OC_CTL_SSKU : 1; /// Bits 30:30
+ U32 : 1; /// Bits 31:31
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} MRC_PCI_000_CAPID0_B_STRUCT;
+
+#define MRC_PCI_000_CAPID0_B_REG (0xE8)
+ #define CAPID0_B_SPEGFX1_OFF (0)
+ #define CAPID0_B_SPEGFX1_WID (1)
+ #define CAPID0_B_SPEGFX1_MSK (0x1)
+ #define CAPID0_B_SPEGFX1_MAX (0x1)
+ #define CAPID0_B_SPEGFX1_DEF (0x0)
+ #define CAPID0_B_DPEGFX1_OFF (1)
+ #define CAPID0_B_DPEGFX1_WID (1)
+ #define CAPID0_B_DPEGFX1_MSK (0x2)
+ #define CAPID0_B_DPEGFX1_MAX (0x1)
+ #define CAPID0_B_DPEGFX1_DEF (0x0)
+ #define CAPID0_B_DMFC_OFF (4)
+ #define CAPID0_B_DMFC_WID (3)
+ #define CAPID0_B_DMFC_MSK (0x70)
+ #define CAPID0_B_DMFC_MAX (0x7)
+ #define CAPID0_B_DMFC_DEF (0x0)
+ #define CAPID0_B_DDD_OFF (7)
+ #define CAPID0_B_DDD_WID (1)
+ #define CAPID0_B_DDD_MSK (0x80)
+ #define CAPID0_B_DDD_MAX (0x1)
+ #define CAPID0_B_DDD_DEF (0x0)
+ #define CAPID0_B_HGKS_OFF (8)
+ #define CAPID0_B_HGKS_WID (3)
+ #define CAPID0_B_HGKS_MSK (0x700)
+ #define CAPID0_B_HGKS_MAX (0x7)
+ #define CAPID0_B_HGKS_DEF (0x0)
+ #define CAPID0_B_HDCPD_OFF (11)
+ #define CAPID0_B_HDCPD_WID (1)
+ #define CAPID0_B_HDCPD_MSK (0x800)
+ #define CAPID0_B_HDCPD_MAX (0x1)
+ #define CAPID0_B_HDCPD_DEF (0x0)
+ #define CAPID0_B_ADDGFXCAP_OFF (17)
+ #define CAPID0_B_ADDGFXCAP_WID (1)
+ #define CAPID0_B_ADDGFXCAP_MSK (0x20000)
+ #define CAPID0_B_ADDGFXCAP_MAX (0x1)
+ #define CAPID0_B_ADDGFXCAP_DEF (0x0)
+ #define CAPID0_B_ADDGFXEN_OFF (18)
+ #define CAPID0_B_ADDGFXEN_WID (1)
+ #define CAPID0_B_ADDGFXEN_MSK (0x40000)
+ #define CAPID0_B_ADDGFXEN_MAX (0x1)
+ #define CAPID0_B_ADDGFXEN_DEF (0x0)
+ #define CAPID0_B_PKGTYP_OFF (19)
+ #define CAPID0_B_PKGTYP_WID (1)
+ #define CAPID0_B_PKGTYP_MSK (0x80000)
+ #define CAPID0_B_PKGTYP_MAX (0x1)
+ #define CAPID0_B_PKGTYP_DEF (0x0)
+ #define CAPID0_B_PLL_REF100_CFG_OFF (21)
+ #define CAPID0_B_PLL_REF100_CFG_WID (3)
+ #define CAPID0_B_PLL_REF100_CFG_MSK (0xE00000)
+ #define CAPID0_B_PLL_REF100_CFG_MAX (0x7)
+ #define CAPID0_B_PLL_REF100_CFG_DEF (0x0)
+ #define CAPID0_B_SOFTBIN_OFF (24)
+ #define CAPID0_B_SOFTBIN_WID (1)
+ #define CAPID0_B_SOFTBIN_MSK (0x1000000)
+ #define CAPID0_B_SOFTBIN_MAX (0x1)
+ #define CAPID0_B_SOFTBIN_DEF (0x0)
+ #define CAPID0_B_CACHESZ_OFF (25)
+ #define CAPID0_B_CACHESZ_WID (3)
+ #define CAPID0_B_CACHESZ_MSK (0xe000000)
+ #define CAPID0_B_CACHESZ_MAX (0x7)
+ #define CAPID0_B_CACHESZ_DEF (0x0)
+ #define CAPID0_B_SMT_OFF (28)
+ #define CAPID0_B_SMT_WID (1)
+ #define CAPID0_B_SMT_MSK (0x10000000)
+ #define CAPID0_B_SMT_MAX (0x1)
+ #define CAPID0_B_SMT_DEF (0x0)
+ #define CAPID0_B_OC_ENABLED_SSKU_OFF (29)
+ #define CAPID0_B_OC_ENABLED_SSKU_WID (1)
+ #define CAPID0_B_OC_ENABLED_SSKU_MSK (0x20000000)
+ #define CAPID0_B_OC_ENABLED_SSKU_MAX (0x1)
+ #define CAPID0_B_OC_ENABLED_SSKU_DEF (0x0)
+
+typedef union {
+ struct {
+ U64 DDR3L_EN : 1; /// Bits 0:0
+ U64 DDR_WRTVREF : 1; /// Bits 1:1
+ U64 OC_ENABLED_DSKU : 1; /// Bits 2:2
+ U64 DDR_OVERCLOCK : 1; /// Bits 3:3
+ U64 CRID : 4; /// Bits 7:4
+ U64 CDID : 2; /// Bits 9:8
+ U64 DIDOE : 1; /// Bits 10:10
+ U64 IGD : 1; /// Bits 11:11
+ U64 PDCD : 1; /// Bits 12:12
+ U64 X2APIC_EN : 1; /// Bits 13:13
+ U64 DDPCD : 1; /// Bits 14:14
+ U64 CDD : 1; /// Bits 15:15
+ U64 FUFRD : 1; /// Bits 16:16
+ U64 D1NM : 1; /// Bits 17:17
+ U64 PCIE_RATIO_DIS : 1; /// Bits 18:18
+ U64 DDRSZ : 2; /// Bits 20:19
+ U64 PEGG2DIS : 1; /// Bits 21:21
+ U64 DMIG2DIS : 1; /// Bits 22:22
+ U64 VTDDD : 1; /// Bits 23:23
+ U64 FDEE : 1; /// Bits 24:24
+ U64 ECCDIS : 1; /// Bits 25:25
+ U64 DW : 1; /// Bits 26:26
+ U64 PELWUD : 1; /// Bits 27:27
+ U64 PEG10D : 1; /// Bits 28:28
+ U64 PEG11D : 1; /// Bits 29:29
+ U64 PEG12D : 1; /// Bits 30:30
+ U64 DHDAD : 1; /// Bits 31:31
+ U64 SPEGFX1 : 1; /// Bits 32:32
+ U64 DPEGFX1 : 1; /// Bits 33:33
+ U64 : 2; /// Bits 35:34
+ U64 DMFC : 3; /// Bits 38:36
+ U64 DDD : 1; /// Bits 39:39
+ U64 : 3; /// Bits 42:40
+ U64 HDCPD : 1; /// Bits 43:43
+ U64 : 4; /// Bits 47:44
+ U64 PEGX16D : 1; /// Bits 48:48
+ U64 ADDGFXCAP : 1; /// Bits 49:49
+ U64 ADDGFXEN : 1; /// Bits 50:50
+ U64 PKGTYP : 1; /// Bits 51:51
+ U64 PEGG3_DIS : 1; /// Bits 52:52
+ U64 PLL_REF100_CFG : 3; /// Bits 55:53
+ U64 SOFTBIN : 1; /// Bits 56:56
+ U64 CACHESZ : 3; /// Bits 59:57
+ U64 SMT : 1; /// Bits 60:60
+ U64 OC_ENABLED_SSKU : 1; /// Bits 61:61
+ U64 OC_CTL_SSKU : 1; /// Bits 62:62
+ U64 : 1; /// Bits 63:63
+ } Bits;
+ U64 Data;
+ struct {
+ MRC_PCI_000_CAPID0_A_STRUCT A;
+ MRC_PCI_000_CAPID0_B_STRUCT B;
+ } Data32;
+} MRC_PCI_000_CAPID0_STRUCT;
+
+#pragma pack (pop)
+#endif /// _Pci000_h_
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/PttHciRegs.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/PttHciRegs.h
new file mode 100644
index 0000000..5646768
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRegisters/PttHciRegs.h
@@ -0,0 +1,101 @@
+/**
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+@file
+ PttHciRegs.h
+
+@brief
+ Register definitions for PTT HCI (Platform Trust Technology - Host Controller Interface).
+
+ Conventions:
+
+ - Prefixes:
+ Definitions beginning with "R_" are registers
+ Definitions beginning with "B_" are bits within registers
+ Definitions beginning with "V_" are meaningful values of bits within the registers
+ Definitions beginning with "S_" are register sizes
+ Definitions beginning with "N_" are the bit position
+**/
+#ifndef _PTT_HCI_REGS_H_
+#define _PTT_HCI_REGS_H_
+
+#ifdef PTT_FLAG
+
+///
+/// FTPM HCI register base address
+///
+#define R_PTT_HCI_BASE_ADDRESS 0xFED70000
+
+///
+/// FTPM HCI Control Area
+///
+#define R_PTT_HCI_CA_RSVD 0x00
+#define R_PTT_HCI_CA_ERROR 0x04
+#define R_PTT_HCI_CA_CANCEL 0x08
+#define R_PTT_HCI_CA_START 0x0C
+#define R_PTT_HCI_CA_INT_RSVD 0x10
+#define R_PTT_HCI_CA_CMD_SZ 0x18
+#define R_PTT_HCI_CA_CMD 0x1C
+#define R_PTT_HCI_CA_RSP_SZ 0x24
+#define R_PTT_HCI_CA_RSP 0x28
+
+///
+/// FTPM HCI Private Area
+///
+#define R_PTT_HCI_CMD 0x40
+#define R_PTT_HCI_STS 0x44
+
+///
+/// FTPM HCI Command and Response Buffer
+///
+#define R_PTT_HCI_CRB 0x80
+
+///
+/// R_PTT_HCI_STS Flags
+///
+#define B_PTT_HCI_STS_ENABLED 0x00000001 ///< BIT0
+#define B_PTT_HCI_STS_READY 0x00000002 ///< BIT1
+#define B_PTT_HCI_STS_ACM_AS_CRTM 0x00000004 ///< BIT2
+#define B_PTT_HCI_STS_STARTUP_EXEC 0x00000008 ///< BIT3
+
+///
+/// Value written to R_PTT_HCI_CMD and CA_START
+/// to indicate that a command is available for processing
+///
+#define V_PTT_HCI_COMMAND_AVAILABLE_START 0x00000001
+#define V_PTT_HCI_COMMAND_AVAILABLE_CMD 0x00000000
+#define V_PTT_HCI_BUFFER_ADDRESS_RDY 0x00000003
+
+///
+/// Ignore bit setting mask for WaitRegisterBits
+///
+#define V_PTT_HCI_IGNORE_BITS 0x00000000
+
+///
+/// All bits clear mask for WaitRegisterBits
+///
+#define V_PTT_HCI_ALL_BITS_CLEAR 0xFFFFFFFF
+#define V_PTT_HCI_START_CLEAR 0x00000001
+
+///
+/// Max FTPM command/reponse buffer length
+///
+#define S_PTT_HCI_CRB_LENGTH 3968 ///< 0xFED70080:0xFED70FFF = 3968 Bytes
+
+#endif /// PTT_FLAG
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcReset.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcReset.h
new file mode 100644
index 0000000..7b95234
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcReset.h
@@ -0,0 +1,127 @@
+/** @file
+ The DDR3 reset sequence definitions.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+**/
+
+#ifndef _MrcReset_h_
+#define _MrcReset_h_
+
+#include "MrcTypes.h"
+#include "MrcApi.h"
+#include "McAddress.h"
+#include "MrcCommon.h"
+#include "MrcDdr3.h"
+#include "MrcOemPlatform.h"
+
+#include "PchRegsRcrb.h"
+
+/**
+@brief
+ Perform full JEDEC reset and init sequence.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - mrcSuccess or reason for failure.
+**/
+extern
+MrcStatus
+MrcResetSequence (
+ IN MrcParameters *const MrcData
+ );
+
+/**
+@brief
+ Perform JEDEC DIMM reset sequence.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval - none
+**/
+extern
+void
+MrcJedecReset (
+ IN MrcParameters *const MrcData
+ );
+
+#ifdef ULT_FLAG
+
+/**
+@brief
+ Perform JEDEC LPDDR3 DIMM reset sequence.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval mrcSuccess if succeeded
+**/
+extern
+MrcStatus
+MrcJedecResetLpddr3 (
+ IN MrcParameters *const MrcData
+ );
+
+/**
+@brief
+ Perform JEDEC LPDDR3 DIMM init sequence.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval mrcSuccess if succeeded
+**/
+MrcStatus
+MrcJedecInitLpddr3 (
+ IN MrcParameters *const MrcData
+ );
+
+#endif // ULT_FLAG
+
+/**
+@brief
+ Wait in a loop until the first RCOMP has been completed.
+ MRC should wait until this bit is set before executing any DDR command.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval mrcDeviceBusy - On Rcomp completion timeout.
+ @retval mrcSuccess - On Rcomp completion.
+**/
+extern
+MrcStatus
+CheckFirstRcompDone (
+ IN MrcParameters *const MrcData
+ );
+
+/**
+@brief
+ Perform the required steps to exit self refresh in S3/Warm reset:
+ Download the Read Reg File for all populated ranks.
+ Assert CKE for all the ranks present to pull Dimms out of Self-Refresh.
+ Issue long ZQ Calibration for all the ranks present in the channel.
+ Set REUT to normal mode for all channels.
+ Set the Power Down Config Register.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval mrcSuccess
+**/
+MrcStatus
+MrcSelfRefreshExit (
+ IN MrcParameters *const MrcData
+ );
+
+#endif // _MrcReset_h_
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRmtData.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRmtData.h
new file mode 100644
index 0000000..38f1c08
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcRmtData.h
@@ -0,0 +1,226 @@
+/** @file
+ Copies the memory related timing and configuration information into the
+ Compatible BIOS data (BDAT) table.
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+**/
+#ifndef _MrcRmtData_h_
+#define _MrcRmtData_h_
+
+#include "MrcTypes.h"
+#include "MrcApi.h"
+
+#define VDD_1_350 1350 ///< VDD in millivolts
+#define VDD_1_500 1500 ///< VDD in millivolts
+#define PI_STEP_BASE 2048 ///< Magic number from spec
+#define PI_STEP_INTERVAL 128 ///< tCK is split into this amount of intervals
+#define PI_STEP ((PI_STEP_BASE) / (PI_STEP_INTERVAL))
+#define VREF_STEP_BASE 100 ///< Magic number from spec
+#define TX_VREF_STEP 7800 ///< TX Vref step in microvolts
+#define TX_VREF(VDD) (((TX_VREF_STEP) * (VREF_STEP_BASE)) / (VDD)) ///< VDD passed in is in millivolts
+#define RX_VREF_STEP 8000 ///< TX Vref step in microvolts
+#define RX_VREF(VDD) (((RX_VREF_STEP) * (VREF_STEP_BASE)) / (VDD)) ///< VDD passed in is in millivolts
+#define CA_VREF_STEP 8000 ///< TX Vref step in microvolts
+#define CA_VREF(VDD) (((CA_VREF_STEP) * (VREF_STEP_BASE)) / (VDD)) ///< VDD passed in is in millivolts
+#define PRIMARY_OFFSET 0 ///< Offset into the BDAT header version.
+#define SECONDARY_OFFSET 1 ///< Offset into the BDAT header version.
+#define RMT_PRIMARY_VERSION 3 ///< The BDAT structure that is currently supported.
+#define RMT_SECONDARY_VERSION 0 ///< The BDAT structure that is currently supported.
+#define OEM_OFFSET 0 ///< The current offset to the OEM data in the BDAT structure.
+#define MAX_SPD_RMT 256 ///< The maximum amount of data, in bytes, in an SPD structure.
+
+#pragma pack(push, 1)
+
+typedef struct {
+ U8 BiosDataSignature[CHAR_BITS * sizeof (U8)]; ///< "BDATHEAD"
+ U32 BiosDataStructSize; ///< sizeof BDAT_STRUCTURE
+ U16 Crc16; ///< 16-bit CRC of BDAT_STRUCTURE (calculated with 0 in this field)
+ U16 Reserved;
+ union {
+ U32 L;
+ U16 S[2];
+ } Version; ///< Version, primary then secondary.
+ U32 OemOffset; ///< Optional offset to OEM-defined structure
+ U32 Reserved1;
+ U32 Reserved2;
+} RmtHeader;
+
+typedef struct {
+ U8 RxDqLeft; ///< Units = piStep
+ U8 RxDqRight;
+ U8 TxDqLeft;
+ U8 TxDqRight;
+ U8 RxVrefLow; ///< Units = rxVrefStep
+ U8 RxVrefHigh;
+ U8 TxVrefLow; ///< Units = txVrefStep
+ U8 TxVrefHigh;
+} RmtDqMargin;
+
+typedef struct {
+ U8 RxDqLeft; ///< Units = piStep
+ U8 RxDqRight;
+ U8 TxDqLeft;
+ U8 TxDqRight;
+ U8 CmdLeft;
+ U8 CmdRight;
+ U8 RecvenLeft; ///< Units = recvenStep
+ U8 RecvenRight;
+ U8 WrLevelLeft; ///< Units = wrLevelStep
+ U8 WrLevelRight;
+ U8 RxVrefLow; ///< Units = rxVrefStep
+ U8 RxVrefHigh;
+ U8 TxVrefLow; ///< Units = txVrefStep
+ U8 TxVrefHigh;
+ U8 CmdVrefLow; ///< Units = caVrefStep
+ U8 CmdVrefHigh;
+} RmtRankMargin;
+
+typedef struct {
+ U16 RecEnDelay[MAX_STROBE];
+ U16 WlDelay[MAX_STROBE];
+ U8 RxDqDelay[MAX_STROBE];
+ U8 TxDqDelay[MAX_STROBE];
+ U8 ClkDelay;
+ U8 CtlDelay;
+ U8 CmdDelay[3];
+ U8 IoLatency;
+ U8 Roundtrip;
+} RmtRankTraining;
+
+typedef union {
+ U16 ModeRegister[MAX_MR_IN_DIMM]; ///< Dimm mode registers MR0 - MR3.
+#if 0
+ struct {
+ struct {
+ U16 BurstLength : 2; ///< A1:A0 - Burst length
+ U16 CasLatency0 : 1; ///< A2 - CAS latency bit 0
+ U16 ReadBurstType : 1; ///< A3 - Read burst type
+ U16 CasLatency : 3; ///< A6:A4 - CAS latency bits 3:1
+ U16 Mode : 1; ///< A7 - Test/Normal mode
+ U16 DllReset : 1; ///< A8 - DLL reset
+ U16 WriteRecovery : 3; ///< A11:A9 - CAS latency bits 3:1
+ U16 DllPd : 1; ///< A12 - DLL control for precharge power down
+ U16 : 3; ///< A15:A13 - Reserved
+ } Mr0;
+ struct {
+ U16 DllEnable : 1; ///< A0 - DLL enable
+ U16 DriverImpCtrl0 : 1; ///< A1 - Output driver impedance control bit 0
+ U16 RttNom0 : 1; ///< A2 - Odt Rtt values bit 0
+ U16 AdditiveLatency : 2; ///< A4:A3 - Additive latency
+ U16 DriverImpCtrl : 1; ///< A5 - Output driver impedance control bit 1
+ U16 RttNom1 : 1; ///< A6 - Odt Rtt values bit 1
+ U16 WriteLeveling : 1; ///< A7 - Write leveling enable
+ U16 : 1; ///< A8 - Reserved
+ U16 RttNom2 : 1; ///< A9 - Odt Rtt values bit 2
+ U16 : 1; ///< A10 - Reserved
+ U16 TdqsEnable : 1; ///< A11 - Termination data strobe
+ U16 Qoff : 1; ///< A12 - Output disable
+ U16 : 3; ///< A15:A13 - Reserved
+ } Mr1;
+ struct {
+ U16 Pasr : 3; ///< A2:A0 - Partial array self refresh
+ U16 CasWrLatency : 3; ///< A5:A3 - CAS write latency
+ U16 AutoSelfRefresh : 1; ///< A6 - Automatic self refresh
+ U16 SelfRefreshTemp : 1; ///< A7 - Self refresh temperature range
+ U16 : 1; ///< A8 - Reserved
+ U16 RttWrite : 2; ///< A10:A9 - Dynamic ODT
+ U16 : 5; ///< A15:A11 - Reserved
+ } Mr2;
+ struct {
+ U16 MprAddress : 2; ///< A1:A0 - Multi-purpose register address
+ U16 MprControl : 1; ///< A2 - Multi-purpose register control
+ U16 : 13; ///< A15:A3 - Reserved
+ } Mr3;
+ } b;
+#endif
+} RmtRankMrs;
+
+typedef struct {
+ U8 RankEnabled; ///< 0 = Rank disabled
+ U8 RankMarginEnabled; ///< 0 = Rank margin disabled
+ U8 DqMarginEnabled; ///< 0 = Dq margin disabled
+ RmtRankMargin RankMargin; ///< Rank margin data
+ RmtDqMargin DqMargin[MAX_DQ]; ///< Array of Dq margin data per rank
+ RmtRankTraining RankTraining; ///< Rank training settings
+ RmtRankMrs RankMRS; ///< Rank MRS settings
+} RmtRankList;
+
+typedef struct {
+ U8 SpdValid[MAX_SPD_RMT / (CHAR_BITS * sizeof (U8))]; ///< Each valid bit maps to SPD byte
+ U8 SpdData[MAX_SPD_RMT]; ///< Array of raw SPD data bytes
+} RmtSpd;
+
+typedef struct {
+ U8 DimmEnabled; ///< 0 = DIMM disabled
+ RmtRankList RankList[MAX_RANK_IN_DIMM]; ///< Array of ranks per DIMM
+ RmtSpd SpdBytes; ///< SPD data per DIMM
+} RmtDimmList;
+
+typedef struct {
+ U8 ChannelEnabled; ///< 0 = Channel disabled
+ U8 NumDimmSlot; ///< Number of slots per channel on the board
+ RmtDimmList DimmList[MAX_DIMMS_IN_CHANNEL]; ///< Array of DIMMs per channel
+} RmtChannelList;
+
+typedef struct {
+ U8 ControllerEnabled; ///< 0 = MC disabled
+ U16 ControllerDeviceId; ///< MC device Id
+ U8 ControllerRevisionId; ///< MC revision Id
+ U16 MemoryFrequency; ///< Memory frequency in units of MHz / 10
+ ///< e.g. ddrFreq = 13333 for tCK = 1.5 ns
+ U16 MemoryVoltage; ///< Memory Vdd in units of mV
+ ///< e.g. ddrVoltage = 1350 for Vdd = 1.35 V
+ U8 PiStep; ///< Step unit = piStep * tCK / 2048
+ ///< e.g. piStep = 16 for step = 11.7 ps (1/128 tCK)
+ U16 RxVrefStep; ///< Step unit = rxVrefStep * Vdd / 100
+ ///< e.g. rxVrefStep = 520 for step = 7.02 mV
+ U16 TxVrefStep; ///< Step unit = txVrefStep * Vdd / 100
+ U16 CaVrefStep; ///< Step unit = caVrefStep * Vdd / 100
+ U8 RecvenStep; ///< Step unit = recvenStep * tCK / 2048
+ U8 WrLevelStep; ///< Step unit = wrLevelStep * tCK / 2048
+ RmtChannelList ChannelList[MAX_CHANNEL]; ///< Array of channels per memory controller
+} RmtControllerList;
+
+typedef struct {
+ union {
+ U32 l; ///< MRC version: Major.Minor.Revision.Build
+ struct {
+ U8 Build; ///< MRC version: Build
+ U8 Revision; ///< MRC version: Revision
+ U8 Minor; ///< MRC version: Minor
+ U8 Major; ///< MRC version: Major
+ } c;
+ } RefCodeRevision; ///< Major.Minor.Revision.Build
+ U8 MaxController; ///< Max controllers per system, e.g. 1
+ U8 MaxChannel; ///< Max channels per memory controller, e.g. 2
+ U8 MaxDimm; ///< Max DIMM per channel, e.g. 2
+ U8 MaxRankDimm; ///< Max ranks per DIMM, e.g. 2
+ U8 MaxStrobe; ///< Number of Dqs used by the rank, e.g. 18
+ U8 MaxDq; ///< Number of Dq bits used by the rank, e.g. 72
+ U32 MarginLoopCount; ///< Units of cache line
+ RmtControllerList ControllerList[MAX_CONTROLLERS]; ///< Array of memory controllers per system
+} RmtSystem;
+
+typedef struct RmtStruct {
+ RmtHeader RmtHeader;
+ RmtSystem RmtSystem;
+} RmtData;
+
+#pragma pack (pop)
+
+#endif //_MrcRmtData_h_
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcSpdData.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcSpdData.h
new file mode 100644
index 0000000..a2b68d8
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcSpdData.h
@@ -0,0 +1,671 @@
+/** @file
+ SPD data format header file.
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+**/
+
+#ifndef _MrcSpdData_h_
+#define _MrcSpdData_h_
+#pragma pack (push, 1)
+
+#include "MrcTypes.h"
+
+#define MAX_XMP_PROFILES (2)
+#define SPD3_MANUF_SIZE (SPD3_MANUF_END - SPD3_MANUF_START + 1) ///< The size of the SPD manufacturing data.
+typedef union {
+ struct {
+ U8 BytesUsed : 4; ///< Bits 3:0
+ U8 BytesTotal : 3; ///< Bits 6:4
+ U8 CrcCoverage : 1; ///< Bits 7:7
+ } Bits;
+ U8 Data;
+} SPD_DEVICE_DESCRIPTION_STRUCT;
+
+typedef union {
+ struct {
+ U8 Minor : 4; ///< Bits 3:0
+ U8 Major : 4; ///< Bits 7:4
+ } Bits;
+ U8 Data;
+} SPD_REVISION_STRUCT;
+
+typedef union {
+ struct {
+ U8 Type : 8; ///< Bits 7:0
+ } Bits;
+ U8 Data;
+} SPD_DRAM_DEVICE_TYPE_STRUCT;
+
+typedef union {
+ struct {
+ U8 ModuleType : 4; ///< Bits 3:0
+ U8 : 4; ///< Bits 7:4
+ } Bits;
+ U8 Data;
+} SPD_MODULE_TYPE_STRUCT;
+
+typedef union {
+ struct {
+ U8 Density : 4; ///< Bits 3:0
+ U8 BankAddress : 3; ///< Bits 6:4
+ U8 : 1; ///< Bits 7:7
+ } Bits;
+ U8 Data;
+} SPD_SDRAM_DENSITY_BANKS_STRUCT;
+
+typedef union {
+ struct {
+ U8 ColumnAddress : 3; ///< Bits 2:0
+ U8 RowAddress : 3; ///< Bits 5:3
+ U8 : 2; ///< Bits 7:6
+ } Bits;
+ U8 Data;
+} SPD_SDRAM_ADDRESSING_STRUCT;
+
+typedef union {
+ struct {
+ U8 OperationAt1_50 : 1; ///< Bits 0:0
+ U8 OperationAt1_35 : 1; ///< Bits 1:1
+ U8 OperationAt1_25 : 1; ///< Bits 2:2
+ U8 : 5; ///< Bits 7:3
+ } Bits;
+ U8 Data;
+} SPD_MODULE_NOMINAL_VOLTAGE_STRUCT;
+
+typedef union {
+ struct {
+ U8 SdramDeviceWidth : 3; ///< Bits 2:0
+ U8 RankCount : 3; ///< Bits 5:3
+ U8 : 2; ///< Bits 7:6
+ } Bits;
+ U8 Data;
+} SPD_MODULE_ORGANIZATION_STRUCT;
+
+typedef union {
+ struct {
+ U8 PrimaryBusWidth : 3; ///< Bits 2:0
+ U8 BusWidthExtension : 2; ///< Bits 4:3
+ U8 : 3; ///< Bits 7:5
+ } Bits;
+ U8 Data;
+} SPD_MODULE_MEMORY_BUS_WIDTH_STRUCT;
+
+typedef union {
+ struct {
+ U8 Divisor : 4; ///< Bits 3:0
+ U8 Dividend : 4; ///< Bits 7:4
+ } Bits;
+ U8 Data;
+} SPD_FINE_TIMEBASE_STRUCT;
+
+typedef union {
+ struct {
+ U8 Dividend : 8; ///< Bits 7:0
+ } Bits;
+ U8 Data;
+} SPD_MEDIUM_TIMEBASE_DIVIDEND_STRUCT;
+
+typedef union {
+ struct {
+ U8 Divisor : 8; ///< Bits 7:0
+ } Bits;
+ U8 Data;
+} SPD_MEDIUM_TIMEBASE_DIVISOR_STRUCT;
+
+typedef struct {
+ SPD_MEDIUM_TIMEBASE_DIVIDEND_STRUCT Dividend; ///< Medium Timebase (MTB) Dividend
+ SPD_MEDIUM_TIMEBASE_DIVISOR_STRUCT Divisor; ///< Medium Timebase (MTB) Divisor
+} SPD_MEDIUM_TIMEBASE;
+
+typedef union {
+ struct {
+ U8 tCKmin : 8; ///< Bits 7:0
+ } Bits;
+ U8 Data;
+} SPD_TCK_MIN_MTB_STRUCT;
+
+typedef union {
+ struct {
+ U16 CL4 : 1; ///< Bits 0:0
+ U16 CL5 : 1; ///< Bits 1:1
+ U16 CL6 : 1; ///< Bits 2:2
+ U16 CL7 : 1; ///< Bits 3:3
+ U16 CL8 : 1; ///< Bits 4:4
+ U16 CL9 : 1; ///< Bits 5:5
+ U16 CL10 : 1; ///< Bits 6:6
+ U16 CL11 : 1; ///< Bits 7:7
+ U16 CL12 : 1; ///< Bits 8:8
+ U16 CL13 : 1; ///< Bits 9:9
+ U16 CL14 : 1; ///< Bits 10:10
+ U16 CL15 : 1; ///< Bits 11:11
+ U16 CL16 : 1; ///< Bits 12:12
+ U16 CL17 : 1; ///< Bits 13:13
+ U16 CL18 : 1; ///< Bits 14:14
+ U16 : 1; ///< Bits 15:15
+ } Bits;
+ U16 Data;
+ U8 Data8;
+} SPD_CAS_LATENCIES_SUPPORTED_STRUCT;
+
+typedef union {
+ struct {
+ U8 tAAmin : 8; ///< Bits 7:0
+ } Bits;
+ U8 Data;
+} SPD_TAA_MIN_MTB_STRUCT;
+
+typedef union {
+ struct {
+ U8 tWRmin : 8; ///< Bits 7:0
+ } Bits;
+ U8 Data;
+} SPD_TWR_MIN_MTB_STRUCT;
+
+typedef union {
+ struct {
+ U8 tRCDmin : 8; ///< Bits 7:0
+ } Bits;
+ U8 Data;
+} SPD_TRCD_MIN_MTB_STRUCT;
+
+typedef union {
+ struct {
+ U8 tRRDmin : 8; ///< Bits 7:0
+ } Bits;
+ U8 Data;
+} SPD_TRRD_MIN_MTB_STRUCT;
+
+typedef union {
+ struct {
+ U8 tRPmin : 8; ///< Bits 7:0
+ } Bits;
+ U8 Data;
+} SPD_TRP_MIN_MTB_STRUCT;
+
+typedef union {
+ struct {
+ U8 tRPab : 8; ///< Bits 7:0
+ } Bits;
+ U8 Data;
+} SPD_TRP_AB_MTB_STRUCT;
+
+typedef union {
+ struct {
+ S8 tRPabFine : 8; ///< Bits 7:0
+ } Bits;
+ S8 Data;
+} SPD_TRP_AB_FTB_STRUCT;
+
+typedef union {
+ struct {
+ U8 tRASminUpper : 4; ///< Bits 3:0
+ U8 tRCminUpper : 4; ///< Bits 7:4
+ } Bits;
+ U8 Data;
+} SPD_TRAS_TRC_MIN_MTB_STRUCT;
+
+typedef union {
+ struct {
+ U8 tRASmin : 8; ///< Bits 7:0
+ } Bits;
+ U8 Data;
+} SPD_TRAS_MIN_MTB_STRUCT;
+
+typedef union {
+ struct {
+ U8 tRCmin : 8; ///< Bits 7:0
+ } Bits;
+ U8 Data;
+} SPD_TRC_MIN_MTB_STRUCT;
+
+typedef union {
+ struct {
+ U16 tRFCmin : 16; ///< Bits 15:0
+ } Bits;
+ U16 Data;
+ U8 Data8;
+} SPD_TRFC_MIN_MTB_STRUCT;
+
+typedef union {
+ struct {
+ U8 tWTRmin : 8; ///< Bits 7:0
+ } Bits;
+ U8 Data;
+} SPD_TWTR_MIN_MTB_STRUCT;
+
+typedef union {
+ struct {
+ U8 tRTPmin : 8; ///< Bits 7:0
+ } Bits;
+ U8 Data;
+} SPD_TRTP_MIN_MTB_STRUCT;
+
+typedef union {
+ struct {
+ U8 tFAWminUpper : 4; ///< Bits 3:0
+ U8 : 4; ///< Bits 7:4
+ } Bits;
+ U8 Data;
+} SPD_TFAW_MIN_MTB_UPPER_STRUCT;
+
+typedef union {
+ struct {
+ U8 tFAWmin : 8; ///< Bits 7:0
+ } Bits;
+ U8 Data;
+} SPD_TFAW_MIN_MTB_STRUCT;
+
+typedef union {
+ struct {
+ U8 tCWLmin : 8; ///< Bits 7:0
+ } Bits;
+ U8 Data;
+} SPD_TCWL_MIN_MTB_STRUCT;
+
+typedef union {
+ struct {
+ U8 NMode : 8; ///< Bits 7:0
+ } Bits;
+ U8 Data;
+} SPD_SYSTEM_COMMAND_RATE_STRUCT;
+
+typedef union {
+ struct {
+ U16 tREFImin : 16; ///< Bits 15:0
+ } Bits;
+ U16 Data;
+ U8 Data8;
+} SPD_TREFI_MIN_MTB_STRUCT;
+
+typedef union {
+ struct {
+ U8 RZQ6 : 1; ///< Bits 0:0
+ U8 RZQ7 : 1; ///< Bits 1:1
+ U8 : 5; ///< Bits 6:2
+ U8 DllOff : 1; ///< Bits 7:7
+ } Bits;
+ U8 Data;
+} SPD_SDRAM_OPTIONAL_FEATURES_STRUCT;
+
+typedef union {
+ struct {
+ U8 ExtendedTemperatureRange : 1; ///< Bits 0:0
+ U8 ExtendedTemperatureRefreshRate : 1; ///< Bits 1:1
+ U8 AutoSelfRefresh : 1; ///< Bits 2:2
+ U8 OnDieThermalSensor : 1; ///< Bits 3:3
+ U8 : 3; ///< Bits 6:4
+ U8 PartialArraySelfRefresh : 1; ///< Bits 7:7
+ } Bits;
+ U8 Data;
+} SPD_SDRAM_THERMAL_REFRESH_STRUCT;
+
+typedef union {
+ struct {
+ U8 ThermalSensorAccuracy : 7; ///< Bits 6:0
+ U8 ThermalSensorPresence : 1; ///< Bits 7:7
+ } Bits;
+ U8 Data;
+} SPD_MODULE_THERMAL_SENSOR_STRUCT;
+
+typedef union {
+ struct {
+ U8 NonStandardDeviceDescription : 7; ///< Bits 6:0
+ U8 SdramDeviceType : 1; ///< Bits 7:7
+ } Bits;
+ U8 Data;
+} SPD_SDRAM_DEVICE_TYPE_STRUCT;
+
+typedef union {
+ struct {
+ U8 : 8; ///< Bits 7:0
+ } Bits;
+ U8 Data;
+} SPD_AUTO_SELF_REFRESH_PERF_STRUCT;
+
+typedef union {
+ struct {
+ S8 tCKminFine : 8; ///< Bits 7:0
+ } Bits;
+ S8 Data;
+} SPD_TCK_MIN_FTB_STRUCT;
+
+typedef union {
+ struct {
+ S8 tAAminFine : 8; ///< Bits 7:0
+ } Bits;
+ S8 Data;
+} SPD_TAA_MIN_FTB_STRUCT;
+
+typedef union {
+ struct {
+ S8 tRCDminFine : 8; ///< Bits 7:0
+ } Bits;
+ S8 Data;
+} SPD_TRCD_MIN_FTB_STRUCT;
+
+typedef union {
+ struct {
+ S8 tRPminFine : 8; ///< Bits 7:0
+ } Bits;
+ S8 Data;
+} SPD_TRP_MIN_FTB_STRUCT;
+
+typedef union {
+ struct {
+ S8 tRCminFine : 8; ///< Bits 7:0
+ } Bits;
+ S8 Data;
+} SPD_TRC_MIN_FTB_STRUCT;
+
+typedef union {
+ struct {
+ S8 tRRDminFine : 8; ///< Bits 7:0
+ } Bits;
+ S8 Data;
+} SPD_TRRD_MIN_FTB_STRUCT;
+
+typedef union {
+ struct {
+ U8 Height : 5; ///< Bits 4:0
+ U8 RawCardExtension : 3; ///< Bits 7:5
+ } Bits;
+ U8 Data;
+} SPD_UNBUF_MODULE_NOMINAL_HEIGHT;
+
+typedef union {
+ struct {
+ U8 FrontThickness : 4; ///< Bits 3:0
+ U8 BackThickness : 4; ///< Bits 7:4
+ } Bits;
+ U8 Data;
+} SPD_UNBUF_MODULE_NOMINAL_THICKNESS;
+
+typedef union {
+ struct {
+ U8 Card : 5; ///< Bits 4:0
+ U8 Revision : 2; ///< Bits 6:5
+ U8 Extension : 1; ///< Bits 7:7
+ } Bits;
+ U8 Data;
+} SPD_UNBUF_REFERENCE_RAW_CARD;
+
+typedef union {
+ struct {
+ U8 MappingRank1 : 1; ///< Bits 0:0
+ U8 : 7; ///< Bits 7:1
+ } Bits;
+ U8 Data;
+} SPD_UNBUF_ADDRESS_MAPPING;
+
+typedef union {
+ struct {
+ U8 Height : 5; ///< Bits 4:0
+ U8 : 3; ///< Bits 7:5
+ } Bits;
+ U8 Data;
+} SPD_RDIMM_MODULE_NOMINAL_HEIGHT;
+
+typedef union {
+ struct {
+ U8 FrontThickness : 4; ///< Bits 3:0
+ U8 BackThickness : 4; ///< Bits 7:4
+ } Bits;
+ U8 Data;
+} SPD_RDIMM_MODULE_NOMINAL_THICKNESS;
+
+typedef union {
+ struct {
+ U8 Card : 5; ///< Bits 4:0
+ U8 Revision : 2; ///< Bits 6:5
+ U8 Extension : 1; ///< Bits 7:7
+ } Bits;
+ U8 Data;
+} SPD_RDIMM_REFERENCE_RAW_CARD;
+
+typedef union {
+ struct {
+ U8 RegisterCount : 2; ///< Bits 1:0
+ U8 DramRowCount : 2; ///< Bits 3:2
+ U8 : 4; ///< Bits 7:4
+ } Bits;
+ U8 Data;
+} SPD_RDIMM_MODULE_ATTRIBUTES;
+
+typedef union {
+ struct {
+ U16 ContinuationCount : 7; ///< Bits 6:0
+ U16 ContinuationParity : 1; ///< Bits 7:7
+ U16 LastNonZeroByte : 8; ///< Bits 15:8
+ } Bits;
+ U16 Data;
+ U8 Data8;
+} SPD_MANUFACTURER_ID_CODE;
+
+typedef struct {
+ U8 Year; ///< Year represented in BCD (00h = 2000)
+ U8 Week; ///< Year represented in BCD (47h = week 47)
+} SPD_MANUFACTURING_DATE;
+
+typedef union {
+ U32 Data;
+ U16 SerialNumber16[2];
+ U8 SerialNumber8[4];
+} SPD_MANUFACTURER_SERIAL_NUMBER;
+
+typedef union {
+ U16 Crc[1];
+ U8 Data8[2];
+} SPD_CYCLIC_REDUNDANCY_CODE;
+
+typedef union {
+ struct {
+ U8 ProfileEnable1 : 1; ///< Bits 0:0
+ U8 ProfileEnable2 : 1; ///< Bits 1:1
+ U8 ProfileConfig1 : 2; ///< Bits 3:2
+ U8 ProfileConfig2 : 2; ///< Bits 5:4
+ U8 : 2; ///< Bits 7:6
+ } Bits;
+ U8 Data;
+} SPD_XMP_ORG_CONFIG;
+
+typedef struct {
+ U16 XmpId; ///< 176-177 XMP Identification String
+ SPD_XMP_ORG_CONFIG XmpOrgConf; ///< 178 XMP Organization & Configuration
+ SPD_REVISION_STRUCT XmpRevision; ///< 179 XMP Revision
+ SPD_MEDIUM_TIMEBASE MediumTimeBase[MAX_XMP_PROFILES]; ///< 180-183 Medium Timebase (MTB)
+ SPD_FINE_TIMEBASE_STRUCT FineTimeBase; ///< 184 Fine Timebase (FTB) Dividend / Divisor
+} SPD_EXTREME_MEMORY_PROFILE_HEADER;
+
+typedef union {
+ struct {
+ U8 Decimal : 5;
+ U8 Integer : 2;
+ U8 : 1;
+ } Bits;
+ U8 Data;
+} SPD_VDD_VOLTAGE_LEVEL_STRUCT;
+
+typedef struct {
+ SPD_VDD_VOLTAGE_LEVEL_STRUCT Vdd; ///< 185, 220 XMP Module VDD Voltage Level
+ SPD_TCK_MIN_MTB_STRUCT tCKmin; ///< 186, 221 XMP SDRAM Minimum Cycle Time (tCKmin)
+ SPD_TAA_MIN_MTB_STRUCT tAAmin; ///< 187, 222 XMP Minimum CAS Latency Time (tAAmin)
+ SPD_CAS_LATENCIES_SUPPORTED_STRUCT CasLatencies; ///< 188-189, 223-224 XMP CAS Latencies Supported, Least Significant Byte
+ SPD_TCWL_MIN_MTB_STRUCT tCWLmin; ///< 190, 225 XMP Minimum CAS Write Latency Time (tCWLmin)
+ SPD_TRP_MIN_MTB_STRUCT tRPmin; ///< 191, 226 XMP Minimum Row Precharge Delay Time (tRPmin)
+ SPD_TRCD_MIN_MTB_STRUCT tRCDmin; ///< 192, 227 XMP Minimum RAS# to CAS# Delay Time (tRCDmin)
+ SPD_TWR_MIN_MTB_STRUCT tWRmin; ///< 193, 228 XMP Minimum Write Recovery Time (tWRmin)
+ SPD_TRAS_TRC_MIN_MTB_STRUCT tRASMintRCMinUpper; ///< 194, 229 XMP Upper Nibbles for tRAS and tRC
+ SPD_TRAS_MIN_MTB_STRUCT tRASmin; ///< 195, 230 XMP Minimum Active to Precharge Delay Time (tRASmin), Least Significant Byte
+ SPD_TRC_MIN_MTB_STRUCT tRCmin; ///< 196, 231 XMP Minimum Active to Active/Refresh Delay Time (tRCmin), Least Significant Byte
+ SPD_TREFI_MIN_MTB_STRUCT tREFImin; ///< 197-198, 232-233 XMP Maximum tREFI Time (Average Periodic Refresh Interval), Least Significant Byte
+ SPD_TRFC_MIN_MTB_STRUCT tRFCmin; ///< 199-200, 234-235 XMP Minimum Refresh Recovery Delay Time (tRFCmin), Least Significant Byte
+ SPD_TRTP_MIN_MTB_STRUCT tRTPmin; ///< 201, 236 XMP Minimum Internal Read to Precharge Command Delay Time (tRTPmin)
+ SPD_TRRD_MIN_MTB_STRUCT tRRDmin; ///< 202, 237 XMP Minimum Row Active to Row Active Delay Time (tRRDmin)
+ SPD_TFAW_MIN_MTB_UPPER_STRUCT tFAWMinUpper; ///< 203, 238 XMP Upper Nibble for tFAW
+ SPD_TFAW_MIN_MTB_STRUCT tFAWmin; ///< 204, 239 XMP Minimum Four Activate Window Delay Time (tFAWmin)
+ SPD_TWTR_MIN_MTB_STRUCT tWTRmin; ///< 205, 240 XMP Minimum Internal Write to Read Command Delay Time (tWTRmin)
+ U8 Reserved1[207 - 206 + 1]; ///< 206-207, 241-242 XMP Reserved
+ SPD_SYSTEM_COMMAND_RATE_STRUCT SystemCmdRate; ///< 208, 243 XMP System ADD/CMD Rate (1N or 2N mode)
+ SPD_AUTO_SELF_REFRESH_PERF_STRUCT AsrPerf; ///< 209, 244 XMP SDRAM Auto Self Refresh Performance (Sub 1x Refresh and IDD6 impact)
+ U8 VoltageLevel; ///< 210, 245 XMP Memory Controller Voltage Level
+ SPD_TCK_MIN_FTB_STRUCT tCKminFine; ///< 211, 246 XMP Fine Offset for SDRAM Minimum Cycle Time (tCKmin)
+ SPD_TAA_MIN_FTB_STRUCT tAAminFine; ///< 212, 247 XMP Fine Offset for Minimum CAS Latency Time (tAAmin)
+ SPD_TRP_MIN_FTB_STRUCT tRPminFine; ///< 213, 248 XMP Minimum Row Precharge Delay Time (tRPmin)
+ SPD_TRCD_MIN_FTB_STRUCT tRCDminFine; ///< 214, 249 XMP Fine Offset for Minimum RAS# to CAS# Delay Time (tRCDmin)
+ SPD_TRC_MIN_FTB_STRUCT tRCminFine; ///< 215, 250 XMP Fine Offset for Minimum Active to Active/Refresh Delay Time (tRCmin)
+ U8 Reserved2[218 - 216 + 1]; ///< 216-218, 251-253 XMP Reserved
+ U8 VendorPersonality; ///< 219, 254 XMP Vendor Personality
+} SPD_EXTREME_MEMORY_PROFILE_DATA;
+
+typedef struct {
+ SPD_EXTREME_MEMORY_PROFILE_HEADER Header; ///< 176-184 XMP header
+ SPD_EXTREME_MEMORY_PROFILE_DATA Data[MAX_XMP_PROFILES]; ///< 185-254 XMP profiles
+} SPD_EXTREME_MEMORY_PROFILE;
+
+typedef struct {
+ SPD_DEVICE_DESCRIPTION_STRUCT Description; ///< 0 Number of Serial PD Bytes Written / SPD Device Size / CRC Coverage 1, 2
+ SPD_REVISION_STRUCT Revision; ///< 1 SPD Revision
+ SPD_DRAM_DEVICE_TYPE_STRUCT DramDeviceType; ///< 2 DRAM Device Type
+ SPD_MODULE_TYPE_STRUCT ModuleType; ///< 3 Module Type
+ SPD_SDRAM_DENSITY_BANKS_STRUCT SdramDensityAndBanks; ///< 4 SDRAM Density and Banks
+ SPD_SDRAM_ADDRESSING_STRUCT SdramAddressing; ///< 5 SDRAM Addressing
+ SPD_MODULE_NOMINAL_VOLTAGE_STRUCT ModuleNominalVoltage; ///< 6 Module Nominal Voltage, VDD
+ SPD_MODULE_ORGANIZATION_STRUCT ModuleOrganization; ///< 7 Module Organization
+ SPD_MODULE_MEMORY_BUS_WIDTH_STRUCT ModuleMemoryBusWidth; ///< 8 Module Memory Bus Width
+ SPD_FINE_TIMEBASE_STRUCT FineTimebase; ///< 9 Fine Timebase (FTB) Dividend / Divisor
+ SPD_MEDIUM_TIMEBASE MediumTimebase; ///< 10-11 Medium Timebase (MTB) Dividend
+ SPD_TCK_MIN_MTB_STRUCT tCKmin; ///< 12 SDRAM Minimum Cycle Time (tCKmin)
+ U8 Reserved1; ///< 13 Reserved
+ SPD_CAS_LATENCIES_SUPPORTED_STRUCT CasLatencies; ///< 14-15 CAS Latencies Supported
+ SPD_TAA_MIN_MTB_STRUCT tAAmin; ///< 16 Minimum CAS Latency Time (tAAmin)
+ SPD_TWR_MIN_MTB_STRUCT tWRmin; ///< 17 Minimum Write Recovery Time (tWRmin)
+ SPD_TRCD_MIN_MTB_STRUCT tRCDmin; ///< 18 Minimum RAS# to CAS# Delay Time (tRCDmin)
+ SPD_TRRD_MIN_MTB_STRUCT tRRDmin; ///< 19 Minimum Row Active to Row Active Delay Time (tRRDmin)
+ SPD_TRP_MIN_MTB_STRUCT tRPmin; ///< 20 Minimum Row Precharge Delay Time (tRPmin)
+ SPD_TRAS_TRC_MIN_MTB_STRUCT tRASMintRCMinUpper; ///< 21 Upper Nibbles for tRAS and tRC
+ SPD_TRAS_MIN_MTB_STRUCT tRASmin; ///< 22 Minimum Active to Precharge Delay Time (tRASmin), Least Significant Byte
+ SPD_TRC_MIN_MTB_STRUCT tRCmin; ///< 23 Minimum Active to Active/Refresh Delay Time (tRCmin), Least Significant Byte
+ SPD_TRFC_MIN_MTB_STRUCT tRFCmin; ///< 24-25 Minimum Refresh Recovery Delay Time (tRFCmin)
+ SPD_TWTR_MIN_MTB_STRUCT tWTRmin; ///< 26 Minimum Internal Write to Read Command Delay Time (tWTRmin)
+ SPD_TRTP_MIN_MTB_STRUCT tRTPmin; ///< 27 Minimum Internal Read to Precharge Command Delay Time (tRTPmin)
+ SPD_TFAW_MIN_MTB_UPPER_STRUCT tFAWMinUpper; ///< 28 Upper Nibble for tFAW
+ SPD_TFAW_MIN_MTB_STRUCT tFAWmin; ///< 29 Minimum Four Activate Window Delay Time (tFAWmin)
+ SPD_SDRAM_OPTIONAL_FEATURES_STRUCT SdramOptionalFeatures; ///< 30 SDRAM Optional Features
+ SPD_SDRAM_THERMAL_REFRESH_STRUCT ThermalAndRefreshOptions; ///< 31 SDRAMThermalAndRefreshOptions
+ SPD_MODULE_THERMAL_SENSOR_STRUCT ModuleThermalSensor; ///< 32 Module Thermal Sensor
+ SPD_SDRAM_DEVICE_TYPE_STRUCT SdramDeviceType; ///< 33 SDRAM Device Type
+ SPD_TCK_MIN_FTB_STRUCT tCKminFine; ///< 34 Fine Offset for SDRAM Minimum Cycle Time (tCKmin)
+ SPD_TAA_MIN_FTB_STRUCT tAAminFine; ///< 35 Fine Offset for Minimum CAS Latency Time (tAAmin)
+ SPD_TRCD_MIN_FTB_STRUCT tRCDminFine; ///< 36 Fine Offset for Minimum RAS# to CAS# Delay Time (tRCDmin)
+ SPD_TRP_MIN_FTB_STRUCT tRPminFine; ///< 37 Minimum Row Precharge Delay Time (tRPmin)
+ SPD_TRC_MIN_FTB_STRUCT tRCminFine; ///< 38 Fine Offset for Minimum Active to Active/Refresh Delay Time (tRCmin)
+#if (SUPPORT_LPDDR3 == SUPPORT)
+ SPD_TRP_AB_MTB_STRUCT tRPab; ///< 39 Minimum Row Precharge Delay Time for all banks (tRPab)
+ SPD_TRP_AB_FTB_STRUCT tRPabFine; ///< 40 Fine Offset for Minimum Row Precharge Delay Time for all banks (tRPab)
+ U8 Reserved2[59 - 41 + 1]; ///< 41 - 59 Reserved
+#else
+ U8 Reserved2[59 - 39 + 1]; ///< 39 - 59 Reserved
+#endif
+} SPD_GENERAL_SECTION;
+
+typedef struct {
+ SPD_UNBUF_MODULE_NOMINAL_HEIGHT ModuleNominalHeight; ///< 60 Module Nominal Height
+ SPD_UNBUF_MODULE_NOMINAL_THICKNESS ModuleMaximumThickness; ///< 61 Module Maximum Thickness
+ SPD_UNBUF_REFERENCE_RAW_CARD ReferenceRawCardUsed; ///< 62 Reference Raw Card Used
+ SPD_UNBUF_ADDRESS_MAPPING AddressMappingEdgeConn; ///< 63 Address Mapping from Edge Connector to DRAM
+ U8 Reserved[116 - 64 + 1]; ///< 64-116 Reserved
+} SPD_MODULE_UNBUFFERED;
+
+typedef struct {
+ SPD_RDIMM_MODULE_NOMINAL_HEIGHT ModuleNominalHeight; ///< 60 Module Nominal Height
+ SPD_RDIMM_MODULE_NOMINAL_THICKNESS ModuleMaximumThickness; ///< 61 Module Maximum Thickness
+ SPD_RDIMM_REFERENCE_RAW_CARD ReferenceRawCardUsed; ///< 62 Reference Raw Card Used
+ SPD_RDIMM_MODULE_ATTRIBUTES DimmModuleAttributes; ///< 63 DIMM Module Attributes
+ U8 Reserved[116 - 64 + 1]; ///< 64-116 Reserved
+} SPD_MODULE_REGISTERED;
+
+typedef union {
+ SPD_MODULE_UNBUFFERED Unbuffered;
+ SPD_MODULE_REGISTERED Registered;
+} SPD_MODULE_SPECIFIC;
+
+typedef struct {
+ U8 Location; ///< 119 Module Manufacturing Location
+} SPD_MANUFACTURING_LOCATION;
+
+typedef struct {
+ SPD_MANUFACTURER_ID_CODE IdCode; ///< 117-118 Module Manufacturer ID Code
+ SPD_MANUFACTURING_LOCATION Location; ///< 119 Module Manufacturing Location
+ SPD_MANUFACTURING_DATE Date; ///< 120-121 Module Manufacturing Year, in BCD (range: 2000-2255)
+ SPD_MANUFACTURER_SERIAL_NUMBER SerialNumber; ///< 122-125 Module Serial Number
+} SPD_UNIQUE_MODULE_ID;
+
+typedef struct {
+ U8 ModulePartNumber[145 - 128 + 1]; ///< 128-145 Module Part Number
+} SPD_MODULE_PART_NUMBER;
+
+typedef struct {
+ U8 ModuleRevisionCode[147 - 146 + 1]; ///< 146-147 Module Revision Code
+} SPD_MODULE_REVISION_CODE;
+
+typedef struct {
+ U8 ManufactureSpecificData[175 - 150 + 1]; ///< 150-175 Manufacturer's Specific Data
+} SPD_MANUFACTURE_SPECIFIC;
+
+///
+/// DDR3 Serial Presence Detect structure
+///
+typedef struct {
+ SPD_GENERAL_SECTION General; ///< 0-59 General Section
+ SPD_MODULE_SPECIFIC Module; ///< 60-116 Module-Specific Section
+ SPD_UNIQUE_MODULE_ID ModuleId; ///< 117-125 Unique Module ID
+ SPD_CYCLIC_REDUNDANCY_CODE Crc; ///< 126-127 Cyclical Redundancy Code (CRC)
+ SPD_MODULE_PART_NUMBER ModulePartNumber; ///< 128-145 Module Part Number
+ SPD_MODULE_REVISION_CODE ModuleRevisionCode; ///< 146-147 Module Revision Code
+ SPD_MANUFACTURER_ID_CODE DramIdCode; ///< 148-149 Dram Manufacturer ID Code
+ SPD_MANUFACTURE_SPECIFIC ManufactureSpecificData; ///< 150-175 Manufacturer's Specific Data
+ SPD_EXTREME_MEMORY_PROFILE Xmp; ///< 176-254 Intel(r) Extreme Memory Profile support
+ U8 Reserved; ///< 255 Reserved
+} MrcSpdDdr3;
+typedef union {
+ MrcSpdDdr3 Ddr3;
+} MrcSpd;
+
+typedef struct {
+ SPD_MODULE_TYPE_STRUCT ModuleType; ///< 3 Module Type
+ SPD_MODULE_MEMORY_BUS_WIDTH_STRUCT ModuleMemoryBusWidth; ///< 8/14 Module Memory Bus Width
+} SMBIOS_SPD_SAVE;
+
+typedef struct {
+ SPD_UNIQUE_MODULE_ID ModuleId; ///< 117-125 Unique Module ID
+ SPD_CYCLIC_REDUNDANCY_CODE Crc; ///< 126-127 Cyclical Redundancy Code (CRC)
+ SPD_MODULE_PART_NUMBER ModulePartNumber; ///< 128-145 Module Part Number
+ SPD_MODULE_REVISION_CODE ModuleRevisionCode; ///< 146-147 Module Revision Code
+} MANUFACTURING_SPD_SAVE_DDR3;
+
+typedef union {
+ MANUFACTURING_SPD_SAVE_DDR3 Ddr3Data;
+} MANUFACTURING_SPD_SAVE;
+
+typedef struct {
+ SMBIOS_SPD_SAVE SmbiosData;
+ MANUFACTURING_SPD_SAVE ManufacturingData;
+} MrcSpdSave;
+
+#pragma pack (pop)
+#endif // _MrcSpdData_h_
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcTypes.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcTypes.h
new file mode 100644
index 0000000..e445942
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcTypes.h
@@ -0,0 +1,175 @@
+/** @file
+
+ Include the the general MRC types
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _MRC_TYPES_H
+#define _MRC_TYPES_H
+
+//
+// Data Types
+//
+typedef unsigned long long U64;
+typedef unsigned long U32;
+typedef unsigned short U16;
+typedef unsigned char U8;
+typedef signed long long S64;
+typedef signed long S32;
+typedef signed short S16;
+typedef signed char S8;
+typedef unsigned char MrcBool;
+
+#ifndef BOOL
+#undef FALSE
+#undef TRUE
+typedef enum {
+ FALSE = (0 == 1),
+ TRUE = (1 == 1)
+} BOOL;
+#endif
+
+#ifndef NULL
+#define NULL ((void *) 0)
+#endif
+
+#ifndef IN
+#define IN
+#endif
+
+#ifndef OPTIONAL
+#define OPTIONAL
+#endif
+
+#ifndef OUT
+#define OUT
+#endif
+
+#define UNSUPPORT 0
+#define SUPPORT 1
+
+typedef enum {
+ mrcSuccess,
+ mrcFail,
+ mrcWrongInputParameter,
+ mrcCasError,
+ mrcTimingError,
+ mrcSenseAmpErr,
+ mrcReadMPRErr,
+ mrcReadLevelingError,
+ mrcWriteLevelingError,
+ mrcDataTimeCentering1DErr,
+ mrcWriteVoltage2DError,
+ mrcReadVoltage2DError,
+ mrcWrError,
+ mrcDimmNotSupport,
+ mrcChannelNotSupport,
+ mrcPiSettingError,
+ mrcDqsPiSettingError,
+ mrcDeviceBusy,
+ mrcFrequencyChange,
+ mrcReutSequenceError,
+ mrcCrcError,
+ mrcFrequencyError,
+ mrcDimmNotExist,
+ mrcColdBootRequired,
+ mrcRoundTripLatencyError,
+ mrcMixedDimmSystem,
+ mrcAliasDetected,
+ mrcRetrain
+} MrcStatus;
+
+//
+// general macros
+//
+#ifndef MIN
+#define MIN(a, b) (((a) < (b)) ? (a) : (b))
+#endif
+
+#ifndef MAX
+#define MAX(a, b) (((a) > (b)) ? (a) : (b))
+#endif
+
+#ifndef ABS
+#define ABS(x) (((x) < 0) ? (-(x)) : (x))
+#endif
+//
+// use for ignore parames
+//
+// #define MRC_IGNORE_PARAM(x) ((x) = (x))
+//
+#if _MSC_EXTENSIONS
+//
+// Disable warning that make it impossible to compile at /W4
+// This only works for Microsoft* tools
+//
+//
+// Disabling bitfield type checking warnings.
+//
+#pragma warning (disable : 4214)
+//
+// Unreferenced formal parameter - We are object oriented, so we pass parameters even
+// if we don't need them.
+//
+#pragma warning (disable : 4100)
+//
+// ASSERT(FALSE) or while (TRUE) are legal constructs so supress this warning
+//
+#pragma warning(disable : 4127)
+
+#endif // _MSC_EXTENSIONS
+#define MRC_BIT0 0x00000001
+#define MRC_BIT1 0x00000002
+#define MRC_BIT2 0x00000004
+#define MRC_BIT3 0x00000008
+#define MRC_BIT4 0x00000010
+#define MRC_BIT5 0x00000020
+#define MRC_BIT6 0x00000040
+#define MRC_BIT7 0x00000080
+#define MRC_BIT8 0x00000100
+#define MRC_BIT9 0x00000200
+#define MRC_BIT10 0x00000400
+#define MRC_BIT11 0x00000800
+#define MRC_BIT12 0x00001000
+#define MRC_BIT13 0x00002000
+#define MRC_BIT14 0x00004000
+#define MRC_BIT15 0x00008000
+#define MRC_BIT16 0x00010000
+#define MRC_BIT17 0x00020000
+#define MRC_BIT18 0x00040000
+#define MRC_BIT19 0x00080000
+#define MRC_BIT20 0x00100000
+#define MRC_BIT21 0x00200000
+#define MRC_BIT22 0x00400000
+#define MRC_BIT23 0x00800000
+#define MRC_BIT24 0x01000000
+#define MRC_BIT25 0x02000000
+#define MRC_BIT26 0x04000000
+#define MRC_BIT27 0x08000000
+#define MRC_BIT28 0x10000000
+#define MRC_BIT29 0x20000000
+#define MRC_BIT30 0x40000000
+#define MRC_BIT31 0x80000000
+
+#define MRC_DEADLOOP() { volatile int __iii; __iii = 1; while (__iii); }
+
+#ifndef ASM
+#define ASM __asm
+#endif
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcVersion.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcVersion.h
new file mode 100644
index 0000000..fccbf94
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Include/MrcVersion.h
@@ -0,0 +1,24 @@
+/** @file
+ Include the MRC version
+
+@copyright
+ Copyright (c) 1999 - 2014 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+/// Major minor Rev build
+/// ----- ----- ---- -----
+ 1, 9, 0, 0
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/McConfiguration/MrcAddressDecodeConfiguration.c b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/McConfiguration/MrcAddressDecodeConfiguration.c
new file mode 100644
index 0000000..e4d17ee
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/McConfiguration/MrcAddressDecodeConfiguration.c
@@ -0,0 +1,368 @@
+/** @file
+ This module configures the memory controller address decoder.
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+
+**/
+#include "MrcAddressDecodeConfiguration.h"
+
+#if (MAX_CHANNEL > 2)
+#error This module only supports a maximum of 2 channels.
+#endif
+#if (MAX_DIMMS_IN_CHANNEL > 2)
+#error This module only supports a maximum of 2 DIMMs per channel.
+#endif
+
+/**
+@brief
+ This function configures the zone configuration registers MAD-CR and MAD-ZR-CR.
+
+ @param[in, out] MrcData - Include all MRC global data.
+
+ @retval Nothing.
+**/
+void
+ZoneConfiguration (
+ IN OUT MrcParameters *const MrcData
+)
+{
+ MrcInput *Inputs;
+ MrcOutput *Outputs;
+ MrcDebug *Debug;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ MrcChannelOut *ChannelOut0;
+ MrcChannelOut *ChannelOut1;
+ MCDECS_CR_MAD_CHNL_MCMAIN_STRUCT MadChnl;
+ MCDECS_CR_MAD_ZR_MCMAIN_STRUCT MadZr;
+ MCDECS_CR_CHANNEL_HASH_MCMAIN_STRUCT ChannelHash;
+ U32 ChannelSizeMin;
+ U32 ChannelSizeBC;
+ U32 ChannelSize2BC;
+ U32 ChannelSize[MAX_CHANNEL];
+ U8 Channel;
+ U8 Dimm;
+
+ MadChnl.Data = 0;
+ MadZr.Data = 0;
+ ChannelHash.Data = 0;
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerOut = &MrcData->SysOut.Outputs.Controller[0];
+
+ //
+ // Add up the amount of memory in each channel.
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ ChannelSize[Channel] = 0;
+ if (ChannelOut->Status == CHANNEL_PRESENT) {
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ if(ChannelOut->Dimm[Dimm].Status == DIMM_PRESENT) {
+ ChannelSize[Channel] += ChannelOut->Dimm[Dimm].DimmCapacity;
+ }
+ }
+ }
+ }
+ //
+ // Define MAD_ZR register:
+ // MAD-ZR-CR [29:24] = channel C size: ch_c_size
+ // MAD-ZR-CR [23:16] = (channel C size) * 3: ch_3c_size
+ // MAD-ZR-CR [15:8] = (channel B size) * 2 + (channel C size): ch_b_2c_size
+ // MAD-ZR-CR [7:0] = (channel B size) + (channel C size): ch_b_c_size
+ //
+ ChannelOut0 = &ControllerOut->Channel[cCHANNEL0];
+ ChannelOut1 = &ControllerOut->Channel[cCHANNEL1];
+ if (ChannelSize[cCHANNEL1] <= ChannelSize[cCHANNEL0]) {
+ MadChnl.Bits.CH_A = 0;
+ MadChnl.Bits.CH_B = 1;
+
+ //
+ // Set the virtual channel type according to the address decoding decision.
+ //
+ ChannelOut0->VirtualChannel = vcA;
+ ChannelOut1->VirtualChannel = vcB;
+
+ ChannelSizeMin = ChannelSize[cCHANNEL1];
+ } else {
+ //
+ // ChannelSize0 < ChannelSize1
+ //
+ MadChnl.Bits.CH_A = 1;
+ MadChnl.Bits.CH_B = 0;
+
+ //
+ // Set the virtual channel type according to the address decoding decision.
+ //
+ ChannelOut0->VirtualChannel = vcB;
+ ChannelOut1->VirtualChannel = vcA;
+
+ ChannelSizeMin = ChannelSize[cCHANNEL0];
+ }
+ //
+ // Divided by 256 because the channel size is in 256 MB units.
+ //
+ ChannelSizeBC = ChannelSizeMin / 256;
+ ChannelSize2BC = ChannelSizeBC << 1;
+ MadZr.Bits.BandC = MIN (ChannelSizeBC, MCDECS_CR_MAD_ZR_MCMAIN_BandC_MAX);
+ MadZr.Bits.TwoBandC = MIN (ChannelSize2BC, MCDECS_CR_MAD_ZR_MCMAIN_TwoBandC_MAX);
+ MadChnl.Bits.CH_C = 2;
+
+#ifdef ULT_FLAG
+ MadChnl.Bits.LPDDR = (Outputs->DdrType == MRC_DDR_TYPE_LPDDR3) ? 1 : 0;
+#endif
+ //
+ // Interleaved mode
+ // Check for any Channel hash support
+ //
+ if (Inputs->ChHashEnable) {
+ ChannelHash.Bits.Mask = MIN (Inputs->ChHashMask, MCDECS_CR_CHANNEL_HASH_MCMAIN_Mask_MAX);
+ ChannelHash.Bits.LSB_mask_bit = MIN (Inputs->ChHashInterleaveBit, MCDECS_CR_CHANNEL_HASH_MCMAIN_LSB_mask_bit_MAX);
+ ChannelHash.Bits.Enable = 1;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel HASH Enabled\n");
+ }
+
+ if (Inputs->MemoryTrace) {
+ if (ChannelSize[cCHANNEL0] == ChannelSize[cCHANNEL1]) {
+ //
+ // Enable the Stacked Mode for memory tracing
+ //
+ MadChnl.Bits.STKD_MODE = 1;
+ MadChnl.Bits.STKD_MODE_CH_BITS = MrcLog2 (ChannelSizeMin) - 9;
+ ChannelHash.Bits.Enable = 1;
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "Enabling Stacked Mode for Memory Trace, Stacked Mode Ch bit = %u (%u MB per channel)\n",
+ MadChnl.Bits.STKD_MODE_CH_BITS + 28,
+ ChannelSizeMin
+ );
+ } else {
+ Inputs->MemoryTrace = 0;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "Channels are not equal in size, cannot enable Memory Trace !\n");
+ }
+ }
+
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "CHANNEL_HASH = 0x%08X\nMAD_CHNL = 0x%08X\nMAD_ZR = 0x%08X\n",
+ ChannelHash.Data,
+ MadChnl.Data,
+ MadZr.Data
+ );
+ MrcWriteCR (MrcData, MCDECS_CR_CHANNEL_HASH_MCMAIN_REG, ChannelHash.Data);
+ MrcWriteCR (MrcData, MCDECS_CR_MAD_CHNL_MCMAIN_REG, MadChnl.Data);
+ MrcWriteCR (MrcData, MCDECS_CR_MAD_ZR_MCMAIN_REG, MadZr.Data);
+ return;
+}
+
+/**
+@brief
+ This function configures the MAD_DIMM_CH0/1 register.
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] ChannelIndex - Channel index
+
+ @retval Nothing.
+**/
+void
+ChannelAddressDecodeConfiguration (
+ IN MrcParameters *const MrcData,
+ IN const U32 ChannelIndex
+)
+{
+ const MrcInput *Inputs;
+ MrcOutput *Outputs;
+ MrcChannelOut *ChannelOut;
+ MrcDimmOut *DimmA;
+ MrcDimmOut *DimmB;
+ MCDECS_CR_MAD_DIMM_CH0_MCMAIN_STRUCT MadDimm;
+ U32 DimmCapacity;
+ U32 Dimm0Capacity;
+ U32 Dimm1Capacity;
+ U32 Scratch;
+#ifdef ULT_FLAG
+ MCHBAR_CH0_CR_LPDDR_MR_PARAMS_STRUCT LpddrMrParams;
+#endif //ULT_FLAG
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ ChannelOut = &Outputs->Controller[0].Channel[ChannelIndex];
+ MadDimm.Data = 0;
+ if (ChannelOut->Dimm[dDIMM0].Status == DIMM_PRESENT) {
+ Dimm0Capacity = ChannelOut->Dimm[dDIMM0].DimmCapacity;
+ } else {
+ Dimm0Capacity = 0;
+ }
+
+ if (ChannelOut->Dimm[dDIMM1].Status == DIMM_PRESENT) {
+ Dimm1Capacity = (MAX_DIMMS_IN_CHANNEL > 1) ? ChannelOut->Dimm[dDIMM1].DimmCapacity : 0;
+ } else {
+ Dimm1Capacity = 0;
+ }
+
+ //
+ // larger dimm will be located to Dimm A and small dimm will be located to dimm B
+ //
+ if (Dimm1Capacity <= Dimm0Capacity) {
+ DimmA = &ChannelOut->Dimm[dDIMM0];
+ DimmB = &ChannelOut->Dimm[dDIMM1];
+ //
+ // larger DIMM in capacity 0 - DIMM 0 or 1 - DIMM 1
+ //
+ MadDimm.Bits.DAS = 0;
+ } else {
+ DimmA = &ChannelOut->Dimm[dDIMM1];
+ DimmB = &ChannelOut->Dimm[dDIMM0];
+ //
+ // larger DIMM in capacity 0 - DIMM 0 or 1 - DIMM 1
+ //
+ MadDimm.Bits.DAS = 1;
+ }
+ //
+ // Dimm A
+ //
+ if ((0 < DimmA->RankInDIMM) && (DimmA->Status == DIMM_PRESENT)) {
+ DimmCapacity = DimmA->DimmCapacity / 256;
+ MadDimm.Bits.DIMM_A_Size = MIN (DimmCapacity, MCDECS_CR_MAD_DIMM_CH0_MCMAIN_DIMM_A_Size_MAX);
+ //
+ // RankInDIMM must be 1 or 2, we test the case that the value is 0
+ //
+ Scratch = DimmA->RankInDIMM - 1;
+ MadDimm.Bits.DANOR = MIN (Scratch, MCDECS_CR_MAD_DIMM_CH0_MCMAIN_DANOR_MAX);
+ //
+ // SDRAM width x8 or x32 set to 0, x16 set to 1
+ //
+ MadDimm.Bits.DAW = (DimmA->SdramWidth == 16) ? 1 : 0;
+ }
+ //
+ // Dimm B
+ //
+ if ((MAX_DIMMS_IN_CHANNEL > 1) && (0 < DimmB->RankInDIMM) && (DimmB->Status == DIMM_PRESENT)) {
+ DimmCapacity = DimmB->DimmCapacity / 256;
+ MadDimm.Bits.DIMM_B_Size = MIN (DimmCapacity, MCDECS_CR_MAD_DIMM_CH0_MCMAIN_DIMM_B_Size_MAX);
+ //
+ // RankInDIMM must be 1 or 2, we test the case that this value is 0.
+ //
+ Scratch = DimmB->RankInDIMM - 1;
+ MadDimm.Bits.DBNOR = MIN (Scratch, MCDECS_CR_MAD_DIMM_CH0_MCMAIN_DBNOR_MAX);
+
+ //
+ // SDRAM width x8 or x32 set to 0, x16 set to 1
+ //
+ MadDimm.Bits.DBW = (DimmB->SdramWidth == 16) ? 1 : 0;
+ }
+
+#ifdef ULT_FLAG
+ if (Inputs->CpuModel == cmHSW_ULT) {
+ //
+ // On HSW-ULT only 1DPC is supported, and DBW should have the same value as DAW
+ //
+ MadDimm.Bits.DBW = MadDimm.Bits.DAW;
+ }
+#endif
+
+ if (Inputs->RankInterleave) {
+ MadDimm.Bits.RI = MRC_DIMM_RANK_INTERLEAVE;
+ }
+ if (Inputs->EnhancedInterleave) {
+ MadDimm.Bits.Enh_Interleave = MRC_ENHANCED_INTERLEAVE_MODE;
+ }
+
+ MRC_DEBUG_MSG (&Inputs->Debug, MSG_LEVEL_NOTE, "MAD_DIMM_CH%u = 0x%08X\n", ChannelIndex, MadDimm.Data);
+ MrcWriteCR (
+ MrcData,
+ MCDECS_CR_MAD_DIMM_CH0_MCMAIN_REG +
+ (ChannelIndex * (MCDECS_CR_MAD_DIMM_CH1_MCMAIN_REG - MCDECS_CR_MAD_DIMM_CH0_MCMAIN_REG)),
+ MadDimm.Data
+ );
+
+#ifdef ULT_FLAG
+ if (Outputs->DdrType == MRC_DDR_TYPE_LPDDR3) {
+ LpddrMrParams.Data = 0;
+ LpddrMrParams.Bits.MR4_PERIOD = 0x200D;
+
+ if (DimmA->SdramWidth == 32) {
+ LpddrMrParams.Bits.Rank_0_x32 = 1;
+ LpddrMrParams.Bits.Rank_1_x32 = 1;
+ }
+
+ MrcWriteCR (
+ MrcData,
+ MCHBAR_CH0_CR_LPDDR_MR_PARAMS_REG +
+ (ChannelIndex * (MCHBAR_CH1_CR_LPDDR_MR_PARAMS_REG - MCHBAR_CH0_CR_LPDDR_MR_PARAMS_REG)),
+ LpddrMrParams.Data
+ );
+ }
+#endif // ULT_FLAG
+ return;
+}
+
+/**
+@brief
+ This function is the main address decoding configuration function.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval Nothing.
+**/
+void
+MrcAdConfiguration (
+ IN MrcParameters *const MrcData
+)
+{
+ MrcOutput *Outputs;
+ MrcChannelOut *ChannelOut;
+ MrcControllerOut *ControllerOut;
+ MrcDimmOut *DimmOut;
+ U8 Controller;
+ U8 Channel;
+ U8 Dimm;
+
+ ZoneConfiguration (MrcData);
+
+ Outputs = &MrcData->SysOut.Outputs;
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!MrcChannelExist (Outputs, Channel)) {
+ continue;
+ }
+ ChannelOut = &ControllerOut->Channel[Channel];
+
+ ChannelAddressDecodeConfiguration (MrcData, Channel);
+
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; ++Dimm) {
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ if (DimmOut->Status == DIMM_PRESENT) {
+ MRC_DEBUG_MSG (
+ &MrcData->SysIn.Inputs.Debug,
+ MSG_LEVEL_NOTE,
+ "Channel: %u, Dimm %d Rank in DIMM is: %u\n",
+ Channel,
+ Dimm,
+ DimmOut->RankInDIMM
+ );
+ }
+ } // for Dimm
+ } // for Channel
+ } // for Controller
+
+ return;
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/McConfiguration/MrcAddressDecodeConfiguration.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/McConfiguration/MrcAddressDecodeConfiguration.h
new file mode 100644
index 0000000..b502ec6
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/McConfiguration/MrcAddressDecodeConfiguration.h
@@ -0,0 +1,78 @@
+/** @file
+ This module configures the memory controller address decoder.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+*/
+#ifndef _MrcAddressConfiguration_h_
+#define _MrcAddressConfiguration_h_
+
+#include "MrcTypes.h"
+#include "MrcGlobal.h"
+#include "MrcApi.h"
+#include "McAddress.h"
+#include "MrcCommon.h"
+#include "MrcOem.h"
+#include "MrcCommon.h"
+#include "MrcOemDebugPrint.h"
+
+/**
+@brief
+ This function is the main address decoding configuration function.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval Nothing.
+
+**/
+extern
+void
+MrcAdConfiguration (
+ IN MrcParameters *const MrcData
+ );
+
+/**
+@brief
+ This function configures the zone configuration registers MAD-CR and MAD-ZR-CR.
+
+ @param[in, out] MrcData - Include all MRC global data.
+
+ @retval Nothing.
+**/
+extern
+void
+ZoneConfiguration (
+ IN OUT MrcParameters *const MrcData
+ );
+
+/**
+@brief
+ This function configures the MAD_DIMM_CH0/1 register.
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] ChannelIndex - Channel index
+
+ @retval Nothing.
+**/
+extern
+void
+ChannelAddressDecodeConfiguration (
+ IN MrcParameters *const MrcData,
+ IN const U32 ChannelIndex
+ );
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/McConfiguration/MrcPowerModes.c b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/McConfiguration/MrcPowerModes.c
new file mode 100644
index 0000000..9c06a65
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/McConfiguration/MrcPowerModes.c
@@ -0,0 +1,1034 @@
+/** @file
+ This module configures the memory controller power modes.
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved.
+
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+
+**/
+
+///
+/// Include files
+///
+#include "MrcPowerModes.h"
+#include "MrcOemDebugPrint.h"
+#include "MrcSpdProcessing.h"
+
+const Ddr3PowerWeightEntry Ddr3PowerWeightTable[] = {
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1067, DENSITY_2, 0}}, 4, 0x6A, 0xCA, 0x82, 0x9, 0x10, 0x08},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1067, DENSITY_2, 0}}, 3, 0x34, 0x89, 0x40, 0x5, 0x07, 0x0B},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1067, DENSITY_4, 0}}, 4, 0x78, 0xD6, 0x86, 0xB, 0x13, 0x09},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1067, DENSITY_4, 0}}, 3, 0x3B, 0x8F, 0x42, 0x6, 0x09, 0x0E},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1067, DENSITY_2, 0}}, 4, 0x5B, 0xB0, 0x7C, 0x5, 0x0B, 0x07},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1067, DENSITY_2, 0}}, 4, 0x58, 0xF7, 0x7A, 0x5, 0x09, 0x09},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1067, DENSITY_4, 0}}, 4, 0x66, 0xB9, 0x81, 0x6, 0x0D, 0x08},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1067, DENSITY_4, 0}}, 3, 0x32, 0x80, 0x40, 0x3, 0x05, 0x09},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1067, DENSITY_2, 0}}, 3, 0x9F, 0xCA, 0x40, 0x5, 0x07, 0x11},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1067, DENSITY_2, 0}}, 3, 0x9E, 0xCA, 0x3F, 0x5, 0x07, 0x18},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1067, DENSITY_4, 0}}, 3, 0xA6, 0xD0, 0x42, 0x6, 0x09, 0x13},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1067, DENSITY_4, 0}}, 3, 0xA5, 0xD0, 0x41, 0x6, 0x08, 0x1A},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1067, DENSITY_2, 0}}, 3, 0x98, 0xBD, 0x3D, 0x3, 0x05, 0x0F},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1067, DENSITY_2, 0}}, 3, 0x97, 0xBD, 0x3D, 0x3, 0x04, 0x12},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1067, DENSITY_4, 0}}, 3, 0x9D, 0xC2, 0x40, 0x3, 0x06, 0x10},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1067, DENSITY_4, 0}}, 3, 0x9C, 0xC1, 0x3F, 0x3, 0x05, 0x14},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1333, DENSITY_2, 0}}, 4, 0x66, 0xB3, 0x88, 0x8, 0x0E, 0x0A},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1333, DENSITY_2, 0}}, 4, 0x64, 0xB1, 0x86, 0x8, 0x0C, 0x0D},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1333, DENSITY_4, 0}}, 4, 0x74, 0xBF, 0x8B, 0xA, 0x11, 0x0B},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1333, DENSITY_4, 0}}, 4, 0x72, 0xBD, 0x89, 0xA, 0x0F, 0x0F},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1333, DENSITY_2, 0}}, 4, 0x57, 0x9A, 0x7C, 0x4, 0x0A, 0x08},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1333, DENSITY_2, 0}}, 4, 0x55, 0x98, 0x7A, 0x4, 0x08, 0x0A},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1333, DENSITY_4, 0}}, 4, 0x62, 0xA3, 0x80, 0x5, 0x0B, 0x09},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1333, DENSITY_4, 0}}, 4, 0x60, 0xA1, 0x7E, 0x5, 0x09, 0x0B},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1333, DENSITY_2, 0}}, 3, 0x88, 0xAB, 0x43, 0x4, 0x07, 0x14},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1333, DENSITY_2, 0}}, 3, 0x87, 0xAA, 0x43, 0x4, 0x06, 0x1A},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1333, DENSITY_4, 0}}, 3, 0x8F, 0xB1, 0x45, 0x5, 0x08, 0x15},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1333, DENSITY_4, 0}}, 3, 0x8F, 0xB0, 0x44, 0x5, 0x07, 0x1D},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1333, DENSITY_2, 0}}, 3, 0x81, 0x9E, 0x3D, 0x2, 0x04, 0x10},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1333, DENSITY_2, 0}}, 3, 0x80, 0x9E, 0x3D, 0x2, 0x04, 0x15},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1333, DENSITY_4, 0}}, 3, 0x86, 0xA3, 0x3F, 0x3, 0x05, 0x11},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1333, DENSITY_4, 0}}, 3, 0x85, 0xA2, 0x3F, 0x3, 0x04, 0x15},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1600, DENSITY_2, 0}}, 4, 0x72, 0xFD, 0x90, 0x7, 0x0D, 0x0C},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1600, DENSITY_2, 0}}, 4, 0x71, 0xFB, 0x8E, 0x7, 0x0B, 0x0F},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1600, DENSITY_4, 0}}, 3, 0x40, 0x85, 0x4A, 0x5, 0x08, 0x0E},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1600, DENSITY_4, 0}}, 3, 0x3F, 0x84, 0x49, 0x5, 0x07, 0x12},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1600, DENSITY_2, 0}}, 4, 0x62, 0xE4, 0x7E, 0x4, 0x09, 0x0A},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1600, DENSITY_2, 0}}, 4, 0x61, 0xE3, 0x7C, 0x4, 0x07, 0x0C},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1600, DENSITY_4, 0}}, 4, 0x6C, 0xED, 0x82, 0x5, 0x0A, 0x0B},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1600, DENSITY_4, 0}}, 4, 0x6B, 0xEB, 0x80, 0x5, 0x08, 0x0D},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1600, DENSITY_2, 0}}, 3, 0x8E, 0xCE, 0x47, 0x4, 0x06, 0x17},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1600, DENSITY_2, 0}}, 3, 0x8E, 0xCD, 0x47, 0x4, 0x06, 0x20},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1600, DENSITY_4, 0}}, 3, 0x95, 0xD4, 0x49, 0x5, 0x07, 0x19},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1600, DENSITY_4, 0}}, 3, 0x95, 0xD3, 0x48, 0x5, 0x07, 0x23},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1600, DENSITY_2, 0}}, 3, 0x86, 0xC1, 0x3E, 0x2, 0x04, 0x13},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1600, DENSITY_2, 0}}, 3, 0x86, 0xC1, 0x3E, 0x2, 0x03, 0x16},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1600, DENSITY_4, 0}}, 3, 0x8C, 0xC6, 0x40, 0x3, 0x04, 0x14},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1600, DENSITY_4, 0}}, 3, 0x8B, 0xC5, 0x40, 0x3, 0x04, 0x1A},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1867, DENSITY_2, 0}}, 4, 0x6F, 0xE6, 0x9C, 0x7, 0x0C, 0x0E},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1867, DENSITY_2, 0}}, 4, 0x6D, 0xE4, 0x9B, 0x7, 0x0B, 0x12},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1867, DENSITY_4, 0}}, 4, 0x7C, 0xF1, 0x9F, 0x8, 0x0E, 0x0F},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1867, DENSITY_4, 0}}, 4, 0x7B, 0xF0, 0x9D, 0x8, 0x0D, 0x14},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1867, DENSITY_2, 0}}, 4, 0x5F, 0xCE, 0x83, 0x4, 0x08, 0x0B},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1867, DENSITY_2, 0}}, 4, 0x5E, 0xCC, 0x82, 0x4, 0x06, 0x0D},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1867, DENSITY_4, 0}}, 4, 0x69, 0xD6, 0x87, 0x5, 0x09, 0x0C},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1867, DENSITY_4, 0}}, 4, 0x68, 0xD5, 0x86, 0x5, 0x07, 0x0E},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1867, DENSITY_2, 0}}, 3, 0x81, 0xB7, 0x4E, 0x4, 0x06, 0x1A},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1867, DENSITY_2, 0}}, 3, 0x80, 0xB6, 0x4D, 0x4, 0x05, 0x21},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1867, DENSITY_4, 0}}, 3, 0x87, 0xBD, 0x4F, 0x4, 0x07, 0x1C},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1867, DENSITY_4, 0}}, 3, 0x87, 0xBC, 0x4F, 0x4, 0x06, 0x25},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1867, DENSITY_2, 0}}, 3, 0x79, 0xAB, 0x41, 0x2, 0x04, 0x15},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1867, DENSITY_2, 0}}, 3, 0x78, 0xAA, 0x41, 0x2, 0x03, 0x19},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1867, DENSITY_4, 0}}, 3, 0x7E, 0xAF, 0x43, 0x3, 0x04, 0x16},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1867, DENSITY_4, 0}}, 3, 0x7D, 0xAF, 0x43, 0x3, 0x04, 0x1D},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_2133, DENSITY_2, 0}}, 4, 0x6C, 0xD4, 0xA6, 0x6, 0x0B, 0x0F},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_2133, DENSITY_2, 0}}, 4, 0x6B, 0xD3, 0xA4, 0x6, 0x0A, 0x13},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_2133, DENSITY_4, 0}}, 4, 0x7A, 0xE0, 0xA8, 0x8, 0x0D, 0x11},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_2133, DENSITY_4, 0}}, 4, 0x79, 0xDE, 0xA7, 0x8, 0x0C, 0x16},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_2133, DENSITY_2, 0}}, 4, 0x5C, 0xBD, 0x87, 0x3, 0x07, 0x0C},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_2133, DENSITY_2, 0}}, 4, 0x5B, 0xBB, 0x85, 0x3, 0x06, 0x0E},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_2133, DENSITY_4, 0}}, 4, 0x66, 0xC5, 0x8A, 0x4, 0x08, 0x0D},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_2133, DENSITY_4, 0}}, 4, 0x65, 0xC3, 0x89, 0x4, 0x07, 0x10},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_2133, DENSITY_2, 0}}, 3, 0x76, 0xA6, 0x52, 0x3, 0x05, 0x1A},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_2133, DENSITY_2, 0}}, 3, 0x76, 0xA5, 0x52, 0x3, 0x05, 0x24},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_2133, DENSITY_4, 0}}, 3, 0x7D, 0xAB, 0x54, 0x4, 0x06, 0x1D},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_2133, DENSITY_4, 0}}, 3, 0x7D, 0xAB, 0x53, 0x4, 0x06, 0x29},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_2133, DENSITY_2, 0}}, 3, 0x6E, 0x9A, 0x43, 0x2, 0x03, 0x15},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_2133, DENSITY_2, 0}}, 3, 0x6E, 0x9A, 0x43, 0x2, 0x03, 0x1B},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_2133, DENSITY_4, 0}}, 3, 0x73, 0x9E, 0x45, 0x2, 0x04, 0x18},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_2133, DENSITY_4, 0}}, 3, 0x73, 0x9D, 0x44, 0x2, 0x03, 0x1C},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1067, DENSITY_2, 0}}, 4, 0x77, 0xC9, 0x82, 0x9, 0x10, 0x09},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1067, DENSITY_2, 0}}, 4, 0x75, 0xC7, 0x7F, 0x9, 0x0E, 0x0C},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1067, DENSITY_4, 0}}, 4, 0x85, 0xD6, 0x86, 0xB, 0x13, 0x0A},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1067, DENSITY_4, 0}}, 4, 0x83, 0xD3, 0x83, 0xB, 0x11, 0x0D},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1067, DENSITY_2, 0}}, 4, 0x68, 0xB0, 0x7C, 0x5, 0x0B, 0x07},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1067, DENSITY_2, 0}}, 4, 0x66, 0xAE, 0x7A, 0x5, 0x09, 0x09},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1067, DENSITY_4, 0}}, 4, 0x73, 0xB9, 0x81, 0x6, 0x0D, 0x08},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1067, DENSITY_4, 0}}, 4, 0x71, 0xB7, 0x7E, 0x6, 0x0A, 0x0A},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1067, DENSITY_2, 0}}, 3, 0xBD, 0xE8, 0x40, 0x5, 0x07, 0x13},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1067, DENSITY_2, 0}}, 3, 0xBD, 0xE8, 0x3F, 0x5, 0x07, 0x1A},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1067, DENSITY_4, 0}}, 3, 0xC4, 0xEF, 0x42, 0x6, 0x09, 0x15},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1067, DENSITY_4, 0}}, 3, 0xC3, 0xEE, 0x41, 0x6, 0x08, 0x1C},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1067, DENSITY_2, 0}}, 3, 0xB6, 0xDC, 0x3D, 0x3, 0x05, 0x11},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1067, DENSITY_2, 0}}, 3, 0xB5, 0xDB, 0x3D, 0x3, 0x04, 0x14},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1067, DENSITY_4, 0}}, 3, 0xBB, 0xE0, 0x40, 0x3, 0x06, 0x12},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1067, DENSITY_4, 0}}, 3, 0xBB, 0xDF, 0x3F, 0x3, 0x05, 0x16},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1333, DENSITY_2, 0}}, 4, 0x71, 0xB2, 0x88, 0x8, 0x0E, 0x0A},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1333, DENSITY_2, 0}}, 4, 0x6F, 0xB1, 0x86, 0x8, 0x0C, 0x0D},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1333, DENSITY_4, 0}}, 4, 0x7F, 0xBF, 0x8B, 0xA, 0x11, 0x0B},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1333, DENSITY_4, 0}}, 4, 0x7D, 0xBD, 0x89, 0xA, 0x0F, 0x0F},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1333, DENSITY_2, 0}}, 4, 0x62, 0x9A, 0x7C, 0x4, 0x0A, 0x08},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1333, DENSITY_2, 0}}, 4, 0x60, 0x98, 0x7A, 0x4, 0x08, 0x0A},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1333, DENSITY_4, 0}}, 4, 0x6D, 0xA3, 0x80, 0x5, 0x0B, 0x09},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1333, DENSITY_4, 0}}, 4, 0x6B, 0xA1, 0x7E, 0x5, 0x09, 0x0B},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1333, DENSITY_2, 0}}, 3, 0xA0, 0xC3, 0x43, 0x4, 0x07, 0x15},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1333, DENSITY_2, 0}}, 3, 0xA0, 0xC2, 0x43, 0x4, 0x06, 0x1C},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1333, DENSITY_4, 0}}, 3, 0xA7, 0xC9, 0x45, 0x5, 0x08, 0x17},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1333, DENSITY_4, 0}}, 3, 0xA7, 0xC8, 0x44, 0x5, 0x07, 0x1F},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1333, DENSITY_2, 0}}, 3, 0x99, 0xB6, 0x3D, 0x2, 0x04, 0x11},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1333, DENSITY_2, 0}}, 3, 0x98, 0xB6, 0x3D, 0x2, 0x04, 0x16},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1333, DENSITY_4, 0}}, 3, 0x9E, 0xBB, 0x3F, 0x3, 0x05, 0x13},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1333, DENSITY_4, 0}}, 3, 0x9E, 0xBA, 0x3F, 0x3, 0x04, 0x17},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1600, DENSITY_2, 0}}, 4, 0x79, 0xD2, 0x90, 0x7, 0x0D, 0x0C},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1600, DENSITY_2, 0}}, 4, 0x77, 0xD0, 0x8E, 0x7, 0x0B, 0x0F},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1600, DENSITY_4, 0}}, 4, 0x87, 0xDE, 0x93, 0x9, 0x0F, 0x0D},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1600, DENSITY_4, 0}}, 4, 0x85, 0xDC, 0x91, 0x9, 0x0D, 0x11},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1600, DENSITY_2, 0}}, 4, 0x69, 0xBA, 0x7E, 0x4, 0x08, 0x0A},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1600, DENSITY_2, 0}}, 4, 0x67, 0xB8, 0x7C, 0x4, 0x07, 0x0C},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1600, DENSITY_4, 0}}, 4, 0x73, 0xC2, 0x81, 0x5, 0x0A, 0x0B},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1600, DENSITY_4, 0}}, 4, 0x72, 0xC0, 0x80, 0x5, 0x08, 0x0D},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1600, DENSITY_2, 0}}, 3, 0x8E, 0xBA, 0x47, 0x4, 0x06, 0x17},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1600, DENSITY_2, 0}}, 3, 0x8E, 0xBA, 0x47, 0x4, 0x06, 0x20},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1600, DENSITY_4, 0}}, 3, 0x95, 0xC0, 0x49, 0x5, 0x07, 0x19},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1600, DENSITY_4, 0}}, 3, 0x94, 0xC0, 0x48, 0x5, 0x07, 0x23},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1600, DENSITY_2, 0}}, 3, 0x86, 0xAE, 0x3E, 0x2, 0x04, 0x13},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1600, DENSITY_2, 0}}, 3, 0x86, 0xAE, 0x3E, 0x2, 0x03, 0x16},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1600, DENSITY_4, 0}}, 3, 0x8B, 0xB2, 0x40, 0x3, 0x04, 0x14},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1600, DENSITY_4, 0}}, 3, 0x8B, 0xB2, 0x40, 0x3, 0x04, 0x1A},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1867, DENSITY_2, 0}}, 4, 0x75, 0xC1, 0x9C, 0x7, 0x0C, 0x0E},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1867, DENSITY_2, 0}}, 4, 0x73, 0xBF, 0x9B, 0x7, 0x0B, 0x12},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1867, DENSITY_4, 0}}, 4, 0x82, 0xCC, 0x9F, 0x8, 0x0E, 0x0F},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1867, DENSITY_4, 0}}, 4, 0x81, 0xCB, 0x9D, 0x8, 0x0C, 0x14},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1867, DENSITY_2, 0}}, 4, 0x65, 0xA9, 0x83, 0x4, 0x08, 0x0B},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1867, DENSITY_2, 0}}, 4, 0x64, 0xA8, 0x82, 0x4, 0x06, 0x0D},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1867, DENSITY_4, 0}}, 4, 0x6F, 0xB1, 0x87, 0x5, 0x09, 0x0C},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1867, DENSITY_4, 0}}, 4, 0x6E, 0xB0, 0x86, 0x5, 0x07, 0x0E},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1867, DENSITY_2, 0}}, 3, 0x80, 0xA6, 0x4E, 0x4, 0x06, 0x1A},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1867, DENSITY_2, 0}}, 3, 0x80, 0xA6, 0x4D, 0x4, 0x05, 0x21},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1867, DENSITY_4, 0}}, 3, 0x87, 0xAC, 0x4F, 0x4, 0x07, 0x1C},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1867, DENSITY_4, 0}}, 3, 0x87, 0xAB, 0x4F, 0x4, 0x06, 0x25},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1867, DENSITY_2, 0}}, 3, 0x78, 0x9A, 0x41, 0x2, 0x04, 0x15},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1867, DENSITY_2, 0}}, 3, 0x78, 0x9A, 0x41, 0x2, 0x03, 0x19},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1867, DENSITY_4, 0}}, 3, 0x7D, 0x9E, 0x43, 0x3, 0x04, 0x16},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1867, DENSITY_4, 0}}, 3, 0x7D, 0x9E, 0x43, 0x3, 0x04, 0x1D},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_2133, DENSITY_2, 0}}, 4, 0x72, 0xB4, 0xA5, 0x6, 0x0B, 0x0F},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_2133, DENSITY_2, 0}}, 4, 0x70, 0xB3, 0xA4, 0x6, 0x0A, 0x14},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_2133, DENSITY_4, 0}}, 4, 0x7F, 0xC0, 0xA8, 0x8, 0x0D, 0x11},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_2133, DENSITY_4, 0}}, 4, 0x7E, 0xBE, 0xA7, 0x8, 0x0C, 0x16},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_2133, DENSITY_2, 0}}, 4, 0x61, 0x9D, 0x87, 0x3, 0x07, 0x0C},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_2133, DENSITY_2, 0}}, 4, 0x60, 0x9B, 0x85, 0x3, 0x06, 0x0E},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_2133, DENSITY_4, 0}}, 4, 0x6B, 0xA4, 0x8A, 0x4, 0x08, 0x0D},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_2133, DENSITY_4, 0}}, 4, 0x6A, 0xA3, 0x89, 0x4, 0x07, 0x10},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_2133, DENSITY_2, 0}}, 3, 0x76, 0x97, 0x52, 0x3, 0x05, 0x1A},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_2133, DENSITY_2, 0}}, 3, 0x76, 0x97, 0x52, 0x3, 0x05, 0x24},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_2133, DENSITY_4, 0}}, 3, 0x7D, 0x9D, 0x54, 0x4, 0x06, 0x1D},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_2133, DENSITY_4, 0}}, 3, 0x7C, 0x9C, 0x53, 0x4, 0x06, 0x29},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_2133, DENSITY_2, 0}}, 3, 0x6E, 0x8B, 0x43, 0x2, 0x03, 0x15},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_2133, DENSITY_2, 0}}, 3, 0x6D, 0x8B, 0x43, 0x2, 0x03, 0x1B},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_2133, DENSITY_4, 0}}, 3, 0x73, 0x8F, 0x45, 0x2, 0x04, 0x18},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_2133, DENSITY_4, 0}}, 3, 0x72, 0x8F, 0x44, 0x2, 0x03, 0x1C},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1067, DENSITY_2, 0}}, 4, 0x85, 0xE2, 0x91, 0xA, 0x12, 0x08},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1067, DENSITY_2, 0}}, 4, 0x83, 0xDF, 0x8F, 0xA, 0x0F, 0x0B},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1067, DENSITY_4, 0}}, 4, 0x95, 0xF0, 0x96, 0xD, 0x15, 0x09},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1067, DENSITY_4, 0}}, 4, 0x92, 0xED, 0x93, 0xD, 0x13, 0x0D},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1067, DENSITY_2, 0}}, 4, 0x7E, 0xCF, 0x9A, 0x6, 0x0C, 0x06},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1067, DENSITY_2, 0}}, 4, 0x7B, 0xCC, 0x98, 0x6, 0x0A, 0x08},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1067, DENSITY_4, 0}}, 4, 0x8B, 0xDA, 0xA0, 0x7, 0x0E, 0x07},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1067, DENSITY_4, 0}}, 4, 0x89, 0xD7, 0x9D, 0x7, 0x0C, 0x0A},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1067, DENSITY_2, 0}}, 2, 0x77, 0x8C, 0x24, 0x3, 0x04, 0x0F},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1067, DENSITY_2, 0}}, 2, 0x76, 0x8C, 0x24, 0x3, 0x04, 0x17},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1067, DENSITY_4, 0}}, 2, 0x7B, 0x90, 0x25, 0x4, 0x05, 0x11},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1067, DENSITY_4, 0}}, 2, 0x7A, 0x8F, 0x25, 0x4, 0x05, 0x1B},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1067, DENSITY_2, 0}}, 2, 0x75, 0x87, 0x26, 0x2, 0x03, 0x0D},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1067, DENSITY_2, 0}}, 2, 0x74, 0x87, 0x26, 0x2, 0x03, 0x13},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1067, DENSITY_4, 0}}, 2, 0x78, 0x8A, 0x28, 0x2, 0x03, 0x0D},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1067, DENSITY_4, 0}}, 2, 0x78, 0x8A, 0x27, 0x2, 0x03, 0x13},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1333, DENSITY_2, 0}}, 4, 0x7E, 0xC8, 0x98, 0x9, 0x10, 0x09},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1333, DENSITY_2, 0}}, 4, 0x7C, 0xC6, 0x96, 0x9, 0x0E, 0x0D},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1333, DENSITY_4, 0}}, 4, 0x8E, 0xD6, 0x9C, 0xB, 0x12, 0x0A},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1333, DENSITY_4, 0}}, 4, 0x8C, 0xD4, 0x9A, 0xB, 0x10, 0x0E},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1333, DENSITY_2, 0}}, 4, 0x77, 0xB6, 0x9A, 0x5, 0x0B, 0x07},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1333, DENSITY_2, 0}}, 4, 0x75, 0xB4, 0x98, 0x5, 0x09, 0x0A},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1333, DENSITY_4, 0}}, 4, 0x84, 0xC0, 0x9F, 0x7, 0x0C, 0x08},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1333, DENSITY_4, 0}}, 4, 0x82, 0xBE, 0x9D, 0x7, 0x0A, 0x0A},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1333, DENSITY_2, 0}}, 2, 0x83, 0x92, 0x26, 0x3, 0x04, 0x13},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1333, DENSITY_2, 0}}, 2, 0x82, 0x92, 0x26, 0x3, 0x04, 0x1D},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1333, DENSITY_4, 0}}, 2, 0x87, 0x96, 0x27, 0x3, 0x05, 0x16},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1333, DENSITY_4, 0}}, 2, 0x86, 0x95, 0x27, 0x3, 0x04, 0x1D},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1333, DENSITY_2, 0}}, 2, 0x81, 0x8E, 0x26, 0x2, 0x03, 0x11},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1333, DENSITY_2, 0}}, 2, 0x80, 0x8D, 0x26, 0x2, 0x02, 0x13},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1333, DENSITY_4, 0}}, 2, 0x84, 0x90, 0x28, 0x2, 0x03, 0x11},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1333, DENSITY_4, 0}}, 2, 0x84, 0x90, 0x27, 0x2, 0x03, 0x18},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1600, DENSITY_2, 0}}, 4, 0x7A, 0xB8, 0xA1, 0x8, 0x0E, 0x0A},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1600, DENSITY_2, 0}}, 4, 0x79, 0xB6, 0xA0, 0x8, 0x0C, 0x0E},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1600, DENSITY_4, 0}}, 4, 0x8A, 0xC5, 0xA5, 0xA, 0x10, 0x0B},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1600, DENSITY_4, 0}}, 4, 0x88, 0xC4, 0xA3, 0xA, 0x0F, 0x10},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1600, DENSITY_2, 0}}, 4, 0x71, 0xA6, 0x9C, 0x5, 0x0A, 0x08},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1600, DENSITY_2, 0}}, 4, 0x70, 0xA4, 0x9A, 0x5, 0x08, 0x0B},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1600, DENSITY_4, 0}}, 4, 0x7E, 0xB0, 0xA1, 0x6, 0x0B, 0x09},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1600, DENSITY_4, 0}}, 4, 0x7C, 0xAE, 0x9F, 0x6, 0x09, 0x0C},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1600, DENSITY_2, 0}}, 3, 0xE2, 0xFC, 0x50, 0x4, 0x07, 0x14},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1600, DENSITY_2, 0}}, 3, 0xE1, 0xFB, 0x50, 0x4, 0x06, 0x1C},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1600, DENSITY_4, 0}}, 2, 0x75, 0x82, 0x29, 0x3, 0x04, 0x16},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1600, DENSITY_4, 0}}, 2, 0x75, 0x81, 0x29, 0x3, 0x04, 0x22},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1600, DENSITY_2, 0}}, 3, 0xDD, 0xF3, 0x4E, 0x3, 0x04, 0x10},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1600, DENSITY_2, 0}}, 3, 0xDD, 0xF2, 0x4D, 0x3, 0x04, 0x16},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1600, DENSITY_4, 0}}, 3, 0xE4, 0xF8, 0x50, 0x3, 0x05, 0x12},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1600, DENSITY_4, 0}}, 3, 0xE3, 0xF7, 0x50, 0x3, 0x05, 0x19},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1867, DENSITY_2, 0}}, 4, 0x77, 0xAC, 0xAF, 0x7, 0x0D, 0x0B},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1867, DENSITY_2, 0}}, 4, 0x76, 0xAB, 0xAE, 0x7, 0x0C, 0x10},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1867, DENSITY_4, 0}}, 4, 0x86, 0xB9, 0xB2, 0x9, 0x0F, 0x0D},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1867, DENSITY_4, 0}}, 4, 0x85, 0xB8, 0xB1, 0x9, 0x0E, 0x12},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1867, DENSITY_2, 0}}, 4, 0x6F, 0x9A, 0xA3, 0x4, 0x09, 0x09},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1867, DENSITY_2, 0}}, 4, 0x6D, 0x99, 0xA2, 0x4, 0x07, 0x0C},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1867, DENSITY_4, 0}}, 4, 0x7B, 0xA5, 0xA8, 0x5, 0x0A, 0x0A},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1867, DENSITY_4, 0}}, 4, 0x7A, 0xA3, 0xA7, 0x5, 0x09, 0x0E},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1867, DENSITY_2, 0}}, 3, 0xC9, 0xDF, 0x57, 0x4, 0x06, 0x15},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1867, DENSITY_2, 0}}, 3, 0xC8, 0xDF, 0x57, 0x4, 0x06, 0x20},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1867, DENSITY_4, 0}}, 3, 0xD0, 0xE6, 0x59, 0x5, 0x07, 0x17},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1867, DENSITY_4, 0}}, 3, 0xD0, 0xE5, 0x58, 0x5, 0x07, 0x24},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1867, DENSITY_2, 0}}, 3, 0xC5, 0xD6, 0x51, 0x2, 0x04, 0x12},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1867, DENSITY_2, 0}}, 3, 0xC4, 0xD6, 0x51, 0x2, 0x04, 0x19},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1867, DENSITY_4, 0}}, 3, 0xCB, 0xDB, 0x54, 0x3, 0x05, 0x14},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1867, DENSITY_4, 0}}, 3, 0xCB, 0xDB, 0x53, 0x3, 0x04, 0x19},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_2133, DENSITY_2, 0}}, 4, 0x75, 0xA4, 0xBA, 0x7, 0x0C, 0x0D},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_2133, DENSITY_2, 0}}, 4, 0x74, 0xA2, 0xB9, 0x7, 0x0B, 0x12},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_2133, DENSITY_4, 0}}, 4, 0x84, 0xB0, 0xBC, 0x9, 0x0E, 0x0E},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_2133, DENSITY_4, 0}}, 4, 0x83, 0xAF, 0xBB, 0x9, 0x0D, 0x14},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_2133, DENSITY_2, 0}}, 4, 0x6C, 0x92, 0xA7, 0x4, 0x08, 0x0A},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_2133, DENSITY_2, 0}}, 4, 0x6A, 0x91, 0xA6, 0x4, 0x07, 0x0D},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_2133, DENSITY_4, 0}}, 4, 0x78, 0x9C, 0xAC, 0x5, 0x09, 0x0B},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_2133, DENSITY_4, 0}}, 4, 0x77, 0x9B, 0xAB, 0x5, 0x08, 0x0E},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_2133, DENSITY_2, 0}}, 3, 0xB6, 0xCA, 0x5D, 0x4, 0x06, 0x18},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_2133, DENSITY_2, 0}}, 3, 0xB6, 0xC9, 0x5C, 0x4, 0x06, 0x24},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_2133, DENSITY_4, 0}}, 3, 0xBE, 0xD0, 0x5E, 0x5, 0x07, 0x1A},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_2133, DENSITY_4, 0}}, 3, 0xBD, 0xD0, 0x5E, 0x5, 0x06, 0x24},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_2133, DENSITY_2, 0}}, 3, 0xB1, 0xC1, 0x53, 0x2, 0x04, 0x13},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_2133, DENSITY_2, 0}}, 3, 0xB1, 0xC1, 0x53, 0x2, 0x03, 0x17},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_2133, DENSITY_4, 0}}, 3, 0xB8, 0xC6, 0x56, 0x3, 0x04, 0x14},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_2133, DENSITY_4, 0}}, 3, 0xB7, 0xC6, 0x55, 0x3, 0x04, 0x1C},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1067, DENSITY_2, 0}}, 4, 0x56, 0xA3, 0x69, 0x7, 0x0D, 0x07},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1067, DENSITY_2, 0}}, 4, 0x54, 0xDD, 0x67, 0x7, 0x0B, 0x09},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1067, DENSITY_4, 0}}, 4, 0x61, 0xAD, 0x6C, 0x9, 0x10, 0x08},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1067, DENSITY_4, 0}}, 4, 0x5F, 0xE7, 0x6A, 0x9, 0x0E, 0x0B},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1067, DENSITY_2, 0}}, 4, 0x4A, 0x8F, 0x65, 0x4, 0x09, 0x06},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1067, DENSITY_2, 0}}, 4, 0x48, 0xC9, 0x63, 0x4, 0x07, 0x07},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1067, DENSITY_4, 0}}, 4, 0x53, 0x96, 0x69, 0x5, 0x0A, 0x06},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1067, DENSITY_4, 0}}, 4, 0x51, 0xD0, 0x67, 0x5, 0x08, 0x08},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1067, DENSITY_2, 0}}, 3, 0x81, 0xA4, 0x34, 0x4, 0x06, 0x0E},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1067, DENSITY_2, 0}}, 3, 0x80, 0xA3, 0x33, 0x4, 0x06, 0x14},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1067, DENSITY_4, 0}}, 3, 0x87, 0xA9, 0x36, 0x5, 0x07, 0x10},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1067, DENSITY_4, 0}}, 3, 0x86, 0xA8, 0x35, 0x5, 0x07, 0x16},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1067, DENSITY_2, 0}}, 3, 0x7B, 0x9A, 0x32, 0x2, 0x04, 0x0C},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1067, DENSITY_2, 0}}, 3, 0x7A, 0x99, 0x31, 0x2, 0x03, 0x0E},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1067, DENSITY_4, 0}}, 3, 0x7F, 0x9D, 0x34, 0x3, 0x05, 0x0D},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1067, DENSITY_4, 0}}, 3, 0x7F, 0x9D, 0x33, 0x3, 0x04, 0x10},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1333, DENSITY_2, 0}}, 4, 0x53, 0x91, 0x6E, 0x6, 0x0C, 0x08},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1333, DENSITY_2, 0}}, 4, 0x51, 0x8F, 0x6D, 0x6, 0x0A, 0x0B},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1333, DENSITY_4, 0}}, 4, 0x5E, 0x9B, 0x71, 0x8, 0x0E, 0x09},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1333, DENSITY_4, 0}}, 4, 0x5C, 0x99, 0x6F, 0x8, 0x0C, 0x0C},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1333, DENSITY_2, 0}}, 5, 0x8D, 0xF9, 0xC9, 0x7, 0x0F, 0x06},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1333, DENSITY_2, 0}}, 5, 0x8A, 0xF6, 0xC5, 0x7, 0x0C, 0x08},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1333, DENSITY_4, 0}}, 4, 0x4F, 0x84, 0x68, 0x4, 0x09, 0x07},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1333, DENSITY_4, 0}}, 4, 0x4E, 0x82, 0x66, 0x4, 0x07, 0x09},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1333, DENSITY_2, 0}}, 3, 0x6E, 0x8A, 0x37, 0x3, 0x05, 0x0F},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1333, DENSITY_2, 0}}, 3, 0x6E, 0x8A, 0x36, 0x3, 0x05, 0x16},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1333, DENSITY_4, 0}}, 3, 0x74, 0x8F, 0x38, 0x4, 0x06, 0x11},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1333, DENSITY_4, 0}}, 3, 0x74, 0x8F, 0x38, 0x4, 0x06, 0x18},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1333, DENSITY_2, 0}}, 3, 0x68, 0x80, 0x32, 0x2, 0x04, 0x0E},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1333, DENSITY_2, 0}}, 4, 0xCF, 0xFF, 0x62, 0x4, 0x06, 0x10},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1333, DENSITY_4, 0}}, 3, 0x6D, 0x84, 0x34, 0x2, 0x04, 0x0E},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1333, DENSITY_4, 0}}, 3, 0x6C, 0x83, 0x33, 0x2, 0x04, 0x13},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1600, DENSITY_2, 0}}, 4, 0x5D, 0xCD, 0x75, 0x6, 0x0B, 0x0A},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1600, DENSITY_2, 0}}, 4, 0x5B, 0xCB, 0x73, 0x6, 0x09, 0x0D},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1600, DENSITY_4, 0}}, 4, 0x68, 0xD6, 0x77, 0x7, 0x0C, 0x0B},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1600, DENSITY_4, 0}}, 4, 0x66, 0xD5, 0x76, 0x7, 0x0B, 0x0E},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1600, DENSITY_2, 0}}, 4, 0x50, 0xB9, 0x66, 0x3, 0x07, 0x08},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1600, DENSITY_2, 0}}, 4, 0x4E, 0xB8, 0x65, 0x3, 0x06, 0x0A},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1600, DENSITY_4, 0}}, 4, 0x58, 0xC0, 0x69, 0x4, 0x08, 0x09},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1600, DENSITY_4, 0}}, 4, 0x57, 0xBE, 0x68, 0x4, 0x07, 0x0B},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1600, DENSITY_2, 0}}, 3, 0x73, 0xA7, 0x3A, 0x3, 0x05, 0x13},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1600, DENSITY_2, 0}}, 3, 0x73, 0xA6, 0x3A, 0x3, 0x05, 0x1A},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1600, DENSITY_4, 0}}, 3, 0x79, 0xAB, 0x3B, 0x4, 0x06, 0x15},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1600, DENSITY_4, 0}}, 3, 0x79, 0xAB, 0x3B, 0x4, 0x05, 0x1B},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1600, DENSITY_2, 0}}, 3, 0x6D, 0x9D, 0x33, 0x2, 0x03, 0x0F},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1600, DENSITY_2, 0}}, 3, 0x6D, 0x9C, 0x32, 0x2, 0x03, 0x14},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1600, DENSITY_4, 0}}, 3, 0x71, 0xA0, 0x34, 0x2, 0x04, 0x11},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1600, DENSITY_4, 0}}, 3, 0x71, 0xA0, 0x34, 0x2, 0x03, 0x14},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1867, DENSITY_2, 0}}, 4, 0x5A, 0xBA, 0x7F, 0x5, 0x0A, 0x0B},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1867, DENSITY_2, 0}}, 4, 0x59, 0xB9, 0x7E, 0x5, 0x09, 0x0F},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1867, DENSITY_4, 0}}, 4, 0x65, 0xC3, 0x81, 0x7, 0x0B, 0x0C},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1867, DENSITY_4, 0}}, 4, 0x64, 0xC2, 0x80, 0x7, 0x0A, 0x10},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1867, DENSITY_2, 0}}, 4, 0x4D, 0xA7, 0x6B, 0x3, 0x06, 0x09},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1867, DENSITY_2, 0}}, 4, 0x4C, 0xA6, 0x69, 0x3, 0x05, 0x0A},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1867, DENSITY_4, 0}}, 4, 0x55, 0xAD, 0x6E, 0x4, 0x07, 0x09},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1867, DENSITY_4, 0}}, 4, 0x54, 0xAC, 0x6C, 0x4, 0x06, 0x0C},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1867, DENSITY_2, 0}}, 3, 0x68, 0x94, 0x3F, 0x3, 0x05, 0x15},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1867, DENSITY_2, 0}}, 3, 0x68, 0x94, 0x3F, 0x3, 0x04, 0x1B},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1867, DENSITY_4, 0}}, 3, 0x6E, 0x99, 0x40, 0x4, 0x05, 0x16},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1867, DENSITY_4, 0}}, 3, 0x6D, 0x98, 0x40, 0x4, 0x05, 0x1E},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1867, DENSITY_2, 0}}, 3, 0x62, 0x8A, 0x35, 0x2, 0x03, 0x11},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1867, DENSITY_2, 0}}, 3, 0x62, 0x8A, 0x35, 0x2, 0x03, 0x16},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1867, DENSITY_4, 0}}, 3, 0x66, 0x8E, 0x37, 0x2, 0x03, 0x11},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1867, DENSITY_4, 0}}, 3, 0x66, 0x8D, 0x36, 0x2, 0x03, 0x17},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_2133, DENSITY_2, 0}}, 4, 0x58, 0xAC, 0x86, 0x5, 0x09, 0x0C},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_2133, DENSITY_2, 0}}, 4, 0x57, 0xAB, 0x85, 0x5, 0x08, 0x10},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_2133, DENSITY_4, 0}}, 4, 0x63, 0xB5, 0x88, 0x6, 0x0B, 0x0E},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_2133, DENSITY_4, 0}}, 4, 0x62, 0xB4, 0x87, 0x6, 0x0A, 0x12},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_2133, DENSITY_2, 0}}, 4, 0x4A, 0x99, 0x6D, 0x3, 0x06, 0x0A},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_2133, DENSITY_2, 0}}, 4, 0x49, 0x98, 0x6C, 0x3, 0x05, 0x0C},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_2133, DENSITY_4, 0}}, 4, 0x53, 0x9F, 0x70, 0x4, 0x07, 0x0B},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_2133, DENSITY_4, 0}}, 4, 0x52, 0x9E, 0x6F, 0x4, 0x06, 0x0D},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_2133, DENSITY_2, 0}}, 3, 0x60, 0x86, 0x43, 0x3, 0x04, 0x16},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_2133, DENSITY_2, 0}}, 3, 0x60, 0x86, 0x43, 0x3, 0x04, 0x1D},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_2133, DENSITY_4, 0}}, 3, 0x65, 0x8B, 0x44, 0x3, 0x05, 0x18},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_2133, DENSITY_4, 0}}, 3, 0x65, 0x8B, 0x44, 0x3, 0x05, 0x22},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_2133, DENSITY_2, 0}}, 4, 0xB2, 0xF9, 0x6C, 0x3, 0x05, 0x11},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_2133, DENSITY_2, 0}}, 4, 0xB1, 0xF8, 0x6C, 0x3, 0x05, 0x16},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_2133, DENSITY_4, 0}}, 4, 0xBA, 0xFF, 0x6F, 0x4, 0x06, 0x13},
+ {{{VDD_135, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_2133, DENSITY_4, 0}}, 4, 0xB9, 0xFF, 0x6F, 0x4, 0x05, 0x17},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1067, DENSITY_2, 0}}, 4, 0x63, 0xA3, 0x69, 0x7, 0x0D, 0x07},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1067, DENSITY_2, 0}}, 4, 0x61, 0xA1, 0x67, 0x7, 0x0B, 0x09},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1067, DENSITY_4, 0}}, 4, 0x6E, 0xAD, 0x6C, 0x9, 0x10, 0x08},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1067, DENSITY_4, 0}}, 4, 0x6C, 0xAB, 0x6A, 0x9, 0x0E, 0x0B},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1067, DENSITY_2, 0}}, 4, 0x57, 0x8F, 0x65, 0x4, 0x09, 0x06},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1067, DENSITY_2, 0}}, 4, 0x55, 0x8D, 0x63, 0x4, 0x07, 0x07},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1067, DENSITY_4, 0}}, 4, 0x5F, 0x96, 0x68, 0x5, 0x0A, 0x06},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1067, DENSITY_4, 0}}, 4, 0x5D, 0x94, 0x67, 0x5, 0x08, 0x08},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1067, DENSITY_2, 0}}, 3, 0x99, 0xBC, 0x34, 0x4, 0x06, 0x10},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1067, DENSITY_2, 0}}, 3, 0x99, 0xBC, 0x33, 0x4, 0x06, 0x16},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1067, DENSITY_4, 0}}, 3, 0x9F, 0xC1, 0x36, 0x5, 0x07, 0x11},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1067, DENSITY_4, 0}}, 3, 0x9E, 0xC1, 0x35, 0x5, 0x07, 0x18},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1067, DENSITY_2, 0}}, 3, 0x93, 0xB2, 0x32, 0x2, 0x04, 0x0D},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1067, DENSITY_2, 0}}, 3, 0x93, 0xB1, 0x31, 0x2, 0x03, 0x0F},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1067, DENSITY_4, 0}}, 3, 0x98, 0xB6, 0x34, 0x3, 0x05, 0x0F},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1067, DENSITY_4, 0}}, 3, 0x97, 0xB5, 0x33, 0x3, 0x04, 0x12},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1333, DENSITY_2, 0}}, 4, 0x5D, 0x91, 0x6E, 0x6, 0x0C, 0x08},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1333, DENSITY_2, 0}}, 4, 0x5B, 0x8F, 0x6D, 0x6, 0x0A, 0x0B},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1333, DENSITY_4, 0}}, 4, 0x68, 0x9B, 0x71, 0x8, 0x0E, 0x09},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1333, DENSITY_4, 0}}, 4, 0x67, 0x99, 0x6F, 0x8, 0x0C, 0x0D},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1333, DENSITY_2, 0}}, 5, 0xA2, 0xF9, 0xC8, 0x7, 0x0F, 0x07},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1333, DENSITY_2, 0}}, 5, 0x9E, 0xF6, 0xC5, 0x7, 0x0C, 0x08},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1333, DENSITY_4, 0}}, 4, 0x5A, 0x84, 0x68, 0x4, 0x09, 0x07},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1333, DENSITY_4, 0}}, 4, 0x58, 0x82, 0x66, 0x4, 0x07, 0x09},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1333, DENSITY_2, 0}}, 3, 0x82, 0x9E, 0x37, 0x3, 0x05, 0x11},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1333, DENSITY_2, 0}}, 3, 0x81, 0x9D, 0x36, 0x3, 0x05, 0x17},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1333, DENSITY_4, 0}}, 3, 0x88, 0xA3, 0x38, 0x4, 0x06, 0x12},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1333, DENSITY_4, 0}}, 3, 0x87, 0xA2, 0x38, 0x4, 0x06, 0x1A},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1333, DENSITY_2, 0}}, 3, 0x7C, 0x94, 0x32, 0x2, 0x03, 0x0E},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1333, DENSITY_2, 0}}, 3, 0x7B, 0x93, 0x31, 0x2, 0x03, 0x12},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1333, DENSITY_4, 0}}, 3, 0x80, 0x97, 0x34, 0x2, 0x04, 0x0F},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1333, DENSITY_4, 0}}, 3, 0x80, 0x97, 0x33, 0x2, 0x04, 0x14},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1600, DENSITY_2, 0}}, 4, 0x63, 0xAA, 0x74, 0x6, 0x0B, 0x0A},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1600, DENSITY_2, 0}}, 4, 0x62, 0xA9, 0x73, 0x6, 0x09, 0x0D},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1600, DENSITY_4, 0}}, 4, 0x6F, 0xB4, 0x77, 0x7, 0x0C, 0x0B},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1600, DENSITY_4, 0}}, 4, 0x6D, 0xB2, 0x76, 0x7, 0x0B, 0x0F},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1600, DENSITY_2, 0}}, 4, 0x56, 0x96, 0x66, 0x3, 0x07, 0x08},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1600, DENSITY_2, 0}}, 4, 0x55, 0x95, 0x64, 0x3, 0x06, 0x0A},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1600, DENSITY_4, 0}}, 4, 0x5F, 0x9D, 0x69, 0x4, 0x08, 0x09},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1600, DENSITY_4, 0}}, 4, 0x5D, 0x9C, 0x68, 0x4, 0x07, 0x0B},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1600, DENSITY_2, 0}}, 3, 0x73, 0x97, 0x3A, 0x3, 0x05, 0x13},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1600, DENSITY_2, 0}}, 3, 0x73, 0x96, 0x3A, 0x3, 0x05, 0x1A},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1600, DENSITY_4, 0}}, 3, 0x79, 0x9C, 0x3B, 0x4, 0x06, 0x15},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1600, DENSITY_4, 0}}, 3, 0x78, 0x9B, 0x3B, 0x4, 0x05, 0x1B},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1600, DENSITY_2, 0}}, 3, 0x6D, 0x8D, 0x33, 0x2, 0x03, 0x0F},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1600, DENSITY_2, 0}}, 3, 0x6C, 0x8D, 0x32, 0x2, 0x03, 0x14},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1600, DENSITY_4, 0}}, 3, 0x71, 0x90, 0x34, 0x2, 0x04, 0x11},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1600, DENSITY_4, 0}}, 3, 0x70, 0x90, 0x34, 0x2, 0x03, 0x14},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1867, DENSITY_2, 0}}, 4, 0x60, 0x9C, 0x7F, 0x5, 0x0A, 0x0B},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1867, DENSITY_2, 0}}, 4, 0x5F, 0x9B, 0x7E, 0x5, 0x09, 0x0F},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1867, DENSITY_4, 0}}, 4, 0x6B, 0xA6, 0x81, 0x7, 0x0B, 0x0C},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1867, DENSITY_4, 0}}, 4, 0x6A, 0xA5, 0x80, 0x7, 0x0A, 0x10},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1867, DENSITY_2, 0}}, 4, 0x53, 0x89, 0x6A, 0x3, 0x06, 0x09},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1867, DENSITY_2, 0}}, 4, 0x52, 0x88, 0x69, 0x3, 0x05, 0x0B},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1867, DENSITY_4, 0}}, 4, 0x5B, 0x90, 0x6D, 0x4, 0x07, 0x0A},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1867, DENSITY_4, 0}}, 4, 0x5A, 0x8F, 0x6C, 0x4, 0x06, 0x0C},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1867, DENSITY_2, 0}}, 3, 0x68, 0x87, 0x3F, 0x3, 0x05, 0x15},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1867, DENSITY_2, 0}}, 3, 0x68, 0x86, 0x3F, 0x3, 0x04, 0x1A},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1867, DENSITY_4, 0}}, 3, 0x6D, 0x8B, 0x40, 0x4, 0x05, 0x16},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1867, DENSITY_4, 0}}, 3, 0x6D, 0x8B, 0x40, 0x4, 0x05, 0x1E},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1867, DENSITY_2, 0}}, 4, 0xC3, 0xF9, 0x6A, 0x3, 0x05, 0x10},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1867, DENSITY_2, 0}}, 4, 0xC2, 0xF9, 0x69, 0x3, 0x05, 0x14},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1867, DENSITY_4, 0}}, 3, 0x66, 0x80, 0x37, 0x2, 0x03, 0x11},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1867, DENSITY_4, 0}}, 4, 0xCA, 0xFF, 0x6C, 0x4, 0x06, 0x16},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_2133, DENSITY_2, 0}}, 4, 0x5D, 0x92, 0x86, 0x5, 0x09, 0x0C},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_2133, DENSITY_2, 0}}, 4, 0x5C, 0x91, 0x85, 0x5, 0x08, 0x10},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_2133, DENSITY_4, 0}}, 4, 0x68, 0x9B, 0x88, 0x6, 0x0B, 0x0E},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_2133, DENSITY_4, 0}}, 4, 0x67, 0x9A, 0x87, 0x6, 0x0A, 0x12},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_2133, DENSITY_2, 0}}, 5, 0x9F, 0xFD, 0xDA, 0x5, 0x0B, 0x0A},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_2133, DENSITY_2, 0}}, 5, 0x9D, 0xFB, 0xD8, 0x5, 0x09, 0x0B},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_2133, DENSITY_4, 0}}, 4, 0x58, 0x85, 0x70, 0x4, 0x07, 0x0B},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_2133, DENSITY_4, 0}}, 4, 0x57, 0x84, 0x6F, 0x4, 0x06, 0x0D},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_2133, DENSITY_2, 0}}, 4, 0xBF, 0xF4, 0x85, 0x5, 0x08, 0x15},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_2133, DENSITY_2, 0}}, 4, 0xBE, 0xF4, 0x85, 0x5, 0x08, 0x1D},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_2133, DENSITY_4, 0}}, 4, 0xCA, 0xFE, 0x87, 0x6, 0x0A, 0x18},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_2133, DENSITY_4, 0}}, 4, 0xC9, 0xFD, 0x87, 0x6, 0x09, 0x20},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_2133, DENSITY_2, 0}}, 4, 0xB1, 0xE1, 0x6C, 0x3, 0x05, 0x11},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_2133, DENSITY_2, 0}}, 4, 0xB1, 0xE1, 0x6C, 0x3, 0x05, 0x16},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_2133, DENSITY_4, 0}}, 4, 0xB9, 0xE8, 0x6F, 0x4, 0x06, 0x13},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_2133, DENSITY_4, 0}}, 4, 0xB9, 0xE7, 0x6F, 0x4, 0x05, 0x17},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1067, DENSITY_2, 0}}, 4, 0x6E, 0xB7, 0x76, 0x8, 0x0E, 0x06},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1067, DENSITY_2, 0}}, 4, 0x6C, 0xB5, 0x74, 0x8, 0x0C, 0x09},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1067, DENSITY_4, 0}}, 4, 0x7B, 0xC2, 0x79, 0xA, 0x11, 0x07},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1067, DENSITY_4, 0}}, 4, 0x79, 0xC0, 0x77, 0xA, 0x0F, 0x0A},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1067, DENSITY_2, 0}}, 4, 0x68, 0xA7, 0x7D, 0x5, 0x0A, 0x05},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1067, DENSITY_2, 0}}, 4, 0x66, 0xA5, 0x7B, 0x5, 0x08, 0x07},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1067, DENSITY_4, 0}}, 4, 0x73, 0xB0, 0x81, 0x6, 0x0C, 0x06},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1067, DENSITY_4, 0}}, 4, 0x71, 0xAF, 0x7F, 0x6, 0x0A, 0x08},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1067, DENSITY_2, 0}}, 3, 0xC0, 0xE3, 0x3A, 0x4, 0x07, 0x0D},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1067, DENSITY_2, 0}}, 3, 0xBF, 0xE2, 0x3A, 0x4, 0x06, 0x12},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1067, DENSITY_4, 0}}, 3, 0xC6, 0xE8, 0x3C, 0x5, 0x08, 0x0E},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1067, DENSITY_4, 0}}, 3, 0xC6, 0xE8, 0x3B, 0x5, 0x07, 0x14},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1067, DENSITY_2, 0}}, 3, 0xBD, 0xDB, 0x3E, 0x3, 0x04, 0x0A},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1067, DENSITY_2, 0}}, 3, 0xBC, 0xDA, 0x3D, 0x3, 0x04, 0x0E},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1067, DENSITY_4, 0}}, 3, 0xC2, 0xDF, 0x40, 0x3, 0x05, 0x0B},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1067, DENSITY_4, 0}}, 3, 0xC2, 0xDF, 0x40, 0x3, 0x05, 0x10},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1333, DENSITY_2, 0}}, 4, 0x68, 0xA2, 0x7B, 0x7, 0x0D, 0x07},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1333, DENSITY_2, 0}}, 4, 0x66, 0xA1, 0x7A, 0x7, 0x0B, 0x0A},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1333, DENSITY_4, 0}}, 4, 0x75, 0xAE, 0x7E, 0x9, 0x0F, 0x08},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1333, DENSITY_4, 0}}, 4, 0x73, 0xAC, 0x7D, 0x9, 0x0D, 0x0C},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1333, DENSITY_2, 0}}, 4, 0x62, 0x93, 0x7D, 0x4, 0x09, 0x06},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1333, DENSITY_2, 0}}, 4, 0x61, 0x92, 0x7B, 0x4, 0x07, 0x08},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1333, DENSITY_4, 0}}, 4, 0x6D, 0x9C, 0x81, 0x5, 0x0A, 0x07},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1333, DENSITY_4, 0}}, 4, 0x6B, 0x9A, 0x7F, 0x5, 0x08, 0x09},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1333, DENSITY_2, 0}}, 3, 0xD3, 0xED, 0x3D, 0x4, 0x06, 0x0F},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1333, DENSITY_2, 0}}, 3, 0xD3, 0xEC, 0x3D, 0x4, 0x05, 0x14},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1333, DENSITY_4, 0}}, 3, 0xDA, 0xF2, 0x3F, 0x5, 0x07, 0x10},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1333, DENSITY_4, 0}}, 3, 0xD9, 0xF2, 0x3E, 0x5, 0x07, 0x19},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1333, DENSITY_2, 0}}, 3, 0xD0, 0xE5, 0x3E, 0x2, 0x04, 0x0D},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1333, DENSITY_2, 0}}, 3, 0xD0, 0xE5, 0x3D, 0x2, 0x04, 0x11},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1333, DENSITY_4, 0}}, 3, 0xD6, 0xE9, 0x40, 0x3, 0x05, 0x0E},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1333, DENSITY_4, 0}}, 3, 0xD5, 0xE9, 0x40, 0x3, 0x04, 0x12},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1600, DENSITY_2, 0}}, 4, 0x64, 0x95, 0x83, 0x6, 0x0B, 0x08},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1600, DENSITY_2, 0}}, 4, 0x63, 0x94, 0x81, 0x6, 0x0A, 0x0B},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1600, DENSITY_4, 0}}, 4, 0x71, 0xA0, 0x85, 0x8, 0x0D, 0x09},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1600, DENSITY_4, 0}}, 4, 0x70, 0x9F, 0x84, 0x8, 0x0C, 0x0D},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1600, DENSITY_2, 0}}, 4, 0x5D, 0x86, 0x7E, 0x4, 0x08, 0x07},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1600, DENSITY_2, 0}}, 4, 0x5C, 0x85, 0x7D, 0x4, 0x07, 0x09},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1600, DENSITY_4, 0}}, 4, 0x68, 0x8F, 0x82, 0x5, 0x09, 0x07},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1600, DENSITY_4, 0}}, 4, 0x66, 0x8D, 0x81, 0x5, 0x08, 0x0A},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1600, DENSITY_2, 0}}, 3, 0xB7, 0xCC, 0x41, 0x3, 0x05, 0x10},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1600, DENSITY_2, 0}}, 3, 0xB7, 0xCC, 0x41, 0x3, 0x05, 0x17},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1600, DENSITY_4, 0}}, 3, 0xBD, 0xD2, 0x42, 0x4, 0x06, 0x11},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1600, DENSITY_4, 0}}, 3, 0xBD, 0xD1, 0x42, 0x4, 0x06, 0x1A},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1600, DENSITY_2, 0}}, 3, 0xB3, 0xC5, 0x3F, 0x2, 0x04, 0x0E},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1600, DENSITY_2, 0}}, 3, 0xB3, 0xC4, 0x3F, 0x2, 0x03, 0x11},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1600, DENSITY_4, 0}}, 3, 0xB9, 0xC9, 0x41, 0x3, 0x04, 0x0E},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1600, DENSITY_4, 0}}, 3, 0xB8, 0xC9, 0x41, 0x3, 0x04, 0x14},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1867, DENSITY_2, 0}}, 4, 0x62, 0x8C, 0x8E, 0x6, 0x0B, 0x0A},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1867, DENSITY_2, 0}}, 4, 0x61, 0x8A, 0x8D, 0x6, 0x0A, 0x0D},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1867, DENSITY_4, 0}}, 4, 0x6E, 0x96, 0x90, 0x8, 0x0C, 0x0A},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1867, DENSITY_4, 0}}, 4, 0x6D, 0x95, 0x8F, 0x8, 0x0B, 0x0F},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1867, DENSITY_2, 0}}, 4, 0x5B, 0x7D, 0x84, 0x4, 0x07, 0x08},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1867, DENSITY_2, 0}}, 4, 0x5A, 0x7C, 0x83, 0x4, 0x06, 0x0A},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1867, DENSITY_4, 0}}, 4, 0x65, 0x85, 0x88, 0x5, 0x08, 0x08},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1867, DENSITY_4, 0}}, 4, 0x64, 0x84, 0x87, 0x5, 0x07, 0x0B},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1867, DENSITY_2, 0}}, 3, 0xA3, 0xB5, 0x47, 0x3, 0x05, 0x12},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1867, DENSITY_2, 0}}, 3, 0xA2, 0xB5, 0x47, 0x3, 0x05, 0x1A},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1867, DENSITY_4, 0}}, 3, 0xA9, 0xBA, 0x48, 0x4, 0x06, 0x14},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1867, DENSITY_4, 0}}, 3, 0xA9, 0xBA, 0x48, 0x4, 0x06, 0x1E},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1867, DENSITY_2, 0}}, 3, 0x9F, 0xAE, 0x42, 0x2, 0x03, 0x0E},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1867, DENSITY_2, 0}}, 3, 0x9F, 0xAD, 0x42, 0x2, 0x03, 0x13},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1867, DENSITY_4, 0}}, 3, 0xA4, 0xB2, 0x44, 0x3, 0x04, 0x10},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1867, DENSITY_4, 0}}, 3, 0xA4, 0xB2, 0x44, 0x3, 0x04, 0x17},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_2133, DENSITY_2, 0}}, 4, 0x60, 0x85, 0x97, 0x6, 0x0A, 0x0B},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_2133, DENSITY_2, 0}}, 4, 0x5F, 0x84, 0x96, 0x6, 0x09, 0x0E},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_2133, DENSITY_4, 0}}, 4, 0x6C, 0x8F, 0x99, 0x7, 0x0C, 0x0C},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_2133, DENSITY_4, 0}}, 4, 0x6B, 0x8E, 0x98, 0x7, 0x0B, 0x11},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_2133, DENSITY_2, 0}}, 4, 0x58, 0x76, 0x88, 0x3, 0x07, 0x09},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_2133, DENSITY_2, 0}}, 4, 0x57, 0x75, 0x87, 0x3, 0x06, 0x0B},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_2133, DENSITY_4, 0}}, 4, 0x62, 0x7E, 0x8B, 0x4, 0x08, 0x09},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_2133, DENSITY_4, 0}}, 4, 0x61, 0x7D, 0x8A, 0x4, 0x07, 0x0C},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_2133, DENSITY_2, 0}}, 3, 0x94, 0xA4, 0x4B, 0x3, 0x05, 0x14},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_2133, DENSITY_2, 0}}, 3, 0x93, 0xA3, 0x4B, 0x3, 0x05, 0x1E},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_2133, DENSITY_4, 0}}, 3, 0x9A, 0xA9, 0x4C, 0x4, 0x06, 0x16},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_2133, DENSITY_4, 0}}, 3, 0x99, 0xA8, 0x4C, 0x4, 0x05, 0x1E},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_2133, DENSITY_2, 0}}, 3, 0x90, 0x9C, 0x44, 0x2, 0x03, 0x0F},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_2133, DENSITY_2, 0}}, 3, 0x8F, 0x9C, 0x43, 0x2, 0x03, 0x15},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_2133, DENSITY_4, 0}}, 3, 0x95, 0xA0, 0x45, 0x2, 0x04, 0x11},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_2133, DENSITY_4, 0}}, 3, 0x95, 0xA0, 0x45, 0x2, 0x03, 0x16},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1067, DENSITY_1, 0}}, 3, 0x5A, 0xAD, 0xCC, 0x8, 0x0E, 0x17},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1067, DENSITY_1, 0}}, 3, 0x5B, 0x8A, 0xCD, 0x8, 0x10, 0x11},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1067, DENSITY_1, 0}}, 3, 0xC5, 0xEE, 0xCB, 0x8, 0x0E, 0x2B},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1067, DENSITY_1, 0}}, 3, 0xC5, 0xEF, 0xCC, 0x8, 0x0F, 0x1E},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1067, DENSITY_1, 0}}, 3, 0x61, 0x88, 0xCC, 0x8, 0x0E, 0x17},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1067, DENSITY_1, 0}}, 3, 0x62, 0x8A, 0xCD, 0x8, 0x10, 0x11},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1067, DENSITY_1, 0}}, 2, 0x72, 0x86, 0x66, 0x4, 0x07, 0x2C},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1067, DENSITY_1, 0}}, 2, 0x72, 0x87, 0x66, 0x4, 0x08, 0x20},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1067, DENSITY_1, 0}}, 3, 0x6D, 0x99, 0xE5, 0x9, 0x10, 0x17},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1067, DENSITY_1, 0}}, 3, 0x6E, 0x9A, 0xE6, 0x9, 0x11, 0x10},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1067, DENSITY_1, 0}}, 2, 0x8C, 0xA0, 0x73, 0x5, 0x08, 0x2B},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1067, DENSITY_1, 0}}, 2, 0x8C, 0xA1, 0x73, 0x5, 0x08, 0x1B},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1067, DENSITY_1, 0}}, 3, 0x40, 0x97, 0x62, 0x5, 0x08, 0x0E},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1067, DENSITY_1, 0}}, 4, 0x83, 0xE7, 0xC5, 0x9, 0x12, 0x0A},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1067, DENSITY_1, 0}}, 3, 0xAB, 0xD8, 0x61, 0x5, 0x08, 0x1B},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1067, DENSITY_1, 0}}, 3, 0xAC, 0xD9, 0x62, 0x5, 0x08, 0x14},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1067, DENSITY_1, 0}}, 4, 0x8E, 0xE4, 0xC3, 0x9, 0x10, 0x0E},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1067, DENSITY_1, 0}}, 4, 0x90, 0xE6, 0xC5, 0x9, 0x12, 0x0B},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1067, DENSITY_1, 0}}, 3, 0xC9, 0xF6, 0x61, 0x5, 0x08, 0x1D},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1067, DENSITY_1, 0}}, 3, 0xCA, 0xF7, 0x62, 0x5, 0x08, 0x15},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1067, DENSITY_1, 0}}, 3, 0x57, 0x88, 0x7A, 0x6, 0x0A, 0x0F},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1067, DENSITY_1, 0}}, 3, 0x58, 0x8A, 0x7B, 0x6, 0x0B, 0x0A},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1067, DENSITY_1, 0}}, 2, 0x81, 0x98, 0x3D, 0x3, 0x05, 0x1C},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1067, DENSITY_1, 0}}, 2, 0x81, 0x98, 0x3D, 0x3, 0x05, 0x12},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1333, DENSITY_1, 0}}, 3, 0x58, 0x76, 0xA8, 0x8, 0x0D, 0x1A},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1333, DENSITY_1, 0}}, 3, 0x59, 0x77, 0xA9, 0x8, 0x0E, 0x13},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1333, DENSITY_1, 0}}, 3, 0xAD, 0xC8, 0xA8, 0x8, 0x0C, 0x2E},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1333, DENSITY_1, 0}}, 3, 0xAD, 0xC8, 0xA9, 0x8, 0x0D, 0x20},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1333, DENSITY_1, 0}}, 3, 0x5D, 0x76, 0xA8, 0x8, 0x0D, 0x1A},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1333, DENSITY_1, 0}}, 3, 0x5E, 0x77, 0xA9, 0x8, 0x0E, 0x13},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1333, DENSITY_1, 0}}, 3, 0xC5, 0xE0, 0xA8, 0x8, 0x0C, 0x2F},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1333, DENSITY_1, 0}}, 3, 0xC5, 0xE0, 0xA9, 0x8, 0x0D, 0x22},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1333, DENSITY_1, 0}}, 3, 0x68, 0x85, 0xBD, 0x8, 0x0E, 0x19},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1333, DENSITY_1, 0}}, 3, 0x69, 0x86, 0xBE, 0x8, 0x0F, 0x11},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1333, DENSITY_1, 0}}, 2, 0x97, 0xA3, 0x5F, 0x4, 0x07, 0x30},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1333, DENSITY_1, 0}}, 2, 0x98, 0xA3, 0x5F, 0x4, 0x07, 0x1E},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1333, DENSITY_1, 0}}, 4, 0x83, 0xCA, 0xC7, 0x8, 0x0E, 0x10},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1333, DENSITY_1, 0}}, 4, 0x85, 0xCC, 0xC9, 0x8, 0x10, 0x0C},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1333, DENSITY_1, 0}}, 3, 0x97, 0xB6, 0x63, 0x4, 0x07, 0x1E},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1333, DENSITY_1, 0}}, 3, 0x97, 0xB7, 0x64, 0x4, 0x07, 0x16},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1333, DENSITY_1, 0}}, 4, 0x8E, 0xCA, 0xC7, 0x8, 0x0E, 0x10},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1333, DENSITY_1, 0}}, 4, 0x8F, 0xCB, 0xC9, 0x8, 0x10, 0x0C},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1333, DENSITY_1, 0}}, 3, 0xAF, 0xCF, 0x63, 0x4, 0x07, 0x20},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1333, DENSITY_1, 0}}, 3, 0xB0, 0xCF, 0x64, 0x4, 0x07, 0x17},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1333, DENSITY_1, 0}}, 4, 0xAE, 0xF2, 0xF8, 0x9, 0x10, 0x10},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1333, DENSITY_1, 0}}, 4, 0xB0, 0xF4, 0xFA, 0x9, 0x12, 0x0C},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1333, DENSITY_1, 0}}, 2, 0x8F, 0x9D, 0x3E, 0x3, 0x04, 0x1F},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1333, DENSITY_1, 0}}, 2, 0x8F, 0x9D, 0x3F, 0x3, 0x05, 0x17},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1600, DENSITY_1, 0}}, 3, 0x5D, 0x97, 0x94, 0x6, 0x0B, 0x1C},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1600, DENSITY_1, 0}}, 3, 0x5E, 0x98, 0x95, 0x6, 0x0C, 0x15},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1600, DENSITY_1, 0}}, 3, 0xB2, 0xE7, 0x93, 0x6, 0x0B, 0x34},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1600, DENSITY_1, 0}}, 3, 0xB3, 0xE7, 0x94, 0x6, 0x0B, 0x23},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1600, DENSITY_1, 0}}, 3, 0x60, 0x82, 0x94, 0x6, 0x0B, 0x1D},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1600, DENSITY_1, 0}}, 3, 0x61, 0x83, 0x95, 0x6, 0x0C, 0x15},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1600, DENSITY_1, 0}}, 3, 0xB2, 0xD3, 0x93, 0x6, 0x0B, 0x34},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1600, DENSITY_1, 0}}, 3, 0xB2, 0xD4, 0x94, 0x6, 0x0B, 0x23},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_1, FREQ_1600, DENSITY_1, 0}}, 3, 0x65, 0x78, 0xA6, 0x7, 0x0C, 0x1A},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_1, FREQ_1600, DENSITY_1, 0}}, 3, 0x66, 0x79, 0xA7, 0x7, 0x0D, 0x12},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_2, DPC_2, FREQ_1600, DENSITY_1, 0}}, 2, 0x85, 0x8C, 0x53, 0x4, 0x06, 0x31},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_8, RANKS_1, DPC_2, FREQ_1600, DENSITY_1, 0}}, 2, 0x86, 0x8C, 0x53, 0x4, 0x06, 0x1F},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1600, DENSITY_1, 0}}, 3, 0x47, 0x88, 0x60, 0x4, 0x06, 0x12},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1600, DENSITY_1, 0}}, 3, 0x48, 0x89, 0x61, 0x4, 0x07, 0x0E},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1600, DENSITY_1, 0}}, 3, 0x9C, 0xD8, 0x60, 0x4, 0x06, 0x22},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1600, DENSITY_1, 0}}, 3, 0x9D, 0xD8, 0x60, 0x4, 0x06, 0x19},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1600, DENSITY_1, 0}}, 4, 0x94, 0xE5, 0xC0, 0x7, 0x0C, 0x12},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1600, DENSITY_1, 0}}, 4, 0x96, 0xE7, 0xC1, 0x7, 0x0E, 0x0E},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1600, DENSITY_1, 0}}, 3, 0x9C, 0xC4, 0x60, 0x4, 0x06, 0x22},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1600, DENSITY_1, 0}}, 3, 0x9C, 0xC5, 0x60, 0x4, 0x06, 0x19},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_1, FREQ_1600, DENSITY_1, 0}}, 4, 0xA7, 0xDD, 0xEF, 0x8, 0x0E, 0x11},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_1, FREQ_1600, DENSITY_1, 0}}, 4, 0xA9, 0xDE, 0xF0, 0x8, 0x10, 0x0D},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_2, DPC_2, FREQ_1600, DENSITY_1, 0}}, 2, 0x7D, 0x88, 0x3C, 0x2, 0x04, 0x24},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, WIDTH_16, RANKS_1, DPC_2, FREQ_1600, DENSITY_1, 0}}, 2, 0x7D, 0x88, 0x3C, 0x2, 0x04, 0x18}
+};
+const Ddr3PowerWeightEntry Ddr3WcPowerWeightTable[] = {
+ {{{VDD_135, ECC_F, TYPE_SODIMM, 0 , 0 , 0 , 0 , 0 , 0}}, 3, 0x87, 0xAB, 0x44, 0x5, 0x08, 0x22},
+ {{{VDD_135, ECC_F, TYPE_UDIMM, 0 , 0 , 0 , 0 , 0 , 0}}, 3, 0x9F, 0xC1, 0x44, 0x5, 0x08, 0x20},
+ {{{VDD_135, ECC_T, TYPE_UDIMM, 0 , 0 , 0 , 0 , 0 , 0}}, 3, 0xDA, 0xF2, 0x4D, 0x5, 0x09, 0x1E},
+ {{{VDD_150, ECC_F, TYPE_SODIMM, 0 , 0 , 0 , 0 , 0 , 0}}, 3, 0xC5, 0xEF, 0xCD, 0x8, 0x10, 0x34},
+ {{{VDD_150, ECC_F, TYPE_UDIMM, 0 , 0 , 0 , 0 , 0 , 0}}, 2, 0x72, 0x87, 0x67, 0x4, 0x08, 0x34},
+ {{{VDD_150, ECC_T, TYPE_UDIMM, 0 , 0 , 0 , 0 , 0 , 0}}, 2, 0x98, 0xA3, 0x73, 0x5, 0x09, 0x31},
+ {{{0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}}, 2, 0x98, 0xA3, 0x73, 0x5, 0x09, 0x34}
+};
+
+const Lpddr3PowerWeightEntry Lpddr3PowerWeightTable[] = {
+ {{{VDD_120, 0, 0, WIDTH_32, RANKS_2, 0, FREQ_1333, DENSITY_4, 0}}, 5, 0xA9, 0x84, 0xEE, 0x2, 0x4, 0x6, 0x3},
+ {{{VDD_120, 0, 0, WIDTH_32, RANKS_1, 0, FREQ_1333, DENSITY_4, 0}}, 5, 0x91, 0x4C, 0xEE, 0x2, 0x4, 0x5, 0x3},
+ {{{VDD_120, 0, 0, WIDTH_32, RANKS_2, 0, FREQ_1600, DENSITY_4, 0}}, 5, 0xA3, 0x79, 0xE9, 0x2, 0x3, 0x7, 0x4},
+ {{{VDD_120, 0, 0, WIDTH_32, RANKS_1, 0, FREQ_1600, DENSITY_4, 0}}, 5, 0x8B, 0x4A, 0xE9, 0x2, 0x3, 0x6, 0x3},
+ {{{VDD_120, 0, 0, WIDTH_16, RANKS_2, 0, FREQ_1333, DENSITY_4, 0}}, 4, 0x6B, 0x56, 0xE0, 0x2, 0x3, 0x9, 0x5},
+ {{{VDD_120, 0, 0, WIDTH_16, RANKS_1, 0, FREQ_1333, DENSITY_4, 0}}, 4, 0x5F, 0x3D, 0xE0, 0x2, 0x3, 0x8, 0x4},
+ {{{VDD_120, 0, 0, WIDTH_16, RANKS_2, 0, FREQ_1600, DENSITY_4, 0}}, 4, 0x67, 0x4F, 0xDB, 0x2, 0x3, 0xA, 0x6},
+ {{{VDD_120, 0, 0, WIDTH_16, RANKS_1, 0, FREQ_1600, DENSITY_4, 0}}, 4, 0x5B, 0x38, 0xDB, 0x2, 0x3, 0x9, 0x5}
+};
+const Lpddr3PowerWeightEntry Lpddr3WcPowerWeightTable[] = {
+ {{{0 , 0, 0, 0 , 0 , 0, 0 , 0 , 0}}, 4, 0x6B, 0x56, 0xE0, 0x2, 0x3, 0xA, 0x6}
+};
+
+/**
+@brief
+ This function configure the MC power register post training after normal mode before PCU start working.
+
+ @param[in, out] MrcData - Include all MRC global data.
+
+ @retval Nothing.
+**/
+void
+MrcPowerModesPostTraining (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ const MrcInput *Inputs;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ MCHBAR_CH0_CR_TC_BANK_RANK_D_STRUCT TcBankRankD;
+ MCDECS_CR_MCDECS_CBIT_MCMAIN_STRUCT McdecsCbit;
+ U32 Offset;
+ U8 Controller;
+ U8 Channel;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ //
+ // Configure Tcpded and Tprpden
+ //
+ TcBankRankD.Data = ChannelOut->MchbarBANKRANKD;
+ if (Outputs->Frequency >= f1867) {
+ TcBankRankD.Bits.tCPDED = 2;
+ }
+
+ if (Outputs->Frequency >= f2133) {
+ TcBankRankD.Bits.tPRPDEN = 2;
+ }
+
+ Offset = MCHBAR_CH0_CR_TC_BANK_RANK_D_REG +
+ ((MCHBAR_CH1_CR_TC_BANK_RANK_D_REG - MCHBAR_CH0_CR_TC_BANK_RANK_D_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, TcBankRankD.Data);
+
+ //
+ // Save in MrcData structure
+ //
+ ChannelOut->MchbarBANKRANKD = TcBankRankD.Data;
+ }
+ }
+ }
+ //
+ // Configure Power Down CR
+ //
+ MrcPowerDownConfig (MrcData);
+
+ //
+ // Initialize McDecs_CBIT
+ //
+ McdecsCbit.Data = MCDECS_CBIT_DEFAULT;
+ if (!Inputs->WeaklockEn) {
+ McdecsCbit.Bits.dis_msg_clk_gate = 1;
+ }
+ MrcWriteCrMulticast (MrcData, MCDECS_CR_MCDECS_CBIT_MCMAIN_REG, McdecsCbit.Data);
+
+ return;
+}
+
+/**
+@brief
+ This function configures the power down control register.
+
+ @param[in] - MrcData - The MRC global data.
+
+ @retval - Nothing
+**/
+void
+MrcPowerDownConfig (
+ IN MrcParameters *const MrcData
+ )
+{
+ const MrcInput *Inputs;
+ MrcOutput *Outputs;
+ U32 PowerDownMode;
+ MCSCHEDS_CR_PM_PDWN_CONFIG_STRUCT PmPdwnConfig;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+
+ PmPdwnConfig.Data = 0;
+ PmPdwnConfig.Bits.PDWN_idle_counter = PDWN_IDLE_COUNTER;
+
+ if (Inputs->PwdwnIdleCounter) {
+ PmPdwnConfig.Bits.PDWN_idle_counter = Inputs->PwdwnIdleCounter;
+ }
+
+ if ((Inputs->PowerDownMode == pdmNoPowerDown) ||
+ (Inputs->PowerDownMode == pdmAPD) ||
+ (Inputs->PowerDownMode == pdmPPDDLLOFF)
+ ) {
+ PowerDownMode = Inputs->PowerDownMode;
+ } else {
+ PowerDownMode = pdmPPDDLLOFF;
+#ifdef ULT_FLAG
+ if (Outputs->DdrType == MRC_DDR_TYPE_LPDDR3) {
+ PowerDownMode = pdmPPD;
+ }
+#endif // ULT_FLAG
+ }
+
+ PmPdwnConfig.Bits.PDWN_mode = PowerDownMode;
+ MrcWriteCR (MrcData, MCSCHEDS_CR_PM_PDWN_CONFIG_REG, PmPdwnConfig.Data);
+
+ return;
+}
+
+/**
+@brief
+ This functions sets power weight, scale factor and Channel
+ Power Floor values from lookup table based on DIMMs present in
+ the system.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - mrcSuccess or reason for failure.
+**/
+MrcStatus
+MrcPowerWeight (
+ IN MrcParameters *const MrcData
+ )
+{
+ const MrcInput *Inputs;
+ const MrcControllerIn *ControllerIn;
+ const MrcDimmIn *DimmIn;
+ const MrcSpd *Spd;
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcDimmOut *DimmOut;
+ U8 Controller;
+ U8 Channel;
+ U8 Dimm;
+ const Ddr3PowerWeightEntry *Ddr3Pwt[2];
+ const Lpddr3PowerWeightEntry *Lpddr3Pwt[2];
+ U16 PwtSize[2];
+ PowerWeightInputs DimmPwt;
+ U8 i;
+ U16 j;
+ BOOL DimmEntryFound;
+ BOOL EnterWc;
+ U8 SfDiff;
+ U8 MinScaleFactor;
+ U8 ScaleFactor[MAX_CHANNEL][MAX_DIMMS_IN_CHANNEL];
+ U8 ChPwrFloor[MAX_CHANNEL][MAX_DIMMS_IN_CHANNEL];
+ U32 Offset;
+ MCHBAR_CH0_CR_PM_DIMM_RD_ENERGY_STRUCT PmDimmRdEnergy[MAX_CHANNEL];
+ MCHBAR_CH0_CR_PM_DIMM_WR_ENERGY_STRUCT PmDimmWrEnergy[MAX_CHANNEL];
+ MCHBAR_CH0_CR_PM_DIMM_ACT_ENERGY_STRUCT PmDimmActEnergy[MAX_CHANNEL];
+ MCHBAR_CH0_CR_PM_DIMM_PD_ENERGY_STRUCT PmDimmPdEnergy[MAX_CHANNEL];
+ MCHBAR_CH0_CR_PM_DIMM_IDLE_ENERGY_STRUCT PmDimmIdleEnergy[MAX_CHANNEL];
+ PCU_CR_DDR_RAPL_CHANNEL_POWER_FLOOR_PCU_STRUCT DdrRaplChannelPowerFloor;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ MinScaleFactor = (U8) ~0;
+ Ddr3Pwt[0] = Ddr3PowerWeightTable;
+ Ddr3Pwt[1] = Ddr3WcPowerWeightTable;
+ Lpddr3Pwt[0] = Lpddr3PowerWeightTable;
+ Lpddr3Pwt[1] = Lpddr3WcPowerWeightTable;
+ DdrRaplChannelPowerFloor.Data = 0;
+
+ MrcOemMemorySet((U8 *) PmDimmRdEnergy, 0, sizeof (PmDimmRdEnergy));
+ MrcOemMemorySet((U8 *) PmDimmWrEnergy, 0, sizeof (PmDimmWrEnergy));
+ MrcOemMemorySet((U8 *) PmDimmActEnergy, 0, sizeof (PmDimmActEnergy));
+ MrcOemMemorySet((U8 *) PmDimmPdEnergy, 0, sizeof (PmDimmPdEnergy));
+ MrcOemMemorySet((U8 *) PmDimmIdleEnergy, 0, sizeof (PmDimmIdleEnergy));
+ MrcOemMemorySet((U8 *) ScaleFactor, (U32) ~0, sizeof (ScaleFactor));
+ MrcOemMemorySet((U8 *) ChPwrFloor, (U32) 0, sizeof (ChPwrFloor));
+
+ if (Outputs->DdrType == MRC_DDR_TYPE_LPDDR3) {
+ PwtSize[0] = sizeof (Lpddr3PowerWeightTable) / sizeof (Lpddr3PowerWeightEntry);
+ PwtSize[1] = sizeof (Lpddr3WcPowerWeightTable) / sizeof (Lpddr3PowerWeightEntry);
+ } else {
+ PwtSize[0] = sizeof (Ddr3PowerWeightTable) / sizeof (Ddr3PowerWeightEntry);
+ PwtSize[1] = sizeof (Ddr3WcPowerWeightTable) / sizeof (Ddr3PowerWeightEntry);
+ }
+
+ if (Inputs->MemoryProfile != USER_PROFILE) {
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerOut = &Outputs->Controller[Controller];
+ ControllerIn = &Inputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ //
+ // Collect Channel level data for lookup
+ //
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmOut = &ControllerOut->Channel[Channel].Dimm[Dimm];
+ DimmIn = &ControllerIn->Channel[Channel].Dimm[Dimm];
+ if (DimmOut->Status == DIMM_PRESENT) {
+ EnterWc = FALSE;
+ DimmPwt.Data = 0;
+ //
+ // Collect DIMM level data for lookup
+ //
+
+ Spd = &DimmIn->Spd;
+
+ switch (Outputs->VddVoltage[Inputs->MemoryProfile]) {
+ case VDD_1_20:
+ DimmPwt.Bits.Vddq = VDD_120;
+ break;
+
+ case VDD_1_35:
+ DimmPwt.Bits.Vddq = VDD_135;
+ break;
+
+ case VDD_1_50:
+ DimmPwt.Bits.Vddq = VDD_150;
+ break;
+
+ default:
+ DimmPwt.Bits.Vddq = VDD_OTHER;
+ EnterWc = TRUE;
+ break;
+ }
+
+ DimmPwt.Bits.Ecc = DimmOut->EccSupport;
+ DimmPwt.Bits.DimmType = DimmOut->ModuleType;
+ DimmPwt.Bits.DeviceWidth = DimmOut->SdramWidthIndex;
+ DimmPwt.Bits.NumOfRanks = DimmOut->RankInDIMM;
+ DimmPwt.Bits.Dpc = ControllerOut->Channel[Channel].DimmCount;
+
+ switch (Outputs->Frequency) {
+ case f1067:
+ DimmPwt.Bits.Frequency = FREQ_1067;
+ break;
+
+ case f1333:
+ DimmPwt.Bits.Frequency = FREQ_1333;
+ break;
+
+ case f1600:
+ DimmPwt.Bits.Frequency = FREQ_1600;
+ break;
+
+ case f1867:
+ DimmPwt.Bits.Frequency = FREQ_1867;
+ break;
+
+ case f2133:
+ DimmPwt.Bits.Frequency = FREQ_2133;
+ break;
+
+ default:
+ EnterWc = TRUE;
+ break;
+ }
+
+ DimmPwt.Bits.DramDensity = DimmOut->DensityIndex;
+
+ if (Outputs->DdrType == MRC_DDR_TYPE_LPDDR3) {
+ DimmPwt.Bits.Ecc = 0;
+ DimmPwt.Bits.DimmType = 0;
+ DimmPwt.Bits.Dpc = 0;
+ }
+
+ //
+ // Search lookup table for DIMM entry
+ //
+ DimmEntryFound = FALSE;
+ for (i = 0; i < sizeof (PwtSize) / sizeof (PwtSize[0]); i++) {
+ if (i == 0) {
+ if (EnterWc) {
+ continue;
+ }
+ } else if (i == 1) {
+ if (!DimmEntryFound) {
+ DimmPwt.Bits.DeviceWidth = 0;
+ DimmPwt.Bits.NumOfRanks = 0;
+ DimmPwt.Bits.Dpc = 0;
+ DimmPwt.Bits.Frequency = 0;
+ DimmPwt.Bits.DramDensity = 0;
+ } else {
+ continue;
+ }
+ }
+ for (j = 0; j < PwtSize[i]; j++) {
+ if (Outputs->DdrType == MRC_DDR_TYPE_LPDDR3) {
+ if (DimmPwt.Data == Lpddr3Pwt[i][j].PwInput.Data ||
+ (i == 1 && j == PwtSize[i] - 1)) {
+ PmDimmRdEnergy[Channel].Data8[Dimm] = Lpddr3Pwt[i][j].RdCr;
+ PmDimmWrEnergy[Channel].Data8[Dimm] = Lpddr3Pwt[i][j].WrCr;
+ PmDimmActEnergy[Channel].Data8[Dimm] = Lpddr3Pwt[i][j].ActCr;
+ PmDimmPdEnergy[Channel].Data8[Dimm] = Lpddr3Pwt[i][j].CkeL;
+ PmDimmIdleEnergy[Channel].Data8[Dimm] = Lpddr3Pwt[i][j].CkeH;
+ ScaleFactor[Channel][Dimm] = Lpddr3Pwt[i][j].ScaleFactor;
+ ChPwrFloor[Channel][Dimm] = (ControllerOut->ChannelCount == 1)
+ ? Lpddr3Pwt[i][j].OneChPwrFloor
+ : Lpddr3Pwt[i][j].TwoChPwrFloor;
+ MinScaleFactor = MIN (MinScaleFactor, ScaleFactor[Channel][Dimm]);
+ DimmEntryFound = TRUE;
+ break;
+ }
+ } else {
+ if (DimmPwt.Data == Ddr3Pwt[i][j].PwInput.Data ||
+ (i == 1 && j == PwtSize[i] - 1)) {
+ PmDimmRdEnergy[Channel].Data8[Dimm] = Ddr3Pwt[i][j].RdCr;
+ PmDimmWrEnergy[Channel].Data8[Dimm] = Ddr3Pwt[i][j].WrCr;
+ PmDimmActEnergy[Channel].Data8[Dimm] = Ddr3Pwt[i][j].ActCr;
+ PmDimmPdEnergy[Channel].Data8[Dimm] = Ddr3Pwt[i][j].CkeL;
+ PmDimmIdleEnergy[Channel].Data8[Dimm] = Ddr3Pwt[i][j].CkeH;
+ ScaleFactor[Channel][Dimm] = Ddr3Pwt[i][j].ScaleFactor;
+ ChPwrFloor[Channel][Dimm] = Ddr3Pwt[i][j].ChPwrFloor;
+ MinScaleFactor = MIN (MinScaleFactor, ScaleFactor[Channel][Dimm]);
+ DimmEntryFound = TRUE;
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmOut = &Outputs->Controller->Channel[Channel].Dimm[Dimm];
+ if (DimmOut->Status == DIMM_PRESENT) {
+ //
+ // Set Scale Factor of all DIMMs to lowest Scale Factor and adjust weights accordingly.
+ //
+ if ((SfDiff = ScaleFactor[Channel][Dimm] - MinScaleFactor) > 0) {
+ PmDimmRdEnergy[Channel].Data8[Dimm] = (PmDimmRdEnergy[Channel].Data8[Dimm] + 1) >> SfDiff;
+ PmDimmWrEnergy[Channel].Data8[Dimm] = (PmDimmWrEnergy[Channel].Data8[Dimm] + 1) >> SfDiff;
+ PmDimmActEnergy[Channel].Data8[Dimm] = (PmDimmActEnergy[Channel].Data8[Dimm] + 1) >> SfDiff;
+ PmDimmPdEnergy[Channel].Data8[Dimm] = (PmDimmPdEnergy[Channel].Data8[Dimm] + 1) >> SfDiff;
+ PmDimmIdleEnergy[Channel].Data8[Dimm] = (PmDimmIdleEnergy[Channel].Data8[Dimm] + 1) >> SfDiff;
+ }
+ }
+ }
+ //
+ // Set RAPL Channel Power Floor to average of DIMMs rounded up to nearest integer multiple of 0.125W (which is
+ // going to be a multiple of 8 for Channel Power Floor Register).
+ //
+ if (Outputs->Controller->Channel[Channel].DimmCount > 1) {
+ if (ChPwrFloor[Channel][0] != ChPwrFloor[Channel][1]) {
+ ChPwrFloor[Channel][0] = (ChPwrFloor[Channel][0] + ChPwrFloor[Channel][1] + 1) / 2;
+ if (ChPwrFloor[Channel][0] < 0xF8) {
+ if ((ChPwrFloor[Channel][0] % 8) != 0) {
+ ChPwrFloor[Channel][0] = ChPwrFloor[Channel][0] + (8 - (ChPwrFloor[Channel][0] % 8));
+ }
+ } else { // No more 8-bit mulitples of 8 after 0xF8, must round down.
+ ChPwrFloor[Channel][0] = 0xF8;
+ }
+ }
+ } else {
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ ChPwrFloor[Channel][0] = MAX (ChPwrFloor[Channel][0], ChPwrFloor[Channel][Dimm]);
+ }
+ }
+
+ //
+ // Apply power weights
+ //
+ Offset = MCHBAR_CH0_CR_PM_DIMM_RD_ENERGY_REG +
+ (MCHBAR_CH1_CR_PM_DIMM_RD_ENERGY_REG - MCHBAR_CH0_CR_PM_DIMM_RD_ENERGY_REG) * Channel;
+ MrcWriteCR (MrcData, Offset, PmDimmRdEnergy[Channel].Data);
+ Offset = MCHBAR_CH0_CR_PM_DIMM_WR_ENERGY_REG +
+ (MCHBAR_CH1_CR_PM_DIMM_WR_ENERGY_REG - MCHBAR_CH0_CR_PM_DIMM_WR_ENERGY_REG) * Channel;
+ MrcWriteCR (MrcData, Offset, PmDimmWrEnergy[Channel].Data);
+ Offset = MCHBAR_CH0_CR_PM_DIMM_ACT_ENERGY_REG +
+ (MCHBAR_CH1_CR_PM_DIMM_ACT_ENERGY_REG - MCHBAR_CH0_CR_PM_DIMM_ACT_ENERGY_REG) * Channel;
+ MrcWriteCR (MrcData, Offset, PmDimmActEnergy[Channel].Data);
+ Offset = MCHBAR_CH0_CR_PM_DIMM_PD_ENERGY_REG +
+ (MCHBAR_CH1_CR_PM_DIMM_PD_ENERGY_REG - MCHBAR_CH0_CR_PM_DIMM_PD_ENERGY_REG) * Channel;
+ MrcWriteCR (MrcData, Offset, PmDimmPdEnergy[Channel].Data);
+ Offset = MCHBAR_CH0_CR_PM_DIMM_IDLE_ENERGY_REG +
+ (MCHBAR_CH1_CR_PM_DIMM_IDLE_ENERGY_REG - MCHBAR_CH0_CR_PM_DIMM_IDLE_ENERGY_REG) * Channel;
+ MrcWriteCR (MrcData, Offset, PmDimmIdleEnergy[Channel].Data);
+ }
+ }
+ DdrRaplChannelPowerFloor.Bits.CH0 = ChPwrFloor[0][0];
+ DdrRaplChannelPowerFloor.Bits.CH1 = ChPwrFloor[1][0];
+ MrcWriteCR (MrcData, PCU_CR_DDR_RAPL_CHANNEL_POWER_FLOOR_PCU_REG, DdrRaplChannelPowerFloor.Data);
+ MrcWriteCR (MrcData, PCU_CR_DDR_ENERGY_SCALEFACTOR_PCU_REG, (U32) MinScaleFactor);
+
+#ifdef MRC_DEBUG_PRINT
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "Applied Power Weights:\n\tSclFctr\tRdCr\tWrCr\tActCr\tCkeL\tCkeH\tChPwrFloor\n"
+ );
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmOut = &Outputs->Controller->Channel[Channel].Dimm[Dimm];
+ if (DimmOut->Status == DIMM_PRESENT) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "C%dD%d:\t", Channel, Dimm);
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "%d\t%2Xh\t%2Xh\t%2Xh\t%Xh\t%2Xh\t%2Xh\n",
+ MinScaleFactor,
+ PmDimmRdEnergy[Channel].Data8[Dimm],
+ PmDimmWrEnergy[Channel].Data8[Dimm],
+ PmDimmActEnergy[Channel].Data8[Dimm],
+ PmDimmPdEnergy[Channel].Data8[Dimm],
+ PmDimmIdleEnergy[Channel].Data8[Dimm],
+ ChPwrFloor[Channel][0]
+ );
+ }
+ }
+ }
+ }
+#endif
+ }
+
+ return mrcSuccess;
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/McConfiguration/MrcPowerModes.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/McConfiguration/MrcPowerModes.h
new file mode 100644
index 0000000..1242276
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/McConfiguration/MrcPowerModes.h
@@ -0,0 +1,174 @@
+/** @file
+ This module includes the power modes definitions.
+
+@Copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+**/
+#ifndef _MrcPowerModes_h_
+#define _MrcPowerModes_h_
+#pragma pack(push, 1)
+
+#include "McAddress.h"
+#include "MrcTypes.h"
+#include "MrcCommon.h"
+#include "MrcGlobal.h"
+
+//
+// Lookup table definitions
+//
+#define GEN_DDR3 1
+#define GEN_DDR4 2
+#define VDD_120 1
+#define VDD_135 2
+#define VDD_150 3
+#define VDD_OTHER 4
+#define ECC_F 0
+#define ECC_T 1
+#define TYPE_SODIMM 3
+#define TYPE_UDIMM 2
+#define WIDTH_8 1
+#define WIDTH_16 2
+#define WIDTH_32 3
+#define RANKS_1 1
+#define RANKS_2 2
+#define DPC_1 1
+#define DPC_2 2
+#define FREQ_800 1
+#define FREQ_1000 2
+#define FREQ_1067 3
+#define FREQ_1200 4
+#define FREQ_1333 5
+#define FREQ_1400 6
+#define FREQ_1600 7
+#define FREQ_1800 8
+#define FREQ_1867 9
+#define FREQ_2000 10
+#define FREQ_2133 11
+#define FREQ_2200 12
+#define FREQ_2400 13
+#define FREQ_2600 14
+#define FREQ_2667 15
+#define DENSITY_1 2
+#define DENSITY_2 3
+#define DENSITY_4 4
+
+typedef enum {
+ tsmNoThermalSensing = 0, ///< No thermal sensing in MC
+ tsmThermalSensor, ///< Thermal Sensor (on DIMM) - when set thermal sense is active
+ tsmBwEstimation, ///< BW estimation - when set, PM_SUM_PC_CxRy of this DIMM accumulates command power estimation
+ tsmBoth ///< Both (1) and (2)
+} ThermalSensorModes;
+
+///
+/// Power Down mode
+///
+typedef enum {
+ pdmNoPowerDown = 0,
+ pdmAPD = 1,
+ pdmPPD = 2,
+ pdmPPDDLLOFF = 6,
+ pdmAuto = 0xFF,
+} MrcPowerDownMode;
+
+typedef union {
+ struct {
+ U32 Vddq : 4;
+ U32 Ecc : 1;
+ U32 DimmType : 4;
+ U32 DeviceWidth : 3;
+ U32 NumOfRanks : 3;
+ U32 Dpc : 2;
+ U32 Frequency : 4;
+ U32 DramDensity : 3;
+ U32 Spare : 8;
+ } Bits;
+ U32 Data;
+ U16 Data16[2];
+ U8 Data8[4];
+} PowerWeightInputs;
+
+typedef struct {
+ PowerWeightInputs PwInput;
+ U8 ScaleFactor;
+ U8 RdCr;
+ U8 WrCr;
+ U8 ActCr;
+ U8 CkeL;
+ U8 CkeH;
+ U8 ChPwrFloor;
+} Ddr3PowerWeightEntry;
+
+typedef struct {
+ PowerWeightInputs PwInput;
+ U8 ScaleFactor;
+ U8 RdCr;
+ U8 WrCr;
+ U8 ActCr;
+ U8 CkeL;
+ U8 CkeH;
+ U8 OneChPwrFloor;
+ U8 TwoChPwrFloor;
+} Lpddr3PowerWeightEntry;
+
+#define PDWN_IDLE_COUNTER (0x80)
+
+#define MCDECS_CBIT_DEFAULT (0x00000000)
+
+/**
+@brief
+ This function configure the MC power register post training after normal mode before PCU start working.
+
+ @param[in, out] MrcData - Include all MRC global data.
+
+ @retval Nothing.
+**/
+extern
+void
+MrcPowerModesPostTraining (
+ IN OUT MrcParameters *const MrcData
+ );
+
+/**
+@brief
+ This function configures the power down control register.
+
+ @param[in] - MrcData - The MRC global data.
+
+ @retval - Nothing
+**/
+extern
+void
+MrcPowerDownConfig (
+ IN MrcParameters *const MrcData
+ );
+
+/**
+@brief
+ This functions applies power weight values from lookup table to every DIMM in the system.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - mrcSuccess or reason for failure.
+**/
+extern
+MrcStatus
+MrcPowerWeight (
+ MrcParameters * const MrcData
+);
+
+#pragma pack(pop)
+#endif // _MrcPowerModes_h_
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/McConfiguration/MrcRefreshConfiguration.c b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/McConfiguration/MrcRefreshConfiguration.c
new file mode 100644
index 0000000..ae958d2
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/McConfiguration/MrcRefreshConfiguration.c
@@ -0,0 +1,453 @@
+/** @file
+ This module sets the memory controller refresh parameters.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+**/
+
+///
+/// Include files
+///
+#include "MrcRefreshConfiguration.h"
+
+/**
+@brief
+ This function returns the tXS offset.
+ tXS-offset: tXS = tRFC+10ns. Setup of tXS-offset is # of cycles for 10 ns.
+
+ @param[in] Frequency - The memory frequency.
+
+ @retval tXS-offset value.
+**/
+static
+U32
+tXsOffset (
+ IN const MrcFrequency Frequency
+ )
+{
+ U32 tXSOffset;
+
+ if (Frequency <= f800) {
+ tXSOffset = Offset_10nsec_800;
+ } else if (Frequency <= f1067) {
+ tXSOffset = Offset_10nsec_1067;
+ } else if (Frequency <= f1333) {
+ tXSOffset = Offset_10nsec_1333;
+ } else if (Frequency <= f1600) {
+ tXSOffset = Offset_10nsec_1600;
+ } else if (Frequency <= f1867) {
+ tXSOffset = Offset_10nsec_1867;
+ } else if (Frequency <= f2133) {
+ tXSOffset = Offset_10nsec_2133;
+ } else if (Frequency <= f2400) {
+ tXSOffset = Offset_10nsec_2400;
+ } else {
+ tXSOffset = Offset_10nsec_2667;
+ }
+
+ return tXSOffset;
+}
+
+/**
+@brief
+ This function configures the TC-RFTP register and its fields 9tREFI, tRFC, tREFI.
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] ChannelIndex - Channel to work on.
+
+ @retval Nothing.
+**/
+static
+void
+SetTcRftpReg (
+ IN MrcParameters *const MrcData,
+ IN const U32 ChannelIndex
+ )
+{
+ MrcTiming *TimingOut;
+ MCHBAR_CH0_CR_TC_RFTP_STRUCT TcRftp;
+ MrcProfile Profile;
+ U32 tRefix9;
+ U32 Offset;
+ U16 tREFI_MAX;
+
+ Profile = MrcData->SysIn.Inputs.MemoryProfile;
+ TimingOut = &MrcData->SysOut.Outputs.Controller[0].Channel[ChannelIndex].Timing[Profile];
+ tRefix9 = (TimingOut->tREFI * 89) / (1024 * 10);
+ TcRftp.Data = 0;
+ tREFI_MAX = MCHBAR_CH0_CR_TC_RFTP_tREFI_MAX;
+ TcRftp.Bits.tREFI = MIN (tREFI_MAX, TimingOut->tREFI);
+ TcRftp.Bits.tRFC = MIN (MCHBAR_CH0_CR_TC_RFTP_tRFC_MAX, TimingOut->tRFC);
+ TcRftp.Bits.tREFIx9 = MIN (MCHBAR_CH0_CR_TC_RFTP_tREFIx9_MAX, tRefix9);
+ Offset = MCHBAR_CH0_CR_TC_RFTP_REG +
+ ((MCHBAR_CH1_CR_TC_RFTP_REG - MCHBAR_CH0_CR_TC_RFTP_REG) * ChannelIndex);
+ MrcWriteCR (MrcData, Offset, TcRftp.Data);
+ MRC_DEBUG_MSG (
+ &MrcData->SysIn.Inputs.Debug,
+ MSG_LEVEL_NOTE,
+ "TC-RFTP Channel %u register value = %Xh\n",
+ ChannelIndex,
+ TcRftp.Data
+ );
+ return;
+}
+
+/**
+@brief
+ This function configures the TC-SRFTP register and its fields tZQOPER, tXS-offset, tXSDLL.
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] ChannelIndex - Channel to work on.
+
+ @retval Nothing.
+**/
+static
+void
+SetTcSrftpReg (
+ IN MrcParameters *const MrcData,
+ IN const U32 ChannelIndex
+ )
+{
+ const MrcInput *Inputs;
+ MrcFrequency Frequency;
+ U32 tZQOPER;
+ U32 tXS_offset;
+ U32 tMod;
+ U32 Offset;
+ MCHBAR_CH0_CR_TC_SRFTP_STRUCT CrTcSrftp;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Frequency = MrcData->SysOut.Outputs.Frequency;
+ tZQOPER = tZQOPERGet (MrcData, Frequency);
+ tXS_offset = tXsOffset (Frequency);
+ tMod = tMODGet (Frequency) - 8;
+
+ CrTcSrftp.Data = 0;
+ CrTcSrftp.Bits.tXSDLL = MIN (MCHBAR_CH0_CR_TC_SRFTP_tXSDLL_MAX, tDLLK_VALUE);
+ CrTcSrftp.Bits.tXS_offset = MIN (MCHBAR_CH0_CR_TC_SRFTP_tXS_offset_MAX, tXS_offset);
+ CrTcSrftp.Bits.tZQOPER = MIN (MCHBAR_CH0_CR_TC_SRFTP_tZQOPER_MAX, tZQOPER);
+ CrTcSrftp.Bits.tMOD = MIN (MCHBAR_CH0_CR_TC_SRFTP_tMOD_MAX, tMod);
+ Offset = MCHBAR_CH0_CR_TC_SRFTP_REG +
+ ((MCHBAR_CH1_CR_TC_SRFTP_REG - MCHBAR_CH0_CR_TC_SRFTP_REG) * ChannelIndex);
+ MrcWriteCR (MrcData, Offset, CrTcSrftp.Data);
+ MRC_DEBUG_MSG (
+ &Inputs->Debug,
+ MSG_LEVEL_NOTE,
+ "Ch%u: TC_SRFTP = %Xh\n tXSDLL = %u\n tXS_offset = %u\n tZQOPER = %u\n tMOD = %u\n",
+ ChannelIndex,
+ CrTcSrftp.Data,
+ CrTcSrftp.Bits.tXSDLL,
+ CrTcSrftp.Bits.tXS_offset,
+ CrTcSrftp.Bits.tZQOPER,
+ CrTcSrftp.Bits.tMOD
+ );
+ return;
+}
+
+/**
+@brief
+ This function returns the tZQOPER value.
+ tZQOPER = Defines the period required for ZQCL after SR exit.
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Frequency - The memory frequency.
+
+ @retval The tZQOPER value.
+**/
+U32
+tZQOPERGet (
+ IN MrcParameters *const MrcData,
+ IN const MrcFrequency Frequency
+ )
+{
+ U32 tZQOPER;
+#ifdef ULT_FLAG
+ MrcDdrType DdrType;
+
+ DdrType = MrcData->SysOut.Outputs.DdrType;
+ if (DdrType == MRC_DDR_TYPE_LPDDR3) {
+ tZQOPER = tZQCL_MIN / (MrcData->SysOut.Outputs.Qclkps * 2);
+ } else
+#endif // ULT_FLAG
+ {
+ if (Frequency <= f1600) {
+ ///
+ /// All frequencies below 1600 uses the same value
+ ///
+ tZQOPER = tZQOPER_1600;
+ } else if (Frequency <= f1867) {
+ tZQOPER = tZQOPER_1867;
+ } else if (Frequency <= f2133) {
+ tZQOPER = tZQOPER_2133;
+ } else if (Frequency <= f2400) {
+ tZQOPER = tZQOPER_2400;
+ } else {
+ tZQOPER = tZQOPER_2667;
+ }
+ }
+
+ return tZQOPER;
+}
+
+/**
+@brief
+ This function returns the tMOD value.
+ tMOD = max(12nCK, 15ns) nCK change by the frequency.
+
+ @param[in] Frequency - The memory frequency.
+
+ @retval The tMOD value.
+**/
+U32
+tMODGet (
+ IN const MrcFrequency Frequency
+ )
+{
+ U32 tMOD;
+
+ if (Frequency <= f800) {
+ tMOD = tMOD_800;
+ } else if (Frequency <= f1067) {
+ tMOD = tMOD_1067;
+ } else if (Frequency <= f1333) {
+ tMOD = tMOD_1333;
+ } else if (Frequency <= f1600) {
+ tMOD = tMOD_1600;
+ } else if (Frequency <= f1867) {
+ tMOD = tMOD_1867;
+ } else if (Frequency <= f2133) {
+ tMOD = tMOD_2133;
+ } else if (Frequency <= f2400) {
+ tMOD = tMOD_2400;
+ } else {
+ tMOD = tMOD_2667;
+ }
+
+ return tMOD;
+}
+
+/**
+@brief
+ This function configures the TC-ZQCAL register and its fields tZQCS and tZQCS_PERIOD.
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] ChannelIndex - Channel to work on.
+
+ @retval Nothing.
+**/
+static
+void
+SetTcZqCalReg (
+ IN MrcParameters *const MrcData,
+ IN const U32 ChannelIndex
+ )
+{
+ MCHBAR_CH0_CR_TC_ZQCAL_STRUCT ZqCal;
+ U32 ZQCS_period;
+ U32 tZQCS;
+ U32 Offset;
+ MrcCpuModel CpuModel;
+#ifdef ULT_FLAG
+ MrcDdrType DdrType;
+#endif // ULT_FLAG
+
+ CpuModel = MrcData->SysIn.Inputs.CpuModel;
+
+ Offset = MCHBAR_CH0_CR_TC_ZQCAL_REG + (MCHBAR_CH1_CR_TC_ZQCAL_REG - MCHBAR_CH0_CR_TC_ZQCAL_REG) * ChannelIndex;
+
+ ZqCal.Data = 0;
+ tZQCS = tZQCSGet (MrcData, MrcData->SysOut.Outputs.Frequency);
+ ZQCS_period = ZQCS_PERIOD_DDR3;
+
+#ifdef ULT_FLAG
+ DdrType = MrcData->SysOut.Outputs.DdrType;
+ if (CpuModel == cmHSW_ULT) {
+ if (DdrType == MRC_DDR_TYPE_LPDDR3) {
+ ZQCS_period = ZQCS_PERIOD_LPDDR3;
+ }
+ ZqCal.UltBits.ZQCS_period = MIN (MCHBAR_CH0_CR_TC_ZQCAL_ZQCS_period_Ult_MAX, ZQCS_period);
+ ZqCal.UltBits.tZQCS = MIN (MCHBAR_CH0_CR_TC_ZQCAL_tZQCS_Ult_MAX, tZQCS);
+ } else
+#endif // ULT_FLAG
+ {
+ ZqCal.Bits.ZQCS_period = MIN (MCHBAR_CH0_CR_TC_ZQCAL_ZQCS_period_MAX, ZQCS_period);
+ ZqCal.Bits.tZQCS = MIN (MCHBAR_CH0_CR_TC_ZQCAL_tZQCS_MAX, tZQCS);
+ }
+ MrcWriteCR (MrcData, Offset, ZqCal.Data);
+
+#ifdef ULT_FLAG
+ if (CpuModel == cmHSW_ULT) {
+ ZQCS_period = ZqCal.UltBits.ZQCS_period;
+ tZQCS = ZqCal.UltBits.tZQCS;
+ } else
+#endif //ULT_FLAG
+ {
+ ZQCS_period = ZqCal.Bits.ZQCS_period;
+ tZQCS = ZqCal.Bits.tZQCS;
+ }
+
+ MRC_DEBUG_MSG (
+ &MrcData->SysIn.Inputs.Debug,
+ MSG_LEVEL_NOTE,
+ "Ch%u: TC_ZQCAL = %Xh\n ZQCS_period = %u\n tZQCS = %u\n",
+ ChannelIndex,
+ ZqCal.Data,
+ ZQCS_period,
+ tZQCS
+ );
+
+ return;
+}
+
+/**
+@brief
+ This function returns the tZQCS value.
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Frequency - The memory frequency.
+
+ @retval The tZQCS value.
+**/
+U32
+tZQCSGet (
+ IN MrcParameters *const MrcData,
+ IN const MrcFrequency Frequency
+ )
+{
+ U32 tZQCS;
+#ifdef ULT_FLAG
+ MrcDdrType DdrType;
+
+ DdrType = MrcData->SysOut.Outputs.DdrType;
+ if (DdrType == MRC_DDR_TYPE_LPDDR3) {
+ tZQCS = tZQCS_MIN / (MrcData->SysOut.Outputs.Qclkps * 2);
+ } else
+#endif // ULT_FLAG
+ {
+ if (Frequency <= f1600) {
+ //
+ // All frequencies below 1600 uses the same value
+ //
+ tZQCS = tZQCS_1600;
+ } else if (Frequency <= f1867) {
+ tZQCS = tZQCS_1867;
+ } else if (Frequency <= f2133) {
+ tZQCS = tZQCS_2133;
+ } else if (Frequency <= f2400) {
+ tZQCS = tZQCS_2400;
+ } else {
+ tZQCS = tZQCS_2667;
+ }
+ }
+ return tZQCS;
+}
+
+/**
+@brief
+ This function configures the TC_MR2_SHADDOW register and its fields.
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Channel - Channel to work on.
+ @param[in] Dimm - Dimm to work on.
+ @param[in] Mr2Value - The value of MR2 to setup.
+
+ @retval Nothing.
+**/
+void
+SetTcMr2ShadowReg (
+ IN MrcParameters *const MrcData,
+ IN const U32 Channel,
+ IN const U32 Dimm,
+ IN U32 Mr2Value
+ )
+{
+ MrcDimmOut *DimmOut;
+ MCHBAR_CH0_CR_TC_MR2_SHADDOW_STRUCT TcMr2Shaddow;
+ U32 Offset;
+
+ Offset = MCHBAR_CH0_CR_TC_MR2_SHADDOW_REG +
+ ((MCHBAR_CH1_CR_TC_MR2_SHADDOW_REG - MCHBAR_CH0_CR_TC_MR2_SHADDOW_REG) * Channel);
+ TcMr2Shaddow.Data = MrcReadCR (MrcData, Offset);
+ TcMr2Shaddow.Bits.MR2_sh_high = 0;
+ TcMr2Shaddow.Bits.MR2_sh_low = 0;
+
+ DimmOut = &MrcData->SysOut.Outputs.Controller[0].Channel[Channel].Dimm[Dimm];
+ if ((DimmOut->SelfRefreshTemp) == TRUE) {
+ TcMr2Shaddow.Bits.SRT_avail |= MRC_BIT0 << Dimm;
+ }
+ ((MCHBAR_CH0_CR_TC_MR2_SHADDOW_STRUCT *) (&Mr2Value))->Bits.SRT_avail = 0;
+ TcMr2Shaddow.Data |= Mr2Value;
+
+ //
+ // Set address bit swizzle according to the DIMM number.
+ //
+ if (DimmOut->AddressMirrored == TRUE) {
+ TcMr2Shaddow.Bits.Addr_bit_swizzle |= MRC_BIT0 << Dimm;
+ }
+
+ MrcWriteCR (MrcData, Offset, TcMr2Shaddow.Data);
+ //
+ // MRC_DEBUG_MSG (&MrcData->Inputs.Debug, MSG_LEVEL_NOTE, "TC-MR2_SHADOW Channel %u register value = %Xh\n", Channel, TcMr2Shaddow.Data);
+ //
+ return;
+}
+
+/**
+@brief
+ This function executes the refresh configuration process.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval Nothing.
+**/
+void
+MrcRefreshConfiguration (
+ IN MrcParameters *const MrcData
+ )
+{
+ MCMNTS_CR_TC_RFP_STRUCT TcRFP;
+ U32 Offset;
+ U8 Channel;
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (&MrcData->SysOut.Outputs, Channel)) {
+ SetTcRftpReg (MrcData, Channel);
+ SetTcSrftpReg (MrcData, Channel);
+ SetTcZqCalReg (MrcData, Channel);
+
+ //
+ // set LP0 WM and OREF_RI to support high memory BW traffic
+ //
+ Offset = MCHBAR_CH0_CR_TC_RFP_REG +
+ ((MCHBAR_CH1_CR_TC_RFP_REG - MCHBAR_CH0_CR_TC_RFP_REG) * Channel);
+ TcRFP.Data = MrcReadCR (MrcData, Offset);
+ TcRFP.Bits.OREF_RI = 0xFF;
+ MrcWriteCR (MrcData, Offset, TcRFP.Data);
+ TcRFP.Data = MrcReadCR (MrcData, Offset);
+ MRC_DEBUG_MSG (
+ &MrcData->SysIn.Inputs.Debug,
+ MSG_LEVEL_NOTE,
+ "Ch%u: TC_RFP = %Xh\n OREF_RI = %u\n",
+ Channel,
+ TcRFP.Data,
+ TcRFP.Bits.OREF_RI
+ );
+ }
+ }
+
+ return;
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/McConfiguration/MrcRefreshConfiguration.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/McConfiguration/MrcRefreshConfiguration.h
new file mode 100644
index 0000000..9909dcd
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/McConfiguration/MrcRefreshConfiguration.h
@@ -0,0 +1,173 @@
+/** @file
+ This module include MRC_RefreshConfiguration external data
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _MrcRefreshConfiguration_h_
+#define _MrcRefreshConfiguration_h_
+
+#include "MrcTypes.h"
+#include "MrcApi.h"
+#include "McAddress.h"
+#include "MrcCommon.h"
+#include "MrcDdr3.h"
+#include "MrcOem.h"
+#include "MrcGlobal.h"
+
+///
+/// tDLLK values
+///
+#define tDLLK_VALUE 512
+
+///
+/// tXSOffset values
+///
+#define Offset_10nsec_800 4
+#define Offset_10nsec_1067 6
+#define Offset_10nsec_1333 7
+#define Offset_10nsec_1600 8
+#define Offset_10nsec_1867 10
+#define Offset_10nsec_2133 11
+#define Offset_10nsec_2400 12
+#define Offset_10nsec_2667 14
+
+///
+/// tMOD values. max(12nCK,15ns)
+///
+#define tMOD_800 12
+#define tMOD_1067 12
+#define tMOD_1333 12
+#define tMOD_1600 12
+#define tMOD_1867 14
+#define tMOD_2133 16
+#define tMOD_2400 18
+#define tMOD_2667 20
+
+///
+/// tZQOPER values.
+///
+#define tZQOPER_1600 256
+#define tZQOPER_1867 299
+#define tZQOPER_2133 342
+#define tZQOPER_2400 384
+#define tZQOPER_2667 427
+
+//
+// ZQCL and ZQCS values for LPDDR3, in [ps]
+//
+#define tZQCL_MIN 360000
+#define tZQCS_MIN 90000
+
+///
+/// tZQCS values.
+///
+#define tZQCS_1600 64
+#define tZQCS_1867 75
+#define tZQCS_2133 86
+#define tZQCS_2400 96
+#define tZQCS_2667 107
+
+//
+// ZQCS period values, in (tREFI * 128) units
+//
+#define ZQCS_PERIOD_DDR3 128 // tREFI * 128 = 7.8 us * 128 = 1ms
+#define ZQCS_PERIOD_LPDDR3 256 // tREFI * 128 = 3.9 us * 128 = 0.5ms
+
+/**
+@brief
+ This function returns the tZQOPER value.
+ tZQOPER = Defines the period required for ZQCL after SR exit.
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Frequency - The memory frequency.
+
+ @retval The tZQOPER value.
+**/
+extern
+U32
+tZQOPERGet (
+ IN MrcParameters *const MrcData,
+ IN const MrcFrequency Frequency
+ );
+
+/**
+@brief
+ This function returns the tMOD value.
+ tMOD = max(12nCK, 15ns) nCK change by the frequency.
+
+ @param[in] Frequency - The memory frequency.
+
+ @retval The tMOD value.
+**/
+extern
+U32
+tMODGet (
+ IN const MrcFrequency Frequency
+ );
+
+/**
+@brief
+ This function returns the tZQCS value.
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Frequency - The memory frequency.
+
+ @retval The tZQCS value.
+**/
+extern
+U32
+tZQCSGet (
+ IN MrcParameters *const MrcData,
+ IN const MrcFrequency Frequency
+ );
+
+/**
+@brief
+ This function configures the TC_MR2_SHADDOW register and its fields.
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Channel - Channel to work on.
+ @param[in] Dimm - Dimm to work on.
+ @param[in] Mr2Value - The value of MR2 to setup.
+
+ @retval Nothing.
+**/
+extern
+void
+SetTcMr2ShadowReg (
+ IN MrcParameters *const MrcData,
+ IN const U32 Channel,
+ IN const U32 Dimm,
+ IN U32 Mr2Value
+ );
+
+/**
+@brief
+ This function executes the refresh configuration process.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval Nothing.
+**/
+extern
+void
+MrcRefreshConfiguration (
+ IN MrcParameters *const MrcData
+ );
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/McConfiguration/MrcSchedulerParameters.c b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/McConfiguration/MrcSchedulerParameters.c
new file mode 100644
index 0000000..58d5e77
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/McConfiguration/MrcSchedulerParameters.c
@@ -0,0 +1,109 @@
+/** @file
+ This module configures the memory controller scheduler.
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved.
+
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+**/
+
+//
+// Include files
+//
+#include "MrcSchedulerParameters.h"
+
+/**
+@brief
+ This function configures the memory controller scheduler.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval Nothing.
+**/
+void
+MrcSchedulerParametersConfig (
+ IN MrcParameters *const MrcData
+ )
+{
+ const MrcInput *Inputs;
+ MrcOutput *Outputs;
+ MCSCHEDS_CR_SCHED_CBIT_STRUCT SchedCbit;
+ MCSCHEDS_CR_SCHED_SECOND_CBIT_STRUCT SchedSecondCbit;
+ U8 Channel;
+ U32 Offset;
+#ifdef ULT_FLAG
+ MCHBAR_CH0_CR_CMD_RATE_STRUCT CmdRate;
+#endif // ULT_FLAG
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ Channel = 0;
+ Offset = 0;
+ if ((Inputs->CpuModel == cmHSW) && (Inputs->CpuStepping == csHswA0)) {
+ SchedCbit.Data = SCHED_CBIT_DEFAULT;
+ } else {
+ SchedCbit.Data = SCHED_CBIT_DEFAULT_B0;
+ }
+#ifdef ULT_FLAG
+ if (Inputs->CpuModel == cmHSW_ULT) {
+ SchedCbit.Bits.dis_odt = 1;
+ if (Outputs->DdrType == MRC_DDR_TYPE_LPDDR3) {
+ //
+ // LPDDR3 DDP and QDP (multi-die) packages share the same ZQ pin,
+ // so we need to serialize the ZQ calibration for different ranks.
+ //
+ SchedCbit.Bits.Serialize_ZQ = 1;
+
+ if (Inputs->LpddrDramOdt) {
+ //
+ // DRAM ODT is used
+ //
+ SchedCbit.Bits.dis_odt = 0;
+ }
+ }
+ }
+#endif
+
+ MrcWriteCrMulticast (MrcData, MCSCHEDS_CR_SCHED_CBIT_REG, SchedCbit.Data);
+
+ MrcWriteCrMulticast (MrcData, MCMNTS_CR_SC_WDBWM_REG, SC_WDBWM_DEFAULT);
+
+ if (Outputs->AsyncOdtDis) {
+ SchedSecondCbit.Data = 0;
+ SchedSecondCbit.Bits.dis_async_odt = 1;
+ MrcWriteCR8 (MrcData, MCSCHEDS_CR_SCHED_SECOND_CBIT_REG + 1, SchedSecondCbit.Data8[1]);
+ }
+
+#ifdef ULT_FLAG
+ //
+ // For LPDDR3, set Command Rate Limit to 3
+ //
+ if (Outputs->DdrType == MRC_DDR_TYPE_LPDDR3) {
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ Offset = MCHBAR_CH0_CR_CMD_RATE_REG + ((MCHBAR_CH1_CR_CMD_RATE_REG - MCHBAR_CH0_CR_CMD_RATE_REG) * Channel);
+ CmdRate.Data = MrcReadCR (MrcData, Offset);
+ CmdRate.Bits.enable_cmd_rate_limit = 1;
+ CmdRate.Bits.cmd_rate_limit = 3;
+ MrcWriteCR (MrcData, Offset, CmdRate.Data);
+ }
+ }
+ }
+#endif
+
+
+ return;
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/McConfiguration/MrcSchedulerParameters.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/McConfiguration/MrcSchedulerParameters.h
new file mode 100644
index 0000000..75dca03
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/McConfiguration/MrcSchedulerParameters.h
@@ -0,0 +1,49 @@
+/** @file
+ This module includes the memory controller scheduler parameters.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved.
+
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+**/
+#ifndef _MrcSchedulerParameters_h_
+#define _MrcSchedulerParameters_h_
+
+#include "McAddress.h"
+#include "MrcTypes.h"
+#include "MrcApi.h"
+#include "MrcCommon.h"
+#include "MrcGlobal.h"
+
+#define SCHED_CBIT_DEFAULT (0x00100030)
+#define SCHED_CBIT_DEFAULT_B0 (0x00100000)
+
+#define SC_WDBWM_DEFAULT (0x553C3038)
+
+/**
+@brief
+ This function configures the memory controller scheduler.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval Nothing.
+**/
+void
+MrcSchedulerParametersConfig (
+ IN MrcParameters *const MrcData
+ );
+
+#endif // _MrcSchedulerParameters_h_
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/McConfiguration/MrcTimingConfiguration.c b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/McConfiguration/MrcTimingConfiguration.c
new file mode 100644
index 0000000..8f98dd2
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/McConfiguration/MrcTimingConfiguration.c
@@ -0,0 +1,921 @@
+/** @file
+ This module configures the memory controller timing parameters.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+
+**/
+#include "MrcTimingConfiguration.h"
+
+/**
+@brief
+ This function returns the tCKE value for the specified frequency.
+
+ @param[in] DdrType - DDR type
+ @param[in] Frequency - The memory frequency.
+
+ @retval The tCKE value for the specified frequency.
+**/
+static
+U32
+tCKEValue (
+ IN MrcDdrType DdrType,
+ IN const MrcFrequency Frequency
+ )
+{
+ U32 tCKE;
+
+#if (SUPPORT_LPDDR3 == SUPPORT)
+ if (DdrType == MRC_DDR_TYPE_LPDDR3) {
+ if (Frequency <= f1067) {
+ tCKE = tCKE_LPDDR_1067;
+ } else if (Frequency <= f1333) {
+ tCKE = tCKE_LPDDR_1333;
+ } else {
+ tCKE = tCKE_LPDDR_1600;
+ }
+ return tCKE;
+ }
+#endif // SUPPORT_LPDDR3
+
+ if (Frequency <= f800) {
+ tCKE = TCKE_800;
+ } else if (Frequency <= f1067) {
+ tCKE = TCKE_1067;
+ } else if (Frequency <= f1333) {
+ tCKE = TCKE_1333;
+ } else if (Frequency <= f1600) {
+ tCKE = TCKE_1600;
+ } else if (Frequency <= f1867) {
+ tCKE = TCKE_1867;
+ } else if (Frequency <= f2133) {
+ tCKE = TCKE_2133;
+ } else if (Frequency <= f2400) {
+ tCKE = TCKE_2400;
+ } else {
+ tCKE = TCKE_2667;
+ }
+
+ return tCKE;
+}
+
+/**
+@brief
+ This function returns the tXPDLL value for the specified frequency.
+
+ @param[in] Frequency - The memory frequency.
+
+ @retval The tXPDLL value for the specified frequency.
+**/
+static
+U32
+tXPDLLValue (
+ IN const MrcFrequency Frequency
+ )
+{
+ U32 tXPDLL;
+
+ if (Frequency <= f800) {
+ tXPDLL = TXPDLL_800;
+ } else if (Frequency <= f1067) {
+ tXPDLL = TXPDLL_1067;
+ } else if (Frequency <= f1333) {
+ tXPDLL = TXPDLL_1333;
+ } else if (Frequency <= f1600) {
+ tXPDLL = TXPDLL_1600;
+ } else if (Frequency <= f1867) {
+ tXPDLL = TXPDLL_1867;
+ } else if (Frequency <= f2133) {
+ tXPDLL = TXPDLL_2133;
+ } else if (Frequency <= f2400) {
+ tXPDLL = TXPDLL_2400;
+ } else {
+ tXPDLL = TXPDLL_2667;
+ }
+
+ return tXPDLL;
+}
+
+/**
+@brief
+ This function returns the tXP value for the specified frequency.
+
+ @param[in] DdrType - DDR type
+ @param[in] Frequency - The memory frequency.
+ @param[in] NMode - Command mode to lookup.
+
+ @retval The tXP value for the specified frequency.
+**/
+U32
+tXPValue (
+ IN MrcDdrType DdrType,
+ IN const MrcFrequency Frequency,
+ IN U8 NMode
+ )
+{
+ U32 tXP;
+
+#if (SUPPORT_LPDDR3 == SUPPORT)
+ if (DdrType == MRC_DDR_TYPE_LPDDR3) {
+ if (Frequency <= f1333) {
+ tXP = tXP_LPDDR_1333;
+ } else {
+ tXP = tXP_LPDDR_1600;
+ }
+ } else
+#endif // SUPPORT_LPDDR3
+ {
+ if (Frequency <= f1600) {
+ tXP = ((MC_tXP_1600_1N - 1) + NMode);
+ } else if (Frequency <= f1867) {
+ tXP = ((NMode <= 2) ? MC_tXP_1867_2N : MC_tXP_1867_3N);
+ } else if (Frequency <= f2133) {
+ tXP = (MC_tXP_2133_1N);
+ } else {
+ tXP = MC_tXP_MAX;
+ }
+ }
+ return (tXP);
+}
+
+/**
+@brief
+ This function returns the tAONPD value for the specified frequency.
+
+ @param[in] Frequency - The memory frequency.
+
+ @retval The tAONPD value for the specified frequency.
+**/
+static
+U32
+tAONPDValue (
+ IN const MrcFrequency Frequency
+ )
+{
+ U32 tAONPD;
+
+ if (Frequency <= f800) {
+ tAONPD = TAONPD_800;
+ } else if (Frequency <= f1067) {
+ tAONPD = TAONPD_1067;
+ } else if (Frequency <= f1333) {
+ tAONPD = TAONPD_1333;
+ } else if (Frequency <= f1600) {
+ tAONPD = TAONPD_1600;
+ } else if (Frequency <= f1867) {
+ tAONPD = TAONPD_1867;
+ } else if (Frequency <= f2133) {
+ tAONPD = TAONPD_2133;
+ } else if (Frequency <= f2400) {
+ tAONPD = TAONPD_2400;
+ } else {
+ tAONPD = TAONPD_2667;
+ }
+
+ return tAONPD;
+}
+
+/**
+@brief
+ This function sets up the TC-BANK register,
+ which includes the tRCD, tRP, tRAS, tRDPRE, tRTP, tWRPRE, and tRRD values.
+
+ @param[in, out] MrcData - Include all MRC global data.
+ @param[in] Channel - Channel select.
+
+ @retval Nothing.
+**/
+static
+void
+SetTcBankReg (
+ IN OUT MrcParameters *const MrcData,
+ IN const U32 Channel
+ )
+{
+ const MrcInput *Inputs;
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcChannelOut *ChannelOut;
+ MrcTiming *Timing;
+ MCHBAR_CH0_CR_TC_BANK_STRUCT CrTcBank;
+ U32 tWRPRE;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ ChannelOut = &Outputs->Controller[0].Channel[Channel];
+ Timing = &ChannelOut->Timing[Inputs->MemoryProfile];
+
+ //
+ // tWRPRE is = 4tCK + tWR + tWL = 4DCLK + tWR + tWL
+ //
+ tWRPRE = 4 + Timing->tCWL + Timing->tWR;
+
+ CrTcBank.Data = 0;
+ CrTcBank.Bits.tRCD = MIN (MCHBAR_CH0_CR_TC_BANK_tRCD_MAX, Timing->tRCD);
+ CrTcBank.Bits.tRP = MIN (MCHBAR_CH0_CR_TC_BANK_tRP_MAX, Timing->tRP);
+ CrTcBank.Bits.tRAS = MIN (MCHBAR_CH0_CR_TC_BANK_tRAS_MAX, Timing->tRAS);
+ CrTcBank.Bits.tRDPRE = MIN (MCHBAR_CH0_CR_TC_BANK_tRDPRE_MAX, Timing->tRTP);
+ CrTcBank.Bits.tWRPRE = MIN (MCHBAR_CH0_CR_TC_BANK_tWRPRE_MAX, tWRPRE);
+ CrTcBank.Bits.tRRD = MIN (MCHBAR_CH0_CR_TC_BANK_tRRD_MAX, Timing->tRRD);
+#ifdef ULT_FLAG
+ if (Outputs->DdrType == MRC_DDR_TYPE_LPDDR3) {
+ CrTcBank.Bits.tRPab_ext = MIN (MCHBAR_CH0_CR_TC_BANK_tRPab_ext_MAX, Timing->tRPab - Timing->tRP);
+ }
+#endif
+ MrcWriteCR (
+ MrcData,
+ MCHBAR_CH0_CR_TC_BANK_REG + ((MCHBAR_CH1_CR_TC_BANK_REG - MCHBAR_CH0_CR_TC_BANK_REG) * Channel),
+ CrTcBank.Data
+ );
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel %u:\n tRCD = %u\n", Channel, CrTcBank.Bits.tRCD);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " tRP = %u\n", CrTcBank.Bits.tRP);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " tRAS = %u\n", CrTcBank.Bits.tRAS);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " tRDPRE = %u\n", CrTcBank.Bits.tRDPRE);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " tWRPRE = %u\n", CrTcBank.Bits.tWRPRE);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " tRRD = %u\n", CrTcBank.Bits.tRRD);
+#ifdef ULT_FLAG
+ if (Outputs->DdrType == MRC_DDR_TYPE_LPDDR3) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " tRPab_ext = %u\n", CrTcBank.Bits.tRPab_ext);
+ }
+#endif
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " TC_BANK = %Xh\n", CrTcBank.Data);
+
+ //
+ // Save in MrcData structure
+ //
+ ChannelOut->MchbarBANK = CrTcBank.Data;
+
+ return;
+}
+
+/**
+@brief
+ This function sets up the TC_BANK_RANK_D register,
+ which includes the tCL and tWCL values.
+
+ @param[in, out] MrcData - Include all MRC global data.
+ @param[in] Channel - Channel select.
+
+ @retval Nothing.
+**/
+static
+void
+SetTcBankRankDReg (
+ IN OUT MrcParameters *const MrcData,
+ IN const U32 Channel
+ )
+{
+ const MrcInput *Inputs;
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcChannelOut *ChannelOut;
+ MrcTiming *Timing;
+ MCHBAR_CH0_CR_TC_BANK_RANK_D_STRUCT TcBankRankD;
+ U32 OdtReadDelay;
+#ifdef ULT_FLAG
+ U32 OdtWriteDelay;
+ U32 OdtWriteDuration;
+ U32 DclkPs;
+#endif // ULT_FLAG
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ Debug = &Inputs->Debug;
+ ChannelOut = &MrcData->SysOut.Outputs.Controller[0].Channel[Channel];
+ Timing = &ChannelOut->Timing[Inputs->MemoryProfile];
+
+ //
+ // @todo: Need to make sure this value, after power on, follows the restrictions in the XML description.
+ //
+ OdtReadDelay = Timing->tCL - Timing->tCWL;
+
+ TcBankRankD.Data = 0;
+ TcBankRankD.Bits.tWCL = MIN (MCHBAR_CH0_CR_TC_BANK_RANK_D_tWCL_MAX, Timing->tCWL);
+ TcBankRankD.Bits.tCL = MIN (MCHBAR_CH0_CR_TC_BANK_RANK_D_tCL_MAX, Timing->tCL);
+ TcBankRankD.Bits.tCPDED = MCHBAR_CH0_CR_TC_BANK_RANK_D_tCPDED_DEF;
+ TcBankRankD.Bits.tPRPDEN = MCHBAR_CH0_CR_TC_BANK_RANK_D_tPRPDEN_DEF;
+ TcBankRankD.Bits.Odt_Read_Delay = MIN (MCHBAR_CH0_CR_TC_BANK_RANK_D_Odt_Read_Delay_MAX, OdtReadDelay);
+
+#ifdef ULT_FLAG
+ if (Outputs->DdrType == MRC_DDR_TYPE_LPDDR3) {
+ if (Inputs->LpddrDramOdt) {
+ //
+ // Only ODT[0] is used in ULT, need to use it for both ranks
+ //
+ TcBankRankD.UltBits.Odt_Always_Rank0 = 1;
+ }
+
+ //
+ // Timing->tCWL has 1 extra clock because of tDQSS - subtract it here.
+ //
+ TcBankRankD.Bits.tWCL--;
+
+ //
+ // JEDEC Spec requires tCPDED should be 2 clocks for all LPDDR3 frequencies
+ //
+ TcBankRankD.Bits.tCPDED = 2;
+
+ DclkPs = Outputs->Qclkps * 2;
+
+ //
+ // Odt_Write_Delay = WL - 1 - RU(tODTon(max))
+ //
+ OdtWriteDelay = Timing->tCWL - 1 - (tODT_ON_MAX + DclkPs - 1) / DclkPs;
+
+ //
+ // Odt_Write_Duration = 6 + RU(tODTon(max)-tODToff(min)) - 6 + 1
+ //
+ OdtWriteDuration = 1 + (tODT_ON_MAX - tODT_OFF_MIN + DclkPs - 1) / DclkPs;
+
+ TcBankRankD.UltBits.Odt_Write_Delay = MIN (MCHBAR_CH0_CR_TC_BANK_RANK_D_Odt_Write_Delay_Ult_MAX, OdtWriteDelay);
+ TcBankRankD.UltBits.Odt_Write_Duration = MIN (MCHBAR_CH0_CR_TC_BANK_RANK_D_Odt_Write_Duration_Ult_MAX, OdtWriteDuration);
+ }
+#endif // ULT_FLAG
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel %u:\n tCL = %u\n", Channel, TcBankRankD.Bits.tCL);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " tWCL = %u\n", TcBankRankD.Bits.tWCL);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " tCPDED = %u\n", TcBankRankD.Bits.tCPDED);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " tPRPDEN = %u\n", TcBankRankD.Bits.tPRPDEN);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " Odt_Read_Delay = %u\n", TcBankRankD.Bits.Odt_Read_Delay);
+#ifdef ULT_FLAG
+ if (Outputs->DdrType == MRC_DDR_TYPE_LPDDR3) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " Odt_Write_Delay = %u\n", TcBankRankD.UltBits.Odt_Write_Delay);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " Odt_Write_Duration = %u\n", TcBankRankD.UltBits.Odt_Write_Duration);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " Odt_Always_Rank0 = %u\n", TcBankRankD.UltBits.Odt_Always_Rank0);
+ }
+#endif // ULT_FLAG
+
+ MrcWriteCR (
+ MrcData,
+ MCHBAR_CH0_CR_TC_BANK_RANK_D_REG + ((MCHBAR_CH1_CR_TC_BANK_RANK_D_REG - MCHBAR_CH0_CR_TC_BANK_RANK_D_REG) * Channel),
+ TcBankRankD.Data
+ );
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " TC_BANK_RANK_D = %Xh\n", TcBankRankD.Data);
+
+ //
+ // Save in MrcData structure
+ //
+ ChannelOut->MchbarBANKRANKD = TcBankRankD.Data;
+
+ return;
+}
+
+/**
+@brief
+ This function sets up the TC_BANK_RANK_A register.
+ which includes the tCKE, tFAW, tRDRD, tRDRD_dr, tRDRD_dd, tRDPDEN, and command rate mode.
+
+ @param[in, out] MrcData - Include all MRC global data.
+ @param[in] Channel - Channel select.
+
+ @retval Nothing.
+**/
+static
+void
+SetTcBankRankAReg (
+ IN OUT MrcParameters *const MrcData,
+ IN const U32 Channel
+ )
+{
+ const MrcInput *Inputs;
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcTiming *Timing;
+ MrcDdrType DdrType;
+ MCHBAR_CH0_CR_TC_BANK_RANK_A_STRUCT TcBankRankA;
+ U32 CRValue;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ Timing = &Outputs->Controller[0].Channel[Channel].Timing[Inputs->MemoryProfile];
+ DdrType = Outputs->DdrType;
+ TcBankRankA.Data = 0;
+
+ //
+ // Get the tCKE value.
+ //
+ CRValue = tCKEValue (DdrType, Outputs->Frequency);
+ TcBankRankA.Bits.tCKE = MIN (MCHBAR_CH1_CR_TC_BANK_RANK_A_tCKE_MAX, CRValue);
+
+ //
+ // Get the command rate mode value.
+ // Use 3N mode during training steps
+ //
+#ifdef ULT_FLAG
+ if (Outputs->DdrType == MRC_DDR_TYPE_LPDDR3) {
+ //
+ // Need to use 1N mode for LPDDR
+ //
+ TcBankRankA.Bits.CMD_stretch = 0;
+ } else
+#endif // ULT_FLAG
+ {
+ TcBankRankA.Bits.CMD_stretch = MIN (MCHBAR_CH1_CR_TC_BANK_RANK_A_CMD_stretch_MAX, 3);
+ }
+ //
+ // Program tFAW value
+ //
+ TcBankRankA.Bits.tFAW = MIN (MCHBAR_CH1_CR_TC_BANK_RANK_A_tFAW_MAX, Timing->tFAW);
+
+ //
+ // Calculate tRDRD
+ //
+ TcBankRankA.Bits.tRDRD = MIN (MCHBAR_CH1_CR_TC_BANK_RANK_A_tRDRD_MAX, TCCD_ALL_FREQ);
+
+ //
+ // Calculate tRDRD_dr = BL/2 + max(tRTR, ODT(R,R,DR)) + tRPRE
+ //
+ CRValue = 4 + 1 + TRPRE_ALL_FREQ;
+
+#ifdef ULT_FLAG
+ if (Outputs->DdrType == MRC_DDR_TYPE_LPDDR3) {
+ //
+ // Increase tRDRD_dr from 6 to 7 DCLKs on LPDDR3
+ //
+ CRValue++;
+ }
+#endif // ULT_FLAG
+
+ TcBankRankA.Bits.tRDRD_dr = MIN (MCHBAR_CH1_CR_TC_BANK_RANK_A_tRDRD_dr_MAX, CRValue);
+
+ //
+ // Calculate tRDRD_dd = BL/2 + max(tRTR, ODT(R,R,DD)) + tRPRE
+ //
+ TcBankRankA.Bits.tRDRD_dd = MIN (MCHBAR_CH1_CR_TC_BANK_RANK_A_tRDRD_dd_MAX, CRValue);
+
+ //
+ // Calculate tRDPDEN = tCL + BL/2 +1
+ //
+ CRValue = Timing->tCL + 5;
+ TcBankRankA.Bits.tRDPDEN = MIN (MCHBAR_CH1_CR_TC_BANK_RANK_A_tRDPDEN_MAX, CRValue);
+
+ //
+ // Disable command tri state before training.
+ //
+ TcBankRankA.Bits.CMD_3st = 1;
+
+ MrcWriteCR (
+ MrcData,
+ MCHBAR_CH0_CR_TC_BANK_RANK_A_REG + ((MCHBAR_CH1_CR_TC_BANK_RANK_A_REG - MCHBAR_CH0_CR_TC_BANK_RANK_A_REG) * Channel),
+ TcBankRankA.Data
+ );
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel %u:\n tCKE = %u\n", Channel, TcBankRankA.Bits.tCKE);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " NMode = %u\n", TcBankRankA.Bits.CMD_stretch);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " tFAW = %u\n", TcBankRankA.Bits.tFAW);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " tRDRD = %u\n", TcBankRankA.Bits.tRDRD);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " tRDRD_dr = %u\n", TcBankRankA.Bits.tRDRD_dr);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " tRDRD_dd = %u\n", TcBankRankA.Bits.tRDRD_dd);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " tRDPDEN = %u\n", TcBankRankA.Bits.tRDPDEN);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " CMD_3st = %u\n", TcBankRankA.Bits.CMD_3st);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " TC_BANK_RANK_A = %Xh\n", TcBankRankA.Data);
+
+ //
+ // Save in MrcData structure
+ //
+ Outputs->Controller[0].Channel[Channel].MchbarBANKRANKA = TcBankRankA.Data;
+
+ return;
+}
+
+/**
+@brief
+ This function sets up the TC_BANK_RANK_B register, which includes
+ Dec_WRD, tWRPDEN, tWRWR_dd, tWRWR_dr, tWRWR, tWRRD_dd, tWRRD_dr and tWRRD.
+
+ @param[in, out] MrcData - Include all MRC global data.
+ @param[in] Channel - Channel select.
+
+ @retval Nothing.
+**/
+static
+void
+SetTcBankRankBReg (
+ IN OUT MrcParameters *const MrcData,
+ IN const U32 Channel
+ )
+{
+ const MrcInput *Inputs;
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcTiming *Timing;
+ MCHBAR_CH0_CR_TC_BANK_RANK_B_STRUCT TcBankRankB;
+ MCHBAR_CH0_CR_TC_BANK_RANK_D_STRUCT TcBankRankD;
+ MCHBAR_CH0_CR_SC_WR_ADD_DELAY_STRUCT ScWrAddDelay;
+ U32 CRValue;
+ U32 tWRRD_dr;
+ U32 tWRWR_dr;
+ U32 Offset;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ Timing = &Outputs->Controller[0].Channel[Channel].Timing[Inputs->MemoryProfile];
+ TcBankRankB.Data = 0;
+
+ //
+ // Calculate tWRRD = tCCD + tCWL + tWTR + max(tWrCAS2RdCAS_sr,ODT(W,R,SR)).
+ //
+ CRValue = TCCD_ALL_FREQ + Timing->tCWL + Timing->tWTR + 2;
+ TcBankRankB.Bits.tWRRD = MIN (MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRRD_MAX, CRValue);
+
+ //
+ // Calculate tWRRD_dr = tCWL-tCL + BL/2 + max(tWRDRDD,ODT(W,R,DR)) + tRPRE
+ //
+ tWRRD_dr = Timing->tCWL - Timing->tCL + 4 + 2 + TRPRE_ALL_FREQ;
+
+#ifdef ULT_FLAG
+ if (Outputs->DdrType == MRC_DDR_TYPE_LPDDR3) {
+ //
+ // tWRRD_dr is 8 for all LPDDR bins
+ //
+ tWRRD_dr = 8;
+ }
+#endif // ULT_FLAG
+
+ TcBankRankB.Bits.tWRRD_dr = MIN (MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRRD_dr_MAX, tWRRD_dr);
+
+ //
+ // Calculate tWRRD_dd = tCWL-tCL + BL/2 + max(tWRDRDD,ODT(W,R,DR)) + tRPRE
+ //
+ TcBankRankB.Bits.tWRRD_dd = MIN (MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRRD_dd_MAX, tWRRD_dr);
+
+ //
+ // Calculate tWRWR
+ //
+ TcBankRankB.Bits.tWRWR = MIN (MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRWR_MAX, TCCD_ALL_FREQ);
+
+ //
+ // Calculate tWRWR_dr = BL/2 + max(tWWDR,ODT(W,W,DR)) + tWPRE
+ //
+ tWRWR_dr = 4 + 2 + TWPRE_ALL_FREQ;
+ TcBankRankB.Bits.tWRWR_dr = MIN (MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRWR_dr_MAX, tWRWR_dr);
+
+ //
+ // Calculate tWRWR_dd = BL/2 + max(tWWDD,ODT(W,W,DR)) + tWPRE
+ //
+ TcBankRankB.Bits.tWRWR_dd = MIN (MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRWR_dd_MAX, tWRWR_dr);
+
+ //
+ // Calculate tWRPDEN = tWR+tWL+BL/2
+ //
+ CRValue = Timing->tWR + Timing->tCWL + 4;
+ TcBankRankB.Bits.tWRPDEN = MIN (MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRPDEN_MAX, CRValue);
+
+ //
+ // Set Dec_WRD.
+ // Can be set to 1 only if tWCL is 6 or more.
+ //
+ Offset = MCHBAR_CH0_CR_TC_BANK_RANK_D_REG +
+ (MCHBAR_CH1_CR_TC_BANK_RANK_D_REG - MCHBAR_CH0_CR_TC_BANK_RANK_D_REG) * Channel;
+ TcBankRankD.Data = MrcReadCR (MrcData, Offset);
+ if (TcBankRankD.Bits.tWCL >= 6) {
+ TcBankRankB.Bits.Dec_WRD = 1;
+ } else {
+ TcBankRankB.Bits.Dec_WRD = 0;
+ }
+
+ MrcWriteCR (
+ MrcData,
+ MCHBAR_CH0_CR_TC_BANK_RANK_B_REG + ((MCHBAR_CH1_CR_TC_BANK_RANK_B_REG - MCHBAR_CH0_CR_TC_BANK_RANK_B_REG) * Channel),
+ TcBankRankB.Data
+ );
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel %u:\n tWRRD = %u\n", Channel, TcBankRankB.Bits.tWRRD);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " tWRRD_dr = %u\n", TcBankRankB.Bits.tWRRD_dr);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " tWRRD_dd = %u\n", TcBankRankB.Bits.tWRRD_dd);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " tWRWR = %u\n", TcBankRankB.Bits.tWRWR);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " tWRWR_dr = %u\n", TcBankRankB.Bits.tWRWR_dr);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " tWRWR_dd = %u\n", TcBankRankB.Bits.tWRWR_dd);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " tWRPDEN = %u\n", TcBankRankB.Bits.tWRPDEN);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " Dec_WRD = %u\n", TcBankRankB.Bits.Dec_WRD);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " TC_BANK_RANK_B = %Xh\n", TcBankRankB.Data);
+
+ //
+ // Save in MrcData structure
+ //
+ Outputs->Controller[0].Channel[Channel].MchbarBANKRANKB = TcBankRankB.Data;
+
+ //
+ // Set sc_wr_add_delay accordingly = 1 + Dec_WRD
+ //
+ CRValue = TcBankRankB.Bits.Dec_WRD + 1;
+ ScWrAddDelay.Data = 0;
+ ScWrAddDelay.Bits.D1R1 = MIN (MCHBAR_CH0_CR_SC_WR_ADD_DELAY_D1R1_MAX, CRValue);
+ ScWrAddDelay.Bits.D1R0 = MIN (MCHBAR_CH0_CR_SC_WR_ADD_DELAY_D1R0_MAX, CRValue);
+ ScWrAddDelay.Bits.D0R1 = MIN (MCHBAR_CH0_CR_SC_WR_ADD_DELAY_D0R1_MAX, CRValue);
+ ScWrAddDelay.Bits.D0R0 = MIN (MCHBAR_CH0_CR_SC_WR_ADD_DELAY_D0R0_MAX, CRValue);
+ MrcWriteCR8 (
+ MrcData,
+ MCHBAR_CH0_CR_SC_WR_ADD_DELAY_REG +
+ ((MCHBAR_CH1_CR_SC_WR_ADD_DELAY_REG - MCHBAR_CH0_CR_SC_WR_ADD_DELAY_REG) * Channel),
+ (U8) ScWrAddDelay.Data
+ );
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " SC_WR_ADD_Delay = %Xh\n", ScWrAddDelay.Data);
+
+ return;
+}
+
+/**
+@brief
+ This function sets up the TC_BANK_RANK_C register, which includes
+ TAONPD, tXP, tXPDLL, tRDWR, tRDWR_dr, and tRDWR_dd.
+
+ @param[in, out] MrcData - Include all MRC global data.
+ @param[in] Channel - Channel select.
+
+ @retval Nothing.
+**/
+static
+void
+SetTcBankRankCReg (
+ IN OUT MrcParameters *const MrcData,
+ IN const U32 Channel
+ )
+{
+ const MrcInput *Inputs;
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcTiming *Timing;
+ MrcDdrType DdrType;
+ MCHBAR_CH0_CR_TC_BANK_RANK_C_STRUCT TcBankRankC;
+ U32 Value;
+ U32 DclkPs;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ Timing = &Outputs->Controller[0].Channel[Channel].Timing[Inputs->MemoryProfile];
+ DdrType = Outputs->DdrType;
+ TcBankRankC.Data = 0;
+
+ Value = tXPDLLValue (Outputs->Frequency);
+ TcBankRankC.Bits.tXPDLL = MIN (MCHBAR_CH0_CR_TC_BANK_RANK_C_tXPDLL_MAX, Value);
+
+ Value = tXPValue (DdrType, Outputs->Frequency, 3);
+ TcBankRankC.Bits.tXP = MIN (MCHBAR_CH0_CR_TC_BANK_RANK_C_tXP_MAX, Value);
+
+ Value = tAONPDValue (Outputs->Frequency);
+ TcBankRankC.Bits.TAONPD = MIN (MCHBAR_CH0_CR_TC_BANK_RANK_C_TAONPD_MAX, Value);
+
+ //
+ // Calculate tRDWR = tCL-tCWL+tCCD+tWPRE+max(tRWSR,ODT(R,W,SR))
+ // tWPRE - Write Preamble
+ //
+ Value = Timing->tCL - Timing->tCWL + TCCD_ALL_FREQ + TWPRE_ALL_FREQ + 2;
+ //
+ // Add 1 for frequencies above 1333.
+ //
+ if (Outputs->Frequency > f1333) {
+ Value++;
+ }
+
+ DclkPs = Outputs->Qclkps * 2;
+
+#ifdef ULT_FLAG
+ if (DdrType == MRC_DDR_TYPE_LPDDR3) {
+ //
+ // tRDWR = tCL - tCWL + tDQSCK_max + tCCD + tWPRE + ElectricalTurnaround
+ //
+ Value = Timing->tCL - Timing->tCWL + (tDQSCK_MAX + DclkPs - 1) / DclkPs +
+ TCCD_ALL_FREQ + TWPRE_ALL_FREQ + 1;
+ }
+#endif // ULT_FLAG
+
+ TcBankRankC.Bits.tRDWR = MIN (MCHBAR_CH0_CR_TC_BANK_RANK_C_tRDWR_MAX, Value);
+
+ //
+ // Calculate tRDWR_dr = tCL-tCWL+tCCD+tWPRE+max(tRWSR,ODT(R,W,SR))
+ //
+ TcBankRankC.Bits.tRDWR_dr = MIN (MCHBAR_CH0_CR_TC_BANK_RANK_C_tRDWR_dr_MAX, Value);
+
+ //
+ // Calculate tRDWR_dd = tCL-tCWL+tCCD+tWPRE+max(tRWSR,ODT(R,W,SR))
+ //
+ TcBankRankC.Bits.tRDWR_dd = MIN (MCHBAR_CH0_CR_TC_BANK_RANK_C_tRDWR_dd_MAX, Value);
+
+ MrcWriteCR (
+ MrcData,
+ MCHBAR_CH0_CR_TC_BANK_RANK_C_REG + ((MCHBAR_CH1_CR_TC_BANK_RANK_C_REG - MCHBAR_CH0_CR_TC_BANK_RANK_C_REG) * Channel),
+ TcBankRankC.Data
+ );
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel %u:\n tXPDLL = %u\n", Channel, TcBankRankC.Bits.tXPDLL);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " tXP = %u\n", TcBankRankC.Bits.tXP);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " tAONPD = %u\n", TcBankRankC.Bits.TAONPD);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " tRDWR = %u\n", TcBankRankC.Bits.tRDWR);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " tRDWR_dr = %u\n", TcBankRankC.Bits.tRDWR_dr);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " tRDWR_dd = %u\n", TcBankRankC.Bits.tRDWR_dd);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " TC_BANK_RANK_C = %Xh\n", TcBankRankC.Data);
+
+ //
+ // Save in MrcData structure
+ //
+ Outputs->Controller[0].Channel[Channel].MchbarBANKRANKC = TcBankRankC.Data;
+
+ return;
+}
+
+/**
+@brief
+ This function configures the memory controller timings.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval Nothing.
+**/
+void
+MrcTimingConfiguration (
+ IN MrcParameters *const MrcData
+ )
+{
+ U8 Channel;
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (&MrcData->SysOut.Outputs, Channel)) {
+ //
+ // setup TC-BANK register
+ //
+ SetTcBankReg (MrcData, Channel);
+
+ //
+ // setup TC-BANK_RANK_D register
+ //
+ SetTcBankRankDReg (MrcData, Channel);
+
+ //
+ // setup TC-BANK_RANK_A register
+ //
+ SetTcBankRankAReg (MrcData, Channel);
+
+ //
+ // setup TC-BANK_RANK_B register
+ //
+ SetTcBankRankBReg (MrcData, Channel);
+
+ //
+ // setup TC-BANK_RANK_C register
+ //
+ SetTcBankRankCReg (MrcData, Channel);
+ }
+ }
+
+ //
+ // Check RawCard Types and adjust Read ODT if needed
+ //
+ RdOdtStretch (MrcData);
+
+ return;
+}
+
+/**
+@brief
+ This function sets up the Read ODTD values based on RawCard types and adjusts the tDRRD2RD, tDDRD2RD, tDRRD2WR and tDDRD2WR
+
+ @param[in, out] MrcData - Include all MRC global data.
+
+ @retval Nothing.
+**/
+void
+RdOdtStretch (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ const MrcDebug *Debug;
+ const MrcInput *Inputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ U8 Channel;
+ U8 ChBitMask;
+ U8 RankMaskCh;
+ S8 OdtStretch;
+#if SUPPORT_SODIMM == SUPPORT
+ MrcDimmOut *DimmOut;
+ BOOL SoDimm;
+ U8 Value;
+ U8 Dimm;
+ U8 DimmRawCardType[MAX_DIMMS_IN_CHANNEL];
+ MCHBAR_CH0_CR_TC_BANK_RANK_A_STRUCT TcBankRankA;
+ MCHBAR_CH0_CR_TC_BANK_RANK_C_STRUCT TcBankRankC;
+#endif //SUPPORT_SODIMM == SUPPORT
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ ControllerOut = &MrcData->SysOut.Outputs.Controller[0];
+
+ ChBitMask = 0;
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ if (ChannelOut->ValidRankBitMask && (ChannelOut->DimmCount == 2)) {
+ ChBitMask |= (MRC_BIT0 << Channel);
+ }
+ }
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!((MRC_BIT0 << Channel) & ChBitMask)) {
+ //
+ // Skip any channels that do not have 2 DIMMs populated
+ //
+ continue;
+ }
+
+ ChannelOut = &ControllerOut->Channel[Channel];
+ RankMaskCh = ChannelOut->ValidRankBitMask;
+ //
+ // Start with the most aggressive setting
+ //
+ OdtStretch = 6;
+
+#if SUPPORT_SODIMM == SUPPORT
+ SoDimm = FALSE;
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ if (((DimmOut->ModuleType == MRC_MODULE_TYPE_SODIMM) || (DimmOut->ModuleType == MRC_MODULE_72B_SO_UDIMM))
+ && (SoDimm == FALSE)) {
+ SoDimm = TRUE;
+ }
+ if (SoDimm) {
+ DimmRawCardType[Dimm] = DimmOut->ReferenceRawCard;
+ }
+ }
+
+ if (SoDimm) {
+ if ((DimmRawCardType[0] == rcF || DimmRawCardType[1] == rcF)
+ && (DimmRawCardType[0] != DimmRawCardType[1])) {
+ OdtStretch = 7;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE,"Rd Odt Stretch F\n");
+ }
+ }
+#endif //SUPPORT_SODIMM == SUPPORT
+ //
+ // Program Rdodtd value
+ //
+ UpdateTAParamOffset (MrcData, Channel, 0, rdodtd, OdtStretch, 1, 1, RankMaskCh);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Selected RdOdtD Offset for channel %d is = %d\n", Channel, OdtStretch);
+
+#if SUPPORT_SODIMM == SUPPORT
+ if (OdtStretch > 6) {
+ TcBankRankA.Data = ChannelOut->MchbarBANKRANKA;
+ Value = (U8)(TcBankRankA.Bits.tRDRD_dr);
+ Value += OdtStretch - 6;
+ //
+ // Program Different Rank RD 2 RD value
+ //
+ UpdateTAParamOffset (MrcData, Channel, 0, drrd2rd, Value, 1, 1, RankMaskCh);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Selected DR RD2RD Offset for channel %d is = %d\n", Channel, Value);
+
+ Value = (U8)(TcBankRankA.Bits.tRDRD_dd);
+ Value += OdtStretch - 6;
+ //
+ // Program Different DIMM RD 2 RD value
+ //
+ UpdateTAParamOffset (MrcData, Channel, 0, ddrd2rd, Value, 1, 1, RankMaskCh);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Selected DD RD2RD Offset for channel %d is = %d\n", Channel, Value);
+
+ TcBankRankC.Data = ChannelOut->MchbarBANKRANKC;
+ Value = (U8)(TcBankRankC.Bits.tRDWR_dr);
+ Value += OdtStretch - 6;
+ //
+ // Program Different Rank RD 2 WR value
+ //
+ UpdateTAParamOffset (MrcData, Channel, 0, drrd2wr, Value, 1, 1, RankMaskCh);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Selected DR RD2WR Offset for channel %d is = %d\n", Channel, Value);
+
+ Value = (U8)(TcBankRankC.Bits.tRDWR_dd);
+ Value += OdtStretch - 6;
+ //
+ // Program Different DIMM RD 2 WR value
+ //
+ UpdateTAParamOffset (MrcData, Channel, 0, ddrd2wr, Value, 1, 1, RankMaskCh);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Selected DD RD2WR Offset for channel %d is = %d\n", Channel, Value);
+
+ Value = (U8)(TcBankRankC.Bits.tRDWR);
+ Value += OdtStretch - 6;
+ //
+ // Program Same Rank RD 2 WR value
+ //
+ UpdateTAParamOffset (MrcData, Channel, 0, srrd2wr, Value, 1, 1, RankMaskCh);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Selected SR RD2WR Offset for channel %d is = %d\n", Channel, Value);
+ }
+#endif //SUPPORT_SODIMM == SUPPORT
+ }
+
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/McConfiguration/MrcTimingConfiguration.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/McConfiguration/MrcTimingConfiguration.h
new file mode 100644
index 0000000..c9bb6c3
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/McConfiguration/MrcTimingConfiguration.h
@@ -0,0 +1,167 @@
+/** @file
+ This module configures the memory controller timing parameters.
+
+@Copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved.
+
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+**/
+#ifndef _MrcTimingConfiguration_h_
+#define _MrcTimingConfiguration_h_
+
+#include "MrcTypes.h"
+#include "MrcApi.h"
+#include "McAddress.h"
+#include "MrcCommon.h"
+#include "MrcDdr3.h"
+#include "MrcGlobal.h"
+#include "MrcOem.h"
+#if SUPPORT_SODIMM == SUPPORT
+#include "MrcSpdProcessing.h"
+#endif //SUPPORT_SODIMM == SUPPORT
+
+///
+/// tCCD values.
+///
+#define TCCD_ALL_FREQ (4) ///< tCCD is = 4 DCLK for all frequencies up to 1600.
+///
+/// tWPRE values.
+///
+#define TWPRE_ALL_FREQ (1) ///< tWPRE is = 1 DCLK for all frequencies up to 1600.
+///
+/// tRPRE values.
+///
+#define TRPRE_ALL_FREQ (1) ///< tRPRE is = 1 DCLK for all frequencies up to 1600.
+///
+/// tCKE values.
+///
+#define TCKE_800 (3)
+#define TCKE_1067 (3)
+#define TCKE_1333 (4)
+#define TCKE_1600 (4)
+#define TCKE_1867 (5)
+#define TCKE_2133 (6)
+#define TCKE_2400 (6)
+#define TCKE_2667 (7)
+
+///
+/// tCKE values for LPDDR: max(7.5ns, 3nCK)
+///
+#define tCKE_LPDDR_1067 (4)
+#define tCKE_LPDDR_1333 (5)
+#define tCKE_LPDDR_1600 (6)
+
+///
+/// tXP values for LPDDR: max(7.5ns, 3nCK)
+///
+#define tXP_LPDDR_1333 (5)
+#define tXP_LPDDR_1600 (6)
+
+///
+/// tXPDLL values.
+///
+#define TXPDLL_800 (10)
+#define TXPDLL_1067 (13)
+#define TXPDLL_1333 (16)
+#define TXPDLL_1600 (20)
+#define TXPDLL_1867 (23)
+#define TXPDLL_2133 (26)
+#define TXPDLL_2400 (29)
+#define TXPDLL_2667 (32)
+
+///
+/// tAONPD values.
+///
+#define TAONPD_800 (4)
+#define TAONPD_1067 (5)
+#define TAONPD_1333 (6)
+#define TAONPD_1600 (7) ///< SNB had 8
+#define TAONPD_1867 (8)
+#define TAONPD_2133 (10)
+#define TAONPD_2400 (11)
+#define TAONPD_2667 (12)
+
+#define MC_tXP_1600_1N (5)
+#define MC_tXP_1867_2N (6)
+#define MC_tXP_1867_3N (7)
+#define MC_tXP_2133_1N (7)
+#define MC_tXP_MAX (8) ///< The maximum value that the MC supports.
+
+///
+/// tODTon / tODToff values, in [ps]
+///
+#define tODT_ON_MIN 1750
+#define tODT_ON_MAX 3500
+#define tODT_OFF_MIN 1750
+#define tODT_OFF_MAX 3500
+
+///
+/// tDQSCK values, in [ps]
+///
+#define tDQSCK_MIN 2500
+#define tDQSCK_MAX 5500
+///
+/// Specified in PI-Ticks. 64 == 1 QClk
+///
+#define tDQSCK_DRIFT 64
+
+/**
+@brief
+ This function configures the memory controller timings.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval Nothing.
+**/
+extern
+void
+MrcTimingConfiguration (
+ IN MrcParameters *const MrcData
+ );
+
+/**
+@brief
+ This function returns the tXP value for the specified frequency.
+
+ @param[in] DdrType - DDR type
+ @param[in] Frequency - The memory frequency.
+ @param[in] NMode - Command mode to lookup.
+
+ @retval The tXP value for the specified frequency.
+**/
+extern
+U32
+tXPValue (
+ IN MrcDdrType DdrType,
+ IN const MrcFrequency Frequency,
+ IN U8 NMode
+ );
+
+/**
+@brief
+ This function sets up the Read ODTD values based on RawCard types and adjusts the tDRRD2RD, tDDRD2RD, tDRRD2WR and tDDRD2WR
+
+ @param[in, out] MrcData - Include all MRC global data.
+
+ @retval Nothing.
+**/
+extern
+void
+RdOdtStretch (
+ IN OUT MrcParameters *const MrcData
+ );
+
+#endif // _MrcTimingConfiguration_h_
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/ReadTraining/MrcReadDqDqs.c b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/ReadTraining/MrcReadDqDqs.c
new file mode 100644
index 0000000..7403971
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/ReadTraining/MrcReadDqDqs.c
@@ -0,0 +1,1207 @@
+/** @file
+ Once DQS is aligned against the clock in the receive enable training flow,
+ the second stage of the read training is the DQ/DQS training, aligning each
+ strobe with it's byte of data. The DQ/DQS training is once again using the
+ DDR read synchronization mode, in this mode a predetermined pattern is read
+ out of the DDR. The following algorithm is used to align the data sampling
+ to the best sampling point.
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+
+**/
+
+//
+// Include files
+//
+#include "MrcReadDqDqs.h"
+
+/**
+ Perform Read MPR Training.
+ Center read DQ-DQS with MPR pattern.
+
+ @param[in, out] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - mrcSuccess or reason for failure.
+**/
+MrcStatus
+MrcReadMprTraining (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ const MrcInput *Inputs;
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcChannelOut *ChannelOut;
+ MrcStatus Status;
+ U8 Channel;
+ U8 Rank;
+ U8 Byte;
+ U8 ChBitMask;
+ U8 RankMask; // RankBitMask for both channels
+ U8 LoopCount;
+ S8 MPRCorrectionFactor;
+ S8 DqsDelay;
+ S32 CurrentPassingStart[MAX_CHANNEL][MAX_SDRAM_IN_DIMM];
+ S32 CurrentPassingEnd[MAX_CHANNEL][MAX_SDRAM_IN_DIMM];
+ S32 LargestPassingStart[MAX_CHANNEL][MAX_SDRAM_IN_DIMM];
+ S32 LargestPassingEnd[MAX_CHANNEL][MAX_SDRAM_IN_DIMM];
+ S32 cWidth;
+ S32 lWidth;
+ S32 Center;
+ S32 Center2;
+ BOOL Pass;
+ BOOL Lpddr;
+ U32 Offset;
+ U32 OdtSampExtendDelay;
+ MCHBAR_CH0_CR_REUT_CH_MISC_ODT_CTRL_STRUCT ReutChMiscOdtCtrl;
+ MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_STRUCT ReutGlobalCtl;
+ DDRDATACH0_CR_DDRCRDATACONTROL0_STRUCT DdrCrDataControl0;
+ DDRDATA0CH0_CR_DDRCRDATACONTROL2_STRUCT DdrCrDataControl2;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ Status = mrcSuccess;
+ Lpddr = (Outputs->DdrType == MRC_DDR_TYPE_LPDDR3);
+
+ LoopCount = 10;
+ OdtSampExtendDelay = 1 * HPET_MIN;
+
+ //
+ // Use basic addressing mode (open a page on a rank and keep writing/reading to it)
+ // Rotate through all 8 logical ranks
+ // LFSR and LMN disabled.
+ //
+ ChBitMask = Outputs->ValidChBitMask;
+ RankMask = Outputs->ValidRankMask;
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ ChannelOut = &Outputs->Controller[0].Channel[Channel];
+
+ //
+ // Set DQS Delay to 32
+ //
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if (MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ //
+ // Update RxDqsP & RxDqsN - leave other parameter the same; can we update in the next loop or do it per channel
+ //
+ UpdateRxT (MrcData, Channel, Rank, Byte, 5, 32);
+ }
+ }
+ }
+
+ //
+ // Clear any old state in DataTrain Offset
+ //
+ MrcOemMemorySetDword (&ChannelOut->DataOffsetTrain[0], 0, Outputs->SdramCount);
+ }
+ }
+
+ //
+ // Setup REUT Engine
+ //
+ SetupIOTestMPR (MrcData, ChBitMask, LoopCount, NSOE, 0, 0);
+
+ //
+ /// @todo: Start with 0 for now.
+ //
+ MPRCorrectionFactor = 0;
+
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if (!((MRC_BIT0 << Rank) & RankMask)) {
+ continue; // Skip if both channels empty
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Rank = %u\n", Rank);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel\t0 1\nByte\t");
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE, (
+ Outputs->SdramCount == (MAX_SDRAM_IN_DIMM)
+ ) ? "0 1 2 3 4 5 6 7 8 0 1 2 3 4 5 6 7 8" : "0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7"
+ );
+
+ //
+ // Program MR3 and Mask RAS/WE to prevent scheduler for issuing non-Read commands
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ SelectReutRanks (MrcData, Channel, MRC_BIT0 << Rank, 0);
+ if (MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ if (!Lpddr) {
+ Status = MrcWriteMRS (MrcData, Channel, (MRC_BIT0 << Rank), mrMR3, 0x4);
+ }
+
+ Offset = MCHBAR_CH0_CR_REUT_CH_MISC_ODT_CTRL_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_MISC_ODT_CTRL_REG - MCHBAR_CH0_CR_REUT_CH_MISC_ODT_CTRL_REG) * Channel);
+ ReutChMiscOdtCtrl.Data = MrcReadCR (MrcData, Offset);
+ ReutChMiscOdtCtrl.Bits.MPR_Train_DDR_On = 1;
+ MrcWriteCR (MrcData, Offset, ReutChMiscOdtCtrl.Data);
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nDqsDelay");
+ for (DqsDelay = RMPR_DQS_START; DqsDelay < RMPR_DQS_STOP; DqsDelay += RMPR_DQS_STEP) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n% 5d\t", DqsDelay);
+
+ //
+ // Program DQS Delays and download the Reg File for the current rank.
+ //
+ Status = ChangeMargin (MrcData, RdT, DqsDelay, 0, 1, 0, 0, 0, 0, 0, 0, MrcRegFileStart);
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!(MrcRankInChannelExist (MrcData, Rank, Channel))) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ (Channel != 0) ? "" : ((Outputs->SdramCount == MAX_SDRAM_IN_DIMM) ? " " : " ")
+ );
+ } else {
+ ChannelOut = &Outputs->Controller[0].Channel[Channel];
+
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ //
+ // Force on SenseAmp
+ //
+ Offset = DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG +
+ ((DDRDATA0CH1_CR_DDRCRDATACONTROL2_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG) * Channel) +
+ ((DDRDATA1CH0_CR_DDRCRDATACONTROL2_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG) * Byte);
+ DdrCrDataControl2.Data = ChannelOut->DqControl2[Byte].Data;
+ DdrCrDataControl2.Bits.ForceBiasOn = 1;
+ DdrCrDataControl2.Bits.ForceRxOn = 1;
+ DdrCrDataControl2.Bits.LeakerComp = 0;
+ MrcWriteCR (MrcData, Offset, DdrCrDataControl2.Data);
+ }
+ //
+ // Enable RX Training mode. Turn on the ODT.
+ //
+ Offset = DDRDATACH0_CR_DDRCRDATACONTROL0_REG +
+ ((DDRDATACH1_CR_DDRCRDATACONTROL0_REG - DDRDATACH0_CR_DDRCRDATACONTROL0_REG) * Channel);
+ DdrCrDataControl0.Data = ChannelOut->DqControl0.Data;
+ if (!Lpddr) {
+ DdrCrDataControl0.Bits.ForceOdtOn = 1;
+ }
+ DdrCrDataControl0.Bits.RxTrainingMode = 1;
+
+ //
+ // Need to disable EnReadPreamble
+ //
+ DdrCrDataControl0.Bits.EnReadPreamble = 0;
+ MrcWriteCrMulticast (MrcData, Offset, DdrCrDataControl0.Data);
+ }
+ }
+
+ Status = IoReset (MrcData);
+
+
+ //
+ // Start REUT and run for 1uS
+ //
+ ReutGlobalCtl.Data = 0;
+ ReutGlobalCtl.Bits.Global_Start_Test = 1;
+ MrcWriteCR (MrcData, MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_REG, ReutGlobalCtl.Data);
+
+ //
+ // Wait for test to start clearing errors.
+ //
+ MrcWait (MrcData, START_TEST_DELAY);
+
+ //
+ // Clear Results for Prior Test and wait to obtain results
+ //
+ Status = IoReset (MrcData);
+ MrcWait (MrcData, IO_RESET_DELAY);
+
+ //
+ // Stop REUT
+ //
+ ReutGlobalCtl.Data = 0;
+ ReutGlobalCtl.Bits.Global_Stop_Test = 1;
+ MrcWriteCR (MrcData, MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_REG, ReutGlobalCtl.Data);
+
+
+ //
+ // Update results for all ch/bytes
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!(MrcRankInChannelExist (MrcData, Rank, Channel))) {
+ continue;
+ }
+
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ Offset = DDRDATA0CH0_CR_DATATRAINFEEDBACK_REG +
+ ((DDRDATA0CH1_CR_DATATRAINFEEDBACK_REG - DDRDATA0CH0_CR_DATATRAINFEEDBACK_REG) * Channel) +
+ ((DDRDATA1CH0_CR_DATATRAINFEEDBACK_REG - DDRDATA0CH0_CR_DATATRAINFEEDBACK_REG) * Byte);
+ Pass = (MrcReadCR (MrcData, Offset) == 1);
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, Pass ? ". " : "# ");
+
+ if (DqsDelay == RMPR_DQS_START) {
+ if (Pass) {
+ CurrentPassingStart[Channel][Byte] = CurrentPassingEnd[Channel][Byte] = DqsDelay;
+ LargestPassingStart[Channel][Byte] = LargestPassingEnd[Channel][Byte] = DqsDelay;
+ } else {
+ CurrentPassingStart[Channel][Byte] = CurrentPassingEnd[Channel][Byte] = -33;
+ LargestPassingStart[Channel][Byte] = LargestPassingEnd[Channel][Byte] = -33;
+ }
+ } else {
+ if (Pass) {
+ if (CurrentPassingEnd[Channel][Byte] == (DqsDelay - RMPR_DQS_STEP)) {
+ CurrentPassingEnd[Channel][Byte] = DqsDelay;
+ } else {
+ CurrentPassingStart[Channel][Byte] = CurrentPassingEnd[Channel][Byte] = DqsDelay;
+ }
+ //
+ // Update Largest variables
+ //
+ cWidth = CurrentPassingEnd[Channel][Byte] - CurrentPassingStart[Channel][Byte];
+ lWidth = LargestPassingEnd[Channel][Byte] - LargestPassingStart[Channel][Byte];
+ if (cWidth > lWidth) {
+ LargestPassingStart[Channel][Byte] = CurrentPassingStart[Channel][Byte];
+ LargestPassingEnd[Channel][Byte] = CurrentPassingEnd[Channel][Byte];
+ }
+ }
+ }
+ }
+ }
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ continue;
+ }
+ ChannelOut = &Outputs->Controller[0].Channel[Channel];
+
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ //
+ // Restore orginal value
+ //
+ Offset = DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG +
+ ((DDRDATA0CH1_CR_DDRCRDATACONTROL2_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG) * Channel) +
+ ((DDRDATA1CH0_CR_DDRCRDATACONTROL2_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG) * Byte);
+ MrcWriteCR (MrcData, Offset, ChannelOut->DqControl2[Byte].Data);
+ }
+
+ //
+ // Clear RxTrainingMode
+ //
+ Offset = DDRDATACH0_CR_DDRCRDATACONTROL0_REG +
+ ((DDRDATACH1_CR_DDRCRDATACONTROL0_REG - DDRDATACH0_CR_DDRCRDATACONTROL0_REG) * Channel);
+
+#ifdef ULT_FLAG
+ if (Lpddr) {
+ //
+ // For LPDDR need to disable OdtSampExtendEn before disabling RxTrainingMode,
+ // then re-enable OdtSampExtendEn (from the host struct)
+ //
+ DdrCrDataControl0.Bits.OdtSampExtendEn = 0;
+ MrcWriteCrMulticast (MrcData, Offset, DdrCrDataControl0.Data);
+ MrcWait (MrcData, OdtSampExtendDelay);
+
+ DdrCrDataControl0.Bits.RxTrainingMode = 0;
+ MrcWriteCrMulticast (MrcData, Offset, DdrCrDataControl0.Data);
+ MrcWait (MrcData, OdtSampExtendDelay);
+ }
+#endif // ULT_FLAG
+
+ MrcWriteCrMulticast (MrcData, Offset, ChannelOut->DqControl0.Data);
+ } // for Channel
+
+ Status = IoReset (MrcData);
+ } // for DqsDelay
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+
+ //
+ // Clean Up registers.
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ ChannelOut = &Outputs->Controller[0].Channel[Channel];
+
+ //
+ // MPR_TRAIN_DDR_ON bit will force a special command so clear it before MRS command
+ //
+ Offset = MCHBAR_CH0_CR_REUT_CH_MISC_ODT_CTRL_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_MISC_ODT_CTRL_REG - MCHBAR_CH0_CR_REUT_CH_MISC_ODT_CTRL_REG) * Channel);
+ ReutChMiscOdtCtrl.Data = MrcReadCR (MrcData, Offset);
+ ReutChMiscOdtCtrl.Bits.MPR_Train_DDR_On = 0;
+ MrcWriteCR (MrcData, Offset, ReutChMiscOdtCtrl.Data);
+
+ if (!Lpddr) {
+ Status = MrcWriteMRS (MrcData, Channel, (MRC_BIT0 << Rank), mrMR3, 0x0);
+ }
+ //
+ // Clear up after test
+ //
+ MrcOemMemorySetDword (&ChannelOut->DataOffsetTrain[0], 0, Outputs->SdramCount);
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "C%u.R%u: \tLeft\tRight\tWidth\tCenter\tRxDqsPN\n", Channel, Rank);
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ lWidth = LargestPassingEnd[Channel][Byte] - LargestPassingStart[Channel][Byte];
+
+ //
+ // Error Handler if eye not found for all bytes
+ //
+ if (lWidth == 0) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_ERROR,
+ "\nERROR!! NO EYE found for Channel: %u Rank: %u Byte: %u \n",
+ Channel,
+ Rank,
+ Byte
+ );
+ return mrcReadMPRErr;
+ }
+
+ if (lWidth > RMPR_MIN_WIDTH) {
+ Center = LargestPassingStart[Channel][Byte] + lWidth / 2;
+ } else {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_WARNING,
+ "\nWARNING!! lWidth <= %u for Channel: %u Rank: %u Byte: %u \n",
+ RMPR_MIN_WIDTH,
+ Channel,
+ Rank,
+ Byte
+ );
+ Center = 0;
+ }
+ //
+ // Based on previous data, the MPR center is not very good; Adjust it with a magical number
+ //
+ Center += MPRCorrectionFactor;
+ Center2 = 32 + Center;
+ ChannelOut->RxDqsP[Rank][Byte] = (U8) Center2;
+ ChannelOut->RxDqsN[Rank][Byte] = (U8) Center2;
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ " B%u: \t%d\t%d\t%d\t%d\t%d\n",
+ Byte,
+ LargestPassingStart[Channel][Byte],
+ LargestPassingEnd[Channel][Byte],
+ lWidth,
+ Center,
+ ChannelOut->RxDqsP[Rank][Byte]
+ );
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Center = %d, RxDqsPN[%d][%d] = %d\n", Center, Channel, Byte, ChannelOut->RxDqsP[Rank][Byte]);
+ //
+ } // for Byte
+ }
+ } // for Channel
+ } // for Rank
+
+ //
+ // Now program the DQS center values on populated ranks, data is taken from the host struct.
+ // Need to do it after all ranks are trained, because we need to keep the same DQS value on all ranks
+ // during the training.
+ //
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ UpdateRxT (MrcData, Channel, Rank, Byte, 0xFF, 0);
+ }
+ }
+ }
+ }
+
+ //
+ // Clean up after Test. Download the Reg file of the last rank used.
+ //
+ Status = ChangeMargin (MrcData, RdT, 0, 0, 1, 0, 0, 0, 0, 0, 0, MrcRegFileCurrent);
+ Status = IoReset (MrcData);
+ return Status;
+}
+
+/**
+ Peform Read Timing Centering.
+ Center Rx DQS-DQ using moderate pattern with 1D eye
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - if it succeded returns mrcSuccess
+**/
+MrcStatus
+MrcReadTimingCentering (
+ IN MrcParameters *const MrcData
+ )
+{
+ MrcOutput *Outputs;
+ U8 ResetPerBit;
+ U8 LoopCount;
+
+ Outputs = &MrcData->SysOut.Outputs;
+ ResetPerBit = 1;
+
+ LoopCount = 10;
+
+ return DQTimeCentering1D (MrcData, Outputs->ValidChBitMask, RdT, ResetPerBit, LoopCount);
+}
+
+/**
+ Peform Read Timing Centering in 2D.
+ Final read timing centering using 2D algorithm and per bit optimization
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - if it succeded returns mrcSuccess
+**/
+MrcStatus
+MrcReadTimingCentering2D (
+ IN MrcParameters *const MrcData
+ )
+{
+ const MrcInput *Inputs;
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcStatus Status;
+ U8 EnPerBit;
+ U8 EnRxDutyCycle;
+ U8 ResetPerBit;
+ U8 LoopCount;
+ U8 En2D;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ EnPerBit = 1;
+ EnRxDutyCycle = 0;
+ ResetPerBit = 1;
+ LoopCount = 15;
+ En2D = 0;
+
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\n\nCalling with EnRxDutyCycle = %d, EnPerBit = %d, ResetPerBit = %d En2D = %d\n",
+ EnRxDutyCycle,
+ EnPerBit,
+ ResetPerBit,
+ En2D
+ );
+
+ Status = DataTimeCentering2D (
+ MrcData,
+ Outputs->MarginResult,
+ Outputs->ValidChBitMask,
+ RdT,
+ EnPerBit,
+ EnRxDutyCycle,
+ ResetPerBit,
+ LoopCount,
+ En2D
+ );
+ if (mrcSuccess == Status) {
+ EnPerBit = 0;
+ EnRxDutyCycle = 1;
+ ResetPerBit = 0;
+ En2D = 1;
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\n\nCalling with EnRxDutyCycle = %d, EnPerBit = %d, ResetPerBit = %d En2D = %d\n",
+ EnRxDutyCycle,
+ EnPerBit,
+ ResetPerBit,
+ En2D
+ );
+
+ Status = DataTimeCentering2D (
+ MrcData,
+ Outputs->MarginResult,
+ Outputs->ValidChBitMask,
+ RdT,
+ EnPerBit,
+ EnRxDutyCycle,
+ ResetPerBit,
+ LoopCount,
+ En2D
+ );
+ }
+
+ return Status;
+}
+
+/**
+ Peform Read Voltage Centering in 2D.
+ Note: This function currently only supports param = RdV
+
+ @param[in,out] MrcData - Include all MRC global data.
+ @param[in,out] MarginByte - Pointer to Marging Results data structure
+ @param[in] ChBitMask - Channel bit mask.
+ @param[in] Param - {0:RcvEn, 1:RdT, 2:WrT, 3: WrDqsT, 4:RdV, 5:WrV, 6:WrLevel,
+ 8:WrTBit, 9:RdTBit, 10:RdVBit,
+ 16:RdFan2, 17:WrFan2, 32:RdFan3, 32:WrFan3}
+ ONLY RdV is allowed in this function
+ @param[in] EnPerBit - Option to enable per bit margining
+ @param[in] ResetPerBit - Option to Reset PerBit Deskew to middle value before byte training
+ @param[in] LoopCount - Loop count
+ @param[in] En2D - Option to only run center at nominal Vref point
+
+ @retval MrcStatus - If it succeded return mrcSuccess
+**/
+MrcStatus
+ReadVoltageCentering2D (
+ IN OUT MrcParameters *const MrcData,
+ IN OUT U32 MarginByte[MAX_RESULT_TYPE][MAX_RANK_IN_CHANNEL][MAX_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_EDGES],
+ IN U8 ChBitMask,
+ IN U8 Param,
+ IN U8 EnPerBit,
+ IN U8 ResetPerBit,
+ IN U8 LoopCount,
+ IN U8 En2D
+ )
+{
+ const S8 TimePoints[] = { 0, -8, 8 };
+ const U8 EHWeights[sizeof (TimePoints)] = { 1, 1, 1 };
+ const MrcInput *Inputs;
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcChannelOut *ChannelOut;
+ MrcStatus Status;
+ U8 ResultType;
+ U8 Channel;
+ U8 Byte;
+ U8 Rank;
+ U8 bit;
+ U8 lcloop;
+ U8 tim;
+ U8 paramB;
+ U8 paramT;
+ U8 BMap[MAX_SDRAM_IN_DIMM];
+ S8 SumEH;
+ S8 SumEHSign;
+ U8 MaxTscale;
+ U8 SaveLC;
+ U16 mode;
+ S32 center[MAX_CHANNEL][MAX_SDRAM_IN_DIMM];
+ S32 value0[MAX_CHANNEL][MAX_SDRAM_IN_DIMM];
+ U32 BERStats[4];
+ U32 TimScale[MAX_CHANNEL][MAX_SDRAM_IN_DIMM];
+ S32 CenterSumByte[MAX_CHANNEL][MAX_SDRAM_IN_DIMM];
+ S32 CenterSumBit[MAX_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_BITS];
+ U32 marginbit[MAX_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_BITS][MAX_EDGES];
+ U32 EyeShape[3][MAX_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_EDGES];
+ U32 Offset;
+ MCHBAR_CH0_CR_REUT_CH_ERR_CTL_STRUCT ReutChErrCtl;
+ DDRDATA0CH0_CR_RXOFFSETVDQ_STRUCT RxOffsetVdq;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ Status = mrcSuccess;
+ SumEH = 0;
+ MaxTscale = 12;
+ MrcOemMemorySet ((U8 *) BERStats, 0, sizeof (BERStats));
+ for (lcloop = 0; lcloop < (sizeof (BMap) / sizeof (BMap[0])); lcloop++) {
+ BMap[lcloop] = lcloop;
+ }
+ //
+ // Assume rank0 is always popuplated
+ //
+ if (Param == RdV) {
+ paramB = RdVBit;
+ paramT = RdT;
+ } else {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "Error Handler: Unknown Margin Parameter\n");
+ Status = mrcReadVoltage2DError;
+ return Status;
+ }
+ //
+ /// @todo: Need to check if we can enable it for A0 or not
+ // Outputs->EnDumRd = 1;
+ // SOE = 10b ( Stop on All Byte Groups Error )
+ //
+ //
+ /// @todo: Will enable the DQ tests instead of basic in the future
+ // SetupIOTestDQ (MrcData, ChBitMask, LoopCount, ABGSOE, 0, 0);
+ //
+ SetupIOTestBasicVA (MrcData, ChBitMask, LoopCount, ABGSOE, 0, 0, 8);
+ //
+ // Calculate SumEH for use in weighting equations
+ //
+ for (tim = 0; tim < sizeof (TimePoints); tim++) {
+ SumEH += EHWeights[tim];
+
+ //
+ // Loop once at nominal Vref point
+ //
+ if (En2D == 0) {
+ tim = sizeof (TimePoints);
+ }
+ }
+ //
+ // SumEH is used as divisor, make sure is never 0
+ //
+ if (SumEH == 0) {
+ SumEH = 1;
+ }
+ //
+ // Reset PerBit Deskew to middle value before Byte training
+ // Amplifier voltage offset for bit[x] of the DQ Byte.
+ // {0: Most negative offset,... 8: 0 offset, ... 15: Most postive offset}
+ //
+ if (ResetPerBit == 1) {
+ //
+ // EnMultiCast=1, 0,0,0,0, UpdateHost=1, SkipWait=0
+ //
+ Status = ChangeMargin (MrcData, paramB, 0x88888888, 0, 1, 0, 0, 0, 0, 1, 0, MrcRegFileStart);
+ }
+ //
+ // Select rank for REUT test
+ //
+ ChBitMask = 0;
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &Outputs->Controller[0].Channel[Channel];
+ ChBitMask |= SelectReutRanks (MrcData, Channel, ChannelOut->ValidRankBitMask, 0);
+ if (!MrcChannelExist (Outputs, Channel)) {
+ continue;
+ }
+ //
+ // Clear any old state in DataTrain Offset
+ //
+ MrcOemMemorySetDword (&ChannelOut->DataOffsetTrain[0], 0, Outputs->SdramCount);
+ }
+ //
+ // ####################################################
+ // ################ Initialize EW/EH variables ######
+ // ####################################################
+ //
+ Status = GetMarginByte (MrcData, Outputs->MarginResult, paramT, 0, 0xF);
+ ResultType = GetMarginResultType (paramT);
+
+#ifdef MRC_DEBUG_PRINT
+ if (En2D) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n### Measure Eye Height, per BYTE, at ALL (2D) Timing Points\n");
+ } else {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n### Measure Eye Height, per BYTE, at NOMINAL Timing\n");
+ }
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!(ChBitMask & (MRC_BIT0 << Channel))) {
+ continue;
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel %d", Channel);
+ if (Channel == 0) {
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " ");
+ }
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nByte ");
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!(ChBitMask & (MRC_BIT0 << Channel))) {
+ continue;
+ }
+
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d ", Byte);
+ }
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nTScale\t");
+#endif // MRC_DEBUG_PRINT
+ //
+ // Update TimScale to have the appropriate eye width (read from last saved parameters)
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!(ChBitMask & (MRC_BIT0 << Channel))) {
+ continue;
+ }
+
+ ChannelOut = &Outputs->Controller[0].Channel[Channel];
+
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ if (En2D > 0) {
+ TimScale[Channel][Byte] =
+ (
+ MarginByte[ResultType][0][Channel][Byte][0] +
+ MarginByte[ResultType][0][Channel][Byte][1]
+ ) /
+ 20;
+ } else {
+ TimScale[Channel][Byte] = 1;
+ }
+ //
+ // It is possible sumT is 0.
+ //
+ if (!(TimScale[Channel][Byte]) || (TimScale[Channel][Byte] > MaxTscale)) {
+ TimScale[Channel][Byte] = MaxTscale;
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d\t", TimScale[Channel][Byte]);
+ }
+ }
+
+ Status = GetMarginByte (MrcData, Outputs->MarginResult, Param, 0, 0xF);
+ ResultType = GetMarginResultType (Param);
+
+ //
+ // ####################################################
+ // ###### Measure Eye Height at all Timing Points #####
+ // ####################################################
+ //
+ //
+ // Loop through all the Time Points to Test
+ //
+ for (tim = 0; tim < sizeof (TimePoints); tim++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n\nRdTime\t");
+
+ //
+ // Setup Timing Offset for this point
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!(ChBitMask & (MRC_BIT0 << Channel))) {
+ continue;
+ }
+
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ value0[Channel][Byte] = (S32) (TimePoints[tim] * TimScale[Channel][Byte]) / MaxTscale;
+ Status = ChangeMargin (MrcData, paramT, value0[Channel][Byte], 0, 0, Channel, 0, Byte, 0, 1, 0, MrcRegFileCurrent);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d\t", value0[Channel][Byte]);
+ }
+ }
+ //
+ // Run Margin Test
+ //
+ mode = 0;
+ Status = MrcGetBERMarginByte (
+ MrcData,
+ Outputs->MarginResult,
+ ChBitMask,
+ 0,
+ 0xFF,
+ Param,
+ mode,
+ BMap,
+ 1,
+ MAX_POSSIBLE_VREF,
+ 0,
+ BERStats
+ );
+
+#ifdef MRC_DEBUG_PRINT
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nLo-Hi\t");
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!(ChBitMask & (MRC_BIT0 << Channel))) {
+ continue;
+ }
+
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "%d %d\t",
+ MarginByte[ResultType][0][Channel][Byte][0],
+ MarginByte[ResultType][0][Channel][Byte][1]
+ );
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nCenter\t");
+#endif // MRC_DEBUG_PRINT
+ //
+ // Store Results
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (ChBitMask & (MRC_BIT0 << Channel)) {
+
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ center[Channel][Byte] = (S32)(MarginByte[ResultType][0][Channel][Byte][1] -
+ MarginByte[ResultType][0][Channel][Byte][0]);
+ if (tim == 0) {
+ CenterSumByte[Channel][Byte] = 0;
+ }
+ //
+ // Calculate weight for this point
+ //
+ CenterSumByte[Channel][Byte] += EHWeights[tim] * center[Channel][Byte];
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d\t", center[Channel][Byte] / 20);
+
+ //
+ // Record edges for use in per bit margining
+ //
+ EyeShape[tim][Channel][Byte][0] = MarginByte[ResultType][0][Channel][Byte][0];
+ EyeShape[tim][Channel][Byte][1] = MarginByte[ResultType][0][Channel][Byte][1];
+ }
+ }
+ }
+ //
+ // Loop once at nominal Vref point
+ //
+ if (En2D == 0) {
+ tim = sizeof (TimePoints);
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n\nWtdCntr\t");
+ //
+ // ####################################################
+ // ########### Center Results per Byte ############
+ // ####################################################
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!(ChBitMask & (MRC_BIT0 << Channel))) {
+ continue;
+ }
+
+ ChannelOut = &Outputs->Controller[0].Channel[Channel];
+
+ //
+ // Calculate CenterPoint. Round to Nearest Int
+ //
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ SumEHSign = (CenterSumByte[Channel][Byte] < 0) ? (-1) : 1;
+
+ CenterSumByte[Channel][Byte] = (CenterSumByte[Channel][Byte] + 10 * (SumEHSign * SumEH)) / (20 * SumEH);
+ MRC_DEBUG_MSG(Debug, MSG_LEVEL_NOTE,"%d\t", CenterSumByte[Channel][Byte] / 2);
+
+ //
+ // Apply new centerpoint
+ // step size for RxVref is about 7.8mv AND for RxVrefOffset is about 3.9mv
+ //
+ ChannelOut->RxVref[Byte] = (U8) ((S32) ChannelOut->RxVref[Byte] + (CenterSumByte[Channel][Byte] / 2));
+
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if (MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ UpdateRxT (MrcData, Channel, Rank, Byte, 0xFF, 0);
+ }
+ }
+ //
+ // Update the Eye Edges
+ //
+ for (tim = 0; tim < sizeof (TimePoints); tim++) {
+ EyeShape[tim][Channel][Byte][0] = (S32) EyeShape[tim][Channel][Byte][0] + (10 * CenterSumByte[Channel][Byte]);
+ EyeShape[tim][Channel][Byte][1] = (S32) EyeShape[tim][Channel][Byte][1] - (10 * CenterSumByte[Channel][Byte]);
+
+ //
+ // Loop once at nominal Vref point
+ //
+ if (En2D == 0) {
+ tim = sizeof (TimePoints);
+ }
+ }
+ //
+ // Update MrcData for future tests (MarginResult points back to MrcData)
+ // EyeShape for Vref 0 is assumed to have the best shape for future tests.
+ //
+ MarginByte[ResultType][0][Channel][Byte][0] = EyeShape[0][Channel][Byte][0];
+ MarginByte[ResultType][0][Channel][Byte][1] = EyeShape[0][Channel][Byte][1];
+ }
+
+ //
+ // Clear up after test
+ //
+ MrcOemMemorySetDword (&ChannelOut->DataOffsetTrain[0], 0, Outputs->SdramCount);
+
+ //
+ // Propagate new settings from the RegFile to the Pads
+ //
+ MrcDownloadRegFile (MrcData, Channel, 1, 0, MrcRegFileCurrent, 0, 1, 0);
+ }
+
+#ifdef MRC_DEBUG_PRINT
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nRdVref\t");
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!(ChBitMask & (MRC_BIT0 << Channel))) {
+ continue;
+ }
+ ChannelOut = &Outputs->Controller[0].Channel[Channel];
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d\t", (S8) ChannelOut->RxVref[Byte]);
+ }
+ }
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nPerByte Margins after per BYTE Centering\nLo-Hi ");
+ //
+#endif // MRC_DEBUG_PRINT
+ //
+ // ####################################################
+ // ############ Measure Eye Height Per BIT ########
+ // ####################################################
+ //
+ if (EnPerBit) {
+
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE, (
+ En2D
+ ) ? "\n### Measure Eye Height, per BIT, at ALL (2D) Timing Points\n" :
+ "\n### Measure Eye Height, per BIT, at NOMINAL Timing\n"
+ );
+
+ //
+ // Stop on all lane fail
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (ChBitMask & (MRC_BIT0 << Channel))
+ {
+#ifdef MRC_DEBUG_PRINT
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel %d", Channel);
+ if (Channel == 0) {
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\t\t\t\t\t\t");
+ }
+ }
+#endif // MRC_DEBUG_PRINT
+ //
+ // SOE = 11b ( Stop on All Lanes Error )
+ //
+ Offset = MCHBAR_CH0_CR_REUT_CH_ERR_CTL_REG + ((MCHBAR_CH1_CR_REUT_CH_ERR_CTL_REG - MCHBAR_CH0_CR_REUT_CH_ERR_CTL_REG) * Channel);
+ ReutChErrCtl.Data = 0;
+
+ ReutChErrCtl.Bits.Selective_Error_Enable_Chunk = MCHBAR_CH0_CR_REUT_CH_ERR_CTL_Selective_Error_Enable_Chunk_MAX;
+ ReutChErrCtl.Bits.Selective_Error_Enable_Cacheline = MCHBAR_CH0_CR_REUT_CH_ERR_CTL_Selective_Error_Enable_Cacheline_MAX;
+ ReutChErrCtl.Bits.Stop_On_Error_Control = ALSOE;
+ ReutChErrCtl.Bits.Stop_on_Nth_Error = 1;
+ MrcWriteCR (MrcData, Offset, ReutChErrCtl.Data);
+ }
+ }
+
+#ifdef MRC_DEBUG_PRINT
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (ChBitMask & (MRC_BIT0 << Channel)) {
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " Byte % 24d ", Byte);
+ }
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+#endif // MRC_DEBUG_PRINT
+ //
+ // Loop through all the Vref Points to Test
+ //
+ SaveLC = Outputs->DQPatLC;
+ for (tim = 0; tim < sizeof (TimePoints); tim++) {
+ //
+ // Setup Timing Offset for this point
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (ChBitMask & (MRC_BIT0 << Channel)) {
+
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ value0[Channel][Byte] = (S32) (TimePoints[tim] * TimScale[Channel][Byte]) / MaxTscale;
+ Status = ChangeMargin (MrcData, paramT, value0[Channel][Byte], 0, 0, Channel, 0, Byte, 0, 1, 0, MrcRegFileStart);
+
+ //
+ // Amplifier voltage offset for bit[x] of the DQ Byte.
+ // {0: Most negative offset,... 8: 0 offset, ... 15: Most postive offset}
+ //
+ for (bit = 0; bit < MAX_BITS; bit++) {
+ marginbit[Channel][Byte][bit][0] = marginbit[Channel][Byte][bit][1] = 8;
+ }
+ }
+ }
+ }
+ //
+ // Run Margin Test
+ // Loop through 2 times. Once at low loop count and Once at high loopcount
+ // Improves runtime
+ // @todo: Need 2 loops below if not using BASICVA
+ //
+ for (lcloop = 0; lcloop < 1; lcloop++) {
+ Outputs->DQPatLC = (lcloop == 0) ? 1 : SaveLC;
+ mode = 0;
+ Status = MrcGetMarginBit (MrcData, ChBitMask, 0, marginbit, EyeShape[tim], paramB, mode, 15);
+ }
+ //
+ // Store Results
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (ChBitMask & (MRC_BIT0 << Channel)) {
+
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ for (bit = 0; bit < MAX_BITS; bit++) {
+ center[Channel][Byte] = ((marginbit[Channel][Byte][bit][1] - 8) - (8 - marginbit[Channel][Byte][bit][0]));
+ if (tim == 0) {
+ CenterSumBit[Channel][Byte][bit] = 0;
+ }
+ //
+ // Calculate weight for this point
+ //
+ CenterSumBit[Channel][Byte][bit] += EHWeights[tim] * center[Channel][Byte];
+ }
+ }
+ }
+ }
+ //
+ // Loop once at nominal Vref point
+ //
+ if (En2D == 0) {
+ tim = sizeof (TimePoints);
+ }
+ } // END OF TIM LOOP
+ //
+ // ####################################################
+ // ############ Center Result Per BIT ##############
+ // ####################################################
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nWgted Center ");
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!(ChBitMask & (MRC_BIT0 << Channel))) {
+ continue;
+ }
+
+ ChannelOut = &Outputs->Controller[0].Channel[Channel];
+
+ //
+ // Calculate and apply CenterPoint. Round to Nearest Int
+ //
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ RxOffsetVdq.Data = 0;
+
+ for (bit = 0; bit < MAX_BITS; bit++) {
+ SumEHSign = (CenterSumBit[Channel][Byte][bit] < 0) ? (-1) : 1;
+
+ CenterSumBit[Channel][Byte][bit] = (CenterSumBit[Channel][Byte][bit] + (SumEHSign * SumEH)) / (2 * SumEH);
+
+ //
+ // Centerpoint needs to be added to starting DqPb value
+ //
+ CenterSumBit[Channel][Byte][bit] += (S32) ChannelOut->RxDqVrefPb[0][Byte][bit].Center;
+
+ //
+ // Check for saturation
+ //
+ if (CenterSumBit[Channel][Byte][bit] > 15) {
+ CenterSumBit[Channel][Byte][bit] = 15;
+ } else if (CenterSumBit[Channel][Byte][bit] < 0) {
+ CenterSumBit[Channel][Byte][bit] = 0;
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%x ", CenterSumBit[Channel][Byte][bit]);
+
+ //
+ // Update MrcData
+ //
+ ChannelOut->RxDqVrefPb[0][Byte][bit].Center = (U8) CenterSumBit[Channel][Byte][bit];
+
+ RxOffsetVdq.Data |= (CenterSumBit[Channel][Byte][bit] << (DDRDATA0CH0_CR_RXOFFSETVDQ_Lane0_WID * bit));
+ }
+ //
+ // Apply and propagate new centerpoint
+ //
+ Status = ChangeMargin (MrcData, RdVBit, RxOffsetVdq.Data, 0, 0, Channel, 0, Byte, 0, 0, 0, MrcRegFileCurrent);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " ");
+ }
+ //
+ // Clear up after test
+ //
+ MrcOemMemorySetDword (&ChannelOut->DataOffsetTrain[0], 0, Outputs->SdramCount);
+ }
+ } // END PERBIT LOOP
+
+/// @attention - This is used to determine if the PerBit routines are correct. Left for sanity.
+/*
+#ifdef MRC_DEBUG_PRINT
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (ChBitMask & (MRC_BIT0 << Channel)) {
+
+ ChannelOut = &Outputs->Channel[Channel];
+
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ Offset = DDRDATA0CH0_CR_RXOFFSETVDQ_REG +
+ ((DDRDATA0CH1_CR_RXOFFSETVDQ_REG - DDRDATA0CH0_CR_RXOFFSETVDQ_REG) * Channel) +
+ ((DDRDATA1CH0_CR_RXOFFSETVDQ_REG - DDRDATA0CH0_CR_RXOFFSETVDQ_REG) * Byte);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nRdVref = % 3d RdVBit = 0x%08X", (S8) ChannelOut->RxVref[Byte],
+ MrcReadCR (MrcData, Offset));
+ }
+ }
+ }
+#endif // MRC_DEBUG_PRINT
+*/
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+ //
+ // Clean up after test
+ //
+ Outputs->EnDumRd = 0;
+ Status = ChangeMargin (MrcData, paramT, 0, 0, 1, 0, 0, 0, 0, 1, 0, MrcRegFileCurrent);
+
+ return Status;
+}
+
+/**
+ Peform Read Voltage Centering in 2D.
+ Note: This function currently only supports param = RdV
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - if it succeded return mrcSuccess
+**/
+MrcStatus
+MrcReadVoltageCentering2D (
+ IN MrcParameters *const MrcData
+ )
+{
+ MrcOutput *Outputs;
+ MrcStatus Status;
+ U8 EnPerBit;
+ U8 ResetPerBit;
+ U8 LoopCount;
+ U8 En2D;
+
+ Outputs = &MrcData->SysOut.Outputs;
+
+ EnPerBit = 1;
+ ResetPerBit = 1;
+ LoopCount = 15;
+ En2D = 0;
+ Status = ReadVoltageCentering2D (
+ MrcData,
+ Outputs->MarginResult,
+ Outputs->ValidChBitMask,
+ RdV,
+ EnPerBit,
+ ResetPerBit,
+ LoopCount,
+ En2D
+ );
+
+ if (mrcSuccess == Status) {
+ //
+ // EnPerBit = 0; ResetPerbit = 0; loopcount = 10; En2D=1
+ //
+ EnPerBit = 0;
+ ResetPerBit = 0;
+ LoopCount = 15;
+ En2D = 1;
+ Status = ReadVoltageCentering2D (
+ MrcData,
+ Outputs->MarginResult,
+ Outputs->ValidChBitMask,
+ RdV,
+ EnPerBit,
+ ResetPerBit,
+ LoopCount,
+ En2D
+ );
+ }
+
+ return Status;
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/ReadTraining/MrcReadDqDqs.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/ReadTraining/MrcReadDqDqs.h
new file mode 100644
index 0000000..e0c717a
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/ReadTraining/MrcReadDqDqs.h
@@ -0,0 +1,97 @@
+/** @file
+ Read DQ/DQS training definitions.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+**/
+
+#ifndef _MrcReadDqDqs_h_
+#define _MrcReadDqDqs_h_
+
+#include "McAddress.h"
+#include "MrcTypes.h"
+#include "MrcCommon.h"
+#include "MrcGlobal.h"
+
+#define RMPR_DQS_START (-32)
+#define RMPR_DQS_STOP (32)
+
+#define RMPR_DQS_STEP (1)
+
+#define RMPR_MIN_WIDTH (12)
+
+/**
+@brief
+ Perform Read MPR Training.
+ Center read DQ-DQS with MPR pattern.
+
+ @param[in, out] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - mrcSuccess or reason for failure.
+**/
+extern
+MrcStatus
+MrcReadMprTraining (
+ IN OUT MrcParameters *const MrcData
+ );
+
+/**
+@brief
+ Peform Read Timing Centering.
+ Center Rx DQS-DQ using moderate pattern with 1D eye
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - if it succeded returns mrcSuccess
+**/
+extern
+MrcStatus
+MrcReadTimingCentering (
+ IN MrcParameters *const MrcData
+ );
+
+/**
+@brief
+ Peform Read Timing Centering in 2D.
+ Final read timing centering using 2D algorithm and per bit optimization
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - if it succeded returns mrcSuccess
+**/
+extern
+MrcStatus
+MrcReadTimingCentering2D (
+ IN MrcParameters *const MrcData
+ );
+
+/**
+@brief
+ Peform Read Voltage Centering in 2D.
+ Note: This function currently only supports param = RdV
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - if it succeded return mrcSuccess
+**/
+extern
+MrcStatus
+MrcReadVoltageCentering2D (
+ IN MrcParameters *const MrcData
+ );
+
+#endif // _MrcReadDqDqs_h_
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/ReadTraining/MrcReadReceiveEnable.c b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/ReadTraining/MrcReadReceiveEnable.c
new file mode 100644
index 0000000..3a49188
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/ReadTraining/MrcReadReceiveEnable.c
@@ -0,0 +1,1155 @@
+/** @file
+ Implementation of the receive enable algorithm.
+ Receive enable training is made out of two stages, the first is finding the
+ DQS rising edge for each DRAM device, and the second is determining the
+ roundtrip latency by locating the preamble cycle.
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+
+**/
+#include "MrcReadReceiveEnable.h"
+
+///
+/// Local defines
+///
+
+#define RCV_EN_CENTER_LC (17)
+
+/**
+@brief
+ Perform receive enable training.
+ Optimize RcvEn timing with MPR pattern
+
+ @param[in, out] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - if succeeded, return mrcSuccess
+**/
+MrcStatus
+MrcReadLevelingTraining (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ const MRC_REUTAddress REUTAddress = {{0, 0, 0, 0}, // Start
+ {0, 0, 0, 1023}, // Stop
+ {0, 0, 0, 0}, // Order
+ {0, 0, 0, 0}, // IncRate
+ {0, 0, 0, 1}}; // IncValue
+ const U8 RLStep0 = 8;
+ const MrcInput *Inputs;
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ MrcStatus Status;
+ MrcProfile Profile;
+ U8 NumSamples;
+ U8 FineStep;
+ U8 DumArr[7];
+ U8 Channel;
+ U8 Rank;
+ U8 Byte;
+ U8 ByteN; // ByteNumber
+ U8 ByteNTimes2;
+ U8 ChBitMask;
+ U8 RankMask; // RankBitMask for both channels
+ U8 Done;
+ U8 Inc;
+ U16 RLStart;
+ U16 RLStop;
+ U16 RLDelay;
+ U16 ChResult[MAX_CHANNEL];
+ U16 ChMask;
+ U32 CRValue;
+ U32 Offset;
+ U32 RtIoComp;
+ U32 RtLatency;
+ S32 InitialPassingStart[MAX_CHANNEL][MAX_SDRAM_IN_DIMM];
+ S32 InitialPassingEnd[MAX_CHANNEL][MAX_SDRAM_IN_DIMM];
+ S32 CurrentPassingStart[MAX_CHANNEL][MAX_SDRAM_IN_DIMM];
+ S32 CurrentPassingEnd[MAX_CHANNEL][MAX_SDRAM_IN_DIMM];
+ S32 LargestPassingStart[MAX_CHANNEL][MAX_SDRAM_IN_DIMM];
+ S32 LargestPassingEnd[MAX_CHANNEL][MAX_SDRAM_IN_DIMM];
+ S32 IncPreAmble[MAX_CHANNEL][MAX_SDRAM_IN_DIMM];
+ S32 iWidth;
+ S32 cWidth;
+ S32 lWidth;
+ S32 Center;
+ S32 Width;
+ BOOL Pass;
+ MRC_WDBPattern WDBPattern;
+ U8 Temp;
+ U16 TDqsCkDrift;
+#ifdef ULT_FLAG
+ U32 DclkPs;
+#endif // ULT_FLAG
+
+ DDRDATACH0_CR_DDRCRDATACONTROL0_STRUCT DdrCrDataControl0;
+ DDRDATA0CH0_CR_DDRCRDATACONTROL2_STRUCT DdrCrDataControl2;
+ MCHBAR_CH0_CR_SC_IO_LATENCY_STRUCT ScIoLatency;
+ DDRDATA0CH0_CR_DATATRAINFEEDBACK_STRUCT DataTrainFeedback;
+
+ WDBPattern.IncRate = 32;
+ WDBPattern.Start = 0;
+ WDBPattern.Stop = 9;
+ WDBPattern.DQPat = BasicVA;
+ Status = mrcSuccess;
+ Done = 0;
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerOut = &Outputs->Controller[0];
+ ChBitMask = Outputs->ValidChBitMask;
+ RankMask = Outputs->ValidRankMask;
+ Profile = Inputs->MemoryProfile;
+ TDqsCkDrift = tDQSCK_DRIFT; // Pull in RcvEna by 1 QClk for Traditional.
+
+#ifdef ULT_FLAG
+#endif
+
+ MrcOemMemorySet (DumArr, 1, sizeof (DumArr));
+
+ NumSamples = 6;
+ FineStep = 1;
+
+ RtIoComp = 0;
+ RtLatency = 0;
+
+ switch (Inputs->CpuModel) {
+ case cmCRW:
+ RtIoComp = MRC_ROUND_TRIP_IO_COMPENSATION_2_CHANNEL_A0;
+ RtLatency = HW_ROUNDT_LAT_DEFAULT_VALUE_A0;
+ break;
+
+ case cmHSW_ULT:
+ RtIoComp = MRC_ROUND_TRIP_IO_COMPENSATION_2_CHANNEL_ULT_A0;
+ RtLatency = HW_ROUNDT_LAT_DEFAULT_VALUE_ULT_A0;
+ break;
+
+ case cmHSW:
+ default:
+ RtIoComp = (Inputs->CpuStepping > csHswA0) ? MRC_ROUND_TRIP_IO_COMPENSATION_2_CHANNEL_B0 :
+ MRC_ROUND_TRIP_IO_COMPENSATION_2_CHANNEL_A0;
+ RtLatency = (Inputs->CpuStepping > csHswA0) ? HW_ROUNDT_LAT_DEFAULT_VALUE_B0 :
+ HW_ROUNDT_LAT_DEFAULT_VALUE_A0;
+ break;
+ }
+
+ //
+ // CmdPat=PatRd, NumCL=2, LC=7, REUTAddress, SOE=0,
+ // WDBPattern, EnCADB=0, EnCKE=0, SubSeqWait=8
+ //
+ SetupIOTest (MrcData, ChBitMask, PatRd, 2, NumSamples + 1, &REUTAddress, 0, &WDBPattern, 0, 0, 8);
+
+ //
+ // Prepare Channel and Rank bit mask & Enable RLMode, force Odt and SAmp.
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!(MrcChannelExist (Outputs, Channel))) {
+ continue;
+ }
+ ChannelOut = &ControllerOut->Channel[Channel];
+
+ //
+ // Enable ReadLeveling Mode and Force On ODT and SenseAmp
+ //
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ Offset = DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG +
+ ((DDRDATA0CH1_CR_DDRCRDATACONTROL2_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG) * Channel) +
+ ((DDRDATA1CH0_CR_DDRCRDATACONTROL2_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG) * Byte);
+ DdrCrDataControl2.Data = ChannelOut->DqControl2[Byte].Data;
+ DdrCrDataControl2.Bits.ForceRxOn = 1;
+ MrcWriteCR (MrcData, Offset, DdrCrDataControl2.Data);
+ }
+ Offset = DDRDATACH0_CR_DDRCRDATACONTROL0_REG +
+ ((DDRDATACH1_CR_DDRCRDATACONTROL0_REG - DDRDATACH0_CR_DDRCRDATACONTROL0_REG) * Channel);
+ DdrCrDataControl0.Data = ChannelOut->DqControl0.Data;
+
+#ifdef ULT_FLAG
+ if (Outputs->DdrType == MRC_DDR_TYPE_LPDDR3) {
+ //
+ // W/A for b4618574 - @todo: remove for HSW ULT C0
+ // Can't have ForceOdtOn together with Leaker, disable LPDDR mode during this training step
+ // LPDDR_Mode is restored at the end of this function from the host structure.
+ //
+ DdrCrDataControl0.Bits.LPDDR_Mode = 0;
+ MrcWriteCrMulticast (MrcData, Offset, DdrCrDataControl0.Data);
+ }
+#endif // ULT_FLAG
+
+ DdrCrDataControl0.Bits.ForceOdtOn = 1;
+ DdrCrDataControl0.Bits.RLTrainingMode = 1;
+ MrcWriteCrMulticast (MrcData, Offset, DdrCrDataControl0.Data);
+
+ //
+ // Set initial IO Latency and IO_COMP
+ //
+ Offset = MCHBAR_CH0_CR_SC_IO_LATENCY_REG +
+ ((MCHBAR_CH1_CR_SC_IO_LATENCY_REG - MCHBAR_CH0_CR_SC_IO_LATENCY_REG) * Channel);
+ ScIoLatency.Data = 0;
+ ScIoLatency.Bits.RT_IOCOMP = RtIoComp;
+ MrcWriteCR (MrcData, Offset, ScIoLatency.Data);
+ }
+
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if (!((MRC_BIT0 << Rank) & RankMask)) {
+ //
+ // Skip if both channels empty
+ //
+ continue;
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nRank %d\n", Rank);
+
+ ChBitMask = 0;
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChBitMask |= SelectReutRanks (MrcData, Channel, MRC_BIT0 << Rank, 0);
+ if (!(MrcRankInChannelExist (MrcData, Rank, Channel))) {
+ continue;
+ }
+
+ ChannelOut = &ControllerOut->Channel[Channel];
+
+ ChannelOut->IoLatency[Rank] = 0;
+ //
+ // Set initial Roundtrip Latency values -4 QCLK assumed for worst board layout
+ //
+ // Default ROUNDT_LAT = HW_ROUNDT_LAT_DEFAULT_VALUE + nMode value * 2 + (2 * tCL) + 4QCLK + PI_CLK
+ // LPDDR3 formula: HW_ROUNDT_LAT_DEFAULT_VALUE + (2 * tCL) + 4QCLK + PI_CLK + tDQSCK_max
+ // NMode = 3 during training mode
+ //
+ Temp = (Outputs->Ratio >= 2) ? Outputs->Ratio : 0;
+
+#ifdef ULT_FLAG
+ if (Outputs->DdrType == MRC_DDR_TYPE_LPDDR3) {
+ DclkPs = Outputs->Qclkps * 2;
+ CRValue = RtLatency + (2 * ChannelOut->Timing[Profile].tCL) + MAX (Temp, 4) + 1 + (tDQSCK_MAX + DclkPs - 1) / DclkPs;
+ } else
+#endif // ULT_FLAG
+ {
+ CRValue = RtLatency + (2 * 2) + (2 * ChannelOut->Timing[Profile].tCL) + MAX (Temp, 4) + 1;
+ }
+ CRValue = MIN (MCHBAR_CH0_CR_SC_ROUNDT_LAT_Lat_R0D0_MAX, CRValue);
+ Offset = MCHBAR_CH0_CR_SC_ROUNDT_LAT_REG +
+ ((MCHBAR_CH1_CR_SC_ROUNDT_LAT_REG - MCHBAR_CH0_CR_SC_ROUNDT_LAT_REG) * Channel) + Rank;
+ MrcWriteCR8 (MrcData, Offset, (U8) CRValue);
+ ChannelOut->RTLatency[Rank] = (U8) CRValue;
+ }
+ //
+ // ******************************************
+ // STEP 1 and 2: Find middle of high region
+ // ******************************************
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Step 1 and 2 Find Middle of high region\n");
+ RLStart = 256 + 24;
+ RLStop = 384 + 24;
+
+ for (RLDelay = RLStart; RLDelay < RLStop; RLDelay += RLStep0) {
+ //
+ // Program RL Delays:
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!(MrcRankInChannelExist (MrcData, Rank, Channel))) {
+ continue;
+ }
+
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ UpdateRxT (MrcData, Channel, Rank, Byte, 0, RLDelay);
+ }
+ }
+ //
+ // Run Test, Reset FIFOs will be done before running test
+ //
+ RunIOTest (MrcData, ChBitMask, BasicVA, DumArr, 1, 0);
+
+ //
+ // Update results for all Channels/Bytes
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!(MrcRankInChannelExist (MrcData, Rank, Channel))) {
+ continue;
+ }
+
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ Offset = DDRDATA0CH0_CR_DATATRAINFEEDBACK_REG +
+ ((DDRDATA0CH1_CR_DATATRAINFEEDBACK_REG - DDRDATA0CH0_CR_DATATRAINFEEDBACK_REG) * Channel) +
+ ((DDRDATA1CH0_CR_DATATRAINFEEDBACK_REG - DDRDATA0CH0_CR_DATATRAINFEEDBACK_REG) * Byte);
+ Pass = (MrcReadCR (MrcData, Offset) >= (U8) (MRC_BIT0 << (NumSamples - 1)));
+ if (RLDelay == RLStart) {
+ if (Pass) {
+ InitialPassingStart[Channel][Byte] = InitialPassingEnd[Channel][Byte] = RLStart;
+ CurrentPassingStart[Channel][Byte] = CurrentPassingEnd[Channel][Byte] = RLStart;
+ LargestPassingStart[Channel][Byte] = LargestPassingEnd[Channel][Byte] = RLStart;
+ } else {
+ InitialPassingStart[Channel][Byte] = InitialPassingEnd[Channel][Byte] = -RLStep0;
+ CurrentPassingStart[Channel][Byte] = CurrentPassingEnd[Channel][Byte] = -RLStep0;
+ LargestPassingStart[Channel][Byte] = LargestPassingEnd[Channel][Byte] = -RLStep0;
+ }
+ } else {
+ if (Pass) {
+ if (InitialPassingEnd[Channel][Byte] == (RLDelay - RLStep0)) {
+ InitialPassingEnd[Channel][Byte] = RLDelay;
+ }
+
+ if (CurrentPassingEnd[Channel][Byte] == (RLDelay - RLStep0)) {
+ CurrentPassingEnd[Channel][Byte] = RLDelay;
+ } else {
+ CurrentPassingStart[Channel][Byte] = CurrentPassingEnd[Channel][Byte] = RLDelay;
+ }
+ //
+ // Special case for last step: Append Initial Passing Region
+ // RLDelay should be considered a continuous range that wraps around 0
+ //
+ if ((RLDelay >= (RLStop - RLStep0)) &&
+ (InitialPassingStart[Channel][Byte] == RLStart) &&
+ (InitialPassingEnd[Channel][Byte] != RLDelay)
+ ) {
+
+ iWidth = (CurrentPassingEnd[Channel][Byte] - CurrentPassingStart[Channel][Byte]);
+ InitialPassingStart[Channel][Byte] -= (RLStep0 + iWidth);
+
+ LargestPassingStart[Channel][Byte] = InitialPassingStart[Channel][Byte];
+ LargestPassingEnd[Channel][Byte] = InitialPassingEnd[Channel][Byte];
+ continue;
+ }
+ //
+ // Update Largest variables
+ //
+ cWidth = CurrentPassingEnd[Channel][Byte] - CurrentPassingStart[Channel][Byte];
+ lWidth = LargestPassingEnd[Channel][Byte] - LargestPassingStart[Channel][Byte];
+ if (cWidth > lWidth) {
+ LargestPassingStart[Channel][Byte] = CurrentPassingStart[Channel][Byte];
+ LargestPassingEnd[Channel][Byte] = CurrentPassingEnd[Channel][Byte];
+ }
+ }
+ }
+ }
+ }
+ }
+ //
+ // Update RcvEn timing to be in the center of the high region.
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!(MrcRankInChannelExist (MrcData, Rank, Channel))) {
+ continue;
+ }
+
+ ChannelOut = &ControllerOut->Channel[Channel];
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "C%d.R%d: Left\tRight\tWidth\tCenter\n", Channel, Rank);
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ Center = (LargestPassingEnd[Channel][Byte] + LargestPassingStart[Channel][Byte]) / 2;
+ Width = LargestPassingEnd[Channel][Byte] - LargestPassingStart[Channel][Byte];
+
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ " B%d: %d %d %d %d\n",
+ Byte,
+ LargestPassingStart[Channel][Byte],
+ LargestPassingEnd[Channel][Byte],
+ Width,
+ Center
+ );
+
+ //
+ // Check if center of High was found
+ //
+ if (Center > RLStop) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_ERROR,
+ "\nERROR! Center of High Higher than expected for Channel: %u Byte: %u\n",
+ Channel,
+ Byte
+ );
+ return mrcReadLevelingError;
+ }
+ //
+ // Check if width is valid
+ //
+ if ((Width <= 32) || (Width >= 96)) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_ERROR,
+ "\nERROR! Width region (%d) outside expected limits for Channel: %u Byte: %u\n",
+ Width,
+ Channel,
+ Byte
+ );
+ return mrcReadLevelingError;
+ }
+
+ ChannelOut->RcvEn[Rank][Byte] = (U16) Center;
+ UpdateRxT (MrcData, Channel, Rank, Byte, 0xFF, 0);
+ }
+ }
+ //
+ // ******************************************************************************
+ // STEP 3: Walk Backwards
+ // ******************************************************************************
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nStep 3: Quarter Preamble - Walk Backwards\n");
+
+ if (Outputs->ValidRankMask & (MRC_BIT0 << Rank)) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel 0 1\nByte ");
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE, (
+ Outputs->SdramCount == MAX_SDRAM_IN_DIMM
+ ) ? "0 1 2 3 4 5 6 7 8 0 1 2 3 4 5 6 7 8" : "0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7"
+ );
+ }
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChResult[Channel] = 0x1FF;
+ }
+
+ //
+ // 0x1FF or 0xFF
+ //
+ ChMask = (MRC_BIT0 << Outputs->SdramCount) - 1;
+ while ((ChResult[0] != 0) || (ChResult[1] != 0)) {
+ //
+ // Run Test
+ //
+ RunIOTest (MrcData, ChBitMask, BasicVA, DumArr, 1, 0);
+
+ //
+ // Update results for all Channel/Bytes
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nIOLAT =");
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChResult[Channel] = 0;
+
+ if (!(MrcRankInChannelExist (MrcData, Rank, Channel))) {
+ if (Channel == 0) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ (Outputs->SdramCount == MAX_SDRAM_IN_DIMM) ? " " : " "
+ );
+ }
+
+ continue;
+ }
+
+ ChannelOut = &ControllerOut->Channel[Channel];
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %u ", ChannelOut->IoLatency[Rank]);
+
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ Offset = DDRDATA0CH0_CR_DATATRAINFEEDBACK_REG +
+ ((DDRDATA0CH1_CR_DATATRAINFEEDBACK_REG - DDRDATA0CH0_CR_DATATRAINFEEDBACK_REG) * Channel) +
+ ((DDRDATA1CH0_CR_DATATRAINFEEDBACK_REG - DDRDATA0CH0_CR_DATATRAINFEEDBACK_REG) * Byte);
+ DataTrainFeedback.Data = MrcReadCR (MrcData, Offset);
+ Pass = (DataTrainFeedback.Bits.DataTrainFeedback >= (U16) (MRC_BIT0 << (NumSamples - 1)));
+ if (Pass) {
+ ChResult[Channel] |= (MRC_BIT0 << Byte);
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, Pass ? "H " : "L ");
+ }
+ //
+ // Adjust Timing
+ //
+ if ((ChResult[Channel] == ChMask) && (ChannelOut->IoLatency[Rank] < 14)) {
+ //
+ // Adjust Timing globally for all Bytes - Number in Qclks
+ //
+ ChannelOut->IoLatency[Rank] = ((ChannelOut->IoLatency[Rank] + 2) & MCHBAR_CH0_CR_SC_IO_LATENCY_IOLAT_R0D0_MSK);
+
+ //
+ // @todo: Add an error check if we reach IOLAT > 10
+ // Update Value
+ //
+ ByteN = RANK_TO_DIMM_NUMBER (Rank);
+ ByteNTimes2 = ByteN * 2;
+ CRValue = (ChannelOut->IoLatency[ByteNTimes2]);
+ CRValue += (ChannelOut->IoLatency[ByteNTimes2 + 1] << MCHBAR_CH0_CR_SC_IO_LATENCY_IOLAT_R0D0_WID);
+ Offset = MCHBAR_CH0_CR_SC_IO_LATENCY_REG +
+ ((MCHBAR_CH1_CR_SC_IO_LATENCY_REG - MCHBAR_CH0_CR_SC_IO_LATENCY_REG) * Channel) + (ByteN);
+ MrcWriteCR8 (MrcData, Offset, (U8) CRValue);
+ } else {
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ if (ChResult[Channel] & (MRC_BIT0 << Byte)) {
+ if (ChannelOut->RcvEn[Rank][Byte] > 127) {
+ ChannelOut->RcvEn[Rank][Byte] -= 128;
+ } else {
+ //
+ // Error Handler
+ //
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_ERROR,
+ "\nERROR! Channel: %u Rank: %uByte: %u - RcvEn %u/IoLat %u while walking backwards\n",
+ Channel,
+ Rank,
+ Byte,
+ ChannelOut->RcvEn[Rank][Byte],
+ ChannelOut->IoLatency[Rank]
+ );
+ return mrcReadLevelingError;
+ }
+
+ UpdateRxT (MrcData, Channel, Rank, Byte, 0xFF, 0);
+ }
+ }
+ }
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!(MrcRankInChannelExist (MrcData, Rank, Channel))) {
+ continue;
+ }
+ ChannelOut = &ControllerOut->Channel[Channel];
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "C%u: Preamble\n", Channel);
+
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " B%u: %u\n", Byte, ChannelOut->RcvEn[Rank][Byte]);
+ }
+ }
+ //
+ // ******************************************
+ // STEP 4: Add 1 qclk
+ // ******************************************
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!(MrcRankInChannelExist (MrcData, Rank, Channel))) {
+ continue;
+ }
+
+ ChannelOut = &Outputs->Controller[0].Channel[Channel];
+
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ ChannelOut->RcvEn[Rank][Byte] += 64;
+ UpdateRxT (MrcData, Channel, Rank, Byte, 0xFF, 0);
+ }
+ }
+ //
+ // ******************************************
+ // STEP 5: Walk forward
+ // ******************************************
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Step 5 Walk forward\n");
+ //
+ // Find Rising Edge
+ //
+ ChResult[0] = 0;
+ ChResult[1] = 0;
+
+ for (Inc = 0; Inc < 64; Inc += FineStep) {
+ //
+ // Run Test
+ //
+ RunIOTest (MrcData, ChBitMask, BasicVA, DumArr, 1, 0);
+
+ //
+ // Update results for all Channel/bytes
+ //
+ Done = 1;
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!(MrcRankInChannelExist (MrcData, Rank, Channel))) {
+ continue;
+ }
+ ChannelOut = &ControllerOut->Channel[Channel];
+
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ //
+ // Skip Bytes that are already done
+ //
+ if (ChResult[Channel] & (MRC_BIT0 << Byte)) {
+ continue;
+ }
+ //
+ // Check if this byte is done
+ //
+ Offset = DDRDATA0CH0_CR_DATATRAINFEEDBACK_REG +
+ ((DDRDATA0CH1_CR_DATATRAINFEEDBACK_REG - DDRDATA0CH0_CR_DATATRAINFEEDBACK_REG) * Channel) +
+ ((DDRDATA1CH0_CR_DATATRAINFEEDBACK_REG - DDRDATA0CH0_CR_DATATRAINFEEDBACK_REG) * Byte);
+ Pass = (MrcReadCR (MrcData, Offset) >= (U8) (MRC_BIT0 << (NumSamples - 1)));
+ if (Pass) {
+ ChResult[Channel] |= (MRC_BIT0 << Byte);
+ } else {
+ ChannelOut->RcvEn[Rank][Byte] += FineStep;
+ UpdateRxT (MrcData, Channel, Rank, Byte, 0xFF, 0);
+ IncPreAmble[Channel][Byte] = Inc;
+ }
+ }
+
+ if (ChResult[Channel] != ChMask) {
+ Done = 0;
+ }
+ }
+ //
+ // Skip additional testing if all Channel/bytes done
+ //
+ if (Done) {
+ break;
+ }
+ }
+ //
+ // Check if Edge was found for all Bytes in the channels
+ //
+ if (!Done) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_ERROR,
+ "Error! Pre-amble edge not found for all Bytes with following final RcvEn results\n"
+ );
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!(MrcRankInChannelExist (MrcData, Rank, Channel))) {
+ continue;
+ }
+
+ ChannelOut = &ControllerOut->Channel[Channel];
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel %u Rank %u: Preamble\n", Channel, Rank);
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ " Byte %u: %u %s\n",
+ Byte,
+ ChannelOut->RcvEn[Rank][Byte],
+ ((ChResult[Channel] ^ ChMask) & (1 << Byte)) ? "" : "*** ERROR! Check This Byte ***"
+ );
+ }
+ }
+
+ return mrcReadLevelingError;
+ }
+ //
+ // ******************************************
+ // STEP 6: Sub 1 qclk and Clean Up Rank
+ // ******************************************
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Step 6: Mid Preamble\n");
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!(MrcRankInChannelExist (MrcData, Rank, Channel))) {
+ continue;
+ }
+ ChannelOut = &ControllerOut->Channel[Channel];
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "C%u: Preamble Increment\n", Channel);
+
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ //
+ // For Traditional, pull in RcvEn by 64
+ // For ULT, Take the DQS drift into account to the specified guardband: tDQSCK_DRIFT.
+ //
+ ChannelOut->RcvEn[Rank][Byte] -= TDqsCkDrift;
+
+ UpdateRxT (MrcData, Channel, Rank, Byte, 0xFF, 0);
+
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ " B%u: %u %u\n",
+ Byte,
+ ChannelOut->RcvEn[Rank][Byte],
+ IncPreAmble[Channel][Byte]
+ );
+ }
+ }
+ } // END OF RANK LOOP
+ //
+ // Clean up after Test
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!(MrcChannelExist (Outputs, Channel))) {
+ continue;
+ }
+ ChannelOut = &ControllerOut->Channel[Channel];
+
+ Offset = DDRDATACH0_CR_DDRCRDATACONTROL0_REG +
+ ((DDRDATACH1_CR_DDRCRDATACONTROL0_REG - DDRDATACH0_CR_DDRCRDATACONTROL0_REG) * Channel);
+ DdrCrDataControl0.Data = ChannelOut->DqControl0.Data;
+#ifdef ULT_FLAG
+ if (Outputs->DdrType == MRC_DDR_TYPE_LPDDR3) {
+ //
+ // W/A for b4618574 - @todo: remove for HSW ULT C0
+ // Can't have ForceOdtOn together with Leaker, disable LPDDR mode during this training step
+ // This write will disable ForceOdtOn while still keeping LPDDR_Mode disabled.
+ // Second write will restore LPDDR_Mode.
+ //
+ DdrCrDataControl0.Bits.LPDDR_Mode = 0;
+ MrcWriteCrMulticast (MrcData, Offset, DdrCrDataControl0.Data);
+ }
+#endif // ULT_FLAG
+ MrcWriteCrMulticast (MrcData, Offset, ChannelOut->DqControl0.Data);
+
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ Offset = DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG +
+ ((DDRDATA0CH1_CR_DDRCRDATACONTROL2_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG) * Channel) +
+ ((DDRDATA1CH0_CR_DDRCRDATACONTROL2_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG) * Byte);
+ MrcWriteCR (MrcData, Offset, ChannelOut->DqControl2[Byte].Data);
+ }
+ }
+
+ Status = IoReset (MrcData);
+
+ //
+ // Step 7: Try to get IO Lat the same across all ranks per channel
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Step 7: Sync IO Lat Across Ranks\n");
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ Status = MrcChangeRcvEnTiming (
+ MrcData,
+ Channel,
+ RRE_ALL_RANKS_MASK,
+ 0, // ByteMask
+ 0, // Offset
+ RRE_PI_TO_RESERVE
+ );
+ }
+ }
+
+ //
+ // Print IO Latency/RcvEn
+ //
+#ifdef MRC_DEBUG_PRINT
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " Adjusted Receive Enable and IO Lat Values\n");
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ Offset = MCHBAR_CH0_CR_SC_IO_LATENCY_REG +
+ ((MCHBAR_CH1_CR_SC_IO_LATENCY_REG - MCHBAR_CH0_CR_SC_IO_LATENCY_REG) * Channel);
+ ScIoLatency.Data = MrcReadCR (MrcData, Offset);
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if ((MrcRankInChannelExist (MrcData, Rank, Channel))) {
+ MRC_DEBUG_MSG (Debug,
+ MSG_LEVEL_NOTE,
+ " C%d.R%d: IOLAT = %u RT_IOCOMP = %d\n",
+ Channel,
+ Rank,
+ ChannelOut->IoLatency[Rank],
+ ScIoLatency.Bits.RT_IOCOMP
+ );
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " B%d: %u\n", Byte, ChannelOut->RcvEn[Rank][Byte]);
+ }
+ }
+ }
+ }
+ }
+#endif
+
+ return Status;
+}
+
+/**
+@brief
+ Apply an signed offset to all selected bytes/ ranks in a channel to RcvEn timing
+ Robustly handles any carries to/from the IO Latency vs. RcvEn FlyBy
+ PiReserve will reserve a certain number of +/- PI ticks for margin purposes
+ Routine also minimizes the difference in RcvEn settings across ranks
+
+ @param[in,out] MrcData - MRC Global Data
+ @param[in] Channel - The channel to adjust
+ @param[in] RankMask - Mask of Ranks to adjust
+ @param[in] ByteMask - Mask of Bytes to adjust by the RcvEnOffset
+ @param[in] RcvEnOffset - Amount to offset RcvEn
+ @param[in] PiReserve - The number of PiTicks to reserve on each edge of RcvEn
+
+ @retval MrcStatus - mrcSuccess if successfull
+ mrcWrongInputParameter if channel doesnt exist or a RankMask of 0 is provided
+ mrcReadLevelingError if we over/underflow RT_IOCOMP field.
+**/
+MrcStatus
+MrcChangeRcvEnTiming (
+ IN OUT MrcParameters *const MrcData,
+ IN const U8 Channel,
+ IN const U8 RankMask,
+ IN const U16 ByteMask,
+ IN const S16 RcvEnOffset,
+ IN const S16 PiReserve
+ )
+{
+ MrcStatus Status;
+ MrcOutput *Outputs;
+ MrcDebug *Debug;
+ MrcChannelOut *ChannelOut;
+ MCHBAR_CH0_CR_SC_IO_LATENCY_STRUCT ScIoLatency;
+ U8 Rank;
+ U8 Byte;
+ S8 CycleOffset;
+ S8 IoGlobalOffset;
+ S8 IoLatRank[MAX_RANK_IN_CHANNEL];
+ S8 IoLatTarget;
+ S8 MaxRankLat;
+ S8 MinRankLat;
+ S16 NewRcvEn;
+ S16 MaxRcvEn;
+ S16 MinRcvEn;
+ S16 MaxRcvEnRank[MAX_RANK_IN_CHANNEL];
+ S16 MinRcvEnRank[MAX_RANK_IN_CHANNEL];
+ U32 CrOffset;
+
+ //
+ // Init variables with min and max values
+ //
+ Status = mrcSuccess;
+ Outputs = &MrcData->SysOut.Outputs;
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ ChannelOut = &MrcData->SysOut.Outputs.Controller[0].Channel[Channel];
+ MaxRankLat = 0;
+ MinRankLat = 15;
+ MaxRcvEn = -4096;
+ MinRcvEn = 4096;
+ IoGlobalOffset = 0;
+ MrcOemMemorySetWord ((U16*) MaxRcvEnRank, (U16)-4096, MAX_RANK_IN_CHANNEL);
+ MrcOemMemorySetWord ((U16*) MinRcvEnRank, 4096, MAX_RANK_IN_CHANNEL);
+ MrcOemMemorySet ((U8*) IoLatRank, 0, MAX_RANK_IN_CHANNEL);
+
+ //
+ // Quick error check on parameters
+ //
+ if ((!(MrcChannelExist (Outputs, Channel))) || (RankMask == 0)) {
+ return mrcWrongInputParameter;
+ }
+
+ //
+ // Walk through all the ranks/bytes to find Max/Min RcvEn values
+ //
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if ((((MRC_BIT0 << Rank) & RankMask) != 0) && ((MrcRankInChannelExist (MrcData, Rank, Channel)))) {
+ //
+ // Find Max/Min for RcvEn across bytes. RcvEn is the total (RcvEnPi - 64 * IOLat)
+ //
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ NewRcvEn = (S16) ChannelOut->RcvEn[Rank][Byte] - (64 * (S16) ChannelOut->IoLatency[Rank]);
+ if (ByteMask & (MRC_BIT0 << Byte)) {
+ //
+ // Apply an offset for this byte
+ //
+ NewRcvEn += RcvEnOffset;
+ }
+
+ if (MaxRcvEnRank[Rank] < NewRcvEn) {
+ MaxRcvEnRank[Rank] = NewRcvEn;
+ }
+
+ if (MinRcvEnRank[Rank] > NewRcvEn) {
+ MinRcvEnRank[Rank] = NewRcvEn;
+ }
+ }
+ //
+ // Find Max/Min for RcvEn across ranks
+ //
+ if (MaxRcvEn < MaxRcvEnRank[Rank]) {
+ MaxRcvEn = MaxRcvEnRank[Rank];
+ }
+
+ if (MinRcvEn > MinRcvEnRank[Rank]) {
+ MinRcvEn = MinRcvEnRank[Rank];
+ }
+ }
+ }
+
+ //
+ // Determine how far we are from the ideal center point for RcvEn timing.
+ // (PiIdeal - AveRcvEn)/64 is the ideal number of cycles we should have for IOLatency
+ // Command training will reduce this by 64, so plan for that now in the ideal value
+ //
+ IoLatTarget = (S8) ((RRE_PI_IDEAL - ((MaxRcvEn + MinRcvEn) / 2) + 32) / 64); // Rnd to closest int
+
+ //
+ // Walk through all the ranks and calculate new values of IOLat
+ //
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if ((((MRC_BIT0 << Rank) & RankMask) != 0) && ((MrcRankInChannelExist (MrcData, Rank, Channel)))) {
+ IoLatRank[Rank] = IoLatTarget;
+
+ //
+ // Check for RcvEn underflow
+ //
+ NewRcvEn = 64 * IoLatRank[Rank] + MinRcvEnRank[Rank];
+ if (NewRcvEn < PiReserve) {
+ IoLatRank[Rank] += (U8) ((PiReserve - NewRcvEn + 63) / 64); // Ceiling
+ }
+
+ //
+ // Check for RcvEn overflow
+ //
+ NewRcvEn = 64 * IoLatRank[Rank] + MaxRcvEnRank[Rank];
+ if (NewRcvEn > (511 - PiReserve)) {
+ IoLatRank[Rank] -= (U8) ((NewRcvEn - (511 - PiReserve) + 63) / 64); // Ceiling
+ }
+ //
+ // Check for IO Latency over/underflow
+ //
+ if ((IoLatRank[Rank] - IoGlobalOffset) > 14) {
+ IoGlobalOffset = IoLatRank[Rank] - 14;
+ }
+ if ((IoLatRank[Rank] - IoGlobalOffset) < 1) {
+ IoGlobalOffset = IoLatRank[Rank] - 1;
+ }
+ //
+ // Update Byte level results
+ //
+ CycleOffset = IoLatRank[Rank] - (S8) ChannelOut->IoLatency[Rank];
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ ChannelOut->RcvEn[Rank][Byte] += 64 * (U16) CycleOffset;
+ if (ByteMask & (MRC_BIT0 << Byte)) {
+ ChannelOut->RcvEn[Rank][Byte] += (U16) RcvEnOffset;
+ }
+ UpdateRxT (MrcData, Channel, Rank, Byte, 0xFF, 0);
+ }
+ }
+ }
+ //
+ // Calculate new IOComp Latency to include over/underflow
+ //
+ CrOffset = MCHBAR_CH0_CR_SC_IO_LATENCY_REG +
+ ((MCHBAR_CH1_CR_SC_IO_LATENCY_REG - MCHBAR_CH0_CR_SC_IO_LATENCY_REG) * Channel);
+ ScIoLatency.Data = MrcReadCR (MrcData, CrOffset);
+
+ //
+ // Check to see if were under/overflowing this field
+ //
+ if ((IoGlobalOffset < 0) && (ScIoLatency.Bits.RT_IOCOMP < (U8) -IoGlobalOffset)) {
+ Status = mrcReadLevelingError;
+ } else if (
+ (IoGlobalOffset > 0) &&
+ ((U8)IoGlobalOffset > (MCSCHEDS_CR_SC_IO_LATENCY_RT_IOCOMP_MAX - ScIoLatency.Bits.RT_IOCOMP))
+ ) {
+ Status = mrcReadLevelingError;
+ }
+
+ if(Status == mrcReadLevelingError) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_ERROR,
+ "MrcChangeRcvEnTiming(): RT_IOCOMP %s\n IoGlobalOffset: %d\n RT_IOCOMP(6'b): %d\n",
+ (IoGlobalOffset < 0) ? "underflowed" : "overflowed",
+ IoGlobalOffset,
+ ScIoLatency.Bits.RT_IOCOMP
+ );
+ }
+ ScIoLatency.Bits.RT_IOCOMP += IoGlobalOffset;
+ ChannelOut->RTIoComp = ScIoLatency.Bits.RT_IOCOMP;
+
+ //
+ // Walk through all ranks to program new IO Latency values
+ //
+ ScIoLatency.Data &= ~(
+ MCHBAR_CH0_CR_SC_IO_LATENCY_IOLAT_R0D0_MSK +
+ MCHBAR_CH0_CR_SC_IO_LATENCY_IOLAT_R1D0_MSK +
+ MCHBAR_CH0_CR_SC_IO_LATENCY_IOLAT_R0D1_MSK +
+ MCHBAR_CH0_CR_SC_IO_LATENCY_IOLAT_R1D1_MSK
+ );
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if ((((MRC_BIT0 << Rank) & RankMask) != 0) && ((MrcRankInChannelExist (MrcData, Rank, Channel)))) {
+ ChannelOut->IoLatency[Rank] = IoLatRank[Rank] - IoGlobalOffset;
+ }
+ ScIoLatency.Data |= (
+ (MCHBAR_CH0_CR_SC_IO_LATENCY_IOLAT_R0D0_MSK & (ChannelOut->IoLatency[Rank])) <<
+ (Rank * MCHBAR_CH0_CR_SC_IO_LATENCY_IOLAT_R0D0_WID)
+ );
+ }
+
+ //
+ // Program new IO Latency
+ //
+ MrcWriteCR (MrcData, CrOffset, ScIoLatency.Data);
+
+ return Status;
+}
+
+/**
+@brief
+ Once the DQS high phase has been found (for each DRAM) the next stage is to find out the round trip latency,
+ by locating the preamble cycle. This is achieved by trying smaller and smaller roundtrip
+ values until the strobe sampling is done on the preamble cycle.
+ The following algorithm is used to find the preamble cycle:
+
+ @param[in] MrcData - all the global data
+
+ @retval Nothing.
+**/
+MrcStatus
+MrcRoundTripLatency (
+ IN MrcParameters *const MrcData
+ )
+{
+ MrcStatus Status;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ MrcDebug *Debug;
+ U8 Channel;
+ U8 Rank;
+ U8 OptParam;
+ U8 RankMask;
+ U8 TestList[1];
+ S8 ClkShifts[1];
+ U8 Start;
+ U8 Stop;
+ U8 LoopCount;
+ U8 Update;
+ U8 MinIoLat;
+ U8 MaxRankRtl;
+ S8 DeltaLimitRtl;
+ U8 DeltaRtl;
+ MCHBAR_CH0_CR_TC_BANK_RANK_A_STRUCT TcBankRankA;
+
+ Status = mrcSuccess;
+ TestList[0] = RdT; // Test based on read eye width
+ ClkShifts[0] = 25; // Delay by 25 pi ticks to guardband for delay drift/jitter
+ LoopCount = 10;
+ Update = 1; // Apply the optimal settings
+ MaxRankRtl = 0;
+ Outputs = &MrcData->SysOut.Outputs;
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ ControllerOut = &Outputs->Controller[0];
+ OptParam = rtl; // Which parameter to optimize for
+
+ //
+ // Train timing separately for each rank
+ //
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ RankMask = (MRC_BIT0 << Rank);
+ if (!(RankMask & Outputs->ValidRankMask)) {
+ continue;
+ }
+ //
+ // Pick starting and stopping points
+ //
+ Stop = 0;
+ Start = 0;
+ MinIoLat = 15;
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!(MrcRankInChannelExist (MrcData, Rank, Channel))) {
+ continue;
+ }
+ ChannelOut = &ControllerOut->Channel[Channel];
+
+ if (Stop < ChannelOut->RTLatency[Rank]) {
+ Stop = ChannelOut->RTLatency[Rank];
+ }
+
+ if (MinIoLat > ChannelOut->IoLatency[Rank]) {
+ MinIoLat = ChannelOut->IoLatency[Rank];
+ }
+
+ Start = Stop - MinIoLat;
+ }
+
+ if ((S8) Start < 0) {
+ Start = 0;
+ }
+ //
+ // Find optimal answer
+ //
+ Status = TrainDDROptParamCliff (
+ MrcData,
+ OptParam,
+ TestList,
+ sizeof (TestList),
+ Start,
+ Stop,
+ LoopCount,
+ Update,
+ Outputs->MarginResult,
+ ClkShifts,
+ sizeof (ClkShifts),
+ Rank,
+ RankMask,
+ 0
+ );
+ if (Status == mrcFail) {
+ return mrcRoundTripLatencyError;
+ }
+ }
+
+ //
+ // Limit the RTL delta across the ranks present.
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nLimit the delta between Rank's RTL value.\n");
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel %d\n", Channel);
+ ChannelOut = &ControllerOut->Channel[Channel];
+ TcBankRankA.Data = ChannelOut->MchbarBANKRANKA;
+ DeltaLimitRtl = MAX ((S8) TcBankRankA.Bits.tRDRD_dr, (S8) TcBankRankA.Bits.tRDRD_dd);
+ //
+ // TA Times are in dclks. Must convert to qclks and subtract the burst length.
+ // Ensure we do not underflow the variable.
+ //
+ DeltaLimitRtl = ((2 * DeltaLimitRtl) - 8);
+ DeltaLimitRtl = MAX (DeltaLimitRtl, 0);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "RTL Delta Limit: %d\n", DeltaLimitRtl);
+
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if (MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ MaxRankRtl = MAX (MaxRankRtl, ChannelOut->RTLatency[Rank]);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " Rank %u RTL: %u\n", Rank, ChannelOut->RTLatency[Rank]);
+ }
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "MaxRankRtl: %u\n", MaxRankRtl);
+
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if (MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ DeltaRtl = MaxRankRtl - ChannelOut->RTLatency[Rank];
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "Rank %d: DeltaRtl: %u\tDeltaLimitRtl: %u%s",
+ Rank,
+ DeltaRtl,
+ DeltaLimitRtl,
+ (DeltaRtl > DeltaLimitRtl) ? "\tNew RTL: " : ""
+ );
+ if (DeltaRtl > DeltaLimitRtl) {
+ UpdateTAParamOffset (MrcData, Channel, 0, OptParam, MaxRankRtl - DeltaLimitRtl, 1, 0, 1 << Rank);
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+ }
+ }
+ }
+ }
+
+ return Status;
+}
+
+/**
+ Perform Receive Enable Timing Centering.
+ Center Receive Enable using moderate pattern with 1D eye.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - If successful, returns mrcSuccess.
+**/
+MrcStatus
+MrcReceiveEnTimingCentering (
+ IN MrcParameters *const MrcData
+ )
+{
+ MrcOutput *Outputs;
+
+ Outputs = &MrcData->SysOut.Outputs;
+
+ return DQTimeCentering1D (MrcData, Outputs->ValidChBitMask, RcvEnaX, 0, RCV_EN_CENTER_LC);
+} \ No newline at end of file
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/ReadTraining/MrcReadReceiveEnable.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/ReadTraining/MrcReadReceiveEnable.h
new file mode 100644
index 0000000..4984d2a
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/ReadTraining/MrcReadReceiveEnable.h
@@ -0,0 +1,120 @@
+/** @file
+ Read receive enable training definitions.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+**/
+
+#ifndef _MrcReadReceiveEnable_h_
+#define _MrcReadReceiveEnable_h_
+
+#include "MrcTypes.h"
+#include "MrcCommon.h"
+#include "MrcCrosser.h"
+#include "MrcGlobal.h"
+
+#define HW_ROUNDT_LAT_DEFAULT_VALUE_A0 (20) ///< HSW HW specific default value
+#define MRC_ROUND_TRIP_IO_COMPENSATION_2_CHANNEL_A0 (25) // Roundtrip - IO compensation for 2 channel
+
+#define HW_ROUNDT_LAT_DEFAULT_VALUE_B0 (16) ///< HSW HW specific default value
+#define MRC_ROUND_TRIP_IO_COMPENSATION_2_CHANNEL_B0 (21) // Roundtrip - IO compensation for 2 channel
+
+#define HW_ROUNDT_LAT_DEFAULT_VALUE_ULT_A0 (18) // Roundtrip Latency
+#define MRC_ROUND_TRIP_IO_COMPENSATION_2_CHANNEL_ULT_A0 (23) // Roundtrip - IO compensation for 2 channel
+
+///
+/// ReadReceiveEnable (RRE) parameters
+/// Command training will reduce this by 64, so plan for that now in the ideal value
+///
+#define RRE_PI_IDEAL (256 + 64)
+#define RRE_ALL_RANKS_MASK (0x0F)
+#define RRE_PI_TO_RESERVE (64)
+
+/**
+@brief
+ Perform receive enable training.
+ Optimize RcvEn timing with MPR pattern
+
+ @param[in, out] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - if succeeded, return mrcSuccess
+**/
+extern
+MrcStatus
+MrcReadLevelingTraining (
+ IN OUT MrcParameters *const MrcData
+ );
+
+/**
+@brief
+ Apply an signed offset to all selected bytes/ ranks in a channel to RcvEn timing
+ Robustly handles any carries to/from the IO Latency vs. RcvEn FlyBy
+ PiReserve will reserve a certain number of +/- PI ticks for margin purposes
+ Routine also minimizes the difference in RcvEn settings across ranks
+
+ @param[in,out] MrcData - MRC Global Data
+ @param[in] Channel - The channel to adjust
+ @param[in] RankMask - Mask of Ranks to adjust
+ @param[in] ByteMask - Mask of Bytes to adjust by the RcvEnOffset
+ @param[in] RcvEnOffset - Amount to offset RcvEn
+ @param[in] PiReserve - The number of PiTicks to reserve on each edge of RcvEn
+
+ @retval MrcStatus - mrcSuccess if successfull
+ mrcWrongInputParameter if channel doesnt exist or a RankMask of 0 is provided
+ mrcReadLevelingError if we over/underflow RT_IOCOMP field.
+**/
+MrcStatus
+MrcChangeRcvEnTiming (
+ IN OUT MrcParameters *const MrcData,
+ IN const U8 Channel,
+ IN const U8 RankMask,
+ IN const U16 ByteMask,
+ IN const S16 RcvEnOffset,
+ IN const S16 PiReserve
+ );
+
+/**
+@brief
+ Once the DQS high phase has been found (for each DRAM) the next stage is to find out the round trip latency,
+ by locating the preamble cycle. This is achieved by trying smaller and smaller roundtrip
+ values until the strobe sampling is done on the preamble cycle.
+ The following algorithm is used to find the preamble cycle:
+
+ @param[in] MrcData - all the global data
+
+ @retval Nothing.
+**/
+extern
+MrcStatus
+MrcRoundTripLatency (
+ IN MrcParameters *const MrcData
+ );
+
+/**
+ Perform Receive Enable Timing Centering.
+ Center Receive Enable using moderate pattern with 1D eye
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - if it succeded returns mrcSuccess
+**/
+MrcStatus
+MrcReceiveEnTimingCentering (
+ IN MrcParameters *const MrcData
+ );
+
+#endif // _MrcReadReceiveEnable_h_
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Services/MrcCommandTraining.c b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Services/MrcCommandTraining.c
new file mode 100644
index 0000000..3bc5ef6
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Services/MrcCommandTraining.c
@@ -0,0 +1,4743 @@
+/** @file
+ Implementation of the command training algorithm.
+ The algorithm finds the N mode for the current board and also the correct
+ CLK CMD CTL pi setting.
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+
+**/
+
+//
+// Include files
+//
+#include "MrcCommandTraining.h"
+
+#define MRC_CADB_PB_LENGTH 16
+
+/**
+@brief
+ This function performs early command training.
+ Center CTL-CLK timing to allow subsequent steps to work
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - mrcSuccess if it succeeded
+**/
+MrcStatus
+MrcEarlyCommandTraining (
+ IN MrcParameters *const MrcData
+ )
+{
+ const MrcInput *Inputs;
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ S32 *IPStart;
+ S32 *IPEnd;
+ S32 *CPStart;
+ S32 *CPEnd;
+ S32 *LPStart;
+ S32 *LPEnd;
+ MrcStatus Status;
+ BOOL Pass;
+ BOOL Done;
+ DDRCLK_CR_DDRCRCLKPICODE_STRUCT DdrCrClkPiCode;
+ MCHBAR_CH0_CR_REUT_CH_MISC_ODT_CTRL_STRUCT ReutChMiscOdtCtrl;
+ MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_STRUCT ReutGlobalCtl;
+ DDRDATA0CH0_CR_DDRCRDATACONTROL0_STRUCT DdrCrDataControl0;
+ DDRDATA0CH0_CR_DDRCRDATACONTROL2_STRUCT DdrCrDataControl2;
+ U32 CRValue;
+ S32 cWidth;
+ S32 lWidth;
+ S32 InitialPassingStart[MAX_CHANNEL][MAX_RANK_IN_CHANNEL];
+ S32 InitialPassingEnd[MAX_CHANNEL][MAX_RANK_IN_CHANNEL];
+ S32 CurrentPassingStart[MAX_CHANNEL][MAX_RANK_IN_CHANNEL];
+ S32 CurrentPassingEnd[MAX_CHANNEL][MAX_RANK_IN_CHANNEL];
+ S32 LargestPassingStart[MAX_CHANNEL][MAX_RANK_IN_CHANNEL];
+ S32 LargestPassingEnd[MAX_CHANNEL][MAX_RANK_IN_CHANNEL];
+ U32 DqsDoneMask;
+ U32 bytePass[MAX_CHANNEL];
+ U32 byteFail[MAX_CHANNEL];
+ U32 Offset;
+ U8 Channel;
+ U8 Rank;
+ U8 byte;
+ U8 chBitMask;
+ U8 RankMask;
+ U8 ValidRankMask;
+ U8 clkDelay;
+ U8 clkDelayArray;
+ U8 PiCode;
+ S8 DqsDelay;
+ S8 LastDqsRan[ECT_CLK_LOOPS][MAX_CHANNEL][MAX_RANK_IN_CHANNEL];
+
+ MrcOemMemorySet ((U8 *) LastDqsRan, ECT_DQS_STOP, sizeof (LastDqsRan));
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerOut = &Outputs->Controller[0];
+ //
+ // RankBitMask for both channels
+ //
+ ValidRankMask = Outputs->ValidRankMask;
+ //
+ // Channel bit mask
+ //
+ chBitMask = Outputs->ValidChBitMask;
+
+#ifdef ULT_FLAG
+ //
+ // Check if LPDDR3 memory is used
+ //
+ if (Outputs->DdrType == MRC_DDR_TYPE_LPDDR3) {
+ return EarlyCommandTrainingLpddr (MrcData);
+ }
+#endif // ULT_FLAG
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+
+ //
+ // Set DQS Delay to 32
+ //
+ for (byte = 0; byte < Outputs->SdramCount; byte++) {
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if ((MrcRankInChannelExist (MrcData, Rank, Channel)) && (Inputs->SetRxDqs32 == TRUE)) {
+ //
+ // Update RxDqsP & RxDqsN - leave other parameter the same; can we update in the next loop or do it per channel
+ //
+ UpdateRxT (MrcData, Channel, Rank, byte, 5, 32);
+ }
+ }
+ }
+ //
+ // Clear any old state in DataTrain Offset
+ //
+ MrcOemMemorySetDword (&ChannelOut->DataOffsetTrain[0], 0, Outputs->SdramCount);
+ }
+ }
+ //
+ // Setup REUT Engine
+ // LC = 10, SOE = 0 (NSOE), EnCADB = 0, EnCKE = 0
+ //
+ SetupIOTestMPR (MrcData, chBitMask, 10, NSOE, 0, 0);
+
+#ifdef MRC_DEBUG_PRINT
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nChannel\t");
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%u\t\t\t\t", Channel);
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nRank\t");
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if (MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%u", Rank);
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\t");
+ }
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nClock");
+#endif // MRC_DEBUG_PRINT
+ for (clkDelay = ECT_CLK_START; clkDelay < ECT_CLK_STOP; clkDelay += ECT_CLK_STEP) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n% 5u\t", clkDelay);
+ clkDelayArray = clkDelay / ECT_CLK_STEP;
+ //
+ // Program Clock Delays
+ //
+ DdrCrClkPiCode.Data = 0;
+ DdrCrClkPiCode.Bits.PiSettingRank0 =
+ DdrCrClkPiCode.Bits.PiSettingRank1 =
+ DdrCrClkPiCode.Bits.PiSettingRank2 =
+ DdrCrClkPiCode.Bits.PiSettingRank3 = clkDelay;
+ MrcWriteCrMulticast (MrcData, DDRCLK_CR_DDRCRCLKPICODE_REG, DdrCrClkPiCode.Data);
+
+ //
+ // Reset FIFOs and Reset all DIMM/all channels after changing PI codes
+ //
+ Status = MrcResetSequence (MrcData);
+
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ RankMask = MRC_BIT0 << Rank;
+ //
+ // Skip ranks that are not populated
+ //
+ if ((ValidRankMask & RankMask) == 0) {
+ continue;
+ }
+ //
+ // Program MR3 and Mask RAS/WE to prevent scheduler from issuing non-Read commands
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ SelectReutRanks (MrcData, Channel, RankMask, 0);
+ bytePass[Channel] = 0;
+ byteFail[Channel] = 0;
+ if (MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ Status = MrcWriteMRS (MrcData, Channel, RankMask, mrMR3, 4);
+
+ Offset = MCHBAR_CH0_CR_REUT_CH_MISC_ODT_CTRL_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_MISC_ODT_CTRL_REG - MCHBAR_CH0_CR_REUT_CH_MISC_ODT_CTRL_REG) * Channel);
+ ReutChMiscOdtCtrl.Data = MrcReadCR (MrcData, Offset);
+ ReutChMiscOdtCtrl.Bits.MPR_Train_DDR_On = 1;
+ MrcWriteCR (MrcData, Offset, ReutChMiscOdtCtrl.Data);
+ }
+ }
+ //
+ // Run ReadDQS Test
+ //
+ DqsDoneMask = (MRC_BIT0 << Outputs->SdramCount) - 1;
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nRank %u DqsDelay for clkDelay = %u", Rank, clkDelay);
+ //
+ for (DqsDelay = ECT_DQS_START; DqsDelay < ECT_DQS_STOP; DqsDelay += ECT_DQS_STEP) {
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n %d\t", DqsDelay);
+ //
+ // Write DqsDelay
+ //
+ Status = ChangeMargin (MrcData, RdT, DqsDelay, 0, 1, 0, 0, 0, 0, 0, 0, MrcRegFileStart);
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!(MrcRankInChannelExist (MrcData, Rank, Channel))) {
+ /*MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ (Channel != 0) ? "" : ((Outputs->SdramCount == MAX_SDRAM_IN_DIMM) ?
+ " " : " ")
+ );*/
+ } else {
+ ChannelOut = &ControllerOut->Channel[Channel];
+
+ for (byte = 0; byte < Outputs->SdramCount; byte++) {
+ //
+ // Force on SenseAmp
+ //
+ Offset = DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG +
+ ((DDRDATA0CH1_CR_DDRCRDATACONTROL2_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG) * Channel) +
+ ((DDRDATA1CH0_CR_DDRCRDATACONTROL2_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG) * byte);
+ DdrCrDataControl2.Data = ChannelOut->DqControl2[byte].Data;
+ DdrCrDataControl2.Bits.ForceBiasOn = DDRDATA0CH0_CR_DDRCRDATACONTROL2_ForceBiasOn_MAX;
+ DdrCrDataControl2.Bits.ForceRxOn = DDRDATA0CH0_CR_DDRCRDATACONTROL2_ForceRxOn_MAX;
+ MrcWriteCrMulticast (MrcData, Offset, DdrCrDataControl2.Data);
+ }
+ //
+ // Enable RX Training mode. Turn on Odt
+ //
+ Offset = DDRDATACH0_CR_DDRCRDATACONTROL0_REG +
+ ((DDRDATACH1_CR_DDRCRDATACONTROL0_REG - DDRDATACH0_CR_DDRCRDATACONTROL0_REG) * Channel);
+ DdrCrDataControl0.Data = ChannelOut->DqControl0.Data;
+ DdrCrDataControl0.Bits.ForceOdtOn = DDRDATACH0_CR_DDRCRDATACONTROL0_ForceOdtOn_MAX;
+ DdrCrDataControl0.Bits.RxTrainingMode = DDRDATACH0_CR_DDRCRDATACONTROL0_RxTrainingMode_MAX;
+ MrcWriteCR (MrcData, Offset, DdrCrDataControl0.Data);
+ }
+ }
+ //
+ // Clear Results for Prior Test and wait to obtain results
+ //
+ Status = IoReset (MrcData);
+
+ //
+ // Start REUT and run for 1uS
+ //
+ ReutGlobalCtl.Data = 0;
+ ReutGlobalCtl.Bits.Global_Clear_Errors = 1;
+ ReutGlobalCtl.Bits.Global_Start_Test = 1;
+ MrcWriteCR (MrcData, MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_REG, ReutGlobalCtl.Data);
+
+ //
+ // Wait for test to start clearing errors.
+ //
+ MrcWait (MrcData, START_TEST_DELAY);
+
+ //
+ // Clear Results for Prior Test and wait to obtain results
+ //
+ Status = IoReset (MrcData);
+ MrcWait (MrcData, IO_RESET_DELAY);
+
+ //
+ // Stop REUT
+ //
+ ReutGlobalCtl.Data = 0;
+ ReutGlobalCtl.Bits.Global_Stop_Test = 1;
+ MrcWriteCR (MrcData, MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_REG, ReutGlobalCtl.Data);
+
+ //
+ // Get Results for all ch/bytes
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ for (byte = 0; byte < Outputs->SdramCount; byte++) {
+ Offset = DDRDATA0CH0_CR_DATATRAINFEEDBACK_REG +
+ ((DDRDATA0CH1_CR_DATATRAINFEEDBACK_REG - DDRDATA0CH0_CR_DATATRAINFEEDBACK_REG) * Channel) +
+ ((DDRDATA1CH0_CR_DATATRAINFEEDBACK_REG - DDRDATA0CH0_CR_DATATRAINFEEDBACK_REG) * byte);
+ Pass = (MrcReadCR (MrcData, Offset) == 1);
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, Pass ? ". " : "# ");
+ //
+ CRValue = (MRC_BIT0 << byte);
+ if (Pass) {
+ bytePass[Channel] |= CRValue;
+ } else {
+ byteFail[Channel] |= CRValue;
+ }
+ }
+ //
+ // Save DqsDelay where all bytes passed
+ //
+ if ((bytePass[Channel] == DqsDoneMask) && (LastDqsRan[clkDelayArray][Channel][Rank] > DqsDelay)) {
+ LastDqsRan[clkDelayArray][Channel][Rank] = DqsDelay;
+ }
+ }
+ }
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (byte = 0; byte < Outputs->SdramCount; byte++) {
+ //
+ // Restore orginal value
+ //
+ Offset = DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG +
+ ((DDRDATA0CH1_CR_DDRCRDATACONTROL2_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG) * Channel) +
+ ((DDRDATA1CH0_CR_DDRCRDATACONTROL2_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG) * byte);
+ MrcWriteCR (MrcData, Offset, ChannelOut->DqControl2[byte].Data);
+ }
+
+ Status = IoReset (MrcData);
+
+ //
+ // Clear RX Mode
+ //
+ Offset = DDRDATACH0_CR_DDRCRDATACONTROL0_REG +
+ ((DDRDATACH1_CR_DDRCRDATACONTROL0_REG - DDRDATACH0_CR_DDRCRDATACONTROL0_REG) * Channel);
+ MrcWriteCrMulticast (MrcData, Offset, ChannelOut->DqControl0.Data);
+ }
+ }
+ //
+ // Are We done yet?
+ //
+ Done = TRUE;
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ if ((bytePass[Channel] != DqsDoneMask) || (byteFail[Channel] != DqsDoneMask)) {
+ Done = FALSE;
+ break;
+ }
+ }
+ }
+ //
+ // If we re done, we passed or failed for all bytes
+ //
+ if (Done == TRUE) {
+ break;
+ }
+ }
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+ //
+ // Update results for all channel at this rank
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ Pass = ((bytePass[Channel] == DqsDoneMask) && (byteFail[Channel] == DqsDoneMask));
+
+ //
+ // Check if we have a valid pass
+ //
+ if (Pass &&
+ (clkDelay != ECT_CLK_START) &&
+ ((LastDqsRan[clkDelayArray][Channel][Rank] - LastDqsRan[clkDelayArray - 1][Channel][Rank]) > 16)
+ ) {
+ Pass = FALSE;
+ }
+
+ IPStart = &InitialPassingStart[Channel][Rank];
+ IPEnd = &InitialPassingEnd[Channel][Rank];
+ CPStart = &CurrentPassingStart[Channel][Rank];
+ CPEnd = &CurrentPassingEnd[Channel][Rank];
+ LPStart = &LargestPassingStart[Channel][Rank];
+ LPEnd = &LargestPassingEnd[Channel][Rank];
+ if (clkDelay == ECT_CLK_START) {
+ if (Pass) {
+ *IPStart = clkDelay;
+ *IPEnd = clkDelay;
+ *CPStart = clkDelay;
+ *CPEnd = clkDelay;
+ *LPStart = clkDelay;
+ *LPEnd = clkDelay;
+ } else {
+ *IPStart = -ECT_CLK_STEP;
+ *IPEnd = -ECT_CLK_STEP;
+ *CPStart = -ECT_CLK_STEP;
+ *CPEnd = -ECT_CLK_STEP;
+ *LPStart = -ECT_CLK_STEP;
+ *LPEnd = -ECT_CLK_STEP;
+ }
+ } else {
+ if (Pass) {
+ //
+ // Update Initial variables
+ //
+ if (*IPEnd == clkDelay - ECT_CLK_STEP) {
+ *IPEnd = clkDelay; // In passing region
+ }
+ //
+ // Update Current variables
+ //
+ if (*CPEnd == clkDelay - ECT_CLK_STEP) {
+ *CPEnd = clkDelay; // In passing region
+ } else {
+ *CPStart = clkDelay; // New region
+ *CPEnd = clkDelay;
+ }
+ //
+ // Special case for last step: Append Initial Passing Region
+ // clkDelay should be considered a continuous range that wraps around 0
+ //
+ if (clkDelay == 128 - ECT_CLK_STEP && *IPStart == ECT_CLK_START && *IPEnd != clkDelay) {
+ *CPEnd += ECT_CLK_STEP + (*IPEnd -*IPStart);
+ }
+ //
+ // Update Largest variables
+ //
+ cWidth = *CPEnd - *CPStart;
+ lWidth = *LPEnd - *LPStart;
+ if (cWidth > lWidth) {
+ *LPStart = *CPStart;
+ *LPEnd = *CPEnd;
+ }
+ }
+ }
+ }
+ }
+ //
+ // Clean up registers. No need to clear MR3 since DIMM will be reset
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ Offset = MCHBAR_CH0_CR_REUT_CH_MISC_ODT_CTRL_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_MISC_ODT_CTRL_REG - MCHBAR_CH0_CR_REUT_CH_MISC_ODT_CTRL_REG) * Channel);
+ ReutChMiscOdtCtrl.Data = MrcReadCR (MrcData, Offset);
+ ReutChMiscOdtCtrl.Bits.MPR_Train_DDR_On = 0;
+ MrcWriteCR (MrcData, Offset, ReutChMiscOdtCtrl.Data);
+ }
+ }
+ }
+
+#ifdef MRC_DEBUG_PRINT
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if (MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ CPEnd = &CurrentPassingEnd[Channel][Rank];
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ (LastDqsRan[clkDelayArray][Channel][Rank] < ECT_DQS_STOP) ? ". " : "# "
+ );
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "(% 3d)", LastDqsRan[clkDelayArray][Channel][Rank]);
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\t");
+ }
+ }
+ }
+#endif // MRC_DEBUG_PRINT
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\tLeft\tRight\tWidth\tClkDelay\n");
+ //
+ // Find largest passing region and Update PICodes
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ DdrCrClkPiCode.Data = 0;
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if (MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ LPStart = &LargestPassingStart[Channel][Rank];
+ LPEnd = &LargestPassingEnd[Channel][Rank];
+ lWidth = *LPEnd - *LPStart;
+
+ //
+ // Error Handler if eye not found for all bytes
+ //
+ if (lWidth == 0) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "\nERROR!! NO EYE found for Channel:%u Rank:%u\n", Channel, Rank);
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "Channel %u Rank %u:\t%d\t%d\t%d\t%d\n",
+ Channel,
+ Rank,
+ *LPStart,
+ *LPEnd,
+ lWidth,
+ 0
+ );
+ return mrcReadMPRErr;
+ }
+
+ if (lWidth > ECT_MIN_WIDTH) {
+ PiCode = (U8) (*LPStart + lWidth / 2);
+ } else {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_WARNING,
+ "\nWARNING!! lWidth <= %u for Channel %u Rank %u \n",
+ ECT_MIN_WIDTH,
+ Channel,
+ Rank
+ );
+ PiCode = 64;
+ }
+ //
+ // Update Host Structure with new PiCode
+ //
+ switch (Rank) {
+ case 0:
+ DdrCrClkPiCode.Bits.PiSettingRank0 = PiCode;
+ break;
+
+ case 1:
+ DdrCrClkPiCode.Bits.PiSettingRank1 = PiCode;
+ break;
+
+ case 2:
+ DdrCrClkPiCode.Bits.PiSettingRank2 = PiCode;
+ break;
+
+ case 3:
+ DdrCrClkPiCode.Bits.PiSettingRank3 = PiCode;
+ break;
+
+ default:
+ break;
+ }
+
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "C%u.R%u:\t%d\t%d\t%d\t%d\n",
+ Channel,
+ Rank,
+ *LPStart,
+ *LPEnd,
+ lWidth,
+ PiCode
+ );
+ }
+ }
+
+ Offset = DDRCLKCH0_CR_DDRCRCLKPICODE_REG +
+ ((DDRCLKCH1_CR_DDRCRCLKPICODE_REG - DDRCLKCH0_CR_DDRCRCLKPICODE_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, DdrCrClkPiCode.Data);
+ MrcOemMemorySetDword (&ChannelOut->DataOffsetTrain[0], 0, Outputs->SdramCount);
+ }
+ }
+
+ Status = ChangeMargin (MrcData, RdT, 0, 0, 1, 0, 0, 0, 0, 0, 0, MrcRegFileCurrent);
+ Status = MrcResetSequence (MrcData);
+
+ return Status;
+}
+
+/**
+@brief
+ This function performs Late command training.
+ Center CMD/CTL-CLK timing using complex patterns.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - If it's a success return mrcSuccess
+**/
+MrcStatus
+MrcLateCommandTraining (
+ MrcParameters *const MrcData
+ )
+{
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ MrcStatus Status;
+ MrcProfile Profile;
+ U32 MinCode;
+ U32 Offset;
+ U8 Cmd2N;
+ U8 Channel;
+ U8 ChBitMask;
+ U8 RankMask;
+ U8 Rank;
+ U8 Ranks;
+ U8 CmdPiCode[MAX_CHANNEL];
+ U8 CtlPiCode[MAX_CHANNEL];
+#ifdef ULT_FLAG
+ BOOL Lpddr;
+ U8 MidPointCke[MAX_CHANNEL];
+ U8 MidPointCmdN[MAX_CHANNEL];
+ U8 MidPointCmdS[MAX_CHANNEL];
+ MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_STRUCT ReutChSeqBaseAddrOrderCarryInvertCtl;
+ MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_STRUCT ReutChSeqBaseAddrIncCtl;
+ MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_STRUCT ReutChPatCadbCtrl;
+ MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_STRUCT ReutChSeqBaseAddrWrap;
+#endif //ULT_FLAG
+
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerOut = &Outputs->Controller[0];
+ Profile = MrcData->SysIn.Inputs.MemoryProfile;
+
+#ifdef ULT_FLAG
+ //
+ // Check if LPDDR3 memory is used
+ //
+ Lpddr = (Outputs->DdrType == MRC_DDR_TYPE_LPDDR3);
+#endif // ULT_FLAG
+
+ ChBitMask = Outputs->ValidChBitMask;
+ RankMask = Outputs->ValidRankMask;
+
+#ifdef ULT_FLAG
+ if (Lpddr) {
+ SetupIOTestCADB (MrcData, ChBitMask, 10, NTHSOE, 1, 0); // LC = 10
+ } else
+#endif //ULT_FLAG
+ {
+ Cmd2N = FALSE;
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ Cmd2N = (ControllerOut->Channel[Channel].Timing[Profile].NMode == 2) ? TRUE : FALSE; // All channels have same NMode
+ break;
+ }
+ }
+ CmdPiCode[0] = CmdPiCode[1] = (Cmd2N == TRUE) ? 85 : 64;
+ CtlPiCode[0] = CtlPiCode[1] = 64;
+
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ " Cmd2N %d, CmdPiCode %d, ChBitMask = 0x%x\n",
+ Cmd2N,
+ CmdPiCode[0],
+ ChBitMask
+ );
+
+ //
+ // Setup REUT
+ // LC= 10, SOE = 1 (NTHSOE), EnCADB = 1, EnCKE = 0
+ //
+ SetupIOTestCADB (MrcData, ChBitMask, 10, NTHSOE, 1, 0);
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!(MrcChannelExist (Outputs, Channel))) {
+ continue;
+ }
+
+ ChannelOut = &ControllerOut->Channel[Channel];
+
+ //
+ // Shift everything to the right. To get DQ timing right, program Clk to 0
+ //
+ ShiftPIforCmdTraining (
+ MrcData,
+ Channel,
+ MrcIterationClock,
+ ChannelOut->ValidRankBitMask,
+ 1,
+ 0 - ChannelOut->ClkPiCode[0],
+ 1
+ );
+ ShiftPIforCmdTraining (MrcData, Channel, MrcIterationCmdS, ChannelOut->ValidRankBitMask, 1, CmdPiCode[Channel], 1);
+ ShiftPIforCmdTraining (MrcData, Channel, MrcIterationCmdN, ChannelOut->ValidRankBitMask, 1, CmdPiCode[Channel], 1);
+ ShiftPIforCmdTraining (MrcData, Channel, MrcIterationCtl, ChannelOut->ValidRankBitMask, 1, CtlPiCode[Channel], 1);
+ }
+ }
+
+#ifdef ULT_FLAG
+
+ if (Lpddr) {
+ //
+ // Center Command Timing
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n*** ECT results\n");
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ MidPointCke[Channel] = (U8) ChannelOut->CkeCmdPiCode[0];
+ MidPointCmdS[Channel] = (U8) ChannelOut->CmdsCmdPiCode[0];
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "C%u: CAA: CKE fub: %d, CmdS fub: %d\n",
+ Channel,
+ MidPointCke[Channel],
+ MidPointCmdS[Channel]
+ );
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n*** Center CAA[5,6,7,8,9] Timing using CKE fub\n");
+ CmdTimingCentering (MrcData, MrcIterationCke, RankMask, 1, MidPointCke);
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n*** Center CAA[0,1,2,3,4] Timing using CmdS fub\n");
+ CmdTimingCentering (MrcData, MrcIterationCmdS, RankMask, 1, MidPointCmdS);
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n*** ECT results\n");
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ MidPointCmdS[Channel] = (U8)ChannelOut->CmdsCmdPiCode[1];
+ MidPointCmdN[Channel] = (U8)ChannelOut->CmdnCmdPiCode[1];
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "C%u: CAB: CmdS fub: %d, CmdN fub: %d\n",
+ Channel,
+ MidPointCmdS[Channel],
+ MidPointCmdN[Channel]
+ );
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n*** Center CAB[5,8] Timing using CmdS fub\n");
+ CmdTimingCentering (MrcData, MrcIterationCmdS, RankMask, 2, MidPointCmdS);
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n*** Center CAB[0,1,2,3,4,6,7,9] Timing using CmdN fub\n");
+ CmdTimingCentering (MrcData, MrcIterationCmdN, RankMask, 2, MidPointCmdN);
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n*** Center Control Timing\n");
+
+ //
+ // @todo Reinitialize registers to CAS-centric training (no CADB) ?
+ //
+
+ //
+ // Modify the differences
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!MrcChannelExist (Outputs, Channel)) {
+ continue;
+ }
+ Offset = MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_REG +
+ ((MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_REG - MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_REG) * Channel);
+ ReutChSeqBaseAddrOrderCarryInvertCtl.Data = 0;
+ MrcWriteCR (MrcData, Offset, ReutChSeqBaseAddrOrderCarryInvertCtl.Data);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "C%d ReutChSeqBaseAddrOrderCarryInvertCtl: 0x%08X\n", Channel, ReutChSeqBaseAddrOrderCarryInvertCtl.Data);
+
+ Offset = MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_REG +
+ ((MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_REG - MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_REG) * Channel);
+ ReutChSeqBaseAddrIncCtl.Data = 0;
+ ReutChSeqBaseAddrIncCtl.Bits.Rank_Base_Address_Update_Scale = 1;
+ ReutChSeqBaseAddrIncCtl.Bits.Bank_Base_Address_Update_Scale = 1;
+ ReutChSeqBaseAddrIncCtl.Bits.Row_Base_Address_Update_Scale = 1;
+ ReutChSeqBaseAddrIncCtl.Bits.Column_Base_Address_Update_Scale = 1;
+ ReutChSeqBaseAddrIncCtl.Bits.Column_Base_Address_Increment = 1;
+ MrcWriteCR64 (MrcData, Offset, ReutChSeqBaseAddrIncCtl.Data);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "C%d ReutChSeqBaseAddrIncCtl: 0x%08X%08X\n", Channel, ReutChSeqBaseAddrIncCtl.Data32[1],
+ ReutChSeqBaseAddrIncCtl.Data32[0]);
+
+ Offset = MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_REG - MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_REG) * Channel);
+ ReutChPatCadbCtrl.Data = 0;
+ ReutChPatCadbCtrl.Bits.Lane_Deselect_Enable = 0xB; // All, except CMD
+ ReutChPatCadbCtrl.Bits.CMD_Deselect_Start = 2; // Start on RD
+ MrcWriteCR (MrcData, Offset, ReutChPatCadbCtrl.Data);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "C%d ReutChPatCadbCtrl: 0x%08X\n", Channel, ReutChPatCadbCtrl.Data);
+
+ Offset = MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_MASK_MCMAIN_0_REG +
+ ((MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_MASK_MCMAIN_1_REG - MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_MASK_MCMAIN_0_REG) * Channel);
+ MrcWriteCR8 (MrcData, Offset, 0xFF);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "C%d ReutChSeqDummyreadMask Offset:0x%X Value:0x%X\n", Channel, Offset, 0xFF);
+
+ //
+ // Start from logical Rank 0
+ //
+ Offset = MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_0_REG +
+ ((MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_1_REG - MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_0_REG) * Channel);
+ MrcWriteCR64 (MrcData, Offset, 0);
+
+ //
+ // Wrap at column 127
+ // Logical Rank Wrap address will be updated in SelectReutRanks() later on.
+ //
+ Offset = MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_REG +
+ ((MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_1_REG - MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_REG) * Channel);
+ ReutChSeqBaseAddrWrap.Data = 0;
+ ReutChSeqBaseAddrWrap.Bits.Column_Address = 0x7F;
+ MrcWriteCR64 (MrcData, Offset, ReutChSeqBaseAddrWrap.Data);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "C%d ReutChSeqBaseAddrWrap: 0x%08X%08X\n", Channel, ReutChSeqBaseAddrWrap.Data32[1],
+ ReutChSeqBaseAddrWrap.Data32[0]);
+ } // for Channel
+
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ Ranks = (1 << Rank);
+ if ((Ranks & RankMask) == 0) {
+ continue;
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n*** ECT results\n");
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ CtlPiCode[Channel] = ControllerOut->Channel[Channel].CtlPiCode[Rank];
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "C%uR%u: CTL: %u\n", Channel, Rank, CtlPiCode[Channel]);
+ } else {
+ CtlPiCode[Channel] = 0;
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nCentering CTL on Rank %d\n", Rank);
+ CmdTimingCentering (MrcData, MrcIterationCtl, Ranks, Ranks, CtlPiCode);
+ }
+ } else // not Lpddr
+#endif //ULT_FLAG
+ {
+ //
+ // Center Clock Timing in the global eye
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n*** Center Clock Timing in the Global eye\n");
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " ALL Ranks - RankBitMask = %d\n", RankMask);
+ CmdTimingCentering (MrcData, MrcIterationClock, RankMask, 1, NULL);
+
+ //
+ // Center Command Timing
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n\n*** Center Command S Timing\n");
+ CmdTimingCentering (MrcData, MrcIterationCmdS, RankMask, 1, CmdPiCode);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n\n*** Center Command N Timing\n");
+ CmdTimingCentering (MrcData, MrcIterationCmdN, RankMask, 1, CmdPiCode);
+
+ //
+ // Center Control Timing. For control pins, CKE PI is shared between Rank 2 and 3
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n\n*** Center Control Timing. CKE PI is shared between Rank 2 and 3");
+ for (Rank = 0; Rank < (MAX_RANK_IN_CHANNEL - 1); Rank++) {
+ Ranks = (1 << Rank);
+
+ if (Rank == 2) {
+ Ranks = 0xC;
+ }
+
+ Ranks = Ranks & RankMask;
+
+ if (Ranks) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n\n Rank %d\n", Rank);
+ CmdTimingCentering (MrcData, MrcIterationCtl, Ranks, 1, CtlPiCode);
+ }
+ }
+ }
+
+ //
+ // Normalize timing back to 0 to improve performance
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n*** Normalize timing back to 0\n");
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!MrcChannelExist (Outputs, Channel)) {
+ continue;
+ }
+ ChannelOut = &ControllerOut->Channel[Channel];
+
+ //
+ // Find the minimum PI Code across all relevant CMD and CTL fubs
+ //
+ MinCode = ChannelOut->CkeCmdPiCode[0];
+ MinCode = MIN (MinCode, ChannelOut->CmdsCmdPiCode[0]);
+
+#ifdef ULT_FLAG
+ if (Lpddr) {
+ MinCode = MIN (MinCode, ChannelOut->CmdsCmdPiCode[1]);
+ MinCode = MIN (MinCode, ChannelOut->CmdnCmdPiCode[1]);
+ } else
+#endif //ULT_FLAG
+ {
+ MinCode = MIN (MinCode, ChannelOut->CmdnCmdPiCode[0]);
+ }
+
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if (MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ MinCode = MIN (MinCode, ChannelOut->CkePiCode[Rank]);
+ MinCode = MIN (MinCode, ChannelOut->CtlPiCode[Rank]);
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "C%d: shifting all PI settings by Min PI Code = %d\n", Channel, MinCode);
+ ShiftChannelTiming (MrcData, Channel, (-1) * MinCode, 1);
+ } // for Channel
+
+ //
+ // Disable CADB Deselects after Command Training
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ Offset = MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_REG - MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, 0);
+ }
+ }
+
+ //
+ // Finish Training with JEDEC Reset / Init
+ //
+ Status = MrcResetSequence (MrcData);
+ return Status;
+}
+
+/**
+@brief
+ Perform Command Voltage Centering.
+
+ @param[in, out] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - if it succeded returns mrcSuccess
+**/
+MrcStatus
+MrcCmdVoltageCentering (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ const U16 mode = 0;
+ const MrcInput *Inputs;
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcChannelOut *ChannelOut;
+ MrcStatus Status;
+ U32 BERStats[4];
+ U32 Offset;
+ U8 LoopCount;
+ U8 ValidRankMask;
+ U8 Channel;
+ U8 Rank;
+ U8 chBitMask;
+ U8 RankMask;
+ U32 MinChLow;
+ U32 MinChHigh;
+ BOOL Lpddr;
+#ifdef MRC_DEBUG_PRINT
+ U32 Low;
+ U32 High;
+ U32 Height;
+#endif
+ S32 Center;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ ValidRankMask = Outputs->ValidRankMask;
+ Status = mrcSuccess;
+ MinChLow = 0xFFFFFFFF;
+ MinChHigh = 0xFFFFFFFF;
+ MrcOemMemorySet ((U8 *) BERStats, 0, sizeof (BERStats));
+
+ //
+ // Check if LPDDR3 memory is used
+ //
+ Lpddr = (Outputs->DdrType == MRC_DDR_TYPE_LPDDR3);
+
+ LoopCount = (Lpddr) ? 6 : 10;
+
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "Cmd Vref Training with LC = %d\n\nMargin\nParams: CmdV\n\tLow\tHigh\tHeight\tCenter\n",
+ LoopCount
+ );
+
+ //
+ // Use CADB test for Cmd to match Late Command Training
+ //
+ SetupIOTestCADB (MrcData, Outputs->ValidChBitMask, LoopCount, NSOE, 1, 0);
+
+ //
+ // Select rank for REUT test
+ //
+ chBitMask = 0;
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &Outputs->Controller[0].Channel[Channel];
+ chBitMask |= SelectReutRanks (MrcData, Channel, ChannelOut->ValidRankBitMask, 0);
+ if ((MRC_BIT0 << Channel) & chBitMask) {
+ //
+ // Clear any old state in DataTrain Offset
+ //
+ MrcOemMemorySetDword (&ChannelOut->DataOffsetTrain[0], 0, Outputs->SdramCount);
+ }
+ }
+
+ //
+ // Run test for Cmd Voltage
+ //
+ Status = MrcGetBERMarginCh (
+ MrcData,
+ Outputs->MarginResult,
+ chBitMask,
+ 0xFF,
+ 0,
+ CmdV,
+ mode,
+ 0,
+ MAX_POSSIBLE_VREF,
+ 0,
+ BERStats
+ );
+ Status = MrcResetSequence (MrcData);
+
+ //
+ // Find center value and update Vref.
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ MinChLow = MIN (MinChLow, Outputs->MarginResult[LastCmdV][0][Channel][0][0]);
+ MinChHigh = MIN (MinChHigh, Outputs->MarginResult[LastCmdV][0][Channel][0][1]);
+ }
+ }
+ Center = ((S32) (MinChHigh - MinChLow)) / 2;
+ UpdateVrefWaitTilStable (MrcData, 2, 1, Center / 10, 0);
+ Status = MrcResetSequence (MrcData);
+
+#ifdef MRC_DEBUG_PRINT
+ //
+ // Print test results
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ Low = Outputs->MarginResult[LastCmdV][0][Channel][0][0] / 10;
+ High = Outputs->MarginResult[LastCmdV][0][Channel][0][1] / 10;
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "C%u:\t%u\t%u\t%u\t%d\n",
+ Channel,
+ Low,
+ High,
+ Low + High,
+ ((S32) (High - Low)) / 2
+ );
+ }
+ }
+ Height = MinChHigh + MinChLow;
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "Sys:\t%u\t%u\t%u\t%d\n",
+ MinChLow / 10,
+ MinChHigh / 10,
+ Height / 10,
+ Center / 10
+ );
+#endif
+
+ //
+ // Update MrcData for future tests
+ //
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ RankMask = MRC_BIT0 << Rank;
+ if (!(RankMask & ValidRankMask)) {
+ //
+ // Skip if all channels empty
+ //
+ continue;
+ }
+ Outputs->MarginResult[LastCmdV][Rank][0][0][0] = MinChLow + Center;
+ Outputs->MarginResult[LastCmdV][Rank][0][0][1] = MinChHigh - Center;
+ }
+ //
+ // Disable CADB Deselects
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ Offset = MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_REG - MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_REG) * Channel);
+ MrcWriteCR8 (MrcData, Offset, 0);
+ }
+ }
+
+ return Status;
+}
+
+/**
+@brief
+ Centers Command Timing around a MidPoint
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Iteration - Determines which PI to shift
+ @param[in] Ranks - Valid Rank bit mask
+ @param[in] GroupMask - which LPDDR groups to work on for CMD/CLK/CKE; not used for DDR3
+ @param[in] MidPoint - The MidPoint to center around (per channel)
+
+ @retval Nothing
+**/
+void
+CmdTimingCentering (
+ IN MrcParameters *const MrcData,
+ IN U8 Iteration,
+ IN U8 Ranks,
+ IN U8 GroupMask,
+ IN U8 MidPoint[MAX_CHANNEL]
+ )
+{
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ U8 Ledge[MAX_CHANNEL];
+ U8 Redge[MAX_CHANNEL];
+ U8 Mid[MAX_CHANNEL];
+ U8 Low[MAX_CHANNEL];
+ U8 High[MAX_CHANNEL];
+ U8 MidValue;
+ S8 VrefOffsets[2];
+ U8 Center;
+ U8 ChBitMask;
+ U8 RankMask;
+ U8 Channel;
+ U8 MinWidth;
+ U8 lWidth;
+ BOOL SkipVref;
+
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerOut = &Outputs->Controller[0];
+ VrefOffsets[0] = -8;
+ VrefOffsets[1] = 8;
+ MinWidth = 18;
+ MrcOemMemorySet (Ledge, 0, sizeof (Ledge));
+ MrcOemMemorySet (Redge, 0, sizeof (Redge));
+
+ if ((Outputs->DdrType == MRC_DDR_TYPE_LPDDR3) && (Iteration != MrcIterationClock)) {
+ //
+ // Limit the binary search to +/- 32 PI ticks from the ECT midpoint, for LPDDR3 Command/Control
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ MidValue = MidPoint[Channel];
+ Low[Channel] = (MidValue > 32) ? (MidValue - 32) : 0;
+ High[Channel] = (MidValue < 127 - 32) ? (MidValue + 32) : 127;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Ch%d: search range is [%d..%d]\n", Channel, Low[Channel], High[Channel]);
+ }
+ } else {
+ //
+ // Binary search will use the full PI range of [0..127]
+ //
+ MrcOemMemorySet (Low, 0, sizeof (Low));
+ MrcOemMemorySet (High, 127, sizeof (High));
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel\t\t\t0 1\n");
+
+ //
+ // Setup REUT Test to iteration through appropriate ranks during test
+ //
+ ChBitMask = 0;
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChBitMask |= SelectReutRanks (MrcData, Channel, Ranks, 0);
+ if (MidPoint != NULL) {
+ Mid[Channel] = MidPoint[Channel];
+ }
+ }
+ //
+ // MRC_DEBUG_MSG (&MrcData->Inputs.Debug, MSG_LEVEL_NOTE, "**** CmdTimingCentering, Iteration = %d, ChBitMask = 0x%x\n", Iteration,ChBitMask);
+ //
+ if (Iteration == MrcIterationClock) {
+ //
+ // Use a linear search to center clock and Update Clock Delay/Host
+ // Allow wrap around since this is clock
+ // CmdLinearFindEdges also programs the new values
+ //
+ SkipVref = FALSE;
+ CmdLinearFindEdges (MrcData, Iteration, ChBitMask, Ranks, GroupMask, Low[0], High[0], 1, VrefOffsets, FALSE, SkipVref);
+ } else {
+ CmdBinaryFindEdge (MrcData, Iteration, ChBitMask, Ranks, GroupMask, Low, Mid, 0, VrefOffsets);
+ Ledge[0] = Mid[0];
+ Ledge[1] = Mid[1]; // CountUp is 0 so return High.
+ if (MidPoint == NULL) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Midpoint[] is NULL and MrcIterationClock not selected!\n");
+ } else {
+ Mid[0] = MidPoint[0];
+ Mid[1] = MidPoint[1]; //Mid Modified by CmdBinaryFindEdge
+ }
+ CmdBinaryFindEdge (MrcData, Iteration, ChBitMask, Ranks, GroupMask, Mid, High, 1, VrefOffsets);
+ Redge[0] = Mid[0];
+ Redge[1] = Mid[1]; // CountUp is 1 so return Low.
+ //
+ // Update Variables:
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nCH\tLeft\tRight\tWidth\tCenter");
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (((1 << Channel) & ChBitMask) == 0) {
+ continue;
+ }
+ RankMask = Ranks & ControllerOut->Channel[Channel].ValidRankBitMask;
+ lWidth = Redge[Channel] - Ledge[Channel];
+
+ if ((Redge[Channel] == 127) && (Ledge[Channel] == 0)) {
+ //
+ // No errors found
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_WARNING, "\nNo Errors Found for C%u!\n", Channel);
+ Center = MidPoint[Channel];
+ } else {
+ Center = (Ledge[Channel] + Redge[Channel] + 1) / 2;
+ if (lWidth < MinWidth) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_WARNING, "\nEye < %u for C%u!\n", MinWidth, Channel);
+ }
+ }
+
+ ShiftPIforCmdTraining (MrcData, Channel, Iteration, RankMask, GroupMask, Center, 1);
+
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\n %d\t%d\t%d\t%d\t%d",
+ Channel,
+ Ledge[Channel],
+ Redge[Channel],
+ lWidth,
+ Center
+ );
+ } // for Channel
+ }
+
+ return;
+}
+
+/**
+@brief
+ Use a linear search to find the edges between Low and High
+ if WrapAround = 0: Look for largest passing region between low and high
+ if WrapAround = 1: Look for largest passing region, including wrapping from high to low
+
+ @param[in, out] MrcData - Include all MRC global data.
+ @param[in] Iteration - Determines which PI to shift
+ @param[in] chBitMask - Valid Channel bit mask
+ @param[in] Ranks - Valid Rank bit mask
+ @param[in] GroupMask - which LPDDR groups to work on for CMD/CLK/CKE; not used for DDR3
+ @param[in] Low - Low limit
+ @param[in] High - High limit
+ @param[in] WrapAllowed - Determines the search region
+ @param[in] VrefOffsets - Array of Vref offsets
+ @param[in] SkipPrint - Switch to enable or disable debug printing
+ @param[in] SkipVref - Skip changing CMD Vref offsets, only run test once at the current Vref.
+
+ @retval MrcStatus - If it succeeds return mrcSuccess
+**/
+void
+CmdLinearFindEdges (
+ IN OUT MrcParameters *const MrcData,
+ IN U8 Iteration,
+ IN U8 chBitMask,
+ IN U8 Ranks,
+ IN U8 GroupMask,
+ IN S8 Low,
+ IN U8 High,
+ IN U8 WrapAllowed,
+ IN S8 *VrefOffsets,
+ IN BOOL SkipPrint,
+ IN BOOL SkipVref
+ )
+{
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ S32 *IPStart;
+ S32 *IPEnd;
+ S32 *CPStart;
+ S32 *CPEnd;
+ S32 *LPStart;
+ S32 *LPEnd;
+ MrcStatus Status;
+ BOOL Pass;
+ BOOL Lpddr;
+ S32 InitialPassingStart[MAX_CHANNEL];
+ S32 InitialPassingEnd[MAX_CHANNEL];
+ S32 CurrentPassingStart[MAX_CHANNEL];
+ S32 CurrentPassingEnd[MAX_CHANNEL];
+ S32 LargestPassingStart[MAX_CHANNEL];
+ S32 LargestPassingEnd[MAX_CHANNEL];
+ S32 lWidth;
+ S32 iWidth;
+ S32 cWidth;
+ S32 Center;
+ S16 LCTDelay;
+ U8 Channel;
+ U8 ChannelMask;
+ U8 RankMask;
+ U8 Rank;
+ U8 LCTStep;
+ U8 LastStep;
+ U8 Vloop;
+ U8 ChError;
+ U8 DumArr[7];
+ S8 Vref;
+
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerOut = &Outputs->Controller[0];
+ lWidth = 0;
+ iWidth = 0;
+ cWidth = 0;
+ MrcOemMemorySet (DumArr, 1, sizeof (DumArr));
+
+ //
+ // Check if LPDDR3 memory is used
+ //
+ Lpddr = (Outputs->DdrType == MRC_DDR_TYPE_LPDDR3);
+
+ LCTStep = (Lpddr) ? 2 : 6;
+
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "**** CmdLinearFindEdges, Iteration = %d, Low = %d, High = %d\n", Iteration, Low, High);
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, (!SkipPrint) ? "CLkDlay" : "");
+
+ for (LCTDelay = Low; LCTDelay <= High; LCTDelay += LCTStep) {
+ //
+ // Update Timing
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if ((1 << Channel) & chBitMask) {
+ RankMask = Ranks & ControllerOut->Channel[Channel].ValidRankBitMask;
+ ShiftPIforCmdTraining (MrcData, Channel, Iteration, RankMask, GroupMask, LCTDelay, 0);
+ }
+ }
+ //
+ // Reset DDR
+ //
+ Status = MrcResetSequence (MrcData);
+
+ //
+ // Run REUT until both channels fail or we finish all Vref points
+ //
+ if (SkipVref) {
+ ChError = RunIOTest (MrcData, chBitMask, Outputs->DQPat, DumArr, 1, 0);
+ } else {
+ ChError = 0;
+ for (Vloop = 0; Vloop < 2; Vloop++) {
+ Vref = VrefOffsets[Vloop];
+ UpdateVrefWaitTilStable (MrcData, 2, 0, Vref, 0);
+
+ ChError |= RunIOTest (MrcData, chBitMask, Outputs->DQPat, DumArr, 1, 0);
+
+ if (ChError == chBitMask) {
+ break;
+ }
+
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, (!SkipPrint) ? "\n %d\t\t\t" : "", LCTDelay);
+
+ //
+ // Update Passing Variables
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelMask = MRC_BIT0 << Channel;
+ if (!(ChannelMask & chBitMask)) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, (!SkipPrint && (Channel == 0)) ? " " : "");
+ continue;
+ }
+
+ Pass = !(ChError & ChannelMask);
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, (!SkipPrint) ? (Pass ? ". " : "# ") : "");
+
+ IPStart = &InitialPassingStart[Channel];
+ IPEnd = &InitialPassingEnd[Channel];
+ CPStart = &CurrentPassingStart[Channel];
+ CPEnd = &CurrentPassingEnd[Channel];
+ LPStart = &LargestPassingStart[Channel];
+ LPEnd = &LargestPassingEnd[Channel];
+
+ if (LCTDelay == (S16) Low) {
+ if (Pass) {
+ *IPStart = *IPEnd = *CPStart = *CPEnd = *LPStart = *LPEnd = Low;
+ } else {
+ *IPStart = *IPEnd = *CPStart = *CPEnd = *LPStart = *LPEnd = Low - LCTStep;
+ }
+ } else {
+ if (Pass) {
+ //
+ // Update Initial variables
+ //
+ if (*IPEnd == (LCTDelay - LCTStep)) {
+ *IPEnd = LCTDelay; // In passing region
+ }
+ //
+ // Update Current variables
+ //
+ if (*CPEnd == (LCTDelay - LCTStep)) {
+ *CPEnd = LCTDelay; // In passing region
+ } else {
+ *CPStart = *CPEnd = LCTDelay;
+ }
+ //
+ // Special case for last step: Append Initial Passing Region
+ // LCTDelay should be considered a continuous range that wraps around 0
+ //
+ LastStep = High - LCTStep;
+ if ((LCTDelay >= LastStep) && (*IPStart == Low) && WrapAllowed) {
+ iWidth = *IPEnd -*IPStart;
+ *CPEnd += (LCTStep + iWidth);
+ }
+ //
+ // Update Largest variables
+ //
+ cWidth = *CPEnd - *CPStart;
+ lWidth = *LPEnd - *LPStart;
+ if (cWidth > lWidth) {
+ *LPStart = *CPStart;
+ *LPEnd = *CPEnd;
+ }
+ }
+ }
+ } // for Channel
+
+
+ } // for LCTDelay
+
+ if (!SkipPrint) {
+ //
+ // Update Variables:
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nCH\tLeft\tRight\tWidth\tCenter\n");
+ }
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if ((MRC_BIT0 << Channel) & chBitMask) {
+ LPStart = &LargestPassingStart[Channel];
+ LPEnd = &LargestPassingEnd[Channel];
+ //
+ // Handle any corner cases
+ //
+ lWidth = *LPEnd - *LPStart;
+ if ((lWidth < (3 * LCTStep)) || (lWidth >= (High - Low))) {
+ //
+ // @todo: Pass a default center parameter instead of line below.
+ //
+ Center = (Low + High) / 2;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_WARNING, "\nError Handler! Found Bad command Eye\n");
+ } else {
+ Center = (*LPEnd + *LPStart) / 2;
+ }
+ RankMask = Ranks & ControllerOut->Channel[Channel].ValidRankBitMask;
+ if (!SkipPrint) {
+ //
+ // Shift Timing
+ //
+ ShiftPIforCmdTraining (MrcData, Channel, Iteration, RankMask, GroupMask, Center, 1);
+
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ " %d\t%d\t%d\t%d\t%d\n",
+ Channel,
+ *LPStart,
+ *LPEnd,
+ lWidth,
+ Center
+ );
+ }
+ //
+ // Determine in which rank to save the margins...
+ //
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if ((RankMask >> Rank) & MRC_BIT0) {
+ Outputs->MarginResult[LastCmdT][Rank][Channel][0][0] = 10 * ABS (*LPStart);
+ Outputs->MarginResult[LastCmdT][Rank][Channel][0][1] = 10 * ABS (*LPEnd);
+ }
+ }
+ }
+ }
+ //
+ // Clean Up
+ //
+ if (!SkipVref) {
+ UpdateVrefWaitTilStable (MrcData, 2, 0, 0, 0);
+ }
+
+ Status = MrcResetSequence (MrcData);
+ return;
+}
+
+/**
+@brief
+ Use a binary search to find the edge between Low and High
+ High and Low track passing points
+ if CountUp: Low is a passing point and need to count up to find a failing point
+ if CountDn: High is a passing point and need to count dn to find a failing point
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Iteration - Determines which PI to shift
+ @param[in] ChBitMask - Valid Channel bit mask
+ @param[in] Ranks - Valid Rank bit mask
+ @param[in] GroupMask - which LPDDR groups to work on for CMD/CLK/CKE; not used for DDR3
+ @param[in, out] Low - Low limit
+ @param[in, out] High - High limit
+ @param[in] CountUp - The direction to search
+ @param[in] VrefOffsets - Array of Vref offsets
+
+ @retval Nothing
+**/
+void
+CmdBinaryFindEdge (
+ IN MrcParameters *const MrcData,
+ IN U8 Iteration,
+ IN U8 ChBitMask,
+ IN U8 Ranks,
+ IN U8 GroupMask,
+ IN OUT U8 *Low,
+ IN OUT U8 *High,
+ IN U8 CountUp,
+ IN S8 *VrefOffsets
+ )
+{
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcStatus Status;
+ U8 Target[MAX_CHANNEL];
+ U8 Done;
+ U8 ChError;
+ U8 DumArr[7];
+ S8 Vref;
+ U8 Channel;
+ U8 ChannelMask;
+ U8 RankMask;
+ U8 Group;
+ U8 Fail;
+ U8 Vloop;
+
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerOut = &Outputs->Controller[0];
+ Done = 0;
+ ChError = 0;
+ MrcOemMemorySet (Target, 0, sizeof (Target));
+ MrcOemMemorySet (DumArr, 1, sizeof (DumArr));
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "CmdTgt\nCh0G0\tCh0G1\tCh1G0\tCh1G1\n");
+
+ while (!Done) {
+ //
+ // Update Timing
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (((1 << Channel) & ChBitMask) == 0) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\t");
+ } else {
+ Target[Channel] = (High[Channel] + Low[Channel] + CountUp) / 2; // CountUp gets rounding correct
+ RankMask = Ranks & ControllerOut->Channel[Channel].ValidRankBitMask;
+ for (Group = 0; Group < 2; Group++) {
+ if (((1 << Group) & GroupMask) == 0) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\t");
+ } else {
+ ShiftPIforCmdTraining (MrcData, Channel, Iteration, RankMask, 1 << Group, Target[Channel], 0);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d\t", Target[Channel]);
+ }
+ }
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\t");
+
+ //
+ // Reset DDR
+ //
+ Status = MrcResetSequence (MrcData);
+
+ //
+ // Run REUT until both channels fail or we finish all Vref points
+ //
+ ChError = 0;
+ for (Vloop = 0; Vloop < 2; Vloop++) {
+ Vref = VrefOffsets[Vloop];
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "**** Run REUT until both channels fail or we finish all Vref points, Vref = %d\n", Vref);
+ //
+ UpdateVrefWaitTilStable (MrcData, 2, 0, Vref, 0);
+
+ ChError |= RunIOTest (MrcData, ChBitMask, Outputs->DQPat, DumArr, 1, 0);
+ if (ChError == ChBitMask) {
+ break;
+ }
+
+ }
+
+ //
+ // Update High/Low
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelMask = 1 << Channel;
+ if (!(ChannelMask & ChBitMask)) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, (Channel == 0) ? " " : "");
+ } else {
+ Fail = (ChError & ChannelMask);
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, Fail ? "# " : ". ");
+
+ //
+ // Skip if this channel is done
+ //
+ if (High[Channel] > Low[Channel]) {
+ if (CountUp) {
+ if (Fail) {
+ High[Channel] = Target[Channel] - 1;
+ } else {
+ Low[Channel] = Target[Channel];
+ }
+ } else {
+ if (Fail) {
+ Low[Channel] = Target[Channel] + 1;
+ } else {
+ High[Channel] = Target[Channel];
+ }
+ }
+ }
+ }
+ }
+ //
+ // Update Done
+ //
+ Done = 1;
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if ((1 << Channel) & ChBitMask) {
+ if (High[Channel] > Low[Channel]) {
+ Done = 0;
+ }
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+ }
+ //
+ // Clean Up
+ //
+ UpdateVrefWaitTilStable (MrcData, 2, 0, 0, 0);
+ MrcResetSequence (MrcData);
+ return;
+}
+
+/**
+@brief
+ Shift the CLK/CMD/CTL Timing by the given PI setting value
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Channel - Channel to shift
+ @param[in] Offset - Offset to shift by
+ @param[in] UpdateHost - Switch to update the host structure
+
+ @retval Nothing
+**/
+void
+ShiftChannelTiming (
+ IN MrcParameters *const MrcData,
+ IN U8 Channel,
+ IN S32 Offset,
+ IN U8 UpdateHost
+ )
+{
+ const MrcDebug *Debug;
+ const MrcInput *Inputs;
+ const MrcChannelIn *ChannelIn;
+ MrcChannelOut *ChannelOut;
+ S32 NewCode;
+ U8 Rank;
+ U8 RankBit;
+#ifdef ULT_FLAG
+ U8 Group;
+ BOOL Lpddr;
+#endif // ULT_FLAG
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ ChannelIn = &Inputs->Controller[0].Channel[Channel];
+ ChannelOut = &MrcData->SysOut.Outputs.Controller[0].Channel[Channel];
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel %d:\n", Channel);
+
+#ifdef ULT_FLAG
+ //
+ // Check if LPDDR3 memory is used
+ //
+ Lpddr = (MrcData->SysOut.Outputs.DdrType == MRC_DDR_TYPE_LPDDR3);
+#endif // ULT_FLAG
+
+ //
+ // Shift the CLK/CTL Timing
+ //
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if (MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ RankBit = 1 << Rank;
+ NewCode = ChannelOut->ClkPiCode[Rank] + Offset;
+#ifdef ULT_FLAG
+ if (!Lpddr)
+#endif // ULT_FLAG
+ {
+ //
+ // CLK is per Rank in DDR3
+ //
+ ShiftPIforCmdTraining (MrcData, Channel, MrcIterationClock, RankBit, RankBit, Offset, UpdateHost);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " R%d New CLK value = %d\n", Rank, NewCode);
+ }
+
+ NewCode = ChannelOut->CtlPiCode[Rank] + Offset;
+ ShiftPIforCmdTraining (MrcData, Channel, MrcIterationCtl, RankBit, 1, NewCode, UpdateHost);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " R%d New CTL value = %d\n", Rank, NewCode);
+ }
+ }
+
+ //
+ // Shift the CMD Timing
+ //
+ NewCode = ChannelOut->CmdsCmdPiCode[0] + Offset;
+ ShiftPIforCmdTraining (MrcData, Channel, MrcIterationCmdS, ChannelOut->ValidRankBitMask, 1, NewCode, UpdateHost);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " New CMDS[0] value = %d\n", NewCode);
+
+#ifdef ULT_FLAG
+ if (Lpddr) {
+ //
+ // CLK is per Group in LPDDR3
+ //
+ for (Group = 0; Group < 2; Group++) {
+ if (ChannelIn->DQByteMap[MrcIterationClock][Group] != 0) {
+ ShiftPIforCmdTraining (MrcData, Channel, MrcIterationClock, 0, 1 << Group, Offset, UpdateHost);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " New CLK%d value = %d\n", Group, ChannelOut->ClkPiCode[Group]);
+ }
+ }
+
+ NewCode = ChannelOut->CkeCmdPiCode[0] + Offset;
+ ShiftPIforCmdTraining (MrcData, Channel, MrcIterationCke, ChannelOut->ValidRankBitMask, 1, NewCode, UpdateHost);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " New CKE[0] value = %d\n", NewCode);
+
+ NewCode = ChannelOut->CmdsCmdPiCode[1] + Offset;
+ ShiftPIforCmdTraining (MrcData, Channel, MrcIterationCmdS, ChannelOut->ValidRankBitMask, 2, NewCode, UpdateHost);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " New CMDS[1] value = %d\n", NewCode);
+
+ NewCode = ChannelOut->CmdnCmdPiCode[1] + Offset;
+ ShiftPIforCmdTraining (MrcData, Channel, MrcIterationCmdN, ChannelOut->ValidRankBitMask, 2, NewCode, UpdateHost);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " New CMDN[1] value = %d\n", NewCode);
+ } else
+#endif // ULT_FLAG
+ {
+ NewCode = ChannelOut->CmdnCmdPiCode[0] + Offset;
+ ShiftPIforCmdTraining (MrcData, Channel, MrcIterationCmdN, ChannelOut->ValidRankBitMask, 1, NewCode, UpdateHost);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " New CMDN[0] value = %d\n", NewCode);
+ }
+ return;
+}
+
+/**
+@brief
+ This function updtes Command Mode register, tXP and Round trip latency
+
+ @param[in, out] MrcData - Include all MRC global data.
+ @param[in] Channel - Channel to perform update to
+ @param[in] OldN - Old N Mode value
+ @param[in] NewN - New N mode value
+
+ @retval Nothing
+**/
+void
+UpdateCmdNTiming (
+ IN OUT MrcParameters *const MrcData,
+ IN U8 Channel,
+ IN U8 OldN,
+ IN U8 NewN
+ )
+{
+ const U8 CmdStretch[1 << MCHBAR_CH0_CR_TC_BANK_RANK_A_CMD_stretch_WID] = {
+ 0,
+ 2,
+ 3,
+ MCHBAR_CH0_CR_TC_BANK_RANK_A_CMD_stretch_DEF
+ };
+
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcChannelOut *ChannelOut;
+ U8 *RtLatency;
+ MCHBAR_CH0_CR_TC_BANK_RANK_A_STRUCT TcBankRankA;
+ MCHBAR_CH0_CR_TC_BANK_RANK_C_STRUCT TcBankRankC;
+ MCHBAR_CH0_CR_SC_ROUNDT_LAT_STRUCT ScRoundtLat;
+ MrcProfile Profile;
+ U32 Offset;
+ U32 Scratch;
+ U8 Rank;
+ S8 Diff;
+
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ ChannelOut = &Outputs->Controller[0].Channel[Channel];
+ Profile = MrcData->SysIn.Inputs.MemoryProfile;
+
+ //
+ // Update CmdN timing
+ //
+ Offset = MCHBAR_CH0_CR_TC_BANK_RANK_A_REG +
+ ((MCHBAR_CH1_CR_TC_BANK_RANK_A_REG - MCHBAR_CH0_CR_TC_BANK_RANK_A_REG) * Channel);
+ TcBankRankA.Data = MrcReadCR (MrcData, Offset);
+ TcBankRankA.Bits.CMD_stretch = CmdStretch[ChannelOut->Timing[Profile].NMode - 1];
+ MrcWriteCR (MrcData, Offset, TcBankRankA.Data);
+ ChannelOut->MchbarBANKRANKA = TcBankRankA.Data;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "C%d_TC_BANK_RANK_A = 0x%x\n", Channel, TcBankRankA.Data);
+
+ //
+ // Adjust tXP value
+ //
+ Offset = MCHBAR_CH0_CR_TC_BANK_RANK_C_REG +
+ ((MCHBAR_CH1_CR_TC_BANK_RANK_C_REG - MCHBAR_CH0_CR_TC_BANK_RANK_C_REG) * Channel);
+ TcBankRankC.Data = MrcReadCR (MrcData, Offset);
+ Scratch = tXPValue (Outputs->DdrType, Outputs->Frequency, (U8) ChannelOut->Timing[Profile].NMode);
+ TcBankRankC.Bits.tXP = MIN (Scratch, MCHBAR_CH0_CR_TC_BANK_RANK_C_tXP_MAX);
+ MrcWriteCR (MrcData, Offset, TcBankRankC.Data);
+ ChannelOut->MchbarBANKRANKC = TcBankRankC.Data;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "C%d_TC_BANK_RANK_C = 0x%x\n", Channel, TcBankRankC.Data);
+
+ //
+ // Adjust RT values to compensate.
+ //
+ Diff = (NewN - OldN);
+ ScRoundtLat.Data = 0;
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if (MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ RtLatency = &ChannelOut->RTLatency[Rank];
+ *RtLatency = (U8) (*RtLatency + Diff);
+ switch (Rank) {
+ case 0:
+ ScRoundtLat.Bits.Lat_R0D0 = *RtLatency;
+ break;
+
+ case 1:
+ ScRoundtLat.Bits.Lat_R1D0 = *RtLatency;
+ break;
+
+ case 2:
+ ScRoundtLat.Bits.Lat_R0D1 = *RtLatency;
+ break;
+
+ case 3:
+ ScRoundtLat.Bits.Lat_R1D1 = *RtLatency;
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+
+ Offset = MCHBAR_CH0_CR_SC_ROUNDT_LAT_REG +
+ ((MCHBAR_CH1_CR_SC_ROUNDT_LAT_REG - MCHBAR_CH0_CR_SC_ROUNDT_LAT_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, ScRoundtLat.Data);
+ return;
+}
+
+#ifdef ULT_FLAG
+
+/**
+@brief
+ Enter / exit LPDDR CA training modes.
+ Main flow:
+ 1. Force CKE high.
+ 2. Send MRW 41, 48 or 42.
+ 3. Force CKE low for MRW 41 or 48
+
+ @param[in] MrcData - The MRC global data.
+ @param[in] ChBitMask - channels to work on.
+ @param[in] RankBitMask - ranks to work on.
+ @param[in] Mode - CA training mode.
+
+ @retval mrcSuccess if succeeded
+**/
+MrcStatus
+LpddrCommandTrainingMode (
+ IN MrcParameters * const MrcData,
+ IN U8 ChBitMask,
+ IN U8 RankBitMask,
+ IN MrcCaTrainingMode Mode
+ )
+{
+ MrcStatus Status;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ U8 Channel;
+ U8 Rank;
+ U32 Offset;
+ U32 Address;
+ U32 Data;
+ BOOL InitMrw;
+ BOOL ChipSelect2N;
+ MCHBAR_CH0_CR_REUT_CH_MISC_CKE_CTRL_STRUCT MiscCkeCtrl;
+
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerOut = &Outputs->Controller[0];
+
+ InitMrw = TRUE;
+ ChipSelect2N = FALSE;
+
+ switch (Mode) {
+ case CaTrainingMode41:
+ Address = 0x29;
+ Data = 0xA4; // Data is selected so that High and Low phases of CA[9:0] are equal
+ break;
+
+ case CaTrainingMode48:
+ Address = 0x30;
+ Data = 0xC0;
+ break;
+
+ case CaTrainingMode42:
+ Address = 0x2A;
+ Data = 0xA8;
+ ChipSelect2N = FALSE;
+ break;
+
+ default:
+ return mrcFail;
+ }
+
+ //
+ // Send the MRW41 command to populated ranks
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (((1 << Channel) & ChBitMask) == 0) {
+ continue;
+ }
+
+ //
+ // Force CKE high
+ //
+ MiscCkeCtrl.Data = 0;
+ MiscCkeCtrl.Bits.CKE_Override = 0x0F;
+ MiscCkeCtrl.Bits.CKE_On = ControllerOut->Channel[Channel].ValidCkeBitMask;
+ Offset = MCHBAR_CH0_CR_REUT_CH_MISC_CKE_CTRL_REG +
+ (MCHBAR_CH1_CR_REUT_CH_MISC_CKE_CTRL_REG - MCHBAR_CH0_CR_REUT_CH_MISC_CKE_CTRL_REG) * Channel;
+ MrcWriteCR (MrcData, Offset, MiscCkeCtrl.Data);
+
+ //
+ // Wait for CKE to become effective
+ //
+ MrcWait (MrcData, 1 * HPET_MIN);
+
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank ++) {
+ if (!MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ continue;
+ }
+ if (((1 << Rank) & RankBitMask) != 0) {
+ Status = MrcIssueMrw (MrcData, Channel, Rank, Address, Data, InitMrw, ChipSelect2N);
+ if (Status != mrcSuccess) {
+ return Status;
+ }
+ }
+ }
+
+ //
+ // Force CKE Low for MRW 41 or 48
+ //
+ if (Mode != CaTrainingMode42) {
+ //
+ // Wait tCACKEL = 10 tCK
+ //
+ MrcWait (MrcData, 1 * HPET_MIN);
+
+ //
+ // Force CKE low, tCACKEL after MRW41 issued
+ //
+ MiscCkeCtrl.Bits.CKE_On = 0;
+ MrcWriteCR (MrcData, Offset, MiscCkeCtrl.Data);
+ }
+ } // for Channel
+ return mrcSuccess;
+}
+
+/**
+ Program CADB Pattern Buffers with given values
+
+ @param[in] MrcData - The MRC global data.
+ @param[in] Channel - channel to work on.
+ @param[in] PatBuf0 - Pattern Buffer 0 value
+ @param[in] PatBuf1 - Pattern Buffer 1 value
+ @param[in] PatBuf2 - Pattern Buffer 2 value
+
+ @retval none
+**/
+void
+SetCadbPatternBuffers (
+ IN MrcParameters * const MrcData,
+ IN U8 Channel,
+ IN U32 PatBuf0,
+ IN U32 PatBuf1,
+ IN U32 PatBuf2
+ )
+{
+ U32 Offset;
+
+ Offset = MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_PB_0_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_PB_0_REG - MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_PB_0_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, PatBuf0);
+
+ Offset = MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_PB_1_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_PB_1_REG - MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_PB_1_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, PatBuf1);
+
+ Offset = MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_PB_2_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_PB_2_REG - MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_PB_2_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, PatBuf2);
+}
+
+//
+// Sets up 3 CADB lines that will be used to send out a CS pattern.
+//
+// -----------------------
+// CADB Phase Phase CS
+// Line High Low
+// -----------------------
+// 0 0x000 0x000 Off
+// 1 0x3FF 0x3FF Off
+// 2 0x2AA 0x2AA On
+// 3 0x155 0x155 On
+//
+// The CS pattern uses Pattern Buffer and hence has 16 lines, with CS active for one line only.
+// This will send a command every 16 DCLKs.
+//
+// Pattern Buffer details:
+// The line order is: 0, 0, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+// or different command: 0, 0, 3, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+//
+// 000
+// 000
+// 000
+// 000
+//
+// 000
+// 000
+// 000
+// 000
+//
+// 000
+// 000
+// 000
+// 000
+//
+// 001
+// 001
+// 010 or 011
+// 000
+// ----
+// 000 --> PB[0] = 0x3000 or 0x7000
+// 000 PB[1] = 0x4000
+// 000 PB[2] = 0x0000
+// 043 or 047
+//
+CADB_LINE CadbLinesCs[] = {
+ { 0x000, 0x000, 0 },
+ { 0x3FF, 0x3FF, 0 },
+ { 0x2AA, 0x2AA, 1 },
+ { 0x155, 0x155, 1 }
+};
+
+/**
+ Setup the CADB for CS or CA training.
+
+ @param[in] MrcData - The MRC global data.
+ @param[in] Channel - channel to work on
+ @param[in] Rank - rank to work on
+ @param[in] CadbLines - CADB lines to program
+ @param[in] CadbCount - Number of CADB lines to program
+ @param[in] PatBuf0 - Pattern Buffer 0 value
+ @param[in] PatBuf1 - Pattern Buffer 1 value
+ @param[in] PatBuf2 - Pattern Buffer 2 value
+ @retval none
+**/
+void
+SetupCaTrainingCadb (
+ IN MrcParameters * const MrcData,
+ IN U8 Channel,
+ IN U8 Rank,
+ IN CADB_LINE *CadbLines,
+ IN U32 CadbCount,
+ IN U32 PatBuf0,
+ IN U32 PatBuf1,
+ IN U32 PatBuf2
+)
+{
+ U32 Offset;
+ U32 MA;
+ U32 BA;
+ U32 CMD;
+ U32 i;
+
+ MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_CTRL_STRUCT ReutChPatCadbMuxCtrl;
+ MCHBAR_CH0_CR_REUT_CH_PAT_CADB_PROG_STRUCT ReutChPatCadbProg;
+
+ //
+ // Set Mux0/1/2 to Pattern Buffer mode
+ //
+ Offset = MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_CTRL_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_CTRL_REG - MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_CTRL_REG) * Channel);
+ ReutChPatCadbMuxCtrl.Data = MrcReadCR (MrcData, Offset);
+ ReutChPatCadbMuxCtrl.Bits.Mux0_Control = 1;
+ ReutChPatCadbMuxCtrl.Bits.Mux1_Control = 1;
+ ReutChPatCadbMuxCtrl.Bits.Mux2_Control = 1;
+ MrcWriteCR (MrcData, Offset, ReutChPatCadbMuxCtrl.Data);
+
+ //
+ // Program Pattern Buffers for a specific progression over CADB,
+ // according to the given Pattern Buffer values
+ //
+ SetCadbPatternBuffers (MrcData, Channel, PatBuf0, PatBuf1, PatBuf2);
+
+ //
+ // Start writing at CADB row 0
+ //
+ Offset = MCHBAR_CH0_CR_REUT_CH_PAT_CADB_WRITE_POINTER_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_PAT_CADB_WRITE_POINTER_REG - MCHBAR_CH0_CR_REUT_CH_PAT_CADB_WRITE_POINTER_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, 0);
+
+ ReutChPatCadbProg.Data = 0;
+ ReutChPatCadbProg.Bits.CADB_Data_ODT = (0 << Rank);
+ ReutChPatCadbProg.Bits.CADB_Data_CKE = (0 << Rank);
+
+ //
+ // Program the CADB lines
+ //
+ Offset = MCHBAR_CH0_CR_REUT_CH_PAT_CADB_PROG_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_PAT_CADB_PROG_REG - MCHBAR_CH0_CR_REUT_CH_PAT_CADB_PROG_REG) * Channel);
+ for (i = 0; i < CadbCount ; i++) {
+ MrcConvertLpddr2Ddr (CadbLines[i].CaHigh, CadbLines[i].CaLow, &MA, &BA, &CMD);
+ ReutChPatCadbProg.Bits.CADB_Data_Address = MA;
+ ReutChPatCadbProg.Bits.CADB_Data_Bank = BA;
+ ReutChPatCadbProg.Bits.CADB_Data_Control = CMD;
+ ReutChPatCadbProg.Bits.CADB_Data_CS = 0x0F & ~(CadbLines[i].ChipSelect << Rank);
+
+ //
+ // Write CADB line. It is auto incremented after every write
+ //
+ MrcWriteCR64 (MrcData, Offset, ReutChPatCadbProg.Data);
+ }
+}
+
+/**
+ Program DESWIZZLE_HIGH/LOW registers for MR4 decoding
+
+ @param[in] MrcData - The MRC global data.
+
+ @retval none
+**/
+void
+ProgramDeswizzleRegisters (
+ IN MrcParameters * const MrcData
+ )
+{
+ MrcInput *Inputs;
+ MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcChannelIn *ChannelIn;
+ MrcChannelOut *ChannelOut;
+ MrcControllerOut *ControllerOut;
+ U8 Channel;
+ U32 Byte;
+ U8 Bit;
+ U32 Offset;
+ MCHBAR_CH0_CR_DESWIZZLE_LOW_STRUCT DeswizzleLow;
+ MCHBAR_CH0_CR_DESWIZZLE_HIGH_STRUCT DeswizzleHigh;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerOut = &Outputs->Controller[0];
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!MrcChannelExist (Outputs, Channel)) {
+ continue;
+ }
+ ChannelIn = &Inputs->Controller[0].Channel[Channel];
+ ChannelOut = &ControllerOut->Channel[Channel];
+
+ DeswizzleLow.Data = 0;
+ DeswizzleHigh.Data = 0;
+
+ for (Byte = 0; Byte <= 7; Byte++) {
+ //
+ // DqsMapCpu2Dram maps CPU bytes to DRAM, we need to find the reverse mapping here
+ //
+ switch (ChannelIn->DqsMapCpu2Dram[Byte]) {
+ case 0:
+ DeswizzleLow.Bits.Byte_0 = Byte;
+ break;
+ case 2:
+ DeswizzleLow.Bits.Byte_2 = Byte;
+ break;
+ case 4:
+ DeswizzleHigh.Bits.Byte_4 = Byte;
+ break;
+ case 6:
+ DeswizzleHigh.Bits.Byte_6 = Byte;
+ break;
+ }
+ }
+
+ for (Bit = 0; Bit <= 7; Bit++) {
+ //
+ // DqMapCpu2Dram maps CPU DQ pins to DRAM, we need to find the reverse mapping here
+ //
+ Byte = DeswizzleLow.Bits.Byte_0;
+ switch (ChannelIn->DqMapCpu2Dram[Byte][Bit]) {
+ case 0:
+ DeswizzleLow.Bits.Bit_0 = Bit;
+ break;
+ case 1:
+ DeswizzleLow.Bits.Bit_1 = Bit;
+ break;
+ case 2:
+ DeswizzleLow.Bits.Bit_2 = Bit;
+ break;
+ }
+
+ Byte = DeswizzleLow.Bits.Byte_2;
+ switch (ChannelIn->DqMapCpu2Dram[Byte][Bit]) {
+ case 16:
+ DeswizzleLow.Bits.Bit_16 = Bit;
+ break;
+ case 17:
+ DeswizzleLow.Bits.Bit_17 = Bit;
+ break;
+ case 18:
+ DeswizzleLow.Bits.Bit_18 = Bit;
+ break;
+ }
+
+ Byte = DeswizzleHigh.Bits.Byte_4;
+ switch (ChannelIn->DqMapCpu2Dram[Byte][Bit]) {
+ case 32:
+ DeswizzleHigh.Bits.Bit_32 = Bit;
+ break;
+ case 33:
+ DeswizzleHigh.Bits.Bit_33 = Bit;
+ break;
+ case 34:
+ DeswizzleHigh.Bits.Bit_34 = Bit;
+ break;
+ }
+
+ Byte = DeswizzleHigh.Bits.Byte_6;
+ switch (ChannelIn->DqMapCpu2Dram[Byte][Bit]) {
+ case 48:
+ DeswizzleHigh.Bits.Bit_48 = Bit;
+ break;
+ case 49:
+ DeswizzleHigh.Bits.Bit_49 = Bit;
+ break;
+ case 50:
+ DeswizzleHigh.Bits.Bit_50 = Bit;
+ break;
+ }
+ } // for Bit
+
+ if (ChannelOut->Dimm[dDIMM0].SdramWidth == 32) {
+ //
+ // Bytes 2 and 6 (and their bits) are irrelevant for x32 devices - copy from Bytes 0 and 4 instead
+ //
+ DeswizzleLow.Bits.Byte_2 = DeswizzleLow.Bits.Byte_0;
+ DeswizzleLow.Bits.Bit_16 = DeswizzleLow.Bits.Bit_0;
+ DeswizzleLow.Bits.Bit_17 = DeswizzleLow.Bits.Bit_1;
+ DeswizzleLow.Bits.Bit_18 = DeswizzleLow.Bits.Bit_2;
+
+ DeswizzleHigh.Bits.Byte_6 = DeswizzleHigh.Bits.Byte_4;
+ DeswizzleHigh.Bits.Bit_48 = DeswizzleHigh.Bits.Bit_32;
+ DeswizzleHigh.Bits.Bit_49 = DeswizzleHigh.Bits.Bit_33;
+ DeswizzleHigh.Bits.Bit_50 = DeswizzleHigh.Bits.Bit_34;
+ }
+
+ Offset = MCHBAR_CH0_CR_DESWIZZLE_LOW_REG +
+ (MCHBAR_CH1_CR_DESWIZZLE_LOW_REG - MCHBAR_CH0_CR_DESWIZZLE_LOW_REG) * Channel;
+ MrcWriteCR (MrcData, Offset, DeswizzleLow.Data);
+
+ Offset = MCHBAR_CH0_CR_DESWIZZLE_HIGH_REG +
+ (MCHBAR_CH1_CR_DESWIZZLE_HIGH_REG - MCHBAR_CH0_CR_DESWIZZLE_HIGH_REG) * Channel;
+ MrcWriteCR (MrcData, Offset, DeswizzleHigh.Data);
+
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "Ch%d DESWIZZLE_HIGH=%08X, DESWIZZLE_LOW=%08X\n",
+ Channel,
+ DeswizzleHigh.Data,
+ DeswizzleLow.Data
+ );
+ } // for Channel
+}
+
+/**
+ Sweep both CS and CMD PI and print the feedback.
+
+ @param[in] MrcData - The MRC global data.
+
+ @retval none
+**/
+MrcStatus
+Ca2DMargins (
+ IN MrcParameters * const MrcData,
+ U8 Rank
+ )
+{
+ MrcInput *Inputs;
+ MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcStatus Status;
+ U8 Channel;
+ U8 ChannelMask;
+ U8 Byte;
+ U8 CaStart = 32;
+ U8 CaStop = 127;
+ S8 CaStep = 6;
+ U8 CsStart = 0;
+ U8 CsStop = 127;
+ S8 CsStep = 8;
+ U8 CaPiCode;
+ U8 CsPiCode;
+ U32 DelayCadb;
+ U32 Offset;
+ char PassFail;
+ DDRDATA0CH0_CR_DATATRAINFEEDBACK_STRUCT DataTrainFeedback;
+
+ Status = mrcSuccess;
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+
+ DelayCadb = 1 * HPET_1US;
+
+ ChannelMask = 0;
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ ChannelMask |= (1 << Channel);
+ }
+ }
+
+ for (CsPiCode = CsStart; CsPiCode < CsStop; CsPiCode += CsStep) {
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ continue;
+ }
+ //
+ // Shift the CS PI on Rank.
+ //
+ ShiftPIforCmdTraining (MrcData, Channel, MrcIterationCtl, 1 << Rank, 1, CsPiCode, 0);
+ }
+
+ for (CaPiCode = CaStart; CaPiCode < CaStop; CaPiCode += CaStep) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d\t%d\t", CsPiCode, CaPiCode);
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ continue;
+ }
+ //
+ // Shift the Command PI on both CAA and CAB groups
+ //
+ ShiftPIforCmdTraining (MrcData, Channel, MrcIterationCmdN, 1 << Rank, 3, CaPiCode, 0);
+ ShiftPIforCmdTraining (MrcData, Channel, MrcIterationCmdS, 1 << Rank, 3, CaPiCode, 0);
+ ShiftPIforCmdTraining (MrcData, Channel, MrcIterationCke, 1 << Rank, 3, CaPiCode, 0);
+ }
+
+ //
+ // Perform Jedec Reset ONLY
+ //
+ MrcJedecResetLpddr3 (MrcData);
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ continue;
+ }
+ //
+ // Put the current Rank in CA training mode using MRW41.
+ //
+ Status = LpddrCommandTrainingMode (MrcData, 1 << Channel, 1 << Rank, CaTrainingMode41);
+ if (Status != mrcSuccess) {
+ return Status;
+ }
+ }
+
+ //
+ // Run CADB pattern on selected channels at the same time
+ //
+ ShortRunCADB (MrcData, ChannelMask);
+ MrcWait (MrcData, DelayCadb);
+
+ //
+ // Read and process the results
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Byte Feedback\n");
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ Offset = DDRDATA0CH0_CR_DATATRAINFEEDBACK_REG +
+ ((DDRDATA0CH1_CR_DATATRAINFEEDBACK_REG - DDRDATA0CH0_CR_DATATRAINFEEDBACK_REG) * Channel) +
+ ((DDRDATA1CH0_CR_DATATRAINFEEDBACK_REG - DDRDATA0CH0_CR_DATATRAINFEEDBACK_REG) * Byte);
+ DataTrainFeedback.Data = (MrcReadCR (MrcData, Offset) & 0xFF); // Get only DQ bits, not DQS
+
+ //
+ // If we don't see 4 ones in the byte, then the command was not aligned properly
+ //
+ if (MrcCountBitsEqOne (DataTrainFeedback.Data) != 4) {
+ PassFail = '#';
+ } else {
+ PassFail = '.';
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%c%02X\t", PassFail, DataTrainFeedback.Data);
+ } // for Byte
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\t");
+ } // for Channel
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+ }
+ } // while not done
+
+ return Status;
+}
+
+/**
+ Sweep CMD PI up or down and find edges for all bytes.
+ Main flow:
+ 1.
+ 2.
+ 3.
+
+ @param[in] MrcData - The MRC global data.
+
+ @retval none
+**/
+void
+EarlyCaFindEdge (
+ IN MrcParameters * const MrcData,
+ U8 Rank,
+ U8 Start,
+ U8 Stop,
+ S8 Step,
+ U8 Limit[MAX_CHANNEL][MAX_RANK_IN_CHANNEL][MAX_SDRAM_IN_DIMM]
+ )
+{
+ MrcInput *Inputs;
+ MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerIn *ControllerIn;
+ MrcControllerOut *ControllerOut;
+ MrcChannelIn *ChannelIn;
+ MrcChannelOut *ChannelOut;
+ U8 Channel;
+ U8 ChannelMask;
+ U8 Byte;
+ U8 ByteMask;
+ U8 DramByte;
+ U8 ByteDoneMask[MAX_CHANNEL];
+ U8 PiCode;
+ U32 DelayCadb;
+ U32 Offset;
+ BOOL Done;
+ char *BytesHeader;
+ char PassFail;
+ DDRDATA0CH0_CR_DATATRAINFEEDBACK_STRUCT DataTrainFeedback;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerIn = &Inputs->Controller[0];
+ ControllerOut = &Outputs->Controller[0];
+
+ DelayCadb = 1 * HPET_1US;
+
+ MrcOemMemorySet (ByteDoneMask, 0, sizeof (ByteDoneMask));
+
+ PiCode = Start;
+ Done = FALSE;
+
+ ChannelMask = 0;
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ ChannelMask |= (1 << Channel);
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\t Ch0\t\t\t\t Ch1\n");
+ BytesHeader = "0 1 2 3 4 5 6 7 ";
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "CMD PI\t %s%s\n", BytesHeader, BytesHeader);
+
+ while (!Done) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d: \t", PiCode);
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ continue;
+ }
+ //
+ // Shift the Command PI on both CAA and CAB groups
+ //
+ ShiftPIforCmdTraining (MrcData, Channel, MrcIterationCmdN, 1 << Rank, 3, PiCode, 0);
+ ShiftPIforCmdTraining (MrcData, Channel, MrcIterationCmdS, 1 << Rank, 3, PiCode, 0);
+ ShiftPIforCmdTraining (MrcData, Channel, MrcIterationCke, 1 << Rank, 3, PiCode, 0);
+ }
+
+ //
+ // Run CADB pattern on selected channels at the same time
+ //
+ ShortRunCADB (MrcData, ChannelMask);
+ MrcWait (MrcData, DelayCadb);
+
+ //
+ // Read and process the results
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ ByteDoneMask[Channel] = 0xFF;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " ");
+ continue;
+ }
+ if (ByteDoneMask[Channel] == 0xFF) { // All bytes failed on this channel, no need to sweep anymore
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " ");
+ continue;
+ }
+ ChannelIn = &ControllerIn->Channel[Channel];
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ ByteMask = (1 << Byte);
+ DramByte = ChannelIn->DqsMapCpu2Dram[Byte];
+ if (ChannelOut->Dimm[dDIMM0].SdramWidth == 32) {
+ if ((DramByte & 0x02) != 0) {
+ //
+ // Ignore upper 16 bits on x32 devices in MRW41 feedback - DRAM bytes 2, 3, 6 and 7
+ //
+ ByteDoneMask[Channel] |= ByteMask;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " ");
+ continue;
+ }
+ }
+ Offset = DDRDATA0CH0_CR_DATATRAINFEEDBACK_REG +
+ ((DDRDATA0CH1_CR_DATATRAINFEEDBACK_REG - DDRDATA0CH0_CR_DATATRAINFEEDBACK_REG) * Channel) +
+ ((DDRDATA1CH0_CR_DATATRAINFEEDBACK_REG - DDRDATA0CH0_CR_DATATRAINFEEDBACK_REG) * Byte);
+ DataTrainFeedback.Data = (MrcReadCR (MrcData, Offset) & 0xFF); // Get only DQ bits, not DQS
+
+ PassFail = '#';
+ if ((ByteDoneMask[Channel] & ByteMask) == 0) {
+ //
+ // If we don't see 4 ones in the byte, then the command was not aligned properly
+ //
+ if (MrcCountBitsEqOne (DataTrainFeedback.Data) != 4) {
+ Limit[Channel][Rank][Byte] = PiCode;
+ ByteDoneMask[Channel] |= ByteMask;
+ } else {
+ PassFail = '.';
+ }
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%c%02X ", PassFail, DataTrainFeedback.Data);
+ } // for Byte
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " ");
+ } // for Channel
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+ if ((ByteDoneMask[0] == 0xFF) && (ByteDoneMask[1] == 0xFF)) {
+ // Found the limit on all bytes on both channels - no need to sweep Pi any longer
+ break;
+ }
+
+ PiCode += Step;
+ if (Step > 0) {
+ // Sweep up
+ Done = (PiCode > Stop);
+ } else {
+ // Sweep down
+ Done = (((S8) PiCode) < Stop);
+ }
+ } // while not done
+}
+
+/**
+ Process the results of the early LPDDR3 CMD training and find the best PI settings for CmdS/CmdN/Cke.
+ Flow:
+ 1. Find the worst case Right and Left limits for each channel
+ 2. Find the Center for each channel
+
+ @param[in] MrcData - The MRC global data.
+ @param[in] LeftLimit - array of left edge values per channel, rank and CPU byte
+ @param[in] RightLimit - array of right edge values per channel, rank and CPU byte
+ @param[out] BestCs - array of best CMD PI settings, per channel
+
+ @retval mrcSuccess if succeeded
+**/
+MrcStatus
+FindBestCmdPi (
+ IN MrcParameters * const MrcData,
+ IN U8 LeftLimit[MAX_CHANNEL][MAX_RANK_IN_CHANNEL][MAX_SDRAM_IN_DIMM],
+ IN U8 RightLimit[MAX_CHANNEL][MAX_RANK_IN_CHANNEL][MAX_SDRAM_IN_DIMM],
+ OUT U8 BestCmd[MAX_CHANNEL][2] // per Channel and per group (CAA and CAB)
+ )
+{
+ MrcInput *Inputs;
+ MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcStatus Status;
+ MrcChannelIn *ChannelIn;
+ MrcControllerIn *ControllerIn;
+ U8 Channel;
+ U8 Rank;
+ U8 Byte;
+ U8 CaGroup;
+ U8 CmdLeftLimit[MAX_CHANNEL][2]; // Per ch and group
+ U8 CmdRightLimit[MAX_CHANNEL][2]; // Per ch and group
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerIn = &Inputs->Controller[0];
+
+ Status = mrcSuccess;
+
+ MrcOemMemorySet ((U8 *) CmdRightLimit, 127, sizeof (CmdRightLimit));
+ MrcOemMemorySet ((U8 *) CmdLeftLimit, 0, sizeof (CmdLeftLimit));
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Finding best CMD PIs:\n");
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!MrcChannelExist (Outputs, Channel)) {
+ continue;
+ }
+ ChannelIn = &ControllerIn->Channel[Channel];
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel: %d\t\tLeft\tRight\tCenter\n", Channel);
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if (!MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ continue;
+ }
+ //
+ // Find the worst case Right and Left limits for all ranks, for bytes from the particular CA group
+ //
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ //
+ // CmdS CAA goes to Bytes[3:0], CmdS CAB goes to Byte[7:4]
+ //
+ if ((1 << Byte) & ChannelIn->DQByteMap[MrcIterationCmdS][0]) {
+ CaGroup = 0;
+ } else {
+ CaGroup = 1;
+ }
+ CmdRightLimit[Channel][CaGroup] = MIN (CmdRightLimit[Channel][CaGroup], RightLimit[Channel][Rank][Byte]);
+ CmdLeftLimit[Channel][CaGroup] = MAX (CmdLeftLimit[Channel][CaGroup], LeftLimit[Channel][Rank][Byte]);
+ }
+ } // for Rank
+
+ //
+ // Find the Center for each group, worst case of all ranks
+ //
+ BestCmd[Channel][0] = (CmdRightLimit[Channel][0] + CmdLeftLimit[Channel][0]) / 2;
+ BestCmd[Channel][1] = (CmdRightLimit[Channel][1] + CmdLeftLimit[Channel][1]) / 2;
+
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "CA%c\t\t\t%d\t%d\t%d\n",
+ 'A',
+ CmdLeftLimit[Channel][0],
+ CmdRightLimit[Channel][0],
+ BestCmd[Channel][0]
+ );
+
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "CA%c\t\t\t%d\t%d\t%d\n",
+ 'B',
+ CmdLeftLimit[Channel][1],
+ CmdRightLimit[Channel][1],
+ BestCmd[Channel][1]
+ );
+ } // for Channel
+
+ return Status;
+}
+
+/**
+ Update DqMapCpu2Dram array
+
+ @param[in] MrcData - The MRC global data.
+ @param[in] Channel - the channel to work on
+ @param[in] Feedback - array of DATATRAINFEEDBACK values for all 8 bytes
+ @param[in] Bit - The DQ bit the should be set in each DRAM byte
+
+ @retval none
+**/
+void
+FillCA2DQMapResult (
+ IN OUT MrcParameters * const MrcData,
+ IN const U8 Channel,
+ IN const U8 Feedback[8],
+ IN const U8 Bit
+ )
+{
+ MrcInput *Inputs;
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcChannelOut *ChannelOut;
+ MrcControllerOut *ControllerOut;
+ MrcControllerIn *ControllerIn;
+ MrcChannelIn *ChannelIn;
+ U8 Byte;
+ U8 Temp;
+ U8 CpuBit;
+ S8 BitNumber;
+ BOOL BitFound;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerOut = &Outputs->Controller[0];
+ ControllerIn = &Inputs->Controller[0];
+
+ ChannelOut = &ControllerOut->Channel[Channel];
+ ChannelIn = &ControllerIn->Channel[Channel];
+
+ BitNumber = -1;
+
+ //
+ // Loop on CPU bytes
+ //
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ if (Feedback[Byte] == 0) {
+ continue;
+ }
+ Temp = Feedback[Byte];
+ BitNumber = 0;
+ CpuBit = 0;
+ BitFound = FALSE;
+ while (Temp > 0) {
+ if (Temp & 1) {
+ if (!BitFound) {
+ CpuBit = BitNumber;
+ BitFound = TRUE;
+ } else {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "Ch%d: ERROR: More than one DQ pin toggled while looking for DQ%d in Byte%d, Feedback=0x%X\n",
+ Channel,
+ Bit,
+ Byte,
+ Feedback[Byte]
+ );
+ break;
+ }
+ }
+ Temp >>= 1;
+ BitNumber++;
+ }
+ ChannelIn->DqMapCpu2Dram[Byte][CpuBit] = ChannelIn->DqsMapCpu2Dram[Byte] * 8 + Bit;
+ } // for Byte
+}
+
+/**
+ Rotate a given number left by a specified number of bits.
+
+ @param[in] Value - The input value
+ @param[in] BitLength - How many bits to rotate in the input value.
+ @param[in] RotateBy - Number of bits to rotate by.
+
+ @retval The rotated number
+**/
+U32
+RotateLeft (
+ IN const U32 Value,
+ IN const U8 BitLength, // should be >1 and <32, tested for 16
+ IN const U8 RotateBy
+ )
+{
+ U32 Mask;
+ U32 Lsb;
+ U32 Result;
+ U8 i;
+
+ Result = Value;
+ Mask = (1 << BitLength) - 1;
+
+ for (i = 0; i < RotateBy; i++) {
+ Lsb = 1 & (((Result) & (1 << (BitLength - 1))) >> (BitLength-1)); // The MSB value needs to move to LSB
+ Result = (Mask & (Result << 1)) | Lsb; // Shift Left once and add the new LSB
+ }
+
+ return Result;
+}
+
+/**
+ Calculate 3 Pattern Buffers values for the given CADB sequence.
+
+ @param[in] MrcData - The MRC global data.
+ @param[in] CadbSequence - CADB line numbers in the order of transmission.
+ Example: 0,1,0,0,...0 for DQ mapping, 0,0,2,1,1,0,0,...0 for CS training
+ @param[out] CadbPatternBuffers - Array of 3 Pattern Buffer values
+
+ @retval none
+**/
+void
+CalculateCadbPB (
+ IN MrcParameters * const MrcData,
+ IN const U8 CadbSequence[MRC_CADB_PB_LENGTH],
+ OUT U32 CadbPatternBuffers[3]
+ )
+{
+ MrcInput *Inputs;
+ MrcDebug *Debug;
+ U8 i;
+ U8 j;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+
+ MrcOemMemorySet ((U8 *) CadbPatternBuffers, 0, 3 * sizeof (CadbPatternBuffers[0]));
+
+ for (i = 0; i < MRC_CADB_PB_LENGTH; i++) {
+ for (j = 0; j < 3; j++) {
+ CadbPatternBuffers[j] = RotateLeft (CadbPatternBuffers[j], MRC_CADB_PB_LENGTH, 1) |
+ ((CadbSequence[i] & (1 << j)) >> j);
+ }
+ }
+
+ for (j = 0; j < 3; j++) {
+ CadbPatternBuffers[j] = RotateLeft (CadbPatternBuffers[j], MRC_CADB_PB_LENGTH, 1);
+ }
+}
+
+/**
+ Map CA to DQ Pins for CA training and MR4 bit swizzling settings for LPDDR.
+ Main flow:
+ Repeat for each of the 8 bits per DQ byte (total 8 iterations for both channels, for rank0 only):
+ Transmit single CA phase expected to appear on a known DQ pin
+ One CA phase per byte, 2 different CA phases for Even and Odd bytes in parallel
+ Locate the single DQ in each byte based on DATATRAINFEEDBACK
+ Report error if more than one DQ pin toggles
+ Report error if no active DQ pin found
+ Ignore Byte2 and Byte3 for x32 devices if they don't return feedback (only DQ[15:0] must return feedback per JEDEC)
+ Update the DQ mapping data structure.
+
+ Assumption: runs on stable and correct CLK, CS and CA PI settings (either guaranteed by design or pre-trained)
+
+ @param[in] MrcData - The MRC global data.
+
+ @retval mrcSuccess if succeeded
+**/
+MrcStatus
+MapCA2DQPins (
+ IN MrcParameters * const MrcData
+)
+{
+ MrcInput *Inputs;
+ MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerIn *ControllerIn;
+ MrcControllerOut *ControllerOut;
+ MrcChannelIn *ChannelIn;
+ MrcChannelOut *ChannelOut;
+ MrcStatus Status;
+ U8 Channel;
+ U8 Rank;
+ U8 Byte;
+ U8 DramByte;
+ U8 Bit;
+ DDRDATACH0_CR_DDRCRDATACONTROL0_STRUCT DdrCrDataControl0;
+ DDRDATA0CH0_CR_DDRCRDATACONTROL2_STRUCT DdrCrDataControl2;
+ U32 Offset;
+ U32 CaPattern;
+ U8 Feedback[8];
+ CADB_LINE CadbLinesDqMapping[] = {
+ { 0x000, 0x000, 0 },
+ { 0x001, 0x000, 1 }
+ };
+ U32 CadbPatternBuffers[3];
+ U8 CadbSequence[MRC_CADB_PB_LENGTH];
+#ifdef MRC_DEBUG_PRINT
+ U8 DramBit;
+ U8 i;
+#endif
+
+ Status = mrcSuccess;
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerIn = &Inputs->Controller[0];
+ ControllerOut = &Outputs->Controller[0];
+ Rank = 0;
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "MapCA2DQPins started\n");
+ if (ControllerOut->Channel[0].Dimm[dDIMM0].SdramWidth == 32) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "x32 DRAM devices - skipping Bytes 2,3 in each DRAM!\n");
+ }
+
+ MrcOemMemorySet (CadbSequence, 0, sizeof (CadbSequence));
+ CadbSequence[1] = 1; // The 2nd PB entry is the 2nd CADB line with active CS. The rest are 0.
+
+ //
+ // Calculate the Pattern Buffers values for the given CADB sequence
+ //
+ CalculateCadbPB (MrcData, CadbSequence, CadbPatternBuffers);
+
+ //
+ // Enable the following bits because we will use DATATRAINFEEDBACK to read back CA values on DQ pins:
+ // DataControl0.SenseampTrainingMode and ForceOdtOn
+ // DataControl2.ForceRxOn and ForceBiasOn
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!MrcRankInChannelExist (MrcData, 0, Channel)) {
+ continue;
+ }
+ ChannelOut = &ControllerOut->Channel[Channel];
+ MrcOemMemorySet (
+ (U8 *) (ControllerIn->Channel[Channel].DqMapCpu2Dram),
+ 0xFF,
+ sizeof (ControllerIn->Channel[0].DqMapCpu2Dram)
+ );
+
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ DdrCrDataControl2.Data = ChannelOut->DqControl2[Byte].Data;
+ DdrCrDataControl2.Bits.ForceBiasOn = 1;
+ DdrCrDataControl2.Bits.ForceRxOn = 1;
+ Offset = DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG +
+ ((DDRDATA0CH1_CR_DDRCRDATACONTROL2_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG) * Channel) +
+ ((DDRDATA1CH0_CR_DDRCRDATACONTROL2_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG) * Byte);
+ MrcWriteCR (MrcData, Offset, DdrCrDataControl2.Data);
+ }
+ DdrCrDataControl0.Data = ChannelOut->DqControl0.Data;
+ DdrCrDataControl0.Bits.ForceOdtOn = 1;
+ DdrCrDataControl0.Bits.SenseampTrainingMode = 1;
+ Offset = DDRDATACH0_CR_DDRCRDATACONTROL0_REG +
+ ((DDRDATACH1_CR_DDRCRDATACONTROL0_REG - DDRDATACH0_CR_DDRCRDATACONTROL0_REG) * Channel);
+ MrcWriteCrMulticast (MrcData, Offset, DdrCrDataControl0.Data);
+
+ //
+ // Put Rank 0 in CA training mode using MRW41.
+ //
+ Status = LpddrCommandTrainingMode (MrcData, 1 << Channel, 1 << Rank, CaTrainingMode41);
+ if (Status != mrcSuccess) {
+ return Status;
+ }
+ }
+
+ for (Bit = 0; Bit < MAX_BITS; Bit++) {
+ //
+ // Create CA patterns for high and low phases,
+ // such that only one DQ bit should toggle on each phase, per DRAM byte
+ //
+ CaPattern = (1 << (Bit / 2)) | (1 << (Bit / 2 + 5));
+ CadbLinesDqMapping[1].CaHigh = ((Bit % 2) == 0) ? CaPattern : 0;
+ CadbLinesDqMapping[1].CaLow = ((Bit % 2) == 1) ? CaPattern : 0;
+
+#ifdef MRC_DEBUG_PRINT
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nRunning Bit %d\n", Bit);
+ for (i = 0; i < sizeof (CadbLinesDqMapping) / sizeof (CadbLinesDqMapping[0]); i++) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\tCADB[%d] CaHigh=0x%03X\tCaLow=0x%03X\tCS=0x%03X\n",
+ i,
+ CadbLinesDqMapping[i].CaHigh,
+ CadbLinesDqMapping[i].CaLow,
+ CadbLinesDqMapping[i].ChipSelect
+ );
+ }
+#endif //MRC_DEBUG_PRINT
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!MrcRankInChannelExist (MrcData, 0, Channel)) {
+ continue;
+ }
+
+ SetupCaTrainingCadb (
+ MrcData,
+ Channel,
+ Rank,
+ CadbLinesDqMapping,
+ sizeof (CadbLinesDqMapping) / sizeof (CadbLinesDqMapping[0]),
+ CadbPatternBuffers[0],
+ CadbPatternBuffers[1],
+ CadbPatternBuffers[2]
+ );
+ }
+
+ //
+ // Run CADB pattern on both channels at the same time
+ //
+ ShortRunCADB (MrcData, 0x3);
+
+ //
+ // Get Results for all ch/bytes
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!MrcRankInChannelExist (MrcData, 0, Channel)) {
+ continue;
+ }
+ ChannelOut = &ControllerOut->Channel[Channel];
+ ChannelIn = &ControllerIn->Channel[Channel];
+
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ DramByte = ChannelIn->DqsMapCpu2Dram[Byte];
+ if (ChannelOut->Dimm[dDIMM0].SdramWidth == 32) {
+ if ((DramByte & 0x02) != 0) {
+ //
+ // Ignore upper 16 bits (in DRAM terms) on x32 devices in MRW41 feedback - DRAM bytes 2, 3, 6 and 7
+ //
+ Feedback[Byte] = 0;
+ continue;
+ }
+ }
+ Offset = DDRDATA0CH0_CR_DATATRAINFEEDBACK_REG +
+ ((DDRDATA0CH1_CR_DATATRAINFEEDBACK_REG - DDRDATA0CH0_CR_DATATRAINFEEDBACK_REG) * Channel) +
+ ((DDRDATA1CH0_CR_DATATRAINFEEDBACK_REG - DDRDATA0CH0_CR_DATATRAINFEEDBACK_REG) * Byte);
+ Feedback[Byte] = (U8) (MrcReadCR (MrcData, Offset) & 0xFF);
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\t Channel %d CPU Byte %d DRAM Byte %d => Feedback = %02X - %s feedback\n",
+ Channel,
+ Byte,
+ DramByte,
+ Feedback[Byte],
+ (MrcCountBitsEqOne (Feedback[Byte]) == 1) ? "Good" : "Bad"
+ );
+ } // for Byte
+ //
+ // Store results in ChannelIn->DqMapCpu2Dram
+ //
+ FillCA2DQMapResult (MrcData, Channel, Feedback, Bit);
+ } // for Channel
+ } // for Bit
+
+ //
+ // Exit CA training mode on rank 0 on both channels
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!MrcRankInChannelExist (MrcData, 0, Channel)) {
+ continue;
+ }
+ Status = LpddrCommandTrainingMode (MrcData, 1 << Channel, 1 << Rank, CaTrainingMode42);
+ if (Status != mrcSuccess) {
+ return Status;
+ }
+ }
+
+#ifdef MRC_DEBUG_PRINT
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!MrcRankInChannelExist (MrcData, 0, Channel)) {
+ continue;
+ }
+ ChannelOut = &ControllerOut->Channel[Channel];
+ ChannelIn = &ControllerIn->Channel[Channel];
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\nMapCA2DQPins Results for Ch%d (\"-1\" for skipped Bytes, DRAM DQ pins offsets):\n%s",
+ Channel,
+ "CPU Bit: \t[0]\t[1]\t[2]\t[3]\t[4]\t[5]\t[6]\t[7]\n"
+ );
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "CPU Byte%d:", Byte);
+ for (Bit = 0; Bit < MAX_BITS; Bit++) {
+ DramBit = ChannelIn->DqMapCpu2Dram[Byte][Bit];
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\t%d", (DramBit == 255) ? -1: DramBit);
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+ }
+ }
+#endif //MRC_DEBUG_PRINT
+
+ return Status;
+}
+
+/**
+ Sweep the given PI up or down and find the edge.
+
+ @param[in] MrcData - The MRC global data.
+ @param[in] Iteration - Determines which PI to shift
+ @param[in] ChannelMask - Valid Channel bit mask
+ @param[in] RankMask - Valid Rank bit mask
+ @param[in] Stop - End of the PI range
+ @param[in] Step - PI step for the sweep
+ @param[out] Limit - array of edge values (per channel), filled by this function
+ @param[in] DebugPrint - Print debug messages or not
+
+ @retval none
+**/
+void
+CaFindEdge (
+ IN MrcParameters * const MrcData,
+ IN U8 Iteration,
+ IN U8 ChannelMask,
+ IN U8 RankMask,
+ IN S16 Stop,
+ IN S16 Step,
+ OUT U8 Limit[MAX_CHANNEL],
+ IN BOOL DebugPrint
+ )
+{
+ MrcInput *Inputs;
+ MrcDebug *Debug;
+ MrcOutput *Outputs;
+ U8 Channel;
+ U8 ChannelBit;
+ U8 ChError;
+ U8 DumArr[7];
+ S16 PiOffset;
+ BOOL Pass;
+ BOOL Done;
+ BOOL ChannelDone[MAX_CHANNEL];
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+
+ PiOffset = 0;
+ Done = FALSE;
+ ChannelDone[0] = ChannelDone[1] = FALSE;
+ MrcOemMemorySet (DumArr, 1, sizeof (DumArr));
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, (DebugPrint) ? "\t0 1\n" : "");
+
+ while (!Done) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, (DebugPrint) ? "%d:\t" : "", PiOffset);
+ //
+ // Update Timing
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if ((1 << Channel) & ChannelMask) {
+ if (!ChannelDone[Channel]) {
+ ShiftPIforCmdTraining (MrcData, Channel, Iteration, RankMask, 3, PiOffset, 0);
+ }
+ }
+ }
+ //
+ // Reset DDR after changing the CLK PI
+ //
+ MrcResetSequence (MrcData);
+
+ //
+ // Run CPGC test on both channels
+ //
+ ChError = RunIOTest (MrcData, ChannelMask, Outputs->DQPat, DumArr, 1, 0);
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelBit = (1 << Channel);
+ if (((ChannelBit & ChannelMask) == 0) || (ChannelDone[Channel])) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, (DebugPrint && (Channel == 0)) ? " " : "");
+ continue;
+ }
+
+ Pass = !(ChError & ChannelBit);
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, (DebugPrint) ? (Pass ? ". " : "# ") : "");
+
+ if (Pass) {
+ Limit[Channel] = (U8) (ABS (PiOffset));
+ } else {
+ ChannelDone[Channel] = TRUE;
+ }
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, (DebugPrint) ? "\n" : "");
+
+ PiOffset += Step;
+ if (Step > 0) {
+ // Sweep up
+ Done = (PiOffset > Stop);
+ } else {
+ // Sweep down
+ Done = (PiOffset < Stop);
+ }
+
+ if (ChannelDone[0] && ChannelDone[1]) {
+ // Found the limit on both channels - no need to sweep PI any longer
+ Done = TRUE;
+ }
+ } // while not done
+}
+
+/**
+@brief
+ Sweep right and left from the current point to find the margins.
+
+ @param[in, out] MrcData - Include all MRC global data.
+ @param[in] Iteration - Determines which PI to shift
+ @param[in] ChannelMask - Valid Channel bit mask
+ @param[in] RankMask - Valid Rank bit mask
+ @param[in] DebugPrint - Print debug messages or not
+
+ @retval MrcStatus - If it succeeds return mrcSuccess
+**/
+void
+CmdLinearFindEdgesLpddr (
+ IN OUT MrcParameters *const MrcData,
+ IN U8 Iteration,
+ IN U8 ChannelMask,
+ IN U8 RankMask,
+ IN BOOL DebugPrint
+ )
+{
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ U8 Channel;
+ U8 Rank;
+ S16 PiLow;
+ S16 PiHigh;
+ S16 PiStep;
+ U8 RightLimit[MAX_CHANNEL];
+ U8 LeftLimit[MAX_CHANNEL];
+
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+
+ //
+ // We are going to sweep clock 32 PI ticks to the left and to the right
+ //
+ PiLow = -32;
+ PiHigh = 32;
+
+ PiStep = 1;
+
+ //
+ // Initialize to zero margin
+ //
+ MrcOemMemorySet ((U8 *) RightLimit, 0, sizeof (RightLimit));
+ MrcOemMemorySet ((U8 *) LeftLimit, 0, sizeof (LeftLimit));
+
+ //
+ // Find right and left margins
+ //
+ CaFindEdge (MrcData, Iteration, ChannelMask, RankMask, PiHigh, PiStep, RightLimit, DebugPrint);
+ CaFindEdge (MrcData, Iteration, ChannelMask, RankMask, PiLow, -PiStep, LeftLimit, DebugPrint);
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if ((1 << Channel) & ChannelMask) {
+ //
+ // Save margins for RMT
+ //
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if ((1 << Rank) & RankMask) {
+ Outputs->MarginResult[LastCmdT][Rank][Channel][0][0] = 10 * LeftLimit[Channel];
+ Outputs->MarginResult[LastCmdT][Rank][Channel][0][1] = 10 * RightLimit[Channel];
+ }
+ }
+ }
+ }
+}
+
+/**
+ Early CMD / CLK training for LPDDR.
+
+ @param[in] MrcData - The MRC global data.
+
+ @retval mrcSuccess if succeeded
+**/
+MrcStatus
+EarlyCaTraining (
+ IN MrcParameters * const MrcData
+ )
+{
+ MrcInput *Inputs;
+ MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerIn *ControllerIn;
+ MrcControllerOut *ControllerOut;
+ MrcChannelIn *ChannelIn;
+ MrcChannelOut *ChannelOut;
+ MrcStatus Status;
+ U8 Channel;
+ U8 Rank;
+ U8 RankBit;
+ U8 Byte;
+ U8 DramByte;
+ U8 RankMask;
+ U32 Offset;
+ U8 PiLow;
+ U8 PiHigh;
+ U8 PiMiddle;
+ U8 PiStep;
+ U8 RightLimit[MAX_CHANNEL][MAX_RANK_IN_CHANNEL][MAX_SDRAM_IN_DIMM];
+ U8 LeftLimit[MAX_CHANNEL][MAX_RANK_IN_CHANNEL][MAX_SDRAM_IN_DIMM];
+ U8 BestCmd[MAX_CHANNEL][2]; // per Channel and per group (CAA and CAB)
+ DDRDATACH0_CR_DDRCRDATACONTROL0_STRUCT DdrCrDataControl0;
+ DDRDATA0CH0_CR_DDRCRDATACONTROL2_STRUCT DdrCrDataControl2;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerIn = &Inputs->Controller[0];
+ ControllerOut = &Outputs->Controller[0];
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "EarlyCaTraining started\n");
+
+ Status = mrcSuccess;
+ RankMask = Outputs->ValidRankMask;
+
+ PiLow = 0;
+ PiHigh = 127;
+ PiMiddle = 96;
+ PiStep = 2;
+
+ MrcOemMemorySet ((U8 *) RightLimit, PiHigh, sizeof (RightLimit));
+ MrcOemMemorySet ((U8 *) LeftLimit, PiLow, sizeof (LeftLimit));
+
+ //
+ // Enable the following bits because we will use DATATRAINFEEDBACK to read back CA values on DQ pins:
+ // DataControl0.SenseampTrainingMode and ForceOdtOn
+ // DataControl2.ForceRxOn and ForceBiasOn
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!MrcChannelExist (Outputs, Channel)) {
+ continue;
+ }
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ DdrCrDataControl2.Data = ChannelOut->DqControl2[Byte].Data;
+ DdrCrDataControl2.Bits.ForceBiasOn = 1;
+ DdrCrDataControl2.Bits.ForceRxOn = 1;
+ Offset = DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG +
+ ((DDRDATA0CH1_CR_DDRCRDATACONTROL2_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG) * Channel) +
+ ((DDRDATA1CH0_CR_DDRCRDATACONTROL2_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG) * Byte);
+ MrcWriteCR (MrcData, Offset, DdrCrDataControl2.Data);
+ }
+ DdrCrDataControl0.Data = ChannelOut->DqControl0.Data;
+ DdrCrDataControl0.Bits.ForceOdtOn = 1;
+ DdrCrDataControl0.Bits.SenseampTrainingMode = 1;
+ Offset = DDRDATACH0_CR_DDRCRDATACONTROL0_REG +
+ ((DDRDATACH1_CR_DDRCRDATACONTROL0_REG - DDRDATACH0_CR_DDRCRDATACONTROL0_REG) * Channel);
+ MrcWriteCrMulticast (MrcData, Offset, DdrCrDataControl0.Data);
+ }
+
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) { // @todo Do we have to do this per rank, or rank 0 is enough ?
+ RankBit = 1 << Rank;
+ if ((RankBit & RankMask) == 0) {
+ continue;
+ }
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ continue;
+ }
+
+ //
+ // Put the current Rank in CA training mode using MRW41.
+ //
+ Status = LpddrCommandTrainingMode (MrcData, 1 << Channel, RankBit, CaTrainingMode41);
+ if (Status != mrcSuccess) {
+ return Status;
+ }
+
+ SetupCaTrainingCadb (
+ MrcData,
+ Channel,
+ Rank,
+ CadbLinesCs,
+ sizeof (CadbLinesCs) / sizeof (CadbLinesCs[0]),
+ 0x3000,
+ 0x4000,
+ 0x0000
+ );
+ } // for Channel
+
+ //
+ // Sweep CMD PI up and down from the middle, on both channels at the same time
+ //
+// Ca2DMargins (MrcData, Rank); // This is used for test
+ EarlyCaFindEdge (MrcData, Rank, PiMiddle, PiHigh, PiStep, RightLimit);
+ EarlyCaFindEdge (MrcData, Rank, PiMiddle, PiLow, -PiStep, LeftLimit);
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ continue;
+ }
+ ChannelIn = &ControllerIn->Channel[Channel];
+ ChannelOut = &ControllerOut->Channel[Channel];
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "CA training data Ch%d Rank%d\nCPU Byte\tLeft\tRight\n", Channel, Rank);
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ DramByte = ChannelIn->DqsMapCpu2Dram[Byte];
+ if (ChannelOut->Dimm[dDIMM0].SdramWidth == 32) {
+ if ((DramByte & 0x02) != 0) {
+ //
+ // Ignore upper 16 bits on x32 devices in MRW41 feedback - DRAM bytes 2, 3, 6 and 7
+ //
+ continue;
+ }
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d\t\t%d\t%d\n",
+ Byte, LeftLimit[Channel][Rank][Byte], RightLimit[Channel][Rank][Byte]);
+ }
+
+ //
+ // Put the CMD PI back to middle for MRW42 command
+ //
+ ShiftPIforCmdTraining (MrcData, Channel, MrcIterationCmdS, RankBit, 3, PiMiddle, 1);
+ ShiftPIforCmdTraining (MrcData, Channel, MrcIterationCke, RankBit, (1 << 0), PiMiddle, 1);
+ ShiftPIforCmdTraining (MrcData, Channel, MrcIterationCmdN, RankBit, (1 << 1), PiMiddle, 1);
+
+ //
+ // Exit CA training mode on the current rank
+ //
+ Status = LpddrCommandTrainingMode (MrcData, 1 << Channel, RankBit, CaTrainingMode42);
+ if (Status != mrcSuccess) {
+ return Status;
+ }
+ } // for Channel
+ } // for Rank
+
+ //
+ // Restore original DataControl0 and DataControl2 values
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!MrcChannelExist (Outputs, Channel)) {
+ continue;
+ }
+ ChannelOut = &ControllerOut->Channel[Channel];
+ Offset = DDRDATACH0_CR_DDRCRDATACONTROL0_REG +
+ ((DDRDATACH1_CR_DDRCRDATACONTROL0_REG - DDRDATACH0_CR_DDRCRDATACONTROL0_REG) * Channel);
+ MrcWriteCrMulticast (MrcData, Offset, ChannelOut->DqControl0.Data);
+
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ Offset = DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG +
+ ((DDRDATA0CH1_CR_DDRCRDATACONTROL2_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG) * Channel) +
+ ((DDRDATA1CH0_CR_DDRCRDATACONTROL2_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG) * Byte);
+ MrcWriteCR (MrcData, Offset, ChannelOut->DqControl2[Byte].Data);
+ }
+ }
+
+ //
+ // Select optimal CMD timings for both channels
+ //
+ FindBestCmdPi (MrcData, LeftLimit, RightLimit, BestCmd);
+
+ //
+ // Apply the new CmdN, CmdS and CKE command PI settings
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!MrcChannelExist (Outputs, Channel)) {
+ continue;
+ }
+ ChannelOut = &ControllerOut->Channel[Channel];
+
+ //
+ // CAA is controlled by CMDS.CmdPi0Code and CKE.CmdPi0Code
+ //
+ ShiftPIforCmdTraining (MrcData, Channel, MrcIterationCmdS, RankMask, (1 << 0), BestCmd[Channel][0], 1);
+ ShiftPIforCmdTraining (MrcData, Channel, MrcIterationCke, RankMask, (1 << 0), BestCmd[Channel][0], 1);
+
+ //
+ // CAB is controlled by CMDS.CmdPi1Code and CMDN.CmdPi1Code
+ //
+ ShiftPIforCmdTraining (MrcData, Channel, MrcIterationCmdS, RankMask, (1 << 1), BestCmd[Channel][1], 1);
+ ShiftPIforCmdTraining (MrcData, Channel, MrcIterationCmdN, RankMask, (1 << 1), BestCmd[Channel][1], 1);
+ } // for Channel
+
+ return Status;
+}
+
+/**
+ Early CA / CS training for LPDDR.
+ Main flow:
+ 1. Put DRAMs in CA training mode using MRW41.
+ 2. Run CS vs. CLK training.
+ 3. Map DQ pins according to the board swizzling.
+ 4. Run CA vs. CLK training.
+ 5. Select optimal CA timings for each CA bus per rank
+
+ @param[in] MrcData - The MRC global data.
+
+ @retval mrcSuccess if succeeded
+**/
+MrcStatus
+EarlyCommandTrainingLpddr (
+ IN MrcParameters * const MrcData
+)
+{
+ const MrcInput *Inputs;
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcStatus Status;
+ U8 ChannelBitMask;
+ U8 ValidRankMask;
+// DDRCMD_CR_DDRCRCMDPICODING_STRUCT DdrCrCmdPiCoding;
+
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerOut = &Outputs->Controller[0];
+
+ ValidRankMask = Outputs->ValidRankMask;
+ ChannelBitMask = Outputs->ValidChBitMask;
+ Status = mrcSuccess;
+
+// //
+// // Set initial Pi settings for CLK / CMD / CTL - done in MrcMcConfiguration
+// //
+// DdrCrCmdPiCoding.Data = 0;
+// DdrCrCmdPiCoding.Bits.CmdPi0Code = 96;
+// DdrCrCmdPiCoding.Bits.CmdPi1Code = 96;
+// MrcWriteCR (MrcData, DDRCMD_CR_DDRCRCMDPICODING_REG, DdrCrCmdPiCoding.Data);
+
+
+ //
+ // Run CPU-to-DRAM DQ Mapping - Run after 2D CS/CA and/or before CS training
+ //
+ Status = MapCA2DQPins (MrcData);
+ if (Status != mrcSuccess) {
+ return Status;
+ }
+
+ //
+ // Run CS vs. CLK training
+ //
+ Status = EarlyChipSelectTraining (MrcData);
+ if (Status != mrcSuccess) {
+ return Status;
+ }
+
+ //
+ // Run CA vs. CLK training
+ //
+ Status = EarlyCaTraining (MrcData);
+ if (Status != mrcSuccess) {
+ return Status;
+ }
+
+ //
+ // Program DESWIZZLE_HIGH/LOW registers
+ //
+ ProgramDeswizzleRegisters (MrcData);
+
+ //
+ // Set this flag so that MrcResetSequence() will include MrcJedecInitLpddr3() as well.
+ //
+ Outputs->LpddrEctDone = TRUE;
+
+ return Status;
+}
+
+/**
+ Sweep CS Pi up or down and find edges for all bytes.
+ Main flow:
+ 1.
+ 2.
+ 3.
+
+ @param[in] MrcData - The MRC global data.
+ @param[out] Limit - array of edge PI values per channel, rank and CPU byte
+
+ @retval none
+**/
+void
+ChipSelectFindEdge (
+ IN MrcParameters * const MrcData,
+ U8 Rank,
+ U8 Start,
+ U8 Stop,
+ S8 Step,
+ OUT U8 Limit[MAX_CHANNEL][MAX_RANK_IN_CHANNEL][MAX_SDRAM_IN_DIMM]
+ )
+{
+ MrcInput *Inputs;
+ MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerIn *ControllerIn;
+ MrcControllerOut *ControllerOut;
+ MrcChannelIn *ChannelIn;
+ MrcChannelOut *ChannelOut;
+ U8 Channel;
+ U8 ChannelMask;
+ U8 Byte;
+ U8 ByteMask;
+ U8 DramByte;
+ U8 ByteDoneMask[MAX_CHANNEL];
+ U8 PiCode;
+ U8 Feedback[MAX_CHANNEL][MAX_SDRAM_IN_DIMM];
+ U32 Pattern;
+ U32 DelayChipSelectCadb;
+ U32 Offset;
+ BOOL Done;
+ BOOL Failed;
+ char *BytesHeader;
+ char PassFail;
+ DDRDATA0CH0_CR_DATATRAINFEEDBACK_STRUCT DataTrainFeedback;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerIn = &Inputs->Controller[0];
+ ControllerOut = &Outputs->Controller[0];
+ ChannelMask = 0;
+
+ DelayChipSelectCadb = 1 * HPET_1US;
+
+ MrcOemMemorySet (ByteDoneMask, 0, sizeof (ByteDoneMask));
+
+ PiCode = Start;
+ Done = FALSE;
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\t Ch0 pattern 1\t\t\t Ch1 pattern 1\t\t Ch 0 pattern 2\t\t Ch 1 pattern 2\n");
+ BytesHeader = "0 1 2 3 4 5 6 7 ";
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "CTL PI\t %s%s%s%s\n", BytesHeader, BytesHeader, BytesHeader, BytesHeader);
+
+ while (!Done) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d:\t", PiCode);
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ continue;
+ }
+ ShiftPIforCmdTraining (MrcData, Channel, MrcIterationCtl, 1 << Rank, 1, PiCode, 0);
+ }
+
+ //
+ // Try two different paterns (0x2AA or 0x155), to see if the command is still decoded correctly
+ //
+ for (Pattern = 0; Pattern <= 1; Pattern++) {
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ continue;
+ }
+ ChannelMask |= (1 << Channel);
+ SetCadbPatternBuffers (MrcData, Channel, (Pattern == 0) ? 0x3000 : 0x7000, 0x4000, 0x0000);
+ }
+
+ //
+ // Run CADB pattern on selected channels at the same time
+ //
+ ShortRunCADB (MrcData, ChannelMask);
+ MrcWait (MrcData, DelayChipSelectCadb);
+
+ //
+ // Read and process the results
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ ByteDoneMask[Channel] = 0xFF;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " ");
+ continue;
+ }
+ if (ByteDoneMask[Channel] == 0xFF) { // All bytes failed on this channel, no need to sweep anymore
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " ");
+ continue;
+ }
+ ChannelIn = &ControllerIn->Channel[Channel];
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ ByteMask = (1 << Byte);
+ DramByte = ChannelIn->DqsMapCpu2Dram[Byte];
+ if (ChannelOut->Dimm[dDIMM0].SdramWidth == 32) {
+ if ((DramByte & 0x02) != 0) {
+ //
+ // Ignore upper 16 bits on x32 devices in MRW41 feedback - DRAM bytes 2, 3, 6 and 7
+ //
+ ByteDoneMask[Channel] |= ByteMask;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " ");
+ continue;
+ }
+ }
+ Offset = DDRDATA0CH0_CR_DATATRAINFEEDBACK_REG +
+ ((DDRDATA0CH1_CR_DATATRAINFEEDBACK_REG - DDRDATA0CH0_CR_DATATRAINFEEDBACK_REG) * Channel) +
+ ((DDRDATA1CH0_CR_DATATRAINFEEDBACK_REG - DDRDATA0CH0_CR_DATATRAINFEEDBACK_REG) * Byte);
+ DataTrainFeedback.Data = (MrcReadCR (MrcData, Offset) & 0xFF); // Get only DQ bits, not DQS
+ PassFail = '#';
+ if ((ByteDoneMask[Channel] & ByteMask) == 0) {
+ if (Pattern == 0) {
+ //
+ // First pattern
+ //
+ Feedback[Channel][Byte] = (U8) DataTrainFeedback.Data;
+ PassFail = ' ';
+ } else {
+ //
+ // Second Pattern
+ // If still read the same data, then DRAM was not able to decode the new command
+ //
+ Failed = FALSE;
+ if (Feedback[Channel][Byte] == (U8) DataTrainFeedback.Data) {
+ Failed = TRUE;
+ }
+ if (MrcCountBitsEqOne (DataTrainFeedback.Data) != 4) {
+ Failed = TRUE;
+ }
+ if (Failed) {
+ Limit[Channel][Rank][Byte] = PiCode;
+ ByteDoneMask[Channel] |= ByteMask;
+ } else {
+ PassFail = '.';
+ }
+ }
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%c%02X ", PassFail, DataTrainFeedback.Data);
+ } // for Byte
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " ");
+ } // for Channel
+ } // for Pattern
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+
+ if ((ByteDoneMask[0] == 0xFF) && (ByteDoneMask[1] == 0xFF)) {
+ // Found the limit on all bytes on both channels - no need to sweep Pi any longer
+ break;
+ }
+
+ PiCode += Step;
+ if (Step > 0) {
+ // Sweep up
+ Done = (PiCode > Stop);
+ } else {
+ // Sweep down
+ Done = (((S8) PiCode) < Stop);
+ }
+ } // while not done
+}
+
+/**
+ Process the results of the early LPDDR3 CS training and find the best PI settings for CS and CLK.
+ Flow:
+ 1. Find the worst case Right and Left limits for each group
+ 2. Find the Center for each group
+
+ @param[in] MrcData - The MRC global data.
+ @param[in] LeftLimit - array of left edge values per channel, rank and CPU byte
+ @param[in] RightLimit - array of right edge values per channel, rank and CPU byte
+ @param[out] BestCs - array of best CS PI settings, per channel and group
+ @param[out] BestClk - array of best CLK PI settings, per channel and group
+
+ @retval mrcSuccess if succeeded
+**/
+MrcStatus
+FindBestCsClkPi (
+ IN MrcParameters * const MrcData,
+ IN U8 LeftLimit[MAX_CHANNEL][MAX_RANK_IN_CHANNEL][MAX_SDRAM_IN_DIMM],
+ IN U8 RightLimit[MAX_CHANNEL][MAX_RANK_IN_CHANNEL][MAX_SDRAM_IN_DIMM],
+ OUT U8 BestCs[MAX_CHANNEL][2],
+ OUT U8 BestClk[MAX_CHANNEL][2]
+ )
+{
+ MrcInput *Inputs;
+ MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcChannelIn *ChannelIn;
+ MrcStatus Status;
+ U8 Channel;
+ U8 Rank;
+ U8 Byte;
+ U8 Group;
+ U8 Count;
+ U8 GroupLeftLimit[MAX_CHANNEL][MAX_RANK_IN_CHANNEL][2]; // Per ch, rank and group
+ U8 GroupRightLimit[MAX_CHANNEL][MAX_RANK_IN_CHANNEL][2]; // Per ch, rank and group
+ U8 GroupCenter[MAX_CHANNEL][MAX_RANK_IN_CHANNEL][2]; // Per ch, rank and group
+ S8 ClkDelta[MAX_RANK_IN_CHANNEL];
+ S8 MeanClkDelta;
+ S8 CsDelta[2]; // Per group
+ S8 MeanCsDelta;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+
+ Status = mrcSuccess;
+
+ MrcOemMemorySet ((U8 *) GroupRightLimit, 127, sizeof (GroupRightLimit));
+ MrcOemMemorySet ((U8 *) GroupLeftLimit, 0, sizeof (GroupLeftLimit));
+ MrcOemMemorySet ((U8 *) GroupCenter, 0, sizeof (GroupCenter));
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Finding best CS/CLK PIs:\n");
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!MrcChannelExist (Outputs, Channel)) {
+ continue;
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel: %d\tLeft\tRight\tCenter\n", Channel);
+ ChannelIn = &Inputs->Controller[0].Channel[Channel];
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if (!MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ continue;
+ }
+ for (Group = 0; Group < 2; Group++) {
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ //
+ // Find the worst case Right and Left limits for each group
+ //
+ if (ChannelIn->DQByteMap[MrcIterationClock][Group] & (1 << Byte)) {
+ if (GroupRightLimit[Channel][Rank][Group] > RightLimit[Channel][Rank][Byte]) {
+ GroupRightLimit[Channel][Rank][Group] = RightLimit[Channel][Rank][Byte];
+ }
+
+ if (GroupLeftLimit[Channel][Rank][Group] < LeftLimit[Channel][Rank][Byte]) {
+ GroupLeftLimit[Channel][Rank][Group] = LeftLimit[Channel][Rank][Byte];
+ }
+ }
+ } // for Byte
+
+ //
+ // Find the Center for each group
+ //
+ GroupCenter[Channel][Rank][Group] =
+ (GroupRightLimit[Channel][Rank][Group] + GroupLeftLimit[Channel][Rank][Group]) / 2;
+
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "Rank%d CLK%d\t%d\t%d\t%d\n",
+ Rank,
+ Group,
+ GroupLeftLimit[Channel][Rank][Group],
+ GroupRightLimit[Channel][Rank][Group],
+ GroupCenter[Channel][Rank][Group]
+ );
+ } // for Group
+ } // for Rank
+
+ //
+ // Find the CS delta between ranks for each clock group, and then group average
+ //
+ for (Count = 0, Group = 0; Group < 2; Group++) {
+ if (MrcRankInChannelExist (MrcData, 1, Channel)) {
+ CsDelta[Group] = (GroupCenter[Channel][1][Group] - GroupCenter[Channel][0][Group]);
+ Count++;
+ } else {
+ CsDelta[Group] = 0; // Single rank 0 case
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "CLK%d delta (Rank0-Rank1) = %d \n", Group, CsDelta[Group]);
+ }
+
+ MeanCsDelta = (Count != 0) ? (CsDelta[0] + CsDelta[1]) / Count : 0;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Mean CS delta = %d\n", MeanCsDelta);
+
+ //
+ // Find the Clock delta for each rank, and then average between ranks
+ // @todo Add case of single CLK group
+ //
+ for (Count = 0, Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if (MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ ClkDelta[Rank] = (GroupCenter[Channel][Rank][1] - GroupCenter[Channel][Rank][0]);
+ Count++;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Rank%d delta (CLK1-CLK0) = %d \n", Rank, ClkDelta[Rank]);
+ } else {
+ ClkDelta[Rank] = 0; // No such rank
+ }
+ }
+ MeanClkDelta = (Count != 0) ? (ClkDelta[0] + ClkDelta[1]) / Count : 0;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Mean Clock delta = %d\n", MeanClkDelta);
+
+ BestClk[Channel][0] = (U8) (64 - MeanClkDelta / 2); // CLK0
+ BestClk[Channel][1] = (U8) (BestClk[Channel][0] + MeanClkDelta); // CLK1
+
+ BestCs[Channel][0] = (GroupCenter[Channel][0][0] + GroupCenter[Channel][0][1]) / 2; // CS0
+ BestCs[Channel][1] = (GroupCenter[Channel][1][0] + GroupCenter[Channel][1][1]) / 2; // CS1
+
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "Best PI CLK0=%d, CLK1=%d, CS0=%d, CS1=%d\n",
+ BestClk[Channel][0],
+ BestClk[Channel][1],
+ BestCs[Channel][0],
+ BestCs[Channel][1]
+ );
+ } // for Channel
+
+ return Status;
+}
+
+/**
+ Early CS / CLK training for LPDDR.
+ Main flow:
+ 1. Setup CADB pattern for CS Training.
+ 2. Run CS vs. CLK training.
+ 3. Select optimal CS and CLK timings
+
+ @param[in] MrcData - The MRC global data.
+
+ @retval mrcSuccess if succeeded
+**/
+MrcStatus
+EarlyChipSelectTraining (
+ IN MrcParameters * const MrcData
+ )
+{
+ MrcInput *Inputs;
+ MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerIn *ControllerIn;
+ MrcControllerOut *ControllerOut;
+ MrcChannelIn *ChannelIn;
+ MrcChannelOut *ChannelOut;
+ MrcStatus Status;
+ BOOL ClockPiChanged;
+ U8 Channel;
+ U8 Rank;
+ U8 RankBit;
+ U8 Byte;
+ U8 DramByte;
+ U8 Group;
+ U8 RankMask;
+ U32 Offset;
+ S32 ClkDelta;
+ U8 PiLow;
+ U8 PiHigh;
+ U8 PiMiddle;
+ U8 PiStep;
+ U8 RightLimit[MAX_CHANNEL][MAX_RANK_IN_CHANNEL][MAX_SDRAM_IN_DIMM];
+ U8 LeftLimit[MAX_CHANNEL][MAX_RANK_IN_CHANNEL][MAX_SDRAM_IN_DIMM];
+ U8 BestCs[MAX_CHANNEL][2];
+ U8 BestClk[MAX_CHANNEL][2];
+ DDRDATACH0_CR_DDRCRDATACONTROL0_STRUCT DdrCrDataControl0;
+ DDRDATA0CH0_CR_DDRCRDATACONTROL2_STRUCT DdrCrDataControl2;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerIn = &Inputs->Controller[0];
+ ControllerOut = &Outputs->Controller[0];
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "EarlyChipSelectTraining started\n");
+
+ Status = mrcSuccess;
+ RankMask = Outputs->ValidRankMask;
+
+ PiLow = 0;
+ PiHigh = 127;
+ PiMiddle = 64;
+ PiStep = 2;
+
+ MrcOemMemorySet ((U8 *) RightLimit, PiHigh, sizeof (RightLimit));
+ MrcOemMemorySet ((U8 *) LeftLimit, PiLow, sizeof (LeftLimit));
+
+ //
+ // Enable the following bits because we will use DATATRAINFEEDBACK to read back CA values on DQ pins:
+ // DataControl0.SenseampTrainingMode and ForceOdtOn
+ // DataControl2.ForceRxOn and ForceBiasOn
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!MrcChannelExist (Outputs, Channel)) {
+ continue;
+ }
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ DdrCrDataControl2.Data = ChannelOut->DqControl2[Byte].Data;
+ DdrCrDataControl2.Bits.ForceBiasOn = 1;
+ DdrCrDataControl2.Bits.ForceRxOn = 1;
+ Offset = DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG +
+ ((DDRDATA0CH1_CR_DDRCRDATACONTROL2_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG) * Channel) +
+ ((DDRDATA1CH0_CR_DDRCRDATACONTROL2_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG) * Byte);
+ MrcWriteCR (MrcData, Offset, DdrCrDataControl2.Data);
+ }
+ DdrCrDataControl0.Data = ChannelOut->DqControl0.Data;
+ DdrCrDataControl0.Bits.ForceOdtOn = 1;
+ DdrCrDataControl0.Bits.SenseampTrainingMode = 1;
+ Offset = DDRDATACH0_CR_DDRCRDATACONTROL0_REG +
+ ((DDRDATACH1_CR_DDRCRDATACONTROL0_REG - DDRDATACH0_CR_DDRCRDATACONTROL0_REG) * Channel);
+ MrcWriteCrMulticast (MrcData, Offset, DdrCrDataControl0.Data);
+ }
+
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ RankBit = 1 << Rank;
+ if ((RankBit & RankMask) == 0) {
+ continue;
+ }
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ continue;
+ }
+
+ //
+ // Put the current Rank in CA training mode using MRW41.
+ //
+ Status = LpddrCommandTrainingMode (MrcData, 1 << Channel, RankBit, CaTrainingMode41);
+ if (Status != mrcSuccess) {
+ return Status;
+ }
+
+ SetupCaTrainingCadb (
+ MrcData,
+ Channel,
+ Rank,
+ CadbLinesCs,
+ sizeof (CadbLinesCs) / sizeof (CadbLinesCs[0]),
+ 0x3000,
+ 0x4000,
+ 0x0000
+ );
+ } // for Channel
+
+ //
+ // Sweep CS Pi up and down from the middle, on both channels at the same time
+ //
+ ChipSelectFindEdge (MrcData, Rank, PiMiddle, PiHigh, PiStep, RightLimit);
+ ChipSelectFindEdge (MrcData, Rank, PiMiddle, PiLow, -PiStep, LeftLimit);
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ continue;
+ }
+ ChannelIn = &ControllerIn->Channel[Channel];
+ ChannelOut = &ControllerOut->Channel[Channel];
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "CS training data Ch%d Rank%d\nCPU Byte\tLeft\tRight\n", Channel, Rank);
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ DramByte = ChannelIn->DqsMapCpu2Dram[Byte];
+ if (ChannelOut->Dimm[dDIMM0].SdramWidth == 32) {
+ if ((DramByte & 0x02) != 0) {
+ //
+ // Ignore upper 16 bits on x32 devices in MRW41 feedback - DRAM bytes 2, 3, 6 and 7
+ //
+ continue;
+ }
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d\t\t%d\t%d\n",
+ Byte, LeftLimit[Channel][Rank][Byte], RightLimit[Channel][Rank][Byte]);
+ }
+
+ //
+ // Put the CTL PI back to middle for MRW42 command
+ //
+ ShiftPIforCmdTraining (MrcData, Channel, MrcIterationCtl, 3, 1, PiMiddle, 1);
+
+ //
+ // Exit CA training mode on the current rank
+ //
+ Status = LpddrCommandTrainingMode (MrcData, 1 << Channel, RankBit, CaTrainingMode42);
+
+ if (Status != mrcSuccess) {
+ return Status;
+ }
+ } // for Channel
+ } // for Rank
+
+ //
+ // Restore original DataControl0 and DataControl2 values
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!MrcChannelExist (Outputs, Channel)) {
+ continue;
+ }
+ ChannelOut = &ControllerOut->Channel[Channel];
+ Offset = DDRDATACH0_CR_DDRCRDATACONTROL0_REG +
+ ((DDRDATACH1_CR_DDRCRDATACONTROL0_REG - DDRDATACH0_CR_DDRCRDATACONTROL0_REG) * Channel);
+ MrcWriteCrMulticast (MrcData, Offset, ChannelOut->DqControl0.Data);
+
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ Offset = DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG +
+ ((DDRDATA0CH1_CR_DDRCRDATACONTROL2_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG) * Channel) +
+ ((DDRDATA1CH0_CR_DDRCRDATACONTROL2_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG) * Byte);
+ MrcWriteCR (MrcData, Offset, ChannelOut->DqControl2[Byte].Data);
+ }
+ }
+
+ //
+ // Select optimal CS and CLK timings for both channels
+ //
+ FindBestCsClkPi (MrcData, LeftLimit, RightLimit, BestCs, BestClk);
+
+ //
+ // Apply the new CTL and CLK PI settings
+ //
+ ClockPiChanged = FALSE;
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!MrcChannelExist (Outputs, Channel)) {
+ continue;
+ }
+ ChannelIn = &ControllerIn->Channel[Channel];
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if (!MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ continue;
+ }
+ //
+ // Shift CS per rank
+ //
+ ShiftPIforCmdTraining (
+ MrcData,
+ Channel,
+ MrcIterationCtl,
+ 1 << Rank,
+ 1,
+ BestCs[Channel][Rank],
+ 1 // UpdateHost
+ );
+ }
+ for (Group = 0; Group < 2; Group++) {
+ //
+ // Shift CLK per group, if needed, and update host struct
+ //
+ ClkDelta = (S32) BestClk[Channel][Group] - (S32) ChannelOut->ClkPiCode[Group];
+ if (ClkDelta != 0) {
+ ClockPiChanged = TRUE;
+ ShiftPIforCmdTraining (MrcData, Channel, MrcIterationClock, RankMask, 1 << Group, ClkDelta, 1);
+
+ //
+ // Shift the corresponding CMD PI by the same amount as the CLK
+ //
+ if (ChannelIn->DQByteMap[MrcIterationClock][Group] == ChannelIn->DQByteMap[MrcIterationCmdS][0]) {
+ //
+ // CAA is controlled by CMDS.CmdPi0Code and CKE.CmdPi0Code
+ //
+ ShiftPIforCmdTraining (MrcData, Channel, MrcIterationCmdS, RankMask, (1 << 0),
+ ChannelOut->CmdsCmdPiCode[0] + ClkDelta, 1);
+ ShiftPIforCmdTraining (MrcData, Channel, MrcIterationCke, RankMask, (1 << 0),
+ ChannelOut->CkeCmdPiCode[0] + ClkDelta, 1);
+ }
+ if (ChannelIn->DQByteMap[MrcIterationClock][Group] == ChannelIn->DQByteMap[MrcIterationCmdS][1]) {
+ //
+ // CAB is controlled by CMDS.CmdPi1Code and CMDN.CmdPi1Code
+ //
+ ShiftPIforCmdTraining (MrcData, Channel, MrcIterationCmdS, RankMask, (1 << 1),
+ ChannelOut->CmdsCmdPiCode[1] + ClkDelta, 1);
+ ShiftPIforCmdTraining (MrcData, Channel, MrcIterationCmdN, RankMask, (1 << 1),
+ ChannelOut->CmdnCmdPiCode[1] + ClkDelta, 1);
+ }
+ }
+ }
+ } // for Channel
+
+ //
+ // Perform IO reset and JEDEC reset if clock PI was changed.
+ //
+ if (ClockPiChanged) {
+ MrcResetSequence (MrcData);
+ }
+
+ return Status;
+}
+
+////
+//// CA to DQ mapping during MRW41
+//// First index is rising edge (0) / falling edge (1)
+//// Second index is CA pin
+////
+//U8 CA2DQMapping[2][9] = {
+// { 0x00,0x02,0x04,0x06,0x10,0x08,0x0A,0x0C,0x0E },
+// { 0x01,0x03,0x05,0x07,0x11,0x09,0x0B,0x0D,0x0F }
+//};
+//
+///**
+//
+// Map byte to group for the given Iteration
+//
+// @param[in] MrcData - The MRC global data.
+// @param[in] Iteration
+// @param[in] Byte
+//
+// @retval Group
+//
+//**/
+//
+//U8
+//MapByte2Group (
+// MrcParameters * const MrcData,
+// U8 Iteration,
+// U8 Channel,
+// U8 Byte
+// )
+//{
+// MrcInput *Inputs;
+// MrcControllerIn *ControllerIn;
+// MrcChannelIn *ChannelIn;
+// U32 ByteMask;
+// U32 SafeIteration;
+// U8 Group;
+// U8 SafeGroup;
+// U8 TargetGroup;
+//
+// Inputs = &MrcData->SysIn.Inputs;
+// ControllerIn = &Inputs->Controller[0];
+// ChannelIn = &ControllerIn->Channel[Channel];
+//
+// SafeIteration = 2; // CmdS has a mapping for all bytes (uses CAA & CAB)
+// SafeGroup = 0; // This is not true for all iterations
+// TargetGroup = 0; // ex: CmdN and CKE only use one of the CAA/CAB buses
+// ByteMask = 0; // ex: Clk may or may not go to all bytes
+//
+// for (Group = 0; Group < 2; Group++) {
+// ByteMask |= ChannelIn->DQByteMap[Iteration][Group];
+// if (ChannelIn->DQByteMap[Iteration][Group] & (1 << Byte)) {
+// TargetGroup = Group;
+// }
+// if (ChannelIn->DQByteMap[SafeIteration][Group] & (1 << Byte)) {
+// SafeGroup = Group;
+// }
+// }
+//
+// if (ByteMask == 0xFF) {
+// return TargetGroup;
+// } else {
+// return SafeGroup;
+// }
+//}
+//
+///**
+//
+// Update the DRAM to CPU DQ mapping for a given byte based on CA training results.
+// DQMapping is from CPU to DRAM
+// Victim is the CA victim bit
+// ByteFB is an 8 bit value that we received back for a Walking 0 VA pattern
+// Diff is an 8 bit value with ones in the victim bit positions
+// Return 0 if everything made sense, otherwise returns (1<<Group) to indicate an error
+// In the case of an error, DQMapping is not updated
+//
+// @param[in] MrcData - The MRC global data.
+//
+// @retval 0 - if a valid mapping was found
+// @retval (1 << Group) - in case of error
+//
+//**/
+//U8
+//UpdateDQMapping (
+// IN OUT U8 DQMapping[64],
+// IN U8 Byte,
+// IN U8 ByteFeedback,
+// IN U8 Diff,
+// IN U8 Victim,
+// IN U8 Group
+// )
+//{
+// U32 BitsHigh;
+// U8 DramDQHigh;
+// U8 DramDQLow;
+// U8 CpuDQHigh;
+// U8 CpuDQLow;
+// U8 Bit;
+// U8 BitValue;
+//
+// if (Diff == 0) {
+// return 0; // No error to look at
+// }
+//
+// //
+// // Should never see an error with these victim lanes since their data returns with MRW 48
+// // This function is only used with data from MRW 41
+// if ((Victim == 4) || (Victim == 9)) {
+// return (1 << Group);
+// }
+//
+// //
+// // Walk through the bits with errors and figure out the mapping
+// //
+// BitsHigh = 0;
+// DramDQHigh = 0xFF;
+// DramDQLow = 0xFF;
+// CpuDQHigh = 0xFF;
+// CpuDQLow = 0xFF;
+//
+// for (Bit = 0; Bit < 8; Bit++) {
+// BitValue = 1 << Bit;
+// if ((Diff & BitValue) != 0) {
+// BitsHigh++; // Count number of mismatches. Should be exactly 2
+// if ((ByteFeedback & BitValue) != 0) { // 1 on Victim bit during WalkZero indicates low phase
+// CpuDQLow = Bit;
+// DramDQLow = CA2DQMapping[1][Victim] & 0xF;
+// } else { // 0 on Victim bit during WalkZero indicates high phase
+// CpuDQHigh = Bit;
+// DramDQHigh = CA2DQMapping[0][Victim] & 0xF;
+// }
+// }
+// }
+//
+// if ((BitsHigh == 2) && (CpuDQLow != 0xFF) && (CpuDQHigh != 0xFF)) {
+// //
+// // This is a valid feedback that makes sense
+// //
+// DQMapping[8 * Byte + CpuDQLow] = (Group << 4) + DramDQLow;
+// DQMapping[8 * Byte + CpuDQHigh] = (Group << 4) + DramDQHigh;
+// return 0;
+// }
+//
+// //
+// // This is not a valid feedback
+// //
+// return (1 << Group);
+//}
+//
+///**
+//
+// Find the DRAM to CPU DQ mapping based on CA training results.
+// DQMapping is from CPU to DRAM
+// ByteFB is an 8 bit value that we received back for a Walking 0 VA pattern
+//
+// @param[in] MrcData - The MRC global data.
+// @param[in] ByteFB - Array of Ch X Byte for WalkZero results (WalkOne will just be the inverse)
+// @param[in] DQMapping - Array of Ch x 64 bits for mapping X64 CPU to X16 DRAM
+// @param[in] X16Count - Array of Ch x Group that indicates how many X16 words are in a given ch/group
+// Usually this is either 0 or 2 (ie: 0 bits or 32 bits)
+// @param[in] ChError - Arrray of Ch with a bit mask indicating if this Ch/Group had an error
+//
+// @retval none
+//
+//**/
+//
+//void
+//FindECTCpu2DramMapping (
+// MrcParameters * const MrcData,
+// U8 ChBitMask,
+// U8 Iteration,
+// U8 ByteFB[MAX_CHANNEL][8][11],
+// IN OUT U8 DQMapping[MAX_CHANNEL][64],
+// IN U8 X16Count[MAX_CHANNEL][2],
+// OUT U8 ChError[MAX_CHANNEL],
+// BOOL UpdateDqMapping
+// )
+//{
+// MrcOutput *Outputs;
+// MrcChannelOut *ChannelOut;
+// MrcControllerOut *ControllerOut;
+// U8 Channel;
+// U8 Byte;
+// U8 Bit;
+// U8 Group;
+// U8 Victim;
+// U8 RefFB;
+// U8 Diff;
+// U8 DramDQ;
+// U8 CountMappings[2][16];
+//
+// Outputs = &MrcData->SysOut.Outputs;
+// ControllerOut = &Outputs->Controller[0];
+//
+// MrcOemMemorySet ((U8 *) CountMappings, 0, sizeof (CountMappings));
+//
+// for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+// if (!MrcChannelExist (Outputs, Channel)) {
+// continue;
+// }
+// if (((1 << Channel) & ChBitMask) == 0) {
+// continue;
+// }
+// ChannelOut = &ControllerOut->Channel[Channel];
+//
+// //
+// // Figure out mappings for all lanes by comparing different walking zero results.
+// // XOR the Victim=10 vs Victim=N results
+// // During Victim=10, all CA lanes drive 0101
+// // During Victim<10, all CA lanes drive 0101 except the victim, which drives 1010
+// // Use this and the mapping of CA2DQ lanes (JEDEC spec) to figure out the mapping.
+// //
+// for (Byte = 0; Byte < 8; ++Byte) {
+// RefFB = ByteFB[Channel][Byte][10]; // All lanes drive WalkZero Agg = 0101
+// Group = MapByte2Group (MrcData, Iteration, Channel, Byte); // Find Byte-to-Group mapping
+//
+// for (Victim = 0; Victim < 10; ++Victim) {
+// Diff = RefFB ^ ByteFB[Channel][Byte][Victim]; // XOR should produce either (0,2) diffs
+// ChError[Channel] |= UpdateDQMapping (DQMapping[Channel], Byte, ByteFB[Channel][Byte][Victim], Diff, Victim, Group);
+// }
+// }
+//
+// //
+// // Check results by making sure everybody is mapped exactly the right number of times.
+// // DQMapping defines the mapping from 64 CPU DQ lanes to 16 DRAM DQ lanes.
+// // As a result, we should see each DRAM DQ lane is listed exactly X16Count times.
+// //
+// for (Byte = 0; Byte < 8; ++Byte) {
+// for (Bit = 0; Bit < 8; ++Bit) {
+// DramDQ = DQMapping[Channel][8 * Byte + Bit] & 0xF;
+// Group = (DQMapping[Channel][8 * Byte + Bit] >> 4) & 1;
+// CountMappings[Group][DramDQ]++;
+// }
+// }
+//
+// for (Group = 0; Group < 2; ++Group) {
+// for (Bit = 0; Bit < 16; ++Bit) {
+// if (CountMappings[Group][Bit] != X16Count[Channel][Group]) {
+// ChError[Channel] |= (1 << Group);
+// }
+// }
+// }
+//
+// //
+// // Update the DQ Mapping in the host structure if needed
+// //
+// if (UpdateDqMapping && (ChError[Channel] == 0)) {
+// for (Byte = 0; Byte < 8; ++Byte) {
+// for (Bit = 0; Bit < 8; ++Bit) {
+// ChannelOut->DqMapCpu2Dram[Byte][Bit] = DQMapping[Channel][8 * Byte + Bit] & 0xF;
+// }
+// }
+// }
+// } // for Channel
+//}
+//
+///**
+//
+// Check if the CA training test is done (everybody has already failed) or we need to keep running
+//
+// @param[in] MrcData - The MRC global data.
+// @param[in] ChBitMask - channels to work on
+// @param[in] Iteration -
+// @param[in] ChError - Array of error values per channel, each element is a bitmask per group, '1' means error.
+//
+// @retval TRUE if the test is done, FALSE otherwise
+//
+//**/
+//BOOL
+//CADBLPDDR3TestIsDone (
+// IN MrcParameters * const MrcData,
+// IN U8 ChBitMask,
+// IN U8 Iteration,
+// IN U8 ChError[MAX_CHANNEL]
+// )
+//{
+// MrcInput *Inputs;
+// MrcControllerIn *ControllerIn;
+// MrcChannelIn *ChannelIn;
+// U8 Channel;
+// U8 Group;
+//
+// Inputs = &MrcData->SysIn.Inputs;
+// ControllerIn = &Inputs->Controller[0];
+//
+// for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+// if (((1 << Channel) & ChBitMask) == 0) {
+// continue;
+// }
+// ChannelIn = &ControllerIn->Channel[Channel];
+// for (Group = 0; Group < 2; ++Group) {
+// if ((ChannelIn->DQByteMap[Iteration][Group] > 0) && ((ChError[Channel] & (1 << Group)) == 0)) {
+// //
+// // Not done if at least 1 valid ch/group is still passing
+// //
+// return FALSE;
+// }
+// }
+// }
+//
+// //
+// // If we reach this point, we are done
+// //
+// return TRUE;
+//}
+//
+///**
+//
+// Programs the CADB to output either a WalkingOne or WalkingZero pattern on VictimBit.
+// Each CA[9:0] lane will toggle with a 1010 pattern but the Victim lane will be inverted.
+// For a WalkingOne pattern, CAHi[Vic] = 1 and CALo[Vic] = 0.
+// For a WalkingZero pattern, CAHi[Vic] = 0 and CALo[Vic] = 1.
+// (VictimBit == 10) is a special case where all CAHi/CALo lanes drive ~WalkOne/WalkOne
+//
+// Sets up 3 CADB lines that will be used to send out a CA pattern.
+//
+// Example for VictimBit = 0, WalkOne = 0:
+//
+// -----------------------
+// CADB Phase Phase CS
+// Line High Low
+// -----------------------
+// 0 0x000 0x000 Off // For delay between CA patterns
+// 1 0x3FE 0x001 On // CA pattern for rank 0
+// 2 0x3FE 0x001 On // CA pattern for rank 1
+//
+// The CS pattern uses Pattern Buffer and hence has 16 lines, with CS active for one line only.
+// This will send command every 16 DCLKs.
+//
+// Pattern Buffer details:
+// The line order is:
+// for rank 0: 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+// for rank 1: 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+//
+// 001 or 010
+// 000
+// 000
+// 000
+//
+// 000
+// 000
+// 000
+// 000
+//
+// 000
+// 000
+// 000
+// 000
+//
+// 000
+// 000
+// 000
+// 000
+// ----
+// 001 or 010 --> PB[0] = 0x0001 or 0x0000
+// 000 PB[1] = 0x0000 or 0x0001
+// 000 PB[2] = 0x0000
+// 000
+//
+// @param[in] MrcData - The MRC global data.
+// @param[in] ChBitMask - channels to work on
+// @param[in] VictimBit - The Victim bit
+// @param[in] WalkOne - '1': Use WalkinOne pattern, '0': use WalkingZero pattern.
+//
+// @retval TRUE if the test is done, FALSE otherwise
+//
+//**/
+//void
+//SetupCADBLPDDR3VaPattern (
+// IN MrcParameters * const MrcData,
+// IN U8 ChBitMask,
+// IN U8 VictimBit,
+// IN U8 WalkOne
+// )
+//{
+// /*
+// CADB_LINE CadbLinesCs[] = {
+// { 0x3FF, 0x3FF, 0 },
+// { 0x000, 0x000, 0 },
+// { 0x2AA, 0x2AA, 1 },
+// { 0x155, 0x155, 1 }
+// };
+//
+// SetupCaTrainingCadb (
+// MrcData,
+// Channel,
+// Rank,
+// CadbLinesCs,
+// sizeof (CadbLinesCs) / sizeof (CadbLinesCs[0]),
+// 0x9FFE,
+// 0x4000,
+// 0x0000
+// );
+// */
+//}
+//
+///**
+//
+// Runs through a VA test on all CH/Ranks for the current CMD PI timing.
+// Setups the test, walks though a walking one/zero pattern with each lane as a victim .
+// If UpdateDqMapping, it will also update host.ch[ch].DQMappingCpu2Dram
+// Returns a pass/fail based on Ch/Group in ChError
+//
+// Main flow:
+// 1.
+// 2.
+// 3.
+//
+// @param[in] MrcData - The MRC global data.
+// @param[in, out] ChError - Array of error values per channel, each element is a bitmask per group, '1' means error.
+//
+// @retval mrcSuccess if succeeded
+//
+//**/
+//MrcStatus
+//RunCADBLPDDR3VATest (
+// IN MrcParameters * const MrcData,
+// IN U8 ChBitMask,
+// IN U8 Ranks,
+// IN U8 Iteration,
+// IN OUT U8 ChError[MAX_CHANNEL],
+// IN BOOL UpdateDqMapping
+// )
+//{
+// MrcInput *Inputs;
+// MrcDebug *Debug;
+// MrcStatus Status;
+// MrcOutput *Outputs;
+// MrcControllerIn *ControllerIn;
+// MrcControllerOut *ControllerOut;
+// MrcChannelIn *ChannelIn;
+// MrcChannelOut *ChannelOut;
+// U32 Offset;
+// U8 Channel;
+// U8 Rank;
+// U8 Group;
+// U8 BytesPerGroup;
+// U8 WalkOne;
+// U8 VictimBit;
+// U8 ByteFB[MAX_CHANNEL][8][11];
+// U8 X16Count[MAX_CHANNEL][2]; // How many X16 words for each ch/group
+// U8 DQMapping[MAX_CHANNEL][64]; // Lower nibble is X64 CPU lane to X16 DRAM lanes
+// // (this does not unswizzle byte/words)
+// // Upper nibble is which group this X64 CPU lane belongs to (0 or 1)
+// DDRDATACH0_CR_DDRCRDATACONTROL0_STRUCT DdrCrDataControl0;
+//
+// Inputs = &MrcData->SysIn.Inputs;
+// Debug = &Inputs->Debug;
+// Outputs = &MrcData->SysOut.Outputs;
+// ControllerOut = &Outputs->Controller[0];
+// ControllerIn = &Inputs->Controller[0];
+//
+// MrcOemMemorySet ((U8 *) ChError, 0, sizeof (ChError));
+// MrcOemMemorySet ((U8 *) ByteFB, 0, sizeof (ByteFB));
+// MrcOemMemorySet ((U8 *) X16Count, 0, sizeof (X16Count));
+// MrcOemMemorySet ((U8 *) DQMapping, 0, sizeof (DQMapping));
+//
+// //
+// // Count number of ranks that are being tested
+// //
+// if (MrcCountBitsEqOne (Ranks) == 0) {
+// return mrcSuccess;
+// }
+//
+// //
+// // Count how many X16 devices are associated with each group
+// // This will be used to determine how many Ones/Zeros are set in each results
+// //
+// for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+// if (((1 << Channel) & ChBitMask) == 0) {
+// continue;
+// }
+// ChannelIn = &ControllerIn->Channel[Channel];
+// ChannelOut = &ControllerOut->Channel[Channel];
+// for (Group = 0; Group < 2; Group++) {
+// if (ChannelIn->DQByteMap[Iteration][Group] > 0) {
+// BytesPerGroup = MrcCountBitsEqOne(ChannelIn->DQByteMap[Iteration][Group]);
+// if ((BytesPerGroup & 1) != 0) {
+// MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "ERROR - Cannot have odd number of bytes per group\n");
+// return mrcFail;
+// }
+// X16Count[Channel][Group] = BytesPerGroup / 2;
+// }
+// }
+//
+// //
+// // Enable DataControl0.SenseampTrainingMode because we will use DATATRAINFEEDBACK to read back CA values on DQ pins.
+// // Also enable DataControl0.ForceOdtOn
+// //
+// DdrCrDataControl0.Data = ChannelOut->DqControl0;
+// DdrCrDataControl0.Bits.SenseampTrainingMode = 1;
+// DdrCrDataControl0.Bits.ForceOdtOn = 1;
+// Offset = DDRDATACH0_CR_DDRCRDATACONTROL0_REG +
+// ((DDRDATACH1_CR_DDRCRDATACONTROL0_REG - DDRDATACH0_CR_DDRCRDATACONTROL0_REG) * Channel);
+// MrcWriteCrMulticast (MrcData, Offset, DdrCrDataControl0.Data);
+// }
+//
+// //
+// // Put DRAM into MRW 41 CA Training mode
+// //
+// Status = LpddrCommandTrainingMode (MrcData, ChBitMask, Ranks, CaTrainingMode41);
+// if (Status != mrcSuccess) {
+// return Status;
+// }
+//
+// //
+// // Run associated VA tests for MRW 41 (16 out of 20 CA bits)
+// //
+// for (WalkOne = 0; WalkOne < 2; WalkOne++) {
+// for (VictimBit = 0; VictimBit < 11; VictimBit++) {
+// //
+// // Are we done ?
+// //
+// if (CADBLPDDR3TestIsDone (MrcData, ChBitMask, Iteration, ChError)) {
+// break;
+// }
+//
+// //
+// // Program VA pattern in the CADB
+// //
+// SetupCADBLPDDR3VaPattern (MrcData, ChBitMask, VictimBit, WalkOne);
+//
+// //
+// // Run test on 1 rank at a time and read out the results
+// //
+// for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+// if (!MrcRankInChannelExist (MrcData, Rank, Channel)) {
+// continue;
+// }
+// if ((Ranks & (1 << Rank)) == 0) {
+// continue;
+// }
+////@todo: IssueCADBLPDDR3CmdTest (MrcData, ChBitMask, 1 << Rank, 3); // Operation = 3
+//
+///* @todo: ReadECTLPDDR3Results (
+// MrcData,
+// ChBitMask,
+// Iteration,
+// WalkOne,
+// ByteFB,
+// VictimBit,
+// DQMapping,
+// TRUE, // Using MRW41
+// X16Count,
+// ChError
+// ); */
+// }
+// }
+// }
+//
+// //
+// // Figure out DQ Lane Mapping for later steps and to ensure this sampled good data
+// // If results do not match expectations, updates ChError appropriately
+// //
+// FindECTCpu2DramMapping (MrcData, ChBitMask, Iteration, ByteFB, DQMapping, X16Count, ChError, UpdateDqMapping);
+//
+// //
+// // Put DRAM into MRW 48 CA Training Mode
+// //
+// Status = LpddrCommandTrainingMode (MrcData, ChBitMask, Ranks, CaTrainingMode48);
+// if (Status != mrcSuccess) {
+// return Status;
+// }
+//
+// //
+// // Run associated VA tests for MRW 48 (4 out of 20 CA bits)
+// //
+// for (WalkOne = 0; WalkOne < 2; WalkOne++) {
+// for (VictimBit = 0; VictimBit < 11; VictimBit++) {
+// //
+// // Are we done ?
+// //
+// if (CADBLPDDR3TestIsDone (MrcData, ChBitMask, Iteration, ChError)) {
+// break;
+// }
+//
+// //
+// // Program VA pattern in the CADB
+// //
+// SetupCADBLPDDR3VaPattern (MrcData, ChBitMask, VictimBit, WalkOne);
+//
+// //
+// // Run test on 1 rank at a time and read out the results
+// //
+// for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+// if (!MrcRankInChannelExist (MrcData, Rank, Channel)) {
+// continue;
+// }
+// if ((Ranks & (1 << Rank)) == 0) {
+// continue;
+// }
+////@todo: IssueCADBLPDDR3CmdTest (MrcData, ChBitMask, 1 << Rank, 3); // Operation = 3
+//
+///* @todo: ReadECTLPDDR3Results (
+// MrcData,
+// ChBitMask,
+// Iteration,
+// WalkOne,
+// ByteFB,
+// VictimBit,
+// DQMapping,
+// FALSE, // Using MRW48
+// X16Count,
+// ChError
+// ); */
+// }
+// }
+// }
+//
+// //
+// // Exit CA training mode using MRW42
+// //
+// Status = LpddrCommandTrainingMode (MrcData, ChBitMask, Ranks, CaTrainingMode42);
+// if (Status != mrcSuccess) {
+// return Status;
+// }
+//
+// //
+// // Restore DataControl0
+// //
+// for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+// if (((1 << Channel) & ChBitMask) == 0) {
+// continue;
+// }
+// ChannelOut = &ControllerOut->Channel[Channel];
+// Offset = DDRDATACH0_CR_DDRCRDATACONTROL0_REG +
+// ((DDRDATACH1_CR_DDRCRDATACONTROL0_REG - DDRDATACH0_CR_DDRCRDATACONTROL0_REG) * Channel);
+// MrcWriteCrMulticast (MrcData, Offset, ChannelOut->DqControl0);
+// }
+// return Status;
+//}
+
+#endif // ULT_FLAG
+
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Services/MrcCommon.c b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Services/MrcCommon.c
new file mode 100644
index 0000000..9380989
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Services/MrcCommon.c
@@ -0,0 +1,8010 @@
+/** @file
+ This file include all the common tolls for the mrc algo
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+**/
+
+//
+// Include files
+//
+#include "MrcCommon.h"
+
+#ifdef MRC_DEBUG_PRINT
+const char CcdString[] = "Controller, Channel, Dimm";
+const char RcvEnDelayString[] = "RcvEnDelay";
+const char DqsDelayString[] = "DqsDelay";
+
+#endif
+
+/**
+ Return the rank mask in channel if rank exist exist.
+
+ @param[in] MrcData - Pointer to MRC global data.
+ @param[in] Channel - Channel to work on.
+ @param[in] Rank - Rank to check.
+
+ @retval Bit mask of Rank requested if the Rank exists in the system.
+**/
+U8
+MrcRankInChannelExist (
+ IN MrcParameters *const MrcData,
+ IN const U8 Rank,
+ IN const U8 Channel
+ )
+{
+ return (MRC_BIT0 << Rank) & MrcData->SysOut.Outputs.Controller[0].Channel[Channel].ValidRankBitMask;
+}
+
+/**
+ Return the number of ranks in specific dimm.
+
+ @param[in] MrcData - Pointer to MRC global data.
+ @param[in] Channel - Channel to work on.
+ @param[in] Dimm - Dimm in channel to return.
+
+ @retval The number of ranks in the dimm.
+**/
+U8
+MrcGetRankInDimm (
+ IN MrcParameters *const MrcData,
+ IN const U8 Dimm,
+ IN const U8 Channel
+ )
+{
+ return MrcData->SysOut.Outputs.Controller[0].Channel[Channel].Dimm[Dimm].RankInDIMM;
+}
+
+/**
+ Returns whether Channel is or is not present.
+
+ @param[in] Outputs - Pointer to MRC global Output data.
+ @param[in] Channel - Channel to test.
+
+ @retval TRUE - if there is at least one enabled DIMM in the channel.
+ @retval FALSE - if there are no enabled DIMMs in the channel.
+**/
+BOOL
+MrcChannelExist (
+ IN const MrcOutput *const Outputs,
+ IN const U8 Channel
+ )
+{
+
+ return (Outputs->Controller[0].Channel[Channel].Status == CHANNEL_PRESENT) ? TRUE : FALSE;
+}
+
+/**
+ This function disable channel parameters.
+ After this function the MRC don't use with the channel.
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] ChannelToDisable - Channel to disable.
+ @param[in] SkipDimmCapacity - Switch to skip setting the DimmCapacity to 0 for the dimms in the channel disabled.
+
+ @retval Nothing
+**/
+void
+MrcChannelDisable (
+ IN MrcParameters *const MrcData,
+ IN const U8 ChannelToDisable,
+ IN const U8 SkipDimmCapacity
+ )
+{
+ MrcChannelOut *ChannelOut;
+ MrcDimmOut *DimmOut;
+ U32 Dimm;
+
+ ChannelOut = &MrcData->SysOut.Outputs.Controller[0].Channel[ChannelToDisable];
+ if (ChannelOut->Status == CHANNEL_PRESENT) {
+ ChannelOut->Status = CHANNEL_DISABLED;
+ ChannelOut->RankInChannel = 0;
+ ChannelOut->ValidRankBitMask = 0;
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ if (DimmOut->Status == DIMM_PRESENT) {
+ DimmOut->Status = DIMM_DISABLED;
+ DimmOut->RankInDIMM = 0;
+ if (!SkipDimmCapacity) {
+ DimmOut->DimmCapacity = 0;
+ }
+ }
+ }
+ }
+}
+
+/**
+ Convert the given frequency and reference clock to a clock ratio.
+
+ @param[in] MrcData - Pointer to MRC global data.
+ @param[in] Frequency - The memory frequency.
+ @param[in] RefClk - The memory reference clock.
+ @param[in] BClk - The base system reference clock.
+
+ @retval Returns the memory clock ratio.
+**/
+MrcClockRatio
+MrcFrequencyToRatio (
+ IN MrcParameters *const MrcData,
+ IN const MrcFrequency Frequency,
+ IN const MrcRefClkSelect RefClk,
+ IN const MrcBClkRef BClk
+ )
+{
+ U64 Value;
+ U64 FreqValue;
+ U32 RefClkValue;
+ U32 BClkValue;
+
+ BClkValue = (BClk == 0) ? (BCLK_DEFAULT / 100000) : (BClk / 100000);
+ RefClkValue = (RefClk == MRC_REF_CLOCK_100) ? 200000 : 266667;
+ FreqValue = MrcOemMemoryMultiplyU64ByU32 (Frequency, 1000000000ULL);
+ Value = MrcOemMemoryDivideU64ByU64 (FreqValue, (RefClkValue * BClkValue));
+ Value = ((U32) Value + 500) / 1000;
+ return ((MrcClockRatio) Value);
+}
+
+/**
+ @brief
+ Convert the given ratio and reference clocks to a memory frequency.
+
+ @param[in] MrcData - Pointer to MRC global data.
+ @param[in] Ratio - The memory ratio.
+ @param[in] RefClk - The memory reference clock.
+ @param[in] BClk - The base system reference clock.
+
+ @retval Returns the memory frequency.
+**/
+MrcFrequency
+MrcRatioToFrequency (
+ IN MrcParameters *const MrcData,
+ IN const MrcClockRatio Ratio,
+ IN const MrcRefClkSelect RefClk,
+ IN const MrcBClkRef BClk
+ )
+{
+ U64 Value;
+ U32 BClkValue;
+ U32 RefClkValue;
+
+ BClkValue = (BClk == 0) ? BCLK_DEFAULT : BClk;
+ RefClkValue = (RefClk == MRC_REF_CLOCK_100) ? 200000000 : 266666667;
+ Value = MrcOemMemoryMultiplyU64ByU32 (RefClkValue, Ratio * BClkValue);
+ Value += 50000000000000ULL;
+ Value = MrcOemMemoryDivideU64ByU64 (Value, 100000000000000ULL);
+ return ((MrcFrequency) Value);
+}
+
+/**
+ Convert the given ratio and reference clocks to a memory clock.
+
+ @param[in] Ratio - The memory ratio.
+ @param[in] RefClk - The memory reference clock.
+ @param[in] BClk - The base system reference clock.
+
+ @retval Returns the memory clock in femtoseconds.
+**/
+U32
+MrcRatioToClock (
+ IN const MrcClockRatio Ratio,
+ IN const MrcRefClkSelect RefClk,
+ IN const MrcBClkRef BClk
+ )
+{
+ U32 BClkValue;
+ U32 RefClkValue;
+ U32 Factor;
+ U64 Value;
+
+ BClkValue = (BClk == 0) ? 100000000UL : BClk;
+ Factor = BClkValue / 100000UL;
+ RefClkValue = (RefClk == MRC_REF_CLOCK_100) ? 1000000000UL : 1333333333UL;
+ Value = MrcOemMemoryMultiplyU64ByU32 (Factor, RefClkValue);
+ Value = MrcOemMemoryMultiplyU64ByU32 (Value, Ratio);
+ return ((Value == 0) ? 0 : (U32) MrcOemMemoryDivideU64ByU64 (10000000000000000000ULL, Value));
+}
+
+/**
+ This function return the DIMM number according to the rank number.
+
+ @param[in] Rank - The requested rank.
+
+ @retval The DIMM number.
+**/
+U8
+MrcGetDimmFromRank (
+ IN const U8 Rank
+ )
+{
+ U8 Dimm;
+
+ if (Rank == rRank0 || Rank == rRank1) {
+ Dimm = dDIMM0;
+ } else {
+ Dimm = dDIMM1;
+ }
+
+ return Dimm;
+}
+
+/**
+ This function sets the memory frequency.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval mrcSuccess on success, mrcFrequencyError on error.
+**/
+MrcStatus
+McFrequencySet (
+ IN MrcParameters *const MrcData
+ )
+{
+ const MrcDebug *Debug;
+ const MrcInput *Inputs;
+ MrcOutput *Outputs;
+ MrcFrequency NewFrequency;
+ MrcClockRatio Ratio;
+ MrcRefClkSelect RefClk;
+ PCU_CR_MC_BIOS_REQ_PCU_STRUCT McBiosReq;
+ U32 MemoryClock;
+#ifdef MRC_DEBUG_PRINT
+ U8 Channel;
+#endif // MRC_DEBUG_PRINT
+ U32 Time;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ Debug = &Inputs->Debug;
+
+ NewFrequency = MrcGetCurrentMemoryFrequency (MrcData, &MemoryClock, &Ratio, &RefClk);
+ if (NewFrequency != fNoInit) {
+ Outputs->Frequency = NewFrequency;
+ Outputs->MemoryClock = MemoryClock;
+ Outputs->RefClk = RefClk;
+ Outputs->Ratio = Ratio;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_WARNING, "WARNING: Memory frequency is already initialized to %u\n", Outputs->Frequency);
+ return mrcSuccess;
+ }
+ //
+ // Set the reference clock, ratio and run_busy bit.
+ if (Outputs->BootMode == bmCold) {
+ if ((Inputs->MemoryProfile == USER_PROFILE) && (Inputs->Ratio > 0)) {
+ Outputs->Ratio = Inputs->Ratio;
+ } else {
+ Outputs->Ratio = MrcFrequencyToRatio (MrcData, Outputs->Frequency, Outputs->RefClk, Inputs->BClkFrequency);
+ }
+ }
+ if ((MEMORY_RATIO_MIN > Outputs->Ratio) || (MEMORY_RATIO_MAX < Outputs->Ratio)) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_ERROR,
+ "Invalid DDR ratio of %u specified, range %u - %u\n",
+ Outputs->Ratio,
+ MEMORY_RATIO_MIN,
+ MEMORY_RATIO_MAX
+ );
+ } else {
+ McBiosReq.Data = 0;
+ McBiosReq.Bits.REQ_DATA = Outputs->Ratio;
+ McBiosReq.Bits.REQ_TYPE = (Outputs->RefClk == MRC_REF_CLOCK_133) ? 0 : 1;
+ McBiosReq.Bits.RUN_BUSY = 1;
+ MrcWriteCR (MrcData, PCU_CR_MC_BIOS_REQ_PCU_REG, McBiosReq.Data);
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Attempting value = 0x%x - Pll busy wait ", McBiosReq.Data);
+ Time = 1000 * (U32) MrcGetCpuTime ();
+ while (McBiosReq.Bits.RUN_BUSY && (MrcGetCpuTime () < Time))
+ {
+ McBiosReq.Data = MrcReadCR (MrcData, PCU_CR_MC_BIOS_REQ_PCU_REG);
+ }
+
+ if (McBiosReq.Bits.RUN_BUSY) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "- NOT DONE. DDR frequency Update FAILED!\n");
+ return mrcFrequencyError;
+ } else
+ {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "- done\n");
+ }
+ //
+ // Wait on RCOMP Done. Needed to ensure Rcomp completes on warm reset/S3 before restoring dclk_enable.
+ //
+ if (CheckFirstRcompDone (MrcData) != mrcSuccess) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "RComp did not complete before the timeout in McFrequencySet\n");
+ return mrcDeviceBusy;
+ }
+
+#ifdef MRC_DEBUG_PRINT
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "Channel %u post PLL RCOMP REG = %Xh\n",
+ Channel,
+ MrcReadCR (
+ MrcData,
+ DDRCKECH0_CR_DDRCRCMDCOMP_REG + ((DDRCKECH1_CR_DDRCRCMDCOMP_REG - DDRCKECH0_CR_DDRCRCMDCOMP_REG) * Channel))
+ );
+ }
+#endif
+ Outputs->Frequency = MrcGetCurrentMemoryFrequency (MrcData, &MemoryClock, &Ratio, &RefClk);
+ MRC_DEBUG_MSG (
+ Debug,
+ (Ratio == Outputs->Ratio) ? MSG_LEVEL_NOTE : MSG_LEVEL_ERROR,
+ "Requested/actual ratio %u/%u, frequency is %u, BClk %uHz RefClk %uMHz, memory clock %u\n",
+ Outputs->Ratio,
+ Ratio,
+ Outputs->Frequency,
+ Inputs->BClkFrequency,
+ (RefClk == MRC_REF_CLOCK_133) ? 133 : 100,
+ MemoryClock);
+ if (Ratio == Outputs->Ratio) {
+ return mrcSuccess;
+ }
+ }
+ return mrcFrequencyError;
+}
+
+/**
+ Returns the extrapolated margin to a fixed # of errors (logT)
+ vrefpass is 10x the first passing margin (with no errors) (10x used for int math)
+ Errors at vrefpass/10+1 = log1
+ Errors at vrefpass/10+2 = logT
+
+ @param[in] vrefpass - 10x the first pass margin (w/no errors) (10x used for int match)
+ @param[in] errLog_1 - Errors at vrefpass/10+1
+ @param[in] errLog_2 - Errors at vrefpass/10+2
+ @param[in] errLog_Target - Error target determines extrapolation vs interpolation
+ @param[in, out] *berStats - Used to track interpolation vs extrapolation or if the slope is non-monotonic.
+ NOTE: target would be Interpolation only
+
+ @retval Interpolated/Extrapolated vref with the scale increased by 10.
+**/
+U32
+interpolateVref (
+ IN U32 vrefpass,
+ IN U32 errLog_1,
+ IN U32 errLog_2,
+ IN U32 errLog_Target,
+ IN OUT U32 *berStats
+ )
+{
+ U32 vref;
+ U32 slope;
+ U32 ErrLogDiff;
+
+ ErrLogDiff = errLog_2 - errLog_1;
+ if (errLog_2 <= errLog_1) {
+ berStats[3] += 1; // non-monotonic case
+ return (vrefpass * 10 + 10);
+ } else if (errLog_2 < errLog_Target) {
+ berStats[2] += 1; // error target above errLog_2 -> extrapolation
+ } else if (errLog_1 <= errLog_Target) {
+ berStats[1] += 1; // error target between errLog_1 and errLog_2 -> interpolation
+ } else {
+ berStats[0] += 1; // error target below errLog_1 -> extrapolation
+ }
+
+ //
+ //extrapolate above errLog_2, max extrapolation is 1 tick (10)
+ //
+ if (errLog_2 < errLog_Target) {
+ vref = vrefpass * 10 + 20 + MIN (10, (10 * (errLog_Target - errLog_2)) / (ErrLogDiff));
+ } else if ( (errLog_1 <= errLog_Target) && (errLog_Target <= errLog_2) && (ErrLogDiff != 0)) {
+ vref = vrefpass * 10 + 10 + (10 * (errLog_Target - errLog_1)) / (ErrLogDiff); //interpolate
+ } else {
+ //
+ //extrapolate below errLog_1
+ //
+ slope = (ErrLogDiff) > errLog_1 ? (ErrLogDiff) : errLog_1;
+ if (slope != 0) {
+ vref = vrefpass * 10 + (10 * errLog_Target) / slope;
+ } else {
+ vref = 0;
+ }
+ }
+
+ return vref; //returns a (vref * 10) interpolation/extrapolation
+};
+
+/**
+ This function swaps a subfield, within a 32 bit integer value with the specified value.
+
+ @param[in] CurrentValue - 32 bit input value.
+ @param[in] NewValue - 32 bit New value.
+ @param[in] Start - Subfield start bit.
+ @param[in] Length - Subfield length in bits/
+
+ @retval The updated 32 bit value.
+**/
+U32
+MrcBitSwap (
+ IN U32 CurrentValue,
+ IN const U32 NewValue,
+ IN const U8 Start,
+ IN const U8 Length
+ )
+{
+ U32 mask;
+
+ //
+ // Do bitwise replacement:
+ //
+ mask = (MRC_BIT0 << Length) - 1;
+ CurrentValue &= ~(mask << Start);
+ CurrentValue |= ((NewValue & mask) << Start);
+
+ return CurrentValue;
+}
+
+/**
+ This function returns the maximim Rx margin for a given Channel, Rank(s), and byte.
+
+ @param[in] MrcData - Pointer to MRC global data.
+ @param[in] Channel - Channel to calculate max Rx margin.
+ @param[in] RankRx - Rank index. 0xFF causes all ranks to be considered.
+ @param[in] byte - Byte to check.
+ @param[in] sign - Sign of the margins (0 - negative/min, 1 - positive/max).
+ @param[in] MaxMargin - Current max margin value.
+
+ @retval The max Rx margin, either MaxMargin or value from stored margins.
+**/
+U8
+MrcCalcMaxRxMargin (
+ IN MrcParameters *const MrcData,
+ IN const U8 Channel,
+ IN const U8 RankRx,
+ IN const U8 byte,
+ IN const U8 sign,
+ IN U8 MaxMargin
+ )
+{
+ MrcChannelOut *ChannelOut;
+ U8 RxDqsP;
+ U8 RxDqsN;
+ U8 Start;
+ U8 Stop;
+ U8 rank;
+
+ //
+ // Check for saturation on Rx Timing
+ //
+ if (RankRx == 0xFF) {
+ //
+ // If desired for all ranks
+ //
+ Start = 0; // Start in rank 0
+ Stop = 4; // Up to 4 ranks
+ } else {
+ Start = RankRx;
+ Stop = RankRx + 1;
+ }
+
+ ChannelOut = &MrcData->SysOut.Outputs.Controller[0].Channel[Channel];
+ for (rank = Start; rank < Stop; rank++) {
+ if (MrcRankInChannelExist (MrcData, rank, Channel)) {
+ RxDqsP = ChannelOut->RxDqsP[rank][byte];
+ RxDqsN = ChannelOut->RxDqsN[rank][byte];
+
+ if (sign == 0) {
+ if (MaxMargin > RxDqsP) {
+ MaxMargin = RxDqsP;
+ }
+
+ if (MaxMargin > RxDqsN) {
+ MaxMargin = RxDqsN;
+ }
+ } else {
+ if (MaxMargin > 63 - RxDqsP) {
+ MaxMargin = 63 - RxDqsP;
+ }
+
+ if (MaxMargin > 63 - RxDqsN) {
+ MaxMargin = 63 - RxDqsN;
+ }
+ }
+ }
+ }
+
+ return MaxMargin;
+}
+
+/**
+ This function determines if a bit lane[0-7] has seen a pass and a fail in each byte for all channels populated.
+
+ @param[in] MrcData - Pointer to MRC global data.
+ @param[in] chBitmask - Bit mask of channels to consider.
+ @param[in] OnePass - Array of Bit masks marking DQ lanes has had a passing value.
+ @param[in] OneFail - Array of Bit masks marking DQ lanes has had a failing value.
+
+ @retval The AND result of each Channel/byte for OnePass and OneFail.
+**/
+U8
+MrcAndBytes (
+ IN MrcParameters *const MrcData,
+ IN const U8 chBitmask,
+ IN U8 OnePass[MAX_CHANNEL][MAX_SDRAM_IN_DIMM],
+ IN U8 OneFail[MAX_CHANNEL][MAX_SDRAM_IN_DIMM]
+ )
+{
+ U8 Res;
+ U8 Channel;
+ U8 byte;
+
+ Res = 0xFF;
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (((MRC_BIT0 << Channel) & chBitmask) == 0) {
+ continue;
+ }
+
+ for (byte = 0; byte < MrcData->SysOut.Outputs.SdramCount; byte++) {
+ Res &= OnePass[Channel][byte];
+ Res &= OneFail[Channel][byte];
+ }
+ }
+
+ return Res;
+}
+
+/**
+ This function Finds the margin for all channels/all bits. The margin sweep is a parameterized
+ Assume REUT test has already been fully setup to run
+ This will unscale the results such that future tests start at the correct point
+ Uses ChangeMargin function to handle a variety cases (Timing, Voltage, Fan, etc.)
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] chBitMask - Channel BIT mask for Channel(s) to work on
+ @param[in] Rank - Rank to work on
+ @param[in,out] marginbit - used as the return data ( real margin measurement, no 10x)
+ marginbit[ch,byte,bit,sign] = abs(Margin)
+ Note: If param == RdTBit/RdVBit/WrVBit, marginbit is also the starting point
+ @param[in,out] marginbyte - provides the starting point on a per byte basis (still 10x)
+ @param[in] param - defines the margin type
+ @param[in] mode - allows for different types of modes for margining
+ {Bit0: PhLock (keep all bytes within in ch in phase),
+ Bit1: Ch2Ch Data out of phase (LFSR seed)
+ Bits 15:2: Reserved}
+ @param[in] MaxMargin - Default Maximum margin
+
+ @retval mrcSuccess if successful, otherwise it returns an error status.
+**/
+MrcStatus
+MrcGetMarginBit (
+ IN MrcParameters *const MrcData,
+ IN U8 chBitMask,
+ IN U8 Rank,
+ IN OUT U32 marginbit[MAX_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_BITS][MAX_EDGES],
+ IN OUT U32 marginbyte[MAX_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_EDGES],
+ IN U8 param,
+ IN U16 mode,
+ IN U8 MaxMargin
+ )
+{
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcStatus Status;
+ U8 Channel;
+ U8 Byte;
+ U8 bit;
+ U8 sign;
+ S8 realSign;
+ U8 pbyte;
+ BOOL PerCh;
+ U8 PerBit;
+ U8 SeqLC[4];
+ U8 Points2D;
+ U8 DoneMask;
+ U8 ByteMax;
+ U8 SkipWait;
+ U8 chPass;
+ U8 chFail;
+ U8 NoECC;
+ U8 AllFail;
+ // Set to 1 after ch/byte/bit has a passing point
+ U8 OnePass[MAX_CHANNEL][MAX_SDRAM_IN_DIMM];
+ // Set to 1 after ch/byte/bit has a failing point
+ U8 OneFail[MAX_CHANNEL][MAX_SDRAM_IN_DIMM];
+ U8 ErrByte;
+ U8 ErrECC;
+ U32 ErrLower;
+ U32 ErrUpper;
+ U8 MinMargin;
+ U32 value0;
+ U32 value1;
+ U32 v0;
+ U32 CMargin[MAX_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_BITS]; // Current Margin Point Testing
+ U32 ABMargin[MAX_CHANNEL][MAX_SDRAM_IN_DIMM]; // Average Byte Margin
+ U32 MinTested[MAX_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_BITS]; // Min Margin Point Tested
+ U8 PrintPetByte;
+ S8 RdTAdjust;
+ U32 Offset;
+ U32 BitTimePerBit;
+ U8 BitMask;
+ MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_STRUCT ReutGlobalCtl;
+
+ Status = mrcSuccess;
+ SkipWait = 0;
+ NoECC = 0;
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+
+ //
+ // Define Constants
+ //
+ ByteMax = MaxMargin;
+
+ //
+ // Define the correct loopcount for test
+ //
+ if (Outputs->DQPat == SegmentWDB) {
+ SeqLC[0] = Outputs->DQPatLC;
+ SeqLC[1] = Outputs->DQPatLC;
+ SeqLC[2] = Outputs->DQPatLC + 4;
+ SeqLC[3] = Outputs->DQPatLC + 2;
+ } else {
+ SeqLC[0] = 1;
+ SeqLC[1] = 1;
+ SeqLC[2] = 1;
+ SeqLC[3] = 1;
+ }
+ //
+ // How many points to test
+ //
+ Points2D = 1 + (param / 16);
+
+ //
+ // Define PerByte param for PerBit cases
+ //
+ if (param == RdTBit) {
+ pbyte = RdT;
+ PerBit = 1;
+ } else if (param == WrTBit) {
+ pbyte = WrT;
+ PerBit = 1;
+ } else if (param == RdVBit) {
+ pbyte = RdV;
+ PerBit = 1;
+ } else {
+ pbyte = 0;
+ PerBit = 0;
+ }
+ //
+ // Print results PerBit or PerByte
+ //
+ PrintPetByte = (param == RdT || param == WrT || param == RdV);
+ //
+ // Created for debug purpose
+ // Are we using DIMM Vref? If so, need to use the same Vref across all bytes
+ //
+ PerCh = ((param == WrFan2) || (param == WrFan3) || (param == WrV) || (mode & 0x1)) && (PerBit == 0);
+
+ //
+ // Get Average Byte back to real margin numbers
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (chBitMask & (MRC_BIT0 << Channel)) {
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ ABMargin[Channel][Byte] = (marginbyte[Channel][Byte][0] + marginbyte[Channel][Byte][1]) / 20;
+ }
+ }
+ }
+ //
+ // Find Left and Right Edges
+ //
+ for (sign = 0; sign < 2; sign++) {
+ realSign = (S8) ((2 * sign) - 1);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n+--MrcGetMarginBit, rsign = %d\n", realSign);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, (PrintPetByte) ? "\nMargin\tBits\n" : "");
+
+ //
+ // Initialize variables
+ //
+ DoneMask = 0xFF;
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!(chBitMask & (MRC_BIT0 << Channel))) {
+ continue; // This channel is not populated
+ }
+
+ MinMargin = 0x7F; // Start with a huge unsigned number
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ //
+ // Init arrays to 0
+ //
+ OnePass[Channel][Byte] = OneFail[Channel][Byte] = 0;
+
+ //
+ // Find MaxMargin for this byte
+ //
+ ByteMax = MaxMargin;
+ if (param == RdT) {
+ ByteMax = MrcCalcMaxRxMargin (MrcData, Channel, Rank, Byte, sign, MaxMargin);
+ }
+
+ CMargin[Channel][Byte][0] = ABMargin[Channel][Byte] - 2; //start from a definite pass for all bytes/bits
+
+ if ((param == RdTBit) || (param == WrTBit)) {
+ // Special case for PerBit Timing
+ v0 = realSign * (CMargin[Channel][Byte][0] + 0); // Push into failing region
+ Status = ChangeMargin (MrcData, pbyte, v0, 0, 0, Channel, Rank, Byte, 0, 0, 0, MrcRegFileStart);
+ } else if (param == RdVBit) {
+ // Special case for PerBit Voltage
+ v0 = realSign * (CMargin[Channel][Byte][0] + 4); // Push into failing region
+ Status = ChangeMargin (MrcData, pbyte, v0, 0, 0, Channel, Rank, Byte, 0, 0, 0, MrcRegFileStart);
+ }
+ //
+ // Update the variables for PerBit tracking
+ //
+ if (PerBit) {
+ for (bit = 0; bit < MAX_BITS; bit++) {
+ CMargin[Channel][Byte][bit] = marginbit[Channel][Byte][bit][sign];
+ //
+ // Double check saturation limits
+ //
+ if (CMargin[Channel][Byte][bit] > MaxMargin) {
+ CMargin[Channel][Byte][bit] = MaxMargin;
+ }
+ }
+ }
+ //
+ // Find MinMargin to start and set marginbyte for the PerCh case
+ //
+ if (PerCh) {
+ if (CMargin[Channel][Byte][0] < MinMargin) {
+ MinMargin = (U8) CMargin[Channel][Byte][0];
+ }
+
+ CMargin[Channel][Byte][0] = MinMargin;
+ }
+
+ for (bit = 0; bit < MAX_BITS; bit++) {
+ MinTested[Channel][Byte][bit] = CMargin[Channel][Byte][bit * PerBit];
+ marginbit[Channel][Byte][bit][sign] = CMargin[Channel][Byte][bit * PerBit];
+ }
+ }
+ } // END OF CHANNEL LOOP
+
+ //##########################################################
+ // Search algorithm:
+ // Walk up until everybody fails. Then Walk down until everybody passes.
+ //##########################################################
+ while (MrcAndBytes (MrcData, chBitMask, OnePass, OneFail) != DoneMask) {
+ //
+ // Walk through all 2D points
+ ReutGlobalCtl.Data = 0;
+ ReutGlobalCtl.Bits.Global_Clear_Errors = 1;
+ MrcWriteCR8 (MrcData, MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_REG, (U8) ReutGlobalCtl.Data); // Clear errors
+ for (value1 = 0; value1 < Points2D; value1++) {
+ //
+ // Set Margin level
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!(chBitMask & (MRC_BIT0 << Channel))) {
+ continue;
+ }
+
+ SkipWait = (chBitMask >> (Channel + 1)); // Skip if there are more channels
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ if (PerBit) {
+ value0 = 0;
+ for (bit = 0; bit < MAX_BITS; bit++) {
+ //
+ // Per Bit Deskew. Note: When (sign==1), then CMargin is off by 1.
+ // Suppose RdTBit and Right/Left Edge Last Pass @ CMargin = 12, 9
+ // Real Right Edge = (15-12)=3, Right Edge Moved By (8-3)=5
+ // Real Left Edge = 9, Left Edge Moved By (9-8) =1
+ // Center Movement = (5-1)/2 = +2
+ // To get correct answer, need to add +1 to CMargin for Right Edge
+ // ie: Center Moverment = (12+1-9)/2 = +2
+ // This error will be corrected at the edge of the function
+ // For RdTBit we shift data not strobe.Since we shift the opposite signal, sign is inverted
+ //
+ if ((param == RdTBit && sign) || ((param != RdTBit) && (sign == 0))) {
+ v0 = (MaxMargin - CMargin[Channel][Byte][bit]);
+ } else {
+ v0 = CMargin[Channel][Byte][bit];
+ }
+
+ if (v0 > MaxMargin) {
+ v0 = MaxMargin;
+ }
+ value0 |= (v0 << (4 * bit));
+ }
+ } else {
+ value0 = realSign * CMargin[Channel][Byte][0];
+ }
+ //
+ // EnMultiCast=0, ch,rank,byte,0, UpdateHost=0, SkipWait
+ //
+ Status = ChangeMargin (
+ MrcData,
+ param,
+ value0,
+ value1,
+ 0,
+ Channel,
+ Rank,
+ Byte,
+ 0,
+ 0,
+ SkipWait,
+ MrcRegFileStart
+ );
+ }
+ }
+ //
+ // Run Test
+ //
+ RunIOTest (MrcData, chBitMask, Outputs->DQPat, SeqLC, (value1 == 0), mode);
+
+ //
+ // Check if we have already failed and can stop running
+ //
+ if (value1 < (U32) (Points2D - 1)) {
+ AllFail = 1;
+ NoECC = (Outputs->EccSupport == FALSE);
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!(chBitMask & (MRC_BIT0 << Channel))) {
+ continue;
+ }
+ Offset = MCHBAR_CH0_CR_REUT_CH_ERR_DATA_STATUS_REG +
+ (Channel * (MCHBAR_CH1_CR_REUT_CH_ERR_DATA_STATUS_REG - MCHBAR_CH0_CR_REUT_CH_ERR_DATA_STATUS_REG));
+ AllFail &= (MrcReadCR (MrcData, Offset) == 0xFFFFFFFF);
+ AllFail &= (MrcReadCR (MrcData, Offset + 4) == 0xFFFFFFFF);
+ Offset = MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_REG +
+ (
+ Channel *
+ (
+ MCHBAR_CH1_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_REG -
+ MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_REG
+ )
+ );
+ AllFail &= (NoECC || ((U8) MrcReadCR (MrcData, Offset) == 0xFF));
+ }
+
+ if (AllFail) {
+ break; // break if any error
+ }
+ }
+ }
+ //
+ // Collect results and Update variables for next point to test
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!(chBitMask & (MRC_BIT0 << Channel))) {
+ continue;
+ }
+
+ // Read Error Results (Assume all reads are 32 bit access
+ Offset = MCHBAR_CH0_CR_REUT_CH_ERR_DATA_STATUS_REG +
+ (Channel * (MCHBAR_CH1_CR_REUT_CH_ERR_DATA_STATUS_REG - MCHBAR_CH0_CR_REUT_CH_ERR_DATA_STATUS_REG));
+ ErrLower = MrcReadCR (MrcData, Offset); // Lower 32 bits
+ ErrUpper = MrcReadCR (MrcData, Offset + 4); // Upper 32 bits
+ Offset = MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_REG +
+ (
+ Channel *
+ (
+ MCHBAR_CH1_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_REG -
+ MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_REG
+ )
+ );
+ ErrECC = (U8) MrcReadCR (MrcData, Offset);
+
+ chPass = 0xFF;
+ chFail = 0xFF;
+
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ //
+ // Extract Errors
+ //
+ if (Byte < 4) {
+ ErrByte = (U8) (ErrLower >> (8 * Byte));
+ } else if (Byte < 8) {
+ ErrByte = (U8) (ErrUpper >> (8 * (Byte - 4)));
+ } else {
+ ErrByte = ErrECC;
+ }
+
+ ErrByte &= DoneMask;
+#ifdef MRC_DEBUG_PRINT
+ if (param == WrTBit) {
+ Offset = DDRDATA0CH0_CR_TXPERBITRANK0_REG +
+ ((DDRDATA0CH1_CR_TXPERBITRANK0_REG - DDRDATA0CH0_CR_TXPERBITRANK0_REG) * Channel) +
+ ((DDRDATA0CH0_CR_TXPERBITRANK1_REG - DDRDATA0CH0_CR_TXPERBITRANK0_REG) * Rank)+
+ ((DDRDATA1CH0_CR_TXPERBITRANK0_REG - DDRDATA0CH0_CR_TXPERBITRANK0_REG) * Byte);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "0x%08X", MrcReadCR (MrcData, Offset));
+ } else if (param == RdTBit) {
+ Offset = DDRDATA0CH0_CR_RXPERBITRANK0_REG +
+ ((DDRDATA0CH1_CR_RXPERBITRANK0_REG - DDRDATA0CH0_CR_RXPERBITRANK0_REG) * Channel) +
+ ((DDRDATA0CH0_CR_RXPERBITRANK1_REG - DDRDATA0CH0_CR_RXPERBITRANK0_REG) * Rank)+
+ ((DDRDATA1CH0_CR_RXPERBITRANK0_REG - DDRDATA0CH0_CR_RXPERBITRANK0_REG) * Byte);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "0x%08X", MrcReadCR (MrcData, Offset));
+ } else if (param == RdVBit) {
+ Offset = DDRDATA0CH0_CR_RXOFFSETVDQ_REG +
+ ((DDRDATA0CH1_CR_RXOFFSETVDQ_REG - DDRDATA0CH0_CR_RXOFFSETVDQ_REG) * Channel) +
+ ((DDRDATA1CH0_CR_RXOFFSETVDQ_REG - DDRDATA0CH0_CR_RXOFFSETVDQ_REG) * Byte);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "0x%08X", MrcReadCR (MrcData, Offset));
+ } else if (param == WrT || param == RdT || param == RdV) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "% 2d", CMargin[Channel][Byte][0]);
+ }
+#endif // MRC_DEBUG_PRINT
+
+ for (bit = 0; bit < MAX_BITS; bit++) {
+ BitMask = MRC_BIT0 << bit;
+ BitTimePerBit = bit * PerBit;
+ //
+ // Skip if this Bit Group is done
+ //
+ if (OnePass[Channel][Byte] & OneFail[Channel][Byte] & (BitMask)) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " $");
+ continue;
+ }
+ //
+ // Update variables for fail
+ //
+ if (ErrByte & (BitMask)) {
+ OneFail[Channel][Byte] |= (BitMask);
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " #");
+
+ //
+ // Handle Speckles
+ //
+ if (marginbit[Channel][Byte][bit][sign] >= CMargin[Channel][Byte][BitTimePerBit]) {
+ marginbit[Channel][Byte][bit][sign] = CMargin[Channel][Byte][BitTimePerBit] - 1;
+ OnePass[Channel][Byte] &= ~(BitMask);
+ }
+ //
+ // Update variables for pass
+ //
+ } else {
+ OnePass[Channel][Byte] |= (BitMask);
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " .");
+
+ if (marginbit[Channel][Byte][bit][sign] < CMargin[Channel][Byte][BitTimePerBit]) {
+ marginbit[Channel][Byte][bit][sign] = CMargin[Channel][Byte][BitTimePerBit];
+ }
+ }
+ }
+ //
+ // FIND MAX Saturation limit
+ //
+ ByteMax = MaxMargin;
+ if (param == RdT) {
+ ByteMax = MrcCalcMaxRxMargin (MrcData, Channel, Rank, Byte, sign, MaxMargin);
+
+ }
+ //
+ // HANDLE Saturation
+ //
+ if (PerBit) {
+ for (bit = 0; bit < MAX_BITS; bit++) {
+ BitMask = MRC_BIT0 << bit;
+ if (CMargin[Channel][Byte][bit] >= ByteMax) {
+ OneFail[Channel][Byte] |= (BitMask);
+ }
+
+ if (CMargin[Channel][Byte][bit] == 0) {
+ OnePass[Channel][Byte] |= (BitMask);
+ }
+ }
+ } else {
+ if (CMargin[Channel][Byte][0] >= ByteMax) {
+ OneFail[Channel][Byte] = DoneMask;
+ }
+
+ if (CMargin[Channel][Byte][0] == 0) {
+ OnePass[Channel][Byte] = DoneMask;
+ }
+ }
+ //
+ // DECIDE WHAT TO TEST NEXT
+ // If PerByte, Do this within the for byte loop
+ //
+ chPass &= OnePass[Channel][Byte];
+ chFail &= OneFail[Channel][Byte];
+
+ if (PerCh == FALSE) {
+ if (PerBit) {
+ for (bit = 0; bit < MAX_BITS; bit++) {
+ BitMask = MRC_BIT0 << bit;
+ //
+ // Skip if this Bit Group is done
+ //
+ if (OnePass[Channel][Byte] & OneFail[Channel][Byte] & (BitMask)) {
+ continue;
+ }
+
+ if ((OneFail[Channel][Byte] & BitMask) == 0) {
+ CMargin[Channel][Byte][bit] += 1;
+ } else if ((OnePass[Channel][Byte] & BitMask) == 0) {
+ MinTested[Channel][Byte][bit] -= 1;
+ CMargin[Channel][Byte][bit] = MinTested[Channel][Byte][bit];
+ } else {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_WARNING, "WARNING! Can't have both: OnePass and OneFail Not Done\n");
+ }
+ }
+ } else {
+ //
+ // PerCh
+ // Skip if this Byte Group is done
+ //
+ if ((OnePass[Channel][Byte] & OneFail[Channel][Byte]) == DoneMask) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " ");
+ continue;
+ }
+
+ if (OneFail[Channel][Byte] != DoneMask) {
+ CMargin[Channel][Byte][0] += 1;
+ } else if (OnePass[Channel][Byte] != DoneMask) {
+ MinTested[Channel][Byte][0] -= 1;
+ CMargin[Channel][Byte][0] = MinTested[Channel][Byte][0];
+ }
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " ");
+ }
+ //
+ // END OF BYTE LOOP
+ // DECIDE WHAT TO TEST NEXT
+ // If PerCh, Do this within the for ch loop
+ //
+ if (PerCh == TRUE) {
+ if ((chPass & chFail) == DoneMask) {
+ continue;
+ }
+
+ if (chFail != DoneMask) {
+ CMargin[Channel][0][0] += 1;
+ } else {
+ MinTested[Channel][0][0] -= 1;
+ CMargin[Channel][0][0] = MinTested[Channel][0][0];
+ }
+ //
+ // All bytes must use the same margin point
+ //
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ CMargin[Channel][Byte][0] = CMargin[Channel][0][0];
+ }
+ }
+ }
+ //
+ // END OF CHANNEL LOOP
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+ }
+ //
+ // END OF WHILE LOOP
+ // Update MarginByte to have the correct result
+ //
+ if (PerBit == 0) {
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (chBitMask & (MRC_BIT0 << Channel)) {
+
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ MinMargin = 0x7F; // Start with a huge unsigned number
+ for (bit = 0; bit < MAX_BITS; bit++) {
+ if (MinMargin > marginbit[Channel][Byte][bit][sign]) {
+ MinMargin = (U8) marginbit[Channel][Byte][bit][sign];
+ }
+ }
+
+ marginbyte[Channel][Byte][sign] = MinMargin * 10;
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE,"+--marginbyte = MinMargin*10 = %d\n", MinMargin*10);
+ //
+ }
+ }
+ }
+ } else {
+ //
+ // Bit Margins
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!(chBitMask & (1 << Channel))) {
+ continue;
+ }
+
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ for (bit = 0; bit < MAX_BITS; bit++) {
+ if ((param == RdTBit && sign) || ((param != RdTBit) && (sign == 0))) {
+ marginbit[Channel][Byte][bit][sign] = MaxMargin - marginbit[Channel][Byte][bit][sign];
+ }
+ }
+ }
+ }
+ //
+ // Cleanup after test
+ //
+ Status = ChangeMargin (MrcData, pbyte, 0, 0, 1, 0, Rank, 0, 0, 0, 0, MrcRegFileCurrent);
+ }
+ }
+ //
+ // END OF SIGN LOOP
+ // Clean up after step
+ // @todo Restore perBit to last saved value
+ //
+ value0 = (PerBit == 1 ? 0x88888888 : 0);
+ Status = ChangeMargin (MrcData, param, value0, 0, 1, 0, Rank, 0, 0, 0, 0, MrcRegFileCurrent);
+
+ //
+ // Correct for 1 tick error in Per Bit Deskew right edge
+ //
+ RdTAdjust = 1;
+#ifdef MRC_DEBUG_PRINT
+ if (PerBit == 1) {
+ if (param == RdTBit) {
+ RdTAdjust = -1;
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nGains ");
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (chBitMask & (MRC_BIT0 << Channel)) {
+
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ for (bit = 0; bit < MAX_BITS; bit++) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ " %d %d",
+ ((RdTAdjust) * (8 - marginbit[Channel][Byte][bit][0])),
+ ((RdTAdjust) * (marginbit[Channel][Byte][bit][1] - 8))
+ );
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " ");
+ }
+ }
+ }
+ } else {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nCt");
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if ((chBitMask & (MRC_BIT0 << Channel))) {
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ for (bit = 0; bit < MAX_BITS; bit++) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "%4d",
+ (S8) (marginbit[Channel][Byte][bit][1] - marginbit[Channel][Byte][bit][0]) / 2
+ );
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " ");
+ }
+ }
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+#endif // MRC_DEBUG_PRINT
+
+ return Status;
+}
+
+/**
+ Assume REUT test has already been fully setup to run
+ Finds the margin for all channels/all bytes
+ The margin sweep is parameterized
+ Uses ChangeMargin function to handle a variety of cases (Timing, Voltage, Fan, etc.)
+ mode allows for different types of modes for margining:
+ mode is {Bit0: PhLock (keep all bytes within in ch in phase),
+ Bit1: Ch2Ch Data out of phase (LFSR seed), Bit 15:2: Reserved}
+ marginByte is used as the starting point for the search (10x the actual margin)
+ marginch returns the results (10x the actual margin)
+ Interior: Search inside marginch limits, enabling multiple calls with different setups
+ To reduce repeatibility noise, the returned margins is actually a BER extrapolation
+
+ @param[in] MrcData - The global MrcData
+ @param[in,out] marginByte - Data structure with the latest margin results
+ @param[in] chBitmask - Bit mask of present channels
+ @param[in] Rank - Rank to change margins for
+ @param[in] RankRx - Ranks for Rx margin
+ @param[in] param - parameter to get margins for
+ @param[in] mode - allows for different types of modes for margining:
+ @param[in] BMap - Byte mapping to configure error counter control register
+ @param[in] EnBER - Enable BER extrapolation calculations
+ @param[in] MaxMargin - Max Margin allowed for the parameter
+ @param[in] Interior - Search inside marginch limits, enabling multiple calls with different setups
+ @param[in,out] BERStats - Bit Error Rate Statistics.
+
+ @retval mrcSuccess if successful, otherwise returns an error status.
+**/
+MrcStatus
+MrcGetBERMarginByte (
+ IN MrcParameters * const MrcData,
+ IN OUT U32 marginByte[MAX_RESULT_TYPE][MAX_RANK_IN_CHANNEL][MAX_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_EDGES],
+ IN U8 chBitmask,
+ IN U8 Rank,
+ IN U8 RankRx,
+ IN U8 param,
+ IN U16 mode,
+ IN U8 *BMap,
+ IN U8 EnBER,
+ IN U8 MaxMargin,
+ IN U8 Interior,
+ IN OUT U32 *BERStats
+ )
+{
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcChannelOut *ChannelOut;
+ MrcControllerOut *ControllerOut;
+ U32 *MarginByteTemp;
+ MrcStatus Status;
+ U8 ResultType;
+ U8 sign;
+ S8 rSign;
+ U8 SeqLC[4];
+ U8 Points2D;
+ U8 Channel;
+ U8 byte;
+ U8 chByte;
+ U8 SkipWait;
+ U8 byteMax;
+ U8 Margin;
+ U16 DoneMask;
+ // Set to 1 after ch has 2 passing points
+ U16 TwoPass[MAX_CHANNEL];
+ // Set to 1 after ch has 2 failing points
+ U16 TwoFail[MAX_CHANNEL];
+ U16 res;
+ U16 BitMask;
+ S8 Delta;
+ BOOL Done;
+ BOOL allFail;
+ BOOL PerCh;
+ U32 value0;
+ U32 value1;
+ U32 tmp;
+ U32 ErrCount;
+ U8 LastPassVref[MAX_CHANNEL][MAX_SDRAM_IN_DIMM]; // Last passing Vref
+ U32 InitValue[MAX_CHANNEL][MAX_SDRAM_IN_DIMM]; // Initial value from margin byte
+ U8 MaxTested[MAX_CHANNEL][MAX_SDRAM_IN_DIMM]; // Highest Vref Point Tested
+ U8 MinTested[MAX_CHANNEL][MAX_SDRAM_IN_DIMM]; // Lowest Vref Point Tested
+ // Log8(Error count) at different Vref Points. 32 bit number that is broken in 4 bytes
+ // [LastPass+2, LastPass+1, LastPass, LastPass-1]
+ U32 Errors[MAX_CHANNEL][MAX_SDRAM_IN_DIMM];
+ U32 Offset;
+
+ MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_0_STRUCT ReutChErrCounterCtl;
+ MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_STRUCT ReutGlobalCtl;
+ MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_0_STRUCT ReutChErrCounterStatus;
+ MCHBAR_CH0_CR_SC_IO_LATENCY_STRUCT ScIoLatency;
+
+
+ Status = mrcSuccess;
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerOut = &Outputs->Controller[0];
+ chByte = 0;
+ Points2D = (param / RdFan2) + 1;
+ ResultType = GetMarginResultType (param);
+
+ //
+ // Are we using DIMM Vref?
+ //
+ PerCh = (param == WrFan2 || param == WrFan3 || param == WrV || ((mode & 1) == 1)); // WrFan not defined
+
+ //MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE,"+--->MrcGetBERMarginByte, Points2D: %d, PerCh: %d --\n", Points2D,PerCh);
+
+ DoneMask = (MRC_BIT0 << Outputs->SdramCount) - 1; // 0x1FF or 0xFF
+
+ if (Outputs->DQPat == SegmentWDB) {
+ SeqLC[0] = Outputs->DQPatLC;
+ SeqLC[1] = Outputs->DQPatLC;
+ SeqLC[2] = Outputs->DQPatLC + 4;
+ SeqLC[3] = Outputs->DQPatLC + 2;
+ } else {
+ SeqLC[0] = 1;
+ SeqLC[1] = 1;
+ SeqLC[2] = 1;
+ SeqLC[3] = 1;
+ }
+ //
+ // Run through margin test
+ //
+ for (sign = 0; sign < 2; sign++) {
+ rSign = (S8) ((2 * sign) - 1);
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE,"+--MrcGetBERMarginByte, rsign = %d\n", rSign);
+ //
+ MrcOemMemorySet ((U8 *) TwoPass, 0, sizeof (TwoPass));
+ MrcOemMemorySet ((U8 *) TwoFail, 0, sizeof (TwoFail));
+
+ //
+ // Initialize variables
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!((MRC_BIT0 << Channel) & chBitmask)) {
+ TwoPass[Channel] = DoneMask;
+ TwoFail[Channel] = DoneMask;
+ continue;
+ }
+
+ MinTested[Channel][0] = 0x7F;
+ for (byte = 0; byte < Outputs->SdramCount; byte++) {
+ LastPassVref[Channel][byte] = 0x7F; // Start with a huge unsigned numer - 128
+ Errors[Channel][byte] = 0;
+
+ //
+ // Find MaxMargin for this byte
+ //
+ byteMax = MaxMargin;
+ if (param == RdT) {
+ byteMax = MrcCalcMaxRxMargin (MrcData, Channel, RankRx, byte, sign, MaxMargin);
+ }
+ //
+ // Scale MarginResult back to real margin numbers. Set Max/MinTested
+ //
+ MarginByteTemp = &marginByte[ResultType][Rank][Channel][byte][sign];
+ *MarginByteTemp = *MarginByteTemp / 10;
+ if (*MarginByteTemp > byteMax) {
+ *MarginByteTemp = byteMax;
+ }
+
+ InitValue[Channel][byte] = *MarginByteTemp;
+
+ //
+ // if Per Ch, find MinMargin to start. Else set margin for that Byte
+ //
+ if (PerCh == TRUE) {
+ if (*MarginByteTemp < MinTested[Channel][0]) {
+ MaxTested[Channel][0] = (U8) *MarginByteTemp;
+ MinTested[Channel][0] = (U8) *MarginByteTemp;
+ }
+ } else {
+ MaxTested[Channel][byte] = (U8) *MarginByteTemp;
+ MinTested[Channel][byte] = (U8) *MarginByteTemp;
+ }
+ //
+ // Setup REUT Error Counters to count errors per byte lane
+ // Count Errors on a particular Byte Group BITS 8:7 = 10b
+ //
+ ReutChErrCounterCtl.Data = 0;
+ ReutChErrCounterCtl.Bits.Counter_Pointer = BMap[byte];
+ ReutChErrCounterCtl.Bits.Counter_Control = 2;
+ Offset = MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_0_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_0_REG - MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_0_REG) * Channel) +
+ ((MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_1_REG - MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_0_REG) * byte);
+ MrcWriteCR (MrcData, Offset, ReutChErrCounterCtl.Data);
+ }
+ //
+ // Set MarginResult for the PerCh case
+ //
+ if (PerCh == TRUE) {
+ for (byte = 0; byte < Outputs->SdramCount; byte++) {
+ marginByte[ResultType][Rank][Channel][byte][sign] = MinTested[Channel][0];
+ }
+ }
+ }
+ //
+ // Search algorithm:
+ // If start with a passing point, walk to hit 2 failing points
+ // Return as needed to hit a second passing point
+ // If start with a failing point, walk to hit 2 passing points
+ // Return as needed to hit a second failing point
+ // Keep testing until all ch/bytes find 2 passes and 2 fails
+ //
+ Done = FALSE;
+ do {
+ //
+ // Walk through all 2D points
+ //
+ ReutGlobalCtl.Data = 0;
+ ReutGlobalCtl.Bits.Global_Clear_Errors = 1;
+ MrcWriteCR (MrcData, MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_REG, ReutGlobalCtl.Data); // Clear errors
+ for (value1 = 0; value1 < Points2D; value1++) {
+ //
+ // Set Vref level
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!((MRC_BIT0 << Channel) & chBitmask)) {
+ continue;
+ }
+
+ SkipWait = (chBitmask >> (Channel + 1)); // Skip if there are more channels
+ for (byte = 0; byte < Outputs->SdramCount; byte++) {
+ value0 = rSign * marginByte[ResultType][Rank][Channel][byte][sign];
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE,"+----->Value0 is %d, Value1 is %d\n", (S32)value0, value1);
+ //
+ Status = ChangeMargin (
+ MrcData,
+ param,
+ value0,
+ value1,
+ 0,
+ Channel,
+ Rank,
+ byte,
+ 0,
+ 0,
+ SkipWait,
+ MrcRegFileStart
+ );
+ if ((PerCh) && ((mode & 1) == 0)) {
+ //
+ // Only Byte 7 on Channel 1 is needed to update Wr DIMM Vref - Taken care of inside ChangeMargin routine
+ //
+ break;
+ }
+ }
+ }
+ //
+ // Run Test
+ //
+ RunIOTest (MrcData, chBitmask, Outputs->DQPat, SeqLC, (value1 == 0), mode);
+
+ //
+ // What is the idea behind this? What if all byte groups failed?
+ //
+ if (EnBER == 0 && value1 < (U32) (Points2D - 1)) {
+ allFail = TRUE;
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!((MRC_BIT0 << Channel) & chBitmask)) {
+ continue;
+ }
+ //
+ // Read out per byte error results
+ //
+ Offset = 4 + MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_REG -
+ MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_REG) * Channel);
+ res = (U16) MrcReadCR (MrcData, Offset);
+ if ((res & DoneMask) != DoneMask) {
+ allFail = FALSE;
+ }
+ }
+
+ if (allFail == TRUE) {
+ break;
+ }
+ }
+ }
+ //
+ // Collect results and Update variables for next point to test
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!((MRC_BIT0 << Channel) & chBitmask)) {
+ continue;
+ }
+
+ for (byte = 0; byte < Outputs->SdramCount; byte++) {
+ BitMask = MRC_BIT0 << byte;
+ //
+ // Skip if this Byte Group is done
+ //
+ if ((TwoPass[Channel] & TwoFail[Channel] & (BitMask)) != 0) {
+ continue;
+ }
+ //
+ // Handle PerCh vs. PerByte variable differences
+ //
+ chByte = (PerCh == TRUE ? 0 : byte);
+
+ //
+ // Read Error Count
+ //
+ Offset = MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_0_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_0_REG - MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_0_REG) * Channel) +
+ ((MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_1_REG - MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_0_REG) * byte);
+ ReutChErrCounterStatus.Data = MrcReadCR (MrcData, Offset);
+ ErrCount = ReutChErrCounterStatus.Bits.Counter_Status;
+ Margin = (U8) marginByte[ResultType][Rank][Channel][byte][sign];
+ Delta = (Margin - LastPassVref[Channel][byte]);
+ //MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE,"+----->channel: %d, Error count:%x.\n", Channel, ErrCount);
+ //MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE,"+----->Margin:%d, LastPassVref:%d, delta:%d. sign:%d\n", Margin, LastPassVref[Channel][byte], (S8) Delta, sign);
+
+ // Update Pass/Fail Variables:
+ //
+ if (ErrCount == 0 && Margin == MaxTested[Channel][chByte]) {
+ //
+ // Passing while walking up
+ //
+ if (Delta < 0) {
+ //
+ // First passing point
+ // @todo: Next line should be changed to return failure. Code should never hang.
+ //
+ MRC_ASSERT (
+ MinTested[Channel][chByte] == MaxTested[Channel][chByte],
+ Debug,
+ "Error: MaxTested < LastPass after first point"
+ );
+ LastPassVref[Channel][byte] = Margin;
+ } else if (Delta == 1) {
+ //
+ // Normal, walk to fail
+ //
+ Errors[Channel][byte] = MrcBitShift (Errors[Channel][byte], -8 * Delta) & BER_ERROR_MASK;
+ LastPassVref[Channel][byte] = Margin;
+ TwoPass[Channel] |= (BitMask);
+ } else if (Delta == 2) {
+ //
+ // Speckling in response, Consider point as error
+ //
+ Errors[Channel][byte] = MrcBitSwap (Errors[Channel][byte], MrcLog8 (ErrCount), 24, 8);
+ TwoFail[Channel] |= (BitMask);
+ } else {
+ //
+ // @todo: Next line should be changed to return failure. Code should never hang.
+ //
+ MRC_ASSERT (
+ FALSE,
+ Debug,
+ "Error: Tested point twice or Tested >2 above LastPass (Passing while walking up)"
+ );
+ }
+ } else if (ErrCount == 0 && Margin == MinTested[Channel][chByte]) {
+ //
+ // Skip if this byte is already done
+ //
+ if ((TwoPass[Channel] & (BitMask)) != 0) {
+ continue;
+ }
+
+ if (Delta == -1) {
+ //
+ // Finding 2nd pass
+ //
+ Errors[Channel][byte] = MrcBitSwap (Errors[Channel][byte], 0, 0, 8);
+ TwoPass[Channel] |= (BitMask);
+ } else {
+ //
+ // 1st passing point
+ // Don't shift Errors. Fail points already assumed correct LastPass
+ //
+ LastPassVref[Channel][byte] = Margin;
+ TwoPass[Channel] &= ~(BitMask);
+ }
+ } else if (ErrCount > 0 && Margin == MaxTested[Channel][chByte]) {
+ //
+ // Failing while walking up
+ // @todo: Next line should be changed to return failure. Code should never hang.
+ //
+ MRC_ASSERT (Delta <= 2, Debug, "Error: Tested >2 above LastPass (Failing while walking up)");
+ if (Delta < 2) {
+ //
+ // first failing point
+ //
+ Errors[Channel][byte] = MrcBitSwap (Errors[Channel][byte], MrcLog8 (ErrCount), 16, 8);
+ TwoFail[Channel] &= ~(BitMask);
+ } else if (Delta == 2) {
+ //
+ // 2nd failing point
+ //
+ Errors[Channel][byte] = MrcBitSwap (Errors[Channel][byte], MrcLog8 (ErrCount), 24, 8);
+ TwoFail[Channel] |= (BitMask);
+ }
+ } else if (ErrCount > 0 && Margin == MinTested[Channel][chByte]) {
+ //
+ // Failing while walking down
+ //
+ if (LastPassVref[Channel][byte] < 0xFF && Delta <= 0) {
+ //
+ // Adjust LastPassVref and Error count to be below this failure point.
+ //
+ Errors[Channel][byte] = MrcBitSwap (Errors[Channel][byte], MrcLog8 (ErrCount), 8 * (Delta + 1), 8);
+ Errors[Channel][byte] = MrcBitShift (Errors[Channel][byte], 8 * (1 - Delta));
+ LastPassVref[Channel][byte] = Margin - 1;
+ } else {
+ tmp = ((Errors[Channel][byte] & 0xFF0000) << 8) + MrcLog8 (ErrCount);
+ Errors[Channel][byte] = MrcBitSwap (Errors[Channel][byte], tmp, 16, 16);
+ //MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE,"Unexpected case for channel: %d, delta: %d.\n", Channel, Delta);
+ }
+
+ if (MinTested[Channel][chByte] < MaxTested[Channel][chByte]) {
+ TwoFail[Channel] |= (BitMask);
+ }
+
+ if (Delta <= 0) {
+ TwoPass[Channel] &= ~(BitMask);
+ }
+ } else {
+ //
+ // @todo: Next line should be changed to return failure. Code should never hang.
+ //
+ MRC_ASSERT (FALSE, Debug, "Error: Testing points other than Max/MinTested");
+ }
+ //
+ // FIND MAX Saturation limit
+ //
+ byteMax = MaxMargin;
+ if (param == RdT) {
+ byteMax = MrcCalcMaxRxMargin (MrcData, Channel, RankRx, byte, sign, MaxMargin);
+ }
+
+ if (Interior && InitValue[Channel][byte] == Margin) {
+ byteMax = Margin;
+ }
+ //
+ // HANDLE MAX Saturation
+ //
+ if (Margin == byteMax) {
+ TwoFail[Channel] |= (BitMask);
+ }
+
+ if (ErrCount == 0 && byteMax == LastPassVref[Channel][byte] && (TwoPass[Channel] & (BitMask)) != 0) {
+ Errors[Channel][byte] = MrcBitSwap (Errors[Channel][byte], 0xFFFE, 16, 16);
+ }
+ //
+ // HANDLE MIN Saturation
+ //
+ if (Margin == 0) {
+ TwoPass[Channel] |= (BitMask);
+ if (ErrCount > 0) {
+ TwoFail[Channel] |= (BitMask);
+ LastPassVref[Channel][byte] = 0;
+ Errors[Channel][byte] = MrcBitSwap (
+ Errors[Channel][byte],
+ (BER_LOG_TARGET << 8) + BER_LOG_TARGET,
+ 16,
+ 16
+ );
+ }
+ }
+ //
+ // DECIDE WHAT TO TEST NEXT
+ // If In PerByte, Do this within the for byte loop
+ //
+ if (PerCh == FALSE) {
+ //
+ // Skip if this Byte Group is done
+ //
+ if ((TwoPass[Channel] & TwoFail[Channel] & (BitMask)) != 0) {
+ continue;
+ }
+
+ if (ErrCount == 0) {
+ if ((TwoFail[Channel] & (BitMask)) == 0) {
+ //
+ // Count up to find 2 fails
+ //
+ marginByte[ResultType][Rank][Channel][byte][sign] = ++MaxTested[Channel][chByte];
+ } else {
+ //
+ // Count down to find 2 passes
+ //
+ marginByte[ResultType][Rank][Channel][byte][sign] = --MinTested[Channel][chByte];
+ }
+ } else {
+ if ((TwoPass[Channel] & (BitMask)) == 0) {
+ marginByte[ResultType][Rank][Channel][byte][sign] = --MinTested[Channel][chByte];
+ } else {
+ marginByte[ResultType][Rank][Channel][byte][sign] = ++MaxTested[Channel][chByte];
+ }
+ }
+ }
+ }
+ //
+ // DECIDE WHAT TO TEST NEXT
+ // If In PerCh, Do this within the for ch loop
+ //
+ if (PerCh == TRUE) {
+ if ((TwoPass[Channel] & TwoFail[Channel]) == DoneMask) {
+ continue;
+ }
+
+ if (TwoPass[Channel] != DoneMask) {
+ marginByte[ResultType][Rank][Channel][0][sign] = --MinTested[Channel][chByte];
+ } else {
+ marginByte[ResultType][Rank][Channel][0][sign] = ++MaxTested[Channel][chByte];
+ }
+ //
+ // All bytes must use the same margin point
+ //
+ for (byte = 0; byte < Outputs->SdramCount; byte++) {
+ marginByte[ResultType][Rank][Channel][byte][sign] = marginByte[ResultType][Rank][Channel][0][sign];
+ }
+ }
+ }
+ //
+ // check if we are done
+ //
+ Done = TRUE;
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if ((TwoPass[Channel] & DoneMask) != DoneMask || (TwoFail[Channel] & DoneMask) != DoneMask) {
+ Done = FALSE;
+ break;
+ }
+ }
+ } while (Done == FALSE);
+
+ //
+ // Calculate the effective margin
+ // Update MarginResult with extroploated BER Margin
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (((MRC_BIT0 << Channel) & chBitmask) == 0) {
+ continue;
+ }
+
+ for (byte = 0; byte < Outputs->SdramCount; byte++) {
+ //MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE,"+----->marginByte[Ch %d, Byte%d, Sign %d] is: %d\n", Channel, byte, sign, marginByte[ResultType][Rank][Channel][byte][sign]);
+ if (EnBER) {
+ marginByte[ResultType][Rank][Channel][byte][sign] = interpolateVref (
+ LastPassVref[Channel][byte],
+ (Errors[Channel][byte] >> 16) & 0xFF,
+ (Errors[Channel][byte] >> 24) & 0xFF,
+ BER_LOG_TARGET,
+ BERStats
+ );
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE,"+----->BERmarginByte[Ch %d, Byte%d, Sign %d] is: %d\n", Channel, byte, sign, marginByte[ResultType][Rank][Channel][byte][sign]);
+ } else {
+ marginByte[ResultType][Rank][Channel][byte][sign] = 10 * LastPassVref[Channel][byte];
+ //MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE,"+----->marginByte[Ch %d, Byte%d, Sign %d] is: %d\n", Channel, byte, sign, marginByte[ResultType][Rank][Channel][byte][sign]);
+ }
+ }
+ }
+ }
+ //
+ // Clean up after step
+ //
+ if (param == RcvEnaX) {
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (((MRC_BIT0 << Channel) & chBitmask) == 0) {
+ continue;
+ }
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (byte = 0; byte < Outputs->SdramCount; byte++) {
+ UpdateRxT (MrcData, Channel, Rank, byte, 0xff, 0);
+ Offset = MCHBAR_CH0_CR_SC_IO_LATENCY_REG +
+ ((MCHBAR_CH1_CR_SC_IO_LATENCY_REG - MCHBAR_CH0_CR_SC_IO_LATENCY_REG) * Channel);
+ ScIoLatency.Data = MrcReadCR (MrcData, Offset);
+ ScIoLatency.Bits.RT_IOCOMP = MCHBAR_CH0_CR_SC_IO_LATENCY_RT_IOCOMP_MAX & ChannelOut->RTIoComp;
+ MrcWriteCR (MrcData, Offset, ScIoLatency.Data);
+ }
+ }
+ }
+ Status = ChangeMargin (MrcData, param, 0, 0, 1, 0, 0, 0, 0, 0, 0, MrcRegFileCurrent);
+ for (byte = 0; byte < Outputs->SdramCount; byte++) {
+ Offset = MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_0_REG +
+ ((MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_1_REG - MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_0_REG) * byte);
+ MrcWriteCrMulticast (MrcData, Offset, 0);
+ }
+
+ return Status;
+}
+
+/**
+ Assume REUT test has already been fully setup to run
+ Finds the margin for all channels/all bytes
+ The margin sweep is parameterized
+ Uses ChangeMargin function to handle a variety of cases (Timing, Voltage, Fan, etc.)
+ mode allows for different types of modes for margining:
+ mode is {Bit0: PhLock (keep all bytes within in ch in phase),
+ Bit1: Ch2Ch Data out of phase (LFSR seed), Bit 15:2: Reserved}
+ marginCh is used as the starting point for the search (10x the actual margin)
+ marginch returns the results (10x the actual margin)
+ Interior: Search inside marginch limits, enabling multiple calls with different setups
+ To reduce repeatibility noise, the returned margins is actually a BER extrapolation
+
+ @param[in] MrcData - The global MrcData
+ @param[in,out] marginCh - Data structure with the latest margin results
+ @param[in] chBitmask - Bit mask of present channels
+ @param[in] RankRx - Ranks for Rx margin
+ @param[in] Rank - Rank to change margins for
+ @param[in] param - parameter to get margins for
+ @param[in] mode - allows for different types of modes for margining:
+ @param[in] EnBER - Enable BER extrapolation calculations
+ @param[in] MaxMargin - Max Margin allowed for the parameter
+ @param[in] Interior - Search inside marginch limits, enabling multiple calls with different setups
+ @param[in,out] BERStats - Bit Error Rate Statistics.
+
+ @retval mrcSuccess if successful, otherwise returns an error status.
+**/
+MrcStatus
+MrcGetBERMarginCh (
+ IN MrcParameters *MrcData,
+ IN U32 marginCh[MAX_RESULT_TYPE][MAX_RANK_IN_CHANNEL][MAX_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_EDGES],
+ IN OUT U8 chBitmask,
+ IN U8 RankRx,
+ IN U8 Rank,
+ IN U8 param,
+ IN U16 mode,
+ IN U8 EnBER,
+ IN U8 MaxMargin,
+ IN U8 Interior,
+ IN OUT U32 *BERStats
+ )
+{
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcStatus Status;
+ U8 ResultType;
+ U8 sign;
+ S8 rSign;
+ U8 SeqLC[4];
+ U8 Points2D;
+ U8 Channel;
+ U8 byte;
+ U8 SkipWait;
+ U8 byteMax[MAX_CHANNEL];
+ U8 Margin;
+ // Set to 1 after ch has 2 passing points
+ U16 TwoPass[MAX_CHANNEL];
+ // Set to 1 after ch has 2 failing points
+ U8 TwoFail[MAX_CHANNEL];
+ S8 Delta;
+ BOOL Done;
+ BOOL DimmVrefParam;
+ U32 value0;
+ U32 value1;
+ U32 tmp;
+ U32 chError;
+ U32 ErrCount;
+ U8 LastPassVref[MAX_CHANNEL]; // Last passing Vref
+ U8 MaxTested[MAX_CHANNEL]; // Highest Vref Point Tested
+ U8 MinTested[MAX_CHANNEL]; // Lowest Vref Point Tested
+ // Log8(Error count) at different Vref Points. 32 bit number that is broken in 4 bytes
+ // [LastPass+2, LastPass+1, LastPass, LastPass-1]
+ U32 Errors[MAX_CHANNEL];
+ U32 Offset;
+ BOOL PerMc;
+ U8 McChannel;
+
+ MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_STRUCT ReutGlobalCtl;
+ MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_0_STRUCT ReutChErrCounterStatus;
+
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ Status = mrcSuccess;
+ ResultType = GetMarginResultType(param);
+ Points2D = (param / 16) + 1; // 2 for Fan2 and 3 for Fan3
+ McChannel = 0;
+
+ if (Outputs->DQPat == SegmentWDB) {
+ SeqLC[0] = Outputs->DQPatLC;
+ SeqLC[1] = Outputs->DQPatLC;
+ SeqLC[2] = Outputs->DQPatLC + 4;
+ SeqLC[3] = Outputs->DQPatLC + 2;
+ } else {
+ SeqLC[0] = 1;
+ SeqLC[1] = 1;
+ SeqLC[2] = 1;
+ SeqLC[3] = 1;
+ }
+ //
+ // Make sure we cover all DIMM Vref cases
+ //
+ DimmVrefParam = (param == WrFan2 || param == WrFan3 || param == WrV ); // WrFan not defined
+ PerMc = (param == CmdV) && (MrcCountBitsEqOne (chBitmask) >= 2);
+
+ //
+ // Run through margin test
+ //
+ for (sign = 0; sign < 2; sign++) {
+ rSign = (S8) ((2 * sign) - 1);
+ //MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE,"+----->rsign: %d \n", rSign);
+
+ MrcOemMemorySet ((U8 *) TwoPass, 0, sizeof (TwoPass));
+ MrcOemMemorySet ((U8 *) TwoFail, 0, sizeof (TwoFail));
+
+ //
+ // Initialize variables
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ //
+ // Set default of all variables
+ //
+ byteMax[Channel] = MaxMargin;
+ LastPassVref[Channel] = 0x7F; // Start with a huge unsigned numer - 128
+ Errors[Channel] = 0;
+ MinTested[Channel] = 0;
+ MaxTested[Channel] = 0;
+
+ if (((MRC_BIT0 << Channel) & chBitmask) == 0) {
+ TwoPass[Channel] = 1;
+ TwoFail[Channel] = 1;
+ continue;
+ }
+ //
+ // Find MaxMargin for this channel
+ //
+ if (param == RdT) {
+ for (byte = 0; byte < Outputs->SdramCount; byte++) {
+ byteMax[Channel] = MrcCalcMaxRxMargin (MrcData, Channel, RankRx, byte, sign, byteMax[Channel]);
+ }
+ }
+ //
+ // Scale back variables to normal margins and check saturation
+ //
+ marginCh[ResultType][Rank][Channel][0][sign] = marginCh[ResultType][Rank][Channel][0][sign] / 10;
+ if (marginCh[ResultType][Rank][Channel][0][sign] > byteMax[Channel]) {
+ marginCh[ResultType][Rank][Channel][0][sign] = byteMax[Channel];
+ }
+ //
+ // If PerMC, all channels should start with the lowest margin across all the channel
+ //
+ if (PerMc) {
+ if (marginCh[ResultType][Rank][McChannel][0][sign] > marginCh[ResultType][Rank][Channel][0][sign]) {
+ marginCh[ResultType][Rank][McChannel][0][sign] = marginCh[ResultType][Rank][Channel][0][sign];
+ }
+ }
+
+ MinTested[Channel] = (U8) marginCh[ResultType][Rank][Channel][0][sign];
+ MaxTested[Channel] = MinTested[Channel];
+
+ //
+ // Setup REUT Error Counters to count errors per channel
+ //
+ Offset = MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_0_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_0_REG - MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_0_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, 0);
+ }
+ //
+ // If PerMC, set all channels to use margin associated with mcChannel = 0
+ //
+ if (PerMc) {
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (((MRC_BIT0 << Channel) & chBitmask) == 0) {
+ continue;
+ }
+ marginCh[ResultType][Rank][Channel][0][sign] = marginCh[ResultType][Rank][McChannel][0][sign];
+ MinTested[Channel] = (U8) marginCh[ResultType][Rank][McChannel][0][sign];
+ MaxTested[Channel] = MinTested[Channel];
+ }
+ }
+ //
+ // Search algorithm:
+ // If start with a passing point, walk to hit 2 failing points
+ // Return as needed to hit a second passing point
+ // If start with a failing point, walk to hit 2 passing points
+ // Return as needed to hit a second failing point
+ // Keep testing until all ch/bytes find 2 passes and 2 fails
+ //
+ Done = FALSE;
+ do {
+ //
+ // Walk through all 2D points
+ //
+ ReutGlobalCtl.Data = 0;
+ ReutGlobalCtl.Bits.Global_Clear_Errors = 1;
+ MrcWriteCR (MrcData, MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_REG, ReutGlobalCtl.Data); // Clear errors
+ chError = 0;
+
+ for (value1 = 0; value1 < Points2D; value1++) {
+ //
+ // Set Vref level
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (((MRC_BIT0 << Channel) & chBitmask) == 0) {
+ continue;
+ }
+
+ SkipWait = (chBitmask >> (Channel + 1)); // Skip if there are more channels
+ value0 = rSign * marginCh[ResultType][Rank][Channel][0][sign];
+ //MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "+----->Value0 is %d, Value1 is %d\n", (S32) value0, value1);
+
+ if (param == CmdV) {
+ UpdateVrefWaitTilStable (MrcData, 2, 0, value0, 0);
+ MrcResetSequence (MrcData);
+ //MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "+----->Value0 is %d, Value1 is %d\n", (S32) value0, value1);
+ break; // Just update for one channel
+ } else {
+ for (byte = 0; byte < Outputs->SdramCount; byte++) {
+ Status = ChangeMargin (
+ MrcData,
+ param,
+ value0,
+ value1,
+ 0,
+ Channel,
+ RankRx,
+ byte,
+ 0,
+ 0,
+ SkipWait,
+ MrcRegFileStart
+ );
+ if (DimmVrefParam) {
+ //
+ // Only Byte 7 on Channel 1 is needed to update Wr DIMM Vref - Taken care of inside ChangeMargin routine
+ //
+ break;
+ }
+ }
+ }
+ }
+ //
+ // Run Test
+ //
+ chError |= RunIOTest (MrcData, chBitmask, Outputs->DQPat, SeqLC, (value1 == 0), mode);
+
+ //
+ // check if we have already failed and can stop running
+ //
+ if (EnBER == 0 && value1 < (U32) (Points2D - 1) && chError == chBitmask) {
+ break;
+ }
+ //
+ // Collect results and Update variables for next point to test
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if ((TwoPass[Channel] == 1 && TwoFail[Channel] == 1) || ((MRC_BIT0 << Channel) & chBitmask) == 0) {
+ continue;
+ }
+
+ McChannel = (PerMc) ? 0 : Channel;
+
+ //
+ // Read Error Count
+ //
+ Offset = MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_0_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_0_REG - MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_0_REG) * Channel);
+ ReutChErrCounterStatus.Data = MrcReadCR (MrcData, Offset);
+ ErrCount = ReutChErrCounterStatus.Bits.Counter_Status;
+ Margin = (U8) marginCh[ResultType][Rank][Channel][0][sign];
+ Delta = (Margin - LastPassVref[Channel]);
+
+ //
+ // Update Pass/Fail Variables:
+ //
+ if (ErrCount == 0 && Margin == MaxTested[McChannel]) {
+ //
+ // Passing while walking up
+ //
+ if (Delta < 0) {
+ //
+ // First passing point
+ // @todo: Next line should be changed to return failure. Code should never hang.
+ //
+ MRC_ASSERT (
+ MinTested[McChannel] == MaxTested[McChannel],
+ Debug,
+ "Error: MaxTested < LastPass after first point"
+ );
+ LastPassVref[Channel] = Margin;
+ } else if (Delta == 1) {
+ //
+ // Normal, walk to fail
+ //
+ Errors[Channel] = MrcBitShift (Errors[Channel], -8 * Delta) & BER_ERROR_MASK;
+ LastPassVref[Channel] = Margin;
+ TwoPass[Channel] = 1;
+ } else if (Delta == 2) {
+ //
+ // Speckling in response, Consider point as error
+ //
+ Errors[Channel] = MrcBitSwap (Errors[Channel], MrcLog8 (ErrCount), 24, 8);
+ TwoFail[Channel] = 1;
+ } else {
+ //
+ // @todo: Next line should be changed to return failure. Code should never hang.
+ //
+ MRC_ASSERT (FALSE, Debug, "Error: Tested point twice or Tested >2 above LastPass");
+ }
+ } else if (ErrCount == 0 && Margin == MinTested[McChannel]) {
+ if (TwoPass[Channel] == 1) {
+ continue; // Skip if this channel is already done
+ }
+ //
+ // Passing while walking down
+ //
+ if (Delta == -1) {
+ Errors[Channel] = MrcBitSwap (Errors[Channel], 0, 0, 8);
+ TwoPass[Channel] = 1; // found second pass
+ } else {
+ //
+ // 1st passing point
+ // Don't shift errors. Fail points already assumed correct
+ //
+ LastPassVref[Channel] = Margin;
+ TwoPass[Channel] = 0;
+ }
+ } else if (ErrCount > 0 && Margin == MaxTested[McChannel]) {
+ //
+ // Failing while walking up
+ // @todo: Next line should be changed to return failure. Code should never hang.
+ //
+ MRC_ASSERT (Delta <= 2, Debug, "Error: Tested >2 above LastPass");
+ if (Delta < 2) {
+ //
+ // first failing point
+ //
+ Errors[Channel] = MrcBitSwap (Errors[Channel], MrcLog8 (ErrCount), 16, 8);
+ TwoFail[Channel] = 0;
+ } else if (Delta == 2) {
+ //
+ // 2nd failing point
+ //
+ Errors[Channel] = MrcBitSwap (Errors[Channel], MrcLog8 (ErrCount), 24, 8);
+ TwoFail[Channel] = 1;
+ }
+ } else if (ErrCount > 0 && Margin == MinTested[McChannel]) {
+ //
+ // Failing while walking down
+ //
+ if (LastPassVref[Channel] < 0xFF && Delta <= 0) {
+ //
+ // Adjust LastPassVref and Error count to be below this failure point
+ //
+ Errors[Channel] = MrcBitSwap (Errors[Channel], MrcLog8 (ErrCount), 8 * (Delta + 1), 8);
+ Errors[Channel] = MrcBitShift (Errors[Channel], 8 * (1 - Delta));
+ LastPassVref[Channel] = Margin - 1;
+ } else {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Unexpected case for channel: %d, delta: %d.\n", Channel, Delta);
+ tmp = ((Errors[Channel] & 0xFF0000) >> 8) + MrcLog8 (ErrCount);
+ Errors[Channel] = MrcBitSwap (Errors[Channel], tmp, 16, 16);
+ }
+
+ if (MinTested[McChannel] < MaxTested[McChannel]) {
+ TwoFail[Channel] = 1;
+ }
+
+ if (Delta <= 0) {
+ TwoPass[Channel] = 0;
+ }
+ } else {
+ //
+ // @todo: Next line should be changed to return failure. Code should never hang.
+ //
+ MRC_ASSERT (FALSE, Debug, "Error: Testing points other than Max/MinTested");
+ }
+ //
+ // Find Max Saturation limit
+ //
+ if (Interior && MaxTested[Channel] == Margin) {
+ byteMax[Channel] = Margin;
+ }
+ //
+ // Handle Max Saturation
+ //
+ if (Margin == byteMax[Channel]) {
+ TwoFail[Channel] = 1;
+ }
+
+ if (ErrCount == 0 && byteMax[Channel] == LastPassVref[Channel] && TwoPass[Channel] == 1) {
+ Errors[Channel] = MrcBitSwap (Errors[Channel], 0xFFFE, 16, 16);
+ }
+ //
+ // Handle Min Saturation
+ //
+ if (Margin == 0) {
+ TwoPass[Channel] = 1;
+ if (ErrCount > 0) {
+ TwoFail[Channel] = 1;
+ LastPassVref[Channel] = 0;
+ Errors[Channel] = MrcBitSwap (Errors[Channel], (BER_LOG_TARGET << 8) + BER_LOG_TARGET, 16, 16);
+ }
+ }
+ //
+ // Decide what to test next for PerMC == FALSE
+ //
+ if (!PerMc) {
+ if (TwoPass[Channel] == 1) {
+ if (TwoFail[Channel] == 1) {
+ continue;
+ }
+ //MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE,"++---->MaxTested[Ch] before ++:%d\n", MaxTested[Channel]);////////
+ marginCh[ResultType][Rank][Channel][0][sign] = ++MaxTested[Channel];
+ } else {
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE,"++---->MinTested[Ch] before --:%d\n", MinTested[Channel]);////////
+ marginCh[ResultType][Rank][Channel][0][sign] = --MinTested[Channel];
+ }
+ }
+ }
+ //
+ // Decide what to test next for PerMC == TRUE
+ //
+ if (PerMc) {
+ if ((TwoPass[0] == 1) && (TwoPass[1] == 1)) {
+ //
+ // All Channels have 2 passes
+ //
+ if ((TwoFail[0] == 1) && (TwoFail[1] == 1)) {
+ //
+ // All Channels have 2 fails
+ //
+ continue;
+ }
+ //MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE,"++---->MaxTested[Ch] before ++:%d\n", MaxTested[Channel]);////////
+ marginCh[ResultType][Rank][McChannel][0][sign] = ++MaxTested[McChannel];
+ } else {
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE,"++---->MinTested[Ch] before --:%d\n", MinTested[Channel]);////////
+ marginCh[ResultType][Rank][McChannel][0][sign] = --MinTested[McChannel];
+ }
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (((MRC_BIT0 << Channel) & chBitmask) == 0) {
+ continue;
+ }
+
+ marginCh[ResultType][Rank][Channel][0][sign] = marginCh[ResultType][Rank][McChannel][0][sign];
+ MinTested[Channel] = MinTested[McChannel];
+ MaxTested[Channel] = MaxTested[McChannel];
+ }
+ }
+ }
+ //
+ // check if we are done
+ //
+ Done = TRUE;
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (TwoPass[Channel] == 0 || TwoFail[Channel] == 0) {
+ Done = FALSE;
+ break;
+ }
+ }
+ } while (Done == FALSE);
+
+ //
+ // Calculate the effective margin
+ // Update marginch with extroploated BER Margin
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (((MRC_BIT0 << Channel) & chBitmask) == 0) {
+ continue;
+ }
+ //MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE,"+----->marginCh[%d,%d] is: %d\n", Channel, sign, marginCh[ResultType][Rank][Channel][0][sign]);
+ if (EnBER) {
+ marginCh[ResultType][Rank][Channel][0][sign] = interpolateVref (
+ LastPassVref[Channel],
+ (Errors[Channel] >> 16) & 0xFF,
+ (Errors[Channel] >> 24) & 0xFF,
+ BER_LOG_TARGET,
+ BERStats
+ );
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "+----->BERmarginCh[%d,%d] is: %d, Errors = 0x%x\n", Channel, sign, marginCh[ResultType][Rank][Channel][0][sign], Errors[Channel]);
+ } else {
+ marginCh[ResultType][Rank][Channel][0][sign] = 10 * LastPassVref[Channel];
+ //MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "+----->marginCh[%d,%d] is: %d\n", Channel, sign, marginCh[ResultType][Rank][Channel][0][sign]);
+ }
+ }
+ }
+ //
+ // Clean up after step
+ //
+ if (param == CmdV) {
+ UpdateVrefWaitTilStable (MrcData, 2, 0, 0, 0);
+ } else {
+ Status = ChangeMargin (MrcData, param, 0, 0, 1, 0, 0, 0, 0, 0, 0, MrcRegFileCurrent);
+ }
+
+ MrcWriteCrMulticast (MrcData, MCSCHEDS_CR_REUT_CH_ERR_COUNTER_CTL_0_REG, 0);
+
+ return Status;
+}
+
+/**
+ This function shifts a 32 bit int either positive or negative
+
+ @param[in] Value - Input value to be shifted
+ @param[in] ShiftAmount - Number of bits places to be shifted.
+
+ @retval 0 if ShiftAmount exceeds +/- 31. Otherwise the updated 32 bit value.
+**/
+U32
+MrcBitShift (
+ IN const U32 Value,
+ IN const S8 ShiftAmount
+ )
+{
+ if ((ShiftAmount > 31) || (ShiftAmount < -31)) {
+ return 0;
+ }
+
+ if (ShiftAmount > 0) {
+ return Value << ShiftAmount;
+ } else {
+ return Value >> (-1 * ShiftAmount);
+ }
+}
+
+/**
+ This function Sign extends OldMSB to NewMSB Bits (Eg: Bit 6 to Bit 7)
+
+ @param[in] CurrentValue - Input value to be shifted
+ @param[in] OldMSB - The original most significant Bit
+ @param[in] NewMSB - The new most significant bit.
+
+ @retval The updated 8 bit value.
+**/
+U8
+MrcSE (
+ IN U8 CurrentValue,
+ IN const U8 OldMSB,
+ IN const U8 NewMSB
+ )
+{
+ U8 Scratch;
+
+ Scratch = ((MRC_BIT0 << (NewMSB - OldMSB)) - 1) << OldMSB;
+ if (CurrentValue >> (OldMSB - 1)) {
+ CurrentValue |= Scratch;
+ } else {
+ CurrentValue &= (~Scratch);
+ }
+
+ return CurrentValue;
+}
+
+/**
+ This function calculates the Log base 2 of the value to a maximum of Bits
+
+ @param[in] Value - Input value
+
+ @retval Returns the log base 2 of input value
+**/
+U8
+MrcLog2 (
+ IN const U32 Value
+ )
+{
+ U8 Log;
+ U8 Bit;
+
+ //
+ // Return 0 if value is negative
+ //
+ Log = 0;
+ if ((Value + 1) != 0) {
+ for (Bit = 0; Bit < 32; Bit++) {
+ if (Value & (MRC_BIT0 << Bit)) {
+ Log = (Bit + 1);
+ }
+ }
+ }
+
+ return Log;
+}
+
+/**
+ ***** Has Buffer Overflow for 68-71, 544-575, 4352-4607, ... ****
+ This function calculates the Log base 8 of the Input parameter using integers
+
+ @param[in] Value - Input value
+
+ @retval Returns 10x the log base 8 of input Value
+**/
+U32
+MrcLog8 (
+ IN U32 Value
+ )
+{
+ const U8 Loglook[17] = { 0, 0, 1, 2, 3, 4, 5, 6, 7, 7, 8, 8, 9, 9, 9, 10, 10 };
+ U32 Loga;
+ U32 Rema;
+
+ Loga = 0;
+ Rema = 2 * Value;
+ while (Value > 8) {
+ Rema = Value >> 2;
+ Value = Value >> 3;
+ Loga += 10;
+ };
+
+ return (Loga + Loglook[Rema]); //returns an integer approximation of "log8(a) * 10"
+}
+
+/**
+ This function Sorts Arr from largest to smallest
+
+ @param[in,out] Arr - Array to be sorted
+ @param[in] Channel - Channel to sort.
+ @param[in] lenArr - Length of the array
+
+ @retval Nothing
+**/
+void
+MrcBsortPerChannel (
+ IN OUT U32 Arr[MAX_CHANNEL][4],
+ IN const U8 Channel,
+ IN const U8 lenArr
+ )
+{
+ U8 i;
+ U8 j;
+ U32 temp;
+
+ for (i = 0; i < lenArr - 1; i++) {
+ for (j = 0; j < lenArr - (1 + i); j++) {
+ if (Arr[Channel][j] < Arr[Channel][j + 1]) {
+ temp = Arr[Channel][j];
+ Arr[Channel][j] = Arr[Channel][j + 1];
+ Arr[Channel][j + 1] = temp;
+ }
+ }
+ }
+
+ return;
+}
+
+/**
+ This function Sorts Arr from largest to smallest
+
+ @param[in,out] Arr - Array to be sort
+ @param[in] lenArr - Lenght of the array
+
+ @retval Nothing
+**/
+void
+MrcBsort (
+ IN OUT U32 *const Arr,
+ IN const U8 lenArr
+ )
+{
+ U8 i;
+ U8 j;
+ U32 temp;
+
+ for (i = 0; i < lenArr - 1; i++) {
+ for (j = 0; j < lenArr - (1 + i); j++) {
+ if (Arr[j] < Arr[j + 1]) {
+ temp = Arr[j];
+ Arr[j] = Arr[j + 1];
+ Arr[j + 1] = temp;
+ }
+ }
+ }
+
+ return;
+}
+
+/**
+ This function calculates the Natural Log of the Input parameter using integers
+
+ @param[in] Input - 100 times a number to get the Natural log from.
+ Max Input Number is 40,000 (without 100x)
+
+ @retval 100 times the actual result. Accurate within +/- 2
+**/
+U32
+MrcNaturalLog (
+ U32 Input
+ )
+{
+ U32 Output;
+
+ Output = 0;
+ while (Input > 271) {
+ Input = (Input * 1000) / 2718;
+ Output += 100;
+ }
+
+ Output += ((-16 * Input * Input + 11578 * Input - 978860) / 10000);
+
+ return Output;
+}
+
+/**
+ This function calculates the number of bits set to 1 in a 32-bit value.
+
+ @param[in] Input - The value to work on.
+
+ @retval The number of bits set to 1 in Input.
+**/
+U8
+MrcCountBitsEqOne (
+ IN U32 Input
+ )
+{
+ U8 NumOnes;
+
+ NumOnes = 0;
+ while (Input > 0) {
+ NumOnes++;
+ Input &= (Input - 1);
+ }
+
+ return NumOnes;
+}
+
+/**
+ This function calculates e to the power of of the Input parameter using integers.
+
+ @param[in] Input - 100 times a number to elevate e to.
+
+ @retval 100 times the actual result. Accurate within +/- 2.
+**/
+U32
+Mrceexp (
+ IN U32 Input
+ )
+{
+ U32 Extra100;
+ U32 Output;
+
+ Extra100 = 0;
+ Output = 1;
+ while (Input > 100) {
+ Input -= 100;
+ Output = (Output * 2718) / 10;
+ if (Extra100) {
+ Output /= 100;
+ }
+
+ Extra100 = 1;
+ }
+
+ Output = ((Output * (8 * Input * Input + 900 * Input + 101000)) / 1000);
+
+ if (Extra100) {
+ Output /= 100;
+ }
+
+ return Output;
+}
+
+/**
+ This function writes a 32 bit register.
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Offset - Offset of register from MchBar Base Address.
+ @param[in] Value - Value to write.
+
+ @retval Nothing
+**/
+void
+MrcWriteCrMulticast (
+ IN MrcParameters *const MrcData,
+ IN const U32 Offset,
+ IN const U32 Value
+ )
+{
+ MrcOemMmioWrite (Offset, Value, MrcData->SysIn.Inputs.MchBarBaseAddress);
+#ifdef MRC_DEBUG_PRINT
+ if (MrcData->SysIn.Inputs.Debug.PostCode[0] == MrcData->SysIn.Inputs.Debug.PostCode[1]) {
+ MRC_DEBUG_MSG (
+ &MrcData->SysIn.Inputs.Debug,
+ MSG_LEVEL_NOTE,
+ "%08Xh > %08Xh\n",
+ MrcData->SysIn.Inputs.MchBarBaseAddress + Offset,
+ Value
+ );
+ }
+#endif // MRC_DEBUG_PRINT
+ return;
+}
+
+/**
+ This function writes a 64 bit register.
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Offset - Offset of register from MchBar Base Address.
+ @param[in] Value - Value to write.
+
+ @retval Nothing
+**/
+void
+MrcWriteCR64 (
+ IN MrcParameters *const MrcData,
+ IN const U32 Offset,
+ IN const U64 Value
+ )
+{
+ MrcOemMmioWrite64 (Offset, Value, MrcData->SysIn.Inputs.MchBarBaseAddress);
+#ifdef MRC_DEBUG_PRINT
+ if (MrcData->SysIn.Inputs.Debug.PostCode[0] == MrcData->SysIn.Inputs.Debug.PostCode[1]) {
+ MRC_DEBUG_MSG (
+ &MrcData->SysIn.Inputs.Debug,
+ MSG_LEVEL_NOTE,
+ "%08Xh > %016Xh\n",
+ MrcData->SysIn.Inputs.MchBarBaseAddress + Offset,
+ Value
+ );
+ }
+#endif // MRC_DEBUG_PRINT
+ return;
+}
+
+/**
+ This function writes a 32 bit register.
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Offset - Offset of register from MchBar Base Address.
+ @param[in] Value - Value to write.
+
+ @retval Nothing
+**/
+void
+MrcWriteCR (
+ IN MrcParameters *const MrcData,
+ IN const U32 Offset,
+ IN const U32 Value
+ )
+{
+ MrcOemMmioWrite (Offset, Value, MrcData->SysIn.Inputs.MchBarBaseAddress);
+#ifdef MRC_DEBUG_PRINT
+ if (MrcData->SysIn.Inputs.Debug.PostCode[0] == MrcData->SysIn.Inputs.Debug.PostCode[1]) {
+ MRC_DEBUG_MSG (
+ &MrcData->SysIn.Inputs.Debug,
+ MSG_LEVEL_NOTE,
+ "%08Xh > %08Xh\n",
+ MrcData->SysIn.Inputs.MchBarBaseAddress + Offset,
+ Value
+ );
+ }
+#endif // MRC_DEBUG_PRINT
+ return;
+}
+
+/**
+ This function writes a 8 bit register.
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Offset - Offset of register from MchBar Base Address.
+ @param[in] Value - The value to write.
+
+ @retval Nothing
+**/
+void
+MrcWriteCR8 (
+ IN MrcParameters*const MrcData,
+ IN const U32 Offset,
+ IN const U8 Value
+ )
+{
+ MrcOemMmioWrite8 (Offset, Value, MrcData->SysIn.Inputs.MchBarBaseAddress);
+#ifdef MRC_DEBUG_PRINT
+ if (MrcData->SysIn.Inputs.Debug.PostCode[0] == MrcData->SysIn.Inputs.Debug.PostCode[1]) {
+ MRC_DEBUG_MSG (
+ &MrcData->SysIn.Inputs.Debug,
+ MSG_LEVEL_NOTE,
+ "%08Xh > %02Xh\n",
+ MrcData->SysIn.Inputs.MchBarBaseAddress + Offset,
+ Value
+ );
+ }
+#endif // MRC_DEBUG_PRINT
+ return;
+}
+
+/**
+ This function reads a 64 bit register.
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Offset - Offset of register from MchBar Base Address.
+
+ @retval Value read from the register.
+**/
+U64
+MrcReadCR64 (
+ IN MrcParameters *const MrcData,
+ IN const U32 Offset
+ )
+{
+ U64 Value;
+
+ MrcOemMmioRead64 (Offset, &Value, MrcData->SysIn.Inputs.MchBarBaseAddress);
+ return Value;
+}
+
+/**
+ This function reads a 32 bit register.
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Offset - Offset of register from MchBar Base Address.
+
+ @retval Value read from the register
+**/
+U32
+MrcReadCR (
+ IN MrcParameters *const MrcData,
+ IN const U32 Offset
+ )
+{
+ U32 Value;
+
+ MrcOemMmioRead (Offset, &Value, MrcData->SysIn.Inputs.MchBarBaseAddress);
+ return Value;
+}
+
+/**
+ This function blocks the CPU for the duration specified in HPET Delay time.
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] DelayHPET - time to wait in 69.841279ns
+
+ @retval Nothing
+**/
+void
+MrcWait (
+ IN MrcParameters *const MrcData,
+ IN U32 DelayHPET
+ )
+{
+ const MrcInput *Inputs;
+ BOOL Done;
+ U32 Start;
+ volatile U32 Finish;
+ U32 Now;
+
+Inputs = &MrcData->SysIn.Inputs;
+Done = FALSE;
+
+
+ if (DelayHPET >= (5 * HPET_1US)) {
+ MrcOemMmioRead (0xF0, &Start, Inputs->HpetBaseAddress);
+ Finish = Start + DelayHPET;
+
+ do {
+ MrcOemMmioRead (0xF0, &Now, Inputs->HpetBaseAddress);
+ if (Finish > Start) {
+ if (Now >= Finish) {
+ Done = TRUE;
+ }
+ } else {
+ if ((Now < Start) && (Now >= Finish)) {
+ Done = TRUE;
+ }
+ }
+ } while (Done == FALSE);
+ } else {
+ for (Start = 0; Start < ((DelayHPET + HPET_MIN) / (2 * HPET_MIN)); Start++) {
+ //
+ // Just perform Dummy reads to CPU CR
+ //
+ Finish = MrcReadCR (MrcData, MCSCHEDS_CR_REUT_CH_ERR_DATA_STATUS_REG);
+ }
+ }
+ return;
+}
+
+/**
+ This function forces an RCOMP.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval Nothing
+**/
+void
+ForceRcomp (
+ IN MrcParameters *const MrcData
+ )
+{
+ MrcWriteCR8 (MrcData, PCU_CR_M_COMP_PCU_REG + 1, MRC_BIT0);
+
+ //
+ // 10 - 20 us wait.
+ //
+ MrcWait (MrcData, 10 * HPET_1US);
+ return;
+}
+
+/**
+ This function sets the self refresh idle timer and enables it.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval Nothing
+**/
+void
+EnterSR (
+ IN MrcParameters *const MrcData
+ )
+{
+ MCDECS_CR_PM_SREF_CONFIG_MCMAIN_STRUCT PmSrefConfig;
+
+ PmSrefConfig.Data = 0;
+ PmSrefConfig.Bits.SR_Enable = 1;
+ PmSrefConfig.Bits.Idle_timer = SELF_REFRESH_IDLE_COUNT;
+ MrcWriteCR (MrcData, MCDECS_CR_PM_SREF_CONFIG_MCMAIN_REG, PmSrefConfig.Data);
+ MrcWait (MrcData, HPET_1US);
+ return;
+}
+
+/**
+ This function sets the self refresh idle timer and disables it.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval Nothing
+**/
+void
+ExitSR (
+ IN MrcParameters *const MrcData
+ )
+{
+ MCDECS_CR_PM_SREF_CONFIG_MCMAIN_STRUCT PmSrefConfig;
+
+ PmSrefConfig.Data = 0;
+ PmSrefConfig.Bits.Idle_timer = SELF_REFRESH_IDLE_COUNT;
+ MrcWriteCR (MrcData, MCDECS_CR_PM_SREF_CONFIG_MCMAIN_REG, PmSrefConfig.Data);
+ MrcWait (MrcData, HPET_1US);
+ return;
+}
+
+/**
+ This function programs the WDB.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval Nothing
+**/
+void
+SetupWDB (
+ IN MrcParameters *const MrcData
+ )
+{
+ U8 a;
+ const U32 vmask = 0x41041041;
+ const U32 amask[9] = {0x86186186, 0x18618618, 0x30C30C30, 0xA28A28A2, 0x8A28A28A,
+ 0x14514514, 0x28A28A28, 0x92492492, 0x24924924};
+ const U32 seeds[MRC_WDB_NUM_MUX_SEEDS] = {0xA10CA1, 0xEF0D08, 0xAD0A1E};
+ U8 Channel;
+ U32 Offset;
+ MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_STRUCT ReutPatWdbClMuxLmn;
+
+ //
+ // Fill first 8 entries as simple 2 LFSR VA pattern
+ // VicRot=8, Start=0
+ //
+ WriteWDBVAPattern (MrcData, 0, BASIC_VA_PATTERN_SPRED_8, 8, 0);
+
+ //
+ // Fill next 54 entries as 3 LFSR VA pattern
+ //
+ for (a = 0; a < 9; a++) {
+ //
+ // VicRot=6, Start=8+a*6
+ //
+ WriteWDBVAPattern (MrcData, amask[a], vmask, 6, 8 + a * 6);
+ }
+ //
+ // Write the LFSR seeds
+ //
+ MrcProgramLFSR (MrcData, seeds);
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (&MrcData->SysOut.Outputs, Channel)) {
+ ReutPatWdbClMuxLmn.Data = 0;
+ ReutPatWdbClMuxLmn.Bits.N_counter = 10;
+ ReutPatWdbClMuxLmn.Bits.M_counter = 1;
+ ReutPatWdbClMuxLmn.Bits.L_counter = 1;
+ ReutPatWdbClMuxLmn.Bits.Enable_Sweep_Frequency = 1;
+ Offset = MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_REG - MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_LMN_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, ReutPatWdbClMuxLmn.Data);
+ }
+ }
+
+ return;
+}
+
+/**
+ This function will program all present channels with the 3 seeds passed in.
+
+ @param[in] MrcData - Global MRC data structure
+ @param[in] seeds - Array of 3 seeds programmed into PAT_WDB_CL_MUX_PB_RD/WR
+
+ @retval - Nothing
+
+**/
+void
+MrcProgramLFSR (
+ IN MrcParameters *const MrcData,
+ IN U32 const seeds[MRC_WDB_NUM_MUX_SEEDS]
+ )
+{
+ U32 CrOffset;
+ U8 Channel;
+ U8 s;
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (&MrcData->SysOut.Outputs, Channel)) {
+ for (s = 0; s < MRC_WDB_NUM_MUX_SEEDS; s++) {
+ CrOffset = MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_0_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_0_REG - MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_0_REG) * Channel) +
+ ((MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_1_REG - MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_RD_0_REG) * s);
+ MrcWriteCR (MrcData, CrOffset, seeds[s]);
+ CrOffset = MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_0_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_0_REG - MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_0_REG) * Channel) +
+ ((MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_1_REG - MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_PB_WR_0_REG) * s);
+ MrcWriteCR (MrcData, CrOffset, seeds[s]);
+ }
+ }
+ }
+}
+
+/**
+ This function Write 1 cacheline worth of data to the WDB
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Patterns - Array of bytes. Each bytes represents 8 chunks of the cachelines for 1 lane.
+ Each entry in Patterns represents a different cacheline for a different lane.
+ @param[in] PMask - Array of len Spread uint8. Maps the patterns to the actual DQ lanes.
+ DQ[0] = Patterns[PMask[0]], ... DQ[Spread-1] = Patterns[PMask[Spread-1]]
+ DQ[Spread] = DQ[0], ... DQ[2*Spread-1] = DQ[Spread-1]
+ @param[in] Start - Starting entry in the WDB.
+
+ @retval Nothing
+**/
+void
+WriteWDBFixedPattern (
+ IN MrcParameters *const MrcData,
+ IN U8 *const Patterns,
+ IN U8 *const PMask,
+ IN const U8 Spread,
+ IN const U16 Start
+ )
+{
+ MrcOutput *Outputs;
+ U8 Channel;
+ U8 up32;
+ U8 chunk;
+ U8 b;
+ U8 beff;
+ U8 burst;
+ U32 data;
+ U32 pointer;
+ U32 Offset;
+ MCHBAR_CH0_CR_QCLK_LDAT_PDAT_STRUCT QclkLdatPdat;
+
+ Outputs = &MrcData->SysOut.Outputs;
+ for (chunk = 0; chunk < 8; chunk++) {
+ //
+ // Program LDAT_DATAIN_*
+ //
+ for (up32 = 0; up32 < 2; up32++) {
+ data = 0;
+ for (b = 0; b < 32; b++) {
+ beff = (b + 32 * up32) % Spread;
+ burst = Patterns[PMask[beff]];
+ if (burst & (MRC_BIT0 << chunk)) {
+ data |= (MRC_BIT0 << b);
+ }
+ }
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ Offset = MCHBAR_CH0_CR_QCLK_LDAT_DATAIN_0_REG +
+ ((MCHBAR_CH1_CR_QCLK_LDAT_DATAIN_0_REG - MCHBAR_CH0_CR_QCLK_LDAT_DATAIN_0_REG) * Channel) +
+ ((MCHBAR_CH0_CR_QCLK_LDAT_DATAIN_1_REG - MCHBAR_CH0_CR_QCLK_LDAT_DATAIN_0_REG) * up32);
+ MrcWriteCR (MrcData, Offset, data);
+ }
+ }
+ } // up32
+
+ pointer = MRC_BIT16 + chunk;
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ //
+ // Set rep = 0 don't want to replicate the data
+ // Set banksel field to the value of the chunk you want to write the 64 bits to.
+ // Set arraysel = 0 ( indicating it is the MC WDB) and mode = 'b01 in the SDAT register
+ //
+ Offset = MCHBAR_CH0_CR_QCLK_LDAT_SDAT_REG +
+ ((MCHBAR_CH1_CR_QCLK_LDAT_SDAT_REG - MCHBAR_CH0_CR_QCLK_LDAT_SDAT_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, pointer);
+
+ //
+ // Finally, write the PDAT register indicating which cacheline of the WDB you want to write to
+ // by setting fastaddr field to one of the 64 cache lines. Also set cmdb in the pdat register to 4'b1000,
+ // indicating that this is a LDAT write
+ //
+ Offset = MCHBAR_CH0_CR_QCLK_LDAT_PDAT_REG +
+ ((MCHBAR_CH1_CR_QCLK_LDAT_PDAT_REG - MCHBAR_CH0_CR_QCLK_LDAT_PDAT_REG) * Channel);
+ QclkLdatPdat.Data = 0;
+ QclkLdatPdat.Bits.CMDB = 8;
+ QclkLdatPdat.Bits.FASTADDR = MIN (Start, MCHBAR_CH0_CR_QCLK_LDAT_PDAT_FASTADDR_MAX);
+ MrcWriteCR (MrcData, Offset, QclkLdatPdat.Data);
+ }
+ }
+ } // chunk
+ //
+ // Turn off LDAT mode after writing to WDB is complete
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ Offset = MCHBAR_CH0_CR_QCLK_LDAT_SDAT_REG +
+ ((MCHBAR_CH1_CR_QCLK_LDAT_SDAT_REG - MCHBAR_CH0_CR_QCLK_LDAT_SDAT_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, 0);
+ }
+ }
+
+ return;
+}
+
+/**
+ This rotine performs the following steps:
+ Step 0: Iterate through all VicRots
+ Step 1: Create a compressed vector for a given 32 byte cacheline
+ Each byte has a value of LFSR0=AA/LFSR1=CC/LFSR2=F0
+ Step 2: Expand compressed vector into chunks and 32 bit segments
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] vmask - 32 bit victim mask. 1 indicates this bit should use LFSR0
+ @param[in] amask - 32 bit aggressor mask. 0/1 indicates this bit should use LFSR1/2
+ @param[in] VicRot - Number of times to circular rotate vmask/amask
+ @param[in] Start - Starting entry in the WDB
+
+ @retval Nothing
+**/
+void
+WriteWDBVAPattern (
+ IN MrcParameters *const MrcData,
+ IN U32 amask,
+ IN U32 vmask,
+ IN const U8 VicRot,
+ IN const U16 Start
+ )
+{
+ const U8 VAMask2Compressed[4] = {0xAA, 0xC0, 0xCC, 0xF0};
+ MrcOutput *Outputs;
+ U8 b;
+ U8 chunk;
+ U8 Channel;
+ U8 cmask;
+ U16 v;
+ U32 Vic;
+ U32 Agg2;
+ U32 data;
+ U32 pointer;
+ U32 msb;
+ U8 Compressed[32];
+ U32 BitMask;
+ U8 Index;
+ U16 Scratch;
+ U32 Offset;
+ MCHBAR_CH0_CR_QCLK_LDAT_PDAT_STRUCT QclkLdatPdat;
+
+ Outputs = &MrcData->SysOut.Outputs;
+ for (v = 0; v < VicRot; v++) {
+ //
+ // Iterate through all 32 bits and create a compressed version of cacheline
+ // AA = Victim (LFSR0), CC = Agg1(LFSR1), F0 = Agg2 (LFSR2)
+ //
+ for (b = 0; b < 32; b++) {
+ BitMask = MRC_BIT0 << b;
+ Vic = (vmask & BitMask);
+ Agg2 = (amask & BitMask);
+
+ //
+ // Program compressed vector
+ //
+ if (Vic && Agg2) {
+ Index = 1;
+ } else if (Vic && !Agg2) {
+ Index = 0;
+ } else if (!Vic && !Agg2) {
+ Index = 2;
+ } else {
+ Index = 3;
+ }
+
+ Compressed[b] = VAMask2Compressed[Index];
+ }
+
+ for (chunk = 0; chunk < 8; chunk++) {
+ data = 0;
+ cmask = (MRC_BIT0 << chunk);
+ for (b = 0; b < 32; b++) {
+ if (Compressed[b] & cmask) {
+ data |= (MRC_BIT0 << b);
+ }
+ }
+ //
+ // Set rep = 0 don't want to replicate the data
+ // Set banksel field to the value of the chunk you want to write the 64 bits to.
+ // Set arraysel = 0 ( indicating it is the MC WDB) and mode = 'b01 in the SDAT register
+ //
+ pointer = MRC_BIT16 + chunk;
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ Offset = MCHBAR_CH0_CR_QCLK_LDAT_DATAIN_0_REG +
+ ((MCHBAR_CH1_CR_QCLK_LDAT_DATAIN_0_REG - MCHBAR_CH0_CR_QCLK_LDAT_DATAIN_0_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, data);
+ Offset = MCHBAR_CH0_CR_QCLK_LDAT_DATAIN_1_REG +
+ ((MCHBAR_CH1_CR_QCLK_LDAT_DATAIN_1_REG - MCHBAR_CH0_CR_QCLK_LDAT_DATAIN_1_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, data);
+ Offset = MCHBAR_CH0_CR_QCLK_LDAT_SDAT_REG +
+ ((MCHBAR_CH1_CR_QCLK_LDAT_SDAT_REG - MCHBAR_CH0_CR_QCLK_LDAT_SDAT_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, pointer);
+
+ //
+ // Finally, write the PDAT register indicating which cacheline of the WDB you want to write to
+ // by setting fastaddr field to one of the 64 cache lines. Also set cmdb in the pdat register to 4'b1000,
+ // indicating that this is a LDAT write
+ //
+ Scratch = Start + v;
+ Offset = MCHBAR_CH0_CR_QCLK_LDAT_PDAT_REG +
+ ((MCHBAR_CH1_CR_QCLK_LDAT_PDAT_REG - MCHBAR_CH0_CR_QCLK_LDAT_PDAT_REG) * Channel);
+ QclkLdatPdat.Data = 0;
+ QclkLdatPdat.Bits.CMDB = 8;
+ QclkLdatPdat.Bits.FASTADDR = MIN (Scratch, MCHBAR_CH0_CR_QCLK_LDAT_PDAT_FASTADDR_MAX);
+ MrcWriteCR (MrcData, Offset, QclkLdatPdat.Data);
+ }
+ }
+ }
+ //
+ // Circular Rotate Vic/Agg Masks
+ //
+ msb = (vmask >> 31) & 0x1;
+ vmask = (vmask << 1) | msb;
+ msb = (amask >> 31) & 0x1;
+ amask = (amask << 1) | msb;
+ }
+ //
+ // Clear LDAT mode
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ Offset = MCHBAR_CH0_CR_QCLK_LDAT_SDAT_REG +
+ ((MCHBAR_CH1_CR_QCLK_LDAT_SDAT_REG - MCHBAR_CH0_CR_QCLK_LDAT_SDAT_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, 0);
+ }
+ }
+
+ return;
+}
+
+/**
+ Write VA pattern in CADB
+ Use basic VA pattern for CADB with 2 LFSRs. Rotation is manual
+ Bit Order is [CKE[3:0], ODT[3:0], CMD[2:0], CS[3:0], BA[2:0], MA[15:0]]
+ [59:56] [51:48] [42:40] [35:32] [26:24] [15:0]
+
+ NOTE: CKE, ODT and CS are not used in functional mode and are ignored
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Channel - Channel to setup.
+ @param[in] VicSpread - Separation of the Victim Bit.
+ @param[in] VicBit - The Bit to be the Victim.
+ @param[in] LMNEn - To enable LMN counter
+
+ @retval Nothing
+**/
+void
+SetupCADB (
+ IN MrcParameters *const MrcData,
+ IN const U8 Channel,
+ IN const U8 VicSpread,
+ IN const U8 VicBit,
+ IN const U8 LMNEn
+ )
+{
+ const U16 seeds[3] = {0xEA1, 0xBEEF, 0xDEAD};
+ U8 Row;
+ U8 bit;
+ U8 lfsr0;
+ U8 lfsr1;
+ U8 bremap;
+ U8 Fine;
+ U32 Offset;
+ MCHBAR_CH0_CR_REUT_CH_PAT_CADB_PROG_STRUCT ReutChPatCadbProg;
+ MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_CTRL_STRUCT ReutChPatCadbMuxCtrl;
+ MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_STRUCT ReutCadbClMuxLmn;
+
+ //
+ // Currently, always start writing at CADB row0. Could add Start point in future.
+ //
+ Offset = MCHBAR_CH0_CR_REUT_CH_PAT_CADB_WRITE_POINTER_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_PAT_CADB_WRITE_POINTER_REG - MCHBAR_CH0_CR_REUT_CH_PAT_CADB_WRITE_POINTER_REG) * Channel);
+ MrcWriteCR8 (MrcData, Offset, 0);
+
+ //
+ // Plan to use VicSpread of 7 bits
+ // Walk through CADB rows, assigning bit for 1 VA pattern
+ //
+ for (Row = 0; Row < MRC_NUM_CADB_ENTRIES; Row++) {
+
+ lfsr0 = (Row & 0x1); // 0, 1, 0, 1 0, 1, 0, 1 for r = 0,1, ..., 7
+ lfsr1 = ((Row >> 1) & 0x1); // 0, 0, 1, 1 0, 0, 1, 1 for r = 0,1, ..., 7
+ //
+ // Assign Victim/Aggressor Bits
+ //
+ ReutChPatCadbProg.Data = 0;
+ for (bit = 0; bit < 22; bit++) {
+ //
+ // b in range(22)
+ //
+ Fine = bit % VicSpread;
+ if (bit >= 19) {
+ bremap = bit + 21; // b = [40-42]
+ } else if (bit >= 16) {
+ bremap = bit + 8; // b = [24-26]
+ } else {
+ bremap = bit; // b = [0-15]
+ }
+
+ if (Fine == VicBit) {
+ ReutChPatCadbProg.Data |= MrcOemMemoryLeftShiftU64 ((U64) lfsr0, bremap);
+ } else {
+ ReutChPatCadbProg.Data |= MrcOemMemoryLeftShiftU64 ((U64) lfsr1, bremap);
+ }
+ }
+ //
+ // Write Row. CADB is auto incremented after every write
+ //
+ Offset = MCHBAR_CH0_CR_REUT_CH_PAT_CADB_PROG_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_PAT_CADB_PROG_REG - MCHBAR_CH0_CR_REUT_CH_PAT_CADB_PROG_REG) * Channel);
+ MrcWriteCR64 (MrcData, Offset, ReutChPatCadbProg.Data);
+ }
+ //
+ // Setup CADB in terms of LFSR selects, LFSR seeds, LMN constants and overall control
+ //
+ Offset = MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_CTRL_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_CTRL_REG - MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_CTRL_REG) * Channel);
+ ReutChPatCadbMuxCtrl.Data = 0;
+ ReutChPatCadbMuxCtrl.Bits.Mux0_Control = LMNEn ? 0 : 2;
+ ReutChPatCadbMuxCtrl.Bits.Mux1_Control = 2;
+ ReutChPatCadbMuxCtrl.Bits.Mux2_Control = 2;
+ MrcWriteCR (MrcData, Offset, ReutChPatCadbMuxCtrl.Data);
+
+ Offset = MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_REG - MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CL_MUX_LMN_REG) * Channel);
+ ReutCadbClMuxLmn.Data = 0;
+ ReutCadbClMuxLmn.Bits.Enable_Sweep_Frequency = 1;
+ ReutCadbClMuxLmn.Bits.L_counter = 1;
+ ReutCadbClMuxLmn.Bits.M_counter = 1;
+ ReutCadbClMuxLmn.Bits.N_counter = 6;
+ MrcWriteCR (MrcData, Offset, ReutCadbClMuxLmn.Data);
+
+ Offset = MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_PB_0_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_PB_0_REG - MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_PB_0_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, seeds[0]);
+
+ Offset = MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_PB_1_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_PB_1_REG - MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_PB_1_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, seeds[1]);
+
+ Offset = MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_PB_2_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MUX_PB_2_REG - MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MUX_PB_2_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, seeds[2]);
+
+ return;
+}
+
+/**
+ Program the subsequence type field in a given MCDFXS_CR_REUT_CHx_SUBSEQ_CTL_MCMAIN_x_STRUCT register
+
+ @param[in] MrcData - MRC global data
+ @param[in, out] SubSeqCtl - Address of the MCDFXS_CR_REUT_CHx_SUBSEQ_CTL_MCMAIN_x_STRUCT register
+ @param[in] Type - The subsequence type to program
+
+ @retval Nothing.
+**/
+void
+SetSubsequenceType (
+ IN MrcParameters *const MrcData,
+ IN OUT U32 *SubSeqCtl,
+ IN U32 Type
+ )
+{
+ const MrcInput *Inputs;
+
+ Inputs = &MrcData->SysIn.Inputs;
+
+ if ((Inputs->CpuModel == cmHSW) && (Inputs->CpuStepping == csHswA0)) {
+ ((MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_STRUCT_HSW_A0 *) (SubSeqCtl))->Bits.Subsequence_Type = Type;
+ } else {
+ ((MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_STRUCT *) (SubSeqCtl))->Bits.Subsequence_Type = Type;
+ }
+}
+
+/**
+ This function handles writing to the REUT Addressing sequence for IO Tests.
+ To not write a certain parameter, pass a NULL pointer to the function.
+
+ @param[in] MrcData - MRC global data structure.
+ @param[in] Channel - Specifies the channel to program.
+ @param[in] StartAddr - Start value for Rank/Bank/Row/Col.
+ @param[in] StopAddr - Stop value for Rank/Bank/Row/Col.
+ @param[in] FieldOrder - Relative order for carry propagates of Rank/Bank/Row/Col.
+ @param[in] IncRate - The number of writes to Rank/Bank/Row/Col before updating the address.
+ Note: The function will handle linear vs exponential and a value of 0 specifies a rate of 1.
+ @param[in] IncValue - The amount to increase Rank/Bank/Row/Col address.
+ @param[in] WrapTriggerEn - Enables wrap trigger for Rank/Bank/Row/Col to enable stopping on subsequence and sequence.
+ @param[in] WrapCarryEn - Enables carry propagation on wrap to the next higest order field
+ @param[in] AddrInvertEn - Enables inverting the Rank/Bank/Row/Col addresses based on AddrInvertRate.
+ @param[in] AddrIvertRate - Exponential rate of address inversion. Only updated if AddrInvertEn != NULL.
+ @param[in] EnableDebug - Enables/Disables debug printing.
+
+ @retval Nothing
+**/
+void
+MrcProgramSequenceAddress (
+ IN MrcParameters *const MrcData,
+ IN const U8 Channel,
+ IN const U16 StartAddr[MrcReutFieldMax],
+ IN const U16 StopAddr[MrcReutFieldMax],
+ IN const U8 FieldOrder[MrcReutFieldMax],
+ IN const U32 IncRate[MrcReutFieldMax],
+ IN const U16 IncValue[MrcReutFieldMax],
+ IN const U8 WrapTriggerEn[MrcReutFieldMax],
+ IN const U8 WrapCarryEn[MrcReutFieldMax],
+ IN const U8 AddrInvertEn[MrcReutFieldMax],
+ IN const U8 AddrInvertRate,
+ IN const BOOL EnableDebug
+ )
+{
+ MrcInput *Inputs;
+ U64 RowMask;
+ U32 ColumnMask;
+ U32 CrOffset;
+ U32 IncRateScratch;
+ U16 ColAddrIncMax;
+ MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_0_STRUCT ReutChSeqBaseAddrStart;
+ MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_STRUCT ReutChSeqBaseAddrWrap;
+ MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_STRUCT ReutChSeqBaseAddrIncCtl;
+ MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_STRUCT ReutChSeqBaseAddrOrderCarryInvertCtl;
+#ifdef MRC_DEBUG_PRINT
+ MrcDebug *Debug;
+ Debug = &MrcData->SysIn.Inputs.Debug;
+#endif
+
+ Inputs = &MrcData->SysIn.Inputs;
+
+ //
+ // @todo: Review next stepping
+ //
+ RowMask = (U64) MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_Row_Address_MSK;
+ switch (Inputs->CpuModel) {
+ case cmHSW:
+ if (Inputs->CpuStepping == csHswA0) {
+ ColumnMask = MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_Column_Address_MSK_A0;
+ ColAddrIncMax = MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Column_Base_Address_Increment_MAX_A0;
+ } else {
+ ColumnMask = MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_Column_Address_MSK;
+ ColAddrIncMax = MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Column_Base_Address_Increment_MAX;
+ }
+ break;
+
+ case cmHSW_ULT:
+ case cmCRW:
+ ColumnMask = MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_Column_Address_MSK;
+ ColAddrIncMax = MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Column_Base_Address_Increment_MAX;
+ break;
+
+ default:
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "Invalid CPU Type in MrcProgramSequenceAddress. Defaulting to Hsw last stepping: %x.\n",
+ csHswLast
+ );
+ ColumnMask = MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_Column_Address_MSK;
+ ColAddrIncMax = MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_Column_Base_Address_Increment_MAX;
+ }
+
+#ifdef MRC_DEBUG_PRINT
+ if (EnableDebug) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "Ch.%d Masks: Col - 0x%x\t Row - 0x%08x%08x\tColAddrIncMax: 0x%x\n",
+ Channel,
+ ColumnMask,
+ (U32) MrcOemMemoryRightShiftU64 (RowMask, 32),
+ (U32) RowMask,
+ ColAddrIncMax
+ );
+ }
+#endif
+
+ if (StartAddr != NULL) {
+ ReutChSeqBaseAddrStart.Data = MrcOemMemoryLeftShiftU64 (
+ (U64) ((StartAddr[MrcReutFieldRank] << (56 - 32)) + (StartAddr[MrcReutFieldBank] << (48 - 32))),
+ 32
+ );
+ ReutChSeqBaseAddrStart.Data |= MrcOemMemoryLeftShiftU64 ((U64) StartAddr[MrcReutFieldRow], 24) & RowMask;
+ ReutChSeqBaseAddrStart.Data |= StartAddr[MrcReutFieldCol] & ColumnMask;
+
+ CrOffset = MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_0_REG +
+ (
+ (MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_1_REG - MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_0_REG)
+ * Channel
+ );
+ MrcWriteCR64 (MrcData, CrOffset, ReutChSeqBaseAddrStart.Data);
+
+#ifdef MRC_DEBUG_PRINT
+ if (EnableDebug) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Start:\n\tField\tInput\t\tStruct\n");
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\tCol:\t0x%x\t\t0x%x\n",
+ StartAddr[MrcReutFieldCol],
+ ReutChSeqBaseAddrStart.Data & ColumnMask
+ );
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\tRow:\t0x%x\t\t0x%x\n",
+ StartAddr[MrcReutFieldRow],
+ MrcOemMemoryRightShiftU64 (ReutChSeqBaseAddrStart.Data, 24) & MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_Row_Address_MAX
+ );
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\tBank:\t0x%x\t\t0x%x\n",
+ StartAddr[MrcReutFieldBank],
+ MrcOemMemoryRightShiftU64 (ReutChSeqBaseAddrStart.Data, 48) & MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_Bank_Address_MAX
+ );
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\tRank:\t0x%x\t\t0x%x\n",
+ StartAddr[MrcReutFieldRank],
+ MrcOemMemoryRightShiftU64 (ReutChSeqBaseAddrStart.Data, 56) & MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_Rank_Address_MAX
+ );
+ }
+#endif
+ }
+
+ if (StopAddr != NULL) {
+ ReutChSeqBaseAddrWrap.Data = MrcOemMemoryLeftShiftU64 (
+ (U64) ((StopAddr[MrcReutFieldRank] << (56 - 32)) + (StopAddr[MrcReutFieldBank] << (48 - 32))),
+ 32
+ );
+ ReutChSeqBaseAddrWrap.Data |= MrcOemMemoryLeftShiftU64 ((U64) StopAddr[MrcReutFieldRow], 24) & RowMask;
+ ReutChSeqBaseAddrWrap.Data |= StopAddr[MrcReutFieldCol] & ColumnMask;
+
+ CrOffset = MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_REG +
+ (
+ (MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_1_REG - MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_REG)
+ * Channel
+ );
+ MrcWriteCR64 (MrcData, CrOffset, ReutChSeqBaseAddrWrap.Data);
+
+#ifdef MRC_DEBUG_PRINT
+ if (EnableDebug) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Stop:\n\tField\tInput\t\tStruct\n");
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\tCol:\t0x%x\t\t0x%x\n",
+ StopAddr[MrcReutFieldCol],
+ ReutChSeqBaseAddrWrap.Data & ColumnMask
+ );
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\tRow:\t0x%x\t\t0x%x\n",
+ StopAddr[MrcReutFieldRow],
+ MrcOemMemoryRightShiftU64 (ReutChSeqBaseAddrWrap.Data, 24) & MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_Row_Address_MAX
+ );
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\tBank:\t0x%x\t\t0x%x\n",
+ StopAddr[MrcReutFieldBank],
+ MrcOemMemoryRightShiftU64 (ReutChSeqBaseAddrWrap.Data, 48) & MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_Bank_Address_MAX
+ );
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\tRank:\t0x%x\t\t0x%x\n",
+ StopAddr[MrcReutFieldRank],
+ MrcOemMemoryRightShiftU64 (ReutChSeqBaseAddrWrap.Data, 56) & MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_Rank_Address_MAX
+ );
+ }
+#endif
+ }
+
+ if (FieldOrder != NULL || WrapTriggerEn != NULL || WrapCarryEn != NULL || AddrInvertEn != NULL) {
+ ReutChSeqBaseAddrOrderCarryInvertCtl.Data = 0;
+
+ CrOffset = MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_REG +
+ (
+ (
+ MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_1_REG -
+ MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_ORDER_CARRY_INVERT_CTL_MCMAIN_0_REG
+ ) * Channel
+ );
+
+ if (FieldOrder == NULL || WrapTriggerEn == NULL || WrapCarryEn == NULL || AddrInvertEn == NULL) {
+ ReutChSeqBaseAddrOrderCarryInvertCtl.Data = MrcReadCR (MrcData, CrOffset);
+ }
+
+ if (FieldOrder != NULL) {
+ ReutChSeqBaseAddrOrderCarryInvertCtl.Bits.Base_Column_Address_Order = FieldOrder[MrcReutFieldCol];
+ ReutChSeqBaseAddrOrderCarryInvertCtl.Bits.Base_Row_Address_Order = FieldOrder[MrcReutFieldRow];
+ ReutChSeqBaseAddrOrderCarryInvertCtl.Bits.Base_Bank_Address_Order = FieldOrder[MrcReutFieldBank];
+ ReutChSeqBaseAddrOrderCarryInvertCtl.Bits.Base_Rank_Address_Order = FieldOrder[MrcReutFieldRank];
+
+#ifdef MRC_DEBUG_PRINT
+ if (EnableDebug) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Order:\n\tField\tInput\t\tStruct\t\t\n");
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\tCol:\t0x%x\t\t0x%x\t\t\n",
+ FieldOrder[MrcReutFieldCol],
+ ReutChSeqBaseAddrOrderCarryInvertCtl.Bits.Base_Column_Address_Order
+ );
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\tRow:\t0x%x\t\t0x%x\t\t\n",
+ FieldOrder[MrcReutFieldRow],
+ ReutChSeqBaseAddrOrderCarryInvertCtl.Bits.Base_Row_Address_Order
+ );
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\tBank:\t0x%x\t\t0x%x\t\t\n",
+ FieldOrder[MrcReutFieldBank],
+ ReutChSeqBaseAddrOrderCarryInvertCtl.Bits.Base_Bank_Address_Order
+ );
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\tRank:\t0x%x\t\t0x%x\t\t\n",
+ FieldOrder[MrcReutFieldRank],
+ ReutChSeqBaseAddrOrderCarryInvertCtl.Bits.Base_Rank_Address_Order
+ );
+ }
+#endif
+ }
+
+ if (WrapTriggerEn != NULL) {
+ ReutChSeqBaseAddrOrderCarryInvertCtl.Bits.Column_Base_Wrap_Trigger_Enable = WrapTriggerEn[MrcReutFieldCol];
+ ReutChSeqBaseAddrOrderCarryInvertCtl.Bits.Row_Base_Wrap_Trigger_Enable = WrapTriggerEn[MrcReutFieldRow];
+ ReutChSeqBaseAddrOrderCarryInvertCtl.Bits.Bank_Base_Wrap_Trigger_Enable = WrapTriggerEn[MrcReutFieldBank];
+ ReutChSeqBaseAddrOrderCarryInvertCtl.Bits.Rank_Base_Wrap_Trigger_Enable = WrapTriggerEn[MrcReutFieldRank];
+#ifdef MRC_DEBUG_PRINT
+ if (EnableDebug) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "WrapT:\n\tField\tInput\t\tStruct\t\t\n");
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\tCol:\t0x%x\t\t0x%x\t\t\n",
+ WrapTriggerEn[MrcReutFieldCol],
+ ReutChSeqBaseAddrOrderCarryInvertCtl.Bits.Column_Base_Wrap_Trigger_Enable
+ );
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\tRow:\t0x%x\t\t0x%x\t\t\n",
+ WrapTriggerEn[MrcReutFieldRow],
+ ReutChSeqBaseAddrOrderCarryInvertCtl.Bits.Row_Base_Wrap_Trigger_Enable
+ );
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\tBank:\t0x%x\t\t0x%x\t\t\n",
+ WrapTriggerEn[MrcReutFieldBank],
+ ReutChSeqBaseAddrOrderCarryInvertCtl.Bits.Bank_Base_Wrap_Trigger_Enable
+ );
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\tRank:\t0x%x\t\t0x%x\t\t\n",
+ WrapTriggerEn[MrcReutFieldRank],
+ ReutChSeqBaseAddrOrderCarryInvertCtl.Bits.Rank_Base_Wrap_Trigger_Enable
+ );
+ }
+#endif
+ }
+
+ if (WrapCarryEn != NULL) {
+ ReutChSeqBaseAddrOrderCarryInvertCtl.Bits.Column_Base_Wrap_Carry_Enable = WrapCarryEn[MrcReutFieldCol];
+ ReutChSeqBaseAddrOrderCarryInvertCtl.Bits.Row_Base_Wrap_Carry_Enable = WrapCarryEn[MrcReutFieldRow];
+ ReutChSeqBaseAddrOrderCarryInvertCtl.Bits.Bank_Base_Wrap_Carry_Enable = WrapCarryEn[MrcReutFieldBank];
+ ReutChSeqBaseAddrOrderCarryInvertCtl.Bits.Rank_Base_Wrap_Carry_Enable = WrapCarryEn[MrcReutFieldRank];
+
+#ifdef MRC_DEBUG_PRINT
+ if (EnableDebug) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "WrapC:\n\tField\tInput\t\tStruct\t\t\n");
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\tCol:\t0x%x\t\t0x%x\t\t\n",
+ WrapCarryEn[MrcReutFieldCol],
+ ReutChSeqBaseAddrOrderCarryInvertCtl.Bits.Column_Base_Wrap_Carry_Enable
+ );
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\tRow:\t0x%x\t\t0x%x\t\t\n",
+ WrapCarryEn[MrcReutFieldRow],
+ ReutChSeqBaseAddrOrderCarryInvertCtl.Bits.Row_Base_Wrap_Carry_Enable
+ );
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\tBank:\t0x%x\t\t0x%x\t\t\n",
+ WrapCarryEn[MrcReutFieldBank],
+ ReutChSeqBaseAddrOrderCarryInvertCtl.Bits.Bank_Base_Wrap_Carry_Enable
+ );
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\tRank:\t0x%x\t\t0x%x\t\t\n",
+ WrapCarryEn[MrcReutFieldRank],
+ ReutChSeqBaseAddrOrderCarryInvertCtl.Bits.Rank_Base_Wrap_Carry_Enable
+ );
+ }
+#endif
+ }
+
+ if (AddrInvertEn != NULL) {
+ ReutChSeqBaseAddrOrderCarryInvertCtl.Bits.Base_Address_Invert_Rate = AddrInvertRate;
+ ReutChSeqBaseAddrOrderCarryInvertCtl.Bits.Column_Base_Address_Invert_Enable = AddrInvertEn[MrcReutFieldCol];
+ ReutChSeqBaseAddrOrderCarryInvertCtl.Bits.Row_Base_Address_Invert_Enable = AddrInvertEn[MrcReutFieldRow];
+ ReutChSeqBaseAddrOrderCarryInvertCtl.Bits.Bank_Base_Address_Invert_Enable = AddrInvertEn[MrcReutFieldBank];
+ ReutChSeqBaseAddrOrderCarryInvertCtl.Bits.Rank_Base_Address_Invert_Enable = AddrInvertEn[MrcReutFieldRank];
+
+#ifdef MRC_DEBUG_PRINT
+ if (EnableDebug) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "InvtEn:\n\tField\tInput\t\tStruct\t\t\n");
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\tCol:\t0x%x\t\t0x%x\t\t\n",
+ AddrInvertEn[MrcReutFieldCol],
+ ReutChSeqBaseAddrOrderCarryInvertCtl.Bits.Column_Base_Address_Invert_Enable
+ );
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\tRow:\t0x%x\t\t0x%x\t\t\n",
+ AddrInvertEn[MrcReutFieldRow],
+ ReutChSeqBaseAddrOrderCarryInvertCtl.Bits.Row_Base_Address_Invert_Enable
+ );
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\tBank:\t0x%x\t\t0x%x\t\t\n",
+ AddrInvertEn[MrcReutFieldBank],
+ ReutChSeqBaseAddrOrderCarryInvertCtl.Bits.Bank_Base_Address_Invert_Enable
+ );
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\tRank:\t0x%x\t\t0x%x\t\t\n",
+ AddrInvertEn[MrcReutFieldRank],
+ ReutChSeqBaseAddrOrderCarryInvertCtl.Bits.Rank_Base_Address_Invert_Enable
+ );
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\tRate:\t0x%x\t\t0x%x\t\t\n",
+ AddrInvertRate,
+ ReutChSeqBaseAddrOrderCarryInvertCtl.Bits.Base_Address_Invert_Rate
+ );
+ }
+#endif
+ }
+
+ MrcWriteCR (MrcData, CrOffset, ReutChSeqBaseAddrOrderCarryInvertCtl.Data);
+ }
+
+ if (IncRate != 0 || IncValue != 0) {
+ ReutChSeqBaseAddrIncCtl.Data = 0;
+
+ CrOffset = MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_REG +
+ (
+ (MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_REG - MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_REG)
+ * Channel
+ );
+
+ if (IncRate == 0 || IncValue == 0) {
+ ReutChSeqBaseAddrIncCtl.Data = MrcReadCR64 (MrcData, CrOffset);
+ }
+
+ if (IncRate != 0) {
+ //
+ // RANK
+ //
+ IncRateScratch = (IncRate[MrcReutFieldRank] > 31) ? (MrcLog2 (IncRate[MrcReutFieldRank] - 1)) :
+ (128 + IncRate[MrcReutFieldRank]);
+ ReutChSeqBaseAddrIncCtl.Bits.Rank_Base_Address_Update_Rate = IncRateScratch;
+ ReutChSeqBaseAddrIncCtl.Bits.Rank_Base_Address_Update_Scale = IncRateScratch >> 7;
+ //
+ // BANK
+ //
+ IncRateScratch = (IncRate[MrcReutFieldBank] > 31) ? (MrcLog2 (IncRate[MrcReutFieldBank] - 1)) :
+ (128 + IncRate[MrcReutFieldBank]);
+ ReutChSeqBaseAddrIncCtl.Bits.Bank_Base_Address_Update_Rate = IncRateScratch;
+ ReutChSeqBaseAddrIncCtl.Bits.Bank_Base_Address_Update_Scale = IncRateScratch >> 7;
+ //
+ // ROW
+ //
+ IncRateScratch = (IncRate[MrcReutFieldRow] > 15) ? (MrcLog2 (IncRate[MrcReutFieldRow] - 1)) :
+ (32 + IncRate[MrcReutFieldRow]);
+ ReutChSeqBaseAddrIncCtl.Bits.Row_Base_Address_Update_Rate = IncRateScratch;
+ ReutChSeqBaseAddrIncCtl.Bits.Row_Base_Address_Update_Scale = IncRateScratch >> 5;
+ //
+ // COL
+ //
+ IncRateScratch = (IncRate[MrcReutFieldCol] > 31) ? (MrcLog2 (IncRate[MrcReutFieldCol] - 1)) :
+ (128 + IncRate[MrcReutFieldCol]);
+ ReutChSeqBaseAddrIncCtl.Bits.Column_Base_Address_Update_Rate = IncRateScratch;
+ ReutChSeqBaseAddrIncCtl.Bits.Column_Base_Address_Update_Scale = IncRateScratch >> 7;
+
+#ifdef MRC_DEBUG_PRINT
+ if (EnableDebug) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "IncRate:\n\tField\tInput\t\tStruct\t\tScale\n");
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\tCol:\t0x%x\t\t0x%x\t\t0x%x\n",
+ IncRate[MrcReutFieldCol],
+ ReutChSeqBaseAddrIncCtl.Bits.Column_Base_Address_Update_Rate,
+ ReutChSeqBaseAddrIncCtl.Bits.Column_Base_Address_Update_Scale
+ );
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\tRow:\t0x%x\t\t0x%x\t\t0x%x\n",
+ IncRate[MrcReutFieldRow],
+ ReutChSeqBaseAddrIncCtl.Bits.Row_Base_Address_Update_Rate,
+ ReutChSeqBaseAddrIncCtl.Bits.Row_Base_Address_Update_Scale
+ );
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\tBank:\t0x%x\t\t0x%x\t\t0x%x\n",
+ IncRate[MrcReutFieldBank],
+ ReutChSeqBaseAddrIncCtl.Bits.Bank_Base_Address_Update_Rate,
+ ReutChSeqBaseAddrIncCtl.Bits.Bank_Base_Address_Update_Scale
+ );
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\tRank:\t0x%x\t\t0x%x\t\t0x%x\n",
+ IncRate[MrcReutFieldRank],
+ ReutChSeqBaseAddrIncCtl.Bits.Rank_Base_Address_Update_Rate,
+ ReutChSeqBaseAddrIncCtl.Bits.Rank_Base_Address_Update_Scale
+ );
+ }
+#endif
+ }
+
+ if (IncValue != 0) {
+ ReutChSeqBaseAddrIncCtl.Bits.Rank_Base_Address_Increment = IncValue[MrcReutFieldRank];
+ ReutChSeqBaseAddrIncCtl.Bits.Bank_Base_Address_Increment = IncValue[MrcReutFieldBank];
+ ReutChSeqBaseAddrIncCtl.Bits.Row_Base_Address_Increment = IncValue[MrcReutFieldRow];
+ ReutChSeqBaseAddrIncCtl.Bits.Column_Base_Address_Increment = IncValue[MrcReutFieldCol] & ColAddrIncMax;
+
+#ifdef MRC_DEBUG_PRINT
+ if (EnableDebug) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "IncVal:\n\tField\tInput\t\tStruct\t\t\n");
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\tCol:\t0x%x\t\t0x%x\t\t\n",
+ IncValue[MrcReutFieldCol],
+ ReutChSeqBaseAddrIncCtl.Bits.Column_Base_Address_Increment
+ );
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\tRow:\t0x%x\t\t0x%x\t\t\n",
+ IncValue[MrcReutFieldRow],
+ ReutChSeqBaseAddrIncCtl.Bits.Row_Base_Address_Increment
+ );
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\tBank:\t0x%x\t\t0x%x\t\t\n",
+ IncValue[MrcReutFieldBank],
+ ReutChSeqBaseAddrIncCtl.Bits.Bank_Base_Address_Increment
+ );
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\tRank:\t0x%x\t\t0x%x\t\t\n",
+ IncValue[MrcReutFieldRank],
+ ReutChSeqBaseAddrIncCtl.Bits.Rank_Base_Address_Increment
+ );
+ }
+#endif
+ }
+
+ MrcWriteCR64 (MrcData, CrOffset, ReutChSeqBaseAddrIncCtl.Data);
+ }
+}
+
+/**
+ Programs all the key registers to define a CPCG test
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] WDBPattern - Structure that stores start, Stop, IncRate and Dqpat for pattern.
+ @param[in] ChbitMask - Channel Bit mak for which test should be setup for.
+ @param[in] CmdPat - [0: PatWrRd (Standard Write/Read Loopback),
+ 1: PatWr (Write Only),
+ 2: PatRd (Read Only),
+ 3: PatRdWrTA (ReadWrite Turnarounds),
+ 4: PatWrRdTA (WriteRead Turnarounds),
+ 5: PatODTTA (ODT Turnaround]
+ @param[in] NumCL - Number of Cache lines
+ @param[in] LC - Loop Count exponent
+ @param[in] REUTAddress - Structure that stores start, stop and increment details for address
+ @param[in] SOE - [0: Never Stop, 1: Stop on Any Lane, 2: Stop on All Byte, 3: Stop on All Lane]
+ @param[in] WDBPattern - Structure that stores start, Stop, IncRate and Dqpat for pattern.
+ @param[in] EnCADB - Enable test to write random deselect packages on bus to create xtalk/isi
+ @param[in] EnCKE - Enable CKE power down by adding 64
+ @param[in] SubSeqWait - # of Dclks to stall at the end of a sub-sequence
+
+ @retval Nothing
+**/
+void
+SetupIOTest(
+ IN MrcParameters *const MrcData,
+ IN const U8 ChbitMask,
+ IN const U8 CmdPat,
+ IN const U16 NumCL,
+ IN const U8 LC,
+ IN const MRC_REUTAddress *const REUTAddress,
+ IN const U8 SOE,
+ IN MRC_WDBPattern *const WDBPattern,
+ IN const U8 EnCADB,
+ IN const U8 EnCKE,
+ IN U16 SubSeqWait
+ )
+{
+ const MrcDebug *Debug;
+ const MrcInput *Inputs;
+ const U8 WrapCarryEn[MrcReutFieldMax] = {0, 0, 0, 0}; // Not used in training tests
+ const U8 WrapTriggerEn[MrcReutFieldMax] = {0, 0, 0, 0}; // Not used in training tests
+ const U8 AddrInvertEn[MrcReutFieldMax] = {0, 0, 0, 0}; // Not used in training tests
+ MrcOutput *Outputs;
+ U8 Channel;
+ S8 LCeff;
+ U32 LoopCountLinear;
+ U8 Mux0;
+ U8 Reload;
+ U8 Save;
+ U8 NumCLCR;
+ U8 NumCL2CR;
+ U16 Wait;
+ U16 NumCL2;
+ U32 LMNFreq[2];
+ U32 Offset;
+ U8 SubSeqStart;
+ U8 SubSeqEnd;
+ U8 Index;
+ MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_STRUCT ReutChPatCadbCtrl;
+ MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_STRUCT ReutChSeqCfg;
+ MCSCHEDS_CR_PM_PDWN_CONFIG_STRUCT PmPdwnConfig;
+ MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_STRUCT_HSW_A0 ReutSubSeqCtl0HswA0;
+ MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_STRUCT ReutSubSeqCtl0;
+ U32 ReutSubSeqCtl0Data;
+ MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_STRUCT ReutSubSeqCtl1;
+ MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_CTRL_STRUCT ReutChPatWdbCl;
+ MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_STRUCT ReutChPatWdbClMuxCfg;
+ MCHBAR_CH0_CR_REUT_CH_ERR_CTL_STRUCT ReutChErrCtrl;
+ MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_0_STRUCT ReutChSeqDummyReadCtl;
+ struct LocalSubSeqCtl {
+ U8 ValidMask;
+ MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_STRUCT Ctl[8];
+ } SubSeq;
+
+ Outputs = &MrcData->SysOut.Outputs;
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+
+ //
+ // Prepare variables needed for both channels
+ //
+ // Check for the cases where this MUST be 1: When we manually walk through SUBSEQ ODT and TAWR
+ //
+ LCeff = LC - MrcLog2 (NumCL - 1) + 1;
+ if ((LCeff < 1) || (CmdPat == PatWrRdTA) || (CmdPat == PatODTTA)) {
+ LCeff = 1;
+ }
+
+ LoopCountLinear = 1 << (LCeff - 1);
+
+ if (NumCL > 127) {
+ NumCLCR = MrcLog2 (NumCL - 1); // Assume Exponential number
+ } else {
+ NumCLCR = (U8) NumCL + (MRC_BIT0 << 7); // Set Number of Cache Lines as linear number
+ }
+
+ NumCL2 = 2 * NumCL;
+ if (NumCL2 > 127) {
+ NumCL2CR = MrcLog2 (NumCL2 - 1); // Assume Exponential number
+ } else {
+ NumCL2CR = (U8) NumCL2 + (MRC_BIT0 << 7); // Set Number of Cache Lines as linear number
+ }
+
+ Reload = MrcLog2 (WDBPattern->IncRate - 1);
+ //
+ // @todo: 'Save' is initialized but never used.
+ //
+ Save = Reload + MrcLog2 ((WDBPattern->Stop - WDBPattern->Start - 1) & 0xFF);
+
+ if (WDBPattern->IncRate > 31) {
+ WDBPattern->IncRate = Reload;
+ } else {
+ WDBPattern->IncRate += 32;
+ }
+
+ if (EnCKE) {
+ //
+ // @todo: Need to check that PDWN is programmed already.
+ //
+ PmPdwnConfig.Data = MrcReadCR (MrcData, MCSCHEDS_CR_PM_PDWN_CONFIG_REG);
+ Wait = (U16) (PmPdwnConfig.Bits.PDWN_idle_counter + 16); // Adding extra DCKs, 16, to make sure we make it to power down.
+ if (Wait > SubSeqWait) {
+ SubSeqWait = Wait;
+ }
+ }
+
+ if (SubSeqWait > 0xFF) {
+ SubSeqWait = 0xFF;
+ }
+ //
+ // Per channel settings
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!((MRC_BIT0 << Channel) & ChbitMask)) {
+ Offset = MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_REG +
+ ((MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_REG - MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, 0); // Clear global control
+ continue;
+ }
+
+ //###########################################################
+ //
+ // Program CADB
+ //
+ //###########################################################
+ Offset = MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_REG - MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_REG) * Channel);
+ ReutChPatCadbCtrl.Data = 0;
+ ReutChPatCadbCtrl.Bits.Enable_CADB_on_Deselect = EnCADB;
+ MrcWriteCR8 (MrcData, Offset, (U8) ReutChPatCadbCtrl.Data);
+ if (EnCADB) {
+ SetupCADB (MrcData, Channel, 7, 8, 0); // LMNEn=0
+ }
+
+ //###########################################################
+ //
+ // Program Sequence
+ //
+ //###########################################################
+ SubSeqStart = SubSeqEnd = 0;
+ switch (CmdPat) {
+ case PatWrRd:
+ SubSeqEnd = 1;
+ break;
+
+ case PatWr:
+ break;
+
+ case PatRd:
+ SubSeqStart = SubSeqEnd = 1;
+ break;
+
+ case PatRdWrTA:
+ break;
+
+ case PatWrRdTA:
+ SubSeqEnd = 7;
+ break;
+
+ case PatODTTA:
+ SubSeqEnd = 3;
+ break;
+
+ default:
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "SetupIOTest: Unknown value for Pattern\n");
+ break;
+ }
+ ReutChSeqCfg.Data = 0;
+ ReutChSeqCfg.Bits.Subsequence_Start_Pointer = SubSeqStart;
+ ReutChSeqCfg.Bits.Subsequence_End_Pointer = SubSeqEnd;
+ ReutChSeqCfg.Bits.Initialization_Mode = REUT_Testing_Mode;
+ ReutChSeqCfg.Bits.Global_Control = 1;
+ ReutChSeqCfg.Bits.Enable_Dummy_Reads = MIN (
+ Outputs->EnDumRd,
+ MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Enable_Dummy_Reads_MAX
+ );
+ if (CmdPat == DimmTest) { // Inc address based on LC
+ ReutChSeqCfg.Bits.Address_Update_Rate_Mode = 1;
+ }
+ ReutChSeqCfg.Bits.Start_Test_Delay = 2;
+
+ if (
+ (Inputs->CpuModel == cmHSW && Inputs->CpuStepping < csHswC0) ||
+ (Inputs->CpuModel == cmCRW && Inputs->CpuStepping < csCrwC0) ||
+ (Inputs->CpuModel == cmHSW_ULT && Inputs->CpuStepping < csHswUltC0)
+ ) {
+ ReutChSeqCfg.Bits.Loopcount = MIN (LCeff, MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_Loopcount_MAX);
+ } else {
+ Offset = MCDFXS_CR_REUT_CH_SEQ_LOOPCOUNT_LIMIT_MCMAIN_0_REG +
+ (
+ (MCDFXS_CR_REUT_CH_SEQ_LOOPCOUNT_LIMIT_MCMAIN_1_REG - MCDFXS_CR_REUT_CH_SEQ_LOOPCOUNT_LIMIT_MCMAIN_0_REG) *
+ Channel
+ );
+ MrcWriteCR (MrcData, Offset, LoopCountLinear);
+ }
+
+ Offset = MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_REG +
+ ((MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_REG - MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_REG) * Channel);
+ MrcWriteCR64 (MrcData, Offset, ReutChSeqCfg.Data);
+ //MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "SetupIOTest: C%d REUT_CH_SEQ_CFG_0 = 0x%X %X\n", Channel, ReutChSeqCfg.Data32[1], ReutChSeqCfg.Data32[0]);
+
+ Offset = MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_0_REG +
+ ((MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_1_REG - MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_0_REG) * Channel);
+ MrcWriteCR8 (MrcData, Offset, MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_0_Local_Clear_Errors_MSK);
+
+ //###########################################################
+ //
+ // Program Sub Sequences
+ //
+ //###########################################################
+ if ((Inputs->CpuModel == cmHSW) && (Inputs->CpuStepping == csHswA0)) {
+ ReutSubSeqCtl0HswA0.Data = 0;
+ ReutSubSeqCtl0HswA0.Bits.Number_of_Cachelines = NumCLCR;
+ ReutSubSeqCtl0HswA0.Bits.Number_of_Cachelines_Scale = NumCLCR >> 7;
+ ReutSubSeqCtl0HswA0.Bits.Reset_Current_Base_Address_To_Start = 1;
+ ReutSubSeqCtl0HswA0.Bits.Subsequence_Wait = SubSeqWait;
+ ReutSubSeqCtl0Data = ReutSubSeqCtl0HswA0.Data;
+ } else {
+ ReutSubSeqCtl0.Data = 0;
+ ReutSubSeqCtl0.Bits.Number_of_Cachelines = NumCLCR;
+ ReutSubSeqCtl0.Bits.Number_of_Cachelines_Scale = NumCLCR >> 7;
+ ReutSubSeqCtl0.Bits.Reset_Current_Base_Address_To_Start = 1;
+ ReutSubSeqCtl0.Bits.Subsequence_Wait = SubSeqWait;
+ ReutSubSeqCtl0Data = ReutSubSeqCtl0.Data;
+ }
+
+ ReutSubSeqCtl1.Data = ReutSubSeqCtl0Data;
+ ReutSubSeqCtl1.Bits.Number_of_Cachelines = NumCL2CR;
+ ReutSubSeqCtl1.Bits.Number_of_Cachelines_Scale = NumCL2CR >> 7;
+
+ switch (CmdPat) {
+ case PatWrRdTA:
+ SubSeq.Ctl[0].Data = ReutSubSeqCtl0Data;
+ SetSubsequenceType (MrcData, &SubSeq.Ctl[0].Data, BWr); // Write CMD
+ for (Index = 1; Index <= 6; Index++) {
+ SubSeq.Ctl[Index].Data = ReutSubSeqCtl1.Data;
+ SetSubsequenceType (MrcData, &SubSeq.Ctl[Index].Data, BRdWr); // Read-Write CMD
+ }
+ SubSeq.Ctl[7].Data = ReutSubSeqCtl0Data;
+ SetSubsequenceType (MrcData, &SubSeq.Ctl[7].Data, BRd); // Read CMD
+ SubSeq.ValidMask = 0xFF;
+ break;
+
+ case PatRdWrTA:
+ SubSeq.Ctl[0].Data = ReutSubSeqCtl1.Data;
+ SetSubsequenceType (MrcData, &SubSeq.Ctl[0].Data, BWrRd); // Write-Read CMD
+ SubSeq.ValidMask = 0x01;
+ break;
+
+ case PatODTTA:
+ SubSeq.Ctl[0].Data = ReutSubSeqCtl0Data;
+ SetSubsequenceType (MrcData, &SubSeq.Ctl[0].Data, BWr); // Write CMD
+
+ SubSeq.Ctl[1].Data = ReutSubSeqCtl1.Data;
+ SetSubsequenceType (MrcData, &SubSeq.Ctl[1].Data, BRdWr); // Read-Write CMD
+
+ SubSeq.Ctl[2].Data = ReutSubSeqCtl0Data;
+ SetSubsequenceType (MrcData, &SubSeq.Ctl[2].Data, BRd); // Read CMD
+
+ SubSeq.Ctl[3].Data = ReutSubSeqCtl1.Data;
+ SetSubsequenceType (MrcData, &SubSeq.Ctl[3].Data, BWrRd); // Write-Read CMD
+
+ SubSeq.ValidMask = 0x0F;
+ break;
+
+ default:
+ SubSeq.Ctl[0].Data = ReutSubSeqCtl0Data;
+ SetSubsequenceType (MrcData, &SubSeq.Ctl[0].Data, BWr); // Write CMD
+
+ SubSeq.Ctl[1].Data = ReutSubSeqCtl0Data;
+ SetSubsequenceType (MrcData, &SubSeq.Ctl[1].Data, BRd); // Read CMD
+
+ SubSeq.ValidMask = 0x03;
+ break;
+ }
+ Offset = MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_REG +
+ ((MCDFXS_CR_REUT_CH1_SUBSEQ_CTL_MCMAIN_0_REG - MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_REG) * Channel);
+ for (Index = 0; Index < 8; Index++) {
+ if (SubSeq.ValidMask & (MRC_BIT0 << Index)) {
+ MrcWriteCR (MrcData, Offset, SubSeq.Ctl[Index].Data);
+ Offset += MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_1_REG - MCDFXS_CR_REUT_CH0_SUBSEQ_CTL_MCMAIN_0_REG;
+ } else {
+ break;
+ }
+ }
+
+ //###########################################################
+ //
+ // Program Sequence Address
+ //
+ //###########################################################
+ MrcProgramSequenceAddress (
+ MrcData,
+ Channel,
+ REUTAddress->Start,
+ REUTAddress->Stop,
+ REUTAddress->Order,
+ REUTAddress->IncRate,
+ REUTAddress->IncVal,
+ WrapCarryEn,
+ WrapTriggerEn,
+ AddrInvertEn,
+ 0,
+ FALSE
+ );
+
+ //###########################################################
+ //
+ // Program Write Data Buffer Related Entries
+ //
+ //###########################################################
+ ReutChPatWdbCl.Data = 0;
+ ReutChPatWdbCl.Bits.WDB_End_Pointer = WDBPattern->Stop;
+ ReutChPatWdbCl.Bits.WDB_Start_Pointer = WDBPattern->Start;
+ ReutChPatWdbCl.Bits.WDB_Increment_Rate = WDBPattern->IncRate;
+ ReutChPatWdbCl.Bits.WDB_Increment_Scale = WDBPattern->IncRate >> MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Increment_Rate_WID;
+ Offset = MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_CTRL_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_CTRL_REG - MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_CTRL_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, ReutChPatWdbCl.Data);
+
+ ReutChPatWdbClMuxCfg.Data = 0;
+
+ //
+ // Enable LMN in either LMN mode or CADB -to create lots of supply noise
+ //
+ Mux0 = ((WDBPattern->DQPat == LMNVa) || (WDBPattern->DQPat == CADB)) ? LMNMode : LFSRMode;
+
+ ReutChPatWdbClMuxCfg.Bits.ECC_Data_Source_Sel = 1;
+ ReutChPatWdbClMuxCfg.Bits.Mux2_Control = LFSRMode;
+ ReutChPatWdbClMuxCfg.Bits.Mux1_Control = LFSRMode;
+ ReutChPatWdbClMuxCfg.Bits.Mux0_Control = Mux0; // ECC, Select LFSR
+ //
+ // Program LFSR Save/Restore. Too complex unless everything is power of 2
+ //
+ if ((CmdPat == PatODTTA) || (CmdPat == PatWrRdTA)) {
+ ReutChPatWdbClMuxCfg.Bits.Reload_LFSR_Seed_Rate = MrcLog2 (NumCL - 1) + 1;
+ ReutChPatWdbClMuxCfg.Bits.Save_LFSR_Seed_Rate = 1;
+ }
+
+ Offset = MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_REG - MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, ReutChPatWdbClMuxCfg.Data);
+
+ //
+ // Currently, not planning to use the Inversion Mask
+ //
+ Offset = MCHBAR_CH0_CR_REUT_CH_PAT_WDB_INV_REG + ((MCHBAR_CH1_CR_REUT_CH_PAT_WDB_INV_REG - MCHBAR_CH0_CR_REUT_CH_PAT_WDB_INV_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, 0);
+
+ //###########################################################
+ //
+ // Program Error Checking
+ //
+ //###########################################################
+
+ //
+ // Enable selective_error_enable_chunk and selective_error_enable_cacheline, mask later
+ // the bits we don't want to check.
+ //
+ Offset = MCHBAR_CH0_CR_REUT_CH_ERR_CTL_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_ERR_CTL_REG - MCHBAR_CH0_CR_REUT_CH_ERR_CTL_REG) * Channel);
+ ReutChErrCtrl.Data = 0;
+ ReutChErrCtrl.Bits.Stop_on_Nth_Error = 1;
+ ReutChErrCtrl.Bits.Stop_On_Error_Control = SOE;
+ ReutChErrCtrl.Bits.Selective_Error_Enable_Chunk = MCHBAR_CH0_CR_REUT_CH_ERR_CTL_Selective_Error_Enable_Chunk_MAX;
+ ReutChErrCtrl.Bits.Selective_Error_Enable_Cacheline = MCHBAR_CH0_CR_REUT_CH_ERR_CTL_Selective_Error_Enable_Cacheline_MAX;
+ MrcWriteCR (MrcData, Offset, ReutChErrCtrl.Data);
+
+ Offset = MCHBAR_CH0_CR_REUT_CH_ERR_DATA_MASK_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_ERR_DATA_MASK_REG - MCHBAR_CH0_CR_REUT_CH_ERR_DATA_MASK_REG) * Channel);
+ MrcWriteCR64 (MrcData, Offset, 0);
+
+ Offset = MCHBAR_CH0_CR_REUT_CH_ERR_ECC_MASK_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_ERR_ECC_MASK_REG - MCHBAR_CH0_CR_REUT_CH_ERR_ECC_MASK_REG) * Channel);
+ MrcWriteCR8 (MrcData, Offset, 0);
+
+ //###########################################################
+ //
+ // Program Dummy Read
+ //
+ //###########################################################
+ if (Outputs->EnDumRd) {
+ //
+ // REUT traffic only uses BA[1:0] - Mask BANK that will not be used
+ //
+ Offset = MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_MASK_MCMAIN_0_REG +
+ (
+ (MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_MASK_MCMAIN_1_REG - MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_MASK_MCMAIN_0_REG) *
+ Channel
+ );
+ MrcWriteCR8 (MrcData, Offset, 0xFC);
+
+ //
+ // Rotated from 40nS to 200nS
+ //
+ if (Outputs->Qclkps > 0) {
+ LMNFreq[0] = (40000 / Outputs->Qclkps);
+ LMNFreq[1] = (200000 / Outputs->Qclkps);
+ } else {
+ LMNFreq[0] = LMNFreq[1] = 0xFF;
+ }
+
+ ReutChSeqDummyReadCtl.Data = 0;
+ ReutChSeqDummyReadCtl.Bits.L_counter = LMNFreq[0];
+ ReutChSeqDummyReadCtl.Bits.M_counter = LMNFreq[0];
+ ReutChSeqDummyReadCtl.Bits.N_Counter = LMNFreq[1];
+ ReutChSeqDummyReadCtl.Bits.Enable_Sweep_Frequency = 1;
+ //
+ // Chirp Freq from 5 to 25 MHz
+ //
+ Offset = MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_0_REG + (
+ (MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_1_REG - MCDFXS_CR_REUT_CH_SEQ_DUMMYREAD_CTL_MCMAIN_0_REG) * Channel
+ );
+ MrcWriteCR (MrcData, Offset, ReutChSeqDummyReadCtl.Data);
+ }
+ }
+ //
+ // Always do a ZQ Short before the beginning of a test
+ //
+ MrcIssueZQ (MrcData, ChbitMask, MRC_ZQ_SHORT);
+
+ return;
+}
+
+/**
+ This function sets up a test with CADB for the given channel mask.
+
+ @param[in,out] MrcData - Pointer to MRC global data.
+ @param[in] ChbitMask - Bit masks of channels to enable for the test.
+ @param[in] LC - Exponential umber of loops to run the test.
+ @param[in] SOE - Error handling switch for test.
+ @param[in] EnCADB - Switch to enable CADB
+ @param[in] EnCKE - Switch to enable CKE.
+
+ @retval Nothing
+**/
+void
+SetupIOTestCADB (
+ IN OUT MrcParameters *const MrcData,
+ IN const U8 ChbitMask,
+ IN const U8 LC,
+ IN const U8 SOE,
+ IN const U8 EnCADB,
+ IN const U8 EnCKE
+ )
+{
+ const MRC_REUTAddress REUTAddress = {
+ // Rank, Bank, Row, Col
+ { 0, 0, 0, 0 }, // Start
+ { 0, 7, 2047, 1023 }, // Stop
+ { 0, 0, 0, 0 }, // Order
+ { 32, 3, 3, 0 }, // IncRate
+ { 1, 1, 73, 53 } // IncValue
+ };
+ MRC_WDBPattern WDBPattern;
+ MrcOutput *Outputs;
+ U16 NumCL;
+
+ Outputs = &MrcData->SysOut.Outputs;
+ WDBPattern.IncRate = 4;
+ WDBPattern.Start = 0;
+ WDBPattern.Stop = 9;
+ WDBPattern.DQPat = CADB;
+
+ NumCL = 128;
+
+ SetupIOTest (MrcData, ChbitMask, PatWrRd, NumCL, LC, &REUTAddress, SOE, &WDBPattern, EnCADB, EnCKE, 0);
+
+ Outputs->DQPatLC = LC - 2 - 3 + 1;
+ if (Outputs->DQPatLC < 1) {
+ Outputs->DQPatLC = 1;
+ }
+
+ Outputs->DQPat = CADB;
+ return;
+}
+
+/**
+ This function sets up a basic victim-aggressor test for the given channel mask.
+
+ @param[in,out] MrcData - Pointer to MRC global data.
+ @param[in] ChbitMask - Bit masks of channels to enable for the test.
+ @param[in] LC - Exponential umber of loops to run the test.
+ @param[in] SOE - Error handling switch for test.
+ @param[in] EnCADB - Switch to enable CADB
+ @param[in] EnCKE - Switch to enable CKE.
+ @param[in] Spread - Stopping point of the pattern.
+
+ @retval Nothing
+**/
+void
+SetupIOTestBasicVA (
+ IN OUT MrcParameters *const MrcData,
+ IN const U8 ChbitMask,
+ IN const U8 LC,
+ IN const U8 SOE,
+ IN const U8 EnCADB,
+ IN const U8 EnCKE,
+ IN const U32 Spread
+ )
+{
+ const MRC_REUTAddress REUTAddress = {
+ // Rank, Bank, Row, Col
+ { 0, 0, 0, 0 }, // Start
+ { 0, 0, 0, 1023 }, // Stop
+ { 0, 0, 0, 0 }, // Order
+ { 32, 0, 0, 0 }, // IncRate
+ { 1, 0, 0, 1 } // IncValue
+ };
+
+ MRC_WDBPattern WDBPattern;
+ MrcOutput *Outputs;
+ U16 NumCL;
+
+ Outputs = &MrcData->SysOut.Outputs;
+ WDBPattern.IncRate = 4;
+ WDBPattern.Start = 0;
+ WDBPattern.Stop = Spread - 1;
+ WDBPattern.DQPat = BasicVA;
+
+ NumCL = 128;
+
+ SetupIOTest (MrcData, ChbitMask, PatWrRd, NumCL, LC, &REUTAddress, SOE, &WDBPattern, EnCADB, EnCKE, 0);
+
+ Outputs->DQPatLC = LC - 8 + 1;
+ if (Outputs->DQPatLC < 1) {
+ Outputs->DQPatLC = 1;
+ }
+
+ Outputs->DQPat = BasicVA;
+ return;
+}
+
+/**
+ This function sets up a DQ test for the given channel mask.
+
+ @param[in,out] MrcData - Pointer to MRC global data.
+ @param[in] ChbitMask - Bit masks of channels to enable for the test.
+ @param[in] LC - Exponential umber of loops to run the test.
+ @param[in] SOE - Error handling switch for test.
+ @param[in] EnCADB - Switch to enable CADB
+ @param[in] EnCKE - Switch to enable CKE.
+
+ @retval Nothing
+**/
+void
+SetupIOTestDQ (
+ IN OUT MrcParameters *const MrcData,
+ IN const U8 ChbitMask,
+ IN const U8 LC,
+ IN const U8 SOE,
+ IN const U8 EnCADB,
+ IN const U8 EnCKE
+ )
+{
+ const MRC_REUTAddress REUTAddress = {{0, 0, 0, 0}, // Start
+ {0, 1, 512, 1023}, // Stop
+ {0, 0, 0, 0}, // Order
+ {2047, 255, 255, 0}, // IncRate
+ {1, 1, 512, 1}}; // IncValue
+ MRC_WDBPattern WDBPattern;
+ MrcOutput *Outputs;
+ U16 NumCL;
+
+ Outputs = &MrcData->SysOut.Outputs;
+ WDBPattern.IncRate = 32;
+ WDBPattern.Start = 0;
+ WDBPattern.Stop = 63;
+ WDBPattern.DQPat = SegmentWDB;
+
+ NumCL = 256;
+
+ SetupIOTest (MrcData, ChbitMask, PatWrRd, NumCL, LC, &REUTAddress, SOE, &WDBPattern, EnCADB, EnCKE, 0);
+
+ Outputs->DQPatLC = LC - 8 - 3 + 1;
+ if (Outputs->DQPatLC < 1) {
+ Outputs->DQPatLC = 1;
+ }
+
+ Outputs->DQPat = SegmentWDB;
+ return;
+}
+
+/**
+ This function sets up a test with CADB for the given channel mask.
+
+ @param[in,out] MrcData - Pointer to MRC global data.
+ @param[in] ChbitMask - Bit masks of channels to enable for the test.
+ @param[in] LC - Exponential umber of loops to run the test.
+ @param[in] SOE - Error handling switch for test.
+ @param[in] EnCADB - Switch to enable CADB
+ @param[in] EnCKE - Switch to enable CKE.
+
+ @retval Nothing
+**/
+void
+SetupIOTestC2C (
+ IN OUT MrcParameters *const MrcData,
+ IN const U8 ChbitMask,
+ IN const U8 LC,
+ IN const U8 SOE,
+ IN const U8 EnCADB,
+ IN const U8 EnCKE
+ )
+{
+ const MRC_REUTAddress REUTAddress = {{0, 0, 0, 0}, // Start
+ {0, 0, 0, 1023}, // Stop
+ {0, 0, 0, 0}, // Order
+ {2047, 0, 0, 0}, // IncRate
+ {1, 0, 0, 1}}; // IncValue
+ MRC_WDBPattern WDBPattern;
+ MrcOutput *Outputs;
+
+ Outputs = &MrcData->SysOut.Outputs;
+ WDBPattern.IncRate = 32;
+ WDBPattern.Start = 0;
+ WDBPattern.Stop = 63;
+ WDBPattern.DQPat = SegmentWDB;
+
+ SetupIOTest (MrcData, ChbitMask, PatWrRd, 32, LC, &REUTAddress, SOE, &WDBPattern, EnCADB, EnCKE, 0);
+
+ Outputs->DQPatLC = LC - 5 + 1;
+ if (Outputs->DQPatLC < 1) {
+ Outputs->DQPatLC = 1;
+ }
+
+ Outputs->DQPat = SegmentWDB;
+ return;
+}
+
+/**
+ This function sets up a MPR test for the given channel mask.
+
+ @param[in,out] MrcData - Pointer to MRC global data.
+ @param[in] ChbitMask - Bit masks of channels to enable for the test.
+ @param[in] LC - Exponential umber of loops to run the test.
+ @param[in] SOE - Error handling switch for test.
+ @param[in] EnCADB - Switch to enable CADB
+ @param[in] EnCKE - Switch to enable CKE.
+
+ @retval Nothing
+**/
+void
+SetupIOTestMPR (
+ IN OUT MrcParameters *const MrcData,
+ IN const U8 ChbitMask,
+ IN const U8 LC,
+ IN const U8 SOE,
+ IN const U8 EnCADB,
+ IN const U8 EnCKE
+ )
+{
+ const MRC_REUTAddress REUTAddress_ddr = {
+ { 0, 0, 0, 0 }, // Start
+ { 0, 0, 0, 1023 }, // Stop
+ { 0, 0, 0, 0 }, // Order
+ { 32, 0, 0, 0 }, // IncRate
+ { 1, 0, 0, 1 } // IncValue
+ };
+ const MRC_REUTAddress REUTAddress_lpddr = {
+ { 0, 4, 0, 0 }, // Start
+ { 0, 4, 0, 0 }, // Stop
+ { 0, 0, 0, 0 }, // Order
+ { 0, 0, 0, 0 }, // IncRate
+ { 0, 0, 0, 0 } // IncValue
+ };
+ const MRC_REUTAddress *ReutAddress;
+ MRC_WDBPattern WDBPattern;
+ MrcOutput *Outputs;
+ U16 NumCL;
+
+ Outputs = &MrcData->SysOut.Outputs;
+ WDBPattern.IncRate = 4;
+ WDBPattern.Start = 0;
+ WDBPattern.Stop = 9;
+ WDBPattern.DQPat = BasicVA;
+
+ NumCL = 128;
+
+ if (Outputs->DdrType == MRC_DDR_TYPE_LPDDR3) {
+ ReutAddress = &REUTAddress_lpddr;
+ } else {
+ ReutAddress = &REUTAddress_ddr;
+ }
+
+ SetupIOTest (MrcData, ChbitMask, PatRd, NumCL, LC, ReutAddress, SOE, &WDBPattern, EnCADB, EnCKE, 0);
+
+ Outputs->DQPatLC = 1;
+ Outputs->DQPat = BasicVA;
+ return;
+}
+
+/**
+ Runs one or more REUT tests (based on TestType)
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] ChbitMask - Channel Bit mask for which test should be setup for.
+ @param[in] DQPat - [0: BasicVA
+ 1: SegmentWDB
+ 2: CADB
+ 3: TurnAround
+ 4: LMNVa
+ 5: TurnAroundWR
+ 6: TurnAroundODT
+ 7: RdRdTA]
+ @param[in] SeqLCs - An array of one or more loopcounts.
+ @param[in] ClearErrors - Decision to clear or not errors.
+ @param[in] Mode - Allows for different types of modes for margining
+ {Bit0: PhLock (keep all bytes within in ch in phase),
+ Bit1: Ch2Ch Data out of phase (LFSR seed)
+ Bits 15:2: Reserved}
+
+ @retval Returns ch errors
+**/
+U8
+RunIOTest (
+ IN MrcParameters *const MrcData,
+ IN const U8 ChbitMask,
+ IN const U8 DQPat,
+ IN const U8 *const SeqLCs,
+ IN const U8 ClearErrors,
+ IN const U16 Mode
+ )
+{
+ const MrcDebug *Debug;
+ MrcInput *Inputs;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ U8 ch;
+ U8 Reload;
+ U8 NumTests;
+ U8 t;
+ U8 IncRate;
+ U8 TestSOE;
+ U8 TestDoneStatus;
+ U8 ErrorStatus;
+ U32 CRValue;
+ U32 TestRand;
+ U32 Offset;
+ U32 LoopCountLinear;
+ U8 tRDRD_dr_Min[MAX_CHANNEL];
+ U8 TurnAroundOffset;
+ // When we segment the WDB, we run a normal 2 LFSR VA pattern on the first 10 entries
+ // The last 54 entries are used for a more complex 3 LFSR pattern
+ // In this mode:
+ // SeqLC is usually [0: host.DQPatLC, 1: host.DQPatLC, 2: host.DQPatLC+4, 3: host.DQPatLC+2]
+ //
+ // Anotherwords:
+ // The first 10 entries of the LFSR are run for twice, each for 2^DQPatLC
+ // and the WDB is incremented every 25 cachelines
+ //
+ // 25 was chosen since 10 Entry * 25 cachelines = 250.
+ // This is pretty close to 256, a power of 2, which should be roughly uniform coverage across all entries
+ //
+ // The second 54 entries of the LFSR are run twice
+ // Once with 2^(DQPatLC+4) and the WDB is incremented every 19 cachelines
+ // Once with 2^(DQPatLC+2) and the WDB is incremented every 10 cachelines
+ // Again, 19*54 = 1026 and 10*54 = 540 and both of these numbers are close
+ // to power of 2 and will provide roughly uniform coverage
+ //
+ // Each entry in the first 10 entries is hit 2 ^ (DQPatLC + NumCachelines + 1) / 10
+ // or 2 ^ (DQPatLC + NumCachelines -2.32)
+ //
+ // Each entry in the second 54 entries is hit 2 ^ (DQPatLC + NumCachelines + 4.32) / 54
+ // or ~2 ^ (DQPatLC + NumCachelines -1.43)
+ // or ~2x more than the first 10 entries
+
+ U8 WDBIncRates[8];
+ U8 WDBStart[8];
+ U8 WDBStop[8];
+
+ MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_STRUCT ReutGlobalCtl;
+ MCDFXS_CR_REUT_GLOBAL_ERR_MCMAIN_STRUCT ReutGlobalErr;
+ MCHBAR_CH0_CR_REUT_CH_ERR_CTL_STRUCT ReutChErrCtl;
+ MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_CTRL_STRUCT ReutChPatWdbCl;
+ MCHBAR_CH0_CR_TC_BANK_RANK_A_STRUCT TcBankRankA[MAX_CHANNEL];
+
+ TestSOE = 0;
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerOut = &Outputs->Controller[0];
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ MrcOemMemorySet (WDBIncRates, 1, sizeof (WDBIncRates));
+ MrcOemMemorySet (WDBStart, 0, sizeof (WDBStart));
+ MrcOemMemorySet (WDBStop, 9, sizeof (WDBStop));
+ MrcOemMemorySetDword ((U32 *) TcBankRankA, 0, sizeof (TcBankRankA) / sizeof (TcBankRankA[0]));
+ ReutGlobalErr.Data = 0;
+ ErrorStatus = 0;
+
+ TestRand = 0xBAD00451;
+ NumTests = 1;
+ if (DQPat == SegmentWDB) {
+ NumTests = 4;
+ WDBIncRates[3] = 10;
+ WDBIncRates[2] = 19;
+ WDBIncRates[1] = 25;
+ WDBIncRates[0] = 25;
+
+ WDBStart[3] = 10;
+ WDBStart[2] = 10;
+ WDBStop[3] = 63;
+ WDBStop[2] = 63;
+ } else if (DQPat == CADB) {
+ NumTests = 7;
+ } else if (DQPat == TurnAroundWR) {
+ NumTests = 8;
+ } else if (DQPat == TurnAroundODT) {
+ NumTests = 4;
+ } else if (DQPat == RdRdTA) {
+ NumTests = 2;
+ for (ch = 0; ch < MAX_CHANNEL; ch++) {
+ if (!((MRC_BIT0 << ch) & ChbitMask)) {
+ continue;
+ }
+
+ TcBankRankA[ch].Data = ControllerOut->Channel[ch].MchbarBANKRANKA;
+ }
+ } else if (DQPat == RdRdTA_All) {
+ NumTests = 8;
+ for (ch = 0; ch < MAX_CHANNEL; ch++) {
+ if (((1 << ch) & ChbitMask) == 0) {
+ continue;
+ }
+
+ TcBankRankA[ch].Data = ControllerOut->Channel[ch].MchbarBANKRANKA;
+ tRDRD_dr_Min[ch] = (U8) TcBankRankA[ch].Bits.tRDRD_dr; // save the min value allowed
+ }
+ }
+
+ for (t = 0; t < NumTests; t++) {
+ //MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "RunIOTest: t = %d\n",t);
+ Reload = MrcLog2 (WDBIncRates[t] - 1);
+ if (WDBIncRates[t] > 31) {
+ WDBIncRates[t] = Reload;
+ } else {
+ WDBIncRates[t] += 32;
+ }
+
+ for (ch = 0; ch < MAX_CHANNEL; ch++) {
+ if (!((MRC_BIT0 << ch) & ChbitMask)) {
+ continue;
+ }
+ //
+ // Check for SOE == NTHSOE, ALSOE
+ // @todo: I still feel we need to exit if we get errors on any test
+ //
+ TestSOE = 0;
+ Offset = MCHBAR_CH0_CR_REUT_CH_ERR_CTL_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_ERR_CTL_REG - MCHBAR_CH0_CR_REUT_CH_ERR_CTL_REG) * ch);
+ ReutChErrCtl.Data = MrcReadCR (MrcData, Offset);
+ CRValue = ReutChErrCtl.Bits.Stop_On_Error_Control;
+ if ((CRValue == NTHSOE) || (CRValue == ALSOE)) {
+ TestSOE = 1; // SOE bits are set
+ }
+
+ if (DQPat == SegmentWDB) {
+ Offset = MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_CTRL_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_CTRL_REG - MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_CTRL_REG) * ch);
+ ReutChPatWdbCl.Data = 0;
+ ReutChPatWdbCl.Bits.WDB_Start_Pointer = WDBStart[t];
+ ReutChPatWdbCl.Bits.WDB_End_Pointer = WDBStop[t];
+ ReutChPatWdbCl.Bits.WDB_Increment_Rate = WDBIncRates[t];
+ ReutChPatWdbCl.Bits.WDB_Increment_Scale = WDBIncRates[t] >> MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_CTRL_WDB_Increment_Rate_WID;
+ MrcWriteCR (MrcData, Offset, ReutChPatWdbCl.Data);
+
+ //
+ // Skip programming LFSR Save/Restore. Too complex unless power of 2
+ //
+ if (
+ (Inputs->CpuModel == cmHSW && Inputs->CpuStepping < csHswC0) ||
+ (Inputs->CpuModel == cmCRW && Inputs->CpuStepping < csCrwC0) ||
+ (Inputs->CpuModel == cmHSW_ULT && Inputs->CpuStepping < csHswUltC0)
+ ) {
+ //
+ // Program desired loopcount
+ //
+ Offset = MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_REG + 2 +
+ ((MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_REG - MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_REG) * ch);
+ MrcWriteCR8 (MrcData, Offset, (SeqLCs[t] + 1));
+ } else {
+ LoopCountLinear = 1 << SeqLCs[t];
+ Offset = MCDFXS_CR_REUT_CH_SEQ_LOOPCOUNT_LIMIT_MCMAIN_0_REG +
+ (
+ (MCDFXS_CR_REUT_CH_SEQ_LOOPCOUNT_LIMIT_MCMAIN_1_REG - MCDFXS_CR_REUT_CH_SEQ_LOOPCOUNT_LIMIT_MCMAIN_0_REG) *
+ ch
+ );
+ MrcWriteCR (MrcData, Offset, LoopCountLinear);
+ }
+
+ } else if (DQPat == CADB) {
+ SetupCADB (MrcData, ch, NumTests, t, 0); // LMNEn=0
+ } else if ( (DQPat == TurnAroundWR) || (DQPat == TurnAroundODT) ) {
+ //
+ // Program which subseq to run
+ //
+ Offset = MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_REG + 3 +
+ ((MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_REG - MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_REG) * ch);
+ MrcWriteCR8 (MrcData, Offset, (t << 4) + t);
+
+ //
+ // Program RankInc Rate
+ //
+ IncRate =
+ (
+ ((DQPat == TurnAroundWR) && ((t == 0) || (t == 7))) ||
+ ((DQPat == TurnAroundODT) && ((t == 0) || (t == 2)))
+ ) ? 0 : 1;
+
+ Offset = MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_REG +
+ ((
+ MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_REG - MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_REG
+ ) * ch
+ );
+ MrcWriteCR8 (MrcData, Offset + 7, 128 + IncRate); // 0x80+IncRate
+ CRValue = MrcReadCR (MrcData, Offset);
+ //
+ // Program bit 19, 16:12 to IncRate (assume linear mode)
+ //
+ CRValue = MrcBitSwap (CRValue, (128 + IncRate), 12, 8);
+ MrcWriteCR (MrcData, Offset, CRValue);
+ } else if (DQPat == RdRdTA) {
+ //
+ // Program tRDRD parameter
+ //
+ Offset = MCHBAR_CH0_CR_TC_BANK_RANK_A_REG +
+ ((MCHBAR_CH1_CR_TC_BANK_RANK_A_REG - MCHBAR_CH0_CR_TC_BANK_RANK_A_REG) * ch);
+ TcBankRankA[ch].Bits.tRDRD = (t == 0) ? 4 : 5;
+ MrcWriteCR (MrcData, Offset, TcBankRankA[ch].Data);
+ } else if (DQPat == RdRdTA_All) {
+ //
+ // Program tRDRD for SR and DR
+ // Run 8 tests, Covering tRDRD_sr = 4,5,6,7 and tRDRD_dr = Min,+1,+2,+3
+ //
+ TurnAroundOffset = (t % 4);
+ Offset = MCHBAR_CH0_CR_TC_BANK_RANK_A_REG +
+ ((MCHBAR_CH1_CR_TC_BANK_RANK_A_REG - MCHBAR_CH0_CR_TC_BANK_RANK_A_REG) * ch);
+ TcBankRankA[ch].Bits.tRDRD = 4 + TurnAroundOffset;
+ TcBankRankA[ch].Bits.tRDRD_dr = tRDRD_dr_Min[ch] + TurnAroundOffset;
+
+ MrcWriteCR (MrcData, Offset, TcBankRankA[ch].Data);
+ //
+ // Program RankInc Rate
+ //
+ IncRate = (t > 3)? 0 : 31; // this field + 1
+
+ Offset = MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_REG +
+ (
+ (
+ MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_1_REG - MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_INC_CTL_MCMAIN_0_REG
+ ) * ch
+ );
+ MrcWriteCR8 (MrcData, Offset + 7, IncRate | MRC_BIT7); // Linear Rank Address Update Rate
+ }
+ }
+
+ //###########################################################
+ //
+ // Start Test and Poll on completion
+ //
+ //###########################################################
+ //
+ // IO Reset neded before starting test.
+ //
+ IoReset (MrcData);
+
+ ReutGlobalCtl.Data = 0;
+ ReutGlobalCtl.Bits.Global_Start_Test = 1;
+ if (ClearErrors && (t == 0)) {
+ ReutGlobalCtl.Bits.Global_Clear_Errors = 1;
+ }
+
+ MrcWriteCR (MrcData, MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_REG, ReutGlobalCtl.Data);
+
+ //
+ // Wait until Channel test done status matches ChbitMask
+ //
+ do {
+ ReutGlobalErr.Data = MrcReadCR (MrcData, MCDFXS_CR_REUT_GLOBAL_ERR_MCMAIN_REG);
+ TestDoneStatus = (U8) ((ReutGlobalErr.Bits.Channel_Test_Done_Status_1 << 1) | ReutGlobalErr.Bits.Channel_Test_Done_Status_0);
+ } while ((TestDoneStatus & ChbitMask) != ChbitMask);
+
+ //
+ // Exit if SOE and Channel_Test_Done_Status bits matches ChbitMask
+ //
+ ErrorStatus = (U8) ((ReutGlobalErr.Bits.Channel_Error_Status_1 << 1) | ReutGlobalErr.Bits.Channel_Error_Status_0);
+ if ((ErrorStatus & ChbitMask) && TestSOE) {
+ //MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "ERROR IN RunIOTest: REUT_GLOBAL_CTRL = %Xh, REUT_GLOBAL_ERR %Xh\n", ReutGlobalErr.Data, ErrorStatus);
+ return (ReutGlobalErr.Data & ChbitMask);
+ }
+ }
+
+ if ((DQPat == RdRdTA) || (DQPat == RdRdTA_All)) {
+ //
+ // Restore original tRDRD value
+ //
+ for (ch = 0; ch < MAX_CHANNEL; ch++) {
+ if (!((MRC_BIT0 << ch) & ChbitMask)) {
+ continue;
+ }
+
+ Offset = MCHBAR_CH0_CR_TC_BANK_RANK_A_REG +
+ ((MCHBAR_CH1_CR_TC_BANK_RANK_A_REG - MCHBAR_CH0_CR_TC_BANK_RANK_A_REG) * ch);
+ MrcWriteCR (MrcData, Offset, ControllerOut->Channel[ch].MchbarBANKRANKA);
+ }
+ }
+
+ return (ReutGlobalErr.Data & ChbitMask);
+}
+
+/**
+ Programs REUT to run on the selected physical ranks.
+
+ @param[in] MrcData - Pointer to MRC global data.
+ @param[in] ch - Channel to enable.
+ @param[in] RankBitMask - Bit mask of ranks to enable.
+ @param[in] RankFeatureEnable - RankFeatureEnable is a bit mask that can enable CKE, Refresh or ZQ
+ RankFeatureEnable[0] enables Refresh on all non-selected ranks
+ RankFeatureEnable[1] enables Refresh on all ranks
+ RankFeatureEnable[2] enables ZQ on all non-selected ranks
+ RankFeatureEnable[3] enables ZQ on all ranks
+ RankFeatureEnable[4] enables CKE on all non-selected ranks
+ RankFeatureEnable[5] enables CKE on all ranks
+
+ @retval Bit mask of channel enabled if rank in the channel exists.
+**/
+U8
+SelectReutRanks (
+ IN MrcParameters *const MrcData,
+ IN const U8 ch,
+ IN U8 RankBitMask,
+ IN const U8 RankFeatureEnable
+ )
+{
+ U32 Offset;
+ U8 En;
+ U8 rank;
+ U8 RankCount;
+ MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_STRUCT ReutChSeqCfg;
+ MCHBAR_CH0_CR_REUT_CH_MISC_REFRESH_CTRL_STRUCT ReutChMiscRefreshCtrl;
+ MCHBAR_CH0_CR_REUT_CH_MISC_ZQ_CTRL_STRUCT ReutChMiscZqCtrl;
+ MCHBAR_CH0_CR_REUT_CH_MISC_CKE_CTRL_STRUCT ReutChMiscCkeCtrl;
+ MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_STRUCT ReutChSeqRankL2PMapping;
+
+ //
+ // Make sure valid rank bit mask for this channel
+ //
+ RankBitMask &= MrcData->SysOut.Outputs.Controller[0].Channel[ch].ValidRankBitMask;
+
+ //
+ // Check if nothing is selected
+ //
+ if ((RankBitMask & 0xF) == 0) {
+ Offset = MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_REG +
+ (
+ (
+ MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_REG -
+ MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_REG
+ ) * ch
+ );
+ MrcWriteCR (MrcData, Offset, 0);
+
+ //
+ // Disable Channel by clearing global start bit in change config
+ //
+ Offset = MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_REG +
+ ((MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_REG - MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_REG) * ch);
+ ReutChSeqCfg.Data = MrcReadCR (MrcData, Offset);
+ ReutChSeqCfg.Bits.Global_Control = 0;
+ MrcWriteCR (MrcData, Offset, (U32) ReutChSeqCfg.Data);
+
+ return 0;
+
+ } else {
+ //
+ // Normal case
+ // Setup REUT Test to iteration through appropriate ranks during test
+ //
+ ReutChSeqRankL2PMapping.Data = 0;
+ RankCount = 0;
+
+ //
+ // Prepare Rank Mapping and Max Rank
+ //
+ for (rank = 0; rank < MAX_RANK_IN_CHANNEL; rank++) {
+ //
+ // rank in range(4):
+ //
+ if ((MRC_BIT0 << rank) & RankBitMask) {
+ ReutChSeqRankL2PMapping.Data |= (rank << (4 * RankCount));
+ RankCount += 1;
+ }
+ }
+ //
+ // Write New Rank Mapping and Max Rank
+ //
+ Offset = MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_REG +
+ (
+ (
+ MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_REG -
+ MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_REG
+ ) * ch
+ );
+ MrcWriteCR (MrcData, Offset, ReutChSeqRankL2PMapping.Data);
+ Offset = MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_REG + 7 +
+ ((MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_1_REG - MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_REG) * ch);
+ MrcWriteCR8 (MrcData, Offset, RankCount - 1);
+
+ //
+ // Make sure channel is enabled
+ //
+ Offset = MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_REG + ((MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_REG - MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_REG) * ch);
+ ReutChSeqCfg.Data = MrcReadCR (MrcData, Offset);
+ ReutChSeqCfg.Bits.Global_Control = 1;
+ MrcWriteCR (MrcData, Offset, (U32) ReutChSeqCfg.Data);
+ }
+ //
+ // Need to convert RankFeatureEnable as an input parameter so we don't pass it all the time
+ //
+ if (RankFeatureEnable != 0) {
+ //
+ // Enable Refresh and ZQ - 0's to the the desired ranks
+ //
+ En = RankFeatureEnable & 0x3; // Refresh
+ ReutChMiscRefreshCtrl.Data = 0;
+ ReutChMiscRefreshCtrl.Bits.Refresh_Rank_Mask = MCHBAR_CH0_CR_REUT_CH_MISC_REFRESH_CTRL_Refresh_Rank_Mask_MAX;
+ ReutChMiscRefreshCtrl.Bits.Panic_Refresh_Only = 1;
+
+ if (En == 1) {
+ ReutChMiscRefreshCtrl.Bits.Refresh_Rank_Mask = ~RankBitMask; // Enable all non-selected ranks
+ } else if (En > 1) {
+ ReutChMiscRefreshCtrl.Bits.Refresh_Rank_Mask = 0; // Enable all ranks
+ }
+ Offset = MCHBAR_CH0_CR_REUT_CH_MISC_REFRESH_CTRL_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_MISC_REFRESH_CTRL_REG - MCHBAR_CH0_CR_REUT_CH_MISC_REFRESH_CTRL_REG) * ch);
+ MrcWriteCR (MrcData, Offset, ReutChMiscRefreshCtrl.Data);
+
+ En = (RankFeatureEnable >> 2) & 0x3; // ZQ
+ ReutChMiscZqCtrl.Data = 0;
+ ReutChMiscZqCtrl.Bits.ZQ_Rank_Mask = MCHBAR_CH0_CR_REUT_CH_MISC_ZQ_CTRL_ZQ_Rank_Mask_MAX;
+ ReutChMiscZqCtrl.Bits.Always_Do_ZQ = 1;
+ if (En == 1) {
+ ReutChMiscZqCtrl.Bits.ZQ_Rank_Mask = ~RankBitMask;
+ } else if (En > 1) {
+ ReutChMiscZqCtrl.Bits.ZQ_Rank_Mask = 0; // Enable all ranks
+ }
+ Offset = MCHBAR_CH0_CR_REUT_CH_MISC_ZQ_CTRL_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_MISC_ZQ_CTRL_REG - MCHBAR_CH0_CR_REUT_CH_MISC_ZQ_CTRL_REG) * ch);
+ MrcWriteCR (MrcData, Offset, ReutChMiscZqCtrl.Data);
+
+ //
+ // Enable CKE ranks - 1's to enable desired ranks
+ //
+ En = (RankFeatureEnable >> 4) & 0x3;
+ ReutChMiscCkeCtrl.Data = 0;
+ ReutChMiscCkeCtrl.Bits.CKE_On = MCHBAR_CH0_CR_REUT_CH_MISC_CKE_CTRL_CKE_On_MAX;
+ if (En == 1) {
+ ReutChMiscCkeCtrl.Bits.CKE_On = ~RankBitMask;
+ ReutChMiscCkeCtrl.Bits.CKE_Override = ~RankBitMask; // Enable all non-selected ranks
+ } else if (En > 1) {
+ ReutChMiscCkeCtrl.Bits.CKE_On = MCHBAR_CH0_CR_REUT_CH_MISC_CKE_CTRL_CKE_On_MAX;
+ ReutChMiscCkeCtrl.Bits.CKE_Override = MCHBAR_CH0_CR_REUT_CH_MISC_CKE_CTRL_CKE_Override_MAX; // Enable all ranks.
+ }
+ Offset = MCHBAR_CH0_CR_REUT_CH_MISC_CKE_CTRL_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_MISC_CKE_CTRL_REG - MCHBAR_CH0_CR_REUT_CH_MISC_CKE_CTRL_REG) * ch);
+ MrcWriteCR (MrcData, Offset, ReutChMiscCkeCtrl.Data);
+ }
+
+ return (U8) (MRC_BIT0 << ch);
+}
+
+/**
+ This routine updates RXTRAINRANK register's specific fields defined by the subfield
+ subfield values:
+ 0 - Update RcvEn - leave other parameter the same
+ 1 - Update RxDqsP - leave other parameter the same
+ 2 - Update RxEq - leave other parameter the same
+ 3 - Update RxDqsN - leave other parameter the same
+ 4 - Update RxVref - leave other parameter the same
+ 5 - Update RxDqsP & RxDqsN - leave other parameter the same
+ FF - leave all parameter the same
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Channel - Defines channel to update
+ @param[in] Rank - Defines rank to update
+ @param[in] Byte - Defines byte to update
+ @param[in] Subfield - Defines the register's field or fields to update
+ @param[in] Value - value to be writen into register fields
+
+ @retval Nothing
+**/
+void
+UpdateRxT (
+ IN MrcParameters *const MrcData,
+ IN const U8 Channel,
+ IN const U8 Rank,
+ IN const U8 Byte,
+ IN const U8 Subfield,
+ IN const U16 Value
+ )
+{
+ MrcChannelOut *ChannelOut;
+ U32 Offset;
+ DDRDATA0CH0_CR_RXTRAINRANK0_STRUCT CrRxTrainRank;
+
+ ChannelOut = &MrcData->SysOut.Outputs.Controller[0].Channel[Channel];
+ CrRxTrainRank.Data = 0;
+ CrRxTrainRank.Bits.RxRcvEnPi = (Subfield == 0) ? Value : ChannelOut->RcvEn[Rank][Byte];
+ CrRxTrainRank.Bits.RxDqsPPi = ((Subfield == 1) || (Subfield == 5)) ? Value : ChannelOut->RxDqsP[Rank][Byte];
+ CrRxTrainRank.Bits.RxEq = (Subfield == 2) ? Value : ChannelOut->RxEq[Rank][Byte];
+ CrRxTrainRank.Bits.RxDqsNPi = ((Subfield == 3) || (Subfield == 5)) ? Value : ChannelOut->RxDqsN[Rank][Byte];
+ CrRxTrainRank.Bits.RxVref = (Subfield == 4) ? Value : ChannelOut->RxVref[Byte];
+
+ Offset = DDRDATA0CH0_CR_RXTRAINRANK0_REG +
+ ((DDRDATA0CH1_CR_RXTRAINRANK0_REG - DDRDATA0CH0_CR_RXTRAINRANK0_REG) * Channel) +
+ ((DDRDATA0CH0_CR_RXTRAINRANK1_REG - DDRDATA0CH0_CR_RXTRAINRANK0_REG) * Rank) +
+ ((DDRDATA1CH0_CR_RXTRAINRANK0_REG - DDRDATA0CH0_CR_RXTRAINRANK0_REG) * Byte);
+ MrcWriteCR (MrcData, Offset, CrRxTrainRank.Data);
+ //
+ // Download new settings from the RegFile to the Pads
+ //
+ MrcDownloadRegFile (MrcData, Channel, 0, Rank, MrcRegFileRank, Byte, 1, 0);
+ return;
+}
+
+/**
+ This routine updates TXTRAINRANK register's specific fields defined by the subfield
+ subfield values:
+ 0 - Update TxDq - leave other parameter the same
+ 1 - Update TxDqs - leave other parameter the same
+ 2 - Update TxEq - leave other parameter the same
+ 3 - Update ALL from input value (non from Mrcdata structure)
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Channel - Defines channel to update
+ @param[in] Rank - Defines rank to update
+ @param[in] Byte - Defines byte to update
+ @param[in] Subfield - Defines the register's field or fields to update
+ @param[in] Value - value to be writen into register fields
+
+ @retval Nothing
+**/
+void
+UpdateTxT (
+ IN MrcParameters *const MrcData,
+ IN const U8 Channel,
+ IN const U8 Rank,
+ IN const U8 Byte,
+ IN const U8 Subfield,
+ IN const U32 Value
+ )
+{
+ MrcChannelOut *ChannelOut;
+ U32 Offset;
+ DDRDATA0CH0_CR_TXTRAINRANK0_STRUCT CrTxTrainRank;
+
+ ChannelOut = &MrcData->SysOut.Outputs.Controller[0].Channel[Channel];
+ if (Subfield == 3) {
+ CrTxTrainRank.Data = Value;
+ } else {
+ CrTxTrainRank.Data = 0;
+ CrTxTrainRank.Bits.TxDqDelay = (Subfield == 0) ? Value : ChannelOut->TxDq[Rank][Byte];
+ CrTxTrainRank.Bits.TxDqsDelay = (Subfield == 1) ? Value : ChannelOut->TxDqs[Rank][Byte];
+ CrTxTrainRank.Bits.TxEqualization = (Subfield == 2) ? Value : ChannelOut->TxEq[Rank][Byte];
+ }
+
+ Offset = DDRDATA0CH0_CR_TXTRAINRANK0_REG +
+ ((DDRDATA0CH1_CR_TXTRAINRANK0_REG - DDRDATA0CH0_CR_TXTRAINRANK0_REG) * Channel) +
+ ((DDRDATA0CH0_CR_TXTRAINRANK1_REG - DDRDATA0CH0_CR_TXTRAINRANK0_REG) * Rank) +
+ ((DDRDATA1CH0_CR_TXTRAINRANK0_REG - DDRDATA0CH0_CR_TXTRAINRANK0_REG) * Byte);
+ MrcWriteCR (MrcData, Offset, CrTxTrainRank.Data);
+ //
+ // Download new settings from the RegFile to the Pads
+ //
+ MrcDownloadRegFile (MrcData, Channel, 0, Rank, MrcRegFileRank, Byte, 0, 1);
+ return;
+}
+
+/**
+ Returns the index into the array MarginResult in the MrcOutput structure.
+
+ @param[in] ParamV - Margin parameter
+
+ @retval One of the following values: LastRxV(0), LastRxT (1), LastTxV(2), LastTxT (3), LastRcvEna (4),
+ LastWrLevel (5), LastCmdT (6), LastCmdV (7)
+**/
+U8
+GetMarginResultType (
+ IN const U8 ParamV
+ )
+{
+ switch (ParamV) {
+ case WrV:
+ case WrFan2:
+ case WrFan3:
+ return LastTxV;
+
+ case WrT:
+ return LastTxT;
+
+ case RdV:
+ case RdFan2:
+ case RdFan3:
+ return LastRxV;
+
+ case RdT:
+ return LastRxT;
+
+ case RcvEna:
+ case RcvEnaX:
+ return LastRcvEna;
+
+ case WrLevel:
+ return LastWrLevel;
+
+ case CmdT:
+ return LastCmdT;
+
+ case CmdV:
+ return LastCmdV;
+
+ default:
+ //MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "GetMarginByte: Unknown Margin Parameter\n");
+ break;
+ }
+
+ return 0; // Return LastRxV to point to the beginning of the array
+}
+
+/*
+1D Margin Types:
+RcvEn: Shifts just RcvEn. Only side effect is it may eat into read dq-dqs for first bit of burst
+RdT: Shifts read DQS timing, changing where DQ is sampled
+WrT: Shifts write DQ timing, margining DQ-DQS timing
+WrDqsT: Shifts write DQS timing, margining both DQ-DQS and DQS-CLK timing
+RdV: Shifts read Vref voltage for DQ only
+WrV: Shifts write Vref voltage for DQ only
+WrLevel: Shifts write DQ and DQS timing, margining only DQS-CLK timing
+WrTBit: Shifts write DQ per bit timing.
+RdTBit: Shifts read DQ per bit timing.
+RdVBit: Shifts read DQ per bit voltage.
+
+2D Margin Types (Voltage, Time)
+RdFan2: Margins both RdV and RdT at { (off, -2/3*off), (off, 2/3*off) }
+WrFan2: Margins both WrV and WrT at { (off, -2/3*off), (off, 2/3*off) }
+RdFan3: Margins both RdV and RdT at { (off, -2/3*off), (5/4*off, 0), (off, 2/3*off) }
+WrFan3: Margins both WrV and WrT at { (off, -2/3*off), (5/4*off, 0), (off, 2/3*off) }
+*/
+/**
+ This function Reads MrcData structure and finds the minimum last recorded margin for param
+ Searches across all bytes and ranks in RankMask
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in,out] MarginResult - Data structure with the latest margin results.
+ @param[in] Param - Defines the margin type
+ @param[in] Ranks - Condenses down the results from multiple ranks
+
+ @retval mrcWrongInputParameter if a bad Param is passed in, otherwise mrcSuccess.
+**/
+MrcStatus
+GetMarginCh (
+ IN MrcParameters *const MrcData,
+ IN OUT U32 MarginResult[MAX_RESULT_TYPE][MAX_RANK_IN_CHANNEL][MAX_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_EDGES],
+ IN const U8 Param,
+ IN const U8 Ranks
+ )
+{
+ MrcOutput *Outputs;
+ U32 *Margin1;
+ U32 *Margin2;
+ U8 ResultType;
+ U8 Channel;
+ U8 Rank;
+ U8 Byte;
+ U8 Edge;
+ U8 Scale;
+
+ Outputs = &MrcData->SysOut.Outputs;
+ switch (Param) {
+ case WrV:
+ case WrT:
+ case RdV:
+ case RdT:
+ Scale = 10;
+ break;
+
+ case WrFan2:
+ case WrFan3:
+ case RdFan2:
+ case RdFan3:
+ Scale = 21 / 3;
+ break;
+
+ default:
+ MRC_DEBUG_MSG (&MrcData->SysIn.Inputs.Debug, MSG_LEVEL_ERROR, "GetMarginCh: Unknown Margin Parameter\n");
+ return mrcWrongInputParameter;
+ }
+
+ ResultType = GetMarginResultType (Param);
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ Margin2 = &MarginResult[ResultType][0][Channel][0][0];
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if (MrcRankInChannelExist (MrcData, Rank, Channel) & Ranks) {
+ Margin1 = &MarginResult[ResultType][Rank][Channel][Byte][0];
+ for (Edge = 0; Edge < MAX_EDGES; Edge++, Margin1++) {
+ if (Margin2[Edge] > *Margin1) {
+ Margin2[Edge] = *Margin1;
+ }
+ }
+ }
+ }
+ }
+ //
+ // Scale results as needed
+ //
+ for (Edge = 0; Edge < MAX_EDGES; Edge++, Margin2++) {
+ *Margin2 = (*Margin2 * Scale) / 10;
+ }
+ }
+ }
+
+ return mrcSuccess;
+}
+
+/**
+ Use this function to retrieve the last margin results from MrcData
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in,out] MarginResult - Data structure with the latest margin results.
+ @param[in] Param - Defines the margin type
+ @param[in] RankIn - Which rank of the host structure you want the result returned on
+ @param[in] Ranks - Condenses down the results from multiple ranks
+
+ @retval MarginResult structure has been updated if MrcStatus returns mrcSuccess.
+ @retval Otherwise, mrcWrongInputParameter is returned if an incorrect Param is passed in.
+**/
+MrcStatus
+GetMarginByte (
+ IN MrcParameters *const MrcData,
+ IN OUT U32 MarginResult[MAX_RESULT_TYPE][MAX_RANK_IN_CHANNEL][MAX_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_EDGES],
+ IN const U8 Param,
+ IN const U8 RankIn,
+ IN const U8 Ranks
+ )
+{
+ MrcOutput *Outputs;
+ U32 *Margin1;
+ U32 *Margin2;
+ U8 ResultType;
+ U8 Channel;
+ U8 Rank;
+ U8 Byte;
+ U8 Edge;
+ U8 Scale;
+
+ Outputs = &MrcData->SysOut.Outputs;
+ switch (Param) {
+ case WrV:
+ case WrT:
+ case RdV:
+ case RdT:
+ case RcvEna:
+ case RcvEnaX:
+ Scale = 10;
+ break;
+
+ case WrFan2:
+ case WrFan3:
+ case RdFan2:
+ case RdFan3:
+ Scale = 21 / 3;
+ break;
+
+ default:
+ MRC_DEBUG_MSG (&MrcData->SysIn.Inputs.Debug, MSG_LEVEL_ERROR, "GetMarginByte: Unknown Margin Parameter\n");
+ return mrcWrongInputParameter;
+ }
+
+ ResultType = GetMarginResultType (Param);
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if (MrcRankInChannelExist (MrcData, Rank, Channel) & Ranks) {
+ Margin1 = &MarginResult[ResultType][RankIn][Channel][Byte][0];
+ Margin2 = &MarginResult[ResultType][Rank][Channel][Byte][0];
+ for (Edge = 0; Edge < MAX_EDGES; Edge++, Margin1++, Margin2++) {
+ if (*Margin1 > *Margin2) {
+ *Margin1 = *Margin2;
+ }
+ }
+ }
+ }
+ //
+ // Scale results as needed
+ //
+ Margin1 = &MarginResult[ResultType][RankIn][Channel][Byte][0];
+ for (Edge = 0; Edge < MAX_EDGES; Edge++, Margin1++) {
+ *Margin1 = (*Margin1 * Scale) / 10;
+ }
+ }
+ }
+ }
+
+ return mrcSuccess;
+}
+
+/**
+ This function is use to "unscale" the MrcData last margin point
+ GetMarginByte will scale the results for FAN margin
+ This will unscale the results such that future tests start at the correct point
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in,out] MarginResult - Input array to be unscaled.
+ @param[in] Param - Defines the margin type for proper scale selection.
+ @param[in] Rank - Which rank of the host structure to work on
+
+ @retval mrcSuccess
+**/
+MrcStatus
+ScaleMarginByte (
+ IN MrcParameters *const MrcData,
+ IN OUT U32 MarginResult[MAX_RESULT_TYPE][MAX_RANK_IN_CHANNEL][MAX_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_EDGES],
+ IN const U8 Param,
+ IN const U8 Rank
+ )
+{
+ MrcOutput *Outputs;
+ U32 *Margin;
+ U8 ResultType;
+ U8 Channel;
+ U8 Byte;
+ U8 Edge;
+
+ //
+ // Calculate scale parameter based on param
+ // Leave room for expansion in case other params needed to be scaled
+ //
+ Outputs = &MrcData->SysOut.Outputs;
+ if ((Param == RdFan2) || (Param == RdFan3) || (Param == WrFan2) || (Param == WrFan3)) {
+ ResultType = GetMarginResultType (Param);
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ Margin = &MarginResult[ResultType][Rank][Channel][Byte][0];
+ for (Edge = 0; Edge < MAX_EDGES; Edge++, Margin++) {
+ *Margin = (*Margin * 15) / 10;
+ }
+ }
+ }
+ }
+ }
+
+ return mrcSuccess;
+}
+
+/**
+ This function is used by most margin search functions to change te underlying margin parameter.
+ This function allows single search function to be used for different types of margins with minimal impact.
+ It provides multiple different parameters, including 2D parameters like Read or Write FAN.
+ It can work in either MultiCast or single register mode.
+
+ @param[in,out] MrcData - Include all MRC global data.
+ @param[in] param - Includes parameter(s) to change including two dimentional.
+ @param[in] value0 - Selected value to program margin param to
+ @param[in] value1 - Selected value to program margin param to in 2D mode (FAN mode)
+ @param[in] EnMultiCast - To enable Multicast (broadcast) or single register mode
+ @param[in] channel - Desired Channel
+ @param[in] rankIn - Desired Rank - only used for the RxTBit and TxTBit settings and to propagate RdVref
+ @param[in] byte - Desired byte offset register
+ @param[in] bitIn - Desired bit offset Mrc data strucure if UpdateMrcData is 1
+ @param[in] UpdateMrcData - Used to decide if Mrc host must be updated
+ @param[in] SkipWait - Used to skip wait until all channel are done
+ @param[in] RegFileParam - Used to determine which Rank to download. Passed to MrcDownloadRegFile.
+
+ @retval MrcStatus - if succeeded, return mrcSuccess
+**/
+MrcStatus
+ChangeMargin (
+ IN OUT MrcParameters *const MrcData,
+ IN const U8 param,
+ IN const S32 value0,
+ IN const S32 value1,
+ IN const U8 EnMultiCast,
+ IN const U8 channel,
+ IN const U8 rankIn,
+ IN const U8 byte,
+ IN const U8 bitIn,
+ IN const U8 UpdateMrcData,
+ IN const U8 SkipWait,
+ IN const MrcRegFile RegFileParam
+ )
+{
+ //
+ // Programs margin param to the selected value0
+ // If param is a 2D margin parameter (ex: FAN), then it uses both value0 and value1
+ // For an N point 2D parameter, value1 can be an interger from 0 to (N-1)
+ // For per bit timing parameter, value1 is the sign of the shift
+ // param = {0:RcvEna, 1:RdT, 2:WrT, 3: WrDqsT, 4:RdV, 5:WrV, 6:WrLevel,
+ // 7:WrTBox, 8:WrTBit, 9:RdTBit, 10:RdVBit,
+ // 16:RdFan2, 17:WrFan2, 32:RdFan3, 33:WrFan3}
+ // Note: For Write Vref, the trained value and margin register are the same
+ // Note: rank is only used for the RxTBit and TxTBit settings and to propagate RdVref
+ // Note: PerBit Settings (WrTBit, RdTBit, RdVBit) provide all 8 offsets in value0
+
+ const MrcDebug *Debug;
+ const MrcInput *Inputs;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ MrcChannelOut *CurrentChannelOut;
+ MrcStatus Status;
+ U8 CurrentCh;
+ U8 CurrentByte;
+ U8 Max0;
+ U8 MaxT;
+ U8 MaxV;
+ U8 maskT;
+ U8 rank;
+ U8 bit;
+ U8 ReadRFRd;
+ U8 ReadRFWr;
+ S32 sign;
+ S32 v0;
+ S32 v1;
+ U32 Offset;
+ BOOL UpdateDataOffset;
+ DDRDATA0CH0_CR_DDRCRDATAOFFSETTRAIN_STRUCT CRValue;
+ MCHBAR_CH0_CR_SC_IO_LATENCY_STRUCT ScIoLatency;
+
+ Status = mrcSuccess;
+ UpdateDataOffset = FALSE;
+ ReadRFRd = 0;
+ ReadRFWr = 0;
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerOut = &Outputs->Controller[0];
+
+ //
+ // Pre-Process the margin numbers
+ //
+ MaxT = MAX_POSSIBLE_TIME; // Maximum value for Time
+ MaxV = MAX_POSSIBLE_VREF; // Maximum value for Vref
+ maskT = 0x3F; // 6 bits (2's complement)
+
+ if ((param < RdV) || (param == WrLevel)) {
+ Max0 = MaxT;
+ } else if ((param == WrTBit) || (param == RdTBit) || (param == RdVBit)) {
+ Max0 = 0xFF;
+ } else {
+ Max0 = MaxV; // Vref for RdV, WrV, and FAN modes
+ }
+ //
+ // Pre-Process the margin numbers. Calculate 2D points based on FAN slopes
+ //
+ v0 = value0;
+ sign = (2 * value1 - 1);
+
+ //
+ // For Fan3, optimize point orders to minimize Vref changes and # of tests required
+ //
+ if (param >= RdFan3) {
+ sign = ((3 * value1 - 5) * value1) / 2; // Translates to {0:0, 1:-1, 2:+1}
+ if (value1 == 0) {
+ v0 = (5 * value0) / 4;
+ }
+ }
+
+ v1 = (sign * value0) / 3;
+ if (v0 > Max0) {
+ v0 = Max0;
+ } else if (v0 < (-1 * Max0)) {
+ v0 = (-1 * Max0);
+ }
+
+ if (v1 > MaxT) {
+ v1 = MaxT;
+ } else if (v1 < (0 - MaxT)) {
+ v1 = (0 - MaxT);
+ }
+ //
+ // Rank = -1 sometimes if used to indicate all ranks
+ // Does not make sense here, hence set to 0)
+ //
+ rank = (rankIn == 0xFF) ? 0 : rankIn;
+
+ ChannelOut = &ControllerOut->Channel[channel];
+ CRValue.Data = ChannelOut->DataOffsetTrain[byte];
+ switch (param) {
+ case RcvEna:
+ CRValue.Bits.RcvEnOffset = (U32) v0;
+ UpdateDataOffset = TRUE;
+ break;
+
+ case RdT:
+ CRValue.Bits.RxDqsOffset = (U32) v0;
+ UpdateDataOffset = TRUE;
+ break;
+
+ case WrT:
+ CRValue.Bits.TxDqOffset = (U32) v0;
+ UpdateDataOffset = TRUE;
+ break;
+
+ case WrDqsT:
+ CRValue.Bits.TxDqsOffset = (U32) v0;
+ UpdateDataOffset = TRUE;
+ break;
+
+ case RdV:
+ CRValue.Bits.VrefOffset = (U32) v0;
+ UpdateDataOffset = TRUE;
+ break;
+
+ case RcvEnaX:
+ //
+ // Calculate new IOComp Latency to include over/underflow
+ //
+ Offset = MCHBAR_CH0_CR_SC_IO_LATENCY_REG +
+ ((MCHBAR_CH1_CR_SC_IO_LATENCY_REG - MCHBAR_CH0_CR_SC_IO_LATENCY_REG) * channel);
+ ScIoLatency.Data = MrcReadCR (MrcData, Offset);
+ if (v0 > 0) {
+ v0 = v0 * 2 - 16;
+ ScIoLatency.Bits.RT_IOCOMP = (MCHBAR_CH0_CR_SC_IO_LATENCY_RT_IOCOMP_MAX & (ChannelOut->RTIoComp - 1));
+ } else if (v0 < 0) {
+ v0 = v0 * 2 + 16;
+ ScIoLatency.Bits.RT_IOCOMP = (MCHBAR_CH0_CR_SC_IO_LATENCY_RT_IOCOMP_MAX & (ChannelOut->RTIoComp + 1));
+ } else {
+ ScIoLatency.Bits.RT_IOCOMP = (MCHBAR_CH0_CR_SC_IO_LATENCY_RT_IOCOMP_MAX & ChannelOut->RTIoComp);
+ }
+
+ v0 += ChannelOut->RcvEn[rank][byte];// the assumption is that we are @ 1 Qclk before edge
+ //
+ // Limit RcvEna 0-511 to prevent under/overflow.
+ //
+ if (v0 < 0) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_WARNING, "WARNING: RcvEn PI wrapped below zero!\n");
+ v0 = 0;
+ } else if (v0 > DDRDATA_CR_RXTRAINRANK0_RxRcvEnPi_MAX) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_WARNING, "WARNING: RcvEn PI wrapped above 9 bits!\n");
+ v0 = DDRDATA_CR_RXTRAINRANK0_RxRcvEnPi_MAX;
+ }
+ UpdateRxT (MrcData, channel, rank, byte, 0,(U16) v0);
+ MrcWriteCR (MrcData, Offset, ScIoLatency.Data);
+ break;
+
+ case WrV:
+ case WrFan2:
+ case WrFan3:
+ for (CurrentCh = 0; CurrentCh < MAX_CHANNEL; CurrentCh++) {
+ if (MrcChannelExist (Outputs, CurrentCh)) {
+ if ((EnMultiCast == 1) || (CurrentCh == channel)) {
+ UpdateVrefWaitTilStable (MrcData, CurrentCh, UpdateMrcData, v0, SkipWait);
+ }
+ }
+ }
+
+ if ((param == WrFan2) || (param == WrFan3)) {
+ CRValue.Data = ChannelOut->DataOffsetTrain[byte];
+ CRValue.Bits.TxDqOffset = v1; // Update TxDqOffset
+ UpdateDataOffset = TRUE;
+ }
+ break;
+
+ case RdFan2: // Read margin in FAN modes.
+ case RdFan3:
+ CRValue.Data = ChannelOut->DataOffsetTrain[byte];
+ CRValue.Bits.VrefOffset = v0; // Update VrefOffset
+ CRValue.Bits.RxDqsOffset = v1; // Update RxDqsOffset
+ UpdateDataOffset = TRUE;
+ break;
+
+ case WrLevel: // Write DQ and DQS timing, margining only DQS-CLK timing
+ CRValue.Data = ChannelOut->DataOffsetTrain[byte];
+ CRValue.Bits.TxDqOffset = v0; // Update TxDqOffset
+ CRValue.Bits.TxDqsOffset = v0; // Update TxDqsOffset
+ UpdateDataOffset = TRUE;
+ break;
+
+ case WrTBit: // Write DQ per BIT timing
+ ReadRFWr = 1;
+ if (EnMultiCast) {
+ Offset = DDRDATA_CR_TXPERBITRANK0_REG +
+ ((DDRDATA_CR_TXPERBITRANK1_REG - DDRDATA_CR_TXPERBITRANK0_REG) * rank);
+ MrcWriteCrMulticast (MrcData, Offset, value0);
+ for (CurrentCh = 0; CurrentCh < MAX_CHANNEL; CurrentCh++) {
+ CurrentChannelOut = &ControllerOut->Channel[CurrentCh];
+ //
+ // Download new settings from the RegFile to the Pads
+ //
+ MrcDownloadRegFile (MrcData, CurrentCh, 1, rank, RegFileParam, 0, ReadRFRd, ReadRFWr);
+ if (UpdateMrcData) {
+ for (CurrentByte = 0; CurrentByte < Outputs->SdramCount; CurrentByte++) {
+ for (bit = 0; bit < MAX_BITS; bit++) {
+ CurrentChannelOut->TxDqPb[rank][CurrentByte][bit].Center = (value0 >> (4 * bit)) & 0xF;
+ }
+ }
+ }
+ }
+ } else {
+ Offset = DDRDATA0CH0_CR_TXPERBITRANK0_REG +
+ ((DDRDATA0CH0_CR_TXPERBITRANK1_REG - DDRDATA0CH0_CR_TXPERBITRANK0_REG) * rank) +
+ ((DDRDATA1CH0_CR_TXPERBITRANK0_REG - DDRDATA0CH0_CR_TXPERBITRANK0_REG) * byte) +
+ ((DDRDATA0CH1_CR_TXPERBITRANK0_REG - DDRDATA0CH0_CR_TXPERBITRANK0_REG) * channel);
+ MrcWriteCR (MrcData, Offset, value0);
+ //
+ // Download new settings from the RegFile to the Pads
+ //
+ MrcDownloadRegFile (MrcData, channel, 0, rank, RegFileParam, byte, ReadRFRd, ReadRFWr);
+ if (UpdateMrcData) {
+ for (bit = 0; bit < MAX_BITS; bit++) {
+ ChannelOut->TxDqPb[rank][byte][bit].Center = (value0 >> (4 * bit)) & 0xF;
+ }
+ }
+ }
+ break;
+
+ case RdTBit: // Read DQ per BIT timing
+ ReadRFRd = 1;
+ if (EnMultiCast) {
+ Offset = DDRDATA_CR_RXPERBITRANK0_REG +
+ ((DDRDATA_CR_RXPERBITRANK1_REG - DDRDATA_CR_RXPERBITRANK0_REG) * rank);
+ MrcWriteCrMulticast (MrcData, Offset, value0);
+ for (CurrentCh = 0; CurrentCh < MAX_CHANNEL; CurrentCh++) {
+ CurrentChannelOut = &ControllerOut->Channel[CurrentCh];
+ //
+ // Download new settings from the RegFile to the Pads
+ //
+ MrcDownloadRegFile (MrcData, CurrentCh, 1, rank, RegFileParam, 0, ReadRFRd, ReadRFWr);
+ if (UpdateMrcData) {
+ for (CurrentByte = 0; CurrentByte < Outputs->SdramCount; CurrentByte++) {
+ for (bit = 0; bit < MAX_BITS; bit++) {
+ CurrentChannelOut->RxDqPb[rank][CurrentByte][bit].Center = (value0 >> (4 * bit)) & 0xF;
+ }
+ }
+ }
+ }
+ } else {
+ Offset = DDRDATA0CH0_CR_RXPERBITRANK0_REG +
+ ((DDRDATA0CH0_CR_RXPERBITRANK1_REG - DDRDATA0CH0_CR_RXPERBITRANK0_REG) * rank) +
+ ((DDRDATA1CH0_CR_RXPERBITRANK0_REG - DDRDATA0CH0_CR_RXPERBITRANK0_REG) * byte) +
+ ((DDRDATA0CH1_CR_RXPERBITRANK0_REG - DDRDATA0CH0_CR_RXPERBITRANK0_REG) * channel);
+ MrcWriteCR (MrcData, Offset, value0);
+ //
+ // Download new settings from the RegFile to the Pads
+ //
+ MrcDownloadRegFile (MrcData, channel, 0, rank, RegFileParam, byte, ReadRFRd, ReadRFWr);
+ if (UpdateMrcData) {
+ for (bit = 0; bit < MAX_BITS; bit++) {
+ ChannelOut->RxDqPb[rank][byte][bit].Center = (value0 >> (4 * bit)) & 0xF;
+ }
+ }
+ }
+ break;
+
+ case RdVBit: // Read DQ per BIT Voltage
+ ReadRFRd = 1;
+ if (EnMultiCast) {
+ MrcWriteCrMulticast (MrcData, DDRDATA_CR_RXOFFSETVDQ_REG, value0);
+ for (CurrentCh = 0; CurrentCh < MAX_CHANNEL; CurrentCh++) {
+ CurrentChannelOut = &ControllerOut->Channel[CurrentCh];
+ //
+ // Download new settings from the RegFile to the Pads
+ //
+ MrcDownloadRegFile (MrcData, CurrentCh, 1, rank, RegFileParam, 0, ReadRFRd, ReadRFWr);
+ if (UpdateMrcData) {
+ for (CurrentByte = 0; CurrentByte < Outputs->SdramCount; CurrentByte++) {
+ for (bit = 0; bit < MAX_BITS; bit++) {
+ CurrentChannelOut->RxDqVrefPb[rank][CurrentByte][bit].Center = (value0 >> (4 * bit)) & 0xF;
+ }
+ }
+ }
+ }
+ } else {
+ Offset = DDRDATA0CH0_CR_RXOFFSETVDQ_REG +
+ ((DDRDATA1CH0_CR_RXOFFSETVDQ_REG - DDRDATA0CH0_CR_RXOFFSETVDQ_REG) * byte) +
+ ((DDRDATA0CH1_CR_RXOFFSETVDQ_REG - DDRDATA0CH0_CR_RXOFFSETVDQ_REG) * channel);
+ MrcWriteCR (MrcData, Offset, value0);
+ //
+ // Download new settings from the RegFile to the Pads
+ //
+ MrcDownloadRegFile (MrcData, channel, 0, rank, RegFileParam, byte, ReadRFRd, ReadRFWr);
+ if (UpdateMrcData) {
+ ChannelOut = &ControllerOut->Channel[channel];
+ for (bit = 0; bit < MAX_BITS; bit++) {
+ ChannelOut->RxDqVrefPb[rank][byte][bit].Center = (value0 >> (4 * bit)) & 0xF;
+ }
+ }
+ }
+
+ break;
+
+ default:
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "Function ChangeMargin, Invalid parameter %d\n", param);
+ return mrcWrongInputParameter;
+ } // end switch (param)
+
+ if (UpdateDataOffset) {
+ //
+ // Download new settings from the RegFile to the Pads
+ //
+ if ((param == RcvEnaX) ||(param == RcvEna) || (param == RdT) || (param == RdV) || (param == RdFan2) || (param == RdFan3)) {
+ ReadRFRd = 1;
+ } else if ((param == WrT) || (param == WrDqsT) || (param == WrLevel) || (param == WrFan2) || (param == WrFan3)) {
+ ReadRFWr = 1;
+ }
+ //
+ // Write CR
+ //
+ if (EnMultiCast) {
+ MrcWriteCrMulticast (MrcData, DDRDATA_CR_DDRCRDATAOFFSETTRAIN_REG, CRValue.Data);
+ for (CurrentCh = 0; CurrentCh < MAX_CHANNEL; CurrentCh++) {
+ if (MrcChannelExist (Outputs, CurrentCh)) {
+ CurrentChannelOut = &ControllerOut->Channel[CurrentCh];
+ //
+ // Download new settings from the RegFile to the Pads
+ //
+ MrcDownloadRegFile (MrcData, CurrentCh, 1, rank, RegFileParam, 0, ReadRFRd, ReadRFWr);
+ for (CurrentByte = 0; CurrentByte < Outputs->SdramCount; CurrentByte++) {
+ if (UpdateMrcData) {
+ CurrentChannelOut->DataOffsetTrain[CurrentByte] = CRValue.Data;
+ }
+ }
+ }
+ }
+ } else {
+ Offset = DDRDATA0CH0_CR_DDRCRDATAOFFSETTRAIN_REG +
+ ((DDRDATA0CH1_CR_DDRCRDATAOFFSETTRAIN_REG - DDRDATA0CH0_CR_DDRCRDATAOFFSETTRAIN_REG) * channel) +
+ ((DDRDATA1CH0_CR_DDRCRDATAOFFSETTRAIN_REG - DDRDATA0CH0_CR_DDRCRDATAOFFSETTRAIN_REG) * byte);
+ MrcWriteCR (MrcData, Offset, CRValue.Data);
+ //
+ // Download new settings from the RegFile to the Pads
+ //
+ MrcDownloadRegFile (MrcData, channel, 0, rank, RegFileParam, byte, ReadRFRd, ReadRFWr);
+ if (UpdateMrcData) {
+ ChannelOut->DataOffsetTrain[byte] = CRValue.Data;
+ }
+ }
+ }
+
+ return Status;
+}
+
+/**
+ This function triggers the hardware to download the specified RegFile.
+ The setting of ReadRfRd and ReadRfWr must be mutually exclusive.
+ Only 1 (start download) and 0 (do nothing) are valid values for ReadRfXx.
+
+ @param[in] MrcData - Global MRC Data
+ @param[in] Channel - The Channel to download target.
+ @param[in] ByteMulticast - Enable Multicasting all bytes on that Channel.
+ @param[in] Rank - The Rank download target.
+ @param[in] RegFileParam - Used to determine which Rank to download.
+ MrcRegFileRank - Uses the Rank Parameter.
+ MrcRegFileStart - Uses the Rank in REUT_CH_SEQ_BASE_ADDR_START after decoding logical to physical.
+ MrcRegFileCurrent - Uses the Rank in REUT_CH_SEQ_BASE_ADDR_CURRENT after decoding logical to physical.
+ @param[in] Byte - The Byte download target.
+ @param[in] ReadRfRd - Download the read RegFile. 1 enables, 0 otherwise
+ @param[in] ReadRfWr - Download the write RegFile. 1 enables, 0 otherwise
+
+ @retval MrcStatus - If both ReadRfRd and ReadRfWr are set, the functions returns mrcWrongInputParameters.
+ Otherwise, mrcSuccess.
+**/
+void
+MrcDownloadRegFile (
+ IN MrcParameters *const MrcData,
+ IN const U8 Channel,
+ IN const BOOL ByteMulticast,
+ IN U8 Rank,
+ IN const MrcRegFile RegFileParam,
+ IN const U8 Byte,
+ IN const BOOL ReadRfRd,
+ IN const BOOL ReadRfWr
+ )
+{
+ DDRDATA0CH0_CR_DDRCRDATACONTROL0_STRUCT DdrCrDataControl0;
+ MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_STRUCT ReutChSeqRankL2PMapping;
+ U64 ReutChSeqBaseAddr;
+ MrcChannelOut *ChannelOut;
+ U32 CrOffset;
+ U8 LogicalRank;
+
+ ChannelOut = &MrcData->SysOut.Outputs.Controller[0].Channel[Channel];
+ //
+ // Determine the rank to download the Reg File
+ //
+ switch (RegFileParam) {
+ case MrcRegFileStart:
+ CrOffset = MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_0_REG +
+ (
+ (MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_1_REG - MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_0_REG) *
+ Channel
+ );
+ break;
+
+ case MrcRegFileCurrent:
+ CrOffset = MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_0_REG +
+ (
+ (MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_1_REG - MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_0_REG) *
+ Channel
+ );
+ break;
+
+ case MrcRegFileRank:
+ default:
+ CrOffset = 0;
+ break;
+ }
+
+ if (CrOffset != 0) {
+ ReutChSeqBaseAddr = MrcReadCR64 (MrcData, CrOffset);
+ ReutChSeqBaseAddr &= MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_0_Rank_Address_MSK;
+ LogicalRank = (U8) MrcOemMemoryRightShiftU64 (
+ ReutChSeqBaseAddr,
+ MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_CURRENT_MCMAIN_0_Rank_Address_OFF
+ );
+
+ CrOffset = MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_REG +
+ (
+ (
+ MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_REG -
+ MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_REG
+ ) * Channel
+ );
+ ReutChSeqRankL2PMapping.Data = MrcReadCR (MrcData, CrOffset);
+ Rank = (U8)
+ (
+ (ReutChSeqRankL2PMapping.Data >> (LogicalRank * 4)) &
+ MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_Logical_to_Physical_Rank0_Mapping_MSK
+ );
+ }
+
+ if (ByteMulticast) {
+ //
+ // Multicast settings on the channel
+ //
+ CrOffset = DDRDATACH0_CR_DDRCRDATACONTROL0_REG +
+ ((DDRDATACH1_CR_DDRCRDATACONTROL0_REG - DDRDATACH0_CR_DDRCRDATACONTROL0_REG) * Channel);
+ } else {
+ CrOffset = DDRDATA0CH0_CR_DDRCRDATACONTROL0_REG +
+ ((DDRDATA0CH1_CR_DDRCRDATACONTROL0_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL0_REG) * Channel) +
+ ((DDRDATA1CH0_CR_DDRCRDATACONTROL0_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL0_REG) * Byte);
+ }
+
+ DdrCrDataControl0.Data = MrcReadCR (MrcData, CrOffset);
+ DdrCrDataControl0.Bits.ReadRFRd = ReadRfRd;
+ DdrCrDataControl0.Bits.ReadRFWr = ReadRfWr;
+ DdrCrDataControl0.Bits.ReadRFRank = Rank;
+ MrcWriteCR (MrcData, CrOffset, DdrCrDataControl0.Data);
+}
+
+/**
+ This procedure is meant to handle basic timing centering, places strobe in the middle of the data eye,
+ for both read and write DQ/DQS using a very robust, linear search algorthim.
+
+ @param[in,out] MrcData - Include all MRC global data.
+ @param[in] chBitMaskIn - Channel bit mask.
+ @param[in] param - {0:RcvEn, 1:RdT, 2:WrT, 3: WrDqsT, 4:RdV, 5:WrV, 6:WrLevel,
+ 8:WrTBit, 9:RdTBit, 10:RdVBit,
+ 16:RdFan2, 17:WrFan2, 32:RdFan3, 32:WrFan3}
+ ONLY RdT and WrT are allowed in this function
+ @param[in] ResetPerBit - Option to Reset PerBit Deskew to middle value before byte training
+ @param[in] loopcount - loop count
+
+ @retval MrcStatus - If succeeded, return mrcSuccess
+**/
+MrcStatus
+DQTimeCentering1D (
+ IN OUT MrcParameters *const MrcData,
+ IN const U8 chBitMaskIn,
+ IN const U8 param,
+ IN const U8 ResetPerBit,
+ IN const U8 loopcount
+ )
+{
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ S32 *CurrentPS;
+ S32 *CurrentPE;
+ S32 *LargestPS;
+ S32 *LargestPE;
+ U32 *Margin;
+ MrcStatus Status;
+ BOOL Pass;
+ U8 Channel;
+ U8 Rank;
+ U8 Byte;
+ U8 Step;
+ U8 MinWidth;
+ U8 chBitMask;
+ U8 DumArr[7];
+ U16 Result;
+ S32 CurrentPassingStart[MAX_CHANNEL][MAX_SDRAM_IN_DIMM];
+ S32 CurrentPassingEnd[MAX_CHANNEL][MAX_SDRAM_IN_DIMM];
+ S32 LargestPassingStart[MAX_CHANNEL][MAX_SDRAM_IN_DIMM];
+ S32 LargestPassingEnd[MAX_CHANNEL][MAX_SDRAM_IN_DIMM];
+ S32 cWidth;
+ S32 lWidth;
+ S32 Center;
+ S32 DqsDelay;
+ U32 Start;
+ U32 End;
+ U32 Offset;
+ MCHBAR_CH0_CR_SC_IO_LATENCY_STRUCT ScIoLatency;
+#ifdef MRC_DEBUG_PRINT
+ U64 BitLaneFailures[MAX_CHANNEL][(MAX_POSSIBLE_TIME * 2) + 1];
+ U8 BitCount;
+ const char *DelayString;
+#endif
+
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerOut = &Outputs->Controller[0];
+ chBitMask = chBitMaskIn;
+ Status = mrcSuccess;
+ Center = 0;
+ MinWidth = 8;
+ MrcOemMemorySet (DumArr, 1, sizeof (DumArr));
+
+ if ((param != RdT) && (param != WrT) && (param != RcvEnaX)) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "DataTimeCentering1D: Unknown Margin Parameter\n");
+ return mrcWrongInputParameter;
+ }
+
+ Step = 1;
+ if (param == RcvEnaX) {
+ SetupIOTestBasicVA (MrcData, chBitMask, loopcount - 3, 0, 0, 0, 8);
+ Outputs->DQPat = RdRdTA_All;
+ } else {
+ SetupIOTestBasicVA (MrcData, chBitMask, loopcount, NSOE, 0, 0, 8);
+ }
+
+#ifdef MRC_DEBUG_PRINT
+ DelayString = (param == RcvEnaX) ? RcvEnDelayString : DqsDelayString;
+#endif
+ //
+ // Reset PerBit Deskew to middle value before byte training
+ // Write timing offset for bit[x] of the DQ byte. Linear from 0-15, each step size is tQCLK/64
+ // Read timing offset for bit[x] of the DQ byte. Linear from 0-15, each step size is tQCLK/64
+ //
+ if (ResetPerBit == 1) {
+ //
+ // EnMultiCast, UpdateMrcData
+ //
+ Status = ChangeMargin (
+ MrcData,
+ (param == RdT) ? RdTBit : WrTBit,
+ 0x88888888,
+ 0,
+ 1,
+ 0,
+ 0,
+ 0,
+ 0,
+ 1,
+ 0,
+ MrcRegFileStart
+ );
+ }
+ //
+ // Center all Ranks
+ //
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+
+#ifdef MRC_DEBUG_PRINT
+ if (Outputs->ValidRankMask & (MRC_BIT0 << Rank)) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Rank = %d\n", Rank);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel 0 1\nByte\t");
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE, (
+ Outputs->SdramCount == MAX_SDRAM_IN_DIMM
+ ) ? "0 1 2 3 4 5 6 7 8 0 1 2 3 4 5 6 7 8 Error Count" : "0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 Error Count"
+ );
+ }
+#endif // MRC_DEBUG_PRINT
+
+ chBitMask = 0;
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ chBitMask |= SelectReutRanks (MrcData, Channel, (MRC_BIT0 << Rank), 0);
+ ChannelOut = &ControllerOut->Channel[Channel];
+ if ((MRC_BIT0 << Channel) & chBitMask) {
+ //
+ // Clear out anything left over in DataOffsetTrain
+ // Update rank timing to middle value
+ //
+ for (Byte = 0; (Byte < Outputs->SdramCount) && (param != RcvEnaX); Byte++) {
+ if (param == RdT) {
+ //
+ // Read Dq/Dqs
+ //
+ ChannelOut->RxDqsP[Rank][Byte] = 32;
+ ChannelOut->RxDqsN[Rank][Byte] = 32;
+ UpdateRxT (MrcData, Channel, Rank, Byte, 0xFF, 0);
+ } else if (param == WrT) {
+ //
+ // Write Dq/Dqs
+ //
+ ChannelOut->TxDq[Rank][Byte] = ChannelOut->TxDqs[Rank][Byte] + 32;
+ UpdateTxT (MrcData, Channel, Rank, Byte, 0xFF, 0);
+ }
+ }
+ //
+ // Clear any old state in DataTrain Offset
+ //
+ MrcOemMemorySetDword (&ChannelOut->DataOffsetTrain[0], 0, Outputs->SdramCount);
+
+ //
+ // Setup REUT Error Counters to count errors per channel
+ //
+ Offset = MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_0_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_CTL_0_REG - MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_CTL_0_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, 0);
+ }
+ }
+ //
+ // Continue if not valid rank on any channel
+ //
+ if (chBitMask == 0) {
+ continue; // This rank does not exist on any of the channels
+ }
+ //
+ // Sweep through values
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n%s", DelayString);
+ for (DqsDelay = -MAX_POSSIBLE_TIME; DqsDelay <= MAX_POSSIBLE_TIME; DqsDelay += Step) {
+ //
+ // Program DQS Delays
+ //
+ if (param == RcvEnaX){
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if ((MRC_BIT0 << Channel) & chBitMask) {
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ Status = ChangeMargin (MrcData, param, DqsDelay, 0, 0, Channel, Rank, Byte, 0, 0, 0, MrcRegFileStart);
+ }
+ }
+ }
+ } else {
+ Status = ChangeMargin (MrcData, param, DqsDelay, 0, 1, 0, 0, 0, 0, 0, 0, MrcRegFileStart);
+ }
+
+ //
+ // Clear Errors and Run Test
+ //
+ RunIOTest (MrcData, chBitMask, Outputs->DQPat, DumArr, 1, 0);
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n% 5d \t", DqsDelay);
+
+ //
+ // Update results for all Channel/bytes
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!(chBitMask & (MRC_BIT0 << Channel))) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ (Channel != 0) ? "" : ((Outputs->SdramCount == MAX_SDRAM_IN_DIMM) ? " " : " ")
+ );
+ continue;
+ }
+
+ //
+ // Read out per byte error results and update limit
+ //
+ Offset = 4 + MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_REG +
+ (
+ (
+ MCHBAR_CH1_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_REG -
+ MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_REG
+ ) * Channel
+ );
+ Result = (U16) MrcReadCR (MrcData, Offset);
+
+#ifdef MRC_DEBUG_PRINT
+ Offset = MCHBAR_CH0_CR_REUT_CH_ERR_DATA_STATUS_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_ERR_DATA_STATUS_REG - MCHBAR_CH0_CR_REUT_CH_ERR_DATA_STATUS_REG) * Channel);
+
+ BitLaneFailures[Channel][DqsDelay + MAX_POSSIBLE_TIME] = MrcReadCR64 (MrcData, Offset);
+#endif
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ //
+ // Check for Byte group error status
+ //
+ Pass = ((Result & (MRC_BIT0 << Byte)) == 0);
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, Pass ? ". " : "# ");
+
+ CurrentPS = &CurrentPassingStart[Channel][Byte];
+ CurrentPE = &CurrentPassingEnd[Channel][Byte];
+ LargestPS = &LargestPassingStart[Channel][Byte];
+ LargestPE = &LargestPassingEnd[Channel][Byte];
+ if (DqsDelay == -31) {
+ if (Pass) {
+ //
+ // No error on this Byte group
+ //
+ *CurrentPS = *CurrentPE = *LargestPS = *LargestPE = DqsDelay;
+ } else {
+ //
+ // Selected Byte group has accumulated an error during loop back pattern
+ //
+ *CurrentPS = *CurrentPE = *LargestPS = *LargestPE = -33;
+ }
+ } else {
+ if (Pass) {
+ //
+ // No error on this Byte group
+ //
+ if (*CurrentPE != (DqsDelay - Step)) {
+ *CurrentPS = DqsDelay;
+ }
+ *CurrentPE = DqsDelay;
+
+ //
+ // Update Largest variables
+ //
+ cWidth = *CurrentPE - *CurrentPS;
+ lWidth = *LargestPE - *LargestPS;
+ if (cWidth > lWidth) {
+ *LargestPS = *CurrentPS;
+ *LargestPE = *CurrentPE;
+ }
+ }
+ }
+ } // for Byte
+ } // for Channel
+#ifdef MRC_DEBUG_PRINT
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (chBitMask & (MRC_BIT0 << Channel)) {
+ Offset = MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_0_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_ERR_COUNTER_STATUS_0_REG - MCHBAR_CH0_CR_REUT_CH_ERR_COUNTER_STATUS_0_REG) * Channel);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " 0x%x\t", MrcReadCR (MrcData, Offset));
+ }
+ }
+#endif // MRC_DEBUG_PRINT
+ } // for DqsDelay
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "\n"); // End last line of Byte table.
+
+#ifdef MRC_DEBUG_PRINT
+ //
+ // Print out the bit lane failure information
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Bit Lane Information\n");
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel %d\nBitLane ", Channel);
+ for (BitCount = 0; BitCount < 7; BitCount++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%u ", BitCount);
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n "); // End tens number and align ones number
+ for (BitCount = 0; BitCount < 64; BitCount++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%u", BitCount % 10);
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n%s", DelayString);
+
+ for (DqsDelay = -MAX_POSSIBLE_TIME; DqsDelay <= MAX_POSSIBLE_TIME; DqsDelay += Step) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n% 5d\t", DqsDelay); // Begin with a new line and print the DqsDelay value
+ for (BitCount = 0; BitCount < 64; BitCount++) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ (BitLaneFailures[Channel][DqsDelay + MAX_POSSIBLE_TIME] & MrcOemMemoryLeftShiftU64 (1, BitCount)) ? "#" : "."
+ );
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n"); // Gap after Channel
+ }
+ }
+#endif
+
+ //
+ // Clean Up for next Rank
+ //
+ Status = ChangeMargin (MrcData, param, 0, 0, 1, 0, 0, 0, 0, 0, 0, MrcRegFileCurrent);
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (chBitMask & (MRC_BIT0 << Channel)) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "C%d.R%d: Left\tRight\tWidth\tCenter\n", Channel, Rank);
+
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ LargestPS = &LargestPassingStart[Channel][Byte];
+ LargestPE = &LargestPassingEnd[Channel][Byte];
+ lWidth = *LargestPE - *LargestPS;
+ if (lWidth < MinWidth) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_ERROR,
+ "ERROR!! DataTimeCentering1D Eye Too Small Channel: %u, Rank: %u, Byte: %u\n",
+ Channel,
+ Rank,
+ Byte
+ );
+ Status = mrcDataTimeCentering1DErr;
+ } else {
+ Center = *LargestPS + (lWidth / 2);
+ }
+
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ " B%d: %d\t%d\t%d\t%d\n",
+ Byte,
+ *LargestPS,
+ *LargestPE,
+ lWidth,
+ Center
+ );
+
+ Start = ABS (10 **LargestPS);
+ End = ABS (10 **LargestPE);
+ if (param == RdT) {
+ //
+ // read Dq./Dqs
+ //
+ Margin = &Outputs->MarginResult[LastRxT][Rank][Channel][Byte][0];
+ *Margin = Start;
+ Margin[1] = End;
+ ChannelOut->RxDqsP[Rank][Byte] = (U8) ((S32) ChannelOut->RxDqsP[Rank][Byte] + Center);
+ ChannelOut->RxDqsN[Rank][Byte] = (U8) ((S32) ChannelOut->RxDqsN[Rank][Byte] + Center);
+ UpdateRxT (MrcData, Channel, Rank, Byte, 0xFF, 0);
+ } else if (param == WrT){
+ //
+ // Write Dq/Dqs
+ //
+ Margin = &Outputs->MarginResult[LastTxT][Rank][Channel][Byte][0];
+ *Margin = Start;
+ Margin[1] = End;
+ ChannelOut->TxDq[Rank][Byte] = (U16) ((S32) ChannelOut->TxDq[Rank][Byte] + Center);
+ UpdateTxT (MrcData, Channel, Rank, Byte, 0xFF, 0);
+ } else if (param == RcvEnaX){
+ //
+ // Receive Enable
+ //
+ Margin = &Outputs->MarginResult[LastRcvEna][Rank][Channel][Byte][0];
+ *Margin = Start;
+ Margin[1] = End;
+ ChannelOut->RcvEn[Rank][Byte] = (ChannelOut->RcvEn[Rank][Byte] + (U16) (2 * Center));
+ UpdateRxT (MrcData, Channel, Rank, Byte, 0xFF, 0);
+ }
+ }
+ if (param == RcvEnaX){
+ //
+ // clean up
+ //
+ Offset = MCHBAR_CH0_CR_SC_IO_LATENCY_REG +
+ ((MCHBAR_CH1_CR_SC_IO_LATENCY_REG - MCHBAR_CH0_CR_SC_IO_LATENCY_REG) * Channel);
+ ScIoLatency.Data = MrcReadCR (MrcData, Offset);
+ ScIoLatency.Bits.RT_IOCOMP = MCHBAR_CH0_CR_SC_IO_LATENCY_RT_IOCOMP_MAX & ChannelOut->RTIoComp;
+ MrcWriteCR (MrcData, Offset, ScIoLatency.Data);
+ }
+ }
+ }
+ }
+
+ if (param == RcvEnaX) {
+ IoReset (MrcData);
+ }
+
+ return Status;
+}
+
+/**
+ This procedure is meant to handle much more complex centering that will use a 2D algorithm to optimize asymetical
+ eyes for both timing and voltage margin.
+
+ @param[in,out] MrcData - Include all MRC global data.
+ @param[in,out] MarginResult - Margin data from centering
+ @param[in] ChBitMaskIn - Channel bit mask.
+ @param[in] param - {0:RcvEn, 1:RdT, 2:WrT, 3: WrDqsT, 4:RdV, 5:WrV, 6:WrLevel,
+ 8:WrTBit, 9:RdTBit, 10:RdVBit,
+ 16:RdFan2, 17:WrFan2, 32:RdFan3, 32:WrFan3}
+ ONLY RdT and WrT are allowed in this function
+ @param[in] EnPerBit - Option to enable per bit margining
+ @param[in] EnRxDutyCycleIn - Phase to center.
+ @param[in] ResetPerBit - Option to Reset PerBit Deskew to middle value before byte training
+ @param[in] LoopCount - loop count
+ @param[in] En2D - Option to only run center at nominal Vref point
+
+ @retval MrcStatus - If succeeded, return mrcSuccess
+**/
+MrcStatus
+DataTimeCentering2D (
+ IN OUT MrcParameters *const MrcData,
+ IN OUT U32 MarginResult[MAX_RESULT_TYPE][MAX_RANK_IN_CHANNEL][MAX_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_EDGES],
+ IN const U8 ChBitMaskIn,
+ IN const U8 Param,
+ IN const U8 EnPerBit,
+ IN const U8 EnRxDutyCycleIn,
+ IN const U8 ResetPerBit,
+ IN const U8 LoopCount,
+ IN const U8 En2D
+ )
+{
+ const U32 EHWeights[] = {6, 2, 1, 0, 2, 1, 0};
+ const U32 EWWeights[] = {0, 1, 2, 3, 1, 2, 3};
+ const S32 VrefPointsConst[] = {0, -6, -12, -18, 6, 12, 18};
+ const MrcDebug *Debug;
+ const MrcInput *Inputs;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ U8 *RxDqPbCenter;
+ U8 *TxDqPbCenter;
+ U16 centerTiming;
+ U32 *Margin;
+ U32 *Eye;
+ S32 *CenterBit;
+ S32 *CSum;
+ MrcStatus Status;
+ U8 ResultType;
+ U8 Channel;
+ U8 Rank;
+ U8 Byte;
+ U8 Bit;
+ U8 ParamV;
+ U8 ParamB;
+ U8 MaxVScale;
+ U8 EnPerBitEH;
+ U8 Strobe;
+ U8 Strobes;
+ U8 Vref;
+ U8 SaveLC;
+ U8 LCloop;
+ U8 i;
+ U8 SkipWait;
+ U8 ChBitMask;
+ U8 EnRxDutyCycle;
+ U8 Edge;
+ U8 BMap[9];
+ U8 LoopEnd;
+ U16 Mode;
+ U32 MarginBit[MAX_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_BITS][MAX_EDGES];
+ S32 Center;
+ U32 Weight;
+ S32 VrefPoints[sizeof (VrefPointsConst) / sizeof (VrefPointsConst[0])];
+ U32 SumEH;
+ U32 SumEW;
+ U32 BERStats[4];
+ U32 VrefScale[MAX_CHANNEL][MAX_SDRAM_IN_DIMM];
+ U32 EH[MAX_CHANNEL][MAX_SDRAM_IN_DIMM];
+ U32 EW[MAX_CHANNEL][MAX_SDRAM_IN_DIMM];
+ U32 EyeShape[7][MAX_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_EDGES]; // Store all eye edges for Per Bit
+ U32 StrobeMargin[7][MAX_CHANNEL][MAX_SDRAM_IN_DIMM][2][MAX_EDGES];//Save Edges per Strobe to pass Min (Stobe1, Strobe2)
+ S32 CenterSum[MAX_CHANNEL][MAX_SDRAM_IN_DIMM];
+ S32 DivBy;
+ S8 DivBySign;
+ S32 Value0;
+ U32 Offset;
+ S32 CenterSumBit[MAX_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_BITS];
+ S32 Calc;
+ MCHBAR_CH0_CR_REUT_CH_ERR_CTL_STRUCT ReutChErrCtl;
+ DDRDATA0CH0_CR_RXPERBITRANK0_STRUCT CrPerBitRank;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+
+ //
+ // 2D Margin Types (Voltage, Time)
+ // RdFan2: Margins both RdV and RdT at { (off, -2/3*off), (off, 2/3*off) }
+ // WrFan2: Margins both WrV and WrT at { (off, -2/3*off), (off, 2/3*off) }
+ // RdFan3: Margins both RdV and RdT at { (off, -2/3*off), (5/4*off, 0), (off, 2/3*off) }
+ // WrFan3: Margins both WrV and WrT at { (off, -2/3*off), (5/4*off, 0), (off, 2/3*off) }
+ //
+ if ((Param != RdT) && (Param != WrT)) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "DataTimeCentering2D: Incorrect Margin Parameter %d\n", Param);
+ return mrcWrongInputParameter;
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Parameter = %d (%sT)\n", Param, (Param == RdT) ? "Rd" : "Wr");
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerOut = &Outputs->Controller[0];
+ ChBitMask = ChBitMaskIn;
+ EnRxDutyCycle = EnRxDutyCycleIn;
+ Status = mrcSuccess;
+ MaxVScale = 24;
+ Strobes = 2;
+ Center = 0;
+ Value0 = 0;
+ MrcOemMemorySet ((U8 *) BERStats, 0, sizeof (BERStats));
+ for (i = 0; i < (sizeof (BMap) / sizeof (BMap[0])); i++) {
+ BMap[i] = i;
+ }
+
+ ResultType = GetMarginResultType (Param);
+
+ EnPerBitEH = 1; // Repeat EH Measurement after byte training, before bit training
+ //
+ // SOE = 10b ( Stop on All Byte Groups Error )
+ //
+ SetupIOTestBasicVA (MrcData, ChBitMask, LoopCount - 1, NSOE, 0, 0, 8);
+ Outputs->DQPat = RdRdTA;
+ //
+ // Duty cycle should be ONLY for Rx
+ //
+ if (Param != RdT) {
+ EnRxDutyCycle = 0;
+ }
+
+ Strobes = 1 + EnRxDutyCycle;
+
+ //
+ // Option to only run center at nominal Vref point
+ //
+ if (En2D == 0) {
+ MrcOemMemorySet ((U8 *) &VrefPoints[0], 0, sizeof (VrefPoints));
+ } else {
+ MrcOemMemoryCpy ((U8 *) &VrefPoints[0], (U8 *) &VrefPointsConst[0], sizeof (VrefPoints));
+ }
+ //
+ // Calculate SumEH / SumEW for use in weighting equations
+ //
+ SumEH = SumEW = 0;
+ for (Vref = 0; Vref < sizeof (VrefPoints) / sizeof (VrefPoints[0]); Vref++) {
+ SumEH += EHWeights[Vref];
+ SumEW += EWWeights[Vref];
+
+ //
+ // Loop once at nominal Vref point
+ //
+ if (En2D == 0) {
+ Vref = 6;
+ }
+ }
+
+ if (Param == RdT) {
+ ParamV = RdV;
+ ParamB = RdTBit;
+ } else {
+ ParamV = WrV;
+ ParamB = WrTBit;
+ }
+ //
+ // Optimize timing per rank
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Optimization is per rank\n");
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ ChBitMask = 0;
+ //
+ // Select rank for REUT test
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if ((MRC_BIT0 << Channel) & ChBitMaskIn) {
+ ChBitMask |= SelectReutRanks (MrcData, Channel, (MRC_BIT0 << Rank), 0);
+ if ((MRC_BIT0 << Channel) & ChBitMask) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ //
+ // Clear any old state in DataTrain Offset
+ //
+ MrcOemMemorySetDword (&ChannelOut->DataOffsetTrain[0], 0, Outputs->SdramCount);
+ }
+ }
+ }
+ //
+ // Continue if not valid rank on any channel
+ //
+ if (ChBitMask == 0) {
+ continue;
+ //
+ // This rank does not exist on any of the channels
+ //
+ }
+ //
+ // Reset PerBit Deskew to middle value before byte training
+ // Write timing offset for bit[x] of the DQ byte. Linear from 0-15, each step size is tQCLK/64
+ // Read timing offset for bit[x] of the DQ byte. Linear from 0-15, each step size is tQCLK/64
+ //
+ if (ResetPerBit == 1) {
+ Status = ChangeMargin (MrcData, ParamB, 0x88888888, 0, 1, 0, Rank, 0, 0, 1, 0, MrcRegFileRank);
+ }
+
+ //####################################################
+ //###### Get EH to scale vref sample point by #####
+ //####################################################
+ //
+ // Pass the host last edges by reference
+ // Get EH/VrefScale for the use in timing centering
+ //
+ if (En2D > 0) {
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nCalling DQTimeCenterEH\n");
+ Status = DQTimeCenterEH (
+ MrcData,
+ ChBitMask,
+ Rank,
+ ParamV,
+ MaxVScale,
+ BMap,
+ EH,
+ VrefScale,
+ BERStats
+ );
+ if (Status != mrcSuccess) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_WARNING, "\nDQTimeCenterEH FAILED - Using VrefScale = %d\n", MaxVScale);
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ MrcOemMemorySetDword (&VrefScale[Channel][0], MaxVScale, Outputs->SdramCount);
+ }
+ }
+ } else {
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ MrcOemMemorySetDword (&EH[Channel][0], 1, Outputs->SdramCount);
+ MrcOemMemorySetDword (&VrefScale[Channel][0], 1, Outputs->SdramCount);
+ }
+ }
+
+ Status = GetMarginByte (MrcData, MarginResult, Param, Rank, (MRC_BIT0 << Rank));
+
+#if 0
+#ifdef MRC_DEBUG_PRINT
+ //
+ // Read the margins
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nLstSavd Margins ");
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!((1 << Channel) & ChBitMask)) {
+ continue;
+ }
+
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "%d %d ",
+ MarginResult[ResultType][Rank][Channel][Byte][0],
+ MarginResult[ResultType][Rank][Channel][Byte][1]
+ );
+ }
+ }
+#endif // MRC_DEBUG_PRINT
+#endif
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "### Rank = %d ###\n", Rank);
+ for (Strobe = 0; Strobe < Strobes; Strobe++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n\n### Strobe = %d ###\n", Strobe);
+ if (Outputs->ValidRankMask & (MRC_BIT0 << Rank)) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nChannel\t\t0\t\t\t\t\t\t\t\t\t 1\nByte\t\t");
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE, (
+ Outputs->SdramCount == MAX_SDRAM_IN_DIMM
+ ) ? "0\t1\t2\t3\t4\t\t5\t6\t7\t8\t0\t1\t2\t3\t4\t5\t6\t7\t8\nEdges L/R" :
+ "0\t1\t2\t3\t4\t5\t6\t7\t0\t1\t2\t3\t4\t5\t6\t7\nEdges L/R"
+ );
+ }
+ //####################################################
+ //###### Measure Eye Width at all Vref Points #####
+ //####################################################
+ //
+ // Program Selective error checking for RX. if strobe = 0 then Check even else Check odd
+ //
+ if (EnRxDutyCycle) {
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (ChBitMask & (MRC_BIT0 << Channel)) {
+ Offset = 2 + MCHBAR_CH0_CR_REUT_CH_ERR_CTL_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_ERR_CTL_REG - MCHBAR_CH0_CR_REUT_CH_ERR_CTL_REG) * Channel);
+ MrcWriteCR8 (MrcData, Offset, (0x55 << Strobe));
+ }
+ }
+ }
+ //
+ // Loop through all the Vref Points to Test
+ //
+ for (Vref = 0; Vref < sizeof (VrefPoints) / sizeof (VrefPoints[0]); Vref++) {
+ //
+ // Setup Vref Voltage for this point
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (ChBitMask & (MRC_BIT0 << Channel)) {
+ SkipWait = (ChBitMask >> (Channel + 1)); // Skip if there are more channels
+
+ LoopEnd = (U8) ((ParamV == RdV) ? Outputs->SdramCount : 1);
+ for (Byte = 0; Byte < LoopEnd; Byte++) {
+ Value0 = (S32) (VrefPoints[Vref] * VrefScale[Channel][Byte]) / MaxVScale;
+ Status = ChangeMargin (
+ MrcData,
+ ParamV,
+ Value0,
+ 0,
+ 0,
+ Channel,
+ Rank,
+ Byte,
+ 0,
+ 0,
+ SkipWait,
+ MrcRegFileRank
+ );
+ }
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nVref = %d:\t", Value0);
+
+ //
+ // Run Margin Test
+ //
+ Mode = 0;
+ Status = MrcGetBERMarginByte (
+ MrcData,
+ MarginResult,
+ ChBitMask,
+ Rank,
+ Rank,
+ Param,
+ Mode,
+ BMap,
+ 1,
+ 31,
+ 0,
+ BERStats
+ );
+ //
+ // Store Results; Setup Vref Voltage for this point
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if ((ChBitMask & (MRC_BIT0 << Channel))) {
+
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ Margin = &MarginResult[ResultType][Rank][Channel][Byte][0];
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "%d %d ",
+ MarginResult[ResultType][Rank][Channel][Byte][0],
+ MarginResult[ResultType][Rank][Channel][Byte][1]
+ );
+
+ Center = (S32) (Margin[1] -*Margin);
+ if (Vref == 0) {
+ EW[Channel][Byte] = (Margin[1] +*Margin) / 10;
+ CenterSum[Channel][Byte] = 0;
+ }
+ //
+ // Calculate weight for this point
+ //
+ Weight = EHWeights[Vref] * EH[Channel][Byte] + EWWeights[Vref] * EW[Channel][Byte];
+ CenterSum[Channel][Byte] += Weight * Center;
+ //
+ // Store Edges for Per Bit deskew
+ //
+ Eye = &EyeShape[Vref][Channel][Byte][0];
+ for (Edge = 0; Edge < MAX_EDGES; Edge++) {
+ Eye[Edge] = Margin[Edge];
+ }
+ //
+ // RunTime Improvement. Set margin back to Vref = 0 point when the sign of the VrefPoint changes
+ //
+ if ((VrefPoints[Vref] < 0) &&
+ (Vref < (sizeof (VrefPoints) / sizeof (VrefPoints[0]) - 1)) &&
+ (VrefPoints[Vref + 1] > 0)
+ ) {
+ Eye = &EyeShape[0][Channel][Byte][0];
+ for (Edge = 0; Edge < MAX_EDGES; Edge++) {
+ Margin[Edge] = Eye[Edge];
+ }
+ }
+ }
+ }
+ }
+ //
+ // Loop once at nominal Vref point
+ //
+ if (En2D == 0) {
+ Vref = sizeof (VrefPoints) / sizeof (VrefPoints[0]);
+ }
+ }
+
+ //####################################################
+ //############ Center Results per Byte ###########
+ //####################################################
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n\nWeighted Center\t");
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (ChBitMask & (MRC_BIT0 << Channel)) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+
+ //
+ // Calculate and apply CenterPoint. Round to Nearest Int
+ //
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ DivBy = (SumEH * EH[Channel][Byte] + SumEW * EW[Channel][Byte]);
+ if (DivBy == 0) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "DataTimeCentering2D: Divide by zero\n");
+ return mrcFail;
+ }
+
+ CSum = &CenterSum[Channel][Byte];
+ DivBySign = (*CSum < 0) ? (-1) : 1;
+
+ *CSum = (*CSum + 10 * (DivBySign * DivBy)) / (20 * DivBy);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d\t", *CSum);
+
+ //
+ // Apply new centerpoint
+ //
+ if (Param == RdT) {
+ if (Strobe == 0) {
+ ChannelOut->RxDqsP[Rank][Byte] = (U8) ((S32) ChannelOut->RxDqsP[Rank][Byte] +*CSum);
+ }
+
+ if ((!EnRxDutyCycle) || (Strobe == 1)) {
+ ChannelOut->RxDqsN[Rank][Byte] = (U8) ((S32) ChannelOut->RxDqsN[Rank][Byte] +*CSum);
+ UpdateRxT (MrcData, Channel, Rank, Byte, 0xFF, 0);
+ }
+ } else {
+ ChannelOut->TxDq[Rank][Byte] = (U16) ((S32) ChannelOut->TxDq[Rank][Byte] +*CSum);
+ UpdateTxT (MrcData, Channel, Rank, Byte, 0xFF, 0);
+ }
+ //
+ // Update the Eye Edges
+ //
+ for (Vref = 0; Vref < sizeof (VrefPoints) / sizeof (VrefPoints[0]); Vref++) {
+ Calc = 10 **CSum;
+ Eye = &EyeShape[Vref][Channel][Byte][0];
+ *Eye += Calc;
+ Eye[1] -= Calc;
+
+ //
+ // Save Per Strobe Edges
+ //
+ for (Edge = 0; Edge < MAX_EDGES; Edge++) {
+ StrobeMargin[Vref][Channel][Byte][Strobe][Edge] = EyeShape[Vref][Channel][Byte][Edge];
+ }
+ //
+ // Loop once at nominal Vref point
+ //
+ if (En2D == 0) {
+ Vref = sizeof (VrefPoints) / sizeof (VrefPoints[0]);
+ }
+ }
+ //
+ // Update MrcData for future tests (MarginResult points back to MrcData)
+ // EyeShape for Vref 0 is assumed to have the best shape for future tests.
+ //
+ for (Edge = 0; Edge < MAX_EDGES; Edge++) {
+ MarginResult[ResultType][Rank][Channel][Byte][Edge] = EyeShape[0][Channel][Byte][Edge];
+ }
+ }
+ //
+ // Clean up after test
+ //
+ MrcOemMemorySetDword (&ChannelOut->DataOffsetTrain[0], 0, Outputs->SdramCount);
+ }
+ }
+
+ centerTiming = 0;
+#ifdef MRC_DEBUG_PRINT
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nFinal Center\t");
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (ChBitMask & (MRC_BIT0 << Channel)) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+
+ //
+ // Calculate final center point relative to "zero" as in the 1D case
+ //
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ if (Param == RdT) {
+ if (Strobe == 0) {
+ centerTiming = (U8) (ChannelOut->RxDqsP[Rank][Byte] - 32);
+ }
+
+ if ((!EnRxDutyCycle) || (Strobe == 1)) {
+ centerTiming = (U8) (ChannelOut->RxDqsN[Rank][Byte] - 32);
+ }
+ } else {
+ centerTiming = ChannelOut->TxDq[Rank][Byte] - (ChannelOut->TxDqs[Rank][Byte] + 32);
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d\t", (S8) centerTiming);
+ }
+ }
+ }
+#endif // MRC_DEBUG_PRINT
+ } // End of Byte Centering
+
+ //######################################################
+ //############ Measure Eye Width Per BIT ##########
+ //######################################################
+
+ if (EnPerBit) {
+#if 0
+#ifdef MRC_DEBUG_PRINT
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n\nEdges we pass on to GetMarginBit are\n");
+ for (Vref = 0; Vref < sizeof (VrefPoints) / sizeof (VrefPoints[0]); Vref++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\t\t");
+ //
+ // Setup Vref Voltage for this point
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (ChBitMask & (MRC_BIT0 << Channel)) {
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ for (Edge = 0; Edge < MAX_EDGES; Edge++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d ", EyeShape[Vref][Channel][Byte][Edge]);
+ }
+ }
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+ if (En2D == 0) {
+ Vref = sizeof (VrefPoints) / sizeof (VrefPoints[0]);
+ }
+ }
+#endif // MRC_DEBUG_PRINT
+#endif
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n\n### Measure Eye Width Per BIT\n");
+ //
+ // Recalculate the EH after the Byte Centering
+ //
+ if (EnPerBitEH && (En2D > 0)) {
+ Status = DQTimeCenterEH (
+ MrcData,
+ ChBitMask,
+ Rank,
+ ParamV,
+ MaxVScale,
+ BMap,
+ EH,
+ VrefScale,
+ BERStats
+ );
+ if (Status != mrcSuccess) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_WARNING, "\nDQTimeCenterEH FAILED - Using VrefScale = %d\n", MaxVScale);
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ MrcOemMemorySetDword (&VrefScale[Channel][0], MaxVScale, Outputs->SdramCount);
+ }
+ }
+ }
+ //
+ // No stop on error or selective error cheking
+ // Stop on all lane fail
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (ChBitMask & (MRC_BIT0 << Channel)) {
+#ifdef MRC_DEBUG_PRINT
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel %d", Channel);
+ if (Channel == 0) {
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\t\t\t\t\t\t");
+ }
+ }
+#endif // MRC_DEBUG_PRINT
+ //
+ // SOE = 11b ( Stop on All Lanes Error )
+ //
+ Offset = MCHBAR_CH0_CR_REUT_CH_ERR_CTL_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_ERR_CTL_REG - MCHBAR_CH0_CR_REUT_CH_ERR_CTL_REG) * Channel);
+ ReutChErrCtl.Data = 0;
+ ReutChErrCtl.Bits.Selective_Error_Enable_Cacheline = MCHBAR_CH0_CR_REUT_CH_ERR_CTL_Selective_Error_Enable_Cacheline_MAX;
+ ReutChErrCtl.Bits.Selective_Error_Enable_Chunk = MCHBAR_CH0_CR_REUT_CH_ERR_CTL_Selective_Error_Enable_Chunk_MAX;
+ ReutChErrCtl.Bits.Stop_On_Error_Control = ALSOE;
+ ReutChErrCtl.Bits.Stop_on_Nth_Error = 1;
+ MrcWriteCR (MrcData, Offset, ReutChErrCtl.Data);
+ }
+ }
+
+#ifdef MRC_DEBUG_PRINT
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (ChBitMask & (MRC_BIT0 << Channel)) {
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " Byte % 24d ", Byte);
+ }
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+#endif // MRC_DEBUG_PRINT
+ //
+ // Loop through all the Vref Points to Test
+ //
+ SaveLC = Outputs->DQPatLC;
+ for (Vref = 0; Vref < sizeof (VrefPoints) / sizeof (VrefPoints[0]); Vref++) {
+ //
+ // Setup Vref Voltage for this point
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if ((ChBitMask & (MRC_BIT0 << Channel))) {
+
+ SkipWait = (ChBitMask >> (Channel + 1)); // Skip if there are more channels
+ //
+ // Change Vref margin
+ //
+ LoopEnd = (U8) ((ParamV == RdV) ? Outputs->SdramCount : 1);
+ for (Byte = 0; Byte < LoopEnd; Byte++) {
+ Value0 = (S32) (VrefPoints[Vref] * VrefScale[Channel][Byte]) / MaxVScale;
+ Status = ChangeMargin (
+ MrcData,
+ ParamV,
+ Value0,
+ 0,
+ 0,
+ Channel,
+ Rank,
+ Byte,
+ 0,
+ 0,
+ SkipWait,
+ MrcRegFileRank
+ );
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel %d Vref = %d\t", Channel, Value0);
+ MrcOemMemorySetDword (&MarginBit[Channel][0][0][0], 8, MAX_SDRAM_IN_DIMM * MAX_BITS * MAX_EDGES);
+ }
+ //
+ // Run Margin Test; Loop through 2 times. Once at low loop count and Once at high loopcount. Improves runtime
+ // @todo: Need loop count of 2 when not using BASICVA
+ //
+ for (LCloop = 0; LCloop < 1; LCloop++) {
+ Outputs->DQPatLC = (LCloop == 0) ? 1 : SaveLC;
+
+ Mode = 0;
+ Status = MrcGetMarginBit (MrcData, ChBitMask, Rank, MarginBit, EyeShape[Vref], ParamB, Mode, 15);
+ }
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nCSum ");
+ // Store Results
+ // Setup Vref Voltage for this point
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (ChBitMask & (MRC_BIT0 << Channel)) {
+
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ //
+ // Calculate weight for this point
+ //
+ Weight = EHWeights[Vref] * EH[Channel][Byte] + EWWeights[Vref] * EW[Channel][Byte];
+ for (Bit = 0; Bit < MAX_BITS; Bit++) {
+ Margin = &MarginBit[Channel][Byte][Bit][0];
+ CSum = &CenterSumBit[Channel][Byte][Bit];
+
+ Center = ((Margin[1] - 8) - (8 - *Margin));
+ if (Vref == 0) {
+ *CSum = 0;
+ }
+
+ *CSum += Weight * Center;
+ //MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "% 4d", *CSum);
+ }
+ //MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " Weight %d ", Weight);
+ }
+ }
+ }
+ //
+ // Loop once at nominal Vref point
+ //
+ if (En2D == 0) {
+ Vref = sizeof (VrefPoints) / sizeof (VrefPoints[0]);
+ }
+ }
+
+ //######################################################
+ //############# Center Result Per BIT #############
+ //######################################################
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nWtd Ctr\t ");
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (ChBitMask & (MRC_BIT0 << Channel)) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+
+ //
+ // Cleanup after test - go back to the per byte setup
+ //
+ ReutChErrCtl.Data = 0;
+ ReutChErrCtl.Bits.Stop_on_Nth_Error = 1;
+ ReutChErrCtl.Bits.Stop_On_Error_Control = NSOE;
+ ReutChErrCtl.Bits.Selective_Error_Enable_Chunk = MCHBAR_CH0_CR_REUT_CH_ERR_CTL_Selective_Error_Enable_Chunk_MAX;
+ ReutChErrCtl.Bits.Selective_Error_Enable_Cacheline = MCHBAR_CH0_CR_REUT_CH_ERR_CTL_Selective_Error_Enable_Cacheline_MAX;
+ Offset = MCHBAR_CH0_CR_REUT_CH_ERR_CTL_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_ERR_CTL_REG - MCHBAR_CH0_CR_REUT_CH_ERR_CTL_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, ReutChErrCtl.Data);
+
+ //
+ // Calculate and apply CenterPoint. Round to Nearest Int
+ //
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ DivBy = (SumEH * EH[Channel][Byte] + SumEW * EW[Channel][Byte]);
+
+ //
+ // Make sure DivBy is never 0
+ //
+ if (DivBy == 0) {
+ DivBy = 1;
+ }
+
+ CrPerBitRank.Data = 0;
+ for (Bit = 0; Bit < MAX_BITS; Bit++) {
+ CenterBit = &CenterSumBit[Channel][Byte][Bit];
+ RxDqPbCenter = &ChannelOut->RxDqPb[Rank][Byte][Bit].Center;
+ TxDqPbCenter = &ChannelOut->TxDqPb[Rank][Byte][Bit].Center;
+
+ DivBySign = (*CenterBit < 0) ? (-1) : 1;
+ *CenterBit = (*CenterBit + (DivBySign * DivBy)) / (2 * DivBy);
+
+ //
+ // Centerpoint needs to be added to starting DqPb value
+ //
+ *CenterBit += (Param == RdT) ? (S32) *RxDqPbCenter : (S32) *TxDqPbCenter;
+
+ //
+ // Check for saturation
+ //
+ if (*CenterBit > DDRDATA0CH0_CR_RXPERBITRANK0_Lane0_MAX) {
+ *CenterBit = DDRDATA0CH0_CR_RXPERBITRANK0_Lane0_MAX;
+ } else if (*CenterBit < 0) {
+ *CenterBit = 0;
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "% 4x", *CenterBit);
+
+ //
+ // Update MrcData
+ //
+ if (Param == RdT) {
+ *RxDqPbCenter = (U8) *CenterBit;
+ } else {
+ *TxDqPbCenter = (U8) *CenterBit;
+ }
+
+ CrPerBitRank.Data |= (*CenterBit << (4 * Bit));
+ }
+ //
+ // Apply new centerpoint
+ // ParamB already has the proper per bit parameter based on Param
+ //
+ Status = ChangeMargin (
+ MrcData,
+ ParamB,
+ CrPerBitRank.Data,
+ 0,
+ 0,
+ Channel,
+ Rank,
+ Byte,
+ 0,
+ 0,
+ 0,
+ MrcRegFileRank
+ );
+
+ //MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " DivBy %d ", DivBy);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " ");
+ }
+ //
+ // Clear any old state in DataTrain Offset
+ //
+ MrcOemMemorySetDword (&ChannelOut->DataOffsetTrain[0], 0, Outputs->SdramCount);
+ }
+ }
+ //
+ // No stop on error or selective error cheking
+ // Stop on all lane fail
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (ChBitMask & (MRC_BIT0 << Channel)) {
+ //
+ // SOE = 11b ( Stop on All Lanes Error )
+ //
+ ReutChErrCtl.Data = 0;
+ ReutChErrCtl.Bits.Stop_on_Nth_Error = 1;
+ ReutChErrCtl.Bits.Stop_On_Error_Control = ALSOE;
+ ReutChErrCtl.Bits.Selective_Error_Enable_Chunk = MCHBAR_CH0_CR_REUT_CH_ERR_CTL_Selective_Error_Enable_Chunk_MAX;
+ ReutChErrCtl.Bits.Selective_Error_Enable_Cacheline = MCHBAR_CH0_CR_REUT_CH_ERR_CTL_Selective_Error_Enable_Cacheline_MAX;
+ Offset = MCHBAR_CH0_CR_REUT_CH_ERR_CTL_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_ERR_CTL_REG - MCHBAR_CH0_CR_REUT_CH_ERR_CTL_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, ReutChErrCtl.Data);
+ }
+ }
+
+#if 0 // This code is for debug purposes ONLY if we want to know the perbyte margins after calling the perbit centering
+#ifdef MRC_DEBUG_PRINT
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n\nEdges\t");
+ for (Vref = 0; Vref < (sizeof (VrefPoints) / sizeof (VrefPoints[0])); Vref++) {
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (ChBitMask & (MRC_BIT0 << Channel)) {
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ for (Edge = 0; Edge < MAX_EDGES; Edge++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d ", EyeShape[Vref][Channel][Byte][Edge]);
+ }
+ }
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+ if (En2D == 0) {
+ Vref = sizeof (VrefPoints) / sizeof (VrefPoints[0]);
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nCalling GetMarginBit with per Byte Timing\nByte\n");
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (ChBitMask & (1 << Channel)) {
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d\t\t\t\t\t", Byte);
+ }
+ }
+ }
+
+ for (Vref = 0; Vref < (sizeof (VrefPoints) / sizeof (VrefPoints[0])); Vref++) {
+ Mode = 0;
+ Status = MrcGetMarginBit (MrcData, ChBitMask, Rank, MarginBit, EyeShape[Vref], Param, Mode, 31);
+ //
+ // Loop once at nominal Vref point
+ //
+ if (En2D == 0) {
+ Vref = sizeof (VrefPoints) / sizeof (VrefPoints[0]);
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nPerByte Margins after Bit Centering\nLeft\tRight\tCenter\n");
+ for (Vref = 0; Vref < (sizeof (VrefPoints) / sizeof (VrefPoints[0])); Vref++) {
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (ChBitMask & (MRC_BIT0 << Channel)) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel %d\n", Channel);
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "%d\t%d\t%d\n",
+ EyeShape[Vref][Channel][Byte][0],
+ EyeShape[Vref][Channel][Byte][1],
+ (((S32) EyeShape[Vref][Channel][Byte][1] - (S32) EyeShape[Vref][Channel][Byte][0]) / (2 * 10))
+ );
+ }
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+ if (En2D == 0) {
+ Vref = sizeof (VrefPoints) / sizeof (VrefPoints[0]);
+ }
+ }
+#endif // MRC_DEBUG_PRINT
+#endif
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (ChBitMask & (MRC_BIT0 << Channel)) {
+ //
+ // Cleanup after test
+ //
+ ReutChErrCtl.Data = 0;
+ ReutChErrCtl.Bits.Stop_on_Nth_Error = 1;
+ ReutChErrCtl.Bits.Stop_On_Error_Control = NSOE;
+ ReutChErrCtl.Bits.Selective_Error_Enable_Chunk = MCHBAR_CH0_CR_REUT_CH_ERR_CTL_Selective_Error_Enable_Chunk_MAX;
+ ReutChErrCtl.Bits.Selective_Error_Enable_Cacheline = MCHBAR_CH0_CR_REUT_CH_ERR_CTL_Selective_Error_Enable_Cacheline_MAX;
+ Offset = MCHBAR_CH0_CR_REUT_CH_ERR_CTL_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_ERR_CTL_REG - MCHBAR_CH0_CR_REUT_CH_ERR_CTL_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, ReutChErrCtl.Data);
+ }
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+ } //End of Rank
+ //
+ // Clean Up after test
+ //
+ Outputs->EnDumRd = 0;
+ Status = ChangeMargin (MrcData, ParamV, 0, 0, 1, 0, 0, 0, 0, 0, 0, MrcRegFileCurrent);
+ return Status;
+}
+
+/**
+ Subfunction of 2D Timing Centering
+ Measures paramV margin across ch/bytes and updates the EH/VrefScale variables
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] ChBitMask - Channel Bit mak for which test should be setup for.
+ @param[in] rank - Defines rank to used for MrcData
+ @param[in] ParamV - Margin parameter
+ @param[in] MaxVScale - Maximum Voltage Scale to use
+ @param[in] BMap - Byte mapping to configure error counter control register
+ @param[in,out] EH - Structure that stores start, stop and increment details for address
+ @param[in,out] VrefScale - Parameter to be updated
+ @param[in,out] BERStats - Bit Error Rate Statistics.
+
+ @retval mrcSuccess if successful, otherwise the function returns an error status.
+**/
+MrcStatus
+DQTimeCenterEH (
+ IN MrcParameters * const MrcData,
+ IN const U8 ChBitMask,
+ IN const U8 rank,
+ IN const U8 ParamV,
+ IN const U8 MaxVScale,
+ IN U8 * const BMap,
+ IN OUT U32 EH[MAX_CHANNEL][MAX_SDRAM_IN_DIMM],
+ IN OUT U32 VrefScale[MAX_CHANNEL][MAX_SDRAM_IN_DIMM],
+ IN OUT U32 * const BERStats
+ )
+{
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ U32 *MarginResult;
+ U32 *VrefS;
+ MrcStatus Status;
+ U8 ResultType;
+ U8 Channel;
+ U8 Byte;
+ U32 MinVrefScale;
+ U16 Mode;
+
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "DQTimeCenterEH:\n");
+ // Run Margin Test
+ //
+ Mode = 0;
+ Status = GetMarginByte (MrcData, Outputs->MarginResult, ParamV, rank, (MRC_BIT0 << rank));
+ if (mrcSuccess == Status) {
+ Status = MrcGetBERMarginByte (
+ MrcData,
+ Outputs->MarginResult,
+ ChBitMask,
+ rank,
+ rank,
+ ParamV,
+ Mode,
+ BMap,
+ 1,
+ MAX_POSSIBLE_VREF,
+ 0,
+ BERStats
+ );
+ if (mrcSuccess == Status) {
+ Status = ScaleMarginByte (MrcData, Outputs->MarginResult, ParamV, rank);
+ if (mrcSuccess == Status) {
+ ResultType = GetMarginResultType (ParamV);
+
+ //
+ // Update VrefScale with results
+ //
+ for (Channel = 0; (Channel < MAX_CHANNEL) && (mrcSuccess == Status); Channel++) {
+ if (ChBitMask & (MRC_BIT0 << Channel)) {
+ //
+ // Calculate EH and VrefScale
+ //
+ MinVrefScale = MaxVScale;
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ MarginResult = &Outputs->MarginResult[ResultType][rank][Channel][Byte][0];
+ VrefS = &VrefScale[Channel][Byte];
+ EH[Channel][Byte] = (*MarginResult + *(MarginResult + 1)) / 10;
+ *VrefS = EH[Channel][Byte] / 2;
+
+ if (*VrefS > MaxVScale) {
+ *VrefS = MaxVScale;
+ }
+
+ if (MinVrefScale > *VrefS) {
+ MinVrefScale = *VrefS;
+ }
+ //
+ // Scale host back to correct values
+ //
+ Status = ScaleMarginByte (MrcData, Outputs->MarginResult, ParamV, rank);
+ if (mrcSuccess != Status) {
+ break;
+ }
+ //
+ // For Tx, use the same Vref limit for all bytes. Store result in byte0
+ //
+ if (ParamV == WrV) {
+ MrcOemMemorySetDword (&VrefScale[Channel][0], MinVrefScale, Outputs->SdramCount);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ //
+ // Updates EH and VrefScale
+ //
+ return Status;
+}
+
+/**
+ Update the Vref value
+ if VrefType = 0 Updates Ch0 Vref_Dq
+ if VrefType = 1 Updates Ch1 Vref_Dq
+ if VrefType = 2 Updates Vref_CA
+
+ @param[in,out] MrcData - Include all MRC global data.
+ @param[in] VrefType - Determines the Vref to change
+ @param[in] UpdateMrcData - Used to decide if Mrc host must be updated
+ @param[in] Offset - Vref value
+ @param[in] SkipWait - Determines if we will wait for vref to settle after writing to register
+
+ @retval Nothing
+**/
+void
+UpdateVrefWaitTilStable (
+ IN OUT MrcParameters *const MrcData,
+ IN const U8 VrefType,
+ IN const U8 UpdateMrcData,
+ IN S32 Offset,
+ IN U8 SkipWait
+ )
+{
+ const MrcDebug *Debug;
+ MrcInput *Inputs;
+ MrcOutput *Outputs;
+ U32 CheckMask;
+ U8 OffH;
+ U8 Count;
+ DDRDATA7CH1_CR_DDRCRVREFADJUST1_STRUCT DdrCrVrefAdjust;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+
+ //
+ // Calculate and write the new Vref offset value.
+ //
+ switch (VrefType) {
+ case 0:
+ OffH = (U8) (((DDRDATA7CH1_CR_DDRCRVREFADJUST1_STRUCT *) (&Outputs->DimmVref))->Bits.Ch0VrefCtl);
+ break;
+
+ case 1:
+ OffH = (U8) (((DDRDATA7CH1_CR_DDRCRVREFADJUST1_STRUCT *) (&Outputs->DimmVref))->Bits.Ch1VrefCtl);
+ break;
+
+ case 2:
+ OffH = (U8) (((DDRDATA7CH1_CR_DDRCRVREFADJUST1_STRUCT *) (&Outputs->DimmVref))->Bits.CAVrefCtl);
+ break;
+
+ default:
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "UpdateVrefWaitTilStable called with an incorrect value!\n");
+ return;
+ }
+
+ Offset = Offset + (S8) MrcSE (OffH, 7, 8); // Get offset from host. SE = Sign Extend number 7->8 bits
+ if (Offset > MAX_POSSIBLE_VREF) {
+ Offset = MAX_POSSIBLE_VREF;
+ } else if (Offset < (-1 * MAX_POSSIBLE_VREF)) {
+ Offset = -1 * MAX_POSSIBLE_VREF;
+ }
+
+ if (UpdateMrcData) {
+ switch (VrefType) {
+ case 0:
+ (((DDRDATA7CH1_CR_DDRCRVREFADJUST1_STRUCT *) (&Outputs->DimmVref))->Bits.Ch0VrefCtl) = Offset;
+ break;
+
+ case 1:
+ (((DDRDATA7CH1_CR_DDRCRVREFADJUST1_STRUCT *) (&Outputs->DimmVref))->Bits.Ch1VrefCtl) = Offset;
+ break;
+
+ case 2:
+ (((DDRDATA7CH1_CR_DDRCRVREFADJUST1_STRUCT *) (&Outputs->DimmVref))->Bits.CAVrefCtl) = Offset;
+ break;
+
+ default:
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "UpdateVrefWaitTilStable called with an incorrect value!\n");
+ return;
+ }
+ }
+
+ DdrCrVrefAdjust.Data = MrcReadCR (MrcData, DDRDATA7CH1_CR_DDRCRVREFADJUST1_REG);
+ switch (VrefType) {
+ case 0:
+ DdrCrVrefAdjust.Bits.Ch0VrefCtl = Offset;
+ CheckMask = DDRDATA7CH1_CR_DDRCRVREFADJUST1_ch0SlowBW_MSK;
+ break;
+
+ case 1:
+ DdrCrVrefAdjust.Bits.Ch1VrefCtl = Offset;
+ CheckMask = DDRDATA7CH1_CR_DDRCRVREFADJUST1_ch1SlowBW_MSK;
+ break;
+
+ case 2:
+ DdrCrVrefAdjust.Bits.CAVrefCtl = Offset;
+ CheckMask = DDRDATA7CH1_CR_DDRCRVREFADJUST1_caSlowBW_MSK;
+ break;
+
+ default:
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "UpdateVrefWaitTilStable called with an incorrect value!\n");
+ return;
+ }
+
+ MrcWriteCrMulticast (MrcData, DDRDATA7CH1_CR_DDRCRVREFADJUST1_REG, DdrCrVrefAdjust.Data);
+
+ //
+ // Wait for Vref to settle. Note VrefCA needs longer to settle.
+ //
+ if (!SkipWait) {
+ Count = 0;
+ while (Count < 50) {
+ //
+ // Don't wait more than 50uS
+ //
+ if ((MrcReadCR (MrcData, DDRDATA7CH1_CR_DDRCRVREFADJUST1_REG) & CheckMask) == CheckMask) {
+ break;
+ }
+
+ MrcWait (MrcData, 1 * HPET_1US);
+ Count += 1;
+ }
+
+ if (Count >= 50) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_WARNING, "CAVref circuit failed to converge, \n");
+ }
+
+ MrcWait (MrcData, 5 * HPET_1US); // Add 5us to make sure everything is done
+ }
+}
+
+/**
+ This function is used to move CMD/CTL/CLK/CKE PIs during training
+
+ @param[in,out] MrcData - Include all MRC global data.
+ @param[in] Channel - Channel to shift PI for
+ @param[in] Iteration - Determines which PI to shift:
+ MrcIterationClock = 0
+ MrcIterationCmdN = 1
+ MrcIterationCmdS = 2
+ MrcIterationCke = 3
+ MrcIterationCtl = 4
+ MrcIterationCmdV = 5
+ @param[in] RankMask - Ranks to work on
+ @param[in] GroupMask - which LPDDR groups to work on for CMD/CLK/CKE; not used for DDR3
+ @param[in] NewValue - value to shift in case of CLK Iteration, New value for all other cases
+ @param[in] UpdateHost - Determines if MrcData structure is updated
+
+ @retval Nothing
+**/
+void
+ShiftPIforCmdTraining (
+ IN OUT MrcParameters *const MrcData,
+ IN const U8 Channel,
+ IN const U8 Iteration,
+ IN const U8 RankMask,
+ IN const U8 GroupMask,
+ IN S32 NewValue,
+ IN const U8 UpdateHost
+ )
+{
+ const MrcInput *Inputs;
+ const MrcDebug *Debug;
+ const MrcChannelIn *ChannelIn;
+ MrcChannelOut *ChannelOut;
+ MrcOutput *Outputs;
+ U32 Offset;
+ U32 ByteMask;
+ U32 BitOffset;
+ U8 Rank;
+#ifdef ULT_FLAG
+ U8 Group;
+ U32 Cke;
+ U32 CkeRankMapping;
+#endif // ULT_FLAG
+ S8 Shift;
+ BOOL Lpddr;
+ DDRCLKCH0_CR_DDRCRCLKPICODE_STRUCT ClkPiCode;
+ DDRCKECH0_CR_DDRCRCMDPICODING_STRUCT CkeCmdPiCoding;
+ DDRCMDSCH0_CR_DDRCRCMDPICODING_STRUCT CmdSPiCoding;
+ DDRCMDNCH0_CR_DDRCRCMDPICODING_STRUCT CmdNPiCoding;
+ DDRCTLCH0_CR_DDRCRCTLPICODING_STRUCT CtlPiCoding;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ ChannelIn = &Inputs->Controller[0].Channel[Channel];
+ ChannelOut = &Outputs->Controller[0].Channel[Channel];
+ Lpddr = (Outputs->DdrType == MRC_DDR_TYPE_LPDDR3);
+
+ if (Iteration != MrcIterationClock) {
+ if (NewValue < 0) {
+ NewValue = 0;
+ } else if (NewValue > 127) {
+ NewValue = 127;
+ }
+ }
+
+ //MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nShiftPIforCmdTraining: Iteration: %d, Channel: %d, RankMask: %d, GroupMask: %d, NewValue = 0x%x\n", Iteration, Channel, RankMask, GroupMask, NewValue);
+
+ switch (Iteration) {
+ case MrcIterationClock: // SHIFT CLOCK
+ ClkPiCode.Data = 0;
+ ByteMask = 0x1FF; // Shift DQ PI on all 9 bytes by default on DDR3
+
+#ifdef ULT_FLAG
+ if (Lpddr) {
+ //
+ // In LPDDR clocks are per group, not per rank
+ //
+ for (Group = 0; Group < 2; Group++) {
+ BitOffset = DDRCLKCH0_CR_DDRCRCLKPICODE_PiSettingRank0_WID * Group;
+ if (GroupMask & (1 << Group)) {
+ Shift = (ChannelOut->ClkPiCode[Group] + NewValue) % 128;
+ if (Shift < 0) {
+ Shift = (128 - ABS (Shift));
+ }
+
+ Shift &= DDRCLKCH0_CR_DDRCRCLKPICODE_PiSettingRank0_MSK;
+ if (UpdateHost) {
+ ChannelOut->ClkPiCode[Group] = Shift;
+ }
+
+ ClkPiCode.Data += (Shift << BitOffset);
+ //
+ // Each clock spans all ranks, so need to shift DQ PIs on all ranks, for bytes in this group only
+ //
+ ByteMask = ChannelIn->DQByteMap[MrcIterationClock][Group];
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if (MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ ShiftDQPIs (MrcData, Channel, Rank, ByteMask, (S8) NewValue, UpdateHost, 0);
+ }
+ }
+ } else {
+ ClkPiCode.Data += (ChannelOut->ClkPiCode[Group] << BitOffset);
+ }
+ } // for Group
+ } else
+#endif // ULT_FLAG
+ {
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ BitOffset = DDRCLKCH0_CR_DDRCRCLKPICODE_PiSettingRank0_WID * Rank;
+ if (RankMask & (1 << Rank)) {
+ Shift = (ChannelOut->ClkPiCode[Rank] + NewValue) % 128;
+ if (Shift < 0) {
+ Shift = (128 - ABS (Shift));
+ }
+
+ Shift &= DDRCLKCH0_CR_DDRCRCLKPICODE_PiSettingRank0_MSK;
+ if (UpdateHost) {
+ ChannelOut->ClkPiCode[Rank] = Shift;
+ }
+
+ ClkPiCode.Data += (Shift << BitOffset);
+ ShiftDQPIs (MrcData, Channel, Rank, ByteMask, (S8) NewValue, UpdateHost, 0);
+ } else {
+ ClkPiCode.Data += (ChannelOut->ClkPiCode[Rank] << BitOffset);
+ }
+ }
+ }
+
+ Offset = DDRCLKCH0_CR_DDRCRCLKPICODE_REG + ((DDRCLKCH1_CR_DDRCRCLKPICODE_REG - DDRCLKCH0_CR_DDRCRCLKPICODE_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, ClkPiCode.Data);
+ //MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "**** ShiftPIforCmdTraining, Iteration = %d, CRValue = 0x%x ****\n", Iteration,CRValue);
+ break;
+
+ case MrcIterationCmdN: // SHIFT COMMAND NORTH
+ CmdNPiCoding.Data = 0;
+ NewValue = MIN (NewValue, DDRCMDNCH0_CR_DDRCRCMDPICODING_CmdPi0Code_MAX);
+ //
+ // HSW ULT LPDDR3: CMDN.CmdPi1Code controls CAB
+ // HSW ULT DDR3L: Both CmdPi0Code and CmdPi1Code should have the same value
+ // HSW TRAD DDR3L: No harm setting CmdPi1Code same as CmdPi0Code
+ //
+ CmdNPiCoding.Bits.CmdPi0Code = NewValue;
+ CmdNPiCoding.Bits.CmdPi1Code = NewValue;
+ Offset = DDRCMDNCH0_CR_DDRCRCMDPICODING_REG +
+ ((DDRCMDNCH1_CR_DDRCRCMDPICODING_REG - DDRCMDNCH0_CR_DDRCRCMDPICODING_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, CmdNPiCoding.Data);
+ if (UpdateHost) {
+ ChannelOut->CmdnCmdPiCode[0] = NewValue;
+ ChannelOut->CmdnCmdPiCode[1] = NewValue;
+ }
+ break;
+
+ case MrcIterationCmdS: // SHIFT COMMAND SOUTH
+ CmdSPiCoding.Data = 0;
+ NewValue = MIN (NewValue, DDRCMDSCH0_CR_DDRCRCMDPICODING_CmdPi0Code_MAX);
+ //
+ // HSW ULT LPDDR3: CMDS.CmdPi0Code controls CAA, CMDS.CmdPi1Code controls CAB
+ // HSW ULT DDR3L: Both CmdPi0Code and CmdPi1Code should have the same value, also program CKE fub
+ // HSW TRAD DDR3L: No harm setting CmdPi1Code same as CmdPi0Code, also program CKE fub
+ //
+#ifdef ULT_FLAG
+ if (Lpddr) {
+ CmdSPiCoding.Bits.CmdPi0Code = (GroupMask & 1) ? (U32) NewValue : ChannelOut->CmdsCmdPiCode[0]; // CAA
+ CmdSPiCoding.Bits.CmdPi1Code = (GroupMask & 2) ? (U32) NewValue : ChannelOut->CmdsCmdPiCode[1]; // CAB
+ } else
+#endif // ULT_FLAG
+ {
+ CmdSPiCoding.Bits.CmdPi0Code = NewValue;
+ CmdSPiCoding.Bits.CmdPi1Code = NewValue;
+
+ CkeCmdPiCoding.Data = 0;
+ NewValue = MIN (NewValue, DDRCKECH0_CR_DDRCRCMDPICODING_CmdPi0Code_MAX);
+ CkeCmdPiCoding.Bits.CmdPi0Code = NewValue;
+ CkeCmdPiCoding.Bits.CmdPi1Code = NewValue;
+ Offset = DDRCKECH0_CR_DDRCRCMDPICODING_REG +
+ ((DDRCKECH1_CR_DDRCRCMDPICODING_REG - DDRCKECH0_CR_DDRCRCMDPICODING_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, CkeCmdPiCoding.Data);
+ if (UpdateHost) {
+ ChannelOut->CkeCmdPiCode[0] = NewValue;
+ ChannelOut->CkeCmdPiCode[1] = NewValue;
+ }
+ }
+
+ if (UpdateHost) {
+ ChannelOut->CmdsCmdPiCode[0] = CmdSPiCoding.Bits.CmdPi0Code;
+ ChannelOut->CmdsCmdPiCode[1] = CmdSPiCoding.Bits.CmdPi1Code;
+ }
+
+ Offset = DDRCMDSCH0_CR_DDRCRCMDPICODING_REG +
+ ((DDRCMDSCH1_CR_DDRCRCMDPICODING_REG - DDRCMDSCH0_CR_DDRCRCMDPICODING_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, CmdSPiCoding.Data);
+ break;
+
+ case MrcIterationCke: // Shift CKE command
+ CkeCmdPiCoding.Data = 0;
+ NewValue = MIN (NewValue, DDRCKECH0_CR_DDRCRCMDPICODING_CmdPi0Code_MAX);
+ //
+ // HSW ULT LPDDR3: CKE.CmdPi0Code controls CAA
+ // HSW ULT DDR3L: Both CmdPi0Code and CmdPi1Code should have the same value
+ // HSW TRAD DDR3L: No harm setting CmdPi1Code same as CmdPi0Code
+ //
+ CkeCmdPiCoding.Bits.CmdPi0Code = NewValue;
+ CkeCmdPiCoding.Bits.CmdPi1Code = NewValue;
+ Offset = DDRCKECH0_CR_DDRCRCMDPICODING_REG +
+ ((DDRCKECH1_CR_DDRCRCMDPICODING_REG - DDRCKECH0_CR_DDRCRCMDPICODING_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, CkeCmdPiCoding.Data);
+ if (UpdateHost) {
+ ChannelOut->CkeCmdPiCode[0] = NewValue;
+ ChannelOut->CkeCmdPiCode[1] = NewValue;
+ }
+ break;
+
+ case MrcIterationCtl: // Shift CS/ODT and CKE.Control
+ CtlPiCoding.Data = 0;
+ NewValue = MIN (NewValue, DDRCTLCH0_CR_DDRCRCTLPICODING_CtlPiCode0_MAX);
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if (RankMask & (1 << Rank)) {
+ CtlPiCoding.Data += (NewValue << (DDRCTLCH0_CR_DDRCRCTLPICODING_CtlPiCode0_WID * Rank));
+ if (UpdateHost) {
+ ChannelOut->CtlPiCode[Rank] = (U8) NewValue;
+ ChannelOut->CkePiCode[Rank] = (U8) NewValue;
+ }
+ } else {
+ CtlPiCoding.Data += (ChannelOut->CtlPiCode[Rank] << (DDRCTLCH0_CR_DDRCRCTLPICODING_CtlPiCode0_WID * Rank));
+ }
+ }
+
+#ifdef ULT_FLAG
+ if (Lpddr && Inputs->LpddrDramOdt) {
+ //
+ // ODT[0] (equal to CS[0] PI setting) goes in to CTL.CtlPiCode2
+ //
+ CtlPiCoding.Bits.CtlPiCode2 = ChannelOut->CtlPiCode[0];
+ }
+#endif // ULT_FLAG
+ Offset = DDRCTLCH0_CR_DDRCRCTLPICODING_REG +
+ ((DDRCTLCH1_CR_DDRCRCTLPICODING_REG - DDRCTLCH0_CR_DDRCRCTLPICODING_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, CtlPiCoding.Data);
+
+#ifdef ULT_FLAG
+ if (Lpddr) {
+ CtlPiCoding.Data = 0;
+ //
+ // Use CKE-to-Rank mapping: [3:0] - Channel 0, [7:4] - Channel 1
+ //
+ CkeRankMapping = (Inputs->CkeRankMapping >> (Channel * 4)) & 0x0F;
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ for (Cke = 0; Cke <= 3; Cke++) {
+ if (((CkeRankMapping >> Cke) & 1) == Rank) {
+ //
+ // This CKE pin is connected to this Rank
+ //
+ CtlPiCoding.Data += (ChannelOut->CkePiCode[Rank] << (DDRCKECH0_CR_DDRCRCTLPICODING_CtlPiCode0_WID * Cke));
+ }
+ }
+ }
+ //
+ // Put average of CKE2 and CKE3 into CKE2 PI setting.
+ //
+ CtlPiCoding.Bits.CtlPiCode2 = (CtlPiCoding.Bits.CtlPiCode2 + CtlPiCoding.Bits.CtlPiCode3) / 2;
+ }
+#endif // ULT_FLAG
+ Offset = DDRCKECH0_CR_DDRCRCTLPICODING_REG +
+ ((DDRCKECH1_CR_DDRCRCTLPICODING_REG - DDRCKECH0_CR_DDRCRCTLPICODING_REG) * Channel);
+ CtlPiCoding.Bits.CtlPiCode3 = 0; // Do not write PiCode3
+ MrcWriteCR (MrcData, Offset, CtlPiCoding.Data);
+ break;
+
+ default:
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_WARNING, "WARNING...Unknown parameter to shift\n");
+ break;
+ }
+
+ return;
+}
+
+/**
+ Shifts RcvEn, WriteLevel and WriteDQS timing for all bytes
+ Usually used when moving the clocks on a channel
+
+ @param[in,out] MrcData - Include all MRC global data.
+ @param[in] Channel - Channel to update
+ @param[in] Rank - Rank to update
+ @param[in] ByteMask - Bytes to update
+ @param[in] Offset - value to shift
+ @param[in] UpdateHost - Determines if MrcData structure is updated
+ @param[in] SkipTx - Determines if TX update should be skipped
+
+ @retval Nothing
+**/
+void
+ShiftDQPIs (
+ IN OUT MrcParameters *const MrcData,
+ IN const U8 Channel,
+ IN const U8 Rank,
+ IN const U32 ByteMask,
+ IN const S8 Offset,
+ IN const U8 UpdateHost,
+ IN const U8 SkipTx
+ )
+{
+ MrcOutput *Outputs;
+ MrcChannelOut *ChannelOut;
+ U8 Byte;
+ S8 OffTx;
+ U16 RcvEnValue;
+ DDRDATA0CH0_CR_TXTRAINRANK0_STRUCT CrTxTrainRank;
+
+ const MrcDebug *Debug;
+
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ ChannelOut = &Outputs->Controller[0].Channel[Channel];
+ OffTx = SkipTx ? 0 : Offset;
+
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ if (((1 << Byte) & ByteMask) == 0) {
+ continue;
+ }
+
+ RcvEnValue = ChannelOut->RcvEn[Rank][Byte] + Offset;
+ if ((S16) RcvEnValue < 0) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_WARNING, "WARNING: RcvEn PI wrapped below zero!\n");
+ RcvEnValue = 0; // Don't go below zero
+ } else if (RcvEnValue > DDRDATA_CR_RXTRAINRANK0_RxRcvEnPi_MAX) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_WARNING, "WARNING: RcvEn PI wrapped above 9 bits!\n");
+ RcvEnValue = DDRDATA_CR_RXTRAINRANK0_RxRcvEnPi_MAX; // Don't go above max
+ }
+
+ UpdateRxT (MrcData, Channel, Rank, Byte, 0, RcvEnValue);
+
+ CrTxTrainRank.Data = 0;
+ CrTxTrainRank.Bits.TxEqualization = ChannelOut->TxEq[Rank][Byte];
+ CrTxTrainRank.Bits.TxDqsDelay = ChannelOut->TxDqs[Rank][Byte] + OffTx;
+ CrTxTrainRank.Bits.TxDqDelay = ChannelOut->TxDq[Rank][Byte] + OffTx;
+ UpdateTxT (MrcData, Channel, Rank, Byte, 3, CrTxTrainRank.Data);
+
+ if (UpdateHost) {
+ ChannelOut->RcvEn[Rank][Byte] = RcvEnValue;
+ ChannelOut->TxDqs[Rank][Byte] += OffTx;
+ ChannelOut->TxDq[Rank][Byte] += OffTx;
+ }
+ }
+
+ return;
+}
+
+/**
+ Retrieve the current memory frequency and clock from the memory controller.
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in, out] MemoryClock - The current memory clock.
+ @param[in, out] Ratio - The current memory ratio setting.
+ @param[in, out] RefClk - The current memory reference clock.
+
+ @retval: The current memory frequency.
+**/
+MrcFrequency
+MrcGetCurrentMemoryFrequency (
+ MrcParameters * const MrcData,
+ U32 * const MemoryClock,
+ MrcClockRatio * const Ratio,
+ MrcRefClkSelect * const RefClk
+ )
+{
+ const MrcInput *Inputs;
+ const MrcOutput *Outputs;
+ PCU_CR_MC_BIOS_DATA_PCU_STRUCT McBiosData;
+ PCU_CR_MC_BIOS_REQ_PCU_STRUCT McBiosReqPcu;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ McBiosReqPcu.Data = MrcReadCR (MrcData, PCU_CR_MC_BIOS_REQ_PCU_REG);
+ McBiosData.Data = MrcReadCR (MrcData, PCU_CR_MC_BIOS_DATA_PCU_REG);
+ if (MemoryClock != NULL) {
+ *MemoryClock = MrcRatioToClock ((MrcClockRatio) McBiosData.Bits.MC_FREQ, McBiosReqPcu.Bits.REQ_TYPE, Inputs->BClkFrequency);
+ }
+ if (Ratio != NULL) {
+ *Ratio = (MrcClockRatio) McBiosData.Bits.MC_FREQ;
+ }
+ if (RefClk != NULL) {
+ *RefClk = (MrcRefClkSelect) McBiosReqPcu.Bits.REQ_TYPE;
+ }
+ return MrcRatioToFrequency (
+ MrcData,
+ (MrcClockRatio) McBiosData.Bits.MC_FREQ,
+ McBiosReqPcu.Bits.REQ_TYPE,
+ Inputs->BClkFrequency
+ );
+}
+
+#ifdef ULT_FLAG
+
+/**
+ Translate LPDDR command from CA[9:0] high and low phase to DDR3 MA/BA/CMD.
+ This is needed to program CADB.
+
+ @param[in] CaHigh - CA[9:0] value on the rising clock
+ @param[in] CaLow - CA[9:0] value on the falling clock
+ @param[out] MA - Translated value of MA[15:0]
+ @param[out] BA - Translated value of BA[2:0]
+ @param[out] CMD - Translated value of CMD[2:0] = [RASb, CASb, WEb]
+
+ @retval none
+**/
+void
+MrcConvertLpddr2Ddr (
+ IN U32 const CaHigh,
+ IN U32 const CaLow,
+ OUT U32 *MA,
+ OUT U32 *BA,
+ OUT U32 *CMD
+ )
+{
+ *MA = MRC_BIT15; // MA[15] should be 1
+ *BA = 0;
+ *CMD = MRC_BIT2; // RASb should be 1
+
+ //
+ // Translation table
+ //
+ // Command High phase Low phase
+ //-----------------------------
+ // CA[0] CASb MA[0]
+ // CA[1] WEb MA[1]
+ // CA[2] MA[8] MA[2]
+ // CA[3] MA[9] MA[3]
+ // CA[4] MA[10] MA[4]
+ // CA[5] MA[11] MA[5]
+ // CA[6] MA[12] MA[6]
+ // CA[7] BA[0] MA[7]
+ // CA[8] BA[1] MA[13]
+ // CA[9] BA[2] MA[14]
+
+ *MA |= (CaLow & 0xFF); // MA[7:0]
+ *MA |= ((CaHigh & 0x7C) << 6); // MA[12:8]
+ *MA |= ((CaLow & 0x300) << 5); // MA[14:13]
+
+ *BA |= ((CaHigh & 0x380) >> 7); // BA[2:0]
+
+ *CMD |= ((CaHigh & 0x02) >> 1); // CMD[0] = WEb
+ *CMD |= ((CaHigh & 0x01) << 1); // CMD[1] = CASb
+}
+
+/**
+ Run a short CADB sequence on selected channels
+
+ @param[in] MrcData - The MRC global data.
+ @param[in] ChBitMask - channels to work on.
+
+ @retval none
+**/
+void
+ShortRunCADB (
+ IN MrcParameters *const MrcData,
+ IN U8 ChBitMask
+ )
+{
+ U32 Channel;
+ U32 Offset;
+ MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_STRUCT ReutGlobalCtl;
+ MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_STRUCT ReutChPatCadbCtrl;
+ MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_STRUCT ReutChSeqCfg;
+
+ //
+ // Enable REUT mode and Global Control on selected channels
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ Offset = MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_REG +
+ ((MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_REG - MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_REG) * Channel);
+ ReutChSeqCfg.Data = MrcReadCR64 (MrcData, Offset);
+ if (((1 << Channel) & ChBitMask) != 0) {
+ ReutChSeqCfg.Bits.Initialization_Mode = REUT_Testing_Mode;
+ ReutChSeqCfg.Bits.Global_Control = 1;
+ } else {
+ ReutChSeqCfg.Bits.Global_Control = 0;
+ }
+
+ MrcWriteCR64 (MrcData, Offset, ReutChSeqCfg.Data);
+ }
+ //
+ // Enable CADB Always On mode
+ //
+ ReutChPatCadbCtrl.Data = 0;
+ ReutChPatCadbCtrl.Bits.Enable_CADB_Always_On = 1;
+ MrcWriteCR (MrcData, MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_REG, ReutChPatCadbCtrl.Data);
+
+ //
+ // Start CADB
+ //
+ ReutGlobalCtl.Data = 0;
+ ReutGlobalCtl.Bits.Global_Start_Test = 1;
+ MrcWriteCR (MrcData, MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_REG, ReutGlobalCtl.Data);
+
+ //
+ // It's enough to read from this register, no need for an extra delay
+ //
+ ReutGlobalCtl.Data = MrcReadCR (MrcData, MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_REG);
+ //
+ // Disable CADB Always On mode
+ //
+ ReutChPatCadbCtrl.Bits.Enable_CADB_Always_On = 0;
+ MrcWriteCR (MrcData, MCSCHEDS_CR_REUT_CH_PAT_CADB_CTRL_REG, ReutChPatCadbCtrl.Data);
+
+ //
+ // Stop CADB
+ //
+ ReutGlobalCtl.Bits.Global_Start_Test = 0;
+ ReutGlobalCtl.Bits.Global_Stop_Test = 1;
+ MrcWriteCR (MrcData, MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_REG, ReutGlobalCtl.Data);
+
+ //
+ // Read back
+ //
+ ReutGlobalCtl.Data = MrcReadCR (MrcData, MCDFXS_CR_REUT_GLOBAL_CTL_MCMAIN_REG);
+
+ //
+ // Disable Global Control on selected channels
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (((1 << Channel) & ChBitMask) != 0) {
+ Offset = MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_REG +
+ ((MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_REG - MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_REG) * Channel);
+ ReutChSeqCfg.Data = MrcReadCR64 (MrcData, Offset);
+ ReutChSeqCfg.Bits.Global_Control = 0;
+ MrcWriteCR64 (MrcData, Offset, ReutChSeqCfg.Data);
+ }
+ }
+}
+
+#endif // ULT_FLAG
+
+/**
+ Get the Rx Bias values
+
+ @param[in, out] MrcData - Include all MRC global data.
+ @param[in, out] RxFselect - Location to save RxFselect.
+ @param[in, out] RxCBSelect - Location to save RxCBSelect.
+
+ @retval none
+**/
+void
+GetRxFselect (
+ IN MrcParameters *const MrcData,
+ IN OUT S8 *RxFselect,
+ IN OUT U8 *RxCBSelect
+ )
+{
+ MrcOutput *Outputs;
+ DDRCLK_CR_DDRCBSTATUS_STRUCT DdrCbStatus;
+
+ Outputs = &MrcData->SysOut.Outputs;
+ DdrCbStatus.Data = MrcReadCR (MrcData, DDRCLK_CR_DDRCBSTATUS_REG);
+ *RxCBSelect = (U8) DdrCbStatus.Bits.DllCB;
+ *RxFselect = (Outputs->Ratio - ((Outputs->RefClk == MRC_REF_CLOCK_133) ? RXF_SELECT_RC_133 : RXF_SELECT_RC_100));
+
+ //
+ // Limit ratios for 1067, 1333, 1600, 1867 & 2133 MHz
+ //
+ *RxFselect = MIN (*RxFselect, RXF_SELECT_MAX); // Maximum 2133 MHz
+ *RxFselect = MAX (*RxFselect, RXF_SELECT_MIN); // Minimum 1067 MHz
+ return;
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Services/MrcCrosser.c b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Services/MrcCrosser.c
new file mode 100644
index 0000000..4086802
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Services/MrcCrosser.c
@@ -0,0 +1,9860 @@
+/** @file
+ These functions implement the crosser training algorithm.
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+
+**/
+
+//
+// Include files
+//
+#include "MrcCrosser.h"
+#if SUPPORT_SODIMM == SUPPORT
+#include "MrcSpdProcessing.h"
+#endif //SUPPORT_SODIMM == SUPPORT
+
+///
+/// Module Definitions
+///
+#define BIT_TX_XTALK_SWEEP_START (-3)
+#define BIT_TX_XTALK_SWEEP_STOP (3)
+#define BIT_TX_XTALK_SWEEP_LEN (BIT_TX_XTALK_SWEEP_STOP - BIT_TX_XTALK_SWEEP_START + 1)
+#define BIT_TX_XTALK_RANGE (16)
+
+#define DIMM_ODT_DIMM_MASK_SHIFT (4)
+
+///
+/// Power optimizations Global Parameters
+///
+#define OPT_PARAM_LOOP_COUNT (15)
+#define OPT_PARAM_1D_LC (15)
+
+///
+/// UPM/PWR increment value if margins are at or below the retrain limit.
+///
+#define MRC_UPM_PWR_INC_VAL (40)
+
+//
+// Module Globals
+//
+const MrcUpmPwrRetrainLimits InitialLimits[MRC_NUMBER_UPM_PWR_RETRAIN_MARGINS] = {
+ //
+ // UPM, PWR Retrain
+ //
+ {RdT, {240, 320, 90 }},
+ {WrT, {220, 280, 90 }},
+ {RdV, {400, 520, 160}},
+ // For ULT DDR3L rcF the values are increased by 20 ticks, see UpmPwrLimitValue()
+ {WrV, {400, 520, 160}},
+ {RdFan2, {240, 480, 0 }},
+ {WrFan2, {240, 480, 0 }},
+ {RdFan3, {240*4/5, 480*4/5, 0 }},
+ {WrFan3, {240*4/5, 480*4/5, 0 }},
+ // {650ps,750ps} * 64 pi ticks * 2 (for width) = 134 PI Ticks. ~1.3nsec for UPM,~1.5nsec for PWR
+ // We must subtract out the built in margin of 96 when shifting IO Lat.
+ // Margin function works in steps of 2, so we divide the margin by 2.
+ // Margin numbers are scaled by 10.
+ {RcvEnaX, {(((134 - 96) / 2) * 10), (((154 - 96) / 2) * 10), 0}}
+};
+
+const U8 ActualDimmOdt[6] = { 0, 120, 60, 40, 30, 20 };
+
+#ifdef MRC_DEBUG_PRINT
+const char *TOptParamOffsetString[] = {
+ "OptWrDS",
+ "OptRdOdt",
+ "OptSComp",
+ "OptTComp",
+ "OptTxEq",
+ "OptRxEq",
+ "OptRxBias",
+ "OptDimmOdt",
+ "OptDimmOdtWr",
+ "OptDimmRon",
+ "OptDefault"
+};
+
+const char *MarginTypesString[] = {
+ "RcvEna",
+ "RdT",
+ "WrT",
+ "WrDqsT",
+ "RdV",
+ "WrV",
+ "WrLevel",
+ "WrTBox",
+ "WrTBit",
+ "RdTBit",
+ "RdVBit",
+ "RcvEnaX",
+ "CmdT",
+ "CmdV"
+};
+
+///
+/// These strings match the OptResultPerByteDbgStr enum for indexing
+/// the switch PrintCalcResultTableCh and PrintODTResultTable.
+///
+const char *OptResultDbgStrings[] = {
+ "Best",
+ "GrdBnd",
+ "OffSel",
+ "Scale",
+ "Signal",
+ "Noise",
+ "Ratio",
+ "MaxPost",
+ "MinPost",
+ "Ticks",
+ "SNRTot."
+};
+
+#endif // MRC_DEBUG_PRINT
+
+/**
+ This function implements Sense Amp Offset training.
+ SenseAmp/ODT offset cancellation
+ Find the best "average" point for Vref Control
+ Test Vref point with SampOffset=-7 and Test Vref Point with SampOffset=+7
+ Find Vref on per ch/byte basis where -7 samples all 1 and +7 samples all 0
+
+ @param[in,out] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - if it succeded return mrcSuccess
+**/
+MrcStatus
+MrcSenseAmpOffsetTraining (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ const MrcInput *Inputs;
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ MrcStatus Status;
+ U32 Offset;
+ S8 sumBits[MAX_CHANNEL][MAX_SDRAM_IN_DIMM];
+ S8 FirstBestPoint[MAX_CHANNEL][MAX_SDRAM_IN_DIMM];
+ S8 LastBestPoint[MAX_CHANNEL][MAX_SDRAM_IN_DIMM];
+ //
+ // additional bit for DQS per each byte
+ //
+ S8 firstZero[MAX_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_BITS_FOR_OFFSET_TRAINING];
+ //
+ // additional bit for DQS per each byte
+ //
+ S8 lastOne[MAX_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_BITS_FOR_OFFSET_TRAINING];
+ S8 sampOffset;
+ S8 vref;
+ S8 VrefWidth;
+ U8 HighMask[MAX_CHANNEL][MAX_SDRAM_IN_DIMM];
+ U8 LowMask[MAX_CHANNEL][MAX_SDRAM_IN_DIMM];
+ U8 Channel;
+ U8 Rank;
+ U8 byte;
+ U8 bit;
+ U8 MaxBits;
+ BOOL Lpddr;
+ DDRDATACH0_CR_DDRCRDATACONTROL0_STRUCT DdrCrDataControl0;
+ DDRDATA0CH0_CR_DDRCRDATACONTROL2_STRUCT DdrCrDataControl2;
+ DDRDATA0CH0_CR_DATATRAINFEEDBACK_STRUCT DataTrainFeedback;
+ DDRDATA_CR_RXOFFSETVDQ_STRUCT RxOffsetVdq;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerOut = &Outputs->Controller[0];
+ Status = mrcSuccess;
+ Lpddr = (Outputs->DdrType == MRC_DDR_TYPE_LPDDR3);
+
+ //
+ // Init LastBestPoint to 0, FirstBestPoint to -8, LowMask to 0xff and HighMask to 0
+ //
+ MrcOemMemorySet ((U8 *) LastBestPoint, 0, sizeof (LastBestPoint));
+ MrcOemMemorySet ((U8 *) FirstBestPoint, (U32) (-8), sizeof (FirstBestPoint));
+ MrcOemMemorySet ((U8 *) LowMask, (U32) (-1), sizeof (LowMask));
+ MrcOemMemorySet ((U8 *) HighMask, 0, sizeof (LowMask));
+
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "Stage 1: Vref Offset Training\nPlot Of SumOfBits across Vref settings\nChannel\t0 1\nByte\t"
+ );
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ (Outputs->SdramCount == MAX_SDRAM_IN_DIMM) ? "0 1 2 3 4 5 6 7 8 0 1 2 3 4 5 6 7 8" : "0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7"
+ );
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ //
+ // Force RXAmp and Bias on -MUST use Per byte as preious DqControl2 values depended on byte number
+ //
+ for (byte = 0; byte < Outputs->SdramCount; byte++) {
+ DdrCrDataControl2.Data = ChannelOut->DqControl2[byte].Data;
+ DdrCrDataControl2.Bits.ForceBiasOn = 1;
+ DdrCrDataControl2.Bits.ForceRxOn = 1;
+ Offset = DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG +
+ ((DDRDATA0CH1_CR_DDRCRDATACONTROL2_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG) * Channel) +
+ ((DDRDATA1CH0_CR_DDRCRDATACONTROL2_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG) * byte);
+ MrcWriteCR (MrcData, Offset, DdrCrDataControl2.Data);
+ }
+ }
+ }
+ //
+ // Sweep through vref settings and find point SampOffset of +/- 7 passes
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n1/2 Vref");
+ for (vref = -8; vref <= 8; vref++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n% 5d\t", vref);
+
+ //
+ // Run Test and Record Results.
+ //
+ Status = ChangeMargin (MrcData, RdV, vref, 0, 1, 0, 0, 0, 0, 0, 0, MrcRegFileRank);
+
+ //
+ // Program settings for Vref and SampOffset = 7
+ //
+ MrcWriteCrMulticast (MrcData, DDRDATA_CR_RXOFFSETVDQ_REG, 0xFFFFFFFF); // (8+7)
+ //
+ // To run test, enable Offset Cancel mode and Enable ODT
+ // Check Results and Update variables. Ideal result is all 0
+ // Clear Offset Cancel mode at end test to enable writing RX_OffsetV
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+
+ //
+ // Propagate delay values (without a read command)
+ //
+ DdrCrDataControl0.Data = ChannelOut->DqControl0.Data;
+ DdrCrDataControl0.Bits.ReadRFRd = 1;
+ DdrCrDataControl0.Bits.ReadRFWr = 0;
+ DdrCrDataControl0.Bits.ReadRFRank = 0;
+ DdrCrDataControl0.Bits.ForceOdtOn = 1;
+ DdrCrDataControl0.Bits.SenseampTrainingMode = 1;
+ Offset = DDRDATACH0_CR_DDRCRDATACONTROL0_REG +
+ ((DDRDATACH1_CR_DDRCRDATACONTROL0_REG - DDRDATACH0_CR_DDRCRDATACONTROL0_REG) * Channel);
+ MrcWriteCrMulticast (MrcData, Offset, DdrCrDataControl0.Data);
+
+ MrcWait (MrcData, HPET_1US);
+
+ for (byte = 0; byte < Outputs->SdramCount; byte++) {
+ Offset = DDRDATA0CH0_CR_DATATRAINFEEDBACK_REG +
+ ((DDRDATA0CH1_CR_DATATRAINFEEDBACK_REG - DDRDATA0CH0_CR_DATATRAINFEEDBACK_REG) * Channel) +
+ ((DDRDATA1CH0_CR_DATATRAINFEEDBACK_REG - DDRDATA0CH0_CR_DATATRAINFEEDBACK_REG) * byte);
+ DataTrainFeedback.Data = (U8) MrcReadCR (MrcData, Offset);
+ sumBits[Channel][byte] = -(MrcCountBitsEqOne (DataTrainFeedback.Bits.DataTrainFeedback));
+ LowMask[Channel][byte] &= (U8) DataTrainFeedback.Bits.DataTrainFeedback;
+ }
+
+ DdrCrDataControl0.Bits.SenseampTrainingMode = 0;
+ Offset = DDRDATACH0_CR_DDRCRDATACONTROL0_REG +
+ ((DDRDATACH1_CR_DDRCRDATACONTROL0_REG - DDRDATACH0_CR_DDRCRDATACONTROL0_REG) * Channel);
+ MrcWriteCrMulticast (MrcData, Offset, DdrCrDataControl0.Data);
+ }
+ }
+ //
+ // Program settings for SampOffset = -7
+ //
+ MrcWriteCrMulticast (MrcData, DDRDATA_CR_RXOFFSETVDQ_REG, 0x11111111); // (8-7)
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!(MrcChannelExist (Outputs, Channel))) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ (Channel != 0) ? "" : ((Outputs->SdramCount == MAX_SDRAM_IN_DIMM) ? " " : " ")
+ );
+ } else {
+ ChannelOut = &ControllerOut->Channel[Channel];
+
+ //
+ // Propagate delay values (without a read command)
+ //
+ DdrCrDataControl0.Data = ChannelOut->DqControl0.Data;
+ DdrCrDataControl0.Bits.ReadRFRd = 1;
+ DdrCrDataControl0.Bits.ReadRFWr = 0;
+ DdrCrDataControl0.Bits.ReadRFRank = 0;
+ DdrCrDataControl0.Bits.ForceOdtOn = 1;
+ DdrCrDataControl0.Bits.SenseampTrainingMode = 1;
+ Offset = DDRDATACH0_CR_DDRCRDATACONTROL0_REG +
+ ((DDRDATACH1_CR_DDRCRDATACONTROL0_REG - DDRDATACH0_CR_DDRCRDATACONTROL0_REG) * Channel);
+ MrcWriteCrMulticast (MrcData, Offset, DdrCrDataControl0.Data);
+
+ MrcWait (MrcData, HPET_1US);
+ for (byte = 0; byte < Outputs->SdramCount; byte++) {
+ Offset = DDRDATA0CH0_CR_DATATRAINFEEDBACK_REG +
+ ((DDRDATA0CH1_CR_DATATRAINFEEDBACK_REG - DDRDATA0CH0_CR_DATATRAINFEEDBACK_REG) * Channel) +
+ ((DDRDATA1CH0_CR_DATATRAINFEEDBACK_REG - DDRDATA0CH0_CR_DATATRAINFEEDBACK_REG) * byte);
+ DataTrainFeedback.Data = (U8) MrcReadCR (MrcData, Offset);
+ sumBits[Channel][byte] += MrcCountBitsEqOne (DataTrainFeedback.Bits.DataTrainFeedback);
+ HighMask[Channel][byte] |= DataTrainFeedback.Bits.DataTrainFeedback;
+
+ //
+ // Check if this point is better
+ //
+ if (sumBits[Channel][byte] > FirstBestPoint[Channel][byte]) {
+ FirstBestPoint[Channel][byte] = sumBits[Channel][byte];
+ LastBestPoint[Channel][byte] = vref;
+ ChannelOut->RxVref[byte] = vref;
+ } else if (sumBits[Channel][byte] == FirstBestPoint[Channel][byte]) {
+ LastBestPoint[Channel][byte] = vref;
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d ", sumBits[Channel][byte]);
+ }
+
+ DdrCrDataControl0.Bits.SenseampTrainingMode = 0;
+ Offset = DDRDATACH0_CR_DDRCRDATACONTROL0_REG +
+ ((DDRDATACH1_CR_DDRCRDATACONTROL0_REG - DDRDATACH0_CR_DDRCRDATACONTROL0_REG) * Channel);
+ MrcWriteCrMulticast (MrcData, Offset, DdrCrDataControl0.Data);
+ }
+ }
+ }
+
+#ifdef MRC_DEBUG_PRINT
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "\nHi-Lo\t");
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ for (byte = 0; byte < Outputs->SdramCount; byte++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "0x%x 0x%x ", HighMask[Channel][byte], LowMask[Channel][byte]);
+ //
+ // Exit with error if any bit did not change
+ //
+ if ((HighMask[Channel][byte] ^ LowMask[Channel][byte]) != 0xFF) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_ERROR,
+ "\nERROR! At least one bit with unexpected results for Channel %u Byte %u\n",
+ Channel,
+ byte
+ );
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_ERROR,
+ "A '0' in the following BitMask value represents the failing Bit(s) 0x%x\n",
+ (HighMask[Channel][byte] ^ LowMask[Channel][byte])
+ );
+ return mrcSenseAmpErr;
+ }
+ }
+ }
+ }
+
+ //
+ // Display the selected Read Vref per byte
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nRdVref\t");
+#endif // MRC_DEBUG_PRINT
+ //
+ // Clear RdV offset
+ //
+ Status = ChangeMargin (MrcData, RdV, 0, 0, 1, 0, 0, 0, 0, 0, 0, MrcRegFileRank);
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ //
+ // Upate RxVref delay center
+ //
+ for (byte = 0; byte < Outputs->SdramCount; byte++) {
+ VrefWidth = (S8) (LastBestPoint[Channel][byte] - ChannelOut->RxVref[byte]);
+ vref = (S8) (ChannelOut->RxVref[byte] + (VrefWidth / 2));
+
+ //
+ // Add 1 to Round Up and find the center
+ //
+ if (vref < 0) {
+ vref--;
+ } else {
+ vref++;
+ }
+ //
+ // step size for RxVref is about 7.8mv AND for RxVrefOffset is about 3.9mv
+ //
+ ChannelOut->RxVref[byte] = vref / 2;
+
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if (MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ UpdateRxT (MrcData, Channel, Rank, byte, 0xFF, 0);
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d ", (S8) ChannelOut->RxVref[byte]);
+ }
+ }
+ }
+ //
+ // init firstZero and lastOne to 0
+ //
+ MrcOemMemorySet ((U8 *) firstZero, 0, sizeof (firstZero));
+ MrcOemMemorySet ((U8 *) lastOne, 0, sizeof (lastOne));
+
+ MaxBits = MAX_BITS_FOR_OFFSET_TRAINING - 1;
+#ifdef ULT_FLAG
+ if (Lpddr) {
+ MaxBits++; // for ULT offset training done for 8 bits + DQS bit
+ }
+#endif //ULT_FLAG
+
+#ifdef MRC_DEBUG_PRINT
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n\nStage 2: SampOffset Training\n");
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel 0\t\t\t\t\t\t\t\t\t %s1\nByte ", Lpddr ? "\t" : "");
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ for (byte = 0; byte < Outputs->SdramCount; byte++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d %s", byte, Lpddr ? " " : "");
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nBits ");
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ for (byte = 0; byte < Outputs->SdramCount; byte++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "01234567%s ", Lpddr ? "S" : "");
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n SAmp");
+#endif // MRC_DEBUG_PRINT
+
+ for (sampOffset = 1; sampOffset <= 15; sampOffset++) {
+ //
+ // Display per Byte Feedback from REUT Registers
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n% 5d\t", sampOffset);
+
+ //
+ // Program Offset and Propagate new value from RF
+ //
+ RxOffsetVdq.Data = 0;
+ for (bit = 0; bit < MAX_BITS; bit++) {
+ RxOffsetVdq.Data += (sampOffset & DDRDATA_CR_RXOFFSETVDQ_Lane0_MSK) << (DDRDATA_CR_RXOFFSETVDQ_Lane0_WID * bit);
+ }
+
+ MrcWriteCrMulticast (MrcData, DDRDATA_CR_RXOFFSETVDQ_REG, RxOffsetVdq.Data);
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!MrcChannelExist (Outputs, Channel)) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\t\t\t\t\t\t\t\t\t%s", Lpddr ? "\t" : "");
+ continue;
+ }
+
+ ChannelOut = &ControllerOut->Channel[Channel];
+#ifdef ULT_FLAG
+ if (Lpddr) {
+ //
+ // write DQS offset to control2 reg sampOffset
+ //
+ for (byte = 0; byte < Outputs->SdramCount; byte++) {
+ DdrCrDataControl2.Data = ChannelOut->DqControl2[byte].Data;
+
+ DdrCrDataControl2.Bits.RxDqsAmpOffset = sampOffset;
+ DdrCrDataControl2.Bits.ForceBiasOn = 1;
+ DdrCrDataControl2.Bits.ForceRxOn = 1;
+ DdrCrDataControl2.Bits.LeakerComp = 0;
+
+ Offset = DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG +
+ ((DDRDATA0CH1_CR_DDRCRDATACONTROL2_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG) * Channel) +
+ ((DDRDATA1CH0_CR_DDRCRDATACONTROL2_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG) * byte);
+ MrcWriteCR (MrcData, Offset, DdrCrDataControl2.Data);
+ }
+ }
+#endif //ULT_FLAG
+ //
+ // Propagate delay values (without a read command)
+ //
+ DdrCrDataControl0.Data = ChannelOut->DqControl0.Data;
+ DdrCrDataControl0.Bits.ReadRFRd = 1;
+ DdrCrDataControl0.Bits.ReadRFWr = 0;
+ DdrCrDataControl0.Bits.ReadRFRank = 0;
+ DdrCrDataControl0.Bits.ForceOdtOn = 1;
+ DdrCrDataControl0.Bits.SenseampTrainingMode = 1;
+ Offset = DDRDATACH0_CR_DDRCRDATACONTROL0_REG +
+ ((DDRDATACH1_CR_DDRCRDATACONTROL0_REG - DDRDATACH0_CR_DDRCRDATACONTROL0_REG) * Channel);
+ MrcWriteCrMulticast (MrcData, Offset, DdrCrDataControl0.Data);
+
+ MrcWait (MrcData, HPET_1US);
+
+ for (byte = 0; byte < Outputs->SdramCount; byte++) {
+ Offset = DDRDATA0CH0_CR_DATATRAINFEEDBACK_REG +
+ ((DDRDATA0CH1_CR_DATATRAINFEEDBACK_REG - DDRDATA0CH0_CR_DATATRAINFEEDBACK_REG) * Channel) +
+ ((DDRDATA1CH0_CR_DATATRAINFEEDBACK_REG - DDRDATA0CH0_CR_DATATRAINFEEDBACK_REG) * byte);
+ DataTrainFeedback.Data = MrcReadCR (MrcData, Offset);
+ //MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "DataTrainFeedback = 0x%x, sampOffset = %d\n", DataTrainFeedback.Data, sampOffset);
+
+ for (bit = 0; bit < MaxBits; bit++) {
+ if (DataTrainFeedback.Bits.DataTrainFeedback & (MRC_BIT0 << bit)) {
+ lastOne[Channel][byte][bit] = sampOffset;
+ } else {
+ if (firstZero[Channel][byte][bit] == 0) {
+ firstZero[Channel][byte][bit] = sampOffset;
+ }
+ }
+ //
+ // Display in bits
+ //
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ ((MRC_BIT0 << bit) & DataTrainFeedback.Bits.DataTrainFeedback) ? "1" : "0"
+ );
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " ");
+ }
+
+ DdrCrDataControl0.Bits.SenseampTrainingMode = 0;
+ Offset = DDRDATACH0_CR_DDRCRDATACONTROL0_REG +
+ ((DDRDATACH1_CR_DDRCRDATACONTROL0_REG - DDRDATACH0_CR_DDRCRDATACONTROL0_REG) * Channel);
+ MrcWriteCrMulticast (MrcData, Offset, DdrCrDataControl0.Data);
+ } // for Channel
+ } // for sampOffset
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nBitSAmp ");
+
+ //
+ // Calculate and Program Offsets and display per bit SenseAmp Offset
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (byte = 0; byte < Outputs->SdramCount; byte++) {
+ RxOffsetVdq.Data = 0;
+ for (bit = 0; bit < MaxBits; bit++) {
+ //
+ // Find vref center, add 1 for Round Up
+ //
+ vref = (firstZero[Channel][byte][bit] + lastOne[Channel][byte][bit]) / 2;
+
+ //
+ // Check for saturation conditions
+ // to make sure we are as close as possible to vdd/2 (750mv)
+ //
+ if (firstZero[Channel][byte][bit] == 0) {
+ vref = 15;
+ }
+
+ if (lastOne[Channel][byte][bit] == 0) {
+ vref = 0;
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%X", vref);
+#ifdef ULT_FLAG
+ if (Lpddr) {
+ if (bit == 8) {
+ //
+ // Write the DQS sense amp offset value to the host struct.
+ // It will be written to the HW at the end of this routine.
+ //
+ // Add 8 to the center value, to better suppress DQS reflections before the read preamble.
+ //
+ ChannelOut->DqControl2[byte].Bits.RxDqsAmpOffset = MIN (vref + 8, DDRDATA_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_MAX);
+ break;
+ }
+ }
+#endif // ULT_FLAG
+
+ RxOffsetVdq.Data += (vref & DDRDATA0CH0_CR_RXOFFSETVDQ_Lane0_MSK) << (DDRDATA0CH0_CR_RXOFFSETVDQ_Lane0_WID * bit);
+ ChannelOut->RxDqVrefPb[0][byte][bit].Center = vref;
+ }
+
+ Offset = DDRDATA0CH0_CR_RXOFFSETVDQ_REG +
+ ((DDRDATA0CH1_CR_RXOFFSETVDQ_REG - DDRDATA0CH0_CR_RXOFFSETVDQ_REG) * Channel) +
+ ((DDRDATA1CH0_CR_RXOFFSETVDQ_REG - DDRDATA0CH0_CR_RXOFFSETVDQ_REG) * byte);
+ MrcWriteCR (MrcData, Offset, RxOffsetVdq.Data);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " ");
+
+ //
+ // Propagate delay values (without a read command)
+ //
+ MrcDownloadRegFile (MrcData, Channel, 1, 0, MrcRegFileRank, 0, 1, 0);
+ }
+ }
+#ifdef MRC_DEBUG_PRINT
+ else {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\t\t\t\t\t\t\t\t\t%s", Lpddr ? "\t" : ""); // Line up Channel 1
+ }
+#endif
+ }
+ //
+ // Clean up after test
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+
+ //
+ // Restore DataControl2
+ //
+ for (byte = 0; byte < Outputs->SdramCount; byte++) {
+ Offset = DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG +
+ ((DDRDATA0CH1_CR_DDRCRDATACONTROL2_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG) * Channel) +
+ ((DDRDATA1CH0_CR_DDRCRDATACONTROL2_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG) * byte);
+ MrcWriteCR (MrcData, Offset, ChannelOut->DqControl2[byte].Data);
+ }
+ //
+ // Restore DataControl0
+ //
+ Offset = DDRDATACH0_CR_DDRCRDATACONTROL0_REG +
+ ((DDRDATACH1_CR_DDRCRDATACONTROL0_REG - DDRDATACH0_CR_DDRCRDATACONTROL0_REG) * Channel);
+ MrcWriteCrMulticast (MrcData, Offset, ChannelOut->DqControl0.Data);
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+
+ Status = IoReset (MrcData);
+
+ return Status;
+}
+
+/**
+ This function looks at the margin values stored in the global data structure and checks
+ WrT, WrV, RdT, and RdV to see if they are above the minimum margin required.
+
+ @param[in, out] MrcData - MRC global data.
+
+ @retval mrcSuccess if margins are acceptable.
+ @retval Otherwise, mrcRetrain.
+**/
+MrcStatus
+MrcRetrainMarginCheck (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ MrcDebug const *Debug;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcUpmPwrRetrainLimits *UpmPwrRetrainLimits;
+ MRC_MarginTypes MarginParam;
+ MrcMarginResult LastResultParam;
+ MrcStatus Status;
+ MRC_MARGIN_LIMIT_TYPE MarginLimitType;
+ U32 (*LastMargins)[MAX_RANK_IN_CHANNEL][MAX_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_EDGES];
+ U32 BERStats[4];
+ U16 MinEdgeMargin[MAX_EDGES];
+ U16 RetrainMarginLimit;
+ U16 CurrentMargin;
+ U8 Channel;
+ U8 ChannelMask;
+ U8 Rank;
+ U8 RankMask;
+ U8 Edge;
+ U8 Loopcount;
+ U8 MaxMargin;
+ BOOL RdWrMarginFail[2];
+
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerOut = &Outputs->Controller[0];
+ LastMargins = Outputs->MarginResult;
+ UpmPwrRetrainLimits = Outputs->UpmPwrRetrainLimits.Pointer;
+ Status = mrcSuccess;
+ Loopcount = 17;
+ MrcOemMemorySet ((U8 *) BERStats, 0, sizeof (BERStats));
+ RdWrMarginFail[0] = FALSE;
+ RdWrMarginFail[1] = FALSE;
+
+
+ //
+ // Loop is dependent on the order of MRC_MarginTypes. If this changes, pleas ensure functionality
+ // stays the same.
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Loopcount: %d\n", Loopcount);
+ SetupIOTestBasicVA (MrcData, Outputs->ValidChBitMask, Loopcount, NSOE, 0, 0, 8);
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ RankMask = 1 << Rank;
+ ChannelMask = 0;
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelMask |= SelectReutRanks (MrcData, Channel, RankMask, 0);
+ if ((1 << Channel) & ChannelMask) {
+ MrcOemMemorySetDword (&ControllerOut->Channel[Channel].DataOffsetTrain[0], 0, Outputs->SdramCount);
+ }
+ }
+
+ if (ChannelMask == 0) {
+ continue;
+ }
+
+ for (MarginParam = RdT; MarginParam <= WrV; MarginParam++) {
+ if (MarginParam == WrDqsT) {
+ continue;
+ }
+
+ if (MarginParam == RdT) {
+ Outputs->DQPat = RdRdTA;
+ } else if (MarginParam == RdV) {
+ Outputs->DQPat = BasicVA;
+ }
+
+ MaxMargin = ((MarginParam == RdV) || (MarginParam == WrV)) ? MAX_POSSIBLE_VREF : MAX_POSSIBLE_TIME;
+
+ Status = MrcGetBERMarginCh (
+ MrcData,
+ LastMargins,
+ ChannelMask,
+ 0xFF,
+ Rank,
+ MarginParam,
+ 0,
+ 1,
+ MaxMargin,
+ 0,
+ BERStats
+ );
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Margins\nParams: RdT\tWrT\tRdV\tWrV\n\tLft Rgt Lft Rgt Low Hi Low Hi");
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ continue;
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nC%dR%d\t", Channel, Rank);
+ for (MarginParam = RdT; MarginParam <= WrV; MarginParam++) {
+ if (MarginParam == WrDqsT) {
+ continue;
+ }
+
+ LastResultParam = GetMarginResultType (MarginParam);
+ RetrainMarginLimit = UpmPwrLimitValue (MrcData, MarginParam, RetrainLimit) / 10;
+ MrcOemMemorySetWord (MinEdgeMargin, (U16) (~0), MAX_EDGES);
+
+
+ for (Edge = 0; Edge < MAX_EDGES; Edge++) {
+ CurrentMargin = (U16) LastMargins[LastResultParam][Rank][Channel][0][Edge] / 10;
+ MinEdgeMargin[Edge] = MIN (MinEdgeMargin[Edge], CurrentMargin);
+ if ((CurrentMargin <= RetrainMarginLimit)) {
+ Status = mrcRetrain;
+ if ((MarginParam == RdT) || (MarginParam == RdV)) {
+ RdWrMarginFail[0] = TRUE;
+ } else if ((MarginParam == WrT) || (MarginParam == WrV)) {
+ RdWrMarginFail[1] = TRUE;
+ }
+ }
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%2d %2d\t", MinEdgeMargin[0], MinEdgeMargin[1]);
+ if ((RdWrMarginFail[0] == TRUE) && (RdWrMarginFail[1] == TRUE)) {
+ Rank = MAX_RANK_IN_CHANNEL;
+ Channel = MAX_CHANNEL;
+ break;
+ }
+ }
+ }
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n"); // End of table
+
+ if (Status == mrcRetrain) {
+ //
+ // Loop is dependent on the order of MRC_MarginTypes. If this changes, please ensure functionality
+ // stays the same.
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "*** Margin Limit Check Failed! ***\nNew Limits:\nParam\tUPM\tPWR");
+ for (MarginParam = RdT; MarginParam <= WrV; MarginParam++) {
+ if (((RdWrMarginFail[0] == FALSE) && ((MarginParam == RdT) || (MarginParam == RdV))) ||
+ ((RdWrMarginFail[1] == FALSE) && ((MarginParam == WrT) || (MarginParam == WrV))) ||
+ (MarginParam == WrDqsT)) {
+ continue;
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n%s", MarginTypesString[MarginParam]);
+ for (MarginLimitType = UpmLimit; MarginLimitType < RetrainLimit; MarginLimitType++) {
+ RetrainMarginLimit = MrcUpdateUpmPwrLimits (MrcData, MarginParam, MarginLimitType, MRC_UPM_PWR_INC_VAL);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\t%d", RetrainMarginLimit);
+ }
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n"); // End of table.
+ }
+
+ return Status;
+}
+
+
+/**
+ This function implements DIMM ODT training.
+ Adjust DIMM RTT_NOM/RTT_WR value to maximize read/write voltage/timing
+
+ RdOdtPriority Needs to be an input parameter
+ option to prioritize the ReadODT setting and attempt to optimize that value first,
+ reducing CPU TDP power (as opposed to system power for the DRAM).
+ For this case, the base value for ReadODT is changed at the compensation block
+ by looking at the following values:
+ RdOdt Global: (50, 64, 84, 110)
+
+ In the case of 2 dpc, the flow will first optimizing RttNom, while keeping RttWr fixed
+ at 60 Ohms (60 Ohms usually gives the best results). It will then try to reduce RttWr
+ to 120 Ohms if possible.
+
+ In the case of 1 dpc, only RttNom is used and only a single pass is required.
+ However, it is important to note that the two channels are completely independent
+ and can have different numbers of dimms populated.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - if it succeed return mrcSuccess
+**/
+MrcStatus
+MrcDimmODTTraining (
+ IN MrcParameters *const MrcData
+ )
+{
+ const MrcDebug *Debug;
+ const MrcInput *Inputs;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ MrcStatus Status;
+ U8 Channel;
+ U8 byte;
+ U32 NumBytes;
+ U8 NumCh;
+ U8 RankMask;
+ U8 LocalRanks[MAX_CHANNEL];
+ U8 ChMask;
+ U8 RttNomPoints;
+ U8 RdOdtPoints;
+ S8 GRdOdt;
+ U8 RttWr0;
+ U8 Dimm;
+ U8 RttWr[MAX_CHANNEL][MAX_DIMMS_IN_CHANNEL];
+ U8 RttNom[MAX_CHANNEL][MAX_DIMMS_IN_CHANNEL];
+ S8 RttNom0;
+ S8 RttNom1;
+ U8 BestRttNom[MAX_CHANNEL][MAX_DIMMS_IN_CHANNEL];
+ U8 BestRttWr[MAX_CHANNEL][MAX_DIMMS_IN_CHANNEL];
+ S8 BestRdOdt[MAX_CHANNEL];
+ U8 offset;
+ U8 test;
+ U8 *TestList;
+ U8 TestListSize;
+ S32 RdOdtCodes[2]; // Store Comp Codes associated with each RdOdt
+ S8 RttNom1Off;
+ BOOL any2DPC;
+ BOOL any1DPC;
+ BOOL Lpddr;
+ S8 BestGRdOdt;
+ U8 RttOffset;
+ U8 OffsetPoints;
+ U8 loopcount; // for centering
+ S8 GRdOdtStep;
+ BOOL IncEnds;
+ BOOL SubPwrLimits;
+ BOOL skipSubOpt;
+ BOOL skipOptPrint;
+ BOOL ReCenterPoints;
+ U8 TestListTradRd[] = { OptRxBias };
+ U8 TestListWr[] = { OptWrDS, OptTxEq };
+ U8 TestListRdWr[] = { OptRxBias, OptWrDS, OptTxEq };
+ U8 ScaleTest[] = { 1, 1, 1, 1, 1 }; // must specify scale=0 to unpopulated slots !!
+ U8 ScaleTest1DPC[] = { 1, 1, 1, 0, 0 }; // must specify scale=0 to unpopulated slots !!
+ U8 *Scale;
+ U16 PwrLimits[] = { 3000, 3000, 0, 0, 0 };
+ S16 Best;
+ DimmOptPoint DimmOptPoints[MaxOptOff];
+ U16 Points2calc[5][MaxOptOff];
+ U8 PWRTrendSlope2D;
+ U8 NumTests;
+ U8 ArrayLength;
+ U8 localChMask;
+ U8 OdtTrainingDimmMask;
+ S32 OdtOff;
+ BOOL ForceCenter;
+ S8 GRdOdtOff;
+ U32 BestGRdOdtCode;
+ S8 Average;
+ OptResultsPerByte BestOff;
+#ifdef ULT_FLAG
+ U8 TestListUltRd[] = { OptRxBias, OptRxEq };
+ BOOL UltCpu;
+#endif
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerOut = &Outputs->Controller[0];
+ Status = mrcSuccess;
+ loopcount = 15;
+ GRdOdtStep = 16;
+ IncEnds = 1;
+ SubPwrLimits = 0;
+ skipSubOpt = 0;
+ skipOptPrint = 1;
+ ReCenterPoints = 0;
+ NumTests = 5;
+ OdtTrainingDimmMask = 0;
+ PWRTrendSlope2D = 65;
+ NumBytes = Outputs->SdramCount;
+ ArrayLength = sizeof (Points2calc) / sizeof (U16) / NumTests;
+#ifdef ULT_FLAG
+ UltCpu = (Inputs->CpuModel == cmHSW_ULT);
+#endif
+
+ //
+ // Check if LPDDR3 memory is used
+ //
+ Lpddr = (Outputs->DdrType == MRC_DDR_TYPE_LPDDR3);
+
+ MrcOemMemorySet ((U8 *) &BestOff, 0, sizeof (BestOff));
+ MrcOemMemorySet ((U8 *) DimmOptPoints, 0, sizeof (DimmOptPoints));
+ MrcOemMemorySet ((U8 *) Points2calc, 0, sizeof (Points2calc));
+ MrcOemMemorySet ((U8 *) LocalRanks, 0, sizeof (LocalRanks));
+ MrcOemMemorySet ((U8 *) RdOdtCodes, 0, sizeof (RdOdtCodes));
+
+ TestList = TestListRdWr;
+ TestListSize = sizeof (TestListRdWr);
+ Scale = ScaleTest;
+
+ //
+ // GOdt : [150,110, 84, 64, 50]
+ // 1 dpc: Search [Off, 120, 60]
+ // 2 dpc: Search [120, 60, 40]
+ // Dimm0/1 = [40/40, 40/30, 30/40, 30/30, 30/20, 20/30, 20/20]
+ //
+ ChMask = 0x3;
+ RankMask = 0xf;
+
+ //
+ // Possible RttNom values to pick
+ //
+#ifdef ULT_FLAG
+ if (UltCpu) {
+ RttOffset = 0; //In ULT no Rtt nom by definition
+ } else
+#endif
+ {
+ RttOffset = 1;
+ }
+ RttNomPoints = 2; //[120, 60]
+ RdOdtPoints = 2; //[150,110]
+ ChMask &= Outputs->ValidChBitMask;
+ RankMask &= Outputs->ValidRankMask;
+
+ any2DPC = FALSE;
+ any1DPC = FALSE;
+ //
+ // set channel and rank population
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!((MRC_BIT0 << Channel) & ChMask)) {
+ continue;
+ }
+
+ ChannelOut = &ControllerOut->Channel[Channel];
+ //
+ // Setup Dimm Masks for CalcPowerTrend so we don't access a Dimm that isn't present.
+ //
+ if (ChannelOut->DimmCount == 2) {
+ any2DPC |= 1;
+ OdtTrainingDimmMask |= 0x3 << (DIMM_ODT_DIMM_MASK_SHIFT * Channel);
+ } else {
+ any1DPC |= 1;
+ OdtTrainingDimmMask |= 0x1 << (DIMM_ODT_DIMM_MASK_SHIFT * Channel);
+ }
+
+ LocalRanks[Channel] = RankMask & ChannelOut->ValidRankBitMask;
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ //
+ // start with 60 Ohm by default
+ //
+#ifdef ULT_FLAG
+ if (MrcData->SysOut.Outputs.DdrType == MRC_DDR_TYPE_LPDDR3) {
+ RttWr[Channel][Dimm] = 0;
+ } else
+#endif
+ {
+ RttWr[Channel][Dimm] = 2;
+ }
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "apply 2DPC optimization to ChMask %d\n", ChMask);
+
+ //
+ // *** Read flow ***
+ // if both ch 1DPC RttNomPoints=1 and RttNom1Off=0 i.e. only GRdOdt loop
+ //
+ if (any2DPC == 0) {
+ //
+ // if no 2DPC ch
+ //
+ RttNomPoints = 1;
+#ifdef ULT_FLAG
+ if (UltCpu && Inputs->TrainingEnables.RDEQT) {
+ TestList = TestListUltRd;
+ TestListSize = sizeof (TestListUltRd);
+ } else
+#endif
+ {
+ TestList = TestListTradRd;
+ TestListSize = sizeof (TestListTradRd);
+ }
+ Scale = ScaleTest1DPC;
+ }
+
+ OffsetPoints = 0;
+ //
+ // Walk Through RttNOM Settings - going from negative to positive
+ //
+ for (GRdOdt = 0; GRdOdt < RdOdtPoints; GRdOdt++) {
+ GRdOdtOff = -16 + GRdOdt * GRdOdtStep;
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "CalcRdOdt = %d, GRdOdt = %d GRdOdtOff=%d\n",CalcRdOdt(GRdOdt),GRdOdt,GRdOdtOff);
+ //
+ for (RttNom0 = RttOffset; RttNom0 < (RttNomPoints + RttOffset); RttNom0++) {
+ //
+ // Dimm0 RttNom Value
+ //
+ for (RttNom1Off = -1; RttNom1Off < 2; RttNom1Off++) {
+ //
+ // Dimm1 RttNom Value
+ // Calculate RttNom1 and check if out of range
+ //
+ RttNom1 = RttNom0 + RttNom1Off;
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "RttNom0 = %d, RttNom1 = %d, RttNom1Off = %d\n",RttNom0,RttNom1,RttNom1Off);
+ //
+ if ((RttNom1 == (RttNomPoints + RttOffset)) || (RttNom1 < RttOffset)) {
+ continue;
+ }
+ //
+ // if RttNom == 120ohm run recenter timing
+ //
+ if (((RttNom0 == 1) || (RttNom1 == 1)) && (any2DPC)) {
+ ForceCenter = 1;
+ } else {
+ ForceCenter = 0;
+ }
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ //
+ // set default opt params offset
+ //
+ if (!((MRC_BIT0 << Channel) & ChMask)) {
+ continue; // check if the ch exist
+ }
+
+ RttNom[Channel][0] = RttNom0;
+ RttNom[Channel][1] = RttNom1;
+ for (byte = 0; byte < NumBytes; byte++) {
+ UpdateOptParamOffset (MrcData, Channel, 0, byte, OptWrDS, 0, 1);
+ UpdateOptParamOffset (
+ MrcData,
+ Channel,
+ LocalRanks[Channel],
+ byte,
+ OptTxEq,
+ (S16) (3 * (TXEQFULLDRV >> 4) + 3),
+ 1
+ );
+ }
+ }
+ //
+ // Apply new settings and optimize various parameters
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "TrainDimmOdtSetting: GRdOdt = %d, RdOdtOff = %d, RttNom0= %d, RttNom1= %d \n",GRdOdt,RdOdtOffsets[GRdOdt], RttNom0, RttNom1);
+ //
+ if (OffsetPoints < MaxOptOff) {
+ TrainDimmOdtSetting (
+ MrcData,
+ &DimmOptPoints[OffsetPoints],
+ ChMask,
+ RankMask,
+ 0,
+ RttNom,
+ RttWr,
+ GRdOdtOff,
+ TestList,
+ TestListSize,
+ SubPwrLimits,
+ skipSubOpt,
+ skipOptPrint,
+ ReCenterPoints | ForceCenter,
+ ReCenterPoints,
+ Points2calc,
+ ArrayLength,
+ OffsetPoints
+ );
+ OffsetPoints++;
+ } else {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "Error: DimmOptPoints array out of bounds! %d > %d\n",
+ OffsetPoints,
+ MaxOptOff - 1
+ );
+ }
+ }
+ }
+ }
+ //
+ // for each channel apply Power Trend and find best point
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ BestRdOdt[Channel] = 0;
+ if (!((MRC_BIT0 << Channel) & ChMask)) {
+ continue; // check if the ch exist in this ch
+ }
+
+ for (offset = 0; offset < OffsetPoints; offset++) {
+ //
+ // copy point for the FindOptTradeOff routing
+ //
+ for (test = 0; test < (DimmOptPoints->NumTests); test++) {
+ Points2calc[test][offset] = DimmOptPoints[offset].Points2Trade[test][Channel];
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "read channel=%d Points2calc[test=%d][offset=%d]=%d\n",Channel,test,offset,Points2calc[test][offset]);
+ //
+ }
+ }
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "FindOptimalTradeOff read\n");
+ // LenMargin,TestList,TestListSize,noPwrCalc
+ //
+ CalcPowerTrend (
+ MrcData,
+ Channel,
+ (OdtTrainingDimmMask >> (DIMM_ODT_DIMM_MASK_SHIFT * Channel)),
+ DimmOptPoints,
+ Points2calc,
+ MaxOptOff,
+ OffsetPoints,
+ DimmOptPoints->TestList,
+ Scale,
+ DimmOptPoints->NumTests,
+ 0,
+ PWRTrendSlope2D
+ );
+ //
+ // senSq=0,AveN=1,caleM=1,powerOpHigh=0
+ //
+ FindOptimalTradeOff (
+ MrcData,
+ &BestOff,
+ Points2calc,
+ ArrayLength,
+ OffsetPoints,
+ Scale,
+ 0,
+ 1,
+ IncEnds,
+ 1,
+ PwrLimits,
+ 0,
+ 0 // GuardBand
+ );
+ Best = BestOff.Best + BestOff.GuardBand;
+ UpdateOdtsValues (
+ MrcData,
+ MRC_BIT0 << Channel,
+ &DimmOptPoints[Best],
+ 0,
+ 0,
+ skipSubOpt,
+ 1
+ );
+ //
+ // MrcWait (MrcData, 10 * HPET_1MS);
+ // MrcResetSequence (MrcData);
+ //
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ BestRttNom[Channel][Dimm] = DimmOptPoints[Best].ODTSet.RttNom[Channel][Dimm];
+ }
+
+ BestRdOdt[Channel] = DimmOptPoints[Best].ODTSet.GRdOdt;
+ RdOdtCodes[Channel] = DimmOptPoints[Best].ODTSet.GRdOdtCode;
+
+#ifdef MRC_DEBUG_PRINT
+ //
+ // printing the results
+ //
+ PrintODTResultTable (
+ MrcData,
+ &BestOff,
+ DimmOptPoints,
+ OffsetPoints,
+ 0,
+ 1,
+ OptDimmOdt,
+ Channel,
+ LocalRanks[Channel],
+ 1,
+ 0,
+ 1
+ );
+ //
+ // PrintODTResultTable(*MrcData,calcResultSummary,*TestList,NumTest,NumOffsets,MidPoint,IncEnds,OptParam,Channel,Ranks,TrendLine,Nibble,perCh);
+ //
+#endif // MRC_DEBUG_PRINT
+ } // end ch loop
+ //
+ // Find Best "Average" value for Global RdOdt Offset
+ //
+ NumCh = 0;
+ Average = 0;
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!((MRC_BIT0 << Channel) & ChMask)) {
+ continue;
+ }
+
+ NumCh += 1;
+ Average += BestRdOdt[Channel];
+ //
+ // RdOdtChOffset[Channel] = RdOdtCodes[BestRdOdt[Channel]]; //set comp code associated comp offset per ch
+ //
+ }
+
+ BestGRdOdt = (NumCh != 0) ? (Average / NumCh) : Average;
+ //
+ // update average rdOdt offset (both ch)
+ //
+ BestGRdOdtCode = UpdateCompGlobalOffset (MrcData, RdOdt, (U8) BestGRdOdt, 1);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "Calculated Average (both ch) GRdOdt is %d\n", BestGRdOdt);
+
+ if (NumCh > 1) {
+ //
+ // adjust RdOdt to per channel/byte
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!((MRC_BIT0 << Channel) & ChMask)) {
+ continue;
+ }
+
+ RdOdtCodes[Channel] -= BestGRdOdtCode;
+ for (byte = 0; byte < Outputs->SdramCount; byte++) {
+ //
+ // Apply Best RdOdt in case we didnt run Godt.
+ //
+ OdtOff = RdOdtCodes[Channel] + ((Outputs->Controller[0].Channel[Channel].DataCompOffset[byte] >> 12) & 0x1f);
+ UpdateOptParamOffset (MrcData, Channel, 0xF, byte, OptRdOdt, (S16) OdtOff, 1);
+ }
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "Re-center Read Voltage\n");
+ Status = ReadVoltageCentering2D (
+ MrcData,
+ Outputs->MarginResult,
+ ChMask,
+ RdV,
+ 0,
+ 0,
+ loopcount,
+ 0
+ );
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "Re-center Read Timing\n");
+ Status = DataTimeCentering2D (
+ MrcData,
+ Outputs->MarginResult, // prev. margin results
+ ChMask,
+ RdT,
+ 0, // EnPerBit,
+ 0, // EnRxDutyCycle
+ 0, // ResetPerBit
+ loopcount,
+ 0 // En2D
+ );
+
+ if (!Lpddr) {
+ //
+ // DIMM ODT is disabled by default on LPDDR, so skip this section
+ //
+
+ //
+ // *** Write flow ***//
+ //
+ RttOffset = (Inputs->MaxRttWr < 0x2) ? (Inputs->MaxRttWr) : (0x1); // Get user input for MaxRttWr, 0 = off, 1 = 120 ohms
+ if (any2DPC) {
+ //
+ // At least one 2DPC ch
+ //
+ if (!any1DPC) {
+ RttOffset = 1; // Start with 120ohm
+ }
+ }
+
+ TestList = TestListWr;
+ TestListSize = sizeof (TestListWr);
+ Scale = ScaleTest1DPC;
+
+ //
+ // option 1: Keep RttWr the same for both DIMMs (ie: train per Ch for both RttWr & WrDrv)
+ // option 2: Allow different RttWr for each DIMM and break WrDrv out of this optimization (ie: do it later).
+ //
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ //
+ // check if dimm exist in any channel
+ //
+ OdtTrainingDimmMask = (0x3 << (Dimm * 2));
+ if (!(Outputs->ValidRankMask & OdtTrainingDimmMask)) {
+ continue;
+ }
+
+ localChMask = 0;
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (OdtTrainingDimmMask & LocalRanks[Channel]) {
+ localChMask |= MRC_BIT0 << Channel; // can run 1 or 2 ch
+ }
+ }
+
+ localChMask &= ChMask;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "write odt train localChMask=%x\n", localChMask);
+
+ OffsetPoints = 0;
+ for (RttWr0 = RttOffset; RttWr0 < 3; RttWr0++) {
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ RttWr[Channel][Dimm] = RttWr0; // start with 60 Ohm by default
+ if (!((MRC_BIT0 << Channel) & localChMask)) {
+ continue; // skip if the ch doesn't exist
+ }
+ }
+
+ if ((RttWr0 == 0) && (any1DPC)) {
+ ForceCenter = 1;
+ } else {
+ ForceCenter = 0;
+ }
+
+ TrainDimmOdtSetting (
+ MrcData,
+ &DimmOptPoints[OffsetPoints],
+ localChMask,
+ OdtTrainingDimmMask,
+ 1,
+ BestRttNom,
+ RttWr,
+ BestGRdOdt,
+ TestList,
+ TestListSize,
+ SubPwrLimits,
+ skipSubOpt,
+ skipOptPrint,
+ ReCenterPoints,
+ ReCenterPoints | ForceCenter,
+ Points2calc,
+ ArrayLength,
+ OffsetPoints
+ );
+ OffsetPoints++;
+ }
+ //
+ // for each channel apply Power Trend and find best point
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!((MRC_BIT0 << Channel) & localChMask)) {
+ continue; // check if the ch exist
+ }
+
+ for (offset = 0; offset < OffsetPoints; offset++) {
+ //
+ // copy point for the FindOptTradeOff routing
+ //
+ for (test = 0; test < (DimmOptPoints->NumTests); test++) {
+ Points2calc[test][offset] = DimmOptPoints[offset].Points2Trade[test][Channel];
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Write channel=%d Points2calc[test=%d][offset=%d]=%d\n",Channel,test,offset,Points2calc[test][offset]);
+ //
+ }
+ }
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "FindOptimalTradeOff write\n");
+ // LenMargin,TestList,TestListSize,noPwrCalc
+ //
+ CalcPowerTrend (
+ MrcData,
+ Channel,
+ MRC_BIT0 << Dimm,
+ DimmOptPoints,
+ Points2calc,
+ MaxOptOff,
+ OffsetPoints,
+ DimmOptPoints->TestList,
+ Scale,
+ DimmOptPoints->NumTests,
+ 0,
+ PWRTrendSlope2D
+ );
+ //
+ // senSq=0,AveN=1,caleM=1,powerOpHigh=0
+ //
+ FindOptimalTradeOff (
+ MrcData,
+ &BestOff,
+ Points2calc,
+ ArrayLength,
+ OffsetPoints,
+ Scale,
+ 0,
+ 1,
+ IncEnds,
+ 1,
+ PwrLimits,
+ 0,
+ 0 // GuardBand
+ );
+ Best = BestOff.Best + BestOff.GuardBand;
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "===============> BestOff=%d\n",BestOff.Best);
+ // skipGRdOdt=1 SkipDimmOdts=0, SkipBestOffsets,updateHost
+ //
+ UpdateOdtsValues (MrcData, MRC_BIT0 << Channel, &DimmOptPoints[Best], 1, 0, skipSubOpt, 1);
+ RttWr[Channel][Dimm] = DimmOptPoints[Best].ODTSet.RttWr[Channel][Dimm];
+ BestRttWr[Channel][Dimm] = DimmOptPoints[Best].ODTSet.RttWr[Channel][Dimm]; // delete?
+ #ifdef MRC_DEBUG_PRINT // printing the results
+ PrintODTResultTable (
+ MrcData,
+ &BestOff,
+ DimmOptPoints,
+ OffsetPoints,
+ 0,
+ 1,
+ OptDimmOdtWr,
+ Channel,
+ OdtTrainingDimmMask,
+ 1,
+ 0,
+ 1
+ );
+ //
+ // PrintODTResultTable(*MrcData,calcResultSummary,*TestList,NumTest,NumOffsets,MidPoint,IncEnds,OptParam,Channel,Ranks,TrendLine,Nibble,perCh);
+ //
+ #endif // MRC_DEBUG_PRINT
+ } // end of channel loop
+ } // end dimm loop
+ //
+ //set equal TxEq for all bytes before DS
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!((MRC_BIT0 << Channel) & Outputs->ValidChBitMask)) {
+ continue; // skip if the ch doesn't exist
+ }
+
+ for (byte = 0; byte < NumBytes; byte++) {
+ UpdateOptParamOffset (
+ MrcData,
+ Channel,
+ LocalRanks[Channel],
+ byte,
+ OptTxEq,
+ (S16) (3 * (TXEQFULLDRV >> 4) + 3),
+ 1
+ );
+ }
+ }
+ } // if (!Lpddr)
+
+ //
+ // run WriteDS
+ //
+ Status = TrainWriteDriveStrength (MrcData, Outputs->ValidChBitMask, 0, OPT_PARAM_1D_LC, 0);
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "Re-center Write Vref\n");
+ Status = MrcWriteVoltageCentering2D (MrcData);
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "Re-center Write Timing\n");
+ Status = DataTimeCentering2D (
+ MrcData,
+ Outputs->MarginResult, // prev. margin results
+ Outputs->ValidChBitMask,
+ WrT,
+ 0, // EnPerBit,
+ 0, // EnRxDutyCycle
+ 0, // ResetPerBit
+ loopcount,
+ 0 // En2D
+ );
+
+ return Status;
+}
+
+/**
+ This function implements Read Equalization training.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - if it succeeds return mrcSuccess
+**/
+MrcStatus
+MrcReadEQTraining (
+ IN MrcParameters *const MrcData
+ )
+{
+#ifdef ULT_FLAG
+ U8 RankMask;
+ U8 TestList[] = { RdV, RdT };
+ U8 Scale[] = { 1, 2, 1, 0, 0 };
+ U16 PwrLimits[] = { 1280, 1280, 0, 0, 0 };
+ U16 GlobalPwrLimit;
+ OptOffsetChByte BestOff;
+
+ if (MrcData->SysIn.Inputs.CpuModel == cmHSW_ULT) {
+ GlobalPwrLimit = UpmPwrLimitValue (MrcData, TestList[0], PowerLimit);
+ PwrLimits[0] = MAX (PwrLimits[0], GlobalPwrLimit);
+ GlobalPwrLimit = UpmPwrLimitValue (MrcData, TestList[1], PowerLimit);
+ PwrLimits[1] = MAX (PwrLimits[1], GlobalPwrLimit);
+
+ //
+ // Function Call for RxEQ Training
+ //
+ for (RankMask = 1; RankMask < (MRC_BIT0 << MAX_RANK_IN_CHANNEL); RankMask <<= 1) {
+ if (RankMask & MrcData->SysOut.Outputs.ValidRankMask) {
+ TrainDDROptParam (
+ MrcData,
+ &BestOff,
+ 0x3,
+ RankMask,
+ OptRxEq,
+ TestList,
+ sizeof (TestList),
+ Scale,
+ PwrLimits,
+ 0, // Start
+ 7, // Stop
+ OPT_PARAM_1D_LC,
+ 1, // Repeats
+ 0, // NoPrint
+ 0, // SkipOptUpdate
+ 0, // RdRd2Test
+ 0 // GuardBand
+ );
+ }
+ }
+ }
+#endif
+
+ return mrcSuccess;
+}
+
+/**
+ This function implements Write (Transmitter) Equalization training.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - if it succeeds return mrcSuccess
+**/
+MrcStatus
+MrcWriteEQTraining (
+ IN MrcParameters *const MrcData
+ )
+{
+ MrcStatus Status;
+ U8 Rank;
+ U8 RankMask;
+ U8 TestList[] = { WrV, WrT };
+ U8 Scale[] = { 1, 2, 1, 0, 0 }; // must specify scale=0 to unpopulate slots !!
+ U16 PwrLimits[5];
+ OptOffsetChByte BestOff;
+
+ MrcOemMemorySetWord (PwrLimits, 0, sizeof (PwrLimits) / sizeof (PwrLimits[0]));
+ PwrLimits[0] = UpmPwrLimitValue (MrcData, TestList[0], PowerLimit);
+ PwrLimits[1] = UpmPwrLimitValue (MrcData, TestList[1], PowerLimit);
+
+ //
+ // Function Call for RxEQ Training
+ //
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ RankMask = MRC_BIT0 << Rank;
+ if (RankMask & MrcData->SysOut.Outputs.ValidRankMask) {
+ TrainDDROptParam (
+ MrcData,
+ &BestOff,
+ 0x3,
+ RankMask,
+ OptTxEq,
+ TestList,
+ sizeof (TestList),
+ Scale,
+ PwrLimits,
+ 0, // Start
+ 11, // Stop
+ OPT_PARAM_1D_LC,
+ 1, // Repeats
+ 0, // NoPrint
+ 0, // SkipOdtUpdate
+ 0, // RdRd2Test
+ 2 // GuardBand
+ );
+ }
+ }
+
+ DataTimeCentering2D (
+ MrcData,
+ MrcData->SysOut.Outputs.MarginResult, // prev. margin results
+ 0x3,
+ WrT,
+ 0, // EnPerBit,
+ 0, // EnRxDutyCycle
+ 0, // ResetPerBit
+ OPT_PARAM_1D_LC,
+ 0 // En2D
+ );
+
+ Status = mrcSuccess;
+ return Status;
+}
+
+/**
+ This function implements Read Amplifier Power training.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - If it succeeds return mrcSuccess
+**/
+MrcStatus
+MrcReadAmplifierPower (
+ IN MrcParameters *const MrcData
+ )
+{
+ MrcStatus Status;
+ MrcOutput *Outputs;
+ const MrcDebug *Debug;
+ U8 TestList[] = { RdV, RdT };
+ U8 Scale[] = { 1, 2, 1, 0, 0 }; // must specify scale=0 to unpopulate slots !!
+ U16 PwrLimits[5];
+ OptOffsetChByte BestOff;
+ BOOL RdCenter;
+ U8 RecenterLC;
+
+ RdCenter = 1;
+ RecenterLC = 15;
+ Status = mrcSuccess;
+ Outputs = &MrcData->SysOut.Outputs;
+ Debug = &MrcData->SysIn.Inputs.Debug;
+
+ MrcOemMemorySetWord (PwrLimits, 0, sizeof (PwrLimits) / sizeof (PwrLimits[0]));
+ PwrLimits[0] = UpmPwrLimitValue (MrcData, TestList[0], PowerLimit);
+ PwrLimits[1] = UpmPwrLimitValue (MrcData, TestList[1], PowerLimit);
+
+ //
+ // Function Call for RxBias
+ //
+ TrainDDROptParam (
+ MrcData,
+ &BestOff,
+ 0x3,
+ 0xF,
+ OptRxBias,
+ TestList,
+ sizeof (TestList),
+ Scale,
+ PwrLimits,
+ 0, // Start
+ 7, // Stop
+ OPT_PARAM_1D_LC,
+ 1, // Repeats
+ 0, // NoPrint
+ 0, // SkipOdtUpdate
+ 0, // RdRd2Test
+ 0 // GuardBand
+ );
+
+ if (RdCenter) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "Re-center Read Timing\n");
+ Status = DataTimeCentering2D (
+ MrcData,
+ Outputs->MarginResult, // prev. margin results
+ 0x3,
+ RdT,
+ 0, // EnPerBit,
+ 0, // EnRxDutyCycle
+ 0, // ResetPerBit
+ RecenterLC,
+ 0 // En2D
+ );
+ }
+
+ return Status;
+}
+
+/**
+ This function implements Dimm Ron training.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - if it succeeds return mrcSuccess
+**/
+MrcStatus
+MrcDimmRonTraining (
+ IN MrcParameters *const MrcData
+ )
+{
+#ifdef ULT_FLAG
+ OptOffsetChByte BestOff;
+ U8 TestList[] = { RdV, RdT };
+ U8 Scale[] = { 1, 2, 1, 0, 0 }; // must specify scale=0 to unpopulate slots !!
+ U16 PwrLimits[5];
+
+ MrcOemMemorySetWord (PwrLimits, 0, sizeof (PwrLimits) / sizeof (PwrLimits[0]));
+ PwrLimits[0] = UpmPwrLimitValue (MrcData, TestList[0], PowerLimit);
+ PwrLimits[1] = UpmPwrLimitValue (MrcData, TestList[1], PowerLimit);
+
+ //
+ // Check if LPDDR3 memory is used
+ //
+ if (MrcData->SysOut.Outputs.DdrType == MRC_DDR_TYPE_LPDDR3) {
+ //
+ // Function Call for RxBias
+ //
+ TrainDDROptParam (
+ MrcData,
+ &BestOff,
+ 0x3, // Channels
+ 0xF, // Ranks
+ OptDimmRon,
+ TestList,
+ sizeof (TestList),
+ Scale,
+ PwrLimits,
+ 0, // Start
+ 2, // Stop
+ OPT_PARAM_1D_LC, // Loopcount
+ 1, // Repeats
+ 0, // NoPrint
+ 0, // SkipOdtUpdate
+ 0, // RdRd2Test
+ 0 // GuardBand
+ );
+ }
+#endif // ULT_FLAG
+
+ return mrcSuccess;
+
+}
+
+/**
+ This function implements Read ODT training and Write DS.
+ Optimize Read ODT strength for performance & power.
+
+ @param[in,out] MrcData - Include all MRC global data.
+ @param[in,out] BestOff - Structure containg the best offest and margins for th Opt param.
+ @param[in] ChannelMask - Channels to train
+ @param[in] RankMask - Condenses down the results from multiple ranks
+ @param[in] OptParam - Defines the OptParam Offsets.
+ Supported OptParam = [0: WrDS, 1: RdODT, 2: SComp, 3: TComp, 3: TxEq, 4: RxEq,
+ 5: RxBias, 6: DimmOdt, 7: DimmOdtWr]
+ @param[in] TestList - List of margin params that will be tested (up to 4)
+ @param[in] NumTests - The length of TestList
+ @param[in] Scale - List of the relative importance between the 4 tests
+ @param[in] PwrLimitsABC - List of the values for each test margin, above which margin is "adequate"
+ @param[in] Start - Start point of sweeping the Comp values
+ @param[in] Stop - Stop point of sweeping the Comp values
+ @param[in] LoopCount - The number of loops to run in IO tests.
+ @param[in] Repeats - Number of times to repeat the test to average out any noise
+ @param[in] NoPrint - Switch to disable printing.
+ @param[in] SkipOptUpdate - Switch to train but not update Opt settings.
+ @param[in] RdRd2Test - Switch to run with different TA times: possible values are [0, RdRdTA, RdRdTA_All]
+ @param[in] GuardBand - Signed offset to apply to the Opt param best value.
+
+ @retval Nothing
+**/
+void
+TrainDDROptParam (
+ IN OUT MrcParameters *const MrcData,
+ IN OUT OptOffsetChByte *BestOff,
+ IN U8 ChannelMask,
+ IN U8 RankMask,
+ IN U8 OptParam,
+ IN U8 *TestList,
+ IN U8 NumTests,
+ IN U8 *Scale,
+ IN U16 *PwrLimitsABC,
+ IN S8 Start,
+ IN S8 Stop,
+ IN U8 LoopCount,
+ IN U8 Repeats,
+ IN BOOL NoPrint,
+ IN BOOL SkipOptUpdate,
+ IN U8 RdRd2Test,
+ IN S8 GuardBand
+ )
+{
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcChannelOut *ChannelOut;
+ MrcControllerOut *ControllerOut;
+ MrcStatus Status;
+ U32 (*MarginByte)[MAX_RESULT_TYPE][MAX_RANK_IN_CHANNEL][MAX_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_EDGES];
+ //
+ // TestParam X 24 Points X Ch X Byte X Hi/Lo
+ //
+ U32 BERStats[4];
+ U16 SaveMargin[4][24][MAX_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_EDGES];
+ U16 Test;
+ U16 MinEdge;
+ U16 Margins[5][24]; // TestParam X 24 Comp Points
+ U16 Mode;
+ S16 Best;
+ U8 ResultType;
+ U8 AveN;
+ U8 ChBitMask;
+ U8 Channel;
+ U8 Byte;
+ U8 Rank;
+ U8 Edge;
+ U8 FirstRank;
+ U8 OdtValue;
+ U8 NumBytes;
+ U8 BMap[9]; // Need by GetBERMarginByte
+ U8 Param;
+ U8 MaxMargin;
+ U8 localR[MAX_CHANNEL];
+ U8 Rep;
+ void *NullPtr;
+ S8 CurrentComp;
+ S8 ReservedComp;
+ S8 MaxComp;
+ U16 OptPower[24];
+ U8 PWRTrendSlope1D;
+ S8 Delta;
+ S8 Index;
+ S8 Off;
+ S8 LenMargin;
+ S8 Shift;
+ U16 NoiseTicks;
+ BOOL NoSignal;
+ BOOL IncEnds;
+ BOOL IncEndsForPrint;
+ BOOL CPUComp;
+ BOOL printPerCh;
+ DDRCOMP_CR_DDRCRDATACOMP0_STRUCT DdrCrDataComp0;
+ DDRCOMP_CR_DDRCRDATACOMP1_STRUCT DdrCrDataComp1;
+ DDRSCRAM_CR_DDRMISCCONTROL0_STRUCT DdrMiscControl0;
+ DDRCOMP_CR_DDRCRCOMPCTL0_STRUCT DdrCrCompCtl0;
+ DDR3_MODE_REGISTER_1_STRUCT Ddr3ModeRegister1;
+ //
+ // result print summary: 5 columns per byte
+ //
+ OptResultsPerByte calcResultSummary[MAX_CHANNEL][MAX_SDRAM_IN_DIMM];
+
+ MaxComp = 63;
+ PWRTrendSlope1D = 65;
+ ResultType = 0;
+ NullPtr = 0;
+ CurrentComp = 0;
+ IncEnds = 0;
+ IncEndsForPrint = 0;
+ printPerCh = 0;
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerOut = &Outputs->Controller[0];
+ DdrCrCompCtl0.Data = Outputs->CompCtl0;
+ MarginByte = &Outputs->MarginResult;
+ ChannelMask &= Outputs->ValidChBitMask;
+ RankMask &= Outputs->ValidRankMask;
+ MrcOemMemorySet ((U8 *) calcResultSummary, 0, sizeof (calcResultSummary));
+ MrcOemMemorySet ((U8 *) BestOff, 0xffff, sizeof (OptOffsetChByte));
+ MrcOemMemorySet ((U8 *) Margins, 0, sizeof (Margins));
+ MrcOemMemorySet ((U8 *) OptPower, 0, sizeof (OptPower));
+ MrcOemMemorySet ((U8 *) localR, 0, sizeof (localR));
+ MrcOemMemorySet ((U8 *) BERStats, 0, sizeof (BERStats));
+ for (Byte = 0; Byte < (sizeof (BMap) / sizeof (BMap[0])); Byte++) {
+ BMap[Byte] = Byte;
+ }
+ Outputs->EnDumRd = 0;
+
+ if (RdRd2Test == RdRdTA) {
+ LoopCount -= 1; // 2 TA tests, so cut the loop count in half
+ } else if (RdRd2Test == RdRdTA_All) {
+ LoopCount -= 3; // 8 TA tests, so divide the loop count by 8
+ }
+
+ SetupIOTestBasicVA (MrcData, ChannelMask, LoopCount, 0, 0, 0, 8); // set test to all channels
+
+ if (RdRd2Test != 0) {
+ Outputs->DQPat = RdRd2Test;
+ }
+ //
+ // Select All Ranks for REUT test
+ //
+ ChBitMask = 0;
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!((MRC_BIT0 << Channel) & ChannelMask)) {
+ continue;
+ }
+
+ ChannelOut = &ControllerOut->Channel[Channel];
+ localR[Channel] = ChannelOut->ValidRankBitMask & RankMask;
+ //
+ // use ChBitMask from here down - if ch is set that mean at least 1 rank for testing, also remove ch w/o active ranks
+ //
+ ChBitMask |= SelectReutRanks (MrcData, Channel, localR[Channel], 0);
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "reut ranks ChBitMask %x Local ranks=%x\n", ChBitMask,localR[Channel]);
+ // Clear any old state in DataTrain Offset
+ //
+ MrcOemMemorySet ((U8 *) &ChannelOut->DataOffsetTrain[0], 0, Outputs->SdramCount);
+ }
+
+ if (ChBitMask == 0) {
+ return ;
+ }
+ //
+ // Find the first selected rank
+ //
+ FirstRank = 0;
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if ((MRC_BIT0 << Rank) & RankMask) {
+ FirstRank = Rank; // could be in any channel
+ break;
+ }
+ }
+ //
+ // Store margin results for
+ //
+ NumBytes = (U8) Outputs->SdramCount;
+
+ if ((OptParam == OptDimmOdt) || (OptParam == OptDimmOdtWr) || (OptParam == OptDimmRon)) {
+ NumBytes = 1;
+ }
+ //
+ // Calculate Start/Stop Point for Comp Optimization
+ //
+ CPUComp = ((OptParam == OptWrDS) || (OptParam == OptRdOdt) || (OptParam == OptTComp) || (OptParam == OptSComp));
+ if (CPUComp) {
+ DdrCrDataComp0.Data = DdrCrDataComp1.Data = 0;
+ if (OptParam == OptRdOdt) {
+ DdrCrDataComp1.Data = MrcReadCR (MrcData, DDRCOMP_CR_DDRCRDATACOMP1_REG);
+ } else {
+ DdrCrDataComp0.Data = MrcReadCR (MrcData, DDRCOMP_CR_DDRCRDATACOMP0_REG);
+ }
+
+ switch (OptParam) {
+ case OptWrDS:
+ CurrentComp = (S8) DdrCrDataComp0.Bits.RcompDrvUp;
+ break;
+
+ case OptRdOdt:
+ CurrentComp = (S8) DdrCrDataComp1.Bits.RcompOdtUp;
+ break;
+
+ case OptSComp:
+ CurrentComp = (S8) DdrCrDataComp0.Bits.SlewRateComp;
+ //
+ // For SCOMP we have a 5-bit register with the max value of 31.
+ // All other COMPs have 6-bit registers with the max value of 63
+ //
+ MaxComp = 31;
+ break;
+
+ case OptTComp:
+ CurrentComp = (S8) DdrCrDataComp0.Bits.TcoComp;
+ break;
+
+ default:
+ CurrentComp = 0;
+ break;
+ }
+
+ ReservedComp = 3; // Reserve 3 comp codes for adjustment range
+ Delta = CurrentComp - ReservedComp + Start;
+ if (Delta < 0) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "------------> warning offset range is clipped by %d\n", Delta);
+ Start -= Delta;
+ }
+
+ Delta = MaxComp - CurrentComp - ReservedComp - Stop;
+ if (Delta < 0) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "------------> warning offset range is clipped by %d\n", Delta);
+ Stop += Delta;
+ }
+
+ if (Stop < Start) {
+ Stop = Start;
+ }
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "CurrentComp = %d, Start = %d, Stop = %d, Delta = %d\n", CurrentComp, Start, Stop, Delta);
+ //
+ }
+ //
+ // Loop through all Test Params and Measure Margin
+ //
+ for (Test = 0; Test < NumTests; Test++) {
+ Param = TestList[Test]; // tl[0]=4 tl[1]=1
+ ResultType = GetMarginResultType (Param); // rxv=0 rxt=1
+ //
+ // Assign to last pass margin results by reference
+ // get lowest margin from all ch/rankS/byte save in FirstRank
+ //
+ Status = GetMarginByte (MrcData, Outputs->MarginResult, Param, FirstRank, RankMask);
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n--- FirstRank = %d ResultType=%d Param=%d ranks=0x%x\n", FirstRank,ResultType,Param,RankMask);
+ // Calculate the MaxMargin for this test
+ //
+ MaxMargin = MAX_POSSIBLE_TIME;
+ if ((Param == RdV) ||
+ (Param == RdFan2) ||
+ (Param == RdFan3) ||
+ (Param == WrV) ||
+ (Param == WrFan2) ||
+ (Param == WrFan3)
+ ) {
+ MaxMargin = MAX_POSSIBLE_VREF;
+ }
+ //
+ // No need to search too far
+ //
+ if (MaxMargin > (PwrLimitsABC[Test] / 20)) {
+ MaxMargin = (U8) (PwrLimitsABC[Test] / 20);
+ }
+ //
+ // Loop Through all Comp Codes
+ //
+ for (Off = Start; Off < Stop + 1; Off++) {
+ Index = Off - Start;
+ //
+ // Apply Code
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!((MRC_BIT0 << Channel) & ChBitMask)) {
+ continue;
+ }
+
+ ChannelOut = &ControllerOut->Channel[Channel];
+ //
+ // For DIMM ODT 2dpc, Start sweeping with RttNom = 40 and RttWr fixed at 60
+ // For DIMM ODT 1dpc, Start sweeping with RttNom = Off and RttWr fixed at Off
+ //
+ if ((OptParam == OptDimmOdt) && (ChannelOut->DimmCount == 2)) {
+ Shift = 0x20;
+ } else {
+ Shift = 0;
+ }
+
+ for (Byte = 0; Byte < NumBytes; Byte++) {
+ if (!SkipOptUpdate) {
+ //
+ // change OpParam offset for all ch/byte/LocalR
+ //
+ UpdateOptParamOffset (MrcData, Channel, localR[Channel], Byte, OptParam, (S16) (Off + Shift), 0);
+ }
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n--Channel=%d, localR[Channel]=%x Byte=%d OffsetComp=%d Off=%d\n",Channel,localR[Channel],Byte,OffsetComp,Off);
+ //
+ } // some are limited in range inside e.g: RdOdt +15:-16
+ }
+
+ for (Rep = 0; Rep < Repeats; Rep++) {
+ //
+ // Run Margin Test - margin_1d with chosen param
+ // run on all ranks but change param only for firstRank??
+ //
+ Mode = 0;
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " start MrcGetBERMarginByte \n");
+ //
+ Status = MrcGetBERMarginByte (
+ MrcData,
+ Outputs->MarginResult,
+ ChBitMask,
+ FirstRank,
+ FirstRank,
+ Param,
+ Mode,
+ BMap,
+ 1,
+ MaxMargin,
+ 0,
+ BERStats
+ );
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " finish MrcGetBERMarginByte \n");
+ // Record Results
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!((MRC_BIT0 << Channel) & ChBitMask)) {
+ continue;
+ }
+
+ for (Edge = 0; Edge < MAX_EDGES; Edge++) {
+ MinEdge = 0xFFFF;
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ if (Rep == 0) {
+ SaveMargin[Test][Index][Channel][Byte][Edge] = 0;
+ }
+
+ SaveMargin[Test][Index][Channel][Byte][Edge] +=
+ (U16) (*MarginByte)[ResultType][FirstRank][Channel][Byte][Edge];
+ if (MinEdge > SaveMargin[Test][Index][Channel][Byte][Edge]) {
+ MinEdge = SaveMargin[Test][Index][Channel][Byte][Edge];
+ }
+ }
+
+ if (NumBytes == 1) {
+ SaveMargin[Test][Index][Channel][0][Edge] = MinEdge; // Todo:change Byte->0
+ }
+ }
+ }
+ }
+ } // end of offset
+#ifdef MRC_DEBUG_PRINT
+ PrintResultTableByte4by24 (
+ MrcData,
+ ChBitMask,
+ SaveMargin,
+ Test,
+ Stop - Start + 1,
+ -Start,
+ 2,
+ OptParam,
+ TestList[Test],
+ PwrLimitsABC,
+ NoPrint
+ );
+#endif // MRC_DEBUG_PRINT
+ } // end of test list
+ //
+ // Calculate the best value for every byte
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n start calculate the the best margin \n");
+ //
+ LenMargin = (Stop - Start) + 1;
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!((MRC_BIT0 << Channel) & ChBitMask)) {
+ continue;
+ }
+
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Byte = 0; Byte < NumBytes; Byte++) {
+ //
+ // Populate Margins array and asymetric penalty
+ //
+ for (Test = 0; Test < NumTests; Test++) {
+ for (Off = Start; Off < Stop + 1; Off++) {
+ Index = Off - Start; // 0:..
+ //
+ // for now just get EW
+ //
+ if ((TestList[Test] == RdV) ||
+ (TestList[Test] == WrV) ||
+ (TestList[Test] == WrFan3) ||
+ (TestList[Test] == RdFan3)
+ ) {
+ Margins[Test][Index] = EffectiveMargin (
+ Scale[Test] * SaveMargin[Test][Index][Channel][Byte][0],
+ Scale[Test] * SaveMargin[Test][Index][Channel][Byte][1]
+ );
+ } else {
+ Margins[Test][Index] = Scale[Test] *
+ (SaveMargin[Test][Index][Channel][Byte][0] + SaveMargin[Test][Index][Channel][Byte][1]);
+ }
+ }
+ }
+ //
+ // Special Cases for Running Average Filter
+ //
+ if ((OptParam == OptDimmOdt) || (OptParam == OptDimmOdtWr) || (OptParam == OptDimmRon)) {
+ AveN = 1;
+ } else if (OptParam == OptRxBias) {
+ AveN = 3;
+ } else if (OptParam == OptRxEq) {
+ //
+ // Use special, 2D running average for RxEq
+ //
+ AveN = 1;
+ RunningAverage2D (Margins, 0, Stop - Start + 1, 5, 2, 1);
+ RunningAverage2D (Margins, 1, Stop - Start + 1, 5, 2, 1); // try Cscale=1 first.
+ } else {
+ AveN = 7;
+ if (LenMargin < AveN) {
+ AveN = LenMargin - 1;
+ }
+ }
+ //
+ // Use one of the Margin Arrays for fine grain power tradeoffs. This is only used if Scale[NumTests] is not 0
+ //
+ for (Off = 0; Off < LenMargin; Off++) {
+ OptPower[Off] = (U16) CalcOptPower (MrcData, Channel, 0, Byte, OptParam, Off + Start, CurrentComp, 0);
+ Margins[NumTests][Off] = OptPower[Off];
+ if ((OptParam == OptDimmRon) || (OptParam == OptWrDS) || (OptParam == OptRdOdt)) {
+ //
+ // convert from Ohm to mW to pass for T-line calc : = (Vdd/2)^2/R ~ 562 / R
+ //
+ Margins[NumTests][Off] = 562 / Margins[NumTests][Off];
+ }
+
+ if ((OptParam == OptTxEq) && (ChannelOut->DimmCount == 1)) {
+ //
+ // find first rank: 0 or 2
+ //
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if ((MRC_BIT0 << Rank) & ChannelOut->ValidRankBitMask) {
+ FirstRank = Rank; // could be in any channel
+ break;
+ }
+ }
+
+ if (Outputs->DdrType == MRC_DDR_TYPE_LPDDR3) {
+ OdtValue = 0;
+ } else {
+ Ddr3ModeRegister1.Data = ChannelOut->Dimm[FirstRank / 2].Rank[FirstRank % 2].MR[mrMR1];
+ OdtValue = (U8)
+ (
+ (Ddr3ModeRegister1.Bits.OdtRttValueHigh << 2) |
+ (Ddr3ModeRegister1.Bits.OdtRttValueMid << 1) |
+ Ddr3ModeRegister1.Bits.OdtRttValueLow
+ );
+ }
+
+ if (OdtValue == 0) {
+ Margins[NumTests][Off] = 1;//no power consideration
+ }
+ }
+ }
+ //
+ // need to provide set of power numbers depending on the OffsetComp codes (per byte)for trend line .
+ //
+ CalcPowerTrend (
+ MrcData,
+ Channel,
+ localR[Channel],
+ NullPtr,
+ Margins,
+ 24,
+ LenMargin,
+ TestList,
+ Scale,
+ NumTests,
+ 1,
+ PWRTrendSlope1D
+ );
+ //
+ // Use that value to create Margin Results based on power.
+ // Creates a smooth, linear function that goes from MaxSum to N/(N-1)*MaxSum
+ // RatioNum = FinePwrRatio[OptParam] * LenMargin; //e.g FinePwrRatio[RdOdt]=5
+ // Find the Best Overall Setting
+ // senSq=0,caleM=1,powerOpHigh=0
+ //
+ FindOptimalTradeOff (
+ MrcData,
+ &calcResultSummary[Channel][Byte],
+ Margins,
+ 24,
+ LenMargin,
+ Scale,
+ 0,
+ AveN,
+ IncEnds,
+ 1,
+ PwrLimitsABC,
+ 0,
+ GuardBand
+ );
+ //
+ // Get the best index considering the GuardBand
+ //
+ Best = calcResultSummary[Channel][Byte].Best + calcResultSummary[Channel][Byte].GuardBand;
+ NoiseTicks = 3;
+ NoSignal = FALSE;
+ for (Test = 0; Test < NumTests; Test++) {
+ if ((calcResultSummary[Channel][Byte].Ticks[Test] / 10) > NoiseTicks) {
+ NoSignal = FALSE;
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n NumTests = %d Best =%d ch=%d byte=%d calcResultSummary[Channel][Byte].Ticks[Test]=%d NoiseTicks=%d\n",NumTests,Best,Channel,Byte,calcResultSummary[Channel][Byte].Ticks[Test],NoiseTicks);
+ //
+ break;
+ }
+ }
+
+ if (NoSignal) {
+ Best = 0;//set to min
+ calcResultSummary[Channel][Byte].Best = 0;
+ }
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n Best =%d ch=%d byte=%d \n",Best,Channel,Byte);
+ // Update CR
+ //
+ if ((OptParam == OptDimmOdt) && (ChannelOut->DimmCount == 2)) {
+ Shift = 0x20;
+ } else {
+ Shift = 0;
+ }
+ //
+ // Best += (Shift - Start);
+ //
+ Best -= (Shift - Start); // update take offset
+ if (!SkipOptUpdate) {
+ UpdateOptParamOffset (MrcData, Channel, localR[Channel], Byte, OptParam, Best, 1);
+ }
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " localR[Channel]=%x Best =%d ch=%d byte=%d \n",localR[Channel],Best,Channel,Byte);
+ //
+ BestOff->Offset[Channel][Byte] = Best;
+ } // end byte
+ } // End of Calculating best value (ch)
+#ifdef MRC_DEBUG_PRINT
+ //
+ // printing the results
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if ((MrcChannelExist (Outputs, Channel))) {
+ if (!((MRC_BIT0 << Channel) & ChBitMask)) {
+ continue;
+ }
+
+ ChannelOut = &ControllerOut->Channel[Channel];
+ if (!(ChannelOut->ValidRankBitMask & localR[Channel])) {
+ continue;
+ }
+
+ IncEndsForPrint =
+ (
+ OptParam == OptDimmOdt ||
+ OptParam == OptDimmOdtWr ||
+ OptParam == OptDimmRon ||
+ OptParam == OptRxEq ||
+ IncEnds
+ );
+ printPerCh = (OptParam == OptDimmOdt || OptParam == OptDimmOdtWr || OptParam == OptDimmRon);
+ //
+ // lower bytes
+ //
+ PrintCalcResultTableCh (
+ MrcData,
+ calcResultSummary,
+ TestList,
+ NumTests,
+ Stop - Start + 1,
+ -Start,
+ IncEndsForPrint,
+ OptParam,
+ OptPower,
+ Channel,
+ localR[Channel],
+ Scale[NumTests],
+ 0,
+ printPerCh,
+ NoPrint
+ );
+ //
+ // higher bytes
+ //
+ if (!printPerCh) {
+ PrintCalcResultTableCh (
+ MrcData,
+ calcResultSummary,
+ TestList,
+ NumTests,
+ Stop - Start + 1,
+ -Start,
+ IncEndsForPrint,
+ OptParam,
+ OptPower,
+ Channel,
+ localR[Channel],
+ Scale[NumTests],
+ 1,
+ printPerCh,
+ NoPrint
+ );
+ }
+ }
+ }
+#endif // MRC_DEBUG_PRINT
+ //
+ // Propgate new CR setting
+ //
+ // @todo: redundant :there is one inside updateComps
+ //
+ if (CPUComp) {
+ DdrMiscControl0.Data = Outputs->MiscControl0;
+ DdrMiscControl0.Bits.ForceCompUpdate = 1;
+ MrcWriteCR (MrcData, DDRSCRAM_CR_DDRMISCCONTROL0_REG, DdrMiscControl0.Data);
+ }
+ //
+ // Update the LastPass points in host
+ //
+ for (Test = 0; Test < NumTests; Test++) {
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!((MRC_BIT0 << Channel) & ChBitMask)) {
+ continue;
+ }
+
+ ResultType = GetMarginResultType (TestList[Test]);
+ for (Byte = 0; Byte < NumBytes; Byte++) {
+ //
+ // save the margins in best offset point for each byte/ch in rank 0/1
+ //
+ (*MarginByte)[ResultType][0][Channel][Byte][0] =
+ SaveMargin[Test][BestOff->Offset[Channel][Byte] - Start][Channel][Byte][0];
+ (*MarginByte)[ResultType][0][Channel][Byte][1] =
+ SaveMargin[Test][BestOff->Offset[Channel][Byte] - Start][Channel][Byte][1];
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "best offset= %d ;byte=%d ;(*MarginByte)[ResultType][0][Channel][Byte][0] -%d (*MarginByte)[ResultType][0][Channel][Byte][1] -%d add=%d\n",BestOff->Offset[Channel][Byte],Byte,(U16) (*MarginByte)[ResultType][0][Channel][Byte][0] , (*MarginByte)[ResultType][0][Channel][Byte][1],((U16) (*MarginByte)[ResultType][0][Channel][Byte][0] + (U16)(*MarginByte)[ResultType][0][Channel][Byte][1]));
+ //
+ }
+ }
+
+ Status = ScaleMarginByte (MrcData, Outputs->MarginResult, TestList[Test], 0);
+ }
+
+ BestOff->NumTests = sizeof (TestList);
+ for (Test = 0; Test < NumTests; Test++) {
+ ResultType = GetMarginResultType (TestList[Test]);
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!((MRC_BIT0 << Channel) & ChBitMask)) {
+ continue;
+ }
+ //
+ // track minimum eye width per ch
+ //
+ for (Byte = 0; Byte < NumBytes; Byte++) {
+ if (Byte == 0) {
+ BestOff->Margins[Test][Channel] = (U16) ((*MarginByte)[ResultType][0][Channel][0][0] +
+ (*MarginByte)[ResultType][0][Channel][0][1]);
+ } else if (BestOff->Margins[Test][Channel] >
+ ((*MarginByte)[ResultType][0][Channel][Byte][0] + (*MarginByte)[ResultType][0][Channel][Byte][1])
+ ) {
+ BestOff->Margins[Test][Channel] = (U16) ((*MarginByte)[ResultType][0][Channel][Byte][0] +
+ (*MarginByte)[ResultType][0][Channel][Byte][1]);
+ }
+ }
+
+ BestOff->TestList[Test][Channel] = TestList[Test];
+
+ //
+ // Normalize margins
+ // BestOff->Margins[Test][Channel] *= Scale[Test]; //Scale??
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "after scale - BestOff->Margins[ch=%d][%s]= %d \n",Channel,MarginTypesString[TestList[Test]],BestOff->Margins[Test][Channel]);
+ //
+ }
+ //
+ // if (BestOff->Margins[Test][Channel]<=20) {//set OptParam to max in case off no eye
+ // for (Byte = 0; Byte < NumBytes; Byte++) {
+ // if(OptParam == OptRxBias) UpdateOptParamOffset (MrcData, Channel, 0, Byte, OptRxBias, 15, 1);
+ // if(OptParam == OptWrDS) UpdateOptParamOffset (MrcData, Channel, 0, Byte, OptWrDS, 7, 1);
+ // }
+ // }
+ //
+ }
+ //
+ // Clean up
+ //
+ Outputs->EnDumRd = 0;
+
+ return;
+
+}
+
+/**
+ This function implements Read ODT training.
+ Optimize Read ODT strength for performance & power
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - If it succeded return mrcSuccess
+**/
+MrcStatus
+MrcReadODTTraining (
+ IN MrcParameters *const MrcData
+ )
+{
+ MrcStatus Status;
+ const MrcInput *Inputs;
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcCpuModel CpuModel;
+ U8 *TestList;
+ U8 TestListDdr3[] = { RdV, RdT };
+ U8 TestListSize;
+ U8 ScaleDdr3[] = { 1, 2, 1, 0, 0 };
+ U8 *Scale;
+ U16 PwrLimits[5]; // Eye width/height
+ S8 Start;
+ S8 Stop;
+ S16 OffLimit;
+ S16 OffLimitDn;
+ U16 OdtLimit;
+ U8 OdtLimitDn;
+ U16 Rleg;
+ S8 StatLegs;
+ U8 OdtLegsDis;
+ S8 CurrentVref;
+ S8 CurrentComp;
+ OptOffsetChByte BestOff;
+ BOOL RdCenter;
+ U8 RecenterLC;
+ DDRCOMP_CR_DDRCRCOMPCTL0_STRUCT DdrCrCompCtl0;
+ DDRCOMP_CR_DDRCRDATACOMP1_STRUCT DdrCrDataComp1;
+ U8 RdTATestType;
+ U8 Index;
+#ifdef ULT_FLAG
+ U8 TestListLpddr[] = { RdV, RdT, RcvEnaX };
+ U8 ScaleLpddr[] = { 1, 2, 2, 1, 0 };
+ BOOL Lpddr;
+#endif
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ Debug = &Inputs->Debug;
+ CpuModel = Inputs->CpuModel;
+ Status = mrcSuccess;
+ RdCenter = 1;
+ RecenterLC = 17;
+ Start = -16;
+ MrcOemMemorySetWord (PwrLimits, 0, sizeof (PwrLimits) / sizeof (PwrLimits[0]));
+
+ //
+ // find a start offset where we below 180ohm to protect against OS/US
+ //
+ DdrCrDataComp1.Data = MrcReadCR (MrcData, DDRCOMP_CR_DDRCRDATACOMP1_REG);
+ CurrentComp = (S8) DdrCrDataComp1.Bits.RcompOdtUp;
+ OdtLimitDn = 30; //ohm
+ TestList = TestListDdr3;
+ TestListSize = sizeof (TestListDdr3);
+ Scale = ScaleDdr3;
+ RdTATestType = RdRdTA;
+
+#ifdef ULT_FLAG
+ Lpddr = (Outputs->DdrType == MRC_DDR_TYPE_LPDDR3);
+ if (CpuModel == cmHSW_ULT) {
+ OdtLimit = 230;
+ if (Lpddr) {
+ RdTATestType = RdRdTA_All;
+ OdtLimitDn = 80; //ohm
+ TestList = TestListLpddr;
+ Scale = ScaleLpddr;
+ TestListSize = sizeof (TestListLpddr);
+ }
+ } else
+#endif //ULT_FLAG
+ {
+ OdtLimit = 180;
+ }
+
+ for (Index = 0; Index < TestListSize; Index++) {
+ PwrLimits[Index] = UpmPwrLimitValue (MrcData, TestList[Index], PowerLimit);
+ }
+
+ DdrCrCompCtl0.Data = Outputs->CompCtl0;
+ OdtLegsDis = (U8) DdrCrCompCtl0.Bits.DisableOdtStatic;
+ CurrentVref = (S8) DdrCrCompCtl0.Bits.DqOdtVref;
+ StatLegs = 4 * 4; // we enable only 1/3 segment for odt
+ if (CurrentVref & 0x10) {
+ CurrentVref -= 0x20; // 2's complement
+ }
+
+ Rleg = CalcRdOdt (MrcData, CurrentVref) * (StatLegs * (!OdtLegsDis) + CurrentComp);
+ OffLimit = (Rleg / OdtLimit) - StatLegs * (!OdtLegsDis) - CurrentComp;
+
+ //
+ // Find max ODT offset
+ //
+ OffLimitDn = (Rleg / OdtLimitDn) - StatLegs * (!OdtLegsDis) - CurrentComp;
+ Stop = (U8) OffLimitDn;
+
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_ERROR,
+ " current code = %d OdtLegsDis = %d Rleg = %d CurrentVref = %d OffLimit = %d Start = %d stop = %d\n",
+ CurrentComp,
+ OdtLegsDis,
+ Rleg,
+ CurrentVref,
+ OffLimit,
+ Start,
+ Stop
+ );
+
+ if (OffLimit > Start) {
+ Start = (S8) OffLimit;
+ }
+
+ if (Stop > (23 + Start)) {
+ Stop = (S8) (23 + Start); // Only 24 offsets in the margin array.
+ }
+ if (Stop > 15) {
+ Stop = 15;
+ }
+
+ //
+ // Function Call for RdODT
+ //
+ TrainDDROptParam (
+ MrcData,
+ &BestOff,
+ 0x3,
+ 0xF,
+ OptRdOdt,
+ TestList,
+ TestListSize,
+ Scale,
+ PwrLimits,
+ Start,
+ Stop, // Stop
+ 17, // Loopcount increased from 15 to better match RMT margins
+ 1, // Repeats
+ 0, // NoPrint
+ 0, // SkipOptUpdate
+ RdTATestType, // RdRd2Test
+ 0 // GuardBand
+ );
+
+ if (RdCenter) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "Re-center Read Timing\n");
+ Status = DataTimeCentering2D (
+ MrcData,
+ Outputs->MarginResult, // prev. margin results
+ 0x3,
+ RdT,
+ 0, // EnPerBit,
+ 0, // EnRxDutyCycle
+ 0, // ResetPerBit
+ RecenterLC,
+ 0 // En2D
+ );
+ }
+
+ return Status;
+}
+
+/**
+ This function implements Dimm Odt training.
+ Optimize Dimm Odt value for performance/power
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - If it succeded return mrcSuccess
+**/
+MrcStatus
+MrcDimmODT1dTraining (
+ IN MrcParameters *const MrcData
+ )
+{
+ MrcStatus Status;
+ MrcOutput *Outputs;
+ U8 TestList[] = { RdV, RdT, WrV, WrT }; // ie 4,1
+ U8 TestListWr[] = { WrV, WrT }; // ie 4,1
+ U8 Scale[] = { 1, 2, 1, 2, 0 };
+ U8 ScaleWr[] = { 1, 2, 0, 0, 0 };
+ U16 PwrLimits[] = { 2480, 2240, 2480, 2240, 0 }; // just margin consideration
+ U8 dimm;
+ U8 Channel;
+ U8 ChannelMask;
+ OptOffsetChByte BestOff;
+
+ Outputs = &MrcData->SysOut.Outputs;
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if ((MrcChannelExist (Outputs, Channel))) {
+ ChannelMask = MRC_BIT0 << Channel;
+ if (Outputs->Controller[0].Channel[Channel].DimmCount == 2) {
+ //
+ // DimmODT Rtt Nom - 120,60,40,30
+ // run Rtt nom with the Rtt write 0x20=60 ohm
+ //
+ TrainDDROptParam (
+ MrcData,
+ &BestOff,
+ ChannelMask,
+ 0xF,
+ OptDimmOdt,
+ TestList,
+ sizeof (TestList),
+ Scale,
+ PwrLimits,
+ 1, // Start
+ 4, // Stop
+ OPT_PARAM_1D_LC,
+ 1, // Repeats
+ 0, // NoPrint
+ 0, // SkipOdtUpdate
+ 0, // RdRd2Test
+ 0 // GuardBand
+ );
+ for (dimm = 0; dimm < 2; dimm++) {
+ //
+ // Function Call for DimmODT Write - 120,60
+ //
+ TrainDDROptParam (
+ MrcData,
+ &BestOff,
+ ChannelMask,
+ 0x3 << (dimm * 2),
+ OptDimmOdtWr,
+ TestListWr,
+ sizeof (TestListWr),
+ ScaleWr,
+ PwrLimits,
+ 1, // Start
+ 2, // Stop
+ OPT_PARAM_1D_LC,
+ 1, // Repeats
+ 0, // NoPrint
+ 0, // SkipOdtUpdate
+ 0, // RdRd2Test
+ 0 // GuardBand
+ );
+ }
+ } else {
+ //
+ // 1DPC (only write) - off,120,60
+ //
+ TrainDDROptParam (
+ MrcData,
+ &BestOff,
+ ChannelMask,
+ 0xF,
+ OptDimmOdt,
+ TestListWr,
+ sizeof (TestListWr),
+ ScaleWr,
+ PwrLimits,
+ 0, // Start
+ 2, // Stop
+ OPT_PARAM_1D_LC,
+ 1, // Repeats
+ 0, // NoPrint
+ 0, // SkipOdtUpdate
+ 0, // RdRd2Test
+ 0 // GuardBand
+ );
+ }
+ }
+ }
+
+ Status = mrcSuccess;
+
+ return Status;
+}
+
+/**
+ This function is the Write Drive Strength training entry point.
+ This step will optimize write drive strength for performance & power.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - If it succeeds return mrcSuccess
+**/
+MrcStatus
+MrcWriteDriveStrength (
+ IN MrcParameters *const MrcData
+ )
+{
+ MrcStatus Status;
+ U8 OptParamLC;
+ U8 RecenterLC;
+ BOOL Recenter;
+
+ Status = mrcSuccess;
+ OptParamLC = OPT_PARAM_LOOP_COUNT;
+ RecenterLC = OPT_PARAM_1D_LC;
+ Recenter = 1;
+
+ Status = TrainWriteDriveStrength (MrcData, 0x3, RecenterLC, OptParamLC, Recenter);
+
+ return Status;
+}
+
+/**
+ This function implements the Write Drive Strength optimization for performance and power.
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] ChBitMask - Channel mask to perform training on the Opt Param test list.
+ @param[in] RecenterLC - The loopcount for Write Time recentering.
+ @param[in] OptParamLC - The loopcount for training the Opt Param test list.
+ @param[in] Recenter - Switch which determines if the step recenters Write Timing.
+
+ @retval If it succeeds return mrcSuccess
+**/
+MrcStatus
+TrainWriteDriveStrength (
+ IN MrcParameters *const MrcData,
+ IN const U8 ChBitMask,
+ IN const U8 RecenterLC,
+ IN const U8 OptParamLC,
+ IN const BOOL Recenter
+ )
+{
+ MrcStatus Status;
+ MrcOutput *Outputs;
+ const MrcDebug *Debug;
+ U8 TestList[] = { WrV, WrT };
+ U8 Scale[] = { 1, 2, 1, 0, 0 };
+ U16 PwrLimits[5];
+ OptOffsetChByte BestOff;
+
+ Status = mrcSuccess;
+ Outputs = &MrcData->SysOut.Outputs;
+ Debug = &MrcData->SysIn.Inputs.Debug;
+
+ MrcOemMemorySetWord (PwrLimits, 0, sizeof (PwrLimits) / sizeof (PwrLimits[0]));
+ PwrLimits[0] = UpmPwrLimitValue (MrcData, TestList[0], PowerLimit);
+ PwrLimits[1] = UpmPwrLimitValue (MrcData, TestList[1], PowerLimit);
+
+ TrainDDROptParam (
+ MrcData,
+ &BestOff,
+ ChBitMask,
+ 0xf,
+ OptWrDS,
+ TestList,
+ sizeof (TestList),
+ Scale,
+ PwrLimits,
+ -13, // Start
+ 10, // Stop
+ OptParamLC,
+ 1, // Repeats
+ 0, // NoPrint
+ 0, // SkipOdtUpdate
+ 0, // RdRd2Test
+ 1 // GuardBand
+ );
+
+ if (Recenter) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "Re-center Write Timing\n");
+ Status = DataTimeCentering2D (
+ MrcData,
+ Outputs->MarginResult, // prev. margin results
+ 0x3,
+ WrT,
+ 0, // EnPerBit,
+ 0, // EnRxDutyCycle
+ 0, // ResetPerBit
+ RecenterLC,
+ 0 // En2D
+ );
+ }
+
+ return Status;
+}
+
+/**
+ This function implements Write Slew Rate training.
+ Optimize Write Slew Rate for performance & power
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval mrcSuccess
+**/
+MrcStatus
+MrcWriteSlewRate (
+ IN MrcParameters *const MrcData
+ )
+{
+#ifdef ULT_FLAG
+ U8 TestList[] = { WrV, WrT };
+ U8 Scale[] = { 1, 2, 0, 0, 0 };
+ U16 PwrLimits[] = { 2480, 2240, 0, 0, 0 }; // no power consideration
+ U16 GlobalPwrLimit;
+ OptOffsetChByte BestOff;
+
+ if (MrcData->SysIn.Inputs.CpuModel == cmHSW_ULT) {
+ GlobalPwrLimit = UpmPwrLimitValue (MrcData, TestList[0], PowerLimit);
+ PwrLimits[0] = MAX (PwrLimits[0], GlobalPwrLimit);
+ GlobalPwrLimit = UpmPwrLimitValue (MrcData, TestList[1], PowerLimit);
+ PwrLimits[1] = MAX (PwrLimits[1], GlobalPwrLimit);
+
+ TrainDDROptParam (
+ MrcData,
+ &BestOff,
+ 0x3,
+ 0xf,
+ OptSComp,
+ TestList,
+ sizeof (TestList),
+ Scale,
+ PwrLimits,
+ -15, // Start
+ 8, // Stop
+ OPT_PARAM_1D_LC,
+ 1, // Repeats
+ 0, // NoPrint
+ 0, // SkipOdtUpdate
+ 0, // RdRd2Test
+ 0 // GuardBand
+ );
+ }
+#endif
+
+ return mrcSuccess;
+}
+
+/**
+ Updates a given ch/Rank/byte combination with a new value for OptParam
+ OptParam can be: WrDS, RdOdt, TComp, SComp, RxEq, TxEq, RxBias or DimmOdt
+ OptParam == OptDefault restore values from Host except Dimms Odt's
+ @param[in,out] MrcData - Include all MRC global data.
+ @param[in] Channel - Channel index to work on.
+ @param[in] Ranks - Condenses down the results from multiple ranks
+ @param[in] Byte - Byte index to work on.
+ @param[in] OptParam - Defines the OptParam Offsets.
+ Supported OptParam = [0: WrDS, 1: RdODT, 2: SComp, 3: TComp, 4: TxEq,
+ 5: RxEq, 6: RxBias, 7: DimmOdt, 8: DimmOdtWr]
+ @param[in] Off - Offset
+ @param[in] UpdateHost - Desides if MrcData has to be updated
+
+ @retval Nothing
+**/
+void
+UpdateOptParamOffset (
+ IN OUT MrcParameters *const MrcData,
+ IN const U8 Channel,
+ IN const U8 Ranks,
+ IN const U8 Byte,
+ IN const U8 OptParam,
+ IN S16 Off,
+ IN const U8 UpdateHost
+ )
+{
+ const U16 RttNomMRSEncodingConst[] = {0x00, 0x10, 0x01, 0x11, 0x81, 0x80}; // RttNom Off,120,60,40,30,20 Ohms
+ const U16 RttWrMRSEncodingConst[] = {0x00, 0x02, 0x01}; // RttWr RttNom,120,60 Ohms
+ const U16 RttDimmRonEncodingConst[] = {0x00, 0x02}; // Dimm Ron 240/6,240/7 Oms
+ const MrcDebug *Debug;
+#ifdef ULT_FLAG
+ const U8 LpddrRonEnc[] = {0x1,0x2,0x3}; //{34,40,48};
+ const U8 LpddrOdtEnc[] = {0x0,0x2,0x3}; //{0,120,240};
+ BOOL Lpddr;
+#endif // ULT_FLAG
+ MrcOutput *Outputs;
+ MrcChannelOut *ChannelOut;
+ U16 *MrReg;
+ MrcStatus Status;
+ BOOL Type;
+ U8 Rank;
+ U8 RankMask;
+ U8 Value;
+ U8 Index;
+ U16 MRValue;
+ U16 RttNomMRSEncoding[sizeof (RttNomMRSEncodingConst) / sizeof (RttNomMRSEncodingConst[0])];
+ U16 RttWrMRSEncoding[sizeof (RttWrMRSEncodingConst) / sizeof (RttWrMRSEncodingConst[0])];
+ U16 RttWr, RttNom, RttNomMask;
+ U16 DimmRon;
+ U16 RttWrMask;
+ U16 DimmRonMask;
+ U32 Offset;
+ S16 OffCode;
+ S16 OffMin;
+ S16 OffMax;
+ DDRDATA0CH0_CR_DDRCRDATAOFFSETCOMP_STRUCT DdrCrDataOffsetComp;
+ DDRSCRAM_CR_DDRMISCCONTROL0_STRUCT DdrMiscControl0;
+ DDRDATA0CH0_CR_DDRCRDATACONTROL1_STRUCT DdrCrDataControl1;
+
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ ChannelOut = &Outputs->Controller[0].Channel[Channel];
+ MrcOemMemoryCpy ((U8 *) RttNomMRSEncoding, (U8 *) RttNomMRSEncodingConst, sizeof (RttNomMRSEncoding));
+ MrcOemMemoryCpy ((U8 *) RttWrMRSEncoding, (U8 *) RttWrMRSEncodingConst, sizeof (RttWrMRSEncoding));
+#ifdef ULT_FLAG
+ //
+ // Check if LPDDR3 memory is used
+ //
+ Lpddr = (Outputs->DdrType == MRC_DDR_TYPE_LPDDR3);
+#endif // ULT_FLAG
+
+ //
+ // Compensation Offsets
+ //
+ Type =
+ (
+ (OptParam == OptWrDS) ||
+ (OptParam == OptRdOdt) ||
+ (OptParam == OptTComp) ||
+ (OptParam == OptSComp) ||
+ (OptParam == OptDefault)
+ );
+ if (Type) {
+ if (OptParam == OptWrDS) {
+ OffMin = -32;
+ OffMax = 31;
+ } else {
+ OffMin = -16;
+ OffMax = 15;
+ }
+
+ if (Off > OffMax) {
+ Off = OffMax;
+ } else if (Off < OffMin) {
+ Off = OffMin;
+ }
+
+ DdrCrDataOffsetComp.Data = ChannelOut->DataCompOffset[Byte];
+
+ if (OptParam == OptWrDS) {
+ DdrCrDataOffsetComp.Bits.DqDrvUpCompOffset = Off;
+ DdrCrDataOffsetComp.Bits.DqDrvDownCompOffset = Off;
+ } else if (OptParam == OptRdOdt) {
+ DdrCrDataOffsetComp.Bits.DqOdtUpCompOffset = Off;
+ DdrCrDataOffsetComp.Bits.DqOdtDownCompOffset = Off;
+ } else if (OptParam == OptTComp) {
+ DdrCrDataOffsetComp.Bits.DqTcoCompOffset = Off;
+ } else if (OptParam == OptSComp) {
+ DdrCrDataOffsetComp.Bits.DqSlewRateCompOffset = Off;
+ }
+
+ Offset = DDRDATA0CH0_CR_DDRCRDATAOFFSETCOMP_REG +
+ ((DDRDATA1CH0_CR_DDRCRDATAOFFSETCOMP_REG - DDRDATA0CH0_CR_DDRCRDATAOFFSETCOMP_REG) * Byte) +
+ ((DDRDATA0CH1_CR_DDRCRDATAOFFSETCOMP_REG - DDRDATA0CH0_CR_DDRCRDATAOFFSETCOMP_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, DdrCrDataOffsetComp.Data);
+ if (UpdateHost) {
+ ChannelOut->DataCompOffset[Byte] = DdrCrDataOffsetComp.Data;
+ }
+ //
+ // Propagate new value and force comp update
+ //
+ DdrMiscControl0.Data = Outputs->MiscControl0;
+ DdrMiscControl0.Bits.ForceCompUpdate = 1;
+ MrcWriteCR (MrcData, DDRSCRAM_CR_DDRMISCCONTROL0_REG, DdrMiscControl0.Data);
+ }
+ //
+ // Equalization Settings
+ //
+ Type = ((OptParam == OptTxEq) || (OptParam == OptRxEq) || (OptParam == OptDefault));
+ if (Type) {
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if ((MrcRankInChannelExist (MrcData, Rank, Channel)) && ((Ranks & (MRC_BIT0 << Rank)))) {
+ //
+ // TxEq[5:4] = Emphasize = [3, 6, 9, 12] legs
+ // TxEq[3:0] = Deemphasize = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 4*Rsvd] legs
+ //
+ if (OptParam == OptTxEq) {
+ if (Off > 11) {
+ Off = 11;
+ }
+
+ if (Off < 0) {
+ Off = 0;
+ }
+
+ OffCode = Off | TXEQFULLDRV; // Use 12 Emphasize legs (not trained)
+ //MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel=%d,Rank= %d update to %x \n",Channel,Rank,OffCode);
+ UpdateTxT (MrcData, Channel, Rank, Byte, 2, OffCode);
+ if (UpdateHost) {
+ ChannelOut->TxEq[Rank][Byte] = (S8) OffCode;
+ }
+ }
+ //
+ // RxEQ[4:0] CR Decoding (pF/kOhm)
+ // [2:0]
+ // [4:3] 0 1 2 3 4 5-7
+ // 0 0.5/.02 0.5/1.0 0.5/.50 0.5/.25 0.5/.12 rsvd
+ // 1 1.0/.02 1.0/1.0 1.0/.50 1.0/.25 1.0/.12 rsvd
+ // 2 1.5/.02 1.5/1.0 1.5/.50 1.5/.25 1.5/.12 rsvd
+ // 3 2.0/.02 2.0/1.0 2.0/.50 2.0/.25 2.0/.12 rsvd
+ // Sweep = 0-19 [4:3] = (Sweep/5) [2:0] = (Sweep%5)
+ //
+ if (OptParam == OptRxEq) {
+ if (Off > 19) {
+ Off = 19;
+ }
+
+ if (Off < 0) {
+ Off = 0;
+ }
+
+ Value = (U8) (((Off / 5) << 3) + (Off % 5));
+ UpdateRxT (MrcData, Channel, Rank, Byte, 2, Value);
+ if (UpdateHost) {
+ ChannelOut->RxEq[Rank][Byte] = Value;
+ }
+ }
+
+ if (OptParam == OptDefault) {
+ UpdateTxT (MrcData, Channel, Rank, Byte, 0xff, 0);
+ UpdateRxT (MrcData, Channel, Rank, Byte, 0xff, 0);
+ }
+ }
+ }
+ }
+ //
+ // RX Amplifier BIAS
+ //
+ if ((OptParam == OptRxBias) || (OptParam == OptDefault)) {
+ if (Off > 7) {
+ Off = 7;
+ }
+
+ if (Off < 0) {
+ Off = 0;
+ }
+ //
+ // Mapping: [0: 0.44, 1: 0.66, 2: 0.88, 3: 1.00, 4: 1.33, 5: 1.66, 6: 2.00, 7: 2.33]
+ //
+ DdrCrDataControl1.Data = ChannelOut->DqControl1[Byte].Data;
+ if (OptParam == OptRxBias) {
+ DdrCrDataControl1.Bits.RxBiasCtl = Off;
+ }
+
+ Offset = DDRDATA0CH0_CR_DDRCRDATACONTROL1_REG +
+ ((DDRDATA1CH0_CR_DDRCRDATACONTROL1_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL1_REG) * Byte) +
+ ((DDRDATA0CH1_CR_DDRCRDATACONTROL1_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL1_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, DdrCrDataControl1.Data);
+ if (UpdateHost) {
+ ChannelOut->DqControl1[Byte].Data = DdrCrDataControl1.Data;
+ }
+ }
+ //
+ // Update Dimm Ron value
+ //
+ if ((OptParam == OptDimmRon)) {
+#ifdef ULT_FLAG
+ //
+ // Check if LPDDR3 memory is used
+ //
+ if (Lpddr) {
+ DimmRonMask = (U16)~(MRC_BIT3 | MRC_BIT2 | MRC_BIT1 | MRC_BIT0);
+ Index = (U8) Off;
+ Index = MIN (Index, sizeof (LpddrRonEnc) / sizeof (LpddrRonEnc[0]) - 1);
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ RankMask = MRC_BIT0 << Rank;
+ if ((MrcRankInChannelExist (MrcData, Rank, Channel)) && (Ranks & RankMask)) {
+ MrReg = &ChannelOut->Dimm[Rank / 2].Rank[(Rank % 2)].MR[mrMR0];
+ //
+ // Program Dimm Ron
+ //
+ DimmRon = LpddrRonEnc[Index];
+ MRValue = (MrReg[mrMR3] & DimmRonMask) | DimmRon;
+ Status = MrcIssueMrw (
+ MrcData,
+ Channel,
+ Rank,
+ mrMR3,
+ MRValue,
+ FALSE, // InitMrw
+ FALSE // ChipSelect2N
+ );
+ if (UpdateHost) {
+ MrReg[mrMR3] = MRValue;
+ }
+ }
+ }
+ } else
+#endif // ULT_FLAG
+ {
+ //
+ // DIMM Ron Encoding RttNom[A5,A1]
+ //
+ DimmRonMask = (U16)~(MRC_BIT5 | MRC_BIT1);
+ Index = (U8) Off;
+ Index = MIN (Index, 1);
+ //
+ // can be 0 or 1
+ //
+ DimmRon = RttDimmRonEncodingConst[Index];
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ RankMask = MRC_BIT0 << Rank;
+ if ((MrcRankInChannelExist (MrcData, Rank, Channel)) && (Ranks & RankMask)) {
+ MrReg = &ChannelOut->Dimm[Rank / 2].Rank[(Rank % 2)].MR[mrMR0];
+ //
+ // Program Dimm Ron
+ //
+ MRValue = (MrReg[mrMR1] & DimmRonMask) | DimmRon;
+ Status = MrcWriteMRS (MrcData, Channel, RankMask, mrMR1, MRValue);
+ if (UpdateHost) {
+ MrReg[mrMR1] = MRValue;
+ }
+ }
+ }
+ }
+ }
+ //
+ // DIMM ODT Values
+ //
+ if ((OptParam == OptDimmOdt) || (OptParam == OptDimmOdtWr)) {
+#ifdef ULT_FLAG
+ if (Lpddr) {
+ //
+ // We have only Odt write
+ //
+ RttWrMask = (U16)~(MRC_BIT1 | MRC_BIT0);
+ Index = (U8) Off;
+ Index = MIN (Index, sizeof (LpddrOdtEnc) / sizeof (LpddrOdtEnc[0]) - 1);
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ RankMask = MRC_BIT0 << Rank;
+ if ((MrcRankInChannelExist (MrcData, Rank, Channel)) && (Ranks & RankMask)) {
+ MrReg = &ChannelOut->Dimm[Rank / 2].Rank[Rank % 2].MR11;
+ MRValue = *MrReg;
+ //
+ // Program Dimm DS
+ //
+ RttWr = LpddrOdtEnc[Index];
+ MRValue = (MRValue & RttWrMask) | RttWr;
+ Status = MrcIssueMrw (
+ MrcData,
+ Channel,
+ Rank,
+ mrMR11,
+ MRValue,
+ FALSE, // InitMrw
+ FALSE // ChipSelect2N
+ );
+ if (UpdateHost) {
+ *MrReg = MRValue;
+ }
+ }
+ }
+
+ return;
+ }
+#endif
+ //
+ // DIMM ODT Encoding RttNom[A9,A6,A2] RttWr[A10, A9]
+ //
+ RttNomMask = (U16)~(MRC_BIT9 | MRC_BIT6 | MRC_BIT2);
+ RttWrMask = (U16)~(MRC_BIT10 | MRC_BIT9);
+
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ RankMask = MRC_BIT0 << Rank;
+ if ((MrcRankInChannelExist (MrcData, Rank, Channel)) && (Ranks & RankMask)) {
+ MrReg = &ChannelOut->Dimm[Rank / 2].Rank[(Rank % 2)].MR[mrMR0];
+
+ //
+ // Program RTT WR
+ //
+ Index = (U8) ((OptParam == OptDimmOdt) ? (Off >> 4) : Off);
+ Index = MIN (Index, 2);
+ RttWr = RttWrMRSEncoding[Index] << 9;
+ MRValue = (MrReg[mrMR2] & RttWrMask) | RttWr;
+ Status = MrcWriteMRS (MrcData, Channel, RankMask, mrMR2, MRValue);
+ if (UpdateHost) {
+ MrReg[mrMR2] = MRValue;
+ }
+ //
+ // Program RTT NOM
+ //
+ if (OptParam == OptDimmOdtWr) {
+ continue;
+ }
+
+ Index = ((U8) Off & 0xF);
+ if (Index > 5) {
+ Index = 5;
+ }
+
+ RttNom = RttNomMRSEncoding[Index] << 2;
+ MRValue = (MrReg[mrMR1] & RttNomMask) | RttNom;
+ Status = MrcWriteMRS (MrcData, Channel, RankMask, mrMR1, MRValue);
+ if (UpdateHost) {
+ MrReg[mrMR1] = MRValue;
+ }
+ }
+ }
+ }
+
+ return;
+}
+
+/**
+ Slightly penalize any Asymmetry in margin
+
+ @param[in] NegEdge - Negative edge of the margin
+ @param[in] PosEdge - Positive edge of the margin
+
+ @retval p2p - Width/Height reduced by the asymmetric difference in margin.
+**/
+U16
+EffectiveMargin (
+ IN const U16 NegEdge,
+ IN const U16 PosEdge
+ )
+{
+ S16 p2p;
+ U16 p2pDiff;
+
+ p2p = 2 * (PosEdge + NegEdge);
+ p2pDiff = PosEdge - NegEdge;
+
+ if (PosEdge > NegEdge) {
+ p2p -= p2pDiff;
+ } else {
+ p2p += p2pDiff;
+ }
+
+ return p2p / 2;
+}
+
+/**
+ This function does a running average on Margins in two dimentional fashion.
+
+ @param[in,out] Margins - Margins to average
+ @param[in] Test - Selects the Margins to average
+ @param[in] MLen - Determines the Y-Dimension lengths
+ @param[in] XDim - Determines the X-Dimension lengths
+ @param[in] XMin - Used to skip the first elements in the Margin when averaging.
+ @param[in] CScale - Used to place more weight on the center point.
+
+ @retval Nothing
+**/
+void
+RunningAverage2D (
+ IN OUT U16 Margins[2][24],
+ IN const U8 Test,
+ IN const U8 MLen,
+ IN const U8 XDim,
+ IN const U8 XMin,
+ IN const U8 CScale
+)
+
+{
+ U8 XMax;
+ U8 YMax;
+ U16 TMargins[24];
+ U8 i;
+ U8 x;
+ U8 y;
+ U8 xo;
+ U8 yo;
+ U8 XOff;
+ S8 YOff;
+
+ XMax = XDim - 1;
+ YMax = ((MLen + XDim - 1) / XDim) - 1; // Ceiling to int in case the matrix is not fully populated
+
+ for (i = 0; i < MLen; i++) {
+ x = (i % XDim);
+ y = (i / XDim);
+
+ //
+ // Center Point
+ //
+ TMargins[i] = Margins[Test][i] * (CScale - 1); // Also add margin at the centerpoint below
+ //
+ // Sum up surrounding results
+ //
+ for (xo = 0; xo < 3; xo++) {
+ XOff = x + xo - 1;
+ //
+ // Avoid negative numbers on XOff
+ //
+ if ((x == 0) && (xo == 0)) {
+ XOff = 0;
+ }
+ //
+ // (x < XMin) allows averaging across points (1;0) and (2;0)
+ //
+ if ((XOff < XMin) && (x < XMin)) {
+ XOff = x; // RxEq special case. Skip averaging on Col0/Col1
+ }
+
+ if (XOff > XMax) {
+ XOff = XMax;
+ }
+
+ for (yo = 0; yo < 3; yo++) {
+ YOff = y + yo - 1;
+ if (YOff < 0) {
+ YOff = 0;
+ }
+
+ if (YOff > YMax) {
+ YOff = YMax;
+ }
+ //
+ // Avoid averaging with unpopulated matrix elements when dealing with partially populated matrices
+ //
+ if ((XDim * YOff + XOff) > (MLen - 1)) {
+ YOff = YOff - 1;
+ }
+
+ TMargins[i] += Margins[Test][XDim * YOff + XOff];
+ }
+ }
+ }
+ //
+ // Copy TempMargins back over to real margins
+ //
+ for (i = 0; i < MLen; i++) {
+ Margins[Test][i] = TMargins[i] / (8 + CScale); // Added div to maintain margin scaling
+ }
+
+ return;
+}
+
+/**
+ Updates a given ch/Rank/byte combination with a new value for OptParam
+ OptParam can be: WrDS, RdOdt, TComp, SComp, RxEq, TxEq, RxBias or DimmOdt
+
+ # Margins: Upto 4 arrays that contain lenMargin elements
+ # Index to the array represents some arbitrary parameter value that we are optimizing
+ # Scale is 4 element array that scales the relative importance on Margins[0] vs. [1] ...
+ # ex: To make Margins[0] twice as important, set Scale = [1, 2, 2, 2]
+ # Since the search optimizes the lowest margin, increasing 1/2/3 makes 0 more important
+ # This function can be used to optimize only Margin[0] by setting Scale = [1, 0, 0, 0]
+ # EnSq = 1 uses a squared function to make the tradeoff between 0/1/2/3 steeper
+ # If AveN > 0, pre-processes the results with a N point running average filter
+ # IncEnds: By setting to 1, the running average will also include the end points
+ # ScaleM: Allows the middle point of the running average to be scaled up
+ #
+ # In addition to optimizing for margin, this function can also optimize for power
+ # PwrLimit is a 4 element array that sets level where pwr is more important than margin
+ # Find any points where ((Margin[0]>PwrLimit[0]) & (Margin[1]>PwrLimit[1]) & ... )
+ # If such points exists and PwrOptHigh = 1, returns point with the highest X value
+ # If such points exists and PwrOptHigh = 0, returns point with the lowest X value
+ # If you don't want to optimize for power, set PwrLimitA and PwrLimitB to large number
+ # Power Optimize still uses the running average filter
+ #
+ # To avoid overflow, this function will automatic scale margins to fit in uint32
+
+ @param[in] MrcData - The global MRC data structure.
+ @param[in,out] OptResByte - Structure containing the optimized results.
+ @param[in] inputMargins - Margins we are optimizing
+ @param[in] MarginsLength - The length of inputMargins
+ @param[in] LenMargin - The length of inputMargins we are optimizing (0 - LenMargin -1).
+ @param[in] Scale - Controls the scaling of the input margin: 1-1, 1-2, ... and so on.
+ @param[in] EnSq - Enables the square root term in the optimization functions.
+ @param[in] AveN - The number of points used for the averaging filter.
+ @param[in] IncEnds - Controls if the endpoints are to be included.
+ @param[in] ScaleM - Controls the scaling of the middle point in 1-D average filter.
+ @param[in] PwrLimit - The power limit above which we only trade-off for power and not margin.
+ @param[in] PwrOptHigh - Controls returning the highest or lowest optimization point.
+ @param[in] GuardBand - Signed offest to check if margin drop is acceptable. Save good guardband
+ in OptResByte.
+
+ @retval Nothing.
+**/
+void
+FindOptimalTradeOff (
+ IN MrcParameters *const MrcData,
+ IN OUT OptResultsPerByte *OptResByte,
+ IN void *inputMargins,
+ IN U8 MarginsLength,
+ IN S8 LenMargin,
+ IN U8 *Scale,
+ IN U8 EnSq,
+ IN U8 AveN,
+ IN U8 IncEnds,
+ IN U8 ScaleM,
+ IN U16 *PwrLimit,
+ IN U8 PwrOptHigh,
+ IN S8 GuardBand
+ )
+
+{
+ const MrcDebug *Debug;
+ U8 NumArr; // Arrays to keep track of results
+ U32 PostMar[5][MaxOptOff]; // Margin array after scaling & averaging
+ U32 MaxPost[5]; // Variables for Results
+ U32 SMaxPost[5];
+ U32 MinPost[5];
+ U32 Signal[5];
+ U32 Noise[5];
+ U32 Ratio[5];
+ U16 PwrLimitPost[5];
+ U32 ScaleMin;
+ U8 Nby2;
+ U8 EqOrder;
+ U8 xArr;
+ U8 yArr;
+ U8 x;
+ U8 i;
+ U8 Off;
+ S8 xEff;
+ S32 n;
+ U8 NumBits;
+ U32 localY;
+ U8 Shift;
+ U8 Adder;
+ U8 Start;
+ U8 Stop;
+ U64 Result;
+ U64 rlocal;
+ U64 MaxR;
+ U64 MinR;
+ U64 SNRTotal;
+ U64 MarginLimit;
+ U8 BestX;
+ U8 PowerX;
+ U8 FoundPwrOpt;
+ U8 NumCalcArr;
+ S8 StepSize;
+ U8 MarginDropPercent;
+ U32 MinPost1;
+ BOOL GoodPower;
+ U16 *Margins;
+ OptResultsPerByte *calcResults;
+
+ MarginDropPercent = 10; // 10% loss of margin is a bad guardband offset.
+ NumArr = 5;
+ Result = 0;
+ rlocal = 0;
+ MaxR = 0;
+ MinR = 0;
+ SNRTotal = 0;
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ MrcOemMemorySetDword (MaxPost, 1, sizeof (MaxPost) / sizeof (U32));
+ MrcOemMemorySetDword (SMaxPost, 1, sizeof (SMaxPost) / sizeof (U32));
+ MrcOemMemorySetDword (MinPost, 0xFFFFFFFF, sizeof (MinPost) / sizeof (U32));
+ MrcOemMemorySetDword (Signal, 0, sizeof (Signal) / sizeof (U32));
+ MrcOemMemorySetDword (Noise, 0, sizeof (Noise) / sizeof (U32));
+ MrcOemMemorySetDword (Ratio, 0, sizeof (Ratio) / sizeof (U32));
+ MrcOemMemorySetWord (PwrLimitPost, 0, sizeof (PwrLimitPost) / sizeof (U16));
+
+ //
+ // Initialize PostMar with zeroes
+ //
+ MrcOemMemorySet ((U8 *) PostMar, 0, sizeof (PostMar));
+
+ calcResults = OptResByte;
+ Margins = (U16 *) inputMargins;
+ MrcOemMemorySet ((U8 *) calcResults, 0, sizeof (OptResultsPerByte));
+ //
+ // Avoid division by zero.
+ //
+ if (AveN == 0) {
+ AveN = 1;
+ }
+ Nby2 = (AveN >> 1);
+ EqOrder = 0; // Is the optimization equation: X^1, X^2, X^5
+
+ //
+ // Process Raw Margins Results
+ //
+ for (xArr = 0; xArr < NumArr; xArr++) {
+ //
+ // Scale PwrLimit to match PostMar results
+ //
+ PwrLimitPost[xArr] = PwrLimit[xArr] * (AveN + ScaleM - 1) * Scale[xArr];
+
+ for (x = 0; x < LenMargin; x++) {
+ //
+ // Calculate the Running Average Filter
+ //
+ if (Scale[xArr] == 0) {
+ //
+ // not in the game
+ //
+ MinPost[xArr] = PostMar[xArr][x] = 1;
+ } else {
+ if (x == 0) {
+ //
+ // update EqOrder once for each xArr value with a non-zero scale factor e.g.:so for {RdT,RdV,0,0} it will be =2
+ //
+ EqOrder += 1;
+ }
+
+ for (Off = 0; Off < AveN; Off++) {
+ xEff = x + Off - Nby2;
+ if (xEff < 0) {
+ PostMar[xArr][x] += *(Margins + xArr * MarginsLength + 0); // Margins[xArr][0];
+ } else if (xEff >= LenMargin) {
+ PostMar[xArr][x] += *(Margins + xArr * MarginsLength + LenMargin - 1);
+ } else if (x == xEff) {
+ PostMar[xArr][x] += ScaleM * *(Margins + xArr * MarginsLength + xEff);
+ } else {
+ PostMar[xArr][x] += *(Margins + xArr * MarginsLength + xEff);
+ }
+ }
+
+ if (MaxPost[xArr] < PostMar[xArr][x]) {
+ MaxPost[xArr] = PostMar[xArr][x];
+ }
+
+ if (MinPost[xArr] > PostMar[xArr][x]) {
+ MinPost[xArr] = PostMar[xArr][x];
+ }
+ //
+ // signal delta pre/post average filter
+ //
+ n = (PostMar[xArr][x] -*(Margins + xArr * MarginsLength + x) * (AveN + ScaleM - 1));
+ Noise[xArr] += (n * n);
+ }
+
+ calcResults->Margins[xArr][x].EW = PostMar[xArr][x] / (AveN + ScaleM - 1);
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Margins[%d][%d] =%d\n",xArr,x,calcResults->Margins[xArr][x].EW);
+ //
+ }
+
+ if (Scale[xArr] == 0) {
+ continue;
+ }
+ //
+ // Calculate SNR for this margin result
+ // For stdev, need sqrt function. Use log domain to change exponential to mult
+ // Make both Signal and Noise a % of (Max+Min)/2
+ // *100 for signal&noise = not go to zero
+ //
+ Signal[xArr] = ((MaxPost[xArr] - MinPost[xArr]) * 200 * 100) / (MaxPost[xArr] + MinPost[xArr]);
+ Noise[xArr] /= LenMargin;
+ if (Noise[xArr] != 0) {
+ Noise[xArr] = Mrceexp (MrcNaturalLog (100 * Noise[xArr]) / 2); // result is 100x
+ }
+
+ Noise[xArr] = (Noise[xArr] * 2 * 100) / (MaxPost[xArr] + MinPost[xArr]);
+
+ if (Noise[xArr] == 0) {
+ Ratio[xArr] = (Signal[xArr] * 1000);
+ } else {
+ Ratio[xArr] = (Signal[xArr] * 1000) / Noise[xArr];
+ }
+
+ SMaxPost[xArr] = MaxPost[xArr];
+
+ //
+ // update global results
+ //
+ calcResults->Scale[xArr] = Scale[xArr];
+ calcResults->Signal[xArr] = Signal[xArr];
+ calcResults->Noise[xArr] = Noise[xArr];
+ calcResults->Ratio[xArr] = Ratio[xArr];
+ calcResults->MaxPost[xArr] = MaxPost[xArr] / (AveN + ScaleM - 1);
+ calcResults->MinPost[xArr] = MinPost[xArr] / (AveN + ScaleM - 1);
+ //
+ // 10x the tick diff.
+ //
+ calcResults->Ticks[xArr] = (U16) (MaxPost[xArr] - MinPost[xArr]) / (AveN + ScaleM - 1) / (Scale[xArr]);
+ }
+ //
+ // Sort Array
+ //
+ MrcBsort (SMaxPost, NumArr);
+
+ //
+ // Calculate Number of Bits Required to represent this number. Make sure to handle care of EnSq
+ //
+ NumBits = 0;
+
+ for (xArr = 0; xArr < NumArr; xArr++) {
+ if (xArr < (NumArr - 1)) {
+ //
+ // if EnSq we do Max^2 so the num get twice the bits...
+ //
+ localY = SMaxPost[xArr];
+ if (EnSq) {
+ localY = (localY * localY);
+ }
+
+ NumBits += MrcLog2 ((U32) localY);
+ } else {
+ NumBits += MrcLog2 ((U32) SMaxPost[xArr]);
+ }
+ }
+
+ NumBits += 11; // reserved another 10 bits for division in order to format for printing ; 3 for adding - up to 8
+ //
+ // EqOrder for square terms
+ //
+ if (EnSq) {
+ EqOrder = (EqOrder + (EqOrder - 1));
+ }
+ //
+ // Handle Potential Saturation
+ //
+ if (NumBits > 64) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Warning number of bits exceeds 64 bit : %d \n", NumBits);
+ //
+ // Shift all numbers to reduce final result to be less than 32 bits. Round Up
+ //
+ Shift = (NumBits - 64 + EqOrder - 1) / EqOrder;
+ //
+ // RoundUp Adder
+ //
+ Adder = (1 << (Shift - 1));
+ //
+ // Divide by (1<<Shift) and Round Up
+ //
+ for (xArr = 0; xArr < NumArr; xArr++) {
+ MaxPost[xArr] = (MaxPost[xArr] + Adder) >> Shift;
+ PwrLimitPost[xArr] = (PwrLimitPost[xArr] + Adder) >> Shift;
+ for (x = 0; x < LenMargin; x++) {
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "PostMar[%d][%d] before Shift : %d Adder : %d Shift : %d\n",xArr,x,PostMar[xArr][x],Shift,Adder);
+ //
+ PostMar[xArr][x] = (PostMar[xArr][x] + Adder) >> Shift;
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "after: %d\n",PostMar[xArr][x]);
+ //
+ }
+ }
+ }
+ //
+ // Calculate Square terms:
+ //
+ if (EnSq) {
+ for (xArr = 0; xArr < NumArr; xArr++) {
+ MaxPost[xArr] = MaxPost[xArr] * MaxPost[xArr];
+ }
+ }
+ //
+ // Set Limits for Search
+ //
+ Start = 0;
+ Stop = LenMargin;
+ if ((IncEnds == 0) && (LenMargin > AveN)) {
+ //
+ // most commonly
+ //
+ if (Nby2 > 0) {
+ Start++;
+ Stop--;
+ }
+ }
+ //
+ // Find the Best Point to Use
+ //
+ Result = 0;
+ MaxR = 0;
+ MinR = ~(0ULL);
+ BestX = 0;
+ PowerX = 0;
+ FoundPwrOpt = 0;
+
+ for (x = Start; x < Stop; x++) {
+ //
+ // Find Optimal Point from Margin Point of View
+ // Combine the points using the formula:
+ // Max0*Max1*Max2*Post3 + Max1*Max2*Max3*Post0 + Max2*Max3*Max0*Post1 +
+ // Max3*Max0*Max1*Post2 + Scale*min(Post0,Post1,Post2,Post3)^EqOrder
+ // Scale = 1 + (10*(SMaxPost[0]-SMaxPost[1]))/SMaxPost[NumArr-1]
+ //
+ Result = 0;
+ MinPost1 = 0xFFFFFFFF;
+ GoodPower = 1;
+ for (xArr = 0; xArr < NumArr; xArr++) {
+ if (Scale[xArr] == 0) {
+ continue; // not need to calculate those
+ }
+ //
+ // Find Min of all PostMar at offset x
+ // Does this point meet the min power Margin requirements?
+ //
+ if (Scale[xArr] > 0) {
+ if (MinPost1 > PostMar[xArr][x]) {
+ MinPost1 = PostMar[xArr][x];
+ }
+
+ if (PostMar[xArr][x] < PwrLimitPost[xArr]) {
+ GoodPower = 0; // not ! //@todo: delete this power limit for this routing
+ }
+ }
+ //
+ // Calculate this portion of result
+ //
+ rlocal = 1;
+ for (yArr = 0; yArr < NumArr; yArr++) {
+ if (Scale[yArr] == 0) {
+ continue; // not need to calculate those
+ }
+
+ if (xArr == yArr) {
+ continue;
+ } else {
+ rlocal = MrcOemMemoryMultiplyU64ByU32 (rlocal, MaxPost[yArr]);
+ }
+ }
+
+ Result += MrcOemMemoryMultiplyU64ByU32 (rlocal, PostMar[xArr][x]);
+ }
+
+ NumCalcArr = 0;
+ for (xArr = 0; xArr < NumArr; xArr++) {
+ //
+ // required for following step.
+ //
+ if (Scale[xArr] != 0) {
+ NumCalcArr++;
+ }
+ }
+ //
+ // Add in (MinPost ^ EqOrder)
+ // If NumCalcArr is 0, set it to 1 so that it still in the range of array size.
+ //
+ if (NumCalcArr == 0) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "Error: wrong input parameter caused NumCalcArr = 0 when calling FindOptimalTradeOff()\n"
+ );
+ NumCalcArr = 1;
+ }
+
+ ScaleMin = 1 + (10 * (SMaxPost[0] - SMaxPost[1])) / SMaxPost[NumCalcArr - 1];
+ if (ScaleMin > 5) {
+ ScaleMin = 5;
+ }
+
+ ScaleMin = 1;
+ rlocal = ScaleMin;
+ for (i = 0; i < EqOrder; i++) {
+ rlocal = MrcOemMemoryMultiplyU64ByU32 (rlocal, MinPost1);
+ }
+
+ Result += rlocal;
+
+ if (Result < MinR) {
+ MinR = Result;
+ }
+
+ if (Result > MaxR) {
+ MaxR = Result;
+ BestX = x; // save first highest function result offset
+ }
+
+ calcResults->Result[x] = Result;
+ //
+ // Find Optimal Point from Power Point of View
+ //
+ if (GoodPower) {
+ //
+ // are all the point meet margins requirements for all Tests ?
+ //
+ if (FoundPwrOpt == 0) {
+ FoundPwrOpt = 1; // power optimization is possible
+ PowerX = x; // first point passing to power limits
+ } else {
+ if ((PwrOptHigh == 1) && (x > PowerX)) {
+ PowerX = x; // we take the less power save point
+ }
+
+ if ((PwrOptHigh == 0) && (x < PowerX)) {
+ PowerX = x; // @todo: how can it be ? x is alwaye increasing
+ }
+ }
+ }
+ } // end shmoo offsets
+ if ((MaxR + MinR) == 0) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "warninig : MaxR+MinR are Zero !!!\n");
+ }
+ //
+ // Record for debug purposes.
+ // more simple: 1000*(max-min)/((max+min)/2)
+ //
+ SNRTotal = MrcOemMemoryDivideU64ByU64 (MrcOemMemoryMultiplyU64ByU32 ((MaxR - MinR), 2000), (MaxR + MinR + 1));
+ //
+ // Are we optimizing for Power or Margin?
+ //
+ if (FoundPwrOpt) {
+ if ((PwrOptHigh == 1) && (BestX < PowerX)) {
+ BestX = PowerX;
+ }
+ //
+ // if ((PwrOptHigh==0) && (BestX>PowerX)) BestX = PowerX;//give the more power saving offset that meet power limits
+ //
+ }
+
+ calcResults->Best = BestX;
+ calcResults->SNRTotal = SNRTotal;
+ calcResults->MaxR = MaxR;
+ calcResults->MinR = MinR;
+ //
+ // Apply a guard band to the best setting, clamped at edges of the search.
+ //
+ if (GuardBand != 0) {
+ //
+ // Determine step direction and limit to the search edge.
+ //
+ if (GuardBand < 0) {
+ StepSize = 1;
+ Off = ((BestX + GuardBand) < Start) ? Start : (BestX + GuardBand);
+ } else {
+ StepSize = -1;
+ Off = ((BestX + GuardBand) >= Stop) ? (Stop - 1) : (BestX + GuardBand);
+ }
+ //
+ // Check each test for margin drop of MarginDropPercent.
+ // If any test fails, we step towards the original selection.
+ //
+ MarginLimit = MrcOemMemoryMultiplyU64ByU32 (calcResults->Result[BestX], (100 - MarginDropPercent));
+ MarginLimit = MrcOemMemoryDivideU64ByU64 (MarginLimit, 100);
+ for(; (Off != BestX); Off += StepSize) {
+ if (calcResults->Result[Off] > MarginLimit) {
+ break;
+ }
+ }
+
+ calcResults->GuardBand = Off - (S8) BestX;
+ }
+
+ return;
+}
+
+/**
+ This function implements Turn Around Timing training.
+ Optimize TA ODT Delay and Duration
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - If it succeeds return mrcSuccess.
+**/
+MrcStatus
+MrcTurnAroundTiming (
+ IN MrcParameters *const MrcData
+ )
+{
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcInput *Inputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ MrcStatus Status;
+ U8 Channel;
+ U8 RankMaskCh;
+ U8 RankMask;
+ BOOL RunDD;
+ BOOL RunDR;
+ U8 ParamList[4]; // List of parameters to margin
+ U8 TestListRd[2];
+ U8 TestListWr[2];
+ U8 GuardBand;
+ U8 NomWR2RD;
+ U8 Update;
+ U8 LoopCount;
+ S8 ClkShifts[2];
+ U32 Offset;
+
+ Status = mrcSuccess;
+ RankMaskCh = 0;
+ Update = 1;
+ LoopCount = 12;
+ RunDD = FALSE;
+ RunDR = FALSE;
+ NomWR2RD = 0;
+ RankMask = 0xF;
+ ParamList[0] = RdV;
+ ParamList[1] = RdT;
+ ParamList[2] = WrV;
+ ParamList[3] = WrT;
+ TestListRd[0] = RdV;
+ TestListRd[1] = RdT;
+ TestListWr[0] = WrV;
+ TestListWr[1] = WrT;
+ ClkShifts[0] = -7;
+ ClkShifts[1] = 7;
+
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerOut = &Outputs->Controller[0];
+ Inputs = &MrcData->SysIn.Inputs;
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ if (!ChannelOut->ValidRankBitMask) {
+ continue;
+ }
+
+ RankMaskCh = ChannelOut->ValidRankBitMask;
+ RunDD = RunDD || (ChannelOut->DimmCount == 2);
+ RunDR = RunDR || ((RankMaskCh & 0xC) == 0xC) || ((RankMaskCh & 0x3) == 0x3);
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "Channel %d: RunDR = 0x%x, RunDD = 0x%x, RankMaskCh = 0x%x\n",
+ Channel,
+ RunDR,
+ RunDD,
+ RankMaskCh
+ );
+
+ //
+ // Use nominal values (previuosly programmed) +1 an -1 to test.
+ //
+ NomWR2RD = (U8)
+ (
+ (ChannelOut->MchbarBANKRANKB & MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRRD_dr_MSK) >>
+ MCHBAR_CH0_CR_TC_BANK_RANK_B_tWRRD_dr_OFF
+ );
+ }
+ //
+ // Program SAFE values for ODT and SAmp
+ //
+ GuardBand = 1;
+ UpdateSampOdtTiming (MrcData, GuardBand);
+
+ //
+ // Sweep ODT values but do not apply optimized value yet (Data Collection Only)
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n ##### Running mcodts\n");
+ Status = TrainDDROptParamCliff (
+ MrcData,
+ mcodts,
+ TestListRd,
+ sizeof (TestListRd),
+ 0,
+ 2 + GuardBand,
+ LoopCount,
+ Update,
+ Outputs->MarginResult,
+ ClkShifts,
+ sizeof (ClkShifts),
+ 0,
+ RankMask,
+ GuardBand
+ );
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n ##### Running mcodtd\n");
+ Status = TrainDDROptParamCliff (
+ MrcData,
+ mcodtd,
+ TestListRd,
+ sizeof (TestListRd),
+ (-1 - GuardBand),
+ 0,
+ LoopCount,
+ Update,
+ Outputs->MarginResult,
+ ClkShifts,
+ sizeof (ClkShifts),
+ 0,
+ RankMask,
+ GuardBand
+ );
+
+ //
+ // Restore SAFE values when ONLY collecting data
+ //
+ if (Update == 0) {
+ UpdateSampOdtTiming (MrcData, GuardBand);
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ if (!ChannelOut->ValidRankBitMask) {
+ continue;
+ }
+ Offset = MCHBAR_CH0_CR_TC_BANK_RANK_D_REG +
+ ((MCHBAR_CH1_CR_TC_BANK_RANK_D_REG - MCHBAR_CH0_CR_TC_BANK_RANK_D_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, ChannelOut->MchbarBANKRANKD);
+ }
+ }
+ //
+ // Sweep DD Timing but do not apply optimized value yet (Data Collection Only)
+ //
+ if (RunDD) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n ##### Running DDRD2RD\n");
+ Status = TrainDDROptParamCliff (
+ MrcData,
+ ddrd2rd,
+ TestListRd,
+ sizeof (TestListRd),
+ 6,
+ 7,
+ LoopCount,
+ Update,
+ Outputs->MarginResult,
+ ClkShifts,
+ sizeof (ClkShifts),
+ 0,
+ RankMask,
+ 0
+ );
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n ##### Running DDWR2WR\n");
+ Status = TrainDDROptParamCliff (
+ MrcData,
+ ddwr2wr,
+ TestListWr,
+ sizeof (TestListWr),
+ 7,
+ 8,
+ LoopCount,
+ Update,
+ Outputs->MarginResult,
+ ClkShifts,
+ sizeof (ClkShifts),
+ 0,
+ RankMask,
+ 0
+ );
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n ##### Running DDWR2RD\n");
+ Status = TrainDDROptParamCliff (
+ MrcData,
+ ddwr2rd,
+ ParamList,
+ sizeof (ParamList),
+ NomWR2RD - 1,
+ NomWR2RD + 1,
+ LoopCount,
+ Update,
+ Outputs->MarginResult,
+ ClkShifts,
+ sizeof (ClkShifts),
+ 0,
+ RankMask,
+ 0
+ );
+ }
+ //
+ // Sweep DR Timing but do not apply optimized value yet (Data Collection Only)
+ //
+ if (RunDR) {
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n ##### Running DRRD2RD\n");
+ Status = TrainDDROptParamCliff (
+ MrcData,
+ drrd2rd,
+ TestListRd,
+ sizeof (TestListRd),
+ 6,
+ 7,
+ LoopCount,
+ Update,
+ Outputs->MarginResult,
+ ClkShifts,
+ sizeof (ClkShifts),
+ 0,
+ RankMask,
+ 0
+ );
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n ##### Running DRWR2WR\n");
+ Status = TrainDDROptParamCliff (
+ MrcData,
+ drwr2wr,
+ TestListWr,
+ sizeof (TestListWr),
+ 7,
+ 8,
+ LoopCount,
+ Update,
+ Outputs->MarginResult,
+ ClkShifts,
+ sizeof (ClkShifts),
+ 0,
+ RankMask,
+ 0
+ );
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n ##### Running DRWR2RD\n");
+ Status = TrainDDROptParamCliff (
+ MrcData,
+ drwr2rd,
+ ParamList,
+ sizeof (ParamList),
+ NomWR2RD - 1,
+ NomWR2RD + 1,
+ LoopCount,
+ Update,
+ Outputs->MarginResult,
+ ClkShifts,
+ sizeof (ClkShifts),
+ 0,
+ RankMask,
+ 0
+ );
+ }
+ //
+ // Restore SAFE values when ONLY collecting data
+ //
+ if (Update == 0) {
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ if (ChannelOut->ValidRankBitMask) {
+ Offset = MCHBAR_CH0_CR_TC_BANK_RANK_A_REG +
+ ((MCHBAR_CH1_CR_TC_BANK_RANK_A_REG - MCHBAR_CH0_CR_TC_BANK_RANK_A_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, ChannelOut->MchbarBANKRANKA);
+
+ Offset = MCHBAR_CH0_CR_TC_BANK_RANK_B_REG +
+ ((MCHBAR_CH1_CR_TC_BANK_RANK_B_REG - MCHBAR_CH0_CR_TC_BANK_RANK_B_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, ChannelOut->MchbarBANKRANKB);
+
+ }
+ }
+ }
+
+ return Status;
+}
+
+/**
+ General purpose function to optimize an abritray value, OptParam (see list above)
+ OptParam is generally some timing number that impacts performance or power
+ Expects that as OptParam gets smaller*, margins are flat until we hit a cliff
+ This procedure defines a cliff as a reducution of 4 ticks in eye height/width
+ * In the case of mcodts, higher values are actually worst
+ To stress out the timing, xxDDR_CLK is shifted by +/- 15 PI ticks
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] OptParam - Supports Turnaround Timings and ODT Start / Duration
+ @param[in] TestList - List of margin param to check to make sure timing are okay.
+ @param[in] NumTests - The size of TestList
+ @param[in] Start - Start point for this turn around time setting.
+ @param[in] Stop - Stop point for this turnaround time setting.
+ Note that the Start/Stop values are the real values, not the encoded value
+ @param[in] LoopCount - Length of a given test
+ @param[in] Update - Update the CRs and host structure with ideal values
+ @param[in] ClkShifts - Array of Pi clocks to be shifted
+ @param[in] MarginByte - Byte level margins
+ @param[in] NumR2RPhases - Number of PI clock phases
+ @param[in] rank - rank to work on
+ @param[in] RankMask - RankMask to be optimized
+ @param[in] GuardBand - GuardBand to be added to last pass value (to be a bit conservative).
+
+ @retval MrcStatus - If it succeeds return mrcSuccess
+**/
+MrcStatus
+TrainDDROptParamCliff (
+ IN MrcParameters *const MrcData,
+ IN U8 OptParam,
+ IN U8 TestList[],
+ IN U8 NumTests,
+ IN S8 Start,
+ IN S8 Stop,
+ IN U8 LoopCount,
+ IN U8 Update,
+ IN U32 MarginByte[MAX_RESULT_TYPE][MAX_RANK_IN_CHANNEL][MAX_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_EDGES],
+ IN S8 *ClkShifts,
+ IN U8 NumR2RPhases,
+ IN U8 rank,
+ IN U8 RankMask,
+ IN U8 GuardBand
+ )
+{
+ const MRC_REUTAddress REUTAddressConst = {
+ {0, 0, 0, 0}, // Start
+ {7, 0, 0, 1023}, // Stop
+ {0, 0, 0, 0}, // Order
+ {0, 0, 0, 0}, // IncRate
+ {1, 0, 0, 1}}; // IncValue
+ const U8 OptParamDDType[13] = {1, 2, 1, 2, 1, 2, 1, 2, 3, 3, 3, 3, 0}; // Does this test run dr, dd or both?
+ const U8 RankMapping[16] = {15, 15, 15, 4, 15, 3, 15, 1, 15, 15, 15, 15, 5, 2, 15, 0};
+ // Order of rank turnarounds for dr & dd.
+ const U32 RankOrder[2][6] = {{0x32320101, 0x20101010, 0x23232320, 0x20, 0x10, 0x23}, // RankOrder[0]: drsd - same DIMM
+ {0x21303120, 0x2120, 0x3020, 0x20, 0, 0}}; // RankOrder[1]: drdd - diff DIMM
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ MrcStatus Status;
+ MRC_REUTAddress REUTAddress;
+ MRC_WDBPattern WDBPattern; // For 8 bit VA, this walks through each WDB pointer ~ 2X
+ BOOL IsDual;
+ BOOL ODT;
+ BOOL PerByte;
+ BOOL NotRankTraining;
+ BOOL Lpddr;
+ BOOL FindFirstPass;
+ U32 BERStats[4]; // Track BER results
+ U32 RankList;
+ U32 Offset;
+ U32 CRValue;
+ U16 Margins[4][2][2][MAX_CHANNEL][MAX_SDRAM_IN_DIMM]; // Tests X DR/DD x ClkPhases x Ch X Byte
+ U16 NumCL; // Number of cachelines per SubSeq
+ U16 m;
+ U16 SeqLC;
+ U16 MinMarginLimit;
+ U8 ShiftValue;
+ U8 Channel;
+ U8 ChannelMask;
+ U8 Byte;
+ U16 ByteMask;
+ U8 Rank;
+ U8 ChBitMask;
+ U8 RankCount;
+ U8 ChBitMaskdd;
+ U8 RankMaskCh;
+ U8 drddPresent[2]; // [0]: ChBitMask for dr, [1]: ChBitMask for dd
+ U8 CmdPat;
+ U8 BMap[9]; // Needed for GetBERMarginByte function
+ U8 MarginLimit; // Need to change it to 20%of eye heigth
+ U8 ResetDDR;
+ U8 SelfRefresh;
+ U8 RankInc; // Increment every cacheline (HW adds +1 automatically)
+ U16 ByteFailMask[MAX_CHANNEL]; // Per ch mask indicating which bytes have failed
+ U8 offs[MAX_CHANNEL];
+ U8 Param;
+ U8 iparam;
+ U16 ByteDone;
+ U8 dd;
+ U8 test0;
+ U8 v0;
+ U8 Mode;
+ U8 RankOrderIndex;
+ U8 UpdateHostMargin;
+ U8 Done;
+ U8 MaxMargin;
+ U8 ResultType;
+ U8 WDBIncRate; // Number of cachelines between incrementing WDB.
+ U8 LoopEnd;
+ S8 Inc;
+ S8 Off;
+ S8 Index;
+ S8 LastPass[MAX_CHANNEL][MAX_SDRAM_IN_DIMM]; // Lass Pass Value for off
+ S8 Begin;
+ S8 End;
+ S8 ChLastPass;
+ S8 ActualGuardBand;
+#ifdef MRC_DEBUG_PRINT
+ S8 ChLastPass1[MAX_CHANNEL];
+#endif // MRC_DEBUG_PRINT
+ MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_STRUCT ReutChSeqRankL2PMapping;
+
+ Status = mrcSuccess;
+ Done = 0;
+ Rank = 0;
+ drddPresent[0] = 0;
+ drddPresent[1] = 0;
+ MarginLimit = (rtl == OptParam) ? 10 : 20; // Drop of X% in margin means failure
+ ResetDDR = 1;
+ SelfRefresh = 0;
+ WDBIncRate = 13;
+ NumCL = 128;
+ //
+ // For {8,5,4,3,2} ranks, this covers each rank ~ {3,5,6,8,12}X
+ // For 8 bit VA, this walks through each WDB pointer ~ 2X
+ //
+ WDBPattern.IncRate = 0;
+ WDBPattern.Start = 0;
+ WDBPattern.Stop = 7;
+ WDBPattern.DQPat = 0;
+ MrcOemMemorySetWord (ByteFailMask, 0, sizeof (ByteFailMask) / sizeof(ByteFailMask[0]));
+ MrcOemMemorySet (offs, 0, sizeof (offs));
+ MrcOemMemorySet ((U8 *) BERStats, 0, sizeof (BERStats));
+ MrcOemMemoryCpy ((U8 *) &REUTAddress, (U8 *) &REUTAddressConst, sizeof (REUTAddress));
+ for (Byte = 0; Byte < (sizeof (BMap) / sizeof (BMap[0])); Byte++) {
+ BMap[Byte] = Byte;
+ }
+
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerOut = &Outputs->Controller[0];
+
+ Lpddr = (Outputs->DdrType == MRC_DDR_TYPE_LPDDR3);
+
+ NotRankTraining = (OptParam == rtl);
+ FindFirstPass = (OptParam == rtl); // FindFirstPass logic only works for RTL!
+ ODT = (OptParam == rdodtd) || (OptParam == wrodtd) || (OptParam == mcodtd) || (OptParam == mcodts);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "\nNotRankTraining = %u, ODT = %d\n", NotRankTraining, ODT);
+
+ //
+ // Decide which channels need to be run and program NumCachelines
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ if (ChannelOut->ValidRankBitMask) {
+ ChannelMask = MRC_BIT0 << Channel;
+ RankMaskCh = ChannelOut->ValidRankBitMask;
+ IsDual = ((RankMaskCh & 0xC) == 0xC) || ((RankMaskCh & 0x3) == 0x3);
+
+ //
+ // Continue if no ranks in this channel
+ //
+ if ((RankMaskCh & RankMask) == 0) {
+ continue;
+ }
+
+ if ((OptParamDDType[OptParam] & 0x2) && (ChannelOut->DimmCount == 2)) {
+ drddPresent[1] |= ChannelMask; // dd parameter and channel has 2 DIMMs
+ }
+
+ if (((OptParamDDType[OptParam] & 0x1) && IsDual) || NotRankTraining) {
+ drddPresent[0] |= ChannelMask; // dr parameter and channel has a dual rank
+ }
+
+ if (ODT && ((drddPresent[0] & (1 << Channel)) == 0)) {
+ //
+ // ODT matters when Single rank
+ // dr parameter and channel has a dual rank
+ //
+ drddPresent[0] |= ChannelMask;
+ }
+ }
+ }
+
+ ChBitMask = drddPresent[1] | drddPresent[0]; // Chanel is present if it has either a dr or dd
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "drddPresent[0] = 0x%x, drddPresent[1] = 0x%x, ChBitMask = 0x%x\n",
+ drddPresent[0],
+ drddPresent[1],
+ ChBitMask
+ );
+
+ //
+ // There is nothing to optimize for this parameter
+ //
+ if ((ChBitMask == 0) || (Stop <= Start)) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "ChBitMask = %d, Start = 0x%x, Stop = 0x%x\n", ChBitMask, Start, Stop);
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "No need to optimized TA, OptParam = %d\n", OptParam);
+ return mrcFail;
+ }
+ //
+ // Setup the REUT Test
+ //
+ SeqLC = LoopCount;
+ RankInc = 0;
+ Outputs->DQPat = TurnAround;
+ if ((OptParam == ddwr2rd) || (OptParam == drwr2rd)) {
+ CmdPat = PatWrRdTA;
+ Outputs->DQPat = TurnAroundWR;
+ RankInc = 1;
+ } else if (ODT) {
+ CmdPat = PatODTTA;
+ Outputs->DQPat = TurnAroundODT;
+ RankInc = 1;
+ } else if (OptParam == rtl) {
+ CmdPat = PatWrRd;
+ //
+ // Less optimistic values since we are updating values and RMT fails
+ //
+ WDBIncRate = 16;
+ NumCL = 4;
+ } else {
+ CmdPat = PatWrRd;
+ }
+
+ WDBPattern.DQPat = Outputs->DQPat;
+ WDBPattern.IncRate = WDBIncRate;
+ REUTAddress.IncRate[0] = RankInc;
+ REUTAddress.IncRate[3] = RankInc;
+
+ //
+ // SOE=0, EnCADB=0, EnCKE=0, SubSeqWait=0
+ //
+ SetupIOTest (MrcData, ChBitMask, CmdPat, NumCL, (U8) SeqLC, &REUTAddress, NSOE, &WDBPattern, 0, 0, 0);
+
+ Outputs->DQPatLC = MRC_BIT0 << (LoopCount - MrcLog2 ((U32) (NumCL - 1)));
+ if (Outputs->DQPatLC < 1) {
+ Outputs->DQPatLC = 1;
+ }
+ //
+ // Optimize parameter per byte. Everything else is per channel
+ //
+ PerByte = (OptParam == mcodts) || (OptParam == mcodtd);
+
+ //
+ // Keep track of which bytes have failed and are we done yet
+ //
+ ByteDone = (1 << Outputs->SdramCount) - 1;
+
+ //
+ // ###########################################################
+ // #### Loop through OptParam X DD X ClkPhases X Params and measure margin #####
+ // ###########################################################
+ //
+ if (OptParam == mcodts) {
+ //
+ // In the case of mcodts, higher values are actually worst.
+ //
+ Begin = Start;
+ End = Stop;
+ Inc = 1;
+ } else {
+ Begin = Stop;
+ End = Start;
+ Inc = -1;
+ }
+
+ ActualGuardBand = (Inc * GuardBand);
+
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "Start = %d, Stop = %d, Begin = %d, End = %d, Inc = %d\n",
+ Start,
+ Stop,
+ Begin,
+ End,
+ Inc
+ );
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, (OptParam == rtl) ? "Rank = %d\n" : "", rank);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel 0\t\t\t\t\t\t\t\t1\nByte\t");
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE, (
+ Outputs->SdramCount == MAX_SDRAM_IN_DIMM
+ ) ? "0\t1\t2\t3\t4\t\t5\t6\t7\t8\t0\t1\t2\t3\t4\t5\t6\t7\t8\n" :
+ "0\t1\t2\t3\t4\t5\t6\t7\t0\t1\t2\t3\t4\t5\t6\t7\n"
+ );
+
+ //
+ // Init Variables
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ LastPass[Channel][Byte] = Begin - ActualGuardBand;
+ for (iparam = 0; iparam < NumTests; iparam++) {
+ for (dd = 0; dd < 2; dd++) {
+ for (test0 = 0; test0 < NumR2RPhases; test0++) {
+ Margins[iparam][dd][test0][Channel][Byte] = 1280;
+ }
+ }
+ }
+ }
+ }
+ }
+ //
+ // Walk through different OptParam values
+ //
+ for (Off = (S8) Begin; Off != (S8) (End + Inc); Off += Inc) {
+ if (Done) {
+ break;
+ }
+ Index = (Off - Begin) * Inc; // Index = 0, 1, 2..
+ //
+ // Inc can only take a value of +/- 1.
+ //
+ if ((Index == 1) && (TRUE == FindFirstPass)) {
+ Inc *= -1;
+ Off = End;
+ End = Begin - Inc; // One Inc less since we have already done Index 0.
+ Begin = Off - Inc; // One Inc less to get us starting at Index 1
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "Find First Pass - Walking backwards.\n Off = %d, Begin = %d, End = %d, Inc = %d, Index = %d\n",
+ Off,
+ Begin,
+ End,
+ Inc,
+ (Off - Begin) * Inc
+ );
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Param^ Offset-> %d\n Actl\t", Off);
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ RankMaskCh = ChannelOut->ValidRankBitMask & RankMask;
+ //
+ // if nothing for this channel OR No Ranks in this channel
+ //
+ if (!((MRC_BIT0 << Channel) & ChBitMask) || (RankMaskCh == 0)) {
+#ifdef MRC_DEBUG_PRINT
+ if (Channel == 0) {
+ if (Outputs->SdramCount == (MAX_SDRAM_IN_DIMM - 1)) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\t\t\t\t\t\t\t\t");
+ } else {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\t\t\t\t\t\t\t\t\t");
+ }
+ }
+#endif // MRC_DEBUG_PRINT
+ continue;
+ }
+ //
+ // For debug purposes program Row start stop to OptParam + Offset value
+ // OptParam in upper BYTE
+ //
+ Offset = 4 + MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_0_REG +
+ (
+ (MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_1_REG - MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_START_MCMAIN_0_REG) *
+ Channel
+ );
+ CRValue = MrcReadCR (MrcData, Offset);
+ //MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "upper SEQ_BASE_ADDR_START BEFORE = 0x%x ", CRValue);
+ CRValue = MrcBitSwap (CRValue, OptParam, 0, 8);
+ //MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "After = 0x%x\n", CRValue);
+ MrcWriteCR (MrcData, Offset, CRValue);
+ //
+ // Offset in Lower BYTE
+ //
+ Offset -= 4;
+ CRValue = MrcReadCR (MrcData, Offset);
+ //MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "lower SEQ_BASE_ADDR_START BEFORE = 0x%x ", CRValue);
+ CRValue = MrcBitSwap (CRValue, Off, 24, 8);
+ //MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "After = 0x%x\n", CRValue);
+ MrcWriteCR (MrcData, Offset, CRValue);
+
+ //
+ // OptParam in upper BYTE
+ //
+ Offset = 4 + MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_REG +
+ (
+ (MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_1_REG - MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_REG) *
+ Channel
+ );
+ CRValue = MrcReadCR (MrcData, Offset);
+ //MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "upper SEQ_BASE_ADDR_WRAP BEFORE = 0x%x ", CRValue);
+ CRValue = MrcBitSwap (CRValue, OptParam, 0, 8);
+ //MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "After = 0x%x\n", CRValue);
+ MrcWriteCR (MrcData, Offset, CRValue);
+ //
+ // Offset in Lower BYTE
+ //
+ Offset -= 4;
+ CRValue = MrcReadCR (MrcData, Offset);
+ //MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "lower SEQ_BASE_ADDR_WRAP BEFORE = 0x%x ", CRValue);
+ CRValue = MrcBitSwap (CRValue, Off, 24, 8);
+ //MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "After = 0x%x\n", CRValue);
+ MrcWriteCR (MrcData, Offset, CRValue);
+
+ //
+ // No need to update MrcData host during this step even if not collecting data
+ //
+ LoopEnd = (U8) ((PerByte) ? Outputs->SdramCount : 1);
+ for (Byte = 0; Byte < LoopEnd; Byte++) {
+ UpdateTAParamOffset (MrcData, Channel, Byte, OptParam, Off, 0, 0, RankMaskCh);
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+
+ //
+ // Test both: different dr and dd as required
+ //
+ for (dd = 0; dd < 2; dd++) {
+ if (Done) {
+ break;
+ }
+ //
+ // Check if this test type should be run
+ //
+ ChBitMaskdd = drddPresent[dd];
+ if (ChBitMaskdd == 0) {
+ continue;
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, (dd == 0) ? "Dual Rank\n" : "Dual Dimm\n");
+ //
+ // Select Ranks in the correct order based on the test type
+ // Need to re-order the ranks based on the value of ddw2r
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!(ChBitMaskdd & (MRC_BIT0 << Channel))) {
+ continue;
+ }
+
+ ChannelOut = &ControllerOut->Channel[Channel];
+ RankMaskCh = ChannelOut->ValidRankBitMask & RankMask;
+ if (RankMaskCh == 0) {
+ continue; // No Ranks in this channel
+ }
+ //
+ // Initialize variables and read out ordered rank list
+ //
+ ReutChSeqRankL2PMapping.Data = 0;
+ RankCount = 0;
+
+ if (NotRankTraining) {
+ RankList = 0x00003210;
+ } else {
+ RankOrderIndex = RankMapping[RankMaskCh];
+ if (RankOrderIndex == 15) {
+ RankList = 0x00003210;
+ } else {
+ RankList = RankOrder[dd][RankOrderIndex];
+ }
+ }
+
+ while (RankList > 0) {
+ Rank = (RankList & 0xF); // Nibble by Nibble
+ RankList = (RankList >> 4);
+ if (!(RankMaskCh & (MRC_BIT0 << Rank))) {
+ continue;
+ }
+
+ ShiftValue = RankCount *
+ MRC_BIT0 <<
+ MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_Logical_to_Physical_Rank0_Mapping_WID;
+ ReutChSeqRankL2PMapping.Data |= (Rank << ShiftValue);
+ RankCount++;
+ }
+
+ Offset = MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_REG +
+ (
+ (
+ MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_1_REG -
+ MCDFXS_CR_REUT_CH_SEQ_RANK_LOGICAL_TO_PHYSICAL_MAPPING_MCMAIN_0_REG
+ ) * Channel
+ );
+ MrcWriteCR (MrcData, Offset, ReutChSeqRankL2PMapping.Data);
+ Offset = MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_REG +
+ (
+ (MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_1_REG - MCDFXS_CR_REUT_CH_SEQ_BASE_ADDR_WRAP_MCMAIN_0_REG) *
+ Channel
+ ) + 7;
+ MrcWriteCR8 (MrcData, Offset, RankCount - 1);
+ }
+ //
+ // ###################################################
+ // ### Walk through different sets of rank2rank timings ###
+ // ###################################################
+ //
+ for (test0 = 0; test0 < NumR2RPhases; test0++) {
+ if (Done) {
+ break;
+ }
+
+ v0 = ClkShifts[test0];
+
+ //
+ // Program rank offsets differently for dd vs. dr
+ //
+ if (NotRankTraining) {
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!(ChBitMaskdd & (MRC_BIT0 << Channel))) {
+ offs[Channel] = 0;
+ } else {
+ //
+ // Shift all signals in the channel(Clk/Ctl/Cmd/Dq) by v0
+ //
+ offs[Channel] = v0;
+ }
+ }
+ //
+ // UpdateHost=0, SkipTx=0
+ //
+ ShiftCh2Ch (MrcData, RankMask, offs, ResetDDR, SelfRefresh, 0, 0);
+ } else if (dd == 1) {
+ //
+ // For DD
+ // Shift Clk/DQ on one DIMM by v0 and Clk/DQ on other DIMM by -v0
+ // @todo: CTL picode should be optionally shifted to improve margins
+ //
+ SetCmdMargin (MrcData, ChBitMaskdd, 0x3, WrT, v0, 0, ResetDDR, SelfRefresh);
+ SetCmdMargin (MrcData, ChBitMaskdd, 0xC, WrT, -v0, 0, ResetDDR, SelfRefresh);
+ } else {
+ //
+ // For DR
+ // Shift Clk/DQ on front side by v0 and Clk/DQ on backside by -v0
+ // @todo: CTL picode should be optionally shifted to improve margins
+ //
+ SetCmdMargin (MrcData, ChBitMaskdd, 0x5, WrT, v0, 0, ResetDDR, SelfRefresh);
+ SetCmdMargin (MrcData, ChBitMaskdd, 0xA, WrT, -v0, 0, ResetDDR, SelfRefresh);
+ }
+ //
+ // Test different margin param
+ //
+ for (iparam = 0; iparam < NumTests; iparam++) {
+ Param = TestList[iparam];
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s ", MarginTypesString[Param]);
+ if (Param == 0) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_WARNING, " WARNING! UNNECESSARY LOOPS. Param = %d \n", Param);
+ return mrcFail;
+ }
+
+ ResultType = GetMarginResultType (Param);
+
+ //
+ // Get the width/height limit for the parameter
+ //
+ MinMarginLimit = UpmPwrLimitValue (MrcData, Param, UpmLimit);
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d ", MinMarginLimit);
+ // Calculate MaxMargin and Starting Point for margin search
+ //
+ MaxMargin = MAX_POSSIBLE_TIME;
+ if ((Param == RdV) ||
+ (Param == RdFan2) ||
+ (Param == RdFan3) ||
+ (Param == WrV) ||
+ (Param == WrFan2) ||
+ (Param == WrFan3)
+ ) {
+ MaxMargin = MAX_POSSIBLE_VREF;
+ }
+ //
+ // Are we done yet or should we keep testing?
+ //
+ Done = 1;
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!(ChBitMaskdd & (MRC_BIT0 << Channel))) {
+ continue;
+ }
+
+ ChannelOut = &ControllerOut->Channel[Channel];
+ RankMaskCh = ChannelOut->ValidRankBitMask & RankMask;
+ if (RankMaskCh == 0) {
+ continue; // No Ranks in this channel
+ }
+
+ //
+ // When FindFirstPass is used, all Bytes have to have passed before we stop.
+ // We uses ByteFailMask[] to track the passing bytes in this case.
+ //
+ if (PerByte || FindFirstPass) {
+ if (ByteFailMask[Channel] != ByteDone) {
+ Done = 0;
+ }
+ } else {
+ if (ByteFailMask[Channel] == 0) {
+ Done = 0;
+ }
+ }
+ }
+
+ if (Done) {
+ break;
+ }
+
+ Status = GetMarginByte (MrcData, Outputs->MarginResult, Param, 0, 0xF);
+ if (Status != mrcSuccess) {
+ return Status;
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "% 3d\t", (S8) v0);
+
+ Mode = 0;
+ Status = MrcGetBERMarginByte (
+ MrcData,
+ Outputs->MarginResult,
+ ChBitMaskdd,
+ rank,
+ 0xFF,
+ Param,
+ Mode,
+ BMap,
+ 1,
+ MaxMargin,
+ 0,
+ BERStats
+ );
+ if (Status != mrcSuccess) {
+ return Status;
+ }
+ //
+ // Record Results
+ //
+ UpdateHostMargin = 1;
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ RankMaskCh = ChannelOut->ValidRankBitMask & RankMask;
+ //
+ // if nothing for this channel OR No Ranks in this channel
+ //
+ if (!((MRC_BIT0 << Channel) & ChBitMaskdd) || (RankMaskCh == 0)) {
+#ifdef MRC_DEBUG_PRINT
+ if (Channel == 0) {
+ if (Outputs->SdramCount == (MAX_SDRAM_IN_DIMM - 1)) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\t\t\t\t\t\t\t\t");
+ } else {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\t\t\t\t\t\t\t\t\t");
+ }
+ }
+#endif // MRC_DEBUG_PRINT
+ continue;
+ }
+
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ //
+ // For this optimization, it makes more sense to look at the full sum
+ //
+ ByteMask = MRC_BIT0 << Byte;
+ m = EffectiveMargin (
+ (U16) MarginByte[ResultType][rank][Channel][Byte][0],
+ (U16) MarginByte[ResultType][rank][Channel][Byte][1]
+ );
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d", m);
+
+ //
+ // If previously failed, this is also a failure unless we are looking for
+ // the first passing offset.
+ //
+ if ((ByteFailMask[Channel] & ByteMask) && (FALSE == FindFirstPass)) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "#\t");
+ continue;
+ }
+ //
+ // Byte fails if margin is below MinMarginLimit at any time
+ //
+ if (m < MinMarginLimit) {
+ //
+ // If we are looking for pass, continue and do not update LastPass
+ //
+ if (TRUE == FindFirstPass) {
+ if (Index == 0) {
+ //
+ // When training from the most aggressive setting to the conservative setting,
+ // if we fail the first setting we stop.
+ //
+ ByteFailMask[Channel] = ByteDone;
+ }
+ UpdateHostMargin = 0;
+ } else {
+ ByteFailMask[Channel] |= ByteMask;
+ LastPass[Channel][Byte] = Off - Inc - ActualGuardBand;
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "#\t");
+ continue;
+ }
+
+ if (Index == 0) {
+ //
+ // Get the smallest marging at Index 0
+ //
+ if (Margins[iparam][dd][test0][Channel][Byte] > m) {
+ Margins[iparam][dd][test0][Channel][Byte] = m;
+ }
+ } else {
+ //
+ // Check if we dropped more than the percent allowed
+ //
+ if (m < ((Margins[iparam][dd][test0][Channel][Byte] * (100 - MarginLimit)) / 100)) {
+ if (FALSE == FindFirstPass) {
+ ByteFailMask[Channel] |= ByteMask;
+ LastPass[Channel][Byte] = Off - Inc - ActualGuardBand;
+ }
+ UpdateHostMargin = 0;
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "#-%d\t",
+ (ABS (m - Margins[iparam][dd][test0][Channel][Byte]) * 100) / Margins[iparam][dd][test0][Channel][Byte]
+ );
+ continue;
+ } else {
+ if (TRUE == FindFirstPass) {
+ if ((ByteFailMask[Channel] & ByteMask) != ByteMask) {
+ LastPass[Channel][Byte] = Off - ActualGuardBand;
+ ByteFailMask[Channel] |= ByteMask;
+ }
+ } else {
+ LastPass[Channel][Byte] = Off - ActualGuardBand;
+ }
+ }
+ }
+
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ ".%c%d\t",
+ (m > Margins[iparam][dd][test0][Channel][Byte]) ? '+' : '-',
+ (ABS(m - Margins[iparam][dd][test0][Channel][Byte]) * 100) / Margins[iparam][dd][test0][Channel][Byte]
+ );
+ }
+ }
+
+ if (UpdateHostMargin) {
+ Status = ScaleMarginByte (MrcData, Outputs->MarginResult, Param, rank);
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+
+ //
+ // Clean up
+ //
+ if (NotRankTraining) {
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ offs[Channel] = 0;
+ }
+ //
+ // UpdateHost=0, SkipTx=0
+ //
+ ShiftCh2Ch (MrcData, RankMask, offs, ResetDDR, SelfRefresh, 0, 0);
+ } else {
+ SetCmdMargin (MrcData, ChBitMaskdd, RankMask, WrT, 0, 0, ResetDDR, SelfRefresh);
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+ }
+ }
+
+ //
+ // If we are sweeping agressive settings to conservative settings, we
+ // need to restore original Inc, Begin, and End values to select the
+ // proper offset if bytes have varying offsets values for a parameter
+ // that is NOT specified per Byte.
+ //
+ if (TRUE == FindFirstPass) {
+ Off = End; // Temp storage for swap
+ End = Begin + Inc;
+ Begin = Off + Inc;
+ Inc *= -1;
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "Find First Pass - Reverting Inc, Begin, and End\n Begin = %d, End = %d, Inc = %d,\n",
+ Begin,
+ End,
+ Inc
+ );
+ }
+
+#ifdef MRC_DEBUG_PRINT
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Optimal offset per Byte\n\t");
+ //
+ // Print OPTIMAL value
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ RankMaskCh = ChannelOut->ValidRankBitMask & RankMask;
+ ChLastPass1[Channel] = End;
+ //
+ // if nothing for this channel OR No Ranks in this channel
+ //
+ if (!((MRC_BIT0 << Channel) & ChBitMask) || (RankMaskCh == 0)) {
+ if (Channel == 0) {
+ if (Outputs->SdramCount == (MAX_SDRAM_IN_DIMM - 1)) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\t\t\t\t\t\t\t\t");
+ } else {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\t\t\t\t\t\t\t\t\t");
+ }
+ }
+
+ continue;
+ }
+
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d\t", LastPass[Channel][Byte]);
+ if ((Inc == 1) && (ChLastPass1[Channel] > LastPass[Channel][Byte])) {
+ ChLastPass1[Channel] = LastPass[Channel][Byte];
+ }
+
+ if ((Inc == -1) && (ChLastPass1[Channel] < LastPass[Channel][Byte])) {
+ ChLastPass1[Channel] = LastPass[Channel][Byte];
+ }
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ RankMaskCh = ChannelOut->ValidRankBitMask & RankMask;
+ //
+ // if nothing for this channel OR No Ranks in this channel
+ //
+ if (!((MRC_BIT0 << Channel) & ChBitMask) || (RankMaskCh == 0)) {
+ continue;
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Optimal offset Channel %d = %d\n", Channel, ChLastPass1[Channel]);
+ }
+#endif // MRC_DEBUG_PRINT
+ //
+ // Program new value
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!((MRC_BIT0 << Channel) & ChBitMask)) {
+ continue;
+ }
+
+ ChannelOut = &ControllerOut->Channel[Channel];
+ RankMaskCh = ChannelOut->ValidRankBitMask & RankMask;
+ if (RankMaskCh == 0) {
+ continue; // No Ranks in this channel
+ }
+ //
+ // Start with the most aggressive setting
+ //
+ ChLastPass = End;
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ if (Update == 0) {
+ LastPass[Channel][Byte] = Begin;
+ }
+
+ if ((Inc == 1) && (ChLastPass > LastPass[Channel][Byte])) {
+ ChLastPass = LastPass[Channel][Byte];
+ }
+
+ if ((Inc == -1) && (ChLastPass < LastPass[Channel][Byte])) {
+ ChLastPass = LastPass[Channel][Byte];
+ }
+
+ if (PerByte) {
+ UpdateTAParamOffset (MrcData, Channel, Byte, OptParam, LastPass[Channel][Byte], Update, 1, RankMaskCh);
+ }
+ }
+
+ if (PerByte == 0) {
+ UpdateTAParamOffset (MrcData, Channel, 0, OptParam, ChLastPass, Update, 1, RankMaskCh);
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Selected Offset for channel %d is = %d\n", Channel, ChLastPass);
+ }
+
+ return Status;
+}
+
+/**
+ Sets commnad margins when moving WrT, WrTBox, or WrV
+ NOTE: ONLY one, ResetDDR or SelfRefresh can be set inside this function
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] ChBitMask - Bit mask of populated channels
+ @param[in] Ranks - Bit Mask of populated ranks
+ @param[in] Param - Input parameter to update
+ @param[in] Value0 - value to be added
+ @param[in] Value1 - value to be added
+ @param[in] ResetDDR - Do we reset DDR?
+ @param[in] SelfRefresh - Do we perform Self refresh?
+
+ @retval MrcStatus - If it succeeds return mrcSuccess
+**/
+void
+SetCmdMargin (
+ IN MrcParameters *const MrcData,
+ IN const U8 ChBitMask,
+ IN const U8 Ranks,
+ IN const U8 Param,
+ IN const U8 Value0,
+ IN const U8 Value1,
+ IN U8 ResetDDR,
+ IN const U8 SelfRefresh
+ )
+{
+ MrcControllerOut *ControllerOut;
+ U8 Channel;
+ U8 RankMaskCh;
+ U8 Offset;
+
+ ControllerOut = &MrcData->SysOut.Outputs.Controller[0];
+ Offset = 0;
+ if (SelfRefresh && ResetDDR) {
+ MRC_DEBUG_MSG (
+ &MrcData->SysIn.Inputs.Debug,
+ MSG_LEVEL_ERROR,
+ "WARNING SelfRefresh OR ResetDDR can be set at once...performing SelfRefresh\n"
+ );
+ ResetDDR = 0;
+ }
+
+ if (SelfRefresh) {
+ EnterSR (MrcData);
+ }
+ //
+ // Change Clock Timing
+ //
+ if ((Param == WrT) || (Param == WrTBox)) {
+ //
+ // Walk though all chs and ranks
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (ChBitMask & (MRC_BIT0 << Channel)) {
+ //
+ // determine which ranks from parameter "Ranks" exist in this channel
+ //
+ RankMaskCh = Ranks & ControllerOut->Channel[Channel].ValidRankBitMask;
+ if (RankMaskCh == 0) {
+ continue; // No Ranks in this channel
+ }
+
+ ShiftPIforCmdTraining (MrcData, Channel, MrcIterationClock, RankMaskCh, 3, Value0, 0);
+ }
+ }
+ }
+
+ if ((Param == WrV) || (Param == (WrTBox))) {
+ if (Param == WrV) {
+ Offset = Value0;
+ } else {
+ if (Param == WrTBox) {
+ Offset = ((2 * Value1) - 1) * 8;
+ }
+ }
+
+ UpdateVrefWaitTilStable (MrcData, 2, 0, Offset, 0);
+ }
+
+ if (ResetDDR) {
+ MrcResetSequence (MrcData);
+ } else if (SelfRefresh) {
+ ExitSR (MrcData);
+ }
+
+ return;
+}
+
+/**
+ Updates the value for following OptParamCliff variables:
+ drrd2rd=0, ddrd2rd=1, drwr2wr=2, ddwr2wr=3, drrd2wr=4, ddrd2wr=5, drwr2rd=6, ddwr2rd=7,
+ rdodtd=8, wrodtd=9, mcodts=10, mcodtd=11, rtl=12}
+
+ @param[in,out] MrcData - Include all MRC global data.
+ @param[in] Channel - Channel to update the specificed parameter.
+ @param[in] Byte - Byte to update the specified parameter.
+ @param[in] OptParam - Parameter to update.
+ @param[in] Off - Value to offset the current setting.
+ @param[in] UpdateHost - Switch to update the host structure with the new value.
+ @param[in] SkipPrint - Switch to skip debug prints.
+ @param[in] RankMask - Bit mask of Ranks to update.
+
+ @retval Nothing
+**/
+void
+UpdateTAParamOffset (
+ IN OUT MrcParameters *const MrcData,
+ IN const U8 Channel,
+ IN const U8 Byte,
+ IN const U8 OptParam,
+ IN const U8 Off,
+ IN const U8 UpdateHost,
+ IN const U8 SkipPrint,
+ IN const U8 RankMask
+ )
+{
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcChannelOut *ChannelOut;
+ U8 Rank;
+ U8 IOLat;
+ S8 New;
+ U32 Offset1;
+ U32 Offset2;
+ MCHBAR_CH0_CR_TC_BANK_RANK_A_STRUCT TcBankRankA;
+ MCHBAR_CH0_CR_TC_BANK_RANK_B_STRUCT TcBankRankB;
+ MCHBAR_CH0_CR_TC_BANK_RANK_C_STRUCT TcBankRankC;
+ MCHBAR_CH0_CR_TC_BANK_RANK_D_STRUCT TcBankRankD;
+ DDRDATA0CH0_CR_DDRCRDATACONTROL1_STRUCT DdrDataControl1;
+ MCHBAR_CH0_CR_SC_IO_LATENCY_STRUCT ScIoLatency;
+ MCHBAR_CH0_CR_SC_ROUNDT_LAT_STRUCT ScRoundtLat;
+
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ ChannelOut = &Outputs->Controller[0].Channel[Channel];
+
+ switch (OptParam) {
+ case drrd2rd:
+ //
+ // dr RD 2 RD Turn Around offsets
+ //
+ TcBankRankA.Data = ChannelOut->MchbarBANKRANKA;
+ TcBankRankA.Bits.tRDRD_dr = Off;
+ Offset1 = MCHBAR_CH0_CR_TC_BANK_RANK_A_REG + ((MCHBAR_CH1_CR_TC_BANK_RANK_A_REG - MCHBAR_CH0_CR_TC_BANK_RANK_A_REG) * Channel);
+ MrcWriteCR (MrcData, Offset1, TcBankRankA.Data);
+ if (UpdateHost) {
+ ChannelOut->MchbarBANKRANKA = TcBankRankA.Data;
+ }
+ break;
+
+ case ddrd2rd:
+ //
+ // dd RD 2 RD Turn Around offsets
+ //
+ TcBankRankA.Data = ChannelOut->MchbarBANKRANKA;
+ TcBankRankA.Bits.tRDRD_dd = Off;
+ Offset1 = MCHBAR_CH0_CR_TC_BANK_RANK_A_REG +
+ ((MCHBAR_CH1_CR_TC_BANK_RANK_A_REG - MCHBAR_CH0_CR_TC_BANK_RANK_A_REG) * Channel);
+ MrcWriteCR (MrcData, Offset1, TcBankRankA.Data);
+ if (UpdateHost) {
+ ChannelOut->MchbarBANKRANKA = TcBankRankA.Data;
+ }
+ break;
+
+ case drwr2wr:
+ //
+ // dr WR 2 WR Turn Around offsets
+ //
+ TcBankRankB.Data = ChannelOut->MchbarBANKRANKB;
+ TcBankRankB.Bits.tWRWR_dr = Off;
+ Offset1 = MCHBAR_CH0_CR_TC_BANK_RANK_B_REG +
+ ((MCHBAR_CH1_CR_TC_BANK_RANK_B_REG - MCHBAR_CH0_CR_TC_BANK_RANK_B_REG) * Channel);
+ MrcWriteCR (MrcData, Offset1, TcBankRankB.Data);
+ if (UpdateHost) {
+ ChannelOut->MchbarBANKRANKB = TcBankRankB.Data;
+ }
+ break;
+
+ case ddwr2wr:
+ //
+ // dd WR 2 WR Turn Around offsets
+ //
+ TcBankRankB.Data = ChannelOut->MchbarBANKRANKB;
+ TcBankRankB.Bits.tWRWR_dd = Off;
+ Offset1 = MCHBAR_CH0_CR_TC_BANK_RANK_B_REG +
+ ((MCHBAR_CH1_CR_TC_BANK_RANK_B_REG - MCHBAR_CH0_CR_TC_BANK_RANK_B_REG) * Channel);
+ MrcWriteCR (MrcData, Offset1, TcBankRankB.Data);
+ if (UpdateHost) {
+ ChannelOut->MchbarBANKRANKB = TcBankRankB.Data;
+ }
+ break;
+
+ case drrd2wr:
+ //
+ // dr RD 2 WR Turn Around offsets
+ //
+ TcBankRankC.Data = ChannelOut->MchbarBANKRANKC;
+ TcBankRankC.Bits.tRDWR_dr = Off;
+ Offset1 = MCHBAR_CH0_CR_TC_BANK_RANK_C_REG +
+ ((MCHBAR_CH1_CR_TC_BANK_RANK_C_REG - MCHBAR_CH0_CR_TC_BANK_RANK_C_REG) * Channel);
+ MrcWriteCR (MrcData, Offset1, TcBankRankC.Data);
+ if (UpdateHost) {
+ ChannelOut->MchbarBANKRANKC = TcBankRankC.Data;
+ }
+ break;
+
+ case ddrd2wr:
+ //
+ // dd RD 2 WR Turn Around offsets
+ //
+ TcBankRankC.Data = ChannelOut->MchbarBANKRANKC;
+ TcBankRankC.Bits.tRDWR_dd = Off;
+ Offset1 = MCHBAR_CH0_CR_TC_BANK_RANK_C_REG +
+ ((MCHBAR_CH1_CR_TC_BANK_RANK_C_REG - MCHBAR_CH0_CR_TC_BANK_RANK_C_REG) * Channel);
+ MrcWriteCR (MrcData, Offset1, TcBankRankC.Data);
+ if (UpdateHost) {
+ ChannelOut->MchbarBANKRANKC = TcBankRankC.Data;
+ }
+ break;
+
+ case drwr2rd:
+ //
+ // dr WR 2 RD Turn Around offsets
+ //
+ TcBankRankB.Data = ChannelOut->MchbarBANKRANKB;
+ TcBankRankB.Bits.tWRRD_dr = Off;
+ Offset1 = MCHBAR_CH0_CR_TC_BANK_RANK_B_REG +
+ ((MCHBAR_CH1_CR_TC_BANK_RANK_B_REG - MCHBAR_CH0_CR_TC_BANK_RANK_B_REG) * Channel);
+ MrcWriteCR (MrcData, Offset1, TcBankRankB.Data);
+ if (UpdateHost) {
+ ChannelOut->MchbarBANKRANKB = TcBankRankB.Data;
+ }
+ break;
+
+ case ddwr2rd:
+ //
+ // dd WR 2 RD Turn Around offsets
+ //
+ TcBankRankB.Data = ChannelOut->MchbarBANKRANKB;
+ TcBankRankB.Bits.tWRRD_dd = Off;
+ Offset1 = MCHBAR_CH0_CR_TC_BANK_RANK_B_REG +
+ ((MCHBAR_CH1_CR_TC_BANK_RANK_B_REG - MCHBAR_CH0_CR_TC_BANK_RANK_B_REG) * Channel);
+ MrcWriteCR (MrcData, Offset1, TcBankRankB.Data);
+ if (UpdateHost) {
+ ChannelOut->MchbarBANKRANKB = TcBankRankB.Data;
+ }
+ break;
+
+ case rdodtd:
+ TcBankRankD.Data = ChannelOut->MchbarBANKRANKD;
+ TcBankRankD.Bits.Odt_Read_Duration = Off - 6; // Convert into Register values. 2'b00 = BL/2 + 2 (6 DCLKs
+ Offset1 = MCHBAR_CH0_CR_TC_BANK_RANK_D_REG +
+ ((MCHBAR_CH1_CR_TC_BANK_RANK_D_REG - MCHBAR_CH0_CR_TC_BANK_RANK_D_REG) * Channel);
+ MrcWriteCR (MrcData, Offset1, TcBankRankD.Data);
+ if (UpdateHost) {
+ ChannelOut->MchbarBANKRANKD = TcBankRankD.Data;
+ }
+ break;
+
+ case wrodtd:
+ TcBankRankD.Data = ChannelOut->MchbarBANKRANKD;
+#ifdef ULT_FLAG
+ if (Outputs->DdrType == MRC_DDR_TYPE_LPDDR3) {
+ TcBankRankD.UltBits.Odt_Write_Duration = Off - 6; // Convert into Register values. 2'b00 = BL/2 + 2 (6 DCLKs
+ } else
+#endif // ULT_FLAG
+ {
+ TcBankRankD.Bits.Odt_Write_Duration = Off - 6; // Convert into Register values. 2'b00 = BL/2 + 2 (6 DCLKs
+ }
+ Offset1 = MCHBAR_CH0_CR_TC_BANK_RANK_D_REG +
+ ((MCHBAR_CH1_CR_TC_BANK_RANK_D_REG - MCHBAR_CH0_CR_TC_BANK_RANK_D_REG) * Channel);
+ MrcWriteCR (MrcData, Offset1, TcBankRankD.Data);
+ if (UpdateHost) {
+ ChannelOut->MchbarBANKRANKD = TcBankRankD.Data;
+ }
+ break;
+
+ case mcodts:
+ //
+ // MC ODT delay
+ //
+ DdrDataControl1.Data = ChannelOut->DqControl1[Byte].Data;
+ New = MrcSE ((U8) DdrDataControl1.Bits.OdtDelay, 4, 8) + Off; // SignExtend
+ if (New < -4) {
+ New = -4; // RcvEnPi[8:6] - 5 qclk Min
+ } else if (New > 6) {
+ New = 6; // RcvEnPi[8:6] + 5 qclk Max
+ }
+
+ DdrDataControl1.Bits.OdtDelay = New;
+ DdrDataControl1.Bits.SenseAmpDelay = New;
+ Offset1 = DDRDATA0CH0_CR_DDRCRDATACONTROL1_REG +
+ ((DDRDATA0CH1_CR_DDRCRDATACONTROL1_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL1_REG) * Channel) +
+ ((DDRDATA1CH0_CR_DDRCRDATACONTROL1_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL1_REG) * Byte);
+ MrcWriteCR (MrcData, Offset1, DdrDataControl1.Data);
+ if (UpdateHost) {
+ ChannelOut->DqControl1[Byte].Data = DdrDataControl1.Data;
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, (SkipPrint) ? "" : "%d\t", New);
+ break;
+
+ case mcodtd:
+ //
+ // Duration
+ //
+ DdrDataControl1.Data = ChannelOut->DqControl1[Byte].Data;
+ New = (U8) DdrDataControl1.Bits.OdtDuration + Off;
+ if (New < 0) {
+ New = 0; // 11 tQCK Min
+ } else if (New > DDRDATA0CH0_CR_DDRCRDATACONTROL1_OdtDuration_MAX) {
+ New = DDRDATA0CH0_CR_DDRCRDATACONTROL1_OdtDuration_MAX; // 18 tQCK Max
+ }
+
+ DdrDataControl1.Bits.OdtDuration = New;
+ DdrDataControl1.Bits.SenseAmpDuration = New;
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "mcodtd CRValue = 0x%x\n", DdrDataControl1.Bits.OdtDuration);
+ //
+ Offset1 = DDRDATA0CH0_CR_DDRCRDATACONTROL1_REG +
+ ((DDRDATA0CH1_CR_DDRCRDATACONTROL1_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL1_REG) * Channel) +
+ ((DDRDATA1CH0_CR_DDRCRDATACONTROL1_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL1_REG) * Byte);
+ MrcWriteCR (MrcData, Offset1, DdrDataControl1.Data);
+ if (UpdateHost) {
+ ChannelOut->DqControl1[Byte].Data = DdrDataControl1.Data;
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, (SkipPrint) ? "" : "%d\t", DdrDataControl1.Bits.OdtDuration);
+ break;
+
+ case rtl:
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if (RankMask & (MRC_BIT0 << Rank)) {
+ //
+ // Update IO Latency & RoundTrip
+ //
+ IOLat = ChannelOut->IoLatency[Rank] - (ChannelOut->RTLatency[Rank] - Off);
+ if ((S8) IOLat < 0) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_WARNING, "IOLatency reached the Saturation point \n");
+ } else {
+ Offset1 = MCHBAR_CH0_CR_SC_IO_LATENCY_REG +
+ ((MCHBAR_CH1_CR_SC_IO_LATENCY_REG - MCHBAR_CH0_CR_SC_IO_LATENCY_REG) * Channel);
+ ScIoLatency.Data = MrcReadCR (MrcData, Offset1);
+ Offset2 = MCHBAR_CH0_CR_SC_ROUNDT_LAT_REG +
+ ((MCHBAR_CH1_CR_SC_ROUNDT_LAT_REG - MCHBAR_CH0_CR_SC_ROUNDT_LAT_REG) * Channel);
+ ScRoundtLat.Data = MrcReadCR (MrcData, Offset2);
+ switch (Rank) {
+ case 0:
+ ScIoLatency.Bits.IOLAT_R0D0 = IOLat;
+ ScRoundtLat.Bits.Lat_R0D0 = Off;
+ break;
+
+ case 1:
+ ScIoLatency.Bits.IOLAT_R1D0 = IOLat;
+ ScRoundtLat.Bits.Lat_R1D0 = Off;
+ break;
+
+ case 2:
+ ScIoLatency.Bits.IOLAT_R0D1 = IOLat;
+ ScRoundtLat.Bits.Lat_R0D1 = Off;
+ break;
+
+ case 3:
+ ScIoLatency.Bits.IOLAT_R1D1 = IOLat;
+ ScRoundtLat.Bits.Lat_R1D1 = Off;
+ break;
+
+ default:
+ break;
+ }
+
+ MrcWriteCR (MrcData, Offset1, ScIoLatency.Data);
+ MrcWriteCR (MrcData, Offset2, ScRoundtLat.Data);
+
+ //
+ // Update host
+ //
+ if (UpdateHost) {
+ ChannelOut->RTLatency[Rank] = Off;
+ ChannelOut->IoLatency[Rank] = IOLat;
+ }
+ }
+ }
+ }
+ break;
+
+ case srrd2rd:
+ //
+ // sr RD 2 RD Turn Around offsets
+ //
+ TcBankRankA.Data = ChannelOut->MchbarBANKRANKA;
+ TcBankRankA.Bits.tRDRD = Off;
+ Offset1 = MCHBAR_CH0_CR_TC_BANK_RANK_A_REG + ((MCHBAR_CH1_CR_TC_BANK_RANK_A_REG - MCHBAR_CH0_CR_TC_BANK_RANK_A_REG) * Channel);
+ MrcWriteCR (MrcData, Offset1, TcBankRankA.Data);
+ if (UpdateHost) {
+ ChannelOut->MchbarBANKRANKA = TcBankRankA.Data;
+ }
+ break;
+
+ case srrd2wr:
+ //
+ // sr RD 2 WR Turn Around offsets
+ //
+ TcBankRankC.Data = ChannelOut->MchbarBANKRANKC;
+ TcBankRankC.Bits.tRDWR = Off;
+ Offset1 = MCHBAR_CH0_CR_TC_BANK_RANK_C_REG +
+ ((MCHBAR_CH1_CR_TC_BANK_RANK_C_REG - MCHBAR_CH0_CR_TC_BANK_RANK_C_REG) * Channel);
+ MrcWriteCR (MrcData, Offset1, TcBankRankC.Data);
+ if (UpdateHost) {
+ ChannelOut->MchbarBANKRANKC = TcBankRankC.Data;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ ((OptParam != mcodtd) && (OptParam != mcodts) && (!SkipPrint)) ? "%d\t" : "",
+ Off
+ );
+
+ return;
+}
+
+/**
+ This function applies the new DRAM ODT settings
+ Walks through various optimizations to get the best result with new ODT values
+ This includes WrDS, RdODT, Eq, etc.
+ Updates Best* variables if this point if better than the prior points
+ chDone is both an input and output. Reports which channels have a good enough value
+ if SkipRd is high, it will skip the read related functions (RdODT, RdEq, RdTiming)
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in,out] DimmOptPoints - Structure of all the DIMM ODT optimal settings.
+ @param[in] ChMask - Channel to work on.
+ @param[in] RankMask - Rank to work on.
+ @param[in] skipGRdOdt - Used to skip RdODT.
+ @param[in] RttNom - Rtt_Nom value for each DIMM.
+ @param[in] RttWr - Rtt_Wr value for each DIMM.
+ @param[in] GRdOdt - CPU Global Read ODT.
+ @param[in] OptParamTestList - List of Opt test(Drive Strength, RxBias, TxEq, RxEq) to run.
+ @param[in] OptParamTestListSize - Size of OptParamTestList.
+ @param[in] SubPwrLimits - Switch to apply power limits to the suboptimization.
+ @param[in] skipOptTests - Skips the suboptimization.
+ @param[in] skipOptPrint - Skip printing of the suboptimization steps.
+ @param[in] RdCenter - Switch to recenter read.
+ @param[in] WrCenter - Switch to recenter write.
+ @param[in] inputBestMargin - Array of the best margin for each test.
+ @param[in] MarginsLength - Length of inputBestMargin.
+ @param[in] OffsetPoint - Index inside inputBestMargin to start.
+
+ @retval Nothing.
+**/
+void
+TrainDimmOdtSetting (
+ IN MrcParameters *const MrcData,
+ IN OUT DimmOptPoint *DimmOptPoints,
+ IN U8 ChMask,
+ IN U8 RankMask,
+ IN U8 skipGRdOdt,
+ IN U8 RttNom[MAX_CHANNEL][MAX_DIMMS_IN_CHANNEL],
+ IN U8 RttWr[MAX_CHANNEL][MAX_DIMMS_IN_CHANNEL],
+ IN S8 GRdOdt,
+ IN U8 *OptParamTestList,
+ IN U8 OptParamTestListSize,
+ IN BOOL SubPwrLimits,
+ IN BOOL skipOptTests,
+ IN BOOL skipOptPrint,
+ IN BOOL RdCenter,
+ IN BOOL WrCenter,
+ IN void *inputBestMargin,
+ IN U8 MarginsLength,
+ IN U8 OffsetPoint
+ )
+{
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ DimmOptPoint *PointResults;
+ OptOffsetChByte BestOffArr[SizeOfTCompOffset][MAX_RANK_IN_CHANNEL];
+ TCompOffset OffsetType;
+ U8 dimm;
+ U8 rank;
+ U8 ValidRankMask;
+ U8 LocalRanks[MAX_CHANNEL];
+ U8 ChBitMask;
+ U8 Channel;
+ U8 ParamList[] = { RdV, RdT, WrV, WrT }; // List of parameters to margin
+ U8 TestListRd[] = { RdV, RdT };
+ U8 TestListWr[] = { WrV, WrT };
+ U8 *TestList;
+ U8 TestListSize;
+ U8 TScale[] = { 1, 2, 1, 0, 0 };
+ U8 GScale[] = { 1, 2, 0, 0, 0 };
+ U16 GPwrLimits[] = { 520, 280, 0, 0, 0 };
+ U16 noPwrLimits[] = { 2480, 2240, 0, 0, 0 };
+ U8 *Scale;
+ U16 *PwrLimits;
+ S8 start;
+ S8 stop;
+ U8 i;
+ U8 t;
+ U8 ResultType;
+ U8 RecenterLC;
+ U8 OptParamLC;
+ BOOL clipPowerLmt;
+ U16 *BestMargin;
+ U8 TestResultType[4] = { 0, 0, 0, 0 };
+
+ TestListSize = 0;
+ RecenterLC = 15;
+ OptParamLC = OPT_PARAM_LOOP_COUNT;
+ clipPowerLmt = 1;
+ Outputs = &MrcData->SysOut.Outputs;
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ ControllerOut = &Outputs->Controller[0];
+
+ PointResults = DimmOptPoints;
+ BestMargin = (U16 *) inputBestMargin;
+ MrcOemMemorySet ((U8 *) BestOffArr, 0xffff, sizeof (BestOffArr));
+ MrcOemMemorySet ((U8 *) PointResults, 0xffff, sizeof (DimmOptPoint));
+ OffsetType = 0;
+
+ if (SubPwrLimits) {
+ //
+ // Use power limits and Trendline
+ //
+ Scale = TScale;
+ PwrLimits = GPwrLimits;
+ } else {
+ //
+ // No power limits and no TrendLine
+ //
+ Scale = GScale;
+ PwrLimits = noPwrLimits;
+ }
+ //
+ // TrainDDROptParam already check the valid against host chRankBit mask
+ // Walk through channels, check if this point is redundant, set RttNom
+ //
+ ChMask &= Outputs->ValidChBitMask;
+ RankMask &= Outputs->ValidRankMask;
+ ValidRankMask = 0;
+ ChBitMask = 0;
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ LocalRanks[Channel] = 0;
+ if (((MRC_BIT0 << Channel) & ChMask)) {
+ LocalRanks[Channel] = RankMask & ControllerOut->Channel[Channel].ValidRankBitMask;
+ if (LocalRanks[Channel]) {
+ ChBitMask |= MRC_BIT0 << Channel; // remove ch with no "active" ranks
+ }
+ }
+ }
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ for (dimm = 0; dimm < MAX_DIMMS_IN_CHANNEL; dimm++) {
+ PointResults->ODTSet.RttNom[Channel][dimm] = RttNom[Channel][dimm];
+ PointResults->ODTSet.RttWr[Channel][dimm] = RttWr[Channel][dimm];
+ }
+ }
+
+ PointResults->ODTSet.GRdOdt = GRdOdt;
+ UpdateOdtsValues (MrcData, ChBitMask, PointResults, skipGRdOdt, 0, 1, 1);
+ //
+ // update only DimmOdt and GROdt if not skipped.
+ // Recenter Timing
+ //
+ if (RdCenter) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "Re-center Read Vref\n");
+ ReadVoltageCentering2D (
+ MrcData,
+ Outputs->MarginResult,
+ ChBitMask,
+ RdV,
+ 0,
+ 0,
+ RecenterLC,
+ 0
+ );
+ //
+ // We can add if status fail go to next point
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "Re-center Read Timing ChBitMask=%x\n", ChBitMask);
+ DataTimeCentering2D (
+ MrcData,
+ Outputs->MarginResult, // prev. margin results
+ ChBitMask,
+ RdT,
+ 0, // EnPerBit,
+ 0, // EnRxDutyCycle
+ 0, // ResetPerBit
+ RecenterLC,
+ 0 // En2D
+ );
+ }
+
+ if (WrCenter) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "Re-center Write Vref\n");
+ MrcWriteVoltageCentering2D (MrcData);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "Re-center Write Timing ChBitMask=%x\n", ChBitMask);
+ DataTimeCentering2D (
+ MrcData,
+ Outputs->MarginResult, // prev. margin results
+ ChBitMask,
+ WrT,
+ 0, // EnPerBit,
+ 0, // EnRxDutyCycle
+ 0, // ResetPerBit
+ RecenterLC,
+ 0 // En2D
+ );
+ }
+ //
+ // @todo: we could check here if we have some reasonable amount of margin to play with
+ //
+ TestList = ParamList;
+ PointResults->OptParamTestListSize = OptParamTestListSize;
+ for (t = 0; t < OptParamTestListSize; t++) {
+ //
+ // also apply the best offset to hw and host and inside also best offset related margin is saved in host struct
+ //
+ PointResults->OptParamTestList[t] = OptParamTestList[t];
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "OptParamTestList[%d]=%d , %s\n",t,OptParamTestList[t],TOptParamOffsetString[OptParamTestList[t]]);
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "OptParamTestList[%d]=%d OptParamTestListSize=%d\n",t,OptParamTestList[t],OptParamTestListSize);
+ switch (OptParamTestList[t]) {
+ case (OptWrDS):
+ start = -11;
+ stop = 12;
+ TrainDDROptParam (
+ MrcData,
+ &BestOffArr[WrDSOfft][0],
+ ChBitMask,
+ RankMask,
+ OptWrDS,
+ TestListWr,
+ sizeof (TestListWr),
+ Scale,
+ PwrLimits,
+ start,
+ stop,
+ OptParamLC,
+ 1, // Repeats
+ skipOptPrint,
+ skipOptTests,
+ 0, // RdRd2Test
+ 1 // GuardBand
+ );
+ TestList = TestListWr;
+ TestListSize = sizeof (TestListWr);
+ OffsetType = WrDSOfft;
+ PointResults->BestOptOff[WrDSOfft][0] = BestOffArr[WrDSOfft][0];
+ break;
+
+ case (OptRdOdt):
+ start = -10;
+ stop = 6;
+ TrainDDROptParam (
+ MrcData,
+ &BestOffArr[RdOdtOfft][0],
+ ChBitMask,
+ RankMask,
+ OptRdOdt,
+ TestListRd,
+ sizeof (TestListRd),
+ Scale,
+ PwrLimits,
+ start,
+ stop,
+ OptParamLC,
+ 1, // Repeats
+ skipOptPrint,
+ skipOptTests,
+ RdRdTA, // RdRd2Test
+ 0 // GuardBand
+ );
+ TestList = TestListRd;
+ TestListSize = sizeof (TestListRd);
+ OffsetType = RdOdtOfft;
+ PointResults->BestOptOff[RdOdtOfft][0] = BestOffArr[RdOdtOfft][0];
+ break;
+
+ case (OptSComp):
+ case (OptTComp):
+ break;
+
+ case (OptTxEq):
+ start = 0;
+ stop = 11;
+ for (rank = 0; rank < MAX_RANK_IN_CHANNEL; rank++) {
+ if (!((MRC_BIT0 << rank) & RankMask)) {
+ continue; // check if rank at least on one channel
+ }
+
+ TrainDDROptParam (
+ MrcData,
+ &BestOffArr[TxEqOfft][rank],
+ ChBitMask,
+ (MRC_BIT0 << rank),
+ OptTxEq,
+ TestListWr,
+ sizeof (TestListWr),
+ Scale,
+ PwrLimits,
+ start,
+ stop,
+ OptParamLC,
+ 1, // Repeats
+ skipOptPrint,
+ skipOptTests,
+ 0, // RdRd2Test
+ 2 // GuardBand
+ );
+ PointResults->BestOptOff[TxEqOfft][rank] = BestOffArr[TxEqOfft][rank];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!((MRC_BIT0 << rank) & LocalRanks[Channel])) {
+ continue;
+ //
+ // check if the rank exist in this ch
+ //
+ }
+
+ for (i = 0; i < sizeof (TestListWr); i++) {
+ //
+ // track min margin per ch
+ //
+ if (BestOffArr[TxEqOfft][rank].Margins[i][Channel] < BestOffArr[TxEqOfft][0].Margins[i][Channel]) {
+ BestOffArr[TxEqOfft][0].Margins[i][Channel] = BestOffArr[TxEqOfft][rank].Margins[i][Channel];
+ }
+ }
+ }
+ }
+
+ TestList = TestListWr;
+ TestListSize = sizeof (TestListWr);
+ OffsetType = TxEqOfft;
+ break;
+
+ case (OptRxEq):
+ start = 0;
+ stop = 14;
+ for (rank = 0; rank < MAX_RANK_IN_CHANNEL; rank++) {
+ if (!((MRC_BIT0 << rank) & RankMask)) {
+ continue; // check if rank at least on one channel
+ }
+
+ TrainDDROptParam (
+ MrcData,
+ &BestOffArr[RxEqOfft][rank],
+ ChBitMask,
+ (MRC_BIT0 << rank),
+ OptRxEq,
+ TestListRd,
+ sizeof (TestListRd),
+ Scale,
+ noPwrLimits,
+ start,
+ stop,
+ OptParamLC,
+ 1, // Repeats
+ skipOptPrint,
+ skipOptTests,
+ RdRdTA, // RdRd2Test
+ 0 // GuardBand
+ );
+ PointResults->BestOptOff[RxEqOfft][rank] = BestOffArr[RxEqOfft][rank];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!((1 << rank) & LocalRanks[Channel])) {
+ continue; // check if the rank exist in this ch
+ }
+
+ for (i = 0; i < sizeof (TestListRd); i++) {
+ //
+ // track min margin per ch and asign to rank0
+ //
+ if (BestOffArr[RxEqOfft][rank].Margins[i][Channel] < BestOffArr[RxEqOfft][0].Margins[i][Channel]) {
+ BestOffArr[RxEqOfft][0].Margins[i][Channel] = BestOffArr[RxEqOfft][rank].Margins[i][Channel];
+ }
+ }
+ }
+ }
+
+ TestList = TestListRd;
+ TestListSize = sizeof (TestListRd);
+ OffsetType = RxEqOfft;
+ break;
+
+ case (OptRxBias):
+ start = 0;
+ stop = 7;
+ TrainDDROptParam (
+ MrcData,
+ &BestOffArr[RdSAmpOfft][0],
+ ChBitMask,
+ RankMask,
+ OptRxBias,
+ TestListRd,
+ sizeof (TestListRd),
+ Scale,
+ PwrLimits,
+ start,
+ stop,
+ OptParamLC,
+ 1, // Repeats
+ skipOptPrint,
+ skipOptTests,
+ RdRdTA, // RdRd2Test
+ 0 // GuardBand
+ );
+ TestList = TestListRd;
+ TestListSize = sizeof (TestListRd);
+ OffsetType = RdSAmpOfft;
+ PointResults->BestOptOff[RdSAmpOfft][0] = BestOffArr[RdSAmpOfft][0];
+ break;
+
+ case (OptDimmOdt):
+ break;
+
+ case (OptDimmOdtWr):
+ break;
+
+ default:
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "OptParam Test not valid\n");
+
+ }
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!(LocalRanks[Channel])) {
+ continue; // check if the active rank run this ch
+ }
+ //
+ // run through all BestOff[optParam][0] and track min[RdV,RdT,WrV,WrT]
+ //
+ for (i = 0; i < TestListSize; i++) {
+ ResultType = GetMarginResultType (TestList[i]);
+ TestResultType[ResultType] = TestList[i]; // indicate which test we run and create the reverse dic
+ //
+ //we need to update only last results
+ //
+ PointResults->Test[ResultType][Channel] = BestOffArr[OffsetType][0].Margins[i][Channel];
+ }
+ }
+ } // end for OptParamTest
+ //
+ // assign the point for passing to the FindOptimalTradeOff function
+ //
+ i = 0;
+ PointResults->NumTests = 0;
+ for (t = 0; t < 4; t++) {
+ //
+ // ResultType=GetMarginResultType(TestList[i]);
+ //
+ if (TestResultType[t] == 0) {
+ continue; // can only be 1,2,4,5
+ } else {
+ PointResults->TestList[i] = TestResultType[t];
+ PointResults->NumTests++;
+ //
+ // *(BestMargin+i*MarginsLength+OffsetPoint)=PointResults->Test[t][Channel];
+ // sorting test for TradeOff
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!(LocalRanks[Channel])) {
+ continue; // check if the active rank run this ch
+ }
+
+ if (clipPowerLmt) {
+ if (PointResults->Test[t][Channel] > UpmPwrLimitValue (MrcData, TestResultType[t], PowerLimit)) {
+ PointResults->Points2Trade[i][Channel] = UpmPwrLimitValue (MrcData, TestResultType[t], PowerLimit);
+ } else {
+ PointResults->Points2Trade[i][Channel] = PointResults->Test[t][Channel];
+ }
+ } else {
+ PointResults->Points2Trade[i][Channel] = PointResults->Test[t][Channel];
+ }
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "PointResults->TestList[%d]=%d PointResults->Test[test index=%d][channel=%d] =%d\n",i,PointResults->TestList[i],t,Channel,PointResults->Test[t][Channel]);
+ //
+ }
+
+ i++;
+ }
+ }
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "PointResults->NumTests =%d\n",PointResults->NumTests);
+ //
+ return;
+}
+
+/**
+ This function applies an offset to the global compensation logic.
+ Reruns Compensation and returns the new comp value
+
+ @param[in,out] MrcData - Include all MRC global data.
+ @param[in] param - Parameter defining the desired global compensation logic
+ @param[in] offset - Value to apply
+ @param[in] UpdateHost - Desides if MrcData has to be updated
+
+ @retval Returns the new comp value.
+**/
+U32
+UpdateCompGlobalOffset (
+ IN OUT MrcParameters *const MrcData,
+ IN const U8 param,
+ IN const U32 offset,
+ IN const U8 UpdateHost
+ )
+{
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ DDRCOMP_CR_DDRCRCOMPCTL0_STRUCT DdrCrCompCtl0;
+ DDRCOMP_CR_DDRCRCOMPCTL1_STRUCT DdrCrCompCtl1;
+ PCU_CR_M_COMP_PCU_STRUCT PcuCrMComp;
+ DDRCOMP_CR_DDRCRDATACOMP0_STRUCT DdrCrDataComp0;
+ DDRCOMP_CR_DDRCRDATACOMP1_STRUCT DdrCrDataComp1;
+ DDRCOMP_CR_DDRCRCMDCOMP_STRUCT DdrCrCmdComp;
+ DDRCOMP_CR_DDRCRCTLCOMP_STRUCT DdrCrCtlComp;
+ DDRCOMP_CR_DDRCRCLKCOMP_STRUCT DdrCrClkComp;
+ DDRDATACH0_CR_DDRCRDATACONTROL0_STRUCT DdrCrDataControl0;
+ DDRCOMP_CR_DDRCRCOMPCTL0_STRUCT DdrCrCompCtl0_Temp;
+ U32 RegOffset;
+ U8 Channel;
+
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerOut = &Outputs->Controller[0];
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ DdrCrCompCtl0.Data = Outputs->CompCtl0;
+ DdrCrCompCtl1.Data = Outputs->CompCtl1;
+ DdrCrDataControl0.Data = 0;
+
+ //
+ // Update offset in local CR variable
+ //
+ switch (param) {
+ case RdOdt:
+ //
+ // Disable FixOdt feature before changing this param
+ //
+ DdrCrCompCtl0.Bits.FixOdtD = 0;
+ //
+ // Apply Comp Offset to RdOdt
+ //
+ DdrCrCompCtl0.Bits.DqOdtVref = offset;
+ break;
+
+ case WrDS:
+ //
+ // Apply Comp Offset to WrDS-DQ
+ //
+ DdrCrCompCtl0.Bits.DqDrvVref = offset;
+ break;
+
+ case WrDSCmd:
+ //
+ // Apply Comp Offset to WrDS-CMD
+ //
+ DdrCrCompCtl0.Bits.CmdDrvVref = offset;
+ break;
+
+ case WrDSCtl:
+ //
+ // Apply Comp Offset to WrDS-CTL
+ //
+ DdrCrCompCtl0.Bits.CtlDrvVref = offset;
+ break;
+
+ case WrDSClk:
+ //
+ // Apply Comp Offset to WrDS-CLK
+ //
+ DdrCrCompCtl0.Bits.ClkDrvVref = offset;
+ break;
+
+ case SCompDq:
+ //
+ // Apply Comp Offset to Scomp-DQ
+ //
+ DdrCrCompCtl1.Bits.DqScompCells = offset;
+ DdrCrCompCtl1.Bits.DqScompPC = offset >> 4;
+ break;
+
+ case SCompCmd:
+ //
+ // Apply Comp Offset to Scomp-CMD
+ //
+ DdrCrCompCtl1.Bits.CmdScompCells = offset;
+ DdrCrCompCtl1.Bits.CmdScompPC = offset >> 4;
+ break;
+
+ case SCompCtl:
+ //
+ // Apply Comp Offset to Scomp-CTL
+ //
+ DdrCrCompCtl1.Bits.CtlScompCells = offset;
+ DdrCrCompCtl1.Bits.CtlScompPC = offset >> 4;
+ break;
+
+ case SCompClk:
+ //
+ // Apply Comp Offset to Scomp-CLK
+ //
+ DdrCrCompCtl1.Bits.ClkScompCells = offset;
+ DdrCrCompCtl1.Bits.ClkScompPC = offset >> 4;
+ break;
+
+ case DisOdtStatic:
+ //
+ // disable static read Otd legs
+ //
+ DdrCrCompCtl0.Bits.DisableOdtStatic = offset;
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ DdrCrDataControl0.Data = ChannelOut->DqControl0.Data;
+ DdrCrDataControl0.Bits.DisableOdtStatic = offset; // apply to bytes fubs
+ RegOffset = DDRDATACH0_CR_DDRCRDATACONTROL0_REG +
+ ((DDRDATACH1_CR_DDRCRDATACONTROL0_REG - DDRDATACH0_CR_DDRCRDATACONTROL0_REG) * Channel);
+ MrcWriteCrMulticast (MrcData, RegOffset, DdrCrDataControl0.Data);
+ if (UpdateHost) {
+ ChannelOut->DqControl0.Data = DdrCrDataControl0.Data;
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ //
+ // Update the Comp Offsets and Host Structure
+ //
+ MrcWriteCR (MrcData, DDRCOMP_CR_DDRCRCOMPCTL0_REG, DdrCrCompCtl0.Data);
+ MrcWriteCR (MrcData, DDRCOMP_CR_DDRCRCOMPCTL1_REG, DdrCrCompCtl1.Data);
+ if (UpdateHost) {
+ Outputs->CompCtl0 = DdrCrCompCtl0.Data;
+ Outputs->CompCtl1 = DdrCrCompCtl1.Data;
+ }
+ //
+ // Run Compensation
+ // Start Comp Engine
+ //
+ PcuCrMComp.Data = 0;
+ PcuCrMComp.Bits.COMP_FORCE = 1;
+ PcuCrMComp.Bits.COMP_INTERVAL = MIN (COMP_INT, PCU_CR_M_COMP_PCU_COMP_INTERVAL_MAX);
+ PcuCrMComp.Bits.COMP_DISABLE = 1;
+ MrcWriteCR (MrcData, PCU_CR_M_COMP_PCU_REG, PcuCrMComp.Data);
+ MrcWait (MrcData, 8 * HPET_1US); // Wait for Comp to Complete
+ if (param == RdOdt) {
+ //
+ // we check if we close to saturation and try dis/en the static legs
+ //
+ DdrCrDataComp1.Data = MrcReadCR (MrcData, DDRCOMP_CR_DDRCRDATACOMP1_REG);
+ if ((DdrCrDataComp1.Bits.RcompOdtUp < 16) || (DdrCrDataComp1.Bits.RcompOdtUp > 48)) {
+ //
+ // disable/enable static read Otd legs
+ //
+ if (DdrCrDataComp1.Bits.RcompOdtUp < 16) {
+ DdrCrCompCtl0.Bits.DisableOdtStatic = 1;
+ } else {
+ DdrCrCompCtl0.Bits.DisableOdtStatic = 0;
+ }
+ //
+ // Update the Comp Offsets and Host Structure
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ ChannelOut->DqControl0.Bits.DisableOdtStatic = DdrCrCompCtl0.Bits.DisableOdtStatic; // apply to bytes fubs
+ RegOffset = DDRDATACH0_CR_DDRCRDATACONTROL0_REG +
+ ((DDRDATACH1_CR_DDRCRDATACONTROL0_REG - DDRDATACH0_CR_DDRCRDATACONTROL0_REG) * Channel);
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "DdrCrDataControl0.Bits.DisableOdtStatic=%d\n",DdrCrDataControl0.Bits.DisableOdtStatic);
+ //
+ MrcWriteCrMulticast (MrcData, RegOffset, ChannelOut->DqControl0.Data);
+ }
+
+ MrcWriteCR (MrcData, DDRCOMP_CR_DDRCRCOMPCTL0_REG, DdrCrCompCtl0.Data);
+ //
+ // host need to always be updated with static state
+ //
+ DdrCrCompCtl0_Temp.Data = Outputs->CompCtl0;
+ DdrCrCompCtl0_Temp.Bits.DisableOdtStatic = DdrCrCompCtl0.Bits.DisableOdtStatic;
+ Outputs->CompCtl0 = DdrCrCompCtl0_Temp.Data;
+ //
+ // Run Compensation
+ // Start Comp Engine
+ //
+ MrcWriteCR (MrcData, PCU_CR_M_COMP_PCU_REG, PcuCrMComp.Data);
+ MrcWait (MrcData, 8 * HPET_1US); // Wait for Comp to Complete
+ }
+
+ }
+ //
+ // Return the new comp code
+ //
+ switch (param) {
+ case DisOdtStatic:
+ case RdOdt:
+ DdrCrDataComp1.Data = MrcReadCR (MrcData, DDRCOMP_CR_DDRCRDATACOMP1_REG);
+ //
+ // re-Enable FixOdt feature after changing this param
+ //
+ DdrCrCompCtl0.Bits.DqOdtUpDnOff = DdrCrDataComp1.Bits.RcompOdtDown - DdrCrDataComp1.Bits.RcompOdtUp;
+ DdrCrCompCtl0.Bits.FixOdtD = 1;
+ MrcWriteCR (MrcData, DDRCOMP_CR_DDRCRCOMPCTL0_REG, DdrCrCompCtl0.Data);
+ if (UpdateHost) {
+ Outputs->CompCtl0 = DdrCrCompCtl0.Data;
+ }
+ return DdrCrDataComp1.Bits.RcompOdtUp;
+
+ case WrDS:
+ case SCompDq:
+ DdrCrDataComp0.Data = MrcReadCR (MrcData, DDRCOMP_CR_DDRCRDATACOMP0_REG);
+ return (param == WrDS) ? DdrCrDataComp0.Bits.RcompDrvUp : DdrCrDataComp0.Bits.SlewRateComp;
+
+ case WrDSCmd:
+ case SCompCmd:
+ DdrCrCmdComp.Data = MrcReadCR (MrcData, DDRCOMP_CR_DDRCRCMDCOMP_REG);
+ return (param == WrDSCmd) ? DdrCrCmdComp.Bits.RcompDrvUp : DdrCrCmdComp.Bits.Scomp;
+
+ case WrDSCtl:
+ case SCompCtl:
+ DdrCrCtlComp.Data = MrcReadCR (MrcData, DDRCOMP_CR_DDRCRCTLCOMP_REG);
+ return (param == WrDSCtl) ? DdrCrCtlComp.Bits.RcompDrvUp : DdrCrCtlComp.Bits.Scomp;
+
+ case WrDSClk:
+ case SCompClk:
+ DdrCrClkComp.Data = MrcReadCR (MrcData, DDRCOMP_CR_DDRCRCLKCOMP_REG);
+ return (param == WrDSClk) ? DdrCrClkComp.Bits.RcompDrvUp : DdrCrClkComp.Bits.Scomp;
+
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+/**
+ Programs Delay/Duration for the SenseAmp and MCODT based on RcvEn timing
+ Provide GuardBand > 0 if needed to be more conservative in timing
+ Main goal is to optimize power
+
+ @param[in,out] MrcData - Include all MRC global data.
+ @param[in] GuardBand - Input parameter with more conservative value
+
+ @retval Nothing
+**/
+void
+UpdateSampOdtTiming (
+ IN OUT MrcParameters *const MrcData,
+ IN const U8 GuardBand
+ )
+
+{
+ MrcOutput *Outputs;
+ MrcDebug *Debug;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ U16 *CurRcvEn;
+ U8 Channel;
+ U8 Byte;
+ U8 rank;
+ U16 MaxRcvEn;
+ U16 MinRcvEn;
+ U32 Offset;
+ U32 SWakeUp;
+ U32 SAWakeUppS; // Round up to nearest Qclk
+ S8 SOn; // SenseAmpDelay
+ S8 OOn; // OdtDelay
+ S32 SOff; // SenseAmpDuration
+ S32 OOff; // OdtDuration
+ DDRDATA0CH0_CR_DDRCRDATACONTROL1_STRUCT *DqControl1;
+
+ SAWakeUppS = 1250;
+ Outputs = &MrcData->SysOut.Outputs;
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ ControllerOut = &Outputs->Controller[0];
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "UpdateSampOdtTiming: GuardBand = %d\n", GuardBand);
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Ch %d\tOdtOn\tOdtOff\tSAmpOn\tSAmpOff\n", Channel);
+
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ MaxRcvEn = 0;
+ MinRcvEn = 512;
+
+ for (rank = 0; rank < MAX_RANK_IN_CHANNEL; rank++) {
+ if (MrcRankInChannelExist (MrcData, rank, Channel)) {
+ CurRcvEn = &ChannelOut->RcvEn[rank][Byte];
+ if (MaxRcvEn < *CurRcvEn) {
+ MaxRcvEn = *CurRcvEn;
+ }
+
+ if (MinRcvEn > *CurRcvEn) {
+ MinRcvEn = *CurRcvEn;
+ }
+ }
+ }
+ //
+ // Round Max to nearest cycle
+ //
+ MaxRcvEn = (MaxRcvEn >> 6) + 1;
+
+ //
+ // SENSE AMP CAN ONLY BE ON WHEN ODT IS ON FOR EOS REASONS.
+ // SWakeUp = (U32)( (SAWakeUppS + Outputs->Qclkps - 1) / Outputs->Qclkps );
+ // SOn = MinRcvEn - SWakeUp - GuardBand;
+ // OOn = MinRcvEn - 2 - GuardBand;
+ //
+ SWakeUp = (U32) ((64 * SAWakeUppS) / Outputs->Qclkps); // Convert to PI codes
+ //
+ // Turn On ODT & Samp at least 2 Qclks before earlier RcvEn Rise
+ //
+ if (SWakeUp < 128) {
+ SWakeUp = 128; // at least 2-Qclks
+ }
+
+ OOn = SOn = (S8) ((MinRcvEn - SWakeUp) >> 6) - GuardBand;
+ //
+ // SenseAmp Delay
+ //
+ if (SOn < -4) {
+ SOn = -4; // RcvEnPi[8:6] - 5 qclk
+ } else if (SOn > 6) {
+ SOn = 6; // RcvEnPi[8:6] + 5 qclk
+ }
+ //
+ // OdtDelay
+ //
+ if (OOn < -4) {
+ OOn = -4; // RcvEnPi[8:6] - 5 qclk
+ } else if (OOn > 6) {
+ OOn = 6; // RcvEnPi[8:6] + 5 qclk
+ }
+ //
+ // Turn Off Samp 1 qclk after postamble
+ // Turn Off ODT 1 qclk after postamble
+ // Program the duration to leave Odt/Samp On
+ // OnBeforeRcvEn BL+Post AfterPost CR Encoding
+ //
+ SOff = (MaxRcvEn - SOn) + (8 + 1) + 1 + GuardBand - 11;
+ OOff = (MaxRcvEn - OOn) + (8 + 1) + 1 + GuardBand - 11;
+
+ if (SOff < 0) {
+ SOff = 0; // 11 tQCK Min
+ } else if (SOff > 7) {
+ SOff = 7; // 18 tQCK Max
+ }
+
+ if (OOff < 0) {
+ OOff = 0; // 11 tQCK Min
+ } else if (OOff > 7) {
+ OOff = 7; // 18 tQCK mAx
+ }
+
+ DqControl1 = &ChannelOut->DqControl1[Byte];
+ DqControl1->Bits.OdtDelay = OOn;
+ DqControl1->Bits.OdtDuration = OOff;
+ DqControl1->Bits.SenseAmpDelay = SOn;
+ DqControl1->Bits.SenseAmpDuration = SOff;
+ Offset = DDRDATA0CH0_CR_DDRCRDATACONTROL1_REG +
+ ((DDRDATA1CH0_CR_DDRCRDATACONTROL1_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL1_REG) * Byte) +
+ ((DDRDATA0CH1_CR_DDRCRDATACONTROL1_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL1_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, DqControl1->Data);
+
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "%d:\t%d\t%d\t%d\t%d\n",
+ Byte,
+ DqControl1->Bits.OdtDelay,
+ DqControl1->Bits.OdtDuration,
+ DqControl1->Bits.SenseAmpDelay,
+ DqControl1->Bits.SenseAmpDuration
+ );
+ }
+ }
+ }
+
+ return;
+}
+
+/**
+ Turns off unused portions of the slave DLL to save power
+
+ @param[in,out] MrcData - Include all MRC global data.
+
+ @retval Nothing
+**/
+void
+UpdateSlaveDLLLength (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ U8 *CurRxDqs;
+ U32 Offset;
+ U8 Channel;
+ U8 byte;
+ U8 rank;
+ U8 MaxPi;
+
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerOut = &Outputs->Controller[0];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (byte = 0; byte < Outputs->SdramCount; byte++) {
+ MaxPi = 0;
+ for (rank = 0; rank < MAX_RANK_IN_CHANNEL; rank++) {
+ if (MrcRankInChannelExist (MrcData, rank, Channel)) {
+ CurRxDqs = &ChannelOut->RxDqsP[rank][byte];
+ if (MaxPi < *CurRxDqs) {
+ MaxPi = *CurRxDqs;
+ }
+
+ CurRxDqs = &ChannelOut->RxDqsN[rank][byte];
+ if (MaxPi < *CurRxDqs) {
+ MaxPi = *CurRxDqs;
+ }
+ }
+ }
+ //
+ // Update SlaveDLL Length for power Savings
+ // Calculate which segments to turn off:
+ // NEW (OFF: 0, PI<48: 0x2, PI<32: 0x4, PI<16: 0x6)
+ // results are: 0, 2 , 4 or 6
+ //
+ ChannelOut->DqControl1[byte].Bits.SdllSegmentDisable = ((7 - (MaxPi >> 3)) &~MRC_BIT0);
+ Offset = DDRDATA0CH0_CR_DDRCRDATACONTROL1_REG +
+ ((DDRDATA1CH0_CR_DDRCRDATACONTROL1_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL1_REG) * byte) +
+ ((DDRDATA0CH1_CR_DDRCRDATACONTROL1_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL1_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, ChannelOut->DqControl1[byte].Data);
+ }
+ }
+ }
+
+ return;
+}
+
+#ifdef TRAD_FLAG
+/**
+ Update Internal clocks on setting if needed.
+
+ @param[in,out] MrcData - Include all MRC global data.
+
+ @retval Nothing
+**/
+void
+UpdateInternalClksOn (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ U32 Offset;
+ U8 Channel;
+ U8 Byte;
+ S8 SOn; // SenseAmpDelay
+ S8 OOn; // OdtDelay
+ S32 SOff; // SenseAmpDuration
+ S32 OOff; // OdtDuration
+ U8 InternalClkOn;
+
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerOut = &Outputs->Controller[0];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ InternalClkOn = 0;
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ OOn = MrcSE ((U8) ChannelOut->DqControl1[Byte].Bits.OdtDelay, 4, 8);
+ OOff = ChannelOut->DqControl1[Byte].Bits.OdtDuration;
+ SOn = MrcSE ((U8) ChannelOut->DqControl1[Byte].Bits.SenseAmpDelay, 4, 8);
+ SOff = ChannelOut->DqControl1[Byte].Bits.SenseAmpDuration;
+
+ //
+ // Check if OdtDelay + OdtDuration >= 7 or if SADelay + SADuration >= 7
+ //
+ if (((OOn + OOff) >= 7) || ((SOn + SOff) >= 7)) {
+ InternalClkOn = 1;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "ODTOn = %d, ODTOff = %d\n", OOn, OOff);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "SAOn = %d, SAOff = %d\n", SOn, SOff);
+ break;
+ }
+ }
+
+ ChannelOut->DqControl0.Bits.InternalClocksOn = InternalClkOn;
+ Offset = DDRDATACH0_CR_DDRCRDATACONTROL0_REG +
+ ((DDRDATACH1_CR_DDRCRDATACONTROL0_REG - DDRDATACH0_CR_DDRCRDATACONTROL0_REG) * Channel);
+ MrcWriteCrMulticast (MrcData, Offset, ChannelOut->DqControl0.Data);
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "C%dDdrCrDataControl0.Data = 0x%x\n",
+ Channel,
+ ChannelOut->DqControl0.Data
+ );
+ }
+ }
+
+ return;
+}
+#endif // TRAD_FLAG
+
+/**
+ This function Shifts the CMD timing.
+ NOTE: ONLY one, ResetDDR or SelfRefresh can be set inside this function
+
+ @param[in,out] MrcData - Include all MRC global data.
+ @param[in] Ranks - Parameter defining the desired global compensation logic
+ @param[in] offset - per channel Value to shift picode for
+ @param[in] ResetDDR - Do we reset DDR?
+ @param[in] SelfRefresh - Do we perform Self refresh?
+ @param[in] UpdateHost - Determines if MrcData has to be updated
+ @param[in] SkipTx - Determines if TX update should be skipped
+ @todo: SkipTx is NOT USED at this time and we don't skip it anyway
+
+ @retval MrcStatus - If it succeeds return mrcSuccess
+**/
+MrcStatus
+ShiftCh2Ch (
+ IN OUT MrcParameters *const MrcData,
+ IN const U8 Ranks,
+ IN const U8 *const offset,
+ IN U8 ResetDDR,
+ IN const U8 SelfRefresh,
+ IN const U8 UpdateHost,
+ IN const U8 SkipTx
+ )
+{
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ MrcStatus Status;
+ U8 Channel;
+ U8 Rank;
+ U8 RankMaskCh;
+ S32 NewValue;
+ S32 Offset;
+ BOOL Lpddr;
+
+ Status = mrcSuccess;
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerOut = &Outputs->Controller[0];
+ Lpddr = (Outputs->DdrType == MRC_DDR_TYPE_LPDDR3);
+
+ if (SelfRefresh && ResetDDR) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_ERROR,
+ "WARNING SelfRefresh OR ResetDDR can be set at once...performing SelfRefresh\n"
+ );
+ ResetDDR = 0;
+ }
+
+ if (SelfRefresh) {
+ EnterSR (MrcData);
+ }
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!MrcChannelExist (Outputs, Channel)) {
+ continue;
+ }
+
+ ChannelOut = &ControllerOut->Channel[Channel];
+ RankMaskCh = Ranks & ChannelOut->ValidRankBitMask;
+
+ if (RankMaskCh == 0) {
+ continue;
+ }
+
+ Offset = offset[Channel];
+
+ //
+ // Shift CLK (this will shift DQ PIs as well)
+ //
+ ShiftPIforCmdTraining (MrcData, Channel, MrcIterationClock, RankMaskCh, 3, Offset, UpdateHost);
+
+ //
+ // Shift CTL
+ //
+ NewValue = 0;
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if (RankMaskCh & (1 << Rank)) {
+ NewValue = ChannelOut->CtlPiCode[Rank] + Offset;
+ break;
+ }
+ }
+
+ ShiftPIforCmdTraining (MrcData, Channel, MrcIterationCtl, RankMaskCh, 1, NewValue, UpdateHost);
+
+ //
+ // Shift CmdS
+ //
+ ShiftPIforCmdTraining (
+ MrcData,
+ Channel,
+ MrcIterationCmdS,
+ RankMaskCh,
+ 1,
+ ChannelOut->CmdsCmdPiCode[0] + Offset,
+ UpdateHost
+ );
+
+ //
+ // Shift CmdN
+ //
+ ShiftPIforCmdTraining (
+ MrcData,
+ Channel,
+ MrcIterationCmdN,
+ RankMaskCh,
+ 1,
+ ChannelOut->CmdnCmdPiCode[0] + Offset,
+ UpdateHost
+ );
+
+#ifdef ULT_FLAG
+ if (Lpddr) {
+ //
+ // For LPDDR need to shift CmdS PiCode[1] separately.
+ // Host struct is not updated, so update PiCode[0] manually, and then restore back.
+ //
+ ChannelOut->CmdsCmdPiCode[0] = ChannelOut->CmdsCmdPiCode[0] + Offset;
+ ShiftPIforCmdTraining (
+ MrcData,
+ Channel,
+ MrcIterationCmdS,
+ RankMaskCh,
+ 2,
+ ChannelOut->CmdsCmdPiCode[1] + Offset,
+ UpdateHost
+ );
+ ChannelOut->CmdsCmdPiCode[0] = ChannelOut->CmdsCmdPiCode[0] - Offset;
+ }
+#endif // ULT_FLAG
+ //
+ // Shift CKE
+ //
+ ShiftPIforCmdTraining (
+ MrcData,
+ Channel,
+ MrcIterationCke,
+ RankMaskCh,
+ 1,
+ ChannelOut->CkeCmdPiCode[0] + Offset,
+ UpdateHost
+ );
+ } // for Channel
+ //
+ // Reset DDR is required
+ //
+ if (ResetDDR) {
+ Status = MrcResetSequence (MrcData);
+ } else if (SelfRefresh) {
+ ExitSR (MrcData);
+ }
+
+ return Status;
+}
+
+/**
+ Returns the index into the array OptResult in the MrcOutput structure.
+
+ @param[in] OptParam - Margin parameter
+
+ @retval One of the following values: RdSAmpOfft(0), WrDSOfft (1), RxEqOfft(2), TxEqOfft (3), RdOdtOfft(4)
+**/
+U8
+GetOptResultType (
+ IN U8 OptParam
+ )
+{
+ switch (OptParam) {
+ case OptRxBias:
+ return RdSAmpOfft;
+
+ case OptWrDS:
+ return WrDSOfft;
+
+ case OptRxEq:
+ return RxEqOfft;
+
+ case OptTxEq:
+ return TxEqOfft;
+
+ case OptRdOdt:
+ return RdOdtOfft;
+
+ default:
+ return 0; // Return RdSAmpOfft to point to the beginning of the array
+ }
+}
+
+/**
+ Program DimmOptPoint values on CPU and DIMM sides, such as DIMM ODT, CPU ODT, Ron, Slew Rate, Equalization.
+
+ @param[in,out] MrcData - Include all MRC global data.
+ @param[in] ChMask - Channel to work on.
+ @param[in,out] BestDimmOptPoint - Best DIMM Opt settings used to update hardware
+ @param[in] SkipGRdOdt - Switch to skip updating CPU ODT
+ @param[in] SkipDimmOdts - Switch to skip updating DIMM ODT
+ @param[in] SkipBestOffsets - Switch to skip updating Opt settings
+ @param[in] UpdateHost - Switch to skip updating MRC host structure
+
+ @retval Nothing
+**/
+void
+UpdateOdtsValues (
+ IN OUT MrcParameters *const MrcData,
+ IN U8 ChMask,
+ IN OUT DimmOptPoint *BestDimmOptPoint,
+ IN BOOL SkipGRdOdt,
+ IN BOOL SkipDimmOdts,
+ IN BOOL SkipBestOffsets,
+ IN BOOL UpdateHost
+ )
+{
+ MrcOutput *Outputs;
+ U8 byte;
+ U8 rank;
+ U8 Channel;
+ U8 offset;
+ U8 Dimm;
+ U8 test;
+ U8 TestArray[5];
+ BOOL DebugPrint;
+ U8 OptParam;
+ U8 NumTests;
+ const MrcDebug *Debug;
+
+ Outputs = &MrcData->SysOut.Outputs;
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ NumTests = BestDimmOptPoint->OptParamTestListSize;
+ DebugPrint = 0;
+
+ MrcOemMemorySet (TestArray, 0, sizeof (TestArray));
+ if (SkipBestOffsets) {
+ NumTests = 0;
+ }
+ //
+ // build tests array to update RdSAmpOfft(0), WrDSOfft (1), RxEqOfft(2), TxEqOfft (3), RdOdtOfft(4)
+ //
+ for (test = 0; test < NumTests; test++) {
+ OptParam = BestDimmOptPoint->OptParamTestList[test];
+ TestArray[GetOptResultType (OptParam)] = 1;
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "Test - %s : %d ,UpdateHost: %d\n",
+ TOptParamOffsetString[OptParam],
+ test,
+ UpdateHost
+ );
+ }
+
+ if (!SkipGRdOdt) {
+ //
+ // update GRdOdt
+ //
+ BestDimmOptPoint->ODTSet.GRdOdtCode = UpdateCompGlobalOffset (
+ MrcData,
+ RdOdt,
+ (U8) BestDimmOptPoint->ODTSet.GRdOdt,
+ UpdateHost
+ );
+ if (DebugPrint) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "best GRdODT aplly is : %d \n",
+ CalcRdOdt (MrcData, BestDimmOptPoint->ODTSet.GRdOdt)
+ );
+ }
+ }
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!(MrcChannelExist (Outputs, Channel))) {
+ continue; // Not valid channel
+ }
+
+ if (!((MRC_BIT0 << Channel) & ChMask)) {
+ continue;
+ }
+
+ offset = 1;
+ if ((Outputs->Controller[0].Channel[Channel].DimmCount == 1)) {
+ offset = 0; // disable dynamic odt
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ //
+ // set RttNom=write and RttWr=0
+ //
+ BestDimmOptPoint->ODTSet.RttNom[Channel][Dimm] = BestDimmOptPoint->ODTSet.RttWr[Channel][Dimm];
+ }
+ }
+#ifdef ULT_FLAG
+ if (MrcData->SysIn.Inputs.CpuModel == cmHSW_ULT) {
+ //
+ // On ULT (1DPC) DIMM ODT is connected to Vdd, so RttNom must be disabled
+ //
+ offset = 1;
+ BestDimmOptPoint->ODTSet.RttNom[Channel][0] = 0;
+ BestDimmOptPoint->ODTSet.RttNom[Channel][1] = 0;
+ BestDimmOptPoint->ODTSet.RttWr[Channel][1] = 0;
+ }
+#endif //ULT_FLAG
+
+ //
+ // Apply Best RTT Points
+ //
+ if (!SkipDimmOdts) {
+ UpdateOptParamOffset (
+ MrcData,
+ Channel,
+ 0x3,
+ 0,
+ OptDimmOdt,
+ (S16)
+ (
+ ((offset * BestDimmOptPoint->ODTSet.RttWr[Channel][0]) << 4) +
+ (BestDimmOptPoint->ODTSet.RttNom[Channel][0])
+ ),
+ UpdateHost
+ );
+ UpdateOptParamOffset (
+ MrcData,
+ Channel,
+ 0xC,
+ 0,
+ OptDimmOdt,
+ (S16)
+ (
+ ((offset * BestDimmOptPoint->ODTSet.RttWr[Channel][1]) << 4) +
+ (BestDimmOptPoint->ODTSet.RttNom[Channel][1])
+ ),
+ UpdateHost
+ );
+ if (DebugPrint) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "best RttNom0 aplly is : %d\t\n",
+ ActualDimmOdt[BestDimmOptPoint->ODTSet.RttNom[Channel][0]]
+ );
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "best RttNom1 aplly is : %d\t\n",
+ ActualDimmOdt[BestDimmOptPoint->ODTSet.RttNom[Channel][1]]
+ );
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "best RttWr0 aplly is : %d\t\n",
+ ActualDimmOdt[BestDimmOptPoint->ODTSet.RttWr[Channel][0]]
+ );
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "best RttWr1 aplly is : %d\t\n",
+ ActualDimmOdt[BestDimmOptPoint->ODTSet.RttWr[Channel][1]]
+ );
+ }
+ }
+
+ if (NumTests) {
+ for (byte = 0; byte < Outputs->SdramCount; byte++) {
+ //
+ // Apply Best RdOdt and WrDS
+ // OdtOff = Off[RdOdtOfft][0][Channel][byte] + RdOdtChOffset[Channel];
+ //
+ if (TestArray[RdSAmpOfft]) {
+ //
+ // OptRdOdt->OptRxBias
+ //
+ UpdateOptParamOffset (
+ MrcData,
+ Channel,
+ 0xF,
+ byte,
+ OptRxBias,
+ BestDimmOptPoint->BestOptOff[RdSAmpOfft][0].Offset[Channel][byte],
+ UpdateHost
+ );
+ }
+
+ if (TestArray[WrDSOfft]) {
+ UpdateOptParamOffset (
+ MrcData,
+ Channel,
+ 0xF,
+ byte,
+ OptWrDS,
+ BestDimmOptPoint->BestOptOff[WrDSOfft][0].Offset[Channel][byte],
+ UpdateHost
+ );
+ }
+
+ if (DebugPrint) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "enable=%d best WrDSOfft byte %d is : %d\t\n",
+ TestArray[WrDSOfft],
+ byte,
+ BestDimmOptPoint->BestOptOff[WrDSOfft][0].Offset[Channel][byte]
+ );
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "enable=%d best RdSAmpOfft byte %d is : %d\t\n",
+ TestArray[RdSAmpOfft],
+ byte,
+ BestDimmOptPoint->BestOptOff[RdSAmpOfft][0].Offset[Channel][byte]
+ );
+ }
+
+ for (rank = 0; rank < MAX_RANK_IN_CHANNEL; rank++) {
+ if (!MrcRankInChannelExist (MrcData, rank, Channel)) {
+ continue;
+ }
+ //
+ // Apply Best Tx/Rx EQ Codes
+ //
+ if (TestArray[RxEqOfft]) {
+ UpdateOptParamOffset (
+ MrcData,
+ Channel,
+ (MRC_BIT0 << rank),
+ byte,
+ OptRxEq,
+ BestDimmOptPoint->BestOptOff[RxEqOfft][rank].Offset[Channel][byte],
+ UpdateHost
+ );
+ }
+
+ if (TestArray[TxEqOfft]) {
+ UpdateOptParamOffset (
+ MrcData,
+ Channel,
+ (MRC_BIT0 << rank),
+ byte,
+ OptTxEq,
+ BestDimmOptPoint->BestOptOff[TxEqOfft][rank].Offset[Channel][byte],
+ UpdateHost
+ );
+ }
+
+ if (DebugPrint) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "enable=%d best OptRxEq rank%d byte %d is : %d\t\n",
+ TestArray[RxEqOfft],
+ rank,
+ byte,
+ BestDimmOptPoint->BestOptOff[RxEqOfft][rank].Offset[Channel][byte]
+ );
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "enable=%d best OptTxEq rank%d byte %d is : %d\t\n",
+ TestArray[TxEqOfft],
+ rank,
+ byte,
+ BestDimmOptPoint->BestOptOff[TxEqOfft][rank].Offset[Channel][byte]
+ );
+ }
+ }
+ }
+ }
+ }
+}
+
+/**
+ Calculate Power based on Ron and Rodt
+ Includes both static power from Ron/Rodt and dynamic power from Cpad/Cline
+ The power results here are not absolutely correct but give a reasonable estimate (ie: within 2x) with the proper trends
+ Getting absolutely correct power numbers with simple calculations is fairly difficult given the transmission line nature of the system
+ Driver power is calculated as the amount of power drawn from the CPU pin (do we want this to be thermal power instead?) based on the Ron and ODTeff
+ ODTeff is calculated as both the real, resistive ODT on the bus in parallel with the effective impendence of the cap on the line
+ This effective impedance is how AC power is included in the measurements
+ This better models the real system behavior where the power consumed due to dynamic power reduces as termination strength increases
+ ODT power is calculated as a purely DC term based on Ron and Rodt
+ The final power reported back is a scaled version of the CPU and DRAM power
+ This allows one to weight the CPU vs. DRAM power differently in the optimization function based on what is more important
+ CPU power is generally more important since it can be translated into additional performance
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[out] Results - Results of the Power power calculations
+ @param[in] RonCpu - RON CPU value (ohm)
+ @param[in] RonDimm - RON DIMM value (ohm)
+ @param[in] Rodtcpu - RODT CPU value
+ @param[in] Rodtdram - RODT DRAM value
+ @param[in] Wodtdram - WODT DRAM value
+
+ @retval Nothing
+**/
+void
+CalcPower (
+ IN MrcParameters *MrcData,
+ OUT MrcPower *Results,
+ IN U16 RonCpu,
+ IN U8 RonDimm,
+ IN U16 Rodtcpu,
+ IN U16 Rodtdram,
+ IN U16 Wodtdram
+ )
+{
+ const MrcInput *Inputs;
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ U16 CapTotal;
+ U32 CapOdt;
+ U32 Rodt;
+ U32 Vx;
+ U32 Vy;
+ U32 Ix;
+ U32 Iy;
+ U32 DrvPwr;
+ U32 ACPowerRd;
+ U32 ACPowerWr;
+ //
+ // Power Results;
+ //
+ U16 ScaleCpuPwr;
+ U16 ScaleDramPwr;
+ U16 LineLength; // cm
+ U16 Cpad; // pF
+ U32 Derating;
+ U32 ACPower;
+ U32 Vswing;
+ U16 CapPerLength; // pF/cm
+ U16 Freq; // Ghz
+ U16 FreqEff;
+ U16 Pi; // 3.14;
+ U16 Vdd; // 1.5; mV
+ U16 SRDimm; // 15ohm serial resistance
+ U16 NormFactor;
+
+ Vx = 0;
+ Vy = 0;
+ Ix = 0;
+ Iy = 0;
+ ScaleCpuPwr = 1;
+ ScaleDramPwr = 1;
+ LineLength = 10;
+ Cpad = 4;
+ CapPerLength = 2;
+ Pi = 3;
+ SRDimm = 15;
+ NormFactor = 100; // if 1000 we get mW
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ Vdd = Outputs->VddVoltage[Inputs->MemoryProfile];
+ Freq = (U16) (Outputs->Frequency);
+ Freq /= 100; // in 10xGhz
+ //
+ // capacitance for AC power
+ // Cut real cap in half and add 10pF offset to better match curves - results x100 pf
+ // Fixed frequency at 500 MHz(~Data Rate/4 assuming random 1100 type data) - resutls is 100x Ghz
+ // In general, most of the simulations show fairly flat AC power vs. frequency
+ //
+ CapTotal = (Cpad + LineLength * CapPerLength) * 45;
+ FreqEff = 50;
+ CapOdt = 10000000 / (2 * Pi * CapTotal * FreqEff); // Scale Up by 2.5x to better match curves
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "RonDimm=%d Rodtcpu=%d Wodtdram=%d Rodtdram=%d RonCpu=%d CapOdt=%d\n",RonDimm,Rodtcpu,Wodtdram,Rodtdram,RonCpu,CapOdt);
+ // for read
+ //
+ Rodt = (Rodtcpu * (Rodtdram + SRDimm)) / (Rodtcpu + (Rodtdram + SRDimm));
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "(Rodtdram+SRDimm)=%d Rodtcpu=%d Rodt=%d \n",(Rodtdram+SRDimm),Rodtcpu,Rodt);
+ Derating = 1000 * Rodt / (Rodt + CapOdt); // Derate ACPower based on ratio of Real ODT vs. "0DT" due to cap
+ Ix = Vdd / 2 / (RonDimm + SRDimm + Rodt); // mA
+ Vx = Vdd - Ix * (RonDimm + SRDimm); // voltage after dimm driver+15ohm
+ DrvPwr = Ix * Ix * (RonDimm + SRDimm) / NormFactor; // dimm Ron static power
+ Vswing = 2 * Vx - Vdd; // for ACpower= Vh-Vl
+ //
+ // Calculate power associated with swing that cap - mV/1000*pf/100*Ghz/100000
+ //
+ ACPower = Vswing * Vswing / 1000 * CapTotal * FreqEff / 100 / 100 / NormFactor;
+ ACPowerRd = ACPower * Derating / 1000; // mW
+ //MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "read ACPowerRd=%d ACPower=%d Derating=%d Vswing=%d Rodt=%d Ix=%d,Vx=%d,PwrDrv=%d,FreqEff=%d CapOdt=%d Rodt=%d ,DrvPwr=%d\n",ACPowerRd,ACPower,Derating,Vswing,Rodt,Ix,Vx,DrvPwr,FreqEff,CapOdt,Rodt,DrvPwr);
+ Results->CpuPwrRd = ((Vdd - Vx) * (Vdd - Vx) + Vx * Vx) / (2 * Rodtcpu * NormFactor); // mW @todo:add RxBias?
+ Iy = (Vx - Vdd / 2) / (Rodtdram + SRDimm); // current in to the NT dimm
+ Vy = Vx - Iy * (SRDimm); // voltage after 15 ohm inside the dimm
+ Results->DimmPwrRd = Iy *
+ Iy *
+ SRDimm /
+ NormFactor +
+ ((Vdd - Vy) * (Vdd - Vy) + Vy * Vy) /
+ (2 * Rodtdram * NormFactor) +
+ DrvPwr; // mW
+ //
+ // for write
+ //
+ Rodt = (Wodtdram + SRDimm) * (Rodtdram + SRDimm) / ((Wodtdram + SRDimm) + (Rodtdram + SRDimm));
+ Derating = 1000 * Rodt / (Rodt + CapOdt); // De-rate ACPower based on ratio of Real ODT vs. "0DT" due to cap
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Rodt=%d Derating=%d ",Rodt,Derating);
+ Ix = Vdd / 2 / (RonCpu + Rodt); // mA
+ Vx = Vdd - Ix * (RonCpu); // voltage after cpu driver
+ DrvPwr = Ix * Ix * (RonCpu) / NormFactor; // cpu Ron static power
+ Vswing = 2 * Vx - Vdd; // for ACpower
+ //
+ // Calculate power associated with swing that cap
+ //
+ ACPower = Vswing * Vswing / 1000 * CapTotal * FreqEff / 100 / 100 / NormFactor;
+ ACPowerWr = ACPower * Derating / 1000; // mW
+ //MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "write ACPowerWr=%d ACPower=%d Derating=%d Vswing=%d Rodt=%d Ix=%d,Vx=%d,PwrDrv=%d,FreqEff=%d CapOdt=%d Rodt=%d ,DrvPwr=%d\n",ACPowerWr,ACPower,Derating,Vswing,Rodt,Ix,Vx,DrvPwr,FreqEff,CapOdt,Rodt,DrvPwr);
+ Results->CpuPwrWr = DrvPwr; // mW
+ Iy = (Vx - Vdd / 2) / (Wodtdram + SRDimm); // current in to the T dimm
+ Vy = Vx - Iy * (SRDimm); // voltage after 15 ohm inside the dimm
+ Results->DimmPwrWrT = Iy * Iy * SRDimm / NormFactor + ((Vdd - Vy) * (Vdd - Vy) + Vy * Vy) / (2 * Wodtdram * NormFactor); // mW
+ Iy = (Vx - Vdd / 2) / (Rodtdram + SRDimm); // current in to the NT dimm
+ Vy = Vx - Iy * (SRDimm); // voltage after 15 ohm inside the dimm
+ Results->DimmPwrWrNT = Iy * Iy * SRDimm / NormFactor + ((Vdd - Vy) * (Vdd - Vy) + Vy * Vy) / (2 * Rodtdram * NormFactor); // mW
+
+ //
+ // ScaleCpuPwr and ScaleDramPwr allows one to tradeoff CPU vs. DRAM power
+ //
+ Results->ACPowerRd = ACPowerRd;
+ Results->ACPowerWr = ACPowerWr;
+ Results->TotPwr = (U16)
+ (
+ 60 * (Results->CpuPwrRd * ScaleCpuPwr + Results->DimmPwrRd * ScaleDramPwr + ACPowerRd * ScaleDramPwr) + 40 *
+ (
+ (Results->DimmPwrWrT + Results->DimmPwrWrNT) *
+ ScaleDramPwr +
+ Results->CpuPwrWr *
+ ScaleCpuPwr +
+ ACPowerWr *
+ ScaleCpuPwr
+ )
+ ) / 100;
+ Results->ACPower = (60 * ACPowerRd + 40 * ACPowerWr) / 100;
+ Results->CpuPower = (U16)
+ (
+ 60 * (Results->CpuPwrRd * ScaleCpuPwr ) + 40 *
+ (
+ Results->CpuPwrWr *
+ ScaleCpuPwr +
+ ACPowerWr *
+ ScaleCpuPwr
+ )
+ ) / 100;
+
+ Results->DimmPwr = (U16)
+ (
+ 60 * (Results->DimmPwrRd * ScaleDramPwr + ACPowerRd * ScaleDramPwr) + 40 *
+ (
+ (Results->DimmPwrWrT + Results->DimmPwrWrNT) *
+ ScaleDramPwr
+ )
+ ) / 100;
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " PwrTotal=%d DimmPwrR=%d DimmPwrWrT=%d DimmPwrWrNT=%d PwrDrvR=%d Rodt=%d PwrDrvW=%d\n",Results->TotPwr,Results->DimmPwrRd,Results->DimmPwrWrT,Results->DimmPwrWrNT,ACPowerRd,Rodt,ACPowerWr);
+ return;
+}
+
+/**
+ Calculate Power Trend line based on Cpu and Dimms Ron and Odt's
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Channel - Channel to work on.
+ @param[in] DimmMask - DIMMs to work on.
+ @param[in,out] DimmOptPoints - Structure of all the DIMM ODT optimal settings.
+ @param[in] Points2calc - Data to build the trendline on.
+ @param[in] ArrayLength - Array length of Points2calc.
+ @param[in] LenMargin - The length of inputMargins we are optimizing (0 - LenMargin -1).
+ @param[in] TestList - TestList index in Points2cal: WrVref, RdVref, WrT, RdT
+ @param[in] Scale - Scale to apply per test to Points2calc
+ @param[in] TestListSize - Size of TestList/Scale
+ @param[in] PwrCalc1d - Determines if the power test is 1-D or 2-D.
+ @param[in] PWRTrendSlope - Determines how aggressive the T-line will be.(0%-100%)
+
+ @retval Nothing
+**/
+void
+CalcPowerTrend (
+ IN MrcParameters *MrcData,
+ IN U8 Channel,
+ IN U8 DimmMask,
+ IN OUT void *DimmOptPoints,
+ IN void *Points2calc,
+ IN U8 ArrayLength,
+ IN U8 LenMargin,
+ IN U8 *TestList,
+ IN U8 *Scale,
+ IN U8 TestListSize,
+ IN BOOL PwrCalc1d,
+ IN U8 PWRTrendSlope
+ )
+{
+ const MrcDebug *Debug;
+ MrcChannelOut *ChannelOut;
+ U16 MaxPoints[4];
+ U16 MinPoints[4];
+ U16 MaxPwr;
+ U16 MinPwr;
+ U8 off;
+ U8 test;
+ U8 dimm;
+ U8 TestParam;
+ MrcPower PwrRes;
+ U16 AveOfMax;
+ U16 X;
+ S16 MinRatio;
+ S16 Ratio;
+ U16 Slope;
+ U16 SlopeOver100;
+ U16 Rodtcpu;
+ U8 RonDimm;
+ U8 RonCpu;
+ U16 Rodtdram;
+ U16 Wodtdram;
+ U16 *Points;
+ U16 *PointsElement;
+ DimmOptPoint *DimmPoints;
+ U8 dimmcount;
+ BOOL is1DPC;
+ U16 AvgROdt;
+
+ ChannelOut = &MrcData->SysOut.Outputs.Controller[0].Channel[Channel];
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ Points = (U16 *) Points2calc;
+ is1DPC = (ChannelOut->DimmCount == 1);
+ MaxPwr = 0;
+ MinPwr = 0xffff;
+ Wodtdram = 0;
+
+ MrcOemMemorySet ((U8 *) &PwrRes, 0, sizeof (PwrRes));
+ MrcOemMemorySetWord (MaxPoints, 0, sizeof (MaxPoints) / sizeof (U16));
+ MrcOemMemorySetWord (MinPoints, 0xFFFF, sizeof (MinPoints) / sizeof (U16));
+
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "TestListSize=%d\n",TestListSize);
+ //
+ for (off = 0; off < LenMargin; off++) {
+ //
+ // sorting the min max power points
+ //
+ for (test = 0; test < TestListSize; test++) {
+ //
+ // sorting the min max margin points for each test
+ //
+ PointsElement = (Points + ArrayLength * test + off);
+ if (MaxPoints[test] < *PointsElement) {
+ MaxPoints[test] = *PointsElement;
+ }
+
+ if (MinPoints[test] > *PointsElement) {
+ MinPoints[test] = *PointsElement;
+ }
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "*(Points+ArrayLength*test+off)=%d (Points+ArrayLength*test+off)=%x\n",*(Points+ArrayLength*test+off),(Points+ArrayLength*test+off));
+ //
+ }
+
+ if (!PwrCalc1d) {
+ DimmPoints = (DimmOptPoint *) DimmOptPoints;
+ RonDimm = 0;
+ RonCpu = 30;
+ Rodtcpu = CalcRdOdt (MrcData, (DimmPoints + off)->ODTSet.GRdOdt);
+ dimmcount = 0;
+ AvgROdt = 0;
+ for (dimm = 0; dimm < MAX_DIMMS_IN_CHANNEL; dimm++) {
+ if (!((MRC_BIT0 << dimm) & DimmMask)) {
+ continue;
+ }
+ //
+ // read from MR1 the DimmRon
+ //
+ RonDimm += (U8) CalcOptPower (MrcData, Channel, 2 * dimm, 0, OptDimmRon, 0, 0, 1);
+ Rodtdram = ActualDimmOdt[(DimmPoints + off)->ODTSet.RttNom[Channel][dimm]];
+ Wodtdram = ActualDimmOdt[(DimmPoints + off)->ODTSet.RttWr[Channel][dimm]];
+ if (is1DPC) { // in 1DPC channel always use only one of the terminations
+ if (Wodtdram == 0) {
+ Wodtdram = Rodtdram;
+ }
+ Rodtdram = 0x3fff; // put 8k ohm as infinity
+ }
+
+ if (Rodtdram == 0) {
+ Rodtdram = 0x3fff;
+ }
+
+ if (Wodtdram == 0) {
+ Wodtdram = Rodtdram; // in 2DPC with RttW=0
+ }
+
+ AvgROdt += Rodtdram;
+ dimmcount++;
+ }
+
+ AvgROdt = (dimmcount != 0) ? AvgROdt / dimmcount : AvgROdt;
+ RonDimm = (dimmcount != 0) ? RonDimm / dimmcount : RonDimm;
+ if ((120 < AvgROdt) && (AvgROdt < 0x3fff)) {
+ Rodtdram = 240; // the mix case of one open and one not
+ } else {
+ Rodtdram = AvgROdt; // for write average not needed because its by dimm
+ }
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "input for power calc Wodtdram=%d Rodtdram=%d RonDimm=%d \n",Wodtdram,Rodtdram,RonDimm);
+ //
+ PointsElement = (Points + ArrayLength * TestListSize + off);
+ CalcPower (MrcData, &PwrRes, RonCpu, RonDimm, Rodtcpu, Rodtdram, Wodtdram);
+ *PointsElement = PwrRes.TotPwr;
+ (DimmPoints + off)->PowerCalc = PwrRes;
+
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Rodtcpu=%d Wodtdram=%d EqRodtdram=%d Calcpower=%d\n",Rodtcpu,Wodtdram,Rodtdram,*(Points+ArrayLength*test+off));
+ //
+ } else {
+ PointsElement = (Points + ArrayLength * TestListSize + off);
+ }
+
+ if (MaxPwr < *PointsElement) {
+ MaxPwr = *PointsElement;
+ }
+
+ if (MinPwr > *PointsElement) {
+ MinPwr = *PointsElement;
+ }
+
+ if (LenMargin == 1) {
+ MaxPwr = *PointsElement;
+ MinPwr = 0;
+ }
+ }
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "MaxPwr=%d MinPwr=%d\n",MaxPwr,MinPwr);
+ //
+ AveOfMax = 0;
+ MinRatio = 0x7fff;
+ for (test = 0; test < TestListSize; test++) {
+ AveOfMax += MaxPoints[test];
+ //
+ // map Test to TestParam
+ //
+ TestParam = TestList[test];
+ Ratio = (100 * (MaxPoints[test] / Scale[test] - UpmPwrLimitValue (MrcData, TestParam, UpmLimit))) /
+ (UpmPwrLimitValue (MrcData, TestParam, PowerLimit) - UpmPwrLimitValue (MrcData, TestParam, UpmLimit));
+ if (MinRatio > Ratio) {
+ MinRatio = Ratio;
+ }
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "AveOfMax=%d MinRatio=%d MaxPoints[%d]=%d Scale[%d]=%d \n",AveOfMax,MinRatio,test,MaxPoints[test],test,Scale[test]);
+ //
+ }
+
+ AveOfMax = AveOfMax / TestListSize;
+ //
+ // if MaxPoint > UPM Limit: PwrTrend should be flat
+ // if MaxPoints == PwrLimit: PwrTrend should have slope going from AveOfMax to (1-PWRTrendSlope/100)*AveOfMax
+ // PwrTrend will be a linear slope going from (MinPwr, (1- PWRTrendSlope/100)*AveOfMax) to (MaxPwr, AveOfMax)
+ //
+ Slope = (PWRTrendSlope * MinRatio) / 100;
+ SlopeOver100 = 0;
+ if (Slope > 100) {
+ //
+ // could only happen if no power limits
+ //
+ SlopeOver100 = Slope - 100;
+ Slope = 100;
+ }
+
+ for (off = 0; off < LenMargin; off++) {
+ PointsElement = (Points + ArrayLength * TestListSize + off);
+ if (MinRatio < 0) {
+ *PointsElement = 1;
+ } else {
+ if (MaxPwr == MinPwr) {
+ X = 0; // no power consideration and not divide by zero
+ } else {
+ //
+ // % of where you are between Min and Max Pwr. X=0 should be MaxPwr and 100 should be MinPwr
+ //
+ X = 100 - 100 * (*PointsElement - MinPwr) / (MaxPwr);
+ }
+ //
+ // Create a linear line based on Power from (1 - PWRTrendSlope / 100) * AveOfMax to AveOfMax
+ // Adding a specicial case for TX XTalk: If PWRTrendSlope = 0 and ArrayLength = BIT_TX_XTALK_RANGE
+ // just multiply power numbers by AveOfMax.
+ //
+ if ((PWRTrendSlope == 0) && (ArrayLength == BIT_TX_XTALK_RANGE)) {
+ *PointsElement = *PointsElement * AveOfMax / 100;
+ } else {
+ *PointsElement = AveOfMax * (100 - Slope + (((Slope + SlopeOver100) * X) / 100)) / 100;
+ }
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "power trend Points[%d][%d]=%d\n",TestListSize,off,*(Points+ArrayLength*TestListSize+off));
+ //
+ }
+ }
+}
+
+#ifdef MRC_DEBUG_PRINT
+
+#if 0 // This function is not used right now
+/**
+ Prints OptParam values from CRs and Host structure for all ch/Rank/byte as well as
+ the Best optimization value (if requested)
+ OptWrDS = 0
+ OptRdOd = 1
+ OptSCom = 2
+ OptTComp = 3
+ OptTxEq = 4
+ OptRxEq = 5
+ OptRxBias = 6
+ OptDimmOdt = 7
+ OptDimmOdtWr = 8
+ OptDimmRon = 9
+ OptDefault = 10
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] ChMask - Channel Mask to print the summary for
+ @param[in] RankMask - Rank Mask to print the summary for (in case Rank is not applicable set RankMask = 0xF)
+ @param[in] OptParam - Defines the OptParam Offsets. OptDefault reports all parameters
+ @param[in] OptOff - Structure containg the best offest and margins for the OptParam.
+ If OptOffsetChByte is not available, NullPtr needs to be passed (void *NullPtr)
+ @param[in] OptResult - True/False: Whether to print the Best optimization value
+
+ @retval Nothing
+**/
+void
+ReadOptParamOffsetSum (
+ IN MrcParameters *const MrcData,
+ IN U8 ChMask,
+ IN U8 RankMask,
+ IN const U8 OptParam,
+ IN OptOffsetChByte *OptOff,
+ IN BOOL OptResult
+ )
+{
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ U8 Channel;
+ U8 Rank;
+ U8 Byte;
+ U8 Param;
+ U8 NumBytes;
+ U8 ChannelMask;
+ S16 OffArr[2];
+ S16 Best;
+ BOOL PerRank;
+ BOOL SkipByte;
+
+ Outputs = &MrcData->SysOut.Outputs;
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ ChannelMask = Outputs->ValidChBitMask & ChMask;
+ NumBytes = (U8) Outputs->SdramCount;
+ MrcOemMemorySetWord ((U16 *) OffArr, (U16) 0, sizeof (OffArr) / sizeof (OffArr[0]));
+
+ for (Param = OptWrDS; Param < OptDefault; Param++) {
+ if (OptParam == Param || OptParam == OptDefault) {
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nOffsets for Optimization Parameter %s\n", TOptParamOffsetString[Param]);
+ PerRank =
+ (
+ Param == OptTxEq ||
+ Param == OptRxEq ||
+ Param == OptDimmOdt ||
+ Param == OptDimmOdtWr ||
+ Param == OptDimmRon
+ );
+ SkipByte = (Param == OptDimmRon || Param == OptDimmOdt || Param == OptDimmOdtWr);
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!((MRC_BIT0 << Channel) & ChannelMask)) {
+ continue;
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel %d\n", Channel);
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if ((MRC_BIT0 << Rank) & RankMask) {
+ if (!(MrcRankInChannelExist (MrcData, Rank, Channel))) {
+ continue;
+ }
+
+ if (PerRank) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Rank %d\n", Rank);
+ } else if (Rank > 0) {
+ continue;
+ }
+
+ if (!SkipByte) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Byte\t");
+ for (Byte = 0; Byte < NumBytes; Byte++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d\t", Byte);
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+ }
+
+ if (OptResult) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Opt/CR/Host\t");
+ } else {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "CR/Host\t");
+ }
+
+ if (!SkipByte) {
+ for (Byte = 0; Byte < NumBytes; Byte++) {
+ ReadOptParamOffset (MrcData, &OffArr[0], Channel, Rank, Byte, Param);
+
+ if (OptResult) {
+ Best = OptOff->Offset[Channel][Byte];
+ if (Best != OffArr[0] || Best != OffArr[1]) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\nError: Mismatch in Param %s in Channel %d Rank %d Byte %d is found: Best=%d CR=%d Host=%d\n",
+ TOptParamOffsetString[Param],
+ Channel,
+ Rank,
+ Byte,
+ Best,
+ OffArr[0],
+ OffArr[1]
+ );
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d/%d/%d\t", Best, OffArr[0], OffArr[1]);
+ } else {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d/%d\t", OffArr[0], OffArr[1]);
+ }
+ }
+ } else {
+ ReadOptParamOffset (MrcData, &OffArr[0], Channel, Rank, 0, Param);
+
+ if (Param == OptDimmRon || Param == OptDimmOdtWr) {
+ if (OptResult) {
+ Best = OptOff->Offset[Channel][0];
+ if (Best != OffArr[1]) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\nError: Mismatch in Param %s in Channel %d Rank %d is found: Best=%d Host=%d\n",
+ TOptParamOffsetString[Param],
+ Channel,
+ Rank,
+ Best,
+ OffArr[1]
+ );
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d/NA/%d", Best, OffArr[1]);
+ } else {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "NA/%d", OffArr[1]);
+ }
+ } else if (Param == OptDimmOdt) {
+ if (OptResult) {
+ Best = OptOff->Offset[Channel][0];
+ if (Best != OffArr[0]) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\nError: Mismatch in Param %s in Channel %d Rank %d is found: Best=%d Host=%d\n",
+ TOptParamOffsetString[Param],
+ Channel,
+ Rank,
+ Best,
+ OffArr[0]
+ );
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d/NA/%d", Best, OffArr[0]);
+ } else {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "NA/%d", OffArr[0]);
+ }
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+ }
+ }
+ }
+ }
+ }
+}
+
+/**
+ Reads OptParam value from CRs and Host structure for a given ch/Rank/byte combination
+ OptParam can be: WrDS, RdOdt, TComp, SComp, RxEq, TxEq, RxBias, DIMM Ron, DIMM RttNom or DIMM RttWr
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[out] FinalVal - Pointer to the array consisting of CR value and Host value for a particular
+ OptParam and given ch/Rank/byte combination.
+ @param[in] Channel - Channel index to work on.
+ @param[in] Rank - Rank index to work on (valid only for TxEq and RxEq, for others is ignored)
+ @param[in] Byte - Byte index to work on.
+ @param[in] OptParam - Defines the OptParam Offsets. Supported OptParam =
+ [0: WrDS, 1: RdODT, 2: SComp, 3: TComp, 3: TxEq,
+ 4: RxEq, 5: RxBias, 6: DimmOdt, 7: DimmOdtWr]
+
+ @retval Nothing
+**/
+void
+ReadOptParamOffset (
+ IN MrcParameters *const MrcData,
+ OUT S16 *FinalVal,
+ IN const U8 Channel,
+ IN const U8 Rank,
+ IN const U8 Byte,
+ IN const U8 OptParam
+ )
+{
+ const U16 RttNomMRSEncodingConst[] = {0x00, 0x10, 0x01, 0x11, 0x81, 0x80}; // RttNom Off,120,60,40,30,20 Ohms
+ const U16 RttWrMRSEncodingConst[] = {0x00, 0x02, 0x01}; // RttWr RttNom,120,60 Ohms
+ const MrcDebug *Debug;
+#ifdef ULT_FLAG
+ const U8 LpddrRonEnc[] = {0x1,0x2,0x3}; //{34,40,48};
+ const U8 LpddrOdtEnc[] = {0x0,0x2,0x3}; //{0,120,240};
+ BOOL Lpddr;
+ U16 DimmRonMask;
+#endif // ULT_FLAG
+ MrcOutput *Outputs;
+ MrcChannelOut *ChannelOut;
+ U16 *MrReg;
+ BOOL Type;
+ U8 Index;
+ U16 MRValue;
+ U16 RttNomMRSEncoding[sizeof (RttNomMRSEncodingConst) / sizeof (RttNomMRSEncodingConst[0])];
+ U16 RttWrMRSEncoding[sizeof (RttWrMRSEncodingConst) / sizeof (RttWrMRSEncodingConst[0])];
+ U16 RttWr;
+ U16 RttNom;
+ U16 RttNomMask;
+ U16 RttWrMask;
+ U32 Offset;
+ S16 UpOff;
+ S16 DnOff;
+ DDRDATA0CH0_CR_DDRCRDATAOFFSETCOMP_STRUCT DdrCrDataOffsetCompCr;
+ DDRDATA0CH0_CR_DDRCRDATAOFFSETCOMP_STRUCT DdrCrDataOffsetCompHost;
+ DDRDATA0CH0_CR_TXTRAINRANK0_STRUCT CrTxTrainRank;
+ DDRDATA0CH0_CR_RXTRAINRANK0_STRUCT CrRxTrainRank;
+ DDRDATA0CH0_CR_DDRCRDATACONTROL1_STRUCT DdrCrDataControl1Cr;
+ DDRDATA0CH0_CR_DDRCRDATACONTROL1_STRUCT DdrCrDataControl1Host;
+
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ ChannelOut = &Outputs->Controller[0].Channel[Channel];
+ MrcOemMemoryCpy ((U8 *) RttNomMRSEncoding, (U8 *) RttNomMRSEncodingConst, sizeof (RttNomMRSEncoding));
+ MrcOemMemoryCpy ((U8 *) RttWrMRSEncoding, (U8 *) RttWrMRSEncodingConst, sizeof (RttWrMRSEncoding));
+
+#ifdef ULT_FLAG
+ Lpddr = Outputs->DdrType == MRC_DDR_TYPE_LPDDR3;
+#endif
+ //
+ // Compensation Offsets
+ //
+ Type = ((OptParam == OptWrDS) || (OptParam == OptRdOdt) || (OptParam == OptTComp) || (OptParam == OptSComp));
+ if (Type) {
+
+ Offset = DDRDATA0CH0_CR_DDRCRDATAOFFSETCOMP_REG +
+ ((DDRDATA1CH0_CR_DDRCRDATAOFFSETCOMP_REG - DDRDATA0CH0_CR_DDRCRDATAOFFSETCOMP_REG) * Byte) +
+ ((DDRDATA0CH1_CR_DDRCRDATAOFFSETCOMP_REG - DDRDATA0CH0_CR_DDRCRDATAOFFSETCOMP_REG) * Channel);
+ DdrCrDataOffsetCompCr.Data = MrcReadCR (MrcData, Offset);
+ DdrCrDataOffsetCompHost.Data = ChannelOut->DataCompOffset[Byte];
+
+ if (OptParam == OptWrDS) {
+ UpOff = (S16) (S32) DdrCrDataOffsetCompCr.Bits.DqDrvUpCompOffset;
+ DnOff = (S16) (S32) DdrCrDataOffsetCompCr.Bits.DqDrvDownCompOffset;
+ if (UpOff != DnOff) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "DqDrvUpCompOffset %d is not equal to DqDrvDownCompOffset for Channel=%d, Byte=%d\n",
+ UpOff,
+ DnOff,
+ Channel,
+ Byte
+ );
+ }
+
+ FinalVal[0] = UpOff;
+ UpOff = (S16) (S32) DdrCrDataOffsetCompHost.Bits.DqDrvUpCompOffset;
+ DnOff = (S16) (S32) DdrCrDataOffsetCompHost.Bits.DqDrvDownCompOffset;
+ if (UpOff != DnOff) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "DqDrvUpCompOffset %d is not equal to DqDrvDownCompOffset for Channel=%d, Byte=%d in Host Structure\n",
+ UpOff,
+ DnOff,
+ Channel,
+ Byte
+ );
+ }
+
+ FinalVal[1] = UpOff;
+
+ if (FinalVal[0] & 0x20) { // 6-bit 2's complement
+ FinalVal[0] -= 0x40;
+ }
+ if (FinalVal[1] & 0x20) { // 6-bit 2's complement
+ FinalVal[1] -= 0x40;
+ }
+ } else if (OptParam == OptRdOdt) {
+ UpOff = (S16) (S32) DdrCrDataOffsetCompCr.Bits.DqOdtUpCompOffset;
+ DnOff = (S16) (S32) DdrCrDataOffsetCompCr.Bits.DqOdtDownCompOffset;
+ if (UpOff != DnOff) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "DqOdtUpCompOffset %d is not equal to DqOdtDownCompOffset for Channel=%d, Byte=%d\n",
+ UpOff,
+ DnOff,
+ Channel,
+ Byte
+ );
+ }
+
+ FinalVal[0] = UpOff;
+ UpOff = (S16) (S32) DdrCrDataOffsetCompHost.Bits.DqOdtUpCompOffset;
+ DnOff = (S16) (S32) DdrCrDataOffsetCompHost.Bits.DqOdtDownCompOffset;
+ if (UpOff != DnOff) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "DqOdtUpCompOffset %d is not equal to DqOdtDownCompOffset for Channel=%d, Byte=%d in Host Structure\n",
+ UpOff,
+ DnOff,
+ Channel,
+ Byte
+ );
+ }
+
+ FinalVal[1] = UpOff;
+
+ if (FinalVal[0] & 0x10) { // 5-bit 2's complement
+ FinalVal[0] -= 0x20;
+ }
+ if (FinalVal[1] & 0x10) { // 5-bit 2's complement
+ FinalVal[1] -= 0x20;
+ }
+ } else if (OptParam == OptTComp) {
+ FinalVal[0] = (S16) (S32) DdrCrDataOffsetCompCr.Bits.DqTcoCompOffset;
+ FinalVal[1] = (S16) (S32) DdrCrDataOffsetCompHost.Bits.DqTcoCompOffset;
+
+ if (FinalVal[0] & 0x10) { // 5-bit 2's complement
+ FinalVal[0] -= 0x20;
+ }
+ if (FinalVal[1] & 0x10) { // 5-bit 2's complement
+ FinalVal[1] -= 0x20;
+ }
+ } else if (OptParam == OptSComp) {
+ FinalVal[0] = (S16) (S32) DdrCrDataOffsetCompCr.Bits.DqSlewRateCompOffset;
+ FinalVal[1] = (S16) (S32) DdrCrDataOffsetCompHost.Bits.DqSlewRateCompOffset;
+
+ if (FinalVal[0] & 0x10) { // 5-bit 2's complement
+ FinalVal[0] -= 0x20;
+ }
+ if (FinalVal[1] & 0x10) { // 5-bit 2's complement
+ FinalVal[1] -= 0x20;
+ }
+ }
+
+ if (FinalVal[0] != FinalVal[1]) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "Error: Param %s: CR value %d doesn't match Host value %d for Channel=%d, Byte=%d\n",
+ TOptParamOffsetString[OptParam],
+ FinalVal[0],
+ FinalVal[1],
+ Channel,
+ Byte
+ );
+ }
+ }
+ //
+ // Equalization Settings
+ //
+ Type = ((OptParam == OptTxEq) || (OptParam == OptRxEq));
+ if (Type) {
+ //
+ // TxEq[5:4] = Emphasize = [3, 6, 9, 12] legs
+ // TxEq[3:0] = Deemphasize = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 4*Rsvd] legs
+ //
+ if (OptParam == OptTxEq) {
+
+ Offset = DDRDATA0CH0_CR_TXTRAINRANK0_REG +
+ ((DDRDATA0CH1_CR_TXTRAINRANK0_REG - DDRDATA0CH0_CR_TXTRAINRANK0_REG) * Channel) +
+ ((DDRDATA0CH0_CR_TXTRAINRANK1_REG - DDRDATA0CH0_CR_TXTRAINRANK0_REG) * Rank) +
+ ((DDRDATA1CH0_CR_TXTRAINRANK0_REG - DDRDATA0CH0_CR_TXTRAINRANK0_REG) * Byte);
+
+ CrTxTrainRank.Data = MrcReadCR (MrcData, Offset);
+ FinalVal[0] = (S16) (S32) CrTxTrainRank.Bits.TxEqualization;
+ FinalVal[1] = (S16) (S32) ChannelOut->TxEq[Rank][Byte];
+ FinalVal[0] &= 0xF; // Read Deemphasize portion only
+ FinalVal[1] &= 0xF; // Read Deemphasize portion only
+ }
+ //
+ // RxEQ[4:0] CR Decoding (pF/kOhm)
+ // [2:0]
+ // [4:3] 0 1 2 3 4 5-7
+ // 0 0.5/.02 0.5/1.0 0.5/.50 0.5/.25 0.5/.12 rsvd
+ // 1 1.0/.02 1.0/1.0 1.0/.50 1.0/.25 1.0/.12 rsvd
+ // 2 1.5/.02 1.5/1.0 1.5/.50 1.5/.25 1.5/.12 rsvd
+ // 3 2.0/.02 2.0/1.0 2.0/.50 2.0/.25 2.0/.12 rsvd
+ // Sweep = 0-19 [4:3] = (Sweep/5) [2:0] = (Sweep%5)
+ //
+ if (OptParam == OptRxEq) {
+ Offset = DDRDATA0CH0_CR_RXTRAINRANK0_REG +
+ ((DDRDATA0CH1_CR_RXTRAINRANK0_REG - DDRDATA0CH0_CR_RXTRAINRANK0_REG) * Channel) +
+ ((DDRDATA0CH0_CR_RXTRAINRANK1_REG - DDRDATA0CH0_CR_RXTRAINRANK0_REG) * Rank) +
+ ((DDRDATA1CH0_CR_RXTRAINRANK0_REG - DDRDATA0CH0_CR_RXTRAINRANK0_REG) * Byte);
+
+ CrRxTrainRank.Data = MrcReadCR (MrcData, Offset);
+ FinalVal[0] = (S16) (S32) CrRxTrainRank.Bits.RxEq;
+ FinalVal[1] = (S16) (S32) ChannelOut->RxEq[Rank][Byte];
+ FinalVal[0] = ((FinalVal[0] >> 3) * 5) + (FinalVal[0] & 0x7); // Multiply Cap portion by 5 and add Res portion
+ FinalVal[1] = ((FinalVal[1] >> 3) * 5) + (FinalVal[1] & 0x7); // Multiply Cap portion by 5 and add Res portion
+ }
+
+ if (FinalVal[0] != FinalVal[1]) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "Error: Param %s: CR value %d doesn't match Host value %d for Channel=%d, Rank=%d, Byte=%d\n",
+ TOptParamOffsetString[OptParam],
+ FinalVal[0],
+ FinalVal[1],
+ Channel,
+ Rank,
+ Byte
+ );
+ }
+ }
+ //
+ // RX Amplifier BIAS
+ //
+ if ((OptParam == OptRxBias)) {
+ //
+ // Mapping: [0: 0.44, 1: 0.66, 2: 0.88, 3: 1.00, 4: 1.33, 5: 1.66, 6: 2.00, 7: 2.33]
+ //
+ Offset = DDRDATA0CH0_CR_DDRCRDATACONTROL1_REG +
+ ((DDRDATA1CH0_CR_DDRCRDATACONTROL1_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL1_REG) * Byte) +
+ ((DDRDATA0CH1_CR_DDRCRDATACONTROL1_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL1_REG) * Channel);
+
+ DdrCrDataControl1Cr.Data = MrcReadCR (MrcData, Offset);
+ DdrCrDataControl1Host.Data = ChannelOut->DqControl1[Byte].Data;
+ FinalVal[0] = (S16) (S32) DdrCrDataControl1Cr.Bits.RxBiasCtl;
+ FinalVal[1] = (S16) (S32) DdrCrDataControl1Host.Bits.RxBiasCtl;
+
+ if (FinalVal[0] != FinalVal[1]) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "Error: Param %s: CR value %d doesn't match Host value %d for Channel=%d, Byte=%d\n",
+ TOptParamOffsetString[OptParam],
+ FinalVal[0],
+ FinalVal[1],
+ Channel,
+ Byte
+ );
+ }
+ }
+ //
+ // Dimm Ron value
+ //
+ if ((OptParam == OptDimmRon)) {
+ //
+ // DIMM Ron Encoding DriverImpCtrl[A5,A1]
+ //
+ if (MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ MrReg = &ChannelOut->Dimm[Rank / 2].Rank[(Rank % 2)].MR[mrMR0];
+#ifdef ULT_FLAG
+ if (Lpddr) {
+ DimmRonMask = (MRC_BIT3 | MRC_BIT2 | MRC_BIT1 | MRC_BIT0);
+ MRValue = (MrReg[mrMR3] & DimmRonMask);
+
+ for (Index = 0; Index < (sizeof (LpddrRonEnc) / sizeof (LpddrRonEnc[0])); Index++) {
+ if (MRValue == LpddrRonEnc[Index]) {
+ FinalVal[1] = (S16) (S8) Index;
+ }
+ }
+ } else
+#endif
+ {
+ MRValue = MrReg[mrMR1];
+ FinalVal[1] = (S16) ((MRValue >> 1) & 0x1);
+ }
+ }
+ }
+ //
+ // DIMM ODT Values
+ //
+ if ((OptParam == OptDimmOdt) || (OptParam == OptDimmOdtWr)) {
+ //
+ // DIMM ODT Encoding RttNom[A9,A6,A2] RttWr[A10, A9] LPDDR - No RttNom
+ //
+ if (MrcRankInChannelExist (MrcData, Rank, Channel)) {
+#ifdef ULT_FLAG
+ if (Lpddr) {
+ RttWrMask = (MRC_BIT1 | MRC_BIT0);
+ MRValue = (ChannelOut->Dimm[Rank / 2].Rank[Rank % 2].MR11 & RttWrMask);
+
+ for (Index = 0; Index < (sizeof (LpddrOdtEnc) / sizeof (LpddrOdtEnc[0])); Index++) {
+ if (MRValue == LpddrOdtEnc[Index]) {
+ FinalVal[1] = (S16) (S8) Index;
+ }
+ }
+
+ FinalVal[0] = 0;
+ } else
+#endif
+ {
+ MrReg = &ChannelOut->Dimm[Rank / 2].Rank[Rank % 2].MR[mrMR0];
+ RttNomMask = (MRC_BIT9 + MRC_BIT6 + MRC_BIT2);
+ RttWrMask = (MRC_BIT10 + MRC_BIT9);
+ RttWr = (MrReg[mrMR2] & RttWrMask) >> 9;
+ RttNom = (MrReg[mrMR1] & RttNomMask) >> 2;
+
+ for (Index = 0; Index < sizeof (RttNomMRSEncodingConst) / sizeof (RttNomMRSEncodingConst[0]); Index++) {
+ if (RttNom == RttNomMRSEncoding[Index]) {
+ FinalVal[0] = (S16) (S8) Index;
+ }
+ }
+
+ for (Index = 0; Index < sizeof (RttWrMRSEncodingConst) / sizeof (RttWrMRSEncodingConst[0]); Index++) {
+ if (RttWr == RttWrMRSEncoding[Index]) {
+ FinalVal[1] = (S16) (S8) Index;
+ }
+ }
+ }
+ }
+ }
+}
+
+/**
+ This function will print out the last margin data collected of the Param passed in.
+ It will print both edges of all the requested bytes, Ranks and Channels.
+ NOTE: The function will not check to see if the Rank/Channel exists. It will print out the
+ values stored in the margin array regardless of population status.
+
+ @param[in] MrcData - Global MRC data.
+ @param[in] Param - Parameter of MRC_MarginTypes of which to print the margin.
+ @param[in] ChannelMask - Bit mask of channels to print.
+ @param[in] RankMask - Bit mask of ranks to print.
+ @param[in] ByteMask - Bit mask of bytes to print.
+
+ @retval Nothing.
+**/
+void
+MrcPrintLastMargins (
+ IN MrcParameters *const MrcData,
+ IN const U8 Param,
+ IN const U8 ChannelMask,
+ IN const U8 RankMask,
+ IN const U16 ByteMask
+ )
+{
+ MrcDebug const *Debug;
+ MrcOutput *Outputs;
+ char *EdgeString;
+ MrcMarginResult LastResultParam;
+ U32 (*LastMargins)[MAX_RANK_IN_CHANNEL][MAX_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_EDGES];
+ U8 Channel;
+ U8 Rank;
+ U8 Byte;
+ U8 Edge;
+
+ LastResultParam = GetMarginResultType (Param);
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ LastMargins = Outputs->MarginResult;
+
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "%s Last Margins:\n",
+ MarginTypesString[Param]
+ );
+
+ EdgeString = ((Param == RdV) || (Param == WrV)) ? "H" : "R";
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Byte\t");
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ if ((1 << Byte) & ByteMask) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "% 10d", Byte);
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nEdge\t");
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ if ((1 << Byte) & ByteMask) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " L %s", EdgeString);
+ }
+ }
+
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if ((1 << Rank) & RankMask) {
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if ((1 << Channel) & ChannelMask) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nR%d.C%d\t", Rank, Channel);
+ for(Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ if ((1 << Byte) & ByteMask) {
+ for (Edge = 0; Edge < MAX_EDGES; Edge++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "% 5d", LastMargins[LastResultParam][Rank][Channel][Byte][Edge]);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n"); // End of table
+}
+#endif // #if 0
+
+/**
+ This function implements switch to print the correct format and data for the
+ OptResultsPerByte struct members.
+
+ @param[in] Debug - Debug pointer for printing.
+ @param[in] Data - Pointer to OptResultsPerByte struct.
+ @param[in] TypeIndex - Member of OptResultsPerByte to print.
+ @param[in] TestIndex - Some parameters store multiple test results to be printed.
+ @param[in] MidPoint - Used to convert from zero-based indexing to the selected value
+
+ @retval Nothing.
+**/
+void
+MrcOptResultsPerBytePrint (
+ IN const MrcDebug *const Debug,
+ IN OptResultsPerByte *Data,
+ IN U8 TypeIndex,
+ IN U8 TestIndex,
+ IN S8 MidPoint
+ )
+{
+ switch (TypeIndex) {
+ case (MrcOptResultBest):
+ (TestIndex == 0) ? MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "=== %d ===", Data->Best - MidPoint) :
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\t");
+ break;
+
+ case (MrcOptResultGrdBnd):
+ (TestIndex == 0) ? MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "*** %d ***", Data->GuardBand) :
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\t");
+ break;
+
+ case(MrcOptResultOffSel):
+ (TestIndex == 0) ? MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "--> %d <--", Data->Best - MidPoint + Data->GuardBand) :
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\t");
+ break;
+
+ case (MrcOptResultScale):
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d\t", Data->Scale[TestIndex]);
+ break;
+
+ case (MrcOptResultSignal):
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d.%d%s\t", Data->Signal[TestIndex] / 100, Data->Signal[TestIndex] % 100 / 10, "%");
+ break;
+
+ case (MrcOptResultNoise):
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d.%d%s\t", Data->Noise[TestIndex] / 100, Data->Noise[TestIndex] % 100 / 10, "%");
+ break;
+
+ case (MrcOptResultRatio):
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d.%d\t", Data->Ratio[TestIndex] / 1000, Data->Ratio[TestIndex] % 1000 / 100);
+ break;
+
+ case (MrcOptResultMaxPost):
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d\t", Data->MaxPost[TestIndex]);
+ break;
+
+ case (MrcOptResultMinPost):
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d\t", Data->MinPost[TestIndex]);
+ break;
+
+ case (MrcOptResultTicks):
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d.%d\t", Data->Ticks[TestIndex] / 10, Data->Ticks[TestIndex] % 10);
+ break;
+
+ case (MrcOptResultSnrTot):
+ (TestIndex == 0) ? MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ " %d.%d%s\t",
+ (U32) Data->SNRTotal / 100,
+ (U32) Data->SNRTotal % 100 / 10,
+ "%"
+ ) : MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\t");
+ break; // assuming we dont exceed 32 bits
+
+ default:
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "OptResultPerByteDbgStr Switch exceeded number of cases defined\n");
+ }
+}
+
+
+/**
+ This function prints the Optimize margin result table
+ e.g: calcResultSummary[MAX_CHANNEL][MAX_SDRAM_IN_DIMM]
+
+ @param[in] MrcData - MRC data structure
+ @param[in] calcResultSummary - The data array [MAX_CHANNEL][MAX_SDRAM_IN_DIMM]
+ @param[in] TestList - Test list
+ @param[in] NumTest - Number of test
+ @param[in] NumOffsets - Number of offsets
+ @param[in] MidPoint - Middle point
+ @param[in] IncEnds - Print ends points
+ @param[in] OptParam - Used to convert to the Opt param string for printing
+ @param[in] OptPower - Opt Power values to be printed
+ @param[in] Channel - Channel to print
+ @param[in] Ranks - Ranks to print
+ @param[in] TrendLine - Switch to print the trend line
+ @param[in] Nibble - take low/high bytes
+ @param[in] perCh - Switch to only print 1 Byte of data
+ @param[in] noPrint - Boolean used to disable printing of results
+
+ @retval Nothing
+**/
+void
+PrintCalcResultTableCh (
+ IN MrcParameters *const MrcData,
+ IN OptResultsPerByte calcResultSummary[MAX_CHANNEL][MAX_SDRAM_IN_DIMM],
+ IN U8 *TestList,
+ IN U8 NumTest,
+ IN U8 NumOffsets,
+ IN S8 MidPoint,
+ IN BOOL IncEnds,
+ IN U8 OptParam,
+ IN U16 *OptPower,
+ IN U8 Channel,
+ IN U8 Ranks,
+ IN BOOL TrendLine,
+ IN U8 Nibble,
+ IN BOOL perCh,
+ IN BOOL noPrint
+ )
+{
+ const MrcDebug *Debug;
+ OptResultsPerByte *data;
+ S8 Off;
+ S8 Start;
+ S8 Stop;
+ U8 i;
+ U8 j;
+ U8 b;
+ U8 FirstByte;
+ U8 NumBytes;
+ U8 NumTestPlus;
+ U32 Result;
+ BOOL Format64Results;
+ U8 Param;
+
+ Format64Results = 1;
+ //
+ // Display result in %/Delta , 0-displat raw 64bit result in HEX
+ //
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ Start = (!IncEnds);
+ Stop = NumOffsets - (!IncEnds);
+ if (noPrint) {
+ return ;
+
+ }
+
+ FirstByte = (Nibble) ? 4 : 0;
+ NumBytes = FirstByte + 4 + Nibble * MrcData->SysOut.Outputs.SdramCount % 8;
+ if (perCh) {
+ NumBytes = 1;
+ }
+
+ NumTestPlus = (TrendLine) ? NumTest + 1 : NumTest;
+
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\n<======== optimize %s ========>Plot results ",
+ TOptParamOffsetString[OptParam]
+ );
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "<Channel=%d><rank/s=0x%x><Nibble=%s> across settings :(Start=%d,Stop=%d)\n",
+ Channel,
+ Ranks,
+ (Nibble) ? "High" : "Low",
+ Start - MidPoint,
+ Stop - MidPoint - 1
+ );
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Bytes\t");
+ for (b = FirstByte; b < NumBytes; b++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d\t", b);
+ for (i = 0; i < NumTestPlus + 1; i++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\t"); // tab insertion
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n"); // row end here !
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Offset\t"); // row starts here !
+ if (OptPower[Stop - 1] != 0) {//WA: need to add param to enable this print
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s\t", 3 + TOptParamOffsetString[OptParam]);
+ }
+
+ for (b = FirstByte; b < NumBytes; b++) {
+ for (i = 0; i < NumTest; i++) {
+ //
+ // Test types header
+ //
+ Param = TestList[i];
+ if (Param > CmdV) {
+ Param = (Param % 16) + 4;
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s\t", MarginTypesString[Param]);
+ }
+
+ if (TrendLine) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s\t", "T.line");
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Opt.func\t"); // more header..
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n\n"); // row end here !
+ for (Off = Start; Off < Stop; Off++) {
+ //
+ // row starts here !
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d\t", Off - MidPoint);
+ if (OptPower[Stop - 1] != 0) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d\t", OptPower[Off]);
+ }
+
+ for (b = FirstByte; b < NumBytes; b++) {
+ if (b < MAX_SDRAM_IN_DIMM) {
+ data = &calcResultSummary[Channel][b];
+ } else {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "Error: calcResultSummary array out of bounds! %d > %d \n",
+ b,
+ MAX_SDRAM_IN_DIMM - 1
+ );
+ return;
+ }
+
+ for (i = 0; i < NumTestPlus; i++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d\t", data->Margins[i][Off].EW);
+ }
+
+ if (Format64Results) {
+ Result = (U32) (MrcOemMemoryDivideU64ByU64 (MrcOemMemoryMultiplyU64ByU32 (data->Result[Off], 200), data->MaxR));
+ Result /= 2;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d\t\t", Result);
+ }
+
+ if (!Format64Results) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "%08x-%08x\t\t",
+ (U32) MrcOemMemoryRightShiftU64 (data->Result[Off],
+ 32),
+ (U32) (data->Result[Off])
+ );
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n"); // row end here !
+ }
+
+ for (i = 0; i < (sizeof (OptResultDbgStrings) / sizeof (*OptResultDbgStrings)); i++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s\t", OptResultDbgStrings[i]);
+ for (b = FirstByte; b < NumBytes; b++) {
+ if (b < MAX_SDRAM_IN_DIMM) {
+ data = &calcResultSummary[Channel][b];
+ } else {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "Error: calcResultSummary array out of bounds! %d > %d \n",
+ b,
+ MAX_SDRAM_IN_DIMM - 1
+ );
+ return;
+ }
+
+ for (j = 0; j < NumTestPlus; j++) {
+ MrcOptResultsPerBytePrint (Debug, data, i, j, MidPoint);
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\t\t"); // tab insertion
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+ } // row end here !
+ return;
+}
+
+/**
+ This function prints the Optimize margin result table
+ e.g: calcResultSummary[MAX_CHANNEL][MAX_SDRAM_IN_DIMM]
+
+ @param[in] MrcData - MRC data structure
+ @param[in] calcResultSummary - The data array [MAX_CHANNEL][MAX_SDRAM_IN_DIMM]
+ @param[in] DimmOptPoints - add argument and description to function comment
+ @param[in] TestList - Test list
+ @param[in] NumTest - Number of test
+ @param[in] NumOffsets - Number of offsets
+ @param[in] MidPoint - Middle point
+ @param[in] IncEnds - Print ends points
+ @param[in] OptParam - Used to convert to the Opt param string for printing
+ @param[in] Channel - Channel to print
+ @param[in] Ranks - Ranks to print
+ @param[in] TrendLine - Switch to print the trend line
+ @param[in] Nibble - take low/high bytes
+ @param[in] perCh - Switch to only print 1 Byte of data
+
+ @retval Nothing
+**/
+void
+PrintODTResultTable (
+ IN MrcParameters *const MrcData,
+ IN OptResultsPerByte *calcResultSummary,
+ IN DimmOptPoint *DimmOptPoints,
+ IN U8 NumOffsets,
+ IN S8 MidPoint,
+ IN BOOL IncEnds,
+ IN U8 OptParam,
+ IN U8 Channel,
+ IN U8 Ranks,
+ IN BOOL TrendLine,
+ IN U8 Nibble,
+ IN BOOL perCh
+ )
+{
+ const char *OdtStrings[] = {
+ "RttNom0",
+ "RttNom1",
+ "RttWr0",
+ "RttWr1",
+ "RdOdt",
+ "Pwr[mW]",
+ "Cpu Rd",
+ "Dim Rd",
+ "Cpu Wr",
+ "DimW-T",
+ "DimW-NT",
+ "ACPower"
+ };
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ OptResultsPerByte *data;
+ S8 Off;
+ S8 Start;
+ S8 Stop;
+ U8 i;
+ U8 j;
+ U8 b;
+ U8 r;
+ U8 FirstByte;
+ U8 NumBytes;
+ U8 NumTestPlus;
+ U8 *TestList;
+ U8 Param;
+ U32 Result;
+ U8 OptResultType;
+ BOOL Format64Results; // Display result in %/MaxR , 0-display raw 64bit result in HEX
+ BOOL printOptSetting;
+ U64 delta;
+
+ Format64Results = 1;
+ printOptSetting = 1;
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ Start = (!IncEnds);
+ Stop = NumOffsets - (!IncEnds);
+ TestList = DimmOptPoints[0].TestList;
+ FirstByte = (Nibble) ? 4 : 0;
+ NumBytes = FirstByte + 4 + Nibble * MrcData->SysOut.Outputs.SdramCount % 8;
+ Ranks &= Outputs->Controller[0].Channel[Channel].ValidRankBitMask;
+
+ if (perCh) {
+ NumBytes = 1;
+ }
+
+ NumTestPlus = (TrendLine) ? DimmOptPoints[0].NumTests + 1 : DimmOptPoints[0].NumTests;
+ //
+ // RttNomOffset = (MrcData->Outputs.Channel[Channel].DimmCount == 1) ? 0 : RttOffset; // if 2DPC - RttNom 40,30,20 Ohms
+ //
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\n<======== optimize %s ========>Plot results ",
+ TOptParamOffsetString[OptParam]
+ );
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "<Channel=%d><rank/s=0x%x> across settings :(Start=%d,Stop=%d)\n",
+ Channel,
+ Ranks,
+ Start - MidPoint,
+ Stop - MidPoint - 1
+ );
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "ODT\t");
+ // for (b = 0; b < (sizeof(OdtStrings)/sizeof(*OdtStrings)); b++) {
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s\t",OdtStrings[b] );
+ // for (i = 0; i < NumTestPlus+1; i++) MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\t");//tab insertion
+ // }
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");//row end here!
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Offset\t"); // row starts here!
+ for (b = 0; b < (sizeof (OdtStrings) / sizeof (*OdtStrings)); b++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s\t", OdtStrings[b]);
+ }
+
+ for (i = 0; i < DimmOptPoints[0].NumTests; i++) {
+ //
+ // Test types header
+ //
+ Param = TestList[i];
+ if (Param > CmdV) {
+ Param = (Param % 16) + 4;
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s\t", MarginTypesString[Param]);
+ }
+
+ if (TrendLine) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s\t", "T.line");
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Opt.func\t"); // more header
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n\n");
+
+ for (Off = Start; Off < Stop; Off++) {
+ //
+ // row starts here !
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d\t", Off - MidPoint);
+ for (b = 0; b < (sizeof (OdtStrings) / sizeof (*OdtStrings)); b++) {
+ if (b == 0) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d\t", ActualDimmOdt[DimmOptPoints[Off].ODTSet.RttNom[Channel][0]]);
+ }
+
+ if (b == 1) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d\t", ActualDimmOdt[DimmOptPoints[Off].ODTSet.RttNom[Channel][1]]);
+ }
+
+ if (b == 2) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d\t", ActualDimmOdt[DimmOptPoints[Off].ODTSet.RttWr[Channel][0]]);
+ }
+
+ if (b == 3) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d\t", ActualDimmOdt[DimmOptPoints[Off].ODTSet.RttWr[Channel][1]]);
+ }
+
+ if (b == 4) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d\t", CalcRdOdt (MrcData, DimmOptPoints[Off].ODTSet.GRdOdt));
+ }
+
+ if (b == 5) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "%d.%d\t",
+ DimmOptPoints[Off].PowerCalc.TotPwr / 10,
+ DimmOptPoints[Off].PowerCalc.TotPwr % 10
+ );
+ }
+
+ if (b == 6) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "%d.%d\t",
+ DimmOptPoints[Off].PowerCalc.CpuPwrRd / 10,
+ DimmOptPoints[Off].PowerCalc.CpuPwrRd % 10
+ );
+ }
+
+ if (b == 7) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "%d.%d\t",
+ DimmOptPoints[Off].PowerCalc.DimmPwrRd / 10,
+ DimmOptPoints[Off].PowerCalc.DimmPwrRd % 10
+ );
+ }
+
+ if (b == 8) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "%d.%d\t",
+ DimmOptPoints[Off].PowerCalc.CpuPwrWr / 10,
+ DimmOptPoints[Off].PowerCalc.CpuPwrWr % 10
+ );
+ }
+
+ if (b == 9) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "%d.%d\t",
+ DimmOptPoints[Off].PowerCalc.DimmPwrWrT / 10,
+ DimmOptPoints[Off].PowerCalc.DimmPwrWrT % 10
+ );
+ }
+
+ if (b == 10) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "%d.%d\t",
+ DimmOptPoints[Off].PowerCalc.DimmPwrWrNT / 10,
+ DimmOptPoints[Off].PowerCalc.DimmPwrWrNT % 10
+ );
+ }
+
+ if (b == 11) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "%d.%d\t",
+ DimmOptPoints[Off].PowerCalc.ACPower / 10,
+ DimmOptPoints[Off].PowerCalc.ACPower % 10
+ );
+ }
+ }
+
+ data = calcResultSummary;
+ for (i = 0; i < NumTestPlus; i++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d\t", data->Margins[i][Off].EW);
+ }
+
+ delta = data->MaxR - data->MinR + 1; // +1 to not divide by 0
+ if (Format64Results) {
+ Result = (U32) (MrcOemMemoryDivideU64ByU64 (MrcOemMemoryMultiplyU64ByU32 (data->Result[Off], 200), data->MaxR));
+ Result /= 2;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d\t\t", Result);
+ } else {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "%08x-%08x\t\t",
+ (U32) MrcOemMemoryRightShiftU64 (data->Result[Off],
+ 32),
+ (U32) (data->Result[Off])
+ );
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n"); // row end here !
+ if (printOptSetting) {
+ for (i = 0; i < DimmOptPoints[0].OptParamTestListSize; i++) {
+ OptResultType = GetOptResultType (DimmOptPoints[0].OptParamTestList[i]);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s \t", TOptParamOffsetString[DimmOptPoints[0].OptParamTestList[i]]);
+ if ((OptResultType == RxEqOfft) || (OptResultType == TxEqOfft)) {
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+ //
+ for (r = 0; r < MAX_RANK_IN_CHANNEL; r++) {
+ if (!(Ranks & (0x1 << r))) {
+ continue;
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "<Rank %d>|", r);
+ for (b = 0; b < Outputs->SdramCount; b++) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "%02d|",
+ DimmOptPoints[Off].BestOptOff[OptResultType][r].Offset[Channel][b]
+ );
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\t");
+ }
+ } else {
+ for (b = 0; b < Outputs->SdramCount; b++) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "%d|",
+ DimmOptPoints[Off].BestOptOff[OptResultType][0].Offset[Channel][b]
+ );
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n"); // row end here !
+ }
+ }
+
+ }
+
+ for (i = 0; i < (sizeof (OptResultDbgStrings) / sizeof (*OptResultDbgStrings)); i++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s\t", OptResultDbgStrings[i]);
+ for (b = FirstByte; b < NumBytes; b++) {
+ data = calcResultSummary;
+ for (j = 0; j < NumTestPlus; j++) {
+ MrcOptResultsPerBytePrint (Debug, data, i, j, MidPoint);
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\t\t"); // tab insertion
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+ } // row end here !
+}
+
+/**
+ This function prints the Optimize margin result table
+ e.g: MarginResult[Test][Offset][Channel][Byte][sign]
+
+ @param[in] MrcData - MRC data structure
+ @param[in] ChMask - Channels to print
+ @param[in] ResultArray - Array with saved margin results
+ @param[in] TestNum - Test index
+ @param[in] OffsetsNum - number of offsets
+ @param[in] MidPoint - Zero point
+ @param[in] Edges - 1 edge or 2 edge
+ @param[in] OptParam - Used to convert to the Opt param string for printing
+ @param[in] Param - Margin type to be printed.
+ @param[in] PowerLimits - Power limits to print.
+ @param[in] noPrint - Used to skip printing.
+
+ @retval Nothing
+**/
+void
+PrintResultTableByte4by24 (
+ IN MrcParameters *MrcData,
+ IN U8 ChMask,
+ IN U16 ResultArray[4][24][MAX_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_EDGES],
+ IN U16 TestNum,
+ IN U8 OffsetsNum,
+ IN U8 MidPoint,
+ IN U8 Edges,
+ IN U8 OptParam,
+ IN U8 Param,
+ IN U16 *PowerLimits,
+ IN BOOL noPrint
+ )
+{
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ U8 Channel;
+ U8 Byte;
+ S8 Off;
+ S8 Start;
+ S8 Stop;
+
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ Start = -MidPoint;
+ Stop = OffsetsNum - MidPoint - 1;
+ if (Param > CmdV) {
+ Param = (Param % 16) + 4;
+ }
+
+ if (noPrint) {
+ return;
+
+ }
+
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\nTest number : %d - %s ,Plot results across OptParam=%s settings:(Start=%d,Stop=%d) w/ power limits(width): %d \nChannel\t0 1\nByte\t",
+ TestNum,
+ MarginTypesString[Param],
+ TOptParamOffsetString[OptParam],
+ Start,
+ Stop,
+ PowerLimits[TestNum]
+ );
+ if (Outputs->SdramCount == 8) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "0\t1\t2\t3\t4\t5\t6\t7\t0\t1\t2\t3\t4\t5\t6\t7");
+ } else if (Outputs->SdramCount == 9) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "0\t1\t2\t3\t4\t5\t6\t7\t0\t1\t2\t3\t4\t5\t6\t7\t8");
+ }
+ //
+ // Sweep through OpParam settings
+ //
+ for (Off = Start; Off < Stop + 1; Off++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n %d:\t", Off);
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ //
+ // spaces for non populated channel
+ //
+ if (!((0x1 << Channel) & ChMask)) {
+ if (Channel == 0) {
+ if (Outputs->SdramCount == 8) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\t\t\t\t\t\t\t\t");
+ } else {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " ");
+ }
+ }
+
+ continue;
+ }
+
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ if (Edges > 1) {
+ if (Byte < MAX_SDRAM_IN_DIMM) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "%d-%d\t",
+ ResultArray[TestNum][Off - Start][Channel][Byte][0],
+ ResultArray[TestNum][Off - Start][Channel][Byte][1]
+ );
+ }
+ } else {
+ if (Byte < MAX_SDRAM_IN_DIMM) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d\t", ResultArray[TestNum][Off - Start][Channel][Byte][0]);
+ }
+ }
+ }
+ }
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n"); // New line after the end of the table
+
+ return;
+}
+#endif // MRC_DEBUG_PRINT
+
+/**
+ This function returns the UPM or PWR limit value for the specified parameter
+
+ @param[in] MrcData - Pointer to MRC global data.
+ @param[in] Param - Margin type
+ @param[in] LimitType - Type of limit: UpmLimit or PowerLimit
+
+ @retval Returns the UPM or PWR limit
+**/
+U16
+UpmPwrLimitValue (
+ IN MrcParameters *const MrcData,
+ IN U8 Param,
+ IN U8 LimitType
+ )
+{
+ MrcOutput *Outputs;
+ MrcUpmPwrRetrainLimits *MrcLimits;
+ U32 Index;
+ U16 Limit;
+#ifdef ULT_FLAG
+ U8 Channel;
+#endif // ULT_FLAG
+
+ Limit = 0;
+ Outputs = &MrcData->SysOut.Outputs;
+ MrcLimits = Outputs->UpmPwrRetrainLimits.Pointer;
+
+ for (Index = 0; Index < MRC_NUMBER_UPM_PWR_RETRAIN_MARGINS; Index++) {
+ if (Param == MrcLimits[Index].Param) {
+ Limit = MrcLimits[Index].ParamLimit[LimitType];
+ break;
+ }
+ }
+
+#ifdef ULT_FLAG
+ if ((MrcData->SysIn.Inputs.CpuModel == cmHSW_ULT) &&
+ (Outputs->DdrType == MRC_DDR_TYPE_DDR3) &&
+ (Param == WrV) &&
+ (LimitType != RetrainLimit)
+ ) {
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ if (Outputs->Controller[0].Channel[Channel].Dimm[0].ReferenceRawCard == rcF) {
+ Limit += 200; // Add 20 ticks for WrV on HSW ULT with DDR3L and raw card F
+ break;
+ }
+ }
+ }
+ }
+#endif // ULT_FLAG
+
+ return Limit;
+}
+
+/**
+ This function will adjust the requested Limit Type of the margin parameter by the signed offset passed in.
+
+ @param[in] MrcData - MRC global data.
+ @param[in] Param - Margin parameter type to adjust.
+ @param[in] LimitType - MRC_MARGIN_LIMIT_TYPE to adjust.
+ @param[in] Offset - The adjustment value.
+
+ @retval U16 - The new value of Param[MRC_MARGIN_LIMIT_TYPE]
+**/
+U16
+MrcUpdateUpmPwrLimits (
+ IN OUT MrcParameters * const MrcData,
+ IN U8 Param,
+ IN U8 LimitType,
+ IN S8 Offset
+ )
+{
+ MrcUpmPwrRetrainLimits *MrcLimits;
+ U32 Index;
+ S32 UpdatedValue;
+
+ MrcLimits = MrcData->SysOut.Outputs.UpmPwrRetrainLimits.Pointer;
+ UpdatedValue = 0;
+
+ for (Index = 0; Index < MRC_NUMBER_UPM_PWR_RETRAIN_MARGINS; Index++) {
+ if (Param == MrcLimits[Index].Param) {
+ UpdatedValue = MrcLimits[Index].ParamLimit[LimitType];
+ break;
+ }
+ }
+
+ UpdatedValue += Offset;
+ UpdatedValue = MAX (UpdatedValue, 0);
+ UpdatedValue = MIN (UpdatedValue, 0xFFFF);
+
+ MrcLimits[Index].ParamLimit[LimitType] = (U16) UpdatedValue;
+
+ return (U16) UpdatedValue;
+}
+
+/**
+ This function returns the Actual Cpu Driver Impedance (1 segment) in ohm.
+
+ @param[in] MrcData - Pointer to MRC global data.
+ @param[in] Offset - Vref Offset (+-8).
+
+ @retval Returns the CPU driver impedance value (for 1 segment)
+**/
+U16
+CalcDrvImp (
+ IN MrcParameters *const MrcData,
+ IN S8 Offset
+ )
+{
+ U16 Result;
+ U8 Rext;
+
+ Rext = 75;
+
+#ifdef ULT_FLAG
+ if (MrcData->SysIn.Inputs.CpuModel == cmHSW_ULT) {
+ Rext = 120; // RCOMP1 resistor is 120 Ohm on HSW-ULT boards
+ }
+#endif // ULT_FLAG
+
+ //
+ // If Offset == -32, return 0;
+ //
+ if (Offset == -32) {
+ Result = 0;
+ } else {
+ Result = Rext * (32 - Offset) / (32 + Offset);
+ }
+
+ return Result;
+}
+
+/**
+ This function returns the Actual Cpu Odt termination in ohm.
+
+ @param[in] MrcData - Pointer to MRC global data.
+ @param[in] Offset - Vref Offset (+-16).
+
+ @retval Returns the Odt termination value.
+**/
+U16
+CalcRdOdt (
+ IN MrcParameters *const MrcData,
+ IN S8 Offset
+ )
+{
+ U16 Result;
+ U8 Rext;
+
+#ifdef ULT_FLAG
+ if (MrcData->SysIn.Inputs.CpuModel == cmHSW_ULT) {
+ Rext = 100; // 200 / 2
+ } else
+#endif //ULT_FLAG
+ {
+ Rext = 50; // 100 / 2
+ }
+
+ Result = (Rext * 96 / (Offset + 48) - Rext);
+
+ return Result;
+}
+
+/**
+ Calculate Power for the selected Opt param based on
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Channel - Channel to work on
+ @param[in] Rank - Rank to work on
+ @param[in] Byte - Byte to work on
+ @param[in] OptParam - The Opt Parameter to work on
+ @param[in] Offset - The Offset to work on
+ @param[in] CurrentComp - The current Comp code for OptParam
+ @param[in] ReadHost - Switch to read current offset and CompCode from Host structure.
+
+ @retval Calc power in mW
+**/
+U32
+CalcOptPower (
+ IN MrcParameters *MrcData,
+ IN U8 Channel,
+ IN U8 Rank,
+ IN U8 Byte,
+ IN U8 OptParam,
+ IN S8 Offset,
+ IN S8 CurrentComp,
+ IN BOOL ReadHost
+ )
+{
+ U32 Power;
+ U16 Rleg;
+ S8 StatLegs;
+ U8 OdtLegsDis;
+ S8 CurrentVref;
+ U8 RxVselect;
+ U8 RxCBSelect;
+ S8 RxFselect;
+ U8 RxDefault;
+ extern const U8 RxBiasTable[2][5][4];
+ U8 RxPowerScale[] = { 33, 66, 88, 100, 133, 166, 200, 233 };
+ U32 Vcc;
+ U32 CPURXPower;
+ MrcVddSelect Vdd;
+ MrcOutput *Outputs;
+ MrcChannelOut *ChannelOut;
+ const MrcInput *Inputs;
+ const MrcDebug *Debug;
+ DDRCOMP_CR_DDRCRCOMPCTL0_STRUCT DdrCrCompCtl0;
+ DDRDATA0CH0_CR_DDRCRDATAOFFSETCOMP_STRUCT DdrCrDataOffsetComp;
+ DDR3_MODE_REGISTER_1_STRUCT Ddr3ModeRegister1;
+ DDRCOMP_CR_DDRCRDATACOMP0_STRUCT DdrCrDataComp0;
+ DDRCOMP_CR_DDRCRDATACOMP1_STRUCT DdrCrDataComp1;
+#ifdef ULT_FLAG
+ BOOL Lpddr;
+ U16 DimmRon;
+ extern const U8 RxBiasTableUlt[2][3][4];
+
+ Lpddr = (MrcData->SysOut.Outputs.DdrType == MRC_DDR_TYPE_LPDDR3);
+#endif //ULT_FLAG
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ ChannelOut = &Outputs->Controller[0].Channel[Channel];
+ DdrCrDataComp0.Data = 0;
+ DdrCrDataComp1.Data = 0;
+ DdrCrDataOffsetComp.Data = 0;
+ Power = 0;
+ Vdd = Outputs->VddVoltage[Inputs->MemoryProfile];
+
+ if ((OptParam == OptWrDS) || (OptParam == OptRdOdt) || (OptParam == OptSComp)) {
+ DdrCrDataOffsetComp.Data = ChannelOut->DataCompOffset[Byte];
+ if (OptParam == OptRdOdt) {
+ DdrCrDataComp1.Data = MrcReadCR (MrcData, DDRCOMP_CR_DDRCRDATACOMP1_REG);
+ } else {
+ DdrCrDataComp0.Data = MrcReadCR (MrcData, DDRCOMP_CR_DDRCRDATACOMP0_REG);
+ }
+ }
+
+ if (OptParam == OptWrDS) {
+ DdrCrCompCtl0.Data = Outputs->CompCtl0;
+ //
+ // Added Driver RCOMP Vref for driver impedance calculation
+ //
+ CurrentVref = (S8) DdrCrCompCtl0.Bits.DqDrvVref;
+ if (CurrentVref & 0x8) {
+ CurrentVref -= 0x10; // 2's complement
+ }
+
+ if (ReadHost) {
+ CurrentComp = (S8) DdrCrDataComp0.Bits.RcompDrvUp;
+ Offset = (S8) DdrCrDataOffsetComp.Bits.DqDrvUpCompOffset;
+
+ if (Offset & 0x20) {
+ Offset-= 0x40; // 2's complement
+ }
+ }
+
+ StatLegs = 3 * 4 * 4; // seg*legs*4 - for calc set to 48
+ Rleg = CalcDrvImp (MrcData, CurrentVref) / 3 * (StatLegs + 3 * CurrentComp); // RCOMP Vref added to Rleg calculation
+ Power = Rleg / (StatLegs + 3 * (CurrentComp + (Offset))); // in ohm
+ }
+
+ if (OptParam == OptRdOdt) {
+ DdrCrCompCtl0.Data = Outputs->CompCtl0;
+ OdtLegsDis = (U8) DdrCrCompCtl0.Bits.DisableOdtStatic;
+ CurrentVref = (S8) DdrCrCompCtl0.Bits.DqOdtVref;
+ StatLegs = 4 * 4; // we enable only 1/3 segment for odt 4 legs time 4
+
+ if (CurrentVref & 0x10) {
+ CurrentVref -= 0x20; // 2's complement
+ }
+
+ if (ReadHost) {
+ CurrentComp = (S8) DdrCrDataComp1.Bits.RcompOdtUp;
+ Offset = (S8) DdrCrDataOffsetComp.Bits.DqOdtUpCompOffset;
+ if (Offset & 0x10) {
+ Offset-= 0x20; // 2's complement
+ }
+ }
+ //
+ // Avoid division by zero.
+ //
+ if (CurrentComp == 0) {
+ CurrentComp = 1;
+ }
+ Rleg = CalcRdOdt (MrcData, CurrentVref) * (StatLegs * (!OdtLegsDis) + CurrentComp);
+ Power = Rleg / (StatLegs * (!OdtLegsDis) + (CurrentComp + (Offset))); // in ohm
+ }
+
+ if (OptParam == OptSComp) {
+ if (ReadHost) {
+ Offset = (S8) DdrCrDataOffsetComp.Bits.DqSlewRateCompOffset;
+ if (Offset & 0x10) {
+ Offset -= 0x20; // 2's complement
+ }
+ }
+ Power = 50 + Offset; // simple linear T-line
+ }
+
+ if (OptParam == OptTxEq) {
+ Power = Offset; // simple linear T-line
+ }
+
+ if (OptParam == OptRxEq) {
+ Power = 100 + (5 * (Offset / 5)); // modulo 5 T-line
+ }
+
+ if (OptParam == OptDimmRon) {
+ //
+ // calc the DimmRon [ohm]
+ //
+ if (ReadHost) {
+ if (Rank < MAX_RANK_IN_CHANNEL) {
+#ifdef ULT_FLAG
+ if (Lpddr) {
+ DimmRon = ChannelOut->Dimm[Rank / 2].Rank[Rank % 2].MR[mrMR3];
+ Offset = (U8) 0xF & (DimmRon - 1); //{0x1,0x2,0x3}; //{34,40,48};
+ } else
+#endif //ULT_FLAG
+ {
+ Ddr3ModeRegister1.Data = ChannelOut->Dimm[Rank / 2].Rank[Rank % 2].MR[mrMR1];
+ Offset = (U8) Ddr3ModeRegister1.Bits.ODImpedanceLow;
+ }
+ } else {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "Error: ChannelOut->Dimm array out of bounds! %d > %d\n",
+ Rank / 2,
+ MAX_DIMMS_IN_CHANNEL - 1
+ );
+ return 0;
+ }
+ }
+
+#ifdef ULT_FLAG
+ if (Lpddr) {
+ if (Offset > 6) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "Offset %d causes negative unsigned number or divide by 0. Dividing by 1.\n",
+ Offset
+ );
+ Offset = 6;
+ }
+
+ Power = 240 / (7 - Offset);
+ } else
+#endif //ULT_FLAG
+ {
+ if (Offset < -5) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "Offset %d causes negative unsigned number or divide by 0. Dividing by 1.\n",
+ Offset
+ );
+ Offset = -5;
+ }
+
+ Power = 240 / (6 + Offset);
+ }
+ }
+
+ if (OptParam == OptRxBias) {
+ //
+ // RX BIAS calculations
+ //
+ Vcc = 1050;
+ RxVselect = 0;
+ if (Vdd > VDD_1_35) {
+ RxVselect = 1; // Set HiVdd bit if Vdd is over 1.35v
+ }
+ //
+ // RX BIAS calculations
+ //
+ GetRxFselect (MrcData, &RxFselect, &RxCBSelect);
+
+#ifdef ULT_FLAG
+ if (MrcData->SysIn.Inputs.CpuModel == cmHSW_ULT) {
+ RxFselect = MIN (RxFselect, RXF_SELECT_MAX_ULT); // Maximum 1600 MHz
+ RxDefault = RxBiasTableUlt[RxVselect][RxFselect][RxCBSelect]; // Read setting from array lookup table
+ } else
+#endif // ULT_FLAG
+ {
+ RxDefault = RxBiasTable[RxVselect][RxFselect][RxCBSelect]; // Read setting from array lookup table
+ }
+
+ CPURXPower = Vdd * 1200 / 1000 + Vcc * 1250 / 1000; // mW
+ CPURXPower /= 1000;
+ if (ReadHost) {
+ Offset = (U8) ChannelOut->DqControl1[Byte].Bits.RxBiasCtl;
+ }
+
+ CPURXPower = (RxPowerScale[Offset] * CPURXPower) / RxPowerScale[RxDefault];
+ Power = (U16) CPURXPower;
+ }
+
+ return Power;
+}
+
+/**
+ This function prints out the Margin eye diagram for ParamT/ParamV.
+
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Channel - Channel to margin.
+ @param[in] Ranks - Bit mask of Ranks to margin.
+ @param[in] ParamT - Time parameter to margin.
+ @param[in] ParamV - Voltage parameter to margin.
+ @param[in] Start - Starting point for margining.
+ @param[in] Stop - Stopping point for margining.
+ @param[in] Repeats - Number of times to repeat the test to average out any noise.
+ @param[in] NoPrint - Switch to skip printing.
+
+ @retval Nothing
+**/
+void
+EyeMargin (
+ IN MrcParameters *const MrcData,
+ IN U8 Channel,
+ IN U8 Ranks,
+ IN U8 ParamT,
+ IN U8 ParamV,
+ IN S8 Start,
+ IN S8 Stop,
+ IN U16 SearchLimits,
+ IN U8 LoopCount,
+ IN U8 Repeats,
+ IN BOOL NoPrint
+ )
+{
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcChannelOut *ChannelOut;
+ MrcControllerOut *ControllerOut;
+ MrcStatus Status;
+ U32 (*MarginByte)[MAX_RESULT_TYPE][MAX_RANK_IN_CHANNEL][MAX_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_EDGES];
+ U32 BERStats[4];
+ U16 SaveMargin[63][MAX_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_EDGES]; //40 Points X Ch X Byte X Hi/Lo
+ BOOL Eye[63][108];
+ BOOL Lines[108];
+ U8 MaxH=108;
+ U8 MaxW=63;
+ U8 i,j;
+ U16 MinEdge;
+ U16 Mode;
+ U8 ResultTypeV = 0;
+ U8 ChBitMask;
+ U8 Byte;
+ U8 Rank;
+ U8 Edge;
+ U8 FirstRank;
+ U8 NumBytes;
+ U8 BMap[9]; // Need by GetBERMarginByte
+ U8 MaxMarginV;
+ U8 localR[MAX_CHANNEL];
+ U8 Rep;
+ S8 Index;
+ U8 IndexOff;
+ S8 Off;
+ U8 byteMax[MAX_CHANNEL];
+ U32 Offset;
+ U64 CrValue64;
+
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ MarginByte = &Outputs->MarginResult;
+ Ranks &= Outputs->ValidRankMask;
+ ControllerOut = &Outputs->Controller[0];
+ IndexOff = 0;
+ CrValue64 = 0x0ULL; //64 bit Data bit mask
+
+ MrcOemMemorySet ((U8 *) localR, 0, sizeof(localR));
+ MrcOemMemorySet ((U8 *) Eye, 0, sizeof(Eye));
+ MrcOemMemorySet ((U8 *) Lines, 0, sizeof(Lines));
+ MrcOemMemorySet ((U8 *) SaveMargin, 0, sizeof(SaveMargin));
+ MrcOemMemorySetDword (BERStats, 0, sizeof(BERStats) / sizeof (U32));
+ for (Byte = 0; Byte < sizeof (BMap) / sizeof (BMap[0]); Byte++) {
+ BMap[Byte] = Byte;
+ }
+
+ Outputs->EnDumRd = 0;
+ SetupIOTestBasicVA(MrcData, 1<<Channel, LoopCount, 0, 0, 0,8); //set test to all channels
+ //
+ // Select All Ranks for REUT test
+ //
+ ChannelOut = &ControllerOut->Channel[Channel];
+ localR[Channel] = ChannelOut->ValidRankBitMask & Ranks;
+ //
+ // use ChBitMask from here down - if ch is set that mean at least 1 rank for testing, also remove ch w/o active ranks
+ //
+ ChBitMask = SelectReutRanks (MrcData, Channel, localR[Channel], 0);
+
+ if (ChBitMask == 0) {
+ return ;
+ }
+
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ ChannelOut->DataOffsetTrain[Byte] = 0;
+ }
+ //
+ // Find the first selected rank
+ //
+ FirstRank = 0;
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if ((1 << Rank) & localR[Channel]) {
+ FirstRank = Rank; // could be in any channel
+ break;
+ }
+ }
+ //
+ // Store margin results for
+ //
+ NumBytes = (U8) Outputs->SdramCount;
+
+ //
+ // Loop through all Test Params and Measure Margin
+ // Find MaxMargin for this channel
+ //
+ byteMax[Channel] = Stop;
+ if (ParamT == RdT) {
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ byteMax[Channel] = MrcCalcMaxRxMargin (MrcData, Channel, Ranks, Byte, 0, byteMax[Channel]);
+ }
+ }
+
+ Offset = MCHBAR_CH0_CR_REUT_CH_ERR_DATA_MASK_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_ERR_DATA_MASK_REG - MCHBAR_CH0_CR_REUT_CH_ERR_DATA_MASK_REG) * Channel);
+
+ MrcWriteCR64 (MrcData, Offset, CrValue64);
+ MaxMarginV = MAX_POSSIBLE_VREF;
+ if (MAX_POSSIBLE_TIME < Stop) {
+ Stop = MAX_POSSIBLE_TIME;
+ }
+
+ if (-MAX_POSSIBLE_TIME > Start) {
+ Start = -MAX_POSSIBLE_TIME;
+ }
+
+ IndexOff = MaxW / 2 + Start;
+ //
+ // No need to search too far
+ //
+ if (MaxMarginV > SearchLimits) {
+ MaxMarginV = (U8) (SearchLimits);
+ }
+
+ for (Off = Start; Off < Stop + 1; Off++) {
+ Index = Off - Start;
+ //
+ // change margin ParamT
+ //
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ Status = ChangeMargin (MrcData, ParamT, Off, 0, 0, Channel, localR[Channel], Byte, 0, 1, 0, MrcRegFileStart);
+ }
+ ResultTypeV = GetMarginResultType (ParamV); // rxv=0 rxt=1
+ //
+ // Assign to last pass margin results by reference
+ // get lowest margin from all ch/rankS/byte save in FirstRank
+ //
+ Status = GetMarginByte (
+ MrcData,
+ Outputs->MarginResult,
+ ParamV,
+ FirstRank,
+ Ranks
+ );
+ for (Rep = 0; Rep < Repeats; Rep++) {
+ //
+ // Run Margin Test - margin_1d with chosen param
+ // run on all ranks but change param only for firstRank??
+ //
+ Mode = 0;
+ Status = MrcGetBERMarginByte (
+ MrcData,
+ Outputs->MarginResult,
+ ChBitMask,
+ FirstRank,
+ FirstRank,
+ ParamV,
+ Mode,
+ BMap,
+ 1,
+ MaxMarginV,
+ 0,
+ BERStats
+ );
+ //
+ // Record Results
+ //
+ for (Edge = 0; Edge < MAX_EDGES; Edge++) {
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ if ((Index > 62) || (Index < 0)) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Error: SaveMargin array out of bounds! %d", Index);
+ return;
+ }
+
+ if (Rep == 0) {
+ SaveMargin[Index][Channel][Byte][Edge] = 0;
+ }
+
+ SaveMargin[Index][Channel][Byte][Edge] += (U16) (*MarginByte)[ResultTypeV][FirstRank][Channel][Byte][Edge];
+ }
+ }
+ }
+
+ for (Edge = 0; Edge < MAX_EDGES; Edge++) {
+ MinEdge = 0xFFFF;
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ if ((Index > 62) || (Index < 0)) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Error: SaveMargin array out of bounds! %d", Index);
+ return;
+ }
+
+ SaveMargin[Index][Channel][Byte][Edge] /= Repeats;
+ if (MinEdge > SaveMargin[Index][Channel][Byte][Edge]) {
+ MinEdge = SaveMargin[Index][Channel][Byte][Edge];
+ }
+ }
+
+ if (((Index + IndexOff) > 62) ||
+ ((Index + IndexOff) < 0) ||
+ ((MaxH / 2 - (MinEdge - 1) / 10) > 107) ||
+ ((MaxH / 2 - (MinEdge - 1) / 10) < 0) ||
+ ((MaxH / 2 + (MinEdge - 1) / 10) > 107) ||
+ ((MaxH / 2 + (MinEdge - 1) / 10) < 0)
+ ) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Error: Eye or Lines array out of bounds!\n");
+ return;
+ }
+
+ if (Edge) {
+ Eye[Index + IndexOff][MaxH / 2 - (MinEdge - 1) / 10] = 1;
+ Lines[MaxH / 2 - (MinEdge - 1) / 10] = 1;
+ } else {
+ Eye[Index + IndexOff][MaxH / 2 + (MinEdge - 1) / 10] = 1;
+ Lines[MaxH / 2 + (MinEdge - 1) / 10] = 1;
+ }
+ }
+ }//end of offset
+ //
+ // Print the box
+ //
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "Plot Eye across ParamT = %s ParamV = %s settings:(Start=%d,Stop=%d) LC = %d Channel = %d Ranks = 0x%x\n",
+ MarginTypesString[ParamT],
+ MarginTypesString[ParamV],
+ Start,
+ Stop,
+ LoopCount,
+ Channel,
+ Ranks
+ );
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\t------------------------------- +++++++++++++++++++++++++++++++\n");
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\t332222222222111111111100000000000000000001111111111222222222233\n");
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Vref\t109876543210987654321098765432101234567890123456789012345678901\n");
+ for (i = 0; i < MaxH; i++) {
+ if (Lines[i]) {
+ //
+ // print only fail lines
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%3d:\t", MaxH / 2 - i); // per ch
+ for (j = 0; j < MaxW; j++) {
+ if (Eye[j][i]) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s", "#"); // per ch
+ } else {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s", ((j == (MaxW) / 2) || (i == (MaxH) / 2)) ? "+" : " "); // per ch
+ }
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");//per ch
+ }
+ }
+ //
+ // Clean up after test
+ //
+ ChannelOut = &ControllerOut->Channel[Channel];
+ MrcOemMemorySetDword (&ChannelOut->DataOffsetTrain[0], 0, Outputs->SdramCount);
+ Status = ChangeMargin (MrcData, ParamT, 0, 0, 1, 0, 0, 0, 0, 0, 0, MrcRegFileCurrent);
+
+}
+
+/**
+ This function fill the input array (e.g array[ch][rank]) with the power calculation
+ per rank/ch for current sys. setting.
+
+ @param[in] MrcData - MRC data struct;
+ @param[in,out] PwrChRank - Array to fill;
+
+ @retval Nothing
+**/
+void
+CalcSysPower (
+ IN MrcParameters *const MrcData,
+ IN OUT MrcPower PwrChRank[MAX_CHANNEL][MAX_RANK_IN_CHANNEL]
+ )
+{
+ const MrcDebug *Debug;
+ MrcChannelOut *ChannelOut;
+ MrcOutput *Outputs;
+ MrcOdtPowerSaving *OdtPowerSaving;
+ U8 Rank;
+ U8 Byte;
+ U8 Channel;
+ BOOL is1DPC;
+ BOOL ChCalcDone;
+ U16 ROdtCpu;
+ U8 RonDimm;
+ U16 RonCpu;
+ U16 Rodtdram;
+ U16 Wodtdram;
+ U16 RxBiasPwr;
+ U8 TotalRankCount;
+ U32 PwrAvgRd;
+ U32 PwrAvgWr;
+ const U8 RttNomDic[6] = {0,60,120,40,20,30}; //accordingly to DDR3 spec
+ const U8 RttWrDic[3] = {0,60,120}; //accordingly to DDR3 spec
+ DDR3_MODE_REGISTER_1_STRUCT Ddr3ModeRegister1;
+ DDR3_MODE_REGISTER_2_STRUCT Ddr3ModeRegister2;
+#ifdef ULT_FLAG
+ U16 LpddrMr3; //dimm DS
+ U16 LpddrMr11; //dimm ODT
+ const U8 LpddrRonDic[4] = {0,34,40,48};
+ const U8 LpddrOdtDic[4] = {0,0,120,240};
+#endif // ULT_FLAG
+
+ Outputs = &MrcData->SysOut.Outputs;
+ OdtPowerSaving = &Outputs->OdtPowerSavingData;
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ RxBiasPwr = 0;
+ TotalRankCount = 0;
+ PwrAvgRd = 0;
+ PwrAvgWr = 0;
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChCalcDone = 0;
+ RonCpu = 0;
+ ROdtCpu = 0;
+ RxBiasPwr = 0;
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ ChannelOut = &Outputs->Controller[0].Channel[Channel];
+ is1DPC = (ChannelOut->DimmCount == 1);
+ if (MrcRankInChannelExist (MrcData, Rank, Channel)) {
+#ifdef ULT_FLAG
+ if (MrcData->SysOut.Outputs.DdrType == MRC_DDR_TYPE_LPDDR3) {
+ if (Rank >= MAX_RANK_IN_DIMM) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Error: ChannelOut array out of bounds!\n");
+ return ;
+ }
+
+ LpddrMr3 = ChannelOut->Dimm[0].Rank[Rank].MR[mrMR3];
+ LpddrMr11 = ChannelOut->Dimm[0].Rank[Rank].MR11;
+ RonDimm = LpddrRonDic[0x3 & LpddrMr3];
+ Wodtdram = LpddrOdtDic[0x3 & LpddrMr11];
+ Rodtdram = 0x3FFF; // put 8k ohm as infinity - in lpddr there is no nomOdt
+ } else
+#endif // ULT_FLAG
+ {
+ Ddr3ModeRegister1.Data = ChannelOut->Dimm[Rank / 2].Rank[Rank % 2].MR[mrMR1];
+ Ddr3ModeRegister2.Data = ChannelOut->Dimm[Rank / 2].Rank[Rank % 2].MR[mrMR2];
+ RonDimm = 240 / (6 + (U8) Ddr3ModeRegister1.Bits.ODImpedanceLow);
+ Rodtdram = RttNomDic[(Ddr3ModeRegister1.Bits.OdtRttValueHigh << 2) |
+ (Ddr3ModeRegister1.Bits.OdtRttValueMid << 1) |
+ Ddr3ModeRegister1.Bits.OdtRttValueLow];
+ Wodtdram = RttWrDic[Ddr3ModeRegister2.Bits.DynamicOdt];
+ }
+ if (!ChCalcDone){
+ //
+ //Ron CPU - take average all bytes only per ch
+ //
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++){
+ RonCpu += (U16) CalcOptPower (MrcData, Channel, 0, Byte, OptWrDS, 0, 0, 1);//read from host
+ ROdtCpu += (U16) CalcOptPower (MrcData, Channel, 0, Byte, OptRdOdt, 0, 0, 1);//read from host
+ RxBiasPwr += (U16) CalcOptPower (MrcData, Channel, 0, Byte, OptRxBias, 0, 0, 1);//read from host
+ }
+ RonCpu /= (U16) Outputs->SdramCount;
+ ROdtCpu /= (U16) Outputs->SdramCount;
+ RxBiasPwr /= (U16) Outputs->SdramCount;
+ ChCalcDone = 1;
+ }
+
+ if (is1DPC) {
+ //
+ // in 1DPC channel always use only one of the terminations
+ //
+ if (Wodtdram == 0) {
+ Wodtdram = Rodtdram;
+ Rodtdram = 0x3FFF; // put 8k ohm as infinity
+ } else {
+ Rodtdram = 0x3FFF; // put 8k ohm as infinity
+ }
+ }
+
+ if (Rodtdram == 0) {
+ Rodtdram = 0x3FFF;
+ }
+
+ if (Wodtdram == 0) {
+ Wodtdram = Rodtdram; // in 2DPC where RttW=0
+ }
+
+ CalcPower (MrcData, &PwrChRank[Channel][Rank], RonCpu, RonDimm, ROdtCpu, Rodtdram, Wodtdram);
+ //
+ // add RxBias to CPU and Total
+ //
+ PwrChRank[Channel][Rank].CpuPower += RxBiasPwr;
+ PwrChRank[Channel][Rank].TotPwr += RxBiasPwr;
+ PwrAvgRd += PwrChRank[Channel][Rank].CpuPwrRd + PwrChRank[Channel][Rank].DimmPwrRd +
+ PwrChRank[Channel][Rank].ACPowerRd;
+ PwrAvgWr += PwrChRank[Channel][Rank].CpuPwrWr + PwrChRank[Channel][Rank].DimmPwrWrT +
+ PwrChRank[Channel][Rank].DimmPwrWrNT + PwrChRank[Channel][Rank].ACPowerWr;
+ TotalRankCount++;
+ }
+ }
+ }
+
+ if (TotalRankCount == 0) {
+ TotalRankCount = 1; // Prevent divide by 0
+ }
+
+ PwrAvgRd /= TotalRankCount;
+ PwrAvgRd += RxBiasPwr;
+ PwrAvgWr /= TotalRankCount;
+ //
+ // update Mrc struct with Base line numbers
+ //
+ if (OdtPowerSaving->BaseFlag == FALSE) {
+ OdtPowerSaving->BaseSavingRd = (U16) PwrAvgRd;
+ OdtPowerSaving->BaseSavingWr = (U16) PwrAvgWr;
+ OdtPowerSaving->BaseSavingCmd = 0; // currently no power train for CMD
+ } else {
+ OdtPowerSaving->MrcSavingRd = (U16) PwrAvgRd;
+ OdtPowerSaving->MrcSavingWr = (U16) PwrAvgWr;
+ OdtPowerSaving->MrcSavingCmd = 0; // currently no power train for CMD
+ }
+
+ return;
+}
+
+/**
+ This function optimize the digital offsets by reducing the digital
+ offset and apply the difference to the global one.
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Param - Parameter defining the desired digital compensation offset.
+ @param[in] UpdateHost - Decides if MrcData is to be updated.
+
+ @retval The new comp value.
+**/
+U32
+OptimizeCompOffset (
+ IN MrcParameters *const MrcData,
+ IN const U8 Param,
+ IN const U8 UpdateHost
+ )
+{
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ DDRCOMP_CR_DDRCRDATACOMP0_STRUCT DdrCrDataComp0;
+ DDRCOMP_CR_DDRCRDATACOMP1_STRUCT DdrCrDataComp1;
+ DDRCOMP_CR_DDRCRCOMPCTL0_STRUCT DdrCrCompCtl0;
+ DDRCOMP_CR_DDRCRCOMPCTL1_STRUCT DdrCrCompCtl1;
+ DDRDATA0CH0_CR_DDRCRDATAOFFSETCOMP_STRUCT DdrCrDataOffsetComp;
+ U8 GlobalParam;
+ U8 CurrCompVref;
+ S8 NewCompVref;
+ U8 CurrentComp;
+ U8 NewComp;
+ S8 Sign;
+ U8 Done;
+ S16 AvgOffset;
+ U8 Offset;
+ U8 StartDelta;
+ U8 CurrDelta;
+ U8 MinDelta;
+ U8 Off;
+ U8 BestVrefOff;
+ U8 SignBit;
+ U8 Byte;
+ U8 Channel;
+ U8 NumCh;
+ U8 ReservedCodes;
+ S8 MaxCompVref;
+ S8 MinCompVref;
+ U8 DqSCompPC;
+ U8 CurrDqSCompPC;
+ U8 CompCodes[MAX_CHANNEL][MAX_SDRAM_IN_DIMM];
+
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerOut = &Outputs->Controller[0];
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ DdrCrCompCtl0.Data = Outputs->CompCtl0;
+ DdrCrCompCtl1.Data = Outputs->CompCtl1;
+
+ DdrCrDataOffsetComp.Data = 0;
+ ReservedCodes = 3;
+ NewComp = 0;
+ Offset = 0;
+ SignBit = 0;
+ DqSCompPC = 0;
+ CurrDqSCompPC = 0;
+
+ switch (Param) {
+ case OptWrDS:
+ DdrCrDataComp0.Data = MrcReadCR (MrcData, DDRCOMP_CR_DDRCRDATACOMP0_REG);
+ CurrentComp = (U8) DdrCrDataComp0.Bits.RcompDrvUp;
+ CurrCompVref = MrcSE ((U8) DdrCrCompCtl0.Bits.DqDrvVref, 4, 8);
+ MaxCompVref = (1 << (DDRCOMP_CR_DDRCRCOMPCTL0_DqDrvVref_WID - 1)) - 1;
+ MinCompVref = (-1) * 1 << (DDRCOMP_CR_DDRCRCOMPCTL0_DqDrvVref_WID - 1);
+ GlobalParam = WrDS;
+ break;
+
+ case OptRdOdt:
+ DdrCrDataComp1.Data = MrcReadCR (MrcData, DDRCOMP_CR_DDRCRDATACOMP1_REG);
+ CurrentComp = (U8) DdrCrDataComp1.Bits.RcompOdtUp;
+ CurrCompVref = MrcSE ((U8) DdrCrCompCtl0.Bits.DqOdtVref, 5, 8);
+ MaxCompVref = (1 << (DDRCOMP_CR_DDRCRCOMPCTL0_DqOdtVref_WID - 1)) - 1;
+ MinCompVref = (-1) * 1 << (DDRCOMP_CR_DDRCRCOMPCTL0_DqOdtVref_WID - 1);
+ GlobalParam = RdOdt;
+ break;
+
+ case OptSComp:
+ DdrCrDataComp0.Data = MrcReadCR (MrcData, DDRCOMP_CR_DDRCRDATACOMP0_REG);
+ CurrentComp = (U8) DdrCrDataComp0.Bits.SlewRateComp;
+ CurrDqSCompPC = (U8) DdrCrCompCtl1.Bits.DqScompPC;
+ CurrCompVref = (U8) DdrCrCompCtl1.Bits.DqScompCells;
+ MaxCompVref = (1 << (DDRCOMP_CR_DDRCRCOMPCTL1_DqScompCells_WID)) - 1;
+ MinCompVref = 4;
+ GlobalParam = SCompDq;
+ break;
+
+ default:
+ CurrentComp = 0;
+ CurrCompVref = 0;
+ MaxCompVref = 0;
+ MinCompVref = 0;
+ GlobalParam = 0;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "Invalid Param : %d", Param);
+ break;
+ }
+
+ AvgOffset = 0;
+ NumCh = 0;
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if ((MrcChannelExist (Outputs, Channel))) {
+ ChannelOut = &MrcData->SysOut.Outputs.Controller[0].Channel[Channel];
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ DdrCrDataOffsetComp.Data = ChannelOut->DataCompOffset[Byte];
+ if (Param == OptWrDS) {
+ Offset = (U8) DdrCrDataOffsetComp.Bits.DqDrvUpCompOffset;
+ SignBit = 6;
+ }
+
+ if (Param == OptRdOdt) {
+ Offset = (U8) DdrCrDataOffsetComp.Bits.DqOdtUpCompOffset;
+ SignBit = 5;
+ }
+
+ if (Param == OptSComp) {
+ Offset = (U8) DdrCrDataOffsetComp.Bits.DqSlewRateCompOffset;
+ SignBit = 5;
+ }
+
+ AvgOffset += (S8) MrcSE (Offset, SignBit, 8);
+ CompCodes[Channel][Byte] = CurrentComp + MrcSE (Offset, SignBit, 8);
+ }
+
+ NumCh++;
+ }
+ }
+
+ Sign = (AvgOffset < 0) ? -1 : 1;
+ //
+ // Calculate the average offset and round to the nearest integer.
+ //
+ AvgOffset = (AvgOffset + Sign * NumCh * ((U8) Outputs->SdramCount) / 2) / (NumCh * ((U8) Outputs->SdramCount));
+
+ if (AvgOffset == 0) {
+ return CurrentComp;
+ }
+ //
+ // Find the CompVref minimum of the delta between (CurrentComp + AvgOffset) to NewComp.
+ // Take care of keeping 3 code reserved.
+ // Exit if no vref range left.
+ //
+ Done = 0;
+ Off = 1;
+ BestVrefOff = CurrCompVref;
+ NewComp = CurrentComp;
+ DqSCompPC = CurrDqSCompPC;
+ StartDelta = ABS ((S8) AvgOffset);
+ MinDelta = StartDelta;
+ if (Param == OptSComp) {
+ Sign *= -1;
+ }
+
+ while (!Done) {
+ NewCompVref = CurrCompVref + (Sign * Off);
+ if ((MinCompVref > NewCompVref) || (NewCompVref > MaxCompVref)) {
+ Done = 1;
+ }
+ //
+ // Reserve 3 comp codes
+ //
+ if ((ReservedCodes > NewComp) || (NewComp > (63 - ReservedCodes))) {
+ Done = 1;
+ }
+
+ if (Param == OptSComp) {
+ if ((NewCompVref + 1) > 16) {
+ DqSCompPC = 0;
+ }
+
+ NewCompVref = (DqSCompPC << 4) + NewCompVref;
+ }
+
+ if (!Done) {
+ NewComp = (U8) UpdateCompGlobalOffset (MrcData, GlobalParam, NewCompVref, 0);
+ CurrDelta = ABS (CurrentComp + (S8) AvgOffset - NewComp);
+ if (CurrDelta < StartDelta) {
+ if (CurrDelta < MinDelta) {
+ MinDelta = CurrDelta;
+ BestVrefOff = NewCompVref;
+ if (MinDelta == 0) {
+ Done = 1;
+ }
+ }
+ } else {
+ Done = 1;
+ }
+ }
+
+ Off++;
+ }
+ //
+ // update new compVref setting
+ //
+ if (BestVrefOff != CurrCompVref) {
+ NewComp = (U8) UpdateCompGlobalOffset (MrcData, GlobalParam, BestVrefOff, UpdateHost);
+ //
+ // Update all bytes with new offset: Offset + code - newcode = +newoffset
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &MrcData->SysOut.Outputs.Controller[0].Channel[Channel];
+ if ((MrcChannelExist (Outputs, Channel))) {
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ UpdateOptParamOffset (MrcData, Channel, 0, Byte, Param, CompCodes[Channel][Byte] - NewComp, UpdateHost);
+ }
+ }
+ }
+ } else {
+ //
+ // Restore CompVref
+ //
+ if (Param == OptSComp) {
+ NewCompVref = (CurrDqSCompPC << 4) + CurrCompVref;
+ }
+
+ NewComp = (U8) UpdateCompGlobalOffset (MrcData, GlobalParam, CurrCompVref, UpdateHost);
+ }
+
+ return NewComp;
+}
+
+/**
+ This step performs Comp Offset optimization on the param list defined in this function.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - mrcSuccess
+**/
+MrcStatus
+MrcOptimizeComp (
+ IN MrcParameters *const MrcData
+ )
+{
+ const U8 ParamList[] = { OptWrDS, OptRdOdt, OptSComp };
+ U8 Param;
+
+ for (Param = 0; Param < sizeof (ParamList); Param++) {
+ OptimizeCompOffset (MrcData, ParamList[Param], 1);
+ }
+
+ return mrcSuccess;
+}
+
+/**
+ This function calculates the percent of power saving from the power optimization steps and
+ updates the proper registers in the PCU. To get the correct base line for this calculation,
+ this routing needs to run first time early in the training in order to update the MrcStruct
+ with the base line. After the power training steps, it will run again to get the actual
+ percent of power saving.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - mrcSuccess
+
+**/
+MrcStatus
+MrcPowerSavingMeter (
+ IN MrcParameters *const MrcData
+ )
+{
+ MrcDebug const *Debug;
+ MrcPower PwrChRank[MAX_CHANNEL][MAX_RANK_IN_CHANNEL];
+ MrcOdtPowerSaving *OdtPowerSaving;
+ U8 PercentRd;
+ U8 PercentWr;
+ U8 PercentCmd;
+ PCU_CR_MRC_ODT_POWER_SAVING_PCU_STRUCT CrMrcOdtPowerSavingPcu;
+
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ OdtPowerSaving = &MrcData->SysOut.Outputs.OdtPowerSavingData;
+ CalcSysPower (MrcData, PwrChRank);
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\tBaseLine\tMrcSaving\nAvgRd\t%d\t\t%d\nAvgWr\t%d\t\t%d\n",
+ OdtPowerSaving->BaseSavingRd,
+ OdtPowerSaving->MrcSavingRd,
+ OdtPowerSaving->BaseSavingWr,
+ OdtPowerSaving->MrcSavingWr
+ );
+
+ if (OdtPowerSaving->BaseFlag) {
+ //
+ // Calculate power saving and update PCU regs
+ //
+ if (OdtPowerSaving->BaseSavingRd > OdtPowerSaving->MrcSavingRd) {
+ PercentRd = (U8) (((U32) (OdtPowerSaving->BaseSavingRd - OdtPowerSaving->MrcSavingRd) * 256) / OdtPowerSaving->BaseSavingRd);
+ } else {
+ PercentRd = 0;
+ }
+
+ if (OdtPowerSaving->BaseSavingWr > OdtPowerSaving->MrcSavingWr) {
+ PercentWr = (U8) (((U32) (OdtPowerSaving->BaseSavingWr - OdtPowerSaving->MrcSavingWr) * 256) / OdtPowerSaving->BaseSavingWr);
+ } else {
+ PercentWr = 0;
+ }
+
+ if (OdtPowerSaving->BaseSavingCmd > OdtPowerSaving->MrcSavingCmd) {
+ PercentCmd = (U8) (((U32) (OdtPowerSaving->BaseSavingCmd - OdtPowerSaving->MrcSavingCmd) * 256) / OdtPowerSaving->BaseSavingCmd);
+ } else {
+ PercentCmd = 0;
+ }
+
+ CrMrcOdtPowerSavingPcu.Bits.MRC_Saving_Rd = PercentRd;
+ CrMrcOdtPowerSavingPcu.Bits.MRC_Saving_Wt = PercentWr;
+ CrMrcOdtPowerSavingPcu.Bits.MRC_Saving_Cmd = PercentCmd;
+
+ MrcWriteCR (MrcData, PCU_CR_MRC_ODT_POWER_SAVING_PCU_REG, CrMrcOdtPowerSavingPcu.Data);
+ } else {
+ OdtPowerSaving->BaseFlag = TRUE;
+ }
+
+ return mrcSuccess;
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Services/MrcDdr3.c b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Services/MrcDdr3.c
new file mode 100644
index 0000000..654a332
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Services/MrcDdr3.c
@@ -0,0 +1,1572 @@
+/** @file
+ This file includes all the DDR3 specific characteristic functions.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+
+**/
+
+//
+// Include files
+//
+#include "MrcDdr3.h"
+
+#ifdef ULT_FLAG
+///
+/// Only 1DPC is supported on HSW-ULT
+///
+const TOdtValue MbUltOdtTable[MAX_DIMMS_IN_CHANNEL][2] = {
+/// 1DPC 1R, 1DPC 2R
+ {{120,0}, {120,0}},
+};
+
+const TOdtValue User1UltOdtTable[MAX_DIMMS_IN_CHANNEL][2] = {
+/// 1DPC 1R, 1DPC 2R
+ {{120,0}, {120,0}},
+};
+
+#endif //ULT_FLAG
+
+#ifdef TRAD_FLAG
+const TOdtValue MbTradOdtTable[MAX_DIMMS_IN_CHANNEL][oiNotValid] = {
+/// 1DPC 1R, 1DPC 2R, 2DPC 1R 1R, 2DPC 1R 2R, 2DPC 2R 1R, 2DPC 2R 2R
+ {{00,40}, {00,40}, {60,30}, {60,30}, {60,30}, {60,30}},
+ {{00,40}, {00,40}, {60,30}, {60,30}, {60,30}, {60,30}}
+};
+
+const TOdtValue DtTradOdtTable[MAX_DIMMS_IN_CHANNEL][oiNotValid] = {
+/// 1DPC 1R, 1DPC 2R, 2DPC 1R 1R, 2DPC 1R 2R, 2DPC 2R 1R, 2DPC 2R 2R
+ {{60,00}, {60,00}, {60,30}, {60,30}, {60,30}, {60,30}},
+ {{60,00}, {60,00}, {60,30}, {60,30}, {60,30}, {60,30}}
+};
+
+const TOdtValue User1TradOdtTable[MAX_DIMMS_IN_CHANNEL][oiNotValid] = {
+/// 1DPC 1R, 1DPC 2R, 2DPC 1R 1R, 2DPC 1R 2R, 2DPC 2R 1R, 2DPC 2R 2R
+ {{60,60}, {60,60}, {60,30}, {60,30}, {60,30}, {60,30}},
+ {{60,60}, {60,60}, {60,30}, {60,30}, {60,30}, {60,30}}
+};
+
+const TOdtValue User2TradOdtTable[MAX_DIMMS_IN_CHANNEL][oiNotValid] = {
+/// 1DPC 1R, 1DPC 2R, 2DPC 1R 1R, 2DPC 1R 2R, 2DPC 2R 1R, 2DPC 2R 2R
+ {{60,60}, {60,60}, {60,40}, {60,40}, {60,40}, {60,40}},
+ {{60,60}, {60,60}, {60,40}, {60,40}, {60,40}, {60,40}}
+};
+#endif // TRAD_FLAG
+
+//
+// Module external functions
+//
+/**
+@brief
+ this function reverses MA and BA bits for Rank1
+
+ @param[in] BA - MRS command to be sent
+ @param[in] MA - Value to be sent
+
+ @retval Proper MA and BA BITS.
+**/
+U32
+MrcMirror (
+ IN U8 BA,
+ IN U16 MA
+ )
+{
+ U16 ma357;
+ U16 ma468;
+
+ //
+ // UDIMM/SODIMM reverses the following bits on Rank1
+ // A3 - 4, A5 - 6, A7 - 8
+ // BA0 - 1
+ //
+ ma357 = 0xA8 & MA;
+ ma468 = 0x150 & MA;
+ MA = (0xFE07 & MA) | (ma357 << 1) | (ma468 >> 1);
+ BA = (0x4 & BA) | ((0x2 & BA) >> 1) | ((0x1 & BA) << 1);
+
+ return (BA << 24) + MA;
+}
+
+/**
+@brief
+ this function writes to CADB
+
+ @param[in] MrcData - include all the MRC data
+ @param[in] Channel - Channel to send command to
+ @param[in] RankMask - Rank mask for which command will be sent to.
+ @param[in] CMD - 0: MRS, 1: REF, 2: PRE, 3: ACT, 4: WR, 5: RD, 6: ZQ, 7: NOP
+ @param[in] BA - MRS command to be sent
+ @param[in] MA - Value to be sent
+ @param[in] Delay - Delay in Dclocks
+
+ @retval MrcStatus
+**/
+MrcStatus
+MrcWriteCADBCmd (
+ IN MrcParameters *const MrcData,
+ IN const U8 Channel,
+ IN const U8 RankMask,
+ IN const U8 CMD,
+ IN const U8 BA,
+ IN const U16 *const MA,
+ IN const U8 Delay
+ )
+{
+ const MrcInput *Inputs;
+ MrcOutput *Outputs;
+ MrcChannelOut *ChannelOut;
+ MrcStatus Status;
+ U32 Offset;
+ U8 Stop;
+ U8 Dimm;
+ U8 Rank;
+ U8 AddressMirrored; // bitMask
+ MCHBAR_CH0_CR_REUT_CH_PAT_CADB_PROG_STRUCT ReutChPatCadbProg;
+ MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MRS_STRUCT ReutChPatCadbMrs;
+ MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_STRUCT ReutChSeqCfg;
+ MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_STRUCT ReutChSeqCfgSave;
+ MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_0_STRUCT ReutChSeqCtl;
+ MCDFXS_CR_REUT_GLOBAL_ERR_MCMAIN_STRUCT ReutGlobalErr;
+ MrcDebug *Debug;
+
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ ChannelOut = &Outputs->Controller[0].Channel[Channel];
+ Status = mrcSuccess;
+ Stop = 0;
+ AddressMirrored = 0;
+
+ //
+ // Clear DDR qualifier during reset sequence
+ //
+ MrcWriteCR8 (MrcData, MCSCHEDS_CR_DFT_MISC_REG + 1, 0);
+
+ //
+ // Check for AddressMirrored on each DIMM present
+ //
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ if (ChannelOut->Dimm[Dimm].AddressMirrored == TRUE) {
+ AddressMirrored |= (MRC_BIT0 << Dimm);
+ }
+ }
+ //
+ // Pointer will be dynamically incremented after a write to CADB_PROG register
+ //
+ Offset = MCHBAR_CH0_CR_REUT_CH_PAT_CADB_WRITE_POINTER_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_PAT_CADB_WRITE_POINTER_REG - MCHBAR_CH0_CR_REUT_CH_PAT_CADB_WRITE_POINTER_REG) * Channel);
+ MrcWriteCR8 (MrcData, Offset, 0);
+
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if (MrcRankInChannelExist (MrcData, Rank, Channel) & RankMask) {
+
+ ReutChPatCadbProg.Data = 0;
+ ReutChPatCadbProg.Bits.CADB_Data_Bank = BA;
+ ReutChPatCadbProg.Bits.CADB_Data_Address = MA[RANK_TO_DIMM_NUMBER (Rank)];
+
+ //
+ // Check if Rank 1 and if DIMM requires AddressMirrored
+ //
+ if ((Rank % 2) && (AddressMirrored & ((Rank / 2) + 1))) {
+ //
+ // Remainder is 1 only for Rank1 of each DIMM
+ //
+ ReutChPatCadbProg.Data = MrcMirror (BA, MA[RANK_TO_DIMM_NUMBER (Rank)]);
+ }
+
+ ReutChPatCadbProg.Bits.CADB_Data_CKE = 0xF;
+ ReutChPatCadbProg.Bits.CADB_Data_Control = CMD;
+ ReutChPatCadbProg.Bits.CADB_Data_CS = ~(MRC_BIT0 << Rank);
+
+ Offset = MCHBAR_CH0_CR_REUT_CH_PAT_CADB_PROG_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_PAT_CADB_PROG_REG - MCHBAR_CH0_CR_REUT_CH_PAT_CADB_PROG_REG) * Channel);
+ MrcWriteCR64 (MrcData, Offset, ReutChPatCadbProg.Data);
+
+ //MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "CH%d Rank %d ReutChPatCadbProg: 0x%08X%08X\n", Channel, Rank, ReutChPatCadbProg.Data32[1], ReutChPatCadbProg.Data32[0]);
+
+ Stop += 1;
+ }
+ }
+
+ if (Stop == 0) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_ERROR,
+ "MrcWriteCADBCmd: Channel %d Ranks %d ValidRankBitMask 0x%X\n",
+ Channel,
+ RankMask,
+ ChannelOut->ValidRankBitMask
+ );
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "MrcWriteCADBCmd: Not a valid Rank in RankBitMask\n");
+ Status = mrcFail;
+ return Status;
+ }
+ //
+ // Execute MRS Mode
+ //
+ Offset = MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MRS_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_PAT_CADB_MRS_REG - MCHBAR_CH0_CR_REUT_CH_PAT_CADB_MRS_REG) * Channel);
+ ReutChPatCadbMrs.Data = 0;
+ ReutChPatCadbMrs.Bits.MRS_Gap = (Delay == 0) ? 3 : Delay;
+ ReutChPatCadbMrs.Bits.CADB_MRS_End_Pointer = Stop - 1;
+ MrcWriteCR (MrcData, Offset, ReutChPatCadbMrs.Data);
+
+ //
+ // Save before MR command
+ //
+ Offset = MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_REG +
+ ((MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_REG - MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_REG) * Channel);
+ ReutChSeqCfgSave.Data = MrcReadCR (MrcData, Offset);
+
+ //
+ // Prepare for MRS command
+ //
+ ReutChSeqCfg.Data = ReutChSeqCfgSave.Data;
+ ReutChSeqCfg.Bits.Global_Control = 0;
+ ReutChSeqCfg.Bits.Initialization_Mode = MRS_Mode;
+ MrcWriteCR (MrcData, Offset, (U32) ReutChSeqCfg.Data); // Set MRS Mode w/o Global control
+
+ //
+ // Start test and clear errors
+ //
+ Offset = MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_0_REG +
+ ((MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_1_REG - MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_0_REG) * Channel);
+ ReutChSeqCtl.Data = 0;
+ ReutChSeqCtl.Bits.Local_Clear_Errors = 1;
+ ReutChSeqCtl.Bits.Local_Start_Test = 1;
+ MrcWriteCR8 (MrcData, Offset, (U8) ReutChSeqCtl.Data);
+
+ //
+ // Wait for Channel_Test_Done_Status for the channel.
+ //
+ // @todo: Infinite loop possible, need timer.
+ //
+ do {
+ ReutGlobalErr.Data = MrcReadCR (MrcData, MCDFXS_CR_REUT_GLOBAL_ERR_MCMAIN_REG);
+ if (1 == ((Channel == 0) ? ReutGlobalErr.Bits.Channel_Error_Status_0 : ReutGlobalErr.Bits.Channel_Error_Status_1)) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "ERROR IN MrcWriteCADBCmd: REUT_GLOBAL_ERR 0x%X\n", ReutGlobalErr.Data);
+ return mrcFail;
+ }
+ } while (0 == ((Channel == 0) ? ReutGlobalErr.Bits.Channel_Test_Done_Status_0 : ReutGlobalErr.Bits.Channel_Test_Done_Status_1));
+
+ //
+ // Restore after MR command
+ //
+ Offset = MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_0_REG +
+ ((MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_1_REG - MCDFXS_CR_REUT_CH_SEQ_CTL_MCMAIN_0_REG) * Channel);
+ ReutChSeqCtl.Data = 0;
+ ReutChSeqCtl.Bits.Local_Clear_Errors = 1;
+ MrcWriteCR8 (MrcData, Offset, (U8) ReutChSeqCtl.Data);
+
+ Offset = MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_REG +
+ ((MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_1_REG - MCDFXS_CR_REUT_CH_SEQ_CFG_MCMAIN_0_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, (U32) ReutChSeqCfgSave.Data);
+ return Status;
+}
+
+/**
+@brief
+ This function sends the proper MRS command for specific ranks as indicated by RankMask
+
+ @param[in] MrcData - include all the MRC data
+ @param[in] Channel - Channel to send command to
+ @param[in] RankMask - Rank mask for which command will be sent to
+ @param[in] MR - MRS command to be sent
+ @param[in] DimmValue - Dimm Values to be sent
+
+ @retval MrcStatus
+**/
+MrcStatus
+MrcWriteMRSAll (
+ IN MrcParameters *const MrcData,
+ IN const U8 Channel,
+ IN const U8 RankMask,
+ IN const U8 MR,
+ IN const U16 *const DimmValue
+ )
+{
+ //
+ // CMD = [0: MRS, 1: REF, 2: PRE, 3: ACT, 4: WR, 5: RD, 6: ZQ, 7: NOP]
+ //
+ return MrcWriteCADBCmd (MrcData, Channel, RankMask, MRS_CMD, MR, DimmValue, 0);
+}
+
+/**
+@brief
+ This function sends the proper MRS command for specific ranks as indicated by RankMask
+
+ @param[in] MrcData - Include all the MRC data
+ @param[in] Channel - Channel to send command to
+ @param[in] RankMask - Rank mask for which command will be sent to
+ @param[in] MR - MRS command to be sent
+ @param[in] Value - Value to be sent
+
+ @retval MrcStatus
+**/
+MrcStatus
+MrcWriteMRS (
+ IN MrcParameters *const MrcData,
+ IN const U8 Channel,
+ IN const U8 RankMask,
+ IN const U8 MR,
+ IN const U16 Value
+ )
+{
+ MrcStatus Status;
+ U16 DimmValue[MAX_DIMMS_IN_CHANNEL];
+
+ //
+ // Update proper Dimm Values based on Ranks (rank bit mask)
+ //
+ if (RankMask <= 3) {
+ //
+ // For DIMM 0
+ //
+ DimmValue[0] = Value;
+#if MAX_DIMMS_IN_CHANNEL > 1
+ DimmValue[1] = 0;
+#endif
+ } else {
+ //
+ // DIMM 1
+ //
+ DimmValue[0] = 0;
+#if MAX_DIMMS_IN_CHANNEL > 1
+ DimmValue[1] = Value;
+#endif
+ }
+ //
+ // CMD = [0: MRS, 1: REF, 2: PRE, 3: ACT, 4: WR, 5: RD, 6: ZQ, 7: NOP]
+ //
+ Status = MrcWriteCADBCmd (MrcData, Channel, RankMask, MRS_CMD, MR, DimmValue, 0);
+
+ return Status;
+}
+
+/**
+@brief
+ Issue ZQ calibration command on all ranks.
+ When done, wait appropriate delay depending on the ZQ type.
+
+ @param[in] MrcData - include all the MRC data
+ @param[in] chBitMask - Channel bit mask to be sent to.
+ @param[in] ZqType - Type of ZQ Calibration: see MrcZqType enum
+
+ @retval MrcStatus - mrcSuccess if passes, otherwise an error status
+**/
+MrcStatus
+MrcIssueZQ (
+ IN MrcParameters *const MrcData,
+ IN const U8 chBitMask,
+ IN const MrcZqType ZqType
+ )
+{
+ MrcOutput *Outputs;
+ MrcStatus Status;
+ MrcDebug *Debug;
+ U8 Channel;
+ U8 Dimm;
+ U8 Delay;
+ U16 MaValue;
+ U16 DimmValue[MAX_DIMMS_IN_CHANNEL];
+ U32 OpCode;
+#ifdef MRC_DEBUG_PRINT
+ char *StrZqType;
+#endif // MRC_DEBUG_PRINT
+#ifdef ULT_FLAG
+ U8 Rank;
+ BOOL Lpddr;
+#endif // ULT_FLAG
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ Status = mrcSuccess;
+ Delay = 1;
+
+#ifdef ULT_FLAG
+ //
+ // Check if LPDDR3 memory is used
+ //
+ Lpddr = (Outputs->DdrType == MRC_DDR_TYPE_LPDDR3);
+#endif //ULT_FLAG
+ MaValue = 0;
+
+ switch (ZqType) {
+ case MRC_ZQ_INIT:
+#ifdef MRC_DEBUG_PRINT
+ StrZqType = "INIT";
+#endif
+ MaValue = MRC_BIT10;
+ OpCode = 0xFF;
+ break;
+
+ case MRC_ZQ_LONG:
+#ifdef MRC_DEBUG_PRINT
+ StrZqType = "LONG";
+#endif
+ MaValue = MRC_BIT10;
+ OpCode = 0xAB;
+ break;
+
+ case MRC_ZQ_SHORT:
+#ifdef MRC_DEBUG_PRINT
+ StrZqType = "SHORT";
+#endif
+ OpCode = 0x56;
+ break;
+
+ case MRC_ZQ_RESET:
+#ifdef MRC_DEBUG_PRINT
+ StrZqType = "RESET";
+#endif
+ OpCode = 0xC3;
+ break;
+
+ default:
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "Wrong ZQ type: %d\n", ZqType);
+ return mrcWrongInputParameter;
+ }
+
+ //
+ // Program MA value for all DIMMs
+ //
+ for (Dimm = 0; Dimm < (sizeof (DimmValue) / sizeof (DimmValue[0])); Dimm++) {
+ DimmValue[Dimm] = MaValue;
+ }
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ if ((MRC_BIT0 << Channel) & chBitMask) {
+ if (!(MRC_BIT0 << (Channel + 1) & chBitMask) && (ZqType == MRC_ZQ_SHORT)) {
+ Delay = 7;
+ }
+ //
+ // Issue ZQ calibration command on all ranks of this channel
+ //
+#ifdef ULT_FLAG
+ if (Lpddr) {
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if (MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ //
+ // MR10, ZQ calibration
+ //
+ if (!Outputs->LpddrJedecInitDone) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "LPDDR: Issue ZQ %s on ch %d rank %d\n", StrZqType, Channel, Rank);
+ }
+ Status = MrcIssueMrw (MrcData, Channel, Rank, 10, OpCode, FALSE, FALSE);
+ }
+ }
+ } else
+#endif // ULT_FLAG
+ {
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "DDR3: Issue ZQ %s on ch %d\n", StrZqType, Channel);
+ //
+ Status = MrcWriteCADBCmd (MrcData, Channel, 0x0F, ZQ_CMD, 0, DimmValue, Delay);
+ }
+ }
+ }
+ }
+
+ if ((ZqType == MRC_ZQ_INIT) || (ZqType == MRC_ZQ_LONG)) {
+ MrcWait (MrcData, 1 * HPET_1US);
+ }
+
+ return Status;
+}
+
+/**
+@brief
+ This function writes the MR2 register for all the ranks and channels
+
+ @param[in, out] MrcData - general data
+ @param[in] Pasr - Partial array self refresh bit A0-A2
+
+ @retval MrcStatus - mrcSuccess if passes, otherwise an error status
+**/
+MrcStatus
+MrcSetMR2 (
+ IN OUT MrcParameters *const MrcData,
+ IN const U8 Pasr
+ )
+{
+ const MrcInput *Inputs;
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ TOdtValue *OdtTableIndex;
+ MrcProfile Profile;
+ U8 Channel;
+ U8 Rank;
+ U8 RankMod2;
+ U8 AutoSelfRefresh;
+ U8 SelfRefreshTemp;
+ U16 DimmValue[MAX_DIMMS_IN_CHANNEL];
+ MrcStatus Status;
+ DDR3_MODE_REGISTER_2_STRUCT Ddr3ModeRegister;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerOut = &Outputs->Controller[0];
+ Debug = &Inputs->Debug;
+ Status = mrcSuccess;
+ Profile = Inputs->MemoryProfile;
+
+ for (Channel = 0; (Channel < MAX_CHANNEL) && (Status == mrcSuccess); Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ Ddr3ModeRegister.Data = 0;
+ Ddr3ModeRegister.Bits.PartialArraySR = Pasr;
+ //
+ // Subtract 5 because of jedec mr2 CWL table 0 = 5 1=6 2=7 ...
+ //
+ Ddr3ModeRegister.Bits.CasWriteLatency = ChannelOut->Timing[Profile].tCWL - 5;
+
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank += MAX_RANK_IN_DIMM) {
+ //
+ // loop only for each DIMM
+ //
+ if (MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ if (Outputs->RestoreMRs) {
+ RankMod2 = Rank % 2;
+ Ddr3ModeRegister.Data = ChannelOut->Dimm[RANK_TO_DIMM_NUMBER (Rank)].Rank[RankMod2].MR[mrMR2];
+ } else {
+ //
+ // ASR: Set if both bits 0 and 2 of byte 31 in SPD are set.
+ //
+ // @todo: Need to check and see if we need to set DDR3_MODE_REGISTER_2_STR_OFF based on EXTENDED_TEMP support
+ // If ASR need BIT6 set, else if EXTENDED_TEMP set BIT7.
+ // Need to understand the policy here or should we follow NHM's approach for LFD/CFD.
+ //
+ if (
+ (ChannelOut->Dimm[RANK_TO_DIMM_NUMBER (Rank)].AutoSelfRefresh == TRUE) &&
+ ((Inputs->RefreshRate2x == FALSE) || (Outputs->AutoSelfRefresh == TRUE))
+ ) {
+ AutoSelfRefresh = 1;
+ SelfRefreshTemp = 0;
+ } else if (ChannelOut->Dimm[RANK_TO_DIMM_NUMBER (Rank)].SelfRefreshTemp == TRUE) {
+ AutoSelfRefresh = 0;
+ SelfRefreshTemp = 1;
+ } else {
+ AutoSelfRefresh = 0;
+ SelfRefreshTemp = 0;
+ }
+
+ Ddr3ModeRegister.Bits.AutoSelfRefresh = AutoSelfRefresh;
+ Ddr3ModeRegister.Bits.SelfRefreshTemp = SelfRefreshTemp;
+
+ OdtTableIndex = GetOdtTableIndex (MrcData, Channel, RANK_TO_DIMM_NUMBER (Rank));
+ if (OdtTableIndex == NULL) {
+ return mrcFail;
+ }
+
+ Ddr3ModeRegister = UpdateRttWrValue (MrcData, OdtTableIndex->RttWr, Ddr3ModeRegister);
+
+ //
+ // *** must be before the MRC command because of address swizzling bits in SODIMM/UDIMM
+ //
+ SetTcMr2ShadowReg (MrcData, Channel, RANK_TO_DIMM_NUMBER (Rank), Ddr3ModeRegister.Data);
+
+ //
+ // save MR2 for later validation usage
+ //
+ RankMod2 = Rank % 2;
+ ChannelOut->Dimm[RANK_TO_DIMM_NUMBER (Rank)].Rank[RankMod2].MR[mrMR2] = Ddr3ModeRegister.Data;
+ ChannelOut->Dimm[RANK_TO_DIMM_NUMBER (Rank)].Rank[RankMod2 + 1].MR[mrMR2] = Ddr3ModeRegister.Data;
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "MrcSetMR2 Channel %u Dimm %u Rank %u = 0x%X\n",
+ // Channel, RANK_TO_DIMM_NUMBER (Rank), Rank, Ddr3ModeRegister.Data);
+ //
+ }
+ //
+ // Update proper DIMM value
+ //
+ DimmValue[RANK_TO_DIMM_NUMBER (Rank)] = Ddr3ModeRegister.Data;
+ }
+ }
+ //
+ // 3rd parameter is really a rank mask of which ranks to send command to.
+ // If need it for all possible and present ranks, it should be 0xF.
+ //
+ Status = MrcWriteMRSAll (MrcData, Channel, 0x0F, mrMR2, DimmValue);
+ }
+ }
+
+ return Status;
+}
+
+/**
+@brief
+ This function writes the MR3 register for all the ranks and channels
+
+ @param[in] MrcData - include all the MRC data
+ @param[in] MPRLoc - MPR Location bit A0-A1
+ @param[in] Mpr - MPR bit A2
+
+ @retval MrcStatus - mrcSuccess if passes, otherwise an error status
+**/
+MrcStatus
+MrcSetMR3 (
+ IN MrcParameters *const MrcData,
+ IN const U8 MPRLoc,
+ IN const U8 Mpr
+ )
+{
+ const MrcInput *Inputs;
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ U16 DimmValue[MAX_DIMMS_IN_CHANNEL];
+ U8 Channel;
+ U8 Dimm;
+ MrcStatus Status;
+ DDR3_MODE_REGISTER_3_STRUCT Ddr3ModeRegister;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ Debug = &Inputs->Debug;
+ Status = mrcSuccess;
+
+ //
+ // Independent channel data
+ //
+ Ddr3ModeRegister.Data = 0;
+ Ddr3ModeRegister.Bits.MprLocation = MPRLoc;
+ Ddr3ModeRegister.Bits.MprOperation = Mpr;
+
+ for (Channel = 0; (Channel < MAX_CHANNEL) && (Status == mrcSuccess); Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ for (Dimm = 0; Dimm < (sizeof (DimmValue) / sizeof (DimmValue[0])); Dimm++) {
+ DimmValue[Dimm] = Ddr3ModeRegister.Data;
+ }
+ //
+ // 3rd parameter is really a rank mask of which ranks to send command to.
+ // If need it for all possible and present ranks, it should be 0xF.
+ //
+ Status = MrcWriteMRSAll (MrcData, Channel, 0x0F, mrMR3, DimmValue);
+ }
+ }
+
+ return Status;
+}
+
+/**
+@brief
+ This function writes the MR1 register for all the ranks and channels
+
+ @param[in, out] MrcData - include all the MRC data
+ @param[in] DLLEnable - DLL enable bit A0
+ @param[in] Odic - Output driver impedance control A5, A1
+ @param[in] AdditiveLatency - Additive latency bit A3-A4
+ @param[in] WlEnable - Write leveling enable bit A7
+ @param[in] Tdqs - TDQS enable bit A11
+ @param[in] Qoff - Qoff bit A12
+
+ @retval MrcStatus - mrcSuccess if passes, otherwise an error status
+**/
+MrcStatus
+MrcSetMR1 (
+ IN OUT MrcParameters *const MrcData,
+ IN const U8 DLLEnable,
+ IN const U8 Odic,
+ IN const U8 AdditiveLatency,
+ IN const U8 WlEnable,
+ IN const U8 Tdqs,
+ IN const U8 Qoff
+ )
+{
+ const MrcInput *Inputs;
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ TOdtValue *OdtTableIndex;
+ U16 DimmValue[MAX_DIMMS_IN_CHANNEL];
+ U8 Channel;
+ U8 Rank;
+ U8 RankMod2;
+ U8 RttNom;
+ MrcStatus Status;
+ DDR3_MODE_REGISTER_1_STRUCT Ddr3ModeRegister;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerOut = &Outputs->Controller[0];
+ Debug = &Inputs->Debug;
+ Status = mrcSuccess;
+ OdtTableIndex = NULL;
+
+ for (Channel = 0; (Channel < MAX_CHANNEL) && (Status == mrcSuccess); Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+
+ ChannelOut = &ControllerOut->Channel[Channel];
+ //
+ // independent channel data
+ //
+ Ddr3ModeRegister.Data = 0;
+ Ddr3ModeRegister.Bits.DllEnable = DLLEnable;
+ Ddr3ModeRegister.Bits.ODImpedanceLow = Odic & 1;
+ Ddr3ModeRegister.Bits.ODImpedanceHigh = (Odic & 2) >> 1;
+ Ddr3ModeRegister.Bits.AdditiveLatency = AdditiveLatency;
+ Ddr3ModeRegister.Bits.WriteLeveling = WlEnable;
+ Ddr3ModeRegister.Bits.Tdqs = Tdqs; // @todo: We used to set Tdqs if the DIMM is X8.
+ Ddr3ModeRegister.Bits.Qoff = Qoff;
+
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank += 2) {
+ //
+ // loop only for each DIMM
+ //
+ if (MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ if (Outputs->RestoreMRs) {
+ RankMod2 = Rank % 2;
+ Ddr3ModeRegister.Data = ChannelOut->Dimm[RANK_TO_DIMM_NUMBER (Rank)].Rank[RankMod2].MR[mrMR1];
+ } else {
+ //
+ // Get the ODT table index.
+ //
+ OdtTableIndex = GetOdtTableIndex (MrcData, Channel, RANK_TO_DIMM_NUMBER (Rank));
+ if (OdtTableIndex == NULL) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "ERROR: Un support board type\n");
+ return mrcFail;
+ }
+ //
+ // Set the RttNom value
+ //
+#ifdef ULT_FLAG
+ if (Inputs->CpuModel == cmHSW_ULT && Outputs->DdrType == MRC_DDR_TYPE_DDR3) {
+ RttNom = 0; // ODT disabled on DDR3 ULT
+ } else
+#endif // ULT_FLAG
+ {
+ RttNom = OdtTableIndex->RttNom;
+ }
+
+ Ddr3ModeRegister = UpdateRttNomValue (MrcData, RttNom, Ddr3ModeRegister);
+
+ //
+ // save MR1 for later validation usage
+ //
+ RankMod2 = Rank % 2;
+ ChannelOut->Dimm[RANK_TO_DIMM_NUMBER (Rank)].Rank[RankMod2].MR[mrMR1] = Ddr3ModeRegister.Data;
+ ChannelOut->Dimm[RANK_TO_DIMM_NUMBER (Rank)].Rank[RankMod2 + 1].MR[mrMR1] = Ddr3ModeRegister.Data;
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "MrcSetMR1 Channel %u Dimm %u Rank %u = 0x%X\n",
+ // Channel, RANK_TO_DIMM_NUMBER (Rank), Rank, Ddr3ModeRegister.Data);
+ //
+ }
+ //
+ // Update proper DIMM value
+ //
+ DimmValue[RANK_TO_DIMM_NUMBER (Rank)] = Ddr3ModeRegister.Data;
+ }
+ }
+ //
+ // 3rd parameter is really a rank mask of which ranks to send command to.
+ // If need it for all possible and present ranks, it should be 0xF.
+ //
+ Status = MrcWriteMRSAll (MrcData, Channel, 0x0F, mrMR1, DimmValue);
+ }
+ }
+
+ return Status;
+}
+
+/**
+@brief
+ This function writes the MR0 register for all the ranks
+
+ @param[in, out] MrcData - include all the MRC data
+ @param[in] CommandControl - include the command control params
+ @param[in] BurstLength - Burst length bit A0-A1
+ @param[in] ReadBurstType - Read burst type bit A3
+ @param[in] TestMode - Test mode type bit A7
+ @param[in] DllReset - DLL reset bit A8
+
+ @retval MrcStatus - mrcSuccess if passes, otherwise an error status
+**/
+MrcStatus
+MrcSetMR0 (
+ IN OUT MrcParameters *const MrcData,
+ IN const U8 BurstLength,
+ IN const U8 ReadBurstType,
+ IN const U8 TestMode,
+ IN const U8 DllReset
+ )
+{
+ /*
+ CAS Latency
+ A6 A5 A4 A2 CAS Latency
+ 0 0 0 0 Reserved
+ 0 0 1 0 5
+ 0 1 0 0 6
+ 0 1 1 0 7
+ 1 0 0 0 8
+ 1 0 1 0 9
+ 1 1 0 0 10
+ 1 1 1 0 11(Optional for DDR3-1600)
+ CAS = (CAS - 4) <<1
+
+ Write recovery
+ A11 A10 A9 WR(cycles)
+ 0 0 0 16*2
+ 0 0 1 5*2
+ 0 1 0 6*2
+ 0 1 1 7*2
+ 1 0 0 8*2
+ 1 0 1 10*2
+ 1 1 0 12*2
+ 1 1 1 14*2
+ Wr = Wr - 5
+*/
+ const U8 WrTable[] = {1, 2, 3, 4, 0, 5, 0, 6, 0, 7, 0, 0};
+ const MrcInput *Inputs;
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ MrcProfile Profile;
+ U16 DimmValue[MAX_DIMMS_IN_CHANNEL];
+ U16 Cas;
+ U16 Wr;
+ U16 Offset;
+ U16 Cl_A2;
+ U8 Channel;
+ U8 Rank;
+ U8 RankMod2;
+ MrcStatus Status;
+ DDR3_MODE_REGISTER_0_STRUCT Ddr3ModeRegister;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerOut = &Outputs->Controller[0];
+ Debug = &Inputs->Debug;
+ Status = mrcSuccess;
+ Profile = Inputs->MemoryProfile;
+
+ //
+ // independent channel data
+ //
+ Ddr3ModeRegister.Data = 0;
+ Ddr3ModeRegister.Bits.BurstLength = BurstLength;
+ Ddr3ModeRegister.Bits.ReadBurstType = ReadBurstType;
+ Ddr3ModeRegister.Bits.TestMode = TestMode;
+ Ddr3ModeRegister.Bits.DllReset = DllReset;
+
+ for (Channel = 0; (Channel < MAX_CHANNEL) && (Status == mrcSuccess); Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+
+ ChannelOut = &ControllerOut->Channel[Channel];
+
+ Cas = ChannelOut->Timing[Profile].tCL;
+ Wr = ChannelOut->Timing[Profile].tWR;
+
+ //
+ // find the new cas value from the CAS table
+ //
+ if (Cas < 5 || Cas > 16) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "ERROR: CAS value %d is not valid \n", Cas);
+ Status = mrcCasError;
+ }
+
+ if ((Wr < 5) || (Wr > 8 && Wr != 10 && Wr != 12 && Wr != 14 && Wr != 16)) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "ERROR: Write recovery Wr value %d is not valid \n", Wr);
+ return mrcWrError;
+ }
+ //
+ // convert CAS to jedec ddr3 values
+ //
+ if (Cas <= 11) {
+ Offset = 4;
+ Cl_A2 = 0;
+ } else {
+ Offset = 12;
+ Cl_A2 = 1;
+ }
+
+ Ddr3ModeRegister.Bits.CasLatencyLow = Cl_A2;
+ Ddr3ModeRegister.Bits.CasLatencyHigh = Cas - Offset;
+
+ //
+ // convert Wr to jedec ddr3 values
+ //
+ Ddr3ModeRegister.Bits.WriteRecovery = WrTable[Wr - 5];
+
+ //
+ // calculate the Ppd
+ // DLL control for PPD: slow (0) for mobile, fast (1) for desktop, open for external input
+ // Note - PM_PDWN_CONFIG_C# should be aligned with this. For slow exit use DLL_off. Otherwise use all others.
+ //
+ Ddr3ModeRegister.Bits.PrechargePdDll =
+ (
+ Inputs->PowerDownMode == pdmNoPowerDown ||
+ Inputs->PowerDownMode == pdmAPD
+ ) ? 1 : 0;
+ if ((Inputs->PowerDownMode != pdmNoPowerDown && Inputs->PowerDownMode != pdmAPD) &&
+ (Inputs->PowerDownMode != pdmPPDDLLOFF)
+ ) {
+ Ddr3ModeRegister.Bits.PrechargePdDll = 0;
+ }
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank += 2) {
+ //
+ // loop only for each DIMM
+ //
+ if (MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ if (Outputs->RestoreMRs) {
+ RankMod2 = Rank % 2;
+ Ddr3ModeRegister.Data = ChannelOut->Dimm[RANK_TO_DIMM_NUMBER (Rank)].Rank[RankMod2].MR[mrMR0];
+ } else {
+ //
+ // save MR0 for later validation usage
+ //
+ RankMod2 = Rank % 2;
+ ChannelOut->Dimm[RANK_TO_DIMM_NUMBER (Rank)].Rank[RankMod2].MR[mrMR0] = Ddr3ModeRegister.Data;
+ ChannelOut->Dimm[RANK_TO_DIMM_NUMBER (Rank)].Rank[RankMod2 + 1].MR[mrMR0] = Ddr3ModeRegister.Data;
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "MrcSetMR0 Channel %u Dimm %u Rank %u = 0x%X\n",
+ // Channel, RANK_TO_DIMM_NUMBER (Rank), Rank, Ddr3ModeRegister.Data);
+ //
+ }
+ //
+ // Update proper DIMM value
+ //
+ DimmValue[RANK_TO_DIMM_NUMBER (Rank)] = Ddr3ModeRegister.Data;
+ }
+ }
+ //
+ // 3rd parameter is really a rank mask of which ranks to send command to.
+ // If need it for all possible and present ranks, it should be 0xF.
+ //
+ Status = MrcWriteMRSAll (MrcData, Channel, 0x0F, mrMR0, DimmValue);
+ }
+ }
+
+ return Status;
+}
+
+/**
+@brief
+ This function return tWLO time. this time is Write leveling output delay.
+
+ @param[in] Frequency - MC frequency.
+
+ @retval tWLO timein nCK.
+**/
+U32
+GetTwloTime (
+ IN const MrcFrequency Frequency
+ )
+{
+ U32 tWLO;
+
+ switch (Frequency) {
+ case f2133:
+ case f1867:
+ tWLO = 8;
+ break;
+
+ case f1600:
+ case f1333:
+ tWLO = 6;
+ break;
+
+ case f1067:
+ tWLO = 5;
+ break;
+
+ case f800:
+ tWLO = 4;
+ break;
+
+ default:
+ tWLO = 0;
+ }
+
+ return tWLO;
+}
+
+/**
+@brief
+ This funtion returns the odt table index for the given Dimm/Channel.
+
+ @param[in] MrcData - Include all the mrc global data.
+ @param[in] Channel - Channel to work on.
+ @param[in] Dimm - Rank to work on.
+
+ @retval OdtValue - iThe pointer to the relevant Odt values.
+**/
+TOdtValue *
+GetOdtTableIndex (
+ IN MrcParameters *const MrcData,
+ IN const U8 Channel,
+ IN const U8 Dimm
+ )
+{
+ MrcDebug *Debug;
+ MrcChannelOut *ChannelOut;
+ MrcDimmOut *DimmOut;
+ TOdtIndex OdtIndex;
+
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ ChannelOut = &MrcData->SysOut.Outputs.Controller[0].Channel[Channel];
+ DimmOut = &ChannelOut->Dimm[dDIMM0];
+ OdtIndex = oiNotValid;
+
+ switch (ChannelOut->DimmCount) {
+#ifdef TRAD_FLAG
+ case 2:
+ //
+ // Two dimms per channel.
+ //
+ if ((DimmOut[dDIMM0].RankInDIMM == 1) && (DimmOut[dDIMM1].RankInDIMM == 1)) {
+ OdtIndex = oi2DPC1R1R;
+ } else if ((DimmOut[dDIMM0].RankInDIMM == 1) && (DimmOut[dDIMM1].RankInDIMM == 2)) {
+ OdtIndex = oi2DPC1R2R;
+ } else if ((DimmOut[dDIMM0].RankInDIMM == 2) && (DimmOut[dDIMM1].RankInDIMM == 1)) {
+ OdtIndex = oi2DPC2R1R;
+ } else if ((DimmOut[dDIMM0].RankInDIMM == 2) && (DimmOut[dDIMM1].RankInDIMM == 2)) {
+ OdtIndex = oi2DPC2R2R;
+ } else {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "ERROR: Invalid 2DPC rank mode\n");
+ }
+ break;
+#endif // TRAD_FLAG
+
+ case 1:
+ //
+ // One dimm per channel.
+ //
+ if ((DimmOut[dDIMM0].RankInDIMM == 1) ||
+ ((DimmOut[dDIMM1].RankInDIMM == 1) && (MAX_DIMMS_IN_CHANNEL > 1))
+ ) {
+ OdtIndex = oi1DPC1R;
+ } else if ((DimmOut[dDIMM0].RankInDIMM == 2) ||
+ ((DimmOut[dDIMM1].RankInDIMM == 2) && (MAX_DIMMS_IN_CHANNEL > 1))
+ ) {
+ OdtIndex = oi1DPC2R;
+ } else {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "ERROR: Invalid 1DPC rank mode\n");
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return (OdtIndex == oiNotValid) ? NULL : SelectTable (MrcData, Dimm, OdtIndex);
+}
+
+/**
+@brief
+ This funtion takes the MR1 register value and updates the odt value
+ inside the register.
+
+ @param[in] MrcData - Include all the MRC general data.
+ @param[in] OdtValue - Selected odt index.
+ @param[in] Ddr3ModeRegister - Register to update.
+
+ @retval Ddr3ModeRegister - Updated register
+**/
+DDR3_MODE_REGISTER_1_STRUCT
+UpdateRttNomValue (
+ IN MrcParameters *const MrcData,
+ IN const U8 OdtValue,
+ IN DDR3_MODE_REGISTER_1_STRUCT Ddr3ModeRegister
+ )
+{
+ const MrcDebug *Debug;
+ U8 A2Value;
+ U8 A6Value;
+ U8 A9Value;
+
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ if (OdtValue == 0) {
+ //
+ // rtt_nom is disable
+ //
+ A2Value = 0;
+ A6Value = 0;
+ A9Value = 0;
+ } else if (OdtValue == 60) {
+ //
+ // RZQ/4
+ //
+ A2Value = 1;
+ A6Value = 0;
+ A9Value = 0;
+ } else if (OdtValue == 120) {
+ //
+ // RZQ/2
+ //
+ A2Value = 0;
+ A6Value = 1;
+ A9Value = 0;
+ } else if (OdtValue == 40) {
+ //
+ // RZQ/6
+ //
+ A2Value = 1;
+ A6Value = 1;
+ A9Value = 0;
+ } else if (OdtValue == 20) {
+ //
+ // RZQ/12
+ //
+ A2Value = 0;
+ A6Value = 0;
+ A9Value = 1;
+ } else if (OdtValue == 30) {
+ //
+ // RZQ/8
+ //
+ A2Value = 1;
+ A6Value = 0;
+ A9Value = 1;
+ } else {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "ERROR: unsupported odt RttNom value\n");
+ A2Value = 1;
+ A6Value = 1;
+ A9Value = 1;
+ }
+
+ Ddr3ModeRegister.Bits.OdtRttValueLow = A2Value;
+ Ddr3ModeRegister.Bits.OdtRttValueMid = A6Value;
+ Ddr3ModeRegister.Bits.OdtRttValueHigh = A9Value;
+ return Ddr3ModeRegister;
+}
+
+/**
+@brief
+ This function updates the Rtt value in the MR2 value passed in.
+
+ @param[in] MrcData - Include all the MRC general data.
+ @param[in] OdtValue - Selected odt index.
+ @param[in] Ddr3ModeRegister - Register to update.
+
+ @retval Ddr3ModeRegister - Updated MR2 register
+**/
+DDR3_MODE_REGISTER_2_STRUCT
+UpdateRttWrValue (
+ MrcParameters *const MrcData,
+ const U8 OdtValue,
+ DDR3_MODE_REGISTER_2_STRUCT Ddr3ModeRegister
+ )
+{
+ U8 RttValue;
+
+ if ((OdtValue > 120) || ((OdtValue % 60) != 0)) {
+ MRC_DEBUG_MSG (
+ &MrcData->SysIn.Inputs.Debug,
+ MSG_LEVEL_ERROR,
+ "ERROR: unsupported odt RttWr value of %u\n",
+ OdtValue
+ );
+ RttValue = 0;
+ } else {
+ RttValue = OdtValue / 60;
+ }
+
+ Ddr3ModeRegister.Bits.DynamicOdt = RttValue;
+ return Ddr3ModeRegister;
+}
+
+/**
+@brief
+ this funtion select the ODT table according OEM/USER decision.
+ In the MRC have 4 table type Mb,Dt,User1,User2.
+ User1,User2 use as internal usage.
+
+ @param[in] MrcData - Include all the MRC general data.
+ @param[in] Dimm - selected DIMM.
+ @param[in] OdtIndex - selected odt index.
+
+ @retval TOdtValue * - Pointer to the relevant table.
+ The return value is NULL if the table could
+ not be found
+**/
+TOdtValue *
+SelectTable (
+ IN MrcParameters *const MrcData,
+ IN const U8 Dimm,
+ IN const TOdtIndex OdtIndex
+ )
+{
+ const MrcInput *Inputs;
+ TOdtValue *OdtTable;
+ const MrcDebug *Debug;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ OdtTable = NULL;
+ switch (Inputs->BoardType) {
+ case btCRBMB:
+ case btCRBEMB:
+#ifdef ULT_FLAG
+ if (Inputs->CpuModel == cmHSW_ULT) {
+ if (OdtIndex >= 2) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Error: MbUltOdtTable array out of bounds!\n");
+ return NULL;
+ }
+ OdtTable = (TOdtValue *) &MbUltOdtTable[Dimm][OdtIndex];
+ }
+#endif // ULT_FLAG
+#ifdef TRAD_FLAG
+ if ((Inputs->CpuModel == cmHSW) || (Inputs->CpuModel == cmCRW)) {
+ OdtTable = (TOdtValue *) &MbTradOdtTable[Dimm][OdtIndex];
+ }
+#endif //TRAD_FLAG
+ break;
+
+ case btCRBDT:
+#ifdef TRAD_FLAG
+ if ((Inputs->CpuModel == cmHSW) || (Inputs->CpuModel == cmCRW)) {
+ OdtTable = (TOdtValue *) &DtTradOdtTable[Dimm][OdtIndex];
+ }
+#endif //TRAD_FLAG
+ break;
+
+ case btUser1:
+#ifdef ULT_FLAG
+ if (Inputs->CpuModel == cmHSW_ULT) {
+ if (OdtIndex >= 2) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Error: User1UltOdtTable array out of bounds!\n");
+ return NULL;
+ }
+ OdtTable = (TOdtValue *) &User1UltOdtTable[Dimm][OdtIndex];
+ }
+#endif // ULT_FLAG
+#ifdef TRAD_FLAG
+ if ((Inputs->CpuModel == cmHSW) || (Inputs->CpuModel == cmCRW)) {
+ OdtTable = (TOdtValue *) &User1TradOdtTable[Dimm][OdtIndex];
+ }
+#endif //TRAD_FLAG
+ break;
+
+ case btUser2:
+#ifdef TRAD_FLAG
+ if ((Inputs->CpuModel == cmHSW) || (Inputs->CpuModel == cmCRW)) {
+ OdtTable = (TOdtValue *) &User2TradOdtTable[Dimm][OdtIndex];
+ }
+#endif //TRAD_FLAG
+ break;
+
+ case btUser4:
+ //
+ // @todo: Need to Port ODT table for Ult
+ //
+#ifdef ULT_FLAG
+ if (Inputs->CpuModel == cmHSW_ULT) {
+ if (OdtIndex >= 2) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Error: MbUltOdtTable array out of bounds!\n");
+ return NULL;
+ }
+ OdtTable = (TOdtValue *) &MbUltOdtTable[Dimm][OdtIndex];
+ }
+#endif // ULT_FLAG
+#ifdef TRAD_FLAG
+ if ((Inputs->CpuModel == cmHSW) || (Inputs->CpuModel == cmCRW)) {
+ OdtTable = (TOdtValue *) &MbTradOdtTable[Dimm][OdtIndex];
+ }
+#endif //TRAD_FLAG
+ break;
+
+ default:
+ OdtTable = NULL;
+ break;
+ }
+
+ return OdtTable;
+}
+
+#ifdef ULT_FLAG
+
+/**
+@brief
+ Issue LPDDR MRW (Mode Register Write) command using MRH (Mode Register Handler).
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Channel - the channel to work on
+ @param[in] Rank - the rank to work on
+ @param[in] Address - MRW address
+ @param[in] Data - MRW Data
+ @param[in] InitMrw - when TRUE, command is stretched (used before CA training is done)
+ @param[in] ChipSelect2N - when TRUE, use 2N stretch mode for CS (used before CA training is done)
+
+ @retval mrcSuccess - MRW was sent successfully
+ @retval mrcDeviceBusy - timed out waiting for MRH
+**/
+MrcStatus
+MrcIssueMrw (
+ IN MrcParameters *const MrcData,
+ IN U32 Channel,
+ IN U32 Rank,
+ IN U32 Address,
+ IN U32 Data,
+ IN BOOL InitMrw,
+ IN BOOL ChipSelect2N
+ )
+{
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ U32 OffsetMrCommand;
+ U32 OffsetCmdRate;
+ MCHBAR_CH0_CR_LPDDR_MR_COMMAND_STRUCT MrCommand;
+ MCHBAR_CH0_CR_CMD_RATE_STRUCT CmdRate;
+ BOOL Busy;
+ U32 Timeout;
+
+ Timeout = (U32) MrcGetCpuTime () + 10000; // 10 seconds timeout
+
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+
+ OffsetMrCommand = MCHBAR_CH0_CR_LPDDR_MR_COMMAND_REG +
+ ((MCHBAR_CH1_CR_LPDDR_MR_COMMAND_REG - MCHBAR_CH0_CR_LPDDR_MR_COMMAND_REG) * Channel);
+
+ //
+ // Make sure MRH is not busy
+ //
+ do {
+ MrCommand.Data = MrcReadCR (MrcData, OffsetMrCommand);
+ Busy = (MrCommand.Bits.Busy == 1);
+ } while (Busy && ((U32) MrcGetCpuTime () < Timeout));
+ if (Busy) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "Timed out waiting for previous MRH command to finish!\n");
+ return mrcDeviceBusy;
+ }
+
+ OffsetCmdRate = MCHBAR_CH0_CR_CMD_RATE_REG + ((MCHBAR_CH1_CR_CMD_RATE_REG - MCHBAR_CH0_CR_CMD_RATE_REG) * Channel);
+ if (ChipSelect2N) {
+ //
+ // Enable 2N stretch mode for CS
+ //
+ CmdRate.Data = MrcReadCR(MrcData, OffsetCmdRate);
+ CmdRate.Bits.init_mrw_2n_cs = 1;
+ MrcWriteCR (MrcData, OffsetCmdRate, CmdRate.Data);
+ }
+ //
+ // Send the MRW
+ //
+ MrCommand.Bits.Address = Address;
+ MrCommand.Bits.Data = Data;
+ MrCommand.Bits.Write = 1;
+ MrCommand.Bits.Init_MRW = InitMrw;
+ MrCommand.Bits.Rank = Rank;
+ MrCommand.Bits.Busy = 1;
+
+ if (!Outputs->LpddrJedecInitDone) {
+ MRC_DEBUG_MSG (
+ Debug, MSG_LEVEL_NOTE,
+ "MrcIssueMrw on ch %d rank %d: MR%d, Opcode=0x%02X, InitMrw=%d, 2N_CS=%d\n",
+ Channel, Rank, Address, Data, InitMrw, ChipSelect2N
+ );
+ }
+ MrcWriteCR (MrcData, OffsetMrCommand, MrCommand.Data);
+
+ //
+ // Wait till MRH is done sending the command
+ //
+ Timeout = (U32) MrcGetCpuTime () + 10000; // 10 seconds timeout
+ do {
+ MrCommand.Data = MrcReadCR (MrcData, OffsetMrCommand);
+ Busy = (MrCommand.Bits.Busy == 1);
+ } while (Busy && ((U32) MrcGetCpuTime () < Timeout));
+
+ if (Busy) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "Timed out sending MRH command!\n");
+ return mrcDeviceBusy;
+ }
+
+ if (ChipSelect2N) {
+ //
+ // Disable 2N stretch mode for CS
+ //
+ CmdRate.Bits.init_mrw_2n_cs = 0;
+ MrcWriteCR (MrcData, OffsetCmdRate, CmdRate.Data);
+ }
+
+ return mrcSuccess;
+}
+
+/**
+@brief
+ Issue LPDDR MRR (Mode Register Read) command using MRH (Mode Register Handler).
+ Use DQ mapping array to deswizzle the MR data.
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Channel - the channel to work on
+ @param[in] Rank - the rank to work on
+ @param[in] Address - MRR address
+ @param[out] Data - MRR Data array per SDRAM device
+
+ @retval mrcSuccess - MRR was executed successfully
+ @retval mrcDeviceBusy - timed out waiting for MRH
+**/
+MrcStatus
+MrcIssueMrr (
+ IN MrcParameters *const MrcData,
+ IN U32 Channel,
+ IN U32 Rank,
+ IN U32 Address,
+ OUT U8 Data[4]
+ )
+{
+ MrcInput *Inputs;
+ MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerIn *ControllerIn;
+ MrcControllerOut *ControllerOut;
+ MrcChannelIn *ChannelIn;
+ MrcChannelOut *ChannelOut;
+ U32 OffsetMrCommand;
+ U32 OffsetMrrResult;
+ BOOL Busy;
+ U32 CurrCpuBit;
+ U32 CurrCpuByte;
+ U32 CpuByteCnt;
+ U32 DeviceCnt;
+ U32 CurrDramBit;
+ U32 BitVal;
+ MCHBAR_CH0_CR_LPDDR_MR_RESULT_STRUCT MrResult;
+ MCHBAR_CH0_CR_LPDDR_MR_COMMAND_STRUCT MrCommand;
+ U32 Timeout;
+ Timeout = (U32) MrcGetCpuTime () + 10000; // 10 seconds timeout
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerIn = &Inputs->Controller[0];
+ ControllerOut = &Outputs->Controller[0];
+ ChannelOut = &ControllerOut->Channel[Channel];
+ ChannelIn = &ControllerIn->Channel[Channel];
+ CurrCpuByte = 0;
+ MrcOemMemorySet (Data, 0, 4 * sizeof (Data[0]));
+
+ OffsetMrCommand = MCHBAR_CH0_CR_LPDDR_MR_COMMAND_REG +
+ ((MCHBAR_CH1_CR_LPDDR_MR_COMMAND_REG - MCHBAR_CH0_CR_LPDDR_MR_COMMAND_REG) * Channel);
+
+ OffsetMrrResult= MCHBAR_CH0_CR_LPDDR_MR_RESULT_REG +
+ ((MCHBAR_CH1_CR_LPDDR_MR_RESULT_REG - MCHBAR_CH0_CR_LPDDR_MR_RESULT_REG) * Channel);
+
+ //
+ // Make sure MRH is not busy
+ //
+ do {
+ MrCommand.Data = MrcReadCR (MrcData, OffsetMrCommand);
+ Busy = (MrCommand.Bits.Busy == 1);
+ } while (Busy && ((U32) MrcGetCpuTime () < Timeout));
+ if (Busy) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "Timed out waiting for previous MRH command to finish!\n");
+ return mrcDeviceBusy;
+ }
+
+ //
+ // Send the MRR
+ //
+ MrCommand.Bits.Address = Address;
+ MrCommand.Bits.Data = 0; // Reading from DRAM
+ MrCommand.Bits.Write = 0; // MRR
+ MrCommand.Bits.Init_MRW = 0; // MRR doesn't support Init_MRW
+ MrCommand.Bits.Rank = Rank;
+ MrCommand.Bits.Busy = 1;
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "MrcIssueMrr on ch %d rank %d: MR%d\n", Channel, Rank, Address);
+ MrcWriteCR (MrcData, OffsetMrCommand, MrCommand.Data);
+
+ //
+ // Wait till MRH is done sending the command and getting the result
+ //
+ Timeout = (U32) MrcGetCpuTime () + 10000; // 10 seconds timeout
+ do {
+ MrCommand.Data = MrcReadCR (MrcData, OffsetMrCommand);
+ Busy = (MrCommand.Bits.Busy == 1);
+ } while (Busy && ((U32) MrcGetCpuTime () < Timeout));
+
+ if (Busy) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "Timed out sending MRH command!\n");
+ return mrcDeviceBusy;
+ }
+
+ MrResult.Data = MrcReadCR (MrcData, OffsetMrrResult);
+
+ for (DeviceCnt = 0; DeviceCnt < 4; DeviceCnt++) {
+ if ((ChannelOut->Dimm[dDIMM0].SdramWidth == 32) && (1 == (DeviceCnt & 1))) {
+ //
+ // We only know DQ mapping for the lower 16 bits of the x32 devices
+ // So we'll copy their MRR feedback to the upper bytes' place
+ // Hence, we skip the odd dies for x32
+ //
+ Data[DeviceCnt] = Data[DeviceCnt - 1];
+ continue;
+ }
+
+ //
+ // Find which CPU byte is mapped to the relevant DRAM byte
+ //
+ for (CpuByteCnt = 0; CpuByteCnt < Outputs->SdramCount; CpuByteCnt++) {
+ if ((DeviceCnt * 2) == ChannelIn->DqsMapCpu2Dram[CpuByteCnt]) {
+ CurrCpuByte = CpuByteCnt;
+ break;
+ }
+ }
+
+ for (CurrCpuBit = 0; CurrCpuBit < MAX_BITS; CurrCpuBit++) {
+ //
+ // The actual DRAM bit that is connected to the current CPU DQ pin
+ //
+ CurrDramBit = ChannelIn->DqMapCpu2Dram[CurrCpuByte][CurrCpuBit] - 8 * (DeviceCnt * 2); // Subtract 8xDramByte
+
+ BitVal = (MrResult.Data8[DeviceCnt] >> CurrCpuBit) & 1; // The 0/1 value that came from the DRAM bit
+ Data[DeviceCnt] |= (BitVal << CurrDramBit); // Putting the value in the correct place
+ }
+ } // for DeviceCnt
+
+ return mrcSuccess;
+}
+
+/**
+@brief
+ Issue LPDDR PRECHARGE ALL command using CADB.
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] Channel - The channel to work on
+ @param[in] RankMask - The rank(s) to work on
+
+ @retval none
+**/
+void
+MrcIssuePrechargeAll (
+ IN MrcParameters *const MrcData,
+ IN const U8 Channel,
+ IN const U8 RankMask
+ )
+{
+ U32 CaHigh;
+ U32 CaLow;
+ U32 CMD;
+ U32 BA;
+ U32 MA;
+
+ CaHigh = 0x1B;
+ CaLow = 0;
+
+ MrcConvertLpddr2Ddr (CaHigh, CaLow, &MA, &BA, &CMD);
+
+// MRC_DEBUG_MSG (&MrcData->SysIn.Inputs.Debug, MSG_LEVEL_ERROR, "MA: 0x%X, BA: 0x%X, CMD: 0x%X\n", MA, BA, CMD);
+
+ MrcWriteCADBCmd (MrcData, Channel, RankMask, (U8) CMD, (U8) BA, (U16 *) &MA, 0);
+}
+
+#endif // ULT_FLAG
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Services/MrcIoControl.c b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Services/MrcIoControl.c
new file mode 100644
index 0000000..dc6fc11
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Services/MrcIoControl.c
@@ -0,0 +1,62 @@
+/** @file
+ This file is used as a driver to all memory controller IO registers.
+ It includes all the functions that the MRC needs to configure the IO and do the training.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+**/
+
+//
+// Include files
+//
+#include "MrcIoControl.h"
+
+/**
+@brief
+ Reset the MC IO module. The MC hardware will handle creating the 20 dclk pulse
+ after the bit is set and will also clear the bit.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval mrcSuccess - IO Reset was done successfully
+ @retval mrcDeviceBusy - Timed out waiting for the IO to clear the bit
+**/
+MrcStatus
+IoReset (
+ IN MrcParameters *const MrcData
+ )
+{
+ MCDECS_CR_MC_INIT_STATE_G_MCMAIN_STRUCT McInitStateG;
+ BOOL Busy;
+ U32 Timeout;
+
+ Timeout = (U32) MrcGetCpuTime () + 10000; // 10 seconds timeout
+
+ McInitStateG.Data = MrcReadCR (MrcData, MCDECS_CR_MC_INIT_STATE_G_MCMAIN_REG);
+ McInitStateG.Bits.reset_io = 1;
+ MrcWriteCR (MrcData, MCDECS_CR_MC_INIT_STATE_G_MCMAIN_REG, McInitStateG.Data);
+
+ //
+ // Wait until the bit is cleared by hardware
+ //
+ do {
+ McInitStateG.Data = MrcReadCR (MrcData, MCDECS_CR_MC_INIT_STATE_G_MCMAIN_REG);
+ Busy = (McInitStateG.Bits.reset_io == 1);
+ } while (Busy && ((U32) MrcGetCpuTime () < Timeout));
+
+ return (Busy ? mrcDeviceBusy : mrcSuccess);
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Services/MrcMcConfiguration.c b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Services/MrcMcConfiguration.c
new file mode 100644
index 0000000..914491a
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Services/MrcMcConfiguration.c
@@ -0,0 +1,1405 @@
+/** @file
+ The functions in this file implement the memory controller registers that
+ are not training specific. After these functions are executed, the
+ memory controller will be ready to execute the timing training sequences.
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+
+**/
+
+//
+// Include files
+//
+#include "MrcMcConfiguration.h"
+
+const U8 RxBiasTable[2][5][4] = {
+ /// Vdd low
+ /// 1067 Mhz, 1333 Mhz, 1600 MHz, 1867 MHz, 2133 Mhz
+ { {4, 3, 3, 2}, {4, 4, 3, 2}, {5, 4, 3, 3}, {5, 4, 4, 3}, {5, 4, 4, 3} },
+ /// Vdd hi
+ /// 1067 Mhz, 1333 Mhz, 1600 MHz, 1867 MHz, 2133 Mhz
+ { {4, 3, 3, 2}, {4, 4, 3, 2}, {5, 4, 3, 3}, {5, 4, 4, 3}, {4, 4, 3, 3} }
+};
+
+#ifdef ULT_FLAG
+const U8 RxBiasTableUlt[2][3][4] = {
+ /// Vdd low
+ /// 1067 Mhz, 1333 Mhz, 1600 MHz
+ { {5, 6, 6, 5}, {5, 6, 6, 5}, {4, 6, 6, 6} },
+ /// Vdd hi
+ /// 1067 Mhz, 1333 Mhz, 1600 MHz
+ { {7, 6, 6, 5}, {7, 6, 6, 5}, {7, 6, 6, 6} }
+};
+#endif // ULT_FLAG
+
+/**
+@brief
+ This function calculates the two numbers that get you closest to the slope.
+
+ @param[in] Slope - targeted slope (multiplied by 100 for int match)
+
+ @retval Returns the Slope Index to be programmed for VtSlope.
+**/
+U8
+MrcCalcVtSlopeCode (
+ IN const U16 Slope
+ )
+{
+ const S16 Coding[] = {0, -125, -62, -31, 250, 125, 62, 31};
+ S16 Error;
+ S16 BestError;
+ U8 BestI;
+ U8 BestJ;
+ U8 i;
+ U8 j;
+
+ BestError = 1000;
+ BestI = 0;
+ BestJ = 0;
+ for (i = 0; i < (sizeof (Coding) / sizeof (Coding[0])); i++) {
+ for (j = 0; j < (sizeof (Coding) / sizeof (Coding[0])); j++) {
+ Error = Slope - (Coding[i] + Coding[j]);
+ if (Error < 0) {
+ Error = -Error;
+ }
+
+ if (BestError > Error) {
+ BestError = Error;
+ BestI = i;
+ BestJ = j;
+ }
+ }
+ }
+
+ return (BestI << 3) + BestJ;
+}
+
+/**
+@brief
+ This function performs the memory controller configuration non training sequence.
+
+ @param[in, out] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - mrcSuccess if successful or an error status
+**/
+MrcStatus
+MrcMcConfiguration (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ const U8 StdCASLat[] = {7, 9, 11, 13, 14}; // 1067, 1333, 1600, 1867 & 2133 MHz
+ const U8 ByteStagger[] = {0, 4, 1, 5, 2, 6, 3, 7, 8};
+ const U8 StepSize[] = {64, 96, 64, 64, 64}; // From Design
+ U8 ReferenceR[] = {25, 50, 20, 20, 25}; // Reference resistors on motherboard (+0 Ohm Rstray)
+ const U8 MinCycleStageDelay[] = {46, 70, 70, 46}; // Avoid corner case
+ const U8 TargetRcompConst[] = {33, 50, 20, 20, 29}; // Target values
+ const U8 BufferStageDelayPSConst[] = {59, 53, 53, 53}; // Slew = 1V / (# Stages * StageDelayPS * Derating)
+ const MrcDebug *Debug;
+ MrcStatus Status;
+ MrcInput *Inputs;
+ MrcOutput *Outputs;
+ MrcChannelIn *ChannelIn;
+ MrcChannelOut *ChannelOut;
+ MrcControllerOut *ControllerOut;
+ MrcDimmOut *DimmOut;
+ MrcCpuModel CpuModel;
+ MrcCpuStepping CpuStepping;
+ MrcProfile Profile;
+ MrcVddSelect Vdd;
+ BOOL Cmd2N;
+ BOOL AutoSelfRefresh;
+ U32 vrefup;
+ U32 Offset;
+ U32 Data32;
+ U32 DisableOdtStatic;
+ S16 CompVref;
+ U16 VssHiSwingTarget;
+ U16 vpanic;
+ U16 SAFE;
+ U16 NS;
+ U16 VssHi; // Target VssHi Voltage
+ U16 Target;
+ U16 Slope;
+ U16 NumStages;
+ U16 lndown;
+ U16 Rdown;
+ U16 vrefdown;
+ U16 vsshiu;
+ U16 vsshid;
+ U16 lnup;
+ U16 Rup;
+ U16 RefiReduction;
+ S8 RxFselect;
+ U8 delta;
+ U8 Controller;
+ U8 Channel;
+ U8 Dimm;
+ U8 Rank;
+ U8 Byte;
+ U8 VddHi;
+ U8 OverClock;
+ U8 MinLatency;
+ U8 Latency[MAX_CHANNEL];
+ U8 ChannelLatency;
+ U8 RxCBSelect;
+ U8 RxB;
+ U8 stagger;
+ U8 Any2dpc;
+ U8 TargetRcomp[sizeof (TargetRcompConst) / sizeof (TargetRcompConst[0])];
+ U8 BufferStageDelayPS[sizeof (BufferStageDelayPSConst) / sizeof (BufferStageDelayPSConst[0])];
+ U8 i;
+ DDRDATA_CR_RXTRAINRANK0_STRUCT RxTrainRank;
+ DDRDATA_CR_TXTRAINRANK0_STRUCT TxTrainRank;
+ DDRDATA_CR_DDRCRDATACONTROL0_STRUCT DdrCrDataControl0;
+ DDRDATA_CR_DDRCRDATACONTROL1_STRUCT DdrCrDataControl1;
+ DDRDATA0CH0_CR_DDRCRDATACONTROL2_STRUCT DdrCrDataControl2;
+#ifdef ULT_FLAG
+ BOOL Lpddr;
+ U32 Group;
+ U32 Cke;
+ U32 CkeRankMapping;
+ DDRDATA_CR_DDRCRVSSHICONTROL_STRUCT DdrCrVssHiControl;
+ DDRDATA7CH1_CR_DDRCRVREFCONTROL_STRUCT DdrCrVrefControl;
+ PCU_CR_DDR_PTM_CTL_PCU_STRUCT DdrPtmCtl;
+#endif // ULT_FLAG
+#ifdef TRAD_FLAG
+ DDRDATACH0_CR_DDRCRVSSHIORVREFCONTROL_STRUCT DdrCrVssHiOrVrefControl;
+#endif // TRAD_FLAG
+ DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_STRUCT DdrCrCompVssHiControl;
+ DDRDATA_CR_DDRCRVREFADJUST1_STRUCT DdrCrVrefAdjust;
+ DDRCLKCH0_CR_DDRCRCLKCONTROLS_STRUCT DdrCrClkControls;
+ DDRCMDCH0_CR_DDRCRCMDCONTROLS_STRUCT DdrCrCmdControls;
+ DDRCKECH0_CR_DDRCRCTLCONTROLS_STRUCT DdrCrCkeControls;
+ DDRCTLCH0_CR_DDRCRCTLCONTROLS_STRUCT DdrCrCtlControls;
+ DDRCKECTLCH0_CR_DDRCRCTLPICODING_STRUCT DdrCrCtlPiCoding;
+ DDRCLKCH0_CR_DDRCRCLKRANKSUSED_STRUCT DdrCrClkRanksUsed;
+ DDRCTLCH0_CR_DDRCRCTLRANKSUSED_STRUCT CtlDdrCrCtlRanksUsed;
+ DDRCKECH0_CR_DDRCRCTLRANKSUSED_STRUCT CkeDdrCrCtlRanksUsed;
+ DDRCOMP_CR_DDRCRCOMPVSSHI_STRUCT DdrCrCompVssHi;
+ DDRSCRAM_CR_DDRMISCCONTROL0_STRUCT DdrMiscControl;
+ PCU_CR_M_COMP_PCU_STRUCT CrMCompPcu;
+ DDRDATA_CR_RCOMPDATA1_STRUCT DataRCompData;
+ DDRCMD_CR_DDRCRCMDCOMP_STRUCT CmdDdrCrCmdComp;
+ DDRCKECTL_CR_DDRCRCTLCOMP_STRUCT CkeCtlDdrCrCtlComp;
+ DDRCLK_CR_DDRCRCLKCOMP_STRUCT ClkDdrCrClkComp;
+ DDRCOMP_CR_DDRCRDATACOMP1_STRUCT CompDdrCrDataComp;
+ DDRCOMP_CR_DDRCRCMDCOMP_STRUCT CompDdrCrCmdComp;
+ DDRCOMP_CR_DDRCRCTLCOMP_STRUCT CompDdrCrCtlComp;
+ DDRCOMP_CR_DDRCRCLKCOMP_STRUCT CompDdrCrClkComp;
+ DDRCOMP_CR_DDRCRCOMPOVR_STRUCT CompDdrCrCompOvr;
+ DDRCOMP_CR_DDRCRCOMPCTL0_STRUCT CompDdrCrCompCtl0;
+ DDRCOMP_CR_DDRCRCOMPCTL1_STRUCT CompDdrCrCompCtl1;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerOut = &Outputs->Controller[0];
+ Profile = Inputs->MemoryProfile;
+ Status = mrcSuccess;
+ CpuModel = Inputs->CpuModel;
+ CpuStepping = Inputs->CpuStepping;
+ Vdd = Outputs->VddVoltage[Inputs->MemoryProfile];
+ VddHi = 0;
+ OverClock = 0;
+ MinLatency = 24;
+ SAFE = 0;
+ VssHiSwingTarget = 950; // VssHi target voltage in mV
+ vpanic = 24; // Panic Treshold at 24 mV
+ delta = 15; // VssHi change voltage during panic: 15mV
+ RefiReduction = 100; // Init to 100% for no reduction.
+ DisableOdtStatic = DISABLE_ODT_STATIC;
+
+ MrcOemMemorySet (Latency, 0, sizeof (Latency));
+ MrcOemMemoryCpy (TargetRcomp, (U8 *) TargetRcompConst, sizeof (TargetRcomp) / sizeof (TargetRcomp[0]));
+ MrcOemMemoryCpy (
+ BufferStageDelayPS,
+ (U8 *) BufferStageDelayPSConst,
+ sizeof (BufferStageDelayPS) / sizeof (BufferStageDelayPS[0])
+ );
+
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerOut = &Outputs->Controller[Controller];
+ ControllerOut->DeviceId = (U16) (MrcOemPciRead32 (HOST_BRIDGE_BUS, HOST_BRIDGE_DEVICE, HOST_BRIDGE_FUNCTION, HOST_BRIDGE_DEVID) >> 16);
+ ControllerOut->RevisionId = (U8) (MrcOemPciRead32 (HOST_BRIDGE_BUS, HOST_BRIDGE_DEVICE, HOST_BRIDGE_FUNCTION, HOST_BRIDGE_REVID));
+ }
+
+#ifdef TRAD_FLAG
+ if ((CpuModel == cmHSW) || (CpuModel == cmCRW)) {
+ //
+ // Make sure tCL-tCWL <= 4
+ // This is needed to support ODT properly for 2DPC case
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ if ((ChannelOut->Timing[Profile].tCL - ChannelOut->Timing[Profile].tCWL) > 4) {
+ ChannelOut->Timing[Profile].tCWL = ChannelOut->Timing[Profile].tCL - 4;
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "(tCL-tCWL) > 4, CH %u - tCWL has been updated to %u\n",
+ Channel,
+ ChannelOut->Timing[Profile].tCWL
+ );
+ }
+ }
+ }
+ }
+#endif // TRAD_FLAG
+
+ //
+ // Set memory controller frequency
+ //
+ if (MrcOemCheckPoint (MrcData, OemFrequencySet, NULL) == mrcSuccess) {
+ Status = McFrequencySet (MrcData);
+ if (Status != mrcSuccess) {
+ return Status;
+ }
+ }
+#ifdef SSA_FLAG
+ MrcOemCheckPoint (MrcData, OemFrequencySetDone, NULL);
+#endif // SSA_FLAG
+ Outputs->Qclkps = (U16) (Outputs->MemoryClock / (2 * 1000)); // QCLK period in pico seconds.
+
+#ifdef ULT_FLAG
+ //
+ // Check if LPDDR3 memory is used
+ //
+ Lpddr = (Outputs->DdrType == MRC_DDR_TYPE_LPDDR3);
+
+ if (CpuModel == cmHSW_ULT) {
+ //
+ // Select the interleaving mode of DQ/DQS pins
+ // This must be the first DDR IO register to be programmed on ULT
+ //
+ DdrMiscControl.Data = 0;
+ DdrMiscControl.Bits.DdrNoChInterleave = (Inputs->DqPinsInterleaved) ? 0 : 1;
+ if (Lpddr) {
+ DdrMiscControl.Bits.LPDDR_Mode = 1;
+
+ //
+ // Initialize the CKE-to-rank mapping for LPDDR
+ //
+ DdrMiscControl.Bits.CKEMappingCh0 = Inputs->CkeRankMapping & 0x0F;
+ DdrMiscControl.Bits.CKEMappingCh1 = (Inputs->CkeRankMapping >> 4) & 0x0F;
+ }
+ MrcWriteCR (MrcData, DDRSCRAM_CR_DDRMISCCONTROL0_REG, DdrMiscControl.Data);
+ DisableOdtStatic = 1;
+ }
+#endif // ULT_FLAG
+ //
+ // Save MRC Version into CR
+ //
+ MrcSetMrcVersion (MrcData);
+
+ Any2dpc = 0;
+ if (Vdd > VDD_1_35) {
+ VddHi = 1; // Set HiVdd bit if Vdd is over 1.35v
+ }
+
+ NS = ~SAFE;
+
+ //
+ // RX BIAS calculations
+ //
+ GetRxFselect (MrcData, &RxFselect, &RxCBSelect);
+
+#ifdef ULT_FLAG
+ if (CpuModel == cmHSW_ULT) {
+ RxFselect = MIN (RxFselect, RXF_SELECT_MAX_ULT); // Maximum 1600 MHz
+ RxB = RxBiasTableUlt[VddHi][RxFselect][RxCBSelect]; // Read setting from array lookup table
+ } else
+#endif // ULT_FLAG
+ {
+ RxB = RxBiasTable[VddHi][RxFselect][RxCBSelect]; // Read setting from array lookup table
+ }
+
+ //
+ // Determine Overclocking
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ Latency[Channel] = (U8) ChannelOut->Timing[Profile].tCL;
+ if (Latency[Channel] < MinLatency) {
+ MinLatency = Latency[Channel];
+ }
+ }
+ }
+
+ if ((Outputs->Frequency > 2133) || (MinLatency < StdCASLat[RxFselect])) {
+ OverClock = 1;
+ }
+ //
+ // Initialize ValidChBitMask and ValidRankMask used during all training steps
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!MrcChannelExist (Outputs, Channel)) {
+ continue;
+ }
+ ChannelOut = &ControllerOut->Channel[Channel];
+ ChannelIn = &Inputs->Controller[0].Channel[Channel];
+
+ if (ChannelOut->DimmCount == 2) {
+ Any2dpc++;
+ }
+
+ Outputs->ValidChBitMask |= (1 << Channel);
+ Outputs->ValidRankMask |= ChannelOut->ValidRankBitMask;
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "C%uValidRankBitMask / ValidRankMask - 0x%x / 0x%x\n",
+ Channel,
+ ChannelOut->ValidRankBitMask,
+ Outputs->ValidRankMask
+ );
+
+ //
+ // Initialize RanksUsed in CLK fub
+ //
+ DdrCrClkRanksUsed.Data = 0;
+ DdrCrClkRanksUsed.Bits.RankEn = ChannelOut->ValidRankBitMask;
+#ifdef ULT_FLAG
+ if (Lpddr) {
+ //
+ // On LPDDR the CLK RanksUsed goes by CLK group instead of by Rank
+ //
+ DdrCrClkRanksUsed.Bits.RankEn = 0;
+ for (Group = 0; Group < 2; Group++) {
+ if (ChannelIn->DQByteMap[MrcIterationClock][Group] != 0) {
+ DdrCrClkRanksUsed.Bits.RankEn |= (1 << Group);
+ }
+ }
+ }
+#endif // ULT_FLAG
+ Offset = DDRCLKCH0_CR_DDRCRCLKRANKSUSED_REG +
+ ((DDRCLKCH1_CR_DDRCRCLKRANKSUSED_REG - DDRCLKCH0_CR_DDRCRCLKRANKSUSED_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, DdrCrClkRanksUsed.Data);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "DDRCLKCH%d_CR_DDRCRCTLRANKSUSED = 0x%X\n", Channel, DdrCrClkRanksUsed.Data);
+
+ //
+ // Initialize RanksUsed in CTL fub - CS (and ODT for LPDDR)
+ //
+ CtlDdrCrCtlRanksUsed.Data = 0;
+ CtlDdrCrCtlRanksUsed.Bits.RankEn = ChannelOut->ValidRankBitMask;
+#ifdef ULT_FLAG
+ if (CpuModel == cmHSW_ULT) {
+ if (Lpddr && Inputs->LpddrDramOdt) {
+ //
+ // ODT is used on rank 0
+ //
+ CtlDdrCrCtlRanksUsed.Bits.OdtDisable = 2;
+ } else {
+ CtlDdrCrCtlRanksUsed.Bits.OdtDisable = 3;
+ }
+ }
+#endif // ULT_FLAG
+ Offset = DDRCTLCH0_CR_DDRCRCTLRANKSUSED_REG +
+ ((DDRCTLCH1_CR_DDRCRCTLRANKSUSED_REG - DDRCTLCH0_CR_DDRCRCTLRANKSUSED_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, CtlDdrCrCtlRanksUsed.Data);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "DDRCTLCH%d_CR_DDRCRCTLRANKSUSED = 0x%X\n", Channel, CtlDdrCrCtlRanksUsed.Data);
+
+ //
+ // Initialize RanksUsed in CKE fub
+ //
+ CkeDdrCrCtlRanksUsed.Data = 0;
+ CkeDdrCrCtlRanksUsed.Bits.RankEn = ChannelOut->ValidRankBitMask;
+#ifdef ULT_FLAG
+ if (Lpddr) {
+ CkeDdrCrCtlRanksUsed.Bits.RankEn = 0;
+ //
+ // Use CKE-to-Rank mapping: [3:0] - Channel 0, [7:4] - Channel 1
+ //
+ CkeRankMapping = (Inputs->CkeRankMapping >> (Channel * 4)) & 0x0F;
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ for (Cke = 0; Cke <= 3; Cke++) {
+ if (((CkeRankMapping >> Cke) & 1) == Rank) {
+ //
+ // This CKE pin is connected to this Rank...
+ //
+ if (ChannelOut->ValidRankBitMask & (1 << Rank)) {
+ //
+ // ...and this rank is enabled
+ //
+ CkeDdrCrCtlRanksUsed.Bits.RankEn |= (1 << Cke);
+ }
+ }
+ }
+ }
+ }
+#endif // ULT_FLAG
+ Offset = DDRCKECH0_CR_DDRCRCTLRANKSUSED_REG +
+ ((DDRCKECH1_CR_DDRCRCTLRANKSUSED_REG - DDRCKECH0_CR_DDRCRCTLRANKSUSED_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, CkeDdrCrCtlRanksUsed.Data);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "DDRCKECH%d_CR_DDRCRCTLRANKSUSED = 0x%X\n", Channel, CkeDdrCrCtlRanksUsed.Data);
+ //
+ // Save for future use in JEDEC Reset, etc.
+ //
+ ChannelOut->ValidCkeBitMask = (U8) CkeDdrCrCtlRanksUsed.Bits.RankEn;
+ } // for Channel
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Init Data CRs\n");
+
+
+ //
+ // Initialize Rx and Tx Data CRs
+ //
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if (((1 << Rank) & Outputs->ValidRankMask) == 0) {
+ continue;
+ }
+ //
+ // RxDqsN/P_Pi = 32, RcvEn = 64, RxEq = 1
+ //
+ RxTrainRank.Data = 0;
+ RxTrainRank.Bits.RxRcvEnPi = 64;
+ RxTrainRank.Bits.RxDqsPPi = 32;
+ RxTrainRank.Bits.RxDqsNPi = 32;
+ RxTrainRank.Bits.RxEq = 1;
+ //
+ // RxGroup - Broadcast all channels
+ //
+ Offset = DDRDATA_CR_RXTRAINRANK0_REG + ((DDRDATA_CR_RXTRAINRANK1_REG - DDRDATA_CR_RXTRAINRANK0_REG) * Rank);
+ MrcWriteCrMulticast (MrcData, Offset, RxTrainRank.Data);
+
+ //
+ // Rx per bit offset - Middle value. Train later.
+ //
+ Offset = DDRDATA_CR_RXPERBITRANK0_REG + ((DDRDATA_CR_RXPERBITRANK1_REG - DDRDATA_CR_RXPERBITRANK0_REG) * Rank);
+ Data32 = 0x88888888;
+ MrcWriteCrMulticast (MrcData, Offset, Data32);
+
+ //
+ // Set TxEq to full strength, TxDqs = 0 and TxDq = 32,
+ //
+ TxTrainRank.Data = 0;
+ TxTrainRank.Bits.TxEqualization = TXEQFULLDRV | 0x0B;
+ TxTrainRank.Bits.TxDqDelay = 96;
+ TxTrainRank.Bits.TxDqsDelay = 64;
+ Offset = DDRDATA_CR_TXTRAINRANK0_REG + ((DDRDATA_CR_TXTRAINRANK1_REG - DDRDATA_CR_TXTRAINRANK0_REG) * Rank);
+ MrcWriteCrMulticast (MrcData, Offset, TxTrainRank.Data);
+ //
+ // Middle value. Train later.
+ //
+ Offset = DDRDATA_CR_TXPERBITRANK0_REG + ((DDRDATA_CR_TXPERBITRANK1_REG - DDRDATA_CR_TXPERBITRANK0_REG) * Rank);
+ MrcWriteCrMulticast (MrcData, Offset, 0x88888888);
+
+ //
+ // Save in MrcData
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Byte = 0; Byte < MAX_SDRAM_IN_DIMM; Byte++) {
+ ChannelOut->TxDq[Rank][Byte] = (U16) (TxTrainRank.Bits.TxDqDelay);
+ ChannelOut->TxDqs[Rank][Byte] = (U16) (TxTrainRank.Bits.TxDqsDelay);
+ ChannelOut->TxEq[Rank][Byte] = (U8) (TxTrainRank.Bits.TxEqualization);
+
+ ChannelOut->RcvEn[Rank][Byte] = (U16) (RxTrainRank.Bits.RxRcvEnPi);
+ ChannelOut->RxDqsP[Rank][Byte] = (U8) (RxTrainRank.Bits.RxDqsPPi);
+ ChannelOut->RxDqsN[Rank][Byte] = (U8) (RxTrainRank.Bits.RxDqsNPi);
+ ChannelOut->RxEq[Rank][Byte] = (U8) (RxTrainRank.Bits.RxEq);
+ }
+ }
+ }
+ //
+ // Initial value to corresponding 0.
+ //
+ MrcWriteCrMulticast (MrcData, DDRDATA_CR_TXXTALK_REG, 0x0);
+ //
+ // Amplifier voltage offset {0: Most negative offset,... 8: 0 offset, ... 15: Most postive offset}
+ //
+ MrcWriteCrMulticast (MrcData, DDRDATA_CR_RXOFFSETVDQ_REG, 0x88888888);
+ MrcWriteCrMulticast (MrcData, DDRDATA_CR_DDRCRDATAOFFSETTRAIN_REG, 0x0);
+ MrcWriteCrMulticast (MrcData, DDRDATA_CR_DDRCRDATAOFFSETCOMP_REG, 0x0);
+
+ //
+ // Disable ODT Static Leg, set Vdd
+ //
+ DdrCrDataControl0.Data = 0;
+ DdrCrDataControl0.Bits.DataVccddqHi = VddHi;
+ DdrCrDataControl0.Bits.DisableOdtStatic = DisableOdtStatic;
+#ifdef ULT_FLAG
+ if (Lpddr) {
+ DdrCrDataControl0.Bits.LPDDR_Mode = 1;
+ //
+ // If C0 or greater, enable EarlyRleak. Otherwise, no Read Conditioning.
+ //
+ if ((CpuModel == cmHSW_ULT) && (CpuStepping >= csHswUltC0)) {
+ DdrCrDataControl0.Bits.EarlyRleakEn = 1; // Mutually exclusive with DdrCrDataControl0.EnReadPreamble
+ }
+ DdrCrDataControl0.Bits.OdtSampExtendEn = 1;
+ }
+#endif // ULT_FLAG
+#ifdef TRAD_FLAG
+ if ((CpuModel == cmHSW) || (CpuModel == cmCRW)) {
+ DdrCrDataControl0.Bits.InternalClocksOn = 1;
+ }
+#endif // TRAD_FLAG
+ MrcWriteCrMulticast (MrcData, DDRDATA_CR_DDRCRDATACONTROL0_REG, DdrCrDataControl0.Data);
+ DdrCrDataControl1.Data = 0;
+ if (Inputs->WeaklockEn) {
+ DdrCrDataControl1.Bits.DllWeakLock = NS; // Enable DLL WeakLock
+ }
+
+ DdrCrDataControl1.Bits.DllMask = 1; // 2 qclk DLL mask
+ DdrCrDataControl1.Bits.OdtDelay = 0xE; // Signed value of (-2) has been converted to hex
+ DdrCrDataControl1.Bits.SenseAmpDelay = 0xE; // Signed value of (-2) has been converted to hex
+ DdrCrDataControl1.Bits.SenseAmpDuration = DDRDATA_CR_DDRCRDATACONTROL1_SenseAmpDuration_MAX; // Max Samp Duration.
+ DdrCrDataControl1.Bits.OdtDuration = DDRDATA_CR_DDRCRDATACONTROL1_OdtDuration_MAX; // Max Odt Duration.
+ DdrCrDataControl1.Bits.RxBiasCtl = RxB; // RxBias uses LUT.
+
+#ifdef ULT_FLAG
+#endif // ULT_FLAG
+
+ MrcWriteCrMulticast (MrcData, DDRDATA_CR_DDRCRDATACONTROL1_REG, DdrCrDataControl1.Data);
+
+ DdrCrDataControl2.Data = 0; // Define DQControl2
+
+#ifdef ULT_FLAG
+ if (CpuModel == cmHSW_ULT) {
+ DdrCrDataControl2.Bits.RxDqsAmpOffset = DDRDATA0CH0_CR_DDRCRDATACONTROL2_RxDqsAmpOffset_DEF;
+ DdrCrDataControl2.Bits.RxClkStgNum = DDRDATA0CH0_CR_DDRCRDATACONTROL2_RxClkStgNum_MAX;
+ if (Lpddr) {
+ DdrCrDataControl2.Bits.LeakerComp = 3;
+ }
+ }
+#endif // ULT_FLAG
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++){
+ if (MrcChannelExist (Outputs, Channel)) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+
+ ChannelOut->DqControl0.Data = DdrCrDataControl0.Data;
+ ChannelLatency = 2 * Latency[Channel] - 6;
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ //
+ // These CRs do a lot of RMW.
+ //
+ ChannelOut->DataOffsetTrain[Byte] = 0; // Faster to store the value in host
+ ChannelOut->DataCompOffset[Byte] = 0;
+ ChannelOut->DqControl1[Byte].Data = DdrCrDataControl1.Data;
+
+ //
+ // Stagger byte turnon to reduce dI/dT. In safe mode, turn off stagger feature
+ //
+ stagger = (SAFE) ? 0 : ((ChannelLatency * ByteStagger[Byte]) / (U8) Outputs->SdramCount) & 0x1F;
+ Offset = DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG +
+ ((DDRDATA0CH1_CR_DDRCRDATACONTROL2_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG) * Channel) +
+ ((DDRDATA1CH0_CR_DDRCRDATACONTROL2_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG) * Byte);
+ DdrCrDataControl2.Bits.RxStaggerCtl = stagger;
+ MrcWriteCR (MrcData, Offset, DdrCrDataControl2.Data);
+ ChannelOut->DqControl2[Byte].Data = DdrCrDataControl2.Data;
+ }
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Init Data VssHi CRs\n");
+ //
+ // Initialize VssHi CRs
+ //
+ // @todo: Need to verify as I don't have bit definitions for VssHi mode
+ //
+ VssHi = ((U16) Vdd - VssHiSwingTarget); // VssHiSwingTarget = 950 mV, VddmV=1500 mV
+ Target = (VssHi * 192) / (U16) Vdd - 20; // Sets target for VssHi.
+
+ DdrCrCompVssHiControl.Data = 0;
+#ifdef ULT_FLAG
+ if (CpuModel == cmHSW_ULT) {
+ DdrCrVssHiControl.Data = (SAFE) ? // SAFE: Panic at 7*8=56mV, !SAFE: Panic at 24mV, GainBoost.
+ (7 << 18) + (2 << 14) + (2 << 8) + (2 << 6) : // Set BwError and *BWDivider to safe values
+ (1 << 22) + (3 << 18) + (2 << 14) + (1 << 8) + (1 << 6); // Normal values for BwError/*BWDivider
+ DdrCrVssHiControl.Data += (1 << 16); // Enable Panic Driver
+ DdrCrVssHiControl.Data += Target + (0 << 10); // Set loop sample frequency at max
+ MrcWriteCrMulticast (MrcData, DDRDATA_CR_DDRCRVSSHICONTROL_REG, DdrCrVssHiControl.Data); // Multicast to both channels
+ //
+ // Set COMP VssHi the same
+ //
+ DdrCrCompVssHiControl.Data = DdrCrVssHiControl.Data;
+ }
+#endif // ULT_FLAG
+#ifdef TRAD_FLAG
+ if ((CpuModel == cmHSW) || (CpuModel == cmCRW)) {
+ DdrCrVssHiOrVrefControl.Data = (SAFE) ? // SAFE: Panic at 7*8=56mV, !SAFE: Panic at 24mV, GainBoost.
+ (7 << 18) + (2 << 14) + (2 << 8) + (2 << 6) : // Set BwError and *BWDivider to safe values
+ (1 << 22) + (3 << 18) + (2 << 14) + (1 << 8) + (1 << 6); // Normal values for BwError/*BWDivider
+ DdrCrVssHiOrVrefControl.Data += (1 << 16); // Enable Panic Driver
+ DdrCrVssHiOrVrefControl.Data += Target + (0 << 10); // Set loop sample frequency at max
+ MrcWriteCrMulticast (MrcData, DDRDATACH0_CR_DDRCRVSSHIORVREFCONTROL_REG, DdrCrVssHiOrVrefControl.Data);
+
+ //
+ // Set COMP VssHi the same
+ //
+ DdrCrCompVssHiControl.Data = DdrCrVssHiOrVrefControl.Data;
+ }
+#endif // TRAD_FLAG
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Init Comp VssHi CRs\n");
+ MrcWriteCrMulticast (MrcData, DDRCOMP_CR_DDRCRCOMPVSSHICONTROL_REG, DdrCrCompVssHiControl.Data);
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Init Dimm Vref CRs\n");
+ //
+ // Initialize Dimm Vref CRs - Use CH1 BYTE 7
+ //
+ // Ideal Slope EQN = (192/128*VccIo/Vdd-1)
+ //
+ Slope = (U16) ((1000 * 192 * Inputs->VccIomV) / (128 * (U16) Vdd) - 1000);
+ Slope = MrcCalcVtSlopeCode (Slope); // Translate ideal slope in CR value
+
+#ifdef ULT_FLAG
+ if (CpuModel == cmHSW_ULT) {
+ //
+ // No Offset. Apply Slope adjustment VT Slope A = 4, VT Slope B = 0, Set SlowBWError = 1
+ //
+ DdrCrVrefControl.Data = (0 << 18) + (0x20 << 12) + (1 << 8);
+ //
+ // Enable HiBW mode, Set Loop Frequency
+ //
+ DdrCrVrefControl.Data += (1 << 10) + (1 << 4);
+ //
+ // Set LoBWDiv, HiBWDiv
+ //
+ DdrCrVrefControl.Data += (3 << 2) + (0 << 0);
+ //
+ // Program DimmVref Control Values
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "DdrCrVrefControl: 0x%X\n", DdrCrVrefControl.Data);
+ MrcWriteCR (MrcData, DDRDATA7CH1_CR_DDRCRVREFCONTROL_REG, DdrCrVrefControl.Data);
+ }
+#endif // ULT_FLAG
+#ifdef TRAD_FLAG
+ if ((CpuModel == cmHSW) || (CpuModel == cmCRW)) {
+ //
+ // No Offset. Apply Slope adjustment, Set SlowBWError = 1
+ //
+ DdrCrVssHiOrVrefControl.Data = (0 << 18) + (Slope << 12) + (1 << 8);
+ //
+ // Enable HiBW mode, Set Loop Frequency
+ //
+ DdrCrVssHiOrVrefControl.Data += (1 << 10) + (3 << 4);
+ //
+ // Set LoBWDiv, HiBWDiv
+ //
+ DdrCrVssHiOrVrefControl.Data += (3 << 2) + (3 << 0);
+ //
+ // Program DimmVref Control Values
+ //
+ MrcWriteCR (MrcData, DDRDATA7CH1_CR_DDRCRVSSHIORVREFCONTROL_REG, DdrCrVssHiOrVrefControl.Data);
+ }
+#endif // TRAD_FLAG
+
+ //
+ // Enable all DimmVref and VddHi based on VddVoltage
+ //
+ DdrCrVrefAdjust.Data = 0;
+ DdrCrVrefAdjust.Bits.EnDimmVrefCA = 1;
+ DdrCrVrefAdjust.Bits.EnDimmVrefCh0 = 1;
+ DdrCrVrefAdjust.Bits.EnDimmVrefCh1 = 1;
+ DdrCrVrefAdjust.Bits.VccddqHiQnnnH = VddHi;
+ DdrCrVrefAdjust.Bits.HiZTimerCtrl = DDRDATA_CR_DDRCRVREFADJUST1_HiZTimerCtrl_MAX;
+ //
+ // Enable DimmVref Drivers with Vref = 0
+ //
+ MrcWriteCrMulticast (MrcData, DDRDATA_CR_DDRCRVREFADJUST1_REG, DdrCrVrefAdjust.Data);
+ Outputs->DimmVref = DdrCrVrefAdjust.Data;
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+
+ ChannelOut = &ControllerOut->Channel[Channel];
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Init CLK CRs\n");
+ //
+ // Initialize Clock CRs
+ //
+ DdrCrClkControls.Data = 0;
+ DdrCrClkControls.Bits.DllMask = 1; // Set 2 qclk DLL mask
+ DdrCrClkControls.Bits.VccddqHi = VddHi; // Set Vdd
+#ifdef ULT_FLAG
+ if (Lpddr) {
+ DdrCrClkControls.Bits.LPDDR_Mode = 1;
+ }
+#endif // ULT_FLAG
+ Offset = DDRCLKCH0_CR_DDRCRCLKCONTROLS_REG +
+ ((DDRCLKCH1_CR_DDRCRCLKCONTROLS_REG - DDRCLKCH0_CR_DDRCRCLKCONTROLS_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, DdrCrClkControls.Data);
+
+ DdrCrCmdControls.Data = DdrCrClkControls.Data;
+ DdrCrCtlControls.Data = DdrCrClkControls.Data;
+ // Determine if weaklock can or can not be enabled
+ //
+ if (Inputs->WeaklockEn) {
+ DdrCrCmdControls.Bits.DllWeakLock = NS;
+ DdrCrCtlControls.Bits.DllWeakLock = NS;
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Init CMD N and P CRs\n");
+ //
+ // Initialize CmdN/CmdS CRx
+ //
+ DdrCrCmdControls.Bits.EarlyWeakDrive = 3;
+ DdrCrCmdControls.Bits.CmdTxEq = NS & 1; // Enable Early Warning and Cmd DeEmphasis
+ MrcWriteCR (MrcData, DDRCMDCH0_CR_DDRCRCMDCONTROLS_REG +
+ ((DDRCMDCH1_CR_DDRCRCMDCONTROLS_REG - DDRCMDCH0_CR_DDRCRCMDCONTROLS_REG) * Channel), DdrCrCmdControls.Data);
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Init CKE CRs\n");
+ //
+ // Initialize CKE CRs
+ //
+ // @todo: DONE Either CKE and CTL must be set the same or we have to be using the per channel defines and not a Multicast.
+ //
+ DdrCrCkeControls.Data = DdrCrCmdControls.Data;
+ DdrCrCkeControls.Bits.CtlSRDrv = NS & 2;
+ DdrCrCkeControls.Bits.CtlTxEq = NS & 1; // Enable Weak CKE in SR and Cke DeEmphasis
+ MrcWriteCR (
+ MrcData,
+ DDRCKECH0_CR_DDRCRCTLCONTROLS_REG +
+ ((DDRCKECH1_CR_DDRCRCTLCONTROLS_REG - DDRCKECH0_CR_DDRCRCTLCONTROLS_REG) * Channel),
+ DdrCrCkeControls.Data
+ );
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Init CTL CRs\n");
+ //
+ // Initialize CTL CRs
+ //
+ DdrCrCtlControls.Bits.CtlTxEq = (NS & 1); // Enable Weak CKE in SR and Cke DeEmphasis
+ DdrCrCtlControls.Bits.CtlSRDrv = (NS & 2); // Enable Weak CKE in SR and Cke DeEmphasis
+ DdrCrCtlControls.Bits.LaDrvEnOvrd = 1;
+ MrcWriteCR (
+ MrcData,
+ DDRCTLCH0_CR_DDRCRCTLCONTROLS_REG +
+ ((DDRCTLCH1_CR_DDRCRCTLCONTROLS_REG - DDRCTLCH0_CR_DDRCRCTLCONTROLS_REG) * Channel),
+ DdrCrCtlControls.Data
+ );
+ //
+ // Initialize CRs shared between CKE/CTL/CMD/CLK
+ //
+ // PI setting must match value written for TxDQs above.
+ // There are no shared registers for CLK, only CKE/CTL but only CTLPICODING and CTLCOMPOFFSET
+ // Set CTL/CLK PI to 64, and CMD to 96 (64 + 1/2 QCLK), for ideal initial command centering.
+ //
+ DdrCrCtlPiCoding.Data = 0;
+ DdrCrCtlPiCoding.Bits.CtlPiCode0 =
+ DdrCrCtlPiCoding.Bits.CtlPiCode1 =
+ DdrCrCtlPiCoding.Bits.CtlPiCode2 =
+ DdrCrCtlPiCoding.Bits.CtlPiCode3 = 96;
+
+ Offset = DDRCMDCH0_CR_DDRCRCMDPICODING_REG +
+ ((DDRCMDCH1_CR_DDRCRCMDPICODING_REG - DDRCMDCH0_CR_DDRCRCMDPICODING_REG) * Channel);
+#ifdef ULT_FLAG
+ if (CpuModel == cmHSW_ULT) {
+ //
+ // On ULT we have DdrCrCmdPiCoding.CmdPi0Code and CmdPi1Code
+ //
+ MrcWriteCR (MrcData, Offset, DdrCrCtlPiCoding.Data);
+ }
+#endif // ULT_FLAG
+#ifdef TRAD_FLAG
+ if ((CpuModel == cmHSW) || (CpuModel == cmCRW)) {
+ MrcWriteCR8 (MrcData, Offset, (U8) DdrCrCtlPiCoding.Bits.CtlPiCode0);
+ }
+#endif // TRAD_FLAG
+
+ Offset = DDRCKECH0_CR_DDRCRCMDPICODING_REG +
+ ((DDRCKECH1_CR_DDRCRCMDPICODING_REG - DDRCKECH0_CR_DDRCRCMDPICODING_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, DdrCrCtlPiCoding.Data);
+
+ DdrCrCtlPiCoding.Bits.CtlPiCode0 =
+ DdrCrCtlPiCoding.Bits.CtlPiCode1 =
+ DdrCrCtlPiCoding.Bits.CtlPiCode2 =
+ DdrCrCtlPiCoding.Bits.CtlPiCode3 = 64;
+
+ Offset = DDRCKECTLCH0_CR_DDRCRCTLPICODING_REG +
+ ((DDRCKECTLCH1_CR_DDRCRCTLPICODING_REG - DDRCKECTLCH0_CR_DDRCRCTLPICODING_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, DdrCrCtlPiCoding.Data);
+
+ Offset = DDRCLKCH0_CR_DDRCRCLKPICODE_REG +
+ ((DDRCLKCH1_CR_DDRCRCLKPICODE_REG - DDRCLKCH0_CR_DDRCRCLKPICODE_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, DdrCrCtlPiCoding.Data);
+
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ ChannelOut->ClkPiCode[Rank] = (U8) DdrCrCtlPiCoding.Bits.CtlPiCode0;
+ }
+
+ Offset = DDRCMDCH0_CR_DDRCRCMDCOMPOFFSET_REG +
+ ((DDRCMDCH1_CR_DDRCRCMDCOMPOFFSET_REG - DDRCMDCH0_CR_DDRCRCMDCOMPOFFSET_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, 0x0); // Zero for now. May offset comp in future
+
+ Offset = DDRCKECTLCH0_CR_DDRCRCTLCOMPOFFSET_REG +
+ ((DDRCKECTLCH1_CR_DDRCRCTLCOMPOFFSET_REG - DDRCKECTLCH0_CR_DDRCRCTLCOMPOFFSET_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, 0x0); // Zero for now. May offset comp in future
+
+ Offset = DDRCLKCH0_CR_DDRCRCLKCOMPOFFSET_REG +
+ ((DDRCLKCH1_CR_DDRCRCLKCOMPOFFSET_REG - DDRCLKCH0_CR_DDRCRCLKCOMPOFFSET_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, 0x0); // Zero for now. May offset comp in future
+ }
+ } // End of for Channel...
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Init COMP CRs\n");
+ //
+ // Initialize COMP CRs
+ //
+ // 14:11 DqDrv 19:15 DqOdt 23:20 CmdDrv 27:24 CtlDrv 31:28 ClkDrv
+ //
+ Outputs->CompCtl0 = (DisableOdtStatic << 3); // Disable ODT Static Leg
+
+ if ((Any2dpc) && (Inputs->BoardType == btCRBDT)) {
+ TargetRcomp[1] = 60;
+ }
+
+#ifdef ULT_FLAG
+ if (CpuModel == cmHSW_ULT) {
+ //
+ // RCOMP1 resistor is 120 Ohm on ULT boards
+ // This is used for DQ/CLK Ron (drive strength)
+ //
+ ReferenceR[0] = 40;
+ TargetRcomp[0] = 40;
+
+ ReferenceR[4] = 40;
+ }
+#endif // ULT_FLAG
+
+ for (i = 0; i < 5; i++) {
+ CompVref = (StepSize[i] * (ReferenceR[i] - TargetRcomp[i])) / (2 * (ReferenceR[i] + TargetRcomp[i]));
+ if (i == 1) {
+ //
+ // DqOdt is 5 bits
+ //
+ if (CompVref > 15) {
+ CompVref = 15;
+ } else if (CompVref < -16) {
+ CompVref = -16;
+ }
+
+ Outputs->CompCtl0 |= (CompVref & 0x1F) << (15);
+ } else {
+ if (CompVref > 7) {
+ CompVref = 7;
+ } else if (CompVref < -8) {
+ CompVref = -8;
+ }
+
+ if (i == 0) {
+ Outputs->CompCtl0 |= (CompVref & 0xF) << (11);
+ } else {
+ Outputs->CompCtl0 |= (CompVref & 0xF) << (12 + 4 * i);
+ }
+ }
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "CompVref[%d] = 0x%x\n", i, CompVref);
+ //
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "CompCtl0 = 0x%08X\n", Outputs->CompCtl0);
+ MrcWriteCR (MrcData, DDRCOMP_CR_DDRCRCOMPCTL0_REG, Outputs->CompCtl0);
+
+ CompDdrCrCompCtl1.Data = 0;
+ CompDdrCrCompCtl1.Bits.VccddqHi = VddHi; // Set Vdd, 2 qclk DLL mask
+ CompDdrCrCompCtl1.Bits.CompClkOn = SAFE; // Override PwrDn in Safe Mode
+
+ Cmd2N = FALSE;
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (Outputs->Controller[Controller].Channel[Channel].Timing[Profile].NMode == 2)
+ Cmd2N = TRUE;
+ if (Cmd2N) {
+ break;
+ }
+ }
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ Outputs->Controller[Controller].Channel[Channel].Timing[Profile].NMode = (Cmd2N == TRUE) ? 2 : 1;
+ }
+ }
+
+ //
+ // Calculate how to program the slew rate targets
+ // Buffer Type DQ CMD CTL CLK
+ // Num Stages 3 5 5 3
+ // Slew Rate 4.5 3.0 3.0 5.0
+ // Derating .8 .8 .8 .8
+ //
+
+/*
+ U8 BufferStageDelayPS[4] = {92, 83, 83, 83}; // Slew = 1V(in mv) / (# Stages * StageDelayPS * Derating)
+ U8 MinCycleStageDelay[4] = {46, 70, 70, 46}; // Avoid corner case
+ U8 i;
+ U16 NumStages;
+*/
+ if (Cmd2N == TRUE) {
+ BufferStageDelayPS[1] = 89; // CMD Slew Rate = 1.8 for 2N
+ }
+
+#ifdef ULT_FLAG
+ if (Lpddr) {
+ BufferStageDelayPS[1] = 63; // CMD Slew Rate = 4 V/ns for double-pumped CMD bus
+ }
+#endif // ULT_FLAG
+
+ for (i = 0; i < 4; i++) {
+ //
+ // Calculate DQ, CMD, CTL, CLK
+ // Number of Stages in DLL, rounded to nearest integer
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "BufferStageDelayPS[%d] = %d\n", i, BufferStageDelayPS[i]);
+ //
+ NumStages = (Outputs->Qclkps + BufferStageDelayPS[i] / 2) / BufferStageDelayPS[i];
+ if (NumStages < 5) {
+ NumStages = 5; // Minimum setting > 3
+ }
+ //
+ // Lock DLL ....
+ //
+ Offset = i * (DDRCOMP_CR_DDRCRCOMPCTL1_DqScompCells_WID + DDRCOMP_CR_DDRCRCOMPCTL1_DqScompPC_WID);
+ if ((NumStages > 16) || (BufferStageDelayPS[i] < MinCycleStageDelay[i])) {
+ CompDdrCrCompCtl1.Data += ((NumStages / 2 - 1) << Offset); // ... to a phase
+ } else {
+ CompDdrCrCompCtl1.Data += (16 + NumStages - 1) << Offset; // ... to a cycle
+ }
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Qclkps = %d, NumStages = %d\n",Outputs->Qclkps, NumStages);
+ //
+ }
+
+ MrcWriteCR (MrcData, DDRCOMP_CR_DDRCRCOMPCTL1_REG, CompDdrCrCompCtl1.Data);
+ Outputs->CompCtl1 = CompDdrCrCompCtl1.Data;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "CompCtl1 = 0x%x\n", CompDdrCrCompCtl1.Data);
+
+ //
+ // Calculate Target Values for VssHi Panic Driver
+ //
+ // Rtarget = Tperiod / Cdie / ln( VssHi / (VssHi - Delta) )
+ //
+
+/*
+ U8 delta = 15; // VssHi change voltage during panic: 15mV
+ U16 lndown;
+ U16 Rdown;
+ U16 vrefdown;
+ U16 vsshiu, vsshid;
+ U16 vpanic = 24; // Panic Treshold at 24 mV
+ U16 lnup;
+ U16 Rup;
+ U32 vrefup;
+*/
+ vsshid = VssHi + vpanic;
+ //
+ //MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "vsshid = %d VssHi = %d vpanic = %d \n", vsshid, VssHi, vpanic);
+ // Calculate log to backsolve exp. RC decay
+ // Input should be 100x. Output is 100x
+ //
+ lndown = (U16) MrcNaturalLog ((100 * vsshid) / (vsshid - delta));
+ Rdown = (Outputs->Qclkps * 2000) / (CDIEVSSHI * lndown); // Rdown is 10x.
+ vrefdown = (128 * Rdown) / (Rdown + 10 * RCMDREF); // Multiple RcmdRef by 10x to match Rdown
+ //
+ //MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "vrefdown = %d Rdown = %d lndown = %d \n", vrefdown, Rdown, lndown);
+ //
+ vsshiu = (Inputs->VccIomV - VssHi - vpanic); // if VccIO == 1v then VccmV = 1000
+ lnup = (U16) MrcNaturalLog ((100 * vsshiu) / (vsshiu - delta));
+ Rup = (Outputs->Qclkps * 2000) / (CDIEVSSHI * lnup);
+ vrefup = (128 * 10 * RCMDREF) / (10 * RCMDREF + Rup) - 64;
+ //
+ //MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "vrefup = %d Rup = %d lnup = %d vsshiu = %d\n", vrefup, Rup, lnup, vsshiu);
+ //
+ DdrCrCompVssHi.Data = 0;
+ DdrCrCompVssHi.Bits.VtSlopeA = 4; // Apply slope correction of 1.5 to VtComp
+ DdrCrCompVssHi.Bits.VtOffset = (128 * 450 / Inputs->VccIomV / 2); // Apply offset correction to VtComp
+ DdrCrCompVssHi.Bits.PanicDrvUpVref = vrefup; // Apply Calculated Vref Values
+ DdrCrCompVssHi.Bits.PanicDrvDnVref = vrefdown;
+ MrcWriteCR (MrcData, DDRCOMP_CR_DDRCRCOMPVSSHI_REG, DdrCrCompVssHi.Data);
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "DdrCrCompVssHi = 0x%x\n", DdrCrCompVssHi.Data);
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Init MISC CRs\n");
+ //
+ // Initialize MISC CRs
+ //
+
+ DdrMiscControl.Data = MrcReadCR (MrcData, DDRSCRAM_CR_DDRMISCCONTROL0_REG);
+ DdrMiscControl.Bits.WeakLock_Latency = 12;
+ DdrMiscControl.Bits.WL_SleepCycles = 5;
+ DdrMiscControl.Bits.WL_WakeCycles = 2;
+ Outputs->MiscControl0 = DdrMiscControl.Data;
+ MrcWriteCR (MrcData, DDRSCRAM_CR_DDRMISCCONTROL0_REG, DdrMiscControl.Data);
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ Offset = DDRSCRAM_CR_DDRSCRAMBLECH0_REG +
+ ((DDRSCRAM_CR_DDRSCRAMBLECH1_REG - DDRSCRAM_CR_DDRSCRAMBLECH0_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, 0);// Keep scrambling disabled for training
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Init KEY MC CRs\n");
+ //
+ // Initialize some key MC CRs
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+
+ //
+ // set the valid rank - Either clear or set only populated so no check for vaid channel
+ //
+ Offset = MCHBAR_CH0_CR_MC_INIT_STATE_REG +
+ ((MCHBAR_CH1_CR_MC_INIT_STATE_REG - MCHBAR_CH0_CR_MC_INIT_STATE_REG) * Channel);
+ MrcWriteCR8 (MrcData, Offset, ChannelOut->ValidRankBitMask);
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Update LS COMP CRs\n");
+
+ //
+ // 1st Disable Perioid Comp and wait for 10us
+ // Set periodic comp = (10uS * 2^COMP_INT)
+ //
+ CrMCompPcu.Data = 0;
+ CrMCompPcu.Bits.COMP_DISABLE = 1;
+ CrMCompPcu.Bits.COMP_FORCE = 1;
+ CrMCompPcu.Bits.COMP_INTERVAL = COMP_INT; // Set COMP_INT to happen every 10mS
+ MrcWriteCR (MrcData, PCU_CR_M_COMP_PCU_REG, CrMCompPcu.Data);
+ MrcWait (MrcData, 10 * HPET_1US);
+
+ //
+ // Override LevelShifter Compensation to 0x4 (From Hua, 3 is not a valid value)
+ //
+ DataRCompData.Data = MrcReadCR (MrcData, DDRDATA_CR_RCOMPDATA1_REG);
+ DataRCompData.Bits.LevelShifterComp = 2;
+ MrcWriteCrMulticast (MrcData, DDRDATA_CR_RCOMPDATA1_REG, DataRCompData.Data);
+ CmdDdrCrCmdComp.Data = MrcReadCR (MrcData, DDRCMD_CR_DDRCRCMDCOMP_REG);
+ CmdDdrCrCmdComp.Bits.LsComp = 2;
+ MrcWriteCrMulticast (MrcData, DDRCMD_CR_DDRCRCMDCOMP_REG, CmdDdrCrCmdComp.Data);
+ CkeCtlDdrCrCtlComp.Data = MrcReadCR (MrcData, DDRCKECTL_CR_DDRCRCTLCOMP_REG);
+ CkeCtlDdrCrCtlComp.Bits.LsComp = 2;
+ MrcWriteCrMulticast (MrcData, DDRCKECTL_CR_DDRCRCTLCOMP_REG, CkeCtlDdrCrCtlComp.Data);
+ ClkDdrCrClkComp.Data = MrcReadCR (MrcData, DDRCLK_CR_DDRCRCLKCOMP_REG);
+ ClkDdrCrClkComp.Bits.LsComp = 2;
+ MrcWriteCrMulticast (MrcData, DDRCLK_CR_DDRCRCLKCOMP_REG, ClkDdrCrClkComp.Data);
+ CompDdrCrDataComp.Data = MrcReadCR (MrcData, DDRCOMP_CR_DDRCRDATACOMP1_REG);
+ CompDdrCrDataComp.Bits.LevelShifterComp = 2;
+ MrcWriteCR (MrcData, DDRCOMP_CR_DDRCRDATACOMP1_REG, CompDdrCrDataComp.Data);
+ CompDdrCrCmdComp.Data = MrcReadCR (MrcData, DDRCOMP_CR_DDRCRCMDCOMP_REG);
+ CompDdrCrCmdComp.Bits.LsComp = 2;
+ MrcWriteCR (MrcData, DDRCOMP_CR_DDRCRCMDCOMP_REG, CompDdrCrCmdComp.Data);
+ CompDdrCrCtlComp.Data = MrcReadCR (MrcData, DDRCOMP_CR_DDRCRCTLCOMP_REG);
+ CompDdrCrCtlComp.Bits.LsComp = 2;
+ MrcWriteCR (MrcData, DDRCOMP_CR_DDRCRCTLCOMP_REG, CompDdrCrCtlComp.Data);
+ CompDdrCrClkComp.Data = MrcReadCR (MrcData, DDRCOMP_CR_DDRCRCLKCOMP_REG);
+ CompDdrCrClkComp.Bits.LsComp = 2;
+ MrcWriteCR (MrcData, DDRCOMP_CR_DDRCRCLKCOMP_REG, CompDdrCrClkComp.Data);
+ CompDdrCrCompOvr.Data = MrcReadCR (MrcData, DDRCOMP_CR_DDRCRCOMPOVR_REG);
+ CompDdrCrCompOvr.Bits.LsComp = 2;
+ MrcWriteCR (MrcData, DDRCOMP_CR_DDRCRCOMPOVR_REG, CompDdrCrCompOvr.Data);
+
+ //
+ // Manually update the comp values
+ //
+ DdrMiscControl.Data = Outputs->MiscControl0;
+ DdrMiscControl.Bits.ForceCompUpdate = 1;
+ MrcWriteCR (MrcData, DDRSCRAM_CR_DDRMISCCONTROL0_REG, DdrMiscControl.Data);
+
+ //
+ // Fix Offset between ODT Up/Dn
+ //
+ CompDdrCrDataComp.Data = MrcReadCR (MrcData, DDRCOMP_CR_DDRCRDATACOMP1_REG);
+ CompDdrCrCompCtl0.Data = Outputs->CompCtl0;
+ //
+ // Calculate (OdtDn - OdtUp) - Will be BITS 9:4
+ //
+ CompDdrCrCompCtl0.Bits.DqOdtUpDnOff = CompDdrCrDataComp.Bits.RcompOdtDown - CompDdrCrDataComp.Bits.RcompOdtUp;
+ CompDdrCrCompCtl0.Bits.FixOdtD = 1; // Enable Fixed Offset between OdtUp/Dn - Will be BIT10
+ Outputs->CompCtl0 = CompDdrCrCompCtl0.Data;
+ MrcWriteCR (MrcData, DDRCOMP_CR_DDRCRCOMPCTL0_REG, CompDdrCrCompCtl0.Data);
+
+ //
+ // 2X Refresh
+ //
+ if (
+ (Inputs->RefreshRate2x == TRUE) &&
+ (
+ ((CpuModel == cmHSW) && (CpuStepping >= csHswC0)) ||
+ ((CpuModel == cmCRW) && (CpuStepping >= csCrwC0)) ||
+ ((CpuModel == cmHSW_ULT) && (CpuStepping >= csHswUltC0))
+ )
+ ) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "*** Enabling 2x Refresh ***\n");
+ AutoSelfRefresh = Outputs->AutoSelfRefresh;
+
+ if ((AutoSelfRefresh == FALSE)
+#ifdef ULT_FLAG
+ || (Lpddr == TRUE)
+#endif
+ ){
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Enabling Mailbox 2x Refresh\n");
+ MrcOemEnable2xRefresh (MrcData);
+ }
+
+ //
+ // Percentage reduction of tREFI needed for ASR and LPDDR cases (Mutually Exclusive).
+ //
+ if (AutoSelfRefresh == TRUE) {
+ RefiReduction = 50;
+ }
+#ifdef ULT_FLAG
+ if (Lpddr == TRUE) {
+ DdrPtmCtl.Data = MrcReadCR (MrcData, PCU_CR_DDR_PTM_CTL_PCU_REG);
+ DdrPtmCtl.Bits.DISABLE_DRAM_TS = 0;
+ MrcWriteCR (MrcData, PCU_CR_DDR_PTM_CTL_PCU_REG, DdrPtmCtl.Data);
+ RefiReduction = 97;
+ }
+#endif
+
+ if ((Inputs->BootMode == bmCold) && ((AutoSelfRefresh == TRUE)
+#ifdef ULT_FLAG
+ || (Lpddr == TRUE)
+#endif
+ )) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "%s Detected, Reducing tREFI by %u percent.\n",
+ (AutoSelfRefresh == TRUE) ? "Auto Self Refresh" : "LPDDR",
+ RefiReduction
+ );
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ ChannelOut->Timing[STD_PROFILE].tREFI = (ChannelOut->Timing[STD_PROFILE].tREFI * RefiReduction) / 100;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " C(%d).tREFI = 0x%x\n", Channel, ChannelOut->Timing[STD_PROFILE].tREFI);
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ if (DimmOut->Status == DIMM_PRESENT) {
+ DimmOut->Timing[STD_PROFILE].tREFI = (DimmOut->Timing[STD_PROFILE].tREFI * RefiReduction) / 100;
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ " C(%d).D(%d).tREFI = 0x%x\n",
+ Channel,
+ Dimm,
+ DimmOut->Timing[STD_PROFILE].tREFI
+ );
+ }
+ }
+ }
+ }
+ }
+ }
+
+ //
+ // Set the DDR voltage in PCU
+ //
+ MrcSetPcuDdrVoltage (MrcData, Vdd);
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Timing Config\n");
+ MrcTimingConfiguration (MrcData);
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Refresh Config\n");
+ MrcRefreshConfiguration (MrcData);
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Scheduler parameters\n");
+ MrcSchedulerParametersConfig (MrcData);
+
+ //
+ // this function must be in the end.
+ // if one of the function close channel the function execute this close.
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Address Decoding Config\n");
+ MrcAdConfiguration (MrcData);
+
+ return Status;
+}
+
+/**
+@brief
+ This function init all the necessary registers for the training.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval mrcSuccess
+**/
+MrcStatus
+MrcPreTraining (
+ IN MrcParameters *const MrcData
+ )
+{
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ U32 Offset;
+ U8 Channel;
+ U8 Rank;
+ U8 RankMod2;
+ MCDECS_CR_MAD_DIMM_CH0_MCMAIN_STRUCT CrMadDimmCh;
+ const MrcDebug *Debug;
+
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerOut = &Outputs->Controller[0];
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!MrcChannelExist (Outputs, Channel)) {
+ continue;
+ }
+
+ //
+ // Dump the MR registers for DDR3
+ // LPDDR Jedec Init is done after Early Command Training
+ //
+ if (Outputs->DdrType != MRC_DDR_TYPE_LPDDR3) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if (!(MrcRankInChannelExist (MrcData, Rank, Channel))) {
+ continue;
+ }
+
+ RankMod2 = Rank % 2;
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "MrcSetMR0 Channel %u Rank %u = 0x%X\n",
+ Channel,
+ Rank,
+ ChannelOut->Dimm[RANK_TO_DIMM_NUMBER (Rank)].Rank[RankMod2].MR[mrMR0]
+ );
+
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "MrcSetMR1 Channel %u Rank %u = 0x%X\n",
+ Channel,
+ Rank,
+ ChannelOut->Dimm[RANK_TO_DIMM_NUMBER (Rank)].Rank[RankMod2].MR[mrMR1]
+ );
+
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "MrcSetMR2 Channel %u Rank %u = 0x%X\n",
+ Channel,
+ Rank,
+ ChannelOut->Dimm[RANK_TO_DIMM_NUMBER (Rank)].Rank[RankMod2].MR[mrMR2]
+ );
+
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "MrcSetMR3 Channel %u Rank %u = 0x%X\n",
+ Channel,
+ Rank,
+ ChannelOut->Dimm[RANK_TO_DIMM_NUMBER (Rank)].Rank[RankMod2].MR[mrMR3]
+ );
+ }
+ }
+
+ if (Outputs->EccSupport == TRUE) {
+ Offset = MCDECS_CR_MAD_DIMM_CH0_MCMAIN_REG +
+ ((MCDECS_CR_MAD_DIMM_CH1_MCMAIN_REG - MCDECS_CR_MAD_DIMM_CH0_MCMAIN_REG) * Channel);
+ CrMadDimmCh.Data = MrcReadCR (MrcData, Offset);
+ //
+ // set ECC IO ACTIVE ONLY - NOT IO
+ //
+ CrMadDimmCh.Bits.ECC = emEccIoActive;
+ MrcWriteCR (MrcData, Offset, CrMadDimmCh.Data);
+ //
+ // Wait 4 usec after enabling the ECC IO, needed by HW
+ //
+ MrcWait (MrcData, 4 * HPET_1US);
+ }
+ } // for Channel
+
+ //
+ // Set up Write data Buffer before training steps
+ //
+ SetupWDB (MrcData);
+
+ return mrcSuccess;
+}
+
+/**
+
+@brief
+
+ This function initializes all the necessary registers after main training steps but before LCT.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval mrcSuccess
+
+**/
+MrcStatus
+MrcPostTraining (
+ IN MrcParameters *const MrcData
+ )
+{
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcProfile Profile;
+ U8 Channel;
+
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerOut = &Outputs->Controller[0];
+ Profile = MrcData->SysIn.Inputs.MemoryProfile;
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ //
+ // Update CmdN timing, Round Trip Latency and tXP
+ // OldN=3, NewN=2*Cmd2N
+ //
+ UpdateCmdNTiming (MrcData, Channel, 2 * 2, (ControllerOut->Channel[Channel].Timing[Profile].NMode == 2) ? 2 : 0);
+ }
+ }
+
+ return mrcSuccess;
+}
+
+/**
+@brief
+ Program PCU_CR_DDR_VOLTAGE register.
+
+ @param[in] MrcData - Include all MRC global data.
+ @param[in] VddVoltage - Current DDR voltage.
+
+ @retval none
+**/
+void
+MrcSetPcuDdrVoltage (
+ IN OUT MrcParameters *MrcData,
+ IN MrcVddSelect VddVoltage
+ )
+{
+ MrcInput *Inputs;
+ MrcOutput *Outputs;
+ U8 Data8;
+ PCU_CR_DDR_VOLTAGE_PCU_STRUCT DdrVoltage;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+
+ switch (VddVoltage) {
+ case VDD_1_35:
+ Data8 = 1;
+ break;
+
+ case VDD_1_20:
+ Data8 = 3; // @todo For single CA bus set this to 2
+ break;
+
+ default:
+ Data8 = 0;
+ }
+
+ MRC_DEBUG_MSG (&Inputs->Debug, MSG_LEVEL_NOTE, "PCU_CR_DDR_VOLTAGE = 0x%02X\n", Data8);
+ DdrVoltage.Data = 0;
+ DdrVoltage.Bits.DDR_VOLTAGE = Data8;
+ MrcWriteCR (MrcData, PCU_CR_DDR_VOLTAGE_PCU_REG, DdrVoltage.Data);
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Services/MrcMemoryMap.c b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Services/MrcMemoryMap.c
new file mode 100644
index 0000000..2fd1310
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Services/MrcMemoryMap.c
@@ -0,0 +1,528 @@
+/** @file
+ The functions in this file initializes the physical memory map.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+
+**/
+
+//
+// Include files
+//
+#include "MrcMemoryMap.h"
+#include "PttHciRegs.h"
+
+/**
+@brief
+ After BIOS determines the total physical memory size.
+ Determines TOM which is defined by the total physical memory size.
+ Determines TOM minus the ME memory size. The ME memory size is calculated from MESEG_BASE and MESEG_MASK.
+ Determines MMIO allocation, which is system configuration dependent.
+
+ Determines TOLUD which is the minimum value by comparing between "4GB minus MMIO size" and "TOM minus ME size".
+ Determines Graphics Stolen Base, BDSM by subtracting the graphics data stolen memory size from TOLUD.
+ Graphics Data Stolen Memory size is given by GMS field in GGC register. It must be define before this stage.
+ Determines Graphics GTT Stolen Base, BGSM by subtracting the GTT graphics stolen memory size from BDSM.
+ GTT Stolen Memory size is given by GGMS field in GGC register. It must be define before this stage.
+ Determines TSEG Base, TSEGMB by subtracting TSEG size from BGSM.
+ TSEG should be defined.
+ Remove the memory hole caused by aligning TSEG to a 8MB boundary.
+ Determine whether Memory Reclaim is available. If "TOM minus ME Stolem Memory Size" is greater than the value of TOLUD, then memory reclaim is available to enable.
+ Determine REMAPBASE if reclaim is enabled. This is the maximum value by comparing between 4GB and "TOM minus ME size".
+ Determine REMAPLIMIT () if reclaim is enabled. This is the value of REMAPBASE plus "the difference between the value in TOLUD register and the lower of either 4GB or 'TOM minus ME Stolen memory size", and then minus 1 boundary.
+ Determine TOUUD. TOUUD indicates the address one byte above the maximum DRAM. If relcaim is disabled, this value is calculated by "TOM minus ME stolen size". Otherwise, this value is set to REMAPLIMIT plus 1MB.
+
+ @param[in, out] MrcData - Include all MRC global data. include also the memory map data.
+
+ @retval MrcStatus - if the reset is succeded.
+**/
+MrcStatus
+MrcSetMemoryMap (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ const MrcDebug *Debug;
+ const MrcInput *Inputs;
+ MrcOutput *Outputs;
+ MrcMemoryMap *MemoryMap;
+ MRC_PCI_000_GGC_STRUCT Ggc;
+ U32 Offset;
+ U32 TsegBaseOrg;
+ U32 TsegBaseDelta;
+ U32 GdxcTop;
+ U32 FtpmTop;
+ U32 MmioSize;
+#ifdef PTT_FLAG
+ U32 PttSts;
+#endif
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ MemoryMap = &Outputs->MemoryMapData;
+
+ //
+ // Find the total memory size
+ //
+ MrcTotalMemory (MrcData);
+
+ //
+ // Set TOM register
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "TOM (Total physical memory size) = %u MB\n", MemoryMap->TotalPhysicalMemorySize);
+
+ //
+ // Find the TOM minus ME size only for internal calculations
+ //
+ MemoryMap->TomMinusMe = MemoryMap->TotalPhysicalMemorySize - Inputs->MeStolenSize;
+
+ MmioSize = Inputs->MmioSize;
+ if (Inputs->MemoryTrace) {
+ if (MemoryMap->TotalPhysicalMemorySize <= MEM_4GB) {
+ MmioSize = MAX (MmioSize, MEM_4GB - MemoryMap->TotalPhysicalMemorySize / 2);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Adjusted MmioSize = %Xh\n", MmioSize);
+ }
+ }
+
+ //
+ // Find and set TOLUD.
+ // TOLUD which is the minimum value by comparing between "4GB minus MMIO size" and "TOM minus ME size"
+ //
+ MemoryMap->ToludBase = MIN (MemoryMap->TomMinusMe, MEM_4GB - MmioSize);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "TOLUD base = %Xh\n", MemoryMap->ToludBase);
+
+ //
+ // Find and set BDSM Graphics Stolen Base.
+ // Graphics Stolen Base, BDSM by subtracting the graphics data stolen memory size from TOLUD.
+ //
+ MemoryMap->BdsmBase = MemoryMap->ToludBase - Outputs->GraphicsStolenSize;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "BDSM base = %Xh\n", MemoryMap->BdsmBase);
+
+ //
+ // Graphics GTT Stolen Base
+ // Graphics GTT Stolen Base, BGSM by subtracting the GTT graphics stolen memory size from BDSM.
+ //
+ MemoryMap->GttBase = MemoryMap->BdsmBase - Outputs->GraphicsGttSize;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "GTT base = %Xh\n", MemoryMap->GttBase);
+
+ //
+ // Graphics size register init.
+ //
+ Offset = MrcOemGetPcieDeviceAddress (0, 0, 0, MRC_PCI_000_GGC_REG);
+ MrcOemMmioRead (Offset, &Ggc.Data, Inputs->PciEBaseAddress);
+ Ggc.Bits.Vamen = (Inputs->GfxIsVersatileAcceleration == TRUE) ? 1 : 0;
+ Ggc.Bits.Ggms = MIN (GGC_GGMS_MAX, Outputs->GraphicsGttSize);
+ //
+ // GMS limitation is 5 bits
+ //
+ if (Outputs->GraphicsStolenSize == 1024) {
+ Ggc.Bits.Gms = 17;
+ } else {
+ Ggc.Bits.Gms = MIN (GGC_GMS_MAX, (Outputs->GraphicsStolenSize / 32));
+ }
+
+ MemoryMap->GraphicsControlRegister = Ggc.Data;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "GGC value = %Xh\n", MemoryMap->GraphicsControlRegister);
+
+ //
+ // TSEG Base
+ // TSEGMB by subtracting TSEG size from BGSM.
+ //
+ MemoryMap->TsegBase = MemoryMap->GttBase - Inputs->TsegSize;
+ TsegBaseOrg = MemoryMap->TsegBase;
+
+ //
+ // Dpr size to program DPR register in update MemoryMap
+ //
+ MemoryMap->DprSize = Inputs->DprSize;
+
+ //
+ // SMRR must be aligned at 8MB boundary.
+ // according to this TSEG base need to be also aligned to 8MB boundary.
+ // Round it down to the nearest 8MB boundary.
+ //
+ MemoryMap->TsegBase &= ~(Inputs->TsegSize - 1);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "TSEG base = %Xh\n", MemoryMap->TsegBase);
+
+ //
+ // Remove the hole between top of aligned TSEG and GTT Base:
+ // 1. Calculate Delta = TsegMB - aligned_TsegMB
+ // 2. Walk backwards and adjust BGSM_new = BGSM - DELTA, TOLUD_new = TOLUD - DELTA
+ //
+ TsegBaseDelta = TsegBaseOrg - MemoryMap->TsegBase;
+ if (TsegBaseDelta != 0) {
+ MemoryMap->GttBase = MemoryMap->GttBase - TsegBaseDelta;
+ MemoryMap->BdsmBase = MemoryMap->BdsmBase - TsegBaseDelta;
+ MemoryMap->ToludBase = MemoryMap->ToludBase - TsegBaseDelta;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "GTT base = %Xh\n", MemoryMap->GttBase);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "BDSM base = %Xh\n", MemoryMap->BdsmBase);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "TOLUD base = %Xh\n", MemoryMap->ToludBase);
+ }
+ //
+ // test if Reclaim is available
+ // If "TOM minus ME Stolem Memory Size" is greater than the value of TOLUD, then memory reclaim is available to enable
+ //
+ if (Inputs->RemapEnable && (MemoryMap->TomMinusMe > MemoryMap->ToludBase)) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Reclaim Enable\n");
+ MemoryMap->ReclaimEnable = TRUE;
+ //
+ // Remap Base
+ // This is the maximum value by comparing between 4GB and "TOM minus ME size".
+ //
+ MemoryMap->RemapBase = MAX (MEM_4GB, MemoryMap->TomMinusMe);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Remap Base %Xh\n", MemoryMap->RemapBase);
+ //
+ // Remap Limit
+ // This is the value of REMAPBASE plus "the difference between the value in TOLUD register and the lower of either 4GB or 'TOM minus ME Stolen memory size", and then minus 1MB boundary.
+ //
+ MemoryMap->RemapLimit = MemoryMap->RemapBase + (MIN (MEM_4GB, MemoryMap->TomMinusMe) - MemoryMap->ToludBase);
+
+ MemoryMap->TouudBase = MemoryMap->RemapLimit;
+
+ if (!((Inputs->CpuModel == cmHSW) && (Inputs->CpuStepping == csHswA0))) {
+ MemoryMap->RemapLimit -= 0x1;
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Remap Limit %Xh\n", MemoryMap->RemapLimit);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "TOUUD Base %Xh\n", MemoryMap->TouudBase);
+ } else {
+ MemoryMap->ReclaimEnable = FALSE;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Reclaim disable \n");
+ //
+ // TOUUD Base
+ // If relcaim is disabled, this value is calculated by "TOM minus ME stolen size".
+ //
+ MemoryMap->TouudBase = MemoryMap->TomMinusMe;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "TOUUD Base %Xh\n", MemoryMap->TouudBase);
+ }
+ //
+ // GDXC must be aligned to 8MB boundary. But PSMI must be 16MB alligned
+ // GdxcBase by subtracting Gdxc from BGSM.
+ // @todo: GDXC is below DPRBASE if TXT is enabled, which is below TSEG. Maybe it will be required to be placed anywhere below TOLUD.
+ //
+ if (Outputs->Gdxc.GdxcEnable) {
+ if (Inputs->MemoryTrace) {
+ //
+ // Put GDXC at the top of the second channel
+ //
+ if (MemoryMap->TotalPhysicalMemorySize <= MEM_4GB) {
+ GdxcTop = MemoryMap->TouudBase;
+ } else {
+ GdxcTop = MemoryMap->TomMinusMe;
+ }
+ } else {
+ //
+ // Put GDXC below DPR stolen region.
+ //
+ GdxcTop = MemoryMap->TsegBase - Inputs->DprSize;
+ }
+ //
+ // @todo For C-step we can remove the "minus 1MB" W/A
+ //
+ MemoryMap->GdxcMotSize = Outputs->Gdxc.GdxcMotSize << (23 - 20); // In MB
+ MemoryMap->GdxcMotBase = GdxcTop - MemoryMap->GdxcMotSize - 1; // Minus 1 MB - WA for MOT overflow.
+ MemoryMap->GdxcMotBase &= ~(MRC_BIT4 - 1); // Round down to 16MB boundary
+
+ MemoryMap->GdxcIotSize = Outputs->Gdxc.GdxcIotSize << (23 - 20); // In MB
+ MemoryMap->GdxcIotBase = MemoryMap->GdxcMotBase - MemoryMap->GdxcIotSize;
+ MemoryMap->GdxcIotBase -= 16; // 16MB for PSMI
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "GDXC MOT base %Xh, size %d (%Xh) MB\n",
+ MemoryMap->GdxcMotBase,
+ MemoryMap->GdxcMotSize,
+ MemoryMap->GdxcMotSize
+ );
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "GDXC IOT base %Xh, size %d (%Xh) MB\n",
+ MemoryMap->GdxcIotBase,
+ MemoryMap->GdxcIotSize,
+ MemoryMap->GdxcIotSize
+ );
+ if (Inputs->MemoryTrace) {
+ //
+ // Put fTPM below DPR
+ //
+ FtpmTop = MemoryMap->TsegBase - Inputs->DprSize;
+ } else {
+ //
+ // Put fTPM below GDXC.
+ //
+ FtpmTop = MemoryMap->GdxcIotBase;
+ }
+ } else {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "GDXC DISABLED\n");
+ FtpmTop = MemoryMap->TsegBase - Inputs->DprSize;
+ }
+
+#ifdef PTT_FLAG
+ if (Inputs->CpuModel == cmHSW_ULT) {
+ MrcOemMmioRead (R_PTT_HCI_STS, (U32 *) &PttSts, R_PTT_HCI_BASE_ADDRESS);
+ if ((PttSts & B_PTT_HCI_STS_ENABLED) == B_PTT_HCI_STS_ENABLED) {
+ //
+ // fTPM Stolen size is 4KB
+ //
+ MemoryMap->FtpmStolenBase = (FtpmTop << 20) - 0x1000;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Ftpm Stolen base = %Xh\n", MemoryMap->FtpmStolenBase);
+ }
+ }
+#endif // PTT_FLAG
+
+ MemoryMap->MeStolenBase = MemoryMap->TomMinusMe;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "ME stolen base %Xh\n", MemoryMap->MeStolenBase);
+
+ MemoryMap->MeStolenSize = Inputs->MeStolenSize;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "ME stolen size %Xh\n", MemoryMap->MeStolenSize);
+
+ UpdateMemoryMapRegisters (Inputs->PciEBaseAddress, Inputs->GdxcBaseAddress, MemoryMap);
+ return mrcSuccess;
+}
+
+/**
+@brief
+ This function find the total memory in the system.
+ and write it to TotalPhysicalMemorySize in MrcData structure.
+
+ @param[in, out] MrcData - Include all MRC global data.
+
+ @retval Nothing
+**/
+void
+MrcTotalMemory (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ MrcDimmOut *DimmOut;
+ U8 Controller;
+ U8 Channel;
+ U8 Dimm;
+
+ Outputs = &MrcData->SysOut.Outputs;
+ Outputs->MemoryMapData.TotalPhysicalMemorySize = 0;
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ ChannelOut->Capacity = 0;
+ if (MrcChannelExist (Outputs, Channel)) {
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ if (DimmOut->Status == DIMM_PRESENT) {
+ ChannelOut->Capacity += DimmOut->DimmCapacity;
+ }
+ }
+
+ ChannelOut->Capacity = MIN (ChannelOut->Capacity, Outputs->MrcTotalChannelLimit);
+ Outputs->MemoryMapData.TotalPhysicalMemorySize += ChannelOut->Capacity;
+ }
+ }
+ }
+
+ return;
+}
+
+/**
+@brief
+ this function write to the memory init registers.
+
+ @param[in] PciEBaseAddress - Address of the PCI Express BAR
+ @param[in] GdxcBaseAddress - Address of the GDXC BAR
+ @param[in] MemoryMap - Include all the memory map definitions
+
+ @retval Nothing
+**/
+void
+UpdateMemoryMapRegisters (
+ IN const U32 PciEBaseAddress,
+ IN const U32 GdxcBaseAddress,
+ IN const MrcMemoryMap *const MemoryMap
+ )
+{
+ MRC_PCI_000_TOM_STRUCT Tom;
+ MRC_PCI_000_TOLUD_STRUCT Tolud;
+ MRC_PCI_000_TOUUD_STRUCT Touud;
+ MRC_PCI_000_REMAPBASE_STRUCT RemapBase;
+ MRC_PCI_000_REMAPLIMIT_STRUCT RemapLimit;
+ MRC_PCI_000_TSEGMB_STRUCT Tsegmb;
+ MRC_PCI_000_BDSM_STRUCT Bdsm;
+ MRC_PCI_000_BGSM_STRUCT Bgsm;
+ MRC_PCI_000_MESEG_BASE_STRUCT MeSegBase;
+ MRC_PCI_000_MESEG_MASK_STRUCT MeSegMask;
+ MRC_PCI_000_DPR_STRUCT Dpr;
+ U32 Offset;
+
+ //
+ // Write TOM register
+ //
+ Tom.Data = 0;
+ Tom.Data32.Low.Bits.Value = MemoryMap->TotalPhysicalMemorySize;
+ Tom.Data32.High.Bits.Value = MemoryMap->TotalPhysicalMemorySize >> (32 - TOM_TOM_OFF);
+ Offset = MrcOemGetPcieDeviceAddress (0, 0, 0, MRC_PCI_000_TOM_REG);
+ MrcOemMmioWrite (Offset, Tom.Data32.Low.Data, PciEBaseAddress);
+ MrcOemMmioWrite (Offset + 4, Tom.Data32.High.Data, PciEBaseAddress);
+
+ //
+ // Write TOLUD register
+ //
+ Tolud.Data = 0;
+ Tolud.Bits.Value = MemoryMap->ToludBase;
+ Offset = MrcOemGetPcieDeviceAddress (0, 0, 0, MRC_PCI_000_TOLUD_REG);
+ MrcOemMmioWrite (Offset, Tolud.Data, PciEBaseAddress);
+
+ //
+ // Write TOUUD register
+ //
+ Touud.Data = 0;
+ Touud.Data32.Low.Bits.Value = MemoryMap->TouudBase;
+ Touud.Data32.High.Bits.Value = MemoryMap->TouudBase >> (32 - TOUUD_TOUUD_OFF);
+ Offset = MrcOemGetPcieDeviceAddress (0, 0, 0, MRC_PCI_000_TOUUD_REG);
+ MrcOemMmioWrite (Offset, Touud.Data32.Low.Data, PciEBaseAddress);
+ MrcOemMmioWrite (Offset + 4, Touud.Data32.High.Data, PciEBaseAddress);
+
+ if (MemoryMap->ReclaimEnable) {
+ //
+ // Write REMAPBASE register.
+ //
+ RemapBase.Data = 0;
+ RemapBase.Data32.Low.Bits.Value = MemoryMap->RemapBase;
+ RemapBase.Data32.High.Bits.Value = MemoryMap->RemapBase >> (32 - REMAPBASE_REMAPBASE_OFF);
+ Offset = MrcOemGetPcieDeviceAddress (0, 0, 0, MRC_PCI_000_REMAPBASE_REG);
+ MrcOemMmioWrite (Offset, RemapBase.Data32.Low.Data, PciEBaseAddress);
+ MrcOemMmioWrite (Offset + 4, RemapBase.Data32.High.Data, PciEBaseAddress);
+
+ //
+ // Write REMAPLIMIT register.
+ //
+ RemapLimit.Data = 0;
+ RemapLimit.Data32.Low.Bits.Value = MemoryMap->RemapLimit;
+ RemapLimit.Data32.High.Bits.Value = MemoryMap->RemapLimit >> (32 - REMAPLIMIT_REMAPLMT_OFF);
+ Offset = MrcOemGetPcieDeviceAddress (0, 0, 0, MRC_PCI_000_REMAPLIMIT_REG);
+ MrcOemMmioWrite (Offset, RemapLimit.Data32.Low.Data, PciEBaseAddress);
+ MrcOemMmioWrite (Offset + 4, RemapLimit.Data32.High.Data, PciEBaseAddress);
+ }
+ //
+ // Write TSEGMB register
+ //
+ Offset = MrcOemGetPcieDeviceAddress (0, 0, 0, MRC_PCI_000_TSEGMB_REG);
+ Tsegmb.Data = 0;
+ Tsegmb.Bits.Value = MemoryMap->TsegBase;
+ MrcOemMmioWrite (Offset, Tsegmb.Data, PciEBaseAddress);
+
+ //
+ // Program DPR Register with DPR size & DMA Protection Enabled
+ //
+ if(MemoryMap->DprSize != 0){
+ Offset = MrcOemGetPcieDeviceAddress (0, 0, 0, MRC_PCI_000_DPR_REG);
+ MrcOemMmioRead (Offset, &Dpr.Data, PciEBaseAddress);
+ Dpr.Bits.Dprsize = MemoryMap->DprSize;
+ Dpr.Bits.Epm = 1;
+ MrcOemMmioWrite (Offset, Dpr.Data, PciEBaseAddress);
+ }
+ //
+ // Write BDSM register
+ //
+ Offset = MrcOemGetPcieDeviceAddress (0, 0, 0, MRC_PCI_000_BDSM_REG);
+ Bdsm.Data = 0;
+ Bdsm.Bits.Value = MemoryMap->BdsmBase;
+ MrcOemMmioWrite (Offset, Bdsm.Data, PciEBaseAddress);
+
+ //
+ // Write BGSM register
+ //
+ Offset = MrcOemGetPcieDeviceAddress (0, 0, 0, MRC_PCI_000_BGSM_REG);
+ Bgsm.Data = 0;
+ Bgsm.Bits.Value = MemoryMap->GttBase;
+ MrcOemMmioWrite (Offset, Bgsm.Data, PciEBaseAddress);
+
+ //
+ // Enable ME Stolen Memory if the size is not zero
+ //
+ if (MemoryMap->MeStolenSize != 0) {
+ //
+ // Write MESEG_MASK register. Must be written before MESEG_BASE.
+ //
+ MeSegMask.Data = 0;
+ MeSegMask.Data32.Low.Bits.Enable = 1;
+ Offset = 0x80000 - MemoryMap->MeStolenSize;
+ MeSegMask.Data32.Low.Bits.Value = Offset;
+ MeSegMask.Data32.High.Bits.Value = Offset >> (32 - MESEG_MASK_MEMASK_OFF);
+ Offset = MrcOemGetPcieDeviceAddress (0, 0, 0, MRC_PCI_000_MESEG_MASK_REG);
+ MrcOemMmioWrite (Offset, MeSegMask.Data32.Low.Data, PciEBaseAddress);
+ MrcOemMmioWrite (Offset + 4, MeSegMask.Data32.High.Data, PciEBaseAddress);
+
+ //
+ // Write MESEG_BASE register
+ //
+ MeSegBase.Data = 0;
+ MeSegBase.Data32.Low.Bits.Value = MemoryMap->MeStolenBase;
+ MeSegBase.Data32.High.Bits.Value = MemoryMap->MeStolenBase >> (32 - MESEG_BASE_MEBASE_OFF);
+ Offset = MrcOemGetPcieDeviceAddress (0, 0, 0, MRC_PCI_000_MESEG_BASE_REG);
+ MrcOemMmioWrite (Offset, MeSegBase.Data32.Low.Data, PciEBaseAddress);
+ MrcOemMmioWrite (Offset + 4, MeSegBase.Data32.High.Data, PciEBaseAddress);
+ }
+ //
+ // Write graphics control register
+ //
+ Offset = MrcOemGetPcieDeviceAddress (0, 0, 0, MRC_PCI_000_GGC_REG);
+ MrcOemMmioWrite (Offset, MemoryMap->GraphicsControlRegister, PciEBaseAddress);
+
+ //
+ // Program GDXC Registers
+ // 1st MOT: 0x10, 0x14 and 0x18 (Address Low, Address High and Region)
+ // 2nd IOT: 0x20, 0x24 and 0x28 (Address Low, Address High and Region)
+ //
+ MrcOemMmioWrite (
+ MPCOHTRK_CR_GDXC_MOT_ADDRESS_LO_REG,
+ MemoryMap->GdxcMotBase << 14, // (GdxcMotBase << 20) >> 6, Current Pointer in cache line units
+ GdxcBaseAddress
+ );
+ MrcOemMmioWrite (
+ MPCOHTRK_CR_GDXC_MOT_ADDRESS_HI_REG,
+ (MemoryMap->GdxcMotBase & MRC_BIT18) >> 18, // Bit [18] will be bit [32], so it goes to MOT_ADDRESS_HI.MEM_PTR
+ GdxcBaseAddress
+ );
+ MrcOemMmioWrite (
+ MPCOHTRK_CR_GDXC_MOT_REGION_REG,
+ MemoryMap->GdxcMotBase >> 3 | // (GdxcMotBase << 20) >> 23, MOT_REGION.START_ADDRESS is bits [38:23]
+ (((MemoryMap->GdxcMotBase + MemoryMap->GdxcMotSize) >> 3) << 16),
+ GdxcBaseAddress
+ );
+
+ MrcOemMmioWrite (
+ MPCOHTRK_CR_GDXC_OCLA_ADDRESS_LO_REG,
+ MemoryMap->GdxcIotBase << 14, // (GdxcIotBase << 20) >> 6, Current Pointer in cache line units
+ GdxcBaseAddress
+ );
+ MrcOemMmioWrite (
+ MPCOHTRK_CR_GDXC_OCLA_ADDRESS_HI_REG,
+ MPCOHTRK_CR_GDXC_OCLA_ADDRESS_HI_LOCK_MSK | (MemoryMap->GdxcIotBase & MRC_BIT18) >> 18, // Bit [18] will be bit [32], goes to IOT_ADDRESS_HI.MEM_PTR
+ GdxcBaseAddress
+ );
+ MrcOemMmioWrite (
+ MPCOHTRK_CR_GDXC_OCLA_REGION_REG,
+ MemoryMap->GdxcIotBase >> 3 | // (GdxcIotBase << 20) >> 23, OCLA_REGION.START_ADDRESS is bits [38:23]
+ (((MemoryMap->GdxcIotBase + MemoryMap->GdxcIotSize) >> 3) << 16),
+ GdxcBaseAddress
+ );
+ return;
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Services/MrcReset.c b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Services/MrcReset.c
new file mode 100644
index 0000000..b51b6f3
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/Services/MrcReset.c
@@ -0,0 +1,629 @@
+/** @file
+ The functions in this file implement the DDR3 reset sequence.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+
+**/
+
+//
+// Include files
+//
+#include "MrcReset.h"
+
+/**
+@brief
+ Perform full JEDEC reset and init sequence.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - mrcSuccess or reason for failure.
+**/
+MrcStatus
+MrcResetSequence (
+ IN MrcParameters *const MrcData
+ )
+{
+ MrcStatus Status;
+ MrcOutput *Outputs;
+#ifdef ULT_FLAG
+ BOOL Lpddr;
+#endif //ULT_FLAG
+
+ Outputs = &MrcData->SysOut.Outputs;
+
+ //
+ // Start with an IO reset
+ //
+ Status = IoReset (MrcData);
+ if (mrcSuccess == Status) {
+ //
+ // Check if rcomp is done and the ddr ready to use
+ //
+ Status = CheckFirstRcompDone (MrcData);
+ if (mrcSuccess == Status) {
+ //
+ // Perform jedec reset.
+ //
+ // If RTT_NOM is to be enabled in MR1, the ODT input signal must be statically held LOW
+ // in our system RTT_NOM is always enable.
+ // Force ODT low
+ //
+ MrcWriteCR (MrcData, MCSCHEDS_CR_REUT_CH_MISC_ODT_CTRL_REG, MCSCHEDS_CR_REUT_CH_MISC_ODT_CTRL_ODT_Override_MAX);
+
+#ifdef ULT_FLAG
+ //
+ // Check if LPDDR3 memory is used
+ //
+ Lpddr = (MrcData->SysOut.Outputs.DdrType == MRC_DDR_TYPE_LPDDR3);
+
+ if (Lpddr) {
+ Status = MrcJedecResetLpddr3 (MrcData);
+ //
+ // The rest of JEDEC init will be done in a separate step after Early Command Training,
+ // and ECT will set the LpddrEctDone flag.
+ //
+ if (Outputs->LpddrEctDone) {
+ Status = MrcJedecInitLpddr3 (MrcData);
+ }
+ return Status;
+ }
+#endif // ULT_FLAG
+ MrcJedecReset (MrcData);
+
+ //
+ // Initialize the DIMM MRS registers.
+ //
+ //
+ // Step 6 - Set the MR2 for each rank
+ //
+ Status = MrcSetMR2 (MrcData, 0);
+ if (Status == mrcSuccess) {
+ //
+ // Step 7 - Set the MR3 for each rank
+ //
+ Status = MrcSetMR3 (MrcData, 0, 0);
+ if (Status == mrcSuccess) {
+ //
+ // Step 8 - Set the MR1 for each rank
+ //
+ Status = MrcSetMR1 (MrcData, 0, DIMMRON, 0, 0, 0, 0);
+ if (Status == mrcSuccess) {
+ //
+ // Step 9 - Set the MR0 for each rank
+ //
+ Status = MrcSetMR0 (MrcData, 0, 0, 0, 1);
+ if (Status == mrcSuccess) {
+ //
+ // Step 10 - Issue ZQCL command to start ZQ calibration
+ //
+ Status = MrcIssueZQ (MrcData, 0x3, MRC_ZQ_INIT);
+ if (Status == mrcSuccess) {
+ //
+ // If RTT_NOM is to be enabled in MR1, the ODT input signal must be statically held LOW
+ // in our system RTT_NOM is always enable.
+ // Force ODT low
+ //
+ MrcWriteCR (MrcData, MCSCHEDS_CR_REUT_CH_MISC_ODT_CTRL_REG, 0);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ //
+ // Set flag to restore from host structure instead from look-up table
+ //
+ Outputs->RestoreMRs = TRUE;
+
+ return Status;
+}
+
+/**
+@brief
+ Perform JEDEC DIMM reset sequence.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval - none
+**/
+void
+MrcJedecReset (
+ IN MrcParameters *const MrcData
+ )
+{
+ MrcInput *Inputs;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ U32 Offset;
+ U32 VddSettleWaitTime;
+ U8 Channel;
+ MCDECS_CR_MC_INIT_STATE_G_MCMAIN_STRUCT McInitStateG;
+#ifdef ULT_FLAG
+ U32 Rcba;
+ U32 PmCfg2;
+#endif // ULT_FLAG
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerOut = &Outputs->Controller[0];
+ VddSettleWaitTime = 200; // 200us is the minimum w/o the delay needed to allow for DDR3L Change
+
+#ifdef ULT_FLAG
+ //
+ // Get the PCH RCBA from 0:1F:0:F0, and clear the Enable bit
+ //
+ Offset = MrcOemGetPcieDeviceAddress (0, 0x1F, 0, 0xF0);
+ MrcOemMmioRead (Offset, &Rcba, Inputs->PciEBaseAddress);
+ Rcba &= (~1);
+
+ if (Inputs->CpuModel == cmHSW_ULT) {
+ //
+ // Deassert DRAM RESET# via PCH regsiter on ULT
+ //
+ MrcOemMmioRead (R_PCH_RCRB_PM_CFG2, &PmCfg2, Rcba);
+ PmCfg2 |= B_PCH_RCRB_PM_CFG2_DRAM_RESET_CTL;
+ MrcOemMmioWrite (R_PCH_RCRB_PM_CFG2, PmCfg2, Rcba);
+ }
+#endif // ULT_FLAG
+
+ McInitStateG.Data = 0;
+ McInitStateG.Bits.pu_mrc_done = MCDECS_CR_MC_INIT_STATE_G_MCMAIN_pu_mrc_done_DEF;
+ McInitStateG.Bits.ddr_reset = MCDECS_CR_MC_INIT_STATE_G_MCMAIN_ddr_reset_DEF;
+ McInitStateG.Bits.refresh_enable = MCDECS_CR_MC_INIT_STATE_G_MCMAIN_refresh_enable_DEF;
+ McInitStateG.Bits.mc_init_done_ack = MCDECS_CR_MC_INIT_STATE_G_MCMAIN_mc_init_done_ack_DEF;
+ McInitStateG.Bits.mrc_done = MCDECS_CR_MC_INIT_STATE_G_MCMAIN_mrc_done_DEF;
+ McInitStateG.Bits.safe_sr = MCDECS_CR_MC_INIT_STATE_G_MCMAIN_safe_sr_DEF;
+ McInitStateG.Bits.HVM_Gate_DDR_Reset = MCDECS_CR_MC_INIT_STATE_G_MCMAIN_HVM_Gate_DDR_Reset_DEF;
+ McInitStateG.Bits.dclk_enable = MCDECS_CR_MC_INIT_STATE_G_MCMAIN_dclk_enable_DEF;
+ McInitStateG.Bits.reset_io = MCDECS_CR_MC_INIT_STATE_G_MCMAIN_reset_io_DEF;
+
+ MrcWriteCR (MrcData, MCDECS_CR_MC_INIT_STATE_G_MCMAIN_REG, McInitStateG.Data);
+
+ //
+ // Force CKE low
+ //
+ MrcWriteCR (MrcData, MCSCHEDS_CR_REUT_CH_MISC_CKE_CTRL_REG, MCSCHEDS_CR_REUT_CH_MISC_CKE_CTRL_CKE_Override_MAX);
+
+ //
+ // Assert DIMM reset signal - step 1
+ //
+#ifdef ULT_FLAG
+ if (Inputs->CpuModel == cmHSW_ULT) {
+ PmCfg2 &= ~(B_PCH_RCRB_PM_CFG2_DRAM_RESET_CTL);
+ MrcOemMmioWrite (R_PCH_RCRB_PM_CFG2, PmCfg2, Rcba);
+ } else
+#endif // ULT_FLAG
+ {
+ McInitStateG.Data = MrcReadCR (MrcData, MCDECS_CR_MC_INIT_STATE_G_MCMAIN_REG); // Read 'MC_Init_State_G' register.
+ McInitStateG.Bits.ddr_reset = 0;
+ MrcWriteCR (MrcData, MCDECS_CR_MC_INIT_STATE_G_MCMAIN_REG, McInitStateG.Data); // Assert DIMM reset
+ }
+
+ //
+ // Check and Switch DDR3 voltage
+ //
+ if ((Outputs->VddVoltage[Inputs->MemoryProfile] != VDD_INVALID) && (Outputs->VddVoltageDone == FALSE)) {
+ MrcOemVDDVoltageCheckAndSwitch (MrcData, Outputs->VddVoltage[Inputs->MemoryProfile], &VddSettleWaitTime);
+ }
+ //
+ // delay 200 micro sec as jedec ask
+ //
+ MrcWait (MrcData, VddSettleWaitTime * HPET_1US);
+
+ //
+ // De-asserted DIMM reset signal - step 2
+ //
+#ifdef ULT_FLAG
+ if (Inputs->CpuModel == cmHSW_ULT) {
+ PmCfg2 |= B_PCH_RCRB_PM_CFG2_DRAM_RESET_CTL;
+ MrcOemMmioWrite (R_PCH_RCRB_PM_CFG2, PmCfg2, Rcba);
+ } else
+#endif // ULT_FLAG
+ {
+ McInitStateG.Bits.ddr_reset = 1;
+ MrcWriteCR (MrcData, MCDECS_CR_MC_INIT_STATE_G_MCMAIN_REG, McInitStateG.Data); // De-assert DIMM reset
+ }
+
+ //
+ // delay 500 micro sec as jedec ask
+ //
+ MrcWait (MrcData, 500 * HPET_1US);
+
+ //
+ // Enable the DCLK - step 3
+ //
+ McInitStateG.Bits.dclk_enable = 1;
+ MrcWriteCR (MrcData, MCDECS_CR_MC_INIT_STATE_G_MCMAIN_REG, McInitStateG.Data);
+
+ //
+ // wait the 20 nano sec tCKSRX .
+ //
+ MrcWait (MrcData, 1 * HPET_MIN); // Minimum is 69.84 ns
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+
+ //
+ // Set the Valid CKE - step 4
+ //
+ Offset = 2 + MCHBAR_CH0_CR_REUT_CH_MISC_CKE_CTRL_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_MISC_CKE_CTRL_REG - MCHBAR_CH0_CR_REUT_CH_MISC_CKE_CTRL_REG) * Channel);
+ MrcWriteCR8 (MrcData, Offset, ControllerOut->Channel[Channel].ValidRankBitMask);
+ }
+ }
+ //
+ // wait minimum of Reset CKE Exit time, tXPR - Step 5
+ //
+ // Spec says max (tXS, 5 tCK). 5 tCK is 10 nsec and minimum using HPET is 69.64ns
+ //
+ MrcWait (MrcData, 1 * HPET_MIN); // Minimum is 69.84 ns
+
+ return;
+}
+
+#ifdef ULT_FLAG
+/**
+@brief
+ Perform JEDEC LPDDR3 DIMM reset sequence.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval mrcSuccess if succeeded
+**/
+MrcStatus
+MrcJedecResetLpddr3 (
+ IN MrcParameters *const MrcData
+ )
+{
+ MrcStatus Status;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ U32 Offset;
+ U8 Channel;
+ U8 Rank;
+ MCDECS_CR_MC_INIT_STATE_G_MCMAIN_STRUCT McInitStateG;
+
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerOut = &Outputs->Controller[0];
+
+ //
+ // Force CKE low
+ //
+ MrcWriteCR (MrcData, MCSCHEDS_CR_REUT_CH_MISC_CKE_CTRL_REG, MCSCHEDS_CR_REUT_CH_MISC_CKE_CTRL_CKE_Override_MAX);
+
+ //
+ // Wait till voltages are stable
+ //
+ // @todo
+ // if ((Outputs->VddVoltage[Inputs->MemoryProfile] != VDD_INVALID) && (Outputs->VddVoltageDone == FALSE)) {
+ // MrcOemVDDVoltageCheckAndSwitch (MrcData, Outputs->VddVoltage[Inputs->MemoryProfile], VddSettleWaitTime);
+ // }
+ //
+ // Enable the DCLK
+ //
+ McInitStateG.Data = MrcReadCR (MrcData, MCDECS_CR_MC_INIT_STATE_G_MCMAIN_REG);
+ McInitStateG.Bits.dclk_enable = 1;
+ MrcWriteCR (MrcData, MCDECS_CR_MC_INIT_STATE_G_MCMAIN_REG, McInitStateG.Data);
+
+ //
+ // Wait 20ns before CKE goes high
+ //
+ MrcWait (MrcData, 1 * HPET_MIN); // Minimum is 69.84 ns
+
+ //
+ // Force CKE high on populated ranks
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+
+ //
+ // Set the Valid CKE
+ //
+ Offset = 2 + MCHBAR_CH0_CR_REUT_CH_MISC_CKE_CTRL_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_MISC_CKE_CTRL_REG - MCHBAR_CH0_CR_REUT_CH_MISC_CKE_CTRL_REG) * Channel);
+ MrcWriteCR8 (MrcData, Offset, ControllerOut->Channel[Channel].ValidCkeBitMask);
+ }
+ }
+ //
+ // Delay 200 micro sec per JEDEC requirement
+ // tINIT3 - minimum idle time after first CKE assertion
+ //
+ MrcWait (MrcData, 200 * HPET_1US);
+
+ //
+ // Send the RESET MRW command to populated ranks
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if (MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ if (Outputs->LpddrEctDone) {
+ //
+ // Issue a PRECHARGE ALL command to put all banks to idle state.
+ // MRW can only be issued when all banks are idle.
+ //
+ MrcIssuePrechargeAll (MrcData, Channel, 1 << Rank);
+ MrcWait (MrcData, 1 * HPET_1US);
+ }
+
+ Status = MrcIssueMrw (
+ MrcData,
+ Channel,
+ Rank,
+ 0x3F, // Address = 63
+ 0xFC, // Data is selected so that High and Low phases of CA[9:0] are equal
+ TRUE, // InitMrw
+ TRUE // ChipSelect2N
+ );
+ if (Status != mrcSuccess) {
+ return Status;
+ }
+ }
+ }
+ }
+ }
+ //
+ // tINIT5 - Maximum duration of device auto initialization = 10 us
+ //
+ MrcWait (MrcData, 10 * HPET_1US);
+
+ return mrcSuccess;
+}
+
+typedef struct _MRC_LPDDR_MR_DATA {
+ U8 Address;
+ U8 Data;
+} MRC_LPDDR_MR_DATA;
+
+/**
+@brief
+ Perform JEDEC LPDDR3 DIMM init sequence.
+ 1. ZQ Calibration
+ 2. Program MR2, MR1, MR3, MR11
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval mrcSuccess if succeeded
+**/
+MrcStatus
+MrcJedecInitLpddr3 (
+ IN MrcParameters *const MrcData
+ )
+{
+ MrcStatus Status;
+ MrcInput *Inputs;
+ MrcOutput *Outputs;
+ MrcDebug *Debug;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ U8 Channel;
+ U8 Rank;
+ U32 MrIndex;
+ U8 MrData;
+ U32 Index;
+ MRC_LPDDR_MR_DATA MrTable[] = {
+ { 2, 0x40 }, // MR2: nWRE = 1, RL & WL depend on frequency
+ { 1, 0x43 }, // MR1: BL = BL8, nWR = 12
+ { 3, 0x01 }, // MR3: DS = 34.3 Ohm
+ { 11, 0x00 } // MR11: ODT
+ };
+
+ Outputs = &MrcData->SysOut.Outputs;
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ ControllerOut = &Outputs->Controller[0];
+
+ //
+ // Issue ZQ Init calibration on all channels / ranks
+ //
+ Status = MrcIssueZQ (MrcData, 0x3, MRC_ZQ_INIT);
+ if (Status != mrcSuccess) {
+ return Status;
+ }
+
+ if (Outputs->Frequency <= f800) {
+ MrData = 0x14;
+ } else if (Outputs->Frequency <= f1067) {
+ MrData = 0x16;
+ } else if (Outputs->Frequency <= f1200) {
+ MrData = 0x17;
+ } else if (Outputs->Frequency <= f1333) {
+ MrData = 0x18;
+ } else if (Outputs->Frequency <= f1600) {
+ MrData = 0x1A;
+ } else {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "MrcJedecInitLpddr3: Invalid LPDDR frequency!\n");
+ return mrcFrequencyError;
+ }
+
+ MrTable[0].Data = MrData; // MR2
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!MrcChannelExist (Outputs, Channel)) {
+ continue;
+ }
+
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if (MrcRankInChannelExist (MrcData, Rank, Channel) == 0) {
+ continue;
+ }
+
+ if ((Rank == 0) && Inputs->LpddrDramOdt) {
+ //
+ // Enable PD Control on Rank 0 only if we have 2 ranks and ODT is used
+ //
+ if (MrcRankInChannelExist (MrcData, 1, Channel)) {
+ MrTable[3].Data = 0x06; // MR11, ODT Enabled, PD Control = 1
+ } else {
+ MrTable[3].Data = 0x02; // MR11, ODT Enabled, PD Control = 0
+ }
+ } else {
+ MrTable[3].Data = 0; // MR11, ODT Disabled
+ }
+
+ //
+ // Send out all the MR commands from the table
+ //
+ for (Index = 0; Index < sizeof (MrTable) / sizeof (MrTable[0]); ++Index) {
+ MrIndex = MrTable[Index].Address;
+
+ if (Outputs->RestoreMRs) {
+ if (MrIndex < MAX_MR_IN_DIMM) {
+ MrData = (U8) ChannelOut->Dimm[0].Rank[Rank % 2].MR[MrIndex];
+ } else {
+ MrData = (U8) ChannelOut->Dimm[0].Rank[Rank % 2].MR11;
+ }
+ } else {
+ //
+ // Save the MR value in the global struct
+ //
+ MrData = MrTable[Index].Data;
+
+ if (MrIndex < MAX_MR_IN_DIMM) {
+ ChannelOut->Dimm[0].Rank[Rank % 2].MR[MrIndex] = MrData;
+ } else if (MrIndex == mrMR11) {
+ ChannelOut->Dimm[0].Rank[Rank % 2].MR11 = MrData;
+ }
+ }
+
+ Status = MrcIssueMrw (
+ MrcData,
+ Channel,
+ Rank,
+ MrIndex,
+ MrData,
+ FALSE, // InitMrw
+ FALSE // ChipSelect2N
+ );
+ if (Status != mrcSuccess) {
+ return Status;
+ }
+ }
+ //
+ // @todo: Read MR8 (compare to SPD values) - optional step
+ //
+ } // for Rank
+ } // for Channel
+
+ Outputs->LpddrJedecInitDone = TRUE;
+ Outputs->RestoreMRs = TRUE;
+ return Status;
+}
+
+#endif // ULT_FLAG
+
+/**
+@brief
+ Wait in a loop until the first RCOMP has been completed.
+ MRC should wait until this bit is set before executing any DDR command.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval mrcDeviceBusy - On Rcomp completion timeout.
+ @retval mrcSuccess - On Rcomp completion.
+**/
+MrcStatus
+CheckFirstRcompDone (
+ IN MrcParameters *const MrcData
+ )
+{
+ MCDECS_CR_RCOMP_TIMER_MCMAIN_STRUCT CrRcompTimer;
+ BOOL Busy;
+ U32 Timeout;
+
+ Timeout = (U32) MrcGetCpuTime () + 10000; // 10 seconds timeout
+
+ do {
+ CrRcompTimer.Data = MrcReadCR (MrcData, MCDECS_CR_RCOMP_TIMER_MCMAIN_REG);
+ Busy = (0 == CrRcompTimer.Bits.First_Rcomp_done) ? TRUE : FALSE;
+ } while (Busy && ((U32) MrcGetCpuTime () < Timeout));
+
+ return ((Busy) ? mrcDeviceBusy : mrcSuccess);
+}
+
+/**
+@brief
+ Perform the required steps to exit self refresh in S3/Warm reset:
+ Download the Read Reg File for all populated ranks.
+ Assert CKE for all the ranks present to pull DIMMs out of Self-Refresh.
+ Issue long ZQ Calibration for all the ranks present in the channel.
+ Set REUT to normal mode for all channels.
+ Set the Power Down Config Register.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval mrcSuccess
+**/
+MrcStatus
+MrcSelfRefreshExit (
+ IN MrcParameters *const MrcData
+ )
+{
+ const MrcOutput *Outputs;
+ U32 Offset;
+ U8 Channel;
+ U8 Rank;
+ DDRDATACH0_CR_DDRCRDATACONTROL0_STRUCT DdrCrDataControl0;
+
+ Outputs = &MrcData->SysOut.Outputs;
+ //
+ // Download Read Reg File for all populated ranks per channel
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ Offset = DDRDATA0CH0_CR_DDRCRDATACONTROL0_REG +
+ ((DDRDATA0CH1_CR_DDRCRDATACONTROL0_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL0_REG) * Channel);
+ DdrCrDataControl0.Data = MrcReadCR (MrcData, Offset);
+
+ Offset = DDRDATACH0_CR_DDRCRDATACONTROL0_REG +
+ ((DDRDATACH1_CR_DDRCRDATACONTROL0_REG - DDRDATACH0_CR_DDRCRDATACONTROL0_REG) * Channel);
+ DdrCrDataControl0.Bits.ReadRFRd = 1;
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ if (MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ DdrCrDataControl0.Bits.ReadRFRank = Rank;
+ MrcWriteCrMulticast (MrcData, Offset, DdrCrDataControl0.Data);
+ }
+ }
+ }
+ }
+
+ //
+ // Pull the DIMMs out of self refresh by asserting CKE high.
+ // The time needed to stabilize the DCLK (~6uS) should be covered
+ // by the last 43 MC CR restores after restoring MC_INIT_STATE
+ // in MrcRestoreTrainingValues().
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++){
+ if (MrcChannelExist (&MrcData->SysOut.Outputs, Channel)) {
+ Offset = 2 + MCHBAR_CH0_CR_REUT_CH_MISC_CKE_CTRL_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_MISC_CKE_CTRL_REG - MCHBAR_CH0_CR_REUT_CH_MISC_CKE_CTRL_REG) * Channel);
+ MrcWriteCR8 (MrcData, Offset, Outputs->Controller[0].Channel[Channel].ValidRankBitMask);
+ }
+ }
+
+ //
+ // Issue ZQ Long on both channels / all ranks
+ //
+ if (MrcIssueZQ (MrcData, 0x3, MRC_ZQ_LONG) != mrcSuccess) {
+ MRC_DEBUG_MSG (&MrcData->SysIn.Inputs.Debug, MSG_LEVEL_WARNING, "\nZQ Long failed during S3/warm reset\n");
+ }
+
+ return mrcSuccess;
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/SpdProcessing/MrcSpdProcessing.c b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/SpdProcessing/MrcSpdProcessing.c
new file mode 100644
index 0000000..1717d48
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/SpdProcessing/MrcSpdProcessing.c
@@ -0,0 +1,4275 @@
+/** @file
+ By passing in a SPD data structure and platform support values, an output
+ structure is populated with DIMM configuration information.
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+
+**/
+
+#include "MrcSpdProcessing.h"
+
+#ifdef MRC_DEBUG_PRINT
+const char UnknownString[] = "unknown";
+const char Ddr3String[] = "DDR3";
+const char Ddr4String[] = "DDR4";
+const char RdimmString[] = "RDIMM";
+const char UdimmString[] = "UDIMM";
+const char SodimmString[] = "SO-DIMM";
+const char Sodimm72String[] = "72 bit SO-DIMM";
+const char StdString[] = "Standard";
+#if (SUPPORT_XMP == SUPPORT)
+const char Xmp1String[] = "XMP1";
+const char Xmp2String[] = "XMP2";
+const char XpString[] = " XMP profile %u is %sabled and recommended channel config: %u DIMM per channel\n";
+#endif // SUPPORT_XMP
+const char ErrorString[] = "ERROR: Unsupported ";
+const char SpdValString[] = "SPD value: ";
+const char IsSupString[] = " is supported";
+const char NotSupString[] = " is not supported";
+const char TimeBaseString[] = "Timebase (MTB/FTB)";
+const char tAAString[] = "CAS Latency Time (tAAmin)";
+const char tCKString[] = "SDRAM Cycle Time (tCKmin)";
+const char tWRString[] = "Write recovery time (tWRmin)";
+const char tRCDString[] = "RAS# to CAS# delay time (tRCDmin)";
+const char tRRDString[] = "Row active to row active delay time (tRRDmin)";
+const char tRPString[] = "Row precharge delay time (tRPmin)";
+#if (SUPPORT_LPDDR3 == SUPPORT)
+const char Lpddr3String[] = "LPDDR3";
+const char tRPabString[] = "Row precharge delay time for all banks (tRPab)";
+#endif // SUPPORT_LPDDRn
+const char tRASString[] = "Active to precharge delay time (tRASmin)";
+const char tRCString[] = "Active to active/refresh delay time (tRCmin)";
+const char tRFCString[] = "Refresh recovery delay time (tRFCmin)";
+const char tWTRString[] = "Internal write to read command delay time (tWTRmin)";
+const char tRTPString[] = "Internal read to precharge delay time (tRTPmin)";
+const char tFAWString[] = "Active to active/refresh delay time (tFAWmin)";
+const char tREFIString[] = "Average Periodic Refresh Interval (tREFImin)";
+const char tCWLString[] = "CAS Write Latency (tCWLmin)";
+const char NmodeString[] = "Command rate mode (Nmode)";
+const char VddString[] = "Module voltage VDD (mVolts)";
+const char BestCaseString[] = "Best case value for profiles 0-";
+const char ProfileString[] = "Profile";
+const char HeaderString[] = "Profile Controller Channel Dimm Value";
+const char RrcString[][3] = {
+ " A", " B", " C", " D", " E", " F", " G", " H", " J", " K",
+ " L", " M", " N", " P", " R", " T", " U", " V", " W", " Y",
+ "AA", "AB", "AC", "AD", "AE", "AF", "AG", "AH", "AJ", "AK",
+ "AL", "ZZ", "AM", "AN", "AP", "AR", "AT", "AU", "AV", "AW",
+ "AY", "BA", "BB", "BC", "BD", "BE", "BF", "BG", "BH", "BJ",
+ "BK", "BL", "BM", "BN", "BP", "BR", "BT", "BU", "BV", "BW",
+ "BY", "CA", "CB", "ZZ"};
+#endif // MRC_DEBUG_PRINT
+
+const TRangeTable Range[] = {
+ { 0xFFFFFFFF, fUnSupport, (0 << MRC_REF_CLOCK_133) | (0 << MRC_REF_CLOCK_100) },
+ { MRC_DDR3_800_TCK_MIN, f800, (1 << MRC_REF_CLOCK_133) | (1 << MRC_REF_CLOCK_100) },
+ { MRC_DDR3_1000_TCK_MIN, f1000, (0 << MRC_REF_CLOCK_133) | (1 << MRC_REF_CLOCK_100) },
+ { MRC_DDR3_1067_TCK_MIN, f1067, (1 << MRC_REF_CLOCK_133) | (0 << MRC_REF_CLOCK_100) },
+ { MRC_DDR3_1200_TCK_MIN, f1200, (0 << MRC_REF_CLOCK_133) | (1 << MRC_REF_CLOCK_100) },
+ { MRC_DDR3_1333_TCK_MIN, f1333, (1 << MRC_REF_CLOCK_133) | (0 << MRC_REF_CLOCK_100) },
+ { MRC_DDR3_1400_TCK_MIN, f1400, (0 << MRC_REF_CLOCK_133) | (1 << MRC_REF_CLOCK_100) },
+ { MRC_DDR3_1600_TCK_MIN, f1600, (1 << MRC_REF_CLOCK_133) | (1 << MRC_REF_CLOCK_100) },
+ { MRC_DDR3_1800_TCK_MIN, f1800, (0 << MRC_REF_CLOCK_133) | (1 << MRC_REF_CLOCK_100) },
+ { MRC_DDR3_1867_TCK_MIN, f1867, (1 << MRC_REF_CLOCK_133) | (0 << MRC_REF_CLOCK_100) },
+ { MRC_DDR3_2000_TCK_MIN, f2000, (0 << MRC_REF_CLOCK_133) | (1 << MRC_REF_CLOCK_100) },
+ { MRC_DDR3_2133_TCK_MIN, f2133, (1 << MRC_REF_CLOCK_133) | (0 << MRC_REF_CLOCK_100) },
+ { MRC_DDR3_2200_TCK_MIN, f2200, (0 << MRC_REF_CLOCK_133) | (1 << MRC_REF_CLOCK_100) },
+ { MRC_DDR3_2400_TCK_MIN, f2400, (1 << MRC_REF_CLOCK_133) | (1 << MRC_REF_CLOCK_100) },
+ { MRC_DDR3_2600_TCK_MIN, f2600, (0 << MRC_REF_CLOCK_133) | (1 << MRC_REF_CLOCK_100) },
+ { MRC_DDR3_2667_TCK_MIN, f2667, (1 << MRC_REF_CLOCK_133) | (0 << MRC_REF_CLOCK_100) },
+ { 0, fNoInit, (0 << MRC_REF_CLOCK_133) | (0 << MRC_REF_CLOCK_100) }
+};
+
+const SupportTable PlatformSupport = {
+ {TRAD_SUPPORT_LPDDR3, ULT_SUPPORT_LPDDR3 },
+ {TRAD_SUPPORT_COLUMN_10, ULT_SUPPORT_COLUMN_10},
+ {TRAD_SUPPORT_COLUMN_11, ULT_SUPPORT_COLUMN_11},
+ {TRAD_SUPPORT_COLUMN_12, ULT_SUPPORT_COLUMN_12},
+ {TRAD_VDDMINPOSSIBLE, ULT_VDDMINPOSSIBLE },
+ {TRAD_VDDMAXPOSSIBLE, ULT_VDDMAXPOSSIBLE }
+};
+
+/**
+ @brief
+ Calculate the memory clock value from the current memory frequency.
+
+ @param[in, out] MrcData - Pointer to MrcData data structure.
+ @param[in] Frequency - Memory frequency to convert.
+ @param[out] tCKminIndex - Pointer to the chosen table index.
+
+ @retval Returns the tCK value for the given frequency.
+**/
+U32
+ConvertFreq2Clock (
+ IN OUT MrcParameters *const MrcData,
+ IN const MrcFrequency Frequency,
+ OUT S32 *const tCKminIndex
+ )
+{
+ U32 tCKminActual;
+ S32 Index;
+
+ tCKminActual = MRC_DDR3_800_TCK_MIN;
+ for (Index = 0; (U32) Index < (sizeof (Range) / sizeof (TRangeTable)); Index++) {
+ if (Frequency == Range[Index].Frequency) {
+ tCKminActual = Range[Index].tCK;
+ break;
+ }
+ }
+ if (tCKminIndex != NULL) {
+ *tCKminIndex = Index;
+ }
+ return (tCKminActual);
+}
+
+/**
+ @brief
+ Calculate the memory frequency from the memory clock value.
+
+ @param[in, out] MrcData - Pointer to MrcData data structure.
+ @param[in] RefClk - The memory reference clock.
+ @param[in] tCKmin - The tCKmin value to convert.
+ @param[out] tCKminIndex - Pointer to the chosen table index.
+
+ @retval Returns the tCK value for the given frequency.
+**/
+static
+U32
+ConvertClock2Freq (
+ IN OUT MrcParameters *const MrcData,
+ IN const MrcRefClkSelect RefClk,
+ IN const U32 tCKmin,
+ OUT S32 *const tCKminIndex
+ )
+{
+ MrcOutput *Outputs;
+ MrcFrequency Frequency;
+ U32 Index;
+
+ Outputs = &MrcData->SysOut.Outputs;
+
+ //
+ // Convert tCK value to the nearest frequency value.
+ // Then find slowest valid frequency for the given reference clock.
+ //
+ Frequency = fNoInit;
+ for (Index = 0; Index < (sizeof (Range) / sizeof (TRangeTable)) - 1; Index++) {
+ if ((tCKmin <= Range[Index].tCK) && (tCKmin > Range[Index + 1].tCK)) {
+ Frequency = Range[Index].Frequency;
+ break;
+ }
+ }
+
+ while (Index) {
+ if ((Range[Index].RefClkFlag & (1 << RefClk)) == 0) {
+ Frequency = Range[--Index].Frequency;
+ } else {
+ break;
+ }
+ }
+ if (tCKminIndex != NULL) {
+ *tCKminIndex = Index;
+ }
+ return (Frequency);
+}
+
+/**
+ @brief
+ Determine if the DIMM slot is filled.
+ If the SPD structure is all zero's, then DIMM is not present.
+
+ @param[in] MrcData - Pointer to MrcData data structure.
+ @param[in] Spd - Pointer to Spd data structure.
+ @param[in] Size - Amount of data, in bytes.
+
+ @retval TRUE on valid value, otherwise FALSE and the value is set to zero.
+**/
+static
+MrcDimmSts
+DimmPresence (
+ IN const MrcParameters *const MrcData,
+ IN const MrcSpd *const Spd,
+ IN const U32 Size
+ )
+{
+
+ const U8 *p;
+ U32 count;
+ const MrcDebug *Debug;
+
+ Debug = &MrcData->SysIn.Inputs.Debug;
+
+ p = (const U8 *) Spd;
+ count = Size;
+ while (count--) {
+ if (0 != *p++) {
+ return DIMM_PRESENT;
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_WARNING, " Warning: No DIMM detected in slot\n");
+ return DIMM_NOT_PRESENT;
+}
+
+/**
+ @brief
+ Determine if the DIMM is valid and supported.
+
+ @param[in, out] MrcData - Pointer to MrcData data structure.
+ @param[in] Spd - Pointer to Spd data structure.
+ @param[in, out] DimmOut - Pointer to structure containing DIMM information.
+
+ @retval TRUE on valid value, otherwise FALSE.
+**/
+static
+BOOL
+ValidDimm (
+ IN OUT MrcParameters *const MrcData,
+ IN const MrcSpd *const Spd,
+ IN OUT MrcDimmOut *const DimmOut
+ )
+{
+ const SPD_EXTREME_MEMORY_PROFILE *Xmp;
+ BOOL Status;
+ U8 DeviceType;
+ MrcCpuModel CpuModel;
+ SpdVddFlag VddFlag;
+#ifdef MRC_DEBUG_PRINT
+ const U16 BytesUsedConst[] = {0, 128, 176, 256};
+ const MrcDebug *Debug;
+ const char *DramTypeString;
+ const char *ModuleTypeString;
+ const char *ProfileString;
+ SPD_REVISION_STRUCT Revision;
+ U16 BytesUsed;
+ U16 BytesTotal;
+ U16 CrcCoverage;
+
+ Debug = &MrcData->SysIn.Inputs.Debug;
+#endif // MRC_DEBUG_PRINT
+
+ Status = TRUE;
+ CpuModel = MrcData->SysIn.Inputs.CpuModel;
+
+ DeviceType = Spd->Ddr3.General.DramDeviceType.Bits.Type;
+
+ VddFlag.Bits.Vdd1_35 = Spd->Ddr3.General.ModuleNominalVoltage.Bits.OperationAt1_35;
+
+ switch (DeviceType) {
+#if (SUPPORT_DDR3 == SUPPORT)
+ case MRC_SPD_DDR3_SDRAM_TYPE_NUMBER:
+ DimmOut->DdrType = MRC_DDR_TYPE_DDR3;
+ DimmOut->ModuleType = Spd->Ddr3.General.ModuleType.Bits.ModuleType;
+ Xmp = &Spd->Ddr3.Xmp;
+ if ((CpuModel == cmHSW_ULT) && (VddFlag.Bits.Vdd1_35 == 0)) {
+ Status = FALSE;
+#ifdef MRC_DEBUG_PRINT
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, " DDR3 memory does not support 1.35V operation\n");
+#endif // MRC_DEBUG_PRINT
+ }
+ break;
+#endif // SUPPORT_DDR3
+
+#if (SUPPORT_LPDDR3 == SUPPORT)
+ case MRC_SPD_LPDDR3_SDRAM_TYPE_NUMBER:
+ if ((CpuModel == cmHSW_ULT && PlatformSupport.Lpddr3.UltSupport) ||
+ ((CpuModel == cmHSW || CpuModel == cmCRW) && PlatformSupport.Lpddr3.TradSupport)) {
+ DimmOut->DdrType = MRC_DDR_TYPE_LPDDR3;
+ DimmOut->ModuleType = Spd->Ddr3.General.ModuleType.Bits.ModuleType;
+ Xmp = &Spd->Ddr3.Xmp;
+ break;
+ }
+ // no break;
+#endif // SUPPORT_LPDDR3
+
+
+ default:
+ DimmOut->DdrType = MRC_DDR_TYPE_UNKNOWN;
+ DimmOut->ModuleType = 0;
+ Xmp = NULL;
+ Status = FALSE;
+ break;
+ }
+
+ if (Status) {
+ switch (DimmOut->ModuleType) {
+#if (SUPPORT_RDIMM == SUPPORT)
+ case MRC_MODULE_TYPE_RDIMM:
+ break;
+#endif
+
+#if (SUPPORT_UDIMM == SUPPORT)
+ case MRC_MODULE_TYPE_UDIMM:
+ break;
+#endif
+
+#if (SUPPORT_SODIMM == SUPPORT)
+ case MRC_MODULE_TYPE_SODIMM:
+ case MRC_MODULE_72B_SO_UDIMM:
+ break;
+#endif
+
+ default:
+ Status = FALSE;
+ break;
+ }
+ }
+
+#if (SUPPORT_XMP == SUPPORT)
+ DimmOut->XmpSupport = 0;
+ if (Status) {
+ if ((XMP_ID_STRING != Xmp->Header.XmpId) ||
+ (0x12 != (Xmp->Header.XmpRevision.Data & 0xFE)) ||
+ ((MrcData->SysIn.Inputs.MemoryProfile == XMP_PROFILE1) && (Xmp->Header.XmpOrgConf.Bits.ProfileEnable1 == 0)) ||
+ ((MrcData->SysIn.Inputs.MemoryProfile == XMP_PROFILE2) && (Xmp->Header.XmpOrgConf.Bits.ProfileEnable2 == 0))) {
+ if ((MrcData->SysIn.Inputs.MemoryProfile == XMP_PROFILE1) || (MrcData->SysIn.Inputs.MemoryProfile == XMP_PROFILE2)) {
+ Status = FALSE;
+ }
+ } else {
+ MrcData->SysOut.Outputs.XmpProfileEnable |= 1;
+ }
+ if (XMP_ID_STRING == Xmp->Header.XmpId) {
+ if (0x12 == (Xmp->Header.XmpRevision.Data & 0xFE)) {
+ DimmOut->XmpRevision = Xmp->Header.XmpRevision.Data;
+ }
+ if (Xmp->Header.XmpOrgConf.Bits.ProfileEnable1 != 0) {
+ DimmOut->XmpSupport |= 1;
+ }
+ if (Xmp->Header.XmpOrgConf.Bits.ProfileEnable2 != 0) {
+ DimmOut->XmpSupport |= 2;
+ }
+ }
+ }
+#endif // SUPPORT_XMP
+
+#ifdef MRC_DEBUG_PRINT
+ switch (MrcData->SysIn.Inputs.MemoryProfile) {
+ case STD_PROFILE:
+ case USER_PROFILE:
+ default:
+ ProfileString = StdString;
+ break;
+#if (SUPPORT_XMP == SUPPORT)
+ case XMP_PROFILE1:
+ ProfileString = Xmp1String;
+ break;
+ case XMP_PROFILE2:
+ ProfileString = Xmp2String;
+ break;
+#endif // SUPPORT_XMP
+ }
+
+ switch (DeviceType) {
+#if (SUPPORT_DDR3 == SUPPORT)
+ case MRC_SPD_DDR3_SDRAM_TYPE_NUMBER:
+ DramTypeString = Ddr3String;
+ BytesTotal = 256 * Spd->Ddr3.General.Description.Bits.BytesTotal;
+ BytesUsed = BytesUsedConst[Spd->Ddr3.General.Description.Bits.BytesUsed & 3];
+ CrcCoverage = 125 - (9 * Spd->Ddr3.General.Description.Bits.CrcCoverage);
+ Revision.Data = Spd->Ddr3.General.Revision.Data;
+ break;
+#endif // SUPPORT_DDR3
+
+#if (SUPPORT_LPDDR3 == SUPPORT)
+ case MRC_SPD_LPDDR3_SDRAM_TYPE_NUMBER:
+ if ((CpuModel == cmHSW_ULT && PlatformSupport.Lpddr3.UltSupport) ||
+ ((CpuModel == cmHSW || CpuModel == cmCRW) && PlatformSupport.Lpddr3.TradSupport)) {
+ DramTypeString = Lpddr3String;
+ BytesTotal = 256 * Spd->Ddr3.General.Description.Bits.BytesTotal;
+ BytesUsed = BytesUsedConst[Spd->Ddr3.General.Description.Bits.BytesUsed & 3];
+ CrcCoverage = 125 - (9 * Spd->Ddr3.General.Description.Bits.CrcCoverage);
+ Revision.Data = Spd->Ddr3.General.Revision.Data;
+ break;
+ }
+ // no break;
+#endif // SUPPORT_LPDDR3
+
+
+ default:
+ DramTypeString = UnknownString;
+ BytesTotal = 0;
+ BytesUsed = 0;
+ CrcCoverage = 0;
+ Revision.Data = 0;
+ break;
+ }
+
+ switch (DimmOut->ModuleType) {
+#if (SUPPORT_RDIMM == SUPPORT)
+ case MRC_MODULE_TYPE_RDIMM:
+ ModuleTypeString = RdimmString;
+ break;
+#endif // SUPPORT_RDIMM
+
+#if (SUPPORT_UDIMM == SUPPORT)
+ case MRC_MODULE_TYPE_UDIMM:
+ ModuleTypeString = UdimmString;
+ break;
+#endif // SUPPORT_UDIMM
+
+#if (SUPPORT_SODIMM == SUPPORT)
+ case MRC_MODULE_TYPE_SODIMM:
+ ModuleTypeString = SodimmString;
+ break;
+
+ case MRC_MODULE_72B_SO_UDIMM:
+ ModuleTypeString = SodimmString;
+ break;
+#endif // SUPPORT_SODIMM
+
+ default:
+ ModuleTypeString = UnknownString;
+ break;
+ }
+
+ if (Status) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ " %s %s detected, Rev: %u.%u, Size: %u used/%u total, CRC coverage: 0 - %u\n",
+ DramTypeString,
+ ModuleTypeString,
+ Revision.Bits.Major,
+ Revision.Bits.Minor,
+ BytesUsed,
+ BytesTotal,
+ CrcCoverage
+ );
+ } else {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_ERROR,
+ " %s %s detected, SPD Dram type %Xh, module type %Xh\n",
+ DramTypeString,
+ ModuleTypeString,
+ DeviceType,
+ DimmOut->ModuleType
+ );
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " DIMM profile %s selected\n", ProfileString);
+#if (SUPPORT_XMP == SUPPORT)
+ if (Xmp == NULL) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " Xmp structure is NULL!\n\n");
+ } else {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ " XMP String: %Xh, Rev: %u.%u\n",
+ Xmp->Header.XmpId,
+ Xmp->Header.XmpRevision.Bits.Major,
+ Xmp->Header.XmpRevision.Bits.Minor
+ );
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ XpString,
+ 1,
+ Xmp->Header.XmpOrgConf.Bits.ProfileEnable1 ? "en" : "dis",
+ Xmp->Header.XmpOrgConf.Bits.ProfileConfig1 + 1
+ );
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ XpString,
+ 2,
+ Xmp->Header.XmpOrgConf.Bits.ProfileEnable2 ? "en" : "dis",
+ Xmp->Header.XmpOrgConf.Bits.ProfileConfig2 + 1
+ );
+ }
+#endif // SUPPORT_XMP
+
+#endif // MRC_DEBUG_PRINT
+
+ return Status;
+}
+
+/**
+ @brief
+ Determine if the DIMM SDRAM device width is valid and return the value.
+
+ @param[in, out] MrcData - Pointer to MrcData data structure.
+ @param[in] Spd - Pointer to Spd data structure.
+ @param[in, out] DimmOut - Pointer to structure containing DIMM information.
+
+ @retval TRUE on valid value, otherwise FALSE and the value is set to zero.
+**/
+static
+BOOL
+ValidSdramDeviceWidth (
+ IN OUT MrcParameters *const MrcData,
+ IN const MrcSpd *const Spd,
+ IN OUT MrcDimmOut *const DimmOut
+ )
+{
+ const MrcDebug *Debug;
+
+ Debug = &MrcData->SysIn.Inputs.Debug;
+
+ DimmOut->SdramWidthIndex = Spd->Ddr3.General.ModuleOrganization.Bits.SdramDeviceWidth;
+
+ switch (DimmOut->SdramWidthIndex) {
+#if (SUPPORT_DEVWIDTH_4 == SUPPORT)
+
+ case MRC_SPD_SDRAM_DEVICE_WIDTH_4:
+ DimmOut->SdramWidth = 4;
+ break;
+#endif
+#if (SUPPORT_DEVWIDTH_8 == SUPPORT)
+
+ case MRC_SPD_SDRAM_DEVICE_WIDTH_8:
+ DimmOut->SdramWidth = 8;
+ break;
+#endif
+#if (SUPPORT_DEVWIDTH_16 == SUPPORT)
+
+ case MRC_SPD_SDRAM_DEVICE_WIDTH_16:
+ DimmOut->SdramWidth = 16;
+ break;
+#endif
+#if (SUPPORT_DEVWIDTH_32 == SUPPORT)
+
+ case MRC_SPD_SDRAM_DEVICE_WIDTH_32:
+ DimmOut->SdramWidth = 32;
+ break;
+#endif
+
+ default:
+ DimmOut->SdramWidth = 0;
+ MRC_DEBUG_MSG (Debug,
+ MSG_LEVEL_ERROR,
+ "%sSDRAM device width, %s%Xh\n",
+ ErrorString,
+ SpdValString,
+ DimmOut->SdramWidthIndex
+ );
+ return FALSE;
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " SDRAM device width: %u\n", DimmOut->SdramWidth);
+ return TRUE;
+}
+
+/**
+ @brief
+ Determine if the DIMM SDRAM row address size is valid and return the value.
+
+ @param[in, out] MrcData - Pointer to MrcData data structure.
+ @param[in] Spd - Pointer to Spd data structure.
+ @param[in, out] DimmOut - Pointer to structure containing DIMM information.
+
+ @retval TRUE if the row address size is valid, otherwise FALSE and the value is set to zero.
+**/
+static
+BOOL
+ValidRowSize (
+ IN OUT MrcParameters *const MrcData,
+ IN const MrcSpd *const Spd,
+ IN OUT MrcDimmOut *const DimmOut
+ )
+{
+ U8 RowBits;
+ U8 RowAddress;
+ const MrcDebug *Debug;
+
+ Debug = &MrcData->SysIn.Inputs.Debug;
+
+ RowAddress = Spd->Ddr3.General.SdramAddressing.Bits.RowAddress;
+
+ switch (RowAddress) {
+#if (SUPPORT_ROW_12 == SUPPORT)
+
+ case MRC_SPD_SDRAM_ROW_12:
+ DimmOut->RowSize = MRC_BIT12;
+ RowBits = 12;
+ break;
+#endif
+#if (SUPPORT_ROW_13 == SUPPORT)
+
+ case MRC_SPD_SDRAM_ROW_13:
+ DimmOut->RowSize = MRC_BIT13;
+ RowBits = 13;
+ break;
+#endif
+#if (SUPPORT_ROW_14 == SUPPORT)
+
+ case MRC_SPD_SDRAM_ROW_14:
+ DimmOut->RowSize = MRC_BIT14;
+ RowBits = 14;
+ break;
+#endif
+#if (SUPPORT_ROW_15 == SUPPORT)
+
+ case MRC_SPD_SDRAM_ROW_15:
+ DimmOut->RowSize = MRC_BIT15;
+ RowBits = 15;
+ break;
+#endif
+#if (SUPPORT_ROW_16 == SUPPORT)
+
+ case MRC_SPD_SDRAM_ROW_16:
+ DimmOut->RowSize = MRC_BIT16;
+ RowBits = 16;
+ break;
+#endif
+ default:
+ DimmOut->RowSize = 0;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "%sSDRAM row size, %s%Xh\n", ErrorString, SpdValString, RowAddress);
+ return FALSE;
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " Row bits: %u\n", RowBits);
+ return TRUE;
+}
+
+/**
+ @brief
+ Determine if the DIMM SDRAM column address size is valid and return the value.
+
+ @param[in, out] MrcData - Pointer to MrcData data structure.
+ @param[in] Spd - Pointer to Spd data structure.
+ @param[in, out] DimmOut - Pointer to structure containing DIMM information.
+
+ @retval TRUE if the column address size is valid, otherwise FALSE and the value is set to zero.
+**/
+static
+BOOL
+ValidColumnSize (
+ IN OUT MrcParameters *const MrcData,
+ IN const MrcSpd *const Spd,
+ IN OUT MrcDimmOut *const DimmOut
+ )
+{
+ const MrcDebug *Debug;
+ U8 ColumnBits;
+ U8 ColumnAddress;
+ MrcCpuModel CpuModel;
+
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ CpuModel = MrcData->SysIn.Inputs.CpuModel;
+
+ ColumnAddress = Spd->Ddr3.General.SdramAddressing.Bits.ColumnAddress;
+
+ switch (ColumnAddress) {
+#if (SUPPORT_COLUMN_9 == SUPPORT)
+ case MRC_SPD_SDRAM_COLUMN_9:
+ DimmOut->ColumnSize = MRC_BIT9;
+ ColumnBits = 9;
+ break;
+#endif
+
+#if (SUPPORT_COLUMN_10 == SUPPORT)
+ case MRC_SPD_SDRAM_COLUMN_10:
+ if ((CpuModel == cmHSW_ULT && PlatformSupport.Column10.UltSupport) ||
+ ((CpuModel == cmHSW || CpuModel == cmCRW) && PlatformSupport.Column10.TradSupport)) {
+ DimmOut->ColumnSize = MRC_BIT10;
+ ColumnBits = 10;
+ break;
+ }
+ // no break;
+#endif
+
+#if (SUPPORT_COLUMN_11 == SUPPORT)
+ case MRC_SPD_SDRAM_COLUMN_11:
+ if ((CpuModel == cmHSW_ULT && PlatformSupport.Column11.UltSupport) ||
+ ((CpuModel == cmHSW || CpuModel == cmCRW) && PlatformSupport.Column11.TradSupport)) {
+ DimmOut->ColumnSize = MRC_BIT11;
+ ColumnBits = 11;
+ break;
+ }
+ // no break;
+#endif
+
+#if (SUPPORT_COLUMN_12 == SUPPORT)
+ case MRC_SPD_SDRAM_COLUMN_12:
+ if ((CpuModel == cmHSW_ULT && PlatformSupport.Column12.UltSupport) ||
+ ((CpuModel == cmHSW || CpuModel == cmCRW) && PlatformSupport.Column12.TradSupport)) {
+ DimmOut->ColumnSize = MRC_BIT12;
+ ColumnBits = 12;
+ break;
+ }
+ // no break;
+#endif
+
+ default:
+ DimmOut->ColumnSize = 0;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "%sSDRAM column size, %s%Xh\n", ErrorString, SpdValString, ColumnAddress);
+ return FALSE;
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " Column bits: %u\n", ColumnBits);
+ return TRUE;
+}
+
+/**
+ @brief
+ Determine if the DIMM SDRAM primary bus width is valid and return the value.
+
+ @param[in, out] MrcData - Pointer to MrcData data structure.
+ @param[in] Spd - Pointer to Spd data structure.
+ @param[in, out] DimmOut - Pointer to structure containing DIMM information.
+
+ @retval TRUE on valid value, otherwise FALSE and the value is set to zero.
+**/
+static
+BOOL
+ValidPrimaryWidth (
+ IN OUT MrcParameters *const MrcData,
+ IN const MrcSpd *const Spd,
+ IN OUT MrcDimmOut *const DimmOut
+ )
+{
+ U8 Width;
+ const MrcDebug *Debug;
+
+ Debug = &MrcData->SysIn.Inputs.Debug;
+
+ Width = Spd->Ddr3.General.ModuleMemoryBusWidth.Bits.PrimaryBusWidth;
+
+ switch (Width) {
+#if (SUPPORT_PRIWIDTH_8 == SUPPORT)
+
+ case MRC_SPD_PRIMARY_BUS_WIDTH_8:
+ DimmOut->PrimaryBusWidth = 8;
+ break;
+#endif
+#if (SUPPORT_PRIWIDTH_16 == SUPPORT)
+
+ case MRC_SPD_PRIMARY_BUS_WIDTH_16:
+ DimmOut->PrimaryBusWidth = 16;
+ break;
+#endif
+#if (SUPPORT_PRIWIDTH_32 == SUPPORT)
+
+ case MRC_SPD_PRIMARY_BUS_WIDTH_32:
+ DimmOut->PrimaryBusWidth = 32;
+ break;
+#endif
+#if (SUPPORT_PRIWIDTH_64 == SUPPORT)
+
+ case MRC_SPD_PRIMARY_BUS_WIDTH_64:
+ DimmOut->PrimaryBusWidth = 64;
+ break;
+#endif
+
+ default:
+ DimmOut->PrimaryBusWidth = 0;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "%sSDRAM primary bus width, %s%Xh\n", ErrorString, SpdValString, Width);
+ return FALSE;
+ break;
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " Primary bus width: %u\n", DimmOut->PrimaryBusWidth);
+ return TRUE;
+}
+
+/**
+ Determines if the number of Bank are valid.
+
+ @param[in, out] MrcData - Pointer to MrcData data structure.
+ @param[in] Spd - Pointer to Spd data structure.
+ @param[in, out] DimmOut - Pointer to structure containing DIMM information.
+
+ @retval TRUE on valid value, otherwise FALSE.
+**/
+static
+BOOL
+ValidBank (
+ IN OUT MrcParameters *const MrcData,
+ IN const MrcSpd *const Spd,
+ IN OUT MrcDimmOut *const DimmOut
+ )
+{
+ const MrcDebug *Debug;
+ U8 BankAddress;
+ U8 BankGroup;
+ U8 ValidCheck;
+
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ ValidCheck = TRUE;
+ DimmOut->DensityIndex = Spd->Ddr3.General.SdramDensityAndBanks.Bits.Density;
+ BankAddress = Spd->Ddr3.General.SdramDensityAndBanks.Bits.BankAddress;
+ BankGroup = 0;
+ switch (BankAddress) {
+#if (SUPPORT_BANK_8 == SUPPORT)
+ case MRC_SPD_DDR3_SDRAM_BANK_8:
+#endif
+#if (SUPPORT_BANK_16 == SUPPORT)
+ case MRC_SPD_DDR3_SDRAM_BANK_16:
+#endif
+#if (SUPPORT_BANK_32 == SUPPORT)
+ case MRC_SPD_DDR3_SDRAM_BANK_32:
+#endif
+#if (SUPPORT_BANK_64 == SUPPORT)
+ case MRC_SPD_DDR3_SDRAM_BANK_64:
+#endif
+#if ((SUPPORT_BANK_8 == SUPPORT) || (SUPPORT_BANK_16 == SUPPORT) || (SUPPORT_BANK_32 == SUPPORT) || (SUPPORT_BANK_64 == SUPPORT))
+ DimmOut->Banks = MRC_BIT3 << BankAddress;;
+ DimmOut->BankGroups = BankGroup;
+ break;
+#endif
+
+ default:
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_ERROR,
+ "%sSDRAM number of banks, %s%Xh\n",
+ ErrorString,
+ SpdValString,
+ BankAddress
+ );
+ ValidCheck = FALSE;
+ }
+
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ (TRUE == ValidCheck) ? " %u Banks in %u groups\n" : "",
+ DimmOut->Banks,
+ DimmOut->BankGroups
+ );
+
+ return ValidCheck;
+}
+
+/**
+ @brief
+ Determine if the number of ranks in the DIMM is valid and return the value.
+
+ @param[in, out] MrcData - Pointer to MrcData data structure.
+ @param[in] Spd - Pointer to Spd data structure.
+ @param[in, out] DimmOut - Pointer to structure containing DIMM information.
+
+ @retval TRUE on valid value, otherwise FALSE and the value is set to zero.
+**/
+static
+BOOL
+GetRankCount (
+ IN OUT MrcParameters *const MrcData,
+ IN const MrcSpd *const Spd,
+ IN OUT MrcDimmOut *const DimmOut
+ )
+{
+ const MrcDebug *Debug;
+ U8 RankCount;
+
+ Debug = &MrcData->SysIn.Inputs.Debug;
+
+ RankCount = Spd->Ddr3.General.ModuleOrganization.Bits.RankCount;
+
+ DimmOut->RankInDIMM = RankCount + 1;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " Ranks: %u\n", DimmOut->RankInDIMM);
+ if (DimmOut->RankInDIMM > MAX_RANK_IN_DIMM) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "%snumber of ranks, %s%Xh\n", ErrorString, SpdValString, RankCount);
+ DimmOut->RankInDIMM = 0;
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/**
+ @brief
+ Calculate the size of the DIMM, in MBytes.
+
+ @param[in, out] MrcData - Pointer to MrcData data structure.
+ @param[in] Spd - Pointer to Spd data structure.
+ @param[in, out] DimmOut - Pointer to structure containing DIMM information.
+
+ @retval TRUE on valid value, otherwise FALSE and the value is set to zero.
+**/
+static
+BOOL
+GetDimmSize (
+ IN OUT MrcParameters *const MrcData,
+ IN const MrcSpd *const Spd,
+ IN OUT MrcDimmOut *const DimmOut
+ )
+{
+ const U32 SdramCapacityTable[] = {
+ (256 / 8), (512 / 8), (1024 / 8), (2048 / 8),
+ (4096 / 8), (8192 / 8), (16384 / 8), (32768 / 8)
+ };
+ U32 DimmSize;
+ const MrcDebug *Debug;
+
+ Debug = &MrcData->SysIn.Inputs.Debug;
+
+ if ((DimmOut->SdramWidth > 0) && (DimmOut->DensityIndex < (sizeof (SdramCapacityTable) / sizeof (SdramCapacityTable[0])))) {
+ DimmSize = (((SdramCapacityTable[DimmOut->DensityIndex] * DimmOut->PrimaryBusWidth) / DimmOut->SdramWidth) * DimmOut->RankInDIMM);
+ if ((DimmSize >= DIMMSIZEMIN) && (DimmSize <= DIMMSIZEMAX)) {
+ DimmOut->DimmCapacity = DimmSize;
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ " DIMM size: %u MByte\n",
+ DimmSize
+ );
+ return TRUE;
+ }
+ }
+
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_ERROR,
+ "%sDIMM size, valid range %u - %u. ",
+ ErrorString,
+ DIMMSIZEMIN,
+ DIMMSIZEMAX
+ );
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_ERROR,
+ "SDRAM capacity %s%Xh\n",
+ SpdValString,
+ DimmOut->DensityIndex
+ );
+ DimmOut->DimmCapacity = 0;
+ return FALSE;
+}
+
+/**
+ @brief
+ Obtain ECC support Status for this DIMM.
+
+ @param[in, out] MrcData - Pointer to MrcData data structure.
+ @param[in] Spd - Pointer to Spd data structure.
+ @param[in, out] DimmOut - Pointer to structure containing DIMM information.
+
+ @retval Returns TRUE.
+**/
+static
+BOOL
+ValidEccSupport (
+ IN OUT MrcParameters *const MrcData,
+ IN const MrcSpd *const Spd,
+ IN OUT MrcDimmOut *const DimmOut
+ )
+{
+#if (SUPPORT_ECC == SUPPORT)
+ U8 BusWidthExtension;
+#endif // SUPPORT_ECC
+ const MrcDebug *Debug;
+
+ Debug = &MrcData->SysIn.Inputs.Debug;
+
+#if (SUPPORT_ECC == SUPPORT)
+ BusWidthExtension = Spd->Ddr3.General.ModuleMemoryBusWidth.Bits.BusWidthExtension;
+
+ if (MRC_SPD_BUS_WIDTH_EXTENSION_8 == BusWidthExtension) {
+ DimmOut->EccSupport = TRUE;
+ } else
+#endif // SUPPORT_ECC
+ {
+ DimmOut->EccSupport = FALSE;
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " ECC is %ssupported\n", (DimmOut->EccSupport == FALSE) ? "not " : "");
+ return TRUE;
+}
+
+/**
+ @brief
+ Obtain address mirroring Status for this DIMM.
+
+ @param[in, out] MrcData - Pointer to MrcData data structure.
+ @param[in] Spd - Pointer to Spd data structure.
+ @param[in, out] DimmOut - Pointer to structure containing DIMM information.
+
+ @retval Returns TRUE.
+**/
+static
+BOOL
+GetAddressMirror (
+ IN OUT MrcParameters *const MrcData,
+ IN const MrcSpd *const Spd,
+ IN OUT MrcDimmOut *const DimmOut
+ )
+{
+ const MrcDebug *Debug;
+ U8 MappingRank1;
+
+ Debug = &MrcData->SysIn.Inputs.Debug;
+
+ MappingRank1 = Spd->Ddr3.Module.Unbuffered.AddressMappingEdgeConn.Bits.MappingRank1;
+ DimmOut->AddressMirrored = (MappingRank1 != 0) ? TRUE : FALSE;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " DIMM has %saddress mirroring\n", (DimmOut->AddressMirrored == FALSE) ? "no " : "");
+ return TRUE;
+}
+
+/**
+ @brief
+ Obtain thermal and refresh support for this DIMM.
+
+ @param[in, out] MrcData - Pointer to MrcData data structure.
+ @param[in] Spd - Pointer to Spd data structure.
+ @param[in, out] DimmOut - Pointer to structure containing DIMM information.
+
+ @retval Returns TRUE.
+**/
+static
+BOOL
+GetThermalRefreshSupport (
+ IN OUT MrcParameters *const MrcData,
+ IN const MrcSpd *const Spd,
+ IN OUT MrcDimmOut *const DimmOut
+ )
+{
+ const MrcDebug *Debug;
+ const MrcInput *Inputs;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ DimmOut->PartialSelfRefresh = Spd->Ddr3.General.ThermalAndRefreshOptions.Bits.PartialArraySelfRefresh;
+ DimmOut->OnDieThermalSensor = Spd->Ddr3.General.ThermalAndRefreshOptions.Bits.OnDieThermalSensor;
+ DimmOut->AutoSelfRefresh = Spd->Ddr3.General.ThermalAndRefreshOptions.Bits.AutoSelfRefresh && Inputs->AutoSelfRefreshSupport;
+ DimmOut->ExtendedTemperRefresh = Spd->Ddr3.General.ThermalAndRefreshOptions.Bits.ExtendedTemperatureRefreshRate;
+ DimmOut->ExtendedTemperRange = Spd->Ddr3.General.ThermalAndRefreshOptions.Bits.ExtendedTemperatureRange;
+
+ DimmOut->SelfRefreshTemp = ((!DimmOut->AutoSelfRefresh) && (DimmOut->ExtendedTemperRange) && (Inputs->ExtTemperatureSupport)) ? TRUE : FALSE;
+
+ MRC_DEBUG_MSG (Debug,
+ MSG_LEVEL_NOTE,
+ " Partial Array Self Refresh%s\n",
+ DimmOut->PartialSelfRefresh ? IsSupString : NotSupString);
+ MRC_DEBUG_MSG (Debug,
+ MSG_LEVEL_NOTE,
+ " On-Die Thermal Sensor Readout%s\n",
+ DimmOut->OnDieThermalSensor ? IsSupString : NotSupString);
+ MRC_DEBUG_MSG (Debug,
+ MSG_LEVEL_NOTE,
+ " Auto Self Refresh%s\n",
+ DimmOut->AutoSelfRefresh ? IsSupString : NotSupString);
+ MRC_DEBUG_MSG (Debug,
+ MSG_LEVEL_NOTE,
+ " Extended Temperature Refresh Rate%s\n",
+ DimmOut->ExtendedTemperRefresh ? IsSupString : NotSupString);
+ MRC_DEBUG_MSG (Debug,
+ MSG_LEVEL_NOTE,
+ " Extended Temperature Range%s\n",
+ DimmOut->ExtendedTemperRange ? IsSupString : NotSupString);
+ return TRUE;
+}
+
+/**
+ @brief
+ Obtain which JEDEC reference design raw card was used as the basis for the DIMM assembly.
+
+ @param[in, out] MrcData - Pointer to MrcData data structure.
+ @param[in] Spd - Pointer to Spd data structure.
+ @param[in, out] DimmOut - Pointer to structure containing DIMM information.
+
+ @retval Returns TRUE.
+**/
+static
+BOOL
+GetReferenceRawCardSupport (
+ IN OUT MrcParameters *const MrcData,
+ IN const MrcSpd *const Spd,
+ IN OUT MrcDimmOut *const DimmOut
+ )
+{
+ const MrcDebug *Debug;
+
+ Debug = &MrcData->SysIn.Inputs.Debug;
+
+ DimmOut->ReferenceRawCard = (Spd->Ddr3.Module.Unbuffered.ReferenceRawCardUsed.Bits.Extension << MRC_SPD_REF_RAW_CARD_SIZE) |
+ Spd->Ddr3.Module.Unbuffered.ReferenceRawCardUsed.Bits.Card;
+
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ " Reference raw card: %u '%s'\n",
+ DimmOut->ReferenceRawCard,
+ (DimmOut->ReferenceRawCard < (sizeof (RrcString) / sizeof (RrcString[0][0]))) ?
+ RrcString[DimmOut->ReferenceRawCard] : UnknownString
+ );
+ return TRUE;
+}
+
+/**
+ @brief
+ Calculate the CRC16 of the provided SPD data. CRC16 formula is the same
+ one that is used for calculating the CRC16 stored at SPD bytes 126-127.
+ This can be used to detect DIMM change.
+
+ @param[in] Buffer - Pointer to the start of the data.
+ @param[in] Size - Amount of data in the buffer, in bytes.
+ @param[out] Crc - Pointer to location to write the calculated CRC16 value.
+
+ @retval Returns TRUE.
+**/
+BOOL
+GetDimmCrc (
+ IN const U8 *const Buffer,
+ IN const U32 Size,
+ OUT U16 *const Crc
+ )
+{
+ const U8 *Data;
+ U32 Value;
+ U32 Byte;
+ U8 Bit;
+
+ Data = Buffer;
+ Value = CRC_SEED;
+ for (Byte = 0; Byte < Size; Byte++) {
+ Value ^= (U32) *Data++ << 8;
+ for (Bit = 0; Bit < 8; Bit++) {
+ Value = (Value & MRC_BIT15) ? (Value << 1) ^ CRC_XOR_MASK : Value << 1;
+ }
+ }
+
+ *Crc = (U16) Value;
+ return TRUE;
+}
+
+/**
+ @brief
+ Calculate the medium and fine timebases, using integer math.
+
+ @param[in, out] MrcData - Pointer to MrcData data structure.
+
+ @retval TRUE if medium timebase is valid, otherwise FALSE.
+**/
+static
+BOOL
+GetChannelDimmTimeBase (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ const MrcInput *Inputs;
+ const MrcControllerIn *ControllerIn;
+ const MrcChannelIn *ChannelIn;
+ const MrcDimmIn *DimmIn;
+ const MrcSpd *Spd;
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ MrcDimmOut *DimmOut;
+ MrcTimeBase *TimeBase;
+ MrcProfile Profile;
+ U8 Controller;
+ U8 Channel;
+ U8 Dimm;
+#if ((SUPPORT_XMP == SUPPORT) || (SUPPORT_DDR3 == SUPPORT) || (SUPPORT_LPDDR3 == SUPPORT))
+ U8 SpdMtbDividend;
+ U8 SpdMtbDivisor;
+ U8 SpdFtbDividend;
+ U8 SpdFtbDivisor;
+#endif
+#if (SUPPORT_XMP == SUPPORT)
+ const SPD_MEDIUM_TIMEBASE *XmpMtb;
+ U32 Index;
+
+#endif // SUPPORT_XMP
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ Debug = &Inputs->Debug;
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %s:\n %s\n", TimeBaseString, HeaderString);
+
+ //
+ // Find the smallest timing value for all the given DIMMs, for all the profiles.
+ //
+ for (Profile = STD_PROFILE; Profile < MAX_PROFILE; Profile++) {
+ if (((Profile == XMP_PROFILE1) || (Profile == XMP_PROFILE2)) && (!(Outputs->XmpProfileEnable))) {
+ continue;
+ }
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerIn = &Inputs->Controller[Controller];
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelIn = &ControllerIn->Channel[Channel];
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmIn = &ChannelIn->Dimm[Dimm];
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ if (DIMM_PRESENT == DimmOut->Status) {
+ Spd = &DimmIn->Spd;
+ TimeBase = &ChannelOut->TimeBase[Dimm][Profile];
+ switch (Profile) {
+ case XMP_PROFILE1:
+ case XMP_PROFILE2:
+#if (SUPPORT_XMP == SUPPORT)
+ if (((Profile == XMP_PROFILE1) && ((DimmOut->XmpSupport & 1) != 0)) ||
+ ((Profile == XMP_PROFILE2) && ((DimmOut->XmpSupport & 2) != 0))) {
+ Index = Profile - XMP_PROFILE1;
+ SpdFtbDividend = Spd->Ddr3.Xmp.Header.FineTimeBase.Bits.Dividend;
+ SpdFtbDivisor = Spd->Ddr3.Xmp.Header.FineTimeBase.Bits.Divisor;
+ XmpMtb = &Spd->Ddr3.Xmp.Header.MediumTimeBase[Index];
+ SpdMtbDividend = XmpMtb->Dividend.Bits.Dividend;
+ SpdMtbDivisor = XmpMtb->Divisor.Bits.Divisor;
+ TimeBase->Ftb = ((DimmOut->XmpRevision == 0x12) || (SpdFtbDivisor == 0)) ? 0 : (SpdFtbDividend * MRC_FREQUENCY_FTB_OFFSET) / SpdFtbDivisor;
+ TimeBase->Mtb = (SpdMtbDivisor == 0) ? 0 : (SpdMtbDividend * MRC_FREQUENCY_MTB_OFFSET) / SpdMtbDivisor;
+ } else {
+ TimeBase->Ftb = 0;
+ TimeBase->Mtb = 0;
+ }
+#endif //SUPPORT_XMP
+ break;
+ case USER_PROFILE:
+ case STD_PROFILE:
+ default:
+ SpdFtbDividend = Spd->Ddr3.General.FineTimebase.Bits.Dividend;
+ SpdFtbDivisor = Spd->Ddr3.General.FineTimebase.Bits.Divisor;
+ SpdMtbDividend = Spd->Ddr3.General.MediumTimebase.Dividend.Bits.Dividend;
+ SpdMtbDivisor = Spd->Ddr3.General.MediumTimebase.Divisor.Bits.Divisor;
+ TimeBase->Ftb = (SpdFtbDivisor == 0) ? 0 : (SpdFtbDividend * MRC_FREQUENCY_FTB_OFFSET) / SpdFtbDivisor;
+ TimeBase->Mtb = (SpdMtbDivisor == 0) ? 0 : (SpdMtbDividend * MRC_FREQUENCY_MTB_OFFSET) / SpdMtbDivisor;
+ break;
+ } //switch
+
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ " % 7u % 10u % 8u % 5u % 6u %u\n",
+ Profile,
+ Controller,
+ Channel,
+ Dimm,
+ TimeBase->Mtb,
+ TimeBase->Ftb
+ );
+ } //DimmOut->Status
+ } //Dimm
+ } //Channel
+ } //Controller
+ } //Profile
+
+ return TRUE;
+}
+
+/**
+ @brief
+ Calculate the SDRAM minimum cycle time (tCKmin) that this DIMM supports.
+ Then use the lookup table to obtain the frequency closest to the clock multiple.
+
+ @param[in, out] MrcData - Pointer to MrcData data structure.
+
+ @retval TRUE if the DIMM frequency is supported, otherwise FALSE and the frequency is set to fUnSupport.
+**/
+static
+BOOL
+GetChannelDimmtCK (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ const MrcInput *Inputs;
+ const MrcControllerIn *ControllerIn;
+ const MrcChannelIn *ChannelIn;
+ const MrcDimmIn *DimmIn;
+ const MrcSpd *Spd;
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ MrcDimmOut *DimmOut;
+ MrcTimeBase *TimeBase;
+ MrcProfile Profile;
+ U8 Controller;
+ U8 Channel;
+ U8 Dimm;
+ S32 MediumTimebase;
+ S32 FineTimebase;
+ S32 tCKminMtb;
+ S32 tCKminFine;
+ U32 Actual[MAX_PROFILE];
+ U32 Calculated;
+#if (SUPPORT_XMP == SUPPORT)
+ const SPD_EXTREME_MEMORY_PROFILE_DATA *Data;
+#endif
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ Debug = &Inputs->Debug;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %s:\n %s (fs)\n", tCKString, HeaderString);
+
+ //
+ // Find the smallest timing value for all the given DIMMs, for all the profiles.
+ //
+ for (Profile = STD_PROFILE; Profile < MAX_PROFILE; Profile++) {
+ if (((Profile == XMP_PROFILE1) || (Profile == XMP_PROFILE2)) && (!(Outputs->XmpProfileEnable))) {
+ continue;
+ }
+ Actual[Profile] = fNoInit;
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerIn = &Inputs->Controller[Controller];
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelIn = &ControllerIn->Channel[Channel];
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmIn = &ChannelIn->Dimm[Dimm];
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ if (DIMM_PRESENT == DimmOut->Status) {
+ Spd = &DimmIn->Spd;
+ TimeBase = &ChannelOut->TimeBase[Dimm][Profile];
+ MediumTimebase = TimeBase->Mtb;
+ FineTimebase = TimeBase->Ftb;
+ Calculated = 0;
+ switch (Profile) {
+ case XMP_PROFILE1:
+ case XMP_PROFILE2:
+#if (SUPPORT_XMP == SUPPORT)
+ if (((Profile == XMP_PROFILE1) && ((DimmOut->XmpSupport & 1) != 0)) ||
+ ((Profile == XMP_PROFILE2) && ((DimmOut->XmpSupport & 2) != 0))) {
+ Data = &Spd->Ddr3.Xmp.Data[Profile - XMP_PROFILE1];
+
+ tCKminMtb = Data->tCKmin.Bits.tCKmin;
+ tCKminFine = (DimmOut->XmpRevision == 0x13) ? Data->tCKminFine.Bits.tCKminFine : 0;
+ Calculated = (MediumTimebase * tCKminMtb) + (FineTimebase * tCKminFine);
+ Calculated = MAX (Outputs->MemoryClockMax, Calculated);
+ } else {
+ Calculated = 0;
+ }
+#endif // SUPPORT_XMP
+ break;
+ case USER_PROFILE:
+ if (Inputs->Ratio > 0) {
+ Calculated = MrcRatioToClock (Inputs->Ratio, Outputs->RefClk, Inputs->BClkFrequency);
+ Calculated = MAX (Outputs->MemoryClockMax, Calculated);
+ break;
+ } else {
+ // In AUTO mode, so no break.
+ }
+ case STD_PROFILE:
+ default:
+ tCKminMtb = Spd->Ddr3.General.tCKmin.Bits.tCKmin;
+ tCKminFine = Spd->Ddr3.General.tCKminFine.Bits.tCKminFine;
+
+ Calculated = (MediumTimebase * tCKminMtb) + (FineTimebase * tCKminFine);
+ Calculated = MAX (Outputs->MemoryClockMax, Calculated);
+ break;
+ } //switch
+ Actual[Profile] = MAX (Actual[Profile], Calculated);
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ " % 7u % 10u % 8u % 5u % 6u\n",
+ Profile,
+ Controller,
+ Channel,
+ Dimm,
+ Calculated
+ );
+ } //DimmOut->Status
+ } //Dimm
+ } //Channel
+ } //Controller
+ } //Profile
+
+ //
+ // Set the best case timing for all controllers/channels/dimms, for each profile.
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %s%u:", BestCaseString, MAX_PROFILE - 1);
+ for (Profile = STD_PROFILE; Profile < MAX_PROFILE; Profile++) {
+ if (((Profile == XMP_PROFILE1) || (Profile == XMP_PROFILE2)) && (!(Outputs->XmpProfileEnable))) {
+ continue;
+ }
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ DimmOut->Timing[Profile].tCK = Actual[Profile];
+ ChannelOut->Timing[Profile].tCK = Actual[Profile];
+ }
+ }
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %u", Actual[Profile]);
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+
+ Outputs->MemoryClock = Actual[Inputs->MemoryProfile];
+
+ return TRUE;
+}
+
+/**
+ @brief
+ Calculate the Minimum CAS Latency Time (tAAmin) for the given DIMMs.
+ Step 1: Determine the common set of supported CAS Latency values for all modules
+ on the memory channel using the CAS Latencies Supported in SPD.
+ Step 2: Determine tAAmin(all) which is the largest tAAmin value for all modules on the memory channel.
+ Step 3: Determine tCKmin(all) which is the largest tCKmin value for all
+ the modules on the memory channel (Done in function GetChannelDimmtCK).
+ Step 4: For a proposed tCK value between tCKmin and tCKmax, determine the desired CAS Latency.
+ If tCKproposed is not a standard JEDEC value then tCKproposed must be adjusted to the
+ next lower standard tCK value for calculating CLdesired.
+ Step 5: Chose an actual CAS Latency that is greater than or equal to CLdesired and is
+ supported by all modules on the memory channel as determined in step 1. If no such value exists,
+ choose a higher tCKproposed value and repeat steps 4 and 5 until a solution is found.
+ Step 6: Once the calculation of CLactual is completed, the BIOS must also verify that this CAS
+ Latency value does not exceed tAAmax, which is 20 ns for all DDR3 speed grades.
+ If not, choose a lower CL value and repeat steps 5 and 6 until a solution is found.
+
+ @param[in, out] MrcData - Pointer to MrcData data structure.
+
+ @retval TRUE if the CAS latency has been calculated, otherwise FALSE and the returned value is set to zero.
+**/
+static
+BOOL
+GetChannelDimmtAA (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ const MrcInput *Inputs;
+ const MrcControllerIn *ControllerIn;
+ const MrcChannelIn *ChannelIn;
+ const MrcDimmIn *DimmIn;
+ const MrcSpd *Spd;
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ MrcDimmOut *DimmOut;
+ MrcProfile Profile;
+ MrcBool Found[MAX_PROFILE];
+ MrcBool UserProfile;
+ MrcBool tCLOverride;
+ BOOL Status;
+ S32 MediumTimeBase;
+ S32 FineTimeBase;
+ S32 tCKminIndex;
+ S32 tCKmin100;
+ S32 tCKminIndexSave;
+ S32 TimingFTB;
+ U32 TimingMTB;
+ U32 tCKmin;
+ U32 CommonCasMask[MAX_PROFILE];
+ U32 CasMask;
+ U32 Actual[MAX_PROFILE];
+ U32 Calculated;
+ U32 tCLLimitMin;
+ U32 tCLLimitMax;
+ U8 Controller;
+ U8 Channel;
+ U8 Dimm;
+#if (SUPPORT_XMP == SUPPORT)
+ const SPD_EXTREME_MEMORY_PROFILE_DATA *Data;
+ U32 Index;
+#endif
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ Debug = &Inputs->Debug;
+ tCKmin = 0;
+ Calculated = 0;
+ Status = FALSE;
+ tCLOverride = FALSE;
+ MediumTimeBase = 0;
+ FineTimeBase = 0;
+ TimingMTB = 0;
+ TimingFTB = 0;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %s:\n %s tCL Mask\n", tAAString, HeaderString);
+
+ for (Profile = STD_PROFILE; Profile < MAX_PROFILE; Profile++) {
+ if (((Profile == XMP_PROFILE1) || (Profile == XMP_PROFILE2)) && (!(Outputs->XmpProfileEnable))) {
+ continue;
+ }
+ UserProfile = (Profile == USER_PROFILE) && (Inputs->MemoryProfile == USER_PROFILE);
+ CommonCasMask[Profile] = ~(0UL);
+ Actual[Profile] = 0;
+ tCLLimitMin = 4;
+ tCLLimitMax = 18;
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerIn = &Inputs->Controller[Controller];
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelIn = &ControllerIn->Channel[Channel];
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmIn = &ChannelIn->Dimm[Dimm];
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ if (DIMM_PRESENT == DimmOut->Status) {
+ Spd = &DimmIn->Spd;
+ tCKmin = ChannelOut->Dimm[Dimm].Timing[Profile].tCK;
+ MediumTimeBase = ChannelOut->TimeBase[Dimm][Profile].Mtb;
+ FineTimeBase = ChannelOut->TimeBase[Dimm][Profile].Ftb;
+ CasMask = 0;
+ switch (Profile) {
+ case XMP_PROFILE1:
+ case XMP_PROFILE2:
+#if (SUPPORT_XMP == SUPPORT)
+ if (((Profile == XMP_PROFILE1) && ((DimmOut->XmpSupport & 1) != 0)) ||
+ ((Profile == XMP_PROFILE2) && ((DimmOut->XmpSupport & 2) != 0))) {
+ Index = Profile - XMP_PROFILE1;
+ Data = &Spd->Ddr3.Xmp.Data[Index];
+ tCLLimitMin = 4;
+ tCLLimitMax = 18;
+ TimingMTB = Data->tAAmin.Bits.tAAmin;
+ TimingFTB = (DimmOut->XmpRevision == 0x13) ? Data->tAAminFine.Bits.tAAminFine : 0;
+ CasMask = Data->CasLatencies.Data & MRC_SPD_CL_SUPPORTED_MASK;
+ Calculated = (tCKmin == 0) ? 0 : ((MediumTimeBase * TimingMTB) + (FineTimeBase * TimingFTB) + (tCKmin - 1)) / tCKmin;
+ Actual[Profile] = MAX (Actual[Profile], Calculated);
+ } else {
+ Calculated = 0;
+ }
+#endif // SUPPORT_XMP
+ break;
+
+ case USER_PROFILE:
+ if (DimmIn->Timing.tCL > 0) {
+ CasMask = ~(0UL);
+ Calculated = DimmIn->Timing.tCL;
+ Actual[Profile] = MAX (Actual[Profile], Calculated);
+ tCLOverride = TRUE;
+ break;
+ } else {
+ // In AUTO mode, so no break.
+ }
+
+ case STD_PROFILE:
+ default:
+ tCLLimitMin = 4;
+ tCLLimitMax = 18;
+ TimingMTB = Spd->Ddr3.General.tAAmin.Bits.tAAmin;
+ TimingFTB = Spd->Ddr3.General.tAAminFine.Bits.tAAminFine;
+ CasMask = Spd->Ddr3.General.CasLatencies.Data & MRC_SPD_CL_SUPPORTED_MASK;
+ Calculated = (tCKmin == 0) ? 0 : ((MediumTimeBase * TimingMTB) + (FineTimeBase * TimingFTB) + (tCKmin - 1)) / tCKmin;
+ Actual[Profile] = MAX (Actual[Profile], Calculated);
+ break;
+ } //end switch
+
+ CommonCasMask[Profile] &= CasMask;
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ " % 7u % 10u % 8u % 5u %6u % 8Xh\n",
+ Profile,
+ Controller,
+ Channel,
+ Dimm,
+ Calculated,
+ CasMask
+ );
+ } //if DimmOut->Status
+ } //for Dimm
+ } //for Channel
+ } //for Controller
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " Profile %u common set of supported CAS Latency values = %Xh\n", Profile, CommonCasMask[Profile]);
+
+ if ((Profile >= XMP_PROFILE1) && (tCKmin == 0)) {
+ continue;
+ }
+
+ Found[Profile] = FALSE;
+ ConvertClock2Freq (MrcData, Outputs->RefClk, tCKmin, &tCKminIndex);
+ if ((Profile >= XMP_PROFILE1) && (Outputs->RefClk == MRC_REF_CLOCK_133) && (Outputs->Capable100)) {
+ ConvertClock2Freq (MrcData, MRC_REF_CLOCK_100, tCKmin, &tCKmin100);
+ if (tCKmin100 > tCKminIndex) {
+ tCKminIndex = tCKmin100;
+ if (Inputs->MemoryProfile == Profile) {
+ Outputs->RefClk = MRC_REF_CLOCK_100;
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " Profile%u is RefClk 100 capable, switching to RefClk 100\n", Profile);
+ }
+ }
+ do {
+ for (; !Found[Profile] && (Actual[Profile] <= tCLLimitMax); Actual[Profile]++) {
+ if ((UserProfile) ||
+ ((MRC_BIT0 == ((CommonCasMask[Profile] >> (Actual[Profile] - tCLLimitMin)) & MRC_BIT0)) &&
+ ((Actual[Profile] * tCKmin) <= MRC_TaaMAX))) {
+ Found[Profile] = TRUE;
+ if (Profile == Inputs->MemoryProfile) {
+ Outputs->MemoryClock = tCKmin;
+ Status = TRUE;
+ }
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ if (DIMM_PRESENT == DimmOut->Status) {
+ DimmOut->Timing[Profile].tCL = (U16) Actual[Profile];
+ ChannelOut->Timing[Profile].tCL = (U16) Actual[Profile];
+ DimmOut->Timing[Profile].tCK = tCKmin;
+ ChannelOut->Timing[Profile].tCK = tCKmin;
+ } //if
+ } //for Dimm
+ } //for Channel
+ } //for Controller
+ break;
+ } //if
+ } //for Actual[Profile]
+ if (!Found[Profile]) {
+ if (UserProfile && ((Inputs->Ratio > 0) || (tCLOverride == TRUE))) {
+ break;
+ } else {
+ tCKminIndexSave = tCKminIndex;
+ while (--tCKminIndex > 0) {
+ if ((Range[tCKminIndex].RefClkFlag == 3) ||
+ ((Range[tCKminIndex].RefClkFlag == 1) && (Outputs->RefClk == MRC_REF_CLOCK_133)) ||
+ ((Range[tCKminIndex].RefClkFlag == 2) && (Outputs->RefClk == MRC_REF_CLOCK_100))) {
+ tCKmin = Range[tCKminIndex].tCK;
+ ConvertClock2Freq (MrcData, Outputs->RefClk, tCKmin, &tCKminIndex);
+ Actual[Profile] = (tCKmin == 0) ? 0 : ((MediumTimeBase * TimingMTB) + (FineTimeBase * TimingFTB) + (tCKmin - 1)) / tCKmin;
+ MRC_DEBUG_MSG (Debug,
+ MSG_LEVEL_WARNING,
+ "Warning: The memory frequency is being downgraded on profile %u, from %u to %u and the new tCL is %u\n",
+ Profile,
+ Range[tCKminIndexSave].Frequency,
+ Range[tCKminIndex].Frequency,
+ Actual[Profile]);
+ break;
+ }
+ }
+ }
+ }
+ } while (!Found[Profile] && (tCKminIndex > 0));
+ } //for Profile
+
+ Outputs->Frequency = ConvertClock2Freq (MrcData, Outputs->RefClk, Outputs->MemoryClock, NULL);
+
+#ifdef MRC_DEBUG_PRINT
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %s%u:", BestCaseString, MAX_PROFILE - 1);
+ for (Profile = STD_PROFILE; Profile < MAX_PROFILE; Profile++) {
+ if (((Profile == XMP_PROFILE1) || (Profile == XMP_PROFILE2)) && (!(Outputs->XmpProfileEnable))) {
+ continue;
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %u", Found[Profile] ? Actual[Profile] : 0);
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n Memory clock = %ufs\n", Outputs->MemoryClock);
+#endif
+
+ return (Status);
+}
+
+/**
+ @brief
+ Calculate the minimum tCWL timing value for the given memory frequency.
+ We calculate timings for all profiles so that this information can be passed out of MRC.
+
+ @param[in, out] MrcData - Pointer to MrcData data structure.
+
+ @retval TRUE if there are DIMMs present, otherwise FALSE.
+**/
+static
+BOOL
+GetChannelDimmtCWL (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ const MrcInput *Inputs;
+ const MrcControllerIn *ControllerIn;
+ const MrcChannelIn *ChannelIn;
+ const MrcDimmIn *DimmIn;
+ const MrcSpd *Spd;
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ MrcDimmOut *DimmOut;
+ MrcTimeBase *TimeBase;
+ MrcProfile Profile;
+ U8 Controller;
+ U8 Channel;
+ U8 Dimm;
+ U32 tCKmin;
+ S32 MediumTimebase;
+ S32 FineTimebase;
+ U32 Actual[MAX_PROFILE];
+ U32 Calculated;
+ U32 MaxPossible;
+ U32 TimingMTB;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ Debug = &Inputs->Debug;
+ MaxPossible = TCWLMAXPOSSIBLE;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %s:\n %s\n", tCWLString, HeaderString);
+
+ //
+ // Find the smallest timing value for all the given DIMMs, for all the profiles.
+ //
+ for (Profile = STD_PROFILE; Profile < MAX_PROFILE; Profile++) {
+ if (((Profile == XMP_PROFILE1) || (Profile == XMP_PROFILE2)) && (!(Outputs->XmpProfileEnable))) {
+ continue;
+ }
+ Actual[Profile] = 0;
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerIn = &Inputs->Controller[Controller];
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelIn = &ControllerIn->Channel[Channel];
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmIn = &ChannelIn->Dimm[Dimm];
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ if (DIMM_PRESENT == DimmOut->Status) {
+ Spd = &DimmIn->Spd;
+ tCKmin = DimmOut->Timing[Profile].tCK;
+ TimeBase = &ChannelOut->TimeBase[Dimm][Profile];
+ MediumTimebase = TimeBase->Mtb;
+ FineTimebase = TimeBase->Ftb;
+ Calculated = 0;
+ switch (Profile) {
+ case XMP_PROFILE1:
+ case XMP_PROFILE2:
+#if (SUPPORT_XMP == SUPPORT)
+ if (((Profile == XMP_PROFILE1) && ((DimmOut->XmpSupport & 1) != 0)) ||
+ ((Profile == XMP_PROFILE2) && ((DimmOut->XmpSupport & 2) != 0))) {
+ TimingMTB = Spd->Ddr3.Xmp.Data[Profile - XMP_PROFILE1].tCWLmin.Bits.tCWLmin;
+ Calculated = (tCKmin == 0) ? 0 : ((MediumTimebase * TimingMTB) + (tCKmin - 1)) / tCKmin;
+ } else {
+ Calculated = 0;
+ }
+#endif // SUPPORT_XMP
+ break;
+ case USER_PROFILE:
+ if (DimmIn->Timing.tCWL > 0) {
+ Calculated = DimmIn->Timing.tCWL;
+ break;
+ } else {
+ // In AUTO mode, so no break.
+ }
+ case STD_PROFILE:
+ default:
+ TimingMTB = 0;
+#if (SUPPORT_LPDDR3 == SUPPORT)
+ if (DimmOut->DdrType == MRC_DDR_TYPE_LPDDR3) {
+ //
+ // WL Set A from MR2 spec, adding 1 to take tDQSS into account.
+ // We will subtract this 1 when programming TC_BANK_RANK_D.tWCL
+ //
+ if (tCKmin <= MRC_DDR3_1333_TCK_MIN) {
+ Calculated = 7;
+ } else if (tCKmin <= MRC_DDR3_1067_TCK_MIN) {
+ Calculated = 5;
+ } else if (tCKmin <= MRC_DDR3_800_TCK_MIN) {
+ Calculated = 4;
+ }
+ } else
+#endif // SUPPORT_LPDDR3
+ {
+ if (tCKmin <= MRC_DDR3_2133_TCK_MIN) {
+ Calculated = 10;
+ } else if (tCKmin <= MRC_DDR3_1867_TCK_MIN) {
+ Calculated = 9;
+ } else if (tCKmin <= MRC_DDR3_1600_TCK_MIN) {
+ Calculated = 8;
+ } else if (tCKmin <= MRC_DDR3_1333_TCK_MIN) {
+ Calculated = 7;
+ } else if (tCKmin <= MRC_DDR3_1067_TCK_MIN) {
+ Calculated = 6;
+ } else if (tCKmin <= MRC_DDR3_800_TCK_MIN) {
+ Calculated = 5;
+ }
+ }
+ break;
+ } //switch
+
+ Calculated = MIN (Calculated, MaxPossible);
+ Actual[Profile] = MAX (Actual[Profile], Calculated);
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ " % 7u % 10u % 8u % 5u %6u\n",
+ Profile,
+ Controller,
+ Channel,
+ Dimm,
+ Calculated
+ );
+ } //DimmOut->Status
+ } //Dimm
+ } //Channel
+ } //Controller
+ } //Profile
+
+ //
+ // Set the best case timing for all controllers/channels/dimms, for each profile.
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %s%u:", BestCaseString, MAX_PROFILE - 1);
+ for (Profile = STD_PROFILE; Profile < MAX_PROFILE; Profile++) {
+ if (((Profile == XMP_PROFILE1) || (Profile == XMP_PROFILE2)) && (!(Outputs->XmpProfileEnable))) {
+ continue;
+ }
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ DimmOut->Timing[Profile].tCWL = (U16) Actual[Profile];
+ ChannelOut->Timing[Profile].tCWL = (U16) Actual[Profile];
+ }
+ }
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %u", Actual[Profile]);
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+
+ return TRUE;
+}
+
+#if (MRC_DDR3_LPDDR_SUPPORTED)
+/**
+ @brief
+ Calculate the minimum tFAW timing value for the given memory frequency.
+
+ @param[in, out] MrcData - Pointer to MrcData data structure.
+
+ @retval TRUE if there are DIMMs present, otherwise FALSE.
+**/
+static
+BOOL
+GetChannelDimmtFAW (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ const MrcInput *Inputs;
+ const MrcControllerIn *ControllerIn;
+ const MrcChannelIn *ChannelIn;
+ const MrcDimmIn *DimmIn;
+ const MrcSpd *Spd;
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ MrcDimmOut *DimmOut;
+ MrcTimeBase *TimeBase;
+ MrcProfile Profile;
+ U8 Controller;
+ U8 Channel;
+ U8 Dimm;
+ U32 tCKmin;
+ U32 TimingMTB;
+ S32 MediumTimebase;
+ S32 FineTimebase;
+ U32 Actual[MAX_PROFILE];
+ U32 Calculated;
+#if (SUPPORT_XMP == SUPPORT)
+ const SPD_EXTREME_MEMORY_PROFILE_DATA *Data;
+#endif
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ Debug = &Inputs->Debug;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %s:\n %s\n", tFAWString, HeaderString);
+
+ //
+ // Find the smallest timing value for all the given DIMMs, for all the profiles.
+ //
+ for (Profile = STD_PROFILE; Profile < MAX_PROFILE; Profile++) {
+ if (((Profile == XMP_PROFILE1) || (Profile == XMP_PROFILE2)) && (!(Outputs->XmpProfileEnable))) {
+ continue;
+ }
+ Actual[Profile] = 0;
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerIn = &Inputs->Controller[Controller];
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelIn = &ControllerIn->Channel[Channel];
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmIn = &ChannelIn->Dimm[Dimm];
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ if (DIMM_PRESENT == DimmOut->Status) {
+ Spd = &DimmIn->Spd;
+ Calculated = 0;
+ tCKmin = DimmOut->Timing[Profile].tCK;
+ TimeBase = &ChannelOut->TimeBase[Dimm][Profile];
+ MediumTimebase = TimeBase->Mtb;
+ FineTimebase = TimeBase->Ftb;
+ switch (Profile) {
+ case XMP_PROFILE1:
+ case XMP_PROFILE2:
+#if (SUPPORT_XMP == SUPPORT)
+ if (((Profile == XMP_PROFILE1) && ((DimmOut->XmpSupport & 1) != 0)) ||
+ ((Profile == XMP_PROFILE2) && ((DimmOut->XmpSupport & 2) != 0))) {
+ Data = &Spd->Ddr3.Xmp.Data[Profile - XMP_PROFILE1];
+ TimingMTB = ((U32) (Data->tFAWMinUpper.Bits.tFAWminUpper) << 8) | (U32) (Data->tFAWmin.Bits.tFAWmin);
+ Calculated = (tCKmin == 0) ? 0 : ((MediumTimebase * TimingMTB) + (tCKmin - 1)) / tCKmin;
+ } else {
+ Calculated = 0;
+ }
+#endif //SUPPORT_XMP
+ break;
+ case USER_PROFILE:
+ if (DimmIn->Timing.tFAW > 0) {
+ Calculated = DimmIn->Timing.tFAW;
+ break;
+ } else {
+ // In AUTO mode, so no break.
+ }
+ case STD_PROFILE:
+ default:
+ if (tCKmin > 0) {
+ TimingMTB = ((U32) (Spd->Ddr3.General.tFAWMinUpper.Bits.tFAWminUpper) << 8) | (U32) (Spd->Ddr3.General.tFAWmin.Bits.tFAWmin);
+ Calculated = (tCKmin == 0) ? 0 : ((MediumTimebase * TimingMTB) + (tCKmin - 1)) / tCKmin;
+ }
+ break;
+ } //switch
+
+ Calculated = MIN (Calculated, TFAWMAXPOSSIBLE);
+ Actual[Profile] = MAX (Actual[Profile], Calculated);
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ " % 7u % 10u % 8u % 5u %6u\n",
+ Profile,
+ Controller,
+ Channel,
+ Dimm,
+ Calculated
+ );
+ } //DimmOut->Status
+ } //Dimm
+ } //Channel
+ } //Controller
+ } //Profile
+
+ //
+ // Set the best case timing for all controllers/channels/dimms, for each profile.
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %s%u:", BestCaseString, MAX_PROFILE - 1);
+ for (Profile = STD_PROFILE; Profile < MAX_PROFILE; Profile++) {
+ if (((Profile == XMP_PROFILE1) || (Profile == XMP_PROFILE2)) && (!(Outputs->XmpProfileEnable))) {
+ continue;
+ }
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ DimmOut->Timing[Profile].tFAW = (U16) Actual[Profile];
+ ChannelOut->Timing[Profile].tFAW = (U16) Actual[Profile];
+ }
+ }
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %u", Actual[Profile]);
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+
+ return TRUE;
+}
+#endif
+
+/**
+ @brief
+ Calculate the minimum tRAS timing value for the given memory frequency.
+
+ @param[in, out] MrcData - Pointer to MrcData data structure.
+
+ @retval TRUE if there are DIMMs present, otherwise FALSE.
+**/
+static
+BOOL
+GetChannelDimmtRAS (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ const MrcInput *Inputs;
+ const MrcControllerIn *ControllerIn;
+ const MrcChannelIn *ChannelIn;
+ const MrcDimmIn *DimmIn;
+ const MrcSpd *Spd;
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ MrcDimmOut *DimmOut;
+ MrcTimeBase *TimeBase;
+ MrcProfile Profile;
+ U8 Controller;
+ U8 Channel;
+ U8 Dimm;
+ U32 tCKmin;
+ U32 TimingMTB;
+ S32 MediumTimebase;
+ S32 FineTimebase;
+ U32 Actual[MAX_PROFILE];
+ U32 Calculated;
+#if (SUPPORT_XMP == SUPPORT)
+ const SPD_EXTREME_MEMORY_PROFILE_DATA *Data;
+ U32 Index;
+#endif
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ Debug = &Inputs->Debug;
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %s:\n %s\n", tRASString, HeaderString);
+
+ //
+ // Find the smallest timing value for all the given DIMMs, for all the profiles.
+ //
+ for (Profile = STD_PROFILE; Profile < MAX_PROFILE; Profile++) {
+ if (((Profile == XMP_PROFILE1) || (Profile == XMP_PROFILE2)) && (!(Outputs->XmpProfileEnable))) {
+ continue;
+ }
+ Actual[Profile] = 0;
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerIn = &Inputs->Controller[Controller];
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelIn = &ControllerIn->Channel[Channel];
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmIn = &ChannelIn->Dimm[Dimm];
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ if (DIMM_PRESENT == DimmOut->Status) {
+ Spd = &DimmIn->Spd;
+ Calculated = 0;
+ tCKmin = DimmOut->Timing[Profile].tCK;
+ TimeBase = &ChannelOut->TimeBase[Dimm][Profile];
+ MediumTimebase = TimeBase->Mtb;
+ FineTimebase = TimeBase->Ftb;
+ switch (Profile) {
+ case XMP_PROFILE1:
+ case XMP_PROFILE2:
+#if (SUPPORT_XMP == SUPPORT)
+ if (((Profile == XMP_PROFILE1) && ((DimmOut->XmpSupport & 1) != 0)) ||
+ ((Profile == XMP_PROFILE2) && ((DimmOut->XmpSupport & 2) != 0))) {
+ Index = Profile - XMP_PROFILE1;
+ Data = &Spd->Ddr3.Xmp.Data[Index];
+ TimingMTB = ((U32) (Data->tRASMintRCMinUpper.Bits.tRASminUpper) << 8) | (U32) (Data->tRASmin.Bits.tRASmin);
+ Calculated = (tCKmin == 0) ? 0 : ((MediumTimebase * TimingMTB) + (tCKmin - 1)) / tCKmin;
+ } else {
+ Calculated = 0;
+ }
+#endif //SUPPORT_XMP
+ break;
+ case USER_PROFILE:
+ if (DimmIn->Timing.tRAS > 0) {
+ Calculated = DimmIn->Timing.tRAS;
+ break;
+ } else {
+ // In AUTO mode, so no break.
+ }
+ case STD_PROFILE:
+ default:
+ if (tCKmin > 0) {
+ TimingMTB = ((U32) (Spd->Ddr3.General.tRASMintRCMinUpper.Bits.tRASminUpper) << 8) | (U32) (Spd->Ddr3.General.tRASmin.Bits.tRASmin);
+ Calculated = (tCKmin == 0) ? 0 : ((MediumTimebase * TimingMTB) + (tCKmin - 1)) / tCKmin;
+ }
+ break;
+ } //switch
+
+ Calculated = MIN (Calculated, TRASMAXPOSSIBLE);
+ Actual[Profile] = MAX (Actual[Profile], Calculated);
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ " % 7u % 10u % 8u % 5u %6u\n",
+ Profile,
+ Controller,
+ Channel,
+ Dimm,
+ Calculated
+ );
+ } //DimmOut->Status
+ } //Dimm
+ } //Channel
+ } //Controller
+ } //Profile
+
+ //
+ // Set the best case timing for all controllers/channels/dimms, for each profile.
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %s%u:", BestCaseString, MAX_PROFILE - 1);
+ for (Profile = STD_PROFILE; Profile < MAX_PROFILE; Profile++) {
+ if (((Profile == XMP_PROFILE1) || (Profile == XMP_PROFILE2)) && (!(Outputs->XmpProfileEnable))) {
+ continue;
+ }
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ DimmOut->Timing[Profile].tRAS = (U16) Actual[Profile];
+ ChannelOut->Timing[Profile].tRAS = (U16) Actual[Profile];
+ }
+ }
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %u", Actual[Profile]);
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+
+ return TRUE;
+}
+
+/**
+ @brief
+ Calculate the minimum tRC timing value for the given memory frequency.
+
+ @param[in, out] MrcData - Pointer to MrcData data structure.
+
+ @retval TRUE if there are DIMMs present, otherwise FALSE.
+**/
+static
+BOOL
+GetChannelDimmtRC (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ const MrcInput *Inputs;
+ const MrcControllerIn *ControllerIn;
+ const MrcChannelIn *ChannelIn;
+ const MrcDimmIn *DimmIn;
+ const MrcSpd *Spd;
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ MrcDimmOut *DimmOut;
+ MrcTimeBase *TimeBase;
+ MrcProfile Profile;
+ U8 Controller;
+ U8 Channel;
+ U8 Dimm;
+ U32 tCKmin;
+ U32 TimingMTB;
+ S32 TimingFTB;
+ S32 MediumTimebase;
+ S32 FineTimebase;
+ U32 Actual[MAX_PROFILE];
+ U32 Calculated;
+#if (SUPPORT_XMP == SUPPORT)
+ const SPD_EXTREME_MEMORY_PROFILE_DATA *Data;
+ U32 Index;
+#endif
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ Debug = &Inputs->Debug;
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %s:\n %s\n", tRCString, HeaderString);
+
+ //
+ // Find the smallest timing value for all the given DIMMs, for all the profiles.
+ //
+ for (Profile = STD_PROFILE; Profile < MAX_PROFILE; Profile++) {
+ if (((Profile == XMP_PROFILE1) || (Profile == XMP_PROFILE2)) && (!(Outputs->XmpProfileEnable))) {
+ continue;
+ }
+ Actual[Profile] = 0;
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerIn = &Inputs->Controller[Controller];
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelIn = &ControllerIn->Channel[Channel];
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmIn = &ChannelIn->Dimm[Dimm];
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ if (DIMM_PRESENT == DimmOut->Status) {
+ Spd = &DimmIn->Spd;
+ Calculated = 0;
+ tCKmin = DimmOut->Timing[Profile].tCK;
+ TimeBase = &ChannelOut->TimeBase[Dimm][Profile];
+ MediumTimebase = TimeBase->Mtb;
+ FineTimebase = TimeBase->Ftb;
+ switch (Profile) {
+ case XMP_PROFILE1:
+ case XMP_PROFILE2:
+#if (SUPPORT_XMP == SUPPORT)
+ if (((Profile == XMP_PROFILE1) && ((DimmOut->XmpSupport & 1) != 0)) ||
+ ((Profile == XMP_PROFILE2) && ((DimmOut->XmpSupport & 2) != 0))) {
+ Index = Profile - XMP_PROFILE1;
+ Data = &Spd->Ddr3.Xmp.Data[Index];
+ TimingMTB = ((U32) (Data->tRASMintRCMinUpper.Bits.tRCminUpper) << 8) | (U32) (Data->tRCmin.Bits.tRCmin);
+ TimingFTB = (DimmOut->XmpRevision == 0x13) ? Data->tRCminFine.Bits.tRCminFine : 0;
+ Calculated = (tCKmin == 0) ? 0 : ((MediumTimebase * TimingMTB) + (FineTimebase * TimingFTB) + (tCKmin - 1)) / tCKmin;
+ } else {
+ Calculated = 0;
+ }
+#endif //SUPPORT_XMP
+ break;
+ case USER_PROFILE:
+ if (DimmIn->Timing.tRC > 0) {
+ Calculated = DimmIn->Timing.tRC;
+ break;
+ } else {
+ // In AUTO mode, so no break.
+ }
+ case STD_PROFILE:
+ default:
+ if (tCKmin > 0) {
+ TimingMTB = ((U32) (Spd->Ddr3.General.tRASMintRCMinUpper.Bits.tRCminUpper) << 8) | (U32) (Spd->Ddr3.General.tRCmin.Bits.tRCmin);
+ TimingFTB = Spd->Ddr3.General.tRCminFine.Bits.tRCminFine;
+ Calculated = (tCKmin == 0) ? 0 : ((MediumTimebase * TimingMTB) + (FineTimebase * TimingFTB) + (tCKmin - 1)) / tCKmin;
+ }
+ break;
+ } //switch
+
+ Calculated = MIN (Calculated, TRCMAXPOSSIBLE);
+ Actual[Profile] = MAX (Actual[Profile], Calculated);
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ " % 7u % 10u % 8u % 5u %6u\n",
+ Profile,
+ Controller,
+ Channel,
+ Dimm,
+ Calculated
+ );
+ } //DimmOut->Status
+ } //Dimm
+ } //Channel
+ } //Controller
+ } //Profile
+
+ //
+ // Set the best case timing for all controllers/channels/dimms, for each profile.
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %s%u:", BestCaseString, MAX_PROFILE - 1);
+ for (Profile = STD_PROFILE; Profile < MAX_PROFILE; Profile++) {
+ if (((Profile == XMP_PROFILE1) || (Profile == XMP_PROFILE2)) && (!(Outputs->XmpProfileEnable))) {
+ continue;
+ }
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ DimmOut->Timing[Profile].tRC = (U16) Actual[Profile];
+ ChannelOut->Timing[Profile].tRC = (U16) Actual[Profile];
+ }
+ }
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %u", Actual[Profile]);
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+
+ return TRUE;
+}
+
+/**
+ @brief
+ Calculate the minimum tRCD timing value for the given memory frequency.
+
+ @param[in, out] MrcData - Pointer to MrcData data structure.
+
+ @retval TRUE if there are DIMMs present, otherwise FALSE.
+**/
+static
+BOOL
+GetChannelDimmtRCD (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ const MrcInput *Inputs;
+ const MrcControllerIn *ControllerIn;
+ const MrcChannelIn *ChannelIn;
+ const MrcDimmIn *DimmIn;
+ const MrcSpd *Spd;
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ MrcDimmOut *DimmOut;
+ MrcTimeBase *TimeBase;
+ MrcProfile Profile;
+ U8 Controller;
+ U8 Channel;
+ U8 Dimm;
+ U32 tCKmin;
+ U32 TimingMTB;
+ S32 TimingFTB;
+ S32 MediumTimebase;
+ S32 FineTimebase;
+ U32 Actual[MAX_PROFILE];
+ U32 Calculated;
+#if (SUPPORT_XMP == SUPPORT)
+ const SPD_EXTREME_MEMORY_PROFILE_DATA *Data;
+ U32 Index;
+#endif
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ Debug = &Inputs->Debug;
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %s:\n %s\n", tRCDString, HeaderString);
+
+ //
+ // Find the smallest timing value for all the given DIMMs, for all the profiles.
+ //
+ for (Profile = STD_PROFILE; Profile < MAX_PROFILE; Profile++) {
+ if (((Profile == XMP_PROFILE1) || (Profile == XMP_PROFILE2)) && (!(Outputs->XmpProfileEnable))) {
+ continue;
+ }
+ Actual[Profile] = 0;
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerIn = &Inputs->Controller[Controller];
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelIn = &ControllerIn->Channel[Channel];
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmIn = &ChannelIn->Dimm[Dimm];
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ if (DIMM_PRESENT == DimmOut->Status) {
+ Spd = &DimmIn->Spd;
+ Calculated = 0;
+ tCKmin = DimmOut->Timing[Profile].tCK;
+ TimeBase = &ChannelOut->TimeBase[Dimm][Profile];
+ MediumTimebase = TimeBase->Mtb;
+ FineTimebase = TimeBase->Ftb;
+ switch (Profile) {
+ case XMP_PROFILE1:
+ case XMP_PROFILE2:
+#if (SUPPORT_XMP == SUPPORT)
+ if (((Profile == XMP_PROFILE1) && ((DimmOut->XmpSupport & 1) != 0)) ||
+ ((Profile == XMP_PROFILE2) && ((DimmOut->XmpSupport & 2) != 0))) {
+ Index = Profile - XMP_PROFILE1;
+ Data = &Spd->Ddr3.Xmp.Data[Index];
+ TimingMTB = Data->tRCDmin.Bits.tRCDmin;
+ TimingFTB = (DimmOut->XmpRevision == 0x13) ? Data->tRCDminFine.Bits.tRCDminFine : 0;
+ Calculated = (tCKmin == 0) ? 0 : ((MediumTimebase * TimingMTB) + (FineTimebase * TimingFTB) + (tCKmin - 1)) / tCKmin;
+ } else {
+ Calculated = 0;
+ }
+#endif //SUPPORT_XMP
+ break;
+ case USER_PROFILE:
+ if (DimmIn->Timing.tRCD > 0) {
+ Calculated = DimmIn->Timing.tRCD;
+ break;
+ } else {
+ // In AUTO mode, so no break.
+ }
+ case STD_PROFILE:
+ default:
+ if (tCKmin > 0) {
+ TimingMTB = Spd->Ddr3.General.tRCDmin.Bits.tRCDmin;
+ TimingFTB = Spd->Ddr3.General.tRCDminFine.Bits.tRCDminFine;
+ Calculated = (tCKmin == 0) ? 0 : ((MediumTimebase * TimingMTB) + (FineTimebase * TimingFTB) + (tCKmin - 1)) / tCKmin;
+ }
+ break;
+ } //switch
+
+ Calculated = MIN (Calculated, TRCDMAXPOSSIBLE);
+ Actual[Profile] = MAX (Actual[Profile], Calculated);
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ " % 7u % 10u % 8u % 5u %6u\n",
+ Profile,
+ Controller,
+ Channel,
+ Dimm,
+ Calculated
+ );
+ } //DimmOut->Status
+ } //Dimm
+ } //Channel
+ } //Controller
+ } //Profile
+
+ //
+ // Set the best case timing for all controllers/channels/dimms, for each profile.
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %s%u:", BestCaseString, MAX_PROFILE - 1);
+ for (Profile = STD_PROFILE; Profile < MAX_PROFILE; Profile++) {
+ if (((Profile == XMP_PROFILE1) || (Profile == XMP_PROFILE2)) && (!(Outputs->XmpProfileEnable))) {
+ continue;
+ }
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ DimmOut->Timing[Profile].tRCD = (U16) Actual[Profile];
+ ChannelOut->Timing[Profile].tRCD = (U16) Actual[Profile];
+ }
+ }
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %u", Actual[Profile]);
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+
+ return TRUE;
+}
+
+/**
+ @brief
+ Calculate the minimum tREFI timing value for the given memory frequency.
+
+ @param[in, out] MrcData - Pointer to MrcData data structure.
+
+ @retval TRUE if there are DIMMs present, otherwise FALSE.
+**/
+static
+BOOL
+GetChannelDimmtREFI (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ const MrcInput *Inputs;
+ const MrcControllerIn *ControllerIn;
+ const MrcChannelIn *ChannelIn;
+ const MrcDimmIn *DimmIn;
+ const MrcSpd *Spd;
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ MrcDimmOut *DimmOut;
+ MrcTimeBase *TimeBase;
+ MrcProfile Profile;
+ U8 Controller;
+ U8 Channel;
+ U8 Dimm;
+ U32 tCKmin;
+ S32 MediumTimebase;
+ S32 FineTimebase;
+ U32 Actual[MAX_PROFILE];
+ U32 Calculated;
+ U32 TimingMTB;
+#if (SUPPORT_XMP == SUPPORT)
+ U32 Index;
+#endif
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ Debug = &Inputs->Debug;
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %s:\n %s\n", tREFIString, HeaderString);
+
+ //
+ // Find the smallest timing value for all the given DIMMs, for all the profiles.
+ //
+ for (Profile = STD_PROFILE; Profile < MAX_PROFILE; Profile++) {
+ if (((Profile == XMP_PROFILE1) || (Profile == XMP_PROFILE2)) && (!(Outputs->XmpProfileEnable))) {
+ continue;
+ }
+ Actual[Profile] = 0;
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerIn = &Inputs->Controller[Controller];
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelIn = &ControllerIn->Channel[Channel];
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmIn = &ChannelIn->Dimm[Dimm];
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ if (DIMM_PRESENT == DimmOut->Status) {
+ Spd = &DimmIn->Spd;
+ Calculated = 0;
+ tCKmin = DimmOut->Timing[Profile].tCK;
+ TimeBase = &ChannelOut->TimeBase[Dimm][Profile];
+ MediumTimebase = TimeBase->Mtb;
+ FineTimebase = TimeBase->Ftb;
+ switch (Profile) {
+ case XMP_PROFILE1:
+ case XMP_PROFILE2:
+#if (SUPPORT_XMP == SUPPORT)
+ if (((Profile == XMP_PROFILE1) && ((DimmOut->XmpSupport & 1) != 0)) ||
+ ((Profile == XMP_PROFILE2) && ((DimmOut->XmpSupport & 2) != 0))) {
+ Index = Profile - XMP_PROFILE1;
+ TimingMTB = Spd->Ddr3.Xmp.Data[Index].tREFImin.Bits.tREFImin;
+ Calculated = (tCKmin == 0) ? 0 : (U32) (MrcOemMemoryDivideU64ByU64 (
+ ((MrcOemMemoryMultiplyU64ByU32 (MediumTimebase, TimingMTB * TREFIMULTIPLIER)) + (tCKmin - 1)),
+ tCKmin));
+ } else {
+ Calculated = 0;
+ }
+#endif //SUPPORT_XMP
+ break;
+ case USER_PROFILE:
+ if (DimmIn->Timing.tREFI > 0) {
+ Calculated = DimmIn->Timing.tREFI;
+ break;
+ } else {
+ // In AUTO mode, so no break.
+ }
+ case STD_PROFILE:
+ default:
+ if (tCKmin > 0) {
+ switch (DimmOut->DdrType)
+ {
+#if (MRC_DDR3_LPDDR_SUPPORTED)
+ case MRC_DDR_TYPE_DDR3:
+ TimingMTB = TREFIMIN_DDR3;
+ break;
+#endif
+#if (SUPPORT_LPDDR3 == SUPPORT)
+ case MRC_DDR_TYPE_LPDDR3:
+ TimingMTB = TREFIMIN_LPDDR3;
+ break;
+#endif
+ default:
+ TimingMTB = TREFIMIN_DDR3;
+ break;
+ }
+
+ Calculated = (tCKmin == 0) ? 0 : ((TimingMTB + ((tCKmin / 1000) - 1)) / (tCKmin / 1000));
+ }
+ break;
+ } //switch
+
+ Calculated = MIN (Calculated, TREFIMAXPOSSIBLE);
+ Actual[Profile] = MAX (Actual[Profile], Calculated);
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ " % 7u % 10u % 8u % 5u %6u\n",
+ Profile,
+ Controller,
+ Channel,
+ Dimm,
+ Calculated
+ );
+ } //DimmOut->Status
+ } //Dimm
+ } //Channel
+ } //Controller
+ } //Profile
+
+ //
+ // Set the best case timing for all controllers/channels/dimms, for each profile.
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %s%u:", BestCaseString, MAX_PROFILE - 1);
+ for (Profile = STD_PROFILE; Profile < MAX_PROFILE; Profile++) {
+ if (((Profile == XMP_PROFILE1) || (Profile == XMP_PROFILE2)) && (!(Outputs->XmpProfileEnable))) {
+ continue;
+ }
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ DimmOut->Timing[Profile].tREFI = (U16) Actual[Profile];
+ ChannelOut->Timing[Profile].tREFI = (U16) Actual[Profile];
+ }
+ }
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %u", Actual[Profile]);
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+
+ return TRUE;
+}
+
+/**
+ @brief
+ Calculate the minimum tRFC timing value for the given memory frequency.
+
+ @param[in, out] MrcData - Pointer to MrcData data structure.
+
+ @retval TRUE if there are DIMMs present, otherwise FALSE.
+**/
+static
+BOOL
+GetChannelDimmtRFC (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ const MrcInput *Inputs;
+ const MrcControllerIn *ControllerIn;
+ const MrcChannelIn *ChannelIn;
+ const MrcDimmIn *DimmIn;
+ const MrcSpd *Spd;
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ MrcDimmOut *DimmOut;
+ MrcTimeBase *TimeBase;
+ MrcProfile Profile;
+ U8 Controller;
+ U8 Channel;
+ U8 Dimm;
+ U32 tCKmin;
+ U32 TimingMTB;
+ S32 MediumTimebase;
+ S32 FineTimebase;
+ U32 Actual[MAX_PROFILE];
+ U32 Calculated;
+#if (SUPPORT_XMP == SUPPORT)
+ U32 Index;
+#endif
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ Debug = &Inputs->Debug;
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %s:\n %s\n", tRFCString, HeaderString);
+
+ //
+ // Find the smallest timing value for all the given DIMMs.
+ //
+ for (Profile = STD_PROFILE; Profile < MAX_PROFILE; Profile++) {
+ if (((Profile == XMP_PROFILE1) || (Profile == XMP_PROFILE2)) && (!(Outputs->XmpProfileEnable))) {
+ continue;
+ }
+ Actual[Profile] = 0;
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerIn = &Inputs->Controller[Controller];
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelIn = &ControllerIn->Channel[Channel];
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmIn = &ChannelIn->Dimm[Dimm];
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ if (DIMM_PRESENT == DimmOut->Status) {
+ Spd = &DimmIn->Spd;
+ Calculated = 0;
+ tCKmin = DimmOut->Timing[Profile].tCK;
+ TimeBase = &ChannelOut->TimeBase[Dimm][Profile];
+ MediumTimebase = TimeBase->Mtb;
+ FineTimebase = TimeBase->Ftb;
+ switch (Profile) {
+ case XMP_PROFILE1:
+ case XMP_PROFILE2:
+#if (SUPPORT_XMP == SUPPORT)
+ if (((Profile == XMP_PROFILE1) && ((DimmOut->XmpSupport & 1) != 0)) ||
+ ((Profile == XMP_PROFILE2) && ((DimmOut->XmpSupport & 2) != 0))) {
+ Index = Profile - XMP_PROFILE1;
+ TimingMTB = Spd->Ddr3.Xmp.Data[Index].tRFCmin.Bits.tRFCmin;
+ Calculated = (tCKmin == 0) ? 0 : ((MediumTimebase * TimingMTB) + (tCKmin - 1)) / tCKmin;
+ } else {
+ Calculated = 0;
+ }
+#endif //SUPPORT_XMP
+ break;
+ case USER_PROFILE:
+ if (DimmIn->Timing.tRFC > 0) {
+ Calculated = DimmIn->Timing.tRFC;
+ break;
+ } else {
+ // In AUTO mode, so no break.
+ }
+ case STD_PROFILE:
+ default:
+ if (tCKmin > 0) {
+ TimingMTB = Spd->Ddr3.General.tRFCmin.Bits.tRFCmin;
+ //
+ // @todo: Temp w/a for 8GB dimms
+ // if ((DimmOut->DimmCapacity == 8192) && (TimingMTB != 2400)) {
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%s %u/%u/%u tRFC MTB = %u .., W/A - changing it to 2400\n", CcdString, Controller, Channel, Dimm, TimingMTB);
+ // TimingMTB = 2400;
+ // }
+ //
+
+ Calculated = (tCKmin == 0) ? 0 : ((MediumTimebase * TimingMTB) + (tCKmin - 1)) / tCKmin;
+ }
+ break;
+ } //switch
+
+ Calculated = MIN (Calculated, TRFCMAXPOSSIBLE);
+ Actual[Profile] = MAX (Actual[Profile], Calculated);
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ " % 7u % 10u % 8u % 5u %6u\n",
+ Profile,
+ Controller,
+ Channel,
+ Dimm,
+ Calculated
+ );
+ } //DimmOut->Status
+ } //Dimm
+ } //Channel
+ } //Controller
+ } //Profile
+
+ //
+ // Set the best case timing for all controllers/channels/dimms, for each profile.
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %s%u:", BestCaseString, MAX_PROFILE - 1);
+ for (Profile = STD_PROFILE; Profile < MAX_PROFILE; Profile++) {
+ if (((Profile == XMP_PROFILE1) || (Profile == XMP_PROFILE2)) && (!(Outputs->XmpProfileEnable))) {
+ continue;
+ }
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ DimmOut->Timing[Profile].tRFC = (U16) Actual[Profile];
+ ChannelOut->Timing[Profile].tRFC = (U16) Actual[Profile];
+ }
+ }
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %u", Actual[Profile]);
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+
+ return TRUE;
+}
+
+
+/**
+ @brief
+ Calculate the minimum tRP timing value for the given memory frequency.
+
+ @param[in, out] MrcData - Pointer to MrcData data structure.
+
+ @retval TRUE if there are DIMMs present, otherwise FALSE.
+**/
+static
+BOOL
+GetChannelDimmtRP (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ const MrcInput *Inputs;
+ const MrcControllerIn *ControllerIn;
+ const MrcChannelIn *ChannelIn;
+ const MrcDimmIn *DimmIn;
+ const MrcSpd *Spd;
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ MrcDimmOut *DimmOut;
+ MrcTimeBase *TimeBase;
+ MrcProfile Profile;
+ U8 Controller;
+ U8 Channel;
+ U8 Dimm;
+ U32 tCKmin;
+ S32 MediumTimebase;
+ S32 FineTimebase;
+ U32 TimingMTB;
+ S32 TimingFTB;
+ U32 Actual[MAX_PROFILE];
+ U32 Calculated;
+#if (SUPPORT_XMP == SUPPORT)
+ U32 Index;
+ const SPD_EXTREME_MEMORY_PROFILE_DATA *Data;
+#endif
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ Debug = &Inputs->Debug;
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %s:\n %s\n", tRPString, HeaderString);
+
+ //
+ // Find the smallest timing value for all the given DIMMs, for all the profiles.
+ //
+ for (Profile = STD_PROFILE; Profile < MAX_PROFILE; Profile++) {
+ if (((Profile == XMP_PROFILE1) || (Profile == XMP_PROFILE2)) && (!(Outputs->XmpProfileEnable))) {
+ continue;
+ }
+ Actual[Profile] = 0;
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerIn = &Inputs->Controller[Controller];
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelIn = &ControllerIn->Channel[Channel];
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmIn = &ChannelIn->Dimm[Dimm];
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ if (DIMM_PRESENT == DimmOut->Status) {
+ Spd = &DimmIn->Spd;
+ Calculated = 0;
+ tCKmin = DimmOut->Timing[Profile].tCK;
+ TimeBase = &ChannelOut->TimeBase[Dimm][Profile];
+ MediumTimebase = TimeBase->Mtb;
+ FineTimebase = TimeBase->Ftb;
+ switch (Profile) {
+ case XMP_PROFILE1:
+ case XMP_PROFILE2:
+#if (SUPPORT_XMP == SUPPORT)
+ if (((Profile == XMP_PROFILE1) && ((DimmOut->XmpSupport & 1) != 0)) ||
+ ((Profile == XMP_PROFILE2) && ((DimmOut->XmpSupport & 2) != 0))) {
+ Index = Profile - XMP_PROFILE1;
+ Data = &Spd->Ddr3.Xmp.Data[Index];
+ TimingMTB = Data->tRPmin.Bits.tRPmin;
+ TimingFTB = (DimmOut->XmpRevision == 0x13) ? Data->tRPminFine.Bits.tRPminFine : 0;
+ Calculated = (tCKmin == 0) ? 0 : ((MediumTimebase * TimingMTB) + (FineTimebase * TimingFTB) + (tCKmin - 1)) / tCKmin;
+ } else {
+ Calculated = 0;
+ }
+#endif //SUPPORT_XMP
+ break;
+ case USER_PROFILE:
+ if (DimmIn->Timing.tRP > 0) {
+ Calculated = DimmIn->Timing.tRP;
+ break;
+ } else {
+ // In AUTO mode, so no break.
+ }
+ case STD_PROFILE:
+ default:
+ if (tCKmin > 0) {
+ TimingMTB = Spd->Ddr3.General.tRPmin.Bits.tRPmin;
+ TimingFTB = Spd->Ddr3.General.tRPminFine.Bits.tRPminFine;
+ Calculated = (tCKmin == 0) ? 0 : ((MediumTimebase * TimingMTB) + (FineTimebase * TimingFTB) + (tCKmin - 1)) / tCKmin;
+ }
+ break;
+ } //switch
+
+ Calculated = MIN (Calculated, TRPMAXPOSSIBLE);
+ Actual[Profile] = MAX (Actual[Profile], Calculated);
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ " % 7u % 10u % 8u % 5u %6u\n",
+ Profile,
+ Controller,
+ Channel,
+ Dimm,
+ Calculated
+ );
+ } //DimmOut->Status
+ } //Dimm
+ } //Channel
+ } //Controller
+ } //Profile
+
+ //
+ // Set the best case timing for all controllers/channels/dimms, for each profile.
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %s%u:", BestCaseString, MAX_PROFILE - 1);
+ for (Profile = STD_PROFILE; Profile < MAX_PROFILE; Profile++) {
+ if (((Profile == XMP_PROFILE1) || (Profile == XMP_PROFILE2)) && (!(Outputs->XmpProfileEnable))) {
+ continue;
+ }
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ DimmOut->Timing[Profile].tRP = (U16) Actual[Profile];
+ ChannelOut->Timing[Profile].tRP = (U16) Actual[Profile];
+ }
+ }
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %u", Actual[Profile]);
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+
+ return TRUE;
+}
+
+#if (SUPPORT_LPDDR3 == SUPPORT)
+/**
+ @brief
+ Calculate the minimum tRPab timing value for the given memory frequency.
+
+ @param[in, out] MrcData - Pointer to MrcData data structure.
+
+ @retval TRUE if there are DIMMs present, otherwise FALSE.
+**/
+static
+BOOL
+GetChannelDimmtRPab (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ const MrcInput *Inputs;
+ const MrcControllerIn *ControllerIn;
+ const MrcChannelIn *ChannelIn;
+ const MrcDimmIn *DimmIn;
+ const MrcSpd *Spd;
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ MrcDimmOut *DimmOut;
+ MrcTimeBase *TimeBase;
+ MrcProfile Profile;
+ MrcBool Flag;
+ U8 Controller;
+ U8 Channel;
+ U8 Dimm;
+ U32 tCKmin;
+ S32 MediumTimebase;
+ S32 FineTimebase;
+ U32 TimingMTB;
+ S32 TimingFTB;
+ U32 Actual[MAX_PROFILE];
+ U32 Calculated;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ Debug = &Inputs->Debug;
+ Flag = FALSE;
+
+ //
+ // Find the smallest timing value for all the given DIMMs, for all the profiles.
+ //
+ for (Profile = STD_PROFILE; Profile < MAX_PROFILE; Profile++) {
+ if (((Profile == XMP_PROFILE1) || (Profile == XMP_PROFILE2)) && (!(Outputs->XmpProfileEnable))) {
+ continue;
+ }
+ Actual[Profile] = 0;
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerIn = &Inputs->Controller[Controller];
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelIn = &ControllerIn->Channel[Channel];
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmIn = &ChannelIn->Dimm[Dimm];
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ if ((DIMM_PRESENT == DimmOut->Status) && (DimmOut->DdrType == MRC_DDR_TYPE_LPDDR3)) {
+ Spd = &DimmIn->Spd;
+ Calculated = 0;
+ tCKmin = DimmOut->Timing[Profile].tCK;
+ TimeBase = &ChannelOut->TimeBase[Dimm][Profile];
+ MediumTimebase = TimeBase->Mtb;
+ FineTimebase = TimeBase->Ftb;
+ switch (Profile) {
+ case USER_PROFILE:
+ if (DimmIn->Timing.tRPab > 0) {
+ Calculated = DimmIn->Timing.tRPab;
+ break;
+ } else {
+ // In AUTO mode, so no break.
+ }
+ case STD_PROFILE:
+ case XMP_PROFILE1:
+ case XMP_PROFILE2:
+ default:
+ if (tCKmin > 0) {
+ TimingMTB = Spd->Ddr3.General.tRPab.Bits.tRPab;
+ TimingFTB = Spd->Ddr3.General.tRPabFine.Bits.tRPabFine;
+ Calculated = (tCKmin == 0) ? 0 : ((MediumTimebase * TimingMTB) + (FineTimebase * TimingFTB) + (tCKmin - 1)) / tCKmin;
+ }
+ break;
+ } //switch
+
+ if ((Calculated >= TRPABMINPOSSIBLE) && ((Calculated - DimmOut->Timing[Profile].tRP) <= 3)) {
+ Actual[Profile] = MAX (Actual[Profile], Calculated);
+ }
+ if (!Flag) {
+ Flag = TRUE;
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %s:\n %s\n", tRPabString, HeaderString);
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ " % 7u % 10u % 8u % 5u %6u\n",
+ Profile,
+ Controller,
+ Channel,
+ Dimm,
+ Calculated
+ );
+ } //Flag
+ } //DimmOut->Status
+ } //Dimm
+ } //Channel
+ } //Controller
+ } //Profile
+
+ if (Flag ) {
+ //
+ // Set the best case timing for all controllers/channels/dimms, for each profile.
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %s%u:", BestCaseString, MAX_PROFILE - 1);
+ for (Profile = STD_PROFILE; Profile < MAX_PROFILE; Profile++) {
+ if (((Profile == XMP_PROFILE1) || (Profile == XMP_PROFILE2)) && (!(Outputs->XmpProfileEnable))) {
+ continue;
+ }
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ DimmOut->Timing[Profile].tRPab = (U16) Actual[Profile];
+ ChannelOut->Timing[Profile].tRPab = (U16) Actual[Profile];
+ }
+ }
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %u", Actual[Profile]);
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+ }
+
+ return TRUE;
+
+}
+#endif
+
+#if (MRC_DDR3_LPDDR_SUPPORTED)
+/**
+ @brief
+ Calculate the minimum tRRD timing value for the given memory frequency.
+ MRC should not set tRRD below 4nCK for all frequencies.
+
+ @param[in, out] MrcData - Pointer to MrcData data structure.
+
+ @retval TRUE
+**/
+static
+BOOL
+GetChannelDimmtRRD (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ const MrcInput *Inputs;
+ const MrcControllerIn *ControllerIn;
+ const MrcChannelIn *ChannelIn;
+ const MrcDimmIn *DimmIn;
+ const MrcSpd *Spd;
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ MrcDimmOut *DimmOut;
+ MrcTimeBase *TimeBase;
+ MrcProfile Profile;
+ U8 Controller;
+ U8 Channel;
+ U8 Dimm;
+ U32 tCKmin;
+ U32 TimingMTB;
+ S32 MediumTimebase;
+ S32 FineTimebase;
+ U32 Actual[MAX_PROFILE];
+ U32 Calculated;
+#if (SUPPORT_XMP == SUPPORT)
+ U32 Index;
+#endif
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ Debug = &Inputs->Debug;
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %s:\n %s\n", tRRDString, HeaderString);
+
+ //
+ // Find the smallest timing value for all the given DIMMs, for all the profiles.
+ //
+ for (Profile = STD_PROFILE; Profile < MAX_PROFILE; Profile++) {
+ if (((Profile == XMP_PROFILE1) || (Profile == XMP_PROFILE2)) && (!(Outputs->XmpProfileEnable))) {
+ continue;
+ }
+ Actual[Profile] = 0;
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerIn = &Inputs->Controller[Controller];
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelIn = &ControllerIn->Channel[Channel];
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmIn = &ChannelIn->Dimm[Dimm];
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ if (DIMM_PRESENT == DimmOut->Status) {
+ Spd = &DimmIn->Spd;
+ Calculated = 0;
+ tCKmin = DimmOut->Timing[Profile].tCK;
+ TimeBase = &ChannelOut->TimeBase[Dimm][Profile];
+ MediumTimebase = TimeBase->Mtb;
+ FineTimebase = TimeBase->Ftb;
+ switch (Profile) {
+ case XMP_PROFILE1:
+ case XMP_PROFILE2:
+#if (SUPPORT_XMP == SUPPORT)
+ if (((Profile == XMP_PROFILE1) && ((DimmOut->XmpSupport & 1) != 0)) ||
+ ((Profile == XMP_PROFILE2) && ((DimmOut->XmpSupport & 2) != 0))) {
+ Index = Profile - XMP_PROFILE1;
+ TimingMTB = Spd->Ddr3.Xmp.Data[Index].tRRDmin.Bits.tRRDmin;
+ Calculated = (tCKmin == 0) ? 0 : ((MediumTimebase * TimingMTB) + (tCKmin - 1)) / tCKmin;
+ } else {
+ Calculated = 0;
+ }
+#endif //SUPPORT_XMP
+ break;
+ case USER_PROFILE:
+ if (DimmIn->Timing.tRRD > 0) {
+ Calculated = DimmIn->Timing.tRRD;
+ break;
+ } else {
+ // In AUTO mode, so no break.
+ }
+ case STD_PROFILE:
+ default:
+ if (tCKmin > 0) {
+ TimingMTB = Spd->Ddr3.General.tRRDmin.Bits.tRRDmin;
+ Calculated = (tCKmin == 0) ? 0 : ((MediumTimebase * TimingMTB) + (tCKmin - 1)) / tCKmin;
+ }
+ break;
+ } //switch
+
+ Calculated = MAX (Calculated, TRRDMINPOSSIBLE); // Make sure tRRD is at least 4 tCK
+ Actual[Profile] = MAX (Actual[Profile], Calculated);
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ " % 7u % 10u % 8u % 5u %6u\n",
+ Profile,
+ Controller,
+ Channel,
+ Dimm,
+ Calculated
+ );
+ } //DimmOut->Status
+ } //Dimm
+ } //Channel
+ } //Controller
+ } //Profile
+
+ //
+ // Set the best case timing for all controllers/channels/dimms, for each profile.
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %s%u:", BestCaseString, MAX_PROFILE - 1);
+ for (Profile = STD_PROFILE; Profile < MAX_PROFILE; Profile++) {
+ if (((Profile == XMP_PROFILE1) || (Profile == XMP_PROFILE2)) && (!(Outputs->XmpProfileEnable))) {
+ continue;
+ }
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ DimmOut->Timing[Profile].tRRD = (U16) Actual[Profile];
+ ChannelOut->Timing[Profile].tRRD = (U16) Actual[Profile];
+ }
+ }
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %u", Actual[Profile]);
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+
+ return TRUE;
+}
+#endif
+
+
+#if (MRC_DDR3_LPDDR_SUPPORTED)
+/**
+ @brief
+ Calculate the minimum tRTP timing value for the given memory frequency.
+
+ @param[in, out] MrcData - Pointer to MrcData data structure.
+
+ @retval TRUE if there are DIMMs present, otherwise FALSE.
+**/
+static
+BOOL
+GetChannelDimmtRTP (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ const MrcInput *Inputs;
+ const MrcControllerIn *ControllerIn;
+ const MrcChannelIn *ChannelIn;
+ const MrcDimmIn *DimmIn;
+ const MrcSpd *Spd;
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ MrcDimmOut *DimmOut;
+ MrcTimeBase *TimeBase;
+ MrcProfile Profile;
+ U8 Controller;
+ U8 Channel;
+ U8 Dimm;
+ U32 tCKmin;
+ U32 TimingMTB;
+ S32 MediumTimebase;
+ S32 FineTimebase;
+ U32 Actual[MAX_PROFILE];
+ U32 Calculated;
+ U32 MaxPossible;
+#if (SUPPORT_XMP == SUPPORT)
+ U32 Index;
+#endif
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ Debug = &Inputs->Debug;
+ MaxPossible = TRTPMAXPOSSIBLE;
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %s:\n %s\n", tRTPString, HeaderString);
+
+ //
+ // Find the smallest timing value for all the given DIMMs, for all the profiles.
+ //
+ for (Profile = STD_PROFILE; Profile < MAX_PROFILE; Profile++) {
+ if (((Profile == XMP_PROFILE1) || (Profile == XMP_PROFILE2)) && (!(Outputs->XmpProfileEnable))) {
+ continue;
+ }
+ Actual[Profile] = 0;
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerIn = &Inputs->Controller[Controller];
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelIn = &ControllerIn->Channel[Channel];
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmIn = &ChannelIn->Dimm[Dimm];
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ if (DIMM_PRESENT == DimmOut->Status) {
+ Spd = &DimmIn->Spd;
+ Calculated = 0;
+ tCKmin = DimmOut->Timing[Profile].tCK;
+ TimeBase = &ChannelOut->TimeBase[Dimm][Profile];
+ MediumTimebase = TimeBase->Mtb;
+ FineTimebase = TimeBase->Ftb;
+ switch (Profile) {
+ case XMP_PROFILE1:
+ case XMP_PROFILE2:
+#if (SUPPORT_XMP == SUPPORT)
+ if (((Profile == XMP_PROFILE1) && ((DimmOut->XmpSupport & 1) != 0)) ||
+ ((Profile == XMP_PROFILE2) && ((DimmOut->XmpSupport & 2) != 0))) {
+ Index = Profile - XMP_PROFILE1;
+ TimingMTB = Spd->Ddr3.Xmp.Data[Index].tRTPmin.Bits.tRTPmin;
+ Calculated = (tCKmin == 0) ? 0 : ((MediumTimebase * TimingMTB) + (tCKmin - 1)) / tCKmin;
+ } else {
+ Calculated = 0;
+ }
+#endif //SUPPORT_XMP
+ break;
+ case USER_PROFILE:
+ if (DimmIn->Timing.tRTP > 0) {
+ Calculated = DimmIn->Timing.tRTP;
+ break;
+ } else {
+ // In AUTO mode, so no break.
+ }
+ case STD_PROFILE:
+ default:
+ if (tCKmin > 0) {
+ TimingMTB = Spd->Ddr3.General.tRTPmin.Bits.tRTPmin;
+ Calculated = (tCKmin == 0) ? 0 : ((MediumTimebase * TimingMTB) + (tCKmin - 1)) / tCKmin;
+ }
+ break;
+ } //switch
+
+ Calculated = MIN (Calculated, MaxPossible);
+ Actual[Profile] = MAX (Actual[Profile], Calculated);
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ " % 7u % 10u % 8u % 5u %6u\n",
+ Profile,
+ Controller,
+ Channel,
+ Dimm,
+ Calculated
+ );
+ } //DimmOut->Status
+ } //Dimm
+ } //Channel
+ } //Controller
+ } //Profile
+
+ //
+ // Set the best case timing for all controllers/channels/dimms, for each profile.
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %s%u:", BestCaseString, MAX_PROFILE - 1);
+ for (Profile = STD_PROFILE; Profile < MAX_PROFILE; Profile++) {
+ if (((Profile == XMP_PROFILE1) || (Profile == XMP_PROFILE2)) && (!(Outputs->XmpProfileEnable))) {
+ continue;
+ }
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ DimmOut->Timing[Profile].tRTP = (U16) Actual[Profile];
+ ChannelOut->Timing[Profile].tRTP = (U16) Actual[Profile];
+ }
+ }
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %u", Actual[Profile]);
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+
+ return TRUE;
+}
+#endif
+
+#if (MRC_DDR3_LPDDR_SUPPORTED)
+/**
+ @brief
+ Calculate the minimum tWR timing value for the given memory frequency.
+
+ @param[in, out] MrcData - Pointer to MrcData data structure.
+
+ @retval TRUE if there are DIMMs present, otherwise FALSE.
+**/
+static
+BOOL
+GetChannelDimmtWR (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ const MrcInput *Inputs;
+ const MrcControllerIn *ControllerIn;
+ const MrcChannelIn *ChannelIn;
+ const MrcDimmIn *DimmIn;
+ const MrcSpd *Spd;
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ MrcDimmOut *DimmOut;
+ MrcTimeBase *TimeBase;
+ MrcProfile Profile;
+ U8 Controller;
+ U8 Channel;
+ U8 Dimm;
+ U32 tCKmin;
+ U32 TimingMTB;
+ S32 MediumTimebase;
+ S32 FineTimebase;
+ U32 Actual[MAX_PROFILE];
+ U32 Calculated;
+ U32 MaxPossible;
+#if (SUPPORT_XMP == SUPPORT)
+ U32 Index;
+#endif
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ Debug = &Inputs->Debug;
+ MaxPossible = TWRMAXPOSSIBLE;
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %s:\n %s\n", tWRString, HeaderString);
+
+ //
+ // Find the smallest timing value for all the given DIMMs, for all the profiles.
+ //
+ for (Profile = STD_PROFILE; Profile < MAX_PROFILE; Profile++) {
+ if (((Profile == XMP_PROFILE1) || (Profile == XMP_PROFILE2)) && (!(Outputs->XmpProfileEnable))) {
+ continue;
+ }
+ Actual[Profile] = 0;
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerIn = &Inputs->Controller[Controller];
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelIn = &ControllerIn->Channel[Channel];
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmIn = &ChannelIn->Dimm[Dimm];
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ if (DIMM_PRESENT == DimmOut->Status) {
+ Spd = &DimmIn->Spd;
+ Calculated = 0;
+ tCKmin = DimmOut->Timing[Profile].tCK;
+ TimeBase = &ChannelOut->TimeBase[Dimm][Profile];
+ MediumTimebase = TimeBase->Mtb;
+ FineTimebase = TimeBase->Ftb;
+ switch (Profile) {
+ case XMP_PROFILE1:
+ case XMP_PROFILE2:
+#if (SUPPORT_XMP == SUPPORT)
+ if (((Profile == XMP_PROFILE1) && ((DimmOut->XmpSupport & 1) != 0)) ||
+ ((Profile == XMP_PROFILE2) && ((DimmOut->XmpSupport & 2) != 0))) {
+ Index = Profile - XMP_PROFILE1;
+ TimingMTB = Spd->Ddr3.Xmp.Data[Index].tWRmin.Bits.tWRmin;
+ Calculated = (tCKmin == 0) ? 0 : ((MediumTimebase * TimingMTB) + (tCKmin - 1)) / tCKmin;
+ } else {
+ Calculated = 0;
+ }
+#endif //SUPPORT_XMP
+ break;
+ case USER_PROFILE:
+ if (DimmIn->Timing.tWR > 0) {
+ Calculated = DimmIn->Timing.tWR;
+ break;
+ } else {
+ // In AUTO mode, so no break.
+ }
+ case STD_PROFILE:
+ default:
+ if (tCKmin > 0) {
+ TimingMTB = Spd->Ddr3.General.tWRmin.Bits.tWRmin;
+ Calculated = (tCKmin == 0) ? 0 : ((MediumTimebase * TimingMTB) + (tCKmin - 1)) / tCKmin;
+ }
+ break;
+ } //switch
+
+ //
+ // Special case, tWRmin values of 9, 11, 13, and 15 are not supported by DDR3 Mode Register 0 (MR0).
+ // If we see one of these values, then add one clock to it in order to make it valid.
+ //
+ if ((9 == Calculated) || (11 == Calculated) || (13 == Calculated) || (15 == Calculated)) {
+ Calculated++;
+ } else {
+ Calculated = MIN (Calculated, MaxPossible);
+ }
+ Actual[Profile] = MAX (Actual[Profile], Calculated);
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ " % 7u % 10u % 8u % 5u %6u\n",
+ Profile,
+ Controller,
+ Channel,
+ Dimm,
+ Calculated
+ );
+ } //DimmOut->Status
+ } //Dimm
+ } //Channel
+ } //Controller
+ } //Profile
+
+ //
+ // Set the best case timing for all controllers/channels/dimms, for each profile.
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %s%u:", BestCaseString, MAX_PROFILE - 1);
+ for (Profile = STD_PROFILE; Profile < MAX_PROFILE; Profile++) {
+ if (((Profile == XMP_PROFILE1) || (Profile == XMP_PROFILE2)) && (!(Outputs->XmpProfileEnable))) {
+ continue;
+ }
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ DimmOut->Timing[Profile].tWR = (U16) Actual[Profile];
+ ChannelOut->Timing[Profile].tWR = (U16) Actual[Profile];
+ }
+ }
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %u", Actual[Profile]);
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+
+ return TRUE;
+}
+#endif
+
+#if (MRC_DDR3_LPDDR_SUPPORTED)
+/**
+ @brief
+ Calculate the minimum tWTR timing value for the given memory frequency.
+
+ @param[in, out] MrcData - Pointer to MrcData data structure.
+
+ @retval TRUE if there are DIMMs present, otherwise FALSE.
+**/
+static
+BOOL
+GetChannelDimmtWTR (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ const MrcInput *Inputs;
+ const MrcControllerIn *ControllerIn;
+ const MrcChannelIn *ChannelIn;
+ const MrcDimmIn *DimmIn;
+ const MrcSpd *Spd;
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ MrcDimmOut *DimmOut;
+ MrcTimeBase *TimeBase;
+ MrcProfile Profile;
+ U8 Controller;
+ U8 Channel;
+ U8 Dimm;
+ U32 tCKmin;
+ U32 TimingMTB;
+ S32 MediumTimebase;
+ S32 FineTimebase;
+ U32 Actual[MAX_PROFILE];
+ U32 Calculated;
+#if (SUPPORT_XMP == SUPPORT)
+ U32 Index;
+#endif
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ Debug = &Inputs->Debug;
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %s:\n %s\n", tWTRString, HeaderString);
+
+ //
+ // Find the smallest timing value for all the given DIMMs, for all the profiles.
+ //
+ for (Profile = STD_PROFILE; Profile < MAX_PROFILE; Profile++) {
+ if (((Profile == XMP_PROFILE1) || (Profile == XMP_PROFILE2)) && (!(Outputs->XmpProfileEnable))) {
+ continue;
+ }
+ Actual[Profile] = 0;
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerIn = &Inputs->Controller[Controller];
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelIn = &ControllerIn->Channel[Channel];
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmIn = &ChannelIn->Dimm[Dimm];
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ if (DIMM_PRESENT == DimmOut->Status) {
+ Spd = &DimmIn->Spd;
+ Calculated = 0;
+ tCKmin = DimmOut->Timing[Profile].tCK;
+ TimeBase = &ChannelOut->TimeBase[Dimm][Profile];
+ MediumTimebase = TimeBase->Mtb;
+ FineTimebase = TimeBase->Ftb;
+ switch (Profile) {
+ case XMP_PROFILE1:
+ case XMP_PROFILE2:
+#if (SUPPORT_XMP == SUPPORT)
+ if (((Profile == XMP_PROFILE1) && ((DimmOut->XmpSupport & 1) != 0)) ||
+ ((Profile == XMP_PROFILE2) && ((DimmOut->XmpSupport & 2) != 0))) {
+ Index = Profile - XMP_PROFILE1;
+ TimingMTB = Spd->Ddr3.Xmp.Data[Index].tWTRmin.Bits.tWTRmin;
+ Calculated = (tCKmin == 0) ? 0 : ((MediumTimebase * TimingMTB) + (tCKmin - 1)) / tCKmin;
+ } else {
+ Calculated = 0;
+ }
+#endif //SUPPORT_XMP
+ break;
+ case USER_PROFILE:
+ if (DimmIn->Timing.tWTR > 0) {
+ Calculated = DimmIn->Timing.tWTR;
+ break;
+ } else {
+ // In AUTO mode, so no break.
+ }
+ case STD_PROFILE:
+ default:
+ if (tCKmin > 0) {
+ TimingMTB = Spd->Ddr3.General.tWTRmin.Bits.tWTRmin;
+ Calculated = (tCKmin == 0) ? 0 : ((MediumTimebase * TimingMTB) + (tCKmin - 1)) / tCKmin;
+ }
+ break;
+ } //switch
+
+ Calculated = MIN (Calculated, TWTRMAXPOSSIBLE);
+ Actual[Profile] = MAX (Actual[Profile], Calculated);
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ " % 7u % 10u % 8u % 5u %6u\n",
+ Profile,
+ Controller,
+ Channel,
+ Dimm,
+ Calculated
+ );
+ } //DimmOut->Status
+ } //Dimm
+ } //Channel
+ } //Controller
+ } //Profile
+
+ //
+ // Set the best case timing for all controllers/channels/dimms, for each profile.
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %s%u:", BestCaseString, MAX_PROFILE - 1);
+ for (Profile = STD_PROFILE; Profile < MAX_PROFILE; Profile++) {
+ if (((Profile == XMP_PROFILE1) || (Profile == XMP_PROFILE2)) && (!(Outputs->XmpProfileEnable))) {
+ continue;
+ }
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ DimmOut->Timing[Profile].tWTR = (U16) Actual[Profile];
+ ChannelOut->Timing[Profile].tWTR = (U16) Actual[Profile];
+ }
+ }
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %u", Actual[Profile]);
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+
+ return TRUE;
+}
+#endif
+
+/**
+ @brief
+ Calculate the minimum command rate mode value for the given channel.
+
+ @param[in, out] MrcData - Pointer to MrcData data structure.
+
+ @retval TRUE if there are DIMMs present, otherwise FALSE.
+**/
+static
+BOOL
+GetChannelDimmNmode (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ const MrcInput *Inputs;
+ const MrcControllerIn *ControllerIn;
+ const MrcChannelIn *ChannelIn;
+ const MrcDimmIn *DimmIn;
+ const MrcSpd *Spd;
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ MrcDimmOut *DimmOut;
+ MrcTimeBase *TimeBase;
+ MrcProfile Profile;
+ U8 Controller;
+ U8 Channel;
+ U8 Dimm;
+ U32 tCKmin;
+ S32 MediumTimebase;
+ S32 FineTimebase;
+ U32 Actual[MAX_PROFILE];
+ U32 Calculated;
+#if (SUPPORT_XMP == SUPPORT)
+ U32 Index;
+ U32 TimingMTB;
+#endif
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ Debug = &Inputs->Debug;
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %s:\n %s\n", NmodeString, HeaderString);
+
+ //
+ // Find the smallest timing value for all the given DIMMs, for all the profiles.
+ //
+ for (Profile = STD_PROFILE; Profile < MAX_PROFILE; Profile++) {
+ if (((Profile == XMP_PROFILE1) || (Profile == XMP_PROFILE2)) && (!(Outputs->XmpProfileEnable))) {
+ continue;
+ }
+ Actual[Profile] = (Profile < XMP_PROFILE1) ? NMODEMINPOSSIBLE : 0;
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerIn = &Inputs->Controller[Controller];
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelIn = &ControllerIn->Channel[Channel];
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmIn = &ChannelIn->Dimm[Dimm];
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ if (DIMM_PRESENT == DimmOut->Status) {
+ Spd = &DimmIn->Spd;
+ Calculated = 2;
+ tCKmin = DimmOut->Timing[Profile].tCK;
+ TimeBase = &ChannelOut->TimeBase[Dimm][Profile];
+ MediumTimebase = TimeBase->Mtb;
+ FineTimebase = TimeBase->Ftb;
+ switch (Profile) {
+ case XMP_PROFILE1:
+ case XMP_PROFILE2:
+#if (SUPPORT_XMP == SUPPORT)
+ if (((Profile == XMP_PROFILE1) && ((DimmOut->XmpSupport & 1) != 0)) ||
+ ((Profile == XMP_PROFILE2) && ((DimmOut->XmpSupport & 2) != 0))) {
+ Index = Profile - XMP_PROFILE1;
+ TimingMTB = Spd->Ddr3.Xmp.Data[Index].SystemCmdRate.Bits.NMode;
+ if (tCKmin == 0) {
+ Calculated = 0;
+ } else {
+ Calculated = ((MediumTimebase * TimingMTB) + (tCKmin - 1)) / tCKmin;
+ if (Calculated == 0) {
+ Calculated = 2;
+ }
+ }
+ } else {
+ Calculated = 0;
+ }
+#endif //SUPPORT_XMP
+ break;
+ case USER_PROFILE:
+ if (DimmIn->Timing.NMode > 0) {
+ Calculated = DimmIn->Timing.NMode;
+ break;
+ } else {
+ // In AUTO mode, so no break.
+ }
+ case STD_PROFILE:
+ default:
+ Calculated = NMODEMINPOSSIBLE;
+ break;
+ } //switch
+
+ Actual[Profile] = MAX (Actual[Profile], Calculated);
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ " % 7u % 10u % 8u % 5u %6u\n",
+ Profile,
+ Controller,
+ Channel,
+ Dimm,
+ Calculated
+ );
+ } //DimmOut->Status
+ } //Dimm
+ } //Channel
+ } //Controller
+ } //Profile
+
+ //
+ // Set the best case timing for all controllers/channels/dimms, for each profile.
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %s%u:", BestCaseString, MAX_PROFILE - 1);
+ for (Profile = STD_PROFILE; Profile < MAX_PROFILE; Profile++) {
+ if (((Profile == XMP_PROFILE1) || (Profile == XMP_PROFILE2)) && (!(Outputs->XmpProfileEnable))) {
+ continue;
+ }
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ DimmOut->Timing[Profile].NMode = (U16) Actual[Profile];
+ ChannelOut->Timing[Profile].NMode = (U16) Actual[Profile];
+ }
+ }
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %u", Actual[Profile]);
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+
+ return TRUE;
+}
+
+/**
+ @brief
+ Calculate the VDD voltage value for the given channel.
+
+ @param[in, out] MrcData - Pointer to MrcData data structure.
+
+ @retval TRUE if there are DIMMs present, otherwise FALSE.
+**/
+static
+BOOL
+GetChannelDimmVdd (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ const MrcInput *Inputs;
+ const MrcControllerIn *ControllerIn;
+ const MrcChannelIn *ChannelIn;
+ const MrcDimmIn *DimmIn;
+ const MrcSpd *Spd;
+ const MrcDebug *Debug;
+ const SPD_EXTREME_MEMORY_PROFILE_DATA *Xmp;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ MrcDimmOut *DimmOut;
+ MrcProfile Profile;
+ SpdVddFlag VddFlag;
+ MrcCpuModel CpuModel;
+ U32 Actual[MAX_PROFILE];
+ U32 Calculated;
+ U8 Controller;
+ U8 Channel;
+ U8 Dimm;
+#if (SUPPORT_XMP == SUPPORT)
+ U32 Index;
+#endif
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ Debug = &Inputs->Debug;
+ CpuModel = MrcData->SysIn.Inputs.CpuModel;
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %s:\n %s\n", VddString, HeaderString);
+
+ //
+ // Find the best case voltage value for all the given DIMMs, for all the profiles.
+ //
+ for (Profile = STD_PROFILE; Profile < MAX_PROFILE; Profile++) {
+ if (((Profile == XMP_PROFILE1) || (Profile == XMP_PROFILE2)) && (!(Outputs->XmpProfileEnable))) {
+ continue;
+ }
+ Actual[Profile] = (Profile < XMP_PROFILE1) ? VDD_1_20 : 0;
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerIn = &Inputs->Controller[Controller];
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelIn = &ControllerIn->Channel[Channel];
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmIn = &ChannelIn->Dimm[Dimm];
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ if (DIMM_PRESENT == DimmOut->Status) {
+ Spd = &DimmIn->Spd;
+ Calculated = VDD_1_50;
+ switch (Profile) {
+ case XMP_PROFILE1:
+ case XMP_PROFILE2:
+#if (SUPPORT_XMP == SUPPORT)
+ if (((Profile == XMP_PROFILE1) && ((DimmOut->XmpSupport & 1) != 0)) ||
+ ((Profile == XMP_PROFILE2) && ((DimmOut->XmpSupport & 2) != 0))) {
+ Index = Profile - XMP_PROFILE1;
+ Xmp = &Spd->Ddr3.Xmp.Data[Index];
+ Calculated = XMP_VDD_INCREMENT * Xmp->Vdd.Bits.Decimal;
+ Calculated = MIN (Calculated, XMP_VDD_INTEGER - 1);
+ Calculated += (XMP_VDD_INTEGER * Xmp->Vdd.Bits.Integer);
+ Calculated = MAX (Calculated, XMP_VDD_MIN_POSSIBLE);
+ Calculated = MIN (Calculated, XMP_VDD_MAX_POSSIBLE);
+ } else {
+ Calculated = 0;
+ }
+#endif //SUPPORT_XMP
+ break;
+ case USER_PROFILE:
+ if (Inputs->VddVoltage > 0) {
+ Calculated = Inputs->VddVoltage;
+ break;
+ } else {
+ // In AUTO mode, so no break.
+ }
+ case STD_PROFILE:
+ default:
+ VddFlag.Bits.Vdd1_50 = ~(Spd->Ddr3.General.ModuleNominalVoltage.Bits.OperationAt1_50);
+ VddFlag.Bits.Vdd1_35 = Spd->Ddr3.General.ModuleNominalVoltage.Bits.OperationAt1_35;
+ VddFlag.Bits.Vdd1_25 = Spd->Ddr3.General.ModuleNominalVoltage.Bits.OperationAt1_25;
+#if (VDDMINPOSSIBLE <= 1350)
+ if ((CpuModel == cmHSW_ULT && PlatformSupport.VddMin.UltSupport <= 1350) ||
+ ((CpuModel == cmHSW || CpuModel == cmCRW) && PlatformSupport.VddMin.TradSupport <= 1350 )) {
+ if (VddFlag.Bits.Vdd1_35) {
+ Calculated = VDD_1_35;
+ }
+ }
+#endif // VDDMINPOSSIBLE
+#if (VDDMINPOSSIBLE <= 1200)
+ if ((CpuModel == cmHSW_ULT && PlatformSupport.VddMin.UltSupport <= 1200) ||
+ ((CpuModel == cmHSW || CpuModel == cmCRW) && PlatformSupport.VddMin.TradSupport <= 1200 )) {
+ if (VddFlag.Bits.Vdd1_25) {
+ Calculated = VDD_1_20;
+ }
+ }
+#endif // VDDMINPOSSIBLE
+ if ((Profile == STD_PROFILE) && (Inputs->BoardType == btCRBDT)) {
+ Calculated = VDD_1_50;
+ }
+ break;
+ } //switch
+
+ Actual[Profile] = MAX (Actual[Profile], Calculated);
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ " % 7u % 10u % 8u % 5u %4u\n",
+ Profile,
+ Controller,
+ Channel,
+ Dimm,
+ Calculated
+ );
+ } //DimmOut->Status
+ } //Dimm
+ } //Channel
+ } //Controller
+ } //Profile
+
+ //
+ // Set the best case voltage for all controllers/channels/dimms, for each profile.
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %s%u:", BestCaseString, MAX_PROFILE - 1);
+ for (Profile = STD_PROFILE; Profile < MAX_PROFILE; Profile++) {
+ if (((Profile == XMP_PROFILE1) || (Profile == XMP_PROFILE2)) && (!(Outputs->XmpProfileEnable))) {
+ continue;
+ }
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ Outputs->VddVoltage[Profile] = (MrcVddSelect) Actual[Profile];
+ DimmOut->VddVoltage[Profile] = (MrcVddSelect) Actual[Profile];
+ }
+ }
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " %u", Actual[Profile]);
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+
+ return TRUE;
+}
+
+/**
+ @brief
+ Analyze the given DIMM SPD data to determine DIMM presence and configuration.
+
+ @param[in, out] MrcData - Pointer to MRC global data structure.
+ @param[in] Controller - Current controller number.
+ @param[in] Channel - Current channel number.
+ @param[in] Dimm - Current DIMM number.
+
+ @retval mrcSuccess if DIMM is present otherwise mrcDimmNotExist.
+**/
+static
+MrcStatus
+SpdDimmRecognition (
+ IN OUT MrcParameters *const MrcData,
+ IN const U8 Controller,
+ IN U8 Channel,
+ IN U8 Dimm
+ )
+{
+ const SpdRecogCallTable CallTable[] = {
+ {ValidDimm},
+ {ValidSdramDeviceWidth},
+ {ValidPrimaryWidth},
+ {GetRankCount},
+ {ValidBank},
+ {GetDimmSize},
+ {ValidRowSize},
+ {ValidColumnSize},
+ {ValidEccSupport},
+ {GetAddressMirror},
+ {GetThermalRefreshSupport},
+ {GetReferenceRawCardSupport}
+ };
+ const MrcSpd *Spd;
+ const U8 *CrcStart;
+ MrcDimmOut *DimmOut;
+ MrcDimmIn *DimmIn;
+ BOOL Status;
+ U32 CrcSize;
+ U8 Index;
+
+ Spd = &MrcData->SysIn.Inputs.Controller[Controller].Channel[Channel].Dimm[Dimm].Spd;
+ DimmIn = &MrcData->SysIn.Inputs.Controller[Controller].Channel[Channel].Dimm[Dimm];
+ DimmOut = &MrcData->SysOut.Outputs.Controller[Controller].Channel[Channel].Dimm[Dimm];
+ DimmOut->Status = DIMM_NOT_PRESENT;
+ if (DIMM_PRESENT == DimmPresence (MrcData, Spd, sizeof (MrcSpd))) {
+ Status = TRUE;
+ for (Index = 0; (Status == TRUE) && (Index < (sizeof (CallTable) / sizeof (CallTable[0]))); Index++) {
+ Status &= CallTable[Index].mrc_task (MrcData, Spd, DimmOut);
+ }
+ if (Status == FALSE) {
+ DimmOut->Status = DIMM_DISABLED;
+ return mrcDimmNotExist;
+ }
+ DimmOut->Status = DIMM_PRESENT;
+ CrcStart = MrcSpdCrcArea (MrcData, Controller, Channel, Dimm, &CrcSize);
+ GetDimmCrc ((const U8 *const) CrcStart, CrcSize, &DimmOut->Crc);
+ } else {
+ return mrcDimmNotExist;
+ }
+
+ if (DIMM_DISABLED == DimmIn->Status) {
+ DimmOut->Status = DIMM_DISABLED;
+ }
+
+ return mrcSuccess;
+}
+
+/**
+ @brief
+ Calculate the timing of all DIMMs on all channels.
+
+ @param[in, out] MrcData - The MRC "global data".
+
+ @retval mrcSuccess on success, mrcDimmNotExist if no DIMMs found.
+**/
+static
+MrcStatus
+SpdTimingCalculation (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ const SpdTimeCallTable CallTable[] = {
+ {GetChannelDimmTimeBase}, // Note: This must be done first as all other calculations are based on this.
+ {GetChannelDimmtCK}, // Note: This must be done second as all other calculations are based on this.
+ {GetChannelDimmtAA},
+ {GetChannelDimmtCWL},
+ {GetChannelDimmtRAS},
+ {GetChannelDimmtRC},
+ {GetChannelDimmtRCD},
+ {GetChannelDimmtREFI},
+ {GetChannelDimmtRFC},
+ {GetChannelDimmtRP},
+#if (SUPPORT_LPDDR3 == SUPPORT)
+ {GetChannelDimmtRPab}, // Note: This must be done after GetChannelDimmtRP
+#endif
+#if (MRC_DDR3_LPDDR_SUPPORTED)
+ {GetChannelDimmtFAW},
+ {GetChannelDimmtRRD},
+ {GetChannelDimmtRTP},
+ {GetChannelDimmtWR},
+ {GetChannelDimmtWTR},
+#endif
+ {GetChannelDimmNmode},
+ {GetChannelDimmVdd}
+ };
+ BOOL Status;
+ U8 Index;
+#if (SUPPORT_FORCE == SUPPORT)
+ MrcChannelOut *ChannelOut;
+ MrcDimmOut *DimmOut;
+ U16 Value;
+ U8 Controller;
+ U8 Channel;
+ U8 Dimm;
+#endif
+
+ //
+ // Find the "least common denominator" timing across the DIMMs.
+ // tAA must be done first before any other timings are calculated.
+ //
+ Status = TRUE;
+ for (Index = 0; (Status == TRUE) && (Index < (sizeof (CallTable) / sizeof (SpdTimeCallTable))); Index++) {
+ Status &= CallTable[Index].mrc_task (MrcData);
+ }
+
+#if (SUPPORT_FORCE == SUPPORT)
+ if (Status == TRUE) {
+ //
+ // Force tCLmin, tRCDmin, tRPmin to be the same "least common denominator" value.
+ //
+ Value = 0;
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmOut = &Outputs->Controller[Controller].Channel[Channel].Dimm[Dimm];
+ if (DIMM_PRESENT == DimmOut->Status) {
+ Value = MAX (Value, DimmOut->Timing.tRCD);
+ Value = MAX (Value, DimmOut->Timing.tRP);
+ Value = MAX (Value, DimmOut->Timing.tCL);
+ }
+ }
+ }
+ }
+
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &Outputs->Controller[Controller].Channel[Channel];
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ if (DIMM_PRESENT == DimmOut->Status) {
+ ChannelOut->Timing.tRCD = Value;
+ ChannelOut->Timing.tRP = Value;
+ ChannelOut->Timing.tCL = Value;
+ DimmOut->Timing.tRCD = Value;
+ DimmOut->Timing.tRP = Value;
+ DimmOut->Timing.tCL = Value;
+ }
+ }
+ }
+ }
+ }
+#endif
+ return (Status == FALSE) ? mrcDimmNotExist : mrcSuccess;
+}
+
+/**
+ @brief
+ Determine the starting address and size of the SPD area to generate a CRC.
+
+ @param[in, out] MrcData - The MRC "global data".
+ @param[in] Controller - Controller index.
+ @param[in] Channel - Channel index.
+ @param[in] Dimm - Dimm index.
+ @param[out] CrcSize - Location to write CRC block size.
+
+ @retval The starting address of the CRC block.
+**/
+const U8 *
+MrcSpdCrcArea (
+ IN OUT MrcParameters *const MrcData,
+ IN U8 Controller,
+ IN U8 Channel,
+ IN U8 Dimm,
+ OUT U32 *const CrcSize
+ )
+{
+ const MrcDimmIn *DimmIn;
+ MrcDimmOut *DimmOut;
+ const U8 *CrcStart;
+
+ DimmIn = &MrcData->SysIn.Inputs.Controller[Controller].Channel[Channel].Dimm[Dimm];
+ DimmOut = &MrcData->SysOut.Outputs.Controller[Controller].Channel[Channel].Dimm[Dimm];
+ CrcStart = NULL;
+
+ CrcStart = (const U8 *) &DimmIn->Spd.Ddr3.ModuleId;
+ *CrcSize = SPD3_MANUF_SIZE;
+ return (CrcStart);
+}
+
+/**
+ @brief
+ Process the SPD information for all DIMMs on all channels.
+
+ @param[in, out] MrcData - The MRC "global data".
+
+ @retval mrcSuccess on success, mrcDimmNotExist if no DIMMs found.
+**/
+MrcStatus
+MrcSpdProcessing (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ const MrcDebug *Debug;
+ const MrcInput *Inputs;
+ const MrcControllerIn *ControllerIn;
+ const MrcChannelIn *ChannelIn;
+ const MrcDimmIn *DimmIn;
+ MrcStatus Status;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ MrcDimmOut *DimmOut;
+ MrcModuleType ModuleType;
+ U8 Controller;
+ U8 Channel;
+ U8 Dimm;
+ U32 DimmCount;
+ U8 ValidRankBitMask;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ Status = mrcDimmNotExist;
+
+ //
+ // Scan thru each DIMM to see if it is a valid DIMM and to get its configuration.
+ //
+ ModuleType = MRC_MODULE_TYPE_UNKNOWN;
+ DimmCount = 0;
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerIn = &Inputs->Controller[Controller];
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelIn = &ControllerIn->Channel[Channel];
+ ChannelOut = &ControllerOut->Channel[Channel];
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmIn = &ChannelIn->Dimm[Dimm];
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ if (DimmIn->Status == DIMM_ENABLED || DimmIn->Status == DIMM_DISABLED) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "SPD Dimm recognition, %s %u/%u/%u\n",
+ CcdString,
+ Controller,
+ Channel,
+ Dimm
+ );
+ if (mrcSuccess == SpdDimmRecognition (MrcData, Controller, Channel, Dimm)) {
+ DimmCount++;
+ if (MRC_DDR_TYPE_UNKNOWN == Outputs->DdrType) {
+ Outputs->DdrType = DimmOut->DdrType;
+ } else if (Outputs->DdrType != DimmOut->DdrType) {
+ Status = mrcMixedDimmSystem;
+ }
+ if (MRC_MODULE_TYPE_UNKNOWN == ModuleType) {
+ ModuleType = DimmOut->ModuleType;
+ } else if (ModuleType != DimmOut->ModuleType) {
+ Status = mrcMixedDimmSystem;
+ }
+ if (Status == mrcMixedDimmSystem) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_ERROR,
+ "%s configuration, system contains a mix of memory types\n",
+ ErrorString
+ );
+ return (Status);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (DimmCount > 0) {
+ //
+ // Scan thru each channel to see if it is a valid channel and to get its configuration.
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "SPD Dimm timing calculation\n");
+ if (mrcSuccess == SpdTimingCalculation (MrcData)) {
+ Outputs->EccSupport = TRUE;
+
+ //
+ // Count up the number of valid DIMMs.
+ //
+ ControllerOut = &Outputs->Controller[0];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ ChannelOut->EccSupport = TRUE;
+ for (Dimm = 0; Dimm < MAX_DIMMS_IN_CHANNEL; Dimm++) {
+ DimmOut = &ChannelOut->Dimm[Dimm];
+ if ((DIMM_PRESENT == DimmOut->Status) || (DIMM_DISABLED == DimmOut->Status)) {
+ ChannelOut->DimmCount++;
+ }
+ if (DIMM_PRESENT == DimmOut->Status) {
+#if (MAX_RANK_IN_CHANNEL > 8)
+#error The next switch statement and ValidRankBitMask needs updated to support additional ranks.
+#endif
+ switch (DimmOut->RankInDIMM) {
+ case 1:
+ ValidRankBitMask = 1;
+ break;
+#if (MAX_RANK_IN_DIMM > 1)
+
+ case 2:
+ ValidRankBitMask = 3;
+ break;
+#endif
+#if (MAX_RANK_IN_DIMM > 2)
+
+ case 3:
+ ValidRankBitMask = 7;
+ break;
+#endif
+#if (MAX_RANK_IN_DIMM > 3)
+
+ case 4:
+ ValidRankBitMask = 15;
+ break;
+#endif
+
+ default:
+ ValidRankBitMask = 0;
+ break;
+ }
+
+ ChannelOut->ValidRankBitMask |= ValidRankBitMask << (Dimm * MAX_RANK_IN_DIMM);
+
+ ChannelOut->EccSupport &= DimmOut->EccSupport;
+ Outputs->EccSupport &= DimmOut->EccSupport;
+ }
+ }
+
+ if ((ChannelOut->DimmCount > 0) && (ChannelOut->ValidRankBitMask > 0)) {
+ ControllerOut->ChannelCount++;
+ ControllerOut->Channel[Channel].Status = CHANNEL_PRESENT;
+ }
+ }
+
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerOut = &Outputs->Controller[Controller];
+ if (ControllerOut->ChannelCount > 0) {
+ ControllerOut->Status = CONTROLLER_PRESENT;
+ Status = mrcSuccess;
+ }
+ }
+ }
+ }
+
+ return Status;
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/SpdProcessing/MrcSpdProcessing.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/SpdProcessing/MrcSpdProcessing.h
new file mode 100644
index 0000000..402530e
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/SpdProcessing/MrcSpdProcessing.h
@@ -0,0 +1,231 @@
+/** @file
+ SPD processing header file.
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+**/
+
+#ifndef _MrcSpdProcessing_h_
+#define _MrcSpdProcessing_h_
+
+#include "MrcTypes.h"
+#include "MrcApi.h"
+#include "MrcGlobal.h"
+#include "MrcCommon.h"
+#include "MrcOemDebugPrint.h"
+
+#pragma pack (push, 1)
+
+///
+/// Local definitions
+///
+#define CRC_SEED 0
+#define CRC_XOR_MASK 0x1021
+#define TREFIMIN_DDR3 7800000 /// Average periodic refresh interval, in picoseconds (7.8 us for DDR3)
+#define TREFIMIN_LPDDR3 3900000 /// Average periodic refresh interval, in picoseconds (3.9 us for LPDDR3)
+#define TREFIMULTIPLIER 1000 /// tREFI value defined in XMP 1.3 spec is actually in thousands of MTB units.
+#define MRC_TaaMAX 20000000 /// TaaMax is 20ns
+#define MRC_FREQUENCY_MTB_OFFSET 1000000
+#define MRC_FREQUENCY_FTB_OFFSET 1000
+#define MRC_DDR3_800_TCK_MIN 2500000 /// 1/(800/2) femtoseconds
+#define MRC_DDR3_1000_TCK_MIN 2000000 /// 1/(1000/2) femtoseconds
+#define MRC_DDR3_1067_TCK_MIN 1875000 /// 1/(1067/2) femtoseconds
+#define MRC_DDR3_1200_TCK_MIN 1666666 /// 1/(1200/2) femtoseconds
+#define MRC_DDR3_1333_TCK_MIN 1500000 /// 1/(1333/2) femtoseconds
+#define MRC_DDR3_1400_TCK_MIN 1428571 /// 1/(1400/2) femtoseconds
+#define MRC_DDR3_1600_TCK_MIN 1250000 /// 1/(1600/2) femtoseconds
+#define MRC_DDR3_1800_TCK_MIN 1111111 /// 1/(1800/2) femtoseconds
+#define MRC_DDR3_1867_TCK_MIN 1071428 /// 1/(1867/2) femtoseconds
+#define MRC_DDR3_2000_TCK_MIN 1000000 /// 1/(2000/2) femtoseconds
+#define MRC_DDR3_2133_TCK_MIN 937500 /// 1/(2133/2) femtoseconds
+#define MRC_DDR3_2200_TCK_MIN 909090 /// 1/(2200/2) femtoseconds
+#define MRC_DDR3_2400_TCK_MIN 833333 /// 1/(2400/2) femtoseconds
+#define MRC_DDR3_2600_TCK_MIN 769230 /// 1/(2600/2) femtoseconds
+#define MRC_DDR3_2667_TCK_MIN 750000 /// 1/(2667/2) femtoseconds
+#define MRC_DDR3_2800_TCK_MIN 714285 /// 1/(2800/2) femtoseconds
+
+///
+/// SPD field definitions
+///
+#define MRC_SPD_DDR3_SDRAM_TYPE_NUMBER (0x0B)
+#define MRC_SPD_LPDDR3_SDRAM_TYPE_NUMBER (0xF1)
+
+#define MRC_SPD_RDIMM_TYPE_NUMBER (0x01)
+#define MRC_SPD_UDIMM_TYPE_NUMBER (0x02)
+#define MRC_SPD_SODIMM_TYPE_NUMBER (0x03)
+
+#define MRC_SPD_DDR3_SDRAM_BANK_8 (0x00)
+#define MRC_SPD_DDR3_SDRAM_BANK_16 (0x01)
+#define MRC_SPD_DDR3_SDRAM_BANK_32 (0x02)
+#define MRC_SPD_DDR3_SDRAM_BANK_64 (0x03)
+
+#define MRC_SPD_SDRAM_DENSITY_12 (0x00)
+#define MRC_SPD_SDRAM_DENSITY_13 (0x01)
+#define MRC_SPD_SDRAM_DENSITY_14 (0x02)
+#define MRC_SPD_SDRAM_DENSITY_15 (0x03)
+#define MRC_SPD_SDRAM_DENSITY_16 (0x04)
+
+#define MRC_SPD_SDRAM_ROW_12 (0x00)
+#define MRC_SPD_SDRAM_ROW_13 (0x01)
+#define MRC_SPD_SDRAM_ROW_14 (0x02)
+#define MRC_SPD_SDRAM_ROW_15 (0x03)
+#define MRC_SPD_SDRAM_ROW_16 (0x04)
+
+#define MRC_SPD_SDRAM_COLUMN_9 (0x00)
+#define MRC_SPD_SDRAM_COLUMN_10 (0x01)
+#define MRC_SPD_SDRAM_COLUMN_11 (0x02)
+#define MRC_SPD_SDRAM_COLUMN_12 (0x03)
+
+#define MRC_SPD_SDRAM_DEVICE_WIDTH_4 (0x00)
+#define MRC_SPD_SDRAM_DEVICE_WIDTH_8 (0x01)
+#define MRC_SPD_SDRAM_DEVICE_WIDTH_16 (0x02)
+#define MRC_SPD_SDRAM_DEVICE_WIDTH_32 (0x03)
+
+#define MRC_SPD_PRIMARY_BUS_WIDTH_8 (0x00)
+#define MRC_SPD_PRIMARY_BUS_WIDTH_16 (0x01)
+#define MRC_SPD_PRIMARY_BUS_WIDTH_32 (0x02)
+#define MRC_SPD_PRIMARY_BUS_WIDTH_64 (0x03)
+
+#define MRC_SPD_BUS_WIDTH_EXTENSION_0 (0x00)
+#define MRC_SPD_BUS_WIDTH_EXTENSION_8 (0x01)
+
+#define MRC_SPD_CL_SUPPORTED_MASK (0x7FFF)
+
+#define XMP_VDD_INTEGER (1000)
+#define XMP_VDD_INCREMENT (50)
+#define XMP_VDD_MIN_POSSIBLE (1200)
+#define XMP_VDD_MAX_POSSIBLE (1650)
+
+#define MRC_SPD_REF_RAW_CARD_SIZE (5)
+#define MRC_SPD_REF_RAW_CARD_EXT_OFFSET (7)
+
+#define XMP_ID_STRING (0x4A0C)
+
+typedef struct {
+ U32 tCK;
+ MrcFrequency Frequency;
+ U8 RefClkFlag; // 0 = invalid freq. 1 = valid only at 133 RefClk, 2 = valid only at 100 RefClk, 3 = valid at both.
+} TRangeTable;
+
+typedef struct {
+ BOOL (*mrc_task) (MrcParameters * const MrcData);
+} SpdTimeCallTable;
+
+typedef struct {
+ BOOL (*mrc_task) (MrcParameters * const MrcData, const MrcSpd * const Spd, MrcDimmOut * const DimmOut);
+} SpdRecogCallTable;
+
+typedef union {
+ struct {
+ U8 Vdd1_20 : 1;
+ U8 Vdd1_25 : 1;
+ U8 Vdd1_35 : 1;
+ U8 Vdd1_50 : 1;
+ U8 : 4;
+ } Bits;
+ U8 Data;
+} SpdVddFlag;
+
+ typedef struct {
+ BOOL TradSupport;
+ BOOL UltSupport;
+ } SupportEntry;
+
+ typedef struct {
+ SupportEntry Lpddr3;
+ SupportEntry Column10;
+ SupportEntry Column11;
+ SupportEntry Column12;
+ SupportEntry VddMin;
+ SupportEntry VddMax;
+ } SupportTable;
+
+/**
+ @brief
+ Calculate the memory clock value from the current memory frequency.
+
+ @param[in, out] MrcData - Pointer to MrcData data structure.
+ @param[in] Frequency - Memory frequency to convert.
+ @param[out] tCKminIndex - Pointer to the chosen table index.
+
+ @retval Returns the tCK value for the given frequency.
+**/
+extern
+U32
+ConvertFreq2Clock (
+ IN OUT MrcParameters *const MrcData,
+ IN const MrcFrequency Frequency,
+ OUT S32 *const tCKminIndex
+);
+
+/**
+@brief
+ Calculate the CRC16 of the provided SPD data. CRC16 formula is the same
+ one that is used for calculating the CRC16 stored at SPD bytes 126-127.
+ This can be used to detect DIMM change.
+
+ @param[in] Buffer - Pointer to the start of the data.
+ @param[in] Size - Amount of data in the buffer, in bytes.
+ @param[out] Crc - Pointer to location to write the calculated CRC16 value.
+
+ @retval Returns TRUE.
+**/
+extern
+BOOL
+GetDimmCrc (
+ IN const U8 *const Buffer,
+ IN const U32 Size,
+ OUT U16 *const Crc
+ );
+
+/**
+ @brief
+ Determine the starting address and size of the SPD area to generate a CRC.
+
+ @param[in, out] MrcData - The MRC "global data".
+ @param[in] Controller - Controller index.
+ @param[in] Channel - Channel index.
+ @param[in] Dimm - Dimm index.
+ @param[out] CrcSize - Location to write CRC block size.
+
+ @retval The starting address of the CRC block.
+**/
+const U8 *
+MrcSpdCrcArea (
+ IN OUT MrcParameters *const MrcData,
+ IN U8 Controller,
+ IN U8 Channel,
+ IN U8 Dimm,
+ OUT U32 *const CrcSize
+ );
+
+/**
+@brief
+ Process the SPD information for all DIMMs on all channels.
+
+ @param[in, out] MrcData - The MRC "global data".
+
+ @retval mrcSuccess on success, mrcDimmNotExist if no DIMMs found.
+**/
+extern
+MrcStatus
+MrcSpdProcessing (
+ IN OUT MrcParameters *const MrcData
+ );
+
+#pragma pack (pop)
+#endif // _MrcSpdProcessing_h_
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/WriteTraining/MrcWriteDqDqs.c b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/WriteTraining/MrcWriteDqDqs.c
new file mode 100644
index 0000000..49b35e4
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/WriteTraining/MrcWriteDqDqs.c
@@ -0,0 +1,703 @@
+/** @file
+ The third stage of the write training is determining the PI setting for
+ each byte strobe to make sure that data is sent at the optimal location.
+ In order to do that a pattern of alternating zeros and ones is written to
+ a block of the memory, and then read out. By identifying the location
+ where it is farthest away from where errors are shown the DQS will be
+ aligned to the center of the eye.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+
+**/
+
+//
+// Include files
+//
+#include "MrcWriteDqDqs.h"
+
+/**
+@brief
+ this function executes the write timing centering.
+ Center Tx DQS-DQ using moderate pattern with 1D eye.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - if it succeded returns mrcSuccess
+**/
+MrcStatus
+MrcWriteTimingCentering (
+ IN MrcParameters *const MrcData
+ )
+{
+ MrcOutput *Outputs;
+ U8 ResetPerbit;
+ U8 LoopCount;
+
+ Outputs = &MrcData->SysOut.Outputs;
+ ResetPerbit = 1;
+
+ LoopCount = 10;
+
+ return DQTimeCentering1D (MrcData, Outputs->ValidChBitMask, WrT, ResetPerbit, LoopCount);
+}
+
+/**
+ @brief
+ this function executes the write timing centering in 2D.
+ Final write timing centering using 2D algorithm and per bit optimization.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - if it succeded returns mrcSuccess
+
+ **/
+MrcStatus
+MrcWriteTimingCentering2D (
+ IN MrcParameters *const MrcData
+ )
+{
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcStatus Status;
+ U8 EnPerBit;
+ U8 EnRxDutyCycle;
+ U8 ResetPerBit;
+ U8 LoopCount;
+ U8 En2D;
+
+ Debug = &MrcData->SysIn.Inputs.Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ EnPerBit = 1;
+ EnRxDutyCycle = 0;
+ ResetPerBit = 1;
+ LoopCount = 15;
+ En2D = 0;
+
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\n\nCalling with EnRxDutyCycle = %d, EnPerBit = %d, ResetPerBit = %d En2D = %d\n",
+ EnRxDutyCycle,
+ EnPerBit,
+ ResetPerBit,
+ En2D
+ );
+
+ Status = DataTimeCentering2D (
+ MrcData,
+ Outputs->MarginResult,
+ Outputs->ValidChBitMask,
+ WrT,
+ EnPerBit,
+ EnRxDutyCycle,
+ ResetPerBit,
+ LoopCount,
+ En2D
+ );
+
+ if (mrcSuccess == Status) {
+ EnPerBit = 0;
+ ResetPerBit = 0;
+ En2D = 1;
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\n\nCalling with EnRxDutyCycle = %d, EnPerBit = %d, ResetPerBit = %d En2D = %d\n",
+ EnRxDutyCycle,
+ EnPerBit,
+ ResetPerBit,
+ En2D
+ );
+
+ Status = DataTimeCentering2D (
+ MrcData,
+ Outputs->MarginResult,
+ Outputs->ValidChBitMask,
+ WrT,
+ EnPerBit,
+ EnRxDutyCycle,
+ ResetPerBit,
+ LoopCount,
+ En2D
+ );
+ }
+
+ return Status;
+}
+
+/**
+@brief
+ Rank Margin Tool - Measure margins across various parameters
+
+ @param[in, out] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - mrcSuccess if succeded
+**/
+MrcStatus
+MrcRankMarginTool (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ const U16 mode = 0;
+ const MrcInput *Inputs;
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ MrcCommandMargin *CommandOut;
+ MrcRecvEnMargin *RecvEnOut;
+ MrcWrLevelMargin *WrLevelOut;
+ MrcStatus Status;
+ U32 BERStats[4];
+ U32 Offset;
+ U8 Rank;
+ U8 Param;
+ U8 RankMask;
+ U8 Controller;
+ U8 Channel;
+ U8 byte;
+ U8 bit;
+ U8 chBitMask;
+ U8 MaxMargin;
+ U8 DqLoopCount;
+ U8 CmdLoopCount;
+ S8 VrefOffsets[2];
+ BOOL Lpddr;
+ BOOL SkipVref;
+ BOOL SkipPrint;
+ MrcPower PwrChRank[MAX_CHANNEL][MAX_RANK_IN_CHANNEL];
+ Inputs = &MrcData->SysIn.Inputs;
+ Debug = &Inputs->Debug;
+ Outputs = &MrcData->SysOut.Outputs;
+ Status = mrcSuccess;
+ MrcOemMemorySet ((U8 *) BERStats, 0, sizeof (BERStats));
+ MrcOemMemorySet ((U8 *) VrefOffsets, 0, sizeof (VrefOffsets));
+ MrcOemMemorySet ((U8 *) PwrChRank, 0, sizeof (PwrChRank));
+
+ //
+ // Check if LPDDR3 memory is used
+ //
+ Lpddr = (Outputs->DdrType == MRC_DDR_TYPE_LPDDR3);
+
+
+ DqLoopCount = 17;
+ CmdLoopCount = (Lpddr) ? 10 : 17;
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Rank Margin Testing: DQ LC = %d, Cmd LC = %d\n\n", DqLoopCount, CmdLoopCount);
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "Margin\nParams: RcvEna\tWrLevel\tRdT\tWrT\tRdV\tWrV\tCmdT\tCmdV\tDimmPwr\tCpuPwr\tTotPwr\n"
+ );
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\tLft Rgt Lft Rgt Lft Rgt Lft Rgt Low Hi Low Hi Lft Rgt Low Hi\t[mW]\t[mW]\t[mW]\n"
+ );
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ //
+ // Select rank for REUT test
+ //
+ RankMask = 1 << Rank;
+ chBitMask = 0;
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ chBitMask |= SelectReutRanks (MrcData, Channel, RankMask, 0);
+ if ((MRC_BIT0 << Channel) & chBitMask) {
+ ChannelOut = &Outputs->Controller[0].Channel[Channel];
+ //
+ // Clear any old state in DataOffsetTrain
+ //
+ MrcOemMemorySetDword (&ChannelOut->DataOffsetTrain[0], 0, Outputs->SdramCount);
+ }
+ }
+ //
+ // Continue with next rank if this rank is not present on any channel
+ //
+ if (!(chBitMask)) {
+ continue;
+ }
+ //
+ // Setup Test
+ // SOE=1, EnCADB=0, EnCKE=0 SOE=1 sets bit12 of REUT_CH_ERR_CTL
+ //
+ SetupIOTestBasicVA (MrcData, chBitMask, DqLoopCount, NSOE, 0, 0, 8);
+ for (Param = RcvEna; Param <= WrLevel; Param++) {
+ if (Param == WrDqsT) {
+ continue;
+ }
+
+ //
+ // For Write/Read timing margining, we want to run traffic with Rd->Rd turnaround times of 4 and 5.
+ // This statement depends on the order of MRC_MarginTypes. If this enum's order changes, this
+ // statement must change.
+ //
+ if (Param == RdT) {
+ Outputs->DQPat = RdRdTA;
+ } else if (Param == RdV) {
+ Outputs->DQPat = BasicVA;
+ }
+
+ MaxMargin = ((Param == RdV) || (Param == WrV)) ? MAX_POSSIBLE_VREF : MAX_POSSIBLE_TIME;
+
+ //
+ // Run test for different Params
+ //
+ Status = MrcGetBERMarginCh (
+ MrcData,
+ Outputs->MarginResult,
+ chBitMask,
+ 0xFF,
+ Rank,
+ Param,
+ mode,
+ 1,
+ MaxMargin,
+ 0,
+ BERStats
+ );
+ }
+
+ //
+ // Use CADB test for Cmd to match Late Command Training
+ //
+ SetupIOTestCADB (MrcData, chBitMask, CmdLoopCount, NSOE, 1, 0);
+
+ //
+ // Run test for Cmd Timing
+ //
+ SkipVref = TRUE;
+ SkipPrint = TRUE;
+
+#ifdef ULT_FLAG
+ if (Lpddr) {
+ CmdLinearFindEdgesLpddr (MrcData, MrcIterationClock, chBitMask, RankMask, !SkipPrint);
+ } else
+#endif // ULT_FLAG
+ {
+ CmdLinearFindEdges (
+ MrcData,
+ MrcIterationClock,
+ chBitMask,
+ 0xFF,
+ 3,
+ -64,
+ 64,
+ 1,
+ VrefOffsets,
+ SkipPrint,
+ SkipVref
+ );
+ }
+
+ //
+ // Restore centered value
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ShiftPIforCmdTraining (MrcData, Channel, MrcIterationClock, 0xFF, 3, 0, 0);
+ }
+
+ Status = MrcResetSequence (MrcData);
+
+ //
+ // Run test for Cmd Voltage
+ //
+ Status = MrcGetBERMarginCh (
+ MrcData,
+ Outputs->MarginResult,
+ chBitMask,
+ 0xFF,
+ Rank,
+ CmdV,
+ mode,
+ 0,
+ MAX_POSSIBLE_VREF,
+ 0,
+ BERStats
+ );
+ Status = MrcResetSequence (MrcData);
+
+ CalcSysPower(MrcData, PwrChRank);
+
+#ifdef MRC_DEBUG_PRINT
+ //
+ // Print test results
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "C%dR%d:\t", Channel, Rank);
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "%2d %2d\t%2d %2d\t%2d %2d\t%2d %2d\t%2d %2d\t%2d %2d\t%2d %2d\t%2d %2d\t%2d.%d\t%2d.%d\t%2d.%d\n",
+ Outputs->MarginResult[LastRcvEna][Rank][Channel][0][0] / 10,
+ Outputs->MarginResult[LastRcvEna][Rank][Channel][0][1] / 10,
+ Outputs->MarginResult[LastWrLevel][Rank][Channel][0][0] / 10,
+ Outputs->MarginResult[LastWrLevel][Rank][Channel][0][1] / 10,
+ Outputs->MarginResult[LastRxT][Rank][Channel][0][0] / 10,
+ Outputs->MarginResult[LastRxT][Rank][Channel][0][1] / 10,
+ Outputs->MarginResult[LastTxT][Rank][Channel][0][0] / 10,
+ Outputs->MarginResult[LastTxT][Rank][Channel][0][1] / 10,
+ Outputs->MarginResult[LastRxV][Rank][Channel][0][0] / 10,
+ Outputs->MarginResult[LastRxV][Rank][Channel][0][1] / 10,
+ Outputs->MarginResult[LastTxV][Rank][Channel][0][0] / 10,
+ Outputs->MarginResult[LastTxV][Rank][Channel][0][1] / 10,
+ Outputs->MarginResult[LastCmdT][Rank][Channel][0][0] / 10,
+ Outputs->MarginResult[LastCmdT][Rank][Channel][0][1] / 10,
+ Outputs->MarginResult[LastCmdV][Rank][Channel][0][0] / 10,
+ Outputs->MarginResult[LastCmdV][Rank][Channel][0][1] / 10,
+ PwrChRank[Channel][Rank].DimmPwr / 10,
+ PwrChRank[Channel][Rank].DimmPwr % 10,
+ PwrChRank[Channel][Rank].CpuPower / 10,
+ PwrChRank[Channel][Rank].CpuPower % 10,
+ PwrChRank[Channel][Rank].TotPwr / 10,
+ PwrChRank[Channel][Rank].TotPwr % 10
+ );
+ }
+ }
+#endif
+ for (Controller = 0; Controller < MAX_CONTROLLERS; Controller++) {
+ ControllerOut = &Outputs->Controller[Controller];
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ CommandOut = &ChannelOut->Command[Rank];
+ CommandOut->Left = (U8) (Outputs->MarginResult[LastCmdT][Rank][Channel][0][0] / 10);
+ CommandOut->Right = (U8) (Outputs->MarginResult[LastCmdT][Rank][Channel][0][1] / 10);
+ CommandOut->Low = (U8) (Outputs->MarginResult[LastCmdV][Rank][Channel][0][0] / 10);
+ CommandOut->High = (U8) (Outputs->MarginResult[LastCmdV][Rank][Channel][0][1] / 10);
+ RecvEnOut = &ChannelOut->ReceiveEnable[Rank];
+ RecvEnOut->Left = (U8) (Outputs->MarginResult[LastRcvEna][Rank][Channel][0][0] / 10);
+ RecvEnOut->Right = (U8) (Outputs->MarginResult[LastRcvEna][Rank][Channel][0][1] / 10);
+ WrLevelOut = &ChannelOut->WriteLevel[Rank];
+ WrLevelOut->Left = (U8) (Outputs->MarginResult[LastWrLevel][Rank][Channel][0][0] / 10);
+ WrLevelOut->Right = (U8) (Outputs->MarginResult[LastWrLevel][Rank][Channel][0][1] / 10);
+ for (byte = 0; byte < Outputs->SdramCount; byte++) {
+ for (bit = 0; bit < MAX_BITS; bit++) {
+ ChannelOut->RxDqPb[Rank][byte][bit].Left = (U8) (Outputs->MarginResult[LastRxT][Rank][Channel][0][0] / 10);
+ ChannelOut->RxDqPb[Rank][byte][bit].Right = (U8) (Outputs->MarginResult[LastRxT][Rank][Channel][0][1] / 10);
+ ChannelOut->TxDqPb[Rank][byte][bit].Left = (U8) (Outputs->MarginResult[LastTxT][Rank][Channel][0][0] / 10);
+ ChannelOut->TxDqPb[Rank][byte][bit].Right = (U8) (Outputs->MarginResult[LastTxT][Rank][Channel][0][1] / 10);
+ ChannelOut->RxDqVrefPb[Rank][byte][bit].Low = (U8) (Outputs->MarginResult[LastRxV][Rank][Channel][0][0] / 10);
+ ChannelOut->RxDqVrefPb[Rank][byte][bit].High = (U8) (Outputs->MarginResult[LastRxV][Rank][Channel][0][1] / 10);
+ ChannelOut->TxDqVrefPb[Rank][byte][bit].Low = (U8) (Outputs->MarginResult[LastTxV][Rank][Channel][0][0] / 10);
+ ChannelOut->TxDqVrefPb[Rank][byte][bit].High = (U8) (Outputs->MarginResult[LastTxV][Rank][Channel][0][1] / 10);
+ }
+ }
+ }
+ }
+ }
+ } // for Rank
+
+ //
+ // Disable CADB Deselects after RMT
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ Offset = MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_PAT_CADB_CTRL_REG - MCHBAR_CH0_CR_REUT_CH_PAT_CADB_CTRL_REG) * Channel);
+ MrcWriteCR8 (MrcData, Offset, 0);
+ }
+ }
+ return Status;
+}
+
+/**
+@brief
+ Peform Read Voltage Centering in 2D.
+ Note: This function currently only supports param = WrV
+
+ @param[in, out] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - if t succeded return mrcSuccess
+ @todo - Need option for loopcount
+**/
+MrcStatus
+MrcWriteVoltageCentering2D (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ const MrcDebug *Debug;
+ const MrcInput *Inputs;
+ MrcOutput *Outputs;
+ MrcChannelOut *ChannelOut;
+ MrcStatus Status;
+ U32 (*marginch)[MAX_RESULT_TYPE][MAX_RANK_IN_CHANNEL][MAX_CHANNEL][MAX_SDRAM_IN_DIMM][MAX_EDGES];
+
+ U8 ResultType;
+ U8 ResultTypeT;
+ U8 loopcount;
+ U8 param;
+ U8 paramT;
+ U8 Channel;
+ U8 byte;
+ U8 tim;
+ U8 chBitMask;
+ U8 MaxTscale;
+ U8 SkipWait;
+ S8 SumEH;
+ S8 SumEHSign;
+ S8 TimePoints[3];
+ U8 EHWeights[sizeof (TimePoints)];
+ U16 mode;
+ S32 center;
+ S32 height;
+ U32 value0[MAX_CHANNEL];
+ U32 BERStats[4];
+ U32 TimScale[MAX_CHANNEL];
+ S32 centersum[MAX_CHANNEL];
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ Debug = &Inputs->Debug;
+ marginch = &Outputs->MarginResult;
+ Status = mrcSuccess;
+ loopcount = 17;
+ MaxTscale = 12;
+ SumEH = 0;
+ MrcOemMemorySet ((U8 *) BERStats, 0, sizeof (BERStats));
+ MrcOemMemorySet ((U8 *) EHWeights, 1, sizeof (EHWeights));
+ TimePoints[0] = -4;
+ TimePoints[1] = 0;
+ TimePoints[2] = 4;
+
+ //
+ // No input for param so set it to RdV
+ //
+ param = WrV;
+
+ //
+ // Assume rank0 is always popuplated
+ //
+ if (param == WrV) {
+ paramT = WrT;
+ } else {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "Error Handler: Unknown Margin Parameter\n");
+ Status = mrcFail;
+ return Status;
+ }
+
+ ResultType = GetMarginResultType (param);
+ ResultTypeT = GetMarginResultType (paramT);
+
+ //
+ /// @todo: Need to check if we can enable it for A0 or not
+ // Outputs->EnDumRd = 1;
+ // SOE = 00b(No Stop on error), EnCADB=0, EnCKE=0
+ //
+ //
+ /// @todo: Will enable the DQ tests instead of basic in the future
+ // SetupIOTestDQ (MrcData,Outputs->ValidChBitMask, loopcount, NSOE, 0, 0);
+ //
+ SetupIOTestBasicVA (MrcData, Outputs->ValidChBitMask, loopcount, NSOE, 0, 0, 8);
+
+ //
+ // Calculate SumEH for use in weighting equations
+ //
+ for (tim = 0; tim < sizeof (TimePoints); tim++) {
+ SumEH += EHWeights[tim];
+ }
+ //
+ // Select rank for REUT test
+ //
+ chBitMask = 0;
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!MrcChannelExist (Outputs, Channel)) {
+ continue;
+ }
+
+ ChannelOut = &Outputs->Controller[0].Channel[Channel];
+ chBitMask |= SelectReutRanks (MrcData, Channel, ChannelOut->ValidRankBitMask, 0);
+
+ //
+ // Clear any old state in DataTrain Offset
+ //
+ MrcOemMemorySetDword (&ChannelOut->DataOffsetTrain[0], 0, Outputs->SdramCount);
+ }
+ //
+ // ####################################################
+ // ############# Initialize EW/EH variables ########
+ // ####################################################
+ //
+ Status = GetMarginCh (MrcData, Outputs->MarginResult, paramT, 0xF);
+
+ //
+ // Update TimScale with results
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ TimScale[Channel] = 0;
+ if (!(chBitMask & (1 << Channel))) {
+ continue;
+ }
+
+ TimScale[Channel] = ((*marginch)[ResultTypeT][0][Channel][0][0] + (*marginch)[ResultTypeT][0][Channel][0][1]) / 20;
+ //
+ // It is possible TimScale[Channel] is 0.
+ //
+ if (!TimScale[Channel] || (TimScale[Channel] > MaxTscale)) {
+ TimScale[Channel] = MaxTscale;
+ }
+ }
+
+ Status = GetMarginCh (MrcData, Outputs->MarginResult, param, 0xF);
+
+ //
+ // ####################################################
+ // ###### Measure Eye Height at all Timing Points #####
+ // ####################################################
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "TimScale{0] is %d, TimScale{1] is %d\n", TimScale[0], TimScale[1]);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel\t0\t\t\t\t1\n");
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "WrTime\tLow\tHigh\tHeight\tCenter\t");
+ }
+ //
+ // Initialize parameters to 0
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ centersum[Channel] = 0;
+ value0[Channel] = 0;
+ }
+ //
+ // Loop through all the Time Points to Test
+ //
+ for (tim = 0; tim < sizeof (TimePoints); tim++) {
+ //
+ // Setup Timing Offset for this point
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!(chBitMask & (1 << Channel))) {
+ continue;
+ }
+
+ value0[Channel] = (S32) (TimePoints[tim] * TimScale[Channel]) / MaxTscale;
+
+ //
+ // There is no multicast per channel...
+ //
+ for (byte = 0; byte < Outputs->SdramCount; byte++) {
+ Status = ChangeMargin (MrcData, paramT, value0[Channel], 0, 0, Channel, 0, byte, 0, 1, 0, MrcRegFileStart);
+ }
+ }
+ //
+ // Run Margin Test
+ //
+ mode = 0;
+ Status = MrcGetBERMarginCh (
+ MrcData,
+ Outputs->MarginResult,
+ chBitMask,
+ 0xFF,
+ 0,
+ param,
+ mode,
+ 1,
+ MAX_POSSIBLE_VREF,
+ 0,
+ BERStats
+ );
+
+ //
+ // Store Results
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!(chBitMask & (1 << Channel))) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\t\t\t\t\t");
+ continue;
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d\t", value0[Channel]);
+
+ height = ((*marginch)[ResultType][0][Channel][0][1] + (*marginch)[ResultType][0][Channel][0][0]) / 10;
+ center = (S32) ((*marginch)[ResultType][0][Channel][0][1] - (*marginch)[ResultType][0][Channel][0][0]);
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "%d\t%d\t%d\t%d\t",
+ (*marginch)[ResultType][0][Channel][0][0] / 10,
+ (*marginch)[ResultType][0][Channel][0][1] / 10,
+ height,
+ center / 20
+ );
+ if (tim == 0) {
+ centersum[Channel] = 0;
+ }
+ //
+ // Calculate weight for this point
+ //
+ centersum[Channel] += EHWeights[tim] * center;
+ //
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "+----->centersum[%d] = %d, \n", Channel, centersum[Channel]);
+ //
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nWtdCntr\t");
+ //
+ // ####################################################
+ // ########### Center Results per Ch #############
+ // ####################################################
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!(chBitMask & (1 << Channel))) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\t\t\t\t\t");
+ continue;
+ }
+
+ ChannelOut = &Outputs->Controller[0].Channel[Channel];
+
+ //
+ // Calculate CenterPoint. Round to Nearest Int
+ //
+ SumEHSign = (centersum[Channel] < 0) ? (-1) : 1;
+
+ centersum[Channel] = (centersum[Channel] + 10 * SumEH * SumEHSign) / (20 * SumEH);
+
+ //
+ // Apply new centerpoint
+ // Only Byte 7 on Channel 1 is needed to update DIMM Vref
+ // Skip if there are more channels
+ //
+ SkipWait = (chBitMask >> (Channel + 1));
+ Status = ChangeMargin (MrcData, param, centersum[Channel], 0, 0, Channel, 0, 7, 0, 1, SkipWait, MrcRegFileCurrent);
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "%d\t\t\t\t", centersum[Channel]);
+
+ //
+ // Update MrcData for future tests
+ //
+ (*marginch)[ResultType][0][Channel][0][0] = (S32) ((*marginch)[ResultType][0][Channel][0][0]) + (10 * (centersum[Channel]));
+ (*marginch)[ResultType][0][Channel][0][1] = (S32) ((*marginch)[ResultType][0][Channel][0][1]) - (10 * (centersum[Channel]));
+
+ //
+ // Clean up after test
+ //
+ MrcOemMemorySetDword (&ChannelOut->DataOffsetTrain[0], 0, Outputs->SdramCount);
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n");
+
+ //
+ // Clean up
+ //
+ Status = ChangeMargin (MrcData, paramT, 0, 0, 1, 0, 0, 0, 0, 1, 0, MrcRegFileCurrent);
+
+ Outputs->EnDumRd = 0;
+ return Status;
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/WriteTraining/MrcWriteDqDqs.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/WriteTraining/MrcWriteDqDqs.h
new file mode 100644
index 0000000..d021aed
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/WriteTraining/MrcWriteDqDqs.h
@@ -0,0 +1,108 @@
+/** @file
+ The third stage of the write training is determining the PI setting for each
+ byte strobe to make sure that data is sent at the optimal location.
+ In order to do that a pattern of alternating zeros and ones is written to a block of the memory, and then read out.
+ By identifying the location where it is farthest away from where errors are shown the DQS will be aligned to the
+ center of the eye.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+**/
+
+#ifndef _MrcWriteDqDqs_h_
+#define _MrcWriteDqDqs_h_
+
+#include "MrcTypes.h"
+#include "McAddress.h"
+#include "MrcApi.h"
+#include "MrcCommandTraining.h"
+#include "MrcCommon.h"
+#include "MrcGlobal.h"
+#include "MrcReset.h"
+
+/**
+ @brief
+ this function executes the write timing centering in 2D.
+ Final write timing centering using 2D algorithm and per bit optimization.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - if it succeded returns mrcSuccess
+
+ **/
+extern
+MrcStatus
+MrcWriteTimingCentering (
+ IN MrcParameters *const MrcData
+ );
+
+/**
+ @brief
+ this function executes the write timing centering in 2D.
+ Final write timing centering using 2D algorithm and per bit optimization.
+
+ @param[in] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - if it succeded returns mrcSuccess
+
+ **/
+extern
+MrcStatus
+MrcWriteTimingCentering2D (
+ IN MrcParameters *const MrcData
+ );
+
+/**
+@brief
+ Rank Margin Tool - Measure margins across various parameters
+
+ @param[in, out] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - mrcSuccess if succeded
+**/
+extern
+MrcStatus
+MrcRankMarginTool (
+ IN OUT MrcParameters *const MrcData
+ );
+
+/**
+@brief
+ this function execute the write timing centering in 2D.
+ Final write timing centering using 2D algorithm and per bit optimization
+
+ @param[in, out] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - if it succeded returns mrcSuccess
+**/
+/**
+@brief
+ Peform Read Voltage Centering in 2D.
+ Note: This function currently only supports param = WrV
+
+ @param[in, out] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - if it succeded return mrcSuccess
+ @todo - Need option for loopcount
+**/
+extern
+MrcStatus
+MrcWriteVoltageCentering2D (
+ IN OUT MrcParameters *const MrcData
+ );
+
+#endif // _MrcWriteDqDqs_h_
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/WriteTraining/MrcWriteLeveling.c b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/WriteTraining/MrcWriteLeveling.c
new file mode 100644
index 0000000..8b71620
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/WriteTraining/MrcWriteLeveling.c
@@ -0,0 +1,1079 @@
+/** @file
+ The write leveling flow is the first part of the write training.
+ In this stage the memory controller needs to synchronize its DQS sending
+ with the clock for each DRAM. The DRAM can be put in a mode where for a
+ write command it responds by sampling the clock using DQS and sending it
+ back as the data. The IO can receive this and tune the DQS alignment so
+ it will appear in sync with the clock at the DRAM side.
+ The following algorithm is used for the write leveling flow:
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+
+**/
+#include "MrcWriteLeveling.h"
+
+/**
+@brief
+ this function execute the Jedec write leveling Cleanup.
+ Center TxDQS-CLK timing
+
+ @param[in, out] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - if it succeded return mrcSuccess
+**/
+MrcStatus
+MrcJedecWriteLevelingCleanUp (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ const MRC_REUTAddress REUTAddress = {{0, 0, 0, 0}, // Start
+ {0, 0, 0, 1023}, // Stop
+ {0, 0, 0, 0}, // Order
+ {0, 0, 0, 0}, // IncRate
+ {0, 0, 0, 1}}; // IncValue
+ const U8 DumArr[7] = {1, 1, 1, 1, 1, 1, 1};
+ const U8 DqOffsetMax = 7;
+ const S8 DqOffsets[7] = {0, -10, 10, -5, 5, -15, 15};
+ const S8 Offsets[5] = {0, 1, -1, 2, 3};
+ const U8 PMaskConst[8] = {0, 0, 1, 1, 1, 1, 0, 0};
+ const U32 CleanUpSeeds[MRC_WDB_NUM_MUX_SEEDS] = {0xAAAAAA, 0xCCCCCC, 0xF0F0F0};
+ const U32 NormalSeeds[MRC_WDB_NUM_MUX_SEEDS] = {0xA10CA1, 0xEF0D08, 0xAD0A1E};
+ const MrcInput *Inputs;
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ MrcStatus Status;
+ U8 Channel;
+ U8 Rank;
+ U8 Byte;
+ U8 offset;
+ U8 ChBitMask;
+ U8 RankMask; // RankBitMask for both channels
+ U8 ValidRankMask;
+ U8 Pattern[4][2];
+ U8 PMask[sizeof (PMaskConst)];
+ U8 AllGood;
+ U8 AllGoodLoops;
+ U8 DqOffset;
+ U8 RankDouble;
+ U8 RankHalf;
+ U8 RankMod2;
+ U8 Start;
+ S8 ByteOff[MAX_CHANNEL][MAX_SDRAM_IN_DIMM]; // Passing offset for each ch/byte.
+ S8 ByteSum[MAX_CHANNEL]; // Sum of passing offsets for a ch
+ S8 TargetOffset;
+ U16 ByteMask;
+ U16 ValidByteMask;
+ U16 Result;
+ U16 SkipMe;
+ U16 BytePass[MAX_CHANNEL]; // Bit mask indicating which ch/byte has passed
+ S16 GlobalByteOff;
+ U32 CRValue;
+ U32 Offset;
+ U32 CRAddDelay[MAX_CHANNEL];
+ S32 LocalOffset;
+ BOOL Done;
+#ifdef ULT_FLAG
+ BOOL Lpddr;
+#endif //ULT_FLAG
+ MRC_WDBPattern WDBPattern;
+
+ MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_STRUCT ReutChPatWdbClMuxCfg;
+ DDRDATA0CH0_CR_TXTRAINRANK0_STRUCT CrTxTrainRank;
+#ifdef MRC_DEBUG_PRINT
+ U32 ErrLower[MAX_CHANNEL];
+ U32 ErrUpper[MAX_CHANNEL];
+#endif // MRC_DEBUG_PRINT
+
+ //
+ // Setup REUT Pattern
+ // Use 0x00FFC33C pattern to keep DQ-DQS simple but detect any failures
+ // Same Pattern as NHM/WSM
+ //
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerOut = &Outputs->Controller[0];
+ Debug = &Inputs->Debug;
+ Status = mrcSuccess;
+ LocalOffset = 0;
+ Done = TRUE;
+ Pattern[0][0] = 0x00;
+ Pattern[0][1] = 0xFF;
+ Pattern[1][0] = 0xFF;
+ Pattern[1][1] = 0x00;
+ Pattern[2][0] = 0xC3;
+ Pattern[2][1] = 0x3C;
+ Pattern[3][0] = 0x3C;
+ Pattern[3][1] = 0xC3;
+ WDBPattern.IncRate = 1;
+ WDBPattern.Start = 0;
+ WDBPattern.Stop = 3;
+ WDBPattern.DQPat = BasicVA;
+ MrcOemMemoryCpy (PMask, (U8 *) PMaskConst, sizeof (PMask));
+ MrcOemMemorySet ((U8 *) CRAddDelay, 0, sizeof (CRAddDelay));
+#ifdef MRC_DEBUG_PRINT
+ MrcOemMemorySet ((U8 *) ErrLower, 0, sizeof (ErrLower));
+ MrcOemMemorySet ((U8 *) ErrUpper, 0, sizeof (ErrUpper));
+#endif // MRC_DEBUG_PRINT
+
+#ifdef ULT_FLAG
+ //
+ // Check if LPDDR3 memory is used
+ //
+ Lpddr = (Outputs->DdrType == MRC_DDR_TYPE_LPDDR3);
+#endif // ULT_FLAG
+ //
+ // Spread = 8, Start = 0, 1, 2 and 3
+ //
+ for (Start = 0; Start < (sizeof (Pattern) / sizeof (Pattern[0])); Start++) {
+ WriteWDBFixedPattern (MrcData, Pattern[Start], PMask, 8, Start);
+ }
+
+ //
+ // Set LSFR Seed to be sequential
+ //
+ MrcProgramLFSR (MrcData, CleanUpSeeds);
+
+ //
+ // Set Channel and Rank bit masks
+ //
+ ChBitMask = Outputs->ValidChBitMask;
+ ValidRankMask = Outputs->ValidRankMask;
+ ValidByteMask = (MRC_BIT0 << Outputs->SdramCount) - 1; // 0x1FF or 0xFF
+ //
+ // Setip IO test CmdPat=PatWrRd, NumCL=4, LC=4, REUTAddress, SOE=3,
+ // WDBPattern, EnCADB=0, EnCKE=0, SubSeqWait=0 )
+ //
+ SetupIOTest (MrcData, ChBitMask, PatWrRd, 2, 4, &REUTAddress, NSOE, &WDBPattern, 0, 0, 0);
+
+ //
+ // Progam BITBUFFER for JWLT
+ //
+ ReutChPatWdbClMuxCfg.Data = 0;
+ ReutChPatWdbClMuxCfg.Bits.Mux0_Control = BTBUFFER;
+ ReutChPatWdbClMuxCfg.Bits.Mux1_Control = BTBUFFER;
+ ReutChPatWdbClMuxCfg.Bits.Mux2_Control = BTBUFFER;
+ ReutChPatWdbClMuxCfg.Bits.ECC_Data_Source_Sel = 1;
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ Offset = MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_REG - MCHBAR_CH0_CR_REUT_CH_PAT_WDB_CL_MUX_CFG_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, ReutChPatWdbClMuxCfg.Data);
+ }
+ }
+
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ //
+ // Select Rank for REUT test
+ //
+ ChBitMask = 0;
+ RankMask = MRC_BIT0 << Rank;
+ RankDouble = Rank * 2;
+ RankHalf = Rank / 2;
+ RankMod2 = Rank % 2;
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ ChBitMask |= SelectReutRanks (MrcData, Channel, (RankMask), 0);
+ BytePass[Channel] = ByteSum[Channel] = 0;
+ }
+ //
+ // Skip if both channels empty
+ //
+ if (!(RankMask & ValidRankMask)) {
+ continue;
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nRank %d\n", Rank);
+
+ //
+ // *************************************************
+ // Sweep through the cycle offsets until we find a value that passes
+ // *************************************************
+ //
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Sweep through the cycle offsets until we find a value that passes\n");
+
+ if (RankMask & ValidRankMask) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Channel 0 1\nDelay DqOffset Byte \t");
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE, (
+ Outputs->SdramCount == MAX_SDRAM_IN_DIMM
+ ) ? "0 1 2 3 4 5 6 7 8 0 1 2 3 4 5 6 7 8" : "0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7"
+ );
+ }
+
+ for (offset = 0; offset < sizeof (Offsets); offset++) {
+ //
+ // Program new delay offsets to DQ/DQS timing:
+ //
+ /// @todo - Address debuging switches or remove.
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Program new delay offsets to DQ/DQS timing %d\n", Offsets[offset]);
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!(MrcRankInChannelExist (MrcData, Rank, Channel))) {
+ continue;
+ }
+
+ ChannelOut = &ControllerOut->Channel[Channel];
+
+ //
+ // Calculate offsets
+ //
+ GlobalByteOff = 0;
+ if (Offsets[offset] > MAX_ADD_DELAY) {
+ CRAddDelay[Channel] = MrcBitSwap (CRAddDelay[Channel], MAX_ADD_DELAY, RankDouble, 2);
+ GlobalByteOff = 128 * (Offsets[offset] - MAX_ADD_DELAY);
+ } else if (Offsets[offset] < 0) {
+ CRAddDelay[Channel] = MrcBitSwap (CRAddDelay[Channel], 0, RankDouble, 2);
+ GlobalByteOff = 128 * Offsets[offset];
+ } else {
+ CRAddDelay[Channel] = MrcBitSwap (CRAddDelay[Channel], Offsets[offset], RankDouble, 2);
+ }
+ //
+ // Write Tx DQ/DQS Flyby delays
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Add GlobalByteOff = %d to TxDQS Flyby delay: Ch %d \n", GlobalByteOff, Channel);
+ //
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ CRValue = ChannelOut->TxDqs[Rank][Byte] + GlobalByteOff;
+ CrTxTrainRank.Data = 0;
+ CrTxTrainRank.Bits.TxDqDelay = CRValue + 32;
+ CrTxTrainRank.Bits.TxDqsDelay = CRValue;
+ CrTxTrainRank.Bits.TxEqualization = ChannelOut->TxEq[Rank][Byte];
+ UpdateTxT (MrcData, Channel, Rank, Byte, 0x3, CrTxTrainRank.Data);
+ //
+ /// @todo - Address debuging switches or remove.
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "CRValue = 0x%x \n", CrTxTrainRank.Data);
+ //
+ }
+ //
+ // Write Wr ADD Delays
+ //
+ Offset = MCHBAR_CH0_CR_SC_WR_ADD_DELAY_REG + ((MCHBAR_CH1_CR_SC_WR_ADD_DELAY_REG - MCHBAR_CH0_CR_SC_WR_ADD_DELAY_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, CRAddDelay[Channel]);
+ //
+ /// @todo - Address debuging switches or remove.
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "CRAddDelay[%d] = 0x%x \n", Channel, CRAddDelay[Channel]);
+ //
+ }
+
+#ifdef ULT_FLAG
+ if (!Lpddr) {
+#endif // ULT_FLAG
+ //
+ // Reset FIFOs & Reset DRAM DLL (Micron WorkAround). Wait 1uS for test to complete
+ //
+ Status = IoReset (MrcData);
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+ Status = MrcWriteMRS (
+ MrcData,
+ Channel,
+ RankMask,
+ mrMR0,
+ ChannelOut->Dimm[RankHalf].Rank[RankMod2].MR[mrMR0] | (MRC_BIT0 << 8)
+ );
+ }
+ }
+
+ MrcWait (MrcData, (1 * HPET_1US));
+#ifdef ULT_FLAG
+ }
+#endif // ULT_FLAG
+
+ //
+ // Run Test across all DqOffsets points
+ //
+ for (DqOffset = 0; DqOffset < DqOffsetMax; DqOffset++) {
+ //
+ // Update Offset
+ //
+ ChangeMargin (MrcData, WrT, DqOffsets[DqOffset], 0, 1, 0, Rank, 0, 0, 0, 0, MrcRegFileRank);
+
+ //
+ // Run Test
+ // DQPat = BasicVA, DumArr, ClearErrors = 1, mode = 0
+ //
+ RunIOTest (MrcData, ChBitMask, BasicVA, DumArr, 1, 0);
+
+ //
+ // Update results for all ch/bytes
+ //
+ Done = TRUE;
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n% 3d\t% 3d\t \t", Offsets[offset], DqOffsets[DqOffset]);
+
+ //
+ // Update results for all ch/bytes
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!(MrcRankInChannelExist (MrcData, Rank, Channel))) {
+ if (Channel == 0) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ (Outputs->SdramCount == MAX_SDRAM_IN_DIMM) ? " " : " "
+ );
+ }
+
+ continue;
+ }
+ //
+ // Read out per byte error results and check for any byte error
+ //
+ Offset = 4 + MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_REG +
+ (
+ (
+ MCHBAR_CH1_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_REG -
+ MCHBAR_CH0_CR_REUT_CH_ERR_ECC_CHUNK_RANK_BYTE_NTH_STATUS_REG
+ ) * Channel
+ );
+ Result = (U16) MrcReadCR (MrcData, Offset);
+ SkipMe = (Result & ValidByteMask) | BytePass[Channel];
+
+#ifdef MRC_DEBUG_PRINT
+ Offset = MCHBAR_CH0_CR_REUT_CH_ERR_DATA_STATUS_REG + ((MCHBAR_CH1_CR_REUT_CH_ERR_DATA_STATUS_REG - MCHBAR_CH0_CR_REUT_CH_ERR_DATA_STATUS_REG) * Channel);
+ ErrLower[Channel] = MrcReadCR (MrcData, Offset);
+ //
+ // Lower 32 bits
+ //
+ ErrUpper[Channel] = MrcReadCR (MrcData, Offset + 4);
+ //
+ // Upper 32 bits
+ //
+#endif // MRC_DEBUG_PRINT
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ ByteMask = MRC_BIT0 << Byte;
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ ((Result & ValidByteMask) & ByteMask) ?
+ "# " : //Fail
+ ". " // Pass
+ );
+ //
+ // If this byte has failed or previously passed, nothing to do
+ //
+ if (SkipMe & ByteMask) {
+ continue;
+ }
+
+ BytePass[Channel] |= ByteMask;
+ ByteOff[Channel][Byte] = Offsets[offset];
+ ByteSum[Channel] += Offsets[offset];
+ }
+ //
+ /// @todo - Address debuging switches or remove.
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "For DqOffsets %d: BytePass[%d] = 0x%X, Result = 0x%x, SkipMe = 0x%x\n", DqOffsets[DqOffset], Channel, BytePass[Channel], Result, SkipMe);
+ //
+ if (BytePass[Channel] != ValidByteMask) {
+ Done = FALSE;
+ }
+ }
+
+#ifdef MRC_DEBUG_PRINT
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "0x%08x%08x ",
+ ErrUpper[Channel],
+ ErrLower[Channel]
+ );
+ }
+ }
+#endif // MRC_DEBUG_PRINT
+ //
+ // Jump out of the for DqOffset loop if everybody is passing
+ //
+ if (Done == TRUE) {
+ break;
+ }
+ }
+ //
+ // Jump out of the for offset loop if everybody is passing
+ //
+ if (Done == TRUE) {
+ break;
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "\n");
+
+ //
+ // Walk through and find the correct value for each ch/byte
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!(MrcRankInChannelExist (MrcData, Rank, Channel))) {
+ continue;
+ }
+
+ ChannelOut = &ControllerOut->Channel[Channel];
+
+ if (Done == FALSE) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_ERROR,
+ "Error! Write Leveling CleanUp - Couldn't find a passing value for all bytes on Channel %u Rank %u:\nBytes - ",
+ Channel,
+ Rank
+ );
+#ifdef MRC_DEBUG_PRINT
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, ((BytePass[Channel] ^ ValidByteMask) & (1 << Byte)) ? "%d " : "", Byte);
+ }
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "\n");
+#endif
+ return mrcWriteLevelingError;
+ }
+ //
+ // Calculate the average offset, rounding up
+ // Apply that offset to the global MC CRAddDelay register
+ //
+ TargetOffset = (ByteSum[Channel] + (S8) (Outputs->SdramCount / 2)) / (S8) Outputs->SdramCount;
+ //
+ /// @todo - Address debuging switches or remove.
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "TargetOffset = 0x%x, ByteSum[%d] = 0x%x \n", TargetOffset, Channel, ByteSum[Channel]);
+ //
+ AllGood = 0;
+ AllGoodLoops = 0;
+ GlobalByteOff = 0;
+ while (AllGood == 0) {
+ //
+ // Update CRAddDelay and GlobalByteOff
+ //
+ GlobalByteOff = 0;
+ if (TargetOffset > MAX_ADD_DELAY) {
+ CRAddDelay[Channel] = MrcBitSwap (CRAddDelay[Channel], MAX_ADD_DELAY, RankDouble, 2);
+ GlobalByteOff = 128 * (TargetOffset - MAX_ADD_DELAY);
+ } else if (TargetOffset < 0) {
+ CRAddDelay[Channel] = MrcBitSwap (CRAddDelay[Channel], 0, RankDouble, 2);
+ GlobalByteOff = 128 * TargetOffset;
+ } else {
+ CRAddDelay[Channel] = MrcBitSwap (CRAddDelay[Channel], TargetOffset, RankDouble, 2);
+ }
+ //
+ /// @todo - Address debuging switches or remove.
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "GlobalByteOff = 0x%x, CRAddDelay[%d] = 0x%x \n", GlobalByteOff, Channel, CRAddDelay[Channel]);
+ // Refine TargetOffset to make sure it works for all byte lanes
+ //
+ AllGood = 1;
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ LocalOffset = GlobalByteOff + 128 * (ByteOff[Channel][Byte] - TargetOffset);
+ if ((ChannelOut->TxDq[Rank][Byte] + LocalOffset) > (511 - 64)) {
+ AllGood = 0;
+ AllGoodLoops += 1;
+ TargetOffset += 1;
+ break;
+ }
+
+ if ((ChannelOut->TxDqs[Rank][Byte] + LocalOffset) < 96) {
+ AllGood = 0;
+ AllGoodLoops += 1;
+ TargetOffset -= 1;
+ break;
+ }
+ //
+ /// @todo - Address debuging switches or remove.
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "TargetOffset = 0x%x, ByteOff[%d][%d] = 0x%x \n", TargetOffset, Channel, Byte, ByteOff[Channel][Byte]);
+ //
+ }
+ //
+ // Avoid an infinite loop
+ //
+ if (AllGoodLoops > 3) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "Error Handler1: JWL CleanUp - TargetOffset refining failed \n");
+ return mrcFail;
+ }
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "C%d.R%d: Offset\tFinalEdge\n", Channel, Rank);
+ //
+ // Program the final settings to the DQ bytes and update MrcData
+ //
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ LocalOffset = GlobalByteOff + 128 * (ByteOff[Channel][Byte] - TargetOffset);
+ ChannelOut->TxDq[Rank][Byte] += (S16) LocalOffset;
+ ChannelOut->TxDqs[Rank][Byte] += (S16) LocalOffset;
+ UpdateTxT (MrcData, Channel, Rank, Byte, 0xFF, 0);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, " B%d: %d\t%d\n", Byte, LocalOffset, ChannelOut->TxDqs[Rank][Byte]);
+ }
+ //
+ /// @todo - Address debuging switches or remove.
+ // MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "LocalOffset = 0x%x \n", LocalOffset);
+ // Update MC Delay
+ //
+ Offset = MCHBAR_CH0_CR_SC_WR_ADD_DELAY_REG + ((MCHBAR_CH1_CR_SC_WR_ADD_DELAY_REG - MCHBAR_CH0_CR_SC_WR_ADD_DELAY_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, CRAddDelay[Channel]);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "CRAddDelay[%d] = 0x%x \n", Channel, CRAddDelay[Channel]);
+
+#ifdef ULT_FLAG
+ if (!Lpddr) {
+#endif // ULT_FLAG
+ //
+ // Clean up after Test
+ //
+ Status = MrcWriteMRS (
+ MrcData,
+ Channel,
+ RankMask,
+ mrMR0,
+ ChannelOut->Dimm[RankHalf].Rank[RankMod2].MR[mrMR0] | (MRC_BIT0 << 8)
+ );
+ MrcWait (MrcData, (1 * HPET_1US));
+#ifdef ULT_FLAG
+ }
+#endif // ULT_FLAG
+ }
+ }
+ //
+ // Clean up after Test
+ // Restore WDB - VicRot=8, Start=0 and restore default seed
+ //
+ WriteWDBVAPattern (MrcData, 0, BASIC_VA_PATTERN_SPRED_8, 8, 0);
+ MrcProgramLFSR (MrcData, NormalSeeds);
+
+ MrcWriteCrMulticast (MrcData, DDRDATA_CR_DDRCRDATAOFFSETTRAIN_REG, 0);
+ Status = IoReset (MrcData);
+
+ return Status;
+}
+
+/**
+@brief
+ this function execute the Jedec write leveling training.
+ Center TxDQS-CLK timing
+
+ @param[in, out] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - if it succedes return mrcSuccess
+**/
+MrcStatus
+MrcJedecWriteLevelingTraining (
+ IN OUT MrcParameters *const MrcData
+ )
+{
+ const MrcInput *Inputs;
+ const MrcDebug *Debug;
+ MrcOutput *Outputs;
+ MrcControllerOut *ControllerOut;
+ MrcChannelOut *ChannelOut;
+ TOdtValue *OdtTableIndex;
+ MrcStatus Status;
+ U8 Channel;
+ U8 Rank;
+ U8 RankDouble;
+ U8 RankHalf;
+ U8 RankMod2;
+ U8 Byte;
+ U8 refbyte;
+ U8 ChBitMask;
+ U8 RankMask; // RankBitMask for both channels
+ U8 ValidRankMask;
+ U8 OtherDimm;
+ U8 OdtMatrix;
+ U16 WLStart;
+ U16 WLStop;
+ U16 WLDelay;
+ U8 WLStep;
+ U32 WaitTime;
+ U32 CRValue;
+ U32 Offset;
+ U32 DqsToggleTime;
+ S32 InitialPassingStart[MAX_CHANNEL][MAX_SDRAM_IN_DIMM];
+ S32 InitialPassingEnd[MAX_CHANNEL][MAX_SDRAM_IN_DIMM];
+ S32 CurrentPassingStart[MAX_CHANNEL][MAX_SDRAM_IN_DIMM];
+ S32 CurrentPassingEnd[MAX_CHANNEL][MAX_SDRAM_IN_DIMM];
+ S32 LargestPassingStart[MAX_CHANNEL][MAX_SDRAM_IN_DIMM];
+ S32 LargestPassingEnd[MAX_CHANNEL][MAX_SDRAM_IN_DIMM];
+ S32 iWidth;
+ S32 cWidth;
+ S32 lWidth;
+ S32 ByteWidth;
+ BOOL Pass;
+ BOOL RankIsx16;
+ BOOL SavedRestoreMRS;
+#ifdef ULT_FLAG
+ BOOL Lpddr;
+#endif //ULT_FLAG
+
+ DDR3_MODE_REGISTER_1_STRUCT Ddr3ModeRegister1;
+ DDRDATACH0_CR_DDRCRDATACONTROL0_STRUCT DdrCrDataControl0;
+ DDRDATA0CH0_CR_DDRCRDATACONTROL2_STRUCT DdrCrDataControl2;
+ MCHBAR_CH0_CR_REUT_CH_MISC_ODT_CTRL_STRUCT ReutChMiscOdtCtrl;
+ DDRDATA0CH0_CR_DDRCRDATACONTROL0_STRUCT DdrCrData0Control0;
+ DDRDATA0CH0_CR_DATATRAINFEEDBACK_STRUCT DataTrainFeedback;
+
+ Inputs = &MrcData->SysIn.Inputs;
+ Outputs = &MrcData->SysOut.Outputs;
+ ControllerOut = &Outputs->Controller[0];
+ Debug = &Inputs->Debug;
+ Status = mrcSuccess;
+ OdtTableIndex = NULL;
+ CRValue = 0;
+ ChBitMask = Outputs->ValidChBitMask;
+ ValidRankMask = Outputs->ValidRankMask;
+
+ // Save the flag and force MRS recalculation
+ SavedRestoreMRS = Outputs->RestoreMRs;
+ Outputs->RestoreMRs = FALSE;
+
+ DqsToggleTime = 1024;
+#ifdef ULT_FLAG
+ //
+ // Check if LPDDR3 memory is used
+ //
+ Lpddr = (Outputs->DdrType == MRC_DDR_TYPE_LPDDR3);
+
+ if (Lpddr) {
+ DqsToggleTime = 2048;
+ }
+#endif // ULT_FLAG
+
+ //
+ // Enabling WLmode causes DQS to toggle for 1024 qclk. Wait for this to stop
+ // Round up to nearest uS
+ //
+
+ WaitTime = (Outputs->Qclkps * DqsToggleTime + 500000) / 1000000;
+ //
+ // Propagate delay values (without a write command) and Set Qoff on all ranks.
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+ ChannelOut = &ControllerOut->Channel[Channel];
+
+ //
+ // Propagate delay values from rank 0 to prevent assertion failures in RTL
+ //
+ DdrCrDataControl0.Data = ChannelOut->DqControl0.Data;
+ DdrCrDataControl0.Bits.ReadRFRd = 0;
+ DdrCrDataControl0.Bits.ReadRFWr = 1;
+ DdrCrDataControl0.Bits.ReadRFRank = 0;
+ Offset = DDRDATACH0_CR_DDRCRDATACONTROL0_REG + ((DDRDATACH1_CR_DDRCRDATACONTROL0_REG - DDRDATACH0_CR_DDRCRDATACONTROL0_REG) * Channel);
+ MrcWriteCrMulticast (MrcData, Offset, DdrCrDataControl0.Data);
+
+ //
+ // Set ForceBiasOn and make sure ForceRxAmpOn is cleared
+ //
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ DdrCrDataControl2.Data = ChannelOut->DqControl2[Byte].Data;
+ DdrCrDataControl2.Bits.ForceBiasOn = 1;
+ DdrCrDataControl2.Bits.ForceRxOn = 0;
+#ifdef ULT_FLAG
+ if (Lpddr) {
+ DdrCrDataControl2.Bits.WlLongDelEn = 1;
+ }
+#endif // ULT_FLAG
+ Offset = DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG +
+ ((DDRDATA0CH1_CR_DDRCRDATACONTROL2_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG) * Channel) +
+ ((DDRDATA1CH0_CR_DDRCRDATACONTROL2_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG) * Byte);
+ MrcWriteCR (MrcData, Offset, DdrCrDataControl2.Data);
+ }
+ }
+ }
+
+ for (Rank = 0; Rank < MAX_RANK_IN_CHANNEL; Rank++) {
+ RankMask = MRC_BIT0 << Rank;
+ if (!(RankMask & ValidRankMask)) {
+ //
+ // Skip if all channels empty
+ //
+ continue;
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nRank %d\n", Rank);
+ RankDouble = Rank * 2;
+ RankHalf = Rank / 2;
+ RankMod2 = Rank % 2;
+ //
+ // Program MR1: Set A7 to enter Write Leveling mode
+ // Write MaskRasWe to prevent scheduler from issuing non-Read commands
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcRankInChannelExist (MrcData, Rank, Channel)) {
+
+ ChannelOut = &ControllerOut->Channel[Channel];
+
+#ifdef ULT_FLAG
+ //
+ // Enable WL mode in MR2[7]
+ //
+ if (Lpddr) {
+ CRValue = (ChannelOut->Dimm[RankHalf].Rank[RankMod2].MR[mrMR2]);
+ Status = MrcIssueMrw (MrcData, Channel, Rank, mrMR2, (CRValue | MRC_BIT7), FALSE, FALSE);
+ } else
+#endif // ULT_FLAG
+ {
+ Ddr3ModeRegister1.Data = ChannelOut->Dimm[RankHalf].Rank[RankMod2].MR[mrMR1];
+ Ddr3ModeRegister1.Bits.WriteLeveling = 1;
+
+ OdtTableIndex = GetOdtTableIndex (MrcData, Channel, RANK_TO_DIMM_NUMBER (Rank));
+ if (OdtTableIndex == NULL) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "Error: OdtTableIndex is NULL!\n");
+ return mrcFail;
+ }
+#ifdef ULT_FLAG
+ if (Inputs->CpuModel == cmHSW_ULT) { // DDR3L case
+ Ddr3ModeRegister1 = UpdateRttNomValue (MrcData, OdtTableIndex->RttWr, Ddr3ModeRegister1);
+ }
+#endif // ULT_FLAG
+
+ //
+ // In write leveling mode Rtt_Nom = Rtt_Wr ONLY for 2DPC
+ //
+ if (ChannelOut->DimmCount == 2) {
+ Ddr3ModeRegister1 = UpdateRttNomValue (MrcData, OdtTableIndex->RttWr, Ddr3ModeRegister1);
+ }
+ Status = MrcWriteMRS (MrcData, Channel, RankMask, mrMR1, (U16) Ddr3ModeRegister1.Data);
+ }
+
+ //
+ // Assert ODT for myself
+ //
+ OdtMatrix = RankMask;
+ if (ChannelOut->DimmCount == 2) {
+ //
+ // Calculate non-target DIMM
+ //
+ OtherDimm = ((Rank + 2) / 2) & MRC_BIT0;
+ //
+ // Assert ODT for non-target DIMM
+ //
+ OdtMatrix |= 1 << (2 * OtherDimm);
+ }
+
+ ReutChMiscOdtCtrl.Data = 0;
+#ifdef ULT_FLAG
+ if (Lpddr) {
+ //
+ // Only one ODT pin for ULT
+ //
+ ReutChMiscOdtCtrl.Bits.ODT_On = 1;
+ ReutChMiscOdtCtrl.Bits.ODT_Override = 1;
+ }
+#endif // ULT_FLAG
+#ifdef TRAD_FLAG
+ if ((Inputs->CpuModel == cmHSW) || (Inputs->CpuModel == cmCRW)) {
+ ReutChMiscOdtCtrl.Bits.ODT_On = OdtMatrix;
+ ReutChMiscOdtCtrl.Bits.ODT_Override = MCHBAR_CH0_CR_REUT_CH_MISC_ODT_CTRL_ODT_Override_MAX;
+ }
+#endif // TRAD_FLAG
+ Offset = MCHBAR_CH0_CR_REUT_CH_MISC_ODT_CTRL_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_MISC_ODT_CTRL_REG - MCHBAR_CH0_CR_REUT_CH_MISC_ODT_CTRL_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, ReutChMiscOdtCtrl.Data);
+ }
+ } // for Channel
+
+ //
+ // ******************************************
+ // STEP 1 and 2: Find middle of high region
+ // ******************************************
+ //
+ WLStart = 192;
+ WLStop = 320;
+ WLStep = 2;
+
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\n\tCh0\t\t\t\t\t\t\t\t%sCh1\n",
+ (Outputs->SdramCount == MAX_SDRAM_IN_DIMM) ? "\t" : ""
+ );
+
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "WLDelay%s%s",
+ (Outputs->SdramCount == MAX_SDRAM_IN_DIMM) ? "\t0\t1\t2\t3\t4\t5\t6\t7\t8" : "\t0\t1\t2\t3\t4\t5\t6\t7",
+ (Outputs->SdramCount == MAX_SDRAM_IN_DIMM) ? "\t0\t1\t2\t3\t4\t5\t6\t7\t8" : "\t0\t1\t2\t3\t4\t5\t6\t7"
+ );
+
+ for (WLDelay = WLStart; WLDelay < WLStop; WLDelay += WLStep) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n %d:", WLDelay);
+ //
+ // Program WL DQS Delays:
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcRankInChannelExist (MrcData, Rank, Channel)) {
+
+ ChannelOut = &ControllerOut->Channel[Channel];
+
+ //
+ // Enable Write Level Mode in DDR and Propagate delay values (without a write command).
+ // Stay in WLMode.
+ //
+ DdrCrData0Control0.Data = ChannelOut->DqControl0.Data;
+ DdrCrData0Control0.Bits.WLTrainingMode = 1;
+ DdrCrData0Control0.Bits.TxPiOn = 1;
+ DdrCrData0Control0.Bits.ReadRFRd = 0;
+ DdrCrData0Control0.Bits.ReadRFWr = 1;
+ DdrCrData0Control0.Bits.ReadRFRank = Rank;
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ UpdateTxT (MrcData, Channel, Rank, Byte, 1, WLDelay);
+
+ Offset = DDRDATA0CH0_CR_DDRCRDATACONTROL0_REG +
+ ((DDRDATA0CH1_CR_DDRCRDATACONTROL0_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL0_REG) * Channel) +
+ ((DDRDATA1CH0_CR_DDRCRDATACONTROL0_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL0_REG) * Byte);
+ MrcWriteCR (MrcData, Offset, DdrCrData0Control0.Data);
+ }
+ }
+ }
+
+ if (WLDelay == WLStart) {
+ MrcWait (MrcData, (WaitTime * HPET_1US)); // Wait for the first burst to finish
+ }
+
+ Status = IoReset (MrcData);
+
+ MrcWait (MrcData, (WaitTime * HPET_1US));
+
+ //
+ // Update results for all Channels/Bytes
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (!MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ "\t\t\t\t\t\t\t\t%s",
+ (Outputs->SdramCount == MAX_SDRAM_IN_DIMM) ? "\t" : ""
+ );
+ continue;
+ }
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ Offset = DDRDATA0CH0_CR_DATATRAINFEEDBACK_REG +
+ ((DDRDATA0CH1_CR_DATATRAINFEEDBACK_REG - DDRDATA0CH0_CR_DATATRAINFEEDBACK_REG) * Channel) +
+ ((DDRDATA1CH0_CR_DATATRAINFEEDBACK_REG - DDRDATA0CH0_CR_DATATRAINFEEDBACK_REG) * Byte);
+ DataTrainFeedback.Data = MrcReadCR (MrcData, Offset);
+ Pass = (DataTrainFeedback.Bits.DataTrainFeedback >= 16);
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\t%c%d", Pass ? '.' : '#', DataTrainFeedback.Data);
+ if (WLDelay == WLStart) {
+ if (Pass) {
+ InitialPassingStart[Channel][Byte] = InitialPassingEnd[Channel][Byte] = WLStart;
+ CurrentPassingStart[Channel][Byte] = CurrentPassingEnd[Channel][Byte] = WLStart;
+ LargestPassingStart[Channel][Byte] = LargestPassingEnd[Channel][Byte] = WLStart;
+ } else {
+ InitialPassingStart[Channel][Byte] = InitialPassingEnd[Channel][Byte] = -WLStep;
+ CurrentPassingStart[Channel][Byte] = CurrentPassingEnd[Channel][Byte] = -WLStep;
+ LargestPassingStart[Channel][Byte] = LargestPassingEnd[Channel][Byte] = -WLStep;
+ }
+ } else {
+ if (Pass) {
+ if (InitialPassingEnd[Channel][Byte] == (WLDelay - WLStep)) {
+ InitialPassingEnd[Channel][Byte] = WLDelay;
+ }
+
+ if (CurrentPassingEnd[Channel][Byte] == (WLDelay - WLStep)) {
+ CurrentPassingEnd[Channel][Byte] = WLDelay;
+ } else {
+ CurrentPassingStart[Channel][Byte] = CurrentPassingEnd[Channel][Byte] = WLDelay;
+ }
+ //
+ // Special case for last step: Append Initial Passing Region
+ // WLDelay should be considered a continuous range that wraps around 0
+ //
+ if ((WLDelay >= (WLStop - WLStep)) && (InitialPassingStart[Channel][Byte] == WLStart)) {
+ iWidth = (InitialPassingEnd[Channel][Byte] - InitialPassingStart[Channel][Byte]);
+ CurrentPassingEnd[Channel][Byte] += (WLStep + iWidth);
+ }
+ //
+ // Update Largest variables
+ //
+ cWidth = CurrentPassingEnd[Channel][Byte] - CurrentPassingStart[Channel][Byte];
+ lWidth = LargestPassingEnd[Channel][Byte] - LargestPassingStart[Channel][Byte];
+ if (cWidth > lWidth) {
+ LargestPassingStart[Channel][Byte] = CurrentPassingStart[Channel][Byte];
+ LargestPassingEnd[Channel][Byte] = CurrentPassingEnd[Channel][Byte];
+ }
+ }
+ }
+ } // for Byte
+ } // for Channel
+ } // for WLDelay
+
+#ifdef MRC_DEBUG_PRINT
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\n\tInitPassSt\tInitPassEn\tCurrPassSt\tCurrPassEn\tLargPassSt\tLargPassEn\n");
+
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcRankInChannelExist (MrcData, Rank, Channel)) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "C%d\n", Channel);
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ " B%d:\t\t%d\t\t%d\t\t%d\t\t%d\t\t%d\t\t%d\n",
+ Byte,
+ InitialPassingStart[Channel][Byte],
+ InitialPassingEnd[Channel][Byte],
+ CurrentPassingStart[Channel][Byte],
+ CurrentPassingEnd[Channel][Byte],
+ LargestPassingStart[Channel][Byte],
+ LargestPassingEnd[Channel][Byte]
+ );
+ }
+ }
+ }
+#endif // MRC_DEBUG_PRINT
+
+ //
+ // Clean up after step
+ // Very coarsely adjust for any cycle errors
+ // Program values for TxDQS
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcRankInChannelExist (MrcData, Rank, Channel)) {
+
+ ChannelOut = &ControllerOut->Channel[Channel];
+
+ //
+ // Check if rank is a x16
+ //
+ RankIsx16 = (ChannelOut->Dimm[RankHalf].SdramWidth == 16 ? TRUE : FALSE);
+
+ //
+ // Clear ODT before MRS (JEDEC Spec)
+ //
+ Offset = MCHBAR_CH0_CR_REUT_CH_MISC_ODT_CTRL_REG +
+ ((MCHBAR_CH1_CR_REUT_CH_MISC_ODT_CTRL_REG - MCHBAR_CH0_CR_REUT_CH_MISC_ODT_CTRL_REG) * Channel);
+ MrcWriteCR (MrcData, Offset, 0);
+
+#ifdef ULT_FLAG
+ //
+ // Restore MR2 values
+ //
+ if (Lpddr) {
+ CRValue = (ChannelOut->Dimm[RankHalf].Rank[RankMod2].MR[mrMR2]);
+ Status = MrcIssueMrw (MrcData, Channel, Rank, mrMR2, CRValue, FALSE, FALSE);
+ } else
+#endif // ULT_FLAG
+ {
+ //
+ // Restore Write Leveling mode and Rtt_Nom for this rank
+ //
+ CRValue = (ChannelOut->Dimm[RankHalf].Rank[RankMod2].MR[mrMR1]);
+ Status = MrcWriteMRS (MrcData, Channel, RankMask, mrMR1, (U16) CRValue);
+ }
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "C%d.R%d: LftEdge Width\n", Channel, Rank);
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ ByteWidth = LargestPassingEnd[Channel][Byte] - LargestPassingStart[Channel][Byte];
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_NOTE,
+ " B%d: %d\t%d\n",
+ Byte,
+ LargestPassingStart[Channel][Byte],
+ ByteWidth
+ );
+
+ //
+ // Check if width is valid
+ //
+ if ((ByteWidth <= 32) || (ByteWidth >= 96)) {
+ MRC_DEBUG_MSG (
+ Debug,
+ MSG_LEVEL_ERROR,
+ "\nERROR! Width region outside expected limits for Channel: %u Rank %u Byte: %u\n",
+ Channel,
+ Rank,
+ Byte
+ );
+ return mrcWriteLevelingError;
+ }
+ //
+ // Align byte pairs if DIMM is x16
+ //
+ if (RankIsx16 && (Byte & MRC_BIT0)) {
+ //
+ // If odd byte number (1, 3, 5 or 7)
+ //
+ refbyte = Byte - 1;
+ if (LargestPassingStart[Channel][Byte] > (LargestPassingStart[Channel][refbyte] + 64)) {
+ LargestPassingStart[Channel][Byte] -= 128;
+ }
+
+ if (LargestPassingStart[Channel][Byte] < (LargestPassingStart[Channel][refbyte] - 64)) {
+ LargestPassingStart[Channel][Byte] += 128;
+ }
+ }
+
+#ifdef ULT_FLAG
+ if (Inputs->CpuModel == cmHSW_ULT) {
+ //
+ // Fix for b4618067 - need to add 1 QCLK to DqsPi
+ //
+ LargestPassingStart[Channel][Byte] += 64;
+ }
+#endif // ULT_FLAG
+
+ ChannelOut->TxDqs[Rank][Byte] = (U16) LargestPassingStart[Channel][Byte];
+ ChannelOut->TxDq[Rank][Byte] = (U16) (LargestPassingStart[Channel][Byte] + 32);
+ UpdateTxT (MrcData, Channel, Rank, Byte, 0xFF, 0);
+ }
+ }
+ }
+ }
+ //
+ // Clean up after Test
+ //
+ for (Channel = 0; Channel < MAX_CHANNEL; Channel++) {
+ if (MrcChannelExist (Outputs, Channel)) {
+
+ ChannelOut = &ControllerOut->Channel[Channel];
+
+ Offset = DDRDATACH0_CR_DDRCRDATACONTROL0_REG +
+ ((DDRDATACH1_CR_DDRCRDATACONTROL0_REG - DDRDATACH0_CR_DDRCRDATACONTROL0_REG) * Channel);
+ MrcWriteCrMulticast (MrcData, Offset, ChannelOut->DqControl0.Data);
+
+ //
+ // Restore DqControl2 values.
+ //
+ for (Byte = 0; Byte < Outputs->SdramCount; Byte++) {
+ Offset = DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG +
+ ((DDRDATA0CH1_CR_DDRCRDATACONTROL2_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG) * Channel) +
+ ((DDRDATA1CH0_CR_DDRCRDATACONTROL2_REG - DDRDATA0CH0_CR_DDRCRDATACONTROL2_REG) * Byte);
+ MrcWriteCR (MrcData, Offset, ChannelOut->DqControl2[Byte].Data);
+ }
+ }
+ }
+
+#ifdef ULT_FLAG
+ if (!Lpddr)
+#endif // ULT_FLAG
+ {
+ //
+ // DLLEnable=0, Dic=0, Al=0, Level=0, Tdqs=0, Qoff=0
+ //
+ Status = MrcSetMR1 (MrcData, 0, DIMMRON, 0, 0, 0, 0);
+ if (Status != mrcSuccess) {
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_ERROR, "ERROR: RESET FAIL - WLT\n");
+ return Status;
+ }
+ }
+
+ // Restore flag
+ Outputs->RestoreMRs = SavedRestoreMRS;
+
+ MRC_DEBUG_MSG (Debug, MSG_LEVEL_NOTE, "\nJedec Write Leveling CLEANUP\n");
+ Status = MrcJedecWriteLevelingCleanUp (MrcData);
+
+ return Status;
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/WriteTraining/MrcWriteLeveling.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/WriteTraining/MrcWriteLeveling.h
new file mode 100644
index 0000000..bbb6ceb
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/WriteTraining/MrcWriteLeveling.h
@@ -0,0 +1,85 @@
+/** @file
+ The write leveling training algorithm definitions.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+**/
+
+#ifndef _MrcWriteLeveling_h_
+#define _MrcWriteLeveling_h_
+
+#include "MrcTypes.h"
+#include "MrcApi.h"
+#include "McAddress.h"
+#include "MrcCommon.h"
+#include "MrcReset.h"
+#include "MrcDdr3.h"
+#include "MrcIoControl.h"
+#include "MrcReadReceiveEnable.h"
+#include "MrcOem.h"
+
+///
+/// This defines the maximum ADD delay that can be programmed to the register. It may change in the future
+///
+#define MAX_ADD_DELAY (2)
+
+/**
+@brief
+ this function execute the Jedec write leveling Cleanup.
+ Center TxDQS-CLK timing
+
+ @param[in, out] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - if it succeded return mrcSuccess
+**/
+extern
+MrcStatus
+MrcJedecWriteLevelingCleanUp (
+ IN OUT MrcParameters *const MrcData
+ );
+
+/**
+@brief
+ this function execute the functional write leveling training.
+ Center TxDQS-CLK timing
+
+ @param[in, out] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - if it succeded return mrcSuccess
+**/
+extern
+MrcStatus
+MrcWriteLevelingTraining (
+ IN OUT MrcParameters *const MrcData
+ );
+
+/**
+@brief
+ this function execute the Jedec write leveling training.
+ Center TxDQS-CLK timing
+
+ @param[in, out] MrcData - Include all MRC global data.
+
+ @retval MrcStatus - if it succedes return mrcSuccess
+**/
+extern
+MrcStatus
+MrcJedecWriteLevelingTraining (
+ IN OUT MrcParameters *const MrcData
+ );
+
+#endif // _MrcWriteLeveling_h_
diff --git a/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/SsaCallbackPeim.h b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/SsaCallbackPeim.h
new file mode 100644
index 0000000..11bdcd6
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/SsaCallbackPeim.h
@@ -0,0 +1,56 @@
+/**
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+/**
+
+Copyright (c) 2012 - 2012 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+@file
+ SsaCallbackPeim.h
+
+@brief
+ Header file for the SSA BIOS Callback Init PEIM
+**/
+#ifndef _SSA_CALLBACK_PEIM_H_
+#define _SSA_CALLBACK_PEIM_H_
+
+#include "EdkIIGluePeim.h"
+#include "MrcTypes.h"
+#include "MrcDebugHook.h"
+#include "MrcGlobal.h"
+
+struct _SSA_BIOS_CALLBACKS_PPI;
+
+extern EFI_GUID gSsaBiosCallBacksPpiGuid;
+typedef int MRC_OEM_STATUS_COMMAND;
+
+typedef
+MrcStatus
+(EFIAPI * MRC_CHECKPOINT) (
+ EFI_PEI_SERVICES **PeiServices,
+ struct _SSA_BIOS_CALLBACKS_PPI *SsaBiosCallBacksPpi,
+ MRC_OEM_STATUS_COMMAND StatusCommand,
+ VOID *CheckpointData
+ );
+
+typedef struct _SSA_BIOS_CALLBACKS_PPI {
+ UINT32 Revision;
+ MRC_CHECKPOINT MrcCheckpoint;
+ VOID *ModuleState;
+} SSA_BIOS_CALLBACKS_PPI;
+
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/PciHostBridge/Dxe/PciHostBridge.c b/ReferenceCode/Chipset/SystemAgent/PciHostBridge/Dxe/PciHostBridge.c
new file mode 100644
index 0000000..e660935
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/PciHostBridge/Dxe/PciHostBridge.c
@@ -0,0 +1,1414 @@
+/** @file
+ Provides the basic interfaces to abstract a PCI Host Bridge Resource Allocation
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "Token.h" // <<< AMI_OVERRIDE
+#include "PciHostBridge.h"
+#include "PciRootBridge.h"
+#include "PchAccess.h" // <<< AMI_OVERRIDE - EIP# 42483 - Support for Multi-Monitor >>>
+#ifndef GUID_VARIABLE_DECLARATION // AMI_OVERRIDE ... EIP#42483: MemCeiling support <<>>
+#define GUID_VARIABLE_DECLARATION(Variable, Guid) extern EFI_GUID Variable
+#endif
+#include <Protocol\NBMemInfo.h> // AMI_OVERRIDE ... EIP#42483: MemCeiling support <<>>
+///
+/// Support 64 K IO space
+/// Moving RES_IO_BASE due to new ACPI Base address 0x1800
+///
+#define RES_IO_BASE 0x2000
+#define RES_IO_LIMIT 0xFFFF
+
+///
+/// Support 4G address space
+///
+#define RES_MEM_LIMIT_1 ((UINTN) MmPciAddress (0,0,0,0,0) - 1)
+
+///
+/// Hard code: Root Bridge Number within the host bridge
+/// Root Bridge's attribute
+/// Root Bridge's device path
+/// Root Bridge's resource aperture
+///
+static UINTN RootBridgeNumber[1] = { 1 };
+///
+/// Hard code EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM 0 to support prefetchable memory allocation
+///
+#ifdef AMI_COMBINE_MEM_PMEM_FLAG
+static UINT64 RootBridgeAttribute[1][1] = { EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM };
+#else // AMI_COMBINE_MEM_PMEM_FLAG
+static UINT64 RootBridgeAttribute[1][1] = { 0 };
+#endif // AMI_COMBINE_MEM_PMEM_FLAG
+static EFI_PCI_ROOT_BRIDGE_DEVICE_PATH mEfiPciRootBridgeDevicePath[1][1] = {
+ {
+ ACPI_DEVICE_PATH,
+ ACPI_DP,
+ (UINT8) (sizeof (ACPI_HID_DEVICE_PATH)),
+ (UINT8) ((sizeof (ACPI_HID_DEVICE_PATH)) >> 8),
+ EISA_PNP_ID(0x0A03),
+ 0,
+ END_DEVICE_PATH_TYPE,
+ END_ENTIRE_DEVICE_PATH_SUBTYPE,
+ END_DEVICE_PATH_LENGTH,
+ 0
+ }
+};
+
+static PCI_ROOT_BRIDGE_RESOURCE_APERTURE mResAperture[1][1] = { { 0, ((UINT8)((PCIEX_LENGTH >> 20) - 1)), 0, 0xffffffff, 0, 1 << 16 } }; // <<< AMI_OVERRIDE
+static EFI_HANDLE mDriverImageHandle;
+CHAR16 gMemoryCeilingVariable[] = L"MemCeil."; // AMI_OVERRIDE ... EIP#42483: MemCeiling support <<>>
+EFI_GUID gEfiNbMrcS3DataGuid = EFI_NB_MRC_S3_DATA_GUID; // AMI_OVERRIDE ... EIP#42483: MemCeiling support <<>>
+
+// AMI_OVERRIDE ... Fixed GenericSio use 0x0 ~ 0xfff issue start.
+// It will Override CoreAllocateIoSpace.
+static EFI_ALLOCATE_IO_SPACE gAmiCoreAllocateIoSpace;
+
+EFI_STATUS
+NbCspOverrideCoreAllocateIoSpace (
+ IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType,
+ IN EFI_GCD_IO_TYPE GcdIoType,
+ IN UINTN Alignment,
+ IN UINT64 Length,
+ IN OUT EFI_PHYSICAL_ADDRESS *BaseAddress,
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_HANDLE DeviceHandle OPTIONAL
+ )
+{
+ EFI_STATUS Status;
+ EFI_GCD_IO_SPACE_DESCRIPTOR IoDescriptor;
+
+ if (GcdIoType == EfiGcdIoTypeIo && *BaseAddress < RES_IO_BASE)
+ {
+ if(GcdAllocateType == EfiGcdAllocateAddress)
+ {
+ Status = gDS->GetIoSpaceDescriptor(*BaseAddress, &IoDescriptor);
+ if(!EFI_ERROR(Status))
+ {
+ if(IoDescriptor.GcdIoType == EfiGcdIoTypeNonExistent)
+ {
+ Status = gDS->AddIoSpace (
+ EfiGcdIoTypeIo,
+ *BaseAddress,
+ Length
+ );
+// ASSERT_EFI_ERROR (Status);
+ }
+ }
+ }
+ }
+
+ return gAmiCoreAllocateIoSpace (
+ GcdAllocateType,
+ GcdIoType,
+ Alignment,
+ Length,
+ BaseAddress,
+ ImageHandle,
+ DeviceHandle
+ );
+}
+// AMI_OVERRIDE ... Fixed GenericSio use 0x0 ~ 0xfff issue end.
+
+//AMI_OVERRIDE START // AMI_OVERRIDE ... EIP#42483: MemCeiling support ...Start...
+EFI_STATUS
+HbCspAdjustMemoryMmioOverlap (
+ PCI_ROOT_BRIDGE_INSTANCE *RootBridgeInstance
+ )
+{
+ EFI_STATUS Status;
+ EFI_GCD_MEMORY_SPACE_DESCRIPTOR *MemorySpaceMap;
+ UINTN NumberOfDescriptors;
+ PCI_RES_NODE res;
+ UINTN i;
+ EFI_PHYSICAL_ADDRESS Highest4GMem = 0;
+ EFI_PHYSICAL_ADDRESS LowestMMIO = 0xffffffff;
+ EFI_PHYSICAL_ADDRESS LowestAllocMMIO = 0xffffffff;
+ UINTN MemoryCeiling = 0; //Init to zero incase variable doesn't exist.
+ UINTN NewMemoryCeiling = 0xffffffff;
+ UINTN DataSize = sizeof(UINT32);
+ EFI_PHYSICAL_ADDRESS NeededBottomMmio;
+ UINT32 Attributes = 0; // [ EIP167027 ]
+
+//------------------------------------
+ //Status = gRT->GetVariable ( // [ EIP167027 ]
+ // gMemoryCeilingVariable,
+ // &gEfiNbMrcS3DataGuid,
+ // NULL,
+ // &DataSize,
+ // &MemoryCeiling );
+ Status = gRT->GetVariable (
+ gMemoryCeilingVariable,
+ &gEfiNbMrcS3DataGuid,
+ &Attributes,
+ &DataSize,
+ &MemoryCeiling );
+
+ DEBUG((-1, "OEM trace - GetVariable MemCeil Status = %r\n", Status));
+
+ if (EFI_ERROR(Status))
+ Attributes = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS;
+
+ if (Status == EFI_NOT_FOUND) {
+ //Status = gRT->GetVariable ( // [ EIP167027 ]
+ // gMemoryCeilingVariable,
+ // &gEfiGlobalVariableGuid,
+ // NULL,
+ // &DataSize,
+ // &MemoryCeiling
+ // );
+ Status = gRT->GetVariable (
+ gMemoryCeilingVariable,
+ &gEfiGlobalVariableGuid,
+ &Attributes,
+ &DataSize,
+ &MemoryCeiling
+ );
+
+ if (!EFI_ERROR(Status)) {
+ //gRT->SetVariable ( // [ EIP167027 ]
+ // gMemoryCeilingVariable,
+ // &gEfiNbMrcS3DataGuid,
+ // EFI_VARIABLE_NON_VOLATILE
+ // + EFI_VARIABLE_BOOTSERVICE_ACCESS
+ // + EFI_VARIABLE_RUNTIME_ACCESS,
+ // DataSize,
+ // &MemoryCeiling
+ //);
+ gRT->SetVariable (
+ gMemoryCeilingVariable,
+ &gEfiNbMrcS3DataGuid,
+ Attributes,
+ DataSize,
+ &MemoryCeiling
+ );
+ }
+ else
+ Attributes = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS;
+ }
+
+ //Memory sizing uses memory ceiling to set top of memory.
+
+ Status = gDS->GetMemorySpaceMap(&NumberOfDescriptors, &MemorySpaceMap);
+ ASSERT_EFI_ERROR(Status);
+
+ //Find the lowest MMIO and lowest allocated MMIO in GCD.
+ for(i = 0; i < NumberOfDescriptors; ++i) {
+ EFI_GCD_MEMORY_SPACE_DESCRIPTOR *Descr = &MemorySpaceMap[i];
+ EFI_PHYSICAL_ADDRESS Base = Descr->BaseAddress;
+ //Find highest system below 4GB memory.
+ //Treat any non MMIO as system memory. Not all system memory is reported as system memory,
+ //such as SMM.
+ if (Descr->GcdMemoryType != EfiGcdMemoryTypeMemoryMappedIo && Base < LowestMMIO) {
+ EFI_PHYSICAL_ADDRESS EndMem = Base + Descr->Length - 1;
+ if (EndMem > Highest4GMem && EndMem <= 0xffffffff) Highest4GMem = EndMem;
+
+ //Find Lowest mmio above system memory.
+ } else if (Descr->GcdMemoryType == EfiGcdMemoryTypeMemoryMappedIo) {
+ if (Base >= 0x100000) {
+ if (Base < LowestMMIO) LowestMMIO = Base;
+ //If ImageHandle, then MMIO is allocated.
+ if (Base < LowestAllocMMIO && Descr->ImageHandle) LowestAllocMMIO = Base;
+ }
+ }
+ }
+
+ (gBS->FreePool)(MemorySpaceMap);
+
+ if (Highest4GMem + 1 != LowestMMIO) {
+ DEBUG((-1, "PciHostCSHooks: System Memory and MMIO are not consequitive.\n Top of Below 4G Memory: %lX\n Bottom of MMIO: %x%x\n",
+ Highest4GMem, LowestMMIO ));
+ }
+
+ //Find any MMIO that could not be allocated due to small of MMIO region.
+ NeededBottomMmio = LowestAllocMMIO;
+ for(i = 0; i < TypeMax; ++i) {
+
+ res=RootBridgeInstance->ResAllocNode[i];
+ if ((res.Type == TypeMem32 && (res.Status != ResNone) && (res.Status != ResAllocated)) ||
+ (res.Type == TypePMem32 && (res.Status != ResNone) && (res.Status != ResAllocated))) {
+ //Determine new memory ceiling variable needed to allocate this memory.
+ NeededBottomMmio = NeededBottomMmio - res.Length;
+ NeededBottomMmio &= ~(res.Alignment);
+ if (NeededBottomMmio < NewMemoryCeiling) NewMemoryCeiling = (UINTN) NeededBottomMmio;
+ }
+ }
+
+ if (NewMemoryCeiling < 0xffffffff) { //Check if a NewMemory Ceiling is needed.
+
+ // Adjust the granularity
+ NewMemoryCeiling &= (~(TOP_LOW_MEM_GRANULARITY - 1));
+
+ if (MemoryCeiling == NewMemoryCeiling) return EFI_SUCCESS; //No change in system configuration. Nothing more to do. Just exit.
+
+ // Change in system config, so MMIO requirement changed. Update MemCeil and do reset.
+ // Set memory ceiling variable.
+ //gRT->SetVariable( // [ EIP167027 ]
+ // gMemoryCeilingVariable,
+ // &gEfiNbMrcS3DataGuid,
+ // EFI_VARIABLE_NON_VOLATILE
+ // + EFI_VARIABLE_BOOTSERVICE_ACCESS
+ // + EFI_VARIABLE_RUNTIME_ACCESS,
+ // DataSize,
+ // &NewMemoryCeiling
+ //);
+ gRT->SetVariable(
+ gMemoryCeilingVariable,
+ &gEfiNbMrcS3DataGuid,
+ Attributes,
+ DataSize,
+ &NewMemoryCeiling
+ );
+
+ DEBUG((-1, "Adjusting maximum top of RAM.\n Resetting System.\n"));
+
+#if (NV_SIMULATION != 1)
+ //Reset only needed of type of physical memory overlaps with MMIO.
+ gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
+#endif
+
+ }
+
+ return Status;
+}
+//AMI_OVERRIDE ... // AMI_OVERRIDE ... EIP#42483: MemCeiling support ...END...
+
+EFI_DRIVER_ENTRY_POINT (PciHostBridgeEntryPoint)
+///
+/// Implementation
+///
+/**
+ Entry point of this driver
+
+ @param[in] ImageHandle -
+ @param[in] SystemTable -
+
+ @retval EFI_SUCCESS - Driver Start OK
+ @retval EFI_DEVICE_ERROR - Fail to install PCI_ROOT_BRIDGE_IO protocol.
+**/
+EFI_STATUS
+EFIAPI
+PciHostBridgeEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ UINTN Loop1;
+ UINTN Loop2;
+ PCI_HOST_BRIDGE_INSTANCE *HostBridge;
+ PCI_ROOT_BRIDGE_INSTANCE *PrivateData;
+ EFI_PHYSICAL_ADDRESS PciBaseAddress;
+ EFI_PHYSICAL_ADDRESS RemapBase;
+ EFI_PHYSICAL_ADDRESS RemapLimit;
+ EFI_PHYSICAL_ADDRESS MeSegMask;
+ EFI_PHYSICAL_ADDRESS MeStolenSize;
+ BOOLEAN MeStolenEnable;
+ UINT32 Tolud;
+ UINT64 Length;
+ EFI_PHYSICAL_ADDRESS BaseAddress;
+ CPU_FAMILY CpuFamilyId;
+ CPU_STEPPING CpuSteppingId;
+#ifndef AMI_OVERRIDE_FOR_REMAP_DISABLED
+ EFI_PHYSICAL_ADDRESS MeStolenBase;
+#endif // AMI_OVERRIDE_FOR_REMAP_DISABLED
+
+ INITIALIZE_SCRIPT (ImageHandle, SystemTable);
+
+ mDriverImageHandle = ImageHandle;
+
+ ///
+ /// This system has one Host Bridge (one Root Bridge in this Host Bridge)
+ ///
+ ///
+ /// Create Host Bridge Device Handle
+ ///
+ for (Loop1 = 0; Loop1 < HOST_BRIDGE_NUMBER; Loop1++) {
+ Status = (gBS->AllocatePool) (EfiBootServicesData, sizeof (PCI_HOST_BRIDGE_INSTANCE), (VOID **) &HostBridge);
+ ASSERT (!EFI_ERROR (Status));
+
+ HostBridge->Signature = PCI_HOST_BRIDGE_SIGNATURE;
+ HostBridge->RootBridgeNumber = RootBridgeNumber[Loop1];
+ HostBridge->ResourceSubmited = FALSE;
+ HostBridge->CanRestarted = TRUE;
+
+ ///
+ /// InitializeListHead (&HostBridge->Head);
+ ///
+ HostBridge->ResAlloc.NotifyPhase = NotifyPhase;
+ HostBridge->ResAlloc.GetNextRootBridge = GetNextRootBridge;
+ HostBridge->ResAlloc.GetAllocAttributes = GetAttributes;
+ HostBridge->ResAlloc.StartBusEnumeration = StartBusEnumeration;
+ HostBridge->ResAlloc.SetBusNumbers = SetBusNumbers;
+ HostBridge->ResAlloc.SubmitResources = SubmitResources;
+ HostBridge->ResAlloc.GetProposedResources = GetProposedResources;
+ HostBridge->ResAlloc.PreprocessController = PreprocessController;
+ HostBridge->HostBridgeHandle = NULL;
+ Status = gBS->InstallProtocolInterface (
+ &HostBridge->HostBridgeHandle,
+ &gEfiPciHostBridgeResourceAllocationProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ &HostBridge->ResAlloc
+ );
+ if (EFI_ERROR (Status)) {
+ (gBS->FreePool) (HostBridge);
+ return EFI_DEVICE_ERROR;
+ }
+ ///
+ /// Create Root Bridge Device Handle in this Host Bridge
+ ///
+ InitializeListHead (&HostBridge->Head);
+ for (Loop2 = 0; Loop2 < HostBridge->RootBridgeNumber; Loop2++) {
+ Status = (gBS->AllocatePool) (EfiBootServicesData, sizeof (PCI_ROOT_BRIDGE_INSTANCE), (VOID **) &PrivateData);
+ ASSERT (!EFI_ERROR (Status));
+
+ PrivateData->Signature = PCI_ROOT_BRIDGE_SIGNATURE;
+ PrivateData->DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) &mEfiPciRootBridgeDevicePath[Loop1][Loop2];
+ RootBridgeConstructor (
+ &PrivateData->Io,
+ HostBridge->HostBridgeHandle,
+ RootBridgeAttribute[Loop1][Loop2],
+ &mResAperture[Loop1][Loop2]
+ );
+ PrivateData->Handle = NULL;
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &PrivateData->Handle,
+ &gEfiDevicePathProtocolGuid,
+ PrivateData->DevicePath,
+ &gEfiPciRootBridgeIoProtocolGuid,
+ &PrivateData->Io,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ (gBS->FreePool) (PrivateData);
+ return EFI_DEVICE_ERROR;
+ }
+
+ InsertTailList (&HostBridge->Head, &PrivateData->Link);
+ }
+ }
+ ///
+ /// Allocate 60 KB of I/O space [0x1000..0xFFFF]
+ ///
+ Status = gDS->AddIoSpace (
+ EfiGcdIoTypeIo,
+ RES_IO_BASE,
+ RES_IO_LIMIT - RES_IO_BASE + 1
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ // AMI_OVERRIDE ... Fixed GenericSio use 0x0 ~ 0xfff issue start.
+ // It will Override CoreAllocateIoSpace.
+ gAmiCoreAllocateIoSpace = gDS->AllocateIoSpace;
+ gDS->AllocateIoSpace = NbCspOverrideCoreAllocateIoSpace;
+ // AMI_OVERRIDE ... Fixed GenericSio use 0x0 ~ 0xfff issue end.
+
+ ///
+ /// Allocate PCI memory space.
+ ///
+ ///
+ /// Read memory map registers
+ ///
+ RemapBase = McD0PciCfg64 (R_SA_REMAPBASE) & B_SA_REMAPBASE_REMAPBASE_MASK;
+ RemapLimit = McD0PciCfg64 (R_SA_REMAPLIMIT) & B_SA_REMAPLIMIT_REMAPLMT_MASK;
+ Tolud = McD0PciCfg32 (R_SA_TOLUD) & B_SA_TOLUD_TOLUD_MASK;
+ PciBaseAddress = Tolud;
+ MeSegMask = McD0PciCfg64 (R_SA_MESEG_MASK);
+ MeStolenEnable = (BOOLEAN) ((MeSegMask & B_SA_MESEG_MASK_ME_STLEN_EN_MASK) != 0);
+
+ ///
+ /// First check if memory remap is used
+ ///
+ if ((RemapBase > RemapLimit) && (MeStolenEnable)) {
+ MeStolenSize = MeSegMask & B_SA_MESEG_MASK_MEMASK_MASK;
+ if (MeStolenSize != 0) {
+ MeStolenSize = 0x8000000000L - MeStolenSize;
+#ifndef AMI_OVERRIDE_FOR_REMAP_DISABLED
+ // Remap is disabled -> if Me Stolen Base on PCI resume, PCI resume - MeStolenSize.
+ MeStolenBase = McD0PciCfg64 (R_SA_MESEG_BASE);
+ if(MeStolenBase < RES_MEM_LIMIT_1) {
+ //
+ // Remap is disabled -> PCI starts at TOLUD + ME Stolen size
+ //
+ PciBaseAddress += MeStolenSize;
+ }
+#endif // AMI_OVERRIDE_FOR_REMAP_DISABLED
+ }
+ ///
+ /// Remap is disabled -> PCI starts at TOLUD + ME Stolen size
+ ///
+#ifdef AMI_OVERRIDE_FOR_REMAP_DISABLED
+ PciBaseAddress += MeStolenSize;
+#endif // AMI_OVERRIDE_FOR_REMAP_DISABLED
+ }
+
+ Length = RES_MEM_LIMIT_1 - PciBaseAddress + 1;
+
+ if (Length != 0) {
+ DEBUG (
+ (
+ EFI_D_INFO, " Allocating PCI space from 0x%X to 0x%X\n", (UINT32) PciBaseAddress, (UINT32)
+ (PciBaseAddress + Length - 1)
+ )
+ );
+ Status = gDS->AddMemorySpace (
+ EfiGcdMemoryTypeMemoryMappedIo,
+ PciBaseAddress,
+ Length,
+ 0
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
+ ///
+ /// Get CPU Family and Stepping ID
+ ///
+ CpuFamilyId = GetCpuFamily();
+ CpuSteppingId = GetCpuStepping();
+
+ ///
+ /// WA for HSW A0. To exclude the ranges 20000000-201FFFFF (2MB) and 0x40004000-0x40004FFF (4KB).
+ ///
+ if ((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId == EnumHswA0)) {
+ if (McD0PciCfg32 (R_SA_DEVEN) & B_SA_DEVEN_D2EN_MASK) {
+ BaseAddress = 0x20000000;
+ Status = (gBS->AllocatePages) (AllocateAddress, EfiReservedMemoryType, EFI_SIZE_TO_PAGES (0x00200000), &BaseAddress);
+
+ BaseAddress = 0x40004000;
+ Status = (gBS->AllocatePages) (AllocateAddress, EfiReservedMemoryType, EFI_SIZE_TO_PAGES (0x00001000), &BaseAddress);
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Enter a certain phase of the PCI enumeration process
+
+ @param[in] This - The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL instance
+ @param[in] Phase - The phase during enumeration
+
+ @retval EFI_SUCCESS - Succeed.
+ @retval EFI_INVALID_PARAMETER - Wrong phase parameter passed in.
+ @retval EFI_NOT_READY - Resources have not been submitted yet.
+**/
+EFI_STATUS
+EFIAPI
+NotifyPhase (
+ IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
+ IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PHASE Phase
+ )
+{
+ PCI_HOST_BRIDGE_INSTANCE *HostBridgeInstance;
+ PCI_ROOT_BRIDGE_INSTANCE *RootBridgeInstance;
+ PCI_RESOURCE_TYPE Index;
+ LIST_ENTRY *List;
+ EFI_PHYSICAL_ADDRESS BaseAddress;
+ UINT64 AddrLen;
+ UINTN BitsOfAlignment;
+ UINT64 Alignment;
+ EFI_STATUS Status;
+ EFI_STATUS ReturnStatus;
+
+ HostBridgeInstance = INSTANCE_FROM_RESOURCE_ALLOCATION_THIS (This);
+ switch (Phase) {
+ case EfiPciHostBridgeBeginEnumeration:
+ if (HostBridgeInstance->CanRestarted) {
+ ///
+ /// Reset the Each Root Bridge
+ ///
+ List = HostBridgeInstance->Head.ForwardLink;
+ while (List != &HostBridgeInstance->Head) {
+ RootBridgeInstance = DRIVER_INSTANCE_FROM_LIST_ENTRY (List);
+ for (Index = TypeIo; Index < TypeMax; Index++) {
+ RootBridgeInstance->ResAllocNode[Index].Type = Index;
+ RootBridgeInstance->ResAllocNode[Index].Base = 0;
+ RootBridgeInstance->ResAllocNode[Index].Length = 0;
+ RootBridgeInstance->ResAllocNode[Index].Status = ResNone;
+ }
+
+ List = List->ForwardLink;
+ }
+
+ HostBridgeInstance->ResourceSubmited = FALSE;
+ HostBridgeInstance->CanRestarted = TRUE;
+ } else {
+ ///
+ /// Can not restart
+ ///
+ return EFI_NOT_READY;
+ }
+ break;
+
+ case EfiPciHostBridgeBeginBusAllocation:
+ ///
+ /// No specific action is required here, can perform any chipset specific programing
+ ///
+ HostBridgeInstance->CanRestarted = FALSE;
+ return EFI_SUCCESS;
+ break;
+
+ case EfiPciHostBridgeEndBusAllocation:
+ ///
+ /// No specific action is required here, can perform any chipset specific programing
+ ///
+ return EFI_SUCCESS;
+ break;
+
+ case EfiPciHostBridgeBeginResourceAllocation:
+ ///
+ /// No specific action is required here, can perform any chipset specific programing
+ ///
+ return EFI_SUCCESS;
+ break;
+
+ case EfiPciHostBridgeAllocateResources:
+ ReturnStatus = EFI_SUCCESS;
+ if (HostBridgeInstance->ResourceSubmited) {
+ ///
+ /// Take care of the resource dependencies between the root bridges
+ ///
+ List = HostBridgeInstance->Head.ForwardLink;
+ while (List != &HostBridgeInstance->Head) {
+ RootBridgeInstance = DRIVER_INSTANCE_FROM_LIST_ENTRY (List);
+
+ Status = HbCspAdjustMemoryMmioOverlap(RootBridgeInstance); // <<< AMI_OVERRIDE - EIP# 42483 - Support for Multi-Monitor >>>
+
+ for (Index = TypeIo; Index < TypeBus; Index++) {
+ if (RootBridgeInstance->ResAllocNode[Index].Status != ResNone) {
+ AddrLen = RootBridgeInstance->ResAllocNode[Index].Length;
+ Alignment = RootBridgeInstance->ResAllocNode[Index].Alignment;
+
+ ///
+ /// Get the number of '1' in Alignment.
+ ///
+ for (BitsOfAlignment = 0; Alignment != 0; BitsOfAlignment++) {
+ Alignment = RShiftU64 (Alignment, 1);
+ }
+
+ switch (Index) {
+ case TypeIo:
+ ///
+ /// It is impossible for this chipset to align 0xFFFF for IO16
+ /// So clear it
+ ///
+ if (BitsOfAlignment >= 16) {
+ BitsOfAlignment = 0;
+ }
+
+#ifndef AMI_ORIGINAL_FOR_MMIO_4G_TOLUD
+ // Support MaxAddressSearchTopDown for Gcd Io
+ BaseAddress = 0xFFFF;
+#endif // AMI_ORIGINAL_FOR_MMIO_4G_TOLUD
+
+ Status = gDS->AllocateIoSpace (
+#ifdef AMI_ORIGINAL_FOR_MMIO_4G_TOLUD
+ EfiGcdAllocateAnySearchBottomUp,
+#else // AMI_ORIGINAL_FOR_MMIO_4G_TOLUD
+ EfiGcdAllocateMaxAddressSearchTopDown,
+#endif // AMI_ORIGINAL_FOR_MMIO_4G_TOLUD
+ EfiGcdIoTypeIo,
+ BitsOfAlignment,
+ AddrLen,
+ &BaseAddress,
+ mDriverImageHandle,
+ NULL
+ );
+ if (!EFI_ERROR (Status)) {
+ RootBridgeInstance->ResAllocNode[Index].Base = (UINTN) BaseAddress;
+ RootBridgeInstance->ResAllocNode[Index].Status = ResAllocated;
+ } else {
+ ///
+ /// Not able to allocate enough I/O memory - critical stop
+ ///
+ DEBUG ((EFI_D_ERROR, "Out of I/O space! AllocateIoSpace() returned %r\n", Status));
+ DEBUG ((EFI_D_ERROR, "Size requested: 0x%lX bytes\n", AddrLen));
+ ReturnStatus = Status;
+ }
+ break;
+
+ case TypeMem32:
+ case TypePMem32:
+ ///
+ /// It is impossible for this chipset to align 0xFFFFFFFF for Mem32
+ /// So clear it
+ ///
+ if (BitsOfAlignment >= 32) {
+ BitsOfAlignment = 0;
+ }
+
+#ifndef AMI_ORIGINAL_FOR_MMIO_4G_TOLUD
+ // Support MMIO 4G to Tolud for EfiGcdAllocateMaxAddressSearchTopDown
+ BaseAddress = 0xFFFFFFFF;
+#endif // AMI_ORIGINAL_FOR_MMIO_4G_TOLUD
+ ///
+ /// Fall through to TypeMem64 / TypePMem64...
+ ///
+ case TypeMem64:
+ case TypePMem64:
+ Status = gDS->AllocateMemorySpace (
+#ifdef AMI_ORIGINAL_FOR_MMIO_4G_TOLUD
+ EfiGcdAllocateAnySearchBottomUp,
+#else // AMI_ORIGINAL_FOR_MMIO_4G_TOLUD
+ EfiGcdAllocateMaxAddressSearchTopDown,
+#endif // AMI_ORIGINAL_FOR_MMIO_4G_TOLUD
+ EfiGcdMemoryTypeMemoryMappedIo,
+ BitsOfAlignment,
+ AddrLen,
+ &BaseAddress,
+ mDriverImageHandle,
+ NULL
+ );
+ if (!EFI_ERROR (Status)) {
+ ///
+ /// We were able to allocate the PCI memory
+ ///
+ RootBridgeInstance->ResAllocNode[Index].Base = (UINTN) BaseAddress;
+ RootBridgeInstance->ResAllocNode[Index].Status = ResAllocated;
+ } else {
+ ///
+ /// Not able to allocate enough PCI memory - critical stop
+ ///
+ DEBUG ((EFI_D_ERROR, "Out of PCI memory! AllocateMemorySpace() returned %r\n", Status));
+ DEBUG ((EFI_D_ERROR, "Size requested: 0x%lX bytes\n", AddrLen));
+ ReturnStatus = Status;
+ }
+ break;
+ default:
+ break;
+ }
+ ///
+ /// end switch
+ ///
+ }
+ }
+
+ List = List->ForwardLink;
+ }
+
+ return ReturnStatus;
+ } else {
+ return EFI_NOT_READY;
+ }
+ break;
+
+ case EfiPciHostBridgeSetResources:
+ break;
+
+ case EfiPciHostBridgeFreeResources:
+ ReturnStatus = EFI_SUCCESS;
+
+ List = HostBridgeInstance->Head.ForwardLink;
+ while (List != &HostBridgeInstance->Head) {
+ RootBridgeInstance = DRIVER_INSTANCE_FROM_LIST_ENTRY (List);
+ for (Index = TypeIo; Index < TypeBus; Index++) {
+ if (RootBridgeInstance->ResAllocNode[Index].Status == ResAllocated) {
+ AddrLen = RootBridgeInstance->ResAllocNode[Index].Length;
+ BaseAddress = RootBridgeInstance->ResAllocNode[Index].Base;
+ switch (Index) {
+ case TypeIo:
+ Status = gDS->FreeIoSpace (BaseAddress, AddrLen);
+ break;
+
+ case TypeMem32:
+ case TypePMem32:
+ case TypeMem64:
+ case TypePMem64:
+ Status = gDS->FreeMemorySpace (BaseAddress, AddrLen);
+ break;
+
+ default:
+ Status = EFI_INVALID_PARAMETER;
+
+ }
+
+ if (EFI_ERROR (Status)) {
+ ReturnStatus = Status;
+ }
+ ///
+ /// end switch
+ ///
+ RootBridgeInstance->ResAllocNode[Index].Type = Index;
+ RootBridgeInstance->ResAllocNode[Index].Base = 0;
+ RootBridgeInstance->ResAllocNode[Index].Length = 0;
+ RootBridgeInstance->ResAllocNode[Index].Status = ResNone;
+ }
+ }
+
+ List = List->ForwardLink;
+ }
+
+ HostBridgeInstance->ResourceSubmited = FALSE;
+ HostBridgeInstance->CanRestarted = TRUE;
+ return ReturnStatus;
+ break;
+
+ case EfiPciHostBridgeEndResourceAllocation:
+ HostBridgeInstance->CanRestarted = FALSE;
+ break;
+
+ default:
+ return EFI_INVALID_PARAMETER;
+ }
+ ///
+ /// end switch
+ ///
+ return EFI_SUCCESS;
+}
+
+/**
+ Return the device handle of the next PCI root bridge that is associated with
+ this Host Bridge
+
+ @param[in] This - The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_ PROTOCOL instance
+ @param[in] RootBridgeHandle - Returns the device handle of the next PCI Root Bridge.
+ On input, it holds the RootBridgeHandle returned by the most
+ recent call to GetNextRootBridge().The handle for the first
+ PCI Root Bridge is returned if RootBridgeHandle is NULL on input
+
+ @retval EFI_SUCCESS - Succeed.
+ @retval EFI_NOT_FOUND - Next PCI root bridge not found.
+ @retval EFI_INVALID_PARAMETER - Wrong parameter passed in.
+**/
+EFI_STATUS
+EFIAPI
+GetNextRootBridge (
+ IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
+ IN OUT EFI_HANDLE *RootBridgeHandle
+ )
+{
+ BOOLEAN NoRootBridge;
+ LIST_ENTRY *List;
+ PCI_HOST_BRIDGE_INSTANCE *HostBridgeInstance;
+ PCI_ROOT_BRIDGE_INSTANCE *RootBridgeInstance;
+
+ NoRootBridge = TRUE;
+ HostBridgeInstance = INSTANCE_FROM_RESOURCE_ALLOCATION_THIS (This);
+ List = HostBridgeInstance->Head.ForwardLink;
+
+ while (List != &HostBridgeInstance->Head) {
+ NoRootBridge = FALSE;
+ RootBridgeInstance = DRIVER_INSTANCE_FROM_LIST_ENTRY (List);
+ if (*RootBridgeHandle == NULL) {
+ ///
+ /// Return the first Root Bridge Handle of the Host Bridge
+ ///
+ *RootBridgeHandle = RootBridgeInstance->Handle;
+ return EFI_SUCCESS;
+ } else {
+ if (*RootBridgeHandle == RootBridgeInstance->Handle) {
+ ///
+ /// Get next if have
+ ///
+ List = List->ForwardLink;
+ if (List != &HostBridgeInstance->Head) {
+ RootBridgeInstance = DRIVER_INSTANCE_FROM_LIST_ENTRY (List);
+ *RootBridgeHandle = RootBridgeInstance->Handle;
+ return EFI_SUCCESS;
+ } else {
+ return EFI_NOT_FOUND;
+ }
+ }
+ }
+
+ List = List->ForwardLink;
+ }
+ ///
+ /// end while
+ ///
+ if (NoRootBridge) {
+ return EFI_NOT_FOUND;
+ } else {
+ return EFI_INVALID_PARAMETER;
+ }
+}
+
+/**
+ Returns the attributes of a PCI Root Bridge.
+
+ @param[in] This - The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_ PROTOCOL instance.
+ @param[in] RootBridgeHandle - The device handle of the PCI Root Bridge
+ that the caller is interested in
+ @param[in] Attributes - The pointer to attributes of the PCI Root Bridge
+
+ @retval EFI_SUCCESS - Succeed.
+ @retval EFI_INVALID_PARAMETER - Attributes parameter passed in is NULL or
+ RootBridgeHandle is not an EFI_HANDLE
+ that was returned on a previous call to
+ GetNextRootBridge().
+**/
+EFI_STATUS
+EFIAPI
+GetAttributes (
+ IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
+ IN EFI_HANDLE RootBridgeHandle,
+ OUT UINT64 *Attributes
+ )
+{
+ LIST_ENTRY *List;
+ PCI_HOST_BRIDGE_INSTANCE *HostBridgeInstance;
+ PCI_ROOT_BRIDGE_INSTANCE *RootBridgeInstance;
+
+ if (Attributes == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ HostBridgeInstance = INSTANCE_FROM_RESOURCE_ALLOCATION_THIS (This);
+ List = HostBridgeInstance->Head.ForwardLink;
+ while (List != &HostBridgeInstance->Head) {
+ RootBridgeInstance = DRIVER_INSTANCE_FROM_LIST_ENTRY (List);
+ if (RootBridgeHandle == RootBridgeInstance->Handle) {
+ *Attributes = RootBridgeInstance->RootBridgeAttrib;
+ return EFI_SUCCESS;
+ }
+
+ List = List->ForwardLink;
+ }
+ ///
+ /// RootBridgeHandle is not an EFI_HANDLE
+ /// that was returned on a previous call to GetNextRootBridge()
+ ///
+ return EFI_INVALID_PARAMETER;
+}
+
+/**
+ This is the request from the PCI enumerator to set up
+ the specified PCI Root Bridge for bus enumeration process.
+
+ @param[in] This - The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_ PROTOCOL instance.
+ @param[in] RootBridgeHandle - The PCI Root Bridge to be set up.
+ @param[in] Configuration - Pointer to the pointer to the PCI bus resource descriptor.
+
+ @retval EFI_SUCCESS - Succeed.
+ @retval EFI_OUT_OF_RESOURCES - Not enough pool to be allocated.
+ @retval EFI_INVALID_PARAMETER - RootBridgeHandle is not a valid handle.
+**/
+EFI_STATUS
+EFIAPI
+StartBusEnumeration (
+ IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
+ IN EFI_HANDLE RootBridgeHandle,
+ OUT VOID **Configuration
+ )
+{
+ LIST_ENTRY *List;
+ PCI_HOST_BRIDGE_INSTANCE *HostBridgeInstance;
+ PCI_ROOT_BRIDGE_INSTANCE *RootBridgeInstance;
+ VOID *Buffer;
+ UINT8 *Temp;
+ EFI_STATUS Status;
+ UINT64 BusStart;
+ UINT64 BusEnd;
+
+ HostBridgeInstance = INSTANCE_FROM_RESOURCE_ALLOCATION_THIS (This);
+ List = HostBridgeInstance->Head.ForwardLink;
+
+ while (List != &HostBridgeInstance->Head) {
+ RootBridgeInstance = DRIVER_INSTANCE_FROM_LIST_ENTRY (List);
+ if (RootBridgeHandle == RootBridgeInstance->Handle) {
+ ///
+ /// Set up the Root Bridge for Bus Enumeration
+ ///
+ BusStart = RootBridgeInstance->BusBase;
+ BusEnd = RootBridgeInstance->BusLimit;
+
+ ///
+ /// Program the Hardware(if needed) if error return EFI_DEVICE_ERROR
+ ///
+ Status = (gBS->AllocatePool) (
+ EfiBootServicesData, sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) + sizeof (EFI_ACPI_END_TAG_DESCRIPTOR), &Buffer
+ );
+ if (EFI_ERROR (Status)) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Temp = (UINT8 *) Buffer;
+ ((EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *) Temp)->Desc = ACPI_ADDRESS_SPACE_DESCRIPTOR;
+ ((EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *) Temp)->Len = 0x2B;
+ ((EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *) Temp)->ResType = ACPI_ADDRESS_SPACE_TYPE_BUS;
+ ((EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *) Temp)->GenFlag = 0;
+ ((EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *) Temp)->SpecificFlag = 0;
+ ((EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *) Temp)->AddrSpaceGranularity = 0;
+ ((EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *) Temp)->AddrRangeMin = BusStart;
+ ((EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *) Temp)->AddrRangeMax = 0;
+ ((EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *) Temp)->AddrTranslationOffset = 0;
+ ((EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *) Temp)->AddrLen = BusEnd - BusStart + 1;
+
+ Temp = Temp + sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR);
+
+ ((EFI_ACPI_END_TAG_DESCRIPTOR *) Temp)->Desc = ACPI_END_TAG_DESCRIPTOR;
+ ((EFI_ACPI_END_TAG_DESCRIPTOR *) Temp)->Checksum = 0x0;
+ *Configuration = Buffer;
+ return EFI_SUCCESS;
+ }
+
+ List = List->ForwardLink;
+ }
+
+ return EFI_INVALID_PARAMETER;
+}
+
+/**
+ This function programs the PCI Root Bridge hardware so that
+ it decodes the specified PCI bus range
+
+ @param[in] This - The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_ PROTOCOL instance
+ @param[in] RootBridgeHandle - The PCI Root Bridge whose bus range is to be programmed
+ @param[in] Configuration - The pointer to the PCI bus resource descriptor
+
+ @retval EFI_SUCCESS - Succeed.
+ @retval EFI_INVALID_PARAMETER - Wrong parameters passed in.
+**/
+EFI_STATUS
+EFIAPI
+SetBusNumbers (
+ IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
+ IN EFI_HANDLE RootBridgeHandle,
+ IN VOID *Configuration
+ )
+{
+ LIST_ENTRY *List;
+ PCI_HOST_BRIDGE_INSTANCE *HostBridgeInstance;
+ PCI_ROOT_BRIDGE_INSTANCE *RootBridgeInstance;
+ UINT8 *Ptr;
+ UINTN BusStart;
+ UINTN BusEnd;
+ UINTN BusLen;
+
+ if (Configuration == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Ptr = Configuration;
+
+ ///
+ /// Check the Configuration is valid
+ ///
+ if (*Ptr != ACPI_ADDRESS_SPACE_DESCRIPTOR) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (((EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *) Ptr)->ResType != ACPI_ADDRESS_SPACE_TYPE_BUS) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Ptr += sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR);
+ if (*Ptr != ACPI_END_TAG_DESCRIPTOR) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ HostBridgeInstance = INSTANCE_FROM_RESOURCE_ALLOCATION_THIS (This);
+ List = HostBridgeInstance->Head.ForwardLink;
+ Ptr = Configuration;
+ while (List != &HostBridgeInstance->Head) {
+ RootBridgeInstance = DRIVER_INSTANCE_FROM_LIST_ENTRY (List);
+ if (RootBridgeHandle == RootBridgeInstance->Handle) {
+ BusStart = (UINTN) ((EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *) Ptr)->AddrRangeMin;
+ BusLen = (UINTN) ((EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *) Ptr)->AddrLen;
+ BusEnd = BusStart + BusLen - 1;
+ if (BusStart > BusEnd) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if ((BusStart < RootBridgeInstance->BusBase) || (BusEnd > RootBridgeInstance->BusLimit)) {
+ return EFI_INVALID_PARAMETER;
+ }
+ ///
+ /// Update the Bus Range
+ ///
+ RootBridgeInstance->ResAllocNode[TypeBus].Base = BusStart;
+ RootBridgeInstance->ResAllocNode[TypeBus].Length = BusLen;
+ RootBridgeInstance->ResAllocNode[TypeBus].Status = ResAllocated;
+
+ ///
+ /// Program the Root Bridge Hardware
+ ///
+ return EFI_SUCCESS;
+ }
+
+ List = List->ForwardLink;
+ }
+
+ return EFI_INVALID_PARAMETER;
+}
+
+/**
+ Submits the I/O and memory resource requirements for the specified PCI Root Bridge
+
+ @param[in] This - The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_ PROTOCOL instance
+ @param[in] RootBridgeHandle - The PCI Root Bridge whose I/O and memory resource requirements
+ are being submitted
+ @param[in] Configuration - The pointer to the PCI I/O and PCI memory resource descriptor
+
+ @retval EFI_SUCCESS - Succeed.
+ @retval EFI_INVALID_PARAMETER - Wrong parameters passed in.
+**/
+EFI_STATUS
+EFIAPI
+SubmitResources (
+ IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
+ IN EFI_HANDLE RootBridgeHandle,
+ IN VOID *Configuration
+ )
+{
+ LIST_ENTRY *List;
+ PCI_HOST_BRIDGE_INSTANCE *HostBridgeInstance;
+ PCI_ROOT_BRIDGE_INSTANCE *RootBridgeInstance;
+ UINT8 *Temp;
+ EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *ptr;
+ UINT64 AddrLen;
+ UINT64 Alignment;
+
+ ///
+ /// Check the input parameter: Configuration
+ ///
+ if (Configuration == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ HostBridgeInstance = INSTANCE_FROM_RESOURCE_ALLOCATION_THIS (This);
+ List = HostBridgeInstance->Head.ForwardLink;
+ Temp = (UINT8 *) Configuration;
+ while (*Temp == ACPI_ADDRESS_SPACE_DESCRIPTOR) {
+ Temp += sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR);
+ }
+
+ if (*Temp != ACPI_END_TAG_DESCRIPTOR) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Temp = (UINT8 *) Configuration;
+ while (List != &HostBridgeInstance->Head) {
+ RootBridgeInstance = DRIVER_INSTANCE_FROM_LIST_ENTRY (List);
+ if (RootBridgeHandle == RootBridgeInstance->Handle) {
+ while (*Temp == ACPI_ADDRESS_SPACE_DESCRIPTOR) {
+ ptr = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *) Temp;
+
+ ///
+ /// Check address range alignment
+ ///
+ if (ptr->AddrRangeMax >= (UINT64) 0xffffffff ||
+ ptr->AddrRangeMax != (Power2MaxMemory (ptr->AddrRangeMax + 1) - 1)
+ ) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ switch (ptr->ResType) {
+ case ACPI_ADDRESS_SPACE_TYPE_MEM:
+ ///
+ /// check the memory resource request is supported by PCI root bridge
+ ///
+ /// Hard code EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM 0 to support prefetchable memory allocation
+ ///
+ if (RootBridgeInstance->RootBridgeAttrib == 0 && ptr->SpecificFlag == 0x06) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ AddrLen = (UINT64) ptr->AddrLen;
+ Alignment = (UINT64) ptr->AddrRangeMax;
+ if (ptr->AddrSpaceGranularity == 32) {
+ if ((ptr->SpecificFlag & 0x06) == 0x06) {
+ ///
+ /// Apply from GCD
+ ///
+ RootBridgeInstance->ResAllocNode[TypePMem32].Length = AddrLen;
+ RootBridgeInstance->ResAllocNode[TypePMem32].Alignment = Alignment;
+ RootBridgeInstance->ResAllocNode[TypePMem32].Status = ResRequested;
+ HostBridgeInstance->ResourceSubmited = TRUE;
+
+ } else {
+ RootBridgeInstance->ResAllocNode[TypeMem32].Length = AddrLen;
+ RootBridgeInstance->ResAllocNode[TypeMem32].Alignment = Alignment;
+ RootBridgeInstance->ResAllocNode[TypeMem32].Status = ResRequested;
+ HostBridgeInstance->ResourceSubmited = TRUE;
+ }
+ }
+
+ if (ptr->AddrSpaceGranularity == 64) {
+ if ((ptr->SpecificFlag & 0x06) == 0x06) {
+ RootBridgeInstance->ResAllocNode[TypePMem64].Length = AddrLen;
+ RootBridgeInstance->ResAllocNode[TypePMem64].Alignment = Alignment;
+ RootBridgeInstance->ResAllocNode[TypePMem64].Status = ResSubmitted;
+ HostBridgeInstance->ResourceSubmited = TRUE;
+
+ } else {
+ RootBridgeInstance->ResAllocNode[TypeMem64].Length = AddrLen;
+ RootBridgeInstance->ResAllocNode[TypeMem64].Alignment = Alignment;
+ RootBridgeInstance->ResAllocNode[TypeMem64].Status = ResSubmitted;
+ HostBridgeInstance->ResourceSubmited = TRUE;
+ }
+ }
+ break;
+
+ case ACPI_ADDRESS_SPACE_TYPE_IO:
+ AddrLen = (UINT64) ptr->AddrLen;
+ Alignment = (UINT64) ptr->AddrRangeMax;
+ RootBridgeInstance->ResAllocNode[TypeIo].Length = AddrLen;
+ RootBridgeInstance->ResAllocNode[TypeIo].Alignment = Alignment;
+ RootBridgeInstance->ResAllocNode[TypeIo].Status = ResRequested;
+ HostBridgeInstance->ResourceSubmited = TRUE;
+ break;
+
+ default:
+ break;
+ }
+
+ Temp += sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR);
+ }
+
+ return EFI_SUCCESS;
+ }
+
+ List = List->ForwardLink;
+ }
+
+ return EFI_INVALID_PARAMETER;
+}
+
+/**
+ This function returns the proposed resource settings for the specified
+ PCI Root Bridge
+
+ @param[in] This - The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_ PROTOCOL instance
+ @param[in] RootBridgeHandle - The PCI Root Bridge handle
+ @param[in] Configuration - The pointer to the pointer to the PCI I/O
+ and memory resource descriptor
+
+ @retval EFI_SUCCESS - Succeed.
+ @retval EFI_OUT_OF_RESOURCES - Not enough pool to be allocated.
+ @retval EFI_INVALID_PARAMETER - RootBridgeHandle is not a valid handle.
+**/
+EFI_STATUS
+EFIAPI
+GetProposedResources (
+ IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
+ IN EFI_HANDLE RootBridgeHandle,
+ OUT VOID **Configuration
+ )
+{
+ LIST_ENTRY *List;
+ PCI_HOST_BRIDGE_INSTANCE *HostBridgeInstance;
+ PCI_ROOT_BRIDGE_INSTANCE *RootBridgeInstance;
+ UINTN Index;
+ UINTN Number;
+ VOID *Buffer;
+ UINT8 *Temp;
+ EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *ptr;
+ EFI_STATUS Status;
+ UINT64 ResStatus;
+
+ Buffer = NULL;
+ Number = 0;
+
+ ///
+ /// Get the Host Bridge Instance from the resource allocation protocol
+ ///
+ HostBridgeInstance = INSTANCE_FROM_RESOURCE_ALLOCATION_THIS (This);
+ List = HostBridgeInstance->Head.ForwardLink;
+
+ ///
+ /// Enumerate the root bridges in this host bridge
+ ///
+ while (List != &HostBridgeInstance->Head) {
+ RootBridgeInstance = DRIVER_INSTANCE_FROM_LIST_ENTRY (List);
+ if (RootBridgeHandle == RootBridgeInstance->Handle) {
+ for (Index = 0; Index < TypeBus; Index++) {
+ if (RootBridgeInstance->ResAllocNode[Index].Status != ResNone) {
+ Number++;
+ }
+ }
+
+ if (Number > 0) {
+ Status = (gBS->AllocatePool)
+ (
+ EfiBootServicesData, Number * sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) +
+ sizeof (EFI_ACPI_END_TAG_DESCRIPTOR), &Buffer
+ );
+ if (EFI_ERROR (Status)) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ ZeroMem (Buffer, sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) * Number + sizeof (EFI_ACPI_END_TAG_DESCRIPTOR));
+
+ Temp = Buffer;
+ for (Index = 0; Index < TypeBus; Index++) {
+ if (RootBridgeInstance->ResAllocNode[Index].Status != ResNone) {
+ ptr = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *) Temp;
+ ResStatus = RootBridgeInstance->ResAllocNode[Index].Status;
+ switch (Index) {
+ case TypeIo:
+ ///
+ /// Io
+ ///
+ ptr->Desc = 0x8A;
+ ptr->Len = 0x2B;
+ ptr->ResType = 1;
+ ptr->GenFlag = 0;
+ ptr->SpecificFlag = 0;
+ ptr->AddrRangeMin = RootBridgeInstance->ResAllocNode[Index].Base;
+ ptr->AddrRangeMax = 0;
+ ptr->AddrTranslationOffset = (ResStatus == ResAllocated) ? EFI_RESOURCE_SATISFIED : EFI_RESOURCE_LESS;
+ ptr->AddrLen = RootBridgeInstance->ResAllocNode[Index].Length;
+ break;
+
+ case TypeMem32:
+ ///
+ /// Memory 32
+ ///
+ ptr->Desc = 0x8A;
+ ptr->Len = 0x2B;
+ ptr->ResType = 0;
+ ptr->GenFlag = 0;
+ ptr->SpecificFlag = 0;
+ ptr->AddrSpaceGranularity = 32;
+ ptr->AddrRangeMin = RootBridgeInstance->ResAllocNode[Index].Base;
+ ptr->AddrRangeMax = 0;
+ ptr->AddrTranslationOffset = (ResStatus == ResAllocated) ? EFI_RESOURCE_SATISFIED : EFI_RESOURCE_LESS;
+ ptr->AddrLen = RootBridgeInstance->ResAllocNode[Index].Length;
+ break;
+
+ case TypePMem32:
+ ///
+ /// Prefetch memory 32
+ ///
+ ptr->Desc = 0x8A;
+ ptr->Len = 0x2B;
+ ptr->ResType = 0;
+ ptr->GenFlag = 0;
+ ptr->SpecificFlag = 6;
+ ptr->AddrSpaceGranularity = 32;
+ ptr->AddrRangeMin = 0;
+ ptr->AddrRangeMax = 0;
+ ptr->AddrTranslationOffset = (ResStatus == ResAllocated) ? EFI_RESOURCE_SATISFIED : EFI_RESOURCE_LESS;
+ ptr->AddrLen = RootBridgeInstance->ResAllocNode[Index].Length;
+ break;
+
+ case TypeMem64:
+ ///
+ /// Memory 64
+ ///
+ ptr->Desc = 0x8A;
+ ptr->Len = 0x2B;
+ ptr->ResType = 0;
+ ptr->GenFlag = 0;
+ ptr->SpecificFlag = 0;
+ ptr->AddrSpaceGranularity = 64;
+ ptr->AddrRangeMin = 0;
+ ptr->AddrRangeMax = 0;
+ ptr->AddrTranslationOffset = (ResStatus == ResAllocated) ? EFI_RESOURCE_SATISFIED : EFI_RESOURCE_LESS;
+ ptr->AddrLen = RootBridgeInstance->ResAllocNode[Index].Length;
+ break;
+
+ case TypePMem64:
+ ///
+ /// Prefetch memory 64
+ ///
+ ptr->Desc = 0x8A;
+ ptr->Len = 0x2B;
+ ptr->ResType = 0;
+ ptr->GenFlag = 0;
+ ptr->SpecificFlag = 6;
+ ptr->AddrSpaceGranularity = 64;
+ ptr->AddrRangeMin = 0;
+ ptr->AddrRangeMax = 0;
+ ptr->AddrTranslationOffset = (ResStatus == ResAllocated) ? EFI_RESOURCE_SATISFIED : EFI_RESOURCE_LESS;
+ ptr->AddrLen = RootBridgeInstance->ResAllocNode[Index].Length;
+ break;
+ }
+
+ Temp += sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR);
+ }
+ }
+
+ ((EFI_ACPI_END_TAG_DESCRIPTOR *) Temp)->Desc = 0x79;
+ ((EFI_ACPI_END_TAG_DESCRIPTOR *) Temp)->Checksum = 0x0;
+ *Configuration = Buffer;
+ }
+
+ return EFI_SUCCESS;
+ }
+
+ List = List->ForwardLink;
+ }
+
+ return EFI_INVALID_PARAMETER;
+}
+
+/**
+ This function is called for all the PCI controllers that the PCI
+ bus driver finds. Can be used to Preprogram the controller.
+
+ @param[in] This - The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_ PROTOCOL instance
+ @param[in] RootBridgeHandle - The PCI Root Bridge handle
+ @param[in] PciAddress - Address of the controller on the PCI bus
+ @param[in] Phase - The Phase during resource allocation
+
+ @retval EFI_SUCCESS - Succeed.
+ @retval EFI_INVALID_PARAMETER - RootBridgeHandle is not a valid handle.
+**/
+EFI_STATUS
+EFIAPI
+PreprocessController (
+ IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
+ IN EFI_HANDLE RootBridgeHandle,
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS PciAddress,
+ IN EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE Phase
+ )
+{
+ PCI_HOST_BRIDGE_INSTANCE *HostBridgeInstance;
+ PCI_ROOT_BRIDGE_INSTANCE *RootBridgeInstance;
+ LIST_ENTRY *List;
+
+ HostBridgeInstance = INSTANCE_FROM_RESOURCE_ALLOCATION_THIS (This);
+ List = HostBridgeInstance->Head.ForwardLink;
+
+ ///
+ /// Enumerate the root bridges in this host bridge
+ ///
+ while (List != &HostBridgeInstance->Head) {
+ RootBridgeInstance = DRIVER_INSTANCE_FROM_LIST_ENTRY (List);
+ if (RootBridgeHandle == RootBridgeInstance->Handle) {
+ return EFI_SUCCESS;
+ }
+
+ List = List->ForwardLink;
+ }
+
+ return EFI_INVALID_PARAMETER;
+}
+
+/**
+ Calculate max memory of power 2
+
+ @param[in] MemoryLength - Input memory length.
+
+ @retval Returned Maximum length.
+**/
+UINT64
+Power2MaxMemory (
+ IN UINT64 MemoryLength
+ )
+{
+ UINT64 Result;
+
+ if (RShiftU64 (MemoryLength, 32)) {
+ Result = LShiftU64 ((UINT64) GetPowerOfTwo64 (RShiftU64 (MemoryLength, 32)), 32);
+ } else {
+ Result = (UINT64) GetPowerOfTwo64 (MemoryLength);
+ }
+
+ return Result;
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/PciHostBridge/Dxe/PciHostBridge.cif b/ReferenceCode/Chipset/SystemAgent/PciHostBridge/Dxe/PciHostBridge.cif
new file mode 100644
index 0000000..55f38b5
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/PciHostBridge/Dxe/PciHostBridge.cif
@@ -0,0 +1,15 @@
+<component>
+ name = "PciHostBridge"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\SystemAgent\PciHostBridge\Dxe\"
+ RefName = "PciHostBridge"
+[files]
+"PciHostBridge.sdl"
+"PciHostBridge.mak"
+"PciHostBridge.c"
+"PciHostBridge.h"
+"PciHostBridge.dxs"
+"PciRootBridgeIo.c"
+"PciRootBridge.h"
+"PciHostBridge.inf"
+<endComponent>
diff --git a/ReferenceCode/Chipset/SystemAgent/PciHostBridge/Dxe/PciHostBridge.dxs b/ReferenceCode/Chipset/SystemAgent/PciHostBridge/Dxe/PciHostBridge.dxs
new file mode 100644
index 0000000..87cf509
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/PciHostBridge/Dxe/PciHostBridge.dxs
@@ -0,0 +1,43 @@
+/** @file
+ Dependency expression source file.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "DxeDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+
+#include EFI_PROTOCOL_DEFINITION (CpuIo)
+#include EFI_ARCH_PROTOCOL_DEFINITION (Metronome)
+#endif
+
+DEPENDENCY_START
+ EFI_CPU_IO_PROTOCOL_GUID AND
+ EFI_METRONOME_ARCH_PROTOCOL_GUID
+DEPENDENCY_END
diff --git a/ReferenceCode/Chipset/SystemAgent/PciHostBridge/Dxe/PciHostBridge.h b/ReferenceCode/Chipset/SystemAgent/PciHostBridge/Dxe/PciHostBridge.h
new file mode 100644
index 0000000..d94ff48
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/PciHostBridge/Dxe/PciHostBridge.h
@@ -0,0 +1,234 @@
+/** @file
+ The Header file of the Pci Host Bridge Driver
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#ifndef _PCI_HOST_BRIDGE_H_
+#define _PCI_HOST_BRIDGE_H_
+
+#include "EdkIIGlueDxe.h"
+#include "CpuRegs.h"
+#include "CpuPlatformLib.h"
+
+#include EFI_PROTOCOL_DEFINITION (PciHostBridgeResourceAllocation)
+
+///
+/// Hard code the host bridge number in the platform.
+/// In this chipset, there is only one host bridge.
+///
+#define HOST_BRIDGE_NUMBER 1
+
+#define PCI_HOST_BRIDGE_SIGNATURE EFI_SIGNATURE_32 ('e', 'h', 's', 't')
+typedef struct {
+ UINTN Signature;
+ EFI_HANDLE HostBridgeHandle;
+ UINTN RootBridgeNumber;
+ LIST_ENTRY Head;
+ BOOLEAN ResourceSubmited;
+ BOOLEAN CanRestarted;
+ EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL ResAlloc;
+} PCI_HOST_BRIDGE_INSTANCE;
+
+#define INSTANCE_FROM_RESOURCE_ALLOCATION_THIS(a) CR (a, PCI_HOST_BRIDGE_INSTANCE, ResAlloc, PCI_HOST_BRIDGE_SIGNATURE)
+
+///
+/// HostBridge Resource Allocation interface
+///
+/**
+ Enter a certain phase of the PCI enumeration process
+
+ @param[in] This - The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL instance
+ @param[in] Phase - The phase during enumeration
+
+ @retval EFI_SUCCESS - Succeed.
+ @retval EFI_INVALID_PARAMETER - Wrong phase parameter passed in.
+ @retval EFI_NOT_READY - Resources have not been submitted yet.
+**/
+EFI_STATUS
+EFIAPI
+NotifyPhase (
+ IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
+ IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PHASE Phase
+ )
+;
+
+/**
+ Return the device handle of the next PCI root bridge that is associated with
+ this Host Bridge
+
+ @param[in] This - The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_ PROTOCOL instance
+ @param[in] RootBridgeHandle - Returns the device handle of the next PCI Root Bridge.
+ On input, it holds the RootBridgeHandle returned by the most
+ recent call to GetNextRootBridge().The handle for the first
+ PCI Root Bridge is returned if RootBridgeHandle is NULL on input
+
+ @retval EFI_SUCCESS - Succeed.
+ @retval EFI_NOT_FOUND - Next PCI root bridge not found.
+ @retval EFI_INVALID_PARAMETER - Wrong parameter passed in.
+**/
+EFI_STATUS
+EFIAPI
+GetNextRootBridge (
+ IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
+ IN OUT EFI_HANDLE *RootBridgeHandle
+ )
+;
+
+/**
+ Returns the attributes of a PCI Root Bridge.
+
+ @param[in] This - The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_ PROTOCOL instance.
+ @param[in] RootBridgeHandle - The device handle of the PCI Root Bridge
+ that the caller is interested in
+ @param[in] Attributes - The pointer to attributes of the PCI Root Bridge
+
+ @retval EFI_SUCCESS - Succeed.
+ @retval EFI_INVALID_PARAMETER - Attributes parameter passed in is NULL or
+ RootBridgeHandle is not an EFI_HANDLE
+ that was returned on a previous call to
+ GetNextRootBridge().
+**/
+EFI_STATUS
+EFIAPI
+GetAttributes (
+ IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
+ IN EFI_HANDLE RootBridgeHandle,
+ OUT UINT64 *Attributes
+ )
+;
+
+/**
+ This is the request from the PCI enumerator to set up
+ the specified PCI Root Bridge for bus enumeration process.
+
+ @param[in] This - The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_ PROTOCOL instance.
+ @param[in] RootBridgeHandle - The PCI Root Bridge to be set up.
+ @param[in] Configuration - Pointer to the pointer to the PCI bus resource descriptor.
+
+ @retval EFI_SUCCESS - Succeed.
+ @retval EFI_OUT_OF_RESOURCES - Not enough pool to be allocated.
+ @retval EFI_INVALID_PARAMETER - RootBridgeHandle is not a valid handle.
+**/
+EFI_STATUS
+EFIAPI
+StartBusEnumeration (
+ IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
+ IN EFI_HANDLE RootBridgeHandle,
+ OUT VOID **Configuration
+ )
+;
+
+/**
+ This function programs the PCI Root Bridge hardware so that
+ it decodes the specified PCI bus range
+
+ @param[in] This - The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_ PROTOCOL instance
+ @param[in] RootBridgeHandle - The PCI Root Bridge whose bus range is to be programmed
+ @param[in] Configuration - The pointer to the PCI bus resource descriptor
+
+ @retval EFI_SUCCESS - Succeed.
+ @retval EFI_INVALID_PARAMETER - Wrong parameters passed in.
+**/
+EFI_STATUS
+EFIAPI
+SetBusNumbers (
+ IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
+ IN EFI_HANDLE RootBridgeHandle,
+ IN VOID *Configuration
+ )
+;
+
+/**
+ Submits the I/O and memory resource requirements for the specified PCI Root Bridge
+
+ @param[in] This - The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_ PROTOCOL instance
+ @param[in] RootBridgeHandle - The PCI Root Bridge whose I/O and memory resource requirements
+ are being submitted
+ @param[in] Configuration - The pointer to the PCI I/O and PCI memory resource descriptor
+
+ @retval EFI_SUCCESS - Succeed.
+ @retval EFI_INVALID_PARAMETER - Wrong parameters passed in.
+**/
+EFI_STATUS
+EFIAPI
+SubmitResources (
+ IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
+ IN EFI_HANDLE RootBridgeHandle,
+ IN VOID *Configuration
+ )
+;
+
+/**
+ This function returns the proposed resource settings for the specified
+ PCI Root Bridge
+
+ @param[in] This - The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_ PROTOCOL instance
+ @param[in] RootBridgeHandle - The PCI Root Bridge handle
+ @param[in] Configuration - The pointer to the pointer to the PCI I/O
+ and memory resource descriptor
+
+ @retval EFI_SUCCESS - Succeed.
+ @retval EFI_OUT_OF_RESOURCES - Not enough pool to be allocated.
+ @retval EFI_INVALID_PARAMETER - RootBridgeHandle is not a valid handle.
+**/
+EFI_STATUS
+EFIAPI
+GetProposedResources (
+ IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
+ IN EFI_HANDLE RootBridgeHandle,
+ OUT VOID **Configuration
+ )
+;
+
+/**
+ This function is called for all the PCI controllers that the PCI
+ bus driver finds. Can be used to Preprogram the controller.
+
+ @param[in] This - The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_ PROTOCOL instance
+ @param[in] RootBridgeHandle - The PCI Root Bridge handle
+ @param[in] PciAddress - Address of the controller on the PCI bus
+ @param[in] Phase - The Phase during resource allocation
+
+ @retval EFI_SUCCESS - Succeed.
+ @retval EFI_INVALID_PARAMETER - RootBridgeHandle is not a valid handle.
+**/
+EFI_STATUS
+EFIAPI
+PreprocessController (
+ IN struct _EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
+ IN EFI_HANDLE RootBridgeHandle,
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS PciAddress,
+ IN EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE Phase
+ )
+;
+
+/**
+ Calculate max memory of power 2
+
+ @param[in] MemoryLength - Input memory length.
+
+ @retval Returned Maximum length.
+**/
+UINT64
+Power2MaxMemory (
+ IN UINT64 MemoryLength
+ )
+;
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/PciHostBridge/Dxe/PciHostBridge.inf b/ReferenceCode/Chipset/SystemAgent/PciHostBridge/Dxe/PciHostBridge.inf
new file mode 100644
index 0000000..0c4561c
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/PciHostBridge/Dxe/PciHostBridge.inf
@@ -0,0 +1,86 @@
+## @file
+# Component description file for PciHostBridge module
+# {8D6756B9-E55E-4d6a-A3A5-5E4D72DDF772}
+# 0x8d6756b9, 0xee5e, 0x4d6a, 0xa3, 0xa5, 0x5e, 0x4d, 0x72, 0xdd, 0xf7, 0x72
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = PciHostBridge
+FILE_GUID = 8D6756B9-E55E-4d6a-A3A5-5E4D72DDF772
+COMPONENT_TYPE = BS_DRIVER
+
+[sources.common]
+ PciHostBridge.h
+ PciHostBridge.c
+ PciRootBridge.h
+ PciRootBridgeIo.c
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueDxeDriverEntryPoint.c
+
+[includes.common]
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EDK_SOURCE)/Foundation/Cpu/Pentium/Include
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include/Library
+
+[libraries.common]
+ ArchProtocolLib
+ EdkFrameworkProtocolLib
+ EfiScriptLib
+ EdkIIGlueBaseLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueDxeReportStatusCodeLib
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueDxeServicesTableLib
+ EdkIIGlueUefiLib
+ CPUIA32LIB
+ EdkIIGlueDxeMemoryAllocationLib
+ EdkProtocolLib
+ CpuPlatformLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = PciHostBridge.dxs
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=PciHostBridgeEntryPoint \
+ -D __EDKII_GLUE_BASE_LIB__ \
+ -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_LIB__\
+ -D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+
diff --git a/ReferenceCode/Chipset/SystemAgent/PciHostBridge/Dxe/PciHostBridge.mak b/ReferenceCode/Chipset/SystemAgent/PciHostBridge/Dxe/PciHostBridge.mak
new file mode 100644
index 0000000..fe3614c
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/PciHostBridge/Dxe/PciHostBridge.mak
@@ -0,0 +1,67 @@
+#---------------------------------------------------------------------------
+# Create PCI Host Bridge DXE Component
+#---------------------------------------------------------------------------
+EDK : PciHostBridge
+
+PciHostBridge : $(BUILD_DIR)\PciHostBridge.mak PciHostBridgeBin
+
+$(BUILD_DIR)\PciHostBridge.mak : $(PciHostBridge_DIR)\PciHostBridge.cif $(BUILD_RULES)
+ $(CIF2MAK) $(PciHostBridge_DIR)\PciHostBridge.cif $(CIF2MAK_DEFAULTS)
+
+PciHostBridge_INCLUDES=\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(EDK_INCLUDES)\
+ $(PROJECT_CPU_INCLUDES)\
+ $(INTEL_MCH_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+ /IInclude
+
+PciHostBridge_DEFINES =$(MY_DEFINES)\
+ /D "__EDKII_GLUE_MODULE_ENTRY_POINT__=PciHostBridgeEntryPoint" \
+ /D __EDKII_GLUE_BASE_LIB__ \
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_UEFI_LIB__\
+ /D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+
+PciHostBridge_LIB_LINKS =\
+ $(ArchProtocolLib)\
+ $(EFISCRIPTLIB)\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueDxeServicesTableLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueUefiLib_LIB)\
+ $(EdkIIGlueDxeMemoryAllocationLib_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueUefiRuntimeServicesTableLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(EDKPROTOCOLLIB)\
+ $(EFIDRIVERLIB)\
+ $(CpuPlatformLib_LIB)\
+ $(PchPlatformDxeLib_LIB)
+
+PciHostBridgeBin : $(PciHostBridge_LIB_LINKS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\PciHostBridge.mak all\
+ GUID=8D6756B9-E55E-4d6a-A3A5-5E4D72DDF772 \
+ ENTRY_POINT=_ModuleEntryPoint \
+ "MY_DEFINES=$(PciHostBridge_DEFINES)"\
+ "MY_INCLUDES=$(PciHostBridge_INCLUDES)"\
+ TYPE=BS_DRIVER \
+ EDKIIModule=DXEDRIVER\
+ DEPEX1=$(PciHostBridge_DIR)\PciHostBridge.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX\
+ COMPRESS=1
diff --git a/ReferenceCode/Chipset/SystemAgent/PciHostBridge/Dxe/PciHostBridge.sdl b/ReferenceCode/Chipset/SystemAgent/PciHostBridge/Dxe/PciHostBridge.sdl
new file mode 100644
index 0000000..9e2b5b3
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/PciHostBridge/Dxe/PciHostBridge.sdl
@@ -0,0 +1,41 @@
+TOKEN
+ Name = "PciHostBridge_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+ Help = "Main switch to enable PciHostBridge support in Project"
+ Token = "AMI_ROOT_BRIDGE_SUPPORT" "=" "0"
+End
+
+TOKEN
+ Name = "TOP_LOW_MEM_GRANULARITY"
+ Value = "0x10000000"
+ Help = "Adjust the MMIO granularity size 256MB."
+ TokenType = Integer
+ TargetH = Yes
+End
+
+MODULE
+ Help = "Includes PciHostBridge.mak to Project"
+ File = "PciHostBridge.mak"
+End
+
+PATH
+ Name = "PciHostBridge_DIR"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PciHostBridge.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/D AMI_COMBINE_MEM_PMEM_FLAG"
+ Parent = "GLOBAL_DEFINES"
+ InvokeOrder = AfterParent
+ Token = "COMBINE_MEM_PMEM" "=" "1"
+End \ No newline at end of file
diff --git a/ReferenceCode/Chipset/SystemAgent/PciHostBridge/Dxe/PciRootBridge.h b/ReferenceCode/Chipset/SystemAgent/PciHostBridge/Dxe/PciRootBridge.h
new file mode 100644
index 0000000..557755e
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/PciHostBridge/Dxe/PciRootBridge.h
@@ -0,0 +1,156 @@
+/** @file
+ The driver for the host to pci bridge (root bridge).
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PCI_ROOT_BRIDGE_H_
+#define _PCI_ROOT_BRIDGE_H_
+
+#include "EdkIIGlueDxe.h"
+#include "Acpi.h"
+#include "EfiScriptLib.h"
+#include "SaAccess.h"
+
+///
+/// Driver Consumed Protocol Prototypes
+///
+#include EFI_ARCH_PROTOCOL_DEFINITION (Metronome)
+#include EFI_PROTOCOL_CONSUMER (CpuIo)
+
+///
+/// Driver Produced Protocol Prototypes
+///
+#include EFI_PROTOCOL_DEFINITION (DevicePath)
+#include EFI_PROTOCOL_DEFINITION (PciRootBridgeIo)
+
+///
+/// Define resource status constant
+///
+#define EFI_RESOURCE_NONEXISTENT 0xFFFFFFFFFFFFFFFF
+#define EFI_RESOURCE_LESS 0xFFFFFFFFFFFFFFFE
+#define EFI_RESOURCE_SATISFIED 0x0000000000000000
+
+///
+/// Driver Instance Data Prototypes
+///
+typedef struct {
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_OPERATION Operation;
+ UINTN NumberOfBytes;
+ UINTN NumberOfPages;
+ EFI_PHYSICAL_ADDRESS HostAddress;
+ EFI_PHYSICAL_ADDRESS MappedHostAddress;
+} MAP_INFO;
+
+typedef struct {
+ ACPI_HID_DEVICE_PATH AcpiDevicePath;
+ EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
+} EFI_PCI_ROOT_BRIDGE_DEVICE_PATH;
+
+typedef struct {
+ UINT64 BusBase;
+ UINT64 BusLimit;
+ UINT64 MemBase;
+ UINT64 MemLimit;
+ UINT64 IoBase;
+ UINT64 IoLimit;
+} PCI_ROOT_BRIDGE_RESOURCE_APERTURE;
+
+typedef enum {
+ TypeIo = 0,
+ TypeMem32,
+ TypePMem32,
+ TypeMem64,
+ TypePMem64,
+ TypeBus,
+ TypeMax
+} PCI_RESOURCE_TYPE;
+
+typedef enum {
+ ResNone = 0,
+ ResSubmitted,
+ ResRequested,
+ ResAllocated,
+ ResStatusMax
+} RES_STATUS;
+
+typedef struct {
+ PCI_RESOURCE_TYPE Type;
+ UINT64 Base;
+ UINT64 Length;
+ UINT64 Alignment;
+ RES_STATUS Status;
+} PCI_RES_NODE;
+
+#define PCI_ROOT_BRIDGE_SIGNATURE EFI_SIGNATURE_32 ('e', '2', 'p', 'b')
+
+typedef struct {
+ UINT32 Signature;
+ LIST_ENTRY Link;
+ EFI_HANDLE Handle;
+ UINT64 RootBridgeAttrib;
+ UINT64 Attributes;
+ UINT64 Supports;
+
+ ///
+ /// Specific for this memory controller: Bus, I/O, Mem
+ ///
+ PCI_RES_NODE ResAllocNode[6];
+
+ ///
+ /// Addressing for Memory and I/O and Bus arrange
+ ///
+ UINT64 BusBase;
+ UINT64 MemBase;
+ UINT64 IoBase;
+ UINT64 BusLimit;
+ UINT64 MemLimit;
+ UINT64 IoLimit;
+ EFI_LOCK PciLock;
+ UINTN PciAddress;
+ UINTN PciData;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL Io;
+} PCI_ROOT_BRIDGE_INSTANCE;
+
+///
+/// Driver Instance Data Macros
+///
+#define DRIVER_INSTANCE_FROM_PCI_ROOT_BRIDGE_IO_THIS(a) CR (a, PCI_ROOT_BRIDGE_INSTANCE, Io, PCI_ROOT_BRIDGE_SIGNATURE)
+
+#define DRIVER_INSTANCE_FROM_LIST_ENTRY(a) CR (a, PCI_ROOT_BRIDGE_INSTANCE, Link, PCI_ROOT_BRIDGE_SIGNATURE)
+
+/**
+ Construct the Pci Root Bridge Io protocol
+
+ @param[in] Protocol - Point to protocol instance
+ @param[in] HostBridgeHandle - Handle of host bridge
+ @param[in] Attri - Attribute of host bridge
+ @param[in] ResAperture - ResourceAperture for host bridge
+
+ @retval EFI_SUCCESS - Success to initialize the Pci Root Bridge.
+**/
+EFI_STATUS
+RootBridgeConstructor (
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *Protocol,
+ IN EFI_HANDLE HostBridgeHandle,
+ IN UINT64 Attri,
+ IN PCI_ROOT_BRIDGE_RESOURCE_APERTURE *ResAperture
+ )
+;
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/PciHostBridge/Dxe/PciRootBridgeIo.c b/ReferenceCode/Chipset/SystemAgent/PciHostBridge/Dxe/PciRootBridgeIo.c
new file mode 100644
index 0000000..a3a0447
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/PciHostBridge/Dxe/PciRootBridgeIo.c
@@ -0,0 +1,1515 @@
+/** @file
+ EFI Memory Controller PCI Root Bridge Io Protocol
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "PciRootBridge.h"
+#include "Pci22.h"
+
+typedef struct {
+ EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR SpaceDesp[TypeMax];
+ EFI_ACPI_END_TAG_DESCRIPTOR EndDesp;
+} RESOURCE_CONFIGURATION;
+
+RESOURCE_CONFIGURATION Configuration = {
+ {
+ {
+ 0x8A,
+ 0x2B,
+ 1,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0
+ },
+ {
+ 0x8A,
+ 0x2B,
+ 0,
+ 0,
+ 0,
+ 32,
+ 0,
+ 0,
+ 0,
+ 0
+ },
+ {
+ 0x8A,
+ 0x2B,
+ 0,
+ 0,
+ 6,
+ 32,
+ 0,
+ 0,
+ 0,
+ 0
+ },
+ {
+ 0x8A,
+ 0x2B,
+ 0,
+ 0,
+ 0,
+ 64,
+ 0,
+ 0,
+ 0,
+ 0
+ },
+ {
+ 0x8A,
+ 0x2B,
+ 0,
+ 0,
+ 6,
+ 64,
+ 0,
+ 0,
+ 0,
+ 0
+ },
+ {
+ 0x8A,
+ 0x2B,
+ 2,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0
+ }
+ },
+ {
+ 0x79,
+ 0
+ }
+};
+
+///
+/// Protocol Member Function Prototypes
+///
+EFI_STATUS
+EFIAPI
+RootBridgeIoPollMem (
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
+ IN UINT64 Address,
+ IN UINT64 Mask,
+ IN UINT64 Value,
+ IN UINT64 Delay,
+ OUT UINT64 *Result
+ );
+
+EFI_STATUS
+EFIAPI
+RootBridgeIoPollIo (
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
+ IN UINT64 Address,
+ IN UINT64 Mask,
+ IN UINT64 Value,
+ IN UINT64 Delay,
+ OUT UINT64 *Result
+ );
+
+EFI_STATUS
+EFIAPI
+RootBridgeIoMemRead (
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
+ IN UINT64 Address,
+ IN UINTN Count,
+ IN OUT VOID *Buffer
+ );
+
+EFI_STATUS
+EFIAPI
+RootBridgeIoMemWrite (
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
+ IN UINT64 Address,
+ IN UINTN Count,
+ IN OUT VOID *Buffer
+ );
+
+EFI_STATUS
+EFIAPI
+RootBridgeIoIoRead (
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
+ IN UINT64 UserAddress,
+ IN UINTN Count,
+ IN OUT VOID *UserBuffer
+ );
+
+EFI_STATUS
+EFIAPI
+RootBridgeIoIoWrite (
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
+ IN UINT64 UserAddress,
+ IN UINTN Count,
+ IN OUT VOID *UserBuffer
+ );
+
+EFI_STATUS
+EFIAPI
+RootBridgeIoCopyMem (
+ IN struct _EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
+ IN UINT64 DestAddress,
+ IN UINT64 SrcAddress,
+ IN UINTN Count
+ );
+
+EFI_STATUS
+EFIAPI
+RootBridgeIoPciRead (
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
+ IN UINT64 Address,
+ IN UINTN Count,
+ IN OUT VOID *Buffer
+ );
+
+EFI_STATUS
+EFIAPI
+RootBridgeIoPciWrite (
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
+ IN UINT64 Address,
+ IN UINTN Count,
+ IN OUT VOID *Buffer
+ );
+
+EFI_STATUS
+EFIAPI
+RootBridgeIoMap (
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_OPERATION Operation,
+ IN VOID *HostAddress,
+ IN OUT UINTN *NumberOfBytes,
+ OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
+ OUT VOID **Mapping
+ );
+
+EFI_STATUS
+EFIAPI
+RootBridgeIoUnmap (
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
+ IN VOID *Mapping
+ );
+
+EFI_STATUS
+EFIAPI
+RootBridgeIoAllocateBuffer (
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
+ IN EFI_ALLOCATE_TYPE Type,
+ IN EFI_MEMORY_TYPE MemoryType,
+ IN UINTN Pages,
+ OUT VOID **HostAddress,
+ IN UINT64 Attributes
+ );
+
+EFI_STATUS
+EFIAPI
+RootBridgeIoFreeBuffer (
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
+ IN UINTN Pages,
+ OUT VOID *HostAddress
+ );
+
+EFI_STATUS
+EFIAPI
+RootBridgeIoFlush (
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This
+ );
+
+EFI_STATUS
+EFIAPI
+RootBridgeIoGetAttributes (
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
+ OUT UINT64 *Supported,
+ OUT UINT64 *Attributes
+ );
+
+EFI_STATUS
+EFIAPI
+RootBridgeIoSetAttributes (
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
+ IN UINT64 Attributes,
+ IN OUT UINT64 *ResourceBase,
+ IN OUT UINT64 *ResourceLength
+ );
+
+EFI_STATUS
+EFIAPI
+RootBridgeIoConfiguration (
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
+ OUT VOID **Resources
+ );
+
+///
+/// Sub Function Prototypes
+///
+typedef union {
+ UINT8 VOLATILE *buf;
+ UINT8 VOLATILE *ui8;
+ UINT16 VOLATILE *ui16;
+ UINT32 VOLATILE *ui32;
+ UINT64 VOLATILE *ui64;
+ UINTN VOLATILE ui;
+} PTR;
+
+STATIC
+EFI_STATUS
+RootBridgeIoPciRW (
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
+ IN BOOLEAN Write,
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
+ IN UINT64 UserAddress,
+ IN UINTN Count,
+ IN OUT VOID *UserBuffer
+ );
+
+///
+/// Memory Controller Pci Root Bridge Io Module Variables
+///
+EFI_METRONOME_ARCH_PROTOCOL *mMetronome;
+EFI_CPU_IO_PROTOCOL *mCpuIo;
+
+/**
+ Construct the Pci Root Bridge Io protocol
+
+ @param Protocol - Point to protocol instance
+ @param HostBridgeHandle - Handle of host bridge
+ @param Attri - Attribute of host bridge
+ @param ResAperture - ResourceAperture for host bridge
+
+ @retval EFI_SUCCESS - Success to initialize the Pci Root Bridge.
+**/
+EFI_STATUS
+RootBridgeConstructor (
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *Protocol,
+ IN EFI_HANDLE HostBridgeHandle,
+ IN UINT64 Attri,
+ IN PCI_ROOT_BRIDGE_RESOURCE_APERTURE *ResAperture
+ )
+{
+ EFI_STATUS Status;
+ PCI_ROOT_BRIDGE_INSTANCE *PrivateData;
+ PCI_RESOURCE_TYPE Index;
+
+ PrivateData = DRIVER_INSTANCE_FROM_PCI_ROOT_BRIDGE_IO_THIS (Protocol);
+
+ ///
+ /// The host to pci bridge, the host memory and io addresses are
+ /// direct mapped to pci addresses, so no need translate, set bases to 0.
+ ///
+ PrivateData->MemBase = ResAperture->MemBase;
+ PrivateData->IoBase = ResAperture->IoBase;
+
+ ///
+ /// The host bridge only supports 32bit addressing for memory
+ /// and standard IA32 16bit io
+ ///
+ PrivateData->MemLimit = ResAperture->MemLimit;
+ PrivateData->IoLimit = ResAperture->IoLimit;
+
+ ///
+ /// Bus Aperture for this Root Bridge (Possible Range)
+ ///
+ PrivateData->BusBase = ResAperture->BusBase;
+ PrivateData->BusLimit = ResAperture->BusLimit;
+
+ ///
+ /// Specific for this chipset
+ ///
+ for (Index = TypeIo; Index < TypeMax; Index++) {
+ PrivateData->ResAllocNode[Index].Type = Index;
+ PrivateData->ResAllocNode[Index].Base = 0;
+ PrivateData->ResAllocNode[Index].Length = 0;
+ PrivateData->ResAllocNode[Index].Status = ResNone;
+ }
+
+ EfiInitializeLock (&PrivateData->PciLock, EFI_TPL_HIGH_LEVEL);
+ PrivateData->PciAddress = 0xCF8;
+ PrivateData->PciData = 0xCFC;
+ PrivateData->RootBridgeAttrib = Attri;
+ PrivateData->Attributes = 0;
+ ///
+ /// Set both ISA_IO and ISA_IO_16 / VGA_IO and VGA_IO_16 to co-work
+ /// with EDK and EDK2 PCI bus driver.
+ ///
+ PrivateData->Supports = EFI_PCI_ATTRIBUTE_ISA_MOTHERBOARD_IO |
+ EFI_PCI_ATTRIBUTE_IDE_PRIMARY_IO |
+ EFI_PCI_ATTRIBUTE_ISA_IO |
+ EFI_PCI_ATTRIBUTE_ISA_IO_16 |
+ EFI_PCI_ATTRIBUTE_VGA_PALETTE_IO |
+ EFI_PCI_ATTRIBUTE_VGA_PALETTE_IO_16 |
+ EFI_PCI_ATTRIBUTE_VGA_MEMORY |
+ EFI_PCI_ATTRIBUTE_VGA_IO |
+ EFI_PCI_ATTRIBUTE_VGA_IO_16;
+ Protocol->ParentHandle = HostBridgeHandle;
+ Protocol->PollMem = RootBridgeIoPollMem;
+ Protocol->PollIo = RootBridgeIoPollIo;
+ Protocol->Mem.Read = RootBridgeIoMemRead;
+ Protocol->Mem.Write = RootBridgeIoMemWrite;
+ Protocol->Io.Read = RootBridgeIoIoRead;
+ Protocol->Io.Write = RootBridgeIoIoWrite;
+ Protocol->CopyMem = RootBridgeIoCopyMem;
+ Protocol->Pci.Read = RootBridgeIoPciRead;
+ Protocol->Pci.Write = RootBridgeIoPciWrite;
+ Protocol->Map = RootBridgeIoMap;
+ Protocol->Unmap = RootBridgeIoUnmap;
+ Protocol->AllocateBuffer = RootBridgeIoAllocateBuffer;
+ Protocol->FreeBuffer = RootBridgeIoFreeBuffer;
+ Protocol->Flush = RootBridgeIoFlush;
+ Protocol->GetAttributes = RootBridgeIoGetAttributes;
+ Protocol->SetAttributes = RootBridgeIoSetAttributes;
+ Protocol->Configuration = RootBridgeIoConfiguration;
+ Protocol->SegmentNumber = 0;
+ Status = gBS->LocateProtocol (&gEfiMetronomeArchProtocolGuid, NULL, (VOID **) &mMetronome);
+ ASSERT_EFI_ERROR (Status);
+
+ Status = gBS->LocateProtocol (&gEfiCpuIoProtocolGuid, NULL, (VOID **) &mCpuIo);
+ ASSERT_EFI_ERROR (Status);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Polls an address in memory mapped I/O space until an exit condition is met, or
+ a timeout occurs.
+
+ @param[in] This - A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
+ @param[in] Width - Signifies the width of the memory operations.
+ @param[in] Address - The base address of the memory operations. The caller is
+ responsible for aligning Address if required.
+ @param[in] Mask - Mask used for the polling criteria. Bytes above Width in Mask
+ are ignored. The bits in the bytes below Width which are zero in
+ Mask are ignored when polling the memory address.
+ @param[in] Value - The comparison value used for the polling exit criteria.
+ @param[in] Delay - The number of 100 ns units to poll. Note that timer available may
+ be of poorer granularity.
+ @param[out] Result - Pointer to the last value read from the memory location.
+
+ @retval EFI_SUCCESS - The last data returned from the access matched the poll exit criteria.
+ @retval EFI_INVALID_PARAMETER - Width is invalid or Result is NULL..
+ @retval EFI_TIMEOUT - Delay expired before a match occurred.
+**/
+EFI_STATUS
+EFIAPI
+RootBridgeIoPollMem (
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
+ IN UINT64 Address,
+ IN UINT64 Mask,
+ IN UINT64 Value,
+ IN UINT64 Delay,
+ OUT UINT64 *Result
+ )
+{
+ EFI_STATUS Status;
+ UINT64 NumberOfTicks;
+ UINT32 Remainder;
+
+ if (Result == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (Width < 0 || Width > EfiPciWidthUint64) {
+ return EFI_INVALID_PARAMETER;
+ }
+ ///
+ /// No matter what, always do a single poll.
+ ///
+ Status = This->Mem.Read (This, Width, Address, 1, Result);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ if ((*Result & Mask) == Value) {
+ return EFI_SUCCESS;
+ }
+
+ if (Delay == 0) {
+ return EFI_SUCCESS;
+ } else {
+ ///
+ /// Determine the proper # of metronome ticks to wait for polling the
+ /// location. The nuber of ticks is Roundup (Delay / mMetronome->TickPeriod)+1
+ /// The "+1" to account for the possibility of the first tick being short
+ /// because we started in the middle of a tick.
+ ///
+ NumberOfTicks = DivU64x32Remainder (Delay, (UINT32) mMetronome->TickPeriod, &Remainder);
+ if (Remainder != 0) {
+ NumberOfTicks += 1;
+ }
+
+ NumberOfTicks += 1;
+ while (NumberOfTicks) {
+ mMetronome->WaitForTick (mMetronome, 1);
+ Status = This->Mem.Read (This, Width, Address, 1, Result);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ if ((*Result & Mask) == Value) {
+ return EFI_SUCCESS;
+ }
+
+ NumberOfTicks -= 1;
+ }
+ }
+
+ return EFI_TIMEOUT;
+}
+
+/**
+ Reads from the I/O space of a PCI Root Bridge. Returns when either the polling exit criteria is
+ satisfied or after a defined duration.
+
+ @param[in] This - A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
+ @param[in] Width - Signifies the width of the I/O operations.
+ @param[in] Address - The base address of the I/O operations. The caller is responsible
+ for aligning Address if required.
+ @param[in] Mask - Mask used for the polling criteria. Bytes above Width in Mask
+ are ignored. The bits in the bytes below Width which are zero in
+ Mask are ignored when polling the I/O address.
+ @param[in] Value - The comparison value used for the polling exit criteria.
+ @param[in] Delay - The number of 100 ns units to poll. Note that timer available may
+ be of poorer granularity.
+ @param[out] Result - Pointer to the last value read from the memory location.
+
+ @retval EFI_SUCCESS - The last data returned from the access matched the poll exit criteria.
+ @retval EFI_INVALID_PARAMETER - Width is invalid or Result is NULL.
+ @retval EFI_TIMEOUT - Delay expired before a match occurred.
+**/
+EFI_STATUS
+EFIAPI
+RootBridgeIoPollIo (
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
+ IN UINT64 Address,
+ IN UINT64 Mask,
+ IN UINT64 Value,
+ IN UINT64 Delay,
+ OUT UINT64 *Result
+ )
+{
+ EFI_STATUS Status;
+ UINT64 NumberOfTicks;
+ UINT32 Remainder;
+
+ ///
+ /// No matter what, always do a single poll.
+ ///
+ if (Result == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (Width < 0 || Width > EfiPciWidthUint64) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Status = This->Io.Read (This, Width, Address, 1, Result);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ if ((*Result & Mask) == Value) {
+ return EFI_SUCCESS;
+ }
+
+ if (Delay == 0) {
+ return EFI_SUCCESS;
+ } else {
+ ///
+ /// Determine the proper # of metronome ticks to wait for polling the
+ /// location. The number of ticks is Roundup (Delay / mMetronome->TickPeriod)+1
+ /// The "+1" to account for the possibility of the first tick being short
+ /// because we started in the middle of a tick.
+ ///
+ NumberOfTicks = DivU64x32Remainder (Delay, (UINT32) mMetronome->TickPeriod, &Remainder);
+ if (Remainder != 0) {
+ NumberOfTicks += 1;
+ }
+
+ NumberOfTicks += 1;
+ while (NumberOfTicks) {
+ mMetronome->WaitForTick (mMetronome, 1);
+ Status = This->Io.Read (This, Width, Address, 1, Result);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ if ((*Result & Mask) == Value) {
+ return EFI_SUCCESS;
+ }
+
+ NumberOfTicks -= 1;
+ }
+ }
+
+ return EFI_TIMEOUT;
+}
+
+/**
+ Enables a PCI driver to access PCI controller registers in the PCI root bridge memory space.
+
+ @param[in] This - A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
+ @param[in] Width - Signifies the width of the memory operation.
+ @param[in] Address - The base address of the memory operation. The caller is
+ responsible for aligning the Address if required.
+ @param[in] Count - The number of memory operations to perform. Bytes moved is
+ Width size * Count, starting at Address.
+ @param[in, out] Buffer - For read operations, the destination buffer to store the results. For
+ write operations, the source buffer to write data from.
+
+ @retval EFI_SUCCESS - The data was read from or written to the PCI root bridge.
+ @retval EFI_INVALID_PARAMETER - Width is invalid for this PCI root bridge or Buffer is NULL.
+**/
+EFI_STATUS
+EFIAPI
+RootBridgeIoMemRead (
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
+ IN UINT64 Address,
+ IN UINTN Count,
+ IN OUT VOID *Buffer
+ )
+{
+ PCI_ROOT_BRIDGE_INSTANCE *PrivateData;
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH OldWidth;
+ UINTN OldCount;
+
+ if (Buffer == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (Width < 0 || Width >= EfiPciWidthMaximum) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+// AMI_OVERRIDE (EIP#106042+)>>
+ // Fix Fpt.efi not work, accessing Rom decode region could cause AEL bit
+ // be set, and, Pci Resource should not be inside rom decode region.
+ if ((Address >= 0xff000000) && (Address <= 0xffffffff)) {
+ return EFI_INVALID_PARAMETER;
+ }
+// AMI_OVERRIDE <<
+
+ PrivateData = DRIVER_INSTANCE_FROM_PCI_ROOT_BRIDGE_IO_THIS (This);
+
+ ///
+ /// Check memory access limit
+ ///
+ if (Address < PrivateData->MemBase) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ OldWidth = Width;
+ OldCount = Count;
+ if (Width >= EfiPciWidthFifoUint8 && Width <= EfiPciWidthFifoUint64) {
+ Count = 1;
+ }
+
+ Width &= 0x03;
+ if (Address + MultU64x32 (LShiftU64 (1, Width), (UINT32) Count) - 1 > PrivateData->MemLimit) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ return mCpuIo->Mem.Read (
+ mCpuIo,
+ (EFI_CPU_IO_PROTOCOL_WIDTH) OldWidth,
+ Address,
+ OldCount,
+ Buffer
+ );
+}
+
+/**
+ Enables a PCI driver to access PCI controller registers in the PCI root bridge memory space.
+
+ @param[in] This - A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
+ @param[in] Width - Signifies the width of the memory operation.
+ @param[in] Address - The base address of the memory operation. The caller is
+ responsible for aligning the Address if required.
+ @param[in] Count - The number of memory operations to perform. Bytes moved is
+ Width size * Count, starting at Address.
+ @param[in, out] Buffer - For read operations, the destination buffer to store the results. For
+ write operations, the source buffer to write data from.
+
+ @retval EFI_SUCCESS - The data was read from or written to the PCI root bridge.
+ @retval EFI_INVALID_PARAMETER - Width is invalid for this PCI root bridge or Buffer is NULL.
+**/
+EFI_STATUS
+EFIAPI
+RootBridgeIoMemWrite (
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
+ IN UINT64 Address,
+ IN UINTN Count,
+ IN OUT VOID *Buffer
+ )
+{
+ PCI_ROOT_BRIDGE_INSTANCE *PrivateData;
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH OldWidth;
+ UINTN OldCount;
+
+ if (Buffer == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (Width < 0 || Width >= EfiPciWidthMaximum) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ PrivateData = DRIVER_INSTANCE_FROM_PCI_ROOT_BRIDGE_IO_THIS (This);
+
+ ///
+ /// Check memory access limit
+ ///
+ if (Address < PrivateData->MemBase) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ OldWidth = Width;
+ OldCount = Count;
+ if (Width >= EfiPciWidthFifoUint8 && Width <= EfiPciWidthFifoUint64) {
+ Count = 1;
+ }
+
+ Width &= 0x03;
+ if (Address + MultU64x32 (LShiftU64 (1, Width), (UINT32) Count) - 1 > PrivateData->MemLimit) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ return mCpuIo->Mem.Write (
+ mCpuIo,
+ (EFI_CPU_IO_PROTOCOL_WIDTH) OldWidth,
+ Address,
+ OldCount,
+ Buffer
+ );
+}
+
+/**
+ Enables a PCI driver to access PCI controller registers in the PCI root bridge I/O space.
+
+ @param[in] This - A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
+ @param[in] Width - Signifies the width of the memory operations.
+ @param[in] UserAddress - The base address of the I/O operation. The caller is responsible for
+ aligning the Address if required.
+ @param[in] Count - The number of I/O operations to perform. Bytes moved is Width
+ size * Count, starting at Address.
+ @param[in, out] UserBuffer - For read operations, the destination buffer to store the results. For
+ write operations, the source buffer to write data from.
+
+ @retval EFI_SUCCESS - The data was read from or written to the PCI root bridge.
+ @retval EFI_INVALID_PARAMETER - Width is invalid for this PCI root bridge or Buffer is NULL.
+**/
+EFI_STATUS
+EFIAPI
+RootBridgeIoIoRead (
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
+ IN UINT64 Address,
+ IN UINTN Count,
+ IN OUT VOID *Buffer
+ )
+{
+
+ UINTN AlignMask;
+ PCI_ROOT_BRIDGE_INSTANCE *PrivateData;
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH OldWidth;
+ UINTN OldCount;
+
+ if (Buffer == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (Width < 0 || Width >= EfiPciWidthMaximum) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ PrivateData = DRIVER_INSTANCE_FROM_PCI_ROOT_BRIDGE_IO_THIS (This);
+
+ ///
+ /// AlignMask = (1 << Width) - 1;
+ ///
+ AlignMask = (1 << (Width & 0x03)) - 1;
+
+ ///
+ /// Check Io access limit
+ ///
+ if (Address < PrivateData->IoBase) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ OldWidth = Width;
+ OldCount = Count;
+ if (Width >= EfiPciWidthFifoUint8 && Width <= EfiPciWidthFifoUint64) {
+ Count = 1;
+ }
+
+ Width &= 0x03;
+ if (Address + MultU64x32 (LShiftU64 (1, Width), (UINT32) Count) - 1 >= PrivateData->IoLimit) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (Address & AlignMask) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ return mCpuIo->Io.Read (
+ mCpuIo,
+ (EFI_CPU_IO_PROTOCOL_WIDTH) OldWidth,
+ Address,
+ OldCount,
+ Buffer
+ );
+}
+
+/**
+ Enables a PCI driver to access PCI controller registers in the PCI root bridge I/O space.
+
+ @param[in] This - A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
+ @param[in] Width - Signifies the width of the memory operations.
+ @param[in] UserAddress - The base address of the I/O operation. The caller is responsible for
+ aligning the Address if required.
+ @param[in] Count - The number of I/O operations to perform. Bytes moved is Width
+ size * Count, starting at Address.
+ @param[in, out] UserBuffer - For read operations, the destination buffer to store the results. For
+ write operations, the source buffer to write data from.
+
+ @retval EFI_SUCCESS - The data was read from or written to the PCI root bridge.
+ @retval EFI_INVALID_PARAMETER - Width is invalid for this PCI root bridge or Buffer is NULL.
+**/
+EFI_STATUS
+EFIAPI
+RootBridgeIoIoWrite (
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
+ IN UINT64 Address,
+ IN UINTN Count,
+ IN OUT VOID *Buffer
+ )
+{
+ UINTN AlignMask;
+ PCI_ROOT_BRIDGE_INSTANCE *PrivateData;
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH OldWidth;
+ UINTN OldCount;
+
+ if (Buffer == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (Width < 0 || Width >= EfiPciWidthMaximum) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ PrivateData = DRIVER_INSTANCE_FROM_PCI_ROOT_BRIDGE_IO_THIS (This);
+
+ ///
+ /// AlignMask = (1 << Width) - 1;
+ ///
+ AlignMask = (1 << (Width & 0x03)) - 1;
+
+ ///
+ /// Check Io access limit
+ ///
+ if (Address < PrivateData->IoBase) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ OldWidth = Width;
+ OldCount = Count;
+ if (Width >= EfiPciWidthFifoUint8 && Width <= EfiPciWidthFifoUint64) {
+ Count = 1;
+ }
+
+ Width &= 0x03;
+ if (Address + MultU64x32 (LShiftU64 (1, Width), (UINT32) Count) - 1 >= PrivateData->IoLimit) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (Address & AlignMask) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ return mCpuIo->Io.Write (
+ mCpuIo,
+ (EFI_CPU_IO_PROTOCOL_WIDTH) OldWidth,
+ Address,
+ OldCount,
+ Buffer
+ );
+}
+
+/**
+ Enables a PCI driver to copy one region of PCI root bridge memory space to another region of PCI
+ root bridge memory space.
+
+ @param[in] This - A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL instance.
+ @param[in] Width - Signifies the width of the memory operations.
+ @param[in] DestAddress - The destination address of the memory operation. The caller is
+ responsible for aligning the DestAddress if required.
+ @param[in] SrcAddress - The source address of the memory operation. The caller is
+ responsible for aligning the SrcAddress if required.
+ @param[in] Count - The number of memory operations to perform. Bytes moved is
+ Width size * Count, starting at DestAddress and SrcAddress.
+
+ @retval EFI_SUCCESS - The data was copied from one memory region to another memory region.
+ @retval EFI_INVALID_PARAMETER - Width is invalid for this PCI root bridge.
+**/
+EFI_STATUS
+EFIAPI
+RootBridgeIoCopyMem (
+ IN struct _EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
+ IN UINT64 DestAddress,
+ IN UINT64 SrcAddress,
+ IN UINTN Count
+ )
+{
+ EFI_STATUS Status;
+ BOOLEAN Direction;
+ UINTN Stride;
+ UINTN Index;
+ UINT64 Result;
+
+ if (Width < 0 || Width > EfiPciWidthUint64) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (DestAddress == SrcAddress) {
+ return EFI_SUCCESS;
+ }
+
+ Stride = (UINTN) (LShiftU64 (1, Width));
+ Direction = TRUE;
+ if ((DestAddress > SrcAddress) && (DestAddress < (SrcAddress + Count * Stride))) {
+ Direction = FALSE;
+ SrcAddress = SrcAddress + (Count - 1) * Stride;
+ DestAddress = DestAddress + (Count - 1) * Stride;
+ }
+
+ for (Index = 0; Index < Count; Index++) {
+ Status = RootBridgeIoMemRead (
+ This,
+ Width,
+ SrcAddress,
+ 1,
+ &Result
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = RootBridgeIoMemWrite (
+ This,
+ Width,
+ DestAddress,
+ 1,
+ &Result
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ if (Direction) {
+ SrcAddress += Stride;
+ DestAddress += Stride;
+ } else {
+ SrcAddress -= Stride;
+ DestAddress -= Stride;
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Enables a PCI driver to access PCI controller registers in a PCI root bridge's configuration space.
+
+ @param[in] This - A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
+ @param[in] Width - Signifies the width of the memory operations.
+ @param[in] Address - The address within the PCI configuration space for the PCI controller.
+ @param[in] Count - The number of PCI configuration operations to perform. Bytes
+ moved is Width size * Count, starting at Address.
+ @param[in, out] Buffer - For read operations, the destination buffer to store the results. For
+ write operations, the source buffer to write data from.
+
+ @retval EFI_SUCCESS - The data was read from or written to the PCI root bridge.
+ @retval EFI_INVALID_PARAMETER - Width is invalid for this PCI root bridge or Buffer is NULL.
+**/
+EFI_STATUS
+EFIAPI
+RootBridgeIoPciRead (
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
+ IN UINT64 Address,
+ IN UINTN Count,
+ IN OUT VOID *Buffer
+ )
+{
+ if (Buffer == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (Width < 0 || Width >= EfiPciWidthMaximum) {
+ return EFI_INVALID_PARAMETER;
+ }
+ ///
+ /// Read Pci configuration space
+ ///
+ return RootBridgeIoPciRW (This, FALSE, Width, Address, Count, Buffer);
+}
+
+/**
+ Enables a PCI driver to access PCI controller registers in a PCI root bridge's configuration space.
+
+ @param[in] This - A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
+ @param[in] Width - Signifies the width of the memory operations.
+ @param[in] Address - The address within the PCI configuration space for the PCI controller.
+ @param[in] Count - The number of PCI configuration operations to perform. Bytes
+ moved is Width size * Count, starting at Address.
+ @param[in, out] Buffer - For read operations, the destination buffer to store the results. For
+ write operations, the source buffer to write data from.
+
+ @retval EFI_SUCCESS - The data was read from or written to the PCI root bridge.
+ @retval EFI_INVALID_PARAMETER - Width is invalid for this PCI root bridge or Buffer is NULL.
+**/
+EFI_STATUS
+EFIAPI
+RootBridgeIoPciWrite (
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
+ IN UINT64 Address,
+ IN UINTN Count,
+ IN OUT VOID *Buffer
+ )
+{
+
+ if (Buffer == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (Width < 0 || Width >= EfiPciWidthMaximum) {
+ return EFI_INVALID_PARAMETER;
+ }
+ ///
+ /// Write Pci configuration space
+ ///
+ return RootBridgeIoPciRW (This, TRUE, Width, Address, Count, Buffer);
+}
+
+/**
+ Provides the PCI controller-specific addresses required to access system memory from a
+ DMA bus master.
+
+ @param[in] This - A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
+ @param[in] Operation - Indicates if the bus master is going to read or write to system memory.
+ @param[in] HostAddress - The system memory address to map to the PCI controller.
+ @param[in, out] NumberOfBytes - On input the number of bytes to map. On output the number of bytes that were mapped.
+ @param[out] DeviceAddress - The resulting map address for the bus master PCI controller to use
+ to access the system memory's HostAddress.
+ @param[out] Mapping - The value to pass to Unmap() when the bus master DMA operation is complete.
+
+ @retval EFI_SUCCESS - The range was mapped for the returned NumberOfBytes.
+ @retval EFI_INVALID_PARAMETER - Operation is invalid.
+ @retval EFI_INVALID_PARAMETER - HostAddress or NumberOfBytes or DeviceAddress or Mapping is NULL.
+ @retval EFI_UNSUPPORTED - The HostAddress cannot be mapped as a common buffer.
+**/
+EFI_STATUS
+EFIAPI
+RootBridgeIoMap (
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_OPERATION Operation,
+ IN VOID *HostAddress,
+ IN OUT UINTN *NumberOfBytes,
+ OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
+ OUT VOID **Mapping
+ )
+{
+ EFI_STATUS Status;
+ EFI_PHYSICAL_ADDRESS PhysicalAddress;
+ MAP_INFO *MapInfo;
+
+ if (HostAddress == NULL || NumberOfBytes == NULL || DeviceAddress == NULL || Mapping == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+ ///
+ /// Initialize the return values to their defaults
+ ///
+ *Mapping = NULL;
+
+ ///
+ /// Make sure that Operation is valid
+ ///
+ if (Operation < 0 || Operation >= EfiPciOperationMaximum) {
+ return EFI_INVALID_PARAMETER;
+ }
+ ///
+ /// Most PCAT like chipsets can not handle performing DMA above 4GB.
+ /// If any part of the DMA transfer being mapped is above 4GB, then
+ /// map the DMA transfer to a buffer below 4GB.
+ ///
+ PhysicalAddress = (EFI_PHYSICAL_ADDRESS) (UINTN) HostAddress;
+ if ((PhysicalAddress +*NumberOfBytes) > 0x100000000) {
+ ///
+ /// Common Buffer operations can not be remapped. If the common buffer
+ /// if above 4GB, then it is not possible to generate a mapping, so return
+ /// an error.
+ ///
+ if (Operation == EfiPciOperationBusMasterCommonBuffer || Operation == EfiPciOperationBusMasterCommonBuffer64) {
+ return EFI_UNSUPPORTED;
+ }
+ ///
+ /// Allocate a MAP_INFO structure to remember the mapping when Unmap() is
+ /// called later.
+ ///
+ Status = (gBS->AllocatePool) (EfiBootServicesData, sizeof (MAP_INFO), (VOID **) &MapInfo);
+ if (EFI_ERROR (Status)) {
+ *NumberOfBytes = 0;
+ return Status;
+ }
+ ///
+ /// Return a pointer to the MAP_INFO structure in Mapping
+ ///
+ *Mapping = MapInfo;
+
+ ///
+ /// Initialize the MAP_INFO structure
+ ///
+ MapInfo->Operation = Operation;
+ MapInfo->NumberOfBytes = *NumberOfBytes;
+ MapInfo->NumberOfPages = EFI_SIZE_TO_PAGES (*NumberOfBytes);
+ MapInfo->HostAddress = PhysicalAddress;
+ MapInfo->MappedHostAddress = 0x00000000ffffffff;
+
+ ///
+ /// Allocate a buffer below 4GB to map the transfer to.
+ ///
+ Status = (gBS->AllocatePages) (AllocateMaxAddress, EfiBootServicesData, MapInfo->NumberOfPages, &MapInfo->MappedHostAddress);
+ if (EFI_ERROR (Status)) {
+ (gBS->FreePool) (MapInfo);
+ *NumberOfBytes = 0;
+ return Status;
+ }
+ ///
+ /// If this is a read operation from the Bus Master's point of view,
+ /// then copy the contents of the real buffer into the mapped buffer
+ /// so the Bus Master can read the contents of the real buffer.
+ ///
+ if (Operation == EfiPciOperationBusMasterRead || Operation == EfiPciOperationBusMasterRead64) {
+ CopyMem (
+ (VOID *) (UINTN) MapInfo->MappedHostAddress,
+ (VOID *) (UINTN) MapInfo->HostAddress,
+ MapInfo->NumberOfBytes
+ );
+ }
+ ///
+ /// The DeviceAddress is the address of the maped buffer below 4GB
+ ///
+ *DeviceAddress = MapInfo->MappedHostAddress;
+ } else {
+ ///
+ /// The transfer is below 4GB, so the DeviceAddress is simply the HostAddress
+ ///
+ *DeviceAddress = PhysicalAddress;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Completes the Map() operation and releases any corresponding resources.
+
+ @param[in] This - A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
+ @param[in] Mapping - The mapping value returned from Map().
+
+ @retval EFI_SUCCESS - The range was unmapped.
+ @retval EFI_INVALID_PARAMETER - Mapping is not a value that was returned by Map().
+**/
+EFI_STATUS
+EFIAPI
+RootBridgeIoUnmap (
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
+ IN VOID *Mapping
+ )
+{
+ MAP_INFO *MapInfo;
+
+ ///
+ /// See if the Map() operation associated with this Unmap() required a mapping buffer.
+ /// If a mapping buffer was not required, then this function simply returns EFI_SUCCESS.
+ ///
+ if (Mapping != NULL) {
+ ///
+ /// Get the MAP_INFO structure from Mapping
+ ///
+ MapInfo = (MAP_INFO *) Mapping;
+
+ ///
+ /// If this is a write operation from the Bus Master's point of view,
+ /// then copy the contents of the mapped buffer into the real buffer
+ /// so the processor can read the contents of the real buffer.
+ ///
+ if (MapInfo->Operation == EfiPciOperationBusMasterWrite || MapInfo->Operation == EfiPciOperationBusMasterWrite64) {
+ CopyMem (
+ (VOID *) (UINTN) MapInfo->HostAddress,
+ (VOID *) (UINTN) MapInfo->MappedHostAddress,
+ MapInfo->NumberOfBytes
+ );
+ }
+ ///
+ /// Free the mapped buffer and the MAP_INFO structure.
+ ///
+ (gBS->FreePages) (MapInfo->MappedHostAddress, MapInfo->NumberOfPages);
+ (gBS->FreePool) (Mapping);
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Allocates pages that are suitable for an EfiPciOperationBusMasterCommonBuffer or
+ EfiPciOperationBusMasterCommonBuffer64 mapping.
+
+ @param This - A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
+ @param Type - This parameter is not used and must be ignored.
+ @param MemoryType - The type of memory to allocate, EfiBootServicesData or EfiRuntimeServicesData.
+ @param Pages - The number of pages to allocate.
+ @param HostAddress - A pointer to store the base system memory address of the allocated range.
+ @param Attributes - The requested bit mask of attributes for the allocated range. Only
+ the attributes EFI_PCI_ATTRIBUTE_MEMORY_WRITE_COMBINE, EFI_PCI_ATTRIBUTE_MEMORY_CACHED,
+ and EFI_PCI_ATTRIBUTE_DUAL_ADDRESS_CYCLE may be used with this function.
+
+ @retval EFI_SUCCESS - The requested memory pages were allocated.
+ @retval EFI_INVALID_PARAMETER - MemoryType is invalid or HostAddress is NULL.
+ @retval EFI_UNSUPPORTED - Attributes is unsupported. The only legal attribute bits are
+ MEMORY_WRITE_COMBINE, MEMORY_CACHED, and DUAL_ADDRESS_CYCLE.
+**/
+EFI_STATUS
+EFIAPI
+RootBridgeIoAllocateBuffer (
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
+ IN EFI_ALLOCATE_TYPE Type,
+ IN EFI_MEMORY_TYPE MemoryType,
+ IN UINTN Pages,
+ OUT VOID **HostAddress,
+ IN UINT64 Attributes
+ )
+{
+ EFI_STATUS Status;
+ EFI_PHYSICAL_ADDRESS PhysicalAddress;
+
+ ///
+ /// Validate Attributes
+ ///
+ if (Attributes & EFI_PCI_ATTRIBUTE_INVALID_FOR_ALLOCATE_BUFFER) {
+ return EFI_UNSUPPORTED;
+ }
+ ///
+ /// Check for invalid inputs
+ ///
+ if (HostAddress == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ ///
+ /// The only valid memory types are EfiBootServicesData and EfiRuntimeServicesData
+ ///
+ if (MemoryType != EfiBootServicesData && MemoryType != EfiRuntimeServicesData) {
+ return EFI_INVALID_PARAMETER;
+ }
+ ///
+ /// Limit allocations to memory below 4GB
+ ///
+ PhysicalAddress = (EFI_PHYSICAL_ADDRESS) (0xffffffff);
+ Status = (gBS->AllocatePages) (AllocateMaxAddress, MemoryType, Pages, &PhysicalAddress);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ *HostAddress = (VOID *) (UINTN) PhysicalAddress;
+ return EFI_SUCCESS;
+}
+
+/**
+ Frees memory that was allocated with AllocateBuffer().
+
+ The FreeBuffer() function frees memory that was allocated with AllocateBuffer().
+
+ @param This - A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
+ @param Pages - The number of pages to free.
+ @param HostAddress - The base system memory address of the allocated range.
+
+ @retval EFI_SUCCESS - The requested memory pages were freed.
+ @retval EFI_INVALID_PARAMETER - The memory range specified by HostAddress and Pages
+ was not allocated with AllocateBuffer().
+**/
+EFI_STATUS
+EFIAPI
+RootBridgeIoFreeBuffer (
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
+ IN UINTN Pages,
+ OUT VOID *HostAddress
+ )
+{
+ return (gBS->FreePages) ((EFI_PHYSICAL_ADDRESS) (UINTN) HostAddress, Pages);
+}
+
+/**
+ Flushes all PCI posted write transactions from a PCI host bridge to system memory.
+
+ @param This - A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
+
+ @retval EFI_SUCCESS - The PCI posted write transactions were flushed from the PCI host
+ bridge to system memory.
+**/
+EFI_STATUS
+EFIAPI
+RootBridgeIoFlush (
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This
+ )
+{
+ ///
+ /// not supported yet
+ ///
+ return EFI_SUCCESS;
+}
+
+/**
+ Gets the attributes that a PCI root bridge supports setting with SetAttributes(), and the
+ attributes that a PCI root bridge is currently using.
+
+ @param This - A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
+ @param Supported - A pointer to the mask of attributes that this PCI root bridge
+ supports setting with SetAttributes().
+ @param Attributes - A pointer to the mask of attributes that this PCI root bridge is
+ currently using.
+
+ @retval EFI_SUCCESS - If Supports is not NULL, then the attributes that the PCI root
+ bridge supports is returned in Supports. If Attributes is
+ not NULL, then the attributes that the PCI root bridge is currently
+ using is returned in Attributes.
+ @retval EFI_INVALID_PARAMETER - Both Supports and Attributes are NULL.
+**/
+EFI_STATUS
+EFIAPI
+RootBridgeIoGetAttributes (
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
+ OUT UINT64 *Supported,
+ OUT UINT64 *Attributes
+ )
+{
+ PCI_ROOT_BRIDGE_INSTANCE *PrivateData;
+
+ PrivateData = DRIVER_INSTANCE_FROM_PCI_ROOT_BRIDGE_IO_THIS (This);
+ if (Attributes == NULL && Supported == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+ ///
+ /// Set the return value for Supported and Attributes
+ ///
+ if (Supported) {
+ *Supported = PrivateData->Supports;
+ }
+
+ if (Attributes) {
+ *Attributes = PrivateData->Attributes;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Sets attributes for a resource range on a PCI root bridge.
+
+ @param[in] This - A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
+ @param[in] Attributes - The mask of attributes to set. If the attribute bit
+ MEMORY_WRITE_COMBINE, MEMORY_CACHED, or
+ MEMORY_DISABLE is set, then the resource range is specified by
+ ResourceBase and ResourceLength. If
+ MEMORY_WRITE_COMBINE, MEMORY_CACHED, and
+ MEMORY_DISABLE are not set, then ResourceBase and
+ ResourceLength are ignored, and may be NULL.
+ @param[in, out] ResourceBase - A pointer to the base address of the resource range to be modified
+ by the attributes specified by Attributes.
+ @param[in, out] ResourceLength - A pointer to the length of the resource range to be modified by the
+ attributes specified by Attributes.
+
+ @retval EFI_SUCCESS - The current configuration of this PCI root bridge was returned in Resources.
+ @retval EFI_UNSUPPORTED - The current configuration of this PCI root bridge could not be retrieved.
+**/
+EFI_STATUS
+EFIAPI
+RootBridgeIoSetAttributes (
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
+ IN UINT64 Attributes,
+ IN OUT UINT64 *ResourceBase,
+ IN OUT UINT64 *ResourceLength
+ )
+{
+ PCI_ROOT_BRIDGE_INSTANCE *PrivateData;
+
+ PrivateData = DRIVER_INSTANCE_FROM_PCI_ROOT_BRIDGE_IO_THIS (This);
+ if (Attributes) {
+ if ((Attributes & (~(PrivateData->Supports))) != 0) {
+ return EFI_UNSUPPORTED;
+ }
+ }
+
+ if (Attributes == PrivateData->Attributes) {
+ return EFI_SUCCESS;
+ }
+ ///
+ /// It is just a trick for some attribute can only be enabled or disabled
+ /// otherwise it can impact on other devices
+ ///
+ PrivateData->Attributes = Attributes;
+ return EFI_SUCCESS;
+}
+
+/**
+ Retrieves the current resource settings of this PCI root bridge in the form of a set of ACPI 2.0
+ resource descriptors.
+
+ @param[in] This - A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
+ @param[out] Resources - A pointer to the ACPI 2.0 resource descriptors that describe the
+ current configuration of this PCI root bridge. The storage for the
+ ACPI 2.0 resource descriptors is allocated by this function. The
+ caller must treat the return buffer as read-only data, and the buffer
+ must not be freed by the caller.
+
+ @retval EFI_SUCCESS - The current configuration of this PCI root bridge was returned in Resources.
+**/
+EFI_STATUS
+EFIAPI
+RootBridgeIoConfiguration (
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
+ OUT VOID **Resources
+ )
+{
+ PCI_ROOT_BRIDGE_INSTANCE *PrivateData;
+ UINTN Index;
+
+ PrivateData = DRIVER_INSTANCE_FROM_PCI_ROOT_BRIDGE_IO_THIS (This);
+ for (Index = 0; Index < TypeMax; Index++) {
+ if (PrivateData->ResAllocNode[Index].Status == ResAllocated) {
+ Configuration.SpaceDesp[Index].AddrRangeMin = PrivateData->ResAllocNode[Index].Base;
+ Configuration.SpaceDesp[Index].AddrRangeMax = PrivateData->ResAllocNode[Index].Base +
+ PrivateData->ResAllocNode[Index].Length -
+ 1;
+ Configuration.SpaceDesp[Index].AddrLen = PrivateData->ResAllocNode[Index].Length;
+ }
+ }
+
+ *Resources = &Configuration;
+ return EFI_SUCCESS;
+}
+
+/**
+ Internal help function for read and write PCI configuration space.
+
+ @param[in] This - A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
+ @param[in] Write - Switch value for Read or Write.
+ @param[in] Width - Signifies the width of the memory operations.
+ @param[in] UserAddress - The address within the PCI configuration space for the PCI controller.
+ @param[in] Count - The number of PCI configuration operations to perform. Bytes
+ moved is Width size * Count, starting at Address.
+ @param[in, out] UserBuffer - For read operations, the destination buffer to store the results. For
+ write operations, the source buffer to write data from.
+
+ @retval EFI_SUCCESS - The data was read from or written to the PCI root bridge.
+ @retval EFI_INVALID_PARAMETER - Width is invalid for this PCI root bridge or Buffer is NULL.
+**/
+STATIC
+EFI_STATUS
+RootBridgeIoPciRW (
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
+ IN BOOLEAN Write,
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
+ IN UINT64 UserAddress,
+ IN UINTN Count,
+ IN OUT VOID *UserBuffer
+ )
+{
+ UINT32 InStride;
+ UINT32 OutStride;
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS *PciRbAddr;
+ UINT8 *PcieRegAddr;
+
+ if ((Width & 0x03) >= EfiPciWidthUint64) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ InStride = 1 << (Width & 0x03);
+ OutStride = InStride;
+ if (Width >= EfiCpuIoWidthFifoUint8 && Width <= EfiCpuIoWidthFifoUint64) {
+ InStride = 0;
+ }
+
+ if (Width >= EfiCpuIoWidthFillUint8 && Width <= EfiCpuIoWidthFillUint64) {
+ OutStride = 0;
+ }
+
+ PciRbAddr = (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS *) &UserAddress;
+ PcieRegAddr = (UINT8 *) MmPciAddress (
+ 0, /// No segment support
+ PciRbAddr->Bus,
+ PciRbAddr->Device,
+ PciRbAddr->Function,
+ 0 /// Register is added next
+ );
+
+ ///
+ /// Add the register offset to the address
+ ///
+ if (PciRbAddr->ExtendedRegister != 0) {
+ PcieRegAddr += PciRbAddr->ExtendedRegister;
+ } else {
+ PcieRegAddr += PciRbAddr->Register;
+ }
+
+ while (Count) {
+ if (Write) {
+ This->Mem.Write (This, Width, (UINTN) PcieRegAddr, 1, UserBuffer);
+ } else {
+ This->Mem.Read (This, Width, (UINTN) PcieRegAddr, 1, UserBuffer);
+ }
+
+ UserBuffer = ((UINT8 *) UserBuffer) + OutStride;
+ PcieRegAddr += InStride;
+ Count -= 1;
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/Ppi/IntelSaPpiLib.inf b/ReferenceCode/Chipset/SystemAgent/Ppi/IntelSaPpiLib.inf
new file mode 100644
index 0000000..4b3fb06
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Ppi/IntelSaPpiLib.inf
@@ -0,0 +1,53 @@
+## @file
+# Component description file for the PEI protocol library
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+
+[defines]
+BASE_NAME = IntelSaPpiLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ SsaPeiInit/SsaPeiInit.c
+ SsaPeiInit/SsaPeiInit.h
+ SaPlatformPolicy/SaPlatformPolicy.c
+ SaPlatformPolicy/SaPlatformPolicy.h
+ SaPeiInit/SaPeiInit.c
+ SaPeiInit/SaPeiInit.h
+
+[includes.common]
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Pei/Include
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/$(PROJECT_SA_MRC)/Pei/Source/Api
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/$(PROJECT_SA_MRC)/Pei/Source/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/$(PROJECT_SA_MRC)/Pei/Source/Include/MrcRegisters
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Include
+
+[nmake.common]
+C_STD_INCLUDE=
diff --git a/ReferenceCode/Chipset/SystemAgent/Ppi/SaPeiInit/SaPeiInit.c b/ReferenceCode/Chipset/SystemAgent/Ppi/SaPeiInit/SaPeiInit.c
new file mode 100644
index 0000000..50530ed
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Ppi/SaPeiInit/SaPeiInit.c
@@ -0,0 +1,40 @@
+/** @file
+ Interface definition between MRC and SaInitPeim driver.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+///
+/// External include files do NOT need to be explicitly specified in real EDKII
+/// environment
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#endif
+
+#include "SaPeiInit.h"
+
+///
+/// PPI GUID definition
+///
+EFI_GUID gSaPeiInitPpiGuid = SA_PEI_INIT_PPI_GUID;
+
+///
+/// PPI description
+///
+EFI_GUID_STRING(&gSaPeiInitPpiGuid, "SA PEI Init PPI", "SA PEI Initialization PPI");
diff --git a/ReferenceCode/Chipset/SystemAgent/Ppi/SaPeiInit/SaPeiInit.h b/ReferenceCode/Chipset/SystemAgent/Ppi/SaPeiInit/SaPeiInit.h
new file mode 100644
index 0000000..b82348c
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Ppi/SaPeiInit/SaPeiInit.h
@@ -0,0 +1,37 @@
+/** @file
+ Interface definition between MRC and SaInitPeim driver.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _SA_PEI_INIT_H_
+#define _SA_PEI_INIT_H_
+
+///
+/// Define the SA PEI Init PPI GUID
+///
+#define SA_PEI_INIT_PPI_GUID \
+ { \
+ 0x9ea8911, 0xbe0d, 0x4230, 0xa0, 0x3, 0xed, 0xc6, 0x93, 0xb4, 0x8e, 0x11 \
+ }
+
+///
+/// Extern the GUID for PPI users.
+///
+extern EFI_GUID gSaPeiInitPpiGuid;
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/Ppi/SaPlatformPolicy/SaPlatformPolicy.c b/ReferenceCode/Chipset/SystemAgent/Ppi/SaPlatformPolicy/SaPlatformPolicy.c
new file mode 100644
index 0000000..34dc03f
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Ppi/SaPlatformPolicy/SaPlatformPolicy.c
@@ -0,0 +1,32 @@
+/** @file
+ Interface definition details between MRC and platform drivers during PEI phase.
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "Tiano.h"
+#include "SaPlatformPolicy.h"
+
+///
+/// PPI GUID definition
+///
+EFI_GUID gSaPlatformPolicyPpiGuid = SA_PLATFORM_POLICY_PPI_GUID;
+
+///
+/// PPI description
+///
+EFI_GUID_STRING(&gSaPlatformPolicyPpiGuid, "SaPlatformPolicy", "System Agent Platform Policy PPI");
diff --git a/ReferenceCode/Chipset/SystemAgent/Ppi/SaPlatformPolicy/SaPlatformPolicy.h b/ReferenceCode/Chipset/SystemAgent/Ppi/SaPlatformPolicy/SaPlatformPolicy.h
new file mode 100644
index 0000000..d70d5da
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Ppi/SaPlatformPolicy/SaPlatformPolicy.h
@@ -0,0 +1,698 @@
+/** @file
+ Interface definition details between MRC and platform drivers during PEI phase.
+
+@copyright
+ Copyright (c) 2010 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _SA_PLATFORM_POLICY_PPI_H_
+#define _SA_PLATFORM_POLICY_PPI_H_
+
+#include "MrcApi.h"
+#include "SaAccess.h"
+
+///
+/// SA Platform Policy for PEI phase {573EAF99-F445-46b5-A5D5-BC4A933598F3}
+///
+#define SA_PLATFORM_POLICY_PPI_GUID \
+ { \
+ 0x573eaf99, 0xf445, 0x46b5, 0xa5, 0xd5, 0xbc, 0x4a, 0x93, 0x35, 0x98, 0xf3 \
+ }
+
+///
+/// Extern the GUID for protocol users.
+///
+extern EFI_GUID gSaPlatformPolicyPpiGuid;
+
+///
+/// PPI revision number
+/// Any backwards compatible changes to this PPI will result in an update in the revision number
+/// Major changes will require publication of a new PPI
+///
+/// Revision 1: Initial version.
+/// Included in SA RC 0.5.0.0
+///
+#define SA_PLATFORM_POLICY_PPI_REVISION 1
+///
+/// Revision 2: Added PCIE_CONFIGURATION.PegGen3PresetSearchVoltageMarginSteps
+/// PCIE_CONFIGURATION.PegGen3PresetSearchVoltageStartMargin
+/// PCIE_CONFIGURATION.PegGen3PresetSearchFavorTiming
+/// PCIE_CONFIGURATION.PegDataPtr
+/// PCIE_CONFIGURATION.PegGen3ForcePresetSearch
+/// PCIE_CONFIGURATION.InitPcieAspmAfterOprom
+/// PCIE_CONFIGURATION.SaIotrapSmiAddress
+/// Added MEMORY_CONFIGURATION.DqPinsInterleaved
+/// MEMORY_CONFIGURATION.DIMMODTT1D
+/// MEMORY_CONFIGURATION.WRSRT
+/// MEMORY_CONFIGURATION.DIMMRONT
+///
+#define SA_PLATFORM_POLICY_PPI_REVISION_2 2
+///
+/// Revision 3: Added SA_PLATFORM_DATA.SgMode
+/// SA_PLATFORM_DATA.SgSubSystemId
+/// Added SA_PLATFORM_POLICY_PPI.SgGpioData
+/// PCIE_CONFIGURATION.PegGpioData
+/// PCIE_CONFIGURATION.PegGen3PresetSearchErrorTarget
+/// PCIE_CONFIGURATION.RxCEMLoopback
+/// PCIE_CONFIGURATION.RxCEMLoopbackLane
+/// PCIE_CONFIGURATION.Gen3RxCtleP[SA_PEG_MAX_LANE >> 1]
+/// Obsoleted PCIE_CONFIGURATION.PegGen3PresetSearchMarginSteps
+/// PCIE_CONFIGURATION.PegGen3PresetSearchVoltageMarginSteps
+/// PCIE_CONFIGURATION.PegGen3PresetSearchFavorTiming
+/// MEMORY_CONFIGURATION.ForceColdReset
+/// Added OVERCLOCKING_CONFIGURATION.GtVoltageMode
+/// OVERCLOCKING_CONFIGURATION.OcSupport
+/// MEMORY_CONFIGURATION.MrcUltPoSafeConfig
+///
+#define SA_PLATFORM_POLICY_PPI_REVISION_3 3
+///
+/// Revision 4: Added MEMORY_CONFIGURATION.CMDVC
+/// MEMORY_CONFIGURATION.PowerDownMode
+/// MEMORY_CONFIGURATION.PwdwnIdleCounter
+/// MEMORY_CONFIGURATION.RankInterleave
+/// MEMORY_CONFIGURATION.EnhancedInterleave
+/// MEMORY_CONFIGURATION.WeaklockEn;
+/// MEMORY_CONFIGURATION.EnCmdRate
+/// MEMORY_CONFIGURATION.CmdTriStateDis
+///
+#define SA_PLATFORM_POLICY_PPI_REVISION_4 4
+///
+/// Revision 5: Added MEMORY_CONFIGURATION.BClkFrequency
+/// OVERCLOCKING_CONFIGURATION.IoaVoltageOffset
+/// OVERCLOCKING_CONFIGURATION.IodVoltageOffset
+///
+#define SA_PLATFORM_POLICY_PPI_REVISION_5 5
+///
+/// Revision 6: Added MEMORY_CONFIGURATION.tRPab
+/// MEMORY_CONFIGURATION.ALIASCHK
+/// Obsoleted MEMORY_CONFIGURATION.WRXTCT
+/// PCIE_CONFIGURATION.PegGen3EqualizationPhase2
+/// Added GT_CONFIGURATION.GttMmAdr
+///
+#define SA_PLATFORM_POLICY_PPI_REVISION_6 6
+///
+/// Revision 7: Obsoleted MEMORY_CONFIGURATION.B2BXTT
+/// MEMORY_CONFIGURATION.C2CXTT
+/// Added MEMORY_CONFIGURATION.MemoryTrace
+///
+#define SA_PLATFORM_POLICY_PPI_REVISION_7 7
+///
+/// Revision 8: Added PCIE_CONFIGURATION.PowerDownUnusedBundles[SA_PEG_MAX_FUN]
+///
+#define SA_PLATFORM_POLICY_PPI_REVISION_8 8
+///
+/// Revision 9: Added SA_PLATFORM_DATA.IedSize
+/// MEMORY_CONFIGURATION.RefreshRate2x
+/// MEMORY_CONFIGURATION.ChHashEnable
+/// MEMORY_CONFIGURATION.ChHashMask
+/// MEMORY_CONFIGURATION.ChHashInterleaveBit
+///
+#define SA_PLATFORM_POLICY_PPI_REVISION_9 9
+///
+/// Revision 10: Added MEMORY_CONFIGURATION.EnableExtts
+/// MEMORY_CONFIGURATION.EnableCltm
+/// MEMORY_CONFIGURATION.EnableOltm
+/// MEMORY_CONFIGURATION.EnablePwrDn
+/// MEMORY_CONFIGURATION.EnablePwrDnLpddr
+/// MEMORY_CONFIGURATION.Refresh2X
+/// MEMORY_CONFIGURATION.LpddrThermalSensor
+/// MEMORY_CONFIGURATION.LockPTMregs
+/// MEMORY_CONFIGURATION.UserPowerWeightsEn
+/// MEMORY_CONFIGURATION.EnergyScaleFact
+/// MEMORY_CONFIGURATION.RaplPwrFlCh1
+/// MEMORY_CONFIGURATION.RaplPwrFlCh0
+/// MEMORY_CONFIGURATION.RaplLim2Lock
+/// MEMORY_CONFIGURATION.RaplLim2WindX
+/// MEMORY_CONFIGURATION.RaplLim2WindY
+/// MEMORY_CONFIGURATION.RaplLim2Ena
+/// MEMORY_CONFIGURATION.RaplLim2Pwr
+/// MEMORY_CONFIGURATION.RaplLim1WindX
+/// MEMORY_CONFIGURATION.RaplLim1WindY
+/// MEMORY_CONFIGURATION.RaplLim1Ena
+/// MEMORY_CONFIGURATION.RaplLim1Pwr
+/// MEMORY_CONFIGURATION.WarmThresholdCh0Dimm0
+/// MEMORY_CONFIGURATION.WarmThresholdCh0Dimm1
+/// MEMORY_CONFIGURATION.WarmThresholdCh1Dimm0
+/// MEMORY_CONFIGURATION.WarmThresholdCh1Dimm1
+/// MEMORY_CONFIGURATION.HotThresholdCh0Dimm0
+/// MEMORY_CONFIGURATION.HotThresholdCh0Dimm1
+/// MEMORY_CONFIGURATION.HotThresholdCh1Dimm0
+/// MEMORY_CONFIGURATION.HotThresholdCh1Dimm1
+/// MEMORY_CONFIGURATION.WarmBudgetCh0Dimm0
+/// MEMORY_CONFIGURATION.WarmBudgetCh0Dimm1
+/// MEMORY_CONFIGURATION.WarmBudgetCh1Dimm0
+/// MEMORY_CONFIGURATION.WarmBudgetCh1Dimm1
+/// MEMORY_CONFIGURATION.HotBudgetCh0Dimm0
+/// MEMORY_CONFIGURATION.HotBudgetCh0Dimm1
+/// MEMORY_CONFIGURATION.HotBudgetCh1Dimm0
+/// MEMORY_CONFIGURATION.HotBudgetCh1Dimm1
+/// MEMORY_CONFIGURATION.IdleEnergyCh0Dimm1
+/// MEMORY_CONFIGURATION.IdleEnergyCh0Dimm0
+/// MEMORY_CONFIGURATION.PdEnergyCh0Dimm1
+/// MEMORY_CONFIGURATION.PdEnergyCh0Dimm0
+/// MEMORY_CONFIGURATION.ActEnergyCh0Dimm1
+/// MEMORY_CONFIGURATION.ActEnergyCh0Dimm0
+/// MEMORY_CONFIGURATION.RdEnergyCh0Dimm1
+/// MEMORY_CONFIGURATION.RdEnergyCh0Dimm0
+/// MEMORY_CONFIGURATION.WrEnergyCh0Dimm1
+/// MEMORY_CONFIGURATION.WrEnergyCh0Dimm0
+/// MEMORY_CONFIGURATION.IdleEnergyCh1Dimm1
+/// MEMORY_CONFIGURATION.IdleEnergyCh1Dimm0
+/// MEMORY_CONFIGURATION.PdEnergyCh1Dimm1
+/// MEMORY_CONFIGURATION.PdEnergyCh1Dimm0
+/// MEMORY_CONFIGURATION.ActEnergyCh1Dimm1
+/// MEMORY_CONFIGURATION.ActEnergyCh1Dimm0
+/// MEMORY_CONFIGURATION.RdEnergyCh1Dimm1
+/// MEMORY_CONFIGURATION.RdEnergyCh1Dimm0
+/// MEMORY_CONFIGURATION.WrEnergyCh1Dimm1
+/// MEMORY_CONFIGURATION.WrEnergyCh1Dimm0
+/// MEMORY_CONFIGURATION.SrefCfgEna
+/// MEMORY_CONFIGURATION.SrefCfgIdleTmr
+/// MEMORY_CONFIGURATION.ThrtCkeMinDefeat
+/// MEMORY_CONFIGURATION.ThrtCkeMinTmr
+/// MEMORY_CONFIGURATION.ThrtCkeMinDefeatLpddr
+/// MEMORY_CONFIGURATION.ThrtCkeMinTmrLpddr
+#define SA_PLATFORM_POLICY_PPI_REVISION_10 10
+///
+/// Revision 11: Added MEMORY_CONFIGURATION.CAVrefCtlOffset
+/// MEMORY_CONFIGURATION.Ch0VrefCtlOffset
+/// MEMORY_CONFIGURATION.Ch1VrefCtlOffset
+/// MEMORY_CONFIGURATION.Ch0ClkPiCodeOffset
+/// MEMORY_CONFIGURATION.Ch1ClkPiCodeOffset
+/// MEMORY_CONFIGURATION.Ch0RcvEnOffset
+/// MEMORY_CONFIGURATION.Ch0RxDqsOffset
+/// MEMORY_CONFIGURATION.Ch0TxDqOffset
+/// MEMORY_CONFIGURATION.Ch0TxDqsOffset
+/// MEMORY_CONFIGURATION.Ch0VrefOffset
+/// MEMORY_CONFIGURATION.Ch1RcvEnOffset
+/// MEMORY_CONFIGURATION.Ch1RxDqsOffset
+/// MEMORY_CONFIGURATION.Ch1TxDqOffset
+/// MEMORY_CONFIGURATION.Ch1TxDqsOffset
+/// MEMORY_CONFIGURATION.Ch1VrefOffset
+/// PCIE_CONFIGURATION.PegComplianceTestingMode
+/// MEMORY_CONFIGURATION.MaxRttWr
+#define SA_PLATFORM_POLICY_PPI_REVISION_11 11
+///
+/// Revision 12: Added MEMORY_CONFIGURATION.RCVENC1D
+///
+#define SA_PLATFORM_POLICY_PPI_REVISION_12 12
+///
+/// Revision 13: Added MEMORY_CONFIGURATION.MCREGOFFSET
+///
+#define SA_PLATFORM_POLICY_PPI_REVISION_13 13
+///
+/// Revision 14: Added GT_CONFIGURATION.PanelPowerEnable
+/// Obsoleted MEMORY_CONFIGURATION.CAVrefCtlOffset
+/// MEMORY_CONFIGURATION.Ch0VrefCtlOffset
+/// MEMORY_CONFIGURATION.Ch1VrefCtlOffset
+/// MEMORY_CONFIGURATION.Ch0ClkPiCodeOffset
+/// MEMORY_CONFIGURATION.Ch1ClkPiCodeOffset
+/// MEMORY_CONFIGURATION.Ch0RcvEnOffset
+/// MEMORY_CONFIGURATION.Ch0RxDqsOffset
+/// MEMORY_CONFIGURATION.Ch0TxDqOffset
+/// MEMORY_CONFIGURATION.Ch0TxDqsOffset
+/// MEMORY_CONFIGURATION.Ch0VrefOffset
+/// MEMORY_CONFIGURATION.Ch1RcvEnOffset
+/// MEMORY_CONFIGURATION.Ch1RxDqsOffset
+/// MEMORY_CONFIGURATION.Ch1TxDqOffset
+/// MEMORY_CONFIGURATION.Ch1TxDqsOffset
+/// MEMORY_CONFIGURATION.Ch1VrefOffset
+/// MEMORY_CONFIGURATION.MCREGOFFSET
+///
+#define SA_PLATFORM_POLICY_PPI_REVISION_14 14
+///
+/// Revision 15: Added: MEMORY_CONFIGURATION.RMC
+///
+#define SA_PLATFORM_POLICY_PPI_REVISION_15 15
+
+#ifndef SA_MC_MAX_SOCKETS
+#define SA_MC_MAX_SOCKETS 4
+#endif
+
+#define S3_TIMING_DATA_LEN 9
+#define S3_READ_TRAINING_DATA_LEN 16
+#define S3_WRITE_TRAINING_DATA_LEN 12
+#define SAVE_PRESET_SEARCH_DATA_LEN 3
+
+#ifndef S3_RESTORE_DATA_LEN
+#define S3_RESTORE_DATA_LEN (S3_TIMING_DATA_LEN + S3_READ_TRAINING_DATA_LEN + S3_WRITE_TRAINING_DATA_LEN)
+#endif // S3_RESTORE_DATA_LEN
+
+#pragma pack(1)
+///
+/// SA Platform Data Structure
+///
+typedef struct {
+ UINT8 SpdAddressTable[SA_MC_MAX_SOCKETS];///< Memory DIMMs' SPD address for reading SPD data
+ UINT32 MchBar; ///< Address of System Agent MCHBAR
+ UINT32 DmiBar; ///< Address of System Agent DMIBAR
+ UINT32 EpBar; ///< Address of System Agent EPBAR
+ UINT32 PciExpressBar; ///< Address of System Agent PCI EXPRESS BAR
+ UINT32 SmbusBar; ///< Address of System Agent SMBUS BAR
+ UINT32 GdxcBar; ///< Address of System Agent GDXCBAR
+ UINT32 TsegSize; ///< Size of TSEG in bytes
+ UINT8 UserBd; ///< Mobile - 0; Desktop/UpServer - 1
+ UINT8 FastBoot; ///< FastBoot option: enable or disable MRC FastBoot feature
+ UINT32 EdramBar; ///< Address of System Agent EDRAMBAR. Default of 0xfed80000
+ UINT16 BoardId; ///< Platform Board ID
+ UINT8 SgMode; ///< SgMode (0=Disabled, 1=SG Muxed, 2=SG Muxless, 3=PEG)
+ UINT16 SgSubSystemId; ///< Switchable Graphics Subsystem ID
+ UINT32 IedSize; ///< Size of IED region in bytes
+//AMI_OVERRIDE >>
+ UINT8 PXFixedDynamicMode;
+//AMI_OVERRIDE <<
+} SA_PLATFORM_DATA;
+
+///
+/// GT Configuration
+///
+typedef struct {
+ UINT16 MmioSize; ///< Reserved MMIO space for Graphics
+ UINT16 GttSize; ///< Gtt Memory size of IGD
+ UINT8 IgdDvmt50PreAlloc; ///< Pre-allocated memory for IGD
+ UINT8 InternalGraphics; ///< Control for enabling/disabling iGfx device
+ UINT8 PrimaryDisplay; ///< Selection of the primary display device (iGFX, External PCIe or PCI Graphics)
+ UINT8 ApertureSize; ///< Graphics aperture size
+ UINT32 GttMmAdr; ///< Address of System Agent GTTMMADR
+ UINT8 PanelPowerEnable; ///< Control for enabling/disabling VDD force bit (Required only for early enabling of eDP panel)
+} GT_CONFIGURATION;
+
+///
+/// SA_SPD
+///
+typedef enum {
+ Default, ///< 0, Default SPD
+ UserDefined, ///< 1, User Defined profile
+ XMPProfile1, ///< 2, XMP Profile 1
+ XMPProfile2 ///< 3, XMP Profile 2
+} SA_SPD;
+
+///
+/// Memory Configuration
+///
+typedef struct {
+ UINT8 EccSupport; ///< Ecc Support option - for Desktop only
+ UINT16 DdrFreqLimit; ///< Memory Frequency setting
+ UINT8 MaxTolud; ///< Maximum top of memory size below 4G
+ SA_SPD SpdProfileSelected; ///< SPD XMP profile selection - for XMP supported DIMM
+ UINT16 tCL; ///< User defined Memory Timing tCL value, it's valid when SpdProfileSelected is CUSTOM_PROFILE
+ UINT16 tRCD; ///< User defined Memory Timing tRCD value, it's valid when SpdProfileSelected is CUSTOM_PROFILE
+ UINT16 tRP; ///< User defined Memory Timing tRP value, it's valid when SpdProfileSelected is CUSTOM_PROFILE
+ UINT16 tRAS; ///< User defined Memory Timing tRAS value, it's valid when SpdProfileSelected is CUSTOM_PROFILE
+ UINT8 NModeSupport; ///< Memory N Mode Support - Enable user to select Auto, 1N or 2N
+ UINT8 ScramblerSupport; ///< Memory scrambler support
+ UINT16 tWR; ///< User defined Memory Timing tWR value, it's valid when SpdProfileSelected is CUSTOM_PROFILE
+ UINT16 tRFC; ///< User defined Memory Timing tRFC value, it's valid when SpdProfileSelected is CUSTOM_PROFILE
+ UINT16 tRRD; ///< User defined Memory Timing tRRD value, it's valid when SpdProfileSelected is CUSTOM_PROFILE
+ UINT16 tWTR; ///< User defined Memory Timing tWTR value, it's valid when SpdProfileSelected is CUSTOM_PROFILE
+ UINT16 tRTP; ///< User defined Memory Timing tRP value, it's valid when SpdProfileSelected is CUSTOM_PROFILE
+ UINT16 tRC; ///< User defined Memory Timing tRC value, it's valid when SpdProfileSelected is CUSTOM_PROFILE
+ UINT16 tFAW; ///< User defined Memory Timing tFAW value, it's valid when SpdProfileSelected is CUSTOM_PROFILE
+ UINT16 tCWL; ///< User defined Memory Timing tCWL value, it's valid when SpdProfileSelected is CUSTOM_PROFILE
+ UINT16 tREFI; ///< User defined Memory Timing tREFI value, it's valid when SpdProfileSelected is CUSTOM_PROFILE
+ //
+ // Thermal Management
+ //
+ UINT8 ThermalManagement; ///< Memory Thermal Management Support - Enable/Disable
+ UINT8 PeciInjectedTemp; ///< Enable/Disable memory temperatures to be injected to the processor via PECI
+ UINT8 ExttsViaTsOnBoard; ///< Enable/Disable routing TS-on-Board's ALERT# and THERM# to EXTTS# pins on the PCH
+ UINT8 ExttsViaTsOnDimm; ///< Enable/Disable routing TS-on-DIMM's ALERT# to EXTTS# pin on the PCH
+ UINT8 VirtualTempSensor; ///< Enable/Disable Virtual Temperature Sensor (VTS)
+ BOOLEAN ForceColdReset; ///< @deprecated since revision 3
+ ///
+ /// Disables a DIMM slot in the channel even if a DIMM is present. Array index represents
+ /// the channel number (0 = channel 0, 1 = channel 1). 0x0 = DIMM 0 and DIMM 1 enabled.
+ ///
+ /// 0x1 = DIMM 0 disabled, DIMM 1 enabled.
+ /// 0x2 = DIMM 0 enabled, DIMM 1 disabled.
+ /// 0x3 = DIMM 0 and DIMM 1 disabled (will disable the whole channel)
+ ///
+ UINT8 DisableDimmChannel[SA_MC_MAX_CHANNELS];
+ BOOLEAN RemapEnable; ///< This option is used to control whether to enable/disable memory remap above 4GB
+ ///
+ /// Sets the serial debug message level.
+ /// 0x00 = Disabled
+ /// 0x01 = Errors only.
+ /// 0x02 = Errors and Warnings
+ /// 0x03 = Errors, Warnings, and Info
+ /// 0x04 = Errors, Warnings, Info, and Events
+ /// 0x05 = Displays Memory Init Execution Time Summary only.
+ ///
+ UINT8 SerialDebug;
+
+ UINT8 McLock; ///< Enable/Disable memory configuration register locking.
+ UINT8 GdxcEnable; ///< Enable/Disable GDXC debug support feature.
+ UINT8 GdxcIotSize; ///< GDXC IOT Size in 8MB granularity
+ UINT8 GdxcMotSize; ///< GDXC MOT Size in 8MB granularity
+ //
+ // Training Algorithms
+ //
+ UINT8 ECT; ///< Enable/Disable Early Command Training. Note it is not recommended to change this setting from the default value
+ UINT8 SOT; ///< Enable/Disable Sense Amp Offset Training. Note it is not recommended to change this setting from the default value
+ UINT8 RDMPRT; ///< Enable/Disable Read MPR Training. Note it is not recommended to change this setting from the default value
+ UINT8 RCVET; ///< Enable/Disable Receive Enable Training. Note it is not recommended to change this setting from the default value
+ UINT8 JWRL; ///< Enable/Disable JEDEC Write Leveling Training. Note it is not recommended to change this setting from the default value
+ UINT8 FWRL; ///< Enable/Disable Functional Write Leveling Training. Note it is not recommended to change this setting from the default value
+ UINT8 WRTC1D; ///< Enable/Disable 1D Write Timing Centering Training. Note it is not recommended to change this setting from the default value
+ UINT8 RDTC1D; ///< Enable/Disable 1D Read Timing Centering Training. Note it is not recommended to change this setting from the default value
+ UINT8 DIMMODTT; ///< Enable/Disable DIMM ODT Training. Note it is not recommended to change this setting from the default value
+ UINT8 WRDST; ///< Enable/Disable Write Drive Strength Training. Note it is not recommended to change this setting from the default value
+ UINT8 WREQT; ///< Enable/Disable Write Equalization Training. Note it is not recommended to change this setting from the default value
+ UINT8 WRXTCT; ///< @deprecated since revision 6
+ UINT8 RDODTT; ///< Enable/Disable Read ODT Training. Note it is not recommended to change this setting from the default value
+ UINT8 RDEQT; ///< Enable/Disable Read Equalization Training. Note it is not recommended to change this setting from the default value
+ UINT8 RDAPT; ///< Enable/Disable Read Amplifier Power Training. Note it is not recommended to change this setting from the default value
+ UINT8 WRTC2D; ///< Enable/Disable 2D Write Timing Centering Training. Note it is not recommended to change this setting from the default value
+ UINT8 RDTC2D; ///< Enable/Disable 2D Read Timing Centering Training. Note it is not recommended to change this setting from the default value
+ UINT8 WRVC2D; ///< Enable/Disable 2D Write Voltage Centering Training. Note it is not recommended to change this setting from the default value
+ UINT8 RDVC2D; ///< Enable/Disable 2D Read Voltage Centering Training. Note it is not recommended to change this setting from the default value
+ UINT8 B2BXTT; ///< @deprecated since revision 7
+ UINT8 C2CXTT; ///< @deprecated since revision 7
+ UINT8 LCT; ///< Enable/Disable Late Command Training. Note it is not recommended to change this setting from the default value
+ UINT8 RTL; ///< Enable/Disable Round Trip Latency function. Note it is not recommended to change this setting from the default value
+ UINT8 TAT; ///< Enable/Disable Turn Around Time function. Note it is not recommended to change this setting from the default value
+ UINT8 RMT; ///< Enable/Disable Rank Margin Tool function
+ UINT8 MEMTST; ///< Enable/Disable Memory Test function
+
+ UINT16 DDR3Voltage; ///< Indicates if platform supports DDR3L DIMMs
+ UINT32 DDR3VoltageWaitTime; ///< Amount of time in microseconds to wait for the DDR3 voltage to change from 1.5V to 1.35V
+
+ BOOLEAN RmtBdatEnable; ///< Enable/Disable creating the BIOS DATA ACPI tables and populating with the RMT data
+ ///
+ /// Selects the DDR base reference clock.
+ /// 0x00 = Auto
+ /// 0x01 = 133MHz
+ /// 0x02 = 100MHz
+ ///
+ UINT8 RefClk;
+ ///
+ /// Selects the ratio to multiply the reference clock by for the DDR frequency.
+ /// 0x00 = Auto
+ /// 0x03 through 0x0A are valid values, all others are invalid.
+ ///
+ UINT8 Ratio;
+ UINT8 MrcTimeMeasure; ///< Enables serial debug level to display the MRC execution times only
+ UINT8 MrcFastBoot; ///< Enables the MRC fast boot path for faster cold boot execution
+ BOOLEAN DqPinsInterleaved; ///< Interleaving mode of DQ/DQS pins for HSW_ULT which depends on board routing
+ UINT8 DIMMODTT1D; ///< DIMM ODT 1D training switch
+ UINT8 WRSRT; ///< Write Slew Rate traning switch
+ UINT8 DIMMRONT; ///< DIMM RON training switch
+ BOOLEAN MrcUltPoSafeConfig; ///< MRC ULT PO Safe Mode
+ UINT8 CMDVC; ///< Command Vref Centering
+ UINT8 PowerDownMode; ///< REVISION_4 - Power Down Mode
+ UINT8 PwdwnIdleCounter; ///< REVISION_4 - Power Down Mode Idle Counter
+ UINT8 RankInterleave; ///< REVISION_4 - Rank Interleave Mode
+ UINT8 EnhancedInterleave; ///< REVISION_4 - Enhanced Interleave Mode
+ UINT8 WeaklockEn; ///< REVISION_4 - Weak Lock Enable
+ UINT8 EnCmdRate; ///< REVISION_4 - CMD Rate Enable
+ UINT8 CmdTriStateDis; ///< REVISION_4 - CMD Tri-State Disable
+ UINT32 BClkFrequency; ///< REVISION_5 - Base reference clock value, in Hertz.
+ UINT16 tRPab; ///< REVISION_6 - User defined Memory Timing tRPab value, it's valid when SpdProfileSelected is CUSTOM_PROFILE
+ UINT8 ALIASCHK; ///< REVISION_6 - DIMM SPD Alias Check Switch
+ UINT8 MemoryTrace; ///< REVISION_7 - Memory Trace to second DDR channel using Stacked Mode
+ BOOLEAN RefreshRate2x; ///< REVISION_9 - 2x Refresh Rate Enable
+ UINT8 ChHashEnable; ///< REVISION_9 - Channel Hash Enable
+ UINT16 ChHashMask; ///< REVISION_9 - Channel Hash Mask
+ UINT8 ChHashInterleaveBit; ///< REVISION_9 - Channel Hash Enable
+ UINT8 EnableExtts; ///< REVISION_10 - Enable Extts
+ UINT8 EnableCltm; ///< REVISION_10 - Enable Closed Loop Thermal Management
+ UINT8 EnableOltm; ///< REVISION_10 - Enable Open Loop Thermal Management
+ UINT8 EnablePwrDn; ///< REVISION_10 - Enable Power Down
+ UINT8 EnablePwrDnLpddr; ///< REVISION_10 - Enable Power Down for LPDDR
+ UINT8 Refresh2X; ///< REVISION_10 - Refresh 2x
+ UINT8 LpddrThermalSensor; ///< REVISION_10 - Lpddr Thermal Sensore
+ UINT8 LockPTMregs; ///< REVISION_10 - Lock PCU Thermal Management registers
+ UINT8 UserPowerWeightsEn; ///< REVISION_10 - Allows user to explicitly set power weight, scale factor, and channel power floor values
+ UINT8 EnergyScaleFact; ///< REVISION_10 - Energy Scale Factor
+ UINT8 RaplPwrFlCh1; ///< REVISION_10 - Power Channel 1 Floor value
+ UINT8 RaplPwrFlCh0; ///< REVISION_10 - Power Channel 0 Floor value
+ UINT8 RaplLim2Lock; ///< REVISION_10 - Lock DDR_RAPL_LIMIT register
+ UINT8 RaplLim2WindX; ///< REVISION_10 - Power Limit 2 Time Window X value
+ UINT8 RaplLim2WindY; ///< REVISION_10 - Power Limit 2 Time Window Y value
+ UINT8 RaplLim2Ena; ///< REVISION_10 - Enable Power Limit 2
+ UINT16 RaplLim2Pwr; ///< REVISION_10 - Power Limit 2
+ UINT8 RaplLim1WindX; ///< REVISION_10 - Power Limit 1 Time Window X value
+ UINT8 RaplLim1WindY; ///< REVISION_10 - Power Limit 1 Time Window Y value
+ UINT8 RaplLim1Ena; ///< REVISION_10 - Enable Power Limit 1
+ UINT16 RaplLim1Pwr; ///< REVISION_10 - Power Limit 1
+ UINT8 WarmThresholdCh0Dimm0; ///< REVISION_10 - Warm Threshold (Channel 0, Dimm 0)
+ UINT8 WarmThresholdCh0Dimm1; ///< REVISION_10 - Warm Threshold (Channel 0, Dimm 1)
+ UINT8 WarmThresholdCh1Dimm0; ///< REVISION_10 - Warm Threshold (Channel 1, Dimm 0)
+ UINT8 WarmThresholdCh1Dimm1; ///< REVISION_10 - Warm Threshold (Channel 1, Dimm 1)
+ UINT8 HotThresholdCh0Dimm0; ///< REVISION_10 - Hot Threshold (Channel 0, Dimm 0)
+ UINT8 HotThresholdCh0Dimm1; ///< REVISION_10 - Hot Threshold (Channel 0, Dimm 1)
+ UINT8 HotThresholdCh1Dimm0; ///< REVISION_10 - Hot Threshold (Channel 1, Dimm 0)
+ UINT8 HotThresholdCh1Dimm1; ///< REVISION_10 - Hot Threshold (Channel 1, Dimm 1)
+ UINT8 WarmBudgetCh0Dimm0; ///< REVISION_10 - Warm Budget (Channel 0, Dimm 0)
+ UINT8 WarmBudgetCh0Dimm1; ///< REVISION_10 - Warm Budget (Channel 0, Dimm 1)
+ UINT8 WarmBudgetCh1Dimm0; ///< REVISION_10 - Warm Budget (Channel 1, Dimm 0)
+ UINT8 WarmBudgetCh1Dimm1; ///< REVISION_10 - Warm Budget (Channel 1, Dimm 1)
+ UINT8 HotBudgetCh0Dimm0; ///< REVISION_10 - Hot Budget (Channel 0, Dimm 0)
+ UINT8 HotBudgetCh0Dimm1; ///< REVISION_10 - Hot Budget (Channel 0, Dimm 1)
+ UINT8 HotBudgetCh1Dimm0; ///< REVISION_10 - Hot Budget (Channel 1, Dimm 0)
+ UINT8 HotBudgetCh1Dimm1; ///< REVISION_10 - Hot Budget (Channel 1, Dimm 1)
+ UINT8 IdleEnergyCh0Dimm1; ///< REVISION_10 - Idle Energy (Channel 0, Dimm 1)
+ UINT8 IdleEnergyCh0Dimm0; ///< REVISION_10 - Idle Energy (Channel 0, Dimm 0)
+ UINT8 PdEnergyCh0Dimm1; ///< REVISION_10 - Power Down Energy (Channel 0, Dimm 1)
+ UINT8 PdEnergyCh0Dimm0; ///< REVISION_10 - Power Down Energy (Channel 0, Dimm 0)
+ UINT8 ActEnergyCh0Dimm1; ///< REVISION_10 - Activation Energy (Channel 0, Dimm 1)
+ UINT8 ActEnergyCh0Dimm0; ///< REVISION_10 - Activation Energy (Channel 0, Dimm 0)
+ UINT8 RdEnergyCh0Dimm1; ///< REVISION_10 - Read Energy (Channel 0, Dimm 1)
+ UINT8 RdEnergyCh0Dimm0; ///< REVISION_10 - Read Energy (Channel 0, Dimm 0)
+ UINT8 WrEnergyCh0Dimm1; ///< REVISION_10 - Write Energy (Channel 0, Dimm 1)
+ UINT8 WrEnergyCh0Dimm0; ///< REVISION_10 - Write Energy (Channel 0, Dimm 0)
+ UINT8 IdleEnergyCh1Dimm1; ///< REVISION_10 - Idle Energy (Channel 1, Dimm 1)
+ UINT8 IdleEnergyCh1Dimm0; ///< REVISION_10 - Idle Energy (Channel 1, Dimm 0)
+ UINT8 PdEnergyCh1Dimm1; ///< REVISION_10 - Power Down Energy (Channel 1, Dimm 1)
+ UINT8 PdEnergyCh1Dimm0; ///< REVISION_10 - Power Down Energy (Channel 1, Dimm 0)
+ UINT8 ActEnergyCh1Dimm1; ///< REVISION_10 - Activation Energy (Channel 1, Dimm 1)
+ UINT8 ActEnergyCh1Dimm0; ///< REVISION_10 - Activation Energy (Channel 1, Dimm 0)
+ UINT8 RdEnergyCh1Dimm1; ///< REVISION_10 - Read Energy (Channel 1, Dimm 1)
+ UINT8 RdEnergyCh1Dimm0; ///< REVISION_10 - Read Energy (Channel 1, Dimm 0)
+ UINT8 WrEnergyCh1Dimm1; ///< REVISION_10 - Write Energy (Channel 1, Dimm 1)
+ UINT8 WrEnergyCh1Dimm0; ///< REVISION_10 - Write Energy (Channel 1, Dimm 0)
+ UINT8 SrefCfgEna; ///< REVISION_10 - Enable Self Refresh
+ UINT16 SrefCfgIdleTmr; ///< REVISION_10 - Self Refresh idle timer
+ UINT8 ThrtCkeMinDefeat; ///< REVISION_10 - Throttler CKE min defeature
+ UINT8 ThrtCkeMinTmr; ///< REVISION_10 - Throttler CKE min timer
+ UINT8 ThrtCkeMinDefeatLpddr; ///< REVISION_10 - Throttler CKE min defeature for LPDDR
+ UINT8 ThrtCkeMinTmrLpddr; ///< REVISION_10 - Throttler CKE min timer for LPDDR
+ UINT8 CAVrefCtlOffset; ///< @deprecated since revision 14
+ UINT8 Ch0VrefCtlOffset; ///< @deprecated since revision 14
+ UINT8 Ch1VrefCtlOffset; ///< @deprecated since revision 14
+ UINT8 Ch0ClkPiCodeOffset; ///< @deprecated since revision 14
+ UINT8 Ch1ClkPiCodeOffset; ///< @deprecated since revision 14
+ UINT8 Ch0RcvEnOffset; ///< @deprecated since revision 14
+ UINT8 Ch0RxDqsOffset; ///< @deprecated since revision 14
+ UINT8 Ch0TxDqOffset; ///< @deprecated since revision 14
+ UINT8 Ch0TxDqsOffset; ///< @deprecated since revision 14
+ UINT8 Ch0VrefOffset; ///< @deprecated since revision 14
+ UINT8 Ch1RcvEnOffset; ///< @deprecated since revision 14
+ UINT8 Ch1RxDqsOffset; ///< @deprecated since revision 14
+ UINT8 Ch1TxDqOffset; ///< @deprecated since revision 14
+ UINT8 Ch1TxDqsOffset; ///< @deprecated since revision 14
+ UINT8 Ch1VrefOffset; ///< @deprecated since revision 14
+ BOOLEAN AutoSelfRefreshSupport;///< REVISION_11 - FALSE = No auto self refresh support, TRUE = auto self refresh support.
+ BOOLEAN ExtTemperatureSupport; ///< REVISION_11 - FALSE = No extended temperature support, TRUE = extended temperature support.
+ UINT8 MaxRttWr; ///< REVISION_11 - Maximum DIMM RTT_WR to use in power training 0 = Off, 1 = 120 ohms
+ UINT8 RCVENC1D; ///< REVISION_12 - Receive Enable Centering Training. LPDDR Only.
+ UINT8 MCREGOFFSET; ///< @deprecated since revision 14
+ UINT8 RMC; ///< REVISION_15 - Retrain Margin Check Enable/Disable
+} MEMORY_CONFIGURATION;
+
+typedef struct {
+ UINTN CpuId;
+ UINTN CapIda;
+ UINTN CapIdb;
+ UINT16 Peg0VenId;
+ UINT16 Peg0DevId;
+ UINT16 Peg1VenId;
+ UINT16 Peg1DevId;
+ UINT16 Peg2VenId;
+ UINT16 Peg2DevId;
+} PRESET_SEARCH_SIGNATURE;
+
+///
+/// SA GPIO Data Structure
+///
+typedef struct {
+ UINT8 Value; ///< GPIO Value
+ BOOLEAN Active; ///< 0=Active Low; 1=Active High
+} SA_GPIO_INFO;
+
+///
+/// SA Board PEG GPIO Info
+///
+typedef struct {
+ BOOLEAN GpioSupport; ///< 1=Supported; 0=Not Supported
+ SA_GPIO_INFO *SaPegReset; ///< PEG PERST# GPIO assigned
+} PEG_GPIO_DATA;
+
+///
+/// Information for PCI Express controller configuration and DMI VC enable/disable control
+///
+typedef struct {
+ UINT8 DmiVc1; ///< DMI Virtual channel 1 control (enable or disable)
+ UINT8 DmiVcp; ///< DMI Virtual channel P control (enable or disable)
+ UINT8 DmiVcm; ///< DMI Virtual channel M control (enable or disable)
+ UINT8 DmiGen2; ///< DMI Gen2 support control (enable or disable)
+ UINT8 AlwaysEnablePeg; ///< Force PEG controllers to always be enabled
+ UINT8 PegGenx[SA_PEG_MAX_FUN]; ///< PEG Port PCIE GenX control (Gen1, Gen2 or Gen3)
+ UINT8 PegGen3Equalization; ///< Enable PEG Gen3 static Presets programming. 0=Disable and 1=Enable (Default)
+ UINT8 Gen3RootPortPreset[SA_PEG_MAX_LANE]; ///< Used for programming PEG Gen3 preset values per lane. Range: 0 to 9, 8 is default for each lane
+ UINT8 Gen3EndPointPreset[SA_PEG_MAX_LANE]; ///< Used for programming PEG Gen3 preset values per lane. Range: 0 to 9, 7 is default for each lane
+ UINT8 Gen3EndPointHint[SA_PEG_MAX_LANE]; ///< Hint value per lane for GEN3 end point device. Range: 0 to 6, 2 is default for each lane
+ UINT8 PegSamplerCalibrate; ///< Enable/Disable PEG Sampler Calibration. 0=Disable (Default) and 1=Enable
+ UINT8 PegGen3EqualizationPhase2; ///< @deprecated since revision 6
+ ///
+ /// Note: An attack on the PresetSearch policies could result in an apparent hang,
+ /// but the system will eventually boot. These variables should be protected.
+ ///
+ UINT8 PegGen3PresetSearch; ///< Enable/Disable PEG Gen3 Preset Search algorithm which improves GEN3 link quality. 0=Disable and 1=Enable (Default)
+ UINT16 PegGen3PresetSearchDwellTime; ///< Used for PEG Gen3 Preset Search algorithm. Range: 0 to 65535, default is 1000
+ UINT8 PegGen3PresetSearchMarginSteps; ///< @deprecated since revision 3
+ UINT8 PegGen3PresetSearchStartMargin; ///< Used for PEG Gen3 Preset Search algorithm. Range: 4 to 255, default is 15
+ UINT8 PegSwingControl; ///< Used for PEG Swing Control in PCIe Recipe steps. 1=Half and 2=Full (Default)
+ UINT8 PegGen3PresetSearchVoltageMarginSteps; ///< @deprecated since revision 3
+ UINT8 PegGen3PresetSearchVoltageStartMargin; ///< The starting value for the Gen3 preset search voltage backward margin search. Range: 4 to 255, default is 20
+ UINT8 PegGen3PresetSearchFavorTiming; ///< @deprecated since revision 3
+ ///
+ /// This is a memory data pointer for saved preset search results. The reference code will store
+ /// the Gen3 Preset Search results in the SaDataHob's PegData structure. In order to skip the Gen3
+ /// preset search on boots where the PEG card configuration has not changed since the previous boot,
+ /// platform code can save the contents of the SaDataHob's PegData structure in DXE and provide a
+ /// pointer to a restored copy of that data. Default value is NULL, which results in a full
+ /// preset search every boot.
+ ///
+ /// Note: An attack on this policy could prevent the PEG display from working until a boot when
+ /// PegDataPtr is NULL or PegGen3ForcePresetSearch is enabled. The variable used to save the
+ /// preset search results should be protected in a way that it can only be modified by the
+ /// platform manufacturer.
+ ///
+ VOID *PegDataPtr;
+ ///
+ /// When enabled, Gen3 preset search will be executed each boot. Otherwise, it will be skipped
+ /// and the previous Preset value will be re-used in the following boot. 0=Disable (Default)
+ /// and 1=Enable
+ ///
+ BOOLEAN PegGen3ForcePresetSearch;
+ ///
+ /// Set to 1 to do the PCIe ASPM programming after Oprom. This will require one SMM IO Trap handler
+ /// implemented so ensure the build flag "SA_PCIE_ASPM_IN_SMM=1" is defined in compiling parameter.
+ /// Set to 0 to do the PCIe ASPM programming before Oprom. ("SA_PCIE_ASPM_IN_DXE=1" should be
+ /// defined in compiling parameter)
+ ///
+ /// Note: Platform designer may include both SMM and DXE implementation (both build switch defined
+ /// as 1) and provide a setup option to support different scenarios by this policy. It is required
+ /// to have at least one implementation (either DXE or SMM implementation) included and working
+ /// on platform or it may have security concern.
+ ///
+ BOOLEAN InitPcieAspmAfterOprom;
+ ///
+ /// This IO Trap address is required to support PCIe ASPM programming after Oprom. When build switch
+ /// "SA_PCIE_ASPM_IN_SMM=1" defined in compiling parameter this IO Trap address must be provided
+ /// and should not conflict with any other IO address used by platform
+ ///
+ UINT16 SaIotrapSmiAddress;
+ ///
+ /// This is a memory data pointer to PCIe PERST# GPIO information. This structure is required
+ /// for PCIe Gen3 operation. The reference code will use the information in this structure in
+ /// order to reset PCIe Gen3 devices during equalization, if necessary. Refer to the Platform
+ /// Developer's Guide (PDG) for additional details. The default value of NULL is only valid
+ /// for systems without PCIe Gen3 devices connected to the PEG controllers.
+ ///
+ PEG_GPIO_DATA *PegGpioData;
+ UINT16 PegGen3PresetSearchErrorTarget; ///< Used for PEG Gen3 Preset Search algorithm. Range: 0 to 65535, default is 4
+ BOOLEAN RxCEMLoopback; ///< Enable/Disable RxCEMLoopback Test Mode. 0=Disable (default) and 1=Enable
+ UINT8 RxCEMLoopbackLane; ///< When RxCEMLoopback Test Mode enabled, a lane (0 ~ 15) has to be specified by this policy. Default is lane0 (0)
+ ///
+ /// PCIe Gen3 RxCTLEp per-Bundle control support. The range of the setting is (0~15). This setting
+ /// has to be specified based upon platform design and must follow the guideline. Default is 12.
+ ///
+ UINT8 Gen3RxCtleP[SA_PEG_MAX_BUNDLE];
+ ///
+ /// PCIe power down unused bundles support. It has 3 policies.
+ /// Disabled (0x0) : No power saving.
+ /// Auto (0xFF) : Bios will decide unused bundles to power down [if the controller max-linkwidth is greater than the endpoint max-linkwidth
+ /// then bios will calculate the unused bundles to power down].
+ /// 1-n bundles (0x1-n): Number of bundles to power down via user selection [n depends on HW configuration].
+ ///
+ UINT8 PowerDownUnusedBundles[SA_PEG_MAX_FUN];
+ ///
+ /// PCIe compliance testing mode. Set this bit to when running a PCIe compliance test. Leave disabled during normal operation.
+ /// - Disabled (0x0) : Normal Operation - Disable PCIe compliance testing
+ /// - Enabled (0x1) : PCIe Compliance Test Mode - PEG controller is in compliance testing mode, should only be set when doing PCIe compliance testing
+ /// @since Added in revision 11
+ UINT8 PegComplianceTestingMode;
+} PCIE_CONFIGURATION;
+
+///
+/// Defines the overclocking configuration parameters for System Agent.
+///
+typedef struct {
+ INT16 GtVoltageOffset; ///< The voltage offset applied to GT. Valid range from -1000mv to 1000mv
+ UINT16 GtVoltageOverride; ///< The GT voltage override which is applied to the entire range of GT frequencies
+ UINT16 GtExtraTurboVoltage; ///< The adaptive voltage applied during turbo frequencies. Valid range from 0 to 2000mV
+ UINT16 GtMaxOcTurboRatio; ///< Maximum GT turbo ratio override
+ INT16 SaVoltageOffset; ///< The voltage offset applied to the SA. Valid range from -1000mv to 1000mv
+ UINT8 GtVoltageMode; ///< Specifies whether GT voltage is operating in Adaptive or Override mode - 0: Adaptive, 1: Override
+ UINT8 OcSupport; ///< Enable disable of SA overclocking mailbox commands
+ INT16 IoaVoltageOffset; ///< The voltage offset applied to the IOA domain. Valid Range -1000mv to 1000mv
+ INT16 IodVoltageOffset; ///< The voltage offset applied to the IOD domain. Valid Range -1000mv to 1000mv
+} OVERCLOCKING_CONFIGURATION;
+
+///
+/// Defines the Switchable Graphics configuration parameters for System Agent.
+///
+typedef struct {
+ BOOLEAN GpioSupport; ///< 1=Supported; 0=Not Supported
+ SA_GPIO_INFO *SgDgpuPwrOK; ///< This field contain dGPU PWROK GPIO value and Level information
+ SA_GPIO_INFO *SgDgpuHoldRst; ///< This field contain dGPU HLD RESET GPIO value and level information
+ SA_GPIO_INFO *SgDgpuPwrEnable; ///< This field contain dGPU_PWR Enable GPIO value and level information
+ SA_GPIO_INFO *SgDgpuPrsnt; ///< This field contain dGPU_PRSNT# GPIO value and level information
+} SG_GPIO_DATA;
+
+///
+/// SA Platform Policy PPI
+///
+/// Note: User must initialize the policy "UserBd" based on the customer platform
+/// (Mobile - 0; Desktop/UpServer - 1) in customer BIOS before executing MRC. This policy
+/// isn't initialized in the Sample Code.
+///
+typedef struct _SA_PLATFORM_POLICY_PPI {
+ ///
+ /// This field specifies the revision of the PPI. The PPI is expected to change in a
+ /// backwards compatible manner as the chipset configuration options are added or removed.
+ /// Major changes will result in new PPI definitions/GUID. The PPI producer must update this
+ /// field at build time.
+ ///
+ /// Please ensure to use SA_PLATFORM_POLICY_PPI_REVISION macro to define the protocol revision
+ /// as input for this version
+ ///
+ UINT8 Revision;
+ SA_PLATFORM_DATA *PlatformData; ///< Platform specific data
+ GT_CONFIGURATION *GtConfig; ///< Contains the information for Graphic configurations
+ MEMORY_CONFIGURATION *MemConfig; ///< Contains the information for Memory configurations
+ PCIE_CONFIGURATION *PcieConfig; ///< Contains the information for PCI Express controller configurations
+ OVERCLOCKING_CONFIGURATION *OcConfig; ///< Contains the information for Overclocking configurations
+ VOID *S3DataPtr; ///< Memory data save pointer for S3 resume. The memory space should be allocated and filled with proper S3 resume data on a resume path
+ UINT8 ScramblerSeedCmosLocation; ///< @deprecated since revision 2
+ SG_GPIO_DATA *SgGpioData; ///< Switchable Graphics GPIO data (REVISION_3)
+} SA_PLATFORM_POLICY_PPI;
+
+#pragma pack()
+
+#endif // _SA_PLATFORM_POLICY_PPI_H_
diff --git a/ReferenceCode/Chipset/SystemAgent/Ppi/SaPpiLib.cif b/ReferenceCode/Chipset/SystemAgent/Ppi/SaPpiLib.cif
new file mode 100644
index 0000000..5a7ad60
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Ppi/SaPpiLib.cif
@@ -0,0 +1,16 @@
+<component>
+ name = "SaPpiLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\SystemAgent\Ppi\"
+ RefName = "SaPpiLib"
+[files]
+"SaPpiLib.sdl"
+"SaPpiLib.mak"
+"IntelSaPpiLib.inf"
+"SsaPeiInit\SsaPeiInit.c"
+"SsaPeiInit\SsaPeiInit.h"
+"SaPlatformPolicy\SaPlatformPolicy.c"
+"SaPlatformPolicy\SaPlatformPolicy.h"
+"SaPeiInit\SaPeiInit.h"
+"SaPeiInit\SaPeiInit.c"
+<endComponent>
diff --git a/ReferenceCode/Chipset/SystemAgent/Ppi/SaPpiLib.mak b/ReferenceCode/Chipset/SystemAgent/Ppi/SaPpiLib.mak
new file mode 100644
index 0000000..bf21b86
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Ppi/SaPpiLib.mak
@@ -0,0 +1,20 @@
+# MAK file for the ModulePart:IntelSaPpiLib
+all : IntelSaPpiLib
+
+$(BUILD_DIR)\IntelSaPpiLib.lib : IntelSaPpiLib
+
+IntelSaPpiLib : $(BUILD_DIR)\SaPpiLib.mak IntelSaPpiLibBin
+
+$(BUILD_DIR)\SaPpiLib.mak : $(INTEL_SA_PPI_LIB_DIR)\$(@B).cif $(INTEL_SA_PPI_LIB_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(INTEL_SA_PPI_LIB_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+IntelSaPpiLib_INCLUDES =\
+ $(EDK_INCLUDES) \
+ $(INTEL_MCH_INCLUDES)
+
+IntelSaPpiLibBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\SaPpiLib.mak all\
+ "MY_INCLUDES=$(IntelSaPpiLib_INCLUDES)" \
+ TYPE=PEI_LIBRARY \
+ LIBRARY_NAME=$(BUILD_DIR)\IntelSaPpiLib.lib \ No newline at end of file
diff --git a/ReferenceCode/Chipset/SystemAgent/Ppi/SaPpiLib.sdl b/ReferenceCode/Chipset/SystemAgent/Ppi/SaPpiLib.sdl
new file mode 100644
index 0000000..d2d8eaa
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Ppi/SaPpiLib.sdl
@@ -0,0 +1,42 @@
+TOKEN
+ Name = SaPpiLib_SUPPORT
+ Value = 1
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable SaPpiLib support in Project"
+End
+
+MODULE
+ Help = "Includes SaPpiLib.mak to Project"
+ File = "SaPpiLib.mak"
+End
+
+ELINK
+ Name = "INTEL_SA_PPI_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\IntelSaPpiLib.lib"
+ Parent = "INTEL_SA_PPI_LIB"
+ InvokeOrder = AfterParent
+End
+
+PATH
+ Name = "INTEL_SA_PPI_LIB_DIR"
+End
+
+ELINK
+ Name = "/I$(INTEL_SA_PPI_LIB_DIR)"
+ Parent = "INTEL_MCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(INTEL_SA_PPI_LIB_DIR)\SsaPeiInit"
+ Parent = "INTEL_MCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
diff --git a/ReferenceCode/Chipset/SystemAgent/Ppi/SsaPeiInit/SsaPeiInit.c b/ReferenceCode/Chipset/SystemAgent/Ppi/SsaPeiInit/SsaPeiInit.c
new file mode 100644
index 0000000..a7eed72
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Ppi/SsaPeiInit/SsaPeiInit.c
@@ -0,0 +1,47 @@
+/**
+This file contains an 'Intel Peripheral Driver' and uniquely
+identified as "Intel Reference Module" and is
+licensed for Intel CPUs and chipsets under the terms of your
+license agreement with Intel or your vendor. This file may
+be modified by the user, subject to additional terms of the
+license agreement
+
+@copyright
+Copyright (c) 2012 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+@file
+ SsaPeiInit.c
+
+@brief
+ Interface definition between MRC and SsaInitPeim driver.
+**/
+
+///
+/// External include files do NOT need to be explicitly specified in real EDKII
+/// environment
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#endif
+
+#include "SsaPeiInit.h"
+
+///
+/// PPI GUID definition
+///
+EFI_GUID gSsaBiosCallBacksPpiGuid = SSA_BIOS_CALLBACKS_PPI_GUID;
+EFI_GUID gSsaBiosServicesPpiGuid = SSA_BIOS_SERVICES_PPI_GUID;
+
+///
+/// PPI description
+///
+EFI_GUID_STRING (&gSsaBiosCallBacksPpiGuid, "SsaBiosCallback", "SSA Bios Callback PPI");
+EFI_GUID_STRING (&gSsaBiosServicesPpiGuid, "SsaBiosServices", "SSA Bios Services PPI");
+
diff --git a/ReferenceCode/Chipset/SystemAgent/Ppi/SsaPeiInit/SsaPeiInit.h b/ReferenceCode/Chipset/SystemAgent/Ppi/SsaPeiInit/SsaPeiInit.h
new file mode 100644
index 0000000..6a0ab1d
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Ppi/SsaPeiInit/SsaPeiInit.h
@@ -0,0 +1,40 @@
+/**
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+@copyright
+ Copyright (c) 2012 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+@file
+ SsaPeiInit.h
+
+@brief
+ Interface definition between MRC and SsaInitPeim driver.
+**/
+#ifndef _SSA_PEI_INIT_H_
+#define _SSA_PEI_INIT_H_
+
+///
+/// Define the SSA PEI Init PPI GUID
+///
+#define SSA_BIOS_CALLBACKS_PPI_GUID {0x99B56126, 0xE16C, 0x4D9B, 0xBB, 0x71, 0xAA, 0x35, 0x46, 0x1A, 0x70, 0x2F}
+#define SSA_BIOS_SERVICES_PPI_GUID {0x55750D10, 0x6D3D, 0x4BF5, 0x89, 0xD8, 0xE3, 0x5E, 0xF0, 0xB0, 0x90, 0xF4}
+
+///
+/// Extern the GUID for PPI users.
+///
+extern EFI_GUID gSsaBiosCallBacksPpiGuid;
+extern EFI_GUID gSsaBiosServicesPpiGuid;
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/Protocol/BdatAccess/BdatAccess.c b/ReferenceCode/Chipset/SystemAgent/Protocol/BdatAccess/BdatAccess.c
new file mode 100644
index 0000000..ec43597
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Protocol/BdatAccess/BdatAccess.c
@@ -0,0 +1,29 @@
+/** @file
+ Bdat Access Handler Protocol
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#endif
+#include EFI_PROTOCOL_DEFINITION (BdatAccess)
+
+EFI_GUID gBdatAccessGuid = EFI_BDAT_ACCESS_GUID;
+
+EFI_GUID_STRING(&gBdatAccessGuid, "BDAT ACCESS", "BDAT ACCESS");
diff --git a/ReferenceCode/Chipset/SystemAgent/Protocol/BdatAccess/BdatAccess.h b/ReferenceCode/Chipset/SystemAgent/Protocol/BdatAccess/BdatAccess.h
new file mode 100644
index 0000000..1d49638
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Protocol/BdatAccess/BdatAccess.h
@@ -0,0 +1,36 @@
+/** @file
+ This file abstracts Bdat Access Handler Protocol.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+#ifndef _BDAT_ACCESS_PROTOCOL_H_
+#define _BDAT_ACCESS_PROTOCOL_H_
+
+#define EFI_BDAT_ACCESS_GUID \
+ { \
+ 0xb979746a, 0x8c1f, 0x4a2b, 0x97, 0xe4, 0x78, 0xe9, 0x3a, 0x71, 0xa7, 0xa \
+ }
+
+typedef struct _BDAT_ACCESS_PROTOCOL {
+ UINTN bdat;
+} BDAT_ACCESS_PROTOCOL;
+
+extern EFI_GUID gBdatAccessGuid;
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/Protocol/GopComponentName2/GopComponentName2.c b/ReferenceCode/Chipset/SystemAgent/Protocol/GopComponentName2/GopComponentName2.c
new file mode 100644
index 0000000..f430cf3
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Protocol/GopComponentName2/GopComponentName2.c
@@ -0,0 +1,37 @@
+/** @file
+ Protocol to retrieve the GOP driver version
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "Tiano.h"
+
+///
+/// Include the protocol header file
+///
+#include "GopComponentName2.h"
+
+///
+/// Protocol GUID definition
+///
+EFI_GUID gGopComponentName2ProtocolGuid = GOP_COMPONENT_NAME2_PROTOCOL_GUID
+
+///
+/// Protocol description
+///
+EFI_GUID_STRING
+ (&gGopComponentName2ProtocolGuid, "ComponentName2 Protocol", "Intel(R) DXE Phase Gop Component Name 2 Protocol");
diff --git a/ReferenceCode/Chipset/SystemAgent/Protocol/GopComponentName2/GopComponentName2.h b/ReferenceCode/Chipset/SystemAgent/Protocol/GopComponentName2/GopComponentName2.h
new file mode 100644
index 0000000..51ff044
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Protocol/GopComponentName2/GopComponentName2.h
@@ -0,0 +1,72 @@
+/** @file
+ Protocol to retrieve the GOP driver version
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+#ifndef _GOP_COMPONENT_NAME2_H_
+#define _GOP_COMPONENT_NAME2_H_
+//
+// Global ID for the Component Name Protocol
+//
+#define GOP_COMPONENT_NAME2_PROTOCOL_GUID \
+ { \
+ 0x651b7ebd, 0xce13, 0x41d0, 0x82, 0xe5, 0xa0, 0x63, 0xab, 0xbe, 0x9b, 0xb6 \
+ }
+
+EFI_FORWARD_DECLARATION (GOP_COMPONENT_NAME2_PROTOCOL);
+
+
+typedef struct _GOP_COMPONENT_NAME2_PROTOCOL GOP_COMPONENT_NAME2_PROTOCOL;
+
+typedef
+EFI_STATUS
+(EFIAPI *GOP_COMPONENT_NAME2_GET_DRIVER_NAME) (
+ IN GOP_COMPONENT_NAME2_PROTOCOL * This,
+ IN CHAR8 *Language,
+ OUT CHAR16 **DriverName
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *GOP_COMPONENT_NAME2_GET_CONTROLLER_NAME) (
+ IN GOP_COMPONENT_NAME2_PROTOCOL * This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_HANDLE ChildHandle OPTIONAL,
+ IN CHAR8 *Language,
+ OUT CHAR16 **ControllerName
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *GOP_COMPONENT_NAME2_GET_DRIVER_VERSION) (
+ IN GOP_COMPONENT_NAME2_PROTOCOL * This,
+ IN CHAR8 *Language,
+ OUT CHAR16 **DriverVersion
+ );
+
+struct _GOP_COMPONENT_NAME2_PROTOCOL {
+ GOP_COMPONENT_NAME2_GET_DRIVER_NAME GetDriverName;
+ GOP_COMPONENT_NAME2_GET_DRIVER_VERSION GetDriverVersion;
+ GOP_COMPONENT_NAME2_GET_CONTROLLER_NAME GetControllerName;
+ CHAR8 *SupportedLanguages;
+};
+
+extern EFI_GUID gGopComponentName2ProtocolGuid;
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/Protocol/IgdOpRegion/IgdOpRegion.c b/ReferenceCode/Chipset/SystemAgent/Protocol/IgdOpRegion/IgdOpRegion.c
new file mode 100644
index 0000000..596c9f5
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Protocol/IgdOpRegion/IgdOpRegion.c
@@ -0,0 +1,35 @@
+/** @file
+ This file is part of the IGD OpRegion Implementation. The IGD OpRegion is
+ an interface between system BIOS, ASL code, and Graphics drivers. The code
+ in this file will implement a protocol allowing access to the
+ OpRegion from ASL code.
+
+ Supporting Specifiction: IGD OpRegion/Software SCI BIOS SPEC
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "Tiano.h"
+#include "IgdOpRegion.h"
+
+EFI_GUID gIgdOpRegionProtocolGuid = IGD_OPREGION_PROTOCOL_GUID;
+
+EFI_GUID_STRING
+ (
+ &gIgdOpRegionProtocolGuid, "IGD OpRegion/Software SCI",
+ "Communication interface between Graphics drivers, ASL code, and system BIOS"
+ );
diff --git a/ReferenceCode/Chipset/SystemAgent/Protocol/IgdOpRegion/IgdOpRegion.h b/ReferenceCode/Chipset/SystemAgent/Protocol/IgdOpRegion/IgdOpRegion.h
new file mode 100644
index 0000000..c0b5c06
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Protocol/IgdOpRegion/IgdOpRegion.h
@@ -0,0 +1,210 @@
+/** @file
+ This file is part of the IGD OpRegion Implementation. The IGD OpRegion is
+ an interface between system BIOS, ASL code, and Graphics drivers.
+
+ Supporting Specifiction: IGD OpRegion/Software SCI SPEC
+
+ Note: Data structures defined in this protocol are packed not naturally
+ aligned.
+
+ GUID forms:
+ {CDC5DDDF-E79D-41ec-A9B0-6565490DB9D3}
+ (0xcdc5dddf, 0xe79d, 0x41ec, 0xa9, 0xb0, 0x65, 0x65, 0x49, 0xd, 0xb9, 0xd3);
+
+ Acronyms:
+ NVS: ACPI Non Volatile Storage
+ OpRegion: ACPI Operational Region
+ VBT: Video BIOS Table (OEM customizable data)
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _IGD_OPREGION_PROTOCOL_H_
+#define _IGD_OPREGION_PROTOCOL_H_
+
+///
+/// Include files
+///
+#include "Tiano.h"
+
+///
+/// IGD OpRegion protocol GUID
+///
+#define IGD_OPREGION_PROTOCOL_GUID \
+ { \
+ 0xcdc5dddf, 0xe79d, 0x41ec, 0xa9, 0xb0, 0x65, 0x65, 0x49, 0xd, 0xb9, 0xd3 \
+ }
+
+///
+/// Extern the GUID for protocol users.
+///
+extern EFI_GUID gIgdOpRegionProtocolGuid;
+
+///
+/// Forward reference for pure ANSI compatability
+///
+EFI_FORWARD_DECLARATION (IGD_OPREGION_PROTOCOL);
+
+//
+// Protocol data definitions
+//
+///
+/// OpRegion structures:
+/// Sub-structures define the different parts of the OpRegion followed by the
+/// main structure representing the entire OpRegion.
+///
+/// Note: These structures are packed to 1 byte offsets because the exact
+/// data location is requred by the supporting design specification due to
+/// the fact that the data is used by ASL and Graphics driver code compiled
+/// separatly.
+///
+///
+/// OpRegion header (mailbox 0) structure and #defines.
+///
+#pragma pack(1)
+typedef struct {
+ CHAR8 SIGN[0x10]; ///< 0 OpRegion signature
+ UINT32 SIZE; ///< 16 OpRegion size
+ UINT32 OVER; ///< 20 OpRegion structure version
+ UINT8 SVER[0x20]; ///< 24 System BIOS build version
+ UINT8 VVER[0x10]; ///< 56 Video BIOS build version
+ UINT8 GVER[0x10]; ///< 72 Graphic driver build version
+ UINT32 MBOX; ///< 88 Mailboxes supported
+ UINT32 DMOD; ///< 92 Driver Model
+ UINT32 PCON; ///< 96 Platform Capabilities
+ CHAR16 DVER[0x10]; ///< 100 GOP Version
+ UINT8 RHD1[0x7C]; ///< 132 Reserved
+} OPREGION_HEADER;
+#pragma pack()
+///
+/// OpRegion mailbox 1 (public ACPI Methods).
+///
+#pragma pack(1)
+typedef struct {
+ UINT32 DRDY; ///< 0 Driver readiness
+ UINT32 CSTS; ///< 4 Status
+ UINT32 CEVT; ///< 8 Current event
+ UINT8 RM11[0x14]; ///< 12 Reserved
+ UINT32 DIDL; ///< 32 Supported display devices list
+ UINT32 DDL2; ///< 8 Devices.
+ UINT32 DDL3;
+ UINT32 DDL4;
+ UINT32 DDL5;
+ UINT32 DDL6;
+ UINT32 DDL7;
+ UINT32 DDL8;
+ UINT32 CPDL; ///< 64 Currently present display devices list
+ UINT32 CPL2; ///< 8 Devices.
+ UINT32 CPL3;
+ UINT32 CPL4;
+ UINT32 CPL5;
+ UINT32 CPL6;
+ UINT32 CPL7;
+ UINT32 CPL8;
+ UINT32 CADL; ///< 96 Currently active display devices list
+ UINT32 CAL2; ///< 8 Devices.
+ UINT32 CAL3;
+ UINT32 CAL4;
+ UINT32 CAL5;
+ UINT32 CAL6;
+ UINT32 CAL7;
+ UINT32 CAL8;
+ UINT32 NADL; ///< 128 Next active device list
+ UINT32 NDL2; ///< 8 Devices.
+ UINT32 NDL3;
+ UINT32 NDL4;
+ UINT32 NDL5;
+ UINT32 NDL6;
+ UINT32 NDL7;
+ UINT32 NDL8;
+ UINT32 ASLP; ///< 160 ASL sleep timeout
+ UINT32 TIDX; ///< 164 Toggle table index
+ UINT32 CHPD; ///< 168 Current hot plug enable indicator
+ UINT32 CLID; ///< 172 Current lid state indicator
+ UINT32 CDCK; ///< 176 Current docking state indicator
+ UINT32 SXSW; ///< 180 Display Switch notification on Sx State resume
+ UINT32 EVTS; ///< 184 Events supported by ASL
+ UINT32 CNOT; ///< 188 Current OS Notification
+ UINT32 NRDY; ///< 192 Reasons for DRDY = 0
+ UINT8 RM12[0x3C]; ///< 196 Reserved
+} OPREGION_MBOX1;
+#pragma pack()
+///
+/// OpRegion mailbox 2 (Software SCI Interface).
+///
+#pragma pack(1)
+typedef struct {
+ UINT32 SCIC; ///< 0 Software SCI function number parameters
+ UINT32 PARM; ///< 4 Software SCI additional parameters
+ UINT32 DSLP; ///< 8 Driver sleep timeout
+ UINT8 RM21[0xF4]; ///< 12 Reserved
+} OPREGION_MBOX2;
+#pragma pack()
+///
+/// OpRegion mailbox 3 (Power Conservation).
+///
+#pragma pack(1)
+typedef struct {
+ UINT32 ARDY; ///< 0 Driver readiness
+ UINT32 ASLC; ///< 4 ASLE interrupt command / status
+ UINT32 TCHE; ///< 8 Technology enabled indicator
+ UINT32 ALSI; ///< 12 Current ALS illuminance reading
+ UINT32 BCLP; ///< 16 Backlight britness to set
+ UINT32 PFIT; ///< 20 Panel fitting Request
+ UINT32 CBLV; ///< 24 Brightness Current State
+ UINT16 BCLM[0x14]; ///< 28 Backlight Brightness Level Duty Cycle Mapping Table
+ UINT32 CPFM; ///< 68 Panel Fitting Current Mode
+ UINT32 EPFM; ///< 72 Enabled Panel Fitting Modes
+ UINT8 PLUT[0x4A]; ///< 76 Panel Look Up Table
+ UINT32 PFMB; ///< 150 PWM Frequency and Minimum Brightness
+ UINT32 CCDV; ///< 154 Color Correction Default Values
+ UINT32 PCFT; ///< 158 Power Conservation Features
+ UINT32 SROT; ///< 162 Supported Rotation angle
+ UINT32 IUER; ///< 166 Intel Ultrabook Event Register
+ UINT64 FDSP; ///< 170 FFS Display Physical address
+ UINT32 FDSS; ///< 178 FFS Display Size
+ UINT8 RM32[0x4A]; ///< 182 Reserved
+} OPREGION_MBOX3;
+#pragma pack()
+///
+/// OpRegion mailbox 4 (VBT).
+///
+#pragma pack(1)
+typedef struct {
+ UINT8 GVD1[0x1C00]; ///< Reserved
+} OPREGION_VBT;
+#pragma pack()
+///
+/// Entire OpRegion
+///
+#pragma pack(1)
+typedef struct {
+ OPREGION_HEADER Header; ///< OpRegion header
+ OPREGION_MBOX1 MBox1; ///< Mailbox 1: Public ACPI Methods
+ OPREGION_MBOX2 MBox2; ///< Mailbox 2: Software SCI Inteface
+ OPREGION_MBOX3 MBox3; ///< Mailbox 3: Power Conservation
+ OPREGION_VBT VBT; ///< VBT: Video BIOS Table (OEM customizable data)
+} IGD_OPREGION_STRUC;
+#pragma pack()
+///
+/// Protocol data structure definition
+///
+struct _IGD_OPREGION_PROTOCOL {
+ IGD_OPREGION_STRUC *OpRegion;
+};
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/Protocol/IntelSaProtocolLib.inf b/ReferenceCode/Chipset/SystemAgent/Protocol/IntelSaProtocolLib.inf
new file mode 100644
index 0000000..594e48b
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Protocol/IntelSaProtocolLib.inf
@@ -0,0 +1,59 @@
+## @file
+# Component description file for the SA protocol library
+#
+#@copyright
+# Copyright (c) 2010 - 2013 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+
+[defines]
+BASE_NAME = IntelSaProtocolLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ MemInfo/MemInfo.h
+ MemInfo/MemInfo.c
+ IgdOpRegion/IgdOpRegion.h
+ IgdOpRegion/IgdOpRegion.c
+ SaPlatformPolicy/SaPlatformPolicy.h
+ SaPlatformPolicy/SaPlatformPolicy.c
+ SaInfo/SaInfo.h
+ SaInfo/SaInfo.c
+ BdatAccess/BdatAccess.h
+ BdatAccess/BdatAccess.c
+ SaGlobalNvsArea/SaGlobalNvsArea.c
+ SaGlobalNvsArea/SaGlobalNvsArea.h
+ PlatformGopPolicy/PlatformGopPolicy.h
+ PlatformGopPolicy/PlatformGopPolicy.c
+ GopComponentName2/GopComponentName2.h
+ GopComponentName2/GopComponentName2.c
+
+[includes.common]
+ .
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Include
+
+[nmake.common]
+C_STD_INCLUDE=
diff --git a/ReferenceCode/Chipset/SystemAgent/Protocol/MemInfo/MemInfo.c b/ReferenceCode/Chipset/SystemAgent/Protocol/MemInfo/MemInfo.c
new file mode 100644
index 0000000..09e400c
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Protocol/MemInfo/MemInfo.c
@@ -0,0 +1,33 @@
+/** @file
+ This file defines global GUID variables for the MemInfo Protocol
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "Tiano.h"
+#include "MemInfo.h"
+
+///
+/// Protocol GUID definition
+///
+EFI_GUID gMemInfoProtocolGuid = MEM_INFO_PROTOCOL_GUID;
+
+///
+/// Protocol description
+///
+EFI_GUID_STRING
+ (&gMemInfoProtocolGuid, "Memory Information Protocol", "The MemInfo Protocol returns memory information Data.");
diff --git a/ReferenceCode/Chipset/SystemAgent/Protocol/MemInfo/MemInfo.h b/ReferenceCode/Chipset/SystemAgent/Protocol/MemInfo/MemInfo.h
new file mode 100644
index 0000000..6f0c662
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Protocol/MemInfo/MemInfo.h
@@ -0,0 +1,99 @@
+/** @file
+ This protocol provides the memory information data, such as
+ total physical memory size, memory frequency, memory size
+ of each dimm and rank.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _MEM_INFO_PROTOCOL_H_
+#define _MEM_INFO_PROTOCOL_H_
+
+///
+/// Define the protocol GUID
+///
+#define MEM_INFO_PROTOCOL_GUID \
+ { \
+ 0x6f20f7c8, 0xe5ef, 0x4f21, 0x8d, 0x19, 0xed, 0xc5, 0xf0, 0xc4, 0x96, 0xae \
+ }
+
+///
+/// Extern the GUID for protocol users.
+///
+extern EFI_GUID gMemInfoProtocolGuid;
+
+//
+// Forward reference for ANSI C compatibility
+//
+typedef struct _MEM_INFO_PROTOCOL MEM_INFO_PROTOCOL;
+
+//
+// Protocol definitions
+//
+#define NODE_NUM 1
+#define CH_NUM 2
+#define DIMM_NUM 2
+#define RANK_NUM 2
+#define PROFILE_NUM 4 // number of memory profiles supported
+
+#pragma pack(1)
+typedef struct {
+ UINT32 tCK; ///< Memory cycle time, in femtoseconds.
+ UINT16 NMode; ///< Number of tCK cycles for the channel DIMM's command rate mode.
+ UINT16 tCL; ///< Number of tCK cycles for the channel DIMM's CAS latency.
+ UINT16 tCWL; ///< Number of tCK cycles for the channel DIMM's minimum CAS write latency time.
+ UINT16 tFAW; ///< Number of tCK cycles for the channel DIMM's minimum four activate window delay time.
+ UINT16 tRAS; ///< Number of tCK cycles for the channel DIMM's minimum active to precharge delay time.
+ UINT16 tRC; ///< Number of tCK cycles for the channel DIMM's minimum active to active/refresh delay time.
+ UINT16 tRCD; ///< Number of tCK cycles for the channel DIMM's minimum RAS# to CAS# delay time.
+ UINT16 tREFI; ///< Number of tCK cycles for the channel DIMM's minimum Average Periodic Refresh Interval.
+ UINT16 tRFC; ///< Number of tCK cycles for the channel DIMM's minimum refresh recovery delay time.
+ UINT16 tRP; ///< Number of tCK cycles for the channel DIMM's minimum row precharge delay time.
+ UINT16 tRPab; ///< Number of tCK cycles for the channel DIMM's minimum row precharge delay time for all banks.
+ UINT16 tRRD; ///< Number of tCK cycles for the channel DIMM's minimum row active to row active delay time.
+ UINT16 tRTP; ///< Number of tCK cycles for the channel DIMM's minimum internal read to precharge command delay time.
+ UINT16 tWR; ///< Number of tCK cycles for the channel DIMM's minimum write recovery time.
+ UINT16 tWTR; ///< Number of tCK cycles for the channel DIMM's minimum internal write to read command delay time.
+} MEMORY_TIMING;
+
+typedef struct {
+ UINT32 memSize; ///< Total physical memory size
+ UINT16 ddrFreq; ///< DDR Frequency
+ UINT16 ddrFreqMax;
+ UINT8 RefClk;
+ UINT8 Ratio;
+ BOOLEAN EccSupport; ///< ECC Support
+ UINT16 dimmSize[NODE_NUM * CH_NUM * DIMM_NUM]; ///< Dimm Size
+ BOOLEAN DimmExist[NODE_NUM * CH_NUM * DIMM_NUM]; ///< Dimm Present or not
+ UINT8 RankInDimm[NODE_NUM * CH_NUM * DIMM_NUM]; ///< No. of ranks in a dimm
+ UINT8 Reserved[24];
+ UINT8 *DimmsSpdData[NODE_NUM * CH_NUM * DIMM_NUM];
+ UINT16 VddVoltage[PROFILE_NUM];
+ MEMORY_TIMING Timing[PROFILE_NUM];
+ UINT8 Profile; ///< Currently running memory profile
+ UINT8 XmpProfileEnable; ///< 0 = no XMP DIMMs in system
+} MEMORY_INFO_DATA;
+#pragma pack()
+
+///
+/// Protocol definition
+///
+struct _MEM_INFO_PROTOCOL {
+ MEMORY_INFO_DATA MemInfoData;
+};
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/Protocol/PlatformGopPolicy/PlatformGopPolicy.c b/ReferenceCode/Chipset/SystemAgent/Protocol/PlatformGopPolicy/PlatformGopPolicy.c
new file mode 100644
index 0000000..7fa5b6f
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Protocol/PlatformGopPolicy/PlatformGopPolicy.c
@@ -0,0 +1,36 @@
+/** @file
+ Interface definition for PlatformGopPolicy Protocol.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "Tiano.h"
+
+///
+/// Include the protocol header file
+///
+#include "PlatformGopPolicy.h"
+
+///
+/// Protocol GUID definition
+///
+EFI_GUID gPlatformGopPolicyProtocolGuid = EFI_PLATFORM_GOP_POLICY_PROTOCOL_GUID;
+
+///
+/// Protocol description
+///
+EFI_GUID_STRING(&gPlatformGopPolicyProtocolGuid, "PlatformGopPolicy Protocol", "Intel(R) GOP Platform Policy Protocol");
diff --git a/ReferenceCode/Chipset/SystemAgent/Protocol/PlatformGopPolicy/PlatformGopPolicy.h b/ReferenceCode/Chipset/SystemAgent/Protocol/PlatformGopPolicy/PlatformGopPolicy.h
new file mode 100644
index 0000000..d6c493b
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Protocol/PlatformGopPolicy/PlatformGopPolicy.h
@@ -0,0 +1,58 @@
+/** @file
+ Interface definition for PlatformGopPolicy Protocol.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PLATFORM_GOP_POLICY_PROTOCOL_H_
+#define _PLATFORM_GOP_POLICY_PROTOCOL_H_
+
+#define EFI_PLATFORM_GOP_POLICY_PROTOCOL_GUID \
+ { \
+ 0xec2e931b, 0x3281, 0x48a5, 0x81, 0x7, 0xdf, 0x8a, 0x8b, 0xed, 0x3c, 0x5d \
+ }
+
+#define PLATFORM_GOP_POLICY_PROTOCOL_REVISION_01 0x01
+
+typedef enum {
+ LidClosed,
+ LidOpen,
+ LidStatusMax
+} LID_STATUS;
+
+typedef
+EFI_STATUS
+(EFIAPI *GET_PLATFORM_LID_STATUS) (
+ OUT LID_STATUS * CurrentLidStatus
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *GET_VBT_DATA) (
+ OUT EFI_PHYSICAL_ADDRESS * VbtAddress,
+ OUT UINT32 *VbtSize
+ );
+
+typedef struct _PLATFORM_GOP_POLICY_PROTOCOL {
+ UINT32 Revision;
+ GET_PLATFORM_LID_STATUS GetPlatformLidStatus;
+ GET_VBT_DATA GetVbtData;
+} PLATFORM_GOP_POLICY_PROTOCOL;
+
+extern EFI_GUID gPlatformGopPolicyProtocolGuid;
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/Protocol/SaGlobalNvsArea/SaGlobalNvsArea.c b/ReferenceCode/Chipset/SystemAgent/Protocol/SaGlobalNvsArea/SaGlobalNvsArea.c
new file mode 100644
index 0000000..2f0725d
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Protocol/SaGlobalNvsArea/SaGlobalNvsArea.c
@@ -0,0 +1,31 @@
+/** @file
+ System Agent Global NVS Area description protocol implementation.
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Mobile Silicon Support Module" and is
+ licensed for Intel Mobile CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "EdkIIGlueDxe.h"
+
+#include "SaGlobalNvsArea.h"
+
+EFI_GUID gSaGlobalNvsAreaProtocolGuid = SYSTEM_AGENT_GLOBAL_NVS_AREA_PROTOCOL_GUID;
+
+EFI_GUID_STRING
+ (
+ &gSaGlobalNvsAreaProtocolGuid, "System Agent Global NVS Area Protocol",
+ "Protocol describing System Agent ACPI NVS memory region used by ACPI subsystem."
+ );
diff --git a/ReferenceCode/Chipset/SystemAgent/Protocol/SaGlobalNvsArea/SaGlobalNvsArea.h b/ReferenceCode/Chipset/SystemAgent/Protocol/SaGlobalNvsArea/SaGlobalNvsArea.h
new file mode 100644
index 0000000..bc38e5e
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Protocol/SaGlobalNvsArea/SaGlobalNvsArea.h
@@ -0,0 +1,197 @@
+/** @file
+ Definition of the System Agent global NVS area protocol. This protocol
+ publishes the address and format of a global ACPI NVS buffer used as a communications
+ buffer between SMM/DXE/PEI code and ASL code.
+ @todo The format is derived from the ACPI reference code, version 0.95.
+
+ Note: Data structures defined in this protocol are not naturally aligned.
+
+@copyright
+ Copyright (c) 2012 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _SYSTEM_AGENT_GLOBAL_NVS_AREA_H_
+#define _SYSTEM_AGENT_GLOBAL_NVS_AREA_H_
+
+///
+/// Includes
+///
+///
+/// Forward reference for pure ANSI compatability
+///
+EFI_FORWARD_DECLARATION (SYSTEM_AGENT_GLOBAL_NVS_AREA_PROTOCOL);
+
+///
+/// SA Global NVS Area Protocol GUID
+///
+#define SYSTEM_AGENT_GLOBAL_NVS_AREA_PROTOCOL_GUID \
+ { \
+ 0x5bd3336f, 0x5406, 0x48a0, 0xb8, 0x58, 0xd5, 0x0f, 0x72, 0x1c, 0x83, 0x57 \
+ }
+
+///
+/// Extern the GUID for protocol users.
+///
+extern EFI_GUID gSaGlobalNvsAreaProtocolGuid;
+
+///
+/// Global NVS Area definition
+///
+#pragma pack(1)
+typedef struct {
+ UINT32 SaRcRevision; ///< 000 SA RC Revision
+ ///
+ /// IGFX relevant fields
+ ///
+ UINT32 IgdOpRegionAddress; ///< 004 IGD OpRegion Starting Address
+ UINT8 GfxTurboIMON; ///< 008 IMON Current Value
+ UINT8 IgdState; ///< 009 IGD State (Primary Display = 1)
+ UINT8 CurrentDeviceList; ///< 010 Current Attached Device List
+ UINT8 PreviousDeviceList; ///< 011 Previous Attached Device List
+ UINT16 CurrentDisplayState; ///< 012 Current Display State
+ UINT16 NextDisplayState; ///< 014 Next Display State
+ UINT32 DeviceId9; ///< 016 Device ID 9
+ UINT32 DeviceId10; ///< 020 Device ID 10
+ UINT32 DeviceId11; ///< 024 Device ID 11
+ UINT8 IgdBootType; ///< 028 IGD Boot Type CMOS option
+ UINT8 IgdPanelType; ///< 029 IGD Panel Type CMOs option
+ UINT8 IgdPanelScaling; ///< 030 IGD Panel Scaling
+ UINT8 IgdBlcConfig; ///< 031 IGD BLC Configuration
+ UINT8 IgdBiaConfig; ///< 032 IGD BIA Configuration
+ UINT8 IgdSscConfig; ///< 033 IGD SSC Configuration
+ UINT8 IgdPowerConservation; ///< 034 IGD Power Conservation Feature Flag
+ UINT8 IgdDvmtMemSize; ///< 035 IGD DVMT Memory Size
+ UINT8 IgdFunc1Enable; ///< 036 IGD Function 1 Enable
+ UINT8 IgdHpllVco; ///< 037 HPLL VCO
+ UINT32 NextStateDid1; ///< 038 Next state DID1 for _DGS
+ UINT32 NextStateDid2; ///< 042 Next state DID2 for _DGS
+ UINT32 NextStateDid3; ///< 046 Next state DID3 for _DGS
+ UINT32 NextStateDid4; ///< 050 Next state DID4 for _DGS
+ UINT32 NextStateDid5; ///< 054 Next state DID5 for _DGS
+ UINT32 NextStateDid6; ///< 058 Next state DID6 for _DGS
+ UINT32 NextStateDid7; ///< 062 Next state DID7 for _DGS
+ UINT32 NextStateDid8; ///< 066 Next state DID8 for _DGS
+ UINT8 IgdSciSmiMode; ///< 070 GMCH SMI/SCI mode (0=SCI)
+ UINT8 IgdPAVP; ///< 071 IGD PAVP data
+ UINT8 LidState; ///< 072 Open = 1
+ UINT32 AKsv0; ///< 073 First four bytes of AKSV (manufacturing mode)
+ UINT8 AKsv1; ///< 077 Fifth byte of AKSV (manufacturing mode)
+ UINT32 IgfxD3F0BarBaseAddress; ///< 078 IGFX Audio D3F0 BAR Base Address
+ ///
+ /// Backlight Control Values
+ ///
+ UINT8 BacklightControlSupport; ///< 082 Backlight Control Support
+ UINT8 BrightnessPercentage; ///< 083 Brightness Level Percentage
+ ///
+ /// Ambient Light Sensor Values
+ ///
+ UINT8 AlsEnable; ///< 084 Ambient Light Sensor Enable
+ UINT8 AlsAdjustmentFactor; ///< 085 Ambient Light Adjusment Factor
+ UINT8 LuxLowValue; ///< 086 LUX Low Value
+ UINT8 LuxHighValue; ///< 087 LUX High Value
+ UINT8 ActiveLFP; ///< 088 Active LFP
+ UINT32 AudioWaA; ///< 089 Audio MMIO WA 1
+ UINT32 AudioWaB; ///< 093 Audio MMIO WA 2
+ UINT32 AudioWaC; ///< 097 Audio MMIO WA 3
+ UINT32 DeviceId12; ///< 101 Device ID 12
+ UINT32 DeviceId13; ///< 105 Device ID 13
+ UINT32 DeviceId14; ///< 109 Device ID 14
+ UINT32 DeviceId15; ///< 113 Device ID 15
+ UINT32 AudioCodecSaveAddress; ///< 117 Codec Save Address
+ UINT32 AudioCodecSaveCount; ///< 121 Codec Save Count
+ ///
+ /// Add any IGFX relevant fields here and reduce reserved bytes
+ ///
+ UINT8 ReservedIgd[75]; ///< 125:199
+
+ ///
+ /// Switchable Graphics Info
+ ///
+ UINT8 SgMode; ///< 200 SG Mode (0=Disabled, 1=SG Muxed, 2=SG Muxless, 3=DGPU Only)
+ UINT8 SgFeatureList; ///< 201 SG Feature list
+ UINT8 SgDgpuPwrOK; ///< 202 dGPU PWROK GPIO assigned
+ UINT8 SgDgpuHoldRst; ///< 203 dGPU HLD RST GPIO assigned
+ UINT8 SgDgpuPwrEnable; ///< 204 dGPU PWR Enable GPIO assigned
+ UINT8 SgDgpuPrsnt; ///< 205 dGPU Present Detect GPIO assigned
+ UINT32 CapStrPresence; ///< 206 PEG Endpoint Capability Structure Presence
+ UINT8 EndpointPcieCapOffset; ///< 210 PEG Endpoint PCIe Capability Structure Offset
+ UINT16 EndpointVcCapOffset; ///< 211 PEG Endpoint Virtual Channel Capability Structure Offset
+ UINT32 XPcieCfgBaseAddress; ///< 213 Any Device's PCIe Config Space Base Address
+ UINT16 GpioBaseAddress; ///< 217 GPIO Base Address
+ UINT8 SgGPIOSupport; ///< 219 SG GPIO
+ UINT32 NvIgOpRegionAddress; ///< 220 NVIG support
+ UINT32 NvHmOpRegionAddress; ///< 224 NVHM support
+ UINT32 ApXmOpRegionAddress; ///< 228 AMDA support
+ UINT8 NumberOfValidDeviceId; ///< 232 Number of Valid Device IDs
+ UINT32 DeviceId1; ///< 233 Device ID 1
+ UINT32 DeviceId2; ///< 237 Device ID 2
+ UINT32 DeviceId3; ///< 241 Device ID 3
+ UINT32 DeviceId4; ///< 245 Device ID 4
+ UINT32 DeviceId5; ///< 249 Device ID 5
+ UINT32 DeviceId6; ///< 253 Device ID 6
+ UINT32 DeviceId7; ///< 257 Device ID 7
+ UINT32 DeviceId8; ///< 261 Device ID 8
+ UINT32 OccupiedBuses1; ///< 265 Occupied Buses from 0 to 31
+ UINT32 OccupiedBuses2; ///< 269 Occupied Buses from 32 to 63
+ UINT32 OccupiedBuses3; ///< 273 Occupied Buses from 64 to 95
+ UINT32 OccupiedBuses4; ///< 277 Occupied Buses from 96 to 127
+ UINT32 OccupiedBuses5; ///< 281 Occupied Buses from 128 to 159
+ UINT32 OccupiedBuses6; ///< 285 Occupied Buses from 160 to 191
+ UINT32 OccupiedBuses7; ///< 289 Occupied Buses from 192 to 223
+ UINT32 OccupiedBuses8; ///< 293 Occupied Buses from 224 to 255
+ UINT8 Peg0LtrEnable; ///< 297 Latency Tolerance Reporting Control for PEG(0:1:0)
+ UINT8 Peg0ObffEnable; ///< 298 Optimized Buffer Flush and Fill for PEG(0:1:0)
+ UINT8 Peg1LtrEnable; ///< 299 Latency Tolerance Reporting Control for PEG(0:1:1)
+ UINT8 Peg1ObffEnable; ///< 300 Optimized Buffer Flush and Fill for PEG(0:1:1)
+ UINT8 Peg2LtrEnable; ///< 301 Latency Tolerance Reporting Control for PEG(0:1:2)
+ UINT8 Peg2ObffEnable; ///< 302 Optimized Buffer Flush and Fill for PEG(0:1:2)
+ UINT16 PegLtrMaxSnoopLatency; ///< 303 SA Peg Latency Tolerance Reporting Control
+ UINT16 PegLtrMaxNoSnoopLatency; ///< 305 SA Peg Latency Tolerance Reporting Control
+ UINT8 Peg0PowerDownUnusedBundles; ///< 307 Peg0 Unused Bundle Control
+ UINT8 Peg1PowerDownUnusedBundles; ///< 308 Peg1 Unused Bundle Control
+ UINT8 Peg2PowerDownUnusedBundles; ///< 309 Peg2 Unused Bundle Control
+ UINT8 EdpValid; ///< 310 Check for eDP display device
+ UINT32 NextStateDidEdp; ///< 311 Next state DID for eDP
+ UINT32 DeviceIdX; ///< 315 Device ID for eDP device
+ UINT8 PackageCstateLimit; ///< 319 The lowest C-state for the package
+ UINT8 C7Allowed; ///< 316 Run-time C7 Allowed feature (0=Disabled, 1=Enabled)
+ //
+ // Add any other HG Board Info or anything else here
+ //
+// AMI_OVERRIDE...
+ UINT8 SgDgpuDisplaySel; ///< 319 dGPU Display Select GPIO assigned
+ UINT8 SgDgpuEdidSel; ///< 320 dGPU EDID Select GPIO assigned
+ UINT8 SgDgpuPwmSel; ///< 321 dGPU PWM Select GPIO assigned
+ UINT32 SgMuxDid1; ///< 322 DID1 Mux Setting
+ UINT32 SgMuxDid2; ///< 326 DID2 Mux Setting
+ UINT32 SgMuxDid3; ///< 330 DID3 Mux Setting
+ UINT32 SgMuxDid4; ///< 334 DID4 Mux Setting
+ UINT32 SgMuxDid5; ///< 338 DID5 Mux Setting
+ UINT32 SgMuxDid6; ///< 342 DID6 Mux Setting
+ UINT32 SgMuxDid7; ///< 346 DID7 Mux Setting
+ UINT32 SgMuxDid8; ///< 350 DID8 Mux Setting
+ UINT8 PXFixedDynamicMode; ///< 354 ATI 5.0 Fixed/Dynamic ATI 5.0 Fixed/Dynamic
+ UINT32 EndpointBaseAddress; ///< 355 Endpoint PCIe Base Address
+ UINT32 DgpuSsid; ///< 359 dGPU SSID for MSHyBrid restore
+// AMI_OVERRIDE...end
+} SYSTEM_AGENT_GLOBAL_NVS_AREA;
+#pragma pack()
+///
+/// System Agent Global NVS Area Protocol
+///
+typedef struct _SYSTEM_AGENT_GLOBAL_NVS_AREA_PROTOCOL {
+ SYSTEM_AGENT_GLOBAL_NVS_AREA *Area;
+} SYSTEM_AGENT_GLOBAL_NVS_AREA_PROTOCOL;
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/Protocol/SaInfo/SaInfo.c b/ReferenceCode/Chipset/SystemAgent/Protocol/SaInfo/SaInfo.c
new file mode 100644
index 0000000..4ca46f3
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Protocol/SaInfo/SaInfo.c
@@ -0,0 +1,41 @@
+/** @file
+ This file defines the Sa Info Protocol.
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+///
+/// Statements that include other files
+///
+///
+/// External include files do NOT need to be explicitly specified in real EDKII
+/// environment
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#endif
+
+#include "SaInfo.h"
+
+///
+/// Protocol GUID definition
+///
+EFI_GUID gEfiSaInfoProtocolGuid = EFI_SA_INFO_PROTOCOL_GUID;
+
+///
+/// Protocol description
+///
+EFI_GUID_STRING(&gEfiSaInfoProtocolGuid, "Sa Info Protocol", "Sa Information Protocol");
diff --git a/ReferenceCode/Chipset/SystemAgent/Protocol/SaInfo/SaInfo.h b/ReferenceCode/Chipset/SystemAgent/Protocol/SaInfo/SaInfo.h
new file mode 100644
index 0000000..7469119
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Protocol/SaInfo/SaInfo.h
@@ -0,0 +1,70 @@
+/** @file
+ This file defines the SA Info Protocol.
+
+@copyright
+ Copyright (c) 2011 - 2014 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _SA_INFO_H_
+#define _SA_INFO_H_
+
+///
+/// Define SA INFO protocol GUID
+///
+/// EDK and EDKII have different GUID formats
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#define EFI_SA_INFO_PROTOCOL_GUID \
+ { \
+ 0x493b5bac, 0xbb9e, 0x4bf5, 0x83, 0x79, 0x20, 0xe2, 0xac, 0xa9, 0x85, 0x41 \
+ }
+
+#else
+#define EFI_SA_INFO_PROTOCOL_GUID \
+ { \
+ 0x493b5bac, 0xbb9e, 0x4bf5, \
+ { \
+ 0x83, 0x79, 0x20, 0xe2, 0xac, 0xa9, 0x85, 0x41 \
+ } \
+ }
+#endif
+///
+/// Extern the GUID for protocol users.
+///
+extern EFI_GUID gEfiSaInfoProtocolGuid;
+
+//
+// Forward reference for ANSI C compatibility
+//
+typedef struct _EFI_SA_INFO_PROTOCOL EFI_SA_INFO_PROTOCOL;
+
+///
+/// Protocol revision number
+/// Any backwards compatible changes to this protocol will result in an update in the revision number
+/// Major changes will require publication of a new protocol
+///
+/// Revision 1: Original version
+///
+#define SA_INFO_PROTOCOL_REVISION_1 1
+#define SA_RC_VERSION 0x01090000
+
+///
+/// Protocol definition
+///
+struct _EFI_SA_INFO_PROTOCOL {
+ UINT8 Revision;
+ UINT32 RCVersion;
+};
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/Protocol/SaPlatformPolicy/SaPlatformPolicy.c b/ReferenceCode/Chipset/SystemAgent/Protocol/SaPlatformPolicy/SaPlatformPolicy.c
new file mode 100644
index 0000000..b843e48
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Protocol/SaPlatformPolicy/SaPlatformPolicy.c
@@ -0,0 +1,37 @@
+/** @file
+ Interface definition details between SystemAgent and platform drivers during DXE phase.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "Tiano.h"
+
+///
+/// Include the protocol header file
+///
+#include "SaPlatformPolicy.h"
+
+///
+/// Protocol GUID definition
+///
+EFI_GUID gDxePlatformSaPolicyGuid = DXE_PLATFORM_SA_POLICY_GUID;
+
+///
+/// Protocol description
+///
+EFI_GUID_STRING
+ (&gDxePlatformSaPolicyGuid, "SaPlatformPolicy Protocol", "Intel(R) DXE Phase SA Platform Policy Protocol");
diff --git a/ReferenceCode/Chipset/SystemAgent/Protocol/SaPlatformPolicy/SaPlatformPolicy.h b/ReferenceCode/Chipset/SystemAgent/Protocol/SaPlatformPolicy/SaPlatformPolicy.h
new file mode 100644
index 0000000..5b6793f
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Protocol/SaPlatformPolicy/SaPlatformPolicy.h
@@ -0,0 +1,366 @@
+/** @file
+ Interface definition details between System Agent and platform drivers during DXE phase.
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#ifndef _SA_PLATFORM_POLICY_H_
+#define _SA_PLATFORM_POLICY_H_
+
+#include "SaAccess.h"
+
+///
+/// SA Policy provided by platform for DXE phase {912A2913-42A8-45b0-822F-A94D1EAE9965}
+///
+#define DXE_PLATFORM_SA_POLICY_GUID \
+ { \
+ 0x912a2913, 0x42a8, 0x45b0, 0x82, 0x2f, 0xa9, 0x4d, 0x1e, 0xae, 0x99, 0x65 \
+ }
+
+///
+/// Extern the GUID for protocol users.
+///
+extern EFI_GUID gDxePlatformSaPolicyGuid;
+
+///
+/// Protocol revision number
+/// Any backwards compatible changes to this protocol will result in an update in the revision number
+/// Major changes will require publication of a new protocol
+///
+/// Don't change the original DXE_MCH_PLATFORM_POLICY_PROTOCOL_REVISION macro, external
+/// modules maybe have consumed this macro in their source code. Directly
+/// update the DXE_MCH_PLATFORM_POLICY_PROTOCOL_REVISION version number may cause those
+/// external modules to auto mark themselves wrong version info.
+/// Always create new version macro for new PlatformMchPolicy protocol interface.
+///
+/// DXE_SA_PLATFORM_POLICY_PROTOCOL_REVISION
+/// First version
+///
+#define DXE_SA_PLATFORM_POLICY_PROTOCOL_REVISION 1
+///
+/// DXE_SA_PLATFORM_POLICY_PROTOCOL_REVISION_2
+/// Moved PcieDevsOverride to SampleCode as part of SA_PCIE_CONFIGURATION structure
+/// Added SA_PCIE_CONFIGURATION.PcieLtrDevsOverride
+///
+#define DXE_SA_PLATFORM_POLICY_PROTOCOL_REVISION_2 2
+///
+/// DXE_SA_PLATFORM_POLICY_PROTOCOL_REVISION_3
+/// Added DXE_PLATFORM_SA_POLICY_PROTOCOL.VbiosConfig
+/// SA_IGD_CONFIGURATION.VbtAddress
+/// SA_IGD_CONFIGURATION.Size
+///
+#define DXE_SA_PLATFORM_POLICY_PROTOCOL_REVISION_3 3
+///
+/// DXE_SA_PLATFORM_POLICY_PROTOCOL_REVISION_4
+/// Added SA_IGD_CONFIGURATION.CdClk
+/// SA_IGD_CONFIGURATION.CdClkVar
+///
+#define DXE_SA_PLATFORM_POLICY_PROTOCOL_REVISION_4 4
+///
+/// DXE_SA_PLATFORM_POLICY_PROTOCOL_REVISION_5
+/// Added SA_IGD_CONFIGURATION.PlatformConfig
+///
+#define DXE_SA_PLATFORM_POLICY_PROTOCOL_REVISION_5 5
+///
+/// DXE_SA_PLATFORM_POLICY_PROTOCOL_REVISION_6
+/// Added SA_IGD_CONFIGURATION.IuerStatusVal
+/// Added SA_MISC_CONFIGURATION.SaHdaVerbTableNum
+/// SA_MISC_CONFIGURATION.*SaHdaVerbTable
+///
+#define DXE_SA_PLATFORM_POLICY_PROTOCOL_REVISION_6 6
+///
+/// DXE_SA_PLATFORM_POLICY_PROTOCOL_REVISION_7
+/// Added SA_IGD_CONFIGURATION.GopVersion
+/// Added SA_PCIE_CONFIGURATION.PegPwrOpt[SA_PEG_MAX_FUN]
+///
+#define DXE_SA_PLATFORM_POLICY_PROTOCOL_REVISION_7 7
+///
+/// DXE_SA_PLATFORM_POLICY_PROTOCOL_REVISION_8
+/// Added SA_PCIE_CONFIGURATION.C7Allowed
+///
+#define DXE_SA_PLATFORM_POLICY_PROTOCOL_REVISION_8 8
+
+#define SA_VTD_ENGINE_NUMBER 2
+#define SA_PCIE_DEV_END_OF_TABLE 0xFFFF
+///
+/// The data elements should be initialized by a Platform Module. The data structure is for
+/// VT-d driver initialization
+///
+typedef struct {
+ BOOLEAN VtdEnable; ///< This field is used to describe whether or not the VT-d function should be enabled
+ EFI_PHYSICAL_ADDRESS *RmrrUsbBaseAddress; ///< The field is used to describe the platform USB Reserved memory for Intel VT-d support. Platform code should provide this information for Intel VT-d DXE driver use
+ UINT32 BaseAddress[SA_VTD_ENGINE_NUMBER]; ///< This field is used to describe the base addresses for VT-d function
+} SA_VTD_CONFIGURATION;
+
+///
+/// The Memory Configuration includes DIMM SPD address Map and DIMM Slot Mechanical present bit map.
+///
+/// The data elements should be initialized by a Platform Module. Refer to
+/// $(PROJECT_SA_ROOT)\SmbiosMemory\Dxe\SmbiosMemory.c for the usage.
+///
+typedef struct {
+/**
+ Dimm SPD address
+ Only Server support 2 channels * 3 slots per channel = 6 sockets totally
+ The Desktop and mobile only support 2 channels * 2 slots per channel = 4 sockets totally
+ So there is mapping rule here for Desktop and mobile that there are no more 4 DIMMS totally in a system:
+ Channel A/ Slot 0 --> Dimm 0 --> SpdAddressTable[0]
+ Channel A/ Slot 1 --> Dimm 1 --> SpdAddressTable[1]
+ Channel B/ Slot 0 --> Dimm 2 --> SpdAddressTable[2]
+ Channel B/ Slot 1 --> Dimm 3 --> SpdAddressTable[3]
+ Refer to $(PROJECT_SA_ROOT)\SmbiosMemory\Dxe\SmbiosMemory.c for use
+ If change the mapping rule, please update the Revision number.
+**/
+ UINT8 *SpdAddressTable;
+/**
+ Channel A DIMM Slot Mechanical present bit map, bit 0 -> DIMM 0, bit 1 -> DIMM1, ...
+ if the bit is 1, the related DIMM slot is present.
+ E.g. if channel A has 2 DIMMs, ChannelASlotMap = 0x03;
+ E.g. if channel A has only 1 DIMMs, ChannelASlotMap = 0x01;
+ Refer to $(PROJECT_SA_ROOT)\SmbiosMemory\Dxe\SmbiosMemory.c
+**/
+ UINT8 ChannelASlotMap;
+/**
+ Channel B DIMM Slot Mechanical present bit map, bit 0 -> DIMM 0, bit 1 -> DIMM1, ...
+ if the bit is 1, the related DIMM slot is present.
+ E.g. if channel B has 2 DIMMs, ChannelBSlotMap = 0x03;
+ E.g. if channel B has only 1 DIMMs, ChannelBSlotMap = 0x01;
+ Refer to $(PROJECT_SA_ROOT)\SmbiosMemory\Dxe\SmbiosMemory.c
+**/
+ UINT8 ChannelBSlotMap;
+ UINT8 RmtBdatEnable; ///< This flag is used by the MRC for DDR3 channel training (default is false). Please refer to the MRC documentation for more details
+ UINT8 MrcTimeMeasure; ///< Time measure
+ UINT8 MrcFastBoot; ///< Fast boot
+} SA_MEMORY_CONFIGURATION;
+
+///
+/// The value before AutoConfig match the setting of PCI Express Base Specification 1.1, please be careful for adding new feature
+///
+typedef enum {
+ PcieAspmDisabled,
+ PcieAspmL0s,
+ PcieAspmL1,
+ PcieAspmL0sL1,
+ PcieAspmAutoConfig,
+ PcieAspmMax
+} SA_PCIE_ASPM_CONFIG;
+
+///
+/// Device List Structure
+///
+typedef struct {
+ UINT16 VendorId; ///< PCI Configuration space offset 0
+ UINT16 DeviceId; ///< PCI Configuration space offset 2
+ UINT8 RevId; ///< PCI Configuration space offset 8; 0xFF means all steppings
+ UINT8 RootApmcMask;
+ UINT8 EndpointApmcMask;
+} PCIE_ASPM_DEV_INFO;
+
+typedef struct {
+ UINT16 VendorId; ///< PCI Config space offset 0
+ UINT16 DeviceId; ///< PCI Config space offset 2
+ UINT8 RevId; ///< PCI Config space offset 8; 0xFF means all steppings
+/**
+ SnoopLatency bit definition
+ Note: All Reserved bits must be set to 0
+
+ BIT[15] - When set to 1b, indicates that the values in bits 9:0 are valid
+ When clear values in bits 9:0 will be ignored
+ BIT[14] - Should be set to 0b
+ BIT[13] - Reserved
+ BITS[12:10] - Value in bits 9:0 will be multiplied with the scale in these bits
+ 000b - 1 ns
+ 001b - 32 ns
+ 010b - 1024 ns
+ 011b - 32,768 ns
+ 100b - 1,048,576 ns
+ 101b - 33,554,432 ns
+ 110b - Reserved
+ 111b - Reserved
+ BITS[9:0] - Snoop Latency Value. The value in these bits will be multiplied with
+ the scale in bits 12:10
+**/
+ UINT16 SnoopLatency;
+/**
+ NonSnoopLatency bit definition
+ Note: All Reserved bits must be set to 0
+
+ BIT[15] - When set to 1b, indicates that the values in bits 9:0 are valid
+ When clear values in bits 9:0 will be ignored
+ BIT[14] - Should be set to 0b
+ BIT[13] - Reserved
+ BITS[12:10] - Value in bits 9:0 will be multiplied with the scale in these bits
+ 000b - 1 ns
+ 001b - 32 ns
+ 010b - 1024 ns
+ 011b - 32,768 ns
+ 100b - 1,048,576 ns
+ 101b - 33,554,432 ns
+ 110b - Reserved
+ 111b - Reserved
+ BITS[9:0] - Non Snoop Latency Value. The value in these bits will be multiplied with
+ the scale in bits 12:10
+**/
+ UINT16 NonSnoopLatency;
+} PCIE_LTR_DEV_INFO;
+
+///
+/// PCIE Power Optimizer config
+///
+typedef struct {
+ UINT8 LtrEnable;
+ UINT16 LtrMaxSnoopLatency;
+ UINT16 LtrMaxNoSnoopLatency;
+ UINT8 ObffEnable;
+} SA_PCIE_PWR_OPT;
+
+
+///
+/// The PCI Express Configuration info includes PCI Resources Range Base and Limits and the control
+/// for PEG ASPM.
+///
+/// The data elements should be initialized by a Platform Module. For the data structure for PCI IO
+/// and PCI Memory address range info refer to $(PROJECT_SA_ROOT)\PciHostBridge\Dxe\PciHostBridge.c
+/// for the usage.
+///
+typedef struct {
+ SA_PCIE_ASPM_CONFIG DmiAspm; ///< This field is used to describe the ASPM control for DMI
+ SA_PCIE_ASPM_CONFIG PegAspm[SA_PEG_MAX_FUN]; ///< This field is used to describe the ASPM control for PEG Ports
+ UINT8 PegAspmL0s[SA_PEG_MAX_FUN]; ///< This field is used to describe the PEG L0s advanced control
+ UINT8 PegDeEmphasis[SA_PEG_MAX_FUN]; ///< This field is used to describe the DeEmphasis control for PEG (-6 dB and -3.5 dB are the options)
+ BOOLEAN DmiExtSync; ///< This field is used to describe the DMI Extended Sync enable/disable control
+ UINT8 DmiDeEmphasis; ///< This field is used to describe the DeEmphasis control for DMI (-6 dB and -3.5 dB are the options)
+ BOOLEAN DmiIot; ///< This field is used to describe the IOT control for DMI, default is 0
+ UINT8 C7Allowed; ///< Enable/Disable C7 allowed for PEG Ports [Run-time control]. 0=Disable (default) and 1=Enable
+ ///
+ /// This field is used as a pointer to the ASPM device override table, default points to an
+ /// existing table, mPcieAspmDevsOverride, in the sample code. Refer to
+ /// $(PROJECT_SA_ROOT)\Protocol\SaPlatformPolicy\SaPlatformPolicy.h and
+ /// $(PROJECT_SA_ROOT)\SampleCode\SaPolicyInit\Dxe\SaDxePolicyInit.c for the usage.
+ ///
+ /// Note: This exclusion list helps avoid potential system hangs.
+ ///
+ PCIE_ASPM_DEV_INFO *PcieAspmDevsOverride;
+ ///
+ /// This field is used as a pointer to the LTR device override table, default points to an existing
+ /// table, mPcieLtrDevsOverride, in the sample code. Refer to
+ /// $(PROJECT_SA_ROOT)\Protocol\SaPlatformPolicy\SaPlatformPolicy.h and
+ /// $(PROJECT_SA_ROOT)\SampleCode\SaPolicyInit\Dxe\SaDxePolicyInit.c for the usage.
+ ///
+ PCIE_LTR_DEV_INFO *PcieLtrDevsOverride;
+ SA_PCIE_PWR_OPT PegPwrOpt[SA_PEG_MAX_FUN]; ///< This field is used to describe the PCIe LTR/OBFF relevant settings
+} SA_PCIE_CONFIGURATION;
+
+///
+/// Audio Codec Verb Table
+///
+typedef struct {
+ UINT32 VendorDeviceId;
+ UINT16 SubSystemId;
+ UINT8 RevisionId; ///< 0xFF applies to all steppings
+ UINT8 FrontPanelSupport;
+ UINT16 NumberOfRearJacks;
+ UINT16 NumberOfFrontJacks;
+} SA_HDA_VERB_TABLE_HEADER;
+
+typedef struct {
+ SA_HDA_VERB_TABLE_HEADER VerbTableHeader;
+ UINT32 *VerbTableData;
+} SA_HDA_VERB_TABLE;
+
+///
+/// This data structure includes IGD related configuration Variables. The data elements should
+/// be initialized by a Platform Module.
+///
+typedef struct {
+ UINT8 RenderStandby; ///< This field is used to enable or disable RC6 (Render Standby)
+ UINT8 DeepRenderStandby; ///< @deprecated
+ EFI_PHYSICAL_ADDRESS VbtAddress; ///< This field points to the GOP VBT data buffer
+ UINT32 Size; ///< This field gives the size of the GOP VBT Data buffer
+ UINT8 CdClk; ///< This field is used to control the Cd Clock Frequency by the user. 0: 337.5Mhz, 1: 450Mhz, 2: 540Mhz
+ UINT8 CdClkVar; ///< This field gives the Cd Clock Frequencies supported by the system.
+ UINT8 PlatformConfig; ///< This field gives the Platform Configuration Information (0 = Platform is S0ix Capable for ULT SKUs only, 1 = Platform is not S0ix Capable, 2 = Force Platform is S0ix Capable for All SKUs)
+ UINT32 IuerStatusVal; ///< This field holds the current status of all the supported Ultrabook events (Intel(R) Ultrabook Event Status bits)
+ CHAR16 GopVersion[0x10]; ///< This field holds the GOP Driver Version. It is an Output Protocol and updated by the RC
+
+} SA_IGD_CONFIGURATION;
+
+///
+/// Subsystem Vendor ID / Subsystem ID
+///
+typedef struct {
+ UINT16 SubSystemVendorId;
+ UINT16 SubSystemId;
+} SA_DEFAULT_SVID_SID;
+
+///
+/// This data structure includes miscellaneous configuration variables such SA thermal device
+/// control. The data elements should be initialized by a Platform Module.
+///
+typedef struct {
+ BOOLEAN ChapDeviceEnable; ///< This field is used to control enable or disable System Agent device (0,7,0)
+ BOOLEAN Device4Enable; ///< This field is used to control enable or disable System Agent device (0,4,0)
+ SA_DEFAULT_SVID_SID *DefaultSvidSid; ///< This field contains the Subsystem VendorID and Subsystem ID values to program to SA devices
+ BOOLEAN CridEnable; ///< This field is used to control enable or disable HSW CRID control (to support Intel(R) SIPP)
+ BOOLEAN AudioEnable; ///< This field is used to control enable or disable System Agent device (0,3,0)
+ BOOLEAN FviReport; ///< This field is used to control enable or disable of Firmware Version Info (FVI) reporting. 0: Disable; 1: Enable
+ UINT8 FviSmbiosType; ///< This field is used to control the FVI type reported
+ UINT8 SaHdaVerbTableNum;///< This field gives the number of HD Audio verb tables that are loaded
+ SA_HDA_VERB_TABLE *SaHdaVerbTable; ///< This field points to the current HD Audio verb table
+} SA_MISC_CONFIGURATION;
+
+///
+/// This data structure includes Switchable Graphics VBIOS configuration. The data elements
+/// should be initialized by a Platform Module.
+///
+typedef struct {
+ UINT8 LoadVbios : 1; ///< This field is used to describe if the dGPU VBIOS needs to be loaded
+ UINT8 ExecuteVbios : 1; ///< This field is used to describe if the dGPU VBIOD need to be executed
+ UINT8 VbiosSource : 1; ///< This field is used to identify the source location of dGPU VBIOS
+ UINT8 Reserved : 5;
+} SA_SG_VBIOS_CONFIGURATION;
+
+///
+/// SA DXE Platform Policy
+///
+/// The DXE_PLATFORM_SA_POLICY_PROTOCOL producer drvier is recommended to
+/// set all the DXE_PLATFORM_SA_POLICY_PROTOCOL size buffer zero before init any member parameter,
+/// this clear step can make sure no random value for those unknow new version parameters.
+///
+/// Make sure to update the Revision if any change to the protocol, including the existing
+/// internal structure definations
+///
+typedef struct _DXE_PLATFORM_SA_POLICY_PROTOCOL {
+ /// This field specifies the revision of the protocol. The protocol is expected to change in
+ /// a backwards compatible manner as the chipset configuration options are added or removed.
+ /// Major changes will result in new protocol definitions/GUID. The protocol producer must update
+ /// this field at build time.
+ ///
+ /// Please ensure to use DXE_SA_PLATFORM_POLICY_PROTOCOL_REVISION macro to define the protocol
+ /// revision as input for this version.
+ ///
+ UINT8 Revision;
+ SA_VTD_CONFIGURATION *Vtd; ///< This field is used to describe the configuration of VT-d function used by System Agent Reference code
+ SA_PCIE_CONFIGURATION *PcieConfig; ///< This field is used to describe the PCIE configuration used by System Agent Reference code
+ SA_MEMORY_CONFIGURATION *MemoryConfig; ///< This field is used to describe the Memory configuration used by System Agent Reference code
+ SA_IGD_CONFIGURATION *IgdConfig; ///< This field is used to describe the IGD configuration used by System Agent Reference code
+ SA_MISC_CONFIGURATION *MiscConfig; ///< This field is used to describe some miscellaneous configuration used by System Agent Reference code, such as device enable/disable, CRID support, etc
+ SA_SG_VBIOS_CONFIGURATION *VbiosConfig; ///< This field is used to describe Switchable Graphics configuration used by System Agent Reference Code
+} DXE_PLATFORM_SA_POLICY_PROTOCOL;
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/Protocol/SaProtocolLib.cif b/ReferenceCode/Chipset/SystemAgent/Protocol/SaProtocolLib.cif
new file mode 100644
index 0000000..22c0c36
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Protocol/SaProtocolLib.cif
@@ -0,0 +1,26 @@
+<component>
+ name = "SaProtocolLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\SystemAgent\Protocol\"
+ RefName = "SaProtocolLib"
+[files]
+"SaProtocolLib.sdl"
+"SaProtocolLib.mak"
+"MemInfo\MemInfo.c"
+"MemInfo\MemInfo.h"
+"IgdOpRegion\IgdOpRegion.c"
+"IgdOpRegion\IgdOpRegion.h"
+"IntelSaProtocolLib.inf"
+"SaPlatformPolicy\SaPlatformPolicy.c"
+"SaPlatformPolicy\SaPlatformPolicy.h"
+"SaInfo\SaInfo.h"
+"SaInfo\SaInfo.c"
+"BdatAccess\BdatAccess.h"
+"BdatAccess\BdatAccess.c"
+"PlatformGopPolicy\PlatformGopPolicy.c"
+"PlatformGopPolicy\PlatformGopPolicy.h"
+"SaGlobalNvsArea\SaGlobalNvsArea.c"
+"SaGlobalNvsArea\SaGlobalNvsArea.h"
+"GopComponentName2\GopComponentName2.c"
+"GopComponentName2\GopComponentName2.h"
+<endComponent>
diff --git a/ReferenceCode/Chipset/SystemAgent/Protocol/SaProtocolLib.mak b/ReferenceCode/Chipset/SystemAgent/Protocol/SaProtocolLib.mak
new file mode 100644
index 0000000..f858243
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Protocol/SaProtocolLib.mak
@@ -0,0 +1,20 @@
+# MAK file for the ModulePart:IntelSaProtocolLib
+all : IntelSaProtocolLib
+
+$(BUILD_DIR)\IntelSaProtocolLib.lib : IntelSaProtocolLib
+
+IntelSaProtocolLib : $(BUILD_DIR)\SaProtocolLib.mak IntelSaProtocolLibBin
+
+$(BUILD_DIR)\SaProtocolLib.mak : $(INTEL_SA_PROTOCOL_LIB_DIR)\$(@B).cif $(INTEL_SA_PROTOCOL_LIB_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(INTEL_SA_PROTOCOL_LIB_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+IntelSaProtocolLib_INCLUDES =\
+ $(EDK_INCLUDES) \
+ $(INTEL_MCH_INCLUDES)
+
+IntelSaProtocolLibBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\SaProtocolLib.mak all\
+ "MY_INCLUDES=$(IntelSaProtocolLib_INCLUDES)" \
+ TYPE=LIBRARY \
+ LIBRARY_NAME=$(BUILD_DIR)\IntelSaProtocolLib.lib \ No newline at end of file
diff --git a/ReferenceCode/Chipset/SystemAgent/Protocol/SaProtocolLib.sdl b/ReferenceCode/Chipset/SystemAgent/Protocol/SaProtocolLib.sdl
new file mode 100644
index 0000000..b5ad7b2
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/Protocol/SaProtocolLib.sdl
@@ -0,0 +1,35 @@
+TOKEN
+ Name = SaProtocolLib_SUPPORT
+ Value = 1
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable SaProtocolLib support in Project"
+End
+
+MODULE
+ Help = "Includes SaProtocolLib.mak to Project"
+ File = "SaProtocolLib.mak"
+End
+
+PATH
+ Name = "INTEL_SA_PROTOCOL_LIB_DIR"
+End
+
+ELINK
+ Name = "/I$(INTEL_SA_PROTOCOL_LIB_DIR)"
+ Parent = "INTEL_MCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "INTEL_SA_PROTOCOL_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\IntelSaProtocolLib.lib"
+ Parent = "INTEL_SA_PROTOCOL_LIB"
+ InvokeOrder = AfterParent
+End \ No newline at end of file
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/AudioInit.c b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/AudioInit.c
new file mode 100644
index 0000000..a55603a
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/AudioInit.c
@@ -0,0 +1,849 @@
+/** @file
+ This is the driver that initializes the CPU Audio device.
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+#include "AudioInit.h"
+
+extern SYSTEM_AGENT_GLOBAL_NVS_AREA_PROTOCOL mSaGlobalNvsAreaProtocol;
+
+///
+/// Global variables
+///
+UINT32 *mVerbCodecSaveAddress = NULL;
+UINT8 mVerbCount = 0;
+
+UINT32 mSaHdaVerbTableDataDefault[] = {
+ ///
+ /// Audio Verb Table - 0x80862807
+ ///
+ ///
+ /// Pin Widget 5 - PORT B
+ ///
+ 0x00571C10,
+ 0x00571D00,
+ 0x00571E56,
+ 0x00571F18,
+ ///
+ /// Pin Widget 6 - PORT C
+ ///
+ 0x00671C20,
+ 0x00671D00,
+ 0x00671E56,
+ 0x00671F18,
+ ///
+ /// Pin Widget 7 - PORT D
+ ///
+ 0x00771C30,
+ 0x00771D00,
+ 0x00771E56,
+ 0x00771F18
+};
+
+SA_HDA_VERB_TABLE mSaHdaVerbTableDefault[] = {
+ {
+ ///
+ /// VerbTable:
+ /// Revision ID = 0xFF
+ /// Codec Vendor: 0x80862807
+ ///
+ {
+ 0x80862807, ///< Vendor ID/Device ID
+ 0x0000, ///< SubSystem ID
+ 0xFF, ///< Revision ID
+ 0x02, ///< Front panel support (1=yes, 2=no)
+ 0x0003, ///< Number of Rear Jacks
+ 0x0000 ///< Number of Front Jacks
+ },
+ 0 ///< Pointer to verb table data, need to be inited in the code.
+ }
+};
+
+/**
+ Polling the Status bit
+
+ @param[in] StatusReg The regsiter address to read the status
+ @param[in] PollingBitMap The bit mapping for polling
+ @param[in] PollingData The Data for polling
+
+ @retval EFI_SUCCESS The function completed successfully
+ @retval EFI_TIMEOUT Polling the bit map time out
+**/
+EFI_STATUS
+StatusPolling (
+ IN UINT32 StatusReg,
+ IN UINT16 PollingBitMap,
+ IN UINT16 PollingData
+ )
+{
+ UINT32 LoopTime;
+
+ for (LoopTime = 0; LoopTime < SA_HDA_MAX_LOOP_TIME; LoopTime++) {
+ if ((MmioRead16 (StatusReg) & PollingBitMap) == PollingData) {
+ break;
+ } else {
+ PchPmTimerStall (SA_HDA_WAIT_PERIOD);
+ }
+ }
+
+ if (LoopTime >= SA_HDA_MAX_LOOP_TIME) {
+ DEBUG ((EFI_D_ERROR, "Polling StatusReg 0x%X BitMap 0x%x TimeOut\n", StatusReg, PollingBitMap));
+ return EFI_TIMEOUT;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Send the command to the codec via the Immediate Command mechanism is written
+ to the IC register
+
+ @param[in] HdaBar Base address of Intel HD Audio memory mapped configuration registers
+ @param[in, out] CodecCommandData The Codec Command to be sent to the codec
+ @param[in] ReadBack Whether to get the response received from the codec
+
+ @exception EFI_DEVICE_ERROR Device status error, operation failed
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+SendCodecCommand (
+ IN UINT32 HdaBar,
+ IN OUT UINT32 *CodecCommandData,
+ IN BOOLEAN ReadBack
+ )
+{
+ EFI_STATUS Status;
+
+ ///
+ /// Wait for Command Busy (ICB) bit to be cleared
+ ///
+ Status = StatusPolling (HdaBar + R_HDA_IRS, (UINT16) B_HDA_IRS_ICB, (UINT16) 0);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "ICB bit is not zero before SendCodecCommand! \n"));
+ return EFI_DEVICE_ERROR;
+ }
+ ///
+ /// Clear Result Valid (IRV) bit (by writing a one to it) before issuing a new command
+ ///
+ MmioOr16 ((UINTN) (HdaBar + R_HDA_IRS), (UINT16) (B_HDA_IRS_IRV));
+ ///
+ /// Send command to codec
+ ///
+ MmioWrite32 (HdaBar + R_HDA_IC, *CodecCommandData);
+ ///
+ /// Set ICB bit to issue the command currently stored in IC to the codec.
+ ///
+ MmioOr16 ((UINTN) (HdaBar + R_HDA_IRS), (UINT16) (B_HDA_IRS_ICB));
+ ///
+ /// Wait for Command Busy (ICB) bit to be cleared
+ ///
+ Status = StatusPolling (HdaBar + R_HDA_IRS, (UINT16) B_HDA_IRS_ICB, (UINT16) 0);
+ if (EFI_ERROR (Status)) {
+ MmioAnd16 ((UINTN) (HdaBar + R_HDA_IRS), (UINT16)~(B_HDA_IRS_ICB));
+ return Status;
+ }
+
+ ///
+ /// Save Codec command for runtime code
+ ///
+ if (mVerbCodecSaveAddress != NULL) {
+ if ((mVerbCount * 4) < AUDIO_CODEC_MAX_SIZE) {
+ *(mVerbCodecSaveAddress + mVerbCount) = *CodecCommandData;
+ mVerbCount++;
+ DEBUG ((EFI_D_ERROR, "SendCodecCommand(0x%x): 0x%x \n",(mVerbCodecSaveAddress + (mVerbCount)), *CodecCommandData));
+ } else {
+ DEBUG ((EFI_D_ERROR, "Codec Command Save Area Overflow max value of %d\n", AUDIO_CODEC_MAX_SIZE));
+ }
+ }
+
+ if (ReadBack == TRUE) {
+ if ((MmioRead16 (HdaBar + R_HDA_IRS) & B_HDA_IRS_IRV) != 0) {
+ *CodecCommandData = MmioRead32 (HdaBar + R_HDA_IR);
+ } else {
+ DEBUG ((EFI_D_ERROR, "SendCodecCommand: ReadBack fail! \n"));
+ return EFI_DEVICE_ERROR;
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Set a "Send Codec Command" S3 dispatch item
+
+ @param[in] HdaBar Base address of Intel HD Audio memory mapped configuration registers
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+SendCodecCommandS3Item (
+ IN UINT32 HdaBar
+ )
+{
+ UINT16 BitMask;
+ UINT16 BitValue;
+ UINT16 Data16And;
+ UINT16 Data16Or;
+
+ ///
+ /// Wait for Command Busy (ICB) bit to be cleared
+ ///
+ BitMask = (UINT16) B_HDA_IRS_ICB;
+ BitValue = (UINT16) 0;
+ SCRIPT_MEM_POLL (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ HdaBar + R_HDA_IRS,
+ &BitMask,
+ &BitValue,
+ SA_HDA_WAIT_PERIOD,
+ SA_HDA_MAX_LOOP_TIME
+ );
+ ///
+ /// Clear Result Valid (IRV) bit (by writing a one to it) before issuing a new command
+ ///
+ Data16And = 0xFFFF;
+ Data16Or = (UINT16) (B_HDA_IRS_IRV);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (HdaBar + R_HDA_IRS),
+ &Data16Or, /// Data to be ORed
+ &Data16And /// Data to be ANDed
+ );
+
+ ///
+ /// Send command to codec
+ ///
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (HdaBar + R_HDA_IC),
+ 1,
+ (VOID *) (UINTN) (HdaBar + R_HDA_IC)
+ );
+
+ ///
+ /// Set ICB bit to issue the command currently stored in IC to the codec.
+ ///
+ Data16And = 0xFFFF;
+ Data16Or = (UINT16) (B_HDA_IRS_ICB );
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (HdaBar + R_HDA_IRS),
+ &Data16Or, /// Data to be ORed
+ &Data16And /// Data to be ANDed
+ );
+
+ ///
+ /// Wait for Command Busy (ICB) bit to be cleared
+ ///
+ SCRIPT_MEM_POLL (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ HdaBar + R_HDA_IRS,
+ &BitMask,
+ &BitValue,
+ SA_HDA_WAIT_PERIOD,
+ SA_HDA_MAX_LOOP_TIME
+ );
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Detect And Initialize SA Audio Codec
+
+ @param[in] ImageHandle Handle for the image of this driver
+ @param[in] DxePlatformSaPolicy SA DxePlatformPolicy protocol
+
+ @retval EFI_SUCCESS - Legacy Region protocol installed
+ @retval Other - No protocol installed, unload driver.
+**/
+EFI_STATUS
+DetectAndInitializeCodec (
+ IN EFI_HANDLE mImageHandle,
+ IN DXE_PLATFORM_SA_POLICY_PROTOCOL *DxePlatformSaPolicy
+ )
+{
+ EFI_STATUS Status;
+ UINT32 Index;
+ UINT32 VendorDeviceId;
+ UINT32 RevisionId;
+ UINT8 ByteReg;
+ UINTN AudioBase;
+ UINT8 AudioSDINo;
+ UINT32 HdaBar;
+ UINT32 *VerbTable;
+ UINT32 LoopTime;
+ SA_HDA_VERB_TABLE_HEADER *VerbHeaderTable;
+ EFI_PHYSICAL_ADDRESS BaseAddressBarMem;
+ UINT8 VerbTableNum;
+ UINT32 Data32And;
+ UINT32 Data32Or;
+ UINT32 Data32;
+ UINT32 CodecCmdData;
+ UINT16 AudioDeviceId;
+ UINT16 Data16;
+ UINT16 BitMask;
+ UINT16 BitValue;
+ CPU_STEPPING CpuSteppingId;
+ CPU_FAMILY CpuFamilyId;
+ UINT16 IsUlx;
+
+ CpuFamilyId = GetCpuFamily();
+ CpuSteppingId = GetCpuStepping();
+
+ AudioBase = MmPciAddress (0, SA_HDA_BUS_NUM, SA_HDA_DEV_NUM, SA_HDA_FUN_NUM, 0);
+ AudioDeviceId = MmioRead16 (AudioBase + PCI_DEVICE_ID_OFFSET);
+
+ ///
+ /// Allocate resource for HDBAR
+ ///
+ BaseAddressBarMem = 0x0FFFFFFFF;
+ Status = gDS->AllocateMemorySpace (
+ EfiGcdAllocateMaxAddressSearchBottomUp,
+ EfiGcdMemoryTypeMemoryMappedIo,
+ 14,
+ SA_HDA_HDBAR_SIZE,
+ &BaseAddressBarMem,
+ mImageHandle,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ ///
+ /// System BIOS should ensure that the High Definition Audio HDBAR D27:F0:Reg 10-17h contains a valid address value
+ /// and is enabled by setting D3:F0:Reg 04h[1].
+ ///
+ HdaBar = (UINT32) BaseAddressBarMem;
+ MmioWrite32 (AudioBase + SA_HDA_HDBARL, HdaBar);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (AudioBase + SA_HDA_HDBARL),
+ 1,
+ (VOID *) (UINTN) (AudioBase + SA_HDA_HDBARL)
+ );
+
+ MmioWrite32 (AudioBase + SA_HDA_HDBARU, 0);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (AudioBase + SA_HDA_HDBARU),
+ 1,
+ (VOID *) (UINTN) (AudioBase + SA_HDA_HDBARU)
+ );
+
+ MmioOr16 ((UINTN) (AudioBase + PCI_COMMAND_OFFSET), (UINT16) BIT1);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (AudioBase + PCI_COMMAND_OFFSET),
+ 1,
+ (VOID *) (UINTN) (AudioBase + PCI_COMMAND_OFFSET)
+ );
+
+ ///
+ /// AudioWA: Apply until C0, program Chicken bit: set Dev3 mmio 101C bit 29
+ ///
+ if (((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId < EnumHswC0)) ||
+ ((CpuFamilyId == EnumCpuCrw) && (CpuSteppingId < EnumCrwC0))) {
+ Data32And = 0xFFFFFFFF;
+ Data32Or = (UINT32) (BIT29);
+ MmioOr32 ((UINTN) (HdaBar + 0x101C), Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (HdaBar + 0x101C),
+ &Data32Or, /// Data to be ORed
+ &Data32And /// Data to be ANDed
+ );
+ }
+ if (DxePlatformSaPolicy->Revision >=4) {
+ IsUlx = 0;
+ Data16 = McD2PciCfg16 (0x2);
+ if ((Data16 == 0xA0E) || (Data16 == 0xA1E)) {
+ IsUlx = 1;
+ }
+ Data32Or = 4;
+ Data32 = 75;
+ if (DxePlatformSaPolicy->IgdConfig->CdClkVar != 0) {
+ if (DxePlatformSaPolicy->IgdConfig->CdClk == 0) {
+ Data32Or = 16;
+ Data32 = 225;
+ }
+ if (DxePlatformSaPolicy->IgdConfig->CdClk == 2) {
+ Data32Or = 4;
+ Data32 = 90;
+ }
+ }
+ if(IsUlx == 1) {
+ Data32Or = 16;
+ Data32 = 225;
+ }
+ ///
+ /// Program Dev3 EM4 and EM5 MMIO registers [17:00] based on Cd Clk frequency
+ ///
+ Data32And = 0xFFFC0000;
+ Mmio32AndThenOr ((UINTN) HdaBar, 0x100c, Data32And, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (HdaBar + 0x100c),
+ &Data32Or, /// Data to be ORed
+ &Data32And /// Data to be ANDed
+ );
+
+ Data32And = 0xFFFC0000;
+ Data32Or = Data32;
+ Mmio32AndThenOr ((UINTN) HdaBar, 0x1010, Data32And, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (HdaBar + 0x1010),
+ &Data32Or, /// Data to be ORed
+ &Data32And /// Data to be ANDed
+ );
+ }
+
+ mSaGlobalNvsAreaProtocol.Area->AudioWaA = MmioRead32(HdaBar + 0x1010);
+ mSaGlobalNvsAreaProtocol.Area->AudioWaB = MmioRead32(HdaBar + 0x101C);
+ mSaGlobalNvsAreaProtocol.Area->AudioWaC = MmioRead32(HdaBar + 0x100C);
+
+ ///
+ /// Allocate an ACPI NVS memory buffer for Saving Codec value for Adapter Power on restore
+ /// , zero initialize, and set the pointer in the SA NVS area structure.
+ ///
+ Status = (gBS->AllocatePool) (EfiACPIMemoryNVS, AUDIO_CODEC_MAX_SIZE, (VOID **) &mVerbCodecSaveAddress);
+ if (EFI_ERROR(Status)) {
+ mSaGlobalNvsAreaProtocol.Area->AudioCodecSaveAddress = 0;
+ ASSERT_EFI_ERROR (Status);
+ } else {
+ ZeroMem ((VOID *) mVerbCodecSaveAddress, AUDIO_CODEC_MAX_SIZE);
+ mSaGlobalNvsAreaProtocol.Area->AudioCodecSaveAddress = (UINT32) (UINTN) (mVerbCodecSaveAddress);
+ }
+
+ ///
+ /// Codec Initialization Programming Sequence
+ /// System BIOS should also ensure that the Controller Reset# bit of Global Control register
+ /// in memory-mapped space (HDBAR+08h[0]) is set to 1 and read back as 1.
+ /// Deassert the HDA controller RESET# to start up the link
+ ///
+ DEBUG ((EFI_D_INFO, "Codec Initialization...\n"));
+ Data32And = 0xFFFFFFFF;
+ Data32Or = (UINT32) (B_HDA_GCTL_CRST);
+ MmioOr32 ((UINTN) (HdaBar + R_HDA_GCTL), Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (HdaBar + R_HDA_GCTL),
+ &Data32Or, /// Data to be ORed
+ &Data32And /// Data to be ANDed
+ );
+
+ BitMask = (UINT16) B_HDA_GCTL_CRST;
+ BitValue = (UINT16) B_HDA_GCTL_CRST;
+ Status = StatusPolling (HdaBar + R_HDA_GCTL, BitMask, BitValue);
+ SCRIPT_MEM_POLL (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ HdaBar + R_HDA_GCTL,
+ &BitMask,
+ &BitValue,
+ SA_HDA_WAIT_PERIOD,
+ SA_HDA_MAX_LOOP_TIME
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "Reset SA dHDA Codec - Set Controller Reset# bit and Poll: Time Out - 0! \n"));
+ goto ExitInitAudio;
+ }
+ ///
+ /// Read GCAP and write the same value back to the register once after Controller Reset# bit is set
+ ///
+ Data16 = MmioRead16 (HdaBar + R_HDA_GCAP);
+ MmioWrite16 (HdaBar + R_HDA_GCAP, Data16);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (HdaBar + R_HDA_GCAP),
+ 1,
+ (VOID *) (UINTN) (HdaBar + R_HDA_GCAP)
+ );
+ ///
+ /// Clear the "State Change Status Register" STATESTS bits for
+ /// each of the "SDIN Stat Change Status Flag"
+ ///
+ MmioOr8 ((UINTN) (HdaBar + R_HDA_STATESTS), (UINT8) (SA_HDA_MAX_SID_MASK));
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (HdaBar + R_HDA_STATESTS),
+ 1,
+ (VOID *) (UINTN) (HdaBar + R_HDA_STATESTS)
+ );
+ ///
+ /// Turn off the link and poll RESET# bit until it reads back as 0 to get hardware reset report
+ ///
+ Data32And = (UINT32) (~B_HDA_GCTL_CRST);
+ Data32Or = (UINT32) 0;
+ MmioAnd32 ((UINTN) (HdaBar + R_HDA_GCTL), Data32And);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (HdaBar + R_HDA_GCTL),
+ &Data32Or, /// Data to be ORed
+ &Data32And /// Data to be ANDed
+ );
+
+ BitMask = (UINT16) B_HDA_GCTL_CRST;
+ BitValue = 0;
+ Status = StatusPolling (HdaBar + R_HDA_GCTL, BitMask, BitValue);
+ SCRIPT_MEM_POLL (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ HdaBar + R_HDA_GCTL,
+ &BitMask,
+ &BitValue,
+ SA_HDA_WAIT_PERIOD,
+ SA_HDA_MAX_LOOP_TIME
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "Reset SA dHDA Codec - Turn off the link and Poll: Time Out - 1! \n"));
+ goto ExitInitAudio;
+ }
+ ///
+ /// Turn on the link and poll RESET# bit until it reads back as 1
+ ///
+ Data32And = 0xFFFFFFFF;
+ Data32Or = (UINT32) (B_HDA_GCTL_CRST);
+ MmioOr32 ((UINTN) (HdaBar + R_HDA_GCTL), Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (HdaBar + R_HDA_GCTL),
+ &Data32Or, /// Data to be ORed
+ &Data32And /// Data to be ANDed
+ );
+ ///
+ /// For some combo card that will need this delay because each codec has different latency to come out from RESET.
+ /// This delay can make sure all codecs be recognized by BIOS after RESET sequence.
+ /// Additional delay might be required to allow codec coming out of reset prior to subsequent operations,
+ /// please contact your codec vendor for detail. When clearing this bit and setting it afterward,
+ /// BIOS must ensure that minimum link timing requirements (minimum RESET# assertion time, etc.) are met..
+ ///
+ PchPmTimerStall (SA_HDA_WAIT_PERIOD);
+ SCRIPT_STALL (EFI_ACPI_S3_RESUME_SCRIPT_TABLE, 300 * STALL_ONE_MICRO_SECOND);
+
+ BitMask = (UINT16) B_HDA_GCTL_CRST;
+ BitValue = (UINT16) B_HDA_GCTL_CRST;
+ Status = StatusPolling (HdaBar + R_HDA_GCTL, BitMask, BitValue);
+ SCRIPT_MEM_POLL (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ HdaBar + R_HDA_GCTL,
+ &BitMask,
+ &BitValue,
+ SA_HDA_WAIT_PERIOD,
+ SA_HDA_MAX_LOOP_TIME
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "Reset SA dHDA Codec - Turn on the link and Poll: Time Out - 2! \n"));
+ goto ExitInitAudio;
+ }
+ ///
+ /// Read the "State Change Status Register" STATESTS bits twice to find out if any SDIN is connected
+ /// to a codec.
+ ///
+ for (LoopTime = 0, ByteReg = 0, AudioSDINo = 0; LoopTime < SA_HDA_MAX_LOOP_TIME; LoopTime++) {
+ ByteReg = MmioRead8 (HdaBar + R_HDA_STATESTS) & SA_HDA_MAX_SID_MASK;
+ if (ByteReg != 0 && (ByteReg == AudioSDINo)) {
+ break;
+ } else {
+ AudioSDINo = ByteReg;
+ }
+
+ PchPmTimerStall (SA_HDA_WAIT_PERIOD);
+ }
+ ///
+ /// BIT3(1000) -- SDI3
+ /// BIT2(0100) -- SDI2
+ /// BIT1(0010) -- SDI1
+ /// BIT0(0001) -- SDI0
+ ///
+ if (ByteReg == 0) {
+ ///
+ /// No Codec Detected, Turn off the link
+ ///
+ DEBUG ((EFI_D_INFO, "No Codec device is detected.\n"));
+ Data32And = (UINT32) (~B_HDA_GCTL_CRST);
+ Data32Or = (UINT32) 0;
+ MmioAnd32 ((UINTN) (HdaBar + R_HDA_GCTL), Data32And);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (HdaBar + R_HDA_GCTL),
+ &Data32Or, /// Data to be ORed
+ &Data32And /// Data to be ANDed
+ );
+ Status = EFI_DEVICE_ERROR;
+ goto ExitInitAudio;
+ }
+
+ for (AudioSDINo = 0; AudioSDINo < SA_HDA_MAX_SID_NUMBER; AudioSDINo++, ByteReg >>= 1) {
+ if ((ByteReg & 0x1) == 0) {
+ ///
+ /// SDIx has no Codec Device
+ ///
+ DEBUG ((EFI_D_INFO, "SDI%d has no Codec device.\n", AudioSDINo));
+ continue;
+ }
+ ///
+ /// Verb: 31~28 27 26~20 19~0
+ /// CAd 1 NID Verb Command and data
+ /// 0/1/2
+ ///
+ /// Read the Vendor ID/Device ID pair from the attached codec
+ ///
+ VendorDeviceId = 0x000F0000 | (AudioSDINo << 28);
+ Status = SendCodecCommand (HdaBar, &VendorDeviceId, TRUE);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "Read the Codec Vendor ID/Device ID fail! \n"));
+ goto ExitInitAudio;
+ }
+ ///
+ /// Read the Revision ID from the attached codec
+ ///
+ RevisionId = 0x000F0002 | (AudioSDINo << 28);
+ Status = SendCodecCommand (HdaBar, &RevisionId, TRUE);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "Read the Codec Revision ID fail! \n"));
+ goto ExitInitAudio;
+ }
+
+ RevisionId = (RevisionId >> 8) & 0xFF;
+
+ ///
+ /// Get the match codec verb table, RevID of 0xFF applies to all steppings.
+ ///
+ if (DxePlatformSaPolicy->MiscConfig->SaHdaVerbTableNum == 0) {
+ ///
+ /// Init Verb Table Data
+ ///
+ DxePlatformSaPolicy->MiscConfig->SaHdaVerbTable[0].VerbTableData = mSaHdaVerbTableDataDefault;
+ DxePlatformSaPolicy->MiscConfig->SaHdaVerbTableNum = sizeof (mSaHdaVerbTableDefault) / sizeof (SA_HDA_VERB_TABLE);
+ }
+ for (VerbTableNum = 0, VerbHeaderTable = NULL, VerbTable = NULL;
+ VerbTableNum < DxePlatformSaPolicy->MiscConfig->SaHdaVerbTableNum;
+ VerbTableNum++
+ ) {
+ if ((VendorDeviceId == DxePlatformSaPolicy->MiscConfig->SaHdaVerbTable[VerbTableNum].VerbTableHeader.VendorDeviceId) &&
+ (
+ (DxePlatformSaPolicy->MiscConfig->SaHdaVerbTable[VerbTableNum].VerbTableHeader.RevisionId == 0xFF) ||
+ (RevisionId == DxePlatformSaPolicy->MiscConfig->SaHdaVerbTable[VerbTableNum].VerbTableHeader.RevisionId)
+ )
+ ) {
+ VerbHeaderTable = &(DxePlatformSaPolicy->MiscConfig->SaHdaVerbTable[VerbTableNum].VerbTableHeader);
+ VerbTable = DxePlatformSaPolicy->MiscConfig->SaHdaVerbTable[VerbTableNum].VerbTableData;
+ if (VerbTable == 0) {
+ DEBUG ((EFI_D_ERROR, "VerbTableData of VendorID:0x%X is null.\n", VendorDeviceId));
+ Status = EFI_INVALID_PARAMETER;
+ goto ExitInitAudio;
+ }
+
+ DEBUG ((EFI_D_INFO, "Detected SA HDA Codec with verb table, VendorID = 0x%X", VendorDeviceId));
+ DEBUG ((EFI_D_INFO, " on SDI%d, revision = 0x%0x.\n", AudioSDINo, RevisionId));
+ ///
+ /// Enable 3rd Pin and Converter Widget
+ /// Clear CAd Field
+ ///
+ CodecCmdData = SA_HDA_ENABLE_3RD_PIN_WIDGET;
+ ///
+ /// Program CAd Field per the SDI number got during codec detection
+ ///
+ CodecCmdData |= (UINT32) (AudioSDINo << 28);
+ Status = SendCodecCommand (HdaBar, &CodecCmdData, FALSE);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "Error occurs at loading Verb 0x00878101"));
+ ///
+ /// Skip the verb table loading when find the verb table content is not
+ /// properly matched with the HDA hardware, though IDs match.
+ ///
+ DEBUG (
+ (EFI_D_ERROR,
+ "Detected Codec of VendorID:0x%X, error occurs during loading verb table.\n",
+ VendorDeviceId)
+ );
+ goto ExitInitAudio;
+ }
+
+ SendCodecCommandS3Item (HdaBar);
+ ///
+ /// Send the entire list of verbs in the matching verb table one by one to the codec
+ ///
+ for (Index = 0; Index < (UINT32) ((VerbHeaderTable->NumberOfFrontJacks + VerbHeaderTable->NumberOfRearJacks) * 4); Index++) {
+ ///
+ /// Clear CAd Field
+ ///
+ CodecCmdData = VerbTable[Index] & (UINT32)~(BIT31 | BIT30 | BIT29 | BIT28);
+ ///
+ /// Program CAd Field per the SDI number got during codec detection
+ ///
+ CodecCmdData |= (UINT32) (AudioSDINo << 28);
+ Status = SendCodecCommand (HdaBar, &CodecCmdData, FALSE);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "Error occurs at loading Command Index:%x\n", Index));
+ ///
+ /// Skip the verb table loading when find the verb table content is not
+ /// properly matched with the HDA hardware, though IDs match.
+ ///
+ DEBUG (
+ (EFI_D_ERROR,
+ "Detected Codec of VendorID:0x%X, error occurs during loading verb table.\n",
+ VendorDeviceId)
+ );
+ goto ExitInitAudio;
+ }
+
+ SendCodecCommandS3Item (HdaBar);
+ }
+ ///
+ /// Disable 3rd Pin and Converter Widget
+ /// Clear CAd Field
+ ///
+ CodecCmdData = SA_HDA_DISABLE_3RD_PIN_WIDGET;
+ ///
+ /// Program CAd Field per the SDI number got during codec detection
+ ///
+ CodecCmdData |= (UINT32) (AudioSDINo << 28);
+ Status = SendCodecCommand (HdaBar, &CodecCmdData, FALSE);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "Error occurs at loading verb 0x00878100"));
+ ///
+ /// Skip the verb table loading when find the verb table content is not
+ /// properly matched with the HDA hardware, though IDs match.
+ ///
+ DEBUG (
+ (EFI_D_ERROR,
+ "Detected Codec of VendorID:0x%X, error occurs during loading verb table.\n",
+ VendorDeviceId)
+ );
+ goto ExitInitAudio;
+ }
+
+ SendCodecCommandS3Item (HdaBar);
+
+ DEBUG ((EFI_D_INFO, "Verb Table loading complete to Codec on SDI%d\n", AudioSDINo));
+ break;
+ }
+ }
+
+ if (VerbTableNum >= DxePlatformSaPolicy->MiscConfig->SaHdaVerbTableNum) {
+ DEBUG (
+ (EFI_D_INFO,
+ "Detected SA High Definition Audio Codec, VendorID = 0x%08x on SDI%d,",
+ VendorDeviceId,
+ AudioSDINo)
+ );
+ DEBUG ((EFI_D_INFO, " but no matching verb table found.\n"));
+ }
+ } // end of for
+ Status = EFI_SUCCESS;
+
+ExitInitAudio:
+ ///
+ /// Clear HdaBar and disable memory map access
+ ///
+ MmioAnd16 ((UINTN) (AudioBase + PCI_COMMAND_OFFSET), (UINT16) (~BIT1));
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (AudioBase + PCI_COMMAND_OFFSET),
+ 1,
+ (VOID *) (UINTN) (AudioBase + PCI_COMMAND_OFFSET)
+ );
+
+ MmioWrite32 (AudioBase + SA_HDA_HDBARL, 0);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (AudioBase + SA_HDA_HDBARL),
+ 1,
+ (VOID *) (UINTN) (AudioBase + SA_HDA_HDBARL)
+ );
+
+ MmioWrite32 (AudioBase + SA_HDA_HDBARU, 0);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (AudioBase + SA_HDA_HDBARU),
+ 1,
+ (VOID *) (UINTN) (AudioBase + SA_HDA_HDBARU)
+ );
+
+ gDS->FreeMemorySpace (
+ BaseAddressBarMem,
+ SA_HDA_HDBAR_SIZE
+ );
+ ///
+ /// Save the final count of Audio Codec Save data in SA NVS
+ ///
+ mSaGlobalNvsAreaProtocol.Area->AudioCodecSaveCount = mVerbCount;
+
+ return Status;
+}
+
+/**
+ Initialize SystemAgent Audio Device/Codec.
+
+ @param[in] ImageHandle Handle for the image of this driver
+ @param[in] DxePlatformSaPolicy SA DxePlatformPolicy protocol
+
+ @retval EFI_SUCCESS - Audio/Codec initialization done
+**/
+EFI_STATUS
+AudioInit (
+ IN EFI_HANDLE ImageHandle,
+ IN DXE_PLATFORM_SA_POLICY_PROTOCOL *DxePlatformSaPolicy
+ )
+{
+ EFI_STATUS Status;
+
+ if ((DxePlatformSaPolicy->MiscConfig->AudioEnable == 0) || (McD2PciCfg16 (R_SA_IGD_VID) == 0xFFFF)) {
+ DEBUG ((
+ EFI_D_INFO, "Skip Audio Initialization when BIOS option set to disable Or iGfx is not enabled.\n"
+ )
+ );
+ return EFI_SUCCESS;
+ }
+
+ Status = DetectAndInitializeCodec (ImageHandle, DxePlatformSaPolicy);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "SA Audio Codec initialization failure!\n"));
+ }
+
+ DEBUG ((EFI_D_INFO, "AudioInit() End\n"));
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/AudioInit.h b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/AudioInit.h
new file mode 100644
index 0000000..cd7bc33
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/AudioInit.h
@@ -0,0 +1,66 @@
+/** @file
+ Header file for initialization of CPU Audio device.
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _AUDIO_INIT_H_
+#define _AUDIO_INIT_H_
+
+#include "EdkIIGlueDxe.h"
+#include "Pci22.h"
+#include "SaAccess.h"
+#include "PchAccess.h"
+#include "PchPlatformLib.h"
+#include "EfiScriptLib.h"
+#include "CpuRegs.h"
+#include "CpuPlatformLib.h"
+
+#include EFI_PROTOCOL_DEPENDENCY (BootScriptSave)
+#include EFI_PROTOCOL_DEFINITION (SaPlatformPolicy)
+#include EFI_PROTOCOL_DEFINITION (PciHostBridgeResourceAllocation)
+#include EFI_PROTOCOL_DEPENDENCY (SaGlobalNvsArea)
+
+#define SA_HDA_MAX_LOOP_TIME 10
+#define SA_HDA_WAIT_PERIOD 100
+#define SA_HDA_MAX_SID_NUMBER 4
+#define SA_HDA_MAX_SID_MASK ((1 << SA_HDA_MAX_SID_NUMBER) - 1)
+
+#define AUDIO_CODEC_MAX_SIZE 0x80
+
+#define SA_HDA_ENABLE_3RD_PIN_WIDGET 0x00878101
+#define SA_HDA_DISABLE_3RD_PIN_WIDGET 0x00878100
+
+///
+/// Functions
+///
+/**
+ Initialize SystemAgent Audio Device/Codec.
+
+ @param[in] ImageHandle Handle for the image of this driver
+ @param[in] DxePlatformSaPolicy SA DxePlatformPolicy protocol
+
+ @retval EFI_SUCCESS - Audio/Codec initialization Done.
+**/
+EFI_STATUS
+AudioInit (
+ IN EFI_HANDLE ImageHandle,
+ IN DXE_PLATFORM_SA_POLICY_PROTOCOL *DxePlatformSaPolicy
+ )
+;
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/LegacyRegion.c b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/LegacyRegion.c
new file mode 100644
index 0000000..5c91336
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/LegacyRegion.c
@@ -0,0 +1,368 @@
+/** @file
+ This code provides a private implementation of the Legacy Region protocol.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "LegacyRegion.h"
+
+///
+/// Module Global:
+/// Since this driver will only ever produce one instance of the Private Data
+/// protocol you are not required to dynamically allocate the PrivateData.
+///
+LEGACY_REGION_INSTANCE mPrivateData;
+
+UINT8 mRomData[16] = {
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00
+};
+
+UINT8 mLockData[16] = {
+ 0x01,
+ 0x10,
+ 0x01,
+ 0x10,
+ 0x01,
+ 0x10,
+ 0x01,
+ 0x10,
+ 0x01,
+ 0x10,
+ 0x01,
+ 0x10, /// it was: 0x03, 0x30, 0x03, 0x30, <-- why ??
+ 0x10,
+ 0x10,
+ 0x10,
+ 0x10
+};
+
+UINT8 mUnlockData[16] = {
+ 0x03,
+ 0x30,
+ 0x03,
+ 0x30,
+ 0x03,
+ 0x30,
+ 0x03,
+ 0x30,
+ 0x03,
+ 0x30,
+ 0x03,
+ 0x30,
+ 0x30,
+ 0x30,
+ 0x30,
+ 0x30
+};
+
+UINT8 mMaskData[16] = {
+ 0x30,
+ 0x03,
+ 0x30,
+ 0x03,
+ 0x30,
+ 0x03,
+ 0x30,
+ 0x03,
+ 0x30,
+ 0x03,
+ 0x30,
+ 0x03,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00
+};
+
+UINT8 mReg[16] = {
+ R_SA_PAM1,
+ R_SA_PAM1,
+ R_SA_PAM2,
+ R_SA_PAM2,
+ R_SA_PAM3,
+ R_SA_PAM3,
+ R_SA_PAM4,
+ R_SA_PAM4,
+ R_SA_PAM5,
+ R_SA_PAM5,
+ R_SA_PAM6,
+ R_SA_PAM6,
+ R_SA_PAM0,
+ R_SA_PAM0,
+ R_SA_PAM0,
+ R_SA_PAM0
+};
+
+EFI_STATUS
+LegacyRegionManipulation (
+ IN EFI_LEGACY_REGION_PROTOCOL * This,
+ IN UINT32 Start,
+ IN UINT32 Length,
+ IN UINT32 Mode,
+ OUT UINT32 *Granularity OPTIONAL
+ )
+/**
+ Modify PAM registers for region specified to MODE state.
+
+ @param[in] This - Pointer to EFI_LEGACY_REGION_PROTOCOL instance.
+ @param[in] Start - Starting address of a memory region covered by PAM registers (C0000h - FFFFFh).
+ @param[in] Length - Memory region length.
+ @param[in] Mode - Action to perform on a PAM region: UNLOCK, LOCK or BOOTLOCK.
+ @param[out] Granularity - Granularity of region in bytes.
+
+ @retval EFI_SUCCESS - PAM region(s) state modified as requested.
+ @retval EFI_INVALID_PARAMETER - parameter out of boundary
+**/
+{
+ UINT8 Index;
+ UINT8 Data;
+ UINT8 TempData;
+ UINT32 TempAddr;
+ UINT32 NewStartAddr;
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *Pci;
+ EFI_CPU_ARCH_PROTOCOL *CpuArch;
+ UINT64 PciAddress;
+ UINT64 Attributes;
+ EFI_STATUS Status;
+
+ Pci = mPrivateData.PciRootBridgeIo;
+ if ((Start < 0xC0000) ||
+ (Start > 0xFFFFF) ||
+ (Length > 0x40000) ||
+ ((Start + Length - 1) > 0xFFFFF)) {
+ return EFI_INVALID_PARAMETER;
+ }
+ TempAddr = Start;
+ Index = (UINT8) ((TempAddr - 0xC0000) / PAM_GRANULARITY);
+ NewStartAddr = TempAddr = (TempAddr / PAM_GRANULARITY) * PAM_GRANULARITY;
+ while (TempAddr <= (Start + Length - 1)) {
+ if (Index >= 16) {
+ return EFI_INVALID_PARAMETER;
+ }
+ if ((Mode == LOCK) || (Mode == BOOTLOCK)) {
+ Data = mLockData[Index];
+ } else {
+ if (Mode == UNLOCK) {
+ Data = mUnlockData[Index];
+ } else {
+ Data = mRomData[Index];
+ }
+ }
+
+ PciAddress = EFI_PCI_ADDRESS (0, 0, 0, mReg[Index]);
+ Pci->Pci.Read (Pci, EfiPciWidthUint8, PciAddress, 1, &TempData);
+ TempData = (UINT8) ((TempData & mMaskData[Index]) | Data);
+ Pci->Pci.Write (Pci, EfiPciWidthUint8, PciAddress, 1, &TempData);
+ TempAddr += PAM_GRANULARITY;
+ Index++;
+ }
+
+ if (Granularity != NULL) {
+ *Granularity = PAM_GRANULARITY;
+ }
+ ///
+ /// Program the MTRRs
+ ///
+ switch (Mode) {
+
+ case UNLOCK:
+ Attributes = EFI_MEMORY_WT;
+ break;
+
+ case LOCK:
+ Attributes = EFI_MEMORY_WP;
+ break;
+
+ case BOOTLOCK:
+ Attributes = EFI_MEMORY_WP;
+ break;
+
+ default:
+ Attributes = EFI_MEMORY_UC;
+
+ }
+
+ Status = gBS->LocateProtocol (
+ &gEfiCpuArchProtocolGuid,
+ NULL,
+ (VOID **) &CpuArch
+ );
+ ASSERT_EFI_ERROR (Status);
+ Status = CpuArch->SetMemoryAttributes (
+ CpuArch,
+ NewStartAddr,
+ TempAddr - NewStartAddr,
+ Attributes
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+LegacyRegionDecode (
+ IN EFI_LEGACY_REGION_PROTOCOL *This,
+ IN UINT32 Start,
+ IN UINT32 Length,
+ IN BOOLEAN *On
+ )
+/**
+ Enable/Disable decoding of the given region
+
+ @param[in] This - Pointer to EFI_LEGACY_REGION_PROTOCOL instance.
+ @param[in] Start - Starting address of region.
+ @param[in] Length - Length of region in bytes.
+ @param[in] On - 0 = Disable decoding, 1 = Enable decoding.
+
+ @retval EFI_SUCCESS - Decoding change affected.
+**/
+{
+ UINT32 Granularity;
+ if (*On) {
+ return LegacyRegionManipulation (This, Start, Length, UNLOCK, &Granularity);
+ } else {
+ return LegacyRegionManipulation (This, Start, Length, LEGACY_REGION_DECODE_ROM, &Granularity);
+ }
+}
+
+EFI_STATUS
+EFIAPI
+LegacyRegionBootLock (
+ IN EFI_LEGACY_REGION_PROTOCOL * This,
+ IN UINT32 Start,
+ IN UINT32 Length,
+ OUT UINT32 *Granularity OPTIONAL
+ )
+/**
+ Make the indicated region read from RAM / write to ROM.
+
+ @param[in] This - Pointer to EFI_LEGACY_REGION_PROTOCOL instance.
+ @param[in] Start - Starting address of region.
+ @param[in] Length - Length of region in bytes.
+ @param[out] Granularity - Granularity of region in bytes.
+
+ @retval EFI_SUCCESS - Region locked or made R/O.
+**/
+{
+ return LegacyRegionManipulation (This, Start, Length, BOOTLOCK, Granularity);
+}
+
+EFI_STATUS
+EFIAPI
+LegacyRegionLock (
+ IN EFI_LEGACY_REGION_PROTOCOL * This,
+ IN UINT32 Start,
+ IN UINT32 Length,
+ OUT UINT32 *Granularity OPTIONAL
+ )
+/**
+ Make the indicated region read from RAM / write to ROM.
+
+ @param[in] This - Pointer to EFI_LEGACY_REGION_PROTOCOL instance.
+ @param[in] Start - Starting address of region.
+ @param[in] Length - Length of region in bytes.
+ @param[out] Granularity - Granularity of region in bytes.
+
+ @retval EFI_SUCCESS - Region locked or made R/O.
+**/
+{
+ return LegacyRegionManipulation (This, Start, Length, LOCK, Granularity);
+}
+
+EFI_STATUS
+EFIAPI
+LegacyRegionUnlock (
+ IN EFI_LEGACY_REGION_PROTOCOL * This,
+ IN UINT32 Start,
+ IN UINT32 Length,
+ OUT UINT32 *Granularity OPTIONAL
+ )
+/**
+ Make the indicated region read from RAM / write to RAM.
+
+ @param[in] This - Pointer to EFI_LEGACY_REGION_PROTOCOL instance.
+ @param[in] Start - Starting address of region.
+ @param[in] Length - Length of region in bytes.
+ @param[out] Granularity - Granularity of region in bytes.
+
+ @retval EFI_SUCCESS - Region unlocked or made R/W.
+**/
+{
+ return LegacyRegionManipulation (This, Start, Length, UNLOCK, Granularity);
+}
+
+EFI_STATUS
+LegacyRegionInstall (
+ IN EFI_HANDLE ImageHandle
+ )
+/**
+ Install Driver to produce Legacy Region protocol.
+
+ @param[in] ImageHandle Handle for the image of this driver
+
+ @retval EFI_SUCCESS - Legacy Region protocol installed
+ @retval Other - No protocol installed, unload driver.
+**/
+{
+ EFI_STATUS Status;
+ LEGACY_REGION_INSTANCE *Private;
+ Private = &mPrivateData;
+
+ ///
+ /// Grab a copy of all the protocols we depend on. Any error would
+ /// be a dispatcher bug!.
+ ///
+ Status = gBS->LocateProtocol (
+ &gEfiPciRootBridgeIoProtocolGuid,
+ NULL,
+ (VOID **) &Private->PciRootBridgeIo
+ );
+ Private->Signature = LEGACY_REGION_INSTANCE_SIGNATURE;
+ Private->LegacyRegion.Decode = LegacyRegionDecode;
+ Private->LegacyRegion.Lock = LegacyRegionLock;
+ Private->LegacyRegion.BootLock = LegacyRegionBootLock;
+ Private->LegacyRegion.UnLock = LegacyRegionUnlock;
+ Private->ImageHandle = ImageHandle;
+
+ ///
+ /// Make a new handle and install the protocol
+ ///
+ Private->Handle = NULL;
+ return gBS->InstallProtocolInterface (
+ &Private->Handle,
+ &gEfiLegacyRegionProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ &Private->LegacyRegion
+ );
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/LegacyRegion.h b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/LegacyRegion.h
new file mode 100644
index 0000000..d2e9b2d
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/LegacyRegion.h
@@ -0,0 +1,76 @@
+/** @file
+ This code supports a private implementation of the Legacy Region protocol.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _LEGACY_REGION_H_
+#define _LEGACY_REGION_H_
+
+#include "EdkIIGlueDxe.h"
+#include "Pci22.h"
+
+#include EFI_PROTOCOL_PRODUCER (LegacyRegion)
+#include EFI_PROTOCOL_DEFINITION (PciRootBridgeIo)
+#define LEGACY_REGION_INSTANCE_SIGNATURE EFI_SIGNATURE_32 ('R', 'E', 'G', 'N')
+
+#include EFI_ARCH_PROTOCOL_CONSUMER (Cpu)
+#define LEGACY_REGION_DECODE_ROM 3
+
+#include "SaAccess.h"
+
+///
+/// PAM registers granularity is 16 KB
+///
+#define PAM_GRANULARITY 0x4000
+#define UNLOCK 0x0000
+#define LOCK 0x0001
+#define BOOTLOCK 0x0002
+
+typedef struct {
+ UINT32 Signature;
+ EFI_HANDLE Handle;
+ EFI_LEGACY_REGION_PROTOCOL LegacyRegion;
+ EFI_HANDLE ImageHandle;
+
+ ///
+ /// Protocol for PAM register access
+ ///
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
+} LEGACY_REGION_INSTANCE;
+
+#define LEGACY_REGION_INSTANCE_FROM_THIS (this) CR (this, \
+ LEGACY_REGION_INSTANCE, \
+ LegacyRegion, \
+ LEGACY_REGION_INSTANCE_SIGNATURE \
+ )
+
+/**
+ Install Driver to produce Legacy Region protocol.
+
+ @param[in] ImageHandle Handle for the image of this driver
+
+ @retval EFI_SUCCESS - Legacy Region protocol installed
+ @retval Other - No protocol installed, unload driver.
+**/
+EFI_STATUS
+LegacyRegionInstall (
+ IN EFI_HANDLE ImageHandle
+ )
+;
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/PciExpressInit.c b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/PciExpressInit.c
new file mode 100644
index 0000000..921ae94
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/PciExpressInit.c
@@ -0,0 +1,483 @@
+/** @file
+ This driver does SA PCI Express initialization.
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "PciExpressInit.h"
+
+extern SYSTEM_AGENT_GLOBAL_NVS_AREA_PROTOCOL mSaGlobalNvsAreaProtocol;
+
+EFI_STATUS
+PciExpressInit (
+ IN DXE_PLATFORM_SA_POLICY_PROTOCOL *DxePlatformSaPolicy
+ )
+/**
+ PCI Express Dxe Initialization.
+ Run before PCI Bus Init, where assignment of Bus, Memory,
+ and I/O Resources are assigned.
+
+ @param[in] DxePlatformSaPolicy - SA DxePlatformPolicy protocol
+
+ @retval EFI_SUCCESS - Pci Express successfully started and ready to be used
+ @exception EFI_UNSUPPORTED - Pci Express can't be initialized
+**/
+{
+ EFI_STATUS Status;
+ UINT64 EgressPortBar;
+ UINT64 MchBar;
+ UINT64 PciExpressBar;
+ UINT64 DmiBar;
+ UINT32 PchRootComplexBar;
+ CPU_FAMILY CpuFamilyId;
+ CPU_STEPPING CpuSteppingId;
+
+ CpuFamilyId = GetCpuFamily();
+ CpuSteppingId = GetCpuStepping();
+
+ ///
+ /// The SA Represents Component ID 1 (CID1), while the PCH represents
+ /// Component ID 2 (CID2). This code will completely configure both Components
+ /// CID1 Integrated Ports:
+ /// Egress Port = Port 0
+ /// DMI Port = Port 1
+ /// Peg Port10 = Port 2
+ /// Peg Port11 = Port 3
+ /// Peg Port12 = Port 4
+ /// CID2 Integated Ports:
+ /// Egress Port = Port 0
+ /// Root Port 1 = Port 1
+ /// Root Port 2 = Port 2
+ /// Root Port 3 = Port 3
+ /// Root Port 4 = Port 4
+ /// Azalia = Port 5
+ ///
+ ///
+ /// Get BAR registers
+ ///
+ PchRootComplexBar = MmPci32 (0, 0, 31, 0, 0xF0) &~BIT0;
+ PciExpressBar = McD0PciCfg64 (R_SA_PCIEXBAR) & (B_SA_PCIEXBAR_PCIEXBAR_MASK | B_SA_PCIEXBAR_ADMSK128_MASK | B_SA_PCIEXBAR_ADMSK64_MASK);
+ EgressPortBar = McD0PciCfg64 (R_SA_PXPEPBAR) &~BIT0;
+ MchBar = McD0PciCfg64 (R_SA_MCHBAR) &~BIT0;
+ DmiBar = McD0PciCfg64 (R_SA_DMIBAR) &~BIT0;
+
+ ///
+ /// Configure the Egress Port (0) in CID1
+ ///
+ Status = Cid1EgressPort0Init (EgressPortBar);
+
+#ifdef PEG_FLAG
+ if ((CpuFamilyId == EnumCpuHsw) || (CpuFamilyId == EnumCpuCrw)) {
+ ///
+ /// Configure the PEG Ports in CID1
+ ///
+ Status = Cid1PegPortInit (DxePlatformSaPolicy);
+ }
+#endif // PEG_FLAG
+
+ ///
+ /// Configure the SA DMI Port (1) in CID1 and the PCH DMI Port (0) in CID2.
+ /// Note that both links must be fully configured before the link
+ /// should be checked for negotiation between the 2 CIDs.
+ ///
+ DEBUG ((EFI_D_INFO, " Going to call Cid1Cid2DmiPortInit\n"));
+ Status = Cid1Cid2DmiPortInit (DmiBar, DxePlatformSaPolicy);
+
+ ///
+ /// Configure the RootComplex Topology in CID1.
+ ///
+ DEBUG ((EFI_D_INFO, " Going to call Cid1TopologyInit\n"));
+ Status = Cid1TopologyInit (EgressPortBar, DmiBar, PchRootComplexBar);
+
+ ///
+ /// Configure the RootComplex Topology in CID2.
+ ///
+ DEBUG ((EFI_D_INFO, " Going to call Cid2TopologyInit\n"));
+ Status = Cid2TopologyInit (PchRootComplexBar, DmiBar);
+
+ if (((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId >= EnumHswC0)) ||
+ ((CpuFamilyId == EnumCpuCrw) && (CpuSteppingId >= EnumCrwC0))) {
+ if (DxePlatformSaPolicy->Revision >= DXE_SA_PLATFORM_POLICY_PROTOCOL_REVISION_7) {
+ mSaGlobalNvsAreaProtocol.Area->C7Allowed = DxePlatformSaPolicy->PcieConfig->C7Allowed; //Update the Run-time C7 Allowed for ASL usage
+ }
+ }
+
+ mSaGlobalNvsAreaProtocol.Area->PackageCstateLimit = (UINT8)(AsmReadMsr64(MSR_PMG_CST_CONFIG) & B_PACKAGE_C_STATE_LIMIT);
+
+
+ return Status;
+}
+
+UINT32
+PcieFindCapId (
+ IN UINT8 Bus,
+ IN UINT8 Device,
+ IN UINT8 Function,
+ IN UINT8 CapId
+ )
+/**
+ Find the Offset to a given Capabilities ID
+ CAPID list:
+ 0x01 = PCI Power Management Interface
+ 0x04 = Slot Identification
+ 0x05 = MSI Capability
+ 0x10 = PCI Express Capability
+
+ @param[in] Bus - Pci Bus Number
+ @param[in] Device - Pci Device Number
+ @param[in] Function - Pci Function Number
+ @param[in] CapId - CAPID to search for
+
+ @retval 0 - CAPID not found
+ @retval Other - CAPID found, Offset of desired CAPID
+**/
+{
+ UINT8 CapHeader;
+
+ ///
+ /// Always start at Offset 0x34
+ ///
+ CapHeader = MmPci8 (0, Bus, Device, Function, PCI_CAPP);
+ if (CapHeader == 0xFF) {
+ return 0;
+ }
+
+ while (CapHeader != 0) {
+ ///
+ /// Bottom 2 bits of the pointers are reserved per PCI Local Bus Spec 2.2
+ ///
+ CapHeader &= ~(BIT1 + BIT0);
+ ///
+ /// Search for desired CapID
+ ///
+ if (MmPci8 (0, Bus, Device, Function, CapHeader) == CapId) {
+ return CapHeader;
+ }
+
+ CapHeader = MmPci8 (0, Bus, Device, Function, CapHeader + 1);
+ }
+
+ return 0;
+}
+
+UINT32
+PcieFindExtendedCapId (
+ IN UINT8 Bus,
+ IN UINT8 Device,
+ IN UINT8 Function,
+ IN UINT16 CapId
+ )
+/**
+ Search and return the offset of desired Pci Express Capability ID
+ CAPID list:
+ 0x0001 = Advanced Error Rreporting Capability
+ 0x0002 = Virtual Channel Capability
+ 0x0003 = Device Serial Number Capability
+ 0x0004 = Power Budgeting Capability
+
+ @param[in] Bus - Pci Bus Number
+ @param[in] Device - Pci Device Number
+ @param[in] Function - Pci Function Number
+ @param[in] CapId - Extended CAPID to search for
+
+ @retval 0 - CAPID not found
+ @retval Other - CAPID found, Offset of desired CAPID
+**/
+{
+ UINT16 CapHeaderOffset;
+ UINT16 CapHeaderId;
+
+ ///
+ /// Start to search at Offset 0x100
+ /// Get Capability Header
+ ///
+ CapHeaderId = 0;
+ CapHeaderOffset = 0x100;
+
+ while (CapHeaderOffset != 0 && CapHeaderId != 0xFFFF) {
+ ///
+ /// Search for desired CapID
+ ///
+ CapHeaderId = MmPci16 (0, Bus, Device, Function, CapHeaderOffset);
+ if (CapHeaderId == CapId) {
+ return CapHeaderOffset;
+ }
+
+ CapHeaderOffset = (MmPci16 (0, Bus, Device, Function, CapHeaderOffset + 2) >> 4);
+ }
+
+ return 0;
+}
+
+VOID
+PcieSetClkreq (
+ IN UINT8 Bus,
+ IN UINT8 Device
+ )
+/**
+ This function enables the CLKREQ# PM on all the end point functions
+
+ @param[in] Bus - Pci Bus Number
+ @param[in] Device - Pci Device Number
+**/
+{
+ UINT8 Function;
+ UINT32 CapOffset;
+
+ ///
+ /// Parse through all the functions of the endpoint and find the PCIe Cap ID (offset 10h) and if
+ /// exists then enable the CLKREQ# bit (BIT8) on that function
+ ///
+ for (Function = 0; Function < 8; Function++) {
+ ///
+ /// Find the PCIe Cap Id (offset 10h)
+ ///
+ CapOffset = PcieFindCapId (Bus, Device, Function, EFI_PCI_CAPABILITY_ID_PCIEXP);
+ if (CapOffset == 0) {
+ continue;
+ }
+ ///
+ /// Check if CLKREQ# is supported by the endpoints
+ ///
+ if ((MmPci32 (0, Bus, Device, Function, (CapOffset + 0x0C)) & BIT18) != BIT18) {
+ ///
+ /// CLKREQ# is not supported so dont do anything
+ ///
+ return ;
+ }
+ }
+ ///
+ /// Now enable the CLKREQ#
+ ///
+ for (Function = 0; Function < 8; Function++) {
+ ///
+ /// Find the PCIe Cap Id (offset 10h)
+ ///
+ CapOffset = PcieFindCapId (Bus, Device, Function, EFI_PCI_CAPABILITY_ID_PCIEXP);
+ if (CapOffset == 0) {
+ continue;
+ }
+
+ MmPci16Or (0, Bus, Device, Function, (CapOffset + 0x010), BIT8);
+ }
+}
+
+VOID
+AdditionalDMIProgramStepsBeforeASPM (
+ IN UINT64 DmiBar,
+ IN DXE_PLATFORM_SA_POLICY_PROTOCOL *DxePlatformSaPolicy
+ )
+/**
+ Additional DMI Programming Steps as in SA BIOS spec
+
+ @param[in] DmiBar - DMIBAR Address
+ @param[in] DxePlatformSaPolicy - SA DxePlatformPolicy protocol
+**/
+{
+ UINT32 Data32And;
+ UINT32 Data32Or;
+
+ ///
+ /// Configure the De-emphasis control on DMI
+ ///
+ Data32And = (UINT32) ~BIT6;
+ Data32Or = (UINT32) ((DxePlatformSaPolicy->PcieConfig->DmiDeEmphasis & 0x1) << 6);
+ Mmio32AndThenOr (DmiBar, R_SA_DMIBAR_LCTL2_OFFSET, Data32And, Data32Or);
+
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (DmiBar + R_SA_DMIBAR_LCTL2_OFFSET),
+ &Data32Or, ///< Data to be ORed
+ &Data32And ///< Data to be ANDed
+ );
+
+ ///
+ /// Set 0x22C[31] to 1 before enabling ASPM
+ ///
+ Data32And = (UINT32) ~(BIT31);
+ Data32Or = (UINT32) BIT31;
+ Mmio32AndThenOr (DmiBar, R_SA_DMIBAR_L0SLAT_OFFSET, Data32And, Data32Or);
+
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (DmiBar + R_SA_DMIBAR_L0SLAT_OFFSET),
+ &Data32Or, ///< Data to be ORed
+ &Data32And ///< Data to be ANDed
+ );
+
+ ///
+ /// Set 0x238 bit29 for DMI before enabling ASPM
+ ///
+ Data32And = 0xFFFFFFFF;
+ Data32Or = BIT29;
+ Mmio32Or (DmiBar, 0x238, Data32Or);
+
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (DmiBar + 0x238),
+ &Data32Or, ///< Data to be ORed
+ &Data32And ///< Data to be ANDed
+ );
+
+ ///
+ /// Set DMI Offset 0xC28 [4:0]
+ ///
+ Data32And = 0xFFFFFFE0;
+ Data32Or = 0x13;
+ Mmio32AndThenOr (DmiBar, R_SA_PEG_AFE_PM_TMR_OFFSET, Data32And, Data32Or);
+
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (DmiBar + R_SA_PEG_AFE_PM_TMR_OFFSET),
+ &Data32Or, ///< Data to be ORed
+ &Data32And ///< Data to be ANDed
+ );
+}
+
+VOID
+AdditionalPEGProgramStepsBeforeASPM (
+ IN UINT8 Bus,
+ IN UINT8 pegDev,
+ IN UINT8 pegFn,
+ IN DXE_PLATFORM_SA_POLICY_PROTOCOL *DxePlatformSaPolicy
+ )
+/**
+ Additional PEG Programming Steps as in SA BIOS spec
+
+ @param[in] Bus - Pci Bus Number
+ @param[in] pegDev - Pci Device Number
+ @param[in] pegFn - Pci Func Number
+ @param[in] DxePlatformSaPolicy - SA DxePlatformPolicy protocol
+**/
+{
+ UINT32 Data32Or;
+ UINT32 Data32And;
+ UINT32 PegBaseAddress;
+
+ PegBaseAddress = (UINT32) MmPciAddress (0x0, Bus, pegDev, pegFn, 0x0);
+
+ ///
+ /// Permanently set PEGUESEV[CTS](0x1CC bit14) to 1b during BIOS boot for all the PEG controllers
+ ///
+ Data32And = 0xFFFFFFFF;
+ Data32Or = BIT14;
+ Mmio32Or (PegBaseAddress, 0x1CC, Data32Or);
+
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PegBaseAddress + 0x1CC),
+ &Data32Or, ///< Data to be ORed
+ &Data32And ///< Data to be ANDed
+ );
+
+ ///
+ /// Configure the De-emphasis control on PEG
+ ///
+ Data32And = (UINT32)~BIT6;
+ Data32Or = (DxePlatformSaPolicy->PcieConfig->PegDeEmphasis[pegFn] & BIT0) << 6;
+ Mmio32AndThenOr (PegBaseAddress, R_SA_PEG_LCTL2_OFFSET, Data32And, Data32Or);
+
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PegBaseAddress + R_SA_PEG_LCTL2_OFFSET),
+ &Data32Or, ///< Data to be ORed
+ &Data32And ///< Data to be ANDed
+ );
+
+ ///
+ /// Set 0x22C[31] to 1 before enabling ASPM
+ ///
+ Data32And = (UINT32) ~(BIT31);
+ Data32Or = (UINT32) BIT31;
+ Mmio32AndThenOr (PegBaseAddress, R_SA_PEG_L0SLAT_OFFSET, Data32And, Data32Or);
+
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PegBaseAddress + R_SA_PEG_L0SLAT_OFFSET),
+ &Data32Or, ///< Data to be ORed
+ &Data32And ///< Data to be ANDed
+ );
+
+ ///
+ /// Program 0x250 bit[22:20] to 010b for all the PEG controllers before enabling ASPM
+ ///
+ Data32And = (UINT32)~(BIT22 + BIT21 + BIT20);
+ Data32Or = 0x02 << 20;
+ Mmio32AndThenOr (PegBaseAddress, 0x250, Data32And, Data32Or);
+
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PegBaseAddress + 0x250),
+ &Data32Or, ///< Data to be ORed
+ &Data32And ///< Data to be ANDed
+ );
+
+ ///
+ /// Set 0x238 bit29 for PEG controller before enabling ASPM
+ ///
+ Data32And = 0xFFFFFFFF;
+ Data32Or = BIT29;
+ Mmio32Or (PegBaseAddress, 0x238, Data32Or);
+
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PegBaseAddress + 0x238),
+ &Data32Or, ///< Data to be ORed
+ &Data32And ///< Data to be ANDed
+ );
+
+ ///
+ /// Set PEG Offset 0x1F8 bit16
+ ///
+ Data32And = 0xFFFFFFFF;
+ Data32Or = BIT16;
+ Mmio32Or (PegBaseAddress, 0x1F8, Data32Or);
+
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PegBaseAddress + 0x1F8),
+ &Data32Or, ///< Data to be ORed
+ &Data32And ///< Data to be ANDed
+ );
+
+ ///
+ /// Set PEG Offset 0xC28 [4:0]
+ ///
+ Data32And = 0xFFFFFFE0;
+ Data32Or = 0x13;
+ Mmio32AndThenOr (PegBaseAddress, R_SA_PEG_AFE_PM_TMR_OFFSET, Data32And, Data32Or);
+
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PegBaseAddress + R_SA_PEG_AFE_PM_TMR_OFFSET),
+ &Data32Or, ///< Data to be ORed
+ &Data32And ///< Data to be ANDed
+ );
+}
+
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/PciExpressInit.h b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/PciExpressInit.h
new file mode 100644
index 0000000..05037b9
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/PciExpressInit.h
@@ -0,0 +1,224 @@
+/** @file
+ Header file for PciExpress Initialization Driver.
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PCIEXPRESS_INITIALIZATION_DRIVER_H_
+#define _PCIEXPRESS_INITIALIZATION_DRIVER_H_
+
+#include "EdkIIGlueDxe.h"
+#include "SaAccess.h"
+#include "PchAccess.h"
+#include "pci23.h"
+#include "EfiScriptLib.h"
+#include "CpuRegs.h"
+#include "CpuPlatformLib.h"
+#include "cpu.h"
+
+#include EFI_PROTOCOL_CONSUMER (ExitPmAuth)
+#include EFI_PROTOCOL_DEPENDENCY (BootScriptSave)
+#include EFI_PROTOCOL_CONSUMER (SaPlatformPolicy)
+#include EFI_PROTOCOL_DEPENDENCY (SaGlobalNvsArea)
+
+#define DISABLED 0
+#define AUTO 1
+#define ENABLED 1
+
+#define GEN1 1
+#define GEN2 2
+
+typedef struct {
+ UINT8 Bus;
+ UINT8 Device;
+ UINT8 Function;
+ UINT8 Slot;
+ UINT8 Bus2;
+ UINT8 Device2;
+ UINT8 Function2;
+} PEG_PORT_DEVICE;
+
+///
+/// Function prototypes
+///
+/**
+ PCI Express Dxe Initialization.
+ Run before PCI Bus Init, where assignment of Bus, Memory,
+ and I/O Resources are assigned.
+
+ @param[in] DxePlatformSaPolicy - SA DxePlatformPolicy protocol
+
+ @retval EFI_SUCCESS - Pci Express successfully started and ready to be used
+ @exception EFI_UNSUPPORTED - Pci Express can't be initialized
+**/
+EFI_STATUS
+PciExpressInit (
+ IN DXE_PLATFORM_SA_POLICY_PROTOCOL *DxePlatformSaPolicy
+ )
+;
+
+/**
+ Find the Offset to a given Capabilities ID
+
+ @param[in] Bus - Pci Bus Number
+ @param[in] Device - Pci Device Number
+ @param[in] Function - Pci Function Number
+ @param[in] CapId - CAPID to search fo
+
+ @retval 0 - CAPID not found
+ @retval Other - CAPID found, Offset of desired CAPID
+**/
+UINT32
+PcieFindCapId (
+ IN UINT8 Bus,
+ IN UINT8 Device,
+ IN UINT8 Function,
+ IN UINT8 CapId
+ )
+;
+
+/**
+ Search and return the offset of desired Pci Express Capability ID
+
+ @param[in] Bus - Pci Bus Number
+ @param[in] Device - Pci Device Number
+ @param[in] Function - Pci Function Number
+ @param[in] CapId - Extended CAPID to search for
+
+ @retval 0 - CAPID not found
+ @retval Other - CAPID found, Offset of desired CAPID
+**/
+UINT32
+PcieFindExtendedCapId (
+ IN UINT8 Bus,
+ IN UINT8 Device,
+ IN UINT8 Function,
+ IN UINT16 CapId
+ )
+;
+
+/**
+ This function enables the CLKREQ# PM on all the end point functions
+
+ @param[in] Bus - Pci Bus Number
+ @param[in] Device - Pci Device Number
+**/
+VOID
+PcieSetClkreq (
+ IN UINT8 Bus,
+ IN UINT8 Device
+ )
+;
+
+/**
+ Perform Egress Port 0 Initialization.
+
+ @param[in] EgressPortBar - EPBAR Address
+**/
+EFI_STATUS
+Cid1EgressPort0Init (
+ IN UINT64 EgressPortBar
+ )
+;
+
+#ifdef PEG_FLAG
+/**
+ Conditionally perform PEG Port Initialization.
+ bugbug: organize this code in a way that can utilize the
+ PchS3ItemTypeInitPcieRootPortDownstream EFI_PCH_S3_DISPATCH_ITEM_TYPE
+
+ @param[in] DxePlatformSaPolicy - SA DxePlatformPolicy protocol
+**/
+EFI_STATUS
+Cid1PegPortInit (
+ IN DXE_PLATFORM_SA_POLICY_PROTOCOL *DxePlatformSaPolicy
+ )
+;
+#endif // PEG_FLAG
+
+/**
+ DMI Port Initialization for both CID1 (Port 1 in MCH) and CID2 (Port 0 in ICH).
+
+ @param[in] DmiBar - DMIBAR Address
+ @param[in] DxePlatformSaPolicy - SA DxePlatformPolicy protocol
+**/
+EFI_STATUS
+Cid1Cid2DmiPortInit (
+ IN UINT64 DmiBar,
+ IN DXE_PLATFORM_SA_POLICY_PROTOCOL *DxePlatformSaPolicy
+ )
+;
+
+/**
+ Perform Root Complex Topology Initialization for CID1.
+
+ @param[in] EgressPortBar - EPBAR Address
+ @param[in] DmiBar - DMIBAR Address
+ @param[in] PchRootComplexBar - ICH RCBA Address
+**/
+EFI_STATUS
+Cid1TopologyInit (
+ IN UINT64 EgressPortBar,
+ IN UINT64 DmiBar,
+ IN UINT32 PchRootComplexBar
+ )
+;
+
+/**
+ Perform Root Complex Topology Initialization for CID2.
+
+ @param[in] DmiBar - DMIBAR Address
+ @param[in] PchRootComplexBar - ICH RCBA Address
+**/
+EFI_STATUS
+Cid2TopologyInit (
+ IN UINT32 PchRootComplexBar,
+ IN UINT64 DmiBar
+ )
+;
+
+/**
+ Additional PEG Programming Steps as in SA BIOS spec
+
+ @param[in] Bus - Bus Number of PEG device
+ @param[in] pegDev - Dev Number of PEG device
+ @param[in] pegFn - Func Number of PEG device
+ @param[in] DxePlatformSaPolicy - SA DxePlatformPolicy protocol
+**/
+VOID
+AdditionalPEGProgramStepsBeforeASPM (
+ IN UINT8 Bus,
+ IN UINT8 pegDev,
+ IN UINT8 pegFn,
+ IN DXE_PLATFORM_SA_POLICY_PROTOCOL *DxePlatformSaPolicy
+ )
+;
+
+/**
+ Additional DMI Programming Steps as in SA BIOS spec
+
+ @param[in] DmiBar - DMIBAR Address
+ @param[in] DxePlatformSaPolicy - SA DxePlatformPolicy protocol
+**/
+VOID
+AdditionalDMIProgramStepsBeforeASPM (
+ IN UINT64 DmiBar,
+ IN DXE_PLATFORM_SA_POLICY_PROTOCOL *DxePlatformSaPolicy
+ )
+;
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/PcieComplex.c b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/PcieComplex.c
new file mode 100644
index 0000000..bf4b367
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/PcieComplex.c
@@ -0,0 +1,1371 @@
+/** @file
+ This file will perform SA PCIE Root Complex initialization.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "SaBuildFlags.h"
+#include "PciExpressInit.h"
+#include "EdkIIGluePcdPciExpressLib.h"
+#include "SaPcieLib.h"
+#include "PcieComplex.h"
+#include <Token.h>
+///
+/// Global variables
+///
+UINT8 HwStrap;
+extern UINT16 mSaIotrapSmiAddress;
+extern BOOLEAN mInitPcieAspmAfterOprom;
+extern DXE_PLATFORM_SA_POLICY_PROTOCOL *mDxePlatformSaPolicy;
+
+#ifdef PEG_FLAG
+PEG_PORT_DEVICE PegDeviceTable[] = {
+ ///
+ /// Bus, Device, Function, Slot, Bus2, Device2, Function2
+ ///
+ { SA_PEG_BUS_NUM, SA_PEG10_DEV_NUM, SA_PEG10_FUN_NUM, 1, 2, 0, 0 }
+// AMI_OVERRID >>
+#if RC_PEG_1 == 1
+ ,{ SA_PEG_BUS_NUM, SA_PEG11_DEV_NUM, SA_PEG11_FUN_NUM, 2, 3, 0, 0 }
+#endif
+#if RC_PEG_2 == 1
+ ,{ SA_PEG_BUS_NUM, SA_PEG12_DEV_NUM, SA_PEG12_FUN_NUM, 3, 4, 0, 0 }
+#endif
+// AMI_OVERRID <<
+};
+#endif // PEG_FLAG
+
+///
+/// Functions
+///
+VOID
+EFIAPI
+SaLateInitSmiCallback (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+/**
+ This function gets registered as a callback to perform all SA late initialization
+
+ @param[in] Event - A pointer to the Event that triggered the callback.
+ @param[in] Context - A pointer to private data registered with the callback function.
+**/
+{
+ if (mSaIotrapSmiAddress != 0) {
+ DEBUG ((EFI_D_INFO, "[SA] Issue IOTRAP SMI %X\n", mSaIotrapSmiAddress));
+ IoWrite8 (mSaIotrapSmiAddress, 0);
+ }
+ if (Event != NULL) {
+ gBS->CloseEvent(Event);
+ }
+ return;
+}
+
+EFI_STATUS
+Cid1EgressPort0Init (
+ IN UINT64 EgressPortBar
+ )
+/**
+ Perform Egress Port 0 Initialization.
+
+ @param[in] EgressPortBar - EPBAR Address
+
+ @retval EFI_SUCCESS - Egress Port 0 initialization successed.
+**/
+{
+ UINT32 Data32And;
+ UINT32 Data32Or;
+ UINT8 Data8And;
+ UINT8 Data8Or;
+ UINT8 BitMask;
+ UINT8 BitValue;
+
+ ///
+ /// Egress Port Configuration
+ ///
+ /// Egress Port Virtual Channel 0 Configuration
+ /// System BIOS must insure that only TC0 is mapped to VC0.
+ /// a. Set the Egress Port Register EPBAR offset 014h[7:1]=0000000b
+ ///
+ Data32And = BIT0;
+ Data32Or = 0;
+ Mmio32And (EgressPortBar, 0x14, Data32And);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (EgressPortBar + 0x14),
+ &Data32Or,
+ &Data32And
+ );
+
+ ///
+ /// System BIOS must program the extended VC count field.
+ /// b. Set the Egress Port Register EPBAR offset 004h[2:0]=001b
+ ///
+ Data8And = (UINT8)~(0x07);
+ Data8Or = BIT0;
+ Mmio8AndThenOr (EgressPortBar, 0x4, Data8And, Data8Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (EgressPortBar + 0x4),
+ &Data8Or,
+ &Data8And
+ );
+
+ ///
+ /// Egress Port VC1 Configuration
+ /// a. Assign Virtual Channel ID 1 to VC1: by programming PXEPBAR Offset 020[26:24] = '001b'
+ /// b. Select and map TC1 to VC1: by programming PXPEPBAR Offset 020h[7:1] = '0000001b'
+ ///
+ Data32And = (UINT32)~(0x070000FE);
+ Data32Or = ((0x01 << 24) + BIT1);
+ Mmio32AndThenOr (EgressPortBar, 0x20, Data32And, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (EgressPortBar + 0x20),
+ &Data32Or,
+ &Data32And
+ );
+
+ ///
+ /// c. Enable VC1 (no hardware behind this bit, s/w compatibility flag only) BIT31
+ /// Program EXPEPBAR Offset 020h[31]=1
+ ///
+ Data32And = 0xFFFFFFFF;
+ Data32Or = BIT31;
+ Mmio32Or (EgressPortBar, 0x20, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (EgressPortBar + 0x20),
+ &Data32Or,
+ &Data32And
+ );
+
+ ///
+ /// d. Poll the VC1 Negotiation Pending bit until it reads 0:
+ /// Read the Egress Port Register EPBAR Offset 026h until [1]==0
+ ///
+ BitMask = (UINT8) BIT1;
+ BitValue = 0;
+ while ((Mmio8 (EgressPortBar, 0x26) & BitMask) != BitValue) {
+ };
+ SCRIPT_MEM_POLL (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (EgressPortBar + 0x26),
+ &BitMask,
+ &BitValue,
+ 50,
+ 200000
+ );
+
+ return EFI_SUCCESS;
+}
+
+#ifdef PEG_FLAG
+EFI_STATUS
+Cid1PegPortInit (
+ IN DXE_PLATFORM_SA_POLICY_PROTOCOL *DxePlatformSaPolicy
+ )
+/**
+ Conditionally perform PEG Port Initialization.
+ bugbug: organize this code in a way that can utilize the
+ PchS3ItemTypeInitPcieRootPortDownstream EFI_PCH_S3_DISPATCH_ITEM_TYPE
+
+ @param[in] DxePlatformSaPolicy - SA DxePlatformPolicy protocol
+
+ @retval EFI_SUCCESS - PEG Port initialization successed.
+**/
+{
+ UINT32 Data32;
+ UINT32 Data32Or;
+ UINT32 Data32And;
+ UINT16 Data16Or;
+ UINT16 Data16And;
+ UINT8 Data8;
+ UINT32 PegBaseAddress;
+ UINT8 Bus;
+ UINT8 Dev;
+ UINT8 Func;
+ UINT8 Slot;
+ UINT8 Bus2;
+ UINT8 Dev2;
+ UINT8 Func2;
+ UINT8 PegComplete;
+ CPU_FAMILY CpuFamilyId;
+ CPU_STEPPING CpuSteppingId;
+
+ CpuFamilyId = GetCpuFamily();
+ CpuSteppingId = GetCpuStepping();
+
+ ///
+ /// Read HwStrap Register - PEG1CFGSEL D1.R 504h [17:16]
+ ///
+ HwStrap = (UINT8) ((McD1PciCfg32 (R_SA_PEG_FUSESCMN_OFFSET) & (BIT17 + BIT16)) >> 16);
+
+ ///
+ /// HSW - Scan/initialize PEG devices based on HW strapping.
+ ///
+ for (PegComplete = 0; PegComplete < ((sizeof (PegDeviceTable)) / (sizeof (PEG_PORT_DEVICE))); PegComplete++) {
+ ///
+ /// Get Peg Device BDF, Slot# and EndPoint(Temporary)
+ ///
+ Bus = PegDeviceTable[PegComplete].Bus;
+ Dev = PegDeviceTable[PegComplete].Device;
+ Func = PegDeviceTable[PegComplete].Function;
+ Slot = PegDeviceTable[PegComplete].Slot;
+ Bus2 = PegDeviceTable[PegComplete].Bus2;
+ Dev2 = PegDeviceTable[PegComplete].Device2;
+ Func2 = PegDeviceTable[PegComplete].Function2;
+
+ PegBaseAddress = (UINT32) MmPciAddress (0, Bus, Dev, Func, 0);
+ ///
+ /// Check if the PEG is Enabled. Since Graphics initialization has already
+ /// occurred, simply check for PEG presence.
+ /// bugbug: need to make sure this dependency is captured in the integration guide
+ ///
+ if (McDevFunPciCfg16 (Bus, Dev, Func, PCI_VID) != 0xFFFF) {
+ ///
+ /// PEG port enable and visible
+ ///
+ ///
+ /// Initialize Slot Implemented for PCI Express Port
+ ///
+ Data16And = 0xFFFF;
+ Data16Or = BIT8;
+
+ McDevFunPciCfg16Or (Bus, Dev, Func, R_SA_PEG_CAP_OFFSET, Data16Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PegBaseAddress + R_SA_PEG_CAP_OFFSET),
+ &Data16Or,
+ &Data16And
+ );
+
+ ///
+ /// Initialize "Physical Slot Number" for PCI Express Port
+ ///
+ Data32 = McDevFunPciCfg32 (Bus, Dev, Func, R_SA_PEG_SLOTCAP_OFFSET);
+ Data32 &= 0x0007FFFF;
+ ///
+ /// Set [31:19] - Slot # based on Peg Port
+ ///
+ Data32 |= (Slot << 19);
+
+ ///
+ /// Initialize Slot Power Limit for PCI Express Port and Power Limit Scale.
+ /// Note: this register is a write once.
+ ///
+ /// Set [14:7] - 75 Watts (Default)
+ ///
+ Data32 &= 0xFFFE007F;
+ Data32 |= (75 << 7);
+ ///
+ /// [16:15] - 1.0 Watt Scale
+ ///
+ Data32 |= (0 << 15);
+
+ McDevFunPciCfg32 (Bus, Dev, Func, R_SA_PEG_SLOTCAP_OFFSET) = Data32;
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PegBaseAddress + R_SA_PEG_SLOTCAP_OFFSET),
+ 1,
+ &Data32
+ );
+
+ ///
+ /// Additional Programming Steps
+ ///
+ /// Set PEG D.F.R 006h [15:0] = 0FFFFh
+ ///
+ Data32And = ~(0xFFFF0000);
+ Data32Or = 0xFFFF0000;
+
+ McDevFunPciCfg32AndThenOr (Bus, Dev, Func, 0x4, Data32And, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PegBaseAddress + 0x4),
+ &Data32Or,
+ &Data32And
+ );
+
+ ///
+ /// Set PEG D.F.R 01Eh [15:0] = 0FFFFh
+ ///
+ Data32And = ~(0xFFFF0000);
+ Data32Or = 0xFFFF0000;
+
+ McDevFunPciCfg32AndThenOr (Bus, Dev, Func, 0x1C, Data32And, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PegBaseAddress + 0x1C),
+ &Data32Or,
+ &Data32And
+ );
+
+ ///
+ /// Set PEG D.F.R 0AAh [15:0] = 0FFFFh
+ ///
+ Data32And = 0xFFFF;
+ Data32Or = 0xFFFF;
+
+ McDevFunPciCfg16Or (Bus, Dev, Func, 0xAA, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PegBaseAddress + 0xAA),
+ &Data32Or,
+ &Data32And
+ );
+
+ ///
+ /// Set PEG D.F.R 1C4h [31:0] = 0FFFFFFFFh
+ ///
+ Data32 = 0xFFFFFFFF;
+
+ McDevFunPciCfg32Or (Bus, Dev, Func, R_SA_PEG_PEGUESTS_OFFSET, Data32);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PegBaseAddress + R_SA_PEG_PEGUESTS_OFFSET),
+ 1,
+ &Data32
+ );
+
+ ///
+ /// Set PEG D.F.R 1D0h [31:0] = 0FFFFFFFFh
+ ///
+ Data32 = 0xFFFFFFFF;
+
+ McDevFunPciCfg32Or (Bus, Dev, Func, R_SA_PEG_PEGCESTS_OFFSET, Data32);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PegBaseAddress + R_SA_PEG_PEGCESTS_OFFSET),
+ 1,
+ &Data32
+ );
+
+ ///
+ /// Set PEG D.F.R 1F0h [31:0] = 0FFFFFFFFh
+ ///
+ Data32 = 0xFFFFFFFF;
+
+ McDevFunPciCfg32Or (Bus, Dev, Func, 0x1F0, Data32);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PegBaseAddress + 0x1F0),
+ 1,
+ &Data32
+ );
+ ///
+ /// If HSW CPU steppingId >= B0 or CRW, set BIT19 of DCAP2 register of the PEG port,to enable OBFF support using WAKE# signaling
+ ///
+ if (((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId >= EnumHswB0)) ||
+ (CpuFamilyId == EnumCpuCrw)) {
+ Data32 = (UINT32) BIT19;
+ McDevFunPciCfg32Or (Bus, Dev, Func, R_SA_PEG_DCAP2_OFFSET, Data32);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PegBaseAddress + R_SA_PEG_DCAP2_OFFSET),
+ 1,
+ &Data32
+ );
+ }
+ ///
+ /// Complete Common Port and Endpoint Configuration
+ ///
+ ///
+ /// Virtual Channel Configuration of PCI Express Port
+ /// Set the VC0RCTL register D1:F0 Offset 114h [7:1] = 7Fh
+ ///
+ Data32And = 0xFFFFFF01;
+ Data32Or = BIT7 | BIT6 | BIT5 | BIT4 | BIT3 | BIT2 | BIT1;
+
+ McDevFunPciCfg32AndThenOr (Bus, Dev, Func, R_SA_PEG_VC0RCTL0_OFFSET, Data32And, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PegBaseAddress + R_SA_PEG_VC0RCTL0_OFFSET),
+ &Data32Or,
+ &Data32And
+ );
+ ///
+ /// 6.8 Additional Programming Steps before Enabling ASPM for PEG device
+ ///
+ AdditionalPEGProgramStepsBeforeASPM (Bus, Dev, Func, DxePlatformSaPolicy);
+
+ ///
+ /// 6.10 Interrupt Routing for PCI Express*
+ /// It is recommened to re-route the legacy interrupts (INTA -> INTB,C,D)
+ /// to avoid overcrowded INTA. ACPI PRT needs update.
+ /// The ACPI _PRT() methods for PEG controllers must match the legacy interrupt routing.
+ ///
+ if ((Dev == 1) && (Func == 1)) {
+ Data32And = (UINT32)~(BIT25 | BIT24);
+ Data32Or = BIT24 | BIT25;
+ McDevFunPciCfg32AndThenOr (Bus, Dev, Func, R_SA_PEG_CFG4_OFFSET, Data32And, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PegBaseAddress + R_SA_PEG_CFG4_OFFSET),
+ &Data32Or,
+ &Data32And
+ );
+ }
+
+ if ((Dev == 1) && (Func == 2)) {
+ Data32And = (UINT32)~(BIT25 | BIT24);
+ Data32Or = BIT25;
+ McDevFunPciCfg32AndThenOr (Bus, Dev, Func, R_SA_PEG_CFG4_OFFSET, Data32And, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PegBaseAddress + R_SA_PEG_CFG4_OFFSET),
+ &Data32Or,
+ &Data32And
+ );
+ }
+ }
+
+ ///
+ /// Lock offset 3Dh for Interrupt Pin
+ ///
+ Data8 = McDevFunPciCfg8 (Bus, Dev, Func, PCI_INTPIN);
+ McDevFunPciCfg8 (Bus, Dev, Func, PCI_INTPIN) = Data8;
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (PegBaseAddress + PCI_INTPIN),
+ 1,
+ &Data8
+ );
+
+ ///
+ /// Lock DCAP register
+ ///
+ Data32 = McDevFunPciCfg32 (Bus, Dev, Func, R_SA_PEG_DCAP_OFFSET);
+ McDevFunPciCfg32 (Bus, Dev, Func, R_SA_PEG_DCAP_OFFSET) = Data32;
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PegBaseAddress + R_SA_PEG_DCAP_OFFSET),
+ 1,
+ &Data32
+ );
+
+ if ((CpuFamilyId == EnumCpuHsw) || (CpuFamilyId == EnumCpuCrw)
+ ){
+ if ((Bus == 0) && (Dev == 1) && (Func == 0)) {
+ Data32 = McDevFunPciCfg32 (Bus, Dev, Func, 0xCD0);
+ Data32 |= BIT11;
+ McDevFunPciCfg32 (Bus, Dev, Func, 0xCD0) = Data32;
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PegBaseAddress + 0xCD0),
+ 1,
+ &Data32
+ );
+ }
+ }
+
+ if ((HwStrap == SA_PEG_x16_x0_x0) && (PegComplete == 0)) {
+ break;
+ }
+ if ((HwStrap == SA_PEG_x8_x8_x0) && (PegComplete == 1)) {
+ break;
+ }
+ if ((HwStrap == SA_PEG_x8_x4_x4) && (PegComplete == 2)) {
+ break;
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+#endif // PEG_FLAG
+
+EFI_STATUS
+Cid1Cid2DmiPortInit (
+ IN UINT64 DmiBar,
+ IN DXE_PLATFORM_SA_POLICY_PROTOCOL *DxePlatformSaPolicy
+ )
+/**
+ DMI Port Initialization for both CID1 (Port 1 in MCH) and CID2 (Port 0 in PCH).
+
+ @param[in] DmiBar - DMIBAR Address
+ @param[in] DxePlatformSaPolicy - SA DxePlatformPolicy protocol
+
+ @retval EFI_SUCCESS - DMI Port initialization successed.
+**/
+{
+ UINT32 Data32Or;
+#ifdef DMI_FLAG
+ UINT8 Data8And;
+ UINT8 Data8Or;
+ CPU_FAMILY CpuFamilyId;
+
+ CpuFamilyId = GetCpuFamily();
+#endif // DMI_FLAG
+
+#ifdef DMI_FLAG
+ if ((CpuFamilyId == EnumCpuHsw) || (CpuFamilyId == EnumCpuCrw)) {
+ ///
+ /// Additional Programming Steps
+ ///
+ AdditionalDMIProgramStepsBeforeASPM (DmiBar, DxePlatformSaPolicy);
+ }
+#endif // DMI_FLAG
+
+ ///
+ /// Set DMIBAR Offset 1C4h [31:0] = 0FFFFFFFFh
+ ///
+ Data32Or = 0xFFFFFFFF;
+ Mmio32 (DmiBar, 0x1C4) = 0xFFFFFFFF;
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (DmiBar + 0x1C4),
+ 1,
+ &Data32Or
+ );
+
+ ///
+ /// Set DMIBAR Offset 1D0h [31:0] = 0FFFFFFFFh
+ ///
+ Data32Or = 0xFFFFFFFF;
+ Mmio32 (DmiBar, 0x1D0) = 0xFFFFFFFF;
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (DmiBar + 0x1D0),
+ 1,
+ &Data32Or
+ );
+
+#ifdef DMI_FLAG
+ if ((CpuFamilyId == EnumCpuHsw) || (CpuFamilyId == EnumCpuCrw)) {
+ ///
+ /// Enable `Active State PM'. DMILCTL register at DMIBAR 088h [1:0] = '11b'.
+ /// Based on the policy:
+ ///
+ if (DxePlatformSaPolicy->PcieConfig->DmiAspm == PcieAspmAutoConfig ||
+ DxePlatformSaPolicy->PcieConfig->DmiAspm == PcieAspmL0sL1
+ ) {
+ ///
+ /// Enable ASPM = L0s and L1 Entry
+ ///
+ Data8And = 0xFC;
+ Data8Or = 0x03;
+ Mmio8Or (DmiBar, 0x88, Data8Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (DmiBar + 0x088),
+ &Data8Or,
+ &Data8And
+ );
+ } else if (DxePlatformSaPolicy->PcieConfig->DmiAspm == PcieAspmL0s) {
+ ///
+ /// Enable ASPM = L0s
+ ///
+ Data8And = 0xFC;
+ Data8Or = 0x01;
+ Mmio8Or (DmiBar, 0x88, Data8Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (DmiBar + 0x088),
+ &Data8Or,
+ &Data8And
+ );
+ } else if (DxePlatformSaPolicy->PcieConfig->DmiAspm == PcieAspmL1) {
+ ///
+ /// Enable ASPM = L1
+ ///
+ Data8And = 0xFC;
+ Data8Or = 0x02;
+ Mmio8Or (DmiBar, 0x88, Data8Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (DmiBar + 0x088),
+ &Data8Or,
+ &Data8And
+ );
+ }
+
+ if (DxePlatformSaPolicy->PcieConfig->DmiExtSync == ENABLED) {
+ ///
+ /// Enable Extended Synch
+ ///
+ Data8And = 0xFF;
+ Data8Or = 0x10;
+ Mmio8Or (DmiBar, 0x88, Data8Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (DmiBar + 0x088),
+ &Data8Or,
+ &Data8And
+ );
+ }
+
+ if (DxePlatformSaPolicy->PcieConfig->DmiIot == ENABLED) {
+ ///
+ /// if DMI Iot is enabled, set DMIBAR offset 0xD34 = 0x44
+ ///
+ Data8Or = 0x44;
+ Mmio8 (DmiBar, 0xD34) = 0x44;
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (DmiBar + 0xD34),
+ 1,
+ (VOID *) (UINTN) (DmiBar + 0xD34)
+ );
+ }
+ }
+#endif // DMI_FLAG
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+Cid1TopologyInit (
+ IN UINT64 EgressPortBar,
+ IN UINT64 DmiBar,
+ IN UINT32 PchRootComplexBar
+ )
+/**
+ Perform Root Complex Topology Initialization for CID1.
+
+ @param[in] EgressPortBar - EPBAR Address
+ @param[in] DmiBar - DMIBAR Address
+ @param[in] PchRootComplexBar - PCH RCBA Address
+
+ @retval EFI_SUCCESS - Root Complex topology initialization for CID1 successed.
+**/
+{
+ UINT32 Data32;
+ UINT32 Data32And;
+ UINT32 Data32Or;
+ UINT32 DwordReg;
+ UINT64 McD1Base;
+ UINT64 McD1F1Base;
+ UINT64 McD1F2Base;
+
+ McD1Base = MmPciAddress (0, 0, 1, 0, 0);
+ McD1F1Base = MmPciAddress (0, 0, 1, 1, 0);
+ McD1F2Base = MmPciAddress (0, 0, 1, 2, 0);
+
+ ///
+ /// Set the CID1 Egress Port 0 Topology
+ ///
+ ///
+ /// Step 1, Set the SA Component ID = 1.
+ ///
+ Data32And = 0xFF00FFFF;
+ Data32Or = BIT16;
+ Mmio32AndThenOr (EgressPortBar, 0x44, Data32And, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (EgressPortBar + 0x44),
+ &Data32Or,
+ &Data32And
+ );
+
+ ///
+ /// Step 2, Set link 1 Target Component ID and valid (Bit 0 = 1b).
+ /// Set the Link 1 TCID = 1 (Bits 23:16 = 01h).
+ ///
+ Data32And = 0xFF00FFFF;
+ Data32Or = (BIT16 | BIT0);
+ Mmio32AndThenOr (EgressPortBar, 0x50, Data32And, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (EgressPortBar + 0x50),
+ &Data32Or,
+ &Data32And
+ );
+
+ ///
+ /// Step 3, Set Link 1 to Reference the DMI RCRB (Bits 31:0 = DMI Base).
+ ///
+ Data32 = (UINT32) DmiBar;
+ MmioWrite32 ((UINTN) EgressPortBar + 0x58, Data32);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (EgressPortBar + 0x58),
+ 1,
+ &Data32
+ );
+ Data32 = (UINT32) 0x00;
+ MmioWrite32 ((UINTN) EgressPortBar + 0x58 + 4, Data32);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (EgressPortBar + 0x58 + 4),
+ 1,
+ &Data32
+ );
+
+#ifdef PEG_FLAG
+ ///
+ /// CID1 Egress port Root Topology and PciExpress Port (PEG Ports) Topology
+ /// Programming only if PEG devices are enabled.
+ ///
+ /// Step 1 PCI Express Enabled Check
+ /// Check and Configure CID1 root and Device 1 function 0
+ ///
+ if (McD1PciCfg16 (PCI_VID) != 0xFFFF) {
+ ///
+ /// Step 4, Set Link 2 to Reference the Device 1 function 0.
+ ///
+ Data32 = (UINT32) 0x8000;
+ MmioWrite32 ((UINTN) EgressPortBar + 0x68, Data32);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (EgressPortBar + 0x68),
+ 1,
+ &Data32
+ );
+ Data32 = (UINT32) 0x00;
+ MmioWrite32 ((UINTN) EgressPortBar + 0x68 + 4, Data32);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (EgressPortBar + 0x68 + 4),
+ 1,
+ &Data32
+ );
+
+ ///
+ /// Step 5, Set link 2 Target Component ID and valid bit(Offset 60h, Bit 0 = 1b)
+ /// Set the Link 2 TCID = 1 (Bits 23:16 = 01h).
+ ///
+ Data32And = 0xFF00FFFF;
+ Data32Or = (BIT16 | BIT0);
+ Mmio32AndThenOr (EgressPortBar, 0x60, Data32And, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (EgressPortBar + 0x60),
+ &Data32Or,
+ &Data32And
+ );
+
+ ///
+ /// Set the CID1 PCI Express* Port Root Topology
+ ///
+ /// Step 2 Set the Link 1 CID = 1 144h(23:16 = 01h).
+ ///
+ Data32And = 0xFF00FFFF;
+ Data32Or = BIT16;
+ MmioAndThenOr32 ((UINTN) McD1Base + 0x144, Data32And, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (McD1Base + 0x144),
+ &Data32Or,
+ &Data32And
+ );
+
+ ///
+ /// Step 3. Set Link 1 to Reference the SA EP RCRB (Bits 31:0 = EPBAR).
+ ///
+ Data32 = (UINT32) EgressPortBar;
+ MmioWrite32 ((UINTN) McD1Base + 0x158, Data32);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (McD1Base + 0x158),
+ 1,
+ &Data32
+ );
+ Data32 = (UINT32) 0x00;
+ MmioWrite32 ((UINTN) McD1Base + 0x158 + 4, Data32);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (McD1Base + 0x158 + 4),
+ 1,
+ &Data32
+ );
+
+ ///
+ /// Step 4 Set link 1 Target Component ID and valid bit(Offset 150h, Bit 0 = 1b)
+ /// Set the Link 1 TCID = 1 (Bits 23:16 = 01h).
+ ///
+ Data32And = 0xFF00FFFF;
+ Data32Or = (BIT16 | BIT0);
+ MmioAndThenOr32 ((UINTN) McD1Base + 0x150, Data32And, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (McD1Base + 0x150),
+ &Data32Or,
+ &Data32And
+ );
+
+ ///
+ /// Step 5 Program Read-Only Write-Once Registers
+ /// D1.F0.R 0C4h [31:0]
+ ///
+ Data32And = 0xFFFFFFFF;
+ Data32Or = (UINT32) 0x00;
+ Data32 = McD1PciCfg32 (0xC4);
+ McD1PciCfg32 (0xC4) = Data32;
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (McD1Base + 0xC4),
+ &Data32Or,
+ &Data32And
+ );
+ }
+ ///
+ /// Check and Configure CID1 root and Device 1 function 1
+ ///
+ if (McD1F1PciCfg16 (PCI_VID) != 0xFFFF) {
+ ///
+ /// Step 6, Set Link 3 to Reference the Device 1 function 1.
+ ///
+ Data32 = (UINT32) 0x9000;
+ MmioWrite32 ((UINTN) EgressPortBar + 0x78, Data32);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (EgressPortBar + 0x78),
+ 1,
+ &Data32
+ );
+ Data32 = (UINT32) 0x00;
+ MmioWrite32 ((UINTN) EgressPortBar + 0x78 + 4, Data32);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (EgressPortBar + 0x78 + 4),
+ 1,
+ &Data32
+ );
+
+ ///
+ /// Step 7. Set the Link 3 Target Component ID and Valid Bit 70h [0]
+ ///
+ Data32And = 0xFF00FFFF;
+ Data32Or = (BIT16 | BIT0);
+ Mmio32AndThenOr (EgressPortBar, 0x70, Data32And, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (EgressPortBar + 0x70),
+ &Data32Or,
+ &Data32And
+ );
+
+ ///
+ /// Step 2 Set the Link 1 CID = 1 144h(23:16 = 01h).
+ ///
+ Data32And = 0xFF00FFFF;
+ Data32Or = BIT16;
+ MmioAndThenOr32 ((UINTN) McD1F1Base + 0x144, Data32And, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (McD1F1Base + 0x144),
+ &Data32Or,
+ &Data32And
+ );
+
+ ///
+ /// Step 3 Set Link 1 to Reference the IMC EP RCRB (Bits 31:0 = EPBAR).
+ ///
+ Data32 = (UINT32) EgressPortBar;
+ MmioWrite32 ((UINTN) McD1F1Base + 0x158, Data32);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (McD1F1Base + 0x158),
+ 1,
+ &Data32
+ );
+ Data32 = (UINT32) 0x00;
+ MmioWrite32 ((UINTN) McD1F1Base + 0x158 + 4, Data32);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (McD1F1Base + 0x158 + 4),
+ 1,
+ &Data32
+ );
+
+ ///
+ /// Step 4 Set link 1 Target Component ID and valid bit(Offset 150h, Bit 0 = 1b)
+ /// Set the Link 1 TCID = 1 (Bits 23:16 = 01h).
+ ///
+ Data32And = 0xFF00FFFF;
+ Data32Or = (BIT16 | BIT0);
+ MmioAndThenOr32 ((UINTN) McD1F1Base + 0x150, Data32And, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (McD1F1Base + 0x150),
+ &Data32Or,
+ &Data32And
+ );
+
+ ///
+ /// Step 5 Program Read-Only Write-Once Registers
+ ///
+ Data32And = 0xFFFFFFFF;
+ Data32Or = (UINT32) 0x00;
+ Data32 = McD1F1PciCfg32 (0xC4);
+ McD1F1PciCfg32 (0xC4) = Data32;
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (McD1F1Base + 0xC4),
+ &Data32Or,
+ &Data32And
+ );
+ }
+ ///
+ /// Check and Configure CID1 root and Device 1 function 2
+ ///
+ if (McD1F2PciCfg16 (PCI_VID) != 0xFFFF) {
+ ///
+ /// Step 8, Set Link 4 to Reference the Device 1 function 2.
+ ///
+ Data32 = (UINT32) 0xA000;
+ MmioWrite32 ((UINTN) EgressPortBar + 0x88, Data32);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (EgressPortBar + 0x88),
+ 1,
+ &Data32
+ );
+ Data32 = (UINT32) 0x00;
+ MmioWrite32 ((UINTN) EgressPortBar + 0x88 + 4, Data32);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (EgressPortBar + 0x88 + 4),
+ 1,
+ &Data32
+ );
+
+ ///
+ /// Step 9, Set the Link 4 Target Component ID and Valid Bit 80h [0]
+ ///
+ Data32And = 0xFF00FFFF;
+ Data32Or = (BIT16 | BIT0);
+ Mmio32AndThenOr (EgressPortBar, 0x80, Data32And, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (EgressPortBar + 0x80),
+ &Data32Or,
+ &Data32And
+ );
+
+ ///
+ /// Step 2. Set the Link 1 CID = 1 144h(23:16 = 01h).
+ ///
+ Data32And = 0xFF00FFFF;
+ Data32Or = BIT16;
+ MmioAndThenOr32 ((UINTN) McD1F2Base + 0x144, Data32And, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (McD1F2Base + 0x144),
+ &Data32Or,
+ &Data32And
+ );
+
+ ///
+ /// Step 3. Set Link 1 to Reference the IMC EP RCRB (Bits 31:0 = EPBAR).
+ ///
+ Data32 = (UINT32) EgressPortBar;
+ MmioWrite32 ((UINTN) McD1F2Base + 0x158, Data32);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (McD1F2Base + 0x158),
+ 1,
+ &Data32
+ );
+ Data32 = (UINT32) 0x00;
+ MmioWrite32 ((UINTN) McD1F2Base + 0x158 + 4, Data32);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (McD1F2Base + 0x158 + 4),
+ 1,
+ &Data32
+ );
+
+ ///
+ /// Step 4. Set link 1 Target Component ID and valid bit(Offset 150h, Bit 0 = 1b)
+ /// Set the Link 1 TCID = 1 (Bits 23:16 = 01h).
+ ///
+ Data32And = 0xFF00FFFF;
+ Data32Or = (BIT16 | BIT0);
+ MmioAndThenOr32 ((UINTN) McD1F2Base + 0x150, Data32And, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (McD1F2Base + 0x150),
+ &Data32Or,
+ &Data32And
+ );
+
+ ///
+ /// Step 5. Program Read-Only Write-Once Registers
+ ///
+ Data32And = 0xFFFFFFFF;
+ Data32Or = (UINT32) 0x00;
+ Data32 = McD1F2PciCfg32 (0xC4);
+ McD1F2PciCfg32 (0xC4) = Data32;
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (McD1F2Base + 0xC4),
+ &Data32Or,
+ &Data32And
+ );
+ }
+#endif // PEG_FLAG
+
+ ///
+ /// Set the CID1 DMI Port Root Topology
+ ///
+ /// Step 1 Set the CID = 1 ( Bits 23:16 = 01h).
+ ///
+ Data32And = 0xFF00FFFF;
+ Data32Or = BIT16;
+ Mmio32AndThenOr (DmiBar, 0x44, Data32And, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (DmiBar + 0x44),
+ &Data32Or,
+ &Data32And
+ );
+
+ ///
+ /// Step 2. Set Link 1 Target Port Number = 0 (Bits 31:24 = 00h).
+ /// Step 3. Set Link 1 TCID = 2 (Bits 23:16 = 02h).
+ /// Step 4. Set Link 1 as valid (Bit 0 = 1b).
+ ///
+ Data32And = 0x0000FFFF;
+ Data32Or = (BIT17 + BIT0);
+ Mmio32AndThenOr (DmiBar, 0x50, Data32And, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (DmiBar + 0x50),
+ &Data32Or,
+ &Data32And
+ );
+
+ ///
+ /// Step 5, Set Link 1 to Reference the PCH RCRB
+ ///
+ Data32 = PchRootComplexBar;
+ Mmio32 (DmiBar, 0x58) = PchRootComplexBar;
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (DmiBar + 0x58),
+ 1,
+ &Data32
+ );
+ Data32 = (UINT32) 0x00;
+ Mmio32 (DmiBar, 0x58 + 4) = Data32;
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (DmiBar + 0x58 + 4),
+ 1,
+ &Data32
+ );
+
+ ///
+ /// Step 6, Set Link 2 to Reference the IMC EP (Bits 31:0 = EP).
+ ///
+ Data32 = (UINT32) EgressPortBar;
+ MmioWrite32 ((UINTN) DmiBar + 0x68, Data32);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (DmiBar + 0x68),
+ 1,
+ &Data32
+ );
+ Data32 = (UINT32) 0x00;
+ MmioWrite32 ((UINTN) DmiBar + 0x68 + 4, Data32);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (DmiBar + 0x68 + 4),
+ 1,
+ &Data32
+ );
+
+ ///
+ /// Step 7, Set link 2 Target Component ID and valid Bit(Bit 0 = 1b)
+ /// Set the Link 2 TCID = 1 (Bits 23:16 = 01h).
+ ///
+ Data32And = 0xFF00FFFF;
+ Data32Or = (BIT16 | BIT0);
+ Mmio32AndThenOr (DmiBar, 0x60, Data32And, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (DmiBar + 0x60),
+ &Data32Or,
+ &Data32And
+ );
+
+ ///
+ /// Step 8. Program RO and Write-Once Registers
+ /// DMIBAR Offset 004h [31:0]
+ /// DMIBAR Offset 084h [31:0]
+ ///
+ DwordReg = Mmio32 (DmiBar, 0x4);
+ Mmio32 (DmiBar, 0x4) = DwordReg;
+
+ DwordReg = Mmio32 (DmiBar, 0x84);
+ Mmio32 (DmiBar, 0x84) = DwordReg;
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+Cid2TopologyInit (
+ IN UINT32 PchRootComplexBar,
+ IN UINT64 DmiBar
+ )
+/**
+ Perform Root Complex Topology Initialization for CID2.
+ Note: This sequence follows PCH BIOS specification Ver 0.5 section 8.3
+ Root Complex Topology Programming
+
+ @param[in] PchRootComplexBar - PCH RCBA Address
+ @param[in] DmiBar - DMIBAR Address
+
+ @retval EFI_SUCCESS - Root Complex topology initialization for CID2 successed.
+**/
+{
+ UINT32 Data32;
+ UINT32 Data32And;
+ UINT32 Data32Or;
+
+ ///
+ /// PCH BIOS specification Ver 0.5 section 8.3 Note 1,2
+ /// program a value into this Component ID field to determine the Component ID of
+ /// ICH8, and this value must be different from the Component ID value of the MCH.
+ /// Set the CID = 2 (Offset 104h, Bits 23:16 = 02h).
+ ///
+ Data32And = 0xFF00FFFF;
+ Data32Or = BIT17;
+ MmioAndThenOr32 (PchRootComplexBar + 0x104, Data32And, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PchRootComplexBar + 0x104),
+ &Data32Or,
+ &Data32And
+ );
+
+ ///
+ /// PCH BIOS specification Ver 0.5 section 8.3 Note 3,4
+ /// Note 3: This Target Port # field must be filled in by System BIOS with the Port
+ /// # of the RCRB DMI link in the MCH.
+ /// Note 4: This Target CID field must be filled in by System BIOS with the
+ /// Component ID of the MCH.
+ /// Set the Link 1 Target Port Number = 1 (Offset 110h, bits 31:24 = 01h).
+ /// Set the Link 1 Target Component ID = 1 (Offset 110h, bits 23:16 = 01h).
+ ///
+ Data32And = 0x0000FFFF;
+ Data32Or = (BIT24 | BIT16);
+ MmioAndThenOr32 (PchRootComplexBar + 0x110, Data32And, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PchRootComplexBar + 0x110),
+ &Data32Or,
+ &Data32And
+ );
+
+ ///
+ /// PCH BIOS specification Ver 0.5 section 8.3 Note 5
+ /// Fill the Base Address field with the same base address of the RCRB DMI link in
+ /// the MCH, This register field is located at RCBA+ 0118h[63:0],
+ /// and will be locked once written until the next reset.
+ ///
+ Data32 = (UINT32) DmiBar;
+ MmioWrite32 (PchRootComplexBar + 0x118, Data32);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (PchRootComplexBar + 0x118),
+ 1,
+ &Data32
+ );
+
+ Data32 = *((UINT32 *) (&DmiBar) + 1);
+ MmioWrite32 (PchRootComplexBar + 0x118 + 4, Data32);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (PchRootComplexBar + 0x118 + 4),
+ 1,
+ &Data32
+ );
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+PegInitBeforeExitPmAuth (
+ VOID
+ )
+/**
+ This function performs Peg initialization before ExitPmAuth.
+
+ @retval EFI_SUCCESS - Always.
+**/
+{
+#if SA_PCIE_ASPM_IN_SMM == 1
+ EFI_EVENT ReadyToBoot;
+ EFI_STATUS Status;
+#endif
+ BOOLEAN AspmHasBeenHandled;
+
+ DEBUG ((EFI_D_ERROR, "[SA] Pcie before ExitPmAuth callback.\n"));
+ AspmHasBeenHandled = FALSE;
+ ///
+ /// SMM mode ASPM handling
+ /// Check if supported and enabled
+ ///
+#if SA_PCIE_ASPM_IN_SMM == 1
+ if ((mInitPcieAspmAfterOprom == 1) && (mSaIotrapSmiAddress != 0)) {
+ ///
+ /// Do the Phase 1 SMI callback
+ /// This will enumerate PCIe downstream devices
+ ///
+ SaLateInitSmiCallback (NULL, NULL);
+
+ ///
+ /// Create an ReadyToBoot call back event to do the Phase 3 SMI callback
+ /// This will handle PEG ASPM programming after OROM execution
+ ///
+ Status = EfiCreateEventReadyToBootEx (
+ EFI_TPL_NOTIFY,
+ SaLateInitSmiCallback,
+ NULL,
+ &ReadyToBoot
+ );
+ ASSERT_EFI_ERROR (Status);
+ AspmHasBeenHandled = TRUE;
+ }
+#endif
+
+ ///
+ /// DXE mode ASPM handling
+ /// Check if SMM mode already taken care all things
+ /// TRUE to skip DXE mode task. Otherwise do DXE mode ASPM initialization
+ ///
+#if SA_PCIE_ASPM_IN_DXE == 1
+ if (AspmHasBeenHandled == FALSE) {
+ ///
+ /// Initialize ASPM before OpROM, S3 Save script supported
+ /// First initialize all policy settings
+ /// Initialize module global variables - Stepping ID and Platform Policy
+ ///
+ SaPcieInitPolicy (mDxePlatformSaPolicy);
+ ///
+ /// Do initialization
+ ///
+ SaPcieEnumCallback ();
+ SaPcieConfigAfterOpRom ();
+ }
+#endif
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+SaSecurityInit (
+ VOID
+ )
+/**
+ This function performs SA Security locking in ExitPmAuth callback
+
+ @retval EFI_SUCCESS - Security lock has done
+ @retval EFI_UNSUPPORTED - Security lock not done successfully
+**/
+{
+ BOOLEAN SecurityHasBeenHandled;
+ SecurityHasBeenHandled = FALSE;
+#if SA_PCIE_ASPM_IN_SMM == 1
+ if ((mInitPcieAspmAfterOprom == 1) && (mSaIotrapSmiAddress != 0)) {
+ ///
+ /// Generate the Phase 2 of SA SMI to do security lock
+ ///
+ SaLateInitSmiCallback (NULL, NULL);
+
+ SecurityHasBeenHandled = TRUE;
+ }
+#endif
+
+ ///
+ /// Check if SMM mode already taken care this task
+ ///
+#if SA_PCIE_ASPM_IN_DXE == 1
+ if (SecurityHasBeenHandled == FALSE) {
+ SaSaveRestorePlatform (TRUE);
+ SaSecurityLock ();
+ SecurityHasBeenHandled = TRUE;
+ }
+#endif
+ ///
+ /// Security locking is important so fail to do this will be an ERROR.
+ ///
+ if (SecurityHasBeenHandled == TRUE) {
+ return EFI_SUCCESS;
+ } else {
+ return EFI_UNSUPPORTED;
+ }
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/PcieComplex.h b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/PcieComplex.h
new file mode 100644
index 0000000..8a52de9
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/PcieComplex.h
@@ -0,0 +1,43 @@
+/** @file
+ This is header file for SA PCIE Root Complex initialization.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+EFI_STATUS
+PegInitBeforeExitPmAuth (
+ VOID
+ )
+/**
+ This function performs Peg initialization before ExitPmAuth.
+
+ @retval EFI_SUCCESS - Always.
+**/
+;
+
+EFI_STATUS
+SaSecurityInit (
+ VOID
+ )
+/**
+ This function performs SA Security locking in ExitPmAuth callback
+
+ @retval EFI_SUCCESS - Security lock has done
+ @retval EFI_UNSUPPORTED - Security lock not done successfully
+**/
+;
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/SaFvi.c b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/SaFvi.c
new file mode 100644
index 0000000..d88a5e7
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/SaFvi.c
@@ -0,0 +1,105 @@
+/** @file
+ SA Firmware Version Info implementation.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "SaInit.h"
+
+FVI_ELEMENT_AND_FUNCTION mSaFviElementsData[] = {
+ {
+ DEFAULT_FVI_ELEMENT_DATA(SA),
+ NULL
+ },
+ {
+ {
+ 1,
+ 0,
+ MEM_RC_VERSION,
+ MEM_FVI_STRING,
+ {
+ 0
+ },
+ },
+ NULL
+ },
+ {
+ {
+ 1,
+ 0,
+ PCIE_RC_VERSION,
+ PCIE_FVI_STRING,
+ {
+ 0
+ },
+ },
+ NULL
+ },
+ {
+ {
+ 1,
+ 2,
+ SA_CRID_VERSION,
+ SA_CRID_STATUS,
+ SA_CRID_DISABLED,
+ },
+ NULL
+ },
+ {
+ {
+ 1,
+ 0,
+ SA_CRID_VERSION,
+ SA_CRID_ORIGINAL_VALUE,
+ {
+ 0
+ },
+ },
+ NULL
+ },
+ {
+ {
+ 1,
+ 0,
+ SA_CRID_VERSION,
+ SA_CRID_NEW_VALUE,
+ {
+ 0
+ },
+ },
+ NULL
+ },
+ {
+ {
+ 1,
+ 0,
+ VBIOS_RC_VERSION,
+ VBIOS_FVI_STRING,
+ {
+ 0
+ },
+ },
+ NULL
+ }
+};
+
+FVI_DATA_HUB_CALLBACK_CONTEXT mSaFviVersionData = {
+ MISC_SUBCLASS_FVI_HEADER_ENTRY(SA),
+ mSaFviElementsData,
+};
+
+UINTN mSaFviElements = sizeof (mSaFviElementsData) / sizeof (FVI_ELEMENT_AND_FUNCTION);
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/SaInit.c b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/SaInit.c
new file mode 100644
index 0000000..af4d45a
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/SaInit.c
@@ -0,0 +1,842 @@
+/** @file
+ This is the driver that initializes the Intel System Agent.
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "SaInit.h"
+#include EFI_GUID_DEFINITION (SaDataHob)
+#include <Protocol/PciEnumerationComplete.h>
+#include EFI_PROTOCOL_DEPENDENCY (SaGlobalNvsArea)
+#include EFI_GUID_DEFINITION (SaSsdtTableStorage)
+
+///
+/// Global Variables
+///
+SYSTEM_AGENT_GLOBAL_NVS_AREA_PROTOCOL mSaGlobalNvsAreaProtocol;
+DXE_PLATFORM_SA_POLICY_PROTOCOL *mDxePlatformSaPolicy;
+UINT16 mSaIotrapSmiAddress;
+BOOLEAN mInitPcieAspmAfterOprom;
+EFI_GUID gEfiPciEnumerationCompleteProtocolGuid = EFI_PCI_ENUMERATION_COMPLETE_GUID;
+
+EFI_STATUS
+InitializeSaSsdtAcpiTables (
+ VOID
+ )
+/**
+@brief
+ Initialize System Agent SSDT ACPI tables
+
+ @retval EFI_SUCCESS ACPI tables are initialized successfully
+ @retval EFI_NOT_FOUND ACPI tables not found
+**/
+{
+ EFI_STATUS Status;
+ EFI_HANDLE *HandleBuffer;
+ UINTN NumberOfHandles;
+ EFI_FV_FILETYPE FileType;
+ UINT32 FvStatus;
+ EFI_FV_FILE_ATTRIBUTES Attributes;
+ UINTN Size;
+ UINTN i;
+ EFI_FIRMWARE_VOLUME_PROTOCOL *FwVol;
+ INTN Instance;
+ EFI_ACPI_COMMON_HEADER *CurrentTable;
+ UINTN AcpiTableKey;
+ UINT8 *CurrPtr;
+ UINT8 *EndPtr;
+ UINT32 *Signature;
+ EFI_ACPI_DESCRIPTION_HEADER *SaAcpiTable;
+ EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
+
+ FwVol = NULL;
+ SaAcpiTable = NULL;
+
+ ///
+ /// Locate ACPI Table protocol
+ ///
+ DEBUG ((EFI_D_INFO, "Init SA SSDT table\n"));
+ Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, &AcpiTable);
+ if (Status != EFI_SUCCESS) {
+ DEBUG ((EFI_D_ERROR, "Fail to locate EfiAcpiTableProtocol.\n"));
+ return EFI_NOT_FOUND;
+ }
+
+ ///
+ /// Locate protocol.
+ /// There is little chance we can't find an FV protocol
+ ///
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiFirmwareVolumeProtocolGuid,
+ NULL,
+ &NumberOfHandles,
+ &HandleBuffer
+ );
+ ASSERT_EFI_ERROR (Status);
+ ///
+ /// Looking for FV with ACPI storage file
+ ///
+ for (i = 0; i < NumberOfHandles; i++) {
+ ///
+ /// Get the protocol on this handle
+ /// This should not fail because of LocateHandleBuffer
+ ///
+ Status = gBS->HandleProtocol (
+ HandleBuffer[i],
+ &gEfiFirmwareVolumeProtocolGuid,
+ &FwVol
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// See if it has the ACPI storage file
+ ///
+ Size = 0;
+ FvStatus = 0;
+ Status = FwVol->ReadFile (
+ FwVol,
+ &gSaSsdtAcpiTableStorageGuid,
+ NULL,
+ &Size,
+ &FileType,
+ &Attributes,
+ &FvStatus
+ );
+
+ ///
+ /// If we found it, then we are done
+ ///
+ if (Status == EFI_SUCCESS) {
+ break;
+ }
+ }
+ ///
+ /// Free any allocated buffers
+ ///
+ FreePool (HandleBuffer);
+
+ ///
+ /// Sanity check that we found our data file
+ ///
+ ASSERT (FwVol != NULL);
+ if (FwVol == NULL) {
+ DEBUG ((EFI_D_INFO, "SA Global NVS table not found\n"));
+ return EFI_NOT_FOUND;
+ }
+ ///
+ /// Our exit status is determined by the success of the previous operations
+ /// If the protocol was found, Instance already points to it.
+ /// Read tables from the storage file.
+ ///
+ Instance = 0;
+ CurrentTable = NULL;
+ while (Status == EFI_SUCCESS) {
+ Status = FwVol->ReadSection (
+ FwVol,
+ &gSaSsdtAcpiTableStorageGuid,
+ EFI_SECTION_RAW,
+ Instance,
+ &CurrentTable,
+ &Size,
+ &FvStatus
+ );
+
+ if (!EFI_ERROR (Status)) {
+ ///
+ /// Check the table ID to modify the table
+ ///
+ if (((EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable)->OemTableId == EFI_SIGNATURE_64 ('S', 'a', 'S', 's', 'd', 't', ' ', 0)) {
+ SaAcpiTable = (EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable;
+ ///
+ /// Locate the SSDT package
+ ///
+ CurrPtr = (UINT8 *) SaAcpiTable;
+ EndPtr = CurrPtr + SaAcpiTable->Length;
+
+ for (; CurrPtr <= EndPtr; CurrPtr++) {
+ Signature = (UINT32 *) (CurrPtr + 3);
+ if (*Signature == EFI_SIGNATURE_32 ('S', 'A', 'N', 'V')) {
+ ASSERT_EFI_ERROR (*(UINT32 *) (CurrPtr + 3 + sizeof (*Signature) + 2) == 0xFFFF0000);
+ ASSERT_EFI_ERROR (*(UINT16 *) (CurrPtr + 3 + sizeof (*Signature) + 2 + sizeof (UINT32) + 1) == 0xAA55);
+ ///
+ /// SA Global NVS Area address
+ ///
+ *(UINT32 *) (CurrPtr + 3 + sizeof (*Signature) + 2) = (UINT32) (UINTN) mSaGlobalNvsAreaProtocol.Area;
+ ///
+ /// SA Global NVS Area size
+ ///
+ *(UINT16 *) (CurrPtr + 3 + sizeof (*Signature) + 2 + sizeof (UINT32) + 1) =
+ sizeof (SYSTEM_AGENT_GLOBAL_NVS_AREA);
+
+ AcpiTableKey = 0;
+ Status = AcpiTable->InstallAcpiTable (
+ AcpiTable,
+ SaAcpiTable,
+ SaAcpiTable->Length,
+ &AcpiTableKey
+ );
+ ASSERT_EFI_ERROR (Status);
+ return EFI_SUCCESS;
+ }
+ }
+ }
+ ///
+ /// Increment the instance
+ ///
+ Instance++;
+ CurrentTable = NULL;
+ }
+ }
+
+ return Status;
+
+}
+
+EFI_STATUS
+EFIAPI
+SaInitEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+/**
+ SystemAgent DXE Initialization.
+
+ @param[in] ImageHandle Handle for the image of this driver
+ @param[in] SystemTable Pointer to the EFI System Table
+
+ @retval EFI_SUCCESS The function completed successfully
+ @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
+**/
+{
+ EFI_STATUS Status;
+ VOID *Registration;
+ SA_INSTANCE_PRIVATE_DATA *SaInstance;
+ UINTN MCHBAR_BASE;
+ SA_DATA_HOB *SaDataHob;
+
+ DEBUG ((EFI_D_INFO, "SaInitDxe Start\n"));
+
+ INITIALIZE_SCRIPT (ImageHandle, SystemTable);
+ SaInstance = NULL;
+
+ MCHBAR_BASE = McD0PciCfg64 (R_SA_MCHBAR) &~BIT0;
+
+ ///
+ /// Get the platform setup policy.
+ ///
+ Status = gBS->LocateProtocol (&gDxePlatformSaPolicyGuid, NULL, (VOID **) &mDxePlatformSaPolicy);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Dump SA Platform Policy
+ ///
+ SaDxePolicyDump (mDxePlatformSaPolicy);
+
+ ///
+ /// Get SaDataHob HOB and see if ASPM should be programmed before or after OpROM.
+ ///
+ mSaIotrapSmiAddress = 0;
+ mInitPcieAspmAfterOprom = 0;
+ SaDataHob = NULL;
+ SaDataHob = (SA_DATA_HOB *)GetFirstGuidHob (&gSaDataHobGuid);
+ if (SaDataHob != NULL) {
+ mSaIotrapSmiAddress = SaDataHob->SaIotrapSmiAddress;
+ mInitPcieAspmAfterOprom = SaDataHob->InitPcieAspmAfterOprom;
+ }
+
+ ///
+ /// If there was no DXE ASPM code, always executes SMM code
+ ///
+#if SA_PCIE_ASPM_IN_DXE == 0
+ mInitPcieAspmAfterOprom = 1;
+#endif
+ ///
+ /// If there was no SMM mode supported, always enable DXE mode
+ ///
+#if SA_PCIE_ASPM_IN_SMM == 0
+ mInitPcieAspmAfterOprom = 0;
+#endif
+
+ ///
+ /// Install System Agent Global NVS protocol
+ ///
+ DEBUG ((EFI_D_INFO, "Install SA GNVS protocol\n"));
+ Status = (gBS->AllocatePool) (EfiACPIMemoryNVS, sizeof (SYSTEM_AGENT_GLOBAL_NVS_AREA), &mSaGlobalNvsAreaProtocol.Area);
+ ASSERT_EFI_ERROR (Status);
+ ZeroMem ((VOID *) mSaGlobalNvsAreaProtocol.Area, sizeof (SYSTEM_AGENT_GLOBAL_NVS_AREA));
+ mSaGlobalNvsAreaProtocol.Area->SaRcRevision = SA_RC_VERSION;
+ mSaGlobalNvsAreaProtocol.Area->XPcieCfgBaseAddress = (UINT32) (MmPciAddress (0, 0, 0, 0, 0x0));
+
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &ImageHandle,
+ &gSaGlobalNvsAreaProtocolGuid,
+ &mSaGlobalNvsAreaProtocol,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// PciExpress Dxe Initialization
+ ///
+ DEBUG ((EFI_D_INFO, "Initializing PciExpress (Dxe)\n"));
+ PciExpressInit (mDxePlatformSaPolicy);
+
+ ///
+ /// Internal devices and Misc configurations.
+ ///
+ DEBUG ((EFI_D_INFO, "Internal Device and Misc Configurations\n"));
+ DeviceConfigure (mDxePlatformSaPolicy);
+ ProgramSvidSid (mDxePlatformSaPolicy);
+
+ ///
+ /// LegacyRegion Driver
+ ///
+ DEBUG ((EFI_D_INFO, "Initializing Legacy Region\n"));
+ LegacyRegionInstall (ImageHandle);
+
+ ///
+ /// GtPostInit Initialization
+ ///
+ DEBUG ((EFI_D_INFO, "Initializing GT PowerManagement and other GT POST related\n"));
+ GraphicsInit (ImageHandle, mDxePlatformSaPolicy);
+
+ ///
+ /// Audio (dHDA) Initialization
+ ///
+ DEBUG ((EFI_D_INFO, "Initializing CPU Audio (dHDA) device\n"));
+ AudioInit (ImageHandle, mDxePlatformSaPolicy);
+
+ //
+ // @todo remove this VP SKIP and prepare for PO settings to skip this code.
+ //
+ ///
+ /// Vtd Initialization
+ ///
+ DEBUG ((EFI_D_INFO, "Initializing VT-d\n"));
+ VtdInit (mDxePlatformSaPolicy);
+
+ ///
+ /// IgdOpRegion Install Initialization
+ ///
+ DEBUG ((EFI_D_INFO, "Initializing IGD OpRegion\n"));
+ IgdOpRegionInit ();
+
+
+ ///
+ /// Create PCI Enumeration Completed callback for SA
+ ///
+ EfiCreateProtocolNotifyEvent (
+ &gEfiPciEnumerationCompleteProtocolGuid,
+ EFI_TPL_CALLBACK,
+ SaPciEnumCompleteCallback,
+ NULL,
+ &Registration
+ );
+
+ ///
+ /// Create ExitPmAuth callback for SA
+ ///
+ EfiCreateProtocolNotifyEvent (
+ &gExitPmAuthProtocolGuid,
+ EFI_TPL_CALLBACK,
+ SaExitPmAuthCallback,
+ NULL,
+ &Registration
+ );
+
+ ///
+ /// Install SA_INFO_PROTOCOL
+ ///
+ SaInstance = AllocateZeroPool (sizeof (SA_INSTANCE_PRIVATE_DATA));
+ if (SaInstance == NULL) {
+ ASSERT (FALSE);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ SaInstance->SaInfo.Revision = SA_INFO_PROTOCOL_REVISION_1;
+ ///
+ /// RCVersion[31:0] is the release number.
+ /// For example:
+ /// SaFramework 0.6.0.01 should be 00 06 00 01 (0x00060001)
+ /// SaFramework 0.6.2 should be 00 06 02 00 (0x00060200)
+ ///
+ SaInstance->SaInfo.RCVersion = SA_RC_VERSION;
+
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &ImageHandle,
+ &gEfiSaInfoProtocolGuid,
+ &(SaInstance->SaInfo),
+ NULL
+ );
+
+ ///
+ /// Install System Agent Global NVS ACPI table
+ ///
+#ifndef Remove_SaSsdt_Data_To_Dsdt
+ Status = InitializeSaSsdtAcpiTables ();
+#endif //AMI_OVERRIDE
+
+#ifdef SG_SUPPORT
+
+ DEBUG ((EFI_D_INFO, "Initializing Switchable Graphics (Dxe)\n"));
+ SwitchableGraphicsInit (ImageHandle, SystemTable, mDxePlatformSaPolicy);
+
+#endif
+
+ DEBUG ((EFI_D_INFO, "SaInitDxe End\n"));
+
+ return EFI_SUCCESS;
+}
+
+VOID
+DeviceConfigure (
+ IN DXE_PLATFORM_SA_POLICY_PROTOCOL *DxePlatformSaPolicy
+ )
+/**
+ Initialize GT Post Routines.
+
+ @param[in] ImageHandle - Handle for the image of this driver
+ @param[in] DxePlatformSaPolicy - SA DxePlatformPolicy protocol
+**/
+{
+ UINT64 MchBar;
+
+ MchBar = McD0PciCfg64 (R_SA_MCHBAR) &~BIT0;
+
+ ///
+ /// Enable/Disable CHAP device (B0,D7,F0).
+ ///
+ if (DxePlatformSaPolicy->MiscConfig->ChapDeviceEnable) {
+ McD0PciCfg32Or (R_SA_DEVEN, B_SA_DEVEN_D7EN_MASK);
+ } else {
+ McD0PciCfg32And (R_SA_DEVEN, ~(B_SA_DEVEN_D7EN_MASK));
+ }
+ ///
+ /// Enable/Disable Thermal device (B0,D4,F0).
+ ///
+ if (DxePlatformSaPolicy->MiscConfig->Device4Enable) {
+ McD0PciCfg32Or (R_SA_DEVEN, B_SA_DEVEN_D4EN_MASK);
+ } else {
+ McD0PciCfg32And (R_SA_DEVEN, ~(B_SA_DEVEN_D4EN_MASK));
+ }
+ ///
+ /// Enable/Disable Audio device (B0,D3,F0).
+ ///
+ if ((DxePlatformSaPolicy->MiscConfig->AudioEnable) && (McD2PciCfg16 (R_SA_IGD_VID) != 0xFFFF)) {
+ McD0PciCfg32Or (R_SA_DEVEN, B_SA_DEVEN_D3EN_MASK);
+ } else {
+ McD0PciCfg32And (R_SA_DEVEN, ~(B_SA_DEVEN_D3EN_MASK));
+ }
+
+ return ;
+}
+
+VOID
+ProgramSvidSid (
+ IN DXE_PLATFORM_SA_POLICY_PROTOCOL *DxePlatformSaPolicy
+ )
+/**
+ Program SA devices Subsystem Vendor Identifier (SVID) and Subsystem Identifier (SID).
+
+ @param[in] DxePlatformSaPolicy The SAPlatform Policy protocol instance
+**/
+{
+ UINT8 Index;
+ UINT8 BusNumber;
+ UINTN PciEAddressBase;
+ UINT8 DeviceNumber;
+ UINT8 FunctionNumber;
+ UINT8 SvidRegOffset;
+ UINT16 Data16;
+ STATIC SA_SVID_SID_INIT_ENTRY SvidSidInitTable[] = {
+ {
+ 0,
+ 0,
+ PCI_SVID_OFFSET
+ },
+ {
+ 1,
+ 0,
+ R_SA_PEG_SS_OFFSET
+ },
+ {
+ 1,
+ 1,
+ R_SA_PEG_SS_OFFSET
+ },
+ {
+ 1,
+ 2,
+ R_SA_PEG_SS_OFFSET
+ },
+ {
+ 2,
+ 0,
+ PCI_SVID_OFFSET
+ },
+ {
+ 3,
+ 0,
+ PCI_SVID_OFFSET
+ },
+ {
+ 4,
+ 0,
+ PCI_SVID_OFFSET
+ },
+ {
+ 7,
+ 0,
+ PCI_SVID_OFFSET
+ }
+ };
+
+ if ((DxePlatformSaPolicy->MiscConfig->DefaultSvidSid->SubSystemVendorId != 0) ||
+ (DxePlatformSaPolicy->MiscConfig->DefaultSvidSid->SubSystemId != 0)
+ ) {
+ for (Index = 0; Index < (sizeof (SvidSidInitTable) / sizeof (SA_SVID_SID_INIT_ENTRY)); Index++) {
+ BusNumber = 0;
+ DeviceNumber = SvidSidInitTable[Index].DeviceNumber;
+ FunctionNumber = SvidSidInitTable[Index].FunctionNumber;
+ SvidRegOffset = SvidSidInitTable[Index].SvidRegOffset;
+ PciEAddressBase = (UINT32) MmPciAddress (0, BusNumber, DeviceNumber, FunctionNumber, 0);
+ ///
+ /// Skip if the device is disabled
+ ///
+ if (MmioRead16 (PciEAddressBase + PCI_VID) == 0xFFFF) {
+ continue;
+ }
+ ///
+ /// Program SA devices Subsystem Vendor Identifier (SVID)
+ ///
+ Data16 = DxePlatformSaPolicy->MiscConfig->DefaultSvidSid->SubSystemVendorId;
+ MmioWrite16 (
+ (UINTN) (PciEAddressBase + SvidRegOffset),
+ Data16
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PciEAddressBase + SvidRegOffset),
+ 1,
+ (VOID *) (UINTN) (PciEAddressBase + SvidRegOffset)
+ );
+
+ ///
+ /// Program SA devices Subsystem Identifier (SID)
+ ///
+ Data16 = DxePlatformSaPolicy->MiscConfig->DefaultSvidSid->SubSystemId;
+ MmioWrite16 (
+ (UINTN) (PciEAddressBase + SvidRegOffset + 2),
+ Data16
+ );
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PciEAddressBase + SvidRegOffset + 2),
+ 1,
+ (VOID *) (UINTN) (PciEAddressBase + SvidRegOffset + 2)
+ );
+ }
+ }
+
+ return;
+}
+
+VOID
+SaFviExitPmAuth(
+ VOID
+ )
+/**
+ This function populates the SA FVI version numbers
+**/
+{
+ const UINT8 StrEnabled[sizeof (SA_CRID_ENABLED)] = SA_CRID_ENABLED;
+ const UINT8 StrDisabled[sizeof (SA_CRID_DISABLED)] = SA_CRID_DISABLED;
+ const CodeVersion PcieRcVersion = {
+#include "SaPcieVersion.h"
+ };
+ const CodeVersion MemRcVersion = {
+#include "MrcVersion.h"
+ };
+ EFI_STATUS Status;
+ EFI_IA32_REGISTER_SET RegSet;
+ UINT16 VbiosBuildNum;
+ EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
+
+ if (mDxePlatformSaPolicy->MiscConfig->FviReport) {
+ InitFviDataHubCbContext (
+ mDxePlatformSaPolicy->MiscConfig->FviSmbiosType,
+ (UINT8) mSaFviElements,
+ &mSaFviVersionData
+ );
+ mSaFviElementsData[MEM_RC_VER].Element.Version.MajorVersion = (UINT8) MemRcVersion.Major;
+ mSaFviElementsData[MEM_RC_VER].Element.Version.MinorVersion = (UINT8) MemRcVersion.Minor;
+ mSaFviElementsData[MEM_RC_VER].Element.Version.Revision = (UINT8) MemRcVersion.Rev;
+ mSaFviElementsData[MEM_RC_VER].Element.Version.BuildNum = (UINT16) MemRcVersion.Build;
+ mSaFviElementsData[PCIE_VER].Element.Version.MajorVersion = (UINT8) PcieRcVersion.Major;
+ mSaFviElementsData[PCIE_VER].Element.Version.MinorVersion = (UINT8) PcieRcVersion.Minor;
+ mSaFviElementsData[PCIE_VER].Element.Version.Revision = (UINT8) PcieRcVersion.Rev;
+ mSaFviElementsData[PCIE_VER].Element.Version.BuildNum = (UINT16) PcieRcVersion.Build;
+ mSaFviElementsData[CRID_ORIGINAL].Element.Version.BuildNum = (UINT16) McD0PciCfg8 (PCI_REVISION_ID_OFFSET);
+
+ if (mDxePlatformSaPolicy->MiscConfig->CridEnable == TRUE) {
+ CopyMem (mSaFviElementsData[CRID_STATUS].Element.VerString, StrEnabled, sizeof (StrEnabled));
+ } else {
+ CopyMem (mSaFviElementsData[CRID_STATUS].Element.VerString, StrDisabled, sizeof (StrDisabled));
+ }
+
+ mSaFviElementsData[CRID_NEW].Element.Version.BuildNum = (UINT16) McD0PciCfg8 (PCI_REVISION_ID_OFFSET);
+ //
+ // Check IGFX device
+ //
+ VbiosBuildNum = 0xFFFF;
+ Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL, (void **) &LegacyBios);
+ if (Status == EFI_SUCCESS) {
+ RegSet.X.AX = 0x5f01;
+ Status = LegacyBios->Int86 (LegacyBios, 0x15, &RegSet);
+ VbiosBuildNum = (((RegSet.X.DX & 0x0F00) << 4) | ((RegSet.X.DX & 0x000F) << 8) | ((RegSet.X.BX & 0x0F00) >> 4) | (RegSet.X.BX & 0x000F));
+ }
+ mSaFviElementsData[VBIOS_VER].Element.Version.BuildNum = VbiosBuildNum;
+
+ CreateRcFviDatahub (&mSaFviVersionData);
+ }
+}
+
+VOID
+EFIAPI
+SaPciEnumCompleteCallback (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+/**
+ This function gets registered as a callback to perform SA initialization before ExitPmAuth
+
+ @param[in] Event - A pointer to the Event that triggered the callback.
+ @param[in] Context - A pointer to private data registered with the callback function.
+**/
+{
+ EFI_STATUS Status;
+ VOID *ProtocolPointer;
+
+ ///
+ /// Check if this is first time called by EfiCreateProtocolNotifyEvent() or not,
+ /// if it is, we will skip it until real event is triggered
+ ///
+ Status = gBS->LocateProtocol (&gEfiPciEnumerationCompleteProtocolGuid, NULL, &ProtocolPointer);
+ if (EFI_SUCCESS != Status) {
+ return;
+ }
+
+ gBS->CloseEvent (Event);
+
+ Status = PegInitBeforeExitPmAuth ();
+ if (EFI_SUCCESS != Status) {
+ DEBUG ((EFI_D_ERROR, "[SA] Pcie initialization before ExitPmAuth Error, Status = %x \n", Status));
+ ASSERT_EFI_ERROR (Status);
+ }
+}
+
+VOID
+EFIAPI
+SaExitPmAuthCallback (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+/**
+ This function gets registered as a callback to perform SA configuration security lock
+
+ @param[in] Event - A pointer to the Event that triggered the callback.
+ @param[in] Context - A pointer to private data registered with the callback function.
+**/
+{
+ EFI_STATUS Status;
+ VOID *ProtocolPointer;
+
+ ///
+ /// Check if this is first time called by EfiCreateProtocolNotifyEvent() or not,
+ /// if it is, we will skip it until real event is triggered
+ ///
+ Status = gBS->LocateProtocol (&gExitPmAuthProtocolGuid, NULL, &ProtocolPointer);
+ if (EFI_SUCCESS != Status) {
+ return;
+ }
+
+ gBS->CloseEvent (Event);
+
+ if (McD2PciCfg16 (R_SA_IGD_VID) != 0xFFFF) {
+ Status = PostPmInitExitPmAuth();
+ if (EFI_SUCCESS != Status) {
+ DEBUG ((EFI_D_ERROR, "[SA] ExitPmAuth GraphicsInit Error, Status = %x \n", Status));
+ ASSERT_EFI_ERROR (Status);
+ }
+ }
+
+ UpdateDmarExitPmAuth();
+
+ if (McD2PciCfg16 (R_SA_IGD_VID) != 0xFFFF) {
+ Status = GetVBiosVbtExitPmAuth();
+ if (EFI_SUCCESS != Status) {
+ DEBUG ((EFI_D_ERROR, "[SA] ExitPmAuth Op Region Error, Status = %x \n", Status));
+ }
+
+ Status = UpdateIgdOpRegionExitPmAuth();
+ if (EFI_SUCCESS != Status) {
+ DEBUG ((EFI_D_ERROR, "[SA] ExitPmAuth Update Op Region Error, Status = %x \n", Status));
+ }
+ }
+
+ SaFviExitPmAuth();
+
+ Status = SaSecurityInit ();
+ if (EFI_SUCCESS != Status) {
+ DEBUG ((EFI_D_ERROR, "[SA] Security lock Error, Status = %x \n", Status));
+ ASSERT_EFI_ERROR (Status);
+ }
+ return;
+}
+
+VOID
+SaDxePolicyDump (
+ IN DXE_PLATFORM_SA_POLICY_PROTOCOL *mDxePlatformSaPolicy
+ )
+/**
+ This function prints the DXE phase platform policy.
+
+ @param[in] mDxePlatformSaPolicy - SA DxePlatformPolicy protocol
+**/
+{
+#ifdef EFI_DEBUG
+ INTN i;
+
+ DEBUG ((EFI_D_INFO, "\n------------------------ SA Platform Policy (DXE) dump BEGIN -----------------\n"));
+ DEBUG ((EFI_D_INFO, "Revision : %x\n", mDxePlatformSaPolicy->Revision));
+ DEBUG ((EFI_D_INFO, "------------------------ SA_VTD_CONFIGURATION -----------------\n"));
+ DEBUG ((EFI_D_INFO, " VtdEnable : %x\n", mDxePlatformSaPolicy->Vtd->VtdEnable));
+ DEBUG ((EFI_D_INFO, " RmrrUsbBaseAddress : %x\n", mDxePlatformSaPolicy->Vtd->RmrrUsbBaseAddress));
+
+ DEBUG ((EFI_D_INFO, " VtdBaseAddress[%d] :", SA_VTD_ENGINE_NUMBER));
+ for (i = 0; i < SA_VTD_ENGINE_NUMBER; i++) {
+ DEBUG ((EFI_D_INFO, " %x", mDxePlatformSaPolicy->Vtd->BaseAddress[i]));
+ }
+ DEBUG ((EFI_D_INFO, "\n"));
+
+ DEBUG ((EFI_D_INFO, "------------------------ SA_MEMORY_CONFIGURATION -----------------\n"));
+ DEBUG ((EFI_D_INFO, " SpdAddressTable[%d] :", SA_MC_MAX_SOCKETS));
+ for (i = 0; i < SA_MC_MAX_SOCKETS; i++) {
+ DEBUG ((EFI_D_INFO, " %x", mDxePlatformSaPolicy->MemoryConfig->SpdAddressTable[i]));
+ }
+ DEBUG ((EFI_D_INFO, "\n"));
+
+ DEBUG ((EFI_D_INFO, " ChannelASlotMap : %x\n", mDxePlatformSaPolicy->MemoryConfig->ChannelASlotMap));
+ DEBUG ((EFI_D_INFO, " ChannelBSlotMap : %x\n", mDxePlatformSaPolicy->MemoryConfig->ChannelBSlotMap));
+ DEBUG ((EFI_D_INFO, " RmtBdatEnable : %x\n", mDxePlatformSaPolicy->MemoryConfig->RmtBdatEnable));
+ DEBUG ((EFI_D_INFO, " MrcTimeMeasure : %x\n", mDxePlatformSaPolicy->MemoryConfig->MrcTimeMeasure));
+ DEBUG ((EFI_D_INFO, " MrcFastBoot : %x\n", mDxePlatformSaPolicy->MemoryConfig->MrcFastBoot));
+
+ DEBUG ((EFI_D_INFO, "------------------------ SA_PCIE_CONFIGURATION -----------------\n"));
+ DEBUG ((EFI_D_INFO, " DmiAspm : %x\n", mDxePlatformSaPolicy->PcieConfig->DmiAspm));
+
+ DEBUG ((EFI_D_INFO, " PegAspm[%d] :", SA_PEG_MAX_FUN));
+ for (i = 0; i < SA_PEG_MAX_FUN; i++) {
+ DEBUG ((EFI_D_INFO, " %x", mDxePlatformSaPolicy->PcieConfig->PegAspm[i]));
+ }
+ DEBUG ((EFI_D_INFO, "\n"));
+
+ DEBUG ((EFI_D_INFO, " PegAspmL0s[%d] :", SA_PEG_MAX_FUN));
+ for (i = 0; i < SA_PEG_MAX_FUN; i++) {
+ DEBUG ((EFI_D_INFO, " %x", mDxePlatformSaPolicy->PcieConfig->PegAspmL0s[i]));
+ }
+ DEBUG ((EFI_D_INFO, "\n"));
+
+ DEBUG ((EFI_D_INFO, " PegDeEmphasis[%d] :", SA_PEG_MAX_FUN));
+ for (i = 0; i < SA_PEG_MAX_FUN; i++) {
+ DEBUG ((EFI_D_INFO, " %x", mDxePlatformSaPolicy->PcieConfig->PegDeEmphasis[i]));
+ }
+ DEBUG ((EFI_D_INFO, "\n"));
+
+ DEBUG ((EFI_D_INFO, " DmiExtSync : %x\n", mDxePlatformSaPolicy->PcieConfig->DmiExtSync));
+ DEBUG ((EFI_D_INFO, " DmiDeEmphasis : %x\n", mDxePlatformSaPolicy->PcieConfig->DmiDeEmphasis));
+ DEBUG ((EFI_D_INFO, " DmiIot : %x\n", mDxePlatformSaPolicy->PcieConfig->DmiIot));
+
+ if (mDxePlatformSaPolicy->Revision >= DXE_SA_PLATFORM_POLICY_PROTOCOL_REVISION_2) {
+ if (mDxePlatformSaPolicy->PcieConfig->PcieAspmDevsOverride != NULL) {
+ DEBUG ((EFI_D_INFO, "------------------------ PCIE_ASPM_DEV_INFO -----------------\n"));
+ DEBUG ((EFI_D_INFO, " VendorId DeviceId RevId RootApmcMask EndpointApmcMask\n"));
+ i = 0;
+ while ((mDxePlatformSaPolicy->PcieConfig->PcieAspmDevsOverride[i].VendorId != SA_PCIE_DEV_END_OF_TABLE) &&
+ (i < MAX_PCIE_ASPM_OVERRIDE)) {
+ DEBUG ((EFI_D_INFO, " %04x %04x %02x %01x %01x\n",
+ mDxePlatformSaPolicy->PcieConfig->PcieAspmDevsOverride[i].VendorId,
+ mDxePlatformSaPolicy->PcieConfig->PcieAspmDevsOverride[i].DeviceId,
+ mDxePlatformSaPolicy->PcieConfig->PcieAspmDevsOverride[i].RevId,
+ mDxePlatformSaPolicy->PcieConfig->PcieAspmDevsOverride[i].RootApmcMask,
+ mDxePlatformSaPolicy->PcieConfig->PcieAspmDevsOverride[i].EndpointApmcMask));
+ i++;
+ }
+ DEBUG ((EFI_D_INFO, "------------------------ END_OF_TABLE -----------------------\n"));
+ }
+ if (mDxePlatformSaPolicy->PcieConfig->PcieLtrDevsOverride != NULL) {
+ DEBUG ((EFI_D_INFO, "------------------------ PCIE_LTR_DEV_INFO -----------------\n"));
+ DEBUG ((EFI_D_INFO, " VendorId DeviceId RevId SnoopLatency NonSnoopLatency\n"));
+ i = 0;
+ while ((mDxePlatformSaPolicy->PcieConfig->PcieLtrDevsOverride[i].VendorId != SA_PCIE_DEV_END_OF_TABLE) &&
+ (i < MAX_PCIE_LTR_OVERRIDE)) {
+ DEBUG ((EFI_D_INFO, " %04x %04x %02x %01x %01x\n",
+ mDxePlatformSaPolicy->PcieConfig->PcieLtrDevsOverride[i].VendorId,
+ mDxePlatformSaPolicy->PcieConfig->PcieLtrDevsOverride[i].DeviceId,
+ mDxePlatformSaPolicy->PcieConfig->PcieLtrDevsOverride[i].RevId,
+ mDxePlatformSaPolicy->PcieConfig->PcieLtrDevsOverride[i].SnoopLatency,
+ mDxePlatformSaPolicy->PcieConfig->PcieLtrDevsOverride[i].NonSnoopLatency));
+ i++;
+ }
+ DEBUG ((EFI_D_INFO, "------------------------ END_OF_TABLE ----------------------\n"));
+ }
+ }
+
+ for (i = 0; i < SA_PEG_MAX_FUN; i++) {
+ DEBUG ((EFI_D_INFO, " PegPwrOpt[%d].LtrEnable : %x\n", i, mDxePlatformSaPolicy->PcieConfig->PegPwrOpt[i].LtrEnable));
+ DEBUG ((EFI_D_INFO, " PegPwrOpt[%d].LtrMaxSnoopLatency : %x\n", i, mDxePlatformSaPolicy->PcieConfig->PegPwrOpt[i].LtrMaxSnoopLatency));
+ DEBUG ((EFI_D_INFO, " PegPwrOpt[%d].ObffEnable : %x\n", i, mDxePlatformSaPolicy->PcieConfig->PegPwrOpt[i].ObffEnable));
+ DEBUG ((EFI_D_INFO, " PegPwrOpt[%d].LtrMaxNoSnoopLatency : %x\n", i, mDxePlatformSaPolicy->PcieConfig->PegPwrOpt[i].LtrMaxNoSnoopLatency));
+ }
+
+ if (mDxePlatformSaPolicy->Revision >= DXE_SA_PLATFORM_POLICY_PROTOCOL_REVISION_3) {
+ DEBUG ((EFI_D_INFO, "------------------------ SA_SG_VBIOS_CONFIGURATION -----------------\n"));
+ DEBUG ((EFI_D_INFO, " LoadVbios : %x\n", mDxePlatformSaPolicy->VbiosConfig->LoadVbios));
+ DEBUG ((EFI_D_INFO, " ExecuteVbios : %x\n", mDxePlatformSaPolicy->VbiosConfig->ExecuteVbios));
+ DEBUG ((EFI_D_INFO, " VbiosSource : %x\n", mDxePlatformSaPolicy->VbiosConfig->VbiosSource));
+ }
+
+
+ DEBUG ((EFI_D_INFO, "------------------------ SA_IGD_CONFIGURATION -----------------\n"));
+ DEBUG ((EFI_D_INFO, " RenderStandby : %x\n", mDxePlatformSaPolicy->IgdConfig->RenderStandby));
+ DEBUG ((EFI_D_INFO, "------------------------ SA_MISC_CONFIGURATION -----------------\n"));
+ DEBUG ((EFI_D_INFO, " ChapDeviceEnable : %x\n", mDxePlatformSaPolicy->MiscConfig->ChapDeviceEnable));
+ DEBUG ((EFI_D_INFO, " Device4Enable : %x\n", mDxePlatformSaPolicy->MiscConfig->Device4Enable));
+ DEBUG ((EFI_D_INFO, " SubSystemVendorId : %x\n", mDxePlatformSaPolicy->MiscConfig->DefaultSvidSid->SubSystemVendorId));
+ DEBUG ((EFI_D_INFO, " SubSystemId : %x\n", mDxePlatformSaPolicy->MiscConfig->DefaultSvidSid->SubSystemId));
+ DEBUG ((EFI_D_INFO, " CridEnable : %x\n", mDxePlatformSaPolicy->MiscConfig->CridEnable));
+ DEBUG ((EFI_D_INFO, " AudioEnable : %x\n", mDxePlatformSaPolicy->MiscConfig->AudioEnable));
+ DEBUG ((EFI_D_INFO, " FviReport : %x\n", mDxePlatformSaPolicy->MiscConfig->FviReport));
+ DEBUG ((EFI_D_INFO, " FviSmbiosType : %x\n", mDxePlatformSaPolicy->MiscConfig->FviSmbiosType));
+ DEBUG ((EFI_D_INFO, "\n------------------------ SA Platform Policy (DXE) dump END -----------------\n"));
+#endif
+ return;
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/SaInit.dxs b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/SaInit.dxs
new file mode 100644
index 0000000..03c23ef
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/SaInit.dxs
@@ -0,0 +1,65 @@
+/** @file
+ @todo ADD DESCRIPTION
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "DxeDepex.h"
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+#endif
+
+#include EFI_PROTOCOL_DEPENDENCY (SaPlatformPolicy)
+#include EFI_PROTOCOL_DEPENDENCY (PciRootBridgeIo)
+#include EFI_PROTOCOL_DEPENDENCY (BootScriptSave)
+#include EFI_PROTOCOL_DEPENDENCY (AcpiSupport)
+#include EFI_PROTOCOL_DEPENDENCY (PciHostBridgeResourceAllocation)
+#include EFI_PROTOCOL_DEPENDENCY (CpuIo)
+#include EFI_PROTOCOL_DEPENDENCY (DataHub)
+#include EFI_PROTOCOL_DEPENDENCY (PowerMgmtInitDone)
+#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
+#include EFI_PROTOCOL_DEPENDENCY (HiiDatabase)
+#else
+#include EFI_PROTOCOL_DEPENDENCY (HII)
+#endif
+#include EFI_PROTOCOL_DEPENDENCY (FirmwareVolume)
+
+DEPENDENCY_START
+ EFI_ACPI_SUPPORT_GUID AND
+ EFI_DATA_HUB_PROTOCOL_GUID AND
+ EFI_POWER_MGMT_INIT_DONE_PROTOCOL_GUID AND
+ EFI_FIRMWARE_VOLUME_PROTOCOL_GUID AND
+ DXE_PLATFORM_SA_POLICY_GUID AND
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GUID AND
+ EFI_BOOT_SCRIPT_SAVE_PROTOCOL_GUID AND
+ EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_GUID AND
+ EFI_CPU_IO_PROTOCOL_GUID AND
+#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
+ EFI_HII_DATABASE_PROTOCOL_GUID
+#else
+ EFI_HII_PROTOCOL_GUID
+#endif
+DEPENDENCY_END
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/SaInit.h b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/SaInit.h
new file mode 100644
index 0000000..a8c2b8f
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/SaInit.h
@@ -0,0 +1,194 @@
+/** @file
+ Header file for SA Initialization Driver.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _SA_INITIALIZATION_DRIVER_H_
+#define _SA_INITIALIZATION_DRIVER_H_
+
+///
+/// External include files do NOT need to be explicitly specified in real EDKII
+/// environment
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "EfiScriptLib.h"
+#include "SaBuildFlags.h"
+#include "LegacyRegion.h"
+#include "Vtd.h"
+#include "GraphicsInit.h"
+#include "IgdOpregion.h"
+#include "PciExpressInit.h"
+#include "AudioInit.h"
+#include "RcFviDxeLib.h"
+#include "CpuRegs.h"
+#include "CpuPlatformLib.h"
+#include "PcieComplex.h"
+#include "VTd.h"
+#include "SwitchableGraphicsInit.h"
+
+///
+/// Driver Consumed Protocol Prototypes
+///
+#include EFI_PROTOCOL_DEFINITION (SaPlatformPolicy)
+#include EFI_PROTOCOL_PRODUCER (SaInfo)
+#endif
+///
+/// Data definitions
+///
+#define CRID_DATA 0x69
+#define CRID_LOCK 0x17
+
+typedef struct {
+ UINT64 BaseAddr;
+ UINT32 Offset;
+ UINT32 AndMask;
+ UINT32 OrMask;
+} BOOT_SCRIPT_REGISTER_SETTING;
+
+typedef struct {
+ UINT64 Address;
+ EFI_BOOT_SCRIPT_WIDTH Width;
+ UINT32 Value;
+} BOOT_SCRIPT_PCI_REGISTER_SAVE;
+
+typedef struct {
+ EFI_SA_INFO_PROTOCOL SaInfo;
+} SA_INSTANCE_PRIVATE_DATA;
+
+typedef struct {
+ UINT8 DeviceNumber;
+ UINT8 FunctionNumber;
+ UINT8 SvidRegOffset;
+} SA_SVID_SID_INIT_ENTRY;
+
+#define SA_FVI_STRING "Reference Code - SA - System Agent"
+#define SA_FVI_SMBIOS_TYPE 0xDD ///< Default value
+#define SA_FVI_SMBIOS_INSTANCE 0x06
+#define MEM_FVI_STRING "Reference Code - MRC"
+#define MEM_RC_VERSION \
+ { \
+ 0xFF, 0xFF, 0xFF, 0xFFFF \
+ }
+#define PCIE_FVI_STRING "SA - PCIe Version"
+#define PCIE_RC_VERSION \
+ { \
+ 0xFF, 0xFF, 0xFF, 0xFFFF \
+ }
+#define SA_CRID_STATUS "SA-CRID Status"
+#define SA_CRID_ORIGINAL_VALUE "SA-CRID Original Value"
+#define SA_CRID_NEW_VALUE "SA-CRID New Value"
+#define SA_CRID_ENABLED "Enabled "
+#define SA_CRID_DISABLED "Disabled"
+#define SA_CRID_VERSION \
+ { \
+ 0xFF, 0xFF, 0xFF, 0xFFFF \
+ }
+#define VBIOS_FVI_STRING "OPROM - VBIOS"
+#define VBIOS_RC_VERSION \
+ { \
+ 0xFF, 0xFF, 0xFF, 0xFFFF \
+ }
+
+enum {
+ SA_RC_VER = 0,
+ MEM_RC_VER,
+ PCIE_VER,
+ CRID_STATUS,
+ CRID_ORIGINAL,
+ CRID_NEW,
+ VBIOS_VER
+} SA_FVI_INDEX;
+
+extern FVI_ELEMENT_AND_FUNCTION mSaFviElementsData[];
+extern FVI_DATA_HUB_CALLBACK_CONTEXT mSaFviVersionData;
+extern UINTN mSaFviElements;
+
+///
+/// Function Prototype
+///
+VOID
+EFIAPI
+SaPciEnumCompleteCallback (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+/**
+ This function gets registered as a callback to perform SA initialization before ExitPmAuth
+
+ @param[in] Event - A pointer to the Event that triggered the callback.
+ @param[in] Context - A pointer to private data registered with the callback function.
+
+ @retval EFI_SUCCESS - Always.
+
+ **/
+;
+
+VOID
+EFIAPI
+SaExitPmAuthCallback (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+/**
+ This function gets registered as a callback to perform SA configuration security lock
+
+ @param[in] Event - A pointer to the Event that triggered the callback.
+ @param[in] Context - A pointer to private data registered with the callback function.
+
+ @retval EFI_SUCCESS - Always.
+
+ **/
+;
+
+VOID
+DeviceConfigure (
+ IN DXE_PLATFORM_SA_POLICY_PROTOCOL *DxePlatformSaPolicy
+ )
+/**
+ This function performs SA internal devices enabling/disabling
+
+ @param[in] DxePlatformSaPolicy - SA DxePlatformPolicy protocol
+
+ **/
+;
+
+VOID
+ProgramSvidSid (
+ IN DXE_PLATFORM_SA_POLICY_PROTOCOL *DxePlatformSaPolicy
+ )
+/**
+ Program SA devices Subsystem Vendor Identifier (SVID) and Subsystem Identifier (SID).
+
+ @param[in] DxePlatformSaPolicy The SAPlatform Policy protocol instance
+**/
+;
+
+VOID
+SaDxePolicyDump (
+ IN DXE_PLATFORM_SA_POLICY_PROTOCOL *mDxePlatformSaPolicy
+ )
+/**
+ This function prints the DXE phase platform policy.
+
+ @param[in] mDxePlatformSaPolicy - SA DxePlatformPolicy protocol
+
+ **/
+;
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/SaInit.inf b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/SaInit.inf
new file mode 100644
index 0000000..638f6da
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/SaInit.inf
@@ -0,0 +1,137 @@
+## @file
+# Component description file for SystemAgent Initialization driver
+#
+#@copyright
+# Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+##
+
+[defines]
+BASE_NAME = SaInit
+FILE_GUID = DE23ACEE-CF55-4fb6-AA77-984AB53DE811
+COMPONENT_TYPE = BS_DRIVER
+
+[sources.common]
+ SaInit.h
+ SaInit.c
+ LegacyRegion.h
+ LegacyRegion.c
+ Vtd.c
+ Vtd.h
+ IgdOpRegion.h
+ IgdOpRegion.c
+ GraphicsInit.h
+ GraphicsInit.c
+ PciExpressInit.h
+ PciExpressInit.c
+ PcieComplex.c
+ PcieComplex.h
+ AudioInit.c
+ AudioInit.h
+ SaFvi.c
+ SwitchableGraphicsInit.c
+ SwitchableGraphicsInit.h
+
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueDxeDriverEntryPoint.c
+
+[includes.common]
+ .
+ ../Common
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Library
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/core/Dxe
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include/pcd
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Cpu/Pentium/Include
+ $(EDK_SOURCE)/Foundation/Library/Dxe/UefiEfiIfrSupportLib
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Protocol
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/$(PROJECT_SA_MRC)/Pei/Source/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Library/SaPcieLib/Common
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Protocol
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include/Library
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/../MdePkg/Include
+
+#
+# Typically, the sample code referenced will be available in the code base already.
+# So, keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/SampleCode
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/SampleCode/Include
+
+[libraries.common]
+ EfiProtocolLib
+ EdkGuidLib
+ EfiCommonLib
+ EfiScriptLib
+ EdkIIGlueBaseLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueBaseMemoryLib
+ EdkIIGlueBasePciExpressLib
+ EdkIIGlueDxeReportStatusCodeLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueDxeServicesTableLib
+ EdkIIGlueDxeHobLib
+ EdkIIGlueUefiLib
+ EdkIIGlueBasePciLibPciExpress
+ $(PROJECT_SA_FAMILY)ProtocolLib
+ $(PROJECT_PCH_FAMILY)ProtocolLib
+ RcFviDxeLib
+ PchPlatformLib
+ UefiEfiIfrSupportLib
+ SaGuidLib
+ EdkProtocolLib
+ CpuPlatformLib
+#
+# Comment out SaPcieDxeLib if ASPM initialization in DXE phase was not supported
+#
+ SaPcieDxeLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = SaInit.dxs
+
+ C_FLAGS = $(C_FLAGS) -D"__EDKII_GLUE_MODULE_ENTRY_POINT__=SaInitEntryPoint" \
+ -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_BASE_LIB__ \
+ -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__\
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_DXE_HOB_LIB__ \
+ -D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+ -D __EDKII_GLUE_UEFI_LIB__
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/SaInitDxe.cif b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/SaInitDxe.cif
new file mode 100644
index 0000000..f705e96
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/SaInitDxe.cif
@@ -0,0 +1,30 @@
+<component>
+ name = "SaInitDxe"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\SystemAgent\SaInit\Dxe"
+ RefName = "SaInitDxe"
+[files]
+"SaInitDxe.sdl"
+"SaInitDxe.mak"
+"SaInit.c"
+"SaInit.dxs"
+"SaInit.h"
+"SaInit.inf"
+"graphicsinit.c"
+"graphicsinit.h"
+"igdopregion.c"
+"igdopregion.h"
+"LegacyRegion.c"
+"LegacyRegion.h"
+"PcieComplex.c"
+"PcieComplex.h"
+"PciExpressInit.c"
+"PciExpressInit.h"
+"VTd.c"
+"VTd.h"
+"AudioInit.c"
+"AudioInit.h"
+"SaFvi.c"
+"SwitchableGraphicsInit.c"
+"SwitchableGraphicsInit.h"
+<endComponent>
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/SaInitDxe.mak b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/SaInitDxe.mak
new file mode 100644
index 0000000..809ba05
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/SaInitDxe.mak
@@ -0,0 +1,86 @@
+#---------------------------------------------------------------------------
+# Create SaInitDxe Driver
+#---------------------------------------------------------------------------
+EDK : SaInitDxe
+
+SaInitDxe: $(BUILD_DIR)\SaInitDxe.mak SaInitDxeBin
+
+$(BUILD_DIR)\SaInitDxe.mak : $(SaInitDxe_DIR)\$(@B).cif $(SaInitDxe_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(SaInitDxe_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+SaInitDxe_INCLUDES=\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(INTEL_MCH_INCLUDES) \
+ $(INTEL_PCH_INCLUDES)\
+ $(IndustryStandard_INCLUDES)\
+ $(INTEL_PLATFORM_PROTOCOL_INCLUDES)\
+ $(PROJECT_CPU_INCLUDES)\
+ /I$(INTEL_SYSTEM_AGENT_DIR)\Library\SaPcieLib\Common\
+ /I$(INTEL_SYSTEM_AGENT_DIR)\SampleCode\
+
+SaInitDxe_DEFINES =$(MY_DEFINES)\
+ /D "__EDKII_GLUE_MODULE_ENTRY_POINT__=SaInitEntryPoint" \
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_BASE_LIB__ \
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__\
+ /D __EDKII_GLUE_DXE_HOB_LIB__ \
+ /D __EDKII_GLUE_UEFI_LIB__\
+ /D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+
+SaInitDxe_LIB_LINKS =\
+ $(EFIPROTOCOLLIB)\
+ $(EDKGUIDLIB)\
+ $(EFICOMMONLIB)\
+ $(EFISCRIPTLIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueDxeServicesTableLib_LIB)\
+ $(EdkIIGlueDxeHobLib_LIB)\
+ $(EdkIIGlueUefiLib_LIB)\
+ $(INTEL_SA_PROTOCOL_LIB)\
+ $(INTEL_PCH_PROTOCOL_LIB)\
+ $(IntelPlatformProtocolLib_LIB)\
+!IF $(EFI_SPECIFICATION_VERSION) >= 0x0002000A
+ $(UEFIEFIIFRSUPPORTLIB)\
+!ELSE
+ $(EFIIFRSUPPORTLIB) \
+!ENDIF
+ $(SaGuidLib_LIB)\
+ $(EdkIIGlueBasePciExpressLib_LIB)\
+ $(EdkIIGlueUefiRuntimeServicesTableLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(EDKPROTOCOLLIB)\
+ $(RcFviDxeLib_LIB)\
+ $(PchPlatformDxeLib_LIB)\
+ $(CpuPlatformLib_LIB)\
+#
+# Comment out SaPcieDxeLib if ASPM initialization in DXE phase was not supported
+#
+ $(SaPcieDxeLib_LIB)\
+
+SaInitDxeBin: $(SaInitDxe_LIB_LINKS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\SaInitDxe.mak all \
+ "MY_INCLUDES=$(SaInitDxe_INCLUDES)"\
+ "MY_DEFINES=$(SaInitDxe_DEFINES)"\
+ GUID=DE23ACEE-CF55-4fb6-AA77-984AB53DE811\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=BS_DRIVER\
+ EDKIIModule=DXEDRIVER\
+ DEPEX1=$(SaInitDxe_DIR)\SaInit.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX\
+ COMPRESS=1
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/SaInitDxe.sdl b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/SaInitDxe.sdl
new file mode 100644
index 0000000..e4a95b4
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/SaInitDxe.sdl
@@ -0,0 +1,24 @@
+TOKEN
+ Name = "SaInitDxe_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable SaInitDxe support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "SaInitDxe_DIR"
+End
+
+MODULE
+ File = "SaInitDxe.mak"
+ Help = "Includes SaInitDxe.mak to Project"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\SaInitDxe.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End \ No newline at end of file
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/SwitchableGraphicsInit.c b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/SwitchableGraphicsInit.c
new file mode 100644
index 0000000..599a01a
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/SwitchableGraphicsInit.c
@@ -0,0 +1,958 @@
+/** @file
+ SwitchableGraphics Dxe driver.
+ This DXE driver loads SwitchableGraphics acpi tables
+ for the platform.
+
+@copyright
+ Copyright (c) 2010 - 2013 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+#include "SwitchableGraphicsInit.h"
+#include EFI_PROTOCOL_CONSUMER (ExitPmAuth)
+#include <Token.h> //<< AMI_OVERRIDE >>
+
+extern DXE_PLATFORM_SA_POLICY_PROTOCOL *mDxePlatformSaPolicy;
+
+EFI_BOOT_SERVICES *gBS;
+SA_DATA_HOB *SaDataHob;
+
+EFI_GUID gSaDataHobGuid = SA_DATA_HOB_GUID;
+EFI_GUID gSgAcpiTableStorageGuid = SG_ACPI_TABLE_STORAGE_GUID;
+EFI_GUID gSgAcpiTablePchStorageGuid = SG_ACPI_TABLE_PCH_STORAGE_GUID;
+
+VOID *VbiosAddress = NULL;
+BOOLEAN DgpuOpRomCopied;
+UINT32 VbiosSize;
+
+UINT8 EndpointBus;
+UINT16 GpioBaseAddress;
+UINT8 GpioSupport;
+
+UINT8 RootPortDev;
+UINT8 RootPortFun;
+
+CPU_FAMILY CpuFamilyId;
+
+// AMI MODIFY BEGIN
+EFI_STATUS
+LoadTpvAcpiTables(
+ VOID
+ );
+// AMI MODIFY END
+
+/**
+ Initialize the SwitchableGraphics support (DXE).
+
+ @param[in] ImageHandle - Handle for the image of this driver
+ @param[in] DxePlatformSaPolicy - SA DxePlatformPolicy protocol
+
+ @retval EFI_SUCCESS - SwitchableGraphics initialization complete
+ @retval EFI_OUT_OF_RESOURCES - Unable to allocated memory
+ @retval EFI_NOT_FOUND - SA DataHob not found
+ @retval EFI_DEVICE_ERROR - Error Accessing SG GPIO
+**/
+EFI_STATUS
+SwitchableGraphicsInit (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable,
+ IN DXE_PLATFORM_SA_POLICY_PROTOCOL *DxePlatformSaPolicy
+ )
+{
+ EFI_STATUS Status;
+ VOID *Registration;
+ UINTN PciD31F0RegBase;
+ UINT32 RootComplexBar;
+ UINT32 RpFn;
+
+ CpuFamilyId = GetCpuFamily();
+
+ if (CpuFamilyId == EnumCpuHswUlt) {
+ /// For SwitchableGraphics support the dGPU is present on PCH RootPort
+ RootPortDev = PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS;
+ //AMI override begin
+ RootPortFun = SG_ULT_PORT_FUNC;
+ //RootPortFun = PCI_FUNCTION_NUMBER_PCH_PCIE_ROOT_PORT_5;
+ //AMI override end
+
+ PciD31F0RegBase = MmPciAddress (
+ 0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ 0
+ );
+ RootComplexBar = MmioRead32 (PciD31F0RegBase + R_PCH_LPC_RCBA) & B_PCH_LPC_RCBA_BAR;
+ RpFn = MmioRead32 (RootComplexBar + R_PCH_RCRB_RPFN);
+ /// dGPU sits on Root Port 5 [1-based]
+ /// Root Port 5 Function Number (RP5FN) = RPFN[18:16]
+ //AMI override begin
+ //RootPortFun = (UINT8) ((RpFn >> (4 * S_PCH_RCRB_PRFN_RP_FIELD)) & B_PCH_RCRB_RPFN_RP1FN);
+ RootPortFun = (UINT8) ((RpFn >> (RootPortFun * S_PCH_RCRB_PRFN_RP_FIELD)) & B_PCH_RCRB_RPFN_RP1FN);
+ ////AMI override end
+ } else {
+ /// Assume: For SwitchableGraphics support the dGPU is present on PEG RootPort by default
+ RootPortDev = SA_PEG10_DEV_NUM;
+ RootPortFun = SA_PEG10_FUN_NUM;
+ }
+
+ DEBUG ((EFI_D_INFO, "dGPU Rootport info[B/D/F] : [0x00/0x%x/0x%x]\n", RootPortDev, RootPortFun));
+
+ gBS = SystemTable->BootServices;
+
+ ///
+ /// Get SG GPIO info from SA HOB.
+ ///
+ Status = EfiGetSystemConfigurationTable (&gEfiHobListGuid, (VOID **) &SaDataHob);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ SaDataHob = GetNextGuidHob (&gSaDataHobGuid, SaDataHob);
+ if (SaDataHob == NULL) {
+ return EFI_NOT_FOUND;
+ }
+
+ GpioSupport = SaDataHob->SgInfo.SgGpioSupport;
+
+ ///
+ /// Read GPIO base
+ ///
+ GpioBaseAddress = McDevFunPciCfg16 (0, PCI_DEVICE_NUMBER_PCH_LPC, 0, R_PCH_LPC_GPIO_BASE) &~BIT0;
+ if (GpioBaseAddress == 0) {
+ return EFI_DEVICE_ERROR;
+ }
+
+ ///
+ /// Update GlobalNvs data for runtime usage
+ ///
+ Status = UpdateGlobalNvsData (SaDataHob->SgInfo, DxePlatformSaPolicy);
+// AMI MODIFY BEGIN
+ DEBUG ((EFI_D_INFO, "SG:: OEM SSDT start"));
+#if SGOEMSSDT_SUPPORT
+ // Load OEM SSDT
+ if (SaDataHob->SgInfo.SgMode == SgModeDgpu) { // In PEG mode
+
+ DEBUG ((EFI_D_INFO, "SG:: OEM SSDT start1"));
+ Status = LoadAndExecuteDgpuVbios (mDxePlatformSaPolicy->VbiosConfig);
+ return Status;
+ }
+#endif
+// AMI MODIFY END
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ ///
+ /// Load Intel SG SSDT tables
+ ///
+ Status = LoadAcpiTables ();
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ ///
+ /// Check to see if Switchable Graphics Mode is enabled
+ ///
+ if (SaDataHob->SgInfo.SgMode == SgModeMuxless) {
+ ///
+ /// Create ReadyToBoot callback for SG
+ ///
+ EfiCreateProtocolNotifyEvent (
+ &gExitPmAuthProtocolGuid,
+ EFI_TPL_CALLBACK,
+ SgExitPmAuthCallback,
+ NULL,
+ &Registration
+ );
+ }
+
+ return Status;
+}
+
+/**
+ Initialize the runtime SwitchableGraphics support data for ACPI tables in GlobalNvs.
+
+ @param[in] SaDataHob->SgInfo - Pointer to Hob for SG system details.
+ @param[in] DxePlatformSaPolicy - Pointer to the loaded image protocol for this driver.
+
+ @retval EFI_SUCCESS - The data updated successfully.
+**/
+EFI_STATUS
+UpdateGlobalNvsData (
+ IN SG_INFO_HOB SgInfo,
+ IN DXE_PLATFORM_SA_POLICY_PROTOCOL *DxePlatformSaPolicy
+ )
+{
+ SYSTEM_AGENT_GLOBAL_NVS_AREA_PROTOCOL *SaGlobalNvsArea;
+ UINT8 CapOffset;
+ UINT16 ExtendedCapOffset;
+ EFI_STATUS Status;
+ UINT32 Data32;
+
+ ///
+ /// Locate the SA Global NVS Protocol.
+ ///
+ Status = gBS->LocateProtocol (
+ &gSaGlobalNvsAreaProtocolGuid,
+ NULL,
+ (VOID **) &SaGlobalNvsArea
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ ///
+ /// SG Mode for ASL usage
+ ///
+ SaGlobalNvsArea->Area->SgMode |= SaDataHob->SgInfo.SgMode;
+
+ SaGlobalNvsArea->Area->PXFixedDynamicMode = SaDataHob->SgInfo.PXFixedDynamicMode; // AMI_OVERRIDE_FOR ATI 5.0 Fixed/Dynamic
+
+ SaGlobalNvsArea->Area->GpioBaseAddress = GpioBaseAddress;
+
+ SaGlobalNvsArea->Area->SgGPIOSupport = SaDataHob->SgInfo.SgGpioSupport;
+
+ DEBUG ((EFI_D_INFO, "SG:: Switchable Graphics Mode : 0x%x\n", SaDataHob->SgInfo.SgMode));
+
+ if (SaDataHob->SgInfo.SgMode == SgModeMuxless) {
+ ///
+ /// SG Feature List for ASL usage
+ ///
+ //SaGlobalNvsArea->Area->SgFeatureList |= DxePlatformSaPolicy->FeatureList->WirelessDisplay;
+
+ if (SaDataHob->SgInfo.SgGpioSupport) {
+ ///
+ /// GPIO Assignment for ASL usage
+ ///
+ SaGlobalNvsArea->Area->SgDgpuPwrOK = SaDataHob->SgInfo.SgDgpuPwrOK;
+ SaGlobalNvsArea->Area->SgDgpuHoldRst = SaDataHob->SgInfo.SgDgpuHoldRst;
+ SaGlobalNvsArea->Area->SgDgpuPwrEnable = SaDataHob->SgInfo.SgDgpuPwrEnable;
+ SaGlobalNvsArea->Area->SgDgpuPrsnt = SaDataHob->SgInfo.SgDgpuPrsnt;
+
+ DEBUG ((EFI_D_INFO, "SG:: dGPU_PWROK GPIO GPIO assigned = %d\n", SaDataHob->SgInfo.SgDgpuPwrOK & 0x7f));
+ DEBUG ((EFI_D_INFO, "SG:: dGPU_HOLD_RST# GPIO assigned = %d\n", SaDataHob->SgInfo.SgDgpuHoldRst & 0x7f));
+ DEBUG ((EFI_D_INFO, "SG:: dGPU_PWR_EN# GPIO assigned = %d\n", SaDataHob->SgInfo.SgDgpuPwrEnable & 0x7f));
+ DEBUG ((EFI_D_INFO, "SG:: dGPU_PRSNT# GPIO assigned = %d\n", SaDataHob->SgInfo.SgDgpuPrsnt & 0x7f));
+ }
+
+ DEBUG ((EFI_D_INFO, "SG:: VBIOS Configurations:\n"));
+ DEBUG (
+ (
+ EFI_D_INFO, "SG:: Load VBIOS (0=No Vbios;1=Load VBIOS) =%d\n", DxePlatformSaPolicy->VbiosConfig->
+ LoadVbios
+ )
+ );
+ DEBUG (
+ (
+ EFI_D_INFO, "SG:: Execute VBIOS (0=Do not execute;1=Execute Vbios) =%d\n", DxePlatformSaPolicy->VbiosConfig->
+ ExecuteVbios
+ )
+ );
+ DEBUG (
+ (
+ EFI_D_INFO, "SG:: VBIOS Source (0=PCIE Card;1=FW Volume) =%d\n", DxePlatformSaPolicy->VbiosConfig->
+ VbiosSource
+ )
+ );
+
+ ///
+ /// PEG Endpoint Base Addresses and Capability Structure Offsets for ASL usage
+ ///
+
+ ///
+ /// Save bus numbers on the PEG/PCH bridge.
+ ///
+ Data32 = MmPci32 (0, 0, RootPortDev, RootPortFun, PCI_PBUS);
+ Data32 &= 0x00FFFF00;
+
+ ///
+ /// Set PEG/PCH PortBus = 1 to Read Endpoint.
+ ///
+ MmPci32AndThenOr (0, 0, RootPortDev, RootPortFun, PCI_PBUS, 0xFF0000FF, 0x00010100);
+
+ ///
+ /// A config write is required in order for the device to re-capture the Bus number,
+ /// according to PCI Express Base Specification, 2.2.6.2
+ /// Write to a read-only register VendorID to not cause any side effects.
+ ///
+ McDevFunPciCfg16 (1, 0, 0, PCI_VID) = 0;
+
+ EndpointBus = MmPci8 (0, 0, RootPortDev, RootPortFun, PCI_SBUS);
+
+ if (EndpointBus != 0xFF) {
+ //AMI override begin
+ SaGlobalNvsArea->Area->EndpointBaseAddress = (UINT32) (MmPciAddress (0, EndpointBus, 0, 0, 0x0));
+ //AMI override end
+ SaGlobalNvsArea->Area->CapStrPresence = 0;
+
+ CapOffset = (UINT8) PcieFindCapId (EndpointBus, 0, 0, PEG_CAP_ID);
+ SaGlobalNvsArea->Area->EndpointPcieCapOffset = CapOffset;
+ DEBUG ((EFI_D_INFO, "SG:: Endpoint PCI Express Capability Offset : 0x%x\n", SaGlobalNvsArea->Area->EndpointPcieCapOffset));
+
+ ExtendedCapOffset = (UINT16) PcieFindExtendedCapId (EndpointBus, 0, 0, PEG_CAP_VER);
+ if (ExtendedCapOffset != 0) {
+ SaGlobalNvsArea->Area->CapStrPresence |= BIT0;
+ SaGlobalNvsArea->Area->EndpointVcCapOffset = ExtendedCapOffset;
+ DEBUG ((EFI_D_INFO, "SG:: Endpoint Virtual Channel Capability Offset : 0x%x\n", SaGlobalNvsArea->Area->EndpointVcCapOffset));
+ }
+ }
+
+ ///
+ /// Restore bus numbers on the PEG/PCH bridge.
+ ///
+ MmPci32AndThenOr (0, 0, RootPortDev, RootPortFun, PCI_PBUS, 0xFF0000FF, Data32);
+ } else {
+ DEBUG ((EFI_D_ERROR, "SG:: Switchable Graphics Mode disabled!!!\n"));
+ Status = EFI_LOAD_ERROR;
+ }
+
+ return Status;
+}
+
+/**
+ Load and execute the dGPU VBIOS.
+
+ @param[in] VbiosConfig - Pointer to VbiosConfig policy for Load/Execute and VBIOS Source.
+ LoadVbios - 0 = Do Not Load ; 1 = Load VBIOS
+ ExecuteVbios - 0 = Do Not Execute; 1 = Execute VBIOS
+ VbiosSource - 0 = PCIE Device ; 1 = FirmwareVolume => TBD
+
+ @retval EFI_SUCCESS - Load and execute successful.
+ @exception EFI_UNSUPPORTED - Secondary VBIOS not loaded.
+**/
+EFI_STATUS
+LoadAndExecuteDgpuVbios (
+ IN SA_SG_VBIOS_CONFIGURATION *VbiosConfig
+ )
+{
+ EFI_HANDLE *HandleBuffer;
+ UINTN HandleCount;
+ UINTN Index;
+ VBIOS_PCIR_STRUCTURE *PcirBlockPtr;
+ EFI_STATUS Status;
+ EFI_PCI_IO_PROTOCOL *PciIo;
+ VBIOS_OPTION_ROM_HEADER *VBiosRomImage;
+ EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
+ EFI_IA32_REGISTER_SET RegSet;
+ EFI_PHYSICAL_ADDRESS ImageLocation;
+ UINTN Offset;
+
+ HandleBuffer = NULL;
+ DgpuOpRomCopied = FALSE;
+
+ DEBUG ((EFI_D_INFO, "SG:: LoadAndExecuteDgpuVbios\n"));
+
+ ///
+ /// Endpoint Device Bus#
+ ///
+ EndpointBus = MmPci8 (0, 0, RootPortDev, RootPortFun, PCI_SBUS);
+
+ ///
+ /// Endpoint Device Not found
+ ///
+ if (EndpointBus == 0xFF) {
+ DEBUG ((EFI_D_ERROR, "SG:: 0x00/0x%x/0x%x Rootport's Endpoint Device Not found\n", RootPortDev, RootPortFun));
+ return EFI_UNSUPPORTED;
+ }
+
+ ///
+ /// Check Policy setting for loading VBIOS
+ ///
+ if (VbiosConfig->LoadVbios != 0) {
+
+ DEBUG ((EFI_D_INFO, "SG:: Start to load dGPU VBIOS if available\n"));
+
+ ///
+ /// Set as if an umcompressed video BIOS image was not obtainable.
+ ///
+ VBiosRomImage = NULL;
+
+ ///
+ /// Get all PCI IO protocols
+ ///
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiPciIoProtocolGuid,
+ NULL,
+ &HandleCount,
+ &HandleBuffer
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ ///
+ /// Find the video BIOS by checking each PCI IO handle for DGPU video
+ /// BIOS OPROM.
+ ///
+ for (Index = 0; Index < HandleCount; Index++) {
+ Status = gBS->HandleProtocol (
+ HandleBuffer[Index],
+ &gEfiPciIoProtocolGuid,
+ (VOID **) &PciIo
+ );
+ if (EFI_ERROR (Status) || (PciIo->RomImage == NULL)) {
+ ///
+ /// If this PCI device doesn't have a ROM image, skip to the next device.
+ ///
+ continue;
+ }
+
+ VBiosRomImage = PciIo->RomImage;
+
+ ///
+ /// Get pointer to PCIR structure
+ ///
+ PcirBlockPtr = (VBIOS_PCIR_STRUCTURE *) ((UINTN) VBiosRomImage + VBiosRomImage->PcirOffset);
+ //AMI override begin
+ if (( PcirBlockPtr->VendorId != 0x10DE) && (PcirBlockPtr->VendorId != 0x1002)){
+ continue;
+ }
+ //AMI override end
+ ///
+ /// Check if we have an video BIOS OPROM for DGPU.
+ ///
+ if ((VBiosRomImage->Signature == OPTION_ROM_SIGNATURE) &&
+ (McDevFunPciCfg16 (EndpointBus, 0, 0, PCI_VID) == PcirBlockPtr->VendorId) &&
+ (PcirBlockPtr->ClassCode[2] == 0x03)
+ ) {
+
+ DEBUG ((EFI_D_INFO, "SG:: Loading dGPU VBIOS...\n"));
+
+ ///
+ /// Allocate space for copying Oprom
+ ///
+ VbiosSize = (PcirBlockPtr->ImageLength) * 512;
+ Status = (gBS->AllocatePool) (EfiBootServicesData, VbiosSize, &VbiosAddress);
+ if (EFI_ERROR (Status)) {
+ break;
+ }
+
+ ///
+ /// Execute VBIOS based on Policy setting
+ ///
+ if (VbiosConfig->ExecuteVbios) {
+ DEBUG ((EFI_D_INFO, "SG:: Execute dGPU VBIOS...\n"));
+ ///
+ /// Memory IO Bus Master needs to be enabled when we execute the vbios
+ ///
+ ///
+ /// Enable Memory Access, IO Access Bus Master enable on PEG/PCH ROOT PORT
+ ///
+ MmPci16Or (0, 0, RootPortDev, RootPortFun, PCI_CMD, BIT0 + BIT1 + BIT2);
+
+ ///
+ /// Enable Memory Access, IO Access Bus Master enable and Rom Enable on Peg/PCH Endpoint device
+ ///
+ McDevFunPciCfg16Or (EndpointBus, 0, 0, PCI_CMD, BIT0 + BIT1 + BIT2);
+
+ ///
+ /// Allocate 64kb under 1MB memory region
+ ///
+ Status = AllocateLegacyMemory (
+ AllocateMaxAddress,
+ CONVENTIONAL_MEMORY_TOP,
+ (BIN_FILE_SIZE_MAX / 4096),
+ &ImageLocation
+ );
+ if (!EFI_ERROR (Status)) {
+ (gBS->SetMem) ((VOID *) (UINTN) ImageLocation, BIN_FILE_SIZE_MAX, 0);
+
+ ///
+ /// After allocation copy VBIOS to buffer
+ ///
+ (gBS->CopyMem) ((VOID *) (UINTN) ImageLocation, PciIo->RomImage, VbiosSize);
+
+ Status = gBS->LocateProtocol (
+ &gEfiLegacyBiosProtocolGuid,
+ NULL,
+ (VOID **) &LegacyBios
+ );
+ if (!EFI_ERROR (Status)) {
+ (gBS->SetMem) (&RegSet, sizeof (EFI_IA32_REGISTER_SET), 0);
+
+ RegSet.H.AH = MmPci8 (0, 0, RootPortDev, RootPortFun, PCI_SBUS);
+ Offset = MemoryRead16 ((UINTN) ImageLocation + 0x40);
+ LegacyBios->FarCall86 (
+ LegacyBios,
+ ((UINT16) RShiftU64 ((ImageLocation & 0x000FFFF0),
+ 4)),
+ ((UINT16) Offset),
+ &RegSet,
+ NULL,
+ 0
+ );
+
+ Offset = MemoryRead16 ((UINTN) ImageLocation + 0x42) + (UINTN) ImageLocation;
+ if (MemoryRead16 ((UINTN) ImageLocation + 0x44) == 0x0) {
+ VbiosSize = MemoryRead8 ((UINTN) ImageLocation + 0x2) * 512;
+ } else {
+ VbiosSize = MemoryRead16 ((UINTN) ImageLocation + 0x44) * 512;
+ }
+ ///
+ /// Copy Oprom to allocated space for the following scenario:
+ /// # Load vbios and Execute vbios policy setting
+ ///
+ DEBUG ((EFI_D_INFO, "Copy Oprom to allocated space: Load & Execute policy satisfied\n"));
+ (gBS->CopyMem) (VbiosAddress, (VOID *) Offset, VbiosSize);
+ DgpuOpRomCopied = TRUE;
+ (gBS->SetMem) ((VOID *) (UINTN) ImageLocation, BIN_FILE_SIZE_MAX, 0);
+ }
+ (gBS->FreePages) (ImageLocation, (BIN_FILE_SIZE_MAX / 4096));
+ }
+
+ ///
+ /// Disable Memory Access, IO Access Bus Master enable and Rom Enable on PEG/PCH Endpoint device
+ ///
+ McDevFunPciCfg16And (EndpointBus, 0, 0, PCI_CMD, ~(BIT0 + BIT1 + BIT2));
+
+ ///
+ /// Disable Memory Access, IO Access Bus Master enable on PEG/PCH Root Port
+ ///
+ MmPci16And (0, 0, RootPortDev, RootPortFun, PCI_CMD, ~(BIT0 + BIT1 + BIT2));
+ }
+
+ ///
+ /// Copy Oprom to allocated space for the following scenario:
+ /// # Load vbios and Execute vbios policy setting in which dGPU execution is not called
+ /// # Load vbios but don't Execute vbios policy setting
+ ///
+ if ((VbiosAddress!=NULL) && (!DgpuOpRomCopied)) {
+ DEBUG ((EFI_D_INFO, "Copy Oprom to allocated space: Load policy satisfied\n"));
+ (gBS->CopyMem) (VbiosAddress, PciIo->RomImage, VbiosSize);
+ DgpuOpRomCopied = TRUE;
+ }
+
+ // AMI MODIFY BEGIN
+ //
+ //
+#ifdef AMI_SgTpv_SUPPORT
+ if (!EFI_ERROR (Status)) {
+ Status = LoadTpvAcpiTables ();
+ }
+#endif // AMI_SgTpv_SUPPORT
+ //
+ // AMI MODIFY ENDS
+ //
+ break;
+ }
+ }
+
+ }
+
+
+ if (VbiosAddress!=NULL) {
+ (gBS->FreePool) (VbiosAddress);
+ }
+
+ if (HandleBuffer!=NULL) {
+ (gBS->FreePool) (HandleBuffer);
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Read SG GPIO value
+
+ @param[in] Value - PCH GPIO number and Active value
+ Bit0 to Bit7 - PCH GPIO Number
+ Bit8 - GPIO Active value (0 = Active Low; 1 = Active High)
+
+ @retval GPIO read value.
+**/
+BOOLEAN
+GpioRead (
+ IN UINT8 Value
+ )
+{
+ BOOLEAN Active;
+ UINT32 Data;
+ UINT16 BitOffset=0;
+ UINT16 Offset=0;
+
+ ///
+ /// Check if SG GPIOs are supported
+ ///
+ if (GpioSupport == 0) {
+ return FALSE;
+ }
+ ///
+ /// Extract GPIO number and Active value
+ ///
+ Active = (BOOLEAN) (Value >> 7);
+ Value &= 0x7F;
+
+ if (CpuFamilyId == EnumCpuHswUlt) {
+ Offset = R_PCH_GP_N_CONFIG0 + (Value * 0x08);
+ BitOffset = 30; //GPI_LVL
+ } else {
+ if (Value < 0x20) {
+ Offset = R_PCH_GPIO_LVL;
+ BitOffset = Value;
+ } else if (Value < 0x40) {
+ Offset = R_PCH_GPIO_LVL2;
+ BitOffset = Value - 0x20;
+ } else {
+ Offset = R_PCH_GPIO_LVL3;
+ BitOffset = Value - 0x40;
+ }
+ }
+
+ ///
+ /// Read specified value GPIO
+ ///
+ Data = IoRead32 (GpioBaseAddress + Offset);
+ Data >>= BitOffset;
+
+ if (Active == 0) {
+ Data = ~Data;
+ }
+
+ return (BOOLEAN) (Data & 0x1);
+}
+
+/**
+ Write SG GPIO value
+
+ @param[in] Value - PCH GPIO number and Active value
+ Bit0 to Bit7 - PCH GPIO Number
+ Bit8 - GPIO Active value (0 = Active Low; 1 = Active High)
+ @param[in] Level - Write data (0 = Disable; 1 = Enable)
+**/
+VOID
+GpioWrite (
+ IN UINT8 Value,
+ IN BOOLEAN Level
+ )
+{
+ BOOLEAN Active;
+ UINT32 Data;
+ UINT16 BitOffset=0;
+ UINT16 Offset=0;
+
+ ///
+ /// Check if SG GPIOs are supported
+ ///
+ if (GpioSupport == 0) {
+ return ;
+ }
+
+ Active = (BOOLEAN) (Value >> 7);
+ Value &= 0x7F;
+
+ if (Active == 0) {
+ Level = (~Level) & 0x1;
+ }
+
+ if (CpuFamilyId == EnumCpuHswUlt) {
+ Offset = R_PCH_GP_N_CONFIG0 + (Value * 0x08);
+ BitOffset = 31; //GPO_LVL
+ } else {
+ if (Value < 0x20) {
+ Offset = R_PCH_GPIO_LVL;
+ BitOffset = Value;
+ } else if (Value < 0x40) {
+ Offset = R_PCH_GPIO_LVL2;
+ BitOffset = Value - 0x20;
+ } else {
+ Offset = R_PCH_GPIO_LVL3;
+ BitOffset = Value - 0x40;
+ }
+ }
+
+ Data = IoRead32 (GpioBaseAddress + Offset);
+ Data &= ~(0x1 << BitOffset);
+ Data |= (Level << BitOffset);
+ IoWrite32 (GpioBaseAddress + Offset, Data);
+
+ return ;
+}
+
+/**
+ Do an AllocatePages () of type AllocateMaxAddress for EfiBootServicesCode
+ memory.
+
+ @param[in] AllocateType - Allocated Legacy Memory Type
+ @param[in] StartPageAddress - Start address of range
+ @param[in] Pages - Number of pages to allocate
+ @param[in, out] Result - Result of allocation
+
+ @retval EFI_SUCCESS - Legacy16 code loaded
+ @retval Other - No protocol installed, unload driver.
+**/
+EFI_STATUS
+AllocateLegacyMemory (
+ IN EFI_ALLOCATE_TYPE AllocateType,
+ IN EFI_PHYSICAL_ADDRESS StartPageAddress,
+ IN UINTN Pages,
+ IN OUT EFI_PHYSICAL_ADDRESS *Result
+ )
+{
+ EFI_STATUS Status;
+ EFI_PHYSICAL_ADDRESS MemPage;
+
+ ///
+ /// Allocate Pages of memory less <= StartPageAddress
+ ///
+ MemPage = (EFI_PHYSICAL_ADDRESS) (UINTN) StartPageAddress;
+ Status = (gBS->AllocatePages) (AllocateType, EfiBootServicesCode, Pages, &MemPage);
+
+ ///
+ /// Do not ASSERT on Status error but let caller decide since some cases
+ /// memory is already taken but that is ok.
+ ///
+ if (!EFI_ERROR (Status)) {
+ *Result = (EFI_PHYSICAL_ADDRESS) (UINTN) MemPage;
+ }
+
+ return Status;
+}
+
+/**
+ Load Intel SG SSDT Tables
+
+ @param[in] None
+
+ @retval EFI_SUCCESS - SG SSDT Table load successful.
+**/
+EFI_STATUS
+LoadAcpiTables (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ EFI_HANDLE *HandleBuffer;
+ BOOLEAN LoadTable;
+ UINTN NumberOfHandles;
+ UINTN Index;
+ INTN Instance;
+ UINTN Size;
+ UINT32 FvStatus;
+ UINTN TableHandle;
+ EFI_GUID AcpiTableGuid;
+ EFI_FV_FILETYPE FileType;
+ EFI_FV_FILE_ATTRIBUTES Attributes;
+ EFI_FIRMWARE_VOLUME_PROTOCOL *FwVol;
+ EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
+ EFI_ACPI_TABLE_VERSION Version;
+ EFI_ACPI_DESCRIPTION_HEADER *TableHeader;
+ EFI_ACPI_COMMON_HEADER *Table;
+
+ FwVol = NULL;
+ Table = NULL;
+
+ AcpiTableGuid = gSgAcpiTableStorageGuid;
+ if (CpuFamilyId == EnumCpuHswUlt) {
+ AcpiTableGuid = gSgAcpiTablePchStorageGuid;
+ }
+
+ DEBUG ((EFI_D_INFO, "SG:: Loading ACPI Tables...\n"));
+
+ ///
+ /// Locate FV protocol.
+ ///
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiFirmwareVolumeProtocolGuid,
+ NULL,
+ &NumberOfHandles,
+ &HandleBuffer
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Look for FV with ACPI storage file
+ ///
+ for (Index = 0; Index < NumberOfHandles; Index++) {
+ ///
+ /// Get the protocol on this handle
+ /// This should not fail because of LocateHandleBuffer
+ ///
+ Status = gBS->HandleProtocol (
+ HandleBuffer[Index],
+ &gEfiFirmwareVolumeProtocolGuid,
+ (VOID **) &FwVol
+ );
+ ASSERT_EFI_ERROR (Status);
+ if (FwVol == NULL) {
+ return EFI_NOT_FOUND;
+ }
+ ///
+ /// See if it has the ACPI storage file
+ ///
+ Size = 0;
+ FvStatus = 0;
+ Status = FwVol->ReadFile (
+ FwVol,
+ &AcpiTableGuid,
+ NULL,
+ &Size,
+ &FileType,
+ &Attributes,
+ &FvStatus
+ );
+
+ ///
+ /// If we found it, then we are done
+ ///
+ if (!EFI_ERROR (Status)) {
+ break;
+ }
+ }
+ ///
+ /// Our exit status is determined by the success of the previous operations
+ /// If the protocol was found, Instance already points to it.
+ ///
+ ///
+ /// Free any allocated buffers
+ ///
+ (gBS->FreePool) (HandleBuffer);
+
+ ///
+ /// Sanity check that we found our data file
+ ///
+ ASSERT (FwVol);
+
+ ///
+ /// By default, a table belongs in all ACPI table versions published.
+ ///
+ Version = EFI_ACPI_TABLE_VERSION_1_0B | EFI_ACPI_TABLE_VERSION_2_0 | EFI_ACPI_TABLE_VERSION_3_0;
+
+ ///
+ /// Locate ACPI tables
+ ///
+ Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **) &AcpiTable);
+
+ ///
+ /// Read tables from the storage file.
+ ///
+ if (FwVol == NULL) {
+ ASSERT_EFI_ERROR (EFI_NOT_FOUND);
+ return EFI_NOT_FOUND;
+ }
+ Instance = 0;
+
+ while (Status == EFI_SUCCESS) {
+ ///
+ /// Read the ACPI tables
+ ///
+ Status = FwVol->ReadSection (
+ FwVol,
+ &AcpiTableGuid,
+ EFI_SECTION_RAW,
+ Instance,
+ (VOID **) &Table,
+ &Size,
+ &FvStatus
+ );
+ if (!EFI_ERROR (Status)) {
+ ///
+ /// check and load SwitchableGraphics SSDT table
+ ///
+ LoadTable = FALSE;
+ TableHeader = (EFI_ACPI_DESCRIPTION_HEADER *) Table;
+
+ if (((EFI_ACPI_DESCRIPTION_HEADER *) TableHeader)->OemTableId == EFI_SIGNATURE_64 (
+ 'S',
+ 'g',
+ 'P',
+ 'e',
+ 'g',
+ 0,
+ 0,
+ 0
+ )
+ ) {
+ ///
+ /// This is SG SSDT [dGPU is present on PEG RootPort]
+ ///
+ DEBUG ((EFI_D_INFO, "SG:: ---- SG SSDT ----\n"));
+ DEBUG ((EFI_D_INFO, "SG:: Found out SSDT:SgPeg [SgSsdt.asl]. dGPU is present on PEG RootPort.\n"));
+ LoadTable = TRUE;
+ }
+
+ if (((EFI_ACPI_DESCRIPTION_HEADER *) TableHeader)->OemTableId == EFI_SIGNATURE_64 (
+ 'S',
+ 'g',
+ 'P',
+ 'c',
+ 'h',
+ 0,
+ 0,
+ 0
+ )
+ ) {
+ ///
+ /// This is SG SSDT [dGPU is present on PCH RootPort]
+ ///
+ DEBUG ((EFI_D_INFO, "SG:: ---- SG SSDT ----\n"));
+ DEBUG ((EFI_D_INFO, "SG:: Found out SSDT:SgPch [SgSsdtPch.asl]. dGPU is present on PCH RootPort.\n"));
+ LoadTable = TRUE;
+ }
+
+ ///
+ /// Add the table
+ ///
+ if (LoadTable) {
+ TableHandle = 0;
+ Status = AcpiTable->InstallAcpiTable (
+ AcpiTable,
+ TableHeader,
+ TableHeader->Length,
+ &TableHandle
+ );
+ }
+ ///
+ /// Increment the instance
+ ///
+ Instance++;
+ Table = NULL;
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+
+VOID
+EFIAPI
+SgExitPmAuthCallback (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ EFI_STATUS Status;
+ VOID *ProtocolPointer;
+
+ ///
+ /// Check if this is first time called by EfiCreateProtocolNotifyEvent() or not,
+ /// if it is, we will skip it until real event is triggered
+ ///
+ Status = gBS->LocateProtocol (&gExitPmAuthProtocolGuid, NULL, &ProtocolPointer);
+ if (EFI_SUCCESS != Status) {
+ return;
+ }
+
+ gBS->CloseEvent (Event);
+
+ DEBUG ((EFI_D_INFO, "SG:: ExitPmAuth Callback\n"));
+ ///
+ /// Load and Execute dGPU VBIOS
+ ///
+ Status = LoadAndExecuteDgpuVbios (mDxePlatformSaPolicy->VbiosConfig);
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/SwitchableGraphicsInit.h b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/SwitchableGraphicsInit.h
new file mode 100644
index 0000000..4d32f8f
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/SwitchableGraphicsInit.h
@@ -0,0 +1,267 @@
+/** @file
+ Header file for the SwitchableGraphics Dxe driver.
+ This driver loads SwitchableGraphics ACPI tables.
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+#ifndef _SWITCHABLE_GRAPHICS_DXE_H_
+#define _SWITCHABLE_GRAPHICS_DXE_H_
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "EfiScriptLib.h"
+#endif
+
+#include "CpuRegs.h"
+#include "CpuPlatformLib.h"
+
+#include "PchAccess.h"
+#include "Acpi3_0.h"
+#include "SaAccess.h"
+
+#include EFI_PROTOCOL_DEPENDENCY (PciIo)
+#include EFI_PROTOCOL_DEPENDENCY (AcpiTable)
+#include EFI_PROTOCOL_DEPENDENCY (FirmwareVolume)
+#include EFI_PROTOCOL_DEPENDENCY (SaGlobalNvsArea)
+#include EFI_GUID_DEFINITION (SaDataHob)
+#include EFI_PROTOCOL_DEFINITION (SaPlatformPolicy)
+
+///
+/// SG ACPI table data storage file
+///
+#include EFI_GUID_DEFINITION (SgAcpiTableStorage)
+
+///
+/// Switchable Graphics defines.
+///
+#define CONVENTIONAL_MEMORY_TOP 0xA0000 ///< 640 KB
+#define BIN_FILE_SIZE_MAX 0x10000
+
+#define OPTION_ROM_SIGNATURE 0xAA55
+
+#define MemoryRead16(Address) * (UINT16 *) (Address)
+#define MemoryRead8(Address) * (UINT8 *) (Address)
+
+///
+/// PEG Capability Equates
+///
+#define PEG_CAP_ID 0x10
+#define PEG_CAP_VER 0x2
+
+#pragma pack(1)
+typedef struct {
+ UINT16 Signature; ///< 0xAA55
+ UINT8 Reserved[22];
+ UINT16 PcirOffset;
+} VBIOS_OPTION_ROM_HEADER;
+#pragma pack()
+
+#pragma pack(1)
+typedef struct {
+ UINT32 Signature; ///< "PCIR"
+ UINT16 VendorId;
+ UINT16 DeviceId;
+ UINT16 Reserved0;
+ UINT16 Length;
+ UINT8 Revision;
+ UINT8 ClassCode[3];
+ UINT16 ImageLength;
+ UINT16 CodeRevision;
+ UINT8 CodeType;
+ UINT8 Indicator;
+ UINT16 Reserved1;
+} VBIOS_PCIR_STRUCTURE;
+#pragma pack()
+
+/**
+ Initialize the SwitchableGraphics support.
+
+ @param[in] ImageHandle - Handle for the image of this driver
+ @param[in] DxePlatformSaPolicy - SA DxePlatformPolicy protocol
+
+ @retval EFI_SUCCESS - SwitchableGraphics initialization complete
+ @retval EFI_OUT_OF_RESOURCES - Unable to allocated memory
+**/
+EFI_STATUS
+SwitchableGraphicsInit (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable,
+ IN DXE_PLATFORM_SA_POLICY_PROTOCOL *DxePlatformSaPolicy
+ )
+;
+
+/**
+ Load and execute the dGPU VBIOS.
+
+ @param[in] VbiosData - Pointer to VbiosData policy for Load/Execute and VBIOS Source.
+ LoadVbios - 0 = Do Not Load ; 1 = Load VBIOS
+ ExecuteVbios - 0 = Do Not Execute; 1 = Execute VBIOS
+ VbiosSource - 0 = PCIE Device ; 1 = FirmwareVolume => TBD
+
+ @retval EFI_SUCCESS - Load and execute successful.
+ @exception EFI_UNSUPPORTED - Secondary VBIOS not loaded.
+**/
+EFI_STATUS
+LoadAndExecuteDgpuVbios (
+ IN SA_SG_VBIOS_CONFIGURATION *VbiosConfig
+ )
+;
+
+/**
+ Initialize the runtime SwitchableGraphics support data for ACPI tables in GlobalNvs.
+ @param[in] SgInfoDataHob - Pointer to Hob for SG system details.
+ @param[in] DxePlatformSgPolicy - Pointer to the loaded image protocol for this driver.
+
+ @retval EFI_SUCCESS - The data updated successfully.
+**/
+EFI_STATUS
+UpdateGlobalNvsData (
+ IN SG_INFO_HOB SgInfo,
+ IN DXE_PLATFORM_SA_POLICY_PROTOCOL *DxePlatformSaPolicy
+ )
+;
+
+/**
+ Do an AllocatePages () of type AllocateMaxAddress for EfiBootServicesCode
+ memory.
+
+ @param[in] AllocateType - Allocated Legacy Memory Type
+ @param[in] StartPageAddress - Start address of range
+ @param[in] Pages - Number of pages to allocate
+ @param[in, out] Result - Result of allocation
+
+ @retval EFI_SUCCESS - Legacy16 code loaded
+ @retval Other - No protocol installed, unload driver.
+**/
+EFI_STATUS
+AllocateLegacyMemory (
+ IN EFI_ALLOCATE_TYPE AllocateType,
+ IN EFI_PHYSICAL_ADDRESS StartPageAddress,
+ IN UINTN Pages,
+ IN OUT EFI_PHYSICAL_ADDRESS *Result
+ )
+;
+
+/**
+ Search and return the offset of desired Pci Express Capability ID
+ CAPID list:
+ 0x0001 = Advanced Error Rreporting Capability
+ 0x0002 = Virtual Channel Capability
+ 0x0003 = Device Serial Number Capability
+ 0x0004 = Power Budgeting Capability
+
+ @param[in] Bus - Pci Bus Number
+ @param[in] Device - Pci Device Number
+ @param[in] Function - Pci Function Number
+ @param[in] CapId - Extended CAPID to search for
+
+ @retval 0 - CAPID not found
+ @retval Other - CAPID found, Offset of desired CAPID
+**/
+UINT32
+PcieFindExtendedCapId (
+ IN UINT8 Bus,
+ IN UINT8 Device,
+ IN UINT8 Function,
+ IN UINT16 CapId
+ )
+;
+
+/**
+ Find the Offset to a given Capabilities ID
+ CAPID list:
+ 0x01 = PCI Power Management Interface
+ 0x04 = Slot Identification
+ 0x05 = MSI Capability
+ 0x10 = PCI Express Capability
+
+ @param[in] Bus - Pci Bus Number
+ @param[in] Device - Pci Device Number
+ @param[in] Function - Pci Function Number
+ @param[in] CapId - CAPID to search for
+
+ @retval 0 - CAPID not found
+ @retval Other - CAPID found, Offset of desired CAPID
+**/
+UINT32
+PcieFindCapId (
+ IN UINT8 Bus,
+ IN UINT8 Device,
+ IN UINT8 Function,
+ IN UINT8 CapId
+ )
+;
+
+/**
+ Read SG GPIO value
+
+ @param[in] Value - PCH GPIO number and Active value
+ Bit0 to Bit7 - PCH GPIO Number
+ Bit8 - GPIO Active value (0 = Active Low; 1 = Active High)
+
+ @retval GPIO read value.
+**/
+BOOLEAN
+GpioRead (
+ IN UINT8 Value
+ )
+;
+
+/**
+ Write SG GPIO value
+
+ @param[in] Value - PCH GPIO number and Active value
+ Bit0 to Bit7 - PCH GPIO Number
+ Bit8 - GPIO Active value (0 = Active Low; 1 = Active High)
+ @param[in] Level - Write data (0 = Disable; 1 = Enable)
+**/
+VOID
+GpioWrite (
+ IN UINT8 Value,
+ IN BOOLEAN Level
+ )
+;
+
+/**
+ Load Intel SG SSDT Tables
+
+ @param[in] None
+
+ @retval EFI_SUCCESS - SG SSDT Table load successful.
+**/
+EFI_STATUS
+LoadAcpiTables (
+ VOID
+ )
+;
+
+
+VOID
+EFIAPI
+SgExitPmAuthCallback (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ );
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/VTd.c b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/VTd.c
new file mode 100644
index 0000000..1dea621
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/VTd.c
@@ -0,0 +1,934 @@
+/** @file
+ This code provides a initialization of intel VT-d (Virtualization Technology for Directed I/O).
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+@todo assumption is ANDD table will use device path to be loaded dynamically, need to use pchplatformpolicy if assumption is incorrect.
+**/
+#include "SaInit.h"
+#include "VTd.h"
+
+UINT32 mPchRootComplexBar;
+DXE_PLATFORM_SA_POLICY_PROTOCOL *mDxePlatformSaPolicy;
+DXE_PCH_PLATFORM_POLICY_PROTOCOL *mDxePlatformPchPolicy;
+PCH_SERIES mPchSeries;
+
+/**
+For device that specified by Device Num and Function Num,
+mDevEnMap is used to check device presence.
+ 0x80 means use Device ID to detemine presence
+
+ The structure is used to check if device scope is valid when update DMAR table
+**/
+UINT16 mDevEnMap[][2] = {
+ {
+ 0x0200,
+ 0x80
+ }, ///< D2F0
+ {
+ 0x1D00,
+ 0x80
+ }, ///< D29F0
+ {
+ 0x1A00,
+ 0x80
+ }, ///< D26F0
+ {
+ 0x1400,
+ 0x80
+ } ///< D20F0
+};
+
+BOOLEAN mInterruptRemappingSupport;
+
+UINT16
+GetFunDisableBit (
+ UINT8 DevNum,
+ UINT8 FunNum
+ )
+/**
+ Get the corresponding device Enable/Disable bit according DevNum and FunNum
+
+ @param[in] DevNum - Device Number
+ @param[in] FunNum - Function Number
+
+ @retval If the device is found, return disable/Enable bit in FD/Deven reigster
+ @retval If not found return 0xFF
+**/
+{
+ UINTN Index;
+
+ for (Index = 0; Index < sizeof (mDevEnMap) / 4; Index++) {
+ if (mDevEnMap[Index][0] == ((DevNum << 0x08) | FunNum)) {
+ return mDevEnMap[Index][1];
+ }
+ }
+
+ return 0xFF;
+}
+
+VOID
+UpdateDRHD (
+ IN OUT VOID *DrhdEnginePtr
+ )
+/**
+ Update the DRHD structure
+
+ @param[in, out] DrhdEnginePtr - A pointer to DRHD structure
+**/
+{
+ UINT16 Length;
+ UINT16 DisableBit;
+ UINTN DeviceScopeNum;
+ BOOLEAN NeedRemove;
+ EFI_ACPI_DRHD_ENGINE1_STRUCT *DrhdEngine;
+
+ //
+ // Convert DrhdEnginePtr to EFI_ACPI_DRHD_ENGINE1_STRUCT Pointer
+ //
+ DrhdEngine = (EFI_ACPI_DRHD_ENGINE1_STRUCT *) DrhdEnginePtr;
+
+ Length = DrhdEngine->Length;
+ DeviceScopeNum = (DrhdEngine->Length - EFI_ACPI_DRHD_ENGINE_HEADER_LENGTH) / sizeof (EFI_ACPI_DEV_SCOPE_STRUCTURE);
+ DisableBit = GetFunDisableBit (
+ DrhdEngine->DeviceScope[0].PciPath[0],
+ DrhdEngine->DeviceScope[0].PciPath[1]
+ );
+ NeedRemove = FALSE;
+ if ((DisableBit == 0xFF) ||
+ (DrhdEngine->RegisterBaseAddress == 0) ||
+ ((DisableBit == 0x80) &&
+ (MmPci32 (0, 0, DrhdEngine->DeviceScope[0].PciPath[0], DrhdEngine->DeviceScope[0].PciPath[1], 0x00) == 0xFFFFFFFF))
+ ){
+ NeedRemove = TRUE;
+ }
+ if (NeedRemove) {
+ Length -= sizeof (EFI_ACPI_DEV_SCOPE_STRUCTURE);
+ }
+ ///
+ /// If no devicescope is left, we set the structure length as 0x00
+ ///
+ if ((Length > EFI_ACPI_DRHD_ENGINE_HEADER_LENGTH) || (DrhdEngine->Flags == 0x01)) {
+ DrhdEngine->Length = Length;
+ } else {
+ DrhdEngine->Length = 0;
+ }
+}
+
+UINT8
+GetIoApicID (
+ VOID
+ )
+/**
+ Get IOAPIC ID from LPC
+
+ @retval APIC ID
+**/
+{
+ UINT8 VOLATILE *IoapicIndex;
+ UINT32 VOLATILE *IoapicData;
+ UINT32 Data32;
+
+ ///
+ /// Get IOAPIC base
+ ///
+ IoapicIndex = (UINT8 *) (UINTN) (R_PCH_IO_APIC_INDEX + ((PchMmRcrb16 (R_PCH_RCRB_OIC) & 0x0ff) << 12));
+ IoapicData = (UINT32 *) (UINTN) (R_PCH_IO_APIC_DATA + ((PchMmRcrb16 (R_PCH_RCRB_OIC) & 0x0ff) << 12));
+
+ ///
+ /// Get APIC ID from Identification Register (Index 0)
+ ///
+ *IoapicIndex = 0;
+ Data32 = (*IoapicData & 0x0F000000) >> 24;
+
+ return (UINT8) Data32;
+}
+
+VOID
+UpdateDRHD2 (
+ IN OUT VOID *DrhdEnginePtr
+ )
+/**
+ Update the second DRHD structure
+
+ @param[in, out] DrhdEnginePtr - A pointer to DRHD structure
+**/
+{
+ UINT16 Length;
+ UINTN DeviceScopeNum;
+ UINTN ValidDeviceScopeNum;
+ UINT16 Data16;
+ UINT16 HpetReg;
+ UINT16 Index;
+ UINT8 Bus;
+ UINT8 Path[2] = { 0, 0 };
+ BOOLEAN NeedRemove;
+ EFI_ACPI_DRHD_ENGINE2_STRUCT *DrhdEngine;
+
+ ///
+ /// Convert DrhdEnginePtr to EFI_ACPI_DRHD_ENGINE2_STRUCT Pointer
+ ///
+ DrhdEngine = (EFI_ACPI_DRHD_ENGINE2_STRUCT *) DrhdEnginePtr;
+
+ Length = DrhdEngine->Length;
+ DeviceScopeNum = (DrhdEngine->Length - EFI_ACPI_DRHD_ENGINE_HEADER_LENGTH) / sizeof (EFI_ACPI_DEV_SCOPE_STRUCTURE);
+ Data16 = 0;
+ Bus = 0;
+ HpetReg = R_PCH_LPC_HPET0;
+ ValidDeviceScopeNum = 0;
+
+ for (Index = 0; Index < DeviceScopeNum; Index++) {
+ NeedRemove = FALSE;
+ /**
+ For HPET and APIC, update device scope if Interrupt remapping is supported. remove device scope
+ if interrupt remapping is not supported.
+ - Index = 0 - IOAPIC
+ - Index = 1 - HPET
+ For Serial IO devices, they do not appear in PCI space, use platform policy to determine existence, also remove if PCH not LP
+ - Index = 2 - I2C0
+ - Index = 3 - I2C1
+ - Index = 4 - SPI0
+ - Index = 5 - SPI1
+ - Index = 6 - UART0
+ - Index = 7 - UART1
+ - Index = 8 - SDIO
+ **/
+ if (mInterruptRemappingSupport) {
+ if (Index == 0) {
+ ///
+ /// Update source id for IoApic's device scope entry
+ ///
+ Data16 = PchLpcPciCfg16 (R_PCH_LPC_IOXAPIC);
+ Bus = (UINT8) (Data16 >> 8);
+ if (Bus != 0x00) {
+ Path[0] = (UINT8) ((Data16 & 0xff) >> 3);
+ Path[1] = (UINT8) (Data16 & 0x7);
+ } else {
+ //
+ // BUGBUG: Here we just hardcode, because in this version, R_PCH_LPC_IOXAPIC is initialized AFTER Vtd run. We can NOT get proper setting from PCH
+ // We can NOT get proper setting from PCH
+ /// @todo check if code still needed
+ //
+ DEBUG ((EFI_D_WARN, "BUGBUG: UpdateApicHpet use hardcode value - To be fixed!\n"));
+ Bus = 0xF0;
+ Path[0] = 0x1F;
+ Path[1] = 0x0;
+ }
+ DrhdEngine->DeviceScope[Index].StartBusNumber = Bus;
+ //
+ // Update APIC ID
+ //
+ DrhdEngine->DeviceScope[Index].EnumId = GetIoApicID ();
+ }
+ if (Index == 1) {
+ ///
+ /// Update source id for HPET's device scope entry
+ ///
+ Data16 = PchLpcPciCfg16 (HpetReg);
+ Bus = (UINT8) (Data16 >> 8);
+ Path[0] = (UINT8) ((Data16 & 0xFF) >> 3);
+ Path[1] = (UINT8) (Data16 & 0x7);
+ DrhdEngine->DeviceScope[Index].StartBusNumber = Bus;
+ }
+ } else {
+ if ((Index == 0) || (Index == 1)) {
+ NeedRemove = TRUE;
+ }
+ }
+ /*
+ Pch removed device from PCI space and it is visible by ACPI only, we use platform policy to check
+ if device is present. If Pch is 2 chip, remove all serialio devices.
+ */
+#ifdef SERIAL_IO_FLAG
+ if (mPchSeries == PchLp){
+ if (Index == 2){
+ if (mDxePlatformPchPolicy->DeviceEnabling->SerialIoI2c0 == 0){
+ NeedRemove = TRUE;
+ }
+ }
+ if (Index == 3){
+ if (mDxePlatformPchPolicy->DeviceEnabling->SerialIoI2c1 == 0){
+ NeedRemove = TRUE;
+ }
+ }
+ if (Index == 4){
+ if (mDxePlatformPchPolicy->DeviceEnabling->SerialIoSpi0 == 0){
+ NeedRemove = TRUE;
+ }
+ }
+ if (Index == 5){
+ if (mDxePlatformPchPolicy->DeviceEnabling->SerialIoSpi1 == 0){
+ NeedRemove = TRUE;
+ }
+ }
+ if (Index == 6){
+ if (mDxePlatformPchPolicy->DeviceEnabling->SerialIoUart0 == 0){
+ NeedRemove = TRUE;
+ }
+ }
+ if (Index == 7){
+ if (mDxePlatformPchPolicy->DeviceEnabling->SerialIoUart1 == 0){
+ NeedRemove = TRUE;
+ }
+ }
+ if (Index == 8){
+ if (mDxePlatformPchPolicy->DeviceEnabling->SerialIoSdio == 0){
+ NeedRemove = TRUE;
+ }
+ }
+ } else {
+#endif
+ if ((Index >= 2) && (Index <= 8)){
+ NeedRemove = TRUE;
+ }
+#ifdef SERIAL_IO_FLAG
+ }
+#endif
+ CopyMem (
+ &DrhdEngine->DeviceScope[ValidDeviceScopeNum],
+ &DrhdEngine->DeviceScope[Index],
+ sizeof (EFI_ACPI_DEV_SCOPE_STRUCTURE)
+ );
+ if (NeedRemove) {
+ Length -= sizeof (EFI_ACPI_DEV_SCOPE_STRUCTURE);
+ } else {
+ ValidDeviceScopeNum++;
+ }
+ }
+ ///
+ /// If no devicescope is left, we set the structure length as 0x00
+ ///
+ if ((Length > EFI_ACPI_DRHD_ENGINE_HEADER_LENGTH) || (DrhdEngine->Flags == 0x01)) {
+ DrhdEngine->Length = Length;
+ } else {
+ DrhdEngine->Length = 0;
+ }
+}
+
+VOID
+UpdateRMRR (
+ IN OUT VOID *RmrrPtr
+ )
+/**
+ Update the RMRR structure
+
+ @param[in, out] RmrrPtr - A pointer to RMRR structure
+**/
+{
+ UINT16 Length;
+ UINT16 DisableBit;
+ UINTN DeviceScopeNum;
+ UINTN ValidDeviceScopeNum;
+ UINTN Index;
+ BOOLEAN NeedRemove;
+ EFI_ACPI_RMRR_USB_STRUC *Rmrr;
+
+ ///
+ /// To make sure all devicescope can be checked,
+ /// we convert the RmrrPtr to EFI_ACPI_RMRR_USB_STRUC pointer
+ ///
+ Rmrr = (EFI_ACPI_RMRR_USB_STRUC *) RmrrPtr;
+ Length = Rmrr->Length;
+ ValidDeviceScopeNum = 0;
+ DeviceScopeNum = (Rmrr->Length - EFI_ACPI_RMRR_HEADER_LENGTH) / sizeof (EFI_ACPI_DEV_SCOPE_STRUCTURE);
+ for (Index = 0; Index < DeviceScopeNum; Index++) {
+ ///
+ /// here we assume Device will exist on PCH if Device Number is greater than 0x0F
+ ///
+ DisableBit = GetFunDisableBit (
+ Rmrr->DeviceScope[Index].PciPath[0],
+ Rmrr->DeviceScope[Index].PciPath[1]
+ );
+ NeedRemove = FALSE;
+ if ((DisableBit == 0xFF) ||
+ ((DisableBit == 0x80) &&
+ (MmPci32 (0, 0, Rmrr->DeviceScope[Index].PciPath[0], Rmrr->DeviceScope[Index].PciPath[1], 0x00) == 0xFFFFFFFF))
+ ){
+ NeedRemove = TRUE;
+ }
+ CopyMem (
+ &Rmrr->DeviceScope[ValidDeviceScopeNum],
+ &Rmrr->DeviceScope[Index],
+ sizeof (EFI_ACPI_DEV_SCOPE_STRUCTURE)
+ );
+ if (NeedRemove) {
+ Length -= sizeof (EFI_ACPI_DEV_SCOPE_STRUCTURE);
+ } else {
+ ValidDeviceScopeNum++;
+ }
+ }
+ ///
+ /// If No deviceScope is left, set length as 0x00
+ ///
+ if (Length > EFI_ACPI_RMRR_HEADER_LENGTH) {
+ Rmrr->Length = Length;
+ } else {
+ Rmrr->Length = 0;
+ }
+}
+
+VOID
+DmarTableUpdate (
+ IN OUT EFI_ACPI_DESCRIPTION_HEADER *TableHeader,
+ IN OUT EFI_ACPI_TABLE_VERSION *Version
+ )
+/**
+ Update the DMAR table
+
+ @param[in, out] TableHeader - The table to be set
+ @param[in, out] Version - Version to publish
+**/
+{
+ EFI_ACPI_DMAR_TABLE *DmarTable;
+ EFI_ACPI_DMAR_TABLE TempDmarTable;
+ UINTN Offset;
+ UINTN StructureLen;
+ UINT16 IgdMode;
+ UINT16 GttMode;
+ UINT32 IgdMemSize;
+ UINT32 GttMemSize;
+
+ IgdMemSize = 0;
+ GttMemSize = 0;
+ DmarTable = (EFI_ACPI_DMAR_TABLE *) TableHeader;
+
+ if (mInterruptRemappingSupport) {
+ DmarTable->Flags |= BIT0; ///< Set INTR_REMAP bit (BIT 0) if interrupt remapping is supported
+ }
+ ///
+ /// Find IGD memsize
+ ///
+ IgdMode = (McD0PciCfg16 (R_SA_GGC) & B_SA_GGC_GMS_MASK) >> 3;
+ if (IgdMode <= V_SA_GGC_GMS_512MB) {
+ IgdMemSize = IgdMode * 32 * (1024) * (1024);
+ } else {
+ IgdMemSize = 0;
+ }
+ ///
+ /// Find GTT mem size
+ ///
+ GttMode = (McD0PciCfg16 (R_SA_GGC) & B_SA_GGC_GGMS_MASK) >> 8;
+ if (GttMode <= V_SA_GGC_GGMS_2MB) {
+ GttMemSize = GttMode * (1024) * (1024);
+ } else {
+ GttMemSize = 0;
+ }
+
+ DmarTable->RmrrIgd.RmrBaseAddress = (McD0PciCfg32 (R_SA_TOLUD) &~(0x01)) - IgdMemSize - GttMemSize;
+ DmarTable->RmrrIgd.RmrLimitAddress = DmarTable->RmrrIgd.RmrBaseAddress + IgdMemSize + GttMemSize - 1;
+ DEBUG ((EFI_D_INFO, "RMRR Base address IGD %016lX\n", DmarTable->RmrrIgd.RmrBaseAddress));
+ DEBUG ((EFI_D_INFO, "RMRR Limit address IGD %016lX\n", DmarTable->RmrrIgd.RmrLimitAddress));
+
+ DmarTable->RmrrUsb.RmrBaseAddress = mDxePlatformSaPolicy->Vtd->RmrrUsbBaseAddress[0];
+ DmarTable->RmrrUsb.RmrLimitAddress = mDxePlatformSaPolicy->Vtd->RmrrUsbBaseAddress[1];
+
+ ///
+ /// Convert to 4KB alignment.
+ ///
+ DmarTable->RmrrUsb.RmrBaseAddress &= ~0xFFF;
+ DmarTable->RmrrUsb.RmrLimitAddress &= ~0xFFF;
+ DmarTable->RmrrUsb.RmrLimitAddress += 0x1000 - 1;
+
+ DEBUG ((EFI_D_INFO, "RMRR Base address USB %016lX\n", DmarTable->RmrrUsb.RmrBaseAddress));
+ DEBUG ((EFI_D_INFO, "RMRR Limit address USB %016lX\n", DmarTable->RmrrUsb.RmrLimitAddress));
+
+ ///
+ /// @todo check if this check is still needed.
+ ///
+ if (DmarTable->RmrrUsb.RmrBaseAddress == 0) {
+ DEBUG ((EFI_D_WARN, "BUGBUG: RmrrUsb.RmrBaseAddress is 0 - To be fixed\n"));
+ }
+ ///
+ /// Update DRHD structures of DmarTable
+ ///
+ DmarTable->DrhdEngine1.RegisterBaseAddress = (McMmio32 (R_SA_MCHBAR_VTD1_OFFSET) &~1);
+ DmarTable->DrhdEngine2.RegisterBaseAddress = (McMmio32 (R_SA_MCHBAR_VTD2_OFFSET) &~1);
+
+ DEBUG ((EFI_D_INFO, "VTD base address1 %x\n", DmarTable->DrhdEngine1.RegisterBaseAddress));
+ DEBUG ((EFI_D_INFO, "VTD base address2 %x\n", DmarTable->DrhdEngine2.RegisterBaseAddress));
+ ///
+ /// copy DmarTable to TempDmarTable to be processed
+ ///
+ CopyMem (&TempDmarTable, DmarTable, sizeof (EFI_ACPI_DMAR_TABLE));
+
+ ///
+ /// Update DRHD structures of temp DMAR table
+ ///
+ UpdateDRHD (&TempDmarTable.DrhdEngine1);
+ UpdateDRHD2 (&TempDmarTable.DrhdEngine2);
+
+ ///
+ /// Update RMRR structures of temp DMAR table
+ ///
+ UpdateRMRR ((VOID *) &TempDmarTable.RmrrUsb);
+ UpdateRMRR ((VOID *) &TempDmarTable.RmrrIgd);
+
+ ///
+ /// Remove unused device scope or entire DRHD structures
+ ///
+ Offset = (UINTN) (&TempDmarTable.DrhdEngine1);
+ if (TempDmarTable.DrhdEngine1.Length != 0) {
+ Offset += TempDmarTable.DrhdEngine1.Length;
+ }
+ if (TempDmarTable.DrhdEngine2.Length != 0) {
+ StructureLen = TempDmarTable.DrhdEngine2.Length;
+ CopyMem ((VOID *) Offset, (VOID *) &TempDmarTable.DrhdEngine2, TempDmarTable.DrhdEngine2.Length);
+ Offset += StructureLen;
+ }
+ ///
+ /// Remove unused device scope or entire RMRR structures
+ ///
+ if (TempDmarTable.RmrrUsb.Length != 0) {
+ StructureLen = TempDmarTable.RmrrUsb.Length;
+ CopyMem ((VOID *) Offset, (VOID *) &TempDmarTable.RmrrUsb, TempDmarTable.RmrrUsb.Length);
+ Offset += StructureLen;
+ }
+ if (TempDmarTable.RmrrIgd.Length != 0) {
+ StructureLen = TempDmarTable.RmrrIgd.Length;
+ CopyMem ((VOID *) Offset, (VOID *) &TempDmarTable.RmrrIgd, TempDmarTable.RmrrIgd.Length);
+ Offset += StructureLen;
+ }
+#ifdef SERIAL_IO_FLAG
+ ///
+ /// Include necessary ANDD structures. If not PchLp, remove all ANDD.
+ ///
+ if (mPchSeries == PchLp){
+ if (mDxePlatformPchPolicy->DeviceEnabling->SerialIoI2c0 != 0) {
+ StructureLen = TempDmarTable.AnddI2C0.Length;
+ CopyMem ((VOID *) Offset, (VOID *) &TempDmarTable.AnddI2C0, TempDmarTable.AnddI2C0.Length);
+ Offset += StructureLen;
+ }
+ if (mDxePlatformPchPolicy->DeviceEnabling->SerialIoI2c1 != 0) {
+ StructureLen = TempDmarTable.AnddI2C1.Length;
+ CopyMem ((VOID *) Offset, (VOID *) &TempDmarTable.AnddI2C1, TempDmarTable.AnddI2C1.Length);
+ Offset += StructureLen;
+ }
+ if (mDxePlatformPchPolicy->DeviceEnabling->SerialIoSpi0 != 0) {
+ StructureLen = TempDmarTable.AnddSpi0.Length;
+ CopyMem ((VOID *) Offset, (VOID *) &TempDmarTable.AnddSpi0, TempDmarTable.AnddSpi0.Length);
+ Offset += StructureLen;
+ }
+ if (mDxePlatformPchPolicy->DeviceEnabling->SerialIoSpi1 != 0) {
+ StructureLen = TempDmarTable.AnddSpi1.Length;
+ CopyMem ((VOID *) Offset, (VOID *) &TempDmarTable.AnddSpi1, TempDmarTable.AnddSpi1.Length);
+ Offset += StructureLen;
+ }
+ if (mDxePlatformPchPolicy->DeviceEnabling->SerialIoUart0 != 0) {
+ StructureLen = TempDmarTable.AnddUa00.Length;
+ CopyMem ((VOID *) Offset, (VOID *) &TempDmarTable.AnddUa00, TempDmarTable.AnddUa00.Length);
+ Offset += StructureLen;
+ }
+ if (mDxePlatformPchPolicy->DeviceEnabling->SerialIoUart1 != 0) {
+ StructureLen = TempDmarTable.AnddUa01.Length;
+ CopyMem ((VOID *) Offset, (VOID *) &TempDmarTable.AnddUa01, TempDmarTable.AnddUa01.Length);
+ Offset += StructureLen;
+ }
+ if (mDxePlatformPchPolicy->DeviceEnabling->SerialIoSdio != 0) {
+ StructureLen = TempDmarTable.AnddSdhc.Length;
+ CopyMem ((VOID *) Offset, (VOID *) &TempDmarTable.AnddSdhc, TempDmarTable.AnddSdhc.Length);
+ Offset += StructureLen;
+ }
+ }
+#endif
+ Offset = Offset - (UINTN) &TempDmarTable;
+ TempDmarTable.Header.Checksum = (UINT8) (TempDmarTable.Header.Checksum + TempDmarTable.Header.Length - Offset);
+ TempDmarTable.Header.Length = (UINT32) Offset;
+ ///
+ /// Replace DMAR table with rebuilt table TempDmarTable
+ ///
+ CopyMem ((VOID *) DmarTable, (VOID *) &TempDmarTable, TempDmarTable.Header.Length);
+}
+
+EFI_STATUS
+WaForVc0RemappingEngine (
+ UINT64 MchBar
+ )
+/**
+ Workaround for VC0 remapping engine
+
+ @param[in] MchBar - MCHBAR address
+
+ @retval EFI_SUCCESS - successed.
+**/
+{
+ UINT16 DeviceId;
+ UINT32 Vc0RemapEngineBase;
+ UINT32 Data32Or;
+ UINT32 Data32And;
+
+ DeviceId = PchLpcPciCfg16(R_PCH_LPC_DEVICE_ID);
+ Vc0RemapEngineBase = Mmio32(MchBar, R_SA_MCHBAR_VTD2_OFFSET) & 0xFFFFFFFE;
+
+ ///
+ /// Disable VTD SuperPage policy when iGfx is enabled
+ ///
+ if (McD2PciCfg16(R_SA_IGD_VID) != 0xFFFF) {
+ Data32And = (UINT32)~(BIT25);
+ Data32Or = 0;
+ Mmio32And(Vc0RemapEngineBase, 0xFF0, Data32And);
+ SCRIPT_MEM_READ_WRITE
+ (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (Vc0RemapEngineBase + 0xFF0),
+ &Data32Or, ///< Data to be ORed
+ &Data32And ///< Data to be ANDed
+ );
+ }
+
+ return EFI_SUCCESS;
+}
+
+VOID
+UpdateDmarExitPmAuth (
+ VOID
+ )
+/**
+ ExitPmAuth routine for update DMAR
+**/
+{
+ EFI_STATUS Status;
+ EFI_HANDLE *HandleBuffer;
+ UINTN NumberOfHandles;
+ EFI_FV_FILETYPE FileType;
+ UINT32 FvStatus;
+ EFI_FV_FILE_ATTRIBUTES Attributes;
+ UINTN Size;
+ UINTN i;
+ INTN Instance;
+ EFI_ACPI_TABLE_VERSION Version;
+ EFI_ACPI_COMMON_HEADER *CurrentTable;
+ UINTN AcpiTableHandle;
+ EFI_FIRMWARE_VOLUME_PROTOCOL *FwVol;
+ EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
+ EFI_ACPI_DESCRIPTION_HEADER *VtdAcpiTable;
+ STATIC BOOLEAN Triggered = FALSE;
+
+ if (Triggered) {
+ return;
+ }
+
+ Triggered = TRUE;
+
+ FwVol = NULL;
+ AcpiTable = NULL;
+ VtdAcpiTable = NULL;
+
+ ///
+ /// Locate PCH platform policy protocol and PCH series to support feature enabling/disabling
+ ///
+ Status = gBS->LocateProtocol (
+ &gDxePchPlatformPolicyProtocolGuid,
+ NULL,
+ (VOID**) &mDxePlatformPchPolicy
+ );
+ ASSERT_EFI_ERROR (Status);
+ mPchSeries = GetPchSeries();
+
+ if ((!mDxePlatformSaPolicy->Vtd->VtdEnable) || (McD0PciCfg32 (R_SA_MC_CAPID0_A_OFFSET) & BIT23)) {
+ DEBUG ((EFI_D_INFO, "Vtd Disabled, skip DMAR Table install\n"));
+
+ return;
+ }
+
+ ///
+ /// Locate ACPI support protocol
+ ///
+ Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **) &AcpiTable);
+
+ ///
+ /// Locate protocol.
+ /// There is little chance we can't find an FV protocol
+ ///
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiFirmwareVolumeProtocolGuid,
+ NULL,
+ &NumberOfHandles,
+ &HandleBuffer
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Looking for FV with ACPI storage file
+ ///
+ for (i = 0; i < NumberOfHandles; i++) {
+ ///
+ /// Get the protocol on this handle
+ /// This should not fail because of LocateHandleBuffer
+ ///
+ Status = gBS->HandleProtocol (
+ HandleBuffer[i],
+ &gEfiFirmwareVolumeProtocolGuid,
+ (VOID **) &FwVol
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// See if it has the ACPI storage file
+ ///
+ Size = 0;
+ FvStatus = 0;
+ Status = FwVol->ReadFile (
+ FwVol,
+ &gSaAcpiTableStorageGuid,
+ NULL,
+ &Size,
+ &FileType,
+ &Attributes,
+ &FvStatus
+ );
+
+ ///
+ /// If we found it, then we are done
+ ///
+ if (Status == EFI_SUCCESS) {
+ break;
+ }
+ }
+ ///
+ /// Our exit status is determined by the success of the previous operations
+ /// If the protocol was found, Instance already points to it.
+ ///
+ ///
+ /// Free any allocated buffers
+ ///
+ FreePool (HandleBuffer);
+
+ ///
+ /// Sanity check that we found our data file
+ ///
+ ASSERT (FwVol);
+ if (FwVol == NULL) {
+ return ;
+ }
+ ///
+ /// By default, a table belongs in all ACPI table versions published.
+ ///
+ Version = EFI_ACPI_TABLE_VERSION_1_0B | EFI_ACPI_TABLE_VERSION_2_0 | EFI_ACPI_TABLE_VERSION_3_0;
+
+ ///
+ /// Read tables from the storage file.
+ ///
+ Instance = 0;
+ CurrentTable = NULL;
+
+ while (Status == EFI_SUCCESS) {
+ Status = FwVol->ReadSection (
+ FwVol,
+ &gSaAcpiTableStorageGuid,
+ EFI_SECTION_RAW,
+ Instance,
+ (VOID **) &CurrentTable,
+ &Size,
+ &FvStatus
+ );
+
+ if (!EFI_ERROR (Status)) {
+ ///
+ /// Check the Signature ID to modify the table
+ ///
+ switch (((EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable)->Signature) {
+
+ case EFI_ACPI_VTD_DMAR_TABLE_SIGNATURE:
+ VtdAcpiTable = (EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable;
+ DmarTableUpdate (VtdAcpiTable, &Version);
+ break;
+
+ default:
+ break;
+ }
+ ///
+ /// Increment the instance
+ ///
+ Instance++;
+ CurrentTable = NULL;
+ }
+ }
+ ///
+ /// Update the VTD table in the ACPI tables.
+ ///
+ AcpiTableHandle = 0;
+ if (VtdAcpiTable != NULL) {
+ Status = AcpiTable->InstallAcpiTable (
+ AcpiTable,
+ VtdAcpiTable,
+ VtdAcpiTable->Length,
+ &AcpiTableHandle
+ );
+ }
+}
+
+EFI_STATUS
+VtdInit (
+ IN DXE_PLATFORM_SA_POLICY_PROTOCOL *DxePlatformSaPolicy
+ )
+/**
+@brief
+ Locate the VT-d ACPI tables data file and read ACPI SSDT tables.
+ Publish the appropriate SSDT based on current configuration and capabilities.
+
+ @param[in] DxePlatformSaPolicy - SA DxePlatformPolicy protocol
+
+ @retval EFI_SUCCESS - Vtd initialization complete
+ @exception EFI_UNSUPPORTED - Vtd is not enabled by policy
+**/
+{
+ EFI_STATUS Status;
+ UINTN i;
+ UINT64 MchBar;
+ UINT32 Data32Or;
+ UINT32 Data32And;
+ UINT32 VtdBase;
+ UINT32 VtBarReg [SA_VTD_ENGINE_NUMBER];
+ CPU_FAMILY CpuFamilyId;
+ CPU_STEPPING CpuStepping;
+
+ mInterruptRemappingSupport = FALSE;
+ mPchRootComplexBar = MmPci32 (0, 0, 31, 0, 0xF0) &~BIT0;
+ MchBar = McD0PciCfg64 (R_SA_MCHBAR) &~BIT0;
+
+ VtBarReg[0] = R_SA_MCHBAR_VTD1_OFFSET;
+ VtBarReg[1] = R_SA_MCHBAR_VTD2_OFFSET;
+ mDxePlatformSaPolicy = DxePlatformSaPolicy;
+
+ ///
+ /// Check SA supports VTD and VTD is enabled in setup menu
+ ///
+ if ((!mDxePlatformSaPolicy->Vtd->VtdEnable) || (McD0PciCfg32 (R_SA_MC_CAPID0_A_OFFSET) & BIT23)) {
+ DEBUG ((EFI_D_WARN, "VTd disabled or no capability!\n"));
+ return EFI_UNSUPPORTED;
+ }
+ DEBUG ((EFI_D_INFO, "VTd enabled\n"));
+
+ ///
+ /// 14.1 Program Remap Engine Base Address
+ /// Configure VTD1 BAR
+ ///
+ i = 0;
+
+ ///
+ /// Skip GFXVTBAR if IGD is disabled
+ ///
+ if (McD2PciCfg16 (R_SA_IGD_VID) != 0xFFFF) {
+ Data32Or = mDxePlatformSaPolicy->Vtd->BaseAddress[i];
+ Data32Or |= 0x1;
+ Mmio32 (MchBar, R_SA_MCHBAR_VTD1_OFFSET) = Data32Or;
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (MchBar + R_SA_MCHBAR_VTD1_OFFSET),
+ 1,
+ &Data32Or
+ );
+ i++;
+ }
+
+ ///
+ /// Configure VTD2 BAR
+ ///
+ Data32Or = mDxePlatformSaPolicy->Vtd->BaseAddress[i];
+ Data32Or |= 0x1;
+ Mmio32 (MchBar, R_SA_MCHBAR_VTD2_OFFSET) = Data32Or;
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (MchBar + R_SA_MCHBAR_VTD2_OFFSET),
+ 1,
+ &Data32Or
+ );
+
+ ///
+ /// Workaround for VC0 remapping engine
+ ///
+ Status = WaForVc0RemappingEngine (MchBar);
+ ASSERT_EFI_ERROR (Status);
+
+ for (i = 0; i < SA_VTD_ENGINE_NUMBER; i++) {
+ VtdBase = Mmio32 (MchBar, VtBarReg[i]) & 0xfffffffe;
+
+ ///
+ /// skip if the VT bar is 0
+ ///
+ if (VtdBase == 0) {
+ continue;
+ }
+
+ CpuFamilyId = GetCpuFamily();
+ CpuStepping = GetCpuStepping();
+
+ if ((CpuFamilyId == EnumCpuHsw) || (CpuFamilyId == EnumCpuHswUlt) || (CpuFamilyId == EnumCpuCrw)
+ ) {
+ Data32And = (UINT32) ~(BIT15+BIT16+BIT17+BIT18+BIT19); ///< mask out 19:15
+ Data32Or = BIT15;
+ if (i == 1) {
+ Mmio32AndThenOr (VtdBase, 0xF04, Data32And, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (VtdBase + 0xF04),
+ &Data32Or, ///< Data to be ORed
+ &Data32And ///< Data to be ANDed
+ );
+ }
+ }
+ ///
+ /// 14.2 Set the remap engine policy bits
+ ///
+ Data32And = 0x0; ///< mask out all bits
+ Data32Or = 0;
+
+
+ if ((CpuFamilyId == EnumCpuHsw) || (CpuFamilyId == EnumCpuHswUlt) || (CpuFamilyId == EnumCpuCrw)) {
+ if (i == 0) {
+ Data32Or |= 0x02100000;
+ }
+ if (i == 1) {
+ if (McD2PciCfg16 (R_SA_IGD_VID) != 0xFFFF) {
+ Data32Or |= 0x000A5003;
+ } else {
+ Data32Or |= 0x020A5003;
+ }
+ }
+ }
+
+ ///
+ /// Set lock bit
+ ///
+ Data32Or |= BIT31;
+
+
+ Mmio32AndThenOr (VtdBase, 0xFF0, Data32And, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (VtdBase + 0xFF0),
+ &Data32Or, ///< Data to be ORed
+ &Data32And ///< Data to be ANDed
+ );
+
+ ///
+ /// Check IR status
+ ///
+ if ((Mmio32 (VtdBase, VTD_ECAP_REG) & IR) && !(mInterruptRemappingSupport)) {
+ mInterruptRemappingSupport = TRUE;
+ }
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/VTd.h b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/VTd.h
new file mode 100644
index 0000000..2d9daa4
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/VTd.h
@@ -0,0 +1,70 @@
+/** @file
+ This code provides a initialization of intel VT-d (Virtualization Technology for Directed I/O).
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _VT_D_H_
+#define _VT_D_H_
+
+///
+/// Include files
+///
+#include "DmaRemappingTable.h"
+#include "SaAccess.h"
+#include "PchAccess.h"
+
+#include EFI_PROTOCOL_DEPENDENCY (AcpiTable)
+#include EFI_PROTOCOL_DEFINITION (SaPlatformPolicy)
+#include EFI_PROTOCOL_DEFINITION (PchPlatformPolicy)
+
+///
+/// SA ACPI table data storage file
+///
+#include EFI_GUID_DEFINITION (SaAcpiTableStorage)
+
+#define VTD_ECAP_REG 0x10
+#define IR BIT3
+
+#define VTD_GCMD_REG 0x18
+#define QIE BIT26
+#define IRE BIT25
+
+EFI_STATUS
+VtdInit (
+ IN DXE_PLATFORM_SA_POLICY_PROTOCOL *DxePlatformSaPolicy
+ )
+/**
+ Locate the VT-d ACPI tables data file and read ACPI SSDT tables.
+ Publish the appropriate SSDT based on current configuration and capabilities.
+
+ @param[in] DxePlatformSaPolicy SA DxePlatformPolicy protocol
+
+ @retval EFI_SUCCESS - Vtd initialization complete
+ @retval Other - No Vtd function initiated
+**/
+;
+
+VOID
+UpdateDmarExitPmAuth (
+ VOID
+ )
+/**
+ ExitPmAuth routine for update DMAR
+**/
+;
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/graphicsinit.c b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/graphicsinit.c
new file mode 100644
index 0000000..2b1af13
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/graphicsinit.c
@@ -0,0 +1,1094 @@
+/** @file
+ DXE driver for Initializing SystemAgent Graphics initialization.
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "GraphicsInit.h"
+#include EFI_PROTOCOL_DEFINITION (LegacyBios)
+#include EFI_PROTOCOL_DEFINITION (GopComponentName2)
+#ifndef AMI_OVERRIDE_FOR_INTEL_GOP_SUPPORT
+#if (defined(IntelSaGopDriver_SUPPORT) && (IntelSaGopDriver_SUPPORT == 1))
+#include "Include\Protocol\IntelSaGopDriver.h"
+#endif
+#endif
+UINT64 GTTMMADR;
+UINTN MCHBAR_BASE;
+UINT8 rP1GraphicsFreq;
+EFI_EVENT mExitPmAuthEvent;
+
+DXE_PLATFORM_SA_POLICY_PROTOCOL *mDxePlatformSaPolicy;
+GOP_COMPONENT_NAME2_PROTOCOL *GopComponentName2Protocol = NULL;
+
+///
+/// RC6 Settings
+///
+BOOT_SCRIPT_REGISTER_SETTING gSaGtRC6Registers[] = {
+ 0x0,
+ 0xA090,
+ 0xFFFFFFFF,
+ 0x0,
+ ///
+ /// RC1e - RC6/6p - RC6pp Wake Rate Limits
+ ///
+ 0x0,
+ 0xA098,
+ 0xFFFFFFFF,
+ 0x3E80000,
+ 0x0,
+ 0xA09C,
+ 0xFFFFFFFF,
+ 0x00280000,
+ 0x0,
+ 0xA0A8,
+ 0xFFFFFFFF,
+ 0x1E848,
+ 0x0,
+ 0xA0AC,
+ 0xFFFFFFFF,
+ 0x19,
+ ///
+ /// Render/Video/Blitter Idle Max Count
+ ///
+ 0x0,
+ 0x2054,
+ 0x0,
+ 0xA,
+ 0x0,
+ 0x12054,
+ 0x0,
+ 0xA,
+ 0x0,
+ 0x22054,
+ 0x0,
+ 0xA,
+ 0x0,
+ 0x1a054,
+ 0x0,
+ 0xA,
+ ///
+ /// RC Sleep / RCx Thresholds
+ ///
+ 0x0,
+ 0xA0B0,
+ 0xFFFFFFFF,
+ 0,
+ 0x0,
+ 0xA0B4,
+ 0xFFFFFFFF,
+ 0x3E8,
+ 0x0,
+ 0xA0B8,
+ 0xFFFFFFFF,
+ 0xC350,
+ ///
+ /// RP Settings
+ ///
+ 0x0,
+ 0xA010,
+ 0xFFFFFFFF,
+ 0xF4240,
+ 0x0,
+ 0xA014,
+ 0xFFFFFFFF,
+ 0x12060000,
+ 0x0,
+ 0xA02C,
+ 0xFFFFFFFF,
+ 0x0000E808,
+ 0x0,
+ 0xA030,
+ 0xFFFFFFFF,
+ 0x0003BD08,
+ 0x0,
+ 0xA068,
+ 0xFFFFFFFF,
+ 0x000101D0,
+ 0x0,
+ 0xA06C,
+ 0xFFFFFFFF,
+ 0x00055730,
+ 0x0,
+ 0xA070,
+ 0xFFFFFFFF,
+ 0xA
+};
+
+///
+/// PM Lock Settings
+///
+BOOT_SCRIPT_REGISTER_SETTING gSaGtPmLockBits[] = {
+ 0x0,
+ 0xA248,
+ 0xFFFFFFFF,
+ BIT31,
+ 0x0,
+ 0xA004,
+ 0xFFFFFFFF,
+ BIT4,
+ 0x0,
+ 0xA080,
+ 0xFFFFFFFF,
+ BIT2,
+ 0x0,
+ 0xA180,
+ 0xFFFFFFFF,
+ BIT31
+};
+
+EFI_STATUS
+PmInit (
+ IN EFI_HANDLE ImageHandle,
+ IN DXE_PLATFORM_SA_POLICY_PROTOCOL *DxePlatformSaPolicy
+ )
+/**
+ Initialize GT PowerManagement of SystemAgent.
+
+ @param[in] ImageHandle - Handle for the image of this driver
+ @param[in] DxePlatformSaPolicy - SA DxePlatformPolicy protocol
+
+ @retval EFI_SUCCESS - GT Power Management initialization complete
+**/
+{
+ UINT8 i;
+ UINT32 RegOffset;
+ UINT32 Data32;
+ UINT32 Data32And;
+ UINT32 Data32Or;
+ UINT32 Data32Mask;
+ UINT32 Result;
+ CPU_STEPPING CpuSteppingId;
+ CPU_FAMILY CpuFamilyId;
+
+ CpuFamilyId = GetCpuFamily();
+ CpuSteppingId = GetCpuStepping();
+
+ ///
+ /// Multi Threaded Force Wake
+ ///
+ RegOffset = 0xA180;
+ Data32 = BIT5;
+ Mmio32 (GTTMMADR, RegOffset) = Data32;
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (GTTMMADR + RegOffset),
+ 1,
+ &Data32
+ );
+
+ RegOffset = 0xA188;
+ Data32 = 0x00010001;
+ Mmio32 (GTTMMADR, RegOffset) = Data32;
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (GTTMMADR + RegOffset),
+ 1,
+ &Data32
+ );
+ ///
+ /// Force Wake Acknowledge Bit
+ ///
+ RegOffset = 0x130044;
+ Data32Mask = BIT0;
+ Result = 1;
+ PollGtReady (GTTMMADR, RegOffset, Data32Mask, Result);
+ SCRIPT_MEM_POLL (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (GTTMMADR + RegOffset),
+ &Data32Mask,
+ &Result,
+ 50,
+ 200000
+ );
+
+ ///
+ /// Enable counters except Power Meter
+ ///
+ Data32And = 0xFFFFFFFF;
+ Data32Or = 0x16;
+ Mmio32AndThenOr (GTTMMADR, 0xA248, Data32And, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (GTTMMADR + 0xA248),
+ &Data32Or, /// Data to be ORed
+ &Data32And /// Data to be ANDed
+ );
+
+ ///
+ /// GFXPAUSE Settings
+ ///
+ Data32 = 0x70020;
+
+
+ if (((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId < EnumHswC0) ) ||
+ ((CpuFamilyId == EnumCpuHswUlt) && (CpuSteppingId < EnumHswUltC0)) ||
+ ((CpuFamilyId == EnumCpuCrw) && (CpuSteppingId < EnumCrwC0) )) {
+ Data32 |= 0xFFFF;
+ }
+
+ Mmio32 (GTTMMADR, 0xA000) = Data32;
+
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (GTTMMADR + 0xA000),
+ 1,
+ &Data32
+ );
+
+
+ ///
+ /// ECO Settings
+ /// BIT28 = 1 GFX will be blocked from accessing memory (go=0) during CPD enter
+ /// BIT26 = 1 indicates to PCU that we are doing a fifo block due to RC6 and not CPD
+ /// BIT[24:22] = 100 RC6 Control
+ ///
+ RegOffset = 0xA180;
+ Data32And = 0xFFFFFFFF;
+ Data32Or = BIT28 + BIT26;
+ if (DxePlatformSaPolicy->IgdConfig->RenderStandby) {
+ Data32And = (UINT32)~(BIT23 + BIT22);
+ Data32Or |= BIT24;
+ }
+
+ ///
+ /// Force CPD Non-IA. for steppings less than C0 for HSW/CRW
+ ///
+ if (((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId < EnumHswC0)) ||
+ ((CpuFamilyId == EnumCpuCrw) && (CpuSteppingId < EnumCrwC0))) {
+ Data32Or |= BIT30;
+ }
+ ///
+ /// Force CPD Block memory bits. for stepping less than C0 for HSW/ULT/CRW
+ ///
+ if (((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId < EnumHswC0) ) ||
+ ((CpuFamilyId == EnumCpuHswUlt) && (CpuSteppingId < EnumHswUltC0)) ||
+ ((CpuFamilyId == EnumCpuCrw) && (CpuSteppingId < EnumCrwC0) )) {
+ Data32And &= (UINT32)~(BIT28);
+ Data32Or &= (UINT32)~(BIT28);
+ }
+
+ Mmio32AndThenOr (GTTMMADR, RegOffset, Data32And, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (GTTMMADR + RegOffset),
+ &Data32Or, /// Data to be ORed
+ &Data32And /// Data to be ANDed
+ );
+
+ ///
+ /// Clock Gating Settings
+ ///
+ Data32 = 0x3FD;
+ Mmio32 (GTTMMADR, 0x9424) = Data32;
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (GTTMMADR + 0x9424),
+ 1,
+ &Data32
+ );
+
+ ///
+ /// Enable Unit Level Clock Gates
+ ///
+ Data32 = 0x80;
+ Mmio32 (GTTMMADR, 0x9400) = Data32;
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (GTTMMADR + 0x9400),
+ 1,
+ &Data32
+ );
+
+ Data32 = 0x40401000;
+ Mmio32 (GTTMMADR, 0x9404) = Data32;
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (GTTMMADR + 0x9404),
+ 1,
+ &Data32
+ );
+
+ Data32 = 0;
+ Mmio32 (GTTMMADR, 0x9408) = Data32;
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (GTTMMADR + 0x9408),
+ 1,
+ &Data32
+ );
+
+ Data32 = 0x02000001;
+ Mmio32 (GTTMMADR, 0x940c) = Data32;
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (GTTMMADR + 0x940c),
+ 1,
+ &Data32
+ );
+
+ Data32 = 0x08000000;
+ Mmio32 (GTTMMADR, 0xA008) = Data32;
+
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (GTTMMADR + 0xA008),
+ 1,
+ &Data32
+ );
+ ///
+ /// RC6 Settings
+ ///
+ for (i = 0; i < sizeof (gSaGtRC6Registers) / sizeof (BOOT_SCRIPT_REGISTER_SETTING); ++i) {
+ RegOffset = gSaGtRC6Registers[i].Offset;
+ Data32And = gSaGtRC6Registers[i].AndMask;
+ Data32Or = gSaGtRC6Registers[i].OrMask;
+
+ Mmio32AndThenOr (GTTMMADR, RegOffset, Data32And, Data32Or);
+
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (GTTMMADR + RegOffset),
+ &Data32Or, /// Data to be ORed
+ &Data32And /// Data to be ANDed
+ );
+ }
+
+ ///
+ /// RP Control
+ ///
+ Data32 = 0xB92;
+ Mmio32 (GTTMMADR, 0xA024) = Data32;
+
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (GTTMMADR + 0xA024),
+ 1,
+ &Data32
+ );
+
+ ///
+ /// HW RC6 Control Settings
+ ///
+ Data32 = 0;
+
+ if (DxePlatformSaPolicy->IgdConfig->RenderStandby) {
+ Data32 = 0x88040000;
+ }
+
+ Mmio32 (GTTMMADR, 0xA090) = Data32;
+
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (GTTMMADR + 0xA090),
+ 1,
+ &Data32
+ );
+
+ ///
+ /// Video frequency request
+ ///
+ Data32 = 0x08000000;
+ Mmio32 (GTTMMADR, 0xA00C) = Data32;
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (GTTMMADR + 0xA00C),
+ 1,
+ &Data32
+ );
+
+ ///
+ /// RC6 Settings
+ ///
+ ///
+ /// Wait for Mailbox ready
+ ///
+ Data32Mask = BIT31;
+ Result = 0;
+
+ PollGtReady (GTTMMADR, 0x138124, Data32Mask, Result);
+
+ SCRIPT_MEM_POLL (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (GTTMMADR + 0x138124),
+ &Data32Mask,
+ &Result,
+ 50,
+ 200000
+ );
+
+ ///
+ /// Mailbox Data - RC6 VIDS
+ ///
+ Data32 = 0x0;
+ Mmio32 (GTTMMADR, 0x138128) = Data32;
+
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (GTTMMADR + 0x138128),
+ 1,
+ &Data32
+ );
+
+ ///
+ /// Mailbox Command
+ ///
+ Data32 = 0x80000004;
+ Mmio32 (GTTMMADR, 0x138124) = Data32;
+
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (GTTMMADR + 0x138124),
+ 1,
+ &Data32
+ );
+
+ ///
+ /// Wait for Mailbox ready
+ ///
+ Data32Mask = BIT31;
+ Result = 0;
+
+ PollGtReady (GTTMMADR, 0x138124, Data32Mask, Result);
+
+ SCRIPT_MEM_POLL (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (GTTMMADR + 0x138124),
+ &Data32Mask,
+ &Result,
+ 50,
+ 200000
+ );
+
+ ///
+ /// Enable PM Interrupts
+ ///
+ Data32 = 0x3000076;
+ Mmio32 (GTTMMADR, 0x4402C) = Data32;
+
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (GTTMMADR + 0x4402C),
+ 1,
+ &Data32
+ );
+
+ ///
+ /// RC6 setting
+ ///
+ if (mDxePlatformSaPolicy->IgdConfig->RenderStandby) {
+ ///
+ /// Software RC state - RC6
+ ///
+ Data32 = 0x40000;
+ Mmio32 (GTTMMADR, 0xA094) = Data32;
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (GTTMMADR + 0xA094),
+ 1,
+ &Data32
+ );
+ }
+
+ ///
+ /// PM Lock Settings
+ ///
+ for (i = 0; i < sizeof (gSaGtPmLockBits) / sizeof (BOOT_SCRIPT_REGISTER_SETTING); ++i) {
+ RegOffset = gSaGtPmLockBits[i].Offset;
+ Data32And = gSaGtPmLockBits[i].AndMask;
+ Data32Or = gSaGtPmLockBits[i].OrMask;
+
+ Mmio32AndThenOr (GTTMMADR, RegOffset, Data32And, Data32Or);
+
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (GTTMMADR + RegOffset),
+ &Data32Or, /// Data to be ORed
+ &Data32And /// Data to be ANDed
+ );
+ }
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+PavpInit (
+ IN EFI_HANDLE ImageHandle,
+ IN DXE_PLATFORM_SA_POLICY_PROTOCOL *DxePlatformSaPolicy
+ )
+/**
+ Initialize PAVP feature of SystemAgent.
+
+ @param[in] ImageHandle - Handle for the image of this driver
+ @param[in] DxePlatformSaPolicy - SA DxePlatformPolicy protocol
+
+ @retval EFI_SUCCESS - PAVP initialization complete
+**/
+{
+
+ UINT32 DwordData;
+ UINT32 PcmBase;
+ CPU_STEPPING CpuSteppingId;
+ CPU_FAMILY CpuFamilyId;
+
+ CpuFamilyId = GetCpuFamily();
+ CpuSteppingId = GetCpuStepping();
+
+ McD0PciCfg32And (R_SA_PAVPC, ~(B_SA_PAVPC_HVYMODSEL_MASK | B_SA_PAVPC_PCMBASE_MASK | B_SA_PAVPC_PAVPE_MASK | B_SA_PAVPC_PCME_MASK));
+ McD0PciCfg16Or (R_SA_PAVPC, B_SA_PAVPC_PCME_MASK | B_SA_PAVPC_PAVPE_MASK);
+ PcmBase = ((UINT32) RShiftU64 ((McD0PciCfg32 (R_SA_TOLUD)), 20)) - PAVP_PCM_SIZE_1_MB;
+ McD0PciCfg32Or (R_SA_PAVPC, (UINT32) LShiftU64 (PcmBase, 20));
+
+ if ((CpuFamilyId == EnumCpuHsw) ||
+ (CpuFamilyId == EnumCpuHswUlt) ||
+ (CpuFamilyId == EnumCpuCrw)
+ ){
+ McD0PciCfg32Or (R_SA_PAVPC, (BIT4));
+ }
+
+ DwordData = McD0PciCfg32 (R_SA_PAVPC);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (MmPciAddress (0,
+ 0,
+ 0,
+ 0,
+ R_SA_PAVPC)),
+ 1,
+ &DwordData
+ );
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+PostPmInitExitPmAuth (
+ VOID
+ )
+/**
+ Do Post GT PM Init Steps after VBIOS Initialization.
+
+ @retval EFI_SUCCESS Succeed.
+**/
+{
+ UINT32 RegOffset;
+ UINT32 Data32;
+ EFI_STATUS Status;
+ UINT32 Data32Mask;
+ UINT32 Result;
+ UINT16 Data16;
+ CHAR16 *DriverVersion;
+ UINTN Index;
+ EFI_LEGACY_BIOS_PROTOCOL *LegacyBios = NULL;
+
+ ///
+ /// Get the platform setup policy.
+ ///
+ Status = gBS->LocateProtocol (&gDxePlatformSaPolicyGuid, NULL, (VOID **) &mDxePlatformSaPolicy);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// only 32bit read/write is legal for device 0:2:0
+ ///
+ GTTMMADR = (UINT64) (McD2PciCfg32 (R_SA_IGD_GTTMMADR));
+ GTTMMADR = LShiftU64 ((UINT64) McD2PciCfg32 (R_SA_IGD_GTTMMADR + 4), 32) | (GTTMMADR);
+
+ ///
+ /// Save the current GTMMADR value into S3 resume script before other S3 resume items in this function.
+ /// GTTMMADR may have been modified by the PCI enumeration code at this point,
+ /// but not saved into the S3 resume script yet.
+ ///
+ ///
+ /// only 32bit read/write is legal for device 0:2:0
+ ///
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (MmPciAddress (0,
+ 0,
+ 2,
+ 0,
+ R_SA_IGD_GTTMMADR)),
+ 1,
+ &GTTMMADR
+ );
+
+ ///
+ /// only 32bit read/write is legal for device 0:2:0
+ ///
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (MmPciAddress (0,
+ 0,
+ 2,
+ 0,
+ R_SA_IGD_GTTMMADR + 4)),
+ 1,
+ (&(UINT32) GTTMMADR) + 1
+ );
+
+ GTTMMADR = GTTMMADR &~(BIT2 | BIT1);
+
+ ///
+ /// Enable Bus Master, I/O and Memory access on 0:2:0
+ ///
+ McD2PciCfg16Or (R_SA_IGD_CMD, (BIT2 | BIT1));
+ Data16 = McD2PciCfg16(R_SA_IGD_CMD);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (MmPciAddress (0, 0, 2, 0, R_SA_IGD_CMD)),
+ 1,
+ &Data16
+ );
+
+ ///
+ /// Deassert Force Wake
+ RegOffset = 0xA188;
+ Data32 = 0x00010000;
+ Mmio32 (GTTMMADR, RegOffset) = Data32;
+
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (GTTMMADR + RegOffset),
+ 1,
+ &Data32
+ );
+
+ RegOffset = 0x130044;
+ Data32Mask = BIT0;
+ Result = 0;
+ PollGtReady (GTTMMADR, RegOffset, Data32Mask, Result);
+
+ SCRIPT_MEM_POLL (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (GTTMMADR + RegOffset),
+ &Data32Mask,
+ &Result,
+ 50,
+ 200000
+ );
+
+ RegOffset = 0xA188;
+ Data32 = 0x00000001;
+ Mmio32 (GTTMMADR, RegOffset) = Data32;
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (GTTMMADR + RegOffset),
+ 1,
+ &Data32
+ );
+
+
+ Status = gBS->LocateProtocol (
+ &gEfiLegacyBiosProtocolGuid,
+ NULL,
+ (VOID **) &LegacyBios
+ );
+
+
+#ifndef AMI_OVERRIDE_FOR_INTEL_GOP_SUPPORT
+#if (defined(IntelSaGopDriver_SUPPORT) && (IntelSaGopDriver_SUPPORT == 1))
+{
+ EFI_PHYSICAL_ADDRESS VbtAddress;
+ UINT32 VbtSize;
+ PLATFORM_GOP_POLICY_PROTOCOL *PlatformGOPPolicy;
+ EFI_GUID PlatformGOPPolicyGuid = EFI_PLATFORM_GOP_POLICY_PROTOCOL_GUID;
+ EFI_STATUS Status2 = EFI_SUCCESS;
+ //
+ // Locate Platform GOP policy protocol
+ //
+ Status = gBS->LocateProtocol (&PlatformGOPPolicyGuid, NULL, &PlatformGOPPolicy);
+ if (!EFI_ERROR(Status)) {
+ Status2 = PlatformGOPPolicy->GetVbtData(&VbtAddress, &VbtSize);
+ if (!EFI_ERROR(Status2)) LegacyBios = NULL;
+ }
+}
+#endif
+#endif // AMI_OVERRIDE_FOR_INTEL_GOP_SUPPORT
+
+ if (!LegacyBios) {
+ Status = gBS->LocateProtocol (&gGopComponentName2ProtocolGuid, NULL, (VOID **)&GopComponentName2Protocol);
+ if (!EFI_ERROR (Status)) {
+ Status = GopComponentName2Protocol->GetDriverVersion (
+ GopComponentName2Protocol,
+ "en-US",
+ &DriverVersion
+ );
+ if (!EFI_ERROR (Status)) {
+ for (Index = 0; (DriverVersion[Index] != '\0'); Index++) {
+ }
+ Index = (Index+1)*2;
+ CopyMem(mDxePlatformSaPolicy->IgdConfig->GopVersion, DriverVersion, Index);
+ }
+ }
+ }
+
+ ///
+ /// Return final status
+ ///
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+GraphicsInit (
+ IN EFI_HANDLE ImageHandle,
+ IN DXE_PLATFORM_SA_POLICY_PROTOCOL *DxePlatformSaPolicy
+ )
+/**
+Initialize GT Post Routines.
+
+ @param[in] ImageHandle - Handle for the image of this driver
+ @param[in] DxePlatformSaPolicy - SA DxePlatformPolicy protocol
+
+ @retval EFI_SUCCESS - GT POST initialization complete
+ @retval EFI_NOT_FOUND - Dxe System Table not found.
+**/
+{
+ EFI_PHYSICAL_ADDRESS MemBaseAddress;
+ UINT32 LoGTBaseAddress;
+ UINT32 HiGTBaseAddress;
+ UINT32 Data32And;
+ UINT32 Data32Or;
+ EFI_STATUS Status;
+ UINTN DwordData;
+ UINT32 Data32Mask;
+ UINT32 Result;
+ UINT16 Data16;
+ CPU_FAMILY CpuFamilyId;
+ UINT8 CpuSteppingId;
+ UINT32 Data32;
+ UINT16 IsUlx;
+
+ CpuFamilyId = GetCpuFamily();
+ CpuSteppingId = GetCpuStepping();
+
+ GTTMMADR = 0;
+ Status = EFI_SUCCESS;
+ MCHBAR_BASE = McD0PciCfg64 (0x48) &~BIT0;
+
+ ///
+ /// Read the RP1 Graphics Frequency
+ ///
+ rP1GraphicsFreq = (UINT8) ((Mmio32 (MCHBAR_BASE, 0x5998) >> 8) & 0xFF);
+
+ ///
+ /// If device 0:2:0 (Internal Graphics Device, or GT) is enabled, then Program GTTMMADR,
+ ///
+ if (McD2PciCfg16 (R_SA_IGD_VID) != 0xFFFF) {
+ gDS = NULL;
+ Status = EfiGetSystemConfigurationTable (&gEfiDxeServicesTableGuid, (VOID **) &gDS);
+ ASSERT_EFI_ERROR (Status);
+ ASSERT(gDS != NULL);
+ if (gDS == NULL) {
+ return EFI_NOT_FOUND;
+ }
+
+ ///
+ /// Means Allocate 4MB for GTTMADDR
+ ///
+ MemBaseAddress = 0x0ffffffffffffffff;
+
+ Status = gDS->AllocateMemorySpace (
+ EfiGcdAllocateAnySearchBottomUp,
+ EfiGcdMemoryTypeMemoryMappedIo,
+ GTT_MEM_ALIGN,
+ GTTMMADR_SIZE_4MB,
+ &MemBaseAddress,
+ ImageHandle,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Program GT PM Settings if GTTMMADR allocation is Successful
+ ///
+ GTTMMADR = (UINTN) MemBaseAddress;
+
+ LoGTBaseAddress = (UINT32) (MemBaseAddress & 0xFFFFFFFF);
+ HiGTBaseAddress = (UINT32) RShiftU64 ((MemBaseAddress & 0xFFFFFFFF00000000), 32);
+ McD2PciCfg32 (R_SA_IGD_GTTMMADR) = LoGTBaseAddress | BIT2;
+ McD2PciCfg32 (R_SA_IGD_GTTMMADR + 4) = HiGTBaseAddress;
+
+ DwordData = McD2PciCfg32 (R_SA_IGD_GTTMMADR);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (MmPciAddress (0,
+ 0,
+ 2,
+ 0,
+ R_SA_IGD_GTTMMADR)),
+ 1,
+ &DwordData
+ );
+
+ DwordData = McD2PciCfg32 (R_SA_IGD_GTTMMADR + 4);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (MmPciAddress (0,
+ 0,
+ 2,
+ 0,
+ R_SA_IGD_GTTMMADR + 4)),
+ 1,
+ &DwordData
+ );
+
+ ///
+ /// Enable Bus Master, I/O and Memory access on 0:2:0
+ ///
+ McD2PciCfg16Or (R_SA_IGD_CMD, (BIT2 | BIT1));
+ Data16 = McD2PciCfg16 (R_SA_IGD_CMD);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (MmPciAddress (0, 0, 2, 0, R_SA_IGD_CMD)),
+ 1,
+ &Data16
+ );
+
+ ///
+ /// PAVP Initialization
+ ///
+ DEBUG ((EFI_D_INFO, "Initializing PAVP\n"));
+ PavpInit (ImageHandle, DxePlatformSaPolicy);
+ ///
+ /// PmInit Initialization
+ ///
+ DEBUG ((EFI_D_INFO, "Initializing GT PowerManagement\n"));
+ PmInit (ImageHandle, DxePlatformSaPolicy);
+
+ ///
+ /// Enable PowerWell for DP and Audio: set Dev2 mmio 45400 bit 31 and poll bit30 (1 means enabled)
+ ///
+ Data32And = 0xFFFFFFFF;
+ Data32Or = (UINT32) (BIT31);
+ Mmio32Or (GTTMMADR, 0x45400, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (GTTMMADR + 0x45400),
+ &Data32Or, /// Data to be ORed
+ &Data32And /// Data to be ANDed
+ );
+
+ Data32Mask = BIT30;
+ Result = BIT30;
+ PollGtReady (GTTMMADR, 0x45400, Data32Mask, Result);
+ SCRIPT_MEM_POLL (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (GTTMMADR + 0x45400),
+ &Data32Mask,
+ &Result,
+ 50,
+ 200000
+ );
+
+ if (DxePlatformSaPolicy->Revision >=4) {
+ IsUlx = 0;
+ Data16 = McD2PciCfg16 (0x2);
+ if ((Data16 == 0xA0E) || (Data16 == 0xA1E)) {
+ IsUlx = 1;
+ }
+ ///
+ /// BIOS to get supported CD frequency
+ ///
+ if (((MmioRead32 (GTTMMADR + 0x42014) & 0x1000000) != 0) || (IsUlx == 1) || (CpuFamilyId == EnumCpuHswUlt)) {
+ ///fixed frequency
+ mDxePlatformSaPolicy->IgdConfig->CdClkVar = 0;
+ } else {
+ ///choice of varying frequency
+ mDxePlatformSaPolicy->IgdConfig->CdClkVar = 2;
+ }
+
+ if (IsUlx == 1) {
+ Data32And = 0xF7FFFFFF;
+ Data32Or = 0x4000000;
+ } else {
+ if ((mDxePlatformSaPolicy->IgdConfig->CdClk) != 1) {
+ if ((mDxePlatformSaPolicy->IgdConfig->CdClkVar != 0)) {
+ ///540 or 337.5Mhz
+ Data32And = 0xF7FFFFFF;
+ Data32Or = 0x4000000;
+ }
+ } else {
+ ///450 Mhz
+ Data32And = 0xF3FFFFFF;
+ Data32Or = 0;
+ }
+ }
+ Mmio32AndThenOr (GTTMMADR, 0x130040, Data32And, Data32Or);
+ SCRIPT_MEM_READ_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (GTTMMADR + 0x130040),
+ &Data32Or, /// Data to be ORed
+ &Data32And /// Data to be ANDed
+ );
+
+ if ((CpuFamilyId == EnumCpuHswUlt)||(IsUlx == 1)) {
+ Data32 = 1;
+ if (((mDxePlatformSaPolicy->IgdConfig->CdClk) == 1) && (IsUlx == 0)) {
+ Data32 = 0;
+ }
+
+ Mmio32 (GTTMMADR, 0x138128) = Data32;
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (GTTMMADR + 0x138128),
+ 1,
+ &Data32
+ );
+
+ Data32 = 0x0;
+ Mmio32 (GTTMMADR, 0x13812c) = Data32;
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (GTTMMADR + 0x13812c),
+ 1,
+ &Data32
+ );
+
+ Data32 = 0x80000017;
+ Mmio32 (GTTMMADR, 0x138124) = Data32;
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (GTTMMADR + 0x138124),
+ 1,
+ &Data32
+ );
+ }
+ }
+
+ McD2PciCfg16And (R_SA_IGD_CMD, ~(BIT2 | BIT1));
+ Data16 = McD2PciCfg16(R_SA_IGD_CMD);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (MmPciAddress (0, 0, 2, 0, R_SA_IGD_CMD)),
+ 1,
+ &Data16
+ );
+
+ McD2PciCfg64 (R_SA_IGD_GTTMMADR) = 0;
+ DwordData = McD2PciCfg64(R_SA_IGD_GTTMMADR);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (MmPciAddress (0, 0, 2, 0, R_SA_IGD_GTTMMADR)),
+ 1,
+ &DwordData
+ );
+
+ ///
+ /// Free allocated resources
+ ///
+ gDS->FreeMemorySpace (MemBaseAddress, GTTMMADR_SIZE_4MB);
+ }
+
+ ///
+ /// Lock PAVPC Register
+ ///
+ McD0PciCfg32Or (R_SA_PAVPC, B_SA_PAVPC_PAVPLCK_MASK);
+
+ DwordData = McD0PciCfg32 (R_SA_PAVPC);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (MmPciAddress (0,
+ 0,
+ 0,
+ 0,
+ R_SA_PAVPC)),
+ 1,
+ &DwordData
+ );
+
+ return EFI_SUCCESS;
+}
+
+VOID
+PollGtReady (
+ UINT64 Base,
+ UINT32 Offset,
+ UINT32 Mask,
+ UINT32 Result
+ )
+/**
+ "Poll Status" for GT Readiness
+
+ @param[in] Base - Base address of MMIO
+ @param[in] Offset - MMIO Offset
+ @param[in] Mask - Mask
+ @param[in] Result - Value to wait for
+**/
+{
+ UINT32 GtStatus;
+ UINT16 StallCount;
+
+ StallCount = 0;
+
+ ///
+ /// Register read
+ ///
+ GtStatus = Mmio32 (Base, Offset);
+
+ while (((GtStatus & Mask) != Result) && (StallCount < GT_WAIT_TIMEOUT)) {
+
+ GtStatus = Mmio32 (Base, Offset);
+ ///
+ /// 1mSec wait
+ ///
+ gBS->Stall (1000);
+ StallCount = StallCount + 1;
+ }
+
+ ASSERT ((StallCount != GT_WAIT_TIMEOUT));
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/graphicsinit.h b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/graphicsinit.h
new file mode 100644
index 0000000..d5696e3
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/graphicsinit.h
@@ -0,0 +1,132 @@
+/** @file
+ Header file for initialization of GT PowerManagement
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _GRAPHICS_INIT_H_
+#define _GRAPHICS_INIT_H_
+
+#include "EdkIIGlueDxe.h"
+#include "SaAccess.h"
+#include "EfiScriptLib.h"
+#include EFI_PROTOCOL_DEFINITION (SaPlatformPolicy)
+#include EFI_PROTOCOL_DEFINITION (PciHostBridgeResourceAllocation)
+#include EFI_PROTOCOL_CONSUMER (ExitPmAuth)
+#include "SaInit.h"
+#include "PchAccess.h"
+#include "CpuRegs.h"
+#include "CpuPlatformLib.h"
+
+///
+/// Data definitions
+///
+///
+/// GT RELATED EQUATES
+///
+#define GTT_MEM_ALIGN 22
+#define GTTMMADR_SIZE_4MB 0x400000
+#define GT_WAIT_TIMEOUT 3000 ///< ~3 seconds
+
+///
+/// PAVP Modes
+///
+#define PAVP_LITE_MODE 1
+#define PAVP_SERPENT_MODE 2
+#define PAVP_PCM_SIZE_1_MB 1
+
+EFI_STATUS
+PavpInit (
+ IN EFI_HANDLE ImageHandle,
+ IN DXE_PLATFORM_SA_POLICY_PROTOCOL *DxePlatformSaPolicy
+ )
+/**
+ Initialize PAVP feature of SystemAgent.
+
+ @param[in] ImageHandle - Handle for the image of this driver
+ @param[in] DxePlatformSaPolicy - SA DxePlatformPolicy protocol
+
+ @retval EFI_SUCCESS - PAVP initialization complete
+**/
+;
+
+/**
+ Initialize PAVP.
+
+ @param[in] ImageHandle - Handle for the image of this driver
+ @param[in] DxePlatformSaPolicy - SA DxePlatformPolicy protocol
+
+ @retval EFI_SUCCESS - PAVP initialization complete
+**/
+EFI_STATUS
+PmInit (
+ IN EFI_HANDLE ImageHandle,
+ IN DXE_PLATFORM_SA_POLICY_PROTOCOL *DxePlatformSaPolicy
+ )
+/**
+ Initialize GT PowerManagement of SystemAgent.
+
+ @param[in] ImageHandle - Handle for the image of this driver
+ @param[in] DxePlatformSaPolicy - SA DxePlatformPolicy protocol
+
+ @retval EFI_SUCCESS - GT Power Management initialization complete
+**/
+;
+
+EFI_STATUS
+GraphicsInit (
+ IN EFI_HANDLE ImageHandle,
+ IN DXE_PLATFORM_SA_POLICY_PROTOCOL *DxePlatformSaPolicy
+ )
+/**
+ Initialize GT PowerManagement of SystemAgent.
+
+ @param[in] ImageHandle - Handle for the image of this driver
+ @param[in] DxePlatformSaPolicy - SA DxePlatformPolicy protocol
+
+ @retval EFI_SUCCESS - GT Power Management initialization complete
+**/
+;
+
+VOID
+PollGtReady (
+ UINT64 Base,
+ UINT32 Offset,
+ UINT32 Mask,
+ UINT32 Result
+ )
+/**
+ "Poll Status" for GT Readiness
+
+ @param[in] Base - Base address of MMIO
+ @param[in] Offset - MMIO Offset
+ @param[in] Mask - Mask
+ @param[in] Result - Value to wait for
+**/
+;
+
+EFI_STATUS
+PostPmInitExitPmAuth (
+ VOID
+ )
+/**
+ Do Post GT PM Init Steps after VBIOS Initialization.
+
+ @retval EFI_SUCCESS Succeed.
+**/
+;
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/igdopregion.c b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/igdopregion.c
new file mode 100644
index 0000000..0774807
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/igdopregion.c
@@ -0,0 +1,955 @@
+/** @file
+ This is part of the implementation of an Intel Graphics drivers OpRegion /
+ Software SCI interface between system BIOS, ASL code, and Graphics drivers.
+ The code in this file will load the driver and initialize the interface
+
+ Supporting Specifiction: OpRegion / Software SCI SPEC 0.70
+
+ Acronyms:
+ IGD: Internal Graphics Device
+ NVS: ACPI Non Volatile Storage
+ OpRegion: ACPI Operational Region
+ VBT: Video BIOS Table (OEM customizable data)
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+///
+/// Include files
+///
+#include "IgdOpRegion.h"
+#include "CpuIA32.h"
+#include "CpuRegs.h"
+#include "CpuPlatformLib.h"
+#include <Protocol\SaPlatformPolicy\SaPlatformPolicy.h>
+#ifndef AMI_OVERRIDE_FOR_INTEL_GOP_SUPPORT
+#include "Token.h"
+#if (defined(IntelSaGopDriver_SUPPORT) && (IntelSaGopDriver_SUPPORT == 1))
+#include "Include\Protocol\IntelSaGopDriver.h"
+#endif
+#endif
+
+///
+/// Global variables
+///
+IGD_OPREGION_PROTOCOL mIgdOpRegion;
+EFI_GUID mMiscSubClass = EFI_MISC_SUBCLASS_GUID;
+EFI_EVENT mExitPmAuthEvent;
+BOOLEAN mRunExitPmAuthRoutine;
+SYSTEM_AGENT_GLOBAL_NVS_AREA_PROTOCOL *mSaGlobalNvsArea;
+DXE_PLATFORM_SA_POLICY_PROTOCOL *mDxePlatformSaPolicy;
+
+///
+/// Function implementations.
+///
+EFI_STATUS
+GetIntegratedIntelVbtPtr (
+ OUT VBIOS_VBT_STRUCTURE **VbtFileBuffer
+ )
+/**
+ Get VBT data using SaPlaformPolicy
+
+ @param[in] VbtFileBuffer Pointer to VBT data buffer.
+
+ @retval EFI_SUCCESS VBT data was returned.
+ @retval EFI_NOT_FOUND VBT data not found.
+ @exception EFI_UNSUPPORTED Invalid signature in VBT data.
+**/
+{
+ EFI_STATUS Status;
+ EFI_PHYSICAL_ADDRESS VbtAddress;
+ UINT32 Size;
+
+ ///
+ /// Get the platform SA policy.
+ ///
+ Status = gBS->LocateProtocol (
+ &gDxePlatformSaPolicyGuid,
+ NULL,
+ (VOID **) &mDxePlatformSaPolicy
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ VbtAddress = mDxePlatformSaPolicy->IgdConfig->VbtAddress;
+ Size = mDxePlatformSaPolicy->IgdConfig->Size ;
+
+ if (VbtAddress == 0x00000000) {
+ return EFI_NOT_FOUND;
+ } else {
+ ///
+ /// Check VBT signature
+ ///
+ *VbtFileBuffer = NULL;
+ *VbtFileBuffer = (VBIOS_VBT_STRUCTURE *) (UINTN) VbtAddress;
+ if ((*((UINT32 *) ((*VbtFileBuffer)->HeaderSignature))) != VBT_SIGNATURE) {
+ FreePool (*VbtFileBuffer);
+ *VbtFileBuffer = NULL;
+ return EFI_UNSUPPORTED;
+ }
+ }
+ if (Size == 0) {
+ return EFI_NOT_FOUND;
+ } else {
+ ///
+ /// Check VBT size
+ ///
+ if ((*VbtFileBuffer)->HeaderVbtSize > Size) {
+ (*VbtFileBuffer)->HeaderVbtSize = (UINT16) Size;
+ }
+ }
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+GetIntegratedIntelVBiosPtr (
+ OUT INTEL_VBIOS_OPTION_ROM_HEADER **VBiosImage
+ )
+/**
+ Get a pointer to an uncompressed image of the Intel video BIOS.
+
+ Note: This function would only be called if the video BIOS at 0xC000 is
+ missing or not an Intel video BIOS. It may not be an Intel video BIOS
+ if the Intel graphic contoller is considered a secondary adapter.
+
+ @param[in] VBiosImage - Pointer to an uncompressed Intel video BIOS. This pointer must
+ be set to NULL if an uncompressed image of the Intel Video BIOS
+ is not obtainable.
+
+ @retval EFI_SUCCESS - VBiosPtr is updated.
+ @exception EFI_UNSUPPORTED - No Intel video BIOS found.
+**/
+
+{
+ EFI_HANDLE *HandleBuffer;
+ UINTN HandleCount;
+ UINTN Index;
+ INTEL_VBIOS_PCIR_STRUCTURE *PcirBlockPtr;
+ EFI_STATUS Status;
+ EFI_PCI_IO_PROTOCOL *PciIo;
+ INTEL_VBIOS_OPTION_ROM_HEADER *VBiosRomImage;
+ ///
+ /// Set as if an umcompressed Intel video BIOS image was not obtainable.
+ ///
+ VBiosRomImage = NULL;
+
+ ///
+ /// Get all PCI IO protocols
+ ///
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiPciIoProtocolGuid,
+ NULL,
+ &HandleCount,
+ &HandleBuffer
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Find the video BIOS by checking each PCI IO handle for an Intel video
+ /// BIOS OPROM.
+ ///
+ for (Index = 0; Index < HandleCount; Index++) {
+ Status = gBS->HandleProtocol (
+ HandleBuffer[Index],
+ &gEfiPciIoProtocolGuid,
+ (VOID **) &PciIo
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ VBiosRomImage = PciIo->RomImage;
+
+ ///
+ /// If this PCI device doesn't have a ROM image, skip to the next device.
+ ///
+ if (!VBiosRomImage) {
+ continue;
+ }
+ ///
+ /// Get pointer to PCIR structure
+ ///
+ PcirBlockPtr = (INTEL_VBIOS_PCIR_STRUCTURE *) ((UINT8 *) VBiosRomImage + VBiosRomImage->PcirOffset);
+
+ ///
+ /// Check if we have an Intel video BIOS OPROM.
+ ///
+ if ((VBiosRomImage->Signature == OPTION_ROM_SIGNATURE) &&
+ (PcirBlockPtr->VendorId == V_SA_MC_VID) &&
+ (PcirBlockPtr->ClassCode[0] == 0x00) &&
+ (PcirBlockPtr->ClassCode[1] == 0x00) &&
+ (PcirBlockPtr->ClassCode[2] == 0x03)
+ ) {
+ ///
+ /// Found Intel video BIOS.
+ ///
+ *VBiosImage = VBiosRomImage;
+ return EFI_SUCCESS;
+ }
+ }
+ ///
+ /// No Intel video BIOS found.
+ ///
+ ///
+ /// Free any allocated buffers
+ ///
+ FreePool (HandleBuffer);
+ return EFI_UNSUPPORTED;
+}
+
+EFI_STATUS
+GetVBiosVbtExitPmAuth (
+ VOID
+ )
+/**
+ Get Intel video BIOS VBT information (i.e. Pointer to VBT and VBT size).
+ The VBT (Video BIOS Table) is a block of customizable data that is built
+ within the video BIOS and edited by customers.
+
+ @retval EFI_SUCCESS - Video BIOS VBT information returned.
+ @exception EFI_UNSUPPORTED - Could not find VBT information (*VBiosVbtPtr = NULL).
+**/
+{
+ INTEL_VBIOS_PCIR_STRUCTURE *PcirBlockPtr;
+ UINT16 PciVenderId;
+ INTEL_VBIOS_OPTION_ROM_HEADER *VBiosPtr;
+ VBIOS_VBT_STRUCTURE *VBiosVbtPtr;
+ EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
+ EFI_STATUS Status;
+ VBIOS_VBT_STRUCTURE *VbtFileBuffer;
+ UINTN Index;
+#ifndef AMI_OVERRIDE_FOR_INTEL_GOP_SUPPORT
+#if (defined(IntelSaGopDriver_SUPPORT) && (IntelSaGopDriver_SUPPORT == 1))
+ EFI_PHYSICAL_ADDRESS VbtAddress;
+ UINT32 VbtSize;
+ PLATFORM_GOP_POLICY_PROTOCOL *PlatformGOPPolicy;
+ EFI_GUID PlatformGOPPolicyGuid = EFI_PLATFORM_GOP_POLICY_PROTOCOL_GUID;
+ EFI_STATUS Status2 = EFI_SUCCESS;
+#endif
+#endif // AMI_OVERRIDE_FOR_INTEL_GOP_SUPPORT
+
+ if (!mRunExitPmAuthRoutine) {
+ return EFI_SUCCESS;
+ }
+
+ ///
+ /// Get the platform SA policy.
+ ///
+ Status = gBS->LocateProtocol (
+ &gDxePlatformSaPolicyGuid,
+ NULL,
+ (VOID **) &mDxePlatformSaPolicy
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ LegacyBios = NULL;
+ VBiosPtr = NULL;
+
+ Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL, (VOID **) &LegacyBios);
+
+#ifndef AMI_OVERRIDE_FOR_INTEL_GOP_SUPPORT
+#if (defined(IntelSaGopDriver_SUPPORT) && (IntelSaGopDriver_SUPPORT == 1))
+ //
+ // Locate Platform GOP policy protocol
+ //
+ Status = gBS->LocateProtocol (&PlatformGOPPolicyGuid, NULL, &PlatformGOPPolicy);
+ if (!EFI_ERROR(Status)) {
+ Status2 = PlatformGOPPolicy->GetVbtData(&VbtAddress, &VbtSize);
+ if (!EFI_ERROR(Status2)) LegacyBios = NULL;
+ }
+#endif
+#endif // AMI_OVERRIDE_FOR_INTEL_GOP_SUPPORT
+
+ if (LegacyBios) {
+ VBiosPtr = (INTEL_VBIOS_OPTION_ROM_HEADER *) (UINTN) (VBIOS_LOCATION_PRIMARY);
+ PcirBlockPtr = (INTEL_VBIOS_PCIR_STRUCTURE *) ((UINT8 *) VBiosPtr + VBiosPtr->PcirOffset);
+ PciVenderId = PcirBlockPtr->VendorId;
+ ///
+ /// If the video BIOS is not at 0xC0000 or it is not an Intel video BIOS get
+ /// the integrated Intel video BIOS (must be uncompressed).
+ ///
+ if ((VBiosPtr->Signature != OPTION_ROM_SIGNATURE) || (PciVenderId != V_SA_MC_VID)) {
+ GetIntegratedIntelVBiosPtr (&VBiosPtr);
+ if (VBiosPtr != NULL) {
+ ///
+ /// Video BIOS found.
+ ///
+ PcirBlockPtr = (INTEL_VBIOS_PCIR_STRUCTURE *) ((UINT8 *) VBiosPtr + VBiosPtr->PcirOffset);
+ PciVenderId = PcirBlockPtr->VendorId;
+
+ if ((VBiosPtr->Signature != OPTION_ROM_SIGNATURE) || (PciVenderId != V_SA_MC_VID)) {
+ ///
+ /// Intel video BIOS not found.
+ ///
+ VBiosVbtPtr = NULL;
+ return EFI_UNSUPPORTED;
+ }
+ }
+ }
+ } else {
+ ///
+ /// No Video BIOS found, try to get VBT from FV.
+ ///
+ GetIntegratedIntelVbtPtr (&VbtFileBuffer);
+ if (VbtFileBuffer != NULL) {
+ ///
+ /// Video BIOS not found, use VBT from SaPlatformPolicy
+ ///
+ DEBUG ((EFI_D_INFO, "VBT data found\n"));
+ for (Index = 0; (mDxePlatformSaPolicy->IgdConfig->GopVersion[Index] != '\0'); Index++) {
+ }
+ Index = (Index+1)*2;
+ CopyMem (mIgdOpRegion.OpRegion->Header.DVER, mDxePlatformSaPolicy->IgdConfig->GopVersion, Index);
+ (gBS->CopyMem) (mIgdOpRegion.OpRegion->VBT.GVD1, VbtFileBuffer, VbtFileBuffer->HeaderVbtSize);
+ FreePool (VbtFileBuffer);
+ return EFI_SUCCESS;
+ }
+ }
+
+ if (VBiosPtr == NULL) {
+ return EFI_UNSUPPORTED;
+ }
+
+ DEBUG ((EFI_D_INFO, "VBIOS found at 0x%X\n", VBiosPtr));
+ VBiosVbtPtr = (VBIOS_VBT_STRUCTURE *) ((UINT8 *) VBiosPtr + VBiosPtr->VbtOffset);
+
+ if ((*((UINT32 *) (VBiosVbtPtr->HeaderSignature))) != VBT_SIGNATURE) {
+ return EFI_UNSUPPORTED;
+ }
+ ///
+ /// No PlatformGopPolicy.h in EDK II code
+ ///
+#if 0
+ GetSVER (mIgdOpRegion.OpRegion->Header.SVER);
+#endif
+ DEBUG ((EFI_D_INFO, "System BIOS ID is %a\n", mIgdOpRegion.OpRegion->Header.SVER));
+
+ ///
+ /// Initialize Video BIOS version with its build number.
+ ///
+ mIgdOpRegion.OpRegion->Header.VVER[0] = VBiosVbtPtr->CoreBlockBiosBuild[0];
+ mIgdOpRegion.OpRegion->Header.VVER[1] = VBiosVbtPtr->CoreBlockBiosBuild[1];
+ mIgdOpRegion.OpRegion->Header.VVER[2] = VBiosVbtPtr->CoreBlockBiosBuild[2];
+ mIgdOpRegion.OpRegion->Header.VVER[3] = VBiosVbtPtr->CoreBlockBiosBuild[3];
+ (gBS->CopyMem) (mIgdOpRegion.OpRegion->VBT.GVD1, VBiosVbtPtr, VBiosVbtPtr->HeaderVbtSize);
+
+ ///
+ /// Return final status
+ ///
+ return EFI_SUCCESS;
+}
+///
+/// No PlatformGopPolicy.h in EDK II code
+///
+#if 0
+EFI_STATUS
+GetSVER (
+ OUT UINT8 *SVER
+ )
+/**
+ Set the SVER (system BIOS ID) string with the system BIOS build number.
+
+ @param[in] SVER String to populate with system BIOS build number.
+
+ @retval EFI_SUCCESS The SVER string is populated.
+ @exception EFI_UNSUPPORTED The SVER string is not populated.
+**/
+{
+ EFI_SUBCLASS_TYPE1_HEADER *DataHeader;
+ EFI_DATA_HUB_PROTOCOL *DataHub;
+ EFI_MISC_BIOS_VENDOR *BiosVendor;
+ UINTN Length;
+ UINT64 MonotonicCount;
+ CHAR16 *NewString;
+ EFI_DATA_RECORD_HEADER *Record;
+ EFI_STATUS Status;
+
+ ///
+ /// Locate the data hub protocol.
+ ///
+ Status = gBS->LocateProtocol (
+ &gEfiDataHubProtocolGuid,
+ NULL,
+ &DataHub
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Get the BIOS ID from the data hub.
+ ///
+ MonotonicCount = 0;
+ Record = NULL;
+
+ do {
+ ///
+ /// Check each data class record
+ ///
+ Status = DataHub->GetNextRecord (DataHub, &MonotonicCount, NULL, &Record);
+ if (Record->DataRecordClass == EFI_DATA_RECORD_CLASS_DATA) {
+ ///
+ /// Check for BIOS vendor information
+ ///
+ DataHeader = (EFI_SUBCLASS_TYPE1_HEADER *) (Record + 1);
+ if (CompareGuid (&Record->DataRecordGuid, &mMiscSubClass) &&
+ (DataHeader->RecordType == EFI_MISC_BIOS_VENDOR_RECORD_NUMBER)
+ ) {
+ BiosVendor = (EFI_MISC_BIOS_VENDOR *) (DataHeader + 1);
+
+ ///
+ /// Get the BIOS ID string from the HII database
+ ///
+ Status = GetStringFromToken (&Record->ProducerName, BiosVendor->BiosVersion, &NewString);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Convert from Unicode to ASCII
+ ///
+ if (NewString != NULL) {
+ Length = StrLen (NewString);
+ ASSERT (Length <= SVER_SIZE);
+ ASPrint (SVER, Length, "%s", NewString);
+ return EFI_SUCCESS;
+ }
+ }
+ }
+ } while ((!EFI_ERROR (Status)) && (MonotonicCount != 0));
+
+ ///
+ /// We assume BIOS ID is present and required.
+ /// If this is not the case, BIOS ID will need to be determined in another way.
+ ///
+ ASSERT_EFI_ERROR (EFI_UNSUPPORTED);
+ return EFI_UNSUPPORTED;
+}
+
+#if (EFI_SPECIFICATION_VERSION < 0x0002000A)
+EFI_STATUS
+GetStringFromToken (
+ IN EFI_GUID *ProducerGuid,
+ IN STRING_REF Token,
+ OUT CHAR16 **String
+ )
+/**
+ Acquire the string associated with the ProducerGuid and return it.
+
+ @param[in] ProducerGuid - The Guid to search the HII database for
+ @param[in] Token - The token value of the string to extract
+ @param[in] String - The string that is extracted
+
+ @retval EFI_SUCCESS The function completed successfully
+ @retval EFI_NOT_FOUND The requested string was not found
+**/
+{
+ EFI_STATUS Status;
+ UINT16 HandleBufferLength;
+ EFI_HII_HANDLE *HiiHandleBuffer;
+ UINTN StringBufferLength;
+ UINTN NumberOfHiiHandles;
+ UINTN Index;
+ UINT16 Length;
+ EFI_GUID HiiGuid;
+ EFI_HII_PROTOCOL *Hii;
+
+ HandleBufferLength = 0x1000;
+ HiiHandleBuffer = NULL;
+
+ ///
+ /// Locate HII protocol
+ ///
+ Status = gBS->LocateProtocol (&gEfiHiiProtocolGuid, NULL, &Hii);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Get all the Hii handles
+ ///
+ HiiHandleBuffer = AllocateZeroPool (HandleBufferLength);
+
+ Status = Hii->FindHandles (Hii, &HandleBufferLength, HiiHandleBuffer);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Get the Hii Handle that matches the StructureNode->ProducerName
+ ///
+ NumberOfHiiHandles = HandleBufferLength / sizeof (EFI_HII_HANDLE);
+ for (Index = 0; Index < NumberOfHiiHandles; Index++) {
+ Length = 0;
+ Status = ExtractDataFromHiiHandle (
+ HiiHandleBuffer[Index],
+ &Length,
+ NULL,
+ &HiiGuid
+ );
+ if (CompareGuid (ProducerGuid, &HiiGuid)) {
+ break;
+ }
+ }
+ ///
+ /// Find the string based on the current language
+ ///
+ StringBufferLength = 0x100;
+ *String = AllocateZeroPool (0x100);
+ Status = Hii->GetString (
+ Hii,
+ HiiHandleBuffer[Index],
+ Token,
+ FALSE,
+ NULL,
+ &StringBufferLength,
+ *String
+ );
+
+ (gBS->FreePool) (HiiHandleBuffer);
+
+ if (EFI_ERROR (Status)) {
+ (gBS->FreePool) (*String);
+ return EFI_NOT_FOUND;
+ }
+
+ return EFI_SUCCESS;
+}
+#endif
+#endif
+
+EFI_STATUS
+IgdOpRegionInit (
+ VOID
+ )
+/**
+ Graphics OpRegion / Software SCI driver installation function.
+
+ @param[in] void - None
+ @retval EFI_SUCCESS - The driver installed without error.
+ @retval EFI_ABORTED - The driver encountered an error and could not complete
+ installation of the ACPI tables.
+**/
+
+{
+ EFI_HANDLE Handle;
+ EFI_STATUS Status;
+ ///
+ /// VBIOS_VBT_STRUCTURE *VBiosVbtPtr;
+ ///
+ UINT32 DwordData;
+ EFI_CPU_IO_PROTOCOL *CpuIo;
+ UINT16 Data16;
+ UINT32 Data32;
+ UINT16 PchAcpiBaseAddress;
+ UINT16 DeviceId;
+ PCH_SERIES PchSeries;
+ CPU_FAMILY CpuFamilyId;
+ EFI_GUID DxePlatformSaPolicyGuid = DXE_PLATFORM_SA_POLICY_GUID;
+ DXE_PLATFORM_SA_POLICY_PROTOCOL *DxePlatformSaPolicy;
+
+ CpuFamilyId = GetCpuFamily();
+
+ ///
+ /// Get the platform SA policy.
+ ///
+ Status = gBS->LocateProtocol (
+ &gDxePlatformSaPolicyGuid,
+ NULL,
+ (VOID **) &mDxePlatformSaPolicy
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ ///
+ /// Locate the SA Global NVS Protocol.
+ ///
+ Status = gBS->LocateProtocol (
+ &gSaGlobalNvsAreaProtocolGuid,
+ NULL,
+ (VOID **) &mSaGlobalNvsArea
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Allocate an ACPI NVS memory buffer as the IGD OpRegion, zero initialize
+ /// the first 1K, and set the IGD OpRegion pointer in the Global NVS
+ /// area structure.
+ ///
+ Status = (gBS->AllocatePool) (EfiACPIMemoryNVS, sizeof (IGD_OPREGION_STRUC), (VOID **) &mIgdOpRegion.OpRegion);
+ ASSERT_EFI_ERROR (Status);
+
+ (gBS->SetMem) (mIgdOpRegion.OpRegion, 0x2000, 0);
+ mSaGlobalNvsArea->Area->IgdOpRegionAddress = (UINT32) (UINTN) (mIgdOpRegion.OpRegion);
+
+ ///
+ /// If IGD is disabled return
+ ///
+ mRunExitPmAuthRoutine = TRUE;
+ if (IgdMmPci32 (0) == 0xFFFFFFFF) {
+ mRunExitPmAuthRoutine = FALSE;
+ return EFI_SUCCESS;
+ }
+
+ PchSeries = GetPchSeries();
+ ///
+ /// Initialize OpRegion Header
+ ///
+ (gBS->CopyMem) (mIgdOpRegion.OpRegion->Header.SIGN, HEADER_SIGNATURE, sizeof (HEADER_SIGNATURE));
+ ///
+ /// Set OpRegion Size in KBs
+ ///
+ mIgdOpRegion.OpRegion->Header.SIZE = HEADER_SIZE / 1024;
+ mIgdOpRegion.OpRegion->Header.OVER = (UINT32) (LShiftU64 (HEADER_OPREGION_VER, 16) + LShiftU64 (HEADER_OPREGION_REV, 8));
+
+ ///
+ /// Get CPU Flavor by reading System Agent's Device ID (B0:D1F:F0:R02)
+ ///
+ DeviceId = McD0PciCfg16 (R_SA_MC_DEVICE_ID);
+ if (IS_SA_DEVICE_ID_MOBILE (DeviceId)) {
+ ///
+ /// For Mobile, all Mailbox are supported.
+ ///
+ mIgdOpRegion.OpRegion->Header.MBOX = HEADER_MBOX_SUPPORT_MOBILE;
+ } else if (IS_SA_DEVICE_ID_DESKTOP (DeviceId) || IS_SA_DEVICE_ID_SERVER (DeviceId)) {
+ ///
+ /// For Desktop and Server, Mailbox 1/3/5 are not supported.
+ ///
+ mIgdOpRegion.OpRegion->Header.MBOX = HEADER_MBOX_SUPPORT_DESKTOP;
+ } else {
+ DEBUG ((EFI_D_ERROR, "Hang if unknown System Agent\n"));
+ ASSERT (FALSE);
+ ///
+ /// Hang if unknown System Agent
+ ///
+ }
+ ///
+ /// Initialize OpRegion Mailbox 1 (Public ACPI Methods).
+ ///
+ /// @todo: The initial setting of mailbox 1 fields is implementation specific.
+ /// Adjust them as needed many even coming from user setting in setup.
+ ///
+ ///
+ /// Initialize OpRegion Mailbox 3 (ASLE Interrupt and Power Conservation).
+ ///
+ /// @todo: The initial setting of mailbox 3 fields is implementation specific.
+ /// Adjust them as needed many even coming from user setting in setup.
+ ///
+ ///
+ /// Do not initialize TCHE. This field is written by the graphics driver only.
+ ///
+ ///
+ /// The ALSI field is generally initialized by ASL code by reading the embedded controller.
+ ///
+ if (mDxePlatformSaPolicy->Revision >= 5) {
+ mIgdOpRegion.OpRegion->Header.PCON = mDxePlatformSaPolicy->IgdConfig->PlatformConfig;
+ if (CpuFamilyId == EnumCpuHswUlt) {
+ mIgdOpRegion.OpRegion->Header.PCON = mIgdOpRegion.OpRegion->Header.PCON | 0x2;
+ }
+ }
+ mIgdOpRegion.OpRegion->MBox3.BCLP = BACKLIGHT_BRIGHTNESS;
+
+ mIgdOpRegion.OpRegion->MBox3.PFIT = (FIELD_VALID_BIT | PFIT_STRETCH);
+
+ ///
+ /// Reporting to driver for VR IMON Calibration. Bits [5-1] values supported 14A to 31A.
+ ///
+ mIgdOpRegion.OpRegion->MBox3.PCFT = (mSaGlobalNvsArea->Area->GfxTurboIMON << 1) & 0x003E;
+
+ ///
+ /// Set Initial current Brightness
+ ///
+ mIgdOpRegion.OpRegion->MBox3.CBLV = (INIT_BRIGHT_LEVEL | FIELD_VALID_BIT);
+
+ ///
+ /// <EXAMPLE> Create a static Backlight Brightness Level Duty cycle Mapping Table
+ /// Possible 20 entries (example used 10), each 16 bits as follows:
+ /// [15] = Field Valid bit, [14:08] = Level in Percentage (0-64h), [07:00] = Desired duty cycle (0 - FFh).
+ ///
+ mIgdOpRegion.OpRegion->MBox3.BCLM[0] = (0x0000 + WORD_FIELD_VALID_BIT); ///< 0%
+ ///
+ mIgdOpRegion.OpRegion->MBox3.BCLM[1] = (0x0A19 + WORD_FIELD_VALID_BIT); ///< 10%
+ mIgdOpRegion.OpRegion->MBox3.BCLM[2] = (0x1433 + WORD_FIELD_VALID_BIT); ///< 20%
+ mIgdOpRegion.OpRegion->MBox3.BCLM[3] = (0x1E4C + WORD_FIELD_VALID_BIT); ///< 30%
+ mIgdOpRegion.OpRegion->MBox3.BCLM[4] = (0x2866 + WORD_FIELD_VALID_BIT); ///< 40%
+ mIgdOpRegion.OpRegion->MBox3.BCLM[5] = (0x327F + WORD_FIELD_VALID_BIT); ///< 50%
+ mIgdOpRegion.OpRegion->MBox3.BCLM[6] = (0x3C99 + WORD_FIELD_VALID_BIT); ///< 60%
+ mIgdOpRegion.OpRegion->MBox3.BCLM[7] = (0x46B2 + WORD_FIELD_VALID_BIT); ///< 70%
+ mIgdOpRegion.OpRegion->MBox3.BCLM[8] = (0x50CC + WORD_FIELD_VALID_BIT); ///< 80%
+ mIgdOpRegion.OpRegion->MBox3.BCLM[9] = (0x5AE5 + WORD_FIELD_VALID_BIT); ///< 90%
+ mIgdOpRegion.OpRegion->MBox3.BCLM[10] = (0x64FF + WORD_FIELD_VALID_BIT); ///< 100%
+
+ mIgdOpRegion.OpRegion->MBox3.IUER = 0x00;
+
+ Status = gBS->LocateProtocol (&DxePlatformSaPolicyGuid, NULL, &DxePlatformSaPolicy);
+
+ if (!EFI_ERROR(Status)) {
+ mIgdOpRegion.OpRegion->MBox3.IUER = DxePlatformSaPolicy->IgdConfig->IuerStatusVal;
+ }
+
+ ///
+ /// Initialize hardware state:
+ /// Set ASLS Register to the OpRegion physical memory address.
+ /// Set SWSCI register bit 15 to a "1" to activate SCI interrupts.
+ ///
+ IgdMmPci32 (R_SA_IGD_ASLS_OFFSET) = (UINT32) (UINTN) (mIgdOpRegion.OpRegion);
+ IgdMmPci16AndThenOr (R_SA_IGD_SWSCI_OFFSET, ~(BIT0), BIT15);
+
+ DwordData = IgdMmPci32 (R_SA_IGD_ASLS_OFFSET);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (MmPciAddress (0x0,
+ SA_IGD_BUS,
+ SA_IGD_DEV,
+ SA_IGD_FUN_0,
+ R_SA_IGD_ASLS_OFFSET)),
+ 1,
+ &DwordData
+ );
+ DwordData = IgdMmPci32 (R_SA_IGD_SWSCI_OFFSET);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (MmPciAddress (0x0,
+ SA_IGD_BUS,
+ SA_IGD_DEV,
+ SA_IGD_FUN_0,
+ R_SA_IGD_SWSCI_OFFSET)),
+ 1,
+ &DwordData
+ );
+ PchAcpiBaseAddress = MmPci16 (
+ 0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_ACPI_BASE
+ ) &~BIT0;
+
+ ///
+ /// Find the CPU I/O Protocol. ASSERT if not found.
+ ///
+ Status = gBS->LocateProtocol (
+ &gEfiCpuIoProtocolGuid,
+ NULL,
+ (VOID **) &CpuIo
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ CpuIo->Io.Read (
+ CpuIo,
+ EfiCpuIoWidthUint16,
+ PchAcpiBaseAddress + PCH_TCO_BASE + R_PCH_TCO1_STS,
+ 1,
+ &Data16
+ );
+ ///
+ /// Clear the B_DMISCI_STS bit in R_TCO1_STS by writing a '1'.
+ ///
+ Data16 &= B_PCH_TCO1_STS_DMISCI;
+
+ CpuIo->Io.Write (
+ CpuIo,
+ EfiCpuIoWidthUint16,
+ PchAcpiBaseAddress + PCH_TCO_BASE + R_PCH_TCO1_STS,
+ 1,
+ &Data16
+ );
+
+ if (PchSeries == PchLp) {
+ ///
+ /// Clear the ACPI TCO status.
+ ///
+ Data32 = B_PCH_ACPI_GPE0_STS_127_96_TC0SCI;
+ CpuIo->Io.Write (
+ CpuIo,
+ EfiCpuIoWidthUint32,
+ (UINT64) (PchAcpiBaseAddress + R_PCH_ACPI_GPE0_STS_127_96),
+ 1,
+ &Data32
+ );
+
+ ///
+ /// Enable ACPI TCO SCI's.
+ ///
+ CpuIo->Io.Read (
+ CpuIo,
+ EfiCpuIoWidthUint16,
+ (UINT64) (PchAcpiBaseAddress + R_PCH_ACPI_GPE0_EN_127_96),
+ 1,
+ &Data16
+ );
+ Data16 |= B_PCH_ACPI_GPE0_EN_127_96_TC0SCI;
+ CpuIo->Io.Write (
+ CpuIo,
+ EfiCpuIoWidthUint16,
+ (UINT64) (PchAcpiBaseAddress + R_PCH_ACPI_GPE0_EN_127_96),
+ 1,
+ &Data16
+ );
+ } else if (PchSeries == PchH) {
+ ///
+ /// Clear the ACPI TCO status.
+ ///
+ Data32 = B_PCH_ACPI_GPE0a_STS_TC0SCI;
+ CpuIo->Io.Write (
+ CpuIo,
+ EfiCpuIoWidthUint32,
+ (UINT64) (PchAcpiBaseAddress + R_PCH_ACPI_GPE0a_STS),
+ 1,
+ &Data32
+ );
+
+ ///
+ /// Enable ACPI TCO SCI's.
+ ///
+ CpuIo->Io.Read (
+ CpuIo,
+ EfiCpuIoWidthUint16,
+ (UINT64) (PchAcpiBaseAddress + R_PCH_ACPI_GPE0a_EN),
+ 1,
+ &Data16
+ );
+ Data16 |= B_PCH_ACPI_GPE0a_EN_TC0SCI;
+ CpuIo->Io.Write (
+ CpuIo,
+ EfiCpuIoWidthUint16,
+ (UINT64) (PchAcpiBaseAddress + R_PCH_ACPI_GPE0a_EN),
+ 1,
+ &Data16
+ );
+ }
+
+ ///
+ /// Install OpRegion / Software SCI protocol
+ ///
+ Handle = NULL;
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &Handle,
+ &gIgdOpRegionProtocolGuid,
+ &mIgdOpRegion,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Return final status
+ ///
+ return EFI_SUCCESS;
+}
+
+
+EFI_STATUS
+UpdateIgdOpRegionExitPmAuth (
+ VOID
+ )
+/**
+ Update Graphics OpRegion after PCI enumeration.
+
+ @param[in] void - None
+ @retval EFI_SUCCESS - The function completed successfully.
+**/
+{
+ EFI_STATUS Status;
+ UINTN HandleCount;
+ EFI_HANDLE *HandleBuffer;
+ UINTN Index;
+ EFI_PCI_IO_PROTOCOL *PciIo;
+ PCI_TYPE00 Pci;
+ UINTN Segment;
+ UINTN Bus;
+ UINTN Device;
+ UINTN Function;
+
+ Bus = 0;
+ Device = 0;
+ Function = 0;
+
+ DEBUG ((EFI_D_INFO, "UpdateIgdOpRegionExitPmAuth\n"));
+
+ mIgdOpRegion.OpRegion->Header.PCON |= BIT8; //Set External Gfx Adapter field is valid
+ mIgdOpRegion.OpRegion->Header.PCON &= (UINT32) (~BIT7); //Assume No External Gfx Adapter
+
+ ///
+ /// Get all PCI IO protocols handles
+ ///
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiPciIoProtocolGuid,
+ NULL,
+ &HandleCount,
+ &HandleBuffer
+ );
+
+ if (!EFI_ERROR (Status)) {
+ for (Index = 0; Index < HandleCount; Index++) {
+ ///
+ /// Get the PCI IO Protocol Interface corresponding to each handle
+ ///
+ Status = gBS->HandleProtocol (
+ HandleBuffer[Index],
+ &gEfiPciIoProtocolGuid,
+ (VOID **) &PciIo
+ );
+
+ if (!EFI_ERROR (Status)) {
+ ///
+ /// Read the PCI configuration space
+ ///
+ Status = PciIo->Pci.Read (
+ PciIo,
+ EfiPciIoWidthUint32,
+ 0,
+ sizeof (Pci) / sizeof (UINT32),
+ &Pci
+ );
+
+ ///
+ /// Find the display controllers devices
+ ///
+ if (!EFI_ERROR (Status) && IS_PCI_DISPLAY (&Pci)) {
+ Status = PciIo->GetLocation (
+ PciIo,
+ &Segment,
+ &Bus,
+ &Device,
+ &Function
+ );
+
+ //
+ // Assumption: Onboard devices will be sits on Bus no 0, while external devices will be sits on Bus no > 0
+ //
+ if (!EFI_ERROR (Status) && (Bus > 0)) {
+ //External Gfx Adapter Detected and Available
+ DEBUG ((EFI_D_INFO, "PCON - External Gfx Adapter Detected and Available\n"));
+ mIgdOpRegion.OpRegion->Header.PCON |= BIT7;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ ///
+ /// Free any allocated buffers
+ ///
+ if (HandleBuffer != NULL) {
+ FreePool (HandleBuffer);
+ }
+
+ ///
+ /// Return final status
+ ///
+ return Status;
+} \ No newline at end of file
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/igdopregion.h b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/igdopregion.h
new file mode 100644
index 0000000..085c665
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Dxe/igdopregion.h
@@ -0,0 +1,281 @@
+/** @file
+ This is part of the implementation of an Intel Graphics drivers OpRegion /
+ Software SCI interface between system BIOS, ASL code, and Graphics drivers.
+
+ Supporting Specifiction: OpRegion / Software SCI SPEC 0.70
+
+ Acronyms:
+ IGD: Internal Graphics Device
+ NVS: ACPI Non Volatile Storage
+ OpRegion: ACPI Operational Region
+ VBT: Video BIOS Table (OEM customizable data)
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _IGD_OPREGION_H_
+#define _IGD_OPREGION_H_
+
+///
+/// Statements that include other header files.
+///
+#include "EdkIIGlueDxe.h"
+#include "EfiScriptLib.h"
+#include "PchAccess.h"
+#include "PchPlatformLib.h"
+#include "SaAccess.h"
+#include "EfiMgmtModeRuntimeLib.h"
+#include "EfiApi.h"
+#include "pci22.h"
+
+///
+/// Driver Consumed Protocol Prototypes
+///
+#include EFI_GUID_DEFINITION (DataHubRecords)
+#include EFI_PROTOCOL_DEFINITION (SaPlatformPolicy)
+
+#include EFI_PROTOCOL_CONSUMER (PciIo)
+#include EFI_PROTOCOL_CONSUMER (PciRootBridgeIo)
+
+#include EFI_PROTOCOL_DEPENDENCY (CpuIo)
+#include EFI_PROTOCOL_DEPENDENCY (DataHub)
+#include EFI_PROTOCOL_DEPENDENCY (SaGlobalNvsArea)
+#include EFI_PROTOCOL_CONSUMER (ExitPmAuth)
+
+///
+/// Driver Produced Protocol Prototypes
+///
+#include EFI_PROTOCOL_PRODUCER (IgdOpRegion)
+
+///
+///
+/// OpRegion (Miscellaneous) #defines.
+///
+/// OpRegion Header #defines.
+///
+#define HEADER_SIGNATURE "IntelGraphicsMem"
+#define HEADER_SIZE 0x2000
+#define HEADER_OPREGION_VER 0x0200
+#define HEADER_OPREGION_REV 0x00
+#define HEADER_MBOX_SUPPORT (HD_MBOX5 + HD_MBOX4 + HD_MBOX3 + HD_MBOX2 + HD_MBOX1)
+#define HEADER_MBOX_SUPPORT_MOBILE HEADER_MBOX_SUPPORT
+#define HEADER_MBOX_SUPPORT_DESKTOP HEADER_MBOX_SUPPORT
+#define HD_MBOX1 BIT0
+#define HD_MBOX2 BIT1
+#define HD_MBOX3 BIT2
+#define HD_MBOX4 BIT3
+#define HD_MBOX5 BIT4
+#define SVER_SIZE 32
+
+///
+/// OpRegion Mailbox 1 EQUates.
+///
+/// OpRegion Mailbox 3 EQUates.
+///
+#define ALS_ENABLE BIT0
+#define BLC_ENABLE BIT1
+#define BACKLIGHT_BRIGHTNESS 0xFF
+#define FIELD_VALID_BIT BIT31
+#define WORD_FIELD_VALID_BIT BIT15
+#define PFIT_ENABLE BIT2
+#define PFIT_OPRN_AUTO 0x00000000
+#define PFIT_OPRN_SCALING 0x00000007
+#define PFIT_OPRN_OFF 0x00000000
+#define PFIT_SETUP_AUTO 0
+#define PFIT_SETUP_SCALING 1
+#define PFIT_SETUP_OFF 2
+#define INIT_BRIGHT_LEVEL 0x64
+#define PFIT_STRETCH 6
+
+///
+/// GMCH PCI register access #defines.
+///
+#define IgdMmPci32(Register) MmPci32 (0, SA_IGD_BUS, SA_IGD_DEV, SA_IGD_FUN_0, Register)
+#define IgdMmPci16Or(Register, OrData) MmPci16Or (0, SA_IGD_BUS, SA_IGD_DEV, SA_IGD_FUN_0, Register, OrData)
+#define IgdMmPci16AndThenOr(Register, AndData, OrData) \
+ MmPci16AndThenOr ( \
+ 0, \
+ SA_IGD_BUS, \
+ SA_IGD_DEV, \
+ SA_IGD_FUN_0, \
+ Register, \
+ AndData, \
+ OrData \
+ )
+
+///
+/// Video BIOS / VBT #defines
+///
+#define OPTION_ROM_SIGNATURE 0xAA55
+#define VBIOS_LOCATION_PRIMARY 0xC0000
+
+#define VBT_SIGNATURE EFI_SIGNATURE_32 ('$', 'V', 'B', 'T')
+///
+/// Typedef stuctures
+///
+#pragma pack(1)
+typedef struct {
+ UINT16 Signature; /// 0xAA55
+ UINT8 Size512;
+ UINT8 Reserved[21];
+ UINT16 PcirOffset;
+ UINT16 VbtOffset;
+} INTEL_VBIOS_OPTION_ROM_HEADER;
+#pragma pack()
+
+#pragma pack(1)
+typedef struct {
+ UINT32 Signature; /// "PCIR"
+ UINT16 VendorId; /// 0x8086
+ UINT16 DeviceId;
+ UINT16 Reserved0;
+ UINT16 Length;
+ UINT8 Revision;
+ UINT8 ClassCode[3];
+ UINT16 ImageLength;
+ UINT16 CodeRevision;
+ UINT8 CodeType;
+ UINT8 Indicator;
+ UINT16 Reserved1;
+} INTEL_VBIOS_PCIR_STRUCTURE;
+#pragma pack()
+
+#pragma pack(1)
+typedef struct {
+ UINT8 HeaderSignature[20];
+ UINT16 HeaderVersion;
+ UINT16 HeaderSize;
+ UINT16 HeaderVbtSize;
+ UINT8 HeaderVbtCheckSum;
+ UINT8 HeaderReserved;
+ UINT32 HeaderOffsetVbtDataBlock;
+ UINT32 HeaderOffsetAim1;
+ UINT32 HeaderOffsetAim2;
+ UINT32 HeaderOffsetAim3;
+ UINT32 HeaderOffsetAim4;
+ UINT8 DataHeaderSignature[16];
+ UINT16 DataHeaderVersion;
+ UINT16 DataHeaderSize;
+ UINT16 DataHeaderDataBlockSize;
+ UINT8 CoreBlockId;
+ UINT16 CoreBlockSize;
+ UINT16 CoreBlockBiosSize;
+ UINT8 CoreBlockBiosType;
+ UINT8 CoreBlockReleaseStatus;
+ UINT8 CoreBlockHWSupported;
+ UINT8 CoreBlockIntegratedHW;
+ UINT8 CoreBlockBiosBuild[4];
+ UINT8 CoreBlockBiosSignOn[155];
+} VBIOS_VBT_STRUCTURE;
+#pragma pack()
+///
+/// Driver Private Function definitions
+///
+EFI_STATUS
+GetSVER (
+ OUT UINT8 *SVER
+ )
+/**
+ Set the SVER (system BIOS ID) string with the system BIOS build number.
+
+ @param[in] SVER String to populate with system BIOS build number.
+
+ @retval EFI_SUCCESS The SVER string is populated.
+ @exception EFI_UNSUPPORTED The SVER string is not populated.
+**/
+;
+
+EFI_STATUS
+GetStringFromToken (
+ IN EFI_GUID *ProducerGuid,
+ IN STRING_REF Token,
+ OUT CHAR16 **String
+ )
+/**
+ Acquire the string associated with the ProducerGuid and return it.
+
+ @param[in] ProducerGuid - The Guid to search the HII database for
+ @param[in] Token - The token value of the string to extract
+ @param[in] String - The string that is extracted
+
+ @retval EFI_SUCCESS The function completed successfully
+ @retval EFI_NOT_FOUND The requested string was not found
+**/
+;
+
+EFI_STATUS
+IgdOpRegionInit (
+ void
+ )
+/**
+ Graphics OpRegion / Software SCI driver installation function.
+
+ @param[in] void - None
+ @retval EFI_SUCCESS - The driver installed without error.
+ @retval EFI_ABORTED - The driver encountered an error and could not complete
+ installation of the ACPI tables.
+**/
+;
+
+EFI_STATUS
+ExtractDataFromHiiHandle (
+ IN EFI_HII_HANDLE HiiHandle,
+ IN OUT UINT16 *ImageLength,
+ OUT UINT8 *DefaultImage,
+ OUT EFI_GUID *Guid
+ )
+/**
+ Extract information pertaining to the HiiHandle
+
+ @param[in] HiiHandle - Hii handle
+ @param[in] ImageLength - For input, length of DefaultImage;
+ For output, length of actually required
+ @param[in] DefaultImage - Image buffer prepared by caller
+ @param[in] Guid - Guid information about the form
+
+ @retval EFI_OUT_OF_RESOURCES - No enough buffer to allocate
+ @retval EFI_BUFFER_TOO_SMALL - DefualtImage has no enough ImageLength
+ @retval EFI_SUCCESS - Successfully extract data from Hii database.
+**/
+;
+
+EFI_STATUS
+GetVBiosVbtExitPmAuth (
+ VOID
+ )
+/**
+ Get Intel video BIOS VBT information (i.e. Pointer to VBT and VBT size).
+ The VBT (Video BIOS Table) is a block of customizable data that is built
+ within the video BIOS and edited by customers.
+
+ @retval EFI_SUCCESS - Video BIOS VBT information returned.
+ @exception EFI_UNSUPPORTED - Could not find VBT information (*VBiosVbtPtr = NULL).
+**/
+;
+
+EFI_STATUS
+UpdateIgdOpRegionExitPmAuth (
+ VOID
+ )
+/**
+ Update Graphics OpRegion after PCI enumeration.
+
+ @param[in] void - None
+ @retval EFI_SUCCESS - The function completed successfully.
+**/
+;
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/GraphicsInit.c b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/GraphicsInit.c
new file mode 100644
index 0000000..ab08eb3
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/GraphicsInit.c
@@ -0,0 +1,929 @@
+/** @file
+ PEIM to initialize both IGD, PEG and PCI graphics card.
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "GraphicsInit.h"
+#include "CpuIA32.h"
+#include <Token.h>
+#define IGD_ENABLE 1
+#define IGD_DISABLE 0
+
+/**
+ GraphicsInit: Initialize the IGD if no other external graphics is present
+
+ @param[in] PeiServices - Pointer to the PEI services table
+ @param[in] SaPlatformPolicyPpi - SaPlatformPolicyPpi to access the GtConfig related information
+**/
+VOID
+GraphicsInit (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi
+ )
+{
+ DISPLAY_DEVICE PrimaryDisplay;
+ UINT8 GMSData;
+ UINT32 PciMmioLength;
+ UINT32 PchPcieMmioLength;
+ UINT32 PegMmioLength;
+ UINT32 IGfxMmioLength;
+ UINT32 TotalMmioLength;
+ BOOLEAN IGfxSupported;
+ UINT32 LoGTBaseAddress;
+ UINT32 HiGTBaseAddress;
+ UINT32 RegOffset;
+ UINT32 Data32And;
+ UINT32 Data32Or;
+ UINT32 Data32Mask;
+ UINT32 Result;
+ PEI_STALL_PPI *StallPpi;
+ EFI_STATUS Status;
+ UINT64 GttMmAdr;
+ UINTN MchBarBase;
+ CPU_FAMILY CpuFamilyId;
+
+ PciMmioLength = 0;
+ PchPcieMmioLength = 0;
+ PegMmioLength = 0;
+ IGfxMmioLength = 0;
+ GttMmAdr = 0;
+ MchBarBase = McD0PciCfg32 (0x48) &~BIT0;
+ CpuFamilyId = GetCpuFamily();
+
+ ///
+ /// Set the VGA Decode bits to a good known starting point where both PEG and
+ /// IGD VGA Decode Bits are both disabled.
+ ///
+ McD0PciCfg16Or (R_SA_GGC, B_SA_GGC_IVD_MASK);
+ PrimaryDisplay = IGD;
+
+ ///
+ /// Check if IGfx is supported
+ ///
+ IGfxSupported = (BOOLEAN) (McD2PciCfg16 (R_SA_IGD_VID) != 0xFFFF);
+
+ ///
+ /// Check external VGA devices
+ ///
+ CheckOffboardPcieVga (PeiServices, &PchPcieMmioLength, &PrimaryDisplay);
+ CheckAndInitializePegVga (
+ PeiServices,
+ SaPlatformPolicyPpi->PcieConfig->AlwaysEnablePeg,
+ &PrimaryDisplay,
+ SaPlatformPolicyPpi->GtConfig->PrimaryDisplay,
+ &PegMmioLength
+ );
+
+ ///
+ /// Temporarily program GttMmAdr
+ ///
+ GttMmAdr = SaPlatformPolicyPpi->GtConfig->GttMmAdr;
+
+ ///
+ /// Program GttMmAdr
+ ///
+ LoGTBaseAddress = (UINT32) (GttMmAdr & 0xFFFFFFFF);
+ HiGTBaseAddress = (UINT32) RShiftU64 ((GttMmAdr & 0xFFFFFFFF00000000), 32);
+ McD2PciCfg32 (R_SA_IGD_GTTMMADR) = LoGTBaseAddress | BIT2;
+ McD2PciCfg32 (R_SA_IGD_GTTMMADR + 4) = HiGTBaseAddress;
+
+ ///
+ /// Enable Bus Master and Memory access on 0:2:0
+ ///
+ McD2PciCfg16Or (R_SA_IGD_CMD, (BIT2 | BIT1));
+
+ ///
+ /// If primary display device is IGD or no other display detected then enable IGD
+ ///
+ if (IGfxSupported &&
+ (
+ (
+ ((PrimaryDisplay == IGD) || (SaPlatformPolicyPpi->GtConfig->PrimaryDisplay == IGD)) &&
+ (SaPlatformPolicyPpi->GtConfig->InternalGraphics != IGD_DISABLE)
+ ) || (SaPlatformPolicyPpi->GtConfig->InternalGraphics == IGD_ENABLE)
+ )
+ ) {
+
+ DEBUG ((EFI_D_INFO, "IGD enabled.\n"));
+
+ ///
+ /// Program GFX Memory by setting D0.F0.R 050h [7:3]
+ ///
+ McD0PciCfg16And (R_SA_GGC, ~(B_SA_GGC_GMS_MASK));
+
+ GMSData = SaPlatformPolicyPpi->GtConfig->IgdDvmt50PreAlloc;
+
+ McD0PciCfg8Or (R_SA_GGC, (GMSData << N_SA_GGC_GMS_OFFSET));
+
+ ///
+ /// Program Graphics GTT Memory D0:F0:R50h[9:8] = 10b => 2MB of GTT
+ ///
+ McD0PciCfg16AndThenOr (R_SA_GGC, ~(B_SA_GGC_GGMS_MASK), 1 << (N_SA_GGC_GGMS_OFFSET + 1));
+
+ ///
+ /// Set register D2.F0.R 062h [2:1] = `01b' to set a 256MByte aperture.
+ /// This must be done before Device 2 registers are enumerated.
+ ///
+ if (SaPlatformPolicyPpi->GtConfig->ApertureSize == APERTURE_SIZE_128MB) {
+ McD2PciCfg8And (R_SA_IGD_MSAC_OFFSET, ~(BIT2 + BIT1));
+ } else if (SaPlatformPolicyPpi->GtConfig->ApertureSize == APERTURE_SIZE_256MB) {
+ McD2PciCfg8AndThenOr (R_SA_IGD_MSAC_OFFSET, ~(BIT2 + BIT1), BIT1);
+ } else {
+ McD2PciCfg8Or (R_SA_IGD_MSAC_OFFSET, (BIT2 + BIT1));
+ }
+ ///
+ /// Enable IGD VGA Decode. This is needed so the Class Code will
+ /// be correct for the IGD Device when determining which device
+ /// should be primary. If disabled, IGD will show up as a non VGA device.
+ ///
+ if ((SaPlatformPolicyPpi->GtConfig->PrimaryDisplay != IGD) && (PrimaryDisplay != IGD)) {
+ ///
+ /// If IGD is forced to be enabled, but is a secondary display, disable IGD VGA Decode
+ ///
+ McD0PciCfg16Or (R_SA_GGC, B_SA_GGC_IVD_MASK);
+ DEBUG ((EFI_D_INFO, "IGD VGA Decode is disabled because it's not a primary display.\n"));
+ } else {
+ McD0PciCfg16And (R_SA_GGC, ~(B_SA_GGC_IVD_MASK));
+ }
+
+ FindPciDeviceMmioLength (0, 2, 0, &IGfxMmioLength);
+
+ if ((SaPlatformPolicyPpi->Revision >= SA_PLATFORM_POLICY_PPI_REVISION_12) && (SaPlatformPolicyPpi->GtConfig->PanelPowerEnable == 1)) {
+ ///
+ /// Panel Enable VDD bit
+ ///
+ Mmio32Or (GttMmAdr, 0xc7204, 0x8);
+ }
+ } else {
+
+ Status = (*PeiServices)->LocatePpi (PeiServices, &gPeiStallPpiGuid, 0, NULL, &StallPpi);
+ ASSERT_PEI_ERROR (PeiServices, Status);
+
+ if (CpuFamilyId == EnumCpuHswUlt) {
+ ///
+ /// For HSW ULT, Disable LCPLL
+ /// Set LCPLL_CTL (GTTMMADR Offset 0x130040) PLL_disable (Bit 31) to 1b to disable LCPLL.
+ /// Poll for LCPLL_CTL PLL_lock (Bit 30) = 0b to indicate LCPLL lost lock.Timeout and continue after 1 ms.
+ /// Set D_COMP COMP_DISABLE (MCHBAR offset 0x5F0C Bit 0)to 1b.
+ /// Wait > 100 ns for write to complete.
+ /// Poll for D_COMP RCOMP_IN_PROGRESS Bit 9 = 0b.Timeout and continue after 1 ms.
+ ///
+
+ RegOffset = 0x130040;
+ Data32And = 0xFFFFFFFF;
+ Data32Or = BIT31;
+ Mmio32AndThenOr (GttMmAdr, RegOffset, Data32And, Data32Or);
+
+ if (IGfxSupported) {
+ Data32Mask = BIT30;
+ Result = 0;
+ PollGtReady (PeiServices, StallPpi, GttMmAdr, RegOffset, Data32Mask, Result);
+ }
+
+ RegOffset = 0x5F0C;
+ Data32And = 0xFFFFFFFF;
+ Data32Or = BIT0;
+ Mmio32AndThenOr (MchBarBase, RegOffset, Data32And, Data32Or);
+
+ ///
+ /// 1uSec wait
+ ///
+ StallPpi->Stall (PeiServices, StallPpi, 1);
+
+ if (IGfxSupported) {
+ Data32Mask = BIT9;
+ Result = 0;
+ PollGtReady (PeiServices, StallPpi, MchBarBase, RegOffset, Data32Mask, Result);
+ }
+ }
+
+ DEBUG ((EFI_D_INFO, "Disable IGD Device.\n"));
+ ///
+ /// Disable IGD device
+ ///
+ /// Register D0:F0 Offset 50h [7:3] = '00000b'.
+ /// This prevents UMA memory from being pre-allocated to IGD.
+ /// Set D0:F0 Offset 50h [9:8] = '00b'.
+ /// GTT Graphics Memory Size to 0
+ /// Set VGA Disable (IVD) in D0:F0 Offset 50h [1] = '1b'.
+ ///
+ McD0PciCfg16AndThenOr (R_SA_GGC, ~(B_SA_GGC_GGMS_MASK | B_SA_GGC_GMS_MASK), B_SA_GGC_IVD_MASK);
+ SaPlatformPolicyPpi->GtConfig->GttSize = 0;
+ SaPlatformPolicyPpi->GtConfig->IgdDvmt50PreAlloc = 0;
+
+ ///
+ /// Disable IGD. D0.F0.R 054h [4] = '0b'.
+ ///
+ McD0PciCfg8And (R_SA_DEVEN, ~(B_SA_DEVEN_D2EN_MASK));
+ }
+
+ TotalMmioLength = PciMmioLength + PchPcieMmioLength + PegMmioLength + IGfxMmioLength;
+ DEBUG ((EFI_D_INFO, "TotalMmioLength: 0x%08X bytes\n", TotalMmioLength));
+
+ ///
+ /// Disable Bus Master and Memory access on 0:2:0 and clear GTTMMADR
+ ///
+ McD2PciCfg16And (R_SA_IGD_CMD, ~(BIT2 | BIT1));
+ McD2PciCfg32And (R_SA_IGD_GTTMMADR, 0x0);
+ McD2PciCfg32And (R_SA_IGD_GTTMMADR + 0x4, 0x0);
+
+ ///
+ /// Determine MMIO Size for Dynamic Tolud
+ ///
+ if (SaPlatformPolicyPpi->MemConfig->MaxTolud == 0x00) {
+ ///
+ /// if total MMIO need 1GB or over
+ ///
+ if (TotalMmioLength >= 0x40000000) {
+ SaPlatformPolicyPpi->GtConfig->MmioSize = 0x800;
+ }
+ ///
+ /// if total MMIO need 728MB~1GB
+ ///
+ else if (TotalMmioLength >= 0x30000000) {
+ SaPlatformPolicyPpi->GtConfig->MmioSize = 0x700;
+ }
+ ///
+ /// if total MMIO need 512MB~728MB
+ ///
+ else if (TotalMmioLength >= 0x20000000) {
+ SaPlatformPolicyPpi->GtConfig->MmioSize = 0x600;
+ }
+ ///
+ /// if total MMIO need 256MB~512MB
+ ///
+ else if (TotalMmioLength >= 0x10000000) {
+ SaPlatformPolicyPpi->GtConfig->MmioSize = 0x500;
+ }
+ ///
+ /// if total MMIO need less than 256MB
+ ///
+ else {
+ SaPlatformPolicyPpi->GtConfig->MmioSize = 0x400;
+ }
+ }
+}
+
+/**
+ CheckAndInitializePegVga: Check if PEG card is present and configure accordingly
+
+ @param[in] PeiServices - Pointer to the PEI services table
+ @param[in] AlwaysEnablePeg - 0 - Peg is not always enabled.
+ @param[in, out] PrimaryDisplay - Primary Display - default is IGD
+ @param[in] PrimaryDisplaySelection - Primary display selection from BIOS Setup
+ @param[in, out] PegMmioLength - Total PEG MMIO length on all PEG ports
+**/
+VOID
+CheckAndInitializePegVga (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN UINT8 AlwaysEnablePeg,
+ IN OUT DISPLAY_DEVICE *PrimaryDisplay,
+ IN UINT8 PrimaryDisplaySelection,
+ IN OUT UINT32 *PegMmioLength
+ )
+{
+ UINT8 ClassCode;
+ BOOLEAN IgdPresent;
+ UINT8 PegBus;
+ UINT8 PegDev;
+ UINT8 PegFunc;
+ UINT16 PegDevenReg;
+ UINT8 PegComplete;
+ UINT16 PegEnable;
+ BOOLEAN CardDetect;
+ UINT32 MmioLength;
+ UINT8 Func;
+ UINT8 MaxFunction;
+ UINT8 HeaderType;
+ UINT8 PegVgaFunc;
+
+ PEG_DEVEN PegDevenTable[] = {
+ ///
+ /// Bus, Device, Function, DevenMask
+ ///
+ {
+ SA_PEG_BUS_NUM,
+ SA_PEG10_DEV_NUM,
+ SA_PEG10_FUN_NUM,
+ BIT3
+ }
+// AMI_OVERRID >>
+#if RC_PEG_1 == 1
+,
+ {
+ SA_PEG_BUS_NUM,
+ SA_PEG11_DEV_NUM,
+ SA_PEG11_FUN_NUM,
+ BIT2
+ }
+#endif
+#if RC_PEG_2 == 1
+,
+ {
+ SA_PEG_BUS_NUM,
+ SA_PEG12_DEV_NUM,
+ SA_PEG12_FUN_NUM,
+ BIT1
+ }
+#endif
+// AMI_OVERRID <<
+ };
+
+ MmioLength = 0;
+ CardDetect = FALSE;
+ PegVgaFunc = 0xFF;
+
+ ///
+ /// Read the DEVEN register for PEG0/1/2 controllers configuration
+ ///
+ PegDevenReg = MmPci16 (0, SA_MC_BUS, 0, 0, R_SA_DEVEN) & (BIT3 + BIT2 + BIT1);
+
+ ///
+ /// If IGD is disabled
+ /// or not present IgdPresent is set to false
+ ///
+ if (McD2PciCfg16 (PCI_VID) == 0xFFFF) {
+ IgdPresent = FALSE;
+ } else {
+ IgdPresent = TRUE;
+ }
+ ///
+ /// Scan PEG device vs DEVEN register for PEG controllers configuration
+ ///
+ for (PegComplete = 0; PegComplete < ((sizeof (PegDevenTable)) / (sizeof (PEG_DEVEN))); PegComplete++) {
+
+ PegBus = PegDevenTable[PegComplete].Bus;
+ PegDev = PegDevenTable[PegComplete].Device;
+ PegFunc = PegDevenTable[PegComplete].Function;
+ PegEnable = PegDevenTable[PegComplete].DevenMask;
+
+ if ((PegDevenReg & PegEnable) == 0) {
+ continue;
+ }
+ ///
+ /// Check for a card presence in the PEG slot.
+ /// We don't know if it's a graphics card yet.
+ ///
+ if ((MmPci8 (0, PegBus, PegDev, PegFunc, R_SA_PEG_SLOTSTS_OFFSET) & BIT6) == 0) {
+ continue;
+ }
+ ///
+ /// Set PEG PortBus = 1 to Read Endpoint.
+ ///
+ MmPci32AndThenOr (0, PegBus, PegDev, PegFunc, PCI_PBUS, 0xFF0000FF, 0x00010100);
+
+ ///
+ /// A config write is required in order for the device to re-capture the Bus number,
+ /// according to PCI Express Base Specification, 2.2.6.2
+ /// Write to a read-only register VendorID to not cause any side effects.
+ ///
+ MmPci16 (0, 1, 0, 0, PCI_VID) = 0;
+
+ ///
+ /// Read Vendor ID to check if endpoint exists
+ /// if no device exists, then check next device
+ ///
+ if (MmPci16 (0, 1, 0, 0, PCI_VID) == 0xFFFF) {
+ continue;
+ }
+ ///
+ /// Check for a multifunction device
+ ///
+ HeaderType = MmPci8 (0, 1, 0, 0, PCI_HEADER_TYPE_OFFSET);
+ if ((HeaderType & HEADER_TYPE_MULTI_FUNCTION) != 0) {
+ MaxFunction = 7;
+ } else {
+ MaxFunction = 0;
+ }
+ ///
+ /// Calculate total PEG MMIO length on all functions of the endpoint
+ ///
+ for (Func = 0; Func <= MaxFunction; Func++) {
+ if (MmPci16 (0, 1, 0, Func, PCI_VID) == 0xFFFF) {
+ continue;
+ }
+
+ FindPciDeviceMmioLength (1, 0, Func, &MmioLength);
+ *PegMmioLength += MmioLength;
+ }
+ ///
+ /// Perform PEG Endpoint Class Code Check. If the Endpoint Class Code is
+ /// not GFX, then the Port is being used as a standard PCI Express Port.
+ ///
+ ClassCode = MmPci8 (0, 1, 0, 0, PCI_BCC);
+ if (ClassCode == 0x03) {
+ ///
+ /// Disable PEG if IGD or PCI VGA take precedence.
+ ///
+ if (AlwaysEnablePeg == 0) {
+ ///
+ /// If IGD is present and selected as primary, skip the PEG VGA enabling
+ ///
+ if (IgdPresent && (PrimaryDisplaySelection == IGD)) {
+ MmPci32And (0, PegBus, PegDev, PegFunc, PCI_PBUS, 0xFF0000FF);
+ continue;
+ }
+ ///
+ /// If PCI video card was detected, skip the PEG VGA enabling
+ ///
+ if (*PrimaryDisplay == PCI) {
+ MmPci32And (0, PegBus, PegDev, PegFunc, PCI_PBUS, 0xFF0000FF);
+ continue;
+ }
+ }
+ ///
+ /// Enable PEG video and Execute 16-bit address decodes on VGA I/O accesses
+ ///
+ /// Check if PEG VGA already detected
+ ///
+ if (*PrimaryDisplay != PEG) {
+ MmPci16Or (0, PegBus, PegDev, PegFunc, R_SA_PEG_BCTRL_OFFSET, (BIT3 + BIT4));
+ *PrimaryDisplay = PEG;
+ PegVgaFunc = PegFunc;
+ DEBUG ((EFI_D_INFO, "PCIe card on PEG%x%x (%x:%x:%x) enabled as VGA.\n", PegDev, PegFunc, PegBus, PegDev, PegFunc));
+ }
+ }
+
+ if (ClassCode == 0x06) {
+ CardDetect = EnumerateBridgeDevice (PegBus, PegDev, PegFunc, PegMmioLength);
+ if (CardDetect == TRUE) {
+ ///
+ /// Check if PEG VGA already detected
+ ///
+ if (*PrimaryDisplay != PEG) {
+ MmPci16Or (0, PegBus, PegDev, PegFunc, R_SA_PEG_BCTRL_OFFSET, (BIT3 + BIT4));
+ *PrimaryDisplay = PEG;
+ PegVgaFunc = PegFunc;
+ DEBUG ((EFI_D_INFO, "PCIe card on PEG%x%x (%x:%x:%x) enabled as VGA.\n", PegDev, PegFunc, PegBus, PegDev, PegFunc));
+ }
+ }
+ }
+ ///
+ /// Restore bus numbers on the PEG bridge.
+ ///
+ MmPci32And (0, PegBus, PegDev, PegFunc, PCI_PBUS, 0xFF0000FF);
+ } // End of the for Loop
+
+ ///
+ /// If a PEG device is used for primary graphics, set the ISAEN bit on all other PEG ports.
+ ///
+ if (PegVgaFunc != 0xFF) {
+ for (PegComplete = 0; PegComplete < ((sizeof (PegDevenTable)) / (sizeof (PEG_DEVEN))); PegComplete++) {
+ if (PegVgaFunc == PegComplete) {
+ continue;
+ }
+ PegBus = PegDevenTable[PegComplete].Bus;
+ PegDev = PegDevenTable[PegComplete].Device;
+ PegFunc = PegDevenTable[PegComplete].Function;
+ MmPci16Or (0, PegBus, PegDev, PegFunc, R_SA_PEG_BCTRL_OFFSET, BIT2);
+ DEBUG ((EFI_D_INFO, "PEG%x%x (%x:%x:%x) ISAEN has been set.\n", PegDev, PegFunc, PegBus, PegDev, PegFunc));
+ }
+ }
+}
+
+/**
+ Find the MMIO size that a given PCI device requires
+
+ @param[in] BusNum - Bus number of the device
+ @param[in] DevNum - device Number of the device
+ @param[in] FunNum - Function number of the device
+ @param[out] MmioLength - MMIO Length in bytes
+**/
+VOID
+FindPciDeviceMmioLength (
+ IN UINT32 BusNum,
+ IN UINT32 DevNum,
+ IN UINT32 FunNum,
+ OUT UINT32 *MmioLength
+ )
+{
+ UINT32 CurrentMmioLength;
+ UINT32 SavedBAR;
+ UINT32 i;
+ UINT64 BarAlign;
+ UINT8 ClassCode;
+
+ *MmioLength = 0;
+ BarAlign = PCI_BAR_OLD_ALIGN;
+
+ ClassCode = MmPci8 (0, BusNum, DevNum, FunNum, PCI_BCC);
+ if (ClassCode == PCI_CLASS_BRIDGE) {
+ return ;
+ }
+
+ for (i = PCI_BAR0; i <= PCI_BAR5; i += 4) {
+ SavedBAR = MmPci32 (0, BusNum, DevNum, FunNum, i);
+ ///
+ /// Check BAR is read-only or not
+ ///
+ MmPci32And (0, BusNum, DevNum, FunNum, i, (UINT32) PCI_BAR_NOCHANGE);
+ MmPci32Or (0, BusNum, DevNum, FunNum, i, BarAlign);
+ if (SavedBAR == MmPci32 (0, BusNum, DevNum, FunNum, i)) {
+ ///
+ /// Restore BAR as original value
+ ///
+ MmPci32 (0, BusNum, DevNum, FunNum, i) = SavedBAR;
+ continue;
+ }
+ ///
+ /// If BAR is not memory map, skip it
+ ///
+ if ((SavedBAR & BIT0) != 0) {
+ ///
+ /// Restore BAR as original value
+ ///
+ MmPci32 (0, BusNum, DevNum, FunNum, i) = SavedBAR;
+ continue;
+ }
+ ///
+ /// Calculate the MMIO length through BAR
+ ///
+ CurrentMmioLength = ~(MmPci32 (0, BusNum, DevNum, FunNum, i) &~0xF) + 1;
+ *MmioLength += CurrentMmioLength;
+
+ ///
+ /// Restore BAR as original value
+ ///
+ MmPci32 (0, BusNum, DevNum, FunNum, i) = SavedBAR;
+ ///
+ /// Skip next index if BAR is 64bit address
+ ///
+ if ((SavedBAR & (BIT1 + BIT2)) == 0x4) {
+ i += 4;
+ }
+ }
+}
+
+/**
+ CheckOffboardPcieVga: Check if off board PCIe graphics Card is present
+
+ @param[in] PeiServices - Pointer to the PEI services table
+ @param[in, out] PchPcieMmioLength - Total PCIe MMIO length on all PCH root ports
+ @param[in, out] PrimaryDisplay - Primary Display - default is IGD
+**/
+VOID
+CheckOffboardPcieVga (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN OUT UINT32 *PchPcieMmioLength,
+ IN OUT DISPLAY_DEVICE *PrimaryDisplay
+ )
+{
+ UINT8 PortNo;
+ UINT32 PcieBusNum;
+ UINT8 Bus;
+ UINT8 Dev;
+ UINT8 Func;
+ UINT8 MaxFunction;
+ UINT8 SubBusNum;
+ UINT8 HeaderType;
+ UINT16 Buffer16;
+ BOOLEAN CardDetect;
+ UINT32 MmioLength;
+
+ MmioLength = 0;
+
+ ///
+ /// Initialize Secondary and Subordinate bus number for first Pcie root port
+ ///
+ PcieBusNum = 0x00010100;
+
+ SubBusNum = 0;
+
+ CardDetect = FALSE;
+
+ for (PortNo = 0; PortNo < GetPchMaxPciePortNum (); PortNo++) {
+ ///
+ /// Check if root port exists
+ ///
+ if (MmPci16 (0, 0, 0x1C, PortNo, PCI_VID) == 0xFFFF) {
+ continue;
+ }
+
+ MmPci32 (0, 0, 0x1c, PortNo, PCI_BRIDGE_PRIMARY_BUS_REGISTER_OFFSET) = PcieBusNum;
+ Bus = MmPci8 (0, 0, 0x1c, PortNo, PCI_BRIDGE_SECONDARY_BUS_REGISTER_OFFSET);
+
+ ///
+ /// Assign temporary subordinate bus number so that device this bridge can be seen
+ ///
+ MmPci8 (0, 0, 0x1c, PortNo, PCI_BRIDGE_SUBORDINATE_BUS_REGISTER_OFFSET) = 0xFF;
+
+ ///
+ /// A config write is required in order for the device to re-capture the Bus number,
+ /// according to PCI Express Base Specification, 2.2.6.2
+ /// Write to a read-only register VendorID to not cause any side effects.
+ ///
+ MmPci16 (0, Bus, 0, 0, PCI_VID) = 0;
+
+ SubBusNum = EnumerateDownstream (Bus);
+ ///
+ /// Update the actual subordinate bus number
+ ///
+ MmPci8 (0, 0, 0x1c, PortNo, PCI_BRIDGE_SUBORDINATE_BUS_REGISTER_OFFSET) = SubBusNum;
+ PcieBusNum = (SubBusNum + 1) << 8;
+ }
+
+ for (Bus = 1; Bus <= SubBusNum; Bus++) {
+ for (Dev = 0; Dev < 32; Dev++) {
+ ///
+ /// Read Vendor ID to check if device exists
+ /// if no device exists, then check next device
+ ///
+ if (MmPci16 (0, Bus, Dev, 0, PCI_VID) == 0xFFFF) {
+ continue;
+ }
+ ///
+ /// Check for a multifunction device
+ ///
+ HeaderType = MmPci8 (0, Bus, Dev, 0, PCI_HDR);
+ if ((HeaderType & HEADER_TYPE_MULTI_FUNCTION) != 0) {
+ MaxFunction = 7;
+ } else {
+ MaxFunction = 0;
+ }
+
+ for (Func = 0; Func <= MaxFunction; Func++) {
+ if (MmPci16 (0, Bus, Dev, Func, PCI_VID) == 0xFFFF) {
+ continue;
+ }
+
+ FindPciDeviceMmioLength (Bus, Dev, Func, &MmioLength);
+ *PchPcieMmioLength += MmioLength;
+
+ ///
+ /// Video cards can have Base Class 0 with Sub-class 1
+ /// or Base Class 3.
+ ///
+ if (MmPci16 (0, Bus, Dev, Func, PCI_SCC) == 0x0300) {
+ if (CardDetect != TRUE) {
+ *PrimaryDisplay = PCI;
+ DEBUG ((EFI_D_INFO, "PCH PCIe Graphics Card enabled.\n"));
+ CardDetect = TRUE;
+ }
+ }
+ }
+ }
+ }
+ ///
+ /// Clear bus number on all the bridges that we have opened so far.
+ /// We have to do it in the reverse Bus number order.
+ ///
+ for (Bus = SubBusNum; Bus >= 1; Bus--) {
+ for (Dev = 0; Dev < 32; Dev++) {
+ ///
+ /// Read Vendor ID to check if device exists
+ /// if no device exists, then check next device
+ ///
+ if (MmPci16 (0, Bus, Dev, 0, PCI_VID) == 0xFFFF) {
+ continue;
+ }
+
+ Buffer16 = MmPci16 (0, Bus, Dev, 0, PCI_SCC);
+ ///
+ /// Clear Bus Number for PCI/PCI Bridge Device
+ ///
+ if (Buffer16 == 0x0604) {
+ MmPci32 (0, Bus, Dev, 0, PCI_BRIDGE_PRIMARY_BUS_REGISTER_OFFSET) = 0;
+ }
+ }
+ }
+
+ for (PortNo = 0; PortNo < GetPchMaxPciePortNum (); PortNo++) {
+ ///
+ /// Clear bus numbers so that PCIe slots are hidden
+ ///
+ MmPci32 (0, 0, 0x1c, PortNo, PCI_BRIDGE_PRIMARY_BUS_REGISTER_OFFSET) = 0;
+ }
+}
+
+/**
+ This function enumerate all downstream bridge.
+
+ @param[in] BusNum - Primary bus number of current bridge.
+
+ @retval BusNum: return current bus number if current bus is an enpoint device.
+ @retval SubBus: return subordinate bus number if current bus is a bridge.
+**/
+UINT8
+EnumerateDownstream (
+ IN UINT8 BusNum
+ )
+{
+ UINT8 DevNum;
+ UINT16 Buffer16;
+ UINT8 SubBus;
+ UINT8 SecBus;
+
+ SubBus = 0;
+
+ SecBus = BusNum;
+
+ for (DevNum = 0; DevNum < 32; DevNum++) {
+ ///
+ /// Read Vendor ID to check if device exists
+ /// if no device exists, then check next device
+ ///
+ if (MmPci16 (0, BusNum, DevNum, 0, PCI_VID) == 0xFFFF) {
+ continue;
+ }
+
+ Buffer16 = MmPci16 (0, BusNum, DevNum, 0, PCI_SCC);
+ ///
+ /// Check for PCI/PCI Bridge Device Base Class 6 with subclass 4
+ ///
+ if (Buffer16 == 0x0604) {
+ SecBus++;
+ MmPci8 (0, BusNum, DevNum, 0, PCI_BRIDGE_PRIMARY_BUS_REGISTER_OFFSET) = BusNum;
+ MmPci8 (0, BusNum, DevNum, 0, PCI_BRIDGE_SECONDARY_BUS_REGISTER_OFFSET) = SecBus;
+ ///
+ /// Assign temporary subordinate bus number so that device behind this bridge can be seen
+ ///
+ MmPci8 (0, BusNum, DevNum, 0, PCI_BRIDGE_SUBORDINATE_BUS_REGISTER_OFFSET) = 0xFF;
+
+ ///
+ /// A config write is required in order for the device to re-capture the Bus number,
+ /// according to PCI Express Base Specification, 2.2.6.2
+ /// Write to a read-only register VendorID to not cause any side effects.
+ ///
+ MmPci16 (0, SecBus, 0, 0, PCI_VID) = 0;
+
+ ///
+ /// Enumerate bus behind this bridge by calling this funstion recursively
+ ///
+ SubBus = EnumerateDownstream (SecBus);
+ ///
+ /// Update the correct subordinate bus number
+ ///
+ MmPci8 (0, BusNum, DevNum, 0, PCI_BRIDGE_SUBORDINATE_BUS_REGISTER_OFFSET) = SubBus;
+ SecBus = SubBus;
+ }
+ }
+
+ if (SubBus == 0) {
+ return BusNum;
+ } else {
+ return SubBus;
+ }
+}
+
+/**
+ This function enumerate the bridge on the device
+
+ @param[in] PegBus - Particular Bus number
+ @param[in] PegDev - Particular Device number
+ @param[in] PegFunc - Particular Func number
+ @param[in, out] PegMmioLength - PEG MMIO length
+
+ @retval CardDetect : TRUE if current bridge device has a Graphics card.
+ @retval CardDetect : FALSE if current bridge device has no Graphics card.
+**/
+BOOLEAN
+EnumerateBridgeDevice (
+ IN UINT8 PegBus,
+ IN UINT8 PegDev,
+ IN UINT8 PegFunc,
+ IN OUT UINT32 *PegMmioLength
+ )
+{
+
+ UINT8 Bus;
+ UINT8 Dev;
+ UINT8 SubBusNum;
+ UINT16 Buffer16;
+ BOOLEAN CardDetect;
+
+ CardDetect = FALSE;
+
+ ///
+ /// Temporarily program the secondary and subordinate bus numbers
+ /// of PEG bridge to (1, 0xFF) so that devices behind the bridge can be seen
+ ///
+ Bus = 1;
+ MmPci8 (0, PegBus, PegDev, PegFunc, PCI_BRIDGE_SECONDARY_BUS_REGISTER_OFFSET) = Bus;
+ MmPci8 (0, PegBus, PegDev, PegFunc, PCI_BRIDGE_SUBORDINATE_BUS_REGISTER_OFFSET) = 0xFF;
+
+ ///
+ /// A config write is required in order for the device to re-capture the Bus number,
+ /// according to PCI Express Base Specification, 2.2.6.2
+ /// Write to a read-only register VendorID to not cause any side effects.
+ ///
+ MmPci16 (0, Bus, 0, 0, PCI_VID) = 0;
+
+ SubBusNum = EnumerateDownstream (Bus);
+
+ for (Bus = 1; Bus <= SubBusNum; Bus++) {
+ for (Dev = 0; Dev < 32; Dev++) {
+ ///
+ /// Read Vendor ID to check if device exists
+ /// if no device exists, then check next device
+ ///
+ if (MmPci16 (0, Bus, Dev, 0, PCI_VID) == 0xFFFF) {
+ continue;
+
+ }
+ ///
+ /// Video cards can have Base Class 0 with Sub-class 1
+ /// or Base Class 3.
+ ///
+ if (MmPci16 (0, Bus, Dev, 0, PCI_SCC) == 0x0300) {
+ FindPciDeviceMmioLength (Bus, Dev, 0, PegMmioLength);
+ CardDetect = TRUE;
+ break;
+ }
+ }
+
+ if (CardDetect == TRUE) {
+ break;
+ }
+ }
+ ///
+ /// Clear bus number on all the bridges that we have opened so far.
+ /// We have to do it in the reverse Bus number order.
+ ///
+ for (Bus = SubBusNum; Bus >= 1; Bus--) {
+ for (Dev = 0; Dev < 32; Dev++) {
+ ///
+ /// Read Vendor ID to check if device exists
+ /// if no device exists, then check next device
+ ///
+ if (MmPci16 (0, Bus, Dev, 0, PCI_VID) == 0xFFFF) {
+ continue;
+ }
+
+ Buffer16 = MmPci16 (0, Bus, Dev, 0, PCI_SCC);
+ ///
+ /// Clear Bus Number for PCI/PCI Bridge Device
+ ///
+ if (Buffer16 == 0x0604) {
+ MmPci32 (0, Bus, Dev, 0, PCI_BRIDGE_PRIMARY_BUS_REGISTER_OFFSET) = 0;
+ }
+ }
+ }
+ ///
+ /// Clear the bus numbers on the PEG bridge
+ ///
+ MmPci32 (0, PegBus, PegDev, PegFunc, PCI_BRIDGE_PRIMARY_BUS_REGISTER_OFFSET) = 0;
+
+ return CardDetect;
+}
+
+/**
+
+ "Poll Status" for GT Readiness
+
+ @param[in] PeiServices - Pointer to the PEI services table
+ @param[in] StallPpi - Pointer to Stall PPI
+ @param[in] Base - Base address of MMIO
+ @param[in] Offset - MMIO Offset
+ @param[in] Mask - Mask
+ @param[in] Result - Value to wait for
+
+
+**/
+VOID
+PollGtReady (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_STALL_PPI *StallPpi,
+ UINT64 Base,
+ UINT32 Offset,
+ UINT32 Mask,
+ UINT32 Result
+ )
+{
+ UINT32 GtStatus;
+ UINT16 StallCount;
+
+ StallCount = 0;
+
+ ///
+ /// Register read
+ ///
+ GtStatus = Mmio32 (Base, Offset);
+
+ while (((GtStatus & Mask) != Result) && (StallCount < GT_WAIT_TIMEOUT)) {
+
+ GtStatus = Mmio32 (Base, Offset);
+ ///
+ /// 1mSec wait
+ ///
+ StallPpi->Stall (PeiServices, StallPpi, 1000);
+ StallCount = StallCount + 1;
+ }
+
+ ASSERT ((StallCount != GT_WAIT_TIMEOUT));
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/GraphicsInit.h b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/GraphicsInit.h
new file mode 100644
index 0000000..6d060cb
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/GraphicsInit.h
@@ -0,0 +1,219 @@
+/** @file
+ Graphics header file
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _GRAPHICS_INIT_H_
+#define _GRAPHICS_INIT_H_
+
+#include "EdkIIGluePeim.h"
+#include "SaAccess.h"
+#include "PchAccess.h"
+#include "EdkIIGluePcdPciExpressLib.h"
+#include "EdkIIGlueConfig.h"
+#include "Pci22.h"
+#include "PchPlatformLib.h"
+#include "CpuRegs.h"
+#include "CpuPlatformLib.h"
+
+///
+/// Driver Consumed PPI Prototypes
+///
+#include EFI_PPI_DEPENDENCY (SaPlatformPolicy)
+
+typedef struct {
+ UINT8 Bus;
+ UINT8 Device;
+ UINT8 Function;
+ UINT16 DevenMask;
+} PEG_DEVEN;
+
+typedef enum {
+ IGD = 0,
+ PEG,
+ PCI,
+ DISPLAY_DEVICE_MAX
+} DISPLAY_DEVICE;
+
+typedef enum {
+ VBIOS_DEFAULT = 0,
+ CRT,
+ LFP,
+ CRT_LFP,
+ TV,
+ LFPSDVO,
+ EFP,
+ TVSDVO,
+ CRT_LFPSDVO,
+ CRT_EFP,
+ IGD_BOOT_TYPE_MAX
+} IGD_BOOT_TYPE;
+
+typedef enum {
+ GMS_FIXED = 0,
+ GMS_DVMT,
+ GMS_FIXED_DVMT,
+ GMS_MAX
+} GRAPHICS_MEMORY_SELECTION;
+
+typedef enum {
+ GM_32M = 1,
+ GM_64M = 2,
+ GM_128M = 4,
+ GM_MAX
+} STOLEN_MEMORY;
+
+typedef enum {
+ PAVP_DISABLED = 0,
+ PAVP_LITE,
+ PAVP_HIGH
+} PAVP_MODE;
+
+#define GTTMMADR_SIZE_4MB 0x400000
+#define GTT_SIZE_2MB 2
+#define GT_WAIT_TIMEOUT 3000 ///< ~3 seconds
+
+#define APERTURE_SIZE_128MB 1
+#define APERTURE_SIZE_256MB 2
+#define APERTURE_SIZE_512MB 3
+
+/**
+ CheckAndInitializePegVga: Check if PEG card is present and configure accordingly
+
+ @param[in] PeiServices - Pointer to the PEI services table
+ @param[in] AlwaysEnablePeg - 0 - Peg is not always enabled.
+ @param[in, out] PrimaryDisplay - Primary Display - default is IGD
+ @param[in] PrimaryDisplaySelection - Primary display selection from BIOS Setup
+ @param[in, out] PegMmioLength - Total PEG MMIO length on all PEG ports
+**/
+VOID
+CheckAndInitializePegVga (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN UINT8 AlwaysEnablePeg,
+ IN OUT DISPLAY_DEVICE *PrimaryDisplay,
+ IN UINT8 PrimaryDisplaySelection,
+ IN OUT UINT32 *PegMmioLength
+ )
+;
+
+/**
+ CheckOffboardPciVga: Check if off board PCI graphics Card is present
+
+ @param[in] PeiServices - Pointer to the PEI services table
+ @param[in, out] PciMmioLength - PCI MMIO length
+ @param[in, out] PrimaryDisplay - Primary Display - default is IGD
+**/
+VOID
+CheckOffboardPciVga (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN OUT UINT32 *PciMmioLength,
+ IN OUT DISPLAY_DEVICE *PrimaryDisplay
+ )
+;
+
+/**
+ CheckOffboardPcieVga: Check if off board PCIe graphics Card is present
+
+ @param[in] PeiServices - Pointer to the PEI services table
+ @param[in, out] PchPcieMmioLength - Total PCIe MMIO length on all PCH root ports
+ @param[in, out] PrimaryDisplay - Primary Display - default is IGD
+**/
+VOID
+CheckOffboardPcieVga (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN OUT UINT32 *PchPcieMmioLength,
+ IN OUT DISPLAY_DEVICE *PrimaryDisplay
+ )
+;
+
+/**
+ Find the MMIO size that a given PCI device requires
+
+ @param[in] BusNum - Bus number of the device
+ @param[in] DevNum - device Number of the device
+ @param[in] FunNum - Function number of the device
+ @param[out] MmioLength - MMIO Length in bytes
+**/
+VOID
+FindPciDeviceMmioLength (
+ IN UINT32 BusNum,
+ IN UINT32 DevNum,
+ IN UINT32 FunNum,
+ OUT UINT32 *MmioLength
+ )
+;
+
+/**
+ This function enumerate all downstream bridge.
+
+ @param[in] BusNum - Primary bus number of current bridge
+
+ @retval Current bus number: if current bus is an enpoint device
+ @retval subordinate bus number: if current bus is a bridge
+**/
+UINT8
+EnumerateDownstream (
+ IN UINT8 BusNum
+ )
+;
+
+/**
+ This function enumerate the bridge on the device
+
+ @param[in] PegBus - Particular Bus number
+ @param[in] PegDev - Particular Device number
+ @param[in] PegFunc - Particular Func number
+ @param[in, out] PegMmioLength - PEG MMIO length
+
+ @retval CardDetect : TRUE if current bridge device has a Graphics card.
+ @retval CardDetect : FALSE if current bridge device has no Graphics card.
+**/
+BOOLEAN
+EnumerateBridgeDevice (
+ IN UINT8 PegBus,
+ IN UINT8 PegDev,
+ IN UINT8 PegFunc,
+ IN OUT UINT32 *PegMmioLength
+ )
+;
+
+/**
+
+ "Poll Status" for GT Readiness
+
+ @param[in] PeiServices - Pointer to the PEI services table
+ @param[in] StallPpi - Pointer to Stall PPI
+ @param[in] Base - Base address of MMIO
+ @param[in] Offset - MMIO Offset
+ @param[in] Mask - Mask
+ @param[in] Result - Value to wait for
+
+
+**/
+VOID
+PollGtReady (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_STALL_PPI *StallPpi,
+ UINT64 Base,
+ UINT32 Offset,
+ UINT32 Mask,
+ UINT32 Result
+ )
+;
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/PciExpressInit.c b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/PciExpressInit.c
new file mode 100644
index 0000000..bead6ce
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/PciExpressInit.c
@@ -0,0 +1,2987 @@
+/** @file
+ PEI Function to initialize SA PciExpress.
+
+@copyright
+ Copyright (c) 1999 - 2014 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+#include "PciExpressInit.h"
+#include "PcieTraining.h"
+#include "PchPlatformLib.h"
+
+#include <Token.h> //AMI_OVERRIDE
+
+#ifdef PEG_FLAG
+#include EFI_GUID_DEFINITION (SaDataHob)
+
+#define SA_PEG_VMARGIN_UP 0
+#define SA_PEG_VMARGIN_DOWN 1
+
+#define SA_PEG_LINK_DISABLE_MAXWAIT 100*10
+
+VOID
+ReportPcieLinkStatus (
+ IN UINT8 PegBus,
+ IN UINT8 PegDev,
+ IN UINT8 PegFunc
+)
+/**
+ This function reports a PEG controller's link status
+
+ @param[in] PegBus - Peg Bus
+ @param[in] PegDev - Peg Device
+ @param[in] PegFunc - Peg Function
+
+ @retval None
+**/
+{
+ UINT32 Deven;
+ UINT16 LinkStatus;
+ UINT8 LinkWidth;
+ UINT8 LinkSpeed;
+ UINT16 Vc0Pending;
+
+ Deven = MmPci32 (0, SA_MC_BUS, SA_MC_DEV, SA_MC_FUN, R_SA_DEVEN);
+ Deven = (Deven >> 1) & 0x7;
+ DEBUG ((EFI_D_INFO, "PEG%x%x (%x:%x:%x) - ", PegDev, PegFunc, PegBus, PegDev, PegFunc));
+ if (((Deven >> (SA_PEG_MAX_FUN - 1 - PegFunc)) & 0x1) == 0x1) {
+ LinkStatus = MmPci16 (0, PegBus, PegDev, PegFunc, R_SA_PEG_LSTS_OFFSET);
+ LinkWidth = (LinkStatus >> 4) & 0x3F;
+ LinkSpeed = LinkStatus & 0xF;
+ Vc0Pending = ((MmPci16 (0, PegBus, PegDev, PegFunc, R_SA_PEG_VC0RSTS_OFFSET)) >> 1) & 0x1;
+ DEBUG ((EFI_D_INFO, "Trained to x%d at Gen%d.", LinkWidth, LinkSpeed));
+ DEBUG ((EFI_D_INFO, " VC0 Negotiation Pending = %d.", Vc0Pending));
+ DEBUG ((EFI_D_INFO, "\n"));
+ } else {
+ DEBUG ((EFI_D_INFO, "Disabled.\n"));
+ }
+}
+
+VOID
+WaitForVc0Negotiation (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_STALL_PPI *StallPpi,
+ IN UINT8 PegBus,
+ IN UINT8 PegDev,
+ IN UINT8 PegFunc
+)
+/**
+ This function prints the time required for VC0 Negotiation Pending to be cleared. Quits after 100 msec.
+
+ @param[in] PeiServices - Pointer to the PEI services table
+ @param[in] StallPpi - Pointer to PEI_STALL_PPI
+ @param[in] PegBus - Peg Bus
+ @param[in] PegDev - Peg Device
+ @param[in] PegFunc - Peg Function
+
+ @retval None
+**/
+{
+ UINT32 Deven;
+ UINT32 MsecWait;
+ UINT16 Vc0Pending;
+
+ Deven = MmPci32 (0, SA_MC_BUS, SA_MC_DEV, SA_MC_FUN, R_SA_DEVEN);
+ Deven = (Deven >> 1) & 0x7;
+ if (((Deven >> (SA_PEG_MAX_FUN - 1 - PegFunc)) & 0x1) == 0x1) {
+ MsecWait = 0;
+ Vc0Pending = ((MmPci16 (0, PegBus, PegDev, PegFunc, R_SA_PEG_VC0RSTS_OFFSET)) >> 1) & 0x1;
+
+ while (Vc0Pending && (MsecWait < 100)) {
+ MsecWait++;
+ StallPpi->Stall (PeiServices, StallPpi, STALL_ONE_MILLI_SECOND);
+ Vc0Pending = ((MmPci16 (0, PegBus, PegDev, PegFunc, R_SA_PEG_VC0RSTS_OFFSET)) >> 1) & 0x1;
+ }
+ DEBUG ((EFI_D_INFO, "PEG%x%x (%x:%x:%x) - VC0 Negotiation Pending = %x after %d msec.\n",
+ PegDev, PegFunc, PegBus, PegDev, PegFunc, Vc0Pending, MsecWait));
+ }
+}
+
+VOID
+GracefulLinkStatusStall (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_STALL_PPI *StallPpi,
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi,
+ IN SA_DATA_HOB *SaDataHob,
+ IN UINT8 HwStrap
+ )
+/**
+ If we have a record of links that did not train from last boot, then do not stall for them
+ For links that did train last boot, stall until they train or 100ms pass
+
+ @param[in] PeiServices - Pointer to the PEI services table
+ @param[in] StallPpi - Pointer to PEI_STALL_PPI
+ @param[in] SaPlatformPolicyPpi - Pointer to SA_PLATFORM_POLICY_PPI
+ @param[in] SaDataHob - Pointer to SA_DATA_HOB
+ @param[in] HwStrap - HwStrap configuration from FUSESCMN
+
+ @retval None
+**/
+{
+ UINT8 LinkStatusGood;
+ UINT8 PegLinkFailMask;
+ UINT8 i;
+ UINT8 PegDev;
+ UINT8 PegFunc;
+ UINT8 CurrentPegFuncBit;
+ UINT8 SkipFuncMask;
+ EFI_STATUS Status;
+ EFI_BOOT_MODE BootMode;
+
+ PegLinkFailMask = 0;
+ ///
+ /// If this is S3 Resume or Warm Boot, check if PEG delay can be skipped when no PEG devices populated.
+ ///
+ Status = (*PeiServices)->GetBootMode (PeiServices, &BootMode);
+ ASSERT_EFI_ERROR (Status);
+ if ((BootMode == BOOT_ON_S3_RESUME) || (GetPchPmStatus (WarmBoot) == TRUE)) {
+ if ((SaDataHob != NULL) && (SaDataHob->PegDataValid)) {
+ if (SaDataHob->PegData.PegLinkFailMask != 0) {
+ PegLinkFailMask = SaDataHob->PegData.PegLinkFailMask;
+ DEBUG ((EFI_D_INFO, "Previous Link Training Fail Mask 0x%2.2X\n", SaDataHob->PegData.PegLinkFailMask));
+ } else {
+ PegLinkFailMask = 0xFF;
+ for (i = 0; i < SA_PEG_MAX_FUN; i++) {
+ PegLinkFailMask &= (UINT8) ~(0x1 << i);
+ }
+ }
+ }
+ }
+ DEBUG ((EFI_D_INFO, "New Link Training Fail Mask 0x%2.2X\n", PegLinkFailMask));
+
+ switch (HwStrap) {
+ case SA_PEG_x16_x0_x0:
+ SkipFuncMask = BIT2 | BIT1;
+ break;
+
+ case SA_PEG_x8_x8_x0:
+ SkipFuncMask = BIT2;
+ break;
+
+ default:
+ case SA_PEG_x8_x4_x4:
+ SkipFuncMask = 0;
+ break;
+ }
+
+ LinkStatusGood = 0;
+ PegDev = 1;
+ for (i = 0; i < 100; i++) {
+ ///
+ /// Poll endpoints
+ /// Skip endpoints that failed last boot
+ /// Skip endpoints that trained good this boot
+ /// Loop in 1-ms increments until all endpoints are:
+ /// reported bad from last boot, or
+ /// have trained good on this boot
+ ///
+ for (PegFunc = 0, CurrentPegFuncBit = 1; PegFunc < SA_PEG_MAX_FUN; PegFunc++, CurrentPegFuncBit <<= 1) {
+ if (CurrentPegFuncBit == (CurrentPegFuncBit & SkipFuncMask)) {
+ if (i == 0) {
+ DEBUG ((EFI_D_INFO, " PEG%x%x (%x:%x:%x) - skipping due to furcation\n", PegDev, PegFunc, SA_PEG_BUS_NUM, PegDev, PegFunc));
+ }
+ continue;
+ }
+ ///
+ /// If configuration change, then break out of loop.
+ /// Test if current PEG is neither in fail mask nor previously tested good.
+ ///
+ if (CurrentPegFuncBit != (CurrentPegFuncBit & (UINT8) (PegLinkFailMask | LinkStatusGood))) {
+ DEBUG ((EFI_D_INFO, " PEG%x%x (%x:%x:%x) - checking\n", PegDev, PegFunc, SA_PEG_BUS_NUM, PegDev, PegFunc));
+ ///
+ /// VC negotiation is complete
+ ///
+ if ((BIT1 & MmPci16(0, SA_PEG_BUS_NUM, PegDev, PegFunc, R_SA_PEG_VC0RSTS_OFFSET)) != BIT1) {
+ DEBUG ((EFI_D_INFO, " VC negotiation is complete\n"));
+ ///
+ /// Record as a good link
+ ///
+ LinkStatusGood |= CurrentPegFuncBit;
+ }
+ }
+ }
+ ///
+ /// If all links accounted for, then exit.
+ ///
+ if (((UINT8) (LinkStatusGood | PegLinkFailMask | SkipFuncMask)) == 0xFF) {
+ break;
+ }
+ StallPpi->Stall (PeiServices, StallPpi, STALL_ONE_MILLI_SECOND);
+ } ///< End of stall loop
+
+ DEBUG ((EFI_D_INFO, "Total Stall: %d msec\n", i));
+ if (SaDataHob != NULL) {
+ SaDataHob->PegData.PegLinkFailMask = (UINT8) ~LinkStatusGood;
+ DEBUG ((EFI_D_INFO, "Returned PegLinkFailMask 0x%2.2X\n", SaDataHob->PegData.PegLinkFailMask));
+ }
+
+}
+
+UINT32
+PcieFindCapId (
+ IN UINT8 Bus,
+ IN UINT8 Device,
+ IN UINT8 PegFunc,
+ IN UINT8 CapId
+ )
+/**
+ Find the Offset to a given Capabilities ID
+ CAPID list:
+ 0x01 = PCI Power Management Interface
+ 0x04 = Slot Identification
+ 0x05 = MSI Capability
+ 0x10 = PCI Express Capability
+
+ @param[in] Bus - Pci Bus Number
+ @param[in] Device - Pci Device Number
+ @param[in] PegFunc - Pci Function Number
+ @param[in] CapId - CAPID to search for
+
+ @retval 0 - CAPID not found
+ @retval Other - CAPID found, Offset of desired CAPID
+**/
+{
+ UINT8 CapHeader;
+
+ ///
+ /// Always start at Offset 0x34
+ ///
+ CapHeader = MmPci8 (0, Bus, Device, PegFunc, PCI_CAPBILITY_POINTER_OFFSET);
+ if (CapHeader == 0xFF) {
+ return 0;
+ }
+
+ while (CapHeader != 0) {
+ ///
+ /// Bottom 2 bits of the pointers are reserved per PCI Local Bus Spec 2.2
+ ///
+ CapHeader &= ~(BIT1 | BIT0);
+ ///
+ /// Search for desired CapID
+ ///
+ if (MmPci8 (0, Bus, Device, PegFunc, CapHeader) == CapId) {
+ return CapHeader;
+ }
+
+ CapHeader = MmPci8 (0, Bus, Device, PegFunc, CapHeader + 1);
+ }
+
+ return 0;
+}
+
+
+VOID
+SetLoadBus (
+ IN UINT32 DmiBar,
+ IN UINTN Dev,
+ IN UINTN Lane,
+ IN UINT32 LoadSel,
+ IN UINT32 LoadData,
+ IN UINT8 CpuSteppingId
+ )
+/**
+ Set Load Bus
+
+ @param[in] DmiBar - DMIBAR address
+ @param[in] Dev - Device Number
+ @param[in] Lane - Number of Lane
+ @param[in] LoadSel - Load selection value
+ @param[in] LoadData - Load Data
+ @param[in] CpuSteppingId - CPUID.1.EAX[3:0], CPU stepping ID
+
+ @retval None
+**/
+{
+ UINT32 lbcvalue;
+ UINT32 lbcdata;
+ UINT32 lbclnsel;
+ UINT32 lbcldsel;
+ UINT32 lbcaddr;
+
+ lbcaddr = R_SA_PEG_LOADBUSCTL0_OFFSET + BUNDLE_STEP * (Lane >> 1);
+ lbcvalue = 0x70000000;
+
+ lbclnsel = ((Lane & 1) == 0) ? 0x80000 : 0x100000;
+ lbcldsel = (LoadSel & 0x3f) << 21;
+ lbcdata = (LoadData << 1) & 0x7FFF;
+
+ lbcvalue = lbcvalue | lbclnsel | lbcldsel | lbcdata;
+
+ if (Dev == 0) {
+ Mmio32 (DmiBar, lbcaddr) = lbcvalue;
+ } else {
+ MmPci32 (0, SA_PEG_BUS_NUM, Dev, SA_PEG10_FUN_NUM, lbcaddr) = lbcvalue;
+ }
+
+ return;
+}
+
+UINT32
+GetMonBus (
+ IN UINT32 DmiBar,
+ IN UINTN Dev,
+ IN UINTN Lane,
+ IN UINT32 LoadSel,
+ IN UINT8 CpuSteppingId
+ )
+/**
+ Get monitor bus from the lane selected
+
+ @param[in] DmiBar - DMIBAR address
+ @param[in] Dev - Device number
+ @param[in] Lane - Number of Lane
+ @param[in] LoadSel - Load selection value
+ @param[in] LoadData - Load selecttion data
+ @param[in] CpuSteppingId - CPUID.1.EAX[3:0], CPU stepping ID
+
+ @retval UINT32 - Load bus address
+**/
+{
+ UINT32 monvalue;
+ UINT32 prevalue;
+ UINT32 lbclnsel;
+ UINT32 lbcldsel;
+ UINT32 lbcaddr;
+ UINT32 Result;
+
+ lbcaddr = R_SA_PEG_LOADBUSCTL0_OFFSET + BUNDLE_STEP * (Lane >> 1);
+ monvalue = 0x068008000;
+
+ if (Dev == 0) {
+ prevalue = Mmio32 (DmiBar, lbcaddr);
+ } else {
+ prevalue = MmPci32 (0, SA_PEG_BUS_NUM, Dev, SA_PEG10_FUN_NUM, lbcaddr);
+ }
+ monvalue = monvalue | (prevalue & 0x7FFE);
+
+ lbclnsel = ((Lane & 1) == 0) ? 0x80000 : 0x100000;
+ lbcldsel = (LoadSel & 0x3f) << 21;
+ monvalue = monvalue | lbclnsel | lbcldsel;
+
+ if (Dev == 0) {
+ Mmio32 (DmiBar, lbcaddr) = monvalue;
+ Result = Mmio32 (DmiBar, lbcaddr);
+ } else {
+ MmPci32 (0, SA_PEG_BUS_NUM, Dev, SA_PEG10_FUN_NUM, lbcaddr) = monvalue;
+ Result = MmPci32 (0, SA_PEG_BUS_NUM, Dev, SA_PEG10_FUN_NUM, lbcaddr);
+ }
+
+ return (Result >> 1) & 0x3FFF;
+}
+
+VOID
+ProgramPreset (
+ IN UINT8 Direction,
+ IN UINT8 PresetValue,
+ IN UINT8 PegFunc,
+ IN UINT8 Lane
+ )
+/**
+ Program PEG Gen3 preset value
+
+ @param[in] Direction - 0 = Root Port, 1 = End Point
+ @param[in] PresetValue - Preset value to program
+ @param[in] PegFunc - Peg function number to be configured
+ @param[in] Lane - Lane to be configured
+
+ @retval None
+**/
+{
+ UINT32 Data32Or;
+ UINT32 Data32And;
+ UINT8 OriginalLane;
+
+ OriginalLane = Lane;
+ switch (PegFunc) {
+ case 1:
+ if (Lane < 8) {
+ DEBUG ((EFI_D_WARN, "Invalid input to ProgramPreset() function! PegFunc=%d, Lane=%d\n", PegFunc, Lane));
+ return;
+ } else {
+ Lane -= 8;
+ }
+ break;
+ case 2:
+ if (Lane < 12) {
+ DEBUG ((EFI_D_WARN, "Invalid input to ProgramPreset() function! PegFunc=%d, Lane=%d\n", PegFunc, Lane));
+ return;
+ } else {
+ Lane -= 12;
+ }
+ break;
+ default:
+ break;
+ }
+ ///
+ /// RP preset goes to bits [3:0] for even lane and [19:16] for odd lane
+ /// EP preset goes to bits [11:8] for even lane and [27:24] for odd lane
+ ///
+ if (Direction != 0) {
+ if ((Lane % 2) == 0) {
+ Data32And = 0xFFFFF0FF;
+ Data32Or = PresetValue << 8;
+ } else {
+ Data32And = 0xF0FFFFFF;
+ Data32Or = PresetValue << 24;
+ }
+ } else {
+ if (OriginalLane >= 8) {
+ if ((Lane % 2) == 0) {
+ Data32And = 0xFFF0FFFF;
+ Data32Or = PresetValue << 16;
+ } else {
+ Data32And = 0xFFFFFFF0;
+ Data32Or = PresetValue;
+ }
+ } else {
+ if ((Lane % 2) == 0) {
+ Data32And = 0xFFFFFFF0;
+ Data32Or = PresetValue;
+ } else {
+ Data32And = 0xFFF0FFFF;
+ Data32Or = PresetValue << 16;
+ }
+ }
+ }
+
+ MmPci32AndThenOr (0, SA_PEG_BUS_NUM, SA_PEG_DEV_NUM, PegFunc, R_SA_PEG_EQCTL0_1_OFFSET + (Lane / 2) * 4, Data32And, Data32Or);
+
+ return;
+}
+
+VOID
+ProgramPresetPerLane (
+ IN UINT8 *RootPortPreset,
+ IN UINT8 *EndPointPreset,
+ IN UINT8 *EndPointHint,
+ IN UINTN HwStrap
+ )
+/**
+ Program PEG Gen3 preset values per lane
+
+ @param[in] RootPortPreset - Array of root port preset values to program
+ @param[in] EndPointPreset - Array of end point preset values to program
+ @param[in] EndPointHint - Array of end point hint value to program
+ @param[in] HwStrap - HwStrap configuration from FUSESCMN
+
+ @retval None
+**/
+{
+ UINTN i;
+
+ for (i = 0; i < SA_PEG_MAX_LANE; i++) {
+ if (RootPortPreset[i] > 9) {
+ RootPortPreset[i] = 8;
+ }
+ if (EndPointPreset[i] > 9) {
+ EndPointPreset[i] = 7;
+ }
+ if (EndPointHint[i] > 6) {
+ EndPointHint[i] = 2;
+ }
+ }
+
+ ///
+ /// RP preset goes to bits [3:0] and [19:16]
+ /// EP preset goes to bits [11:8] and [27:24]
+ /// EP hint goes to bits [14:12] and [30:28]
+ ///
+ switch (HwStrap) {
+ case SA_PEG_x16_x0_x0:
+ ///
+ /// PEG10 x16
+ ///
+
+ for (i = 0; i < 4; ++i) {
+ McD1PciCfg32AndThenOr (R_SA_PEG_EQCTL0_1_OFFSET + i * 4, 0x80F080F0,
+ RootPortPreset[2 * i] | (EndPointPreset[2 * i] << 8) | (EndPointHint[2 * i] << 12) | (RootPortPreset[2 * i + 1] << 16) | (EndPointPreset[2 * i + 1] << 24) | (EndPointHint[2 * i + 1] << 28));
+ }
+ for (i = 4; i < 8; ++i) {
+ McD1PciCfg32AndThenOr (R_SA_PEG_EQCTL0_1_OFFSET + i * 4, 0x80F080F0,
+ RootPortPreset[2 * i + 1] | (EndPointPreset[2 * i] << 8) | (EndPointHint[2 * i] << 12) | (RootPortPreset[2 * i] << 16) | (EndPointPreset[2 * i + 1] << 24) | (EndPointHint[2 * i + 1] << 28));
+ }
+ break;
+
+ case SA_PEG_x8_x8_x0:
+ ///
+ /// PEG10 x8 / PEG11 x8
+ ///
+ for (i = 0; i < 4; ++i) {
+ McD1PciCfg32AndThenOr (R_SA_PEG_EQCTL0_1_OFFSET + i * 4, 0x80F080F0,
+ RootPortPreset[2 * i] | (EndPointPreset[2 * i] << 8) | (EndPointHint[2 * i] << 12) | (RootPortPreset[2 * i + 1] << 16) | (EndPointPreset[2 * i + 1] << 24) | (EndPointHint[2 * i + 1] << 28));
+ McD1F1PciCfg32AndThenOr (R_SA_PEG_EQCTL0_1_OFFSET + i * 4, 0x80F080F0,
+ RootPortPreset[8 + 2 * i + 1] | (EndPointPreset[8 + 2 * i] << 8) | (EndPointHint[8 + 2 * i] << 12) | (RootPortPreset[8 + 2 * i] << 16) | (EndPointPreset[8 + 2 * i + 1] << 24) | (EndPointHint[8 + 2 * i + 1] << 28));
+ }
+ break;
+
+ case SA_PEG_x8_x4_x4:
+ ///
+ /// PEG10 x8 / PEG11 x4 / PEG12 x4
+ ///
+ for (i = 0; i < 4; ++i) {
+ McD1PciCfg32AndThenOr (R_SA_PEG_EQCTL0_1_OFFSET + i * 4, 0x80F080F0,
+ RootPortPreset[2 * i] | (EndPointPreset[2 * i] << 8) | (EndPointHint[2 * i] << 12) | (RootPortPreset[2 * i + 1] << 16) | (EndPointPreset[2 * i + 1] << 24) | (EndPointHint[2 * i + 1] << 28));
+ }
+ for (i = 0; i < 2; ++i) {
+ McD1F1PciCfg32AndThenOr (R_SA_PEG_EQCTL0_1_OFFSET + i * 4, 0x80F080F0,
+ RootPortPreset[8 + 2 * i + 1] | (EndPointPreset[8 + 2 * i] << 8) | (EndPointHint[8 + 2 * i] << 12) | (RootPortPreset[8 + 2 * i] << 16) | (EndPointPreset[8 + 2 * i + 1] << 24) | (EndPointHint[8 + 2 * i + 1] << 28));
+ McD1F2PciCfg32AndThenOr (R_SA_PEG_EQCTL0_1_OFFSET + i * 4, 0x80F080F0,
+ RootPortPreset[12 + 2 * i + 1] | (EndPointPreset[12 + 2 * i] << 8) | (EndPointHint[12 + 2 * i] << 12) | (RootPortPreset[12 + 2 * i] << 16) | (EndPointPreset[12 + 2 * i + 1] << 24) | (EndPointHint[12 + 2 * i + 1] << 28));
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return;
+}
+
+VOID
+PegGen3Equalization (
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi,
+ IN UINT8 CpuSteppingId,
+ IN UINTN HwStrap
+ )
+/**
+ Perform PEG Gen3 Equalization steps
+
+ @param[in] SaPlatformPolicyPpi - pointer to SA_PLATFORM_POLICY_PPI
+ @param[in] CpuSteppingId - CPUID.1.EAX[3:0], CPU stepping ID
+ @param[in] HwStrap - HwStrap configuration from FUSESCMN
+
+ @retval None
+**/
+{
+ UINT8 *RootPortPreset;
+ UINT8 *EndPointPreset;
+ UINT8 *EndPointHint;
+
+ ///
+ /// Apply static presets for root port and endpoint
+ ///
+ RootPortPreset = SaPlatformPolicyPpi->PcieConfig->Gen3RootPortPreset;
+ EndPointPreset = SaPlatformPolicyPpi->PcieConfig->Gen3EndPointPreset;
+ EndPointHint = SaPlatformPolicyPpi->PcieConfig->Gen3EndPointHint;
+
+ ProgramPresetPerLane (RootPortPreset, EndPointPreset, EndPointHint, HwStrap);
+
+ return;
+}
+
+#endif // PEG_FLAG
+
+#if defined(DMI_FLAG) || defined(PEG_FLAG)
+VOID
+PegDmiRecipe (
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi,
+ IN UINT32 MchBar,
+ IN UINT32 DmiBar,
+ IN UINTN Dev,
+ IN UINT8 SwingControl
+ )
+/**
+ Perform PEG/DMI PCIe Recipe steps
+
+ @param[in] SaPlatformPolicyPpi - Pointer to SA_PLATFORM_POLICY_PPI
+ @param[in] MchBar - MCHBAR or zero if called for PEG
+ @param[in] DmiBar - DMIBAR or zero if called for PEG
+ @param[in] Dev - PEG device number: 1 for PEG10, 0 if called for DMI.
+ @param[in] SwingControl - 1 = Half, 2 = Full
+
+ @retval None
+**/
+{
+ UINTN i;
+ UINTN BundlesCount;
+ UINTN LanesCount;
+ UINT32 Data32;
+ UINT32 Data32And;
+ UINT32 Data32Or;
+ UINT32 VcuAddress;
+ UINT8 VcuReadOp;
+ UINT8 VcuWriteOp;
+ CPU_FAMILY CpuFamilyId;
+ CPU_STEPPING CpuSteppingId;
+ BOOLEAN IsSingleCall;
+
+ CpuFamilyId = GetCpuFamily();
+ CpuSteppingId = GetCpuStepping();
+
+ ///
+ /// With both DMI_FLAG and PEG_FLAG defined, this function is called twice: once for DMI and once for PEG.
+ /// Some registers are shared between DMI and PEG, so they are only programmed during one of the calls.
+ /// If only one flag is defined, this function will only be called once, so the shared registers need to be
+ /// programmed during the first/only call.
+ ///
+ IsSingleCall = TRUE;
+#if defined(DMI_FLAG) && defined(PEG_FLAG)
+ IsSingleCall = FALSE;
+#endif
+
+ if (Dev == SA_PEG_DEV_NUM) {
+ ///
+ /// PEG10
+ ///
+ LanesCount = SA_PEG_MAX_LANE;
+ } else {
+ ///
+ /// DMI
+ ///
+ LanesCount = SA_DMI_MAX_LANE;
+ }
+
+ BundlesCount = LanesCount >> 1;
+
+ ///
+ /// g23rxvref = 0xC (DMI & PEG)
+ ///
+ Data32And = (UINT32) ~(BIT4 | BIT3 | BIT2 | BIT1 | BIT0);
+ Data32Or = 0xC;
+ for (i = 0; i < LanesCount; i++) {
+ SaMmio32AndThenOr (DmiBar, Dev, R_SA_PEG_AFELN0CFG0_OFFSET + i * LANE_STEP, Data32And, Data32Or);
+ }
+ ///
+ /// CDRPDDATMODE = 0x1 (DMI & PEG)
+ ///
+ if ((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId == EnumHswA0)) {
+ for (i = 0; i < LanesCount; i++) {
+ SaMmio32AndThenOr (DmiBar, Dev, R_SA_PEG_AFELN0CFG1_OFFSET + i * LANE_STEP, 0xFFFFFFFF, BIT11);
+ }
+ }
+ ///
+ /// irefctl = 0x2 (PEG only)
+ ///
+ if (DmiBar == 0) {
+ ///
+ /// Switch on
+ /// SwingControl 1 == Half
+ /// 2 == Full (Default)
+ ///
+ switch (SwingControl) {
+ case SA_SWING_HALF:
+ Data32Or = 0x0C;
+ break;
+
+ default:
+ case SA_SWING_FULL:
+ Data32Or = 0x02;
+ break;
+ }
+
+ for (i = 0; i < BundlesCount; i++) {
+ SaMmio32AndThenOr (DmiBar, Dev, R_SA_PEG_AFEBND0CFG1_OFFSET + i * BUNDLE_STEP, (UINT32) ~(0x1F), Data32Or);
+ }
+ }
+ ///
+ /// txvrefsel = 0x3 (PEG only)
+ ///
+ if (DmiBar == 0) {
+ ///
+ /// Switch on
+ /// SwingControl 1 == Half
+ /// 2 == Full (Default)
+ ///
+ switch (SwingControl) {
+ case SA_SWING_HALF:
+ Data32Or = 0x0E;
+ break;
+
+ default:
+ case SA_SWING_FULL:
+ Data32Or = 0x03;
+ break;
+ }
+
+ for (i = 0; i < BundlesCount; i++) {
+ SaMmio32AndThenOr (DmiBar, Dev, R_SA_PEG_AFEBND0CFG1_OFFSET + i * BUNDLE_STEP, (UINT32) ~(0x1F << 5), Data32Or << 5);
+ }
+ }
+ ///
+ /// igacq = 0x0 (HSW A0: DMI & PEG)
+ ///
+ if ((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId == EnumHswA0)) {
+ for (i = 0; i < BundlesCount; i++) {
+ SaMmio32AndThenOr (DmiBar, Dev, R_SA_PEG_AFEBND0CFG1_OFFSET + i * BUNDLE_STEP, (UINT32) ~(7 << 22), 0);
+ }
+ }
+ ///
+ /// dfegainacq = 0x1 (HSW A0: DMI & PEG)
+ ///
+ if ((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId == EnumHswA0)) {
+ for (i = 0; i < BundlesCount; i++) {
+ SaMmio32AndThenOr (DmiBar, Dev, R_SA_PEG_AFEBND0CFG1_OFFSET + i * BUNDLE_STEP, (UINT32) ~(3 << 29), 1 << 29);
+ }
+ }
+ ///
+ /// PGTRK = 0x9 (DMI & PEG)
+ ///
+ Data32And = (UINT32) ~(BIT10 | BIT9 | BIT8 | BIT7 | BIT6 | BIT5);
+ Data32Or = 0x9 << 5;
+ for (i = 0; i < BundlesCount; i++) {
+ SaMmio32AndThenOr (DmiBar, Dev, R_SA_PEG_AFEBND0CFG3_OFFSET + i * BUNDLE_STEP, Data32And, Data32Or);
+ }
+ ///
+ /// igtrk = 0x0 (HSW A0: DMI & PEG)
+ ///
+ if ((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId == EnumHswA0)) {
+ for (i = 0; i < BundlesCount; i++) {
+ SaMmio32AndThenOr (DmiBar, Dev, R_SA_PEG_AFEBND0CFG3_OFFSET + i * BUNDLE_STEP, (UINT32) ~(7 << 17), 0);
+ }
+ }
+ ///
+ /// RXRTBIN = 0x5 (PEG only)
+ ///
+ if (DmiBar == 0) {
+ Data32And = (UINT32) ~(BIT24 | BIT23 | BIT22 | BIT21);
+ Data32Or = 0x5 << 21;
+ for (i = 0; i < BundlesCount; i++) {
+ SaMmio32AndThenOr (DmiBar, Dev, R_SA_PEG_AFEBND0CFG3_OFFSET + i * BUNDLE_STEP, Data32And, Data32Or);
+ }
+ }
+ ///
+ /// G3RXCTLEPEAK = 0x8 (PEG only)
+ ///
+ if (DmiBar == 0) {
+ Data32And = (UINT32) ~(BIT9 | BIT8 | BIT7 | BIT6);
+ for (i = 0; i < BundlesCount; i++) {
+ if (SaPlatformPolicyPpi->Revision >= SA_PLATFORM_POLICY_PPI_REVISION_3) {
+ Data32Or = SaPlatformPolicyPpi->PcieConfig->Gen3RxCtleP[i] << 6;
+ } else {
+ Data32Or = 8 << 6;
+ }
+ SaMmio32AndThenOr (DmiBar, Dev, R_SA_PEG_AFEBND0CFG4_OFFSET + i * BUNDLE_STEP, Data32And, Data32Or);
+ }
+ }
+ ///
+ /// g2rxctlepeak = 0x0 (DMI & PEG)
+ ///
+ for (i = 0; i < BundlesCount; i++) {
+ SaMmio32AndThenOr (DmiBar, Dev, R_SA_PEG_AFEBND0CFG4_OFFSET + i * BUNDLE_STEP, (UINT32) ~(0xF << 10), 0);
+ }
+ ///
+ /// AFEBNDSPARE[uneqmm] = 0x4 (HSW == A0: DMI & PEG)
+ ///
+ if ((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId == EnumHswA0)) {
+ for (i = 0; i < BundlesCount; i++) {
+ SaMmio32AndThenOr (DmiBar, Dev, R_SA_PEG_AFEBND0CFG4_OFFSET + i * BUNDLE_STEP, (UINT32) ~(7 << 29), 4 << 29);
+ }
+ }
+ ///
+ /// AGCACQLEN = 0x2 (HSW == A0: DMI & PEG)
+ ///
+ if ((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId == EnumHswA0)) {
+ for (i = 0; i < BundlesCount; i++) {
+ SaMmio32AndThenOr (DmiBar, Dev, R_SA_PEG_AFEBND0CFG5_OFFSET + i * BUNDLE_STEP, (UINT32) ~(3 << 7), 2 << 7);
+ }
+ }
+ ///
+ /// G2DFEC1CTL = 0x0 (HSW == A0: DMI & PEG)
+ ///
+ if ((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId == EnumHswA0)) {
+ for (i = 0; i < BundlesCount; i++) {
+ SaMmio32AndThenOr (DmiBar, Dev, R_SA_PEG_AFEBND0CFG5_OFFSET + i * BUNDLE_STEP, (UINT32) ~(3 << 12), 0);
+ }
+ }
+ ///
+ /// RXSQEXCTL = 0x0 (DMI & PEG)
+ ///
+ Data32And = (UINT32) ~(BIT20 | BIT19 | BIT18);
+ Data32Or = 0;
+ for (i = 0; i < BundlesCount; i++) {
+ SaMmio32AndThenOr (DmiBar, Dev, R_SA_PEG_AFEBND0CFG5_OFFSET + i * BUNDLE_STEP, Data32And, Data32Or);
+ }
+ ///
+ /// dfemfc = 0x3 (HSW == A0: DMI & PEG)
+ ///
+ if ((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId == EnumHswA0)) {
+ for (i = 0; i < BundlesCount; i++) {
+ SaMmio32AndThenOr (DmiBar, Dev, R_SA_PEG_AFEBND0CFG5_OFFSET + i * BUNDLE_STEP, (UINT32) ~(3 << 21), 3 << 21);
+ }
+ }
+
+ ///
+ /// ICOMPGAIN = 0x6 (HSW == A0: DMI & PEG)
+ ///
+ if ((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId == EnumHswA0)) {
+ VcuAddress = R_SA_VCU_AFECMNCFG0_ADDRESS_REV1;
+ VcuReadOp = V_SA_VCU_OPCODE_READ_MMIO_REV1;
+ VcuWriteOp = V_SA_VCU_OPCODE_WRITE_MMIO_REV1;
+ } else {
+ VcuAddress = R_SA_VCU_AFECMNCFG0_ADDRESS_REV2;
+ VcuReadOp = V_SA_VCU_OPCODE_READ_MMIO_REV2;
+ VcuWriteOp = V_SA_VCU_OPCODE_WRITE_MMIO_REV2;
+ }
+
+ if ((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId == EnumHswA0)) {
+ if ((DmiBar != 0) || (IsSingleCall)) {
+ Data32 = SendVcuApiSequence (MchBar, VcuAddress, VcuReadOp, 0);
+ Data32 &= (UINT32) ~(BIT12 | BIT11 | BIT10 | BIT9);
+ Data32 |= 0x6 << 9;
+ SendVcuApiSequence (MchBar, VcuAddress, VcuWriteOp, Data32);
+ }
+ }
+
+ ///
+ /// PEGVCMSEL = 0x3 (PEG only)
+ ///
+ if (DmiBar == 0) {
+ Data32 = SendVcuApiSequence (MchBar, VcuAddress, VcuReadOp, 0);
+ Data32 &= (UINT32) ~(BIT29 | BIT28 | BIT27 | BIT26 | BIT25);
+ ///
+ /// Switch on
+ /// SwingControl 1 == Half
+ /// 2 == Full (Default)
+ ///
+ switch (SwingControl) {
+ case SA_SWING_HALF:
+ Data32 |= (UINT32) (0x0E << 25);
+ break;
+
+ default:
+ case SA_SWING_FULL:
+ Data32 |= (UINT32) (0x03 << 25);
+ break;
+ }
+ SendVcuApiSequence (MchBar, VcuAddress, VcuWriteOp, Data32);
+ }
+
+ ///
+ /// PH3EQFFEKNOBS = 0x8 (DMI & PEG)
+ ///
+ if ((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId == EnumHswA0)) {
+ VcuAddress = R_SA_VCU_AFECMNCFG2_ADDRESS_REV1;
+ } else {
+ VcuAddress = R_SA_VCU_AFECMNCFG2_ADDRESS_REV2;
+ }
+
+ if ((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId == EnumHswA0)) {
+ if ((DmiBar != 0) || (IsSingleCall)) {
+ Data32 = SendVcuApiSequence (MchBar, VcuAddress, VcuReadOp, 0);
+ Data32 &= (UINT32) ~(BIT30 | BIT29 | BIT28 | BIT27 | BIT26 | BIT25);
+ Data32 |= 0x8 << 25;
+ SendVcuApiSequence (MchBar, VcuAddress, VcuWriteOp, Data32);
+ }
+ }
+
+ ///
+ /// FIXUNCORRDATA = 0x0 (DMI & PEG)
+ ///
+ if ((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId == EnumHswA0)) {
+ VcuAddress = R_SA_VCU_AFECMNCFG3_ADDRESS_REV1;
+ } else {
+ VcuAddress = R_SA_VCU_AFECMNCFG3_ADDRESS_REV2;
+ }
+
+ if ((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId == EnumHswA0)) {
+ if ((DmiBar != 0) || (IsSingleCall)) {
+ Data32 = SendVcuApiSequence (MchBar, VcuAddress, VcuReadOp, 0);
+ Data32 &= (UINT32) ~(BIT20);
+ Data32 |= 0;
+ SendVcuApiSequence (MchBar, VcuAddress, VcuWriteOp, Data32);
+ }
+ }
+ ///
+ /// BLEGCTL = 0x0 (DMI & PEG)
+ ///
+ if ((DmiBar != 0) || (IsSingleCall)) {
+ Data32 = SendVcuApiSequence (MchBar, VcuAddress, VcuReadOp, 0);
+ Data32 &= (UINT32) ~(BIT28 | BIT27 | BIT26 | BIT25 | BIT24 | BIT23);
+ Data32 |= 0;
+ SendVcuApiSequence (MchBar, VcuAddress, VcuWriteOp, Data32);
+ }
+ if (((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId == EnumHswA0)) &&
+ ((DmiBar != 0) || (IsSingleCall) )) {
+ VcuAddress = R_SA_VCU_AFECMNCFG7_ADDRESS_REV1;
+ VcuReadOp = V_SA_VCU_OPCODE_READ_CSR_REV1;
+ VcuWriteOp = V_SA_VCU_OPCODE_WRITE_CSR_REV1;
+
+ Data32 = SendVcuApiSequence (MchBar, VcuAddress, VcuReadOp, 0);
+ ///
+ /// VREFRXDET = 0x19 (PEG only)
+ ///
+ if ((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId == EnumHswA0)) {
+ Data32 &= (UINT32) ~(BIT18 | BIT17 | BIT16 | BIT15 | BIT14);
+ Data32 |= 0x19 << 14;
+ }
+ ///
+ /// DFEFIX = 0x4 (PEG only)
+ ///
+ if ((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId == EnumHswA0)) {
+ Data32 &= (UINT32) ~(BIT30 | BIT29 | BIT28);
+ Data32 |= 0x4 << 28;
+ }
+ SendVcuApiSequence (MchBar, VcuAddress, VcuWriteOp, Data32);
+ }
+
+
+ ///
+ /// RXDETECT_SAMPLE_TIME = 0x4 (PEG only)
+ ///
+ if ((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId == EnumHswA0)) {
+ if (DmiBar == 0) {
+ Data32And = (UINT32) ~(BIT14 | BIT13 | BIT12 | BIT11 | BIT10 | BIT9 | BIT8 | BIT7);
+ Data32Or = 0x4 << 7;
+ SaMmio32AndThenOr (DmiBar, Dev, R_SA_PEG_AFE_PWRON_OFFSET, Data32And, Data32Or);
+ }
+ }
+
+ ///
+ /// RXL0S_ENTRY_EXIT_TIMER = 0x00 (HSW == A0: DMI & PEG)
+ /// = 0x13 (HSW >= B0: DMI & PEG)
+ ///
+ Data32And = (UINT32) ~(BIT4 | BIT3 | BIT2 | BIT1 | BIT0);
+ if ((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId == EnumHswA0)) {
+ Data32Or = 0x00;
+ } else {
+ Data32Or = 0x13;
+ }
+ SaMmio32AndThenOr (DmiBar, Dev, R_SA_PEG_AFE_PM_TMR_OFFSET, Data32And, Data32Or);
+
+ ///
+ /// Set 0xC38[6] = 0x1 (HSW == A0), 0x0 (HSW >= B0) (DMI & PEG)
+ ///
+ Data32And = (UINT32) ~(BIT6);
+ if ((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId == EnumHswA0)) {
+ Data32Or = 0x1 << 6;
+ } else {
+ Data32Or = 0x0 << 6;
+ }
+ if (DmiBar == 0) {
+ McD1PciCfg16AndThenOr (R_SA_PEG_CMNSPARE_OFFSET, Data32And, Data32Or);
+ McD1F1PciCfg16AndThenOr (R_SA_PEG_CMNSPARE_OFFSET, Data32And, Data32Or);
+ McD1F2PciCfg16AndThenOr (R_SA_PEG_CMNSPARE_OFFSET, Data32And, Data32Or);
+ } else {
+ Mmio32AndThenOr (DmiBar, R_SA_DMIBAR_CMNSPARE_OFFSET, Data32And, Data32Or);
+ }
+
+ ///
+ /// Set 0x260[1:0] = '10b' (DMI & PEG)
+ ///
+ Data32And = (UINT32) ~(BIT1 | BIT0);
+ Data32Or = 0x2;
+ if (DmiBar == 0) {
+ McD1PciCfg16AndThenOr (R_SA_PEG_CFG6_OFFSET, Data32And, Data32Or);
+ McD1F1PciCfg16AndThenOr (R_SA_PEG_CFG6_OFFSET, Data32And, Data32Or);
+ McD1F2PciCfg16AndThenOr (R_SA_PEG_CFG6_OFFSET, Data32And, Data32Or);
+ } else {
+ Mmio32AndThenOr (DmiBar, R_SA_DMIBAR_CFG6_OFFSET, Data32And, Data32Or);
+ }
+
+ ///
+ /// setdfelsbsel = 0
+ ///
+ for (i = 0; i < BundlesCount; i++) {
+ SaMmio32AndThenOr (DmiBar, Dev, R_SA_PEG_AFEBND0CFG0_OFFSET + i * BUNDLE_STEP, (UINT32) ~(3 << 26), 0);
+ }
+ ///
+ /// OFFCORGAIN = 0x3 (HSW >= A0)
+ ///
+ for (i = 0; i < BundlesCount; i++) {
+ SaMmio32AndThenOr (DmiBar, Dev, R_SA_PEG_AFEBND0CFG1_OFFSET + i * BUNDLE_STEP, (UINT32) ~(3 << 10), 3 << 10);
+ }
+
+ ///
+ /// fixtxrtermoffset = -3; (PEG only)
+ ///
+ if (DmiBar == 0) {
+ for (i = 0; i < BundlesCount; i++) {
+ SaMmio32AndThenOr (DmiBar, Dev, R_SA_PEG_AFEBND0CFG3_OFFSET + i * BUNDLE_STEP, (UINT32) ~(0x1F << 25), ((0x03 << 1) | 0x01) << 25);
+ }
+ }
+
+ ///
+ /// Set BND0SPARE[29:27] = '101b' (PEG)
+ ///
+ Data32And = (UINT32) ~(BIT29 | BIT28 | BIT27);
+ Data32Or = (UINT32) 0x28000000;
+ for (i = 0; i < BundlesCount; i++) {
+ MmPci32AndThenOr (
+ 0,
+ SA_PEG_BUS_NUM,
+ SA_PEG10_DEV_NUM,
+ SA_PEG10_FUN_NUM,
+ R_SA_PEG_BND0SPARE_OFFSET + (i * BUNDLE_STEP),
+ Data32And,
+ Data32Or
+ );
+ }
+ return;
+}
+#endif // DMI_FLAG || PEG_FLAG
+
+#ifdef PEG_FLAG
+VOID
+BubbleSort (
+ IN OUT DATA_SAMPLE Array[]
+ )
+/**
+ Bubble sort from DATA_SAMPLE
+
+ @param[in, out] - Array[]: array of DATA_SAMPLE
+
+ @retval None
+**/
+{
+ UINTN n;
+ UINTN i;
+ UINTN j;
+ DATA_SAMPLE Temp;
+
+ n = (UINTN) Array[0].Count;
+
+ for (i = 1; i <= n; i++) {
+ for (j = n; j > i; j--) {
+ if (Array[j - 1].Data > Array[j].Data) {
+ Temp = Array[j - 1];
+ Array[j - 1] = Array[j];
+ Array[j] = Temp;
+ }
+ }
+ }
+
+ return;
+}
+
+UINT32
+GetMiddleValue (
+ IN OUT DATA_SAMPLE Array[]
+ )
+/**
+ Get Middle Value from DATA_SAMPLE
+
+ @param[in, out] - Array[]: array of DATA_SAMPLE
+
+ @retval UINT32 : Middle Value of DATA_SAMPLE
+**/
+{
+ UINT32 n;
+
+ n = Array[0].Count;
+
+ return Array[n / 2 + 1].Data;
+}
+
+#ifdef EFI_DEBUG
+VOID
+DumpSamplerValues (
+ IN UINT32 DmiBar,
+ IN UINT8 CpuSteppingId,
+ IN UINTN Dev,
+ IN UINTN LanesCount
+ )
+/**
+ Dump Sampler Values
+
+ @param[in] DmiBar - DMIBAR address
+ @param[in] CpuSteppingId - CPUID.1.EAX[3:0], CPU stepping ID
+ @param[in] Dev - Device number
+ @param[in] LanesCount - Value of Lanes
+
+ @retval None
+**/
+{
+ UINTN Lane;
+ UINT32 Sampler;
+ UINT8 SampleData;
+
+ DEBUG ((EFI_D_INFO, "Lane DS0 DS1 ESP0 ESP1 ESM0 ESM1\n"));
+ for (Lane = 0; Lane < LanesCount; Lane++) {
+ DEBUG ((EFI_D_INFO, "%2d: ", Lane));
+ for (Sampler = 0; Sampler < 6; Sampler++) {
+ SampleData = GetMonBus (DmiBar, Dev, Lane, 0x31 + Sampler, CpuSteppingId) & 0x3F;
+ DEBUG ((EFI_D_INFO, "%02X ", SampleData));
+ }
+
+ DEBUG ((EFI_D_INFO, "\n"));
+ }
+
+ return;
+}
+#endif // EFI_DEBUG
+
+VOID
+SamplerCalibratePegPort (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_STALL_PPI *StallPpi,
+ IN UINT8 CpuSteppingId,
+ IN UINTN Dev,
+ IN UINTN LanesCount,
+ IN UINTN HwStrap
+ )
+/**
+ This function performs the PEG Sampler Calibration for HSW on a given PEG controller
+ It also calls the Step 2 of PEG Recipe routine.
+
+ @param[in] PeiServices - Pointer to the PEI services table
+ @param[in] StallPpi - pointer to PEI_STALL_PPI
+ @param[in] CpuSteppingId - CPUID.1.EAX[3:0], CPU stepping ID
+ @param[in] Dev - Device number
+ @param[in] LanesCount - Value of Lanes
+ @param[in] HwStrap - HwStrap configuration from FUSESCMN
+
+ @retval None
+**/
+{
+ UINTN Iteration;
+ UINTN PegSamplerIterations;
+ UINTN Lane;
+ UINTN i;
+ BOOLEAN Peg11Present;
+ BOOLEAN Peg12Present;
+ BOOLEAN EarlyExit;
+ BOOLEAN CodeFound;
+ UINT8 SampleData;
+ UINT32 Sampler;
+ UINT16 CodesFound;
+ UINT32 MiddleCode;
+ UINTN OcDelay;
+
+ ///
+ /// Array of sampling data - 16 lanes max, 6 samplers per lane, up to MAX_CODES per sampler
+ /// Size is 3 * 16 * 6 * 11 = 3168 bytes
+ ///
+ DATA_SAMPLE SampleArray[16][6][MAX_CODES + 1];
+
+ PegSamplerIterations = SA_PEG_SAMPLER_ITERATIONS;
+ Peg11Present = FALSE;
+ Peg12Present = FALSE;
+
+ if (LanesCount == 16) {
+ OcDelay = 10;
+ } else {
+ OcDelay = 20;
+ }
+
+ ZeroMem (&SampleArray, sizeof (SampleArray));
+
+ if (HwStrap == SA_PEG_x8_x8_x0) {
+ Peg11Present = TRUE;
+ }
+
+
+ if (HwStrap == SA_PEG_x8_x4_x4) {
+ Peg11Present = TRUE;
+ Peg12Present = TRUE;
+ }
+ ///
+ /// Dump the Sampler values before calibration
+ ///
+ DEBUG ((EFI_D_INFO, "--- Sampler values before calibration ---\n"));
+#ifdef EFI_DEBUG
+ DumpSamplerValues (0, CpuSteppingId, Dev, LanesCount);
+#endif // EFI_DEBUG
+ ///
+ /// Disable the link
+ ///
+ MmPci16Or (0, SA_PEG_BUS_NUM, Dev, 0, R_SA_PEG_LCTL_OFFSET, BIT4);
+ if (Peg11Present) {
+ MmPci16Or (0, SA_PEG_BUS_NUM, Dev, 1, R_SA_PEG_LCTL_OFFSET, BIT4);
+ }
+ if (Peg12Present) {
+ MmPci16Or (0, SA_PEG_BUS_NUM, Dev, 2, R_SA_PEG_LCTL_OFFSET, BIT4);
+ }
+
+ ///
+ /// Delay 10 ms after link disable
+ ///
+ StallPpi->Stall (PeiServices, StallPpi, 10 * STALL_ONE_MILLI_SECOND);
+
+ ///
+ /// Override L0s and L1 - set bits 11, 13 & 15 of AFEOVR
+ ///
+ MmPci32Or (0, SA_PEG_BUS_NUM, Dev, 0, R_SA_PEG_AFEOVR_OFFSET, 0xA800);
+ if (Peg11Present) {
+ MmPci32Or (0, SA_PEG_BUS_NUM, Dev, 1, R_SA_PEG_AFEOVR_OFFSET, 0xA800);
+ }
+ if (Peg12Present) {
+ MmPci32Or (0, SA_PEG_BUS_NUM, Dev, 2, R_SA_PEG_AFEOVR_OFFSET, 0xA800);
+ }
+
+ for (Iteration = 0; Iteration < PegSamplerIterations; Iteration++) {
+ PostCode ((UINT8) (Iteration / 100));
+ ///
+ /// First trigger OC on each lane
+ ///
+ for (Lane = 0; Lane < LanesCount; Lane++) {
+ SetLoadBus (0, Dev, Lane, 0x39, 0x1, CpuSteppingId);
+ SetLoadBus (0, Dev, Lane, 0x3A, 0xC, CpuSteppingId);
+ }
+ ///
+ /// Delay to give the OC time to complete
+ ///
+ StallPpi->Stall (PeiServices, StallPpi, OcDelay * STALL_ONE_MICRO_SECOND);
+
+ for (Lane = 0; Lane < LanesCount; Lane++) {
+ for (Sampler = 0; Sampler < 6; Sampler++) {
+ SampleData = GetMonBus (0, Dev, Lane, 0x31 + Sampler, CpuSteppingId) & 0x3F;
+
+ ///
+ /// SampleArray[Lane][Sampler][0].Count holds the number of distinct codes found so far
+ ///
+ CodeFound = FALSE;
+ for (i = 1; i <= SampleArray[Lane][Sampler][0].Count; ++i) {
+ if (SampleArray[Lane][Sampler][i].Data == SampleData) {
+ CodeFound = TRUE;
+ SampleArray[Lane][Sampler][i].Count++;
+ break;
+ }
+ }
+
+ if (!CodeFound) {
+ if (i > MAX_CODES) {
+ DEBUG ((EFI_D_ERROR, "ERROR: PEG dev=%d, lane=%d, sampler=%d, iteration=%d, found more than %d distinct codes!!!\n", Dev, Lane, Sampler, Iteration, MAX_CODES));
+ if (LanesCount == 16) {
+ PostCode ((UINT8) (ERROR_BY_16 >> 8));
+ } else {
+ PostCode ((UINT8) (ERROR_NOT_BY_16 >> 8));
+ }
+
+ EFI_DEADLOOP ();
+ }
+ ///
+ /// Increment the number of distinct codes found for this sampler
+ ///
+ SampleArray[Lane][Sampler][0].Count++;
+
+ ///
+ /// Save the new code
+ ///
+ SampleArray[Lane][Sampler][i].Data = SampleData;
+ SampleArray[Lane][Sampler][i].Count = 1;
+ }
+ }
+ }
+ ///
+ /// Exit early if all the sampled lanes have more than 5 codes,
+ /// and we covered at least 20% of iterations.
+ /// Ignore the inactive lanes, these will only show one code.
+ ///
+ if (Iteration > PegSamplerIterations / 5) {
+ EarlyExit = TRUE;
+ for (Lane = 0; Lane < LanesCount; Lane++) {
+ for (Sampler = 0; Sampler < 6; Sampler++) {
+ CodesFound = SampleArray[Lane][Sampler][0].Count;
+ if ((CodesFound > 1) && (CodesFound < 5)) {
+ EarlyExit = FALSE;
+ break;
+ }
+ }
+
+ if (!EarlyExit) {
+ break;
+ }
+ }
+
+ if (EarlyExit) {
+ break;
+ }
+ }
+ }
+ ///
+ /// Iteration
+ ///
+ for (Lane = 0; Lane < LanesCount; Lane++) {
+ for (Sampler = 0; Sampler < 6; Sampler++) {
+ ///
+ /// Sort the codes for this Lane / Sampler
+ ///
+ BubbleSort (SampleArray[Lane][Sampler]);
+ ///
+ /// Find the middle value
+ ///
+ MiddleCode = GetMiddleValue (SampleArray[Lane][Sampler]);
+ ///
+ /// Set the middle calibration code
+ ///
+ SetLoadBus (0, Dev, Lane, 0x31 + Sampler, MiddleCode, CpuSteppingId);
+ }
+ }
+ ///
+ /// Restore AFEOVR
+ ///
+ MmPci32 (0, SA_PEG_BUS_NUM, Dev, 0, R_SA_PEG_AFEOVR_OFFSET) = 0;
+ if (Peg11Present) {
+ MmPci32 (0, SA_PEG_BUS_NUM, Dev, 1, R_SA_PEG_AFEOVR_OFFSET) = 0;
+ }
+ if (Peg12Present) {
+ MmPci32 (0, SA_PEG_BUS_NUM, Dev, 2, R_SA_PEG_AFEOVR_OFFSET) = 0;
+ }
+ ///
+ /// Delay 1 ms before link enable
+ ///
+ StallPpi->Stall (PeiServices, StallPpi, STALL_ONE_MILLI_SECOND);
+
+ ///
+ /// Enable the link
+ ///
+ MmPci16And (0, SA_PEG_BUS_NUM, Dev, 0, R_SA_PEG_LCTL_OFFSET, ~BIT4);
+ if (Peg11Present) {
+ MmPci16And (0, SA_PEG_BUS_NUM, Dev, 1, R_SA_PEG_LCTL_OFFSET, ~BIT4);
+ }
+ if (Peg12Present) {
+ MmPci16And (0, SA_PEG_BUS_NUM, Dev, 2, R_SA_PEG_LCTL_OFFSET, ~BIT4);
+ }
+ ///
+ /// Dump the Sampler values after calibration
+ ///
+ DEBUG ((EFI_D_INFO, "--- Sampler values after calibration ---\n"));
+#ifdef EFI_DEBUG
+ DumpSamplerValues (0, CpuSteppingId, Dev, LanesCount);
+#endif // EFI_DEBUG
+ return;
+}
+
+VOID
+PegSamplerCalibration (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi,
+ IN PEI_STALL_PPI *StallPpi,
+ IN UINT8 CpuSteppingId,
+ IN UINT8 HwStrap
+ )
+/**
+ This function performs the PEG Sampler Calibration
+
+ @param[in] PeiServices - Pointer to the PEI services table
+ @param[in] SaPlatformPolicyPpi - pointer to SA_PLATFORM_POLICY_PPI
+ @param[in] StallPpi - pointer to PEI_STALL_PPI
+ @param[in] CpuSteppingId - CPUID.1.EAX[3:0], CPU stepping ID
+ @param[in] HwStrap - HwStrap configuration from FUSESCMN
+
+ @retval None
+**/
+{
+ UINT32 Data32;
+
+ ///
+ /// Calibrate PEG10/PEG11/PEG12 - 16 lanes total
+ ///
+ if (MmPci16 (0, 0, 1, 0, PCI_VID) != 0xFFFF) {
+ Data32 = MmPci32 (0, 0, 1, 0, R_SA_PEG_PEGSTS_OFFSET);
+ if (((Data32 & 0xFFFF) != 0) && (((Data32 >> 16) & 0x0F) >= 7)) {
+ SamplerCalibratePegPort (PeiServices, StallPpi, CpuSteppingId, SA_PEG10_DEV_NUM, 16, HwStrap);
+ }
+ }
+
+ return;
+}
+
+VOID
+PegGen2AutoSpeedDisable (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi,
+ IN PEI_STALL_PPI *StallPpi,
+ IN SA_DATA_HOB *SaDataHob,
+ IN PEG_PORT *PegPortTable,
+ IN UINTN PegPortTableSize,
+ IN UINT8 HwStrap
+ )
+/**
+ This function performs the PEG GEN2 Auto Speed Disable
+
+ @param[in] PeiServices - Pointer to the PEI services table
+ @param[in] SaPlatformPolicyPpi - Pointer to SA_PLATFORM_POLICY_PPI
+ @param[in] StallPpi - Pointer to PEI_STALL_PPI
+ @param[in] SaDataHob - Pointer to SA_DATA_HOB
+ @param[in] PegPortTable - Pointer to PEG Port Table
+ @param[in] PegPortTableSize - Size of PEG Port Table
+ @param[in] HwStrap - Furcation HW Strap Value
+
+ @retval None
+**/
+{
+ UINTN PortIndex;
+ EFI_STATUS Status;
+ EFI_BOOT_MODE BootMode;
+ UINT8 DisableAutoSpeedUp;
+ UINT8 PegBus;
+ UINT8 PegDev;
+ UINT8 PegFunc;
+
+ DisableAutoSpeedUp = 0;
+ Status = (*PeiServices)->GetBootMode (PeiServices, &BootMode);
+ ASSERT_EFI_ERROR (Status);
+
+ for (PortIndex = 0; PortIndex < PegPortTableSize; PortIndex++) {
+ PegBus = PegPortTable[PortIndex].Bus;
+ PegDev = PegPortTable[PortIndex].Device;
+ PegFunc = PegPortTable[PortIndex].Function;
+
+ ///
+ /// If VC0 is still pending
+ /// And presence of an endpoint was detected, enable GEN2 auto speed disable
+ ///
+ if ((MmPci16 (0, PegBus, PegDev, PegFunc, PCI_VID ) != 0xFFFF) &&
+ ((MmPci16 (0, PegBus, PegDev, PegFunc, R_SA_PEG_VC0RSTS_OFFSET) & BIT1) != 0) &&
+ ((MmPci16 (0, PegBus, PegDev, PegFunc, R_SA_PEG_SLOTSTS_OFFSET) & BIT6) != 0)) {
+ DisableAutoSpeedUp |= 1 << PegFunc;
+ MmPci16Or (0, PegBus, PegDev, PegFunc, R_SA_PEG_LCTL_OFFSET, BIT4);
+ MmPci32Or (0, PegBus, PegDev, PegFunc, R_SA_PEG_CFG5_OFFSET, BIT9);
+ MmPci16And (0, PegBus, PegDev, PegFunc, R_SA_PEG_LCTL_OFFSET, (UINT16)~(BIT4));
+ }
+ }
+ ///
+ /// If needed, reinitialize link after disable
+ ///
+ if (DisableAutoSpeedUp != 0) {
+ if ((BootMode == BOOT_ON_S3_RESUME) || (GetPchPmStatus (WarmBoot) == TRUE)) {
+ if ((SaDataHob != NULL) && (SaDataHob->PegDataValid)) {
+ if (SaDataHob->PegData.PegLinkFailMask != 0) {
+ ///
+ /// Even on warm boot/S3 resume, we still want to force checking of VC0 status
+ ///
+ SaDataHob->PegData.PegLinkFailMask = 0;
+ }
+ }
+ }
+ GracefulLinkStatusStall (PeiServices, StallPpi, SaPlatformPolicyPpi, SaDataHob, HwStrap);
+ for (PortIndex = 0; PortIndex < PegPortTableSize; PortIndex++) {
+ PegBus = PegPortTable[PortIndex].Bus;
+ PegDev = PegPortTable[PortIndex].Device;
+ PegFunc = PegPortTable[PortIndex].Function;
+ if (((DisableAutoSpeedUp >> PegFunc) & 1) == 1) {
+ ///
+ /// Retrain to allow link to reach GEN2
+ ///
+ MmPci16Or (0, PegBus, PegDev, PegFunc, R_SA_PEG_LCTL_OFFSET, BIT5);
+ }
+ }
+ ///
+ /// Ensure all links are now ready
+ ///
+ if ((BootMode == BOOT_ON_S3_RESUME) || (GetPchPmStatus (WarmBoot) == TRUE)) {
+ if ((SaDataHob != NULL) && (SaDataHob->PegDataValid)) {
+ if (SaDataHob->PegData.PegLinkFailMask != 0) {
+ ///
+ /// Even on warm boot/S3 resume, we still want to force checking of VC0 status
+ ///
+ SaDataHob->PegData.PegLinkFailMask = 0;
+ }
+ }
+ }
+ GracefulLinkStatusStall (PeiServices, StallPpi, SaPlatformPolicyPpi, SaDataHob, HwStrap);
+ DEBUG ((EFI_D_INFO, "PEG Link Status after auto speed disable:\n"));
+ for (PortIndex = 0; PortIndex < PegPortTableSize; PortIndex++) {
+ PegBus = PegPortTable[PortIndex].Bus;
+ PegDev = PegPortTable[PortIndex].Device;
+ PegFunc = PegPortTable[PortIndex].Function;
+ ReportPcieLinkStatus (PegBus, PegDev, PegFunc);
+ }
+ }
+}
+
+VOID
+PciExpressInit (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi
+ )
+/**
+ Initialize the SA PciExpress in PEI
+
+ @param[in] PeiServices - Pointer to the PEI services table
+ @param[in] SaPlatformPolicyPpi - SaPlatformPolicyPpi to access the GtConfig related information
+**/
+{
+ UINT8 PegBus;
+ UINT8 PegDev;
+ UINT8 PegFunc;
+ UINT8 PegIndex;
+ UINT8 HwStrap;
+ UINT64 MchBar;
+ UINT64 DmiBar;
+ BOOLEAN DisableFun0;
+ BOOLEAN DisableFun1;
+ BOOLEAN DisableFun2;
+ BOOLEAN DisableLinkFunc0;
+ EFI_STATUS Status;
+ CPU_FAMILY CpuFamilyId;
+ CPU_STEPPING CpuSteppingId;
+ UINTN PegComplete;
+ UINT16 Peg10Speed;
+ UINT16 Peg11Speed;
+ UINT16 Peg12Speed;
+ UINT8 SwingControl;
+ UINT8 Gen3Capable;
+ UINT8 i;
+ PEI_STALL_PPI *StallPpi;
+ UINT32 Data32;
+ UINT32 CapOffset;
+ BOOLEAN AnyGen3Endpoint;
+ UINT8 FullSwing;
+ UINT8 PreCursor;
+ UINT8 Cursor;
+ UINT8 PostCursor;
+
+ PEG_PORT PegPortTable[] = {
+ ///
+ /// Bus, Device, Function, Index, PresenceDetect, MaxLinkWidth, EndpointMaxLinkSpeed
+ ///
+ { SA_PEG_BUS_NUM, SA_PEG10_DEV_NUM, SA_PEG10_FUN_NUM, 0, FALSE, 16, 0}
+//AMI_OVERRIDE>>
+#if RC_PEG_1 == 1
+ ,{ SA_PEG_BUS_NUM, SA_PEG11_DEV_NUM, SA_PEG11_FUN_NUM, 1, FALSE, 8, 0}
+#endif
+#if RC_PEG_2 == 1
+ ,{ SA_PEG_BUS_NUM, SA_PEG12_DEV_NUM, SA_PEG12_FUN_NUM, 2, FALSE, 4, 0}
+#endif
+//AMI_OVERRIDE<<
+ };
+ SA_DATA_HOB *SaDataHob;
+ BOOLEAN S3Flow;
+ UINT8 LinkStatusGood;
+ BOOLEAN FunctionExists;
+ UINT8 UnusedLanes;
+ UINT8 CtrlMaxLinkWidth;
+ UINT8 EpMaxLinkWidth;
+ UINT16 LoopCount;
+ UINT8 MaxBndlPwrdnCount;
+ UINT8 BndlPwrdnCount;
+ UINT8 PwrDnUnusedBundlesSetupData;
+
+ HwStrap = SA_PEG_x16_x0_x0;
+ DisableFun0 = FALSE;
+ DisableFun1 = FALSE;
+ DisableFun2 = FALSE;
+ DisableLinkFunc0 = FALSE;
+ MchBar = McD0PciCfg64 (R_SA_MCHBAR) &~BIT0;
+ DmiBar = McD0PciCfg64 (R_SA_DMIBAR) &~BIT0;
+ PegDev = 0x1;
+
+ Peg10Speed = 0;
+ Peg11Speed = 0;
+ Peg12Speed = 0;
+ SwingControl = SaPlatformPolicyPpi->PcieConfig->PegSwingControl;
+ SaDataHob = NULL;
+ S3Flow = FALSE;
+ Gen3Capable = TRUE;
+ AnyGen3Endpoint = FALSE;
+ FullSwing = 0;
+ CtrlMaxLinkWidth = 0;
+ EpMaxLinkWidth = 0;
+ UnusedLanes = 0;
+ LoopCount = 0;
+ MaxBndlPwrdnCount = 0;
+ BndlPwrdnCount = 0;
+ PwrDnUnusedBundlesSetupData = 0xFF;
+
+ ///
+ /// Check to see if PEG exists and leave initialization function if non-existant
+ ///
+ if (McD1PciCfg16 (PCI_VID) == 0xFFFF) {
+ DEBUG ((EFI_D_INFO, "PEG controller not detected\n"));
+ return;
+ }
+
+ ///
+ /// Read the HW straps - Bus 0, Device 1, Fun 0, Reg 0x504 BIT17,16
+ /// Fun 1 & 2 disabled = Pcie 1x16, Fun 2 disabled = Pcie 2x8
+ /// Fun 1 & 2 enabled = Pcie 1x8 + (2+4)
+ ///
+ HwStrap = (UINT8) ((MmPci32 (0, SA_MC_BUS, PegDev, 0, R_SA_PEG_FUSESCMN_OFFSET) >> 16) & 0x03);
+ DEBUG ((EFI_D_INFO, "PEG HW Strap value %x\n", HwStrap));
+
+ Status = (*PeiServices)->LocatePpi (PeiServices, &gPeiStallPpiGuid, 0, NULL, &StallPpi);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Update PEG LCAP.MLW based on PEG port Split configuration.
+ /// This is Write-Once field, so keep the values in the structure,
+ /// and write later together with LCAP.MLS.
+ ///
+ switch (HwStrap) {
+ case SA_PEG_x8_x4_x4:
+ ///
+ /// 0x0: Device 1 functions 1 and 2 enabled
+ /// PEG10: x16->x8, PEG11: x8->x4, PEG12: x4
+ ///
+ PegPortTable[0].MaxLinkWidth = 8;
+//AMI_OVERRIDE >>
+#if RC_PEG_1 == 1
+ PegPortTable[1].MaxLinkWidth = 4;
+#endif
+//AMI_OVERRIDE <<
+ break;
+
+
+ case SA_PEG_x8_x8_x0:
+ ///
+ /// 0x2: Device 1 function 1 enabled; function 2 disabled
+ /// PEG10: x16->x8, PEG11: x8, PEG12: N/A
+ ///
+ PegPortTable[0].MaxLinkWidth = 8;
+ break;
+
+ default:
+ case SA_PEG_x16_x0_x0:
+ break;
+ }
+
+ CpuFamilyId = GetCpuFamily();
+ CpuSteppingId = GetCpuStepping();
+
+ ///
+ /// Read PEG Gen3 Fuse to see if it should override programming
+ ///
+ if (MmPci32 (0, SA_MC_BUS, SA_MC_DEV, SA_MC_FUN, R_SA_MC_CAPID0_B) & BIT20) {
+ Gen3Capable = FALSE;
+ DEBUG ((EFI_D_INFO, "PEG Gen3 Fused off\n"));
+ }
+
+ ///
+ /// Gen3 Preset Search: 0 = Disabled, 1 = Enabled (default)
+ ///
+ if (SaPlatformPolicyPpi->PcieConfig->PegGen3PresetSearch == 2) {
+ SaPlatformPolicyPpi->PcieConfig->PegGen3PresetSearch = 1;
+ }
+
+ ///
+ /// Restore SA Data HOB's PEG data
+ ///
+ if (SaPlatformPolicyPpi->Revision >= SA_PLATFORM_POLICY_PPI_REVISION_2) {
+ SaDataHob = (SA_DATA_HOB *) GetFirstGuidHob (&gSaDataHobGuid);
+
+ if (SaDataHob != NULL) {
+ if (SaPlatformPolicyPpi->PcieConfig->PegDataPtr != NULL) {
+ DEBUG ((EFI_D_INFO, "\nRestore SA PEG DATA from previous boot: Size=%X\n", sizeof (SA_PEG_DATA)));
+ CopyMem (&(SaDataHob->PegData), SaPlatformPolicyPpi->PcieConfig->PegDataPtr, sizeof (SA_PEG_DATA));
+ SaDataHob->PegDataValid = TRUE;
+ if ((SaDataHob->PegData.PegGen3PresetSearch != SaPlatformPolicyPpi->PcieConfig->PegGen3PresetSearch) && (SaPlatformPolicyPpi->PcieConfig->PegGen3PresetSearch != 1)) {
+ ///
+ /// Zero out previous boot GEN3 Preset data so old data won't be re-used when PegGen3PresetSearch re-enabled later
+ ///
+ DEBUG ((EFI_D_INFO, "\nPegGen3PresetSearch is disabled, Clear old Preset data\n"));
+ for (PegIndex = 0; PegIndex < SA_PEG_MAX_FUN; PegIndex++) {
+ SaDataHob->PegData.EndPointVendorIdDeviceId[PegIndex] = 0;
+ for (i = 0; i < SA_PEG_MAX_LANE; i++) {
+ SaDataHob->PegData.BestPreset[i] = 0;
+ }
+ }
+ }
+ }
+ SaDataHob->PegData.PegGen3PresetSearch = SaPlatformPolicyPpi->PcieConfig->PegGen3PresetSearch;
+ }
+ }
+
+ ///
+ /// Perform PEG Pre-Detection steps
+ ///
+ for (PegComplete = 0; PegComplete < ((sizeof (PegPortTable)) / (sizeof (PEG_PORT))); PegComplete++) {
+ PegBus = PegPortTable[PegComplete].Bus;
+ PegDev = PegPortTable[PegComplete].Device;
+ PegFunc = PegPortTable[PegComplete].Function;
+ PegPreDetectionSteps (PegBus, PegDev, PegFunc, SaPlatformPolicyPpi);
+ }
+
+ ///
+ /// Perform PEG Recipe steps
+ ///
+ DEBUG ((EFI_D_INFO, "PEG Recipe...\n"));
+ PegDmiRecipe (SaPlatformPolicyPpi, (UINT32) MchBar, 0, SA_PEG10_DEV_NUM, SwingControl);
+
+ ///
+ /// Perform PEG Gen3 Equalization steps and load preset values
+ ///
+ if (Gen3Capable == TRUE) {
+ if (SaPlatformPolicyPpi->PcieConfig->PegGen3Equalization != 0) {
+ DEBUG ((EFI_D_INFO, "PEG Gen3 Equalization...\n"));
+ PegGen3Equalization (SaPlatformPolicyPpi, CpuSteppingId, HwStrap);
+ }
+ }
+
+ ///
+ /// PEG Sampler Calibration: 0 = Disabled (default), 1 = Enabled
+ ///
+ if (SaPlatformPolicyPpi->PcieConfig->PegSamplerCalibrate == 2) {
+ SaPlatformPolicyPpi->PcieConfig->PegSamplerCalibrate = 0;
+ }
+
+ if (SaPlatformPolicyPpi->PcieConfig->PegSamplerCalibrate == 1) {
+ ///
+ /// Back up the current PEG speed in LCTL2.TLS[3:0]
+ ///
+ Peg10Speed = McD1PciCfg16 (R_SA_PEG_LCTL2_OFFSET) & 0x0F;
+ Peg11Speed = McD1F1PciCfg16 (R_SA_PEG_LCTL2_OFFSET) & 0x0F;
+ Peg12Speed = McD1F2PciCfg16 (R_SA_PEG_LCTL2_OFFSET) & 0x0F;
+ ///
+ /// Set the PEG speed in LCTL2.TLS[3:0] to Gen1 before clearing DEFER_OC,
+ /// in order to run Sampler Calibration at Gen1.
+ ///
+ McD1PciCfg16AndThenOr (R_SA_PEG_LCTL2_OFFSET, 0xFFF0, 1);
+ McD1F1PciCfg16AndThenOr (R_SA_PEG_LCTL2_OFFSET, 0xFFF0, 1);
+ McD1F2PciCfg16AndThenOr (R_SA_PEG_LCTL2_OFFSET, 0xFFF0, 1);
+ }
+
+ for (PegComplete = 0; PegComplete < ((sizeof (PegPortTable)) / (sizeof (PEG_PORT))); PegComplete++) {
+ ///
+ /// Program the PEG speed according to Setup options: Auto/Gen1/2/3
+ /// We have to do it before endpoint enumeration, so that uncompliant card
+ /// can train at a lower speed.
+ ///
+ ConfigurePegGenX (
+ PeiServices,
+ StallPpi,
+ SaPlatformPolicyPpi,
+ PegPortTable,
+ PegComplete,
+ CpuSteppingId,
+ Gen3Capable
+ );
+ }
+
+ ///
+ /// RxCEM Loopback (LPBK) Mode
+ ///
+ if ((SaPlatformPolicyPpi->Revision >= SA_PLATFORM_POLICY_PPI_REVISION_3) && (SaPlatformPolicyPpi->PcieConfig->RxCEMLoopback == 1)) {
+ McD1PciCfg32AndThenOr (R_SA_PEG_PEGTST_OFFSET, ~(BIT19|BIT18|BIT17|BIT16), (SaPlatformPolicyPpi->PcieConfig->RxCEMLoopbackLane & 0xF) << 16);
+ for (i = 0; i < SA_PEG_MAX_LANE; i++) {
+ if (i == SaPlatformPolicyPpi->PcieConfig->RxCEMLoopbackLane) {
+ McD1PciCfg32And (R_SA_PEG_AFELN0CFG0_OFFSET + LANE_STEP * i, ~BIT9);
+ } else {
+ McD1PciCfg32Or (R_SA_PEG_AFELN0CFG0_OFFSET + LANE_STEP * i, BIT9);
+ }
+ }
+ }
+
+ ///
+ /// Enable 3-OC retry for PEG(0/1/2). HSW/CRW earlier than C0.
+ ///
+ if (((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId < EnumHswC0)) ||
+ ((CpuFamilyId == EnumCpuCrw) && (CpuSteppingId < EnumCrwC0))) {
+ McD1PciCfg32Or (R_SA_PEG_AFE_PWRON_OFFSET, BIT5);
+ McD1F1PciCfg32Or (R_SA_PEG_AFE_PWRON_OFFSET, BIT5);
+ McD1F2PciCfg32Or (R_SA_PEG_AFE_PWRON_OFFSET, BIT5);
+ }
+
+ ///
+ /// Bypass phase2
+ ///
+ Data32 = McD1PciCfg32 (R_SA_PEG_EQCFG_OFFSET);
+ Data32 |= BIT15 | BIT1;
+ McD1PciCfg32 (R_SA_PEG_EQCFG_OFFSET) = Data32;
+
+ ///
+ /// Clear DEFER_OC in offset 0xC24[16] on all PEG controllers to start the PEG training
+ ///
+ McD1PciCfg32And (R_SA_PEG_AFE_PWRON_OFFSET, ~BIT16);
+ McD1F1PciCfg32And (R_SA_PEG_AFE_PWRON_OFFSET, ~BIT16);
+ McD1F2PciCfg32And (R_SA_PEG_AFE_PWRON_OFFSET, ~BIT16);
+
+ ///
+ /// Delay for 100ms to meet the timing requirements of the PCI Express Base
+ /// Specification, Revision 1.0A, Section 6.6 ("...software must wait at least
+ /// 100 ms from the end of reset of one or more device before it is permitted
+ /// to issue Configuration Requests to those devices").
+ ///
+ GracefulLinkStatusStall (PeiServices, StallPpi, SaPlatformPolicyPpi, SaDataHob, HwStrap);
+
+ PegGen2AutoSpeedDisable (PeiServices,
+ SaPlatformPolicyPpi,
+ StallPpi,
+ SaDataHob,
+ &(PegPortTable[0]),
+ ((sizeof (PegPortTable)) / (sizeof (PEG_PORT))),
+ HwStrap);
+
+ ///
+ /// Read the presence detect bit for each PEG port - must be done before sampler calibration
+ ///
+ for (PegComplete = 0; PegComplete < ((sizeof (PegPortTable)) / (sizeof (PEG_PORT))); PegComplete++) {
+ PegBus = PegPortTable[PegComplete].Bus;
+ PegDev = PegPortTable[PegComplete].Device;
+ PegFunc = PegPortTable[PegComplete].Function;
+ if (( MmPci16 (0, PegBus, PegDev, PegFunc, PCI_VID ) != 0xFFFF) &&
+ ((MmPci16 (0, PegBus, PegDev, PegFunc, R_SA_PEG_SLOTSTS_OFFSET) & BIT6) != 0)) {
+ PegPortTable[PegComplete].PresenceDetect = TRUE;
+
+ ///
+ /// Read the endpoint's Max Link Speed
+ ///
+ MmPci32AndThenOr (0, PegBus, PegDev, PegFunc, PCI_PBUS, 0xFF0000FF, 0x00010100);
+ MmPci16 (0, 1, 0, 0, PCI_VID) = 0;
+ CapOffset = PcieFindCapId (1, 0, 0, EFI_PCI_CAPABILITY_ID_PCIEXP);
+ if (CapOffset != 0) {
+ Data32 = MmPci32 (0, 1, 0, 0, CapOffset + 0xC);
+ PegPortTable[PegComplete].EndpointMaxLinkSpeed = Data32 & 0xF;
+ if (PegPortTable[PegComplete].EndpointMaxLinkSpeed >= 0x3) {
+ AnyGen3Endpoint = TRUE;
+ }
+ }
+ MmPci32And (0, PegBus, PegDev, PegFunc, PCI_PBUS, 0xFF0000FF);
+ }
+ }
+ DEBUG ((EFI_D_INFO, "Presence detect table...\n"));
+ for (PegComplete = 0; PegComplete < ((sizeof (PegPortTable)) / (sizeof (PEG_PORT))); PegComplete++) {
+ DEBUG ((EFI_D_INFO, " PEG%d%d PresenceDetect: %x. EndpointMaxLinkSpeed: %x.\n",
+ PegPortTable[PegComplete].Device,
+ PegPortTable[PegComplete].Function,
+ PegPortTable[PegComplete].PresenceDetect,
+ PegPortTable[PegComplete].EndpointMaxLinkSpeed));
+ }
+
+ ///
+ /// If any Gen3 device, setup equalization values and retrain link
+ ///
+ if (AnyGen3Endpoint &&
+ (((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId >= EnumHswB0)) ||
+ ((CpuFamilyId == EnumCpuCrw) && (CpuSteppingId >= EnumCrwB0)))) {
+ ///
+ /// Program presets based upon endpoint fullswing value
+ ///
+ for (i = 0; i < SA_PEG_MAX_LANE; i++) {
+ switch (i) {
+ case 0:
+ GetLinkPartnerFullSwing (i, &FullSwing);
+ break;
+ case 8:
+ if (PegPortTable[1].PresenceDetect) {
+ GetLinkPartnerFullSwing (i, &FullSwing);
+ }
+ break;
+ case 12:
+ if (PegPortTable[2].PresenceDetect) {
+ GetLinkPartnerFullSwing (i, &FullSwing);
+ }
+ break;
+ default:
+ break;
+ }
+ GetCoefficientsFromPreset (SaPlatformPolicyPpi->PcieConfig->Gen3EndPointPreset[i], FullSwing, &PreCursor, &Cursor, &PostCursor);
+ SetPartnerTxCoefficients (i, &PreCursor, &Cursor, &PostCursor);
+ }
+
+ ///
+ /// Redo EQ
+ ///
+ for (PegComplete = 0; PegComplete < ((sizeof (PegPortTable)) / (sizeof (PEG_PORT))); PegComplete++) {
+ if (PegPortTable[PegComplete].PresenceDetect) {
+ PegBus = PegPortTable[PegComplete].Bus;
+ PegDev = PegPortTable[PegComplete].Device;
+ PegFunc = PegPortTable[PegComplete].Function;
+ MmPci32Or (0, PegBus, PegDev, PegFunc, R_SA_PEG_LCTL3_OFFSET, BIT0); ///< DOEQ
+ MmPci16Or (0, PegBus, PegDev, PegFunc, R_SA_PEG_LCTL_OFFSET, BIT5); ///< Retrain link
+ }
+ }
+ for (PegComplete = 0; PegComplete < ((sizeof (PegPortTable)) / (sizeof (PEG_PORT))); PegComplete++) {
+ if (PegPortTable[PegComplete].PresenceDetect) {
+ WaitForL0 (PeiServices, StallPpi, &(PegPortTable[PegComplete]), FALSE);
+ }
+ }
+ }
+
+ ///
+ /// Sampler Calibration
+ ///
+ if (SaPlatformPolicyPpi->PcieConfig->PegSamplerCalibrate == 1) {
+ DEBUG ((EFI_D_INFO, "PEG SamplerCalibration...\n"));
+ PegSamplerCalibration (PeiServices, SaPlatformPolicyPpi, StallPpi, CpuSteppingId, HwStrap);
+
+ ///
+ /// Restore the PEG speed
+ ///
+ McD1PciCfg16AndThenOr (R_SA_PEG_LCTL2_OFFSET, 0xFFF0, Peg10Speed);
+ McD1F1PciCfg16AndThenOr (R_SA_PEG_LCTL2_OFFSET, 0xFFF0, Peg11Speed);
+ McD1F2PciCfg16AndThenOr (R_SA_PEG_LCTL2_OFFSET, 0xFFF0, Peg12Speed);
+
+ ///
+ /// Delay 100ms to let endpoint train properly
+ ///
+ StallPpi->Stall (PeiServices, StallPpi, 100 * STALL_ONE_MILLI_SECOND);
+ }
+ ///
+ /// Gen3 Preset Search: 0 = Disabled, 1 = Enabled (default)
+ ///
+ if (SaPlatformPolicyPpi->PcieConfig->PegGen3PresetSearch == 2) {
+ SaPlatformPolicyPpi->PcieConfig->PegGen3PresetSearch = 1;
+ }
+
+ if (SaPlatformPolicyPpi->PcieConfig->PegGen3PresetSearch == 1) {
+ PegGen3PresetSearch (PeiServices, SaPlatformPolicyPpi, StallPpi, SaDataHob);
+ }
+
+ ///
+ /// After last equalization, set PH3 bypass
+ ///
+ McD1PciCfg32Or (R_SA_PEG_EQCFG_OFFSET, BIT15 | BIT14);
+
+ ///
+ /// Scan PEG Ports for device population
+ ///
+ DEBUG ((EFI_D_INFO, "PEG Ports Scanning starts.\n"));
+ for (PegComplete = 0; PegComplete < ((sizeof (PegPortTable)) / (sizeof (PEG_PORT))); PegComplete++) {
+
+ PegBus = PegPortTable[PegComplete].Bus;
+ PegDev = PegPortTable[PegComplete].Device;
+ PegFunc = PegPortTable[PegComplete].Function;
+ PegIndex = PegPortTable[PegComplete].Index;
+
+ ///
+ /// Check for a card presence in the PEG slot, or if the PEG port exists.
+ ///
+ if ((MmPci16 (0, PegBus, PegDev, PegFunc, PCI_VID) == 0xFFFF) ||
+ (PegPortTable[PegComplete].PresenceDetect == FALSE)) {
+ if (SaPlatformPolicyPpi->PcieConfig->AlwaysEnablePeg == 0) {
+ goto PegDisable;
+ }
+ } else {
+ if (SaPlatformPolicyPpi->PcieConfig->AlwaysEnablePeg == 0) {
+ ///
+ /// Set PEG PortBus = 1 to Read Endpoint.
+ ///
+ MmPci32AndThenOr (0, PegBus, PegDev, PegFunc, PCI_PBUS, 0xFF0000FF, 0x00010100);
+
+ ///
+ /// A config write is required in order for the device to re-capture the Bus number,
+ /// according to PCI Express Base Specification, 2.2.6.2
+ /// Write to a read-only register VendorID to not cause any side effects.
+ ///
+ MmPci16 (0, 1, 0, 0, PCI_VID) = 0;
+
+ ///
+ /// Negotiation Done?
+ ///
+ if ((MmPci16 (0, PegBus, PegDev, PegFunc, R_SA_PEG_VC0RSTS_OFFSET) & BIT1) != 0) {
+ goto PegDisable;
+ }
+
+ ///
+ /// Restore bus numbers on the PEG bridge.
+ ///
+ MmPci32And (0, PegBus, PegDev, PegFunc, PCI_PBUS, 0xFF0000FF);
+ }
+
+ if (SaPlatformPolicyPpi->Revision >= SA_PLATFORM_POLICY_PPI_REVISION_8) {
+ PwrDnUnusedBundlesSetupData = SaPlatformPolicyPpi->PcieConfig->PowerDownUnusedBundles[PegIndex];
+ } else {
+ PwrDnUnusedBundlesSetupData = 0xFF; ///< Forced to AUTO mode for calculating unused bundles to powerdown
+ }
+
+ if (PwrDnUnusedBundlesSetupData == 0xff) { ///< AUTO mode for calculating unused bundles to powerdown
+ ///
+ /// Read the controller's Max Link Width
+ ///
+ CtrlMaxLinkWidth = (UINT8) ((MmPci32 (0, PegBus, PegDev, PegFunc, R_SA_PEG_LCAP_OFFSET) >> 4) & 0x3F);
+
+ ///
+ /// Read the endpoint's Max Link Width
+ ///
+
+ ///
+ /// Set PEG PortBus = 1 to Read Endpoint.
+ ///
+ MmPci32AndThenOr (0, PegBus, PegDev, PegFunc, PCI_PBUS, 0xFF0000FF, 0x00010100);
+
+ ///
+ /// A config write is required in order for the device to re-capture the Bus number,
+ /// according to PCI Express Base Specification, 2.2.6.2
+ /// Write to a read-only register VendorID to not cause any side effects.
+ ///
+ MmPci16 (0, 1, 0, 0, PCI_VID) = 0;
+
+ ///
+ /// Check if the device actually got mapped into config space,
+ /// if the device wasn't able to be mapped into config space then
+ /// it's possible that it's a test card or some other device that
+ /// does not support config space. In that case our only option is
+ /// to assume that the link trains to its max width and use that to
+ /// determine which bundles to power down
+ ///
+ if (MmPci32 (0, 1, 0, 0, PCI_VID) == 0xFFFFFFFF) {
+ EpMaxLinkWidth = (UINT8) ((MmPci16 (0, PegBus, PegDev, PegFunc, R_SA_PEG_LSTS_OFFSET) & 0x3f0) >> 4);
+ DEBUG ((EFI_D_INFO,
+ "PEG%d%d - Endpoint not responding to PCI config space access, assuming negotiated width (X%d) is max width\n",
+ PegDev,
+ PegFunc,
+ EpMaxLinkWidth
+ ));
+ } else {
+ CapOffset = PcieFindCapId (1, 0, 0, EFI_PCI_CAPABILITY_ID_PCIEXP);
+ if (CapOffset != 0) {
+ EpMaxLinkWidth = (UINT8) ((MmPci32 (0, 1, 0, 0, CapOffset + 0xC) >> 4) & 0x3F);
+ }
+ }
+
+ ///
+ /// Restore bus numbers on the PEG bridge.
+ ///
+ MmPci32And (0, PegBus, PegDev, PegFunc, PCI_PBUS, 0xFF0000FF);
+
+ if (CtrlMaxLinkWidth > EpMaxLinkWidth) {
+ UnusedLanes = CtrlMaxLinkWidth - EpMaxLinkWidth;
+ } else {
+ UnusedLanes = 0;
+ }
+
+ BndlPwrdnCount = (UnusedLanes / 2);
+
+ DEBUG ((EFI_D_INFO, "CtrlMLW[%d]. EpMLW[%d]. UnusedLanes[%d]. BndlPwrdnCount[%d].\n", CtrlMaxLinkWidth, EpMaxLinkWidth, UnusedLanes, BndlPwrdnCount));
+ } else if (PwrDnUnusedBundlesSetupData != 0) { ///< User selection mode: 1...8 unused bundles
+ BndlPwrdnCount = PwrDnUnusedBundlesSetupData;
+ DEBUG ((EFI_D_INFO, "BndlPwrdnCount[%d].\n", BndlPwrdnCount));
+ }
+
+ ///
+ /// PowerOff unused lanes for PEGs
+ ///
+ if (((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId >= EnumHswC0)) ||
+ ((CpuFamilyId == EnumCpuCrw) && (CpuSteppingId >= EnumCrwC0))) {
+ if (PwrDnUnusedBundlesSetupData != 0) {
+ MaxBndlPwrdnCount = GetMaxBundles(PeiServices, PegFunc, HwStrap);
+ if (BndlPwrdnCount > MaxBndlPwrdnCount) {
+ BndlPwrdnCount = MaxBndlPwrdnCount;
+ DEBUG ((EFI_D_INFO+EFI_D_ERROR, "BndlPwrdnCount violation! Overriding BndlPwrdnCount! BndlPwrdnCount[%d].\n", BndlPwrdnCount));
+ }
+ PowerDownUnusedBundles(PeiServices, PegFunc, HwStrap, BndlPwrdnCount);
+ }
+ }
+
+ ///
+ /// Additional Programming Steps for PEGs
+ ///
+ DEBUG ((EFI_D_INFO, "Run AdditionalPegProgramSteps on PEG%x%x!\n", PegDev, PegFunc));
+ AdditionalPegProgramSteps (SaPlatformPolicyPpi, PegBus, PegDev, PegFunc);
+ }
+
+ if ((HwStrap == SA_PEG_x16_x0_x0) && (PegIndex == 0)) {
+ DisableFun1 = TRUE;
+ DisableFun2 = TRUE;
+ break;
+ }
+ if ((HwStrap == SA_PEG_x8_x8_x0) && (PegIndex == 1)) {
+ DisableFun2 = TRUE;
+ break;
+ }
+ if ((HwStrap == SA_PEG_x8_x4_x4) && (PegIndex == 2)) {
+ break;
+ }
+
+ continue;
+
+PegDisable:
+ ///
+ /// SA_PEG_x16_x0_x0 Mode: in this mode, PEG11 and PEG12 need to be Disabled by BIOS in this driver.
+ /// Only PEG10 needs to be checked (whether has a VGA device on it) and disabled if not.
+ ///
+ /// SA_PEG_x8_x8_x0 Mode: in this mode, PEG12 needs to be disabled, PEG10 and PEG11
+ /// need to be checked and disabled if no device installed.
+ ///
+ ///
+ /// SA_PEG_x8_x4_x4 Mode: in this mode, all PEG10, PEG11 and PEG12 devices
+ /// need to be checked and disabled if no device installed.
+ ///
+ if (HwStrap == SA_PEG_x16_x0_x0) {
+ DisableFun0 = TRUE;
+ DisableFun1 = TRUE;
+ DisableFun2 = TRUE;
+ break;
+ } else if (HwStrap == SA_PEG_x8_x8_x0) {
+ DisableFun2 = TRUE;
+ if (PegIndex == 0) {
+ DisableFun0 = TRUE;
+ } else {
+ DisableFun1 = TRUE;
+ break;
+ }
+ } else if (HwStrap == SA_PEG_x8_x4_x4) {
+ if (PegIndex == 0) {
+ DisableFun0 = TRUE;
+ } else if (PegIndex == 1) {
+ DisableFun1 = TRUE;
+ } else {
+ DisableFun2 = TRUE;
+ break;
+ }
+ }
+ } ///< End of the for Loop
+
+ if (!DisableFun1 || !DisableFun2) {
+ ///
+ /// PEG10 must be enabled if PEG11 and/or PEG12 are enabled
+ ///
+ if (DisableFun0) {
+ DisableLinkFunc0 = TRUE;
+ }
+
+ DisableFun0 = FALSE;
+ }
+
+ if (MmPci16 (0, SA_PEG_BUS_NUM, SA_PEG10_DEV_NUM, SA_PEG10_FUN_NUM, R_SA_PEG_VID_OFFSET) != 0xFFFF) {
+ FunctionExists = TRUE;
+ } else {
+ FunctionExists = FALSE;
+ DEBUG ((EFI_D_WARN, "PEG10 Disabled.\n"));
+ }
+ if ((DisableFun0 || DisableLinkFunc0) && FunctionExists) {
+ ///
+ /// Set D1.F0.R 224h [8] = 1
+ ///
+ MmPci32Or (0, SA_PEG_BUS_NUM, SA_PEG10_DEV_NUM, SA_PEG10_FUN_NUM, R_SA_PEG_LTSSMC_OFFSET, BIT8);
+
+ ///
+ /// DisableLink. Set D1.F0.R 0B0h [4] (LD (Link Disable) bit in Link Control Register
+ /// Set D1.F0.R D10h [0].
+ ///
+ MmPci8Or (0, SA_PEG_BUS_NUM, SA_PEG10_DEV_NUM, SA_PEG10_FUN_NUM, R_SA_PEG_LCTL_OFFSET, BIT4);
+
+ ///
+ /// Poll until D1.F0.R 464h [5:0] = 2
+ ///
+ LoopCount = 0;
+ while( ((MmPci32 (0, SA_PEG_BUS_NUM, SA_PEG10_DEV_NUM, SA_PEG10_FUN_NUM, R_SA_PEG_REUT_PH1_PIS_OFFSET) & 0x3F) != 2)
+ && (LoopCount < SA_PEG_LINK_DISABLE_MAXWAIT)) {
+ StallPpi->Stall (PeiServices, StallPpi, STALL_ONE_MICRO_SECOND*100); //100usec
+ LoopCount++;
+ }
+
+ ///
+ /// Program AFEOVR.RXSQDETOVR
+ /// PCIe link disable for Switchable GFx
+ /// Additional Power savings: Set 0:1:0 0xC20 BIT4 = 0 & BIT5 = 1
+ ///
+ MmPci8AndThenOr (0, SA_PEG_BUS_NUM, SA_PEG10_DEV_NUM, SA_PEG10_FUN_NUM, R_SA_PEG_AFEOVR_OFFSET, ~(BIT5 | BIT4), BIT5);
+
+ if (((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId >= EnumHswC0)) ||
+ ((CpuFamilyId == EnumCpuCrw) && (CpuSteppingId >= EnumCrwC0))) {
+ MaxBndlPwrdnCount = GetMaxBundles(PeiServices, 0, HwStrap);
+ PowerDownUnusedBundles(PeiServices, 0, HwStrap, MaxBndlPwrdnCount);
+ }
+
+ if (DisableFun0) {
+ ///
+ /// Set D1.F0.R D20h [30] to power off PEG lanes when no device is attached (prvtexdetq=1).
+ /// Clear D0.F0.R 054h (DEVEN) enable bit.
+ ///
+ MmPci32Or (0, SA_PEG_BUS_NUM, SA_PEG10_DEV_NUM, SA_PEG10_FUN_NUM, R_SA_PEG_PEGCOMLCGCTRL_OFFSET, BIT30);
+ MmPci8And (0, SA_MC_BUS, 0, 0, R_SA_DEVEN, ~B_SA_DEVEN_D1F0EN_MASK);
+ DEBUG ((EFI_D_WARN, "PEG10 Disabled.\n"));
+ }
+ }
+
+ if (MmPci16 (0, SA_PEG_BUS_NUM, SA_PEG11_DEV_NUM, SA_PEG11_FUN_NUM, R_SA_PEG_VID_OFFSET) != 0xFFFF) {
+ FunctionExists = TRUE;
+ } else {
+ FunctionExists = FALSE;
+ DEBUG ((EFI_D_WARN, "PEG11 Disabled.\n"));
+ }
+ if (DisableFun1 && FunctionExists) {
+ ///
+ /// Set D1.F1.R 224h [8] = 1
+ ///
+ MmPci32Or (0, SA_PEG_BUS_NUM, SA_PEG11_DEV_NUM, SA_PEG11_FUN_NUM, R_SA_PEG_LTSSMC_OFFSET, BIT8);
+
+ ///
+ /// DisableLink. Set D1.F1.R 0B0h [4] (LD (Link Disable) bit in Link Control Register.
+ /// Set D1.F1.R D10h [0].
+ /// Set D1.F1.R D20h [30] to power off PEG lanes when no device is attached (prvtexdetq=1).
+ /// Clear B0,D0,F0 054h (DEVEN) enable bit.
+ ///
+ MmPci8Or (0, SA_PEG_BUS_NUM, SA_PEG11_DEV_NUM, SA_PEG11_FUN_NUM, R_SA_PEG_LCTL_OFFSET, BIT4);
+
+ ///
+ /// Poll until D1.F0.R 464h [13:8] = 2
+ ///
+ LoopCount = 0;
+ while( (((MmPci32 (0, SA_PEG_BUS_NUM, SA_PEG10_DEV_NUM, SA_PEG10_FUN_NUM, R_SA_PEG_REUT_PH1_PIS_OFFSET) >> 8) & 0x3F) != 2)
+ && (LoopCount < SA_PEG_LINK_DISABLE_MAXWAIT)) {
+ StallPpi->Stall (PeiServices, StallPpi, STALL_ONE_MICRO_SECOND*100); //100usec
+ LoopCount++;
+ }
+
+ ///
+ /// Program AFEOVR.RXSQDETOVR
+ /// PCIe link disable for Switchable GFx
+ /// Additional Power savings: Set 0:1:1 0xC20 BIT4 = 0 & BIT5 = 1
+ ///
+ MmPci8AndThenOr (0, SA_PEG_BUS_NUM, SA_PEG11_DEV_NUM, SA_PEG11_FUN_NUM, R_SA_PEG_AFEOVR_OFFSET, ~(BIT5 | BIT4), BIT5);
+
+ if (((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId >= EnumHswC0)) ||
+ ((CpuFamilyId == EnumCpuCrw) && (CpuSteppingId >= EnumCrwC0))) {
+ MaxBndlPwrdnCount = GetMaxBundles(PeiServices, 1, HwStrap);
+ PowerDownUnusedBundles(PeiServices, 1, HwStrap, MaxBndlPwrdnCount);
+ }
+
+ MmPci32Or (0, SA_PEG_BUS_NUM, SA_PEG11_DEV_NUM, SA_PEG11_FUN_NUM, R_SA_PEG_PEGCOMLCGCTRL_OFFSET, BIT30);
+ MmPci8And (0, SA_MC_BUS, 0, 0, R_SA_DEVEN, ~B_SA_DEVEN_D1F1EN_MASK);
+ DEBUG ((EFI_D_WARN, "PEG11 Disabled.\n"));
+ }
+
+ if (MmPci16 (0, SA_PEG_BUS_NUM, SA_PEG12_DEV_NUM, SA_PEG12_FUN_NUM, R_SA_PEG_VID_OFFSET) != 0xFFFF) {
+ FunctionExists = TRUE;
+ } else {
+ FunctionExists = FALSE;
+ DEBUG ((EFI_D_WARN, "PEG12 Disabled.\n"));
+ }
+ if (DisableFun2 && FunctionExists) {
+ ///
+ /// Set D1.F2.R 224h [8] = 1
+ ///
+ MmPci32Or (0, SA_PEG_BUS_NUM, SA_PEG12_DEV_NUM, SA_PEG12_FUN_NUM, R_SA_PEG_LTSSMC_OFFSET, BIT8);
+
+ ///
+ /// DisableLink. Set D1.F2.R 0B0h [4] (LD (Link Disable) bit in Link Control Register.
+ /// Set D1.F2.R D10h [0].
+ /// Set D1.F2.R D20h [30] to power off PEG lanes when no device is attached (prvtexdetq=1).
+ /// Clear B0,D0,F0 054h (DEVEN) enable bit.
+ ///
+ MmPci8Or (0, SA_PEG_BUS_NUM, SA_PEG12_DEV_NUM, SA_PEG12_FUN_NUM, R_SA_PEG_LCTL_OFFSET, BIT4);
+
+ ///
+ /// Poll until D1.F0.R 464h [21:16] = 2
+ ///
+ LoopCount = 0;
+ while( (((MmPci32 (0, SA_PEG_BUS_NUM, SA_PEG10_DEV_NUM, SA_PEG10_FUN_NUM, R_SA_PEG_REUT_PH1_PIS_OFFSET) >> 16) & 0x3F) != 2)
+ && (LoopCount < SA_PEG_LINK_DISABLE_MAXWAIT)) {
+ StallPpi->Stall (PeiServices, StallPpi, STALL_ONE_MICRO_SECOND*100); //100usec
+ LoopCount++;
+ }
+
+ ///
+ /// Program AFEOVR.RXSQDETOVR
+ /// PCIe link disable for Switchable GFx
+ /// Additional Power savings: Set 0:1:2 0xC20 BIT4 = 0 & BIT5 = 1
+ ///
+ MmPci8AndThenOr (0, SA_PEG_BUS_NUM, SA_PEG12_DEV_NUM, SA_PEG12_FUN_NUM, R_SA_PEG_AFEOVR_OFFSET, ~(BIT5 | BIT4), BIT5);
+
+ if (((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId >= EnumHswC0)) ||
+ ((CpuFamilyId == EnumCpuCrw) && (CpuSteppingId >= EnumCrwC0))) {
+ MaxBndlPwrdnCount = GetMaxBundles(PeiServices, 2, HwStrap);
+ PowerDownUnusedBundles(PeiServices, 2, HwStrap, MaxBndlPwrdnCount);
+ }
+
+ MmPci32Or (0, SA_PEG_BUS_NUM, SA_PEG12_DEV_NUM, SA_PEG12_FUN_NUM, R_SA_PEG_PEGCOMLCGCTRL_OFFSET, BIT30);
+ MmPci8And (0, SA_MC_BUS, 0, 0, R_SA_DEVEN, ~B_SA_DEVEN_D1F2EN_MASK);
+ DEBUG ((EFI_D_WARN, "PEG12 Disabled.\n"));
+ }
+
+ for (PegComplete = 0; PegComplete < ((sizeof (PegPortTable)) / (sizeof (PEG_PORT))); PegComplete++) {
+ PegBus = PegPortTable[PegComplete].Bus;
+ PegDev = PegPortTable[PegComplete].Device;
+ PegFunc = PegPortTable[PegComplete].Function;
+ WaitForVc0Negotiation(PeiServices, StallPpi, PegBus, PegDev, PegFunc);
+ ReportPcieLinkStatus(PegBus, PegDev, PegFunc);
+ }
+
+ ///
+ /// Re-check Link again and see if PegLinkFailMask in SaDataHob needed update
+ ///
+ if (SaDataHob != NULL) {
+ LinkStatusGood = 0;
+ if ((BIT1 & MmPci16(0, 0, SA_PEG10_DEV_NUM, SA_PEG10_FUN_NUM, R_SA_PEG_VC0RSTS_OFFSET)) != BIT1) {
+ LinkStatusGood |= BIT0;
+ }
+ if ((BIT1 & MmPci16(0, 0, SA_PEG10_DEV_NUM, SA_PEG11_FUN_NUM, R_SA_PEG_VC0RSTS_OFFSET)) != BIT1) {
+ LinkStatusGood |= BIT1;
+ }
+ if ((BIT1 & MmPci16(0, 0, SA_PEG10_DEV_NUM, SA_PEG12_FUN_NUM, R_SA_PEG_VC0RSTS_OFFSET)) != BIT1) {
+ LinkStatusGood |= BIT2;
+ }
+ if (SaDataHob->PegData.PegLinkFailMask != (UINT8) (~LinkStatusGood)) {
+ DEBUG ((EFI_D_INFO, "Original PegLinkFailMask=%X, Final PegLinkFailMask=%X\n", SaDataHob->PegData.PegLinkFailMask, (UINT8) (~LinkStatusGood)));
+ SaDataHob->PegData.PegLinkFailMask = (UINT8) (~LinkStatusGood);
+ }
+ }
+
+ if ((SaPlatformPolicyPpi->Revision >= SA_PLATFORM_POLICY_PPI_REVISION_11) &&
+ (SaPlatformPolicyPpi->PcieConfig->PegComplianceTestingMode == 1)) {
+ for (PegComplete = 0; PegComplete < ((sizeof (PegPortTable)) / (sizeof (PEG_PORT))); PegComplete++) {
+ PegBus = PegPortTable[PegComplete].Bus;
+ PegDev = PegPortTable[PegComplete].Device;
+ PegFunc = PegPortTable[PegComplete].Function;
+ MmPci32Or (0, PegBus, PegDev, PegFunc, R_SA_PEG_CFG5_OFFSET, BIT0);
+ }
+ }
+
+ ///
+ /// Maximize the dedicated credits for the PEG controllers
+ ///
+ MaximizeSharedCredits();
+ RebalancePegPerformanceCredits (DisableFun0, DisableFun1, DisableFun2);
+ return;
+}
+
+VOID
+ConfigurePegGenX (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_STALL_PPI *StallPpi,
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi,
+ IN PEG_PORT *PegPortTable,
+ IN UINTN TableIndex,
+ IN UINT8 CpuSteppingId,
+ IN UINT8 Gen3Capable
+ )
+/**
+ Configure PEG GenX mode
+
+ @param[in] PeiServices - Pointer to the PEI services table
+ @param[in] StallPpi - Pointer to PEI_STALL_PPI
+ @param[in] SaPlatformPolicyPpi - Pointer to SA_PLATFORM_POLICY_PPI
+ @param[in] PegPortTable - Pointer to PEG_PORT array
+ @param[in] TableIndex - Index in PEG_PORT array
+ @param[in] CpuSteppingId - CPU stepping
+ @param[in] Gen3Capable - Selected PEG_PORT is Gen3 capable
+
+ @retval None
+**/
+{
+ UINT8 PegPortGenx;
+ UINT8 PegBus;
+ UINT8 PegDev;
+ UINT8 PegFunc;
+ UINT8 PegIndex;
+ UINT8 MaxLinkWidth;
+ UINT16 LinkSpeed;
+
+ PegBus = PegPortTable[TableIndex].Bus;
+ PegDev = PegPortTable[TableIndex].Device;
+ PegFunc = PegPortTable[TableIndex].Function;
+ PegIndex = PegPortTable[TableIndex].Index;
+ MaxLinkWidth = PegPortTable[TableIndex].MaxLinkWidth;
+
+ ///
+ /// Check if this port exists
+ ///
+ if (MmPci16 (0, PegBus, PegDev, PegFunc, PCI_VID) == 0xFFFF) {
+ return;
+ }
+
+ ///
+ /// PegPortGenx: 0 = Auto, 1 = Gen1, 2 = Gen2, 3 = Gen3
+ ///
+ PegPortGenx = SaPlatformPolicyPpi->PcieConfig->PegGenx[PegIndex];
+
+ if (PegPortGenx == PEG_AUTO) {
+ DEBUG ((EFI_D_ERROR, "Auto\n"));
+ LinkSpeed = (UINT16)(MmPci32(0, PegBus, PegDev, PegFunc, R_SA_PEG_LCAP_OFFSET) & 0x0F);
+ } else {
+ LinkSpeed = SaPlatformPolicyPpi->PcieConfig->PegGenx[PegIndex];
+ DEBUG ((EFI_D_ERROR, "Speed From Setup %x\n", LinkSpeed));
+ }
+ ///
+ /// If Gen3 is fused off, limit is Gen2
+ ///
+ if (Gen3Capable == FALSE) {
+ if (LinkSpeed > 2) {
+ LinkSpeed = 2;
+ }
+ }
+ ///
+ /// Set the requested speed in Max Link Speed in LCAP[3:0] and Target Link Speed in LCTL2[3:0].
+ /// Update LCAP.MLW in the same write as it's a Write-Once field
+ ///
+ DEBUG ((EFI_D_INFO, "PEG%x%x (%x:%x:%x) - Max Link Speed = Gen%d\n", PegDev, PegFunc, PegBus, PegDev, PegFunc, LinkSpeed));
+ MmPci32AndThenOr (0, PegBus, PegDev, PegFunc, R_SA_PEG_LCAP_OFFSET, 0xFFFFFC00, ((UINT32) MaxLinkWidth << 4) | LinkSpeed);
+ MmPci16AndThenOr (0, PegBus, PegDev, PegFunc, R_SA_PEG_LCTL2_OFFSET, ~(0x0F), LinkSpeed);
+
+ return;
+}
+
+VOID
+AdditionalPegProgramSteps (
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi,
+ IN UINT8 PegBus,
+ IN UINT8 PegDev,
+ IN UINT8 PegFunc
+ )
+/**
+ Additional PEG Programming Steps at PEI
+
+ @param[in] SaPlatformPolicyPpi - pointer to SA_PLATFORM_POLICY_PPI
+ @param[in] PegBus - Pci Bus Number
+ @param[in] PegDev - Pci Device Number
+ @param[in] PegFunc - Pci Func Number
+
+ @retval None
+**/
+{
+ UINT32 Data32And;
+ UINT32 Data32Or;
+
+
+ ///
+ /// Set L0SLAT[15:0] to 0x2020
+ ///
+ Data32And = (UINT32) ~(0xFFFF);
+ Data32Or = 0x00002020;
+ MmPci32AndThenOr (0, PegBus, PegDev, PegFunc, R_SA_PEG_L0SLAT_OFFSET, Data32And, Data32Or);
+
+ ///
+ /// Disable PEG Debug Align Message - set 258[29] = '1b'
+ ///
+ Data32And = (UINT32) ~BIT29;
+ Data32Or = BIT29;
+ MmPci32AndThenOr (0, PegBus, PegDev, PegFunc, R_SA_PEG_CFG4_OFFSET, Data32And, Data32Or);
+
+ ///
+ /// Retrain the link only if VC0 negotiation is complete at this point.
+ /// This is to support CLB card together with "Aways Enable PEG" option
+ ///
+ if ((MmPci16 (0, PegBus, PegDev, PegFunc, R_SA_PEG_VC0RSTS_OFFSET) & BIT1) == 0) {
+ ///
+ /// Set LCTL.RL (0xb0 bit 5) to initiate link retrain
+ ///
+ MmPci8Or (0, PegBus, PegDev, PegFunc, R_SA_PEG_LCTL_OFFSET, BIT5);
+ ///
+ /// Wait for Link training complete
+ ///
+ while (MmPci16 (0, PegBus, PegDev, PegFunc, R_SA_PEG_LSTS_OFFSET) & BIT11) {
+ };
+ }
+
+ return;
+}
+
+VOID
+MaximizeSharedCredits (
+ )
+/**
+ Maximize the dedicated credits for the PEG controllers
+**/
+{
+
+ UINT64 MchBar;
+ UINT32 Crdtctl0;
+ UINT32 Crdtctl1;
+ UINT32 Crdtctl2;
+ UINT32 Crdtctl3;
+ UINT8 Data8;
+ UINT8 Iotrk;
+ UINT8 Rrtrk;
+ BOOL CommitUpdates;
+ UINT8 i;
+
+ Iotrk = 40;
+ Rrtrk = 71;
+ CommitUpdates = FALSE;
+
+ MchBar = McD0PciCfg64 (R_SA_MCHBAR) & ~BIT0;
+ Crdtctl0 = Mmio32 (MchBar, R_SA_MCHBAR_CRDTCTL0_OFFSET);
+ Crdtctl1 = Mmio32 (MchBar, R_SA_MCHBAR_CRDTCTL1_OFFSET);
+ Crdtctl2 = Mmio32 (MchBar, R_SA_MCHBAR_CRDTCTL2_OFFSET);
+ Crdtctl3 = Mmio32 (MchBar, R_SA_MCHBAR_CRDTCTL3_OFFSET);
+
+ Data8 = 0;
+ for (i = 0; i < 24; i += 3) {
+ Data8 += (Crdtctl0 >> i) & 0x7;
+ Data8 += (Crdtctl1 >> i) & 0x7;
+ }
+ if (Data8 > Iotrk) {
+ DEBUG ((EFI_D_ERROR, "ERROR: Attempted to reserve > %d IOTRK (Attempt = %d)! Skipping programming.\n", Iotrk, Data8));
+ CommitUpdates = FALSE;
+ } else {
+ Iotrk -= Data8;
+ DEBUG ((EFI_D_INFO, "IOTRK: Reserved = %d. Shared = %d. Total = %d.\n", Data8, Iotrk, Data8 + Iotrk));
+ }
+
+ Data8 = 0;
+ for (i = 0; i < 24; i += 3) {
+ Data8 += (Crdtctl2 >> i) & 0x7;
+ }
+ Data8 += (Crdtctl2 >> 24) & 0x3F;
+ if (Data8 > Rrtrk) {
+ DEBUG ((EFI_D_ERROR, "ERROR: Attempted to reserve > %d RRTRK (Attempt = %d)! Skipping programming.\n", Rrtrk, Data8));
+ CommitUpdates = FALSE;
+ } else {
+ Rrtrk -= Data8;
+ DEBUG ((EFI_D_INFO, "RRTRK: Reserved = %d. Shared = %d. Total = %d.\n", Data8, Rrtrk, Data8 + Rrtrk));
+ }
+
+ if (CommitUpdates) {
+ Crdtctl3 = ((Rrtrk & 0x7F) << 6) | (Iotrk & 0x3F);
+ Mmio32AndThenOr (MchBar, R_SA_MCHBAR_CRDTCTL3_OFFSET, (UINT32) ~(0x00001FFF), Crdtctl3);
+ }
+
+ return;
+}
+
+VOID
+RebalancePegPerformanceCredits (
+ IN BOOLEAN DisablePeg10,
+ IN BOOLEAN DisablePeg11,
+ IN BOOLEAN DisablePeg12
+ )
+/**
+ Rebalance Credits when PEG controllers so that no starvation occurs
+
+ @param[in] DisablePeg10 - Peg10 disable/enable status
+ @param[in] DisablePeg11 - Peg11 disable/enable status
+ @param[in] DisablePeg12 - Peg12 disable/enable status
+
+ @retval None
+**/
+{
+ UINT64 MchBar;
+ UINT32 Crdtctl4;
+ UINT32 Crdtctl6;
+ UINT32 Crdtctl8;
+ UINT16 PegLinkWidth10;
+ UINT16 PegLinkWidth11;
+ UINT16 PegLinkWidth12;
+
+ MchBar = McD0PciCfg64 (R_SA_MCHBAR) & ~BIT0;
+ Crdtctl4 = Mmio32 (MchBar, R_SA_MCHBAR_CRDTCTL4_OFFSET);
+ Crdtctl6 = Mmio32 (MchBar, R_SA_MCHBAR_CRDTCTL6_OFFSET);
+ Crdtctl8 = Mmio32 (MchBar, R_SA_MCHBAR_CRDTCTL8_OFFSET);
+
+ DEBUG ((EFI_D_INFO, "Crdtctl4 Crdtctl6 Crdtctl8 Before = %x %x %x\n", Crdtctl4, Crdtctl6, Crdtctl8));
+
+ PegLinkWidth10 = 0;
+ PegLinkWidth11 = 0;
+ PegLinkWidth12 = 0;
+
+ if (!DisablePeg10) {
+ PegLinkWidth10 = (MmPci16 (0, SA_PEG_BUS_NUM, SA_PEG10_DEV_NUM, SA_PEG10_FUN_NUM, R_SA_PEG_LSTS_OFFSET) & 0x3F0) >> 4;
+ }
+ if (!DisablePeg11) {
+ PegLinkWidth11 = (MmPci16 (0, SA_PEG_BUS_NUM, SA_PEG11_DEV_NUM, SA_PEG11_FUN_NUM, R_SA_PEG_LSTS_OFFSET) & 0x3F0) >> 4;
+ }
+ if (!DisablePeg12) {
+ PegLinkWidth12 = (MmPci16 (0, SA_PEG_BUS_NUM, SA_PEG12_DEV_NUM, SA_PEG12_FUN_NUM, R_SA_PEG_LSTS_OFFSET) & 0x3F0) >> 4;
+ }
+
+ DEBUG ((EFI_D_INFO, "PEG10: LinkDisabled = %x. Width = %x\n", DisablePeg10, PegLinkWidth10));
+ DEBUG ((EFI_D_INFO, "PEG11: LinkDisabled = %x. Width = %x\n", DisablePeg11, PegLinkWidth11));
+ DEBUG ((EFI_D_INFO, "PEG12: LinkDisabled = %x. Width = %x\n", DisablePeg12, PegLinkWidth12));
+
+ ///
+ /// PEG10 = x8 and PEG11 = x8
+ ///
+ if (!DisablePeg10 && !DisablePeg11 && (PegLinkWidth10 == 8) && (PegLinkWidth11 == 8)) {
+ Crdtctl4 &= ~0x3E0;
+ Crdtctl4 |= (Crdtctl4 & 0x7C00) >> 5;
+ Crdtctl6 &= ~0x3E0;
+ Crdtctl6 |= (Crdtctl6 & 0x7C00) >> 5;
+ Crdtctl8 &= ~0xFC0;
+ Crdtctl8 |= (Crdtctl8 & 0x3F000) >> 6;
+ }
+
+ ///
+ /// PEG12 = x4
+ ///
+ if (!DisablePeg12 && (PegLinkWidth12 == 4)) {
+ ///
+ /// PEG10 = x4
+ ///
+ if (!DisablePeg10 && (PegLinkWidth10 == 4)) {
+ Crdtctl4 &= ~0x3E0;
+ Crdtctl4 |= (Crdtctl4 & 0xF8000) >> 10;
+ Crdtctl6 &= ~0x3E0;
+ Crdtctl6 |= (Crdtctl6 & 0xF8000) >> 10;
+ Crdtctl8 &= ~0xFC0;
+ Crdtctl8 |= (Crdtctl8 & 0xFC0000) >> 12;
+ }
+ ///
+ /// PEG11 = x4
+ ///
+ if (!DisablePeg11 && (PegLinkWidth11 == 4)) {
+ Crdtctl4 &= ~0x7C00;
+ Crdtctl4 |= (Crdtctl4 & 0xF8000) >> 5;
+ Crdtctl6 &= ~0x7C00;
+ Crdtctl6 |= (Crdtctl6 & 0xF8000) >> 5;
+ Crdtctl8 &= ~0x3F000;
+ Crdtctl8 |= (Crdtctl8 & 0xFC0000) >> 6;
+ }
+ }
+
+ DEBUG ((EFI_D_INFO, "Crdtctl4 Crdtctl6 Crdtctl8 After = %x %x %x\n", Crdtctl4, Crdtctl6, Crdtctl8));
+
+ Mmio32AndThenOr (MchBar, R_SA_MCHBAR_CRDTCTL4_OFFSET, (UINT32) ~0x01FFFFFF, Crdtctl4);
+ Mmio32AndThenOr (MchBar, R_SA_MCHBAR_CRDTCTL6_OFFSET, (UINT32) ~0x01FFFFFF, Crdtctl6);
+ Mmio32AndThenOr (MchBar, R_SA_MCHBAR_CRDTCTL8_OFFSET, (UINT32) ~0x3FFFFFFF, Crdtctl8);
+
+ return;
+}
+
+VOID
+PegPreDetectionSteps (
+ IN UINT8 PegBus,
+ IN UINT8 PegDev,
+ IN UINT8 PegFunc,
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi
+ )
+/**
+ Additional PEG Programming Steps before PEG detection at PEI
+
+ @param[in] PegBus - Pci Bus Number
+ @param[in] PegDev - Pci Device Number
+ @param[in] PegFunc - Pci Func Number
+ @param[in] SaPlatformPolicyPpi - Pointer to SA_PLATFORM_POLICY_PPI
+**/
+{
+ UINT32 Data32;
+ UINT32 Data32And;
+ UINT32 Data32Or;
+ UINT32 i;
+ CPU_STEPPING CpuSteppingId;
+ CPU_FAMILY CpuFamilyId;
+
+ CpuSteppingId = GetCpuStepping();
+ CpuFamilyId = GetCpuFamily();
+
+
+ Data32Or = (UINT32) (BIT4 | BIT3 | BIT2 | BIT1 | BIT0);
+ Data32And = (UINT32) ~(BIT8);
+ MmPci32AndThenOr (0, PegBus, PegDev, PegFunc, R_SA_PEG_LTSSMC_OFFSET, Data32And, Data32Or);
+
+ ///
+ /// Set PPCIE_CR_REUT_OVR_CTL_0_1_0_MMR.GRCLKGTDIS [28] to 1 (for PCIE Margin Test, Default is kept 0)
+ ///
+ if ((PegDev == 1) && (PegFunc == 0)) {
+ Data32And = (UINT32) ~BIT28;
+ Data32Or = 0;
+ MmPci32AndThenOr (0, PegBus, PegDev, PegFunc, R_SA_PEG_REUT_OVR_CTL_OFFSET, Data32And, Data32Or);
+ }
+
+ if ((PegDev == 1) && (PegFunc == 0)) {
+ ///
+ /// DCBLNC = 0
+ ///
+ Data32And = (UINT32) ~(BIT3 | BIT2);
+ Data32Or = 0;
+ for (i = 0; i < SA_PEG_MAX_BUNDLE; i++) {
+ MmPci32AndThenOr (0, PegBus, PegDev, PegFunc, R_SA_PEG_G3CTL0_OFFSET + i * BUNDLE_STEP, Data32And, Data32Or);
+ }
+ }
+
+ ///
+ /// DEBUP3[4] = 1
+ ///
+ if ((CpuFamilyId == EnumCpuHsw) || (CpuFamilyId == EnumCpuCrw)) {
+ Data32And = (UINT32) ~(BIT4);
+ Data32Or = BIT4;
+ MmPci32AndThenOr (0, PegBus, PegDev, PegFunc, R_SA_PEG_DEBUP3_OFFSET, Data32And, Data32Or);
+ }
+
+ ///
+ /// FCLKGTTLLL[2] = 1
+ ///
+ if (((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId < EnumHswC0)) ||
+ ((CpuFamilyId == EnumCpuCrw) && (CpuSteppingId < EnumCrwC0))) {
+ Data32And = (UINT32) ~(BIT2);
+ Data32Or = BIT2;
+ MmPci32AndThenOr (0, PegBus, PegDev, PegFunc, R_SA_PEG_FCLKGTTLLL_OFFSET, Data32And, Data32Or);
+ }
+
+ ///
+ /// Program Read-Only Write-Once Registers
+ /// R 308h [31:0]
+ /// R 314h [31:0]
+ /// R 32Ch [31:0]
+ /// R 330h [31:0]
+ ///
+ Data32 = MmPci32 (0, PegBus, PegDev, PegFunc, R_SA_PEG_VC0PRCA_OFFSET);
+ MmPci32 (0, PegBus, PegDev, PegFunc, R_SA_PEG_VC0PRCA_OFFSET) = Data32;
+ Data32 = MmPci32 (0, PegBus, PegDev, PegFunc, R_SA_PEG_VC0NPRCA_OFFSET);
+ MmPci32 (0, PegBus, PegDev, PegFunc, R_SA_PEG_VC0NPRCA_OFFSET) = Data32;
+ Data32 = MmPci32 (0, PegBus, PegDev, PegFunc, R_SA_PEG_VC1PRCA_OFFSET);
+ MmPci32 (0, PegBus, PegDev, PegFunc, R_SA_PEG_VC1PRCA_OFFSET) = Data32;
+ Data32 = MmPci32 (0, PegBus, PegDev, PegFunc, R_SA_PEG_VC1NPRCA_OFFSET);
+ MmPci32 (0, PegBus, PegDev, PegFunc, R_SA_PEG_VC1NPRCA_OFFSET) = Data32;
+
+ return;
+}
+#endif // PEG_FLAG
+
+#if defined(DMI_FLAG) || defined(PEG_FLAG)
+UINT32
+SendVcuApiSequence (
+ IN UINT32 MchBar,
+ IN UINT32 Address,
+ IN UINT16 OpCode,
+ IN UINT32 WriteData
+ )
+/**
+ Send one sequence to VCU MailBox
+
+ @param[in] MchBar - MCHBAR value
+ @param[in] Address - Target address
+ @param[in] OpCode - OpCode number
+ @param[in] WriteData - Data value (only used if OpCode is a write)
+**/
+{
+ BOOL IsWrite;
+ BOOL IsCsr;
+ UINT32 DataOpCode;
+ UINT32 SequenceId;
+ UINT32 VcuData;
+ CPU_FAMILY CpuFamilyId;
+ CPU_STEPPING CpuSteppingId;
+
+ CpuFamilyId = GetCpuFamily();
+ CpuSteppingId = GetCpuStepping();
+
+ if ((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId == EnumHswA0)) {
+ if ((OpCode == V_SA_VCU_OPCODE_WRITE_CSR_REV1) || (OpCode == V_SA_VCU_OPCODE_WRITE_MMIO_REV1)) {
+ IsWrite = TRUE;
+ } else {
+ IsWrite = FALSE;
+ }
+
+ if ((OpCode == V_SA_VCU_OPCODE_READ_CSR_REV1) || (OpCode == V_SA_VCU_OPCODE_WRITE_CSR_REV1)) {
+ IsCsr = TRUE;
+ } else {
+ IsCsr = FALSE;
+ }
+ } else {
+ if ((OpCode == V_SA_VCU_OPCODE_WRITE_CSR_REV2) || (OpCode == V_SA_VCU_OPCODE_WRITE_MMIO_REV2)) {
+ IsWrite = TRUE;
+ } else {
+ IsWrite = FALSE;
+ }
+
+ if ((OpCode == V_SA_VCU_OPCODE_READ_CSR_REV2) || (OpCode == V_SA_VCU_OPCODE_WRITE_CSR_REV2)) {
+ IsCsr = TRUE;
+ } else {
+ IsCsr = FALSE;
+ }
+ }
+
+ if ((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId == EnumHswA0)) {
+ if (IsWrite) {
+ DataOpCode = V_SA_VCU_OPCODE_WRITE_DATA_REV1;
+ if (IsCsr) {
+ SequenceId = V_SA_VCU_SEQID_WRITE_CSR_REV1;
+ } else {
+ SequenceId = V_SA_VCU_SEQID_WRITE_MMIO_REV1;
+ }
+ } else {
+ DataOpCode = V_SA_VCU_OPCODE_READ_DATA_REV1;
+ if (IsCsr) {
+ SequenceId = V_SA_VCU_SEQID_READ_CSR_REV1;
+ } else {
+ SequenceId = V_SA_VCU_SEQID_READ_MMIO_REV1;
+ }
+ }
+ } else {
+ if (IsWrite) {
+ DataOpCode = V_SA_VCU_OPCODE_WRITE_DATA_REV2;
+ if (IsCsr) {
+ SequenceId = V_SA_VCU_SEQID_WRITE_CSR_REV2;
+ } else {
+ SequenceId = V_SA_VCU_SEQID_WRITE_MMIO_REV2;
+ }
+ } else {
+ DataOpCode = V_SA_VCU_OPCODE_READ_DATA_REV2;
+ if (IsCsr) {
+ SequenceId = V_SA_VCU_SEQID_READ_CSR_REV2;
+ } else {
+ SequenceId = V_SA_VCU_SEQID_READ_MMIO_REV2;
+ }
+ }
+ }
+ if ((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId == EnumHswA0)) {
+ SendVcuApiCmd (MchBar, V_SA_VCU_OPCODE_OPEN_SEQ_REV1, SequenceId);
+ } else {
+ SendVcuApiCmd (MchBar, V_SA_VCU_OPCODE_OPEN_SEQ_REV2, SequenceId);
+ }
+ SendVcuApiCmd (MchBar, OpCode, Address);
+ SendVcuApiCmd (MchBar, DataOpCode, WriteData);
+ VcuData = Mmio32 (MchBar, R_SA_MCHBAR_VCU_MAILBOX_DATA_OFFSET);
+ if ((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId == EnumHswA0)) {
+ SendVcuApiCmd (MchBar, V_SA_VCU_OPCODE_CLOSE_SEQ_REV1, SequenceId);
+ } else {
+ SendVcuApiCmd (MchBar, V_SA_VCU_OPCODE_CLOSE_SEQ_REV2, SequenceId);
+ }
+
+ return VcuData;
+}
+
+VOID
+SendVcuApiCmd (
+ IN UINT32 MchBar,
+ IN UINT32 Interface,
+ IN UINT32 Data
+ )
+/**
+ Send one command to VCU MailBox
+
+ @param[in] MchBar - MCHBAR value
+ @param[in] Interface - Interface number
+ @param[in] Data - Data value
+**/
+{
+ UINT32 ResponseCounter;
+ UINT16 ResponseCode;
+ UINT32 BusyCounter;
+ UINT32 RunBusy;
+ BOOL BusyStatus;
+
+ ResponseCode = V_SA_VCU_RESPONSE_SUCCESS;
+ for (ResponseCounter = 0; ResponseCounter < V_SA_VCU_RESPONSE_RETRY_LIMIT; ResponseCounter++) {
+ Mmio32 (MchBar, R_SA_MCHBAR_VCU_MAILBOX_DATA_OFFSET) = Data;
+ Mmio32 (MchBar, R_SA_MCHBAR_VCU_MAILBOX_INTERFACE_OFFSET) = (Interface | B_SA_MCHBAR_VCU_STATUS_RUN_BUSY);
+ BusyStatus = FALSE;
+ for (BusyCounter = 0; BusyCounter < V_SA_VCU_STATUS_BUSY_LIMIT; BusyCounter++) {
+ RunBusy = Mmio32 (MchBar, R_SA_MCHBAR_VCU_MAILBOX_INTERFACE_OFFSET);
+ BusyStatus = (RunBusy & B_SA_MCHBAR_VCU_STATUS_RUN_BUSY) ? TRUE : FALSE;
+ if (BusyStatus == FALSE) {
+ break;
+ }
+ }
+
+ if (BusyStatus) {
+ DEBUG ((EFI_D_INFO, "VCU Busy Timeout after %d tries: MCHBAR=%8.8X. Interface=%8.8X. Data=%4.4X.\n", BusyCounter, MchBar, Interface, Data));
+ }
+ ResponseCode = Mmio16 (MchBar, R_SA_MCHBAR_VCU_MAILBOX_INTERFACE_OFFSET);
+ if (ResponseCode == V_SA_VCU_RESPONSE_SUCCESS) {
+ break;
+ }
+ }
+
+ if (ResponseCode != V_SA_VCU_RESPONSE_SUCCESS) {
+ DEBUG ((EFI_D_ERROR, "ERROR: VCU Response Error after %d tries: MCHBAR=%8.8X. Interface=%4.4X. Data=%8.8X. ResponseCode=%4.4X\n", ResponseCounter, MchBar, Interface, Data, ResponseCode));
+ }
+
+ return;
+}
+#endif // DMI_FLAG || PEG_FLAG
+
+#ifdef PEG_FLAG
+
+UINT8
+GetMaxBundles (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN UINT8 PegFunc,
+ IN UINT8 HwStrap
+ )
+/**
+ GetMaxBundles: Get the maximum bundle numbers for the corresponding PEG
+
+ @param[in] PeiServices - Pointer to the PEI services table
+ @param[in] PegFunc - Points to PEG0/PEG1/PEG2/...
+ @param[in] HwStrap - Points to PEG configuration information [x16_x0_x0/x8_x8_x0/x8_x4_x4/...]
+
+ @retval - MaxBndlPwrdnCount [Maximun number of bundles for this HW configuration]
+**/
+{
+ UINT8 MaxBndlPwrdnCount;
+
+ MaxBndlPwrdnCount = 0;
+
+ DEBUG ((EFI_D_INFO, "In GetMaxBundles procedure\n"));
+
+ if (PegFunc == 0) { // PEG10
+ if (HwStrap == SA_PEG_x16_x0_x0) {
+ MaxBndlPwrdnCount = 8;
+ } else {
+ MaxBndlPwrdnCount = 4;
+ }
+ } else if (PegFunc == 1) { // PEG11
+ if (HwStrap == SA_PEG_x8_x8_x0) {
+ MaxBndlPwrdnCount = 4;
+ } else if (HwStrap == SA_PEG_x8_x4_x4) {
+ MaxBndlPwrdnCount = 2;
+ }
+ } else if (PegFunc == 2) { // PEG12
+ if (HwStrap == SA_PEG_x8_x4_x4) {
+ MaxBndlPwrdnCount = 2;
+ }
+ }
+
+ DEBUG ((EFI_D_INFO, "MaxBndlPwrdnCount = %d\n", MaxBndlPwrdnCount));
+ return MaxBndlPwrdnCount;
+}
+
+VOID
+PowerDownUnusedBundles (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN UINT8 PegFunc,
+ IN UINT8 HwStrap,
+ IN UINT8 BndlPwrdnCount
+ )
+/**
+ PowerDownUnusedBundles: Program the PEG BundleSpare registers for power on sequence [PowerOff unused bundles for PEGs]
+
+ @param[in] PeiServices - Pointer to the PEI services table
+ @param[in] PegFunc - Points to PEG0/PEG1/PEG2/...
+ @param[in] HwStrap - Points to PEG configuration information [x16_x0_x0/x8_x8_x0/x8_x4_x4/...]
+ @param[in] BndlPwrdnCount - Points to how many bundles are unused and should be powered down
+**/
+{
+ BOOLEAN PegLaneReversal;
+ UINT8 BndlPwrdnFirst;
+
+ UINT8 i;
+ UINT8 j;
+
+ PegLaneReversal = FALSE;
+ BndlPwrdnFirst = 0;
+
+ DEBUG ((EFI_D_INFO, "In PowerDownUnusedBundles sequence\n"));
+
+ if (BndlPwrdnCount == 0) {
+ ///
+ /// If all lanes are used. Do nothing
+ ///
+ DEBUG ((EFI_D_INFO, "All lanes are used. Do nothing.\n"));
+ return;
+ }
+
+ if ((MmPci32 (0, SA_PEG_BUS_NUM, SA_PEG10_DEV_NUM, SA_PEG10_FUN_NUM, R_SA_PEG_PEGTST_OFFSET) & BIT20) != 0) {
+ DEBUG ((EFI_D_INFO, "PegLaneReversal is true\n"));
+ PegLaneReversal = TRUE;
+ }
+
+ if (PegFunc == 0) { // PEG10
+ if (HwStrap == SA_PEG_x16_x0_x0) {
+ if (!PegLaneReversal) {
+ BndlPwrdnFirst = 8 - BndlPwrdnCount;
+ } else {
+ BndlPwrdnFirst = 0;
+ }
+ } else {
+ if (!PegLaneReversal) {
+ BndlPwrdnFirst = 4 - BndlPwrdnCount;
+ } else {
+ BndlPwrdnFirst = 4;
+ }
+ }
+ } else if (PegFunc == 1) { // PEG11
+ if (HwStrap == SA_PEG_x8_x8_x0) {
+ if (!PegLaneReversal) {
+ BndlPwrdnFirst = 8 - BndlPwrdnCount;
+ } else {
+ BndlPwrdnFirst = 0;
+ }
+ } else if (HwStrap == SA_PEG_x8_x4_x4) {
+ if (!PegLaneReversal) {
+ BndlPwrdnFirst = 6 - BndlPwrdnCount;
+ } else {
+ BndlPwrdnFirst = 2;
+ }
+ }
+ } else if (PegFunc == 2) { // PEG12
+ if (HwStrap == SA_PEG_x8_x4_x4) {
+ if (!PegLaneReversal) {
+ BndlPwrdnFirst = 8 - BndlPwrdnCount;
+ } else {
+ BndlPwrdnFirst = 0;
+ }
+ }
+ }
+
+ ///
+ /// Power down unused lanes per request
+ ///
+ DEBUG ((EFI_D_INFO, "BNDL_PWRDN PEG%d%d[%d:%d]\n", 0, PegFunc, BndlPwrdnFirst, (BndlPwrdnFirst+BndlPwrdnCount-1)));
+ for (i = BndlPwrdnFirst, j=1; j <= BndlPwrdnCount; i++, j++) {
+ MmPci32Or (0, SA_PEG_BUS_NUM, SA_PEG10_DEV_NUM, SA_PEG10_FUN_NUM, R_SA_PEG_BND0SPARE_OFFSET + (i * BUNDLE_STEP), BIT31);
+ }
+
+ return;
+}
+#endif // PEG_FLAG
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/PciExpressInit.h b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/PciExpressInit.h
new file mode 100644
index 0000000..2ca1bbe
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/PciExpressInit.h
@@ -0,0 +1,452 @@
+/** @file
+ PciExpressInit header file
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#ifndef _PCIEXPRESS_INIT_H_
+#define _PCIEXPRESS_INIT_H_
+
+#include "EdkIIGluePeim.h"
+#include "SaAccess.h"
+#include "PchAccess.h"
+#include "EdkIIGluePcdPciExpressLib.h"
+#include "EdkIIGlueConfig.h"
+#include "Pci30.h"
+#include "CpuRegs.h"
+#include "CpuPlatformLib.h"
+
+///
+/// Driver Consumed PPI Prototypes
+///
+#include EFI_PPI_DEPENDENCY (Stall)
+#include EFI_PPI_DEPENDENCY (SaPlatformPolicy)
+
+#define PEG_AUTO 0
+#define PEG_GEN1 1
+#define PEG_GEN2 2
+#define PEG_GEN3 3
+
+#define DMI_GEN1 1
+#define DMI_GEN2 2
+
+#define LANE_STEP 0x10
+#define BUNDLE_STEP 0x20
+
+typedef struct {
+ UINT8 Bus;
+ UINT8 Device;
+ UINT8 Function;
+ UINT8 Index;
+ BOOLEAN PresenceDetect;
+ UINT8 MaxLinkWidth;
+ UINT8 EndpointMaxLinkSpeed;
+} PEG_PORT;
+
+///
+/// Data structure used in Sampler Calibration
+///
+#pragma pack(1)
+typedef struct _SAMPLE {
+ UINT8 Data;
+ UINT16 Count;
+} DATA_SAMPLE;
+#pragma pack()
+
+#define MAX_CODES 10
+
+///
+/// Data structure used in Preset Search
+///
+typedef struct _PRESET_DATA {
+ UINT8 Preset;
+ UINTN TimingMargin[SA_PEG_MAX_BUNDLE];
+ UINTN VoltageUpMargin[SA_PEG_MAX_BUNDLE];
+ UINTN VoltageDownMargin[SA_PEG_MAX_BUNDLE];
+} PRESET_DATA;
+
+#define MAX_PRESETS 3
+
+#define SA_PEG_SAMPLER_ITERATIONS 500
+///
+/// Common register access macros - use either DMIBAR or PEG10
+///
+#define SaMmio32AndThenOr(BaseAddr, Device, Register, AndData, OrData) \
+ if (BaseAddr != 0) { \
+ Mmio32AndThenOr (BaseAddr, Register, AndData, OrData); \
+ } else { \
+ MmPci32AndThenOr (0, 0, Device, 0, Register, AndData, OrData); \
+ }
+
+#ifdef PEG_FLAG
+VOID
+BubbleSort (
+ IN OUT DATA_SAMPLE Array[]
+ )
+/**
+ Bubble sort from DATA_SAMPLE
+
+ @param[in, out] - Array[]: array of DATA_SAMPLE
+
+ @retval None
+**/
+;
+
+UINT32
+GetMiddleValue (
+ IN OUT DATA_SAMPLE Array[]
+ )
+/**
+ Get Middle Value from DATA_SAMPLE
+
+ @param[in, out] - Array[]: array of DATA_SAMPLE
+
+ @retval UINT32 : Middle Value of DATA_SAMPLE
+**/
+;
+
+VOID
+SetLoadBus (
+ IN UINT32 DmiBar,
+ IN UINTN Dev,
+ IN UINTN Lane,
+ IN UINT32 LoadSel,
+ IN UINT32 LoadData,
+ IN UINT8 CpuSteppingId
+ )
+/**
+ Set Load Bus
+
+ @param[in] DmiBar - DMIBAR address
+ @param[in] Dev - Device Number
+ @param[in] Lane - Number of Lane
+ @param[in] LoadSel - Load selection value
+ @param[in] LoadData - Load Data
+ @param[in] CpuSteppingId - CPUID.1.EAX[3:0], CPU stepping ID
+
+ @retval None
+**/
+;
+
+UINT32
+GetMonBus (
+ IN UINT32 DmiBar,
+ IN UINTN Dev,
+ IN UINTN Lane,
+ IN UINT32 LoadSel,
+ IN UINT8 CpuSteppingId
+ )
+/**
+ Get monitor bus from the lane selected
+
+ @param[in] DmiBar - DMIBAR address
+ @param[in] Dev - Device number
+ @param[in] Lane - Number of Lane
+ @param[in] LoadSel - Load selection value
+ @param[in] LoadData - Load selecttion data
+ @param[in] CpuSteppingId - CPUID.1.EAX[3:0], CPU stepping ID
+
+ @retval UINT32 - Load bus address
+**/
+;
+
+VOID
+DumpSamplerValues (
+ IN UINT32 DmiBar,
+ IN UINT8 CpuSteppingId,
+ IN UINTN Dev,
+ IN UINTN LanesCount
+ )
+/**
+ Dump Sampler Values
+
+ @param[in] DmiBar - DMIBAR address
+ @param[in] CpuSteppingId - CPUID.1.EAX[3:0], CPU stepping ID
+ @param[in] Dev - Device number
+ @param[in] LanesCount - Value of Lanes
+
+ @retval None
+**/
+;
+#endif // PEG_FLAG
+
+#if defined(DMI_FLAG) || defined(PEG_FLAG)
+VOID
+PegDmiRecipe (
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi,
+ IN UINT32 MchBar,
+ IN UINT32 DmiBar,
+ IN UINTN Dev,
+ IN UINT8 SwingControl
+ )
+/**
+ Perform PEG/DMI PCIe Recipe steps
+
+ @param[in] SaPlatformPolicyPpi - Pointer to SA_PLATFORM_POLICY_PPI
+ @param[in] MchBar - MCHBAR or zero if called for PEG
+ @param[in] DmiBar - DMIBAR or zero if called for PEG
+ @param[in] Dev - PEG device number: 1 for PEG10, 0 if called for DMI.
+ @param[in] SwingControl - 1 = Half, 2 = Full
+
+ @retval None
+**/
+;
+#endif // DMI_FLAG || PEG_FLAG
+
+#ifdef PEG_FLAG
+VOID
+ConfigurePegGenX (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_STALL_PPI *StallPpi,
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi,
+ IN PEG_PORT *PegPortTable,
+ IN UINTN TableIndex,
+ IN UINT8 CpuSteppingId,
+ IN UINT8 Gen3Capable
+ )
+/**
+ Configure PEG GenX mode
+
+ @param[in] PeiServices - Pointer to the PEI services table
+ @param[in] StallPpi - Pointer to PEI_STALL_PPI
+ @param[in] SaPlatformPolicyPpi - Pointer to SA_PLATFORM_POLICY_PPI
+ @param[in] PegPortTable - Pointer to PEG_PORT array
+ @param[in] TableIndex - Index in PEG_PORT array
+ @param[in] CpuSteppingId - CPU stepping
+ @param[in] Gen3Capable - Selected PEG_PORT is Gen3 capable
+
+ @retval None
+**/
+;
+
+VOID
+AdditionalPegProgramSteps (
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi,
+ IN UINT8 PegBus,
+ IN UINT8 PegDev,
+ IN UINT8 PegFunc
+ )
+/**
+ Additional PEG Programming Steps at PEI
+
+ @param[in] SaPlatformPolicyPpi - SaPlatformPolicyPpi to access the GtConfig related information
+ @param[in] PegBus - Pci Bus Number
+ @param[in] PegDev - Pci Device Number
+ @param[in] PegFunc - Pci Func Number
+**/
+;
+
+VOID
+MaximizeSharedCredits (
+ )
+/**
+ Maximize the dedicated credits for the PEG controllers
+**/
+;
+
+VOID
+RebalancePegPerformanceCredits (
+ IN BOOLEAN DisablePeg10,
+ IN BOOLEAN DisablePeg11,
+ IN BOOLEAN DisablePeg12
+ )
+/**
+ Rebalance Credits when PEG controllers so that no stavation occurs
+
+ @param[in] DisablePeg10 - Peg10 disable/enable status
+ @param[in] DisablePeg11 - Peg11 disable/enable status
+ @param[in] DisablePeg12 - Peg12 disable/enable status
+
+ @retval None
+**/
+;
+
+VOID
+PegPreDetectionSteps (
+ IN UINT8 PegBus,
+ IN UINT8 PegDev,
+ IN UINT8 PegFunc,
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi
+ )
+/**
+ Additional PEG Programming Steps before PEG detection at PEI
+
+ @param[in] PegBus - Pci Bus Number
+ @param[in] PegDev - Pci Device Number
+ @param[in] PegFunc - Pci Func Number
+ @param[in] SaPlatformPolicyPpi - Pointer to SA_PLATFORM_POLICY_PPI
+**/
+;
+#endif // PEG_FLAG
+
+#if defined(DMI_FLAG) || defined(PEG_FLAG)
+UINT32
+SendVcuApiSequence (
+ IN UINT32 MchBar,
+ IN UINT32 Address,
+ IN UINT16 OpCode,
+ IN UINT32 WriteData
+ )
+/**
+ Send one sequence to VCU MailBox
+
+ @param[in] MchBar - MCHBAR value
+ @param[in] Address - Target address
+ @param[in] OpCode - OpCode number
+ @param[in] WriteData - Data value (only used if OpCode is a write)
+**/
+;
+
+VOID
+SendVcuApiCmd (
+ IN UINT32 MchBar,
+ IN UINT32 Interface,
+ IN UINT32 Data
+ )
+/**
+ Send one command to VCU MailBox
+
+ @param[in] MchBar - MCHBAR value
+ @param[in] Interface - Interface number
+ @param[in] Data - Data value
+**/
+;
+
+VOID
+ReportPcieLinkStatus (
+ IN UINT8 PegBus,
+ IN UINT8 PegDev,
+ IN UINT8 PegFunc
+)
+/**
+ This function reports a PEG controller's link status
+
+ @param[in] PegBus - Peg Bus
+ @param[in] PegDev - Peg Device
+ @param[in] PegFunc - Peg Function
+
+ @retval None
+**/
+;
+
+VOID
+WaitForVc0Negotiation (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_STALL_PPI *StallPpi,
+ IN UINT8 PegBus,
+ IN UINT8 PegDev,
+ IN UINT8 PegFunc
+)
+/**
+ This function prints the time required for VC0 Negotiation Pending to be cleared. Quits after 100 msec.
+
+ @param[in] PeiServices - Pointer to the PEI services table
+ @param[in] StallPpi - Pointer to PEI_STALL_PPI
+ @param[in] PegBus - Peg Bus
+ @param[in] PegDev - Peg Device
+ @param[in] PegFunc - Peg Function
+
+ @retval None
+**/
+;
+
+UINT32
+PcieFindCapId (
+ IN UINT8 Bus,
+ IN UINT8 Device,
+ IN UINT8 PegFunc,
+ IN UINT8 CapId
+ )
+/**
+ Find the Offset to a given Capabilities ID
+ CAPID list:
+ 0x01 = PCI Power Management Interface
+ 0x04 = Slot Identification
+ 0x05 = MSI Capability
+ 0x10 = PCI Express Capability
+
+ @param[in] Bus - Pci Bus Number
+ @param[in] Device - Pci Device Number
+ @param[in] PegFunc - Pci Function Number
+ @param[in] CapId - CAPID to search for
+
+ @retval 0 - CAPID not found
+ @retval Other - CAPID found, Offset of desired CAPID
+**/
+;
+
+VOID
+ProgramPreset (
+ IN UINT8 Direction,
+ IN UINT8 PresetValue,
+ IN UINT8 PegFunc,
+ IN UINT8 Lane
+ )
+/**
+ Program PEG Gen3 preset value
+
+ @param[in] Direction - 0 = Root Port, 1 = End Point
+ @param[in] PresetValue - Preset value to program
+ @param[in] PegFunc - Peg function number to be configured
+ @param[in] Lane - Lane to be configured
+
+ @retval None
+**/
+;
+
+#endif // DMI_FLAG || PEG_FLAG
+
+#ifdef PEG_FLAG
+UINT8
+GetMaxBundles (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN UINT8 PegFunc,
+ IN UINT8 HwStrap
+ )
+/**
+ GetMaxBundles: Get the maximum bundle numbers for the corresponding PEG
+
+ @param[in] PeiServices - Pointer to the PEI services table
+ @param[in] PegFunc - Points to PEG0/PEG1/PEG2/...
+ @param[in] HwStrap - Points to PEG configuration information [x16_x0_x0/x8_x8_x0/x8_x4_x4/...]
+
+ @retval - MaxBndlPwrdnCount [Maximun number of bundles for this HW configuration]
+**/
+;
+
+VOID
+PowerDownUnusedBundles (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN UINT8 PegFunc,
+ IN UINT8 HwStrap,
+ IN UINT8 BndlPwrdnCount
+ )
+/**
+ PowerDownUnusedBundles: Program the PEG BundleSpare registers for power on sequence [PowerOff unused bundles for PEGs]
+
+ @param[in] PeiServices - Pointer to the PEI services table
+ @param[in] PegFunc - Points to PEG0/PEG1/PEG2/...
+ @param[in] HwStrap - Points to PEG configuration information [x16_x0_x0/x8_x8_x0/x8_x4_x4/...]
+ @param[in] BndlPwrdnCount - Points to how many bundles are unused and should be powered down
+
+ @retval - None
+**/
+;
+#endif // PEG_FLAG
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/PcieTraining.c b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/PcieTraining.c
new file mode 100644
index 0000000..26f16be
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/PcieTraining.c
@@ -0,0 +1,628 @@
+/** @file
+ This driver trains the PEG interface.
+
+@copyright
+ Copyright (c) 2012 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+#include "PcieTraining.h"
+
+#ifdef PEG_FLAG
+
+UINT16
+GetErrorTarget (
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi
+ )
+{
+ UINT16 ErrorTarget;
+
+ if ((SaPlatformPolicyPpi->Revision >= SA_PLATFORM_POLICY_PPI_REVISION_3) &&
+ (SaPlatformPolicyPpi->PcieConfig->PegGen3PresetSearchErrorTarget >= 1)) {
+ ErrorTarget = SaPlatformPolicyPpi->PcieConfig->PegGen3PresetSearchErrorTarget;
+ } else {
+ ErrorTarget = 4;
+ }
+
+ return ErrorTarget;
+}
+
+VOID
+GetPortInfo (
+ OUT PORT_INFO *PortInfoList,
+ OUT UINT8 *PortInfoListLength,
+ OUT BOOLEAN *SkipBundle0
+ )
+{
+ UINT32 HwStrap;
+ UINT8 PegBus;
+ UINT8 PegDev;
+ UINT8 PcieController;
+ UINT8 Index;
+ UINT8 Lane;
+ UINT8 LaneIndex;
+ UINT8 FurcationSetup[SA_PEG_MAX_FUN];
+ UINT8 PcieControllerList[SA_PEG_MAX_FUN];
+ UINT8 NumberToCheck;
+ UINT8 StartLane;
+ UINT8 Width;
+ UINT32 Lcap;
+ UINT32 CapOffset;
+ CPU_FAMILY CpuFamilyId;
+ CPU_STEPPING CpuSteppingId;
+
+ PegBus = SA_MC_BUS;
+ PegDev = 1;
+ HwStrap = (McD1PciCfg32(R_SA_PEG_FUSESCMN_OFFSET) >> 16) & 0x3;
+ CpuFamilyId = GetCpuFamily();
+ CpuSteppingId = GetCpuStepping();
+
+ switch(HwStrap) {
+ case SA_PEG_x8_x4_x4:
+ FurcationSetup[0] = 8;
+ FurcationSetup[1] = 4;
+ FurcationSetup[2] = 4;
+ NumberToCheck = 3;
+ break;
+ case SA_PEG_x8_x8_x0:
+ FurcationSetup[0] = 8;
+ FurcationSetup[1] = 8;
+ NumberToCheck = 2;
+ break;
+ default:
+ case SA_PEG_x16_x0_x0:
+ FurcationSetup[0] = 16;
+ NumberToCheck = 1;
+ break;
+ }
+
+ ///
+ /// Figure out which PcieControllers are enabled
+ ///
+ (*PortInfoListLength) = 0;
+ for (PcieController = 0; PcieController < NumberToCheck; PcieController++) {
+ ///
+ /// Sanity check to make sure width > 0
+ ///
+ if (FurcationSetup[PcieController] == 0) {
+ continue;
+ }
+
+ ///
+ /// Check to make sure the Root Port Exists
+ ///
+ if (MmPci16 (0, PegBus, PegDev, PcieController, PCI_VID) == 0xFFFF) {
+ continue;
+ }
+
+ ///
+ /// Add the PcieController to the list of enabled controllers
+ ///
+ PcieControllerList[(*PortInfoListLength)] = PcieController;
+ (*PortInfoListLength)++;
+ }
+
+ ///
+ /// If needed, skip Bundle 0's preset search and use Bundle 1's preset instead.
+ ///
+ (*SkipBundle0) = FALSE;
+ if (((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId < EnumHswC0)) ||
+ ((CpuFamilyId == EnumCpuCrw) && (CpuSteppingId < EnumCrwC0))) {
+ (*SkipBundle0) = TRUE;
+ }
+ if ((*SkipBundle0)) {
+ DEBUG ((EFI_D_INFO, "Skipping each controller's Lane 0-1 preset searches; using their Lane 2 preset instead.\n"));
+ }
+
+ StartLane = 0;
+ for (Index = 0; Index < (*PortInfoListLength); Index++) {
+ PcieController = PcieControllerList[Index];
+
+ ///
+ /// Get information for the current port
+ ///
+ (PortInfoList[Index]).EnableMargin = TRUE;
+ (PortInfoList[Index]).FoundUsablePreset = FALSE;
+ (PortInfoList[Index]).PegPort.Bus = PegBus;
+ (PortInfoList[Index]).PegPort.Device = PegDev;
+ (PortInfoList[Index]).PegPort.Function = PcieController;
+ (PortInfoList[Index]).PegPort.Index = PcieController;
+ (PortInfoList[Index]).PegPort.EndpointMaxLinkSpeed = 0;
+ ReportPcieLinkStatus (PegBus, PegDev, PcieController);
+ Width = GetNegotiatedWidth(&((PortInfoList[Index]).PegPort));
+ (PortInfoList[Index]).LaneListLength = Width;
+ for (Lane = 0, LaneIndex = 0; Lane < Width; Lane++) {
+ if ((*SkipBundle0)) {
+ if ((Lane == 0) || (Lane == 1)) {
+ (PortInfoList[Index]).LaneListLength--;
+ continue;
+ }
+ }
+ if (LaneIndex < SA_PEG_MAX_LANE) {
+ (PortInfoList[Index]).LaneList[LaneIndex] = (Lane + StartLane);
+ }
+ LaneIndex++;
+ }
+
+ ///
+ /// Check that both root port and endpoint support Gen3
+ ///
+ Lcap = MmPci32 (0, PegBus, PegDev, PcieController, R_SA_PEG_LCAP_OFFSET);
+ if ((Lcap & 0x0F) != 3) {
+ DEBUG ((EFI_D_INFO, " PEG%x%x (%x:%x:%x) - Root Port is not Gen3-capable. Max Link Speed = %d.\n",
+ PegDev, PcieController, PegBus, PegDev, PcieController, Lcap & 0x0F));
+ (PortInfoList[Index]).LinkIsGen3Capable = FALSE;
+ } else {
+
+ DEBUG ((EFI_D_INFO, " PEG%x%x (%x:%x:%x) - Root Port is Gen3-capable.\n",
+ PegDev, PcieController, PegBus, PegDev, PcieController));
+
+ ///
+ /// Set PEG PortBus = 1 to Read Endpoint.
+ ///
+ MmPci32AndThenOr (0, PegBus, PegDev, PcieController, PCI_PBUS, 0xFF0000FF, 0x00010100);
+
+ ///
+ /// A config write is required in order for the device to re-capture the Bus number,
+ /// according to PCI Express Base Specification, 2.2.6.2
+ /// Write to a read-only register VendorID to not cause any side effects.
+ ///
+ MmPci16 (0, 1, 0, 0, PCI_VID) = 0;
+
+ ///
+ /// Save end point vendor id and device id
+ ///
+ (PortInfoList[Index]).EndPointVendorIdDeviceId = MmPci32 (0, 1, 0, 0, 0);
+
+ ///
+ /// Negotiation Done?
+ ///
+ if ((MmPci16 (0, PegBus, PegDev, PcieController, R_SA_PEG_VC0RSTS_OFFSET) & BIT1) != 0) {
+ (PortInfoList[Index]).LinkIsGen3Capable = FALSE;
+ DEBUG ((EFI_D_INFO, " PEG%x%x (%x:%x:%x) - VC0 negotiation is pending! Skipping endpoint.\n",
+ PegDev, PcieController, PegBus, PegDev, PcieController, Lcap & 0x0F));
+ ReportPcieLinkStatus (PegBus, PegDev, PcieController);
+ } else {
+ ///
+ /// Get the pointer to the Port PCI Express Capability Structure.
+ ///
+ CapOffset = PcieFindCapId (1, 0, 0, EFI_PCI_CAPABILITY_ID_PCIEXP);
+ if (CapOffset == 0) {
+ (PortInfoList[Index]).LinkIsGen3Capable = FALSE;
+ DEBUG ((EFI_D_INFO, " PEG%x%x (%x:%x:%x) - Endpoint is not Gen3-capable. No PCIe Capability found.\n",
+ PegDev, PcieController, PegBus, PegDev, PcieController, Lcap & 0x0F));
+ } else {
+ Lcap = MmPci32 (0, 1, 0, 0, CapOffset + 0x0C);
+ (PortInfoList[Index]).PegPort.EndpointMaxLinkSpeed = Lcap & 0x0F;
+ if ((Lcap & 0x0F) < 3) {
+ (PortInfoList[Index]).LinkIsGen3Capable = FALSE;
+ DEBUG ((EFI_D_INFO, " PEG%x%x (%x:%x:%x) - Endpoint is not Gen3-capable. Max Link Speed = %d.\n",
+ PegDev, PcieController, PegBus, PegDev, PcieController, Lcap & 0x0F));
+ } else {
+ (PortInfoList[Index]).LinkIsGen3Capable = TRUE;
+ DEBUG ((EFI_D_INFO, " PEG%x%x (%x:%x:%x) - Endpoint is Gen3-capable\n",
+ PegDev, PcieController, PegBus, PegDev, PcieController, Lcap & 0x0F));
+ }
+ }
+ }
+ ///
+ /// Restore bus numbers on the PEG bridge.
+ ///
+ MmPci32And (0, PegBus, PegDev, PcieController, PCI_PBUS, 0xFF0000FF);
+ }
+
+ StartLane += FurcationSetup[PcieController];
+ } ///< End of for each port
+
+ return;
+}
+
+EFI_STATUS
+RunMarginTest (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi,
+ IN SA_DATA_HOB *SaDataHob,
+ IN PEI_STALL_PPI *StallPpi,
+ IN UINT32 MonitorPort,
+ IN PORT_INFO *PortInfoList,
+ IN UINT8 PortInfoListLength,
+ IN MARGIN_TEST_TYPE MarginTest,
+ OUT INT32 *Margins
+ )
+{
+ EFI_STATUS Status;
+ UINT8 *LaneList;
+ UINT8 Lane;
+ UINT8 PortListIndex;
+ UINT8 OriginalSpeed;
+ UINT8 OriginalWidth;
+ UINT8 LaneListLength;
+ PEG_PORT *PegPort;
+
+ Status = EFI_SUCCESS;
+
+ ///
+ /// Initialize Margins to -1. Since -1 is an invalid value, we know that lane wasn't tested if its margin == -1
+ ///
+ for (Lane = 0; Lane < SA_PEG_MAX_LANE; Lane++) {
+ Margins[Lane] = -1;
+ }
+
+ for (PortListIndex = 0; PortListIndex < PortInfoListLength; PortListIndex++) {
+ ///
+ /// Test all lanes associated with this the current port
+ ///
+ LaneList = &((PortInfoList[PortListIndex]).LaneList[0]);
+ LaneListLength = (PortInfoList[PortListIndex]).LaneListLength;
+ PegPort = &((PortInfoList[PortListIndex]).PegPort);
+ if ((PortInfoList[PortListIndex]).EnableMargin == FALSE ||
+ (PortInfoList[PortListIndex]).SkipMargin == TRUE) {
+ continue;
+ }
+
+ if ((PortInfoList[PortListIndex]).LinkIsGen3Capable) {
+ OriginalSpeed = 3;
+ } else {
+ OriginalSpeed = GetLinkSpeed (PegPort);
+ }
+ OriginalWidth = GetNegotiatedWidth (PegPort);
+
+ switch (MarginTest) {
+ case LaneLevelRxJitter:
+ Status = LaneLevelJitterTest (
+ PeiServices,
+ SaPlatformPolicyPpi,
+ SaDataHob,
+ StallPpi,
+ MonitorPort,
+ LaneList,
+ LaneListLength,
+ PegPort,
+ OriginalSpeed,
+ OriginalWidth,
+ FALSE,
+ Margins
+ );
+ break;
+ default:
+ DEBUG ((EFI_D_WARN, "Invalid Margin Test Requested.\n"));
+ break;
+ }
+ }
+
+ return Status;
+}
+
+EFI_STATUS
+LaneLevelJitterTest (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi,
+ IN SA_DATA_HOB *SaDataHob,
+ IN PEI_STALL_PPI *StallPpi,
+ IN UINT32 MonitorPort,
+ IN UINT8 *LaneList,
+ IN UINT8 LaneListLength,
+ IN PEG_PORT *PegPort,
+ IN UINT8 OriginalLinkSpeed,
+ IN UINT8 OriginalLinkWidth,
+ IN BOOLEAN TxJitterTest,
+ OUT INT32 *Margins
+ )
+{
+ EFI_STATUS Status;
+ UINT8 LaneListIndex;
+ INT8 Jitter;
+ UINT32 Errors;
+ UINT32 PreviousErrors;
+ UINT8 Lane;
+ UINT32 RecoveryCount;
+ BOOLEAN AbortMargin;
+ UINT16 ErrorTarget;
+ UINT8 ConvergenceCounter;
+ INT32 LastMargin;
+ INT32 MarginDifference;
+ INT32 StartJitter;
+ INT8 MarginDirection;
+ UINT8 RepeatCount;
+
+ ErrorTarget = GetErrorTarget (SaPlatformPolicyPpi);
+
+ for (LaneListIndex = 0; LaneListIndex < LaneListLength; LaneListIndex++) {
+ Lane = LaneList[LaneListIndex];
+ Errors = 0;
+ AbortMargin = FALSE;
+ Margins[Lane] = 0;
+ MarginDirection = 1;
+
+ if (TxJitterTest) {
+ ConfigureTxJitterMux (Lane, SaPlatformPolicyPpi->PlatformData->MchBar);
+ EnableTxJitterInjection (Lane, TRUE);
+ }
+
+ ///
+ /// Determine value to start at
+ ///
+ if (LaneListIndex == 0) {
+ StartJitter = 0;
+ } else {
+ StartJitter = (Margins[LaneList[LaneListIndex - 1]] / 100) - JITTER_MARGIN_INITIAL_OFFSET;
+ if (StartJitter < 0) {
+ StartJitter = 0;
+ }
+ }
+
+ ConvergenceCounter = 0;
+ LastMargin = -1;
+ RepeatCount = 0;
+ while (ConvergenceCounter < MARGIN_CONVERGANCE_MIN_MATCHES && RepeatCount < MARGIN_CONVERGANCE_MAX_REPEATS) {
+ RepeatCount++;
+ ///
+ /// Determine whether to go up or down from starting point
+ ///
+ AbortMargin = FALSE;
+ RecoveryCount = SaPcieGetErrorCount (MonitorPort, PegPort->Function);
+ Status = SetJitterTolerance (&Lane, 1, (UINT8) StartJitter);
+ ASSERT_EFI_ERROR (Status);
+
+ Errors = SaPciePointTest (PeiServices, SaPlatformPolicyPpi, StallPpi, MonitorPort, PegPort, RecoveryCount);
+ if (Errors >= ErrorTarget) {
+ if (StartJitter == 0) {
+ Margins[Lane] = 0;
+ AbortMargin = TRUE;
+ } else {
+ MarginDirection = -1;
+ }
+ } else {
+ MarginDirection = 1;
+ }
+ for (Jitter = (INT8) (StartJitter + MarginDirection);
+ Jitter < JITTER_LENGTH &&
+ Jitter >= 0 &&
+ (!AbortMargin);
+ Jitter = (INT8) (Jitter + MarginDirection)) {
+ ///
+ /// Check for a link downgrade
+ ///
+ AbortMargin = LinkIsDowngraded (PegPort, OriginalLinkSpeed, OriginalLinkWidth);
+ if (AbortMargin) {
+ if (MarginDirection < 0) {
+ LastMargin = -1;
+ ConvergenceCounter = 0;
+ StartJitter = 0;
+ MarginDirection = 1;
+ } else {
+ if (Jitter == 0) {
+ Margins[Lane] = 0;
+ } else {
+ Margins[Lane] = (Jitter - 1) * 100;
+ }
+ }
+ break;
+ }
+
+ ///
+ /// Get initial recovery count
+ ///
+ RecoveryCount = SaPcieGetErrorCount (MonitorPort, PegPort->Function);
+ Status = SetJitterTolerance (&Lane, 1, Jitter);
+ ASSERT_EFI_ERROR (Status);
+
+ PreviousErrors = Errors;
+ Errors = SaPciePointTest (PeiServices, SaPlatformPolicyPpi, StallPpi, MonitorPort, PegPort, RecoveryCount);
+ if (MarginDirection < 0) {
+ if (Errors < ErrorTarget) { ///< Downward direction has started passing
+ Margins[Lane] = InterpolateMargin (ErrorTarget, PreviousErrors, Errors, (INT32) Jitter);
+ break;
+ }
+ } else {
+ if (Errors >= ErrorTarget) { ///< Upward direction has started failing
+ Margins[Lane] = InterpolateMargin (ErrorTarget, Errors, PreviousErrors, (INT32) Jitter);
+ break;
+ }
+ }
+ } ///< End of for loop
+
+ ///
+ /// Check if we never reached the error target
+ ///
+ if (MarginDirection < 0) {
+ if ((Errors >= ErrorTarget) && (!AbortMargin)) {
+ Margins[Lane] = 0;
+ }
+ } else {
+ if ((Errors < ErrorTarget) && (!AbortMargin)) {
+ Margins[Lane] = JITTER_LENGTH * 100;
+ }
+ }
+
+ ///
+ /// Compute the next margin point to start at
+ ///
+ StartJitter = (Margins[Lane] / 100) - JITTER_MARGIN_INITIAL_OFFSET;
+ if (StartJitter < 0) {
+ StartJitter = 0;
+ }
+
+ ///
+ /// Check for convergance
+ ///
+ if (LastMargin == -1) {
+ LastMargin = Margins[Lane];
+ } else {
+ MarginDifference = CalculateMarginDifference (LastMargin, Margins[Lane]);
+ if (MarginDifference <= MARGIN_CONVERGANCE_ALLOWED_DELTA) {
+ ConvergenceCounter++;
+ } else {
+ ConvergenceCounter = 0;
+ }
+ LastMargin = Margins[Lane];
+ }
+
+ if (LinkIsDowngraded (PegPort, OriginalLinkSpeed, OriginalLinkWidth)) {
+ Status = SetJitterTolerance (&Lane, 1, 0);
+ ASSERT_EFI_ERROR (Status);
+ }
+
+ ///
+ /// If the link degraded in any way, bring it back to functional state
+ ///
+ Status = EnsureLinkIsHealthy (PeiServices, SaPlatformPolicyPpi, SaDataHob, StallPpi, PegPort, OriginalLinkSpeed, OriginalLinkWidth);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ } ///< End of repeat while loop
+
+ ///
+ /// Remove Jitter in preparation for testing the next lane
+ ///
+ Status = SetJitterTolerance (&Lane, 1, 0);
+ ASSERT_EFI_ERROR (Status);
+ if (TxJitterTest) {
+ EnableTxJitterInjection (Lane, FALSE);
+ }
+ } ///< End of for each lane loop
+
+ return EFI_SUCCESS;
+}
+
+UINT32
+SaPciePointTest (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi,
+ IN PEI_STALL_PPI *StallPpi,
+ IN UINT32 MonitorPort,
+ IN PEG_PORT *PegPort,
+ IN UINT32 InitialRecoveryCount
+ )
+{
+ UINT32 Data32;
+
+ StallPpi->Stall (PeiServices, StallPpi, SaPlatformPolicyPpi->PcieConfig->PegGen3PresetSearchDwellTime);
+ Data32 = SaPcieGetErrorCount (MonitorPort, PegPort->Function) - InitialRecoveryCount;
+
+ return Data32;
+}
+
+INT32
+CalculateMarginDifference (
+ IN INT32 Margin1,
+ IN INT32 Margin2
+ )
+{
+ if (Margin1 < Margin2) {
+ return Margin2 - Margin1;
+ } else {
+ return Margin1 - Margin2;
+ }
+}
+
+INT32
+InterpolateMargin (
+ IN UINT32 ErrorTarget,
+ IN UINT32 CurrentErrorCount,
+ IN UINT32 PreviousErrorCount,
+ IN INT32 FailingPoint
+ )
+{
+ UINT32 LnErrorTarget;
+ UINT32 LnCurrentErrorCount;
+ UINT32 LnPreviousErrorCount;
+ INT32 Margin;
+
+ if (ErrorTarget > 40000) {
+ ErrorTarget = 40000;
+ }
+ if (CurrentErrorCount > 40000) {
+ CurrentErrorCount = 40000;
+ }
+ if (PreviousErrorCount > 40000) {
+ PreviousErrorCount = 40000;
+ }
+
+ LnErrorTarget = NaturalLog (ErrorTarget * 100);
+ LnCurrentErrorCount = NaturalLog (CurrentErrorCount * 100);
+ LnPreviousErrorCount = NaturalLog (PreviousErrorCount * 100);
+
+ if (FailingPoint >= 0) {
+ if ((LnCurrentErrorCount - LnPreviousErrorCount) == 0) {
+ Margin = (FailingPoint - 1) * 100;
+ } else {
+ Margin = ((LnErrorTarget - LnPreviousErrorCount) * 100) /
+ (LnCurrentErrorCount - LnPreviousErrorCount) +
+ ((FailingPoint - 1) * 100);
+ }
+ if (Margin < 0) {
+ Margin = 0;
+ }
+ } else {
+ if ((LnCurrentErrorCount - LnPreviousErrorCount) == 0) {
+ Margin = (FailingPoint + 1) * 100;
+ } else {
+ Margin = ((FailingPoint + 1) * 100) -
+ ((LnErrorTarget - LnPreviousErrorCount) * 100) /
+ (LnCurrentErrorCount - LnPreviousErrorCount);
+ }
+ if (Margin > 0) {
+ Margin = 0;
+ }
+ }
+
+ return Margin;
+}
+
+
+UINT32
+NaturalLog (
+ IN UINT32 Input
+ )
+ /*++
+
+ Routine Description:
+
+ This function calculates the Natural Log of the Input parameter using integers
+
+ Arguments:
+
+ Input - 100 times a number to get the Natural log from.
+ - Max Input Number is 40,000 (without 100x)
+
+ Returns:
+
+ Output - 100 times the actual result. Accurate within +/- 2
+
+ --*/
+{
+ UINT32 Output;
+
+ ///
+ ///Special case - treat 0 recoveries as 1 recovery for interpolation purposes
+ ///
+ if (Input == 0) {
+ return 0;
+ }
+
+ Output = 0;
+ while (Input > 271) {
+ Input = (Input * 1000) / 2718;
+ Output += 100;
+ }
+
+ Output += ((-16 * Input * Input + 11578 * Input - 978860) / 10000);
+
+ return Output;
+}
+
+#endif // PEG_FLAG
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/PcieTraining.h b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/PcieTraining.h
new file mode 100644
index 0000000..5c7ee57
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/PcieTraining.h
@@ -0,0 +1,425 @@
+/** @file
+ Header file for PcieTraining Initialization Driver.
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+#ifndef _PCIETRAINING_H_
+#define _PCIETRAINING_H_
+
+#include "EdkIIGluePeim.h"
+#include "SaAccess.h"
+#include "PciExpressInit.h"
+
+#include EFI_PPI_DEPENDENCY (SaPlatformPolicy)
+#include EFI_GUID_DEFINITION (SaDataHob)
+
+///
+/// Data structures
+///
+
+typedef struct {
+ PEG_PORT PegPort;
+ UINT32 EndPointVendorIdDeviceId;
+ BOOLEAN LinkIsGen3Capable;
+ UINT8 LaneList[SA_PEG_MAX_LANE];
+ UINT8 LaneListLength;
+ BOOLEAN EnableMargin;
+ BOOLEAN SkipMargin;
+ BOOLEAN FoundUsablePreset;
+} PORT_INFO;
+
+typedef struct {
+ INT8 Depth;
+ UINT8 Step;
+ UINT8 ReportedMargin;
+ UINT8 DoubleMargin;
+} JITTER_SETTING;
+
+typedef struct {
+ UINT8 Lane;
+ UINT32 InitialDs0Dac;
+ UINT32 InitialDs0Value;
+ INT32 Ds0MarginOffset;
+ UINT32 InitialDs1Dac;
+ UINT32 InitialDs1Value;
+ INT32 Ds1MarginOffset;
+ INT32 MaxUpMargin;
+ INT32 MaxDownMargin;
+} VOC_STATE;
+
+typedef enum {
+ LaneLevelRxJitter,
+ VocUp,
+ VocDown
+} MARGIN_TEST_TYPE;
+
+#define JITTER_LENGTH 25
+#define JITTER_MARGIN_INITIAL_OFFSET 1
+#define MARGIN_CONVERGANCE_ALLOWED_DELTA 100
+#define MARGIN_CONVERGANCE_MIN_MATCHES 2
+#define MARGIN_CONVERGANCE_MAX_REPEATS 30
+
+#define SA_PEI_MONITOR_OFFSET 0xFED85000
+
+///
+/// Register Definitions
+///
+#define B_SA_PEG_LTSSMC_WIDTH_MASK 0xFFFFFFE0
+
+#define R_SA_PEG_REUT_PH_CTR_OFFSET 0x444
+#define B_SA_PEG_REUT_PH_CTR_PHYRESET_MASK 0x1
+#define B_SA_PEG_REUT_PH_CTR_RESETMOD_MASK 0x2
+#define B_SA_PEG_REUT_PH_CTR_AUTOCOMP_MASK 0x2000
+
+#define R_SA_PEG_REUT_PH1_PIS_OFFSET 0x464
+#define B_SA_PEG_REUT_PH1_PIS_ST_MASK 0x3F
+#define B_SA_PEG_REUT_PH1_PIS_ST_STEP 0x8
+
+#define B_SA_PEG_BCTRL_SRESET_MASK BIT6
+
+#define V_SA_VCU_OPCODE_SET_TXJITTER_MUX 0x3002
+#define V_SA_VCU_SEQID_SET_TXJITTER_MUX 0x00030003
+
+#define R_SA_VCU_REUT_PH_CTR_ADDRESS_REV1 0x04448808
+#define R_SA_VCU_REUT_PH_CTR_ADDRESS_REV2 0x04448080
+
+#define R_SA_VCU_REUT_PH1_PIS_ADDRESS_REV1 0x04648808
+#define R_SA_VCU_REUT_PH1_PIS_ADDRESS_REV2 0x04648080
+
+///
+/// Function Prototypes
+///
+
+
+
+UINT16
+GetErrorTarget (
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi
+ );
+
+VOID GetPortInfo (
+ OUT PORT_INFO *PortInfoList,
+ OUT UINT8 *PortInfoListLength,
+ OUT BOOLEAN *SkipBundle0
+ );
+
+EFI_STATUS
+RunMarginTest (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi,
+ IN SA_DATA_HOB *SaDataHob,
+ IN PEI_STALL_PPI *StallPpi,
+ IN UINT32 MonitorPort,
+ IN PORT_INFO *PortInfoList,
+ IN UINT8 PortInfoListLength,
+ IN MARGIN_TEST_TYPE MarginTest,
+ OUT INT32 *Margins
+ );
+
+EFI_STATUS
+LaneLevelJitterTest (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi,
+ IN SA_DATA_HOB *SaDataHob,
+ IN PEI_STALL_PPI *StallPpi,
+ IN UINT32 MonitorPort,
+ IN UINT8 *LaneList,
+ IN UINT8 LaneListLength,
+ IN PEG_PORT *PegPort,
+ IN UINT8 OriginalLinkSpeed,
+ IN UINT8 OriginalLinkWidth,
+ IN BOOLEAN TxJitterTest,
+ OUT INT32 *Margins
+ );
+
+UINT32
+SaPciePointTest (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi,
+ IN PEI_STALL_PPI *StallPpi,
+ IN UINT32 MonitorPort,
+ IN PEG_PORT *PegPort,
+ IN UINT32 InitialRecoveryCount
+ );
+
+INT32
+CalculateMarginDifference (
+ IN INT32 Margin1,
+ IN INT32 Margin2
+ );
+
+INT32
+InterpolateMargin (
+ IN UINT32 ErrorTarget,
+ IN UINT32 CurrentErrorCount,
+ IN UINT32 PreviousErrorCount,
+ IN INT32 FailingPoint
+ );
+
+
+UINT32
+NaturalLog (
+ IN UINT32 Input
+ );
+
+
+VOID
+PegGen3PresetSearch (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi,
+ IN PEI_STALL_PPI *StallPpi,
+ SA_DATA_HOB *SaDataHob
+ );
+
+BOOLEAN
+SaPolicyEnablesGen3 (
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi
+ );
+
+
+EFI_STATUS
+EnsureLinkIsHealthy (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi,
+ IN SA_DATA_HOB *SaDataHob,
+ IN PEI_STALL_PPI *StallPpi,
+ IN PEG_PORT *PegPort,
+ IN UINT8 OriginalLinkSpeed,
+ IN UINT8 OriginalLinkWidth
+ );
+
+EFI_STATUS
+WaitForL0 (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_STALL_PPI *StallPpi,
+ IN PEG_PORT *PegPort,
+ IN BOOLEAN UseVcu
+ );
+
+EFI_STATUS
+TogglePegSlotReset (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_STALL_PPI *StallPpi,
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi
+ );
+
+EFI_STATUS
+AssertPegSlotReset (
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi
+ );
+
+EFI_STATUS
+DeassertPegSlotReset (
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi
+ );
+
+EFI_STATUS
+RecoverLinkFailure (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi,
+ IN SA_DATA_HOB *SaDataHob,
+ IN PEI_STALL_PPI *StallPpi,
+ IN PEG_PORT *PegPort,
+ IN UINT8 OriginalLinkSpeed,
+ IN UINT8 OriginalLinkWidth
+ );
+
+BOOLEAN
+LinkIsDowngraded (
+ IN PEG_PORT *PegPort,
+ IN UINT8 OriginalLinkSpeed,
+ IN UINT8 OriginalLinkWidth
+ );
+
+EFI_STATUS
+SecondaryBusReset (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_STALL_PPI *StallPpi,
+ IN PEG_PORT *PegPort
+ );
+
+EFI_STATUS
+ResetPhyLayer (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_STALL_PPI *StallPpi,
+ IN PEG_PORT *PegPort
+ );
+
+EFI_STATUS
+RetrainLink (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_STALL_PPI *StallPpi,
+ IN PEG_PORT *PegPort
+ );
+
+UINT8
+GetNegotiatedWidth (
+ IN PEG_PORT *PegPort
+ );
+
+EFI_STATUS
+RecoverLinkWidth (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_STALL_PPI *StallPpi,
+ IN PEG_PORT *PegPort,
+ IN UINT8 OriginalLinkWidth
+ );
+
+UINT8
+GetLinkSpeed (
+ IN PEG_PORT *PegPort
+ );
+
+EFI_STATUS
+RecoverLinkSpeed (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_STALL_PPI *StallPpi,
+ IN PEG_PORT *PegPort,
+ IN UINT8 OriginalLinkSpeed
+ );
+
+VOID
+PcieTrainingWarmReset (
+ IN EFI_PEI_SERVICES **PeiServices
+ );
+
+
+EFI_STATUS
+SetJitterTolerance (
+ IN UINT8 *LaneList,
+ IN UINT8 LaneListLength,
+ IN UINT8 ReportedMargin
+ );
+
+EFI_STATUS
+SetRawJitterTolerance (
+ IN UINT8 *LaneList,
+ IN UINT8 LaneListLength,
+ IN UINT8 Step,
+ IN UINT8 Depth,
+ IN UINT8 DoubleMargin,
+ IN BOOLEAN EnableJitter
+ );
+
+VOID
+EnableTxJitterInjection (
+ IN UINT8 Lane,
+ IN BOOLEAN EnableTxJitter
+ );
+
+VOID
+ConfigureTxJitterMux (
+ IN UINT8 Lane,
+ IN UINT32 MchBar
+ );
+
+EFI_STATUS
+GetBundleList (
+ IN UINT8 *LaneList,
+ IN UINT8 LaneListLength,
+ OUT UINT8 *BundleList,
+ OUT UINT8 *BundleListLength
+ );
+
+
+UINT32
+OpenMonitor (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi,
+ IN PEI_STALL_PPI *StallPpi
+ );
+
+VOID
+CloseMonitor (
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi,
+ IN UINT32 MonitorPort
+ );
+
+UINT32
+SaPcieGetErrorCount (
+ IN UINT32 MonitorPort,
+ IN UINT8 PcieController
+ );
+
+VOID
+SaPcieClearErrorCount (
+ IN UINT32 MonitorPort,
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_STALL_PPI *StallPpi
+ );
+
+VOID
+InitMonitor (
+ IN UINT32 MchBar,
+ IN UINT32 GdxcBar
+ );
+
+VOID
+TearDownMonitor (
+ IN UINT32 MchBar,
+ IN UINT32 GdxcBar
+ );
+
+UINT32
+EnableMonitor (
+ VOID
+ );
+
+VOID
+DisableMonitor (
+ VOID
+ );
+
+VOID
+FullMonitorReset (
+ IN UINT32 MonitorPort
+ );
+
+VOID
+ProgramMonitor (
+ IN UINT32 MonitorPort,
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_STALL_PPI *StallPpi
+ );
+
+
+VOID
+GetLinkPartnerFullSwing (
+ IN UINT8 Lane,
+ OUT UINT8 *FullSwing
+ );
+
+VOID
+GetCoefficientsFromPreset (
+ IN UINT8 Preset,
+ IN UINT8 FullSwing,
+ OUT UINT8 *PreCursor,
+ OUT UINT8 *Cursor,
+ OUT UINT8 *PostCursor
+ );
+
+VOID
+SetPartnerTxCoefficients (
+ IN UINT8 Lane,
+ IN UINT8 *PreCursor,
+ IN UINT8 *Cursor,
+ IN UINT8 *PostCursor
+ );
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/PcieTrainingEqSettings.c b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/PcieTrainingEqSettings.c
new file mode 100644
index 0000000..dc4515e
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/PcieTrainingEqSettings.c
@@ -0,0 +1,166 @@
+/*++ @file
+ This file adds equalization setting support.
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+--*/
+
+#include "PcieTraining.h"
+#include "PciExpressInit.h"
+
+#ifdef PEG_FLAG
+
+VOID
+GetLinkPartnerFullSwing (
+ IN UINT8 Lane,
+ OUT UINT8 *FullSwing
+ )
+{
+ UINT32 Data32;
+
+ Data32 = BIT25 | BIT23 | (Lane << 19) | BIT18;
+ McD1PciCfg32(R_SA_PEG_EQPH3_OFFSET) = Data32;
+ Data32 = McD1PciCfg32(R_SA_PEG_EQPH3_OFFSET);
+ McD1PciCfg32(R_SA_PEG_EQPH3_OFFSET) = 0;
+
+ *FullSwing = (Data32 >> 6) & 0x3F;
+
+ return;
+}
+
+VOID
+GetCoefficientsFromPreset (
+ IN UINT8 Preset,
+ IN UINT8 FullSwing,
+ OUT UINT8 *PreCursor,
+ OUT UINT8 *Cursor,
+ OUT UINT8 *PostCursor
+ )
+{
+ INT32 PreCursorMilli;
+ INT32 PostCursorMilli;
+
+ PreCursorMilli = 0;
+ PostCursorMilli = 0;
+
+ ///
+ /// Get starting values from Table 4-16 of the PCIe Base Spec v3.0
+ ///
+ switch (Preset) {
+ case 0:
+ PreCursorMilli = 0;
+ PostCursorMilli = -250;
+ break;
+
+ case 1:
+ PreCursorMilli = 0;
+ PostCursorMilli = -167;
+ break;
+
+ case 2:
+ PreCursorMilli = 0;
+ PostCursorMilli = -200;
+ break;
+
+ case 3:
+ PreCursorMilli = 0;
+ PostCursorMilli = -125;
+ break;
+
+ case 4:
+ PreCursorMilli = 0;
+ PostCursorMilli = 0;
+ break;
+
+ case 5:
+ PreCursorMilli = -100;
+ PostCursorMilli = 0;
+ break;
+
+ case 6:
+ PreCursorMilli = -125;
+ PostCursorMilli = 0;
+ break;
+
+ case 7:
+ PreCursorMilli = -100;
+ PostCursorMilli = -200;
+ break;
+
+ case 8:
+ PreCursorMilli = -125;
+ PostCursorMilli = -125;
+ break;
+
+ case 9:
+ PreCursorMilli = -166;
+ PostCursorMilli = 0;
+ break;
+
+ case 10: ///< P10 is unsupported
+ default:
+ PreCursorMilli = -100;
+ PostCursorMilli = -200;
+ DEBUG ((EFI_D_WARN, "GetCoefficientsFromPreset(): Unsupported Preset Requested: P%d. Using P7.\n", Preset));
+ break;
+ }
+
+ ///
+ /// Convert to absolute values
+ ///
+ if (PreCursorMilli < 0) {
+ PreCursorMilli *= -1;
+ }
+ if (PostCursorMilli < 0) {
+ PostCursorMilli *= -1;
+ }
+
+ ///
+ /// Apply FullSwing
+ ///
+ PreCursorMilli *= FullSwing;
+ PostCursorMilli *= FullSwing;
+
+ ///
+ /// Convert to integers
+ ///
+ *PreCursor = (( PreCursorMilli % 1000) >= 500) ? (UINT8) (( PreCursorMilli / 1000) + 1) : (UINT8) ( PreCursorMilli / 1000);
+ *PostCursor = ((PostCursorMilli % 1000) >= 500) ? (UINT8) ((PostCursorMilli / 1000) + 1) : (UINT8) (PostCursorMilli / 1000);
+ *Cursor = FullSwing - (*PreCursor) - (*PostCursor);
+
+ return;
+}
+
+VOID
+SetPartnerTxCoefficients (
+ IN UINT8 Lane,
+ IN UINT8 *PreCursor,
+ IN UINT8 *Cursor,
+ IN UINT8 *PostCursor
+ )
+{
+ UINT32 Data32;
+
+ Data32 = (Lane << 19) | BIT18 | (*Cursor << 12) | (*PreCursor << 6) | (*PostCursor);
+ McD1PciCfg32(R_SA_PEG_EQPH3_OFFSET) = Data32;
+ McD1PciCfg32(R_SA_PEG_EQPH3_OFFSET) = 0;
+
+ return;
+}
+
+#endif // PEG_FLAG
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/PcieTrainingErrorCount.c b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/PcieTrainingErrorCount.c
new file mode 100644
index 0000000..d1fb107
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/PcieTrainingErrorCount.c
@@ -0,0 +1,195 @@
+/** @file
+ Error Counting for PEG training.
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+#include "PcieTraining.h"
+
+#ifdef PEG_FLAG
+
+UINT32
+OpenMonitor (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi,
+ IN PEI_STALL_PPI *StallPpi
+ )
+{
+ UINT32 MonitorPort;
+
+ InitMonitor (SaPlatformPolicyPpi->PlatformData->MchBar, SaPlatformPolicyPpi->PlatformData->GdxcBar);
+ MonitorPort = EnableMonitor ();
+ FullMonitorReset (MonitorPort);
+ ProgramMonitor (MonitorPort, PeiServices, StallPpi);
+
+ return MonitorPort;
+}
+
+VOID
+CloseMonitor (
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi,
+ IN UINT32 MonitorPort
+ )
+{
+ FullMonitorReset (MonitorPort);
+ DisableMonitor ();
+ TearDownMonitor (SaPlatformPolicyPpi->PlatformData->MchBar, SaPlatformPolicyPpi->PlatformData->GdxcBar);
+
+ return;
+}
+
+UINT32
+SaPcieGetErrorCount (
+ IN UINT32 MonitorPort,
+ IN UINT8 PcieController
+ )
+{
+ UINT32 Data32;
+
+ Data32 = Mmio32 (MonitorPort, (0xC + (PcieController * 0x10)));
+
+ return Data32;
+}
+
+VOID
+SaPcieClearErrorCount (
+ IN UINT32 MonitorPort,
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_STALL_PPI *StallPpi
+ )
+{
+ FullMonitorReset (MonitorPort);
+ ProgramMonitor (MonitorPort, PeiServices, StallPpi);
+
+ return;
+}
+
+VOID
+InitMonitor (
+ IN UINT32 MchBar,
+ IN UINT32 GdxcBar
+ )
+{
+ Mmio32 (MchBar, 0x6430) = 0x3;
+ Mmio32 (MchBar, 0x6434) = 0x76543210;
+ McD1PciCfg32 (0x630) = 0xB;
+ McD1PciCfg32 (0x600) = 0x60B;
+ McD1PciCfg32 (0x604) = 0x76543980;
+ McD1F1PciCfg32 (0x600) = 0x60B;
+ McD1F1PciCfg32 (0x604) = 0x76543280;
+ McD1F2PciCfg32 (0x600) = 0xB;
+ McD1F2PciCfg32 (0x604) = 0x76543210;
+ Mmio32 (MchBar, 0x6438) = 0x680000;
+ Mmio32 (GdxcBar, 0xA04) = 0xA;
+
+ return;
+}
+
+VOID
+TearDownMonitor (
+ IN UINT32 MchBar,
+ IN UINT32 GdxcBar
+ )
+{
+ Mmio32 (MchBar, 0x6430) = 0x0;
+ Mmio32 (MchBar, 0x6434) = 0x0;
+ McD1PciCfg32 (0x630) = 0x0;
+ McD1PciCfg32 (0x600) = 0x0;
+ McD1PciCfg32 (0x604) = 0x0;
+ McD1F1PciCfg32 (0x600) = 0x0;
+ McD1F1PciCfg32 (0x604) = 0x0;
+ McD1F2PciCfg32 (0x600) = 0x0;
+ McD1F2PciCfg32 (0x604) = 0x0;
+ Mmio32 (MchBar, 0x6438) = 0x0;
+ Mmio32 (GdxcBar, 0xA04) = 0x0;
+
+ return;
+}
+
+UINT32
+EnableMonitor (
+ VOID
+ )
+{
+ UINT32 Data32;
+
+ Data32 = (McD0PciCfg32 (0140) & ~(07));
+ Mmio32Or (Data32, 0124, 040000);
+ Mmio64 (Data32, 0700020) = (UINT64) SA_PEI_MONITOR_OFFSET;
+ Mmio16Or (Data32, 0700004, 02);
+
+ return SA_PEI_MONITOR_OFFSET;
+}
+
+VOID
+DisableMonitor (
+ VOID
+ )
+{
+ UINT32 Data32;
+
+ Data32 = (McD0PciCfg32 (0140) & ~(07));
+ Mmio16And (Data32, 0700004, 0177775);
+ Mmio64And (Data32, 0700020, 07777);
+ Mmio32And (Data32, 0124, 037777737777);
+
+ return;
+}
+
+VOID
+FullMonitorReset (
+ IN UINT32 MonitorPort
+ )
+{
+ Mmio32 (MonitorPort, 0x0) = 0x40000;
+ Mmio32 (MonitorPort, 0x4) = 0x0;
+ Mmio32 (MonitorPort, 0x10) = 0x40000;
+ Mmio32 (MonitorPort, 0x14) = 0x0;
+ Mmio32 (MonitorPort, 0x20) = 0x40000;
+ Mmio32 (MonitorPort, 0x24) = 0x0;
+ Mmio32 (MonitorPort, 0x8) = 0xFF000000;
+ Mmio32 (MonitorPort, 0x18) = 0xFF000000;
+ Mmio32 (MonitorPort, 0x28) = 0xFF000000;
+ Mmio32 (MonitorPort, 0xC) = 0x0;
+ Mmio32 (MonitorPort, 0x1C) = 0x0;
+ Mmio32 (MonitorPort, 0x2C) = 0x0;
+
+ return;
+}
+
+VOID
+ProgramMonitor (
+ IN UINT32 MonitorPort,
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_STALL_PPI *StallPpi
+ )
+{
+ Mmio32 (MonitorPort, 0x4) = 0xA100;
+ Mmio32 (MonitorPort, 0x14) = 0xA101;
+ Mmio32 (MonitorPort, 0x24) = 0xA102;
+ Mmio32 (MonitorPort, 0x0) = 0x110000;
+ StallPpi->Stall (PeiServices, StallPpi, 1 * STALL_ONE_MILLI_SECOND);
+
+ Mmio32 (MonitorPort, 0x0) = 0x22100;
+ Mmio32 (MonitorPort, 0x10) = 0x22101;
+ Mmio32 (MonitorPort, 0x20) = 0x22102;
+
+ return;
+}
+
+#endif // PEG_FLAG
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/PcieTrainingLinkRecovery.c b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/PcieTrainingLinkRecovery.c
new file mode 100644
index 0000000..1480bc7
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/PcieTrainingLinkRecovery.c
@@ -0,0 +1,721 @@
+/*++ @file
+ This driver recovers the PEG link.
+
+@copyright
+ Copyright (c) 2012 - 2014 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+--*/
+
+#include "PcieTraining.h"
+#include "PciExpressInit.h"
+#include EFI_PPI_CONSUMER (PchReset)
+
+#ifdef PEG_FLAG
+
+EFI_STATUS
+EnsureLinkIsHealthy (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi,
+ IN SA_DATA_HOB *SaDataHob,
+ IN PEI_STALL_PPI *StallPpi,
+ IN PEG_PORT *PegPort,
+ IN UINT8 OriginalLinkSpeed,
+ IN UINT8 OriginalLinkWidth
+ )
+{
+ EFI_STATUS Status;
+
+ Status = EFI_SUCCESS;
+
+ ///
+ /// Check Link Status and Recover the Link if needed
+ ///
+ Status = RecoverLinkWidth (PeiServices, StallPpi, PegPort, OriginalLinkWidth);
+ if (EFI_ERROR (Status)) {
+ Status = RecoverLinkFailure (PeiServices, SaPlatformPolicyPpi, SaDataHob, StallPpi, PegPort, OriginalLinkSpeed, OriginalLinkWidth);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ }
+ Status = RecoverLinkSpeed (PeiServices, StallPpi, PegPort, OriginalLinkSpeed);
+ if (EFI_ERROR (Status)) {
+ Status = RecoverLinkFailure (PeiServices, SaPlatformPolicyPpi, SaDataHob, StallPpi, PegPort, OriginalLinkSpeed, OriginalLinkWidth);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ }
+ Status = WaitForL0 (PeiServices, StallPpi, PegPort, FALSE);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_INFO, "DOWNGRADE, Link is not in L0\n"));
+ Status = RetrainLink (PeiServices, StallPpi, PegPort);
+ if (EFI_ERROR (Status)) {
+ Status = RecoverLinkFailure (PeiServices, SaPlatformPolicyPpi, SaDataHob, StallPpi, PegPort, OriginalLinkSpeed, OriginalLinkWidth);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ }
+ }
+
+ return Status;
+}
+
+/**
+ Wait until link is up.
+
+ @param[in] PeiServices - Pointer to the PEI services table
+ @param[in] StallPpi - Pointer to PEI_STALL_PPI
+ @param[in] PegPort - Pointer PEG Port
+ @param[in] UseVcu - If TRUE, use VCU to determine link state. If FALSE, use MMIO CFG to determine link state.
+
+ @retval EFI_SUCCESS - Completed successfully before timeout
+ @retval EFI_TIMEOUT - Timed out
+**/
+EFI_STATUS
+WaitForL0 (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_STALL_PPI *StallPpi,
+ IN PEG_PORT *PegPort,
+ IN BOOLEAN UseVcu
+ )
+{
+ UINT32 MchBar;
+ UINT32 i;
+ EFI_STATUS Status;
+ UINT32 VcuAddress;
+ UINT8 VcuReadOp;
+ UINT8 VcuWriteOp;
+ CPU_FAMILY CpuFamilyId;
+ CPU_STEPPING CpuSteppingId;
+ BOOLEAN CheckEq;
+ BOOLEAN CompletedEq;
+ UINT32 EqStatus;
+ UINT32 LinkStatus;
+
+ Status = EFI_TIMEOUT;
+ CheckEq = (PegPort->EndpointMaxLinkSpeed >= 0x3) ? TRUE : FALSE;
+ CompletedEq = FALSE;
+ i = 0;
+ MchBar = McD0PciCfg64 (R_SA_MCHBAR) & ~BIT0;
+ CpuFamilyId = GetCpuFamily();
+ CpuSteppingId = GetCpuStepping();
+
+#ifndef AMI_OVERRIDE_FOR_ULT_FASTBOOT
+ if (CpuFamilyId == EnumCpuHswUlt) return EFI_UNSUPPORTED;
+#endif // AMI_OVERRIDE_FOR_ULT_FASTBOOT
+
+ if ((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId == EnumHswA0)) {
+ VcuAddress = R_SA_VCU_REUT_PH1_PIS_ADDRESS_REV1;
+ VcuReadOp = V_SA_VCU_OPCODE_READ_CSR_REV1;
+ VcuWriteOp = V_SA_VCU_OPCODE_WRITE_CSR_REV1;
+ } else {
+ VcuAddress = R_SA_VCU_REUT_PH1_PIS_ADDRESS_REV2;
+ VcuReadOp = V_SA_VCU_OPCODE_READ_CSR_REV2;
+ VcuWriteOp = V_SA_VCU_OPCODE_WRITE_CSR_REV2;
+ }
+
+ ///
+ /// If endpoint's LCAP.MLS (Spec section 7.8.6) indicated Gen3 capability, first wait for equalization to complete.
+ /// Check equalization status LSTS2.EC (Spec section 7.8.20) until Gen3 equalization successfully completed.
+ ///
+ if (CheckEq && !UseVcu) {
+ for (; i < 100; i++) {
+ EqStatus = MmPci16 (0, PegPort->Bus, PegPort->Device, PegPort->Function, R_SA_PEG_LSTS2_OFFSET);
+ EqStatus = (EqStatus >> 1) & 0x1;
+ if (EqStatus == 0x1) {
+ CompletedEq = TRUE;
+ break;
+ }
+ StallPpi->Stall (PeiServices, StallPpi, STALL_ONE_MILLI_SECOND);
+ }
+ }
+
+ ///
+ /// Check for L0 status. If !UseVcu, check PEGSTS.
+ /// Continue up to 100 msec of combined delay.
+ /// Skip if equalization was needed but didn't successfully complete.
+ ///
+ if ((CheckEq && CompletedEq) || !CheckEq || UseVcu) {
+ for (; i < 100; i++) {
+ if (UseVcu) {
+ LinkStatus = SendVcuApiSequence (MchBar, VcuAddress, VcuReadOp, 0);
+ LinkStatus = (LinkStatus >> (PegPort->Function * B_SA_PEG_REUT_PH1_PIS_ST_STEP)) & B_SA_PEG_REUT_PH1_PIS_ST_MASK;
+ if (LinkStatus == 0x10) {
+ Status = EFI_SUCCESS;
+ break;
+ }
+ } else {
+ LinkStatus = MmPci32 (0, PegPort->Bus, PegPort->Device, PegPort->Function, R_SA_PEG_PEGSTS_OFFSET);
+ LinkStatus = (LinkStatus >> 16) & 0xF;
+ if (LinkStatus == 0x7) {
+ Status = EFI_SUCCESS;
+ break;
+ }
+ }
+ StallPpi->Stall (PeiServices, StallPpi, STALL_ONE_MILLI_SECOND);
+ }
+ }
+
+ return Status;
+}
+
+EFI_STATUS
+SetPchGpio (
+ IN UINT8 GpioNumber,
+ IN UINT8 Level
+ )
+/**
+ This function sets a GPIO to a particular level.
+
+ @param[in] GpioNumber - PCH GPIO number
+ @param[in] Level - 0 = Low, 1 = High
+
+ @retval EFI_SUCCESS - Did toggle GPIO
+ @retval EFI_UNSUPPORTED - Didn't toggle GPIO
+ @retval EFI_INVALID_PARAMETER - Didn't toggle GPIO
+**/
+{
+ UINT32 Data32;
+ UINT16 LpcDeviceId;
+ UINT16 GpioBase;
+ UINT16 UseSelOffset;
+ UINT16 IoSelOffset;
+ UINT16 LvlOffset;
+ UINT8 GpioBit;
+ EFI_STATUS Status;
+
+ Level &= 0x1;
+ Status = EFI_SUCCESS;
+ GpioBase = 0;
+ UseSelOffset = 0;
+ IoSelOffset = 0;
+ LvlOffset = 0;
+ GpioBit = 0;
+
+ LpcDeviceId = McDevFunPciCfg16 (
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_DEVICE_ID
+ );
+ if (!IS_PCH_LPT_LPC_DEVICE_ID (LpcDeviceId)) {
+ Status = EFI_UNSUPPORTED;
+ return Status;
+ }
+
+ GpioBase = McDevFunPciCfg16 (
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_GPIO_BASE
+ ) & B_PCH_LPC_GPIO_BASE_BAR;
+ if (GpioBase == 0) {
+ Status = EFI_UNSUPPORTED;
+ return Status;
+ }
+
+ if (GpioNumber < 0x20) {
+ UseSelOffset = R_PCH_GPIO_USE_SEL;
+ IoSelOffset = R_PCH_GPIO_IO_SEL;
+ LvlOffset = R_PCH_GPIO_LVL;
+ GpioBit = GpioNumber;
+ } else if (GpioNumber < 0x40) {
+ UseSelOffset = R_PCH_GPIO_USE_SEL2;
+ IoSelOffset = R_PCH_GPIO_IO_SEL2;
+ LvlOffset = R_PCH_GPIO_LVL2;
+ GpioBit = GpioNumber - 0x20;
+ } else if (GpioNumber < 0x60) {
+ UseSelOffset = R_PCH_GPIO_USE_SEL3;
+ IoSelOffset = R_PCH_GPIO_IO_SEL3;
+ LvlOffset = R_PCH_GPIO_LVL3;
+ GpioBit = GpioNumber - 0x40;
+ } else {
+ Status = EFI_INVALID_PARAMETER;
+ return Status;
+ }
+
+ if (!EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_INFO, "Setting GPIO%d to %x\n", GpioNumber, Level));
+ IoOr32 ((UINTN) (GpioBase + UseSelOffset), (UINT32) (1 << GpioBit));
+ IoAnd32 ((UINTN) (GpioBase + IoSelOffset), (UINT32) ~(1 << GpioBit));
+ Data32 = IoRead32 ((UINTN) (GpioBase + LvlOffset));
+ Data32 &= (UINT32) ~(1 << GpioBit);
+ Data32 |= (UINT32) (Level << GpioBit);
+ IoWrite32 ((UINTN) (GpioBase + LvlOffset), Data32);
+ }
+
+ return Status;
+}
+
+EFI_STATUS
+TogglePegSlotReset (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_STALL_PPI *StallPpi,
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi
+ )
+/**
+ This function asserts and deasserts a GPIO that controls PERST#.
+ The specific GPIO and its active level is provided by a policy.
+ The GPIO minimum assertion time, T_PERST (100 usec), is defined in the PCIe CEM Specification.
+
+ @param[in] PeiServices - Pointer to the PEI services table
+ @param[in] StallPpi - Pointer to PEI_STALL_PPI
+ @param[in] SaPlatformPolicyPpi - Pointer to SA_PLATFORM_POLICY_PPI
+
+ @retval EFI_SUCCESS - Did toggle GPIO
+ @retval EFI_UNSUPPORTED - Didn't toggle GPIO
+ @retval EFI_INVALID_PARAMETER - Didn't toggle GPIO
+**/
+{
+ EFI_STATUS Status;
+ UINT8 i;
+
+ DEBUG ((EFI_D_INFO, "Toggling PEG slot reset.\n"));
+ for (i = 0; i < SA_PEG_MAX_FUN; i++) {
+ MmPci16Or (0, SA_PEG_BUS_NUM, SA_PEG_DEV_NUM, i, R_SA_PEG_LCTL_OFFSET, BIT4);
+ }
+ Status = AssertPegSlotReset (SaPlatformPolicyPpi);
+ if (!EFI_ERROR (Status)) {
+ StallPpi->Stall (PeiServices, StallPpi, 100 * STALL_ONE_MICRO_SECOND);
+ for (i = 0; i < SA_PEG_MAX_FUN; i++) {
+ MmPci16And (0, SA_PEG_BUS_NUM, SA_PEG_DEV_NUM, i, R_SA_PEG_LCTL_OFFSET, (UINT16) ~(BIT4));
+ }
+ Status = DeassertPegSlotReset (SaPlatformPolicyPpi);
+ } else {
+ for (i = 0; i < SA_PEG_MAX_FUN; i++) {
+ MmPci16And (0, SA_PEG_BUS_NUM, SA_PEG_DEV_NUM, i, R_SA_PEG_LCTL_OFFSET, (UINT16) ~(BIT4));
+ }
+ }
+
+ return Status;
+}
+
+EFI_STATUS
+AssertPegSlotReset (
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi
+ )
+/**
+ This function asserts a GPIO that controls PERST#.
+ The specific GPIO and its active level is provided by a policy.
+ The GPIO minimum assertion time, T_PERST (100 usec), is defined in the PCIe CEM Specification.
+
+ @param[in] SaPlatformPolicyPpi - Pointer to SA_PLATFORM_POLICY_PPI
+
+ @retval EFI_SUCCESS - Did assert GPIO
+ @retval EFI_UNSUPPORTED - Didn't assert GPIO
+ @retval EFI_INVALID_PARAMETER - Didn't assert GPIO
+**/
+{
+ EFI_STATUS Status;
+ UINT8 GpioNumber;
+ UINT8 AssertLevel;
+
+ Status = EFI_SUCCESS;
+
+ DEBUG ((EFI_D_INFO, "Asserting PEG slot reset.\n"));
+
+ if (!((SaPlatformPolicyPpi->Revision >= SA_PLATFORM_POLICY_PPI_REVISION_3) &&
+ (SaPlatformPolicyPpi->PcieConfig->PegGpioData->GpioSupport == TRUE))) {
+ Status = EFI_UNSUPPORTED;
+ }
+
+ if (!EFI_ERROR (Status)) {
+ GpioNumber = (UINT8) (SaPlatformPolicyPpi->PcieConfig->PegGpioData->SaPegReset->Value);
+ AssertLevel = (UINT8) (SaPlatformPolicyPpi->PcieConfig->PegGpioData->SaPegReset->Active & 0x1);
+ Status = SetPchGpio (GpioNumber, AssertLevel);
+ }
+
+ return Status;
+}
+
+EFI_STATUS
+DeassertPegSlotReset (
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi
+ )
+/**
+ This function deasserts a GPIO that controls PERST#.
+ The specific GPIO and its active level is provided by a policy.
+ The GPIO minimum assertion time, T_PERST (100 usec), is defined in the PCIe CEM Specification.
+
+ @param[in] SaPlatformPolicyPpi - Pointer to SA_PLATFORM_POLICY_PPI
+
+ @retval EFI_SUCCESS - Did deassert GPIO
+ @retval EFI_UNSUPPORTED - Didn't deassert GPIO
+ @retval EFI_INVALID_PARAMETER - Didn't deassert GPIO
+**/
+{
+ EFI_STATUS Status;
+ UINT8 GpioNumber;
+ UINT8 DeassertLevel;
+
+ Status = EFI_SUCCESS;
+
+ DEBUG ((EFI_D_INFO, "Deasserting PEG slot reset.\n"));
+
+ if (!((SaPlatformPolicyPpi->Revision >= SA_PLATFORM_POLICY_PPI_REVISION_3) &&
+ (SaPlatformPolicyPpi->PcieConfig->PegGpioData->GpioSupport == TRUE))) {
+ Status = EFI_UNSUPPORTED;
+ }
+
+ if (!EFI_ERROR (Status)) {
+ GpioNumber = (UINT8) (SaPlatformPolicyPpi->PcieConfig->PegGpioData->SaPegReset->Value);
+ DeassertLevel = (UINT8) ((SaPlatformPolicyPpi->PcieConfig->PegGpioData->SaPegReset->Active & 0x1) ^ 0x1);
+ SetPchGpio (GpioNumber, DeassertLevel);
+ }
+
+ return Status;
+}
+
+EFI_STATUS
+RecoverLinkFailure (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi,
+ IN SA_DATA_HOB *SaDataHob,
+ IN PEI_STALL_PPI *StallPpi,
+ IN PEG_PORT *PegPort,
+ IN UINT8 OriginalLinkSpeed,
+ IN UINT8 OriginalLinkWidth
+ )
+{
+ EFI_STATUS Status;
+ UINT8 CurrentLinkWidth;
+ UINT8 CurrentLinkSpeed;
+ UINT8 PegBus;
+ UINT8 PegDev;
+ UINT8 PegFunc;
+
+ ///
+ /// A platform reset should be done after presets are saved in NVRAM
+ ///
+ if (SaDataHob != NULL) {
+ if ((SaPlatformPolicyPpi->Revision >= SA_PLATFORM_POLICY_PPI_REVISION_2) &&
+ (SaPlatformPolicyPpi->PcieConfig->PegGen3ForcePresetSearch == 0)) {
+ SaDataHob->PegPlatformResetRequired = TRUE;
+ } else if (SaPlatformPolicyPpi->Revision < SA_PLATFORM_POLICY_PPI_REVISION_2) {
+ SaDataHob->PegPlatformResetRequired = TRUE;
+ }
+ }
+
+ ///
+ /// Bypass phase2 and assert slot reset
+ ///
+ McD1PciCfg32Or (R_SA_PEG_EQCFG_OFFSET, BIT15);
+ Status = TogglePegSlotReset (PeiServices, StallPpi, SaPlatformPolicyPpi);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_INFO, "Error 0x%x.\n", Status));
+ } else {
+ DEBUG ((EFI_D_INFO, "Success.\n"));
+ }
+ PegBus = PegPort->Bus;
+ PegDev = PegPort->Device;
+ PegFunc = PegPort->Function;
+ ///
+ /// Wait for Equalization Done
+ ///
+ while (((MmPci32 (0, PegBus, PegDev, PegFunc, R_SA_PEG_LSTS2_OFFSET) >> 1) & 0x1) != 0x1);
+ ///
+ /// Wait for flow control credits exchange
+ ///
+ WaitForVc0Negotiation (PeiServices, StallPpi, PegBus, PegDev, PegFunc);
+
+ CurrentLinkWidth = GetNegotiatedWidth (PegPort);
+ if (CurrentLinkWidth < OriginalLinkWidth) {
+ DEBUG ((EFI_D_ERROR, "Link Width DOWNGRADED!\n"));
+ Status = EFI_TIMEOUT;
+ }
+ CurrentLinkSpeed = GetLinkSpeed (PegPort);
+ if (CurrentLinkSpeed < OriginalLinkSpeed) {
+ DEBUG ((EFI_D_ERROR, "Link Speed DOWNGRADED!\n"));
+ Status = EFI_TIMEOUT;
+ }
+
+ return Status;
+}
+
+BOOLEAN
+LinkIsDowngraded (
+ IN PEG_PORT *PegPort,
+ IN UINT8 OriginalLinkSpeed,
+ IN UINT8 OriginalLinkWidth
+ )
+{
+ BOOLEAN IsDowngraded;
+
+ IsDowngraded = FALSE;
+
+ if (OriginalLinkSpeed != GetLinkSpeed (PegPort)) {
+ DEBUG ((EFI_D_INFO, "Link speed downgrade detected\n"));
+ IsDowngraded = TRUE;
+ }
+ if (OriginalLinkWidth != GetNegotiatedWidth (PegPort)) {
+ DEBUG ((EFI_D_INFO, "Link width downgrade detected\n"));
+ IsDowngraded = TRUE;
+ }
+ return IsDowngraded;
+}
+
+EFI_STATUS
+SecondaryBusReset (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_STALL_PPI *StallPpi,
+ IN PEG_PORT *PegPort
+ )
+{
+ EFI_STATUS Status;
+
+ Status = EFI_SUCCESS;
+ DEBUG ((EFI_D_INFO, "SECONDARY BUS RESET!\n"));
+ MmPci16Or (0, PegPort->Bus, PegPort->Device, PegPort->Function, R_SA_PEG_BCTRL_OFFSET, B_SA_PEG_BCTRL_SRESET_MASK);
+ MmPci16And (0, PegPort->Bus, PegPort->Device, PegPort->Function, R_SA_PEG_BCTRL_OFFSET,~(B_SA_PEG_BCTRL_SRESET_MASK));
+ Status = WaitForL0 (PeiServices, StallPpi, PegPort, FALSE);
+ DEBUG ((EFI_D_INFO, "Reset Complete\n"));
+
+ return Status;
+}
+
+EFI_STATUS
+ResetPhyLayer (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_STALL_PPI *StallPpi,
+ IN PEG_PORT *PegPort
+ )
+{
+ EFI_STATUS Status;
+ UINT32 MchBar;
+ UINT32 Data32;
+ UINT32 VcuAddress;
+ UINT8 VcuReadOp;
+ UINT8 VcuWriteOp;
+ BOOLEAN UseVcu;
+ CPU_FAMILY CpuFamilyId;
+ CPU_STEPPING CpuSteppingId;
+
+ UseVcu = TRUE;
+ Status = EFI_SUCCESS;
+ MchBar = McD0PciCfg64 (R_SA_MCHBAR) &~BIT0;
+ CpuFamilyId = GetCpuFamily();
+ CpuSteppingId = GetCpuStepping();
+
+#ifndef AMI_OVERRIDE_FOR_ULT_FASTBOOT
+ if (CpuFamilyId == EnumCpuHswUlt) return EFI_UNSUPPORTED;
+#endif // AMI_OVERRIDE_FOR_ULT_FASTBOOT
+
+ if ((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId == EnumHswA0)) {
+ VcuAddress = R_SA_VCU_REUT_PH_CTR_ADDRESS_REV1;
+ VcuReadOp = V_SA_VCU_OPCODE_READ_CSR_REV1;
+ VcuWriteOp = V_SA_VCU_OPCODE_WRITE_CSR_REV1;
+ } else {
+ VcuAddress = R_SA_VCU_REUT_PH_CTR_ADDRESS_REV2;
+ VcuReadOp = V_SA_VCU_OPCODE_READ_CSR_REV2;
+ VcuWriteOp = V_SA_VCU_OPCODE_WRITE_CSR_REV2;
+ }
+
+ DEBUG ((EFI_D_INFO, "PHY LAYER RESET!\n"));
+ if (UseVcu) {
+ Data32 = SendVcuApiSequence (MchBar, VcuAddress, VcuReadOp, 0);
+ Data32 &= (UINT32) ~(BIT1);
+ SendVcuApiSequence (MchBar, VcuAddress, VcuWriteOp, Data32);
+ } else {
+ McD1PciCfg32And (R_SA_PEG_REUT_PH_CTR_OFFSET, ~(B_SA_PEG_REUT_PH_CTR_RESETMOD_MASK));
+ }
+
+ if (UseVcu) {
+ Data32 = SendVcuApiSequence (MchBar, VcuAddress, VcuReadOp, 0);
+ Data32 |= (UINT32) BIT0;
+ SendVcuApiSequence (MchBar, VcuAddress, VcuWriteOp, Data32);
+ } else {
+ McD1PciCfg32Or (R_SA_PEG_REUT_PH_CTR_OFFSET, B_SA_PEG_REUT_PH_CTR_PHYRESET_MASK);
+ }
+
+ if (UseVcu) {
+ Data32 = SendVcuApiSequence (MchBar, VcuAddress, VcuReadOp, 0);
+ Data32 |= (UINT32) BIT13;
+ SendVcuApiSequence (MchBar, VcuAddress, VcuWriteOp, Data32);
+ } else {
+ McD1PciCfg32Or (R_SA_PEG_REUT_PH_CTR_OFFSET, B_SA_PEG_REUT_PH_CTR_AUTOCOMP_MASK);
+ }
+
+ if (UseVcu) {
+ Data32 = SendVcuApiSequence (MchBar, VcuAddress, VcuReadOp, 0);
+ Data32 &= (UINT32) ~(BIT0);
+ SendVcuApiSequence (MchBar, VcuAddress, VcuWriteOp, Data32);
+ } else {
+ McD1PciCfg32And (R_SA_PEG_REUT_PH_CTR_OFFSET, ~(B_SA_PEG_REUT_PH_CTR_PHYRESET_MASK));
+ }
+
+ Status = WaitForL0 (PeiServices, StallPpi, PegPort, TRUE);
+ DEBUG ((EFI_D_INFO, "Reset Complete\n"));
+
+ return Status;
+}
+
+EFI_STATUS
+RetrainLink (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_STALL_PPI *StallPpi,
+ IN PEG_PORT *PegPort
+ )
+{
+ EFI_STATUS Status;
+
+ ///
+ /// Initiate Link Retrain
+ ///
+ MmPci16Or (0, PegPort->Bus, PegPort->Device, PegPort->Function, R_SA_PEG_LCTL_OFFSET, 0x20);
+
+ Status = WaitForL0 (PeiServices, StallPpi, PegPort, FALSE);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_INFO, "Link retrain FAILED!!!\n"));
+ }
+
+ return Status;
+}
+
+UINT8
+GetNegotiatedWidth (
+ IN PEG_PORT *PegPort
+ )
+{
+ UINT16 Lsts;
+
+ Lsts = MmPci16 (0, PegPort->Bus, PegPort->Device, PegPort->Function, R_SA_PEG_LSTS_OFFSET);
+
+ return (UINT8)((Lsts >> 4) & 0x3F);
+}
+
+EFI_STATUS
+RecoverLinkWidth (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_STALL_PPI *StallPpi,
+ IN PEG_PORT *PegPort,
+ IN UINT8 OriginalLinkWidth
+ )
+{
+ EFI_STATUS Status;
+ UINT8 CurrentLinkWidth;
+
+ Status = EFI_SUCCESS;
+
+ CurrentLinkWidth = GetNegotiatedWidth (PegPort);
+ if (CurrentLinkWidth < OriginalLinkWidth) {
+ DEBUG ((EFI_D_INFO, "DOWNGRADE from x%d to x%d detected\n", OriginalLinkWidth, CurrentLinkWidth));
+ MmPci32AndThenOr (
+ 0,
+ PegPort->Bus,
+ PegPort->Device,
+ PegPort->Function,
+ R_SA_PEG_LTSSMC_OFFSET,
+ B_SA_PEG_LTSSMC_WIDTH_MASK,
+ OriginalLinkWidth
+ );
+ MmPci16Or (0, PegPort->Bus, PegPort->Device, PegPort->Function, R_SA_PEG_LCTL_OFFSET, 0x10);
+ StallPpi->Stall (PeiServices, StallPpi, STALL_ONE_MICRO_SECOND);
+ MmPci16And (0, PegPort->Bus, PegPort->Device, PegPort->Function, R_SA_PEG_LCTL_OFFSET, 0xFFEF);
+ Status = WaitForL0 (PeiServices, StallPpi, PegPort, FALSE);
+ MmPci32Or (
+ 0,
+ PegPort->Bus,
+ PegPort->Device,
+ PegPort->Function,
+ R_SA_PEG_LTSSMC_OFFSET,
+ 0x1F
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ CurrentLinkWidth = GetNegotiatedWidth (PegPort);
+ if (CurrentLinkWidth == OriginalLinkWidth) {
+ DEBUG ((EFI_D_INFO, "Width Recovery Successful\n"));
+ Status = EFI_SUCCESS;
+ } else {
+ DEBUG ((EFI_D_INFO, "Width Recovery FAILED!\n"));
+ Status = EFI_DEVICE_ERROR;
+ }
+ }
+
+ return Status;
+}
+
+UINT8
+GetLinkSpeed (
+ IN PEG_PORT *PegPort
+ )
+{
+ UINT16 Lsts;
+
+ Lsts = MmPci16 (0, PegPort->Bus, PegPort->Device, PegPort->Function, R_SA_PEG_LSTS_OFFSET);
+
+ return (UINT8)(Lsts & 0xF);
+}
+
+EFI_STATUS
+RecoverLinkSpeed (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_STALL_PPI *StallPpi,
+ IN PEG_PORT *PegPort,
+ IN UINT8 OriginalLinkSpeed
+ )
+{
+ EFI_STATUS Status;
+ UINT8 CurrentLinkSpeed;
+
+ Status = EFI_SUCCESS;
+
+ CurrentLinkSpeed = GetLinkSpeed (PegPort);
+ if (CurrentLinkSpeed < OriginalLinkSpeed) {
+ DEBUG ((EFI_D_INFO, "DOWNGRADE from Gen %d to Gen %d detected\n", OriginalLinkSpeed, CurrentLinkSpeed));
+
+ Status = RetrainLink (PeiServices, StallPpi, PegPort);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_INFO, "Link Speed Recovery FAILED!\n"));
+ return Status;
+ }
+
+ CurrentLinkSpeed = GetLinkSpeed (PegPort);
+ if (CurrentLinkSpeed < OriginalLinkSpeed) {
+ DEBUG ((EFI_D_INFO, "Link Speed Recovery FAILED!\n"));
+ Status = EFI_DEVICE_ERROR;
+ } else {
+ DEBUG ((EFI_D_INFO, "Link Speed Recovery Successful\n"));
+ }
+ }
+
+ return Status;
+}
+
+VOID
+PcieTrainingWarmReset (
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_STATUS Status;
+ PCH_RESET_PPI *PchResetPpi;
+
+ Status = (*PeiServices)->LocatePpi (
+ PeiServices,
+ &gPchResetPpiGuid,
+ 0,
+ NULL,
+ &PchResetPpi
+ );
+ ASSERT_EFI_ERROR (Status);
+ PchResetPpi->Reset (PchResetPpi, WarmReset);
+
+ return;
+}
+
+#endif // PEG_FLAG
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/PcieTrainingMargining.c b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/PcieTrainingMargining.c
new file mode 100644
index 0000000..7d2f63d
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/PcieTrainingMargining.c
@@ -0,0 +1,223 @@
+/** @file
+ Margining for PEG Training
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+#include "PcieTraining.h"
+
+#ifdef PEG_FLAG
+
+///
+/// Jitter Calculations
+///
+JITTER_SETTING Jitter_Gen3[/* 083.333 */] = {{1, 64, 1, 0}, {1, 33, 2, 0}, {3, 64, 3, 0}, {4, 80, 4, 0}, {5, 97, 5, 0}, {6, 128, 6, 0}, {7, 129, 7, 0}, {8, 161, 8, 0}, {9, 192, 9, 0}, {10, 193, 10, 0}, {11, 225, 11, 0}, {12, 128, 12, 1}, {13, 129, 13, 1}, {14, 145, 14, 1}, {15, 160, 15, 1}, {16, 161, 16, 1}, {17, 177, 17, 1}, {18, 192, 18, 1}, {19, 193, 19, 1}, {20, 209, 20, 1}, {21, 224, 21, 1}, {22, 225, 22, 1}, {23, 241, 23, 1}, {24, 246, 24, 1}};
+
+EFI_STATUS
+SetJitterTolerance (
+ IN UINT8 *LaneList,
+ IN UINT8 LaneListLength,
+ IN UINT8 ReportedMargin
+ )
+{
+ JITTER_SETTING Settings = {0, 0, 0, 0};
+ UINT8 i;
+ BOOLEAN Found;
+
+ if (ReportedMargin > 0) {
+ Found = FALSE;
+ for (i = 0; i < (JITTER_LENGTH - 1); ++i) {
+ Settings = Jitter_Gen3[i];
+ if (Settings.ReportedMargin == ReportedMargin) {
+ Found = TRUE;
+ break;
+ }
+ }
+
+ if (Found) {
+ return SetRawJitterTolerance (
+ LaneList,
+ LaneListLength,
+ Settings.Step,
+ Settings.Depth,
+ Settings.DoubleMargin,
+ TRUE
+ );
+ } else {
+ return EFI_INVALID_PARAMETER;
+ }
+ } else {
+ return SetRawJitterTolerance (
+ LaneList,
+ LaneListLength,
+ Settings.Step,
+ Settings.Depth,
+ Settings.DoubleMargin,
+ FALSE
+ );
+ }
+}
+
+EFI_STATUS
+SetRawJitterTolerance (
+ IN UINT8 *LaneList,
+ IN UINT8 LaneListLength,
+ IN UINT8 Step,
+ IN UINT8 Depth,
+ IN UINT8 DoubleMargin,
+ IN BOOLEAN EnableJitter
+ )
+{
+ UINT8 BundleList[8];
+ UINT8 BundleListLength;
+ UINT8 i;
+ UINT8 Lane;
+ UINT8 Bundle;
+
+ BundleListLength = 0;
+
+ GetBundleList (LaneList, LaneListLength, &BundleList[0], &BundleListLength);
+
+ for (i = 0; i < LaneListLength; ++i) {
+ Lane = LaneList[i];
+
+ McD1PciCfg32And (R_SA_PEG_AFELN0CFG0_OFFSET + (Lane * LANE_STEP), 0xFFFFFBFF);
+ }
+
+ for (i = 0; i < BundleListLength; ++i) {
+ Bundle = BundleList[i];
+
+ McD1PciCfg32AndThenOr (
+ R_SA_PEG_AFEBND0CFG0_OFFSET + (Bundle * BUNDLE_STEP),
+ (UINT32) ~(BIT28 | BIT17 | BIT16 | BIT15 | BIT14 | BIT13 | BIT12 | BIT11 | BIT10),
+ (UINT32) ((DoubleMargin << 28) | (Step << 10))
+ );
+
+ McD1PciCfg32AndThenOr (
+ R_SA_PEG_AFEBND0CFG3_OFFSET + (Bundle * BUNDLE_STEP),
+ (UINT32) ~(BIT16 | BIT15 | BIT14 | BIT13 | BIT12 | BIT11),
+ (UINT32) (Depth << 11)
+ );
+ }
+
+ if (EnableJitter) {
+ for (i = 0; i < LaneListLength; ++i) {
+ Lane = LaneList[i];
+ McD1PciCfg32Or (R_SA_PEG_AFELN0CFG0_OFFSET + (Lane * LANE_STEP), BIT10);
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+VOID
+EnableTxJitterInjection (
+ IN UINT8 Lane,
+ IN BOOLEAN EnableTxJitter
+ )
+{
+ UINT8 Bundle;
+
+ Bundle = Lane / 2;
+
+ if (EnableTxJitter) {
+ McD1PciCfg32AndThenOr (
+ R_SA_PEG_AFEBND0CFG0_OFFSET + (Bundle * BUNDLE_STEP),
+ ~(BIT1 | BIT2),
+ 0x6
+ );
+ } else {
+ McD1PciCfg32And (
+ R_SA_PEG_AFEBND0CFG0_OFFSET + (Bundle * BUNDLE_STEP),
+ ~(BIT1 | BIT2)
+ );
+ }
+}
+
+
+VOID
+ConfigureTxJitterMux (
+ IN UINT8 Lane,
+ IN UINT32 MchBar
+ )
+{
+ CPU_FAMILY CpuFamilyId;
+ CPU_STEPPING CpuSteppingId;
+ UINT32 SequenceId;
+
+ CpuFamilyId = GetCpuFamily ();
+ CpuSteppingId = GetCpuStepping ();
+ SequenceId = V_SA_VCU_SEQID_SET_TXJITTER_MUX;
+
+#ifndef AMI_OVERRIDE_FOR_ULT_FASTBOOT
+ if (CpuFamilyId == EnumCpuHswUlt) return;
+#endif // AMI_OVERRIDE_FOR_ULT_FASTBOOT
+
+ if ((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId == EnumHswA0)) {
+ SendVcuApiCmd (MchBar, V_SA_VCU_OPCODE_OPEN_SEQ_REV1, SequenceId);
+ } else {
+ SendVcuApiCmd (MchBar, V_SA_VCU_OPCODE_OPEN_SEQ_REV2, SequenceId);
+ }
+
+ SendVcuApiCmd (MchBar, V_SA_VCU_OPCODE_SET_TXJITTER_MUX, Lane);
+
+ if ((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId == EnumHswA0)) {
+ SendVcuApiCmd (MchBar, V_SA_VCU_OPCODE_CLOSE_SEQ_REV1, 0);
+ } else {
+ SendVcuApiCmd (MchBar, V_SA_VCU_OPCODE_CLOSE_SEQ_REV2, 0);
+ }
+
+ return;
+}
+
+EFI_STATUS
+GetBundleList (
+ IN UINT8 *LaneList,
+ IN UINT8 LaneListLength,
+ OUT UINT8 *BundleList,
+ OUT UINT8 *BundleListLength
+ )
+{
+ UINT8 Bundle;
+ BOOLEAN HasBundle;
+ UINT8 i;
+ UINT8 j;
+
+ (*BundleListLength) = 0;
+
+ for (i = 0; i < LaneListLength; ++i) {
+ Bundle = LaneList[i] / 2;
+
+ HasBundle = FALSE;
+ for (j = 0; j < (*BundleListLength); ++j) {
+ if (BundleList[j] == Bundle) {
+ HasBundle = TRUE;
+ break;
+ }
+ }
+
+ if (!HasBundle) {
+ BundleList[*BundleListLength] = Bundle;
+ ++(*BundleListLength);
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+#endif // PEG_FLAG
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/PcieTrainingPhase3.c b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/PcieTrainingPhase3.c
new file mode 100644
index 0000000..6123968
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/PcieTrainingPhase3.c
@@ -0,0 +1,657 @@
+/** @file
+ This driver trains the PEG interface.
+
+@copyright
+ Copyright (c) 2012 - 2014 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+#include "PcieTraining.h"
+
+#ifdef PEG_FLAG
+
+#include EFI_PPI_DEFINITION (PchMeUma)
+#include "PchMeUma.h"
+
+typedef struct _MARGIN_DATA {
+ UINT8 Preset;
+ INT32 TimingMargin[SA_PEG_MAX_LANE];
+} MARGIN_DATA;
+
+UINT8
+SelectBestPresetForLane (
+ IN PORT_INFO *PortInfo,
+ IN UINT8 Lane,
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi,
+ IN SA_DATA_HOB *SaDataHob,
+ IN UINT8 TrainingPreset
+ )
+{
+ UINT8 BestPreset;
+
+ ///
+ /// Init to EV default
+ ///
+ BestPreset = 7;
+
+ ///
+ /// EnableMargin FoundUsablePreset SaDataHob
+ /// Y Y !NULL -> Use training results; update SaDataHob
+ /// Y Y NULL -> Use training results
+ /// Y N !NULL -> Use Policy value; update SaDataHob
+ /// X N NULL -> Use Policy value
+ /// N X !NULL -> Restore from SaDataHob
+ ///
+ if (Lane < SA_PEG_MAX_LANE) {
+ DEBUG ((EFI_D_INFO, "Preset for Lane %2d: ", Lane));
+ if ((PortInfo->EnableMargin) && (PortInfo->FoundUsablePreset)) {
+ ///
+ /// Use the best preset found during training
+ ///
+ BestPreset = TrainingPreset;
+ DEBUG ((EFI_D_INFO, "Search Result: P%d", BestPreset));
+ if (SaDataHob != NULL) {
+ DEBUG ((EFI_D_INFO, ". Saving value for next boot."));
+ SaDataHob->PegData.BestPreset[Lane] = BestPreset;
+ }
+ } else if ((PortInfo->EnableMargin) && (!PortInfo->FoundUsablePreset) && (SaDataHob != NULL)) {
+ ///
+ /// Use the policy value; update SaDataHob
+ ///
+ BestPreset = (UINT8) SaPlatformPolicyPpi->PcieConfig->Gen3EndPointPreset[Lane];
+ DEBUG ((EFI_D_INFO, "Applying Policy value: P%d. Saving value for next boot.", BestPreset));
+ SaDataHob->PegData.BestPreset[Lane] = BestPreset;
+ } else if ((!PortInfo->FoundUsablePreset) && (SaDataHob == NULL)) {
+ ///
+ /// Use the policy value
+ ///
+ BestPreset = (UINT8) SaPlatformPolicyPpi->PcieConfig->Gen3EndPointPreset[Lane];
+ DEBUG ((EFI_D_INFO, "Applying Policy value: P%d", BestPreset));
+ } else if ((!PortInfo->EnableMargin) && (SaDataHob != NULL)) {
+ ///
+ /// Use the preset found on a previous boot
+ ///
+ BestPreset = (UINT8) SaDataHob->PegData.BestPreset[Lane];
+ DEBUG ((EFI_D_INFO, "Restoring previous value: P%d", BestPreset));
+ }
+ DEBUG ((EFI_D_INFO, "\n"));
+ } else {
+ ///
+ /// Error: Non-existent lane
+ ///
+ DEBUG ((EFI_D_ERROR, "Illegal Lane: %d", Lane));
+ }
+
+ return BestPreset;
+}
+
+VOID
+PegGen3PresetSearch (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi,
+ IN PEI_STALL_PPI *StallPpi,
+ SA_DATA_HOB *SaDataHob
+ )
+{
+ UINT8 Index;
+ INT32 MarginScore;
+ UINT8 PegBus;
+ UINT8 PegDev;
+ UINT8 PegFunc;
+ UINT16 LinkStatus;
+ BOOLEAN LoadedSavedPreset;
+ BOOLEAN EndpointDeviceChanged;
+ UINT8 TempIndex;
+ BOOLEAN SkipBundle0;
+ CPU_FAMILY CpuFamilyId;
+ CPU_STEPPING CpuSteppingId;
+ MARGIN_DATA MarginData[MAX_PRESETS];
+ PORT_INFO PortInfoList[SA_PEG_MAX_FUN];
+ INT32 LaneScores[SA_PEG_MAX_LANE];
+ INT32 BestScores[SA_PEG_MAX_LANE];
+ UINT8 BestPresets[SA_PEG_MAX_LANE];
+ EFI_STATUS Status;
+ UINT32 MonitorPort;
+ UINT8 PortInfoListLength;
+ UINT8 PortIndex;
+ UINT8 Lane;
+ BOOLEAN AnyGen3CapableLinks;
+ BOOLEAN AnyMarginingNeeded;
+ UINT8 PreCursor;
+ UINT8 Cursor;
+ UINT8 PostCursor;
+ UINT8 FullSwing;
+ UINT32 NominalRecoveryCount;
+ UINT8 FirstSkippedLane;
+ UINT8 LastSkippedLane;
+ UINT32 Data32;
+ BOOLEAN SlotResetNeeded;
+ PCH_ME_UMA_PPI *PchMeUmaPpi;
+ UINT8 DetectedReplacedCpu;
+
+ AnyMarginingNeeded = FALSE;
+ CpuFamilyId = GetCpuFamily();
+ CpuSteppingId = GetCpuStepping();
+
+ ///
+ /// Setup default presets to search
+ ///
+ MarginData[0].Preset = 7;
+ MarginData[1].Preset = 3;
+ MarginData[2].Preset = 5;
+
+ ///
+ /// Initialize Arrays
+ ///
+ for (Lane = 0; Lane < SA_PEG_MAX_LANE; Lane++) {
+ LaneScores[Lane] = -1;
+ BestScores[Lane] = -1;
+ BestPresets[Lane] = MarginData[0].Preset;
+ }
+
+ DEBUG ((EFI_D_INFO, "PEG Gen3 Preset Search\n"));
+
+ if (!SaPolicyEnablesGen3 (SaPlatformPolicyPpi)) {
+ DEBUG ((EFI_D_INFO, " Gen3 is disabled by policy\n"));
+ return;
+ }
+ if ((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId < EnumHswB0)) {
+ DEBUG ((EFI_D_WARN, " Gen3 preset search is not supported on this stepping\n"));
+ return;
+ }
+ Data32 = (McD1PciCfg32 (R_SA_PEG_PEGTST_OFFSET) & BIT20) >> 20;
+ if (Data32 != 0) {
+ DEBUG ((EFI_D_WARN, " Gen3 preset search does not support lane reversal\n"));
+ return;
+ }
+
+ ///
+ /// If ME is supported and the CPU has been replaced, redo the Preset Search.
+ /// Note that calling CpuReplacementCheck() can induce an ME-required warm reset.
+ ///
+ DetectedReplacedCpu = 0;
+ Status = EFI_SUCCESS;
+
+ if ((SaDataHob != NULL) && (SaDataHob->PegDataValid)) {
+ Status = (*PeiServices)->LocatePpi (PeiServices, &gPchMeUmaPpiGuid, 0, NULL, &PchMeUmaPpi);
+ ASSERT_EFI_ERROR (Status);
+ DEBUG ((EFI_D_INFO, "Calling CpuReplacementCheck\n"));
+ Status = PchMeUmaPpi->CpuReplacementCheck (PeiServices, NULL, &DetectedReplacedCpu);
+ ASSERT_EFI_ERROR (Status);
+ DEBUG ((EFI_D_INFO, " ME reported CPU Replacement value: %x\n", DetectedReplacedCpu));
+ }
+
+ ///
+ /// Get the furcation setup and port information
+ ///
+ GetPortInfo (&(PortInfoList[0]), &PortInfoListLength, &SkipBundle0);
+
+ ///
+ /// Make sure we at Gen3 before starting, if not attempt reset and see if that helps
+ ///
+ SlotResetNeeded = FALSE;
+ for (PortIndex = 0; PortIndex < PortInfoListLength; PortIndex++) {
+ PegBus = (PortInfoList[PortIndex]).PegPort.Bus;
+ PegDev = (PortInfoList[PortIndex]).PegPort.Device;
+ PegFunc = (PortInfoList[PortIndex]).PegPort.Function;
+ LinkStatus = MmPci16 (0, PegBus, PegDev, PegFunc, R_SA_PEG_LSTS_OFFSET);
+ if (((LinkStatus & 0x0F) != 3) && ((PortInfoList[PortIndex]).LinkIsGen3Capable)) {
+ SlotResetNeeded = TRUE;
+ break;
+ }
+ }
+ if (SlotResetNeeded) {
+ ///
+ /// Bypass phase2 and assert slot reset
+ ///
+ McD1PciCfg32Or (R_SA_PEG_EQCFG_OFFSET, BIT15);
+ Status = TogglePegSlotReset (PeiServices, StallPpi, SaPlatformPolicyPpi);
+ if (!EFI_ERROR (Status)) {
+ for (PortIndex = 0; PortIndex < PortInfoListLength; PortIndex++) {
+ PegBus = (PortInfoList[PortIndex]).PegPort.Bus;
+ PegDev = (PortInfoList[PortIndex]).PegPort.Device;
+ PegFunc = (PortInfoList[PortIndex]).PegPort.Function;
+ ///
+ /// Wait for Equalization Done
+ ///
+ while (((MmPci32 (0, PegBus, PegDev, PegFunc, R_SA_PEG_LSTS2_OFFSET) >> 1) & 0x1) != 0x1);
+ ///
+ /// Wait for flow control credits exchange
+ ///
+ WaitForVc0Negotiation (PeiServices, StallPpi, PegBus, PegDev, PegFunc);
+ }
+ }
+ }
+
+ ///
+ /// Determine which PEG ports require testing
+ ///
+ AnyGen3CapableLinks = FALSE;
+ for (PortIndex = 0; PortIndex < PortInfoListLength; PortIndex++) {
+ PegBus = (PortInfoList[PortIndex]).PegPort.Bus;
+ PegDev = (PortInfoList[PortIndex]).PegPort.Device;
+ PegFunc = (PortInfoList[PortIndex]).PegPort.Function;
+
+ ///
+ /// If we already have Best Preset value from previous boot, use it and skip PresetSearch when end point device no change
+ ///
+ LoadedSavedPreset = FALSE;
+ EndpointDeviceChanged = TRUE;
+ if (SaDataHob != NULL) {
+ if (SaDataHob->PegDataValid) {
+ LoadedSavedPreset = TRUE;
+ if (SaDataHob->PegData.EndPointVendorIdDeviceId[PegFunc] == (PortInfoList[PortIndex]).EndPointVendorIdDeviceId) {
+ EndpointDeviceChanged = FALSE;
+ }
+ }
+ if (EndpointDeviceChanged) {
+ ///
+ /// Save new device ID vendor ID
+ ///
+ SaDataHob->PegData.EndPointVendorIdDeviceId[PegFunc] = (PortInfoList[PortIndex]).EndPointVendorIdDeviceId;
+ }
+ }
+ DEBUG ((EFI_D_INFO, " PEG%x%x (%x:%x:%x) - LoadedSavedPreset = %d. EndpointDeviceChanged = %d.\n",
+ PegDev, PegFunc, PegBus, PegDev, PegFunc, LoadedSavedPreset, EndpointDeviceChanged));
+
+ ReportPcieLinkStatus (PegBus, PegDev, PegFunc);
+
+ if ( (!LoadedSavedPreset) ||
+ (EndpointDeviceChanged) ||
+ (DetectedReplacedCpu != 0) ||
+ ((SaPlatformPolicyPpi->Revision >= SA_PLATFORM_POLICY_PPI_REVISION_2) &&
+ (SaPlatformPolicyPpi->PcieConfig->PegGen3ForcePresetSearch == 1 ))) {
+ (PortInfoList[PortIndex]).EnableMargin = TRUE;
+ } else {
+ (PortInfoList[PortIndex]).EnableMargin = FALSE;
+ }
+
+ if (!(PortInfoList[PortIndex]).LinkIsGen3Capable) {
+ (PortInfoList[PortIndex]).EnableMargin = FALSE;
+ } else {
+ AnyGen3CapableLinks = TRUE;
+ }
+ } ///< PegFunc Loop end
+
+ if (!AnyGen3CapableLinks) {
+ DEBUG ((EFI_D_INFO, "Skipping Preset Search - No Gen3 capable links\n"));
+ return;
+ }
+
+ ///
+ /// Determine if any ports need to be trained.
+ /// If any ports are trained, the corresponding endpoint should also be reset with PERST#.
+ ///
+ for (PortIndex = 0; PortIndex < PortInfoListLength; PortIndex++) {
+ if ((PortInfoList[PortIndex]).EnableMargin == TRUE) {
+ AnyMarginingNeeded = TRUE;
+ break;
+ }
+ }
+
+ if (AnyMarginingNeeded) {
+ MonitorPort = OpenMonitor (PeiServices, SaPlatformPolicyPpi, StallPpi);
+
+ McD1PciCfg32Or (R_SA_PEG_REUT_PH_CTR_OFFSET, B_SA_PEG_REUT_PH_CTR_AUTOCOMP_MASK);
+
+ ///
+ /// Presets Loop start
+ ///
+ for (Index = 0; Index < MAX_PRESETS; Index++) {
+ ///
+ /// Clear out old values
+ ///
+ for (TempIndex = 0; TempIndex < SA_PEG_MAX_LANE; TempIndex++) {
+ MarginData[Index].TimingMargin[TempIndex] = 0;
+ } ///< End of for each Lane
+
+
+ for (PortIndex = 0; PortIndex < PortInfoListLength; PortIndex++) {
+ (PortInfoList[PortIndex]).SkipMargin = FALSE;
+ PegBus = (PortInfoList[PortIndex]).PegPort.Bus;
+ PegDev = (PortInfoList[PortIndex]).PegPort.Device;
+ PegFunc = (PortInfoList[PortIndex]).PegPort.Function;
+
+ if (!(PortInfoList[PortIndex]).LinkIsGen3Capable) {
+ DEBUG ((EFI_D_INFO, "Skipping PEG%d%d - Not Gen3 capable\n", PegDev, PegFunc));
+ continue;
+ }
+
+ ///
+ /// Find first lane of the port for coefficient programming
+ ///
+ switch (PegFunc) {
+ default:
+ case 0:
+ Lane = 0;
+ FirstSkippedLane = 0;
+ LastSkippedLane = 1;
+ break;
+ case 1:
+ Lane = 8;
+ FirstSkippedLane = 8;
+ LastSkippedLane = 9;
+ break;
+ case 2:
+ Lane = 12;
+ FirstSkippedLane = 12;
+ LastSkippedLane = 13;
+ break;
+ }
+
+ ///
+ /// Get FullSwing
+ ///
+ GetLinkPartnerFullSwing (Lane, &FullSwing);
+
+ ///
+ /// Get Coefficients
+ ///
+ GetCoefficientsFromPreset (MarginData[Index].Preset, FullSwing, &PreCursor, &Cursor, &PostCursor);
+
+ ///
+ /// Set Lane's Coefficients
+ ///
+ if (SkipBundle0) {
+ for (TempIndex = FirstSkippedLane; TempIndex <= LastSkippedLane; TempIndex++) {
+ SetPartnerTxCoefficients (TempIndex, &PreCursor, &Cursor, &PostCursor);
+ ProgramPreset (1, MarginData[Index].Preset, PegFunc, TempIndex);
+ }
+ }
+ for (TempIndex = 0; TempIndex < (PortInfoList[PortIndex]).LaneListLength; TempIndex++) {
+ SetPartnerTxCoefficients ((PortInfoList[PortIndex]).LaneList[TempIndex], &PreCursor, &Cursor, &PostCursor);
+ ProgramPreset (1, MarginData[Index].Preset, PegFunc, (PortInfoList[PortIndex]).LaneList[TempIndex]);
+ }
+
+ ///
+ /// Set DOEQ bit
+ ///
+ MmPci32Or (0, PegBus, PegDev, PegFunc, R_SA_PEG_LCTL3_OFFSET, BIT0);
+ RetrainLink (PeiServices, StallPpi, &((PortInfoList[PortIndex]).PegPort));
+
+ ///
+ /// Get the current link status
+ ///
+ LinkStatus = MmPci16 (0, PegBus, PegDev, PegFunc, R_SA_PEG_LSTS_OFFSET);
+ ///
+ /// No need to margin if couldn't get to Gen3 with this preset
+ ///
+ if ((LinkStatus & 0x0F) != 3) {
+ RecoverLinkFailure (PeiServices, SaPlatformPolicyPpi, SaDataHob, StallPpi,
+ &((PortInfoList[PortIndex]).PegPort), 3,
+ GetNegotiatedWidth (&((PortInfoList[PortIndex]).PegPort)));
+ LinkStatus = MmPci16 (0, PegBus, PegDev, PegFunc, R_SA_PEG_LSTS_OFFSET);
+ if ((LinkStatus & 0x0F) != 3) {
+ (PortInfoList[PortIndex]).SkipMargin = TRUE;
+ continue;
+ }
+ }
+
+ NominalRecoveryCount = SaPcieGetErrorCount (MonitorPort, PegFunc);
+ StallPpi->Stall (PeiServices, StallPpi, SaPlatformPolicyPpi->PcieConfig->PegGen3PresetSearchDwellTime * STALL_ONE_MICRO_SECOND);
+ NominalRecoveryCount = SaPcieGetErrorCount (MonitorPort, PegFunc) - NominalRecoveryCount;
+ if (NominalRecoveryCount > 0) {
+ (PortInfoList[PortIndex]).SkipMargin = TRUE;
+ continue;
+ }
+ (PortInfoList[PortIndex]).FoundUsablePreset = TRUE;
+ } ///< End of for each Port
+
+ Status = RunMarginTest (
+ PeiServices,
+ SaPlatformPolicyPpi,
+ SaDataHob,
+ StallPpi,
+ MonitorPort,
+ &(PortInfoList[0]),
+ PortInfoListLength,
+ LaneLevelRxJitter,
+ MarginData[Index].TimingMargin
+ );
+
+ if (EFI_ERROR (Status)) {
+ for (TempIndex = 0; TempIndex < SA_PEG_MAX_LANE; TempIndex++) {
+ MarginData[Index].TimingMargin[TempIndex] = 0;
+ }
+ }
+ } ///< Presets Loop end
+
+ McD1PciCfg32And (R_SA_PEG_REUT_PH_CTR_OFFSET, ~B_SA_PEG_REUT_PH_CTR_AUTOCOMP_MASK);
+ CloseMonitor (SaPlatformPolicyPpi, MonitorPort);
+
+ ///
+ /// Find the preset with the maximum margin (largest of all margin values)
+ ///
+ for (Index = 0; Index < sizeof (MarginData) / sizeof (MarginData[0]); Index++) {
+ for (Lane = 0; Lane < SA_PEG_MAX_LANE; Lane++) {
+ LaneScores[Lane] = -1;
+ }
+ for (Lane = 0; Lane < SA_PEG_MAX_LANE; Lane++) {
+ if (MarginData[Index].TimingMargin[Lane] != -1) {
+ MarginScore = MarginData[Index].TimingMargin[Lane];
+ LaneScores[Lane] = MarginScore;
+ }
+ if (LaneScores[Lane] > BestScores[Lane]) {
+ BestScores[Lane] = LaneScores[Lane];
+ BestPresets[Lane] = MarginData[Index].Preset;
+ }
+ } ///< End of for each Lane
+ } ///< End of for each Preset
+
+ ///
+ /// If Lanes 0-1 were skipped, copy the values from Lane 2
+ ///
+ if (SkipBundle0) {
+ for (PortIndex = 0; PortIndex < PortInfoListLength; PortIndex++) {
+ PegFunc = (PortInfoList[PortIndex]).PegPort.Function;
+ switch (PegFunc) {
+ default:
+ case 0:
+ Lane = 2;
+ FirstSkippedLane = 0;
+ LastSkippedLane = 1;
+ break;
+ case 1:
+ Lane = 10;
+ FirstSkippedLane = 8;
+ LastSkippedLane = 9;
+ break;
+ case 2:
+ Lane = 14;
+ FirstSkippedLane = 12;
+ LastSkippedLane = 13;
+ break;
+ }
+ if (BestScores[Lane] != -1) {
+ DEBUG ((EFI_D_INFO, "Using Lane %2d's Best Preset for Lanes %2d-%2d.\n", Lane, FirstSkippedLane, LastSkippedLane));
+ for (TempIndex = FirstSkippedLane; TempIndex <= LastSkippedLane; TempIndex++) {
+ BestScores[TempIndex] = BestScores[Lane];
+ BestPresets[TempIndex] = BestPresets[Lane];
+ }
+ }
+ } ///< End of for each port
+ } ///< End of SkipBundle0
+ } ///< End of AnyMarginingNeeded
+
+ for (PortIndex = 0; PortIndex < PortInfoListLength; PortIndex++) {
+ PegBus = (PortInfoList[PortIndex]).PegPort.Bus;
+ PegDev = (PortInfoList[PortIndex]).PegPort.Device;
+ PegFunc = (PortInfoList[PortIndex]).PegPort.Function;
+ if (!(PortInfoList[PortIndex]).LinkIsGen3Capable) {
+ continue;
+ }
+ if (SkipBundle0) {
+ switch (PegFunc) {
+ default:
+ case 0:
+ FirstSkippedLane = 0;
+ LastSkippedLane = 1;
+ break;
+ case 1:
+ FirstSkippedLane = 8;
+ LastSkippedLane = 9;
+ break;
+ case 2:
+ FirstSkippedLane = 12;
+ LastSkippedLane = 13;
+ break;
+ }
+ for (TempIndex = FirstSkippedLane; TempIndex <= LastSkippedLane; TempIndex++) {
+ BestPresets[TempIndex] = SelectBestPresetForLane (
+ &(PortInfoList[PortIndex]),
+ TempIndex,
+ SaPlatformPolicyPpi,
+ SaDataHob,
+ BestPresets[TempIndex]
+ );
+ }
+ }
+ for (TempIndex = 0; TempIndex < (PortInfoList[PortIndex]).LaneListLength; TempIndex++) {
+ BestPresets[(PortInfoList[PortIndex]).LaneList[TempIndex]] = SelectBestPresetForLane (
+ &(PortInfoList[PortIndex]),
+ (PortInfoList[PortIndex]).LaneList[TempIndex],
+ SaPlatformPolicyPpi,
+ SaDataHob,
+ BestPresets[(PortInfoList[PortIndex]).LaneList[TempIndex]]
+ );
+ }
+ }
+
+ ///
+ /// Program the presets. If any link was margined, also reset the
+ /// endpoints in order to return the endpoints to a known-good state.
+ ///
+ if (AnyMarginingNeeded) {
+ for (TempIndex = 0; TempIndex < SA_PEG_MAX_FUN; TempIndex++) {
+ MmPci16Or (0, SA_PEG_BUS_NUM, SA_PEG_DEV_NUM, TempIndex, R_SA_PEG_LCTL_OFFSET, BIT4);
+ }
+ AssertPegSlotReset (SaPlatformPolicyPpi);
+ }
+ for (PortIndex = 0; PortIndex < PortInfoListLength; PortIndex++) {
+ PegBus = (PortInfoList[PortIndex]).PegPort.Bus;
+ PegDev = (PortInfoList[PortIndex]).PegPort.Device;
+ PegFunc = (PortInfoList[PortIndex]).PegPort.Function;
+ if (!(PortInfoList[PortIndex]).LinkIsGen3Capable) {
+ DEBUG ((EFI_D_INFO, "PEG%d%d - Not Gen3 capable, skip coefficient programming.\n", PegDev, PegFunc));
+ continue;
+ }
+ ///
+ /// Find first lane of the port for coefficient programming
+ ///
+ switch (PegFunc) {
+ default:
+ case 0:
+ Lane = 0;
+ FirstSkippedLane = 0;
+ LastSkippedLane = 1;
+ break;
+ case 1:
+ Lane = 8;
+ FirstSkippedLane = 8;
+ LastSkippedLane = 9;
+ break;
+ case 2:
+ Lane = 12;
+ FirstSkippedLane = 12;
+ LastSkippedLane = 13;
+ break;
+ }
+ ///
+ /// Get FullSwing
+ ///
+ GetLinkPartnerFullSwing (Lane, &FullSwing);
+
+ if (SkipBundle0) {
+ for (TempIndex = FirstSkippedLane; TempIndex <= LastSkippedLane; TempIndex++) {
+ GetCoefficientsFromPreset (BestPresets[TempIndex], FullSwing, &PreCursor, &Cursor, &PostCursor);
+ SetPartnerTxCoefficients (TempIndex, &PreCursor, &Cursor, &PostCursor);
+ ProgramPreset (1, BestPresets[TempIndex], PegFunc, TempIndex);
+ }
+ }
+ for (TempIndex = 0; TempIndex < (PortInfoList[PortIndex]).LaneListLength; TempIndex++) {
+ ///
+ /// Get Coefficients
+ ///
+ GetCoefficientsFromPreset (BestPresets[((PortInfoList[PortIndex]).LaneList[TempIndex])], FullSwing, &PreCursor, &Cursor, &PostCursor);
+
+ ///
+ /// Set Lane's Coefficients
+ ///
+ SetPartnerTxCoefficients ((PortInfoList[PortIndex]).LaneList[TempIndex], &PreCursor, &Cursor, &PostCursor);
+
+ ///
+ /// Set Phase 1 Presets
+ ///
+ ProgramPreset (1, BestPresets[((PortInfoList[PortIndex]).LaneList[TempIndex])], PegFunc, (PortInfoList[PortIndex]).LaneList[TempIndex]);
+ }
+
+ MmPci32Or (0, PegBus, PegDev, PegFunc, R_SA_PEG_LCTL3_OFFSET, BIT0); ///< DOEQ
+ MmPci16Or (0, PegBus, PegDev, PegFunc, R_SA_PEG_LCTL_OFFSET, BIT5); ///< Retrain link
+ }
+
+ if (AnyMarginingNeeded) {
+ StallPpi->Stall (PeiServices, StallPpi, 100 * STALL_ONE_MICRO_SECOND);
+ for (TempIndex = 0; TempIndex < SA_PEG_MAX_FUN; TempIndex++) {
+ MmPci16And (0, SA_PEG_BUS_NUM, SA_PEG_DEV_NUM, TempIndex, R_SA_PEG_LCTL_OFFSET, (UINT16) ~(BIT4));
+ }
+ DeassertPegSlotReset (SaPlatformPolicyPpi);
+ }
+
+ for (PortIndex = 0; PortIndex < PortInfoListLength; PortIndex++) {
+ PegBus = (PortInfoList[PortIndex]).PegPort.Bus;
+ PegDev = (PortInfoList[PortIndex]).PegPort.Device;
+ PegFunc = (PortInfoList[PortIndex]).PegPort.Function;
+ WaitForL0 (PeiServices, StallPpi, &(PortInfoList[PortIndex].PegPort), FALSE);
+ ReportPcieLinkStatus (PegBus, PegDev, PegFunc);
+ }
+
+ DEBUG ((EFI_D_INFO, "PEG Gen3 Preset Search done\n\n"));
+
+ return;
+}
+
+BOOLEAN
+SaPolicyEnablesGen3 (
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi
+ )
+{
+ UINTN PegPortGenx;
+ BOOLEAN Gen3Enabled;
+ UINT8 Index;
+
+ Gen3Enabled = FALSE;
+
+ ///
+ /// Check if Gen3 is enabled on PEG10/11/12
+ ///
+ for (Index = 0; Index < SA_PEG_MAX_FUN; Index++) {
+ ///
+ /// PegPortGenx: 0 = Auto, 1 = Gen1, 2 = Gen2, 3 = Gen3
+ ///
+ PegPortGenx = SaPlatformPolicyPpi->PcieConfig->PegGenx[Index];
+
+ ///
+ /// Check if the root port is present and the speed is not limited to Gen1/Gen2
+ ///
+ if ((PegPortGenx == PEG_AUTO) || (PegPortGenx == PEG_GEN3)) {
+ Gen3Enabled = TRUE;
+ break;
+ }
+ }
+ return Gen3Enabled;
+}
+
+#endif // PEG_FLAG
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaDmiPeim.c b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaDmiPeim.c
new file mode 100644
index 0000000..ea817d8
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaDmiPeim.c
@@ -0,0 +1,450 @@
+/** @file
+ SA Dmi PEI Initialization library
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "SaDmiPeim.h"
+#include "PciExpressInit.h"
+
+///
+/// Functions
+///
+/**
+ Initialize DMI Tc/Vc mapping through SA-PCH.
+
+ @param[in] PeiServices - General purpose services available to every PEIM.
+ @param[in] SaPlatformPolicyPpi - Instance of SA_PLATFORM_POLICY_PPI
+
+ @retval EFI_SUCCESS
+**/
+EFI_STATUS
+SaDmiTcVcInit (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi
+ )
+{
+ EFI_STATUS Status;
+ UINT64 MchBar;
+ UINT64 DmiBar;
+ PCH_INIT_PPI *PchInitPpi;
+ PCH_DMI_TC_VC_PPI *PchDmiTcVcMapPpi;
+ CPU_FAMILY CpuFamilyId;
+ UINT8 i;
+
+ MchBar = McD0PciCfg64 (R_SA_MCHBAR) &~BIT0;
+ DmiBar = McD0PciCfg64 (R_SA_DMIBAR) &~BIT0;
+ CpuFamilyId = GetCpuFamily();
+
+ ///
+ /// Locate PchInitPpi and PchDmiTcVcMapPpi
+ ///
+ Status = (*PeiServices)->LocatePpi (PeiServices, &gPchInitPpiGuid, 0, NULL, (VOID **) &PchInitPpi);
+ ASSERT_EFI_ERROR (Status);
+
+ Status = (*PeiServices)->LocatePpi (PeiServices, &gPchDmiTcVcMapPpiGuid, 0, NULL, (VOID **) &PchDmiTcVcMapPpi);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// SA OPI Initialization
+ ///
+ if (CpuFamilyId == EnumCpuHswUlt) {
+ MmioOr8 ((UINTN) (DmiBar + 0xA78), BIT1);
+ }
+
+ ///
+ /// Update DmiTcVcMapping based on Policy
+ ///
+ PchDmiTcVcMapPpi->DmiVc[DmiVcTypeVc1].Enable = (BOOLEAN) SaPlatformPolicyPpi->PcieConfig->DmiVc1;
+ PchDmiTcVcMapPpi->DmiVc[DmiVcTypeVcp].Enable = (BOOLEAN) SaPlatformPolicyPpi->PcieConfig->DmiVcp;
+ PchDmiTcVcMapPpi->DmiVc[DmiVcTypeVcm].Enable = (BOOLEAN) SaPlatformPolicyPpi->PcieConfig->DmiVcm;
+
+ for (i = 0; i < DmiTcTypeMax; i++) {
+ if (((PchDmiTcVcMapPpi->DmiTc[i].Vc == DmiVcTypeVc1) && (PchDmiTcVcMapPpi->DmiVc[DmiVcTypeVc1].Enable == FALSE)) ||
+ ((PchDmiTcVcMapPpi->DmiTc[i].Vc == DmiVcTypeVcp) && (PchDmiTcVcMapPpi->DmiVc[DmiVcTypeVcp].Enable == FALSE)) ||
+ ((PchDmiTcVcMapPpi->DmiTc[i].Vc == DmiVcTypeVcm) && (PchDmiTcVcMapPpi->DmiVc[DmiVcTypeVcm].Enable == FALSE))
+ ) {
+ PchDmiTcVcMapPpi->DmiTc[i].Vc = DmiVcTypeVc0;
+ }
+ }
+ ///
+ /// Program NB TC/VC mapping
+ ///
+ SaSetDmiTcVcMapping (PchDmiTcVcMapPpi, DmiBar);
+
+ ///
+ /// Call PchDmiTcVcProgPoll
+ ///
+ Status = PchInitPpi->DmiTcVcProgPoll (PeiServices);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Poll NB negotiation completion
+ ///
+ SaPollDmiVcStatus (PchDmiTcVcMapPpi, DmiBar);
+ ASSERT_EFI_ERROR (Status);
+
+ return EFI_SUCCESS;
+
+}
+
+/**
+ Map SA DMI TCs to VC
+
+ @param[in] PchDmiTcVcMapPpi - Instance of PCH_DMI_TC_VC_PPI
+ @param[in] DmiBar - DMIBAR address
+
+ @retval EFI_SUCCESS - Succeed.
+ @retval EFI_INVALID_PARAMETER - Wrong phase parameter passed in.
+**/
+EFI_STATUS
+SaSetDmiTcVcMapping (
+ IN PCH_DMI_TC_VC_PPI *PchDmiTcVcMapPpi,
+ IN UINT64 DmiBar
+ )
+{
+ UINT32 Data32And;
+ UINT32 Data32Or;
+ UINT8 Data8And;
+ UINT8 Data8Or;
+ UINT8 Index;
+ UINT16 Register;
+ UINT8 VcId;
+ UINT8 VcMap[DmiVcTypeMax] = { 0 };
+
+ ///
+ /// Set the TC/VC mappings
+ ///
+ for (Index = 0; Index < DmiTcTypeMax; Index++) {
+ VcMap[PchDmiTcVcMapPpi->DmiTc[Index].Vc] |= (BIT0 << Index);
+ }
+ ///
+ /// System BIOS must perform the following steps for VC0 configuration.
+ /// Program the TCs/VC0 map by setting DMIBAR offset 014h [7:1] = '0111 101b'.
+ ///
+ /// Private Virtual Channel Configuration
+ /// Step1. Assign Virtual Channel ID 2 to VCp:
+ /// Programming the DMIVCPRCTL DMI Port Register DMIBAR Offset 02Ch[26:24] = '010b'.
+ ///
+ /// Step2. Set TC2 to VCp:
+ /// Program the DMIVCPRCTL DMI Port Register DMIBAR offset 02Ch [7:1] = '0000 010b'.
+ ///
+ /// Step3. Enable VCp by programming the DMIVCPRCTL DMI Port Register DMIBAR Offset 02Ch[31] = '1b'.
+ ///
+ /// Virtual Channel for ME (VCm) Configuration
+ /// This is configured by ConfigMemMe
+ ///
+ /// Step1. Assign Virtual Channel ID 7 to VCm:
+ /// Programming the DMIVCMRCTL DMI Port Register DMIBAR Offset 038h[26:24] = '111b'.
+ ///
+ /// Step2. Enable VCm:
+ /// Programming the DMIVMPRCTL DMI Port Register DMIBAR Offset 038h[31] = '1b'.
+ ///
+ /// Step3. Enable VCm by programming the DMIVCMRCTL DMI Port Register DMIBAR Offset 038h[31] = '1b'.
+ ///
+ for (Index = 0; Index < DmiVcTypeMax; Index++) {
+ if (PchDmiTcVcMapPpi->DmiVc[Index].Enable == PCH_DEVICE_ENABLE) {
+ ///
+ /// Map TCs to VC, Set the VC ID, Enable VC
+ ///
+ VcId = PchDmiTcVcMapPpi->DmiVc[Index].VcId,
+
+ Data32And = (UINT32) (~(V_SA_DMIBAR_DMIVCCTL_ID | B_SA_DMIBAR_DMIVCCTL_TVM_MASK));
+ Data32Or = VcId << N_SA_DMIBAR_DMIVCCTL_ID;
+ Data32Or |= VcMap[Index];
+ Data32Or |= N_SA_DMIBAR_DMIVCCTL_EN;
+
+ switch (Index) {
+ case DmiVcTypeVc0:
+ Register = R_SA_DMIBAR_DMIVC0RCTL_OFFSET;
+ break;
+
+ case DmiVcTypeVc1:
+ Register = R_SA_DMIBAR_DMIVC1RCTL_OFFSET;
+ break;
+
+ case DmiVcTypeVcp:
+ Register = R_SA_DMIBAR_DMIVCPRCTL_OFFSET;
+ break;
+
+ case DmiVcTypeVcm:
+ Register = R_SA_DMIBAR_DMIVCMRCTL_OFFSET;
+ break;
+
+ default:
+ return EFI_INVALID_PARAMETER;
+ }
+
+ MmioAndThenOr32 ((UINTN) (DmiBar + Register), Data32And, Data32Or);
+ }
+ }
+ ///
+ /// System BIOS must program the extended VC Count:
+ /// Set the DMI Port Register DMIBAR Offset 004h[2:0]=001b
+ ///
+ Data8And = (UINT8) (~0x07);
+ if (PchDmiTcVcMapPpi->DmiVc[DmiVcTypeVc1].Enable == TRUE) {
+ Data8Or = 1;
+ } else {
+ Data8Or = 0;
+ }
+
+ MmioAndThenOr8 ((UINTN) (DmiBar + R_SA_DMIBAR_DMIPVCCAP1_OFFSET), Data8And, Data8Or);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Poll SA DMI negotiation completion
+
+ @param[in] PchDmiTcVcMapPpi - Instance of PCH_DMI_TC_VC_PPI
+ @param[in] DmiBar - DMIBAR address
+
+ @retval EFI_SUCCESS - Succeed.
+ @retval EFI_INVALID_PARAMETER - Wrong phase parameter passed in.
+**/
+EFI_STATUS
+SaPollDmiVcStatus (
+ IN PCH_DMI_TC_VC_PPI *PchDmiTcVcMapPpi,
+ IN UINT64 DmiBar
+ )
+{
+ UINT8 Index;
+ UINT16 Register;
+
+ ///
+ /// 6.2.3.2 - Step 4, Poll until VC1 has been negotiated
+ /// Read the DMIVC1RSTS DMI Port Register Offset 026h until [1]==0
+ ///
+ /// 6.2.3.3 - Step4. Poll the VCp Negotiation Pending bit until it reads 0:
+ /// Read the DMIVCPRSTS DMI Port Register Offset 032h until [1]==0
+ ///
+ /// 6.2.3.4 - Step4. Poll the VCm Negotiation Pending bit until it reads 0:
+ /// Read the DMIVCMRSTS DMI Port Register Offset 03Eh until [1]==0
+ ///
+ for (Index = 0; Index < DmiVcTypeMax; Index++) {
+ if (PchDmiTcVcMapPpi->DmiVc[Index].Enable == PCH_DEVICE_ENABLE) {
+ switch (Index) {
+ case DmiVcTypeVc0:
+ Register = R_SA_DMIBAR_DMIVC0RSTS_OFFSET;
+ break;
+
+ case DmiVcTypeVc1:
+ Register = R_SA_DMIBAR_DMIVC1RSTS_OFFSET;
+ break;
+
+ case DmiVcTypeVcp:
+ Register = R_SA_DMIBAR_DMIVCPRSTS_OFFSET;
+ break;
+
+ case DmiVcTypeVcm:
+ Register = R_SA_DMIBAR_DMIVCMRSTS_OFFSET;
+ break;
+
+ default:
+ return EFI_INVALID_PARAMETER;
+ }
+ ///
+ /// Wait for negotiation to complete
+ ///
+ while ((MmioRead16 ((UINTN) (DmiBar + Register)) & B_SA_DMIBAR_DMISTS_NP) != 0);
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+#ifdef DMI_FLAG
+/**
+ Initialize DMI.
+
+ @param[in] PeiServices - General purpose services available to every PEIM.
+ @param[in] SaPlatformPolicyPpi - Instance of SA_PLATFORM_POLICY_PPI
+
+ @retval EFI_SUCCESS
+**/
+EFI_STATUS
+DmiInit (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi
+ )
+{
+ EFI_STATUS Status;
+ UINT64 MchBar;
+ UINT64 DmiBar;
+ PCH_INIT_PPI *PchInitPpi;
+ PCH_PLATFORM_POLICY_PPI *PchPlatformPolicyPpi;
+ UINT8 CpuSteppingId;
+ BOOLEAN DmiGen2Enable;
+ UINT16 LinkStatus;
+ UINT32 Data32Or;
+
+ ///
+ /// Read the CPU stepping
+ ///
+ CpuSteppingId = GetCpuStepping();
+
+ ///
+ /// BridgeId = (UINT8) (McD0PciCfg16 (R_MC_DEVICE_ID) & 0xF0);
+ /// BridgeSteppingId = BridgeId + CpuSteppingId;
+ ///
+ MchBar = McD0PciCfg64 (R_SA_MCHBAR) &~BIT0;
+ DmiBar = McD0PciCfg64 (R_SA_DMIBAR) &~BIT0;
+
+ ///
+ /// Get RCBA through the PchPlatformPolicy PPI
+ ///
+ Status = (**PeiServices).LocatePpi (
+ PeiServices,
+ &gPchPlatformPolicyPpiGuid,
+ 0,
+ NULL,
+ &PchPlatformPolicyPpi
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "Can't locate PchPlatformPolicy PPI - exiting.\n"));
+ return Status;
+ }
+ ///
+ /// Perform DMI Recipe steps
+ ///
+ DEBUG ((EFI_D_INFO, "DMI Recipe...\n"));
+ PegDmiRecipe (SaPlatformPolicyPpi, (UINT32) MchBar, (UINT32) DmiBar, 0, 0);
+
+ ///
+ /// Additional DMI steps. See SA BIOS Spec.
+ ///
+ DEBUG ((EFI_D_INFO, "Run AdditionalDmiProgramSteps!\n"));
+ AdditionalDmiProgramSteps (SaPlatformPolicyPpi, (UINT32) MchBar, (UINT32) DmiBar);
+
+ DmiGen2Enable = TRUE;
+ if ((SaPlatformPolicyPpi->PcieConfig->DmiGen2 == 0) ||
+ ((MmioRead8 ((UINTN) PchPlatformPolicyPpi->Rcba + R_PCH_RCRB_LCAP) & (BIT0 | BIT1 | BIT2 | BIT3)) == 0x1) ||
+ (McDevFunPciCfg32 (0, 0, 0, R_SA_MC_CAPID0_A_OFFSET) & BIT22)
+ ) {
+ DEBUG ((EFI_D_WARN, "DMI Gen2 is Disabled or not capable, staying at Gen1 !\n"));
+ DmiGen2Enable = FALSE;
+ }
+
+ if (DmiGen2Enable) {
+ ///
+ /// Locate PchInitPpi
+ ///
+ Status = (*PeiServices)->LocatePpi (PeiServices, &gPchInitPpiGuid, 0, NULL, &PchInitPpi);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Program PCH TLS to Gen 2
+ ///
+ PchInitPpi->DmiGen2Prog (PeiServices);
+
+ ///
+ /// Program CPU Max Link Speed to Gen 2
+ ///
+ MmioAndThenOr32 ((UINTN) (DmiBar + R_SA_DMIBAR_LCAP_OFFSET), (UINT32)~0xF, 2);
+ }
+ Data32Or = (MmioRead32 ((UINTN) (DmiBar + R_SA_DMIBAR_LCAP_OFFSET)) & (BIT3 | BIT2 | BIT1 | BIT0));
+ MmioAndThenOr32 ((UINTN) (DmiBar + R_SA_DMIBAR_LCTL2_OFFSET), (UINT32)~(BIT3 | BIT2 | BIT1 | BIT0), Data32Or);
+
+ ///
+ /// Retrain link
+ ///
+ DmiLinkTrain (DmiBar);
+
+ ///
+ /// Retrain link if it is GEN2 Capable and it is not yet set to GEN2
+ ///
+ if (DmiGen2Enable &&
+ ((((MmioRead16 ((UINTN) (DmiBar + R_SA_DMIBAR_LSTS_OFFSET))) & 0x0F) != DMI_GEN2) ||
+ (((MmioRead16 ((UINTN) PchPlatformPolicyPpi->Rcba + R_PCH_RCRB_LSTS)) & 0x0F) != DMI_GEN2))
+ ) {
+ DEBUG ((EFI_D_INFO, "DMI Link re-train to set GEN2\n"));
+ DmiLinkTrain (DmiBar);
+ }
+ ///
+ /// Get the current link status
+ ///
+ LinkStatus = MmioRead16 ((UINTN) (DmiBar + R_SA_DMIBAR_LSTS_OFFSET));
+ DEBUG ((EFI_D_INFO, "DMI trained to x%d at Gen%d\n", (LinkStatus >> 4) & 0x3F, LinkStatus & 0x0F));
+
+ return EFI_SUCCESS;
+}
+
+/**
+ DMI link training
+
+ @param[in] DmiBar - DMIBAR address
+**/
+VOID
+DmiLinkTrain (
+ IN UINT64 DmiBar
+ )
+{
+ ///
+ /// Retrain link
+ ///
+ MmioOr8 ((UINTN) (DmiBar + R_SA_DMIBAR_LCTL_OFFSET), BIT5);
+
+ ///
+ /// Wait for link training complete
+ ///
+ while ((MmioRead16 ((UINTN) (DmiBar + R_SA_DMIBAR_LSTS_OFFSET)) & BIT11) != 0)
+ ;
+}
+
+/**
+ Additional DMI Programming Steps at PEI
+
+ @param[in] SaPlatformPolicyPpi - pointer to SA_PLATFORM_POLICY_PPI
+ @param[in] MchBar - MCHBAR address
+ @param[in] DmiBar - DMIBAR address
+**/
+VOID
+AdditionalDmiProgramSteps (
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi,
+ IN UINT32 MchBar,
+ IN UINT32 DmiBar
+ )
+{
+ UINT32 Data32And;
+ UINT32 Data32Or;
+
+ ///
+ /// Disable DMI and PEG Debug Align Message - set 0x258[29] = '1b'
+ ///
+ Data32And = (UINT32) ~BIT29;
+ Data32Or = BIT29;
+ Mmio32AndThenOr (DmiBar, R_SA_DMIBAR_CFG4_OFFSET, Data32And, Data32Or);
+
+ ///
+ /// Overwrite DMICC (DMIBAR offset 0x208) to 0x6B5
+ ///
+ Data32And = (UINT32)~(BIT10 | BIT9 | BIT8 | BIT7 | BIT6 | BIT5 | BIT4 | BIT3 | BIT2 | BIT1 | BIT0);
+ Data32Or = 0x6B5;
+ Mmio32AndThenOr (DmiBar, R_SA_DMIBAR_DMICC_OFFSET, Data32And, Data32Or);
+
+ ///
+ /// Set L0SLAT[15:0] to 0x2020
+ ///
+ Data32And = (UINT32) ~(0xFFFF);
+ Data32Or = 0x00002020;
+ Mmio32AndThenOr (DmiBar, R_SA_DMIBAR_L0SLAT_OFFSET, Data32And, Data32Or);
+}
+#endif // DMI_FLAG
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaDmiPeim.h b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaDmiPeim.h
new file mode 100644
index 0000000..799eb13
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaDmiPeim.h
@@ -0,0 +1,94 @@
+/** @file
+ Header file for the SA Dmi Init library.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _SA_DMI_PEIM_H_
+#define _SA_DMI_PEIM_H_
+
+#include "EdkIIGluePeim.h"
+#include "SaAccess.h"
+#include "CpuRegs.h"
+#include "CpuPlatformLib.h"
+
+///
+/// Driver Consumed PPI Prototypes
+///
+#include EFI_PPI_DEPENDENCY (SaPlatformPolicy)
+#include EFI_PPI_DEPENDENCY (PchPlatformPolicy)
+#include EFI_PPI_DEPENDENCY (PchInit)
+#include EFI_PPI_DEPENDENCY (PchDmiTcVcMap)
+
+/**
+ Map SA DMI TCs to VC
+
+ @param[in] PchDmiTcVcMapPpi - Instance of PCH_DMI_TC_VC_PPI
+ @param[in] DmiBar - DMIBAR address
+
+ @retval EFI_SUCCESS
+**/
+EFI_STATUS
+SaSetDmiTcVcMapping (
+ IN PCH_DMI_TC_VC_PPI *PchDmiTcVcMapPpi,
+ IN UINT64 DmiBar
+ )
+;
+
+/**
+ Poll SA DMI negotiation completion
+
+ @param[in] PchDmiTcVcMapPpi - Instance of PCH_DMI_TC_VC_PPI
+ @param[in] DmiBar - DMIBAR address
+
+ @retval EFI_SUCCESS
+**/
+EFI_STATUS
+SaPollDmiVcStatus (
+ IN PCH_DMI_TC_VC_PPI *PchDmiTcVcMapPpi,
+ IN UINT64 DmiBar
+ )
+;
+
+#ifdef DMI_FLAG
+/**
+ DMI link training
+
+ @param[in] DmiBar - DMIBAR address
+**/
+VOID
+DmiLinkTrain (
+ IN UINT64 DmiBar
+ )
+;
+
+/**
+ Additional DMI Programming Steps at PEI
+
+ @param[in] SaPlatformPolicyPpi - pointer to SA_PLATFORM_POLICY_PPI
+ @param[in] MchBar - MCHBAR address
+ @param[in] DmiBar - DMIBAR address
+**/
+VOID
+AdditionalDmiProgramSteps (
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi,
+ IN UINT32 MchBar,
+ IN UINT32 DmiBar
+ )
+;
+#endif // DMI_FLAG
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaInitPeim.c b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaInitPeim.c
new file mode 100644
index 0000000..28fc22e
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaInitPeim.c
@@ -0,0 +1,689 @@
+/** @file
+ The PEIM implements the SA PEI Initialization.
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "SaInitPeim.h"
+#ifdef RAPID_START_FLAG
+#include EFI_PPI_CONSUMER (RapidStart)
+#endif
+
+static EFI_PEI_PPI_DESCRIPTOR mSaPeiInitPpi[] = {
+ (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+ &gSaPeiInitPpiGuid,
+ NULL
+};
+
+STATIC EFI_PEI_NOTIFY_DESCRIPTOR mSaResetCompleteNotifyDesc = {
+ (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+ &gMemoryInitHobGuid,
+ SaResetComplete
+};
+
+EFI_GUID gEfiPeiEndOfPeiPhasePpiGuid = EFI_PEI_END_OF_PEI_PHASE_PPI_GUID;
+STATIC EFI_PEI_NOTIFY_DESCRIPTOR mSaS3ResumeNotifyDesc = {
+ (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+ &gEfiPeiEndOfPeiPhasePpiGuid,
+ SaS3ResumeAtEndOfPei
+};
+
+#ifdef RAPID_START_FLAG
+STATIC EFI_PEI_NOTIFY_DESCRIPTOR mSaOnRapidStartPpiNotifyDesc = {
+ (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+ &gRapidStartPpiGuid,
+ SaCheckRapidStartMode
+};
+#endif
+
+///
+/// Functions
+///
+static
+EFI_STATUS
+SaS3ResumeAtEndOfPei (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
+ IN VOID *Ppi
+ )
+/**
+ This function handles SA S3 resume task
+
+ @param[in] PeiServices - Pointer to PEI Services Table.
+ @param[in] NotifyDesc - Pointer to the descriptor for the Notification event that
+ caused this function to execute.
+ @param[in] Ppi - Pointer to the PPI data associated with this function.
+
+ @retval EFI_STATUS - Always return EFI_SUCCESS
+**/
+{
+ SA_DATA_HOB *SaDataHob;
+ CPU_STEPPING CpuSteppingId;
+ CPU_FAMILY CpuFamilyId;
+
+ CpuSteppingId = GetCpuStepping();
+ CpuFamilyId = GetCpuFamily();
+ ///
+ /// Get SaPegDataHob HOB
+ ///
+ SaDataHob = NULL;
+ SaDataHob = (SA_DATA_HOB *)GetFirstGuidHob (&gSaDataHobGuid);
+ if (SaDataHob != NULL) {
+ ///
+ /// If there was no DXE mode supported, always enable SMM mode
+ ///
+#if SA_PCIE_ASPM_IN_DXE == 0
+ SaDataHob->InitPcieAspmAfterOprom = 1;
+#endif
+ ///
+ /// If there was no SMM mode supported, always enable DXE mode
+ ///
+#if SA_PCIE_ASPM_IN_SMM == 0
+ SaDataHob->InitPcieAspmAfterOprom = 0;
+#endif
+
+ if ((SaDataHob->SaIotrapSmiAddress != 0) && (SaDataHob->InitPcieAspmAfterOprom == 1)) {
+#if SA_PCIE_ASPM_IN_SMM == 1
+ ///
+ /// Always generate SA IO TRAP SMI when supported
+ /// The SMI handler will directly return if not PCIe ASPM init after Oprom was enabled
+ ///
+ DEBUG ((EFI_D_INFO, "Generate SA IOTRAP SMI port=%X\n", SaDataHob->SaIotrapSmiAddress));
+ IoWrite8 (SaDataHob->SaIotrapSmiAddress, 0);
+#endif
+ }
+ }
+#if SA_PCIE_ASPM_IN_DXE == 1
+ if ((SaDataHob == NULL) || (SaDataHob->InitPcieAspmAfterOprom == 0)) {
+ ///
+ /// When SaDataHob not preset/corrupted or InitPcieAspmAfterOprom set to 0,
+ /// try to do DXE mode S3 resume task.
+ ///
+ ///
+ /// Lock processor/chipset BAR registers
+ /// Other save/restore were done by S3 Save script table
+ ///
+ if (!(((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId <= EnumHswB0) ) ||
+ ((CpuFamilyId == EnumCpuHswUlt) && (CpuSteppingId <= EnumHswUltB0)) ||
+ ((CpuFamilyId == EnumCpuCrw) && (CpuSteppingId <= EnumCrwB0) ) )) {
+ AsmMsrOr64 (0x2e7, 1);
+ }
+ }
+#endif
+ return EFI_SUCCESS;
+}
+
+#ifdef RAPID_START_FLAG
+static
+EFI_STATUS
+SaCheckRapidStartMode (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
+ IN VOID *Ppi
+ )
+/**
+ This function will check Rapid Start mode and install SaS3Resume callback notify if it was Rapid Start Resume
+
+ @param[in] PeiServices - Pointer to PEI Services Table.
+ @param[in] NotifyDesc - Pointer to the descriptor for the Notification event that
+ caused this function to execute.
+ @param[in] Ppi - Pointer to the PPI data associated with this function.
+
+ @retval EFI_STATUS - Always return EFI_SUCCESS
+**/
+{
+ RAPID_START_PPI *RapidStartPpi;
+ EFI_STATUS Status;
+
+ ///
+ /// When Rapid Start implemented and in the Rapid Start Resume transition, this SA S3 resume Notify should happen early than Rapid Start End-Of-Pei callback
+ /// This is because Rapid Start End-Of-Pei callback will generate ACPI_ENABLE SMI which should be after SA S3 resume completed.
+ ///
+ Status = PeiServicesLocatePpi (&gRapidStartPpiGuid, 0, NULL, &RapidStartPpi);
+ ASSERT_EFI_ERROR (Status);
+ if (RapidStartPpi->GetMode (RapidStartPpi) == RapidStartExit) {
+ DEBUG ((EFI_D_INFO, "[SA] Install Notify callback for Rapid Start Resume\n"));
+ Status = PeiServicesNotifyPpi (&mSaS3ResumeNotifyDesc);
+ ASSERT_EFI_ERROR (Status);
+ }
+ return EFI_SUCCESS;
+}
+#endif
+
+EFI_STATUS
+EFIAPI
+SaInitPeiEntryPoint (
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+/**
+ SA PEI Initialization.
+
+ @param[in] FfsHeader - Pointer to Firmware File System file header.
+ @param[in] PeiServices - General purpose services available to every PEIM.
+
+ @retval EFI_SUCCESS
+**/
+{
+ EFI_STATUS Status;
+ SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi;
+ EFI_BOOT_MODE BootMode;
+#ifdef RAPID_START_FLAG
+ RAPID_START_PPI *RapidStartPpi;
+#endif
+#if defined(DMI_FLAG) || defined(PEG_FLAG)
+ CPU_FAMILY CpuFamilyId;
+
+ CpuFamilyId = GetCpuFamily();
+#endif // DMI_FLAG || PEG_FLAG
+
+ ///
+ /// Get platform policy settings through the SaPlatformPolicy PPI
+ ///
+ Status = (**PeiServices).LocatePpi (
+ PeiServices,
+ &gSaPlatformPolicyPpiGuid,
+ 0,
+ NULL,
+ (VOID **) &SaPlatformPolicyPpi
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Dump SA Platform Policy
+ ///
+ SaPeiPolicyDump (SaPlatformPolicyPpi);
+
+ ///
+ /// Program SA Bar Registers
+ ///
+ DEBUG ((EFI_D_INFO, "Programming SA Bars\n"));
+ ProgramSaBars (SaPlatformPolicyPpi);
+
+ ///
+ /// Install SA HOBs
+ ///
+ InstallSaHob (PeiServices, SaPlatformPolicyPpi);
+
+ ///
+ /// Report SA PCIe code version
+ ///
+ DEBUG ((EFI_D_INFO, "Reporting SA PCIe code version\n"));
+ ReportPcieVersion (SaPlatformPolicyPpi);
+
+#ifdef DMI_FLAG
+ if ((CpuFamilyId == EnumCpuHsw) || (CpuFamilyId == EnumCpuCrw)) {
+ ///
+ /// Initialize DMI
+ ///
+ DEBUG ((EFI_D_INFO, "Initializing DMI\n"));
+ DmiInit (PeiServices, SaPlatformPolicyPpi);
+ }
+#endif // DMI_FLAG
+
+#ifdef SG_SUPPORT
+ ///
+ /// Initialize SwitchableGraphics
+ ///
+ DEBUG ((EFI_D_INFO, "Initializing SwitchableGraphics\n"));
+ SwitchableGraphicsInit (PeiServices, SaPlatformPolicyPpi);
+#endif
+
+#ifdef PEG_FLAG
+ if ((CpuFamilyId == EnumCpuHsw) || (CpuFamilyId == EnumCpuCrw)) {
+ ///
+ /// Initialize SA PCIe
+ ///
+ DEBUG ((EFI_D_INFO, "Initializing SA PCIe\n"));
+ PciExpressInit (PeiServices, SaPlatformPolicyPpi);
+ }
+#endif // PEG_FLAG
+
+ ///
+ /// Initialize Graphics (IGD/External)
+ ///
+ DEBUG ((EFI_D_INFO, "Initializing Graphics\n"));
+ GraphicsInit (PeiServices, SaPlatformPolicyPpi);
+
+ ///
+ /// Initialize Overclocking
+ ///
+ DEBUG ((EFI_D_INFO, "Initializing System Agent Overclocking\n"));
+ SaOcInit(PeiServices, SaPlatformPolicyPpi);
+
+ ///
+ /// Initialize DMI Tc/Vc mapping setting
+ ///
+ DEBUG ((EFI_D_INFO, "Initializing DMI Tc/Vc mapping\n"));
+ SaDmiTcVcInit (PeiServices, SaPlatformPolicyPpi);
+
+ ///
+ /// Early BIOS POST Programming
+ ///
+ DEBUG ((EFI_D_INFO, "Early BIOS POST Programming\n"));
+ EarlyBiosPostProgramming(SaPlatformPolicyPpi);
+
+ ///
+ /// Install Notify
+ ///
+ Status = PeiServicesNotifyPpi (&mSaResetCompleteNotifyDesc);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Install SA S3 resume Notify only when booting from S3 resume
+ ///
+ Status = PeiServicesGetBootMode (&BootMode);
+ DEBUG ((EFI_D_INFO, "[SA] BootMode = %X\n", BootMode));
+ if ((Status == EFI_SUCCESS) && (BootMode == BOOT_ON_S3_RESUME)) {
+ DEBUG ((EFI_D_INFO, "[SA] Install SA S3 Notify callback\n"));
+ Status = PeiServicesNotifyPpi (&mSaS3ResumeNotifyDesc);
+ ASSERT_EFI_ERROR (Status);
+ }
+#ifdef RAPID_START_FLAG
+ else {
+ ///
+ /// When Rapid Start implemented and in the Rapid Start Resume transition, this SA S3 resume Notify should happen early than Rapid Start End-Of-Pei callback
+ /// This is because Rapid Start End-Of-Pei callback will generate ACPI_ENABLE SMI which should be after SA S3 resume completed.
+ ///
+ Status = PeiServicesLocatePpi (&gRapidStartPpiGuid, 0, NULL, &RapidStartPpi);
+ if (Status == EFI_SUCCESS) {
+ DEBUG ((EFI_D_INFO, "[SA] Check Rapid Start transition mode\n"));
+ if (RapidStartPpi->GetMode (RapidStartPpi) == RapidStartExit) {
+ DEBUG ((EFI_D_INFO, "[SA] Install Notify callback for Rapid Start Resume\n"));
+ Status = PeiServicesNotifyPpi (&mSaS3ResumeNotifyDesc);
+ ASSERT_EFI_ERROR (Status);
+ }
+ } else {
+ DEBUG ((EFI_D_INFO, "[SA] Postpone Rapid Start mode checking after RapidStartPpi installed\n"));
+ Status = PeiServicesNotifyPpi (&mSaOnRapidStartPpiNotifyDesc);
+ }
+ }
+#endif
+
+ ///
+ /// Install Ppi with SaInitPeim complete
+ ///
+ Status = (**PeiServices).InstallPpi (PeiServices, mSaPeiInitPpi);
+ ASSERT_EFI_ERROR (Status);
+
+ return EFI_SUCCESS;
+}
+
+STATIC
+EFI_STATUS
+SaResetComplete (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
+ IN VOID *Ppi
+ )
+/**
+ BIOS_RESET_CPL bit is set for processor to activate the power and thermal management
+ features on the platform.
+
+ @param[in] PeiServices - Pointer to PEI Services Table.
+ @param[in] NotifyDesc - Pointer to the descriptor for the Notification event that
+ caused this function to execute.
+ @param[in] Ppi - Pointer to the PPI data associated with this function.
+
+ @retval EFI_SUCCESS
+**/
+{
+ EFI_STATUS Status;
+ UINT64 MchBar;
+ UINT32 Data32And;
+ UINT32 Data32Or;
+ SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi;
+
+ MchBar = McD0PciCfg64 (R_SA_MCHBAR) &~BIT0;
+
+ ///
+ /// Get platform policy settings through the SaPlatformPolicy PPI
+ ///
+ Status = PeiServicesLocatePpi (&gSaPlatformPolicyPpiGuid, 0, NULL, (VOID **) &SaPlatformPolicyPpi);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Set MCHBAR Offset 5F00h [10:9] = 11b
+ ///
+ Data32And = (UINT32)~(BIT10 | BIT9);
+ Data32Or = 0x3 << 9;
+ Mmio32AndThenOr (MchBar, R_SA_MCHBAR_SAPMCTL_OFFSET, Data32And, Data32Or);
+
+ ///
+ /// Set BIOS_RESET_CPL
+ ///
+ DEBUG ((EFI_D_INFO, "Set BIOS_RESET_CPL to indicate all configurations complete\n"));
+ Mmio8Or ((UINTN) MchBar, R_SA_MCHBAR_BIOS_RESET_CPL_OFFSET, BIT0 | BIT1);
+
+ return EFI_SUCCESS;
+}
+
+VOID
+ProgramSaBars (
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi
+ )
+/**
+ Programs SA Bars
+
+ @param[in] SaPlatformPolicyPpi - Instance of SA_PLATFORM_POLICY_PPI
+**/
+{
+ CPU_FAMILY CpuFamilyId;
+
+ CpuFamilyId = GetCpuFamily();
+
+ ///
+ /// Program SA MchBar, DmiBar and EpBar
+ ///
+ McD0PciCfg64 (R_SA_MCHBAR) = (UINT64) (SaPlatformPolicyPpi->PlatformData->MchBar | BIT0);
+ McD0PciCfg64 (R_SA_DMIBAR) = (UINT64) (SaPlatformPolicyPpi->PlatformData->DmiBar | BIT0);
+ McD0PciCfg64 (R_SA_PXPEPBAR) = (UINT64) (SaPlatformPolicyPpi->PlatformData->EpBar | BIT0);
+
+ ///
+ /// Program SA GdxcBar
+ ///
+ Mmio64 ((UINTN) (SaPlatformPolicyPpi->PlatformData->MchBar), R_SA_MCHBAR_GDXCBAR_OFFSET) = (UINT64)
+ (SaPlatformPolicyPpi->PlatformData->GdxcBar | BIT0);
+
+ if (CpuFamilyId == EnumCpuCrw) {
+ ///
+ /// Program SA EdramBar
+ ///
+ Mmio64 ((UINTN) (SaPlatformPolicyPpi->PlatformData->MchBar), R_SA_MCHBAR_EDRAMBAR_OFFSET) = (UINT64)
+ (SaPlatformPolicyPpi->PlatformData->EdramBar | BIT0);
+ }
+}
+
+VOID
+EarlyBiosPostProgramming (
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi
+ )
+/**
+ Do Early BIOS POST Programming
+
+ @param[in] SaPlatformPolicyPpi - Instance of SA_PLATFORM_POLICY_PPI
+**/
+{
+ /// SA BS 11.1 Early BIOS POST Programming
+ /// 1. Enable System Agent Clock Gating by setting the MCHBAR offset 5F00h [0] = '1b'.
+ MmioOr32 ((UINTN) (SaPlatformPolicyPpi->PlatformData->MchBar + 0x5F00), BIT0);
+}
+
+EFI_STATUS
+InstallSaHob (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi
+ )
+/**
+ Init and Install SA Hob
+
+ @param[in] PeiServices - General purpose services available to every PEIM.
+ @param[in] SaPlatformPolicyPpi - SaPlatformPolicyPpi to access the GtConfig related information
+
+ @retval EFI_SUCCESS
+**/
+{
+ EFI_STATUS Status;
+ SA_DATA_HOB *SaDataHob;
+ PEI_CPU_PLATFORM_POLICY_PPI *CpuPlatformPolicy;
+
+ ///
+ /// Create HOB for SA Data
+ ///
+ Status = (**PeiServices).CreateHob (
+ PeiServices,
+ EFI_HOB_TYPE_GUID_EXTENSION,
+ sizeof (SA_DATA_HOB),
+ (VOID **) &SaDataHob
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Initialize default HOB data
+ ///
+ SaDataHob->EfiHobGuidType.Name = gSaDataHobGuid;
+ ZeroMem (&(SaDataHob->DprDirectory[EnumDprDirectoryTxt]), sizeof (DPR_DIRECTORY_ENTRY));
+ ZeroMem (&(SaDataHob->DprDirectory[EnumDprDirectoryPfat]), sizeof (DPR_DIRECTORY_ENTRY));
+ ZeroMem (&(SaDataHob->PegData), sizeof (SA_PEG_DATA));
+ SaDataHob->PegDataValid = FALSE;
+ SaDataHob->PegPlatformResetRequired = FALSE;
+ if (SaPlatformPolicyPpi->Revision >= SA_PLATFORM_POLICY_PPI_REVISION_2) {
+ SaDataHob->SaIotrapSmiAddress = SaPlatformPolicyPpi->PcieConfig->SaIotrapSmiAddress;
+ SaDataHob->InitPcieAspmAfterOprom = SaPlatformPolicyPpi->PcieConfig->InitPcieAspmAfterOprom;
+ } else {
+ SaDataHob->SaIotrapSmiAddress = 0;
+ SaDataHob->InitPcieAspmAfterOprom = 0;
+ }
+
+ ///
+ /// Get platform policy settings through the SaPlatformPolicy PPI
+ ///
+ Status = (**PeiServices).LocatePpi (
+ PeiServices,
+ &gPeiCpuPlatformPolicyPpiGuid,
+ 0,
+ NULL,
+ (VOID **) &CpuPlatformPolicy
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// TXT DPR Directory Entry
+ ///
+#if defined(TXT_SUPPORT_FLAG) && (TXT_SUPPORT_FLAG == 1)
+ SaDataHob->DprDirectory[EnumDprDirectoryTxt].Type = DPR_DIRECTORY_TYPE_TXT;
+ if (CpuPlatformPolicy->CpuConfig->Txt) {
+ SaDataHob->DprDirectory[EnumDprDirectoryTxt].Size = (UINT8) RShiftU64 (CpuPlatformPolicy->SecurityConfig->TxtConfig->TxtDprMemorySize, 20);
+ }
+#endif
+
+ ///
+ /// PFAT Directory Entry
+ ///
+ SaDataHob->DprDirectory[EnumDprDirectoryPfat].Type = DPR_DIRECTORY_TYPE_PFAT;
+ if (CpuPlatformPolicy->CpuConfig->Pfat) {
+ SaDataHob->DprDirectory[EnumDprDirectoryPfat].Size = CpuPlatformPolicy->SecurityConfig->PfatConfig->PfatMemSize;
+ }
+
+ DEBUG ((EFI_D_INFO, "SA Data HOB installed\n"));
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+ReportPcieVersion (
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi
+ )
+/**
+ Report the SA PCIe initialization code version.
+
+ @param[in] SaPlatformPolicyPpi - Instance of SA_PLATFORM_POLICY_PPI
+
+ @retval EFI_SUCCESS
+**/
+{
+ UINT32 Version;
+ CPU_FAMILY CpuFamilyId;
+ CPU_STEPPING CpuSteppingId;
+ const CodeVersion SaPcieCodeVersion = {
+#include "SaPcieVersion.h"
+ };
+
+ DEBUG ((EFI_D_INFO, "***************** System Agent PCIe code version *****************\n"));
+ DEBUG ((EFI_D_INFO, "** Major version number is: %3d **\n", SaPcieCodeVersion.Major));
+ DEBUG ((EFI_D_INFO, "** Minor version number is: %3d **\n", SaPcieCodeVersion.Minor));
+ DEBUG ((EFI_D_INFO, "** Rev version number is: %3d **\n", SaPcieCodeVersion.Rev));
+ DEBUG ((EFI_D_INFO, "** Build number is: %3d **\n", SaPcieCodeVersion.Build));
+ DEBUG ((EFI_D_INFO, "******************************************************************\n"));
+
+ Version = (((UINT32) SaPcieCodeVersion.Major) << 24) | (((UINT32) SaPcieCodeVersion.Minor) << 16) | (((UINT32) SaPcieCodeVersion.Rev) << 8) | (((UINT32) SaPcieCodeVersion.Build));
+
+ CpuFamilyId = GetCpuFamily();
+ CpuSteppingId = GetCpuStepping();
+
+ ///
+ /// Store SA Reference Code version and SA PCIe code version in scrachpad registers
+ ///
+ if ((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId == EnumHswA0)) {
+ Mmio32 ((UINTN) (SaPlatformPolicyPpi->PlatformData->MchBar), R_SA_MCHBAR_PCIE_CODE_VERSION_OFFSET_HSW) = Version;
+ } else {
+ Mmio32 ((UINTN) (SaPlatformPolicyPpi->PlatformData->DmiBar), R_SA_DMIBAR_SCRATCHPAD0_OFFSET) = SaPlatformPolicyPpi->Revision;
+ Mmio32 ((UINTN) (SaPlatformPolicyPpi->PlatformData->DmiBar), R_SA_DMIBAR_SCRATCHPAD1_OFFSET) = Version;
+ }
+ return EFI_SUCCESS;
+}
+
+VOID
+SaPeiPolicyDump (
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi
+ )
+/**
+ This function prints the PEI phase platform policy.
+
+ @param[in] SaPlatformPolicyPpi - Instance of SA_PLATFORM_POLICY_PPI
+**/
+{
+#ifdef EFI_DEBUG
+ INTN i;
+
+ DEBUG ((EFI_D_INFO, "\n------------------------ SA Platform Policy (PEI) dump BEGIN -----------------\n"));
+ DEBUG ((EFI_D_INFO, "Revision : %x\n", SaPlatformPolicyPpi->Revision));
+
+ DEBUG ((EFI_D_INFO, "------------------------ SA_PLATFORM_DATA -----------------\n"));
+
+ DEBUG ((EFI_D_INFO, " SpdAddressTable[%d] :", SA_MC_MAX_SOCKETS));
+ for (i = 0; i < SA_MC_MAX_SOCKETS; i++) {
+ DEBUG ((EFI_D_INFO, " %x", SaPlatformPolicyPpi->PlatformData->SpdAddressTable[i]));
+ }
+ DEBUG ((EFI_D_INFO, "\n"));
+
+ DEBUG ((EFI_D_INFO, " MchBar : %x\n", SaPlatformPolicyPpi->PlatformData->MchBar));
+ DEBUG ((EFI_D_INFO, " DmiBar : %x\n", SaPlatformPolicyPpi->PlatformData->DmiBar));
+ DEBUG ((EFI_D_INFO, " EpBar : %x\n", SaPlatformPolicyPpi->PlatformData->EpBar));
+ DEBUG ((EFI_D_INFO, " PciExpressBar : %x\n", SaPlatformPolicyPpi->PlatformData->PciExpressBar));
+ DEBUG ((EFI_D_INFO, " SmbusBar : %x\n", SaPlatformPolicyPpi->PlatformData->SmbusBar));
+ DEBUG ((EFI_D_INFO, " GdxcBar : %x\n", SaPlatformPolicyPpi->PlatformData->GdxcBar));
+ DEBUG ((EFI_D_INFO, " TsegSize : %x\n", SaPlatformPolicyPpi->PlatformData->TsegSize));
+ DEBUG ((EFI_D_INFO, " UserBd : %x\n", SaPlatformPolicyPpi->PlatformData->UserBd));
+ DEBUG ((EFI_D_INFO, " FastBoot : %x\n", SaPlatformPolicyPpi->PlatformData->FastBoot));
+ DEBUG ((EFI_D_INFO, " EdramBar : %x\n", SaPlatformPolicyPpi->PlatformData->EdramBar));
+
+ DEBUG ((EFI_D_INFO, "------------------------ GT_CONFIGURATION -----------------\n"));
+ DEBUG ((EFI_D_INFO, " MmioSize : %x MB\n", SaPlatformPolicyPpi->GtConfig->MmioSize));
+ DEBUG ((EFI_D_INFO, " GttSize : %x MB\n", SaPlatformPolicyPpi->GtConfig->GttSize));
+ DEBUG ((EFI_D_INFO, " IgdDvmt50PreAlloc : %x\n", SaPlatformPolicyPpi->GtConfig->IgdDvmt50PreAlloc));
+ DEBUG ((EFI_D_INFO, " InternalGraphics : %x\n", SaPlatformPolicyPpi->GtConfig->InternalGraphics));
+ DEBUG ((EFI_D_INFO, " PrimaryDisplay : %x\n", SaPlatformPolicyPpi->GtConfig->PrimaryDisplay));
+ DEBUG ((EFI_D_INFO, " ApertureSize : %x\n", SaPlatformPolicyPpi->GtConfig->ApertureSize));
+ DEBUG ((EFI_D_INFO, " GttMmAdr : %x\n", SaPlatformPolicyPpi->GtConfig->GttMmAdr));
+
+ DEBUG ((EFI_D_INFO, "------------------------ PCIE_CONFIGURATION -----------------\n"));
+ DEBUG ((EFI_D_INFO, " DmiVc1 : %x\n", SaPlatformPolicyPpi->PcieConfig->DmiVc1));
+ DEBUG ((EFI_D_INFO, " DmiVcp : %x\n", SaPlatformPolicyPpi->PcieConfig->DmiVcp));
+ DEBUG ((EFI_D_INFO, " DmiVcm : %x\n", SaPlatformPolicyPpi->PcieConfig->DmiVcm));
+ DEBUG ((EFI_D_INFO, " DmiGen2 : %x\n", SaPlatformPolicyPpi->PcieConfig->DmiGen2));
+ DEBUG ((EFI_D_INFO, " AlwaysEnablePeg : %x\n", SaPlatformPolicyPpi->PcieConfig->AlwaysEnablePeg));
+
+ DEBUG ((EFI_D_INFO, " PegGenx[%d] :", SA_PEG_MAX_FUN));
+ for (i = 0; i < SA_PEG_MAX_FUN; i++) {
+ DEBUG ((EFI_D_INFO, " %x", SaPlatformPolicyPpi->PcieConfig->PegGenx[i]));
+ }
+ DEBUG ((EFI_D_INFO, "\n"));
+
+ DEBUG ((EFI_D_INFO, " PegGen3Equalization : %x\n", SaPlatformPolicyPpi->PcieConfig->PegGen3Equalization));
+
+ DEBUG ((EFI_D_INFO, " Gen3RootPortPreset[%d] :", SA_PEG_MAX_LANE));
+ for (i = 0; i < SA_PEG_MAX_LANE; i++) {
+ DEBUG ((EFI_D_INFO, " %x", SaPlatformPolicyPpi->PcieConfig->Gen3RootPortPreset[i]));
+ }
+ DEBUG ((EFI_D_INFO, "\n"));
+
+ DEBUG ((EFI_D_INFO, " Gen3EndPointPreset[%d] :", SA_PEG_MAX_LANE));
+ for (i = 0; i < SA_PEG_MAX_LANE; i++) {
+ DEBUG ((EFI_D_INFO, " %x", SaPlatformPolicyPpi->PcieConfig->Gen3EndPointPreset[i]));
+ }
+ DEBUG ((EFI_D_INFO, "\n"));
+
+ DEBUG ((EFI_D_INFO, " Gen3EndPointHint[%d] :", SA_PEG_MAX_LANE));
+ for (i = 0; i < SA_PEG_MAX_LANE; i++) {
+ DEBUG ((EFI_D_INFO, " %x", SaPlatformPolicyPpi->PcieConfig->Gen3EndPointHint[i]));
+ }
+ DEBUG ((EFI_D_INFO, "\n"));
+
+ DEBUG ((EFI_D_INFO, " PegSamplerCalibrate : %x\n", SaPlatformPolicyPpi->PcieConfig->PegSamplerCalibrate));
+ DEBUG ((EFI_D_INFO, " PegGen3EqualizationPhase2 : %x\n", SaPlatformPolicyPpi->PcieConfig->PegGen3EqualizationPhase2));
+ DEBUG ((EFI_D_INFO, " PegGen3PresetSearch : %x\n", SaPlatformPolicyPpi->PcieConfig->PegGen3PresetSearch));
+ DEBUG ((EFI_D_INFO, " PegGen3PresetSearchDwellTime : %x\n", SaPlatformPolicyPpi->PcieConfig->PegGen3PresetSearchDwellTime));
+ DEBUG ((EFI_D_INFO, " PegGen3PresetSearchMarginSteps : %x\n", SaPlatformPolicyPpi->PcieConfig->PegGen3PresetSearchMarginSteps));
+ DEBUG ((EFI_D_INFO, " PegGen3PresetSearchStartMargin : %x\n", SaPlatformPolicyPpi->PcieConfig->PegGen3PresetSearchStartMargin));
+ DEBUG ((EFI_D_INFO, " PegSwingControl : %x\n", SaPlatformPolicyPpi->PcieConfig->PegSwingControl));
+ if (SaPlatformPolicyPpi->Revision >= SA_PLATFORM_POLICY_PPI_REVISION_2) {
+ DEBUG ((EFI_D_INFO, " PegGen3PresetSearchVoltageMarginSteps : %x\n", SaPlatformPolicyPpi->PcieConfig->PegGen3PresetSearchVoltageMarginSteps));
+ DEBUG ((EFI_D_INFO, " PegGen3PresetSearchVoltageStartMargin : %x\n", SaPlatformPolicyPpi->PcieConfig->PegGen3PresetSearchVoltageStartMargin));
+ DEBUG ((EFI_D_INFO, " PegGen3PresetSearchFavorTiming : %x\n", SaPlatformPolicyPpi->PcieConfig->PegGen3PresetSearchFavorTiming));
+ DEBUG ((EFI_D_INFO, " PegDataPtr : %p\n", SaPlatformPolicyPpi->PcieConfig->PegDataPtr));
+ DEBUG ((EFI_D_INFO, " PegGen3ForcePresetSearch : %x\n", SaPlatformPolicyPpi->PcieConfig->PegGen3ForcePresetSearch));
+ DEBUG ((EFI_D_INFO, " InitPcieAspmAfterOprom : %x\n", SaPlatformPolicyPpi->PcieConfig->InitPcieAspmAfterOprom));
+ DEBUG ((EFI_D_INFO, " SaIotrapSmiAddress : %x\n", SaPlatformPolicyPpi->PcieConfig->SaIotrapSmiAddress));
+ }
+ if (SaPlatformPolicyPpi->Revision >= SA_PLATFORM_POLICY_PPI_REVISION_3) {
+ DEBUG ((EFI_D_INFO, " PegGpioData : %p\n", SaPlatformPolicyPpi->PcieConfig->PegGpioData));
+ if (SaPlatformPolicyPpi->PcieConfig->PegGpioData != NULL) {
+ DEBUG ((EFI_D_INFO, " PegGpioData->GpioSupport : %x\n", SaPlatformPolicyPpi->PcieConfig->PegGpioData->GpioSupport));
+ if (SaPlatformPolicyPpi->PcieConfig->PegGpioData->SaPegReset != NULL) {
+ DEBUG ((EFI_D_INFO, " PegGpioData->SaPegReset->Value : %x\n", SaPlatformPolicyPpi->PcieConfig->PegGpioData->SaPegReset->Value));
+ DEBUG ((EFI_D_INFO, " PegGpioData->SaPegReset->Active : %x\n", SaPlatformPolicyPpi->PcieConfig->PegGpioData->SaPegReset->Active));
+ }
+ }
+ DEBUG ((EFI_D_INFO, " PegGen3PresetSearchErrorTarget : %x\n", SaPlatformPolicyPpi->PcieConfig->PegGen3PresetSearchErrorTarget));
+ DEBUG ((EFI_D_INFO, " RxCEMLoopback : %x\n", SaPlatformPolicyPpi->PcieConfig->RxCEMLoopback));
+ DEBUG ((EFI_D_INFO, " RxCEMLoopbackLane : %x\n", SaPlatformPolicyPpi->PcieConfig->RxCEMLoopbackLane));
+
+ DEBUG ((EFI_D_INFO, " Gen3RxCtleP[%d] :", SA_PEG_MAX_BUNDLE));
+ for (i = 0; i < SA_PEG_MAX_BUNDLE; i++) {
+ DEBUG ((EFI_D_INFO, " %x", SaPlatformPolicyPpi->PcieConfig->Gen3RxCtleP[i]));
+ }
+ DEBUG ((EFI_D_INFO, "\n"));
+ }
+
+ DEBUG ((EFI_D_INFO, "------------------------ OVERCLOCKING_CONFIGURATION -----------------\n"));
+ DEBUG ((EFI_D_INFO, " GtVoltageOffset : %x\n", SaPlatformPolicyPpi->OcConfig->GtVoltageOffset));
+ DEBUG ((EFI_D_INFO, " GtVoltageOverride : %x\n", SaPlatformPolicyPpi->OcConfig->GtVoltageOverride));
+ DEBUG ((EFI_D_INFO, " GtExtraTurboVoltage : %x\n", SaPlatformPolicyPpi->OcConfig->GtExtraTurboVoltage));
+ DEBUG ((EFI_D_INFO, " GtMaxOcTurboRatio : %x\n", SaPlatformPolicyPpi->OcConfig->GtMaxOcTurboRatio));
+ DEBUG ((EFI_D_INFO, " SaVoltageOffset : %x\n", SaPlatformPolicyPpi->OcConfig->SaVoltageOffset));
+ DEBUG ((EFI_D_INFO, " GtVoltageMode : %x\n", SaPlatformPolicyPpi->OcConfig->GtVoltageMode));
+ DEBUG ((EFI_D_INFO, " OcSupport : %x\n", SaPlatformPolicyPpi->OcConfig->OcSupport));
+ DEBUG ((EFI_D_INFO, " IoaVoltageOffset : %x\n", SaPlatformPolicyPpi->OcConfig->IoaVoltageOffset));
+ DEBUG ((EFI_D_INFO, " IodVoltageOffset : %x\n", SaPlatformPolicyPpi->OcConfig->IodVoltageOffset));
+
+ DEBUG ((EFI_D_INFO, "------------------------ Misc -----------------\n"));
+ DEBUG ((EFI_D_INFO, " S3DataPtr : %x\n", SaPlatformPolicyPpi->S3DataPtr));
+
+ if (SaPlatformPolicyPpi->Revision >= SA_PLATFORM_POLICY_PPI_REVISION_3) {
+ DEBUG ((EFI_D_INFO, "------------------------ SG_GPIO_DATA -----------------\n"));
+ DEBUG ((EFI_D_INFO, " SgGpioData : %x\n", SaPlatformPolicyPpi->SgGpioData));
+ if (SaPlatformPolicyPpi->SgGpioData != NULL) {
+ DEBUG ((EFI_D_INFO, " SgGpioData->GpioSupport : %x\n", SaPlatformPolicyPpi->SgGpioData->GpioSupport));
+ }
+ }
+
+ DEBUG ((EFI_D_INFO, "\n------------------------ SA Platform Policy (PEI) dump END -----------------\n"));
+#endif
+ return;
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaInitPeim.cif b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaInitPeim.cif
new file mode 100644
index 0000000..c60de34
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaInitPeim.cif
@@ -0,0 +1,30 @@
+<component>
+ name = "SaInitPeim"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\SystemAgent\SaInit\Pei"
+ RefName = "SaInitPeim"
+[files]
+"SaInitPeim.sdl"
+"SaInitPeim.mak"
+"SaInitPeim.h"
+"SaInitPeim.c"
+"SaInitPeim.dxs"
+"SaInitPeim.inf"
+"GraphicsInit.h"
+"GraphicsInit.c"
+"SaDmiPeim.h"
+"SaDmiPeim.c"
+"PciExpressInit.h"
+"PciExpressInit.c"
+"PcieTraining.c"
+"PcieTraining.h"
+"PcieTrainingEqSettings.c"
+"PcieTrainingErrorCount.c"
+"PcieTrainingLinkRecovery.c"
+"PcieTrainingMargining.c"
+"PcieTrainingPhase3.c"
+"SaOcInit.c"
+"SaOcInit.h"
+"SwitchableGraphicsInit.c"
+"SwitchableGraphicsInit.h"
+<endComponent>
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaInitPeim.dxs b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaInitPeim.dxs
new file mode 100644
index 0000000..4eedf37
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaInitPeim.dxs
@@ -0,0 +1,49 @@
+/** @file
+ Dependency expression source file.
+
+@copyright
+ Copyright (c) 2009 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "PeimDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+#endif
+
+#include EFI_PPI_DEPENDENCY (SaPlatformPolicy)
+#include EFI_PPI_DEPENDENCY (CpuPlatformPolicy)
+#include EFI_PPI_DEPENDENCY (PchInit)
+#include EFI_PPI_DEPENDENCY (Stall)
+#include EFI_PPI_DEPENDENCY (PchMeUma)
+
+DEPENDENCY_START
+ SA_PLATFORM_POLICY_PPI_GUID AND
+ PCH_INIT_PPI_GUID AND
+ PEI_STALL_PPI_GUID AND
+ PEI_CPU_PLATFORM_POLICY_PPI_GUID
+ AND PCH_ME_UMA_PPI_GUID
+DEPENDENCY_END
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaInitPeim.h b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaInitPeim.h
new file mode 100644
index 0000000..2f3263c
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaInitPeim.h
@@ -0,0 +1,260 @@
+/** @file
+ Header file for the SA Init PEIM
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _SA_INIT_PEIM_H_
+#define _SA_INIT_PEIM_H_
+
+///
+/// External include files do NOT need to be explicitly specified in real EDKII
+/// environment
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#include "SaAccess.h"
+#include "MemInfoHob.h"
+#include "CpuRegs.h"
+#include "CpuPlatformLib.h"
+#include "SaOcInit.h"
+
+#include EFI_PPI_DEPENDENCY (SaPlatformPolicy)
+#include EFI_PPI_DEPENDENCY (CpuPlatformPolicy)
+#include EFI_PPI_PRODUCER (SaPeiInit)
+#include EFI_GUID_DEFINITION (SaDataHob)
+#endif
+///
+/// Data definitions & structures
+///
+
+EFI_GUID gMemoryInitHobGuid = EFI_PEI_PERMANENT_MEMORY_INSTALLED_PPI_GUID;
+
+///
+/// Functions
+///
+EFI_STATUS
+EFIAPI
+SaInitPeiEntryPoint (
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+/**
+ SA PEI Initialization.
+
+ @param[in] FfsHeader - Pointer to Firmware File System file header.
+ @param[in] PeiServices - General purpose services available to every PEIM.
+
+ @retval EFI_SUCCESS
+**/
+;
+
+VOID
+ProgramSaBars (
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi
+ )
+/**
+ Programs Sa Bars
+
+ @param[in] SaPlatformPolicyPpi - Instance of SA_PLATFORM_POLICY_PPI
+**/
+;
+
+VOID
+SwitchableGraphicsInit (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi
+ )
+/**
+ SwitchableGraphicsInit: Initialize the Switchable Graphics if enabled
+
+ @param[in] PeiServices - Pointer to the PEI services table
+ @param[in] SaPlatformPolicyPpi - SaPlatformPolicyPpi to access the SgConfig related information
+**/
+;
+
+VOID
+EarlyBiosPostProgramming (
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi
+ )
+/**
+ Do Early BIOS POST Programming
+
+ @param[in] SaPlatformPolicyPpi - Instance of SA_PLATFORM_POLICY_PPI
+**/
+;
+
+VOID
+GraphicsInit (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi
+ )
+/**
+ GraphicsInit: Initialize the IGD if no other external graphics is present
+
+ @param[in] PeiServices - Pointer to the PEI services table
+ @param[in] SaPlatformPolicyPpi - SaPlatformPolicyPpi to access the GtConfig related information
+**/
+;
+
+EFI_STATUS
+SaDmiTcVcInit (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi
+ )
+/**
+ Initialize DMI Tc/Vc mapping through SA-PCH.
+
+ @param[in] PeiServices - General purpose services available to every PEIM.
+ @param[in] SaPlatformPolicyPpi - SaPlatformPolicyPpi to access the GtConfig related information
+
+ @retval EFI_SUCCESS
+**/
+;
+
+#ifdef DMI_FLAG
+EFI_STATUS
+DmiInit (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi
+ )
+/**
+ Initialize DMI.
+
+ @param[in] PeiServices - General purpose services available to every PEIM.
+ @param[in] SaPlatformPolicyPpi - SaPlatformPolicyPpi to access the GtConfig related information
+
+ @retval EFI_SUCCESS
+**/
+;
+#endif // DMI_FLAG
+
+#ifdef PEG_FLAG
+VOID
+PciExpressInit (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi
+ )
+/**
+ GraphicsInit: Initialize the IGD if no other external graphics is present
+
+ @param[in] PeiServices - Pointer to the PEI services table
+ @param[in] SaPlatformPolicyPpi - SaPlatformPolicyPpi to access the GtConfig related information
+**/
+;
+#endif // PEG_FLAG
+
+EFI_STATUS
+InstallSaHob (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi
+ )
+/**
+ Init and Install SA Hob
+
+ @param[in] PeiServices - General purpose services available to every PEIM.
+ @param[in] SaPlatformPolicyPpi - SaPlatformPolicyPpi to access the GtConfig related information
+
+ @retval EFI_SUCCESS
+**/
+;
+
+EFI_STATUS
+ReportPcieVersion (
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi
+ )
+/**
+ Report the SA PCIe initialization code version.
+
+ @param[in] SaPlatformPolicyPpi - Instance of SA_PLATFORM_POLICY_PPI
+
+ @retval EFI_SUCCESS
+**/
+;
+
+STATIC
+EFI_STATUS
+SaResetComplete (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
+ IN VOID *Ppi
+ )
+/**
+ BIOS_CPL_BIT is set for processor to activate the power and thermal management
+ features on the platform.
+
+ @param[in] PeiServices - Pointer to PEI Services Table.
+ @param[in] NotifyDesc - Pointer to the descriptor for the Notification event that
+ caused this function to execute.
+ @param[in] Ppi - Pointer to the PPI data associated with this function.
+
+ @retval EFI_SUCCESS
+**/
+;
+
+VOID
+SaPeiPolicyDump (
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi
+ )
+/**
+ This function prints the PEI phase platform policy.
+
+ @param[in] SaPlatformPolicyPpi - Instance of SA_PLATFORM_POLICY_PPI
+**/
+;
+
+static
+EFI_STATUS
+SaS3ResumeAtEndOfPei (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
+ IN VOID *Ppi
+ )
+/**
+ This function handles SA S3 resume task
+
+ @param[in] PeiServices - Pointer to PEI Services Table.
+ @param[in] NotifyDesc - Pointer to the descriptor for the Notification event that
+ caused this function to execute.
+ @param[in] Ppi - Pointer to the PPI data associated with this function.
+
+ @retval EFI_STATUS - Always return EFI_SUCCESS
+**/
+;
+
+#ifdef RAPID_START_FLAG
+static
+EFI_STATUS
+SaCheckRapidStartMode (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
+ IN VOID *Ppi
+ )
+/**
+ This function will check Rapid Start mode and install SaS3Resume callback notify if it was Rapid Start Resume
+
+ @param[in] PeiServices - Pointer to PEI Services Table.
+ @param[in] NotifyDesc - Pointer to the descriptor for the Notification event that
+ caused this function to execute.
+ @param[in] Ppi - Pointer to the PPI data associated with this function.
+
+ @retval EFI_STATUS - Always return EFI_SUCCESS
+**/
+;
+#endif // RAPID_START_FLAG
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaInitPeim.inf b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaInitPeim.inf
new file mode 100644
index 0000000..8ca75a4
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaInitPeim.inf
@@ -0,0 +1,132 @@
+## @file
+# Component description file for the SA Init PEIM.
+#
+#@copyright
+# Copyright (c) 2010 - 2014 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = SaInitPeim
+FILE_GUID = FD236AE7-0791-48c4-B29E-29BDEEE1A811
+COMPONENT_TYPE = PE32_PEIM
+
+[sources.common]
+ SaInitPeim.h
+ SaInitPeim.c
+ GraphicsInit.h
+ GraphicsInit.c
+ SaDmiPeim.h
+ SaDmiPeim.c
+ PciExpressInit.h
+ PciExpressInit.c
+ SwitchableGraphicsInit.c
+ SwitchableGraphicsInit.h
+ PcieTraining.h
+ PcieTraining.c
+ PcieTrainingEqSettings.c
+ PcieTrainingErrorCount.c
+ PcieTrainingMargining.c
+ PcieTrainingLinkRecovery.c
+ PcieTrainingPhase3.c
+ SaOcInit.h
+ SaOcInit.c
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGluePeimEntryPoint.c
+
+
+[includes.common]
+ .
+ ../Common
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_RAPID_START_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Library
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Library/OverclockingLib
+
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Pei/Include
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include/Library
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include/Pcd
+ $(EDK_SOURCE)/Foundation/Cpu/Pentium/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/$(PROJECT_SA_MRC)/Pei/Source/Api
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/$(PROJECT_SA_MRC)/Pei/Source/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/$(PROJECT_SA_MRC)/Pei/Source/Include/MrcRegisters
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/$(PROJECT_SA_MRC)/Pei
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include/Library
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/PchMeUma
+
+[libraries.common]
+ $(PROJECT_PCH_FAMILY)PpiLib
+ EdkFrameworkPpiLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueBaseMemoryLib
+ EdkIIGluePeiDebugLibReportStatusCode
+ EdkIIGluePeiReportStatusCodeLib
+ EdkIIGluePeiServicesLib
+ EdkIIGluePeiMemoryAllocationLib
+ EdkIIGlueBasePciExpressLib
+ EdkIIGlueBasePostCodeLibPort80
+ PeiLib
+ $(PROJECT_SA_FAMILY)PpiLib
+ SAGuidLib
+ EdkPpiLib
+ CpuPpiLib
+ CpuPlatformLib
+ EdkIIGluePeiHobLib
+ PchPlatformLib
+ OverclockingLib
+ MeLibPpi
+#
+# Uncomment all the RapidStart include directories and library if RapidStart is supported
+#
+# RapidStartPpiLib
+
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = SaInitPeim.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=SaInitPeiEntryPoint
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_PEI_SERVICES_LIB__ \
+ -D __EDKII_GLUE_PEI_MEMORY_ALLOCATION_LIB__ \
+ -D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaInitPeim.mak b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaInitPeim.mak
new file mode 100644
index 0000000..935d761
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaInitPeim.mak
@@ -0,0 +1,72 @@
+#---------------------------------------------------------------------------
+# Create SaInitPeim module
+#---------------------------------------------------------------------------
+all : SaInitPeim
+SaInitPeim : $(BUILD_DIR)\SaInitPeim.mak SaInitPeimBin
+
+$(BUILD_DIR)\SaInitPeim.mak : $(SaInitPeim_DIR)\$(@B).cif $(SaInitPeim_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(SaInitPeim_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+SaInitPeim_INCLUDES=\
+ $(INTEL_MCH_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(PROJECT_CPU_INCLUDES)\
+ $(RAPIDSTART_INCLUDES)\
+ $(PchMeUma_INCLUDES)\
+ /I$(PROJECT_CPU_ROOT)\Library\OverclockingLib \
+
+SaInitPeim_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=SaInitPeiEntryPoint"\
+ /D __EDKII_GLUE_BASE_LIB__ \
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_PEI_SERVICES_LIB__ \
+ /D __EDKII_GLUE_PEI_MEMORY_ALLOCATION_LIB__ \
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+
+SaInitPeim_LIB_LINKS =\
+ $(INTEL_SA_PPI_LIB) \
+ $(IntelPchPpiLib_LIB)\
+ $(EDKFRAMEWORKPPILIB) \
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EdkIIGlueBaseLibIA32_LIB)\
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB) \
+ $(EdkIIGluePeiDebugLibReportStatusCode_LIB) \
+ $(EdkIIGluePeiReportStatusCodeLib_LIB) \
+ $(EdkIIGluePeiServicesLib_LIB) \
+ $(EdkIIGluePeiMemoryAllocationLib_LIB) \
+ $(EdkIIGlueBasePciLibPciExpress_LIB) \
+ $(EdkIIGlueBasePciExpressLib_LIB)\
+ $(PEILIB)\
+ $(SaGuidLib_LIB)\
+ $(EdkIIGlueBasePciExpressLib_LIB)\
+ $(EdkIIGlueBasePostCodeLibPort80_LIB)\
+ $(CPU_PPI_LIB)\
+ $(CpuPlatformLib_LIB)\
+ $(PchPlatformPeiLib_LIB)\
+ $(EdkIIGluePeiHobLib_LIB)\
+ $(OcPlatformLib_LIB)\
+#
+# Uncomment all the RapidStart include directories and library if RapidStart is supported
+#
+# RapidStartPpiLib
+ $(RapidStartPpiLib_LIB)\
+ $(MeLibPpi_LIB)
+
+SaInitPeimBin: $(SaInitPeim_LIB_LINKS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\SaInitPeim.mak all \
+ "MY_INCLUDES=$(SaInitPeim_INCLUDES)"\
+ "MY_DEFINES=$(SaInitPeim_DEFINES)"\
+ NAME=SaInitPeim\
+ MAKEFILE=$(BUILD_DIR)\SaInitPeim.mak \
+ GUID=FD236AE7-0791-48c4-B29E-29BDEEE1A811\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=PEIM \
+ EDKIIModule=PEIM\
+ DEPEX1=$(SaInitPeim_DIR)\SaInitPeim.dxs\
+ DEPEX1_TYPE=EFI_SECTION_PEI_DEPEX\
+ COMPRESS=0
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaInitPeim.sdl b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaInitPeim.sdl
new file mode 100644
index 0000000..38ceadb
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaInitPeim.sdl
@@ -0,0 +1,39 @@
+TOKEN
+ Name = "SaInitPeim_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable SaInitPeim support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+End
+
+TOKEN
+ Name = "SA_DEBUG_INFO"
+ Value = "1"
+ TokenType = Boolean
+ Range = "0-1 "
+ TargetMAK = Yes
+End
+
+ELINK
+ Name = "/D SA_DEBUG_FLAG"
+ Parent = "INTEL_SA_RC_FLAGS"
+ Token = "SA_DEBUG_INFO" "=" "1"
+ InvokeOrder = AfterParent
+End
+
+PATH
+ Name = "SaInitPeim_DIR"
+End
+
+MODULE
+ File = "SaInitPeim.mak"
+ Help = "Includes SaInitPeim.mak to Project"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\SaInitPeim.ffs"
+ Parent = "FV_BB"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaOcInit.c b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaOcInit.c
new file mode 100644
index 0000000..80a1ffb
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaOcInit.c
@@ -0,0 +1,189 @@
+/** @file
+ OC System Agent Early Post initializations.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+///
+/// External include files do NOT need to be explicitly specified in real EDKII
+/// environment
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#include "SaOcInit.h"
+#endif
+
+EFI_STATUS
+SaOcInit (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi
+ )
+/**
+ Initializes Overclocking settings in the processor.
+
+ @param[in] PeiServices - General purpose services available to every PEIM.
+ @param[in] OverclockingtConfig Pointer to Policy protocol instance
+
+ @retval EFI_SUCCESS
+**/
+{
+ EFI_STATUS Status;
+ OC_CAPABILITIES_ITEM OcCaps;
+ VOLTAGE_FREQUENCY_ITEM CurrentVfItem;
+ VOLTAGE_FREQUENCY_ITEM RequestedVfItem;
+ UINT32 LibStatus;
+ UINT8 DomainId;
+ BOOLEAN VfUpdateNeeded;
+ WDT_PPI *gWdtPei;
+
+ LibStatus = 0;
+ VfUpdateNeeded = FALSE;
+
+ if (SaPlatformPolicyPpi->OcConfig->OcSupport == 0){
+ ///
+ /// Overclocking is disabled
+ ///
+ DEBUG ((EFI_D_ERROR, "(OC) Overclocking is disabled. Bypassing SA overclocking flow.\n"));
+ return EFI_SUCCESS;
+ }
+
+ Status = EFI_SUCCESS;
+ ZeroMem(&CurrentVfItem,sizeof(CurrentVfItem));
+ ZeroMem(&RequestedVfItem,sizeof(RequestedVfItem));
+
+ //
+ // Locate WDT_PPI (ICC WDT PPI)
+ //
+ Status = PeiServicesLocatePpi (
+ &gWdtPpiGuid,
+ 0,
+ NULL,
+ (VOID **) &gWdtPei
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// We will loop on the CPU domains to manage the voltage/frequency settings
+ ///
+ for (DomainId = OC_LIB_DOMAIN_ID_GT; DomainId <= OC_LIB_DOMAIN_ID_IOD; DomainId++) {
+ ///
+ /// Only GT, Uncore, IOA, and IOD are valid for System Agent
+ ///
+ if ((DomainId == OC_LIB_DOMAIN_ID_GT) ||(DomainId == OC_LIB_DOMAIN_ID_UNCORE) ||
+ (DomainId == OC_LIB_DOMAIN_ID_IOA) || (DomainId == OC_LIB_DOMAIN_ID_IOD)){
+ ///
+ /// Get OC Capabilities of the domain
+ ///
+ ZeroMem(&OcCaps,sizeof(OcCaps));
+ OcCaps.DomainId = DomainId;
+ Status = GetOcCapabilities(&OcCaps,&LibStatus);
+
+ if (LibStatus == OC_LIB_COMPLETION_CODE_SUCCESS){
+ ///
+ /// If any OC is supported on this domain, then proceed
+ ///
+ if (OcCaps.RatioOcSupported || OcCaps.VoltageOverridesSupported || OcCaps.VoltageOffsetSupported){
+ ///
+ /// Need to populate the user requested settings from the platform policy
+ /// to determine if OC changes are desired.
+ ///
+ ZeroMem(&CurrentVfItem,sizeof(CurrentVfItem));
+ CurrentVfItem.DomainId = DomainId;
+
+ ///
+ /// Get a copy of the current domain VfSettings from the Mailbox Library
+ ///
+ Status = GetVoltageFrequencyItem(&CurrentVfItem,&LibStatus);
+ if ((Status != EFI_SUCCESS) || (LibStatus != OC_LIB_COMPLETION_CODE_SUCCESS)){
+ continue;
+ }
+
+ ///
+ /// Populate the user requested VfSettings struct
+ ///
+ ZeroMem(&RequestedVfItem,sizeof(RequestedVfItem));
+ RequestedVfItem.DomainId = DomainId;
+ if (DomainId == OC_LIB_DOMAIN_ID_GT){
+ RequestedVfItem.VfSettings.MaxOcRatio = (UINT8) SaPlatformPolicyPpi->OcConfig->GtMaxOcTurboRatio;
+
+ ///
+ /// VoltageTarget has 2 uses and we need to update the target based
+ /// on the voltagemode requested
+ ///
+ RequestedVfItem.VfSettings.VoltageTargetMode = SaPlatformPolicyPpi->OcConfig->GtVoltageMode;
+ if (RequestedVfItem.VfSettings.VoltageTargetMode == OC_LIB_OFFSET_ADAPTIVE){
+ RequestedVfItem.VfSettings.VoltageTarget = SaPlatformPolicyPpi->OcConfig->GtExtraTurboVoltage;
+ }
+ else {
+ RequestedVfItem.VfSettings.VoltageTarget = SaPlatformPolicyPpi->OcConfig->GtVoltageOverride;
+ }
+ RequestedVfItem.VfSettings.VoltageOffset = SaPlatformPolicyPpi->OcConfig->GtVoltageOffset;
+
+ VfUpdateNeeded = (BOOLEAN)CompareMem((VOID*)&RequestedVfItem,(VOID*)&CurrentVfItem,sizeof(VOLTAGE_FREQUENCY_ITEM));
+ }
+ else if ((DomainId == OC_LIB_DOMAIN_ID_UNCORE) || (DomainId == OC_LIB_DOMAIN_ID_IOA) || (DomainId == OC_LIB_DOMAIN_ID_IOD)){
+ ///
+ /// Uncore,IOA, and IOD domains only supports voltage offset, other settings are ignored
+ ///
+ switch (DomainId) {
+ case OC_LIB_DOMAIN_ID_UNCORE:
+ RequestedVfItem.VfSettings.VoltageOffset = SaPlatformPolicyPpi->OcConfig->SaVoltageOffset;
+ break;
+
+ case OC_LIB_DOMAIN_ID_IOA:
+ RequestedVfItem.VfSettings.VoltageOffset = SaPlatformPolicyPpi->OcConfig->IoaVoltageOffset;
+ break;
+
+ case OC_LIB_DOMAIN_ID_IOD:
+ RequestedVfItem.VfSettings.VoltageOffset = SaPlatformPolicyPpi->OcConfig->IodVoltageOffset;
+ break;
+ }
+
+ if (RequestedVfItem.VfSettings.VoltageOffset != CurrentVfItem.VfSettings.VoltageOffset)
+ VfUpdateNeeded = TRUE;
+ }
+
+ if (VfUpdateNeeded){
+ VfUpdateNeeded = FALSE;
+
+ ///
+ /// Arm watchdog timer for OC changes
+ ///
+ Status = gWdtPei->ReloadAndStart (WDT_TIMEOUT_BETWEEN_PEI_DXE);
+
+ ///
+ /// Need to update the requested voltage/frequency values
+ ///
+ Status = SetVoltageFrequencyItem(RequestedVfItem,&LibStatus);
+ if ((Status != EFI_SUCCESS) || (LibStatus != OC_LIB_COMPLETION_CODE_SUCCESS)){
+ DEBUG ((EFI_D_ERROR, "(OC) Set Voltage Frequency failed. EFI Status = %X, Library Status = %X\n", Status, LibStatus));
+ }
+ }
+ }
+ else {
+ DEBUG ((EFI_D_INFO, "(OC) No OC support for this Domain = %X\n", DomainId));
+ }
+ }
+ else {
+ DEBUG ((EFI_D_ERROR, "(OC) GetOcCapabilities message failed. Library Status = %X, Domain = %X\n", LibStatus, DomainId));
+ }
+ }
+ }
+
+ return Status;
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaOcInit.h b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaOcInit.h
new file mode 100644
index 0000000..0ebff94
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SaOcInit.h
@@ -0,0 +1,56 @@
+/** @file
+ Describes the functions visible to the rest of the OcInit.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _SA_INIT_H_
+#define _SA_INIT_H_
+
+#include "OverclockingLibrary.h"
+#include EFI_PPI_DEPENDENCY (CpuPlatformPolicy)
+#include EFI_PPI_DEPENDENCY (SaPlatformPolicy)
+#include EFI_PPI_CONSUMER (Wdt)
+
+#ifdef USE_WDT_IN_DEBUG_BIOS
+//
+// MRC takes a lot of time to execute in debug mode
+//
+#define WDT_TIMEOUT_BETWEEN_PEI_DXE 120
+#else
+#define WDT_TIMEOUT_BETWEEN_PEI_DXE 60
+#endif
+
+///
+/// Function Prototypes
+///
+EFI_STATUS
+SaOcInit (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi
+ )
+/**
+ Initializes Overclocking settings in the processor.
+
+ @param[in] PeiServices - General purpose services available to every PEIM.
+ @param[in] OverclockingtConfig Pointer to Policy protocol instance
+
+ @retval EFI_SUCCESS
+**/
+;
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SwitchableGraphicsInit.c b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SwitchableGraphicsInit.c
new file mode 100644
index 0000000..cbb8748
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SwitchableGraphicsInit.c
@@ -0,0 +1,288 @@
+/** @file
+ SwitchableGraphics Pei driver.
+ This Pei driver initialize GPIO programming
+ for the platform.
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+#include "SwitchableGraphicsInit.h"
+#include EFI_GUID_DEFINITION (SaDataHob)
+
+#ifdef SG_SUPPORT
+
+/**
+ Initialize the SwitchableGraphics support (PEI).
+
+ @param[in] PeiServices - Pointer to the PEI services table
+ @param[in] SaPlatformPolicyPpi - SaPlatformPolicyPpi to access the GtConfig related information
+**/
+VOID
+SwitchableGraphicsInit (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi
+ )
+{
+ EFI_STATUS Status;
+ PEI_STALL_PPI *StallPpi;
+ EFI_GUID StallPpiGuid = PEI_STALL_PPI_GUID;
+ UINT16 GpioAddress;
+ SA_DATA_HOB *SaDataHob;
+ BOOLEAN SgDgpuPrsntGpioIsValid = TRUE;
+ CPU_FAMILY CpuFamilyId;
+
+ CpuFamilyId = GetCpuFamily();
+
+ ///
+ /// Get SaDataHob HOB
+ ///
+ SaDataHob = NULL;
+ SaDataHob = (SA_DATA_HOB *) GetFirstGuidHob (&gSaDataHobGuid);
+
+ if (SaDataHob != NULL) {
+ SaDataHob->SgInfo.SgMode = SaPlatformPolicyPpi->PlatformData->SgMode;
+ SaDataHob->SgInfo.PXFixedDynamicMode = SaPlatformPolicyPpi->PlatformData->PXFixedDynamicMode; // AMI_OVERRIDE_FOR ATI 5.0 Fixed/Dynamic
+
+ ///
+ /// GPIO Assigned from policy
+ ///
+ SaDataHob->SgInfo.SgGpioSupport = SaPlatformPolicyPpi->SgGpioData->GpioSupport;
+
+ if (SaPlatformPolicyPpi->SgGpioData->GpioSupport == 1) {
+ ///
+ /// Get GPIO Base Address
+ ///
+ GpioAddress = MmPci16 (0, 0, PCI_DEVICE_NUMBER_PCH_LPC, 0, R_PCH_LPC_GPIO_BASE) &~BIT0;
+
+ SaDataHob->SgInfo.SgDgpuPwrOK = SaPlatformPolicyPpi->SgGpioData->SgDgpuPwrOK->Value;
+ SaDataHob->SgInfo.SgDgpuHoldRst = SaPlatformPolicyPpi->SgGpioData->SgDgpuHoldRst->Value;
+ SaDataHob->SgInfo.SgDgpuPwrEnable = SaPlatformPolicyPpi->SgGpioData->SgDgpuPwrEnable->Value;
+ SaDataHob->SgInfo.SgDgpuPrsnt = SaPlatformPolicyPpi->SgGpioData->SgDgpuPrsnt->Value;
+
+ ///
+ /// Set Bit7 as indicator for GPIO Active Low/High
+ ///
+ SaDataHob->SgInfo.SgDgpuPwrOK |= (SaPlatformPolicyPpi->SgGpioData->SgDgpuPwrOK->Active << 7);
+ SaDataHob->SgInfo.SgDgpuHoldRst |= (SaPlatformPolicyPpi->SgGpioData->SgDgpuHoldRst->Active << 7);
+ SaDataHob->SgInfo.SgDgpuPwrEnable |= (SaPlatformPolicyPpi->SgGpioData->SgDgpuPwrEnable->Active << 7);
+ SaDataHob->SgInfo.SgDgpuPrsnt |= (SaPlatformPolicyPpi->SgGpioData->SgDgpuPrsnt->Active << 7);
+
+ if (CpuFamilyId == EnumCpuHswUlt) {
+ PEI_DEBUG ((PeiServices, EFI_D_INFO, "SgDgpuPrsntGpioIsValid = FALSE\n"));
+ SgDgpuPrsntGpioIsValid = FALSE;
+ }
+
+ ///
+ /// Locate PPI stall service
+ ///
+ Status = (**PeiServices).LocatePpi (
+ PeiServices,
+ &StallPpiGuid,
+ 0,
+ NULL,
+ &StallPpi
+ );
+ if (!EFI_ERROR (Status)) {
+ ///
+ /// if DGPU PRSNT is Disabled, it means that MXM card was not detected, and
+ /// DGPU HOLD RST must be driven high to allow the board to support a normal PEG card
+ ///
+ if ( (SgDgpuPrsntGpioIsValid)
+ && (GpioRead (PeiServices, CpuFamilyId, GpioAddress, SaDataHob->SgInfo.SgDgpuPrsnt) == GP_DISABLE)) {
+ GpioWrite (PeiServices, CpuFamilyId, GpioAddress, SaDataHob->SgInfo.SgDgpuHoldRst, GP_DISABLE);
+ ///
+ /// Set SG mode as disabled
+ ///
+ SaDataHob->SgInfo.SgMode = SgModeDisabled;
+ } else {
+ ///
+ /// DGPU PRSNT Enabled. MXM is present.
+ /// If PEG Mode or SG Muxless
+ /// Power on MXM
+ /// Configure GPIOs to drive MXM in PEG mode or SG Muxless
+ /// else
+ /// Do Nothing
+ ///
+ if ((SaPlatformPolicyPpi->PlatformData->SgMode == SgModeMuxless) ||
+ (SaPlatformPolicyPpi->PlatformData->SgMode == SgModeDgpu)) {
+ PEI_DEBUG ((PeiServices, EFI_D_INFO, "Configure GPIOs for driving the dGPU.\n"));
+ ///
+ /// Drive DGPU HOLD RST Enable to make sure we hold reset
+ ///
+ GpioWrite (PeiServices, CpuFamilyId, GpioAddress, SaDataHob->SgInfo.SgDgpuHoldRst, GP_ENABLE);
+ ///
+ /// wait 100ms
+ ///
+ StallPpi->Stall (
+ PeiServices,
+ StallPpi,
+ SG_DELAY_HOLD_RST
+ );
+
+ ///
+ /// Drive DGPU PWR EN to Power On MXM
+ ///
+ GpioWrite (PeiServices, CpuFamilyId, GpioAddress, SaDataHob->SgInfo.SgDgpuPwrEnable, GP_ENABLE);
+
+ ///
+ /// wait 300ms
+ ///
+ StallPpi->Stall (
+ PeiServices,
+ StallPpi,
+ SG_DELAY_PWR_ENABLE
+ );
+
+ ///
+ /// Drive DGPU HOLD RST Disabled to remove reset
+ ///
+ GpioWrite (PeiServices, CpuFamilyId, GpioAddress, SaDataHob->SgInfo.SgDgpuHoldRst, GP_DISABLE);
+
+ ///
+ /// wait 100ms
+ ///
+ StallPpi->Stall (
+ PeiServices,
+ StallPpi,
+ SG_DELAY_HOLD_RST
+ );
+ }
+ }
+ }
+ }
+ }
+ ///
+ /// Program SubsystemID for IGFX
+ ///
+ PEI_DEBUG ((PeiServices, EFI_D_INFO, "Program SDID [Subsystem ID] for IGFX: 0x%x\n", SaPlatformPolicyPpi->PlatformData->SgSubSystemId));
+ McD2PciCfg16Or (PCI_SID, SaPlatformPolicyPpi->PlatformData->SgSubSystemId);
+
+}
+
+/**
+ SG GPIO Read
+
+ @param[in] PeiServices - General purpose services available to every PEIM
+ @param[in] CpuFamilyId - Specifies the CPU family
+ @param[in] GpioAddress - GPIO base address
+ @param[in] Value - PCH GPIO number
+
+ @retval GPIO read value (0/1)
+**/
+BOOLEAN
+GpioRead (
+ EFI_PEI_SERVICES **PeiServices,
+ CPU_FAMILY CpuFamilyId,
+ IN UINT16 GpioAddress,
+ IN UINT8 Value
+ )
+{
+ BOOLEAN Active;
+ UINT16 BitOffset=0;
+ UINT32 Data;
+
+ Active = (BOOLEAN) (Value >> 7);
+ Value &= 0x7F;
+
+ ASSERT (GpioAddress != 0);
+
+ if (CpuFamilyId == EnumCpuHswUlt) {
+ GpioAddress += R_PCH_GP_N_CONFIG0 + (Value * 0x08);
+ BitOffset = 30; //GPI_LVL
+ } else {
+ if (Value < 0x20) {
+ GpioAddress += R_PCH_GPIO_LVL;
+ BitOffset = Value;
+ } else if (Value < 0x40) {
+ GpioAddress += R_PCH_GPIO_LVL2;
+ BitOffset = Value - 0x20;
+ } else {
+ GpioAddress += R_PCH_GPIO_LVL3;
+ BitOffset = Value - 0x40;
+ }
+ }
+
+ Data = IoRead32 (GpioAddress);
+ Data >>= BitOffset;
+
+ if (Active == 0) {
+ Data = ~Data;
+ }
+
+ return (BOOLEAN) (Data & 0x1);
+}
+
+/**
+ SG GPIO Write
+
+ @param[in] PeiServices - General purpose services available to every PEIM
+ @param[in] CpuFamilyId - Specifies the CPU family
+ @param[in] GpioAddress - GPIO base address
+ @param[in] Value - PCH GPIO number
+ @param[in] Level - Write SG GPIO value (0/1)
+
+ @retval none
+**/
+VOID
+GpioWrite (
+ EFI_PEI_SERVICES **PeiServices,
+ CPU_FAMILY CpuFamilyId,
+ IN UINT16 GpioAddress,
+ IN UINT8 Value,
+ IN BOOLEAN Level
+ )
+{
+ BOOLEAN Active;
+ UINT32 Data;
+ UINT16 BitOffset=0;
+
+ Active = (BOOLEAN) (Value >> 7);
+ Value &= 0x7F;
+
+ if (Active == 0) {
+ Level = (~Level) & 0x1;
+ }
+
+ ASSERT (GpioAddress != 0);
+
+ if (CpuFamilyId == EnumCpuHswUlt) {
+ GpioAddress += R_PCH_GP_N_CONFIG0 + (Value * 0x08);
+ BitOffset = 31; //GPO_LVL
+ } else {
+ if (Value < 0x20) {
+ GpioAddress += R_PCH_GPIO_LVL;
+ BitOffset = Value;
+ } else if (Value < 0x40) {
+ GpioAddress += R_PCH_GPIO_LVL2;
+ BitOffset = Value - 0x20;
+ } else {
+ GpioAddress += R_PCH_GPIO_LVL3;
+ BitOffset = Value - 0x40;
+ }
+ }
+
+ Data = IoRead32 (GpioAddress);
+ Data &= ~(0x1 << BitOffset);
+ Data |= (Level << BitOffset);
+
+ IoWrite32 (GpioAddress, Data);
+ return ;
+}
+
+#endif //SG_SUPPORT \ No newline at end of file
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SwitchableGraphicsInit.h b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SwitchableGraphicsInit.h
new file mode 100644
index 0000000..7126b19
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Pei/SwitchableGraphicsInit.h
@@ -0,0 +1,93 @@
+/** @file
+ Header file for the SwitchableGraphics Pei driver.
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+#ifndef _SWITCHABLE_GRAPHICS_PEI_H_
+#define _SWITCHABLE_GRAPHICS_PEI_H_
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#include "EdkIIGlueIoLib.h"
+#endif
+
+#include "CpuRegs.h"
+#include "CpuPlatformLib.h"
+
+#include "PchAccess.h"
+#include "SaAccess.h"
+
+#include EFI_PPI_DEPENDENCY (SaPlatformPolicy)
+#include EFI_PPI_DEPENDENCY (Stall)
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#ifndef HIGH
+#define HIGH 1
+#endif
+
+#ifndef LOW
+#define LOW 0
+#endif
+
+#define SG_DELAY_HOLD_RST 100 * STALL_ONE_MILLI_SECOND
+#define SG_DELAY_PWR_ENABLE 300 * STALL_ONE_MILLI_SECOND
+
+/**
+ SG GPIO Write
+
+ @param[in] PeiServices - General purpose services available to every PEIM
+ @param[in] CpuFamilyId - Specifies the CPU family
+ @param[in] GpioAddress - GPIO base address
+ @param[in] Value - PCH GPIO number
+ @param[in] Level - Write SG GPIO value (0/1)
+
+ @retval none
+**/
+VOID
+GpioWrite (
+ EFI_PEI_SERVICES **PeiServices,
+ CPU_FAMILY CpuFamilyId,
+ IN UINT16 GpioAddress,
+ IN UINT8 Value,
+ IN BOOLEAN Level
+ )
+;
+
+/**
+ SG GPIO Read
+
+ @param[in] PeiServices - General purpose services available to every PEIM
+ @param[in] CpuFamilyId - Specifies the CPU family
+ @param[in] GpioAddress - GPIO base address
+ @param[in] Value - PCH GPIO number
+
+ @retval GPIO read value (0/1)
+**/
+BOOLEAN
+GpioRead (
+ EFI_PEI_SERVICES **PeiServices,
+ CPU_FAMILY CpuFamilyId,
+ IN UINT16 GpioAddress,
+ IN UINT8 Value
+ )
+;
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Smm/SaLateInitSmm.c b/ReferenceCode/Chipset/SystemAgent/SaInit/Smm/SaLateInitSmm.c
new file mode 100644
index 0000000..45ce0af
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Smm/SaLateInitSmm.c
@@ -0,0 +1,204 @@
+/** @file
+ This SMM driver will handle SA relevant late initialization
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+///
+/// External include files do NOT need to be explicitly specified in real EDKII
+/// environment
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "SaBuildFlags.h"
+#include "EdkIIGlueDxe.h"
+#include "SaLateInitSmm.h"
+#include "SaRegs.h"
+#include "SaAccess.h"
+#include "PchAccess.h"
+#include "CpuIA32.h"
+#include "SaPcieLib.h"
+#include EFI_PROTOCOL_DEPENDENCY (SmmIoTrapDispatch)
+#include EFI_GUID_DEFINITION (SaDataHob)
+#endif
+
+typedef enum {
+ EnumSaSmiCallbackForMaxPayLoad,
+ EnumSaSmiCallbackForSecurityLock,
+ EnumSaSmiCallbackForLateInit,
+ EnumSaSmiCallbackForS3resume,
+ EnumSaSmiCallbackMax
+} SMI_OPERATION;
+
+UINT8 mSaSmiCallbackPhase = EnumSaSmiCallbackForMaxPayLoad;
+
+/**
+ A SMI callback to do SA relevant late initialization
+
+ @param[in] DispatchHandle - The handle of this callback, obtained when registering
+ @param[in] DispatchContext - Pointer to the EFI_SMM_IO_TRAP_DISPATCH_CALLBACK_CONTEXT
+
+ @retval None
+**/
+VOID
+EFIAPI
+SaIoTrapSmiCallback (
+ IN EFI_HANDLE DispatchHandle,
+ IN EFI_SMM_IO_TRAP_DISPATCH_CALLBACK_CONTEXT *CallbackContext
+ )
+{
+
+ if (mSaSmiCallbackPhase == EnumSaSmiCallbackMax) {
+ return;
+ }
+ if (mSaSmiCallbackPhase == EnumSaSmiCallbackForMaxPayLoad) {
+ SaPcieEnumCallback ();
+ ///
+ /// Switch to next phase
+ ///
+ mSaSmiCallbackPhase = EnumSaSmiCallbackForSecurityLock;
+ } else if (mSaSmiCallbackPhase == EnumSaSmiCallbackForSecurityLock) {
+ ///
+ /// Save platform registers including IGFX BAR & COMMAND registers and PAM
+ ///
+ SaSaveRestorePlatform (TRUE);
+ SaSecurityLock ();
+ ///
+ /// Switch to next phase
+ ///
+ mSaSmiCallbackPhase = EnumSaSmiCallbackForLateInit;
+ } else if (mSaSmiCallbackPhase == EnumSaSmiCallbackForLateInit) {
+ ///
+ /// Expected to execute in ReadyToBoot point (after OROM)
+ ///
+ SaPcieConfigAfterOpRom ();
+ ///
+ /// Switch to next phase
+ ///
+ mSaSmiCallbackPhase = EnumSaSmiCallbackForS3resume;
+ } else if (mSaSmiCallbackPhase == EnumSaSmiCallbackForS3resume) {
+ ///
+ /// Expected to execute in end of S3 resume flow
+ ///
+ SaS3ResumeCallback ();
+ }
+}
+
+/**
+ Initializes the SA SMM handler
+
+ @param[in] ImageHandle - The image handle of Wake On Lan driver
+ @param[in] SystemTable - The standard EFI system table
+
+ @retval EFI_SUCCESS - SA SMM handler was installed or not necessary
+ @retval EFI_NOT_FOUND - DxePlatformSaPolicy not found
+**/
+EFI_STATUS
+SaLateInitSmmEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ EFI_SMM_IO_TRAP_DISPATCH_PROTOCOL *PchIoTrap;
+ EFI_HANDLE PchIoTrapHandle;
+ EFI_SMM_IO_TRAP_DISPATCH_REGISTER_CONTEXT PchIoTrapContext;
+ SA_DATA_HOB *SaDataHob;
+ DXE_PLATFORM_SA_POLICY_PROTOCOL *DxePlatformSaPolicy;
+ BOOLEAN InitPcieAspmAfterOprom;
+ EFI_PHYSICAL_ADDRESS IotrapAddress;
+
+ DEBUG ((EFI_D_INFO, "SaLateInitSmmEntryPoint()\n"));
+
+ SaDataHob = NULL;
+ SaDataHob = (SA_DATA_HOB *)GetFirstGuidHob (&gSaDataHobGuid);
+ Status = EFI_NOT_FOUND;
+ if ((SaDataHob != NULL)) {
+ ///
+ /// Locate the PCH Trap dispatch protocol
+ ///
+ Status = gBS->LocateProtocol (&gEfiSmmIoTrapDispatchProtocolGuid, NULL, (VOID **) &PchIoTrap);
+ ASSERT_EFI_ERROR (Status);
+ if ((Status == EFI_SUCCESS) && (SaDataHob->SaIotrapSmiAddress != 0)) {
+ ///
+ /// Allocate 16 byte range from GCD for this IO trap address
+ ///
+ IotrapAddress = SaDataHob->SaIotrapSmiAddress;
+ DEBUG ((EFI_D_INFO, "Iotrap address=%X\n", SaDataHob->SaIotrapSmiAddress));
+ Status = gDS->AllocateIoSpace (
+ EfiGcdAllocateAddress,
+ EfiGcdIoTypeIo,
+ 0,
+ 0x10,
+ &IotrapAddress,
+ ImageHandle,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+ if (Status == EFI_SUCCESS) {
+ PchIoTrapContext.Type = ReadWriteTrap;
+ PchIoTrapContext.Length = 4;
+ PchIoTrapContext.Address = SaDataHob->SaIotrapSmiAddress;
+ PchIoTrapContext.Context = NULL;
+ PchIoTrapContext.MergeDisable = FALSE;
+ Status = PchIoTrap->Register (
+ PchIoTrap,
+ SaIoTrapSmiCallback,
+ &PchIoTrapContext,
+ &PchIoTrapHandle
+ );
+ ASSERT_EFI_ERROR (Status);
+ if (Status == EFI_SUCCESS) {
+ InitPcieAspmAfterOprom = SaDataHob->InitPcieAspmAfterOprom;
+#if SA_PCIE_ASPM_IN_DXE == 0
+ ///
+ /// There is no DXE ASPM code so always executes SMM code
+ ///
+ InitPcieAspmAfterOprom = 1;
+#endif
+ if (InitPcieAspmAfterOprom == 1) {
+ ///
+ /// Initialize module global variables - Stepping ID and Platform Policy for runtime SMI handler
+ /// Get the platform setup policy.
+ ///
+ Status = gBS->LocateProtocol (&gDxePlatformSaPolicyGuid, NULL, (VOID **) &DxePlatformSaPolicy);
+ ASSERT_EFI_ERROR (Status);
+ if (DxePlatformSaPolicy != NULL) {
+ SaPcieInitPolicy (DxePlatformSaPolicy);
+ }
+ } else {
+ ///
+ /// InitPcieAspmAfterOprom was not available or disabled, make this SMI handler directly return.
+ ///
+ mSaSmiCallbackPhase = EnumSaSmiCallbackMax;
+ }
+ }
+ }
+ }
+ }
+
+ ///
+ /// For security consideration, if this SMM driver was compiled/executed, the IOTRAP SMI handler must be registered successfully.
+ /// If not, hang system here
+ ///
+ if (Status != EFI_SUCCESS) {
+ DEBUG ((EFI_D_ERROR, "Failed to register SaIotrapSmiCallback! System halt!\n"));
+ EFI_DEADLOOP ();
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Smm/SaLateInitSmm.cif b/ReferenceCode/Chipset/SystemAgent/SaInit/Smm/SaLateInitSmm.cif
new file mode 100644
index 0000000..6fbd4ba
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Smm/SaLateInitSmm.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "SaLateInitSmm"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\SystemAgent\SaInit\Smm\"
+ RefName = "SaLateInitSmm"
+[files]
+"SaLateInitSmm.sdl"
+"SaLateInitSmm.mak"
+"SaLateInitSmm.h"
+"SaLateInitSmm.c"
+"SaLateInitSmm.dxs"
+"SaLateInitSmm.inf"
+<endComponent>
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Smm/SaLateInitSmm.dxs b/ReferenceCode/Chipset/SystemAgent/SaInit/Smm/SaLateInitSmm.dxs
new file mode 100644
index 0000000..8890d7d
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Smm/SaLateInitSmm.dxs
@@ -0,0 +1,45 @@
+/** @file
+ Dependency expression source file.
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "DxeDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+
+#include EFI_PROTOCOL_DEPENDENCY (SmmBase)
+#include EFI_PROTOCOL_DEPENDENCY (SmmIoTrapDispatch)
+#include EFI_PROTOCOL_DEPENDENCY (SaPlatformPolicy)
+#endif
+
+DEPENDENCY_START
+ EFI_SMM_BASE_PROTOCOL_GUID AND
+ EFI_SMM_IO_TRAP_DISPATCH_PROTOCOL_GUID AND
+ DXE_PLATFORM_SA_POLICY_GUID
+DEPENDENCY_END
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Smm/SaLateInitSmm.h b/ReferenceCode/Chipset/SystemAgent/SaInit/Smm/SaLateInitSmm.h
new file mode 100644
index 0000000..71ff7e4
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Smm/SaLateInitSmm.h
@@ -0,0 +1,39 @@
+/** @file
+ Header file for SA SMM Handler
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+#ifndef _SaLateInitSmm_H_
+#define _SaLateInitSmm_H_
+
+///
+/// External include files do NOT need to be explicitly specified in real EDKII
+/// environment
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+///
+/// Driver Consumed Protocol Prototypes
+///
+#include EFI_PROTOCOL_DEPENDENCY (SmmBase)
+#include EFI_PROTOCOL_DEPENDENCY (SmmIchnDispatch)
+#include EFI_PROTOCOL_DEPENDENCY (SaPlatformPolicy)
+
+#endif
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Smm/SaLateInitSmm.inf b/ReferenceCode/Chipset/SystemAgent/SaInit/Smm/SaLateInitSmm.inf
new file mode 100644
index 0000000..3fd8846
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Smm/SaLateInitSmm.inf
@@ -0,0 +1,97 @@
+## @file
+# Component description file for the SA late initialization SMM module.
+#
+#@copyright
+# Copyright (c) 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = SaLateInitSmm
+FILE_GUID = 2D1E361C-7B3F-4d15-8B1F-66E551FABDC7
+COMPONENT_TYPE = RT_DRIVER
+
+[sources.common]
+ SaLateInitSmm.c
+ SaLateInitSmm.h
+
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueSmmDriverEntryPoint.c
+
+[includes.common]
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Core/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include/Pcd
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include/Library
+ $(EDK_SOURCE)/Foundation/Cpu/Pentium/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Library/SaPcieLib/Common
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+
+
+[libraries.common]
+ EdkProtocolLib
+ ArchProtocolLib
+ EdkFrameworkProtocolLib
+ EdkIIGlueBaseLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueBaseMemoryLib
+ EdkIIGlueDxeMemoryAllocationLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueSmmRuntimeDxeReportStatusCodeLib
+ EdkIIGlueBasePciLibPciExpress
+ EdkIIGlueUefiLib
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueDxeServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueUefiDevicePathLib
+ EfiProtocolLib
+ $(PROJECT_SA_FAMILY)ProtocolLib
+ SaGuidLib
+ EdkIIGlueDxeHobLib
+ CpuPlatformLib
+ SaPcieSmmLib
+ $(PROJECT_PCH_FAMILY)ProtocolLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT=_ModuleEntryPoint
+ DPX_SOURCE=SaLateInitSmm.dxs
+
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=SaLateInitSmmEntryPoint
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_LIB__ \
+ -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_SMM_RUNTIME_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_UEFI_LIB__\
+ -D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_DEVICE_PATH_LIB__ \
+ -D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+ -D __EDKII_GLUE_DXE_HOB_LIB__
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Smm/SaLateInitSmm.mak b/ReferenceCode/Chipset/SystemAgent/SaInit/Smm/SaLateInitSmm.mak
new file mode 100644
index 0000000..dfa035d
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Smm/SaLateInitSmm.mak
@@ -0,0 +1,96 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#---------------------------------------------------------------------------
+# Create SaLateInitSmm Driver
+#---------------------------------------------------------------------------
+EDK : SaLateInitSmm
+SaLateInitSmm : $(BUILD_DIR)\SaLateInitSmm.mak SaLateInitSmmBin
+
+
+$(BUILD_DIR)\SaLateInitSmm.mak : $(SaLateInitSmm_DIR)\$(@B).cif $(SaLateInitSmm_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(SaLateInitSmm_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+SaLateInitSmm_INCLUDES=\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(INTEL_MCH_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+ /I$(INTEL_SYSTEM_AGENT_DIR)\Library\SaPcieLib\Common\
+
+SaLateInitSmm_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=SaLateInitSmmEntryPoint"\
+ /D __EDKII_GLUE_BASE_LIB__ \
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_SMM_RUNTIME_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_UEFI_LIB__ \
+ /D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_UEFI_DEVICE_PATH_LIB__ \
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+ /D __EDKII_GLUE_DXE_HOB_LIB__ \
+
+SaLateInitSmm_LIB_LINKS =\
+ $(EDKPROTOCOLLIB)\
+ $(ArchProtocolLib)\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGlueDxeMemoryAllocationLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueSmmRuntimeDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(EdkIIGlueUefiLib_LIB)\
+ $(EdkIIGlueSmmFirmwarePerformanceLib_LIB)\
+ $(EdkIIGlueDxeServicesTableLib_LIB)\
+ $(EdkIIGlueUefiRuntimeServicesTableLib_LIB)\
+ $(EdkIIGlueUefiDevicePathLib_LIB)\
+ $(EFIPROTOCOLLIB)\
+ $(INTEL_SA_PROTOCOL_LIB)\
+ $(SaGuidLib_LIB)\
+ $(EdkIIGlueDxeHobLib_LIB)\
+ $(CpuPlatformLib_LIB)\
+ $(PchPlatformDxeLib_LIB)\
+ $(SaPcieSmmLib_LIB)\
+ $(INTEL_PCH_PROTOCOL_LIB)\
+
+SaLateInitSmmBin: $(COMPILERSTUB) $(SaLateInitSmm_LIB_LINKS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\SaLateInitSmm.mak all \
+ "MY_INCLUDES=$(SaLateInitSmm_INCLUDES)" \
+ "MY_DEFINES=$(SaLateInitSmm_DEFINES)" \
+ GUID=2D1E361C-7B3F-4d15-8B1F-66E551FABDC7\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=BS_DRIVER\
+ EDKIIModule=SMMDRIVER\
+ DEPEX1=$(SaLateInitSmm_DIR)\SaLateInitSmm.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \
+ COMPRESS=1
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Chipset/SystemAgent/SaInit/Smm/SaLateInitSmm.sdl b/ReferenceCode/Chipset/SystemAgent/SaInit/Smm/SaLateInitSmm.sdl
new file mode 100644
index 0000000..285ea16
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SaInit/Smm/SaLateInitSmm.sdl
@@ -0,0 +1,26 @@
+TOKEN
+ Name = "SaLateInitSmm_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable SaLateInitSmm support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "SaLateInitSmm_DIR"
+ Help = "SaLateInitSmm file source directory"
+End
+
+MODULE
+ Help = "Includes SaLateInitSmm.mak to Project"
+ File = "SaLateInitSmm.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\SaLateInitSmm.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End \ No newline at end of file
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/Include/AcpiBuild.dsc b/ReferenceCode/Chipset/SystemAgent/SampleCode/Include/AcpiBuild.dsc
new file mode 100644
index 0000000..cc3fb3d
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/Include/AcpiBuild.dsc
@@ -0,0 +1,96 @@
+## @file
+# Build description file for building ASL and ACT file types used in ACPI tables
+# You should not put platform details, like how to build DSDT, SSDT, or how to
+# package the ACPI tables into a data file in this build. This should be platform
+# neutral code only.
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[=============================================================================]
+[Compile.Ia32.act,Compile.x64.act]
+#
+# Instructions to create ACPI table sections out of ACPI table C source files.
+#
+
+#/*++
+#
+# If it already exists, then include the dependency list file for this
+# source file. If it doesn't exist, then this is a clean build and the
+# dependency file will get created below and the source file will get
+# compiled. Don't do any of this if NO_MAKEDEPS is defined.
+#
+#--*/
+!IF ("$(NO_MAKEDEPS)" == "")
+
+!IF EXIST($(DEST_DIR)\$(FILE).dep)
+!INCLUDE $(DEST_DIR)\$(FILE).dep
+!ENDIF
+
+#
+# This is how to create the dependency file.
+#
+DEP_FILE = $(DEST_DIR)\$(FILE).dep
+
+$(DEP_FILE) : $(SOURCE_FILE_NAME)
+ $(MAKEDEPS) -ignorenotfound -f $(SOURCE_FILE_NAME) -q -target \
+ $(DEST_DIR)\$(FILE).obj \
+ -o $(DEP_FILE) $(INC)
+
+!ENDIF
+
+#
+# Compile the file
+#
+$(DEST_DIR)\$(FILE).obj : $(SOURCE_FILE_NAME) $(INC_DEPS) $(DEP_FILE)
+ $(CC) $(C_FLAGS) /TC $(SOURCE_FILE_NAME)
+
+#
+# Link it
+#
+$(DEST_DIR)\$(FILE).exe : $(DEST_DIR)\$(FILE).obj
+ $(LINK) $(LINK_FLAGS_EXE) $(DEST_DIR)\$(FILE).obj /OUT:$(DEST_DIR)\$(FILE).exe /ENTRY:main
+
+#
+# Strip out the ACPI table
+#
+$(DEST_DIR)\$(FILE).acpi : $(DEST_DIR)\$(FILE).exe
+ $(GENACPITABLE) $(DEST_DIR)\$(FILE).exe $(DEST_DIR)\$(FILE).acpi
+
+#
+# Create a section from the ACPI table
+#
+$(DEST_DIR)\$(FILE).sec : $(DEST_DIR)\$(FILE).acpi
+ $(GENSECTION) -I $(DEST_DIR)\$(FILE).acpi -O $(DEST_DIR)\$(FILE).sec -S EFI_SECTION_RAW
+
+#
+# Add it to the targets to build
+#
+SECTIONS = $(SECTIONS) $(DEST_DIR)\$(FILE).sec
+
+[=============================================================================]
+[Compile.Ia32.asl,Compile.x64.asl]
+#
+# We run the ASL through the C Preprocessor to resolve definitions.
+#
+$(DEST_DIR)\$(FILE).asl : $(SOURCE_FILE_NAME)
+ $(CC) $(ASL_CPP_FLAGS) /nologo /C /EP /TC $(INC) -oa $(SOURCE_FILE_NAME) > $(DEST_DIR)\$(FILE).asl
+
+#
+# Add it to the targets to build
+#
+ASL_FILES = $(ASL_FILES) $(DEST_DIR)\$(FILE).asl
+
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/Include/Cpu.h b/ReferenceCode/Chipset/SystemAgent/SampleCode/Include/Cpu.h
new file mode 100644
index 0000000..510f1b7
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/Include/Cpu.h
@@ -0,0 +1,66 @@
+/** @file
+ Various CPU-specific definitions.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains 'Framework Code' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may not be modified, except as allowed by
+ additional terms of your license agreement.
+**/
+
+#ifndef _CPU_H_
+#define _CPU_H_
+
+#define B_FAMILY_MODEL_STEPPING 0x00000FFF
+
+#define EFI_MSR_CORE_THREAD_COUNT 0x35
+#define EFI_MSR_IA32_PERF_STS 0x198
+#define EFI_MSR_IA32_PERF_CTL 0x199
+#define EFI_MSR_IA32_CLOCK_MODULATION 0x19A
+#define EFI_MSR_IA32_THERM_STATUS 0x19C
+
+#define B_BS_VID 0x0000003F
+#define N_BS_VID 0
+#define B_BS_RATIO 0x00001F00
+#define N_BS_RATIO 8
+
+///
+/// UINT64 workaround
+///
+/// The MS compiler doesn't handle QWORDs very well. I'm breaking
+/// them into DWORDs to circumvent the problems. Converting back
+/// shouldn't be a big deal.
+///
+#pragma pack(1)
+typedef union _MSR_REGISTER {
+ UINT64 Qword;
+
+ struct _DWORDS {
+ UINT32 Low;
+ UINT32 High;
+ } Dwords;
+
+ struct _BYTES {
+ UINT8 FirstByte;
+ UINT8 SecondByte;
+ UINT8 ThirdByte;
+ UINT8 FouthByte;
+ UINT8 FifthByte;
+ UINT8 SixthByte;
+ UINT8 SeventhByte;
+ UINT8 EighthByte;
+ } Bytes;
+
+} MSR_REGISTER;
+#pragma pack()
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/Capsule/Capsule.c b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/Capsule/Capsule.c
new file mode 100644
index 0000000..4b1ea89
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/Capsule/Capsule.c
@@ -0,0 +1,27 @@
+/** @file
+ Capsule PPI GUID declaration.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains 'Framework Code' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may not be modified, except as allowed by
+ additional terms of your license agreement.
+**/
+
+#include "Tiano.h"
+#include "PeiBind.h"
+#include "PeiApi.h"
+#include EFI_PPI_DEFINITION (Capsule)
+
+EFI_GUID gPeiCapsulePpiGuid = PEI_CAPSULE_PPI_GUID;
+
+EFI_GUID_STRING(&gPeiCapsulePpiGuid, "Capsule", "Capsule Update PPI");
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/Capsule/Capsule.h b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/Capsule/Capsule.h
new file mode 100644
index 0000000..200e7f5
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/Capsule/Capsule.h
@@ -0,0 +1,60 @@
+/** @file
+ Capsule PPI definitions.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains 'Framework Code' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may not be modified, except as allowed by
+ additional terms of your license agreement.
+**/
+
+#ifndef _PEI_CAPSULE_PPI_H_
+#define _PEI_CAPSULE_PPI_H_
+
+#define PEI_CAPSULE_PPI_GUID \
+ { \
+ 0x3acf33ee, 0xd892, 0x40f4, 0xa2, 0xfc, 0x38, 0x54, 0xd2, 0xe1, 0x32, 0x3d \
+ }
+
+EFI_FORWARD_DECLARATION (PEI_CAPSULE_PPI);
+
+typedef
+EFI_STATUS
+(EFIAPI *PEI_CAPSULE_COALESCE) (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN OUT VOID **MemoryBase,
+ IN OUT UINTN *MemSize
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *PEI_CAPSULE_CREATE_STATE) (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN VOID *CapsuleBase, /// returned from coalesce
+ IN UINTN CapsuleSize /// returned from coalesce
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *PEI_CAPSULE_CHECK_CAPSULE_UPDATE) (
+ IN EFI_PEI_SERVICES **PeiServices
+ );
+
+struct _PEI_CAPSULE_PPI {
+ PEI_CAPSULE_COALESCE Coalesce;
+ PEI_CAPSULE_CHECK_CAPSULE_UPDATE CheckCapsuleUpdate;
+ PEI_CAPSULE_CREATE_STATE CreateState;
+};
+
+extern EFI_GUID gPeiCapsulePpiGuid;
+
+#endif /// #ifndef _PEI_CAPSULE_PPI_H_
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/IntelSaSampleCodePpiLib.cif b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/IntelSaSampleCodePpiLib.cif
new file mode 100644
index 0000000..e8e28a4
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/IntelSaSampleCodePpiLib.cif
@@ -0,0 +1,18 @@
+<component>
+ name = "IntelSaSampleCodePpiLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\SystemAgent\SampleCode\Ppi"
+ RefName = "IntelSaSampleCodePpiLib"
+[files]
+"IntelSaSampleCodePpiLib.sdl"
+"IntelSaSampleCodePpiLib.mak"
+"IntelSaSampleCodePpiLib.inf"
+"PlatformMemoryRange\PlatformMemoryRange.c"
+"PlatformMemoryRange\PlatformMemoryRange.h"
+"PlatformMemorySize\PlatformMemorySize.c"
+"PlatformMemorySize\PlatformMemorySize.h"
+"Capsule\Capsule.c"
+"Capsule\Capsule.h"
+"SmmAccess\SmmAccess.c"
+"SmmAccess\SmmAccess.h"
+<endComponent>
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/IntelSaSampleCodePpiLib.inf b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/IntelSaSampleCodePpiLib.inf
new file mode 100644
index 0000000..ce3a918
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/IntelSaSampleCodePpiLib.inf
@@ -0,0 +1,51 @@
+## @file
+# Component description file for the PEI protocol library
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+
+[defines]
+BASE_NAME = IntelSaSampleCodePpiLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ Capsule/Capsule.h
+ Capsule/Capsule.c
+ PlatformMemorySize/PlatformMemorySize.h
+ PlatformMemorySize/PlatformMemorySize.c
+ PlatformMemoryRange/PlatformMemoryRange.h
+ PlatformMemoryRange/PlatformMemoryRange.c
+ SmmAccess/SmmAccess.c
+ SmmAccess/SmmAccess.h
+
+[includes.common]
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Pei/Include
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/SampleCode
+
+[nmake.common]
+C_STD_INCLUDE=
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/IntelSaSampleCodePpiLib.mak b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/IntelSaSampleCodePpiLib.mak
new file mode 100644
index 0000000..c94e324
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/IntelSaSampleCodePpiLib.mak
@@ -0,0 +1,64 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/Chipset/Intel/NorthBridge/Haswell/Intel SystemAgent NB Refcode/SaSampleCode/IntelSaSampleCodePpiLib/IntelSaSampleCodePpiLib.mak 1 2/08/12 4:53a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 4:53a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/NorthBridge/Haswell/Intel SystemAgent NB Refcode/SaSampleCode/IntelSaSampleCodePpiLib/IntelSaSampleCodePpiLib.mak $
+#
+# 1 2/08/12 4:53a Yurenlai
+# Intel Haswell/NB eChipset initially releases.
+#
+#*************************************************************************
+#<AMI_FHDR_START>
+#
+# Name: IntelSaSampleCodePpiLib_LIB.mak
+#
+# Description:
+#
+#<AMI_FHDR_END>
+#**********************************************************************
+all : IntelSaSampleCodePpiLib
+
+$(BUILD_DIR)\IntelSaSampleCodePpiLib.lib : IntelSaSampleCodePpiLib
+
+IntelSaSampleCodePpiLib : $(BUILD_DIR)\IntelSaSampleCodePpiLib.mak IntelSaSampleCodePpiLibBin
+
+$(BUILD_DIR)\IntelSaSampleCodePpiLib.mak : $(IntelSaSampleCodePpiLib_DIR)\$(@B).cif $(IntelSaSampleCodePpiLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(IntelSaSampleCodePpiLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+IntelSaSampleCodePpiLibBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDK_DEFAULTS)\
+ /f $(BUILD_DIR)\IntelSaSampleCodePpiLib.mak all\
+ "MY_INCLUDES=$(EDK_INCLUDES) $(INTEL_MCH_INCLUDES) /I$(INTEL_SYSTEM_AGENT_DIR)\SampleCode" \
+ TYPE=PEI_LIBRARY \
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/IntelSaSampleCodePpiLib.sdl b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/IntelSaSampleCodePpiLib.sdl
new file mode 100644
index 0000000..02bda23
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/IntelSaSampleCodePpiLib.sdl
@@ -0,0 +1,28 @@
+TOKEN
+ Name = "IntelSaSampleCodePpiLib_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable FrameworkPpiLib support in Project"
+ TokenType = Boolean
+ TargetMAK = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "IntelSaSampleCodePpiLib_DIR"
+End
+
+MODULE
+ Help = "Includes IntelSaSampleCodePpiLib.mak to Project"
+ File = "IntelSaSampleCodePpiLib.mak"
+End
+
+ELINK
+ Name = "IntelSaSampleCodePpiLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\IntelSaSampleCodePpiLib.lib"
+ Parent = "IntelSaSampleCodePpiLib_LIB"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/PlatformMemoryRange/PlatformMemoryRange.c b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/PlatformMemoryRange/PlatformMemoryRange.c
new file mode 100644
index 0000000..c3c1d75
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/PlatformMemoryRange/PlatformMemoryRange.c
@@ -0,0 +1,25 @@
+/** @file
+ Platform Memory Range PPI GUID as defined in EFI 2.0
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains 'Framework Code' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may not be modified, except as allowed by
+ additional terms of your license agreement.
+**/
+#include "Tiano.h"
+#include "Pei.h"
+#include EFI_PPI_DEFINITION (PlatformMemoryRange)
+
+EFI_GUID gPeiPlatformMemoryRangePpiGuid = PEI_PLATFORM_MEMORY_RANGE_PPI_GUID;
+
+EFI_GUID_STRING(&gPeiPlatformMemoryRangePpiGuid, "PlatformMemoryRange", "Platform Memory Range PPI");
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/PlatformMemoryRange/PlatformMemoryRange.h b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/PlatformMemoryRange/PlatformMemoryRange.h
new file mode 100644
index 0000000..a9a2b3e
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/PlatformMemoryRange/PlatformMemoryRange.h
@@ -0,0 +1,145 @@
+/** @file
+ Platform Memory Range PPI as defined in EFI 2.0
+ PPI for reserving special purpose memory ranges.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains 'Framework Code' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may not be modified, except as allowed by
+ additional terms of your license agreement.
+**/
+#ifndef _PEI_PLATFORM_MEMORY_RANGE_H_
+#define _PEI_PLATFORM_MEMORY_RANGE_H_
+
+#define PEI_PLATFORM_MEMORY_RANGE_PPI_GUID \
+ { \
+ 0x30eb2979, 0xb0f7, 0x4d60, 0xb2, 0xdc, 0x1a, 0x2c, 0x96, 0xce, 0xb1, 0xf4 \
+ }
+
+EFI_FORWARD_DECLARATION (PEI_PLATFORM_MEMORY_RANGE_PPI);
+
+#define PEI_MEMORY_RANGE_OPTION_ROM UINT32
+
+#define PEI_MR_OPTION_ROM_ALL 0xFFFFFFFF
+#define PEI_MR_OPTION_ROM_NONE 0x00000000
+#define PEI_MR_OPTION_ROM_C0000_16K 0x00000001
+#define PEI_MR_OPTION_ROM_C4000_16K 0x00000002
+#define PEI_MR_OPTION_ROM_C8000_16K 0x00000004
+#define PEI_MR_OPTION_ROM_CC000_16K 0x00000008
+#define PEI_MR_OPTION_ROM_D0000_16K 0x00000010
+#define PEI_MR_OPTION_ROM_D4000_16K 0x00000020
+#define PEI_MR_OPTION_ROM_D8000_16K 0x00000040
+#define PEI_MR_OPTION_ROM_DC000_16K 0x00000080
+#define PEI_MR_OPTION_ROM_E0000_16K 0x00000100
+#define PEI_MR_OPTION_ROM_E4000_16K 0x00000200
+#define PEI_MR_OPTION_ROM_E8000_16K 0x00000400
+#define PEI_MR_OPTION_ROM_EC000_16K 0x00000800
+#define PEI_MR_OPTION_ROM_F0000_16K 0x00001000
+#define PEI_MR_OPTION_ROM_F4000_16K 0x00002000
+#define PEI_MR_OPTION_ROM_F8000_16K 0x00004000
+#define PEI_MR_OPTION_ROM_FC000_16K 0x00008000
+
+///
+/// SMRAM Memory Range
+///
+#define PEI_MEMORY_RANGE_SMRAM UINT32
+#define PEI_MR_SMRAM_ALL 0xFFFFFFFF
+#define PEI_MR_SMRAM_NONE 0x00000000
+#define PEI_MR_SMRAM_CACHEABLE_MASK 0x80000000
+#define PEI_MR_SMRAM_SEGTYPE_MASK 0x00FF0000
+#define PEI_MR_SMRAM_ABSEG_MASK 0x00010000
+#define PEI_MR_SMRAM_HSEG_MASK 0x00020000
+#define PEI_MR_SMRAM_TSEG_MASK 0x00040000
+///
+/// If adding additional entries, SMRAM Size
+/// is a multiple of 128KB.
+///
+#define PEI_MR_SMRAM_SIZE_MASK 0x0000FFFF
+#define PEI_MR_SMRAM_SIZE_128K_MASK 0x00000001
+#define PEI_MR_SMRAM_SIZE_256K_MASK 0x00000002
+#define PEI_MR_SMRAM_SIZE_512K_MASK 0x00000004
+#define PEI_MR_SMRAM_SIZE_1024K_MASK 0x00000008
+#define PEI_MR_SMRAM_SIZE_2048K_MASK 0x00000010
+#define PEI_MR_SMRAM_SIZE_4096K_MASK 0x00000020
+#define PEI_MR_SMRAM_SIZE_8192K_MASK 0x00000040
+#define PEI_MR_SMRAM_SIZE_16384K_MASK 0x00000080
+#define PEI_MR_SMRAM_SIZE_32768K_MASK 0x00000100
+#define PEI_MR_SMRAM_SIZE_65536K_MASK 0x00000200
+
+#define PEI_MR_SMRAM_ABSEG_128K_NOCACHE 0x00010001
+#define PEI_MR_SMRAM_HSEG_128K_CACHE 0x80020001
+#define PEI_MR_SMRAM_HSEG_128K_NOCACHE 0x00020001
+#define PEI_MR_SMRAM_TSEG_128K_CACHE 0x80040001
+#define PEI_MR_SMRAM_TSEG_128K_NOCACHE 0x00040001
+#define PEI_MR_SMRAM_TSEG_256K_CACHE 0x80040002
+#define PEI_MR_SMRAM_TSEG_256K_NOCACHE 0x00040002
+#define PEI_MR_SMRAM_TSEG_512K_CACHE 0x80040004
+#define PEI_MR_SMRAM_TSEG_512K_NOCACHE 0x00040004
+#define PEI_MR_SMRAM_TSEG_1024K_CACHE 0x80040008
+#define PEI_MR_SMRAM_TSEG_1024K_NOCACHE 0x00040008
+
+///
+/// Graphics Memory Range
+///
+#define PEI_MEMORY_RANGE_GRAPHICS_MEMORY UINT32
+#define PEI_MR_GRAPHICS_MEMORY_ALL 0xFFFFFFFF
+#define PEI_MR_GRAPHICS_MEMORY_NONE 0x00000000
+#define PEI_MR_GRAPHICS_MEMORY_CACHEABLE 0x80000000
+///
+/// If adding additional entries, Graphics Memory Size
+/// is a multiple of 512KB.
+///
+#define PEI_MR_GRAPHICS_MEMORY_SIZE_MASK 0x0000FFFF
+#define PEI_MR_GRAPHICS_MEMORY_512K_NOCACHE 0x00000001
+#define PEI_MR_GRAPHICS_MEMORY_512K_CACHE 0x80000001
+#define PEI_MR_GRAPHICS_MEMORY_1M_NOCACHE 0x00000002
+#define PEI_MR_GRAPHICS_MEMORY_1M_CACHE 0x80000002
+#define PEI_MR_GRAPHICS_MEMORY_4M_NOCACHE 0x00000008
+#define PEI_MR_GRAPHICS_MEMORY_4M_CACHE 0x80000008
+#define PEI_MR_GRAPHICS_MEMORY_8M_NOCACHE 0x00000010
+#define PEI_MR_GRAPHICS_MEMORY_8M_CACHE 0x80000010
+#define PEI_MR_GRAPHICS_MEMORY_16M_NOCACHE 0x00000020
+#define PEI_MR_GRAPHICS_MEMORY_16M_CACHE 0x80000020
+#define PEI_MR_GRAPHICS_MEMORY_32M_NOCACHE 0x00000040
+#define PEI_MR_GRAPHICS_MEMORY_32M_CACHE 0x80000040
+#define PEI_MR_GRAPHICS_MEMORY_48M_NOCACHE 0x00000060
+#define PEI_MR_GRAPHICS_MEMORY_48M_CACHE 0x80000060
+#define PEI_MR_GRAPHICS_MEMORY_64M_NOCACHE 0x00000080
+#define PEI_MR_GRAPHICS_MEMORY_64M_CACHE 0x80000080
+#define PEI_MR_GRAPHICS_MEMORY_128M_NOCACHE 0x00000100
+#define PEI_MR_GRAPHICS_MEMORY_128M_CACHE 0x80000100
+#define PEI_MR_GRAPHICS_MEMORY_256M_NOCACHE 0x00000200
+#define PEI_MR_GRAPHICS_MEMORY_256M_CACHE 0x80000200
+///
+/// Pci Memory Hole
+///
+#define PEI_MEMORY_RANGE_PCI_MEMORY UINT32
+#define PEI_MR_PCI_MEMORY_SIZE_512M_MASK 0x00000001
+
+typedef
+EFI_STATUS
+(EFIAPI *PEI_CHOOSE_RANGES) (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_PLATFORM_MEMORY_RANGE_PPI * This,
+ IN OUT PEI_MEMORY_RANGE_OPTION_ROM * OptionRomMask,
+ IN OUT PEI_MEMORY_RANGE_SMRAM * SmramMask,
+ IN OUT PEI_MEMORY_RANGE_GRAPHICS_MEMORY * GraphicsMemoryMask,
+ IN OUT PEI_MEMORY_RANGE_PCI_MEMORY * PciMemoryMask
+ );
+
+struct _PEI_PLATFORM_MEMORY_RANGE_PPI {
+ PEI_CHOOSE_RANGES ChooseRanges;
+};
+
+extern EFI_GUID gPeiPlatformMemoryRangePpiGuid;
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/PlatformMemorySize/PlatformMemorySize.c b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/PlatformMemorySize/PlatformMemorySize.c
new file mode 100644
index 0000000..4a6c6ea
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/PlatformMemorySize/PlatformMemorySize.c
@@ -0,0 +1,25 @@
+/** @file
+ Platform Memory Size PPI GUID as defined in Tiano
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains 'Framework Code' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may not be modified, except as allowed by
+ additional terms of your license agreement.
+**/
+#include "Tiano.h"
+#include "Pei.h"
+#include EFI_PPI_DEFINITION (PlatformMemorySize)
+
+EFI_GUID gPeiPlatformMemorySizePpiGuid = PEI_PLATFORM_MEMORY_SIZE_PPI_GUID;
+
+EFI_GUID_STRING(&gPeiPlatformMemorySizePpiGuid, "PlatformMemorySize", "Platform Memory Size PPI");
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/PlatformMemorySize/PlatformMemorySize.h b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/PlatformMemorySize/PlatformMemorySize.h
new file mode 100644
index 0000000..0c11041
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/PlatformMemorySize/PlatformMemorySize.h
@@ -0,0 +1,45 @@
+/** @file
+ Platform Memory Size PPI as defined in Tiano
+ PPI for describing the minimum platform memory size in order to successfully
+ pass control into DXE
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains 'Framework Code' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may not be modified, except as allowed by
+ additional terms of your license agreement.
+**/
+#ifndef _PEI_PLATFORM_MEMORY_SIZE_H_
+#define _PEI_PLATFORM_MEMORY_SIZE_H_
+
+#define PEI_PLATFORM_MEMORY_SIZE_PPI_GUID \
+ { \
+ 0x9a7ef41e, 0xc140, 0x4bd1, 0xb8, 0x84, 0x1e, 0x11, 0x24, 0xb, 0x4c, 0xe6 \
+ }
+
+EFI_FORWARD_DECLARATION (PEI_PLATFORM_MEMORY_SIZE_PPI);
+
+typedef
+EFI_STATUS
+(EFIAPI *PEI_GET_MINIMUM_PLATFORM_MEMORY_SIZE) (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_PLATFORM_MEMORY_SIZE_PPI * This,
+ IN OUT UINT64 *MemorySize
+ );
+
+struct _PEI_PLATFORM_MEMORY_SIZE_PPI {
+ PEI_GET_MINIMUM_PLATFORM_MEMORY_SIZE GetPlatformMemorySize;
+};
+
+extern EFI_GUID gPeiPlatformMemorySizePpiGuid;
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/SmmAccess/SmmAccess.c b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/SmmAccess/SmmAccess.c
new file mode 100644
index 0000000..9dc4695
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/SmmAccess/SmmAccess.c
@@ -0,0 +1,25 @@
+/** @file
+ SmmAccess PPI GUID
+
+@copyright
+ Copyright (c) 2009 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains 'Framework Code' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may not be modified, except as allowed by
+ additional terms of your license agreement.
+**/
+#include "Tiano.h"
+#include "Pei.h"
+#include EFI_PPI_DEFINITION (SmmAccess)
+
+EFI_GUID gPeiSmmAccessPpiGuid = PEI_SMM_ACCESS_PPI_GUID;
+
+EFI_GUID_STRING(&gPeiSmmAccessPpiGuid, "SmmAccess", "SMM Access PPI");
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/SmmAccess/SmmAccess.h b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/SmmAccess/SmmAccess.h
new file mode 100644
index 0000000..8ff077f
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/SmmAccess/SmmAccess.h
@@ -0,0 +1,136 @@
+/** @file
+ This code abstracts the PEI core to provide SmmAccess services.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains 'Framework Code' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may not be modified, except as allowed by
+ additional terms of your license agreement.
+**/
+#ifndef _PEI_SMM_ACCESS_PPI_H_
+#define _PEI_SMM_ACCESS_PPI_H_
+
+#include EFI_GUID_DEFINITION (SmramMemoryReserve)
+
+#define PEI_SMM_ACCESS_PPI_GUID \
+ { \
+ 0x268f33a9, 0xcccd, 0x48be, 0x88, 0x17, 0x86, 0x5, 0x3a, 0xc3, 0x2e, 0xd6 \
+ }
+
+EFI_FORWARD_DECLARATION (PEI_SMM_ACCESS_PPI);
+
+typedef
+EFI_STATUS
+(EFIAPI *PEI_SMM_OPEN) (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_SMM_ACCESS_PPI * This,
+ IN UINTN DescriptorIndex
+ )
+/**
+ This routine accepts a request to "open" a region of SMRAM. The
+ region could be legacy ABSEG, HSEG, or TSEG near top of physical memory.
+ The use of "open" means that the memory is visible from all PEIM
+ and SMM agents.
+
+ @param[in] This - Pointer to the SMM Access Interface.
+ @param[in] DescriptorIndex - Region of SMRAM to Open.
+
+ @retval EFI_SUCCESS - The region was successfully opened.
+ @retval EFI_DEVICE_ERROR - The region could not be opened because locked by
+ chipset.
+ @retval EFI_INVALID_PARAMETER - The descriptor index was out of bounds.
+**/
+;
+
+typedef
+EFI_STATUS
+(EFIAPI *PEI_SMM_CLOSE) (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_SMM_ACCESS_PPI * This,
+ IN UINTN DescriptorIndex
+ )
+/**
+ This routine accepts a request to "close" a region of SMRAM. The
+ region could be legacy AB or TSEG near top of physical memory.
+ The use of "close" means that the memory is only visible from SMM agents,
+ not from PEIM.
+
+ @param[in] This - Pointer to the SMM Access Interface.
+ @param[in] DescriptorIndex - Region of SMRAM to Close.
+
+ @retval EFI_SUCCESS - The region was successfully closed.
+ @retval EFI_DEVICE_ERROR - The region could not be closed because locked by
+ chipset.
+ @retval EFI_INVALID_PARAMETER - The descriptor index was out of bounds.
+**/
+;
+
+typedef
+EFI_STATUS
+(EFIAPI *PEI_SMM_LOCK) (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_SMM_ACCESS_PPI * This,
+ IN UINTN DescriptorIndex
+ )
+/**
+ This routine accepts a request to "lock" SMRAM. The
+ region could be legacy AB or TSEG near top of physical memory.
+ The use of "lock" means that the memory can no longer be opened
+ to PEIM.
+
+ @param[in] This - Pointer to the SMM Access Interface.
+ @param[in] DescriptorIndex - Region of SMRAM to Lock.
+
+ @retval EFI_SUCCESS - The region was successfully locked.
+ @retval EFI_DEVICE_ERROR - The region could not be locked because at least
+ one range is still open.
+ @retval EFI_INVALID_PARAMETER - The descriptor index was out of bounds.
+**/
+;
+
+typedef
+EFI_STATUS
+(EFIAPI *PEI_SMM_CAPABILITIES) (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_SMM_ACCESS_PPI * This,
+ IN OUT UINTN *SmramMapSize,
+ IN OUT EFI_SMRAM_DESCRIPTOR * SmramMap
+ )
+/**
+ This routine services a user request to discover the SMRAM
+ capabilities of this platform. This will report the possible
+ ranges that are possible for SMRAM access, based upon the
+ memory controller capabilities.
+
+ @param[in] This - Pointer to the SMRAM Access Interface.
+ @param[in] SmramMapSize - Pointer to the variable containing size of the
+ buffer to contain the description information.
+ @param[in] SmramMap - Buffer containing the data describing the Smram
+ region descriptors.
+
+ @retval EFI_BUFFER_TOO_SMALL - The user did not provide a sufficient buffer.
+ @retval EFI_SUCCESS - The user provided a sufficiently-sized buffer.
+**/
+;
+
+struct _PEI_SMM_ACCESS_PPI {
+ PEI_SMM_OPEN Open;
+ PEI_SMM_CLOSE Close;
+ PEI_SMM_LOCK Lock;
+ PEI_SMM_CAPABILITIES GetCapabilities;
+ BOOLEAN LockState;
+ BOOLEAN OpenState;
+};
+
+extern EFI_GUID gPeiSmmAccessPpiGuid;
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/Protocol/IntelSaSampleCodeProtocolLib.inf b/ReferenceCode/Chipset/SystemAgent/SampleCode/Protocol/IntelSaSampleCodeProtocolLib.inf
new file mode 100644
index 0000000..32dd4d1
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/Protocol/IntelSaSampleCodeProtocolLib.inf
@@ -0,0 +1,42 @@
+## @file
+# Component description file for SA SamepleCode protocol library
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = IntelSaSampleCodeProtocolLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ PciEnumerationComplete.h
+
+[includes.common]
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/SampleCode
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+
+[nmake.common]
+C_STD_INCLUDE=
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/Protocol/PciEnumerationComplete.h b/ReferenceCode/Chipset/SystemAgent/SampleCode/Protocol/PciEnumerationComplete.h
new file mode 100644
index 0000000..405c2d5
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/Protocol/PciEnumerationComplete.h
@@ -0,0 +1,30 @@
+/** @file
+ PCI Enumeration Complete Protocol as defined in the PI 1.1 specification.
+ This protocol indicates that pci enumeration complete
+
+@copyright
+ Copyright (c) 2009 - 2012 Intel Corporation. All rights reserved.<BR>
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+@par Revision Reference:
+ This Protocol is defined in UEFI Platform Initialization Specification 1.2
+ Volume 5: Standards
+**/
+
+#ifndef _PCI_ENUMERATION_COMPLETE_H_
+#define _PCI_ENUMERATION_COMPLETE_H_
+
+#define EFI_PCI_ENUMERATION_COMPLETE_GUID \
+ { \
+ 0x30cfe3e7, 0x3de1, 0x4586, { 0xbe, 0x20, 0xde, 0xab, 0xa1, 0xb3, 0xb7, 0x93 } \
+ }
+
+extern EFI_GUID gEfiPciEnumerationCompleteProtocolGuid;
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Dxe/SaDxePolicyInit.c b/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Dxe/SaDxePolicyInit.c
new file mode 100644
index 0000000..f907f4f
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Dxe/SaDxePolicyInit.c
@@ -0,0 +1,247 @@
+/** @file
+ This file is a wrapper for Intel SA Platform Policy driver.
+ Get Setup Value to initilize Intel SA DXE Platform Policy.
+
+@copyright
+ Copyright (c) 1999 - 2014 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+#include "SaDxePolicyInit.h"
+
+DXE_PLATFORM_SA_POLICY_PROTOCOL mDxePlatformSaPolicy;
+
+PCIE_ASPM_DEV_INFO mPcieAspmDevsOverride[] = {
+ ///
+ /// Tekoa w/o iAMT
+ ///
+ {0x8086, 0x108b, 0xff, 2, 2},
+ ///
+ /// Tekoa A2
+ ///
+ {0x8086, 0x108c, 0x00, 0, 0},
+ ///
+ /// Tekoa others
+ ///
+ {0x8086, 0x108c, 0xff, 2, 2},
+ ///
+ /// Vidalia
+ ///
+ {0x8086, 0x109a, 0xff, 2, 2},
+ ///
+ /// 3945ABG
+ ///
+ {0x8086, 0x4222, 0xff, 2, 3},
+ ///
+ /// 3945ABG
+ ///
+ {0x8086, 0x4227, 0xff, 2, 3},
+ ///
+ /// 3945ABG
+ ///
+ {0x8086, 0x4228, 0xff, 2, 3},
+ ///
+ /// End of table
+ ///
+ {SA_PCIE_DEV_END_OF_TABLE, 0, 0, 0, 0}
+};
+
+PCIE_LTR_DEV_INFO mPcieLtrDevsOverride[] = {
+ ///
+ /// Place holder for PCIe devices with correct LTR requirements
+ ///
+ ///
+ /// End of table
+ ///
+ {SA_PCIE_DEV_END_OF_TABLE, 0, 0, 0, 0}
+};
+///
+/// Function implementations
+///
+/**
+ Initilize Intel SA DXE Platform Policy
+
+ @param[in] ImageHandle Image handle of this driver.
+ @param[in] SystemTable Global system service table.
+
+ @retval EFI_SUCCESS Initialization complete.
+ @exception EFI_UNSUPPORTED The chipset is unsupported by this driver.
+ @retval EFI_OUT_OF_RESOURCES Do not have enough resources to initialize the driver.
+ @retval EFI_DEVICE_ERROR Device error, driver exits abnormally.
+**/
+EFI_STATUS
+EFIAPI
+SaDxePolicyInitEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ UINT8 pegFn;
+ UINT8 Index;
+
+ SetMem (&mDxePlatformSaPolicy, sizeof (DXE_PLATFORM_SA_POLICY_PROTOCOL), 0);
+ Status = (gBS->AllocatePool) (EfiBootServicesData, sizeof (SA_VTD_CONFIGURATION), &(mDxePlatformSaPolicy.Vtd));
+ ASSERT_EFI_ERROR (Status);
+ Status = (gBS->AllocatePool) (EfiBootServicesData, sizeof (SA_MEMORY_CONFIGURATION), &(mDxePlatformSaPolicy.MemoryConfig));
+ ASSERT_EFI_ERROR (Status);
+ Status = (gBS->AllocatePool) (EfiBootServicesData, sizeof (SA_PCIE_CONFIGURATION), &(mDxePlatformSaPolicy.PcieConfig));
+ ASSERT_EFI_ERROR (Status);
+ Status = (gBS->AllocatePool) (EfiBootServicesData, sizeof (SA_IGD_CONFIGURATION), &(mDxePlatformSaPolicy.IgdConfig));
+ ASSERT_EFI_ERROR (Status);
+ Status = (gBS->AllocatePool) (EfiBootServicesData, sizeof (SA_MISC_CONFIGURATION), &(mDxePlatformSaPolicy.MiscConfig));
+ ASSERT_EFI_ERROR (Status);
+#ifdef SG_SUPPORT
+ Status = (gBS->AllocatePool) (EfiBootServicesData, sizeof (SA_SG_VBIOS_CONFIGURATION), &(mDxePlatformSaPolicy.VbiosConfig));
+ ASSERT_EFI_ERROR (Status);
+#endif
+
+ ///
+ /// SA DXE Policy Init
+ ///
+ mDxePlatformSaPolicy.Revision = DXE_SA_PLATFORM_POLICY_PROTOCOL_REVISION_8;
+
+ ///
+ /// Initialize the VTD Configuration
+ ///
+ mDxePlatformSaPolicy.Vtd->VtdEnable = 0;
+ mDxePlatformSaPolicy.Vtd->BaseAddress[0] = 0xFED90000;
+ mDxePlatformSaPolicy.Vtd->BaseAddress[1] = 0xFED91000;
+ ///
+ /// RMRR Base and Limit Address for USB
+ ///
+ Status = (gBS->AllocatePool) (EfiBootServicesData, (sizeof (EFI_PHYSICAL_ADDRESS) * 2), (VOID **) &mDxePlatformSaPolicy.Vtd->RmrrUsbBaseAddress);
+ ASSERT_EFI_ERROR (Status);
+ ///
+ /// BIOS must update USB RMRR base address
+ ///
+ mDxePlatformSaPolicy.Vtd->RmrrUsbBaseAddress[0] = 0x3E2E0000;
+ mDxePlatformSaPolicy.Vtd->RmrrUsbBaseAddress[1] = 0x3E2FFFFF;
+
+ ///
+ /// Initialize the PCIE Configuration
+ ///
+ mDxePlatformSaPolicy.PcieConfig->DmiAspm = PcieAspmL0sL1;
+ ///
+ /// PEG ASPM per port configuration. 3 PEG controllers i.e. 0,1,2
+ ///
+ for (pegFn = 0; pegFn < 3; pegFn++) {
+ mDxePlatformSaPolicy.PcieConfig->PegAspm[pegFn] = PcieAspmAutoConfig;
+ mDxePlatformSaPolicy.PcieConfig->PegAspmL0s[pegFn] = 0;
+ mDxePlatformSaPolicy.PcieConfig->PegDeEmphasis[pegFn] = 1;
+ }
+
+ mDxePlatformSaPolicy.PcieConfig->DmiExtSync = 0;
+ mDxePlatformSaPolicy.PcieConfig->DmiDeEmphasis = 0;
+ mDxePlatformSaPolicy.PcieConfig->DmiIot = 0;
+ mDxePlatformSaPolicy.PcieConfig->C7Allowed = 0;
+ for (Index = 0; Index < SA_PEG_MAX_FUN; Index++) {
+ mDxePlatformSaPolicy.PcieConfig->PegPwrOpt[Index].LtrEnable = 1;
+ mDxePlatformSaPolicy.PcieConfig->PegPwrOpt[Index].LtrMaxSnoopLatency = V_SA_LTR_MAX_SNOOP_LATENCY_VALUE;
+ mDxePlatformSaPolicy.PcieConfig->PegPwrOpt[Index].LtrMaxNoSnoopLatency = V_SA_LTR_MAX_NON_SNOOP_LATENCY_VALUE;
+ mDxePlatformSaPolicy.PcieConfig->PegPwrOpt[Index].ObffEnable = 1;
+ }
+
+ mDxePlatformSaPolicy.PcieConfig->PcieAspmDevsOverride = mPcieAspmDevsOverride;
+ mDxePlatformSaPolicy.PcieConfig->PcieLtrDevsOverride = mPcieLtrDevsOverride;
+
+ ///
+ /// Initialize the Memory Configuration
+ ///
+ ///
+ /// DIMM SMBus addresses info
+ /// Refer to the SpdAddressTable[] mapping rule in SaPlatformPolicy.h
+ ///
+ Status = (gBS->AllocatePool) (EfiBootServicesData, (sizeof (UINT8) * 4), (VOID **) &mDxePlatformSaPolicy.MemoryConfig->SpdAddressTable);
+ ASSERT_EFI_ERROR (Status);
+
+ mDxePlatformSaPolicy.MemoryConfig->SpdAddressTable[0] = DIMM_SMB_SPD_P0C0D0;
+ mDxePlatformSaPolicy.MemoryConfig->SpdAddressTable[1] = DIMM_SMB_SPD_P0C0D1;
+ mDxePlatformSaPolicy.MemoryConfig->SpdAddressTable[2] = DIMM_SMB_SPD_P0C1D0;
+ mDxePlatformSaPolicy.MemoryConfig->SpdAddressTable[3] = DIMM_SMB_SPD_P0C1D1;
+
+ mDxePlatformSaPolicy.MemoryConfig->ChannelASlotMap = 0x01;
+ mDxePlatformSaPolicy.MemoryConfig->ChannelBSlotMap = 0x01;
+ mDxePlatformSaPolicy.MemoryConfig->RmtBdatEnable = 0x00;
+
+ ///
+ /// Initialize the Graphics configuration
+ ///
+ mDxePlatformSaPolicy.IgdConfig->RenderStandby = 1;
+ mDxePlatformSaPolicy.IgdConfig->VbtAddress = 0x00000000;
+ mDxePlatformSaPolicy.IgdConfig->Size = 0;
+ mDxePlatformSaPolicy.IgdConfig->CdClk = 0;
+ mDxePlatformSaPolicy.IgdConfig->PlatformConfig = 1;
+
+ ///
+ /// SA internal devices and misc configuration
+ ///
+ mDxePlatformSaPolicy.MiscConfig->ChapDeviceEnable = FALSE;
+ mDxePlatformSaPolicy.MiscConfig->Device4Enable = FALSE;
+ mDxePlatformSaPolicy.MiscConfig->CridEnable = FALSE;
+ mDxePlatformSaPolicy.MiscConfig->AudioEnable = TRUE;
+ mDxePlatformSaPolicy.MiscConfig->FviReport = 1;
+ ///
+ /// Default Enable FVI SMBIOS Report
+ ///
+ mDxePlatformSaPolicy.MiscConfig->FviSmbiosType = 0xDD;
+ ///
+ /// Default SMBIOS Type 221
+ ///
+ Status = (gBS->AllocatePool) (EfiBootServicesData, sizeof (SA_DEFAULT_SVID_SID), (VOID **) &mDxePlatformSaPolicy.MiscConfig->DefaultSvidSid);
+ ASSERT_EFI_ERROR (Status);
+ mDxePlatformSaPolicy.MiscConfig->DefaultSvidSid->SubSystemVendorId = V_SA_MC_VID;
+ ///
+ /// 0x8086;
+ ///
+ mDxePlatformSaPolicy.MiscConfig->DefaultSvidSid->SubSystemId = 0x2010;
+
+
+#ifdef SG_SUPPORT
+ ///
+ /// Initialize the Switchable Graphics DXE Policies
+ ///
+
+ ///
+ /// 1 = Load secondary display device VBIOS
+ /// 0 = Do not load
+ ///
+ mDxePlatformSaPolicy.VbiosConfig->LoadVbios = 0;
+ ///
+ /// 1 = Execute the secondary display device VBIOS (only if LoadVbios == 1)
+ /// 0 = Do no execute
+ ///
+ mDxePlatformSaPolicy.VbiosConfig->ExecuteVbios = 0;
+ ///
+ /// 1 = secondary display device VBIOS Source is PCI Card
+ /// 0 = secondary display device VBIOS Source is FW Volume
+ ///
+ mDxePlatformSaPolicy.VbiosConfig->VbiosSource = 1;
+#endif
+
+ UpdateDxeSaPlatformPolicy (&mDxePlatformSaPolicy);
+
+ ///
+ /// Install protocol to to allow access to this Policy.
+ ///
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &ImageHandle,
+ &gDxePlatformSaPolicyGuid,
+ &mDxePlatformSaPolicy,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ return Status;
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Dxe/SaDxePolicyInit.dxs b/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Dxe/SaDxePolicyInit.dxs
new file mode 100644
index 0000000..21fcf4c
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Dxe/SaDxePolicyInit.dxs
@@ -0,0 +1,31 @@
+/** @file
+ Dependency expression source file.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+
+#include "EfiDepex.h"
+#include EFI_PROTOCOL_DEFINITION (PchPlatformPolicy)
+#include EFI_ARCH_PROTOCOL_DEFINITION (Variable)
+
+DEPENDENCY_START
+ DXE_PCH_PLATFORM_POLICY_PROTOCOL_GUID AND
+ EFI_VARIABLE_ARCH_PROTOCOL_GUID
+DEPENDENCY_END
+
+
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Dxe/SaDxePolicyInit.h b/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Dxe/SaDxePolicyInit.h
new file mode 100644
index 0000000..8f87761
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Dxe/SaDxePolicyInit.h
@@ -0,0 +1,59 @@
+/** @file
+ Header file for the SaDxePolicyInit Driver.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _SA_DXE_PLATFORM_POLICY_H_
+#define _SA_DXE_PLATFORM_POLICY_H_
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "EfiScriptLib.h"
+#include EFI_PROTOCOL_PRODUCER (SaPlatformPolicy)
+#endif
+
+#include "SaAccess.h"
+#include "SaPlatformPolicyUpdateDxeLib.h"
+
+///
+/// DIMM SMBus addresses
+///
+#define DIMM_SMB_SPD_P0C0D0 0xA0
+#define DIMM_SMB_SPD_P0C0D1 0xA2
+#define DIMM_SMB_SPD_P0C1D0 0xA4
+#define DIMM_SMB_SPD_P0C1D1 0xA6
+#define DIMM_SMB_SPD_P0C0D2 0xA8
+#define DIMM_SMB_SPD_P0C1D2 0xAA
+
+/**
+ Initilize Intel SA DXE Platform Policy
+
+ @param[in] ImageHandle - Image handle of this driver.
+ @param[in] SystemTable - Global system service table.
+
+ @retval EFI_SUCCESS Initialization complete.
+ @exception EFI_UNSUPPORTED The chipset is unsupported by this driver.
+ @retval EFI_OUT_OF_RESOURCES Do not have enough resources to initialize the driver.
+ @retval EFI_DEVICE_ERROR Device error, driver exits abnormally.
+**/
+EFI_STATUS
+SaDxePolicyInitEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN OUT EFI_SYSTEM_TABLE *SystemTable
+ )
+;
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Dxe/SaDxePolicyInit.inf b/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Dxe/SaDxePolicyInit.inf
new file mode 100644
index 0000000..8ee2520
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Dxe/SaDxePolicyInit.inf
@@ -0,0 +1,84 @@
+## @file
+# Component description file for the SaDxePolicyInit DXE driver.
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+
+[defines]
+BASE_NAME = SaDxePolicyInit
+FILE_GUID = 67a54a24-3f4f-4048-8787-3e5aa2a0b7d2
+COMPONENT_TYPE = BS_DRIVER
+
+[sources.common]
+ SaDxePolicyInit.c
+ SaDxePolicyInit.h
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueDxeDriverEntryPoint.c
+
+[includes.common]
+ .
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include/Pcd
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Cpu/Pentium/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Include
+ $(PLATFORM_ECP_PACKAGE)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+
+[libraries.common]
+ EdkGuidLib
+ EdkFrameworkGuidLib
+ EdkFrameworkProtocolLib
+ EdkProtocolLib
+ EfiGuidLib
+ EfiCommonLib
+ $(PROJECT_SA_FAMILY)ProtocolLib
+ EdkIIGlueBaseLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueBasePciLibPciExpress
+ EdkIIGlueDxeReportStatusCodeLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueDxeServicesTableLib
+ PlatformPolicyUpdateDxeLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT= _ModuleEntryPoint
+ DPX_SOURCE=SaDxePolicyInit.dxs
+ C_FLAGS = $(C_FLAGS) -D"__EDKII_GLUE_MODULE_ENTRY_POINT__=SaDxePolicyInitEntryPoint" \
+ -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_BASE_LIB__ \
+ -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__\
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_LIB__
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Pei/SaPeiPolicyInit.c b/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Pei/SaPeiPolicyInit.c
new file mode 100644
index 0000000..7317fb4
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Pei/SaPeiPolicyInit.c
@@ -0,0 +1,548 @@
+/** @file
+ This file is SampleCode for Intel SA PEI Platform Policy initialzation.
+
+@copyright
+ Copyright (c) 1999 - 2014 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+#include "SaPeiPolicyInit.h"
+
+///
+/// This IO Trap address can be overridden by defining it
+/// in compiling environment variable
+/// It must not conflict with other IO address in platform
+///
+#ifndef SA_IOTRAP_SMI_ADDRESS
+#define SA_IOTRAP_SMI_ADDRESS 0x2000
+#endif
+
+EFI_STATUS
+SaPeiPolicyInitEntryPoint (
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+/**
+ This PEIM performs SA PEI Platform Policy initialzation.
+
+ @param[in] FfsHeader - Pointer to Firmware File System file header.
+ @param[in] PeiServices - General purpose services available to every PEIM.
+
+ @retval EFI_SUCCESS - The PPI is installed and initialized.
+ @retval EFI ERRORS - The PPI is not successfully installed.
+**/
+{
+ EFI_STATUS Status;
+ EFI_PEI_PPI_DESCRIPTOR *SaPlatformPolicyPpiDesc;
+ SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi;
+ SA_PLATFORM_DATA *PlatformData;
+ GT_CONFIGURATION *GtConfig;
+ MEMORY_CONFIGURATION *MemConfig;
+ PCIE_CONFIGURATION *PcieConfig;
+ OVERCLOCKING_CONFIGURATION *OcConfig;
+ PEG_GPIO_DATA *PegGpioData;
+ CPU_FAMILY CpuFamilyId;
+#ifdef SG_SUPPORT
+ SG_GPIO_DATA *SgGpioData;
+#endif
+ UINT8 Index;
+ ///
+ /// Allocate descriptor and PPI structures
+ ///
+ SaPlatformPolicyPpi = (SA_PLATFORM_POLICY_PPI *) AllocatePool (sizeof (SA_PLATFORM_POLICY_PPI));
+ ASSERT (SaPlatformPolicyPpi != NULL);
+ EfiCommonLibZeroMem (SaPlatformPolicyPpi, sizeof (SA_PLATFORM_POLICY_PPI));
+
+ SaPlatformPolicyPpiDesc = (EFI_PEI_PPI_DESCRIPTOR *) AllocatePool (sizeof (EFI_PEI_PPI_DESCRIPTOR));
+ ASSERT (SaPlatformPolicyPpiDesc != NULL);
+ EfiCommonLibZeroMem (SaPlatformPolicyPpiDesc, sizeof (EFI_PEI_PPI_DESCRIPTOR));
+
+ PlatformData = (SA_PLATFORM_DATA *) AllocatePool (sizeof (SA_PLATFORM_DATA));
+ ASSERT (PlatformData != NULL);
+ EfiCommonLibZeroMem (PlatformData, sizeof (SA_PLATFORM_DATA));
+
+ GtConfig = (GT_CONFIGURATION *) AllocatePool (sizeof (GT_CONFIGURATION));
+ ASSERT (GtConfig != NULL);
+ EfiCommonLibZeroMem (GtConfig, sizeof (GT_CONFIGURATION));
+
+ MemConfig = (MEMORY_CONFIGURATION *) AllocatePool (sizeof (MEMORY_CONFIGURATION));
+ ASSERT (MemConfig != NULL);
+ EfiCommonLibZeroMem (MemConfig, sizeof (MEMORY_CONFIGURATION));
+
+ PcieConfig = (PCIE_CONFIGURATION *) AllocatePool (sizeof (PCIE_CONFIGURATION));
+ ASSERT (PcieConfig != NULL);
+ EfiCommonLibZeroMem (PcieConfig, sizeof (PCIE_CONFIGURATION));
+
+ PegGpioData = (PEG_GPIO_DATA *) AllocatePool (sizeof (PEG_GPIO_DATA));
+ ASSERT (PegGpioData != NULL);
+ EfiCommonLibZeroMem (PegGpioData, sizeof (PEG_GPIO_DATA));
+
+ OcConfig = (OVERCLOCKING_CONFIGURATION *) AllocatePool (sizeof (OVERCLOCKING_CONFIGURATION));
+ ASSERT (OcConfig != NULL);
+ EfiCommonLibZeroMem (OcConfig, sizeof (OVERCLOCKING_CONFIGURATION));
+
+#ifdef SG_SUPPORT
+ SgGpioData = (SG_GPIO_DATA *) AllocatePool (sizeof (SG_GPIO_DATA));
+ ASSERT (SgGpioData != NULL);
+ EfiCommonLibZeroMem (SgGpioData, sizeof (SG_GPIO_DATA));
+#endif
+
+ SetMem ((VOID *) SaPlatformPolicyPpi, sizeof (SA_PLATFORM_POLICY_PPI), 0);
+
+ ///
+ /// Initialize the PPI
+ ///
+ SaPlatformPolicyPpiDesc->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;
+ SaPlatformPolicyPpiDesc->Guid = &gSaPlatformPolicyPpiGuid;
+ SaPlatformPolicyPpiDesc->Ppi = SaPlatformPolicyPpi;
+
+ ///
+ /// Update the REVISION number
+ ///
+ SaPlatformPolicyPpi->Revision = SA_PLATFORM_POLICY_PPI_REVISION_15;
+
+ CpuFamilyId = GetCpuFamily();
+
+ ///
+ /// Initialize the Platform Configuration
+ ///
+ PlatformData->SpdAddressTable[0] = 0xA0;
+ PlatformData->SpdAddressTable[1] = 0xA2;
+ PlatformData->SpdAddressTable[2] = 0xA4;
+ PlatformData->SpdAddressTable[3] = 0xA6;
+ PlatformData->MchBar = 0xfed10000;
+ PlatformData->DmiBar = 0xfed18000;
+ PlatformData->EpBar = 0xfed19000;
+ PlatformData->EdramBar = 0xfed80000;
+ PlatformData->PciExpressBar = (UINTN) PcdGet64 (PcdPciExpressBaseAddress);
+ PlatformData->SmbusBar = 0xEFA0;
+ PlatformData->TsegSize = 0x800000;
+ PlatformData->IedSize = 0x400000;
+ PlatformData->FastBoot = 0;
+ PlatformData->GdxcBar = 0xFED84000;
+ PlatformData->BoardId = 0;
+
+ SaPlatformPolicyPpi->PlatformData = PlatformData;
+ ///
+ /// Initialize the Graphics configuration
+ ///
+ GtConfig->GttSize = 2;
+ GtConfig->IgdDvmt50PreAlloc = 1;
+ GtConfig->InternalGraphics = 2;
+ GtConfig->PrimaryDisplay = 3;
+ GtConfig->ApertureSize = 2;
+ GtConfig->PanelPowerEnable = 0;
+ SaPlatformPolicyPpi->GtConfig = GtConfig;
+
+ ///
+ /// Initialize the Memory Configuration
+ ///
+ MemConfig->EccSupport = 1;
+ MemConfig->DdrFreqLimit = 0;
+ MemConfig->MaxTolud = 0;
+ MemConfig->SpdProfileSelected = 0;
+ MemConfig->NModeSupport = 0;
+ MemConfig->ScramblerSupport = 1;
+ MemConfig->PowerDownMode = 0xFF;
+ MemConfig->PwdwnIdleCounter = 0x80;
+ MemConfig->RankInterleave = TRUE;
+ MemConfig->EnhancedInterleave = TRUE;
+ MemConfig->WeaklockEn = TRUE;
+ MemConfig->EnCmdRate = 7;
+ MemConfig->CmdTriStateDis = FALSE;
+ MemConfig->RefreshRate2x = FALSE;
+ MemConfig->AutoSelfRefreshSupport = TRUE;
+ MemConfig->ExtTemperatureSupport = TRUE;
+
+ ///
+ /// Thermal Management Configuration
+ ///
+ MemConfig->ThermalManagement = 1;
+ MemConfig->PeciInjectedTemp = 0;
+ MemConfig->ExttsViaTsOnBoard = 0;
+ MemConfig->ExttsViaTsOnDimm = 0;
+ MemConfig->VirtualTempSensor = 0;
+ ///
+ /// Channel DIMM Disable
+ ///
+ MemConfig->DisableDimmChannel[0] = 0;
+ MemConfig->DisableDimmChannel[1] = 0;
+ ///
+ /// Channel Hash Configuration
+ ///
+ MemConfig->ChHashEnable = TRUE;
+ MemConfig->ChHashMask = 0x30CE;
+ MemConfig->ChHashInterleaveBit = 1;
+ ///
+ /// Options for Thermal settings
+ ///
+ MemConfig->EnableExtts = 0;
+ MemConfig->EnableCltm = 0;
+ MemConfig->EnableOltm = 0;
+ MemConfig->EnablePwrDn = 1;
+ if (CpuFamilyId == EnumCpuHswUlt) {
+ MemConfig->EnablePwrDnLpddr = 0;
+ }
+ MemConfig->Refresh2X = 0;
+ MemConfig->LpddrThermalSensor = 1;
+ MemConfig->LockPTMregs = 0;
+ MemConfig->UserPowerWeightsEn = 0;
+
+ MemConfig->EnergyScaleFact = 3;
+ MemConfig->RaplPwrFlCh1 = 0;
+ MemConfig->RaplPwrFlCh0 = 0;
+
+ MemConfig->RaplLim2Lock = 0;
+ MemConfig->RaplLim2WindX = 0;
+ MemConfig->RaplLim2WindY = 0;
+ MemConfig->RaplLim2Ena = 0;
+ MemConfig->RaplLim2Pwr = 0;
+ MemConfig->RaplLim1WindX = 0;
+ MemConfig->RaplLim1WindY = 0;
+ MemConfig->RaplLim1Ena = 0;
+ MemConfig->RaplLim1Pwr = 0;
+
+ MemConfig->WarmThresholdCh0Dimm0 = 0xFF;
+ MemConfig->WarmThresholdCh0Dimm1 = 0xFF;
+ MemConfig->WarmThresholdCh1Dimm0 = 0xFF;
+ MemConfig->WarmThresholdCh1Dimm1 = 0xFF;
+ MemConfig->HotThresholdCh0Dimm0 = 0xFF;
+ MemConfig->HotThresholdCh0Dimm1 = 0xFF;
+ MemConfig->HotThresholdCh1Dimm0 = 0xFF;
+ MemConfig->HotThresholdCh1Dimm1 = 0xFF;
+ MemConfig->WarmBudgetCh0Dimm0 = 0xFF;
+ MemConfig->WarmBudgetCh0Dimm1 = 0xFF;
+ MemConfig->WarmBudgetCh1Dimm0 = 0xFF;
+ MemConfig->WarmBudgetCh1Dimm1 = 0xFF;
+ MemConfig->HotBudgetCh0Dimm0 = 0xFF;
+ MemConfig->HotBudgetCh0Dimm1 = 0xFF;
+ MemConfig->HotBudgetCh1Dimm0 = 0xFF;
+ MemConfig->HotBudgetCh1Dimm1 = 0xFF;
+
+ MemConfig->IdleEnergyCh0Dimm1 = 0;
+ MemConfig->IdleEnergyCh0Dimm0 = 0;
+ MemConfig->PdEnergyCh0Dimm1 = 0;
+ MemConfig->PdEnergyCh0Dimm0 = 0;
+ MemConfig->ActEnergyCh0Dimm1 = 0;
+ MemConfig->ActEnergyCh0Dimm0 = 0;
+ MemConfig->RdEnergyCh0Dimm1 = 0;
+ MemConfig->RdEnergyCh0Dimm0 = 0;
+ MemConfig->WrEnergyCh0Dimm1 = 0;
+ MemConfig->WrEnergyCh0Dimm0 = 0;
+
+ MemConfig->IdleEnergyCh1Dimm1 = 0;
+ MemConfig->IdleEnergyCh1Dimm0 = 0;
+ MemConfig->PdEnergyCh1Dimm1 = 0;
+ MemConfig->PdEnergyCh1Dimm0 = 0;
+ MemConfig->ActEnergyCh1Dimm1 = 0;
+ MemConfig->ActEnergyCh1Dimm0 = 0;
+ MemConfig->RdEnergyCh1Dimm1 = 0;
+ MemConfig->RdEnergyCh1Dimm0 = 0;
+ MemConfig->WrEnergyCh1Dimm1 = 0;
+ MemConfig->WrEnergyCh1Dimm0 = 0;
+
+ MemConfig->SrefCfgEna = 1;
+ MemConfig->SrefCfgIdleTmr = 0x200;
+ MemConfig->ThrtCkeMinDefeat = 0;
+ MemConfig->ThrtCkeMinTmr = 0x30;
+ if (CpuFamilyId == EnumCpuHswUlt) {
+ MemConfig->ThrtCkeMinDefeatLpddr = 1;
+ MemConfig->ThrtCkeMinTmrLpddr = 0x40;
+ }
+
+
+ MemConfig->McLock = TRUE;
+
+ MemConfig->GdxcEnable = TRUE;
+ MemConfig->GdxcIotSize = 4;
+ MemConfig->GdxcMotSize = 12;
+
+ MemConfig->MemoryTrace = 0;
+
+ MemConfig->ECT = 0;
+ MemConfig->SOT = 1;
+ MemConfig->RDMPRT = 1;
+ MemConfig->RCVET = 1;
+ MemConfig->JWRL = 1;
+ MemConfig->FWRL = 0;
+ MemConfig->WRTC1D = 1;
+ MemConfig->RDTC1D = 1;
+ MemConfig->DIMMODTT = 1;
+ MemConfig->WRDST = 0;
+ MemConfig->WREQT = 1;
+ MemConfig->RDODTT = 1;
+ MemConfig->RDEQT = 0;
+ MemConfig->RDAPT = 1;
+ MemConfig->WRTC2D = 1;
+ MemConfig->RDTC2D = 1;
+ MemConfig->CMDVC = 1;
+ MemConfig->WRVC2D = 1;
+ MemConfig->RDVC2D = 1;
+ MemConfig->LCT = 1;
+ MemConfig->RTL = 1;
+ MemConfig->TAT = 1;
+ MemConfig->RMT = 0;
+ MemConfig->MEMTST = 0;
+ MemConfig->DIMMODTT1D = 0;
+ MemConfig->WRSRT = 0;
+ MemConfig->DIMMRONT = 1;
+ MemConfig->ALIASCHK = 1;
+ MemConfig->RCVENC1D = 1;
+ MemConfig->RMC = 1;
+
+ MemConfig->RemapEnable = TRUE;
+ MemConfig->RmtBdatEnable = FALSE;
+ MemConfig->MrcTimeMeasure = FALSE;
+ MemConfig->MrcFastBoot = TRUE;
+ MemConfig->DDR3Voltage = 0;
+ MemConfig->DDR3VoltageWaitTime = 0;
+ MemConfig->RefClk = 0;
+ MemConfig->Ratio = 0;
+ MemConfig->BClkFrequency = 100 * 1000 * 1000;
+ MemConfig->MaxRttWr = 0;
+ ///
+ /// MrcUltPoSafeConfig
+ /// 1 to enable, 0 to disable
+ ///
+ MemConfig->MrcUltPoSafeConfig = 0;
+
+ if (CpuFamilyId == EnumCpuHswUlt) {
+ ///
+ /// Interleaving mode of DQ/DQS pins - depends on board routing
+ ///
+ MemConfig->DqPinsInterleaved = FALSE;
+ }
+
+ SaPlatformPolicyPpi->MemConfig = MemConfig;
+
+ ///
+ /// Initialize the PciExpress Configuration
+ ///
+ PcieConfig->DmiVc1 = 0;
+ PcieConfig->DmiVcp = 1;
+ PcieConfig->DmiVcm = 1;
+ PcieConfig->DmiGen2 = 1;
+ PcieConfig->AlwaysEnablePeg = 0;
+ for (Index = 0; Index < SA_PEG_MAX_FUN; Index++) {
+ PcieConfig->PegGenx[Index] = 0;
+ }
+
+ for (Index = 0; Index < SA_PEG_MAX_FUN; Index++) {
+ PcieConfig->PowerDownUnusedBundles[Index] = 0xFF;
+ }
+
+ PcieConfig->PegGen3Equalization = 1;
+ PcieConfig->PegSamplerCalibrate = 0;
+ PcieConfig->PegSwingControl = 2;
+ PcieConfig->PegComplianceTestingMode = 0;
+
+ ///
+ /// PEG Gen3 Preset Search: 0 = Disabled, 1 = Enabled (default)
+ /// PEG Gen3 Force Preset Search (always re-search): 0 = Disabled (default), 1 = Enabled
+ /// PEG Gen3 Preset Search Dwell Time: 400 usec
+ /// PEG Gen3 Preset Search Timing Margin Steps: 2
+ /// PEG Gen3 Preset Search Timing Start Margin: 15
+ /// PEG Gen3 Preset Search Voltage Margin Steps: 2
+ /// PEG Gen3 Preset Search Voltage Start Margin: 20
+ /// PEG Gen3 Preset Search Favor Timing: 0 = Timing + Voltage (default), 1 = Timing only
+ /// PEG Gen3 Preset Search Error Target: 4
+ ///
+ PcieConfig->PegGen3PresetSearch = 1;
+ PcieConfig->PegGen3ForcePresetSearch = 0;
+ PcieConfig->PegGen3PresetSearchDwellTime = STALL_ONE_MILLI_SECOND;
+ PcieConfig->PegGen3PresetSearchStartMargin = 15;
+ PcieConfig->PegGen3PresetSearchVoltageStartMargin = 20;
+ PcieConfig->PegGen3PresetSearchErrorTarget = 1;
+
+ for (Index = 0; Index < SA_PEG_MAX_LANE; Index++) {
+ PcieConfig->Gen3RootPortPreset[Index] = 8;
+ PcieConfig->Gen3EndPointPreset[Index] = 7;
+ PcieConfig->Gen3EndPointHint[Index] = 2;
+ }
+
+ ///
+ /// Parameters for PCIe ASPM flow control
+ /// InitPcieAspmAfterOprom:
+ /// 0 (default) - PCIe ASPM will be initialized Before Oprom
+ /// 1 - PCIe ASPM will be initialized After Oprom (required IOTRAP SMI handler)
+ /// Note: This setting should match supported mode!
+ ///
+ /// SaIotrapSmiAddress:
+ /// IOTRAP SMI address for SA SMI callback handler. This should be given if platform supports InitPcieAspmAfterOprom = 1 scenario (SaLateInitSmm driver was compiled)
+ ///
+ PcieConfig->InitPcieAspmAfterOprom = FALSE;
+ PcieConfig->SaIotrapSmiAddress = SA_IOTRAP_SMI_ADDRESS;
+
+ ///
+ /// Parameters for PCIe Gen3 device reset
+ /// Note: Refer to the Platform Design Guide (PDG) for additional information about this GPIO.
+ ///
+ PegGpioData->GpioSupport = TRUE;
+ if (PegGpioData->GpioSupport) {
+ PegGpioData->SaPegReset = (SA_GPIO_INFO *) AllocatePool (sizeof (SA_GPIO_INFO));
+ ASSERT (PegGpioData->SaPegReset != NULL);
+ if (PegGpioData->SaPegReset == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ ///
+ /// PEG Reset: GPIO 50, Active Low (Mobile PDG)
+ ///
+ PegGpioData->SaPegReset->Value = 50;
+ PegGpioData->SaPegReset->Active = 0;
+ PcieConfig->PegGpioData = PegGpioData;
+ }
+
+ ///
+ /// Enable/Disable RxCEM Loop back
+ /// 1=Enable, 0=Disable (default)
+ /// When enabled, Lane for loop back should be selected (0 ~ 15 and default is Lane 0)
+ ///
+ PcieConfig->RxCEMLoopback = 0;
+ PcieConfig->RxCEMLoopbackLane = 0;
+
+ ///
+ /// Gen3 RxCTLE peaking default is 8
+ ///
+ for (Index = 0; Index < SA_PEG_MAX_BUNDLE; Index++) {
+ PcieConfig->Gen3RxCtleP[Index] = 8;
+ }
+
+ ///
+ /// Initialize the SA PEG Data pointer for saved preset search results
+ ///
+ PcieConfig->PegDataPtr = NULL;
+
+ SaPlatformPolicyPpi->PcieConfig = PcieConfig;
+
+ ///
+ /// Initialize the Overclocking Configuration
+ ///
+ OcConfig->GtVoltageOffset = 0;
+ OcConfig->GtVoltageOverride = 0;
+ OcConfig->GtExtraTurboVoltage = 0;
+ OcConfig->GtMaxOcTurboRatio = 0;
+ OcConfig->SaVoltageOffset = 0;
+ OcConfig->GtVoltageMode = 0;
+ OcConfig->OcSupport = 0;
+ OcConfig->IoaVoltageOffset = 0;
+ OcConfig->IodVoltageOffset = 0;
+
+ SaPlatformPolicyPpi->OcConfig = OcConfig;
+
+
+#ifdef SG_SUPPORT
+ ///
+ /// Initialize the Switchable Graphics Configuration
+ ///
+ ///
+ /// Switchable Graphics mode set as MUXLESS (By default)
+ ///
+ PlatformData->SgMode = SgModeMuxless;
+ PlatformData->SgSubSystemId = 0x2112;
+
+ SaPlatformPolicyPpi->PlatformData = PlatformData;
+
+ ///
+ /// Configure below based on the OEM platfrom design
+ /// Switchable Graphics GPIO support - 1=Supported, 0=Not Supported
+ ///
+ SgGpioData->GpioSupport = TRUE;
+
+ if (SgGpioData->GpioSupport) {
+ ///
+ /// Initialzie the GPIO Configuration
+ ///
+ ///
+ /// dGPU PWROK GPIO assigned
+ ///
+ SgGpioData->SgDgpuPwrOK = (SA_GPIO_INFO *) AllocatePool (sizeof (SA_GPIO_INFO));
+ ASSERT (SgGpioData->SgDgpuPwrOK != NULL);
+ if (SgGpioData->SgDgpuPwrOK == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ SgGpioData->SgDgpuPwrOK->Value = 17;
+ ///
+ /// dGPU PWROK Active High
+ ///
+ SgGpioData->SgDgpuPwrOK->Active = 1;
+
+ ///
+ /// dGPU HLD RST GPIO assigned
+ ///
+ SgGpioData->SgDgpuHoldRst = (SA_GPIO_INFO *) AllocatePool (sizeof (SA_GPIO_INFO));
+ ASSERT (SgGpioData->SgDgpuHoldRst != NULL);
+ if (SgGpioData->SgDgpuHoldRst == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ SgGpioData->SgDgpuHoldRst->Value = 50;
+ ///
+ /// dGPU HLD RST Active Low
+ ///
+ SgGpioData->SgDgpuHoldRst->Active = 0;
+
+ if (CpuFamilyId == EnumCpuHswUlt) {
+ SgGpioData->SgDgpuHoldRst->Value = 48;
+ }
+
+ ///
+ /// dGPU PWR Enable GPIO assigned
+ ///
+ SgGpioData->SgDgpuPwrEnable = (SA_GPIO_INFO *) AllocatePool (sizeof (SA_GPIO_INFO));
+ ASSERT (SgGpioData->SgDgpuPwrEnable != NULL);
+ if (SgGpioData->SgDgpuPwrEnable == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ SgGpioData->SgDgpuPwrEnable->Value = 54;
+ ///
+ /// dGPU PWR Enable Active Low
+ ///
+ SgGpioData->SgDgpuPwrEnable->Active = 0;
+
+ if (CpuFamilyId == EnumCpuHswUlt) {
+ SgGpioData->SgDgpuPwrEnable->Value = 84;
+ }
+
+ ///
+ /// dGPU_PRSNT# GPIO assigned
+ ///
+ SgGpioData->SgDgpuPrsnt = (SA_GPIO_INFO *) AllocatePool (sizeof (SA_GPIO_INFO));
+ ASSERT (SgGpioData->SgDgpuPrsnt != NULL);
+ if (SgGpioData->SgDgpuPrsnt == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ SgGpioData->SgDgpuPrsnt->Value = 67;
+ ///
+ /// dGPU_PRSNT# Active Low
+ ///
+ SgGpioData->SgDgpuPrsnt->Active = 0;
+
+ SaPlatformPolicyPpi->SgGpioData = SgGpioData;
+ }
+#endif
+
+ ///
+ /// Initialize the DataPtr for S3 resume
+ ///
+ SaPlatformPolicyPpi->S3DataPtr = NULL;
+
+ UpdatePeiSaPlatformPolicy (PeiServices, SaPlatformPolicyPpi);
+
+ ///
+ /// Install SA Platform Policy PPI
+ ///
+ Status = (**PeiServices).InstallPpi (PeiServices, SaPlatformPolicyPpiDesc);
+ ASSERT_EFI_ERROR (Status);
+
+ return Status;
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Pei/SaPeiPolicyInit.dxs b/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Pei/SaPeiPolicyInit.dxs
new file mode 100644
index 0000000..b3b2c70
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Pei/SaPeiPolicyInit.dxs
@@ -0,0 +1,42 @@
+/** @file
+ Dependency expression source file.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "PeimDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+#include EFI_PPI_DEPENDENCY (Variable)
+#endif
+
+
+DEPENDENCY_START
+
+ PEI_READ_ONLY_VARIABLE_ACCESS_PPI_GUID
+DEPENDENCY_END
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Pei/SaPeiPolicyInit.h b/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Pei/SaPeiPolicyInit.h
new file mode 100644
index 0000000..2cfb8e3
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Pei/SaPeiPolicyInit.h
@@ -0,0 +1,57 @@
+/** @file
+ Header file for the SaPeiPolicyInit PEIM.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _SA_PEI_PLATFORM_POLICY_H_
+#define _SA_PEI_PLATFORM_POLICY_H_
+
+///
+/// External include files do NOT need to be explicitly specified in real EDKII
+/// environment
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#include "SaAccess.h"
+#include "MrcApi.h"
+#include "CpuRegs.h"
+#include "CpuPlatformLib.h"
+
+#include EFI_PPI_PRODUCER (SaPlatformPolicy)
+#include EFI_GUID_DEFINITION (SaDataHob)
+#endif
+
+#include "SaPlatformPolicyUpdatePeiLib.h"
+
+///
+/// Functions
+///
+/**
+ This PEIM performs SA PEI Platform Policy initialzation.
+
+ @param[in] FfsHeader - Pointer to Firmware File System file header.
+ @param[in] PeiServices - General purpose services available to every PEIM.
+
+ @retval EFI_SUCCESS - The PPI is installed and initialized.
+ @retval EFI ERRORS - The PPI is not successfully installed.
+**/
+EFI_STATUS
+SaPeiPolicyInitEntryPoint (
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+;
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Pei/SaPeiPolicyInit.inf b/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Pei/SaPeiPolicyInit.inf
new file mode 100644
index 0000000..175d1ba
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Pei/SaPeiPolicyInit.inf
@@ -0,0 +1,95 @@
+## @file
+# Component description file for the SaPeiPolicyInit PEIM.
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = SaPeiPolicyInit
+FILE_GUID = FD236AE7-0791-48c4-B29E-29BDEEE1A822
+COMPONENT_TYPE = PE32_PEIM
+
+[sources.common]
+ SaPeiPolicyInit.h
+ SaPeiPolicyInit.c
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGluePeimEntryPoint.c
+
+
+[includes.common]
+ .
+ ../Common
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Include
+
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Pei/Include
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include/Pcd
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/$(PROJECT_SA_MRC)/Pei/Source/Api
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/$(PROJECT_SA_MRC)/Pei/Source/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/$(PROJECT_SA_MRC)/Pei/Source/Include/MrcRegisters
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include/Library
+ $(PLATFORM_ECP_PACKAGE)/Include
+
+[libraries.common]
+ $(PROJECT_PCH_FAMILY)PpiLib
+ EdkFrameworkPpiLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueBaseMemoryLib
+ EdkIIGluePeiDebugLibReportStatusCode
+ EdkIIGluePeiReportStatusCodeLib
+ EdkIIGluePeiServicesLib
+ EdkIIGluePeiMemoryAllocationLib
+ EdkIIGlueBasePciExpressLib
+ PeiLib
+ $(PROJECT_SA_FAMILY)PpiLib
+ PlatformPolicyUpdatePeiLib
+ CpuPlatformLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = SaPeiPolicyInit.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=SaPeiPolicyInitEntryPoint
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_PEI_SERVICES_LIB__ \
+ -D __EDKII_GLUE_PEI_MEMORY_ALLOCATION_LIB__ \
+ -D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \ No newline at end of file
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/SaSampleCode.cif b/ReferenceCode/Chipset/SystemAgent/SampleCode/SaSampleCode.cif
new file mode 100644
index 0000000..ddaedbc
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/SaSampleCode.cif
@@ -0,0 +1,22 @@
+<component>
+ name = "SaSampleCode"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\SystemAgent\SampleCode"
+ RefName = "SaSampleCode"
+[files]
+"Include\AcpiBuild.dsc"
+"Protocol\IntelSaSampleCodeProtocolLib.inf"
+"Protocol\PciEnumerationComplete.h"
+"Tools\GenAcpiTable.exe"
+"Include\Cpu.h"
+"SaPolicyInit\Dxe\SaDxePolicyInit.c"
+"SaPolicyInit\Dxe\SaDxePolicyInit.h"
+"SaPolicyInit\Pei\SaPeiPolicyInit.c"
+"SaPolicyInit\Pei\SaPeiPolicyInit.h"
+"SaPolicyInit\Dxe\SaDxePolicyInit.inf"
+"SaPolicyInit\Dxe\SaDxePolicyInit.dxs"
+"SaPolicyInit\Pei\SaPeiPolicyInit.dxs"
+"SaPolicyInit\Pei\SaPeiPolicyInit.inf"
+[parts]
+"IntelSaSampleCodePpiLib"
+<endComponent>
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/Tools/GenAcpiTable.exe b/ReferenceCode/Chipset/SystemAgent/SampleCode/Tools/GenAcpiTable.exe
new file mode 100644
index 0000000..5aad32c
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/Tools/GenAcpiTable.exe
Binary files differ
diff --git a/ReferenceCode/Chipset/SystemAgent/SmbiosMemory/Dxe/SmBiosMemory.cif b/ReferenceCode/Chipset/SystemAgent/SmbiosMemory/Dxe/SmBiosMemory.cif
new file mode 100644
index 0000000..e3a1e70
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SmbiosMemory/Dxe/SmBiosMemory.cif
@@ -0,0 +1,14 @@
+<component>
+ name = "SmBiosMemory"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\SystemAgent\SmbiosMemory\Dxe\"
+ RefName = "SmBiosMemory"
+[files]
+"SmBiosMemory.sdl"
+"SmBiosMemory.mak"
+"SmbiosMemory.c"
+"SmbiosMemory.h"
+"SmbiosMemory.dxs"
+"SmbiosMemoryStrings.uni"
+"SmBiosMemory.inf"
+<endComponent>
diff --git a/ReferenceCode/Chipset/SystemAgent/SmbiosMemory/Dxe/SmBiosMemory.inf b/ReferenceCode/Chipset/SystemAgent/SmbiosMemory/Dxe/SmBiosMemory.inf
new file mode 100644
index 0000000..3bacc7c
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SmbiosMemory/Dxe/SmBiosMemory.inf
@@ -0,0 +1,98 @@
+## @file
+# Component description file for SmbiosMemory Driver module
+# {EDA39402-F375-4496-92D3-83B43CB8A76A}
+#
+#@copyright
+# Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+##
+
+[defines]
+BASE_NAME = SmBiosMemory
+FILE_GUID = EDA39402-F375-4496-92D3-83B43CB8A76A
+COMPONENT_TYPE = BS_DRIVER
+
+[sources.common]
+ SmbiosMemory.h
+ SmbiosMemory.c
+ SmbiosMemoryStrings.uni
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueDxeDriverEntryPoint.c
+
+[includes.common]
+ .
+ $(DEST_DIR)
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Include
+ $(EFI_SOURCE)/Include/IndustryStandard
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EDK_SOURCE)/Foundation/Library/Dxe/UefiEfiIfrSupportLib
+
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/SampleCode
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/SampleCode/Include
+
+[libraries.common]
+ EdkGuidLib
+ EfiCommonLib
+ EfiProtocolLib
+ UefiEfiIfrSupportLib
+ $(PROJECT_SA_FAMILY)ProtocolLib
+ EdkIIGlueBaseLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueDxeMemoryAllocationLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueDxeReportStatusCodeLib
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueDxeServicesTableLib
+ EdkIIGlueHiiLib
+ EdkIIGlueBasePrintLib
+ EdkProtocolLib
+ EfiDriverLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = SmbiosMemory.dxs
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=SmbiosMemoryEntryPoint\
+ -D __EDKII_GLUE_BASE_LIB__ \
+ -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ -D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_HII_LIB__ \
+ -D __EDKII_GLUE_BASE_PRINT_LIB__
diff --git a/ReferenceCode/Chipset/SystemAgent/SmbiosMemory/Dxe/SmBiosMemory.mak b/ReferenceCode/Chipset/SystemAgent/SmbiosMemory/Dxe/SmBiosMemory.mak
new file mode 100644
index 0000000..33553e3
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SmbiosMemory/Dxe/SmBiosMemory.mak
@@ -0,0 +1,85 @@
+#---------------------------------------------------------------------------
+# Create SmBiosMemory DXE driver
+#---------------------------------------------------------------------------
+EDK: SmBiosMemorySDB SmBiosMemory
+
+SmBiosMemory: $(BUILD_DIR)\SmBiosMemory.mak SmBiosMemoryBin
+
+$(BUILD_DIR)\SmBiosMemory.mak : $(SmBiosMemory_DIR)\$(@B).cif $(SmBiosMemory_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(SmBiosMemory_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+SmBiosMemory_OBJECTS = \
+ $(BUILD_DIR)\$(SmBiosMemory_DIR)\SmBiosMemory.obj \
+ $(BUILD_DIR)\SmBiosMemoryStrings.obj \
+
+SmBiosMemory_INCLUDES=\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(EDK_INCLUDES)\
+ $(INTEL_MCH_INCLUDES)\
+ $(NB_INCLUDES)\
+ /I$(UefiEfiIfrSupportLib_DIR)\
+
+SmBiosMemory_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=SmbiosMemoryEntryPoint"\
+ /D __EDKII_GLUE_BASE_LIB__ \
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ /D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_HII_LIB__
+
+SmBiosMemory_LIBS=\
+ $(EDKGUIDLIB)\
+ $(EFICOMMONLIB)\
+ $(EFIPROTOCOLLIB)\
+!IF $(EFI_SPECIFICATION_VERSION) >= 0x0002000A
+ $(UEFIEFIIFRSUPPORTLIB)\
+!ENDIF
+ $(INTEL_SA_PROTOCOL_LIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueDxeMemoryAllocationLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueDxeServicesTableLib_LIB)\
+ $(EdkIIGlueHiiLib_LIB)\
+ $(EFIDRIVERLIB)\
+ $(EdkIIGlueUefiRuntimeServicesTableLib_LIB)\
+ $(EdkIIGlueBasePrintLib_LIB) \
+ $(EDKPROTOCOLLIB)\
+
+SmBiosMemoryBin : $(SmBiosMemory_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\SmBiosMemory.mak all\
+ GUID=EDA39402-F375-4496-92D3-83B43CB8A76A\
+ "MY_INCLUDES=$(SmBiosMemory_INCLUDES)" \
+ "MY_DEFINES=$(SmBiosMemory_DEFINES)"\
+ ENTRY_POINT=_ModuleEntryPoint\
+ TYPE=BS_DRIVER\
+ EDKIIModule=DXEDRIVER\
+ "OBJECTS=$(SmBiosMemory_OBJECTS)"\
+ DEPEX1=$(SmBiosMemory_DIR)\SmBiosMemory.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX\
+ COMPRESS=1
+
+#---------------------------------------------------------------------------
+# Create SmBiosMemory Setup Screens
+#---------------------------------------------------------------------------
+SmBiosMemorySDB : $(BUILD_DIR)\SmBiosMemory.mak
+ $(MAKE) /$(MAKEFLAGS) $(BUILD_DEFAULTS)\
+ /f $(BUILD_DIR)\SmBiosMemory.mak all\
+ TYPE=SDB NAME=SmBiosMemory
+ $(STRGATHER) -dump -lang $(SUPPORTED_LANGUAGES: = -lang )\
+ -db $(BUILD_DIR)\SmBiosMemory.sdb\
+ -oh $(BUILD_DIR)\SmBiosMemoryStrDefs.h\
+ -bn SmBiosMemoryStrings\
+ -oc $(BUILD_DIR)\SmBiosMemoryStrings.c
+ $(CC) $(CFLAGS) /Fo$(BUILD_DIR)\ $(BUILD_DIR)\SmBiosMemoryStrings.c \ No newline at end of file
diff --git a/ReferenceCode/Chipset/SystemAgent/SmbiosMemory/Dxe/SmBiosMemory.sdl b/ReferenceCode/Chipset/SystemAgent/SmbiosMemory/Dxe/SmBiosMemory.sdl
new file mode 100644
index 0000000..945477c
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SmbiosMemory/Dxe/SmBiosMemory.sdl
@@ -0,0 +1,32 @@
+TOKEN
+ Name = "SMBIOS_MEMORY_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable SmBiosMemory support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "SmBiosMemory_DIR"
+End
+
+MODULE
+ Help = "Includes SmBiosMemory.mak to Project"
+ File = "SmBiosMemory.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\SmBiosMemory.ffs"
+ Parent = "FV_MAIN"
+ Help = "Add Intel SMBIOSMemory driver"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "SmBiosMemory"
+ InvokeOrder = ReplaceParent
+End
+
diff --git a/ReferenceCode/Chipset/SystemAgent/SmbiosMemory/Dxe/SmbiosMemory.c b/ReferenceCode/Chipset/SystemAgent/SmbiosMemory/Dxe/SmbiosMemory.c
new file mode 100644
index 0000000..910c58a
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SmbiosMemory/Dxe/SmbiosMemory.c
@@ -0,0 +1,745 @@
+/** @file
+ This driver will determine memory configuration information from the chipset
+ and memory and create SMBIOS memory structures appropriately.
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "SmbiosMemory.h"
+EFI_DRIVER_ENTRY_POINT (SmbiosMemoryEntryPoint)
+
+extern UINT8 SmBiosMemoryStrings[];
+MEMORY_MODULE_MANUFACTURE_LIST MemoryModuleManufactureList[] = {
+ {
+ 0,
+ 0x2c,
+ L"Micron"
+ },
+ {
+ 0,
+ 0xad,
+ L"Hynix/Hyundai"
+ },
+ {
+ 0,
+ 0xce,
+ L"Samsung"
+ },
+ {
+ 1,
+ 0x4f,
+ L"Transcend"
+ },
+ {
+ 1,
+ 0x98,
+ L"Kingston"
+ },
+ {
+ 2,
+ 0xfe,
+ L"Elpida"
+ },
+ {
+ 0xff,
+ 0xff,
+ 0
+ }
+};
+
+///
+/// Even SPD Addresses only as we read Words
+///
+const UINT8
+ SpdAddress[] = { 2, 8, 116, 118, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144 };
+
+/**
+ This driver will determine memory configuration information from the chipset
+ and memory and report the memory configuration info to the DataHub.
+
+ @param[in] ImageHandle - Handle for the image of this driver
+ @param[in] SystemTable - Pointer to the EFI System Table
+
+ @retval EFI_SUCCESS - if the data is successfully reported
+ @retval EFI_NOT_FOUND - if the HOB list could not be located.
+ @retval EFI_OUT_OF_RESOURCES - if not able to get resouces.
+**/
+EFI_STATUS
+SmbiosMemoryEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ BOOLEAN Populated;
+ CHAR16 StringBuffer2[64];
+ EFI_DATA_HUB_PROTOCOL *DataHub;
+ DDR_ROW_CONFIG RowConfArray[SA_MC_MAX_SOCKETS];
+ EFI_MEMORY_SUBCLASS_DRIVER_DATA MemorySubClassData;
+ EFI_SMBUS_DEVICE_ADDRESS SmbusSlaveAddress;
+ EFI_SMBUS_HC_PROTOCOL *SmbusController;
+ EFI_STATUS Status;
+ EFI_STRING StringBuffer;
+ EFI_PHYSICAL_ADDRESS BaseAddress;
+ UINT8 Index;
+ UINT8 *SmbusBuffer;
+ UINT16 ArrayInstance;
+ UINT64 DimmMemorySize;
+ UINT64 TotalMemorySize;
+ UINT8 Dimm;
+ UINTN SmbusBufferSize;
+ UINTN SmbusLength;
+ UINTN SmbusOffset;
+ UINTN StringBufferSize;
+ UINT8 IndexCounter;
+ UINTN IdListIndex;
+ MEM_INFO_PROTOCOL *MemInfoHob;
+ EFI_GUID MemInfoProtocolGuid = MEM_INFO_PROTOCOL_GUID;
+ UINT8 ChannelASlotMap;
+ UINT8 ChannelBSlotMap;
+ UINT8 BitIndex;
+ UINT16 MaxSockets;
+ UINT8 WidthCount=0; //AMI_OVERRIDE [EIP344598]
+ UINT8 ChannelASlotNum;
+ UINT8 ChannelBSlotNum;
+ BOOLEAN SlotPresent;
+ UINT16 MemoryTotalWidth;
+ UINT16 MemoryDataWidth;
+ UINT8 i;
+
+#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
+ EFI_HANDLE DriverHandle;
+ EFI_HII_DATABASE_PROTOCOL *HiiDatabase;
+ EFI_HII_PACKAGE_LIST_HEADER *PackageList;
+ EFI_HII_HANDLE StringPackHandle;
+#else
+ EFI_HII_PROTOCOL *Hii;
+ EFI_HII_HANDLE HiiHandle;
+ EFI_HII_PACKAGES *PackageList;
+#endif
+ STRING_REF DimmToDevLocator[] = {
+ STRING_TOKEN (STR_MEMORY_SUBCLASS_DEVICE_LOCATOR_0),
+ STRING_TOKEN (STR_MEMORY_SUBCLASS_DEVICE_LOCATOR_1),
+ STRING_TOKEN (STR_MEMORY_SUBCLASS_DEVICE_LOCATOR_2),
+ STRING_TOKEN (STR_MEMORY_SUBCLASS_DEVICE_LOCATOR_3)
+ };
+
+ STRING_REF DimmToBankLocator[] = {
+ STRING_TOKEN (STR_MEMORY_SUBCLASS_BANK_LOCATOR_0),
+ STRING_TOKEN (STR_MEMORY_SUBCLASS_BANK_LOCATOR_1),
+ STRING_TOKEN (STR_MEMORY_SUBCLASS_BANK_LOCATOR_2),
+ STRING_TOKEN (STR_MEMORY_SUBCLASS_BANK_LOCATOR_3)
+ };
+
+ EFI_GUID gEfiMemorySubClassDriverGuid = EFI_MEMORY_SUBCLASS_DRIVER_GUID;
+ DXE_PLATFORM_SA_POLICY_PROTOCOL *DxePlatformSaPolicy;
+
+ DxePlatformSaPolicy = NULL;
+
+ ///
+ /// Get the platform setup policy.
+ ///
+ Status = gBS->LocateProtocol (&gDxePlatformSaPolicyGuid, NULL, (VOID **) &DxePlatformSaPolicy);
+ ASSERT_EFI_ERROR (Status);
+
+ StringBufferSize = (sizeof (CHAR16)) * 100;
+ StringBuffer = AllocateZeroPool (StringBufferSize);
+ if (StringBuffer == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ SmbusBuffer = NULL;
+ SmbusBufferSize = 0x100;
+ SmbusBuffer = AllocatePool (SmbusBufferSize);
+ if (SmbusBuffer == NULL) {
+ (gBS->FreePool) (StringBuffer);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Status = gBS->LocateProtocol (&gEfiDataHubProtocolGuid, NULL, (VOID **) &DataHub);
+ ASSERT_EFI_ERROR (Status);
+
+ Status = gBS->LocateProtocol (&gEfiSmbusProtocolGuid, NULL, (VOID **) &SmbusController);
+ ASSERT_EFI_ERROR (Status);
+
+#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
+
+ Status = gBS->LocateProtocol (
+ &gEfiHiiDatabaseProtocolGuid,
+ NULL,
+ (VOID **) &HiiDatabase
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ ///
+ /// Create driver handle used by HII database
+ ///
+ Status = CreateHiiDriverHandle (&DriverHandle);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ ///
+ /// Publish our HII data
+ ///
+ PackageList = PreparePackageList (1, &gEfiMemorySubClassDriverGuid, SmBiosMemoryStrings);
+ if (PackageList == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Status = HiiDatabase->NewPackageList (
+ HiiDatabase,
+ PackageList,
+ DriverHandle,
+ &StringPackHandle
+ );
+ ASSERT_EFI_ERROR (Status);
+
+#else
+ ///
+ /// There should only be one HII protocol
+ ///
+ Status = gBS->LocateProtocol (&gEfiHiiProtocolGuid, NULL, (VOID **) &Hii);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Add our default strings to the HII database. They will be modified later.
+ ///
+ PackageList = PreparePackages (1, &gEfiMemorySubClassDriverGuid, SmBiosMemoryStrings);
+ Status = Hii->NewPack (Hii, PackageList, &HiiHandle);
+
+#endif
+
+ (gBS->FreePool) (PackageList);
+
+ Status = gBS->LocateProtocol (&MemInfoProtocolGuid, NULL, (VOID **) &MemInfoHob);
+ ASSERT_EFI_ERROR (Status);
+ ///
+ /// Data for TYPE 16 SMBIOS Structure
+ ///
+ ///
+ /// Create physical array and associated data for all mainboard memory
+ ///
+ ArrayInstance = 1;
+ TotalMemorySize = 0;
+ MemorySubClassData.Header.Version = EFI_MEMORY_SUBCLASS_VERSION;
+ MemorySubClassData.Header.HeaderSize = sizeof (EFI_SUBCLASS_TYPE1_HEADER);
+ MemorySubClassData.Header.Instance = ArrayInstance;
+ MemorySubClassData.Header.SubInstance = EFI_SUBCLASS_INSTANCE_NON_APPLICABLE;
+ MemorySubClassData.Header.RecordType = EFI_MEMORY_ARRAY_LOCATION_RECORD_NUMBER;
+
+ MemorySubClassData.Record.ArrayLocationData.MemoryArrayLocation = EfiMemoryArrayLocationSystemBoard;
+ MemorySubClassData.Record.ArrayLocationData.MemoryArrayUse = EfiMemoryArrayUseSystemMemory;
+
+ ///
+ /// Detect ECC
+ ///
+ if (MemInfoHob->MemInfoData.EccSupport) {
+ MemorySubClassData.Record.ArrayLocationData.MemoryErrorCorrection = EfiMemoryErrorCorrectionSingleBitEcc;
+ } else {
+ MemorySubClassData.Record.ArrayLocationData.MemoryErrorCorrection = EfiMemoryErrorCorrectionNone;
+ }
+ ///
+ /// Get the Memory DIMM info from platform policy protocols
+ ///
+ ChannelASlotMap = DxePlatformSaPolicy->MemoryConfig->ChannelASlotMap;
+ ChannelBSlotMap = DxePlatformSaPolicy->MemoryConfig->ChannelBSlotMap;
+ ChannelASlotNum = 0;
+ ChannelBSlotNum = 0;
+ for (BitIndex = 0; BitIndex < 8; BitIndex++) {
+ if ((ChannelASlotMap >> BitIndex) & BIT0) {
+ ChannelASlotNum++;
+ }
+
+ if ((ChannelBSlotMap >> BitIndex) & BIT0) {
+ ChannelBSlotNum++;
+ }
+ }
+
+ MaxSockets = ChannelASlotNum + ChannelBSlotNum;
+ MemorySubClassData.Record.ArrayLocationData.MaximumMemoryCapacity = MAX_RANK_CAPACITY * SA_MC_MAX_SIDES * MaxSockets;
+ MemorySubClassData.Record.ArrayLocationData.NumberMemoryDevices = (UINT16) (MaxSockets);
+
+ ///
+ /// Report top level physical array to datahub
+ /// This will translate into a Type 16 SMBIOS Record
+ ///
+ Status = DataHub->LogData (
+ DataHub,
+ &gEfiMemorySubClassGuid,
+ &gEfiMemorySubClassDriverGuid,
+ EFI_DATA_RECORD_CLASS_DATA,
+ &MemorySubClassData,
+ sizeof (EFI_SUBCLASS_TYPE1_HEADER) + sizeof (EFI_MEMORY_ARRAY_LOCATION_DATA)
+ );
+ if (EFI_ERROR (Status)) {
+ goto CleanAndExit;
+ }
+ ///
+ /// Get Memory size parameters for each rank
+ ///
+ ///
+ /// We start from a base address of 0 for rank 0. We calculate the base address based on the DIMM size.
+ ///
+ BaseAddress = 0;
+
+ for (Dimm = 0; Dimm < SA_MC_MAX_SLOTS; Dimm++) {
+ ///
+ /// Channel 0
+ ///
+ RowConfArray[Dimm].BaseAddress = BaseAddress;
+ RowConfArray[Dimm].RowLength = LShiftU64 (MemInfoHob->MemInfoData.dimmSize[Dimm], 20);
+ BaseAddress += RowConfArray[Dimm].RowLength;
+ ///
+ /// Channel 1
+ ///
+ RowConfArray[Dimm + SA_MC_MAX_SLOTS].BaseAddress = BaseAddress;
+ RowConfArray[Dimm + SA_MC_MAX_SLOTS].RowLength = LShiftU64 (MemInfoHob->MemInfoData.dimmSize[Dimm + SA_MC_MAX_SLOTS], 20);
+ BaseAddress += RowConfArray[Dimm + SA_MC_MAX_SLOTS].RowLength;
+
+ }
+ ///
+ /// For each existed socket whether it is populated or not generate Type 17.
+ /// Type 20 is optional for existed and populated socket.
+ ///
+ /// The Desktop and mobile only support 2 channels * 2 slots per channel = 4 sockets totally
+ /// So there is rule here for Desktop and mobile that there are no more 4 DIMMS totally in a system:
+ /// Channel A/ Slot 0 --> SpdAddressTable[0] --> DimmToDevLocator[0] --> MemInfoHobProtocol.MemInfoData.dimmSize[0]
+ /// Channel A/ Slot 1 --> SpdAddressTable[1] --> DimmToDevLocator[1] --> MemInfoHobProtocol.MemInfoData.dimmSize[1]
+ /// Channel B/ Slot 0 --> SpdAddressTable[2] --> DimmToDevLocator[2] --> MemInfoHobProtocol.MemInfoData.dimmSize[2]
+ /// Channel B/ Slot 1 --> SpdAddressTable[3] --> DimmToDevLocator[3] --> MemInfoHobProtocol.MemInfoData.dimmSize[3]
+ ///
+ for (Dimm = 0; Dimm < SA_MC_MAX_SOCKETS; Dimm++) {
+ ///
+ /// Use channel slot map to check whether the Socket is supported in this SKU, some SKU only has 2 Sockets totally
+ ///
+ SlotPresent = FALSE;
+ if (Dimm < 2) {
+ if (ChannelASlotMap & (1 << Dimm)) {
+ SlotPresent = TRUE;
+ }
+ } else {
+ if (ChannelBSlotMap & (1 << (Dimm - 2))) {
+ SlotPresent = TRUE;
+ }
+ }
+ ///
+ /// Don't create Type 17 and Type 20 items for non-existing socket
+ ///
+ if (!SlotPresent) {
+ continue;
+ }
+ ///
+ /// Generate Memory Device info (Type 17)
+ ///
+ ZeroMem (SmbusBuffer, SmbusBufferSize);
+ ///
+ /// Only read the SPD data if the DIMM is populated in the slot.
+ ///
+ Populated = MemInfoHob->MemInfoData.DimmExist[Dimm];
+ if (Populated) {
+ WidthCount++; //AMI_OVERRIDE [EIP344598]
+ ///
+ /// Read the SPD for this DIMM
+ ///
+ SmbusSlaveAddress.SmbusDeviceAddress = (DxePlatformSaPolicy->MemoryConfig->SpdAddressTable[Dimm]) >> 1;
+
+ ///
+ /// Read only needed values from SMBus or DimmsSpdData pointer to improve performance.
+ ///
+ for (i = 0; i < sizeof SpdAddress; i++) {
+ SmbusOffset = SpdAddress[i];
+ if (MemInfoHob->MemInfoData.DimmsSpdData[Dimm] == NULL) {
+ SmbusLength = 2;
+ Status = SmbusController->Execute (
+ SmbusController,
+ SmbusSlaveAddress,
+ SmbusOffset,
+ EfiSmbusReadWord,
+ FALSE,
+ &SmbusLength,
+ &SmbusBuffer[SmbusOffset]
+ );
+ if (EFI_ERROR (Status)) {
+ Populated = FALSE;
+ break;
+ }
+ } else {
+ *(UINT16 *) (SmbusBuffer + SmbusOffset) = *(UINT16 *) (MemInfoHob->MemInfoData.DimmsSpdData[Dimm] + SmbusOffset);
+ }
+ }
+ }
+
+ ZeroMem (&MemorySubClassData, sizeof (EFI_MEMORY_SUBCLASS_DRIVER_DATA));
+
+ ///
+ /// Use SPD data to generate Device Type info
+ ///
+ MemorySubClassData.Header.Version = EFI_MEMORY_SUBCLASS_VERSION;
+ MemorySubClassData.Header.HeaderSize = sizeof (EFI_SUBCLASS_TYPE1_HEADER);
+ MemorySubClassData.Header.Instance = ArrayInstance;
+ MemorySubClassData.Header.SubInstance = (UINT16) (Dimm + 1);
+ MemorySubClassData.Header.RecordType = EFI_MEMORY_ARRAY_LINK_RECORD_NUMBER;
+
+ MemorySubClassData.Record.ArrayLink.MemoryDeviceLocator = DimmToDevLocator[Dimm];
+ MemorySubClassData.Record.ArrayLink.MemoryBankLocator = DimmToBankLocator[Dimm];
+
+#ifdef MEMORY_ASSET_TAG
+ StrCpy (StringBuffer, MEMORY_ASSET_TAG);
+ MemorySubClassData.Record.ArrayLink.MemoryAssetTag = (STRING_REF) 0;
+
+#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
+ Status = IfrLibNewString (StringPackHandle, &MemorySubClassData.Record.ArrayLink.MemoryAssetTag, StringBuffer);
+ ASSERT_EFI_ERROR (Status);
+#else
+ Status = Hii->NewString (
+ Hii,
+ NULL,
+ HiiHandle,
+ &MemorySubClassData.Record.ArrayLink.MemoryAssetTag,
+ StringBuffer
+ );
+ ASSERT_EFI_ERROR (Status);
+#endif
+
+#else
+ MemorySubClassData.Record.ArrayLink.MemoryAssetTag = STRING_TOKEN (STR_MEMORY_SUBCLASS_DEFAULT_ASSET_TAG);
+#endif
+
+ MemorySubClassData.Record.ArrayLink.MemoryArrayLink.ProducerName = gEfiMemorySubClassDriverGuid;
+ MemorySubClassData.Record.ArrayLink.MemoryArrayLink.Instance = ArrayInstance;
+ MemorySubClassData.Record.ArrayLink.MemoryArrayLink.SubInstance = EFI_SUBCLASS_INSTANCE_NON_APPLICABLE;
+ MemorySubClassData.Record.ArrayLink.MemorySubArrayLink.ProducerName = gEfiMemorySubClassDriverGuid;
+ MemorySubClassData.Record.ArrayLink.MemorySubArrayLink.SubInstance = EFI_SUBCLASS_INSTANCE_NON_APPLICABLE;
+ ///
+ /// Set MemoryType value to DDR3 (0x18)
+ ///
+ MemorySubClassData.Record.ArrayLink.MemoryType = EfiMemoryTypeDdr3;
+
+ ///
+ /// According to SMBIOS 2.6.1 Specification - Appendix A Conformance Guidelines
+ /// 4.8.7: Form Factor is not 00h (Reserved) or 02h (Unknown).
+ ///
+ if (Populated) {
+ switch (SmbusBuffer[DDR_MTYPE_SPD_OFFSET] & DDR_MTYPE_SPD_MASK) {
+ case DDR_MTYPE_SODIMM:
+ MemorySubClassData.Record.ArrayLink.MemoryFormFactor = EfiMemoryFormFactorSodimm;
+ break;
+
+ case DDR_MTYPE_RDIMM:
+ case DDR_MTYPE_MINI_RDIMM:
+ MemorySubClassData.Record.ArrayLink.MemoryFormFactor = EfiMemoryFormFactorRimm;
+ break;
+
+ case DDR_MTYPE_UDIMM:
+ case DDR_MTYPE_MICRO_DIMM:
+ case DDR_MTYPE_MINI_UDIMM:
+ default:
+ MemorySubClassData.Record.ArrayLink.MemoryFormFactor = EfiMemoryFormFactorDimm;
+ }
+ ///
+ /// Show name for known manufacturer or ID for unknown manufacturer
+ ///
+ StrCpy (StringBuffer, L"");
+
+ ///
+ /// Calculate index counter
+ /// Clearing Bit7 as it is the Parity Bit for Byte 117
+ ///
+ IndexCounter = SmbusBuffer[117] & (~0x80);
+
+ ///
+ /// Converter memory manufacturer ID to string
+ ///
+ for (IdListIndex = 0; MemoryModuleManufactureList[IdListIndex].Index != 0xff; IdListIndex++) {
+ if (MemoryModuleManufactureList[IdListIndex].Index == IndexCounter &&
+ MemoryModuleManufactureList[IdListIndex].ManufactureId == SmbusBuffer[118]
+ ) {
+ StrCpy (StringBuffer, MemoryModuleManufactureList[IdListIndex].ManufactureName);
+ break;
+ }
+ }
+ ///
+ /// Use original data if no conversion information in conversion table
+ ///
+ if (!(*StringBuffer)) {
+ for (Index = 117; Index < 119; Index++) {
+ ///
+ /// --cr-- EfiValueToHexStr(StringBuffer2, SmbusBuffer[Index], PREFIX_ZERO, 2);
+ ///
+ UnicodeValueToString (StringBuffer2, PREFIX_ZERO, SmbusBuffer[Index], 2);
+ StrCat (StringBuffer, StringBuffer2);
+ }
+ }
+
+ MemorySubClassData.Record.ArrayLink.MemoryManufacturer = (STRING_REF) 0;
+#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
+ Status = IfrLibNewString (
+ StringPackHandle,
+ &MemorySubClassData.Record.ArrayLink.MemoryManufacturer,
+ StringBuffer
+ );
+ ASSERT_EFI_ERROR (Status);
+#else
+ Status = Hii->NewString (
+ Hii,
+ NULL,
+ HiiHandle,
+ &MemorySubClassData.Record.ArrayLink.MemoryManufacturer,
+ StringBuffer
+ );
+ ASSERT_EFI_ERROR (Status);
+#endif
+ StrCpy (StringBuffer, L"");
+ for (Index = 122; Index < 126; Index++) {
+ EfiValueToHexStr(StringBuffer2, SmbusBuffer[Index], PREFIX_ZERO, 2);
+ StrCat (StringBuffer, StringBuffer2);
+ }
+
+ MemorySubClassData.Record.ArrayLink.MemorySerialNumber = (STRING_REF) 0;
+#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
+ Status = IfrLibNewString (
+ StringPackHandle,
+ &MemorySubClassData.Record.ArrayLink.MemorySerialNumber,
+ StringBuffer
+ );
+ ASSERT_EFI_ERROR (Status);
+#else
+ Status = Hii->NewString (
+ Hii,
+ NULL,
+ HiiHandle,
+ &MemorySubClassData.Record.ArrayLink.MemorySerialNumber,
+ StringBuffer
+ );
+ ASSERT_EFI_ERROR (Status);
+#endif
+ StrCpy (StringBuffer, L"");
+ for (Index = 128; Index < 146; Index++) {
+ UnicodeSPrint (
+ StringBuffer2,
+ 4,
+ L"%c",
+ SmbusBuffer[Index]
+ );
+ StrCat (StringBuffer, StringBuffer2);
+ }
+
+ MemorySubClassData.Record.ArrayLink.MemoryPartNumber = (STRING_REF) 0;
+#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
+ Status = IfrLibNewString (StringPackHandle, &MemorySubClassData.Record.ArrayLink.MemoryPartNumber, StringBuffer);
+ ASSERT_EFI_ERROR (Status);
+#else
+ Status = Hii->NewString (
+ Hii,
+ NULL,
+ HiiHandle,
+ &MemorySubClassData.Record.ArrayLink.MemoryPartNumber,
+ StringBuffer
+ );
+ ASSERT_EFI_ERROR (Status);
+#endif
+ ///
+ /// Get the Memory TotalWidth and DataWidth info for DDR3
+ /// refer to DDR3 SPD 1.0 spec, Byte 8: Module Memory Bus Width
+ /// SPD Offset 8 Bits [2:0] DataWidth aka Primary Bus Width
+ /// SPD Offset 8 Bits [4:3] Bus Width extension for ECC
+ ///
+ MemoryDataWidth = 8 * (1 << (SmbusBuffer[8] & 0x07));
+ MemoryTotalWidth = MemoryDataWidth + 8 * (SmbusBuffer[8] & 0x18);
+ MemorySubClassData.Record.ArrayLink.MemoryTotalWidth = MemoryTotalWidth;
+ MemorySubClassData.Record.ArrayLink.MemoryDataWidth = MemoryDataWidth;
+ DimmMemorySize = RowConfArray[Dimm].RowLength;
+
+ TotalMemorySize += DimmMemorySize;
+ MemorySubClassData.Record.ArrayLink.MemoryDeviceSize = DimmMemorySize;
+ MemorySubClassData.Record.ArrayLink.MemoryTypeDetail.Synchronous = 1;
+ if (MemorySubClassData.Record.ArrayLink.MemoryFormFactor == EfiMemoryFormFactorRimm) {
+ MemorySubClassData.Record.ArrayLink.MemoryTypeDetail.Rambus = 1;
+ }
+
+ MemorySubClassData.Record.ArrayLink.MemorySpeed = MemInfoHob->MemInfoData.ddrFreq;
+ MemorySubClassData.Record.ArrayLink.MemoryAttributes = MemInfoHob->MemInfoData.RankInDimm[Dimm] & 0x0F;
+ } else {
+ ///
+ /// Memory is not Populated in this slot.
+ ///
+ StrCpy (StringBuffer, L"");
+ MemorySubClassData.Record.ArrayLink.MemoryManufacturer = (STRING_REF) 0;
+#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
+ Status = IfrLibNewString (
+ StringPackHandle,
+ &MemorySubClassData.Record.ArrayLink.MemoryManufacturer,
+ StringBuffer
+ );
+ ASSERT_EFI_ERROR (Status);
+#else
+ Status = Hii->NewString (
+ Hii,
+ NULL,
+ HiiHandle,
+ &MemorySubClassData.Record.ArrayLink.MemoryManufacturer,
+ StringBuffer
+ );
+ ASSERT_EFI_ERROR (Status);
+#endif
+ MemorySubClassData.Record.ArrayLink.MemorySerialNumber = (STRING_REF) 0;
+#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
+ Status = IfrLibNewString (
+ StringPackHandle,
+ &MemorySubClassData.Record.ArrayLink.MemorySerialNumber,
+ StringBuffer
+ );
+ ASSERT_EFI_ERROR (Status);
+#else
+ Status = Hii->NewString (
+ Hii,
+ NULL,
+ HiiHandle,
+ &MemorySubClassData.Record.ArrayLink.MemorySerialNumber,
+ StringBuffer
+ );
+ ASSERT_EFI_ERROR (Status);
+#endif
+
+ MemorySubClassData.Record.ArrayLink.MemoryPartNumber = (STRING_REF) 0;
+#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
+ Status = IfrLibNewString (StringPackHandle, &MemorySubClassData.Record.ArrayLink.MemoryPartNumber, StringBuffer);
+ ASSERT_EFI_ERROR (Status);
+#else
+ Status = Hii->NewString (
+ Hii,
+ NULL,
+ HiiHandle,
+ &MemorySubClassData.Record.ArrayLink.MemoryPartNumber,
+ StringBuffer
+ );
+ ASSERT_EFI_ERROR (Status);
+#endif
+ DimmMemorySize = 0;
+ MemorySubClassData.Record.ArrayLink.MemorySpeed = 0;
+ MemorySubClassData.Record.ArrayLink.MemoryDeviceSize = 0;
+ MemorySubClassData.Record.ArrayLink.MemoryType = EfiMemoryTypeUnknown;
+ MemorySubClassData.Record.ArrayLink.MemoryFormFactor = EfiMemoryFormFactorDimm;
+ }
+ ///
+ /// Generate Memory Device info (Type 17)
+ ///
+ Status = DataHub->LogData (
+ DataHub,
+ &gEfiMemorySubClassGuid,
+ &gEfiMemorySubClassDriverGuid,
+ EFI_DATA_RECORD_CLASS_DATA,
+ &MemorySubClassData,
+ sizeof (EFI_SUBCLASS_TYPE1_HEADER) + sizeof (EFI_MEMORY_ARRAY_LINK)
+ );
+ if (EFI_ERROR (Status)) {
+ goto CleanAndExit;
+ }
+ ///
+ /// Memory Device Mapped Address (Type 20) is optional and it will not be generated by RC
+ ///
+// ...AMI_OVERRIDE... support Type 20
+ if ((Populated) && (DimmMemorySize != 0)) {
+ ///
+ /// Generate Memory Device Mapped Address info (Type 20)
+ ///
+ MemorySubClassData.Header.Instance = ArrayInstance;
+ MemorySubClassData.Header.SubInstance = (UINT16) (Dimm + 1);
+ MemorySubClassData.Header.RecordType = EFI_MEMORY_DEVICE_START_ADDRESS_RECORD_NUMBER;
+
+ MemorySubClassData.Record.DeviceStartAddress.MemoryDeviceStartAddress = RowConfArray[Dimm].BaseAddress;
+ MemorySubClassData.Record.DeviceStartAddress.MemoryDeviceEndAddress = MemorySubClassData.Record.
+ DeviceStartAddress.MemoryDeviceStartAddress +
+ DimmMemorySize -
+ 1;
+ ///
+ /// 1 or 2 will be applicable for lock step mode
+ ///
+ MemorySubClassData.Record.DeviceStartAddress.MemoryDevicePartitionRowPosition = 0xFF;
+
+ MemorySubClassData.Record.DeviceStartAddress.PhysicalMemoryDeviceLink.ProducerName = gEfiMemorySubClassDriverGuid;
+ MemorySubClassData.Record.DeviceStartAddress.PhysicalMemoryDeviceLink.Instance = ArrayInstance;
+ MemorySubClassData.Record.DeviceStartAddress.PhysicalMemoryDeviceLink.SubInstance = (UINT16) (Dimm + 1);
+ MemorySubClassData.Record.DeviceStartAddress.PhysicalMemoryArrayLink.ProducerName = gEfiMemorySubClassDriverGuid;
+ MemorySubClassData.Record.DeviceStartAddress.PhysicalMemoryArrayLink.Instance = ArrayInstance;
+ MemorySubClassData.Record.DeviceStartAddress.PhysicalMemoryArrayLink.SubInstance = EFI_SUBCLASS_INSTANCE_NON_APPLICABLE;
+
+ ///
+ /// Set Interleave Data Depth and Position.
+ ///
+ if (((Dimm >= SA_MC_MAX_SLOTS) && (MemInfoHob->MemInfoData.DimmExist[Dimm - SA_MC_MAX_SLOTS])) ||
+ ((Dimm < SA_MC_MAX_SLOTS) && (MemInfoHob->MemInfoData.DimmExist[Dimm + SA_MC_MAX_SLOTS]))
+ ) {
+ ///
+ /// If DIMMs on both channels are populated then Interleaved Data Depth is 2 and Interleave Position is 1 or 2
+ ///
+ MemorySubClassData.Record.DeviceStartAddress.MemoryDeviceInterleaveDataDepth = (UINT8) (MaxSockets >> 1);
+ MemorySubClassData.Record.DeviceStartAddress.MemoryDeviceInterleavePosition = (UINT8) (1 << (Dimm >= (MaxSockets >> 1)));
+ } else {
+ ///
+ /// Interleaved Data Depth and Position is 1
+ ///
+ MemorySubClassData.Record.DeviceStartAddress.MemoryDeviceInterleaveDataDepth = 1;
+ MemorySubClassData.Record.DeviceStartAddress.MemoryDeviceInterleavePosition = 1;
+ }
+ ///
+ /// Generate Memory Device Mapped Address info (Type 20)
+ ///
+ Status = DataHub->LogData (
+ DataHub,
+ &gEfiMemorySubClassGuid,
+ &gEfiMemorySubClassDriverGuid,
+ EFI_DATA_RECORD_CLASS_DATA,
+ &MemorySubClassData,
+ sizeof (EFI_SUBCLASS_TYPE1_HEADER) + sizeof (EFI_MEMORY_DEVICE_START_ADDRESS)
+ );
+ if (EFI_ERROR (Status)) {
+ goto CleanAndExit;
+ }
+ }
+// ...AMI_OVERRIDE... support Type 20 end
+ }
+ ///
+ /// Generate Memory Array Mapped Address info (TYPE 19)
+ ///
+ MemorySubClassData.Header.Instance = ArrayInstance;
+ MemorySubClassData.Header.SubInstance = EFI_SUBCLASS_INSTANCE_NON_APPLICABLE;
+ MemorySubClassData.Header.RecordType = EFI_MEMORY_ARRAY_START_ADDRESS_RECORD_NUMBER;
+
+ MemorySubClassData.Record.ArrayStartAddress.MemoryArrayStartAddress = 0;
+ MemorySubClassData.Record.ArrayStartAddress.MemoryArrayEndAddress = TotalMemorySize - 1;
+ MemorySubClassData.Record.ArrayStartAddress.PhysicalMemoryArrayLink.ProducerName = gEfiMemorySubClassDriverGuid;
+ MemorySubClassData.Record.ArrayStartAddress.PhysicalMemoryArrayLink.Instance = ArrayInstance;
+ MemorySubClassData.Record.ArrayStartAddress.PhysicalMemoryArrayLink.SubInstance = EFI_SUBCLASS_INSTANCE_NON_APPLICABLE;
+ //MemorySubClassData.Record.ArrayStartAddress.MemoryArrayPartitionWidth = (UINT16) (MaxSockets); //AMI_OVERRIDE [EIP344598]
+ MemorySubClassData.Record.ArrayStartAddress.MemoryArrayPartitionWidth = WidthCount; //AMI_OVERRIDE [EIP344598]
+ ///
+ /// Generate Memory Array Mapped Address info (TYPE 19)
+ ///
+ Status = DataHub->LogData (
+ DataHub,
+ &gEfiMemorySubClassGuid,
+ &gEfiMemorySubClassDriverGuid,
+ EFI_DATA_RECORD_CLASS_DATA,
+ &MemorySubClassData,
+ sizeof (EFI_SUBCLASS_TYPE1_HEADER) + sizeof (EFI_MEMORY_ARRAY_START_ADDRESS)
+ );
+CleanAndExit:
+ (gBS->FreePool) (SmbusBuffer);
+ (gBS->FreePool) (StringBuffer);
+ return Status;
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/SmbiosMemory/Dxe/SmbiosMemory.dxs b/ReferenceCode/Chipset/SystemAgent/SmbiosMemory/Dxe/SmbiosMemory.dxs
new file mode 100644
index 0000000..5675c94
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SmbiosMemory/Dxe/SmbiosMemory.dxs
@@ -0,0 +1,58 @@
+/** @file
+ Dependency expression file for the MemorySubClass Driver.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "DxeDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+
+#include EFI_PROTOCOL_DEFINITION (DataHub)
+#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
+#include EFI_PROTOCOL_DEFINITION (HiiDatabase)
+#else
+#include EFI_PROTOCOL_DEFINITION (Hii)
+#endif
+#include EFI_PROTOCOL_DEFINITION (Smbus)
+#include EFI_PROTOCOL_DEFINITION (PciRootBridgeIo)
+#include EFI_PROTOCOL_DEPENDENCY (SaPlatformPolicy)
+#include EFI_PROTOCOL_DEPENDENCY (MemInfo)
+#endif
+
+DEPENDENCY_START
+ EFI_DATA_HUB_PROTOCOL_GUID AND
+#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
+ EFI_HII_DATABASE_PROTOCOL_GUID AND
+#else
+ EFI_HII_PROTOCOL_GUID AND
+#endif
+ EFI_SMBUS_HC_PROTOCOL_GUID AND
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GUID AND
+ DXE_PLATFORM_SA_POLICY_GUID AND
+ MEM_INFO_PROTOCOL_GUID
+DEPENDENCY_END
diff --git a/ReferenceCode/Chipset/SystemAgent/SmbiosMemory/Dxe/SmbiosMemory.h b/ReferenceCode/Chipset/SystemAgent/SmbiosMemory/Dxe/SmbiosMemory.h
new file mode 100644
index 0000000..9e0a641
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SmbiosMemory/Dxe/SmbiosMemory.h
@@ -0,0 +1,127 @@
+/** @file
+ Header file for the SMBIOS Memory Driver.
+ This driver will determine memory configuration information from the chipset
+ and memory and create SMBIOS Memory structures appropriately.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _SMBIOS_MEMORY_H_
+#define _SMBIOS_MEMORY_H_
+
+#include "EdkIIGlueDxe.h"
+#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
+#include "UefiIfrLibrary.h"
+#include EFI_PROTOCOL_DEPENDENCY (HiiDatabase)
+#include EFI_PROTOCOL_DEPENDENCY (HiiString)
+#else
+#include EFI_PROTOCOL_DEPENDENCY (Hii)
+#endif
+#include "SaAccess.h"
+#include "CpuFuncs.h"
+#include "Cpu.h"
+
+///
+/// This is the generated header file which includes whatever needs to be exported (strings + IFR)
+///
+#include "SmbiosMemoryStrDefs.h"
+
+///
+/// Driver Consumed Protocol Prototypes
+///
+#include EFI_PROTOCOL_DEPENDENCY (DataHub)
+#include EFI_PROTOCOL_DEPENDENCY (Smbus)
+#include EFI_PROTOCOL_DEPENDENCY (MemInfo)
+#include EFI_PROTOCOL_DEPENDENCY (PciRootBridgeIo)
+#include EFI_PROTOCOL_DEPENDENCY (SaPlatformPolicy)
+
+///
+/// Driver private data
+///
+#include EFI_GUID_DEFINITION (DataHubRecords)
+
+#define EFI_MEMORY_SUBCLASS_DRIVER_GUID \
+ { \
+ 0x1767CEED, 0xDB82, 0x47cd, 0xBF, 0x2B, 0x68, 0x45, 0x8A, 0x8C, 0xCF, 0xFF \
+ }
+
+///
+/// Memory
+///
+#define MEM_FRQCY_BIT_SHIFT 1
+
+#define MAD_DIMM_CH0 0x5004
+#define MAD_DIMM_CH1 0x5008
+
+///
+/// Memory module type definition in DDR3 SPD Data
+///
+#define DDR_MTYPE_SPD_OFFSET 3 ///< Module type, offset 3, bits (3:0)
+#define DDR_MTYPE_SPD_MASK 0x0F ///< Module Type mask
+#define DDR_MTYPE_RDIMM 0x01 ///< Registered DIMM Memory
+#define DDR_MTYPE_UDIMM 0x02 ///< Unbuffered DIMM Memory
+#define DDR_MTYPE_SODIMM 0x03 ///< Small Outline DIMM Memory
+#define DDR_MTYPE_MICRO_DIMM 0x04 ///< Micro-DIMM Memory
+#define DDR_MTYPE_MINI_RDIMM 0x05 ///< Mini Registered DIMM Memory
+#define DDR_MTYPE_MINI_UDIMM 0x06 ///< Mini Unbuffered DIMM Memory
+///
+/// Maximum rank memory size supported by the memory controller
+/// 4 GB in terms of KB
+///
+#define MAX_RANK_CAPACITY (4 * 1024 * 1024)
+
+#ifndef MEMORY_ASSET_TAG
+#define MEMORY_ASSET_TAG L"9876543210"
+#endif
+///
+/// Memory Module Manufacture ID List Structure
+///
+typedef struct {
+ UINT8 Index;
+ UINT8 ManufactureId;
+ CHAR16 *ManufactureName;
+} MEMORY_MODULE_MANUFACTURE_LIST;
+
+///
+/// Row configuration data structure
+///
+typedef struct {
+ EFI_PHYSICAL_ADDRESS BaseAddress;
+ UINT64 RowLength; ///< Size of Row in bytes
+} DDR_ROW_CONFIG;
+
+///
+/// Prototypes
+///
+/**
+ This driver will determine memory configuration information from the chipset
+ and memory and report the memory configuration info to the DataHub.
+
+ @param[in] ImageHandle - Handle for the image of this driver
+ @param[in] SystemTable - Pointer to the EFI System Table
+
+ @retval EFI_SUCCESS - if the data is successfully reported
+ @retval EFI_NOT_FOUND - if the HOB list could not be located.
+ @retval EFI_OUT_OF_RESOURCES - if not able to get resouces.
+**/
+EFI_STATUS
+SmbiosMemoryEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+;
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/SmbiosMemory/Dxe/SmbiosMemoryStrings.uni b/ReferenceCode/Chipset/SystemAgent/SmbiosMemory/Dxe/SmbiosMemoryStrings.uni
new file mode 100644
index 0000000..3b5be48
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SmbiosMemory/Dxe/SmbiosMemoryStrings.uni
Binary files differ
diff --git a/ReferenceCode/Chipset/SystemAgent/SmmAccess/Dxe/SmmAccess.cif b/ReferenceCode/Chipset/SystemAgent/SmmAccess/Dxe/SmmAccess.cif
new file mode 100644
index 0000000..b754f8b
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SmmAccess/Dxe/SmmAccess.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "SmmAccess"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\SystemAgent\SmmAccess\Dxe"
+ RefName = "SmmAccess"
+[files]
+"SmmAccess.sdl"
+"SmmAccess.mak"
+"SmmAccessDriver.c"
+"SmmAccessDriver.h"
+"SmmAccess.dxs"
+"SmmAccess.inf"
+<endComponent>
diff --git a/ReferenceCode/Chipset/SystemAgent/SmmAccess/Dxe/SmmAccess.dxs b/ReferenceCode/Chipset/SystemAgent/SmmAccess/Dxe/SmmAccess.dxs
new file mode 100644
index 0000000..30e8eb6
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SmmAccess/Dxe/SmmAccess.dxs
@@ -0,0 +1,40 @@
+/** @file
+ Dependency expression file for Smm Access Driver.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "DxeDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+#include EFI_PROTOCOL_DEFINITION (PciRootBridgeIo)
+#endif
+
+DEPENDENCY_START
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GUID
+DEPENDENCY_END
diff --git a/ReferenceCode/Chipset/SystemAgent/SmmAccess/Dxe/SmmAccess.inf b/ReferenceCode/Chipset/SystemAgent/SmmAccess/Dxe/SmmAccess.inf
new file mode 100644
index 0000000..f19577b
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SmmAccess/Dxe/SmmAccess.inf
@@ -0,0 +1,82 @@
+## @file
+# Component description file for the SmmAccess module
+# {1323C7F8-DAD5-4126-A54B-7A05FBF4151}
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = SmmAccess
+FILE_GUID = 1323C7F8-DAD5-4126-A54B-7A05FBF41515
+COMPONENT_TYPE = BS_DRIVER
+
+[sources.common]
+ SmmAccessDriver.h
+ SmmAccessDriver.c
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueDxeDriverEntryPoint.c
+
+[includes.common]
+ .
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Include
+ $(EDK_SOURCE)/Foundation/Cpu/Pentium/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include/Library
+
+[libraries.common]
+ EdkFrameworkGuidLib
+ EdkFrameworkProtocolLib
+ EfiProtocolLib
+ EfiCommonLib
+ EfiScriptLib
+ EdkIIGlueBaseLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueBaseMemoryLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueDxeReportStatusCodeLib
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueDxeServicesTableLib
+ EdkIIGlueDxeHobLib
+ EdkIIGlueDxeMemoryAllocationLib
+ EdkProtocolLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = SmmAccess.dxs
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=SmmAccessDriverEntryPoint \
+ -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_BASE_LIB__ \
+ -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_DXE_HOB_LIB__ \
+ -D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__
diff --git a/ReferenceCode/Chipset/SystemAgent/SmmAccess/Dxe/SmmAccess.mak b/ReferenceCode/Chipset/SystemAgent/SmmAccess/Dxe/SmmAccess.mak
new file mode 100644
index 0000000..59d1450
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SmmAccess/Dxe/SmmAccess.mak
@@ -0,0 +1,63 @@
+#---------------------------------------------------------------------------
+# Create SmmAccess Driver
+#---------------------------------------------------------------------------
+EDK : SmmAccess
+
+SmmAccess : $(BUILD_DIR)\SmmAccess.mak SmmAccessBin
+
+$(BUILD_DIR)\SmmAccess.mak : $(SmmAccess_DIR)\$(@B).cif $(SmmAccess_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(SmmAccess_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+SmmAccess_INCLUDES = \
+ $(EdkIIGlueLib_INCLUDES)\
+ $(EDK_INCLUDES)\
+ $(INTEL_MCH_INCLUDES)
+
+SmmAccess_DEFINES = $(MY_DEFINES)\
+ /D "__EDKII_GLUE_MODULE_ENTRY_POINT__=SmmAccessDriverEntryPoint" \
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_BASE_LIB__ \
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_DXE_HOB_LIB__\
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+
+SmmAccess_LIB_LINKS =\
+ $(EDKFRAMEWORKGUIDLIB)\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(EFIPROTOCOLLIB)\
+ $(EFICOMMONLIB)\
+ $(EFISCRIPTLIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueDxeHobLib_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueUefiRuntimeServicesTableLib_LIB)\
+ $(EdkIIGlueDxeServicesTableLib_LIB)\
+ $(EdkIIGlueDxeMemoryAllocationLib_LIB)\
+ $(EDKPROTOCOLLIB)\
+
+SmmAccessBin: $(SmmAccess_LIB_LINKS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\SmmAccess.mak all \
+ "MY_INCLUDES=$(SmmAccess_INCLUDES)" \
+ "MY_DEFINES=$(SmmAccess_DEFINES)"\
+ GUID=1323C7F8-DAD5-4126-A54B-7A05FBF41515\
+ ENTRY_POINT=_ModuleEntryPoint\
+ TYPE=BS_DRIVER \
+ EDKIIModule=DXEDRIVER\
+ DEPEX1=$(SmmAccess_DIR)\SmmAccess.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \
+ COMPRESS=1
diff --git a/ReferenceCode/Chipset/SystemAgent/SmmAccess/Dxe/SmmAccess.sdl b/ReferenceCode/Chipset/SystemAgent/SmmAccess/Dxe/SmmAccess.sdl
new file mode 100644
index 0000000..89077d9
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SmmAccess/Dxe/SmmAccess.sdl
@@ -0,0 +1,30 @@
+TOKEN
+ Name = "SmmAccess_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable SmmAccess support in Project"
+ TokenType = Boolean
+ TargetMAK = Yes
+ Master = Yes
+ Token = "SMM_SUPPORT" "=" "1"
+End
+
+PATH
+ Name = "SmmAccess_DIR"
+End
+
+MODULE
+ Help = "Includes SmmAccess to Project"
+ File = "SmmAccess.mak"
+End
+
+ELINK
+ Name = "SmmAccess"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\SmmAccess.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+
diff --git a/ReferenceCode/Chipset/SystemAgent/SmmAccess/Dxe/SmmAccessDriver.c b/ReferenceCode/Chipset/SystemAgent/SmmAccess/Dxe/SmmAccessDriver.c
new file mode 100644
index 0000000..f91c170
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SmmAccess/Dxe/SmmAccessDriver.c
@@ -0,0 +1,457 @@
+/** @file
+ This is the driver that publishes the SMM Access Protocol
+ instance for System Agent.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "SmmAccessDriver.h"
+
+static SMM_ACCESS_PRIVATE_DATA mSmmAccess;
+
+EFI_DRIVER_ENTRY_POINT (SmmAccessDriverEntryPoint)
+
+/**
+ This is the standard EFI driver point that
+ installs an SMM Access Protocol
+
+ @param[in] ImageHandle - Handle for the image of this driver
+ @param[in] SystemTable - Pointer to the EFI System Table
+
+ @retval EFI_SUCCESS - Protocol was installed successfully
+ @exception EFI_UNSUPPORTED - Protocol was not installed
+ @retval EFI_NOT_FOUND - Protocol can't be found.
+ @retval EFI_OUT_OF_RESOURCES - Protocol does not have enough resources to initialize the driver.
+**/
+EFI_STATUS
+SmmAccessDriverEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
+ UINTN Index;
+ EFI_SMRAM_HOB_DESCRIPTOR_BLOCK *DescriptorBlock;
+ EFI_PEI_HOB_POINTERS *Hob;
+
+ ///
+ /// --cr-- INITIALIZE_SCRIPT (ImageHandle, SystemTable);
+ ///
+ /// Initialize Global variables
+ ///
+ ZeroMem (&mSmmAccess, sizeof (mSmmAccess));
+
+ Status = gBS->LocateProtocol (
+ &gEfiPciRootBridgeIoProtocolGuid,
+ NULL,
+ (VOID **) &PciRootBridgeIo
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "Could not locate PCI Root Bridge IO Protocol\n"));
+ return EFI_NOT_FOUND;
+ }
+
+ mSmmAccess.Signature = SMM_ACCESS_PRIVATE_DATA_SIGNATURE;
+ mSmmAccess.Handle = NULL;
+ mSmmAccess.PciRootBridgeIo = PciRootBridgeIo;
+
+ ///
+ /// Get Hob list
+ ///
+ Hob = GetFirstGuidHob (&gEfiSmmPeiSmramMemoryReserve);
+ if (Hob == NULL) {
+ DEBUG ((EFI_D_ERROR, "SmramMemoryReserve HOB not found\n"));
+ return EFI_NOT_FOUND;
+ }
+
+ DescriptorBlock = (VOID *) ((UINT8 *) Hob + sizeof (EFI_HOB_GUID_TYPE));
+
+ ///
+ /// Alloc space for mSmmAccess.SmramDesc
+ ///
+ mSmmAccess.SmramDesc = AllocateZeroPool ((DescriptorBlock->NumberOfSmmReservedRegions) * sizeof (EFI_SMRAM_DESCRIPTOR));
+ if (mSmmAccess.SmramDesc == NULL) {
+ DEBUG ((EFI_D_ERROR, "Alloc mSmmAccess.SmramDesc fail.\n"));
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ DEBUG ((EFI_D_INFO, "Alloc mSmmAccess.SmramDesc success.\n"));
+
+ ///
+ /// Use the HOB to publish SMRAM capabilities
+ ///
+ for (Index = 0; Index < DescriptorBlock->NumberOfSmmReservedRegions; Index++) {
+ mSmmAccess.SmramDesc[Index].PhysicalStart = DescriptorBlock->Descriptor[Index].PhysicalStart;
+ mSmmAccess.SmramDesc[Index].CpuStart = DescriptorBlock->Descriptor[Index].CpuStart;
+ mSmmAccess.SmramDesc[Index].PhysicalSize = DescriptorBlock->Descriptor[Index].PhysicalSize;
+ mSmmAccess.SmramDesc[Index].RegionState = DescriptorBlock->Descriptor[Index].RegionState;
+ }
+
+ mSmmAccess.NumberRegions = Index;
+ mSmmAccess.SmmAccess.Open = Open;
+ mSmmAccess.SmmAccess.Close = Close;
+ mSmmAccess.SmmAccess.Lock = Lock;
+ mSmmAccess.SmmAccess.GetCapabilities = GetCapabilities;
+ mSmmAccess.SmmAccess.LockState = FALSE;
+ mSmmAccess.SmmAccess.OpenState = FALSE;
+
+ ///
+ /// Install our protocol interfaces on the device's handle
+ ///
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &mSmmAccess.Handle,
+ &gEfiSmmAccessProtocolGuid,
+ &mSmmAccess.SmmAccess,
+ NULL
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "InstallMultipleProtocolInterfaces returned %r\n", Status));
+ return EFI_UNSUPPORTED;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This routine accepts a request to "open" a region of SMRAM. The
+ region could be legacy ABSEG, HSEG, or TSEG near top of physical memory.
+ The use of "open" means that the memory is visible from all boot-service
+ and SMM agents.
+
+ @param[in] This - Pointer to the SMM Access Interface.
+ @param[in] DescriptorIndex - Region of SMRAM to Open.
+
+ @retval EFI_SUCCESS - The region was successfully opened.
+ @retval EFI_DEVICE_ERROR - The region could not be opened because locked by
+ chipset.
+ @retval EFI_INVALID_PARAMETER - The descriptor index was out of bounds.
+**/
+EFI_STATUS
+EFIAPI
+Open (
+ IN EFI_SMM_ACCESS_PROTOCOL *This,
+ UINTN DescriptorIndex
+ )
+{
+ EFI_STATUS Status;
+ SMM_ACCESS_PRIVATE_DATA *SmmAccess;
+ UINT64 Address;
+ UINT8 SmramControl;
+
+ SmmAccess = SMM_ACCESS_PRIVATE_DATA_FROM_THIS (This);
+
+ if (DescriptorIndex >= SmmAccess->NumberRegions) {
+ DEBUG ((EFI_D_WARN, "SMRAM region out of range\n"));
+ return EFI_INVALID_PARAMETER;
+ } else if (SmmAccess->SmramDesc[DescriptorIndex].RegionState & EFI_SMRAM_LOCKED) {
+ ///
+ /// Cannot open a "locked" region
+ ///
+ DEBUG ((EFI_D_WARN, "Cannot open a locked SMRAM region\n"));
+
+ return EFI_DEVICE_ERROR;
+ }
+ ///
+ /// BEGIN CHIPSET SPECIFIC CODE
+ ///
+ ///
+ /// SMRAM register is PCI 0:0:0:88, SMRAMC (8 bit)
+ ///
+ Address = EFI_PCI_ADDRESS (SA_MC_BUS, SA_MC_DEV, SA_MC_FUN, R_SA_SMRAMC);
+
+ Status = SmmAccess->PciRootBridgeIo->Pci.Read (
+ SmmAccess->PciRootBridgeIo,
+ EfiPciWidthUint8,
+ Address,
+ 1,
+ &SmramControl
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "SmmAccess->PciRootBridgeIo->Pci.Read returned %r\n", Status));
+ return Status;
+ }
+ ///
+ /// Is SMRAM locked?
+ ///
+ if ((SmramControl & B_SA_SMRAMC_D_LCK_MASK) != 0) {
+ ///
+ /// Cannot Open a locked region
+ ///
+ SmmAccess->SmramDesc[DescriptorIndex].RegionState |= EFI_SMRAM_LOCKED;
+ DEBUG ((EFI_D_WARN, "Cannot open a locked SMRAM region\n"));
+ return EFI_DEVICE_ERROR;
+ }
+ ///
+ /// Open SMRAM region
+ ///
+ SmramControl |= B_SA_SMRAMC_D_OPEN_MASK;
+ SmramControl &= ~(B_SA_SMRAMC_D_CLS_MASK);
+
+ Status = SmmAccess->PciRootBridgeIo->Pci.Write (
+ SmmAccess->PciRootBridgeIo,
+ EfiPciWidthUint8,
+ Address,
+ 1,
+ &SmramControl
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "SmmAccess->PciRootBridgeIo->Pci.Write returned %r\n", Status));
+ return Status;
+ }
+ ///
+ /// END CHIPSET SPECIFIC CODE
+ ///
+ SmmAccess->SmramDesc[DescriptorIndex].RegionState &= ~(EFI_SMRAM_CLOSED | EFI_ALLOCATED);
+ SmmAccess->SmramDesc[DescriptorIndex].RegionState |= EFI_SMRAM_OPEN;
+ SmmAccess->SmmAccess.OpenState = TRUE;
+ return EFI_SUCCESS;
+}
+
+/**
+ This routine accepts a request to "close" a region of SMRAM. The
+ region could be legacy AB or TSEG near top of physical memory.
+ The use of "close" means that the memory is only visible from SMM agents,
+ not from BS or RT code.
+
+ @param[in] This - Pointer to the SMM Access Interface.
+ @param[in] DescriptorIndex - Region of SMRAM to Close.
+
+ @retval EFI_SUCCESS - The region was successfully closed.
+ @retval EFI_DEVICE_ERROR - The region could not be closed because locked by
+ chipset.
+ @retval EFI_INVALID_PARAMETER - The descriptor index was out of bounds.
+**/
+EFI_STATUS
+EFIAPI
+Close (
+ IN EFI_SMM_ACCESS_PROTOCOL *This,
+ UINTN DescriptorIndex
+ )
+{
+ EFI_STATUS Status;
+ SMM_ACCESS_PRIVATE_DATA *SmmAccess;
+ UINT64 Address;
+ BOOLEAN OpenState;
+ UINT8 Index;
+ UINT8 SmramControl;
+
+ SmmAccess = SMM_ACCESS_PRIVATE_DATA_FROM_THIS (This);
+
+ if (DescriptorIndex >= SmmAccess->NumberRegions) {
+ DEBUG ((EFI_D_WARN, "SMRAM region out of range\n"));
+ return EFI_INVALID_PARAMETER;
+ } else if (SmmAccess->SmramDesc[DescriptorIndex].RegionState & EFI_SMRAM_LOCKED) {
+ ///
+ /// Cannot close a "locked" region
+ ///
+ DEBUG ((EFI_D_WARN, "Cannot close a locked SMRAM region\n"));
+ return EFI_DEVICE_ERROR;
+ }
+
+ if (SmmAccess->SmramDesc[DescriptorIndex].RegionState & EFI_SMRAM_CLOSED) {
+ return EFI_DEVICE_ERROR;
+ }
+ ///
+ /// SMRAM register is PCI 0:0:0:88, SMRAMC (8 bit)
+ ///
+ Address = EFI_PCI_ADDRESS (SA_MC_BUS, SA_MC_DEV, SA_MC_FUN, R_SA_SMRAMC);
+
+ Status = SmmAccess->PciRootBridgeIo->Pci.Read (
+ SmmAccess->PciRootBridgeIo,
+ EfiPciWidthUint8,
+ Address,
+ 1,
+ &SmramControl
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "SmmAccess->PciRootBridgeIo->Pci.Read returned %r\n", Status));
+ return Status;
+ }
+ ///
+ /// Is SMRAM locked?
+ ///
+ if ((SmramControl & B_SA_SMRAMC_D_LCK_MASK) != 0) {
+ ///
+ /// Cannot Close a locked region
+ ///
+ SmmAccess->SmramDesc[DescriptorIndex].RegionState |= EFI_SMRAM_LOCKED;
+ DEBUG ((EFI_D_WARN, "Cannot close a locked SMRAM region\n"));
+ return EFI_DEVICE_ERROR;
+ }
+ ///
+ /// Close SMRAM region
+ ///
+ SmramControl &= ~(B_SA_SMRAMC_D_OPEN_MASK);
+
+ Status = SmmAccess->PciRootBridgeIo->Pci.Write (
+ SmmAccess->PciRootBridgeIo,
+ EfiPciWidthUint8,
+ Address,
+ 1,
+ &SmramControl
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "SmmAccess->PciRootBridgeIo->Pci.Write returned %r\n", Status));
+ return Status;
+ }
+ ///
+ /// END CHIPSET SPECIFIC CODE
+ ///
+ SmmAccess->SmramDesc[DescriptorIndex].RegionState &= ~EFI_SMRAM_OPEN;
+ SmmAccess->SmramDesc[DescriptorIndex].RegionState |= (EFI_SMRAM_CLOSED | EFI_ALLOCATED);
+
+ ///
+ /// Find out if any regions are still open
+ ///
+ OpenState = FALSE;
+ for (Index = 0; Index < mSmmAccess.NumberRegions; Index++) {
+ if ((SmmAccess->SmramDesc[Index].RegionState & EFI_SMRAM_OPEN) == EFI_SMRAM_OPEN) {
+ OpenState = TRUE;
+ }
+ }
+
+ SmmAccess->SmmAccess.OpenState = OpenState;
+ return EFI_SUCCESS;
+}
+
+/**
+ This routine accepts a request to "lock" SMRAM. The
+ region could be legacy AB or TSEG near top of physical memory.
+ The use of "lock" means that the memory can no longer be opened
+ to BS state..
+
+ @param[in] This - Pointer to the SMM Access Interface.
+ @param[in] DescriptorIndex - Region of SMRAM to Lock.
+
+ @retval EFI_SUCCESS - The region was successfully locked.
+ @retval EFI_DEVICE_ERROR - The region could not be locked because at least
+ one range is still open.
+ @retval EFI_INVALID_PARAMETER - The descriptor index was out of bounds.
+**/
+EFI_STATUS
+EFIAPI
+Lock (
+ IN EFI_SMM_ACCESS_PROTOCOL *This,
+ UINTN DescriptorIndex
+ )
+{
+ EFI_STATUS Status;
+ SMM_ACCESS_PRIVATE_DATA *SmmAccess;
+ UINT64 Address;
+ UINT8 SmramControl;
+
+ SmmAccess = SMM_ACCESS_PRIVATE_DATA_FROM_THIS (This);
+
+ if (DescriptorIndex >= SmmAccess->NumberRegions) {
+ DEBUG ((EFI_D_WARN, "SMRAM region out of range\n"));
+ return EFI_INVALID_PARAMETER;
+ } else if (SmmAccess->SmmAccess.OpenState) {
+ DEBUG ((EFI_D_WARN, "Cannot lock SMRAM when SMRAM regions are still open\n"));
+ return EFI_DEVICE_ERROR;
+ }
+
+ SmmAccess->SmramDesc[DescriptorIndex].RegionState |= EFI_SMRAM_LOCKED;
+ SmmAccess->SmmAccess.LockState = TRUE;
+
+ ///
+ /// SMRAM register is PCI 0:0:0:88, SMRAMC (8 bit)
+ ///
+ Address = EFI_PCI_ADDRESS (SA_MC_BUS, SA_MC_DEV, SA_MC_FUN, R_SA_SMRAMC);
+
+ Status = SmmAccess->PciRootBridgeIo->Pci.Read (
+ SmmAccess->PciRootBridgeIo,
+ EfiPciWidthUint8,
+ Address,
+ 1,
+ &SmramControl
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "SmmAccess->PciRootBridgeIo->Pci.Read returned %r\n", Status));
+ return Status;
+ }
+ ///
+ /// Lock the SMRAM
+ ///
+ SmramControl |= B_SA_SMRAMC_D_LCK_MASK;
+
+ Status = SmmAccess->PciRootBridgeIo->Pci.Write (
+ SmmAccess->PciRootBridgeIo,
+ EfiPciWidthUint8,
+ Address,
+ 1,
+ &SmramControl
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "SmmAccess->PciRootBridgeIo->Pci.Write returned %r\n", Status));
+ return Status;
+ }
+ ///
+ /// END CHIPSET SPECIFIC CODE
+ ///
+ return EFI_SUCCESS;
+}
+
+/**
+ This routine services a user request to discover the SMRAM
+ capabilities of this platform. This will report the possible
+ ranges that are possible for SMRAM access, based upon the
+ memory controller capabilities.
+
+ @param[in] This - Pointer to the SMRAM Access Interface.
+ @param[in] SmramMapSize - Pointer to the variable containing size of the
+ buffer to contain the description information.
+ @param[in] SmramMap - Buffer containing the data describing the Smram
+ region descriptors.
+
+ @retval EFI_BUFFER_TOO_SMALL - The user did not provide a sufficient buffer.
+ @retval EFI_SUCCESS - The user provided a sufficiently-sized buffer.
+**/
+EFI_STATUS
+EFIAPI
+GetCapabilities (
+ IN EFI_SMM_ACCESS_PROTOCOL *This,
+ IN OUT UINTN *SmramMapSize,
+ IN OUT EFI_SMRAM_DESCRIPTOR *SmramMap
+ )
+{
+ EFI_STATUS Status;
+ SMM_ACCESS_PRIVATE_DATA *SmmAccess;
+ UINTN NecessaryBufferSize;
+
+ SmmAccess = SMM_ACCESS_PRIVATE_DATA_FROM_THIS (This);
+
+ NecessaryBufferSize = SmmAccess->NumberRegions * sizeof (EFI_SMRAM_DESCRIPTOR);
+
+ if (*SmramMapSize < NecessaryBufferSize) {
+ DEBUG ((EFI_D_WARN, "SMRAM Map Buffer too small\n"));
+ Status = EFI_BUFFER_TOO_SMALL;
+ } else {
+ CopyMem (SmramMap, SmmAccess->SmramDesc, NecessaryBufferSize);
+ Status = EFI_SUCCESS;
+ }
+
+ *SmramMapSize = NecessaryBufferSize;
+
+ return Status;
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/SmmAccess/Dxe/SmmAccessDriver.h b/ReferenceCode/Chipset/SystemAgent/SmmAccess/Dxe/SmmAccessDriver.h
new file mode 100644
index 0000000..4d98f27
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SmmAccess/Dxe/SmmAccessDriver.h
@@ -0,0 +1,178 @@
+/** @file
+ Header file for SMM Access Driver.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _SMM_ACCESS_DRIVER_H_
+#define _SMM_ACCESS_DRIVER_H_
+
+#include "EdkIIGlueDxe.h"
+#include "pci22.h"
+#include "EdkIIGlueHobLib.h"
+#include "EfiScriptLib.h"
+#include "SaAccess.h"
+
+///
+/// Driver Consumed Protocol Prototypes
+///
+#include EFI_PROTOCOL_CONSUMER (PciRootBridgeIo)
+
+///
+/// Driver private data
+///
+#include EFI_GUID_DEFINITION (SmramMemoryReserve)
+#include EFI_GUID_DEFINITION (Hob)
+#include EFI_PROTOCOL_DEFINITION (SmmAccess)
+
+#define SMM_ACCESS_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('4', '5', 's', 'a')
+
+///
+/// Private data
+///
+typedef struct {
+ UINTN Signature;
+ EFI_HANDLE Handle;
+ EFI_SMM_ACCESS_PROTOCOL SmmAccess;
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
+
+ ///
+ /// Local Data for SMM Access interface goes here
+ ///
+ UINTN NumberRegions;
+ EFI_SMRAM_DESCRIPTOR *SmramDesc;
+} SMM_ACCESS_PRIVATE_DATA;
+
+#define SMM_ACCESS_PRIVATE_DATA_FROM_THIS(a) \
+ CR (a, \
+ SMM_ACCESS_PRIVATE_DATA, \
+ SmmAccess, \
+ SMM_ACCESS_PRIVATE_DATA_SIGNATURE \
+ )
+
+///
+/// Prototypes
+/// Driver model protocol interface
+///
+/**
+ This is the standard EFI driver point that
+ installs an SMM Access Protocol
+
+ @param[in] ImageHandle - Handle for the image of this driver
+ @param[in] SystemTable - Pointer to the EFI System Table
+
+ @retval EFI_SUCCESS - Protocol was installed successfully
+ @exception EFI_UNSUPPORTED - Protocol was not installed
+**/
+EFI_STATUS
+SmmAccessDriverEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+;
+
+/**
+ This routine accepts a request to "open" a region of SMRAM. The
+ region could be legacy ABSEG, HSEG, or TSEG near top of physical memory.
+ The use of "open" means that the memory is visible from all boot-service
+ and SMM agents.
+
+ @param[in] This - Pointer to the SMM Access Interface.
+ @param[in] DescriptorIndex - Region of SMRAM to Open.
+
+ @retval EFI_SUCCESS - The region was successfully opened.
+ @retval EFI_DEVICE_ERROR - The region could not be opened because locked by
+ chipset.
+ @retval EFI_INVALID_PARAMETER - The descriptor index was out of bounds.
+**/
+EFI_STATUS
+EFIAPI
+Open (
+ IN EFI_SMM_ACCESS_PROTOCOL *This,
+ IN UINTN DescriptorIndex
+ )
+;
+
+/**
+ This routine accepts a request to "close" a region of SMRAM. The
+ region could be legacy AB or TSEG near top of physical memory.
+ The use of "close" means that the memory is only visible from SMM agents,
+ not from BS or RT code.
+
+ @param[in] This - Pointer to the SMM Access Interface.
+ @param[in] DescriptorIndex - Region of SMRAM to Close.
+
+ @retval EFI_SUCCESS - The region was successfully closed.
+ @retval EFI_DEVICE_ERROR - The region could not be closed because locked by
+ chipset.
+ @retval EFI_INVALID_PARAMETER - The descriptor index was out of bounds.
+**/
+EFI_STATUS
+EFIAPI
+Close (
+ IN EFI_SMM_ACCESS_PROTOCOL *This,
+ IN UINTN DescriptorIndex
+ )
+;
+
+/**
+ This routine accepts a request to "lock" SMRAM. The
+ region could be legacy AB or TSEG near top of physical memory.
+ The use of "lock" means that the memory can no longer be opened
+ to BS state..
+
+ @param[in] This - Pointer to the SMM Access Interface.
+ @param[in] DescriptorIndex - Region of SMRAM to Lock.
+
+ @retval EFI_SUCCESS - The region was successfully locked.
+ @retval EFI_DEVICE_ERROR - The region could not be locked because at least
+ one range is still open.
+ @retval EFI_INVALID_PARAMETER - The descriptor index was out of bounds.
+**/
+EFI_STATUS
+EFIAPI
+Lock (
+ IN EFI_SMM_ACCESS_PROTOCOL *This,
+ IN UINTN DescriptorIndex
+ )
+;
+
+/**
+ This routine services a user request to discover the SMRAM
+ capabilities of this platform. This will report the possible
+ ranges that are possible for SMRAM access, based upon the
+ memory controller capabilities.
+
+ @param[in] This - Pointer to the SMRAM Access Interface.
+ @param[in] SmramMapSize - Pointer to the variable containing size of the
+ buffer to contain the description information.
+ @param[in] SmramMap - Buffer containing the data describing the Smram
+ region descriptors.
+
+ @retval EFI_BUFFER_TOO_SMALL - The user did not provide a sufficient buffer.
+ @retval EFI_SUCCESS - The user provided a sufficiently-sized buffer.
+**/
+EFI_STATUS
+EFIAPI
+GetCapabilities (
+ IN EFI_SMM_ACCESS_PROTOCOL *This,
+ IN OUT UINTN *SmramMapSize,
+ IN OUT EFI_SMRAM_DESCRIPTOR *SmramMap
+ )
+;
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/SmmAccess/Pei/SmmAccess.inf b/ReferenceCode/Chipset/SystemAgent/SmmAccess/Pei/SmmAccess.inf
new file mode 100644
index 0000000..99b2a6d
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SmmAccess/Pei/SmmAccess.inf
@@ -0,0 +1,91 @@
+## @file
+# Component description file for the SmmAccess module
+#
+#@copyright
+# Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+##
+
+[defines]
+BASE_NAME = SmmAccess
+FILE_GUID = 6ECFCE51-5724-450c-A38A-58553E954422
+COMPONENT_TYPE = PE32_PEIM
+
+[sources.common]
+ SmmAccessPeim.h
+ SmmAccessPeim.c
+
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGluePeimEntryPoint.c
+
+[includes.common]
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Pei/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Include
+ $(EDK_SOURCE)/Foundation/Cpu/Pentium/Include
+ $(CLIENT_COMMON_ECP_SOURCE)
+
+#
+# Edk II Glue Library, some hearder are included by R9 header so have to include
+#
+
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Framework
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[libraries.common]
+ EdkIIGlueBaseLib
+ EdkIIGlueBaseMemoryLib
+ EdkIIGluePeiDebugLibReportStatusCode
+ EdkIIGluePeiReportStatusCodeLib
+ EdkIIGluePeiServicesLib
+ EdkIIGluePeiHobLib
+ EdkIIGlueBasePciLibPciExpress
+ EdkIIGluePeiMemoryAllocationLib
+ IntelSaSampleCodePpiLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT=_ModuleEntryPoint
+ DPX_SOURCE=SmmAccessPeim.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=SmmAccessPeimEntryPoint
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_LIB__ \
+ -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_PEI_HOB_LIB__ \
+ -D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+ -D __EDKII_GLUE_PEI_MEMORY_ALLOCATION_LIB__ \
+ -D __EDKII_GLUE_PEI_SERVICES_LIB__
diff --git a/ReferenceCode/Chipset/SystemAgent/SmmAccess/Pei/SmmAccessPeim.c b/ReferenceCode/Chipset/SystemAgent/SmmAccess/Pei/SmmAccessPeim.c
new file mode 100644
index 0000000..fc2ab44
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SmmAccess/Pei/SmmAccessPeim.c
@@ -0,0 +1,407 @@
+/** @file
+ This is the driver that publishes the SMM Access Ppi
+ instance.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#include "SmmAccessPeim.h"
+#include "CpuIA32.h"
+#endif
+
+/**
+ This is the standard PEIM entry point that
+ installs an SMM Access PPI
+
+ @param[in] FfsHeader - FfsHeader.
+ @param[in] PeiServices - General purpose services available to every PEIM.
+
+ @retval EFI_SUCCESS - Protocol successfully started and installed.
+ @exception EFI_UNSUPPORTED - Protocol can't be started.
+ @retval EFI_NOT_FOUND - Protocol can't be found.
+ @retval EFI_OUT_OF_RESOURCES - Protocol does not have enough resources to initialize the driver.
+**/
+EFI_STATUS
+EFIAPI
+SmmAccessPeimEntryPoint (
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_STATUS Status;
+ UINT32 PciVidDid;
+ UINTN Index;
+ EFI_PEI_PPI_DESCRIPTOR *PpiList;
+ EFI_SMRAM_HOB_DESCRIPTOR_BLOCK *DescriptorBlock;
+ SMM_ACCESS_PRIVATE_DATA *SmmAccessPrivate;
+ VOID *HobList;
+ EFI_BOOT_MODE BootMode;
+
+ Status = (*PeiServices)->GetBootMode (PeiServices, &BootMode);
+ if (EFI_ERROR (Status)) {
+ ///
+ /// If not in S3 boot path. do nothing
+ ///
+ return EFI_SUCCESS;
+ }
+
+ if (BootMode != BOOT_ON_S3_RESUME) {
+ return EFI_SUCCESS;
+ }
+ ///
+ /// Initialize private data
+ ///
+ SmmAccessPrivate = AllocateZeroPool (sizeof (*SmmAccessPrivate));
+ PpiList = AllocateZeroPool (sizeof (*PpiList));
+
+ ///
+ /// Check if the chipset is supported
+ /// by this driver. Read the PCI Configuration Header for this device.
+ ///
+ PciVidDid = PciRead32 (PCI_LIB_ADDRESS (SA_MC_BUS, SA_MC_DEV, SA_MC_FUN, 0));
+
+ SmmAccessPrivate->Signature = SMM_ACCESS_PRIVATE_DATA_SIGNATURE;
+ SmmAccessPrivate->Handle = NULL;
+
+ ///
+ /// Get Hob list
+ ///
+ HobList = GetFirstGuidHob (&gEfiSmmPeiSmramMemoryReserve);
+ if (HobList == NULL) {
+ DEBUG ((EFI_D_ERROR, "SmramMemoryReserve HOB not found\n"));
+ return EFI_NOT_FOUND;
+ }
+
+ DescriptorBlock = (EFI_SMRAM_HOB_DESCRIPTOR_BLOCK *) ((UINT8 *) HobList + sizeof (EFI_HOB_GUID_TYPE));
+
+ ///
+ /// Alloc space for SmmAccessPrivate->SmramDesc
+ ///
+ SmmAccessPrivate->SmramDesc = AllocateZeroPool ((DescriptorBlock->NumberOfSmmReservedRegions) * sizeof (EFI_SMRAM_DESCRIPTOR));
+ if (SmmAccessPrivate->SmramDesc == NULL) {
+ DEBUG ((EFI_D_ERROR, "Alloc SmmAccessPrivate->SmramDesc fail.\n"));
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ DEBUG ((EFI_D_INFO, "Alloc SmmAccessPrivate->SmramDesc success.\n"));
+
+ ///
+ /// use the hob to publish SMRAM capabilities
+ ///
+ for (Index = 0; Index < DescriptorBlock->NumberOfSmmReservedRegions; Index++) {
+ SmmAccessPrivate->SmramDesc[Index].PhysicalStart = DescriptorBlock->Descriptor[Index].PhysicalStart;
+ SmmAccessPrivate->SmramDesc[Index].CpuStart = DescriptorBlock->Descriptor[Index].CpuStart;
+ SmmAccessPrivate->SmramDesc[Index].PhysicalSize = DescriptorBlock->Descriptor[Index].PhysicalSize;
+ SmmAccessPrivate->SmramDesc[Index].RegionState = DescriptorBlock->Descriptor[Index].RegionState;
+ }
+
+ SmmAccessPrivate->NumberRegions = Index;
+ SmmAccessPrivate->SmmAccess.Open = Open;
+ SmmAccessPrivate->SmmAccess.Close = Close;
+ SmmAccessPrivate->SmmAccess.Lock = Lock;
+ SmmAccessPrivate->SmmAccess.GetCapabilities = GetCapabilities;
+ SmmAccessPrivate->SmmAccess.LockState = FALSE;
+ SmmAccessPrivate->SmmAccess.OpenState = FALSE;
+
+ ///
+ /// Install PPI
+ ///
+ PpiList->Flags = (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST);
+ PpiList->Guid = &gPeiSmmAccessPpiGuid;
+ PpiList->Ppi = &SmmAccessPrivate->SmmAccess;
+
+ Status = PeiServicesInstallPpi (PpiList);
+ ASSERT_EFI_ERROR (Status);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This routine accepts a request to "open" a region of SMRAM. The
+ region could be legacy ABSEG, HSEG, or TSEG near top of physical memory.
+ The use of "open" means that the memory is visible from all PEIM
+ and SMM agents.
+
+ @param[in] This - Pointer to the SMM Access Interface.
+ @param[in] DescriptorIndex - Region of SMRAM to Open.
+ @param[in] PeiServices - General purpose services available to every PEIM.
+
+ @retval EFI_SUCCESS - The region was successfully opened.
+ @retval EFI_DEVICE_ERROR - The region could not be opened because locked by
+ chipset.
+ @retval EFI_INVALID_PARAMETER - The descriptor index was out of bounds.
+**/
+EFI_STATUS
+EFIAPI
+Open (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_SMM_ACCESS_PPI *This,
+ IN UINTN DescriptorIndex
+ )
+{
+ SMM_ACCESS_PRIVATE_DATA *SmmAccess;
+ SMRAM Smram;
+
+ SmmAccess = SMM_ACCESS_PRIVATE_DATA_FROM_THIS (This);
+ if (DescriptorIndex >= SmmAccess->NumberRegions) {
+ DEBUG ((EFI_D_WARN, "SMRAM region out of range\n"));
+
+ return EFI_INVALID_PARAMETER;
+ } else if (SmmAccess->SmramDesc[DescriptorIndex].RegionState & EFI_SMRAM_LOCKED) {
+ ///
+ /// Cannot open a "locked" region
+ ///
+ DEBUG ((EFI_D_WARN, "Cannot open a locked SMRAM region\n"));
+
+ return EFI_DEVICE_ERROR;
+ }
+ ///
+ /// BEGIN CHIPSET SPECIFIC CODE
+ ///
+ ///
+ /// SMRAM register is PCI 0:0:0:88, SMRAMC (8 bit)
+ ///
+ Smram = PciRead32 (PCI_LIB_ADDRESS (SA_MC_BUS, SA_MC_DEV, SA_MC_FUN, R_SA_SMRAMC));
+
+ ///
+ /// Is SMRAM locked?
+ ///
+ if (Smram & B_SA_SMRAMC_D_LCK_MASK) {
+ ///
+ /// Cannot Open a locked region
+ ///
+ SmmAccess->SmramDesc[DescriptorIndex].RegionState |= EFI_SMRAM_LOCKED;
+ DEBUG ((EFI_D_WARN, "Cannot open a locked SMRAM region\n"));
+
+ return EFI_DEVICE_ERROR;
+ }
+ ///
+ /// Open SMRAM region
+ ///
+ Smram |= B_SA_SMRAMC_D_OPEN_MASK;
+ Smram &= ~(B_SA_SMRAMC_D_CLS_MASK);
+
+ ///
+ /// Write the SMRAMC register
+ ///
+ PciWrite32 (PCI_LIB_ADDRESS (SA_MC_BUS, SA_MC_DEV, SA_MC_FUN, R_SA_SMRAMC), Smram);
+
+ ///
+ /// END CHIPSET SPECIFIC CODE
+ ///
+ SmmAccess->SmramDesc[DescriptorIndex].RegionState &= ~(EFI_SMRAM_CLOSED | EFI_ALLOCATED);
+ SmmAccess->SmramDesc[DescriptorIndex].RegionState |= EFI_SMRAM_OPEN;
+ SmmAccess->SmmAccess.OpenState = TRUE;
+ return EFI_SUCCESS;
+}
+
+/**
+ This routine accepts a request to "close" a region of SMRAM. This is valid for
+ compatible SMRAM region.
+
+ @param[in] PeiServices - General purpose services available to every PEIM.
+ @param[in] This - Pointer to the SMM Access Interface.
+ @param[in] DescriptorIndex - Region of SMRAM to Close.
+
+ @retval EFI_SUCCESS - The region was successfully closed.
+ @retval EFI_DEVICE_ERROR - The region could not be closed because locked by
+ chipset.
+ @retval EFI_INVALID_PARAMETER - The descriptor index was out of bounds.
+**/
+EFI_STATUS
+EFIAPI
+Close (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_SMM_ACCESS_PPI *This,
+ IN UINTN DescriptorIndex
+ )
+{
+ SMM_ACCESS_PRIVATE_DATA *SmmAccess;
+ BOOLEAN OpenState;
+ UINT8 Index;
+ SMRAM Smram;
+
+ SmmAccess = SMM_ACCESS_PRIVATE_DATA_FROM_THIS (This);
+ if (DescriptorIndex >= SmmAccess->NumberRegions) {
+ DEBUG ((EFI_D_WARN, "SMRAM region out of range\n"));
+
+ return EFI_INVALID_PARAMETER;
+ } else if (SmmAccess->SmramDesc[DescriptorIndex].RegionState & EFI_SMRAM_LOCKED) {
+ ///
+ /// Cannot close a "locked" region
+ ///
+ DEBUG ((EFI_D_WARN, "Cannot close a locked SMRAM region\n"));
+
+ return EFI_DEVICE_ERROR;
+ }
+
+ if (SmmAccess->SmramDesc[DescriptorIndex].RegionState & EFI_SMRAM_CLOSED) {
+ return EFI_DEVICE_ERROR;
+ }
+ ///
+ /// SMRAM register is PCI 0:0:0:88, SMRAMC (8 bit)
+ ///
+ Smram = PciRead32 (PCI_LIB_ADDRESS (SA_MC_BUS, SA_MC_DEV, SA_MC_FUN, R_SA_SMRAMC));
+
+ ///
+ /// Is SMRAM locked?
+ ///
+ if ((Smram & B_SA_SMRAMC_D_LCK_MASK) != 0) {
+ ///
+ /// Cannot Close a locked region
+ ///
+ SmmAccess->SmramDesc[DescriptorIndex].RegionState |= EFI_SMRAM_LOCKED;
+ DEBUG ((EFI_D_WARN, "Cannot close a locked SMRAM region\n"));
+ return EFI_DEVICE_ERROR;
+ }
+ ///
+ /// Close SMRAM region
+ ///
+ Smram &= ~(B_SA_SMRAMC_D_OPEN_MASK);
+
+ ///
+ /// Write the SAD_SMRAM register
+ ///
+ PciWrite32 (PCI_LIB_ADDRESS (SA_MC_BUS, SA_MC_DEV, SA_MC_FUN, R_SA_SMRAMC), Smram);
+
+ ///
+ /// END CHIPSET SPECIFIC CODE
+ ///
+ SmmAccess->SmramDesc[DescriptorIndex].RegionState &= ~EFI_SMRAM_OPEN;
+ SmmAccess->SmramDesc[DescriptorIndex].RegionState |= (EFI_SMRAM_CLOSED | EFI_ALLOCATED);
+
+ ///
+ /// Find out if any regions are still open
+ ///
+ OpenState = FALSE;
+ for (Index = 0; Index < SmmAccess->NumberRegions; Index++) {
+ if ((SmmAccess->SmramDesc[Index].RegionState & EFI_SMRAM_OPEN) == EFI_SMRAM_OPEN) {
+ OpenState = TRUE;
+ }
+ }
+
+ SmmAccess->SmmAccess.OpenState = OpenState;
+ return EFI_SUCCESS;
+}
+
+/**
+ This routine accepts a request to "lock" SMRAM. The
+ region could be legacy AB or TSEG near top of physical memory.
+ The use of "lock" means that the memory can no longer be opened
+ to PEIM.
+
+ @param[in] PeiServices - General purpose services available to every PEIM.
+ @param[in] This - Pointer to the SMM Access Interface.
+ @param[in] DescriptorIndex - Region of SMRAM to Lock.
+
+ @retval EFI_SUCCESS - The region was successfully locked.
+ @retval EFI_DEVICE_ERROR - The region could not be locked because at least
+ one range is still open.
+ @retval EFI_INVALID_PARAMETER - The descriptor index was out of bounds.
+**/
+EFI_STATUS
+EFIAPI
+Lock (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_SMM_ACCESS_PPI *This,
+ IN UINTN DescriptorIndex
+ )
+{
+ SMM_ACCESS_PRIVATE_DATA *SmmAccess;
+ SMRAM Smram;
+
+ SmmAccess = SMM_ACCESS_PRIVATE_DATA_FROM_THIS (This);
+ if (DescriptorIndex >= SmmAccess->NumberRegions) {
+ DEBUG ((EFI_D_WARN, "SMRAM region out of range\n"));
+
+ return EFI_INVALID_PARAMETER;
+ } else if (SmmAccess->SmmAccess.OpenState) {
+ DEBUG ((EFI_D_WARN, "Cannot lock SMRAM when SMRAM regions are still open\n"));
+
+ return EFI_DEVICE_ERROR;
+ }
+
+ SmmAccess->SmramDesc[DescriptorIndex].RegionState |= EFI_SMRAM_LOCKED;
+ SmmAccess->SmmAccess.LockState = TRUE;
+
+ ///
+ /// Read the SAD_SMRAM register
+ ///
+ Smram = PciRead32 (PCI_LIB_ADDRESS (SA_MC_BUS, SA_MC_DEV, SA_MC_FUN, R_SA_SMRAMC));
+
+ ///
+ /// Lock the chipset
+ ///
+ Smram |= B_SA_SMRAMC_D_LCK_MASK;
+
+ ///
+ /// Write the SAD_SMRAM register
+ ///
+ PciWrite32 (PCI_LIB_ADDRESS (SA_MC_BUS, SA_MC_DEV, SA_MC_FUN, R_SA_SMRAMC), Smram);
+
+ ///
+ /// END CHIPSET SPECIFIC CODE
+ ///
+ return EFI_SUCCESS;
+}
+
+/**
+ This routine services a user request to discover the SMRAM
+ capabilities of this platform. This will report the possible
+ ranges that are possible for SMRAM access, based upon the
+ memory controller capabilities.
+
+ @param[in] PeiServices - General purpose services available to every PEIM.
+ @param[in] This - Pointer to the SMRAM Access Interface.
+ @param[in] SmramMapSize - Pointer to the variable containing size of the
+ buffer to contain the description information.
+ @param[in] SmramMap - Buffer containing the data describing the Smram
+ region descriptors.
+
+ @retval EFI_BUFFER_TOO_SMALL - The user did not provide a sufficient buffer.
+ @retval EFI_SUCCESS - The user provided a sufficiently-sized buffer.
+**/
+EFI_STATUS
+EFIAPI
+GetCapabilities (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_SMM_ACCESS_PPI *This,
+ IN OUT UINTN *SmramMapSize,
+ IN OUT EFI_SMRAM_DESCRIPTOR *SmramMap
+ )
+{
+ EFI_STATUS Status;
+ SMM_ACCESS_PRIVATE_DATA *SmmAccess;
+ UINTN NecessaryBufferSize;
+
+ SmmAccess = SMM_ACCESS_PRIVATE_DATA_FROM_THIS (This);
+ NecessaryBufferSize = SmmAccess->NumberRegions * sizeof (EFI_SMRAM_DESCRIPTOR);
+ if (*SmramMapSize < NecessaryBufferSize) {
+ DEBUG ((EFI_D_WARN, "SMRAM Map Buffer too small\n"));
+
+ Status = EFI_BUFFER_TOO_SMALL;
+ } else {
+ CopyMem (SmramMap, SmmAccess->SmramDesc, NecessaryBufferSize);
+ Status = EFI_SUCCESS;
+ }
+
+ *SmramMapSize = NecessaryBufferSize;
+ return Status;
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/SmmAccess/Pei/SmmAccessPeim.cif b/ReferenceCode/Chipset/SystemAgent/SmmAccess/Pei/SmmAccessPeim.cif
new file mode 100644
index 0000000..d7f3ab1
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SmmAccess/Pei/SmmAccessPeim.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "SmmAccessPeim"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\SystemAgent\SmmAccess\Pei"
+ RefName = "SmmAccessPeim"
+[files]
+"SmmAccessPeim.sdl"
+"SmmAccessPeim.mak"
+"SmmAccessPeim.c"
+"SmmAccessPeim.h"
+"SmmAccessPeim.dxs"
+"SmmAccess.inf"
+<endComponent>
diff --git a/ReferenceCode/Chipset/SystemAgent/SmmAccess/Pei/SmmAccessPeim.dxs b/ReferenceCode/Chipset/SystemAgent/SmmAccess/Pei/SmmAccessPeim.dxs
new file mode 100644
index 0000000..34e3dde
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SmmAccess/Pei/SmmAccessPeim.dxs
@@ -0,0 +1,29 @@
+/** @file
+ Dependency expression file for Smm Access PEIM.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+
+#include "EfiDepex.h"
+#include EFI_PPI_CONSUMER (MemoryDiscovered)
+#include EFI_PPI_CONSUMER (BootMode)
+
+DEPENDENCY_START
+ PEI_PERMANENT_MEMORY_INSTALLED_PPI_GUID AND
+ PEI_MASTER_BOOT_MODE_PEIM_PPI
+DEPENDENCY_END
diff --git a/ReferenceCode/Chipset/SystemAgent/SmmAccess/Pei/SmmAccessPeim.h b/ReferenceCode/Chipset/SystemAgent/SmmAccess/Pei/SmmAccessPeim.h
new file mode 100644
index 0000000..c89cdaf
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SmmAccess/Pei/SmmAccessPeim.h
@@ -0,0 +1,186 @@
+/** @file
+ Header file for SMM Access Driver.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _SMM_ACCESS_DRIVER_H_
+#define _SMM_ACCESS_DRIVER_H_
+
+#include "pci22.h"
+#include "SaAccess.h"
+
+///
+/// Driver Consumed Protocol Prototypes
+///
+///
+/// Driver Consumed GUID Prototypes
+///
+#include EFI_GUID_DEFINITION (SmramMemoryReserve)
+
+///
+/// Driver produced protocol
+///
+#include EFI_PPI_PRODUCER (SmmAccess)
+
+#define SMM_ACCESS_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('4', '5', 's', 'a')
+
+///
+/// SMM configuration register
+///
+typedef UINT32 SMRAM; /// System Management RAM Control
+///
+/// Private data
+///
+typedef struct {
+ UINTN Signature;
+ EFI_HANDLE Handle;
+ PEI_SMM_ACCESS_PPI SmmAccess;
+ ///
+ /// Local Data for SMM Access interface goes here
+ ///
+ UINTN NumberRegions;
+ EFI_SMRAM_DESCRIPTOR *SmramDesc;
+} SMM_ACCESS_PRIVATE_DATA;
+
+#define SMM_ACCESS_PRIVATE_DATA_FROM_THIS(a) \
+ PEI_CR (a, \
+ SMM_ACCESS_PRIVATE_DATA, \
+ SmmAccess, \
+ SMM_ACCESS_PRIVATE_DATA_SIGNATURE \
+ )
+
+///
+/// Prototypes
+/// Driver model protocol interface
+///
+/**
+ This is the standard PEIM entry point that
+ installs an SMM Access PPI
+
+ @param[in] FfsHeader - Pointer to an alleged FFS file.
+ @param[in] PeiServices - General purpose services available to every PEIM.
+
+ @retval EFI_STATUS - Protocol successfully started and installed
+**/
+EFI_STATUS
+EFIAPI
+SmmAccessPeimEntryPoint (
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+;
+
+/**
+ This routine accepts a request to "open" a region of SMRAM. The
+ region could be legacy ABSEG, HSEG, or TSEG near top of physical memory.
+ The use of "open" means that the memory is visible from all boot-service
+ and SMM agents.
+
+ @param[in] PeiServices - General purpose services available to every PEIM.
+ @param[in] This - Pointer to the SMM Access Interface.
+ @param[in] DescriptorIndex - Region of SMRAM to Open.
+
+ @retval EFI_SUCCESS - The region was successfully opened.
+ @retval EFI_DEVICE_ERROR - The region could not be opened because locked by
+ chipset.
+ @retval EFI_INVALID_PARAMETER - The descriptor index was out of bounds.
+**/
+EFI_STATUS
+EFIAPI
+Open (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_SMM_ACCESS_PPI *This,
+ IN UINTN DescriptorIndex
+ )
+;
+
+/**
+ This routine accepts a request to "close" a region of SMRAM. The
+ region could be legacy AB or TSEG near top of physical memory.
+ The use of "close" means that the memory is only visible from SMM agents,
+ not from BS or RT code.
+
+ @param[in] PeiServices - General purpose services available to every PEIM.
+ @param[in] This - Pointer to the SMM Access Interface.
+ @param[in] DescriptorIndex - Region of SMRAM to Close.
+
+ @retval EFI_SUCCESS - The region was successfully closed.
+ @retval EFI_DEVICE_ERROR - The region could not be closed because locked by
+ chipset.
+ @retval EFI_INVALID_PARAMETER - The descriptor index was out of bounds.
+**/
+EFI_STATUS
+EFIAPI
+Close (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_SMM_ACCESS_PPI *This,
+ IN UINTN DescriptorIndex
+ )
+;
+
+/**
+ This routine accepts a request to "lock" SMRAM. The
+ region could be legacy AB or TSEG near top of physical memory.
+ The use of "lock" means that the memory can no longer be opened
+ to BS state..
+
+ @param[in] PeiServices - General purpose services available to every PEIM.
+ @param[in] This - Pointer to the SMM Access Interface.
+ @param[in] DescriptorIndex - Region of SMRAM to Lock.
+
+ @retval EFI_SUCCESS - The region was successfully locked.
+ @retval EFI_DEVICE_ERROR - The region could not be locked because at least
+ one range is still open.
+ @retval EFI_INVALID_PARAMETER - The descriptor index was out of bounds.
+**/
+EFI_STATUS
+EFIAPI
+Lock (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_SMM_ACCESS_PPI *This,
+ IN UINTN DescriptorIndex
+ )
+;
+
+/**
+ This routine services a user request to discover the SMRAM
+ capabilities of this platform. This will report the possible
+ ranges that are possible for SMRAM access, based upon the
+ memory controller capabilities.
+
+ @param[in] PeiServices - General purpose services available to every PEIM.
+ @param[in] This - Pointer to the SMRAM Access Interface.
+ @param[in] SmramMapSize - Pointer to the variable containing size of the
+ buffer to contain the description information.
+ @param[in] SmramMap - Buffer containing the data describing the Smram
+ region descriptors.
+
+ @retval EFI_BUFFER_TOO_SMALL - The user did not provide a sufficient buffer.
+ @retval EFI_SUCCESS - The user provided a sufficiently-sized buffer.
+**/
+EFI_STATUS
+EFIAPI
+GetCapabilities (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_SMM_ACCESS_PPI *This,
+ IN OUT UINTN *SmramMapSize,
+ IN OUT EFI_SMRAM_DESCRIPTOR *SmramMap
+ )
+;
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/SmmAccess/Pei/SmmAccessPeim.mak b/ReferenceCode/Chipset/SystemAgent/SmmAccess/Pei/SmmAccessPeim.mak
new file mode 100644
index 0000000..1cea8ff
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SmmAccess/Pei/SmmAccessPeim.mak
@@ -0,0 +1,55 @@
+#---------------------------------------------------------------------------
+# Create SmmAccessPeim Driver
+#---------------------------------------------------------------------------
+EDK : SmmAccessPeim
+SmmAccessPeim : $(BUILD_DIR)\SmmAccessPeim.mak SmmAccessPeimBin
+
+$(BUILD_DIR)\SmmAccessPeim.mak : $(SmmAccessPeim_DIR)\$(@B).cif $(SmmAccessPeim_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(SmmAccessPeim_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+SmmAccessPeim_INCLUDES=\
+ $(EDK_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(INTEL_MCH_INCLUDES)\
+ $(INTEL_CPU_INCLUDES)\
+
+SmmAccessPeim_DEFINES = $(MY_DEFINES)\
+ /DMDE_CPU_IA32\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=SmmAccessPeimEntryPoint"\
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_PEI_SERVICES_LIB__ \
+ /D __EDKII_GLUE_PEI_MEMORY_ALLOCATION_LIB__ \
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+ /D __EDKII_GLUE_PEI_HOB_LIB__\
+
+SmmAccessPeim_LIB_LINKS =\
+ $(EDKFRAMEWORKGUIDLIB)\
+ $(EDKPPILIB)\
+ $(EdkIIGlueBaseLibIA32_LIB)\
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGluePeiDebugLibReportStatusCode_LIB)\
+ $(EdkIIGluePeiReportStatusCodeLib_LIB)\
+ $(EdkIIGluePeiServicesLib_LIB)\
+ $(EdkIIGluePeiMemoryAllocationLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(EdkIIGlueBasePciExpressLib_LIB)\
+ $(EdkIIGluePeiHobLib_LIB)\
+ $(IntelSaSampleCodePpiLib_LIB)\
+
+SmmAccessPeimBin: $(SmmAccessPeim_LIB_LINKS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\SmmAccessPeim.mak all\
+ NAME=SmmAccessPeim\
+ MAKEFILE=$(BUILD_DIR)\SmmAccessPeim.mak \
+ GUID=6ECFCE51-5724-450c-A38A-58553E954422\
+ "MY_INCLUDES=$(SmmAccessPeim_INCLUDES)"\
+ "MY_DEFINES=$(SmmAccessPeim_DEFINES)"\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=PEIM \
+ EDKIIModule=PEIM\
+ DEPEX1=$(SmmAccessPeim_DIR)\SmmAccessPeim.dxs DEPEX1_TYPE=EFI_SECTION_PEI_DEPEX \
+ COMPRESS=0
diff --git a/ReferenceCode/Chipset/SystemAgent/SmmAccess/Pei/SmmAccessPeim.sdl b/ReferenceCode/Chipset/SystemAgent/SmmAccess/Pei/SmmAccessPeim.sdl
new file mode 100644
index 0000000..2217ebd
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SmmAccess/Pei/SmmAccessPeim.sdl
@@ -0,0 +1,30 @@
+TOKEN
+ Name = "SmmAccessPeim_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable SmmAccess support in Project"
+ TokenType = Boolean
+ TargetMAK = Yes
+ Master = Yes
+ Token = "SMM_SUPPORT" "=" "1"
+End
+
+PATH
+ Name = "SmmAccessPeim_DIR"
+End
+
+MODULE
+ Help = "Includes SmmAccess to Project"
+ File = "SmmAccessPeim.mak"
+End
+
+ELINK
+ Name = "SmmAccessPeim"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\SmmAccessPeim.ffs"
+ Parent = "FV_BB"
+ InvokeOrder = AfterParent
+End
+
diff --git a/ReferenceCode/Chipset/SystemAgent/SystemAgent.cif b/ReferenceCode/Chipset/SystemAgent/SystemAgent.cif
new file mode 100644
index 0000000..7ddc687
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SystemAgent.cif
@@ -0,0 +1,27 @@
+<component>
+ name = "Intel SystemAgent NB Refcode"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\SystemAgent"
+ RefName = "Intel SystemAgent NB Refcode"
+[files]
+"SystemAgent.sdl"
+[parts]
+"MemoryInit"
+"PciHostBridge"
+"SmBiosMemory"
+"SmmAccess"
+"SmmAccessPeim"
+"SaAcpiTables"
+"SaGuidLib"
+"SaInclude"
+"SaPcieLib"
+"SaPcieDxeLib"
+"SaPcieSmmLib"
+"SaPpiLib"
+"SaProtocolLib"
+"SaSampleCode"
+"SaInitDxe"
+"SaInitPeim"
+"SaLateInitSmm"
+"BdatAccessHandler"
+<endComponent>
diff --git a/ReferenceCode/Chipset/SystemAgent/SystemAgent.sdl b/ReferenceCode/Chipset/SystemAgent/SystemAgent.sdl
new file mode 100644
index 0000000..48c6a4f
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SystemAgent.sdl
@@ -0,0 +1,337 @@
+TOKEN
+ Name = "SystemAgent_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable SystemAgent support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+End
+
+TOKEN
+ Name = "PEG_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetMAK = Yes
+End
+
+TOKEN
+ Name = "DMI_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetMAK = Yes
+End
+
+TOKEN
+ Name = "SwitchableGraphics_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetMAK = Yes
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "GPIO_dGPU_SELECT"
+ Value = "52"
+ TokenType = Integer
+ TargetEQU = Yes
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "ACTIVE_dGPU_SELECT"
+ Value = "0"
+ TokenType = Integer
+ TargetEQU = Yes
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "====== SharkBay MB/DT Two Chip platform GPIO setting======"
+ TokenType = Expression
+End
+
+TOKEN
+ Name = "GPIO_dGPU_PRSNT"
+ Value = "67"
+ Help = "PCH GPIO bit offset on HuronRiver CRB-Emerald Lake\Unused GPIOs must return 0xFF"
+ TokenType = Integer
+ TargetEQU = Yes
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "ACTIVE_dGPU_PRSNT"
+ Value = "0"
+ Help = "PCH GPIO bit offset on HuronRiver CRB-Emerald Lake"
+ TokenType = Integer
+ TargetEQU = Yes
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "GPIO_dGPU_PWR_EN"
+ Value = "54"
+ TokenType = Integer
+ TargetEQU = Yes
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "ACTIVE_dGPU_PWR_EN"
+ Value = "0"
+ TokenType = Integer
+ TargetEQU = Yes
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "GPIO_dGPU_PWROK"
+ Value = "17"
+ TokenType = Integer
+ TargetEQU = Yes
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "ACTIVE_dGPU_PWROK"
+ Value = "1"
+ TokenType = Integer
+ TargetEQU = Yes
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "GPIO_dGPU_HOLD_RST"
+ Value = "50"
+ TokenType = Integer
+ TargetEQU = Yes
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "ACTIVE_dGPU_HOLD_RST"
+ Value = "0"
+ TokenType = Integer
+ TargetEQU = Yes
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "====== SharkBay ULT platform GPIO setting======"
+ TokenType = Expression
+End
+
+TOKEN
+ Name = "GPIO_dGPU_PRSNT_ULT"
+ Value = "67"
+ Help = "PCH GPIO bit offset on HuronRiver CRB-Emerald Lake\Unused GPIOs must return 0xFF"
+ TokenType = Integer
+ TargetEQU = Yes
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "ACTIVE_dGPU_PRSNT_ULT"
+ Value = "0"
+ Help = "PCH GPIO bit offset on HuronRiver CRB-Emerald Lake"
+ TokenType = Integer
+ TargetEQU = Yes
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "GPIO_dGPU_PWR_EN_ULT"
+ Value = "84"
+ TokenType = Integer
+ TargetEQU = Yes
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "ACTIVE_dGPU_PWR_EN_ULT"
+ Value = "0"
+ TokenType = Integer
+ TargetEQU = Yes
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "GPIO_dGPU_PWROK_ULT"
+ Value = "17"
+ TokenType = Integer
+ TargetEQU = Yes
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "ACTIVE_dGPU_PWROK_ULT"
+ Value = "1"
+ TokenType = Integer
+ TargetEQU = Yes
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "GPIO_dGPU_HOLD_RST_ULT"
+ Value = "48"
+ TokenType = Integer
+ TargetEQU = Yes
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "ACTIVE_dGPU_HOLD_RST_ULT"
+ Value = "0"
+ TokenType = Integer
+ TargetEQU = Yes
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "====== SharkBay ULT platform port function setting======"
+ TokenType = Expression
+End
+
+TOKEN
+ Name = "SG_ULT_PORT_FUNC"
+ Value = "0x04"
+ Help = "Port Function Number."
+ TokenType = Integer
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "MRC_BDAT_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Help = "Main switch to enable BdatAccessHandler support in Project"
+End
+
+ELINK
+ Name = "INTEL_SA_RC_FLAGS"
+ Help = "System Agent Reference Code command line options of the compiler"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(INTEL_SA_RC_FLAGS)"
+ Parent = "GLOBAL_DEFINES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(INTEL_SA_RC_FLAGS)"
+ Parent = "ASLPREPROCESS_FLAG"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/D PEG_FLAG"
+ Parent = "INTEL_SA_RC_FLAGS"
+ Token = "PEG_SUPPORT" "=" "1"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/D DMI_FLAG"
+ Parent = "INTEL_SA_RC_FLAGS"
+ Token = "DMI_SUPPORT" "=" "1"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/D SG_SUPPORT"
+ Parent = "INTEL_SA_RC_FLAGS"
+ Token = "SwitchableGraphics_SUPPORT" "=" "1"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/D PciHotPlug_SUPPORT"
+ Parent = "INTEL_SA_RC_FLAGS"
+ Token = "HOTPLUG_SUPPORT" "=" "1"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/D AMI_SgTpv_SUPPORT"
+ Parent = "INTEL_SA_RC_FLAGS"
+ InvokeOrder = AfterParent
+ Token = "SgTpv_SUPPORT" "=" "1"
+ Token = "SwitchableGraphics_SUPPORT" "=" "1"
+End
+
+ELINK
+ Name = "/D BDAT_SUPPORT"
+ Parent = "INTEL_SA_RC_FLAGS"
+ InvokeOrder = AfterParent
+ Token = "MRC_BDAT_SUPPORT" "=" "1"
+End
+
+PATH
+ Name = "INTEL_SYSTEM_AGENT_DIR"
+End
+
+ELINK
+ Name = "INTEL_MCH_INCLUDES"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "/I$(INTEL_SYSTEM_AGENT_DIR)"
+ Parent = "INTEL_MCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(INTEL_SA_INCLUDE_DIR)"
+ Parent = "INTEL_MCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(INTEL_SYSTEM_AGENT_DIR)\SampleCode"
+ Parent = "INTEL_MCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(INTEL_SYSTEM_AGENT_DIR)\SampleCode\Include"
+ Parent = "INTEL_MCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(INTEL_SYSTEM_AGENT_DIR)\MemoryInit\Pei\Source\Api"
+ Parent = "INTEL_MCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(INTEL_SYSTEM_AGENT_DIR)\MemoryInit"
+ Parent = "INTEL_MCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(INTEL_SYSTEM_AGENT_DIR)\MemoryInit\Pei"
+ Parent = "INTEL_MCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(INTEL_SYSTEM_AGENT_DIR)\MemoryInit\Pei\Source\Include"
+ Parent = "INTEL_MCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(INTEL_SYSTEM_AGENT_DIR)\MemoryInit\Pei\Source\Include\MrcRegisters"
+ Parent = "INTEL_MCH_INCLUDES"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/Haswell/CpuInit/Dxe/CacheData.c b/ReferenceCode/Haswell/CpuInit/Dxe/CacheData.c
new file mode 100644
index 0000000..f68c151
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Dxe/CacheData.c
@@ -0,0 +1,515 @@
+/** @file
+ Processor Cache data records.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+///
+/// External include files do NOT need to be explicitly specified in real EDKII
+/// environment
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "CpuAccess.h"
+#include "CacheData.h"
+#endif
+///
+/// This is the VFR compiler generated header file which defines the
+/// string identifiers.
+///
+#include "CpuInitDxeStrDefs.h"
+
+extern EFI_DATA_HUB_PROTOCOL *mDataHub;
+extern EFI_SUBCLASS_TYPE1_HEADER mCpuDataRecordHeader;
+
+EFI_CACHE_CONVERTER mCacheConverter[] = {
+ {
+ 1,
+ 0x09,
+ 32,
+ EfiCacheAssociativity4Way,
+ EfiCacheTypeInstruction
+ },
+ {
+ 1,
+ 0x0D,
+ 16,
+ EfiCacheAssociativity4Way,
+ EfiCacheTypeData
+ },
+ {
+ 2,
+ 0x21,
+ 256,
+ EfiCacheAssociativity8Way,
+ EfiCacheTypeUnified
+ },
+ {
+ 1,
+ 0x2C,
+ 32,
+ EfiCacheAssociativity8Way,
+ EfiCacheTypeData
+ },
+ {
+ 2,
+ 0x40,
+ 0,
+ EfiCacheAssociativityUnknown,
+ EfiCacheTypeUnknown
+ },
+ {
+ 3,
+ 0xD0,
+ 512,
+ EfiCacheAssociativity4Way,
+ EfiCacheTypeUnified
+ },
+ {
+ 3,
+ 0xD1,
+ 1024,
+ EfiCacheAssociativity4Way,
+ EfiCacheTypeUnified
+ },
+ {
+ 3,
+ 0xD2,
+ 2048,
+ EfiCacheAssociativity4Way,
+ EfiCacheTypeUnified
+ },
+ {
+ 3,
+ 0xD3,
+ 4096,
+ EfiCacheAssociativity4Way,
+ EfiCacheTypeUnified
+ },
+ {
+ 3,
+ 0xD4,
+ 8192,
+ EfiCacheAssociativity4Way,
+ EfiCacheTypeUnified
+ },
+ {
+ 3,
+ 0xD6,
+ 1024,
+ EfiCacheAssociativity8Way,
+ EfiCacheTypeUnified
+ },
+ {
+ 3,
+ 0xD7,
+ 2048,
+ EfiCacheAssociativity8Way,
+ EfiCacheTypeUnified
+ },
+ {
+ 3,
+ 0xD8,
+ 4096,
+ EfiCacheAssociativity8Way,
+ EfiCacheTypeUnified
+ },
+ {
+ 3,
+ 0xD9,
+ 8192,
+ EfiCacheAssociativity8Way,
+ EfiCacheTypeUnified
+ },
+ {
+ 3,
+ 0xDA,
+ 12288,
+ EfiCacheAssociativity8Way,
+ EfiCacheTypeUnified
+ },
+ {
+ 3,
+ 0xDC,
+ 1536,
+ EfiCacheAssociativity12Way,
+ EfiCacheTypeUnified
+ },
+ {
+ 3,
+ 0xDD,
+ 3072,
+ EfiCacheAssociativity12Way,
+ EfiCacheTypeUnified
+ },
+ {
+ 3,
+ 0xDE,
+ 6144,
+ EfiCacheAssociativity12Way,
+ EfiCacheTypeUnified
+ },
+ {
+ 3,
+ 0xDF,
+ 12288,
+ EfiCacheAssociativity12Way,
+ EfiCacheTypeUnified
+ },
+ {
+ 3,
+ 0xE0,
+ 18432,
+ EfiCacheAssociativity12Way,
+ EfiCacheTypeUnified
+ },
+ {
+ 3,
+ 0xE2,
+ 2048,
+ EfiCacheAssociativity16Way,
+ EfiCacheTypeUnified
+ },
+ {
+ 3,
+ 0xE3,
+ 4096,
+ EfiCacheAssociativity16Way,
+ EfiCacheTypeUnified
+ },
+ {
+ 3,
+ 0xE4,
+ 8192,
+ EfiCacheAssociativity16Way,
+ EfiCacheTypeUnified
+ },
+ {
+ 3,
+ 0xE5,
+ 16384,
+ EfiCacheAssociativity16Way,
+ EfiCacheTypeUnified
+ },
+ {
+ 3,
+ 0xE6,
+ 24576,
+ EfiCacheAssociativity16Way,
+ EfiCacheTypeUnified
+ },
+ {
+ 3,
+ 0xEA,
+ 12288,
+ EfiCacheAssociativity24Way,
+ EfiCacheTypeUnified
+ },
+ {
+ 3,
+ 0xEB,
+ 18432,
+ EfiCacheAssociativity24Way,
+ EfiCacheTypeUnified
+ },
+ {
+ 3,
+ 0xEC,
+ 24567,
+ EfiCacheAssociativity24Way,
+ EfiCacheTypeUnified
+ },
+ {
+ 0,
+ 0xFF,
+ 0,
+ 0,
+ 0
+ }
+};
+
+///
+/// Convert Cache Type Field to SMBIOS format
+///
+#define SMBIOS_CACHE_TYPE_MAX 5
+UINT8 SmbiosCacheTypeFieldConverter[SMBIOS_CACHE_TYPE_MAX] = {
+ EfiCacheTypeUnknown,
+ EfiCacheTypeData,
+ EfiCacheTypeInstruction,
+ EfiCacheTypeUnified,
+ EfiCacheTypeOther
+};
+
+UINT8 mCacheInstance[EFI_CACHE_LMAX] = { 0, 0, 0, 0 };
+
+EFI_SUBCLASS_TYPE1_HEADER mCacheDataRecordHeader = {
+ EFI_CACHE_SUBCLASS_VERSION, ///< Version
+ sizeof (EFI_SUBCLASS_TYPE1_HEADER), ///< Header Size
+ 0, ///< Instance, Initialize later
+ 0, ///< SubInstance, Initialize later to Cache Level
+ 0 ///< RecordType, Initialize later
+};
+
+/**
+ This function gets called with the processor number and will log all cache data to data hub
+ pertaining to this processor.
+
+ @param[in] CpuNumber - Processor Number
+ @param[in] CacheInformation - Cache information get from cpuid instruction
+
+ @retval EFI_OUT_OF_RESOURCES - Failed to allocate required POOL for record buffer.
+ @retval EFI_SUCCESS - successful to update cache data
+**/
+EFI_STATUS
+InitializeCacheData (
+ IN UINTN CpuNumber,
+ IN EFI_CPUID_REGISTER *CacheInformation
+ )
+{
+ EFI_STATUS Status;
+ UINT32 HeaderSize;
+ UINT32 TotalSize;
+ CPU_CACHE_DATA_RECORD_BUFFER RecordBuffer;
+ UINT8 Index1;
+ UINT8 CacheLevel;
+ UINT8 LxCacheType;
+ UINT32 Ways;
+ UINT32 Partitions;
+ UINT32 LineSets;
+ UINT32 Sets;
+ UINT32 LxCacheSize;
+ EFI_CPUID_REGISTER CpuidRegisters;
+
+ ///
+ /// Only log CPU socket level information.
+ ///
+ if (CpuNumber != 0) {
+ return EFI_SUCCESS;
+ }
+
+ mCacheDataRecordHeader.Instance = (UINT16) (CpuNumber + 1);
+
+ HeaderSize = sizeof (EFI_SUBCLASS_TYPE1_HEADER);
+ RecordBuffer.Raw = AllocatePool (HeaderSize + CPU_CACHE_DATA_MAXIMUM_LENGTH);
+ if (RecordBuffer.Raw == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ for (Index1 = 0;; Index1++) {
+ EfiCpuidExt (CPUID_CACHE_PARAMS, Index1, &CpuidRegisters);
+ if ((CpuidRegisters.RegEax & V_CPUID_CACHE_TYPE_MASK) == 0) {
+ break;
+ }
+
+ Ways = ((CpuidRegisters.RegEbx >> B_CPUID_CACHE_PARAMS_WAYS_SHIFT) & 0x3FF) + 1;
+ Partitions = ((CpuidRegisters.RegEbx >> B_CPUID_CACHE_PARAMS_PARTITIONS_SHIFT) & 0x3FF) + 1;
+ LineSets = (CpuidRegisters.RegEbx & 0xFFF) + 1;
+ Sets = CpuidRegisters.RegEcx + 1;
+
+ CacheLevel = (UINT8) (CpuidRegisters.RegEax & V_CPUID_CACHE_LEVEL_MASK) >> B_CPUID_CACHE_LEVEL_SHIFT;
+ LxCacheSize = (Ways * Partitions * LineSets * Sets) / 1024;
+ LxCacheType = (UINT8) (CpuidRegisters.RegEax & V_CPUID_CACHE_TYPE_MASK);
+
+ CopyMem (RecordBuffer.Raw, &mCacheDataRecordHeader, HeaderSize);
+
+ mCacheInstance[CacheLevel - 1]++;
+ RecordBuffer.DataRecord->DataRecordHeader.Instance = mCacheInstance[CacheLevel - 1];
+ RecordBuffer.DataRecord->DataRecordHeader.SubInstance = CacheLevel;
+
+ ///
+ /// Record Type 1
+ ///
+ RecordBuffer.DataRecord->DataRecordHeader.RecordType = CacheSizeRecordType;
+ TotalSize = HeaderSize + sizeof (EFI_CACHE_SIZE_DATA);
+ RecordBuffer.DataRecord->VariableRecord.CacheSize.Value = (UINT16) LxCacheSize;
+ RecordBuffer.DataRecord->VariableRecord.CacheSize.Exponent = 10;
+ Status = LogCacheData (mDataHub, RecordBuffer.Raw, TotalSize);
+
+ ///
+ /// Record Type 2
+ ///
+ RecordBuffer.DataRecord->DataRecordHeader.RecordType = MaximumSizeCacheRecordType;
+ TotalSize = HeaderSize + sizeof (EFI_MAXIMUM_CACHE_SIZE_DATA);
+ RecordBuffer.DataRecord->VariableRecord.MaximumCacheSize.Value = (UINT16) LxCacheSize;
+ RecordBuffer.DataRecord->VariableRecord.MaximumCacheSize.Exponent = 10;
+ Status = LogCacheData (mDataHub, RecordBuffer.Raw, TotalSize);
+
+ ///
+ /// Record Type 3
+ ///
+ RecordBuffer.DataRecord->DataRecordHeader.RecordType = CacheSpeedRecordType;
+ TotalSize = HeaderSize + sizeof (EFI_CACHE_SPEED_DATA);
+ RecordBuffer.DataRecord->VariableRecord.CacheSpeed.Exponent = 0;
+ RecordBuffer.DataRecord->VariableRecord.CacheSpeed.Value = 0;
+ Status = LogCacheData (mDataHub, RecordBuffer.Raw, TotalSize);
+
+ ///
+ /// Record Type 4
+ ///
+ RecordBuffer.DataRecord->DataRecordHeader.RecordType = CacheSocketRecordType;
+ TotalSize = HeaderSize + sizeof (EFI_CACHE_SOCKET_DATA);
+ RecordBuffer.DataRecord->VariableRecord.CacheSocket = 0;
+ ///
+ /// CacheDesignation[Index1];
+ ///
+ Status = LogCacheData (mDataHub, RecordBuffer.Raw, TotalSize);
+
+ ///
+ /// Record Type 5
+ ///
+ RecordBuffer.DataRecord->DataRecordHeader.RecordType = CacheSramTypeRecordType;
+ TotalSize = HeaderSize + sizeof (EFI_CACHE_SRAM_TYPE_DATA);
+ ZeroMem (
+ &RecordBuffer.DataRecord->VariableRecord.CacheSramType,
+ sizeof (EFI_CACHE_SRAM_TYPE_DATA)
+ );
+ RecordBuffer.DataRecord->VariableRecord.CacheSramType.Synchronous = TRUE;
+ Status = LogCacheData (mDataHub, RecordBuffer.Raw, TotalSize);
+
+ ///
+ /// Record Type 6, since record same as Type 5
+ ///
+ RecordBuffer.DataRecord->DataRecordHeader.RecordType = CacheInstalledSramTypeRecordType;
+ Status = LogCacheData (mDataHub, RecordBuffer.Raw, TotalSize);
+
+ ///
+ /// Record Type 7
+ ///
+ RecordBuffer.DataRecord->DataRecordHeader.RecordType = CacheErrorTypeRecordType;
+ TotalSize = HeaderSize + sizeof (EFI_CACHE_ERROR_TYPE_DATA);
+ RecordBuffer.DataRecord->VariableRecord.CacheErrorType = EfiCacheErrorSingleBit;
+ Status = LogCacheData (mDataHub, RecordBuffer.Raw, TotalSize);
+
+ ///
+ /// Record Type 8
+ ///
+ RecordBuffer.DataRecord->DataRecordHeader.RecordType = CacheTypeRecordType;
+ TotalSize = HeaderSize + sizeof (EFI_CACHE_TYPE_DATA);
+ ///
+ /// If cache type is larger or equal than 5, this is undefined type so mark it as "Other" Cache type.
+ ///
+ if (LxCacheType >= SMBIOS_CACHE_TYPE_MAX) {
+ LxCacheType = SMBIOS_CACHE_TYPE_MAX - 1;
+ }
+ RecordBuffer.DataRecord->VariableRecord.CacheType = SmbiosCacheTypeFieldConverter[LxCacheType];
+ Status = LogCacheData (mDataHub, RecordBuffer.Raw, TotalSize);
+
+ ///
+ /// Record Type 9
+ ///
+ RecordBuffer.DataRecord->DataRecordHeader.RecordType = CacheAssociativityRecordType;
+ TotalSize = HeaderSize + sizeof (EFI_CACHE_ASSOCIATIVITY_DATA);
+ ///
+ /// Convert Associativity Ways to SMBIOS format
+ ///
+ switch (Ways) {
+ case 2:
+ Ways = EfiCacheAssociativity2Way;
+ break;
+ case 4:
+ Ways = EfiCacheAssociativity4Way;
+ break;
+ case 8:
+ Ways = EfiCacheAssociativity8Way;
+ break;
+ case 12:
+ Ways = EfiCacheAssociativity12Way;
+ break;
+ case 16:
+ Ways = EfiCacheAssociativity16Way;
+ break;
+ case 24:
+ Ways = EfiCacheAssociativity24Way;
+ break;
+ case 32:
+ Ways = EfiCacheAssociativity32Way;
+ break;
+ case 48:
+ Ways = EfiCacheAssociativity48Way;
+ break;
+ case 64:
+ Ways = EfiCacheAssociativity64Way;
+ break;
+ default:
+ Ways = EfiCacheAssociativityOther;
+ break;
+ }
+ RecordBuffer.DataRecord->VariableRecord.CacheAssociativity = Ways;
+ Status = LogCacheData (mDataHub, RecordBuffer.Raw, TotalSize);
+
+ ///
+ /// Record Type 10
+ ///
+ RecordBuffer.DataRecord->DataRecordHeader.RecordType = CacheConfigRecordType;
+ TotalSize = HeaderSize + sizeof (EFI_CACHE_CONFIGURATION_DATA);
+ RecordBuffer.DataRecord->VariableRecord.CacheConfig.Level = CacheLevel;
+ RecordBuffer.DataRecord->VariableRecord.CacheConfig.Socketed = EFI_CACHE_NOT_SOCKETED;
+ RecordBuffer.DataRecord->VariableRecord.CacheConfig.Reserved2 = 0;
+ RecordBuffer.DataRecord->VariableRecord.CacheConfig.Location = EfiCacheInternal;
+ RecordBuffer.DataRecord->VariableRecord.CacheConfig.Enable = EFI_CACHE_ENABLED;
+ RecordBuffer.DataRecord->VariableRecord.CacheConfig.OperationalMode = EfiCacheWriteBack;
+ RecordBuffer.DataRecord->VariableRecord.CacheConfig.Reserved1 = 0;
+ Status = LogCacheData (mDataHub, RecordBuffer.Raw, TotalSize);
+
+ ///
+ /// Cache Association. Processor Record Type 17
+ ///
+ TotalSize = HeaderSize + sizeof (EFI_CACHE_ASSOCIATION_DATA);
+ RecordBuffer.DataRecord->VariableRecord.CacheAssociation.ProducerName = gEfiProcessorProducerGuid;
+ ///
+ /// RecordBuffer.DataRecord->VariableRecord.CacheAssociation.ProducerInstance = (UINT16)Instance;
+ ///
+ RecordBuffer.DataRecord->VariableRecord.CacheAssociation.Instance = RecordBuffer.DataRecord->DataRecordHeader.Instance;
+ RecordBuffer.DataRecord->VariableRecord.CacheAssociation.SubInstance = RecordBuffer.DataRecord->DataRecordHeader.SubInstance;
+ CopyMem (RecordBuffer.Raw, &mCpuDataRecordHeader, HeaderSize);
+ RecordBuffer.DataRecord->DataRecordHeader.RecordType = CacheAssociationRecordType;
+ Status = LogCpuData (mDataHub, RecordBuffer.Raw, TotalSize);
+ }
+
+ FreePool (RecordBuffer.Raw);
+ return EFI_SUCCESS;
+}
+
+/**
+ Log cache data into data hub
+
+ @param[in] DataHub - Pointer to the DataHub protocol that will be updated
+ @param[in] Buffer - Data buffer which will be updated into DataHub
+ @param[in] Size - The size of data buffer
+
+ @retval EFI_STATUS - status code for logging data into dat hub
+**/
+EFI_STATUS
+LogCacheData (
+ EFI_DATA_HUB_PROTOCOL *DataHub,
+ UINT8 *Buffer,
+ UINT32 Size
+ )
+{
+ EFI_STATUS Status;
+
+ Status = DataHub->LogData (
+ DataHub,
+ &gEfiCacheSubClassGuid,
+ &gEfiProcessorProducerGuid,
+ EFI_DATA_RECORD_CLASS_DATA,
+ Buffer,
+ Size
+ );
+ return Status;
+}
diff --git a/ReferenceCode/Haswell/CpuInit/Dxe/CacheData.h b/ReferenceCode/Haswell/CpuInit/Dxe/CacheData.h
new file mode 100644
index 0000000..57579eb
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Dxe/CacheData.h
@@ -0,0 +1,91 @@
+/** @file
+ Header file for CPU Data File
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _CACHE_DATA_H_
+#define _CACHE_DATA_H_
+
+#include "CpuInitDxe.h"
+
+///
+/// Platform-specific definitions
+///
+#define CPU_CACHE_DATA_MAXIMUM_LENGTH 0x100
+
+typedef union {
+ EFI_CACHE_DATA_RECORD *DataRecord;
+ UINT8 *Raw;
+} CPU_CACHE_DATA_RECORD_BUFFER;
+
+typedef struct {
+ UINT8 CacheLevel;
+ UINT8 CacheDescriptor;
+ UINT16 CacheSizeinKB;
+ EFI_CACHE_ASSOCIATIVITY_DATA Associativity;
+ EFI_CACHE_TYPE_DATA Type;
+} EFI_CACHE_CONVERTER;
+
+/**
+ This function gets called with the processor number and will log all cache data to data hub
+ pertaining to this processor.
+
+ @param[in] CpuNumber - Processor Number
+ @param[in] CacheInformation - Cache information get from cpuid instruction
+
+ @retval EFI_OUT_OF_RESOURCES - Failed to allocate required POOL for record buffer.
+ @retval EFI_SUCCESS - successful to update cache data
+**/
+EFI_STATUS
+InitializeCacheData (
+ IN UINTN CpuNumber,
+ IN EFI_CPUID_REGISTER *CacheInformation
+ );
+
+/**
+ Log cache data into data hub
+
+ @param[in] DataHub - Pointer to the DataHub protocol that will be updated
+ @param[in] Buffer - Data buffer which will be updated into DataHub
+ @param[in] Size - The size of data buffer
+
+ @retval EFI_STATUS - status code for logging data into dat hub
+**/
+EFI_STATUS
+LogCacheData (
+ EFI_DATA_HUB_PROTOCOL *DataHub,
+ UINT8 *Buffer,
+ UINT32 Size
+ );
+
+/**
+ Log CPU data into data hub
+
+ @param[in] DataHub - point to data hub that will be updated
+ @param[in] Buffer - the buffer which will be updated into data hub
+ @param[in] Size - size of the buffer
+
+ @retval EFI_STATUS - status returned when updating Data hub
+**/
+EFI_STATUS
+LogCpuData (
+ EFI_DATA_HUB_PROTOCOL *DataHub,
+ UINT8 *Buffer,
+ UINT32 Size
+ );
+
+#endif
diff --git a/ReferenceCode/Haswell/CpuInit/Dxe/CpuFvi.c b/ReferenceCode/Haswell/CpuInit/Dxe/CpuFvi.c
new file mode 100644
index 0000000..7559980
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Dxe/CpuFvi.c
@@ -0,0 +1,62 @@
+/** @file
+ CPU Firmware Version Info implementation.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "CpuInitDxe.h"
+#endif
+
+FVI_ELEMENT_AND_FUNCTION mCpuFviElementsData[] = {
+ {
+ DEFAULT_FVI_ELEMENT_DATA(CPU),
+ NULL
+ },
+ {
+ {
+ 1,
+ 0,
+ UCODE_VERSION,
+ UCODE_FVI_STRING,
+ {
+ 0
+ },
+ },
+ NULL
+ },
+ {
+ {
+ 1,
+ 0,
+ TXT_VERSION,
+ TXT_FVI_STRING,
+ {
+ 0
+ },
+ },
+ NULL
+ }
+};
+
+FVI_DATA_HUB_CALLBACK_CONTEXT mCpuFviVersionData = {
+ MISC_SUBCLASS_FVI_HEADER_ENTRY(CPU),
+ mCpuFviElementsData,
+};
+
+UINTN mCpuFviElements = sizeof (mCpuFviElementsData) / sizeof (FVI_ELEMENT_AND_FUNCTION);
diff --git a/ReferenceCode/Haswell/CpuInit/Dxe/CpuInitDxe.c b/ReferenceCode/Haswell/CpuInit/Dxe/CpuInitDxe.c
new file mode 100644
index 0000000..93ec58e
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Dxe/CpuInitDxe.c
@@ -0,0 +1,1085 @@
+/** @file
+ Cpu driver, which initializes CPU and implements CPU Architecture
+ Protocol as defined in Framework specification.
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "CpuInitDxe.h"
+#include "ProcessorData.h"
+#include "CacheData.h"
+#include "Exception.h"
+#include "PfatDefinitions.h"
+#include "BootGuardLibrary.h"
+#include "BootGuardRevocationLib.h"
+
+#define SAMPLE_TICK_COUNT 1000
+
+#endif
+
+#include <token.h>
+extern UINT64 mValidMtrrAddressMask;
+extern UINT64 mValidMtrrBitsMask;
+extern EFI_CPU_MICROCODE_HEADER **mMicrocodePointerBuffer;
+extern UINT8 CpuInitDxeStrings[];
+
+#if (EFI_SPECIFICATION_VERSION >= 0x2000A)
+EFI_HANDLE mDriverHandle;
+EFI_HII_DATABASE_PROTOCOL *mHiiDatabase;
+#else
+EFI_HII_PROTOCOL *mHii;
+#endif
+EFI_SMM_BASE_PROTOCOL *mSmmBaseProtocol = NULL;
+VOID *mSmmBaseRegistration;
+EFI_METRONOME_ARCH_PROTOCOL *mMetronome;
+DXE_CPU_PLATFORM_POLICY_PROTOCOL *mPlatformCpu = NULL;
+EFI_HII_HANDLE mStringHandle;
+BOOLEAN mIsFlushingGCD = TRUE;
+UINT8 mSmmbaseSwSmiNumber;
+BOOLEAN mVariableMtrrChanged;
+BOOLEAN mFixedMtrrChanged;
+UINT64 mCpuFrequency = 0;
+
+EFI_EVENT gReadyToBootEvent;
+EFI_CPU_INTERRUPT_HANDLER mExternalVectorTable[0x100];
+BOOLEAN mInterruptState = FALSE;
+
+///
+/// The Cpu Architectural Protocol that this Driver produces
+///
+EFI_CPU_ARCH_PROTOCOL gCpu = {
+ FlushCpuDataCache,
+ EnableInterrupt,
+ DisableInterrupt,
+ CpuGetInterruptState,
+ Init,
+ RegisterInterruptHandler,
+ GetTimerValue,
+ SetMemoryAttributes,
+ 1, ///< NumberOfTimers
+ 4, ///< DmaBufferAlignment
+};
+
+/**
+ Decide if the CPU is executing in SMM mode
+
+ @retval TRUE - The CPU is executing in SMM mode
+ @retval FALSE - The CPU is not executing in SMM mode
+**/
+BOOLEAN
+ExecutionInSmm (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ BOOLEAN InSmm;
+
+ if (mSmmBaseProtocol == NULL) {
+ return FALSE;
+ }
+
+ Status = mSmmBaseProtocol->InSmm (mSmmBaseProtocol, &InSmm);
+ ASSERT_EFI_ERROR (Status);
+ return InSmm;
+}
+
+/**
+ Flush CPU data cache. If the instruction cache is fully coherent
+ with all DMA operations then function can just return EFI_SUCCESS.
+
+ @param[in] This - Protocol instance structure
+ @param[in] Start - Physical address to start flushing from.
+ @param[in] Length - Number of bytes to flush. Round up to chipset
+ granularity.
+ @param[in] FlushType - Specifies the type of flush operation to perform.
+
+ @retval EFI_SUCCESS - If cache was flushed
+ @exception EFI_UNSUPPORTED - If flush type is not supported.
+ @retval EFI_DEVICE_ERROR - If requested range could not be flushed.
+**/
+EFI_STATUS
+EFIAPI
+FlushCpuDataCache (
+ IN EFI_CPU_ARCH_PROTOCOL *This,
+ IN EFI_PHYSICAL_ADDRESS Start,
+ IN UINT64 Length,
+ IN EFI_CPU_FLUSH_TYPE FlushType
+ )
+{
+ if (FlushType == EfiCpuFlushTypeWriteBackInvalidate) {
+ AsmWbinvd ();
+ return EFI_SUCCESS;
+ } else if (FlushType == EfiCpuFlushTypeInvalidate) {
+ EfiInvd ();
+ return EFI_SUCCESS;
+ } else {
+ return EFI_UNSUPPORTED;
+ }
+}
+
+/**
+ Enables CPU interrupts.
+
+ @param[in] This - Protocol instance structure
+
+ @retval EFI_SUCCESS - If interrupts were enabled in the CPU
+ @retval EFI_DEVICE_ERROR - If interrupts could not be enabled on the CPU.
+**/
+EFI_STATUS
+EFIAPI
+EnableInterrupt (
+ IN EFI_CPU_ARCH_PROTOCOL *This
+ )
+{
+ if (!ExecutionInSmm ()) {
+ CpuEnableInterrupt ();
+ }
+
+ mInterruptState = TRUE;
+ return EFI_SUCCESS;
+}
+
+/**
+ Disables CPU interrupts.
+
+ @param[in] This - Protocol instance structure
+
+ @retval EFI_SUCCESS - If interrupts were disabled in the CPU.
+**/
+EFI_STATUS
+EFIAPI
+DisableInterrupt (
+ IN EFI_CPU_ARCH_PROTOCOL *This
+ )
+{
+ CpuDisableInterrupt ();
+
+ mInterruptState = FALSE;
+ return EFI_SUCCESS;
+}
+
+/**
+ Return the state of interrupts.
+
+ @param[in] This - Protocol instance structure
+ @param[in] State - Pointer to the CPU's current interrupt state
+
+ @retval EFI_SUCCESS - If interrupts were disabled in the CPU.
+ @retval EFI_INVALID_PARAMETER - State is NULL.
+**/
+EFI_STATUS
+EFIAPI
+CpuGetInterruptState (
+ IN EFI_CPU_ARCH_PROTOCOL *This,
+ OUT BOOLEAN *State
+ )
+{
+ if (State == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ *State = mInterruptState;
+ return EFI_SUCCESS;
+}
+
+/**
+ Generates an INIT to the CPU
+
+ @param[in] This - Protocol instance structure
+ @param[in] InitType - Type of CPU INIT to perform
+
+ @retval EFI_SUCCESS - If CPU INIT occurred. This value should never be seen
+ @retval EFI_DEVICE_ERROR - If CPU INIT failed.
+ @exception EFI_UNSUPPORTED - Requested type of CPU INIT not supported.
+**/
+EFI_STATUS
+EFIAPI
+Init (
+ IN EFI_CPU_ARCH_PROTOCOL *This,
+ IN EFI_CPU_INIT_TYPE InitType
+ )
+{
+ return EFI_UNSUPPORTED;
+}
+
+/**
+ Registers a function to be called from the CPU interrupt handler.
+
+ @param[in] This - Protocol instance structure
+ @param[in] InterruptType - Defines which interrupt to hook.
+ IA-32 valid range is 0x00 through 0xFF
+ @param[in] InterruptHandler - A pointer to a function of type EFI_CPU_INTERRUPT_HANDLER
+ that is called when a processor interrupt occurs.
+ A null pointer is an error condition.
+
+ @retval EFI_SUCCESS - If handler installed or uninstalled.
+ @retval EFI_ALREADY_STARTED - InterruptHandler is not NULL, and a handler for
+ InterruptType was previously installed
+ @retval EFI_INVALID_PARAMETER - InterruptHandler is NULL, and a handler for
+ InterruptType was not previously installed.
+ @exception EFI_UNSUPPORTED - The interrupt specified by InterruptType is not supported.
+**/
+EFI_STATUS
+EFIAPI
+RegisterInterruptHandler (
+ IN EFI_CPU_ARCH_PROTOCOL *This,
+ IN EFI_EXCEPTION_TYPE InterruptType,
+ IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler
+ )
+{
+ if (InterruptType < 0 || InterruptType > 0xff) {
+ return EFI_UNSUPPORTED;
+ }
+
+ if (InterruptHandler == NULL && mExternalVectorTable[InterruptType] == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (InterruptHandler != NULL && mExternalVectorTable[InterruptType] != NULL) {
+ return EFI_ALREADY_STARTED;
+ }
+
+ mExternalVectorTable[InterruptType] = InterruptHandler;
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+GetTimerValue (
+ IN EFI_CPU_ARCH_PROTOCOL *This,
+ IN UINT32 TimerIndex,
+ OUT UINT64 *TimerValue,
+ OUT UINT64 *TimerPeriod OPTIONAL
+ )
+/**
+ Returns a timer value from one of the CPU's internal timers. There is no
+ inherent time interval between ticks but is a function of the CPU frequency.
+
+ @param[in] This - Protocol instance structure.
+ @param[in] TimerIndex - Specifies which CPU timer is requested.
+ @param[in] TimerValue - Pointer to the returned timer value.
+ @param[in] TimerPeriod - A pointer to the amount of time that passes in femtoseconds (10-15) for each
+ increment of TimerValue. If TimerValue does not increment at a predictable
+ rate, then 0 is returned. The amount of time that has passed between two calls to
+ GetTimerValue() can be calculated with the formula
+ (TimerValue2 - TimerValue1) * TimerPeriod. This parameter is optional and may be NULL.
+
+ @retval EFI_SUCCESS - If the CPU timer count was returned.
+ @exception EFI_UNSUPPORTED - If the CPU does not have any readable timers.
+ @retval EFI_DEVICE_ERROR - If an error occurred while reading the timer.
+ @retval EFI_INVALID_PARAMETER - TimerIndex is not valid or TimerValue is NULL.
+**/
+{
+ UINT64 Actual;
+
+ if (TimerValue == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (TimerIndex != 0) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ *TimerValue = EfiReadTsc ();
+
+ if (TimerPeriod != NULL) {
+ GetActualFrequency (mMetronome, &Actual);
+ *TimerPeriod = DivU64x32 (1000000000, (UINT32) Actual);
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Set memory cacheability attributes for given range of memeory
+
+ @param[in] This - Protocol instance structure
+ @param[in] BaseAddress - Specifies the start address of the memory range
+ @param[in] Length - Specifies the length of the memory range
+ @param[in] Attributes - The memory cacheability for the memory range
+
+ @retval EFI_SUCCESS - If the cacheability of that memory range is set successfully
+ @exception EFI_UNSUPPORTED - If the desired operation cannot be done
+ @retval EFI_INVALID_PARAMETER - The input parameter is not correct, such as Length = 0
+**/
+EFI_STATUS
+EFIAPI
+SetMemoryAttributes (
+ IN EFI_CPU_ARCH_PROTOCOL *This,
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,
+ IN UINT64 Length,
+ IN UINT64 Attributes
+ )
+{
+ EFI_STATUS Status;
+ UINT64 TempQword;
+ UINT32 MsrNum;
+ UINTN MtrrNumber;
+ BOOLEAN Positive;
+ BOOLEAN OverLap;
+#define SKIP_ALIGN_CHECK 0
+#if SKIP_ALIGN_CHECK
+ UINT32 Remainder;
+#endif
+ EFI_MP_SERVICES_PROTOCOL *MpService;
+ EFI_STATUS Status1;
+ UINT32 VariableMtrrLimit;
+ UINT32 SmiEnVal;
+ BOOLEAN InterruptState;
+ UINT8 MasterIrq,SlaveIrq;
+
+ mFixedMtrrChanged = FALSE;
+ mVariableMtrrChanged = FALSE;
+
+ VariableMtrrLimit = (UINT32) (AsmReadMsr64 (IA32_MTRR_CAP) & B_IA32_MTRR_VARIABLE_SUPPORT);
+
+ if (mIsFlushingGCD) {
+ return EFI_SUCCESS;
+ }
+
+ TempQword = 0;
+
+ ///
+ /// Check for invalid parameter
+ ///
+ if (Length == 0) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if ((BaseAddress &~mValidMtrrAddressMask) != 0 || (Length &~mValidMtrrAddressMask) != 0) {
+ return EFI_UNSUPPORTED;
+ }
+
+ switch (Attributes) {
+ case EFI_MEMORY_UC:
+ Attributes = CACHE_UNCACHEABLE;
+ break;
+
+ case EFI_MEMORY_WC:
+ Attributes = CACHE_WRITECOMBINING;
+ break;
+
+ case EFI_MEMORY_WT:
+ Attributes = CACHE_WRITETHROUGH;
+ break;
+
+ case EFI_MEMORY_WP:
+ Attributes = CACHE_WRITEPROTECTED;
+ break;
+
+ case EFI_MEMORY_WB:
+ Attributes = CACHE_WRITEBACK;
+ break;
+
+ default:
+ return EFI_UNSUPPORTED;
+ }
+
+ ///
+ /// Check if Fixed MTRR
+ ///
+ Status = EFI_SUCCESS;
+ while ((BaseAddress < (1 << 20)) && (Length > 0) && Status == EFI_SUCCESS) {
+ Status = CalculateFixedMtrr (Attributes, &BaseAddress, &Length);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ }
+
+ MasterIrq = IoRead8(0x21); //save current irq mask
+ SlaveIrq = IoRead8(0xA1);
+ IoWrite8(0x21,0xFF);
+ IoWrite8(0xA1,0xFF);
+
+ CpuGetInterruptState (&gCpu, &InterruptState);
+ if (InterruptState) {
+ DisableInterrupt (&gCpu);
+ }
+ SmiEnVal = IoRead32(PM_BASE_ADDRESS + 0x30); // Save SMI Control and Enable Reg.
+ IoWrite32(PM_BASE_ADDRESS + 0x30, 0); // Disable SMI
+
+ if (mFixedMtrrChanged) {
+ ProgramFixedMtrr ();
+ }
+
+ if (Length == 0) {
+ ///
+ /// Just Fixed MTRR. NO need to go through Variable MTRR
+ ///
+ goto Done;
+ }
+
+ ///
+ /// since mem below 1m will be override by fixed mtrr, we can set it to 0 to save mtrr.
+ ///
+ if (BaseAddress == 0x100000) {
+ BaseAddress = 0;
+ Length += 0x100000;
+ }
+
+ ///
+ /// Check memory base address alignment
+ ///
+#if SKIP_ALIGN_CHECK
+ DivU64x32Remainder (BaseAddress, (UINT32) Power2MaxMemory (LShiftU64 (Length, 1)), &Remainder);
+ if (Remainder != 0) {
+ DivU64x32Remainder (BaseAddress, (UINT32) Power2MaxMemory (Length), &Remainder);
+ if (Remainder != 0) {
+ Status = EFI_UNSUPPORTED;
+ goto Done;
+ }
+ }
+#endif
+
+ ///
+ /// Check overlap
+ ///
+ GetMemoryAttribute ();
+ OverLap = CheckMemoryAttributeOverlap (BaseAddress, BaseAddress + Length - 1);
+ if (OverLap) {
+ Status = CombineMemoryAttribute (Attributes, &BaseAddress, &Length);
+ if (EFI_ERROR (Status)) {
+ goto Done;
+ }
+ if (Length == 0) {
+ ///
+ /// combine successfully
+ ///
+ Status = EFI_SUCCESS;
+ goto Done;
+ }
+ } else {
+ if (Attributes == CACHE_UNCACHEABLE) {
+ Status = EFI_SUCCESS;
+ goto Done;
+ }
+ }
+
+ ///
+ /// Program Variable MTRRs
+ ///
+ if (mUsedMtrr >= VariableMtrrLimit) {
+ Status = EFI_OUT_OF_RESOURCES;
+ goto Done;
+ }
+
+ ///
+ /// Find first unused MTRR
+ ///
+ for (MsrNum = CACHE_VARIABLE_MTRR_BASE; MsrNum < (CACHE_VARIABLE_MTRR_BASE + VariableMtrrLimit * 2 - 1); MsrNum += 2) {
+ if ((AsmReadMsr64 (MsrNum + 1) & B_CACHE_MTRR_VALID) == 0) {
+ break;
+ }
+ }
+
+ TempQword = Length;
+ if (TempQword == Power2MaxMemory (TempQword)) {
+ ProgramVariableMtrr (
+ MsrNum,
+ BaseAddress,
+ Length,
+ Attributes
+ );
+ } else {
+ GetDirection (TempQword, &MtrrNumber, &Positive);
+ if ((mUsedMtrr + MtrrNumber) > VariableMtrrLimit) {
+ goto Done;
+ }
+ if (!Positive) {
+ Length = Power2MaxMemory (LShiftU64 (TempQword, 1));
+ ProgramVariableMtrr (
+ MsrNum,
+ BaseAddress,
+ Length,
+ Attributes
+ );
+ BaseAddress += TempQword;
+ TempQword = Length - TempQword;
+ Attributes = CACHE_UNCACHEABLE;
+ }
+ do {
+ ///
+ /// Find unused MTRR
+ ///
+ for (; MsrNum < (CACHE_VARIABLE_MTRR_BASE + VariableMtrrLimit * 2 - 1); MsrNum += 2) {
+ if ((AsmReadMsr64 (MsrNum + 1) & B_CACHE_MTRR_VALID) == 0) {
+ break;
+ }
+ }
+ Length = Power2MaxMemory (TempQword);
+ ProgramVariableMtrr (
+ MsrNum,
+ BaseAddress,
+ Length,
+ Attributes
+ );
+ BaseAddress += Length;
+ TempQword -= Length;
+ } while (TempQword);
+ }
+
+Done:
+ Status1 = gBS->LocateProtocol (
+ &gEfiMpServiceProtocolGuid,
+ NULL,
+ (VOID **) &MpService
+ );
+
+ if (!EFI_ERROR (Status1)) {
+ if (mVariableMtrrChanged || mFixedMtrrChanged) {
+ ///
+ /// PERF_START (NULL, L"CacheSync", NULL, 0);
+ ///
+ ReadMtrrRegisters ();
+ Status1 = MpService->StartupAllAPs (
+ MpService,
+ MpMtrrSynchUp,
+ FALSE,
+ NULL,
+ 0,
+ NULL,
+ NULL
+ );
+ ///
+ /// PERF_END (NULL, L"CacheSync", NULL, 0);
+ ///
+ }
+ }
+
+ IoWrite32(PM_BASE_ADDRESS + 0x30, SmiEnVal); // Restore SMI Control and Enable Reg.
+ if (InterruptState) {
+ EnableInterrupt (&gCpu);
+ }
+ IoWrite8(0x21,MasterIrq); //restore irq mask
+ IoWrite8(0xA1,SlaveIrq);
+ return Status;
+}
+
+/**
+ Initialize the SmmBase pointer when SmmBase protocol get installed
+
+ @param[in] Event - Event whose notification function is being invoked.
+ @param[in] Context - Pointer to the notification functions context, which is implementation dependent.
+**/
+VOID
+EFIAPI
+InitializeSmmBasePtr (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ EFI_STATUS Status;
+
+ Status = gBS->LocateProtocol (&gEfiSmmBaseProtocolGuid, NULL, (VOID **) &mSmmBaseProtocol);
+ if (EFI_ERROR (Status)) {
+ mSmmBaseProtocol = NULL;
+ }
+}
+
+/**
+ Call back function to publish Hii data
+
+ @param[in] Event - The triggered event.
+ @param[in] Context - Context for this event.
+**/
+VOID
+EFIAPI
+HiiCallback (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+
+#if (EFI_SPECIFICATION_VERSION >= 0x2000A)
+ EFI_HII_PACKAGE_LIST_HEADER *PackageList;
+#else
+ EFI_HII_PACKAGES *PackageList;
+#endif
+ EFI_STATUS Status;
+
+ ///
+ /// Initialize strings to HII database
+ ///
+#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
+
+ Status = gBS->LocateProtocol (
+ &gEfiHiiDatabaseProtocolGuid,
+ NULL,
+ &mHiiDatabase
+ );
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+
+ ///
+ /// Create driver handle used by HII database
+ ///
+ Status = CreateHiiDriverHandle (&mDriverHandle);
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+
+ ///
+ /// Publish our HII data
+ ///
+ PackageList = PreparePackageList (1, &gProcessorProducerGuid, CpuInitDxeStrings);
+ if (PackageList == NULL) {
+ return;
+ }
+ Status = mHiiDatabase->NewPackageList (
+ mHiiDatabase,
+ PackageList,
+ mDriverHandle,
+ &mStringHandle
+ );
+ ASSERT_EFI_ERROR (Status);
+#else
+ ///
+ /// There should only be one HII protocol
+ ///
+ Status = gBS->LocateProtocol (
+ &gEfiHiiProtocolGuid,
+ NULL,
+ (VOID **) &mHii
+ );
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+ PackageList = PreparePackages (1, &gProcessorProducerGuid, CpuInitDxeStrings);
+ Status = mHii->NewPack (mHii, PackageList, &mStringHandle);
+ FreePool (PackageList);
+#endif
+}
+
+/**
+ Create SMBIOS Table type - FviSmbiosType, when ExitPmAuth event is signaled
+
+ @param[in] Event - A pointer to the Event that triggered the callback.
+ @param[in] Context - A pointer to private data registered with the callback function.
+ **/
+VOID
+InitializeFviDataCallback (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ EFI_STATUS Status;
+ VOID *ProtocolPointer;
+ UINT32 uCodeRevision;
+
+ Status = gBS->LocateProtocol (&gExitPmAuthProtocolGuid, NULL, &ProtocolPointer);
+ if (EFI_SUCCESS != Status) {
+ return;
+ }
+
+ gBS->CloseEvent (Event);
+
+ if (mPlatformCpu->CpuConfig->FviReport) {
+ InitFviDataHubCbContext (
+ mPlatformCpu->CpuConfig->FviSmbiosType,
+ (UINT8) mCpuFviElements,
+ &mCpuFviVersionData
+ );
+
+ uCodeRevision = GetCpuUcodeRevision ();
+ mCpuFviElementsData[UCODE_VER].Element.Version.MajorVersion = (UINT8) ((uCodeRevision & 0xFF000000) >> 24);
+ mCpuFviElementsData[UCODE_VER].Element.Version.MinorVersion = (UINT8) ((uCodeRevision & 0x00FF0000) >> 16);
+ mCpuFviElementsData[UCODE_VER].Element.Version.Revision = (UINT8) ((uCodeRevision & 0x0000FF00) >> 8);
+ mCpuFviElementsData[UCODE_VER].Element.Version.BuildNum = (UINT16) (uCodeRevision & 0x000000FF);
+
+ CreateRcFviDatahub (&mCpuFviVersionData);
+ }
+ return;
+}
+
+/**
+ Initialize the state information for the CPU Architectural Protocol
+
+ @param[in] ImageHandle - Image handle of the loaded driver
+ @param[in] SystemTable - Pointer to the System Table
+
+ @retval EFI_SUCCESS - thread can be successfully created
+ @retval EFI_OUT_OF_RESOURCES - cannot allocate protocol data structure
+ @retval EFI_DEVICE_ERROR - cannot create the thread
+**/
+EFI_STATUS
+EFIAPI
+InitializeCpu (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ EFI_HANDLE NewHandle1;
+ VOID *Registration;
+
+ ///
+ /// Initialize the Global Descriptor Table
+ ///
+ InitializeSelectors ();
+
+ ///
+ /// Setup Cache attributes and Interrupt Tables
+ ///
+ PrepareMemory ();
+
+ ///
+ /// Initialize Exception Handlers
+ ///
+ InitializeException (&gCpu);
+
+ ///
+ /// Install CPU Architectural Protocol
+ ///
+ NewHandle1 = NULL;
+ Status = gBS->InstallProtocolInterface (
+ &NewHandle1,
+ &gEfiCpuArchProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ &gCpu
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Refresh memory space attributes according to MTRRs
+ ///
+ Status = RefreshGcdMemoryAttributes ();
+ mIsFlushingGCD = FALSE;
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ ///
+ /// Locate DxeCpuPlatformPolicy protocol instance and assign it to a global variable
+ ///
+ Status = gBS->LocateProtocol (&gDxeCpuPlatformPolicyProtocolGuid, NULL, (VOID **) &mPlatformCpu);
+ if (EFI_ERROR (Status)) {
+ DEBUG((EFI_D_ERROR,"Failed to locate DxeCpuPlatformPolicy Protocol\n"));
+ return Status;
+ }
+
+ //
+ // Dump Cpu platform policy
+ //
+ CpuDxePolicyDump();
+
+ ///
+ /// Initialize the global SmmBase SWSMI number
+ ///
+ mSmmbaseSwSmiNumber = mPlatformCpu->CpuConfig->SmmbaseSwSmiNumber;
+
+ ///
+ /// Load the microcode if needed
+ ///
+ Status = LoadAllMicrocodeUpdates ();
+
+ Status = gBS->LocateProtocol (&gEfiMetronomeArchProtocolGuid, NULL, (VOID **) &mMetronome);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+#if (EFI_SPECIFICATION_VERSION >= 0x2000A)
+ EfiLibCreateProtocolNotifyEvent (
+ &gEfiHiiDatabaseProtocolGuid,
+ EFI_TPL_CALLBACK,
+ HiiCallback,
+ NULL,
+ &Registration
+ );
+#else
+ EfiLibCreateProtocolNotifyEvent (
+ &gEfiHiiProtocolGuid,
+ EFI_TPL_CALLBACK,
+ HiiCallback,
+ NULL,
+ &Registration
+ );
+#endif
+
+ ///
+ /// Create an SmmBase protocol call back event to initialize
+ /// Smm Base pointer, during SMM mode
+ ///
+ EfiCreateProtocolNotifyEvent (
+ &gEfiSmmBaseProtocolGuid,
+ TPL_CALLBACK,
+ InitializeSmmBasePtr,
+ NULL,
+ &mSmmBaseRegistration
+ );
+
+ ///
+ /// Initialize MP Support if necessary
+ ///
+ Status = InitializeMpSupport ();
+ if (EFI_ERROR(Status)) {
+ DEBUG((EFI_D_ERROR,"Failed to initialize MPs\n"));
+ }
+
+ ///
+ /// Create an ExitPmAuth protocol callback event to generate SMBIOS table - FviSmbiosType
+ ///
+ EfiCreateProtocolNotifyEvent (
+ &gExitPmAuthProtocolGuid,
+ EFI_TPL_CALLBACK,
+ InitializeFviDataCallback,
+ NULL,
+ &Registration
+ );
+
+ ///
+ /// Create an ExitPmAuth protocol callback event for PFAT.
+ ///
+ EfiCreateProtocolNotifyEvent (
+ &gExitPmAuthProtocolGuid,
+ EFI_TPL_CALLBACK,
+ InitializePfatToolsIntCallback,
+ NULL,
+ &Registration
+ );
+
+ ///
+ /// Verify if Boot Guard is supported
+ ///
+ if (IsBootGuardSupported()){
+ ///
+ /// Identify if Revocation is requested by Boot Guard ACM
+ ///
+ if (AsmReadMsr64 (MSR_BOOT_GUARD_SACM_INFO) & BIT7) {
+ ///
+ /// Create an ExitPmAuth protocol call back event if one or more of Boot Guard modules are revoked.
+ ///
+ EfiCreateProtocolNotifyEvent (
+ &gExitPmAuthProtocolGuid,
+ TPL_CALLBACK,
+ BootGuardRevocationCallback,
+ NULL,
+ &Registration
+ );
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Returns the actual CPU core frequency in MHz.
+
+ @param[in] Metronome - Metronome protocol
+ @param[in] Frequency - Pointer to the CPU core frequency
+
+ @retval EFI_SUCCESS - If the frequency is returned successfully
+ @retval EFI_INVALID_PARAMETER - If the input parameter is wrong
+**/
+EFI_STATUS
+GetActualFrequency (
+ IN EFI_METRONOME_ARCH_PROTOCOL *Metronome,
+ OUT UINT64 *Frequency
+ )
+{
+ UINT64 BeginValue;
+ UINT64 EndValue;
+ UINT64 TotalValue;
+ UINT32 TickCount;
+ BOOLEAN InterruptState;
+ EFI_STATUS Status;
+
+ if (Metronome == NULL || Frequency == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (mCpuFrequency == 0) {
+ ///
+ /// In order to calculate the actual CPU frequency, we keep track of the CPU Tsc value (which
+ /// increases by 1 for every cycle) for a know period of time. The Metronome is not accurate
+ /// for the 1st tick, so I choose to wait for 1000 ticks, thus the error can be control to be
+ /// lower than 1%.
+ ///
+ TickCount = SAMPLE_TICK_COUNT;
+ CpuGetInterruptState (&gCpu, &InterruptState);
+ if (InterruptState) {
+ DisableInterrupt (&gCpu);
+ }
+ ///
+ /// In DxeCis-0.91 specs.
+ /// Metronome->WaitForTick is possible for interrupt processing,
+ /// or exception processing to interrupt the execution of the WaitForTick() function.
+ /// Depending on the hardware source for the ticks, it is possible for a tick to be missed.
+ /// This function cannot guarantee that ticks will not be missed.
+ ///
+ while (TRUE) {
+ BeginValue = EfiReadTsc ();
+ Status = Metronome->WaitForTick (Metronome, TickCount);
+ EndValue = EfiReadTsc ();
+ if (!EFI_ERROR (Status)) {
+ TotalValue = EndValue - BeginValue;
+ break;
+ }
+ }
+
+ if (InterruptState) {
+ EnableInterrupt (&gCpu);
+ }
+
+ mCpuFrequency = MultU64x32 (TotalValue, 10);
+ mCpuFrequency = DivU64x32 (mCpuFrequency, Metronome->TickPeriod * TickCount);
+ }
+
+ *Frequency = mCpuFrequency;
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Dump RC CPU and PPM platform policies
+**/
+VOID
+CpuDxePolicyDump (
+ VOID
+ )
+{
+#ifdef EFI_DEBUG
+ CPU_CONFIG *CpuConfig;
+ POWER_MGMT_CONFIG *PowerMgmtConfig;
+ SECURITY_CONFIG *SecurityConfig;
+
+ CpuConfig = mPlatformCpu->CpuConfig;
+ PowerMgmtConfig = mPlatformCpu->PowerMgmtConfig;
+ SecurityConfig = mPlatformCpu->SecurityConfig;
+ //
+ // Dump Cpu Platform policy
+ //
+ DEBUG ((EFI_D_INFO, "\n------------------------ DXE CpuPlatformPolicy Dump Begin -----------------\n"));
+ //
+ // Cpu config
+ //
+ DEBUG ((EFI_D_INFO, " CPU:: HtState : 0x%X \n", CpuConfig->HtState));
+ DEBUG ((EFI_D_INFO, " CPU:: LimitCpuidMaximumValue : 0x%X\n", CpuConfig->LimitCpuidMaximumValue));
+ DEBUG ((EFI_D_INFO, " CPU:: ExecuteDisableBit : 0x%X\n", CpuConfig->ExecuteDisableBit));
+ DEBUG ((EFI_D_INFO, " CPU:: VmxEnable : 0x%X\n", CpuConfig->VmxEnable));
+ DEBUG ((EFI_D_INFO, " CPU:: SmxEnable : 0x%X\n", CpuConfig->SmxEnable));
+ DEBUG ((EFI_D_INFO, " CPU:: MachineCheckEnable : 0x%X\n", CpuConfig->MachineCheckEnable));
+ DEBUG ((EFI_D_INFO, " CPU:: MonitorMwaitEnable : 0x%X\n", CpuConfig->MonitorMwaitEnable));
+ DEBUG ((EFI_D_INFO, " CPU:: XapicEnable : 0x%X\n", CpuConfig->XapicEnable));
+ DEBUG ((EFI_D_INFO, " CPU:: IsColdReset : 0x%X\n", CpuConfig->IsColdReset));
+ DEBUG ((EFI_D_INFO, " CPU:: MlcStreamerPrefetcher : 0x%X\n", CpuConfig->MlcStreamerPrefetcher));
+ DEBUG ((EFI_D_INFO, " CPU:: EnableDts : 0x%X\n", CpuConfig->EnableDts));
+ DEBUG ((EFI_D_INFO, " CPU:: FviReport : 0x%X\n", CpuConfig->FviReport));
+ DEBUG ((EFI_D_INFO, " CPU:: AesEnable : 0x%X\n", CpuConfig->AesEnable));
+ DEBUG ((EFI_D_INFO, " CPU:: DebugInterfaceEnable : 0x%X\n", CpuConfig->DebugInterfaceEnable));
+ DEBUG ((EFI_D_INFO, " CPU:: DebugInterfaceLockEnable : 0x%X\n", CpuConfig->DebugInterfaceLockEnable));
+ DEBUG ((EFI_D_INFO, " CPU:: ApIdleManner : 0x%X\n", CpuConfig->ApIdleManner));
+ DEBUG ((EFI_D_INFO, " CPU:: ApHandoffManner : 0x%X\n", CpuConfig->ApHandoffManner));
+ DEBUG ((EFI_D_INFO, " CPU:: BspSelection : 0x%X\n", CpuConfig->BspSelection));
+ DEBUG ((EFI_D_INFO, " CPU:: SmmbaseSwSmiNumber : 0x%X\n", CpuConfig->SmmbaseSwSmiNumber));
+ DEBUG ((EFI_D_INFO, " CPU:: FviSmbiosType; : 0x%X\n", CpuConfig->FviSmbiosType));
+ //
+ // SECURITY_CONFIG : TXT_FUNCTION_CONFIG
+ //
+ DEBUG ((EFI_D_INFO, " CPU:: SECURITY_CONFIG:TXT_FUNCTION_CONFIG : ResetAux : 0x%X\n", SecurityConfig->TxtFunctionConfig->ResetAux));
+ DEBUG ((EFI_D_INFO, "\n------------------------ DXE CpuPlatformPolicy Dump End -----------------\n"));
+#endif
+}
+
+/**
+ Initialize the global DataHub pointer
+
+ @param[in] DataHub - Pointer to the DataHub protocol as output
+
+ @retval EFI_SUCCESS - If the DataHub pointer is initialized successfully
+**/
+EFI_STATUS
+InitializeDataHubPtr (
+ OUT EFI_DATA_HUB_PROTOCOL **DataHub
+ )
+{
+ EFI_STATUS Status;
+
+ Status = gBS->LocateProtocol (&gEfiDataHubProtocolGuid, NULL, (VOID **) DataHub);
+ return Status;
+}
+
+/**
+ Drop into SMM to register IOTRAP for pfat tools interface
+
+ @param[in] Event - A pointer to the Event that triggered the callback.
+ @param[in] Context - A pointer to private data registered with the callback function.
+**/
+VOID
+InitializePfatToolsIntCallback (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ EFI_STATUS Status;
+ VOID *ProtocolPointer;
+ EFI_PHYSICAL_ADDRESS BaseAddress;
+ PFAT_HOB *PfatHobPtr;
+ EFI_GUID PfatHobGuid = PFAT_HOB_GUID;
+
+ Status = gBS->LocateProtocol (&gExitPmAuthProtocolGuid, NULL, &ProtocolPointer);
+ if (EFI_SUCCESS != Status) {
+ return;
+ }
+
+ PfatHobPtr = GetFirstGuidHob (&PfatHobGuid);
+ if (PfatHobPtr != NULL) {
+ BaseAddress = (EFI_PHYSICAL_ADDRESS) PfatHobPtr->PfatToolsIntIoTrapAdd;
+ ///
+ /// IOTRAP TO SMM
+ ///
+ IoRead8 (BaseAddress);
+ }
+ return;
+}
+
+/**
+ Register callback function for Boot Guard revocation flow.
+
+ @param[in] Event - A pointer to the Event that triggered the callback.
+ @param[in] Context - A pointer to private data registered with the callback function.
+**/
+VOID
+EFIAPI
+BootGuardRevocationCallback (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ EFI_STATUS Status;
+ VOID *ProtocolPointer;
+
+ //
+ // Check whether this is real ExitPmAuth notification, or just a SignalEvent
+ //
+ Status = gBS->LocateProtocol (&gExitPmAuthProtocolGuid, NULL, (VOID **) &ProtocolPointer);
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+
+ BootGuardOemRevocationHook();
+
+ //
+ // Closed the event to avoid call twice
+ //
+ gBS->CloseEvent (Event);
+
+ return;
+}
diff --git a/ReferenceCode/Haswell/CpuInit/Dxe/CpuInitDxe.cif b/ReferenceCode/Haswell/CpuInit/Dxe/CpuInitDxe.cif
new file mode 100644
index 0000000..f533f7c
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Dxe/CpuInitDxe.cif
@@ -0,0 +1,46 @@
+<component>
+ name = "CpuInitDxe"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Haswell\CpuInit\Dxe"
+ RefName = "CpuInitDxe"
+[files]
+"CacheData.h"
+"CacheData.c"
+"CpuInitDxe.c"
+"CpuInitDxeDbgr.c"
+"CpuInitDxe.h"
+"CpuInitDxeDbgr.h"
+"CpuFvi.c"
+"Exception.h"
+"MachineCheck.c"
+"MachineCheck.h"
+"MemoryAttribute.c"
+"MemoryAttribute.h"
+"Microcode.c"
+"MpCommon.c"
+"MpCommon.h"
+"MpService.c"
+"MpService.h"
+"PiMpService.c"
+"PiMpService.h"
+"MtrrSync.c"
+"Features.c"
+"Features.h"
+"ProcessorData.c"
+"ProcessorData.h"
+"CpuInitDxeStrings.uni"
+"CpuInitDxe.inf"
+"CpuInitDxe.dxs"
+"CpuInitDxe.sdl"
+"CpuInitDxe.mak"
+"x64\Cpu.asm"
+"x64\MpFuncs.asm"
+"x64\MemoryOperation.c"
+"x64\MemoryOperationDbgr.c"
+"x64\Exception.c"
+"x64\MpCpu.c"
+"x64\CpuLib.h"
+"x64\ProcessorDef.h"
+"x64\VirtualMemory.h"
+"x64\MpEqu.inc"
+<endComponent>
diff --git a/ReferenceCode/Haswell/CpuInit/Dxe/CpuInitDxe.dxs b/ReferenceCode/Haswell/CpuInit/Dxe/CpuInitDxe.dxs
new file mode 100644
index 0000000..5298ba3
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Dxe/CpuInitDxe.dxs
@@ -0,0 +1,57 @@
+/** @file
+ This is the Dependency expression for the CPU architectural protocol
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "DxeDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+#include EFI_PROTOCOL_DEFINITION (CpuIo)
+#if (EFI_SPECIFICATION_VERSION>=0x2000A)
+#include EFI_PROTOCOL_DEFINITION (HiiDatabase)
+#else
+#include EFI_PROTOCOL_DEFINITION (Hii)
+#endif
+#include EFI_ARCH_PROTOCOL_DEFINITION (Variable)
+#include EFI_ARCH_PROTOCOL_DEFINITION (Metronome)
+#include EFI_PROTOCOL_DEFINITION (CpuPlatformPolicy)
+#endif
+
+DEPENDENCY_START
+ EFI_METRONOME_ARCH_PROTOCOL_GUID AND
+ EFI_CPU_IO_PROTOCOL_GUID AND
+#if (EFI_SPECIFICATION_VERSION>=0x2000A)
+ EFI_HII_DATABASE_PROTOCOL_GUID AND
+#else
+ EFI_HII_PROTOCOL_GUID AND
+#endif
+ EFI_VARIABLE_ARCH_PROTOCOL_GUID AND
+ DXE_CPU_PLATFORM_POLICY_PROTOCOL_GUID
+DEPENDENCY_END
diff --git a/ReferenceCode/Haswell/CpuInit/Dxe/CpuInitDxe.h b/ReferenceCode/Haswell/CpuInit/Dxe/CpuInitDxe.h
new file mode 100644
index 0000000..a7be681
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Dxe/CpuInitDxe.h
@@ -0,0 +1,546 @@
+/** @file
+ Private data structures
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#ifndef _CPU_INIT_DXE_H
+#define _CPU_INIT_DXE_H
+
+#include "CpuAccess.h"
+#include "MemoryAttribute.h"
+#include "RcFviDxeLib.h"
+#include "EdkIIGlueBaseLib.h"
+
+#include EFI_PROTOCOL_DEFINITION (CpuPlatformPolicy)
+#include EFI_PROTOCOL_CONSUMER (ExitPmAuth)
+#include EFI_PROTOCOL_DEFINITION (CpuInfo)
+
+#if (EFI_SPECIFICATION_VERSION >= 0x2000A)
+#include "UefiIfrLibrary.h"
+#endif
+
+#define INTERRUPT_VECTOR_NUMBER 256
+#define INTERRUPT_GATE_ATTRIBUTE 0x8e00
+#define NUMBER_OF_MICROCODE_UPDATE 10
+
+extern UINT8 mSmmbaseSwSmiNumber;
+
+#define CPU_FVI_STRING "Reference Code - CPU"
+#define CPU_FVI_SMBIOS_TYPE 0xDD ///< Default value
+#define CPU_FVI_SMBIOS_INSTANCE 0x02
+#define UCODE_FVI_STRING "uCode Version"
+#define UCODE_VERSION \
+ { \
+ 0xFF, 0xFF, 0xFF, 0xFFFF \
+ }
+#define TXT_FVI_STRING "TXT ACM version"
+#define TXT_ACM_MAJOR_VERSION 0x1
+#define TXT_ACM_MINOR_VERSION 0x3
+#define TXT_ACM_REVERSION 0x0
+#define TXT_ACM_BUILD_NUMBER 0x1
+#define TXT_VERSION \
+ { \
+ TXT_ACM_MAJOR_VERSION, TXT_ACM_MINOR_VERSION, TXT_ACM_REVERSION, TXT_ACM_BUILD_NUMBER \
+ }
+enum {
+ CPU_RC_VER= 0,
+ UCODE_VER,
+ TXT_VER
+} CPU_FVI_INDEX;
+
+extern FVI_ELEMENT_AND_FUNCTION mCpuFviElementsData[];
+extern FVI_DATA_HUB_CALLBACK_CONTEXT mCpuFviVersionData;
+extern UINTN mCpuFviElements;
+
+/**
+ Adjust length to a paragraph boundry
+
+ @param[in] MemoryLength - Input memory length.
+
+ @retval Returned Maximum length.
+**/
+UINT64
+Power2MaxMemory (
+ IN UINT64 MemoryLength
+ );
+
+/**
+ Disable cache and its mtrr
+
+ @param[in] OldMtrr - To return the Old MTRR value
+**/
+VOID
+EfiDisableCacheMtrr (
+ IN UINT64 *OldMtrr
+ );
+
+/**
+ Recover cache MTRR
+
+ @param[in] EnableMtrr - Whether to enable the MTRR
+ @param[in] OldMtrr - The saved old MTRR value to restore when not to
+ enable the MTRR
+**/
+VOID
+EfiRecoverCacheMtrr (
+ IN BOOLEAN EnableMtrr,
+ IN UINT64 OldMtrr
+ );
+
+typedef struct _ALIGNED_DWORD {
+ UINT32 High;
+ UINT32 Low;
+} ALIGNED_DWORD;
+
+typedef union _ALIGNED {
+ UINT64 AlignedQword;
+ ALIGNED_DWORD AlignedDword;
+} ALIGNED;
+
+/**
+ Initialize the state information for the CPU Architectural Protocol
+
+ @param[in] ImageHandle - Image handle of the loaded driver
+ @param[in] SystemTable - Pointer to the System Table
+
+ @retval EFI_SUCCESS - thread can be successfully created
+ @retval EFI_OUT_OF_RESOURCES - cannot allocate protocol data structure
+ @retval EFI_DEVICE_ERROR - cannot create the thread
+**/
+EFI_STATUS
+EFIAPI
+InitializeCpu (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ );
+
+/**
+ Prepare memory for essential system tables.
+
+ @retval EFI_SUCCESS - Memory successfully prepared.
+**/
+EFI_STATUS
+PrepareMemory (
+ VOID
+ );
+
+/**
+ Flush CPU data cache. If the instruction cache is fully coherent
+ with all DMA operations then function can just return EFI_SUCCESS.
+
+ @param[in] This - Protocol instance structure
+ @param[in] Start - Physical address to start flushing from.
+ @param[in] Length - Number of bytes to flush. Round up to chipset granularity.
+ @param[in] FlushType - Specifies the type of flush operation to perform.
+
+ @retval EFI_SUCCESS - If cache was flushed
+ @exception EFI_UNSUPPORTED - If flush type is not supported.
+ @retval EFI_DEVICE_ERROR - If requested range could not be flushed.
+**/
+EFI_STATUS
+EFIAPI
+FlushCpuDataCache (
+ IN EFI_CPU_ARCH_PROTOCOL *This,
+ IN EFI_PHYSICAL_ADDRESS Start,
+ IN UINT64 Length,
+ IN EFI_CPU_FLUSH_TYPE FlushType
+ );
+
+/**
+ Enables CPU interrupts.
+
+ @param[in] This - Protocol instance structure
+
+ @retval EFI_SUCCESS - If interrupts were enabled in the CPU
+ @retval EFI_DEVICE_ERROR - If interrupts could not be enabled on the CPU.
+**/
+EFI_STATUS
+EFIAPI
+EnableInterrupt (
+ IN EFI_CPU_ARCH_PROTOCOL *This
+ );
+
+/**
+ Disables CPU interrupts.
+
+ @param[in] This - Protocol instance structure
+
+ @retval EFI_SUCCESS - If interrupts were disabled in the CPU.
+ @retval EFI_DEVICE_ERROR - If interrupts could not be disabled on the CPU.
+**/
+EFI_STATUS
+EFIAPI
+DisableInterrupt (
+ IN EFI_CPU_ARCH_PROTOCOL *This
+ );
+
+/**
+ Return the state of interrupts.
+
+ @param[in] This - Protocol instance structure
+ @param[in] State - Pointer to the CPU's current interrupt state
+
+ @retval EFI_SUCCESS - If interrupts were disabled in the CPU.
+ @retval EFI_INVALID_PARAMETER - State is NULL.
+**/
+EFI_STATUS
+EFIAPI
+CpuGetInterruptState (
+ IN EFI_CPU_ARCH_PROTOCOL *This,
+ OUT BOOLEAN *State
+ );
+
+/**
+ Generates an INIT to the CPU
+
+ @param[in] This - Protocol instance structure
+ @param[in] InitType - Type of CPU INIT to perform
+
+ @retval EFI_SUCCESS - If CPU INIT occurred. This value should never be seen.
+ @retval EFI_DEVICE_ERROR - If CPU INIT failed.
+ @exception EFI_UNSUPPORTED - Requested type of CPU INIT not supported.
+**/
+EFI_STATUS
+EFIAPI
+Init (
+ IN EFI_CPU_ARCH_PROTOCOL *This,
+ IN EFI_CPU_INIT_TYPE InitType
+ );
+
+/**
+ Registers a function to be called from the CPU interrupt handler.
+
+ @param[in] This - Protocol instance structure
+ @param[in] InterruptType - Defines which interrupt to hook.
+ IA-32 valid range is 0x00 through 0xFF
+ @param[in] InterruptHandler - A pointer to a function of type EFI_CPU_INTERRUPT_HANDLER
+ that is called when a processor interrupt occurs.
+ A null pointer is an error condition.
+
+ @retval EFI_SUCCESS - If handler installed or uninstalled.
+ @retval EFI_ALREADY_STARTED - InterruptHandler is not NULL, and a handler for
+ InterruptType was previously installed
+ @retval EFI_INVALID_PARAMETER - InterruptHandler is NULL, and a handler for
+ InterruptType was not previously installed.
+ @exception EFI_UNSUPPORTED - The interrupt specified by InterruptType is not supported.
+**/
+EFI_STATUS
+EFIAPI
+RegisterInterruptHandler (
+ IN EFI_CPU_ARCH_PROTOCOL *This,
+ IN EFI_EXCEPTION_TYPE InterruptType,
+ IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler
+ );
+
+/**
+ Returns a timer value from one of the CPU's internal timers. There is no
+ inherent time interval between ticks but is a function of the CPU frequency.
+
+ @param[in] This - Protocol instance structure.
+ @param[in] TimerIndex - Specifies which CPU timer is requested.
+ @param[in] TimerValue - Pointer to the returned timer value.
+ @param[in] TimerPeriod - A pointer to the amount of time that passes in femtoseconds (10-15) for each
+ increment of TimerValue. If TimerValue does not increment at a predictable
+ rate, then 0 is returned. The amount of time that has passed between two calls to
+ GetTimerValue() can be calculated with the formula
+ (TimerValue2 - TimerValue1) * TimerPeriod. This parameter is optional and may be NULL.
+
+ @retval EFI_SUCCESS - If the CPU timer count was returned.
+ @exception EFI_UNSUPPORTED - If the CPU does not have any readable timers.
+ @retval EFI_DEVICE_ERROR - If an error occurred while reading the timer.
+ @retval EFI_INVALID_PARAMETER - TimerIndex is not valid or TimerValue is NULL.
+**/
+EFI_STATUS
+EFIAPI
+GetTimerValue (
+ IN EFI_CPU_ARCH_PROTOCOL *This,
+ IN UINT32 TimerIndex,
+ OUT UINT64 *TimerValue,
+ OUT UINT64 *TimerPeriod OPTIONAL
+ );
+
+/**
+ Set memory cacheability attributes for given range of memeory
+
+ @param[in] This - Protocol instance structure
+ @param[in] BaseAddress - Specifies the start address of the memory range
+ @param[in] Length - Specifies the length of the memory range
+ @param[in] Attributes - The memory cacheability for the memory range
+
+ @retval EFI_SUCCESS - If the cacheability of that memory range is set successfully
+ @exception EFI_UNSUPPORTED - If the desired operation cannot be done
+ @retval EFI_INVALID_PARAMETER - The input parameter is not correct, such as Length = 0
+**/
+EFI_STATUS
+EFIAPI
+SetMemoryAttributes (
+ IN EFI_CPU_ARCH_PROTOCOL *This,
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,
+ IN UINT64 Length,
+ IN UINT64 Attributes
+ );
+
+/**
+ Init Global Descriptor table
+**/
+VOID
+InitializeSelectors (
+ VOID
+ );
+
+typedef struct {
+ VOID *Start;
+ UINTN Size;
+ UINTN FixOffset;
+} INTERRUPT_HANDLER_TEMPLATE_MAP;
+
+typedef union {
+ EFI_CPU_DATA_RECORD *DataRecord;
+ UINT8 *Raw;
+} EFI_CPU_DATA_RECORD_BUFFER;
+
+///
+/// This constant defines the maximum length of the CPU brand string. According to the
+/// IA manual, the brand string is in EAX through EDX (thus 16 bytes) after executing
+/// the CPUID instructions with EAX as 80000002, 80000003, 80000004.
+///
+#define MAXIMUM_CPU_BRAND_STRING_LENGTH 48
+
+typedef struct {
+ BOOLEAN StringValid;
+ CHAR16 BrandString[MAXIMUM_CPU_BRAND_STRING_LENGTH + 1];
+ EFI_PROCESSOR_VERSION_DATA StringRef;
+} PROCESSOR_VERSION_INFORMATION;
+
+///
+/// The constant defines how many times the Cpuid instruction should be executed
+/// in order to get all the cache information. For Pentium 4 processor, 1 is enough
+///
+#define CPU_CPUID_EXECTION_COUNT 2
+
+typedef struct {
+ UINT64 IntendCoreFrequency;
+ UINT64 IntendFsbFrequency;
+ PROCESSOR_VERSION_INFORMATION Version;
+ EFI_PROCESSOR_MANUFACTURER_DATA Manufacturer;
+ EFI_PROCESSOR_ID_DATA CpuidData;
+ EFI_PROCESSOR_FAMILY_DATA Family;
+ INT16 Voltage;
+ EFI_PROCESSOR_APIC_BASE_ADDRESS_DATA ApicBase;
+ EFI_PROCESSOR_APIC_ID_DATA ApicID;
+ EFI_PROCESSOR_APIC_VERSION_NUMBER_DATA ApicVersion;
+ UINT32 MicrocodeRevision;
+ EFI_PROCESSOR_STATUS_DATA Status; ///< Need to update this field before report
+ CPU_PHYSICAL_LOCATION Location;
+ EFI_MP_HEALTH_FLAGS Health;
+ EFI_CPUID_REGISTER CacheInformation[CPU_CPUID_EXECTION_COUNT];
+} CPU_DATA_FOR_DATAHUB;
+
+///
+/// Type, FamilyId and Model values for the different processors
+/// [0:7] - Model
+/// [8:23] - FamilyId
+/// [24:31] - Type
+///
+#define RESERVED 0x00
+
+/**
+ This will locate a processor microcode and if it finds a newer revision, it will
+ load it to the processor.
+
+ @param[in] MicrocodePointerBuffer - The Array of pointers which each points to 1 microcode update binary (in memory)
+ @param[in] FailedRevision - The microcode revision that fails to be loaded
+
+ @retval EFI_SUCCESS - A new microcode update is loaded
+ @retval Other - Due to some reason, no new microcode update is loaded
+**/
+EFI_STATUS
+InitializeMicrocode (
+ IN EFI_CPU_MICROCODE_HEADER **MicrocodePointerBuffer,
+ OUT UINT32 *FailedRevision
+ );
+
+/**
+ To indicate the first microcode load is done
+**/
+VOID
+McuFirstLoadDone (
+ VOID
+ );
+
+/**
+ Initializes MP support in the system.
+
+ @retval EFI_SUCCESS - Multiple processors are initialized successfully.
+ @retval EFI_NOT_FOUND - The ACPI variable is not found in S3 boot path.
+ @retval EFI_OUT_OF_RESOURCES - No enough resoruces (such as out of memory).
+**/
+EFI_STATUS
+InitializeMpSupport (
+ VOID
+ );
+
+/**
+ Save the MTRR registers to global variables
+**/
+VOID
+ReadMtrrRegisters (
+ VOID
+ );
+
+/**
+ Synch up the MTRR values for all processors
+**/
+VOID
+EFIAPI
+MpMtrrSynchUp (
+ IN VOID *Buffer
+ );
+
+/**
+ Copy Global MTRR data to S3
+**/
+VOID
+SaveBspMtrrForS3 (
+ VOID
+ );
+
+/**
+ Load all microcode updates to memory. Since in S3 resume boot path, CPUs should be
+ patched again, these microcode updates are copied to OS reserved memory.
+
+ @retval EFI_SUCCESS - All microcode updates are loaded to memory successfully
+ @retval EFI_OUT_OF_RESOURCES - Not enough memory to accomodate all the microcode updates
+**/
+EFI_STATUS
+LoadAllMicrocodeUpdates (
+ VOID
+ );
+
+/**
+ Returns the actual CPU core frequency in MHz.
+
+ @param[in] Metronome - Metronome protocol
+ @param[in] Frequency - Pointer to the CPU core frequency
+
+ @retval EFI_SUCCESS - If the frequency is returned successfully
+ @retval EFI_INVALID_PARAMETER - If the input parameter is wrong
+**/
+EFI_STATUS
+GetActualFrequency (
+ IN EFI_METRONOME_ARCH_PROTOCOL *Metronome,
+ OUT UINT64 *Frequency
+ );
+
+/**
+ Dump RC CPU and PPM platform policies
+**/
+VOID
+CpuDxePolicyDump (
+ VOID
+ );
+
+/**
+ Initialize the global DataHub pointer
+
+ @param[in] DataHub - Pointer to the DataHub protocol as output
+
+ @retval EFI_SUCCESS - If the DataHub pointer is initialized successfully
+**/
+EFI_STATUS
+InitializeDataHubPtr (
+ OUT EFI_DATA_HUB_PROTOCOL **DataHub
+ );
+
+/**
+ Check if loading microcode update fails, if so, report proper status code
+
+ @param[in] CpuNumber - The CPU number
+ @param[in] Status - The return value of InitializeMicrocode()
+ @param[in] FailedRevision - The revision of the microcode update that failed to be loaded
+
+ @retval EFI_SUCCESS - The status is check and proper status code is reported
+**/
+EFI_STATUS
+CheckMicrocodeUpdate (
+ IN UINTN CpuNumber,
+ IN EFI_STATUS Status,
+ IN UINT32 FailedRevision
+ );
+
+/**
+ Enable Cpu Interrupt
+**/
+VOID
+CpuEnableInterrupt (
+ VOID
+ );
+
+/**
+ Disable Cpu Interrupt
+**/
+VOID
+CpuDisableInterrupt (
+ VOID
+ );
+
+/**
+ Get code segment
+
+ @retval Code segmnet value
+**/
+UINT16
+GetCodeSegment (
+ VOID
+ );
+
+/**
+ Initialize Cpu float point unit
+**/
+VOID
+CpuInitFloatPointUnit (
+ VOID
+ );
+
+/**
+ Drop into SMM to register IOTRAP handler for pfat tools interface
+
+ @param[in] Event - A pointer to the Event that triggered the callback.
+ @param[in] Context - A pointer to private data registered with the callback function.
+**/
+VOID
+InitializePfatToolsIntCallback (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ );
+
+/**
+ Register callback function for Boot Guard revocation flow.
+
+ @param[in] Event - A pointer to the Event that triggered the callback.
+ @param[in] Context - A pointer to private data registered with the callback function.
+**/
+VOID
+EFIAPI
+BootGuardRevocationCallback (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ );
+
+#endif
diff --git a/ReferenceCode/Haswell/CpuInit/Dxe/CpuInitDxe.inf b/ReferenceCode/Haswell/CpuInit/Dxe/CpuInitDxe.inf
new file mode 100644
index 0000000..bd66192
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Dxe/CpuInitDxe.inf
@@ -0,0 +1,171 @@
+## @file
+# Component description file for MP Cpu module.
+#
+#@copyright
+# Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains an 'Intel Peripheral Driver' and uniquely
+# identified as "Intel Reference Module" and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+
+[defines]
+BASE_NAME = CpuInitDxe
+FILE_GUID = 62D171CB-78CD-4480-8678-C6A2A797A8DE
+COMPONENT_TYPE = BS_DRIVER
+
+[sources.ia32]
+
+[sources.x64]
+ x64/Cpu.asm
+ x64/MpFuncs.asm
+ x64/MemoryOperation.c
+ x64/Exception.c
+ x64/MpCpu.c
+ x64/CpuLib.h
+ x64/ProcessorDef.h
+ x64/VirtualMemory.h
+
+[sources.common]
+ CacheData.h
+ CacheData.c
+ CpuInitDxe.c
+ CpuInitDxe.h
+ Exception.h
+ MachineCheck.c
+ MachineCheck.h
+ MemoryAttribute.c
+ MemoryAttribute.h
+ Microcode.c
+ MpCommon.c
+ MpCommon.h
+ MpService.c
+ MpService.h
+ PiMpService.c
+ PiMpService.h
+ MtrrSync.c
+ Features.c
+ Features.h
+ ProcessorData.c
+ ProcessorData.h
+ CpuInitDxeStrings.uni
+ CpuFvi.c
+
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueDxeDriverEntryPoint.c
+
+[includes.common]
+ $(DEST_DIR)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/FrameWork
+ $(EDK_SOURCE)/Foundation/FrameWork/Include
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/Pei/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Cpu/Pentium/Include
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/CpuInit/Dxe
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/CpuInit/Dxe/x64
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include/Library
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+
+#
+# if (EFI_SPECIFICATION_VERSION < 0x0002000A), use EfiIfrSupportLib
+# if (EFI_SPECIFICATION_VERSION >= 0x0002000A), use UefiEfiIfrSupportLib
+#
+# $(EDK_SOURCE)/Foundation/Library/Dxe/EfiIfrSupportLib
+ $(EDK_SOURCE)/Foundation/Library/Dxe/UefiEfiIfrSupportLib
+
+#
+# Edk II Glue Library, some hearder are included by R9 header so have to include
+#
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Framework
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include/Library
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/SampleCode
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/SampleCode/Include
+
+[libraries.common]
+ EfiGuidLib
+ EdkFrameworkProtocolLib
+ EdkProtocolLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueBaseLib
+ EdkIIGlueBaseMemoryLib
+ EdkIIGlueDxeReportStatusCodeLib
+ EdkIIGlueDxeServicesTableLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueUefiLib
+ EdkIIGlueBasePciLibPciExpress
+ EdkIIGlueDxeMemoryAllocationLib
+ EdkIIGlueDxeHobLib
+ EdkIIGlueHiiLib
+ EdkIIGlueBaseTimerLibLocalApic
+
+#
+# if (EFI_SPECIFICATION_VERSION < 0x0002000A), use EfiIfrSupportLib
+# if (EFI_SPECIFICATION_VERSION >= 0x0002000A), use UefiEfiIfrSupportLib, EfiDriverLib
+#
+# EfiIfrSupportLib
+ EfiDriverLib
+ UefiEfiIfrSupportLib
+ CpuProtocolLib
+ CpuGuidLib
+ CpuIA32Lib
+ RcFviDxeLib
+ CpuPlatformLib
+ BootGuardLib
+ BootGuardRevocationLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT=_ModuleEntryPoint
+ DPX_SOURCE=CpuInitDxe.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=InitializeCpu
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_BASE_LIB__ \
+ -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_LIB__ \
+ -D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+ -D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ -D __EDKII_GLUE_DXE_HOB_LIB__
+
diff --git a/ReferenceCode/Haswell/CpuInit/Dxe/CpuInitDxe.mak b/ReferenceCode/Haswell/CpuInit/Dxe/CpuInitDxe.mak
new file mode 100644
index 0000000..f3d5922
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Dxe/CpuInitDxe.mak
@@ -0,0 +1,140 @@
+# MAK file for the eModule:PowerManagement
+
+EDK : CpuInitDxe
+
+BUILD_CpuInitDxe_DIR = $(BUILD_DIR)\$(CpuInitDxe_DIR)
+
+$(BUILD_DIR)\CpuInitDxe.mak : $(CpuInitDxe_DIR)\CpuInitDxe.cif $(BUILD_RULES)
+ $(CIF2MAK) $(CpuInitDxe_DIR)\CpuInitDxe.cif $(CIF2MAK_DEFAULTS)
+
+CpuInitDxe : $(BUILD_DIR)\CpuInitDxe.MAK CpuInitDxeBin
+
+CpuInitDxe_OBJECTS = \
+ $(BUILD_CpuInitDxe_DIR)\CacheData.obj \
+ $(BUILD_CpuInitDxe_DIR)\CpuFvi.obj \
+ $(BUILD_CpuInitDxe_DIR)\MachineCheck.obj \
+ $(BUILD_CpuInitDxe_DIR)\MemoryAttribute.obj \
+ $(BUILD_CpuInitDxe_DIR)\Microcode.obj \
+ $(BUILD_CpuInitDxe_DIR)\MpCommon.obj \
+ $(BUILD_CpuInitDxe_DIR)\MpService.obj \
+ $(BUILD_CpuInitDxe_DIR)\PiMpService.obj \
+ $(BUILD_CpuInitDxe_DIR)\MtrrSync.obj \
+ $(BUILD_CpuInitDxe_DIR)\Features.obj \
+ $(BUILD_CpuInitDxe_DIR)\ProcessorData.obj \
+ $(BUILD_CpuInitDxe_DIR)\x64\Cpu.obj \
+ $(BUILD_CpuInitDxe_DIR)\x64\MpFuncs.obj \
+ $(BUILD_CpuInitDxe_DIR)\x64\Exception.obj \
+ $(BUILD_CpuInitDxe_DIR)\x64\MpCpu.obj \
+!IFDEF PeiDebugger_SUPPORT
+!IF $(PeiDebugger_SUPPORT)
+ $(BUILD_CpuInitDxe_DIR)\CpuInitDxeDbgr.obj \
+ $(BUILD_CpuInitDxe_DIR)\x64\MemoryOperationDbgr.obj \
+!ELSE
+ $(BUILD_CpuInitDxe_DIR)\CpuInitDxe.obj \
+ $(BUILD_CpuInitDxe_DIR)\x64\MemoryOperation.obj \
+!ENDIF
+!ELSE
+ $(BUILD_CpuInitDxe_DIR)\CpuInitDxe.obj \
+ $(BUILD_CpuInitDxe_DIR)\x64\MemoryOperation.obj \
+!ENDIF
+ $(BUILD_DIR)\CpuInitDxeStrings.obj \
+
+CpuInitDxe_MY_INCLUDES= \
+ $(EdkIIGlueLib_INCLUDES)\
+ $(EDK_INCLUDES)\
+ $(PROJECT_CPU_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+ /I$(PROJECT_CPU_ROOT)\CpuInit\Dxe\
+ /I$(PROJECT_CPU_ROOT)\CpuInit\Dxe\x64\
+ /I$(PROJECT_CPU_ROOT)\CpuSmm\Include\
+ /I$(UefiEfiIfrSupportLib_DIR)\
+ /I$(PROJECT_CPU_ROOT)\
+ /I$(PROJECT_CPU_ROOT)\Include\
+ /IBoard\EM\Platform\SMBIOSUpdateData
+
+CpuInitDxe_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=InitializeCpu"\
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_BASE_LIB__ \
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_UEFI_LIB__ \
+ /D __EDKII_GLUE_UEFI_DEVICE_PATH_LIB__ \
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+ /D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ /D __EDKII_GLUE_DXE_HOB_LIB__ \
+ /D REQUEST_EBDA_SIZE="$(REQUEST_EBDA_SIZE)" \
+!IFDEF AMI_PEI_DEBUG_SUPPORT
+!IF $(AMI_PEI_DEBUG_SUPPORT)
+ /D __AMI_PEI_DEBUG_SUPPORT__
+!ENDIF
+!ENDIF
+!IF $(CPU_MODULE_CREATE_SMBIOS_TABLES)
+ /D__CREATE_CPU_SMBIOS__
+!ENDIF
+
+CpuInitDxe_LIBS =\
+ $(EFIGUIDLIB)\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(EDKPROTOCOLLIB)\
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueDxeServicesTableLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueUefiLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(EdkIIGlueDxeMemoryAllocationLib_LIB)\
+ $(EdkIIGlueBaseTimerLibLocalApic_LIB)\
+ $(EdkIIGlueDxeHobLib_LIB)\
+ $(EdkIIGlueHiiLib_LIB)\
+ $(EFIDRIVERLIB)\
+ $(UEFIEFIIFRSUPPORTLIB)\
+ $(CpuProtocolLib_LIB)\
+ $(CpuGuidLib_LIB)\
+ $(CPUIA32LIB)\
+ $(CpuPlatformLib_LIB)\
+ $(PchPlatformDxeLib_LIB)\
+ $(RcFviDxeLib_LIB)\
+ $(BootGuardRevocationLib_LIB)\
+ $(BootGuardLib_LIB)
+
+
+CpuInitDxeBin : $(CpuInitDxe_LIBS)
+ $(CC) $(CFLAGS) /Fo$(BUILD_DIR)\ $(BUILD_DIR)\CpuInitDxeStrings.c
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\CpuInitDxe.mak all\
+ NAME=CpuInitDxe\
+ MAKEFILE=$(BUILD_DIR)\CpuInitDxe.mak \
+ "MY_INCLUDES=$(CpuInitDxe_MY_INCLUDES)" \
+ "MY_DEFINES=$(CpuInitDxe_DEFINES)"\
+ OBJECTS="$(CpuInitDxe_OBJECTS)" \
+ GUID=62D171CB-78CD-4480-8678-C6A2A797A8DE\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=RT_DRIVER \
+ EDKIIModule=DXEDRIVER\
+ DEPEX1=$(CpuInitDxe_DIR)\CpuInitDxe.DXS \
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \
+ COMPRESS=1
+
+#---------------------------------------------------------------------------
+# Create Cpu SDB data
+#---------------------------------------------------------------------------
+SetupSdbs : CpuDxeSDB
+
+CpuDxeSDB : $(BUILD_DIR)\CpuInitDxe.mak
+ $(MAKE) /$(MAKEFLAGS) $(BUILD_DEFAULTS)\
+ /f $(BUILD_DIR)\CpuInitDxe.mak all\
+ TYPE=SDB NAME=CpuInitDxe
+ $(STRGATHER) -dump -lang $(SUPPORTED_LANGUAGES: = -lang )\
+ -db $(BUILD_DIR)\CpuInitDxe.sdb\
+ -oh $(BUILD_DIR)\CpuInitDxeStrDefs.h\
+ -bn CpuInitDxeStrings\
+ -oc $(BUILD_DIR)\CpuInitDxeStrings.c
+# $(CC) $(CFLAGS) /Fo$(BUILD_DIR)\ $(BUILD_DIR)\CpuInitDxeStrings.c
+
diff --git a/ReferenceCode/Haswell/CpuInit/Dxe/CpuInitDxe.sdl b/ReferenceCode/Haswell/CpuInit/Dxe/CpuInitDxe.sdl
new file mode 100644
index 0000000..e50eae9
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Dxe/CpuInitDxe.sdl
@@ -0,0 +1,45 @@
+TOKEN
+ Name = "CpuInitDxe_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable Cpu Pei init support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+End
+
+TOKEN
+ Name = "REQUEST_EBDA_SIZE"
+ Value = "0x1000"
+ Help = "Default value 0x1000. If we need to use EBDA, please change the token value to 0x2000. For example, Using mini-pcie card."
+ TokenType = Integer
+ TargetMAK = Yes
+End
+
+PATH
+ Name = "CpuInitDxe_DIR"
+End
+
+MODULE
+ Help = "Includes CpuPeiInit.mak to Project"
+ File = "CpuInitDxe.mak"
+End
+
+ELINK
+ Name = "CpuInitDxe_INCLUDES"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "/I$(CpuInitDxe_DIR)"
+ Parent = "CpuInitDxe_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\CpuInitDxe.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+
diff --git a/ReferenceCode/Haswell/CpuInit/Dxe/CpuInitDxeDbgr.c b/ReferenceCode/Haswell/CpuInit/Dxe/CpuInitDxeDbgr.c
new file mode 100644
index 0000000..308329e
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Dxe/CpuInitDxeDbgr.c
@@ -0,0 +1,1112 @@
+/** @file
+ Cpu driver, which initializes CPU and implements CPU Architecture
+ Protocol as defined in Framework specification.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "CpuInitDxeDbgr.h"
+#include "ProcessorData.h"
+#include "CacheData.h"
+#include "Exception.h"
+#include "PfatDefinitions.h"
+#include "BootGuardLibrary.h"
+#include "BootGuardRevocationLib.h"
+//(AMI_CHG+)>
+#if defined(AMI_PEI_DEBUG_SUPPORT) && AMI_PEI_DEBUG_SUPPORT
+EFI_GUID gAmiDebuggerCpuProtocolGuid = AMI_DEBUGGER_CPU_PROTOCOL_GUID;
+AMI_DEBUGGER_CPU_PROTOCOL *mAmiDebuggerCpuProtocol;
+VOID* AptioInterruptHandlerHalt;
+UINT32 AptioInterruptHandlerHalt1;
+VOID
+EFIAPI CommonExceptionHandler (
+ IN EFI_EXCEPTION_TYPE InterruptType,
+ IN EFI_SYSTEM_CONTEXT SystemContext
+ );
+#endif
+//<(AMI_CHG+)
+
+#define SAMPLE_TICK_COUNT 1000
+
+#endif
+
+extern UINT64 mValidMtrrAddressMask;
+extern UINT64 mValidMtrrBitsMask;
+extern EFI_CPU_MICROCODE_HEADER **mMicrocodePointerBuffer;
+extern UINT8 CpuInitDxeStrings[];
+
+#if (EFI_SPECIFICATION_VERSION >= 0x2000A)
+EFI_HANDLE mDriverHandle;
+EFI_HII_DATABASE_PROTOCOL *mHiiDatabase;
+#else
+EFI_HII_PROTOCOL *mHii;
+#endif
+EFI_SMM_BASE_PROTOCOL *mSmmBaseProtocol = NULL;
+VOID *mSmmBaseRegistration;
+EFI_METRONOME_ARCH_PROTOCOL *mMetronome;
+DXE_CPU_PLATFORM_POLICY_PROTOCOL *mPlatformCpu = NULL;
+EFI_HII_HANDLE mStringHandle;
+BOOLEAN mIsFlushingGCD = TRUE;
+UINT8 mSmmbaseSwSmiNumber;
+BOOLEAN mVariableMtrrChanged;
+BOOLEAN mFixedMtrrChanged;
+UINT64 mCpuFrequency = 0;
+
+EFI_EVENT gReadyToBootEvent;
+EFI_CPU_INTERRUPT_HANDLER mExternalVectorTable[0x100];
+BOOLEAN mInterruptState = FALSE;
+
+///
+/// The Cpu Architectural Protocol that this Driver produces
+///
+EFI_CPU_ARCH_PROTOCOL gCpu = {
+ FlushCpuDataCache,
+ EnableInterrupt,
+ DisableInterrupt,
+ CpuGetInterruptState,
+ Init,
+ RegisterInterruptHandler,
+ GetTimerValue,
+ SetMemoryAttributes,
+ 1, ///< NumberOfTimers
+ 4, ///< DmaBufferAlignment
+};
+
+/**
+ Decide if the CPU is executing in SMM mode
+
+ @retval TRUE - The CPU is executing in SMM mode
+ @retval FALSE - The CPU is not executing in SMM mode
+**/
+BOOLEAN
+ExecutionInSmm (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ BOOLEAN InSmm;
+
+ if (mSmmBaseProtocol == NULL) {
+ return FALSE;
+ }
+
+ Status = mSmmBaseProtocol->InSmm (mSmmBaseProtocol, &InSmm);
+ ASSERT_EFI_ERROR (Status);
+ return InSmm;
+}
+
+/**
+ Flush CPU data cache. If the instruction cache is fully coherent
+ with all DMA operations then function can just return EFI_SUCCESS.
+
+ @param[in] This - Protocol instance structure
+ @param[in] Start - Physical address to start flushing from.
+ @param[in] Length - Number of bytes to flush. Round up to chipset
+ granularity.
+ @param[in] FlushType - Specifies the type of flush operation to perform.
+
+ @retval EFI_SUCCESS - If cache was flushed
+ @exception EFI_UNSUPPORTED - If flush type is not supported.
+ @retval EFI_DEVICE_ERROR - If requested range could not be flushed.
+**/
+EFI_STATUS
+EFIAPI
+FlushCpuDataCache (
+ IN EFI_CPU_ARCH_PROTOCOL *This,
+ IN EFI_PHYSICAL_ADDRESS Start,
+ IN UINT64 Length,
+ IN EFI_CPU_FLUSH_TYPE FlushType
+ )
+{
+ if (FlushType == EfiCpuFlushTypeWriteBackInvalidate) {
+ AsmWbinvd ();
+ return EFI_SUCCESS;
+ } else if (FlushType == EfiCpuFlushTypeInvalidate) {
+ EfiInvd ();
+ return EFI_SUCCESS;
+ } else {
+ return EFI_UNSUPPORTED;
+ }
+}
+
+/**
+ Enables CPU interrupts.
+
+ @param[in] This - Protocol instance structure
+
+ @retval EFI_SUCCESS - If interrupts were enabled in the CPU
+ @retval EFI_DEVICE_ERROR - If interrupts could not be enabled on the CPU.
+**/
+EFI_STATUS
+EFIAPI
+EnableInterrupt (
+ IN EFI_CPU_ARCH_PROTOCOL *This
+ )
+{
+ if (!ExecutionInSmm ()) {
+ CpuEnableInterrupt ();
+ }
+
+ mInterruptState = TRUE;
+ return EFI_SUCCESS;
+}
+
+/**
+ Disables CPU interrupts.
+
+ @param[in] This - Protocol instance structure
+
+ @retval EFI_SUCCESS - If interrupts were disabled in the CPU.
+**/
+EFI_STATUS
+EFIAPI
+DisableInterrupt (
+ IN EFI_CPU_ARCH_PROTOCOL *This
+ )
+{
+ CpuDisableInterrupt ();
+
+ mInterruptState = FALSE;
+ return EFI_SUCCESS;
+}
+
+/**
+ Return the state of interrupts.
+
+ @param[in] This - Protocol instance structure
+ @param[in] State - Pointer to the CPU's current interrupt state
+
+ @retval EFI_SUCCESS - If interrupts were disabled in the CPU.
+ @retval EFI_INVALID_PARAMETER - State is NULL.
+**/
+EFI_STATUS
+EFIAPI
+CpuGetInterruptState (
+ IN EFI_CPU_ARCH_PROTOCOL *This,
+ OUT BOOLEAN *State
+ )
+{
+ if (State == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ *State = mInterruptState;
+ return EFI_SUCCESS;
+}
+
+/**
+ Generates an INIT to the CPU
+
+ @param[in] This - Protocol instance structure
+ @param[in] InitType - Type of CPU INIT to perform
+
+ @retval EFI_SUCCESS - If CPU INIT occurred. This value should never be seen
+ @retval EFI_DEVICE_ERROR - If CPU INIT failed.
+ @exception EFI_UNSUPPORTED - Requested type of CPU INIT not supported.
+**/
+EFI_STATUS
+EFIAPI
+Init (
+ IN EFI_CPU_ARCH_PROTOCOL *This,
+ IN EFI_CPU_INIT_TYPE InitType
+ )
+{
+ return EFI_UNSUPPORTED;
+}
+
+/**
+ Registers a function to be called from the CPU interrupt handler.
+
+ @param[in] This - Protocol instance structure
+ @param[in] InterruptType - Defines which interrupt to hook.
+ IA-32 valid range is 0x00 through 0xFF
+ @param[in] InterruptHandler - A pointer to a function of type EFI_CPU_INTERRUPT_HANDLER
+ that is called when a processor interrupt occurs.
+ A null pointer is an error condition.
+
+ @retval EFI_SUCCESS - If handler installed or uninstalled.
+ @retval EFI_ALREADY_STARTED - InterruptHandler is not NULL, and a handler for
+ InterruptType was previously installed
+ @retval EFI_INVALID_PARAMETER - InterruptHandler is NULL, and a handler for
+ InterruptType was not previously installed.
+ @exception EFI_UNSUPPORTED - The interrupt specified by InterruptType is not supported.
+**/
+EFI_STATUS
+EFIAPI
+RegisterInterruptHandler (
+ IN EFI_CPU_ARCH_PROTOCOL *This,
+ IN EFI_EXCEPTION_TYPE InterruptType,
+ IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler
+ )
+{
+//(AMI_CHG+)>
+#if defined(AMI_PEI_DEBUG_SUPPORT) && AMI_PEI_DEBUG_SUPPORT
+ EFI_STATUS Status;
+#endif
+//<(AMI_CHG+)
+
+ if (InterruptType < 0 || InterruptType > 0xff) {
+ return EFI_UNSUPPORTED;
+ }
+
+ if (InterruptHandler == NULL && mExternalVectorTable[InterruptType] == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (InterruptHandler != NULL && mExternalVectorTable[InterruptType] != NULL) {
+ return EFI_ALREADY_STARTED;
+ }
+
+ mExternalVectorTable[InterruptType] = InterruptHandler;
+
+//AMI_CHG>
+#if defined(AMI_PEI_DEBUG_SUPPORT) && AMI_PEI_DEBUG_SUPPORT
+ if ((UINT32) InterruptHandler == (UINT32)CommonExceptionHandler)
+ Status = mAmiDebuggerCpuProtocol->DebuggerIsDebuggerIrqHadler(InterruptType,AptioInterruptHandlerHalt);
+ else
+ Status = mAmiDebuggerCpuProtocol->DebuggerIsDebuggerIrqHadler(InterruptType,InterruptHandler);
+#endif
+//<AMI_CHG
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+GetTimerValue (
+ IN EFI_CPU_ARCH_PROTOCOL *This,
+ IN UINT32 TimerIndex,
+ OUT UINT64 *TimerValue,
+ OUT UINT64 *TimerPeriod OPTIONAL
+ )
+/**
+ Returns a timer value from one of the CPU's internal timers. There is no
+ inherent time interval between ticks but is a function of the CPU frequency.
+
+ @param[in] This - Protocol instance structure.
+ @param[in] TimerIndex - Specifies which CPU timer is requested.
+ @param[in] TimerValue - Pointer to the returned timer value.
+ @param[in] TimerPeriod - A pointer to the amount of time that passes in femtoseconds (10-15) for each
+ increment of TimerValue. If TimerValue does not increment at a predictable
+ rate, then 0 is returned. The amount of time that has passed between two calls to
+ GetTimerValue() can be calculated with the formula
+ (TimerValue2 - TimerValue1) * TimerPeriod. This parameter is optional and may be NULL.
+
+ @retval EFI_SUCCESS - If the CPU timer count was returned.
+ @exception EFI_UNSUPPORTED - If the CPU does not have any readable timers.
+ @retval EFI_DEVICE_ERROR - If an error occurred while reading the timer.
+ @retval EFI_INVALID_PARAMETER - TimerIndex is not valid or TimerValue is NULL.
+**/
+{
+ UINT64 Actual;
+
+ if (TimerValue == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (TimerIndex != 0) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ *TimerValue = EfiReadTsc ();
+
+ if (TimerPeriod != NULL) {
+ GetActualFrequency (mMetronome, &Actual);
+ *TimerPeriod = DivU64x32 (1000000000, (UINT32) Actual);
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Set memory cacheability attributes for given range of memeory
+
+ @param[in] This - Protocol instance structure
+ @param[in] BaseAddress - Specifies the start address of the memory range
+ @param[in] Length - Specifies the length of the memory range
+ @param[in] Attributes - The memory cacheability for the memory range
+
+ @retval EFI_SUCCESS - If the cacheability of that memory range is set successfully
+ @exception EFI_UNSUPPORTED - If the desired operation cannot be done
+ @retval EFI_INVALID_PARAMETER - The input parameter is not correct, such as Length = 0
+**/
+EFI_STATUS
+EFIAPI
+SetMemoryAttributes (
+ IN EFI_CPU_ARCH_PROTOCOL *This,
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,
+ IN UINT64 Length,
+ IN UINT64 Attributes
+ )
+{
+ EFI_STATUS Status;
+ UINT64 TempQword;
+ UINT32 MsrNum;
+ UINTN MtrrNumber;
+ BOOLEAN Positive;
+ BOOLEAN OverLap;
+#define SKIP_ALIGN_CHECK 0
+#if SKIP_ALIGN_CHECK
+ UINT32 Remainder;
+#endif
+ EFI_MP_SERVICES_PROTOCOL *MpService;
+ EFI_STATUS Status1;
+ UINT32 VariableMtrrLimit;
+
+ mFixedMtrrChanged = FALSE;
+ mVariableMtrrChanged = FALSE;
+
+ VariableMtrrLimit = (UINT32) (AsmReadMsr64 (IA32_MTRR_CAP) & B_IA32_MTRR_VARIABLE_SUPPORT);
+
+ if (mIsFlushingGCD) {
+ return EFI_SUCCESS;
+ }
+
+ TempQword = 0;
+
+ ///
+ /// Check for invalid parameter
+ ///
+ if (Length == 0) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if ((BaseAddress &~mValidMtrrAddressMask) != 0 || (Length &~mValidMtrrAddressMask) != 0) {
+ return EFI_UNSUPPORTED;
+ }
+
+ switch (Attributes) {
+ case EFI_MEMORY_UC:
+ Attributes = CACHE_UNCACHEABLE;
+ break;
+
+ case EFI_MEMORY_WC:
+ Attributes = CACHE_WRITECOMBINING;
+ break;
+
+ case EFI_MEMORY_WT:
+ Attributes = CACHE_WRITETHROUGH;
+ break;
+
+ case EFI_MEMORY_WP:
+ Attributes = CACHE_WRITEPROTECTED;
+ break;
+
+ case EFI_MEMORY_WB:
+ Attributes = CACHE_WRITEBACK;
+ break;
+
+ default:
+ return EFI_UNSUPPORTED;
+ }
+
+ ///
+ /// Check if Fixed MTRR
+ ///
+ Status = EFI_SUCCESS;
+ while ((BaseAddress < (1 << 20)) && (Length > 0) && Status == EFI_SUCCESS) {
+ Status = CalculateFixedMtrr (Attributes, &BaseAddress, &Length);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ }
+
+ if (mFixedMtrrChanged) {
+ ProgramFixedMtrr ();
+ }
+
+ if (Length == 0) {
+ ///
+ /// Just Fixed MTRR. NO need to go through Variable MTRR
+ ///
+ goto Done;
+ }
+
+ ///
+ /// since mem below 1m will be override by fixed mtrr, we can set it to 0 to save mtrr.
+ ///
+ if (BaseAddress == 0x100000) {
+ BaseAddress = 0;
+ Length += 0x100000;
+ }
+
+ ///
+ /// Check memory base address alignment
+ ///
+#if SKIP_ALIGN_CHECK
+ DivU64x32Remainder (BaseAddress, (UINT32) Power2MaxMemory (LShiftU64 (Length, 1)), &Remainder);
+ if (Remainder != 0) {
+ DivU64x32Remainder (BaseAddress, (UINT32) Power2MaxMemory (Length), &Remainder);
+ if (Remainder != 0) {
+ Status = EFI_UNSUPPORTED;
+ goto Done;
+ }
+ }
+#endif
+
+ ///
+ /// Check overlap
+ ///
+ GetMemoryAttribute ();
+ OverLap = CheckMemoryAttributeOverlap (BaseAddress, BaseAddress + Length - 1);
+ if (OverLap) {
+ Status = CombineMemoryAttribute (Attributes, &BaseAddress, &Length);
+ if (EFI_ERROR (Status)) {
+ goto Done;
+ }
+ if (Length == 0) {
+ ///
+ /// combine successfully
+ ///
+ Status = EFI_SUCCESS;
+ goto Done;
+ }
+ } else {
+ if (Attributes == CACHE_UNCACHEABLE) {
+ Status = EFI_SUCCESS;
+ goto Done;
+ }
+ }
+
+ ///
+ /// Program Variable MTRRs
+ ///
+ if (mUsedMtrr >= VariableMtrrLimit) {
+ Status = EFI_OUT_OF_RESOURCES;
+ goto Done;
+ }
+
+ ///
+ /// Find first unused MTRR
+ ///
+ for (MsrNum = CACHE_VARIABLE_MTRR_BASE; MsrNum < (CACHE_VARIABLE_MTRR_BASE + VariableMtrrLimit * 2 - 1); MsrNum += 2) {
+ if ((AsmReadMsr64 (MsrNum + 1) & B_CACHE_MTRR_VALID) == 0) {
+ break;
+ }
+ }
+
+ TempQword = Length;
+ if (TempQword == Power2MaxMemory (TempQword)) {
+ ProgramVariableMtrr (
+ MsrNum,
+ BaseAddress,
+ Length,
+ Attributes
+ );
+ } else {
+ GetDirection (TempQword, &MtrrNumber, &Positive);
+ if ((mUsedMtrr + MtrrNumber) > VariableMtrrLimit) {
+ goto Done;
+ }
+ if (!Positive) {
+ Length = Power2MaxMemory (LShiftU64 (TempQword, 1));
+ ProgramVariableMtrr (
+ MsrNum,
+ BaseAddress,
+ Length,
+ Attributes
+ );
+ BaseAddress += TempQword;
+ TempQword = Length - TempQword;
+ Attributes = CACHE_UNCACHEABLE;
+ }
+ do {
+ ///
+ /// Find unused MTRR
+ ///
+ for (; MsrNum < (CACHE_VARIABLE_MTRR_BASE + VariableMtrrLimit * 2 - 1); MsrNum += 2) {
+ if ((AsmReadMsr64 (MsrNum + 1) & B_CACHE_MTRR_VALID) == 0) {
+ break;
+ }
+ }
+ Length = Power2MaxMemory (TempQword);
+ ProgramVariableMtrr (
+ MsrNum,
+ BaseAddress,
+ Length,
+ Attributes
+ );
+ BaseAddress += Length;
+ TempQword -= Length;
+ } while (TempQword);
+ }
+
+Done:
+ Status1 = gBS->LocateProtocol (
+ &gEfiMpServiceProtocolGuid,
+ NULL,
+ (VOID **) &MpService
+ );
+
+ if (!EFI_ERROR (Status1)) {
+ if (mVariableMtrrChanged || mFixedMtrrChanged) {
+ ///
+ /// PERF_START (NULL, L"CacheSync", NULL, 0);
+ ///
+ ReadMtrrRegisters ();
+ Status1 = MpService->StartupAllAPs (
+ MpService,
+ MpMtrrSynchUp,
+ FALSE,
+ NULL,
+ 0,
+ NULL,
+ NULL
+ );
+ ///
+ /// PERF_END (NULL, L"CacheSync", NULL, 0);
+ ///
+ }
+ }
+
+ return Status;
+}
+
+/**
+ Initialize the SmmBase pointer when SmmBase protocol get installed
+
+ @param[in] Event - Event whose notification function is being invoked.
+ @param[in] Context - Pointer to the notification functions context, which is implementation dependent.
+**/
+VOID
+EFIAPI
+InitializeSmmBasePtr (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ EFI_STATUS Status;
+
+ Status = gBS->LocateProtocol (&gEfiSmmBaseProtocolGuid, NULL, (VOID **) &mSmmBaseProtocol);
+ if (EFI_ERROR (Status)) {
+ mSmmBaseProtocol = NULL;
+ }
+}
+
+/**
+ Call back function to publish Hii data
+
+ @param[in] Event - The triggered event.
+ @param[in] Context - Context for this event.
+**/
+VOID
+EFIAPI
+HiiCallback (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+
+#if (EFI_SPECIFICATION_VERSION >= 0x2000A)
+ EFI_HII_PACKAGE_LIST_HEADER *PackageList;
+#else
+ EFI_HII_PACKAGES *PackageList;
+#endif
+ EFI_STATUS Status;
+
+ ///
+ /// Initialize strings to HII database
+ ///
+#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
+
+ Status = gBS->LocateProtocol (
+ &gEfiHiiDatabaseProtocolGuid,
+ NULL,
+ &mHiiDatabase
+ );
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+
+ ///
+ /// Create driver handle used by HII database
+ ///
+ Status = CreateHiiDriverHandle (&mDriverHandle);
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+
+ ///
+ /// Publish our HII data
+ ///
+ PackageList = PreparePackageList (1, &gProcessorProducerGuid, CpuInitDxeStrings);
+ if (PackageList == NULL) {
+ return;
+ }
+ Status = mHiiDatabase->NewPackageList (
+ mHiiDatabase,
+ PackageList,
+ mDriverHandle,
+ &mStringHandle
+ );
+ ASSERT_EFI_ERROR (Status);
+#else
+ ///
+ /// There should only be one HII protocol
+ ///
+ Status = gBS->LocateProtocol (
+ &gEfiHiiProtocolGuid,
+ NULL,
+ (VOID **) &mHii
+ );
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+ PackageList = PreparePackages (1, &gProcessorProducerGuid, CpuInitDxeStrings);
+ Status = mHii->NewPack (mHii, PackageList, &mStringHandle);
+ FreePool (PackageList);
+#endif
+}
+
+/**
+ Create SMBIOS Table type - FviSmbiosType, when ExitPmAuth event is signaled
+
+ @param[in] Event - A pointer to the Event that triggered the callback.
+ @param[in] Context - A pointer to private data registered with the callback function.
+ **/
+VOID
+InitializeFviDataCallback (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ EFI_STATUS Status;
+ VOID *ProtocolPointer;
+ UINT32 uCodeRevision;
+
+ Status = gBS->LocateProtocol (&gExitPmAuthProtocolGuid, NULL, &ProtocolPointer);
+ if (EFI_SUCCESS != Status) {
+ return;
+ }
+
+ gBS->CloseEvent (Event);
+
+ if (mPlatformCpu->CpuConfig->FviReport) {
+ InitFviDataHubCbContext (
+ mPlatformCpu->CpuConfig->FviSmbiosType,
+ (UINT8) mCpuFviElements,
+ &mCpuFviVersionData
+ );
+
+ uCodeRevision = GetCpuUcodeRevision ();
+ mCpuFviElementsData[UCODE_VER].Element.Version.MajorVersion = (UINT8) ((uCodeRevision & 0xFF000000) >> 24);
+ mCpuFviElementsData[UCODE_VER].Element.Version.MinorVersion = (UINT8) ((uCodeRevision & 0x00FF0000) >> 16);
+ mCpuFviElementsData[UCODE_VER].Element.Version.Revision = (UINT8) ((uCodeRevision & 0x0000FF00) >> 8);
+ mCpuFviElementsData[UCODE_VER].Element.Version.BuildNum = (UINT16) (uCodeRevision & 0x000000FF);
+
+ CreateRcFviDatahub (&mCpuFviVersionData);
+ }
+ return;
+}
+
+/**
+ Initialize the state information for the CPU Architectural Protocol
+
+ @param[in] ImageHandle - Image handle of the loaded driver
+ @param[in] SystemTable - Pointer to the System Table
+
+ @retval EFI_SUCCESS - thread can be successfully created
+ @retval EFI_OUT_OF_RESOURCES - cannot allocate protocol data structure
+ @retval EFI_DEVICE_ERROR - cannot create the thread
+**/
+EFI_STATUS
+EFIAPI
+InitializeCpu (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ EFI_HANDLE NewHandle1;
+ VOID *Registration;
+
+ ///
+ /// Initialize the Global Descriptor Table
+ ///
+//(AMI_CHG+)>
+#if defined(AMI_PEI_DEBUG_SUPPORT) && AMI_PEI_DEBUG_SUPPORT
+ Status = gBS->LocateProtocol(
+ &gAmiDebuggerCpuProtocolGuid,
+ NULL,
+ &mAmiDebuggerCpuProtocol
+ );
+
+ if (!EFI_ERROR(Status)){
+ Status = mAmiDebuggerCpuProtocol->
+ DebuggerGetAptioIntHandler((VOID*)&AptioInterruptHandlerHalt1);
+
+ (UINT32)AptioInterruptHandlerHalt = AptioInterruptHandlerHalt1;
+
+ Status = mAmiDebuggerCpuProtocol->DebuggerSetupExceptionHandler();
+ }
+#endif
+
+ InitializeSelectors ();
+
+ ///
+ /// Initialize Exception Handlers
+ ///
+ InitializeException (&gCpu);
+
+ ///
+ /// Setup Cache attributes and Interrupt Tables
+ ///
+ PrepareMemory ();
+
+//<(AMI_CHG+)
+
+ ///
+ /// Install CPU Architectural Protocol
+ ///
+ NewHandle1 = NULL;
+ Status = gBS->InstallProtocolInterface (
+ &NewHandle1,
+ &gEfiCpuArchProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ &gCpu
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Refresh memory space attributes according to MTRRs
+ ///
+ Status = RefreshGcdMemoryAttributes ();
+ mIsFlushingGCD = FALSE;
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ ///
+ /// Locate DxeCpuPlatformPolicy protocol instance and assign it to a global variable
+ ///
+ Status = gBS->LocateProtocol (&gDxeCpuPlatformPolicyProtocolGuid, NULL, (VOID **) &mPlatformCpu);
+ if (EFI_ERROR (Status)) {
+ DEBUG((EFI_D_ERROR,"Failed to locate DxeCpuPlatformPolicy Protocol\n"));
+ return Status;
+ }
+
+ //
+ // Dump Cpu platform policy
+ //
+ CpuDxePolicyDump();
+
+ ///
+ /// Initialize the global SmmBase SWSMI number
+ ///
+ mSmmbaseSwSmiNumber = mPlatformCpu->CpuConfig->SmmbaseSwSmiNumber;
+
+ ///
+ /// Load the microcode if needed
+ ///
+ Status = LoadAllMicrocodeUpdates ();
+
+ Status = gBS->LocateProtocol (&gEfiMetronomeArchProtocolGuid, NULL, (VOID **) &mMetronome);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+#if (EFI_SPECIFICATION_VERSION >= 0x2000A)
+ EfiLibCreateProtocolNotifyEvent (
+ &gEfiHiiDatabaseProtocolGuid,
+ EFI_TPL_CALLBACK,
+ HiiCallback,
+ NULL,
+ &Registration
+ );
+#else
+ EfiLibCreateProtocolNotifyEvent (
+ &gEfiHiiProtocolGuid,
+ EFI_TPL_CALLBACK,
+ HiiCallback,
+ NULL,
+ &Registration
+ );
+#endif
+
+ ///
+ /// Create an SmmBase protocol call back event to initialize
+ /// Smm Base pointer, during SMM mode
+ ///
+ EfiCreateProtocolNotifyEvent (
+ &gEfiSmmBaseProtocolGuid,
+ TPL_CALLBACK,
+ InitializeSmmBasePtr,
+ NULL,
+ &mSmmBaseRegistration
+ );
+
+ ///
+ /// Initialize MP Support if necessary
+ ///
+ Status = InitializeMpSupport ();
+ if (EFI_ERROR(Status)) {
+ DEBUG((EFI_D_ERROR,"Failed to initialize MPs\n"));
+ }
+
+ ///
+ /// Create an ExitPmAuth protocol callback event to generate SMBIOS table - FviSmbiosType
+ ///
+ EfiCreateProtocolNotifyEvent (
+ &gExitPmAuthProtocolGuid,
+ EFI_TPL_CALLBACK,
+ InitializeFviDataCallback,
+ NULL,
+ &Registration
+ );
+
+ ///
+ /// Create an ExitPmAuth protocol callback event for PFAT.
+ ///
+ EfiCreateProtocolNotifyEvent (
+ &gExitPmAuthProtocolGuid,
+ EFI_TPL_CALLBACK,
+ InitializePfatToolsIntCallback,
+ NULL,
+ &Registration
+ );
+
+ ///
+ /// Verify if Boot Guard is supported
+ ///
+ if (IsBootGuardSupported()){
+ ///
+ /// Identify if Revocation is requested by Boot Guard ACM
+ ///
+ if (AsmReadMsr64 (MSR_BOOT_GUARD_SACM_INFO) & BIT7) {
+ ///
+ /// Create an ExitPmAuth protocol call back event if one or more of Boot Guard modules are revoked.
+ ///
+ EfiCreateProtocolNotifyEvent (
+ &gExitPmAuthProtocolGuid,
+ TPL_CALLBACK,
+ BootGuardRevocationCallback,
+ NULL,
+ &Registration
+ );
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Returns the actual CPU core frequency in MHz.
+
+ @param[in] Metronome - Metronome protocol
+ @param[in] Frequency - Pointer to the CPU core frequency
+
+ @retval EFI_SUCCESS - If the frequency is returned successfully
+ @retval EFI_INVALID_PARAMETER - If the input parameter is wrong
+**/
+EFI_STATUS
+GetActualFrequency (
+ IN EFI_METRONOME_ARCH_PROTOCOL *Metronome,
+ OUT UINT64 *Frequency
+ )
+{
+ UINT64 BeginValue;
+ UINT64 EndValue;
+ UINT64 TotalValue;
+ UINT32 TickCount;
+ BOOLEAN InterruptState;
+ EFI_STATUS Status;
+
+ if (Metronome == NULL || Frequency == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (mCpuFrequency == 0) {
+ ///
+ /// In order to calculate the actual CPU frequency, we keep track of the CPU Tsc value (which
+ /// increases by 1 for every cycle) for a know period of time. The Metronome is not accurate
+ /// for the 1st tick, so I choose to wait for 1000 ticks, thus the error can be control to be
+ /// lower than 1%.
+ ///
+ TickCount = SAMPLE_TICK_COUNT;
+ CpuGetInterruptState (&gCpu, &InterruptState);
+ if (InterruptState) {
+ DisableInterrupt (&gCpu);
+ }
+ ///
+ /// In DxeCis-0.91 specs.
+ /// Metronome->WaitForTick is possible for interrupt processing,
+ /// or exception processing to interrupt the execution of the WaitForTick() function.
+ /// Depending on the hardware source for the ticks, it is possible for a tick to be missed.
+ /// This function cannot guarantee that ticks will not be missed.
+ ///
+ while (TRUE) {
+ BeginValue = EfiReadTsc ();
+ Status = Metronome->WaitForTick (Metronome, TickCount);
+ EndValue = EfiReadTsc ();
+ if (!EFI_ERROR (Status)) {
+ TotalValue = EndValue - BeginValue;
+ break;
+ }
+ }
+
+ if (InterruptState) {
+ EnableInterrupt (&gCpu);
+ }
+
+ mCpuFrequency = MultU64x32 (TotalValue, 10);
+ mCpuFrequency = DivU64x32 (mCpuFrequency, Metronome->TickPeriod * TickCount);
+ }
+
+ *Frequency = mCpuFrequency;
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Dump RC CPU and PPM platform policies
+**/
+VOID
+CpuDxePolicyDump (
+ VOID
+ )
+{
+#ifdef EFI_DEBUG
+ CPU_CONFIG *CpuConfig;
+ POWER_MGMT_CONFIG *PowerMgmtConfig;
+ SECURITY_CONFIG *SecurityConfig;
+
+ CpuConfig = mPlatformCpu->CpuConfig;
+ PowerMgmtConfig = mPlatformCpu->PowerMgmtConfig;
+ SecurityConfig = mPlatformCpu->SecurityConfig;
+ //
+ // Dump Cpu Platform policy
+ //
+ DEBUG ((EFI_D_INFO, "\n------------------------ DXE CpuPlatformPolicy Dump Begin -----------------\n"));
+ //
+ // Cpu config
+ //
+ DEBUG ((EFI_D_INFO, " CPU:: HtState : 0x%X \n", CpuConfig->HtState));
+ DEBUG ((EFI_D_INFO, " CPU:: LimitCpuidMaximumValue : 0x%X\n", CpuConfig->LimitCpuidMaximumValue));
+ DEBUG ((EFI_D_INFO, " CPU:: ExecuteDisableBit : 0x%X\n", CpuConfig->ExecuteDisableBit));
+ DEBUG ((EFI_D_INFO, " CPU:: VmxEnable : 0x%X\n", CpuConfig->VmxEnable));
+ DEBUG ((EFI_D_INFO, " CPU:: SmxEnable : 0x%X\n", CpuConfig->SmxEnable));
+ DEBUG ((EFI_D_INFO, " CPU:: MachineCheckEnable : 0x%X\n", CpuConfig->MachineCheckEnable));
+ DEBUG ((EFI_D_INFO, " CPU:: MonitorMwaitEnable : 0x%X\n", CpuConfig->MonitorMwaitEnable));
+ DEBUG ((EFI_D_INFO, " CPU:: XapicEnable : 0x%X\n", CpuConfig->XapicEnable));
+ DEBUG ((EFI_D_INFO, " CPU:: IsColdReset : 0x%X\n", CpuConfig->IsColdReset));
+ DEBUG ((EFI_D_INFO, " CPU:: MlcStreamerPrefetcher : 0x%X\n", CpuConfig->MlcStreamerPrefetcher));
+ DEBUG ((EFI_D_INFO, " CPU:: EnableDts : 0x%X\n", CpuConfig->EnableDts));
+ DEBUG ((EFI_D_INFO, " CPU:: FviReport : 0x%X\n", CpuConfig->FviReport));
+ DEBUG ((EFI_D_INFO, " CPU:: AesEnable : 0x%X\n", CpuConfig->AesEnable));
+ DEBUG ((EFI_D_INFO, " CPU:: DebugInterfaceEnable : 0x%X\n", CpuConfig->DebugInterfaceEnable));
+ DEBUG ((EFI_D_INFO, " CPU:: DebugInterfaceLockEnable : 0x%X\n", CpuConfig->DebugInterfaceLockEnable));
+ DEBUG ((EFI_D_INFO, " CPU:: ApIdleManner : 0x%X\n", CpuConfig->ApIdleManner));
+ DEBUG ((EFI_D_INFO, " CPU:: ApHandoffManner : 0x%X\n", CpuConfig->ApHandoffManner));
+ DEBUG ((EFI_D_INFO, " CPU:: BspSelection : 0x%X\n", CpuConfig->BspSelection));
+ DEBUG ((EFI_D_INFO, " CPU:: SmmbaseSwSmiNumber : 0x%X\n", CpuConfig->SmmbaseSwSmiNumber));
+ DEBUG ((EFI_D_INFO, " CPU:: FviSmbiosType; : 0x%X\n", CpuConfig->FviSmbiosType));
+ //
+ // SECURITY_CONFIG : TXT_FUNCTION_CONFIG
+ //
+ DEBUG ((EFI_D_INFO, " CPU:: SECURITY_CONFIG:TXT_FUNCTION_CONFIG : ResetAux : 0x%X\n", SecurityConfig->TxtFunctionConfig->ResetAux));
+ DEBUG ((EFI_D_INFO, "\n------------------------ DXE CpuPlatformPolicy Dump End -----------------\n"));
+#endif
+}
+
+/**
+ Initialize the global DataHub pointer
+
+ @param[in] DataHub - Pointer to the DataHub protocol as output
+
+ @retval EFI_SUCCESS - If the DataHub pointer is initialized successfully
+**/
+EFI_STATUS
+InitializeDataHubPtr (
+ OUT EFI_DATA_HUB_PROTOCOL **DataHub
+ )
+{
+ EFI_STATUS Status;
+
+ Status = gBS->LocateProtocol (&gEfiDataHubProtocolGuid, NULL, (VOID **) DataHub);
+ return Status;
+}
+
+/**
+ Drop into SMM to register IOTRAP for pfat tools interface
+
+ @param[in] Event - A pointer to the Event that triggered the callback.
+ @param[in] Context - A pointer to private data registered with the callback function.
+**/
+VOID
+InitializePfatToolsIntCallback (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ EFI_STATUS Status;
+ VOID *ProtocolPointer;
+ EFI_PHYSICAL_ADDRESS BaseAddress;
+ PFAT_HOB *PfatHobPtr;
+ EFI_GUID PfatHobGuid = PFAT_HOB_GUID;
+
+ Status = gBS->LocateProtocol (&gExitPmAuthProtocolGuid, NULL, &ProtocolPointer);
+ if (EFI_SUCCESS != Status) {
+ return;
+ }
+
+ PfatHobPtr = GetFirstGuidHob (&PfatHobGuid);
+ if (PfatHobPtr != NULL) {
+ BaseAddress = (EFI_PHYSICAL_ADDRESS) PfatHobPtr->PfatToolsIntIoTrapAdd;
+ ///
+ /// IOTRAP TO SMM
+ ///
+ IoRead8 (BaseAddress);
+ }
+ return;
+}
+
+/**
+ Register callback function for Boot Guard revocation flow.
+
+ @param[in] Event - A pointer to the Event that triggered the callback.
+ @param[in] Context - A pointer to private data registered with the callback function.
+**/
+VOID
+EFIAPI
+BootGuardRevocationCallback (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ EFI_STATUS Status;
+ VOID *ProtocolPointer;
+
+ //
+ // Check whether this is real ExitPmAuth notification, or just a SignalEvent
+ //
+ Status = gBS->LocateProtocol (&gExitPmAuthProtocolGuid, NULL, (VOID **) &ProtocolPointer);
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+
+ BootGuardOemRevocationHook();
+
+ //
+ // Closed the event to avoid call twice
+ //
+ gBS->CloseEvent (Event);
+
+ return;
+}
diff --git a/ReferenceCode/Haswell/CpuInit/Dxe/CpuInitDxeDbgr.h b/ReferenceCode/Haswell/CpuInit/Dxe/CpuInitDxeDbgr.h
new file mode 100644
index 0000000..86316bb
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Dxe/CpuInitDxeDbgr.h
@@ -0,0 +1,602 @@
+/** @file
+ Private data structures
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#ifndef _CPU_INIT_DXE_H
+#define _CPU_INIT_DXE_H
+
+#include "CpuAccess.h"
+#include "MemoryAttribute.h"
+#include "RcFviDxeLib.h"
+#include "EdkIIGlueBaseLib.h"
+
+#include EFI_PROTOCOL_DEFINITION (CpuPlatformPolicy)
+#include EFI_PROTOCOL_CONSUMER (ExitPmAuth)
+#include EFI_PROTOCOL_DEFINITION (CpuInfo)
+
+#if (EFI_SPECIFICATION_VERSION >= 0x2000A)
+#include "UefiIfrLibrary.h"
+#endif
+
+#define INTERRUPT_VECTOR_NUMBER 256
+#define INTERRUPT_GATE_ATTRIBUTE 0x8e00
+#define NUMBER_OF_MICROCODE_UPDATE 10
+
+extern UINT8 mSmmbaseSwSmiNumber;
+
+//(AMI_CHG+)
+#if defined(AMI_PEI_DEBUG_SUPPORT) && AMI_PEI_DEBUG_SUPPORT
+
+#define AMI_DEBUGGER_CPU_PROTOCOL_GUID \
+ { 0xab21acc3, 0xba33, 0xee2c, 0x66, 0xbc, 0x12, 0x56, 0x77, 0x11, 0x1a, 0xb2 }
+
+
+typedef struct _AMI_DEBUGGER_CPU_PROTOCOL AMI_DEBUGGER_CPU_PROTOCOL;
+
+#pragma pack(1)
+
+typedef struct {
+ UINT16 Offset15To0;
+ UINT16 SegmentSelector;
+ UINT16 Attributes;
+ UINT16 Offset31To16;
+ UINT32 Offset63To32;
+ UINT32 Reserved;
+} DEBUGGER_INTERRUPT_GATE_DESCRIPTOR;
+
+#pragma pack()
+
+typedef
+EFI_STATUS
+(EFIAPI *DEBUGGER_GET_APTIO_INT_HANDLER) (
+ IN OUT UINT32* InterruptHandlerHaltAddr
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *DEBUGGER_FIXUP_PEI_EXCEPTION_HANDLER) (
+ IN DEBUGGER_INTERRUPT_GATE_DESCRIPTOR* IdtEntry,
+ IN UINT32 i
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *DEBUGGER_SETUP_EXCEPTION_HANDLER) (VOID);
+
+typedef
+EFI_STATUS
+(EFIAPI *DEBUGGER_IS_DEBUGGER_IRQ_HANDLER) (
+ IN EFI_EXCEPTION_TYPE InterruptType,
+ IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler
+ );
+
+typedef struct _AMI_DEBUGGER_CPU_PROTOCOL {
+ DEBUGGER_GET_APTIO_INT_HANDLER DebuggerGetAptioIntHandler;
+ DEBUGGER_FIXUP_PEI_EXCEPTION_HANDLER DebuggerFixUpPEIExceptionHandlers;
+ DEBUGGER_SETUP_EXCEPTION_HANDLER DebuggerSetupExceptionHandler;
+ DEBUGGER_IS_DEBUGGER_IRQ_HANDLER DebuggerIsDebuggerIrqHadler;
+};
+
+#endif
+//<(AMI_CHG+)
+
+#define CPU_FVI_STRING "Reference Code - CPU"
+#define CPU_FVI_SMBIOS_TYPE 0xDD ///< Default value
+#define CPU_FVI_SMBIOS_INSTANCE 0x02
+#define UCODE_FVI_STRING "uCode Version"
+#define UCODE_VERSION \
+ { \
+ 0xFF, 0xFF, 0xFF, 0xFFFF \
+ }
+#define TXT_FVI_STRING "TXT ACM version"
+#define TXT_ACM_MAJOR_VERSION 0x1
+#define TXT_ACM_MINOR_VERSION 0x0
+#define TXT_ACM_REVERSION 0x0
+#define TXT_ACM_BUILD_NUMBER 0x0
+#define TXT_VERSION \
+ { \
+ TXT_ACM_MAJOR_VERSION, TXT_ACM_MINOR_VERSION, TXT_ACM_REVERSION, TXT_ACM_BUILD_NUMBER \
+ }
+enum {
+ CPU_RC_VER= 0,
+ UCODE_VER,
+ TXT_VER
+} CPU_FVI_INDEX;
+
+extern FVI_ELEMENT_AND_FUNCTION mCpuFviElementsData[];
+extern FVI_DATA_HUB_CALLBACK_CONTEXT mCpuFviVersionData;
+extern UINTN mCpuFviElements;
+
+/**
+ Adjust length to a paragraph boundry
+
+ @param[in] MemoryLength - Input memory length.
+
+ @retval Returned Maximum length.
+**/
+UINT64
+Power2MaxMemory (
+ IN UINT64 MemoryLength
+ );
+
+/**
+ Disable cache and its mtrr
+
+ @param[in] OldMtrr - To return the Old MTRR value
+**/
+VOID
+EfiDisableCacheMtrr (
+ IN UINT64 *OldMtrr
+ );
+
+/**
+ Recover cache MTRR
+
+ @param[in] EnableMtrr - Whether to enable the MTRR
+ @param[in] OldMtrr - The saved old MTRR value to restore when not to
+ enable the MTRR
+**/
+VOID
+EfiRecoverCacheMtrr (
+ IN BOOLEAN EnableMtrr,
+ IN UINT64 OldMtrr
+ );
+
+typedef struct _ALIGNED_DWORD {
+ UINT32 High;
+ UINT32 Low;
+} ALIGNED_DWORD;
+
+typedef union _ALIGNED {
+ UINT64 AlignedQword;
+ ALIGNED_DWORD AlignedDword;
+} ALIGNED;
+
+/**
+ Initialize the state information for the CPU Architectural Protocol
+
+ @param[in] ImageHandle - Image handle of the loaded driver
+ @param[in] SystemTable - Pointer to the System Table
+
+ @retval EFI_SUCCESS - thread can be successfully created
+ @retval EFI_OUT_OF_RESOURCES - cannot allocate protocol data structure
+ @retval EFI_DEVICE_ERROR - cannot create the thread
+**/
+EFI_STATUS
+EFIAPI
+InitializeCpu (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ );
+
+/**
+ Prepare memory for essential system tables.
+
+ @retval EFI_SUCCESS - Memory successfully prepared.
+**/
+EFI_STATUS
+PrepareMemory (
+ VOID
+ );
+
+/**
+ Flush CPU data cache. If the instruction cache is fully coherent
+ with all DMA operations then function can just return EFI_SUCCESS.
+
+ @param[in] This - Protocol instance structure
+ @param[in] Start - Physical address to start flushing from.
+ @param[in] Length - Number of bytes to flush. Round up to chipset granularity.
+ @param[in] FlushType - Specifies the type of flush operation to perform.
+
+ @retval EFI_SUCCESS - If cache was flushed
+ @exception EFI_UNSUPPORTED - If flush type is not supported.
+ @retval EFI_DEVICE_ERROR - If requested range could not be flushed.
+**/
+EFI_STATUS
+EFIAPI
+FlushCpuDataCache (
+ IN EFI_CPU_ARCH_PROTOCOL *This,
+ IN EFI_PHYSICAL_ADDRESS Start,
+ IN UINT64 Length,
+ IN EFI_CPU_FLUSH_TYPE FlushType
+ );
+
+/**
+ Enables CPU interrupts.
+
+ @param[in] This - Protocol instance structure
+
+ @retval EFI_SUCCESS - If interrupts were enabled in the CPU
+ @retval EFI_DEVICE_ERROR - If interrupts could not be enabled on the CPU.
+**/
+EFI_STATUS
+EFIAPI
+EnableInterrupt (
+ IN EFI_CPU_ARCH_PROTOCOL *This
+ );
+
+/**
+ Disables CPU interrupts.
+
+ @param[in] This - Protocol instance structure
+
+ @retval EFI_SUCCESS - If interrupts were disabled in the CPU.
+ @retval EFI_DEVICE_ERROR - If interrupts could not be disabled on the CPU.
+**/
+EFI_STATUS
+EFIAPI
+DisableInterrupt (
+ IN EFI_CPU_ARCH_PROTOCOL *This
+ );
+
+/**
+ Return the state of interrupts.
+
+ @param[in] This - Protocol instance structure
+ @param[in] State - Pointer to the CPU's current interrupt state
+
+ @retval EFI_SUCCESS - If interrupts were disabled in the CPU.
+ @retval EFI_INVALID_PARAMETER - State is NULL.
+**/
+EFI_STATUS
+EFIAPI
+CpuGetInterruptState (
+ IN EFI_CPU_ARCH_PROTOCOL *This,
+ OUT BOOLEAN *State
+ );
+
+/**
+ Generates an INIT to the CPU
+
+ @param[in] This - Protocol instance structure
+ @param[in] InitType - Type of CPU INIT to perform
+
+ @retval EFI_SUCCESS - If CPU INIT occurred. This value should never be seen.
+ @retval EFI_DEVICE_ERROR - If CPU INIT failed.
+ @exception EFI_UNSUPPORTED - Requested type of CPU INIT not supported.
+**/
+EFI_STATUS
+EFIAPI
+Init (
+ IN EFI_CPU_ARCH_PROTOCOL *This,
+ IN EFI_CPU_INIT_TYPE InitType
+ );
+
+/**
+ Registers a function to be called from the CPU interrupt handler.
+
+ @param[in] This - Protocol instance structure
+ @param[in] InterruptType - Defines which interrupt to hook.
+ IA-32 valid range is 0x00 through 0xFF
+ @param[in] InterruptHandler - A pointer to a function of type EFI_CPU_INTERRUPT_HANDLER
+ that is called when a processor interrupt occurs.
+ A null pointer is an error condition.
+
+ @retval EFI_SUCCESS - If handler installed or uninstalled.
+ @retval EFI_ALREADY_STARTED - InterruptHandler is not NULL, and a handler for
+ InterruptType was previously installed
+ @retval EFI_INVALID_PARAMETER - InterruptHandler is NULL, and a handler for
+ InterruptType was not previously installed.
+ @exception EFI_UNSUPPORTED - The interrupt specified by InterruptType is not supported.
+**/
+EFI_STATUS
+EFIAPI
+RegisterInterruptHandler (
+ IN EFI_CPU_ARCH_PROTOCOL *This,
+ IN EFI_EXCEPTION_TYPE InterruptType,
+ IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler
+ );
+
+/**
+ Returns a timer value from one of the CPU's internal timers. There is no
+ inherent time interval between ticks but is a function of the CPU frequency.
+
+ @param[in] This - Protocol instance structure.
+ @param[in] TimerIndex - Specifies which CPU timer is requested.
+ @param[in] TimerValue - Pointer to the returned timer value.
+ @param[in] TimerPeriod - A pointer to the amount of time that passes in femtoseconds (10-15) for each
+ increment of TimerValue. If TimerValue does not increment at a predictable
+ rate, then 0 is returned. The amount of time that has passed between two calls to
+ GetTimerValue() can be calculated with the formula
+ (TimerValue2 - TimerValue1) * TimerPeriod. This parameter is optional and may be NULL.
+
+ @retval EFI_SUCCESS - If the CPU timer count was returned.
+ @exception EFI_UNSUPPORTED - If the CPU does not have any readable timers.
+ @retval EFI_DEVICE_ERROR - If an error occurred while reading the timer.
+ @retval EFI_INVALID_PARAMETER - TimerIndex is not valid or TimerValue is NULL.
+**/
+EFI_STATUS
+EFIAPI
+GetTimerValue (
+ IN EFI_CPU_ARCH_PROTOCOL *This,
+ IN UINT32 TimerIndex,
+ OUT UINT64 *TimerValue,
+ OUT UINT64 *TimerPeriod OPTIONAL
+ );
+
+/**
+ Set memory cacheability attributes for given range of memeory
+
+ @param[in] This - Protocol instance structure
+ @param[in] BaseAddress - Specifies the start address of the memory range
+ @param[in] Length - Specifies the length of the memory range
+ @param[in] Attributes - The memory cacheability for the memory range
+
+ @retval EFI_SUCCESS - If the cacheability of that memory range is set successfully
+ @exception EFI_UNSUPPORTED - If the desired operation cannot be done
+ @retval EFI_INVALID_PARAMETER - The input parameter is not correct, such as Length = 0
+**/
+EFI_STATUS
+EFIAPI
+SetMemoryAttributes (
+ IN EFI_CPU_ARCH_PROTOCOL *This,
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,
+ IN UINT64 Length,
+ IN UINT64 Attributes
+ );
+
+/**
+ Init Global Descriptor table
+**/
+VOID
+InitializeSelectors (
+ VOID
+ );
+
+typedef struct {
+ VOID *Start;
+ UINTN Size;
+ UINTN FixOffset;
+} INTERRUPT_HANDLER_TEMPLATE_MAP;
+
+typedef union {
+ EFI_CPU_DATA_RECORD *DataRecord;
+ UINT8 *Raw;
+} EFI_CPU_DATA_RECORD_BUFFER;
+
+///
+/// This constant defines the maximum length of the CPU brand string. According to the
+/// IA manual, the brand string is in EAX through EDX (thus 16 bytes) after executing
+/// the CPUID instructions with EAX as 80000002, 80000003, 80000004.
+///
+#define MAXIMUM_CPU_BRAND_STRING_LENGTH 48
+
+typedef struct {
+ BOOLEAN StringValid;
+ CHAR16 BrandString[MAXIMUM_CPU_BRAND_STRING_LENGTH + 1];
+ EFI_PROCESSOR_VERSION_DATA StringRef;
+} PROCESSOR_VERSION_INFORMATION;
+
+///
+/// The constant defines how many times the Cpuid instruction should be executed
+/// in order to get all the cache information. For Pentium 4 processor, 1 is enough
+///
+#define CPU_CPUID_EXECTION_COUNT 2
+
+typedef struct {
+ UINT64 IntendCoreFrequency;
+ UINT64 IntendFsbFrequency;
+ PROCESSOR_VERSION_INFORMATION Version;
+ EFI_PROCESSOR_MANUFACTURER_DATA Manufacturer;
+ EFI_PROCESSOR_ID_DATA CpuidData;
+ EFI_PROCESSOR_FAMILY_DATA Family;
+ INT16 Voltage;
+ EFI_PROCESSOR_APIC_BASE_ADDRESS_DATA ApicBase;
+ EFI_PROCESSOR_APIC_ID_DATA ApicID;
+ EFI_PROCESSOR_APIC_VERSION_NUMBER_DATA ApicVersion;
+ UINT32 MicrocodeRevision;
+ EFI_PROCESSOR_STATUS_DATA Status; ///< Need to update this field before report
+ CPU_PHYSICAL_LOCATION Location;
+ EFI_MP_HEALTH_FLAGS Health;
+ EFI_CPUID_REGISTER CacheInformation[CPU_CPUID_EXECTION_COUNT];
+} CPU_DATA_FOR_DATAHUB;
+
+///
+/// Type, FamilyId and Model values for the different processors
+/// [0:7] - Model
+/// [8:23] - FamilyId
+/// [24:31] - Type
+///
+#define RESERVED 0x00
+
+/**
+ This will locate a processor microcode and if it finds a newer revision, it will
+ load it to the processor.
+
+ @param[in] MicrocodePointerBuffer - The Array of pointers which each points to 1 microcode update binary (in memory)
+ @param[in] FailedRevision - The microcode revision that fails to be loaded
+
+ @retval EFI_SUCCESS - A new microcode update is loaded
+ @retval Other - Due to some reason, no new microcode update is loaded
+**/
+EFI_STATUS
+InitializeMicrocode (
+ IN EFI_CPU_MICROCODE_HEADER **MicrocodePointerBuffer,
+ OUT UINT32 *FailedRevision
+ );
+
+/**
+ To indicate the first microcode load is done
+**/
+VOID
+McuFirstLoadDone (
+ VOID
+ );
+
+/**
+ Initializes MP support in the system.
+
+ @retval EFI_SUCCESS - Multiple processors are initialized successfully.
+ @retval EFI_NOT_FOUND - The ACPI variable is not found in S3 boot path.
+ @retval EFI_OUT_OF_RESOURCES - No enough resoruces (such as out of memory).
+**/
+EFI_STATUS
+InitializeMpSupport (
+ VOID
+ );
+
+/**
+ Save the MTRR registers to global variables
+**/
+VOID
+ReadMtrrRegisters (
+ VOID
+ );
+
+/**
+ Synch up the MTRR values for all processors
+**/
+VOID
+EFIAPI
+MpMtrrSynchUp (
+ IN VOID *Buffer
+ );
+
+/**
+ Copy Global MTRR data to S3
+**/
+VOID
+SaveBspMtrrForS3 (
+ VOID
+ );
+
+/**
+ Load all microcode updates to memory. Since in S3 resume boot path, CPUs should be
+ patched again, these microcode updates are copied to OS reserved memory.
+
+ @retval EFI_SUCCESS - All microcode updates are loaded to memory successfully
+ @retval EFI_OUT_OF_RESOURCES - Not enough memory to accomodate all the microcode updates
+**/
+EFI_STATUS
+LoadAllMicrocodeUpdates (
+ VOID
+ );
+
+/**
+ Returns the actual CPU core frequency in MHz.
+
+ @param[in] Metronome - Metronome protocol
+ @param[in] Frequency - Pointer to the CPU core frequency
+
+ @retval EFI_SUCCESS - If the frequency is returned successfully
+ @retval EFI_INVALID_PARAMETER - If the input parameter is wrong
+**/
+EFI_STATUS
+GetActualFrequency (
+ IN EFI_METRONOME_ARCH_PROTOCOL *Metronome,
+ OUT UINT64 *Frequency
+ );
+
+/**
+ Dump RC CPU and PPM platform policies
+**/
+VOID
+CpuDxePolicyDump (
+ VOID
+ );
+
+/**
+ Initialize the global DataHub pointer
+
+ @param[in] DataHub - Pointer to the DataHub protocol as output
+
+ @retval EFI_SUCCESS - If the DataHub pointer is initialized successfully
+**/
+EFI_STATUS
+InitializeDataHubPtr (
+ OUT EFI_DATA_HUB_PROTOCOL **DataHub
+ );
+
+/**
+ Check if loading microcode update fails, if so, report proper status code
+
+ @param[in] CpuNumber - The CPU number
+ @param[in] Status - The return value of InitializeMicrocode()
+ @param[in] FailedRevision - The revision of the microcode update that failed to be loaded
+
+ @retval EFI_SUCCESS - The status is check and proper status code is reported
+**/
+EFI_STATUS
+CheckMicrocodeUpdate (
+ IN UINTN CpuNumber,
+ IN EFI_STATUS Status,
+ IN UINT32 FailedRevision
+ );
+
+/**
+ Enable Cpu Interrupt
+**/
+VOID
+CpuEnableInterrupt (
+ VOID
+ );
+
+/**
+ Disable Cpu Interrupt
+**/
+VOID
+CpuDisableInterrupt (
+ VOID
+ );
+
+/**
+ Get code segment
+
+ @retval Code segmnet value
+**/
+UINT16
+GetCodeSegment (
+ VOID
+ );
+
+/**
+ Initialize Cpu float point unit
+**/
+VOID
+CpuInitFloatPointUnit (
+ VOID
+ );
+
+/**
+ Drop into SMM to register IOTRAP handler for pfat tools interface
+
+ @param[in] Event - A pointer to the Event that triggered the callback.
+ @param[in] Context - A pointer to private data registered with the callback function.
+**/
+VOID
+InitializePfatToolsIntCallback (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ );
+
+/**
+ Register callback function for Boot Guard revocation flow.
+
+ @param[in] Event - A pointer to the Event that triggered the callback.
+ @param[in] Context - A pointer to private data registered with the callback function.
+**/
+VOID
+EFIAPI
+BootGuardRevocationCallback (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ );
+
+#endif
diff --git a/ReferenceCode/Haswell/CpuInit/Dxe/CpuInitDxeStrings.uni b/ReferenceCode/Haswell/CpuInit/Dxe/CpuInitDxeStrings.uni
new file mode 100644
index 0000000..9dee7a4
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Dxe/CpuInitDxeStrings.uni
Binary files differ
diff --git a/ReferenceCode/Haswell/CpuInit/Dxe/Exception.h b/ReferenceCode/Haswell/CpuInit/Dxe/Exception.h
new file mode 100644
index 0000000..b8a1eac
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Dxe/Exception.h
@@ -0,0 +1,92 @@
+/** @file
+ IA32 Exception Includes.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _IA32EXCEPTION_H
+#define _IA32EXCEPTION_H
+
+//
+// Driver Consumed Protocol Prototypes
+//
+#include EFI_ARCH_PROTOCOL_DEFINITION (Cpu)
+
+#define INTERRUPT_HANDLER_DIVIDE_ZERO 0x00
+#define INTERRUPT_HANDLER_DEBUG 0x01
+#define INTERRUPT_HANDLER_NMI 0x02
+#define INTERRUPT_HANDLER_BREAKPOINT 0x03
+#define INTERRUPT_HANDLER_OVERFLOW 0x04
+#define INTERRUPT_HANDLER_BOUND 0x05
+#define INTERRUPT_HANDLER_INVALID_OPCODE 0x06
+#define INTERRUPT_HANDLER_DEVICE_NOT_AVAILABLE 0x07
+#define INTERRUPT_HANDLER_DOUBLE_FAULT 0x08
+#define INTERRUPT_HANDLER_COPROCESSOR_OVERRUN 0x09
+#define INTERRUPT_HANDLER_INVALID_TSS 0x0A
+#define INTERRUPT_HANDLER_SEGMENT_NOT_PRESENT 0x0B
+#define INTERRUPT_HANDLER_STACK_SEGMENT_FAULT 0x0C
+#define INTERRUPT_HANDLER_GP_FAULT 0x0D
+#define INTERRUPT_HANDLER_PAGE_FAULT 0x0E
+#define INTERRUPT_HANDLER_RESERVED 0x0F
+#define INTERRUPT_HANDLER_MATH_FAULT 0x10
+#define INTERRUPT_HANDLER_ALIGNMENT_FAULT 0x11
+#define INTERRUPT_HANDLER_MACHINE_CHECK 0x12
+#define INTERRUPT_HANDLER_STREAMING_SIMD 0x13
+
+typedef struct {
+ EFI_STATUS_CODE_DATA Header;
+ union {
+ EFI_SYSTEM_CONTEXT_IA32 SystemContextIa32;
+ EFI_SYSTEM_CONTEXT_X64 SystemContextX64;
+ } SystemContext;
+} CPU_STATUS_CODE_TEMPLATE;
+
+/**
+ Common exception handler
+
+ @param[in] InterruptType - Exception type
+ @param[in] SystemContext - EFI_SYSTEM_CONTEXT
+**/
+VOID
+EFIAPI
+CommonExceptionHandler (
+ IN EFI_EXCEPTION_TYPE InterruptType,
+ IN EFI_SYSTEM_CONTEXT SystemContext
+ );
+
+/**
+ Install the IA-32 EM64T Exception Handler.
+ The current operation (which likely will change) will uninstall all the
+ pertinent exception handlers (0-7, 10-14, 16-19) except for Int8 which the timer
+ is currently sitting on (or soon will be).
+
+ It then installs all the appropriate handlers for each exception.
+
+ The handler then calls gRT->ReportStatusCode with a specific progress code. The
+ progress codes for now start at 0x200 for IA-32 processors. See Status Code
+ Specification for details. The Status code Specification uses the enumeration from
+ the EFI 1.1 Debug Support Protocol.
+
+ @param[in] CpuProtocol - Instance of CPU Arch Protocol
+
+ @retval EFI_SUCCESS - This function always return success after registering handlers.
+**/
+EFI_STATUS
+InitializeException (
+ IN EFI_CPU_ARCH_PROTOCOL *CpuProtocol
+ );
+
+#endif
diff --git a/ReferenceCode/Haswell/CpuInit/Dxe/Features.c b/ReferenceCode/Haswell/CpuInit/Dxe/Features.c
new file mode 100644
index 0000000..2561850
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Dxe/Features.c
@@ -0,0 +1,1093 @@
+/** @file
+ CPU feature control module
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "CpuInitDxe.h"
+#include "Features.h"
+#include "MachineCheck.h"
+#include "Mpcommon.h"
+#include "CpuPlatformLib.h"
+#endif
+
+extern DXE_CPU_PLATFORM_POLICY_PROTOCOL *mPlatformCpu;
+
+UINT8 mFeatureLock;
+UINTN mCommonFeatures;
+UINTN mSetupFeatures;
+
+static UINT8 mLock;
+static LEAST_FEATURE_PROC mLeastFeatureProcessor;
+
+/**
+ Write 64bits MSR with script
+
+ @param[in] Index - MSR index that will be written
+ @param[in] Value - value written to MSR
+**/
+VOID
+AsmWriteMsr64WithScript (
+ IN UINT32 Index,
+ IN UINT64 Value
+ )
+{
+ AsmWriteMsr64 (Index, Value);
+ WriteMsr64ToScript (Index, Value);
+}
+
+/**
+ Write 64bits MSR to script
+
+ @param[in] Index - MSR index that will be written
+ @param[in] Value - value written to MSR
+**/
+VOID
+WriteMsr64ToScript (
+ IN UINT32 Index,
+ IN UINT64 Value
+ )
+{
+ UINTN TableIndex;
+
+ ASSERT (mMPSystemData != NULL);
+
+ ///
+ /// Save it into script
+ ///
+ AsmAcquireMPLock (&(mMPSystemData->S3BootScriptLock));
+ TableIndex = mMPSystemData->S3BootScriptCount++;
+ AsmReleaseMPLock (&(mMPSystemData->S3BootScriptLock));
+
+ ASSERT (TableIndex < MAX_CPU_S3_TABLE_SIZE - 1);
+ mMPSystemData->S3BootScriptTable[TableIndex].ApicId = GetApicID (NULL, NULL);
+ mMPSystemData->S3BootScriptTable[TableIndex].MsrIndex = Index;
+ mMPSystemData->S3BootScriptTable[TableIndex].MsrValue = Value;
+}
+
+/**
+ Provide access to the CPU misc enables MSR
+
+ @param[in] Enable - Enable or Disable Misc Features
+ @param[in] BitMask - The register bit offset of MSR MSR_IA32_MISC_ENABLE
+**/
+VOID
+CpuMiscEnable (
+ BOOLEAN Enable,
+ UINT64 BitMask
+ )
+{
+ UINT64 MsrValue;
+
+ MsrValue = AsmReadMsr64 (MSR_IA32_MISC_ENABLE);
+ if (Enable) {
+ MsrValue |= BitMask;
+ } else {
+ MsrValue &= ~BitMask;
+ }
+
+ AsmWriteMsr64 (MSR_IA32_MISC_ENABLE, MsrValue);
+}
+
+/**
+ Calculate how many bits are one from given number
+
+ @param[in] Value - number that will be calculated bits
+
+ @retval Number of bits
+**/
+UINT32
+GetBitsNumberOfOne (
+ UINT32 Value
+ )
+{
+ UINT32 Result;
+
+ Result = 0;
+ while (Value) {
+ if (Value & 1) {
+ Result++;
+ }
+ Value >>= 1;
+ }
+ return Result;
+}
+
+///
+/// DCA contains processor code and chipset code
+/// CPU driver has the following assumption on the initialization flow
+/// 1. Chipset pre-initialization should detect DCA support per chipset capability after CpuPlatformPolicy
+/// 2. If not support, it should update CpuPlatformPolicy DCA to disable state
+/// 3. If support, it should enable the DCA related registers
+/// 4. CPU initialization for DCA (CPU may change CpuPlatformPolicy DCA states per CPU capability)
+/// 5. Normal chipset driver (IOH) should look at CpuPlatformPolicy DCA policy again in PCI enumeratoin
+/// 6. Chipset enable or disable DCA according to CpuPlatformPolicy DCA state
+///
+/**
+ Detect DCA supported or not
+
+ @retval DCA_SUPPORT if supported or 0 if not supported
+**/
+UINTN
+IsDcaSupported (
+ VOID
+ )
+{
+ EFI_CPUID_REGISTER CpuidRegisters;
+ BOOLEAN Support;
+
+ Support = 0;
+ AsmCpuid (
+ CPUID_VERSION_INFO,
+ &CpuidRegisters.RegEax,
+ &CpuidRegisters.RegEbx,
+ &CpuidRegisters.RegEcx,
+ &CpuidRegisters.RegEdx
+ );
+ if ((CpuidRegisters.RegEcx & B_CPUID_VERSION_INFO_ECX_DCA) != 0) {
+ ///
+ /// Execute Disable Bit feature is not supported on this processor.
+ ///
+ Support = DCA_SUPPORT;
+ }
+ return Support;
+}
+
+/**
+ Detect HT supported or not
+
+ @retval HT_SUPPORT if supported or 0 if not supported
+**/
+UINTN
+IsHTSupported (
+ VOID
+ )
+{
+ EFI_CPUID_REGISTER CpuidRegisters;
+ UINTN Support;
+
+ Support = 0;
+
+ AsmCpuidEx (
+ CPUID_CORE_TOPOLOGY,
+ 0,
+ &CpuidRegisters.RegEax,
+ &CpuidRegisters.RegEbx,
+ &CpuidRegisters.RegEcx,
+ &CpuidRegisters.RegEdx
+ );
+ if ((CpuidRegisters.RegEbx & 0x00FF) == 2) {
+ Support = HT_SUPPORT;
+ }
+ return Support;
+
+}
+
+/**
+ Detect if AES supported or not
+
+ @retval AES_SUPPORT if supported or 0 if not supported
+**/
+UINTN
+IsAesSupported (
+ VOID
+ )
+{
+
+ EFI_CPUID_REGISTER CpuidRegisters;
+ UINTN Support;
+
+ Support = 0;
+ EfiCpuid (CPUID_VERSION_INFO, &CpuidRegisters);
+ if ((CpuidRegisters.RegEcx & B_CPUID_VERSION_INFO_ECX_AES) != 0) {
+ Support = AES_SUPPORT;
+ }
+ return Support;
+}
+
+/**
+ Detect if XD supported or not
+
+ @retval XD_SUPPORT if supported or 0 if not supported
+**/
+UINTN
+IsXdSupported (
+ VOID
+ )
+{
+ EFI_CPUID_REGISTER CpuidRegisters;
+ BOOLEAN Support;
+
+ Support = 0;
+ AsmCpuid (
+ CPUID_EXTENDED_FUNCTION,
+ &CpuidRegisters.RegEax,
+ &CpuidRegisters.RegEbx,
+ &CpuidRegisters.RegEcx,
+ &CpuidRegisters.RegEdx
+ );
+ if (CpuidRegisters.RegEax > CPUID_EXTENDED_FUNCTION) {
+ AsmCpuid (
+ CPUID_EXTENDED_CPU_SIG,
+ &CpuidRegisters.RegEax,
+ &CpuidRegisters.RegEbx,
+ &CpuidRegisters.RegEcx,
+ &CpuidRegisters.RegEdx
+ );
+ if ((CpuidRegisters.RegEdx & B_CPUID_VERSION_INFO_EDX_XD) != 0) {
+ ///
+ /// Execute Disable Bit feature is not supported on this processor.
+ ///
+ Support = XD_SUPPORT;
+ }
+ }
+ return Support;
+}
+
+/**
+ Enable XD if supported or disable it if not supported
+
+ @param[in] Support - bitmap that indicate XD supported or not
+**/
+VOID
+EnableDisableXd (
+ IN UINTN Support
+ )
+{
+ BOOLEAN XdSupport;
+
+ if ((mCommonFeatures & XD_SUPPORT) == 0) {
+ return;
+ }
+ XdSupport = (BOOLEAN)((Support & XD_SUPPORT) == XD_SUPPORT);
+ ///
+ /// MSR MISC_ENABLE[34] has negative logic: 0 - XD Enabled, 1 - XD Disabled
+ ///
+ CpuMiscEnable (!XdSupport, B_MSR_IA32_MISC_ENABLE_XD);
+}
+
+/**
+ Check on the processor if VMX/TXT is supported.
+
+ @retval VMX_SUPPORT and TXT_SUPPORT if supported or 0 if not supported
+**/
+UINTN
+IsVmxSupported (
+ VOID
+ )
+{
+ EFI_CPUID_REGISTER CpuIdRegister;
+ UINTN Support;
+
+ Support = 0;
+
+ ///
+ /// Get CPUID to check if the processor supports Vanderpool Technology.
+ ///
+ AsmCpuid (
+ CPUID_VERSION_INFO,
+ &CpuIdRegister.RegEax,
+ &CpuIdRegister.RegEbx,
+ &CpuIdRegister.RegEcx,
+ &CpuIdRegister.RegEdx
+ );
+ if ((CpuIdRegister.RegEcx & B_CPUID_VERSION_INFO_ECX_VME) != 0) {
+ ///
+ /// VT is supported.
+ ///
+ Support |= VMX_SUPPORT;
+ }
+ if ((CpuIdRegister.RegEcx & B_CPUID_VERSION_INFO_ECX_SME) != 0) {
+ ///
+ /// TXT is supported.
+ ///
+ Support |= TXT_SUPPORT;
+ }
+ return Support;
+}
+
+/**
+ Enable VMX/TXT on the processor.
+
+ @param[in] Support - To enable or disable VMX/TXT feature.
+**/
+VOID
+EnableDisableVmx (
+ IN UINTN Support
+ )
+{
+ UINT64 Ia32FeatCtrl;
+ UINT64 NewFeatCtrl;
+
+ Ia32FeatCtrl = AsmReadMsr64 (MSR_IA32_FEATURE_CONTROL);
+ Ia32FeatCtrl &= ~((UINT64) OPTION_FEATURE_RESERVED_MASK);
+
+ NewFeatCtrl = Ia32FeatCtrl;
+
+ ///
+ /// If Vmx is Disabled, Enable it.
+ ///
+ if (mCommonFeatures & VMX_SUPPORT) {
+ if (Support & VMX_SUPPORT) {
+ NewFeatCtrl |= B_MSR_IA32_FEATURE_CONTROL_EVT;
+ } else {
+ NewFeatCtrl &= ~B_MSR_IA32_FEATURE_CONTROL_EVT;
+ }
+ }
+ if (mCommonFeatures & TXT_SUPPORT) {
+ if (Support & TXT_SUPPORT) {
+ ///
+ /// MSR Lock will be done in later.
+ ///
+ NewFeatCtrl |= (B_MSR_IA32_FEATURE_CONTROL_SLFE | B_MSR_IA32_FEATURE_CONTROL_SGE);
+ if (mCommonFeatures & VMX_SUPPORT) {
+ ///
+ /// Bit [1] can only be set if CPU is both VMX and TXT capable
+ ///
+ NewFeatCtrl |= B_MSR_IA32_FEATURE_CONTROL_ELT;
+ }
+ } else {
+ NewFeatCtrl &= ~(B_MSR_IA32_FEATURE_CONTROL_ELT | B_MSR_IA32_FEATURE_CONTROL_SLFE | B_MSR_IA32_FEATURE_CONTROL_SGE);
+ }
+ }
+
+ ///
+ /// Check the Feature Lock Bit.
+ /// If it is already set, which indicates we are executing POST
+ /// due to a warm RESET (i.e., PWRGOOD was not de-asserted).
+ ///
+ if ((Ia32FeatCtrl & B_MSR_IA32_FEATURE_CONTROL_LOCK) == 0) {
+ AsmWriteMsr64WithScript (MSR_IA32_FEATURE_CONTROL, NewFeatCtrl);
+ } else {
+ ///
+ /// if Lock bit is set
+ ///
+ NewFeatCtrl &= ~(B_MSR_IA32_FEATURE_CONTROL_LOCK);
+ WriteMsr64ToScript (MSR_IA32_FEATURE_CONTROL, NewFeatCtrl);
+ }
+}
+
+/**
+ Enable / Disable AES on the processor.
+
+ @param[in] Support - To enable or disable AES feature.
+**/
+VOID
+EnableDisableAes (
+ IN UINTN Support
+ )
+{
+ UINT64 MsrValue;
+
+ if (!(mCommonFeatures & AES_SUPPORT) || (IsSecondaryThread ())) {
+ return;
+ }
+
+ ///
+ /// The processor was manufacted with AES-NI feature
+ ///
+ MsrValue = AsmReadMsr64 (MSR_IA32_FEATURE_CONFIG);
+
+ ///
+ /// Check the Feature Lock Bit.
+ /// If it is already set, which indicates we are executing POST
+ /// due to a warm RESET (i.e., PWRGOOD was not de-asserted).
+ ///
+ if ((MsrValue & B_IA32_FEATURE_CONFIG_LOCK) == 0) {
+ if (Support & AES_SUPPORT) {
+ ///
+ /// Enabled AES, writes of 00b, 01b pr 10b to the MSR will result in AES enable.
+ /// Should lock this MSR always, so write 01b to the MSR.
+ ///
+ MsrValue &= ~B_IA32_FEATURE_CONFIG_AES_DIS;
+ MsrValue |= B_IA32_FEATURE_CONFIG_LOCK;
+ } else {
+ ///
+ /// To disable AES, system BIOS must write 11b to this MSR.
+ ///
+ MsrValue |= (B_IA32_FEATURE_CONFIG_AES_DIS + B_IA32_FEATURE_CONFIG_LOCK);
+ }
+ AsmWriteMsr64WithScript (MSR_IA32_FEATURE_CONFIG, MsrValue);
+ }
+ return;
+}
+
+/**
+ Check on the processor if Debug Interface is supported.
+
+ @retval DEBUG_SUPPORT and DEBUG_LOCK_SUPPORT if supported or 0 if not supported
+**/
+UINTN
+IsDebugInterfaceSupported (
+ VOID
+ )
+{
+ UINTN Support;
+ EFI_CPUID_REGISTER CpuIdRegister;
+
+ Support = 0;
+
+ ///
+ /// Access to MSR_IA32_DEBUG_INTERFACE is supported on:
+ /// HSW B0, HSWULT B0 and CRW B0 Stepping
+ /// HSW stepping >= C0, HSWULT Stepping >= C0 and CRW stepping >= C0 stepping, if CPUID (EAX=1): ECX[11] = 1
+ ///
+ AsmCpuid (
+ CPUID_VERSION_INFO,
+ &CpuIdRegister.RegEax,
+ &CpuIdRegister.RegEbx,
+ &CpuIdRegister.RegEcx,
+ &CpuIdRegister.RegEdx
+ );
+ switch (CpuIdRegister.RegEax) {
+ case (EnumCpuHsw + EnumHswA0):
+ //DEBUG ((EFI_D_INFO,"MSR_IA32_DEBUG_INTERFACE is not supported on Ax CPU stepping\n")); (AMI_CHG+)
+ break;
+ case (EnumCpuHsw + EnumHswB0):
+ case (EnumCpuHswUlt + EnumHswUltB0):
+ case (EnumCpuCrw + EnumCrwB0):
+ Support |= DEBUG_SUPPORT;
+ Support |= DEBUG_LOCK_SUPPORT;
+ break;
+ default:
+ if (CpuIdRegister.RegEcx & BIT11) {
+ Support |= DEBUG_SUPPORT;
+ Support |= DEBUG_LOCK_SUPPORT;
+ }
+ break;
+ }
+ return Support;
+}
+
+/**
+ Enable/Disable Debug Interfaces in the processor.
+
+ @param[in] Support - To enable or disable Debug Interface feature.
+**/
+VOID
+EnableDisableDebugInterface (
+ IN UINTN Support
+ )
+{
+ UINT64 Ia32DebugInterface;
+ BOOLEAN IsBsp;
+
+ ///
+ /// IA32_DEBUG_INTERFACE_MSR scope is "Package", program on BSP only
+ ///
+ IsBsp = (AsmReadMsr64 (MSR_IA32_APIC_BASE) & B_MSR_IA32_APIC_BASE_BSP) ? TRUE : FALSE;
+ if (!(mCommonFeatures & DEBUG_SUPPORT) || (IsBsp == FALSE)) {
+ return;
+ }
+
+ ///
+ /// Check if the processor supports debug interface
+ ///
+ if (IsDebugInterfaceSupported()) {
+ Ia32DebugInterface = AsmReadMsr64 (MSR_IA32_DEBUG_INTERFACE);
+ if (!(Ia32DebugInterface & B_DEBUG_INTERFACE_LOCK)) {
+ if (Support & DEBUG_SUPPORT) {
+ ///
+ /// Enable Debug Interface (MSR 0xC80.Bit0 = 1)
+ ///
+ Ia32DebugInterface |= B_DEBUG_INTERFACE_ENABLE;
+ DEBUG ((EFI_D_ERROR, "Enable MSR_IA32_DEBUG_INTERFACE\n"));
+ } else {
+ ///
+ /// Disable Debug Interface (MSR 0xC80.Bit0 = 0)
+ ///
+ Ia32DebugInterface &= ~B_DEBUG_INTERFACE_ENABLE;
+ DEBUG ((EFI_D_ERROR, "Disable MSR_IA32_DEBUG_INTERFACE\n"));
+ }
+ if (Support & DEBUG_LOCK_SUPPORT) {
+ Ia32DebugInterface &= ~B_DEBUG_INTERFACE_LOCK;
+ }
+ DEBUG ((EFI_D_ERROR, "Set MSR_IA32_DEBUG_INTERFACE to %x\n",Ia32DebugInterface));
+ AsmWriteMsr64WithScript (MSR_IA32_DEBUG_INTERFACE, Ia32DebugInterface);
+ }
+ }
+ return;
+}
+
+/**
+ Lock VMX/TXT feature bits on the processor.
+ Set "CFG Lock" (MSR 0E2h Bit[15]
+
+ @param[in] LockFeatureEnable - TRUE to lock these feature bits and FALSE to not lock
+**/
+VOID
+LockFeatureBit (
+ IN BOOLEAN LockFeatureEnable
+ )
+{
+ UINT64 Ia32FeatCtrl;
+ UINT32 MsrValue;
+
+ if (!LockFeatureEnable) {
+ return;
+ }
+
+ ///
+ /// MSR 3Ah for VMX/TXT Lock
+ ///
+ Ia32FeatCtrl = AsmReadMsr64 (MSR_IA32_FEATURE_CONTROL);
+ Ia32FeatCtrl &= ~((UINT64) OPTION_FEATURE_RESERVED_MASK);
+
+ if ((Ia32FeatCtrl & B_MSR_IA32_FEATURE_CONTROL_LOCK) == 0) {
+ ///
+ /// Set Feature Lock bits.
+ ///
+ Ia32FeatCtrl |= B_MSR_IA32_FEATURE_CONTROL_LOCK;
+ AsmWriteMsr64WithScript (MSR_IA32_FEATURE_CONTROL, Ia32FeatCtrl);
+ } else {
+ WriteMsr64ToScript (MSR_IA32_FEATURE_CONTROL, Ia32FeatCtrl);
+ }
+
+ MsrValue = GetCsrDesiredCores ();
+ if ((MsrValue & BIT16) == 0) {
+ ///
+ /// Set Lock
+ ///
+ SetLockCsrDesiredCores ();
+ }
+ return;
+}
+
+/**
+ Detect if X2APIC supported or not
+
+ @retval XAPIC_SUPPORT if supported or 0 if not supported
+**/
+UINTN
+IsXapicSupported (
+ VOID
+ )
+{
+ EFI_CPUID_REGISTER CpuidRegisters;
+ UINTN Support;
+ UINT64 MsrValue;
+
+ Support = 0;
+
+ MsrValue = AsmReadMsr64 (MSR_IA32_APIC_BASE);
+ AsmCpuid (
+ CPUID_VERSION_INFO,
+ &CpuidRegisters.RegEax,
+ &CpuidRegisters.RegEbx,
+ &CpuidRegisters.RegEcx,
+ &CpuidRegisters.RegEdx
+ );
+ if ((CpuidRegisters.RegEcx & B_CPUID_VERSION_INFO_ECX_XAPIC) != 0) {
+ if (MsrValue & B_MSR_IA32_APIC_BASE_G_XAPIC) {
+ ///
+ /// XAPIC Mode feature is supported on this processor.
+ ///
+ Support = XAPIC_SUPPORT;
+ }
+ }
+ return Support;
+}
+
+/**
+ Enable / Disable X2APIC on the processor.
+
+ @param[in] Support - To enable or disable X2APIC feature.
+**/
+VOID
+EnableDisableXAPIC (
+ IN UINTN Support
+ )
+{
+ UINT64 MsrValue;
+
+ if (!(mCommonFeatures & XAPIC_SUPPORT)) {
+ return;
+ }
+ MsrValue = AsmReadMsr64 (MSR_IA32_APIC_BASE);
+ if (Support & XAPIC_SUPPORT) {
+ MsrValue |= B_MSR_IA32_APIC_BASE_M_XAPIC;
+ } else {
+ MsrValue &= ~B_MSR_IA32_APIC_BASE_G_XAPIC;
+ MsrValue &= ~B_MSR_IA32_APIC_BASE_M_XAPIC;
+ AsmWriteMsr64 (MSR_IA32_APIC_BASE, MsrValue);
+ MsrValue |= B_MSR_IA32_APIC_BASE_G_XAPIC;
+ }
+ AsmWriteMsr64 (MSR_IA32_APIC_BASE, MsrValue);
+}
+
+/**
+ Initialize other processor functions (TPR messaging, floating point)
+**/
+VOID
+InitializeMiscProcessorFunctions (
+ VOID
+ )
+{
+ UINT64 MsrValue;
+
+ ///
+ /// Enable TPR Update messages,if supported (see section 2.5)
+ ///
+ MsrValue = AsmReadMsr64 (PIC_THREAD_CONTROL);
+ MsrValue &= (~B_PIC_THREAD_CONTROL_TPR_DIS);
+ AsmWriteMsr64WithScript (PIC_THREAD_CONTROL, MsrValue);
+
+ ///
+ /// Enable the Save Floating Point feature on every logical processors in the
+ /// platform when available. The BIOS must verify the SMM SAVE CONTROL capability
+ /// bit is set to 1 in PLATFORM_INFO MSR CEh [16] (see Section 2.16) before setting
+ /// the SMM_SAVE_CONTROL MSR 3Eh [0] to 1.
+ ///
+ MsrValue = AsmReadMsr64 (MSR_PLATFORM_INFO);
+ if ((MsrValue & B_PLATFORM_INFO_SMM_SAVE_CONTROL) != 0) {
+ MsrValue = AsmReadMsr64 (MSR_IA32_SMM_SAVE_CONTROL);
+ MsrValue |= B_MSR_IA32_SMM_SAVE_CONTROL_SFPPE;
+ AsmWriteMsr64WithScript (MSR_IA32_SMM_SAVE_CONTROL, MsrValue);
+ }
+
+}
+
+/**
+ Create feature control structure which will be used to program each feature on each core.
+
+ @param[in] MPSystemData - MP_SYSTEM_DATA global variable that contains platform policy protocol settings of each features.
+**/
+VOID
+InitializeFeaturePerSetup (
+ IN MP_SYSTEM_DATA *MPSystemData
+ )
+{
+ mFeatureLock = VacantFlag;
+ mCommonFeatures = (UINTN) -1;
+ mSetupFeatures = (UINTN) -1;
+
+ if (!MPSystemData->VmxEnable) {
+ mSetupFeatures &= ~VMX_SUPPORT;
+ }
+ if (!MPSystemData->TxtEnable) {
+ mSetupFeatures &= ~TXT_SUPPORT;
+ }
+ if (!MPSystemData->ExecuteDisableBit) {
+ mSetupFeatures &= ~XD_SUPPORT;
+ }
+ if (!MPSystemData->XapicEnable) {
+ mSetupFeatures &= ~XAPIC_SUPPORT;
+ }
+ if (!MPSystemData->AesEnable) {
+ mSetupFeatures &= ~AES_SUPPORT;
+ }
+ if (!MPSystemData->DebugInterfaceEnable) {
+ mSetupFeatures &= ~DEBUG_SUPPORT;
+ }
+ if (!MPSystemData->DebugInterfaceLockEnable) {
+ mSetupFeatures &= ~DEBUG_LOCK_SUPPORT;
+ }
+}
+
+/**
+ Detect each processor feature and log all supported features
+
+ @param[in] MpServices - EFI_MP_SERVICES_PROTOCOL
+**/
+VOID
+CollectProcessorFeature (
+ IN EFI_MP_SERVICES_PROTOCOL *MpServices
+ )
+{
+ UINTN Support;
+
+ Support = 0;
+ Support |= IsXdSupported ();
+ Support |= IsVmxSupported ();
+ Support |= IsDcaSupported ();
+ Support |= IsAesSupported ();
+ Support |= IsXapicSupported ();
+ Support |= IsHTSupported ();
+ Support |= IsDebugInterfaceSupported ();
+
+ AsmAcquireMPLock (&mFeatureLock);
+ mCommonFeatures &= Support;
+ AsmReleaseMPLock (&mFeatureLock);
+
+ return;
+}
+
+/**
+ Program all processor features basing on desired settings
+
+ @param[in] MpServices - EFI_MP_SERVICES_PROTOCOL
+**/
+VOID
+ProgramProcessorFeature (
+ IN EFI_MP_SERVICES_PROTOCOL *MpServices
+ )
+{
+ UINTN Supported;
+ BOOLEAN IsBsp;
+
+ Supported = mCommonFeatures & mSetupFeatures;
+
+ ///
+ /// Configure features such as Xd, Vmx, Smx, XAPIC, AES, DebugInterface
+ ///
+ EnableDisableXd (Supported);
+ EnableDisableVmx (Supported);
+ EnableDisableXAPIC (Supported);
+ EnableDisableAes (Supported);
+ EnableDisableDebugInterface (Supported);
+
+ ///
+ /// Lock Proceesor Features
+ /// Make sure all CPU Features configuration are set before lock
+ ///
+ LockFeatureBit (1);
+
+ ///
+ /// Programe XApic register
+ ///
+ IsBsp = (AsmReadMsr64 (MSR_IA32_APIC_BASE) & B_MSR_IA32_APIC_BASE_BSP) ? TRUE : FALSE;
+ ProgramXApic (IsBsp);
+
+ ///
+ /// Initialize MonitorMWait register
+ ///
+ CpuMiscEnable (mMPSystemData->MonitorMwaitEnable, B_MSR_IA32_MISC_ENABLE_MONITOR);
+
+ ///
+ /// Initialize Machine Check registers
+ ///
+ InitializeMachineCheckRegisters (NULL, mMPSystemData->MachineCheckEnable);
+
+ //
+ // Misc functions
+ //
+ InitializeMiscProcessorFunctions();
+
+ return;
+}
+
+/**
+ Program CPUID Limit before booting to OS
+
+ @param[in] MpServices - MP Services Protocol entry
+**/
+VOID
+ProgramCpuidLimit (
+ IN EFI_MP_SERVICES_PROTOCOL *MpServices
+ )
+{
+ UINT64 MsrValue;
+
+ ///
+ /// Move Limit CPUID Maxval configuration here to not impact the BOOT
+ /// After setting this, no code can execute CPUID function > 3.
+ ///
+ CpuMiscEnable (mMPSystemData->LimitCpuidMaximumValue, B_MSR_IA32_MISC_ENABLE_CPUID_MAX);
+
+ ///
+ /// Finally record the MISC MSR into CPU S3 script table
+ /// to avoid access for multiple times
+ ///
+ MsrValue = AsmReadMsr64 (MSR_IA32_MISC_ENABLE);
+ AsmWriteMsr64WithScript (MSR_IA32_MISC_ENABLE, MsrValue);
+
+ return;
+}
+
+/**
+ Initialize prefetcher settings
+
+ @param[in] MlcStreamerprefecterEnabled - Enable/Disable MLC streamer prefetcher
+ @param[in] MlcSpatialPrefetcherEnabled - Enable/Disable MLC spatial prefetcher
+**/
+VOID
+InitializeProcessorsPrefetcher (
+ IN UINTN MlcStreamerprefecterEnabled,
+ IN UINTN MlcSpatialPrefetcherEnabled
+ )
+{
+ UINT64 MsrValue;
+ MsrValue = AsmReadMsr64 (MISC_FEATURE_CONTROL);
+
+ if (MlcStreamerprefecterEnabled == CPU_FEATURE_DISABLE) {
+ MsrValue |= B_MISC_FEATURE_CONTROL_MLC_STRP;
+ }
+
+ if (MlcSpatialPrefetcherEnabled == CPU_FEATURE_DISABLE) {
+ MsrValue |= B_MISC_FEATURE_CONTROL_MLC_SPAP;
+ }
+
+ if ((MsrValue & (B_MISC_FEATURE_CONTROL_MLC_STRP | B_MISC_FEATURE_CONTROL_MLC_SPAP)) != 0) {
+ AsmWriteMsr64 (MISC_FEATURE_CONTROL, MsrValue);
+ }
+
+ return;
+}
+
+/**
+ Get processor feature
+
+ @param[in] Features - pointer to a buffer which stores feature information
+**/
+VOID
+GetProcessorFeatures (
+ IN UINT32 *Features
+ )
+{
+ EFI_CPUID_REGISTER CpuidRegisters;
+
+ AsmCpuid (
+ CPUID_VERSION_INFO,
+ &CpuidRegisters.RegEax,
+ &CpuidRegisters.RegEbx,
+ &CpuidRegisters.RegEcx,
+ &CpuidRegisters.RegEdx
+ );
+ Features[0] = CpuidRegisters.RegEcx;
+ Features[1] = CpuidRegisters.RegEdx;
+ AsmCpuid (
+ CPUID_EXTENDED_CPU_SIG,
+ &CpuidRegisters.RegEax,
+ &CpuidRegisters.RegEbx,
+ &CpuidRegisters.RegEcx,
+ &CpuidRegisters.RegEdx
+ );
+ Features[2] = CpuidRegisters.RegEax;
+ Features[3] = CpuidRegisters.RegEbx;
+ Features[4] = CpuidRegisters.RegEcx;
+ Features[5] = CpuidRegisters.RegEdx;
+
+ return;
+}
+
+/**
+ Update some processor info into LEAST_FEATURE_PROC data structure.
+
+ @param[in] Index - indicate which processor calling this routine
+ @param[in] LeastFeatureProcessor - the data structure that will be updated
+**/
+VOID
+UpdateProcessorInfo (
+ IN UINTN Index,
+ IN LEAST_FEATURE_PROC *LeastFeatureProcessor
+ )
+{
+ UINT16 FamilyId;
+ UINT8 Model;
+ UINT8 SteppingId;
+
+ EfiCpuVersion (&FamilyId, &Model, &SteppingId, NULL);
+ LeastFeatureProcessor->Index = Index;
+ LeastFeatureProcessor->ApicId = GetApicID (NULL, NULL);
+ LeastFeatureProcessor->Version = EfiMakeCpuVersion (FamilyId, Model, SteppingId);
+}
+
+/**
+ Get processor feature delta
+
+ @param[in] FeaturesInput - Supported features for input processor
+ @param[in] CommonFeatures - Supported features for processor (subset of FeaturesInput)
+
+ @retval The least of processor features
+**/
+UINT32
+GetProcessorFeatureDelta (
+ IN UINT32 *FeaturesInput,
+ IN UINT32 *CommonFeatures
+ )
+{
+ UINT32 Delta;
+ UINTN Index;
+
+ ///
+ /// CommonFeatures is the subset of FeaturesInput
+ ///
+ Delta = 0;
+ for (Index = 0; Index < MAX_FEATURE_NUM; Index++) {
+ Delta += GetBitsNumberOfOne (FeaturesInput[Index] - CommonFeatures[Index]);
+ }
+
+ return 0;
+}
+
+/**
+ Find out the common features supported by all core/threads
+
+ @param[in] MpServices - EFI_MP_SERVICES_PROTOCOL
+**/
+VOID
+GetProcessorCommonFeature (
+ IN EFI_MP_SERVICES_PROTOCOL *MpServices
+ )
+{
+ UINTN Index;
+ UINT32 Features[MAX_FEATURE_NUM];
+
+ GetProcessorFeatures (Features);
+
+ AsmAcquireMPLock (&mLock);
+ for (Index = 0; Index < MAX_FEATURE_NUM; Index++) {
+ mLeastFeatureProcessor.Features[Index] &= Features[Index];
+ }
+ AsmReleaseMPLock (&mLock);
+ return;
+}
+
+/**
+ Get the processor data with least features
+
+ @param[in] MpServices - EFI_MP_SERVICES_PROTOCOL
+**/
+VOID
+GetProcessorWithLeastFeature (
+ IN EFI_MP_SERVICES_PROTOCOL *MpServices
+ )
+{
+ EFI_STATUS Status;
+ UINTN CurrentProcessor;
+ LEAST_FEATURE_PROC LeastFeatureProcessor;
+
+ Status = MpServices->WhoAmI (
+ MpServices,
+ &CurrentProcessor
+ );
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+
+ GetProcessorFeatures (LeastFeatureProcessor.Features);
+ LeastFeatureProcessor.FeatureDelta = GetProcessorFeatureDelta (
+ LeastFeatureProcessor.Features,
+ mLeastFeatureProcessor.Features
+ );
+
+ AsmAcquireMPLock (&mLock);
+ if (LeastFeatureProcessor.FeatureDelta < mLeastFeatureProcessor.FeatureDelta) {
+ mLeastFeatureProcessor.FeatureDelta = LeastFeatureProcessor.FeatureDelta;
+ UpdateProcessorInfo (CurrentProcessor, &mLeastFeatureProcessor);
+ } else if (LeastFeatureProcessor.FeatureDelta == mLeastFeatureProcessor.FeatureDelta) {
+ UpdateProcessorInfo (CurrentProcessor, &LeastFeatureProcessor);
+ if (LeastFeatureProcessor.Version < mLeastFeatureProcessor.Version) {
+ UpdateProcessorInfo (CurrentProcessor, &mLeastFeatureProcessor);
+ } else if (LeastFeatureProcessor.Version == mLeastFeatureProcessor.Version) {
+ if (LeastFeatureProcessor.ApicId < mLeastFeatureProcessor.ApicId) {
+ UpdateProcessorInfo (CurrentProcessor, &mLeastFeatureProcessor);
+ }
+ }
+ }
+
+ AsmReleaseMPLock (&mLock);
+
+ return;
+}
+
+/**
+ Switch BSP to the processor which has least features
+
+ @param[in] MpServices - EFI_MP_SERVICES_PROTOCOL
+
+ @retval EFI_STATUS - status code returned from each sub-routines
+**/
+EFI_STATUS
+SwitchToLowestFeatureProcess (
+ IN EFI_MP_SERVICES_PROTOCOL *MpServices
+ )
+{
+ EFI_STATUS Status;
+ UINTN CurrentProcessor;
+ UINTN NewBsp;
+ UINT32 Features[MAX_FEATURE_NUM];
+
+ Status = MpServices->WhoAmI (
+ MpServices,
+ &CurrentProcessor
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ ReportStatusCode (
+ EFI_PROGRESS_CODE,
+ EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_PC_BSP_SELECT
+ );
+
+ ///
+ /// Take current BSP as the least feature
+ ///
+ UpdateProcessorInfo (CurrentProcessor, &mLeastFeatureProcessor);
+ GetProcessorFeatures (mLeastFeatureProcessor.Features);
+ CopyMem (Features, mLeastFeatureProcessor.Features, sizeof (Features));
+ Status = MpServices->StartupAllAPs (
+ MpServices,
+ GetProcessorCommonFeature,
+ FALSE,
+ NULL,
+ 100000,
+ (VOID *) MpServices,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ ///
+ /// Go through all processors to find the processor with least features
+ ///
+ mLeastFeatureProcessor.FeatureDelta = GetProcessorFeatureDelta (Features, mLeastFeatureProcessor.Features);
+ Status = MpServices->StartupAllAPs (
+ MpServices,
+ GetProcessorWithLeastFeature,
+ FALSE,
+ NULL,
+ 100000,
+ (VOID *) MpServices,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ ///
+ /// Switch BSP according
+ ///
+ if (mPlatformCpu->CpuConfig->BspSelection == 16) {
+ ///
+ /// Enable least feature SBSP selection
+ ///
+ NewBsp = mLeastFeatureProcessor.Index;
+ } else {
+ ///
+ /// Do not change the current BSP
+ /// made by SEC
+ ///
+ NewBsp = CurrentProcessor;
+ }
+
+ if (NewBsp != CurrentProcessor) {
+
+ DEBUG ((EFI_D_INFO, "Switch BSP from %d ==> %d\n", CurrentProcessor, NewBsp));
+ Status = MpServices->SwitchBSP (
+ MpServices,
+ NewBsp,
+ TRUE
+ );
+ }
+
+ return Status;
+}
diff --git a/ReferenceCode/Haswell/CpuInit/Dxe/Features.h b/ReferenceCode/Haswell/CpuInit/Dxe/Features.h
new file mode 100644
index 0000000..207ddde
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Dxe/Features.h
@@ -0,0 +1,145 @@
+/** @file
+ Header file of CPU feature control module
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _FEATURES_H_
+#define _FEATURES_H_
+
+#include "CpuInitDxe.h"
+#include "MpService.h"
+
+#define OPTION_FEATURE_RESERVED_MASK 0xFFFF00F8 ///< bits 30:16, 7:3
+#define OPTION_FEATURE_CONFIG_RESERVED_MASK 0xFFFFFFFC ///< bits 2:31
+/**
+ Create feature control structure which will be used to program each feature on each core.
+
+ @param[in] MPSystemData - MP_SYSTEM_DATA global variable that contains platform policy protocol settings of each features.
+**/
+VOID
+InitializeFeaturePerSetup (
+ IN MP_SYSTEM_DATA *MPSystemData
+ );
+
+/**
+ Program all processor features basing on desired settings
+
+ @param[in] MpServices - EFI_MP_SERVICES_PROTOCOL
+**/
+VOID
+ProgramProcessorFeature (
+ IN EFI_MP_SERVICES_PROTOCOL *MpServices
+ );
+
+/**
+ Program CPUID Limit before booting to OS
+
+ @param[in] MpServices - MP Services Protocol entry
+**/
+VOID
+ProgramCpuidLimit (
+ IN EFI_MP_SERVICES_PROTOCOL *MpServices
+ );
+
+/**
+ Initialize prefetcher settings
+
+ @param[in] MlcStreamerprefecterEnabled - Enable/Disable MLC streamer prefetcher
+ @param[in] MlcSpatialPrefetcherEnabled - Enable/Disable MLC spatial prefetcher
+**/
+VOID
+InitializeProcessorsPrefetcher (
+ IN UINTN MlcStreamerprefecterEnabled,
+ IN UINTN MlcSpatialPrefetcherEnabled
+ );
+
+/**
+ Detect each processor feature and log all supported features
+
+ @param[in] MpServices - EFI_MP_SERVICES_PROTOCOL
+**/
+VOID
+CollectProcessorFeature (
+ IN EFI_MP_SERVICES_PROTOCOL *MpServices
+ );
+
+/**
+ Lock VMX/TXT feature bits on the processor.
+ Set "CFG Lock" (MSR 0E2h Bit[15]
+
+ @param[in] LockFeatureEnable - TRUE to lock these feature bits and FALSE to not lock
+**/
+VOID
+LockFeatureBit (
+ IN BOOLEAN LockFeatureEnable
+ );
+
+/**
+ Function to get desired core number by CSR register
+
+ @retval Desired core number
+**/
+UINT32
+GetCsrDesiredCores (
+ VOID
+ );
+
+/**
+ Function to set desired core numbers or SMT lock
+**/
+VOID
+SetLockCsrDesiredCores (
+ VOID
+ );
+
+/**
+ Write 64bits MSR with script
+
+ @param[in] Index - MSR index that will be written
+ @param[in] Value - value written to MSR
+**/
+VOID
+AsmWriteMsr64WithScript (
+ IN UINT32 Index,
+ IN UINT64 Value
+ );
+
+/**
+ Write 64bits MSR to script
+
+ @param[in] Index - MSR index that will be written
+ @param[in] Value - value written to MSR
+**/
+VOID
+WriteMsr64ToScript (
+ IN UINT32 Index,
+ IN UINT64 Value
+ );
+
+/**
+ Provide access to the CPU misc enables MSR
+
+ @param[in] Enable - Enable or Disable Misc Features
+ @param[in] BitMask - The register bit offset of MSR MSR_IA32_MISC_ENABLE
+**/
+VOID
+CpuMiscEnable (
+ BOOLEAN Enable,
+ UINT64 BitMask
+ );
+
+#endif
diff --git a/ReferenceCode/Haswell/CpuInit/Dxe/MachineCheck.c b/ReferenceCode/Haswell/CpuInit/Dxe/MachineCheck.c
new file mode 100644
index 0000000..b7485fa
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Dxe/MachineCheck.c
@@ -0,0 +1,133 @@
+/** @file
+ Machine check register initialization
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "MachineCheck.h"
+#include "Features.h"
+
+#include EFI_GUID_DEFINITION (PowerOnHob)
+#include EFI_PROTOCOL_DEFINITION (MpService)
+#include EFI_PROTOCOL_DEFINITION (CpuPlatformPolicy)
+#endif
+
+extern DXE_CPU_PLATFORM_POLICY_PROTOCOL *mPlatformCpu;
+
+/**
+ Initialize all the Machine-Check registers.
+
+ @param[in] Buffer - Pointer to private data. Not Used.
+ @param[in] MchkEnable - Enable or disable Mchk.
+**/
+VOID
+InitializeMachineCheckRegisters (
+ IN VOID *Buffer,
+ IN BOOLEAN MchkEnable
+ )
+{
+ EFI_CPUID_REGISTER CpuidRegisters;
+ CPU_FEATURE Feature;
+ CPU_IA32_MCG_CAP_LOW_REGISTER *MCGCap;
+ UINT64 MCGCapValue;
+ UINT8 Count;
+ UINT8 Index;
+ UINT8 StartIndex;
+ UINT64 Value;
+
+ if (!MchkEnable) {
+ ///
+ /// Do not enable MCHK
+ ///
+ return;
+ }
+
+ AsmCpuid (
+ CPUID_VERSION_INFO,
+ &CpuidRegisters.RegEax,
+ &CpuidRegisters.RegEbx,
+ &CpuidRegisters.RegEcx,
+ &CpuidRegisters.RegEdx
+ );
+ *(UINT32 *) (&Feature) = CpuidRegisters.RegEdx;
+
+ if (Feature.MCE && Feature.MCA) {
+
+ MCGCapValue = AsmReadMsr64 (IA32_MCG_CAP);
+ MCGCap = (CPU_IA32_MCG_CAP_LOW_REGISTER *) &MCGCapValue;
+
+ Count = (UINT8) MCGCap->Count;
+
+ StartIndex = 0;
+ for (Index = StartIndex; Index < Count; Index++) {
+ Value = (UINT64) -1;
+ AsmWriteMsr64WithScript (IA32_MC0_CTL + Index * 4, Value);
+ }
+ for (Index = StartIndex; Index < Count; Index++) {
+ if (Index <= 4) {
+ ///
+ /// Clean MC0-MC4 Status when system is cold reset, but no boot script. S3 is treated as warm reset.
+ ///
+ if (mPlatformCpu->CpuConfig->IsColdReset == CPU_FEATURE_ENABLE) {
+ AsmWriteMsr64 (IA32_MC0_STATUS + Index * 4, 0);
+ }
+ continue;
+ }
+ AsmWriteMsr64WithScript (IA32_MC0_STATUS + Index * 4, 0);
+ }
+ EnableMce ();
+ }
+
+ return;
+}
+
+/**
+ Enable MCE feature for current CPU.
+
+ @param[in] MchkEnable - Enable Mchk or not.
+**/
+VOID
+InitializeMce (
+ IN BOOLEAN MchkEnable
+ )
+{
+ EFI_CPUID_REGISTER CpuidRegisters;
+ CPU_FEATURE Feature;
+
+ if (!MchkEnable) {
+ ///
+ /// Do not enable MCHK
+ ///
+ return;
+ }
+
+ AsmCpuid (
+ CPUID_VERSION_INFO,
+ &CpuidRegisters.RegEax,
+ &CpuidRegisters.RegEbx,
+ &CpuidRegisters.RegEcx,
+ &CpuidRegisters.RegEdx
+ );
+ *(UINT32 *) (&Feature) = CpuidRegisters.RegEdx;
+
+ if (Feature.MCE && Feature.MCA) {
+ EnableMce ();
+ }
+
+ return;
+}
diff --git a/ReferenceCode/Haswell/CpuInit/Dxe/MachineCheck.h b/ReferenceCode/Haswell/CpuInit/Dxe/MachineCheck.h
new file mode 100644
index 0000000..107c849
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Dxe/MachineCheck.h
@@ -0,0 +1,109 @@
+/** @file
+ The header file for Machine check register initialization driver
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _MACHINE_CHECK_INIT_H
+#define _MACHINE_CHECK_INIT_H
+
+#include "CpuInitDxe.h"
+#include "MpCommon.h"
+
+#pragma pack(1)
+
+typedef struct {
+ UINT32 FPU : 1;
+ UINT32 VME : 1;
+ UINT32 DE : 1;
+ UINT32 PSE : 1;
+ UINT32 TSC : 1;
+ UINT32 MSR : 1;
+ UINT32 PAE : 1;
+ UINT32 MCE : 1;
+
+ UINT32 CX8 : 1;
+ UINT32 APIC : 1;
+ UINT32 Reserved0 : 1;
+ UINT32 SEP : 1;
+ UINT32 MTRR : 1;
+ UINT32 PGE : 1;
+ UINT32 MCA : 1;
+ UINT32 CMOV : 1;
+
+ UINT32 PAT : 1;
+ UINT32 PSE_36 : 1;
+ UINT32 PSN : 1;
+ UINT32 CLFSH : 1;
+ UINT32 Reserved1 : 1;
+ UINT32 DS : 1;
+ UINT32 ACPI : 1;
+ UINT32 MMX : 1;
+
+ UINT32 FXSR : 1;
+ UINT32 SSE : 1;
+ UINT32 SSE2 : 1;
+ UINT32 SS : 1;
+ UINT32 HTT : 1;
+ UINT32 TM : 1;
+ UINT32 Reserved2 : 1;
+ UINT32 PBE : 1;
+} CPU_FEATURE;
+
+typedef struct {
+ UINT32 Count : 8;
+ UINT32 MCG_CTL_P : 1;
+ UINT32 MCG_EXT_P : 1;
+ UINT32 EXT_CORR_ERR : 1;
+ UINT32 MCG_TES_P : 1;
+ UINT32 Reserved0 : 4;
+ UINT32 MCG_EXT_CNT : 8;
+ UINT32 Reserved1 : 8;
+} CPU_IA32_MCG_CAP_LOW_REGISTER;
+
+#pragma pack()
+
+/**
+ Initialize all the Machine-Check registers.
+
+ @param[in] Buffer - Pointer to private data. Not Used.
+ @param[in] MchkEnable - Enable Mchk or not.
+**/
+VOID
+InitializeMachineCheckRegisters (
+ IN VOID *Buffer,
+ IN BOOLEAN MchkEnable
+ );
+
+/**
+ Enable MCE feature for current CPU.
+
+ @param[in] MchkEnable - Enable Mchk or not.
+**/
+VOID
+InitializeMce (
+ IN BOOLEAN MchkEnable
+ );
+
+/**
+ Enable "Machine Check Enable"
+**/
+VOID
+EnableMce (
+ VOID
+ );
+
+#endif
diff --git a/ReferenceCode/Haswell/CpuInit/Dxe/MemoryAttribute.c b/ReferenceCode/Haswell/CpuInit/Dxe/MemoryAttribute.c
new file mode 100644
index 0000000..9132580
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Dxe/MemoryAttribute.c
@@ -0,0 +1,895 @@
+/** @file
+ CPU MTRR programming driver
+
+Revision History
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "MpService.h"
+#include "MemoryAttribute.h"
+#include "CpuInitDxe.h"
+#endif
+
+FIXED_MTRR mFixedMtrrTable[V_FIXED_MTRR_NUMBER];
+
+FIXED_MTRR mFixedMtrrTable[] = {
+ {
+ IA32_MTRR_FIX64K_00000,
+ 0,
+ 0x10000
+ },
+ {
+ IA32_MTRR_FIX16K_80000,
+ 0x80000,
+ 0x4000
+ },
+ {
+ IA32_MTRR_FIX16K_A0000,
+ 0xA0000,
+ 0x4000
+ },
+ {
+ IA32_MTRR_FIX4K_C0000,
+ 0xC0000,
+ 0x1000
+ },
+ {
+ IA32_MTRR_FIX4K_C8000,
+ 0xC8000,
+ 0x1000
+ },
+ {
+ IA32_MTRR_FIX4K_D0000,
+ 0xD0000,
+ 0x1000
+ },
+ {
+ IA32_MTRR_FIX4K_D8000,
+ 0xD8000,
+ 0x1000
+ },
+ {
+ IA32_MTRR_FIX4K_E0000,
+ 0xE0000,
+ 0x1000
+ },
+ {
+ IA32_MTRR_FIX4K_E8000,
+ 0xE8000,
+ 0x1000
+ },
+ {
+ IA32_MTRR_FIX4K_F0000,
+ 0xF0000,
+ 0x1000
+ },
+ {
+ IA32_MTRR_FIX4K_F8000,
+ 0xF8000,
+ 0x1000
+ },
+};
+
+MTRR_VALUE mFixedMtrrValueTable[] = {
+ {
+ 0,
+ FALSE
+ },
+ {
+ 0,
+ FALSE
+ },
+ {
+ 0,
+ FALSE
+ },
+ {
+ 0,
+ FALSE
+ },
+ {
+ 0,
+ FALSE
+ },
+ {
+ 0,
+ FALSE
+ },
+ {
+ 0,
+ FALSE
+ },
+ {
+ 0,
+ FALSE
+ },
+ {
+ 0,
+ FALSE
+ },
+ {
+ 0,
+ FALSE
+ },
+ {
+ 0,
+ FALSE
+ },
+};
+
+VARIABLE_MTRR mVariableMtrr[V_MAXIMUM_VARIABLE_MTRR_NUMBER];
+UINT32 mUsedMtrr;
+UINT8 mDefaultMemoryType = EFI_MEMORY_UC;
+extern UINT64 mValidMtrrAddressMask;
+extern UINT64 mValidMtrrBitsMask;
+extern BOOLEAN mVariableMtrrChanged;
+extern BOOLEAN mFixedMtrrChanged;
+
+/**
+ Disable Cache MTRR
+**/
+VOID
+PreMtrrChange (
+ VOID
+ )
+{
+ UINT64 TempQword;
+
+ EfiDisableCache ();
+ ///
+ /// Disable Cache MTRR
+ ///
+ TempQword = AsmReadMsr64 (CACHE_IA32_MTRR_DEF_TYPE);
+ TempQword = TempQword &~B_CACHE_MTRR_VALID &~B_CACHE_FIXED_MTRR_VALID;
+ AsmWriteMsr64 (CACHE_IA32_MTRR_DEF_TYPE, TempQword);
+
+ return;
+}
+
+/**
+ Enable Cache MTRR
+**/
+VOID
+PostMtrrChange (
+ VOID
+ )
+{
+ UINT64 TempQword;
+
+ TempQword = 0;
+ ///
+ /// Enable Cache MTRR
+ ///
+ TempQword = AsmReadMsr64 (CACHE_IA32_MTRR_DEF_TYPE);
+ AsmWriteMsr64 (CACHE_IA32_MTRR_DEF_TYPE, TempQword | B_CACHE_MTRR_VALID | B_CACHE_FIXED_MTRR_VALID);
+
+ EfiEnableCache ();
+ return;
+}
+
+/**
+ Calculate fixed MTRR
+
+ @param[in] MemoryCacheType - Cache type for this memory range
+ @param[in] Base - Memory range base address
+ @param[in] Length - Memory range length
+
+ @exception EFI_UNSUPPORTED - Fixed MTRR number not enough or not present
+ @retval EFI_SUCCESS - Fixed MTRR settings calculated successfully
+**/
+EFI_STATUS
+CalculateFixedMtrr (
+ IN UINT64 MemoryCacheType,
+ IN UINT64 *Base,
+ IN UINT64 *Length
+ )
+{
+ UINT32 MsrNum;
+ UINT32 ByteShift;
+ UINT64 TempQword;
+ UINT64 OrMask;
+ UINT64 ClearMask;
+
+ TempQword = 0;
+ OrMask = 0;
+ ClearMask = 0;
+
+ for (MsrNum = 0; MsrNum < V_FIXED_MTRR_NUMBER; MsrNum++) {
+ if ((*Base >= mFixedMtrrTable[MsrNum].BaseAddress) &&
+ (*Base < (mFixedMtrrTable[MsrNum].BaseAddress + 8 * mFixedMtrrTable[MsrNum].Length))
+ ) {
+ break;
+ }
+ }
+
+ if (MsrNum == V_FIXED_MTRR_NUMBER) {
+ return EFI_UNSUPPORTED;
+ }
+ ///
+ /// We found the fixed MTRR to be programmed
+ ///
+ for (ByteShift = 0; ByteShift < 8; ByteShift++) {
+ if (*Base == (mFixedMtrrTable[MsrNum].BaseAddress + ByteShift * mFixedMtrrTable[MsrNum].Length)) {
+ break;
+ }
+ }
+
+ if (ByteShift == 8) {
+ return EFI_UNSUPPORTED;
+ }
+
+ for (; ((ByteShift < 8) && (*Length >= mFixedMtrrTable[MsrNum].Length)); ByteShift++) {
+ OrMask |= LShiftU64 ((UINT64) MemoryCacheType, (UINT32) (ByteShift * 8));
+ ClearMask |= LShiftU64 ((UINT64) 0xFF, (UINT32) (ByteShift * 8));
+ *Length -= mFixedMtrrTable[MsrNum].Length;
+ *Base += mFixedMtrrTable[MsrNum].Length;
+ mFixedMtrrChanged = TRUE;
+ }
+
+ if (ByteShift < 8 && (*Length != 0)) {
+ return EFI_UNSUPPORTED;
+ }
+
+ TempQword = AsmReadMsr64 (mFixedMtrrTable[MsrNum].Msr) &~ClearMask | OrMask;
+ mFixedMtrrValueTable[MsrNum].MsrValue = TempQword;
+ mFixedMtrrValueTable[MsrNum].Changed = TRUE;
+ return EFI_SUCCESS;
+}
+
+/**
+ Program fixed MTRR
+**/
+VOID
+ProgramFixedMtrr (
+ VOID
+ )
+{
+ UINT32 MsrNum;
+ PreMtrrChange ();
+ for (MsrNum = 0; MsrNum < V_FIXED_MTRR_NUMBER; MsrNum++) {
+ if (mFixedMtrrValueTable[MsrNum].Changed) {
+ AsmWriteMsr64 (mFixedMtrrTable[MsrNum].Msr, mFixedMtrrValueTable[MsrNum].MsrValue);
+ mFixedMtrrValueTable[MsrNum].Changed = FALSE;
+ }
+ }
+
+ PostMtrrChange ();
+}
+
+/**
+ Get all information about memory cache registers
+
+ @retval EFI_SUCCESS - always success
+**/
+EFI_STATUS
+GetMemoryAttribute (
+ VOID
+ )
+{
+ UINTN Index;
+ UINT32 MsrNum;
+ UINT64 MsrValue;
+ UINT32 VariableMtrrLimit;
+
+ VariableMtrrLimit = (UINT32) (AsmReadMsr64 (IA32_MTRR_CAP) & B_IA32_MTRR_VARIABLE_SUPPORT);
+
+ ///
+ /// Get Default Mtrr Type
+ ///
+ MsrValue = AsmReadMsr64 (CACHE_IA32_MTRR_DEF_TYPE);
+ mDefaultMemoryType = (UINT8) MsrValue;
+
+ ///
+ /// Get Variable Mtrr
+ ///
+ ZeroMem (mVariableMtrr, sizeof (VARIABLE_MTRR) * V_MAXIMUM_VARIABLE_MTRR_NUMBER);
+ mUsedMtrr = 0;
+
+ for (MsrNum = CACHE_VARIABLE_MTRR_BASE, Index = 0;
+ ((MsrNum < (CACHE_VARIABLE_MTRR_BASE + VariableMtrrLimit * 2 - 1)) && (Index < V_MAXIMUM_VARIABLE_MTRR_NUMBER));
+ MsrNum += 2
+ ) {
+ if ((AsmReadMsr64 (MsrNum + 1) & B_CACHE_MTRR_VALID) != 0) {
+ mVariableMtrr[Index].Msr = MsrNum;
+ mVariableMtrr[Index].BaseAddress = (AsmReadMsr64 (MsrNum) & mValidMtrrAddressMask);
+ mVariableMtrr[Index].Length = ((~((AsmReadMsr64 (MsrNum + 1) & mValidMtrrAddressMask))) & mValidMtrrBitsMask) + 1;
+ mVariableMtrr[Index].Type = (AsmReadMsr64 (MsrNum) & 0x0ff);
+ mVariableMtrr[Index].Valid = TRUE;
+ mUsedMtrr++;
+ Index++;
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Check if different memory attribute range overlapping with each other
+
+ @param[in] Start - start of memory range that will be checking
+ @param[in] End - end of memory range address that will be checking
+
+ @retval TRUE if overlapping found
+ @retval FALSE if not found
+**/
+BOOLEAN
+CheckMemoryAttributeOverlap (
+ IN EFI_PHYSICAL_ADDRESS Start,
+ IN EFI_PHYSICAL_ADDRESS End
+ )
+{
+ UINT32 Index;
+
+ for (Index = 0; Index < V_MAXIMUM_VARIABLE_MTRR_NUMBER; Index++) {
+ if (mVariableMtrr[Index].Valid &&
+ !(
+ Start > (mVariableMtrr[Index].BaseAddress + mVariableMtrr[Index].Length - 1) ||
+ (End < mVariableMtrr[Index].BaseAddress)
+ )
+ ) {
+
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+/**
+ Combine current memory attribute range to existing memory attribute range
+
+ @param[in] Attributes - Cache type
+ @param[in] Base - Base address of memory range that will be combined into existing one.
+ @param[in] Length - Length of the memory range that will be combined into existing one.
+
+ @retval EFI_SUCCESS - Memory combined successfully
+ @retval EFI_ACCESS_DENIED - memory type that is not allowed to overlap
+**/
+EFI_STATUS
+CombineMemoryAttribute (
+ IN UINT64 Attributes,
+ IN UINT64 *Base,
+ IN UINT64 *Length
+ )
+{
+ UINT32 Index;
+ UINT64 CombineStart;
+ UINT64 CombineEnd;
+ UINT64 MtrrEnd;
+ UINT64 EndAddress;
+ BOOLEAN InvalidMTRRs[V_MAXIMUM_VARIABLE_MTRR_NUMBER];
+
+ EndAddress = *Base +*Length - 1;
+
+ for (Index = 0; Index < V_MAXIMUM_VARIABLE_MTRR_NUMBER; Index++) {
+ InvalidMTRRs[Index] = FALSE;
+ }
+
+ Index = 0;
+ while (Index < V_MAXIMUM_VARIABLE_MTRR_NUMBER) {
+ MtrrEnd = mVariableMtrr[Index].BaseAddress + mVariableMtrr[Index].Length - 1;
+
+ ///
+ /// The MTRR is marked invalid or the ranges are not intersected.
+ ///
+ if (InvalidMTRRs[Index] ||
+ !mVariableMtrr[Index].Valid ||
+ (*Base > (MtrrEnd) || (EndAddress < mVariableMtrr[Index].BaseAddress))
+ ) {
+ Index++;
+ continue;
+ }
+ ///
+ /// if the requested range contains MTRR range, invalidate this MTRR
+ ///
+ if (mVariableMtrr[Index].BaseAddress >= *Base && MtrrEnd <= EndAddress) {
+ InvalidMTRRs[Index] = TRUE;
+ Index++;
+ continue;
+ }
+
+ if (Attributes == mVariableMtrr[Index].Type) {
+ ///
+ /// if the Mtrr range contain the request range, return EFI_SUCCESS
+ ///
+ if (mVariableMtrr[Index].BaseAddress <= *Base && MtrrEnd >= EndAddress) {
+ *Length = 0;
+ return EFI_SUCCESS;
+ }
+ ///
+ /// invalid this MTRR, and program the combine range
+ ///
+ CombineStart = (*Base) < mVariableMtrr[Index].BaseAddress ? (*Base) : mVariableMtrr[Index].BaseAddress;
+ CombineEnd = EndAddress > MtrrEnd ? EndAddress : MtrrEnd;
+
+ ///
+ /// Record this MTRR as invalid
+ ///
+ InvalidMTRRs[Index] = TRUE;
+
+ ///
+ /// The range is modified, retry from the first MTRR
+ ///
+ if (*Base != CombineStart || *Length != CombineEnd - CombineStart + 1) {
+ Index = 0;
+ } else {
+ Index++;
+ }
+
+ *Base = CombineStart;
+ *Length = CombineEnd - CombineStart + 1;
+ EndAddress = CombineEnd;
+ continue;
+ }
+
+ if ((Attributes == CACHE_UNCACHEABLE) ||
+ (Attributes == CACHE_WRITETHROUGH && mVariableMtrr[Index].Type == CACHE_WRITEBACK) ||
+ (Attributes == CACHE_WRITEBACK && mVariableMtrr[Index].Type == CACHE_WRITETHROUGH) ||
+ (Attributes == CACHE_WRITETHROUGH && mVariableMtrr[Index].Type == CACHE_UNCACHEABLE) ||
+ (Attributes == CACHE_WRITEBACK && mVariableMtrr[Index].Type == CACHE_UNCACHEABLE)
+ ) {
+ Index++;
+ continue;
+ }
+ ///
+ /// Other type memory overlap is invalid
+ ///
+ return EFI_ACCESS_DENIED;
+ }
+ ///
+ /// Finally invalidate recorded MTRRs
+ ///
+ for (Index = 0; Index < V_MAXIMUM_VARIABLE_MTRR_NUMBER; Index++) {
+ if (InvalidMTRRs[Index]) {
+ InvariableMtrr (mVariableMtrr[Index].Msr, Index);
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Given the input, check if the number of MTRR is lesser
+ if positive or subtractive
+
+ @param[in] Input - Length of Memory to program MTRR
+ @param[in] MtrrNumber - return needed Mtrr number
+ @param[in] Direction - TRUE: do positive
+ FALSE: do subtractive
+
+ @retval EFI_SUCCESS - always return success
+**/
+EFI_STATUS
+GetDirection (
+ IN UINT64 Input,
+ IN UINTN *MtrrNumber,
+ IN BOOLEAN *Direction
+ )
+{
+ UINT64 TempQword;
+ UINT32 Positive;
+ UINT32 Subtractive;
+
+ TempQword = Input;
+ Positive = 0;
+ Subtractive = 0;
+
+ do {
+ TempQword -= Power2MaxMemory (TempQword);
+ Positive++;
+
+ } while (TempQword != 0);
+
+ TempQword = Power2MaxMemory (LShiftU64 (Input, 1)) - Input;
+ Subtractive++;
+ do {
+ TempQword -= Power2MaxMemory (TempQword);
+ Subtractive++;
+
+ } while (TempQword != 0);
+
+ if (Positive <= Subtractive) {
+ *Direction = TRUE;
+ *MtrrNumber = Positive;
+ } else {
+ *Direction = FALSE;
+ *MtrrNumber = Subtractive;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Calculate max memory of power 2
+
+ @param[in] MemoryLength - Memory length that will be calculated
+
+ @retval Max memory
+**/
+UINT64
+Power2MaxMemory (
+ IN UINT64 MemoryLength
+ )
+{
+ UINT64 Result;
+ UINT32 *ResultPointer;
+ UINT32 *MemoryLengthPointer;
+ MemoryLengthPointer = (UINT32 *) &MemoryLength;
+ ResultPointer = (UINT32 *) &Result;
+ Result = 0;
+ if (MemoryLengthPointer[1] != 0) {
+ ResultPointer[1] = GetPowerOfTwo32 (MemoryLengthPointer[1]);
+ } else {
+ ResultPointer[0] = GetPowerOfTwo32 (MemoryLengthPointer[0]);
+ }
+
+ return Result;
+}
+
+/**
+ Clear MTRR
+
+ @param[in] MtrrNumber - MTRR register that will be cleared
+ @param[in] Index - index of MTRR register
+
+ @retval EFI_SUCCESS - always return success
+**/
+EFI_STATUS
+InvariableMtrr (
+ IN UINTN MtrrNumber,
+ IN UINTN Index
+ )
+{
+ PreMtrrChange ();
+ mVariableMtrr[Index].Valid = FALSE;
+ AsmWriteMsr64 ((UINT32) MtrrNumber, 0);
+ AsmWriteMsr64 ((UINT32) (MtrrNumber + 1), 0);
+ mUsedMtrr--;
+ PostMtrrChange ();
+ return EFI_SUCCESS;
+}
+
+/**
+ Programm VARIABLE MTRR
+
+ @param[in] MtrrNumber - Variable MTRR register
+ @param[in] BaseAddress - Memory base address
+ @param[in] Length - Memory length
+ @param[in] MemoryCacheType - Cache type
+
+ @retval EFI_SUCCESS - always return success
+**/
+EFI_STATUS
+ProgramVariableMtrr (
+ IN UINTN MtrrNumber,
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,
+ IN UINT64 Length,
+ IN UINT64 MemoryCacheType
+ )
+{
+ UINT64 TempQword;
+
+ PreMtrrChange ();
+
+ ///
+ /// MTRR Physical Base
+ ///
+ TempQword = (BaseAddress & mValidMtrrAddressMask) | MemoryCacheType;
+ AsmWriteMsr64 ((UINT32) MtrrNumber, TempQword);
+
+ ///
+ /// MTRR Physical Mask
+ ///
+ TempQword = ~(Length - 1);
+ AsmWriteMsr64 ((UINT32) (MtrrNumber + 1), (TempQword & mValidMtrrAddressMask) | B_CACHE_MTRR_VALID);
+
+ ///
+ /// Variable MTRR is updated
+ ///
+ mVariableMtrrChanged = TRUE;
+
+ PostMtrrChange ();
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Get GCD Mem Space type from Mtrr Type
+
+ @param[in] MtrrAttributes - Mtrr type
+
+ @retval GCD Mem Space typed (64-bit)
+ @retval EFI_MEMORY_UC - input MTRR type is Uncacheable
+ @retval EFI_MEMORY_WC - input MTRR type is Write Combining
+ @retval EFI_MEMORY_WT - input MTRR type is Write-through
+ @retval EFI_MEMORY_WP - input MTRR type is Write-protected
+ @retval EFI_MEMORY_WB - input MTRR type is Write Back
+**/
+UINT64
+GetMemorySpaceAttributeFromMtrrType (
+ IN UINT8 MtrrAttributes
+ )
+{
+ switch (MtrrAttributes) {
+ case CACHE_UNCACHEABLE:
+ return EFI_MEMORY_UC;
+
+ case CACHE_WRITECOMBINING:
+ return EFI_MEMORY_WC;
+
+ case CACHE_WRITETHROUGH:
+ return EFI_MEMORY_WT;
+
+ case CACHE_WRITEPROTECTED:
+ return EFI_MEMORY_WP;
+
+ case CACHE_WRITEBACK:
+ return EFI_MEMORY_WB;
+
+ default:
+ return 0;
+ }
+}
+
+/**
+ Refresh the GCD Memory Space Attributes according to MTRRs
+
+ @retval EFI_STATUS - status returned from each sub-routine
+**/
+EFI_STATUS
+RefreshGcdMemoryAttributes (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ UINTN Index;
+ UINTN SubIndex;
+ UINT64 RegValue;
+ EFI_PHYSICAL_ADDRESS BaseAddress;
+ UINT64 Length;
+ UINT64 Attributes;
+ UINT64 CurrentAttributes;
+ UINT8 MtrrType;
+ UINTN NumberOfDescriptors;
+ EFI_GCD_MEMORY_SPACE_DESCRIPTOR *MemorySpaceMap;
+ UINT64 DefaultAttributes;
+
+ MemorySpaceMap = NULL;
+
+ Status = GetMemoryAttribute ();
+ if (EFI_ERROR (Status)) {
+ goto Done;
+ }
+
+ Status = gDS->GetMemorySpaceMap (
+ &NumberOfDescriptors,
+ &MemorySpaceMap
+ );
+ if (EFI_ERROR (Status)) {
+ goto Done;
+ }
+
+ DefaultAttributes = GetMemorySpaceAttributeFromMtrrType (mDefaultMemoryType);
+
+ ///
+ /// Set default attributes to all spaces.
+ ///
+ for (Index = 0; Index < NumberOfDescriptors; Index++) {
+ if (MemorySpaceMap[Index].GcdMemoryType == EfiGcdMemoryTypeNonExistent) {
+ continue;
+ }
+
+ gDS->SetMemorySpaceAttributes (
+ MemorySpaceMap[Index].BaseAddress,
+ MemorySpaceMap[Index].Length,
+ (MemorySpaceMap[Index].Attributes &~EFI_MEMORY_CACHETYPE_MASK) |
+ (MemorySpaceMap[Index].Capabilities & DefaultAttributes)
+ );
+ }
+ ///
+ /// Go for variable MTRRs, WB first, Other types second
+ ///
+ for (Index = 0; Index < 6; Index++) {
+ if (mVariableMtrr[Index].Valid && mVariableMtrr[Index].Type == CACHE_WRITEBACK) {
+ SetGcdMemorySpaceAttributes (
+ MemorySpaceMap,
+ NumberOfDescriptors,
+ mVariableMtrr[Index].BaseAddress,
+ mVariableMtrr[Index].Length,
+ EFI_MEMORY_WB
+ );
+ }
+ }
+
+ for (Index = 0; Index < 6; Index++) {
+ if (mVariableMtrr[Index].Valid && mVariableMtrr[Index].Type != CACHE_WRITEBACK) {
+ Attributes = GetMemorySpaceAttributeFromMtrrType ((UINT8) mVariableMtrr[Index].Type);
+ SetGcdMemorySpaceAttributes (
+ MemorySpaceMap,
+ NumberOfDescriptors,
+ mVariableMtrr[Index].BaseAddress,
+ mVariableMtrr[Index].Length,
+ Attributes
+ );
+ }
+ }
+ ///
+ /// Go for fixed MTRRs
+ ///
+ Attributes = 0;
+ BaseAddress = 0;
+ Length = 0;
+ for (Index = 0; Index < V_FIXED_MTRR_NUMBER; Index++) {
+ RegValue = AsmReadMsr64 (mFixedMtrrTable[Index].Msr);
+ for (SubIndex = 0; SubIndex < 8; SubIndex++) {
+ MtrrType = (UINT8) RShiftU64 (RegValue, SubIndex * 8);
+ CurrentAttributes = GetMemorySpaceAttributeFromMtrrType (MtrrType);
+ if (Length == 0) {
+ Attributes = CurrentAttributes;
+ } else {
+ if (CurrentAttributes != Attributes) {
+ SetGcdMemorySpaceAttributes (
+ MemorySpaceMap,
+ NumberOfDescriptors,
+ BaseAddress,
+ Length,
+ Attributes
+ );
+ BaseAddress = mFixedMtrrTable[Index].BaseAddress + mFixedMtrrTable[Index].Length * SubIndex;
+ Length = 0;
+ Attributes = CurrentAttributes;
+ }
+ }
+
+ Length += mFixedMtrrTable[Index].Length;
+ }
+ }
+ ///
+ /// handle the last region
+ ///
+ SetGcdMemorySpaceAttributes (
+ MemorySpaceMap,
+ NumberOfDescriptors,
+ BaseAddress,
+ Length,
+ Attributes
+ );
+
+Done:
+ if (MemorySpaceMap != NULL) {
+ FreePool (MemorySpaceMap);
+ }
+
+ return Status;
+}
+
+/**
+ Search into the Gcd Memory Space for descriptors (from StartIndex
+ to EndIndex) that contains the memory range specified by BaseAddress
+ and Length.
+
+ @param[in] MemorySpaceMap - Gcd Memory Space Map as array
+ @param[in] NumberOfDescriptors - Number of descriptors in map
+ @param[in] BaseAddress - BaseAddress for the requested range
+ @param[in] Length - Length for the requested range
+ @param[in] StartIndex - Start index into the Gcd Memory Space Map
+ @param[in] EndIndex - End index into the Gcd Memory Space Map
+
+ @retval EFI_SUCCESS - Search successfully
+ @retval EFI_NOT_FOUND - The requested descriptors not exist
+**/
+EFI_STATUS
+SearchGcdMemorySpaces (
+ IN EFI_GCD_MEMORY_SPACE_DESCRIPTOR *MemorySpaceMap,
+ IN UINTN NumberOfDescriptors,
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,
+ IN UINT64 Length,
+ OUT UINTN *StartIndex,
+ OUT UINTN *EndIndex
+ )
+{
+ UINTN Index;
+
+ *StartIndex = 0;
+ *EndIndex = 0;
+ for (Index = 0; Index < NumberOfDescriptors; Index++) {
+ if (BaseAddress >= MemorySpaceMap[Index].BaseAddress &&
+ BaseAddress < MemorySpaceMap[Index].BaseAddress + MemorySpaceMap[Index].Length
+ ) {
+ *StartIndex = Index;
+ }
+
+ if (BaseAddress + Length - 1 >= MemorySpaceMap[Index].BaseAddress &&
+ BaseAddress + Length - 1 < MemorySpaceMap[Index].BaseAddress + MemorySpaceMap[Index].Length
+ ) {
+ *EndIndex = Index;
+ return EFI_SUCCESS;
+ }
+ }
+
+ return EFI_NOT_FOUND;
+}
+
+/**
+ Set the attributes for a specified range in Gcd Memory Space Map.
+
+ @param[in] MemorySpaceMap - Gcd Memory Space Map as array
+ @param[in] NumberOfDescriptors - Number of descriptors in map
+ @param[in] BaseAddress - BaseAddress for the range
+ @param[in] Length - Length for the range
+ @param[in] Attributes - Attributes to set
+
+ @retval EFI_SUCCESS - Set successfully
+ @retval EFI_NOT_FOUND - The specified range does not exist in Gcd Memory Space
+**/
+EFI_STATUS
+SetGcdMemorySpaceAttributes (
+ IN EFI_GCD_MEMORY_SPACE_DESCRIPTOR *MemorySpaceMap,
+ IN UINTN NumberOfDescriptors,
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,
+ IN UINT64 Length,
+ IN UINT64 Attributes
+ )
+{
+ EFI_STATUS Status;
+ UINTN Index;
+ UINTN StartIndex;
+ UINTN EndIndex;
+ EFI_PHYSICAL_ADDRESS RegionStart;
+ UINT64 RegionLength;
+
+ Status = SearchGcdMemorySpaces (
+ MemorySpaceMap,
+ NumberOfDescriptors,
+ BaseAddress,
+ Length,
+ &StartIndex,
+ &EndIndex
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ for (Index = StartIndex; Index <= EndIndex; Index++) {
+ if (MemorySpaceMap[Index].GcdMemoryType == EfiGcdMemoryTypeNonExistent) {
+ continue;
+ }
+
+ if (BaseAddress >= MemorySpaceMap[Index].BaseAddress) {
+ RegionStart = BaseAddress;
+ } else {
+ RegionStart = MemorySpaceMap[Index].BaseAddress;
+ }
+
+ if (BaseAddress + Length - 1 < MemorySpaceMap[Index].BaseAddress + MemorySpaceMap[Index].Length) {
+ RegionLength = BaseAddress + Length - RegionStart;
+ } else {
+ RegionLength = MemorySpaceMap[Index].BaseAddress + MemorySpaceMap[Index].Length - RegionStart;
+ }
+
+ gDS->SetMemorySpaceAttributes (
+ RegionStart,
+ RegionLength,
+ (MemorySpaceMap[Index].Attributes &~EFI_MEMORY_CACHETYPE_MASK) | (MemorySpaceMap[Index].Capabilities & Attributes)
+ );
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/Haswell/CpuInit/Dxe/MemoryAttribute.h b/ReferenceCode/Haswell/CpuInit/Dxe/MemoryAttribute.h
new file mode 100644
index 0000000..8ce2a74
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Dxe/MemoryAttribute.h
@@ -0,0 +1,259 @@
+/** @file
+ Header file for CPU MTRR programming driver
+
+Revision History:
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _EFI_MEMORY_ATTRIB_H
+#define _EFI_MEMORY_ATTRIB_H
+
+extern UINT32 mUsedMtrr;
+
+typedef struct {
+ UINT32 Msr;
+ UINT32 BaseAddress;
+ UINT32 Length;
+} FIXED_MTRR;
+
+typedef struct {
+ UINT64 MsrValue;
+ BOOLEAN Changed;
+} MTRR_VALUE;
+
+typedef struct {
+ UINT64 BaseAddress;
+ UINT64 Length;
+ UINT64 Type;
+ UINT32 Msr;
+ BOOLEAN Valid;
+} VARIABLE_MTRR;
+
+#define EFI_MEMORY_CACHETYPE_MASK (EFI_MEMORY_UC | EFI_MEMORY_WC | EFI_MEMORY_WT | EFI_MEMORY_WB | EFI_MEMORY_UCE)
+
+/**
+ Calculate fixed MTRR
+
+ @param[in] MemoryCacheType - Cache type for this memory range
+ @param[in] Base - Memory range base address
+ @param[in] Length - Memory range length
+
+ @exception EFI_UNSUPPORTED - Fixed MTRR number not enough or not present
+ @retval EFI_SUCCESS - Fixed MTRR settings calculated successfully
+**/
+EFI_STATUS
+CalculateFixedMtrr (
+ IN UINT64 MemoryCacheType,
+ IN UINT64 *Base,
+ IN UINT64 *Length
+ );
+
+/**
+ Disable Cache MTRR
+**/
+VOID
+PreMtrrChange (
+ VOID
+ );
+/**
+ Enable Cache MTRR
+**/
+VOID
+PostMtrrChange (
+ VOID
+ );
+
+/**
+ Program fixed MTRR
+**/
+VOID
+ProgramFixedMtrr (
+ VOID
+ );
+
+/**
+ Get all information about memory cache registers
+
+ @retval EFI_SUCCESS - always success
+**/
+EFI_STATUS
+GetMemoryAttribute (
+ VOID
+ );
+
+/**
+ Check if different memory attribute range overlapping with each other
+
+ @param[in] Start - start of memory range that will be checking
+ @param[in] End - end of memory range address that will be checking
+
+ @retval TRUE if overlapping found
+ @retval FALSE if not found
+**/
+BOOLEAN
+CheckMemoryAttributeOverlap (
+ IN EFI_PHYSICAL_ADDRESS Start,
+ IN EFI_PHYSICAL_ADDRESS End
+ );
+
+/**
+ Combine current memory attribute range to existing memory attribute range
+
+ @param[in] Attribute - Cache type
+ @param[in] Base - Base address of memory range that will be combined into existing one.
+ @param[in] Length - Length of the memory range that will be combined into existing one.
+
+ @retval EFI_SUCCESS - Memory combined successfully
+ @retval EFI_ACCESS_DENIED - memory type that is not allowed to overlap
+**/
+EFI_STATUS
+CombineMemoryAttribute (
+ IN UINT64 Attribute,
+ IN UINT64 *Base,
+ IN UINT64 *Length
+ );
+
+/**
+ Given the input, check if the number of MTRR is lesser
+ if positive or subtractive
+
+ @param[in] Input - Length of Memory to program MTRR
+ @param[in] MtrrNumber - return needed Mtrr number
+ @param[in] Direction - TRUE: do positive
+ FALSE: do subtractive
+
+ @retval EFI_SUCCESS - always return success
+**/
+EFI_STATUS
+GetDirection (
+ IN UINT64 Input,
+ IN UINTN *MtrrNumber,
+ IN BOOLEAN *Direction
+ );
+
+/**
+ Calculate max memory of power 2
+
+ @param[in] MemoryLength - Memory length that will be calculated
+
+ @retval Max memory
+**/
+UINT64
+Power2MaxMemory (
+ IN UINT64 MemoryLength
+ );
+
+/**
+ Clear MTRR
+
+ @param[in] MtrrNumber - MTRR register that will be cleared
+ @param[in] Index - index of MTRR register
+
+ @retval EFI_SUCCESS - always return success
+**/
+EFI_STATUS
+InvariableMtrr (
+ IN UINTN MtrrNumber,
+ IN UINTN Index
+ );
+
+/**
+ Programm VARIABLE MTRR
+
+ @param[in] MtrrNumber - Variable MTRR register
+ @param[in] BaseAddress - Memory base address
+ @param[in] Length - Memory length
+ @param[in] MemoryCacheType - Cache type
+
+ @retval EFI_SUCCESS - always return success
+**/
+EFI_STATUS
+ProgramVariableMtrr (
+ IN UINTN MtrrNumber,
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,
+ IN UINT64 Length,
+ IN UINT64 MemoryCacheType
+ );
+
+/**
+ Get GCD Mem Space type from Mtrr Type
+
+ @param[in] MtrrAttribute - Mtrr type
+
+ @retval GCD Mem Space typed (64-bit)
+**/
+UINT64
+GetMemorySpaceAttributeFromMtrrType (
+ IN UINT8 MtrrAttribute
+ );
+
+/**
+ Refresh the GCD Memory Space Attributes according to MTRRs
+
+ @retval EFI_STATUS - status returned from each sub-routine
+**/
+EFI_STATUS
+RefreshGcdMemoryAttributes (
+ VOID
+ );
+
+/**
+ Search into the Gcd Memory Space for descriptors (from StartIndex
+ to EndIndex) that contains the memory range specified by BaseAddress
+ and Length.
+
+ @param[in] MemorySpaceMap - Gcd Memory Space Map as array
+ @param[in] NumberOfDescriptors - Number of descriptors in map
+ @param[in] BaseAddress - BaseAddress for the requested range
+ @param[in] Length - Length for the requested range
+ @param[in] StartIndex - Start index into the Gcd Memory Space Map
+ @param[in] EndIndex - End index into the Gcd Memory Space Map
+
+ @retval EFI_SUCCESS - Search successfully
+ @retval EFI_NOT_FOUND - The requested descriptors not exist
+**/
+EFI_STATUS
+SearchGcdMemorySpaces (
+ IN EFI_GCD_MEMORY_SPACE_DESCRIPTOR *MemorySpaceMap,
+ IN UINTN NumberOfDescriptors,
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,
+ IN UINT64 Length,
+ OUT UINTN *StartIndex,
+ OUT UINTN *EndIndex
+ );
+
+/**
+ Set the attributes for a specified range in Gcd Memory Space Map.
+
+ @param[in] MemorySpaceMap - Gcd Memory Space Map as array
+ @param[in] NumberOfDescriptors - Number of descriptors in map
+ @param[in] BaseAddress - BaseAddress for the range
+ @param[in] Length - Length for the range
+ @param[in] Attributes - Attributes to set
+
+ @retval EFI_SUCCESS - Set successfully
+ @retval EFI_NOT_FOUND - The specified range does not exist in Gcd Memory Space
+**/
+EFI_STATUS
+SetGcdMemorySpaceAttributes (
+ IN EFI_GCD_MEMORY_SPACE_DESCRIPTOR *MemorySpaceMap,
+ IN UINTN NumberOfDescriptors,
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,
+ IN UINT64 Length,
+ IN UINT64 Attributes
+ );
+#endif
diff --git a/ReferenceCode/Haswell/CpuInit/Dxe/Microcode.c b/ReferenceCode/Haswell/CpuInit/Dxe/Microcode.c
new file mode 100644
index 0000000..3f54a7d
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Dxe/Microcode.c
@@ -0,0 +1,547 @@
+/** @file
+ CPU Microcode update driver
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "CpuInitDxe.h"
+#include "ProcessorData.h"
+#include "MpCommon.h"
+#include "MpService.h"
+#endif
+
+extern DXE_CPU_PLATFORM_POLICY_PROTOCOL *mPlatformCpu;
+
+///
+/// static type so this variable only can be accessed in this file
+///
+static UINT32 mMcuFirstLoadDone = FALSE;
+UINT32 mMcuLoadCount;
+
+///
+/// Array of pointers which each points to 1 microcode update binary (in memory)
+///
+EFI_CPU_MICROCODE_HEADER **mMicrocodePointerBuffer;
+
+///
+/// Function declarations
+///
+EFI_STATUS
+FindLoadMicrocode (
+ IN UINT32 Cpuid,
+ IN EFI_CPU_MICROCODE_HEADER **MicrocodePointerBuffer,
+ IN OUT UINT32 *Revision
+ );
+
+/**
+ To indicate the first microcode load is done
+**/
+VOID
+McuFirstLoadDone (
+ VOID
+ )
+{
+ mMcuFirstLoadDone = TRUE;
+}
+
+/**
+ Wait till all primary threads done the microcode load
+**/
+VOID
+WaitForPrimaryThreadMcuUpdate (
+ VOID
+ )
+{
+ UINTN CoreNumber;
+ CoreNumber = RShiftU64 (AsmReadMsr64 (MSR_CORE_THREAD_COUNT), 16) & 0xffff;
+ if (IsSecondaryThread ()) {
+ while (mMcuLoadCount < CoreNumber) {
+ CpuPause ();
+ }
+ }
+}
+
+/**
+ This function checks the MCU revision to decide if BIOS needs to load
+ microcode.
+
+ @param[in] MicrocodePointer - Microcode in memory
+ @param[in] Revision - Current CPU microcode revision
+
+ @retval EFI_SUCCESS - BIOS needs to load microcode
+ @retval EFI_ABORTED - Don't need to update microcode
+**/
+EFI_STATUS
+CheckMcuRevision (
+ IN EFI_CPU_MICROCODE_HEADER *MicrocodePointer,
+ IN UINT32 *Revision
+ )
+{
+ EFI_STATUS Status;
+ Status = EFI_ABORTED;
+
+ if (mMcuFirstLoadDone) {
+ if (MicrocodePointer->UpdateRevision & 0x80000000 ||
+ (MicrocodePointer->UpdateRevision > 0 && MicrocodePointer->UpdateRevision > *Revision)
+ ) {
+ Status = EFI_SUCCESS;
+ }
+ } else {
+ if (*Revision == 0) {
+ Status = EFI_SUCCESS;
+ }
+ }
+
+ return Status;
+}
+
+/**
+ This will locate a processor microcode and if it finds a newer revision, it will
+ load it to the processor.
+
+ @param[in] MicrocodePointerBuffer - The Array of pointers which each points to 1 microcode update binary (in memory)
+ @param[in] FailedRevision - The microcode revision that fails to be loaded
+
+ @retval EFI_SUCCESS - A new microcode update is loaded
+ @retval Other - Due to some reason, no new microcode update is loaded
+**/
+EFI_STATUS
+InitializeMicrocode (
+ IN EFI_CPU_MICROCODE_HEADER **MicrocodePointerBuffer,
+ OUT UINT32 *FailedRevision
+ )
+{
+ EFI_STATUS Status;
+ EFI_CPUID_REGISTER Cpuid;
+ UINT32 UcodeRevision;
+
+ AsmCpuid (
+ CPUID_VERSION_INFO,
+ &Cpuid.RegEax,
+ &Cpuid.RegEbx,
+ &Cpuid.RegEcx,
+ &Cpuid.RegEdx
+ );
+
+ WaitForPrimaryThreadMcuUpdate ();
+ UcodeRevision = GetCpuUcodeRevision ();
+ Status = FindLoadMicrocode (
+ Cpuid.RegEax,
+ MicrocodePointerBuffer,
+ &UcodeRevision
+ );
+ *FailedRevision = UcodeRevision;
+
+ InterlockedIncrement (&mMcuLoadCount);
+
+ return Status;
+}
+
+/**
+ This will load the microcode to the processors.
+
+ @param[in] MicrocodeEntryPoint - The microcode update pointer
+ @param[in] Revision - The current (before load this microcode update) microcode revision
+
+ @retval EFI_SUCCESS - Microcode loaded
+ @retval EFI_LOAD_ERROR - Microcode not loaded
+**/
+EFI_STATUS
+LoadMicrocode (
+ IN EFI_CPU_MICROCODE_HEADER *MicrocodeEntryPoint,
+ IN UINT32 *Revision
+ )
+{
+ ///
+ /// Load the Processor Microcode
+ ///
+ AsmWriteMsr64 (
+ MSR_IA32_BIOS_UPDT_TRIG,
+ (UINT64) ((UINTN) MicrocodeEntryPoint + sizeof (EFI_CPU_MICROCODE_HEADER))
+ );
+
+ ///
+ /// Verify that the microcode has been loaded
+ ///
+ if (GetCpuUcodeRevision () == *Revision) {
+ return EFI_LOAD_ERROR;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Verify the DWORD type checksum
+
+ @param[in] ChecksumAddr - The start address to be checksumed
+ @param[in] ChecksumLen - The length of data that will be checksumed
+
+ @retval EFI_SUCCESS - Checksum correct
+ @retval EFI_CRC_ERROR - Checksum incorrect
+**/
+EFI_STATUS
+Checksum32Verify (
+ IN UINT32 *ChecksumAddr,
+ IN UINT32 ChecksumLen
+ )
+{
+ UINT32 Checksum;
+ UINT32 Index;
+
+ Checksum = 0;
+
+ for (Index = 0; Index < ChecksumLen; Index++) {
+ Checksum += ChecksumAddr[Index];
+ }
+
+ return (Checksum == 0) ? EFI_SUCCESS : EFI_CRC_ERROR;
+}
+
+/**
+ Check if this microcode is correct one for processor
+
+ @param[in] Cpuid - processor CPUID
+ @param[in] MicrocodeEntryPoint - entry point of microcode
+ @param[in] Revision - revision of microcode
+
+ @retval CorrectMicrocode if this microcode is correct
+**/
+BOOLEAN
+CheckMicrocode (
+ IN UINTN Cpuid,
+ IN EFI_CPU_MICROCODE_HEADER *MicrocodeEntryPoint,
+ IN UINT32 *Revision
+ )
+{
+ EFI_STATUS Status;
+ UINT8 ExtendedIndex;
+ UINT8 MsrPlatform;
+ UINT32 ExtendedTableLength;
+ UINT32 ExtendedTableCount;
+ BOOLEAN CorrectMicrocode;
+ EFI_CPU_MICROCODE_EXTENDED_TABLE *ExtendedTable;
+ EFI_CPU_MICROCODE_EXTENDED_TABLE_HEADER *ExtendedTableHeader;
+
+ Status = EFI_NOT_FOUND;
+ ExtendedTableLength = 0;
+ CorrectMicrocode = FALSE;
+
+ ///
+ /// The index of platform information resides in bits 50:52 of MSR IA32_PLATFORM_ID
+ ///
+ MsrPlatform = (UINT8) (RShiftU64 (AsmReadMsr64 (MSR_IA32_PLATFORM_ID), 50) & 0x07);
+
+ ///
+ /// Check if the microcode is for the Cpu and the version is newer
+ /// and the update can be processed on the platform
+ ///
+ if ((MicrocodeEntryPoint->HeaderVersion == 0x00000001) &&
+ !EFI_ERROR (CheckMcuRevision (MicrocodeEntryPoint, Revision))
+ ) {
+ if ((MicrocodeEntryPoint->ProcessorId == Cpuid) && (MicrocodeEntryPoint->ProcessorFlags & (1 << MsrPlatform))) {
+ if (MicrocodeEntryPoint->DataSize == 0) {
+ Status = Checksum32Verify ((UINT32 *) MicrocodeEntryPoint, 2048 / sizeof (UINT32));
+ } else {
+ Status = Checksum32Verify (
+ (UINT32 *) MicrocodeEntryPoint,
+ (MicrocodeEntryPoint->DataSize + sizeof (EFI_CPU_MICROCODE_HEADER)) / sizeof (UINT32)
+ );
+ }
+
+ if (!EFI_ERROR (Status)) {
+ CorrectMicrocode = TRUE;
+ }
+ } else if ((MicrocodeEntryPoint->DataSize != 0)) {
+ ///
+ /// Check the Extended Signature if the entended signature exist
+ /// Only the data size != 0 the extended signature may exist
+ ///
+ ExtendedTableLength = MicrocodeEntryPoint->TotalSize - (MicrocodeEntryPoint->DataSize + sizeof (EFI_CPU_MICROCODE_HEADER));
+ if (ExtendedTableLength != 0) {
+ ///
+ /// Extended Table exist, check if the CPU in support list
+ ///
+ ExtendedTableHeader = (EFI_CPU_MICROCODE_EXTENDED_TABLE_HEADER *) ((UINT8 *) (MicrocodeEntryPoint) + MicrocodeEntryPoint->DataSize + 48);
+ ///
+ /// Calulate Extended Checksum
+ ///
+ if ((ExtendedTableLength % 4) == 0) {
+ Status = Checksum32Verify ((UINT32 *) ExtendedTableHeader, ExtendedTableLength / sizeof (UINT32));
+ if (!EFI_ERROR (Status)) {
+ ///
+ /// Checksum correct
+ ///
+ ExtendedTableCount = ExtendedTableHeader->ExtendedSignatureCount;
+ ExtendedTable = (EFI_CPU_MICROCODE_EXTENDED_TABLE *) (ExtendedTableHeader + 1);
+ for (ExtendedIndex = 0; ExtendedIndex < ExtendedTableCount; ExtendedIndex++) {
+ ///
+ /// Verify Header
+ ///
+ if ((ExtendedTable->ProcessorSignature == Cpuid) && (ExtendedTable->ProcessorFlag & (1 << MsrPlatform))) {
+ Status = Checksum32Verify (
+ (UINT32 *) ExtendedTable,
+ sizeof (EFI_CPU_MICROCODE_EXTENDED_TABLE) / sizeof (UINT32)
+ );
+ if (!EFI_ERROR (Status)) {
+ ///
+ /// Find one
+ ///
+ CorrectMicrocode = TRUE;
+ break;
+ }
+ }
+
+ ExtendedTable++;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return CorrectMicrocode;
+}
+
+/**
+ Find microcode data
+
+ @param[in] Cpuid - processor CPUID
+ @param[in] MicrocodePointerBuffer - the pointer for microcode buffer
+ @param[in] Revision - revision of microcode
+
+ @retval The pointer of microcode header
+**/
+EFI_CPU_MICROCODE_HEADER *
+FindMicrocode (
+ IN UINTN Cpuid,
+ IN EFI_CPU_MICROCODE_HEADER **MicrocodePointerBuffer,
+ IN UINT32 *Revision
+ )
+{
+ EFI_STATUS Status;
+ EFI_CPU_MICROCODE_HEADER *MicrocodeEntryPoint;
+ UINT8 Index;
+ BOOLEAN CorrectMicrocode;
+
+ Status = EFI_NOT_FOUND;
+ MicrocodeEntryPoint = NULL;
+ CorrectMicrocode = FALSE;
+
+ Index = 0;
+ while (MicrocodePointerBuffer[Index] != NULL) {
+ MicrocodeEntryPoint = MicrocodePointerBuffer[Index];
+ CorrectMicrocode = CheckMicrocode (Cpuid, MicrocodeEntryPoint, Revision);
+
+ if (CorrectMicrocode) {
+ break;
+ }
+
+ Index++;
+ }
+
+ if (!CorrectMicrocode) {
+ MicrocodeEntryPoint = NULL;
+ }
+
+ return MicrocodeEntryPoint;
+}
+
+/**
+ This will locate a processor microcode and if it finds a newer revision, it will
+ load it to the processor.
+
+ @param[in] Cpuid - Data returned by cpuid instruction
+ @param[in] MicrocodePointerBuffer - The Array of pointers which each points to 1 microcode update binary (in memory)
+ @param[in] Revision - As input parameter, the current microcode revision;
+ as output parameter, the microcode revision after microcode update is loaded
+
+ @retval EFI_SUCCESS - A new microcode update is loaded
+ @retval Other - Due to some reason, no new microcode update is loaded
+**/
+EFI_STATUS
+FindLoadMicrocode (
+ IN UINT32 Cpuid,
+ IN EFI_CPU_MICROCODE_HEADER **MicrocodePointerBuffer,
+ IN OUT UINT32 *Revision
+ )
+{
+ EFI_STATUS Status;
+ EFI_CPU_MICROCODE_HEADER *MicrocodeEntryPoint;
+
+ Status = EFI_NOT_FOUND;
+
+ MicrocodeEntryPoint = FindMicrocode (
+ Cpuid,
+ MicrocodePointerBuffer,
+ Revision
+ );
+
+ if (MicrocodeEntryPoint != NULL) {
+ Status = LoadMicrocode (MicrocodeEntryPoint, Revision);
+ *Revision = MicrocodeEntryPoint->UpdateRevision;
+ }
+
+ return Status;
+}
+
+/**
+ Load all microcode updates to memory. Since in S3 resume boot path, CPUs should be
+ patched again, these microcode updates are copied to OS reserved memory.
+
+ @retval EFI_SUCCESS - All microcode updates are loaded to memory successfully
+ @retval EFI_OUT_OF_RESOURCES - Not enough memory to accomodate all the microcode updates
+**/
+EFI_STATUS
+LoadAllMicrocodeUpdates (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ EFI_CPU_MICROCODE_HEADER *MicrocodeEntryPoint;
+ EFI_CPU_MICROCODE_HEADER *MicrocodeBuffer;
+ UINTN MicrocodeNumber;
+ UINTN Index;
+ UINTN TotalSize[NUMBER_OF_MICROCODE_UPDATE + 1];
+ EFI_CPUID_REGISTER Cpuid;
+ UINT32 UcodeRevision;
+
+ AsmCpuid (
+ CPUID_VERSION_INFO,
+ &Cpuid.RegEax,
+ &Cpuid.RegEbx,
+ &Cpuid.RegEcx,
+ &Cpuid.RegEdx
+ );
+
+ UcodeRevision = 0;
+ MicrocodeNumber = 0;
+ Status = (gBS->AllocatePool)
+ (
+ EfiReservedMemoryType, sizeof (EFI_CPU_MICROCODE_HEADER *) * (NUMBER_OF_MICROCODE_UPDATE + 1), (VOID *)
+ (&mMicrocodePointerBuffer)
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ZeroMem (mMicrocodePointerBuffer, sizeof (EFI_CPU_MICROCODE_HEADER *) * (NUMBER_OF_MICROCODE_UPDATE + 1));
+
+ MicrocodeEntryPoint = NULL;
+ while (TRUE) {
+ if (MicrocodeNumber > NUMBER_OF_MICROCODE_UPDATE) {
+ DEBUG ((EFI_D_INFO, "CPU Too Many Microcode available > %d\n", (UINTN) NUMBER_OF_MICROCODE_UPDATE));
+ Status = EFI_SUCCESS;
+ break;
+ }
+ ///
+ /// Initialize it to 0
+ ///
+ TotalSize[MicrocodeNumber] = 0;
+ ///
+ /// Continue to try to find patch
+ ///
+ Status = mPlatformCpu->CpuConfig->RetrieveMicrocode (mPlatformCpu, (VOID *) &MicrocodeEntryPoint);
+
+ if (EFI_ERROR (Status)) {
+ if (Status == EFI_NOT_FOUND) {
+ Status = EFI_SUCCESS;
+ }
+ break;
+
+ } else {
+ if (!CheckMicrocode (Cpuid.RegEax, MicrocodeEntryPoint, &UcodeRevision)) {
+ continue;
+ }
+
+ if (MicrocodeEntryPoint->DataSize == 0) {
+ TotalSize[MicrocodeNumber] = 2048;
+ } else {
+ TotalSize[MicrocodeNumber] = MicrocodeEntryPoint->TotalSize;
+ }
+
+ Status = AllocateReservedMemoryBelow4G (
+ TotalSize[MicrocodeNumber],
+ &MicrocodeBuffer
+ );
+ if (EFI_ERROR (Status)) {
+ break;
+ }
+
+ CopyMem (MicrocodeBuffer, MicrocodeEntryPoint, TotalSize[MicrocodeNumber]);
+ mMicrocodePointerBuffer[MicrocodeNumber] = MicrocodeBuffer;
+ MicrocodeNumber++;
+ }
+ }
+
+ if (EFI_ERROR (Status)) {
+ Index = 0;
+ while ((Index <= NUMBER_OF_MICROCODE_UPDATE) && (mMicrocodePointerBuffer[Index] != NULL)) {
+ (gBS->FreePages)((EFI_PHYSICAL_ADDRESS) (UINTN) mMicrocodePointerBuffer[Index], EFI_SIZE_TO_PAGES (TotalSize[Index]));
+ mMicrocodePointerBuffer[Index] = NULL;
+ Index++;
+ }
+ }
+
+ return Status;
+}
+
+/**
+ Check if loading microcode update fails, if so, report proper status code
+
+ @param[in] CpuNumber - The CPU number
+ @param[in] Status - The return value of InitializeMicrocode()
+ @param[in] FailedRevision - The revision of the microcode update that failed to be loaded
+
+ @retval EFI_SUCCESS - The status is check and proper status code is reported
+**/
+EFI_STATUS
+CheckMicrocodeUpdate (
+ IN UINTN CpuNumber,
+ IN EFI_STATUS Status,
+ IN UINT32 FailedRevision
+ )
+{
+ EFI_STATUS_CODE_VALUE StatusCode;
+
+ if (!EFI_ERROR (Status)) {
+ return EFI_SUCCESS;
+ }
+ if (Status == EFI_LOAD_ERROR) {
+ StatusCode = EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_MICROCODE_UPDATE;
+ } else if (Status == EFI_NOT_FOUND) {
+ if (GetCpuUcodeRevision () != 0) {
+ ///
+ /// Some other driver (for example, SEC) already updated CPU microcode
+ ///
+ return EFI_SUCCESS;
+ }
+ StatusCode = EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_NO_MICROCODE_UPDATE;
+ } else {
+ return Status;
+ }
+ ///
+ /// ReportStatusCode UEFI service can't be called by AP currently, so call by BSP only
+ ///
+ if (CpuNumber == mMPSystemData->BSP) {
+ return ReportStatusCode (
+ EFI_ERROR_MINOR | EFI_ERROR_CODE,
+ StatusCode
+ );
+ } else {
+ return Status;
+ }
+}
diff --git a/ReferenceCode/Haswell/CpuInit/Dxe/MpCommon.c b/ReferenceCode/Haswell/CpuInit/Dxe/MpCommon.c
new file mode 100644
index 0000000..dd9a55e
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Dxe/MpCommon.c
@@ -0,0 +1,1186 @@
+/** @file
+ Code which support multi-processor
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "MpCommon.h"
+#include "CpuInitDxe.h"
+#include "Features.h"
+#include EFI_PROTOCOL_DEFINITION (ExitPmAuth)
+#endif
+
+extern MP_SYSTEM_DATA *mMPSystemData;
+
+extern EFI_PHYSICAL_ADDRESS mOriginalBuffer;
+extern EFI_PHYSICAL_ADDRESS mBackupBuffer;
+extern EFI_METRONOME_ARCH_PROTOCOL *mMetronome;
+extern DXE_CPU_PLATFORM_POLICY_PROTOCOL *mPlatformCpu;
+volatile UINTN mSwitchToLegacyRegionCount = 0;
+
+EFI_PHYSICAL_ADDRESS mLegacyRegion;
+//(AMI_CHG+)>
+#if (REQUEST_EBDA_SIZE != 0x1000)
+UINTN mEbdaOffset = 0;
+#endif
+//<(AMI_CHG+)
+
+/**
+ Check if X2APIC is enabled
+
+ @retval TRUE if enabled
+ @retval FALSE if not enabled
+**/
+BOOLEAN
+IsXapicEnabled (
+ VOID
+ )
+{
+ UINT64 MsrValue;
+
+ MsrValue = AsmReadMsr64 (MSR_IA32_APIC_BASE);
+ if (MsrValue & B_MSR_IA32_APIC_BASE_G_XAPIC) {
+ if (MsrValue & B_MSR_IA32_APIC_BASE_M_XAPIC) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+ } else {
+ return FALSE;
+ }
+}
+
+/**
+ Function to get APIC register from MSR or MMIO
+
+ @param[in] XapicEnabled - x2APIC enabled or not
+ @param[in] MsrIndex - MSR index of APIC register
+ @param[in] MemoryMappedIo - MMIO address for APIC register
+
+ @retval The value of APIC register
+**/
+UINT64
+ReadApicMsrOrMemory (
+ BOOLEAN XapicEnabled,
+ UINT32 MsrIndex,
+ UINT64 MemoryMappedIo
+ )
+{
+ UINT64 Value;
+
+ if (XapicEnabled) {
+ Value = AsmReadMsr64 (MsrIndex);
+ } else {
+ Value = (UINT64) *(volatile UINT32 *) (UINTN) MemoryMappedIo;
+ }
+
+ return Value;
+}
+
+/**
+ Function to write APIC register by MSR or MMIO
+
+ @param[in] XapicEnabled - x2APIC enabled or not
+ @param[in] MsrIndex - MSR index of APIC register
+ @param[in] MemoryMappedIo - MMIO address for APIC register
+ @param[in] Value - Value that will be written to APIC register
+**/
+VOID
+WriteApicMsrOrMemory (
+ BOOLEAN XapicEnabled,
+ UINT32 MsrIndex,
+ UINT64 MemoryMappedIo,
+ UINT64 Value
+ )
+{
+ if (XapicEnabled) {
+ AsmWriteMsr64 (MsrIndex, Value);
+ } else {
+ if (MsrIndex == EXT_XAPIC_ICR) {
+ *(volatile UINT32 *) (UINTN) (MemoryMappedIo - APIC_REGISTER_ICR_LOW_OFFSET + APIC_REGISTER_ICR_HIGH_OFFSET) = (UINT32) (Value >> 32);
+ }
+ *(volatile UINT32 *) (UINTN) MemoryMappedIo = (UINT32) Value;
+ }
+}
+
+/**
+ Send interrupt to CPU
+
+ @param[in] BroadcastMode - Interrupt broadcast mode
+ @param[in] ApicID - APIC ID for sending interrupt
+ @param[in] VectorNumber - Vector number
+ @param[in] DeliveryMode - Interrupt delivery mode
+ @param[in] TriggerMode - Interrupt trigger mode
+ @param[in] Assert - Interrupt pin polarity
+
+ @retval EFI_INVALID_PARAMETER - Input parameter not correct
+ @retval EFI_NOT_READY - There was a pending interrupt
+ @retval EFI_SUCCESS - Interrupt sent successfully
+**/
+EFI_STATUS
+SendInterrupt (
+ IN UINT32 BroadcastMode,
+ IN UINT32 ApicID,
+ IN UINT32 VectorNumber,
+ IN UINT32 DeliveryMode,
+ IN UINT32 TriggerMode,
+ IN BOOLEAN Assert
+ )
+{
+ UINT64 ApicBaseReg;
+ EFI_PHYSICAL_ADDRESS ApicBase;
+ UINT32 ICRLow;
+ UINT32 ICRHigh;
+ BOOLEAN XapicEnabled;
+
+ ///
+ /// Initialze ICR high dword, since P6 family processor needs
+ /// the destination field to be 0x0F when it is a broadcast
+ ///
+ ICRHigh = 0x0f000000;
+ ICRLow = VectorNumber | (DeliveryMode << 8);
+
+ if (TriggerMode == TRIGGER_MODE_LEVEL) {
+ ICRLow |= 0x8000;
+ }
+
+ if (Assert) {
+ ICRLow |= 0x4000;
+ }
+
+ XapicEnabled = IsXapicEnabled ();
+
+ switch (BroadcastMode) {
+ case BROADCAST_MODE_SPECIFY_CPU:
+ if (XapicEnabled) {
+ ICRHigh = (UINT32) ApicID;
+ } else {
+ ICRHigh = ApicID << 24;
+ }
+ break;
+
+ case BROADCAST_MODE_ALL_INCLUDING_SELF:
+ ICRLow |= 0x80000;
+ break;
+
+ case BROADCAST_MODE_ALL_EXCLUDING_SELF:
+ ICRLow |= 0xC0000;
+ break;
+
+ default:
+ return EFI_INVALID_PARAMETER;
+ }
+
+ ApicBaseReg = AsmReadMsr64 (MSR_IA32_APIC_BASE);
+ ApicBase = ApicBaseReg & 0xffffff000;
+
+ ///
+ /// According Nehalem BWG, if Extended XAPIC Mode is enabled,
+ /// legacy xAPIC is no longer working.
+ /// So, previous MMIO offset must be transferred to MSR offset R/W.
+ /// ----------------------------------------------------------------
+ /// MMIO Offset MSR Offset Register Name
+ /// ----------------------------------------------------------------
+ /// 300h-310h 830h Interrupt Command Register [63:0]
+ /// 831h [Reserved]
+ /// ----------------------------------------------------------------
+ ///
+ WriteApicMsrOrMemory (
+ XapicEnabled,
+ EXT_XAPIC_ICR,
+ ApicBase + APIC_REGISTER_ICR_LOW_OFFSET,
+ (((UINT64) ICRHigh << 32) | (UINT64) ICRLow)
+ );
+
+ gBS->Stall (10);
+
+ ICRLow = (UINT32) ReadApicMsrOrMemory (XapicEnabled, EXT_XAPIC_ICR, ApicBase + APIC_REGISTER_ICR_LOW_OFFSET);
+
+ if (ICRLow & BIT12) {
+ return EFI_NOT_READY;
+ }
+
+ gBS->Stall (100);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Check number of cores in the package.
+
+ @retval Number of cores in the package.
+**/
+UINT8
+GetCoreNumber (
+ VOID
+ )
+{
+ EFI_CPUID_REGISTER Cpuid;
+ AsmCpuidEx (
+ 4,
+ 0,
+ &Cpuid.RegEax,
+ NULL,
+ NULL,
+ NULL
+ );
+ return (UINT8)(RShiftU64 (Cpuid.RegEax, 26) & 0x3f) + 1;
+}
+
+/**
+ Get APIC ID of processor
+
+ @param[in] ApicBase - APIC base
+ @param[in] ApicVersion - APIC version
+
+ @retval APIC ID of processor
+**/
+UINT32
+GetApicID (
+ OUT EFI_PHYSICAL_ADDRESS *ApicBase OPTIONAL,
+ OUT UINT32 *ApicVersion OPTIONAL
+ )
+{
+ UINT64 ApicBaseReg;
+ UINT32 ApicID;
+ UINT32 LocalApicVersion;
+ UINT64 LocalApicBase;
+ UINTN MsrValue;
+ BOOLEAN XapicEnabled;
+
+ XapicEnabled = IsXapicEnabled ();
+
+ if (XapicEnabled) {
+ ///
+ /// According Nehalem BWG, if Extended XAPIC Mode
+ /// is enabled, legacy xAPIC is no longer working.
+ /// So, previous MMIO offset must be transfered
+ /// to MSR offset R/W.
+ /// MMIO Offset MSR Offset Register Name
+ /// 020h 802h EXT_XAPIC_LOGICAL_APIC_ID
+ /// 030h 803h EXT_XAPIC_VERSION
+ ///
+ MsrValue = (UINTN) AsmReadMsr64 (EXT_XAPIC_VERSION);
+ *ApicVersion = (UINT32) (MsrValue & 0xff);
+ *ApicBase = 0;
+
+ MsrValue = (UINTN) AsmReadMsr64 (EXT_XAPIC_LOGICAL_APIC_ID);
+ ApicID = (UINT32) MsrValue;
+ return ApicID;
+ }
+
+ ApicBaseReg = AsmReadMsr64 (MSR_IA32_APIC_BASE);
+ LocalApicBase = ApicBaseReg & 0xffffff000;
+ if (ApicBase) {
+ *ApicBase = LocalApicBase;
+ }
+
+ ///
+ /// if Apic is not enabled yet, enable it here
+ ///
+ if ((ApicBaseReg & 0x800) == 0) {
+ ApicBaseReg |= 0x800;
+ AsmWriteMsr64 (MSR_IA32_APIC_BASE, ApicBaseReg);
+ }
+
+ if (ApicVersion) {
+ LocalApicVersion = *(volatile UINT32 *) (UINTN) (LocalApicBase + APIC_REGISTER_APIC_VERSION_OFFSET);
+ *ApicVersion = LocalApicVersion & 0xff;
+ }
+
+ ApicID = *(volatile UINT32 *) (UINTN) (LocalApicBase + APIC_REGISTER_LOCAL_ID_OFFSET);
+ return (ApicID >> 24) & 0x0ff;
+}
+
+/**
+ Programs Local APIC registers.
+
+ @param[in] BSP - Is this BSP?
+**/
+VOID
+ProgramXApic (
+ BOOLEAN BSP
+ )
+{
+ UINT64 ApicBaseReg;
+ EFI_PHYSICAL_ADDRESS ApicBase;
+ UINT64 EntryValue;
+ BOOLEAN XapicEnabled;
+
+ ApicBaseReg = AsmReadMsr64 (MSR_IA32_APIC_BASE);
+ ApicBase = ApicBaseReg & 0xffffff000;
+
+ XapicEnabled = IsXapicEnabled ();
+
+ ///
+ /// Program the Spurious Vector entry if XAPIC is enabled
+ ///
+ EntryValue = ReadApicMsrOrMemory (XapicEnabled, EXT_XAPIC_SVR, ApicBase + APIC_REGISTER_SPURIOUS_VECTOR_OFFSET);
+ EntryValue &= 0xFFFFFD0F;
+ EntryValue |= 0x10F;
+ WriteApicMsrOrMemory (XapicEnabled, EXT_XAPIC_SVR, ApicBase + APIC_REGISTER_SPURIOUS_VECTOR_OFFSET, EntryValue);
+
+ ///
+ /// Double check if it is BSP
+ ///
+ if (!BSP) {
+ CpuDisableInterrupt ();
+ }
+
+ ///
+ /// Program the LINT0 vector entry as EntInt
+ ///
+ EntryValue = ReadApicMsrOrMemory (XapicEnabled, EXT_XAPIC_LVT_LINT0, ApicBase + APIC_REGISTER_LINT0_VECTOR_OFFSET);
+ if (BSP) {
+ EntryValue &= 0xFFFE00FF;
+ EntryValue |= 0x700;
+ } else {
+ EntryValue |= 0x10000;
+ ///
+ /// set bit 16 as mask for LINT0
+ ///
+ }
+
+ WriteApicMsrOrMemory (XapicEnabled, EXT_XAPIC_LVT_LINT0, ApicBase + APIC_REGISTER_LINT0_VECTOR_OFFSET, EntryValue);
+
+ ///
+ /// Program the LINT1 vector entry as NMI
+ ///
+ EntryValue = ReadApicMsrOrMemory (XapicEnabled, EXT_XAPIC_LVT_LINT1, ApicBase + APIC_REGISTER_LINT1_VECTOR_OFFSET);
+ EntryValue &= 0xFFFE00FF;
+ if (BSP) {
+ EntryValue |= 0x400;
+ } else {
+ EntryValue |= 0x10400;
+ }
+
+ WriteApicMsrOrMemory (XapicEnabled, EXT_XAPIC_LVT_LINT1, ApicBase + APIC_REGISTER_LINT1_VECTOR_OFFSET, EntryValue);
+
+}
+
+/**
+ Allocate a temporary memory under 1MB for MP Init to perform INIT-SIPI.
+ This buffer also provides memory for stack/data for MP running
+
+ @param[in] WakeUpBuffer - Return buffer location
+
+ @retval EFI_SUCCESS if ok to get a memory under 1MB for MP running.
+**/
+EFI_STATUS
+AllocateWakeUpBuffer (
+ OUT EFI_PHYSICAL_ADDRESS *WakeUpBuffer
+ )
+{
+ EFI_STATUS Status;
+
+ Status = EFI_SUCCESS;
+ for (*WakeUpBuffer = 0x58000; *WakeUpBuffer >= 0x2000; *WakeUpBuffer -= 0x1000) {
+ Status = (gBS->AllocatePages)(AllocateAddress, EfiReservedMemoryType, 1, WakeUpBuffer);
+ if (!EFI_ERROR (Status)) {
+ break;
+ }
+ }
+
+ return Status;
+}
+
+/**
+ Allocate Reserved Memory
+
+ @param[in] Size - Memory Size
+ @param[in] Alignment - Alignment size
+ @param[in] Pointer - return memory location
+
+ @retval EFI_SUCCESS - Allocate a reserved memory successfully
+**/
+EFI_STATUS
+AllocateAlignedReservedMemory (
+ IN UINTN Size,
+ IN UINTN Alignment,
+ OUT VOID **Pointer
+ )
+{
+ EFI_STATUS Status;
+ UINTN PointerValue;
+
+ Status = AllocateReservedMemoryBelow4G (
+ Size + Alignment - 1,
+ Pointer
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ PointerValue = (UINTN) *Pointer;
+ PointerValue = (PointerValue + Alignment - 1) / Alignment * Alignment;
+
+ *Pointer = (VOID *) PointerValue;
+ return EFI_SUCCESS;
+}
+
+/**
+ Fill in the CPU location information
+
+ @param[in] Location - CPU location information
+
+ @retval EFI_SUCCESS - always return success
+**/
+EFI_STATUS
+FillInCpuLocation (
+ IN CPU_PHYSICAL_LOCATION *Location
+ )
+{
+ UINT32 ApicId;
+ EFI_CPUID_REGISTER RegsInfo;
+ UINT32 LevelType;
+ UINT32 LevelBits;
+ UINT8 Shift;
+ UINT8 Bits;
+ UINT32 Mask;
+ BOOLEAN HyperThreadingEnabled;
+
+ AsmCpuid (CPUID_VERSION_INFO, &RegsInfo.RegEax, &RegsInfo.RegEbx, &RegsInfo.RegEcx, &RegsInfo.RegEdx);
+ ApicId = (RegsInfo.RegEbx >> 24);
+
+ AsmCpuid (CPUID_SIGNATURE, &RegsInfo.RegEax, &RegsInfo.RegEbx, &RegsInfo.RegEcx, &RegsInfo.RegEdx);
+ if (RegsInfo.RegEax >= CPUID_CORE_TOPOLOGY) {
+ LevelBits = 0;
+ LevelType = 0;
+ do {
+ AsmCpuidEx (
+ CPUID_CORE_TOPOLOGY,
+ LevelType,
+ &RegsInfo.RegEax,
+ &RegsInfo.RegEbx,
+ &RegsInfo.RegEcx,
+ &RegsInfo.RegEdx
+ );
+ LevelType = ((RegsInfo.RegEcx >> 8) & 0xFF);
+ switch (LevelType) {
+ case 1:
+ ///
+ /// Thread
+ ///
+ Location->Thread = ApicId & ((1 << (RegsInfo.RegEax & 0x0F)) - 1);
+ LevelBits = RegsInfo.RegEax & 0x0F;
+ break;
+
+ case 2:
+ ///
+ /// Core
+ ///
+ Location->Core = ApicId >> LevelBits;
+ LevelBits = RegsInfo.RegEax & 0x0F;
+ break;
+
+ default:
+ ///
+ /// End of Level
+ ///
+ Location->Die = 0;
+ Location->Package = ApicId >> LevelBits;
+ break;
+ }
+ } while (!(RegsInfo.RegEax == 0 && RegsInfo.RegEbx == 0));
+ } else {
+
+ AsmCpuid (CPUID_VERSION_INFO, &RegsInfo.RegEax, &RegsInfo.RegEbx, &RegsInfo.RegEcx, &RegsInfo.RegEdx);
+ Bits = 0;
+ Shift = (UINT8) ((RegsInfo.RegEbx >> 16) & 0xFF);
+
+ Mask = Shift - 1;
+ while (Shift > 1) {
+ Shift >>= 1;
+ Bits++;
+ }
+
+ HyperThreadingEnabled = FALSE;
+ AsmCpuidEx (CPUID_CACHE_PARAMS, 0, &RegsInfo.RegEax, &RegsInfo.RegEbx, &RegsInfo.RegEcx, &RegsInfo.RegEdx);
+ if (Mask > (RegsInfo.RegEax >> 26)) {
+ HyperThreadingEnabled = TRUE;
+ }
+
+ Location->Package = (ApicId >> Bits);
+ Location->Die = 0;
+ if (HyperThreadingEnabled) {
+ Location->Core = (ApicId & Mask) >> 1;
+ Location->Thread = (ApicId & Mask) & 1;
+ } else {
+ Location->Core = (ApicId & Mask);
+ Location->Thread = 0;
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Fill in CPU relevant information into data hub
+
+ @param[in] CpuNumber - CPU number
+ @param[in] CpuDataforDatahub - pointer to data hub that will be updated
+
+ @retval EFI_SUCCESS - always return success
+**/
+EFI_STATUS
+FillinDataforDataHub (
+ IN UINTN CpuNumber,
+ OUT CPU_DATA_FOR_DATAHUB *CpuDataforDatahub
+ )
+{
+ ZeroMem (CpuDataforDatahub, sizeof (*CpuDataforDatahub));
+
+ ///
+ /// Read Cpu Frequency from MSR instead
+ ///
+ CpuDataforDatahub->IntendCoreFrequency =
+ (
+ 100 *
+ (((UINT32) EfiReadMsr (MSR_IA32_PERF_STS) >> N_IA32_PERF_STSP_STATE_TARGET) & B_IA32_PERF_STSP_STATE_MASK)
+ );
+
+ GetProcessorVersion (&CpuDataforDatahub->Version);
+ CpuDataforDatahub->Manufacturer = GetProcessorManufacturer ();
+
+ EfiCpuid (CPUID_VERSION_INFO, (EFI_CPUID_REGISTER *) &CpuDataforDatahub->CpuidData);
+
+ CpuDataforDatahub->Family = GetProcessorFamily ();
+ CpuDataforDatahub->Voltage = GetProcessorVoltage ();
+ CpuDataforDatahub->ApicID = GetApicID (
+ &CpuDataforDatahub->ApicBase,
+ &CpuDataforDatahub->ApicVersion
+ );
+
+ CpuDataforDatahub->MicrocodeRevision = GetCpuUcodeRevision ();
+ EfiCpuid (CPUID_CACHE_INFO, CpuDataforDatahub->CacheInformation);
+
+ ///
+ /// Status field will be updated later, after calling CpuPlatformPolicy protocol to override
+ ///
+ CpuDataforDatahub->Status = GetProcessorStatus (CpuNumber);;
+
+ FillInCpuLocation (&CpuDataforDatahub->Location);
+
+ ///
+ /// Health field will be filled in else where
+ ///
+ return EFI_SUCCESS;
+}
+
+/**
+ Allocate EfiReservedMemoryType below 4G memory address.
+
+ @param[in] Size - Size of memory to allocate.
+ @param[in] Buffer - Allocated address for output.
+
+ @retval EFI_SUCCESS - Memory successfully allocated.
+ @retval Other - Other errors occur.
+**/
+EFI_STATUS
+AllocateReservedMemoryBelow4G (
+ IN UINTN Size,
+ OUT VOID **Buffer
+ )
+{
+ UINTN Pages;
+ EFI_PHYSICAL_ADDRESS Address;
+ EFI_STATUS Status;
+
+ Pages = EFI_SIZE_TO_PAGES (Size);
+ Address = 0xffffffff;
+
+ Status = (gBS->AllocatePages)(AllocateMaxAddress, EfiReservedMemoryType, Pages, &Address);
+
+ *Buffer = (VOID *) (UINTN) Address;
+
+ return Status;
+}
+
+/**
+ This function is invoked when SMM_BASE protocol is installed, then we
+ allocate SMRAM and save all information there.
+
+ @param[in] Event - The triggered event.
+ @param[in] Context - Context for this event.
+**/
+VOID
+EFIAPI
+InitializeSmramDataContent (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ EFI_SMM_BASE_PROTOCOL *SmmBase;
+ SMRAM_CPU_DATA SmramCpuDataTemplate;
+ UINTN LockBoxSize;
+ UINT8 *LockBoxData;
+ PSEUDO_DESCRIPTOR *Idtr;
+ PSEUDO_DESCRIPTOR *Gdtr;
+ UINTN MicrocodeSize;
+ EFI_CPU_MICROCODE_HEADER **Microcode;
+ UINT8 *LockBoxMicrocode;
+ UINTN Index;
+ EFI_STATUS Status;
+ EFI_SMM_CONTROL_PROTOCOL *SmmControl;
+ UINT8 *SmramCpuData;
+ UINTN VarSize;
+ SMRAM_CPU_DATA_ADDRESS SmramCpuDataAddr;
+ UINTN ArgBufferSize;
+ UINT8 ArgBuffer;
+ EFI_SMM_CONTROL_REGISTER SmiRegister;
+
+ DEBUG ((EFI_D_INFO, "InitializeSmramDataContent\n"));
+
+ Status = gBS->LocateProtocol (&gEfiSmmBaseProtocolGuid, NULL, (VOID **) &SmmBase);
+ ASSERT_EFI_ERROR (Status);
+
+ Status = gBS->LocateProtocol (&gEfiSmmControlProtocolGuid, NULL, (VOID **) &SmmControl);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Init
+ ///
+ CopyMem (&SmramCpuDataTemplate.HeaderGuid, &gSmramCpuDataHeaderGuid, sizeof (EFI_GUID));
+ SmramCpuDataTemplate.AcpiCpuPointer = (EFI_PHYSICAL_ADDRESS) (UINTN) mAcpiCpuData;
+ CopyMem (&SmramCpuDataTemplate.AcpiCpuData, mAcpiCpuData, sizeof (ACPI_CPU_DATA));
+
+ ///
+ /// Calculate size
+ ///
+ SmramCpuDataTemplate.GdtrProfileSize = sizeof (PSEUDO_DESCRIPTOR);
+ Gdtr = (PSEUDO_DESCRIPTOR *) (UINTN) mAcpiCpuData->GdtrProfile;
+ SmramCpuDataTemplate.GdtSize = Gdtr->Limit + 1;
+ SmramCpuDataTemplate.IdtrProfileSize = sizeof (PSEUDO_DESCRIPTOR);
+ Idtr = (PSEUDO_DESCRIPTOR *) (UINTN) mAcpiCpuData->GdtrProfile;
+ SmramCpuDataTemplate.IdtSize = Idtr->Limit + 1;
+ SmramCpuDataTemplate.CpuPrivateDataSize = sizeof (MP_CPU_S3_DATA_POINTER);
+ SmramCpuDataTemplate.S3BootScriptTableSize = sizeof (mMPSystemData->S3BootScriptTable);
+ SmramCpuDataTemplate.S3BspMtrrTableSize = sizeof (mMPSystemData->S3BspMtrrTable);
+ ///
+ /// Record best match for each CPU Microcode and NULL for end
+ ///
+ SmramCpuDataTemplate.MicrocodePointerBufferSize = sizeof (UINT32) * (mAcpiCpuData->NumberOfCpus + 1);
+ ///
+ /// Calculate Microcode DataSize
+ ///
+ SmramCpuDataTemplate.MicrocodeDataBufferSize = 0;
+ Microcode = (VOID *) (UINTN) mAcpiCpuData->MicrocodePointerBuffer;
+ if (Microcode != NULL) {
+ Index = 0;
+ MicrocodeSize = 0;
+ while (Microcode[Index] != NULL) {
+ if (Microcode[Index]->DataSize == 0) {
+ MicrocodeSize = 2048;
+ } else {
+ MicrocodeSize = Microcode[Index]->TotalSize;
+ }
+
+ SmramCpuDataTemplate.MicrocodeDataBufferSize += (UINT32) MicrocodeSize;
+ Index++;
+ }
+ }
+
+ SmramCpuDataTemplate.GdtrProfileOffset = sizeof (SMRAM_CPU_DATA);
+ SmramCpuDataTemplate.GdtOffset = SmramCpuDataTemplate.GdtrProfileOffset + SmramCpuDataTemplate.GdtrProfileSize;
+ SmramCpuDataTemplate.IdtrProfileOffset = SmramCpuDataTemplate.GdtOffset + SmramCpuDataTemplate.GdtSize;
+ SmramCpuDataTemplate.IdtOffset = SmramCpuDataTemplate.IdtrProfileOffset + SmramCpuDataTemplate.IdtrProfileSize;
+ SmramCpuDataTemplate.CpuPrivateDataOffset = SmramCpuDataTemplate.IdtOffset + SmramCpuDataTemplate.IdtSize;
+ SmramCpuDataTemplate.S3BootScriptTableOffset = SmramCpuDataTemplate.CpuPrivateDataOffset + SmramCpuDataTemplate.CpuPrivateDataSize;
+ SmramCpuDataTemplate.S3BspMtrrTableOffset = SmramCpuDataTemplate.S3BootScriptTableOffset + SmramCpuDataTemplate.S3BootScriptTableSize;
+ SmramCpuDataTemplate.MicrocodePointerBufferOffset = SmramCpuDataTemplate.S3BspMtrrTableOffset + SmramCpuDataTemplate.S3BspMtrrTableSize;
+ SmramCpuDataTemplate.MicrocodeDataBufferOffset = SmramCpuDataTemplate.MicrocodePointerBufferOffset + SmramCpuDataTemplate.MicrocodePointerBufferSize;
+
+ LockBoxSize = sizeof (SMRAM_CPU_DATA) +
+ SmramCpuDataTemplate.GdtrProfileSize +
+ SmramCpuDataTemplate.GdtSize +
+ SmramCpuDataTemplate.IdtrProfileSize +
+ SmramCpuDataTemplate.IdtSize +
+ SmramCpuDataTemplate.CpuPrivateDataSize +
+ SmramCpuDataTemplate.S3BootScriptTableSize +
+ SmramCpuDataTemplate.S3BspMtrrTableSize +
+ SmramCpuDataTemplate.MicrocodePointerBufferSize +
+ SmramCpuDataTemplate.MicrocodeDataBufferSize;
+
+ DEBUG ((EFI_D_INFO, "LockBoxSize - %x\n", LockBoxSize));
+ DEBUG ((EFI_D_INFO, "SmramCpuData.GdtrProfileSize - %x\n", SmramCpuDataTemplate.GdtrProfileSize));
+ DEBUG ((EFI_D_INFO, "SmramCpuData.GdtSize - %x\n", SmramCpuDataTemplate.GdtSize));
+ DEBUG ((EFI_D_INFO, "SmramCpuData.IdtrProfileSize - %x\n", SmramCpuDataTemplate.IdtrProfileSize));
+ DEBUG ((EFI_D_INFO, "SmramCpuData.IdtSize - %x\n", SmramCpuDataTemplate.IdtSize));
+ DEBUG ((EFI_D_INFO, "SmramCpuData.CpuPrivateDataSize - %x\n", SmramCpuDataTemplate.CpuPrivateDataSize));
+ DEBUG ((EFI_D_INFO, "SmramCpuData.S3BootScriptTableSize - %x\n", SmramCpuDataTemplate.S3BootScriptTableSize));
+ DEBUG ((EFI_D_INFO, "SmramCpuData.S3BspMtrrTableSize - %x\n", SmramCpuDataTemplate.S3BspMtrrTableSize));
+ DEBUG ((EFI_D_INFO, "SmramCpuData.MicrocodePointerBufferSize - %x\n", SmramCpuDataTemplate.MicrocodePointerBufferSize));
+ DEBUG ((EFI_D_INFO, "SmramCpuData.MicrocodeDataBufferSize - %x\n", SmramCpuDataTemplate.MicrocodeDataBufferSize));
+ DEBUG ((EFI_D_INFO, "SmramCpuData.GdtrProfileOffset - %x\n", SmramCpuDataTemplate.GdtrProfileOffset));
+ DEBUG ((EFI_D_INFO, "SmramCpuData.GdtOffset - %x\n", SmramCpuDataTemplate.GdtOffset));
+ DEBUG ((EFI_D_INFO, "SmramCpuData.IdtrProfileOffset - %x\n", SmramCpuDataTemplate.IdtrProfileOffset));
+ DEBUG ((EFI_D_INFO, "SmramCpuData.IdtOffset - %x\n", SmramCpuDataTemplate.IdtOffset));
+ DEBUG ((EFI_D_INFO, "SmramCpuData.CpuPrivateDataOffset - %x\n", SmramCpuDataTemplate.CpuPrivateDataOffset));
+ DEBUG ((EFI_D_INFO, "SmramCpuData.S3BootScriptTableOffset - %x\n", SmramCpuDataTemplate.S3BootScriptTableOffset));
+ DEBUG ((EFI_D_INFO, "SmramCpuData.S3BspMtrrTableOffset - %x\n", SmramCpuDataTemplate.S3BspMtrrTableOffset));
+ DEBUG ((EFI_D_INFO, "SmramCpuData.MicrocodePointerBufferOffset - %x\n", SmramCpuDataTemplate.MicrocodePointerBufferOffset));
+ DEBUG ((EFI_D_INFO, "SmramCpuData.MicrocodeDataBufferOffset - %x\n", SmramCpuDataTemplate.MicrocodeDataBufferOffset));
+
+ ///
+ /// Allocate Normal Memory
+ ///
+ Status = (gBS->AllocatePool)(EfiBootServicesData, LockBoxSize, &SmramCpuData);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Allocate SMRAM
+ ///
+ Status = SmmBase->SmmAllocatePool (
+ SmmBase,
+ EfiRuntimeServicesData,
+ LockBoxSize + EFI_PAGE_SIZE,
+ &LockBoxData
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Let it page aligned
+ ///
+ LockBoxData = (UINT8 *) (((UINTN) LockBoxData + EFI_PAGE_SIZE - 1) &~(EFI_PAGE_SIZE - 1));
+ DEBUG ((EFI_D_INFO, "CPU SMRAM NVS Data - %x\n", LockBoxData));
+
+ ///
+ /// Copy data buffer
+ ///
+ CopyMem (SmramCpuData, &SmramCpuDataTemplate, sizeof (SmramCpuDataTemplate));
+
+ CopyMem (
+ SmramCpuData + SmramCpuDataTemplate.GdtrProfileOffset,
+ (VOID *) (UINTN) mAcpiCpuData->GdtrProfile,
+ SmramCpuDataTemplate.GdtrProfileSize
+ );
+ CopyMem (
+ SmramCpuData + SmramCpuDataTemplate.GdtOffset,
+ (VOID *) (UINTN) Gdtr->Base,
+ SmramCpuDataTemplate.GdtSize
+ );
+ CopyMem (
+ SmramCpuData + SmramCpuDataTemplate.IdtrProfileOffset,
+ (VOID *) (UINTN) mAcpiCpuData->IdtrProfile,
+ SmramCpuDataTemplate.IdtrProfileSize
+ );
+ CopyMem (
+ SmramCpuData + SmramCpuDataTemplate.IdtOffset,
+ (VOID *) (UINTN) Idtr->Base,
+ SmramCpuDataTemplate.IdtSize
+ );
+ CopyMem (
+ SmramCpuData + SmramCpuDataTemplate.CpuPrivateDataOffset,
+ (VOID *) (UINTN) mAcpiCpuData->CpuPrivateData,
+ SmramCpuDataTemplate.CpuPrivateDataSize
+ );
+ CopyMem (
+ SmramCpuData + SmramCpuDataTemplate.S3BootScriptTableOffset,
+ (VOID *) (UINTN) mMPSystemData->S3DataPointer.S3BootScriptTable,
+ SmramCpuDataTemplate.S3BootScriptTableSize
+ );
+ CopyMem (
+ SmramCpuData + SmramCpuDataTemplate.S3BspMtrrTableOffset,
+ (VOID *) (UINTN) mMPSystemData->S3DataPointer.S3BspMtrrTable,
+ SmramCpuDataTemplate.S3BspMtrrTableSize
+ );
+ Microcode = (VOID *) (UINTN) mAcpiCpuData->MicrocodePointerBuffer;
+ if (Microcode != NULL) {
+ ///
+ /// Copy Microcode Pointer Buffer
+ ///
+ CopyMem (
+ SmramCpuData + SmramCpuDataTemplate.MicrocodePointerBufferOffset,
+ Microcode,
+ SmramCpuDataTemplate.MicrocodePointerBufferSize
+ );
+ ///
+ /// Copy Microcode Data
+ ///
+ Index = 0;
+ MicrocodeSize = 0;
+ LockBoxMicrocode = SmramCpuData + SmramCpuDataTemplate.MicrocodeDataBufferOffset;
+ while (Microcode[Index] != NULL) {
+ if (Microcode[Index]->DataSize == 0) {
+ MicrocodeSize = 2048;
+ } else {
+ MicrocodeSize = Microcode[Index]->TotalSize;
+ }
+
+ CopyMem (LockBoxMicrocode, Microcode[Index], MicrocodeSize);
+ LockBoxMicrocode += MicrocodeSize;
+ Index++;
+ }
+ }
+
+ ///
+ /// Copy to SMRAM
+ ///
+ ///
+ /// We have to use SMI to copy SMRAM, because we can not access SMRAM after SMRR enabled.
+ /// SMM_ACCESS.Open () takes no effect.
+ ///
+ VarSize = sizeof (SmramCpuDataAddr);
+ SmramCpuDataAddr.LockBoxData = (UINT64) (UINTN) LockBoxData;
+ SmramCpuDataAddr.SmramCpuData = (UINT64) (UINTN) SmramCpuData;
+ SmramCpuDataAddr.LockBoxSize = (UINT64) LockBoxSize;
+
+ Status = gRT->SetVariable (
+ SMRAM_CPU_DATA_VARIABLE,
+ &gSmramCpuDataVariableGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS,
+ VarSize,
+ &SmramCpuDataAddr
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Fill SMI data port
+ ///
+ Status = SmmControl->GetRegisterInfo (SmmControl, &SmiRegister);
+ ASSERT_EFI_ERROR (Status);
+ IoWrite8 (SmiRegister.SmiDataRegister, SMM_FROM_CPU_DRIVER_SAVE_INFO);
+
+ ///
+ /// Trigger SMI
+ ///
+ ArgBufferSize = sizeof (ArgBuffer);
+ ArgBuffer = mSmmbaseSwSmiNumber;
+ Status = SmmControl->Trigger (SmmControl, (INT8 *) &ArgBuffer, &ArgBufferSize, FALSE, 0);
+ Status = SmmControl->Clear (SmmControl, 0);
+ return;
+}
+
+/**
+ This function is invoked when LegacyBios protocol is installed, we must
+ allocate reserved memory under 1M for AP.
+
+ @param[in] Event - The triggered event.
+ @param[in] Context - Context for this event.
+**/
+VOID
+EFIAPI
+ReAllocateEbdaMemoryForAP (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
+ EFI_PHYSICAL_ADDRESS EbdaOld;
+ EFI_PHYSICAL_ADDRESS EbdaNew;
+ UINTN EbdaSize;
+ EFI_STATUS Status;
+
+ ///
+ /// Check whether this is real LegacyBios notification
+ ///
+ Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL, (VOID **) &LegacyBios);
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+ ///
+ /// PLEASE NOTE:
+ /// For legacy implementation, we have reserved 0x9F000 to 0x9FFFF for S3 usage in CSM,
+ /// No don't need to allocate it again
+ /// This range will be used for MpS3 driver and S3Resume driver on S3 boot path
+ /// The base needs to be aligned to 4K to satisfy the AP vector requirement
+ /// The original implementation requires 8K from legacy memory form E/F segment,
+ /// which needs lock/unlock and makes lots of code chipset dependent on S3 boot path
+ /// Here we just use normal low memory to eliminate the dependency
+ /// In this case, EBDA will start from 0x9F000 - sizeof (EBDA) in CSM definition
+ /// CSM EBDA base and memory size in BDA area needs to be consistent with this
+ ///
+ ///
+ /// Get EDBA address/length and turn it into the S3 reserved address
+ /// The length of this range is limited so we need to keep the real mode code small
+ ///
+ EbdaOld = (EFI_PHYSICAL_ADDRESS) (*(UINT16 *) (UINTN) 0x40E) << 4;;
+ EbdaSize = (UINTN) (*((UINT8 *) (UINTN) EbdaOld));
+
+//(AMI_CHG+)>
+#if (REQUEST_EBDA_SIZE == 0x1000)
+ mLegacyRegion = EbdaOld + (EbdaSize << 10);
+ mLegacyRegion = (mLegacyRegion - 0x1000) & 0xFFFFF000;
+ EbdaNew = mLegacyRegion - (EbdaSize << 10);
+#else
+ *(UINT8 *) ((UINTN) EbdaOld) = (UINT8)(EbdaSize + 8);
+ mLegacyRegion = EbdaOld + (EbdaSize << 10);
+ mLegacyRegion = (mLegacyRegion - REQUEST_EBDA_SIZE) & 0xFFFFF000;
+ EbdaNew = mLegacyRegion - (EbdaSize << 10);
+ mEbdaOffset = EbdaSize << 10;
+#endif
+//<(AMI_CHG+)
+
+ (*(UINT16 *) (UINTN) 0x40E) = (UINT16) (EbdaNew >> 4);
+ CopyMem ((VOID *) (UINTN) EbdaNew, (VOID *) (UINTN) EbdaOld, EbdaSize << 10);
+
+ ///
+ /// Update 40:13 with the new size of available base memory
+ ///
+ *(UINT16 *) (UINTN) 0x413 = (*(UINT16 *) (UINTN) 0x413) - (UINT16) (((EbdaOld - EbdaNew) >> 10));
+
+ ///
+ /// Free the Wake-up buffer and re-declare it as Reserved Memory
+ ///
+ DEBUG ((EFI_D_INFO, "Legacy region freed before re-allocation: %X\n", mLegacyRegion));
+ Status = (gBS->FreePages) (mLegacyRegion, 1);
+ ASSERT_EFI_ERROR (Status);
+ DEBUG ((EFI_D_INFO, "Allocate and reserve the 4K buffer for Legacy Region\n"));
+ Status = (gBS->AllocatePages)(AllocateAddress, EfiReservedMemoryType, 1, &mLegacyRegion);
+ ASSERT_EFI_ERROR (Status);
+ DEBUG ((EFI_D_INFO, "mLegacyRegion CSM - %x\n", mLegacyRegion));
+}
+
+/**
+ This function is invoked when LegacyBios protocol is installed, we must
+ allocate reserved memory under 1M for AP.
+
+ @param[in] Event - The triggered event.
+ @param[in] Context - Context for this event.
+**/
+VOID
+EFIAPI
+ReAllocateMemoryForAP (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
+ EFI_STATUS Status;
+ EFI_PHYSICAL_ADDRESS LegacyRegion;
+ MP_CPU_EXCHANGE_INFO *ExchangeInfo;
+ MONITOR_MWAIT_DATA *MonitorAddr;
+ UINTN Index;
+ UINT64 MaxCstate;
+ UINT64 CStateLimit;
+ UINT32 SubStates;
+ EFI_CPUID_REGISTER MwaitInfo;
+ BOOLEAN HasCsm;
+ EFI_MP_SERVICES_PROTOCOL *MpService;
+
+ VOID *ExitPmAuth;
+ STATIC BOOLEAN InitDone = FALSE;
+
+ ///
+ /// Check whether this is real ExitPmAuth notification
+ ///
+ Status = gBS->LocateProtocol (&gExitPmAuthProtocolGuid, NULL, &ExitPmAuth);
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+ ///
+ /// Make sure it is invoked only once.
+ ///
+ if (InitDone) {
+ return;
+ }
+
+ InitDone = TRUE;
+
+ Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL, (VOID **) &LegacyBios);
+ if (EFI_ERROR (Status)) {
+ HasCsm = FALSE;
+ } else {
+ HasCsm = TRUE;
+ }
+
+ while (ApRunning ()) {
+ CpuPause ();
+ }
+ ///
+ /// Re-load microcode patch here!!!
+ ///
+ ReLoadMicrocodeBeforeBoot ();
+
+ if (HasCsm) {
+//(AMI_CHG+)>
+#if (REQUEST_EBDA_SIZE == 0x1000)
+ LegacyRegion = mLegacyRegion;
+#else
+ EFI_PHYSICAL_ADDRESS CurEbda;
+
+ CurEbda = (EFI_PHYSICAL_ADDRESS) (*(UINT16 *) (UINTN) 0x40E) << 4;
+ LegacyRegion = (EFI_PHYSICAL_ADDRESS) ((UINTN)CurEbda + mEbdaOffset);
+ LegacyRegion += 0x1000;
+ LegacyRegion &= 0xffff000;
+#endif
+//<(AMI_CHG+)
+ DEBUG ((EFI_D_INFO, "Using LegacyRegion CSM - %x\n", LegacyRegion));
+ } else {
+ ///
+ /// The BackBuffer is 4k. Allocate 0x2000 bytes from below 640K memory to ensure 4k aligned spaces of 0x1000 bytes,
+ /// since Alignment argument does not work.
+ ///
+ LegacyRegion = 0x9FFFF;
+ Status = (gBS->AllocatePages)(AllocateMaxAddress, EfiReservedMemoryType, EFI_SIZE_TO_PAGES (0x2000), &LegacyRegion);
+ ASSERT_EFI_ERROR (Status);
+ DEBUG ((EFI_D_INFO, "LegacyRegion NonCSM - %x\n", LegacyRegion));
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+ }
+ ///
+ /// This address should be less than A seg.
+ /// And it should be aligned to 4K
+ ///
+ ASSERT (!((UINTN) LegacyRegion & 0x0FFF) && ((UINTN) LegacyRegion < 0xA0000));
+
+ mAcpiCpuData->WakeUpBuffer = (EFI_PHYSICAL_ADDRESS) LegacyRegion;
+ mAcpiCpuData->WakeUpBuffer = (mAcpiCpuData->WakeUpBuffer + 0x0fff) & 0x0fffff000;
+
+ ExchangeInfo = (MP_CPU_EXCHANGE_INFO *) (UINTN) (mBackupBuffer + MP_CPU_EXCHANGE_INFO_OFFSET);
+ ExchangeInfo->BufferStart = (UINT32) mAcpiCpuData->WakeUpBuffer;
+ CopyMem (
+ (VOID *) (UINTN) mAcpiCpuData->WakeUpBuffer,
+ (VOID *) (UINTN) mBackupBuffer,
+ EFI_PAGE_SIZE
+ );
+ RedirectFarJump ();
+
+ if (HasCsm) {
+ Status = LegacyBios->CopyLegacyRegion (
+ LegacyBios,
+ sizeof (MP_CPU_EXCHANGE_INFO),
+ (VOID *) (UINTN) (mAcpiCpuData->WakeUpBuffer + MP_CPU_EXCHANGE_INFO_OFFSET),
+ (VOID *) (UINTN) (mBackupBuffer + MP_CPU_EXCHANGE_INFO_OFFSET)
+ );
+ }
+
+ ///
+ /// Set all APs to deepest C-State before ready to boot for better power saving,
+ /// if boot to DOS/EFI_SHARE or any operating system that running only single thread.
+ ///
+ ExchangeInfo = (MP_CPU_EXCHANGE_INFO *) (UINTN) (mAcpiCpuData->WakeUpBuffer + MP_CPU_EXCHANGE_INFO_OFFSET);
+ if (mPlatformCpu->CpuConfig->ApHandoffManner != WakeUpApPerHltLoop) {
+ ///
+ /// Based on HSW BWG 17.2.7, BIOS should use CPUID.(EAX=5) Monitor/Mwait Leaf and also check MSR E2h[3:0] Package C-state limit to determine
+ /// if the processor supports MONITOR/MWAIT extensions for various Haswell specific C-states and sub C-states.
+ ///
+ CStateLimit = AsmReadMsr64 (MSR_PMG_CST_CONFIG) & B_PACKAGE_C_STATE_LIMIT;
+ AsmCpuid (5, &MwaitInfo.RegEax, &MwaitInfo.RegEbx, &MwaitInfo.RegEcx, &MwaitInfo.RegEdx);
+ MaxCstate = 0;
+ SubStates = 0;
+ if (MwaitInfo.RegEcx & BIT0) {
+ switch (CStateLimit) {
+ case V_CSTATE_LIMIT_C10:
+ SubStates = (MwaitInfo.RegEdx & (BIT31 | BIT30 | BIT29 | BIT28)) >> 28;
+ MaxCstate = 0x60 | (SubStates - 1);
+ break;
+
+ case V_CSTATE_LIMIT_C9:
+ SubStates = (MwaitInfo.RegEdx & (BIT27 | BIT26 | BIT25 | BIT24)) >> 24;
+ MaxCstate = 0x50 | (SubStates - 1);
+ break;
+
+ case V_CSTATE_LIMIT_C8:
+ SubStates = (MwaitInfo.RegEdx & (BIT23 | BIT22 | BIT21 | BIT20)) >> 20;
+ MaxCstate = 0x40 | (SubStates - 1);
+ break;
+
+ case V_CSTATE_LIMIT_C7S:
+ SubStates = (MwaitInfo.RegEdx & (BIT19 | BIT18 | BIT17 | BIT16)) >> 16;
+ MaxCstate = 0x30 | (SubStates - 1);
+ break;
+
+ case V_CSTATE_LIMIT_C7:
+ SubStates = (MwaitInfo.RegEdx & (BIT19 | BIT18 | BIT17 | BIT16)) >> 16;
+ MaxCstate = 0x30 | (SubStates - 1);
+ break;
+
+ case V_CSTATE_LIMIT_C6:
+ SubStates = (MwaitInfo.RegEdx & (BIT15 | BIT14 | BIT13 | BIT12)) >> 12;
+ MaxCstate = 0x20 | (SubStates - 1);
+ break;
+
+ case V_CSTATE_LIMIT_C3:
+ SubStates = (MwaitInfo.RegEdx & (BIT11 | BIT10 | BIT9 | BIT8)) >> 8;
+ MaxCstate = 0x10 | (SubStates - 1);
+ break;
+
+ case V_CSTATE_LIMIT_C1:
+ SubStates = (MwaitInfo.RegEdx & (BIT7 | BIT6 | BIT5 | BIT4)) >> 4;
+ MaxCstate = 0x00 | (SubStates - 1);
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ ///
+ /// Use WakeUpApPerMwaitLoop32 if CR4 paging table entities are not allocated as RESERVED MEMORY TYPE in 64-bits mode.
+ ///
+ ExchangeInfo->WakeUpApManner = WakeUpApPerMwaitLoop32;
+ for (Index = 0; Index < mMPSystemData->NumberOfCpus; Index++) {
+ MonitorAddr = (MONITOR_MWAIT_DATA *) ((UINT8 *) ExchangeInfo->StackStart + (Index + 1) * ExchangeInfo->StackSize - MONITOR_FILTER_SIZE);
+ MonitorAddr->WakeUpApVectorChangeFlag = TRUE;
+ MonitorAddr->MwaitTargetCstate = MaxCstate;
+ }
+ } else {
+ ExchangeInfo->WakeUpApManner = WakeUpApPerHltLoop;
+ }
+
+ ///
+ /// Locate MpServices protocol
+ ///
+ Status = gBS->LocateProtocol (
+ &gEfiMpServiceProtocolGuid,
+ NULL,
+ (VOID **) &MpService
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Move Limit CPUID Maxval configuration here to not impact the BOOT
+ /// After setting this, no code can execute CPUID function > 3.
+ ///
+ ProgramCpuidLimit (MpService);
+ Status = MpService->StartupAllAPs (
+ MpService,
+ ProgramCpuidLimit,
+ FALSE,
+ NULL,
+ 0,
+ MpService,
+ NULL
+ );
+
+ ///
+ /// Invoke the InitializeSmram directly, since it is in ExitPmAuth event.
+ ///
+ InitializeSmramDataContent (NULL, NULL);
+}
+
+/**
+ This function is invoked by EFI_EVENT_SIGNAL_LEGACY_BOOT.
+ Before booting to legacy OS, reset AP's wakeup buffer address,
+ preparing for S3 usage.
+
+ @param[in] Event - The triggered event.
+ @param[in] Context - Context for this event.
+**/
+VOID
+ResetAPs (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ return;
+}
diff --git a/ReferenceCode/Haswell/CpuInit/Dxe/MpCommon.h b/ReferenceCode/Haswell/CpuInit/Dxe/MpCommon.h
new file mode 100644
index 0000000..7677e80
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Dxe/MpCommon.h
@@ -0,0 +1,606 @@
+/** @file
+ Some definitions for MP and HT driver.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#ifndef _MP_COMMON_
+#define _MP_COMMON_
+
+#include "ProcessorData.h"
+#include "CacheData.h"
+#include "Exception.h"
+#include "ProcessorDef.h"
+
+//
+// Protocol produced by this driver
+//
+#include EFI_PROTOCOL_PRODUCER (MpService)
+
+//
+// Protocol consumed by this driver
+//
+#include EFI_PROTOCOL_DEFINITION (CpuPlatformPolicy)
+
+//
+// GUID definitions
+//
+#include EFI_GUID_DEFINITION (HtBistHOB)
+#include EFI_GUID_DEFINITION (SmramCpuDataVariable)
+#include EFI_GUID_DEFINITION (SmramCpuDataHeader)
+
+#define VacantFlag 0x00
+#define NotVacantFlag 0xff
+#define MICROSECOND 10
+#define MAXIMUM_CPU_NUMBER 0x40
+#define STACK_SIZE_PER_PROC 0x8000
+
+#define IO_APIC_INDEX_REGISTER 0xFEC00000
+#define IO_APIC_DATA_REGISTER 0xFEC00010
+
+///
+/// Data structure used in MP/HT driver
+///
+#define MP_CPU_EXCHANGE_INFO_OFFSET (0x1000 - 0x400)
+#define MP_CPU_LEGACY_RESET_INFO_OFFSET (0x100 - 0x20)
+
+#define SMM_FROM_CPU_DRIVER_SAVE_INFO 0x81
+
+#pragma pack(1)
+#define SIZE_OF_MCE_HANDLER 16
+
+typedef struct {
+ UINT16 LimitLow;
+ UINT16 BaseLow;
+ UINT8 BaseMiddle;
+ UINT16 Attributes;
+ UINT8 BaseHigh;
+} SEGMENT_DESCRIPTOR;
+
+#pragma pack()
+
+#define BREAK_TO_RUN_AP_SIGNAL 0x6E755200
+#define MONITOR_FILTER_SIZE 0x40
+
+typedef enum {
+ WakeUpApCounterInit = 0,
+ WakeUpApPerHltLoop = 1,
+ WakeUpApPerMwaitLoop = 2,
+ WakeUpApPerRunLoop = 3,
+ WakeUpApPerMwaitLoop32= 4,
+ WakeUpApPerRunLoop32 = 5
+} WAKEUP_AP_MANNER;
+
+typedef struct {
+ UINTN BreakToRunApSignal;
+ UINTN HltLoopBreakCounter;
+ UINTN MwaitLoopBreakCounter;
+ UINTN RunLoopBreakCounter;
+ UINTN MwaitLoopBreakCounter32;
+ UINTN RunLoopBreakCounter32;
+ UINTN WakeUpApVectorChangeFlag;
+ UINTN MwaitTargetCstate;
+} MONITOR_MWAIT_DATA;
+
+typedef struct {
+ UINT32 Number;
+ UINT32 BIST;
+} BIST_INFO;
+
+typedef struct {
+ UINTN Lock;
+ VOID *StackStart;
+ UINTN StackSize;
+ VOID *ApFunction;
+ PSEUDO_DESCRIPTOR GdtrProfile;
+ PSEUDO_DESCRIPTOR IdtrProfile;
+ UINT32 BufferStart;
+ UINT32 Cr3;
+ UINT32 InitFlag;
+ WAKEUP_AP_MANNER WakeUpApManner;
+ BIST_INFO BistBuffer[MAXIMUM_CPU_NUMBER];
+} MP_CPU_EXCHANGE_INFO;
+
+extern ACPI_CPU_DATA *mAcpiCpuData;
+
+//
+// Protocol interface functions
+//
+/**
+ Get general MP information
+
+ @param[in] This - EFI_MP_SERVICE_PROTOCOL
+ @param[in] NumberOfCPUs - Number of processors
+ @param[in] MaxiumNumberOfCPUs - Max supported number of processors
+ @param[in] NumberOfEnabledCPUs - Number of processors enabled
+ @param[in] RendezvousIntNumber - number of Rendezvous procedure
+ @param[in] RendezvousProcLength - length of Rendezvous procedure
+
+ @retval EFI_SUCCESS - always return success
+**/
+EFI_STATUS
+EFIAPI
+GetGeneralMPInfo (
+ IN EFI_MP_SERVICES_PROTOCOL *This,
+ OUT UINTN *NumberOfCPUs,
+ OUT UINTN *MaxiumNumberOfCPUs,
+ OUT UINTN *NumberOfEnabledCPUs,
+ OUT UINTN *RendezvousIntNumber,
+ OUT UINTN *RendezvousProcLength
+ );
+
+/**
+ Get processor context
+
+ @param[in] This - EFI_MP_SERVICE_PROTOCOL
+ @param[in] ProcessorNumber - Cpu number
+ @param[in] BufferLength - buffer length
+ @param[in] ProcessorContextBuffer - pointer to the buffer that will be updated
+
+ @retval EFI_INVALID_PARAMETER - buffer is NULL or CpuNumber our of range
+ @retval EFI_BUFFER_TOO_SMALL - buffer too small
+ @retval EFI_SUCCESS - got processor context successfully
+**/
+EFI_STATUS
+EFIAPI
+GetProcessorContext (
+ IN EFI_MP_SERVICES_PROTOCOL *This,
+ IN UINTN ProcessorNumber,
+ IN OUT UINTN *BufferLength,
+ IN OUT EFI_MP_PROC_CONTEXT *ProcessorContextBuffer
+ );
+
+/**
+ MP Service to get specified application processor (AP)
+ to execute a caller-provided code stream.
+
+ @param[in] This - Pointer to MP Service Protocol
+ @param[in] Procedure - The procedure to be assigned to AP.
+ @param[in] ProcessorNumber - Cpu number
+ @param[in] WaitEvent - If timeout, the event to be triggered after this AP finishes.
+ @param[in] TimeoutInMicroSecs - The timeout value in microsecond. Zero means infinity.
+ @param[in] ProcArguments - Argument for Procedure.
+
+ @retval EFI_INVALID_PARAMETER - Procudure is NULL.
+ @retval EFI_INVALID_PARAMETER - Number of CPU out of range, or it belongs to BSP.
+ @retval EFI_INVALID_PARAMETER - Specified CPU is not idle.
+ @retval EFI_SUCCESS - The AP has finished.
+ @retval EFI_TIMEOUT - Time goes out before the AP has finished.
+**/
+EFI_STATUS
+EFIAPI
+StartupThisAP (
+ IN EFI_MP_SERVICES_PROTOCOL *This,
+ IN EFI_AP_PROCEDURE Procedure,
+ IN UINTN ProcessorNumber,
+ IN EFI_EVENT WaitEvent OPTIONAL,
+ IN UINTN TimeoutInMicroSecs OPTIONAL,
+ IN OUT VOID *ProcArguments OPTIONAL
+ );
+
+/**
+ MP Service to get all the available application processors (APs)
+ to execute a caller-provided code stream.
+
+ @param[in] This - Pointer to MP Service Protocol
+ @param[in] Procedure - The procedure to be assigned to APs.
+ @param[in] SingleThread - If true, all APs execute in block mode.
+ Otherwise, all APs exceute in non-block mode.
+ @param[in] WaitEvent - If timeout, the event to be triggered after all APs finish.
+ @param[in] TimeoutInMicroSecs - The timeout value in microsecond. Zero means infinity.
+ @param[in] ProcArguments - Argument for Procedure.
+ @param[in] FailedCPUList - If not NULL, all APs that fail to start will be recorded in the list.
+
+ @retval EFI_INVALID_PARAMETER - Procudure is NULL.
+ @retval EFI_SUCCESS - Only 1 logical processor exists.
+ @retval EFI_SUCCESS - All APs have finished.
+ @retval EFI_TIMEOUT - Time goes out before all APs have finished.
+**/
+EFI_STATUS
+EFIAPI
+StartupAllAPs (
+ IN EFI_MP_SERVICES_PROTOCOL *This,
+ IN EFI_AP_PROCEDURE Procedure,
+ IN BOOLEAN SingleThread,
+ IN EFI_EVENT WaitEvent OPTIONAL,
+ IN UINTN TimeoutInMicroSecs OPTIONAL,
+ IN OUT VOID *ProcArguments OPTIONAL,
+ OUT UINTN *FailedCPUList OPTIONAL
+ );
+
+/**
+ MP Service to makes the current BSP into an AP and then switches the
+ designated AP into the AP. This procedure is usually called after a CPU
+ test that has found that BSP is not healthy to continue it's responsbilities.
+
+ @param[in] This - Pointer to MP Service Protocol.
+ @param[in] ProcessorNumber - The handle number of processor.
+ @param[in] OldBSPState - Whether to enable or disable the original BSP.
+
+ @retval EFI_INVALID_PARAMETER - Number for Specified AP out of range.
+ @retval EFI_INVALID_PARAMETER - Number of specified CPU belongs to BSP.
+ @retval EFI_NOT_READY - Specified AP is not idle.
+ @retval EFI_SUCCESS - BSP successfully switched.
+**/
+EFI_STATUS
+EFIAPI
+SwitchBSP (
+ IN EFI_MP_SERVICES_PROTOCOL *This,
+ IN UINTN ProcessorNumber,
+ IN BOOLEAN OldBSPState
+ );
+
+/**
+ This procedure sends an IPI to the designated processor in
+ the requested delivery mode with the requested vector.
+
+ @param[in] This - Pointer to MP Service Protocol.
+ @param[in] ProcessorNumber - The handle number of processor.
+ @param[in] VectorNumber - Vector number.
+ @param[in] DeliveryMode - I/O APIC Interrupt Deliver Modes
+
+ @retval EFI_INVALID_PARAMETER - Input paramters were not correct.
+ @retval Other status - Status returned by SendInterrupt ()
+**/
+EFI_STATUS
+EFIAPI
+SendIPI (
+ IN EFI_MP_SERVICES_PROTOCOL *This,
+ IN UINTN ProcessorNumber,
+ IN UINTN VectorNumber,
+ IN UINTN DeliveryMode
+ );
+
+/**
+ This procedure enables or disables APs.
+
+ @param[in] This - Pointer to MP Service Protocol.
+ @param[in] ProcessorNumber - The handle number of processor.
+ @param[in] NewAPState - Indicate new desired AP state
+ @param[in] HealthState - If not NULL, it points to the value that specifies the new health status of the AP.
+ If it is NULL, this parameter is ignored.
+
+ @retval EFI_INVALID_PARAMETER - Input paramters were not correct.
+ @retval EFI_SUCCESS - Function completed successfully
+**/
+EFI_STATUS
+EFIAPI
+EnableDisableAP (
+ IN EFI_MP_SERVICES_PROTOCOL *This,
+ IN UINTN ProcessorNumber,
+ IN BOOLEAN NewAPState,
+ IN EFI_MP_HEALTH *HealthState OPTIONAL
+ );
+
+/**
+ Implementation of WhoAmI() service of MP Services Protocol.
+
+ This service lets the caller processor get its handle number.
+ This service may be called from the BSP and APs.
+
+ @param[in] This - A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
+ @param[in] ProcessorNumber - Pointer to the handle number of AP.
+
+ @retval EFI_SUCCESS - Processor number successfully returned.
+ @retval EFI_INVALID_PARAMETER - ProcessorNumber is NULL
+**/
+EFI_STATUS
+EFIAPI
+WhoAmI (
+ IN EFI_MP_SERVICES_PROTOCOL *This,
+ OUT UINTN *ProcessorNumber
+ );
+
+///
+/// Functions shared in MP/HT drivers
+///
+/**
+ Send interrupt to CPU
+
+ @param[in] BroadcastMode - interrupt broadcast mode
+ @param[in] ApicID - APIC ID for sending interrupt
+ @param[in] VectorNumber - Vector number
+ @param[in] DeliveryMode - Interrupt delivery mode
+ @param[in] TriggerMode - Interrupt trigger mode
+ @param[in] Assert - Interrupt pin polarity
+
+ @retval EFI_INVALID_PARAMETER - input parameter not correct
+ @retval EFI_NOT_READY - there was a pending interrupt
+ @retval EFI_SUCCESS - interrupt sent successfully
+**/
+EFI_STATUS
+SendInterrupt (
+ IN UINT32 BroadcastMode,
+ IN UINT32 ApicID,
+ IN UINT32 VectorNumber,
+ IN UINT32 DeliveryMode,
+ IN UINT32 TriggerMode,
+ IN BOOLEAN Assert
+ );
+
+/**
+ Get APIC ID of processor
+
+ @param[in] ApicBase - APIC base
+ @param[in] ApicVersionNumber - APIC version
+
+ @retval APIC ID of processor
+**/
+UINT32
+GetApicID (
+ OUT EFI_PHYSICAL_ADDRESS *ApicBase OPTIONAL,
+ OUT UINT32 *ApicVersionNumber OPTIONAL
+ );
+
+/**
+ Programs XAPIC registers.
+
+ @param[in] BSP - Is this BSP
+**/
+VOID
+ProgramXApic (
+ IN BOOLEAN BSP
+ );
+
+/**
+ Allocate a temporary memory under 1MB for MP Init to perform INIT-SIPI.
+ This buffer also provides memory for stack/data for MP running.
+
+ @param[in] WakeUpBuffer - Return buffer location
+
+ @retval EFI_SUCCESS if ok to get a memory under 1MB for MP running.
+**/
+EFI_STATUS
+AllocateWakeUpBuffer (
+ OUT EFI_PHYSICAL_ADDRESS *WakeUpBuffer
+ );
+
+///
+/// Assembly functions implemented in MP/HT drivers
+///
+/**
+ Lock APs
+
+ @param[in] Lock - Lock state
+**/
+VOID
+AsmAcquireMPLock (
+ IN UINT8 *Lock
+ );
+
+/**
+ Release APs
+
+ @param[in] Lock - Lock state
+**/
+VOID
+AsmReleaseMPLock (
+ IN UINT8 *Lock
+ );
+
+/**
+ Get GDTR and IDTR
+
+ @param[in] Gdt - will be stored GDTR
+ @param[in] Idt - will be stored IDTR
+**/
+VOID
+AsmGetGdtrIdtr (
+ OUT PSEUDO_DESCRIPTOR **Gdt,
+ OUT PSEUDO_DESCRIPTOR **Idt
+ );
+
+/**
+ Prepare GDTR and IDTR for AP
+
+ @param[in] GDTR - The GDTR profile
+ @param[in] IDTR - The IDTR profile
+
+ @retval EFI_STATUS - status returned by each sub-routine
+ @retval EFI_SUCCESS - GDTR and IDTR has been prepared for AP
+**/
+EFI_STATUS
+PrepareGdtIdtForAP (
+ OUT PSEUDO_DESCRIPTOR *GDTR,
+ OUT PSEUDO_DESCRIPTOR *IDTR
+ );
+
+/**
+ Allocate Reserved Memory
+
+ @param[in] Size - Memory Size
+ @param[in] Alignment - Alignment size
+ @param[in] Pointer - return memory location
+
+ @retval EFI_SUCCESS - Allocate a reserved memory successfully
+**/
+EFI_STATUS
+AllocateAlignedReservedMemory (
+ IN UINTN Size,
+ IN UINTN Alignment,
+ OUT VOID **Pointer
+ );
+
+/**
+ Fill in CPU relevant information into data hub
+
+ @param[in] CpuNumber - CPU number
+ @param[in] CpuDataForDatahub - pointer to data hub that will be updated
+
+ @retval EFI_SUCCESS - always return success
+**/
+EFI_STATUS
+FillinDataforDataHub (
+ IN UINTN CpuNumber,
+ OUT CPU_DATA_FOR_DATAHUB *CpuDataForDatahub
+ );
+
+/**
+ This function is invoked when LegacyBios protocol is installed, we must
+ allocate reserved memory under 1M for AP.
+
+ @param[in] Event - The triggered event.
+ @param[in] Context - Context for this event.
+**/
+VOID
+EFIAPI
+ReAllocateEbdaMemoryForAP (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ );
+
+/**
+ This function is invoked when LegacyBios protocol is installed, we must
+ allocate reserved memory under 1M for AP.
+
+ @param[in] Event - The triggered event.
+ @param[in] Context - Context for this event.
+**/
+VOID
+EFIAPI
+ReAllocateMemoryForAP (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ );
+
+/**
+ This function is invoked by EFI_EVENT_SIGNAL_LEGACY_BOOT.
+ Before booting to legacy OS, reset it with memory allocated
+ by ReAllocateMemoryForAp() and set local APIC correctly.
+
+ @param[in] Event - The triggered event.
+ @param[in] Context - Context for this event.
+**/
+VOID
+ResetAPs (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ );
+
+/**
+ Prepare Wakeup Buffer and stack for APs.
+
+ @param[in] WakeUpBuffer - Pointer to the address of wakeup buffer for output.
+ @param[in] StackAddressStart - Pointer to the stack address of APs for output.
+ @param[in] MaximumCPUsForThisSystem - Maximum CPUs in this system.
+
+ @retval EFI_SUCCESS - Memory successfully prepared for APs.
+ @retval Other - Error occurred while allocating memory.
+**/
+EFI_STATUS
+PrepareMemoryForAPs (
+ OUT EFI_PHYSICAL_ADDRESS *WakeUpBuffer,
+ OUT VOID **StackAddressStart,
+ IN UINTN MaximumCPUsForThisSystem
+ );
+
+/**
+ Prepare exchange information for APs.
+
+ @param[in] ExchangeInfo - Pointer to the exchange info buffer for output.
+ @param[in] StackAddressStart - Start address of APs' stacks.
+ @param[in] ApFunction - Address of function assigned to AP.
+ @param[in] WakeUpBuffer - Pointer to the address of wakeup buffer.
+
+ @retval EFI_SUCCESS - Exchange Info successfully prepared for APs.
+ @retval Other - Error occurred while allocating memory.
+**/
+EFI_STATUS
+PrepareExchangeInfo (
+ OUT MP_CPU_EXCHANGE_INFO *ExchangeInfo,
+ IN VOID *StackAddressStart,
+ IN VOID *ApFunction,
+ IN EFI_PHYSICAL_ADDRESS WakeUpBuffer
+ );
+
+/**
+ Prepare Wakeup Buffer and stack for APs during S3.
+
+ @param[in] WakeUpBuffer - Pointer to the address of wakeup buffer for output.
+ @param[in] StackAddressStart - Pointer to the stack address of APs for output.
+
+ @retval EFI_SUCCESS - Memory successfully prepared for APs.
+**/
+EFI_STATUS
+S3PrepareMemoryForAPs (
+ OUT EFI_PHYSICAL_ADDRESS *WakeUpBuffer,
+ OUT VOID **StackAddressStart
+ );
+
+/**
+ Prepare exchange information for APs during S3.
+
+ @param[in] ExchangeInfo - Pointer to the exchange info for output.
+ @param[in] StackAddressStart - Start address of APs' stacks.
+ @param[in] ApFunction - Address of function assigned to AP.
+ @param[in] WakeUpBuffer - Pointer to the address of wakeup buffer.
+
+ @retval EFI_SUCCESS - Exchange Info successfully prepared for APs.
+**/
+EFI_STATUS
+S3PrepareExchangeInfo (
+ OUT MP_CPU_EXCHANGE_INFO *ExchangeInfo,
+ IN VOID *StackAddressStart,
+ IN VOID *ApFunction,
+ IN EFI_PHYSICAL_ADDRESS WakeUpBuffer
+ );
+
+/**
+ Check whether any AP is running for assigned task.
+
+ @retval TRUE - Some APs are running.
+ @retval FALSE - No AP is running.
+**/
+BOOLEAN
+ApRunning (
+ VOID
+ );
+
+/**
+ Wrapper function for all procedures assigned to AP via MP service protocol.
+ It controls states of AP and invokes assigned precedure.
+**/
+VOID
+ApProcWrapper (
+ VOID
+ );
+
+/**
+ Allocate EfiReservedMemoryType below 4G memory address.
+
+ @param[in] Size - Size of memory to allocate.
+ @param[in] Buffer - Allocated address for output.
+
+ @retval EFI_SUCCESS - Memory successfully allocated.
+ @retval Other - Other errors occur.
+**/
+EFI_STATUS
+AllocateReservedMemoryBelow4G (
+ IN UINTN Size,
+ OUT VOID **Buffer
+ );
+
+/**
+ Dynamically write the far jump destination in APs' wakeup buffer,
+ in order to refresh APs' CS registers for mode switching.
+**/
+VOID
+RedirectFarJump (
+ VOID
+ );
+
+#endif
diff --git a/ReferenceCode/Haswell/CpuInit/Dxe/MpService.c b/ReferenceCode/Haswell/CpuInit/Dxe/MpService.c
new file mode 100644
index 0000000..7979618
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Dxe/MpService.c
@@ -0,0 +1,2194 @@
+/** @file
+ Code which support multi-processor
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "MpService.h"
+#include "PiMpService.h"
+#include "CpuInitDxe.h"
+#include "MachineCheck.h"
+#include "Features.h"
+#include "BootGuardLibrary.h"
+#endif
+
+#include EFI_PROTOCOL_DEFINITION (GenericMemoryTest)
+#include EFI_GUID_DEFINITION (GlobalVariable)
+#include EFI_PROTOCOL_DEFINITION (ExitPmAuth)
+
+extern DXE_CPU_PLATFORM_POLICY_PROTOCOL *mPlatformCpu;
+extern EFI_METRONOME_ARCH_PROTOCOL *mMetronome;
+extern MP_SYSTEM_DATA *mMPSystemData;
+extern UINTN mCommonFeatures;
+extern volatile UINTN mSwitchToLegacyRegionCount;
+extern EFI_CPU_MICROCODE_HEADER **mMicrocodePointerBuffer;
+extern EFI_DATA_HUB_PROTOCOL *mDataHub;
+
+static EFI_HANDLE mHandle = NULL;
+static UINT32 mFinishedCount = 0;
+extern UINT32 mMcuLoadCount;
+STATIC UINT64 mCpuPerfCtrlValue;
+EFI_MP_SERVICES_PROTOCOL mMpService = {
+ GetGeneralMPInfo,
+ GetProcessorContext,
+ StartupAllAPs,
+ StartupThisAP,
+ SwitchBSP,
+ SendIPI,
+ EnableDisableAP,
+ WhoAmI
+};
+
+EFI_PHYSICAL_ADDRESS mOriginalBuffer;
+EFI_PHYSICAL_ADDRESS mBackupBuffer;
+DXE_CPU_INFO_PROTOCOL mCpuInfo;
+
+/**
+ Initialize MP services by MP Service Protocol
+**/
+VOID
+EFIAPI
+InitializeMpServices (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ EFI_EVENT LegacyBootEvent;
+ EFI_EVENT ExitBootServicesEvent;
+ VOID *Registration;
+
+ LegacyBootEvent = NULL;
+ ExitBootServicesEvent = NULL;
+
+ ///
+ /// Save Mtrr Registers in global data areas
+ ///
+ ReadMtrrRegisters ();
+
+ ///
+ /// Initialize and collect MP related data
+ ///
+ Status = InitializeMpSystemData ();
+ if (EFI_ERROR (Status)) {
+ goto Done;
+ }
+
+ ///
+ /// Register protocol notifacation function for ExitPmAuth protocol
+ ///
+ EfiCreateProtocolNotifyEvent (
+ &gExitPmAuthProtocolGuid,
+ TPL_NOTIFY,
+ ReAllocateMemoryForAP,
+ NULL,
+ &Registration
+ );
+
+ ///
+ /// Register protocol notifaction function to allocate memory in EBDA as early as possible
+ ///
+ EfiCreateProtocolNotifyEvent (
+ &gEfiLegacyBiosProtocolGuid,
+ TPL_NOTIFY,
+ ReAllocateEbdaMemoryForAP,
+ NULL,
+ &Registration
+ );
+
+ ///
+ /// Create legacy boot and EFI boot events to reset APs before OS handoff
+ ///
+ Status = EfiCreateEventLegacyBootEx (
+ EFI_TPL_CALLBACK,
+ ResetAPs,
+ mMPSystemData,
+ &LegacyBootEvent
+ );
+ if (EFI_ERROR (Status)) {
+ goto Done;
+ }
+
+ Status = gBS->CreateEvent (
+ EVENT_SIGNAL_EXIT_BOOT_SERVICES,
+ TPL_CALLBACK,
+ ResetAPs,
+ mMPSystemData,
+ &ExitBootServicesEvent
+ );
+ if (EFI_ERROR (Status)) {
+ goto Done;
+ }
+
+ ///
+ /// Create timer event to check AP state for non-blocking execution.
+ ///
+ Status = gBS->CreateEvent (
+ EFI_EVENT_TIMER | EFI_EVENT_NOTIFY_SIGNAL,
+ EFI_TPL_CALLBACK,
+ CheckAPsStatus,
+ NULL,
+ &mMPSystemData->CheckAPsEvent
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Now install the Frameowrk & PI MP services protocol.
+ ///
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &mHandle,
+ &gEfiMpServiceProtocolGuid,
+ &mMpService,
+ &gEfiPiMpServiceProtocolGuid,
+ &mPiMpService,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ Status = gBS->SetTimer (
+ mMPSystemData->CheckAPsEvent,
+ TimerPeriodic,
+ 10000 * MICROSECOND
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ if (EFI_ERROR (Status)) {
+
+Done:
+ if (LegacyBootEvent != NULL) {
+ gBS->CloseEvent (LegacyBootEvent);
+ }
+
+ if (ExitBootServicesEvent != NULL) {
+ gBS->CloseEvent (ExitBootServicesEvent);
+ }
+
+ FreePool (mMPSystemData);
+ }
+}
+
+/**
+ Get general MP information
+
+ @param[in] This - EFI_MP_SERVICE_PROTOCOL
+ @param[in] NumberOfCPUs - Number of processors
+ @param[in] MaximumNumberOfCPUs - Max supported number of processors
+ @param[in] NumberOfEnabledCPUs - Number of processors enabled
+ @param[in] RendezvousIntNumber - number of Rendezvous procedure
+ @param[in] RendezvousProcLength - length of Rendezvous procedure
+
+ @retval EFI_SUCCESS - always return success
+**/
+EFI_STATUS
+EFIAPI
+GetGeneralMPInfo (
+ IN EFI_MP_SERVICES_PROTOCOL *This,
+ OUT UINTN *NumberOfCPUs,
+ OUT UINTN *MaximumNumberOfCPUs,
+ OUT UINTN *NumberOfEnabledCPUs,
+ OUT UINTN *RendezvousIntNumber,
+ OUT UINTN *RendezvousProcLength
+ )
+{
+ UINTN Index;
+ CPU_DATA_BLOCK *CpuData;
+
+ if (NumberOfCPUs) {
+ *NumberOfCPUs = mMPSystemData->NumberOfCpus;
+ }
+
+ if (MaximumNumberOfCPUs) {
+ *MaximumNumberOfCPUs = mMPSystemData->MaximumCpusForThisSystem;
+ }
+
+ if (RendezvousProcLength) {
+ *RendezvousProcLength = RENDEZVOUS_PROC_LENGTH;
+ }
+
+ if (RendezvousIntNumber) {
+ *RendezvousIntNumber = 0;
+ }
+
+ if (NumberOfEnabledCPUs) {
+ *NumberOfEnabledCPUs = 0;
+ for (Index = 0; Index < mMPSystemData->NumberOfCpus; Index++) {
+ CpuData = &mMPSystemData->CpuData[Index];
+ if (mMPSystemData->EnableSecondaryCpu) {
+ if (CpuData->State != CPU_STATE_DISABLED) {
+ (*NumberOfEnabledCPUs)++;
+ }
+ } else {
+ if (CpuData->State != CPU_STATE_DISABLED && !mMPSystemData->CpuData[Index].SecondaryCpu) {
+ (*NumberOfEnabledCPUs)++;
+ }
+ }
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Get processor context
+
+ @param[in] This - EFI_MP_SERVICE_PROTOCOL
+ @param[in] CpuNumber - Cpu number
+ @param[in] BufferLength - buffer length
+ @param[in] ProcessorContextBuffer - pointer to the buffer that will be updated
+
+ @retval EFI_INVALID_PARAMETER - buffer is NULL or CpuNumber our of range
+ @retval EFI_BUFFER_TOO_SMALL - buffer too small
+ @retval EFI_SUCCESS - got processor context successfully
+**/
+EFI_STATUS
+EFIAPI
+GetProcessorContext (
+ IN EFI_MP_SERVICES_PROTOCOL *This,
+ IN UINTN CpuNumber,
+ IN OUT UINTN *BufferLength,
+ IN OUT EFI_MP_PROC_CONTEXT *ProcessorContextBuffer
+ )
+{
+ EFI_MP_PROC_CONTEXT *ProcessorBuffer;
+ CPU_DATA_BLOCK *CpuData;
+
+ if (BufferLength == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (*BufferLength < sizeof (EFI_MP_PROC_CONTEXT)) {
+ *BufferLength = sizeof (EFI_MP_PROC_CONTEXT);
+ return EFI_BUFFER_TOO_SMALL;
+ }
+
+ if ((mMPSystemData->NumberOfCpus <= CpuNumber) || (ProcessorContextBuffer == NULL)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ CpuData = &mMPSystemData->CpuData[CpuNumber];
+
+ *BufferLength = sizeof (EFI_MP_PROC_CONTEXT);
+ ProcessorBuffer = ProcessorContextBuffer;
+
+ ProcessorBuffer->ApicID = CpuData->ApicID;
+
+ ProcessorBuffer->Enabled = TRUE;
+ if (!mMPSystemData->EnableSecondaryCpu) {
+ if (CpuData->SecondaryCpu) {
+ ProcessorBuffer->Enabled = FALSE;
+ }
+ }
+
+ if (CpuData->State == CPU_STATE_DISABLED) {
+ ProcessorBuffer->Enabled = FALSE;
+ }
+
+ if (CpuNumber == mMPSystemData->BSP) {
+ ProcessorBuffer->Designation = EfiCpuBSP;
+ } else {
+ ProcessorBuffer->Designation = EfiCpuAP;
+ }
+
+ ProcessorBuffer->Health.Flags = CpuData->Health;
+ ProcessorBuffer->Health.TestStatus = 0;
+
+ ProcessorBuffer->PackageNumber = CpuData->CpuDataforDatahub.Location.Package;
+ ProcessorBuffer->NumberOfCores = CpuData->CpuDataforDatahub.Location.Core;
+ ProcessorBuffer->NumberOfThreads = CpuData->CpuDataforDatahub.Location.Thread;
+ ProcessorBuffer->ProcessorTestMask = 0;
+
+ return EFI_SUCCESS;
+}
+
+/**
+ MP Service to get specified application processor (AP)
+ to execute a caller-provided code stream.
+
+ @param[in] This - Pointer to MP Service Protocol
+ @param[in] Procedure - The procedure to be assigned to AP.
+ @param[in] CpuNumber - Number of the specified processor.
+ @param[in] WaitEvent - If timeout, the event to be triggered after this AP finishes.
+ @param[in] TimeoutInMicroSecs - The timeout value in microsecond. Zero means infinity.
+ @param[in] ProcArguments - Argument for Procedure.
+
+ @retval EFI_INVALID_PARAMETER - Procudure is NULL.
+ @retval EFI_INVALID_PARAMETER - Number of CPU out of range, or it belongs to BSP.
+ @retval EFI_INVALID_PARAMETER - Specified CPU is not idle.
+ @retval EFI_SUCCESS - The AP has finished.
+ @retval EFI_TIMEOUT - Time goes out before the AP has finished.
+**/
+EFI_STATUS
+EFIAPI
+StartupThisAP (
+ IN EFI_MP_SERVICES_PROTOCOL *This,
+ IN EFI_AP_PROCEDURE Procedure,
+ IN UINTN CpuNumber,
+ IN EFI_EVENT WaitEvent OPTIONAL,
+ IN UINTN TimeoutInMicroSecs OPTIONAL,
+ IN OUT VOID *ProcArguments OPTIONAL
+ )
+{
+ EFI_STATUS Status;
+ CPU_DATA_BLOCK *CpuData;
+ UINT64 ExpectedTime;
+
+ ///
+ /// Check for invalid CPU number
+ ///
+ if ((CpuNumber >= mMPSystemData->NumberOfCpus) || CpuNumber == mMPSystemData->BSP) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (Procedure == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ CpuData = &mMPSystemData->CpuData[CpuNumber];
+
+ ///
+ /// As a first step, check if processor is OK to start up code stream.
+ ///
+ if (CpuData->State != CPU_STATE_IDLE) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ ExpectedTime = CalculateTimeout (TimeoutInMicroSecs);
+
+ mMPSystemData->StartCount = 1;
+ mMPSystemData->FinishCount = 0;
+
+ WakeUpAp (
+ CpuData,
+ Procedure,
+ ProcArguments
+ );
+
+ while (TRUE) {
+ AsmAcquireMPLock (&CpuData->StateLock);
+ if (CpuData->State == CPU_STATE_FINISHED) {
+ CpuData->State = CPU_STATE_IDLE;
+ AsmReleaseMPLock (&CpuData->StateLock);
+ break;
+ }
+
+ AsmReleaseMPLock (&CpuData->StateLock);
+
+ if (CheckTimeout (ExpectedTime)) {
+ ///
+ /// Save data into private data structure, and create timer to poll AP state before exiting
+ ///
+ mMPSystemData->WaitEvent = WaitEvent;
+ Status = gBS->SetTimer (
+ CpuData->CheckThisAPEvent,
+ TimerPeriodic,
+ CPU_CHECK_AP_INTERVAL * MICROSECOND
+ );
+ return EFI_TIMEOUT;
+ }
+
+ gBS->Stall (CPU_CHECK_AP_INTERVAL);
+ }
+
+ if (WaitEvent) gBS->SignalEvent (WaitEvent); //(AMI_CHG)
+ return EFI_SUCCESS;
+}
+
+/**
+ MP Service to get all the available application processors (APs)
+ to execute a caller-provided code stream.
+
+ @param[in] This - Pointer to MP Service Protocol
+ @param[in] Procedure - The procedure to be assigned to APs.
+ @param[in] SingleThread - If true, all APs execute in block mode.
+ Otherwise, all APs exceute in non-block mode.
+ @param[in] WaitEvent - If timeout, the event to be triggered after all APs finish.
+ @param[in] TimeoutInMicroSecs - The timeout value in microsecond. Zero means infinity.
+ @param[in] ProcArguments - Argument for Procedure.
+ @param[in] FailedCPUList - If not NULL, all APs that fail to start will be recorded in the list.
+
+ @retval EFI_INVALID_PARAMETER - Procudure is NULL.
+ @retval EFI_SUCCESS - Only 1 logical processor exists.
+ @retval EFI_SUCCESS - All APs have finished.
+ @retval EFI_TIMEOUT - Time goes out before all APs have finished.
+**/
+EFI_STATUS
+EFIAPI
+StartupAllAPs (
+ IN EFI_MP_SERVICES_PROTOCOL *This,
+ IN EFI_AP_PROCEDURE Procedure,
+ IN BOOLEAN SingleThread,
+ IN EFI_EVENT WaitEvent OPTIONAL,
+ IN UINTN TimeoutInMicroSecs OPTIONAL,
+ IN OUT VOID *ProcArguments OPTIONAL,
+ OUT UINTN *FailedCPUList OPTIONAL
+ )
+{
+ EFI_STATUS Status;
+ CPU_DATA_BLOCK *CpuData;
+ CPU_DATA_BLOCK *NextCpuData;
+ UINTN ListIndex;
+ UINTN CpuNumber;
+ UINTN NextCpuNumber;
+ UINT64 ExpectedTime;
+ CPU_STATE APInitialState;
+ CPU_STATE CpuState;
+
+ ///
+ /// Check for valid procedure for APs
+ ///
+ if (Procedure == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (mMPSystemData->NumberOfCpus == 1) {
+ if (WaitEvent) gBS->SignalEvent (WaitEvent); //(AMI_CHG)
+ return EFI_SUCCESS;
+ }
+
+// AMI Override: Add
+ //
+ // Check whether all enabled APs are idle.
+ // If any enabled AP is not idle, return EFI_NOT_READY.
+ //
+ for (CpuNumber = 0; CpuNumber < mMPSystemData->NumberOfCpus; CpuNumber++) {
+
+ CpuData = &mMPSystemData->CpuData[CpuNumber];
+
+ //
+ // Skip BSP and disabled APs.
+ //
+ if (CpuNumber == mMPSystemData->BSP ||
+ CpuData->State == CPU_STATE_DISABLED) {
+ continue;
+ }
+
+ //
+ // If any enabled APs are busy, return EFI_NOT_FOUND.
+ //
+ if (CpuData->State != CPU_STATE_IDLE) {
+ return EFI_NOT_READY;
+ }
+ }
+ //
+ // All enabled APs are idle, we can safely initiate a new session
+ //
+// AMI Override: End
+ ExpectedTime = CalculateTimeout (TimeoutInMicroSecs);
+
+ ListIndex = 0;
+ CpuData = NULL;
+
+ mMPSystemData->FinishCount = 0;
+ mMPSystemData->StartCount = 0;
+ APInitialState = CPU_STATE_READY;
+
+ for (CpuNumber = 0; CpuNumber < mMPSystemData->NumberOfCpus; CpuNumber++) {
+ CpuData = &mMPSystemData->CpuData[CpuNumber];
+
+ ///
+ /// Get APs prepared, and put failing APs into FailedCPUList
+ /// If "SingleThread", one AP will be put to ready state.
+ /// Once this AP finishes its task, the next AP is put to Ready state.
+ /// This process continues until all APs are put into Ready State
+ /// if not "SingleThread", all APs are put to ready state at the same time
+ ///
+ if (CpuNumber != mMPSystemData->BSP) {
+ if (CpuData->State == CPU_STATE_IDLE) {
+ mMPSystemData->StartCount++;
+
+ AsmAcquireMPLock (&CpuData->StateLock);
+ CpuData->State = APInitialState;
+ AsmReleaseMPLock (&CpuData->StateLock);
+
+ if (SingleThread) {
+ APInitialState = CPU_STATE_BLOCKED;
+ }
+
+ } else if (FailedCPUList != NULL) {
+ FailedCPUList[ListIndex] = CpuNumber;
+ ListIndex++;
+ }
+ }
+ }
+
+ while (TRUE) {
+ for (CpuNumber = 0; CpuNumber < mMPSystemData->NumberOfCpus; CpuNumber++) {
+ CpuData = &mMPSystemData->CpuData[CpuNumber];
+ if (CpuNumber == mMPSystemData->BSP) {
+ continue;
+ }
+ CpuState = CpuData->State;
+ switch (CpuState) {
+ case CPU_STATE_READY:
+ WakeUpAp (
+ CpuData,
+ Procedure,
+ ProcArguments
+ );
+ break;
+
+ case CPU_STATE_FINISHED:
+ mMPSystemData->FinishCount++;
+ if (SingleThread) {
+ Status = GetNextBlockedCpuNumber (&NextCpuNumber);
+ if (!EFI_ERROR (Status)) {
+ NextCpuData = &mMPSystemData->CpuData[NextCpuNumber];
+ AsmAcquireMPLock (&NextCpuData->StateLock);
+ NextCpuData->State = CPU_STATE_READY;
+ AsmReleaseMPLock (&NextCpuData->StateLock);
+ }
+ }
+ AsmAcquireMPLock (&CpuData->StateLock);
+ CpuData->State = CPU_STATE_IDLE;
+ AsmReleaseMPLock (&CpuData->StateLock);
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ if (mMPSystemData->FinishCount == mMPSystemData->StartCount) {
+ if (WaitEvent) gBS->SignalEvent (WaitEvent); //(AMI_CHG)
+ return EFI_SUCCESS;
+ }
+
+ if (CheckTimeout (ExpectedTime)) {
+ ///
+ /// Save data into private data structure, and create timer to poll AP state before exiting
+ ///
+ mMPSystemData->Procedure = Procedure;
+ mMPSystemData->ProcArguments = ProcArguments;
+ mMPSystemData->SingleThread = SingleThread;
+ mMPSystemData->WaitEvent = WaitEvent;
+
+ Status = gBS->SetTimer (
+ mMPSystemData->CheckAllAPsEvent,
+ TimerPeriodic,
+ CPU_CHECK_AP_INTERVAL * MICROSECOND
+ );
+ return EFI_TIMEOUT;
+ }
+
+ gBS->Stall (CPU_CHECK_AP_INTERVAL);
+ }
+
+ if (WaitEvent) gBS->SignalEvent (WaitEvent); //(AMI_CHG)
+ return EFI_SUCCESS;
+}
+
+/**
+ MP Service to makes the current BSP into an AP and then switches the
+ designated AP into the AP. This procedure is usually called after a CPU
+ test that has found that BSP is not healthy to continue it's responsbilities.
+
+ @param[in] This - Pointer to MP Service Protocol.
+ @param[in] CpuNumber - The number of the specified AP.
+ @param[in] EnableOldBSP - Whether to enable or disable the original BSP.
+
+ @retval EFI_INVALID_PARAMETER - Number for Specified AP out of range.
+ @retval EFI_INVALID_PARAMETER - Number of specified CPU belongs to BSP.
+ @retval EFI_NOT_READY - Specified AP is not idle.
+ @retval EFI_SUCCESS - BSP successfully switched.
+**/
+EFI_STATUS
+EFIAPI
+SwitchBSP (
+ IN EFI_MP_SERVICES_PROTOCOL *This,
+ IN UINTN CpuNumber,
+ IN BOOLEAN EnableOldBSP
+ )
+{
+ EFI_STATUS Status;
+ EFI_CPU_ARCH_PROTOCOL *CpuArch;
+ BOOLEAN OldInterruptState;
+ CPU_DATA_BLOCK *CpuData;
+ CPU_STATE CpuState;
+
+ ///
+ /// Check if the specified CPU number is valid
+ ///
+ if (CpuNumber >= mMPSystemData->NumberOfCpus) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ ///
+ /// Check if the specified CPU is already BSP
+ ///
+ if (CpuNumber == mMPSystemData->BSP) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ CpuData = &mMPSystemData->CpuData[CpuNumber];
+ if (CpuData->State != CPU_STATE_IDLE) {
+ return EFI_NOT_READY;
+ }
+ ///
+ /// Before send both BSP and AP to a procedure to exchange their roles,
+ /// interrupt must be disabled. This is because during the exchange role
+ /// process, 2 CPU may use 1 stack. If interrupt happens, the stack will
+ /// be corrputed, since interrupt return address will be pushed to stack
+ /// by hardware.
+ ///
+ CpuArch = mMPSystemData->CpuArch;
+ (CpuArch->GetInterruptState)(CpuArch, &OldInterruptState);
+ if (OldInterruptState) {
+ Status = CpuArch->DisableInterrupt (CpuArch);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ }
+
+ ///
+ /// Unprogram virtual wire mode for the old BSP
+ ///
+ ProgramXApic (FALSE);
+ SetApicBSPBit (FALSE);
+
+ mMPSystemData->BSPInfo.State = CPU_SWITCH_STATE_IDLE;
+ mMPSystemData->BSPInfo.Lock = VacantFlag;
+ mMPSystemData->APInfo.State = CPU_SWITCH_STATE_IDLE;
+ mMPSystemData->APInfo.Lock = VacantFlag;
+
+ ///
+ /// Need to wakeUp AP (future BSP)
+ ///
+ WakeUpAp (
+ CpuData,
+ FutureBSPProc,
+ mMPSystemData
+ );
+
+ AsmExchangeRole (&mMPSystemData->BSPInfo, &mMPSystemData->APInfo);
+
+ ///
+ /// The new BSP has come out. Since it carries the register value of the AP, need
+ /// to pay attention to variable which are stored in registers (due to optimization)
+ ///
+ SetApicBSPBit (TRUE);
+ ProgramXApic (TRUE);
+
+ if (OldInterruptState) {
+ Status = CpuArch->EnableInterrupt (CpuArch);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ }
+
+ CpuData = &mMPSystemData->CpuData[mMPSystemData->BSP];
+ while (TRUE) {
+ AsmAcquireMPLock (&CpuData->StateLock);
+ CpuState = CpuData->State;
+ AsmReleaseMPLock (&CpuData->StateLock);
+
+ if (CpuState == CPU_STATE_FINISHED) {
+ break;
+ }
+ }
+
+ Status = ChangeCpuState (mMPSystemData->BSP, EnableOldBSP, CPU_CAUSE_NOT_DISABLED);
+ mMPSystemData->BSP = CpuNumber;
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This procedure sends an IPI to the designated processor in
+ the requested delivery mode with the requested vector.
+
+ @param[in] This - Pointer to MP Service Protocol.
+ @param[in] CpuNumber - The number of the specified AP.
+ @param[in] VectorNumber - Vector number.
+ @param[in] DeliveryMode - I/O APIC Interrupt Deliver Modes
+
+ @retval EFI_INVALID_PARAMETER - Input paramters were not correct.
+ @retval Other status - Status returned by SendInterrupt ()
+**/
+EFI_STATUS
+EFIAPI
+SendIPI (
+ IN EFI_MP_SERVICES_PROTOCOL *This,
+ IN UINTN CpuNumber,
+ IN UINTN VectorNumber,
+ IN UINTN DeliveryMode
+ )
+{
+ UINT32 TriggerMode;
+ EFI_STATUS Status;
+ CPU_DATA_BLOCK *CpuData;
+ MP_CPU_EXCHANGE_INFO *ExchangeInfo;
+ MONITOR_MWAIT_DATA *MonitorAddr;
+
+ ///
+ /// Check for valid input parameters.
+ ///
+ if (CpuNumber >= mMPSystemData->NumberOfCpus || CpuNumber == mMPSystemData->BSP) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (VectorNumber >= INTERRUPT_VECTOR_NUMBER) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (DeliveryMode >= DELIVERY_MODE_MAX) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ CpuData = &mMPSystemData->CpuData[CpuNumber];
+ TriggerMode = TRIGGER_MODE_EDGE;
+
+ ///
+ /// Fix the vector number for special interrupts like SMI and INIT.
+ ///
+ if (DeliveryMode == DELIVERY_MODE_SMI || DeliveryMode == DELIVERY_MODE_INIT) {
+ VectorNumber = 0x0;
+ }
+
+ ///
+ /// If current waking manner is not HLT loop and some other DXE driver
+ /// like as TXT needs to send INIT command per this MpService routine,
+ /// then we need to set vector change flag for the specific AP to back
+ /// to MWAIT or RUN loop procedure, so additional INIT-SIPI command
+ /// will be sent in WakeUpAp routine for AP tasks to work later.
+ ///
+ ExchangeInfo = (MP_CPU_EXCHANGE_INFO *) (UINTN) (mAcpiCpuData->WakeUpBuffer + MP_CPU_EXCHANGE_INFO_OFFSET);
+ if (ExchangeInfo->WakeUpApManner != WakeUpApPerHltLoop && DeliveryMode == DELIVERY_MODE_INIT) {
+ MonitorAddr = (MONITOR_MWAIT_DATA *)
+ (
+ (UINT8 *) ExchangeInfo->StackStart +
+ (ExchangeInfo->BistBuffer[CpuData->ApicID].Number + 1) *
+ ExchangeInfo->StackSize -
+ MONITOR_FILTER_SIZE
+ );
+ MonitorAddr->WakeUpApVectorChangeFlag = TRUE;
+ }
+
+ Status = SendInterrupt (
+ BROADCAST_MODE_SPECIFY_CPU,
+ CpuData->ApicID,
+ (UINT32) VectorNumber,
+ (UINT32) DeliveryMode,
+ TriggerMode,
+ TRUE
+ );
+
+ return Status;
+}
+
+/**
+ This procedure enables Or disables APs.
+
+ @param[in] This - Pointer to MP Service Protocol.
+ @param[in] CpuNumber - The number of the specified AP.
+ @param[in] NewAPState - Indicate new desired AP state
+ @param[in] HealthState - If not NULL, it points to the value that specifies
+ the new health status of the AP. If it is NULL,
+ this parameter is ignored.
+
+ @retval EFI_INVALID_PARAMETER - Input paramters were not correct.
+ @retval EFI_SUCCESS - Function completed successfully
+**/
+EFI_STATUS
+EFIAPI
+EnableDisableAP (
+ IN EFI_MP_SERVICES_PROTOCOL *This,
+ IN UINTN CpuNumber,
+ IN BOOLEAN NewAPState,
+ IN EFI_MP_HEALTH *HealthState OPTIONAL
+ )
+{
+ EFI_STATUS Status;
+ CPU_DATA_BLOCK *CpuData;
+
+ ///
+ /// Check for valid input parameters.
+ ///
+ if (CpuNumber >= mMPSystemData->NumberOfCpus || CpuNumber == mMPSystemData->BSP) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ CpuData = &mMPSystemData->CpuData[CpuNumber];
+ Status = ChangeCpuState (CpuNumber, NewAPState, CPU_CAUSE_USER_SELECTION);
+
+ if (HealthState != NULL) {
+ CopyMem (&CpuData->Health, HealthState, sizeof (EFI_MP_HEALTH));
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This procedure returns the calling CPU handle.
+
+ @param[in] This - Pointer to MP Service Protocol.
+ @param[in] CpuNumber - The number of the specified AP.
+
+ @retval EFI_SUCCESS - Function completed successfully
+**/
+EFI_STATUS
+EFIAPI
+WhoAmI (
+ IN EFI_MP_SERVICES_PROTOCOL *This,
+ OUT UINTN *CpuNumber
+ )
+{
+ UINTN ApicID;
+ UINTN NumOfCpus;
+ UINTN Index;
+
+ ApicID = GetApicID (NULL, NULL);
+
+ NumOfCpus = mMPSystemData->NumberOfCpus;
+
+ for (Index = 0; Index < NumOfCpus; Index++) {
+ if (ApicID == mMPSystemData->CpuData[Index].ApicID) {
+ break;
+ }
+ }
+
+ *CpuNumber = Index;
+ return EFI_SUCCESS;
+}
+
+/**
+ Searches the HOB list provided by the core to find
+ if a MP guided HOB list exists or not. If it does, it copies it to the driver
+ data area, else returns 0
+
+ @param[in] MPSystemData - Pointer to an MP_SYSTEM_DATA structure
+
+ @retval EFI_SUCCESS - Success
+ @retval EFI_NOT_FOUND - HOB not found or else
+**/
+EFI_STATUS
+GetMpBistStatus (
+ IN MP_SYSTEM_DATA *MPSystemData
+ )
+{
+ VOID *HobList;
+ VOID *DataInHob;
+ EFI_PEI_HOB_POINTERS Hob;
+ UINTN DataSize;
+
+ ///
+ /// Check for MP Data Hob.
+ ///
+ HobList = GetFirstGuidHob (&gEfiHtBistHobGuid);
+
+ if (HobList == NULL) {
+ DEBUG ((EFI_D_ERROR, "No HOBs found\n"));
+ return EFI_NOT_FOUND;
+ }
+
+ DataInHob = (VOID *) ((UINTN) HobList + sizeof (EFI_HOB_GUID_TYPE));
+
+ Hob.Header = HobList;
+ DataSize = Hob.Header->HobLength - sizeof (EFI_HOB_GUID_TYPE);
+
+ ///
+ /// This is the MP HOB. So, copy all the data
+ ///
+ if (HobList != NULL) {
+ if (NULL == MPSystemData->BistHobData) {
+ (gBS->AllocatePool)(EfiReservedMemoryType, DataSize, (VOID **) &MPSystemData->BistHobData);
+ }
+
+ CopyMem (MPSystemData->BistHobData, DataInHob, DataSize);
+ MPSystemData->BistHobSize = DataSize;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Check if CPUID support large than 3
+
+ @retval TRUE if CPUID support large than 3
+ @retval FALSE if not
+**/
+BOOLEAN
+IsCpuidSupportOver3 (
+ VOID
+ )
+{
+ BOOLEAN RetVal;
+ EFI_CPUID_REGISTER CpuidRegisters;
+ RetVal = FALSE;
+ AsmCpuid (
+ CPUID_SIGNATURE,
+ &CpuidRegisters.RegEax,
+ &CpuidRegisters.RegEbx,
+ &CpuidRegisters.RegEcx,
+ &CpuidRegisters.RegEdx
+ );
+ if (CpuidRegisters.RegEax > 3) {
+ RetVal = TRUE;
+ }
+
+ return RetVal;
+}
+
+/**
+ Allocate data pool for MP information and fill data in it.
+
+ @param[in] WakeUpBuffer - The address of wakeup buffer.
+ @param[in] StackAddressStart - The start address of APs's stacks.
+ @param[in] MaximumCPUsForThisSystem - Maximum CPUs in this system.
+
+ @retval EFI_SUCCESS - Function successfully executed.
+ @retval Other - Error occurred while allocating memory.
+**/
+EFI_STATUS
+FillMPData (
+ OUT EFI_PHYSICAL_ADDRESS WakeUpBuffer,
+ OUT VOID *StackAddressStart,
+ IN UINTN MaximumCPUsForThisSystem
+ )
+{
+ EFI_STATUS Status;
+
+ ///
+ /// First check if the MP data structures and AP rendezvous routine have been
+ /// supplied by the PEIMs that executed in early boot stage.
+ ///
+ ///
+ /// Clear the data structure area first.
+ ///
+ ZeroMem (mMPSystemData, sizeof (MP_SYSTEM_DATA));
+
+ Status = GetMpBistStatus (mMPSystemData);
+
+ mAcpiCpuData->CpuPrivateData = (EFI_PHYSICAL_ADDRESS) (UINTN) (&(mMPSystemData->S3DataPointer));
+ mAcpiCpuData->APState = mPlatformCpu->CpuConfig->HtState;
+ mAcpiCpuData->WakeUpBuffer = WakeUpBuffer;
+ mAcpiCpuData->StackAddress = (EFI_PHYSICAL_ADDRESS) StackAddressStart;
+
+ Status = PrepareGdtIdtForAP (
+ (PSEUDO_DESCRIPTOR *) (UINTN) mAcpiCpuData->GdtrProfile,
+ (PSEUDO_DESCRIPTOR *) (UINTN) mAcpiCpuData->IdtrProfile
+ );
+
+ ///
+ /// First BSP fills and inits all known values, including it's own records.
+ ///
+ mMPSystemData->APSerializeLock = VacantFlag;
+ mMPSystemData->NumberOfCpus = 1;
+ mMPSystemData->EnableSecondaryCpu = mPlatformCpu->CpuConfig->HtState;
+
+ ///
+ /// Record these CPU configuration data (both for normal boot and for S3 use)
+ ///
+ if (IsCpuidSupportOver3 ()) {
+ mMPSystemData->LimitCpuidMaximumValue = mPlatformCpu->CpuConfig->LimitCpuidMaximumValue;
+ } else {
+ mMPSystemData->LimitCpuidMaximumValue = FALSE;
+ }
+
+ mMPSystemData->ExecuteDisableBit = mPlatformCpu->CpuConfig->ExecuteDisableBit;
+ mMPSystemData->VmxEnable = mPlatformCpu->CpuConfig->VmxEnable;
+ mMPSystemData->TxtEnable = mPlatformCpu->CpuConfig->SmxEnable;
+ mMPSystemData->MonitorMwaitEnable = mPlatformCpu->CpuConfig->MonitorMwaitEnable;
+ mMPSystemData->MachineCheckEnable = mPlatformCpu->CpuConfig->MachineCheckEnable;
+ mMPSystemData->XapicEnable = mPlatformCpu->CpuConfig->XapicEnable;
+ mMPSystemData->AesEnable = mPlatformCpu->CpuConfig->AesEnable;
+ mMPSystemData->DebugInterfaceEnable = 0;
+ mMPSystemData->DebugInterfaceLockEnable = 1;
+ if (mPlatformCpu->Revision >= DXE_PLATFORM_CPU_POLICY_PROTOCOL_REVISION_2) {
+ mMPSystemData->DebugInterfaceEnable = mPlatformCpu->CpuConfig->DebugInterfaceEnable;
+ mMPSystemData->DebugInterfaceLockEnable = mPlatformCpu->CpuConfig->DebugInterfaceLockEnable;
+ }
+
+ mMPSystemData->S3DataPointer.S3BootScriptTable = (UINT32) (UINTN) mMPSystemData->S3BootScriptTable;
+ mMPSystemData->S3DataPointer.S3BspMtrrTable = (UINT32) (UINTN) mMPSystemData->S3BspMtrrTable;
+
+ mMPSystemData->CpuArch = NULL;
+ gBS->LocateProtocol (&gEfiCpuArchProtocolGuid, NULL, (VOID **) &mMPSystemData->CpuArch);
+
+ mMPSystemData->MaximumCpusForThisSystem = MaximumCPUsForThisSystem;
+
+ mMPSystemData->BSP = 0;
+
+ ///
+ /// Save Mtrr Register for S3 resume
+ ///
+ SaveBspMtrrForS3 ();
+
+ FillInProcessorInformation (mMPSystemData, TRUE, 0);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Wake up APs for the first time to count their number and collect BIST data.
+
+ @param[in] WakeUpBuffer - Address of the wakeup buffer.
+
+ @retval EFI_SUCCESS - Function successfully finishes.
+**/
+EFI_STATUS
+CountApNumberAndCollectBist (
+ IN EFI_PHYSICAL_ADDRESS WakeUpBuffer
+ )
+{
+ MP_CPU_EXCHANGE_INFO *ExchangeInfo;
+ UINTN Index;
+ UINT64 MsrValue;
+ UINT64 ProcessorThreadCount;
+ UINT32 ResponseProcessorCount;
+ UINTN TimeoutTime;
+
+ ///
+ /// Send INIT IPI - SIPI to all APs
+ ///
+ SendInterrupt (
+ BROADCAST_MODE_ALL_EXCLUDING_SELF,
+ 0,
+ 0,
+ DELIVERY_MODE_INIT,
+ TRIGGER_MODE_EDGE,
+ TRUE
+ );
+ gBS->Stall (10 * STALL_ONE_MILLI_SECOND);
+ SendInterrupt (
+ BROADCAST_MODE_ALL_EXCLUDING_SELF,
+ 0,
+ (UINT32) RShiftU64 (WakeUpBuffer,
+ 12),
+ DELIVERY_MODE_SIPI,
+ TRIGGER_MODE_EDGE,
+ TRUE
+ );
+ gBS->Stall (200 * STALL_ONE_MICRO_SECOND);
+ SendInterrupt (
+ BROADCAST_MODE_ALL_EXCLUDING_SELF,
+ 0,
+ (UINT32) RShiftU64 (WakeUpBuffer,
+ 12),
+ DELIVERY_MODE_SIPI,
+ TRIGGER_MODE_EDGE,
+ TRUE
+ );
+ gBS->Stall (200 * STALL_ONE_MICRO_SECOND);
+ ExchangeInfo = (MP_CPU_EXCHANGE_INFO *) (UINTN) (WakeUpBuffer + MP_CPU_EXCHANGE_INFO_OFFSET);
+
+ ///
+ /// Get thread count
+ ///
+ MsrValue = AsmReadMsr64 (MSR_CORE_THREAD_COUNT);
+ ProcessorThreadCount = MsrValue & 0xffff;
+
+ ///
+ /// Only support MAXIMUM_CPU_NUMBER threads so far
+ ///
+ ASSERT (ProcessorThreadCount <= MAXIMUM_CPU_NUMBER);
+ if (ProcessorThreadCount > MAXIMUM_CPU_NUMBER) {
+ ProcessorThreadCount = MAXIMUM_CPU_NUMBER;
+ }
+
+ for (TimeoutTime = 0; TimeoutTime <= CPU_WAIT_FOR_TASK_TO_BE_COMPLETED; TimeoutTime += CPU_CHECK_AP_INTERVAL) {
+ ///
+ /// Wait for task to complete and then exit.
+ ///
+ gBS->Stall (CPU_CHECK_AP_INTERVAL);
+ for (Index = 1, ResponseProcessorCount = 1; Index < MAXIMUM_CPU_NUMBER; Index++) {
+ if (ExchangeInfo->BistBuffer[Index].Number == 1) {
+ ResponseProcessorCount++;
+ }
+ }
+
+ if (ResponseProcessorCount == ProcessorThreadCount) {
+ break;
+ }
+ }
+
+ for (Index = 0; Index < MAXIMUM_CPU_NUMBER; Index++) {
+ if (ExchangeInfo->BistBuffer[Index].Number == 1) {
+ ExchangeInfo->BistBuffer[Index].Number = (UINT32) mMPSystemData->NumberOfCpus++;
+ }
+ }
+
+ mAcpiCpuData->NumberOfCpus = (UINT32) mMPSystemData->NumberOfCpus;
+
+ ExchangeInfo->InitFlag = 0;
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Wake up APs for the second time to collect detailed information.
+
+ @param[in] WakeUpBuffer - Address of the wakeup buffer.
+
+ @retval EFI_SUCCESS - Function successfully finishes.
+**/
+EFI_STATUS
+PollForInitialization (
+ IN EFI_PHYSICAL_ADDRESS WakeUpBuffer
+ )
+{
+ MP_CPU_EXCHANGE_INFO *ExchangeInfo;
+ UINT32 FailedRevision;
+ EFI_STATUS Status;
+
+ ExchangeInfo = (MP_CPU_EXCHANGE_INFO *) (UINTN) (WakeUpBuffer + MP_CPU_EXCHANGE_INFO_OFFSET);
+
+ ExchangeInfo->ApFunction = (VOID *) (UINTN) DetailedMpInitialization;
+
+ CpuInitFloatPointUnit ();
+
+ ///
+ /// Update microcode for BSP
+ ///
+ mMcuLoadCount = 0;
+ Status = InitializeMicrocode (mMicrocodePointerBuffer, &FailedRevision);
+ if (Status == EFI_LOAD_ERROR) {
+ DEBUG((EFI_D_INFO,"Failed to load microcode patch\n"));
+ }
+
+ ///
+ /// Wait until all APs finish
+ ///
+ while (mFinishedCount < mAcpiCpuData->NumberOfCpus - 1) {
+ CpuPause ();
+ }
+
+ McuFirstLoadDone ();
+ return EFI_SUCCESS;
+}
+
+/**
+ Callback function to initialize MP data hub
+
+ @param[in] Event - Event whose notification function is being invoked.
+ @param[in] Context - Pointer to the notification functions context, which is implementation dependent.
+**/
+VOID
+EFIAPI
+MpDataHubCallback (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ CPU_DATA_FOR_DATAHUB *CpuDataforDatahub;
+ UINTN Index;
+ EFI_STATUS Status;
+
+ Status = InitializeDataHubPtr (&mDataHub);
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+
+ for (Index = 0; Index < mMPSystemData->NumberOfCpus; Index++) {
+ CpuDataforDatahub = &mMPSystemData->CpuData[Index].CpuDataforDatahub;
+ UpdateDataforDatahub (Index, CpuDataforDatahub);
+ }
+
+}
+
+/**
+ Initialize multiple processors and collect MP related data
+
+ @retval EFI_SUCCESS - Multiple processors get initialized and data collected successfully
+ @retval Other - The operation failed and appropriate error status will be returned
+**/
+EFI_STATUS
+InitializeMpSystemData (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ UINT32 MaxThreadsPerCore;
+ UINT32 MaxCoresPerDie;
+ UINT32 MaxDiesPerPackage;
+ UINT32 MaxPackages;
+
+ VOID *StackAddressStart;
+ EFI_PHYSICAL_ADDRESS WakeUpBuffer;
+ MP_CPU_EXCHANGE_INFO *ExchangeInfo;
+ UINTN Index;
+
+ EFI_CPU_ARCH_PROTOCOL *CpuArch;
+ BOOLEAN mInterruptState;
+ CPU_DATA_BLOCK *CpuData;
+ UINTN MaximumCPUsForThisSystem;
+ VOID *Registration;
+ EFI_HANDLE Handle;
+
+ Handle = NULL;
+
+ ///
+ /// Program Local APIC registers
+ ///
+ ProgramXApic (TRUE);
+
+ ///
+ /// Get information on threads, cores, dies and package for the CPU(s) on this platform
+ ///
+ Status = mPlatformCpu->CpuConfig->GetMaxCount (
+ mPlatformCpu,
+ &MaxThreadsPerCore,
+ &MaxCoresPerDie,
+ &MaxDiesPerPackage,
+ &MaxPackages
+ );
+ ///
+ /// Get the total CPU count
+ ///
+ if (!EFI_ERROR (Status)) {
+ MaximumCPUsForThisSystem = MaxThreadsPerCore * MaxCoresPerDie * MaxDiesPerPackage * MaxPackages;
+ } else {
+ MaximumCPUsForThisSystem = MAXIMUM_CPU_NUMBER;
+ }
+
+ ///
+ /// Prepare Wakeup Buffer and Stack for APs
+ ///
+ Status = PrepareMemoryForAPs (
+ &WakeUpBuffer,
+ &StackAddressStart,
+ MaximumCPUsForThisSystem
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ mOriginalBuffer = WakeUpBuffer;
+ Status = (gBS->AllocatePages)(AllocateAnyPages, EfiBootServicesData, 1, &mBackupBuffer);
+
+ ///
+ /// Fill MP Data
+ ///
+ FillMPData (
+ WakeUpBuffer,
+ StackAddressStart,
+ MaximumCPUsForThisSystem
+ );
+
+ ///
+ /// Prepare exchange information for APs
+ ///
+ ExchangeInfo = (MP_CPU_EXCHANGE_INFO *) (UINTN) (WakeUpBuffer + MP_CPU_EXCHANGE_INFO_OFFSET);
+ PrepareExchangeInfo (
+ ExchangeInfo,
+ StackAddressStart,
+ NULL,
+ WakeUpBuffer
+ );
+
+ ReportStatusCode (
+ EFI_PROGRESS_CODE,
+ EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_PC_AP_INIT
+ );
+
+ CpuArch = mMPSystemData->CpuArch;
+ (CpuArch->GetInterruptState)(CpuArch, &mInterruptState);
+ CpuArch->DisableInterrupt (CpuArch);
+
+ ///
+ /// Get BSP Performance Control setting
+ ///
+ mCpuPerfCtrlValue = AsmReadMsr64 (MSR_IA32_PERF_CTRL);
+
+#ifdef BOOT_GUARD_SUPPORT_FLAG
+ //
+ // Disable PBET before send IPI to APs
+ //
+ StopPbeTimer ();
+#endif
+
+ ///
+ /// First INIT-SIPI-SIPI and reset AP waking counters
+ ///
+ CountApNumberAndCollectBist (WakeUpBuffer);
+ ExchangeInfo->WakeUpApManner = WakeUpApCounterInit;
+
+ ///
+ /// Assign AP function to initialize FPU MCU MTRR and get detail info
+ ///
+ PollForInitialization (WakeUpBuffer);
+ ///
+ /// Assign WakeUpApManner (WakeUpApPerHltLoop/WakeUpApPerMwaitLoop/WakeUpApPerRunLoop)
+ ///
+ ExchangeInfo->WakeUpApManner = mPlatformCpu->CpuConfig->ApIdleManner;
+ ///
+ /// Assign AP function to ApProcWrapper for StartAllAps/StartThisAp calling
+ ///
+ ExchangeInfo->ApFunction = (VOID *) (UINTN) ApProcWrapper;
+
+ if (mInterruptState) {
+ CpuArch->EnableInterrupt (CpuArch);
+ }
+
+ for (Index = 1; Index < mMPSystemData->NumberOfCpus; Index++) {
+ CpuData = &mMPSystemData->CpuData[Index];
+ if (CpuData->Health.Uint32 != 0) {
+ ReportStatusCode (
+ EFI_ERROR_MAJOR | EFI_ERROR_CODE,
+ EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_SELF_TEST
+ );
+ }
+
+ Status = CheckMicrocodeUpdate (Index, CpuData->MicrocodeStatus, CpuData->FailedRevision);
+ if (Status == EFI_LOAD_ERROR) {
+ DEBUG((EFI_D_INFO,"Failed to load microcode patch\n"));
+ }
+ }
+
+ Status = gBS->CreateEvent (
+ EFI_EVENT_TIMER | EFI_EVENT_NOTIFY_SIGNAL,
+ EFI_TPL_CALLBACK,
+ CheckAllAPsStatus,
+ NULL,
+ &mMPSystemData->CheckAllAPsEvent
+ );
+ for (Index = 0; Index < mMPSystemData->NumberOfCpus; Index++) {
+ CpuData = &mMPSystemData->CpuData[Index];
+ if (Index == mMPSystemData->BSP) {
+ continue;
+ }
+ Status = gBS->CreateEvent (
+ EFI_EVENT_TIMER | EFI_EVENT_NOTIFY_SIGNAL,
+ EFI_TPL_CALLBACK,
+ CheckThisAPStatus,
+ (VOID *) CpuData,
+ &CpuData->CheckThisAPEvent
+ );
+ }
+ ///
+ /// Switch BSP to Lowest Feature Processor (LFP)
+ ///
+ if (mPlatformCpu->CpuConfig->BspSelection == 16) {
+ Status = SwitchToLowestFeatureProcess (&mMpService);
+ }
+
+ ///
+ /// Initialize feature control structure
+ ///
+ InitializeFeaturePerSetup (mMPSystemData);
+
+ ///
+ /// Detect and log all processor supported features
+ ///
+ CollectProcessorFeature (&mMpService);
+ Status = mMpService.StartupAllAPs (
+ &mMpService,
+ CollectProcessorFeature,
+ FALSE,
+ NULL,
+ 0,
+ (VOID *) &mMpService,
+ NULL
+ );
+
+ ProgramProcessorFeature (&mMpService);
+ Status = mMpService.StartupAllAPs (
+ &mMpService,
+ ProgramProcessorFeature,
+ FALSE,
+ NULL,
+ 0,
+ (VOID *) &mMpService,
+ NULL
+ );
+
+ ///
+ /// Install CPU info protocol
+ ///
+ mCpuInfo.Revision = DXE_CPU_INFO_REVISION_1;
+ mCpuInfo.RcVersion = CPU_RC_VERSION;
+ mCpuInfo.CpuCommonFeatures = mCommonFeatures;
+
+ gBS->InstallMultipleProtocolInterfaces (
+ &Handle,
+ &gDxeCpuInfoProtocolGuid,
+ &mCpuInfo,
+ NULL
+ );
+ DEBUG ((EFI_D_INFO, "mCommonFeatures = %x\n", mCommonFeatures));
+
+ EfiCreateProtocolNotifyEvent (
+ &gEfiDataHubProtocolGuid,
+ EFI_TPL_CALLBACK,
+ MpDataHubCallback,
+ NULL,
+ &Registration
+ );
+
+ CopyMem ((VOID *) (UINTN) mBackupBuffer, (VOID *) (UINTN) mOriginalBuffer, EFI_PAGE_SIZE);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Wrapper function for all procedures assigned to AP via MP service protocol.
+ It controls states of AP and invokes assigned precedure.
+**/
+VOID
+ApProcWrapper (
+ VOID
+ )
+{
+ EFI_AP_PROCEDURE Procedure;
+ VOID *Parameter;
+ UINTN CpuNumber;
+ CPU_DATA_BLOCK *CpuData;
+ MP_CPU_EXCHANGE_INFO *ExchangeInfo;
+ MONITOR_MWAIT_DATA *MonitorAddr;
+
+ ///
+ /// Initialize MCE for CR4.
+ ///
+ InitializeMce (mMPSystemData->MachineCheckEnable);
+
+ WhoAmI (&mMpService, &CpuNumber);
+ CpuData = &mMPSystemData->CpuData[CpuNumber];
+
+ ///
+ /// Now let us check it out.
+ ///
+ Procedure = CpuData->Procedure;
+ Parameter = CpuData->Parameter;
+
+ if (Procedure != NULL) {
+ AsmAcquireMPLock (&CpuData->StateLock);
+ CpuData->State = CPU_STATE_BUSY;
+ AsmReleaseMPLock (&CpuData->StateLock);
+ Procedure (Parameter);
+
+ ///
+ /// if BSP is switched to AP, it continue execute from here, but it carries register state
+ /// of the old AP, so need to reload CpuData (might be stored in a register after compiler
+ /// optimization) to make sure it points to the right data
+ ///
+ WhoAmI (&mMpService, &CpuNumber);
+ CpuData = &mMPSystemData->CpuData[CpuNumber];
+
+ AsmAcquireMPLock (&CpuData->ProcedureLock);
+ CpuData->Procedure = NULL;
+ AsmReleaseMPLock (&CpuData->ProcedureLock);
+
+ AsmAcquireMPLock (&CpuData->StateLock);
+ CpuData->State = CPU_STATE_FINISHED;
+ AsmReleaseMPLock (&CpuData->StateLock);
+
+ ///
+ /// Check AP wakeup manner, update signal and relating counter once finishing AP task
+ ///
+ ExchangeInfo = (MP_CPU_EXCHANGE_INFO *) (UINTN) (mAcpiCpuData->WakeUpBuffer + MP_CPU_EXCHANGE_INFO_OFFSET);
+ MonitorAddr = (MONITOR_MWAIT_DATA *)
+ (
+ (UINT8 *) ExchangeInfo->StackStart +
+ (ExchangeInfo->BistBuffer[CpuData->ApicID].Number + 1) *
+ ExchangeInfo->StackSize -
+ MONITOR_FILTER_SIZE
+ );
+
+ switch (ExchangeInfo->WakeUpApManner) {
+ case WakeUpApPerHltLoop:
+ MonitorAddr->HltLoopBreakCounter += 1;
+ break;
+
+ case WakeUpApPerMwaitLoop:
+ MonitorAddr->MwaitLoopBreakCounter += 1;
+ break;
+
+ case WakeUpApPerRunLoop:
+ MonitorAddr->RunLoopBreakCounter += 1;
+ break;
+
+ case WakeUpApPerMwaitLoop32:
+ MonitorAddr->MwaitLoopBreakCounter32 += 1;
+ break;
+
+ case WakeUpApPerRunLoop32:
+ MonitorAddr->RunLoopBreakCounter32 += 1;
+ break;
+
+ default:
+ break;
+ }
+
+ MonitorAddr->BreakToRunApSignal = 0;
+ }
+}
+
+/**
+ Procedure for detailed initialization of APs. It will be assigned to all APs
+ after first INIT-SIPI-SIPI finishing CPU number counting and BIST collection.
+**/
+VOID
+DetailedMpInitialization (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ UINT32 FailedRevision;
+
+ ///
+ /// Program APs CPU Performance Control setting
+ ///
+ AsmWriteMsr64 (MSR_IA32_PERF_CTRL, mCpuPerfCtrlValue);
+
+ CpuInitFloatPointUnit ();
+
+ Status = InitializeMicrocode (
+ (EFI_CPU_MICROCODE_HEADER **) (UINTN) mAcpiCpuData->MicrocodePointerBuffer,
+ &FailedRevision
+ );
+
+ ///
+ /// Init MLC Streamer Prefetcher and MLC Spatial Prefetcher
+ ///
+ InitializeProcessorsPrefetcher (
+ mPlatformCpu->CpuConfig->MlcStreamerPrefetcher,
+ mPlatformCpu->CpuConfig->MlcSpatialPrefetcher
+ );
+
+ ///
+ /// Init Cache after all MCU is loaded
+ ///
+ while (mMcuLoadCount < mAcpiCpuData->NumberOfCpus) {
+ CpuPause ();
+ }
+
+ ///
+ /// Save Mtrr Registers in global data areas
+ ///
+ MpMtrrSynchUp (NULL);
+ ProgramXApic (FALSE);
+ FillInProcessorInformation (mMPSystemData, FALSE, 0);
+ InterlockedIncrement (&mFinishedCount);
+}
+
+/**
+ Switch current BSP processor to AP
+
+ @param[in] MPSystemData - Pointer to the data structure containing MP related data
+**/
+VOID
+FutureBSPProc (
+ IN MP_SYSTEM_DATA *MPSystemData
+ )
+{
+ AsmExchangeRole (&MPSystemData->APInfo, &MPSystemData->BSPInfo);
+ return;
+}
+
+/**
+ This function is called by all processors (both BSP and AP) once and collects MP related data
+
+ @param[in] MPSystemData - Pointer to the data structure containing MP related data
+ @param[in] BSP - TRUE if the CPU is BSP
+ @param[in] BistParam - BIST (build-in self test) data for the processor. This data
+ is only valid for processors that are waked up for the 1ast
+ time in this CPU DXE driver.
+
+ @retval EFI_SUCCESS - Data for the processor collected and filled in
+**/
+EFI_STATUS
+FillInProcessorInformation (
+ IN MP_SYSTEM_DATA *MPSystemData,
+ IN BOOLEAN BSP,
+ IN UINT32 BistParam
+ )
+{
+ UINT32 Health;
+ UINT32 ApicID;
+ CPU_DATA_BLOCK *CpuData;
+ UINT32 BIST;
+ UINTN CpuNumber;
+ UINTN Index;
+ UINTN Count;
+ MP_CPU_EXCHANGE_INFO *ExchangeInfo;
+
+ ApicID = GetApicID (NULL, NULL);
+ BIST = 0;
+
+ if (BSP) {
+ CpuNumber = 0;
+ BIST = BistParam;
+ } else {
+ ExchangeInfo = (MP_CPU_EXCHANGE_INFO *) (UINTN) (mAcpiCpuData->WakeUpBuffer + MP_CPU_EXCHANGE_INFO_OFFSET);
+ CpuNumber = ExchangeInfo->BistBuffer[ApicID].Number;
+ BIST = ExchangeInfo->BistBuffer[ApicID].BIST;
+ }
+
+ CpuData = &MPSystemData->CpuData[CpuNumber];
+ CpuData->SecondaryCpu = IsSecondaryThread ();
+ CpuData->ApicID = ApicID;
+ CpuData->Procedure = NULL;
+ CpuData->Parameter = NULL;
+ CpuData->StateLock = VacantFlag;
+ CpuData->ProcedureLock = VacantFlag;
+ CpuData->State = CPU_STATE_IDLE;
+
+ Health = BIST;
+ Count = MPSystemData->BistHobSize / sizeof (BIST_HOB_DATA);
+ for (Index = 0; Index < Count; Index++) {
+ if (ApicID == MPSystemData->BistHobData[Index].ApicId) {
+ Health = MPSystemData->BistHobData[Index].Health.Uint32;
+ }
+ }
+
+ if (Health > 0) {
+ CpuData->State = CPU_STATE_DISABLED;
+ MPSystemData->DisableCause[CpuNumber] = CPU_CAUSE_SELFTEST_FAILURE;
+
+ } else {
+ MPSystemData->DisableCause[CpuNumber] = CPU_CAUSE_NOT_DISABLED;
+ }
+
+ FillinDataforDataHub (CpuNumber, &CpuData->CpuDataforDatahub);
+ CpuData->CpuDataforDatahub.Health.Uint32 = Health;
+
+ CopyMem (&CpuData->PhysicalLocation, &CpuData->CpuDataforDatahub.Location, sizeof (PHYSICAL_LOCATION));
+ return EFI_SUCCESS;
+}
+
+/**
+ Set APIC BSP bit
+
+ @param[in] Enable - enable as BSP or not
+
+ @retval EFI_SUCCESS - always return success
+**/
+EFI_STATUS
+SetApicBSPBit (
+ IN BOOLEAN Enable
+ )
+{
+ UINT64 ApicBaseReg;
+
+ ApicBaseReg = AsmReadMsr64 (MSR_IA32_APIC_BASE);
+
+ if (Enable) {
+ ApicBaseReg |= 0x100;
+ } else {
+ ApicBaseReg &= 0xfffffffffffffe00;
+ }
+
+ AsmWriteMsr64 (MSR_IA32_APIC_BASE, ApicBaseReg);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Change CPU state
+
+ @param[in] CpuNumber - CPU number
+ @param[in] NewState - the new state that will be changed to
+ @param[in] Cause - Cause
+
+ @retval EFI_SUCCESS - always return success
+**/
+EFI_STATUS
+ChangeCpuState (
+ IN UINTN CpuNumber,
+ IN BOOLEAN NewState,
+ IN CPU_STATE_CHANGE_CAUSE Cause
+ )
+{
+ CPU_DATA_BLOCK *CpuData;
+ EFI_COMPUTING_UNIT_CPU_DISABLED_ERROR_DATA ErrorData;
+
+ CpuData = &mMPSystemData->CpuData[CpuNumber];
+
+ mMPSystemData->DisableCause[CpuNumber] = Cause;
+
+ if (!NewState) {
+ AsmAcquireMPLock (&CpuData->StateLock);
+ CpuData->State = CPU_STATE_DISABLED;
+ AsmReleaseMPLock (&CpuData->StateLock);
+
+ ErrorData.DataHeader.HeaderSize = sizeof (EFI_STATUS_CODE_DATA);
+ ErrorData.DataHeader.Size = sizeof (EFI_COMPUTING_UNIT_CPU_DISABLED_ERROR_DATA) - sizeof (EFI_STATUS_CODE_DATA);
+ CopyMem (
+ &ErrorData.DataHeader.Type,
+ &gEfiStatusCodeSpecificDataGuid,
+ sizeof (EFI_GUID)
+ );
+ ErrorData.Cause = Cause;
+ ErrorData.SoftwareDisabled = TRUE;
+//(AMI_CHG)>
+/* ReportStatusCode (
+ EFI_ERROR_MINOR | EFI_ERROR_CODE,
+ EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_EC_DISABLED
+ );*/
+//<(AMI_CHG)
+ } else {
+ AsmAcquireMPLock (&CpuData->StateLock);
+ CpuData->State = CPU_STATE_IDLE;
+ AsmReleaseMPLock (&CpuData->StateLock);
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Check if this is non-core processor - HT AP thread
+
+ @retval TRUE if this is HT AP thread
+ @retval FALSE if this is core thread
+**/
+BOOLEAN
+IsSecondaryThread (
+ VOID
+ )
+{
+ UINT32 ApicID;
+ EFI_CPUID_REGISTER CpuidRegisters;
+ UINT8 CpuCount;
+ UINT8 CoreCount;
+ UINT8 CpuPerCore;
+ UINT32 Mask;
+
+ ApicID = GetApicID (NULL, NULL);
+
+ AsmCpuid (
+ CPUID_VERSION_INFO,
+ &CpuidRegisters.RegEax,
+ &CpuidRegisters.RegEbx,
+ &CpuidRegisters.RegEcx,
+ &CpuidRegisters.RegEdx
+ );
+ if ((CpuidRegisters.RegEdx & 0x10000000) == 0) {
+ return FALSE;
+ }
+
+ CpuCount = (UINT8) ((CpuidRegisters.RegEbx >> 16) & 0xff);
+ if (CpuCount == 1) {
+ return FALSE;
+ }
+
+ AsmCpuid (
+ CPUID_SIGNATURE,
+ &CpuidRegisters.RegEax,
+ &CpuidRegisters.RegEbx,
+ &CpuidRegisters.RegEcx,
+ &CpuidRegisters.RegEdx
+ );
+ if (CpuidRegisters.RegEax > 3) {
+
+ CoreCount = GetCoreNumber ();
+ } else {
+ CoreCount = 1;
+ }
+
+ ///
+ /// Assumes there is symmetry across core boundary, i.e. each core within a package has the same number of logical processors
+ ///
+ if (CpuCount == CoreCount) {
+ return FALSE;
+ }
+
+ CpuPerCore = CpuCount / CoreCount;
+
+ ///
+ /// Assume 1 Core has no more than 8 threads
+ ///
+ if (CpuPerCore == 2) {
+ Mask = 0x1;
+ } else if (CpuPerCore <= 4) {
+ Mask = 0x3;
+ } else {
+ Mask = 0x7;
+ }
+
+ if ((ApicID & Mask) == 0) {
+ return FALSE;
+ } else {
+ return TRUE;
+ }
+}
+
+/**
+ If timeout occurs in StartupAllAps(), a timer is set, which invokes this
+ procedure periodically to check whether all APs have finished.
+
+ @param[in] Event - Event triggered.
+ @param[in] Context - Parameter passed with the event.
+**/
+VOID
+CheckAllAPsStatus (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ UINTN CpuNumber;
+ UINTN NextCpuNumber;
+ CPU_DATA_BLOCK *CpuData;
+ CPU_DATA_BLOCK *NextCpuData;
+ EFI_STATUS Status;
+ CPU_STATE CpuState;
+
+ for (CpuNumber = 0; CpuNumber < mMPSystemData->NumberOfCpus; CpuNumber++) {
+ CpuData = &mMPSystemData->CpuData[CpuNumber];
+ if (CpuNumber == mMPSystemData->BSP) {
+ continue;
+ }
+
+ AsmAcquireMPLock (&CpuData->StateLock);
+ CpuState = CpuData->State;
+ AsmReleaseMPLock (&CpuData->StateLock);
+
+ switch (CpuState) {
+ case CPU_STATE_READY:
+ WakeUpAp (
+ CpuData,
+ mMPSystemData->Procedure,
+ mMPSystemData->ProcArguments
+ );
+ break;
+
+ case CPU_STATE_FINISHED:
+ if (mMPSystemData->SingleThread) {
+ Status = GetNextBlockedCpuNumber (&NextCpuNumber);
+ if (!EFI_ERROR (Status)) {
+ NextCpuData = &mMPSystemData->CpuData[NextCpuNumber];
+
+ AsmAcquireMPLock (&NextCpuData->StateLock);
+ NextCpuData->State = CPU_STATE_READY;
+ AsmReleaseMPLock (&NextCpuData->StateLock);
+
+ WakeUpAp (
+ NextCpuData,
+ mMPSystemData->Procedure,
+ mMPSystemData->ProcArguments
+ );
+ }
+ }
+
+ AsmAcquireMPLock (&CpuData->StateLock);
+ CpuData->State = CPU_STATE_IDLE;
+ AsmReleaseMPLock (&CpuData->StateLock);
+
+ mMPSystemData->FinishCount++;
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ if (mMPSystemData->FinishCount == mMPSystemData->StartCount) {
+ gBS->SetTimer (
+ mMPSystemData->CheckAllAPsEvent,
+ TimerCancel,
+ 0
+ );
+ Status = gBS->SignalEvent (mMPSystemData->WaitEvent);
+ }
+
+ return;
+}
+
+/**
+ Check if this AP has finished task
+
+ @param[in] Event - Event triggered.
+ @param[in] Context - Parameter passed with the event.
+**/
+VOID
+CheckThisAPStatus (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ CPU_DATA_BLOCK *CpuData;
+ EFI_STATUS Status;
+ CPU_STATE CpuState;
+
+ CpuData = (CPU_DATA_BLOCK *) Context;
+
+ AsmAcquireMPLock (&CpuData->StateLock);
+ CpuState = CpuData->State;
+ AsmReleaseMPLock (&CpuData->StateLock);
+
+ if (CpuState == CPU_STATE_FINISHED) {
+ gBS->SetTimer (
+ CpuData->CheckThisAPEvent,
+ TimerCancel,
+ 0
+ );
+ Status = gBS->SignalEvent (mMPSystemData->WaitEvent);
+ AsmAcquireMPLock (&CpuData->StateLock);
+ CpuData->State = CPU_STATE_IDLE;
+ AsmReleaseMPLock (&CpuData->StateLock);
+ }
+
+ return;
+}
+
+/**
+ Convert the timeout value to TSC value
+
+ @param[in] TimeoutInMicroSecs - how many microseconds the timeout is
+
+ @retval expected TSC value for timeout
+**/
+UINT64
+CalculateTimeout (
+ IN UINTN TimeoutInMicroSecs
+ )
+{
+ UINT64 CurrentTsc;
+ UINT64 ExpectedTsc;
+ UINT64 Frequency;
+ EFI_STATUS Status;
+
+ if (TimeoutInMicroSecs == 0) {
+ return 0xffffffffffff;
+ }
+
+ CurrentTsc = EfiReadTsc ();
+
+ Status = GetActualFrequency (mMetronome, &Frequency);
+
+ ExpectedTsc = CurrentTsc + MultU64x32 (Frequency, (UINT32) TimeoutInMicroSecs);
+
+ return ExpectedTsc;
+}
+
+/**
+ Check if timeout happened
+
+ @param[in] ExpectedTsc - the TSC value for timeout
+
+ @retval TRUE if timeout happened
+ @retval FALSE if timeout not yet happened
+**/
+BOOLEAN
+CheckTimeout (
+ IN UINT64 ExpectedTsc
+ )
+{
+ UINT64 CurrentTsc;
+
+ CurrentTsc = EfiReadTsc ();
+ if (CurrentTsc >= ExpectedTsc) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/**
+ Get the next blocked processor
+
+ @param[in] NextCpuNumber - that will be updated for next blocked CPU number
+
+ @retval EFI_SUCCESS - The next blocked CPU found
+ @retval EFI_NOT_FOUND - cannot find blocked CPU
+**/
+EFI_STATUS
+GetNextBlockedCpuNumber (
+ OUT UINTN *NextCpuNumber
+ )
+{
+ UINTN CpuNumber;
+ CPU_STATE CpuState;
+ CPU_DATA_BLOCK *CpuData;
+
+ for (CpuNumber = 0; CpuNumber < mMPSystemData->NumberOfCpus; CpuNumber++) {
+ if (CpuNumber == mMPSystemData->BSP) {
+ continue;
+ }
+
+ CpuData = &mMPSystemData->CpuData[CpuNumber];
+
+ AsmAcquireMPLock (&CpuData->StateLock);
+ CpuState = CpuData->State;
+ AsmReleaseMPLock (&CpuData->StateLock);
+
+ if (CpuState == CPU_STATE_BLOCKED) {
+ *NextCpuNumber = CpuNumber;
+ return EFI_SUCCESS;
+ }
+ }
+
+ return EFI_NOT_FOUND;
+}
+
+/**
+ Update data hub for processor status
+
+ @param[in] CpuNumber - CPU number
+ @param[in] CpuDataforDatahub - the data hub that will be updated
+**/
+VOID
+UpdateDataforDatahub (
+ IN UINTN CpuNumber,
+ OUT CPU_DATA_FOR_DATAHUB *CpuDataforDatahub
+ )
+{
+ CpuDataforDatahub->Status = GetProcessorStatus (CpuNumber);
+ InitializeProcessorData (CpuNumber, CpuDataforDatahub);
+ InitializeCacheData (CpuNumber, CpuDataforDatahub->CacheInformation);
+
+ return;
+}
+
+/**
+ Function to wake up a specified AP and assign procedure to it.
+
+ @param[in] CpuData - CPU data block for the specified AP.
+ @param[in] Procedure - Procedure to assign.
+ @param[in] ProcArguments - Argument for Procedure.
+**/
+VOID
+WakeUpAp (
+ IN CPU_DATA_BLOCK *CpuData,
+ IN EFI_AP_PROCEDURE Procedure,
+ IN VOID *ProcArguments
+ )
+{
+ MP_CPU_EXCHANGE_INFO *ExchangeInfo;
+ MONITOR_MWAIT_DATA *MonitorAddr;
+
+ AsmAcquireMPLock (&CpuData->ProcedureLock);
+ CpuData->Parameter = ProcArguments;
+ CpuData->Procedure = Procedure;
+ AsmReleaseMPLock (&CpuData->ProcedureLock);
+
+ ExchangeInfo = (MP_CPU_EXCHANGE_INFO *) (UINTN) (mAcpiCpuData->WakeUpBuffer + MP_CPU_EXCHANGE_INFO_OFFSET);
+ MonitorAddr = (MONITOR_MWAIT_DATA *)
+ (
+ (UINT8 *) ExchangeInfo->StackStart +
+ (ExchangeInfo->BistBuffer[CpuData->ApicID].Number + 1) *
+ ExchangeInfo->StackSize -
+ MONITOR_FILTER_SIZE
+ );
+
+ if (MonitorAddr->WakeUpApVectorChangeFlag == TRUE || ExchangeInfo->WakeUpApManner == WakeUpApPerHltLoop) {
+ SendInterrupt (
+ BROADCAST_MODE_SPECIFY_CPU,
+ CpuData->ApicID,
+ 0,
+ DELIVERY_MODE_INIT,
+ TRIGGER_MODE_EDGE,
+ TRUE
+ );
+ SendInterrupt (
+ BROADCAST_MODE_SPECIFY_CPU,
+ CpuData->ApicID,
+ (UINT32) RShiftU64 (mAcpiCpuData->WakeUpBuffer,
+ 12),
+ DELIVERY_MODE_SIPI,
+ TRIGGER_MODE_EDGE,
+ TRUE
+ );
+ MonitorAddr->WakeUpApVectorChangeFlag = FALSE;
+
+ //
+ // Clear StateLock to 0 to avoid AP locking it then entering SMM and getting INIT-SIPI here could cause dead-lock
+ //
+ CpuData->StateLock = 0;
+ }
+
+ MonitorAddr->BreakToRunApSignal = (UINTN) (BREAK_TO_RUN_AP_SIGNAL | CpuData->ApicID);
+}
+
+/**
+ Check whether any AP is running for assigned task.
+
+ @retval TRUE - Some APs are running.
+ @retval FALSE - No AP is running.
+**/
+BOOLEAN
+ApRunning (
+ VOID
+ )
+{
+ CPU_DATA_BLOCK *CpuData;
+ UINTN CpuNumber;
+
+ for (CpuNumber = 0; CpuNumber < mMPSystemData->NumberOfCpus; CpuNumber++) {
+ CpuData = &mMPSystemData->CpuData[CpuNumber];
+
+ if (CpuNumber != mMPSystemData->BSP) {
+ if (CpuData->State == CPU_STATE_READY || CpuData->State == CPU_STATE_BUSY) {
+ return TRUE;
+ }
+ }
+ }
+
+ return FALSE;
+}
+
+/**
+ Re-load microcode patch before boot.
+
+ @param[in] MpServices - point to EFI_MP_SERVICES_PROTOCOL
+
+ @retval EFI_SUCCESS - one processor re-loads microcode patch
+**/
+EFI_STATUS
+ReLoadMicrocodePatch (
+ IN EFI_MP_SERVICES_PROTOCOL *MpServices
+ )
+{
+ UINT32 FailedRevision;
+ UINTN CpuNumber;
+ EFI_STATUS Status;
+
+ Status = InitializeMicrocode (
+ mMicrocodePointerBuffer,
+ &FailedRevision
+ );
+ WhoAmI (
+ &mMpService,
+ &CpuNumber
+ );
+ Status = CheckMicrocodeUpdate (
+ CpuNumber,
+ Status,
+ FailedRevision
+ );
+ return Status;
+}
+
+/**
+ Re-load microcode patch before boot.
+
+ @retval EFI_SUCCESS - Multiple processors re-load microcode patch
+**/
+EFI_STATUS
+ReLoadMicrocodeBeforeBoot (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+
+ ///
+ /// Added code to handle microcode patch reload here!!!
+ ///
+ mMcuLoadCount = 0;
+ Status = ReLoadMicrocodePatch (&mMpService);
+ if (!EFI_ERROR (Status)) {
+ Status = mMpService.StartupAllAPs (
+ &mMpService,
+ ReLoadMicrocodePatch,
+ FALSE,
+ NULL,
+ 0,
+ (VOID *) &mMpService,
+ NULL
+ );
+ }
+ return Status;
+}
diff --git a/ReferenceCode/Haswell/CpuInit/Dxe/MpService.h b/ReferenceCode/Haswell/CpuInit/Dxe/MpService.h
new file mode 100644
index 0000000..7fa7544
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Dxe/MpService.h
@@ -0,0 +1,670 @@
+/** @file
+ Some definitions for MP services Protocol.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#ifndef _MP_SERVICE_H_
+#define _MP_SERVICE_H_
+
+#include "MpCommon.h"
+
+///
+/// Driver Produced Protocol.
+///
+#include EFI_PROTOCOL_PRODUCER (MpService)
+#include EFI_PROTOCOL_PRODUCER (PiMpService)
+
+//
+// Constant definitions
+//
+#define FOURGB 0x100000000
+#define ONEPAGE 0x1000
+
+#define RENDEZVOUS_PROC_LENGTH 0x1000
+#define STACK_SIZE_PER_PROC 0x8000
+#define MAX_CPU_S3_MTRR_ENTRY 0x0020
+#define MAX_CPU_S3_TABLE_SIZE 0x0400
+
+#define AP_HALT_CODE_SIZE 10
+
+#define CPU_CHECK_AP_INTERVAL 10 // multiply to microseconds for gBS->SetTimer in 100nsec.
+#define CPU_WAIT_FOR_TASK_TO_BE_COMPLETED 100000 // microseconds
+///
+/// The MP data structure follows.
+///
+#define CPU_SWITCH_STATE_IDLE 0
+#define CPU_SWITCH_STATE_STORED 1
+#define CPU_SWITCH_STATE_LOADED 2
+
+#define MSR_L3_CACHE_DISABLE 0x40
+
+typedef struct {
+ UINT8 Lock; ///< offset 0
+ UINT8 State; ///< offset 1
+ UINTN StackPointer; ///< offset 4 / 8
+ PSEUDO_DESCRIPTOR Gdtr; ///< offset 8 / 16
+ PSEUDO_DESCRIPTOR Idtr; ///< offset 14 / 26
+} CPU_EXCHANGE_ROLE_INFO;
+
+//
+// MTRR table definitions
+//
+typedef struct {
+ UINT16 Index;
+ UINT64 Value;
+} EFI_MTRR_VALUES;
+
+typedef enum {
+ CPU_STATE_IDLE,
+ CPU_STATE_BLOCKED,
+ CPU_STATE_READY,
+ CPU_STATE_BUSY,
+ CPU_STATE_FINISHED,
+ CPU_STATE_DISABLED
+} CPU_STATE;
+
+//
+// Define CPU feature information
+//
+#define MAX_FEATURE_NUM 6
+typedef struct {
+ UINTN Index;
+ UINT32 ApicId;
+ UINT32 Version;
+ UINT32 FeatureDelta;
+ UINT32 Features[MAX_FEATURE_NUM];
+} LEAST_FEATURE_PROC;
+
+///
+/// Define Individual Processor Data block.
+///
+typedef struct {
+ UINT32 ApicID;
+ EFI_AP_PROCEDURE Procedure;
+ VOID *Parameter;
+ UINT8 StateLock;
+ UINT8 ProcedureLock;
+ EFI_MP_HEALTH_FLAGS Health;
+ BOOLEAN SecondaryCpu;
+ UINTN NumberOfCores;
+ UINTN NumberOfThreads;
+ UINT64 ActualFsbFrequency;
+ EFI_STATUS MicrocodeStatus;
+ UINT32 FailedRevision;
+ PHYSICAL_LOCATION PhysicalLocation;
+ CPU_STATE State;
+ CPU_DATA_FOR_DATAHUB CpuDataforDatahub;
+
+ //
+ // for PI MP Services Protocol
+ //
+ BOOLEAN *Finished;
+ UINT64 ExpectedTime;
+ EFI_EVENT WaitEvent;
+ EFI_EVENT CheckThisAPEvent;
+} CPU_DATA_BLOCK;
+
+typedef struct {
+ UINT32 ApicId;
+ UINT32 MsrIndex;
+ UINT64 MsrValue;
+} MP_CPU_S3_SCRIPT_DATA;
+
+typedef struct {
+ UINT32 S3BootScriptTable;
+ UINT32 S3BspMtrrTable;
+} MP_CPU_S3_DATA_POINTER;
+
+#pragma pack(1)
+typedef struct {
+ UINT32 ApicId;
+ EFI_MP_HEALTH_FLAGS Health;
+} BIST_HOB_DATA;
+#pragma pack()
+
+///
+/// Define MP data block which consumes individual processor block.
+///
+typedef struct {
+ UINT8 APSerializeLock;
+
+ BOOLEAN LimitCpuidMaximumValue; ///< make processor look like < F40
+ BOOLEAN VmxEnable;
+ BOOLEAN ProcessorVmxEnable;
+ BOOLEAN ProcessorBistEnable;
+ BOOLEAN TxtEnable;
+ BOOLEAN MonitorMwaitEnable;
+ BOOLEAN ExecuteDisableBit;
+ BOOLEAN MachineCheckEnable;
+ BOOLEAN XapicEnable;
+ BOOLEAN AesEnable;
+ BOOLEAN DebugInterfaceEnable;
+ BOOLEAN DebugInterfaceLockEnable;
+ BOOLEAN EnableSecondaryCpu;
+ UINTN NumberOfCpus;
+ UINTN MaximumCpusForThisSystem;
+
+ CPU_EXCHANGE_ROLE_INFO BSPInfo;
+ CPU_EXCHANGE_ROLE_INFO APInfo;
+
+ EFI_CPU_ARCH_PROTOCOL *CpuArch;
+ EFI_EVENT CheckAllAPsEvent;
+ EFI_EVENT WaitEvent;
+ UINTN BSP;
+ BIST_HOB_DATA *BistHobData;
+ UINTN BistHobSize;
+
+ UINTN FinishCount;
+ UINTN StartCount;
+ EFI_AP_PROCEDURE Procedure;
+ VOID *ProcArguments;
+ BOOLEAN SingleThread;
+ UINTN StartedCpuNumber;
+
+ CPU_DATA_BLOCK CpuData[MAXIMUM_CPU_NUMBER];
+ CPU_STATE_CHANGE_CAUSE DisableCause[MAXIMUM_CPU_NUMBER];
+
+ UINT8 S3BootScriptLock;
+ UINT32 S3BootScriptCount;
+ MP_CPU_S3_DATA_POINTER S3DataPointer;
+ MP_CPU_S3_SCRIPT_DATA S3BootScriptTable[MAX_CPU_S3_TABLE_SIZE];
+ EFI_MTRR_VALUES S3BspMtrrTable[MAX_CPU_S3_MTRR_ENTRY];
+
+ ///
+ /// for PI MP Services Protocol
+ ///
+ BOOLEAN CpuList[MAXIMUM_CPU_NUMBER];
+ UINTN **FailedCpuList;
+ UINT64 ExpectedTime;
+ EFI_EVENT CheckAPsEvent;
+} MP_SYSTEM_DATA;
+
+typedef struct {
+ ACPI_CPU_DATA AcpiCpuData;
+ MP_SYSTEM_DATA MPSystemData;
+ PSEUDO_DESCRIPTOR GdtrProfile;
+ PSEUDO_DESCRIPTOR IdtrProfile;
+ EFI_CPU_MICROCODE_HEADER *MicrocodePointerBuffer[NUMBER_OF_MICROCODE_UPDATE + 1];
+} MP_CPU_RESERVED_DATA;
+
+extern MP_SYSTEM_DATA *mMPSystemData;
+extern ACPI_CPU_DATA *mAcpiCpuData;
+extern EFI_MP_SERVICES_PROTOCOL mMpService;
+extern EFI_PI_MP_SERVICES_PROTOCOL mPiMpService;
+
+///
+/// Prototypes.
+///
+
+/**
+ Get general MP information
+
+ @param[in] This - EFI_MP_SERVICE_PROTOCOL
+ @param[in] NumberOfCPUs - Number of processors
+ @param[in] MaxiumNumberOfCPUs - Max supported number of processors
+ @param[in] NumberOfEnabledCPUs - Number of processors enabled
+ @param[in] RendezvousIntNumber - number of Rendezvous procedure
+ @param[in] RendezvousProcLength - length of Rendezvous procedure
+
+ @retval EFI_SUCCESS - always return success
+**/
+EFI_STATUS
+EFIAPI
+GetGeneralMPInfo (
+ IN EFI_MP_SERVICES_PROTOCOL *This,
+ OUT UINTN *NumberOfCPUs,
+ OUT UINTN *MaxiumNumberOfCPUs,
+ OUT UINTN *NumberOfEnabledCPUs,
+ OUT UINTN *RendezvousIntNumber,
+ OUT UINTN *RendezvousProcLength
+ );
+
+/**
+ Get processor context
+
+ @param[in] This - EFI_MP_SERVICE_PROTOCOL
+ @param[in] ProcessorNumber - The handle number of processor.
+ @param[in] BufferLength - buffer length
+ @param[in] ProcessorContextBuffer - pointer to the buffer that will be updated
+
+ @retval EFI_INVALID_PARAMETER - buffer is NULL or CpuNumber our of range
+ @retval EFI_BUFFER_TOO_SMALL - buffer too small
+ @retval EFI_SUCCESS - got processor context successfully
+**/
+EFI_STATUS
+EFIAPI
+GetProcessorContext (
+ IN EFI_MP_SERVICES_PROTOCOL *This,
+ IN UINTN ProcessorNumber,
+ IN OUT UINTN *BufferLength,
+ IN OUT EFI_MP_PROC_CONTEXT *ProcessorContextBuffer
+ );
+
+/**
+ MP Service to get specified application processor (AP)
+ to execute a caller-provided code stream.
+
+ @param[in] This - Pointer to MP Service Protocol
+ @param[in] Procedure - The procedure to be assigned to AP.
+ @param[in] ProcessorNumber - The handle number of processor.
+ @param[in] WaitEvent - If timeout, the event to be triggered after this AP finishes.
+ @param[in] TimeoutInMicroSecs - The timeout value in microsecond. Zero means infinity.
+ @param[in] ProcArguments - Argument for Procedure.
+
+ @retval EFI_INVALID_PARAMETER - Procudure is NULL.
+ @retval EFI_INVALID_PARAMETER - Number of CPU out of range, or it belongs to BSP.
+ @retval EFI_INVALID_PARAMETER - Specified CPU is not idle.
+ @retval EFI_SUCCESS - The AP has finished.
+ @retval EFI_TIMEOUT - Time goes out before the AP has finished.
+**/
+EFI_STATUS
+EFIAPI
+StartupThisAP (
+ IN EFI_MP_SERVICES_PROTOCOL *This,
+ IN EFI_AP_PROCEDURE Procedure,
+ IN UINTN ProcessorNumber,
+ IN EFI_EVENT WaitEvent OPTIONAL,
+ IN UINTN TimeoutInMicroSecs OPTIONAL,
+ IN OUT VOID *ProcArguments OPTIONAL
+ );
+
+/**
+ MP Service to get all the available application processors (APs)
+ to execute a caller-provided code stream.
+
+ @param[in] This - Pointer to MP Service Protocol
+ @param[in] Procedure - The procedure to be assigned to APs.
+ @param[in] SingleThread - If true, all APs execute in block mode.
+ Otherwise, all APs exceute in non-block mode.
+ @param[in] WaitEvent - If timeout, the event to be triggered after all APs finish.
+ @param[in] TimeoutInMicroSecs - The timeout value in microsecond. Zero means infinity.
+ @param[in] ProcArguments - Argument for Procedure.
+ @param[in] FailedCPUList - If not NULL, all APs that fail to start will be recorded in the list.
+
+ @retval EFI_INVALID_PARAMETER - Procudure is NULL.
+ @retval EFI_SUCCESS - Only 1 logical processor exists.
+ @retval EFI_SUCCESS - All APs have finished.
+ @retval EFI_TIMEOUT - Time goes out before all APs have finished.
+**/
+EFI_STATUS
+EFIAPI
+StartupAllAPs (
+ IN EFI_MP_SERVICES_PROTOCOL *This,
+ IN EFI_AP_PROCEDURE Procedure,
+ IN BOOLEAN SingleThread,
+ IN EFI_EVENT WaitEvent OPTIONAL,
+ IN UINTN TimeoutInMicroSecs OPTIONAL,
+ IN OUT VOID *ProcArguments OPTIONAL,
+ OUT UINTN *FailedCPUList OPTIONAL
+ );
+
+/**
+ MP Service to makes the current BSP into an AP and then switches the
+ designated AP into the AP. This procedure is usually called after a CPU
+ test that has found that BSP is not healthy to continue it's responsbilities.
+
+ @param[in] This - Pointer to MP Service Protocol.
+ @param[in] ProcessorNumber - The handle number of processor.
+ @param[in] EnableOldBSPState - Whether to enable or disable the original BSP.
+
+ @retval EFI_INVALID_PARAMETER - Number for Specified AP out of range.
+ @retval EFI_INVALID_PARAMETER - Number of specified CPU belongs to BSP.
+ @retval EFI_NOT_READY - Specified AP is not idle.
+ @retval EFI_SUCCESS - BSP successfully switched.
+**/
+EFI_STATUS
+EFIAPI
+SwitchBSP (
+ IN EFI_MP_SERVICES_PROTOCOL *This,
+ IN UINTN ProcessorNumber,
+ IN BOOLEAN EnableOldBSPState
+ );
+
+/**
+ This procedure sends an IPI to the designated processor in
+ the requested delivery mode with the requested vector.
+
+ @param[in] This - Pointer to MP Service Protocol.
+ @param[in] ProcessorNumber - The handle number of processor.
+ @param[in] VectorNumber - Vector number.
+ @param[in] DeliveryMode - I/O APIC Interrupt Deliver Modes
+
+ @retval EFI_INVALID_PARAMETER - Input paramters were not correct.
+ @retval Other status - Status returned by SendInterrupt ()
+**/
+EFI_STATUS
+EFIAPI
+SendIPI (
+ IN EFI_MP_SERVICES_PROTOCOL *This,
+ IN UINTN ProcessorNumber,
+ IN UINTN VectorNumber,
+ IN UINTN DeliveryMode
+ );
+
+/**
+ Implementation of EnableDisableAP() service of MP Services Protocol.
+
+ This service lets the caller enable or disable an AP.
+ This service may only be called from the BSP.
+
+ @param[in] This - A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
+ @param[in] ProcessorNumber - The handle number of processor.
+ @param[in] NewAPState - Indicates whether the newstate of the AP is enabled or disabled.
+ @param[in] HealthState - Indicates new health state of the AP..
+
+ @retval EFI_SUCCESS - AP successfully enabled or disabled.
+ @retval EFI_DEVICE_ERROR - Caller processor is AP.
+ @retval EFI_NOT_FOUND - Processor with the handle specified by ProcessorNumber does not exist.
+ @retval EFI_INVALID_PARAMETERS - ProcessorNumber specifies the BSP.
+**/
+EFI_STATUS
+EFIAPI
+EnableDisableAP (
+ IN EFI_MP_SERVICES_PROTOCOL *This,
+ IN UINTN ProcessorNumber,
+ IN BOOLEAN NewAPState,
+ IN EFI_MP_HEALTH *HealthState OPTIONAL
+ );
+
+/**
+ Initialize multiple processors and collect MP related data
+
+ @retval EFI_SUCCESS - Multiple processors get initialized and data collected successfully
+ @retval Other - The operation failed due to some reason
+**/
+EFI_STATUS
+InitializeMpSystemData (
+ VOID
+ );
+
+/**
+ Wake up all the application processors
+
+ @param[in] ImageHandle - The firmware allocated handle for the EFI image.
+ @param[in] SystemTable - A pointer to the EFI System Table.
+
+ @retval EFI_SUCCESS - APs are successfully waked up
+**/
+EFI_STATUS
+WakeUpAPs (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ );
+
+/**
+ Exchange 2 processors (BSP to AP or AP to BSP)
+
+ @param[in] MyInfo - CPU info for current processor
+ @param[in] OthersInfo - CPU info that will be exchanged with
+**/
+VOID
+AsmExchangeRole (
+ IN CPU_EXCHANGE_ROLE_INFO *MyInfo,
+ IN CPU_EXCHANGE_ROLE_INFO *OthersInfo
+ );
+
+/**
+ Switch current BSP processor to AP
+
+ @param[in] MPSystemData - Pointer to the data structure containing MP related data
+**/
+VOID
+FutureBSPProc (
+ IN MP_SYSTEM_DATA *MPSystemData
+ );
+
+/**
+ Searches the HOB list provided by the core to find
+ if a MP guided HOB list exists or not. If it does, it copies it to the driver
+ data area, else returns 0
+
+ @param[in] MPSystemData - Pointer to an MP_SYSTEM_DATA structure
+
+ @retval EFI_SUCCESS - Success
+ @retval EFI_NOT_FOUND - HOB not found or else
+**/
+EFI_STATUS
+GetMpBistStatus (
+ IN MP_SYSTEM_DATA *MPSystemData
+ );
+
+/**
+ Initialize the state information for the MP DXE Protocol.
+**/
+VOID
+EFIAPI
+InitializeMpServices (
+ VOID
+ );
+
+/**
+ Prepare for MTRR synchronization.
+
+ @retval CR4 value before changing.
+**/
+UINTN
+MpMtrrSynchUpEntry (
+ VOID
+ );
+
+/**
+ Restoration after MTRR synchronization.
+
+ @param[in] Cr4 - CR4 value before changing.
+**/
+VOID
+MpMtrrSynchUpExit (
+ UINTN Cr4
+ );
+
+/**
+ Copy Global MTRR data to S3
+**/
+VOID
+SaveBspMtrrForS3 (
+ VOID
+ );
+
+/**
+ This function is called by all processors (both BSP and AP) once and collects MP related data
+
+ @param[in] MPSystemData - Pointer to the data structure containing MP related data
+ @param[in] BSP - TRUE if the CPU is BSP
+ @param[in] BistParam - BIST (build-in self test) data for the processor. This data
+ is only valid for processors that are waked up for the 1st
+ time in this CPU DXE driver.
+
+ @retval EFI_SUCCESS - Data for the processor collected and filled in
+**/
+EFI_STATUS
+FillInProcessorInformation (
+ IN MP_SYSTEM_DATA *MPSystemData,
+ IN BOOLEAN BSP,
+ IN UINT32 BistParam
+ );
+
+/**
+ Set APIC BSP bit
+
+ @param[in] Enable - enable as BSP or not
+
+ @retval EFI_SUCCESS - always return success
+**/
+EFI_STATUS
+SetApicBSPBit (
+ IN BOOLEAN Enable
+ );
+
+/**
+ Switch BSP to the processor which has least features
+
+ @param[in] MpServices - EFI_MP_SERVICES_PROTOCOL
+
+ @retval EFI_STATUS - status code returned from each sub-routines
+**/
+EFI_STATUS
+SwitchToLowestFeatureProcess (
+ IN EFI_MP_SERVICES_PROTOCOL *MpServices
+ );
+
+/**
+ Change CPU state
+
+ @param[in] CpuNumber - CPU number
+ @param[in] NewState - the new state that will be changed to
+ @param[in] Cause - Cause
+
+ @retval EFI_SUCCESS - always return success
+**/
+EFI_STATUS
+ChangeCpuState (
+ IN UINTN CpuNumber,
+ IN BOOLEAN NewState,
+ IN CPU_STATE_CHANGE_CAUSE Cause
+ );
+
+/**
+ Check if this is non-core processor - HT AP thread
+
+ @retval TRUE if this is HT AP thread
+ @retval FALSE if this is core thread
+**/
+BOOLEAN
+IsSecondaryThread (
+ VOID
+ );
+
+/**
+ If timeout occurs in StartupAllAps(), a timer is set, which invokes this
+ procedure periodically to check whether all APs have finished.
+
+ @param[in] Event - Event triggered.
+ @param[in] Context - Parameter passed with the event.
+**/
+VOID
+CheckAllAPsStatus (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ );
+
+/**
+ Check if this AP has finished task
+
+ @param[in] Event - Event triggered.
+ @param[in] Context - Parameter passed with the event.
+**/
+VOID
+CheckThisAPStatus (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ );
+
+/**
+ Convert the timeout value to TSC value
+
+ @param[in] TimeoutInMicroSecs - how many microseconds the timeout is
+
+ @retval expected TSC value for timeout
+**/
+UINT64
+CalculateTimeout (
+ IN UINTN TimeoutInMicroSecs
+ );
+
+/**
+ Check if timeout happened
+
+ @param[in] ExpectedTsc - the TSC value for timeout
+
+ @retval TRUE if timeout happened
+ @retval FALSE if timeout not yet happened
+**/
+BOOLEAN
+CheckTimeout (
+ IN UINT64 ExpectedTsc
+ );
+
+/**
+ Get the next blocked processor
+
+ @param[in] NextCpuNumber - that will be updated for next blocked CPU number
+
+ @retval EFI_SUCCESS - The next blocked CPU found
+ @retval EFI_NOT_FOUND - cannot find blocked CPU
+**/
+EFI_STATUS
+GetNextBlockedCpuNumber (
+ OUT UINTN *NextCpuNumber
+ );
+
+/**
+ Update data hub for processor status
+
+ @param[in] CpuNumber - CPU number
+ @param[in] CpuDataforDatahub - the data hub that will be updated
+**/
+VOID
+UpdateDataforDatahub (
+ IN UINTN CpuNumber,
+ OUT CPU_DATA_FOR_DATAHUB *CpuDataforDatahub
+ );
+
+/**
+ Procedure for detailed initialization of APs. It will be assigned to all APs while
+ they are waken up for the second time.
+**/
+VOID
+DetailedMpInitialization (
+ VOID
+ );
+
+/**
+ Function to wake up a specified AP and assign procedure to it.
+
+ @param[in] CpuData - CPU data block for the specified AP.
+ @param[in] Procedure - Procedure to assign.
+ @param[in] Parameter - Argument for Procedure.
+**/
+VOID
+WakeUpAp (
+ IN CPU_DATA_BLOCK *CpuData,
+ IN EFI_AP_PROCEDURE Procedure,
+ IN VOID *Parameter
+ );
+
+/**
+ Check number of cores in the package.
+
+ @retval Number of cores in the package.
+**/
+UINT8
+GetCoreNumber (
+ VOID
+ );
+
+/**
+ Re-load microcode patch before boot.
+
+ @retval EFI_SUCCESS - Multiple processors re-load microcode patch
+**/
+EFI_STATUS
+ReLoadMicrocodeBeforeBoot (
+ VOID
+ );
+
+#endif
diff --git a/ReferenceCode/Haswell/CpuInit/Dxe/MtrrSync.c b/ReferenceCode/Haswell/CpuInit/Dxe/MtrrSync.c
new file mode 100644
index 0000000..a696e6b
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Dxe/MtrrSync.c
@@ -0,0 +1,338 @@
+/** @file
+ Code which support multi-processor
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "MpService.h"
+#endif
+
+extern MP_SYSTEM_DATA *mMPSystemData;
+
+EFI_MTRR_VALUES mFixedMtrrValues[] = {
+ {
+ IA32_MTRR_FIX64K_00000,
+ 0
+ },
+ {
+ IA32_MTRR_FIX16K_80000,
+ 0
+ },
+ {
+ IA32_MTRR_FIX16K_A0000,
+ 0
+ },
+ {
+ IA32_MTRR_FIX4K_C0000,
+ 0
+ },
+ {
+ IA32_MTRR_FIX4K_C8000,
+ 0
+ },
+ {
+ IA32_MTRR_FIX4K_D0000,
+ 0
+ },
+ {
+ IA32_MTRR_FIX4K_D8000,
+ 0
+ },
+ {
+ IA32_MTRR_FIX4K_E0000,
+ 0
+ },
+ {
+ IA32_MTRR_FIX4K_E8000,
+ 0
+ },
+ {
+ IA32_MTRR_FIX4K_F0000,
+ 0
+ },
+ {
+ IA32_MTRR_FIX4K_F8000,
+ 0
+ }
+};
+
+EFI_MTRR_VALUES mMtrrDefType[] = { { CACHE_IA32_MTRR_DEF_TYPE, 0 } };
+
+///
+/// Pre-defined Variable MTRR number to 20
+///
+EFI_MTRR_VALUES mVariableMtrrValues[] = {
+ {
+ CACHE_VARIABLE_MTRR_BASE,
+ 0
+ },
+ {
+ CACHE_VARIABLE_MTRR_BASE + 1,
+ 0
+ },
+ {
+ CACHE_VARIABLE_MTRR_BASE + 2,
+ 0
+ },
+ {
+ CACHE_VARIABLE_MTRR_BASE + 3,
+ 0
+ },
+ {
+ CACHE_VARIABLE_MTRR_BASE + 4,
+ 0
+ },
+ {
+ CACHE_VARIABLE_MTRR_BASE + 5,
+ 0
+ },
+ {
+ CACHE_VARIABLE_MTRR_BASE + 6,
+ 0
+ },
+ {
+ CACHE_VARIABLE_MTRR_BASE + 7,
+ 0
+ },
+ {
+ CACHE_VARIABLE_MTRR_BASE + 8,
+ 0
+ },
+ {
+ CACHE_VARIABLE_MTRR_BASE + 9,
+ 0
+ },
+ {
+ CACHE_VARIABLE_MTRR_BASE + 10,
+ 0
+ },
+ {
+ CACHE_VARIABLE_MTRR_BASE + 11,
+ 0
+ },
+ {
+ CACHE_VARIABLE_MTRR_BASE + 12,
+ 0
+ },
+ {
+ CACHE_VARIABLE_MTRR_BASE + 13,
+ 0
+ },
+ {
+ CACHE_VARIABLE_MTRR_BASE + 14,
+ 0
+ },
+ {
+ CACHE_VARIABLE_MTRR_BASE + 15,
+ 0
+ },
+ {
+ CACHE_VARIABLE_MTRR_BASE + 16,
+ 0
+ },
+ {
+ CACHE_VARIABLE_MTRR_BASE + 17,
+ 0
+ },
+ {
+ CACHE_VARIABLE_MTRR_BASE + 18,
+ 0
+ },
+ {
+ CACHE_VARIABLE_MTRR_BASE + 19,
+ 0
+ }
+};
+
+/**
+ Save the MTRR registers to global variables
+**/
+VOID
+ReadMtrrRegisters (
+ VOID
+ )
+{
+
+ UINT32 Index;
+ UINT32 VariableMtrrLimit;
+
+ VariableMtrrLimit = (UINT32) (AsmReadMsr64 (IA32_MTRR_CAP) & B_IA32_MTRR_VARIABLE_SUPPORT);
+ ///
+ /// Only support MAXIMUM_VARIABLE_MTRR_NUMBER variable MTRR
+ ///
+ ASSERT (VariableMtrrLimit <= V_MAXIMUM_VARIABLE_MTRR_NUMBER);
+ if (VariableMtrrLimit > V_MAXIMUM_VARIABLE_MTRR_NUMBER) {
+ VariableMtrrLimit = V_MAXIMUM_VARIABLE_MTRR_NUMBER;
+ }
+ ///
+ /// Read Fixed Mtrrs
+ ///
+ for (Index = 0; Index < sizeof (mFixedMtrrValues) / sizeof (EFI_MTRR_VALUES); Index++) {
+ mFixedMtrrValues[Index].Value = AsmReadMsr64 (mFixedMtrrValues[Index].Index);
+ }
+ ///
+ /// Read def type Fixed Mtrrs
+ ///
+ mMtrrDefType[0].Value = AsmReadMsr64 (CACHE_IA32_MTRR_DEF_TYPE);
+
+ ///
+ /// Read Variable Mtrr
+ ///
+ for (Index = 0; Index < VariableMtrrLimit * 2; Index++) {
+ mVariableMtrrValues[Index].Value = AsmReadMsr64 (mVariableMtrrValues[Index].Index);
+ }
+
+ return;
+}
+
+/**
+ Synch up the MTRR values for all processors
+
+ @param[in] Buffer - Not used.
+**/
+VOID
+EFIAPI
+MpMtrrSynchUp (
+ IN VOID *Buffer
+ )
+{
+ UINT32 Index;
+ UINTN Cr4;
+ UINT64 MsrValue;
+ UINT64 ValidMtrrAddressMask;
+ EFI_CPUID_REGISTER FeatureInfo;
+ EFI_CPUID_REGISTER FunctionInfo;
+ UINT8 PhysicalAddressBits;
+ UINT32 VariableMtrrLimit;
+
+ VariableMtrrLimit = (UINT32) (AsmReadMsr64 (IA32_MTRR_CAP) & B_IA32_MTRR_VARIABLE_SUPPORT);
+ ///
+ /// Only support MAXIMUM_VARIABLE_MTRR_NUMBER variable MTRR
+ ///
+ ASSERT (VariableMtrrLimit <= V_MAXIMUM_VARIABLE_MTRR_NUMBER);
+ if (VariableMtrrLimit > V_MAXIMUM_VARIABLE_MTRR_NUMBER) {
+ VariableMtrrLimit = V_MAXIMUM_VARIABLE_MTRR_NUMBER;
+ }
+ ///
+ /// ASM code to setup processor register before synching up the MTRRs
+ ///
+ Cr4 = MpMtrrSynchUpEntry ();
+
+ ///
+ /// Get physical CPU MTRR width in case of difference from BSP
+ ///
+ AsmCpuid (
+ CPUID_EXTENDED_FUNCTION,
+ &FunctionInfo.RegEax,
+ &FunctionInfo.RegEbx,
+ &FunctionInfo.RegEcx,
+ &FunctionInfo.RegEdx
+ );
+ PhysicalAddressBits = 36;
+ if (FunctionInfo.RegEax >= CPUID_VIR_PHY_ADDRESS_SIZE) {
+ AsmCpuid (
+ CPUID_VIR_PHY_ADDRESS_SIZE,
+ &FeatureInfo.RegEax,
+ &FeatureInfo.RegEbx,
+ &FeatureInfo.RegEcx,
+ &FeatureInfo.RegEdx
+ );
+ PhysicalAddressBits = (UINT8) FeatureInfo.RegEax;
+ }
+
+ ValidMtrrAddressMask = ((((UINT64) 1) << PhysicalAddressBits) - 1) & 0xfffffffffffff000;
+
+ ///
+ /// Disable Fixed Mtrrs
+ ///
+ AsmWriteMsr64 (CACHE_IA32_MTRR_DEF_TYPE, mMtrrDefType[0].Value & 0xFFFFF7FF);
+
+ ///
+ /// Update Fixed Mtrrs
+ ///
+ for (Index = 0; Index < sizeof (mFixedMtrrValues) / sizeof (EFI_MTRR_VALUES); Index++) {
+ AsmWriteMsr64 (mFixedMtrrValues[Index].Index, mFixedMtrrValues[Index].Value);
+ }
+ ///
+ /// Synchup def type Fixed Mtrrs
+ ///
+ AsmWriteMsr64 (CACHE_IA32_MTRR_DEF_TYPE, mMtrrDefType[0].Value);
+
+ ///
+ /// Synchup Base Variable Mtrr
+ ///
+ for (Index = 0; Index < VariableMtrrLimit * 2 - 1; Index += 2) {
+ MsrValue = (mVariableMtrrValues[Index].Value & 0x0FFF) | (mVariableMtrrValues[Index].Value & ValidMtrrAddressMask);
+ AsmWriteMsr64 (mVariableMtrrValues[Index].Index, MsrValue);
+ }
+ ///
+ /// Synchup Mask Variable Mtrr including valid bit
+ ///
+ for (Index = 1; Index < VariableMtrrLimit * 2; Index += 2) {
+ MsrValue = (mVariableMtrrValues[Index].Value & 0x0FFF) | (mVariableMtrrValues[Index].Value & ValidMtrrAddressMask);
+ AsmWriteMsr64 (mVariableMtrrValues[Index].Index, MsrValue);
+ }
+ ///
+ /// ASM code to setup processor register after synching up the MTRRs
+ ///
+ MpMtrrSynchUpExit (Cr4);
+
+ return;
+}
+
+/**
+ Copy Global MTRR data to S3
+**/
+VOID
+SaveBspMtrrForS3 (
+ VOID
+ )
+{
+ UINTN Index;
+ UINTN TableIndex;
+ UINT32 VariableMtrrLimit;
+
+ VariableMtrrLimit = (UINT32) (AsmReadMsr64 (IA32_MTRR_CAP) & B_IA32_MTRR_VARIABLE_SUPPORT);
+ ///
+ /// Only support MAXIMUM_VARIABLE_MTRR_NUMBER variable MTRR
+ ///
+ ASSERT (VariableMtrrLimit <= V_MAXIMUM_VARIABLE_MTRR_NUMBER);
+ if (VariableMtrrLimit > V_MAXIMUM_VARIABLE_MTRR_NUMBER) {
+ VariableMtrrLimit = V_MAXIMUM_VARIABLE_MTRR_NUMBER;
+ }
+
+ TableIndex = 0;
+ for (Index = 0; Index < sizeof (mFixedMtrrValues) / sizeof (EFI_MTRR_VALUES); Index++) {
+ mMPSystemData->S3BspMtrrTable[TableIndex].Index = mFixedMtrrValues[Index].Index;
+ mMPSystemData->S3BspMtrrTable[TableIndex].Value = mFixedMtrrValues[Index].Value;
+ TableIndex++;
+ }
+
+ for (Index = 0; Index < VariableMtrrLimit * 2; Index++) {
+ mMPSystemData->S3BspMtrrTable[TableIndex].Index = mVariableMtrrValues[Index].Index;
+ mMPSystemData->S3BspMtrrTable[TableIndex].Value = mVariableMtrrValues[Index].Value;
+ TableIndex++;
+ }
+
+ mMPSystemData->S3BspMtrrTable[TableIndex].Index = CACHE_IA32_MTRR_DEF_TYPE;
+ mMPSystemData->S3BspMtrrTable[TableIndex].Value = mMtrrDefType[0].Value;
+
+ ASSERT (TableIndex < MAX_CPU_S3_MTRR_ENTRY);
+
+ return;
+}
diff --git a/ReferenceCode/Haswell/CpuInit/Dxe/PiMpService.c b/ReferenceCode/Haswell/CpuInit/Dxe/PiMpService.c
new file mode 100644
index 0000000..a285f65
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Dxe/PiMpService.c
@@ -0,0 +1,957 @@
+/** @file
+ Implementation of PI MP Services Protocol
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+@par Revision Reference:
+ - PI Version 1.2
+
+**/
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "PiMpService.h"
+#endif
+
+EFI_PI_MP_SERVICES_PROTOCOL mPiMpService = {
+ GetNumberOfProcessors,
+ GetProcessorInfo,
+ PiStartupAllAPs,
+ PiStartupThisAP,
+ PiSwitchBSP,
+ PiEnableDisableAP,
+ PiWhoAmI
+};
+
+BOOLEAN mStopCheckAPsStatus = FALSE;
+
+/**
+ Abort any task on the AP and reset the AP to be in idle state.
+
+ @param[in] ProcessorNumber - Processor index of an AP.
+**/
+VOID
+ResetProcessorToIdleState (
+ UINTN ProcessorNumber
+ )
+{
+ CPU_DATA_BLOCK *CpuData;
+
+ CpuData = &mMPSystemData->CpuData[ProcessorNumber];
+
+ SendIPI (
+ &mMpService,
+ ProcessorNumber,
+ 0,
+ DELIVERY_MODE_INIT
+ );
+
+ AsmAcquireMPLock (&CpuData->StateLock);
+ CpuData->State = CPU_STATE_IDLE;
+ AsmReleaseMPLock (&CpuData->StateLock);
+}
+
+/**
+ Searches for the next waiting AP.
+
+ Search for the next AP that is put in waiting state by single-threaded StartupAllAPs().
+
+ @param[in] NextProcessorNumber - Pointer to the processor number of the next waiting AP.
+
+ @retval EFI_SUCCESS - The next waiting AP has been found.
+ @retval EFI_NOT_FOUND - No waiting AP exists.
+**/
+EFI_STATUS
+GetNextWaitingProcessorNumber (
+ OUT UINTN *NextProcessorNumber
+ )
+{
+ UINTN ProcessorNumber;
+
+ for (ProcessorNumber = 0; ProcessorNumber < mMPSystemData->NumberOfCpus; ProcessorNumber++) {
+
+ if (mMPSystemData->CpuList[ProcessorNumber]) {
+ *NextProcessorNumber = ProcessorNumber;
+ return EFI_SUCCESS;
+ }
+ }
+
+ return EFI_NOT_FOUND;
+}
+
+/**
+ Checks status of all APs.
+
+ This function checks whether all APs have finished task assigned by StartupAllAPs(),
+ and whether timeout expires.
+
+ @retval EFI_SUCCESS - All APs have finished task assigned by StartupAllAPs().
+ @retval EFI_TIMEOUT - The timeout expires.
+ @retval EFI_NOT_READY - APs have not finished task and timeout has not expired.
+**/
+EFI_STATUS
+CheckAllAPs (
+ VOID
+ )
+{
+ UINTN ProcessorNumber;
+ UINTN NextProcessorNumber;
+ UINTN ListIndex;
+ EFI_STATUS Status;
+ CPU_STATE CpuState;
+ CPU_DATA_BLOCK *CpuData;
+
+ NextProcessorNumber = 0;
+
+ ///
+ /// Go through all APs that are responsible for the StartupAllAPs().
+ ///
+ for (ProcessorNumber = 0; ProcessorNumber < mMPSystemData->NumberOfCpus; ProcessorNumber++) {
+ if (!mMPSystemData->CpuList[ProcessorNumber]) {
+ continue;
+ }
+
+ CpuData = &mMPSystemData->CpuData[ProcessorNumber];
+
+ ///
+ /// Check the CPU state of AP. If it is CPU_STATE_FINISHED, then the AP has finished its task.
+ /// Only BSP and corresponding AP access this unit of CPU Data. This means the AP will not modify the
+ /// value of state after setting the it to CPU_STATE_FINISHED, so BSP can safely make use of its value.
+ ///
+ AsmAcquireMPLock (&CpuData->StateLock);
+ CpuState = CpuData->State;
+ AsmReleaseMPLock (&CpuData->StateLock);
+
+ if (CpuState == CPU_STATE_FINISHED) {
+ mMPSystemData->FinishCount++;
+ mMPSystemData->CpuList[ProcessorNumber] = FALSE;
+
+ AsmAcquireMPLock (&CpuData->StateLock);
+ CpuData->State = CPU_STATE_IDLE;
+ AsmReleaseMPLock (&CpuData->StateLock);
+
+ ///
+ /// If in Single Thread mode, then search for the next waiting AP for execution.
+ ///
+ if (mMPSystemData->SingleThread) {
+ Status = GetNextWaitingProcessorNumber (&NextProcessorNumber);
+
+ if (!EFI_ERROR (Status)) {
+ WakeUpAp (
+ &mMPSystemData->CpuData[NextProcessorNumber],
+ mMPSystemData->Procedure,
+ mMPSystemData->ProcArguments
+ );
+ }
+ }
+ }
+ }
+ ///
+ /// If all APs finish, return EFI_SUCCESS.
+ ///
+ if (mMPSystemData->FinishCount == mMPSystemData->StartCount) {
+ return EFI_SUCCESS;
+ }
+ ///
+ /// If timeout expires, report timeout.
+ ///
+ if (CheckTimeout (mMPSystemData->ExpectedTime)) {
+ ///
+ /// If FailedCpuList is not NULL, record all failed APs in it.
+ ///
+ if (mMPSystemData->FailedCpuList != NULL) {
+ Status = (gBS->AllocatePool)
+ (
+ EfiBootServicesData,
+ ((mMPSystemData->StartCount - mMPSystemData->FinishCount + 1) * sizeof (UINTN)),
+ (VOID **) mMPSystemData->FailedCpuList
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
+
+ ListIndex = 0;
+
+ for (ProcessorNumber = 0; ProcessorNumber < mMPSystemData->NumberOfCpus; ProcessorNumber++) {
+ ///
+ /// Check whether this processor is responsible for StartupAllAPs().
+ ///
+ if (mMPSystemData->CpuList[ProcessorNumber]) {
+ ///
+ /// Reset failed APs to idle state
+ ///
+ ResetProcessorToIdleState (ProcessorNumber);
+ mMPSystemData->CpuList[ProcessorNumber] = FALSE;
+ if (mMPSystemData->FailedCpuList != NULL) {
+ (*mMPSystemData->FailedCpuList)[ListIndex++] = ProcessorNumber;
+ }
+ }
+ }
+
+ if (mMPSystemData->FailedCpuList != NULL) {
+ (*mMPSystemData->FailedCpuList)[ListIndex] = END_OF_CPU_LIST;
+ }
+
+ return EFI_TIMEOUT;
+ }
+
+ return EFI_NOT_READY;
+}
+
+/**
+ Checks status of specified AP.
+
+ This function checks whether specified AP has finished task assigned by StartupThisAP(),
+ and whether timeout expires.
+
+ @param[in] ProcessorNumber - The handle number of processor.
+
+ @retval EFI_SUCCESS - Specified AP has finished task assigned by StartupThisAPs().
+ @retval EFI_TIMEOUT - The timeout expires.
+ @retval EFI_NOT_READY - Specified AP has not finished task and timeout has not expired.
+**/
+EFI_STATUS
+CheckThisAP (
+ UINTN ProcessorNumber
+ )
+{
+ CPU_DATA_BLOCK *CpuData;
+ CPU_STATE CpuState;
+
+ CpuData = &mMPSystemData->CpuData[ProcessorNumber];
+
+ ///
+ /// Check the CPU state of AP. If it is CPU_STATE_FINISHED, then the AP has finished its task.
+ /// Only BSP and corresponding AP access this unit of CPU Data. This means the AP will not modify the
+ /// value of state after setting the it to CPU_STATE_FINISHED, so BSP can safely make use of its value.
+ ///
+ AsmAcquireMPLock (&CpuData->StateLock);
+ CpuState = CpuData->State;
+ AsmReleaseMPLock (&CpuData->StateLock);
+
+ ///
+ /// If the APs finishes for StartupThisAP(), return EFI_SUCCESS.
+ ///
+ if (CpuState == CPU_STATE_FINISHED) {
+
+ AsmAcquireMPLock (&CpuData->StateLock);
+ CpuData->State = CPU_STATE_IDLE;
+ AsmReleaseMPLock (&CpuData->StateLock);
+
+ if (CpuData->Finished != NULL) {
+ *(CpuData->Finished) = TRUE;
+ }
+
+ return EFI_SUCCESS;
+ } else {
+ ///
+ /// If timeout expires for StartupThisAP(), report timeout.
+ ///
+ if (CheckTimeout (CpuData->ExpectedTime)) {
+
+ if (CpuData->Finished != NULL) {
+ *(CpuData->Finished) = FALSE;
+ }
+ ///
+ /// Reset failed AP to idle state
+ ///
+ ResetProcessorToIdleState (ProcessorNumber);
+
+ return EFI_TIMEOUT;
+ }
+ }
+
+ return EFI_NOT_READY;
+}
+
+/**
+ Checks APs' status periodically.
+
+ This function is triggerred by timer perodically to check the
+ state of APs for StartupAllAPs() and StartupThisAP() executed
+ in non-blocking mode.
+
+ @param[in] Event - Event triggered.
+ @param[in] Context - Parameter passed with the event.
+**/
+VOID
+EFIAPI
+CheckAPsStatus (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ UINTN ProcessorNumber;
+ CPU_DATA_BLOCK *CpuData;
+ EFI_STATUS Status;
+
+ ///
+ /// If CheckAPsStatus() is stopped, then return immediately.
+ ///
+ if (mStopCheckAPsStatus) {
+ return;
+ }
+ ///
+ /// First, check whether pending StartupAllAPs() exists.
+ ///
+ if (mMPSystemData->WaitEvent != NULL) {
+
+ Status = CheckAllAPs ();
+ ///
+ /// If all APs finish for StartupAllAPs(), signal the WaitEvent for it..
+ ///
+ if (Status != EFI_NOT_READY) {
+ Status = gBS->SignalEvent (mMPSystemData->WaitEvent);
+ mMPSystemData->WaitEvent = NULL;
+ }
+ }
+ ///
+ /// Second, check whether pending StartupThisAPs() callings exist.
+ ///
+ for (ProcessorNumber = 0; ProcessorNumber < mMPSystemData->NumberOfCpus; ProcessorNumber++) {
+
+ CpuData = &mMPSystemData->CpuData[ProcessorNumber];
+
+ if (CpuData->WaitEvent == NULL) {
+ continue;
+ }
+
+ Status = CheckThisAP (ProcessorNumber);
+
+ if (Status != EFI_NOT_READY) {
+ gBS->SignalEvent (CpuData->WaitEvent);
+ CpuData->WaitEvent = NULL;
+ }
+ }
+
+ return;
+}
+
+/**
+ Implementation of GetNumberOfProcessors() service of MP Services Protocol.
+
+ This service retrieves the number of logical processor in the platform
+ and the number of those logical processors that are enabled on this boot.
+ This service may only be called from the BSP.
+
+ @param[in] This - A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
+ @param[in] NumberOfProcessors - Pointer to the total number of logical processors in the system,
+ including the BSP and disabled APs.
+ @param[in] NumberOfEnabledProcessors - Pointer to the number of enabled logical processors that exist
+ in system, including the BSP.
+
+ @retval EFI_SUCCESS - Number of logical processors and enabled logical processors retrieved..
+ @retval EFI_DEVICE_ERROR - Caller processor is AP.
+ @retval EFI_INVALID_PARAMETER - NumberOfProcessors is NULL.
+ @retval EFI_INVALID_PARAMETER - NumberOfEnabledProcessors is NULL.
+**/
+EFI_STATUS
+EFIAPI
+GetNumberOfProcessors (
+ IN EFI_PI_MP_SERVICES_PROTOCOL *This,
+ OUT UINTN *NumberOfProcessors,
+ OUT UINTN *NumberOfEnabledProcessors
+ )
+{
+ EFI_STATUS Status;
+ UINTN CallerNumber;
+
+ ///
+ /// Check whether caller processor is BSP
+ ///
+ WhoAmI (&mMpService, &CallerNumber);
+ if (CallerNumber != mMPSystemData->BSP) {
+ return EFI_DEVICE_ERROR;
+ }
+ ///
+ /// Check parameter NumberOfProcessors and NumberOfEnabledProcessors
+ ///
+ if (NumberOfProcessors == NULL || NumberOfEnabledProcessors == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Status = GetGeneralMPInfo (
+ &mMpService,
+ NumberOfProcessors,
+ NULL,
+ NumberOfEnabledProcessors,
+ NULL,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ return Status;
+}
+
+/**
+ Implementation of GetNumberOfProcessors() service of MP Services Protocol.
+
+ Gets detailed MP-related information on the requested processor at the
+ instant this call is made. This service may only be called from the BSP.
+
+ @param[in] This - A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
+ @param[in] ProcessorNumber - The handle number of processor.
+ @param[in] ProcessorInfoBuffer - A pointer to the buffer where information for the requested processor is deposited.
+
+ @retval EFI_SUCCESS - Processor information successfully returned.
+ @retval EFI_DEVICE_ERROR - Caller processor is AP.
+ @retval EFI_INVALID_PARAMETER - ProcessorInfoBuffer is NULL
+ @retval EFI_NOT_FOUND - Processor with the handle specified by ProcessorNumber does not exist.
+**/
+EFI_STATUS
+EFIAPI
+GetProcessorInfo (
+ IN EFI_PI_MP_SERVICES_PROTOCOL *This,
+ IN UINTN ProcessorNumber,
+ OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer
+ )
+{
+ EFI_STATUS Status;
+ UINTN CallerNumber;
+ UINTN BufferSize;
+ EFI_MP_PROC_CONTEXT ProcessorContextBuffer;
+
+ ///
+ /// Check whether caller processor is BSP
+ ///
+ WhoAmI (&mMpService, &CallerNumber);
+ if (CallerNumber != mMPSystemData->BSP) {
+ return EFI_DEVICE_ERROR;
+ }
+ ///
+ /// Check parameter ProcessorInfoBuffer
+ ///
+ if (ProcessorInfoBuffer == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+ ///
+ /// Check whether processor with the handle specified by ProcessorNumber exists
+ ///
+ if (ProcessorNumber >= mMPSystemData->NumberOfCpus) {
+ return EFI_NOT_FOUND;
+ }
+
+ BufferSize = sizeof (EFI_MP_PROC_CONTEXT);
+ Status = GetProcessorContext (
+ &mMpService,
+ ProcessorNumber,
+ &BufferSize,
+ &ProcessorContextBuffer
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ProcessorInfoBuffer->ProcessorId = (UINT64) ProcessorContextBuffer.ApicID;
+
+ ///
+ /// Get Status Flag of specified processor
+ ///
+ ProcessorInfoBuffer->StatusFlag = 0;
+
+ if (ProcessorContextBuffer.Enabled) {
+ ProcessorInfoBuffer->StatusFlag |= PROCESSOR_ENABLED_BIT;
+ }
+
+ if (ProcessorContextBuffer.Designation == EfiCpuBSP) {
+ ProcessorInfoBuffer->StatusFlag |= PROCESSOR_AS_BSP_BIT;
+ }
+
+ if (ProcessorContextBuffer.Health.Flags.Uint32 == 0) {
+ ProcessorInfoBuffer->StatusFlag |= PROCESSOR_HEALTH_STATUS_BIT;
+ }
+
+ ProcessorInfoBuffer->Location.Package = (UINT32) ProcessorContextBuffer.PackageNumber;
+ ProcessorInfoBuffer->Location.Core = (UINT32) ProcessorContextBuffer.NumberOfCores;
+ ProcessorInfoBuffer->Location.Thread = (UINT32) ProcessorContextBuffer.NumberOfThreads;
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Implementation of StartupAllAPs() service of MP Services Protocol.
+
+ This service lets the caller get all enabled APs to execute a caller-provided function.
+ This service may only be called from the BSP.
+
+ @param[in] This - A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
+ @param[in] Procedure - A pointer to the function to be run on enabled APs of the system.
+ @param[in] SingleThread - Indicates whether to execute the function simultaneously or one by one..
+ @param[in] WaitEvent - The event created by the caller.
+ If it is NULL, then execute in blocking mode.
+ If it is not NULL, then execute in non-blocking mode.
+ @param[in] TimeoutInMicroSeconds - The time limit in microseconds for this AP to finish the function.
+ Zero means infinity.
+ @param[in] ProcedureArgument - Pointer to the optional parameter of the assigned function.
+ @param[in] FailedCpuList - The list of processor numbers that fail to finish the function before
+ TimeoutInMicrosecsond expires.
+
+ @retval EFI_SUCCESS - In blocking mode, all APs have finished before the timeout expired.
+ @retval EFI_SUCCESS - In non-blocking mode, function has been dispatched to all enabled APs.
+ @retval EFI_DEVICE_ERROR - Caller processor is AP.
+ @retval EFI_NOT_STARTED - No enabled AP exists in the system.
+ @retval EFI_NOT_READY - Any enabled AP is busy.
+ @retval EFI_TIMEOUT - In blocking mode, The timeout expired before all enabled APs have finished.
+ @retval EFI_INVALID_PARAMETER - Procedure is NULL.
+**/
+EFI_STATUS
+EFIAPI
+PiStartupAllAPs (
+ IN EFI_PI_MP_SERVICES_PROTOCOL *This,
+ IN EFI_AP_PROCEDURE Procedure,
+ IN BOOLEAN SingleThread,
+ IN EFI_EVENT WaitEvent OPTIONAL,
+ IN UINTN TimeoutInMicroSeconds,
+ IN VOID *ProcedureArgument OPTIONAL,
+ OUT UINTN **FailedCpuList OPTIONAL
+ )
+{
+ EFI_STATUS Status;
+ UINTN ProcessorNumber;
+ CPU_DATA_BLOCK *CpuData;
+ BOOLEAN Blocking;
+
+ if (FailedCpuList != NULL) {
+ *FailedCpuList = NULL;
+ }
+ ///
+ /// Check whether caller processor is BSP
+ ///
+ WhoAmI (&mMpService, &ProcessorNumber);
+ if (ProcessorNumber != mMPSystemData->BSP) {
+ return EFI_DEVICE_ERROR;
+ }
+ ///
+ /// Check parameter Procedure
+ ///
+ if (Procedure == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+ ///
+ /// Temporarily suppress CheckAPsStatus()
+ ///
+ mStopCheckAPsStatus = TRUE;
+
+ ///
+ /// Check whether all enabled APs are idle.
+ /// If any enabled AP is not idle, return EFI_NOT_READY.
+ ///
+ for (ProcessorNumber = 0; ProcessorNumber < mMPSystemData->NumberOfCpus; ProcessorNumber++) {
+
+ CpuData = &mMPSystemData->CpuData[ProcessorNumber];
+
+ mMPSystemData->CpuList[ProcessorNumber] = FALSE;
+ ///
+ /// Skip BSP and disabled APs.
+ ///
+ if (ProcessorNumber == mMPSystemData->BSP || CpuData->State == CPU_STATE_DISABLED) {
+ continue;
+ }
+ ///
+ /// If any enabled APs are busy, return EFI_NOT_FOUND.
+ ///
+ if (CpuData->State != CPU_STATE_IDLE) {
+ mStopCheckAPsStatus = FALSE;
+ return EFI_NOT_READY;
+ } else {
+ ///
+ /// Mark this processor as responsible for current calling.
+ ///
+ mMPSystemData->CpuList[ProcessorNumber] = TRUE;
+ }
+ }
+ ///
+ /// All enabled APs are idle, we can safely initiate a new session
+ ///
+ mMPSystemData->FinishCount = 0;
+ mMPSystemData->StartCount = 0;
+ Blocking = FALSE;
+ ///
+ /// Go through all enabled APs to wakeup them for Procedure.
+ /// If in Single Thread mode, then only one AP is woken up, and others are waiting.
+ ///
+ for (ProcessorNumber = 0; ProcessorNumber < mMPSystemData->NumberOfCpus; ProcessorNumber++) {
+
+ CpuData = &mMPSystemData->CpuData[ProcessorNumber];
+ ///
+ /// Check whether this processor is responsible for current calling.
+ ///
+ if (mMPSystemData->CpuList[ProcessorNumber]) {
+
+ mMPSystemData->StartCount++;
+
+ AsmAcquireMPLock (&CpuData->StateLock);
+ CpuData->State = CPU_STATE_READY;
+ AsmReleaseMPLock (&CpuData->StateLock);
+
+ if (!Blocking) {
+ WakeUpAp (
+ CpuData,
+ Procedure,
+ ProcedureArgument
+ );
+ }
+
+ if (SingleThread) {
+ Blocking = TRUE;
+ }
+ }
+ }
+ ///
+ /// If no enabled AP exists, return EFI_NOT_STARTED.
+ ///
+ if (mMPSystemData->StartCount == 0) {
+ mStopCheckAPsStatus = FALSE;
+ return EFI_NOT_STARTED;
+ }
+ ///
+ /// If WaitEvent is not NULL, execute in non-blocking mode.
+ /// BSP saves data for CheckAPsStatus(), and returns EFI_SUCCESS.
+ /// CheckAPsStatus() will check completion and timeout periodically.
+ ///
+ mMPSystemData->Procedure = Procedure;
+ mMPSystemData->ProcArguments = ProcedureArgument;
+ mMPSystemData->SingleThread = SingleThread;
+ mMPSystemData->FailedCpuList = FailedCpuList;
+ mMPSystemData->ExpectedTime = CalculateTimeout (TimeoutInMicroSeconds);
+ mMPSystemData->WaitEvent = WaitEvent;
+
+ ///
+ /// Allow CheckAPsStatus()
+ ///
+ mStopCheckAPsStatus = FALSE;
+
+ if (WaitEvent != NULL) {
+ return EFI_SUCCESS;
+ }
+ ///
+ /// If WaitEvent is NULL, execute in blocking mode.
+ /// BSP checks APs'state until all APs finish or TimeoutInMicrosecsond expires.
+ ///
+ do {
+ Status = CheckAllAPs ();
+ } while (Status == EFI_NOT_READY);
+
+ return Status;
+}
+
+/**
+ Implementation of StartupThisAP() service of MP Services Protocol.
+
+ This service lets the caller get one enabled AP to execute a caller-provided function.
+ This service may only be called from the BSP.
+
+ @param[in] This - A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
+ @param[in] Procedure - A pointer to the function to be run on the designated AP.
+ @param[in] ProcessorNumber - The handle number of AP..
+ @param[in] WaitEvent - The event created by the caller.
+ If it is NULL, then execute in blocking mode.
+ If it is not NULL, then execute in non-blocking mode.
+ @param[in] TimeoutInMicroseconds - The time limit in microseconds for this AP to finish the function.
+ Zero means infinity.
+ @param[in] ProcedureArgument - Pointer to the optional parameter of the assigned function.
+ @param[in] Finished - Indicates whether AP has finished assigned function.
+ In blocking mode, it is ignored.
+
+ @retval EFI_SUCCESS - In blocking mode, specified AP has finished before the timeout expires.
+ @retval EFI_SUCCESS - In non-blocking mode, function has been dispatched to specified AP.
+ @retval EFI_DEVICE_ERROR - Caller processor is AP.
+ @retval EFI_TIMEOUT - In blocking mode, the timeout expires before specified AP has finished.
+ @retval EFI_NOT_READY - Specified AP is busy.
+ @retval EFI_NOT_FOUND - Processor with the handle specified by ProcessorNumber does not exist.
+ @retval EFI_INVALID_PARAMETER - ProcessorNumber specifies the BSP or disabled AP.
+ @retval EFI_INVALID_PARAMETER - Procedure is NULL.
+**/
+EFI_STATUS
+EFIAPI
+PiStartupThisAP (
+ IN EFI_PI_MP_SERVICES_PROTOCOL *This,
+ IN EFI_AP_PROCEDURE Procedure,
+ IN UINTN ProcessorNumber,
+ IN EFI_EVENT WaitEvent OPTIONAL,
+ IN UINTN TimeoutInMicroseconds,
+ IN VOID *ProcedureArgument OPTIONAL,
+ OUT BOOLEAN *Finished OPTIONAL
+ )
+{
+ CPU_DATA_BLOCK *CpuData;
+ UINTN CallerNumber;
+ EFI_STATUS Status;
+
+ if (Finished != NULL) {
+ *Finished = TRUE;
+ }
+ ///
+ /// Check whether caller processor is BSP
+ ///
+ WhoAmI (&mMpService, &CallerNumber);
+ if (CallerNumber != mMPSystemData->BSP) {
+ return EFI_DEVICE_ERROR;
+ }
+ ///
+ /// Check whether processor with the handle specified by ProcessorNumber exists
+ ///
+ if (ProcessorNumber >= mMPSystemData->NumberOfCpus) {
+ return EFI_NOT_FOUND;
+ }
+ ///
+ /// Check whether specified processor is BSP
+ ///
+ if (ProcessorNumber == mMPSystemData->BSP) {
+ return EFI_INVALID_PARAMETER;
+ }
+ ///
+ /// Check parameter Procedure
+ ///
+ if (Procedure == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ CpuData = &mMPSystemData->CpuData[ProcessorNumber];
+
+ ///
+ /// Temporarily suppress CheckAPsStatus()
+ ///
+ mStopCheckAPsStatus = TRUE;
+
+ ///
+ /// Check whether specified AP is disabled
+ ///
+ if (CpuData->State == CPU_STATE_DISABLED) {
+ mStopCheckAPsStatus = FALSE;
+ return EFI_INVALID_PARAMETER;
+ }
+ ///
+ /// Check whether specified AP is busy
+ ///
+ if (CpuData->State != CPU_STATE_IDLE) {
+ mStopCheckAPsStatus = FALSE;
+ return EFI_NOT_READY;
+ }
+ ///
+ /// Wakeup specified AP for Procedure.
+ ///
+ AsmAcquireMPLock (&CpuData->StateLock);
+ CpuData->State = CPU_STATE_READY;
+ AsmReleaseMPLock (&CpuData->StateLock);
+
+ WakeUpAp (
+ CpuData,
+ Procedure,
+ ProcedureArgument
+ );
+
+ ///
+ /// If WaitEvent is not NULL, execute in non-blocking mode.
+ /// BSP saves data for CheckAPsStatus(), and returns EFI_SUCCESS.
+ /// CheckAPsStatus() will check completion and timeout periodically.
+ ///
+ CpuData->WaitEvent = WaitEvent;
+ CpuData->Finished = Finished;
+ CpuData->ExpectedTime = CalculateTimeout (TimeoutInMicroseconds);
+
+ ///
+ /// Allow CheckAPsStatus()
+ ///
+ mStopCheckAPsStatus = FALSE;
+
+ if (WaitEvent != NULL) {
+ return EFI_SUCCESS;
+ }
+ ///
+ /// If WaitEvent is NULL, execute in blocking mode.
+ /// BSP checks AP's state until it finishes or TimeoutInMicrosecsond expires.
+ ///
+ do {
+ Status = CheckThisAP (ProcessorNumber);
+ } while (Status == EFI_NOT_READY);
+
+ return Status;
+}
+
+/**
+ Implementation of SwitchBSP() service of MP Services Protocol.
+
+ This service switches the requested AP to be the BSP from that point onward.
+ This service may only be called from the current BSP.
+
+ @param[in] This - A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
+ @param[in] ProcessorNumber - The handle number of processor.
+ @param[in] EnableOldBSP - Whether to enable or disable the original BSP.
+
+ @retval EFI_SUCCESS - BSP successfully switched.
+ @retval EFI_DEVICE_ERROR - Caller processor is AP.
+ @retval EFI_NOT_FOUND - Processor with the handle specified by ProcessorNumber does not exist.
+ @retval EFI_INVALID_PARAMETER - ProcessorNumber specifies the BSP or disabled AP.
+ @retval EFI_NOT_READY - Specified AP is busy.
+**/
+EFI_STATUS
+EFIAPI
+PiSwitchBSP (
+ IN EFI_PI_MP_SERVICES_PROTOCOL *This,
+ IN UINTN ProcessorNumber,
+ IN BOOLEAN EnableOldBSP
+ )
+{
+ EFI_STATUS Status;
+ CPU_DATA_BLOCK *CpuData;
+ UINTN CallerNumber;
+
+ ///
+ /// Check whether caller processor is BSP
+ ///
+ WhoAmI (&mMpService, &CallerNumber);
+ if (CallerNumber != mMPSystemData->BSP) {
+ return EFI_DEVICE_ERROR;
+ }
+ ///
+ /// Check whether processor with the handle specified by ProcessorNumber exists
+ ///
+ if (ProcessorNumber >= mMPSystemData->NumberOfCpus) {
+ return EFI_NOT_FOUND;
+ }
+ ///
+ /// Check whether specified processor is BSP
+ ///
+ if (ProcessorNumber == mMPSystemData->BSP) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ CpuData = &mMPSystemData->CpuData[ProcessorNumber];
+
+ ///
+ /// Check whether specified AP is disabled
+ ///
+ if (CpuData->State == CPU_STATE_DISABLED) {
+ return EFI_INVALID_PARAMETER;
+ }
+ ///
+ /// Check whether specified AP is busy
+ ///
+ if (CpuData->State != CPU_STATE_IDLE) {
+ return EFI_NOT_READY;
+ }
+
+ Status = SwitchBSP (
+ &mMpService,
+ ProcessorNumber,
+ EnableOldBSP
+ );
+ ASSERT_EFI_ERROR (Status);
+ return Status;
+}
+
+/**
+ Implementation of EnableDisableAP() service of MP Services Protocol.
+
+ This service lets the caller enable or disable an AP.
+ This service may only be called from the BSP.
+
+ @param[in] This - A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
+ @param[in] ProcessorNumber - The handle number of processor.
+ @param[in] EnableAP - Indicates whether the newstate of the AP is enabled or disabled.
+ @param[in] HealthFlag - Indicates new health state of the AP..
+
+ @retval EFI_SUCCESS - AP successfully enabled or disabled.
+ @retval EFI_DEVICE_ERROR - Caller processor is AP.
+ @retval EFI_NOT_FOUND - Processor with the handle specified by ProcessorNumber does not exist.
+ @retval EFI_INVALID_PARAMETERS - ProcessorNumber specifies the BSP.
+**/
+EFI_STATUS
+EFIAPI
+PiEnableDisableAP (
+ IN EFI_PI_MP_SERVICES_PROTOCOL *This,
+ IN UINTN ProcessorNumber,
+ IN BOOLEAN EnableAP,
+ IN UINT32 *HealthFlag OPTIONAL
+ )
+{
+ EFI_STATUS Status;
+ UINTN CallerNumber;
+ EFI_MP_HEALTH HealthState;
+ EFI_MP_HEALTH *HealthStatePointer;
+
+ ///
+ /// Check whether caller processor is BSP
+ ///
+ WhoAmI (&mMpService, &CallerNumber);
+ if (CallerNumber != mMPSystemData->BSP) {
+ return EFI_DEVICE_ERROR;
+ }
+ ///
+ /// Check whether processor with the handle specified by ProcessorNumber exists
+ ///
+ if (ProcessorNumber >= mMPSystemData->NumberOfCpus) {
+ return EFI_NOT_FOUND;
+ }
+ ///
+ /// Check whether specified processor is BSP
+ ///
+ if (ProcessorNumber == mMPSystemData->BSP) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (HealthFlag == NULL) {
+ HealthStatePointer = NULL;
+ } else {
+ if ((*HealthFlag & PROCESSOR_HEALTH_STATUS_BIT) == 0) {
+ HealthState.Flags.Uint32 = 1;
+ } else {
+ HealthState.Flags.Uint32 = 0;
+ }
+
+ HealthState.TestStatus = 0;
+
+ HealthStatePointer = &HealthState;
+ }
+
+ Status = EnableDisableAP (
+ &mMpService,
+ ProcessorNumber,
+ EnableAP,
+ HealthStatePointer
+ );
+ ASSERT_EFI_ERROR (Status);
+ return Status;
+}
+
+/**
+ Implementation of WhoAmI() service of MP Services Protocol.
+
+ This service lets the caller processor get its handle number.
+ This service may be called from the BSP and APs.
+
+ @param[in] This - A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
+ @param[in] ProcessorNumber - Pointer to the handle number of AP.
+
+ @retval EFI_SUCCESS - Processor number successfully returned.
+ @retval EFI_INVALID_PARAMETER - ProcessorNumber is NULL
+**/
+EFI_STATUS
+EFIAPI
+PiWhoAmI (
+ IN EFI_PI_MP_SERVICES_PROTOCOL *This,
+ OUT UINTN *ProcessorNumber
+ )
+{
+ EFI_STATUS Status;
+
+ if (ProcessorNumber == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Status = WhoAmI (&mMpService, ProcessorNumber);
+ ASSERT_EFI_ERROR (Status);
+
+ return Status;
+}
diff --git a/ReferenceCode/Haswell/CpuInit/Dxe/PiMpService.h b/ReferenceCode/Haswell/CpuInit/Dxe/PiMpService.h
new file mode 100644
index 0000000..0e2bccf
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Dxe/PiMpService.h
@@ -0,0 +1,242 @@
+/** @file
+ some definitions for PI MP services Protocol.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#ifndef _PI_MP_SERVICE_H_
+#define _PI_MP_SERVICE_H_
+
+#include "MpService.h"
+
+///
+/// Driver Produced Protocol.
+///
+#include EFI_PROTOCOL_PRODUCER (PiMpService)
+
+/**
+ Implementation of GetNumberOfProcessors() service of MP Services Protocol.
+
+ This service retrieves the number of logical processor in the platform
+ and the number of those logical processors that are enabled on this boot.
+ This service may only be called from the BSP.
+
+ @param[in] This - A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
+ @param[in] NumberOfProcessors - Pointer to the total number of logical processors in the system,
+ including the BSP and disabled APs.
+ @param[in] NumberOfEnabledProcessors - Pointer to the number of enabled logical processors that exist
+ in system, including the BSP.
+
+ @retval EFI_SUCCESS - Number of logical processors and enabled logical processors retrieved..
+ @retval EFI_DEVICE_ERROR - Caller processor is AP.
+ @retval EFI_INVALID_PARAMETER - NumberOfProcessors is NULL.
+ @retval EFI_INVALID_PARAMETER - NumberOfEnabledProcessors is NULL.
+**/
+EFI_STATUS
+EFIAPI
+GetNumberOfProcessors (
+ IN EFI_PI_MP_SERVICES_PROTOCOL *This,
+ OUT UINTN *NumberOfProcessors,
+ OUT UINTN *NumberOfEnabledProcessors
+ );
+
+/**
+ Implementation of GetNumberOfProcessors() service of MP Services Protocol.
+
+ Gets detailed MP-related information on the requested processor at the
+ instant this call is made. This service may only be called from the BSP.
+
+ @param[in] This - A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
+ @param[in] ProcessorNumber - The handle number of processor.
+ @param[in] ProcessorInfoBuffer - A pointer to the buffer where information for the requested processor is deposited.
+
+ @retval EFI_SUCCESS - Processor information successfully returned.
+ @retval EFI_DEVICE_ERROR - Caller processor is AP.
+ @retval EFI_INVALID_PARAMETER - ProcessorInfoBuffer is NULL
+ @retval EFI_NOT_FOUND - Processor with the handle specified by ProcessorNumber does not exist.
+**/
+EFI_STATUS
+EFIAPI
+GetProcessorInfo (
+ IN EFI_PI_MP_SERVICES_PROTOCOL *This,
+ IN UINTN ProcessorNumber,
+ OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer
+ );
+
+/**
+ Implementation of StartupThisAP() service of MP Services Protocol.
+
+ This service lets the caller get one enabled AP to execute a caller-provided function.
+ This service may only be called from the BSP.
+
+ @param[in] This - A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
+ @param[in] Procedure - A pointer to the function to be run on the designated AP.
+ @param[in] ProcessorNumber - The handle number of AP..
+ @param[in] WaitEvent - The event created by the caller.
+ If it is NULL, then execute in blocking mode.
+ If it is not NULL, then execute in non-blocking mode.
+ @param[in] TimeoutInMicroseconds - The time limit in microseconds for this AP to finish the function.
+ Zero means infinity.
+ @param[in] ProcedureArgument - Pointer to the optional parameter of the assigned function.
+ @param[in] Finished - Indicates whether AP has finished assigned function.
+ In blocking mode, it is ignored.
+
+ @retval EFI_SUCCESS - In blocking mode, specified AP has finished before the timeout expires.
+ @retval EFI_SUCCESS - In non-blocking mode, function has been dispatched to specified AP.
+ @retval EFI_DEVICE_ERROR - Caller processor is AP.
+ @retval EFI_TIMEOUT - In blocking mode, the timeout expires before specified AP has finished.
+ @retval EFI_NOT_READY - Specified AP is busy.
+ @retval EFI_NOT_FOUND - Processor with the handle specified by ProcessorNumber does not exist.
+ @retval EFI_INVALID_PARAMETER - ProcessorNumber specifies the BSP or disabled AP.
+ @retval EFI_INVALID_PARAMETER - Procedure is NULL.
+**/
+EFI_STATUS
+EFIAPI
+PiStartupThisAP (
+ IN EFI_PI_MP_SERVICES_PROTOCOL *This,
+ IN EFI_AP_PROCEDURE Procedure,
+ IN UINTN ProcessorNumber,
+ IN EFI_EVENT WaitEvent OPTIONAL,
+ IN UINTN TimeoutInMicroseconds,
+ IN VOID *ProcedureArgument OPTIONAL,
+ OUT BOOLEAN *Finished OPTIONAL
+ );
+
+/**
+ Implementation of StartupAllAPs() service of MP Services Protocol.
+
+ This service lets the caller get all enabled APs to execute a caller-provided function.
+ This service may only be called from the BSP.
+
+ @param[in] This - A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
+ @param[in] Procedure - A pointer to the function to be run on enabled APs of the system.
+ @param[in] SingleThread - Indicates whether to execute the function simultaneously or one by one..
+ @param[in] WaitEvent - The event created by the caller.
+ If it is NULL, then execute in blocking mode.
+ If it is not NULL, then execute in non-blocking mode.
+ @param[in] TimeoutInMicroSeconds - The time limit in microseconds for this AP to finish the function.
+ Zero means infinity.
+ @param[in] ProcedureArgument - Pointer to the optional parameter of the assigned function.
+ @param[in] FailedCpuList - The list of processor numbers that fail to finish the function before
+ TimeoutInMicrosecsond expires.
+
+ @retval EFI_SUCCESS - In blocking mode, all APs have finished before the timeout expired.
+ @retval EFI_SUCCESS - In non-blocking mode, function has been dispatched to all enabled APs.
+ @retval EFI_DEVICE_ERROR - Caller processor is AP.
+ @retval EFI_NOT_STARTED - No enabled AP exists in the system.
+ @retval EFI_NOT_READY - Any enabled AP is busy.
+ @retval EFI_TIMEOUT - In blocking mode, The timeout expired before all enabled APs have finished.
+ @retval EFI_INVALID_PARAMETER - Procedure is NULL.
+**/
+EFI_STATUS
+EFIAPI
+PiStartupAllAPs (
+ IN EFI_PI_MP_SERVICES_PROTOCOL *This,
+ IN EFI_AP_PROCEDURE Procedure,
+ IN BOOLEAN SingleThread,
+ IN EFI_EVENT WaitEvent OPTIONAL,
+ IN UINTN TimeoutInMicroSeconds,
+ IN VOID *ProcedureArgument OPTIONAL,
+ OUT UINTN **FailedCpuList OPTIONAL
+ );
+
+/**
+ Implementation of SwitchBSP() service of MP Services Protocol.
+
+ This service switches the requested AP to be the BSP from that point onward.
+ This service may only be called from the current BSP.
+
+ @param[in] This - A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
+ @param[in] ProcessorNumber - The handle number of processor.
+ @param[in] EnableOldBSP - Whether to enable or disable the original BSP.
+
+ @retval EFI_SUCCESS - BSP successfully switched.
+ @retval EFI_DEVICE_ERROR - Caller processor is AP.
+ @retval EFI_NOT_FOUND - Processor with the handle specified by ProcessorNumber does not exist.
+ @retval EFI_INVALID_PARAMETER - ProcessorNumber specifies the BSP or disabled AP.
+ @retval EFI_NOT_READY - Specified AP is busy.
+**/
+EFI_STATUS
+EFIAPI
+PiSwitchBSP (
+ IN EFI_PI_MP_SERVICES_PROTOCOL *This,
+ IN UINTN ProcessorNumber,
+ IN BOOLEAN EnableOldBSP
+ );
+
+/**
+ Implementation of EnableDisableAP() service of MP Services Protocol.
+
+ This service lets the caller enable or disable an AP.
+ This service may only be called from the BSP.
+
+ @param[in] This - A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
+ @param[in] ProcessorNumber - The handle number of processor.
+ @param[in] EnableAP - Indicates whether the newstate of the AP is enabled or disabled.
+ @param[in] HealthFlag - Indicates new health state of the AP..
+
+ @retval EFI_SUCCESS - AP successfully enabled or disabled.
+ @retval EFI_DEVICE_ERROR - Caller processor is AP.
+ @retval EFI_NOT_FOUND - Processor with the handle specified by ProcessorNumber does not exist.
+ @retval EFI_INVALID_PARAMETERS - ProcessorNumber specifies the BSP.
+**/
+EFI_STATUS
+EFIAPI
+PiEnableDisableAP (
+ IN EFI_PI_MP_SERVICES_PROTOCOL *This,
+ IN UINTN ProcessorNumber,
+ IN BOOLEAN EnableAP,
+ IN UINT32 *HealthFlag OPTIONAL
+ );
+
+/**
+ Implementation of WhoAmI() service of MP Services Protocol.
+
+ This service lets the caller processor get its handle number.
+ This service may be called from the BSP and APs.
+
+ @param[in] This - A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
+ @param[in] ProcessorNumber - Pointer to the handle number of AP.
+
+ @retval EFI_SUCCESS - Processor number successfully returned.
+ @retval EFI_INVALID_PARAMETER - ProcessorNumber is NULL
+**/
+EFI_STATUS
+EFIAPI
+PiWhoAmI (
+ IN EFI_PI_MP_SERVICES_PROTOCOL *This,
+ OUT UINTN *ProcessorNumber
+ );
+
+/**
+ Checks APs' status periodically.
+
+ This function is triggerred by timer perodically to check the
+ state of APs for StartupAllAPs() and StartupThisAP() executed
+ in non-blocking mode.
+
+ @param[in] Event - Event triggered.
+ @param[in] Context - Parameter passed with the event.
+**/
+VOID
+EFIAPI
+CheckAPsStatus (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ );
+
+#endif
diff --git a/ReferenceCode/Haswell/CpuInit/Dxe/ProcessorData.c b/ReferenceCode/Haswell/CpuInit/Dxe/ProcessorData.c
new file mode 100644
index 0000000..f3a47a5
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Dxe/ProcessorData.c
@@ -0,0 +1,795 @@
+/** @file
+ Produces CPU data records.
+
+Revision History
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "ProcessorData.h"
+#include "MpCommon.h"
+#include "MpService.h"
+
+///
+/// This is the VFR compiler generated header file which defines the
+/// string identifiers.
+///
+#include "CpuInitDxeStrDefs.h"
+
+#endif
+
+extern MP_SYSTEM_DATA *mMPSystemData;
+extern DXE_CPU_PLATFORM_POLICY_PROTOCOL *mPlatformCpu;
+
+#if (EFI_SPECIFICATION_VERSION < 0x2000A)
+extern EFI_HII_PROTOCOL *mHii;
+#endif
+extern EFI_DATA_HUB_PROTOCOL *mDataHub;
+extern DXE_CPU_PLATFORM_POLICY_PROTOCOL *mPlatformCpu;
+extern EFI_HII_HANDLE mStringHandle;
+
+EFI_SUBCLASS_TYPE1_HEADER mCpuDataRecordHeader = {
+ EFI_PROCESSOR_SUBCLASS_VERSION, ///< Version
+ sizeof (EFI_SUBCLASS_TYPE1_HEADER), ///< Header Size
+ 0, ///< Instance, Initialize later
+ EFI_SUBCLASS_INSTANCE_NON_APPLICABLE, ///< SubInstance
+ 0 ///< RecordType, Initialize later
+};
+
+EFI_STATUS
+LogCpuData (
+ EFI_DATA_HUB_PROTOCOL *DataHub,
+ UINT8 *Buffer,
+ UINT32 Size
+ );
+
+typedef struct _PROCESSOR_FAMILY_FIELD {
+ CHAR8 ProcessorFamily[48];
+ UINT16 ProcessorEnum;
+} PROCESSOR_FAMILY_FIELD;
+
+PROCESSOR_FAMILY_FIELD ProcessorFamilyField[] = {
+ {
+ "Intel(R) Core(TM) i7",
+ 0xC6
+ },
+ {
+ "Intel(R) Core(TM) i5",
+ 0xCD
+ },
+ {
+ "Intel(R) Core(TM) i3",
+ 0xCE
+ },
+ {
+ "Intel(R) Xeon(R) CPU",
+ 0xB3
+ },
+ {
+ "Intel(R) Pentium(R) CPU",
+ 0x0B
+ },
+ {
+ "Intel(R) Celeron(R) CPU",
+ 0x0F
+ },
+};
+
+/**
+ Converts an ascii string to unicode string 16 chars at a time.
+
+ @param[in] AsciiString - Pointer to input Ascii string.
+ @param[in] UnicodeString - Pointer to output Unicode string buffer.
+**/
+VOID
+AsciiToUnicode (
+ IN CHAR8 *AsciiString,
+ IN OUT CHAR16 *UnicodeString
+ )
+{
+ UINT8 Index;
+
+ for (Index = 0; Index < 16; Index++) {
+ UnicodeString[Index] = (CHAR16) AsciiString[Index];
+ }
+
+ return;
+}
+///
+/// Processor-specific routines
+///
+/**
+ Returns the procesor version string token installed in the system.
+
+ @retval Processor Version string token
+**/
+VOID
+GetProcessorVersion (
+ OUT PROCESSOR_VERSION_INFORMATION *Version
+ )
+{
+ CHAR16 BrandIdString[MAXIMUM_CPU_BRAND_STRING_LENGTH + 1];
+ EFI_CPUID_REGISTER CpuExtendedSupport;
+ EFI_CPUID_REGISTER CpuBrandString;
+ UINT8 Index;
+
+ ///
+ /// Create the string using Brand ID String.
+ ///
+ Version->StringValid = FALSE;
+
+ if (IsIntelProcessor ()) {
+ Version->StringRef = STRING_TOKEN (STR_INTEL_GENUINE_PROCESSOR);
+
+ AsmCpuid (
+ CPUID_EXTENDED_FUNCTION,
+ &CpuExtendedSupport.RegEax,
+ &CpuExtendedSupport.RegEbx,
+ &CpuExtendedSupport.RegEcx,
+ &CpuExtendedSupport.RegEdx
+ );
+ AsmCpuid (
+ CPUID_BRAND_STRING1,
+ &CpuBrandString.RegEax,
+ &CpuBrandString.RegEbx,
+ &CpuBrandString.RegEcx,
+ &CpuBrandString.RegEdx
+ );
+ ///
+ /// Check if Brand ID String is supported or filled up
+ ///
+ if (CpuExtendedSupport.RegEax != 0 && CpuBrandString.RegEax != 0) {
+ AsciiToUnicode ((CHAR8 *) &CpuBrandString, (CHAR16 *) &BrandIdString[0]);
+ AsmCpuid (
+ CPUID_BRAND_STRING2,
+ &CpuBrandString.RegEax,
+ &CpuBrandString.RegEbx,
+ &CpuBrandString.RegEcx,
+ &CpuBrandString.RegEdx
+ );
+ AsciiToUnicode ((CHAR8 *) &CpuBrandString, (CHAR16 *) &BrandIdString[16]);
+ AsmCpuid (
+ CPUID_BRAND_STRING3,
+ &CpuBrandString.RegEax,
+ &CpuBrandString.RegEbx,
+ &CpuBrandString.RegEcx,
+ &CpuBrandString.RegEdx
+ );
+ AsciiToUnicode ((CHAR8 *) &CpuBrandString, (CHAR16 *) &BrandIdString[32]);
+
+ ///
+ /// Remove preceeding spaces
+ ///
+ Index = 0;
+ while (BrandIdString[Index] == 0x20) {
+ Index++;
+ if (Index >= MAXIMUM_CPU_BRAND_STRING_LENGTH) {
+ break;
+ }
+ }
+
+ CopyMem (
+ Version->BrandString,
+ &BrandIdString[Index],
+ (MAXIMUM_CPU_BRAND_STRING_LENGTH - Index) * sizeof (CHAR16)
+ );
+ Version->BrandString[MAXIMUM_CPU_BRAND_STRING_LENGTH - Index] = 0;
+ Version->StringValid = TRUE;
+ }
+ } else {
+ Version->StringRef = STRING_TOKEN (STR_UNKNOWN);
+ }
+}
+
+/**
+ Returns the procesor manufaturer string token installed in the system.
+
+ @retval Processor Manufacturer string token
+**/
+EFI_PROCESSOR_MANUFACTURER_DATA
+GetProcessorManufacturer (
+ VOID
+ )
+{
+
+ if (IsIntelProcessor ()) {
+ return STRING_TOKEN (STR_INTEL_CORPORATION);
+ } else {
+ return STRING_TOKEN (STR_UNKNOWN);
+ }
+}
+
+/**
+ Returns if processor is Intel or not.
+
+ @retval TRUE - Intel Processor.
+ @retval FALSE - Not Intel Processor.
+**/
+BOOLEAN
+IsIntelProcessor (
+ VOID
+ )
+{
+ EFI_CPUID_REGISTER Reg;
+
+ AsmCpuid (CPUID_SIGNATURE, &Reg.RegEax, &Reg.RegEbx, &Reg.RegEcx, &Reg.RegEdx);
+
+ if ((Reg.RegEbx != 'uneG') || (Reg.RegEdx != 'Ieni') || (Reg.RegEcx != 'letn')) {
+ return FALSE;
+ } else {
+ return TRUE;
+ }
+}
+
+/**
+ Returns the processor family of the processor installed in the system.
+
+ @retval Processor Family
+**/
+EFI_PROCESSOR_FAMILY_DATA
+GetProcessorFamily (
+ VOID
+ )
+{
+
+ UINTN j;
+ UINTN Index;
+ EFI_CPUID_REGISTER CpuExtendedSupport;
+ EFI_CPUID_REGISTER CpuBrandString;
+ CHAR8 BrandString[MAXIMUM_CPU_BRAND_STRING_LENGTH + 1];
+ UINT16 ProcessorFamily;
+ ProcessorFamily = EfiProcessorFamilyUnknown;
+ Index = 0;
+
+ if (IsIntelProcessor ()) {
+ ///
+ /// Get Brand string
+ ///
+ AsmCpuid (
+ CPUID_EXTENDED_FUNCTION,
+ &CpuExtendedSupport.RegEax,
+ &CpuExtendedSupport.RegEbx,
+ &CpuExtendedSupport.RegEcx,
+ &CpuExtendedSupport.RegEdx
+ );
+ AsmCpuid (
+ CPUID_BRAND_STRING1,
+ &CpuBrandString.RegEax,
+ &CpuBrandString.RegEbx,
+ &CpuBrandString.RegEcx,
+ &CpuBrandString.RegEdx
+ );
+
+ if (CpuExtendedSupport.RegEax != 0 && CpuBrandString.RegEax != 0) {
+ EfiAsciiStrCpy (&BrandString[0], (CHAR8 *) &CpuBrandString);
+ AsmCpuid (
+ CPUID_BRAND_STRING2,
+ &CpuBrandString.RegEax,
+ &CpuBrandString.RegEbx,
+ &CpuBrandString.RegEcx,
+ &CpuBrandString.RegEdx
+ );
+ EfiAsciiStrCpy (&BrandString[16], (CHAR8 *) &CpuBrandString);
+ AsmCpuid (
+ CPUID_BRAND_STRING3,
+ &CpuBrandString.RegEax,
+ &CpuBrandString.RegEbx,
+ &CpuBrandString.RegEcx,
+ &CpuBrandString.RegEdx
+ );
+ EfiAsciiStrCpy (&BrandString[32], (CHAR8 *) &CpuBrandString);
+
+ ///
+ /// Remove preceeding spaces
+ ///
+ while (BrandString[Index] == 0x20) {
+ Index++;
+ }
+
+ BrandString[MAXIMUM_CPU_BRAND_STRING_LENGTH - Index] = 0;
+ }
+
+ ProcessorFamily = 0xC6;
+
+ for (j = 0; j < sizeof (ProcessorFamilyField) / sizeof (PROCESSOR_FAMILY_FIELD); j++) {
+ if (EfiAsciiStrnCmp (
+ &BrandString[Index],
+ ProcessorFamilyField[j].ProcessorFamily,
+ (EfiAsciiStrLen (ProcessorFamilyField[j].ProcessorFamily))
+ ) == 0) {
+ ProcessorFamily = ProcessorFamilyField[j].ProcessorEnum;
+ break;
+ }
+ }
+ } else {
+ ProcessorFamily = EfiProcessorFamilyOther;
+ }
+
+ return ProcessorFamily;
+}
+
+/**
+ Returns the processor voltage of the processor installed in the system.
+
+ @retval Processor Voltage
+**/
+INT16
+GetProcessorVoltage (
+ VOID
+ )
+{
+ INT16 VoltageInmV;
+ UINT64 MsrValue;
+
+ VoltageInmV = 0;
+ MsrValue = 0;
+
+ ///
+ /// Core voltage = (float) IA32_PERF_STS(47:32) * (float) 1/(2^13)
+ ///
+ MsrValue = AsmReadMsr64 (MSR_IA32_PERF_STS);
+ MsrValue = RShiftU64(MsrValue, 32);
+ MsrValue &= 0x0FFFF;
+
+ ///
+ /// Convert unit to mV
+ ///
+ MsrValue = MultU64x32(MsrValue, 1000);
+ MsrValue = RShiftU64 (MsrValue, 13);
+ VoltageInmV = (UINT16) MsrValue;
+
+ return VoltageInmV;
+}
+
+/**
+ Returns the processor microcode revision of the processor installed in the system.
+
+ @retval Processor Microcode Revision
+**/
+UINT32
+GetCpuUcodeRevision (
+ VOID
+ )
+{
+ AsmWriteMsr64 (MSR_IA32_BIOS_SIGN_ID, 0);
+ EfiCpuid (CPUID_VERSION_INFO, NULL);
+ return (UINT32) RShiftU64 (AsmReadMsr64 (MSR_IA32_BIOS_SIGN_ID), 32);
+}
+
+/**
+ Get processor status by specific CPU number
+
+ @param[in] CpuNumber - indicate which CPU status are requested
+
+ @retval EFI_PROCESSOR_STATUS_DATA for specific CPU number
+**/
+EFI_PROCESSOR_STATUS_DATA
+GetProcessorStatus (
+ IN UINTN CpuNumber
+ )
+{
+ EFI_PROCESSOR_STATUS_DATA ProcessorStatus;
+ CPU_DATA_BLOCK *CpuData;
+
+ CpuData = &mMPSystemData->CpuData[CpuNumber];
+
+ ProcessorStatus.Reserved1 = 0;
+ ProcessorStatus.Reserved2 = 0;
+ ProcessorStatus.Reserved3 = 0;
+
+ ProcessorStatus.CpuStatus = EfiCpuStatusEnabled;
+ if (CpuData->State == CPU_STATE_DISABLED) {
+ switch (mMPSystemData->DisableCause[CpuNumber]) {
+ case CPU_CAUSE_USER_SELECTION:
+ case CPU_CAUSE_BY_ASSOCIATION:
+ ProcessorStatus.CpuStatus = EfiCpuStatusDisabledByUser;
+ break;
+
+ case CPU_CAUSE_INTERNAL_ERROR:
+ case CPU_CAUSE_THERMAL_ERROR:
+ case CPU_CAUSE_SELFTEST_FAILURE:
+ case CPU_CAUSE_PREBOOT_TIMEOUT:
+ case CPU_CAUSE_CONFIG_ERROR:
+ ProcessorStatus.CpuStatus = EfiCpuStatusDisabledbyBios;
+ break;
+
+ case CPU_CAUSE_FAILED_TO_START:
+ case CPU_CAUSE_UNSPECIFIED:
+ default:
+ ProcessorStatus.CpuStatus = EfiCpuStatusOther;
+ break;
+ }
+ }
+
+ ProcessorStatus.SocketPopulated = TRUE;
+ ProcessorStatus.ApicEnable = 1;
+
+ if (mMPSystemData->BSP == CpuNumber) {
+ ProcessorStatus.BootApplicationProcessor = 1;
+ } else {
+ ProcessorStatus.BootApplicationProcessor = 0;
+ }
+
+ return ProcessorStatus;
+}
+
+/**
+ This function gets called with the processor number and will log all data to data hub
+ pertaining to this processor.
+
+ @param[in] CpuNumber - Processor Number
+ @param[in] CpuDataForDatahub - Contains CPU data which is collected for data hub
+
+ @retval EFI_OUT_OF_RESOURCES - failed to allocate pool for CPU data
+ @retval EFI_SUCCESS - CPU data Hub has been created successfully
+**/
+EFI_STATUS
+InitializeProcessorData (
+ IN UINTN CpuNumber,
+ IN CPU_DATA_FOR_DATAHUB *CpuDataForDatahub
+ )
+{
+ EFI_STATUS Status;
+ EFI_CPU_DATA_RECORD_BUFFER RecordBuffer;
+ UINT32 HeaderSize;
+ UINT32 TotalSize;
+ PLATFORM_CPU_INFORMATION PlatformCpuInfo;
+ STRING_REF Token;
+ UINT64 MsrValue;
+ UINT64 ProcessorCoreCount;
+ UINT64 ProcessorThreadCount;
+
+ mCpuDataRecordHeader.Instance = (UINT16) (CpuNumber + 1);
+
+ HeaderSize = sizeof (EFI_SUBCLASS_TYPE1_HEADER);
+ RecordBuffer.Raw = AllocatePool (HeaderSize + EFI_CPU_DATA_MAXIMUM_LENGTH);
+ if (RecordBuffer.Raw == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ ZeroMem (&PlatformCpuInfo, sizeof (PLATFORM_CPU_INFORMATION));
+ CopyMem (RecordBuffer.Raw, &mCpuDataRecordHeader, HeaderSize);
+
+ ///
+ /// Record following data by socket base
+ ///
+ if (CpuNumber == 0) {
+ ///
+ /// Record Type 1
+ ///
+ RecordBuffer.DataRecord->DataRecordHeader.RecordType = ProcessorCoreFrequencyRecordType;
+ RecordBuffer.DataRecord->VariableRecord.ProcessorCoreFrequency.Value = (UINT16) CpuDataForDatahub->IntendCoreFrequency;
+ RecordBuffer.DataRecord->VariableRecord.ProcessorCoreFrequency.Exponent = 6;
+ TotalSize = HeaderSize + sizeof (EFI_PROCESSOR_CORE_FREQUENCY_DATA);
+ Status = LogCpuData (mDataHub, RecordBuffer.Raw, TotalSize);
+
+ ///
+ /// Record Type 2
+ ///
+ RecordBuffer.DataRecord->DataRecordHeader.RecordType = ProcessorFsbFrequencyRecordType;
+ RecordBuffer.DataRecord->VariableRecord.ProcessorFsbFrequency.Value = 100;
+ RecordBuffer.DataRecord->VariableRecord.ProcessorFsbFrequency.Exponent = 6;
+ TotalSize = HeaderSize + sizeof (EFI_PROCESSOR_FSB_FREQUENCY_DATA);
+ Status = LogCpuData (mDataHub, RecordBuffer.Raw, TotalSize);
+
+ ///
+ /// Record Type 3
+ ///
+ RecordBuffer.DataRecord->DataRecordHeader.RecordType = ProcessorVersionRecordType;
+ if (CpuDataForDatahub->Version.StringValid) {
+ Token = 0;
+#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
+ Status = IfrLibNewString (mStringHandle, &Token, CpuDataForDatahub->Version.BrandString);
+#else
+ Status = mHii->NewString (mHii, NULL, mStringHandle, &Token, CpuDataForDatahub->Version.BrandString);
+#endif
+ if (EFI_ERROR (Status)) {
+ Token = CpuDataForDatahub->Version.StringRef;
+ }
+ } else {
+ Token = CpuDataForDatahub->Version.StringRef;
+ }
+
+ RecordBuffer.DataRecord->VariableRecord.ProcessorVersion = Token;
+ TotalSize = HeaderSize + sizeof (EFI_PROCESSOR_VERSION_DATA);
+ Status = LogCpuData (mDataHub, RecordBuffer.Raw, TotalSize);
+
+ ///
+ /// Record Type 4
+ ///
+ RecordBuffer.DataRecord->DataRecordHeader.RecordType = ProcessorManufacturerRecordType;
+ RecordBuffer.DataRecord->VariableRecord.ProcessorManufacturer = CpuDataForDatahub->Manufacturer;
+ TotalSize = HeaderSize + sizeof (EFI_PROCESSOR_MANUFACTURER_DATA);
+ Status = LogCpuData (mDataHub, RecordBuffer.Raw, TotalSize);
+
+ ///
+ /// Record Type 6.
+ ///
+ RecordBuffer.DataRecord->DataRecordHeader.RecordType = ProcessorIdRecordType;
+ CopyMem (
+ &RecordBuffer.DataRecord->VariableRecord.ProcessorId,
+ &CpuDataForDatahub->CpuidData,
+ sizeof (CpuDataForDatahub->CpuidData)
+ );
+ TotalSize = HeaderSize + sizeof (EFI_PROCESSOR_ID_DATA);
+ Status = LogCpuData (mDataHub, RecordBuffer.Raw, TotalSize);
+
+ ///
+ /// Record Type 7.
+ ///
+ RecordBuffer.DataRecord->DataRecordHeader.RecordType = ProcessorTypeRecordType;
+ RecordBuffer.DataRecord->VariableRecord.ProcessorType = EfiCentralProcessor;
+ TotalSize = HeaderSize + sizeof (EFI_PROCESSOR_TYPE_DATA);
+ Status = LogCpuData (mDataHub, RecordBuffer.Raw, TotalSize);
+
+ ///
+ /// Record Type 8.
+ ///
+ RecordBuffer.DataRecord->DataRecordHeader.RecordType = ProcessorFamilyRecordType;
+ RecordBuffer.DataRecord->VariableRecord.ProcessorFamily = CpuDataForDatahub->Family;
+ TotalSize = HeaderSize + sizeof (EFI_PROCESSOR_FAMILY_DATA);
+ Status = LogCpuData (mDataHub, RecordBuffer.Raw, TotalSize);
+
+ ///
+ /// Record Type 9.
+ ///
+ RecordBuffer.DataRecord->DataRecordHeader.RecordType = ProcessorVoltageRecordType;
+ RecordBuffer.DataRecord->VariableRecord.ProcessorVoltage.Value = CpuDataForDatahub->Voltage;
+ RecordBuffer.DataRecord->VariableRecord.ProcessorVoltage.Exponent = -3;
+ TotalSize = HeaderSize + sizeof (EFI_PROCESSOR_VOLTAGE_DATA);
+ Status = LogCpuData (mDataHub, RecordBuffer.Raw, TotalSize);
+ }
+ ///
+ /// log data by socket base
+ ///
+ /// Record Type 10.
+ ///
+ RecordBuffer.DataRecord->DataRecordHeader.RecordType = ProcessorApicBaseAddressRecordType;
+ RecordBuffer.DataRecord->VariableRecord.ProcessorApicBase = CpuDataForDatahub->ApicBase;
+ TotalSize = HeaderSize + sizeof (EFI_PROCESSOR_APIC_BASE_ADDRESS_DATA);
+ Status = LogCpuData (mDataHub, RecordBuffer.Raw, TotalSize);
+
+ ///
+ /// Record Type 11.
+ ///
+ RecordBuffer.DataRecord->DataRecordHeader.RecordType = ProcessorApicIdRecordType;
+ RecordBuffer.DataRecord->VariableRecord.ProcessorApicId = CpuDataForDatahub->ApicID;
+ TotalSize = HeaderSize + sizeof (EFI_PROCESSOR_APIC_ID_DATA);
+ Status = LogCpuData (mDataHub, RecordBuffer.Raw, TotalSize);
+
+ ///
+ /// Record Type 12.
+ ///
+ RecordBuffer.DataRecord->DataRecordHeader.RecordType = ProcessorApicVersionNumberRecordType;
+ RecordBuffer.DataRecord->VariableRecord.ProcessorApicVersionNumber = CpuDataForDatahub->ApicVersion;
+ TotalSize = HeaderSize + sizeof (EFI_PROCESSOR_APIC_VERSION_NUMBER_DATA);
+ Status = LogCpuData (mDataHub, RecordBuffer.Raw, TotalSize);
+
+ ///
+ /// Record Type 13.
+ ///
+ RecordBuffer.DataRecord->DataRecordHeader.RecordType = CpuUcodeRevisionDataRecordType;
+ RecordBuffer.DataRecord->VariableRecord.CpuUcodeRevisionData.ProcessorMicrocodeType = EfiProcessorIa32Microcode;
+ RecordBuffer.DataRecord->VariableRecord.CpuUcodeRevisionData.ProcessorMicrocodeRevisionNumber = CpuDataForDatahub->MicrocodeRevision;
+ TotalSize = HeaderSize + sizeof (EFI_PROCESSOR_MICROCODE_REVISION_DATA);
+ Status = LogCpuData (mDataHub, RecordBuffer.Raw, TotalSize);
+
+ ///
+ /// Record following data by socket base
+ ///
+ if (CpuNumber == 0) {
+ ///
+ /// Record Type 14.
+ ///
+ RecordBuffer.DataRecord->DataRecordHeader.RecordType = ProcessorStatusRecordType;
+ RecordBuffer.DataRecord->VariableRecord.ProcessorStatus = CpuDataForDatahub->Status;
+ TotalSize = HeaderSize + sizeof (EFI_PROCESSOR_STATUS_DATA);
+ Status = LogCpuData (mDataHub, RecordBuffer.Raw, TotalSize);
+
+ ///
+ /// Record Type 17(0x11). Set in Cache File
+ ///
+ ///
+ /// Record Type 21(0x15). zero based
+ ///
+ RecordBuffer.DataRecord->DataRecordHeader.RecordType = ProcessorPackageNumberRecordType;
+ RecordBuffer.DataRecord->VariableRecord.ProcessorPackageNumber = CpuDataForDatahub->Location.Package;
+ TotalSize = HeaderSize + sizeof (EFI_PROCESSOR_PACKAGE_NUMBER_DATA);
+ Status = LogCpuData (mDataHub, RecordBuffer.Raw, TotalSize);
+
+ ///
+ /// Record Type 24(0x18).
+ /// Health definition in DataHub spec is not the same as BIST format, so add 1 to convert
+ ///
+ RecordBuffer.DataRecord->DataRecordHeader.RecordType = ProcessorHealthStatusRecordType;
+ RecordBuffer.DataRecord->VariableRecord.ProcessorHealthStatus = CpuDataForDatahub->Health.Uint32 + 1;
+ TotalSize = HeaderSize + sizeof (EFI_PROCESSOR_HEALTH_STATUS);
+ Status = LogCpuData (mDataHub, RecordBuffer.Raw, TotalSize);
+ }
+ ///
+ /// log data by socket base
+ ///
+ /// The following record data comes from platform driver:
+ ///
+ PlatformCpuInfo.StringHandle = mStringHandle;
+ PlatformCpuInfo.ApicID = CpuDataForDatahub->ApicID;
+ Status = mPlatformCpu->CpuConfig->GetCpuInfo (
+ mPlatformCpu,
+ &CpuDataForDatahub->Location,
+ &PlatformCpuInfo
+ );
+
+ ///
+ /// Record following data by socket base
+ ///
+ if (CpuNumber == 0) {
+ ///
+ /// Record Type 5. (Processor Serial Number: this feature is only available on PIII, not support here)
+ ///
+ RecordBuffer.DataRecord->DataRecordHeader.RecordType = ProcessorSerialNumberRecordType;
+ RecordBuffer.DataRecord->VariableRecord.ProcessorAssetTag = PlatformCpuInfo.SerialNumber;
+ TotalSize = HeaderSize + sizeof (EFI_PROCESSOR_SERIAL_NUMBER_DATA);
+ Status = LogCpuData (mDataHub, RecordBuffer.Raw, TotalSize);
+
+ ///
+ /// Record Type 15.
+ ///
+ RecordBuffer.DataRecord->DataRecordHeader.RecordType = ProcessorSocketTypeRecordType;
+ RecordBuffer.DataRecord->VariableRecord.ProcessorSocketType = PlatformCpuInfo.SocketType;
+ TotalSize = HeaderSize + sizeof (EFI_PROCESSOR_SOCKET_TYPE_DATA);
+ Status = LogCpuData (mDataHub, RecordBuffer.Raw, TotalSize);
+
+ ///
+ /// Record Type 16(0x10).
+ ///
+ RecordBuffer.DataRecord->DataRecordHeader.RecordType = ProcessorSocketNameRecordType;
+ RecordBuffer.DataRecord->VariableRecord.ProcessorSocketName = PlatformCpuInfo.SocketName;
+ TotalSize = HeaderSize + sizeof (EFI_PROCESSOR_SOCKET_NAME_DATA);
+ Status = LogCpuData (mDataHub, RecordBuffer.Raw, TotalSize);
+
+ ///
+ /// Record Type 18(0x12).
+ ///
+ RecordBuffer.DataRecord->DataRecordHeader.RecordType = ProcessorMaxCoreFrequencyRecordType;
+ RecordBuffer.DataRecord->VariableRecord.ProcessorMaxCoreFrequency = PlatformCpuInfo.MaxCoreFrequency;
+ TotalSize = HeaderSize + sizeof (EFI_PROCESSOR_MAX_CORE_FREQUENCY_DATA);
+ Status = LogCpuData (mDataHub, RecordBuffer.Raw, TotalSize);
+
+ ///
+ /// Record Type 19(0x13).
+ ///
+ RecordBuffer.DataRecord->DataRecordHeader.RecordType = ProcessorAssetTagRecordType;
+ RecordBuffer.DataRecord->VariableRecord.ProcessorAssetTag = PlatformCpuInfo.AssetTag;
+ TotalSize = HeaderSize + sizeof (EFI_PROCESSOR_ASSET_TAG_DATA);
+ Status = LogCpuData (mDataHub, RecordBuffer.Raw, TotalSize);
+ }
+ ///
+ /// log data by socket base
+ ///
+ /// Record Type 20(0x14).
+ ///
+ RecordBuffer.DataRecord->DataRecordHeader.RecordType = ProcessorMaxFsbFrequencyRecordType;
+ RecordBuffer.DataRecord->VariableRecord.ProcessorMaxFsbFrequency = PlatformCpuInfo.MaxFsbFrequency;
+ TotalSize = HeaderSize + sizeof (EFI_PROCESSOR_MAX_FSB_FREQUENCY_DATA);
+ Status = LogCpuData (mDataHub, RecordBuffer.Raw, TotalSize);
+
+ ///
+ /// Record Type 22(0x16).
+ ///
+ RecordBuffer.DataRecord->DataRecordHeader.RecordType = ProcessorCoreFrequencyListRecordType;
+ RecordBuffer.DataRecord->VariableRecord.ProcessorCoreFrequencyList = PlatformCpuInfo.PlatformCoreFrequencyList;
+ TotalSize = HeaderSize + sizeof (EFI_PROCESSOR_CORE_FREQUENCY_LIST_DATA);
+ Status = LogCpuData (mDataHub, RecordBuffer.Raw, TotalSize);
+
+ ///
+ /// Record Type 23(0x17).
+ ///
+ RecordBuffer.DataRecord->DataRecordHeader.RecordType = ProcessorFsbFrequencyListRecordType;
+ RecordBuffer.DataRecord->VariableRecord.ProcessorFsbFrequencyList = PlatformCpuInfo.PlatformFsbFrequencyList;
+ TotalSize = HeaderSize + sizeof (EFI_PROCESSOR_FSB_FREQUENCY_LIST_DATA);
+ Status = LogCpuData (mDataHub, RecordBuffer.Raw, TotalSize);
+
+ ///
+ /// Record following data by socket base
+ ///
+ if (CpuNumber == 0) {
+ ///
+ /// Record Type 30. (Processor Part Number)
+ ///
+ RecordBuffer.DataRecord->DataRecordHeader.RecordType = ProcessorPartNumberRecordType;
+ RecordBuffer.DataRecord->VariableRecord.ProcessorAssetTag = PlatformCpuInfo.PartNumber;
+ TotalSize = HeaderSize + sizeof (EFI_PROCESSOR_PART_NUMBER_DATA);
+ Status = LogCpuData (mDataHub, RecordBuffer.Raw, TotalSize);
+
+ ///
+ /// Record Type 28.
+ ///
+ RecordBuffer.DataRecord->DataRecordHeader.RecordType = ProcessorCharacteristicsRecordType;
+ RecordBuffer.DataRecord->VariableRecord.ProcessorCharacteristics.Reserved2 = 0;
+ RecordBuffer.DataRecord->VariableRecord.ProcessorCharacteristics.Reserved = 0;
+ RecordBuffer.DataRecord->VariableRecord.ProcessorCharacteristics.Unknown = 0;
+ RecordBuffer.DataRecord->VariableRecord.ProcessorCharacteristics.Capable64Bit = 1;
+ TotalSize = HeaderSize + sizeof (EFI_PROCESSOR_CHARACTERISTICS_DATA);
+ Status = LogCpuData (mDataHub, RecordBuffer.Raw, TotalSize);
+
+ MsrValue = AsmReadMsr64 (MSR_CORE_THREAD_COUNT);
+ ProcessorThreadCount = MsrValue & 0xffff;
+ ProcessorCoreCount = (MsrValue >> 16) & 0xffff;
+
+ ///
+ /// Record Type 25.
+ ///
+ RecordBuffer.DataRecord->DataRecordHeader.RecordType = ProcessorCoreCountRecordType;
+ RecordBuffer.DataRecord->VariableRecord.ProcessorCoreCount = (UINT8) (ProcessorCoreCount);
+ TotalSize = HeaderSize + sizeof (EFI_PROCESSOR_CORE_COUNT_DATA);
+ Status = LogCpuData (mDataHub, RecordBuffer.Raw, TotalSize);
+
+ ///
+ /// Record Type 26.
+ ///
+ RecordBuffer.DataRecord->DataRecordHeader.RecordType = ProcessorEnabledCoreCountRecordType;
+ RecordBuffer.DataRecord->VariableRecord.ProcessorEnabledCoreCount = (UINT8) (ProcessorCoreCount);
+ TotalSize = HeaderSize + sizeof (EFI_PROCESSOR_ENABLED_CORE_COUNT_DATA);
+ Status = LogCpuData (mDataHub, RecordBuffer.Raw, TotalSize);
+
+ ///
+ /// Record Type 27.
+ ///
+ RecordBuffer.DataRecord->DataRecordHeader.RecordType = ProcessorThreadCountRecordType;
+ RecordBuffer.DataRecord->VariableRecord.ProcessorThreadCount = (UINT8) (ProcessorThreadCount);
+ TotalSize = HeaderSize + sizeof (EFI_PROCESSOR_THREAD_COUNT_DATA);
+ Status = LogCpuData (mDataHub, RecordBuffer.Raw, TotalSize);
+ }
+ ///
+ /// log data by socket base
+ ///
+ FreePool (RecordBuffer.Raw);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Log CPU data into data hub
+
+ @param[in] DataHub - point to data hub that will be updated
+ @param[in] Buffer - the buffer which will be updated into data hub
+ @param[in] Size - size of the buffer
+
+ @retval EFI_STATUS - status returned when updating Data hub
+**/
+EFI_STATUS
+LogCpuData (
+ EFI_DATA_HUB_PROTOCOL *DataHub,
+ UINT8 *Buffer,
+ UINT32 Size
+ )
+{
+ EFI_STATUS Status;
+
+ Status = DataHub->LogData (
+ DataHub,
+ &gEfiProcessorSubClassGuid,
+ &gEfiProcessorProducerGuid,
+ EFI_DATA_RECORD_CLASS_DATA,
+ Buffer,
+ Size
+ );
+ return Status;
+
+}
diff --git a/ReferenceCode/Haswell/CpuInit/Dxe/ProcessorData.h b/ReferenceCode/Haswell/CpuInit/Dxe/ProcessorData.h
new file mode 100644
index 0000000..fea963e
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Dxe/ProcessorData.h
@@ -0,0 +1,136 @@
+/** @file
+ Header file for CPU Data File
+
+Revision History
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PROCESSOR_DATA_H_
+#define _PROCESSOR_DATA_H_
+
+#include "CpuInitDxe.h"
+
+#define EFI_PROCESSOR_TYPE_SIZE 6
+
+typedef struct {
+ UINT8 Index;
+ UINT8 ProcessorFamily;
+ STRING_REF ProcessorVersionToken;
+} EFI_PROCESSOR_VERSION;
+
+typedef struct {
+ UINT32 Dword1;
+ UINT32 Dword2;
+ UINT32 Dword3;
+ UINT32 Dword4;
+} EFI_QDWORD;
+
+///
+/// Platform-specific definitions
+///
+#define EFI_CPU_DATA_MAXIMUM_LENGTH 0x100
+
+/**
+ This function gets called with the processor number and will log all data to data hub
+ pertaining to this processor.
+
+ @param[in] CpuNumber - Processor Number
+ @param[in] CpuDataForDatahub - Contains CPU data which is collected for data hub
+
+ @retval EFI_OUT_OF_RESOURCES - failed to allocate pool for CPU data
+ @retval EFI_SUCCESS - CPU data Hub has been created successfully
+**/
+EFI_STATUS
+InitializeProcessorData (
+ IN UINTN CpuNumber,
+ IN CPU_DATA_FOR_DATAHUB *CpuDataForDatahub
+ );
+
+/**
+ Returns the processor voltage of the processor installed in the system.
+
+ @retval Processor Voltage
+**/
+INT16
+GetProcessorVoltage (
+ VOID
+ );
+
+/**
+ Returns the processor microcode revision of the processor installed in the system.
+
+ @retval Processor Microcode Revision
+**/
+UINT32
+GetCpuUcodeRevision (
+ VOID
+ );
+
+/**
+ Get processor status by specific CPU number
+
+ @param[in] CpuNumber - indicate which CPU status are requested
+
+ @retval EFI_PROCESSOR_STATUS_DATA for specific CPU number
+**/
+EFI_PROCESSOR_STATUS_DATA
+GetProcessorStatus (
+ UINTN CpuNumber
+ );
+
+/**
+ Returns the procesor version string token installed in the system.
+
+ @retval Processor Version string token
+**/
+VOID
+GetProcessorVersion (
+ OUT PROCESSOR_VERSION_INFORMATION *Version
+ );
+
+/**
+ Returns the processor family of the processor installed in the system.
+
+ @retval Processor Family
+**/
+EFI_PROCESSOR_FAMILY_DATA
+GetProcessorFamily (
+ VOID
+ );
+
+/**
+ Returns the procesor manufaturer string token installed in the system.
+
+ @retval Processor Manufacturer string token
+**/
+EFI_PROCESSOR_MANUFACTURER_DATA
+GetProcessorManufacturer (
+ VOID
+ );
+
+/**
+ Returns if processor is Intel or not.
+
+ @retval TRUE - Intel Processor.
+ @retval FALSE - Not Intel Processor.
+**/
+BOOLEAN
+IsIntelProcessor (
+ VOID
+ );
+
+#endif
diff --git a/ReferenceCode/Haswell/CpuInit/Dxe/x64/Cpu.asm b/ReferenceCode/Haswell/CpuInit/Dxe/x64/Cpu.asm
new file mode 100644
index 0000000..9b28b54
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Dxe/x64/Cpu.asm
@@ -0,0 +1,626 @@
+;
+; This file contains an 'Intel Peripheral Driver' and is
+; licensed for Intel CPUs and chipsets under the terms of your
+; license agreement with Intel or your vendor. This file may
+; be modified by the user, subject to additional terms of the
+; license agreement
+;
+ TITLE Cpu.asm: Assembly code for the IA-32 resources
+
+;-------------------------------------------------------------------------------
+;
+; Copyright (c) 2005 -2012 Intel Corporation. All rights reserved
+; This software and associated documentation (if any) is furnished
+; under a license and may only be used or copied in accordance
+; with the terms of the license. Except as permitted by such
+; license, no part of this software or documentation may be
+; reproduced, stored in a retrieval system, or transmitted in any
+; form or by any means without the express written consent of
+; Intel Corporation.
+;
+;
+; Module Name:
+;
+; Cpu.asm
+;
+; Abstract:
+;
+;
+;-------------------------------------------------------------------------------
+
+text SEGMENT
+
+EXTRN mErrorCodeFlag:DWORD ; Error code flags for exceptions
+
+ExternalVectorTablePtr QWORD 0 ; point to the external interrupt vector table
+
+;
+; Float control word initial value:
+; all exceptions masked, double-extended-precision, round-to-nearest
+;
+mFpuControlWord DW 037Fh
+;
+; Multimedia-extensions control word:
+; all exceptions masked, round-to-nearest, flush to zero for masked underflow
+;
+mMmxControlWord DD 01F80h
+
+
+InitializeExternalVectorTablePtr PROC PUBLIC
+ mov ExternalVectorTablePtr, rcx
+ ret
+InitializeExternalVectorTablePtr ENDP
+;
+;
+;
+;------------------------------------------------------------------------------
+; Generic IDT Vector Handlers for the Host. They are all the same so they
+; will compress really well.
+;
+; By knowing the return address for Vector 00 you can can calculate the
+; vector number by looking at the call CommonInterruptEntry return address.
+; (return address - (AsmIdtVector00 + 5))/8 == IDT index
+;
+;------------------------------------------------------------------------------
+
+ALIGN 8
+
+PUBLIC AsmIdtVector00
+
+AsmIdtVector00 LABEL BYTE
+REPEAT 256
+ call CommonInterruptEntry
+ dw ( $ - AsmIdtVector00 - 5 ) / 8 ; vector number
+ nop
+ENDM
+
+
+;---------------------------------------;
+; CommonInterruptEntry ;
+;---------------------------------------;
+; The follow algorithm is used for the common interrupt routine.
+
+;
+; +---------------------+ <-- 16-byte aligned ensured by processor
+; + Old SS +
+; +---------------------+
+; + Old RSP +
+; +---------------------+
+; + RFlags +
+; +---------------------+
+; + CS +
+; +---------------------+
+; + RIP +
+; +---------------------+
+; + Error Code +
+; +---------------------+
+; + RCX / Vector Number +
+; +---------------------+
+; + RBP +
+; +---------------------+ <-- RBP, 16-byte aligned
+;
+
+CommonInterruptEntry PROC PUBLIC
+ cli
+ cld
+ ;
+ ; All interrupt handlers are invoked through interrupt gates, so
+ ; IF flag automatically cleared at the entry point
+ ;
+ ;
+ ; Calculate vector number
+ ;
+ xchg rcx, [rsp] ; get the return address of call, actually, it is the address of vector number.
+ movzx ecx, word ptr [rcx]
+ cmp ecx, 32 ; Intel reserved vector for exceptions?
+ jae NoErrorCode
+ bt mErrorCodeFlag, ecx
+ jc @F
+
+NoErrorCode:
+ ;
+ ; Push a dummy error code on the stack
+ ; to maintain coherent stack map
+ ;
+ push [rsp]
+ mov qword ptr [rsp + 8], 0
+@@:
+ push rbp
+ mov rbp, rsp
+
+ ;
+ ; Since here the stack pointer is 16-byte aligned, so
+ ; EFI_FX_SAVE_STATE_X64 of EFI_SYSTEM_CONTEXT_x64
+ ; is 16-byte aligned
+ ;
+
+;; UINT64 Rdi, Rsi, Rbp, Rsp, Rbx, Rdx, Rcx, Rax;
+;; UINT64 R8, R9, R10, R11, R12, R13, R14, R15;
+ push r15
+ push r14
+ push r13
+ push r12
+ push r11
+ push r10
+ push r9
+ push r8
+ push rax
+ push qword ptr [rbp + 8] ; RCX
+ push rdx
+ push rbx
+ push qword ptr [rbp + 48] ; RSP
+ push qword ptr [rbp] ; RBP
+ push rsi
+ push rdi
+
+;; UINT64 Gs, Fs, Es, Ds, Cs, Ss; insure high 16 bits of each is zero
+ movzx rax, word ptr [rbp + 56]
+ push rax ; for ss
+ movzx rax, word ptr [rbp + 32]
+ push rax ; for cs
+ mov rax, ds
+ push rax
+ mov rax, es
+ push rax
+ mov rax, fs
+ push rax
+ mov rax, gs
+ push rax
+
+ mov [rbp + 8], rcx ; save vector number
+
+;; UINT64 Rip;
+ push qword ptr [rbp + 24]
+
+;; UINT64 Gdtr[2], Idtr[2];
+ sub rsp, 16
+ sidt fword ptr [rsp]
+ sub rsp, 16
+ sgdt fword ptr [rsp]
+
+;; UINT64 Ldtr, Tr;
+ xor rax, rax
+ str ax
+ push rax
+ sldt ax
+ push rax
+
+;; UINT64 RFlags;
+ push qword ptr [rbp + 40]
+
+;; UINT64 Cr0, Cr1, Cr2, Cr3, Cr4, Cr8;
+ mov rax, cr8
+ push rax
+ mov rax, cr4
+ or rax, 208h
+ mov cr4, rax
+ push rax
+ mov rax, cr3
+ push rax
+ mov rax, cr2
+ push rax
+ xor rax, rax
+ push rax
+ mov rax, cr0
+ push rax
+
+;; UINT64 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;
+ mov rax, dr7
+ push rax
+;; clear Dr7 while executing debugger itself
+ xor rax, rax
+ mov dr7, rax
+
+ mov rax, dr6
+ push rax
+;; insure all status bits in dr6 are clear...
+ xor rax, rax
+ mov dr6, rax
+
+ mov rax, dr3
+ push rax
+ mov rax, dr2
+ push rax
+ mov rax, dr1
+ push rax
+ mov rax, dr0
+ push rax
+
+;; FX_SAVE_STATE_X64 FxSaveState;
+
+ sub rsp, 512
+ mov rdi, rsp
+ db 0fh, 0aeh, 00000111y ;fxsave [rdi]
+
+;; UINT32 ExceptionData;
+ push qword ptr [rbp + 16]
+
+;; call into exception handler
+ mov rcx, [rbp + 8]
+ mov rax, ExternalVectorTablePtr ; get the interrupt vectors base
+ mov rax, [rax + rcx * 8]
+ or rax, rax ; NULL?
+
+ je nonNullValue;
+
+;; Prepare parameter and call
+; mov rcx, [rbp + 8]
+ mov rdx, rsp
+ ;
+ ; Per X64 calling convention, allocate maximum parameter stack space
+ ; and make sure RSP is 16-byte aligned
+ ;
+ sub rsp, 4 * 8 + 8
+ call rax
+ add rsp, 4 * 8 + 8
+
+nonNullValue:
+ cli
+;; UINT64 ExceptionData;
+ add rsp, 8
+
+;; FX_SAVE_STATE_X64 FxSaveState;
+
+ mov rsi, rsp
+ db 0fh, 0aeh, 00001110y ; fxrstor [rsi]
+ add rsp, 512
+
+;; UINT64 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;
+ pop rax
+ mov dr0, rax
+ pop rax
+ mov dr1, rax
+ pop rax
+ mov dr2, rax
+ pop rax
+ mov dr3, rax
+;; skip restore of dr6. We cleared dr6 during the context save.
+ add rsp, 8
+ pop rax
+ mov dr7, rax
+
+;; UINT64 Cr0, Cr1, Cr2, Cr3, Cr4, Cr8;
+ pop rax
+ mov cr0, rax
+ add rsp, 8 ; not for Cr1
+ pop rax
+ mov cr2, rax
+ pop rax
+ mov cr3, rax
+ pop rax
+ mov cr4, rax
+ pop rax
+ mov cr8, rax
+
+;; UINT64 RFlags;
+ pop qword ptr [rbp + 40]
+
+;; UINT64 Ldtr, Tr;
+;; UINT64 Gdtr[2], Idtr[2];
+;; Best not let anyone mess with these particular registers...
+ add rsp, 48
+
+;; UINT64 Rip;
+ pop qword ptr [rbp + 24]
+
+;; UINT64 Gs, Fs, Es, Ds, Cs, Ss;
+ pop rax
+ ; mov gs, rax ; not for gs
+ pop rax
+ ; mov fs, rax ; not for fs
+ ; (X64 will not use fs and gs, so we do not restore it)
+ pop rax
+ mov es, rax
+ pop rax
+ mov ds, rax
+ pop qword ptr [rbp + 32] ; for cs
+ pop qword ptr [rbp + 56] ; for ss
+
+;; UINT64 Rdi, Rsi, Rbp, Rsp, Rbx, Rdx, Rcx, Rax;
+;; UINT64 R8, R9, R10, R11, R12, R13, R14, R15;
+ pop rdi
+ pop rsi
+ add rsp, 8 ; not for rbp
+ pop qword ptr [rbp + 48] ; for rsp
+ pop rbx
+ pop rdx
+ pop rcx
+ pop rax
+ pop r8
+ pop r9
+ pop r10
+ pop r11
+ pop r12
+ pop r13
+ pop r14
+ pop r15
+
+ mov rsp, rbp
+ pop rbp
+ add rsp, 16
+ iretq
+
+CommonInterruptEntry ENDP
+
+
+LongMode PROC PUBLIC
+
+in_long_mode::
+ ;
+ ; Debug Stop
+ ;
+ jmp in_long_mode
+
+ ;
+ ; We're in long mode, so marshall the arguments to call the
+ ; passed in function pointers
+ ; Recall
+ ; [ebp][10h] = HobStart
+ ; [ebp][18h] = Stack
+ ; [ebp][20h] = PpisNeededByDxeIplEntryPoint <--- Call this first (for each call, pass HOB pointer)
+ ; [ebp][28h] = DxeCoreEntryPoint <--- Call this second
+ ;
+ mov rbx, [rbp+18h] ; Setup the stack
+ mov rsp, rbx ; On a new stack now
+
+ mov rcx, [rbp+10h] ; Pass Hob Start in RCX
+ mov rax, [rbp+20h] ; Get the function pointer for
+ ; PpisNeededByDxeIplEntryPoint into EAX
+ call fword ptr [rax] ; Make the call into PpisNeededByDxeIplEntryPoint
+
+ mov ecx, [rbp+10h] ; Pass Hob Start in RCX
+ mov eax, [rbp+28h] ; Get the function pointer for
+ ; DxeCoreEntryPoint into EAX
+ call fword ptr [rax] ; Make the call into Dxe Core
+
+ call CommonInterruptEntry
+
+ mov rdi, CommonInterruptEntry
+
+ lgdt fword ptr [rdi]
+
+ lidt fword ptr [rdi]
+
+ call near ptr [rax] ; Make the call into PpisNeededByDxeIplEntryPoint
+
+ call rax
+
+ ;
+ ; Should never get here.
+ ;
+no_long_mode:
+ jmp no_long_mode
+ ;
+ ; WE SHOULD NEVER GET HERE!!!!!!!!!!!!!
+ ;
+LongMode endp
+
+EnableMce proc public
+
+ mov rax, cr4
+ or rax, 40h
+ mov cr4, rax
+
+ ret
+
+EnableMce endp
+
+MpMtrrSynchUpEntry PROC PUBLIC
+ ;
+ ; Enter no fill cache mode, CD=1(Bit30), NW=0 (Bit29)
+ ;
+ mov rax, cr0
+ and rax, 0DFFFFFFFh
+ or rax, 040000000h
+ mov cr0, rax
+ ;
+ ; Flush cache
+ ;
+ wbinvd
+ ;
+ ; Clear PGE flag Bit 7
+ ;
+ mov rax, cr4
+ mov rdx, rax
+ and rax, 0FFFFFF7Fh
+ mov cr4, rax
+ ;
+ ; Flush all TLBs
+ ;
+ mov rax, cr3
+ mov cr3, rax
+
+ mov rax, rdx
+
+ ret
+
+MpMtrrSynchUpEntry ENDP
+
+MpMtrrSynchUpExit PROC PUBLIC
+ ;
+ ; Flush all TLBs the second time
+ ;
+ mov rax, cr3
+ mov cr3, rax
+ ;
+ ; Enable Normal Mode caching CD=NW=0, CD(Bit30), NW(Bit29)
+ ;
+ mov rax, cr0
+ and rax, 09FFFFFFFh
+ mov cr0, rax
+ ;
+ ; Set PGE Flag in CR4 if set
+ ;
+ mov cr4, rcx
+ ret
+
+MpMtrrSynchUpExit ENDP
+
+;
+; Initializes floating point units for requirement of UEFI specification.
+;
+; This function initializes floating-point control word to 0x037F (all exceptions
+; masked,double-extended-precision, round-to-nearest) and multimedia-extensions control word
+; (if supported) to 0x1F80 (all exceptions masked, round-to-nearest, flush to zero
+; for masked underflow).
+;
+CpuInitFloatPointUnit PROC PUBLIC
+ ;
+ ; Initialize floating point units
+ ;
+ ; The following opcodes stand for instruction 'finit'
+ ; to be supported by some 64-bit assemblers
+ ;
+ DB 9Bh, 0DBh, 0E3h
+ fldcw mFpuControlWord
+
+ ;
+ ; Set OSFXSR bit 9 in CR4
+ ;
+ mov rax, cr4
+ or rax, 200h
+ mov cr4, rax
+
+ ldmxcsr mMmxControlWord
+ ret
+CpuInitFloatPointUnit ENDP
+
+CpuDisableInterrupt PROC PUBLIC
+
+ cli
+ ret
+
+CpuDisableInterrupt ENDP
+
+CpuEnableInterrupt PROC PUBLIC
+
+ sti
+ ret
+
+CpuEnableInterrupt ENDP
+
+MAX_NR_BUS EQU 0FFh
+CSR_DESIRED_CORES EQU 080h ; CSR D0:F0:R80
+
+GetCsrDesiredCores PROC PUBLIC
+
+ push rbx
+
+ ;
+ ; get Bus number from CPUID[1] EBX[31:24]
+ ;
+ mov eax, 1 ; bus 0
+ cpuid
+ bswap ebx
+ shr bl, 4
+ movzx eax, bl
+ ;
+ ; Compute CPU Bus Num
+ ; Bus Num = (MAX_NB_BUS - socket ID)
+ ;
+ xor eax, MAX_NR_BUS ; bus number = MAX_NR_BUS - socket ID
+ ;
+ ; eax = bus number
+ ; out 0CF8h, GQ1_CR_PCIEXBAR OR (Bus Num shl 16)
+ ;
+ or eax, 8000h
+ shl eax, 16
+ or eax, CSR_DESIRED_CORES ; D0:F1:R80h
+ mov dx, 0CF8h
+ out dx, eax
+ mov dx, 0CFCh
+ in eax, dx
+
+ pop rbx
+
+ ret
+
+GetCsrDesiredCores ENDP
+
+SetLockCsrDesiredCores PROC PUBLIC
+
+ push rbx
+
+ ;
+ ; get Bus number from CPUID[1] EBX[31:24]
+ ;
+ mov eax, 1 ; bus 0
+ cpuid
+ bswap ebx
+ shr bl, 4
+ movzx eax, bl
+ ;
+ ; Compute CPU Bus Num
+ ; Bus Num = (MAX_NB_BUS - socket ID)
+ ;
+ xor eax, MAX_NR_BUS ; bus number = MAX_NR_BUS - socket ID
+ ;
+ ; eax = bus number
+ ; out 0CF8h, GQ1_CR_PCIEXBAR OR (Bus Num shl 16)
+ ;
+ or eax, 8000h
+ shl eax, 16
+ or eax, CSR_DESIRED_CORES ; D0:F1:R80h
+ mov dx, 0CF8h
+ out dx, eax
+ mov dx, 0CFCh
+ in eax, dx
+ or eax, 10000h ; Bit[16] = Lock
+ out dx, eax
+
+ pop rbx
+ ret
+
+SetLockCsrDesiredCores ENDP
+
+;------------------------------------------------------------------------------
+; UINTN
+; CpuFlushTlb (
+; VOID
+; )
+;------------------------------------------------------------------------------
+CpuFlushTlb PROC PUBLIC
+ mov rax, cr3
+ mov cr3, rax
+ ret
+CpuFlushTlb ENDP
+
+;------------------------------------------------------------------------------
+; UINT16
+; CpuCodeSegment (
+; VOID
+; );
+;------------------------------------------------------------------------------
+CpuCodeSegment PROC PUBLIC
+ xor eax, eax
+ mov eax, cs
+ ret
+CpuCodeSegment ENDP
+
+;------------------------------------------------------------------------------
+; VOID
+; CpuLoadGlobalDescriptorTable (
+; VOID *Table16ByteAligned
+; );
+;------------------------------------------------------------------------------
+CpuLoadGlobalDescriptorTable PROC PUBLIC
+ lgdt FWORD PTR [rcx]
+ ret
+CpuLoadGlobalDescriptorTable ENDP
+
+;------------------------------------------------------------------------------
+; VOID
+; CpuLoadInterruptDescriptorTable (
+; VOID *Table16ByteAligned
+; );
+;------------------------------------------------------------------------------
+CpuLoadInterruptDescriptorTable PROC PUBLIC
+ lidt FWORD PTR [rcx]
+ ret
+CpuLoadInterruptDescriptorTable ENDP
+
+
+text ENDS
+END
+
+
diff --git a/ReferenceCode/Haswell/CpuInit/Dxe/x64/CpuLib.h b/ReferenceCode/Haswell/CpuInit/Dxe/x64/CpuLib.h
new file mode 100644
index 0000000..14699c1
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Dxe/x64/CpuLib.h
@@ -0,0 +1,168 @@
+/** @file
+ Library functions that can be called in both PEI and DXE phase
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _CPU_LIB_H_
+#define _CPU_LIB_H_
+
+#if 0
+UINTN
+CpuReadCr0 (
+ VOID
+ )
+/**
+@brief
+ Get CR0 value
+
+ @param[in] None
+
+ @retval CR0 value
+**/
+;
+
+VOID
+CpuWriteCr0 (
+ UINTN Value
+ )
+/**
+@brief
+ Write CR0 register
+
+ @param[in] Value - Value that will be written into CR0 register
+**/
+;
+
+UINTN
+CpuReadCr3 (
+ VOID
+ )
+/**
+@brief
+ Get CR3 register value
+
+ @param[in] None
+
+ @retval CR3 register value
+**/
+;
+
+VOID
+CpuWriteCr3 (
+ UINTN Value
+ )
+/**
+@brief
+ Write CR3 register
+
+ @param[in] Value - Value that will be written to CR3 register
+**/
+;
+
+UINTN
+CpuSetPower2 (
+ IN UINTN Input
+ )
+/**
+@brief
+ Calculate the power 2 value from the Input value
+
+ @param[in] Input - The number that will be calculated
+
+ @retval Power 2 value after calculated
+**/
+;
+
+UINT64
+CpuReadTsc (
+ VOID
+ )
+/**
+@brief
+ Read CPU TSC value
+
+ @param[in] None
+
+ @retval TSC value
+**/
+;
+
+VOID
+CpuBreak (
+ VOID
+ )
+/**
+@brief
+ Break by INT3
+
+ @param[in] None
+**/
+;
+
+VOID
+CpuInitSelectors (
+ VOID
+ )
+/**
+@brief
+ Initialize selectors by calling INT 68
+
+ @param[in] None
+**/
+;
+
+#endif
+
+UINT16
+CpuCodeSegment (
+ VOID
+ )
+/**
+@brief
+ Return code segment address - CS
+
+ @param[in] None
+
+ @retval Code segment address
+**/
+;
+
+VOID
+CpuLoadGlobalDescriptorTable (
+ VOID *Table16ByteAligned
+ )
+/**
+@brief
+ Get current GDT descriptor
+
+ @param[in] Table16ByteAligned - the table buffer that will store current GDT table descriptor
+**/
+;
+
+VOID
+CpuLoadInterruptDescriptorTable (
+ VOID *Table16ByteAligned
+ )
+/**
+@brief
+ Get current IDT descriptor
+
+ @param[in] Table16ByteAligned - the table buffer that will store current GDT table descriptor
+**/
+;
+
+#endif
diff --git a/ReferenceCode/Haswell/CpuInit/Dxe/x64/Exception.c b/ReferenceCode/Haswell/CpuInit/Dxe/x64/Exception.c
new file mode 100644
index 0000000..bcd306b
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Dxe/x64/Exception.c
@@ -0,0 +1,372 @@
+/** @file
+ EM64T Exception Handler
+
+@copyright
+ Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "CpuInitDxe.h"
+#include "MpCommon.h"
+#include "Exception.h"
+#endif
+
+typedef
+VOID
+(*EFI_INSTALL_EXCEPTION)(
+ IN UINT32 InterruptType,
+ IN VOID *SystemContext
+ );
+
+typedef struct {
+ UINT32 ErrorMessage;
+ UINT8 Interrupt;
+} EFI_EXCEPTION_HANDLER;
+
+///
+/// Error code flag indicating whether or not an error code will be
+/// pushed on the stack if an exception occurs.
+///
+/// 1 means an error code will be pushed, otherwise 0
+///
+/// bit 0 - exception 0
+/// bit 1 - exception 1
+/// etc.
+///
+UINT32 mErrorCodeFlag = 0x00027d00;
+
+///
+/// Local Table
+///
+EFI_EXCEPTION_HANDLER mExceptionTable[] = {
+ {
+ EFI_SW_EC_IA32_DIVIDE_ERROR,
+ INTERRUPT_HANDLER_DIVIDE_ZERO
+ },
+ {
+ EFI_SW_EC_IA32_DEBUG,
+ INTERRUPT_HANDLER_DEBUG
+ },
+ {
+ EFI_SW_EC_IA32_NMI,
+ INTERRUPT_HANDLER_NMI
+ },
+ {
+ EFI_SW_EC_IA32_BREAKPOINT,
+ INTERRUPT_HANDLER_BREAKPOINT
+ },
+ {
+ EFI_SW_EC_IA32_OVERFLOW,
+ INTERRUPT_HANDLER_OVERFLOW
+ },
+ {
+ EFI_SW_EC_IA32_BOUND,
+ INTERRUPT_HANDLER_BOUND
+ },
+ {
+ EFI_SW_EC_IA32_INVALID_OPCODE,
+ INTERRUPT_HANDLER_INVALID_OPCODE
+ },
+ ///
+ /// Interrupt 7, 9, 15 not defined in the debug support protocol. Hence no status codes for them!
+ ///
+ {
+ EFI_SW_EC_IA32_DOUBLE_FAULT,
+ INTERRUPT_HANDLER_DOUBLE_FAULT
+ },
+ {
+ EFI_SW_EC_IA32_INVALID_TSS,
+ INTERRUPT_HANDLER_INVALID_TSS
+ },
+ {
+ EFI_SW_EC_IA32_SEG_NOT_PRESENT,
+ INTERRUPT_HANDLER_SEGMENT_NOT_PRESENT
+ },
+ {
+ EFI_SW_EC_IA32_STACK_FAULT,
+ INTERRUPT_HANDLER_STACK_SEGMENT_FAULT
+ },
+ {
+ EFI_SW_EC_IA32_GP_FAULT,
+ INTERRUPT_HANDLER_GP_FAULT
+ },
+ {
+ EFI_SW_EC_IA32_PAGE_FAULT,
+ INTERRUPT_HANDLER_PAGE_FAULT
+ },
+ {
+ EFI_SW_EC_IA32_FP_ERROR,
+ INTERRUPT_HANDLER_MATH_FAULT
+ },
+ {
+ EFI_SW_EC_IA32_ALIGNMENT_CHECK,
+ INTERRUPT_HANDLER_ALIGNMENT_FAULT
+ },
+ {
+ EFI_SW_EC_IA32_MACHINE_CHECK,
+ INTERRUPT_HANDLER_MACHINE_CHECK
+ },
+ {
+ EFI_SW_EC_IA32_SIMD,
+ INTERRUPT_HANDLER_STREAMING_SIMD
+ }
+};
+
+UINTN mExceptionNumber = sizeof (mExceptionTable) / sizeof (EFI_EXCEPTION_HANDLER);
+
+CPU_STATUS_CODE_TEMPLATE mStatusCodeData = {
+ {
+ sizeof (EFI_STATUS_CODE_DATA),
+ sizeof (EFI_SYSTEM_CONTEXT_X64),
+ EFI_STATUS_CODE_DATA_TYPE_EXCEPTION_HANDLER_GUID
+ },
+ {
+ 0
+ }
+};
+
+UINT8 mExceptionLock = 0;
+
+/**
+ Report StatusCode for Exception
+
+ @param[in] InterruptType - Interrupt type
+ @param[in] SystemContext - EFI_SYSTEM_CONTEXT
+
+ @retval EFI_SUCCESS
+**/
+EFI_STATUS
+ReportData (
+ IN EFI_EXCEPTION_TYPE InterruptType,
+ IN EFI_SYSTEM_CONTEXT SystemContext
+ )
+{
+ UINT32 ErrorMessage;
+ UINT32 Index;
+
+ CopyMem (
+ &mStatusCodeData.SystemContext.SystemContextX64,
+ SystemContext.SystemContextX64,
+ sizeof (EFI_SYSTEM_CONTEXT_X64)
+ );
+
+ ErrorMessage = EFI_SOFTWARE_DXE_BS_DRIVER;
+ for (Index = 0; Index < mExceptionNumber; Index++) {
+ if (mExceptionTable[Index].Interrupt == InterruptType) {
+ ErrorMessage |= mExceptionTable[Index].ErrorMessage;
+ break;
+ }
+ }
+
+ ReportStatusCode (
+ (EFI_ERROR_CODE | EFI_ERROR_UNRECOVERED),
+ EFI_SOFTWARE_UNSPECIFIED | ErrorMessage
+ );
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Common exception handler
+
+ @param[in] InterruptType - Exception type
+ @param[in] SystemContext - EFI_SYSTEM_CONTEXT
+**/
+VOID
+EFIAPI
+CommonExceptionHandler (
+ IN EFI_EXCEPTION_TYPE InterruptType,
+ IN EFI_SYSTEM_CONTEXT SystemContext
+ )
+{
+ AsmAcquireMPLock (&mExceptionLock);
+
+ DEBUG (
+ (EFI_D_ERROR,
+ "!!!! X64 Exception Type - %016lx CPU Apic ID - %08x!!!!\n",
+ InterruptType,
+ GetApicID (NULL,
+ NULL))
+ );
+ DEBUG (
+ (EFI_D_ERROR,
+ "RIP - %016lx, CS - %016lx, RFLAGS - %016lx\n",
+ SystemContext.SystemContextX64->Rip,
+ SystemContext.SystemContextX64->Cs,
+ SystemContext.SystemContextX64->Rflags)
+ );
+ if (mErrorCodeFlag & (1 << InterruptType)) {
+ DEBUG (
+ (EFI_D_ERROR,
+ "ExceptionData - %016lx\n",
+ SystemContext.SystemContextX64->ExceptionData)
+ );
+ }
+
+ DEBUG (
+ (EFI_D_ERROR,
+ "RAX - %016lx, RCX - %016lx, RDX - %016lx\n",
+ SystemContext.SystemContextX64->Rax,
+ SystemContext.SystemContextX64->Rcx,
+ SystemContext.SystemContextX64->Rdx)
+ );
+ DEBUG (
+ (EFI_D_ERROR,
+ "RBX - %016lx, RSP - %016lx, RBP - %016lx\n",
+ SystemContext.SystemContextX64->Rbx,
+ SystemContext.SystemContextX64->Rsp,
+ SystemContext.SystemContextX64->Rbp)
+ );
+ DEBUG (
+ (EFI_D_ERROR,
+ "RSI - %016lx, RDI - %016lx\n",
+ SystemContext.SystemContextX64->Rsi,
+ SystemContext.SystemContextX64->Rdi)
+ );
+ DEBUG (
+ (EFI_D_ERROR,
+ "R8 - %016lx, R9 - %016lx, R10 - %016lx\n",
+ SystemContext.SystemContextX64->R8,
+ SystemContext.SystemContextX64->R9,
+ SystemContext.SystemContextX64->R10)
+ );
+ DEBUG (
+ (EFI_D_ERROR,
+ "R11 - %016lx, R12 - %016lx, R13 - %016lx\n",
+ SystemContext.SystemContextX64->R11,
+ SystemContext.SystemContextX64->R12,
+ SystemContext.SystemContextX64->R13)
+ );
+ DEBUG (
+ (EFI_D_ERROR,
+ "R14 - %016lx, R15 - %016lx\n",
+ SystemContext.SystemContextX64->R14,
+ SystemContext.SystemContextX64->R15)
+ );
+ DEBUG (
+ (EFI_D_ERROR,
+ "DS - %016lx, ES - %016lx, FS - %016lx\n",
+ SystemContext.SystemContextX64->Ds,
+ SystemContext.SystemContextX64->Es,
+ SystemContext.SystemContextX64->Fs)
+ );
+ DEBUG (
+ (EFI_D_ERROR,
+ "GS - %016lx, SS - %016lx\n",
+ SystemContext.SystemContextX64->Gs,
+ SystemContext.SystemContextX64->Ss)
+ );
+ DEBUG (
+ (EFI_D_ERROR,
+ "GDTR - %016lx %016lx, LDTR - %016lx\n",
+ SystemContext.SystemContextX64->Gdtr[0],
+ SystemContext.SystemContextX64->Gdtr[1],
+ SystemContext.SystemContextX64->Ldtr)
+ );
+ DEBUG (
+ (EFI_D_ERROR,
+ "IDTR - %016lx %016lx, TR - %016lx\n",
+ SystemContext.SystemContextX64->Idtr[0],
+ SystemContext.SystemContextX64->Idtr[1],
+ SystemContext.SystemContextX64->Tr)
+ );
+ DEBUG (
+ (EFI_D_ERROR,
+ "CR0 - %016lx, CR2 - %016lx, CR3 - %016lx\n",
+ SystemContext.SystemContextX64->Cr0,
+ SystemContext.SystemContextX64->Cr2,
+ SystemContext.SystemContextX64->Cr3)
+ );
+ DEBUG (
+ (EFI_D_ERROR,
+ "CR4 - %016lx, CR8 - %016lx\n",
+ SystemContext.SystemContextX64->Cr4,
+ SystemContext.SystemContextX64->Cr8)
+ );
+ DEBUG (
+ (EFI_D_ERROR,
+ "DR0 - %016lx, DR1 - %016lx, DR2 - %016lx\n",
+ SystemContext.SystemContextX64->Dr0,
+ SystemContext.SystemContextX64->Dr1,
+ SystemContext.SystemContextX64->Dr2)
+ );
+ DEBUG (
+ (EFI_D_ERROR,
+ "DR3 - %016lx, DR6 - %016lx, DR7 - %016lx\n",
+ SystemContext.SystemContextX64->Dr3,
+ SystemContext.SystemContextX64->Dr6,
+ SystemContext.SystemContextX64->Dr7)
+ );
+
+ ///
+ /// Report Status Code
+ ///
+ ReportData (InterruptType, SystemContext);
+ AsmReleaseMPLock (&mExceptionLock);
+
+ ///
+ /// Use this macro to hang so that the compiler does not optimize out
+ /// the following RET instructions. This allows us to return if we
+ /// have a debugger attached.
+ ///
+ EFI_DEADLOOP ();
+
+ return;
+}
+
+/**
+ Install the IA-32 EM64T Exception Handler.
+ The current operation (which likely will change) will uninstall all the
+ pertinent exception handlers (0-7, 10-14, 16-19) except for Int8 which the timer
+ is currently sitting on (or soon will be).
+
+ It then installs all the appropriate handlers for each exception.
+
+ The handler then calls gRT->ReportStatusCode with a specific progress code. The
+ progress codes for now start at 0x200 for IA-32 processors. See Status Code
+ Specification for details. The Status code Specification uses the enumeration from
+ the EFI 1.1 Debug Support Protocol.
+
+ @param[in] CpuProtocol - Instance of CPU Arch Protocol
+
+ @retval EFI_SUCCESS - This function always return success after registering handlers.
+**/
+EFI_STATUS
+InitializeException (
+ IN EFI_CPU_ARCH_PROTOCOL *CpuProtocol
+ )
+{
+ EFI_STATUS Status;
+ UINTN Index;
+
+ CpuProtocol->DisableInterrupt (CpuProtocol);
+
+ for (Index = 0; Index < mExceptionNumber; Index++) {
+ Status = CpuProtocol->RegisterInterruptHandler (CpuProtocol, mExceptionTable[Index].Interrupt, NULL);
+ ///
+ /// Add in our handler
+ ///
+ Status = CpuProtocol->RegisterInterruptHandler (
+ CpuProtocol,
+ mExceptionTable[Index].Interrupt,
+ CommonExceptionHandler
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/Haswell/CpuInit/Dxe/x64/MemoryOperation.c b/ReferenceCode/Haswell/CpuInit/Dxe/x64/MemoryOperation.c
new file mode 100644
index 0000000..5fae506
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Dxe/x64/MemoryOperation.c
@@ -0,0 +1,729 @@
+/** @file
+ Memory Operation Functions for IA32 Architecture.
+
+@copyright
+ Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "CpuInitDxe.h"
+#include "CpuLib.h"
+#include "MpCommon.h"
+#include "VirtualMemory.h"
+#include "MemoryAttribute.h"
+#endif
+
+VOID
+InitializeExternalVectorTablePtr (
+ EFI_CPU_INTERRUPT_HANDLER *VectorTable
+ );
+
+extern EFI_CPU_INTERRUPT_HANDLER mExternalVectorTable[];
+extern EFI_PHYSICAL_ADDRESS mBackupBuffer;
+
+UINT8 *mPageStore = NULL;
+UINTN mPageStoreSize = 16;
+UINTN mPageStoreIndex = 0;
+
+UINT64 mValidMtrrAddressMask;
+UINT64 mValidMtrrBitsMask;
+
+///
+/// BugBug: Non Portable
+///
+#if defined (__GNUC__)
+#define ALIGN_16BYTE_BOUNDRY __attribute__ ((aligned (16)))
+#else
+#define ALIGN_16BYTE_BOUNDRY __declspec (align (16))
+#endif
+
+#pragma pack(1)
+typedef struct {
+ UINT16 LimitLow;
+ UINT16 BaseLow;
+ UINT8 BaseMiddle;
+ UINT8 Attributes1;
+ UINT8 Attributes2;
+ UINT8 BaseHigh;
+} SEGMENT_DESCRIPTOR_x64;
+
+typedef struct {
+ UINT16 Limit;
+ UINTN Base;
+} PSEUDO_DESCRIPTOR_x64;
+
+#pragma pack()
+
+ALIGN_16BYTE_BOUNDRY SEGMENT_DESCRIPTOR_x64 gGdt[] = {
+ { /// NULL Selector: selector[0]
+ 0, /// limit 15:0
+ 0, /// base 15:0
+ 0, /// base 23:16
+ 0, ///
+ 0, /// type & limit 19:16
+ 0, /// base 31:24
+ /// 0, /// base 63:32
+ /// 0 /// reserved
+ ///
+ },
+ { /// Linear Selector: selector[8]
+ 0xffff, /// limit 15:0
+ 0, /// base 15:0
+ 0, /// base 23:16
+ 0x93, /// present, ring 0, data, expand-up writable
+ 0xcf, /// type & limit 19:16
+ 0, /// base 31:24
+ /// 0, /// base 63:32
+ /// 0 /// reserved
+ ///
+ },
+ { /// Linear code Selector: selector[10]
+ 0xffff, /// limit 15:0
+ 0, /// base 15:0
+ 0, /// base 23:16
+ 0x9b, /// present, ring 0, code, expand-up writable
+ 0xcf, /// type & limit 19:16
+ 0, /// base 31:24
+ /// 0, /// base 63:32
+ /// 0 /// reserved
+ ///
+ },
+ { /// Compatibility mode data Selector: selector[18]
+ 0xffff, /// limit 15:0
+ 0, /// base 15:0
+ 0, /// base 23:16
+ 0x93, /// type & limit 19:16
+ 0xcf,
+ 0, /// base 31:24
+ /// 0, /// base 63:32
+ /// 0 /// reserved
+ ///
+ },
+ { /// Compatibility code Selector: selector[20]
+ 0xffff, /// limit 15:0
+ 0, /// base 15:0
+ 0, /// base 23:16
+ 0x9b, /// type & limit 19:16
+ 0xcf,
+ 0, /// base 31:24
+ /// 0, /// base 63:32
+ /// 0 /// reserved
+ ///
+ },
+ { /// Spare3 Selector: selector[28]
+ 0, /// limit 15:0
+ 0, /// base 15:0
+ 0, /// base 23:16
+ 0, /// type & limit 19:16
+ 0, /// base 31:24
+ 0,
+ ///
+ /// 0, /// base 63:32
+ /// 0 /// reserved
+ ///
+ },
+ { /// 64-bit data Selector:selector[30]
+ 0xffff, /// limit 15:0
+ 0, /// base 15:0
+ 0, /// base 23:16
+ 0x93, /// type & limit 19:16
+ 0xcf,
+ 0, /// base 31:24
+ /// 0, /// base 63:32
+ /// 0 /// reserved
+ ///
+ },
+ { /// 64-bit code Selector: selector[38]
+ 0xffff, /// limit 15:0
+ 0, /// base 15:0
+ 0, /// base 23:16
+ 0x9b, /// type & limit 19:16
+ 0xaf,
+ 0, /// base 31:24
+ /// 0, /// base 63:32
+ /// 0 /// reserved
+ ///
+ },
+ { /// Spare3 Selector: selector[40]
+ 0, /// limit 15:0
+ 0, /// base 15:0
+ 0, /// base 23:16
+ 0, /// type & limit 19:16
+ 0, /// base 31:24
+ 0,
+ ///
+ /// 0, /// base 63:32
+ /// 0 /// reserved
+ ///
+ }
+};
+
+ALIGN_16BYTE_BOUNDRY PSEUDO_DESCRIPTOR_x64 gGdtPseudoDescriptor = {
+ sizeof (gGdt) - 1,
+ (UINTN) gGdt
+};
+
+INTERRUPT_GATE_DESCRIPTOR gIdtTable[INTERRUPT_VECTOR_NUMBER] = { 0 };
+
+ALIGN_16BYTE_BOUNDRY PSEUDO_DESCRIPTOR_x64 gLidtPseudoDescriptor = {
+ sizeof (gIdtTable) - 1,
+ (UINTN) gIdtTable
+};
+
+/**
+ Init Global Descriptor table
+**/
+VOID
+InitializeSelectors (
+ VOID
+ )
+{
+ CpuLoadGlobalDescriptorTable (&gGdtPseudoDescriptor);
+}
+
+/**
+ Generic IDT Vector Handlers for the Host
+**/
+VOID
+AsmIdtVector00 (
+ VOID
+ );
+
+/**
+ Initialize Interrupt descriptor Tables
+**/
+VOID
+InitializeInterruptTables (
+ VOID
+ )
+{
+ UINT16 CodeSegment;
+ INTERRUPT_GATE_DESCRIPTOR *IdtEntry;
+ UINT8 *CurrentHandler;
+ UINT32 Index;
+
+ CodeSegment = CpuCodeSegment ();
+
+ IdtEntry = gIdtTable;
+ CurrentHandler = (UINT8 *) (UINTN) AsmIdtVector00;
+ for (Index = 0; Index < INTERRUPT_VECTOR_NUMBER; Index++) {
+ IdtEntry[Index].Offset15To0 = (UINT16) (UINTN) CurrentHandler;
+ IdtEntry[Index].SegmentSelector = CodeSegment;
+ IdtEntry[Index].Attributes = INTERRUPT_GATE_ATTRIBUTE;
+ ///
+ /// 8e00;
+ ///
+ IdtEntry[Index].Offset31To16 = (UINT16) ((UINTN) CurrentHandler >> 16);
+ IdtEntry[Index].Offset63To32 = (UINT32) ((UINTN) CurrentHandler >> 32);
+
+ CurrentHandler += 0x8;
+ ///
+ }
+
+ CpuLoadInterruptDescriptorTable (&gLidtPseudoDescriptor);
+
+ return;
+}
+
+/**
+ Initialize cache attributes based on MTRR
+**/
+VOID
+InitailizeCacheAttributes (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ EFI_PHYSICAL_ADDRESS Page;
+ EFI_CPUID_REGISTER FeatureInfo;
+ EFI_CPUID_REGISTER FunctionInfo;
+ UINT8 PhysicalAddressBits;
+ UINT32 MsrNum;
+ UINT64 TempQword;
+ UINT64 ComplementBits;
+ UINT32 VariableMtrrLimit;
+
+ VariableMtrrLimit = (UINT32) (AsmReadMsr64 (IA32_MTRR_CAP) & B_IA32_MTRR_VARIABLE_SUPPORT);
+
+ ///
+ /// Allocate 16 pages
+ ///
+ Status = (gBS->AllocatePages)(AllocateAnyPages, EfiBootServicesData, mPageStoreSize, &Page);
+ ASSERT_EFI_ERROR (Status);
+
+ mPageStore = (UINT8 *) (UINTN) Page;
+
+ ZeroMem (mPageStore, 0x1000 * mPageStoreSize);
+
+ ///
+ /// Check returned value of Eax for extended CPUID functions
+ ///
+ AsmCpuid (
+ CPUID_EXTENDED_FUNCTION,
+ &FunctionInfo.RegEax,
+ &FunctionInfo.RegEbx,
+ &FunctionInfo.RegEcx,
+ &FunctionInfo.RegEdx
+ );
+
+ PhysicalAddressBits = 36;
+
+ ///
+ /// If CPU supports extended functions, get the Physical Address size by reading EAX[7:0]
+ ///
+ if (FunctionInfo.RegEax > CPUID_EXTENDED_FUNCTION) {
+ AsmCpuid (
+ CPUID_VIR_PHY_ADDRESS_SIZE,
+ &FeatureInfo.RegEax,
+ &FeatureInfo.RegEbx,
+ &FeatureInfo.RegEcx,
+ &FeatureInfo.RegEdx
+ );
+ PhysicalAddressBits = (UINT8) FeatureInfo.RegEax;
+ }
+
+ mValidMtrrBitsMask = (((UINT64) 1) << PhysicalAddressBits) - 1;
+ mValidMtrrAddressMask = mValidMtrrBitsMask & 0xfffffffffffff000;
+
+ ComplementBits = mValidMtrrBitsMask & 0xfffffff000000000;
+ if (ComplementBits != 0) {
+ ///
+ /// Disable cache and clear the corresponding MTRR bits
+ ///
+ PreMtrrChange ();
+ for (MsrNum = CACHE_VARIABLE_MTRR_BASE;
+ MsrNum < (CACHE_VARIABLE_MTRR_BASE + VariableMtrrLimit * 2 - 1);
+ MsrNum += 2
+ ) {
+ TempQword = AsmReadMsr64 (MsrNum + 1);
+ if ((TempQword & B_CACHE_MTRR_VALID) != 0) {
+ ///
+ /// MTRR Physical Mask
+ ///
+ TempQword = TempQword | ComplementBits;
+ AsmWriteMsr64 (MsrNum + 1, TempQword);
+ }
+ }
+
+ ///
+ /// Enable Cache and set the corresponding MTRR bits
+ ///
+ PostMtrrChange ();
+ }
+}
+
+/**
+ Allocate zeroed pages
+
+ @retval Pointer to the page buffer
+**/
+VOID *
+AllocateZeroedPage (
+ VOID
+ )
+{
+ if (mPageStoreIndex >= mPageStoreSize) {
+ ///
+ /// We are out of space
+ ///
+ return NULL;
+ }
+
+ return (VOID *) (UINTN) &mPageStore[0x1000 * mPageStoreIndex++];
+}
+
+/**
+ Convert 2MB page tables to 4KB page tables
+
+ @param[in] PageAddress - Page address to convert
+ @param[in] PageDirectoryToConvert - Page table that will be converted
+**/
+VOID
+Convert2MBPageTo4KPages (
+ IN EFI_PHYSICAL_ADDRESS PageAddress,
+ IN OUT x64_PAGE_TABLE_ENTRY **PageDirectoryToConvert
+ )
+{
+ UINTN Index;
+ EFI_PHYSICAL_ADDRESS WorkingAddress;
+ x64_PAGE_TABLE_ENTRY_4K *PageTableEntry;
+ x64_PAGE_TABLE_ENTRY Attributes;
+
+ ///
+ /// Save the attributes of the 2MB table
+ ///
+ Attributes.Page2Mb.Uint64 = (*PageDirectoryToConvert)->Page2Mb.Uint64;
+
+ ///
+ /// Convert PageDirectoryEntry2MB into a 4K Page Directory
+ ///
+ PageTableEntry = AllocateZeroedPage ();
+ if (PageTableEntry == NULL) {
+ return;
+ }
+ (*PageDirectoryToConvert)->Page2Mb.Uint64 = (UINT64) PageTableEntry;
+ (*PageDirectoryToConvert)->Page2Mb.Bits.ReadWrite = 1;
+ (*PageDirectoryToConvert)->Page2Mb.Bits.Present = 1;
+
+ WorkingAddress = PageAddress;
+ for (Index = 0; Index < 512; Index++, PageTableEntry++, WorkingAddress += 0x1000) {
+ PageTableEntry->Uint64 = (UINT64) WorkingAddress;
+ PageTableEntry->Bits.Present = 1;
+
+ ///
+ /// Update the new page to have the same attributes as the 2MB page
+ ///
+ PageTableEntry->Bits.ReadWrite = Attributes.Common.ReadWrite;
+ PageTableEntry->Bits.CacheDisabled = Attributes.Common.CacheDisabled;
+ PageTableEntry->Bits.WriteThrough = Attributes.Common.WriteThrough;
+
+ if (WorkingAddress == PageAddress) {
+ ///
+ /// Return back the 4K page that matches the Working addresss
+ ///
+ *PageDirectoryToConvert = (x64_PAGE_TABLE_ENTRY *) PageTableEntry;
+ }
+ }
+}
+
+/**
+ Get current memory mapping information
+
+ @param[in] BaseAddress - get current memory mapping by this Base address
+ @param[in] PageTable - page table that translated this base address
+ @param[in] Page2MBytes - TRUE if this is 2MBytes page table
+
+ @retval EFI_NOT_FOUND - page table not found
+ @retval EFI_SUCCESS - page table found
+**/
+EFI_STATUS
+GetCurrentMapping (
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,
+ OUT x64_PAGE_TABLE_ENTRY **PageTable,
+ OUT BOOLEAN *Page2MBytes
+ )
+{
+ UINT64 Cr3;
+ x64_PAGE_MAP_AND_DIRECTORY_POINTER_2MB_4K *PageMapLevel4Entry;
+ x64_PAGE_MAP_AND_DIRECTORY_POINTER_2MB_4K *PageDirectoryPointerEntry;
+ x64_PAGE_TABLE_ENTRY_2M *PageTableEntry2Mb;
+ x64_PAGE_DIRECTORY_ENTRY_4K *PageDirectoryEntry4k;
+ x64_PAGE_TABLE_ENTRY_4K *PageTableEntry4k;
+ UINTN Pml4Index;
+ UINTN PdpIndex;
+ UINTN Pde2MbIndex;
+ UINTN PteIndex;
+
+ Cr3 = AsmReadCr3 ();
+
+ PageMapLevel4Entry = (x64_PAGE_MAP_AND_DIRECTORY_POINTER_2MB_4K *) (Cr3 & 0x000ffffffffff000);
+
+ Pml4Index = (UINTN) RShiftU64 (BaseAddress, 39) & 0x1ff;
+ if (PageMapLevel4Entry[Pml4Index].Bits.Present == 0) {
+ return EFI_NOT_FOUND;
+ }
+
+ PageDirectoryPointerEntry = (x64_PAGE_MAP_AND_DIRECTORY_POINTER_2MB_4K *) (PageMapLevel4Entry[Pml4Index].Uint64 & 0x000ffffffffff000);
+ PdpIndex = (UINTN) RShiftU64 (BaseAddress, 30) & 0x1ff;
+ if (PageDirectoryPointerEntry[PdpIndex].Bits.Present == 0) {
+ return EFI_NOT_FOUND;
+ }
+
+ PageTableEntry2Mb = (x64_PAGE_TABLE_ENTRY_2M *) (PageDirectoryPointerEntry[PdpIndex].Uint64 & 0x000ffffffffff000);
+ Pde2MbIndex = (UINTN) RShiftU64 (BaseAddress, 21) & 0x1ff;
+ if (PageTableEntry2Mb[Pde2MbIndex].Bits.Present == 0) {
+ return EFI_NOT_FOUND;
+ }
+
+ if (PageTableEntry2Mb[Pde2MbIndex].Bits.MustBe1 == 1) {
+ ///
+ /// We found a 2MByte page so lets return it
+ ///
+ *Page2MBytes = TRUE;
+ *PageTable = (x64_PAGE_TABLE_ENTRY *) &PageTableEntry2Mb[Pde2MbIndex].Uint64;
+ return EFI_SUCCESS;
+ }
+
+ ///
+ /// 4K page so keep walking
+ ///
+ PageDirectoryEntry4k = (x64_PAGE_DIRECTORY_ENTRY_4K *) &PageTableEntry2Mb[Pde2MbIndex].Uint64;
+
+ PageTableEntry4k = (x64_PAGE_TABLE_ENTRY_4K *) (PageDirectoryEntry4k[Pde2MbIndex].Uint64 & 0x000ffffffffff000);
+ PteIndex = (UINTN) RShiftU64 (BaseAddress, 12) & 0x1ff;
+ if (PageTableEntry4k[PteIndex].Bits.Present == 0) {
+ return EFI_NOT_FOUND;
+ }
+
+ *Page2MBytes = FALSE;
+ *PageTable = (x64_PAGE_TABLE_ENTRY *) &PageTableEntry4k[PteIndex];
+ return EFI_SUCCESS;
+}
+
+/**
+ Prepare memory for essential system tables.
+
+ @retval EFI_SUCCESS - Memory successfully prepared.
+**/
+EFI_STATUS
+PrepareMemory (
+ VOID
+ )
+{
+ ///
+ /// Allocate space to convert 2MB page tables to 4K tables.
+ /// This can not be done at call time as the TPL level will
+ /// not be correct.
+ ///
+ InitailizeCacheAttributes ();
+
+ InitializeExternalVectorTablePtr (mExternalVectorTable);
+ ///
+ /// Initialize the Interrupt Descriptor Table
+ ///
+ InitializeInterruptTables ();
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Prepare Wakeup Buffer and stack for APs.
+
+ @param[in] WakeUpBuffer - Pointer to the address of wakeup buffer for output.
+ @param[in] StackAddressStart - Pointer to the stack address of APs for output.
+ @param[in] MaximumCPUsForThisSystem - Maximum CPUs in this system.
+
+ @retval EFI_SUCCESS - Memory successfully prepared for APs.
+ @retval Other - Error occurred while allocating memory.
+**/
+EFI_STATUS
+PrepareMemoryForAPs (
+ OUT EFI_PHYSICAL_ADDRESS *WakeUpBuffer,
+ OUT VOID **StackAddressStart,
+ IN UINTN MaximumCPUsForThisSystem
+ )
+{
+ EFI_STATUS Status;
+ MP_ASSEMBLY_ADDRESS_MAP AddressMap;
+
+ ///
+ /// Release All APs with a lock and wait for them to retire to rendezvous procedure.
+ /// We need a page (4KB) of memory for IA-32 to use broadcast APIs, on a temporary basis.
+ ///
+ Status = AllocateWakeUpBuffer (WakeUpBuffer);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ ///
+ /// Claim memory for AP stack
+ ///
+ Status = AllocateReservedMemoryBelow4G (
+ MaximumCPUsForThisSystem * STACK_SIZE_PER_PROC,
+ StackAddressStart
+ );
+
+ if (EFI_ERROR (Status)) {
+ (gBS->FreePages)(*WakeUpBuffer, 1);
+ return Status;
+ }
+
+ AsmGetAddressMap (&AddressMap);
+ CopyMem ((VOID *) (UINTN) *WakeUpBuffer, AddressMap.RendezvousFunnelAddress, AddressMap.Size);
+ *(UINT32 *) (UINTN) (*WakeUpBuffer + AddressMap.FlatJumpOffset + 3) = (UINT32) (*WakeUpBuffer + AddressMap.PModeEntryOffset);
+ *(UINT32 *) (UINTN) (*WakeUpBuffer + AddressMap.LongJumpOffset + 2) = (UINT32) (*WakeUpBuffer + AddressMap.LModeEntryOffset);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Prepare exchange information for APs.
+
+ @param[in] ExchangeInfo - Pointer to the exchange info buffer for output.
+ @param[in] StackAddressStart - Start address of APs' stacks.
+ @param[in] ApFunction - Address of function assigned to AP.
+ @param[in] WakeUpBuffer - Pointer to the address of wakeup buffer.
+
+ @retval EFI_SUCCESS - Exchange Info successfully prepared for APs.
+**/
+EFI_STATUS
+PrepareExchangeInfo (
+ OUT MP_CPU_EXCHANGE_INFO *ExchangeInfo,
+ IN VOID *StackAddressStart,
+ IN VOID *ApFunction,
+ IN EFI_PHYSICAL_ADDRESS WakeUpBuffer
+ )
+{
+ ZeroMem ((VOID *) ExchangeInfo, EFI_PAGE_SIZE - MP_CPU_EXCHANGE_INFO_OFFSET);
+
+ ExchangeInfo->Lock = VacantFlag;
+ ExchangeInfo->StackStart = StackAddressStart;
+ ExchangeInfo->StackSize = STACK_SIZE_PER_PROC;
+ ExchangeInfo->ApFunction = ApFunction;
+
+ CopyMem (
+ (VOID *) (UINTN) &ExchangeInfo->GdtrProfile,
+ (VOID *) (UINTN) mAcpiCpuData->GdtrProfile,
+ sizeof (PSEUDO_DESCRIPTOR)
+ );
+ CopyMem (
+ (VOID *) (UINTN) &ExchangeInfo->IdtrProfile,
+ (VOID *) (UINTN) mAcpiCpuData->IdtrProfile,
+ sizeof (PSEUDO_DESCRIPTOR)
+ );
+
+ ExchangeInfo->BufferStart = (UINT32) WakeUpBuffer;
+ ExchangeInfo->Cr3 = (UINT32) (AsmReadCr3 ());
+ ExchangeInfo->InitFlag = 1;
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Prepare Wakeup Buffer and stack for APs.
+
+ @param[in] WakeUpBuffer - Pointer to the address of wakeup buffer for output.
+ @param[in] StackAddressStart - Pointer to the stack address of APs for output.
+
+ @retval EFI_SUCCESS - Memory successfully prepared for APs.
+**/
+EFI_STATUS
+S3PrepareMemoryForAPs (
+ OUT EFI_PHYSICAL_ADDRESS *WakeUpBuffer,
+ OUT VOID **StackAddressStart
+ )
+{
+ return EFI_SUCCESS;
+}
+
+/**
+ Prepare exchange information for APs.
+
+ @param[in] ExchangeInfo - Pointer to the exchange info for output.
+ @param[in] StackAddressStart - Start address of APs' stacks.
+ @param[in] ApFunction - Address of function assigned to AP.
+ @param[in] WakeUpBuffer - Pointer to the address of wakeup buffer.
+
+ @retval EFI_SUCCESS - Exchange Info successfully prepared for APs.
+**/
+EFI_STATUS
+S3PrepareExchangeInfo (
+ OUT MP_CPU_EXCHANGE_INFO *ExchangeInfo,
+ IN VOID *StackAddressStart,
+ IN VOID *ApFunction,
+ IN EFI_PHYSICAL_ADDRESS WakeUpBuffer
+ )
+{
+ return EFI_SUCCESS;
+}
+
+/**
+ Dynamically write the far jump destination in APs' wakeup buffer,
+ in order to refresh APs' CS registers for mode switching.
+**/
+VOID
+RedirectFarJump (
+ VOID
+ )
+{
+ MP_ASSEMBLY_ADDRESS_MAP AddressMap;
+
+ AsmGetAddressMap (&AddressMap);
+ *(UINT32 *) (UINTN) (mAcpiCpuData->WakeUpBuffer + AddressMap.FlatJumpOffset + 3) = (UINT32) (mAcpiCpuData->WakeUpBuffer + AddressMap.PModeEntryOffset);
+ *(UINT32 *) (UINTN) (mAcpiCpuData->WakeUpBuffer + AddressMap.LongJumpOffset + 2) = (UINT32) (mAcpiCpuData->WakeUpBuffer + AddressMap.LModeEntryOffset);
+
+ return;
+}
+
+/**
+ Prepare GDTR and IDTR for AP
+
+ @param[in] Gdtr - The GDTR profile
+ @param[in] Idtr - The IDTR profile
+
+ @retval EFI_STATUS - status returned by each sub-routine
+ @retval EFI_SUCCESS - GDTR and IDTR has been prepared for AP
+**/
+EFI_STATUS
+PrepareGdtIdtForAP (
+ OUT PSEUDO_DESCRIPTOR *Gdtr,
+ OUT PSEUDO_DESCRIPTOR *Idtr
+ )
+{
+ INTERRUPT_GATE_DESCRIPTOR *IdtForAP;
+ SEGMENT_DESCRIPTOR *GdtForAP;
+
+ PSEUDO_DESCRIPTOR *IdtrForBSP;
+ PSEUDO_DESCRIPTOR *GdtrForBSP;
+
+ UINT16 *MceHandler;
+ EFI_STATUS Status;
+
+ AsmGetGdtrIdtr (&GdtrForBSP, &IdtrForBSP);
+
+ ///
+ /// Allocate reserved memory for IDT
+ ///
+ Status = AllocateAlignedReservedMemory (
+ IdtrForBSP->Limit + 1,
+ 8,
+ (VOID **) &IdtForAP
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ ///
+ /// Allocate reserved memory for GDT
+ ///
+ Status = AllocateAlignedReservedMemory (
+ GdtrForBSP->Limit + 1,
+ 8,
+ (VOID **) &GdtForAP
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = (gBS->AllocatePool)(EfiReservedMemoryType, SIZE_OF_MCE_HANDLER, (VOID **) &MceHandler);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ ///
+ /// McheHandler content: iret (opcode = 0xcf)
+ ///
+ *MceHandler = 0xCF48;
+
+ CopyMem (GdtForAP, (VOID *) GdtrForBSP->Base, GdtrForBSP->Limit + 1);
+ CopyMem (IdtForAP, (VOID *) IdtrForBSP->Base, IdtrForBSP->Limit + 1);
+
+ IdtForAP[INTERRUPT_HANDLER_MACHINE_CHECK].Offset15To0 = (UINT16) (UINTN) MceHandler;
+ IdtForAP[INTERRUPT_HANDLER_MACHINE_CHECK].Offset31To16 = (UINT16) ((UINTN) MceHandler >> 16);
+ IdtForAP[INTERRUPT_HANDLER_MACHINE_CHECK].Offset63To32 = (UINT32) ((UINTN) MceHandler >> 32);
+
+ ///
+ /// Create Gdtr, IDTR profile
+ ///
+ Gdtr->Base = (UINTN) GdtForAP;
+ Gdtr->Limit = GdtrForBSP->Limit;
+
+ Idtr->Base = (UINTN) IdtForAP;
+ Idtr->Limit = IdtrForBSP->Limit;
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/Haswell/CpuInit/Dxe/x64/MemoryOperationDbgr.c b/ReferenceCode/Haswell/CpuInit/Dxe/x64/MemoryOperationDbgr.c
new file mode 100644
index 0000000..329a4a5
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Dxe/x64/MemoryOperationDbgr.c
@@ -0,0 +1,749 @@
+/** @file
+ Memory Operation Functions for IA32 Architecture.
+
+@copyright
+ Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "CpuInitDxeDbgr.h"
+#include "CpuLib.h"
+#include "MpCommon.h"
+#include "VirtualMemory.h"
+#include "MemoryAttribute.h"
+#endif
+
+//(AMI_CHG+)>
+#if defined(AMI_PEI_DEBUG_SUPPORT) && AMI_PEI_DEBUG_SUPPORT
+extern AMI_DEBUGGER_CPU_PROTOCOL *mAmiDebuggerCpuProtocol;
+#endif
+//<(AMI_CHG+)
+
+VOID
+InitializeExternalVectorTablePtr (
+ EFI_CPU_INTERRUPT_HANDLER *VectorTable
+ );
+
+extern EFI_CPU_INTERRUPT_HANDLER mExternalVectorTable[];
+extern EFI_PHYSICAL_ADDRESS mBackupBuffer;
+
+UINT8 *mPageStore = NULL;
+UINTN mPageStoreSize = 16;
+UINTN mPageStoreIndex = 0;
+
+UINT64 mValidMtrrAddressMask;
+UINT64 mValidMtrrBitsMask;
+
+///
+/// BugBug: Non Portable
+///
+#if defined (__GNUC__)
+#define ALIGN_16BYTE_BOUNDRY __attribute__ ((aligned (16)))
+#else
+#define ALIGN_16BYTE_BOUNDRY __declspec (align (16))
+#endif
+
+#pragma pack(1)
+typedef struct {
+ UINT16 LimitLow;
+ UINT16 BaseLow;
+ UINT8 BaseMiddle;
+ UINT8 Attributes1;
+ UINT8 Attributes2;
+ UINT8 BaseHigh;
+} SEGMENT_DESCRIPTOR_x64;
+
+typedef struct {
+ UINT16 Limit;
+ UINTN Base;
+} PSEUDO_DESCRIPTOR_x64;
+
+#pragma pack()
+
+ALIGN_16BYTE_BOUNDRY SEGMENT_DESCRIPTOR_x64 gGdt[] = {
+ { /// NULL Selector: selector[0]
+ 0, /// limit 15:0
+ 0, /// base 15:0
+ 0, /// base 23:16
+ 0, ///
+ 0, /// type & limit 19:16
+ 0, /// base 31:24
+ /// 0, /// base 63:32
+ /// 0 /// reserved
+ ///
+ },
+ { /// Linear Selector: selector[8]
+ 0xffff, /// limit 15:0
+ 0, /// base 15:0
+ 0, /// base 23:16
+ 0x93, /// present, ring 0, data, expand-up writable
+ 0xcf, /// type & limit 19:16
+ 0, /// base 31:24
+ /// 0, /// base 63:32
+ /// 0 /// reserved
+ ///
+ },
+ { /// Linear code Selector: selector[10]
+ 0xffff, /// limit 15:0
+ 0, /// base 15:0
+ 0, /// base 23:16
+ 0x9b, /// present, ring 0, code, expand-up writable
+ 0xcf, /// type & limit 19:16
+ 0, /// base 31:24
+ /// 0, /// base 63:32
+ /// 0 /// reserved
+ ///
+ },
+ { /// Compatibility mode data Selector: selector[18]
+ 0xffff, /// limit 15:0
+ 0, /// base 15:0
+ 0, /// base 23:16
+ 0x93, /// type & limit 19:16
+ 0xcf,
+ 0, /// base 31:24
+ /// 0, /// base 63:32
+ /// 0 /// reserved
+ ///
+ },
+ { /// Compatibility code Selector: selector[20]
+ 0xffff, /// limit 15:0
+ 0, /// base 15:0
+ 0, /// base 23:16
+ 0x9b, /// type & limit 19:16
+ 0xcf,
+ 0, /// base 31:24
+ /// 0, /// base 63:32
+ /// 0 /// reserved
+ ///
+ },
+ { /// Spare3 Selector: selector[28]
+ 0, /// limit 15:0
+ 0, /// base 15:0
+ 0, /// base 23:16
+ 0, /// type & limit 19:16
+ 0, /// base 31:24
+ 0,
+ ///
+ /// 0, /// base 63:32
+ /// 0 /// reserved
+ ///
+ },
+ { /// 64-bit data Selector:selector[30]
+ 0xffff, /// limit 15:0
+ 0, /// base 15:0
+ 0, /// base 23:16
+ 0x93, /// type & limit 19:16
+ 0xcf,
+ 0, /// base 31:24
+ /// 0, /// base 63:32
+ /// 0 /// reserved
+ ///
+ },
+ { /// 64-bit code Selector: selector[38]
+ 0xffff, /// limit 15:0
+ 0, /// base 15:0
+ 0, /// base 23:16
+ 0x9b, /// type & limit 19:16
+ 0xaf,
+ 0, /// base 31:24
+ /// 0, /// base 63:32
+ /// 0 /// reserved
+ ///
+ },
+ { /// Spare3 Selector: selector[40]
+ 0, /// limit 15:0
+ 0, /// base 15:0
+ 0, /// base 23:16
+ 0, /// type & limit 19:16
+ 0, /// base 31:24
+ 0,
+ ///
+ /// 0, /// base 63:32
+ /// 0 /// reserved
+ ///
+ }
+};
+
+ALIGN_16BYTE_BOUNDRY PSEUDO_DESCRIPTOR_x64 gGdtPseudoDescriptor = {
+ sizeof (gGdt) - 1,
+ (UINTN) gGdt
+};
+
+INTERRUPT_GATE_DESCRIPTOR gIdtTable[INTERRUPT_VECTOR_NUMBER] = { 0 };
+
+ALIGN_16BYTE_BOUNDRY PSEUDO_DESCRIPTOR_x64 gLidtPseudoDescriptor = {
+ sizeof (gIdtTable) - 1,
+ (UINTN) gIdtTable
+};
+
+/**
+ Init Global Descriptor table
+**/
+VOID
+InitializeSelectors (
+ VOID
+ )
+{
+ CpuLoadGlobalDescriptorTable (&gGdtPseudoDescriptor);
+}
+
+/**
+ Generic IDT Vector Handlers for the Host
+**/
+VOID
+AsmIdtVector00 (
+ VOID
+ );
+
+/**
+ Initialize Interrupt descriptor Tables
+**/
+VOID
+InitializeInterruptTables (
+ VOID
+ )
+{
+ UINT16 CodeSegment;
+ INTERRUPT_GATE_DESCRIPTOR *IdtEntry;
+ UINT8 *CurrentHandler;
+ UINT32 Index;
+
+//(AMI_CHG+)>
+#if defined(AMI_PEI_DEBUG_SUPPORT) && AMI_PEI_DEBUG_SUPPORT
+ EFI_STATUS Status;
+#endif
+//<(AMI_CHG+)
+
+ CodeSegment = CpuCodeSegment ();
+
+ IdtEntry = gIdtTable;
+ CurrentHandler = (UINT8 *) (UINTN) AsmIdtVector00;
+ for (Index = 0; Index < INTERRUPT_VECTOR_NUMBER; Index++) {
+ IdtEntry[Index].Offset15To0 = (UINT16) (UINTN) CurrentHandler;
+ IdtEntry[Index].SegmentSelector = CodeSegment;
+ IdtEntry[Index].Attributes = INTERRUPT_GATE_ATTRIBUTE;
+ ///
+ /// 8e00;
+ ///
+ IdtEntry[Index].Offset31To16 = (UINT16) ((UINTN) CurrentHandler >> 16);
+ IdtEntry[Index].Offset63To32 = (UINT32) ((UINTN) CurrentHandler >> 32);
+
+//(AMI_CHG+)>
+#if defined(AMI_PEI_DEBUG_SUPPORT) && AMI_PEI_DEBUG_SUPPORT
+ Status = mAmiDebuggerCpuProtocol->DebuggerFixUpPEIExceptionHandlers(
+ (DEBUGGER_INTERRUPT_GATE_DESCRIPTOR *)IdtEntry,
+ Index);
+#endif
+//<(AMI_CHG+)
+
+ CurrentHandler += 0x8;
+ ///
+ }
+
+ CpuLoadInterruptDescriptorTable (&gLidtPseudoDescriptor);
+
+ return;
+}
+
+/**
+ Initialize cache attributes based on MTRR
+**/
+VOID
+InitailizeCacheAttributes (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ EFI_PHYSICAL_ADDRESS Page;
+ EFI_CPUID_REGISTER FeatureInfo;
+ EFI_CPUID_REGISTER FunctionInfo;
+ UINT8 PhysicalAddressBits;
+ UINT32 MsrNum;
+ UINT64 TempQword;
+ UINT64 ComplementBits;
+ UINT32 VariableMtrrLimit;
+
+ VariableMtrrLimit = (UINT32) (AsmReadMsr64 (IA32_MTRR_CAP) & B_IA32_MTRR_VARIABLE_SUPPORT);
+
+ ///
+ /// Allocate 16 pages
+ ///
+ Status = (gBS->AllocatePages)(AllocateAnyPages, EfiBootServicesData, mPageStoreSize, &Page);
+ ASSERT_EFI_ERROR (Status);
+
+ mPageStore = (UINT8 *) (UINTN) Page;
+
+ ZeroMem (mPageStore, 0x1000 * mPageStoreSize);
+
+ ///
+ /// Check returned value of Eax for extended CPUID functions
+ ///
+ AsmCpuid (
+ CPUID_EXTENDED_FUNCTION,
+ &FunctionInfo.RegEax,
+ &FunctionInfo.RegEbx,
+ &FunctionInfo.RegEcx,
+ &FunctionInfo.RegEdx
+ );
+
+ PhysicalAddressBits = 36;
+
+ ///
+ /// If CPU supports extended functions, get the Physical Address size by reading EAX[7:0]
+ ///
+ if (FunctionInfo.RegEax > CPUID_EXTENDED_FUNCTION) {
+ AsmCpuid (
+ CPUID_VIR_PHY_ADDRESS_SIZE,
+ &FeatureInfo.RegEax,
+ &FeatureInfo.RegEbx,
+ &FeatureInfo.RegEcx,
+ &FeatureInfo.RegEdx
+ );
+ PhysicalAddressBits = (UINT8) FeatureInfo.RegEax;
+ }
+
+ mValidMtrrBitsMask = (((UINT64) 1) << PhysicalAddressBits) - 1;
+ mValidMtrrAddressMask = mValidMtrrBitsMask & 0xfffffffffffff000;
+
+ ComplementBits = mValidMtrrBitsMask & 0xfffffff000000000;
+ if (ComplementBits != 0) {
+ ///
+ /// Disable cache and clear the corresponding MTRR bits
+ ///
+ PreMtrrChange ();
+ for (MsrNum = CACHE_VARIABLE_MTRR_BASE;
+ MsrNum < (CACHE_VARIABLE_MTRR_BASE + VariableMtrrLimit * 2 - 1);
+ MsrNum += 2
+ ) {
+ TempQword = AsmReadMsr64 (MsrNum + 1);
+ if ((TempQword & B_CACHE_MTRR_VALID) != 0) {
+ ///
+ /// MTRR Physical Mask
+ ///
+ TempQword = TempQword | ComplementBits;
+ AsmWriteMsr64 (MsrNum + 1, TempQword);
+ }
+ }
+
+ ///
+ /// Enable Cache and set the corresponding MTRR bits
+ ///
+ PostMtrrChange ();
+ }
+}
+
+/**
+ Allocate zeroed pages
+
+ @retval Pointer to the page buffer
+**/
+VOID *
+AllocateZeroedPage (
+ VOID
+ )
+{
+ if (mPageStoreIndex >= mPageStoreSize) {
+ ///
+ /// We are out of space
+ ///
+ return NULL;
+ }
+
+ return (VOID *) (UINTN) &mPageStore[0x1000 * mPageStoreIndex++];
+}
+
+/**
+ Convert 2MB page tables to 4KB page tables
+
+ @param[in] PageAddress - Page address to convert
+ @param[in] PageDirectoryToConvert - Page table that will be converted
+**/
+VOID
+Convert2MBPageTo4KPages (
+ IN EFI_PHYSICAL_ADDRESS PageAddress,
+ IN OUT x64_PAGE_TABLE_ENTRY **PageDirectoryToConvert
+ )
+{
+ UINTN Index;
+ EFI_PHYSICAL_ADDRESS WorkingAddress;
+ x64_PAGE_TABLE_ENTRY_4K *PageTableEntry;
+ x64_PAGE_TABLE_ENTRY Attributes;
+
+ ///
+ /// Save the attributes of the 2MB table
+ ///
+ Attributes.Page2Mb.Uint64 = (*PageDirectoryToConvert)->Page2Mb.Uint64;
+
+ ///
+ /// Convert PageDirectoryEntry2MB into a 4K Page Directory
+ ///
+ PageTableEntry = AllocateZeroedPage ();
+ if (PageTableEntry == NULL) {
+ return;
+ }
+ (*PageDirectoryToConvert)->Page2Mb.Uint64 = (UINT64) PageTableEntry;
+ (*PageDirectoryToConvert)->Page2Mb.Bits.ReadWrite = 1;
+ (*PageDirectoryToConvert)->Page2Mb.Bits.Present = 1;
+
+ WorkingAddress = PageAddress;
+ for (Index = 0; Index < 512; Index++, PageTableEntry++, WorkingAddress += 0x1000) {
+ PageTableEntry->Uint64 = (UINT64) WorkingAddress;
+ PageTableEntry->Bits.Present = 1;
+
+ ///
+ /// Update the new page to have the same attributes as the 2MB page
+ ///
+ PageTableEntry->Bits.ReadWrite = Attributes.Common.ReadWrite;
+ PageTableEntry->Bits.CacheDisabled = Attributes.Common.CacheDisabled;
+ PageTableEntry->Bits.WriteThrough = Attributes.Common.WriteThrough;
+
+ if (WorkingAddress == PageAddress) {
+ ///
+ /// Return back the 4K page that matches the Working addresss
+ ///
+ *PageDirectoryToConvert = (x64_PAGE_TABLE_ENTRY *) PageTableEntry;
+ }
+ }
+}
+
+/**
+ Get current memory mapping information
+
+ @param[in] BaseAddress - get current memory mapping by this Base address
+ @param[in] PageTable - page table that translated this base address
+ @param[in] Page2MBytes - TRUE if this is 2MBytes page table
+
+ @retval EFI_NOT_FOUND - page table not found
+ @retval EFI_SUCCESS - page table found
+**/
+EFI_STATUS
+GetCurrentMapping (
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,
+ OUT x64_PAGE_TABLE_ENTRY **PageTable,
+ OUT BOOLEAN *Page2MBytes
+ )
+{
+ UINT64 Cr3;
+ x64_PAGE_MAP_AND_DIRECTORY_POINTER_2MB_4K *PageMapLevel4Entry;
+ x64_PAGE_MAP_AND_DIRECTORY_POINTER_2MB_4K *PageDirectoryPointerEntry;
+ x64_PAGE_TABLE_ENTRY_2M *PageTableEntry2Mb;
+ x64_PAGE_DIRECTORY_ENTRY_4K *PageDirectoryEntry4k;
+ x64_PAGE_TABLE_ENTRY_4K *PageTableEntry4k;
+ UINTN Pml4Index;
+ UINTN PdpIndex;
+ UINTN Pde2MbIndex;
+ UINTN PteIndex;
+
+ Cr3 = AsmReadCr3 ();
+
+ PageMapLevel4Entry = (x64_PAGE_MAP_AND_DIRECTORY_POINTER_2MB_4K *) (Cr3 & 0x000ffffffffff000);
+
+ Pml4Index = (UINTN) RShiftU64 (BaseAddress, 39) & 0x1ff;
+ if (PageMapLevel4Entry[Pml4Index].Bits.Present == 0) {
+ return EFI_NOT_FOUND;
+ }
+
+ PageDirectoryPointerEntry = (x64_PAGE_MAP_AND_DIRECTORY_POINTER_2MB_4K *) (PageMapLevel4Entry[Pml4Index].Uint64 & 0x000ffffffffff000);
+ PdpIndex = (UINTN) RShiftU64 (BaseAddress, 30) & 0x1ff;
+ if (PageDirectoryPointerEntry[PdpIndex].Bits.Present == 0) {
+ return EFI_NOT_FOUND;
+ }
+
+ PageTableEntry2Mb = (x64_PAGE_TABLE_ENTRY_2M *) (PageDirectoryPointerEntry[PdpIndex].Uint64 & 0x000ffffffffff000);
+ Pde2MbIndex = (UINTN) RShiftU64 (BaseAddress, 21) & 0x1ff;
+ if (PageTableEntry2Mb[Pde2MbIndex].Bits.Present == 0) {
+ return EFI_NOT_FOUND;
+ }
+
+ if (PageTableEntry2Mb[Pde2MbIndex].Bits.MustBe1 == 1) {
+ ///
+ /// We found a 2MByte page so lets return it
+ ///
+ *Page2MBytes = TRUE;
+ *PageTable = (x64_PAGE_TABLE_ENTRY *) &PageTableEntry2Mb[Pde2MbIndex].Uint64;
+ return EFI_SUCCESS;
+ }
+
+ ///
+ /// 4K page so keep walking
+ ///
+ PageDirectoryEntry4k = (x64_PAGE_DIRECTORY_ENTRY_4K *) &PageTableEntry2Mb[Pde2MbIndex].Uint64;
+
+ PageTableEntry4k = (x64_PAGE_TABLE_ENTRY_4K *) (PageDirectoryEntry4k[Pde2MbIndex].Uint64 & 0x000ffffffffff000);
+ PteIndex = (UINTN) RShiftU64 (BaseAddress, 12) & 0x1ff;
+ if (PageTableEntry4k[PteIndex].Bits.Present == 0) {
+ return EFI_NOT_FOUND;
+ }
+
+ *Page2MBytes = FALSE;
+ *PageTable = (x64_PAGE_TABLE_ENTRY *) &PageTableEntry4k[PteIndex];
+ return EFI_SUCCESS;
+}
+
+/**
+ Prepare memory for essential system tables.
+
+ @retval EFI_SUCCESS - Memory successfully prepared.
+**/
+EFI_STATUS
+PrepareMemory (
+ VOID
+ )
+{
+ ///
+ /// Allocate space to convert 2MB page tables to 4K tables.
+ /// This can not be done at call time as the TPL level will
+ /// not be correct.
+ ///
+ InitailizeCacheAttributes ();
+
+ InitializeExternalVectorTablePtr (mExternalVectorTable);
+ ///
+ /// Initialize the Interrupt Descriptor Table
+ ///
+ InitializeInterruptTables ();
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Prepare Wakeup Buffer and stack for APs.
+
+ @param[in] WakeUpBuffer - Pointer to the address of wakeup buffer for output.
+ @param[in] StackAddressStart - Pointer to the stack address of APs for output.
+ @param[in] MaximumCPUsForThisSystem - Maximum CPUs in this system.
+
+ @retval EFI_SUCCESS - Memory successfully prepared for APs.
+ @retval Other - Error occurred while allocating memory.
+**/
+EFI_STATUS
+PrepareMemoryForAPs (
+ OUT EFI_PHYSICAL_ADDRESS *WakeUpBuffer,
+ OUT VOID **StackAddressStart,
+ IN UINTN MaximumCPUsForThisSystem
+ )
+{
+ EFI_STATUS Status;
+ MP_ASSEMBLY_ADDRESS_MAP AddressMap;
+
+ ///
+ /// Release All APs with a lock and wait for them to retire to rendezvous procedure.
+ /// We need a page (4KB) of memory for IA-32 to use broadcast APIs, on a temporary basis.
+ ///
+ Status = AllocateWakeUpBuffer (WakeUpBuffer);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ ///
+ /// Claim memory for AP stack
+ ///
+ Status = AllocateReservedMemoryBelow4G (
+ MaximumCPUsForThisSystem * STACK_SIZE_PER_PROC,
+ StackAddressStart
+ );
+
+ if (EFI_ERROR (Status)) {
+ (gBS->FreePages)(*WakeUpBuffer, 1);
+ return Status;
+ }
+
+ AsmGetAddressMap (&AddressMap);
+ CopyMem ((VOID *) (UINTN) *WakeUpBuffer, AddressMap.RendezvousFunnelAddress, AddressMap.Size);
+ *(UINT32 *) (UINTN) (*WakeUpBuffer + AddressMap.FlatJumpOffset + 3) = (UINT32) (*WakeUpBuffer + AddressMap.PModeEntryOffset);
+ *(UINT32 *) (UINTN) (*WakeUpBuffer + AddressMap.LongJumpOffset + 2) = (UINT32) (*WakeUpBuffer + AddressMap.LModeEntryOffset);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Prepare exchange information for APs.
+
+ @param[in] ExchangeInfo - Pointer to the exchange info buffer for output.
+ @param[in] StackAddressStart - Start address of APs' stacks.
+ @param[in] ApFunction - Address of function assigned to AP.
+ @param[in] WakeUpBuffer - Pointer to the address of wakeup buffer.
+
+ @retval EFI_SUCCESS - Exchange Info successfully prepared for APs.
+**/
+EFI_STATUS
+PrepareExchangeInfo (
+ OUT MP_CPU_EXCHANGE_INFO *ExchangeInfo,
+ IN VOID *StackAddressStart,
+ IN VOID *ApFunction,
+ IN EFI_PHYSICAL_ADDRESS WakeUpBuffer
+ )
+{
+ ZeroMem ((VOID *) ExchangeInfo, EFI_PAGE_SIZE - MP_CPU_EXCHANGE_INFO_OFFSET);
+
+ ExchangeInfo->Lock = VacantFlag;
+ ExchangeInfo->StackStart = StackAddressStart;
+ ExchangeInfo->StackSize = STACK_SIZE_PER_PROC;
+ ExchangeInfo->ApFunction = ApFunction;
+
+ CopyMem (
+ (VOID *) (UINTN) &ExchangeInfo->GdtrProfile,
+ (VOID *) (UINTN) mAcpiCpuData->GdtrProfile,
+ sizeof (PSEUDO_DESCRIPTOR)
+ );
+ CopyMem (
+ (VOID *) (UINTN) &ExchangeInfo->IdtrProfile,
+ (VOID *) (UINTN) mAcpiCpuData->IdtrProfile,
+ sizeof (PSEUDO_DESCRIPTOR)
+ );
+
+ ExchangeInfo->BufferStart = (UINT32) WakeUpBuffer;
+ ExchangeInfo->Cr3 = (UINT32) (AsmReadCr3 ());
+ ExchangeInfo->InitFlag = 1;
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Prepare Wakeup Buffer and stack for APs.
+
+ @param[in] WakeUpBuffer - Pointer to the address of wakeup buffer for output.
+ @param[in] StackAddressStart - Pointer to the stack address of APs for output.
+
+ @retval EFI_SUCCESS - Memory successfully prepared for APs.
+**/
+EFI_STATUS
+S3PrepareMemoryForAPs (
+ OUT EFI_PHYSICAL_ADDRESS *WakeUpBuffer,
+ OUT VOID **StackAddressStart
+ )
+{
+ return EFI_SUCCESS;
+}
+
+/**
+ Prepare exchange information for APs.
+
+ @param[in] ExchangeInfo - Pointer to the exchange info for output.
+ @param[in] StackAddressStart - Start address of APs' stacks.
+ @param[in] ApFunction - Address of function assigned to AP.
+ @param[in] WakeUpBuffer - Pointer to the address of wakeup buffer.
+
+ @retval EFI_SUCCESS - Exchange Info successfully prepared for APs.
+**/
+EFI_STATUS
+S3PrepareExchangeInfo (
+ OUT MP_CPU_EXCHANGE_INFO *ExchangeInfo,
+ IN VOID *StackAddressStart,
+ IN VOID *ApFunction,
+ IN EFI_PHYSICAL_ADDRESS WakeUpBuffer
+ )
+{
+ return EFI_SUCCESS;
+}
+
+/**
+ Dynamically write the far jump destination in APs' wakeup buffer,
+ in order to refresh APs' CS registers for mode switching.
+**/
+VOID
+RedirectFarJump (
+ VOID
+ )
+{
+ MP_ASSEMBLY_ADDRESS_MAP AddressMap;
+
+ AsmGetAddressMap (&AddressMap);
+ *(UINT32 *) (UINTN) (mAcpiCpuData->WakeUpBuffer + AddressMap.FlatJumpOffset + 3) = (UINT32) (mAcpiCpuData->WakeUpBuffer + AddressMap.PModeEntryOffset);
+ *(UINT32 *) (UINTN) (mAcpiCpuData->WakeUpBuffer + AddressMap.LongJumpOffset + 2) = (UINT32) (mAcpiCpuData->WakeUpBuffer + AddressMap.LModeEntryOffset);
+
+ return;
+}
+
+/**
+ Prepare GDTR and IDTR for AP
+
+ @param[in] Gdtr - The GDTR profile
+ @param[in] Idtr - The IDTR profile
+
+ @retval EFI_STATUS - status returned by each sub-routine
+ @retval EFI_SUCCESS - GDTR and IDTR has been prepared for AP
+**/
+EFI_STATUS
+PrepareGdtIdtForAP (
+ OUT PSEUDO_DESCRIPTOR *Gdtr,
+ OUT PSEUDO_DESCRIPTOR *Idtr
+ )
+{
+ INTERRUPT_GATE_DESCRIPTOR *IdtForAP;
+ SEGMENT_DESCRIPTOR *GdtForAP;
+
+ PSEUDO_DESCRIPTOR *IdtrForBSP;
+ PSEUDO_DESCRIPTOR *GdtrForBSP;
+
+ UINT16 *MceHandler;
+ EFI_STATUS Status;
+
+ AsmGetGdtrIdtr (&GdtrForBSP, &IdtrForBSP);
+
+ ///
+ /// Allocate reserved memory for IDT
+ ///
+ Status = AllocateAlignedReservedMemory (
+ IdtrForBSP->Limit + 1,
+ 8,
+ (VOID **) &IdtForAP
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ ///
+ /// Allocate reserved memory for GDT
+ ///
+ Status = AllocateAlignedReservedMemory (
+ GdtrForBSP->Limit + 1,
+ 8,
+ (VOID **) &GdtForAP
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = (gBS->AllocatePool)(EfiReservedMemoryType, SIZE_OF_MCE_HANDLER, (VOID **) &MceHandler);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ ///
+ /// McheHandler content: iret (opcode = 0xcf)
+ ///
+ *MceHandler = 0xCF48;
+
+ CopyMem (GdtForAP, (VOID *) GdtrForBSP->Base, GdtrForBSP->Limit + 1);
+ CopyMem (IdtForAP, (VOID *) IdtrForBSP->Base, IdtrForBSP->Limit + 1);
+
+ IdtForAP[INTERRUPT_HANDLER_MACHINE_CHECK].Offset15To0 = (UINT16) (UINTN) MceHandler;
+ IdtForAP[INTERRUPT_HANDLER_MACHINE_CHECK].Offset31To16 = (UINT16) ((UINTN) MceHandler >> 16);
+ IdtForAP[INTERRUPT_HANDLER_MACHINE_CHECK].Offset63To32 = (UINT32) ((UINTN) MceHandler >> 32);
+
+ ///
+ /// Create Gdtr, IDTR profile
+ ///
+ Gdtr->Base = (UINTN) GdtForAP;
+ Gdtr->Limit = GdtrForBSP->Limit;
+
+ Idtr->Base = (UINTN) IdtForAP;
+ Idtr->Limit = IdtrForBSP->Limit;
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/Haswell/CpuInit/Dxe/x64/MpCpu.c b/ReferenceCode/Haswell/CpuInit/Dxe/x64/MpCpu.c
new file mode 100644
index 0000000..806dcc0
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Dxe/x64/MpCpu.c
@@ -0,0 +1,89 @@
+/** @file
+ MP Support functions
+
+@copyright
+ Copyright (c) 2007 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "MpService.h"
+#include EFI_PROTOCOL_DEFINITION (MpService)
+#endif
+
+extern EFI_CPU_MICROCODE_HEADER **mMicrocodePointerBuffer;
+
+ACPI_CPU_DATA *mAcpiCpuData;
+MP_SYSTEM_DATA *mMPSystemData;
+
+///
+/// Function declarations
+///
+/**
+ Initializes MP support in the system.
+
+ @retval EFI_SUCCESS - Multiple processors are initialized successfully.
+ @retval EFI_OUT_OF_RESOURCES - No enough resoruces (such as out of memory).
+**/
+EFI_STATUS
+InitializeMpSupport (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ MP_CPU_RESERVED_DATA *MpCpuReservedData;
+
+ ///
+ /// Allocate memory for MP CPU related data below 4G
+ ///
+ Status = AllocateReservedMemoryBelow4G (
+ sizeof (MP_CPU_RESERVED_DATA),
+ (VOID **) &MpCpuReservedData
+ );
+
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ ZeroMem (MpCpuReservedData, sizeof (MP_CPU_RESERVED_DATA));
+
+ mMPSystemData = &(MpCpuReservedData->MPSystemData);
+ mAcpiCpuData = &(MpCpuReservedData->AcpiCpuData);
+
+ ///
+ /// Copy microcode to allocated memory
+ ///
+ CopyMem (
+ MpCpuReservedData->MicrocodePointerBuffer,
+ mMicrocodePointerBuffer,
+ sizeof (EFI_CPU_MICROCODE_HEADER *) * (NUMBER_OF_MICROCODE_UPDATE + 1)
+ );
+
+ ///
+ /// Initialize ACPI_CPU_DATA data
+ ///
+ mAcpiCpuData->CpuPrivateData = (EFI_PHYSICAL_ADDRESS) (UINTN) (&(mMPSystemData->S3DataPointer));
+ mAcpiCpuData->S3BootPath = FALSE;
+ mAcpiCpuData->MicrocodePointerBuffer = (EFI_PHYSICAL_ADDRESS) MpCpuReservedData->MicrocodePointerBuffer;
+ mAcpiCpuData->GdtrProfile = (EFI_PHYSICAL_ADDRESS) & (MpCpuReservedData->GdtrProfile);
+ mAcpiCpuData->IdtrProfile = (EFI_PHYSICAL_ADDRESS) & (MpCpuReservedData->IdtrProfile);
+
+ ///
+ /// Initialize MP services
+ ///
+ InitializeMpServices ();
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/Haswell/CpuInit/Dxe/x64/MpEqu.inc b/ReferenceCode/Haswell/CpuInit/Dxe/x64/MpEqu.inc
new file mode 100644
index 0000000..f7c97ad
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Dxe/x64/MpEqu.inc
@@ -0,0 +1,51 @@
+;@file
+; @todo ADD DESCRIPTION
+;
+;@copyright
+; Copyright (c) 2005 - 2012 Intel Corporation. All rights reserved
+; This software and associated documentation (if any) is furnished
+; under a license and may only be used or copied in accordance
+; with the terms of the license. Except as permitted by such
+; license, no part of this software or documentation may be
+; reproduced, stored in a retrieval system, or transmitted in any
+; form or by any means without the express written consent of
+; Intel Corporation.
+;
+; This file contains an 'Intel Peripheral Driver' and uniquely
+; identified as "Intel Reference Module" and is
+; licensed for Intel CPUs and chipsets under the terms of your
+; license agreement with Intel or your vendor. This file may
+; be modified by the user, subject to additional terms of the
+; license agreement
+;
+
+VacantFlag Equ 00h
+NotVacantFlag Equ 0ffh
+BreakToRunApSignal Equ 6E755200h
+MonitorFilterSize Equ 40h
+WakeUpApCounterInit Equ 0
+WakeUpApPerHltLoop Equ 1
+WakeUpApPerMwaitLoop Equ 2
+WakeUpApPerRunLoop Equ 3
+WakeUpApPerMwaitLoop32 Equ 4
+WakeUpApPerRunLoop32 Equ 5
+
+LockLocation equ 1000h - 0400h
+StackStartAddressLocation equ LockLocation + 08h
+StackSizeLocation equ LockLocation + 10h
+CProcedureLocation equ LockLocation + 18h
+GdtrLocation equ LockLocation + 20h
+IdtrLocation equ LockLocation + 2Ah
+BufferStartLocation equ LockLocation + 34h
+Cr3OffsetLocation equ LockLocation + 38h
+InitFlagLocation equ LockLocation + 3Ch
+WakeUpApManner equ LockLocation + 40h
+BistBuffer equ LockLocation + 44h
+
+PAUSE32 MACRO
+ DB 0F3h
+ DB 090h
+ ENDM
+
+;-------------------------------------------------------------------------------
+
diff --git a/ReferenceCode/Haswell/CpuInit/Dxe/x64/MpFuncs.asm b/ReferenceCode/Haswell/CpuInit/Dxe/x64/MpFuncs.asm
new file mode 100644
index 0000000..58714f8
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Dxe/x64/MpFuncs.asm
@@ -0,0 +1,618 @@
+;
+; This file contains an 'Intel Peripheral Driver' and is
+; licensed for Intel CPUs and chipsets under the terms of your
+; license agreement with Intel or your vendor. This file may
+; be modified by the user, subject to additional terms of the
+; license agreement
+;
+;-------------------------------------------------------------------------------
+;
+; Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+; This software and associated documentation (if any) is furnished
+; under a license and may only be used or copied in accordance
+; with the terms of the license. Except as permitted by such
+; license, no part of this software or documentation may be
+; reproduced, stored in a retrieval system, or transmitted in any
+; form or by any means without the express written consent of
+; Intel Corporation.
+;
+;
+; Module Name:
+;
+; MpFuncs.asm
+;
+; Abstract:
+;
+; This is the assembly code for EM64T MP support
+;
+;-------------------------------------------------------------------------------
+
+
+include MpEqu.inc
+CpuInitFloatPointUnit PROTO C
+
+;-------------------------------------------------------------------------------------
+
+;-------------------------------------------------------------------------------------
+;RendezvousFunnelProc procedure follows. All APs execute their procedure. This
+;procedure serializes all the AP processors through an Init sequence. It must be
+;noted that APs arrive here very raw...ie: real mode, no stack.
+;ALSO THIS PROCEDURE IS EXECUTED BY APs ONLY ON 16 BIT MODE. HENCE THIS PROC
+;IS IN MACHINE CODE.
+;-------------------------------------------------------------------------------------
+;RendezvousFunnelProc (&WakeUpBuffer,MemAddress);
+
+text SEGMENT
+
+RendezvousFunnelProc PROC PUBLIC
+RendezvousFunnelProcStart::
+
+; At this point CS = 0x(vv00) and ip= 0x0.
+ db 66h, 08bh, 0e8h ; mov ebp, eax
+
+ db 8ch, 0c8h ; mov ax, cs
+ db 8eh, 0d8h ; mov ds, ax
+ db 8eh, 0c0h ; mov es, ax
+ db 8eh, 0d0h ; mov ss, ax
+ db 33h, 0c0h ; xor ax, ax
+ db 8eh, 0e0h ; mov fs, ax
+ db 8eh, 0e8h ; mov gs, ax
+
+; Get APIC ID
+;
+ db 66h, 0B8h
+ dd 00000001h ; mov eax, 1
+ db 0Fh, 0A2h ; cpuid
+ db 66h, 0C1h, 0EBh, 18h ; shr ebx, 24
+ db 66h, 81h, 0E3h
+ dd 000000FFh ; and ebx, 0ffh ; EBX is APIC ID
+
+; If it is the first time AP wakes up, just record AP's BIST
+; Otherwise, switch to protected mode.
+
+ db 0BEh ; opcode of mov si, imm16
+ dw InitFlagLocation ; mov si, InitFlag
+ db 66h, 83h, 3Ch, 00h ; cmp dword ptr [si], 0
+ db 74h ; opcode of jz
+ db flat32Start - ($ + 1) ; jz flat32Start
+
+; Record BIST information
+;
+ db 0B0h, 08h ; mov al, 8
+ db 0F6h, 0E3h ; mul bl
+
+ db 0BEh ; opcode of mov si, imm16
+ dw BistBuffer ; mov si, BistBuffer
+ db 03h, 0F0h ; add si, ax
+
+ db 66h, 0C7h, 04h
+ dd 00000001h ; mov dword ptr [si], 1 ; Set Valid Flag
+ db 66h, 89h, 6Ch, 04h ; mov dword ptr [si + 4], ebp ; Store BIST value
+
+;
+; Switch to flat mode.
+;
+flat32Start::
+
+ db 0BFh ; opcode of mov di, imm16
+ dw BufferStartLocation ; mov di, BufferStartLocation
+ db 66h, 8Bh, 35h ; mov esi,dword ptr [di] ; ESI is keeping the start address of wakeup buffer
+
+ db 0BFh ; opcode of mov di, imm16
+ dw Cr3OffsetLocation ; mov di, Cr3Location
+ db 66h, 8Bh, 0Dh ; mov ecx,dword ptr [di] ; ECX is keeping the value of CR3
+
+ db 0BFh ; opcode of mov di, imm16
+ dw GdtrLocation ; mov di, GdtrProfile
+ db 66h ; db 66h
+ db 2Eh, 0Fh, 01h, 15h ; lgdt fword ptr cs:[di]
+
+ db 0BFh ; opcode of mov di, imm16
+ dw IdtrLocation ; mov di, IdtrProfile
+ db 66h ; db 66h
+ db 2Eh, 0Fh, 01h, 1Dh ; lidt fword ptr cs:[di]
+
+ db 0BFh ; opcode of mov di, imm16
+ dw LongModeStartJump - RendezvousFunnelProcStart ; Get offset of LongModeStartJump
+ db 66h, 8Bh, 3Dh ; mov edi,dword ptr [di] ; EDI is keeping the LongModeStart Jump Address
+
+ db 31h, 0C0h ; xor ax, ax
+ db 8Eh, 0D8h ; mov ds, ax
+
+ db 0Fh, 20h, 0C0h ; mov eax, cr0 ; Get control register 0
+ db 66h, 83h, 0C8h, 03h ; or eax, 000000003h ; Set PE bit (bit #0) and MP
+ db 0Fh, 22h, 0C0h ; mov cr0, eax
+
+FLAT32_JUMP::
+
+ db 66h, 67h, 0EAh ; far jump
+ dd 0h ; 32-bit offset
+ dw 20h ; 16-bit selector
+
+NemInit:: ; 32-bits protected mode entry point
+
+ db 66h, 0B8h, 18h, 00h ; mov ax, 18h
+ db 66h, 8Eh, 0D8h ; mov ds, ax
+ db 66h, 8Eh, 0C0h ; mov es, ax
+ db 66h, 8Eh, 0E0h ; mov fs, ax
+ db 66h, 8Eh, 0E8h ; mov gs, ax
+ db 66h, 8Eh, 0D0h ; mov ss, ax ; Flat mode setup.
+
+
+PrepareToGoLongMode64::
+
+ db 0Fh, 20h, 0E0h ; mov eax, cr4
+ db 66h, 0Dh, 020h, 06h ; or ax, 0620h ; Set PAE=1, OSFXSR=1, OSXMMEXCPT=1.
+ db 0Fh, 22h, 0E0h ; mov cr4, eax
+
+ db 0Fh, 22h, 0D9h ; mov cr3, ecx
+
+ db 0B9h
+ dd 0C0000080h ; mov ecx, 0c0000080h ; EFER MSR number.
+ db 0Fh, 32h ; rdmsr ; Read EFER.
+ db 0Fh, 0BAh, 0E8h, 08h ; bts eax, 8 ; Set LME=1.
+ db 0Fh, 30h ; wrmsr ; Write EFER.
+
+ db 0Fh, 20h, 0C0h ; mov eax, cr0 ; Read CR0.
+ db 0Fh, 0BAh, 0E8h, 1Fh ; bts eax, 31 ; Set PG=1.
+ db 0Fh, 22h, 0C0h ; mov cr0, eax ; Write CR0.
+
+LONG_JUMP::
+
+ db 67h, 0EAh ; far jump
+
+LongModeStartJump:
+
+ dd 0h ; 32-bit offset
+ dw 38h ; 16-bit selector
+
+
+LongModeStart::
+
+ mov ax, 30h
+ mov ds, ax
+ mov es, ax
+ mov ss, ax
+
+WaitFirstApTaskAssigned::
+;
+; First INIT-SIPI-SIPI will loop here until DetailedMpInitialization function assigned for each AP
+;
+ pause
+ cmp qword ptr [esi+CProcedureLocation], 0
+ jz WaitFirstApTaskAssigned
+
+;
+; Patch Addresses for jumping between RUN and MONITOR MWAIT loops 32-bits and Long Monde Procedure 64-bits
+; Based on the running address of LongModeStart in physic memory which was actually copied by CPU DXE INIT
+;
+ xor rdx, rdx
+ mov eax, edi
+ add eax, RunLoopAndMwaitLoop32 - LongModeStart
+ mov edx, edi
+ add edx, RunLoopAndMwaitLoop32Jump - LongModeStart
+ mov dword ptr [rdx], eax
+
+ mov rbp, rdx ; RBP = 32-bits compatibility mode FAR JUMP m16:32 operand pointer
+
+ mov eax, edi
+ add eax, RunLoopAndMwaitLoop64 - LongModeStart
+ mov edx, edi
+ add edx, RunLoopAndMwaitLoop64Jump - LongModeStart
+ mov dword ptr [rdx], eax
+
+;
+; ProgramStack
+;
+ xor rcx, rcx
+ mov edi, esi
+ add edi, BistBuffer
+ mov ecx, dword ptr [edi + 8 * ebx] ; RCX = CpuNumber
+
+ mov edi, esi
+ add edi, StackSizeLocation
+ mov rax, qword ptr [edi]
+ inc rcx
+ mul rcx ; RAX = StackSize * (CpuNumber + 1)
+
+ mov edi, esi
+ add edi, StackStartAddressLocation
+ mov rdx, qword ptr [edi]
+ add rax, rdx ; RAX = StackStart + StackSize * (CpuNumber + 1)
+
+ mov rsp, rax
+ sub rsp, MonitorFilterSize ; Reserved Monitor data space
+ or ebx, BreakToRunApSignal ; ebx = #Cpu run signature
+
+;
+; Call assembly function to initialize FPU.
+;
+ mov rax, CpuInitFloatPointUnit
+ sub rsp, 20h
+ call rax
+ add rsp, 20h
+
+;
+; Load C Function pointer and wakeup manner location
+;
+ mov edi, esi
+ add edi, CProcedureLocation
+ add esi, WakeUpApManner ; esi = WakeUpApManner Address Location
+
+WakeUpThisAp64::
+
+ mov rax, qword ptr [edi]
+
+ test rax, rax
+ jz CheckWakeUpCounterInit64
+
+ push rbp
+ push rbx
+ push rsi
+ push rdi
+
+ sub rsp, 20h
+ call rax
+ add rsp, 20h
+
+ pop rdi
+ pop rsi
+ pop rbx
+ pop rbp
+
+CheckWakeUpCounterInit64::
+
+ cmp dword ptr [esi], WakeUpApCounterInit
+ jnz CheckWakeUpManner64
+
+;
+; Initialize MONITOR_MWAIT_DATA data structure per thread
+;
+ xor rcx, rcx
+ mov qword ptr [rsp + 0], rcx ; BreakToRunApSignal
+ mov qword ptr [rsp + 8], rcx ; HltLoopBreakCounter
+ mov qword ptr [rsp + 16], rcx ; MwaitLoopBreakCounter
+ mov qword ptr [rsp + 24], rcx ; RunLoopBreakCounter
+ mov qword ptr [rsp + 32], rcx ; MwaitLoopBreakCounter32
+ mov qword ptr [rsp + 40], rcx ; RunLoopBreakCounter32
+ mov qword ptr [rsp + 48], rcx ; WakeUpApVectorChangeFlag
+ mov qword ptr [rsp + 56], rcx ; MwaitTargetCstate
+
+WaitWakeUpMannerAssigned::
+
+ pause
+ cmp dword ptr [esi], WakeUpApCounterInit
+ jz WaitWakeUpMannerAssigned
+
+CheckWakeUpManner64::
+
+ pause
+ mov edx, dword ptr [esi]
+ cmp edx, WakeUpApPerHltLoop
+ jz HltApLoop64
+
+ cmp edx, WakeUpApPerMwaitLoop
+ jz ApMwaitLoop64
+
+ cmp edx, WakeUpApPerRunLoop
+ jz CheckRunSignal64
+
+ jmp JumpToCompatibility32Mode
+
+ApMwaitLoop64::
+
+ cli
+ mov rax, rsp ; Set Monitor Address
+ xor rcx, rcx
+ xor rdx, rdx
+ DB 0fh, 1, 0c8h ; MONITOR
+ mov rax, qword ptr [rsp + 56] ; Mwait Target C-State per rax[7:4]
+ DB 0fh, 1, 0c9h ; MWAIT
+
+CheckRunSignal64::
+
+ cmp qword ptr [rsp], rbx ; Check if run signal correct?
+ jnz CheckWakeUpManner64 ; Unknown break, go checking run manner
+
+ jmp WakeUpThisAp64 ; Jmp to execute AP task
+
+HltApLoop64::
+
+ cli
+ hlt
+ jmp HltApLoop64 ; Jump to halt loop
+
+
+JumpToCompatibility32Mode::
+
+ db 0FFh, 6Dh, 0 ; jmp pword ptr [rbp+0] ; Far jump to m16:32 for 32-bits compatibility mode
+
+RunLoopAndMwaitLoop32Jump:
+
+ dd 0h ; m32 part of m16:32
+ dw 20h ; m16 part of m16:32
+
+RunLoopAndMwaitLoop32::
+
+ db 66h, 0B8h, 18h, 00h ; mov ax, 18h
+ db 66h, 8Eh, 0D8h ; mov ds, ax
+ db 8eh, 0d0h ; mov ss, ax
+
+ db 0Fh, 20h, 0C0h ; mov eax, cr0 ; Read CR0.
+ db 0Fh, 0BAh, 0F0h, 1Fh ; btr eax, 31 ; Reset PG=0.
+ db 0Fh, 22h, 0C0h ; mov cr0, eax ; Write CR0.
+
+ db 0B9h
+ dd 0C0000080h ; mov ecx, 0c0000080h ; EFER MSR number.
+ db 0Fh, 32h ; rdmsr ; Read EFER.
+ db 0Fh, 0BAh, 0F0h, 08h ; btr eax, 8 ; Reset LME=0.
+ db 0Fh, 30h ; wrmsr ; Write EFER.
+
+ db 0Fh, 20h, 0E0h ; mov eax, cr4
+ db 24h, 0DFh ; and al, 0DFh ; Reset PAE=0 in CR4 bit 5
+ db 0Fh, 22h, 0E0h ; mov cr4, eax
+
+CheckWakeUpManner32::
+
+ pause
+ cmp dword ptr [rsi], WakeUpApPerMwaitLoop32 ; Use rsi for esi per compling in 64-bits mode
+ jnz CheckRunSignal32
+
+ cli
+ mov eax, esp ; Set Monitor Address
+ xor ecx, ecx
+ xor edx, edx
+ DB 0fh, 1, 0c8h ; MONITOR
+ mov eax, dword ptr [rsp + 56] ; Mwait Target C-State per eax[7:4]
+ DB 0fh, 1, 0c9h ; MWAIT
+
+
+CheckRunSignal32::
+
+ cmp dword ptr [rsp], ebx ; Check if run signal correct?
+ jnz CheckWakeUpManner32 ; Unknown break, go checking run manner
+
+ db 0Fh, 20h, 0E0h ; mov eax, cr4
+ db 0Ch, 20h ; or al, 20h ; Set PAE=1 in CR4 bit 5
+ db 0Fh, 22h, 0E0h ; mov cr4, eax
+
+ db 0B9h
+ dd 0C0000080h ; mov ecx, 0c0000080h ; EFER MSR number.
+ db 0Fh, 32h ; rdmsr ; Read EFER.
+ db 0Fh, 0BAh, 0E8h, 08h ; bts eax, 8 ; Set LME=1.
+ db 0Fh, 30h ; wrmsr ; Write EFER.
+
+ db 0Fh, 20h, 0C0h ; mov eax, cr0 ; Read CR0.
+ db 0Fh, 0BAh, 0E8h, 1Fh ; bts eax, 31 ; Set PG=1.
+ db 0Fh, 22h, 0C0h ; mov cr0, eax ; Write CR0.
+
+ db 67h, 0EAh ; far jump back to 64-bits long mode
+
+RunLoopAndMwaitLoop64Jump:
+
+ dd 0h ; 32-bit offset
+ dw 38h ; 16-bit selector
+
+RunLoopAndMwaitLoop64::
+
+ mov ax, 30h
+ mov ds, ax
+ mov ss, ax
+
+ jmp WakeUpThisAp64
+
+RendezvousFunnelProc ENDP
+RendezvousFunnelProcEnd::
+
+
+;-------------------------------------------------------------------------------------
+; AsmGetAddressMap (&AddressMap);
+;-------------------------------------------------------------------------------------
+AsmGetAddressMap PROC PUBLIC
+
+ mov rax, offset RendezvousFunnelProcStart
+ mov qword ptr [rcx], rax
+ mov qword ptr [rcx+8h], NemInit - RendezvousFunnelProcStart
+ mov qword ptr [rcx+10h], FLAT32_JUMP - RendezvousFunnelProcStart
+ mov qword ptr [rcx+18h], LongModeStart - RendezvousFunnelProcStart
+ mov qword ptr [rcx+20h], LONG_JUMP - RendezvousFunnelProcStart
+ mov qword ptr [rcx+28h], RendezvousFunnelProcEnd - RendezvousFunnelProcStart
+
+ ret
+
+AsmGetAddressMap ENDP
+
+AsmGetGdtrIdtr PROC PUBLIC
+
+ sgdt GdtDesc
+ lea rax, GdtDesc
+ mov [rcx], rax
+
+ sidt IdtDesc
+ lea rax, IdtDesc
+ mov [rdx], rax
+
+ ret
+
+AsmGetGdtrIdtr ENDP
+
+AsmAcquireMPLock PROC PUBLIC
+
+ mov al, NotVacantFlag
+TryGetLock:
+ xchg al, byte ptr [rcx]
+ cmp al, VacantFlag
+ jz LockObtained
+
+ pause
+ jmp TryGetLock
+
+LockObtained:
+ ret
+
+AsmAcquireMPLock ENDP
+
+AsmReleaseMPLock PROC PUBLIC
+
+ mov al, VacantFlag
+ xchg al, byte ptr [rcx]
+
+ ret
+
+AsmReleaseMPLock ENDP
+
+;-------------------------------------------------------------------------------------
+;AsmExchangeRole procedure follows. This procedure executed by current BSP, that is
+;about to become an AP. It switches it'stack with the current AP.
+;AsmExchangeRole (IN CPU_EXCHANGE_INFO *MyInfo, IN CPU_EXCHANGE_INFO *OthersInfo);
+;-------------------------------------------------------------------------------------
+CPU_SWITCH_STATE_IDLE equ 0
+CPU_SWITCH_STATE_STORED equ 1
+CPU_SWITCH_STATE_LOADED equ 2
+
+AsmExchangeRole PROC PUBLIC
+ ; DO NOT call other functions in this function, since 2 CPU may use 1 stack
+ ; at the same time. If 1 CPU try to call a functiosn, stack will be corrupted.
+
+ push rax
+ push rbx
+ push rcx
+ push rdx
+ push rsi
+ push rdi
+ push rbp
+ push r8
+ push r9
+ push r10
+ push r11
+ push r12
+ push r13
+ push r14
+ push r15
+
+ mov rax, cr0
+ push rax
+
+ mov rax, cr4
+ push rax
+
+ ; rsi contains MyInfo pointer
+ mov rsi, rcx
+
+ ; rdi contains OthersInfo pointer
+ mov rdi, rdx
+
+ ;Store EFLAGS, GDTR and IDTR regiter to stack
+ pushfq
+ sgdt fword ptr [rsi + 16]
+ sidt fword ptr [rsi + 26]
+
+ ; Store the its StackPointer
+ mov qword ptr [rsi + 8], rsp
+
+ ; update its switch state to STORED
+ mov al, NotVacantFlag
+TryLock1:
+ lock xchg al, byte ptr [rsi]
+ cmp al, VacantFlag
+ jz LockObtained1
+ pause
+ jmp TryLock1
+
+LockObtained1:
+ mov byte ptr [rsi + 1], CPU_SWITCH_STATE_STORED
+ lock xchg al, byte ptr [rsi]
+
+WaitForOtherStored::
+ ; wait until the other CPU finish storing its state
+ mov al, NotVacantFlag
+TryLock2:
+ lock xchg al, byte ptr [rdi]
+ cmp al, VacantFlag
+ jz LockObtained2
+ PAUSE32
+ jmp TryLock2
+
+LockObtained2:
+ mov bl, byte ptr [rdi + 1]
+ lock xchg al, byte ptr [rdi]
+ cmp bl, CPU_SWITCH_STATE_STORED
+ jb WaitForOtherStored
+
+ ; Since another CPU already stored its state, load them
+ ; load GDTR value
+ lgdt fword ptr [rdi + 16]
+
+ ; load IDTR value
+ lidt fword ptr [rdi + 26]
+
+ ; load its future StackPointer
+ mov rsp, qword ptr [rdi + 8]
+
+ ; update its switch state to LOADED
+ mov al, NotVacantFlag
+TryLock3:
+ lock xchg al, byte ptr [rsi]
+ cmp al, VacantFlag
+ jz LockObtained3
+ PAUSE32
+ jmp TryLock3
+
+LockObtained3:
+ mov byte ptr [rsi+1], CPU_SWITCH_STATE_LOADED
+ lock xchg al, byte ptr [rsi]
+
+WaitForOtherLoaded::
+ ; wait until the other CPU finish loading new state,
+ ; otherwise the data in stack may corrupt
+ mov al, NotVacantFlag
+TryLock4:
+ lock xchg al, byte ptr [rdi]
+ cmp al, VacantFlag
+ jz LockObtained4
+ PAUSE32
+ jmp TryLock4
+
+LockObtained4:
+ mov bl, byte ptr [rdi+1]
+ lock xchg al, byte ptr [rdi]
+ cmp bl, CPU_SWITCH_STATE_LOADED
+ jb WaitForOtherLoaded
+
+ ; since the other CPU already get the data it want, leave this procedure
+ popfq
+
+ pop rax
+ mov cr4, rax
+
+ pop rax
+ mov cr0, rax
+
+ pop r15
+ pop r14
+ pop r13
+ pop r12
+ pop r11
+ pop r10
+ pop r9
+ pop r8
+ pop rbp
+ pop rdi
+ pop rsi
+ pop rdx
+ pop rcx
+ pop rbx
+ pop rax
+
+ ret
+AsmExchangeRole ENDP
+
+GdtDesc QWORD 0
+ WORD 0
+
+IdtDesc QWORD 0
+ WORD 0
+
+text ENDS
+
+END
diff --git a/ReferenceCode/Haswell/CpuInit/Dxe/x64/ProcessorDef.h b/ReferenceCode/Haswell/CpuInit/Dxe/x64/ProcessorDef.h
new file mode 100644
index 0000000..28e55d7
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Dxe/x64/ProcessorDef.h
@@ -0,0 +1,57 @@
+/** @file
+ Definition for EM64T processor
+
+@copyright
+ Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PROCESSOR_DEF_H
+#define _PROCESSOR_DEF_H
+
+#pragma pack(1)
+
+typedef struct {
+ UINT16 Offset15To0;
+ UINT16 SegmentSelector;
+ UINT16 Attributes;
+ UINT16 Offset31To16;
+ UINT32 Offset63To32;
+ UINT32 Reserved;
+} INTERRUPT_GATE_DESCRIPTOR;
+
+#pragma pack()
+
+typedef struct {
+ UINT8 *RendezvousFunnelAddress;
+ UINTN PModeEntryOffset;
+ UINTN FlatJumpOffset;
+ UINTN LModeEntryOffset;
+ UINTN LongJumpOffset;
+ UINTN Size;
+} MP_ASSEMBLY_ADDRESS_MAP;
+
+VOID
+AsmGetAddressMap (
+ OUT MP_ASSEMBLY_ADDRESS_MAP *AddressMap
+ )
+/**
+@brief
+ Get address map of RendezvousFunnelProc.
+
+ @param[in] AddressMap - Output buffer for address map information
+**/
+;
+
+#endif
diff --git a/ReferenceCode/Haswell/CpuInit/Dxe/x64/VirtualMemory.h b/ReferenceCode/Haswell/CpuInit/Dxe/x64/VirtualMemory.h
new file mode 100644
index 0000000..f9bcc82
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Dxe/x64/VirtualMemory.h
@@ -0,0 +1,145 @@
+/** @file
+
+@brief:
+
+ x64 Long Mode Virtual Memory Management Definitions
+
+ References:
+ 1) IA-32 Intel(R) Atchitecture Software Developer's Manual Volume 1:Basic Architecture, Intel
+ 2) IA-32 Intel(R) Atchitecture Software Developer's Manual Volume 2:Instruction Set Reference, Intel
+ 3) IA-32 Intel(R) Atchitecture Software Developer's Manual Volume 3:System Programmer's Guide, Intel
+ 4) AMD64 Architecture Programmer's Manual Volume 2: System Programming
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _VIRTUAL_MEMORY_H_
+#define _VIRTUAL_MEMORY_H_
+
+#pragma pack(1)
+///
+/// Page-Map Level-4 Offset (PML4) and
+///Page-Directory-Pointer Offset (PDPE) entries 4K & 2MB
+///
+typedef union {
+ struct {
+ UINT64 Present : 1; /// 0 = Not present in memory, 1 = Present in memory
+ UINT64 ReadWrite : 1; /// 0 = Read-Only, 1= Read/Write
+ UINT64 UserSupervisor : 1; /// 0 = Supervisor, 1=User
+ UINT64 WriteThrough : 1; /// 0 = Write-Back caching, 1=Write-Through caching
+ UINT64 CacheDisabled : 1; /// 0 = Cached, 1=Non-Cached
+ UINT64 Accessed : 1; /// 0 = Not accessed, 1 = Accessed (set by CPU)
+ UINT64 Reserved : 1; /// Reserved
+ UINT64 MustBeZero : 2; /// Must Be Zero
+ UINT64 Available : 3; /// Available for use by system software
+ UINT64 PageTableBaseAddress : 40; /// Page Table Base Address
+ UINT64 AvabilableHigh : 11; /// Available for use by system software
+ UINT64 Nx : 1; /// No Execute bit
+ } Bits;
+ UINT64 Uint64;
+} x64_PAGE_MAP_AND_DIRECTORY_POINTER_2MB_4K;
+
+///
+/// Page-Directory Offset 4K
+///
+typedef union {
+ struct {
+ UINT64 Present : 1; /// 0 = Not present in memory, 1 = Present in memory
+ UINT64 ReadWrite : 1; /// 0 = Read-Only, 1= Read/Write
+ UINT64 UserSupervisor : 1; /// 0 = Supervisor, 1=User
+ UINT64 WriteThrough : 1; /// 0 = Write-Back caching, 1=Write-Through caching
+ UINT64 CacheDisabled : 1; /// 0 = Cached, 1=Non-Cached
+ UINT64 Accessed : 1; /// 0 = Not accessed, 1 = Accessed (set by CPU)
+ UINT64 Reserved : 1; /// Reserved
+ UINT64 MustBeZero : 1; /// Must Be Zero
+ UINT64 Reserved2 : 1; /// Reserved
+ UINT64 Available : 3; /// Available for use by system software
+ UINT64 PageTableBaseAddress : 40; /// Page Table Base Address
+ UINT64 AvabilableHigh : 11; /// Available for use by system software
+ UINT64 Nx : 1; /// No Execute bit
+ } Bits;
+ UINT64 Uint64;
+} x64_PAGE_DIRECTORY_ENTRY_4K;
+
+///
+/// Page Table Entry 4K
+///
+typedef union {
+ struct {
+ UINT64 Present : 1; /// 0 = Not present in memory, 1 = Present in memory
+ UINT64 ReadWrite : 1; /// 0 = Read-Only, 1= Read/Write
+ UINT64 UserSupervisor : 1; /// 0 = Supervisor, 1=User
+ UINT64 WriteThrough : 1; /// 0 = Write-Back caching, 1=Write-Through caching
+ UINT64 CacheDisabled : 1; /// 0 = Cached, 1=Non-Cached
+ UINT64 Accessed : 1; /// 0 = Not accessed, 1 = Accessed (set by CPU)
+ UINT64 Dirty : 1; /// 0 = Not Dirty, 1 = written by processor on access to page
+ UINT64 PAT : 1; /// 0 = Ignore Page Attribute Table
+ UINT64 Global : 1; /// 0 = Not global page, 1 = global page TLB not cleared on CR3 write
+ UINT64 Available : 3; /// Available for use by system software
+ UINT64 PageTableBaseAddress : 40; /// Page Table Base Address
+ UINT64 AvabilableHigh : 11; /// Available for use by system software
+ UINT64 Nx : 1; /// 0 = Execute Code, 1 = No Code Execution
+ } Bits;
+ UINT64 Uint64;
+} x64_PAGE_TABLE_ENTRY_4K;
+
+///
+/// Page Table Entry 2MB
+///
+typedef union {
+ struct {
+ UINT64 Present : 1; /// 0 = Not present in memory, 1 = Present in memory
+ UINT64 ReadWrite : 1; /// 0 = Read-Only, 1= Read/Write
+ UINT64 UserSupervisor : 1; /// 0 = Supervisor, 1=User
+ UINT64 WriteThrough : 1; /// 0 = Write-Back caching, 1=Write-Through caching
+ UINT64 CacheDisabled : 1; /// 0 = Cached, 1=Non-Cached
+ UINT64 Accessed : 1; /// 0 = Not accessed, 1 = Accessed (set by CPU)
+ UINT64 Dirty : 1; /// 0 = Not Dirty, 1 = written by processor on access to page
+ UINT64 MustBe1 : 1; /// Must be 1
+ UINT64 Global : 1; /// 0 = Not global page, 1 = global page TLB not cleared on CR3 write
+ UINT64 Available : 3; /// Available for use by system software
+ UINT64 PAT : 1; ///
+ UINT64 MustBeZero : 8; /// Must be zero;
+ UINT64 PageTableBaseAddress : 31; /// Page Table Base Address
+ UINT64 AvabilableHigh : 11; /// Available for use by system software
+ UINT64 Nx : 1; /// 0 = Execute Code, 1 = No Code Execution
+ } Bits;
+ UINT64 Uint64;
+} x64_PAGE_TABLE_ENTRY_2M;
+
+typedef union {
+ UINT64 Present : 1; /// 0 = Not present in memory, 1 = Present in memory
+ UINT64 ReadWrite : 1; /// 0 = Read-Only, 1= Read/Write
+ UINT64 UserSupervisor : 1; /// 0 = Supervisor, 1=User
+ UINT64 WriteThrough : 1; /// 0 = Write-Back caching, 1=Write-Through caching
+ UINT64 CacheDisabled : 1; /// 0 = Cached, 1=Non-Cached
+ UINT64 Accessed : 1; /// 0 = Not accessed, 1 = Accessed (set by CPU)
+ UINT64 Dirty : 1; /// 0 = Not Dirty, 1 = written by processor on access to page
+ UINT64 Reserved : 57;
+} x64_PAGE_TABLE_ENTRY_COMMON;
+
+typedef union {
+ x64_PAGE_TABLE_ENTRY_4K Page4k;
+ x64_PAGE_TABLE_ENTRY_2M Page2Mb;
+ x64_PAGE_TABLE_ENTRY_COMMON Common;
+} x64_PAGE_TABLE_ENTRY;
+
+///
+/// BugBug: x64 New stuff
+///
+#pragma pack()
+
+#endif
diff --git a/ReferenceCode/Haswell/CpuInit/Pei/BootGuardInit.c b/ReferenceCode/Haswell/CpuInit/Pei/BootGuardInit.c
new file mode 100644
index 0000000..f877784
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Pei/BootGuardInit.c
@@ -0,0 +1,111 @@
+/** @file
+ EFI 2.0 PEIM to initialize the cache and load the BSP microcode
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Pre-EFI Module' and is licensed
+ for Intel CPUs and Chipsets under the terms of your license
+ agreement with Intel or your vendor. This file may be
+ modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+///
+/// External include files do NOT need to be explicitly specified in real EDKII
+/// environment
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#include "CpuInitPeim.h"
+#include "CpuAccess.h"
+#include "BootGuardLibrary.h"
+#include "MeAccess.h"
+#include "HeciRegs.h"
+#endif
+
+VOID
+BootGuardInit (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_CPU_PLATFORM_POLICY_PPI *CpuPlatformPolicyPpi
+ )
+/**
+
+ Perform the platform spefific initializations.
+
+ @param[in] PeiServices - Indirect reference to the PEI Services Table.
+ @param[in] CpuPlatformPolicyPpi - Platform Policy PPI
+
+**/
+{
+ UINT32 MsrValue;
+ UINT32 MeFwSts4;
+ UINT32 BootGuardAcmStatus;
+
+ if (CpuPlatformPolicyPpi->SecurityConfig->BootGuardConfig == NULL) {
+ return;
+ }
+
+ ///
+ /// Check if System Supports Boot Guard
+ ///
+ if( IsBootGuardSupported() ) {
+ CpuPlatformPolicyPpi->SecurityConfig->BootGuardConfig->BootGuardSupport = TRUE;
+
+ BootGuardAcmStatus = *(UINT32 *) (UINTN) (TXT_PUBLIC_BASE + R_CPU_BOOT_GUARD_ACM_STATUS);
+ DEBUG ((EFI_D_INFO, "Boot Guard ACM Status = %x\n", BootGuardAcmStatus));
+
+ ///
+ /// Check Bit 12 in ME FWSTS4 to check if TPM_DISCONNECT_ALL bit is set
+ /// or ENF Shutdown path is taken by ME FW.
+ /// Also Identify any failures in ACM
+ ///
+ MeFwSts4 = HeciPciRead32(R_ME_HFS_4);
+ DEBUG ((EFI_D_INFO, "ME FW STS 4 = %x\n", MeFwSts4));
+ if((MeFwSts4 & (B_TPM_DISCONNECT | B_BOOT_GUARD_ENF_MASK)) || (BootGuardAcmStatus & B_BOOT_GUARD_ACM_ERRORCODE_MASK)) {
+ DEBUG ((EFI_D_INFO, "All TPM's on Platform are Disconnected\n"));
+ CpuPlatformPolicyPpi->SecurityConfig->BootGuardConfig->DisconnectAllTpms = TRUE;
+ }
+ CpuPlatformPolicyPpi->SecurityConfig->BootGuardConfig->BypassTpmInit = FALSE;
+ CpuPlatformPolicyPpi->SecurityConfig->BootGuardConfig->MeasuredBoot = FALSE;
+
+ if(MeFwSts4 & BIT10) {
+ DEBUG ((EFI_D_INFO, "Sx Resume Type Identified - TPM Event Log not required for ACM Measurements\n"));
+ CpuPlatformPolicyPpi->SecurityConfig->BootGuardConfig->ByPassTpmEventLog = TRUE;
+ }
+ ///
+ /// Check bit 0 of BOOT_GUARD_SACM_INFO MSR if system is in Boot Guard boot mode
+ ///
+ MsrValue = (UINT32) AsmReadMsr64 (MSR_BOOT_GUARD_SACM_INFO);
+ DEBUG ((EFI_D_INFO, "MSR_BOOT_GUARD_SACM_INFO MSR = %x\n", MsrValue));
+ if ( (MsrValue & B_NEM_INIT) == 0 ) {
+ DEBUG ((EFI_D_INFO, "NEM is not initiated by Boot Guard ACM\n"));
+ }
+ if (MsrValue & B_MEASURED) {
+ CpuPlatformPolicyPpi->SecurityConfig->BootGuardConfig->MeasuredBoot = TRUE;
+ ///
+ /// if measured bit is set, BIOS needs to bypass startup command
+ ///
+ if (MsrValue & B_TPM_SUCCESS) {
+ CpuPlatformPolicyPpi->SecurityConfig->BootGuardConfig->BypassTpmInit = TRUE;
+ }
+ ///
+ /// Read present TPM type
+ ///
+ CpuPlatformPolicyPpi->SecurityConfig->BootGuardConfig->TpmType = (TPM_TYPE) ( (MsrValue & V_TPM_PRESENT_MASK) >> 1 );
+ DEBUG ((EFI_D_INFO, "TPM Type is %x\n", CpuPlatformPolicyPpi->SecurityConfig->BootGuardConfig->TpmType));
+ }
+ } else {
+ CpuPlatformPolicyPpi->SecurityConfig->BootGuardConfig->BootGuardSupport = FALSE;
+ }
+
+ return;
+}
diff --git a/ReferenceCode/Haswell/CpuInit/Pei/CachePeim.c b/ReferenceCode/Haswell/CpuInit/Pei/CachePeim.c
new file mode 100644
index 0000000..959c58e
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Pei/CachePeim.c
@@ -0,0 +1,1045 @@
+/** @file
+ EFI 2.0 PEIM to initialize the cache and load the BSP microcode
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Pre-EFI Module' and is licensed
+ for Intel CPUs and Chipsets under the terms of your license
+ agreement with Intel or your vendor. This file may be
+ modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#include "CpuAccess.h"
+#include "CpuInitPeim.h"
+#include EFI_PPI_PRODUCER (Cache)
+#define ALIGNED_SEED 0x01010101
+#endif
+
+INT8
+CheckDirection (
+ IN UINT64 Input
+ );
+
+UINT64
+PeiPower2MaxMemory (
+ IN UINT64 MemoryLength
+ );
+
+VOID
+EfiDisableCacheMtrr (
+ IN UINT64 *OldMtrr
+ );
+
+VOID
+EfiRecoverCacheMtrr (
+ IN BOOLEAN EnableMtrr,
+ IN UINT64 OldMtrr
+ );
+
+VOID
+EfiProgramMtrr (
+ IN PEI_CACHE_PPI *This,
+ IN UINTN MtrrNumber,
+ IN EFI_PHYSICAL_ADDRESS MemoryAddress,
+ IN UINT64 MemoryLength,
+ IN EFI_MEMORY_CACHE_TYPE MemoryCacheType,
+ IN UINT64 ValidMtrrAddressMask
+ );
+
+EFI_STATUS
+EFIAPI
+PeiResetCacheAttributes (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_CACHE_PPI *This
+ );
+
+EFI_STATUS
+EFIAPI
+PeiActivateCache (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_CACHE_PPI *This
+ );
+
+EFI_STATUS
+EFIAPI
+PeiSetCacheAttributes (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_CACHE_PPI *This,
+ IN EFI_PHYSICAL_ADDRESS MemoryAddress,
+ IN UINT64 MemoryLength,
+ IN EFI_MEMORY_CACHE_TYPE MemoryCacheType
+ );
+
+EFI_STATUS
+SearchForExactMtrr (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_CACHE_PPI *This,
+ IN EFI_PHYSICAL_ADDRESS MemoryAddress,
+ IN UINT64 MemoryLength,
+ IN UINT64 ValidMtrrAddressMask,
+ OUT UINT32 *UsedMsrNum,
+ OUT EFI_MEMORY_CACHE_TYPE *MemoryCacheType
+ );
+
+BOOLEAN
+IsDefaultType (
+ IN EFI_MEMORY_CACHE_TYPE MemoryCacheType
+ );
+
+EFI_STATUS
+DisableCacheAsRam (
+ VOID
+ );
+
+typedef struct _ALIGNED_DWORD {
+ UINT32 High;
+ UINT32 Low;
+} ALIGNED_DWORD;
+
+typedef union _ALIGNED {
+ UINT64 AlignedQword;
+ ALIGNED_DWORD AlignedDword;
+} ALIGNED;
+
+typedef struct {
+ UINT32 Msr;
+ UINT32 BaseAddress;
+ UINT32 Length;
+} FIXED_MTRR;
+
+FIXED_MTRR mFixedMtrrTable[] = {
+ {
+ IA32_MTRR_FIX64K_00000,
+ 0,
+ 0x10000
+ },
+ {
+ IA32_MTRR_FIX16K_80000,
+ 0x80000,
+ 0x4000
+ },
+ {
+ IA32_MTRR_FIX16K_A0000,
+ 0xA0000,
+ 0x4000
+ },
+ {
+ IA32_MTRR_FIX4K_C0000,
+ 0xC0000,
+ 0x1000
+ },
+ {
+ IA32_MTRR_FIX4K_C8000,
+ 0xC8000,
+ 0x1000
+ },
+ {
+ IA32_MTRR_FIX4K_D0000,
+ 0xD0000,
+ 0x1000
+ },
+ {
+ IA32_MTRR_FIX4K_D8000,
+ 0xD8000,
+ 0x1000
+ },
+ {
+ IA32_MTRR_FIX4K_E0000,
+ 0xE0000,
+ 0x1000
+ },
+ {
+ IA32_MTRR_FIX4K_E8000,
+ 0xE8000,
+ 0x1000
+ },
+ {
+ IA32_MTRR_FIX4K_F0000,
+ 0xF0000,
+ 0x1000
+ },
+ {
+ IA32_MTRR_FIX4K_F8000,
+ 0xF8000,
+ 0x1000
+ },
+ {
+ 0,
+ 0x100000,
+ 0
+ }
+};
+
+PEI_CACHE_PPI mCachePpi = {
+ PeiSetCacheAttributes,
+ PeiResetCacheAttributes,
+ PeiActivateCache
+};
+
+/**
+ Update MTRR setting to memory buffer
+
+ @param[in] This - Current instance of Pei Cache PPI.
+ @param[in] MsrNum - offset 0-10 maps to Fixed MTRR table
+ offset above 0x200 maps to Variable MTRR table
+ @param[in] UpdateValue - MTRR setting
+ **/
+VOID
+WriteMsrToBuffer (
+ IN PEI_CACHE_PPI *This,
+ IN UINT32 MsrNum,
+ IN UINT64 UpdateValue
+ )
+{
+ CACHE_PPI_INSTANCE *CachePpiInstance;
+ CachePpiInstance = PEI_CACHE_PPI_INSTANCE_FROM_THIS (This);
+ if (MsrNum >= CACHE_VARIABLE_MTRR_BASE) {
+ if ((MsrNum - CACHE_VARIABLE_MTRR_BASE) >= V_MAXIMUM_VARIABLE_MTRR_NUMBER * 2) {
+ ASSERT (FALSE);
+ return;
+ }
+
+ CachePpiInstance->VariableMtrrChanged = TRUE;
+ CachePpiInstance->VariableMtrrValue[MsrNum - CACHE_VARIABLE_MTRR_BASE].Changed = TRUE;
+ CachePpiInstance->VariableMtrrValue[MsrNum - CACHE_VARIABLE_MTRR_BASE].MsrValue = UpdateValue;
+ } else {
+ if (MsrNum >= V_FIXED_MTRR_NUMBER) {
+ ASSERT (FALSE);
+ return;
+ }
+
+ CachePpiInstance->FixedMtrrChanged = TRUE;
+ CachePpiInstance->FixedMtrrValue[MsrNum].Changed = TRUE;
+ CachePpiInstance->FixedMtrrValue[MsrNum].MsrValue = UpdateValue;
+ }
+}
+
+/**
+ Read MTRR from Buffer. If buffer not ready, read from real MSR instead.
+
+ @param[in] This - Current instance of Pei Cache PPI.
+ @param[in] MsrNum - offset 0-10 maps to Fixed MTRR table
+ offset above 0x200 maps to Variable MTRR table
+
+ @retval Return MTRR setting
+ **/
+UINT64
+ReadMsrFromBuffer (
+ IN PEI_CACHE_PPI *This,
+ IN UINT32 MsrNum
+ )
+{
+ UINT64 MtrrVal;
+ CACHE_PPI_INSTANCE *CachePpiInstance;
+ CachePpiInstance = PEI_CACHE_PPI_INSTANCE_FROM_THIS (This);
+ if (MsrNum >= CACHE_VARIABLE_MTRR_BASE) {
+ if ((MsrNum - CACHE_VARIABLE_MTRR_BASE) >= V_MAXIMUM_VARIABLE_MTRR_NUMBER * 2) {
+ ASSERT (FALSE);
+ return 0;
+ }
+
+ if (CachePpiInstance->VariableMtrrValue[MsrNum - CACHE_VARIABLE_MTRR_BASE].Changed) {
+ MtrrVal = CachePpiInstance->VariableMtrrValue[MsrNum - CACHE_VARIABLE_MTRR_BASE].MsrValue;
+ } else {
+ MtrrVal = AsmReadMsr64 (MsrNum);
+ }
+ } else {
+ if (MsrNum >= V_FIXED_MTRR_NUMBER) {
+ ASSERT (FALSE);
+ return 0;
+ }
+
+ if (CachePpiInstance->FixedMtrrValue[MsrNum].Changed) {
+ MtrrVal = CachePpiInstance->FixedMtrrValue[MsrNum].MsrValue;
+ } else {
+ MtrrVal = AsmReadMsr64 (mFixedMtrrTable[MsrNum].Msr);
+ }
+ }
+
+ return MtrrVal;
+}
+
+/**
+ Disable cache and its mtrr
+
+ @param[in] OldMtrr - To return the Old MTRR value
+**/
+VOID
+EfiDisableCacheMtrr (
+ OUT UINT64 *OldMtrr
+ )
+{
+ UINT64 TempQword;
+
+ EfiDisableCache ();
+
+ ///
+ /// Disable Cache MTRR
+ ///
+ *OldMtrr = AsmReadMsr64 (CACHE_IA32_MTRR_DEF_TYPE);
+ TempQword = (*OldMtrr) &~B_CACHE_MTRR_VALID &~B_CACHE_FIXED_MTRR_VALID;
+ AsmWriteMsr64 (CACHE_IA32_MTRR_DEF_TYPE, TempQword);
+ return;
+}
+
+/**
+ Recover cache MTRR
+
+ @param[in] EnableMtrr - Whether to enable the MTRR
+ @param[in] OldMtrr - The saved old MTRR value to restore when not to
+ enable the MTRR
+**/
+VOID
+EfiRecoverCacheMtrr (
+ IN BOOLEAN EnableMtrr,
+ IN UINT64 OldMtrr
+ )
+{
+ UINT64 TempQword;
+
+ TempQword = 0;
+
+ ///
+ /// Enable Cache MTRR
+ ///
+ if (EnableMtrr) {
+ TempQword = AsmReadMsr64 (CACHE_IA32_MTRR_DEF_TYPE);
+ TempQword |= (B_CACHE_MTRR_VALID | B_CACHE_FIXED_MTRR_VALID);
+ } else {
+ TempQword = OldMtrr;
+ }
+
+ AsmWriteMsr64 (CACHE_IA32_MTRR_DEF_TYPE, TempQword);
+
+ EfiEnableCache ();
+ return;
+}
+
+/**
+ Programming MTRR according to Memory address, length, and type.
+
+ @param[in] This - Pointer to PEI_CACHE_PPI
+ @param[in] MtrrNumber - the variable MTRR index number
+ @param[in] MemoryAddress - the address of target memory
+ @param[in] MemoryLength - the length of target memory
+ @param[in] MemoryCacheType - the cache type of target memory
+ @param[in] ValidMtrrAddressMask - the MTRR address mask
+**/
+VOID
+EfiProgramMtrr (
+ IN PEI_CACHE_PPI *This,
+ IN UINT32 MtrrNumber,
+ IN EFI_PHYSICAL_ADDRESS MemoryAddress,
+ IN UINT64 MemoryLength,
+ IN EFI_MEMORY_CACHE_TYPE MemoryCacheType,
+ IN UINT64 ValidMtrrAddressMask
+ )
+{
+ UINT64 TempQword;
+
+ ///
+ /// MTRR Physical Base
+ ///
+ TempQword = (MemoryAddress & ValidMtrrAddressMask) | MemoryCacheType;
+ WriteMsrToBuffer (This, MtrrNumber, TempQword);
+
+ ///
+ /// MTRR Physical Mask
+ ///
+ TempQword = ~(MemoryLength - 1);
+ WriteMsrToBuffer (This, MtrrNumber + 1, (TempQword & ValidMtrrAddressMask) | B_CACHE_MTRR_VALID);
+
+ return;
+}
+
+/**
+ Calculate max memory of power 2
+
+ @param[in] MemoryLength - Memory length that will be calculated
+
+ @retval Max memory
+**/
+UINT64
+PeiPower2MaxMemory (
+ IN UINT64 MemoryLength
+ )
+{
+ UINT64 Result;
+ UINT32 *ResultPointer;
+ UINT32 *MemoryLengthPointer;
+ MemoryLengthPointer = (UINT32 *) &MemoryLength;
+ ResultPointer = (UINT32 *) &Result;
+ Result = 0;
+ if (MemoryLengthPointer[1] != 0) {
+ ResultPointer[1] = GetPowerOfTwo32 (MemoryLengthPointer[1]);
+ } else {
+ ResultPointer[0] = GetPowerOfTwo32 (MemoryLengthPointer[0]);
+ }
+
+ return Result;
+}
+
+/**
+ Program the unaligned MTRR register.
+
+ @param[in] This - Pointer to PEI_CACHE_PPI
+ @param[in] AlignedQword - The aligned 64-bit cache type.
+ @param[in] MsrNum - The index of current MTRR.
+ @param[in] UnalignedBase - Base Address of the current unaligned MTRR.
+ @param[in] UnalignedLimit - Limit Address of the current unaligned MTRR.
+
+ @retval EFI_SUCCESS - The unaligned MTRR is set successfully.
+ @retval EFI_DEVICE_ERROR - The unaligned address is not the multiple of the basic length of MTRR.
+**/
+EFI_STATUS
+PeiProgramUnalignedMtrr (
+ IN PEI_CACHE_PPI *This,
+ IN UINT64 AlignedQword,
+ IN UINTN MsrNum,
+ IN UINT32 UnalignedBase,
+ IN UINT32 UnalignedLimit
+ )
+{
+ UINT32 UnalignedOffset;
+ UINT64 TempQword;
+ UINT64 Mask;
+ UINT8 ByteShift;
+
+ UnalignedOffset = UnalignedBase - mFixedMtrrTable[MsrNum].BaseAddress;
+ if (UnalignedOffset % mFixedMtrrTable[MsrNum].Length != 0) {
+ return EFI_DEVICE_ERROR;
+ }
+
+ ByteShift = (UINT8) (UnalignedOffset / mFixedMtrrTable[MsrNum].Length);
+ Mask = ~(LShiftU64 (1, ByteShift * 8) - 1);
+
+ if (UnalignedLimit < mFixedMtrrTable[MsrNum + 1].BaseAddress) {
+ UnalignedOffset = UnalignedLimit - mFixedMtrrTable[MsrNum].BaseAddress;
+ if (UnalignedOffset % mFixedMtrrTable[MsrNum].Length != 0) {
+ return EFI_DEVICE_ERROR;
+ }
+
+ ByteShift = (UINT8) (UnalignedOffset / mFixedMtrrTable[MsrNum].Length);
+ Mask &= LShiftU64 (1, ByteShift * 8) - 1;
+ }
+
+ TempQword = ReadMsrFromBuffer (This, MsrNum) &~Mask;
+ TempQword |= AlignedQword & Mask;
+ WriteMsrToBuffer (This, MsrNum, TempQword);
+ return EFI_SUCCESS;
+}
+
+/**
+ Given the low memory range ( <= 1MB) and cache type, program the MTRRs.
+
+ @param[in] This - Current instance of Pei Cache PPI.
+ @param[in] MemoryCacheType - Cache Type.
+ @param[in] MemoryBase - Base Address of Memory to program MTRR.
+ @param[in] MemoryLimit - Limit Address of Memory to program MTRR.
+
+ @retval EFI_SUCCESS - Low memory MTRR is set successfully.
+ @retval others - An error occurs when setting Low memory MTRR.
+**/
+EFI_STATUS
+PeiProgramLowMemoryMtrr (
+ IN PEI_CACHE_PPI *This,
+ IN EFI_MEMORY_CACHE_TYPE MemoryCacheType,
+ IN UINT32 MemoryBase,
+ IN UINT32 MemoryLimit
+ )
+{
+ EFI_STATUS Status;
+ ALIGNED Aligned;
+ UINTN MsrNum;
+
+ Status = EFI_SUCCESS;
+
+ Aligned.AlignedDword.High = MemoryCacheType * ALIGNED_SEED;
+ Aligned.AlignedDword.Low = Aligned.AlignedDword.High;
+
+ for (MsrNum = 0; mFixedMtrrTable[MsrNum].BaseAddress < MemoryBase; MsrNum++) {
+ ;
+ }
+
+ if (MemoryBase < mFixedMtrrTable[MsrNum].BaseAddress) {
+ Status = PeiProgramUnalignedMtrr (This, Aligned.AlignedQword, MsrNum - 1, MemoryBase, MemoryLimit);
+ if (EFI_ERROR (Status)) {
+ goto Done;
+ }
+ }
+
+ while (MsrNum < V_FIXED_MTRR_NUMBER && MemoryLimit >= mFixedMtrrTable[MsrNum + 1].BaseAddress) {
+ ///
+ /// Program aligned MTRR
+ ///
+ WriteMsrToBuffer (This, MsrNum, Aligned.AlignedQword);
+ MsrNum++;
+ }
+
+ if (MemoryLimit > mFixedMtrrTable[MsrNum].BaseAddress) {
+ Status = PeiProgramUnalignedMtrr (
+ This,
+ Aligned.AlignedQword,
+ MsrNum,
+ mFixedMtrrTable[MsrNum].BaseAddress,
+ MemoryLimit
+ );
+ }
+
+Done:
+ return Status;
+}
+
+/**
+ Given the memory range and cache type, programs the MTRRs.
+
+ @param[in] PeiServices - General purpose services available to every PEIM.
+ @param[in] This - Current instance of Pei Cache PPI.
+ @param[in] MemoryAddress - Base Address of Memory to program MTRR.
+ @param[in] MemoryLength - Length of Memory to program MTRR.
+ @param[in] MemoryCacheType - Cache Type.
+
+ @retval EFI_SUCCESS - Mtrr are set successfully.
+ @retval EFI_LOAD_ERROR - No empty MTRRs to use.
+ @retval EFI_INVALID_PARAMETER - The input parameter is not valid.
+ @retval others - An error occurs when setting MTTR.
+**/
+EFI_STATUS
+EFIAPI
+PeiSetCacheAttributes (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_CACHE_PPI *This,
+ IN EFI_PHYSICAL_ADDRESS MemoryAddress,
+ IN UINT64 MemoryLength,
+ IN EFI_MEMORY_CACHE_TYPE MemoryCacheType
+ )
+{
+ EFI_STATUS Status;
+ UINT32 MsrNum;
+ UINT64 TempQword;
+ UINT32 UsedMsrNum;
+ EFI_MEMORY_CACHE_TYPE UsedMemoryCacheType;
+ UINT64 ValidMtrrAddressMask;
+ EFI_CPUID_REGISTER FeatureInfo;
+ UINT64 Power2Length[8];
+ UINT64 LengthArray[8];
+ UINTN LengthSize;
+ UINTN Index;
+ UINTN Count;
+ UINT32 Remainder;
+ UINT32 VariableMtrrLimit;
+ UINT32 *TempQwordPointer;
+ UINT32 *Power2LengthPointer;
+
+ TempQwordPointer = (UINT32 *) &TempQword;
+
+ VariableMtrrLimit = (UINT32) (AsmReadMsr64 (IA32_MTRR_CAP) & B_IA32_MTRR_VARIABLE_SUPPORT);
+ if (VariableMtrrLimit > V_MAXIMUM_VARIABLE_MTRR_NUMBER) {
+ VariableMtrrLimit = V_MAXIMUM_VARIABLE_MTRR_NUMBER;
+ }
+ ValidMtrrAddressMask = 0x1000000000ULL;
+
+ AsmCpuid (
+ CPUID_EXTENDED_FUNCTION,
+ &FeatureInfo.RegEax,
+ &FeatureInfo.RegEbx,
+ &FeatureInfo.RegEcx,
+ &FeatureInfo.RegEdx
+ );
+ if (FeatureInfo.RegEax >= CPUID_VIR_PHY_ADDRESS_SIZE) {
+ AsmCpuid (
+ CPUID_VIR_PHY_ADDRESS_SIZE,
+ &FeatureInfo.RegEax,
+ &FeatureInfo.RegEbx,
+ &FeatureInfo.RegEcx,
+ &FeatureInfo.RegEdx
+ );
+ ValidMtrrAddressMask = (LShiftU64 ((UINT64) 1, FeatureInfo.RegEax & 0xFF) - 1) & (~(UINT64) 0x0FFF);
+ }
+
+ ///
+ /// Check for invalid parameter
+ ///
+ if ((MemoryAddress &~ValidMtrrAddressMask) != 0 || (MemoryLength &~ValidMtrrAddressMask) != 0) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ switch (MemoryCacheType) {
+ case EfiCacheTypeUncacheable:
+ case EfiCacheTypeWriteCombining:
+ case EfiCacheTypeWriteThrough:
+ case EfiCacheTypeWriteProtected:
+ case EfiCacheTypeWriteBack:
+ break;
+
+ default:
+ return EFI_INVALID_PARAMETER;
+ }
+
+ ///
+ /// Check if Fixed MTRR
+ ///
+ if ((MemoryAddress + MemoryLength) <= (1 << 20)) {
+ Status = PeiProgramLowMemoryMtrr (
+ This,
+ MemoryCacheType,
+ (UINT32) MemoryAddress,
+ (UINT32) (MemoryAddress + MemoryLength)
+ );
+ return Status;
+ }
+
+ ///
+ /// Special case for 1 MB base address
+ ///
+ if (MemoryAddress == 0x100000) {
+ MemoryAddress = 0;
+ MemoryLength += 0x100000;
+ }
+
+ ///
+ /// Split MemoryLength into a sum of power of 2
+ ///
+ ZeroMem (Power2Length, sizeof (Power2Length));
+ LengthSize = 0;
+ TempQword = MemoryLength;
+ do {
+ Power2Length[LengthSize] = PeiPower2MaxMemory (TempQword);
+ TempQword -= Power2Length[LengthSize];
+ LengthSize++;
+ } while (TempQword != 0 && LengthSize < 8);
+ if (TempQword != 0) {
+ return EFI_LOAD_ERROR;
+ }
+
+ ///
+ /// Work out an order of splitted power of 2
+ /// so that Base and Length are suitable for MTRR
+ /// setting constraints.
+ ///
+ Count = 0;
+ TempQword = MemoryAddress;
+ do {
+ for (Index = 0; Index < LengthSize; Index++) {
+ Power2LengthPointer = (UINT32 *) &Power2Length[Index];
+ if (Power2Length[Index] != 0) {
+ if (Power2LengthPointer[1] != 0) {
+ Remainder = (UINT32) TempQword;
+ if (Remainder == 0) {
+ DivU64x32Remainder (
+ TempQwordPointer[1],
+ Power2LengthPointer[1],
+ &Remainder
+ );
+ }
+ } else {
+ DivU64x32Remainder (TempQword, (UINT32) Power2Length[Index], &Remainder);
+ }
+
+ if (Remainder == 0) {
+ LengthArray[Count] = Power2Length[Index];
+ TempQword += Power2Length[Index];
+ Power2Length[Index] = 0;
+ Count++;
+ break;
+ }
+ }
+ }
+
+ if (Index == LengthSize) {
+ return EFI_LOAD_ERROR;
+ }
+ } while (Count < LengthSize);
+ ///
+ /// Begin setting the MTRR according to the order
+ ///
+ for (Index = 0; Index < LengthSize; Index++, MemoryAddress += MemoryLength) {
+ MemoryLength = LengthArray[Index];
+ ///
+ /// Search if the range attribute has been set before
+ ///
+ Status = SearchForExactMtrr (
+ PeiServices,
+ This,
+ MemoryAddress,
+ MemoryLength,
+ ValidMtrrAddressMask,
+ &UsedMsrNum,
+ &UsedMemoryCacheType
+ );
+
+ if (!EFI_ERROR (Status)) {
+ ///
+ /// Compare if it has the same type as current setting
+ ///
+ if (UsedMemoryCacheType != MemoryCacheType) {
+ ///
+ /// Different type
+ ///
+ ///
+ /// Check if the set type is the same as default type
+ ///
+ if (IsDefaultType (MemoryCacheType)) {
+ ///
+ /// Clear the mtrr
+ ///
+ WriteMsrToBuffer (This, UsedMsrNum, 0);
+ WriteMsrToBuffer (This, UsedMsrNum + 1, 0);
+
+ } else {
+ ///
+ /// Modify the mtrr type
+ ///
+ EfiProgramMtrr (
+ This,
+ UsedMsrNum,
+ MemoryAddress,
+ MemoryLength,
+ MemoryCacheType,
+ ValidMtrrAddressMask
+ );
+ }
+ }
+
+ continue;
+ }
+
+ ///
+ /// Find first unused MTRR
+ ///
+ for (MsrNum = CACHE_VARIABLE_MTRR_BASE; MsrNum < (CACHE_VARIABLE_MTRR_BASE + VariableMtrrLimit * 2); MsrNum += 2) {
+ if (ReadMsrFromBuffer (This, MsrNum + 1) == 0) {
+ break;
+ }
+ }
+ ///
+ /// Check if we ran out of variable-range MTRRs
+ ///
+ if (MsrNum >= (CACHE_VARIABLE_MTRR_BASE + VariableMtrrLimit * 2)) {
+ return EFI_LOAD_ERROR;
+ }
+
+ EfiProgramMtrr (
+ This,
+ MsrNum,
+ MemoryAddress,
+ MemoryLength,
+ MemoryCacheType,
+ ValidMtrrAddressMask
+ );
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Update MTRR setting from buffer to MSR. Disable NEM when NEM is not disabled yet.
+
+ @param[in] PeiServices - General purpose services available to every PEIM.
+ @param[in] This - Current instance of Pei Cache PPI.
+
+ @retval EFI_SUCCESS - Mtrr are set successfully.
+**/
+EFI_STATUS
+EFIAPI
+PeiActivateCache (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_CACHE_PPI *This
+ )
+{
+ UINT32 VariableMtrrLimit;
+ UINT32 MsrNum;
+ UINT64 OldMtrr;
+ UINT16 Index;
+ CACHE_PPI_INSTANCE *CachePpiInstance;
+ CachePpiInstance = PEI_CACHE_PPI_INSTANCE_FROM_THIS (This);
+
+ VariableMtrrLimit = (UINT32) (AsmReadMsr64 (IA32_MTRR_CAP) & B_IA32_MTRR_VARIABLE_SUPPORT);
+ if (VariableMtrrLimit > V_MAXIMUM_VARIABLE_MTRR_NUMBER) {
+ VariableMtrrLimit = V_MAXIMUM_VARIABLE_MTRR_NUMBER;
+ }
+
+ ///
+ /// Disable NEM when NEM is not disabled yet
+ ///
+ if (!CachePpiInstance->NemDisabledDone) {
+ DisableCacheAsRam ();
+ CachePpiInstance->NemDisabledDone = TRUE;
+ }
+
+ ///
+ /// Disable/Enable cache only when MTRR configuration is changed in MTRR buffer
+ ///
+ if (CachePpiInstance->FixedMtrrChanged || CachePpiInstance->VariableMtrrChanged) {
+ EfiDisableCacheMtrr (&OldMtrr);
+ if (CachePpiInstance->FixedMtrrChanged) {
+ for (Index = 0; Index < V_FIXED_MTRR_NUMBER; Index++) {
+ if (CachePpiInstance->FixedMtrrValue[Index].Changed) {
+ AsmWriteMsr64 (mFixedMtrrTable[Index].Msr, CachePpiInstance->FixedMtrrValue[Index].MsrValue);
+ CachePpiInstance->FixedMtrrValue[Index].Changed = FALSE;
+ }
+ }
+
+ CachePpiInstance->FixedMtrrChanged = FALSE;
+ }
+
+ if (CachePpiInstance->VariableMtrrChanged) {
+ for (MsrNum = CACHE_VARIABLE_MTRR_BASE; MsrNum < (CACHE_VARIABLE_MTRR_BASE + VariableMtrrLimit * 2); MsrNum++) {
+ if (CachePpiInstance->VariableMtrrValue[MsrNum - CACHE_VARIABLE_MTRR_BASE].Changed) {
+ AsmWriteMsr64 (MsrNum, CachePpiInstance->VariableMtrrValue[MsrNum - CACHE_VARIABLE_MTRR_BASE].MsrValue);
+ CachePpiInstance->VariableMtrrValue[MsrNum - CACHE_VARIABLE_MTRR_BASE].Changed = FALSE;
+ }
+
+ CachePpiInstance->VariableMtrrChanged = FALSE;
+ }
+ }
+
+ EfiRecoverCacheMtrr (TRUE, OldMtrr);
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Reset all the MTRRs to a known state.
+
+ @param[in] PeiServices - General purpose services available to every PEIM.
+ @param[in] This - Pointer to the instance of the PEI_CACHE_PPI.
+
+ @retval EFI_SUCCESS - All MTRRs have been reset successfully.
+**/
+EFI_STATUS
+EFIAPI
+PeiResetCacheAttributes (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_CACHE_PPI *This
+ )
+{
+ UINT32 MsrNum;
+ UINT16 Index;
+ UINT32 VariableMtrrLimit;
+
+ VariableMtrrLimit = (UINT32) (AsmReadMsr64 (IA32_MTRR_CAP) & B_IA32_MTRR_VARIABLE_SUPPORT);
+ if (VariableMtrrLimit > V_MAXIMUM_VARIABLE_MTRR_NUMBER) {
+ VariableMtrrLimit = V_MAXIMUM_VARIABLE_MTRR_NUMBER;
+ }
+
+ Index = 0;
+
+ ///
+ /// Reset Fixed Mtrrs
+ ///
+ while (mFixedMtrrTable[Index].Msr != 0) {
+ WriteMsrToBuffer (This, Index, 0);
+ Index++;
+ }
+
+ ///
+ /// Reset Variable Mtrrs
+ ///
+ for (MsrNum = CACHE_VARIABLE_MTRR_BASE; MsrNum < (CACHE_VARIABLE_MTRR_BASE + VariableMtrrLimit * 2); MsrNum++) {
+ WriteMsrToBuffer (This, MsrNum, 0);
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Search the memory cache type for specific memory from MTRR.
+
+ @param[in] PeiServices - General purpose services available to every PEIM.
+ @param[in] This - Current instance of Pei Cache PPI.
+ @param[in] MemoryAddress - the address of target memory
+ @param[in] MemoryLength - the length of target memory
+ @param[in] ValidMtrrAddressMask - the MTRR address mask
+ @param[in] UsedMsrNum - the used MSR number
+ @param[in] UsedMemoryCacheType - the cache type for the target memory
+
+ @retval EFI_SUCCESS - The memory is found in MTRR and cache type is returned
+ @retval EFI_NOT_FOUND - The memory is not found in MTRR
+**/
+EFI_STATUS
+SearchForExactMtrr (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_CACHE_PPI *This,
+ IN EFI_PHYSICAL_ADDRESS MemoryAddress,
+ IN UINT64 MemoryLength,
+ IN UINT64 ValidMtrrAddressMask,
+ OUT UINT32 *UsedMsrNum,
+ OUT EFI_MEMORY_CACHE_TYPE *UsedMemoryCacheType
+ )
+{
+ UINT32 MsrNum;
+ UINT64 TempQword;
+ UINT32 VariableMtrrLimit;
+
+ VariableMtrrLimit = (UINT32) (AsmReadMsr64 (IA32_MTRR_CAP) & B_IA32_MTRR_VARIABLE_SUPPORT);
+ if (VariableMtrrLimit > V_MAXIMUM_VARIABLE_MTRR_NUMBER) {
+ VariableMtrrLimit = V_MAXIMUM_VARIABLE_MTRR_NUMBER;
+ }
+
+ for (MsrNum = CACHE_VARIABLE_MTRR_BASE; MsrNum < (CACHE_VARIABLE_MTRR_BASE + VariableMtrrLimit * 2 - 1); MsrNum += 2) {
+
+ TempQword = ReadMsrFromBuffer (This, MsrNum + 1);
+
+ if ((TempQword & B_CACHE_MTRR_VALID) == 0) {
+ continue;
+ }
+
+ if ((TempQword & ValidMtrrAddressMask) != ((~(MemoryLength - 1)) & ValidMtrrAddressMask)) {
+ continue;
+ }
+
+ TempQword = ReadMsrFromBuffer (This, MsrNum);
+
+ if ((TempQword & ValidMtrrAddressMask) != (MemoryAddress & ValidMtrrAddressMask)) {
+ continue;
+ }
+
+ *UsedMemoryCacheType = (EFI_MEMORY_CACHE_TYPE) (TempQword & 0xFF);
+ *UsedMsrNum = MsrNum;
+
+ return EFI_SUCCESS;
+
+ }
+
+ return EFI_NOT_FOUND;
+}
+
+/**
+ Compares provided Cache type to default type
+
+ @param[in] MemoryCacheType - Memory type for testing
+
+ @retval TRUE - Memory type instance is the default type
+ @retval FALSE - Memory type instance is not the default type
+**/
+BOOLEAN
+IsDefaultType (
+ IN EFI_MEMORY_CACHE_TYPE MemoryCacheType
+ )
+{
+
+ if ((AsmReadMsr64 (CACHE_IA32_MTRR_DEF_TYPE) & 0xFF) != MemoryCacheType) {
+ return FALSE;
+ } else {
+ return TRUE;
+ }
+}
+
+/**
+ Install CacheInitPpi
+
+ @retval EFI_OUT_OF_RESOURCES - failed to allocate required pool
+**/
+EFI_STATUS
+CacheInitPpiInit (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ CACHE_PPI_INSTANCE *CachePpiInstance;
+
+ CachePpiInstance = AllocateZeroPool (sizeof (CACHE_PPI_INSTANCE));
+ ASSERT (CachePpiInstance != NULL);
+ if (CachePpiInstance == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ CachePpiInstance->Ppi.SetCache = PeiSetCacheAttributes;
+ CachePpiInstance->Ppi.ResetCache = PeiResetCacheAttributes;
+ CachePpiInstance->Ppi.ActivateCache = PeiActivateCache;
+
+ CachePpiInstance->PpiDesc.Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;
+ CachePpiInstance->PpiDesc.Guid = &gPeiCachePpiGuid;
+ CachePpiInstance->PpiDesc.Ppi = &CachePpiInstance->Ppi;
+
+ ///
+ /// Install PPI
+ ///
+ Status = PeiServicesInstallPpi (&CachePpiInstance->PpiDesc);
+ ASSERT_EFI_ERROR (Status);
+ return Status;
+}
+
+VOID
+CacheInvd (
+ VOID
+ );
+
+/**
+ Disable NEM (cache-as-ram)
+
+ @retval EFI_SUCCESS - always return success
+**/
+EFI_STATUS
+DisableCacheAsRam (
+ VOID
+ )
+{
+ UINT64 CacheAsRamMsr;
+ UINT64 McStatus;
+ UINT32 McIndex;
+ UINT32 McCounter;
+ UINT64 TempQword;
+ UINT64 OldMtrr;
+
+ CacheAsRamMsr = AsmReadMsr64 (NO_EVICT_MODE);
+
+ ///
+ /// Check if CAR has already been disabled. We should not
+ /// execute CacheInvd() after cache has been enabled. This
+ /// check will avoid that.
+ ///
+ if ((CacheAsRamMsr & B_NO_EVICT_MODE_RUN) == 0) {
+ return EFI_SUCCESS;
+ }
+
+ CacheInvd ();
+
+ ///
+ /// Step 3: Disable No-Eviction Mode Run State by clearing
+ /// NO_EVICT_MODE MSR 2E0h bit [1] = 0
+ ///
+ CacheAsRamMsr &= ~B_NO_EVICT_MODE_RUN;
+ AsmWriteMsr64 (NO_EVICT_MODE, CacheAsRamMsr);
+
+ ///
+ /// Step 4: Disable No-Eviction Mode Setup State by clearing
+ /// NO_EVICT_MODE MSR 2E0h bit [0] = 0
+ ///
+ CacheAsRamMsr &= ~B_NO_EVICT_MODE_SETUP;
+ AsmWriteMsr64 (NO_EVICT_MODE, CacheAsRamMsr);
+
+ ///
+ /// Disable Cache MTRR by cleaning IA32_MTRR_DEF_TYPE.E or IA32_MTRR_DEF_TYPE.GE
+ ///
+ OldMtrr = AsmReadMsr64 (CACHE_IA32_MTRR_DEF_TYPE);
+ TempQword = OldMtrr &~B_CACHE_MTRR_VALID;
+ AsmWriteMsr64 (CACHE_IA32_MTRR_DEF_TYPE, TempQword);
+
+ ///
+ /// After NEM is disabled, BIOS must clear any Machine Check Bank 5-8 errors that may
+ /// have occurred as the result of ... MLC to to LLC Evictions.
+ ///
+ McStatus = 0;
+ McCounter = (UINT32) (AsmReadMsr64 (IA32_MCG_CAP) & 0x0f);
+ for (McIndex = 5; McIndex < McCounter; McIndex++) {
+ if (McIndex <= 8) {
+ AsmWriteMsr64 (IA32_MC0_STATUS + McIndex * 4, McStatus);
+ }
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/Haswell/CpuInit/Pei/CpuInitPei.cif b/ReferenceCode/Haswell/CpuInit/Pei/CpuInitPei.cif
new file mode 100644
index 0000000..f69c12f
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Pei/CpuInitPei.cif
@@ -0,0 +1,20 @@
+<component>
+ name = "CpuInitPei"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Haswell\CpuInit\Pei"
+ RefName = "CpuInitPei"
+[files]
+"CpuInitPeim.c"
+"CachePeim.c"
+"CpuInitPeim.h"
+"PfatInit.c"
+"PfatInit.h"
+"CpuOcInit.c"
+"CpuOcInit.h"
+"CpuInitPeim.dxs"
+"CpuInitPeim.inf"
+"CpuInitPei.mak"
+"CpuInitPei.sdl"
+"Ia32\Cpu.asm"
+"BootGuardInit.c"
+<endComponent>
diff --git a/ReferenceCode/Haswell/CpuInit/Pei/CpuInitPei.mak b/ReferenceCode/Haswell/CpuInit/Pei/CpuInitPei.mak
new file mode 100644
index 0000000..7258a7c
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Pei/CpuInitPei.mak
@@ -0,0 +1,76 @@
+# MAK file for the eModule:PowerManagement
+
+EDK : CpuInitPei
+
+BUILD_CpuInitPei_DIR = $(BUILD_DIR)\$(CpuInitPei_DIR)
+
+$(BUILD_DIR)\CpuInitPei.mak : $(CpuInitPei_DIR)\CpuInitPei.cif $(BUILD_RULES)
+ $(CIF2MAK) $(CpuInitPei_DIR)\CpuInitPei.cif $(CIF2MAK_DEFAULTS)
+
+CpuInitPei : $(BUILD_DIR)\CpuInitPei.MAK CpuInitPeiBin
+
+CpuInitPei_OBJECTS = \
+ $(BUILD_CpuInitPei_DIR)\CpuInitPeim.obj \
+ $(BUILD_CpuInitPei_DIR)\CachePeim.obj \
+ $(BUILD_CpuInitPei_DIR)\CpuOcInit.obj \
+ $(BUILD_CpuInitPei_DIR)\PfatInit.obj \
+ $(BUILD_CpuInitPei_DIR)\ia32\Cpu.obj \
+ $(BUILD_CpuInitPei_DIR)\BootGuardInit.obj
+
+CpuInitPei_MY_INCLUDES= \
+ $(EDK_INCLUDES)\
+ $(PROJECT_CPU_INCLUDES)\
+ $(INTEL_MCH_INCLUDES)\
+ $(ME_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)
+
+CpuInitPei_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=PeimInitializeCpu"\
+ /D __EDKII_GLUE_BASE_LIB__ \
+ /D __EDKII_GLUE_PEI_MEMORY_ALLOCATION_LIB__ \
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+ /D __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_MM7__ \
+
+CpuInitPei_LIBS =\
+ $(CPU_PPI_LIB)\
+ $(CPUIA32LIB)\
+ $(EdkIIGluePeiServicesLib_LIB) \
+ $(EdkIIGluePeiReportStatusCodeLib_LIB) \
+ $(EfiRuntimeLib_LIB)\
+ $(INTEL_PCH_PROTOCOL_LIB)\
+ $(EFIRUNTIMELIB)\
+ $(EDKFRAMEWORKPPILIB) \
+ $(EdkIIGluePeiMemoryAllocationLib_LIB)\
+ $(EdkIIGluePeiDebugLibReportStatusCode_LIB)\
+ $(BUILD_DIR)\IA32\EdkIIGlueBaseLib.lib\
+ $(IntelPchPpiLib_LIB)\
+ $(EdkIIGlueBaseLibIA32_LIB)\
+ $(EdkIIGluePeiHobLib_LIB) \
+ $(CpuGuidLib_LIB) \
+ $(PEIHOBLIB) \
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB) \
+ $(EdkIIGlueBasePciExpressLib_LIB)\
+ $(PchPlatformPeiLib_LIB)\
+ $(CpuPlatformLib_LIB)\
+ $(OcPlatformLib_LIB)\
+ $(MeLibPpi_LIB)\
+ $(BootGuardLib_LIB)\
+ $(EFISCRIPTLIB)
+
+CpuInitPeiBin : $(CpuInitPei_LIBS) $(HeciPei_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\CpuInitPei.mak all\
+ NAME=CpuInitPei\
+ MAKEFILE=$(BUILD_DIR)\CpuInitPei.mak \
+ "MY_INCLUDES=$(CpuInitPei_MY_INCLUDES)" \
+ "MY_DEFINES=$(CpuInitPei_DEFINES)"\
+ OBJECTS="$(CpuInitPei_OBJECTS)" \
+ GUID=01359D99-9446-456d-ADA4-50A711C03ADA\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=PEIM \
+ EDKIIModule=PEIM\
+ DEPEX1=$(CpuInitPei_DIR)\CpuInitPeim.DXS \
+ DEPEX1_TYPE=EFI_SECTION_PEI_DEPEX \
+ COMPRESS=0
+#-----------------------------------------------------------------------
diff --git a/ReferenceCode/Haswell/CpuInit/Pei/CpuInitPei.sdl b/ReferenceCode/Haswell/CpuInit/Pei/CpuInitPei.sdl
new file mode 100644
index 0000000..a1abd10
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Pei/CpuInitPei.sdl
@@ -0,0 +1,37 @@
+TOKEN
+ Name = "CpuInitPei_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable Cpu Pei init support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "CpuInitPei_DIR"
+End
+
+MODULE
+ Help = "Includes CpuInitPei.mak to Project"
+ File = "CpuInitPei.mak"
+End
+
+ELINK
+ Name = "CpuInitPei_INCLUDES"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "/I$(CpuInitPei_DIR)"
+ Parent = "CpuInitPei_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\CpuInitPei.ffs"
+ Parent = "FV_BB"
+ InvokeOrder = AfterParent
+End
+
diff --git a/ReferenceCode/Haswell/CpuInit/Pei/CpuInitPeim.c b/ReferenceCode/Haswell/CpuInit/Pei/CpuInitPeim.c
new file mode 100644
index 0000000..739e043
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Pei/CpuInitPeim.c
@@ -0,0 +1,1404 @@
+/** @file
+ EFI 2.0 PEIM to initialize the cache and program for unlock processor
+
+Revision History
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Pre-EFI Module' and is licensed
+ for Intel CPUs and Chipsets under the terms of your license
+ agreement with Intel or your vendor. This file may be
+ modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+///
+/// External include files do NOT need to be explicitly specified in real EDKII
+/// environment
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#include "CpuAccess.h"
+#include "CpuInitPeim.h"
+#include "PchAccess.h"
+#include "SaAccess.h"
+#include "PfatInit.h"
+#include "CpuOcInit.h"
+#include "CpuPlatformLib.h"
+
+#include EFI_PPI_DEFINITION (BootMode)
+#include EFI_PPI_DEFINITION (PchInit)
+#include EFI_PPI_CONSUMER (PchReset)
+#endif
+
+#include EFI_PPI_CONSUMER (SecPlatformInformation)
+#include EFI_GUID_DEFINITION (HtBistHob)
+
+/**
+ This fuction compare Setup Options of ActiveCores & HyperThreading against the CPU Strap
+ and in case of mismatch requests reset
+
+ @param[in] PeiServices - For printouts
+ @param[in] CpuStrapSet - Strap current setting
+ @param[in] CpuPlatformPolicyPpi - Platform Policy PPI
+
+ @retval CPU_RESET_TYPE
+ @retval CPU_ONLY_RESET - if reset is needed
+ @retval NO_RESET - otherwise
+**/
+CPU_RESET_TYPE
+SetActiveCoresAndSmtEnableDisable (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN CPU_STRAP_SET *CpuStrapSet,
+ IN PEI_CPU_PLATFORM_POLICY_PPI *CpuPlatformPolicyPpi
+ )
+{
+ CPU_RESET_TYPE ResetType;
+ UINT16 TotalThreadsPerCore;
+ UINT32 Data32;
+ UINT32 NumberOfActiveCores;
+ UINT32 NumberOfActiveThreads;
+ EFI_CPUID_REGISTER Cpuid0B = { 0, 0, 0, 0 };
+
+ ResetType = NO_RESET;
+
+ ///
+ /// Read CPUID(0xB) with ECX=0 for number of logical processors per Core.
+ /// This value does NOT change based on Intel HT Technology disable and core disables.
+ ///
+ Cpuid0B.RegEcx = 0;
+ AsmCpuidEx (CPUID_PROCESSOR_TOPOLOGY, 0, NULL, &Cpuid0B.RegEbx, NULL, NULL);
+ TotalThreadsPerCore = (UINT16) Cpuid0B.RegEbx;
+
+ ///
+ /// CORE_THREAD_COUNT - msr 0x35
+ /// Symbol Name MSB:LSB Description
+ /// CoreCount CoreCount 31:16 The Core Count reflects the enabled cores based
+ /// on the above thread count and the value of threads_
+ /// available (to determine if HT is on) at reset time.
+ ///
+ /// ThreadCount ThreadCount 15:0 The Thread Count reflects the enabled threads based
+ /// on the factory-configured thread count and the value
+ /// of the CSR_DESIRED_CORES register at reset time.
+ ///
+ ///
+ /// Read MSR for Active Core and Thread Count.
+ ///
+ Data32 = (UINT32) AsmReadMsr64 (MSR_CORE_THREAD_COUNT);
+ NumberOfActiveCores = (UINT32) ((Data32 >> 16) & 0xFFFF);
+ NumberOfActiveThreads = (UINT32) (Data32 & 0xFFFF);
+
+ DEBUG ((EFI_D_INFO, "Number of Active Cores / Threads = %x / %x\n", NumberOfActiveCores, NumberOfActiveThreads));
+
+ if (TotalThreadsPerCore > 1) {
+ ///
+ /// SMT is supported
+ ///
+ DEBUG ((EFI_D_INFO, "SMT is supported\n"));
+ ///
+ /// Check if the configuration of SMT matches the BIOS Setup option.
+ ///
+ if (CpuStrapSet->HtDisabled == CpuPlatformPolicyPpi->CpuConfig->HyperThreading) {
+ ///
+ /// SMT configuration doesn't match BIOS Setup option; update the Strap Set Data and Issue a Warm reset
+ ///
+ DEBUG ((EFI_D_INFO, "SMT configuration doesn't match the setup value\n"));
+ CpuStrapSet->HtDisabled = !CpuPlatformPolicyPpi->CpuConfig->HyperThreading;
+ ResetType |= WARM_RESET;
+ }
+ } else {
+ ///
+ /// SMT is not supported by default fusing.
+ ///
+ DEBUG ((EFI_D_WARN, "SMT is NOT supported\n"));
+ CpuStrapSet->HtDisabled = 1;
+ CpuPlatformPolicyPpi->CpuConfig->HyperThreading = CPU_FEATURE_DISABLE;
+ }
+ ///
+ /// Check if the configuration of "Active Core" matches the BIOS Setup option.
+ ///
+ if (CpuStrapSet->NumberOfActiveCores != CpuPlatformPolicyPpi->CpuConfig->ActiveCoreCount) {
+ DEBUG (
+ (EFI_D_INFO,
+ "NumberOfActiveCores doesn't match the value from Setup = %x / %x\n",
+ CpuStrapSet->NumberOfActiveCores,
+ CpuPlatformPolicyPpi->CpuConfig->ActiveCoreCount)
+ );
+ CpuStrapSet->NumberOfActiveCores = CpuPlatformPolicyPpi->CpuConfig->ActiveCoreCount;
+ ///
+ /// Haswell CPU doesnt require COLD reset to set number of active cores
+ ///
+ ResetType |= WARM_RESET;
+ }
+
+ return ResetType;
+}
+
+/**
+ This fuction compare Setup Options of BIST against the CPU Strap
+ and in case of mismatch requests reset
+
+ @param[in] PeiServices - For printouts
+ @param[in] CpuStrapSet - Strap current setting
+ @param[in] CpuPlatformPolicyPpi - Platform Policy PPI
+
+ @retval CPU_RESET_TYPE
+ @retval CPU_ONLY_RESET - if reset is needed
+ @retval NO_RESET - otherwise
+**/
+CPU_RESET_TYPE
+BistEnableDisable (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN CPU_STRAP_SET *CpuStrapSet,
+ IN PEI_CPU_PLATFORM_POLICY_PPI *CpuPlatformPolicyPpi
+ )
+{
+ if (CpuStrapSet->Bist == CpuPlatformPolicyPpi->CpuConfig->BistOnReset) {
+ return NO_RESET;
+ } else {
+ CpuStrapSet->Bist = CpuPlatformPolicyPpi->CpuConfig->BistOnReset;
+ DEBUG ((EFI_D_INFO, "BIST configuration doesn't match the setup value\n"));
+ return WARM_RESET;
+ }
+}
+
+/**
+ This fuction compare Setup Options of Processor Flex Multiplier against the CPU Strap
+ and in case of mismatch requests reset
+
+ @param[in] PeiServices - For printouts
+ @param[in] CpuStrapSet - Strap current setting
+ @param[in] CpuPlatformPolicyPpi - Platform Policy PPI
+
+ @retval CPU_RESET_TYPE
+ @retval CPU_ONLY_RESET - if reset is needed
+ @retval NO_RESET - otherwise
+**/
+CPU_RESET_TYPE
+ProgramProcessorFlexMultiplier (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN CPU_STRAP_SET *CpuStrapSet,
+ IN PEI_CPU_PLATFORM_POLICY_PPI *CpuPlatformPolicyPpi
+ )
+{
+ UINT64 FlexRatioData;
+ UINT64 CurrentClockFlexRatio;
+ UINT64 MsrData;
+ CPU_RESET_TYPE ResetType;
+
+ ResetType = NO_RESET;
+
+ ///
+ /// Perform Flex Ratio if enabled by user in Setup screen
+ ///
+ if (CpuPlatformPolicyPpi->CpuConfig->CpuRatioOverride) {
+ FlexRatioData = (UINT64) (CpuPlatformPolicyPpi->CpuConfig->CpuRatio);
+ } else {
+ ///
+ /// Flex Ratio was set to disable. Reset to Max Non-Turbo Ratio
+ ///
+ FlexRatioData = 0x0;
+ }
+ DEBUG ((EFI_D_INFO, "Setup Ratio is 0x%X\n", FlexRatioData));
+
+ ///
+ /// Read and save current Flex Ratio data; disregard enable bit (MSR 194h [15:8])
+ ///
+ MsrData = AsmReadMsr64 (MSR_FLEX_RATIO);
+ CurrentClockFlexRatio = ((RShiftU64 (MsrData, N_FLEX_RATIO)) & 0xFF);
+ DEBUG ((EFI_D_INFO, "Current Flex Ratio from MSR is 0x%X\n", CurrentClockFlexRatio));
+ DEBUG ((EFI_D_INFO, "Current Flex Ratio from CPU Strap: 0x%X\n", CpuStrapSet->FlexRatio));
+ ///
+ /// Check and set Flex Ratio to requested ratio if possible
+ ///
+ if (FlexRatioData == CpuStrapSet->FlexRatio) {
+ ///
+ /// Do nothing, ratio is already set to requested value and enabled
+ ///
+ DEBUG ((EFI_D_INFO, "No need to set Flex Ratio.\n"));
+ } else {
+ ///
+ /// Set Flex Ratio to user selected value
+ ///
+ /// Write new data to Flex Ratio register
+ /// First clear MSR of any previous value
+ ///
+ MsrData &= RATIO_FLEX_CLEAR_MASK;
+
+ ///
+ /// Enter the new data
+ ///
+ MsrData |= (LShiftU64 ((FlexRatioData & 0xFF), N_FLEX_RATIO));
+ MsrData |= B_FLEX_EN;
+ AsmWriteMsr64 (MSR_FLEX_RATIO, MsrData);
+
+ ///
+ /// Set Soft Reset Data for Flex Ratio
+ ///
+ CpuStrapSet->FlexRatio = (UINT32) FlexRatioData;
+
+ ///
+ /// Set RESET flag
+ ///
+ DEBUG ((EFI_D_INFO, "Setting Flex Ratio to 0x%X\n", CpuStrapSet->FlexRatio));
+ ResetType |= WARM_RESET;
+ }
+
+ return ResetType;
+}
+
+static EFI_PEI_NOTIFY_DESCRIPTOR mNotifyList[] = {
+ {
+ EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK,
+ &gPchInitPpiGuid,
+ SetCpuStrap
+ },
+ {
+ (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+ &gEfiPeiMasterBootModePpiGuid,
+ BuildBistHob
+ }
+};
+
+/**
+ Check if VT is fused and disabled by Setup Option so reset is needed
+
+ @param[in] CpuPlatformPolicyPpi - Platform Policy PPI
+
+ @retval CPU_RESET_TYPE
+ @retval NO_RESET - If no reset is needed
+ @retval COLDRESET - otherwise
+**/
+CPU_RESET_TYPE
+CheckVmxIfNeedReset (
+ IN PEI_CPU_PLATFORM_POLICY_PPI *CpuPlatformPolicyPpi
+ )
+{
+ UINT64 MsrIa32FeatureControl;
+ BOOLEAN CurrentVmxState;
+ EFI_CPUID_REGISTER Cpuid01 = { 0, 0, 0, 0 };
+
+ AsmCpuid (CPUID_VERSION_INFO, &Cpuid01.RegEax, &Cpuid01.RegEbx, &Cpuid01.RegEcx, &Cpuid01.RegEdx);
+
+ ///
+ /// Check if VMX is supported
+ ///
+ if ((Cpuid01.RegEcx & B_CPUID_VERSION_INFO_ECX_VME) == 0) {
+ return NO_RESET;
+ }
+
+ MsrIa32FeatureControl = AsmReadMsr64 (MSR_IA32_FEATURE_CONTROL);
+
+ ///
+ /// If unlocked, no reset needed.
+ ///
+ if ((MsrIa32FeatureControl & B_MSR_IA32_FEATURE_CONTROL_LOCK) == 0) {
+ return NO_RESET;
+ }
+
+ CurrentVmxState = (BOOLEAN) ((MsrIa32FeatureControl & B_MSR_IA32_FEATURE_CONTROL_EVT) != 0);
+
+ ///
+ /// Need to reset only if locked and VMX state has to be changed.
+ ///
+ if ((CurrentVmxState == (CpuPlatformPolicyPpi->CpuConfig->VmxEnable)) == CPU_FEATURE_ENABLE) {
+ return NO_RESET;
+ }
+ ///
+ /// We need a power good reset to unlock MSR_IA32_FEATURE_CONTROL.
+ ///
+ return COLDRESET;
+}
+
+/**
+ Set CPU strap setting for feature change
+
+ @param[in] PeiServices - Indirect reference to the PEI Services Table.
+ @param[in] NotifyDescriptor - Address of the notification descriptor data structure. Type
+ EFI_PEI_NOTIFY_DESCRIPTOR is defined above.
+ @param[in] Ppi - Address of the PPI that was installed.
+
+ @retval EFI_SUCCESS - Function completed successfully
+**/
+EFI_STATUS
+EFIAPI
+SetCpuStrap (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
+ IN VOID *Ppi
+ )
+{
+ EFI_STATUS Status;
+ CPU_STRAP_SET CpuStrapSet = { 0 };
+ UINT16 CpuStrapSetData;
+ volatile CPU_RESET_TYPE ResetType;
+ PCH_INIT_PPI *PchInitPpi;
+ PEI_CPU_PLATFORM_POLICY_PPI *CpuPlatformPolicyPpi;
+ UINT8 Data;
+
+ ResetType = NO_RESET;
+ CpuStrapSetData = 0;
+ Data = 0;
+
+ Status = PeiServicesLocatePpi (
+ &gPeiCpuPlatformPolicyPpiGuid,
+ 0,
+ NULL,
+ (VOID **) &CpuPlatformPolicyPpi
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Locate PchInit Ppi
+ ///
+ Status = PeiServicesLocatePpi (
+ &gPchInitPpiGuid,
+ 0,
+ NULL,
+ (VOID **) &PchInitPpi
+ );
+ if (Status == EFI_SUCCESS) {
+ ///
+ /// Get Cpu Strap Set Data
+ ///
+ DEBUG ((EFI_D_INFO, "Set PCH CPU Straps \n"));
+ Status = PchInitPpi->CpuStrapSet (PeiServices, GetCpuStrapSetData, &CpuStrapSetData);
+ *((UINT16 *) (&CpuStrapSet)) = CpuStrapSetData;
+ DEBUG ((EFI_D_INFO, "Current CPU Strap Data = 0x%04X\n", CpuStrapSetData));
+
+ if (Status == EFI_SUCCESS) {
+ ResetType |= SetActiveCoresAndSmtEnableDisable (PeiServices, &CpuStrapSet, CpuPlatformPolicyPpi);
+ ResetType |= BistEnableDisable (PeiServices, &CpuStrapSet, CpuPlatformPolicyPpi);
+
+ ///
+ /// Perform Flex Ratio if processor is fused to perform Flex Ratio
+ ///
+ if ((AsmReadMsr64 (MSR_FLEX_RATIO) & B_FLEX_EN) == B_FLEX_EN) {
+ ResetType |= ProgramProcessorFlexMultiplier (PeiServices, &CpuStrapSet, CpuPlatformPolicyPpi);
+ }
+
+ if (ResetType != NO_RESET) {
+ CpuStrapSetData = *((UINT16 *) (&CpuStrapSet));
+ DEBUG ((EFI_D_INFO, "New CPU Strap Data = 0x%04X\n", CpuStrapSetData));
+ Status = PchInitPpi->CpuStrapSet (
+ PeiServices,
+ SetCpuStrapSetData,
+ &CpuStrapSetData
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_INFO, "NO Reset\n"));
+ ResetType = NO_RESET;
+ }
+ }
+ }
+ }
+
+ ResetType |= CheckVmxIfNeedReset (CpuPlatformPolicyPpi);
+
+ if (ResetType != NO_RESET) {
+ ///
+ /// Perform Warm or Cold Reset
+ ///
+ DEBUG (
+ (EFI_D_INFO,
+ "Reset Required. Performing Cold/Warm Reset to read the new strap values - ResetType = %x\n",
+ ResetType)
+ );
+ PerformWarmORColdReset (PeiServices, ResetType);
+ }
+
+ Status = PchInitPpi->CpuStrapSet (
+ PeiServices,
+ LockCpuStrapSetData,
+ &CpuStrapSetData
+ );
+ DEBUG ((EFI_D_INFO, "No Reset Required\n"));
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Initialize prefetcher settings
+
+ @param[in] MlcStreamerprefecterEnabled - Enable/Disable MLC streamer prefetcher
+ @param[in] MlcSpatialPrefetcherEnabled - Enable/Disable MLC spatial prefetcher
+**/
+VOID
+ProcessorsPrefetcherInitialization (
+ IN UINTN MlcStreamerprefecterEnabled,
+ IN UINTN MlcSpatialPrefetcherEnabled
+ )
+{
+ UINT64 MsrValue;
+ MsrValue = AsmReadMsr64 (MISC_FEATURE_CONTROL);
+
+ if (MlcStreamerprefecterEnabled == CPU_FEATURE_DISABLE) {
+ MsrValue |= B_MISC_FEATURE_CONTROL_MLC_STRP;
+ }
+
+ if (MlcSpatialPrefetcherEnabled == CPU_FEATURE_DISABLE) {
+ MsrValue |= B_MISC_FEATURE_CONTROL_MLC_SPAP;
+ }
+
+ if ((MsrValue & (B_MISC_FEATURE_CONTROL_MLC_STRP | B_MISC_FEATURE_CONTROL_MLC_SPAP)) != 0) {
+ AsmWriteMsr64 (MISC_FEATURE_CONTROL, MsrValue);
+ }
+
+ return;
+}
+
+/**
+ Based on ResetType, perform warm or cold reset using PCH Reset PPI
+
+ @param[in] PeiServices - Indirect reference to the PEI Services Table.
+ @param[in] ResetType - CPU_RESET_TYPE to indicate which reset shoudl be performed.
+
+ @exception EFI_UNSUPPORTED - Reset type unsupported
+ @retval EFI_SUCCESS - function successfully (system should already reset)
+**/
+EFI_STATUS
+PerformWarmORColdReset (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN CPU_RESET_TYPE ResetType
+ )
+{
+ PCH_RESET_PPI *PchResetPpi;
+ EFI_STATUS Status;
+
+ ///
+ /// Loccate Reset PPI
+ ///
+ Status = (*PeiServices)->LocatePpi (
+ PeiServices,
+ &gPchResetPpiGuid,
+ 0,
+ NULL,
+ (VOID **) &PchResetPpi
+ );
+
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Perfrom the requested reset using PCH reset PPI
+ ///
+ Status = EFI_SUCCESS;
+ switch (ResetType) {
+ case WARM_RESET:
+ PchResetPpi->Reset (PchResetPpi, RESET_PPI_WARM_RESET);
+ break;
+
+ case COLDRESET:
+ PchResetPpi->Reset (PchResetPpi, RESET_PPI_COLD_RESET);
+ break;
+
+ default:
+ DEBUG ((EFI_D_ERROR, "CpuInitPeim: PerformWarmORColdReset - ResetType %d not supported: \n", ResetType));
+ Status = EFI_UNSUPPORTED;
+ ASSERT_EFI_ERROR (Status);
+ }
+
+ return Status;
+}
+
+/**
+ Initializes XE OR Overclocking support in the processor.
+
+ @param[in] PowerMgmtConfig Pointer to Policy protocol instance
+
+ @retval EFI_SUCCESS
+**/
+EFI_STATUS
+XeInit (
+ IN OUT POWER_MGMT_CONFIG_PPI *PowerMgmtConfig,
+ IN OUT OVERCLOCKING_CONFIG_PPI *OcConfig
+ )
+{
+ MSR_REGISTER TurboRatioLimit;
+ MSR_REGISTER FlexRatioMsr;
+ MSR_REGISTER TempMsr;
+ MSR_REGISTER RingRatioMsr;
+ UINT8 CoreCount;
+ UINT8 OverclockingBins;
+ UINT8 OneCoreRatioLimit;
+ UINT8 TwoCoreRatioLimit;
+ UINT8 ThreeCoreRatioLimit;
+ UINT8 FourCoreRatioLimit;
+ UINT8 RatioLimitProgrammble;
+ UINT16 MaxBusRatio;
+
+ if ((PowerMgmtConfig->Xe == 0)) {
+ ///
+ /// XE is disabled
+ ///
+ return EFI_SUCCESS;
+ }
+
+ TurboRatioLimit.Qword = AsmReadMsr64 (MSR_TURBO_RATIO_LIMIT);
+ OneCoreRatioLimit = (UINT8) (TurboRatioLimit.Dwords.Low & B_MSR_TURBO_RATIO_LIMIT_1C);
+ TwoCoreRatioLimit = (UINT8) RShiftU64 (
+ (TurboRatioLimit.Dwords.Low & B_MSR_TURBO_RATIO_LIMIT_2C),
+ N_MSR_TURBO_RATIO_LIMIT_2C
+ );
+ ThreeCoreRatioLimit = (UINT8) RShiftU64 (
+ (TurboRatioLimit.Dwords.Low & B_MSR_TURBO_RATIO_LIMIT_3C),
+ N_MSR_TURBO_RATIO_LIMIT_3C
+ );
+ FourCoreRatioLimit = (UINT8) RShiftU64 (
+ (TurboRatioLimit.Dwords.Low & B_MSR_TURBO_RATIO_LIMIT_4C),
+ N_MSR_TURBO_RATIO_LIMIT_4C
+ );
+
+ ///
+ /// Check if XE capable
+ ///
+ FlexRatioMsr.Qword = AsmReadMsr64 (MSR_FLEX_RATIO);
+
+ ///
+ /// Overclocking availablity
+ ///
+ OverclockingBins = (UINT8) RShiftU64 ((FlexRatioMsr.Dwords.Low & B_OVERCLOCKING_BINS), N_OVERCLOCKING_BINS);
+
+ ///
+ /// Check if Turbo Ratio Limit is programmable
+ /// Platform Info MSR (0xCE) [28]
+ ///
+ TempMsr.Qword = AsmReadMsr64 (MSR_PLATFORM_INFO);
+ RatioLimitProgrammble = (UINT8) RShiftU64 (
+ (TempMsr.Qword & B_PLATFORM_INFO_RATIO_LIMIT),
+ N_PLATFORM_INFO_RATIO_LIMIT
+ );
+ ///
+ /// Get Maximum Non-Turbo bus ratio (HFM) from Platform Info MSR Bits[15:8]
+ ///
+ MaxBusRatio = TempMsr.Bytes.SecondByte;
+
+ ///
+ /// Check if processor turbo-ratio can be overriden:
+ /// BWG Section 14.14.2
+ /// If PLATFORM INFO MSR [28] == 1 and FLEX_RATIO MSR [19:17] != 0
+ /// Processor with capability to override turbo-ratio detected (either XE or Overclocking part detected)
+ ///
+ if ((RatioLimitProgrammble == 0) || (OverclockingBins == 0)) {
+ ///
+ /// Neither XE nor Overclocking Capable processor.
+ ///
+ DEBUG ((EFI_D_WARN, "WARNING: Trying to configure XE params on a non-XE processor\n"));
+ return EFI_SUCCESS;
+ }
+ ///
+ /// For Overclocking parts, verify ratio overide is within the allowable limits
+ ///
+ if ((RatioLimitProgrammble) && (OverclockingBins < MAX_OVERCLOCKING_BINS)) {
+ if (PowerMgmtConfig->RatioLimit[0] > (OneCoreRatioLimit + OverclockingBins)) {
+ PowerMgmtConfig->RatioLimit[0] = OneCoreRatioLimit + OverclockingBins;
+ }
+
+ if (PowerMgmtConfig->RatioLimit[1] > (TwoCoreRatioLimit + OverclockingBins)) {
+ PowerMgmtConfig->RatioLimit[1] = TwoCoreRatioLimit + OverclockingBins;
+ }
+
+ if (PowerMgmtConfig->RatioLimit[2] > (ThreeCoreRatioLimit + OverclockingBins)) {
+ PowerMgmtConfig->RatioLimit[2] = ThreeCoreRatioLimit + OverclockingBins;
+ }
+
+ if (PowerMgmtConfig->RatioLimit[3] > (FourCoreRatioLimit + OverclockingBins)) {
+ PowerMgmtConfig->RatioLimit[3] = FourCoreRatioLimit + OverclockingBins;
+ }
+ }
+
+ if ((RatioLimitProgrammble)) {
+ ///
+ /// Now initialize turbo ratio limit MSR
+ /// Find the number of active cores and initialize the ratio limits only if they are available.
+ /// Also program the VID value for the new max Turbo ratio by programming Flex Ratio MSR.
+ ///
+ TempMsr.Qword = AsmReadMsr64 (MSR_CORE_THREAD_COUNT);
+ CoreCount = (UINT8) RShiftU64 (TempMsr.Dwords.Low, N_CORE_COUNT_OFFSET);
+
+ if (PowerMgmtConfig->RatioLimit[0] >= PowerMgmtConfig->RatioLimit[1] &&
+ PowerMgmtConfig->RatioLimit[0] >= PowerMgmtConfig->RatioLimit[2] &&
+ PowerMgmtConfig->RatioLimit[0] >= PowerMgmtConfig->RatioLimit[3] &&
+ PowerMgmtConfig->RatioLimit[1] >= MaxBusRatio &&
+ PowerMgmtConfig->RatioLimit[2] >= MaxBusRatio &&
+ PowerMgmtConfig->RatioLimit[3] >= MaxBusRatio
+ ) {
+ if (CoreCount >= 1) {
+ TurboRatioLimit.Dwords.Low &= ~B_MSR_TURBO_RATIO_LIMIT_1C;
+ TurboRatioLimit.Dwords.Low |= PowerMgmtConfig->RatioLimit[0];
+ }
+
+ if (CoreCount >= 2) {
+ TurboRatioLimit.Dwords.Low &= ~B_MSR_TURBO_RATIO_LIMIT_2C;
+ TurboRatioLimit.Dwords.Low |= LShiftU64 (PowerMgmtConfig->RatioLimit[1], 8);
+ }
+
+ if (CoreCount >= 3) {
+ TurboRatioLimit.Dwords.Low &= ~B_MSR_TURBO_RATIO_LIMIT_3C;
+ TurboRatioLimit.Dwords.Low |= LShiftU64 (PowerMgmtConfig->RatioLimit[2], 16);
+ }
+
+ if (CoreCount >= 4) {
+ TurboRatioLimit.Dwords.Low &= ~B_MSR_TURBO_RATIO_LIMIT_4C;
+ TurboRatioLimit.Dwords.Low |= LShiftU64 (PowerMgmtConfig->RatioLimit[3], 24);
+ }
+
+ AsmWriteMsr64 (MSR_TURBO_RATIO_LIMIT, TurboRatioLimit.Qword);
+ }
+ }
+
+ ///
+ /// For Overclocking parts, if a non-default ring ratio is specificed, we need to
+ /// update the ring ratio limit MSR's max limit
+ ///
+ if ((OverclockingBins != 0) && (OcConfig->ClrMaxOcTurboRatio != 0)) {
+ RingRatioMsr.Qword = AsmReadMsr64 (MSR_RING_RATIO_LIMIT);
+ RingRatioMsr.Bytes.FirstByte &= ~MSR_MAX_RING_RATIO_LIMIT_MASK;
+ RingRatioMsr.Bytes.FirstByte |= OcConfig->ClrMaxOcTurboRatio & MSR_MAX_RING_RATIO_LIMIT_MASK;
+ AsmWriteMsr64 (MSR_RING_RATIO_LIMIT, RingRatioMsr.Qword);
+ }
+ return EFI_SUCCESS;
+}
+
+/**
+ Initialize performance and power management features
+
+ @param[in] CpuPlatformPolicyPpi - The CPU Platform Policy PPI instance
+**/
+VOID
+ProcessorsPerfPowerInit (
+ IN OUT PEI_CPU_PLATFORM_POLICY_PPI *CpuPlatformPolicyPpi
+ )
+{
+ EFI_CPUID_REGISTER Cpuid = { 0, 0, 0, 0 };
+ MSR_REGISTER TempMsr;
+ UINT8 TccActivationOffsetProgrammable;
+ UINT16 MaxBusRatio;
+ UINT16 MinBusRatio;
+ UINT32 Remainder;
+ POWER_MGMT_CONFIG_PPI *PowerMgmtConfig;
+ MSR_REGISTER TurboRatioLimit;
+ UINT8 OneCoreRatioLimit;
+ MSR_REGISTER Ia32MiscEnable;
+ CPU_FAMILY CpuFamilyId;
+ CPU_STEPPING CpuStepping;
+ UINT8 TccActivationOffsetMask;
+ UINT32 WriteFivrSpreadCmd;
+ UINT32 ReadFivrSpreadCmd;
+ UINT32 ReadFivrSpreadData;
+ UINT32 WriteFivrSpreadData;
+ UINT32 MailboxStatus;
+
+ PowerMgmtConfig = CpuPlatformPolicyPpi->PowerMgmtConfig;
+ CpuFamilyId = GetCpuFamily();
+ CpuStepping = GetCpuStepping();
+
+ ///
+ /// Initializes Processor Prefetcher
+ ///
+ ProcessorsPrefetcherInitialization (
+ CpuPlatformPolicyPpi->CpuConfig->MlcStreamerPrefetcher,
+ CpuPlatformPolicyPpi->CpuConfig->MlcSpatialPrefetcher
+ );
+
+ TempMsr.Qword = AsmReadMsr64 (MSR_PLATFORM_INFO);
+
+ ///
+ /// Get Tcc Activation Offset Programmable Setting from Platform Info MSR Bits[30]
+ ///
+ TccActivationOffsetProgrammable = (UINT8) RShiftU64 (
+ (TempMsr.Qword & B_PLATFORM_INFO_PROG_TCC_ACTIVATION_OFFSET),
+ N_PLATFORM_INFO_PROG_TCC_ACTIVATION_OFFSET
+ );
+ ///
+ /// Get Maximum Non-Turbo bus ratio (HFM) from Platform Info MSR Bits[15:8]
+ ///
+ MaxBusRatio = TempMsr.Bytes.SecondByte;
+ ///
+ /// Get Maximum Efficiency bus ratio (LFM) from Platform Info MSR Bits[47:40]
+ ///
+ MinBusRatio = TempMsr.Bytes.SixthByte;
+ ///
+ /// Tcc activation offset in temperature target MSR changes from 4 bits [27:24] to 6 bits [29:24] on ULT C step onwards
+ ///
+ if ((CpuFamilyId == EnumCpuHswUlt) && (CpuStepping >= EnumHswUltC0)) {
+ TccActivationOffsetMask = 0x3F;
+ } else {
+ TccActivationOffsetMask = 0xF;
+ }
+ ///
+ /// If User slects TccActivationOffset greater than supported progam max supported.
+ ///
+ if(PowerMgmtConfig->TccActivationOffset > TccActivationOffsetMask){
+ PowerMgmtConfig->TccActivationOffset = TccActivationOffsetMask;
+ }
+ ///
+ /// First check if TCC Activation Offset is programmable PLATFORM INFO MSR [30]
+ /// If TCC Activation Offset is programable, program the TCC Activation offset value
+ /// from Policy, and the Tcc activation offset programming should be dependency on RESET_CPL done.
+ ///
+ if (TccActivationOffsetProgrammable) {
+ TempMsr.Qword = AsmReadMsr64 (MSR_TEMPERATURE_TARGET);
+ TempMsr.Dwords.Low &= ~(TccActivationOffsetMask << N_MSR_TEMPERATURE_TARGET_TCC_OFFSET_LIMIT);
+ PowerMgmtConfig->TccActivationOffset &= TccActivationOffsetMask;
+ TempMsr.Dwords.Low |= LShiftU64 (PowerMgmtConfig->TccActivationOffset, N_MSR_TEMPERATURE_TARGET_TCC_OFFSET_LIMIT);
+ AsmWriteMsr64 (MSR_TEMPERATURE_TARGET, TempMsr.Qword);
+ }
+ ///
+ /// Program Voltage regulator Current Limit's
+ ///
+ TempMsr.Qword = AsmReadMsr64 (MSR_VR_CURRENT_CONFIG);
+ TempMsr.Dwords.High &= ~PSIX_THRESHOLD_MASK;
+ if (CpuPlatformPolicyPpi->Revision >= PEI_CPU_PLATFORM_POLICY_PPI_REVISION_5) {
+ TempMsr.Dwords.High |= ((PowerMgmtConfig->Psi3Threshold << 20) | (PowerMgmtConfig->Psi2Threshold << 10) | PowerMgmtConfig->Psi1Threshold );
+ if ((CpuFamilyId == EnumCpuHswUlt) && (PowerMgmtConfig->VrPSI4enable)) {
+ TempMsr.Dwords.High |= (0x1 << 30);
+ }
+ }
+ if (PowerMgmtConfig->VrCurrentLimit != 0) {
+ ///
+ /// Check the VR_CURRENT_LOCK bit
+ ///
+ if ((TempMsr.Dwords.Low & B_CURRENT_LIMIT_LOCK) == 0) {
+ TempMsr.Dwords.Low &= ~B_CURRENT_LIMIT_MASK;
+ TempMsr.Dwords.Low |= PowerMgmtConfig->VrCurrentLimit;
+ } else {
+ DEBUG ((EFI_D_INFO, "PPM:: VR Current Limit in MSR_VR_CURRENT_CONFIG is locked\n"));
+ }
+ }
+ ///
+ /// Set CURRENT_LIMIT_LOCK bit in VR_Config_MSR
+ ///
+ if (PowerMgmtConfig->VrCurrentLimitLock) {
+ TempMsr.Dwords.Low |= B_CURRENT_LIMIT_LOCK;
+ }
+
+ AsmWriteMsr64 (MSR_VR_CURRENT_CONFIG, TempMsr.Qword);
+
+ if (CpuPlatformPolicyPpi->Revision >= PEI_CPU_PLATFORM_POLICY_PPI_REVISION_4) {
+ TempMsr.Qword = AsmReadMsr64 (MSR_VR_MISC_CONFIG);
+ TempMsr.Dwords.High = RRotU32 (TempMsr.Dwords.High, 8);
+ if (PowerMgmtConfig->VrMiscIoutSlope <= 1023) {
+ ///
+ /// Update IOUT_SLOPE [49:40]
+ /// Must be 0 to 0x3FF (1023 decimal)
+ ///
+ TempMsr.Dwords.High &= ~0x3FF;
+ TempMsr.Dwords.High |= PowerMgmtConfig->VrMiscIoutSlope;
+ }
+ TempMsr.Dwords.High = LRotU32 (TempMsr.Dwords.High, 8);
+ if ((PowerMgmtConfig->VrMiscIoutOffset != 0) && (PowerMgmtConfig->VrMiscIoutOffset <= 625)) {
+ ///
+ /// Update IOUT_OFFSET[39:32]
+ /// MSR encoding = int(value*2^8+0.0625) for positive offsets
+ /// inv(int(value*2^8+0.0625))+1 for negative offsets
+ /// +0.0625 could be ignored
+ ///
+ PowerMgmtConfig->VrMiscIoutOffset = (UINT16) DivU64x32Remainder (
+ (UINT64) MultU64x32 (PowerMgmtConfig->VrMiscIoutOffset, (UINT32) LShiftU64 (1, 8)),
+ 10000,
+ &Remainder
+ );
+ if (Remainder >= 5000) {
+ PowerMgmtConfig->VrMiscIoutOffset += 1;
+ }
+ if (PowerMgmtConfig->VrMiscIoutOffsetSign == 1) {
+ ///
+ /// This is negative offset
+ ///
+ PowerMgmtConfig->VrMiscIoutOffset = (UINT8) (~PowerMgmtConfig->VrMiscIoutOffset + 1);
+ }
+ TempMsr.Dwords.High &= ~0xFF;
+ TempMsr.Dwords.High |= PowerMgmtConfig->VrMiscIoutOffset;
+ }
+ AsmWriteMsr64 (MSR_VR_MISC_CONFIG, TempMsr.Qword);
+ }
+
+ if (CpuPlatformPolicyPpi->Revision >= PEI_CPU_PLATFORM_POLICY_PPI_REVISION_3) {
+ TempMsr.Qword = AsmReadMsr64 (MSR_VR_MISC_CONFIG);
+ TempMsr.Dwords.Low = RRotU32 (TempMsr.Dwords.Low, N_MSR_VR_MISC_CONFIG_MIN_VID_OFFSET);
+ ///
+ /// Update MIN_VID [31:24]
+ /// Must be 0 to 0xFF (255 decimal) resolution 10mV
+ /// 0 equal to 0mV; 0xFF (255 decimal) equal to 2550mV
+ ///
+ TempMsr.Dwords.Low &= ~B_MSR_VR_MISC_CONFIG_MIN_VID_MASK;
+ TempMsr.Dwords.Low |= PowerMgmtConfig->VrMiscMinVid;
+ TempMsr.Dwords.Low = LRotU32 (TempMsr.Dwords.Low, N_MSR_VR_MISC_CONFIG_MIN_VID_OFFSET);
+
+ ///
+ /// Update IDLE_EXIT_RAMP_RATE[50]
+ ///
+ TempMsr.Qword &= ~B_MSR_VR_MISC_CONFIG_IDLE_EXIT_RAMP_RATE;
+ if (PowerMgmtConfig->VrMiscIdleExitRampRate) {
+ TempMsr.Qword |= B_MSR_VR_MISC_CONFIG_IDLE_EXIT_RAMP_RATE;
+ }
+
+ ///
+ /// Update IDLE_ENTRY_RAMP_RATE[51]
+ ///
+ TempMsr.Qword &= ~B_MSR_VR_MISC_CONFIG_IDLE_ENTRY_RAMP_RATE;
+ if (PowerMgmtConfig->VrMiscIdleEntryRampRate) {
+ TempMsr.Qword |= B_MSR_VR_MISC_CONFIG_IDLE_ENTRY_RAMP_RATE;
+ }
+
+ ///
+ /// Update IDLE_ENTRY_DECAY_ENABLE[52]
+ ///
+ TempMsr.Qword &= ~B_MSR_VR_MISC_CONFIG_IDLE_ENTRY_DECAY_ENABLE;
+ if (PowerMgmtConfig->VrMiscIdleEntryDecayEnable) {
+ TempMsr.Qword |= B_MSR_VR_MISC_CONFIG_IDLE_ENTRY_DECAY_ENABLE;
+ }
+
+ if (CpuFamilyId == EnumCpuHswUlt) {
+ ///
+ /// Update IDLE_ENTRY_DECAY_ENABLE[52]
+ ///
+ TempMsr.Qword &= ~B_MSR_VR_MISC_CONFIG_SLOW_SLEW_RATE_CONFIG_MASK;
+ switch (PowerMgmtConfig->VrMiscSlowSlewRateConfig) {
+ case 1:
+ TempMsr.Qword |= V_MSR_VR_MISC_CONFIG_SLOW_SLEW_RATE_CONFIG_FAST_4;
+ break;
+ case 2:
+ TempMsr.Qword |= V_MSR_VR_MISC_CONFIG_SLOW_SLEW_RATE_CONFIG_FAST_8;
+ break;
+ case 3:
+ TempMsr.Qword |= V_MSR_VR_MISC_CONFIG_SLOW_SLEW_RATE_CONFIG_FAST_16;
+ break;
+ case 0:
+ default:
+ TempMsr.Qword |= V_MSR_VR_MISC_CONFIG_SLOW_SLEW_RATE_CONFIG_FAST_2;
+ break;
+ }
+ }
+ AsmWriteMsr64 (MSR_VR_MISC_CONFIG, TempMsr.Qword);
+
+ if (CpuFamilyId == EnumCpuHswUlt) {
+ TempMsr.Qword = AsmReadMsr64 (MSR_VR_MISC_CONFIG2);
+ ///
+ /// Update FAST_RAMP_VOLTAGE [7:0]
+ /// Must be 0 to 0xFF (255 decimal) resolution 10mV
+ /// 0 equal to 0mV; 0xFF (255 decimal) equal to 2550mV
+ ///
+ TempMsr.Bytes.FirstByte &= ~B_MSR_VR_MISC_CONFIG2_FAST_RAMP_VOLTAGE_MASK;
+ TempMsr.Bytes.FirstByte |= PowerMgmtConfig->VrMisc2FastRampVoltage;
+
+ ///
+ /// Update MIN_C8_VOLTAGE [15:8]
+ /// Must be 0 to 0xFF (255 decimal) resolution 10mV
+ /// 0 equal to 0mV; 0xFF (255 decimal) equal to 2550mV
+ ///
+ TempMsr.Bytes.SecondByte &= ~B_MSR_VR_MISC_CONFIG2_MIN_C8_VOLTAGE_MASK;
+ TempMsr.Bytes.SecondByte |= PowerMgmtConfig->VrMisc2MinC8Voltage;
+
+ AsmWriteMsr64 (MSR_VR_MISC_CONFIG2, TempMsr.Qword);
+ }
+ }
+ ///
+ /// Initializes XE OR Overclocking support
+ ///
+ XeInit (CpuPlatformPolicyPpi->PowerMgmtConfig, CpuPlatformPolicyPpi->OverclockingConfig);
+
+ ///
+ /// Set processor P state to HFM, LFM or TURBO
+ ///
+ AsmCpuid (CPUID_VERSION_INFO, &Cpuid.RegEax, &Cpuid.RegEbx, &Cpuid.RegEcx, &Cpuid.RegEdx);
+ ///
+ /// Check to see if CPU is GV3 capable - GV3 is fused Enabled
+ ///
+ if ((Cpuid.RegEcx & B_CPUID_VERSION_INFO_ECX_EIST) == B_CPUID_VERSION_INFO_ECX_EIST) {
+ Ia32MiscEnable.Qword = AsmReadMsr64 (MSR_IA32_MISC_ENABLE);
+ Ia32MiscEnable.Qword |= B_MSR_IA32_MISC_ENABLE_EIST;
+ AsmWriteMsr64 (MSR_IA32_MISC_ENABLE, Ia32MiscEnable.Qword);
+
+ TempMsr.Qword = AsmReadMsr64 (MSR_IA32_PERF_CTRL);
+ TempMsr.Qword &= ~B_IA32_PERF_CTRLP_STATE_TARGET;
+
+ if ((CpuPlatformPolicyPpi->Revision >= PEI_CPU_PLATFORM_POLICY_PPI_REVISION_3) && (PowerMgmtConfig->BootInLfm == 2)) {
+ ///
+ /// Set processor P state as TURBO_RATIO_LIMIT_1C if available
+ ///
+ AsmCpuid (CPUID_POWER_MANAGEMENT_PARAMS, &Cpuid.RegEax, &Cpuid.RegEbx, &Cpuid.RegEcx, &Cpuid.RegEdx);
+ if (((Cpuid.RegEax & B_CPUID_POWER_MANAGEMENT_EAX_TURBO) == B_CPUID_POWER_MANAGEMENT_EAX_TURBO) ||
+ ((Ia32MiscEnable.Qword & B_MSR_IA32_MISC_DISABLE_TURBO) == B_MSR_IA32_MISC_DISABLE_TURBO)) {
+ ///
+ /// Temporarily enable Turbo and it will be reset in DXE phase
+ ///
+ Ia32MiscEnable.Qword &= ~B_MSR_IA32_MISC_DISABLE_TURBO;
+ AsmWriteMsr64 (MSR_IA32_MISC_ENABLE, Ia32MiscEnable.Qword);
+ ///
+ /// Set processor P state as TURBO_RATIO_LIMIT_1C
+ ///
+ TurboRatioLimit.Qword = AsmReadMsr64 (MSR_TURBO_RATIO_LIMIT);
+ OneCoreRatioLimit = (UINT8) (TurboRatioLimit.Dwords.Low & B_MSR_TURBO_RATIO_LIMIT_1C);
+ TempMsr.Qword |= LShiftU64 (OneCoreRatioLimit, N_IA32_PERF_CTRLP_STATE_TARGET);
+ } else {
+ ///
+ /// Turbo is not available, down to HFM
+ ///
+ DEBUG ((EFI_D_INFO, "CPU: Turbo mode is not available, down to HFM mode.\n"));
+ TempMsr.Qword |= LShiftU64 (MaxBusRatio, N_IA32_PERF_CTRLP_STATE_TARGET);
+ }
+ } else if (PowerMgmtConfig->BootInLfm == CPU_FEATURE_DISABLE) {
+ ///
+ /// Set processor P state as HFM
+ ///
+ TempMsr.Qword |= LShiftU64 (MaxBusRatio, N_IA32_PERF_CTRLP_STATE_TARGET);
+ } else {
+ ///
+ /// Set processor P state as LFM
+ ///
+ TempMsr.Qword |= LShiftU64 (MinBusRatio, N_IA32_PERF_CTRLP_STATE_TARGET);
+ }
+
+ AsmWriteMsr64 (MSR_IA32_PERF_CTRL, TempMsr.Qword);
+ }
+
+ ///
+ /// FIVR Spread Spectrum control is available on C0 steppings onward for all CPU families
+ ///
+ if ((CpuFamilyId == EnumCpuHswUlt && CpuStepping >= EnumHswUltC0) ||
+ (CpuFamilyId == EnumCpuHsw && CpuStepping >= EnumHswC0) ||
+ (CpuFamilyId == EnumCpuCrw && CpuStepping >= EnumCrwC0)){
+
+ ///
+ /// FivrSscPercent is specified in 1/10th percent increments. Range is 0-249.
+ ///
+ if (PowerMgmtConfig->FivrSscPercent > MAX_FIVR_SSC_PERCENT) {
+ PowerMgmtConfig->FivrSscPercent = MAX_FIVR_SSC_PERCENT;
+ }
+
+ ///
+ /// Read current FIVR SSC Spread percentage
+ ///
+ ReadFivrSpreadCmd = 0x8000000E;
+ ReadFivrSpreadData = 0;
+ MailboxRead(MAILBOX_TYPE_PCODE, ReadFivrSpreadCmd, &ReadFivrSpreadData, &MailboxStatus);
+
+//(AMI_CHG)>
+ {
+ UINT32 i = 0;
+ while (MailboxStatus == PCODE_MAILBOX_CC_VR_INTERFACE_LOCKED) {
+ MailboxRead(MAILBOX_TYPE_PCODE, ReadFivrSpreadCmd, &ReadFivrSpreadData, &MailboxStatus);
+ i++;
+ if (i == 100) break;
+ }
+ }
+//<(AMI_CHG)
+
+ if (PowerMgmtConfig->FivrSscEnable) {
+ WriteFivrSpreadData = ( ((PowerMgmtConfig->FivrSscPercent)*1024)/NUM_TENTHS_TO_PERCENTAGE) | FIVR_SSC_LOCK_BIT;
+ }
+ else {
+ ///
+ /// If disabling FIVR SSC, send 0% spread and lock interface
+ ///
+
+ WriteFivrSpreadData = FIVR_SSC_LOCK_BIT;
+ }
+
+ DEBUG ((EFI_D_INFO, "FIVR: Read FIVR Spread = %X, Write FIVR Spread = %X\n", ReadFivrSpreadData, WriteFivrSpreadData));
+ ///
+ /// Only update SSC percentage if needed
+ ///
+ if (ReadFivrSpreadData != WriteFivrSpreadData) {
+ DEBUG ((EFI_D_INFO, "FIVR: Update FIVR Spread = %X\n", WriteFivrSpreadData));
+
+ WriteFivrSpreadCmd = 0x8000000F;
+ MailboxWrite(MAILBOX_TYPE_PCODE, WriteFivrSpreadCmd, WriteFivrSpreadData, &MailboxStatus);
+
+//(AMI_CHG)>
+ {
+ UINT32 i = 0;
+ while (MailboxStatus == PCODE_MAILBOX_CC_VR_INTERFACE_LOCKED) {
+ MailboxWrite(MAILBOX_TYPE_PCODE, WriteFivrSpreadCmd, WriteFivrSpreadData, &MailboxStatus);
+ i++;
+ if (i == 100) break;
+ }
+ }
+//<(AMI_CHG)
+
+ if (MailboxStatus != PCODE_MAILBOX_CC_SUCCESS) {
+ DEBUG ((EFI_D_ERROR, "FIVR: Error updating FIVR Spread. Mailbox Status = %X\n", MailboxStatus));
+ }
+ }
+ }
+ else {
+ DEBUG ((EFI_D_ERROR, "FIVR: FIVR Spread adjustment requires C0 stepping or greater. Bypassing FIVR Spread flow.\n"));
+ }
+
+ return;
+}
+
+/**
+ Loads the Processor Microcode & Install the Cache PPI
+
+ @param[in] FfsHeader - Pointer to an alleged FFS file.
+ @param[in] PeiServices - General purpose services available to every PEIM.
+
+ @retval EFI_STATUS - the status code returned from any sub-routine
+**/
+EFI_STATUS
+PeimInitializeCpu (
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_STATUS Status;
+ PEI_CPU_PLATFORM_POLICY_PPI *CpuPlatformPolicyPpi;
+
+ Status = PeiServicesLocatePpi (
+ &gPeiCpuPlatformPolicyPpiGuid,
+ 0,
+ NULL,
+ (VOID **) &CpuPlatformPolicyPpi
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+
+ }
+
+ //
+ // Dump Cpu Platform Policy
+ //
+ CpuPeiPolicyDump(CpuPlatformPolicyPpi);
+
+ ///
+ /// Install Cache PPI
+ ///
+ Status = CacheInitPpiInit ();
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Install Notify
+ ///
+ Status = PeiServicesNotifyPpi (&mNotifyList[0]);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Initializes Overclocking support
+ ///
+ CpuOcInit(PeiServices, CpuPlatformPolicyPpi);
+
+ ///
+ /// Initializes Performance and Power Settings
+ ///
+ ProcessorsPerfPowerInit (CpuPlatformPolicyPpi);
+
+ ///
+ /// Init XMM support
+ ///
+ XmmInit ();
+
+ ///
+ /// Pfat Initialization
+ ///
+ PfatInit (PeiServices, CpuPlatformPolicyPpi);
+
+ ///
+ /// Boot Guard Initializatoin
+ ///
+ BootGuardInit (PeiServices, CpuPlatformPolicyPpi);
+
+ return Status;
+}
+
+/**
+ Build BIST HOB
+
+ @param[in] PeiServices - Indirect reference to the PEI Services Table.
+ @param[in] NotifyDescriptor - Address of the notification descriptor data structure. Type
+ EFI_PEI_NOTIFY_DESCRIPTOR is defined above.
+ @param[in] Ppi - Address of the PPI that was installed.
+
+ @retval EFI_SUCCESS - Hob built or not necessary
+**/
+EFI_STATUS
+EFIAPI
+BuildBistHob (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
+ IN VOID *Ppi
+ )
+{
+ EFI_STATUS Status;
+ EFI_BOOT_MODE BootMode;
+ EFI_SEC_PLATFORM_INFORMATION_PPI *SecPlatformInformationPpi;
+ UINT64 InformationSize;
+ SEC_PLATFORM_INFORMATION_RECORD *SecPlatformInformation;
+ VOID *Hob;
+
+ Status = (**PeiServices).GetBootMode (PeiServices, &BootMode);
+ if (!EFI_ERROR (Status) && (BootMode == BOOT_ON_S3_RESUME)) {
+ return EFI_SUCCESS;
+ }
+
+ Status = PeiServicesLocatePpi (
+ &gEfiSecPlatformInformationPpiGuid, ///< GUID
+ 0, ///< INSTANCE
+ NULL, ///< EFI_PEI_PPI_DESCRIPTOR
+ (VOID ** ) &SecPlatformInformationPpi ///< PPI
+ );
+
+ if (Status == EFI_NOT_FOUND) {
+ return EFI_SUCCESS;
+ }
+
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ InformationSize = 0;
+ SecPlatformInformation = NULL;
+ Status = SecPlatformInformationPpi->PlatformInformation (
+ PeiServices,
+ &InformationSize,
+ SecPlatformInformation
+ );
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ Status = PeiServicesAllocatePool (
+ (UINTN) InformationSize,
+ (VOID **) &SecPlatformInformation
+ );
+
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = SecPlatformInformationPpi->PlatformInformation (
+ PeiServices,
+ &InformationSize,
+ SecPlatformInformation
+ );
+ }
+
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Hob = BuildGuidDataHob (
+ &gEfiHtBistHobGuid,
+ SecPlatformInformation,
+ (UINTN) InformationSize
+ );
+ ASSERT (Hob != NULL);
+
+ return Status;
+}
+
+/**
+ Dump RC CPU and PPM platform policies
+
+ @param[in] CpuPlatformPolicyPpi - Address of the cpu platform policy ppi.
+**/
+VOID
+CpuPeiPolicyDump (
+ IN PEI_CPU_PLATFORM_POLICY_PPI *CpuPlatformPolicyPpi
+ )
+{
+#ifdef EFI_DEBUG
+ UINTN Index;
+ CPU_CONFIG_PPI *CpuConfig;
+ POWER_MGMT_CONFIG_PPI *PowerMgmtConfig;
+ SECURITY_CONFIG_PPI *SecurityConfig;
+ OVERCLOCKING_CONFIG_PPI *OverclockingConfig;
+
+ CpuConfig = CpuPlatformPolicyPpi->CpuConfig;
+ PowerMgmtConfig = CpuPlatformPolicyPpi->PowerMgmtConfig;
+ SecurityConfig = CpuPlatformPolicyPpi->SecurityConfig;
+ OverclockingConfig = CpuPlatformPolicyPpi->OverclockingConfig;
+
+ DEBUG ((EFI_D_INFO, "\n------------------------ CpuPlatformPolicyPpi Dump Begin -----------------\n"));
+ //
+ // CPU_CONFIG
+ //
+ DEBUG ((EFI_D_INFO, " CPU:: BistOnReset : 0x%X\n", CpuConfig->BistOnReset));
+ DEBUG ((EFI_D_INFO, " CPU:: HyperThreading : 0x%X\n", CpuConfig->HyperThreading));
+ DEBUG ((EFI_D_INFO, " CPU:: CpuRatioOverride : 0x%X\n", CpuConfig->CpuRatioOverride));
+ DEBUG ((EFI_D_INFO, " CPU:: VmxEnable : 0x%X\n", CpuConfig->VmxEnable));
+ DEBUG ((EFI_D_INFO, " CPU:: Pfat Feature: 0x%X\n", CpuConfig->Pfat));
+ DEBUG ((EFI_D_INFO, " CPU:: MlcStreamerPrefetcher : 0x%X\n", CpuConfig->MlcStreamerPrefetcher));
+ DEBUG ((EFI_D_INFO, " CPU:: MlcSpatialPrefetcher : 0x%X\n", CpuConfig->MlcSpatialPrefetcher));
+ DEBUG ((EFI_D_INFO, " CPU:: ActiveCoreCount : 0x%X\n", CpuConfig->ActiveCoreCount));
+ DEBUG ((EFI_D_INFO, " CPU:: CpuRatio : 0x%X\n", CpuConfig->CpuRatio));
+ DEBUG ((EFI_D_INFO, " CPU:: MaxNonTurboRatio : 0x%X\n", CpuConfig->CpuMaxNonTurboRatio));
+ //
+ // POWER_MGMT_CONFIG
+ //
+ DEBUG ((EFI_D_INFO, " PPM:: BootInLfm : 0x%X\n", PowerMgmtConfig->BootInLfm));
+ DEBUG ((EFI_D_INFO, " PPM:: TccActivationOffset : 0x%X\n", PowerMgmtConfig->TccActivationOffset));
+ DEBUG ((EFI_D_INFO, " PPM:: VrCurrentLimit : 0x%X\n", PowerMgmtConfig->VrCurrentLimit));
+ DEBUG ((EFI_D_INFO, " PPM:: VrCurrentLimitLock : 0x%X\n", PowerMgmtConfig->VrCurrentLimitLock));
+ DEBUG ((EFI_D_INFO, " PPM:: Xe : 0x%X\n", PowerMgmtConfig->Xe));
+ DEBUG ((EFI_D_INFO, " PPM:: RatioLimit[4] : 0x%X , 0x%X , 0x%X , 0x%X \n", PowerMgmtConfig->RatioLimit[0], \
+ PowerMgmtConfig->RatioLimit[1], \
+ PowerMgmtConfig->RatioLimit[2], \
+ PowerMgmtConfig->RatioLimit[3]));
+ DEBUG ((EFI_D_INFO, " PPM:: VrMiscIoutSlope : 0x%X\n", PowerMgmtConfig->VrMiscIoutSlope));
+ DEBUG ((EFI_D_INFO, " PPM:: VrMiscIoutOffsetSign : 0x%X\n", PowerMgmtConfig->VrMiscIoutOffsetSign));
+ DEBUG ((EFI_D_INFO, " PPM:: VrMiscIoutOffset : 0x%X\n", PowerMgmtConfig->VrMiscIoutOffset));
+ DEBUG ((EFI_D_INFO, " PPM:: VrMiscMinVid : 0x%X\n", PowerMgmtConfig->VrMiscMinVid));
+ DEBUG ((EFI_D_INFO, " PPM:: VrMiscIdleExitRampRate : 0x%X\n", PowerMgmtConfig->VrMiscIdleExitRampRate));
+ DEBUG ((EFI_D_INFO, " PPM:: VrMiscIdleEntryRampRate : 0x%X\n", PowerMgmtConfig->VrMiscIdleEntryRampRate));
+ DEBUG ((EFI_D_INFO, " PPM:: VrMiscIdleEntryDecayEnable : 0x%X\n", PowerMgmtConfig->VrMiscIdleEntryDecayEnable));
+ DEBUG ((EFI_D_INFO, " PPM:: VrMiscSlowSlewRateConfig : 0x%X\n", PowerMgmtConfig->VrMiscSlowSlewRateConfig));
+ DEBUG ((EFI_D_INFO, " PPM:: VrMisc2FastRampVoltage : 0x%X\n", PowerMgmtConfig->VrMisc2FastRampVoltage));
+ DEBUG ((EFI_D_INFO, " PPM:: VrMisc2MinC8Voltage : 0x%X\n", PowerMgmtConfig->VrMisc2MinC8Voltage));
+ DEBUG ((EFI_D_INFO, " PPM:: FivrSscEnable : 0x%X\n", PowerMgmtConfig->FivrSscEnable));
+ DEBUG ((EFI_D_INFO, " PPM:: FivrSscPercent : 0x%X\n", PowerMgmtConfig->FivrSscPercent));
+
+ //
+ // SECURITY_CONFIG : PFAT_CONFIG
+ //
+ DEBUG ((EFI_D_INFO, " PFAT:: PUP_HEADER : Version : 0x%X\n", SecurityConfig->PfatConfig->PupHeader.Version));
+ DEBUG ((EFI_D_INFO, " PFAT:: PUP_HEADER : PlatId[16] :\n"));
+ for (Index = 0; Index < 16; Index++) {
+ if (Index == 15) {
+ DEBUG ((EFI_D_INFO, " 0x%X\n", SecurityConfig->PfatConfig->Ppdt.PlatId[Index]));
+ } else {
+ DEBUG ((EFI_D_INFO, " 0x%X ,", SecurityConfig->PfatConfig->Ppdt.PlatId[Index]));
+ }
+ }
+ DEBUG ((EFI_D_INFO, " \n"));
+ DEBUG ((EFI_D_INFO, " PFAT:: PUP_HEADER : PkgAttributes : 0x%X\n", SecurityConfig->PfatConfig->PupHeader.PkgAttributes));
+ DEBUG ((EFI_D_INFO, " PFAT:: PUP_HEADER : PslMajorVer : 0x%X\n", SecurityConfig->PfatConfig->PupHeader.PslMajorVer));
+ DEBUG ((EFI_D_INFO, " PFAT:: PUP_HEADER : PslMinorVer : 0x%X\n", SecurityConfig->PfatConfig->PupHeader.PslMinorVer));
+ DEBUG ((EFI_D_INFO, " PFAT:: PUP_HEADER : ScriptSectionSize : 0x%X\n", SecurityConfig->PfatConfig->PupHeader.ScriptSectionSize));
+ DEBUG ((EFI_D_INFO, " PFAT:: PUP_HEADER : DataSectionSize : 0x%X\n", SecurityConfig->PfatConfig->PupHeader.DataSectionSize));
+ DEBUG ((EFI_D_INFO, " PFAT:: PUP_HEADER : BiosSvn : 0x%X\n", SecurityConfig->PfatConfig->PupHeader.BiosSvn));
+ DEBUG ((EFI_D_INFO, " PFAT:: PUP_HEADER : EcSvn : 0x%X\n", SecurityConfig->PfatConfig->PupHeader.EcSvn));
+ DEBUG ((EFI_D_INFO, " PFAT:: PUP_HEADER : VendorSpecific : 0x%X\n", SecurityConfig->PfatConfig->PupHeader.VendorSpecific));
+ DEBUG ((EFI_D_INFO, " PFAT:: PPDT : PpdtSize : 0x%X\n", SecurityConfig->PfatConfig->Ppdt.PpdtSize));
+ DEBUG ((EFI_D_INFO, " PFAT:: PPDT : PpdtMajVer : 0x%X\n", SecurityConfig->PfatConfig->Ppdt.PpdtMajVer));
+ DEBUG ((EFI_D_INFO, " PFAT:: PPDT : PpdtMinVer : 0x%X\n", SecurityConfig->PfatConfig->Ppdt.PpdtMinVer));
+ DEBUG ((EFI_D_INFO, " PFAT:: PPDT : PlatId[16] :\n"));
+ for (Index = 0; Index < 16; Index++) {
+ if (Index == 15) {
+ DEBUG ((EFI_D_INFO, " 0x%X\n", SecurityConfig->PfatConfig->Ppdt.PlatId[Index]));
+ } else {
+ DEBUG ((EFI_D_INFO, " 0x%X ,", SecurityConfig->PfatConfig->Ppdt.PlatId[Index]));
+ }
+ }
+ DEBUG ((EFI_D_INFO, " \n"));
+ DEBUG ((EFI_D_INFO, " PFAT:: PPDT : PkeySlot0[32] :\n"));
+ for (Index = 0; Index < 32; Index++) {
+ if ((Index == 15) || (Index == 31)) {
+ DEBUG ((EFI_D_INFO, " 0x%X\n", SecurityConfig->PfatConfig->Ppdt.PkeySlot0[Index]));
+ } else {
+ DEBUG ((EFI_D_INFO, " 0x%X ,", SecurityConfig->PfatConfig->Ppdt.PkeySlot0[Index]));
+ }
+ }
+ DEBUG ((EFI_D_INFO, " \n"));
+ DEBUG ((EFI_D_INFO, " PFAT:: PPDT : PkeySlot1[32] :\n"));
+ for (Index = 0; Index < 32; Index++) {
+ if ((Index == 15) || (Index == 31)) {
+ DEBUG ((EFI_D_INFO, " 0x%X\n", SecurityConfig->PfatConfig->Ppdt.PkeySlot1[Index]));
+ } else {
+ DEBUG ((EFI_D_INFO, " 0x%X ,", SecurityConfig->PfatConfig->Ppdt.PkeySlot1[Index]));
+ }
+ }
+ DEBUG ((EFI_D_INFO, " \n"));
+ DEBUG ((EFI_D_INFO, " PFAT:: PPDT : PkeySlot2[32] :\n"));
+ for (Index = 0; Index < 32; Index++) {
+ if ((Index == 15)|| (Index == 31)) {
+ DEBUG ((EFI_D_INFO, " 0x%X\n", SecurityConfig->PfatConfig->Ppdt.PkeySlot2[Index]));
+ } else {
+ DEBUG ((EFI_D_INFO, " 0x%X ,", SecurityConfig->PfatConfig->Ppdt.PkeySlot2[Index]));
+ }
+ }
+ DEBUG ((EFI_D_INFO, " \n"));
+ DEBUG ((EFI_D_INFO, " PFAT:: PPDT : PfatModSvn : 0x%X\n", SecurityConfig->PfatConfig->Ppdt.PfatModSvn));
+ DEBUG ((EFI_D_INFO, " PFAT:: PPDT : BiosSvn : 0x%X\n", SecurityConfig->PfatConfig->Ppdt.BiosSvn));
+ DEBUG ((EFI_D_INFO, " PFAT:: PPDT : ExecLim : 0x%X\n", SecurityConfig->PfatConfig->Ppdt.ExecLim));
+ DEBUG ((EFI_D_INFO, " PFAT:: PPDT : PlatAttr : 0x%X\n", SecurityConfig->PfatConfig->Ppdt.PlatAttr));
+ DEBUG ((EFI_D_INFO, " PFAT:: PPDT : EcCmd : 0x%X\n", SecurityConfig->PfatConfig->Ppdt.EcCmd));
+ DEBUG ((EFI_D_INFO, " PFAT:: PPDT : EcData : 0x%X\n", SecurityConfig->PfatConfig->Ppdt.EcData));
+ DEBUG ((EFI_D_INFO, " PFAT:: PPDT : EcCmdGetSvn : 0x%X\n", SecurityConfig->PfatConfig->Ppdt.EcCmdGetSvn));
+ DEBUG ((EFI_D_INFO, " PFAT:: PPDT : EcCmdOpen : 0x%X\n", SecurityConfig->PfatConfig->Ppdt.EcCmdOpen));
+ DEBUG ((EFI_D_INFO, " PFAT:: PPDT : EcCmdClose : 0x%X\n", SecurityConfig->PfatConfig->Ppdt.EcCmdClose));
+ DEBUG ((EFI_D_INFO, " PFAT:: PPDT : EcCmdPortTest : 0x%X\n", SecurityConfig->PfatConfig->Ppdt.EcCmdPortTest));
+ DEBUG ((EFI_D_INFO, " PFAT:: PPDT : LastSfam : 0x%X\n", SecurityConfig->PfatConfig->Ppdt.LastSfam));
+ DEBUG ((EFI_D_INFO, " PFAT:: PPDT : SfamData[64] :\n"));
+ //
+ // Change the array size according to MAX_SFAM_COUNT
+ //
+ for (Index = 0; Index < 64; Index++) {
+ if ((Index == 15) || (Index == 31) || (Index == 47) || (Index == 63) ) {
+ DEBUG ((EFI_D_INFO, " 0x%X\n", SecurityConfig->PfatConfig->Ppdt.SfamData[Index]));
+ } else {
+ DEBUG ((EFI_D_INFO, " 0x%X ,", SecurityConfig->PfatConfig->Ppdt.SfamData[Index]));
+ }
+ }
+ DEBUG ((EFI_D_INFO, " \n"));
+ DEBUG ((EFI_D_INFO, " PFAT:: PpdtHash[4] : 0x%lX , 0x%lX , 0x%lX , 0x%lX \n", SecurityConfig->PfatConfig->PpdtHash[0], \
+ SecurityConfig->PfatConfig->PpdtHash[1], \
+ SecurityConfig->PfatConfig->PpdtHash[2], \
+ SecurityConfig->PfatConfig->PpdtHash[3]));
+
+ DEBUG ((EFI_D_INFO, " PFAT:: NumSpiComponents : 0x%x\n", SecurityConfig->PfatConfig->NumSpiComponents));
+ DEBUG ((EFI_D_INFO, " PFAT:: PPDT : ComponentSize[8] :\n"));
+ for (Index = 0; Index < SecurityConfig->PfatConfig->NumSpiComponents; Index++) {
+ if (Index == 7) {
+ DEBUG ((EFI_D_INFO, " 0x%X\n", SecurityConfig->PfatConfig->ComponentSize[Index]));
+ } else {
+ DEBUG ((EFI_D_INFO, " 0x%X ,", SecurityConfig->PfatConfig->ComponentSize[Index]));
+ }
+ }
+ DEBUG ((EFI_D_INFO, " \n"));
+ DEBUG ((EFI_D_INFO, " PFAT:: PfatMemSize : 0x%X\n", SecurityConfig->PfatConfig->PfatMemSize));
+ DEBUG ((EFI_D_INFO, " PFAT:: EcCmdDiscovery : 0x%X\n", SecurityConfig->PfatConfig->EcCmdDiscovery));
+ DEBUG ((EFI_D_INFO, " PFAT:: EcCmdProvisionEav : 0x%X\n", SecurityConfig->PfatConfig->EcCmdProvisionEav));
+ DEBUG ((EFI_D_INFO, " PFAT:: EcCmdLock : 0x%X\n", SecurityConfig->PfatConfig->EcCmdLock));
+ DEBUG ((EFI_D_INFO, " PFAT:: PFATLOG:: Version : 0x%X\n", SecurityConfig->PfatConfig->PfatLog.Version));
+ DEBUG ((EFI_D_INFO, " PFAT:: PFATLOG:: LastPage : 0x%X\n", SecurityConfig->PfatConfig->PfatLog.LastPage));
+ DEBUG ((EFI_D_INFO, " PFAT:: PFATLOG:: LoggingOptions : 0x%X\n", SecurityConfig->PfatConfig->PfatLog.LoggingOptions));
+ DEBUG ((EFI_D_INFO, " PFAT:: PFATLOG:: PfatModSvn : 0x%X\n", SecurityConfig->PfatConfig->PfatLog.PfatModSvn));
+ DEBUG ((EFI_D_INFO, " PFAT:: PFATLOG:: NumOfEntriesInLog : 0x%X\n", SecurityConfig->PfatConfig->PfatLog.NumOfEntriesInLog));
+ //
+ // SECURITY_CONFIG : TXT_CONFIG
+ //
+#if defined(TXT_SUPPORT_FLAG) && (TXT_SUPPORT_FLAG == 1)
+ DEBUG ((EFI_D_INFO, " TXT:: SinitMemorySize : 0x%lX\n", SecurityConfig->TxtConfig->SinitMemorySize));
+ DEBUG ((EFI_D_INFO, " TXT:: TxtHeapMemorySize : 0x%lX\n", SecurityConfig->TxtConfig->TxtHeapMemorySize));
+ DEBUG ((EFI_D_INFO, " TXT:: TxtDprMemoryBase : 0x%lX\n", SecurityConfig->TxtConfig->TxtDprMemoryBase));
+ DEBUG ((EFI_D_INFO, " TXT:: TxtDprMemorySize : 0x%lX\n", SecurityConfig->TxtConfig->TxtDprMemorySize));
+ DEBUG ((EFI_D_INFO, " TXT:: BiosAcmBase : 0x%lX\n", SecurityConfig->TxtConfig->BiosAcmBase));
+ DEBUG ((EFI_D_INFO, " TXT:: BiosAcmSize : 0x%lX\n", SecurityConfig->TxtConfig->BiosAcmSize));
+ DEBUG ((EFI_D_INFO, " TXT:: McuUpdateDataAddr : 0x%lX\n", SecurityConfig->TxtConfig->McuUpdateDataAddr));
+ DEBUG ((EFI_D_INFO, " TXT:: TgaSize : 0x%lX\n", SecurityConfig->TxtConfig->TgaSize));
+ DEBUG ((EFI_D_INFO, " TXT:: TxtLcpPdBase : 0x%lX\n", SecurityConfig->TxtConfig->TxtLcpPdBase));
+ DEBUG ((EFI_D_INFO, " TXT:: TxtLcpPdSize : 0x%lX\n", SecurityConfig->TxtConfig->TxtLcpPdSize));
+#else
+ DEBUG ((EFI_D_INFO, " TXT CONFIG:: UNSUPPORTED \n"));
+#endif
+
+ //
+ // OVERCLOCKING_CONFIG
+ //
+ DEBUG ((EFI_D_INFO, " OC:: CoreVoltageOffset : 0x%X\n", OverclockingConfig->CoreVoltageOffset));
+ DEBUG ((EFI_D_INFO, " OC:: CoreVoltageOverride : 0x%X\n", OverclockingConfig->CoreVoltageOverride));
+ DEBUG ((EFI_D_INFO, " OC:: CoreExtraTurboVoltage : 0x%X\n", OverclockingConfig->CoreExtraTurboVoltage));
+ DEBUG ((EFI_D_INFO, " OC:: CoreMaxOcTurboRatio : 0x%X\n", OverclockingConfig->CoreMaxOcTurboRatio));
+ DEBUG ((EFI_D_INFO, " OC:: ClrVoltageOffset : 0x%X\n", OverclockingConfig->ClrVoltageOffset));
+ DEBUG ((EFI_D_INFO, " OC:: ClrVoltageOverride : 0x%X\n", OverclockingConfig->ClrVoltageOverride));
+ DEBUG ((EFI_D_INFO, " OC:: ClrExtraTurboVoltage : 0x%X\n", OverclockingConfig->ClrExtraTurboVoltage));
+ DEBUG ((EFI_D_INFO, " OC:: ClrMaxOcTurboRatio : 0x%X\n", OverclockingConfig->ClrMaxOcTurboRatio));
+ DEBUG ((EFI_D_INFO, " OC:: SvidVoltageOverride : 0x%X\n", OverclockingConfig->SvidVoltageOverride));
+ DEBUG ((EFI_D_INFO, " OC:: SvidEnable : 0x%X\n", OverclockingConfig->SvidEnable));
+ DEBUG ((EFI_D_INFO, " OC:: FivrFaultsEnable : 0x%X\n", OverclockingConfig->FivrFaultsEnable));
+ DEBUG ((EFI_D_INFO, " OC:: FivrEfficiencyEnable : 0x%X\n", OverclockingConfig->FivrEfficiencyEnable));
+ DEBUG ((EFI_D_INFO, " OC:: CoreVoltageMode : 0x%X\n", OverclockingConfig->CoreVoltageMode));
+ DEBUG ((EFI_D_INFO, " OC:: ClrVoltageMode : 0x%X\n", OverclockingConfig->ClrVoltageMode));
+ DEBUG ((EFI_D_INFO, " OC:: OcSupport : 0x%X\n", OverclockingConfig->OcSupport));
+
+ DEBUG ((EFI_D_INFO, "\n------------------------ CpuPlatformPolicyPpi Dump End -----------------\n\n"));
+#endif
+}
diff --git a/ReferenceCode/Haswell/CpuInit/Pei/CpuInitPeim.dxs b/ReferenceCode/Haswell/CpuInit/Pei/CpuInitPeim.dxs
new file mode 100644
index 0000000..62f855b
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Pei/CpuInitPeim.dxs
@@ -0,0 +1,42 @@
+/** @file
+ Dependency expression source file.
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "PeimDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+#include EFI_PPI_DEFINITION (CpuPlatformPolicy)
+#endif
+
+DEPENDENCY_START
+
+ PEI_CPU_PLATFORM_POLICY_PPI_GUID
+
+DEPENDENCY_END
diff --git a/ReferenceCode/Haswell/CpuInit/Pei/CpuInitPeim.h b/ReferenceCode/Haswell/CpuInit/Pei/CpuInitPeim.h
new file mode 100644
index 0000000..9d6fac5
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Pei/CpuInitPeim.h
@@ -0,0 +1,212 @@
+/** @file
+ Describes the functions visible to the rest of the CpuPeim.
+
+@copyright
+ Copyright (c) 2010 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Pre-EFI Module' and is licensed
+ for Intel CPUs and Chipsets under the terms of your license
+ agreement with Intel or your vendor. This file may be
+ modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _CPU_INIT_PEIM_H_
+#define _CPU_INIT_PEIM_H_
+
+#include EFI_PPI_PRODUCER (Cache)
+#include EFI_PPI_DEFINITION (CpuPlatformPolicy)
+#include "CpuRegs.h"
+
+typedef struct {
+ UINT32 HtDisabled : 1;
+ UINT32 NumberOfActiveCores : 2;
+ UINT32 Reserved0 : 2;
+ UINT32 Bist : 1;
+ UINT32 FlexRatio : 6;
+ UINT32 Reserved1 : 4;
+ UINT32 Reserved2 : 16;
+} CPU_STRAP_SET;
+
+typedef UINT32 CPU_RESET_TYPE;
+
+typedef struct {
+ UINT64 MsrValue;
+ BOOLEAN Changed;
+} MTRR_VALUE;
+
+typedef struct {
+ PEI_CACHE_PPI Ppi;
+ EFI_PEI_PPI_DESCRIPTOR PpiDesc;
+ MTRR_VALUE FixedMtrrValue[V_FIXED_MTRR_NUMBER];
+ MTRR_VALUE VariableMtrrValue[V_MAXIMUM_VARIABLE_MTRR_NUMBER * 2];
+ BOOLEAN FixedMtrrChanged;
+ BOOLEAN VariableMtrrChanged;
+ BOOLEAN NemDisabledDone;
+} CACHE_PPI_INSTANCE;
+
+#define PEI_CACHE_PPI_INSTANCE_FROM_THIS(a) _CR (a, CACHE_PPI_INSTANCE, Ppi)
+
+///
+/// Breaking UINT64 MSR into DWORDs/BYTEs
+///
+#pragma pack(1)
+typedef union _MSR_REGISTER {
+ UINT64 Qword;
+
+ struct _DWORDS {
+ UINT32 Low;
+ UINT32 High;
+ } Dwords;
+
+ struct _BYTES {
+ UINT8 FirstByte;
+ UINT8 SecondByte;
+ UINT8 ThirdByte;
+ UINT8 FouthByte;
+ UINT8 FifthByte;
+ UINT8 SixthByte;
+ UINT8 SeventhByte;
+ UINT8 EighthByte;
+ } Bytes;
+
+} MSR_REGISTER;
+#pragma pack()
+#define NO_RESET 0
+#define CPU_ONLY_RESET 1
+#define WARM_RESET 2
+#define COLDRESET 3
+
+#define RESET_PPI_WARM_RESET 0
+#define RESET_PPI_COLD_RESET 3
+
+#define RESET_PORT 0x0CF9
+#define CLEAR_RESET_BITS 0x0F1
+#define PSIX_THRESHOLD_MASK 0x3FFFFFFF ///< Bits 61:32 - Mask value respect to Dword.High
+#define PSI1_THRESHOLD_VALUE 0x14
+#define PSI2_THRESHOLD_VALUE 0x05
+#define PSI3_THRESHOLD_VALUE 0x01
+
+#define MAX_OVERCLOCKING_BINS 0x7
+
+/**
+ Set up flags in CR4 for XMM instruction enabling
+**/
+VOID
+XmmInit (
+ VOID
+ );
+
+/**
+ Loads the Processor Microcode & Install the Cache PPI
+
+ @param[in] FfsHeader - Pointer to an alleged FFS file.
+ @param[in] PeiServices - General purpose services available to every PEIM.
+
+ @retval EFI_STATUS - the status code returned from any sub-routine
+**/
+EFI_STATUS
+PeimInitializeCpu (
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+ );
+
+/**
+ Install CacheInitPpi
+
+ @retval EFI_OUT_OF_RESOURCES - failed to allocate required pool
+**/
+EFI_STATUS
+CacheInitPpiInit (
+ VOID
+ );
+
+/**
+ Set CPU strap setting for feature change
+
+ @param[in] PeiServices - Indirect reference to the PEI Services Table.
+ @param[in] NotifyDescriptor - Address of the notification descriptor data structure. Type
+ EFI_PEI_NOTIFY_DESCRIPTOR is defined above.
+ @param[in] Ppi - Address of the PPI that was installed.
+
+ @retval EFI_SUCCESS - Function completed successfully
+**/
+EFI_STATUS
+EFIAPI
+SetCpuStrap (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
+ IN VOID *Ppi
+ );
+
+/**
+ Based on ResetType, perform warm or cold reset using PCH Reset PPI
+
+ @param[in] PeiServices - Indirect reference to the PEI Services Table.
+ @param[in] ResetType - CPU_RESET_TYPE to indicate which reset shoudl be performed.
+
+ @exception EFI_UNSUPPORTED - Reset type unsupported
+ @retval EFI_SUCCESS - function successfully (system should already reset)
+**/
+EFI_STATUS
+PerformWarmORColdReset (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN CPU_RESET_TYPE ResetType
+ );
+
+/**
+ Based on ResetType, perform warm or cold reset using PCH Reset PPI
+
+ @param[in] PeiServices
+ @param[in] CPU_RESET_TYPE
+
+ @retval EFI_STATUS
+
+ Build BIST HOB
+
+ @param[in] PeiServices - Indirect reference to the PEI Services Table.
+ @param[in] NotifyDescriptor - Address of the notification descriptor data structure. Type
+ EFI_PEI_NOTIFY_DESCRIPTOR is defined above.
+ @param[in] Ppi - Address of the PPI that was installed.
+
+ @retval EFI_SUCCESS - Hob built or not necessary
+**/
+EFI_STATUS
+EFIAPI
+BuildBistHob (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
+ IN VOID *Ppi
+ );
+
+/**
+ Dump RC CPU and PPM platform policies
+
+ @param[in] CpuPlatformPolicyPpi - Address of the cpu platform policy ppi.
+**/
+VOID
+CpuPeiPolicyDump(
+ IN PEI_CPU_PLATFORM_POLICY_PPI *CpuPlatformPolicyPpi
+ );
+
+/**
+
+ Perform the platform spefific initializations.
+
+ @param[in] PeiServices - Indirect reference to the PEI Services Table.
+ @param[in] CpuPlatformPolicyPpi - Platform Policy PPI
+
+**/
+VOID
+BootGuardInit (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_CPU_PLATFORM_POLICY_PPI *CpuPlatformPolicyPpi
+ );
+
+#endif
diff --git a/ReferenceCode/Haswell/CpuInit/Pei/CpuInitPeim.inf b/ReferenceCode/Haswell/CpuInit/Pei/CpuInitPeim.inf
new file mode 100644
index 0000000..6110b72
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Pei/CpuInitPeim.inf
@@ -0,0 +1,124 @@
+#
+# This file contains an 'Intel Pre-EFI Module' and is licensed
+# for Intel CPUs and Chipsets under the terms of your license
+# agreement with Intel or your vendor. This file may be
+# modified by the user, subject to additional terms of the
+# license agreement
+#
+#/*++
+#
+# Copyright (c) 2007 - 2013 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+
+#
+# Module Name:
+#
+# CpuInitPeim.inf
+#
+# Abstract:
+#
+# Component description file for CPU module
+#
+#
+#--*/
+
+[defines]
+BASE_NAME = CpuInitPeim
+FILE_GUID = 01359D99-9446-456d-ADA4-50A711C03ADA
+COMPONENT_TYPE = PE32_PEIM
+
+[sources.common]
+ CpuInitPeim.c
+ CachePeim.c
+ PfatInit.c
+ CpuOcInit.c
+ BootGuardInit.c
+
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGluePeimEntryPoint.c
+
+[sources.ia32]
+ Ia32/Cpu.asm
+
+[includes.common]
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Pei/Include
+ $(EDK_SOURCE)/Foundation/Cpu/Pentium/Include
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include
+#
+# Edk II Glue Library, some hearder are included by R9 header so have to include
+#
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Framework
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Library/OverclockingLib
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include/Library
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/SampleCode
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/SampleCode/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/Include
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Heci/Include
+
+[libraries.common]
+ EdkFrameworkPpiLib
+ EdkIIGlueBaseLib
+ EdkIIGlueBaseMemoryLib
+ EdkIIGluePeiDebugLibReportStatusCode
+ EdkIIGluePeiReportStatusCodeLib
+ EdkIIGluePeiServicesLib
+ EdkIIGluePeiMemoryAllocationLib
+ EdkIIGluePeiHobLib
+ EdkPpiLib
+ CpuPpiLib
+ CpuGuidLib
+ $(PROJECT_PCH_FAMILY)PpiLib
+ PeiKscLib
+ CpuPlatformLib
+ OverclockingLib
+ BootGuardLib
+
+[libraries.ia32]
+ CpuIA32Lib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = CpuInitPeim.dxs
+
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=PeimInitializeCpu
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_LIB__ \
+ -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_PEI_SERVICES_LIB__
diff --git a/ReferenceCode/Haswell/CpuInit/Pei/CpuOcInit.c b/ReferenceCode/Haswell/CpuInit/Pei/CpuOcInit.c
new file mode 100644
index 0000000..8aa7cd7
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Pei/CpuOcInit.c
@@ -0,0 +1,292 @@
+/** @file
+ OC CPU Early Post initializations.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+///
+/// External include files do NOT need to be explicitly specified in real EDKII
+/// environment
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#include "CpuInitPeim.h"
+#include "CpuAccess.h"
+#include "OverclockingLibrary.h"
+#include "CpuOcInit.h"
+#endif
+
+/**
+ Initializes Overclocking settings in the processor.
+
+ @param[in] PeiServices - General purpose services available to every PEIM.
+ @param[in] OverclockingtConfig Pointer to Policy protocol instance
+
+ @retval EFI_SUCCESS
+**/
+EFI_STATUS
+CpuOcInit (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_CPU_PLATFORM_POLICY_PPI *CpuPlatformPolicyPpi
+ )
+{
+ EFI_STATUS Status;
+ OC_CAPABILITIES_ITEM OcCaps;
+ VOLTAGE_FREQUENCY_ITEM CurrentVfItem;
+ VOLTAGE_FREQUENCY_ITEM RequestedVfItem;
+ GLOBAL_CONFIG_ITEM CurrentFivrItem;
+ GLOBAL_CONFIG_ITEM RequestedFivrItem;
+ SVID_CONFIG_ITEM CurrentSvidItem;
+ SVID_CONFIG_ITEM RequestedSvidItem;
+ UINT32 LibStatus;
+ UINT8 DomainId;
+ UINT8 ResetRequired;
+ WDT_PPI *gWdtPei;
+
+ LibStatus = 0; //DEBUG
+ ResetRequired = FALSE;
+ if (CpuPlatformPolicyPpi->OverclockingConfig->OcSupport == 0) {
+ ///
+ /// Overclocking is disabled
+ ///
+ DEBUG ((EFI_D_ERROR, "(OC) Overclocking is disabled. Bypassing CPU core overclocking flow.\n"));
+ return EFI_SUCCESS;
+ }
+
+ Status = EFI_SUCCESS;
+ ZeroMem(&CurrentFivrItem,sizeof(CurrentFivrItem));
+ ZeroMem(&RequestedFivrItem,sizeof(RequestedFivrItem));
+ ZeroMem(&CurrentSvidItem,sizeof(CurrentSvidItem));
+ ZeroMem(&RequestedSvidItem,sizeof(RequestedSvidItem));
+
+ //
+ // Locate WDT_PPI (ICC WDT PPI)
+ //
+ Status = PeiServicesLocatePpi (
+ &gWdtPpiGuid,
+ 0,
+ NULL,
+ (VOID **) &gWdtPei
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// We will loop on the CPU domains to manage the voltage/frequency settings
+ ///
+ for (DomainId = OC_LIB_DOMAIN_ID_IA_CORE; DomainId < OC_LIB_DOMAIN_ID_UNCORE; DomainId++) {
+ ///
+ /// Only IA_CORE and CLR are valid for CPU Core
+ ///
+ if ((DomainId == OC_LIB_DOMAIN_ID_IA_CORE) || (DomainId == OC_LIB_DOMAIN_ID_CLR)) {
+
+ ///
+ /// Get OC Capabilities of the domain
+ ///
+ ZeroMem(&OcCaps,sizeof(OcCaps));
+ OcCaps.DomainId = DomainId;
+ Status = GetOcCapabilities(&OcCaps,&LibStatus);
+
+ if (LibStatus == OC_LIB_COMPLETION_CODE_SUCCESS) {
+ ///
+ /// If any OC is supported on this domain, then proceed
+ ///
+ if (OcCaps.RatioOcSupported || OcCaps.VoltageOverridesSupported || OcCaps.VoltageOffsetSupported) {
+ ///
+ /// Need to populate the user requested settings from the platform policy
+ /// to determine if OC changes are desired.
+ ///
+ ZeroMem(&CurrentVfItem,sizeof(CurrentVfItem));
+ CurrentVfItem.DomainId = DomainId;
+
+ ///
+ /// Get a copy of the current domain VfSettings from the Mailbox Library
+ ///
+ Status = GetVoltageFrequencyItem(&CurrentVfItem,&LibStatus);
+ if ((Status != EFI_SUCCESS) || (LibStatus != OC_LIB_COMPLETION_CODE_SUCCESS)) {
+ continue;
+ }
+
+ ///
+ /// Populate the user requested VfSettings struct
+ ///
+ ZeroMem(&RequestedVfItem,sizeof(RequestedVfItem));
+ RequestedVfItem.DomainId = DomainId;
+ if (DomainId == OC_LIB_DOMAIN_ID_IA_CORE) {
+ RequestedVfItem.VfSettings.MaxOcRatio = (UINT8) CpuPlatformPolicyPpi->OverclockingConfig->CoreMaxOcTurboRatio;
+ } else if (DomainId == OC_LIB_DOMAIN_ID_CLR) {
+ RequestedVfItem.VfSettings.MaxOcRatio = (UINT8) CpuPlatformPolicyPpi->OverclockingConfig->ClrMaxOcTurboRatio;
+ }
+
+ ///
+ /// VoltageTarget has 2 uses and we need to update the target based
+ /// on the voltagemode requested
+ ///
+ if (DomainId == OC_LIB_DOMAIN_ID_IA_CORE) {
+ RequestedVfItem.VfSettings.VoltageTargetMode = CpuPlatformPolicyPpi->OverclockingConfig->CoreVoltageMode;
+ if (RequestedVfItem.VfSettings.VoltageTargetMode == OC_LIB_OFFSET_ADAPTIVE) {
+ RequestedVfItem.VfSettings.VoltageTarget = CpuPlatformPolicyPpi->OverclockingConfig->CoreExtraTurboVoltage;
+ } else {
+ RequestedVfItem.VfSettings.VoltageTarget = CpuPlatformPolicyPpi->OverclockingConfig->CoreVoltageOverride;
+ }
+ RequestedVfItem.VfSettings.VoltageOffset = CpuPlatformPolicyPpi->OverclockingConfig->CoreVoltageOffset;
+ } else if (DomainId == OC_LIB_DOMAIN_ID_CLR) {
+ RequestedVfItem.VfSettings.VoltageTargetMode = CpuPlatformPolicyPpi->OverclockingConfig->ClrVoltageMode;
+ if (RequestedVfItem.VfSettings.VoltageTargetMode == OC_LIB_OFFSET_ADAPTIVE) {
+ RequestedVfItem.VfSettings.VoltageTarget = CpuPlatformPolicyPpi->OverclockingConfig->ClrExtraTurboVoltage;
+ } else {
+ RequestedVfItem.VfSettings.VoltageTarget = CpuPlatformPolicyPpi->OverclockingConfig->ClrVoltageOverride;
+ }
+ RequestedVfItem.VfSettings.VoltageOffset = CpuPlatformPolicyPpi->OverclockingConfig->ClrVoltageOffset;
+ }
+
+ ///
+ /// Compare current settings with user requested settings to see if changes are needed
+ ///
+ if (CompareMem((VOID *)&RequestedVfItem,(VOID *)&CurrentVfItem,sizeof(VOLTAGE_FREQUENCY_ITEM))) {
+ ///
+ /// Arm watchdog timer for OC changes
+ ///
+ Status = gWdtPei->ReloadAndStart (WDT_TIMEOUT_BETWEEN_PEI_DXE);
+
+ ///
+ /// Need to update the requested voltage/frequency values
+ ///
+ DEBUG ((EFI_D_INFO, "(OC) Set Voltage Frequency for Domain = %X\n", DomainId));
+ DEBUG ((EFI_D_INFO, "(OC) RequestedVfItem.VfSettings.MaxOcRatio = %X\n", RequestedVfItem.VfSettings.MaxOcRatio));
+ DEBUG ((EFI_D_INFO, "(OC) RequestedVfItem.VfSettings.TargetMode = %X\n", RequestedVfItem.VfSettings.VoltageTargetMode));
+ DEBUG ((EFI_D_INFO, "(OC) RequestedVfItem.VfSettings.VoltageTarget = %X\n", RequestedVfItem.VfSettings.VoltageTarget));
+ DEBUG ((EFI_D_INFO, "(OC) RequestedVfItem.VfSettings.VoltageOffset = %X\n", RequestedVfItem.VfSettings.VoltageOffset));
+ DEBUG ((EFI_D_INFO, "(OC) CurrentVfItem.VfSettings.MaxOcRatio = %X\n", CurrentVfItem.VfSettings.MaxOcRatio));
+ DEBUG ((EFI_D_INFO, "(OC) CurrentVfItem.VfSettings.TargetMode = %X\n", CurrentVfItem.VfSettings.VoltageTargetMode));
+ DEBUG ((EFI_D_INFO, "(OC) CurrentVfItem.VfSettings.VoltageTarget = %X\n", CurrentVfItem.VfSettings.VoltageTarget));
+ DEBUG ((EFI_D_INFO, "(OC) CurrentVfItem.VfSettings.VoltageOffset = %X\n", CurrentVfItem.VfSettings.VoltageOffset));
+ Status = SetVoltageFrequencyItem(RequestedVfItem,&LibStatus);
+ if ((Status != EFI_SUCCESS) || (LibStatus != OC_LIB_COMPLETION_CODE_SUCCESS)) {
+ DEBUG ((EFI_D_ERROR, "(OC) Set Voltage Frequency failed. EFI Status = %X, Library Status = %X\n", Status, LibStatus));
+ }
+ }
+ }
+ } else {
+ DEBUG ((EFI_D_ERROR, "(OC) GetOcCapabilities message failed. Library Status = %X, Domain = %X\n", LibStatus, DomainId));
+ }
+ }
+ }
+
+ ///
+ /// Detect changes to global FIVR settings
+ ///
+ Status = GetFivrConfig(&CurrentFivrItem,&LibStatus);
+
+ if (LibStatus == OC_LIB_COMPLETION_CODE_SUCCESS) {
+ ///
+ /// Populate the requested FIVR settings from platform policy. The platform policy defines
+ /// these bits as 0-Disabled, 1-Enabled. The Mailbox uses the reverse encoding. Need to convert
+ /// the platform policy data to match the mailbox input.
+ ///
+ RequestedFivrItem.DisableFivrFaults = (~CpuPlatformPolicyPpi->OverclockingConfig->FivrFaultsEnable) & BIT0_MASK;
+ RequestedFivrItem.DisableFivrEfficiency = (~CpuPlatformPolicyPpi->OverclockingConfig->FivrEfficiencyEnable) & BIT0_MASK;
+
+ ///
+ /// Compare current FIVR settings with requested FIVR settings to see if changes are needed
+ ///
+ if (CompareMem((VOID *)&RequestedFivrItem,(VOID *)&CurrentFivrItem,sizeof(GLOBAL_CONFIG_ITEM))) {
+ ///
+ /// Arm watchdog timer for OC changes
+ ///
+ Status = gWdtPei->ReloadAndStart (8);
+
+ ///
+ /// Need to update the requested FIVR values
+ ///
+ DEBUG ((EFI_D_INFO, "(OC) Set FIVR Config for Domain = %X\n", DomainId));
+ Status = SetFivrConfig(RequestedFivrItem, &LibStatus);
+ if ((Status != EFI_SUCCESS) || (LibStatus != OC_LIB_COMPLETION_CODE_SUCCESS)) {
+ DEBUG ((EFI_D_ERROR, "(OC) Set FIVR Config failed. EFI Status = %X, Library Status = %X\n", Status, LibStatus));
+ }
+ else {
+ ///
+ /// If Re-enabling Fivr Faults, system needs to perform a cold reset for hardware to take effect
+ ///
+ if ((CurrentFivrItem.DisableFivrFaults == 1) && (RequestedFivrItem.DisableFivrFaults == 0)) {
+ DEBUG ((EFI_D_ERROR, "(OC) FIVR Faults enable detected. Cold Reset required.\n"));
+ ResetRequired = TRUE;
+ }
+ }
+ }
+ }
+ else {
+ DEBUG ((EFI_D_ERROR, "(OC) Get FIVR Config message failed. Library Status = %X\n", LibStatus));
+ }
+
+ ///
+ /// Detect changes to SVID settings
+ ///
+ Status = GetSvidConfig(&CurrentSvidItem,&LibStatus);
+
+ if (LibStatus == OC_LIB_COMPLETION_CODE_SUCCESS) {
+ ///
+ /// Populate the requested SVID settings from platform policy. SvidDisable uses a
+ /// reverse encoding from the platform policy defintion and will need to be converted.
+ ///
+ RequestedSvidItem.VoltageTarget = CpuPlatformPolicyPpi->OverclockingConfig->SvidVoltageOverride;
+ RequestedSvidItem.SvidDisable = ~(CpuPlatformPolicyPpi->OverclockingConfig->SvidEnable) & BIT0_MASK;
+
+ ///
+ /// Compare current SVID settings with requested SVID settings to see if changes are needed
+ ///
+ if (CompareMem((VOID *)&RequestedSvidItem,(VOID *)&CurrentSvidItem,sizeof(SVID_CONFIG_ITEM))) {
+ ///
+ /// Arm watchdog timer for OC changes
+ ///
+ Status = gWdtPei->ReloadAndStart (8);
+
+ ///
+ /// If Re-enabling SVID, system needs to perform a cold reset for hardware to take effect. No write to mailbox needed.
+ ///
+ if ((CurrentSvidItem.SvidDisable == 1) && (RequestedSvidItem.SvidDisable == 0)) {
+ DEBUG ((EFI_D_ERROR, "(OC) SVID Enable detected. Cold Reset required.\n"));
+ ResetRequired = TRUE;
+ }
+ else {
+ ///
+ /// Need to update the requested SVID values
+ ///
+ DEBUG ((EFI_D_INFO, "(OC) Set SVID Config for Domain = %X\n", DomainId));
+ Status = SetSvidConfig(RequestedSvidItem, &LibStatus);
+ if ((Status != EFI_SUCCESS) || (LibStatus != OC_LIB_COMPLETION_CODE_SUCCESS)) {
+ DEBUG ((EFI_D_ERROR, "(OC) Set SVID Config failed. EFI Status = %X, Library Status = %X\n", Status, LibStatus));
+ }
+ }
+ }
+ } else {
+ DEBUG ((EFI_D_ERROR, "(OC) GetFivrConfig message failed. Library Status = %X\n", LibStatus));
+ }
+
+ ///
+ /// Command was successful and SVID config has changed. CPU must perform a reset
+ /// for SVID settings to take effect.
+ ///
+ if (ResetRequired) {
+ DEBUG ((EFI_D_ERROR, "(OC) Perform Cold Reset\n"));
+ PerformWarmORColdReset (PeiServices, COLDRESET);
+ }
+
+ return Status;
+}
+
diff --git a/ReferenceCode/Haswell/CpuInit/Pei/CpuOcInit.h b/ReferenceCode/Haswell/CpuInit/Pei/CpuOcInit.h
new file mode 100644
index 0000000..652c67e
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Pei/CpuOcInit.h
@@ -0,0 +1,55 @@
+/** @file
+ Describes the functions visible to the rest of the OcInit.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _OC_INIT_H_
+#define _OC_INIT_H_
+
+#include "OverclockingLibrary.h"
+#include EFI_PPI_DEFINITION (CpuPlatformPolicy)
+#include EFI_PPI_CONSUMER (Wdt)
+
+#ifdef USE_WDT_IN_DEBUG_BIOS
+//
+// MRC takes a lot of time to execute in debug mode
+//
+#define WDT_TIMEOUT_BETWEEN_PEI_DXE 120
+#else
+#define WDT_TIMEOUT_BETWEEN_PEI_DXE 60
+#endif
+
+///
+/// Function Prototypes
+///
+/**
+ Initializes Overclocking settings in the processor.
+
+ @param[in] PeiServices - General purpose services available to every PEIM.
+ @param[in] OverclockingtConfig Pointer to Policy protocol instance
+
+ @retval EFI_SUCCESS
+**/
+EFI_STATUS
+CpuOcInit (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_CPU_PLATFORM_POLICY_PPI *CpuPlatformPolicyPpi
+ );
+
+#endif
+
diff --git a/ReferenceCode/Haswell/CpuInit/Pei/Ia32/Cpu.asm b/ReferenceCode/Haswell/CpuInit/Pei/Ia32/Cpu.asm
new file mode 100644
index 0000000..e7c812a
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Pei/Ia32/Cpu.asm
@@ -0,0 +1,77 @@
+;
+; This file contains an 'Intel Pre-EFI Module' and is licensed
+; for Intel CPUs and Chipsets under the terms of your license
+; agreement with Intel or your vendor. This file may be
+; modified by the user, subject to additional terms of the
+; license agreement
+;
+;------------------------------------------------------------------------------
+;
+; Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+; This software and associated documentation (if any) is furnished
+; under a license and may only be used or copied in accordance
+; with the terms of the license. Except as permitted by such
+; license, no part of this software or documentation may be
+; reproduced, stored in a retrieval system, or transmitted in any
+; form or by any means without the express written consent of
+; Intel Corporation.
+;
+;
+; Module Name:
+;
+; Cpu.asm
+;
+; Abstract:
+;
+; Assembly code of Cpu
+;
+;------------------------------------------------------------------------------
+
+ .686p
+ .model flat
+ .xmm
+
+IA32_CR4_OSFXSR equ 200h
+IA32_CR4_OSXMMEXCPT equ 400h
+IA32_CR0_MP equ 2h
+
+IA32_CPUID_SSE2 equ 02000000h
+IA32_CPUID_SSE2_B equ 26
+
+ .code
+
+;------------------------------------------------------------------------------
+; Set up flags in CR4 for XMM instruction enabling
+;------------------------------------------------------------------------------
+XmmInit PROC C PUBLIC
+ push ebx
+
+ ; Check whether SSE2 is supported
+ mov eax, 1
+ cpuid
+ bt edx, IA32_CPUID_SSE2_B
+ jnc @F
+
+ ; Enable XMM
+ mov eax, cr0
+ or eax, IA32_CR0_MP
+ mov cr0, eax
+ mov eax, cr4
+ or eax, IA32_CR4_OSFXSR OR IA32_CR4_OSXMMEXCPT
+ mov cr4, eax
+
+@@:
+ pop ebx
+ ret
+XmmInit ENDP
+
+
+;------------------------------------------------------------------------------
+; Invalidate cache
+;------------------------------------------------------------------------------
+CacheInvd PROC C PUBLIC
+ invd
+ ret
+CacheInvd ENDP
+
+ END
diff --git a/ReferenceCode/Haswell/CpuInit/Pei/PfatInit.c b/ReferenceCode/Haswell/CpuInit/Pei/PfatInit.c
new file mode 100644
index 0000000..8eff986
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Pei/PfatInit.c
@@ -0,0 +1,191 @@
+/** @file
+ PFAT EarlyPost initializations.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+///
+/// External include files do NOT need to be explicitly specified in real EDKII
+/// environment
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#include "CpuInitPeim.h"
+#include "CpuAccess.h"
+#include "PfatInit.h"
+#ifdef PFAT_EC_FLAG
+#include EFI_PPI_DEPENDENCY (CpuIo)
+#include EFI_PPI_PRODUCER (Stall)
+#include "PeiKscLib.h"
+#endif //PFAT_EC_FLAG
+#endif
+
+#ifdef PFAT_EC_FLAG
+/**
+ Gets CPU's random number generator.
+
+ @param[out] UINT32 - Random value
+**/
+UINT32
+RandomNumber (
+ void
+ )
+{
+ UINT32 Random = 0;
+
+ ///
+ /// Assembly instruction to read CPU's random number generator
+ /// Instruction is only available 100k cycles after reset
+ ///
+ __asm {
+tryAgain:
+ ; rdrand eax
+ ; db 0Fh, 0C7h, 0F0h
+
+ _emit 0x0F
+ _emit 0xC7
+ _emit 0xF0
+
+ mov Random, eax
+ jnc tryAgain; CF will be set is valid number was generated
+ }
+
+ return (Random);
+}
+#endif //PFAT_EC_FLAG
+
+/**
+ Perform the platform spefific initializations.
+
+ @param[in] PeiServices - Indirect reference to the PEI Services Table.
+ @param[in] CpuPlatformPolicyPpi - Platform Policy PPI
+**/
+VOID
+PfatInit (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_CPU_PLATFORM_POLICY_PPI *CpuPlatformPolicyPpi
+ )
+{
+ EFI_STATUS Status;
+ UINT64 MsrValue;
+ BOOLEAN ResetRequired;
+ PFAT_HOB *PfatHobPtr;
+ EFI_GUID PfatHobGuid = PFAT_HOB_GUID;
+ UINT8 i;
+ PFAT_CONFIG *PfatConfig;
+#ifdef PFAT_EC_FLAG
+ volatile UINT32 EphemeralAuthValue;
+ UINT8 EcStatus;
+ PEI_STALL_PPI *StallPpi;
+ PEI_CPU_IO_PPI *CpuIo;
+#endif //PFAT_EC_FLAG
+
+ DEBUG ((EFI_D_INFO, "PfatInit\n"));
+
+ ResetRequired = FALSE;
+ MsrValue = AsmReadMsr64 (MSR_PLATFORM_INFO);
+ if (!(MsrValue & B_MSR_PLATFORM_INFO_PFAT_AVAIL)) {
+ DEBUG ((EFI_D_INFO, "PFAT Feature is not supported\n"));
+ return;
+ }
+
+ if (CpuPlatformPolicyPpi->CpuConfig->Pfat) {
+ DEBUG ((EFI_D_INFO, "PFAT Module is Enable\n"));
+ PfatConfig = CpuPlatformPolicyPpi->SecurityConfig->PfatConfig;
+ ///
+ /// Read PFAT Control Register
+ ///
+ MsrValue = AsmReadMsr64 (MSR_PLAT_FRMW_PROT_CTRL);
+ if (MsrValue & B_MSR_PLAT_FRMW_PROT_CTRL_LK) {
+ if (!(MsrValue & B_MSR_PLAT_FRMW_PROT_CTRL_EN)) {
+ ///
+ /// Reset required as the PFAT CTRL MSR is locked and needs to be toggled
+ ///
+ ResetRequired = TRUE;
+ }
+ } else {
+#ifdef PFAT_EC_FLAG
+ if ((PfatConfig->Ppdt.PlatAttr & EC_PRESENT) && (PfatConfig->Ppdt.PlatAttr & EC_PFAT_PROTECTED)) {
+ DEBUG ((EFI_D_INFO, "EC is Present and EC FW supports PFAT\n"));
+ CpuIo = (**PeiServices).CpuIo;
+ Status = (*PeiServices)->LocatePpi (PeiServices, &gPeiStallPpiGuid, 0, NULL, &StallPpi);
+ ASSERT_PEI_ERROR (PeiServices, Status);
+ Status = SendKscCommand (PeiServices, CpuIo, StallPpi, PfatConfig->EcCmdProvisionEav);
+ if (Status == EFI_SUCCESS) {
+ EphemeralAuthValue = RandomNumber ();
+ for (i = 0; (i < (sizeof (EphemeralAuthValue))); i++) {
+ Status = SendKscData (PeiServices, CpuIo, StallPpi, (UINT8) ((EphemeralAuthValue >> (i * 8)) & 0xFF));
+ }
+ Status = ReceiveKscData (PeiServices, CpuIo, StallPpi, &EcStatus);
+ if (EcStatus != 0) {
+ ResetRequired = TRUE;
+ }
+ AsmWriteMsr32 (MSR_PLAT_FRMW_PROT_PASSWD, EphemeralAuthValue);
+ EphemeralAuthValue = 0;
+ Status = SendKscCommand (PeiServices, CpuIo, StallPpi, PfatConfig->EcCmdLock);
+ }
+ }
+#endif //PFAT_EC_FLAG
+ AsmWriteMsr64 (MSR_PLAT_FRMW_PROT_HASH_0, PfatConfig->PpdtHash[0]);
+ AsmWriteMsr64 (MSR_PLAT_FRMW_PROT_HASH_1, PfatConfig->PpdtHash[1]);
+ AsmWriteMsr64 (MSR_PLAT_FRMW_PROT_HASH_2, PfatConfig->PpdtHash[2]);
+ AsmWriteMsr64 (MSR_PLAT_FRMW_PROT_HASH_3, PfatConfig->PpdtHash[3]);
+ MsrValue |= (B_MSR_PLAT_FRMW_PROT_CTRL_LK | B_MSR_PLAT_FRMW_PROT_CTRL_EN);
+ AsmWriteMsr64 (MSR_PLAT_FRMW_PROT_CTRL, MsrValue);
+ }
+ ///
+ /// Create PFAT HOB
+ ///
+ if (!ResetRequired) {
+ Status = (*PeiServices)->CreateHob (PeiServices, EFI_HOB_TYPE_GUID_EXTENSION, sizeof (PFAT_HOB), (VOID **) &PfatHobPtr);
+ PfatHobPtr->EfiHobGuidType.Name = PfatHobGuid;
+ CopyMem (&PfatHobPtr->Ppdt, &PfatConfig->Ppdt, PfatConfig->Ppdt.PpdtSize);
+ CopyMem (&PfatHobPtr->PupHeader, &PfatConfig->PupHeader, sizeof (PUP_HEADER));
+ CopyMem (&PfatHobPtr->PfatLog, &PfatConfig->PfatLog, sizeof (PFAT_LOG));
+ PfatHobPtr->NumSpiComponents = PfatConfig->NumSpiComponents;
+ for (i = 0; i < PfatConfig->NumSpiComponents; i++) {
+ PfatHobPtr->ComponentSize[i] = PfatConfig->ComponentSize[i];
+ }
+ }
+ } else {
+ DEBUG ((EFI_D_INFO, "PFAT Module is Disabled\n"));
+ MsrValue = AsmReadMsr64 (MSR_PLAT_FRMW_PROT_CTRL);
+ if (MsrValue & B_MSR_PLAT_FRMW_PROT_CTRL_LK) {
+ if (MsrValue & B_MSR_PLAT_FRMW_PROT_CTRL_EN) {
+ ///
+ /// Reset required as the PFAT CTRL MSR is locked and needs to be toggled
+ ///
+ ResetRequired = TRUE;
+ }
+ } else {
+ MsrValue &= ~B_MSR_PLAT_FRMW_PROT_CTRL_EN;
+ MsrValue |= B_MSR_PLAT_FRMW_PROT_CTRL_LK;
+ AsmWriteMsr64 (MSR_PLAT_FRMW_PROT_CTRL, MsrValue);
+ }
+ }
+
+ if (ResetRequired) {
+ ///
+ /// Perform Cold Reset
+ ///
+ DEBUG ((EFI_D_INFO, "Reset Required. Performing Cold Reset to unlock PFAT CONTROL MSR\n"));
+ PerformWarmORColdReset (PeiServices, COLDRESET);
+ }
+
+ return;
+}
diff --git a/ReferenceCode/Haswell/CpuInit/Pei/PfatInit.h b/ReferenceCode/Haswell/CpuInit/Pei/PfatInit.h
new file mode 100644
index 0000000..22e807f
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuInit/Pei/PfatInit.h
@@ -0,0 +1,42 @@
+/** @file
+ Describes the functions visible to the rest of the PfatInit.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PFAT_INIT_H_
+#define _PFAT_INIT_H_
+
+#include "PfatDefinitions.h"
+#include EFI_PPI_DEFINITION (CpuPlatformPolicy)
+
+///
+/// Function Prototypes
+///
+/**
+ Execute Early-Post initialization of PFAT specific MSRs
+
+ @param[in] PeiServices - Indirect reference to the PEI Services Table.
+ @param[in] CpuPlatformPolicyPpi - Platform Policy PPI
+**/
+VOID
+PfatInit (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_CPU_PLATFORM_POLICY_PPI *CpuPlatformPolicyPpi
+ );
+
+#endif
diff --git a/ReferenceCode/Haswell/CpuS3/Pei/CpuAsm.asm b/ReferenceCode/Haswell/CpuS3/Pei/CpuAsm.asm
new file mode 100644
index 0000000..f396d99
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuS3/Pei/CpuAsm.asm
@@ -0,0 +1,147 @@
+;
+; This file contains a 'Sample Driver' and is licensed as such
+; under the terms of your license agreement with Intel or your
+; vendor. This file may be modified by the user, subject to
+; the additional terms of the license agreement
+;
+;------------------------------------------------------------------------------
+;
+; Copyright (c) 2006 - 2011 Intel Corporation. All rights reserved
+; This software and associated documentation (if any) is furnished
+; under a license and may only be used or copied in accordance
+; with the terms of the license. Except as permitted by such
+; license, no part of this software or documentation may be
+; reproduced, stored in a retrieval system, or transmitted in any
+; form or by any means without the express written consent of
+; Intel Corporation.
+;
+;
+; Module Name:
+;
+; CpuAsm.asm
+;
+; Abstract:
+;
+; This is the code that supports IA32 CPU architectural protocol
+;
+;------------------------------------------------------------------------------
+
+include MpEqu.inc
+
+.686p
+.model flat
+.code
+
+PAUSE32 MACRO
+ DB 0F3h
+ DB 090h
+ ENDM
+
+EnableMce proc near C public
+
+ mov eax, cr4
+ or eax, 40h
+ mov cr4, eax
+
+ ret
+
+EnableMce endp
+
+MpMtrrSynchUpEntry PROC NEAR C PUBLIC
+ ;
+ ; Enter no fill cache mode, CD=1(Bit30), NW=0 (Bit29)
+ ;
+ mov eax, cr0
+ and eax, 0DFFFFFFFh
+ or eax, 040000000h
+ mov cr0, eax
+ ;
+ ; Flush cache
+ ;
+ wbinvd
+ ;
+ ; Clear PGE flag Bit 7
+ ;
+ mov eax, cr4
+ mov edx, eax
+ and eax, 0FFFFFF7Fh
+ mov cr4, eax
+ ;
+ ; Flush all TLBs
+ ;
+ mov eax, cr3
+ mov cr3, eax
+
+ mov eax, edx
+
+ ret
+
+MpMtrrSynchUpEntry ENDP
+
+MpMtrrSynchUpExit PROC NEAR C PUBLIC
+
+ push ebp ; C prolog
+ mov ebp, esp
+ ;
+ ; Flush all TLBs the second time
+ ;
+ mov eax, cr3
+ mov cr3, eax
+ ;
+ ; Enable Normal Mode caching CD=NW=0, CD(Bit30), NW(Bit29)
+ ;
+ mov eax, cr0
+ and eax, 09FFFFFFFh
+ mov cr0, eax
+ ;
+ ; Set PGE Flag in CR4 if set
+ ;
+ mov eax, dword ptr [ebp + 8]
+ mov cr4, eax
+
+ pop ebp
+
+ ret
+
+MpMtrrSynchUpExit ENDP
+
+;-------------------------------------------------------------------------------
+; AsmAcquireMPLock (&Lock);
+;-------------------------------------------------------------------------------
+AsmAcquireMPLock PROC near C PUBLIC
+
+ pushad
+ mov ebp,esp
+
+ mov al, NotVacantFlag
+ mov ebx, dword ptr [ebp+24h]
+TryGetLock:
+ lock xchg al, byte ptr [ebx]
+ cmp al, VacantFlag
+ jz LockObtained
+
+ PAUSE32
+ jmp TryGetLock
+
+LockObtained:
+ popad
+ ret
+AsmAcquireMPLock ENDP
+
+;-------------------------------------------------------------------------------
+; AsmReleaseMPLock (&Lock);
+;-------------------------------------------------------------------------------------
+AsmReleaseMPLock PROC near C PUBLIC
+
+ pushad
+ mov ebp,esp
+
+ mov al, VacantFlag
+ mov ebx, dword ptr [ebp+24h]
+ lock xchg al, byte ptr [ebx]
+
+ popad
+ ret
+AsmReleaseMPLock ENDP
+
+END \ No newline at end of file
diff --git a/ReferenceCode/Haswell/CpuS3/Pei/CpuS3Peim.c b/ReferenceCode/Haswell/CpuS3/Pei/CpuS3Peim.c
new file mode 100644
index 0000000..ddf8ba1
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuS3/Pei/CpuS3Peim.c
@@ -0,0 +1,1035 @@
+/** @file
+ Cpu driver running on S3 boot path
+
+@copyright
+ Copyright (c) 2005 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+///
+/// External include files do NOT need to be explicitly specified in real EDKII
+/// environment
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#include "MpCommon.h"
+#include "BootGuardLibrary.h"
+#include EFI_PPI_DEFINITION (SmmAccess)
+#include EFI_PPI_DEPENDENCY (Stall)
+#include EFI_PPI_DEFINITION (CpuPlatformPolicy)
+
+#include EFI_GUID_DEFINITION (HOB)
+#include EFI_GUID_DEFINITION (StatusCodeDataTypeId)
+#include EFI_GUID_DEFINITION (SmramCpuDataHeader)
+#endif
+
+#define PEI_ACPI_CPU_DATA_HOB_GUID \
+ { 0x7682bbef, 0xb0b6, 0x4939, 0xae, 0x66, 0x1b, 0x3d, 0xf2, 0xf6, 0xaa, 0xf3};
+
+EFI_GUID gPeiAcpiCpuDataGuid = PEI_ACPI_CPU_DATA_HOB_GUID;
+typedef VOID (*S3_AP_PROCEDURE)(
+ MP_CPU_EXCHANGE_INFO *ExchangeInfo,
+ UINT64 *MtrrValues
+ );
+
+/**
+ This function handles SA S3 resume task
+
+ @param[in] PeiServices - Pointer to PEI Services Table.
+ @param[in] NotifyDesc - Pointer to the descriptor for the Notification event that
+ caused this function to execute.
+ @param[in] Ppi - Pointer to the PPI data associated with this function.
+
+ @retval EFI_STATUS - Always return EFI_SUCCESS
+**/
+static
+EFI_STATUS
+CpuS3ResumeAtEndOfPei (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
+ IN VOID *Ppi
+ );
+
+EFI_GUID gEfiPeiEndOfPeiPhasePpiGuid = EFI_PEI_END_OF_PEI_PHASE_PPI_GUID;
+STATIC EFI_PEI_NOTIFY_DESCRIPTOR mCpuS3ResumeNotifyDesc = {
+ (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+ &gEfiPeiEndOfPeiPhasePpiGuid,
+ CpuS3ResumeAtEndOfPei
+};
+
+/**
+ Get APIC ID of processor
+
+ @retval APIC ID of processor
+**/
+UINT32
+GetApicID (
+ VOID
+ )
+{
+ EFI_CPUID_REGISTER CpuidRegisters;
+
+ AsmCpuid (
+ CPUID_VERSION_INFO,
+ &CpuidRegisters.RegEax,
+ &CpuidRegisters.RegEbx,
+ &CpuidRegisters.RegEcx,
+ &CpuidRegisters.RegEdx
+ );
+ return (UINT32) (CpuidRegisters.RegEbx >> 24);
+}
+
+/**
+ Send interrupt to CPU
+
+ @param[in] BroadcastMode - interrupt broadcast mode
+ @param[in] ApicID - APIC ID for sending interrupt
+ @param[in] VectorNumber - Vector number
+ @param[in] DeliveryMode - Interrupt delivery mode
+ @param[in] TriggerMode - Interrupt trigger mode
+ @param[in] Assert - Interrupt pin polarity
+ @param[in] PeiServices - Indirect reference to the PEI Services Table
+ @param[in] PeiStall - EFI_PEI_STALL_PPI to stall for some interval
+
+ @retval EFI_INVALID_PARAMETER - input parameter not correct
+ @retval EFI_NOT_READY - there was a pending interrupt
+ @retval EFI_SUCCESS - interrupt sent successfully
+**/
+EFI_STATUS
+SendInterrupt (
+ IN UINT32 BroadcastMode,
+ IN UINT32 ApicID,
+ IN UINT32 VectorNumber,
+ IN UINT32 DeliveryMode,
+ IN UINT32 TriggerMode,
+ IN BOOLEAN Assert,
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_STALL_PPI *PeiStall
+ )
+{
+ UINT64 ApicBaseReg;
+ EFI_PHYSICAL_ADDRESS ApicBase;
+ UINT32 ICRLow;
+ UINT32 ICRHigh;
+
+ ///
+ /// Initialze ICR high dword, since P6 family processor needs
+ /// the destination field to be 0x0F when it is a broadcast
+ ///
+ ICRHigh = 0x0f000000;
+ ICRLow = VectorNumber | (DeliveryMode << 8);
+
+ if (TriggerMode == TRIGGER_MODE_LEVEL) {
+ ICRLow |= 0x8000;
+ }
+
+ if (Assert) {
+ ICRLow |= 0x4000;
+ }
+
+ switch (BroadcastMode) {
+ case BROADCAST_MODE_SPECIFY_CPU:
+ ICRHigh = ApicID << 24;
+ break;
+
+ case BROADCAST_MODE_ALL_INCLUDING_SELF:
+ ICRLow |= 0x80000;
+ break;
+
+ case BROADCAST_MODE_ALL_EXCLUDING_SELF:
+ ICRLow |= 0xC0000;
+ break;
+
+ default:
+ return EFI_INVALID_PARAMETER;
+ }
+
+ ApicBaseReg = AsmReadMsr64 (MSR_IA32_APIC_BASE);
+ ApicBase = ApicBaseReg & 0xffffff000ULL;
+
+ *(volatile UINT32 *) (UINTN) (ApicBase + APIC_REGISTER_ICR_HIGH_OFFSET) = ICRHigh;
+ *(volatile UINT32 *) (UINTN) (ApicBase + APIC_REGISTER_ICR_LOW_OFFSET) = ICRLow;
+
+ PeiStall->Stall (
+ PeiServices,
+ PeiStall,
+ 10 * STALL_ONE_MICRO_SECOND
+ );
+
+ ICRLow = *(volatile UINT32 *) (UINTN) (ApicBase + APIC_REGISTER_ICR_LOW_OFFSET);
+ if (ICRLow & 0x1000) {
+ return EFI_NOT_READY;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Programs XAPIC registers.
+
+ @param[in] BSP - Is this BSP?
+**/
+VOID
+ProgramXApic (
+ BOOLEAN BSP
+ )
+{
+ UINT64 ApicBaseReg;
+ EFI_PHYSICAL_ADDRESS ApicBase;
+ volatile UINT32 *EntryAddress;
+ UINT32 EntryValue;
+
+ ApicBaseReg = AsmReadMsr64 (MSR_IA32_APIC_BASE);
+ ApicBase = ApicBaseReg & 0xffffff000ULL;
+
+ ///
+ /// Program the Spurious Vectore entry
+ ///
+ EntryAddress = (UINT32 *) (UINTN) (ApicBase + APIC_REGISTER_SPURIOUS_VECTOR_OFFSET);
+ EntryValue = *EntryAddress;
+ EntryValue &= 0xFFFFFD0F;
+ EntryValue |= 0x10F;
+ *EntryAddress = EntryValue;
+
+ ///
+ /// Program the LINT1 vector entry as extINT
+ ///
+ EntryAddress = (UINT32 *) (UINTN) (ApicBase + APIC_REGISTER_LINT0_VECTOR_OFFSET);
+ EntryValue = *EntryAddress;
+
+ if (BSP) {
+ EntryValue &= 0xFFFE00FF;
+ EntryValue |= 0x700;
+ } else {
+ EntryValue |= 0x10000;
+ }
+
+ *EntryAddress = EntryValue;
+
+ ///
+ /// Program the LINT1 vector entry as NMI
+ ///
+ EntryAddress = (UINT32 *) (UINTN) (ApicBase + APIC_REGISTER_LINT1_VECTOR_OFFSET);
+ EntryValue = *EntryAddress;
+ EntryValue &= 0xFFFE00FF;
+ if (BSP) {
+ EntryValue |= 0x400;
+ } else {
+ EntryValue |= 0x10400;
+ }
+
+ *EntryAddress = EntryValue;
+
+}
+
+/**
+ Restore all MSR settings
+
+ @param[in] ScriptTable - contain the MSR settings that will be restored
+**/
+VOID
+InitializeFeatures (
+ IN MP_CPU_S3_SCRIPT_DATA *ScriptTable
+ )
+{
+ EFI_CPUID_REGISTER CpuidRegisters;
+ UINT32 ApicId;
+ UINT8 SkipMsr;
+ ///
+ /// Restore all the MSRs for processor
+ ///
+ AsmCpuid (
+ CPUID_VERSION_INFO,
+ &CpuidRegisters.RegEax,
+ &CpuidRegisters.RegEbx,
+ &CpuidRegisters.RegEcx,
+ &CpuidRegisters.RegEdx
+ );
+ ApicId = (CpuidRegisters.RegEbx >> 24);
+
+ while (ScriptTable->MsrIndex != 0) {
+ if (ApicId == ScriptTable->ApicId) {
+ SkipMsr = 0;
+ if ((ScriptTable->MsrIndex == MSR_PMG_CST_CONFIG) && (AsmReadMsr64 (MSR_PMG_CST_CONFIG) & B_CST_CONTROL_LOCK)) {
+ SkipMsr = 1;
+ }
+ if (SkipMsr == 0) {
+ AsmWriteMsr64 (ScriptTable->MsrIndex, ScriptTable->MsrValue);
+ }
+ }
+ ScriptTable++;
+ }
+}
+
+/**
+ Restore all MSR settings with debug message output
+
+ @param[in] PeiServices - General purpose services available to every PEIM.
+ @param[in] ScriptTable - Script table contain all MSR settings that will be restored
+**/
+VOID
+InitializeFeaturesLog (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN MP_CPU_S3_SCRIPT_DATA *ScriptTable
+ )
+{
+ EFI_CPUID_REGISTER CpuidRegisters;
+ UINT32 ApicId;
+ BOOLEAN SkipMsr;
+
+ ///
+ /// Restore all the MSRs for processor
+ ///
+ AsmCpuid (
+ CPUID_VERSION_INFO,
+ &CpuidRegisters.RegEax,
+ &CpuidRegisters.RegEbx,
+ &CpuidRegisters.RegEcx,
+ &CpuidRegisters.RegEdx
+ );
+ ApicId = (CpuidRegisters.RegEbx >> 24);
+
+ while (ScriptTable->MsrIndex != 0) {
+ if (ApicId == ScriptTable->ApicId) {
+ DEBUG ((EFI_D_INFO, "MSR Index - %x, MSR value - %x\n", ScriptTable->MsrIndex, ScriptTable->MsrValue));
+ SkipMsr = FALSE;
+ if ((ScriptTable->MsrIndex == MSR_PMG_CST_CONFIG) && (AsmReadMsr64 (MSR_PMG_CST_CONFIG) & B_CST_CONTROL_LOCK)) {
+ SkipMsr = TRUE;
+ }
+ if (ScriptTable->MsrIndex == MSR_IA32_DEBUG_INTERFACE) {
+ /* Access to MSR_IA32_DEBUG_INTERFACE is supported on
+ HSW B0, HSWULT B0 and CRW B0 Stepping
+ HSW stepping >= C0, HSWULT Stepping >= C0 and CRW stepping >= C0 stepping, if CPUID (EAX=1): ECX[11] = 1
+ */
+ switch (CpuidRegisters.RegEax) {
+ case (EnumCpuHsw + EnumHswA0):
+ DEBUG ((EFI_D_INFO,"MSR_IA32_DEBUG_INTERFACE is not supported on Ax CPU stepping\n"));
+ break;
+ case (EnumCpuHsw + EnumHswB0):
+ case (EnumCpuHswUlt + EnumHswUltB0):
+ case (EnumCpuCrw + EnumCrwB0):
+ if ((AsmReadMsr64 (MSR_IA32_DEBUG_INTERFACE) & B_DEBUG_INTERFACE_LOCK)) {
+ SkipMsr = TRUE;
+ }
+ break;
+ default:
+ if (CpuidRegisters.RegEcx & BIT11) {
+ if ((AsmReadMsr64 (MSR_IA32_DEBUG_INTERFACE) & B_DEBUG_INTERFACE_LOCK)) {
+ SkipMsr = TRUE;
+ }
+ }
+ break;
+ }
+ }
+ if (!SkipMsr) {
+ AsmWriteMsr64 (ScriptTable->MsrIndex, ScriptTable->MsrValue);
+ }
+ }
+ ScriptTable++;
+ }
+}
+
+/**
+ Initialize prefetcher settings
+
+ @param[in] MlcStreamerprefecterEnabled - Enable/Disable MLC streamer prefetcher
+ @param[in] MlcSpatialPrefetcherEnabled - Enable/Disable MLC spatial prefetcher
+**/
+VOID
+ProcessorsPrefetcherInitialization (
+ IN UINTN MlcStreamerprefecterEnabled,
+ IN UINTN MlcSpatialPrefetcherEnabled
+ )
+{
+ UINT64 MsrValue;
+ MsrValue = AsmReadMsr64 (MISC_FEATURE_CONTROL);
+
+ if (MlcStreamerprefecterEnabled == CPU_FEATURE_DISABLE) {
+ MsrValue |= B_MISC_FEATURE_CONTROL_MLC_STRP;
+ }
+
+ if (MlcSpatialPrefetcherEnabled == CPU_FEATURE_DISABLE) {
+ MsrValue |= B_MISC_FEATURE_CONTROL_MLC_SPAP;
+ }
+
+ if ((MsrValue & (B_MISC_FEATURE_CONTROL_MLC_STRP | B_MISC_FEATURE_CONTROL_MLC_SPAP)) != 0) {
+ AsmWriteMsr64 (MISC_FEATURE_CONTROL, MsrValue);
+ }
+
+ return;
+}
+
+/**
+ AP initialization
+
+ @param[in] ExchangeInfo - Pointer to the exchange info buffer for output.
+ @param[in] MtrrValues - buffer contains MTRR settings
+**/
+VOID
+MPRendezvousProcedure (
+ MP_CPU_EXCHANGE_INFO *ExchangeInfo,
+ UINT64 *MtrrValues
+ )
+{
+ UINT32 FailedRevision;
+ ACPI_CPU_DATA *AcpiCpuData;
+ EFI_PEI_SERVICES **PeiServices;
+ EFI_PEI_STALL_PPI *PeiStall;
+ MP_CPU_S3_DATA_POINTER *CpuS3DataPtr;
+
+ ///
+ /// Switch AP speed to BSP speed
+ ///
+ AsmWriteMsr64 (MSR_IA32_PERF_CTRL, ExchangeInfo->CpuPerfCtrlValue);
+
+ AcpiCpuData = (ACPI_CPU_DATA *) (ExchangeInfo->AcpiCpuDataAddress);
+ PeiServices = ExchangeInfo->PeiServices;
+ PeiStall = ExchangeInfo->PeiStall;
+
+ ProgramXApic (FALSE);
+
+ InitializeMicrocode (
+ ExchangeInfo,
+ (EFI_CPU_MICROCODE_HEADER **) (UINTN) ExchangeInfo->MicrocodePointer,
+ &FailedRevision
+ );
+
+ ProcessorsPrefetcherInitialization (
+ ExchangeInfo->CpuPlatformPolicyPpi->CpuConfig->MlcStreamerPrefetcher,
+ ExchangeInfo->CpuPlatformPolicyPpi->CpuConfig->MlcSpatialPrefetcher
+ );
+
+ ///
+ /// wait till all CPUs done the Microcode Load
+ ///
+ while (ExchangeInfo->McuLoadCount < AcpiCpuData->NumberOfCpus) {
+ CpuPause ();
+ }
+
+ MpMtrrSynchUp (MtrrValues);
+
+ InitializeFeatures (ExchangeInfo->S3BootScriptTable);
+
+ InterlockedIncrement (&(ExchangeInfo->FinishedCount));
+
+ ///
+ /// Sempahore check loop executed in memory
+ ///
+ (*ExchangeInfo->SemaphoreCheck)(&ExchangeInfo->FinishedCount);
+
+ InterlockedIncrement (&(ExchangeInfo->WakeupCount));
+
+ ///
+ /// Restore the MTRR programmed before OS boot
+ ///
+ /// MpMtrrSynchUp (MtrrValues);
+ ///
+ CpuS3DataPtr = (MP_CPU_S3_DATA_POINTER *) (UINTN) AcpiCpuData->CpuPrivateData;
+ SetMtrrRegisters (PeiServices, (EFI_MTRR_VALUES *) CpuS3DataPtr->S3BspMtrrTable);
+
+ while (ExchangeInfo->WakeupCount < AcpiCpuData->NumberOfCpus - 1) {
+ CpuPause ();
+ }
+
+ InterlockedIncrement (&(ExchangeInfo->FinishedCount));
+
+}
+
+/**
+ Wake up all the application processors
+
+ @param[in] PeiServices - Indirect reference to the PEI Services Table
+ @param[in] PeiStall - EFI_PEI_STALL_PPI to stall for some interval
+ @param[in] AcpiCpuData - pointer to ACPI_CPU_DATA structure
+ @param[in] MtrrValues - pointer to a buffer which stored MTRR settings
+
+ @retval EFI_SUCCESS - APs are successfully waked up
+**/
+EFI_STATUS
+WakeUpAPs (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_STALL_PPI *PeiStall,
+ ACPI_CPU_DATA *AcpiCpuData,
+ UINT64 *MtrrValues,
+ S3_AP_PROCEDURE Function
+ )
+{
+ EFI_PHYSICAL_ADDRESS WakeUpBuffer;
+ MP_CPU_EXCHANGE_INFO *ExchangeInfo;
+ MP_CPU_S3_DATA_POINTER *CpuS3DataPtr;
+ UINTN CpuPpiAddrDelta;
+ PEI_CPU_PLATFORM_POLICY_PPI *CpuPolicyPpi;
+
+ WakeUpBuffer = AcpiCpuData->WakeUpBuffer;
+ CopyMem ((VOID *) (UINTN) WakeUpBuffer, AsmGetAddressMap (), 0x1000 - 0x200);
+
+ ExchangeInfo = (MP_CPU_EXCHANGE_INFO *) (UINTN) (WakeUpBuffer + (0x1000 - 0x200));
+
+ ExchangeInfo->Lock = 0;
+ ExchangeInfo->StackStart = (UINTN) AcpiCpuData->StackAddress;
+ ExchangeInfo->StackSize = STACK_SIZE_PER_PROC;
+ ExchangeInfo->ApFunction = (UINT32) Function;
+ ExchangeInfo->BufferStart = (UINT32) WakeUpBuffer;
+ ExchangeInfo->PmodeOffset = (UINT32) (AsmGetPmodeOffset ());
+ ExchangeInfo->SemaphoreCheck = (VOID (*)(UINT32 *))(AsmGetSemaphoreCheckOffset () + (UINT32) WakeUpBuffer);
+ ExchangeInfo->AcpiCpuDataAddress = (UINT32) AcpiCpuData;
+ ExchangeInfo->MtrrValuesAddress = (UINT32) MtrrValues;
+ ExchangeInfo->FinishedCount = (UINT32) 0;
+ ExchangeInfo->SerializeLock = (UINT32) 0;
+ ExchangeInfo->MicrocodePointer = (UINT32) (UINTN) AcpiCpuData->MicrocodePointerBuffer;
+ ExchangeInfo->StartState = (UINT32) 0;
+
+ CpuS3DataPtr = (MP_CPU_S3_DATA_POINTER *) (UINTN) AcpiCpuData->CpuPrivateData;
+ ExchangeInfo->S3BootScriptTable = (MP_CPU_S3_SCRIPT_DATA *) (UINTN) CpuS3DataPtr->S3BootScriptTable;
+ ExchangeInfo->VirtualWireMode = CpuS3DataPtr->VirtualWireMode;
+ ExchangeInfo->PeiServices = PeiServices;
+ ExchangeInfo->PeiStall = PeiStall;
+ ExchangeInfo->CpuPerfCtrlValue = AsmReadMsr64 (MSR_IA32_PERF_CTRL);
+
+ ExchangeInfo->CpuPlatformPolicyPpi = NULL;
+ PeiServicesLocatePpi (
+ &gPeiCpuPlatformPolicyPpiGuid,
+ 0,
+ NULL,
+ (VOID **) &(ExchangeInfo->CpuPlatformPolicyPpi)
+ );
+
+ //
+ // Calculate delta from cache address to memory address
+ //
+ CpuPolicyPpi = ExchangeInfo->CpuPlatformPolicyPpi;
+ CpuPpiAddrDelta = CpuPolicyPpi->CpuPlatformPpiPtr - (UINTN)(CpuPolicyPpi);
+ //
+ // Calculate new address in memory for each pointer in PEI_CPU_PLATFORM_POLICY_PPI
+ //
+ CpuPolicyPpi->CpuConfig = (CPU_CONFIG_PPI *)((UINTN)CpuPolicyPpi->CpuConfig - CpuPpiAddrDelta);
+ CpuPolicyPpi->PowerMgmtConfig = (POWER_MGMT_CONFIG_PPI *)((UINTN)CpuPolicyPpi->PowerMgmtConfig - CpuPpiAddrDelta);
+ CpuPolicyPpi->SecurityConfig = (SECURITY_CONFIG_PPI *)((UINTN)CpuPolicyPpi->SecurityConfig - CpuPpiAddrDelta);
+ CpuPolicyPpi->SecurityConfig->PfatConfig = (PFAT_CONFIG *)((UINTN)CpuPolicyPpi->SecurityConfig->PfatConfig - CpuPpiAddrDelta);
+ CpuPolicyPpi->SecurityConfig->TxtConfig = (TXT_CONFIG *)((UINTN)CpuPolicyPpi->SecurityConfig->TxtConfig - CpuPpiAddrDelta);
+ CpuPolicyPpi->SecurityConfig->BootGuardConfig = (BOOT_GUARD_CONFIG *)((UINTN)CpuPolicyPpi->SecurityConfig->BootGuardConfig - CpuPpiAddrDelta);
+ CpuPolicyPpi->OverclockingConfig = (OVERCLOCKING_CONFIG_PPI *)((UINTN)CpuPolicyPpi->OverclockingConfig - CpuPpiAddrDelta);
+
+ CopyMem (
+ (VOID *) (UINTN) &ExchangeInfo->GdtrProfile,
+ (VOID *) (UINTN) AcpiCpuData->GdtrProfile,
+ sizeof (PSEUDO_DESCRIPTOR)
+ );
+ CopyMem (
+ (VOID *) (UINTN) &ExchangeInfo->IdtrProfile,
+ (VOID *) (UINTN) AcpiCpuData->IdtrProfile,
+ sizeof (PSEUDO_DESCRIPTOR)
+ );
+
+ DEBUG ((EFI_D_INFO, "Cpu S3 Bootscript at %08X\n", (UINT32) ExchangeInfo->S3BootScriptTable));
+
+#ifdef BOOT_GUARD_SUPPORT_FLAG
+#if BOOT_GUARD_SUPPORT_FLAG == 1
+ //
+ // Disable PBET before send IPI to APs
+ //
+ StopPbeTimer ();
+#endif
+#endif
+
+ ///
+ /// Don't touch MPCPU private data
+ /// Here we use ExchangeInfo instead
+ ///
+ ///
+ /// Send INIT IPI - SIPI to all APs
+ ///
+ SendInterrupt (
+ BROADCAST_MODE_ALL_EXCLUDING_SELF,
+ 0,
+ 0,
+ DELIVERY_MODE_INIT,
+ TRIGGER_MODE_EDGE,
+ TRUE,
+ PeiServices,
+ PeiStall
+ );
+
+ PeiStall->Stall (
+ PeiServices,
+ PeiStall,
+ 10 * STALL_ONE_MILLI_SECOND ///< 10ms
+ );
+
+ SendInterrupt (
+ BROADCAST_MODE_ALL_EXCLUDING_SELF,
+ 0,
+ (UINT32) RShiftU64 (WakeUpBuffer,
+ 12),
+ DELIVERY_MODE_SIPI,
+ TRIGGER_MODE_EDGE,
+ TRUE,
+ PeiServices,
+ PeiStall
+ );
+
+ PeiStall->Stall (
+ PeiServices,
+ PeiStall,
+ 200 * STALL_ONE_MICRO_SECOND ///< 200us
+ );
+
+ SendInterrupt (
+ BROADCAST_MODE_ALL_EXCLUDING_SELF,
+ 0,
+ (UINT32) RShiftU64 (WakeUpBuffer,
+ 12),
+ DELIVERY_MODE_SIPI,
+ TRIGGER_MODE_EDGE,
+ TRUE,
+ PeiServices,
+ PeiStall
+ );
+
+ PeiStall->Stall (
+ PeiServices,
+ PeiStall,
+ 200 * STALL_ONE_MICRO_SECOND ///< 200us
+ );
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This routine is used to search SMRAM and get SmramCpuData point.
+
+ @param[in] PeiServices - PEI services global pointer
+ @param[in] SmmAccessPpi - SmmAccess PPI instance
+
+ @retval SmramCpuData - The pointer of CPU information in SMRAM.
+**/
+STATIC
+SMRAM_CPU_DATA *
+GetSmmCpuData (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_SMM_ACCESS_PPI *SmmAccessPpi
+ )
+{
+ EFI_SMRAM_DESCRIPTOR *SmramRanges;
+ UINTN SmramRangeCount;
+ UINTN Size;
+ EFI_STATUS Status;
+ UINT32 Address;
+ SMRAM_CPU_DATA *SmramCpuData;
+
+ ///
+ /// Get all SMRAM range
+ ///
+ Size = 0;
+ Status = SmmAccessPpi->GetCapabilities (PeiServices, SmmAccessPpi, &Size, NULL);
+ ASSERT (Status == EFI_BUFFER_TOO_SMALL);
+
+ Status = PeiServicesAllocatePool (
+ Size,
+ (VOID **) &SmramRanges
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ Status = SmmAccessPpi->GetCapabilities (PeiServices, SmmAccessPpi, &Size, SmramRanges);
+ ASSERT_EFI_ERROR (Status);
+
+ Size /= sizeof (*SmramRanges);
+ SmramRangeCount = Size;
+
+ ///
+ /// BUGBUG: We assume TSEG is the last range of SMRAM in SmramRanges
+ ///
+ SmramRanges += SmramRangeCount - 1;
+
+ DEBUG ((EFI_D_INFO, "TsegBase - %x\n", SmramRanges->CpuStart));
+ DEBUG ((EFI_D_INFO, "TsegTop - %x\n", SmramRanges->CpuStart + SmramRanges->PhysicalSize));
+
+ ///
+ /// Search SMRAM on page alignment for the SMMNVS signature
+ ///
+ for (Address = (UINT32) (SmramRanges->CpuStart + SmramRanges->PhysicalSize - EFI_PAGE_SIZE);
+ Address >= (UINT32) SmramRanges->CpuStart;
+ Address -= EFI_PAGE_SIZE
+ ) {
+ SmramCpuData = (SMRAM_CPU_DATA *) (UINTN) Address;
+ if (CompareGuid (&SmramCpuData->HeaderGuid, &gSmramCpuDataHeaderGuid)
+ && SmramCpuData->AcpiCpuData.NumberOfCpus == (UINT32)(AsmReadMsr64(0x35) & 0xffff)) { //(AMI_CHG)
+ ///
+ /// Find it
+ ///
+ return SmramCpuData;
+ }
+ }
+
+ ASSERT (FALSE);
+
+ return NULL;
+}
+
+/**
+ This routine is restore the CPU information from SMRAM to original reserved memory region.
+
+ @param[in] PeiServices - PEI services global pointer
+
+ @retval AcpiCpuData - The pointer of CPU information in reserved memory.
+**/
+ACPI_CPU_DATA *
+RestoreSmramCpuData (
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ PEI_SMM_ACCESS_PPI *SmmAccessPpi;
+ SMRAM_CPU_DATA *SmramCpuData;
+ EFI_STATUS Status;
+ ACPI_CPU_DATA *AcpiCpuData;
+ MP_CPU_S3_DATA_POINTER *CpuS3DataPtr;
+ PSEUDO_DESCRIPTOR *Idtr;
+ PSEUDO_DESCRIPTOR *Gdtr;
+ UINTN MicrocodeSize;
+ EFI_CPU_MICROCODE_HEADER **Microcode;
+ EFI_CPU_MICROCODE_HEADER *LockBoxMicrocode;
+ UINTN Index;
+
+ Status = PeiServicesLocatePpi (
+ &gPeiSmmAccessPpiGuid,
+ 0,
+ NULL,
+ (VOID **) &SmmAccessPpi
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Open all SMM regions
+ ///
+ Index = 0;
+ do {
+ Status = SmmAccessPpi->Open (PeiServices, SmmAccessPpi, Index);
+ Index++;
+ } while (!EFI_ERROR (Status));
+
+ SmramCpuData = GetSmmCpuData (PeiServices, SmmAccessPpi);
+ DEBUG ((EFI_D_INFO, "CpuS3 SmramCpuData - 0x%x \n", SmramCpuData));
+ DEBUG ((EFI_D_INFO, "SmramCpuData->GdtrProfileSize - %x\n", SmramCpuData->GdtrProfileSize));
+ DEBUG ((EFI_D_INFO, "SmramCpuData->GdtSize - %x\n", SmramCpuData->GdtSize));
+ DEBUG ((EFI_D_INFO, "SmramCpuData->IdtrProfileSize - %x\n", SmramCpuData->IdtrProfileSize));
+ DEBUG ((EFI_D_INFO, "SmramCpuData->IdtSize - %x\n", SmramCpuData->IdtSize));
+ DEBUG ((EFI_D_INFO, "SmramCpuData->CpuPrivateDataSize - %x\n", SmramCpuData->CpuPrivateDataSize));
+ DEBUG ((EFI_D_INFO, "SmramCpuData->S3BootScriptTableSize - %x\n", SmramCpuData->S3BootScriptTableSize));
+ DEBUG ((EFI_D_INFO, "SmramCpuData->S3BspMtrrTableSize - %x\n", SmramCpuData->S3BspMtrrTableSize));
+ DEBUG ((EFI_D_INFO, "SmramCpuData->MicrocodePointerBufferSize - %x\n", SmramCpuData->MicrocodePointerBufferSize));
+ DEBUG ((EFI_D_INFO, "SmramCpuData->MicrocodeDataBufferSize - %x\n", SmramCpuData->MicrocodeDataBufferSize));
+ DEBUG ((EFI_D_INFO, "SmramCpuData->GdtrProfileOffset - %x\n", SmramCpuData->GdtrProfileOffset));
+ DEBUG ((EFI_D_INFO, "SmramCpuData->GdtOffset - %x\n", SmramCpuData->GdtOffset));
+ DEBUG ((EFI_D_INFO, "SmramCpuData->IdtrProfileOffset - %x\n", SmramCpuData->IdtrProfileOffset));
+ DEBUG ((EFI_D_INFO, "SmramCpuData->IdtOffset - %x\n", SmramCpuData->IdtOffset));
+ DEBUG ((EFI_D_INFO, "SmramCpuData->CpuPrivateDataOffset - %x\n", SmramCpuData->CpuPrivateDataOffset));
+ DEBUG ((EFI_D_INFO, "SmramCpuData->S3BootScriptTableOffset - %x\n", SmramCpuData->S3BootScriptTableOffset));
+ DEBUG ((EFI_D_INFO, "SmramCpuData->S3BspMtrrTableOffset - %x\n", SmramCpuData->S3BspMtrrTableOffset));
+ DEBUG ((EFI_D_INFO, "SmramCpuData->MicrocodePointerBufferOffset - %x\n", SmramCpuData->MicrocodePointerBufferOffset));
+ DEBUG ((EFI_D_INFO, "SmramCpuData->MicrocodeDataBufferOffset - %x\n", SmramCpuData->MicrocodeDataBufferOffset));
+
+ ///
+ /// Start restore data to NVS
+ ///
+ AcpiCpuData = (ACPI_CPU_DATA *) (UINTN) SmramCpuData->AcpiCpuPointer;
+ CopyMem (AcpiCpuData, &SmramCpuData->AcpiCpuData, sizeof (ACPI_CPU_DATA));
+
+ CopyMem (
+ (VOID *) (UINTN) AcpiCpuData->GdtrProfile,
+ (UINT8 *) SmramCpuData + SmramCpuData->GdtrProfileOffset,
+ SmramCpuData->GdtrProfileSize
+ );
+ Gdtr = (PSEUDO_DESCRIPTOR *) (UINTN) AcpiCpuData->GdtrProfile;
+ CopyMem (
+ (VOID *) (UINTN) Gdtr->Base,
+ (UINT8 *) SmramCpuData + SmramCpuData->GdtOffset,
+ SmramCpuData->GdtSize
+ );
+ CopyMem (
+ (VOID *) (UINTN) AcpiCpuData->IdtrProfile,
+ (UINT8 *) SmramCpuData + SmramCpuData->IdtrProfileOffset,
+ SmramCpuData->IdtrProfileSize
+ );
+ Idtr = (PSEUDO_DESCRIPTOR *) (UINTN) AcpiCpuData->IdtrProfile;
+ CopyMem (
+ (VOID *) (UINTN) Idtr->Base,
+ (UINT8 *) SmramCpuData + SmramCpuData->IdtOffset,
+ SmramCpuData->IdtSize
+ );
+
+ CopyMem (
+ (VOID *) (UINTN) AcpiCpuData->CpuPrivateData,
+ (UINT8 *) SmramCpuData + SmramCpuData->CpuPrivateDataOffset,
+ SmramCpuData->CpuPrivateDataSize
+ );
+ CpuS3DataPtr = (MP_CPU_S3_DATA_POINTER *) (UINTN) AcpiCpuData->CpuPrivateData;
+ CopyMem (
+ (VOID *) (UINTN) CpuS3DataPtr->S3BootScriptTable,
+ (UINT8 *) SmramCpuData + SmramCpuData->S3BootScriptTableOffset,
+ SmramCpuData->S3BootScriptTableSize
+ );
+ CopyMem (
+ (VOID *) (UINTN) CpuS3DataPtr->S3BspMtrrTable,
+ (UINT8 *) SmramCpuData + SmramCpuData->S3BspMtrrTableOffset,
+ SmramCpuData->S3BspMtrrTableSize
+ );
+
+ CopyMem (
+ (VOID *) (UINTN) AcpiCpuData->MicrocodePointerBuffer,
+ (UINT8 *) SmramCpuData + SmramCpuData->MicrocodePointerBufferOffset,
+ SmramCpuData->MicrocodePointerBufferSize
+ );
+ ///
+ /// Restore Microcode Data
+ ///
+ Microcode = (VOID *) (UINTN) AcpiCpuData->MicrocodePointerBuffer;
+ LockBoxMicrocode = (EFI_CPU_MICROCODE_HEADER *) ((UINT8 *) SmramCpuData + SmramCpuData->MicrocodeDataBufferOffset);
+ if (Microcode != NULL) {
+ Index = 0;
+ MicrocodeSize = 0;
+ while (Microcode[Index] != NULL) {
+ if (LockBoxMicrocode->DataSize == 0) {
+ MicrocodeSize = 2048;
+ } else {
+ MicrocodeSize = LockBoxMicrocode->TotalSize;
+ }
+
+ CopyMem (Microcode[Index], LockBoxMicrocode, MicrocodeSize);
+ LockBoxMicrocode = (EFI_CPU_MICROCODE_HEADER *) ((UINT8 *) LockBoxMicrocode + MicrocodeSize);
+ Index++;
+ }
+ }
+ ///
+ /// Close all SMM regions
+ ///
+ Index = 0;
+ do {
+ Status = SmmAccessPpi->Close (PeiServices, SmmAccessPpi, Index);
+ Index++;
+ } while (!EFI_ERROR (Status));
+
+ return AcpiCpuData;
+}
+
+/**
+ Initialize multiple processors.
+
+ @param[in] FfsHeader - Pointer to an alleged FFS file.
+ @param[in] PeiServices - Indirect reference to the PEI Services Table
+
+ @retval EFI_SUCCESS - Multiple processors are intialized successfully
+**/
+EFI_STATUS
+InitializeCpu (
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_STATUS Status;
+ EFI_PEI_STALL_PPI *PeiStall;
+ ACPI_CPU_DATA *AcpiCpuData;
+ EFI_BOOT_MODE BootMode;
+ UINT64 *MtrrValues;
+ MP_CPU_S3_DATA_POINTER *CpuS3DataPtr;
+ UINTN VariableMtrrNumber;
+ EFI_PHYSICAL_ADDRESS WakeUpBuffer;
+ MP_CPU_EXCHANGE_INFO *ExchangeInfo;
+ UINT32 FailedRevision;
+ VOID *Hob;
+
+ DEBUG ((EFI_D_INFO, "Cpu S3 dispatch\n"));
+
+ Status = PeiServicesGetBootMode (&BootMode);
+ if (EFI_ERROR (Status)) {
+ ///
+ /// If not in S3 boot path. do nothing
+ ///
+ return EFI_SUCCESS;
+ }
+
+ if (BootMode != BOOT_ON_S3_RESUME) {
+ return EFI_SUCCESS;
+ }
+
+ DEBUG ((EFI_D_INFO, "Cpu S3 Entrypoint\n"));
+
+ ///
+ /// Restore ACPI Nvs data from SMRAM
+ ///
+ AcpiCpuData = RestoreSmramCpuData (PeiServices);
+ DEBUG ((EFI_D_INFO, "CpuS3 RestoreSmramCpuData - 0x%x \n", AcpiCpuData));
+
+ AcpiCpuData->S3BootPath = TRUE;
+
+ Status = PeiServicesLocatePpi (
+ &gEfiPeiStallPpiGuid,
+ 0,
+ NULL,
+ (VOID **) &PeiStall
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ CpuS3DataPtr = (MP_CPU_S3_DATA_POINTER *) (UINTN) AcpiCpuData->CpuPrivateData;
+
+ VariableMtrrNumber = (UINTN) ((UINT64) AsmReadMsr64 (IA32_MTRR_CAP) & B_IA32_MTRR_VARIABLE_SUPPORT) * 2;
+ Status = PeiServicesAllocatePool (
+ (FixedMtrrNumber + MtrrDefTypeNumber + VariableMtrrNumber) * sizeof (UINT64),
+ (VOID **) &MtrrValues
+ );
+ ASSERT_EFI_ERROR (Status);
+ ReadMtrrRegisters (PeiServices, MtrrValues);
+
+ WakeUpBuffer = AcpiCpuData->WakeUpBuffer;
+ ExchangeInfo = (MP_CPU_EXCHANGE_INFO *) (UINTN) (WakeUpBuffer + (0x1000 - 0x200));
+ ExchangeInfo->WakeupCount = (UINT32) 0;
+ ExchangeInfo->FinishedCount = (UINT32) 0;
+
+ ///
+ /// Restore AP configuration
+ ///
+ WakeUpAPs (PeiServices, PeiStall, AcpiCpuData, MtrrValues, MPRendezvousProcedure);
+
+ ///
+ /// Program XApic register
+ ///
+ ProgramXApic (
+ TRUE
+ );
+
+ InitializeMicrocode (
+ ExchangeInfo,
+ (EFI_CPU_MICROCODE_HEADER **) (UINTN) AcpiCpuData->MicrocodePointerBuffer,
+ &FailedRevision
+ );
+
+ ///
+ /// Restore features for BSP
+ ///
+ InitializeFeaturesLog (
+ PeiServices,
+ (MP_CPU_S3_SCRIPT_DATA *) CpuS3DataPtr->S3BootScriptTable
+ );
+
+ ///
+ /// Save acpi cpu data into one hob, it will be used by a callback when End of Pei Signal installed.
+ ///
+ Hob = BuildGuidDataHob (
+ &gPeiAcpiCpuDataGuid,
+ (VOID *)(UINTN)AcpiCpuData,
+ (UINTN) sizeof (ACPI_CPU_DATA)
+ );
+ ASSERT (Hob != NULL);
+
+ //(AMI_CHG)>
+ //DEBUG ((EFI_D_INFO, "Install CPU S3 Notify callback\n"));
+ //Status = PeiServicesNotifyPpi (&mCpuS3ResumeNotifyDesc);
+ //ASSERT_EFI_ERROR (Status);
+ //(AMI_CHG)<
+
+ ///
+ /// Wait for all APs to complete
+ ///
+ while (ExchangeInfo->FinishedCount < AcpiCpuData->NumberOfCpus - 1) {
+ CpuPause ();
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This function handles CPU S3 resume task
+
+ @param[in] PeiServices - Pointer to PEI Services Table.
+ @param[in] NotifyDesc - Pointer to the descriptor for the Notification event that
+ caused this function to execute.
+ @param[in] Ppi - Pointer to the PPI data associated with this function.
+
+ @retval EFI_STATUS - Always return EFI_SUCCESS
+**/
+STATIC
+EFI_STATUS
+CpuS3ResumeAtEndOfPei (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
+ IN VOID *Ppi
+ )
+{
+
+ EFI_STATUS Status;
+ EFI_PEI_STALL_PPI *PeiStall;
+ ACPI_CPU_DATA *AcpiCpuData;
+ EFI_PHYSICAL_ADDRESS WakeUpBuffer;
+ MP_CPU_S3_DATA_POINTER *CpuS3DataPtr;
+ MP_CPU_EXCHANGE_INFO *ExchangeInfo;
+ VOID *Hob;
+
+ DEBUG ((EFI_D_INFO, "Cpu S3 callback Entry\n"));
+
+ ///
+ /// Find the saved acpi cpu data from HOB.
+ ///
+ AcpiCpuData = NULL;
+ Hob = GetFirstGuidHob (&gPeiAcpiCpuDataGuid);
+ if (Hob != NULL) {
+ AcpiCpuData = (ACPI_CPU_DATA *) ((UINTN) Hob + sizeof (EFI_HOB_GUID_TYPE));
+ ASSERT (AcpiCpuData != NULL);
+ if (AcpiCpuData == NULL) {
+ return EFI_UNSUPPORTED;
+ }
+ } else {
+ return EFI_UNSUPPORTED;
+ }
+
+ WakeUpBuffer = AcpiCpuData->WakeUpBuffer;
+ ExchangeInfo = (MP_CPU_EXCHANGE_INFO *) (UINTN) (WakeUpBuffer + (0x1000 - 0x200));
+ ///
+ /// Have APs to continue the task - Restore S3BspMtrrTable
+ ///
+ ExchangeInfo->WakeupCount = (UINT32) 0;
+ ExchangeInfo->FinishedCount = (UINT32) 0;
+
+ PeiStall = NULL;
+ Status = PeiServicesLocatePpi (
+ &gEfiPeiStallPpiGuid,
+ 0,
+ NULL,
+ (VOID **) &PeiStall
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Set MTRR to the final values
+ /// Do not do it too early so as to avoid performance penalty
+ ///
+ CpuS3DataPtr = (MP_CPU_S3_DATA_POINTER *) (UINTN) AcpiCpuData->CpuPrivateData;
+
+#ifdef EFI_DEBUG
+ ShowMtrrRegisters (PeiServices, (EFI_MTRR_VALUES *) CpuS3DataPtr->S3BspMtrrTable);
+#endif
+ SetMtrrRegisters (PeiServices, (EFI_MTRR_VALUES *) CpuS3DataPtr->S3BspMtrrTable);
+
+ PeiStall->Stall (
+ PeiServices,
+ PeiStall,
+ 1 * STALL_ONE_MILLI_SECOND ///< 1ms
+ );
+
+ while (ExchangeInfo->FinishedCount < AcpiCpuData->NumberOfCpus - 1) {
+ CpuPause ();
+ }
+
+ return EFI_SUCCESS;
+
+}
diff --git a/ReferenceCode/Haswell/CpuS3/Pei/CpuS3Peim.cif b/ReferenceCode/Haswell/CpuS3/Pei/CpuS3Peim.cif
new file mode 100644
index 0000000..2cdadb9
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuS3/Pei/CpuS3Peim.cif
@@ -0,0 +1,18 @@
+<component>
+ name = "CpuS3Peim"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Haswell\CpuS3\Pei"
+ RefName = "CpuS3Peim"
+[files]
+"CpuAsm.asm"
+"CpuS3Peim.c"
+"CpuS3Peim.dxs"
+"CpuS3Peim.inf"
+"CpuS3Peim.mak"
+"CpuS3Peim.sdl"
+"Microcode.c"
+"MpCommon.h"
+"MtrrSync.c"
+"MpFuncs.asm"
+"MpEqu.inc"
+<endComponent>
diff --git a/ReferenceCode/Haswell/CpuS3/Pei/CpuS3Peim.dxs b/ReferenceCode/Haswell/CpuS3/Pei/CpuS3Peim.dxs
new file mode 100644
index 0000000..45d6061
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuS3/Pei/CpuS3Peim.dxs
@@ -0,0 +1,31 @@
+/** @file
+ Dependency expression source file.
+
+@copyright
+ Copyright (c) 2005 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+
+#include "EfiDepex.h"
+#include EFI_PPI_DEFINITION (BootMode)
+#include EFI_PPI_CONSUMER (MemoryDiscovered)
+#include EFI_PPI_DEFINITION (SmmAccess)
+
+DEPENDENCY_START
+ PEI_MASTER_BOOT_MODE_PEIM_PPI AND
+ PEI_PERMANENT_MEMORY_INSTALLED_PPI_GUID AND
+ PEI_SMM_ACCESS_PPI_GUID
+DEPENDENCY_END
diff --git a/ReferenceCode/Haswell/CpuS3/Pei/CpuS3Peim.inf b/ReferenceCode/Haswell/CpuS3/Pei/CpuS3Peim.inf
new file mode 100644
index 0000000..bb2c9c0
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuS3/Pei/CpuS3Peim.inf
@@ -0,0 +1,102 @@
+## @file
+# @todo ADD DESCRIPTION
+#
+#@copyright
+# Copyright (c) 2005 - 2013 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = CpuS3Peim
+FILE_GUID = C866BD71-7C79-4BF1-A93B-066B830D8F9A
+COMPONENT_TYPE = PE32_PEIM
+
+[sources.common]
+ CpuS3Peim.c
+ MtrrSync.c
+ Microcode.c
+
+ MpFuncs.asm
+ CpuAsm.asm
+
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGluePeimEntryPoint.c
+
+[includes.common]
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Pei/Include
+ $(EDK_SOURCE)/Foundation/Cpu/Pentium/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include/Library
+
+#
+# Edk II Glue Library, some hearder are included by R9 header so have to include
+#
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Framework
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include/Library
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/SampleCode
+
+
+[libraries.common]
+ EdkFrameworkPpiLib
+ EdkIIGlueBaseLib
+ EdkIIGlueBaseMemoryLib
+ EdkIIGluePeiDebugLibReportStatusCode
+ EdkIIGluePeiReportStatusCodeLib
+ EdkIIGluePeiServicesLib
+ EdkPpiLib
+ CpuPpiLib
+ $(PROJECT_SA_FAMILY)SampleCodePpiLib
+ CpuGuidLib
+ CpuIA32Lib
+ EdkIIGlueBaseTimerLibLocalApic
+ EdkIIGluePeiHobLib
+ CpuPlatformLib
+ BootGuardLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT=_ModuleEntryPoint
+ DPX_SOURCE=CpuS3Peim.dxs
+
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=InitializeCpu
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_LIB__ \
+ -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_PEI_SERVICES_LIB__
diff --git a/ReferenceCode/Haswell/CpuS3/Pei/CpuS3Peim.mak b/ReferenceCode/Haswell/CpuS3/Pei/CpuS3Peim.mak
new file mode 100644
index 0000000..1fe6836
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuS3/Pei/CpuS3Peim.mak
@@ -0,0 +1,76 @@
+# MAK file for the eModule: CpuS3Peim
+
+EDK : CpuS3Peim
+
+BUILD_CpuS3Peim_DIR = $(BUILD_DIR)\$(CpuS3Peim_DIR)
+
+$(BUILD_DIR)\CpuS3Peim.mak : $(CpuS3Peim_DIR)\CpuS3Peim.cif $(BUILD_RULES)
+ $(CIF2MAK) $(CpuS3Peim_DIR)\CpuS3Peim.cif $(CIF2MAK_DEFAULTS)
+
+CpuS3Peim : $(BUILD_DIR)\CpuS3Peim.MAK CpuS3PeimBin
+
+CpuS3Peim_OBJECTS = \
+ $(BUILD_CpuS3Peim_DIR)\CpuS3Peim.obj \
+ $(BUILD_CpuS3Peim_DIR)\MtrrSync.obj \
+ $(BUILD_CpuS3Peim_DIR)\Microcode.obj \
+ $(BUILD_CpuS3Peim_DIR)\MpFuncs.obj \
+ $(BUILD_CpuS3Peim_DIR)\CpuAsm.obj
+
+CpuS3Peim_MY_INCLUDES= \
+ $(EDK_INCLUDES) \
+ /I$(PROJECT_CPU_ROOT) \
+ /I$(PROJECT_CPU_ROOT)\Include \
+ $(PROJECT_CPU_INCLUDES)\
+ /I$(INTEL_SYSTEM_AGENT_DIR) \
+ /I$(INTEL_SYSTEM_AGENT_DIR)\Include \
+ /I$(INTEL_SYSTEM_AGENT_DIR)\SampleCode \
+
+#- $(CPU_INCLUDES)\
+
+CpuS3Peim_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=InitializeCpu"\
+ /D __EDKII_GLUE_BASE_LIB__ \
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_PEI_SERVICES_LIB__ \
+ /D __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_MM7__ \
+
+
+CpuS3Peim_LIBS =\
+ $(EDKFRAMEWORKPPILIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EdkIIGlueBaseMemoryLib_LIB) \
+ $(EdkIIGluePeiDebugLibReportStatusCode_LIB) \
+ $(EdkIIGluePeiReportStatusCodeLib_LIB)\
+ $(EdkIIGluePeiServicesLib_LIB)\
+ $(EDKPPILIB)\
+ $(EdkIIGlueBaseTimerLibLocalApic_LIB)\
+ $(EdkIIGluePeiHobLib_LIB) \
+ $(CPU_PPI_LIB)\
+ $(INTEL_SA_PPI_LIB)\
+ $(CpuGuidLib_LIB)\
+ $(CPUIA32LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(EdkIIGlueBasePciExpressLib_LIB)\
+ $(PchPlatformPeiLib_LIB)\
+ $(CpuPlatformLib_LIB)\
+ $(BootGuardLib_LIB)\
+ $(IntelSaSampleCodePpiLib_LIB)\
+
+CpuS3PeimBin : $(CpuS3Peim_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\CpuS3Peim.mak all\
+ NAME=CpuS3Peim\
+ MAKEFILE=$(BUILD_DIR)\CpuS3Peim.mak \
+ "MY_INCLUDES=$(CpuS3Peim_MY_INCLUDES)" \
+ "MY_DEFINES=$(CpuS3Peim_DEFINES)"\
+ OBJECTS="$(CpuS3Peim_OBJECTS)" \
+ GUID=C866BD71-7C79-4BF1-A93B-066B830D8F9A\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=PEIM \
+ EDKIIModule=PEIM\
+ DEPEX1=$(CpuS3Peim_DIR)\CpuS3Peim.DXS \
+ DEPEX1_TYPE=EFI_SECTION_PEI_DEPEX \
+ COMPRESS=0
+#-----------------------------------------------------------------------
diff --git a/ReferenceCode/Haswell/CpuS3/Pei/CpuS3Peim.sdl b/ReferenceCode/Haswell/CpuS3/Pei/CpuS3Peim.sdl
new file mode 100644
index 0000000..011eee3
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuS3/Pei/CpuS3Peim.sdl
@@ -0,0 +1,37 @@
+TOKEN
+ Name = "CpuS3Peim_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable Cpu Pei init support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "CpuS3Peim_DIR"
+End
+
+MODULE
+ Help = "Includes CpuS3Peim.mak to Project"
+ File = "CpuS3Peim.mak"
+End
+
+#-ELINK
+#- Name = "CpuS3Peim_INCLUDES"
+#- InvokeOrder = ReplaceParent
+#-End
+#-
+#-ELINK
+#- Name = "/I$(CpuS3Peim_DIR)"
+#- Parent = "CpuS3Peim_INCLUDES"
+#- InvokeOrder = AfterParent
+#-End
+
+ELINK
+ Name = "$(BUILD_DIR)\CpuS3Peim.ffs"
+ Parent = "FV_BB"
+ InvokeOrder = AfterParent
+End
+
diff --git a/ReferenceCode/Haswell/CpuS3/Pei/Microcode.c b/ReferenceCode/Haswell/CpuS3/Pei/Microcode.c
new file mode 100644
index 0000000..4d596d3
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuS3/Pei/Microcode.c
@@ -0,0 +1,472 @@
+/** @file
+ CPU microcode update PEIM
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+///
+/// External include files do NOT need to be explicitly specified in real EDKII
+/// environment
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#include "MpCommon.h"
+#define SKIP_MICROCODE_CHECKSUM_CHECK 1
+#endif
+///
+/// Array of pointers which each points to 1 microcode update binary (in memory)
+///
+EFI_CPU_MICROCODE_HEADER **mMicrocodePointerBuffer;
+
+///
+/// Function declarations
+///
+EFI_STATUS
+FindLoadMicrocode (
+ IN UINT32 Cpuid,
+ IN EFI_CPU_MICROCODE_HEADER **MicrocodePointerBuffer,
+ IN OUT UINT32 *Revision
+ );
+
+/**
+ Check number of cores in the package.
+
+ @retval Number of cores in the package.
+**/
+UINT8
+GetCoreNumber (
+ VOID
+ )
+{
+ EFI_CPUID_REGISTER Cpuid;
+ AsmCpuidEx (
+ 4,
+ 0,
+ &Cpuid.RegEax,
+ NULL,
+ NULL,
+ NULL
+ );
+ return (UINT8) ((RShiftU64 (Cpuid.RegEax, 26) & 0x3f) + 1);
+}
+
+/**
+ Check if this is non-core processor - HT AP thread
+
+ @retval TRUE if this is HT AP thread
+ @retval FALSE if this is core thread
+**/
+BOOLEAN
+IsSecondaryThread (
+ VOID
+ )
+{
+ UINT32 ApicID;
+ EFI_CPUID_REGISTER CpuidRegisters;
+ UINT8 CpuCount;
+ UINT8 CoreCount;
+ UINT8 CpuPerCore;
+ UINT32 Mask;
+
+ ApicID = GetApicID ();
+
+ AsmCpuid (
+ CPUID_VERSION_INFO,
+ &CpuidRegisters.RegEax,
+ &CpuidRegisters.RegEbx,
+ &CpuidRegisters.RegEcx,
+ &CpuidRegisters.RegEdx
+ );
+ if ((CpuidRegisters.RegEdx & 0x10000000) == 0) {
+ return FALSE;
+ }
+
+ CpuCount = (UINT8) ((CpuidRegisters.RegEbx >> 16) & 0xff);
+ if (CpuCount == 1) {
+ return FALSE;
+ }
+
+ AsmCpuid (
+ CPUID_SIGNATURE,
+ &CpuidRegisters.RegEax,
+ &CpuidRegisters.RegEbx,
+ &CpuidRegisters.RegEcx,
+ &CpuidRegisters.RegEdx
+ );
+ if (CpuidRegisters.RegEax > 3) {
+
+ CoreCount = GetCoreNumber ();
+ } else {
+ CoreCount = 1;
+ }
+ ///
+ /// Assumes there is symmetry across core boundary, i.e. each core within a package has the same number of logical processors
+ ///
+ if (CpuCount == CoreCount) {
+ return FALSE;
+ }
+
+ CpuPerCore = CpuCount / CoreCount;
+
+ ///
+ /// Assume 1 Core has no more than 8 threads
+ ///
+ if (CpuPerCore == 2) {
+ Mask = 0x1;
+ } else if (CpuPerCore <= 4) {
+ Mask = 0x3;
+ } else {
+ Mask = 0x7;
+ }
+
+ if ((ApicID & Mask) == 0) {
+ return FALSE;
+ } else {
+ return TRUE;
+ }
+}
+
+/**
+ Returns the processor microcode revision of the processor installed in the system.
+
+ @retval Processor Microcode Revision
+**/
+UINT32
+GetCpuUcodeRevision (
+ VOID
+ )
+{
+ AsmWriteMsr64 (MSR_IA32_BIOS_SIGN_ID, 0);
+ EfiCpuid (CPUID_VERSION_INFO, NULL);
+ return (UINT32) RShiftU64 (AsmReadMsr64 (MSR_IA32_BIOS_SIGN_ID), 32);
+}
+
+/**
+ Wait till all primary threads done the microcode load
+
+ @param[in] ExchangeInfo - Pointer to the exchange info buffer for output.
+**/
+VOID
+WaitForPrimaryThreadMcuUpdate (
+ IN MP_CPU_EXCHANGE_INFO *ExchangeInfo
+ )
+{
+ UINTN CoreNumber;
+ CoreNumber = (UINTN) ((RShiftU64 (AsmReadMsr64 (MSR_CORE_THREAD_COUNT), 16)) & 0xffff);
+ if (IsSecondaryThread ()) {
+ while (ExchangeInfo->McuLoadCount < CoreNumber) {
+ CpuPause ();
+ }
+ }
+}
+
+/**
+ This function checks the MCU revision to decide if BIOS needs to load
+ microcode.
+
+ @param[in] MicrocodePointer - Microcode in memory
+ @param[in] Revision - Current CPU microcode revision
+
+ @retval EFI_SUCCESS - BIOS needs to load microcode
+ @retval EFI_ABORTED - Don't need to update microcode
+**/
+EFI_STATUS
+CheckMcuRevision (
+ IN EFI_CPU_MICROCODE_HEADER *MicrocodePointer,
+ IN UINT32 Revision
+ )
+{
+ EFI_STATUS Status;
+ Status = EFI_ABORTED;
+
+ if (Revision == 0) {
+ Status = EFI_SUCCESS;
+ }
+
+ return Status;
+}
+
+/**
+ This will locate a processor microcode and if it finds a newer revision, it will
+ load it to the processor.
+
+ @param[in] ExchangeInfo - Pointer to the exchange info buffer for output.
+ @param[in] MicrocodePointerBuffer - The Array of pointers which each points to 1 microcode update binary (in memory)
+ @param[in] FailedRevision - The microcode revision that fails to be loaded
+
+ @retval EFI_SUCCESS - A new microcode update is loaded
+ @retval Other - Due to some reason, no new microcode update is loaded
+**/
+EFI_STATUS
+InitializeMicrocode (
+ IN MP_CPU_EXCHANGE_INFO *ExchangeInfo,
+ IN EFI_CPU_MICROCODE_HEADER **MicrocodePointerBuffer,
+ OUT UINT32 *FailedRevision
+ )
+{
+ EFI_STATUS Status;
+ EFI_CPUID_REGISTER Cpuid;
+ UINT32 UcodeRevision;
+ ACPI_CPU_DATA *mAcpiCpuData;
+
+ mAcpiCpuData = (ACPI_CPU_DATA *) (ExchangeInfo->AcpiCpuDataAddress);
+
+ AsmCpuid (
+ CPUID_VERSION_INFO,
+ &Cpuid.RegEax,
+ &Cpuid.RegEbx,
+ &Cpuid.RegEcx,
+ &Cpuid.RegEdx
+ );
+
+ WaitForPrimaryThreadMcuUpdate (ExchangeInfo);
+ UcodeRevision = GetCpuUcodeRevision ();
+ Status = FindLoadMicrocode (
+ Cpuid.RegEax,
+ MicrocodePointerBuffer,
+ &UcodeRevision
+ );
+ *FailedRevision = UcodeRevision;
+
+ InterlockedIncrement (&(ExchangeInfo->McuLoadCount));
+ return Status;
+}
+
+/**
+ This will load the microcode to the processors.
+
+ @param[in] MicrocodeEntryPoint - The microcode update pointer
+ @param[in] Revision - The current (before load this microcode update) microcode revision
+
+ @retval EFI_SUCCESS - Microcode loaded
+ @retval EFI_LOAD_ERROR - Microcode not loaded
+**/
+EFI_STATUS
+LoadMicrocode (
+ IN EFI_CPU_MICROCODE_HEADER *MicrocodeEntryPoint,
+ IN UINT32 *Revision
+ )
+{
+ ///
+ /// Load the Processor Microcode
+ ///
+ AsmWriteMsr64 (
+ MSR_IA32_BIOS_UPDT_TRIG,
+ (UINT64) ((UINTN) MicrocodeEntryPoint + sizeof (EFI_CPU_MICROCODE_HEADER))
+ );
+
+ ///
+ /// Verify that the microcode has been loaded
+ ///
+ if (GetCpuUcodeRevision () == *Revision) {
+ return EFI_LOAD_ERROR;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Verify the DWORD type checksum
+
+ @param[in] ChecksumAddr - The start address to be checkumed
+ @param[in] ChecksumLen - The length of data to be checksumed
+
+ @retval EFI_SUCCESS - Checksum correct
+ @retval EFI_CRC_ERROR - Checksum incorrect
+**/
+EFI_STATUS
+Checksum32Verify (
+ IN UINT32 *ChecksumAddr,
+ IN UINT32 ChecksumLen
+ )
+{
+#if SKIP_MICROCODE_CHECKSUM_CHECK
+ return EFI_SUCCESS;
+#else
+ UINT32 Checksum;
+ UINT32 Index;
+
+ Checksum = 0;
+
+ for (Index = 0; Index < ChecksumLen; Index++) {
+ Checksum += ChecksumAddr[Index];
+ }
+
+ return (Checksum == 0) ? EFI_SUCCESS : EFI_CRC_ERROR;
+#endif
+}
+
+/**
+ Find microcode data
+
+ @param[in] Cpuid - processor CPUID
+ @param[in] MicrocodePointerBuffer - the pointer for microcode buffer
+ @param[in] Revision - revision of microcode
+
+ @retval The pointer of microcode header
+**/
+EFI_CPU_MICROCODE_HEADER *
+FindMicrocode (
+ IN UINTN Cpuid,
+ IN EFI_CPU_MICROCODE_HEADER **MicrocodePointerBuffer,
+ IN UINT32 *Revision
+ )
+{
+ EFI_STATUS Status;
+ EFI_CPU_MICROCODE_HEADER *MicrocodeEntryPoint;
+ UINT8 Index;
+ UINT8 ExtendedIndex;
+ UINT8 MsrPlatform;
+ UINT32 ExtendedTableLength;
+ UINT32 ExtendedTableCount;
+ BOOLEAN CorrectMicrocode;
+ EFI_CPU_MICROCODE_EXTENDED_TABLE *ExtendedTable;
+ EFI_CPU_MICROCODE_EXTENDED_TABLE_HEADER *ExtendedTableHeader;
+
+ Status = EFI_NOT_FOUND;
+ ExtendedTableLength = 0;
+ MicrocodeEntryPoint = NULL;
+ CorrectMicrocode = FALSE;
+
+ ///
+ /// The index of platform information resides in bits 50:52 of MSR IA32_PLATFORM_ID
+ ///
+ MsrPlatform = (UINT8) (RShiftU64 (AsmReadMsr64 (MSR_IA32_PLATFORM_ID), 50) & 0x07);
+
+ Index = 0;
+ while (MicrocodePointerBuffer[Index] != NULL) {
+ MicrocodeEntryPoint = MicrocodePointerBuffer[Index];
+ CorrectMicrocode = FALSE;
+ ///
+ /// Check if the microcode is for the Cpu and the version is newer
+ /// and the update can be processed on the platform
+ ///
+ if ((MicrocodeEntryPoint->HeaderVersion == 0x00000001) &&
+ !EFI_ERROR (CheckMcuRevision (MicrocodeEntryPoint, *Revision))
+ ) {
+ if ((MicrocodeEntryPoint->ProcessorId == Cpuid) && (MicrocodeEntryPoint->ProcessorFlags & (1 << MsrPlatform))) {
+ if (MicrocodeEntryPoint->DataSize == 0) {
+ Status = Checksum32Verify ((UINT32 *) MicrocodeEntryPoint, 2048 / sizeof (UINT32));
+ } else {
+ Status = Checksum32Verify (
+ (UINT32 *) MicrocodeEntryPoint,
+ (MicrocodeEntryPoint->DataSize + sizeof (EFI_CPU_MICROCODE_HEADER)) / sizeof (UINT32)
+ );
+ }
+
+ if (!EFI_ERROR (Status)) {
+ CorrectMicrocode = TRUE;
+ }
+ } else if ((MicrocodeEntryPoint->DataSize != 0)) {
+ ///
+ /// Check the Extended Signature if the entended signature exist
+ /// Only the data size != 0 the extended signature may exist
+ ///
+ ExtendedTableLength = MicrocodeEntryPoint->TotalSize - (MicrocodeEntryPoint->DataSize + sizeof (EFI_CPU_MICROCODE_HEADER));
+ if (ExtendedTableLength != 0) {
+ ///
+ /// Extended Table exist, check if the CPU in support list
+ ///
+ ExtendedTableHeader = (EFI_CPU_MICROCODE_EXTENDED_TABLE_HEADER *) ((UINT8 *) (MicrocodeEntryPoint) + MicrocodeEntryPoint->DataSize + 48);
+ ///
+ /// Calulate Extended Checksum
+ ///
+ if ((ExtendedTableLength % 4) == 0) {
+ Status = Checksum32Verify ((UINT32 *) ExtendedTableHeader, ExtendedTableLength / sizeof (UINT32));
+ if (!EFI_ERROR (Status)) {
+ ///
+ /// Checksum correct
+ ///
+ ExtendedTableCount = ExtendedTableHeader->ExtendedSignatureCount;
+ ExtendedTable = (EFI_CPU_MICROCODE_EXTENDED_TABLE *) (ExtendedTableHeader + 1);
+ for (ExtendedIndex = 0; ExtendedIndex < ExtendedTableCount; ExtendedIndex++) {
+ ///
+ /// Verify Header
+ ///
+ if ((ExtendedTable->ProcessorSignature == Cpuid) && (ExtendedTable->ProcessorFlag & (1 << MsrPlatform))) {
+ Status = Checksum32Verify (
+ (UINT32 *) ExtendedTable,
+ sizeof (EFI_CPU_MICROCODE_EXTENDED_TABLE) / sizeof (UINT32)
+ );
+ if (!EFI_ERROR (Status)) {
+ ///
+ /// Find one
+ ///
+ CorrectMicrocode = TRUE;
+ break;
+ }
+ }
+
+ ExtendedTable++;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (CorrectMicrocode) {
+ break;
+ }
+
+ Index += 2;
+ }
+
+ if (!CorrectMicrocode) {
+ MicrocodeEntryPoint = NULL;
+ }
+
+ return MicrocodeEntryPoint;
+}
+
+/**
+ This will locate a processor microcode and if it finds a newer revision, it will
+ load it to the processor.
+
+ @param[in] Cpuid - Data returned by cpuid instruction
+ @param[in] MicrocodePointerBuffer - The Array of pointers which each points to 1 microcode update binary (in memory)
+ @param[in] Revision - As input parameter, the current microcode revision;
+ as output parameter, the microcode revision after microcode update is loaded
+
+ @retval EFI_SUCCESS - A new microcode update is loaded
+ @retval Other - Due to some reason, no new microcode update is loaded
+**/
+EFI_STATUS
+FindLoadMicrocode (
+ IN UINT32 Cpuid,
+ IN EFI_CPU_MICROCODE_HEADER **MicrocodePointerBuffer,
+ IN OUT UINT32 *Revision
+ )
+{
+ EFI_STATUS Status;
+ EFI_CPU_MICROCODE_HEADER *MicrocodeEntryPoint;
+
+ Status = EFI_NOT_FOUND;
+
+ MicrocodeEntryPoint = FindMicrocode (
+ Cpuid,
+ MicrocodePointerBuffer,
+ Revision
+ );
+
+ if (MicrocodeEntryPoint != NULL) {
+ Status = LoadMicrocode (MicrocodeEntryPoint, Revision);
+ *Revision = MicrocodeEntryPoint->UpdateRevision;
+ }
+
+ return Status;
+}
diff --git a/ReferenceCode/Haswell/CpuS3/Pei/MpCommon.h b/ReferenceCode/Haswell/CpuS3/Pei/MpCommon.h
new file mode 100644
index 0000000..63a28d7
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuS3/Pei/MpCommon.h
@@ -0,0 +1,275 @@
+/** @file
+ some definitions for MP and HT driver.
+
+@copyright
+ Copyright (c) 2005 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _MP_COMMON_
+#define _MP_COMMON_
+
+#include "Tiano.h"
+#include "EfiCombinationLib.h"
+#include "CpuAccess.h"
+#include "CpuPlatformLib.h"
+#include "EdkIIGlueBaseLib.h"
+
+///
+/// Protocol produced by this driver
+///
+/// #include EFI_PROTOCOL_PRODUCER (MpService)
+///
+/// Protocol consumed by this driver
+///
+#include EFI_PPI_DEPENDENCY (Stall)
+#include EFI_GUID_DEFINITION (SmramCpuDataHeader)
+#include EFI_PPI_DEFINITION (CpuPlatformPolicy)
+
+#define VacantFlag 0x00
+#define NotVacantFlag 0xff
+
+#define MICROSECOND 10
+
+#define MAXIMUM_CPU_NUMBER 0x40
+#define STACK_SIZE_PER_PROC 0x8000
+
+#define MAXIMUM_CPU_S3_TABLE_SIZE 0x1000
+
+#define IO_APIC_INDEX_REGISTER 0xFEC00000
+#define IO_APIC_DATA_REGISTER 0xFEC00010
+extern UINTN FixedMtrrNumber;
+extern UINTN MtrrDefTypeNumber;
+extern UINTN VariableMtrrNumber;
+
+typedef struct {
+ UINT16 Index;
+ UINT64 Value;
+} EFI_MTRR_VALUES;
+
+typedef struct {
+ UINT32 ApicId;
+ UINT32 MsrIndex;
+ UINT64 MsrValue;
+} MP_CPU_S3_SCRIPT_DATA;
+
+typedef struct {
+ UINT32 S3BootScriptTable;
+ UINT32 S3BspMtrrTable;
+ UINT32 VirtualWireMode;
+} MP_CPU_S3_DATA_POINTER;
+
+typedef struct {
+ UINT32 Lock;
+ UINT32 StackStart;
+ UINT32 StackSize;
+ UINT32 ApFunction;
+ PSEUDO_DESCRIPTOR GdtrProfile;
+ PSEUDO_DESCRIPTOR IdtrProfile;
+ UINT32 BufferStart;
+ UINT32 PmodeOffset;
+ UINT32 AcpiCpuDataAddress;
+ UINT32 MtrrValuesAddress;
+ UINT32 FinishedCount;
+ UINT32 WakeupCount;
+ UINT32 SerializeLock;
+ UINT32 MicrocodePointer;
+ MP_CPU_S3_SCRIPT_DATA *S3BootScriptTable;
+ UINT32 StartState;
+ UINT32 VirtualWireMode;
+ VOID (*SemaphoreCheck)(
+ UINT32 *SemaphoreAddress
+ );
+ UINT32 McuLoadCount;
+ EFI_PEI_SERVICES **PeiServices;
+ PEI_STALL_PPI *PeiStall;
+ UINT64 CpuPerfCtrlValue;
+ PEI_CPU_PLATFORM_POLICY_PPI *CpuPlatformPolicyPpi;
+} MP_CPU_EXCHANGE_INFO;
+
+/**
+ Get protected mode code offset
+
+ @retval Offset of protected mode code
+**/
+VOID *
+AsmGetPmodeOffset (
+ VOID
+ );
+
+/**
+ Get code offset of SemaphoreCheck
+
+ @retval Offset of SemaphoreCheck
+**/
+UINT32
+AsmGetSemaphoreCheckOffset (
+ VOID
+ );
+
+/**
+ Read MTRR settings
+
+ @param[in] PeiServices - General purpose services available to every PEIM.
+ @param[in] MtrrValues - buffer to store MTRR settings
+**/
+VOID
+ReadMtrrRegisters (
+ IN EFI_PEI_SERVICES **PeiServices,
+ UINT64 *MtrrValues
+ );
+
+/**
+ Syncup MTRR settings between all processors
+
+ @param[in] MtrrValues - buffer to store MTRR settings
+**/
+VOID
+MpMtrrSynchUp (
+ UINT64 *MtrrValues
+ );
+
+/**
+ Set MTRR registers
+
+ @param[in] PeiServices - General purpose services available to every PEIM.
+ @param[in] MtrrArray - buffer with MTRR settings
+**/
+VOID
+SetMtrrRegisters (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_MTRR_VALUES *MtrrArray
+ );
+
+#ifdef EFI_DEBUG
+/**
+ Print MTRR settings in debug build BIOS
+
+ @param[in] PeiServices - General purpose services available to every PEIM.
+ @param[in] MtrrArray - buffer with MTRR settings
+**/
+VOID
+ShowMtrrRegisters (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_MTRR_VALUES *MtrrArray
+ );
+#endif
+
+/**
+ This will locate a processor microcode and if it finds a newer revision, it will
+ load it to the processor.
+
+ @param[in] ExchangeInfo - Pointer to the exchange info buffer for output.
+ @param[in] MicrocodePointerBuffer - The Array of pointers which each points to 1 microcode update binary (in memory)
+ @param[in] FailedRevision - The microcode revision that fails to be loaded
+
+ @retval EFI_SUCCESS - A new microcode update is loaded
+ @retval Other - Due to some reason, no new microcode update is loaded
+**/
+EFI_STATUS
+InitializeMicrocode (
+ IN MP_CPU_EXCHANGE_INFO *ExchangeInfo,
+ IN EFI_CPU_MICROCODE_HEADER **MicrocodePointerBuffer,
+ OUT UINT32 *FailedRevision
+ );
+
+///
+/// Functions shared in MP/HT drivers
+///
+/**
+ Send interrupt to CPU
+
+ @param[in] BroadcastMode - interrupt broadcast mode
+ @param[in] ApicID - APIC ID for sending interrupt
+ @param[in] VectorNumber - Vector number
+ @param[in] DeliveryMode - Interrupt delivery mode
+ @param[in] TriggerMode - Interrupt trigger mode
+ @param[in] Assert - Interrupt pin polarity
+ @param[in] PeiServices - Indirect reference to the PEI Services Table
+ @param[in] PeiStall - EFI_PEI_STALL_PPI to stall for some interval
+
+ @retval EFI_INVALID_PARAMETER - input parameter not correct
+ @retval EFI_NOT_READY - there was a pending interrupt
+ @retval EFI_SUCCESS - interrupt sent successfully
+**/
+EFI_STATUS
+SendInterrupt (
+ IN UINT32 BroadcastMode,
+ IN UINT32 ApicID,
+ IN UINT32 VectorNumber,
+ IN UINT32 DeliveryMode,
+ IN UINT32 TriggerMode,
+ IN BOOLEAN Assert,
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_STALL_PPI *PeiStall
+ );
+
+/**
+ Get APIC ID of processor
+
+ @retval APIC ID of processor
+**/
+UINT32
+GetApicID (
+ VOID
+ );
+
+/**
+ Programs Local APIC registers for virtual wire mode.
+
+ @param[in] BSP - Is this BSP?
+**/
+VOID
+ProgramXApic (
+ BOOLEAN BSP
+ );
+
+/**
+ Lock APs
+
+ @param[in] Lock - Lock state
+**/
+VOID
+AsmAcquireMPLock (
+ IN UINT8 *Lock
+ );
+
+/**
+ Release APs
+
+ @param[in] Lock - Lock state
+**/
+VOID
+AsmReleaseMPLock (
+ IN UINT8 *Lock
+ );
+
+/**
+ Get address map of RendezvousFunnelProc.
+
+ @retval AddressMap - Output buffer for address map information
+**/
+VOID *
+AsmGetAddressMap (
+ VOID
+ );
+
+/**
+ Do CLI and HALT processor
+**/
+VOID
+AsmCliHltLoop (
+ VOID
+ );
+
+#endif
diff --git a/ReferenceCode/Haswell/CpuS3/Pei/MpEqu.inc b/ReferenceCode/Haswell/CpuS3/Pei/MpEqu.inc
new file mode 100644
index 0000000..da4b873
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuS3/Pei/MpEqu.inc
@@ -0,0 +1,51 @@
+;@file
+; This is the equates file for HT (Hyper-threading) support
+;
+;@copyright
+; Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+; This software and associated documentation (if any) is furnished
+; under a license and may only be used or copied in accordance
+; with the terms of the license. Except as permitted by such
+; license, no part of this software or documentation may be
+; reproduced, stored in a retrieval system, or transmitted in any
+; form or by any means without the express written consent of
+; Intel Corporation.
+;
+; This file contains a 'Sample Driver' and is licensed as such
+; under the terms of your license agreement with Intel or your
+; vendor. This file may be modified by the user, subject to
+; the additional terms of the license agreement
+;
+
+VacantFlag Equ 00h
+NotVacantFlag Equ 0ffh
+
+LockLocation equ 1000h - 0200h
+StackStartAddressLocation equ LockLocation + 04h
+StackSizeLocation equ LockLocation + 08h
+CProcedureLocation equ LockLocation + 0Ch
+GdtrLocation equ LockLocation + 10h
+IdtrLocation equ LockLocation + 16h
+BufferStartLocation equ LockLocation + 1Ch
+PmodeOffsetLocation equ LockLocation + 20h
+AcpiCpuDataAddressLocation equ LockLocation + 24h
+MtrrValuesAddressLocation equ LockLocation + 28h
+FinishedCountAddressLocation equ LockLocation + 2Ch
+WakeupCountAddressLocation equ LockLocation + 30h
+SerializeLockAddressLocation equ LockLocation + 34h
+MicrocodeAddressLocation equ LockLocation + 38h
+BootScriptAddressLocation equ LockLocation + 3Ch
+StartStateLocation equ LockLocation + 40h
+VirtualWireMode equ LockLocation + 44h
+SemaphoreCheck equ LockLocation + 48h
+PeiServices equ LockLocation + 4Ch
+PeiStall equ LockLocation + 50h
+CpuPerfCtrlValue equ LockLocation + 54h
+CpuPlatformPolicyPpi equ LockLocation + 5Ch
+
+PAUSE32 MACRO
+ DB 0F3h
+ DB 090h
+ ENDM
+
+;-------------------------------------------------------------------------------
diff --git a/ReferenceCode/Haswell/CpuS3/Pei/MpFuncs.asm b/ReferenceCode/Haswell/CpuS3/Pei/MpFuncs.asm
new file mode 100644
index 0000000..80064c2
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuS3/Pei/MpFuncs.asm
@@ -0,0 +1,196 @@
+;
+; This file contains a 'Sample Driver' and is licensed as such
+; under the terms of your license agreement with Intel or your
+; vendor. This file may be modified by the user, subject to
+; the additional terms of the license agreement
+;
+;-------------------------------------------------------------------------------
+;
+; Copyright (c) 1999 - 2011 Intel Corporation. All rights reserved
+; This software and associated documentation (if any) is furnished
+; under a license and may only be used or copied in accordance
+; with the terms of the license. Except as permitted by such
+; license, no part of this software or documentation may be
+; reproduced, stored in a retrieval system, or transmitted in any
+; form or by any means without the express written consent of
+; Intel Corporation.
+;
+;
+; Module Name:
+;
+; MpFuncs32.asm
+;
+; Abstract:
+;
+; This is the assembly code for MP support
+;
+;-------------------------------------------------------------------------------
+
+include MpEqu.inc
+
+;-------------------------------------------------------------------------------------
+;RendezvousFunnelProc procedure follows. All APs execute their procedure. This
+;procedure serializes all the AP processors through an Init sequence. It must be
+;noted that APs arrive here very raw...ie: real mode, no stack.
+;ALSO THIS PROCEDURE IS EXECUTED BY APs ONLY ON 16 BIT MODE. HENCE THIS PROC
+;IS IN MACHINE CODE.
+;-------------------------------------------------------------------------------------
+;RendezvousFunnelProc (&WakeUpBuffer,MemAddress);
+
+.686p
+.model flat
+.code
+
+
+RendezvousFunnelProc PROC PUBLIC
+RendezvousFunnelProcStart::
+
+;Step-1: Grab a lock. At this point CS = 0x(vv00) and ip= 0x0.
+
+ db 8ch,0c8h ; mov ax,cs
+ db 8eh,0d8h ; mov ds,ax
+ db 8eh,0c0h ; mov es,ax
+ db 8eh,0d0h ; mov ss,ax
+ db 33h,0c0h ; xor ax,ax
+ db 8eh,0e0h ; mov fs,ax
+ db 8eh,0e8h ; mov gs,ax
+
+ db 0BEh ; opcode of mov si, mem16
+ dw BufferStartLocation ; mov si, BufferStartLocation
+ db 66h, 8Bh, 1Ch ; mov ebx,dword ptr [si]
+
+ db 0BFh ; opcode of mov di, mem16
+ dw PmodeOffsetLocation ; mov di, PmodeOffsetLocation
+ db 66h, 8Bh, 05h ; mov eax,dword ptr [di]
+ db 8Bh, 0F8h ; mov di, ax
+ db 83h, 0EFh,06h ; sub di, 06h
+ db 66h, 03h, 0C3h ; add eax, ebx
+ db 66h, 89h, 05h ; mov dword ptr [di],eax
+
+ db 0BEh ; opcode of mov si, mem16
+ dw GdtrLocation ; mov si, GdtrLocation
+ db 66h ; db 66h
+ db 2Eh, 0Fh, 01h, 14h ; lgdt fword ptr cs:[si]
+
+ db 33h, 0C0h ; xor ax, ax
+ db 8Eh, 0D8h ; mov ds, ax
+
+ db 0Fh, 20h, 0C0h ; mov eax, cr0 ;Get control register 0
+ db 66h, 83h, 0C8h, 03h ; or eax, 000000003h ;Set PE bit (bit #0) & MP
+ db 0Fh, 22h, 0C0h ; mov cr0, eax
+
+ db 66h, 67h, 0EAh ; far jump
+ dd 0h ; 32-bit offset
+ dw 20h ; 16-bit selector
+
+NemInit:: ; protected mode entry point
+
+ db 66h, 0B8h, 18h, 00h ; mov ax, 18h
+ db 66h, 8Eh, 0D8h ; mov ds, ax
+ db 66h, 8Eh, 0C0h ; mov es, ax
+ db 66h, 8Eh, 0E0h ; mov fs, ax
+ db 66h, 8Eh, 0E8h ; mov gs, ax
+ db 66h, 8Eh, 0D0h ; mov ss, ax ; Flat mode setup.
+
+ mov esi, ebx
+
+ mov edi, esi
+ add edi, StartStateLocation
+ mov eax, 1
+ mov dword ptr [edi], eax
+
+ mov edi, esi
+ add edi, LockLocation
+ mov eax, NotVacantFlag
+TestLock::
+ xchg dword ptr [edi], eax
+ cmp eax, NotVacantFlag
+ jz TestLock
+
+ProgramStack::
+
+ mov edi, esi
+ add edi, StackSizeLocation
+ mov eax, dword ptr [edi]
+ mov edi, esi
+ add edi, StackStartAddressLocation
+ add eax, dword ptr [edi]
+ mov esp, eax
+ mov dword ptr [edi], eax
+
+Releaselock::
+
+ mov eax, VacantFlag
+ mov edi, esi
+ add edi, LockLocation
+ xchg dword ptr [edi], eax
+
+CProcedureInvoke::
+
+ mov edi, esi
+ add edi, MtrrValuesAddressLocation
+ mov eax, dword ptr [edi]
+ push eax
+
+ mov eax, esi
+ add eax, LockLocation
+ push eax
+
+ mov edi, esi
+ add edi, CProcedureLocation
+ mov eax, dword ptr [edi]
+
+ call eax
+ add esp, 8
+
+ cli
+ hlt
+ jmp $-2
+
+RendezvousFunnelProc ENDP
+
+SemaphoreStartAddress PROC C, SemaphoreAddress:PTR DWORD
+ mov eax, SemaphoreAddress
+@@:
+ cmp dword ptr [eax], 0
+ jz @F
+
+ PAUSE32
+ jmp @B
+
+@@:
+ ret
+SemaphoreStartAddress ENDP
+
+RendezvousFunnelProcEnd::
+
+
+;-------------------------------------------------------------------------------------
+; AsmGetAddressMap (&AddressMap);
+;-------------------------------------------------------------------------------------
+AsmGetAddressMap PROC near C PUBLIC
+
+ mov eax, RendezvousFunnelProcStart
+ ret
+
+AsmGetAddressMap ENDP
+
+AsmGetPmodeOffset PROC near C PUBLIC
+
+ mov eax, NemInit - RendezvousFunnelProcStart
+ ret
+
+AsmGetPmodeOffset ENDP
+
+AsmGetSemaphoreCheckOffset PROC near C PUBLIC
+ mov eax, SemaphoreStartAddress - RendezvousFunnelProcStart
+ ret
+AsmGetSemaphoreCheckOffset ENDP
+
+AsmCliHltLoop PROC near C PUBLIC
+ cli
+ hlt
+ jmp $-2
+AsmCliHltLoop ENDP
+
+END
diff --git a/ReferenceCode/Haswell/CpuS3/Pei/MtrrSync.c b/ReferenceCode/Haswell/CpuS3/Pei/MtrrSync.c
new file mode 100644
index 0000000..96e47ee
--- /dev/null
+++ b/ReferenceCode/Haswell/CpuS3/Pei/MtrrSync.c
@@ -0,0 +1,288 @@
+/** @file
+ Synchronization of MTRRs on S3 boot path.
+
+@copyright
+ Copyright (c) 2005 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+///
+/// External include files do NOT need to be explicitly specified in real EDKII
+/// environment
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#include "CpuAccess.h"
+#include "MpCommon.h"
+#endif
+
+UINTN
+MpMtrrSynchUpEntry (
+ VOID
+ );
+
+VOID
+MpMtrrSynchUpExit (
+ UINTN Cr4
+ );
+
+UINT16 mFixedMtrrIndex[] = {
+ IA32_MTRR_FIX64K_00000,
+ IA32_MTRR_FIX16K_80000,
+ IA32_MTRR_FIX16K_A0000,
+ IA32_MTRR_FIX4K_C0000,
+ IA32_MTRR_FIX4K_C8000,
+ IA32_MTRR_FIX4K_D0000,
+ IA32_MTRR_FIX4K_D8000,
+ IA32_MTRR_FIX4K_E0000,
+ IA32_MTRR_FIX4K_E8000,
+ IA32_MTRR_FIX4K_F0000,
+ IA32_MTRR_FIX4K_F8000,
+};
+
+UINT16 mMtrrDefType[] = { CACHE_IA32_MTRR_DEF_TYPE };
+
+UINT16 mVariableMtrrIndex[] = {
+ CACHE_VARIABLE_MTRR_BASE,
+ CACHE_VARIABLE_MTRR_BASE + 1,
+ CACHE_VARIABLE_MTRR_BASE + 2,
+ CACHE_VARIABLE_MTRR_BASE + 3,
+ CACHE_VARIABLE_MTRR_BASE + 4,
+ CACHE_VARIABLE_MTRR_BASE + 5,
+ CACHE_VARIABLE_MTRR_BASE + 6,
+ CACHE_VARIABLE_MTRR_BASE + 7,
+ CACHE_VARIABLE_MTRR_BASE + 8,
+ CACHE_VARIABLE_MTRR_BASE + 9,
+ CACHE_VARIABLE_MTRR_BASE + 10,
+ CACHE_VARIABLE_MTRR_BASE + 11,
+ CACHE_VARIABLE_MTRR_BASE + 12,
+ CACHE_VARIABLE_MTRR_BASE + 13,
+ CACHE_VARIABLE_MTRR_BASE + 14,
+ CACHE_VARIABLE_MTRR_BASE + 15,
+ CACHE_VARIABLE_MTRR_BASE + 16,
+ CACHE_VARIABLE_MTRR_BASE + 17,
+ CACHE_VARIABLE_MTRR_BASE + 18,
+ CACHE_VARIABLE_MTRR_BASE + 19,
+ ///
+ /// CACHE_VARIABLE_MTRR_END,
+ ///
+};
+
+UINTN FixedMtrrNumber = sizeof (mFixedMtrrIndex) / sizeof (UINT16);
+UINTN MtrrDefTypeNumber = sizeof (mMtrrDefType) / sizeof (UINT16);
+
+/**
+ Save the MTRR registers to global variables
+
+ @param[in] PeiServices - Indirect reference to the PEI Services Table
+ @param[in] MtrrValues - pointer to the buffer which stores MTRR settings
+**/
+VOID
+ReadMtrrRegisters (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN UINT64 *MtrrValues
+ )
+{
+ UINT32 Index;
+ UINT32 VariableMtrrNumber;
+ ///
+ /// Read all Mtrrs
+ ///
+ for (Index = 0; Index < FixedMtrrNumber; Index++) {
+ *MtrrValues = AsmReadMsr64 (mFixedMtrrIndex[Index]);
+ MtrrValues++;
+ }
+
+ for (Index = 0; Index < MtrrDefTypeNumber; Index++) {
+ *MtrrValues = AsmReadMsr64 (mMtrrDefType[Index]);
+ MtrrValues++;
+ }
+
+ VariableMtrrNumber = ((UINT32) (AsmReadMsr64 (IA32_MTRR_CAP) & B_IA32_MTRR_VARIABLE_SUPPORT));
+ if (VariableMtrrNumber > V_MAXIMUM_VARIABLE_MTRR_NUMBER) {
+ VariableMtrrNumber = V_MAXIMUM_VARIABLE_MTRR_NUMBER;
+ }
+
+ DEBUG ((EFI_D_INFO, "MTRR: VariableMtrrNumber = %x\n", VariableMtrrNumber));
+ for (Index = 0; Index < VariableMtrrNumber * 2; Index++) {
+ *MtrrValues = AsmReadMsr64 (mVariableMtrrIndex[Index]);
+ MtrrValues++;
+ DEBUG (
+ (EFI_D_INFO,
+ "MTRR: Index = %x AsmReadMsr64(%x) = %x\n",
+ Index,
+ mVariableMtrrIndex[Index],
+ AsmReadMsr64 (mVariableMtrrIndex[Index]))
+ );
+ }
+
+ return;
+}
+
+/**
+ Synch up the MTRR values for all processors
+
+ @param[in] MtrrValues - pointer to the buffer which stores MTRR settings
+**/
+VOID
+MpMtrrSynchUp (
+ UINT64 *MtrrValues
+ )
+{
+ UINT32 Index;
+ UINT32 VariableMtrrNumber;
+ UINTN Cr4;
+ UINT64 *FixedMtrr;
+ UINT64 *MtrrDefType;
+ UINT64 *VariableMtrr;
+ UINT64 ValidMtrrAddressMask;
+ EFI_CPUID_REGISTER FeatureInfo;
+ EFI_CPUID_REGISTER FunctionInfo;
+ UINT8 PhysicalAddressBits;
+
+ ///
+ /// Get physical CPU MTRR width in case of difference from BSP
+ ///
+ AsmCpuid (
+ CPUID_EXTENDED_FUNCTION,
+ &FunctionInfo.RegEax,
+ &FunctionInfo.RegEbx,
+ &FunctionInfo.RegEcx,
+ &FunctionInfo.RegEdx
+ );
+ PhysicalAddressBits = 36;
+ if (FunctionInfo.RegEax >= CPUID_VIR_PHY_ADDRESS_SIZE) {
+ AsmCpuid (
+ CPUID_VIR_PHY_ADDRESS_SIZE,
+ &FeatureInfo.RegEax,
+ &FeatureInfo.RegEbx,
+ &FeatureInfo.RegEcx,
+ &FeatureInfo.RegEdx
+ );
+ PhysicalAddressBits = (UINT8) FeatureInfo.RegEax;
+ }
+
+ ValidMtrrAddressMask = (LShiftU64 (1, PhysicalAddressBits) - 1) & 0xfffffffffffff000ULL;
+
+ FixedMtrr = MtrrValues;
+ MtrrDefType = MtrrValues + FixedMtrrNumber;
+ VariableMtrr = MtrrValues + FixedMtrrNumber + MtrrDefTypeNumber;
+
+ ///
+ /// ASM code to setup processor register before synching up the MTRRs
+ ///
+ Cr4 = MpMtrrSynchUpEntry ();
+
+ ///
+ /// Disable Fixed Mtrrs
+ ///
+ AsmWriteMsr64 (CACHE_IA32_MTRR_DEF_TYPE, MtrrDefType[0] & 0xFFFFF7FF);
+
+ ///
+ /// Update Fixed Mtrrs
+ ///
+ for (Index = 0; Index < FixedMtrrNumber; Index++) {
+ AsmWriteMsr64 (mFixedMtrrIndex[Index], FixedMtrr[Index]);
+ }
+ ///
+ /// Synchup Base Variable Mtrr
+ ///
+ VariableMtrrNumber = (UINT32) (AsmReadMsr64 (IA32_MTRR_CAP) & B_IA32_MTRR_VARIABLE_SUPPORT);
+ if (VariableMtrrNumber > V_MAXIMUM_VARIABLE_MTRR_NUMBER) {
+ VariableMtrrNumber = V_MAXIMUM_VARIABLE_MTRR_NUMBER;
+ }
+
+ for (Index = 0; Index < VariableMtrrNumber * 2; Index++) {
+ AsmWriteMsr64 (
+ mVariableMtrrIndex[Index],
+ (VariableMtrr[Index] & 0x0FFF) | (VariableMtrr[Index] & ValidMtrrAddressMask)
+ );
+ }
+ ///
+ /// Synchup def type Fixed Mtrrs
+ ///
+ AsmWriteMsr64 (CACHE_IA32_MTRR_DEF_TYPE, MtrrDefType[0]);
+
+ ///
+ /// ASM code to setup processor register after synching up the MTRRs
+ ///
+ MpMtrrSynchUpExit (Cr4);
+
+ return;
+}
+
+/**
+ Set MTRR registers
+
+ @param[in] PeiServices - General purpose services available to every PEIM.
+ @param[in] MtrrArray - buffer with MTRR settings
+**/
+VOID
+SetMtrrRegisters (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_MTRR_VALUES *MtrrArray
+ )
+{
+ UINT32 Index;
+ UINTN Cr4;
+
+ ///
+ /// ASM code to setup processor register before synching up the MTRRs
+ ///
+ Cr4 = MpMtrrSynchUpEntry ();
+
+ Index = 0;
+ while ((MtrrArray[Index].Index != 0) && (MtrrArray[Index].Index >= CACHE_VARIABLE_MTRR_BASE)) {
+ AsmWriteMsr64 (MtrrArray[Index].Index, MtrrArray[Index].Value);
+ Index++;
+ }
+ ///
+ /// ASM code to setup processor register after synching up the MTRRs
+ ///
+ MpMtrrSynchUpExit (Cr4);
+}
+
+#ifdef EFI_DEBUG
+/**
+ Print MTRR settings in debug build BIOS
+
+ @param[in] PeiServices - General purpose services available to every PEIM.
+ @param[in] MtrrArray - buffer with MTRR settings
+**/
+VOID
+ShowMtrrRegisters (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_MTRR_VALUES *MtrrArray
+ )
+{
+ UINT32 Index;
+
+ Index = 0;
+ while ((MtrrArray[Index].Index != 0) && (MtrrArray[Index].Index >= CACHE_VARIABLE_MTRR_BASE)) {
+
+ DEBUG ((EFI_D_INFO, "MTRR: MtrrArray Index = %x\n", Index));
+ DEBUG (
+ (EFI_D_INFO,
+ "MTRR: MtrrArray[%x].Index = %x MtrrArray[%x].Value = %x\n",
+ Index,
+ MtrrArray[Index].Index,
+ Index,
+ MtrrArray[Index].Value)
+ );
+ Index++;
+ }
+
+ DEBUG ((EFI_D_INFO, "MTRR: Total Index = %x\n", Index));
+}
+#endif
diff --git a/ReferenceCode/Haswell/DTS/Smm/DigitalThermalSensorInitStatus.h b/ReferenceCode/Haswell/DTS/Smm/DigitalThermalSensorInitStatus.h
new file mode 100644
index 0000000..24149b0
--- /dev/null
+++ b/ReferenceCode/Haswell/DTS/Smm/DigitalThermalSensorInitStatus.h
@@ -0,0 +1,46 @@
+/** @file
+ This protocol is used to get the status of Digital Thermal Sensor driver initialization
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _DTS_INIT_STATUS_PROTOCOL_H_
+#define _DTS_INIT_STATUS_PROTOCOL_H_
+
+///
+/// Define protocol GUID
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#define DTS_INIT_STATUS_PROTOCOL_GUID \
+ { \
+ 0xf687f441, 0x7dcf, 0x4f45, 0x8f, 0x64, 0xca, 0xf2, 0x88, 0xea, 0x50, 0x4e \
+ }
+#else
+#define DTS_INIT_STATUS_PROTOCOL_GUID \
+ { \
+ 0xf687f441, 0x7dcf, 0x4f45, \
+ { \
+ 0x8f, 0x64, 0xca, 0xf2, 0x88, 0xea, 0x50, 0x4e \
+ } \
+ }
+#endif
+
+typedef struct _DTS_INIT_STATUS_PROTOCOL {
+ BOOLEAN IsDtsInitComplete;
+} DTS_INIT_STATUS_PROTOCOL;
+
+#endif
diff --git a/ReferenceCode/Haswell/DTS/Smm/DigitalThermalSensorLib.h b/ReferenceCode/Haswell/DTS/Smm/DigitalThermalSensorLib.h
new file mode 100644
index 0000000..52fe54c
--- /dev/null
+++ b/ReferenceCode/Haswell/DTS/Smm/DigitalThermalSensorLib.h
@@ -0,0 +1,62 @@
+/** @file
+ Defines and prototypes for the DigitalThermalSensor SMM driver
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+#ifndef _DIGITAL_THERMAL_SENSOR_LIB_H_
+#define _DIGITAL_THERMAL_SENSOR_LIB_H_
+
+/**
+ Prepare data and protocol for Dts Hooe Lib
+
+ @retval EFI_SUCCESS - Initialize complete
+**/
+EFI_STATUS
+InitializeDtsHookLib (
+ VOID
+ );
+
+/**
+ Platform may need to register some data to private data structure before generate
+ software SMI or SCI.
+**/
+VOID
+PlatformHookBeforeGenerateSCI (
+ VOID
+ );
+
+/**
+ Read CPU temperature from platform diode
+
+ @retval TemperatureOfDiode - Return the CPU temperature of platform diode
+**/
+UINT8
+ReadPlatformThermalDiode (
+ VOID
+ );
+
+/**
+ When system temperature out of specification, do platform specific programming to prevent
+ system damage.
+**/
+VOID
+PlatformEventOutOfSpec (
+ VOID
+ );
+
+#endif
diff --git a/ReferenceCode/Haswell/DTS/Smm/DigitalThermalSensorSmm.c b/ReferenceCode/Haswell/DTS/Smm/DigitalThermalSensorSmm.c
new file mode 100644
index 0000000..38dad6c
--- /dev/null
+++ b/ReferenceCode/Haswell/DTS/Smm/DigitalThermalSensorSmm.c
@@ -0,0 +1,1536 @@
+/** @file
+ Digital Thermal Sensor (DTS) driver.
+ This SMM driver configures and supports the Digital Thermal Sensor features for the platform.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "DigitalThermalSensorSmm.h"
+#include "KscLib.h"
+//
+// Protocol GUID definition
+//
+DXE_CPU_PLATFORM_POLICY_PROTOCOL *mPlatformCpu = NULL;
+
+EFI_GUID gDtsInitStatusProtocolGuid = DTS_INIT_STATUS_PROTOCOL_GUID;
+EFI_GUID mEfiGlobalNvsAreaProtocolGuid = EFI_GLOBAL_NVS_AREA_PROTOCOL_GUID;
+EFI_GUID mEfiSmmIoTrapDispatchProtocolGuid = EFI_SMM_IO_TRAP_DISPATCH_PROTOCOL_GUID;
+DTS_INIT_STATUS_PROTOCOL mDtsInitStatusProtocol;
+
+//
+// Global variables
+//
+EFI_SMM_BASE_PROTOCOL *mSmmBase;
+EFI_SMM_SYSTEM_TABLE *mSmst;
+
+EFI_GLOBAL_NVS_AREA *mGlobalNvsAreaPtr;
+UINT8 DTSSetupValue;
+
+BOOLEAN mDtsEnabled;
+UINT8 mDtsTjMax;
+UINT16 mAcpiBaseAddr;
+BOOLEAN mUpdateDtsInEverySmi;
+UINT8 mNoOfThresholdRanges;
+UINT8 (*mDtsThresholdTable)[3];
+UINT8 gIsPackageTempMsrAvailable;
+///
+/// The table is updated for the current CPU.
+///
+UINT8 mDigitalThermalSensorThresholdTable[DTS_NUMBER_THRESHOLD_RANGES][3] = {
+ ///
+ /// TJ_MAX = 110 ///< Current Temp. Low Temp. High Temp.
+ ///
+ {TJ_MAX-80,100,75}, ///< <= 30 10 35
+ {TJ_MAX-70,85,65}, ///< 30 ~ 39 25 45
+ {TJ_MAX-60,75,55}, ///< 40 ~ 49 35 55
+ {TJ_MAX-50,65,45}, ///< 50 ~ 59 45 65
+ {TJ_MAX-40,55,35}, ///< 60 ~ 69 55 75
+ {TJ_MAX-30,45,25}, ///< 70 ~ 79 65 85
+ {TJ_MAX-20,35,15}, ///< 80 ~ 89 75 95
+ {TJ_MAX-10,25,05}, ///< 90 ~ 99 85 105
+ {TJ_MAX-00,15,00} ///< 100 ~ 109 95 110
+};
+
+//
+// Function implementations
+//
+/**
+ Read the temperature data per core/thread.
+ This function must be AP safe.
+
+ @param[in] Buffer Pointer to UINT8 to update with the current temperature
+
+ @retval EFI_SUCCESS Digital Thermal Sensor temperature has updated successfully.
+**/
+VOID
+EFIAPI
+DigitalThermalSensorUpdateTemperature (
+ VOID *Buffer
+ )
+{
+ MSR_REGISTER MsrData;
+ UINT8 Temperature;
+ UINT8 DefApicId;
+ EFI_CPUID_REGISTER CpuidRegisters;
+ UINT8 *TempPointer;
+
+ AsmCpuid (
+ EFI_CPUID_VERSION_INFO,
+ &CpuidRegisters.RegEax,
+ &CpuidRegisters.RegEbx,
+ &CpuidRegisters.RegEcx,
+ &CpuidRegisters.RegEdx
+ );
+ ///
+ /// Default APIC ID = CPUID Function 01, EBX[31:24]
+ ///
+ DefApicId = (UINT8) RShiftU64 (CpuidRegisters.RegEbx, 24);
+
+ ///
+ /// Read the temperature
+ ///
+ MsrData.Qword = AsmReadMsr64 (EFI_MSR_IA32_THERM_STATUS);
+
+ ///
+ /// Find the DTS temperature.
+ ///
+ Temperature = mDtsTjMax - (MsrData.Bytes.ThirdByte & OFFSET_MASK);
+ ///
+ /// We only update the temperature if it is above the current temperature.
+ ///
+ TempPointer = Buffer;
+ if (Temperature > *((UINT8 *) (TempPointer + DefApicId))) {
+ *((UINT8 *) (TempPointer + DefApicId)) = Temperature;
+ }
+
+ return;
+}
+
+/**
+ Read the temperature and update the data for PTID support.
+
+ @retval EFI_SUCCESS Digital Thermal Sensor temperature has updated successfully.
+**/
+EFI_STATUS
+DigitalThermalSensorUpdatePTID (
+ VOID
+ )
+{
+ ///
+ /// ThreadTemperatureBuffer[0], [2], [4] and [6] are Thread0 and [1], [3], [5] and [7] are Thread1 for each Core.
+ /// If thread or core not active, this thread/core temperature will be reported as 0
+ ///
+ UINT8 ThreadTemperatureBuffer[MAX_NUMBER_OF_THREADS_SUPPORTED];
+ UINT8 Index;
+ UINT8 CoreTemp[MAX_NUMBER_OF_THREADS_SUPPORTED / 2];
+
+ ///
+ /// Get DTS temperature for all cores/threads.
+ ///
+ for (Index = 0; Index < MAX_NUMBER_OF_THREADS_SUPPORTED; Index++) {
+ ThreadTemperatureBuffer[Index] = 0;
+ }
+
+ RunOnAllLogicalProcessors (DigitalThermalSensorUpdateTemperature, ThreadTemperatureBuffer);
+ ///
+ /// Compare thread1 and thread2 temperature in each core and only report higher temperature as core temperature.
+ ///
+ for (Index = 0; Index < MAX_NUMBER_OF_THREADS_SUPPORTED; Index += 2) {
+ CoreTemp[(UINT8) DivU64x32 (Index, 2)] =
+ (ThreadTemperatureBuffer[Index] > ThreadTemperatureBuffer[Index + 1])
+ ? ThreadTemperatureBuffer[Index] : ThreadTemperatureBuffer[Index + 1];
+ }
+
+ mGlobalNvsAreaPtr->BspDigitalThermalSensorTemperature = CoreTemp[0];
+ if ((MAX_NUMBER_OF_THREADS_SUPPORTED / 2) > 1) {
+ mGlobalNvsAreaPtr->ApDigitalThermalSensorTemperature = CoreTemp[1];
+ }
+
+ if ((MAX_NUMBER_OF_THREADS_SUPPORTED / 2) > 2) {
+ mGlobalNvsAreaPtr->Ap2DigitalThermalSensorTemperature = CoreTemp[2];
+ }
+
+ if ((MAX_NUMBER_OF_THREADS_SUPPORTED / 2) > 3) {
+ mGlobalNvsAreaPtr->Ap3DigitalThermalSensorTemperature = CoreTemp[3];
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ SMI handler to handle Digital Thermal Sensor CPU Local APIC SMI
+ for thermal Out Of Spec interrupt
+
+ @param[in] SmmImageHandle Image handle returned by the SMM driver.
+ @param[in] CommunicationBuffer Pointer to the buffer that contains the communication Message
+ @param[in] SourceSize Size of the memory image to be used for handler.
+
+ @retval EFI_SUCCESS Callback Function Executed
+**/
+EFI_STATUS
+EFIAPI
+DtsOutOfSpecSmiCallback (
+ IN EFI_HANDLE SmmImageHandle,
+ IN OUT VOID *CommunicationBuffer,
+ IN OUT UINTN *SourceSize
+ )
+{
+
+ DTS_EVENT_TYPE EventType;
+
+ ///
+ /// If not enabled; return. (The DTS will be disabled upon S3 entry
+ /// and will remain disabled until after re-initialized upon wake.)
+ ///
+ if (!mDtsEnabled) {
+ return EFI_SUCCESS;
+ }
+
+ EventType = DtsEventNone;
+
+ if (gIsPackageTempMsrAvailable) {
+ ///
+ /// Get the Package DTS Event Type
+ ///
+ DigitalThermalSensorEventCheckPackageMsr (&EventType);
+ } else {
+ ///
+ /// Get the DTS Event Type
+ ///
+ DigitalThermalSensorEventCheck (&EventType);
+ }
+ ///
+ /// Check if this a DTS Out Of Spec SMI event
+ ///
+ if (EventType == DtsEventOutOfSpec) {
+ ///
+ /// Return Critical temperature value to _TMP and generate GPE event for critical shutdown.
+ ///
+ mGlobalNvsAreaPtr->EnableDigitalThermalSensor = DTS_OUT_OF_SPEC_OCCURRED;
+
+ ///
+ /// Generate SCI to shut down the system
+ ///
+ DigitalThermalSensorSetSwGpeSts ();
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Call from SMI handler to handle Package thermal temperature Digital Thermal Sensor CPU Local APIC SMI
+ for thermal threshold interrupt
+
+ @retval None
+**/
+VOID
+PackageThermalDTS (
+ VOID
+ )
+{
+ DTS_EVENT_TYPE PkgEventType;
+
+ PkgEventType = DtsEventNone;
+
+ ///
+ /// Check is this a Platform SMI event or the flag of update DTS temperature and threshold value in every SMI
+ ///
+ if (DigitalThermalSensorEventCheckPackageMsr (&PkgEventType) || mUpdateDtsInEverySmi) {
+ ///
+ /// Disable Local APIC SMI before programming the threshold
+ ///
+ RunOnAllLogicalProcessors (DigitalThermalSensorDisableSmi, NULL);
+
+ do {
+ ///
+ /// Handle Package events
+ ///
+ if ((PkgEventType == DtsEventOutOfSpec) && (mGlobalNvsAreaPtr->OperatingSystem == 0)) {
+ ///
+ /// Handle critical event by shutting down via EC if ACPI
+ /// is not enabled.
+ ///
+ PlatformEventOutOfSpec ();
+ }
+ ///
+ /// Set the thermal trip toints as needed.
+ ///
+ mGlobalNvsAreaPtr->PackageDTSTemperature = 0;
+
+ ///
+ /// Set the Package thermal sensor thresholds
+ ///
+ PackageDigitalThermalSensorSetThreshold (&mGlobalNvsAreaPtr->PackageDTSTemperature);
+
+ ///
+ /// Set SWGPE Status to generate an SCI if we had any events
+ ///
+ if ((PkgEventType != DtsEventNone) || mUpdateDtsInEverySmi) {
+ DigitalThermalSensorSetSwGpeSts ();
+ }
+
+ } while (DigitalThermalSensorEventCheckPackageMsr (&PkgEventType));
+ ///
+ /// Enable Local APIC SMI on all logical processors
+ ///
+ RunOnAllLogicalProcessors (DigitalThermalSensorEnableSmi, NULL);
+ }
+}
+
+/**
+ SMI handler to handle Digital Thermal Sensor CPU Local APIC SMI
+ for thermal threshold interrupt
+
+ @param[in] SmmImageHandle Image handle returned by the SMM driver.
+ @param[in] CommunicationBuffer Pointer to the buffer that contains the communication Message
+ @param[in] SourceSize Size of the memory image to be used for handler.
+
+ @retval EFI_SUCCESS Callback Function Executed
+**/
+EFI_STATUS
+EFIAPI
+DtsSmiCallback (
+ IN EFI_HANDLE SmmImageHandle,
+ IN OUT VOID *CommunicationBuffer,
+ IN OUT UINTN *SourceSize
+ )
+{
+ UINTN Index;
+ DTS_EVENT_TYPE EventType;
+ ///
+ /// If not enabled; return. (The DTS will be disabled upon S3 entry
+ /// and will remain disabled until after re-initialized upon wake.)
+ ///
+ if (!mDtsEnabled) {
+ return EFI_SUCCESS;
+ }
+ ///
+ /// Get the Package thermal temperature
+ ///
+ if (gIsPackageTempMsrAvailable) {
+ RunOnAllLogicalProcessors (DigitalThermalSensorEnableSmi, NULL);
+ PackageThermalDTS ();
+ } else {
+ ///
+ /// We enable the Thermal interrupt on the AP's prior to the event check
+ /// for the case where the AP has gone through the INIT-SIPI-SIPI sequence
+ /// and does not have the interrupt enabled. (This allows the AP thermal
+ /// interrupt to be re-enabled due to chipset-based SMIs without waiting
+ /// to receive a DTS event on the BSP.)
+ ///
+ for (Index = 1; Index < mSmst->NumberOfCpus; Index++) {
+ RunOnSpecificLogicalProcessor (DigitalThermalSensorEnableSmi, Index, NULL);
+ }
+ ///
+ /// Check is this a DTS SMI event or the flag of update DTS temperature and threshold value in every SMI
+ ///
+ if (DigitalThermalSensorEventCheck (&EventType) || mUpdateDtsInEverySmi) {
+ ///
+ /// Disable Local APIC SMI before programming the threshold
+ ///
+ RunOnAllLogicalProcessors (DigitalThermalSensorDisableSmi, NULL);
+
+ do {
+ ///
+ /// Handle BSP events
+ ///
+ if ((EventType == DtsEventOutOfSpec) && (mGlobalNvsAreaPtr->OperatingSystem == 0)) {
+ ///
+ /// Handle critical event by shutting down via EC if ACPI
+ /// is not enabled.
+ ///
+ PlatformEventOutOfSpec ();
+ }
+ ///
+ /// Update temperatures for PTID
+ ///
+ DigitalThermalSensorUpdatePTID ();
+
+ ///
+ /// Set the thermal trip toints as needed.
+ /// Note: We only save the highest temperature of each die in
+ /// the NVS area when more than two logical processors are
+ /// present as only the highest DTS reading is actually used by
+ /// the current ASL solution.
+ ///
+ mGlobalNvsAreaPtr->BspDigitalThermalSensorTemperature = 0;
+ mGlobalNvsAreaPtr->ApDigitalThermalSensorTemperature = 0;
+
+ ///
+ /// Set the BSP thermal sensor thresholds
+ ///
+ DigitalThermalSensorSetThreshold (&mGlobalNvsAreaPtr->BspDigitalThermalSensorTemperature);
+
+ ///
+ /// Set the AP thermal sensor thresholds and update temperatures
+ ///
+ for (Index = 1; Index < mSmst->NumberOfCpus / 2; Index++) {
+ RunOnSpecificLogicalProcessor (
+ DigitalThermalSensorSetThreshold,
+ Index,
+ &mGlobalNvsAreaPtr->BspDigitalThermalSensorTemperature
+ );
+ }
+
+ for (Index = mSmst->NumberOfCpus / 2; Index < mSmst->NumberOfCpus; Index++) {
+ RunOnSpecificLogicalProcessor (
+ DigitalThermalSensorSetThreshold,
+ Index,
+ &mGlobalNvsAreaPtr->ApDigitalThermalSensorTemperature
+ );
+ }
+ ///
+ /// Set SWGPE Status to generate an SCI if we had any events
+ ///
+ if ((EventType != DtsEventNone) || mUpdateDtsInEverySmi) {
+ DigitalThermalSensorSetSwGpeSts ();
+ }
+
+ } while (DigitalThermalSensorEventCheck (&EventType));
+ ///
+ /// Enable Local APIC SMI on all logical processors
+ ///
+ RunOnAllLogicalProcessors (DigitalThermalSensorEnableSmi, NULL);
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This catches IO trap SMI generated by the ASL code to enable the DTS AP function
+
+ @param[in] DispatchHandle Not used
+ @param[in] CallbackContext Not used
+**/
+VOID
+EFIAPI
+DtsIoTrapCallback (
+ IN EFI_HANDLE DispatchHandle,
+ IN EFI_SMM_IO_TRAP_DISPATCH_CALLBACK_CONTEXT *CallbackContext
+ )
+{
+ UINTN Index;
+ EFI_STATUS Status;
+ UINT8 RetryIteration;
+
+ ///
+ /// Determine the function desired, passed in the global NVS area
+ ///
+ switch (mGlobalNvsAreaPtr->DigitalThermalSensorSmiFunction) {
+ ///
+ /// Enable AP Digital Thermal Sensor function after resume from S3
+ ///
+ case IO_TRAP_INIT_DTS_FUNCTION_AFTER_S3:
+ ///
+ /// Enable the Package DTS on the processors.
+ ///
+ if (gIsPackageTempMsrAvailable) {
+ PackageDigitalThermalSensorEnable (NULL);
+ } else {
+ ///
+ /// Enable the DTS on all logical processors.
+ ///
+ RunOnAllLogicalProcessors (DigitalThermalSensorEnable, NULL);
+ }
+
+ if (DTSSetupValue != DTS_OUT_OF_SPEC_ONLY) {
+ ///
+ /// Set the thermal trip toints on all logical processors.
+ /// Note: We only save the highest temperature of each die in the NVS area when
+ /// more than two logical processors are present as only the highest DTS reading
+ /// is actually used by the current ASL solution.
+ ///
+ mGlobalNvsAreaPtr->BspDigitalThermalSensorTemperature = 0;
+ mGlobalNvsAreaPtr->ApDigitalThermalSensorTemperature = 0;
+ mGlobalNvsAreaPtr->PackageDTSTemperature = 0;
+
+ if (gIsPackageTempMsrAvailable) {
+ PackageDigitalThermalSensorSetThreshold (&mGlobalNvsAreaPtr->PackageDTSTemperature);
+ } else {
+ ///
+ /// Update temperatures for PTID
+ ///
+ DigitalThermalSensorUpdatePTID ();
+ mGlobalNvsAreaPtr->BspDigitalThermalSensorTemperature = 0;
+ mGlobalNvsAreaPtr->ApDigitalThermalSensorTemperature = 0;
+ DigitalThermalSensorSetThreshold (&mGlobalNvsAreaPtr->BspDigitalThermalSensorTemperature);
+
+ for (Index = 1; Index < mSmst->NumberOfCpus / 2; Index++) {
+ Status = EFI_NOT_READY;
+ for (RetryIteration = 0;
+ (RetryIteration < DTS_AP_SAFE_RETRY_LIMIT) && (Status != EFI_SUCCESS);
+ RetryIteration++
+ ) {
+ Status = mSmst->SmmStartupThisAp (
+ DigitalThermalSensorSetThreshold,
+ Index,
+ &mGlobalNvsAreaPtr->BspDigitalThermalSensorTemperature
+ );
+ if (Status != EFI_SUCCESS) {
+ ///
+ /// SmmStartupThisAp might return failure if AP is busy executing some other code. Let's wait for sometime and try again.
+ ///
+ PchPmTimerStall (DTS_WAIT_PERIOD);
+ }
+ }
+ }
+
+ for (Index = mSmst->NumberOfCpus / 2; Index < mSmst->NumberOfCpus; Index++) {
+ RunOnSpecificLogicalProcessor (
+ DigitalThermalSensorSetThreshold,
+ Index,
+ &mGlobalNvsAreaPtr->ApDigitalThermalSensorTemperature
+ );
+ }
+ }
+ ///
+ /// Re-enable the DTS.
+ ///
+ mGlobalNvsAreaPtr->EnableDigitalThermalSensor = CPU_FEATURE_ENABLE;
+ } else {
+ ///
+ /// Enable Out Of Spec Interrupt
+ ///
+ if (gIsPackageTempMsrAvailable) {
+ PackageDigitalThermalSensorSetOutOfSpecInterrupt (NULL);
+ } else {
+ RunOnAllLogicalProcessors (DigitalThermalSensorSetOutOfSpecInterrupt, NULL);
+ }
+ ///
+ /// Re-enable the DTS which only handle Out-Of-Spec condition
+ ///
+ mGlobalNvsAreaPtr->EnableDigitalThermalSensor = DTS_OUT_OF_SPEC_ONLY;
+ }
+ ///
+ /// Enable the Local APIC SMI on all logical processors
+ ///
+ RunOnAllLogicalProcessors (DigitalThermalSensorEnableSmi, NULL);
+ ///
+ /// Set SWGPE Status
+ ///
+ DigitalThermalSensorSetSwGpeSts ();
+
+ mUpdateDtsInEverySmi = UPDATE_DTS_EVERY_SMI;
+ mDtsEnabled = TRUE;
+ break;
+
+ ///
+ /// Disable update DTS temperature and threshold value in every SMI
+ ///
+ case IO_TRAP_DISABLE_UPDATE_DTS:
+ mUpdateDtsInEverySmi = FALSE;
+ break;
+
+ default:
+ break;
+ }
+ ///
+ /// Store return value
+ ///
+ mGlobalNvsAreaPtr->DigitalThermalSensorSmiFunction = 0;
+}
+
+/**
+ This function executes DTS procedures for preparing to enter S3.
+
+ @param[in] Handle Handle of the callback
+ @param[in] Context The dispatch context
+
+ @retval EFI_SUCCESS DTS disabled
+**/
+VOID
+EFIAPI
+DtsS3EntryCallBack (
+ IN EFI_HANDLE Handle,
+ IN EFI_SMM_SX_DISPATCH_CONTEXT *Context
+ )
+{
+ ///
+ /// Clear the Digital Thermal Sensor flag in ACPI NVS.
+ ///
+ mGlobalNvsAreaPtr->EnableDigitalThermalSensor = CPU_FEATURE_DISABLE;
+ ///
+ /// Clear the enable flag.
+ ///
+ mDtsEnabled = FALSE;
+
+ return;
+}
+
+/**
+ Performs initialization of the threshold table.
+
+ @todo Update this function as necessary for the tables used by the implementation.
+
+ @retval EFI_SUCCESS Threshold tables initialized successfully.
+**/
+EFI_STATUS
+ThresholdTableInit (
+ VOID
+ )
+{
+ UINTN i;
+ UINT8 Delta;
+
+ ///
+ /// If the table must be updated, shift the thresholds by the difference between
+ /// TJ_MAX=110 and DtsTjMax.
+ ///
+ if (mDtsTjMax != TJ_MAX) {
+ Delta = TJ_MAX - mDtsTjMax;
+
+ for (i = 0; i < mNoOfThresholdRanges; i++) {
+ if (mDtsThresholdTable[i][1] <= mDtsTjMax) {
+ mDtsThresholdTable[i][0] = mDtsThresholdTable[i][0] - Delta;
+ } else {
+ mDtsThresholdTable[i][0] = 0;
+ }
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Perform first time initialization of the Digital Thermal Sensor
+
+ @retval EFI_SUCCESS Init Digital Thermal Sensor successfully
+**/
+EFI_STATUS
+DigitalThermalSensorInit (
+ VOID
+ )
+{
+ UINTN Index;
+
+ if (DTSSetupValue != DTS_OUT_OF_SPEC_ONLY) {
+ ///
+ /// Initialize the DTS threshold table.
+ ///
+ ThresholdTableInit ();
+
+ ///
+ /// Set the thermal trip points on all logical processors.
+ /// Note: We only save the highest temperature of each die in the NVS area when
+ /// more than two logical processors are present as only the highest DTS reading
+ /// is actually used by the current ASL solution.
+ ///
+ mGlobalNvsAreaPtr->BspDigitalThermalSensorTemperature = 0;
+ mGlobalNvsAreaPtr->ApDigitalThermalSensorTemperature = 0;
+ mGlobalNvsAreaPtr->PackageDTSTemperature = 0;
+ if (gIsPackageTempMsrAvailable) {
+ PackageDigitalThermalSensorSetThreshold (&mGlobalNvsAreaPtr->PackageDTSTemperature);
+ } else {
+ ///
+ /// Update temperatures for PTID
+ ///
+ DigitalThermalSensorUpdatePTID ();
+ mGlobalNvsAreaPtr->BspDigitalThermalSensorTemperature = 0;
+ mGlobalNvsAreaPtr->ApDigitalThermalSensorTemperature = 0;
+ DigitalThermalSensorSetThreshold (&mGlobalNvsAreaPtr->BspDigitalThermalSensorTemperature);
+
+ for (Index = 1; Index < mSmst->NumberOfCpus / 2; Index++) {
+ RunOnSpecificLogicalProcessor (
+ DigitalThermalSensorSetThreshold,
+ Index,
+ &mGlobalNvsAreaPtr->BspDigitalThermalSensorTemperature
+ );
+ }
+
+ for (Index = mSmst->NumberOfCpus / 2; Index < mSmst->NumberOfCpus; Index++) {
+ RunOnSpecificLogicalProcessor (
+ DigitalThermalSensorSetThreshold,
+ Index,
+ &mGlobalNvsAreaPtr->ApDigitalThermalSensorTemperature
+ );
+ }
+ }
+
+ mGlobalNvsAreaPtr->EnableDigitalThermalSensor = CPU_FEATURE_ENABLE;
+ } else {
+ ///
+ /// Enable Out Of Spec Interrupt
+ ///
+ if (gIsPackageTempMsrAvailable) {
+ PackageDigitalThermalSensorSetOutOfSpecInterrupt (NULL);
+ } else {
+ RunOnAllLogicalProcessors (DigitalThermalSensorSetOutOfSpecInterrupt, NULL);
+ }
+
+ mGlobalNvsAreaPtr->EnableDigitalThermalSensor = DTS_OUT_OF_SPEC_ONLY;
+ }
+ ///
+ /// Enable the Local APIC SMI on all logical processors
+ ///
+ RunOnAllLogicalProcessors (DigitalThermalSensorEnableSmi, NULL);
+ ///
+ /// Set Digital Thermal Sensor flag in ACPI NVS
+ ///
+ mUpdateDtsInEverySmi = UPDATE_DTS_EVERY_SMI;
+ mDtsEnabled = TRUE;
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Initializes the Thermal Sensor Control MSR
+
+ This function must be AP safe.
+
+ @param[in] Buffer Unused.
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+VOID
+EFIAPI
+DigitalThermalSensorEnable (
+ VOID *Buffer
+ )
+{
+ MSR_REGISTER MsrData;
+
+ ///
+ /// First, clear our log bits
+ ///
+ MsrData.Qword = AsmReadMsr64 (EFI_MSR_IA32_THERM_STATUS);
+ if (DTSSetupValue != DTS_OUT_OF_SPEC_ONLY) {
+ MsrData.Qword &= ~THERM_STATUS_LOG_MASK;
+ } else {
+ MsrData.Qword &= ~B_OUT_OF_SPEC_STATUS_LOG;
+ }
+
+ AsmWriteMsr64 (EFI_MSR_IA32_THERM_STATUS, MsrData.Qword);
+
+ ///
+ /// Second, configure the thermal sensor control
+ ///
+ MsrData.Qword = AsmReadMsr64 (EFI_MSR_MISC_PWR_MGMT);
+
+ ///
+ /// Only lock interrupts if in CMP mode
+ ///
+ if (mSmst->NumberOfCpus > 1) {
+ MsrData.Qword |= B_LOCK_THERMAL_INT;
+ }
+
+ AsmWriteMsr64 (EFI_MSR_MISC_PWR_MGMT, MsrData.Qword);
+
+ return;
+}
+
+/**
+ Initializes the Package Thermal Sensor Control MSR
+
+ @param[in] Buffer Unused.
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+PackageDigitalThermalSensorEnable (
+ VOID *Buffer
+ )
+{
+ MSR_REGISTER MsrData;
+
+ ///
+ /// First, clear our log bits
+ ///
+ MsrData.Qword = AsmReadMsr64 (EFI_MSR_IA32_PACKAGE_THERM_STATUS);
+ if (DTSSetupValue != DTS_OUT_OF_SPEC_ONLY) {
+ MsrData.Qword &= ~THERM_STATUS_LOG_MASK;
+ } else {
+ MsrData.Qword &= ~B_OUT_OF_SPEC_STATUS_LOG;
+ }
+
+ AsmWriteMsr64 (EFI_MSR_IA32_PACKAGE_THERM_STATUS, MsrData.Qword);
+
+ ///
+ /// Second, configure the thermal sensor control
+ ///
+ MsrData.Qword = AsmReadMsr64 (EFI_MSR_MISC_PWR_MGMT);
+
+ ///
+ /// Only lock interrupts if in CMP mode
+ ///
+ if (mSmst->NumberOfCpus > 1) {
+ MsrData.Qword |= B_LOCK_THERMAL_INT;
+ }
+
+ AsmWriteMsr64 (EFI_MSR_MISC_PWR_MGMT, MsrData.Qword);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Generates a _GPE._L02 SCI to an ACPI OS.
+**/
+VOID
+DigitalThermalSensorSetSwGpeSts (
+ VOID
+ )
+{
+ UINT8 GpeCntl;
+
+ ///
+ /// Check SCI enable
+ ///
+ if (((SmmIoRead8 (mAcpiBaseAddr + R_PCH_ACPI_PM1_CNT)) & B_PCH_ACPI_PM1_CNT_SCI_EN) != 0) {
+ ///
+ /// Do platform specific things before generate SCI
+ ///
+ PlatformHookBeforeGenerateSCI ();
+
+ ///
+ /// Set SWGPE Status
+ ///
+ GpeCntl = SmmIoRead8 (mAcpiBaseAddr + R_ACPI_GPE_CNTL);
+ GpeCntl |= B_SWGPE_CTRL;
+ SmmIoWrite8 (mAcpiBaseAddr + R_ACPI_GPE_CNTL, GpeCntl);
+ }
+}
+
+/**
+ Checks for a Core Thermal Event on any processor
+
+ @param[in] EventType - DTS_EVENT_TYPE to indicate which DTS event type has been detected.
+
+ @retval TRUE means this is a DTS Thermal event
+ @retval FALSE means this is not a DTS Thermal event.
+**/
+BOOLEAN
+DigitalThermalSensorEventCheck (
+ DTS_EVENT_TYPE *EventType
+ )
+{
+ ///
+ /// Clear event status
+ ///
+ *EventType = DtsEventNone;
+
+ RunOnAllLogicalProcessors (DigitalThermalSensorEventCheckMsr, EventType);
+ ///
+ /// Return TRUE if any logical processor reported an event.
+ ///
+ if (*EventType != DtsEventNone) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/**
+ Checks for a Package Thermal Event by reading MSR.
+
+ @param[in] PkgEventType - DTS_EVENT_TYPE to indicate which DTS event type has been detected.
+
+ @retval TRUE means this is a Package DTS Thermal event
+ @retval FALSE means this is not a Package DTS Thermal event.
+**/
+BOOLEAN
+DigitalThermalSensorEventCheckPackageMsr (
+ DTS_EVENT_TYPE *PkgEventType
+ )
+{
+ MSR_REGISTER MsrData;
+
+ ///
+ /// Clear event status
+ ///
+ *PkgEventType = DtsEventNone;
+
+ ///
+ /// If Processor has already been flagged as Out-Of-Spec,
+ /// just return.
+ ///
+ if (*PkgEventType != DtsEventOutOfSpec) {
+ ///
+ /// Read thermal status
+ ///
+ MsrData.Qword = AsmReadMsr64 (EFI_MSR_IA32_PACKAGE_THERM_STATUS);
+
+ ///
+ /// Check for Out-Of-Spec status.
+ ///
+ if (MsrData.Qword & B_OUT_OF_SPEC_STATUS_LOG) {
+ *PkgEventType = DtsEventOutOfSpec;
+
+ ///
+ /// Check thresholds.
+ ///
+ } else if ((DTSSetupValue != DTS_OUT_OF_SPEC_ONLY) &&
+ (MsrData.Qword & (B_THERMAL_THRESHOLD_1_STATUS_LOG | B_THERMAL_THRESHOLD_2_STATUS_LOG))
+ ) {
+ *PkgEventType = DtsEventThreshold;
+ }
+ }
+ ///
+ /// Return TRUE if processor reported an event.
+ ///
+ if (*PkgEventType != DtsEventNone) {
+ return TRUE;
+ }
+
+ return FALSE;
+
+}
+
+/**
+ Checks for a Core Thermal Event by reading MSR.
+
+ This function must be MP safe.
+
+ @param[in] Buffer Pointer to DTS_EVENT_TYPE
+**/
+VOID
+EFIAPI
+DigitalThermalSensorEventCheckMsr (
+ IN VOID *Buffer
+ )
+{
+ MSR_REGISTER MsrData;
+ DTS_EVENT_TYPE *EventType;
+
+ ///
+ /// Cast to enhance readability.
+ ///
+ EventType = (DTS_EVENT_TYPE *) Buffer;
+
+ ///
+ /// If any processor has already been flagged as Out-Of-Spec,
+ /// just return.
+ ///
+ if (*EventType != DtsEventOutOfSpec) {
+ ///
+ /// Read thermal status
+ ///
+ MsrData.Qword = AsmReadMsr64 (EFI_MSR_IA32_THERM_STATUS);
+
+ ///
+ /// Check for Out-Of-Spec status.
+ ///
+ if (MsrData.Qword & B_OUT_OF_SPEC_STATUS_LOG) {
+ *EventType = DtsEventOutOfSpec;
+
+ ///
+ /// Check thresholds.
+ ///
+ } else if ((DTSSetupValue != DTS_OUT_OF_SPEC_ONLY) &&
+ (MsrData.Qword & (B_THERMAL_THRESHOLD_1_STATUS_LOG | B_THERMAL_THRESHOLD_2_STATUS_LOG))
+ ) {
+ *EventType = DtsEventThreshold;
+ }
+ }
+}
+
+/**
+ Set the Out Of Spec Interrupt in all cores
+ This function must be AP safe.
+
+ @param[in] Buffer Unused
+
+ @retval EFI_SUCCESS Out Of Spec Interrupt programmed successfully
+**/
+VOID
+EFIAPI
+DigitalThermalSensorSetOutOfSpecInterrupt (
+ VOID *Buffer
+ )
+{
+ MSR_REGISTER MsrData;
+
+ ///
+ /// Enable Out Of Spec interrupt
+ ///
+ MsrData.Qword = AsmReadMsr64 (EFI_MSR_IA32_THERM_INTERRUPT);
+ MsrData.Qword |= OVERHEAT_INTERRUPT_ENABLE;
+ AsmWriteMsr64 (EFI_MSR_IA32_THERM_INTERRUPT, MsrData.Qword);
+
+ return;
+
+}
+
+/**
+ Set the Out Of Spec Interrupt on the package
+
+ @param[in] Buffer Unused
+
+ @retval EFI_SUCCESS Out Of Spec Interrupt programmed successfully
+**/
+EFI_STATUS
+PackageDigitalThermalSensorSetOutOfSpecInterrupt (
+ VOID *Buffer
+ )
+{
+ MSR_REGISTER MsrData;
+
+ ///
+ /// Enable Out Of Spec interrupt
+ ///
+ MsrData.Qword = AsmReadMsr64 (EFI_MSR_IA32_PACKAGE_THERM_INTERRUPT);
+ MsrData.Qword |= OVERHEAT_INTERRUPT_ENABLE;
+ AsmWriteMsr64 (EFI_MSR_IA32_PACKAGE_THERM_INTERRUPT, MsrData.Qword);
+
+ return EFI_SUCCESS;
+
+}
+
+/**
+ Read the temperature and reconfigure the thresholds.
+ This function must be AP safe.
+
+ @param[in] Buffer Pointer to UINT8 to update with the current temperature
+
+ @retval EFI_SUCCESS Digital Thermal Sensor threshold programmed successfully
+**/
+VOID
+EFIAPI
+DigitalThermalSensorSetThreshold (
+ VOID *Buffer
+ )
+{
+ INT8 ThresholdEntry;
+ MSR_REGISTER MsrData;
+ UINT8 Temperature;
+
+ ///
+ /// Read the temperature
+ ///
+ MsrData.Qword = AsmReadMsr64 (EFI_MSR_IA32_THERM_STATUS);
+
+ ///
+ /// If Out-Of-Spec, return the critical shutdown temperature.
+ ///
+ if (MsrData.Qword & B_OUT_OF_SPEC_STATUS) {
+ *((UINT8 *) Buffer) = DTS_CRITICAL_TEMPERATURE;
+ return;
+ } else if (MsrData.Qword & B_READING_VALID) {
+ ///
+ /// Find the DTS temperature.
+ ///
+ Temperature = mDtsTjMax - (MsrData.Bytes.ThirdByte & OFFSET_MASK);
+ ///
+ /// We only update the temperature if it is above the current temperature.
+ ///
+ if (Temperature > *((UINT8 *) Buffer)) {
+ *((UINT8 *) Buffer) = Temperature;
+ }
+ ///
+ /// Compare the current temperature to the Digital Thermal Sensor Threshold Table until
+ /// a matching Value is found.
+ ///
+ ThresholdEntry = 0;
+ while ((Temperature > mDtsThresholdTable[ThresholdEntry][0]) && (ThresholdEntry < (mNoOfThresholdRanges - 1))) {
+ ThresholdEntry++;
+ }
+ ///
+ /// Update the threshold values
+ ///
+ MsrData.Qword = AsmReadMsr64 (EFI_MSR_IA32_THERM_INTERRUPT);
+ ///
+ /// Low temp is threshold #2
+ ///
+ MsrData.Bytes.ThirdByte = mDtsThresholdTable[ThresholdEntry][1];
+ ///
+ /// High temp is threshold #1
+ ///
+ MsrData.Bytes.SecondByte = mDtsThresholdTable[ThresholdEntry][2];
+
+ ///
+ /// Enable interrupts
+ ///
+ MsrData.Qword |= TH1_ENABLE;
+ MsrData.Qword |= TH2_ENABLE;
+
+ ///
+ /// If the high temp is at TjMax (offset == 0)
+ /// We disable the int to avoid generating a large number of SMI because of TM1/TM2
+ /// causing many threshold crossings
+ ///
+ if (MsrData.Bytes.SecondByte == 0x80) {
+ MsrData.Qword &= ~TH1_ENABLE;
+ }
+
+ AsmWriteMsr64 (EFI_MSR_IA32_THERM_INTERRUPT, MsrData.Qword);
+ }
+ ///
+ /// Clear the threshold log bits
+ ///
+ MsrData.Qword = AsmReadMsr64 (EFI_MSR_IA32_THERM_STATUS);
+ MsrData.Qword &= ~THERM_STATUS_THRESHOLD_LOG_MASK;
+ AsmWriteMsr64 (EFI_MSR_IA32_THERM_STATUS, MsrData.Qword);
+
+ return;
+}
+
+/**
+ Read the temperature and reconfigure the thresholds on the package
+
+ @param[in] Buffer Pointer to UINT8 to update with the current temperature
+
+ @retval EFI_SUCCESS Digital Thermal Sensor threshold programmed successfully
+**/
+EFI_STATUS
+PackageDigitalThermalSensorSetThreshold (
+ VOID *Buffer
+ )
+{
+ INT8 ThresholdEntry;
+ MSR_REGISTER MsrData;
+ UINT8 Temperature;
+
+ ///
+ /// Read the temperature
+ ///
+ MsrData.Qword = AsmReadMsr64 (EFI_MSR_IA32_PACKAGE_THERM_STATUS);
+
+ ///
+ /// If Out-Of-Spec, return the critical shutdown temperature.
+ ///
+ if (MsrData.Qword & B_OUT_OF_SPEC_STATUS) {
+ *((UINT8 *) Buffer) = DTS_CRITICAL_TEMPERATURE;
+ return EFI_SUCCESS;
+ } else if (MsrData.Qword & B_READING_VALID) {
+ ///
+ /// Update temperatures for PTID
+ ///
+ DigitalThermalSensorUpdatePTID ();
+
+ ///
+ /// Find the DTS temperature.
+ ///
+ Temperature = mDtsTjMax - (MsrData.Bytes.ThirdByte & OFFSET_MASK);
+ ///
+ /// We only update the temperature if it is above the current temperature.
+ ///
+ if (Temperature > *((UINT8 *) Buffer)) {
+ *((UINT8 *) Buffer) = Temperature;
+ }
+ ///
+ /// Compare the current temperature to the Digital Thermal Sensor Threshold Table until
+ /// a matching Value is found.
+ ///
+ ThresholdEntry = 0;
+ while ((Temperature > mDtsThresholdTable[ThresholdEntry][0]) && (ThresholdEntry < (mNoOfThresholdRanges - 1))) {
+ ThresholdEntry++;
+ }
+ ///
+ /// Update the threshold values
+ ///
+ MsrData.Qword = AsmReadMsr64 (EFI_MSR_IA32_PACKAGE_THERM_INTERRUPT);
+ ///
+ /// Low temp is threshold #2
+ ///
+ MsrData.Bytes.ThirdByte = mDtsThresholdTable[ThresholdEntry][1];
+ ///
+ /// High temp is threshold #1
+ ///
+ MsrData.Bytes.SecondByte = mDtsThresholdTable[ThresholdEntry][2];
+
+ ///
+ /// Enable interrupts
+ ///
+ MsrData.Qword |= TH1_ENABLE;
+ MsrData.Qword |= TH2_ENABLE;
+
+ ///
+ /// If the high temp is at TjMax (offset == 0)
+ /// We disable the int to avoid generating a large number of SMI because of TM1/TM2
+ /// causing many threshold crossings
+ ///
+ if (MsrData.Bytes.SecondByte == 0x80) {
+ MsrData.Qword &= ~TH1_ENABLE;
+ }
+
+ AsmWriteMsr64 (EFI_MSR_IA32_PACKAGE_THERM_INTERRUPT, MsrData.Qword);
+ }
+ ///
+ /// Clear the threshold log bits
+ ///
+ MsrData.Qword = AsmReadMsr64 (EFI_MSR_IA32_PACKAGE_THERM_STATUS);
+ MsrData.Qword &= ~THERM_STATUS_THRESHOLD_LOG_MASK;
+ AsmWriteMsr64 (EFI_MSR_IA32_PACKAGE_THERM_STATUS, MsrData.Qword);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Enables the Thermal Interrupt in the core Local APIC.
+
+ @param[in] Buffer Unused
+
+ @retval EFI_SUCCESS Enable Local APIC to generate a SMI successfully
+**/
+VOID
+EFIAPI
+DigitalThermalSensorEnableSmi (
+ VOID *Buffer
+ )
+{
+ UINT32 ApicThermalValue;
+ BOOLEAN x2ApicEnabled;
+
+ x2ApicEnabled = (BOOLEAN) (((AsmReadMsr64 (EFI_MSR_XAPIC_BASE)) & (BIT11 + BIT10)) == BIT11 + BIT10);
+ ///
+ /// Configure the Local APIC to generate an SMI on Thermal events. First,
+ /// Clear BIT16, BIT10-BIT8, BIT7-BIT0. Then, set BIT9 (delivery mode).
+ /// Don't enable the interrupt if it's already enabled
+ ///
+ if (x2ApicEnabled) {
+ ApicThermalValue = (UINT32) AsmReadMsr64 (EFI_MSR_EXT_XAPIC_LVT_THERM);
+ } else {
+ ApicThermalValue = *(UINT32 *) (UINTN) LOCAL_APIC_THERMAL_DEF;
+ }
+
+ if ((ApicThermalValue & (B_INTERRUPT_MASK | B_DELIVERY_MODE | B_VECTOR)) != V_MODE_SMI) {
+ ApicThermalValue = (ApicThermalValue &~(B_INTERRUPT_MASK | B_DELIVERY_MODE | B_VECTOR)) | V_MODE_SMI;
+ if (x2ApicEnabled) {
+ AsmWriteMsr64 (EFI_MSR_EXT_XAPIC_LVT_THERM, ApicThermalValue);
+ } else {
+ *(UINT32 *) (UINTN) (LOCAL_APIC_THERMAL_DEF) = (UINT32) ApicThermalValue;
+ }
+ }
+
+ return;
+}
+
+/**
+ Disables the Thermal Interrupt in the core Local APIC.
+
+ @param[in] Buffer Unused
+
+ @retval EFI_SUCCESS Disable Local APIC to generate a SMI successfully
+**/
+VOID
+EFIAPI
+DigitalThermalSensorDisableSmi (
+ VOID *Buffer
+ )
+{
+ UINT32 ApicThermalValue;
+ BOOLEAN x2ApicEnabled;
+
+ x2ApicEnabled = (BOOLEAN) (((AsmReadMsr64 (EFI_MSR_XAPIC_BASE)) & (BIT11 + BIT10)) == BIT11 + BIT10);
+ ///
+ /// Disable Local APIC thermal entry
+ ///
+ if (x2ApicEnabled) {
+ ApicThermalValue = (UINT32) AsmReadMsr64 (EFI_MSR_EXT_XAPIC_LVT_THERM);
+ } else {
+ ApicThermalValue = *(UINT32 *) (UINTN) LOCAL_APIC_THERMAL_DEF;
+ }
+ ///
+ /// Following descriptions were from SSE BIOS
+ /// We set the interrupt mode at the same time as the interrupt is disabled to
+ /// avoid the "Received Illegal Vector" being set in the Error Status Register.
+ /// and eax, 0FFFEF800h
+ /// or eax, 000010200h ; Clear Mask, Set Delivery
+ ///
+ ApicThermalValue = (ApicThermalValue &~(B_INTERRUPT_MASK | B_DELIVERY_MODE | B_VECTOR)) | (B_INTERRUPT_MASK | V_MODE_SMI);
+ if (x2ApicEnabled) {
+ AsmWriteMsr64 (EFI_MSR_EXT_XAPIC_LVT_THERM, ApicThermalValue);
+ } else {
+ *(UINT32 *) (UINTN) (LOCAL_APIC_THERMAL_DEF) = (UINT32) ApicThermalValue;
+ }
+
+ return;
+}
+
+/**
+ Runs the specified procedure on all logical processors, passing in the
+ parameter buffer to the procedure.
+
+ @param[in] Procedure The function to be run.
+ @param[in] Buffer Pointer to a parameter buffer.
+
+ @retval EFI_SUCCESS Function executed successfully.
+**/
+STATIC
+EFI_STATUS
+RunOnAllLogicalProcessors (
+ IN OUT EFI_AP_PROCEDURE Procedure,
+ IN OUT VOID *Buffer
+ )
+{
+ UINTN Index;
+ EFI_STATUS Status;
+ UINT8 RetryIteration;
+ ///
+ /// Run the procedure on all logical processors.
+ ///
+ for (Index = 1; Index < mSmst->NumberOfCpus; Index++) {
+ Status = EFI_NOT_READY;
+ for (RetryIteration = 0; (RetryIteration < DTS_AP_SAFE_RETRY_LIMIT) && (Status != EFI_SUCCESS); RetryIteration++) {
+ Status = mSmst->SmmStartupThisAp (Procedure, Index, Buffer);
+ if (Status != EFI_SUCCESS) {
+ ///
+ /// SmmStartupThisAp might return failure if AP is busy executing some other code. Let's wait for sometime and try again.
+ ///
+ PchPmTimerStall (DTS_WAIT_PERIOD);
+ }
+ }
+ }
+ PchPmTimerStall (DTS_WAIT_PERIOD);
+ (*Procedure)(Buffer);
+ return EFI_SUCCESS;
+}
+
+/**
+ Runs the specified procedure on one specific logical processors, passing in the
+ parameter buffer to the procedure.
+
+ @param[in] Procedure The function to be run.
+ @param[in] Index Indicate which logical processor should execute this procedure
+ @param[in] Buffer Pointer to a parameter buffer.
+
+ @retval EFI_SUCCESS Function executed successfully.
+**/
+STATIC
+EFI_STATUS
+RunOnSpecificLogicalProcessor (
+ IN OUT EFI_AP_PROCEDURE Procedure,
+ IN UINTN Index,
+ IN OUT VOID *Buffer
+ )
+{
+ EFI_STATUS Status;
+ UINT8 RetryIteration;
+ ///
+ /// Run the procedure on one specific logical processor.
+ ///
+ Status = EFI_NOT_READY;
+ for (RetryIteration = 0; (RetryIteration < DTS_AP_SAFE_RETRY_LIMIT) && (Status != EFI_SUCCESS); RetryIteration++) {
+ Status = mSmst->SmmStartupThisAp (Procedure, Index, Buffer);
+ if (Status != EFI_SUCCESS) {
+ ///
+ /// SmmStartupThisAp might return failure if AP is busy executing some other code. Let's wait for sometime and try again.
+ ///
+ PchPmTimerStall (DTS_WAIT_PERIOD);
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Digital Thermal Sensor (DTS) SMM driver entry point function.
+
+ @param[in] ImageHandle Image handle for this driver image
+ @param[in] SystemTable Pointer to the EFI System Table
+
+ @retval EFI_SUCCESS Driver initialization completed successfully
+ @retval EFI_OUT_OF_RESOURCES Error when allocating required memory buffer.
+**/
+EFI_STATUS
+InstallDigitalThermalSensor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ EFI_HANDLE Handle;
+ MSR_REGISTER MsrData;
+ EFI_GLOBAL_NVS_AREA_PROTOCOL *GlobalNvsAreaProtocol;
+ EFI_SMM_SX_DISPATCH_CONTEXT SxDispatchContext;
+ EFI_SMM_SX_DISPATCH_PROTOCOL *SxDispatchProtocol;
+ EFI_HANDLE SxDispatchHandle;
+
+ EFI_SMM_IO_TRAP_DISPATCH_PROTOCOL *PchIoTrap;
+ EFI_HANDLE PchIoTrapHandle;
+ EFI_SMM_IO_TRAP_DISPATCH_REGISTER_CONTEXT PchIoTrapContext;
+ EFI_CPUID_REGISTER Cpuid06;
+
+ ///
+ /// Install DTS_INIT_STATUS_PROTOCOL protocol
+ ///
+ Handle = NULL;
+ mDtsInitStatusProtocol.IsDtsInitComplete = FALSE;
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &Handle,
+ &gDtsInitStatusProtocolGuid,
+ &mDtsInitStatusProtocol,
+ NULL
+ );
+
+ ///
+ /// Locate DTS platform policy.
+ ///
+ Status = gBS->LocateProtocol (
+ &gDxeCpuPlatformPolicyProtocolGuid,
+ NULL,
+ (VOID **) &mPlatformCpu
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "No DTS Platform Policy Protocol available"));
+ }
+
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Check if DTS disabled in setup.
+ ///
+ if (mPlatformCpu->CpuConfig->EnableDts == CPU_FEATURE_DISABLE) {
+ DEBUG ((EFI_D_WARN, "DTS not enabled/supported, so driver not loaded into SMM\n"));
+ return EFI_SUCCESS;
+ }
+ ///
+ /// Find the SMM base protocol
+ ///
+ Status = gBS->LocateProtocol (&gEfiSmmBaseProtocolGuid, NULL, (VOID **) &mSmmBase);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Initialize global variables.
+ ///
+ Status = mSmmBase->GetSmstLocation (mSmmBase, &mSmst);
+ ASSERT_EFI_ERROR (Status);
+ ///
+ /// Verify the code supports the number of processors present.
+ ///
+ ASSERT (mSmst->NumberOfCpus <= MAX_NUMBER_OF_THREADS_SUPPORTED);
+
+ ///
+ /// Get the ACPI Base Address
+ ///
+ mAcpiBaseAddr = MmioRead16 (MmPciExpressAddress (0, PCI_DEVICE_NUMBER_PCH_LPC, 0, R_PCH_LPC_ACPI_BASE)) &~BIT0;
+
+ ///
+ /// Initialize DTS setup value
+ ///
+ DTSSetupValue = mPlatformCpu->CpuConfig->EnableDts;
+
+ ///
+ /// Locate our shared data area
+ ///
+ Status = gBS->LocateProtocol (&mEfiGlobalNvsAreaProtocolGuid, NULL, (VOID **) &GlobalNvsAreaProtocol);
+ ASSERT_EFI_ERROR (Status);
+ mGlobalNvsAreaPtr = GlobalNvsAreaProtocol->Area;
+ ///
+ /// CPU_ID 6, EAX bit 6 for the Package temperature MSR support
+ ///
+ ZeroMem (&Cpuid06, sizeof (Cpuid06));
+ AsmCpuid (6, &Cpuid06.RegEax, &Cpuid06.RegEbx, &Cpuid06.RegEcx, &Cpuid06.RegEdx);
+
+ gIsPackageTempMsrAvailable = (BOOLEAN) ((Cpuid06.RegEax >> 6) & 0x01);
+ mGlobalNvsAreaPtr->IsPackageTempMSRAvailable = gIsPackageTempMsrAvailable;
+ ///
+ /// Locate Platform specific data area, or prepare platform services
+ ///
+ InitializeDtsHookLib ();
+
+ ///
+ /// Initialize ASL manipulation library
+ ///
+ InitializeAslUpdateLib ();
+
+ ///
+ /// Locate the PCH Trap dispatch protocol
+ ///
+ Status = gBS->LocateProtocol (&mEfiSmmIoTrapDispatchProtocolGuid, NULL, (VOID **) &PchIoTrap);
+ ASSERT_EFI_ERROR (Status);
+
+ PchIoTrapContext.Type = ReadWriteTrap;
+ PchIoTrapContext.Length = 4;
+ PchIoTrapContext.Address = 0;
+ PchIoTrapContext.Context = NULL;
+ PchIoTrapContext.MergeDisable = FALSE;
+ Status = PchIoTrap->Register (
+ PchIoTrap,
+ DtsIoTrapCallback,
+ &PchIoTrapContext,
+ &PchIoTrapHandle
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Update two ASL items.
+ /// 1: Operating Region for DTS IO Trap.
+ /// 2: Resource Consumption in LPC Device.
+ ///
+ ASSERT (PchIoTrapContext.Length <= (UINT8) (-1));
+ Status = UpdateAslCode (
+ (EFI_SIGNATURE_32 ('I', 'O', '_', 'D')),
+ PchIoTrapContext.Address,
+ (UINT8) PchIoTrapContext.Length
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Register a callback function to handle Digital Thermal Sensor SMIs.
+ ///
+ if (mPlatformCpu->CpuConfig->EnableDts != DTS_OUT_OF_SPEC_ONLY) {
+ Status = mSmmBase->RegisterCallback (mSmmBase, ImageHandle, DtsSmiCallback, FALSE, FALSE);
+ ASSERT_EFI_ERROR (Status);
+ } else {
+ Status = mSmmBase->RegisterCallback (mSmmBase, ImageHandle, DtsOutOfSpecSmiCallback, FALSE, FALSE);
+ ASSERT_EFI_ERROR (Status);
+ }
+ ///
+ /// Locate the Sx Dispatch Protocol
+ ///
+ Status = gBS->LocateProtocol (
+ &gEfiSmmSxDispatchProtocolGuid,
+ NULL,
+ (VOID **) &SxDispatchProtocol
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Register the callback for S3 entry
+ ///
+ SxDispatchContext.Type = SxS3;
+ SxDispatchContext.Phase = SxEntry;
+ Status = SxDispatchProtocol->Register (
+ SxDispatchProtocol,
+ DtsS3EntryCallBack,
+ &SxDispatchContext,
+ &SxDispatchHandle
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ if (mPlatformCpu->CpuConfig->EnableDts != DTS_OUT_OF_SPEC_ONLY) {
+ ///
+ /// Get the TCC Activation Temperature and use it for TjMax.
+ ///
+ MsrData.Qword = AsmReadMsr64 (EFI_MSR_IA32_TEMPERATURE_TARGET);
+
+ mDtsTjMax = (MsrData.Bytes.ThirdByte);
+ mDtsThresholdTable = mDigitalThermalSensorThresholdTable;
+ mNoOfThresholdRanges = DTS_NUMBER_THRESHOLD_RANGES;
+ }
+
+ if (gIsPackageTempMsrAvailable) {
+ ///
+ /// Enable the DTS on package.
+ ///
+ PackageDigitalThermalSensorEnable (NULL);
+ } else {
+ ///
+ /// Enable the DTS on all logical processors.
+ ///
+ RunOnAllLogicalProcessors (DigitalThermalSensorEnable, NULL);
+ }
+ ///
+ /// Initialize Digital Thermal Sensor Function in POST
+ ///
+ DigitalThermalSensorInit ();
+
+ mDtsInitStatusProtocol.IsDtsInitComplete = TRUE;
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/Haswell/DTS/Smm/DigitalThermalSensorSmm.cif b/ReferenceCode/Haswell/DTS/Smm/DigitalThermalSensorSmm.cif
new file mode 100644
index 0000000..c0b71a1
--- /dev/null
+++ b/ReferenceCode/Haswell/DTS/Smm/DigitalThermalSensorSmm.cif
@@ -0,0 +1,15 @@
+<component>
+ name = "DigitalThermalSensorSmm"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Haswell\DTS\Smm"
+ RefName = "DigitalThermalSensorSmm"
+[files]
+"DigitalThermalSensorSmm.mak"
+"DigitalThermalSensorSmm.sdl"
+"DigitalThermalSensorSmm.inf"
+"DigitalThermalSensorSmm.c"
+"DigitalThermalSensorSmm.dxs"
+"DigitalThermalSensorSmm.h"
+"DigitalThermalSensorInitStatus.h"
+"DigitalThermalSensorLib.h"
+<endComponent>
diff --git a/ReferenceCode/Haswell/DTS/Smm/DigitalThermalSensorSmm.dxs b/ReferenceCode/Haswell/DTS/Smm/DigitalThermalSensorSmm.dxs
new file mode 100644
index 0000000..cc37eff
--- /dev/null
+++ b/ReferenceCode/Haswell/DTS/Smm/DigitalThermalSensorSmm.dxs
@@ -0,0 +1,52 @@
+/** @file
+
+ Dispatch dependency expression file for the DigitalThermalSensorSmm driver.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+
+#include "AutoGen.h"
+#include "DxeDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+#endif
+
+#include EFI_PROTOCOL_DEPENDENCY (AcpiSupport)
+#include EFI_PROTOCOL_DEPENDENCY (SmmBase)
+#include EFI_PROTOCOL_DEPENDENCY (GlobalNvsArea)
+#include EFI_PROTOCOL_DEFINITION (SmmIoTrapDispatch)
+#include EFI_PROTOCOL_DEPENDENCY (SmmSxDispatch)
+#include EFI_PROTOCOL_DEPENDENCY (CpuPlatformPolicy)
+
+DEPENDENCY_START
+ EFI_ACPI_SUPPORT_GUID AND
+ EFI_SMM_BASE_PROTOCOL_GUID AND
+ EFI_SMM_IO_TRAP_DISPATCH_PROTOCOL_GUID AND
+ EFI_GLOBAL_NVS_AREA_PROTOCOL_GUID AND
+ EFI_SMM_SX_DISPATCH_PROTOCOL_GUID AND
+ DXE_CPU_PLATFORM_POLICY_PROTOCOL_GUID
+DEPENDENCY_END
+
diff --git a/ReferenceCode/Haswell/DTS/Smm/DigitalThermalSensorSmm.h b/ReferenceCode/Haswell/DTS/Smm/DigitalThermalSensorSmm.h
new file mode 100644
index 0000000..f89e982
--- /dev/null
+++ b/ReferenceCode/Haswell/DTS/Smm/DigitalThermalSensorSmm.h
@@ -0,0 +1,477 @@
+/** @file
+ Defines and prototypes for the Digital Thermal Sensor SMM driver
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#ifndef _DIGITAL_THERMAL_SENSOR_SMM_H_
+#define _DIGITAL_THERMAL_SENSOR_SMM_H_
+
+//
+// Include files
+//
+#include "EdkIIGlueDxe.h"
+#include "CpuFuncs.h"
+#include "Cpu.h"
+
+//
+// Include dependent protocols
+//
+#include EFI_PROTOCOL_DEPENDENCY (LoadedImage)
+#include EFI_PROTOCOL_DEPENDENCY (SmmBase)
+#include EFI_PROTOCOL_DEPENDENCY (GlobalNvsArea)
+#include EFI_PROTOCOL_DEPENDENCY (SmmIchnDispatch)
+#include EFI_PROTOCOL_DEPENDENCY (SmmIoTrapDispatch)
+#include EFI_PROTOCOL_DEPENDENCY (SmmSxDispatch)
+#include EFI_PROTOCOL_DEFINITION (CpuPlatformPolicy)
+
+#include "SmmIoLib.h"
+#include "AslUpdateLib.h"
+#include "DigitalThermalSensorlib.h"
+
+#include "DigitalThermalSensorInitStatus.h"
+#include "CpuRegs.h"
+#include "PchAccess.h"
+#include "PchPlatformLib.h"
+
+///
+/// Stall period in microseconds
+///
+#define DTS_WAIT_PERIOD 1
+#define DTS_AP_SAFE_RETRY_LIMIT 3
+///
+/// Define module definitions
+///
+#define TJ_MAX 110
+#define DTS_CRITICAL_TEMPERATURE 255
+
+#define DTS_SAMPLE_RATE 0x10
+#define EFI_MSR_XAPIC_BASE 0x1B
+#define EFI_MSR_IA32_THERM_INTERRUPT 0x19B
+#define TH1_VALUE 8
+#define TH1_ENABLE (1 << 15)
+#define TH2_VALUE 16
+#define TH2_ENABLE (1 << 23)
+#define OFFSET_MASK (0x7F)
+#define OVERHEAT_INTERRUPT_ENABLE (1 << 4)
+
+#define B_OUT_OF_SPEC_STATUS (1 << 4)
+#define B_OUT_OF_SPEC_STATUS_LOG (1 << 5)
+#define B_THERMAL_THRESHOLD_1_STATUS (1 << 6)
+#define B_THERMAL_THRESHOLD_1_STATUS_LOG (1 << 7)
+#define B_THERMAL_THRESHOLD_2_STATUS (1 << 8)
+#define B_THERMAL_THRESHOLD_2_STATUS_LOG (1 << 9)
+#define B_READING_VALID (1 << 31)
+
+#define EFI_MSR_IA32_TEMPERATURE_TARGET 0x1A2
+#define EFI_MSR_EXT_XAPIC_LVT_THERM 0x833
+#define EFI_MSR_MISC_PWR_MGMT 0x1AA
+#define B_LOCK_THERMAL_INT (1 << 22)
+
+#define THERM_STATUS_LOG_MASK (B_THERMAL_THRESHOLD_2_STATUS_LOG | B_THERMAL_THRESHOLD_1_STATUS_LOG | B_OUT_OF_SPEC_STATUS_LOG)
+#define THERM_STATUS_THRESHOLD_LOG_MASK (B_THERMAL_THRESHOLD_2_STATUS_LOG | B_THERMAL_THRESHOLD_1_STATUS_LOG)
+
+#define EFI_MSR_IA32_PACKAGE_THERM_STATUS 0x1B1
+#define EFI_MSR_IA32_PACKAGE_THERM_INTERRUPT 0x1B2
+
+#define B_DTS_IO_TRAP (1 << 2)
+#define R_ACPI_GPE_CNTL 0x42 ///< ACPI PM IO register 42h
+#define R_ACPI_SMI_EN 0x30 ///< ACPI PM IO register 30h
+#define B_SWGPE_CTRL (1 << 1)
+#define DTS_IO_TRAP_REGISTER_LOW_DWORD (0x00040001 + ICH_DTS_IO_TRAP_BASE_ADDRESS) ///< DigitalThermalSensor IO Trap High DWord value
+#define DTS_IO_TRAP_REGISTER_HIGH_DWORD 0x000200F0 ///< DigitalThermalSensor IO Trap High DWord value
+#define LOCAL_APIC_THERMAL_DEF 0xFEE00330
+#define B_INTERRUPT_MASK (1 << 16)
+#define B_DELIVERY_MODE (0x07 << 8)
+#define V_MODE_SMI (0x02 << 8)
+#define B_VECTOR (0xFF << 0)
+
+#define DTS_NUMBER_THRESHOLD_RANGES 9 ///< How many ranges are in the threshold table
+#define IO_TRAP_INIT_AP_DTS_FUNCTION 0x0A ///< Enable AP DigitalThermalSensor function
+#define IO_TRAP_INIT_DTS_FUNCTION_AFTER_S3 0x14 ///< Enable Digital Thermal Sensor function after resume from S3
+#define IO_TRAP_DISABLE_UPDATE_DTS 0x1E ///< Disable update DTS temperature and threshold value in every SMI
+#define INIT_DTS_SCF_MIN 0x10 ///< SCF Minimum value.
+#define INIT_DTS_SCF_UNITY 0x20 ///< SCF Unity Value.
+#define INIT_DTS_SCF_MAX 0x30 ///< SCF Maximum value.
+#define UPDATE_DTS_EVERY_SMI TRUE ///< Update DTS temperature and threshold value in every SMI
+#define R_PCH_ACPI_PM1_CNT 0x04
+#define B_PCH_ACPI_PM1_CNT_SCI_EN 0x00000001
+#define R_PCH_LPC_ACPI_BASE 0x40
+#define PCI_DEVICE_NUMBER_PCH_LPC 31
+#define MAX_NUMBER_OF_THREADS_SUPPORTED 8 ///< Max number of threads supported by processor.
+#ifndef BIT63
+#define BIT0 0x0001
+#define BIT1 0x0002
+#define BIT2 0x0004
+#define BIT3 0x0008
+#define BIT4 0x0010
+#define BIT5 0x0020
+#define BIT6 0x0040
+#define BIT7 0x0080
+#define BIT8 0x0100
+#define BIT9 0x0200
+#define BIT10 0x0400
+#define BIT11 0x0800
+#define BIT12 0x1000
+#define BIT13 0x2000
+#define BIT14 0x4000
+#define BIT15 0x8000
+#define BIT16 0x00010000
+#define BIT17 0x00020000
+#define BIT18 0x00040000
+#define BIT19 0x00080000
+#define BIT20 0x00100000
+#define BIT21 0x00200000
+#define BIT22 0x00400000
+#define BIT23 0x00800000
+#define BIT24 0x01000000
+#define BIT25 0x02000000
+#define BIT26 0x04000000
+#define BIT27 0x08000000
+#define BIT28 0x10000000
+#define BIT29 0x20000000
+#define BIT30 0x40000000
+#define BIT31 0x80000000
+#define BIT32 0x100000000
+#define BIT33 0x200000000
+#define BIT34 0x400000000
+#define BIT35 0x800000000
+#define BIT36 0x1000000000
+#define BIT37 0x2000000000
+#define BIT38 0x4000000000
+#define BIT39 0x8000000000
+#define BIT40 0x10000000000
+#define BIT41 0x20000000000
+#define BIT42 0x40000000000
+#define BIT43 0x80000000000
+#define BIT44 0x100000000000
+#define BIT45 0x200000000000
+#define BIT46 0x400000000000
+#define BIT47 0x800000000000
+#define BIT48 0x1000000000000
+#define BIT49 0x2000000000000
+#define BIT50 0x4000000000000
+#define BIT51 0x8000000000000
+#define BIT52 0x10000000000000
+#define BIT53 0x20000000000000
+#define BIT54 0x40000000000000
+#define BIT55 0x80000000000000
+#define BIT56 0x100000000000000
+#define BIT57 0x200000000000000
+#define BIT58 0x400000000000000
+#define BIT59 0x800000000000000
+#define BIT60 0x1000000000000000
+#define BIT61 0x2000000000000000
+#define BIT62 0x4000000000000000
+#define BIT63 0x8000000000000000
+#endif
+///
+/// Enumerate a DTS event type
+///
+typedef enum {
+ DtsEventNone,
+ DtsEventThreshold,
+ DtsEventOutOfSpec,
+ DtsEventMax
+} DTS_EVENT_TYPE;
+
+///
+/// Memory Mapped PCI Access macro
+///
+//#define MmPciExpressAddress(Bus, Device, Function, Register) \
+// ( \
+// (UINTN) GetPciExpressBaseAddress () + (UINTN) (Bus << 20) + (UINTN) (Device << 15) + (UINTN) \
+// (Function << 12) + (UINTN) (Register) \
+// )
+
+#define MmPciExpressAddress(Bus, Device, Function, Register) \
+ ( \
+ (UINTN) PlatformPciExpressBaseAddress + (UINTN) (Bus << 20) + (UINTN) (Device << 15) + (UINTN) \
+ (Function << 12) + (UINTN) (Register) \
+ )
+
+//
+// Function declarations
+//
+/**
+ SMI handler to handle Digital Thermal Sensor CPU Local APIC SMI
+ for thermal threshold interrupt
+
+ @param[in] SmmImageHandle Image handle returned by the SMM driver.
+ @param[in] CommunicationBuffer Pointer to the buffer that contains the communication Message
+ @param[in] SourceSize Size of the memory image to be used for handler.
+
+ @retval EFI_SUCCESS Callback Function Executed
+**/
+EFI_STATUS
+EFIAPI
+DtsSmiCallback (
+ IN EFI_HANDLE SmmImageHandle,
+ IN OUT VOID *CommunicationBuffer,
+ IN OUT UINTN *SourceSize
+ );
+
+/**
+ Call from SMI handler to handle Package thermal temperature Digital Thermal Sensor CPU Local APIC SMI
+ for thermal threshold interrupt
+
+ @retval None
+**/
+VOID
+PackageThermalDTS (
+ VOID
+ );
+
+/**
+ Perform first time initialization of the Digital Thermal Sensor
+
+ @retval EFI_SUCCESS Init Digital Thermal Sensor successfully
+**/
+EFI_STATUS
+DigitalThermalSensorInit (
+ VOID
+ );
+
+/**
+ Initializes the Thermal Sensor Control MSR
+
+ This function must be AP safe.
+
+ @param[in] Buffer Unused.
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+VOID
+EFIAPI
+DigitalThermalSensorEnable (
+ VOID *Buffer
+ );
+
+/**
+ Initializes the Package Thermal Sensor Control MSR
+
+ @param[in] Buffer Unused.
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+PackageDigitalThermalSensorEnable (
+ VOID *Buffer
+ );
+
+/**
+ Generates a _GPE._L02 SCI to an ACPI OS.
+**/
+VOID
+DigitalThermalSensorSetSwGpeSts (
+ VOID
+ );
+
+/**
+ Checks for a Core Thermal Event by reading MSR.
+
+ This function must be MP safe.
+
+ @param[in] Buffer Pointer to DTS_EVENT_TYPE
+**/
+VOID
+EFIAPI
+DigitalThermalSensorEventCheckMsr (
+ IN VOID *Buffer
+ );
+
+/**
+ Checks for a Package Thermal Event by reading MSR.
+
+ @param[in] PkgEventType - DTS_EVENT_TYPE to indicate which DTS event type has been detected.
+
+ @retval TRUE means this is a Package DTS Thermal event
+ @retval FALSE means this is not a Package DTS Thermal event.
+**/
+BOOLEAN
+DigitalThermalSensorEventCheckPackageMsr (
+ DTS_EVENT_TYPE *PkgEventType
+ );
+
+/**
+ Checks for a Core Thermal Event on any processor
+
+ @param[in] EventType - DTS_EVENT_TYPE to indicate which DTS event type has been detected.
+
+ @retval TRUE means this is a DTS Thermal event
+ @retval FALSE means this is not a DTS Thermal event.
+**/
+BOOLEAN
+DigitalThermalSensorEventCheck (
+ DTS_EVENT_TYPE *EventType
+ );
+
+/**
+ Read the temperature and reconfigure the thresholds.
+ This function must be AP safe.
+
+ @param[in] Buffer Pointer to UINT8 to update with the current temperature
+
+ @retval EFI_SUCCESS Digital Thermal Sensor threshold programmed successfully
+**/
+VOID
+EFIAPI
+DigitalThermalSensorSetThreshold (
+ VOID *Buffer
+ );
+
+/**
+ Read the temperature and reconfigure the thresholds on the package
+
+ @param[in] Buffer Pointer to UINT8 to update with the current temperature
+
+ @retval EFI_SUCCESS Digital Thermal Sensor threshold programmed successfully
+**/
+EFI_STATUS
+PackageDigitalThermalSensorSetThreshold (
+ VOID *Buffer
+ );
+
+/**
+ Set the Out Of Spec Interrupt in all cores
+ This function must be AP safe.
+
+ @param[in] Buffer Unused
+
+ @retval EFI_SUCCESS Out Of Spec Interrupt programmed successfully
+**/
+VOID
+EFIAPI
+DigitalThermalSensorSetOutOfSpecInterrupt (
+ VOID *Buffer
+ );
+
+/**
+ Set the Out Of Spec Interrupt on the package
+
+ @param[in] Buffer Unused
+
+ @retval EFI_SUCCESS Out Of Spec Interrupt programmed successfully
+**/
+EFI_STATUS
+PackageDigitalThermalSensorSetOutOfSpecInterrupt (
+ VOID *Buffer
+ );
+
+/**
+ Enables the Thermal Interrupt in the core Local APIC.
+
+ @param[in] Buffer Unused
+
+ @retval EFI_SUCCESS Enable Local APIC to generate a SMI successfully
+**/
+VOID
+EFIAPI
+DigitalThermalSensorEnableSmi (
+ VOID *Buffer
+ );
+
+/**
+ Disables the Thermal Interrupt in the core Local APIC.
+
+ @param[in] Buffer Unused
+
+ @retval EFI_SUCCESS Disable Local APIC to generate a SMI successfully
+**/
+VOID
+EFIAPI
+DigitalThermalSensorDisableSmi (
+ VOID *Buffer
+ );
+
+/**
+ Digital Thermal Sensor (DTS) SMM driver entry point function.
+
+ @param[in] ImageHandle Image handle for this driver image
+ @param[in] SystemTable Pointer to the EFI System Table
+
+ @retval EFI_SUCCESS Driver initialization completed successfully
+**/
+EFI_STATUS
+InstallDigitalThermalSensor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ );
+
+/**
+ Runs the specified procedure on all logical processors, passing in the
+ parameter buffer to the procedure.
+
+ @param[in] Procedure The function to be run.
+ @param[in] Buffer Pointer to a parameter buffer.
+
+ @retval EFI_SUCCESS Function executed successfully.
+**/
+STATIC
+EFI_STATUS
+RunOnAllLogicalProcessors (
+ IN OUT EFI_AP_PROCEDURE Procedure,
+ IN OUT VOID *Buffer
+ );
+
+/**
+ Runs the specified procedure on one specific logical processors, passing in the
+ parameter buffer to the procedure.
+
+ @param[in] Procedure The function to be run.
+ @param[in] Index Indicate which logical processor should execute this procedure
+ @param[in] Buffer Pointer to a parameter buffer.
+
+ @retval EFI_SUCCESS Function executed successfully.
+**/
+STATIC
+EFI_STATUS
+RunOnSpecificLogicalProcessor (
+ IN OUT EFI_AP_PROCEDURE Procedure,
+ IN UINTN Index,
+ IN OUT VOID *Buffer
+ );
+
+/**
+ Performs initialization of the threshold table.
+
+ @todo Update this function as necessary for the tables used by the implementation.
+
+ @retval EFI_SUCCESS Threshold tables initialized successfully.
+**/
+EFI_STATUS
+ThresholdTableInit (
+ VOID
+ );
+
+/**
+ This function executes DTS procedures for preparing to enter S3.
+
+ @param[in] Handle Handle of the callback
+ @param[in] Context The dispatch context
+
+ @retval EFI_SUCCESS DTS disabled
+**/
+VOID
+EFIAPI
+DtsS3EntryCallBack (
+ IN EFI_HANDLE Handle,
+ IN EFI_SMM_SX_DISPATCH_CONTEXT *Context
+ );
+
+#endif
diff --git a/ReferenceCode/Haswell/DTS/Smm/DigitalThermalSensorSmm.inf b/ReferenceCode/Haswell/DTS/Smm/DigitalThermalSensorSmm.inf
new file mode 100644
index 0000000..f5d0d57
--- /dev/null
+++ b/ReferenceCode/Haswell/DTS/Smm/DigitalThermalSensorSmm.inf
@@ -0,0 +1,106 @@
+## @file
+# Component description file for the DigitalThermalSensor SMM driver
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains an 'Intel Peripheral Driver' and uniquely
+# identified as "Intel Reference Module" and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+
+
+[defines]
+BASE_NAME = DigitalThermalSensorSmm
+FILE_GUID = 77A6009E-116E-464D-8EF8-B35201A022DD
+COMPONENT_TYPE = RT_DRIVER
+
+[sources.common]
+ DigitalThermalSensorSmm.c
+ DigitalThermalSensorSmm.h
+
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueSmmDriverEntryPoint.c
+
+[includes.common]
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Framework
+ .
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Core/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include/Pcd
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include/Library
+ $(EDK_SOURCE)/Foundation/Cpu/Pentium/Include
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Samplecode
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Samplecode/Include
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Samplecode/Library/AslUpdate/Dxe
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+ $(EFI_SOURCE)
+
+
+[includes.ipf]
+
+[libraries.common]
+ EdkProtocolLib
+ ArchProtocolLib
+ EdkFrameworkProtocolLib
+ EdkIIGlueBaseLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueBaseMemoryLib
+ EdkIIGlueDxeMemoryAllocationLib
+ EdkIIGlueSmmRuntimeDxeReportStatusCodeLib
+ EdkIIGlueUefiLib
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueUefiDevicePathLib
+ EdkIIGlueBasePciLibPciExpress
+ EdkIIGlueBasePciExpressLib
+ EfiProtocolLib
+ DTSHookLib
+ DxeAslUpdateLib
+ SmmIoLib
+ SmmKscLib
+ CpuProtocolLib
+ PchPlatformLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT=_ModuleEntryPoint
+ DPX_SOURCE=DigitalThermalSensorSmm.dxs
+
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=InstallDigitalThermalSensor
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_LIB__ \
+ -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_SMM_RUNTIME_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_UEFI_LIB__\
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_DEVICE_PATH_LIB__ \
+ -D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__
+
diff --git a/ReferenceCode/Haswell/DTS/Smm/DigitalThermalSensorSmm.mak b/ReferenceCode/Haswell/DTS/Smm/DigitalThermalSensorSmm.mak
new file mode 100644
index 0000000..a1386d5
--- /dev/null
+++ b/ReferenceCode/Haswell/DTS/Smm/DigitalThermalSensorSmm.mak
@@ -0,0 +1,77 @@
+# MAK file for the Module Part: PowerMgmtS3
+
+EDK : DigitalThermalSensorSmm
+
+BUILD_DigitalThermalSensorSmm_DIR = $(BUILD_DIR)\$(DigitalThermalSensorSmm_DIR)
+
+$(BUILD_DIR)\DigitalThermalSensorSmm.mak : $(DigitalThermalSensorSmm_DIR)\DigitalThermalSensorSmm.cif $(BUILD_RULES)
+ $(CIF2MAK) $(DigitalThermalSensorSmm_DIR)\DigitalThermalSensorSmm.cif $(CIF2MAK_DEFAULTS)
+
+DigitalThermalSensorSmm : $(BUILD_DIR)\DigitalThermalSensorSmm.mak DigitalThermalSensorSmmBin
+
+DigitalThermalSensorSmm_OBJECTS = \
+ $(BUILD_DigitalThermalSensorSmm_DIR)\DigitalThermalSensorSmm.obj
+
+DigitalThermalSensorSmm_MY_INCLUDES= \
+ $(EDK_INCLUDES) \
+ $(PROJECT_CPU_INCLUDES)\
+ $(INTEL_PLATFORM_PROTOCOL_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+ $(INTEL_MCH_INCLUDES)
+
+DigitalThermalSensorSmm_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=InstallDigitalThermalSensor"\
+ /D PlatformPciExpressBaseAddress=$(PCIEX_BASE_ADDRESS) \
+ /D __EDKII_GLUE_BASE_LIB__ \
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ /D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_SMM_RUNTIME_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+# /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+ /D __EDKII_GLUE_UEFI_DEVICE_PATH_LIB__
+
+DigitalThermalSensorSmm_LIBS =\
+ $(EFIGUIDLIB)\
+ $(EDKFRAMEWORKGUIDLIB)\
+ $(EDKPROTOCOLLIB)\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueSmmRuntimeDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueDxeMemoryAllocationLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(CpuProtocolLib_LIB)\
+ $(EdkIIGlueBasePciExpressLib_LIB)\
+ $(PpmAslUpdateLib_LIB)\
+ $(SmmIoLib_LIB)\
+ $(SmmKscLib_LIB)\
+ $(DTSHookLib_LIB)\
+ $(PchPlatformSmmLib_LIB)
+
+DigitalThermalSensorSmmBin : $(DigitalThermalSensorSmm_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\DigitalThermalSensorSmm.mak all\
+ MAKEFILE=$(BUILD_DIR)\DigitalThermalSensorSmm.mak \
+ "MY_INCLUDES=$(DigitalThermalSensorSmm_MY_INCLUDES)" \
+ "MY_DEFINES=$(DigitalThermalSensorSmm_DEFINES)"\
+ OBJECTS="$(DigitalThermalSensorSmm_OBJECTS)" \
+ GUID=77A6009E-116E-464D-8EF8-B35201A022DD\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=RT_DRIVER \
+ EDKIIModule=SMMDRIVER\
+ DEPEX1=$(DigitalThermalSensorSmm_DIR)\DigitalThermalSensorSmm.dxs \
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \
+ COMPRESS=1
+
diff --git a/ReferenceCode/Haswell/DTS/Smm/DigitalThermalSensorSmm.sdl b/ReferenceCode/Haswell/DTS/Smm/DigitalThermalSensorSmm.sdl
new file mode 100644
index 0000000..a28ccce
--- /dev/null
+++ b/ReferenceCode/Haswell/DTS/Smm/DigitalThermalSensorSmm.sdl
@@ -0,0 +1,25 @@
+TOKEN
+ Name = "Haswell_DigitalThermalSensorSmm_SUPPORT"
+ Value = "1"
+ Help = "Main switch to include Haswell DigitalThermalSensorSmm driver to the Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "DigitalThermalSensorSmm_DIR"
+End
+
+MODULE
+ Help = "Includes DigitalThermalSensorSmm.mak to Project"
+ File = "DigitalThermalSensorSmm.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\DigitalThermalSensorSmm.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/Haswell/Docs/Haswell_CPU_RC_ReleaseNotes.pdf b/ReferenceCode/Haswell/Docs/Haswell_CPU_RC_ReleaseNotes.pdf
new file mode 100644
index 0000000..14be742
--- /dev/null
+++ b/ReferenceCode/Haswell/Docs/Haswell_CPU_RC_ReleaseNotes.pdf
Binary files differ
diff --git a/ReferenceCode/Haswell/Docs/Intel Haswell Processor Reference Code Specification_1.9.0.pdf b/ReferenceCode/Haswell/Docs/Intel Haswell Processor Reference Code Specification_1.9.0.pdf
new file mode 100644
index 0000000..0fe80ce
--- /dev/null
+++ b/ReferenceCode/Haswell/Docs/Intel Haswell Processor Reference Code Specification_1.9.0.pdf
Binary files differ
diff --git a/ReferenceCode/Haswell/Docs/RcCpuApi.chm b/ReferenceCode/Haswell/Docs/RcCpuApi.chm
new file mode 100644
index 0000000..8b4f925
--- /dev/null
+++ b/ReferenceCode/Haswell/Docs/RcCpuApi.chm
Binary files differ
diff --git a/ReferenceCode/Haswell/Docs/ReleaseNotes.txt b/ReferenceCode/Haswell/Docs/ReleaseNotes.txt
new file mode 100644
index 0000000..734f956
--- /dev/null
+++ b/ReferenceCode/Haswell/Docs/ReleaseNotes.txt
@@ -0,0 +1,54 @@
+;***********************************************************************;
+;* *;
+;* Intel(r) Restricted Secret *;
+;* *;
+;* Haswell CPU Reference Code *;
+;* *;
+;* PCCG Systems Software Engineering *;
+;* *;
+;* Copyright (c) 2014 Intel Corp. *;
+;* *;
+;* This program has been developed by Intel Corporation. *;
+;* Licensee has Intel's permission to incorporate this source code*;
+;* into their product, royalty free. This source code may NOT be *;
+;* redistributed to anyone without Intel's written permission. *;
+;* *;
+;* Intel specifically disclaims all warranties, express or *;
+;* implied, and all liability, including consequential and other *;
+;* indirect damages, for the use of this code, including liability*;
+;* for infringement of any proprietary rights, and including the *;
+;* warranties of merchantability and fitness for a particular *;
+;* purpose. Intel does not assume any responsibility for any *;
+;* errors which may appear in this code nor any responsibility to *;
+;* update it. *;
+;* *;
+;***********************************************************************;
+
+
+Purpose of Reference Code
+
+------------------------------------------------------------------------------
+
+This is Reference code for initialization of the Haswell Processor.
+This supports detection and initialization of various functionalities in
+CPU. The algorithm used in this file follows the algorithm provided in the
+Haswell Processor Family BIOS Writer's Guide.
+
+------------------------------------------------------------------------------
+
+
+Framework Haswell CPU Reference Code Version Information
+Revision: 1.9.0
+Release Date: Nov 6, 2014
+
+
+Release Details
+---------------
+
+EDK version: Edk-Dev-Snapshot-20061117 + EDK1117PatchV8
+Compiler tools version: VS2008 + SP1
+CRB BAT version: HLPT138
+
+References
+----------
+Haswell Processor Family BIOS Writer's Guide 1.8.0 \ No newline at end of file
diff --git a/ReferenceCode/Haswell/Guid/CpuGuidLib.cif b/ReferenceCode/Haswell/Guid/CpuGuidLib.cif
new file mode 100644
index 0000000..8baf1c5
--- /dev/null
+++ b/ReferenceCode/Haswell/Guid/CpuGuidLib.cif
@@ -0,0 +1,24 @@
+<component>
+ name = "CpuGuidLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Haswell\Guid\"
+ RefName = "CpuGuidLib"
+[files]
+"CpuGuidLib.sdl"
+"CpuGuidLib.mak"
+"CpuGuidLib.inf"
+"HtBistHob\HtBistHob.c"
+"HtBistHob\HtBistHob.h"
+"PowerMgmtAcpiTableStorage\PowerMgmtAcpiTableStorage.c"
+"PowerMgmtAcpiTableStorage\PowerMgmtAcpiTableStorage.h"
+"PoweronHob\PoweronHob.c"
+"PoweronHob\PoweronHob.h"
+"SmramCpuDataHeader\SmramCpuDataHeader.c"
+"SmramCpuDataHeader\SmramCpuDataHeader.h"
+"SmramCpuDataVariable\SmramCpuDataVariable.c"
+"SmramCpuDataVariable\SmramCpuDataVariable.h"
+"TxtInfoHob\TxtInfoHob.c"
+"TxtInfoHob\TxtInfoHob.h"
+"TxtOneTouch\TxtOneTouch.c"
+"TxtOneTouch\TxtOneTouch.h"
+<endComponent>
diff --git a/ReferenceCode/Haswell/Guid/CpuGuidLib.inf b/ReferenceCode/Haswell/Guid/CpuGuidLib.inf
new file mode 100644
index 0000000..12a43c2
--- /dev/null
+++ b/ReferenceCode/Haswell/Guid/CpuGuidLib.inf
@@ -0,0 +1,68 @@
+## @file
+# Component description file for CpuGuidLib
+#
+#@copyright
+# Copyright (c) 2008 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains an 'Intel Peripheral Driver' and uniquely
+# identified as "Intel Reference Module" and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+
+[defines]
+BASE_NAME = CpuGuidLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ HtBistHob/HtBistHob.c
+ HtBistHob/HtBistHob.h
+ SmramCpuDataVariable/SmramCpuDataVariable.c
+ SmramCpuDataVariable/SmramCpuDataVariable.h
+ SmramCpuDataHeader/SmramCpuDataHeader.c
+ SmramCpuDataHeader/SmramCpuDataHeader.h
+ PoweronHob/PoweronHob.c
+ PoweronHob/PoweronHob.h
+ PowerMgmtAcpiTableStorage/PowerMgmtAcpiTableStorage.h
+ PowerMgmtAcpiTableStorage/PowerMgmtAcpiTableStorage.c
+ TxtInfoHob/TxtInfoHob.c
+ TxtInfoHob/TxtInfoHob.h
+ TxtOneTouch/TxtOneTouch.c
+ TxtOneTouch/TxtOneTouch.h
+
+[includes.common]
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Pei/Include
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)
+
+#
+# Edk II Glue Library, some hearder are included by R9 header so have to include
+#
+
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Framework
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[nmake.common]
+C_STD_INCLUDE=
diff --git a/ReferenceCode/Haswell/Guid/CpuGuidLib.mak b/ReferenceCode/Haswell/Guid/CpuGuidLib.mak
new file mode 100644
index 0000000..b569f92
--- /dev/null
+++ b/ReferenceCode/Haswell/Guid/CpuGuidLib.mak
@@ -0,0 +1,19 @@
+# MAK file for the ModulePart:PpmGuidLib
+
+$(CpuGuidLib_LIB) : CpuGuidLib
+
+CpuGuidLib : $(BUILD_DIR)\CpuGuidLib.mak CpuGuidLibBin
+
+$(BUILD_DIR)\CpuGuidLib.mak : $(CpuGuidLib_DIR)\$(@B).cif $(CpuGuidLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(CpuGuidLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+CpuGuidLibBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDK_DEFAULTS)\
+ /f $(BUILD_DIR)\CpuGuidLib.mak all\
+ "MY_INCLUDES=$(EDK_INCLUDES) $(EdkIIGlueLib_INCLUDES) $(PROJECT_CPU_INCLUDES)" \
+ TYPE=LIBRARY \
+ LIBRARY_NAME=$(CpuGuidLib_LIB)
+ $(MAKE) /$(MAKEFLAGS) $(EDK_DEFAULTS) BUILD_DIR=$(BUILD_DIR)\IA32\
+ /f $(BUILD_DIR)\CpuGuidLib.mak all\
+ "MY_INCLUDES=$(EDK_INCLUDES) $(EdkIIGlueLib_INCLUDES) $(PROJECT_CPU_INCLUDES)" \
+ TYPE=PEI_LIBRARY
diff --git a/ReferenceCode/Haswell/Guid/CpuGuidLib.sdl b/ReferenceCode/Haswell/Guid/CpuGuidLib.sdl
new file mode 100644
index 0000000..f328927
--- /dev/null
+++ b/ReferenceCode/Haswell/Guid/CpuGuidLib.sdl
@@ -0,0 +1,26 @@
+TOKEN
+ Name = CpuGuidLib_SUPPORT
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable CpuGuidLib support in Project"
+End
+
+MODULE
+ Help = "Includes CpuGuidLib.mak to Project"
+ File = "CpuGuidLib.mak"
+End
+
+PATH
+ Name = "CpuGuidLib_DIR"
+End
+
+TOKEN
+ Name = "CpuGuidLib_LIB"
+ Value = "$$(LIB_BUILD_DIR)\CpuGuidLib.lib"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
diff --git a/ReferenceCode/Haswell/Guid/HtBistHob/HtBistHob.c b/ReferenceCode/Haswell/Guid/HtBistHob/HtBistHob.c
new file mode 100644
index 0000000..a2457c7
--- /dev/null
+++ b/ReferenceCode/Haswell/Guid/HtBistHob/HtBistHob.c
@@ -0,0 +1,24 @@
+/** @file
+ GUIDs used for HT BIST Status HOB entries in the HOB list.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains 'Framework Code' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may not be modified, except as allowed by
+ additional terms of your license agreement.
+**/
+#include "Tiano.h"
+#include EFI_GUID_DEFINITION (HtBistHob)
+
+EFI_GUID gEfiHtBistHobGuid = EFI_HT_BIST_HOB_GUID;
+
+EFI_GUID_STRING(&gEfiHtBistHobGuid, "HT BIST HOB", "HT BIST HOB GUID for HOB list.");
diff --git a/ReferenceCode/Haswell/Guid/HtBistHob/HtBistHob.h b/ReferenceCode/Haswell/Guid/HtBistHob/HtBistHob.h
new file mode 100644
index 0000000..bd5e593
--- /dev/null
+++ b/ReferenceCode/Haswell/Guid/HtBistHob/HtBistHob.h
@@ -0,0 +1,29 @@
+/** @file
+ GUID used for HT BIST Status HOB entries in the HOB list.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains 'Framework Code' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may not be modified, except as allowed by
+ additional terms of your license agreement.
+**/
+#ifndef _HT_BIST_HOB_GUID_H_
+#define _HT_BIST_HOB_GUID_H_
+
+#define EFI_HT_BIST_HOB_GUID \
+ { \
+ 0xbe644001, 0xe7d4, 0x48b1, 0xb0, 0x96, 0x8b, 0xa0, 0x47, 0xbc, 0x7a, 0xe7 \
+ }
+
+extern EFI_GUID gEfiHtBistHobGuid;
+
+#endif
diff --git a/ReferenceCode/Haswell/Guid/PowerMgmtAcpiTableStorage/PowerMgmtAcpiTableStorage.c b/ReferenceCode/Haswell/Guid/PowerMgmtAcpiTableStorage/PowerMgmtAcpiTableStorage.c
new file mode 100644
index 0000000..f8878dd
--- /dev/null
+++ b/ReferenceCode/Haswell/Guid/PowerMgmtAcpiTableStorage/PowerMgmtAcpiTableStorage.c
@@ -0,0 +1,40 @@
+/** @file
+ The GUID definition for power management ACPI table storage file name
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+///
+/// Statements that include other files
+///
+#include "EdkIIGlueDxe.h"
+#include "PowerMgmtAcpiTableStorage.h"
+
+///
+/// Protocol GUID definition
+///
+EFI_GUID gPowerMgmtAcpiTableStorageGuid = POWER_MGMT_ACPI_TABLE_STORAGE_GUID;
+
+///
+/// Protocol description
+///
+EFI_GUID_STRING
+(
+ &gPowerMgmtAcpiTableStorageGuid, "Power Management ACPI Table Storage File Name",
+ "Power Management ACPI Table Storage file name GUID"
+);
diff --git a/ReferenceCode/Haswell/Guid/PowerMgmtAcpiTableStorage/PowerMgmtAcpiTableStorage.h b/ReferenceCode/Haswell/Guid/PowerMgmtAcpiTableStorage/PowerMgmtAcpiTableStorage.h
new file mode 100644
index 0000000..fa96723
--- /dev/null
+++ b/ReferenceCode/Haswell/Guid/PowerMgmtAcpiTableStorage/PowerMgmtAcpiTableStorage.h
@@ -0,0 +1,35 @@
+/** @file
+ GUID definition for the Power Management ACPI table storage file name
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _POWER_MGMT_ACPI_TABLE_STORAGE_H_
+#define _POWER_MGMT_ACPI_TABLE_STORAGE_H_
+
+///
+/// Power Mgmt policy provided by platform for ACPI Table Storage
+/// {299141BB-211A-48a5-92C0-6F9A0A3A006E}
+///
+#define POWER_MGMT_ACPI_TABLE_STORAGE_GUID \
+ { \
+ 0x299141bb, 0x211a, 0x48a5, 0x92, 0xc0, 0x6f, 0x9a, 0xa, 0x3a, 0x0, 0x6e \
+ }
+
+extern EFI_GUID gPowerMgmtAcpiTableStorageGuid;
+
+#endif
diff --git a/ReferenceCode/Haswell/Guid/PoweronHob/PoweronHob.c b/ReferenceCode/Haswell/Guid/PoweronHob/PoweronHob.c
new file mode 100644
index 0000000..660d5d1
--- /dev/null
+++ b/ReferenceCode/Haswell/Guid/PoweronHob/PoweronHob.c
@@ -0,0 +1,24 @@
+/** @file
+ GUIDs used for PowerOn boot mode (not reset).
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains 'Framework Code' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may not be modified, except as allowed by
+ additional terms of your license agreement.
+**/
+#include "Tiano.h"
+#include EFI_GUID_DEFINITION (PowerOnHob)
+
+EFI_GUID gEfiPowerOnHobGuid = EFI_POWER_ON_HOB_GUID;
+
+EFI_GUID_STRING(&gEfiPowerOnHobGuid, "Power On HOB", "Hob GUID for Power On boot mode");
diff --git a/ReferenceCode/Haswell/Guid/PoweronHob/PoweronHob.h b/ReferenceCode/Haswell/Guid/PoweronHob/PoweronHob.h
new file mode 100644
index 0000000..9d0487b
--- /dev/null
+++ b/ReferenceCode/Haswell/Guid/PoweronHob/PoweronHob.h
@@ -0,0 +1,29 @@
+/** @file
+ GUID for Power On boot mode.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains 'Framework Code' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may not be modified, except as allowed by
+ additional terms of your license agreement.
+**/
+#ifndef _POWER_ON_HOB_GUID_H_
+#define _POWER_ON_HOB_GUID_H_
+
+#define EFI_POWER_ON_HOB_GUID \
+ { \
+ 0x468a601, 0xc535, 0x46fd, 0xa9, 0x5d, 0xbb, 0xab, 0x99, 0x1b, 0x17, 0x8c \
+ }
+
+extern EFI_GUID gEfiPowerOnHobGuid;
+
+#endif
diff --git a/ReferenceCode/Haswell/Guid/SmramCpuDataHeader/SmramCpuDataHeader.c b/ReferenceCode/Haswell/Guid/SmramCpuDataHeader/SmramCpuDataHeader.c
new file mode 100644
index 0000000..76f25fe
--- /dev/null
+++ b/ReferenceCode/Haswell/Guid/SmramCpuDataHeader/SmramCpuDataHeader.c
@@ -0,0 +1,24 @@
+/** @file
+ GUIDs used for SMRAM CPU DATA Header as signature for search
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains 'Framework Code' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may not be modified, except as allowed by
+ additional terms of your license agreement.
+**/
+#include "Tiano.h"
+#include EFI_GUID_DEFINITION (SmramCpuDataHeader)
+
+EFI_GUID gSmramCpuDataHeaderGuid = SMRAM_CPU_DATA_HEADER_GUID;
+
+EFI_GUID_STRING(&gSmramCpuDataHeaderGuid, "SMRAM CPU DATA Header", "SMRAM CPU DATA Header GUID");
diff --git a/ReferenceCode/Haswell/Guid/SmramCpuDataHeader/SmramCpuDataHeader.h b/ReferenceCode/Haswell/Guid/SmramCpuDataHeader/SmramCpuDataHeader.h
new file mode 100644
index 0000000..fd8c4ea
--- /dev/null
+++ b/ReferenceCode/Haswell/Guid/SmramCpuDataHeader/SmramCpuDataHeader.h
@@ -0,0 +1,32 @@
+/** @file
+ GUIDs used for SMRAM CPU DATA Header signature
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains 'Framework Code' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may not be modified, except as allowed by
+ additional terms of your license agreement.
+**/
+#ifndef _SMRAM_CPU_DATA_HEADER_H_
+#define _SMRAM_CPU_DATA_HEADER_H_
+
+///
+/// SMRAM CPU DATA Header for search by CpuS3Peim
+///
+#define SMRAM_CPU_DATA_HEADER_GUID \
+ { \
+ 0x5848fd2d, 0xd6af, 0x474b, 0x82, 0x75, 0x95, 0xdd, 0xe7, 0x0a, 0xe8, 0x23 \
+ }
+
+extern EFI_GUID gSmramCpuDataHeaderGuid;
+
+#endif
diff --git a/ReferenceCode/Haswell/Guid/SmramCpuDataVariable/SmramCpuDataVariable.c b/ReferenceCode/Haswell/Guid/SmramCpuDataVariable/SmramCpuDataVariable.c
new file mode 100644
index 0000000..9448ca9
--- /dev/null
+++ b/ReferenceCode/Haswell/Guid/SmramCpuDataVariable/SmramCpuDataVariable.c
@@ -0,0 +1,24 @@
+/** @file
+ GUIDs used for ACPI CPU DATA Variable.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains 'Framework Code' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may not be modified, except as allowed by
+ additional terms of your license agreement.
+**/
+#include "Tiano.h"
+#include EFI_GUID_DEFINITION (SmramCpuDataVariable)
+
+EFI_GUID gSmramCpuDataVariableGuid = SMRAM_CPU_DATA_VARIABLE_GUID;
+
+EFI_GUID_STRING(&gSmramCpuDataVariableGuid, "SMRAM CPU DATA Variable", "SMRAM CPU DATA Variable GUID");
diff --git a/ReferenceCode/Haswell/Guid/SmramCpuDataVariable/SmramCpuDataVariable.h b/ReferenceCode/Haswell/Guid/SmramCpuDataVariable/SmramCpuDataVariable.h
new file mode 100644
index 0000000..33a66b9
--- /dev/null
+++ b/ReferenceCode/Haswell/Guid/SmramCpuDataVariable/SmramCpuDataVariable.h
@@ -0,0 +1,46 @@
+/** @file
+ GUIDs used for SMRAM CPU DATA Variable to keep 2 locations for copying data from
+ regular memory to SMM memory
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains 'Framework Code' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may not be modified, except as allowed by
+ additional terms of your license agreement.
+**/
+#ifndef _SMRAM_CPU_DATA_VARIABLE_H_
+#define _SMRAM_CPU_DATA_VARIABLE_H_
+
+///
+/// CPU Driver will maintain ACPI CPU DATA in regular memory,
+/// 1. CpuInitDxe driver will allocate SMM memory, and normal memory
+/// 2. Save both location in SMRAM_CPU_DATA_VARIABLE
+/// 3. Issue SMM_FROM_CPU_DRIVER_SAVE_INFO SW SMI to ask SMM driver to
+/// copy data to SMRAM with signature.
+/// 4. In S3 path, CPUS3 retrieves data by search signature in SMRAM.
+///
+#define SMRAM_CPU_DATA_VARIABLE_GUID \
+ { \
+ 0x429501d9, 0xe447, 0x40f4, 0x86, 0x7b, 0x75, 0xc9, 0x3a, 0x1d, 0xb5, 0x4e \
+ }
+
+#define SMRAM_CPU_DATA_VARIABLE L"SmramCpuDataVar"
+
+typedef struct {
+ EFI_PHYSICAL_ADDRESS LockBoxData;
+ EFI_PHYSICAL_ADDRESS SmramCpuData;
+ UINT64 LockBoxSize;
+} SMRAM_CPU_DATA_ADDRESS;
+
+extern EFI_GUID gSmramCpuDataVariableGuid;
+
+#endif
diff --git a/ReferenceCode/Haswell/Guid/TxtInfoHob/TxtInfoHob.c b/ReferenceCode/Haswell/Guid/TxtInfoHob/TxtInfoHob.c
new file mode 100644
index 0000000..6803c27
--- /dev/null
+++ b/ReferenceCode/Haswell/Guid/TxtInfoHob/TxtInfoHob.c
@@ -0,0 +1,33 @@
+/** @file
+ This file contains GUID to use for creation of TXT Info Hob.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+///
+/// External include files do NOT need to be explicitly specified in real EDKII
+/// environment
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include EFI_GUID_DEFINITION (TxtInfoHob)
+#endif
+
+EFI_GUID gTxtInfoHobGuid = TXT_INFO_HOB_GUID;
+
+EFI_GUID_STRING(&gTxtInfoHobGuid, "TXT Info Hob", "TXT Info Hob");
diff --git a/ReferenceCode/Haswell/Guid/TxtInfoHob/TxtInfoHob.h b/ReferenceCode/Haswell/Guid/TxtInfoHob/TxtInfoHob.h
new file mode 100644
index 0000000..e006497
--- /dev/null
+++ b/ReferenceCode/Haswell/Guid/TxtInfoHob/TxtInfoHob.h
@@ -0,0 +1,65 @@
+/** @file
+ This file contains definitions required for creation of TXT Info HOB.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _TXT_HOB_H_
+#define _TXT_HOB_H_
+
+#define TXT_INFO_HOB_GUID \
+ { \
+ 0x2986883F, 0x88E0, 0x48d0, 0x4B, 0x82, 0x20, 0xC2, 0x69, 0x48, 0xDD, 0xAC \
+ }
+
+extern EFI_GUID gTxtInfoHobGuid;
+
+#pragma pack(push, 1)
+
+typedef struct {
+ BOOLEAN ChipsetIsTxtCapable;
+ UINT8 TxtMode;
+ UINT64 PmBase;
+ UINT64 SinitMemorySize;
+ UINT64 TxtHeapMemorySize;
+ EFI_PHYSICAL_ADDRESS TxtDprMemoryBase;
+ UINT64 TxtDprMemorySize;
+ EFI_PHYSICAL_ADDRESS BiosAcmBase;
+ UINT64 BiosAcmSize;
+ EFI_PHYSICAL_ADDRESS McuUpdateDataAddr;
+ EFI_PHYSICAL_ADDRESS SinitAcmBase;
+ UINT64 SinitAcmSize;
+ UINT64 TgaSize;
+ EFI_PHYSICAL_ADDRESS TxtLcpPdBase;
+ UINT64 TxtLcpPdSize;
+ UINT64 Flags;
+} TXT_INFO_DATA;
+
+#define FLAGS0 0x1
+#define TXT_CPU_RESET_REQUIRED 0x2
+#define TPM_INIT_FAILED 0x4
+
+#define CMOS_INDEX_PORT 0x70
+#define CMOS_DATA_PORT 0x71
+
+typedef struct {
+ EFI_HOB_GUID_TYPE EfiHobGuidType;
+ TXT_INFO_DATA Data;
+} TXT_INFO_HOB;
+#pragma pack(pop)
+
+#endif
diff --git a/ReferenceCode/Haswell/Guid/TxtOneTouch/TxtOneTouch.c b/ReferenceCode/Haswell/Guid/TxtOneTouch/TxtOneTouch.c
new file mode 100644
index 0000000..acdeafc
--- /dev/null
+++ b/ReferenceCode/Haswell/Guid/TxtOneTouch/TxtOneTouch.c
@@ -0,0 +1,33 @@
+/** @file
+ This file contains definitions required for One-Touch function.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+///
+/// External include files do NOT need to be explicitly specified in real EDKII
+/// environment
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include EFI_GUID_DEFINITION (TxtOneTouch)
+#endif
+
+EFI_GUID gTxtOneTouchGuid = TXT_ONE_TOUCH_GUID;
+
+EFI_GUID_STRING(&gTxtOneTouchGuid, "TXT One_Touch GUID", "TXT One_Touch GUID");
diff --git a/ReferenceCode/Haswell/Guid/TxtOneTouch/TxtOneTouch.h b/ReferenceCode/Haswell/Guid/TxtOneTouch/TxtOneTouch.h
new file mode 100644
index 0000000..a99b42e
--- /dev/null
+++ b/ReferenceCode/Haswell/Guid/TxtOneTouch/TxtOneTouch.h
@@ -0,0 +1,53 @@
+/** @file
+ This file contains definitions required for One-Touch function.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _TXT_ONE_TOUCH_H_
+#define _TXT_ONE_TOUCH_H_
+
+#define TXT_ONE_TOUCH_GUID \
+ { \
+ 0x3D989471, 0xCFAC, 0x46B7, 0x9B, 0x1C, 0x8, 0x43, 0x1, 0x9, 0x40, 0x2D \
+ }
+
+extern EFI_GUID gTxtOneTouchGuid;
+
+//
+// Operation
+//
+#define ENABLE_VT 128
+#define DISABLE_VT_TXT 129
+#define ENABLE_VTD 130
+#define DISABLE_VTD_TXT 131
+#define ENABLE_ACTTPM_VT_VTD_TXT_DISABLE_STM 132
+#define ENABLE_ACTTPM_VT_VTD_TXT_STM 133
+#define DISABLE_STM 134
+#define DISABLE_TXT_STM 135
+#define DISABLE_SENTER_VMX 136 ///< optional
+#define ENABLE_VMX_SMX_ONLY 137 ///< optional
+#define ENABLE_VMX_OUTSIDE_SMX 138 ///< optional
+#define ENABLE_VMX 139 ///< optional
+#define ENABLE_SENTER_ONLY 140 ///< optional
+#define ENABLE_SENTER_VMX_IN_SMX 141 ///< optional
+#define ENABLE_SENTER_VMX_OUTSIDE_SMX 142 ///< optional
+#define ENABLE_SENTER_VMX 143 ///< optional
+#define SET_NO_TXT_MAINTENANCE_FALSE 159
+#define SET_NO_TXT_MAINTENANCE_TRUE 160
+
+#endif
diff --git a/ReferenceCode/Haswell/Haswell.chm b/ReferenceCode/Haswell/Haswell.chm
new file mode 100644
index 0000000..ddbe518
--- /dev/null
+++ b/ReferenceCode/Haswell/Haswell.chm
Binary files differ
diff --git a/ReferenceCode/Haswell/HaswellPkg.cif b/ReferenceCode/Haswell/HaswellPkg.cif
new file mode 100644
index 0000000..a6cfa11
--- /dev/null
+++ b/ReferenceCode/Haswell/HaswellPkg.cif
@@ -0,0 +1,12 @@
+<component>
+ name = "Intel Haswell"
+ category = CPU
+ LocalRoot = "ReferenceCode\Haswell\"
+ RefName = "Intel Haswell"
+[files]
+"HaswellPkg.sdl"
+"Haswell.chm"
+[parts]
+"Haswell Cpu RC PKG"
+"AMI Cpu PKG"
+<endComponent>
diff --git a/ReferenceCode/Haswell/HaswellPkg.sdl b/ReferenceCode/Haswell/HaswellPkg.sdl
new file mode 100644
index 0000000..e3e0b67
--- /dev/null
+++ b/ReferenceCode/Haswell/HaswellPkg.sdl
@@ -0,0 +1,10 @@
+TOKEN
+ Name = "HaswellPkg_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable Ivy Bridge support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+End
diff --git a/ReferenceCode/Haswell/HaswellRcPkg.cif b/ReferenceCode/Haswell/HaswellRcPkg.cif
new file mode 100644
index 0000000..fc84bee
--- /dev/null
+++ b/ReferenceCode/Haswell/HaswellRcPkg.cif
@@ -0,0 +1,46 @@
+<component>
+ name = "Intel Haswell Cpu RC PKG"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Haswell\"
+ RefName = "Haswell Cpu RC PKG"
+[files]
+"HaswellRcPkg.sdl"
+"Docs\RcCpuApi.chm"
+"Docs\Haswell_CPU_RC_ReleaseNotes.pdf"
+"Docs\ReleaseNotes.txt"
+"Docs\Intel Haswell Processor Reference Code Specification_1.9.0.pdf"
+[parts]
+"CpuInitDxe"
+"CpuInitPei"
+"CpuGuidLib"
+"CpuProtocolLib"
+"CpuRcInclude"
+"CpuPpiLib"
+"CpuRcSec"
+"ThunkLib"
+"CpuS3Peim"
+"PowerManagementAcpiTables"
+"PowerMgmtInit"
+"PowerMgmtS3"
+"Cpu Policy Pei"
+"Cpu Policy Dxe"
+"PpmAslUpdateLib"
+"CpuSampleCode"
+"CpuPlatformLib"
+"OcPlatformLib"
+"DigitalThermalSensorSmm"
+"SmmKscLib"
+"SmmIoLib"
+"DTSHookLib"
+"TxtPei"
+"TxtDxe"
+"TxtBiosAcm"
+"TxtTools"
+"TxtOneTouchDxe"
+"CpuSampleCodeProtocolLib"
+"OcPlatformLib"
+"TxtLib"
+"BootGuardRevocationLib"
+"BootGuardLib"
+"BootGuardTpmEventLogLib"
+<endComponent>
diff --git a/ReferenceCode/Haswell/HaswellRcPkg.sdl b/ReferenceCode/Haswell/HaswellRcPkg.sdl
new file mode 100644
index 0000000..30fba98
--- /dev/null
+++ b/ReferenceCode/Haswell/HaswellRcPkg.sdl
@@ -0,0 +1,206 @@
+TOKEN
+ Name = "INTEL_CPURC_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable Ivy Bridge CPU reference code support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+End
+
+TOKEN
+ Name = "BIST_SUPPORT"
+ Value = "0"
+ Help = "Due to Intel sighting report, do not turn on this token."
+ TokenType = Boolean
+ TargetMAK = Yes
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "CpuRatioOverride_Support"
+ Value = "0"
+ Help = "Due to Intel sighting report, do not turn on this token."
+ TokenType = Boolean
+ TargetMAK = Yes
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "DcaState_token"
+ Value = "0"
+ Help = "Due to Intel sighting report, do not turn on this token."
+ TokenType = Boolean
+ TargetMAK = Yes
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "FastString_token"
+ Value = "1"
+ Help = "Token for setup CPU Policy protocol."
+ TokenType = Boolean
+ TargetMAK = Yes
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "MachineCheckEnable_token"
+ Value = "1"
+ Help = "Token for setup CPU Policy protocol."
+ TokenType = Boolean
+ TargetMAK = Yes
+ TargetH = Yes
+End
+
+#TOKEN
+# Name = "MonitorMwaitEnable_token"
+# Value = "1"
+# Help = "Token for setup CPU Policy protocol."
+# TokenType = Boolean
+# TargetMAK = Yes
+# TargetH = Yes
+#End
+
+#-TOKEN
+#- Name = "XapicEnable_token"
+#- Value = "0"
+#- Help = "Token for setup CPU Policy protocol."
+#- TokenType = Boolean
+#- TargetMAK = Yes
+#- TargetH = Yes
+#-End
+
+#TOKEN
+# Name = "BspSelectione_token"
+# Value = "0"
+# Help = "Token for setup CPU Policy protocol."
+# TokenType = Boolean
+# TargetMAK = Yes
+# TargetH = Yes
+#End
+
+TOKEN
+ Name = "DcaPrefetchDelayValue_token"
+ Value = "4"
+ Help = "Token for setup CPU Policy protocol."
+ TokenType = Boolean
+ TargetMAK = Yes
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "VirtualWireMode_token"
+ Value = "0"
+ Help = "Token for setup CPU Policy protocol."
+ TokenType = Boolean
+ TargetMAK = Yes
+ TargetH = Yes
+End
+
+PATH
+#- Name = "IvyBridgePkg_DIR"
+ Name = "PROJECT_CPU_ROOT"
+End
+
+PATH
+ Name = "PROJECT_PCH_ROOT"
+ Path = "ReferenceCode\Chipset\LynxPoint"
+End
+
+#-PATH
+#- Name = "IvyBridgePkgPei_DIR"
+#-End
+
+#-PATH
+#- Name = "IvyBridgePkgDxe_DIR"
+#-End
+
+ELINK
+#- Name = "IvyBridgePkg_INCLUDES"
+ Name = "PROJECT_CPU_INCLUDES"
+ InvokeOrder = ReplaceParent
+End
+
+#-ELINK
+#- Name = "IvyBridgePkgPei_INCLUDES"
+#- InvokeOrder = ReplaceParent
+#-End
+#-
+#-ELINK
+#- Name = "IvyBridgePkgDxe_INCLUDES"
+#- InvokeOrder = ReplaceParent
+#-End
+
+ELINK
+ Name = "/I$(PROJECT_CPU_ROOT)"
+ Parent = "PROJECT_CPU_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(PROJECT_CPU_ROOT)\Include"
+ Parent = "PROJECT_CPU_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(PROJECT_CPU_ROOT)\Include\Library"
+ Parent = "PROJECT_CPU_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(PROJECT_CPU_ROOT)\CpuInit\Dxe\x64"
+ Parent = "PROJECT_CPU_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(PROJECT_CPU_ROOT)\SampleCode\Include"
+ Parent = "PROJECT_CPU_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(PROJECT_CPU_ROOT)\SampleCode"
+ Parent = "PROJECT_CPU_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(PROJECT_PCH_ROOT)\Include"
+ Parent = "PROJECT_CPU_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(PROJECT_PCH_ROOT)\Include\Library"
+ Parent = "PROJECT_CPU_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+#-ELINK
+#- Name = "/I$(IvyBridgePkg_DIR)\SampleCode\CpuPolicyInit\Pei"
+#- Parent = "IvyBridgePkgPei_INCLUDES"
+#- InvokeOrder = AfterParent
+#-End
+#-
+#-ELINK
+#- Name = "/I$(IvyBridgePkg_DIR)\CpuInit\Dxe"
+#- Parent = "IvyBridgePkgDxe_INCLUDES"
+#- InvokeOrder = AfterParent
+#-End
+#-
+#-ELINK
+#- Name = "/I$(IvyBridgePkg_DIR)\SampleCode\CpuPolicyInit\Dxe"
+#- Parent = "IvyBridgePkgDxe_INCLUDES"
+#- InvokeOrder = AfterParent
+#-End
+#-
+#-ELINK
+#- Name = "/I$(IvyBridgePkg_DIR)\SampleCode\CpuPolicyInit\Dxe\x64"
+#- Parent = "IvyBridgePkgDxe_INCLUDES"
+#- InvokeOrder = AfterParent
+#-End
diff --git a/ReferenceCode/Haswell/Include/CommonIncludes.h b/ReferenceCode/Haswell/Include/CommonIncludes.h
new file mode 100644
index 0000000..4fe8b54
--- /dev/null
+++ b/ReferenceCode/Haswell/Include/CommonIncludes.h
@@ -0,0 +1,120 @@
+/** @file
+ This file defines common equates.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Mobile Silicon Support Module" and is
+ licensed for Intel Mobile CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _COMMON_INCLUDES_H_
+#define _COMMON_INCLUDES_H_
+
+#define V_INTEL_VID 0x8086
+
+#ifndef STALL_ONE_MICRO_SECOND
+#define STALL_ONE_MICRO_SECOND 1
+#endif
+#ifndef STALL_ONE_MILLI_SECOND
+#define STALL_ONE_MILLI_SECOND 1000
+#endif
+//
+// Min Max
+//
+#define V_MIN(a, b) (((a) < (b)) ? (a) : (b))
+#define V_MAX(a, b) (((a) > (b)) ? (a) : (b))
+
+///
+/// Bit map macro
+///
+#ifndef BIT0
+
+#define BIT63 0x8000000000000000ULL
+#define BIT62 0x4000000000000000ULL
+#define BIT61 0x2000000000000000ULL
+#define BIT60 0x1000000000000000ULL
+#define BIT59 0x0800000000000000ULL
+#define BIT58 0x0400000000000000ULL
+#define BIT57 0x0200000000000000ULL
+#define BIT56 0x0100000000000000ULL
+#define BIT55 0x0080000000000000ULL
+#define BIT54 0x0040000000000000ULL
+#define BIT53 0x0020000000000000ULL
+#define BIT52 0x0010000000000000ULL
+#define BIT51 0x0008000000000000ULL
+#define BIT50 0x0004000000000000ULL
+#define BIT49 0x0002000000000000ULL
+#define BIT48 0x0001000000000000ULL
+#define BIT47 0x0000800000000000ULL
+#define BIT46 0x0000400000000000ULL
+#define BIT45 0x0000200000000000ULL
+#define BIT44 0x0000100000000000ULL
+#define BIT43 0x0000080000000000ULL
+#define BIT42 0x0000040000000000ULL
+#define BIT41 0x0000020000000000ULL
+#define BIT40 0x0000010000000000ULL
+#define BIT39 0x0000008000000000ULL
+#define BIT38 0x0000004000000000ULL
+#define BIT37 0x0000002000000000ULL
+#define BIT36 0x0000001000000000ULL
+#define BIT35 0x0000000800000000ULL
+#define BIT34 0x0000000400000000ULL
+#define BIT33 0x0000000200000000ULL
+#define BIT32 0x0000000100000000ULL
+
+#define BIT31 0x80000000
+#define BIT30 0x40000000
+#define BIT29 0x20000000
+#define BIT28 0x10000000
+#define BIT27 0x08000000
+#define BIT26 0x04000000
+#define BIT25 0x02000000
+#define BIT24 0x01000000
+#define BIT23 0x00800000
+#define BIT22 0x00400000
+#define BIT21 0x00200000
+#define BIT20 0x00100000
+#define BIT19 0x00080000
+#define BIT18 0x00040000
+#define BIT17 0x00020000
+#define BIT16 0x00010000
+#define BIT15 0x00008000
+#define BIT14 0x00004000
+#define BIT13 0x00002000
+#define BIT12 0x00001000
+#define BIT11 0x00000800
+#define BIT10 0x00000400
+#define BIT9 0x00000200
+#define BIT8 0x00000100
+#define BIT7 0x00000080
+#define BIT6 0x00000040
+#define BIT5 0x00000020
+#define BIT4 0x00000010
+#define BIT3 0x00000008
+#define BIT2 0x00000004
+#define BIT1 0x00000002
+#define BIT0 0x00000001
+#endif
+
+#define BITS(x) (1 << (x))
+
+/*
+Notes :
+ 1. Bit position always starts at 0.
+ 2. Following macros are applicable only for Word alligned integers.
+*/
+#define BIT(Pos, Value) (1 << (Pos) & (Value))
+#define BITRANGE(From, Width, Value) (((Value) >> (From)) & ((1 << (Width)) - 1))
+
+#endif
diff --git a/ReferenceCode/Haswell/Include/CpuAccess.h b/ReferenceCode/Haswell/Include/CpuAccess.h
new file mode 100644
index 0000000..e3dd024
--- /dev/null
+++ b/ReferenceCode/Haswell/Include/CpuAccess.h
@@ -0,0 +1,28 @@
+/** @file
+ Macros to simplify and abstract the interface to CPU configuration.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _CPUACCESS_H_
+#define _CPUACCESS_H_
+
+#include "CpuRegs.h"
+#include "CpuDataStruct.h"
+#include "CpuBaseLib.h"
+
+#endif
diff --git a/ReferenceCode/Haswell/Include/CpuBaseLib.h b/ReferenceCode/Haswell/Include/CpuBaseLib.h
new file mode 100644
index 0000000..87c8363
--- /dev/null
+++ b/ReferenceCode/Haswell/Include/CpuBaseLib.h
@@ -0,0 +1,193 @@
+/** @file
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _CPU_BASE_LIB_H
+#define _CPU_BASE_LIB_H
+
+///
+/// Combine f(FamilyId), m(Model), s(SteppingId) to a single 32 bit number
+///
+#define EfiMakeCpuVersion(f, m, s) (((UINT32) (f) << 16) | ((UINT32) (m) << 8) | ((UINT32) (s)))
+
+#if defined (__GNUC__)
+#define IA32API _EFIAPI
+#else
+#define IA32API __cdecl
+#endif
+
+/**
+ Halt the Cpu
+**/
+VOID
+IA32API
+EfiHalt (
+ VOID
+ );
+
+/**
+ Write back and invalidate the Cpu cache
+**/
+VOID
+IA32API
+EfiWbinvd (
+ VOID
+ );
+
+/**
+ Invalidate the Cpu cache
+**/
+VOID
+IA32API
+EfiInvd (
+ VOID
+ );
+
+/**
+ Get the Cpu info by excute the CPUID instruction
+
+ @param[in] RegisterInEax -The input value to put into register EAX
+ @param[in] Regs -The Output value
+**/
+VOID
+IA32API
+EfiCpuid (
+ IN UINT32 RegisterInEax,
+ OUT EFI_CPUID_REGISTER *Regs
+ );
+
+/**
+ When RegisterInEax != 4, the functionality is the same as EfiCpuid.
+ When RegisterInEax == 4, the function return the deterministic cache
+ parameters by excuting the CPUID instruction
+
+ @param[in] RegisterInEax - The input value to put into register EAX
+ @param[in] CacheLevel - The deterministic cache level
+ @param[in] Regs - The Output value
+**/
+VOID
+IA32API
+EfiCpuidExt (
+ IN UINT32 RegisterInEax,
+ IN UINT32 CacheLevel,
+ OUT EFI_CPUID_REGISTER *Regs
+ );
+
+/**
+ Read Cpu MSR
+
+ @param[in] Index - The index value to select the register
+
+ @retval UINT64 - the read data
+**/
+UINT64
+IA32API
+EfiReadMsr (
+ IN UINT32 Index
+ );
+
+/**
+ Write Cpu MSR
+
+ @param[in] Index - The index value to select the register
+ @param[in] Value - The value to write to the selected register
+**/
+VOID
+IA32API
+EfiWriteMsr (
+ IN UINT32 Index,
+ IN UINT64 Value
+ );
+
+/**
+ Read Time stamp
+
+ @retval Return the read data
+**/
+UINT64
+IA32API
+EfiReadTsc (
+ VOID
+ );
+
+/**
+ Writing back and invalidate the cache,then diable it
+**/
+VOID
+IA32API
+EfiDisableCache (
+ VOID
+ );
+
+/**
+ Invalidate the cache,then Enable it
+**/
+VOID
+IA32API
+EfiEnableCache (
+ VOID
+ );
+
+/**
+ Get Eflags
+
+ @retval Return the Eflags value
+**/
+UINT32
+IA32API
+EfiGetEflags (
+ VOID
+ );
+
+/**
+ Disable interrupt
+**/
+VOID
+IA32API
+EfiDisableInterrupts (
+ VOID
+ );
+/**
+ Enable interrupt
+**/
+VOID
+IA32API
+EfiEnableInterrupts (
+ VOID
+ );
+
+/**
+ Extract CPU detail version infomation
+
+ @param[in] FamilyId - FamilyId, including ExtendedFamilyId
+ @param[in] Model - Model, including ExtendedModel
+ @param[in] SteppingId - SteppingId
+ @param[in] Processor - Processor
+**/
+VOID
+IA32API
+EfiCpuVersion (
+ IN UINT16 *FamilyId,
+ OPTIONAL
+ IN UINT8 *Model,
+ OPTIONAL
+ IN UINT8 *SteppingId,
+ OPTIONAL
+ IN UINT8 *Processor OPTIONAL
+ );
+
+#endif
diff --git a/ReferenceCode/Haswell/Include/CpuDataStruct.h b/ReferenceCode/Haswell/Include/CpuDataStruct.h
new file mode 100644
index 0000000..bb2aee4
--- /dev/null
+++ b/ReferenceCode/Haswell/Include/CpuDataStruct.h
@@ -0,0 +1,142 @@
+/** @file
+ CPU data structure
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _CPU_DATA_STRUCT_H
+#define _CPU_DATA_STRUCT_H
+
+#include EFI_GUID_DEFINITION (SmramCpuDataVariable)
+#include EFI_GUID_DEFINITION (SmramCpuDataHeader)
+
+#pragma pack(1)
+typedef struct {
+ UINT16 Limit;
+ UINTN Base;
+} PSEUDO_DESCRIPTOR;
+#pragma pack()
+
+typedef struct {
+ BOOLEAN APState;
+ BOOLEAN S3BootPath;
+ EFI_PHYSICAL_ADDRESS WakeUpBuffer;
+ EFI_PHYSICAL_ADDRESS GdtrProfile;
+ EFI_PHYSICAL_ADDRESS IdtrProfile;
+ EFI_PHYSICAL_ADDRESS CpuPrivateData;
+ EFI_PHYSICAL_ADDRESS StackAddress;
+ EFI_PHYSICAL_ADDRESS MicrocodePointerBuffer;
+ EFI_PHYSICAL_ADDRESS SmramBase;
+ EFI_PHYSICAL_ADDRESS SmmStartImageBase;
+ UINT32 SmmStartImageSize;
+ UINT32 NumberOfCpus;
+} ACPI_CPU_DATA;
+
+typedef struct {
+ //
+ // Guid as Signature.
+ //
+ EFI_GUID HeaderGuid;
+ EFI_PHYSICAL_ADDRESS AcpiCpuPointer;
+ ACPI_CPU_DATA AcpiCpuData;
+
+ //
+ // It points the data defined below.
+ //
+ EFI_PHYSICAL_ADDRESS GdtrProfileOffset;
+ EFI_PHYSICAL_ADDRESS GdtOffset;
+ EFI_PHYSICAL_ADDRESS IdtrProfileOffset;
+ EFI_PHYSICAL_ADDRESS IdtOffset;
+ EFI_PHYSICAL_ADDRESS CpuPrivateDataOffset;
+ EFI_PHYSICAL_ADDRESS S3BootScriptTableOffset;
+ EFI_PHYSICAL_ADDRESS S3BspMtrrTableOffset;
+ EFI_PHYSICAL_ADDRESS MicrocodePointerBufferOffset; ///< It is pointer to pointer array.
+ EFI_PHYSICAL_ADDRESS MicrocodeDataBufferOffset; ///< It is pointer to the data.
+ ///
+ /// We need put all the data buffer here as well.
+ /// These data will be copied to original location in S3.
+ ///
+ //
+ // DataBuffer size
+ //
+ UINT32 GdtrProfileSize;
+ UINT32 GdtSize;
+ UINT32 IdtrProfileSize;
+ UINT32 IdtSize;
+ UINT32 CpuPrivateDataSize;
+ UINT32 S3BootScriptTableSize;
+ UINT32 S3BspMtrrTableSize;
+ UINT32 MicrocodePointerBufferSize;
+ UINT32 MicrocodeDataBufferSize;
+
+ //
+ // UINT8 WakeUpBufferData[WakeUpBufferSize];
+ // UINT8 GdtrProfileData[GdtrProfileSize];
+ // UINT8 GdtData[GdtSize];
+ // UINT8 IdtrProfileData[IdtrProfileSize];
+ // UINT8 IdtData[IdtSize];
+ // UINT8 CpuPrivateData[CpuPrivateDataSize];
+ // UINT8 S3BootScriptTable[S3BootScriptTableSize];
+ // UINT8 S3BspMtrrTable[S3BspMtrrTableSize];
+ // UINT32 MicrocodePointerBufferData[NumberOfCpus + 1];
+ // UINT8 MicrocodeDataBufferData[MicrocodeDataBufferSize * NumberOfCpus];
+ //
+} SMRAM_CPU_DATA;
+
+typedef struct {
+ UINT32 RegEax;
+ UINT32 RegEbx;
+ UINT32 RegEcx;
+ UINT32 RegEdx;
+} EFI_CPUID_REGISTER;
+
+typedef struct {
+ UINT32 HeaderVersion;
+ UINT32 UpdateRevision;
+ UINT32 Date;
+ UINT32 ProcessorId;
+ UINT32 Checksum;
+ UINT32 LoaderRevision;
+ UINT32 ProcessorFlags;
+ UINT32 DataSize;
+ UINT32 TotalSize;
+ UINT8 Reserved[12];
+} EFI_CPU_MICROCODE_HEADER;
+
+typedef struct {
+ UINT32 ExtendedSignatureCount;
+ UINT32 ExtendedTableChecksum;
+ UINT8 Reserved[12];
+} EFI_CPU_MICROCODE_EXTENDED_TABLE_HEADER;
+
+typedef struct {
+ UINT32 ProcessorSignature;
+ UINT32 ProcessorFlag;
+ UINT32 ProcessorChecksum;
+} EFI_CPU_MICROCODE_EXTENDED_TABLE;
+
+typedef struct {
+ UINT32 Stepping : 4;
+ UINT32 Model : 4;
+ UINT32 Family : 4;
+ UINT32 Type : 2;
+ UINT32 Reserved1 : 2;
+ UINT32 ExtendedModel : 4;
+ UINT32 ExtendedFamily : 8;
+ UINT32 Reserved2 : 4;
+} EFI_CPU_VERSION;
+
+#endif
diff --git a/ReferenceCode/Haswell/Include/CpuPowerMgmt.dsc b/ReferenceCode/Haswell/Include/CpuPowerMgmt.dsc
new file mode 100644
index 0000000..1acb64f
--- /dev/null
+++ b/ReferenceCode/Haswell/Include/CpuPowerMgmt.dsc
@@ -0,0 +1,145 @@
+## @file
+# Build description file for building the power management ACPI tables
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains an 'Intel Peripheral Driver' and uniquely
+# identified as "Intel Reference Module" and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+
+[=============================================================================]
+#
+# Instructions for building the power management ACPI table storage file
+#
+[=============================================================================]
+[Build.Ia32.ACPITABLE,Build.x64.ACPITABLE]
+#
+# Check if we have any source to work with.
+#
+!IFNDEF SECTIONS
+!IFNDEF ASL_FILES
+!ERROR No ASL source files to build were defined in the INF file
+!ENDIF
+!ENDIF
+
+#
+# Define some macros to simplify changes
+#
+TARGET_FFS_FILE = $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).ffs
+
+#
+# Build CST SSDT sections for processor 0
+#
+$(DEST_DIR)\SsdtCpu0Cst.sec : $(ASL_SOURCE_FILES) $(ASL_FILES)
+ $(ASL) $(ASL_FLAGS) $(DEST_DIR)\Ssdt\Cpu0Cst.asl
+ -copy $(DEST_DIR)\Ssdt\Cpu0Cst.aml $(DEST_DIR)\SsdtCpu0Cst.acpi
+ $(GENSECTION) -I $(DEST_DIR)\SsdtCpu0Cst.acpi -O $(DEST_DIR)\SsdtCpu0Cst.sec -S EFI_SECTION_RAW
+
+#
+# Build IST SSDT sections for processor 0
+#
+$(DEST_DIR)\SsdtCpu0Ist.sec : $(ASL_SOURCE_FILES) $(ASL_FILES)
+ $(ASL) $(ASL_FLAGS) $(DEST_DIR)\Ssdt\Cpu0Ist.asl
+ -copy $(DEST_DIR)\Ssdt\Cpu0Ist.aml $(DEST_DIR)\SsdtCpu0Ist.acpi
+ $(GENSECTION) -I $(DEST_DIR)\SsdtCpu0Ist.acpi -O $(DEST_DIR)\SsdtCpu0Ist.sec -S EFI_SECTION_RAW
+
+#
+# Build TST SSDT sections for processor 0
+#
+$(DEST_DIR)\SsdtCpu0Tst.sec : $(ASL_SOURCE_FILES) $(ASL_FILES)
+ $(ASL) $(ASL_FLAGS) $(DEST_DIR)\Ssdt\Cpu0Tst.asl
+ -copy $(DEST_DIR)\Ssdt\Cpu0Tst.aml $(DEST_DIR)\SsdtCpu0Tst.acpi
+ $(GENSECTION) -I $(DEST_DIR)\SsdtCpu0Tst.acpi -O $(DEST_DIR)\SsdtCpu0Tst.sec -S EFI_SECTION_RAW
+
+
+#
+# Build CST SSDT sections for processor 1
+#
+$(DEST_DIR)\SsdtApCst.sec : $(ASL_SOURCE_FILES) $(ASL_FILES)
+ $(ASL) $(ASL_FLAGS) $(DEST_DIR)\Ssdt\ApCst.asl
+ -copy $(DEST_DIR)\Ssdt\ApCst.aml $(DEST_DIR)\SsdtApCst.acpi
+ $(GENSECTION) -I $(DEST_DIR)\SsdtApCst.acpi -O $(DEST_DIR)\SsdtApCst.sec -S EFI_SECTION_RAW
+
+#
+# Build IST SSDT sections for processor 1
+#
+$(DEST_DIR)\SsdtApIst.sec : $(ASL_SOURCE_FILES) $(ASL_FILES)
+ $(ASL) $(ASL_FLAGS) $(DEST_DIR)\Ssdt\ApIst.asl
+ -copy $(DEST_DIR)\Ssdt\ApIst.aml $(DEST_DIR)\SsdtApIst.acpi
+ $(GENSECTION) -I $(DEST_DIR)\SsdtApIst.acpi -O $(DEST_DIR)\SsdtApIst.sec -S EFI_SECTION_RAW
+
+#
+# Build TST SSDT sections for processor 1
+#
+$(DEST_DIR)\SsdtApTst.sec : $(ASL_SOURCE_FILES) $(ASL_FILES)
+ $(ASL) $(ASL_FLAGS) $(DEST_DIR)\Ssdt\ApTst.asl
+ -copy $(DEST_DIR)\Ssdt\ApTst.aml $(DEST_DIR)\SsdtApTst.acpi
+ $(GENSECTION) -I $(DEST_DIR)\SsdtApTst.acpi -O $(DEST_DIR)\SsdtApTst.sec -S EFI_SECTION_RAW
+
+#
+# Build SSDT sections for processor power management
+#
+$(DEST_DIR)\SsdtCpuPm.sec : $(ASL_SOURCE_FILES) $(ASL_FILES)
+ $(ASL) $(ASL_FLAGS) $(DEST_DIR)\Ssdt\CpuPm.asl
+ -copy $(DEST_DIR)\Ssdt\CpuPm.aml $(DEST_DIR)\SsdtCpuPm.acpi
+ $(GENSECTION) -I $(DEST_DIR)\SsdtCpuPm.acpi -O $(DEST_DIR)\SsdtCpuPm.sec -S EFI_SECTION_RAW
+
+#
+# Build SSDT sections for processor power management
+#
+$(DEST_DIR)\SsdtCtdp.sec : $(ASL_SOURCE_FILES) $(ASL_FILES)
+ $(ASL) $(ASL_FLAGS) $(DEST_DIR)\Ssdt\Ctdp.asl
+ -copy $(DEST_DIR)\Ssdt\Ctdp.aml $(DEST_DIR)\SsdtCtdp.acpi
+ $(GENSECTION) -I $(DEST_DIR)\SsdtCtdp.acpi -O $(DEST_DIR)\SsdtCtdp.sec -S EFI_SECTION_RAW
+
+#
+# Build LakeTiny SSDT sections for processor power management
+#
+$(DEST_DIR)\SsdtLakeTiny.sec : $(ASL_SOURCE_FILES) $(ASL_FILES)
+ $(ASL) $(ASL_FLAGS) $(DEST_DIR)\Ssdt\LakeTiny.asl
+ -copy $(DEST_DIR)\Ssdt\LakeTiny.aml $(DEST_DIR)\SsdtLakeTiny.acpi
+ $(GENSECTION) -I $(DEST_DIR)\SsdtLakeTiny.acpi -O $(DEST_DIR)\SsdtLakeTiny.sec -S EFI_SECTION_RAW
+
+#
+# Build FFS file
+#
+$(TARGET_FFS_FILE) : $(SECTIONS) $(DEST_DIR)\SsdtCpu0Cst.sec $(DEST_DIR)\SsdtCpu0Ist.sec $(DEST_DIR)\SsdtCpu0Tst.sec $(DEST_DIR)\SsdtApCst.sec $(DEST_DIR)\SsdtApIst.sec $(DEST_DIR)\SsdtApTst.sec $(DEST_DIR)\SsdtCpuPm.sec $(DEST_DIR)\SsdtCtdp.sec $(DEST_DIR)\SsdtLakeTiny.sec
+ $(GENFFSFILE) -B $(DEST_DIR) -P1 $(DEST_DIR)\$(BASE_NAME).pkg -V
+
+all : $(TARGET_FFS_FILE)
+
+[=============================================================================]
+[Package.ACPITABLE.Default]
+PACKAGE.INF
+\[.]
+BASE_NAME = $(BASE_NAME)
+FFS_FILEGUID = $(FILE_GUID)
+FFS_FILETYPE = EFI_FV_FILETYPE_FREEFORM
+FFS_ATTRIB_CHECKSUM = TRUE
+
+IMAGE_SCRIPT =
+{
+ Compress (Dummy) {
+ $(DEST_DIR)\SsdtCpu0Cst.sec
+ $(DEST_DIR)\SsdtCpu0Ist.sec
+ $(DEST_DIR)\SsdtCpu0Tst.sec
+ $(DEST_DIR)\SsdtApCst.sec
+ $(DEST_DIR)\SsdtApIst.sec
+ $(DEST_DIR)\SsdtApTst.sec
+ $(DEST_DIR)\SsdtCpuPm.sec
+ $(DEST_DIR)\SsdtCtdp.sec
+ $(DEST_DIR)\SsdtLakeTiny.sec
+ }
+}
diff --git a/ReferenceCode/Haswell/Include/CpuRcInclude.cif b/ReferenceCode/Haswell/Include/CpuRcInclude.cif
new file mode 100644
index 0000000..88aff67
--- /dev/null
+++ b/ReferenceCode/Haswell/Include/CpuRcInclude.cif
@@ -0,0 +1,27 @@
+<component>
+ name = "CpuRcInclude"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Haswell\Include\"
+ RefName = "CpuRcInclude"
+[files]
+"CommonIncludes.h"
+"CpuAccess.h"
+"CpuBaseLib.h"
+"CpuDataStruct.h"
+"CpuPowerMgmt.dsc"
+"CpuRegs.h"
+"IntelCpuDxe.dsc"
+"IntelCpuDxeLib.dsc"
+"IntelCpuPei.dsc"
+"IntelCpuPeiLib.dsc"
+"PfatDefinitions.h"
+"PowerMgmtDefinitions.h"
+"ThunkLib.h"
+"TisPc.h"
+"Txt.h"
+"Txt.inc"
+"Library\CpuPlatformLib.h"
+"Library\BootGuardLibrary.h"
+"Library\TxtLibrary.h"
+
+<endComponent>
diff --git a/ReferenceCode/Haswell/Include/CpuRegs.h b/ReferenceCode/Haswell/Include/CpuRegs.h
new file mode 100644
index 0000000..ed92b70
--- /dev/null
+++ b/ReferenceCode/Haswell/Include/CpuRegs.h
@@ -0,0 +1,582 @@
+/** @file
+ Conventions:
+ - Prefixes:
+ Definitions beginning with "MSR_" are MSRs
+ Definitions beginning with "R_" are registers
+ Definitions beginning with "B_" are bits within registers
+ Definitions beginning with "V_" are meaningful values of bits within the registers
+ Definitions beginning with "S_" are register sizes
+ Definitions beginning with "N_" are the bit position
+
+@copyright
+ Copyright (c) 2004 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _CPU_REGS_H_
+#define _CPU_REGS_H_
+
+#include "CommonIncludes.h"
+
+//
+// Local APIC defines
+//
+#define APIC_REGISTER_LOCAL_ID_OFFSET 0x00000020
+#define APIC_REGISTER_APIC_VERSION_OFFSET 0x00000030
+#define APIC_REGISTER_SPURIOUS_VECTOR_OFFSET 0x000000F0
+#define APIC_REGISTER_ICR_LOW_OFFSET 0x00000300
+#define APIC_REGISTER_ICR_HIGH_OFFSET 0x00000310
+#define APIC_REGISTER_LINT0_VECTOR_OFFSET 0x00000350
+#define APIC_REGISTER_LINT1_VECTOR_OFFSET 0x00000360
+
+#define BROADCAST_MODE_SPECIFY_CPU 0x00
+#define BROADCAST_MODE_ALL_INCLUDING_SELF 0x01
+#define BROADCAST_MODE_ALL_EXCLUDING_SELF 0x02
+
+#ifndef DELIVERY_MODE_REMOTE_READ
+
+#define DELIVERY_MODE_FIXED 0x00
+#define DELIVERY_MODE_LOWEST_PRIORITY 0x01
+#define DELIVERY_MODE_SMI 0x02
+#define DELIVERY_MODE_REMOTE_READ 0x03
+#define DELIVERY_MODE_NMI 0x04
+#define DELIVERY_MODE_INIT 0x05
+#define DELIVERY_MODE_SIPI 0x06
+#define DELIVERY_MODE_MAX 0x07
+
+#define TRIGGER_MODE_EDGE 0x00
+#define TRIGGER_MODE_LEVEL 0x01
+
+#endif
+
+#define CACHE_UNCACHEABLE 0
+#define CACHE_WRITECOMBINING 1
+#define CACHE_WRITETHROUGH 4
+#define CACHE_WRITEPROTECTED 5
+#define CACHE_WRITEBACK 6
+
+#define CPUID_SIGNATURE 0x0
+#define CPUID_VERSION_INFO 0x1
+#define CPUID_FUNCTION_4 0x4
+#define CPU_CACHE_TYPE_MASK 0x1F
+#define CPU_CACHE_LEVEL_MASK 0x07
+#define CPU_CACHE_ASSOCIATIVITY_MASK 0x03FF
+#define CPU_CACHE_PARTITION_MASK 0x03FF
+#define CPU_CACHE_LINE_SIZE_MASK 0x0FFF
+#define B_CPUID_VERSION_INFO_ECX_MWAIT BIT3
+#define B_CPUID_VERSION_INFO_ECX_VME BIT5
+#define B_CPUID_VERSION_INFO_ECX_SME BIT6
+#define B_CPUID_VERSION_INFO_ECX_EIST BIT7
+#define B_CPUID_VERSION_INFO_ECX_TM2 BIT8
+#define B_CPUID_VERSION_INFO_ECX_DCA BIT18
+#define B_CPUID_VERSION_INFO_ECX_AES BIT25
+#define B_CPUID_VERSION_INFO_ECX_XAPIC BIT21
+#define B_CPUID_VERSION_INFO_EDX_XD BIT20
+#define B_CPUID_VERSION_INFO_EDX_HT BIT28
+#define B_CPUID_VERSION_INFO_EDX_TM1 BIT29
+
+#define CPUID_CACHE_INFO 0x2
+#define CPUID_SERIAL_NUMBER 0x3
+#define CPUID_CACHE_PARAMS 0x4
+
+//
+// CPU ID Instruction defines
+//
+#define V_CPUID_CACHE_TYPE_MASK 0x1F
+#define B_CPUID_CACHE_TYPE_DATA 0x1
+#define B_CPUID_CACHE_TYPE_INSTRUCTION 0x2
+#define B_CPUID_CACHE_TYPE_UNIFIED 0x3
+#define V_CPUID_CACHE_LEVEL_MASK 0xE0
+#define B_CPUID_CACHE_LEVEL_SHIFT 5
+#define B_CPUID_CACHE_PARAMS_WAYS_SHIFT 22
+#define B_CPUID_CACHE_PARAMS_PARTITIONS_SHIFT 12
+#define CPUID_MONITOR_MWAIT_PARAMS 0x5
+#define B_CPUID_MONITOR_MWAIT_ECX_EXTENSIONS BIT0
+#define B_CPUID_MONITOR_MWAIT_EDX_CSTATE BIT0
+#define V_CPUID_MONITOR_MWAIT_EDX_ENHANCED_CSTATE 0x2
+#define CPUID_POWER_MANAGEMENT_PARAMS 0x6
+#define B_CPUID_POWER_MANAGEMENT_EAX_TURBO BIT1
+#define B_CPUID_POWER_MANAGEMENT_EAX_FINE_GRAINED_CLOCK_MODULATION BIT5
+#define B_CPUID_POWER_MANAGEMENT_ECX_ENERGY_EFFICIENT_POLICY_SUPPORT BIT3
+#define CPUID_REV7 0x7
+#define CPUID_REV8 0x8
+#define CPUID_DCA_PARAMS 0x9
+#define CPUID_REVA 0xA
+#define CPUID_CORE_TOPOLOGY 0xB
+#define CPUID_EXTENDED_FUNCTION 0x80000000
+#define CPUID_EXTENDED_CPU_SIG 0x80000001
+#define CPUID_BRAND_STRING1 0x80000002
+#define CPUID_BRAND_STRING2 0x80000003
+#define CPUID_BRAND_STRING3 0x80000004
+#define CPUID_L2_CACHE_FEATURE 0x80000006
+#define CPUID_VIR_PHY_ADDRESS_SIZE 0x80000008
+
+//
+// MSR defines
+//
+#define MSR_IA32_PLATFORM_ID 0x00000017
+#define MSR_IA32_APIC_BASE 0x0000001B
+#define B_MSR_IA32_APIC_BASE_G_XAPIC BIT11
+#define B_MSR_IA32_APIC_BASE_M_XAPIC BIT10
+#define B_MSR_IA32_APIC_BASE_BSP BIT8
+#define PIC_THREAD_CONTROL 0x0000002E
+#define B_PIC_THREAD_CONTROL_TPR_DIS BIT10
+#define MSR_CORE_THREAD_COUNT 0x00000035
+#define N_CORE_COUNT_OFFSET 16
+#define B_THREAD_COUNT_MASK 0xFFFF
+#define MSR_SOCKET_ID_MSR 0x00000039
+#define MSR_IA32_FEATURE_CONTROL 0x0000003A
+#define B_MSR_IA32_FEATURE_CONTROL_LOCK BIT0
+#define B_MSR_IA32_FEATURE_CONTROL_ELT BIT1
+#define B_MSR_IA32_FEATURE_CONTROL_EVT BIT2
+#define B_MSR_IA32_FEATURE_CONTROL_SLFE (BIT8 | BIT9 | BIT10 | BIT11 | BIT12 | BIT13 | BIT14)
+#define B_MSR_IA32_FEATURE_CONTROL_SGE BIT15
+#define MSR_IA32_SMM_SAVE_CONTROL 0x0000003E
+#define B_MSR_IA32_SMM_SAVE_CONTROL_SFPPE BIT0
+#define MSR_IA32_BIOS_UPDT_TRIG 0x00000079
+#define MSR_IA32_BIOS_SIGN_ID 0x0000008B
+#define MSR_IA32_SMM_MONITOR_CONTROL 0x0000009B
+#define MSR_IA32_PMC0_MSR 0x000000C1
+#define MSR_IA32_PMC1_MSR 0x000000C2
+#define MSR_IA32_PMC2_MSR 0x000000C3
+#define MSR_IA32_PMC3_MSR 0x000000C4
+#define MSR_IA32_PMC4_MSR 0x000000C5
+#define MSR_IA32_PMC5_MSR 0x000000C6
+#define MSR_IA32_PMC6_MSR 0x000000C7
+#define MSR_IA32_PMC7_MSR 0x000000C8
+#define MSR_PLATFORM_INFO 0x000000CE
+#define N_PLATFORM_INFO_MIN_RATIO 40
+#define B_PLATFORM_INFO_RATIO_MASK 0xFF
+#define N_PLATFORM_INFO_MAX_RATIO 8
+#define B_MSR_PLATFORM_INFO_PFAT_AVAIL BIT35
+#define N_MSR_PLATFORM_INFO_CONFIG_TDP_NUM_LEVELS_OFFSET 33
+#define V_CONFIG_TDP_NUM_LEVELS_MASK (BIT34 | BIT33)
+#define B_PLATFORM_INFO_TDC_TDP_LIMIT BIT29
+#define N_PLATFORM_INFO_RATIO_LIMIT 28
+#define B_PLATFORM_INFO_RATIO_LIMIT BIT28
+#define B_FIVR_RFI_TUNING_AVAIL BIT25
+#define B_PLATFORM_INFO_SMM_SAVE_CONTROL BIT16
+#define N_PLATFORM_INFO_PROG_TCC_ACTIVATION_OFFSET 30
+#define B_PLATFORM_INFO_PROG_TCC_ACTIVATION_OFFSET BIT30
+#define B_PLATFORM_INFO_TIMED_MWAIT_SUPPORTED BIT37
+#define MSR_PMG_CST_CONFIG 0x000000E2
+#define B_CST_CONTROL_LOCK BIT15
+#define B_IO_MWAIT_REDIRECTION_ENABLE BIT10
+#define B_TIMED_MWAIT_ENABLE BIT31
+#define B_PACKAGE_C_STATE_LIMIT (BIT3 | BIT2 | BIT1 | BIT0)
+#define V_CSTATE_LIMIT_C1 0x01
+#define V_CSTATE_LIMIT_C3 0x02
+#define V_CSTATE_LIMIT_C6 0x03
+#define V_CSTATE_LIMIT_C7 0x04
+#define V_CSTATE_LIMIT_C7S 0x05
+#define V_CSTATE_LIMIT_C8 0x06
+#define V_CSTATE_LIMIT_C9 0x07
+#define V_CSTATE_LIMIT_C10 0x08
+#define B_C3_AUTO_DEMOTION_ENABLE BIT25
+#define B_C1_AUTO_DEMOTION_ENABLE BIT26
+#define B_C3_AUTO_UNDEMOTION_ENABLE BIT27
+#define B_C1_AUTO_UNDEMOTION_ENABLE BIT28
+#define B_PKG_CSTATE_DEMOTION_ENABLE BIT29
+#define B_PKG_CSTATE_UNDEMOTION_ENABLE BIT30
+#define MSR_RFI_TUNNING 0x000000E3
+#define V_FREQ_TUNNING_MASK 0xFFFF
+#define MSR_PMG_IO_CAPTURE_BASE 0x000000E4
+#define B_MSR_PMG_CST_RANGE (BIT18 | BIT17 | BIT16)
+#define V_IO_CAPT_LVL2 (0x0 << 16) ///< C3
+#define V_IO_CAPT_LVL3 (0x1 << 16) ///< C6
+#define V_IO_CAPT_LVL4 (0x2 << 16) ///< C7
+#define V_IO_CAPT_LVL5 (0x3 << 16) ///< C8
+#define V_IO_CAPT_LVL6 (0x4 << 16) ///< C9
+#define V_IO_CAPT_LVL7 (0x5 << 16) ///< C10
+#define V_IO_CAPT_LVL2_BASE_ADDR_MASK 0xFFFF
+#define IA32_MTRR_CAP 0x000000FE
+#define B_IA32_MTRR_VARIABLE_SUPPORT 0xFF
+#define B_IA32_MTRR_CAP_FIXED_SUPPORT BIT8
+#define B_IA32_MTRR_CAP_SMRR_SUPPORT BIT11
+#define B_IA32_MTRR_CAP_EMRR_SUPPORT BIT12
+#define MSR_PLAT_FRMW_PROT_CTRL 0x00000110
+#define B_MSR_PLAT_FRMW_PROT_CTRL_LK BIT0
+#define B_MSR_PLAT_FRMW_PROT_CTRL_EN BIT1
+#define B_MSR_PLAT_FRMW_PROT_CTRL_S1 BIT2
+#define MSR_PLAT_FRMW_PROT_HASH_0 0x00000111
+#define MSR_PLAT_FRMW_PROT_HASH_1 0x00000112
+#define MSR_PLAT_FRMW_PROT_HASH_2 0x00000113
+#define MSR_PLAT_FRMW_PROT_HASH_3 0x00000114
+#define MSR_PLAT_FRMW_PROT_TRIG_PARAM 0x00000115
+#define N_MSR_PLAT_FRMW_PROT_TRIG_PARAM_STATUS_OFFSET 0
+#define V_MSR_PLAT_FRMW_PROT_TRIG_PARAM_STATUS_MASK 0x000000000000FFFF
+#define N_MSR_PLAT_FRMW_PROT_TRIG_PARAM_DATA_OFFSET 16
+#define V_MSR_PLAT_FRMW_PROT_TRIG_PARAM_DATA_MASK 0x000000000000FFFF
+#define N_MSR_PLAT_FRMW_PROT_TRIG_PARAM_TERMINAL_OFFSET 32
+#define V_MSR_PLAT_FRMW_PROT_TRIG_PARAM_TERMINAL_MASK 0x000000000000FFFF
+#define B_MSR_PLAT_FRMW_PROT_TRIG_PARAM_SE BIT62
+#define N_MSR_PLAT_FRMW_PROT_TRIG_PARAM_SE_OFFSET 62
+#define MSR_PLAT_FRMW_PROT_TRIGGER 0x00000116
+#define MSR_PLAT_FRMW_PROT_PASSWD 0x00000117
+#define MSR_SPCL_CHIPSET_USAGE_ADDR 0x000001FE
+#define MSR_IA32_FEATURE_CONFIG 0x0000013C
+#define B_IA32_FEATURE_CONFIG_AES_DIS BIT1
+#define B_IA32_FEATURE_CONFIG_LOCK BIT0
+#define IA32_MCG_CAP 0x00000179
+#define IA32_MCG_STATUS 0x0000017A
+#define MSR_FLEX_RATIO 0x00000194
+#define N_FLEX_RATIO 8
+#define B_FLEX_RATIO (0xFF << 8)
+#define B_FLEX_EN BIT16
+#define B_MAX_EXTRA_VOLTAGE 0xFF
+#define N_OVERCLOCKING_BINS 17
+#define B_OVERCLOCKING_BINS (0x7 << 17)
+#define B_OVERCLOCKING_LOCK BIT20
+#define RATIO_FLEX_CLEAR_MASK 0xFFFFFFFFFFFF00FFULL
+#define MSR_IA32_PERF_STS 0x00000198
+#define N_IA32_PERF_STSP_STATE_TARGET 8
+#define B_IA32_PERF_STSP_STATE_MASK 0xFF
+#define MSR_IA32_PERF_CTRL 0x00000199
+#define N_IA32_PERF_CTRLP_STATE_TARGET 8
+#define B_IA32_PERF_CTRLP_STATE_TARGET (0x7F << 8)
+#define B_IA32_PERF_CTRL_TURBO_DIS BIT32
+#define MSR_IA32_CLOCK_MODULATION 0x0000019A
+#define IA32_THERM_INTERRUPT 0x0000019B
+#define B_IA32_THERM_INTERRUPT_VIE BIT4
+#define MSR_IA32_THERM_STATUS 0x0000019C
+#define MSR_IA32_MISC_ENABLE 0x000001A0
+#define B_MSR_IA32_MISC_ENABLE_FSE BIT0
+#define B_MSR_IA32_MISC_ENABLE_TME BIT3
+#define N_MSR_IA32_MISC_ENABLE_EIST_OFFSET 16
+#define B_MSR_IA32_MISC_ENABLE_EIST BIT16
+#define B_MSR_IA32_MISC_ENABLE_MONITOR BIT18
+#define B_MSR_IA32_MISC_ENABLE_CPUID_MAX BIT22
+#define B_MSR_IA32_MISC_ENABLE_TPR_DIS BIT23
+#define B_MSR_IA32_MISC_ENABLE_XD BIT34
+#define B_MSR_IA32_MISC_DISABLE_TURBO BIT38
+#define MSR_TEMPERATURE_TARGET 0x000001A2
+#define N_MSR_TEMPERATURE_TARGET_TCC_OFFSET_LIMIT 24
+#define N_MSR_TEMPERATURE_TARGET_TCC_ACTIVATION_TEMPERATURE_OFFSET (16)
+#define B_MSR_TEMPERATURE_TARGET_TCC_ACTIVATION_TEMPERATURE_MASK (0xFF << 16)
+#define N_MSR_TEMPERATURE_TARGET_FAN_TEMP_TARGET_OFFSET 8
+#define B_MSR_TEMPERATURE_TARGET_FAN_TEMP_TARGET_OFFSET (0xFF << 8)
+#define MISC_FEATURE_CONTROL 0x000001A4
+#define B_MISC_FEATURE_CONTROL_MLC_STRP BIT0
+#define B_MISC_FEATURE_CONTROL_MLC_SPAP BIT1
+#define B_MISC_FEATURE_CONTROL_DCU_STRP BIT2
+#define B_MISC_FEATURE_CONTROL_DCU_IPP BIT3
+#define MSR_MISC_PWR_MGMT 0x000001AA
+#define B_MSR_MISC_PWR_MGMT_EIST_HW BIT0
+#define B_MSR_MISC_PWR_MGMT_LTMI BIT22
+#define MSR_TURBO_POWER_CURRENT_LIMIT 0x000001AC
+#define B_MSR_TURBO_POWER_CURRENT_LIMIT_TDC_EN BIT31
+#define N_MSR_TURBO_POWER_CURRENT_LIMIT_TDC_LIMIT 16
+#define B_MSR_TURBO_POWER_CURRENT_LIMIT_TDC_LIMIT (0x7F << 16)
+#define B_MSR_TURBO_POWER_CURRENT_LIMIT_TDP_EN BIT15
+#define N_MSR_TURBO_POWER_CURRENT_LIMIT_TDP_LIMIT 0
+#define B_MSR_TURBO_POWER_CURRENT_LIMIT_TDP_LIMIT (0x7F << 0)
+#define MSR_TURBO_RATIO_LIMIT 0x000001AD
+#define N_MSR_TURBO_RATIO_LIMIT_1C 0
+#define B_MSR_TURBO_RATIO_LIMIT_1C (0xFF << 0)
+#define N_MSR_TURBO_RATIO_LIMIT_2C 8
+#define B_MSR_TURBO_RATIO_LIMIT_2C (0xFF << 8)
+#define N_MSR_TURBO_RATIO_LIMIT_3C 16
+#define B_MSR_TURBO_RATIO_LIMIT_3C (0xFF << 16)
+#define N_MSR_TURBO_RATIO_LIMIT_4C 24
+#define B_MSR_TURBO_RATIO_LIMIT_4C (0xFF << 24)
+#define MSR_IA32_ENERGY_PERFORMANCE_BIAS 0x1B0
+#define B_ENERGY_POLICY_MASK 0xF
+#define MSR_IA32_PLATFORM_DCA_CAP 0x000001F8
+#define B_MSR_IA32_PLATFORM_DCA_CAP_TYPE0_EN BIT0
+#define MSR_IA32_CPU_DCA_CAP 0x000001F9
+#define B_MSR_IA32_CPU_DCA_CAP_TYPE0_SUP BIT0
+#define MSR_IA32_DCA_0_CAP 0x000001FA
+#define B_MSR_IA32_CPU_DCA_CAP_ENDID BIT11
+#define N_MSR_IA32_CPU_DCA_CAP_DELAY 13
+#define B_MSR_IA32_CPU_DCA_CAP_DELAY (BIT13 | BIT14 | BIT15 | BIT16)
+#define B_MSR_IA32_CPU_DCA_CAP_SW_LOCK BIT24
+#define B_MSR_IA32_CPU_DCA_CAP_SW_FLUSH BIT25
+#define B_MSR_IA32_CPU_DCA_CAP_HW_LOCK BIT26
+#define MSR_POWER_CTL 0x000001FC
+#define B_MSR_POWER_CTL_BROCHOT BIT0
+#define B_MSR_POWER_CTL_C1E BIT1
+#define B_ENERGY_EFFICIENT_P_STATE_FEATURE_ENABLE BIT18
+#define B_MSR_POWER_CTL_DISABLE_PHOT_OUT BIT21
+#define B_MSR_POWER_CTL_PROC_HOT_RESPONSE BIT22
+#define B_MSR_POWER_CTL_PROC_HOT_LOCK BIT23
+#define B_MSR_POWER_CTL_DISABLE_VR_THERMAL_ALERT BIT24
+#define B_MSR_POWER_CTL_CSTATE_PRE_WAKE_DISABLE BIT30
+#define MSR_FERR_CAPABILITIES 0x000001F1
+#define B_MSR_FERR_ENABLE BIT0
+#define MSR_VR_CURRENT_CONFIG 0x00000601
+#define B_CURRENT_LIMIT_LOCK BIT31
+#define B_CURRENT_LIMIT_MASK 0x1FFF
+#define MSR_VR_MISC_CONFIG 0x603
+#define N_MSR_VR_MISC_CONFIG_MIN_VID_OFFSET 24
+#define B_MSR_VR_MISC_CONFIG_MIN_VID_MASK 0xFF
+#define V_MSR_VR_MISC_CONFIG_MIN_VID_DEFAULT 0
+#define N_MSR_VR_MISC_CONFIG_IDLE_EXIT_RAMP_RATE_OFFSET 50
+#define B_MSR_VR_MISC_CONFIG_IDLE_EXIT_RAMP_RATE BIT50
+#define N_MSR_VR_MISC_CONFIG_IDLE_ENTRY_RAMP_RATE_OFFSET 51
+#define B_MSR_VR_MISC_CONFIG_IDLE_ENTRY_RAMP_RATE BIT51
+#define N_MSR_VR_MISC_CONFIG_IDLE_ENTRY_DECAY_ENABLE_OFFSET 52
+#define B_MSR_VR_MISC_CONFIG_IDLE_ENTRY_DECAY_ENABLE BIT52
+#define N_MSR_VR_MISC_CONFIG_SLOW_SLEW_RATE_CONFIG_OFFSET 53
+#define B_MSR_VR_MISC_CONFIG_SLOW_SLEW_RATE_CONFIG_MASK (BIT54 | BIT53)
+#define V_MSR_VR_MISC_CONFIG_SLOW_SLEW_RATE_CONFIG_DEFAULT 1
+#define V_MSR_VR_MISC_CONFIG_SLOW_SLEW_RATE_CONFIG_FAST_2 0
+#define V_MSR_VR_MISC_CONFIG_SLOW_SLEW_RATE_CONFIG_FAST_4 BIT53
+#define V_MSR_VR_MISC_CONFIG_SLOW_SLEW_RATE_CONFIG_FAST_8 BIT54
+#define V_MSR_VR_MISC_CONFIG_SLOW_SLEW_RATE_CONFIG_FAST_16 (BIT54 | BIT53)
+#define MSR_VR_MISC_CONFIG2 0x636
+#define N_MSR_VR_MISC_CONFIG2_FAST_RAMP_VOLTAGE_OFFSET 0
+#define B_MSR_VR_MISC_CONFIG2_FAST_RAMP_VOLTAGE_MASK 0xFF
+#define V_MSR_VR_MISC_CONFIG2_FAST_RAMP_VOLTAGE_DEFAULT 0x6F
+#define N_MSR_VR_MISC_CONFIG2_MIN_C8_VOLTAGE_OFFSET 8
+#define B_MSR_VR_MISC_CONFIG2_MIN_C8_VOLTAGE_MASK 0xFF
+#define V_MSR_VR_MISC_CONFIG2_MIN_C8_VOLTAGE_DEFAULT 0
+#define MSR_PACKAGE_POWER_SKU_UNIT 0x606
+#define PACKAGE_POWER_UNIT_MASK 0xF
+#define PACKAGE_TIME_UNIT_MASK 0xF0000
+#define MSR_C_STATE_LATENCY_CONTROL_0 0x60A
+#define MSR_C_STATE_LATENCY_CONTROL_1 0x60B
+#define MSR_C_STATE_LATENCY_CONTROL_2 0x60C
+#define MSR_C_STATE_LATENCY_CONTROL_3 0x633
+#define MSR_C_STATE_LATENCY_CONTROL_4 0x634
+#define MSR_C_STATE_LATENCY_CONTROL_5 0x635
+#define B_PKG_IRTL_VALID BIT15
+#define B_INTERRUPT_RESPONSE_TIME_LIMIT_MASK 0x3FF
+#define B_TIME_UNIT_MASK (0x7 << 10)
+#define N_TIME_UNIT_OFFSET 10
+#define MSR_PACKAGE_POWER_LIMIT 0x610
+#define MSR_PACKAGE_POWER_SKU 0x614
+#define B_POWER_LIMIT_ENABLE BIT15
+#define B_CRITICAL_POWER_CLAMP_ENABLE BIT16
+#define B_POWER_LIMIT_LOCK BIT31
+#define POWER_LIMIT_MASK (0x7FFF)
+#define POWER_LIMIT_1_TIME_MASK (0xFE0000)
+#define PACKAGE_TDP_POWER_MASK (0x7FFF)
+#define PACKAGE_MIN_POWER_MASK (0x7FFF0000)
+#define PACKAGE_MAX_POWER_MASK (0x7FFF)
+#define MSR_PLATFORM_POWER_LIMIT 0x615
+#define POWER_LIMIT_3_TIME_MASK (0xFE0000)
+#define POWER_LIMIT_3_DUTY_CYCLE_MASK (0x7F000000)
+#define MSR_DDR_RAPL_LIMIT 0x618
+#define MSR_RING_RATIO_LIMIT 0x620
+#define MSR_MAX_RING_RATIO_LIMIT_MASK 0x7F
+#define MSR_CONFIG_TDP_NOMINAL 0x648
+#define CONFIG_TDP_NOMINAL_RATIO_MASK 0xFF
+#define MSR_CONFIG_TDP_LVL1 0x649
+#define CONFIG_TDP_LVL1_RATIO_OFFSET 16
+#define CONFIG_TDP_LVL1_RATIO_MASK (0xFF << 16)
+#define CONFIG_TDP_LVL1_PKG_TDP_MASK (0x7FFF)
+#define MSR_CONFIG_TDP_LVL2 0x64A
+#define CONFIG_TDP_LVL2_RATIO_OFFSET 16
+#define CONFIG_TDP_LVL2_RATIO_MASK (0xFF << 16)
+#define CONFIG_TDP_LVL2_PKG_TDP_MASK (0x7FFF)
+#define MSR_CONFIG_TDP_CONTROL 0x64B
+#define CONFIG_TDP_CONTROL_LOCK (1 << 31)
+#define CONFIG_TDP_CONTROL_LVL_MASK 0x3
+#define CONFIG_TDP_NOMINAL 0
+#define CONFIG_TDP_LEVEL1 1
+#define CONFIG_TDP_LEVEL2 2
+#define MSR_TURBO_ACTIVATION_RATIO 0x64C
+#define MSR_TURBO_ACTIVATION_RATIO_LOCK (1 << 31)
+#define MSR_TURBO_ACTIVATION_RATIO_MASK 0xFF
+#define SMRR_PHYS_BASE 0x000001F2
+#define SMRR_PHYS_MASK 0x000001F3
+#define EMRR_PHYS_BASE 0x000001F4
+#define EMRR_PHYS_MASK 0x000001F5
+#define B_MSR_EMRR_PHYS_MASK_EN BIT11
+#define B_MSR_EMRR_PHYS_MASK_LOCK BIT10
+#define V_MAXIMUM_VARIABLE_MTRR_NUMBER 10
+#define CACHE_VARIABLE_MTRR_BASE 0x00000200
+#define V_FIXED_MTRR_NUMBER 11
+#define IA32_MTRR_FIX64K_00000 0x00000250
+#define IA32_MTRR_FIX16K_80000 0x00000258
+#define IA32_MTRR_FIX16K_A0000 0x00000259
+#define IA32_MTRR_FIX4K_C0000 0x00000268
+#define IA32_MTRR_FIX4K_C8000 0x00000269
+#define IA32_MTRR_FIX4K_D0000 0x0000026A
+#define IA32_MTRR_FIX4K_D8000 0x0000026B
+#define IA32_MTRR_FIX4K_E0000 0x0000026C
+#define IA32_MTRR_FIX4K_E8000 0x0000026D
+#define IA32_MTRR_FIX4K_F0000 0x0000026E
+#define IA32_MTRR_FIX4K_F8000 0x0000026F
+#define MSR_IA32_CR_PAT 0x00000277
+#define CACHE_IA32_MTRR_DEF_TYPE 0x000002FF
+#define B_CACHE_MTRR_VALID BIT11
+#define B_CACHE_FIXED_MTRR_VALID BIT10
+#define NO_EVICT_MODE 0x000002E0
+#define B_NO_EVICT_MODE_SETUP BIT0
+#define B_NO_EVICT_MODE_RUN BIT1
+#define UNCORE_CR_MEMLOCK_COMMANDS 0x000002E2
+#define B_LOCK_MEM_CFG BIT1
+#define EFI_PCIEXBAR 0x00000300
+#define B_PCIEXBAR_EN BIT0
+#define B_PCIEXBAR_SIZE (BIT1 | BIT2 | BIT3)
+#define N_PCIEXBAR_SIZE 1
+#define IA32_MC0_CTL 0x00000400
+#define IA32_MC0_STATUS 0x00000401
+#define IA32_MC0_ADDR 0x00000402
+#define IA32_MC0_MISC 0x00000403
+#define IA32_MC8_CTL (IA32_MC0_CTL + (8 * 4))
+#define IA32_MC5_STATUS (IA32_MC0_STATUS + (5 * 4))
+#define IA32_MC6_STATUS (IA32_MC0_STATUS + (6 * 4))
+#define IA32_MC7_STATUS (IA32_MC0_STATUS + (7 * 4))
+#define IA32_MC8_STATUS (IA32_MC0_STATUS + (8 * 4))
+#define MSR_IA32_VMX_BASIC 0x00000480
+#define MSR_IA32_VMX_MISC 0x00000485
+#define APIC_GLOBAL_ENABLE 0x00000800
+#define EXT_XAPIC_LOGICAL_APIC_ID 0x00000802
+#define EXT_XAPIC_VERSION 0x00000803
+#define EXT_XAPIC_SVR 0x0000080F
+#define EXT_XAPIC_ICR 0x00000830
+#define MSR_EXT_XAPIC_LVT_THERM 0x00000833
+#define EXT_XAPIC_LVT_LINT0 0x00000835
+#define EXT_XAPIC_LVT_LINT1 0x00000836
+#define MSR_IA32_DEBUG_INTERFACE 0x00000C80
+#define B_DEBUG_INTERFACE_ENABLE BIT0
+#define B_DEBUG_INTERFACE_LOCK BIT30
+#define B_DEBUG_INTERFACE_DEBUG_STATUS BIT31
+#define NUM_TENTHS_TO_PERCENTAGE 1000
+#define FIVR_SSC_LOCK_BIT BIT31
+#define MAX_FIVR_SSC_PERCENT 70
+//
+// MSRs for SMM State Save Register
+//
+#define MSR_SMM_MCA_CAP 0x17D
+#define B_TARGETED_SMI BIT56
+#define N_TARGETED_SMI 56
+#define B_SMM_CPU_SVRSTR BIT57
+#define N_SMM_CPU_SVRSTR 57
+#define B_SMM_CODE_ACCESS_CHK BIT58
+#define N_SMM_CODE_ACCESS_CHK 58
+#define B_LONG_FLOW_INDICATION BIT59
+#define N_LONG_FLOW_INDICATION 59
+#define MSR_SMM_FEATURE_CONTROL 0x4E0
+#define B_SMM_FEATURE_CONTROL_LOCK BIT0
+#define B_SMM_CPU_SAVE_EN BIT1
+#define B_SMM_CODE_CHK_EN BIT2
+#define MSR_SMM_ENABLE 0x4E1
+#define MSR_SMM_DELAYED 0x4E2
+#define MSR_SMM_BLOCKED 0x4E3
+#define MSR_CR0 0xC00
+#define MSR_CR3 0xC01
+#define MSR_EFLAGS 0xC02
+#define MSR_RIP 0xC04
+#define MSR_DR6 0xC05
+#define MSR_DR7 0xC06
+#define MSR_TR_LDTR 0xC07
+#define MSR_GS_FS 0xC08
+#define MSR_DS_SS 0xC09
+#define MSR_CS_ES 0xC0A
+#define MSR_IO_MISC_INFO 0xC0B
+#define MSR_IO_MEM_ADDR 0xC0C
+#define MSR_RDI 0xC0D
+#define MSR_RSI 0xC0E
+#define MSR_RBP 0xC0F
+#define MSR_RSP 0xC10
+#define MSR_RBX 0xC11
+#define MSR_RDX 0xC12
+#define MSR_RCX 0xC13
+#define MSR_RAX 0xC14
+#define MSR_R8 0xC15
+#define MSR_R9 0xC16
+#define MSR_R10 0xC17
+#define MSR_R11 0xC18
+#define MSR_R12 0xC19
+#define MSR_R13 0xC1A
+#define MSR_R14 0xC1B
+#define MSR_R15 0xC1C
+#define MSR_EVENT_CTL_HLT_IO 0xC1F
+#define MSR_SMBASE 0xC20
+#define MSR_SMM_REVID 0xC21
+#define MSR_IEDBASE 0xC22
+#define MSR_EPTP_ENABLE 0xC23
+#define MSR_EPTP 0xC24
+#define MSR_LDTR_BASE 0xC2C
+#define MSR_IDTR_BASE 0xC2D
+#define MSR_GDTR_BASE 0xC2E
+#define MSR_CR4 0xC37
+#define MSR_IO_RSI 0xC40
+#define MSR_IO_RCX 0xC41
+#define MSR_IO_RIP 0xC42
+#define MSR_IO_RDI 0xC43
+#define MSR_BC_PBEC 0x139
+#define B_STOP_PBET BIT0
+
+#define MSR_BOOT_GUARD_SACM_INFO 0x13A
+#define B_NEM_INIT BIT0
+#define V_TPM_PRESENT_MASK 0x06
+#define V_TPM_PRESENT_NO_TPM 0
+#define V_TPM_PRESENT_DTPM_12 1
+#define V_TPM_PRESENT_DTPM_20 2
+#define V_TPM_PRESENT_PTT 3
+#define B_TPM_SUCCESS BIT3
+#define B_MEASURED BIT5
+#define B_VERIFIED BIT6
+#define TXT_PUBLIC_BASE 0xFED30000
+#define R_CPU_BOOT_GUARD_ERRORCODE 0x30
+#define R_CPU_BOOT_GUARD_BOOTSTATUS 0xA0
+#define R_CPU_BOOT_GUARD_ACM_STATUS 0x328
+#define V_CPU_BOOT_GUARD_LOAD_ACM_SUCCESS 0x8000000000000000
+#define B_BOOT_GUARD_ACM_ERRORCODE_MASK 0x00007FF0
+
+//
+// Processor Definitions
+//
+#define CPUID_FULL_STEPPING 0x0000000F
+#define CPUID_FULL_FAMILY_MODEL 0x0FFF0FF0
+#define CPUID_FULL_FAMILY_MODEL_STEPPING 0x0FFF0FFF
+#define CPUID_FULL_FAMILY_MODEL_HASWELL 0x000306C0
+#define CPUID_FULL_FAMILY_MODEL_HASWELL_ULT 0x00040650
+#define CPUID_FULL_FAMILY_MODEL_CRYSTALWELL 0x00040660
+
+#define CPUID_PROCESSOR_TOPOLOGY 0xB
+
+typedef enum {
+ EnumCpuHsw = CPUID_FULL_FAMILY_MODEL_HASWELL,
+ EnumCpuHswUlt = CPUID_FULL_FAMILY_MODEL_HASWELL_ULT,
+ EnumCpuCrw = CPUID_FULL_FAMILY_MODEL_CRYSTALWELL,
+ EnumCpuMax = CPUID_FULL_FAMILY_MODEL
+} CPU_FAMILY;
+
+typedef enum {
+ ///
+ /// Haswell Family Stepping
+ ///
+ EnumHswA0 = 1,
+ EnumHswB0,
+ EnumHswC0,
+ EnumHswD0,
+ ///
+ /// Haswell ULT Family Stepping
+ ///
+ EnumHswUltB0 = 0,
+ EnumHswUltC0,
+ ///
+ /// Crystalwell Family Stepping
+ ///
+ EnumCrwB0 = 0,
+ EnumCrwC0,
+ EnumCrwD0,
+ ///
+ /// Max Stepping
+ ///
+ EnumCpuSteppingMax = CPUID_FULL_STEPPING
+} CPU_STEPPING;
+
+typedef enum {
+ EnumCpuUlt = 0,
+ EnumCpuTrad,
+ EnumCpuUnknown
+} CPU_SKU;
+
+#endif
diff --git a/ReferenceCode/Haswell/Include/IntelCpuDxe.dsc b/ReferenceCode/Haswell/Include/IntelCpuDxe.dsc
new file mode 100644
index 0000000..29cd9a0
--- /dev/null
+++ b/ReferenceCode/Haswell/Include/IntelCpuDxe.dsc
@@ -0,0 +1,53 @@
+## @file
+# Build description file for building the Intel CPU DXE drivers
+#
+#@copyright
+# Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+#
+# CpuInit DXE drivers
+#
+$(PROJECT_CPU_ROOT)\CpuInit\Dxe\CpuInitDxe.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+
+#
+# DTS SMM drivers
+#
+$(PROJECT_CPU_ROOT)\Dts\Smm\DigitalThermalSensorSmm.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+
+#
+# PFAT SMM drivers
+#
+$(PROJECT_CPU_ROOT)\Pfat\Smm\PfatServices.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+
+#
+# Power Management Drivers
+#
+$(PROJECT_CPU_ROOT)\PowerManagement\Dxe\PowerMgmtDxe.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_CPU_ROOT)\PowerManagement\Smm\PowerMgmtS3.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_CPU_ROOT)\PowerManagement\AcpiTables\PowerMgmtAcpiTables.inf
+
+#
+# TxT drivers
+#
+$(PROJECT_CPU_ROOT)\Txt\TxtInit\Dxe\TxtDxe.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+
+#
+# Sample drivers
+#
+$(PROJECT_CPU_ROOT)\SampleCode\SmramSaveInfoHandlerSmm\SmramSaveInfoHandlerSmm.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_CPU_ROOT)\SampleCode\TxtOneTouch\Dxe\TxtOneTouchDxe.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_CPU_ROOT)\SampleCode\SmmThunk\Smm\SmmThunk.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+
diff --git a/ReferenceCode/Haswell/Include/IntelCpuDxeLib.dsc b/ReferenceCode/Haswell/Include/IntelCpuDxeLib.dsc
new file mode 100644
index 0000000..3f3faba
--- /dev/null
+++ b/ReferenceCode/Haswell/Include/IntelCpuDxeLib.dsc
@@ -0,0 +1,41 @@
+## @file
+# Build description file for building the CPU DXE libraries
+#
+#@copyright
+# Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+#
+# CPU DXE Libraries
+#
+$(PROJECT_CPU_ROOT)\Protocol\CpuProtocolLib.inf
+$(PROJECT_CPU_ROOT)\Guid\CpuGuidLib.inf
+$(PROJECT_CPU_ROOT)\Library\Thunklib\Thunklib.inf
+$(PROJECT_CPU_ROOT)\Library\CpuPlatformLib\CpuPlatformLib.inf
+$(PROJECT_CPU_ROOT)\Library\BootGuardLib\BootGuardLib.inf
+
+#
+# DTS DXE Libraries
+#
+$(PROJECT_CPU_ROOT)\SampleCode\Library\SmmIo\SmmIoLib.inf
+$(PROJECT_CPU_ROOT)\SampleCode\Library\AslUpdate\Dxe\DxeAslUpdateLib.inf
+$(PROJECT_CPU_ROOT)\SampleCode\Library\DTSHookLib\Smm\DTSHookLib.inf
+$(PROJECT_CPU_ROOT)\SampleCode\Library\Ksc\Smm\SmmKscLib.inf
+
+#
+# Sample Code
+#
+$(PROJECT_CPU_ROOT)\SampleCode\Protocol\CpuSampleProtocolLib.inf
+$(PROJECT_CPU_ROOT)\SampleCode\Library\BootGuardRevocationLib\Dxe\BootGuardRevocationLib.inf \ No newline at end of file
diff --git a/ReferenceCode/Haswell/Include/IntelCpuPei.dsc b/ReferenceCode/Haswell/Include/IntelCpuPei.dsc
new file mode 100644
index 0000000..98e0c7e
--- /dev/null
+++ b/ReferenceCode/Haswell/Include/IntelCpuPei.dsc
@@ -0,0 +1,35 @@
+## @file
+# Build description file for building the CPU PEI modules
+#
+#@copyright
+# Copyright (c) 2008 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+#
+# PEI module produce CPU PPI
+#
+$(PROJECT_CPU_ROOT)\CpuInit\Pei\CpuInitPeim.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_CPU_ROOT)\CpuS3\Pei\CpuS3Peim.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+
+#
+# TxT Drivers
+#
+$(PROJECT_CPU_ROOT)\Txt\TxtInit\Pei\TxtPei.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_CPU_ROOT)\Txt\TxtInit\Pei\Ia32\TxtPeiApV7.inf
+# $(PROJECT_CPU_ROOT)\Txt\BiosAcm\TxtBiosAcm.inf
+
+#
+# Sample drivers
+#
diff --git a/ReferenceCode/Haswell/Include/IntelCpuPeiLib.dsc b/ReferenceCode/Haswell/Include/IntelCpuPeiLib.dsc
new file mode 100644
index 0000000..a5475e9
--- /dev/null
+++ b/ReferenceCode/Haswell/Include/IntelCpuPeiLib.dsc
@@ -0,0 +1,30 @@
+## @file
+# Build description file for building the CPU PEI Libraries
+#
+#@copyright
+# Copyright (c) 2011 - 2013 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+#
+# CPU PEI libraries
+#
+$(PROJECT_CPU_ROOT)\Ppi\CpuPpiLib.inf
+$(PROJECT_CPU_ROOT)\Guid\CpuGuidLib.inf
+$(PROJECT_CPU_ROOT)\Library\Thunklib\Thunklib.inf
+$(PROJECT_CPU_ROOT)\Library\CpuPlatformLib\CpuPlatformLib.inf
+$(PROJECT_CPU_ROOT)\Library\OverclockingLib\OverClockingLib.inf
+$(PROJECT_CPU_ROOT)\Library\TxtLib\TxtLib.inf
+$(PROJECT_CPU_ROOT)\SampleCode\Library\Ksc\Pei\PeiKscLib.inf
+$(PROJECT_CPU_ROOT)\Library\BootGuardLib\BootGuardLib.inf \ No newline at end of file
diff --git a/ReferenceCode/Haswell/Include/Library/BootGuardLibrary.h b/ReferenceCode/Haswell/Include/Library/BootGuardLibrary.h
new file mode 100644
index 0000000..e6bfbcc
--- /dev/null
+++ b/ReferenceCode/Haswell/Include/Library/BootGuardLibrary.h
@@ -0,0 +1,46 @@
+/** @file
+ Header file for Boot Guard Lib implementation.
+
+@copyright
+ Copyright (c) 2012 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _BOOT_GUARD_LIBRARY_H_
+#define _BOOT_GUARD_LIBRARY_H_
+
+/**
+ Determine if Boot Guard is supported
+
+ @retval TRUE - Processor is Boot Guard capable.
+ @retval FALSE - Processor is not Boot Guard capable.
+
+**/
+BOOLEAN
+IsBootGuardSupported (
+ VOID
+ );
+
+/**
+ Stop PBE timer if system is in Boot Guard boot
+
+ @retval EFI_SUCCESS - Stop PBE timer
+ @retval EFI_UNSUPPORTED - Not in Boot GuardSupport mode.
+**/
+EFI_STATUS
+StopPbeTimer (
+ VOID
+ );
+#endif
diff --git a/ReferenceCode/Haswell/Include/Library/CpuPlatformLib.h b/ReferenceCode/Haswell/Include/Library/CpuPlatformLib.h
new file mode 100644
index 0000000..99b349f
--- /dev/null
+++ b/ReferenceCode/Haswell/Include/Library/CpuPlatformLib.h
@@ -0,0 +1,221 @@
+/** @file
+ Header file for CpuPlatform Lib.
+
+@copyright
+ Copyright (c) 2012 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _CPU_PLATFORM_LIB_H_
+#define _CPU_PLATFORM_LIB_H_
+
+/**
+ Check CPU Type of the platform
+
+ @retval CPU_FAMILY CPU type
+**/
+CPU_FAMILY
+EFIAPI
+GetCpuFamily (
+ VOID
+ );
+
+/**
+ Return Cpu stepping type
+
+ @retval CPU_STEPPING Cpu stepping type
+**/
+CPU_STEPPING
+EFIAPI
+GetCpuStepping (
+ VOID
+ );
+
+/**
+ Determine if CPU is supported
+
+ @retval TRUE CPU is supported
+ @retval FALSE CPU is not supported
+**/
+BOOLEAN
+IsCpuSupported (
+ VOID
+ );
+
+/**
+ Return CPU Sku
+
+ @retval UINT8 CPU Sku
+**/
+UINT8
+EFIAPI
+GetCpuSku (
+ VOID
+ );
+
+//
+// Mailbox Related Definitions
+//
+#define MAILBOX_TYPE_PCODE 0x00000001
+#define MAILBOX_TYPE_OC 0x00000002
+#define PCODE_MAILBOX_INTERFACE_OFFSET 0x5DA4
+#define PCODE_MAILBOX_DATA_OFFSET 0x5DA0
+#define OC_MAILBOX_MSR 0x00000150
+#define MCHBAR_OFFSET 0x48
+
+//
+// Mailbox commands
+//
+#define READ_ICC_MAX_CMD 0x80002A03
+#define SAMPLE_TSC_24AND100_CMD 0x80000009
+#define READ_TSC24_LOWER_CMD 0x80000109
+#define READ_TSC24_UPPER_CMD 0x80000209
+#define READ_TSC100_LOWER_CMD 0x80000309
+#define READ_TSC100_UPPER_CMD 0x80000409
+#define READ_PCODE_CALIBRATED_CMD 0x80000509
+#define WRITE_CONVERTION_RATIO_CMD 0x80000609
+#define WRITE_PREVENT_BCLKOFF_CMD 0x80000709
+#define WRITE_MEASURE_INTERVAL_CMD 0x80000809
+#define WRITE_FSM_MEASURE_INTVL_CMD 0x80000909
+#define START_CAL_VALUE 0x85000000
+#define READ_PL1_DUTY_CYCLE_CLAMP_ENABLE 0x00000015
+#define WRITE_PL1_DUTY_CYCLE_CLAMP_ENABLE 0x00000016
+#define READ_DDR_FORCE_2X_REFRESH 0x00000017
+#define WRITE_DDR_FORCE_2X_REFRESH 0x00000018
+
+#ifndef MAILBOX_WAIT_TIMEOUT
+#define MAILBOX_WAIT_TIMEOUT 1000 ///< 1 millisecond
+#endif
+#ifndef MAILBOX_WAIT_STALL
+#define MAILBOX_WAIT_STALL 1 ///< 1 microsecond
+#endif
+#ifndef MAILBOX_READ_TIMEOUT
+#define MAILBOX_READ_TIMEOUT 10 ///< 10 microseconds
+#endif
+
+//
+// OC Mailbox Structures
+//
+typedef union _OC_MAILBOX_INTERFACE {
+ UINT32 InterfaceData;
+ struct {
+ UINT8 CommandCompletion : 8;
+ UINT8 Param1 : 8;
+ UINT8 Param2 : 8;
+ UINT8 Reserved : 7;
+ UINT8 RunBusy : 1;
+ } Fields;
+} OC_MAILBOX_INTERFACE;
+
+typedef struct _OC_MAILBOX_FULL {
+ UINT32 Data;
+ OC_MAILBOX_INTERFACE Interface;
+} OC_MAILBOX_FULL;
+
+//
+// OC Mailbox completion codes
+//
+#define OC_MAILBOX_CC_SUCCESS 0
+#define OC_MAILBOX_CC_OC_LOCKED 1
+#define OC_MAILBOX_CC_INVALID_DOMAIN 2
+#define OC_MAILBOX_CC_MAX_RATIO_EXCEEDED 3
+#define OC_MAILBOX_CC_MAX_VOLTAGE_EXCEEDED 4
+#define OC_MAILBOX_CC_OC_NOT_SUPPORTED 5
+
+//
+// PCODE Mailbox Structures
+//
+typedef union _PCODE_MAILBOX_INTERFACE {
+ UINT32 InterfaceData;
+ struct {
+ UINT32 Command : 8;
+ UINT32 Address : 21;
+ UINT32 Reserved : 2;
+ UINT32 RunBusy : 1;
+ } Fields;
+} PCODE_MAILBOX_INTERFACE;
+
+typedef struct _PCODE_MAILBOX_FULL {
+ PCODE_MAILBOX_INTERFACE Interface;
+ UINT32 Data;
+} PCODE_MAILBOX_FULL;
+
+//
+// Pcode Mailbox completion codes
+//
+#define PCODE_MAILBOX_CC_SUCCESS 0
+#define PCODE_MAILBOX_CC_ILLEGAL_CMD 1
+#define PCODE_MAILBOX_CC_TIMEOUT 2
+#define PCODE_MAILBOX_CC_ILLEGAL_DATA 3
+#define PCODE_MAILBOX_CC_RESERVED 4
+#define PCODE_MAILBOX_CC_ILLEGAL_VR_ID 5
+#define PCODE_MAILBOX_CC_VR_INTERFACE_LOCKED 6
+#define PCODE_MAILBOX_CC_VR_ERROR 7
+
+#define READ_PCH_POWER_LEVELS_CMD 0x8000000A
+#define READ_EXT_PCH_POWER_LEVELS_CMD 0x8000000B
+
+EFI_STATUS
+EFIAPI MailboxWrite (
+ IN UINT32 MailboxType,
+ IN UINT32 MailboxCommand,
+ IN UINT32 MailboxData,
+ OUT UINT32 *MailboxStatus
+ )
+/**
+ Generic Mailbox function for mailbox write commands. This function will
+ poll the mailbox interface for control, issue the write request, poll
+ for completion, and verify the write was succussful.
+
+ @param[IN] MailboxType,
+ @param[IN] MailboxCommand,
+ @param[IN] MailboxData,
+ @param[OUT] *MailboxStatus
+
+ @retval EFI_STATUS
+**/
+;
+
+EFI_STATUS
+EFIAPI MailboxRead (
+ IN UINT32 MailboxType,
+ IN UINT32 MailboxCommand,
+ OUT UINT32 *MailboxDataPtr,
+ OUT UINT32 *MailboxStatus
+ )
+/**
+ Generic Mailbox function for mailbox read commands. This function will write
+ the read request, and populate the read results in the output data.
+
+ @param[IN] MailboxType,
+ @param[IN] MailboxCommand,
+ @param[OUT] *MailboxDataPtr,
+ @param[OUT] *MailboxStatus
+
+ @retval EFI_STATUS
+**/
+;
+
+EFI_STATUS
+EFIAPI PollMailboxReady (
+ IN UINT32 MailboxType
+ )
+/**
+ Poll the run/busy bit of the mailbox until available or timeout expires.
+
+ @param[IN] MailboxType,
+
+ @retval EFI_STATUS
+**/
+;
+#endif
diff --git a/ReferenceCode/Haswell/Include/Library/TxtLibrary.h b/ReferenceCode/Haswell/Include/Library/TxtLibrary.h
new file mode 100644
index 0000000..b3f70de
--- /dev/null
+++ b/ReferenceCode/Haswell/Include/Library/TxtLibrary.h
@@ -0,0 +1,44 @@
+/**
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement.
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+@file
+ TxtLibrary.h
+
+@brief
+ Header file for TXT Lib implementation.
+
+**/
+#ifndef _TXT_LIBRARY_H_
+#define _TXT_LIBRARY_H_
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueBase.h"
+#endif
+
+UINT32
+CheckSmxCapabilities (
+ VOID
+ )
+/**
+
+ Execute GETSEC[CAPABILITIES] to report the SMX capabilities
+
+**/
+;
+
+#endif
diff --git a/ReferenceCode/Haswell/Include/PfatDefinitions.h b/ReferenceCode/Haswell/Include/PfatDefinitions.h
new file mode 100644
index 0000000..ff1ec9d
--- /dev/null
+++ b/ReferenceCode/Haswell/Include/PfatDefinitions.h
@@ -0,0 +1,328 @@
+/** @file
+ Describes the functions visible to the rest of the PFAT.
+
+@copyright
+ Copyright (c) 2011 - 2014 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PFAT_DEFINITIONS_H_
+#define _PFAT_DEFINITIONS_H_
+
+#ifndef ALIGN_256KB
+#define ALIGN_256KB 0x00040000
+#endif
+#ifndef EFI_PAGE_SIZE
+#define EFI_PAGE_SIZE 0x00001000
+#endif
+
+///
+/// PFAT Module Commands
+///
+#define PFAT_COMMAND_NOP 0x00 ///< NOP
+#define PFAT_COMMAND_BEGIN 0x01 ///< PFAT Begin
+#define PFAT_COMMAND_WRITE_INDEX 0x10 ///< PFAT Write Index
+#define PFAT_COMMAND_WRITE_IMM 0x11 ///< PFAT Write Immediate
+#define PFAT_COMMAND_READ_INDEX 0x12 ///< PFAT Read Index
+#define PFAT_COMMAND_READ_IMM 0x13 ///< PFAT Read Immediate
+#define PFAT_COMMAND_ERASE_BLK 0x14 ///< PFAT Erase Block
+#define PFAT_COMMAND_EC_CMD_WR_INDEX 0x20 ///< EC_CMD Write Index
+#define PFAT_COMMAND_EC_CMD_WR_IMM 0x21 ///< EC_CMD Write Immediate
+#define PFAT_COMMAND_EC_STS_RD 0x22 ///< EC_CMD Read Status
+#define PFAT_COMMAND_EC_DATA_WR_INDEX 0x23 ///< EC_DATA Write Index
+#define PFAT_COMMAND_EC_DATA_WR_IMM 0x24 ///< EC_DATA Write Immediate
+#define PFAT_COMMAND_EC_DATA_RD 0x25 ///< EC_DATA Read
+#define PFAT_COMMAND_SET_BUFFER_INDEX 0x53 ///< PFAT Set Buffer Index
+#define PFAT_COMMAND_SET_FLASH_INDEX 0x55 ///< PFAT Set Flash Index
+#define PFAT_COMMAND_END 0xFF ///< PFAT End
+
+///
+/// PFAT Module Error Codes
+///
+#define ERR_OK 0x0000 ///< Operation completed without error
+#define ERR_UNSUPPORTED_CPU 0x0001 ///< PFAT module detected an incompatibility with the installed CPU
+#define ERR_BAD_DIRECTORY 0x0002 ///< PFAT_DIRECTORY check failed
+#define ERR_BAD_PPDT 0x0003 ///< A pre-execution check of the PPDT failed
+#define ERR_BAD_PUP 0x0004 ///< An inconsistency was found in the update package
+#define ERR_SCRIPT_SYNTAX 0x0005 ///< Unknown operator or name, or invalid syntax found in script
+#define ERR_UNDEFINED_FLASH_OBJECT 0x0006 ///< An unimplemented flash object was referenced
+#define ERR_INVALID_LINE 0x0007 ///< A JMP, JE, JNE, JG, JGE, JL, or JLE operator has a target that is not within the script buffer (between BEGIN and END inclusive)
+#define ERR_BAD_PUPC 0x0008 ///< PUPC inconsistency found
+#define ERR_BAD_SVN 0x0009 ///< PFAT module SVN is lower than required by PPDT
+#define ERR_UNEXPECTED_OPCODE 0x000A ///< An EC related opcode found in a script when the PPDT indicates there is no EC in the system
+#define ERR_RANGE_VIOLATION 0x8001 ///< Buffer or flash operation exceeded object bounds
+#define ERR_SFAM_VIOLATION 0x8002 ///< An unsigned script attempted to write or erase a bock of flash that overlaps with the SFAM
+#define ERR_OVERFLOW 0x8003 ///< An integer overflow occurred
+#define ERR_EXEC_LIMIT 0x8004 ///< Total number of script opcodes retired exceeds either platform limit, or global limit
+#define ERR_INTERNAL_ERROR 0x8005 ///< An internal consistency check failed within the PFAT module
+#define ERR_LAUNCH_FAIL 0xFFFF ///< CPU detected an error and did not execute the PFAT module
+
+#define PFAT_F0_INDEX 0
+#define PFAT_B0_INDEX 0
+
+#define EC_PRESENT BIT1
+#define EC_PFAT_PROTECTED BIT2
+#define PEG_DMI_FIX BIT24;
+
+#define MAX_SPI_COMPONENTS 8
+#define PFAT_MEMORY_PAGES 64 ///< PFAT Module needs 256KB of reserved memory (64 pages of 4KB each one)
+#define ALIGNMENT_IN_PAGES 64 ///< PFAT requires 256KB alignment (64 pages of 4KB each one)
+
+#define PPDT_MAJOR_VERSION 1
+#define PPDT_MINOR_VERSION 0
+#define PFAT_SVN 0x10001
+#define PUP_HDR_VERSION 1
+#define PSL_MAJOR_VERSION 1
+#define PSL_MINOR_VERSION 0
+
+#define PFAT_LOG_VERSION 1
+#define PFAT_LOG_OPT_STEP_TRACE BIT0
+#define PFAT_LOG_OPT_BRANCH_TRACE BIT1
+#define PFAT_LOG_OPT_FLASH_WRITE BIT2
+#define PFAT_LOG_OPT_FLASH_ERASE BIT3
+#define PFAT_LOG_OPT_FLASH_ERROR BIT4
+#define PFAT_LOG_OPT_DEBUG BIT5
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+///
+/// GUID to locate PFAT Module
+///
+#define PFAT_MODULE_GUID \
+ { \
+ 0x7934156D, 0xCFCE, 0x460E, 0x92, 0xF5, 0xA0, 0x79, 0x09, 0xA5, 0x9E, 0xCA \
+ }
+///
+/// GUID to locate PFAT HOB
+///
+#define PFAT_HOB_GUID \
+ { \
+ 0x66F0C42D, 0x0D0E, 0x4C23, 0x93, 0xC0, 0x2D, 0x52, 0x95, 0xDC, 0x5E, 0x21 \
+ }
+#else
+///
+/// GUID to locate PFAT Module
+///
+#define PFAT_MODULE_GUID \
+ { \
+ 0x7934156D, 0xCFCE, 0x460E, \
+ { \
+ 0x92, 0xF5, 0xA0, 0x79, 0x09, 0xA5, 0x9E, 0xCA \
+ } \
+ }
+///
+/// GUID to locate PFAT HOB
+///
+#define PFAT_HOB_GUID \
+ { \
+ 0x66F0C42D, 0x0D0E, 0x4C23, \
+ { \
+ 0x93, 0xC0, 0x2D, 0x52, 0x95, 0xDC, 0x5E, 0x21 \
+ } \
+ }
+#endif
+
+#define SPI_SIZE_BASE_512KB 0x80000
+
+typedef enum {
+ EnumSpiCompSize512KB = 0,
+ EnumSpiCompSize1MB,
+ EnumSpiCompSize2MB,
+ EnumSpiCompSize4MB,
+ EnumSpiCompSize8MB,
+ EnumSpiCompSize16MB,
+ EnumSpiCompSize32MB,
+ EnumSpiCompSize64MB,
+ EnumSpiCompSize128MB
+} SPI_COMPONENT_SIZE;
+
+#define MIN_SFAM_COUNT 1
+#define MAX_SFAM_COUNT 64
+
+typedef struct {
+ UINT32 FirstByte; ///< Linear flash address of the first byte of the signed range, must be aligned to be first byte in the block. Ordering is little-endian
+ UINT32 LastByte; ///< Linear flash address of the last byte of the signed range, must be aligned to be last byte in the block. Ordering is little-endian
+} SFAM_DATA;
+
+///
+/// PFAT Platform Data Table (PPDT)
+/// Provides platform specific data required by PFAT Module
+///
+typedef struct {
+ UINT32 PpdtSize; ///< Size in bytes of PPDT including SFAM
+ UINT16 PpdtMajVer; ///< Indicates major version of PPDT
+ UINT16 PpdtMinVer; ///< Indicates minor version of PPDT
+ UINT8 PlatId[16]; ///< PLAT_ID used to be compared against the one found in the PUP Header to prevent cross platform flashing
+ UINT8 PkeySlot0[32]; ///< SHA256 hash for PUP verification key 0
+ UINT8 PkeySlot1[32]; ///< SHA256 hash for PUP verification key 1
+ UINT8 PkeySlot2[32]; ///< SHA256 hash for PUP verification key 2
+ UINT32 PfatModSvn; ///< PFAT Module SVN
+ UINT32 BiosSvn; ///< BIOS_SVN to prevent back-flashing
+ UINT32 ExecLim; ///< Limit the number of opcodes that can be executed on any invocation of PFAT
+ ///
+ /// Bitmap of platform policy attributes
+ /// BIT[0]: Reserved. Must be 0
+ /// BIT[2:1] (EC_PRESENT)
+ /// 00b = There is not an EC is the system
+ /// 01b = There exists an EC in the system, PFAT does not extend any protection to the EC
+ /// 11b = There exist an EC in the system, PFAT extends protection to the EC
+ /// 10b = Reserved. Must not be used
+ /// BIT[3]: (DESCRIPTOR_OVERRIDE_POLICY)
+ /// 0b = Do not override PFAT security policy
+ /// 1b = Override PFAT security policy
+ /// BIT[23:4]: Reserved, must be 0
+ /// BIT[24]:
+ /// 0b = indicates PFAT module will not take additional steps.
+ /// 1b = indicates PFAT module should take additional steps to mitigate potential interference from installed PEG device.
+ /// BIT[31:25] Reserved, must be 0
+ ///
+ UINT32 PlatAttr;
+ ///
+ /// BIT[9:0] - 8 bit IO port used for sending EC commands (writes), and reading EC status (reads)
+ /// This field must be populated if PLAT_ATTR.EC_PRESENT != 0
+ /// This field must be zero if PLAT_ATTR.EC_PRESENT == 0
+ /// BIT[31:10] - Reserved. Must be 0
+ ///
+ UINT32 EcCmd;
+ ///
+ /// BIT[9:0] - 8 bit IO port used for reading and writing data to the EC based on a command issued to EC_CMD
+ /// This field must be populated if PLAT_ATTR.EC_PRESENT != 0
+ /// This field must be zero if PLAT_ATTR.EC_PRESENT == 0
+ /// BIT[31:10] - Reserved. Must be 0
+ ///
+ UINT32 EcData;
+ ///
+ /// BIT[7:0] - EC command indicating a read of the current EC firmware SVN
+ /// This field must be populated if PLAT_ATTR.EC_PRESENT != 0
+ /// This field must be zero if PLAT_ATTR.EC_PRESENT == 0
+ /// BIT[31:8] - Reserved. Must be 0
+ ///
+ UINT32 EcCmdGetSvn;
+ ///
+ /// BIT[7:0] - EC command indicating flash begin of flash update session
+ /// This field must be populated if PLAT_ATTR.EC_PRESENT != 0
+ /// This field must be zero if PLAT_ATTR.EC_PRESENT == 0
+ /// BIT[31:8] - Reserved. Must be 0
+ ///
+ UINT32 EcCmdOpen;
+ ///
+ /// BIT[7:0] - EC command indicating the termination of PFAT protected session
+ /// This field must be populated if PLAT_ATTR.EC_PRESENT != 0
+ /// This field must be zero if PLAT_ATTR.EC_PRESENT == 0
+ /// BIT[31:8] - Reserved. Must be 0
+ ///
+ UINT32 EcCmdClose;
+ ///
+ /// BIT[7:0] - EC command used to verify connectivity between PFAT and EC
+ /// This field must be populated if PLAT_ATTR.EC_PRESENT != 0
+ /// This field must be zero if PLAT_ATTR.EC_PRESENT == 0
+ /// BIT[31:8] - Reserved. Must be 0
+ ///
+ UINT32 EcCmdPortTest;
+ UINT8 Reserved1[4];
+ ///
+ /// Defines number of elements in SFAM array
+ /// BIT[5..0]: Index of the last SFAM element
+ /// BIT[7..6]: Reserved for future use. Must be 0
+ ///
+ UINT8 LastSfam;
+ UINT8 Reserved2[3];
+ SFAM_DATA SfamData[MAX_SFAM_COUNT]; ///< Array of flash address map descriptors. sizeof (SFAM_DESC) == 8
+} PPDT;
+
+///
+/// PFAT Update Package Header
+///
+typedef struct {
+ UINT16 Version; ///< Version of the update package header. Must be 0x0001
+ UINT8 Reserved3[2];
+ UINT8 PlatId[16]; ///< PLAT_ID used to be compared against the one found in the PPDT to prevent cross platform flashing
+ ///
+ /// If any bit set in this field then PUP must be signed and valid PUPC must be provided for PUP to be processed
+ /// BIT[0] - Indicates write/erase operations will be executed on protected flash area indicated in the PPDT SFAM
+ /// BIT[1] - Indicates protected EC operations included
+ ///
+ UINT16 PkgAttributes;
+ UINT8 Reserved4[2];
+ UINT16 PslMajorVer; ///< Indicates the PSL major version. Must be 1
+ UINT16 PslMinorVer; ///< Indicates the PSL minor version. Must be 0
+ UINT32 ScriptSectionSize; ///< Size in bytes of the script
+ UINT32 DataSectionSize; ///< Size of the data region in bytes
+ UINT32 BiosSvn; ///< BIOS SVN
+ UINT32 EcSvn; ///< EC SVN
+ UINT32 VendorSpecific;
+ } PUP_HEADER;
+
+ ///
+ /// Memory location for PUP, PUPC and PFAT LOG inside PFAT DPR allocated memory for Tool interface
+ ///
+#define PUP_BUFFER_SIZE 0x00014000 ///< 16KB Script + 64KB Flash Block
+#define PUPC_MEMORY_SIZE 0x00008000 ///< 32KB
+#define PFAT_LOG_MEMORY_SIZE 0x00020000 ///< 128KB
+#define PUPC_MEMORY_OFFSET (PUPC_MEMORY_SIZE + PFAT_LOG_MEMORY_SIZE) ///< PfatMemAddress + PfatMemSize - PFAT_LOG_MEMORY_SIZE - 32KB
+#define PFAT_LOG_MEMORY_OFFSET PFAT_LOG_MEMORY_SIZE ///< PfatMemAddress + PfatMemSize - 128KB
+#define MAX_PFAT_LOG_PAGE ((PFAT_LOG_MEMORY_SIZE / EFI_PAGE_SIZE) - 2) ///< 30 4KB Pages
+
+ ///
+ /// PFAT update package definition for BIOS SMM Initiated runtime calls
+ ///
+ typedef struct {
+ PUP_HEADER PupHeader;
+ UINT64 PupBuffer[PUP_BUFFER_SIZE / 8];
+ } PUP;
+
+///
+/// PFAT Log
+/// The logging facility is used to communicate detailed information regarding the execution of a PFAT script
+/// from the SMI handler which invoked the PFAT module itself
+///
+typedef struct {
+ UINT16 Version; ///< Indicates the version of the log. Must be 0x0001
+ UINT16 LastPage; ///< Last valid page index for the log
+ ///
+ /// Bitmap indicating what events to log
+ /// BIT[0] - Step trace - this indicates a full execution trace. Each line is entered into the log with an EXECUTION_TRACE entry
+ /// BIT[1] - Branch trace - All taken jumps are logged with a BRANCH_TRACE entry
+ /// BIT[2] - Flash write - All flash write operations are logged with a FLASH_WRITE entry
+ /// BIT[3] - Flash erase - All flash erase operations are logged with a FLASH_ERASE entry
+ /// BIT[4] - Flash error - All error conditions from flash operations are logged with FLASH_ERROR entry
+ /// BIT[5] - Debug - Log Debug opcode execution
+ /// BIT[6] - PFAT module debug message - Log implementation specific debug messages from debug module
+ /// BIT[31:7] - Reserved. Must be 0. If any reserved bits are set in Header.LoggingOptions, the PFAT module must disable the logging feature
+ ///
+ UINT32 LoggingOptions;
+ UINT8 Reserved5[8];
+ UINT32 PfatModSvn; ///< Indicates a version number of the PFAT module
+ UINT32 NumOfEntriesInLog; ///< Total number of log entries that have been written to the log
+} PFAT_LOG;
+
+///
+/// HOB used to pass data through every phase of PFAT Bios
+/// PFAT Bios code is executed in PEI, DXE and SMM and HOB is the only method to properly pass data
+/// between every phase
+///
+typedef struct {
+ EFI_HOB_GUID_TYPE EfiHobGuidType;
+ PPDT Ppdt; ///< PFAT Platform Data Table
+ ///
+ /// PFAT update package header, this header will be appended to all flash updates along with PSL script
+ ///
+ PUP_HEADER PupHeader;
+ UINT8 NumSpiComponents; ///< Number of physical SPI flash components on platform
+ UINT8 ComponentSize[MAX_SPI_COMPONENTS]; ///< Array containing size of each flash component
+ UINT64 PfatToolsIntIoTrapAdd; ///< IO Trap address required to Initialize PFAT Tools Interface
+ PFAT_LOG PfatLog; ///< Header for PFAT Log Buffer
+} PFAT_HOB;
+
+#endif
diff --git a/ReferenceCode/Haswell/Include/PowerMgmtDefinitions.h b/ReferenceCode/Haswell/Include/PowerMgmtDefinitions.h
new file mode 100644
index 0000000..5f95a72
--- /dev/null
+++ b/ReferenceCode/Haswell/Include/PowerMgmtDefinitions.h
@@ -0,0 +1,145 @@
+/** @file
+ This file contains define definitions specific to Haswell processor
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _POWER_MGMT_DEFINITIONS_H_
+#define _POWER_MGMT_DEFINITIONS_H_
+
+#define PPM_ENABLE 1
+#define PPM_DISABLE 0
+
+#define CSTATE_SUPPORTED 0x1
+#define ENHANCED_CSTATE_SUPPORTED 0x2
+#define C6_C7_SHORT_LATENCY_SUPPORTED 0x01
+#define C6_C7_LONG_LATENCY_SUPPORTED 0x02
+#define C7s_SHORT_LATENCY_SUPPORTED 0x03
+#define C7s_LONG_LATENCY_SUPPORTED 0x04
+//
+// Platform Power Management Flags Bit Definitions:
+// These defines are also used in CPU0CST.ASL to check platform configuration
+// and build C-state table accordingly.
+//
+#define PPM_EIST 0x1 ///< BIT 0 : Enhanced Intel Speed Step Technology.
+#define PPM_C1 0x2 ///< BIT 1 : C1 enabled, supported.
+#define PPM_C1E 0x4 ///< BIT 2 : C1E enabled.
+#define PPM_C3 0x8 ///< BIT 3 : C3 enabled, supported.
+#define PPM_C6 0x10 ///< BIT 4 : C6 enabled, supported.
+#define PPM_C7 0x20 ///< BIT 5 : C7 enabled, supported.
+#define PPM_C7S 0x40 ///< BIT 6 : C7S enabled, supported
+#define PPM_TM 0x80 ///< BIT 7 : Adaptive Thermal Monitor.
+#define PPM_TURBO 0x100 ///< BIT 8 : Long duration turbo mode
+#define PPM_CMP 0x200 ///< BIT 9 : CMP.
+#define PPM_TSTATES 0x400 ///< BIT 10: CPU throttling states
+#define PPM_MWAIT_EXT 0x800 ///< BIT 11: MONITIOR/MWAIT Extensions supported.
+#define PPM_EEPST 0x1000 ///< BIT 12: Energy efficient P-State Feature enabled
+#define PPM_TSTATE_FINE_GRAINED 0x2000 ///< BIT 13: Fine grained CPU Throttling states
+#define PPM_CD 0x4000 ///< BIT 14: Deep Cstate - C8/C9/C10
+#define PPM_TIMED_MWAIT 0x8000 ///< BIT 15: Timed Mwait support
+#define C6_LONG_LATENCY_ENABLE 0x10000 ///< BIT 16: 1=C6 Long and Short,0=C6 Short only
+#define C7_LONG_LATENCY_ENABLE 0x20000 ///< BIT 17: 1=C7 Long and Short,0=C7 Short only
+#define C7s_LONG_LATENCY_ENABLE 0x40000 ///< BIT 18: 1=C7s Long and Short,0=C7s Short only
+#define PPM_C8 0x80000 ///< Bit 19: 1= C8 enabled/supported
+#define PPM_C9 0x100000 ///< Bit 20: 1= C9 enabled/supported
+#define PPM_C10 0x200000 ///< Bit 21: 1= C10 enabled/supported
+
+#define PPM_C_STATES 0x7A ///< PPM_C1 + PPM_C3 + PPM_C6 + PPM_C7 + PPM_C7S
+#define C3_LATENCY 0x42
+#define C6_C7_SHORT_LATENCY 0x73
+#define C6_C7_LONG_LATENCY 0x91
+#define C8_LATENCY 0xE4
+#define C9_LATENCY 0x145
+#define C10_LATENCY 0x1EF
+
+#define CPUID_FUNCTION_6 0x00000006
+//
+// The following definitions are based on assumed location for the ACPI
+// Base Address. Modify as necessary base on platform-specific requirements.
+//
+#define PCH_ACPI_PBLK 0x1810
+#define PCH_ACPI_LV2 0x1814
+#define PCH_ACPI_LV3 0x1815
+#define PCH_ACPI_LV4 0x1816
+#define PCH_ACPI_LV6 0x1818
+#define PCH_ACPI_LV5 0x1817
+#define PCH_ACPI_LV7 0x1819
+
+//
+// C-State Latency (us) and Power (mW) for C1
+//
+#define C1_LATENCY 1
+#define C1_POWER 0x3E8
+#define C3_POWER 0x1F4
+#define C6_POWER 0x15E
+#define C7_POWER 0xC8
+#define C8_POWER 0xC8
+#define C9_POWER 0xC8
+#define C10_POWER 0xC8
+
+#define MAX_POWER_LIMIT_1_TIME_IN_SECONDS 32767
+#define AUTO 0
+#define END_OF_TABLE 0xFF
+
+#define CONFIG_TDP_DOWN 1
+#define CONFIG_TDP_UP 2
+#define CONFIG_TDP_DEACTIVATE 0xFF
+//
+// MMIO definitions
+//
+#define MMIO_DDR_RAPL_LIMIT 0x58e0
+#define MMIO_TURBO_POWER_LIMIT 0x59A0
+
+#define MAX_OVERCLOCKING_BINS 0x7
+
+///
+/// For Mobile, default PL1 time window value is 28 seconds
+///
+#define MB_POWER_LIMIT1_TIME_DEFAULT 28
+///
+/// For Desktop, default PL1 time window value is 8 second
+///
+#define DT_POWER_LIMIT1_TIME_DEFAULT 8
+
+#define PROCESSOR_FLAVOR_MOBILE 0x04
+#define PROCESSOR_FLAVOR_DESKTOP 0x00
+#define PROCESSOR_FLAVOR_MASK (BIT3 | BIT2)
+
+//
+// Power definitions (Based on EMTS V1.0 for standard voltage 2.4-2.6 GHz dual-core parts.)
+//
+#define FVID_MAX_POWER 35000
+#define FVID_TURBO_POWER 35000
+#define FVID_SUPERLFM_POWER 12000
+//
+// Power definitions for LFM and Turbo mode TBD.
+//
+#define FVID_MIN_POWER 15000
+///
+/// S3- MSR restore SW SMI
+///
+#ifndef SW_SMI_S3_RESTORE_MSR
+#define SW_SMI_S3_RESTORE_MSR 0x48
+#endif
+///
+/// VR Current Limit Default
+///
+#define VR_CURRENT_DEFAULT 0
+#define PSI1_THRESHOLD_DEFAULT 0x14
+#define PSI2_THRESHOLD_DEFAULT 0x05
+#define PSI3_THRESHOLD_DEFAULT 0x01
+#endif
diff --git a/ReferenceCode/Haswell/Include/ThunkLib.h b/ReferenceCode/Haswell/Include/ThunkLib.h
new file mode 100644
index 0000000..8d7146a
--- /dev/null
+++ b/ReferenceCode/Haswell/Include/ThunkLib.h
@@ -0,0 +1,154 @@
+/** @file
+ Real Mode Thunk Functions for IA32 and X64
+
+@copyright
+ Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef __THUNK_LIB__
+#define __THUNK_LIB__
+
+///
+/// Byte packed structure for an 16-bit real mode thunks
+///
+typedef struct {
+ UINT32 RealModeBuffer;
+ UINT32 DefaultStack;
+} THUNK16_CONTEXT;
+
+//
+// 16-bit thunking services
+//
+#define THUNK_SAVE_FP_STATE 0x1
+#define THUNK_USER_STACK 0x2
+#define THUNK_INTERRUPT 0x10000
+
+//
+// Function Prototypes
+//
+/**
+ Returns the properties of this real mode thunk implementation. Currently
+ there are 2 properties has been defined, the minimum real mode buffer size
+ and the minimum stack size.
+
+ @param[in] MinimumStackSize - The minimum size required for a 16-bit stack.
+
+ @retval The minimum size of the real mode buffer needed by this thunk implementation
+ @retval is returned.
+**/
+UINTN
+EFIAPI
+R8AsmThunk16GetProperties (
+ OUT UINTN *MinimumStackSize OPTIONAL
+ );
+
+/**
+ Tell this real mode thunk implementation the address and size of the real
+ mode buffer needed.
+
+ @param[in] ThunkContext - The thunk context whose properties to set.
+ @param[in] RealModeBuffer - The address of the buffer allocated by caller. It should be
+ aligned on a 16-byte boundary.
+ This buffer must be in identity mapped pages.
+ @param[in] BufferSize - The size of RealModeBuffer. Must be larger than the minimum
+ size required as returned by R8AsmThunk16GetProperties().
+**/
+THUNK16_CONTEXT *
+EFIAPI
+R8AsmThunk16SetProperties (
+ OUT THUNK16_CONTEXT *ThunkContext,
+ IN VOID *RealModeBuffer,
+ IN UINTN BufferSize
+ );
+
+/**
+ Reset all internal states to their initial values. The caller should not
+ release the real mode buffer until after a call to this function.
+
+ @param[in] ThunkContext - The thunk context to destroy.
+**/
+VOID
+EFIAPI
+R8AsmThunk16Destroy (
+ IN OUT THUNK16_CONTEXT *ThunkContext
+ );
+
+/**
+ Make a far call to 16-bit code.
+
+ NOTE: This function must be called on TPL_HIGH_LEVEL or with interrupts
+ disabled because of GDTR and IDTR manipulations.
+ This function must be placed in identity mapped pages.
+
+ @param[in] ThunkContext - Thunk context to use.
+ @param[in] RegisterSet - CPU registers would be set to the values contained in this
+ structure before making the far call. Then CPU registers are
+ copied back to this structure.
+ CS:EIP points to the real mode code being called on input.
+ SS:ESP points to the real mode stack if THUNK_USER_STACK is
+ set on input, otherwise ignored.
+ EFlages is ignored on input.
+ On output, values of CS, EIP, SS and ESP should be ignored.
+ @param[in] ThunkFlags - 2 flags have currently been defined, THUNK_SAVE_FP_STATE and
+ THUNK_USER_STACK.
+ THUNK_SAVE_FP_STATE - FPU state would be saved/restored
+ before/after calling real mode code.
+ THUNK_USER_STACK - The stack specified by SS:ESP would be
+ used instead of the default stack.
+
+ @retval RegisterSet is returned.
+**/
+IA32_REGISTER_SET *
+EFIAPI
+R8AsmThunk16FarCall86 (
+ IN THUNK16_CONTEXT *ThunkContext,
+ IN OUT IA32_REGISTER_SET *RegisterSet,
+ IN UINT32 ThunkFlags
+ );
+
+/**
+ Invoke a 16-bit interrupt handler.
+
+ NOTE: This function must be called on TPL_HIGH_LEVEL or with interrupts
+ disabled because of GDTR and IDTR manipulations.
+ This function must be placed in identity mapped pages.
+
+ @param[in] ThunkContext - Thunk context to use.
+ @param[in] IntNumber - The ordinal of the interrupt handler ranging from 0 to 255.
+ @param[in] RegisterSet - CPU registers would be set to the values contained in this
+ structure before making the far call. Then CPU registers are
+ copied back to this structure.
+ SS:ESP points to the real mode stack if THUNK_USER_STACK is
+ set on input, otherwise ignored.
+ EFlages is ignored on input.
+ On output, values of CS, EIP, SS and ESP should be ignored.
+ @param[in] ThunkFlags - 2 flags have currently been defined, THUNK_SAVE_FP_STATE and
+ THUNK_USER_STACK.
+ THUNK_SAVE_FP_STATE - FPU state would be saved/restored
+ before/after calling real mode code.
+ THUNK_USER_STACK - The stack specified by SS:ESP would be
+ used instead of the default stack.
+
+ @retval RegisterSet is returned.
+**/
+IA32_REGISTER_SET *
+EFIAPI
+R8AsmThunk16Int86 (
+ IN THUNK16_CONTEXT *ThunkContext,
+ IN UINT8 IntNumber,
+ IN OUT IA32_REGISTER_SET *RegisterSet,
+ IN UINT32 ThunkFlags
+ );
+
+#endif
diff --git a/ReferenceCode/Haswell/Include/TisPc.h b/ReferenceCode/Haswell/Include/TisPc.h
new file mode 100644
index 0000000..e11434b
--- /dev/null
+++ b/ReferenceCode/Haswell/Include/TisPc.h
@@ -0,0 +1,71 @@
+/**
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+@file
+ TisPc.h
+
+@brief
+ Definitions and function prototypes shared by all TPM components
+
+**/
+#ifndef _TIS_PC_H_
+#define _TIS_PC_H_
+
+///
+/// Set structure alignment to 1-byte
+///
+#pragma pack(push)
+#pragma pack(1)
+///
+/// TPM Base Address Definitions
+///
+#define TPM_BASE_ADDRESS 0xFED40000
+///
+/// Register set map as specified in TIS Chapter 10
+///
+typedef struct tdTIS_PC_REGISTERS {
+ INT8 access; ///< 0
+ UINT8 reserved1[7]; ///< 1
+ UINT32 intEnable; ///< 8
+ UINT8 intVector; ///< 0ch
+ UINT8 reserved2[3]; ///< 0dh
+ UINT32 intSts; ///< 10h
+ UINT32 intfCapability; ///< 14h
+ INT8 status; ///< 18h
+ UINT16 burstCount; ///< 19h
+ UINT8 reserved3[9];
+ UINT32 dataFifo; ///< 24
+ UINT8 reserved4[0xed8]; ///< 28h
+ UINT16 vid; ///< 0f00h
+ UINT16 did; ///< 0f02h
+ UINT8 rid; ///< 0f04h
+ UINT8 tcgDefined[0x7b]; ///< 0f05h
+ UINT32 legacyAddress1; ///< 0f80h
+ UINT32 legacyAddress1Ex; ///< 0f84h
+ UINT32 legacyAddress2; ///< 0f88h
+ UINT32 legacyAddress2Ex; ///< 0f8ch
+ UINT8 vendorDefined[0x70]; ///< 0f90h
+} TIS_PC_REGISTERS;
+
+///
+/// Define pointer types used to access TIS registers on PC
+///
+typedef VOLATILE TIS_PC_REGISTERS *TIS_PC_REGISTERS_PTR;
+
+#pragma pack(pop)
+#endif
diff --git a/ReferenceCode/Haswell/Include/Txt.h b/ReferenceCode/Haswell/Include/Txt.h
new file mode 100644
index 0000000..5db5155
--- /dev/null
+++ b/ReferenceCode/Haswell/Include/Txt.h
@@ -0,0 +1,160 @@
+/** @file
+ This file contains definitions required to use the TXT BIOS
+ Authenticated Code Module Library.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _TXT_BIOS_ACM_LIB_H_
+#define _TXT_BIOS_ACM_LIB_H_
+
+#define TPM_TIME_OUT 750
+
+#define TXT_RLP_INIT 1
+
+///
+/// MMIO definition
+///
+#ifndef MmPciAddress
+//#define MmPciAddress(Segment, Bus, Device, Function, Register) \
+// ((UINTN) (PciRead32 (PCI_LIB_ADDRESS (0,0,0,0x60)) & 0xFC000000) + \
+// (UINTN) (Bus << 20) + \
+// (UINTN) (Device << 15) + \
+// (UINTN) (Function << 12) + \
+// (UINTN) (Register) \
+// )
+#define MmPciAddress(Segment, Bus, Device, Function, Register) \
+ ((UINTN) PlatformPciExpressBaseAddress + \
+ (UINTN) (Bus << 20) + \
+ (UINTN) (Device << 15) + \
+ (UINTN) (Function << 12) + \
+ (UINTN) (Register) \
+ )
+#endif
+//
+// TxT BIOS Spec version
+//
+#define TXT_BIOS_SPEC_VER_MAJOR 2
+#define TXT_BIOS_SPEC_VER_MINOR 1
+#define TXT_BIOS_SPEC_VER_REVISION 0
+
+//
+// The following are values that are placed in the esi register when
+// calling the BIOS ACM. These constants are used as parameters to the
+// TxtSetupandLaunchBiosAcm function.
+//
+#define TXT_LAUNCH_SCLEAN 0x00
+#define TXT_RESET_EST_BIT 0x01
+#define TXT_RESET_AUX 0x02
+#define TXT_LAUNCH_SCHECK 0x04
+
+#define TPM_STATUS_REG_ADDRESS 0xFED40000
+#define TXT_PUBLIC_BASE 0xFED30000
+#define TXT_PRIVATE_BASE 0xFED20000
+#define TXT_CONFIG_SPACE_LENGTH 0x60000
+
+#define TXT_ERROR_STATUS_REG_OFF 0x8
+#define TXT_SINIT_BASE_REG_OFF 0x270
+#define TXT_SINIT_SIZE_REG_OFF 0x278
+#define TXT_SINIT_SIZE_REG_OFF2 0x27C
+#define TXT_SVMM_JOIN_REG_OFF 0x290
+#define TXT_SVMM_JOIN_REG_OFF2 0x294
+#define TXT_HEAP_BASE_REG_OFF 0x300
+#define TXT_HEAP_SIZE_REG_OFF 0x308
+#define TXT_SCRATCHPAD 0x320
+#define TXT_SCRATCHPAD2 0x324
+#define TXT_SCRATCHPAD3 0x328
+#define TXT_SCRATCHPAD4 0x32C
+#define TXT_DPR_SIZE_REG_OFF 0x330
+
+#define TXT_E2STS_REG_OFF 0x8F0
+#define TXT_BLOCK_MEM_STS BIT2
+#define TXT_SECRETS_STS BIT1
+#define TXT_SLP_ENTRY_ERROR_STS BIT0
+
+#define MCU_BASE_ADDR TXT_SINIT_SIZE_REG_OFF
+#define BIOACM_ADDR TXT_SINIT_SIZE_REG_OFF2
+#define APINIT_ADDR TXT_SVMM_JOIN_REG_OFF
+#define SEMAPHORE TXT_SVMM_JOIN_REG_OFF2
+
+///
+/// GUIDs used by TXT drivers
+///
+#define PEI_BIOS_ACM_FILE_GUID \
+ { \
+ 0x2D27C618, 0x7DCD, 0x41F5, 0xBB, 0x10, 0x21, 0x16, 0x6B, 0xE7, 0xE1, 0x43 \
+ }
+
+#define PEI_AP_STARTUP_FILE_GUID \
+ { \
+ 0xD1E59F50, 0xE8C3, 0x4545, 0xBF, 0x61, 0x11, 0xF0, 0x02, 0x23, 0x3C, 0x97 \
+ }
+
+#define CPU_MICROCODE_FILE_GUID \
+ { \
+ 0x17088572, 0x377F, 0x44ef, 0x8F, 0x4E, 0xB0, 0x9F, 0xFF, 0x46, 0xA0, 0x70 \
+ }
+
+#pragma pack(push, 1)
+///
+/// BIOS OS Data region definitions
+///
+#define BIOS_OS_DATAREGION_VERSION 4
+
+typedef struct {
+ UINT32 Type;
+ UINT32 Size;
+} HEAP_EXT_DATA_ELEMENT;
+
+///
+/// BIOS spec version element
+///
+#define HEAP_EXTDATA_TYPE_BIOS_SPEC_VER 1
+
+typedef struct {
+ HEAP_EXT_DATA_ELEMENT Header;
+ UINT16 SpecVerMajor;
+ UINT16 SpecVerMinor;
+ UINT16 SpecVerRevision;
+} HEAP_BIOS_SPEC_VER_ELEMENT;
+
+///
+/// BIOS ACM element
+///
+#define HEAP_EXTDATA_TYPE_BIOSACM 2
+typedef struct {
+ HEAP_EXT_DATA_ELEMENT Header;
+ UINT32 NumAcms;
+} HEAP_BIOSACM_ELEMENT;
+
+///
+/// END type
+///
+#define HEAP_EXTDATA_TYPE_END 0
+
+typedef struct {
+ UINT32 Version;
+ UINT32 BiosSinitSize;
+ EFI_PHYSICAL_ADDRESS LcpPdBase;
+ UINT64 LcpPdSize;
+ UINT32 NumOfLogicalProcessors;
+ UINT64 Flags;
+ HEAP_EXT_DATA_ELEMENT ExtData;
+} BIOS_OS_DATA_REGION;
+
+#pragma pack(pop)
+#endif
diff --git a/ReferenceCode/Haswell/Include/Txt.inc b/ReferenceCode/Haswell/Include/Txt.inc
new file mode 100644
index 0000000..4cd76fe
--- /dev/null
+++ b/ReferenceCode/Haswell/Include/Txt.inc
@@ -0,0 +1,442 @@
+;@file
+; This file contains definitions used in Txtpeibsp and txtpeiap.asm
+;
+;@copyright
+; Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+; This software and associated documentation (if any) is furnished
+; under a license and may only be used or copied in accordance
+; with the terms of the license. Except as permitted by such
+; license, no part of this software or documentation may be
+; reproduced, stored in a retrieval system, or transmitted in any
+; form or by any means without the express written consent of
+; Intel Corporation.
+;
+; This file contains an 'Intel Peripheral Driver' and uniquely
+; identified as "Intel Reference Module" and is
+; licensed for Intel CPUs and chipsets under the terms of your
+; license agreement with Intel or your vendor. This file may
+; be modified by the user, subject to additional terms of the
+; license agreement
+;
+
+;-----------------------------------------------------------------------------
+; Common equates
+;
+
+UINT32 TYPEDEF DWORD
+UINT64 TYPEDEF QWORD
+
+;-----------------------------------------------------------------------------
+; Bit definitions
+;
+BIT31 EQU (1 SHL 31)
+BIT30 EQU (1 SHL 30)
+BIT29 EQU (1 SHL 29)
+BIT28 EQU (1 SHL 28)
+BIT27 EQU (1 SHL 27)
+BIT26 EQU (1 SHL 26)
+BIT25 EQU (1 SHL 25)
+BIT24 EQU (1 SHL 24)
+BIT23 EQU (1 SHL 23)
+BIT22 EQU (1 SHL 22)
+BIT21 EQU (1 SHL 21)
+BIT20 EQU (1 SHL 20)
+BIT19 EQU (1 SHL 19)
+BIT18 EQU (1 SHL 18)
+BIT17 EQU (1 SHL 17)
+BIT16 EQU (1 SHL 16)
+BIT15 EQU (1 SHL 15)
+BIT14 EQU (1 SHL 14)
+BIT13 EQU (1 SHL 13)
+BIT12 EQU (1 SHL 12)
+BIT11 EQU (1 SHL 11)
+BIT10 EQU (1 SHL 10)
+BIT9 EQU (1 SHL 9)
+BIT8 EQU (1 SHL 8)
+BIT7 EQU (1 SHL 7)
+BIT6 EQU (1 SHL 6)
+BIT5 EQU (1 SHL 5)
+BIT4 EQU (1 SHL 4)
+BIT3 EQU (1 SHL 3)
+BIT2 EQU (1 SHL 2)
+BIT1 EQU (1 SHL 1)
+BIT0 EQU (1 SHL 0)
+
+PORTB EQU 061h
+PORTBMASK EQU (1 shl 4)
+;
+; BIOS ACM functions
+;
+TXT_LAUNCH_SCLEAN EQU 00h
+TXT_RESET_EST_BIT EQU 01h
+TXT_RESET_AUX EQU 02h
+TXT_LAUNCH_SCHECK EQU 04h
+
+PORT80_CODE_PREFIX EQU 0A0h
+
+;
+; EDI parameter sent to SCHECK function
+;
+COLD_BOOT_PATH EQU 0
+S3_RESUME_PATH EQU BIT1
+;----------------------------------------------------------------------------
+; Common stackless calling macros
+;
+CALL_NS MACRO lbl
+ local retaddr
+ if @WordSize EQ 2
+ mov sp, retaddr
+ else
+ mov esp, retaddr
+ endif
+
+ pslldq xmm4, 4
+ pinsrw xmm4, esp, 0
+ rol esp, 10h
+ pinsrw xmm4, esp, 1
+
+ jmp lbl
+
+retaddr:
+ENDM
+
+RET_NS MACRO
+ movd esp, xmm4
+ psrldq xmm4, 4
+
+ if @WordSize EQ 2
+ jmp sp
+ else
+ jmp esp
+ endif
+ENDM
+
+;-----------------------------------------------------------------------------
+; AC Module header
+;
+ACM_HEADER STRUCT
+ ORG 24
+ AcmSize dd ? ; // 24 4 Module size (in multiples of four bytes)
+ACM_HEADER ENDS
+
+;-----------------------------------------------------------------------------
+; TXT enabling and execution
+;
+
+CAPABILITIES EQU 00h
+ENTERACCS EQU 02h
+
+CR0_NE_MASK EQU (1 SHL 5)
+CR0_NW_MASK EQU (1 SHL 29)
+CR0_CD_MASK EQU (1 SHL 30)
+CR0_PG_MASK EQU (1 SHL 31)
+
+CR4_VME EQU (1 SHL 0)
+CR4_PVI EQU (1 SHL 1)
+CR4_TSD EQU (1 SHL 2)
+CR4_DE EQU (1 SHL 3)
+CR4_PSE EQU (1 SHL 4)
+CR4_PAE EQU (1 SHL 5)
+CR4_MSE EQU (1 SHL 6)
+CR4_PGE EQU (1 SHL 7)
+CR4_PCE EQU (1 SHL 8)
+CR4_OSFXSR EQU (1 SHL 9)
+CR4_VMXE EQU (1 SHL 13)
+CR4_SMXE EQU (1 SHL 14)
+
+_GETSEC EQU db 0fh, 37h
+
+;----------------------------------------------------------------------------
+; DescriptorAccess Rights Definitions
+;
+PAGEGRANULARITY EQU 01H ; Page Granularity
+BYTEGRANULARITY EQU 00H ; Byte Granularity
+BIGSEGMENT EQU 01H ; Big Segment 32 bit
+SMALLSEGMENT EQU 00H ; Small Segment 16 bit
+SEG_PRESENT EQU 01H ; Segment Present
+SEG_NOTPRESENT EQU 00H ; Segment Not Present
+APPLSEGMENT EQU 01H ; Application Segment
+SYSTEMSEGMENT EQU 00H ; System Segment
+
+DATATYPE EQU 03H ; Read, Write, accessed
+STACKTYPE EQU 03H ; Read, Write, accessed
+CODETYPE EQU 0BH ; Execute, Read, accessed
+
+;----------------------------------------------------------------------------
+;Descritor table structures and records
+;
+
+R_AR0_7 RECORD P:1=0, DPL:2=0, D_T:1=0, sType:4=0
+
+; P - Segment present
+; 0=NOTPRESENT
+; 1=PRESENT
+; DPL - Descriptor priviledge level
+; D_T - Descriptor type
+; 0=SYSTEMSEGMENT
+; 1=APPLSEGMENT
+; sType - Segment Type
+; For Application segment:
+; 03h - DATATYPE (Read/Write/Accessed)
+; 07h - STACKTYPE (Expand Down/Read/Write/Accessed)
+; 0Fh - CODETYPE (Execute/Conforming/Read/Accessed)
+;
+; For System segment:
+; 01h - Available 16 bit TSS
+; 02h - LDT
+; 03h - Active 16 bit TSS
+; 04h - 16 bit call gate
+; 05h - 16 + 32 bit task gate
+; 06h - 16 bit interrupt gate
+; 07h - 16 bit trap gate
+; 09h - Available 32 bit TSS
+; 0Bh - Active 32 bit TSS
+; 0Ch - 32 bit call gate
+; 0Eh - 32 bit interrupt gate
+; 0Fh - 32 bit trap gate
+
+R_LAR16_23 RECORD G:1=0, D_B:1=0, L:1=0, Avl:1=0, Lim:4=0
+
+; G - Granularity
+; 0=BYTEGRANULARITY
+; 1=PAGEGRANULARITY
+; D_B - Segment size
+; 0=SMALLSEGMENT
+; 1=BIGSEGMENT
+; Res - Reserved
+; Avl - Available for OS (Not used)
+; Lim - Limit bits 16-19
+
+SEG_DESCRIPTOR STRUCT 4
+ Limit0_15 DW 0000 ; Limit Bits 0-15
+ Base0_15 DW 0000 ; Base address Bits 0-15
+ Base16_23 DB 00 ; Base address Bits 16-23
+ AR0_7 R_AR0_7 <> ; Access Rights 0-7
+ LAR16_23 R_LAR16_23 <> ; Limit Bits 16-19 and Access Bits 8-11
+ Base24_31 DB 00 ; Base address Bits 24-31
+SEG_DESCRIPTOR ENDS
+
+;-----------------------------------------------------------------------------
+; Machine Check register definitions
+;
+MCG_CAP EQU 179h
+
+MC0_STATUS EQU 401h
+
+;-----------------------------------------------------------------------------
+; TXT register space definitiions
+;
+TXT_PRIVATE_BASE EQU 0FED20000h
+TXT_PUBLIC_BASE EQU 0FED30000h
+TXT_REGISTER_SPACE_LENGTH EQU 070000h
+
+TXT_STS EQU 0000h
+ TXT_STS_SENTER_DONE_MASK EQU BIT0
+ TXT_STS_SEXIT_DONE_MASK EQU BIT1
+ TXT_STS_MEM_UNLOCK_STS_MASK EQU BIT4
+ TXT_STS_NODMAEN_MASK EQU BIT5
+ TXT_STS_MEMCONFIGLOCK_STS_MASK EQU BIT6
+ TXT_STS_PRIVATEOPEN_STS_MASK EQU BIT7
+ TXT_STS_BLOCKMAP_STS_MASK EQU BIT8
+ TXT_STS_NODMACACHE_STS_MASK EQU BIT9
+ TXT_STS_NODMATABLEPROTECT_STS_MASK EQU BIT10
+ TXT_ESTS EQU 0008h
+ TXT_WAKE_ERROR_STS EQU BIT6
+
+TXT_THREADS_EXIST EQU 0010h
+TXT_THREADS_JOIN EQU 0020h
+TXT_CRASH EQU 0030h
+TXT_CMD_SYS_RESET EQU 0038h
+TXT_CMD_OPEN_PRIVATE EQU 0040h
+TXT_CMD_CLOSE_PRIVATE EQU 0048h
+TXT_POISON EQU 00B0h
+TXT_VER_DID EQU 0110h
+TXT_VER_EID EQU 0118h
+TXT_VER_MIF EQU 0200h
+TXT_CMD_LOCK_MEM_CONFIG EQU 0210h
+TXT_CMD_UNLOCK_MEM_CONFIG EQU 0218h
+TXT_CMD_UNLOCK_MEMORY EQU 0220h
+TXT_CMD_NODMA_EN EQU 0230h
+TXT_CMD_NODMA_DIS EQU 0238h
+TXT_SINIT_BASE EQU 0270h
+TXT_SINIT_SIZE EQU 0278h
+TXT_SINIT_SIZE2 EQU 027Ch
+TXT_SVMM_JOIN EQU 0290h
+TXT_SVMM_JOIN2 EQU 0294h
+TXT_HEAP_BASE EQU 0300h
+TXT_HEAP_SIZE EQU 0308h
+TXT_MSEG_BASE EQU 0310h
+TXT_MSEG_SIZE EQU 0318h
+TXT_SCRATCHPAD EQU 0320h
+TXT_SCRATCHPAD2 EQU 0324h
+TXT_SCRATCHPAD3 EQU 0328h
+TXT_SCRATCHPAD4 EQU 032Ch
+TXT_DPR EQU 0330h
+TXT_CMD_OPEN_LOCALITY1 EQU 0380h
+TXT_CMD_CLOSE_LOCALITY1 EQU 0388h
+TXT_CMD_OPEN_LOCALITY3 EQU 03a0h
+TXT_CMD_CLOSE_LOCALITY3 EQU 03a8h
+TXT_PUBLIC_KEY EQU 0400h
+TXT_TGFX_CMD EQU 0504h
+TXT_TGA_BASE EQU 0510h
+TXT_TGR_BASE EQU 0518h
+TXT_TGTT_BASE EQU 0520h
+TXT_TMSAC EQU 0540h
+ TGTT_128MB EQU BIT0
+ TGTT_256MB EQU BIT1
+ TGTT_512MB EQU BIT1+BIT0
+TXT_VER_FTIF EQU 0800h
+TXT_PCH_DIDVID EQU 0810h
+TXT_CMD_SECRETS EQU 08E0h
+TXT_CMD_NO_SECRETS EQU 08E8h
+TXT_E2STS EQU 08F0h
+ TXT_BLOCK_MEM_STS EQU BIT2
+ TXT_SECRETS_STS EQU BIT1
+ TXT_SLP_ENTRY_ERROR_STS EQU BIT0
+
+MCU_MAX_SIZE EQU 10000h ; 64KB max size per MCU
+MCU_SLOT_SZ_BITS EQU 11 ; 2KB MCU slot size
+MCU_SLOT_SZ EQU 1 SHL MCU_SLOT_SZ_BITS
+
+;-----------------------------------------------------------------------------
+;
+; MCU Constants
+;
+MCU_HEADER_VER EQU 1
+MCU_LOADER_REV EQU 1
+;
+; ProcessorMSR Equates
+;
+PLAT_ID_MSR EQU 17h ; Platform ID
+MCU_LOAD_MSR EQU 79h ; Trigger to load MCU
+MCU_REV_MSR EQU 8Bh ; MCU Revision register
+;
+PLAT_ID_BIT EQU 50 ; Bits 52:50 has the Platform ID
+PLAT_ID_BITMASK EQU 07h ; Bits 52:50 has the Platform ID
+
+EFI_MSR_IA32_THERM_INTERRUPT EQU 019Bh
+;
+; Microcode Update (MCU) Header
+;
+MCU STRUCT
+ headerVer DD ? ; MCU Header Version ( = 00000001h )
+ revision DD ? ; MCU Revision
+ date DD ? ; MCU Date
+ signature DD ? ; MCU Processor Signature
+ checksum DD ? ; MCU Main checksum
+ loaderRev DD ? ; MCU Loader Revision
+ procFlags DD ? ; MCU Processor Flags (Platform ID)
+ dataSize DD ? ; MCU Data Size
+ totalSize DD ? ; MCU Total Size
+ reserved DD 3 dup(?)
+MCU ENDS
+;
+; Extended Signature Table (EST)
+;
+EST STRUCT
+ count DD ? ; EST Count
+ checksum DD ? ; EST Checksum
+ reserved DD 3 dup(?)
+EST ENDS
+;
+; Processor Signature Structure (PSS)
+;
+PSS STRUCT
+ signature DD ? ; PSS Processor Signature
+ procFlags DD ? ; PSS Processor Flags (Platform ID)
+ checksum DD ? ; PSS Checksum
+PSS ENDS
+
+;----------------------------------------------------------------------------
+; APIC definitions
+;
+IA32_APIC_BASE EQU 001Bh ; APIC base MSR
+ BASE_ADDR_MASK EQU 0FFFFF000h
+ EFI_MSR_EXT_XAPIC_LVT_THERM EQU 0833h
+APIC_ID EQU 20h
+ APIC_ID_SHIFT EQU 24
+ICR_LOW EQU 300h
+ICR_HIGH EQU 310h
+SPURIOUS_VECTOR_1 EQU 0F0h
+LOCAL_APIC_THERMAL_DEF EQU 330h
+ B_INTERRUPT_MASK EQU (1 SHL 16)
+ B_DELIVERY_MODE EQU (07h SHL 8)
+ V_MODE_SMI EQU (02h SHL 8)
+ B_VECTOR EQU (0FFh SHL 0)
+
+
+;-----------------------------------------------------------------------------
+; MTRRs
+;
+IA32_MTRR_CAP EQU 0FEh
+IA32_MTRR_PHYSBASE0 EQU 200h
+IA32_MTRR_PHYSMASK0 EQU 201h
+IA32_MTRR_PHYSBASE1 EQU 202h
+IA32_MTRR_PHYSMASK1 EQU 203h
+IA32_MTRR_PHYSBASE2 EQU 204h
+IA32_MTRR_PHYSMASK2 EQU 205h
+IA32_MTRR_PHYSBASE3 EQU 206h
+IA32_MTRR_PHYSMASK3 EQU 207h
+IA32_MTRR_PHYSBASE4 EQU 208h
+IA32_MTRR_PHYSMASK4 EQU 209h
+IA32_MTRR_PHYSBASE5 EQU 20Ah
+IA32_MTRR_PHYSMASK5 EQU 20Bh
+IA32_MTRR_PHYSBASE6 EQU 20Ch
+IA32_MTRR_PHYSMASK6 EQU 20Dh
+IA32_MTRR_PHYSBASE7 EQU 20Eh
+IA32_MTRR_PHYSMASK7 EQU 20Fh
+IA32_MTRR_PHYSBASE8 EQU 210h
+IA32_MTRR_PHYSMASK8 EQU 211h
+IA32_MTRR_PHYSBASE9 EQU 212h
+IA32_MTRR_PHYSMASK9 EQU 213h
+IA32_MTRR_FIX64K_00000 EQU 250h
+IA32_MTRR_FIX16K_80000 EQU 258h
+IA32_MTRR_FIX16K_A0000 EQU 259h
+IA32_MTRR_FIX4K_C0000 EQU 268h
+IA32_MTRR_FIX4K_C8000 EQU 269h
+IA32_MTRR_FIX4K_D0000 EQU 26Ah
+IA32_MTRR_FIX4K_D8000 EQU 26Bh
+IA32_MTRR_FIX4K_E0000 EQU 26Ch
+IA32_MTRR_FIX4K_E8000 EQU 26Dh
+IA32_MTRR_FIX4K_F0000 EQU 26Eh
+IA32_MTRR_FIX4K_F8000 EQU 26Fh
+IA32_CR_PAT EQU 277h
+IA32_MTRR_DEF_TYPE EQU 2FFh
+NO_EVICT_MODE EQU 2E0h
+
+;
+; Only low order bits are assumed
+;
+MTRR_MASK EQU 0FFFFF000h
+
+MTRR_ENABLE EQU (1 SHL 11)
+MTRR_FIXED_ENABLE EQU (1 SHL 10)
+MTRR_VALID EQU (1 SHL 11)
+UC EQU 00h
+WB EQU 06h
+
+MTRR_VCNT EQU 8
+
+;-----------------------------------------------------------------------------
+;
+; CPU generic definition
+;
+IA32_CPUID_SMX_B EQU 6
+
+;-----------------------------------------------------------------------------
+;
+; AP communication area
+;
+
+MCU_BASE_ADDR EQU TXT_SINIT_SIZE
+BIOACM_ADDR EQU TXT_SINIT_SIZE2
+APINIT_ADDR EQU TXT_SVMM_JOIN
+SEMAPHORE EQU TXT_SVMM_JOIN2
+
+IA32_MISC_ENABLE_MSR EQU 1A0h
+IA32_EFER_MSR EQU 0C0000080h
+LME EQU BIT8
+
+IFNDEF MKF_TXT_RLP_INIT
+MKF_TXT_RLP_INIT EQU 01h
+ENDIF
diff --git a/ReferenceCode/Haswell/Library/BootGuardLib.cif b/ReferenceCode/Haswell/Library/BootGuardLib.cif
new file mode 100644
index 0000000..2f3587a
--- /dev/null
+++ b/ReferenceCode/Haswell/Library/BootGuardLib.cif
@@ -0,0 +1,11 @@
+<component>
+ name = "BootGuardLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Haswell\Library\"
+ RefName = "BootGuardLib"
+[files]
+"BootGuardLib.sdl"
+"BootGuardLib.mak"
+"BootGuardLib\BootGuardLib.inf"
+"BootGuardLib\BootGuardLibrary.c"
+<endComponent>
diff --git a/ReferenceCode/Haswell/Library/BootGuardLib.mak b/ReferenceCode/Haswell/Library/BootGuardLib.mak
new file mode 100644
index 0000000..5fa59bc
--- /dev/null
+++ b/ReferenceCode/Haswell/Library/BootGuardLib.mak
@@ -0,0 +1,20 @@
+# MAK file for the ModulePart:CpuPlatformLib
+
+$(BootGuardLib_LIB) : BootGuardLib
+
+BootGuardLib : $(BUILD_DIR)\BootGuardLib.mak BootGuardLibBin
+
+$(BUILD_DIR)\BootGuardLib.mak : $(BootGuardLib_DIR)\$(@B).cif $(BootGuardLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(BootGuardLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+BootGuardLibBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ BUILD_DIR=$(BUILD_DIR) \
+ /f $(BUILD_DIR)\BootGuardLib.mak all\
+ "MY_INCLUDES=$(EDK_INCLUDES) $(EdkIIGlueLib_INCLUDES) $(PROJECT_CPU_INCLUDES) $(INTEL_PCH_INCLUDES)" \
+ TYPE=LIBRARY "PARAMETERS=LIBRARY_NAME=$$(BootGuardLib_LIB)"
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ BUILD_DIR=$(BUILD_DIR)\IA32 \
+ /f $(BUILD_DIR)\BootGuardLib.mak all\
+ "MY_INCLUDES=$(EDK_INCLUDES) $(EdkIIGlueLib_INCLUDES) $(PROJECT_CPU_INCLUDES) $(INTEL_PCH_INCLUDES)" \
+ TYPE=PEI_LIBRARY "PARAMETERS=LIBRARY_NAME=$$(BootGuardLib_LIB)"
diff --git a/ReferenceCode/Haswell/Library/BootGuardLib.sdl b/ReferenceCode/Haswell/Library/BootGuardLib.sdl
new file mode 100644
index 0000000..8356d53
--- /dev/null
+++ b/ReferenceCode/Haswell/Library/BootGuardLib.sdl
@@ -0,0 +1,32 @@
+TOKEN
+ Name = BootGuardLib_SUPPORT
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable BootGuardLib support in Project"
+End
+
+TOKEN
+ Name = "BootGuardLib_LIB"
+ Value = "$$(LIB_BUILD_DIR)\BootGuardLib.lib"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+PATH
+ Name = "BootGuardLib_DIR"
+End
+
+ELINK
+ Name = "/I$(BootGuardLib_DIR)\BootGuardLib"
+ Parent = "PROJECT_CPU_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+MODULE
+ Help = "Includes BootGuardLib.mak to Project"
+ File = "BootGuardLib.mak"
+End
+
diff --git a/ReferenceCode/Haswell/Library/BootGuardLib/BootGuardLib.inf b/ReferenceCode/Haswell/Library/BootGuardLib/BootGuardLib.inf
new file mode 100644
index 0000000..5af1ded
--- /dev/null
+++ b/ReferenceCode/Haswell/Library/BootGuardLib/BootGuardLib.inf
@@ -0,0 +1,64 @@
+## @file
+# Component description file for Boot Guard Library
+#
+#@copyright
+# Copyright (c) 2012 - 2013 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains an 'Intel Peripheral Driver' and uniquely
+# identified as "Intel Reference Module" and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+
+[defines]
+BASE_NAME = BootGuardLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ BootGuardLibrary.c
+
+[sources.ia32]
+
+[sources.x64]
+
+[sources.ipf]
+
+[includes.common]
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include/Library
+
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[libraries.common]
+ EdkIIGlueBasePciLibPciExpress
+ CpuPlatformLib
+
+[nmake.common]
diff --git a/ReferenceCode/Haswell/Library/BootGuardLib/BootGuardLibrary.c b/ReferenceCode/Haswell/Library/BootGuardLib/BootGuardLibrary.c
new file mode 100644
index 0000000..e35d42f
--- /dev/null
+++ b/ReferenceCode/Haswell/Library/BootGuardLib/BootGuardLibrary.c
@@ -0,0 +1,121 @@
+/** @file
+ BootGuardLibrary implementation.
+
+@copyright
+ Copyright (c) 2012 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueBase.h"
+#include "EdkIIGluePeim.h"
+#include "CpuAccess.h"
+#include "CpuPlatformLib.h"
+#endif
+
+/**
+ Determine if Boot Guard is supported
+
+ @retval TRUE - Processor is Boot Guard capable.
+ @retval FALSE - Processor is not Boot Guard capable.
+
+**/
+BOOLEAN
+IsBootGuardSupported (
+ VOID
+ )
+{
+ UINT64 BootGuardBootStatus;
+ UINT32 BootGuardAcmStatus;
+ UINT64 BootGuardCapability;
+ CPU_STEPPING CpuSteppingId;
+
+ //
+ // Return unsupported if processor is not ULT sku
+ //
+ if(GetCpuSku() != EnumCpuUlt) {
+ return FALSE;
+ }
+
+ BootGuardBootStatus = *(UINT64 *) (UINTN) (TXT_PUBLIC_BASE + R_CPU_BOOT_GUARD_BOOTSTATUS);
+ BootGuardAcmStatus = *(UINT32 *) (UINTN) (TXT_PUBLIC_BASE + R_CPU_BOOT_GUARD_ACM_STATUS);
+ BootGuardCapability = AsmReadMsr64 (MSR_BOOT_GUARD_SACM_INFO) & BIT32;
+ CpuSteppingId = GetCpuStepping();
+
+ if (CpuSteppingId >= EnumHswUltC0) {
+ if (BootGuardCapability != 0) {
+ DEBUG ((EFI_D_ERROR, "Processor supports Boot Guard.\n"));
+ return TRUE;
+ } else {
+ DEBUG ((EFI_D_ERROR, "Processor does not support Boot Guard.\n"));
+ return FALSE;
+ }
+ } else {
+ if(((BootGuardBootStatus & BIT62) == 0) && // Check for ACM not found in FIT
+ ((BootGuardAcmStatus & B_BOOT_GUARD_ACM_ERRORCODE_MASK) == 0) && // Check for ACM failed to load/run successfully
+ ((BootGuardAcmStatus & BIT31) == 0)) { // Check if ACM Entered
+ DEBUG ((EFI_D_ERROR, "Processor does not support Boot Guard.\n"));
+ return FALSE;
+ } else {
+ DEBUG ((EFI_D_ERROR, "Processor supports Boot Guard.\n"));
+ return TRUE;
+ }
+ }
+}
+
+/**
+ Stop PBE timer if system is in Boot Guard boot
+
+ @retval EFI_SUCCESS - Stop PBE timer
+ @retval EFI_UNSUPPORTED - Not in Boot Guard boot mode.
+**/
+EFI_STATUS
+StopPbeTimer (
+ VOID
+ )
+{
+ UINT64 BootGuardBootStatus;
+ UINT64 BootGuardOperationMode;
+
+ if (IsBootGuardSupported()) {
+ BootGuardBootStatus = (*(UINT64 *) (UINTN) (TXT_PUBLIC_BASE + R_CPU_BOOT_GUARD_BOOTSTATUS) & (BIT63|BIT62));
+ BootGuardOperationMode = AsmReadMsr64 (MSR_BOOT_GUARD_SACM_INFO);
+
+ //
+ // Stop PBET if Verified/Measured/NEM bit is set in MSR 0x13A or
+ // Boot Guard fails to launch or fails to execute successfully for avoiding brick platform
+ //
+
+ if (BootGuardBootStatus == V_CPU_BOOT_GUARD_LOAD_ACM_SUCCESS) {
+ if (BootGuardOperationMode == 0) {
+ DEBUG ((EFI_D_ERROR, "Platform in Legacy boot mode.\n"));
+ return EFI_UNSUPPORTED;
+ } else {
+ DEBUG ((EFI_D_ERROR, "Platform in Boot Guard Boot mode.\n"));
+ }
+ } else {
+ DEBUG ((EFI_D_ERROR, "Boot Guard ACM launch failed or ACM execution failed.\n"));
+ }
+
+ DEBUG ((EFI_D_ERROR, "Disable PBET\n"));
+ AsmWriteMsr64 (MSR_BC_PBEC, B_STOP_PBET);
+ } else {
+ DEBUG ((EFI_D_ERROR, "Boot Guard is not supported.\n"));
+ return EFI_UNSUPPORTED;
+ }
+
+ return EFI_SUCCESS;
+}
+
diff --git a/ReferenceCode/Haswell/Library/CpuPlatformLib.cif b/ReferenceCode/Haswell/Library/CpuPlatformLib.cif
new file mode 100644
index 0000000..7f1e13c
--- /dev/null
+++ b/ReferenceCode/Haswell/Library/CpuPlatformLib.cif
@@ -0,0 +1,12 @@
+<component>
+ name = "CpuPlatformLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Haswell\Library\"
+ RefName = "CpuPlatformLib"
+[files]
+"CpuPlatformLib.sdl"
+"CpuPlatformLib.mak"
+"CpuPlatformLib\CpuPlatformLib.inf"
+"CpuPlatformLib\CpuPlatformLibrary.c"
+"CpuPlatformLib\CpuPlatformLibrary.h"
+<endComponent>
diff --git a/ReferenceCode/Haswell/Library/CpuPlatformLib.mak b/ReferenceCode/Haswell/Library/CpuPlatformLib.mak
new file mode 100644
index 0000000..a9151b4
--- /dev/null
+++ b/ReferenceCode/Haswell/Library/CpuPlatformLib.mak
@@ -0,0 +1,28 @@
+# MAK file for the ModulePart:CpuPlatformLib
+
+$(CpuPlatformLib_LIB) : CpuPlatformLib
+
+CpuPlatformLib : $(BUILD_DIR)\CpuPlatformLib.mak CpuPlatformLibBin
+
+$(BUILD_DIR)\CpuPlatformLib.mak : $(CpuPlatformLib_DIR)\$(@B).cif $(CpuPlatformLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(CpuPlatformLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+CpuPlatformLib_MY_INCLUDES=\
+ $(EDK_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(PROJECT_CPU_INCLUDES)\
+ /I$(PROJECT_CPU_ROOT)\Library\CpuPlatformLib\
+ /I$(INTEL_PCH_DIR)\Include\
+ /I$(INTEL_PCH_DIR)\Include\Library
+
+CpuPlatformLibBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ BUILD_DIR=$(BUILD_DIR) \
+ /f $(BUILD_DIR)\CpuPlatformLib.mak all\
+ "MY_INCLUDES=$(CpuPlatformLib_MY_INCLUDES)" \
+ TYPE=LIBRARY "PARAMETERS=LIBRARY_NAME=$$(CpuPlatformLib_LIB)"
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ BUILD_DIR=$(BUILD_DIR)\IA32 \
+ /f $(BUILD_DIR)\CpuPlatformLib.mak all\
+ "MY_INCLUDES=$(CpuPlatformLib_MY_INCLUDES)" \
+ TYPE=PEI_LIBRARY "PARAMETERS=LIBRARY_NAME=$$(CpuPlatformLib_LIB)"
diff --git a/ReferenceCode/Haswell/Library/CpuPlatformLib.sdl b/ReferenceCode/Haswell/Library/CpuPlatformLib.sdl
new file mode 100644
index 0000000..eb60154
--- /dev/null
+++ b/ReferenceCode/Haswell/Library/CpuPlatformLib.sdl
@@ -0,0 +1,31 @@
+TOKEN
+ Name = CpuPlatformLib_SUPPORT
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable ThunkLib support in Project"
+End
+
+TOKEN
+ Name = "CpuPlatformLib_LIB"
+ Value = "$$(LIB_BUILD_DIR)\CpuPlatformLib.lib"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+PATH
+ Name = "CpuPlatformLib_DIR"
+End
+
+MODULE
+ Help = "Includes ThunkLib.mak to Project"
+ File = "CpuPlatformLib.mak"
+End
+
+ELINK
+ Name = "/I$(CpuPlatformLib_DIR)\CpuPlatformLib"
+ Parent = "PROJECT_CPU_INCLUDES"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/Haswell/Library/CpuPlatformLib/CpuPlatformLib.inf b/ReferenceCode/Haswell/Library/CpuPlatformLib/CpuPlatformLib.inf
new file mode 100644
index 0000000..9a0e283
--- /dev/null
+++ b/ReferenceCode/Haswell/Library/CpuPlatformLib/CpuPlatformLib.inf
@@ -0,0 +1,66 @@
+## @file
+# Component description file for CPU Platform Lib
+#
+#@copyright
+# Copyright (c) 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = CpuPlatformLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ CpuPlatformLibrary.h
+ CpuPlatformLibrary.c
+
+[sources.ia32]
+
+[sources.x64]
+
+[sources.ipf]
+
+[includes.common]
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include/Library
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[libraries.common]
+ PchPlatformLib
+ EdkIIGlueBasePciLibPciExpress
+
+[nmake.common]
diff --git a/ReferenceCode/Haswell/Library/CpuPlatformLib/CpuPlatformLibrary.c b/ReferenceCode/Haswell/Library/CpuPlatformLib/CpuPlatformLibrary.c
new file mode 100644
index 0000000..043bfae
--- /dev/null
+++ b/ReferenceCode/Haswell/Library/CpuPlatformLib/CpuPlatformLibrary.c
@@ -0,0 +1,476 @@
+/** @file
+ CPU Platform Lib implementation.
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "CpuPlatformLibrary.h"
+
+/**
+ Return CPU Family ID
+
+ @retval CPU_FAMILY CPU Family ID
+**/
+CPU_FAMILY
+EFIAPI
+GetCpuFamily (
+ VOID
+ )
+{
+ EFI_CPUID_REGISTER Cpuid;
+ ///
+ /// Read the CPUID information
+ ///
+ AsmCpuid (CPUID_VERSION_INFO, &Cpuid.RegEax, &Cpuid.RegEbx, &Cpuid.RegEcx, &Cpuid.RegEdx);
+ return ((CPU_FAMILY) (Cpuid.RegEax & CPUID_FULL_FAMILY_MODEL));
+}
+
+/**
+ Return Cpu stepping type
+
+ @retval UINT8 Cpu stepping type
+**/
+CPU_STEPPING
+EFIAPI
+GetCpuStepping (
+ VOID
+ )
+{
+ EFI_CPUID_REGISTER Cpuid;
+ ///
+ /// Read the CPUID information
+ ///
+ AsmCpuid (CPUID_VERSION_INFO, &Cpuid.RegEax, &Cpuid.RegEbx, &Cpuid.RegEcx, &Cpuid.RegEdx);
+ return ((CPU_STEPPING) (Cpuid.RegEax & CPUID_FULL_STEPPING));
+}
+
+/**
+ Determine if CPU is supported
+
+ @retval TRUE CPU is supported
+ @retval FALSE CPU is not supported
+**/
+BOOLEAN
+IsCpuSupported (
+ VOID
+ )
+{
+ if (GetCpuFamily() == EnumCpuMax) {
+ return FALSE;
+ }
+ return TRUE;
+}
+
+/**
+ Return CPU Sku
+
+ @retval UINT8 CPU Sku
+**/
+UINT8
+EFIAPI
+GetCpuSku (
+ VOID
+ )
+{
+ UINT8 CpuType;
+ EFI_CPUID_REGISTER Cpuid;
+ ///
+ /// Read the CPUID information
+ ///
+ AsmCpuid (CPUID_VERSION_INFO, &Cpuid.RegEax, &Cpuid.RegEbx, &Cpuid.RegEcx, &Cpuid.RegEdx);
+ switch (Cpuid.RegEax & CPUID_FULL_FAMILY_MODEL) {
+ case CPUID_FULL_FAMILY_MODEL_HASWELL_ULT:
+ CpuType = EnumCpuUlt;
+ break;
+
+ case CPUID_FULL_FAMILY_MODEL_HASWELL:
+ case CPUID_FULL_FAMILY_MODEL_CRYSTALWELL:
+ CpuType = EnumCpuTrad;
+ break;
+
+ default:
+ CpuType = EnumCpuUnknown;
+ DEBUG ((EFI_D_ERROR, "Unsupported CPU SKU, CpuFamilyId: 0x%08X!\n", (Cpuid.RegEax & CPUID_FULL_FAMILY_MODEL)));
+ ASSERT (FALSE);
+ break;
+ }
+
+ return CpuType;
+}
+
+EFI_STATUS
+EFIAPI
+MailboxWrite (
+ IN UINT32 MailboxType,
+ IN UINT32 MailboxCommand,
+ IN UINT32 MailboxData,
+ OUT UINT32 *MailboxStatus
+ )
+/**
+ Generic Mailbox function for mailbox write commands. This function will
+ poll the mailbox interface for control, issue the write request, poll
+ for completion, and verify the write was succussful.
+
+ @param[IN] MailboxType,
+ @param[IN] MailboxCommand,
+ @param[IN] MailboxData,
+ @param[OUT] *MailboxStatus
+
+ @retval EFI_STATUS
+**/
+{
+ EFI_STATUS Status;
+ UINT64 MsrData;
+ UINT32 MchBar;
+ OC_MAILBOX_FULL OcMailboxFull;
+ OC_MAILBOX_FULL OcMailboxFullVerify;
+ PCODE_MAILBOX_FULL PcodeMailboxFull;
+ PCODE_MAILBOX_FULL PcodeMailboxFullVerify;
+
+ ///
+ /// Poll the run/busy to ensure the interface is available
+ ///
+ Status = PollMailboxReady(MailboxType);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ DEBUG ((EFI_D_INFO, "(MAILBOX) Mailbox Write Command = %2X\n", (UINT8)MailboxCommand));
+
+ switch (MailboxType)
+ {
+ case MAILBOX_TYPE_PCODE:
+ ///
+ /// Copy in Mailbox data and write the PCODE mailbox DATA field
+ ///
+ PcodeMailboxFull.Interface.InterfaceData = MailboxCommand;
+ PcodeMailboxFull.Data = MailboxData;
+ MchBar = (MmioRead32 (MmPciAddress (0, 0, 0, 0, MCHBAR_OFFSET)) &~BIT0);
+
+ MmioWrite32 ( (MchBar + PCODE_MAILBOX_DATA_OFFSET), PcodeMailboxFull.Data);
+
+ ///
+ /// Set the Run/Busy bit to signal mailbox data is ready to process
+ ///
+ PcodeMailboxFull.Interface.Fields.RunBusy = 1;
+ MmioWrite32 ( (MchBar + PCODE_MAILBOX_INTERFACE_OFFSET), PcodeMailboxFull.Interface.InterfaceData);
+
+ ///
+ /// Poll run/busy to indicate the completion of write request
+ ///
+ PollMailboxReady(MailboxType);
+
+ ///
+ /// Read the BIOS PCODE mailbox to verify write completion success.
+ /// Mailbox protocol requires software to read back the interface twice
+ /// to ensure the read results are consistent.
+ ///
+ PcodeMailboxFull.Interface.InterfaceData = MmioRead32 (MchBar + PCODE_MAILBOX_INTERFACE_OFFSET);
+ PcodeMailboxFull.Data = MmioRead32 (MchBar + PCODE_MAILBOX_DATA_OFFSET);
+
+ PchPmTimerStall(MAILBOX_READ_TIMEOUT);
+
+ ///
+ /// Read twice to verify data is consitent
+ ///
+ PcodeMailboxFullVerify.Interface.InterfaceData = MmioRead32 (MchBar + PCODE_MAILBOX_INTERFACE_OFFSET);
+ PcodeMailboxFullVerify.Data = MmioRead32 (MchBar + PCODE_MAILBOX_DATA_OFFSET);
+
+ ///
+ /// If the data is inconsistent, we cannot trust the results
+ ///
+ if (PcodeMailboxFull.Interface.InterfaceData != PcodeMailboxFullVerify.Interface.InterfaceData) {
+ if (PcodeMailboxFull.Data != PcodeMailboxFullVerify.Data) {
+ DEBUG ((EFI_D_ERROR, "(MAILBOX) Mailbox read data is corrupted.\n"));
+ return EFI_INVALID_PARAMETER;
+ }
+ }
+
+ ///
+ /// Copy PCODE mailbox completion code
+ ///
+ *MailboxStatus = (UINT32) PcodeMailboxFull.Interface.Fields.Command;
+ break;
+
+ case MAILBOX_TYPE_OC:
+ ///
+ /// Set the Run/Busy bit to signal mailbox data is ready to process
+ ///
+ OcMailboxFull.Interface.InterfaceData = MailboxCommand;
+ OcMailboxFull.Data = MailboxData;
+ OcMailboxFull.Interface.Fields.RunBusy = 1;
+ CopyMem (&MsrData, &OcMailboxFull, sizeof(MsrData));
+
+ ///
+ /// Write mailbox command to OC mailbox
+ ///
+ AsmWriteMsr64 (OC_MAILBOX_MSR, MsrData);
+
+ ///
+ /// Poll run/busy to indicate the completion of write request
+ ///
+ PollMailboxReady(MailboxType);
+
+ ///
+ /// Read the mailbox command from OC mailbox. Read twice to ensure data.
+ ///
+ MsrData = AsmReadMsr64 (OC_MAILBOX_MSR);
+ CopyMem (&OcMailboxFull, &MsrData, sizeof(OcMailboxFull));
+
+ PchPmTimerStall(MAILBOX_READ_TIMEOUT);
+
+ MsrData = AsmReadMsr64 (OC_MAILBOX_MSR);
+ CopyMem (&OcMailboxFullVerify, &MsrData, sizeof(OcMailboxFullVerify));
+
+ ///
+ /// If the data is inconsistent, we cannot trust the results
+ ///
+ if (OcMailboxFull.Interface.InterfaceData != OcMailboxFullVerify.Interface.InterfaceData) {
+ if (OcMailboxFull.Data != OcMailboxFullVerify.Data) {
+ DEBUG ((EFI_D_ERROR, "(MAILBOX) Mailbox read data is corrupted.\n"));
+ return EFI_INVALID_PARAMETER;
+ }
+ }
+
+ ///
+ /// Copy Overclocking mailbox completion code and read results
+ ///
+ *MailboxStatus = OcMailboxFull.Interface.Fields.CommandCompletion;
+ break;
+
+ default:
+ DEBUG ((EFI_D_ERROR, "(MAILBOX) Unrecognized Mailbox Type.\n"));
+ Status = EFI_UNSUPPORTED;
+ break;
+ }
+
+ DEBUG ((EFI_D_INFO, "(MAILBOX) Mailbox Status = %2X\n", *MailboxStatus));
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+MailboxRead (
+ IN UINT32 MailboxType,
+ IN UINT32 MailboxCommand,
+ OUT UINT32 *MailboxDataPtr,
+ OUT UINT32 *MailboxStatus
+ )
+/**
+ Generic Mailbox function for mailbox read commands. This function will write
+ the read request, and populate the read results in the output data.
+
+ @param[IN] MailboxType,
+ @param[IN] MailboxCommand,
+ @param[OUT] *MailboxDataPtr,
+ @param[OUT] *MailboxStatus
+
+ @retval EFI_STATUS
+**/
+{
+ EFI_STATUS Status;
+ UINT64 MsrData;
+ UINT32 MchBar;
+ PCODE_MAILBOX_FULL PcodeMailboxFull;
+ PCODE_MAILBOX_FULL PcodeMailboxFullVerify;
+ OC_MAILBOX_FULL OcMailboxFull;
+ OC_MAILBOX_FULL OcMailboxFullVerify;
+
+ ///
+ /// Poll the run/busy to ensure the interface is available
+ ///
+ Status = PollMailboxReady(MailboxType);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ DEBUG ((EFI_D_INFO, "(MAILBOX) Mailbox Read Command = %2X\n", (UINT8)MailboxCommand));
+
+ switch (MailboxType)
+ {
+ case MAILBOX_TYPE_PCODE:
+ ///
+ /// Write the PCODE mailbox read request.
+ /// Read requests only require a write to the PCODE interface mailbox.
+ /// The read results will be updated in the data mailbox.
+ ///
+ PcodeMailboxFull.Interface.InterfaceData = MailboxCommand;
+ PcodeMailboxFull.Interface.Fields.RunBusy = 1;
+ MchBar = (MmioRead32 (MmPciAddress (0, 0, 0, 0, MCHBAR_OFFSET)) &~BIT0);
+
+ MmioWrite32 ( (MchBar + PCODE_MAILBOX_INTERFACE_OFFSET), PcodeMailboxFull.Interface.InterfaceData);
+
+ ///
+ /// Poll run/busy to indicate the completion of read request
+ ///
+ PollMailboxReady(MailboxType);
+
+ ///
+ /// Read the BIOS PCODE mailbox to verify read completion success.
+ /// Mailbox protocol requires software to read back the interface twice
+ /// to ensure the read results are consistent.
+ ///
+ PcodeMailboxFull.Interface.InterfaceData = MmioRead32 (MchBar + PCODE_MAILBOX_INTERFACE_OFFSET);
+ PcodeMailboxFull.Data = MmioRead32 (MchBar + PCODE_MAILBOX_DATA_OFFSET);
+
+ PchPmTimerStall(MAILBOX_READ_TIMEOUT);
+
+ ///
+ /// Read twice to verify data is consitent
+ ///
+ PcodeMailboxFullVerify.Interface.InterfaceData = MmioRead32 (MchBar + PCODE_MAILBOX_INTERFACE_OFFSET);
+ PcodeMailboxFullVerify.Data = MmioRead32 (MchBar + PCODE_MAILBOX_DATA_OFFSET);
+
+ ///
+ /// If the data is inconsistent, we cannot trust the results
+ ///
+ if (PcodeMailboxFull.Interface.InterfaceData != PcodeMailboxFullVerify.Interface.InterfaceData) {
+ if (PcodeMailboxFull.Data != PcodeMailboxFullVerify.Data) {
+ DEBUG ((EFI_D_ERROR, "(MAILBOX) Mailbox read data is corrupted.\n"));
+ return EFI_INVALID_PARAMETER;
+ }
+ }
+
+ ///
+ /// Copy PCODE mailbox completion code and read results
+ ///
+ *MailboxStatus = (UINT32) PcodeMailboxFull.Interface.InterfaceData;
+ CopyMem(MailboxDataPtr, &PcodeMailboxFull.Data, sizeof(UINT32));
+ break;
+
+ case MAILBOX_TYPE_OC:
+ ///
+ /// Set the Run/Busy bit to signal mailbox data is ready to process
+ ///
+ OcMailboxFull.Interface.InterfaceData = MailboxCommand;
+ OcMailboxFull.Data = *MailboxDataPtr;
+ OcMailboxFull.Interface.Fields.RunBusy = 1;
+ CopyMem (&MsrData, &OcMailboxFull, sizeof(MsrData));
+
+ ///
+ /// Write mailbox command to OC mailbox
+ ///
+ AsmWriteMsr64 (OC_MAILBOX_MSR, MsrData);
+
+ ///
+ /// Poll run/busy to indicate the completion of write request
+ ///
+ PollMailboxReady(MailboxType);
+
+ ///
+ /// Read the OC mailbox to verify read completion success.
+ /// Mailbox protocol requires software to read back the interface twice
+ /// to ensure the read results are consistent.
+ ///
+ MsrData = AsmReadMsr64 (OC_MAILBOX_MSR);
+ CopyMem (&OcMailboxFull, &MsrData, sizeof(OcMailboxFull));
+
+ PchPmTimerStall(MAILBOX_READ_TIMEOUT);
+
+ MsrData = AsmReadMsr64 (OC_MAILBOX_MSR);
+ CopyMem (&OcMailboxFullVerify, &MsrData, sizeof(OcMailboxFullVerify));
+
+ ///
+ /// If the data is inconsistent, we cannot trust the results
+ ///
+ if (OcMailboxFull.Interface.InterfaceData != OcMailboxFullVerify.Interface.InterfaceData) {
+ if (OcMailboxFull.Data != OcMailboxFullVerify.Data) {
+ DEBUG ((EFI_D_ERROR, "(MAILBOX) Mailbox read data is corrupted.\n"));
+ return EFI_INVALID_PARAMETER;
+ }
+ }
+
+ ///
+ /// Copy Overclocking mailbox completion code and read results
+ ///
+ *MailboxStatus = OcMailboxFull.Interface.Fields.CommandCompletion;
+ CopyMem(MailboxDataPtr, &OcMailboxFull.Data, sizeof(UINT32));
+ break;
+
+ default:
+ DEBUG ((EFI_D_ERROR, "(MAILBOX) Unrecognized Mailbox Type.\n"));
+ Status = EFI_UNSUPPORTED;
+ break;
+ }
+
+ DEBUG ((EFI_D_INFO, "(MAILBOX) Mailbox Status = %2X\n", *MailboxStatus));
+
+ return Status;
+}
+
+/**
+ Poll the run/busy bit of the mailbox until available or timeout expires.
+
+ @param[IN] MailboxType,
+
+ @retval EFI_STATUS
+**/
+EFI_STATUS
+EFIAPI
+PollMailboxReady (
+ IN UINT32 MailboxType
+ )
+{
+ EFI_STATUS Status;
+ UINT16 StallCount;
+ UINT8 RunBusyBit;
+ UINT64 MsrData;
+ UINT32 MchBar;
+ OC_MAILBOX_FULL OcMailboxFull;
+ PCODE_MAILBOX_INTERFACE PcodeMailboxInterface;
+
+ Status = EFI_SUCCESS;
+ StallCount = 0;
+ RunBusyBit = 1;
+
+ do {
+ switch (MailboxType)
+ {
+ case MAILBOX_TYPE_PCODE:
+ ///
+ /// Read the MMIO run/busy state
+ ///
+ MchBar = (MmioRead32 (MmPciAddress (0, 0, 0, 0, MCHBAR_OFFSET)) &~BIT0);
+ PcodeMailboxInterface.InterfaceData = MmioRead32 (MchBar + PCODE_MAILBOX_INTERFACE_OFFSET);
+ RunBusyBit = (UINT8) PcodeMailboxInterface.Fields.RunBusy;
+ break;
+
+ case MAILBOX_TYPE_OC:
+ ///
+ /// Read the OC mailbox run/busy state
+ ///
+ MsrData = AsmReadMsr64(OC_MAILBOX_MSR);
+ CopyMem(&OcMailboxFull.Data, &MsrData, sizeof(OcMailboxFull));
+ RunBusyBit = OcMailboxFull.Interface.Fields.RunBusy;
+ break;
+ }
+ //
+ // Wait for 1us
+ //
+ PchPmTimerStall(MAILBOX_WAIT_STALL);
+ StallCount++;
+ }
+ while ((RunBusyBit == 1) && (StallCount < MAILBOX_WAIT_TIMEOUT));
+
+ if ((RunBusyBit == 1) && (StallCount == MAILBOX_WAIT_TIMEOUT)) {
+ DEBUG ((EFI_D_ERROR, "(MAILBOX) Mailbox interface timed out.\n"));
+ Status = EFI_TIMEOUT;
+ }
+ return Status;
+}
+
diff --git a/ReferenceCode/Haswell/Library/CpuPlatformLib/CpuPlatformLibrary.h b/ReferenceCode/Haswell/Library/CpuPlatformLib/CpuPlatformLibrary.h
new file mode 100644
index 0000000..4d5d720
--- /dev/null
+++ b/ReferenceCode/Haswell/Library/CpuPlatformLib/CpuPlatformLibrary.h
@@ -0,0 +1,31 @@
+/** @file
+ Header file for Cpu Platform Lib implementation.
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _CPU_PLATFORM_LIBRARY_IMPLEMENTATION_H_
+#define _CPU_PLATFORM_LIBRARY_IMPLEMENTATION_H_
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueBase.h"
+#include "EdkIIGluePeim.h"
+#include "CpuAccess.h"
+#include "CpuPlatformLib.h"
+#include "PchAccess.h"
+#include "PchPlatformLib.h"
+#endif
+
+#endif
diff --git a/ReferenceCode/Haswell/Library/OcPlatformLib.cif b/ReferenceCode/Haswell/Library/OcPlatformLib.cif
new file mode 100644
index 0000000..7699c9a
--- /dev/null
+++ b/ReferenceCode/Haswell/Library/OcPlatformLib.cif
@@ -0,0 +1,12 @@
+<component>
+ name = "OcPlatformLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Haswell\Library\"
+ RefName = "OcPlatformLib"
+[files]
+"OcPlatformLib.sdl"
+"OcPlatformLib.mak"
+"OverclockingLib\OverclockingLib.inf"
+"OverclockingLib\OverclockingLibrary.c"
+"OverclockingLib\OverclockingLibrary.h"
+<endComponent>
diff --git a/ReferenceCode/Haswell/Library/OcPlatformLib.mak b/ReferenceCode/Haswell/Library/OcPlatformLib.mak
new file mode 100644
index 0000000..512f086
--- /dev/null
+++ b/ReferenceCode/Haswell/Library/OcPlatformLib.mak
@@ -0,0 +1,20 @@
+# MAK file for the ModulePart:CpuPlatformLib
+
+$(OcPlatformLib_LIB) : OcPlatformLib
+
+OcPlatformLib : $(BUILD_DIR)\OcPlatformLib.mak OcPlatformLibBin
+
+$(BUILD_DIR)\OcPlatformLib.mak : $(OcPlatformLib_DIR)\$(@B).cif $(OcPlatformLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(OcPlatformLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+OcPlatformLibBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ BUILD_DIR=$(BUILD_DIR) \
+ /f $(BUILD_DIR)\OcPlatformLib.mak all\
+ "MY_INCLUDES=$(EDK_INCLUDES) $(EdkIIGlueLib_INCLUDES) $(PROJECT_CPU_INCLUDES) $(INTEL_PCH_INCLUDES)" \
+ TYPE=LIBRARY "PARAMETERS=LIBRARY_NAME=$$(OcPlatformLib_LIB)"
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ BUILD_DIR=$(BUILD_DIR)\IA32 \
+ /f $(BUILD_DIR)\OcPlatformLib.mak all\
+ "MY_INCLUDES=$(EDK_INCLUDES) $(EdkIIGlueLib_INCLUDES) $(PROJECT_CPU_INCLUDES) $(INTEL_PCH_INCLUDES)" \
+ TYPE=PEI_LIBRARY "PARAMETERS=LIBRARY_NAME=$$(OcPlatformLib_LIB)"
diff --git a/ReferenceCode/Haswell/Library/OcPlatformLib.sdl b/ReferenceCode/Haswell/Library/OcPlatformLib.sdl
new file mode 100644
index 0000000..bd92181
--- /dev/null
+++ b/ReferenceCode/Haswell/Library/OcPlatformLib.sdl
@@ -0,0 +1,32 @@
+TOKEN
+ Name = OcPlatformLib_SUPPORT
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable OcLib support in Project"
+End
+
+TOKEN
+ Name = "OcPlatformLib_LIB"
+ Value = "$$(LIB_BUILD_DIR)\OcPlatformLib.lib"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+PATH
+ Name = "OcPlatformLib_DIR"
+End
+
+ELINK
+ Name = "/I$(OcPlatformLib_DIR)\OverclockingLib"
+ Parent = "PROJECT_CPU_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+MODULE
+ Help = "Includes OcPlatformLib.mak to Project"
+ File = "OcPlatformLib.mak"
+End
+
diff --git a/ReferenceCode/Haswell/Library/OverclockingLib/OverclockingLib.inf b/ReferenceCode/Haswell/Library/OverclockingLib/OverclockingLib.inf
new file mode 100644
index 0000000..8c286ef
--- /dev/null
+++ b/ReferenceCode/Haswell/Library/OverclockingLib/OverclockingLib.inf
@@ -0,0 +1,69 @@
+## @file
+# Component description file for CPU PPI library.
+#
+#@copyright
+# Copyright (c) 2005 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains an 'Intel Peripheral Driver' and uniquely
+# identified as "Intel Reference Module" and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+
+[defines]
+BASE_NAME = OverclockingLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ OverclockingLibrary.c
+ OverclockingLibrary.h
+
+[includes.common]
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Pei/Include
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include/Library
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Library
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Library/CpuPlatformLib
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+
+#
+# Edk II Glue Library, some hearder are included by R9 header so have to include
+#
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Framework
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[libraries.common]
+ CpuPlatformLib
+
+[nmake.common]
+C_STD_INCLUDE=
+
+
diff --git a/ReferenceCode/Haswell/Library/OverclockingLib/OverclockingLibrary.c b/ReferenceCode/Haswell/Library/OverclockingLib/OverclockingLibrary.c
new file mode 100644
index 0000000..e4576fc
--- /dev/null
+++ b/ReferenceCode/Haswell/Library/OverclockingLib/OverclockingLibrary.c
@@ -0,0 +1,621 @@
+/** @file
+ CPU Platform Lib implementation.
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "OverclockingLibrary.h"
+#include "CpuPlatformLibrary.h"
+
+EFI_STATUS
+EFIAPI
+GetVoltageFrequencyItem (
+ OUT VOLTAGE_FREQUENCY_ITEM *VfSettings,
+ OUT UINT32 *LibStatus
+ )
+/**
+ Gets the Voltage and Frequency information for a given CPU domain
+
+ @param[OUT] *VfSettings
+ @param[OUT] *LibStatus
+
+ @retval EFI_STATUS
+**/
+{
+ EFI_STATUS Status;
+ UINT32 CommandId;
+ UINT16 TempVoltageTarget;
+ INT16 TempVoltageOffset;
+ OC_MAILBOX_ITEM VfMsg;
+
+ Status = EFI_SUCCESS;
+
+ ZeroMem(&VfMsg,sizeof(VfMsg));
+ ///
+ /// Convert v/f command to Mailbox command format
+ ///
+ CommandId = OC_LIB_CMD_GET_VOLTAGE_FREQUENCY;
+
+ ConvertToMailboxFormat((VOID *)VfSettings, &VfMsg, CommandId);
+
+ ///
+ /// Read From the OC Library
+ ///
+ Status = MailboxRead(MAILBOX_TYPE_OC, VfMsg.Interface.InterfaceData, &VfMsg.Data, LibStatus);
+
+ ///
+ /// Copy mailbox data to VfSettings
+ ///
+ if ( (Status == EFI_SUCCESS) && (*LibStatus == OC_LIB_COMPLETION_CODE_SUCCESS)) {
+ VfSettings->VfSettings.MaxOcRatio = (UINT8) (VfMsg.Data & MAX_RATIO_MASK);
+ VfSettings->VfSettings.VoltageTargetMode = (UINT8) ( (VfMsg.Data & VOLTAGE_MODE_MASK) >> VOLTAGE_MODE_OFFSET);
+
+ TempVoltageTarget = (UINT16) (VfMsg.Data & VOLTAGE_TARGET_MASK) >> VOLTAGE_TARGET_OFFSET;
+ ConvertVoltageTarget(TempVoltageTarget, &VfSettings->VfSettings.VoltageTarget, CONVERT_TO_BINARY_MILLIVOLT);
+
+ TempVoltageOffset = (INT16)((VfMsg.Data & VOLTAGE_OFFSET_MASK) >> VOLTAGE_OFFSET_OFFSET);
+ ConvertVoltageOffset(TempVoltageOffset, &VfSettings->VfSettings.VoltageOffset, CONVERT_TO_BINARY_MILLIVOLT);
+ }
+
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+SetVoltageFrequencyItem (
+ IN VOLTAGE_FREQUENCY_ITEM VfSettings,
+ OUT UINT32 *LibStatus
+ )
+/**
+ Sets the Voltage and Frequency information for a given CPU domain
+
+ @param[IN] *VfSettings
+ @param[OUT] *LibStatus
+
+ @retval EFI_STATUS
+**/
+{
+ EFI_STATUS Status;
+ UINT32 CommandId;
+ OC_MAILBOX_ITEM VfMsg;
+
+ Status = EFI_SUCCESS;
+
+ ///
+ /// Convert v/f Commands to Mailbox command format
+ ///
+ CommandId = OC_LIB_CMD_SET_VOLTAGE_FREQUENCY;
+ ConvertToMailboxFormat((VOID *)&VfSettings, &VfMsg, CommandId);
+
+ ///
+ /// Write the v/f Settings to the OC Mailbox
+ ///
+ Status = MailboxWrite(MAILBOX_TYPE_OC, VfMsg.Interface.InterfaceData, VfMsg.Data, LibStatus);
+
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+GetFivrConfig (
+ OUT GLOBAL_CONFIG_ITEM *FivrConfig,
+ OUT UINT32 *LibStatus
+ )
+/**
+ Get the global FIVR Configuration information
+
+ @param[OUT] *FivrConfig
+ @param[OUT] *LibStatus
+
+ @retval EFI_STATUS
+**/
+{
+ EFI_STATUS Status;
+ UINT32 CommandId;
+ OC_MAILBOX_ITEM FivrMsg;
+
+ Status = EFI_SUCCESS;
+ ZeroMem(&FivrMsg, sizeof(FivrMsg));
+
+ ///
+ /// Convert FIVR message to Mailbox command format
+ ///
+ CommandId = OC_LIB_CMD_GET_GLOBAL_CONFIG;
+ ConvertToMailboxFormat((VOID *)FivrConfig, &FivrMsg, CommandId);
+
+ ///
+ /// Read From the OC Library
+ ///
+ Status = MailboxRead(MAILBOX_TYPE_OC, FivrMsg.Interface.InterfaceData, &FivrMsg.Data, LibStatus);
+
+ ///
+ /// Copy mailbox data to FivrConfig
+ ///
+ if ( (Status == EFI_SUCCESS) && (*LibStatus == OC_LIB_COMPLETION_CODE_SUCCESS)) {
+ FivrConfig->DisableFivrFaults = FivrMsg.Data & FIVR_FAULTS_MASK;
+ FivrConfig->DisableFivrEfficiency = (FivrMsg.Data & FIVR_EFFICIENCY_MASK) >> FIVR_EFFICIENCY_OFFSET;
+ }
+
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+SetFivrConfig (
+ IN GLOBAL_CONFIG_ITEM FivrConfig,
+ OUT UINT32 *LibStatus
+ )
+/**
+ Set the Global FIVR Configuration information
+
+ @param[IN] FivrConfig
+ @param[OUT] *LibStatus
+
+ @retval EFI_STATUS
+**/
+{
+ EFI_STATUS Status;
+ UINT32 CommandId;
+ OC_MAILBOX_ITEM FivrMsg;
+
+ Status = EFI_SUCCESS;
+
+ ///
+ /// Convert FIVR Command to Mailbox command format
+ ///
+ CommandId = OC_LIB_CMD_SET_GLOBAL_CONFIG;
+ ConvertToMailboxFormat((VOID *)&FivrConfig, &FivrMsg, CommandId);
+
+ ///
+ /// Write the FIVR Settings to the OC Mailbox
+ ///
+ Status = MailboxWrite(MAILBOX_TYPE_OC, FivrMsg.Interface.InterfaceData, FivrMsg.Data, LibStatus);
+
+ return Status;
+
+}
+
+EFI_STATUS
+EFIAPI
+GetSvidConfig (
+ OUT SVID_CONFIG_ITEM *SvidConfig,
+ OUT UINT32 *LibStatus
+ )
+/**
+ Get the SVID Configuration information
+
+ @param[OUT] *SvidConfig
+ @param[OUT] *LibStatus
+
+ @retval EFI_STATUS
+**/
+{
+ EFI_STATUS Status;
+ UINT32 CommandId;
+ OC_MAILBOX_ITEM SvidMsg;
+
+ Status = EFI_SUCCESS;
+ ZeroMem(&SvidMsg, sizeof(SvidMsg));
+
+ ///
+ /// Convert SVID message to Mailbox command format
+ ///
+ CommandId = OC_LIB_CMD_GET_SVID_CONFIG;
+ ConvertToMailboxFormat((VOID *)SvidConfig, &SvidMsg, CommandId);
+
+ ///
+ /// Read From the OC Library
+ ///
+ Status = MailboxRead(MAILBOX_TYPE_OC, SvidMsg.Interface.InterfaceData, &SvidMsg.Data, LibStatus);
+
+ ///
+ /// Copy mailbox data to SvidConfig
+ ///
+ if ( (Status == EFI_SUCCESS) && (*LibStatus == OC_LIB_COMPLETION_CODE_SUCCESS)) {
+ SvidConfig->VoltageTarget = (UINT16) SvidMsg.Data & SVID_VOLTAGE_MASK;
+ SvidConfig->SvidDisable = (UINT8) ((SvidMsg.Data & SVID_DISABLE_MASK) >> SVID_DISABLE_OFFSET);
+ }
+
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+SetSvidConfig (
+ IN SVID_CONFIG_ITEM SvidConfig,
+ OUT UINT32 *LibStatus
+ )
+/**
+ Set the SVID Configuration information
+
+ @param[IN] SvidConfig
+ @param[OUT] *LibStatus
+
+ @retval EFI_STATUS
+**/
+{
+ EFI_STATUS Status;
+ UINT32 CommandId;
+ OC_MAILBOX_ITEM SvidMsg;
+
+ Status = EFI_SUCCESS;
+
+ ///
+ /// Convert SVID Commands to Mailbox command format
+ ///
+ CommandId = OC_LIB_CMD_SET_SVID_CONFIG;
+ ConvertToMailboxFormat((VOID *)&SvidConfig, &SvidMsg, CommandId);
+
+ ///
+ /// Write the Svid Settings to the OC Mailbox
+ ///
+ Status = MailboxWrite(MAILBOX_TYPE_OC, SvidMsg.Interface.InterfaceData, SvidMsg.Data, LibStatus);
+
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+GetOcCapabilities (
+ OUT OC_CAPABILITIES_ITEM *OcCapabilities,
+ OUT UINT32 *LibStatus
+ )
+/**
+ Get the overclocking capabilities for a given CPU Domain
+
+ @param[OUT] *OcCapabilities
+ @param[OUT] *LibStatus
+
+ @retval EFI_STATUS
+**/
+{
+ EFI_STATUS Status;
+ UINT32 CommandId;
+ OC_MAILBOX_ITEM OcCapsMsg;
+
+ Status = EFI_SUCCESS;
+
+ ZeroMem(&OcCapsMsg,sizeof(OC_MAILBOX_ITEM));
+
+ ///
+ /// Convert OC capabilties message to Mailbox command format
+ ///
+ CommandId = OC_LIB_CMD_GET_OC_CAPABILITIES;
+ ConvertToMailboxFormat((VOID *)OcCapabilities, &OcCapsMsg, CommandId);
+
+ ///
+ /// Read From the OC Library
+ ///
+ Status = MailboxRead(MAILBOX_TYPE_OC, OcCapsMsg.Interface.InterfaceData, &OcCapsMsg.Data, LibStatus);
+
+ ///
+ /// Copy mailbox data to OC Capabilities structure
+ ///
+ if ( (Status == EFI_SUCCESS) && (*LibStatus == OC_LIB_COMPLETION_CODE_SUCCESS)) {
+ OcCapabilities->MaxOcRatioLimit =
+ (UINT8) OcCapsMsg.Data & OC_CAPS_MAX_RATIO_MASK;
+
+ OcCapabilities->RatioOcSupported =
+ (UINT8) ((OcCapsMsg.Data & OC_CAPS_RATIO_SUPPORT_MASK) >> OC_CAPS_RATIO_SUPPORT_OFFSET);
+
+ OcCapabilities->VoltageOverridesSupported =
+ (UINT8) ((OcCapsMsg.Data & OC_CAPS_OVERRIDE_SUPPORT_MASK) >> OC_CAPS_OVERRIDE_SUPPORT_OFFSET);
+
+ OcCapabilities->VoltageOffsetSupported =
+ (UINT8) ((OcCapsMsg.Data & OC_CAPS_OFFSET_SUPPORT_MASK) >> OC_CAPS_OFFSET_SUPPORT_OFFSET);
+ }
+
+ return Status;
+}
+
+VOID
+ConvertVoltageTarget (
+ IN UINT16 InputVoltageTarget,
+ OUT UINT16 *OutputVoltageTarget,
+ IN UINT8 ConversionType
+ )
+/**
+ Converts the input voltage target to the fixed point U12.2.10 Volt format or
+ the Binary millivolts representation based on the ConversionType
+
+@param[IN] InputVoltageTarget
+@param[OUT] *OutputVoltageTarget
+@param[IN] ConversionType - 0:fixed point, 1:Binary millivolts
+**/
+{
+UINT32 Remainder;
+ /// Fixed point representation:
+ ///
+ /// U12.2.10V format
+ /// | | | |
+ /// | | | v
+ /// | | v Exponent
+ /// | v Significand Size
+ /// v Size
+ /// Signed/Unsigned
+ ///
+ /// Float Value = Significand x (Base ^ Exponent)
+ /// (Base ^ Exponent) = 2 ^ 10 = 1024
+ ///
+ Remainder = 0;
+
+ if (InputVoltageTarget == 0) {
+ *OutputVoltageTarget = 0;
+ return;
+ }
+
+ if (ConversionType == CONVERT_TO_FIXED_POINT_VOLTS) {
+ ///
+ /// Input Voltage is in number of millivolts. Clip the input Voltage
+ /// to the max allowed by the fixed point format
+ ///
+ if (InputVoltageTarget > MAX_TARGET_MV)
+ InputVoltageTarget = MAX_TARGET_MV;
+
+ ///
+ /// InputTargetVoltage is the significand in mV. Need to convert to Volts
+ ///
+ *OutputVoltageTarget = (UINT16) DivU64x32Remainder (
+ (UINT64) (InputVoltageTarget * 1024), MILLIVOLTS_PER_VOLT,&Remainder);
+
+ if (Remainder >= 500) {
+ *OutputVoltageTarget += 1;
+ }
+ } else if (ConversionType == CONVERT_TO_BINARY_MILLIVOLT) {
+ ///
+ /// InputVoltage is specified in fixed point representation, need to
+ /// convert to millivolts
+ ///
+ *OutputVoltageTarget = (UINT16) DivU64x32Remainder (
+ (UINT64) (InputVoltageTarget * MILLIVOLTS_PER_VOLT), 1024,&Remainder);
+
+ if (Remainder >= 500) {
+ *OutputVoltageTarget += 1;
+ }
+ }
+
+ return;
+}
+
+VOID
+ConvertVoltageOffset (
+ IN INT16 InputVoltageOffset,
+ OUT INT16 *OutputVoltageOffset,
+ IN UINT8 ConversionType
+ )
+/**
+ Converts the input votlage Offset to the fixed point S11.0.10 Volt format or
+ to Binary illivolts representation based on the ConversionType.
+
+@param[IN] InputVoltageTarget
+@param[OUT] *OutputVoltageTarget
+@param[IN] ConversionType - 0:fixed point, 1:Signed Binary millivolts
+**/
+{
+ BOOLEAN NumIsNegative;
+ UINT32 Remainder;
+ /// Fixed point representation:
+ ///
+ /// S11.0.10V format
+ /// | | | |
+ /// | | | v
+ /// | | v Exponent
+ /// | v Significand Size
+ /// v Size
+ /// Signed/Unsigned
+ ///
+ /// Float Value = Significand x (Base ^ Exponent)
+ /// (Base ^ Exponent) = 2 ^ 10 = 1024
+ ///
+ *OutputVoltageOffset = 0;
+ NumIsNegative = FALSE;
+ Remainder = 0;
+
+ if (InputVoltageOffset == 0) {
+ *OutputVoltageOffset = 0;
+ return;
+ }
+
+ if (ConversionType == CONVERT_TO_FIXED_POINT_VOLTS) {
+ ///
+ /// Input Voltage is in INT16 representation. Check if numenr is negative
+ ///
+ if ( (InputVoltageOffset & INT16_SIGN_BIT_MASK) != 0) {
+ NumIsNegative = TRUE;
+ ///
+ /// Need to 2's complement adjust to make this number positive for
+ /// voltage calculation
+ ///
+ InputVoltageOffset = (~InputVoltageOffset+1) & (INT16_SIGN_BIT_MASK -1);
+ }
+
+ ///
+ /// Clip the input Voltage Offset to 500mv
+ ///
+ if (InputVoltageOffset > MAX_OFFSET_MV) {
+ InputVoltageOffset = MAX_OFFSET_MV;
+ }
+
+ ///
+ /// Convert to fixed point representation
+ ///
+ *OutputVoltageOffset = (UINT16) DivU64x32Remainder (
+ (UINT64) (InputVoltageOffset * 1024), MILLIVOLTS_PER_VOLT,&Remainder);
+
+ if (Remainder >= 500) {
+ *OutputVoltageOffset += 1;
+ }
+
+ if (NumIsNegative) {
+ /// 2's complement back to a negative number
+ *OutputVoltageOffset = ~(*OutputVoltageOffset) + 1;
+ }
+ } else if (ConversionType == CONVERT_TO_BINARY_MILLIVOLT) {
+ ///
+ /// Input Voltage is in fixed point representation. Check if number negative
+ ///
+ if ( (InputVoltageOffset & FIXED_POINT_SIGN_BIT_MASK)!= 0) {
+ NumIsNegative = TRUE;
+ ///
+ /// Need to 2's complement adjust to make this number positive for
+ /// voltage calculation
+ ///
+ InputVoltageOffset = (~InputVoltageOffset+1) & (FIXED_POINT_SIGN_BIT_MASK -1);
+ }
+
+ ///
+ /// Convert to INT16 representation in millivolts
+ ///
+ *OutputVoltageOffset = (UINT16) DivU64x32Remainder (
+ (UINT64) (InputVoltageOffset * MILLIVOLTS_PER_VOLT), 1024,&Remainder);
+
+ if (Remainder >= 500) {
+ *OutputVoltageOffset += 1;
+ }
+
+ if (NumIsNegative) {
+ /// 2's complement back to a negative number
+ *OutputVoltageOffset = ~(*OutputVoltageOffset) + 1;
+ }
+ }
+
+ return;
+}
+
+VOID
+ConvertToMailboxFormat (
+ IN VOID *InputData,
+ OUT OC_MAILBOX_ITEM *MailboxData,
+ IN UINT32 CommandId
+ )
+/**
+ Converts the input data to valid mailbox command format based on CommandID
+
+@param[IN] InputData
+@param[OUT] *MailboxData
+@param[IN] CommandId
+**/
+{
+ VOLTAGE_FREQUENCY_ITEM *VfItem;
+ SVID_CONFIG_ITEM *SvidItem;
+ OC_CAPABILITIES_ITEM *OcCapItem;
+ CORE_RATIO_LIMITS_ITEM *CoreRatioItem;
+ GLOBAL_CONFIG_ITEM *GlobalConfigItem;
+ VF_MAILBOX_COMMAND_DATA VfMailboxCommandData;
+ UINT16 TempVoltage;
+
+ ///
+ /// Initialize local varaibles and mailbox data
+ ///
+ ZeroMem ((UINT32 *)MailboxData, sizeof(OC_MAILBOX_ITEM));
+
+ ///
+ /// Then make a decision based on CommandId how to format
+ ///
+ switch (CommandId) {
+ case OC_LIB_CMD_GET_OC_CAPABILITIES:
+ OcCapItem = (OC_CAPABILITIES_ITEM *) InputData;
+ ///
+ /// OC Capabilities are returned on a per domain basis
+ ///
+ MailboxData->Data = 0;
+ MailboxData->Interface.Fields.CommandCompletion = OC_LIB_CMD_GET_OC_CAPABILITIES;
+ MailboxData->Interface.Fields.Param1 = OcCapItem->DomainId;
+ break;
+
+ case OC_LIB_CMD_GET_PER_CORE_RATIO_LIMIT:
+ CoreRatioItem = (CORE_RATIO_LIMITS_ITEM *) InputData;
+ ///
+ /// Core Ratio Limits are only valid in the IA Core domain
+ ///
+ MailboxData->Data = 0;
+ MailboxData->Interface.Fields.CommandCompletion = OC_LIB_CMD_GET_PER_CORE_RATIO_LIMIT;
+ MailboxData->Interface.Fields.Param1 = OC_LIB_DOMAIN_ID_IA_CORE;
+ MailboxData->Interface.Fields.Param2 = CoreRatioItem->Index;
+ break;
+
+ case OC_LIB_CMD_GET_VOLTAGE_FREQUENCY:
+ VfItem = (VOLTAGE_FREQUENCY_ITEM *) InputData;
+ ///
+ /// Voltage Frequency Settings are on a per domain basis
+ ///
+ MailboxData->Data = 0;
+ MailboxData->Interface.Fields.CommandCompletion = OC_LIB_CMD_GET_VOLTAGE_FREQUENCY;
+ MailboxData->Interface.Fields.Param1 = VfItem->DomainId;
+ break;
+
+ case OC_LIB_CMD_SET_VOLTAGE_FREQUENCY:
+ VfItem = (VOLTAGE_FREQUENCY_ITEM *) InputData;
+ ///
+ /// Voltages are stored in a fixed point format
+ ///
+ VfMailboxCommandData.MaxOcRatio = VfItem->VfSettings.MaxOcRatio;
+
+ TempVoltage = 0;
+ ConvertVoltageTarget(VfItem->VfSettings.VoltageTarget, &TempVoltage, CONVERT_TO_FIXED_POINT_VOLTS);
+ VfMailboxCommandData.VoltageTargetU12 = TempVoltage;
+
+ VfMailboxCommandData.TargetMode = VfItem->VfSettings.VoltageTargetMode;
+
+ TempVoltage = 0;
+ ConvertVoltageOffset(VfItem->VfSettings.VoltageOffset, (INT16 *) &TempVoltage, CONVERT_TO_FIXED_POINT_VOLTS);
+ VfMailboxCommandData.VoltageOffsetS11 = TempVoltage;
+
+ CopyMem(&MailboxData->Data, &VfMailboxCommandData, sizeof(VfMailboxCommandData));
+ MailboxData->Interface.Fields.CommandCompletion = OC_LIB_CMD_SET_VOLTAGE_FREQUENCY;
+ MailboxData->Interface.Fields.Param1 = VfItem->DomainId;
+ break;
+
+ case OC_LIB_CMD_GET_SVID_CONFIG:
+ MailboxData->Data = 0;
+ MailboxData->Interface.Fields.CommandCompletion = OC_LIB_CMD_GET_SVID_CONFIG;
+ MailboxData->Interface.Fields.Param1 = 0;
+ break;
+
+ case OC_LIB_CMD_SET_SVID_CONFIG:
+ SvidItem = (SVID_CONFIG_ITEM *) InputData;
+ ConvertVoltageTarget(SvidItem->VoltageTarget, &TempVoltage, CONVERT_TO_FIXED_POINT_VOLTS);
+ MailboxData->Data = TempVoltage | (SvidItem->SvidDisable << SVID_DISABLE_OFFSET);
+ MailboxData->Interface.Fields.CommandCompletion = OC_LIB_CMD_SET_SVID_CONFIG;
+ MailboxData->Interface.Fields.Param1 = 0;
+ break;
+
+ case OC_LIB_CMD_GET_GLOBAL_CONFIG:
+ MailboxData->Data = 0;
+ MailboxData->Interface.Fields.CommandCompletion = OC_LIB_CMD_GET_GLOBAL_CONFIG;
+ MailboxData->Interface.Fields.Param1 = 0;
+ break;
+
+ case OC_LIB_CMD_SET_GLOBAL_CONFIG:
+ GlobalConfigItem = (GLOBAL_CONFIG_ITEM *) InputData;
+ MailboxData->Data =
+ (GlobalConfigItem->DisableFivrFaults & BIT0_MASK) |
+ ((GlobalConfigItem->DisableFivrEfficiency & BIT0_MASK) << FIVR_EFFICIENCY_OFFSET);
+ MailboxData->Interface.Fields.CommandCompletion = OC_LIB_CMD_SET_GLOBAL_CONFIG;
+ MailboxData->Interface.Fields.Param1 = 0;
+ break;
+
+ default:
+ DEBUG ((EFI_D_ERROR, "(OC MAILBOX) Unknown Command ID\n"));
+
+ break;
+
+ }
+
+}
+
diff --git a/ReferenceCode/Haswell/Library/OverclockingLib/OverclockingLibrary.h b/ReferenceCode/Haswell/Library/OverclockingLib/OverclockingLibrary.h
new file mode 100644
index 0000000..fd32d1f
--- /dev/null
+++ b/ReferenceCode/Haswell/Library/OverclockingLib/OverclockingLibrary.h
@@ -0,0 +1,352 @@
+/** @file
+ Header file for Cpu Platform Lib implementation.
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _OVERCLOCKING_LIBRARY_H_
+#define _OVERCLOCKING_LIBRARY_H_
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueBase.h"
+#endif
+
+//
+// OC Mailbox MSR
+//
+#define MSR_OC_MAILBOX 0x00000150
+#define OC_LIB_WAIT_TIMEOUT 5000 ///< 5 milliseconds
+
+//
+// OC Mailbox commands
+//
+#define OC_LIB_CMD_GET_OC_CAPABILITIES 0x01
+#define OC_LIB_CMD_GET_PER_CORE_RATIO_LIMIT 0x02
+#define OC_LIB_CMD_GET_VOLTAGE_FREQUENCY 0x10
+#define OC_LIB_CMD_SET_VOLTAGE_FREQUENCY 0x11
+#define OC_LIB_CMD_GET_SVID_CONFIG 0x12
+#define OC_LIB_CMD_SET_SVID_CONFIG 0x13
+#define OC_LIB_CMD_GET_GLOBAL_CONFIG 0x14
+#define OC_LIB_CMD_SET_GLOBAL_CONFIG 0x15
+
+//
+// OC Mailbox completion codes
+//
+#define OC_LIB_COMPLETION_CODE_SUCCESS 0x00
+#define OC_LIB_COMPLETION_CODE_OC_LOCKED 0x01
+#define OC_LIB_COMPLETION_CODE_INVALID_DOMAIN 0x02
+#define OC_LIB_COMPLETION_CODE_MAX_RATIO_EXCEEDED 0x03
+#define OC_LIB_COMPLETION_CODE_MAX_VOLTAGE_EXCEEDED 0x04
+#define OC_LIB_COMPLETION_CODE_OC_NOT_SUPPORTED 0x05
+#define OC_LIB_COMPLETION_CODE_WRITE_FAILED 0x06
+#define OC_LIB_COMPLETION_CODE_READ_FAILED 0x07
+
+//
+// Domain ID definitions
+//
+#define OC_LIB_DOMAIN_ID_IA_CORE 0x00
+#define OC_LIB_DOMAIN_ID_GT 0x01
+#define OC_LIB_DOMAIN_ID_CLR 0x02
+#define OC_LIB_DOMAIN_ID_UNCORE 0x03
+#define OC_LIB_DOMAIN_ID_IOA 0x04
+#define OC_LIB_DOMAIN_ID_IOD 0x05
+
+//
+// Bit 10 is the S11.0.10V sign bit
+//
+#define FIXED_POINT_SIGN_BIT_MASK 0x0400
+#define INT16_SIGN_BIT_MASK 0x8000
+
+//
+// Voltage Conversion defines
+//
+#define MILLIVOLTS_PER_VOLT 1000
+#define MAX_TARGET_MV 4095
+#define MAX_OFFSET_MV 500
+
+#define CONVERT_TO_FIXED_POINT_VOLTS 0
+#define CONVERT_TO_BINARY_MILLIVOLT 1
+
+//
+// Masks and offsets
+//
+#define BIT0_MASK 0x1
+#define MAX_RATIO_MASK 0x000000FF
+#define VOLTAGE_TARGET_MASK 0x000FFF00
+#define VOLTAGE_TARGET_OFFSET 8
+#define VOLTAGE_MODE_MASK 0x00100000
+#define VOLTAGE_MODE_OFFSET 20
+#define VOLTAGE_OFFSET_MASK 0xFFE00000
+#define VOLTAGE_OFFSET_OFFSET 21
+
+#define SVID_DISABLE_MASK 0x80000000
+#define SVID_DISABLE_OFFSET 31
+#define SVID_VOLTAGE_MASK 0x00000FFF
+
+#define FIVR_FAULTS_MASK 0x00000001
+#define FIVR_EFFICIENCY_MASK 0x00000002
+#define FIVR_EFFICIENCY_OFFSET 1
+
+#define OC_CAPS_MAX_RATIO_MASK 0x000000FF
+#define OC_CAPS_RATIO_SUPPORT_MASK 0x00000100
+#define OC_CAPS_RATIO_SUPPORT_OFFSET 8
+#define OC_CAPS_OVERRIDE_SUPPORT_MASK 0x00000200
+#define OC_CAPS_OVERRIDE_SUPPORT_OFFSET 9
+#define OC_CAPS_OFFSET_SUPPORT_MASK 0x00000400
+#define OC_CAPS_OFFSET_SUPPORT_OFFSET 10
+
+//
+// Voltage offset definitions
+//
+#define OC_LIB_OFFSET_ADAPTIVE 0
+#define OC_LIB_OFFSET_OVERRIDE 1
+#define OC_LIB_VOLTAGE_DO_NOT_UPDATE 0xFFFF
+
+///
+/// OC Library structures
+///
+typedef struct {
+ UINT32 CommandData;
+ UINT8 CommandCompletion : 8;
+ UINT8 Param1 : 8;
+ UINT8 Param2 : 8;
+ UINT8 Reserved : 7;
+ UINT8 RunBusy : 1;
+} OC_LIBRARY_COMMAND;
+
+typedef union _OC_MAILBOX_COMMAND {
+ UINT32 InterfaceData;
+ struct {
+ UINT8 CommandCompletion : 8;
+ UINT8 Param1 : 8;
+ UINT8 Param2 : 8;
+ UINT8 Reserved : 7;
+ UINT8 RunBusy : 1;
+ } Fields;
+} OC_MAILBOX_COMMAND;
+
+typedef struct _OC_MAILBOX_ITEM {
+ UINT32 Data;
+ OC_MAILBOX_COMMAND Interface;
+} OC_MAILBOX_ITEM;
+
+typedef struct {
+ UINT8 MaxOcRatio;
+ UINT8 VoltageTargetMode;
+ UINT16 VoltageTarget;
+ INT16 VoltageOffset;
+} VOLTAGE_FREQUENCY_SETTINGS;
+
+typedef struct {
+ VOLTAGE_FREQUENCY_SETTINGS VfSettings;
+ UINT8 DomainId;
+} VOLTAGE_FREQUENCY_ITEM;
+
+typedef enum {
+ IaCore,
+ Gt,
+ Clr,
+ Uncore
+} CPU_DOMAIN_ID;
+
+typedef struct {
+ UINT16 VoltageTarget;
+ BOOLEAN SvidDisable;
+} SVID_CONFIG_ITEM;
+
+typedef struct {
+ UINT8 MaxOcRatioLimit;
+ BOOLEAN RatioOcSupported;
+ BOOLEAN VoltageOverridesSupported;
+ BOOLEAN VoltageOffsetSupported;
+ UINT8 DomainId;
+} OC_CAPABILITIES_ITEM;
+
+typedef struct {
+ UINT8 MaxOcRatioLimit1C;
+ UINT8 MaxOcRatioLimit2C;
+ UINT8 MaxOcRatioLimit3C;
+ UINT8 MaxOcRatioLimit4C;
+ UINT8 Index;
+} CORE_RATIO_LIMITS_ITEM;
+
+typedef struct {
+ UINT8 DisableFivrFaults;
+ UINT8 DisableFivrEfficiency;
+} GLOBAL_CONFIG_ITEM;
+
+typedef struct {
+ UINT32 MaxOcRatio : 8;
+ UINT32 VoltageTargetU12 : 12;
+ UINT32 TargetMode : 1;
+ UINT32 VoltageOffsetS11 : 11;
+} VF_MAILBOX_COMMAND_DATA;
+
+///
+/// OC Library Function Prototypes
+///
+EFI_STATUS
+EFIAPI GetVoltageFrequencyItem (
+ OUT VOLTAGE_FREQUENCY_ITEM *VfSettings,
+ OUT UINT32 *LibStatus
+ )
+/**
+ Gets the Voltage and Frequency information for a given CPU domain
+
+ @param[OUT] *VfSettings
+ @param[OUT] *LibStatus
+
+ @retval EFI_STATUS
+**/
+;
+
+EFI_STATUS
+EFIAPI SetVoltageFrequencyItem (
+ IN VOLTAGE_FREQUENCY_ITEM VfSettings,
+ OUT UINT32 *LibStatus
+ )
+/**
+ Sets the Voltage and Frequency information for a given CPU domain
+
+ @param[IN] *VfSettings
+ @param[OUT] *LibStatus
+
+ @retval EFI_STATUS
+**/
+;
+
+EFI_STATUS
+EFIAPI GetFivrConfig (
+ OUT GLOBAL_CONFIG_ITEM *FivrConfig,
+ OUT UINT32 *LibStatus
+ )
+/**
+ Get the global FIVR Configuration information
+
+ @param[OUT] *FivrConfig
+ @param[OUT] *LibStatus
+
+ @retval EFI_STATUS
+**/
+;
+
+EFI_STATUS
+EFIAPI SetFivrConfig (
+ IN GLOBAL_CONFIG_ITEM FivrConfig,
+ OUT UINT32 *LibStatus
+ )
+/**
+ Set the Global FIVR Configuration information
+
+ @param[IN] FivrConfig
+ @param[OUT] *LibStatus
+
+ @retval EFI_STATUS
+**/
+;
+
+EFI_STATUS
+EFIAPI GetSvidConfig (
+ OUT SVID_CONFIG_ITEM *SvidConfig,
+ OUT UINT32 *LibStatus
+ )
+/**
+ Get the SVID Configuration information
+
+ @param[OUT] *SvidConfig
+ @param[OUT] *LibStatus
+
+ @retval EFI_STATUS
+**/
+;
+
+EFI_STATUS
+EFIAPI SetSvidConfig (
+ IN SVID_CONFIG_ITEM SvidConfig,
+ OUT UINT32 *LibStatus
+ )
+/**
+ Set the SVID Configuration information
+
+ @param[IN] SvidConfig
+ @param[OUT] *LibStatus
+
+ @retval EFI_STATUS
+**/
+;
+
+EFI_STATUS
+EFIAPI GetOcCapabilities (
+ OUT OC_CAPABILITIES_ITEM *OcCapabilities,
+ OUT UINT32 *LibStatus
+ )
+/**
+ Get the overclocking capabilities for a given CPU Domain
+
+ @param[OUT] *OcCapabilities
+ @param[OUT] *LibStatus
+
+ @retval EFI_STATUS
+**/
+;
+
+VOID
+ConvertVoltageTarget (
+ IN UINT16 InputVoltageTarget,
+ OUT UINT16 *OutputVoltageTarget,
+ IN UINT8 ConversionType
+ )
+/**
+ Converts the input voltage target to the fixed point U12.2.10 Volt format or
+ the Binary millivolts representation based on the ConversionType
+
+@param[IN] InputVoltageTarget
+@param[OUT] *OutputVoltageTarget
+@param[IN] ConversionType - 0:fixed point, 1:Binary millivolts
+**/
+;
+
+VOID
+ConvertVoltageOffset (
+ IN INT16 InputVoltageOffset,
+ OUT INT16 *OutputVoltageOffset,
+ IN UINT8 ConversionType
+ )
+/**
+ Converts the input votlage Offset to the fixed point S11.0.10 Volt format or
+ to Binary illivolts representation based on the ConversionType.
+
+@param[IN] InputVoltageTarget
+@param[OUT] *OutputVoltageTarget
+@param[IN] ConversionType - 0:fixed point, 1:Signed Binary millivolts
+**/
+;
+
+VOID
+ConvertToMailboxFormat (
+ IN VOID *InputData,
+ OUT OC_MAILBOX_ITEM *MailboxData,
+ IN UINT32 CommandId
+ )
+/**
+ Converts the input data to valid mailbox command format based on CommandID
+
+@param[IN] InputData
+@param[OUT] *MailboxData
+@param[IN] CommandId
+**/
+;
+
+#endif
diff --git a/ReferenceCode/Haswell/Library/ThunkLib.cif b/ReferenceCode/Haswell/Library/ThunkLib.cif
new file mode 100644
index 0000000..f8eda34
--- /dev/null
+++ b/ReferenceCode/Haswell/Library/ThunkLib.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "ThunkLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Haswell\Library\"
+ RefName = "ThunkLib"
+[files]
+"ThunkLib.sdl"
+"ThunkLib.mak"
+"ThunkLib\ThunkLib.inf"
+[parts]
+"ThunkLibIa32"
+"ThunkLibx64"
+<endComponent>
diff --git a/ReferenceCode/Haswell/Library/ThunkLib.mak b/ReferenceCode/Haswell/Library/ThunkLib.mak
new file mode 100644
index 0000000..ead3c5e
--- /dev/null
+++ b/ReferenceCode/Haswell/Library/ThunkLib.mak
@@ -0,0 +1,40 @@
+# MAK file for the ModulePart:ThunkLib
+ThunkLib_x64_OBJECTS =\
+$(BUILD_DIR)\ReferenceCode\IvyBridgeRc\Library\ThunkLib\x64\x86Thunk.obj\
+$(BUILD_DIR)\ReferenceCode\IvyBridgeRc\Library\ThunkLib\x64\Thunk16.obj\
+$(BUILD_DIR)\ReferenceCode\IvyBridgeRc\Library\ThunkLib\x64\FxSave.obj\
+$(BUILD_DIR)\ReferenceCode\IvyBridgeRc\Library\ThunkLib\x64\FxRestore.obj
+
+ThunkLib_IA32_OBJECTS =\
+$(BUILD_DIR)\IA32\ReferenceCode\IvyBridgeRc\Library\ThunkLib\Ia32\x86Thunk.obj\
+$(BUILD_DIR)\IA32\ReferenceCode\IvyBridgeRc\Library\ThunkLib\Ia32\Thunk16.obj
+
+ThunkLib_PORCESSOR_Ia32_CIF=$(ThunkLib_DIR)\ThunkLib\Ia32\ThunkLibIa32.cif
+ThunkLib_PORCESSOR_x64_CIF=$(ThunkLib_DIR)\ThunkLib\x64\ThunkLibx64.cif
+
+$(ThunkLib_LIB) : ThunkLib
+
+ThunkLib : $(BUILD_DIR)\ThunkLib.mak ThunkLibBin
+
+#-!IF "$(PROCESSOR)"=="x64"
+$(BUILD_DIR)\ThunkLib.mak : $(ThunkLib_DIR)\$(@B).cif $(ThunkLib_DIR)\$(@B).mak $(BUILD_RULES) $(ThunkLib_PORCESSOR_Ia32_CIF) $(ThunkLib_PORCESSOR_x64_CIF)
+ $(CIF2MAK) $(ThunkLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS) $(ThunkLib_PORCESSOR_Ia32_CIF) $(ThunkLib_PORCESSOR_x64_CIF)
+#-!ELSE
+#-$(BUILD_DIR)\ThunkLib.mak : $(ThunkLib_DIR)\$(@B).cif $(ThunkLib_DIR)\$(@B).mak $(BUILD_RULES) $(ThunkLib_PORCESSOR_CIF)
+#- $(CIF2MAK) $(ThunkLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS) $(ThunkLib_PORCESSOR_CIF)
+#-!ENDIF
+
+ThunkLibBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ BUILD_DIR=$(BUILD_DIR)\
+ /f $(BUILD_DIR)\ThunkLib.mak all\
+ "MY_INCLUDES=$(EDK_INCLUDES) $(EdkIIGlueLib_INCLUDES) $(PROJECT_CPU_INCLUDES)" \
+ TYPE=LIBRARY "PARAMETERS=LIBRARY_NAME=$$(ThunkLib_LIB)"\
+ "OBJECTS=$(ThunkLib_x64_OBJECTS)"
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ BUILD_DIR=$(BUILD_DIR)\IA32\
+ /f $(BUILD_DIR)\ThunkLib.mak all\
+ "MY_INCLUDES=$(EDK_INCLUDES) $(EdkIIGlueLib_INCLUDES) $(PROJECT_CPU_INCLUDES)" \
+ TYPE=PEI_LIBRARY "PARAMETERS=LIBRARY_NAME=$$(ThunkLib_LIB)"\
+ "OBJECTS=$(ThunkLib_IA32_OBJECTS)"
+
diff --git a/ReferenceCode/Haswell/Library/ThunkLib.sdl b/ReferenceCode/Haswell/Library/ThunkLib.sdl
new file mode 100644
index 0000000..e56aae4
--- /dev/null
+++ b/ReferenceCode/Haswell/Library/ThunkLib.sdl
@@ -0,0 +1,26 @@
+TOKEN
+ Name = ThunkLib_SUPPORT
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable ThunkLib support in Project"
+End
+
+TOKEN
+ Name = "ThunkLib_LIB"
+ Value = "$$(LIB_BUILD_DIR)\ThunkLib.lib"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+PATH
+ Name = "ThunkLib_DIR"
+End
+
+MODULE
+ Help = "Includes ThunkLib.mak to Project"
+ File = "ThunkLib.mak"
+End
+
diff --git a/ReferenceCode/Haswell/Library/ThunkLib/Ia32/Thunk16.asm b/ReferenceCode/Haswell/Library/ThunkLib/Ia32/Thunk16.asm
new file mode 100644
index 0000000..af9d34c
--- /dev/null
+++ b/ReferenceCode/Haswell/Library/ThunkLib/Ia32/Thunk16.asm
@@ -0,0 +1,238 @@
+;/*++
+; This file contains an 'Intel Peripheral Driver' and is
+; licensed for Intel CPUs and chipsets under the terms of your
+; license agreement with Intel or your vendor. This file may
+; be modified by the user, subject to additional terms of the
+; license agreement
+;--*/
+;------------------------------------------------------------------------------
+;
+; Copyright (c) 2006 - 2011 Intel Corporation. All rights reserved
+; This software and associated documentation (if any) is furnished
+; under a license and may only be used or copied in accordance
+; with the terms of the license. Except as permitted by such
+; license, no part of this software or documentation may be
+; reproduced, stored in a retrieval system, or transmitted in any
+; form or by any means without the express written consent of
+; Intel Corporation.
+;
+; Module Name:
+;
+; Thunk.asm
+;
+; Abstract:
+;
+; Real mode thunk
+;
+;------------------------------------------------------------------------------
+
+ .686p
+ .model flat,C
+ .const
+
+EXTERNDEF mCode16Size:DWORD
+mCode16Size DD _Code16End - _Code16Addr
+
+ .data
+ ALIGN 10h
+
+NullSegSel DQ 0
+_16CsSegSel LABEL QWORD
+ DW -1
+ DW 0
+ DB 0
+ DB 9Bh
+ DB 8Fh ; 16-bit segment, 4GB limit
+ DB 0
+;_16DsSegSel LABEL QWORD
+; DW -1
+; DW 0
+; DB 0
+; DB 93h
+; DB 8Fh ; 16-bit segment, 4GB limit
+; DB 0
+_16Gdtr LABEL FWORD
+ DW $ - offset NullSegSel - 1
+ DD offset NullSegSel
+
+ .code
+
+IA32_REGS STRUC 4t
+_EDI DD ?
+_ESI DD ?
+_EBP DD ?
+_ESP DD ?
+_EBX DD ?
+_EDX DD ?
+_ECX DD ?
+_EAX DD ?
+_DS DW ?
+_ES DW ?
+_FS DW ?
+_GS DW ?
+_EFLAGS DD ?
+_EIP DD ?
+_CS DW ?
+_SS DW ?
+IA32_REGS ENDS
+
+_STK16 STRUC 1t
+RetEip DD ?
+RetCs DW ?
+ThunkFlags DW ?
+SavedGdtr FWORD ?
+Resvd1 DW ?
+SavedCr0 DD ?
+SavedCr4 DD ?
+_STK16 ENDS
+
+; IA32_REGISTER_SET *
+; EFIAPI
+; _Thunk16 (
+; IN OUT IA32_REGISTER_SET *RegisterSet,
+; IN UINT32 ThunkFlags,
+; IN UINT32 RealModeCs
+; );
+_Thunk16 PROC USES DS ES FS GS EDI ESI EBP EBX EDX ECX ; 10 dwords will be pushed
+ mov ebp, esp
+ add ebp, 40
+ mov ORG_SS, ss ; preserve SS & ESP
+ mov ORG_ESP, esp
+
+ mov esi, [ebp + 4] ; esi <- RegisterSet
+ movzx edx, (IA32_REGS ptr [esi])._SS ; find 16-bit stack linear address
+ shl edx, 4
+ add edx, (IA32_REGS ptr [esi])._ESP
+ add edx, - sizeof (IA32_REGS) - sizeof (_STK16) ; edx <- 16-bit stack linear address
+
+ mov edi, edx ; [RealMode.IA32_REGS] <- RegisterSet
+ push sizeof (IA32_REGS) / 4
+ pop ecx
+ rep movsd
+ lea eax, @F ; [RealMode._STK16.RetEip] <- ReturnOffset
+ stosd
+ mov eax, cs ; [RealMode._STK16.RetCs] <- ReturnSegment
+ stosw
+ mov eax, [ebp + 8] ; [RealMode._STK16.ThunkFlags] <- ThunkFlags
+ stosw
+ sgdt dword ptr [edi] ; [RealMode._STK16.SavedGdtr] <- GDTR
+ add edi, 8
+ mov eax, cr0 ; [RealMode._STK16.SavedCr0] <- CR0
+ stosd
+ mov esi, eax ; esi <- CR0 to set
+ and esi, 07FFFFFFEh ; clear BIT[24, 0]: PE & PG bits
+ mov eax, cr4 ; [RealMode._STK16.SavedCr4] <- CR4
+ stosd
+
+ push word ptr [ebp + 12] ; [STACK] <- RealModeCs, far jump address for into RealMode
+ pushw 0
+ pushd 8 ; transfer program control to a readable segment that has a limit of 64KB
+ pushd offset @16Bit
+ mov edi, edx ; edi <- 16-bit stack linear address
+
+ sidt fword ptr [ebp + 8] ; save IDTR
+ lgdt _16Gdtr
+ retf
+@16Bit:
+ mov cr0, esi ; disable PE & PG
+; db 066h
+; mov ecx, 0C0000080h
+; rdmsr
+; and ah, NOT 1
+; wrmsr ; clear LME bit
+ mov eax, cr4
+ and al, not 030h ; clear PAE & PSE
+ mov cr4, eax
+ retf
+@@:
+ xor eax, eax
+ mov eax, ss
+ shl eax, 4
+ add eax, esp ; [EAX] <- RegisterSet after x86 call..to return the execution result
+ mov ss, cs:word ptr [ORG_SS] ; restore SS & ESP
+ mov esp, cs:dword ptr [ORG_ESP]
+ lidt fword ptr [ebp + 8] ; restore IDTR
+
+ ret
+
+ORG_SS DW ?
+ORG_ESP DD ?
+
+_Thunk16 ENDP
+
+ ALIGN 10h
+
+; VOID
+; EFIAPI
+; _Code16Addr (
+; VOID
+; );
+_Code16Addr PROC
+_Code16Addr ENDP
+
+; Input: EDI <- 16-bit stack linear address
+RealMode PROC
+ db 066h ; movzx esp, di
+ movzx esp, di
+ db 033h, 0FFh ; xor di, di
+ db 066h ; shr edi, 4
+ shr edi, 4
+ mov ss, di ; mov ss, di
+
+ db 02Eh, 00Fh, 001, 01Eh ; lidt cs:[_16Idtr]
+ dw (_16Idtr - _Code16Addr)
+ db 066h ; popad
+ popa
+ pop ds
+ pop es
+ pop fs
+ pop gs
+ add esp, 4 ; skip EFLAGS
+
+ ; test if EFLAGS with _THUNK_INTERRUPT
+ db 067h, 00F7h, 044h, 024h, 00Eh, 001h, 000h ; test [esp + 0Eh]
+ jz @F
+ db 09Ch ; pushf
+@@:
+ push cs
+ db 068h ; pushw
+ dw (@FarCallRet - _Code16Addr)
+ jz @F
+ db 066h, 067h
+ jmp fword ptr [esp + 6]
+@@:
+ db 066h, 067h
+ jmp fword ptr [esp + 4]
+@FarCallRet:
+ pushf ; pushfd actually
+ push gs
+ push fs
+ push es
+ push ds
+ db 066h ; pushad
+ pusha
+ cli
+
+ db 066h, 067h
+ lgdt (_STK16 ptr [esp + sizeof(IA32_REGS)]).SavedGdtr
+ db 066h, 067h
+ mov eax, (_STK16 ptr [esp + sizeof(IA32_REGS)]).SavedCr4
+ mov cr4, eax
+; db 066h
+; mov ecx, 0C0000080h
+; rdmsr
+; or ah, 1
+; wrmsr ; set LME
+ db 066h, 067h
+ mov eax, (_STK16 ptr [esp + sizeof(IA32_REGS)]).SavedCr0
+ mov cr0, eax
+ db 066h, 067h
+ jmp fword ptr (_STK16 ptr [esp + sizeof(IA32_REGS)]).RetEip
+
+RealMode ENDP
+
+_16Idtr FWORD (1 shl 10) - 1
+
+_Code16End:
+
+ END
diff --git a/ReferenceCode/Haswell/Library/ThunkLib/Ia32/ThunkLibIa32.cif b/ReferenceCode/Haswell/Library/ThunkLib/Ia32/ThunkLibIa32.cif
new file mode 100644
index 0000000..e0204e7
--- /dev/null
+++ b/ReferenceCode/Haswell/Library/ThunkLib/Ia32/ThunkLibIa32.cif
@@ -0,0 +1,9 @@
+<component>
+ name = "ThunkLib Ia32"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Haswell\Library\ThunkLib\Ia32"
+ RefName = "ThunkLibIa32"
+[files]
+"x86Thunk.c"
+"Thunk16.asm"
+<endComponent>
diff --git a/ReferenceCode/Haswell/Library/ThunkLib/Ia32/x86Thunk.c b/ReferenceCode/Haswell/Library/ThunkLib/Ia32/x86Thunk.c
new file mode 100644
index 0000000..ec1045f
--- /dev/null
+++ b/ReferenceCode/Haswell/Library/ThunkLib/Ia32/x86Thunk.c
@@ -0,0 +1,245 @@
+/** @file
+ Real Mode Thunk Functions for IA32 and X64
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "ThunkLib.h"
+#define _THUNK_INTERRUPT 0x10000
+#endif
+
+extern const UINTN mCode16Size;
+
+extern
+IA32_REGISTER_SET *
+EFIAPI
+_Thunk16 (
+ IN OUT IA32_REGISTER_SET *RegisterSet,
+ IN UINT32 ThunkFlags,
+ IN UINT32 RealModeCs
+ );
+
+extern
+VOID
+EFIAPI
+_Code16Addr (
+ VOID
+ );
+
+/**
+ Returns the properties of this real mode thunk implementation. Currently
+ there are 2 properties has been defined, the minimum real mode buffer size
+ and the minimum stack size.
+
+ @param[in] MinimumStackSize - The minimum size required for a 16-bit stack.
+
+ @retval The minimum size of the real mode buffer needed by this thunk implementation
+ @retval is returned.
+**/
+UINTN
+EFIAPI
+R8AsmThunk16GetProperties (
+ OUT UINTN *MinimumStackSize
+ )
+{
+ ///
+ /// This size should be large enough to hold the register set as well as saved
+ /// CPU contexts including GDTR, CR0 and CR4
+ ///
+ if (MinimumStackSize) {
+ *MinimumStackSize = sizeof (IA32_REGISTER_SET) + 0x200;
+ }
+
+ return mCode16Size;
+}
+
+/**
+ Tell this real mode thunk implementation the address and size of the real
+ mode buffer needed.
+
+ @param[in] ThunkContext - The thunk context whose properties to set.
+ @param[in] RealModeBuffer - The address of the buffer allocated by caller. It should be
+ aligned on a 16-byte boundary.
+ This buffer must be in identity mapped pages.
+ @param[in] BufferSize - The size of RealModeBuffer. Must be larger than the minimum
+ size required as returned by R8AsmThunk16GetProperties().
+**/
+THUNK16_CONTEXT *
+EFIAPI
+R8AsmThunk16SetProperties (
+ OUT THUNK16_CONTEXT *ThunkContext,
+ IN VOID *RealModeBuffer,
+ IN UINTN BufferSize
+ )
+{
+ BufferSize &= ~3;
+
+ ASSERT ((UINTN) RealModeBuffer < 0x100000);
+ ASSERT (((UINTN) RealModeBuffer & 0xf) == 0);
+ ASSERT (BufferSize >= mCode16Size);
+
+ ThunkContext->RealModeBuffer = (UINT32) ((UINTN) RealModeBuffer);
+ ThunkContext->DefaultStack = (UINT32) (ThunkContext->RealModeBuffer + BufferSize);
+ CopyMem (RealModeBuffer, (VOID *) (UINTN) _Code16Addr, mCode16Size);
+ return ThunkContext;
+}
+
+/**
+ Reset all internal states to their initial values. The caller should not
+ release the real mode buffer until after a call to this function.
+
+ @param[in] ThunkContext - The thunk context to destroy.
+**/
+VOID
+EFIAPI
+R8AsmThunk16Destroy (
+ IN OUT THUNK16_CONTEXT *ThunkContext
+ )
+{
+ ThunkContext->RealModeBuffer = 0;
+}
+
+/**
+ Do the 16-bit thunk code.
+
+ NOTE: This function must be called on TPL_HIGH_LEVEL or with interrupts
+ disabled because of GDTR and IDTR manipulations.
+ This function must be placed in identity mapped pages.
+
+ @param[in] ThunkContext - Thunk context to use.
+ @param[in] RegisterSet - CPU registers would be set to the values contained in this
+ structure before making the far call. Then CPU registers are
+ copied back to this structure.
+ SS:ESP points to the real mode stack if THUNK_USER_STACK is
+ set on input, otherwise ignored.
+ EFlages is ignored on input.
+ On output, values of CS, EIP, SS and ESP should be ignored.
+ @param[in] ThunkFlags - 2 flags have currently been defined, THUNK_SAVE_FP_STATE and
+ THUNK_USER_STACK.
+ THUNK_SAVE_FP_STATE - FPU state would be saved/restored
+ before/after calling real mode code.
+ THUNK_USER_STACK - The stack specified by SS:ESP would be
+ used instead of the default stack.
+
+ @retval RegisterSet is returned.
+**/
+static
+IA32_REGISTER_SET *
+EFIAPI
+R8AsmThunk16 (
+ IN THUNK16_CONTEXT *ThunkContext,
+ IN OUT IA32_REGISTER_SET *RegisterSet,
+ IN UINT32 ThunkFlags
+ )
+{
+ ASSERT (ThunkContext->RealModeBuffer != 0);
+ ASSERT ((ThunkContext->RealModeBuffer & 0xf) == 0);
+
+ if (!(ThunkFlags & THUNK_USER_STACK)) {
+ RegisterSet->E.ESP = (UINT16) ThunkContext->DefaultStack;
+ RegisterSet->E.SS = (UINT16) ((ThunkContext->DefaultStack >> 4) & 0xf000);
+ }
+
+ ASSERT ((RegisterSet->E.ESP >> 16) == 0);
+
+ CopyMem (
+ RegisterSet,
+ _Thunk16 (RegisterSet,
+ (UINT16) (ThunkFlags >> 16),
+ ThunkContext->RealModeBuffer >> 4),
+ sizeof (IA32_REGISTER_SET)
+ );
+
+ return RegisterSet;
+}
+
+/**
+ Make a far call to 16-bit code.
+
+ NOTE: This function must be called on TPL_HIGH_LEVEL or with interrupts
+ disabled because of GDTR and IDTR manipulations.
+ This function must be placed in identity mapped pages.
+
+ @param[in] ThunkContext - Thunk context to use.
+ @param[in] RegisterSet - CPU registers would be set to the values contained in this
+ structure before making the far call. Then CPU registers are
+ copied back to this structure.
+ CS:EIP points to the real mode code being called on input.
+ SS:ESP points to the real mode stack if THUNK_USER_STACK is
+ set on input, otherwise ignored.
+ EFlages is ignored on input.
+ On output, values of CS, EIP, SS and ESP should be ignored.
+ @param[in] Flags - 2 flags have currently been defined, THUNK_SAVE_FP_STATE and
+ THUNK_USER_STACK.
+ THUNK_SAVE_FP_STATE - FPU state would be saved/restored
+ before/after calling real mode code.
+ THUNK_USER_STACK - The stack specified by SS:ESP would be
+ used instead of the default stack.
+
+ @retval RegisterSet is returned.
+**/
+IA32_REGISTER_SET *
+EFIAPI
+R8AsmThunk16FarCall86 (
+ IN THUNK16_CONTEXT *ThunkContext,
+ IN OUT IA32_REGISTER_SET *RegisterSet,
+ IN UINT32 Flags
+ )
+{
+ return R8AsmThunk16 (ThunkContext, RegisterSet, Flags);
+}
+
+/**
+ Invoke a 16-bit interrupt handler.
+
+ NOTE: This function must be called on TPL_HIGH_LEVEL or with interrupts
+ disabled because of GDTR and IDTR manipulations.
+ This function must be placed in identity mapped pages.
+
+ @param[in] ThunkContext - Thunk context to use.
+ @param[in] IntNumber - The ordinal of the interrupt handler ranging from 0 to 255.
+ @param[in] RegisterSet - CPU registers would be set to the values contained in this
+ structure before making the far call. Then CPU registers are
+ copied back to this structure.
+ SS:ESP points to the real mode stack if THUNK_USER_STACK is
+ set on input, otherwise ignored.
+ EFlages is ignored on input.
+ On output, values of CS, EIP, SS and ESP should be ignored.
+ @param[in] Flags - 2 flags have currently been defined, THUNK_SAVE_FP_STATE and
+ THUNK_USER_STACK.
+ THUNK_SAVE_FP_STATE - FPU state would be saved/restored
+ before/after calling real mode code.
+ THUNK_USER_STACK - The stack specified by SS:ESP would be
+ used instead of the default stack.
+
+ @retval RegisterSet is returned.
+**/
+IA32_REGISTER_SET *
+EFIAPI
+R8AsmThunk16Int86 (
+ IN THUNK16_CONTEXT *ThunkContext,
+ IN UINT8 IntNumber,
+ IN OUT IA32_REGISTER_SET *RegisterSet,
+ IN UINT32 Flags
+ )
+{
+ RegisterSet->E.Eip = (UINT16) ((UINT32 *) NULL)[IntNumber];
+ RegisterSet->E.CS = (UINT16) (((UINT32 *) NULL)[IntNumber] >> 16);
+ return R8AsmThunk16 (ThunkContext, RegisterSet, Flags | _THUNK_INTERRUPT);
+}
diff --git a/ReferenceCode/Haswell/Library/ThunkLib/ThunkLib.inf b/ReferenceCode/Haswell/Library/ThunkLib/ThunkLib.inf
new file mode 100644
index 0000000..8f760df
--- /dev/null
+++ b/ReferenceCode/Haswell/Library/ThunkLib/ThunkLib.inf
@@ -0,0 +1,67 @@
+## @file
+# @todo ADD DESCRIPTION
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains an 'Intel Peripheral Driver' and uniquely
+# identified as "Intel Reference Module" and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+
+[defines]
+BASE_NAME = ThunkLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+
+[sources.ia32]
+ Ia32/x86Thunk.c
+ Ia32/Thunk16.asm
+
+[sources.x64]
+ x64/x86Thunk.c
+ x64/Thunk16.asm
+ x64/FxSave.asm
+ x64/FxRestore.asm
+
+[includes.common]
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include
+
+#
+# Edk II Glue Library, some hearder are included by R9 header so have to include
+#
+
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Framework
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[libraries.common]
+
+[nmake.common]
+ C_FLAGS = $(C_FLAGS)
diff --git a/ReferenceCode/Haswell/Library/ThunkLib/x64/FxRestore.asm b/ReferenceCode/Haswell/Library/ThunkLib/x64/FxRestore.asm
new file mode 100644
index 0000000..54bab05
--- /dev/null
+++ b/ReferenceCode/Haswell/Library/ThunkLib/x64/FxRestore.asm
@@ -0,0 +1,45 @@
+;/*++
+; This file contains an 'Intel Peripheral Driver' and is
+; licensed for Intel CPUs and chipsets under the terms of your
+; license agreement with Intel or your vendor. This file may
+; be modified by the user, subject to additional terms of the
+; license agreement
+;--*/
+;------------------------------------------------------------------------------
+;
+; Copyright (c) 2006 - 2010 Intel Corporation. All rights reserved
+; This software and associated documentation (if any) is furnished
+; under a license and may only be used or copied in accordance
+; with the terms of the license. Except as permitted by such
+; license, no part of this software or documentation may be
+; reproduced, stored in a retrieval system, or transmitted in any
+; form or by any means without the express written consent of
+; Intel Corporation.
+;
+; Module Name:
+;
+; FxRestore.Asm
+;
+; Abstract:
+;
+; AsmFxRestore function
+;
+; Notes:
+;
+;------------------------------------------------------------------------------
+
+ .code
+
+;------------------------------------------------------------------------------
+; VOID
+; EFIAPI
+; AsmFxRestore (
+; IN CONST IA32_FX_BUFFER *Buffer
+; );
+;------------------------------------------------------------------------------
+AsmFxRestore PROC
+ fxrstor [rcx]
+ ret
+AsmFxRestore ENDP
+
+ END
diff --git a/ReferenceCode/Haswell/Library/ThunkLib/x64/FxSave.asm b/ReferenceCode/Haswell/Library/ThunkLib/x64/FxSave.asm
new file mode 100644
index 0000000..c95ba0b
--- /dev/null
+++ b/ReferenceCode/Haswell/Library/ThunkLib/x64/FxSave.asm
@@ -0,0 +1,45 @@
+;/*++
+; This file contains an 'Intel Peripheral Driver' and is
+; licensed for Intel CPUs and chipsets under the terms of your
+; license agreement with Intel or your vendor. This file may
+; be modified by the user, subject to additional terms of the
+; license agreement
+;--*/
+;------------------------------------------------------------------------------
+;
+; Copyright (c) 2006 - 2010 Intel Corporation. All rights reserved
+; This software and associated documentation (if any) is furnished
+; under a license and may only be used or copied in accordance
+; with the terms of the license. Except as permitted by such
+; license, no part of this software or documentation may be
+; reproduced, stored in a retrieval system, or transmitted in any
+; form or by any means without the express written consent of
+; Intel Corporation.
+;
+; Module Name:
+;
+; FxSave.Asm
+;
+; Abstract:
+;
+; AsmFxSave function
+;
+; Notes:
+;
+;------------------------------------------------------------------------------
+
+ .code
+
+;------------------------------------------------------------------------------
+; VOID
+; EFIAPI
+; AsmFxSave (
+; OUT IA32_FX_BUFFER *Buffer
+; );
+;------------------------------------------------------------------------------
+AsmFxSave PROC
+ fxsave [rcx]
+ ret
+AsmFxSave ENDP
+
+ END
diff --git a/ReferenceCode/Haswell/Library/ThunkLib/x64/Thunk16.asm b/ReferenceCode/Haswell/Library/ThunkLib/x64/Thunk16.asm
new file mode 100644
index 0000000..89bb447
--- /dev/null
+++ b/ReferenceCode/Haswell/Library/ThunkLib/x64/Thunk16.asm
@@ -0,0 +1,216 @@
+;/*++
+; This file contains an 'Intel Peripheral Driver' and is
+; licensed for Intel CPUs and chipsets under the terms of your
+; license agreement with Intel or your vendor. This file may
+; be modified by the user, subject to additional terms of the
+; license agreement
+;--*/
+;------------------------------------------------------------------------------
+;
+; Copyright (c) 2006 - 2010 Intel Corporation. All rights reserved
+; This software and associated documentation (if any) is furnished
+; under a license and may only be used or copied in accordance
+; with the terms of the license. Except as permitted by such
+; license, no part of this software or documentation may be
+; reproduced, stored in a retrieval system, or transmitted in any
+; form or by any means without the express written consent of
+; Intel Corporation.
+;
+; Module Name:
+;
+; Thunk.asm
+;
+; Abstract:
+;
+; Real mode thunk
+;
+;------------------------------------------------------------------------------
+
+EXTERNDEF mCode16Size:QWORD
+
+ .const
+
+mCode16Size DQ _Code16End - _Code16Addr
+
+ .data
+
+NullSegSel DQ 0
+_16CsSegSel LABEL QWORD
+ DW -1
+ DW 0
+ DB 0
+ DB 9bh
+ DB 8fh ; 16-bit segment
+ DB 0
+
+_16Gdtr LABEL FWORD
+ DW $ - offset NullSegSel - 1
+ DQ offset NullSegSel
+
+ .code
+
+IA32_REGS STRUC 4t
+_EDI DD ?
+_ESI DD ?
+_EBP DD ?
+_ESP DD ?
+_EBX DD ?
+_EDX DD ?
+_ECX DD ?
+_EAX DD ?
+_DS DW ?
+_ES DW ?
+_FS DW ?
+_GS DW ?
+_RFLAGS DQ ?
+_EIP DD ?
+_CS DW ?
+_SS DW ?
+IA32_REGS ENDS
+
+_STK16 STRUC 1t
+RetEip DD ?
+RetCs DW ?
+ThunkFlags DW ?
+SavedGdtr FWORD ?
+Resvd1 DW ?
+SavedCr0 DD ?
+SavedCr4 DD ?
+_STK16 ENDS
+
+_Thunk16 PROC USES rbp rbx rsi rdi r12 r13 r14 r15
+
+ push fs
+ push gs
+
+ mov r12d, ds
+ mov r13d, es
+ mov r14d, ss
+ mov r15, rsp
+ mov rsi, rcx
+ movzx r10, (IA32_REGS ptr [rsi])._SS
+ xor rdi, rdi
+ mov edi, (IA32_REGS ptr [rsi])._ESP
+ add rdi, - sizeof (IA32_REGS) - sizeof (_STK16)
+ push rdi
+ imul rax, r10, 16
+ add rdi, rax
+ push sizeof (IA32_REGS) / 4
+ pop rcx
+ rep movsd
+ pop rbx ; rbx <- 16-bit stack offset
+ lea eax, @F ; return offset
+ stosd
+ mov eax, cs ; return segment
+ stosw
+ mov eax, edx ; THUNK Flags
+ stosw
+ sgdt fword ptr [rsp + 58h] ; save GDTR
+ mov rax, [rsp + 58h]
+ stosq
+ mov rax, cr0 ; save CR0
+ mov esi, eax ; esi <- CR0 to set
+ stosd
+ mov rax, cr4 ; save CR4
+ stosd
+ sidt fword ptr [rsp + 58h] ; save IDTR
+ and esi, 07ffffffeh ;NOT 080000001h ; clear PE & PG bits
+ mov rdi, r10 ; rdi <- 16-bit stack segment
+
+ shl r8, 16
+ push r8 ; far jmp address
+ lea eax, @16Bit
+ push rax
+ mov word ptr [rsp + 4], 8
+ lgdt _16Gdtr
+ retf
+@16Bit:
+ mov cr0, rsi ; disable PE & PG
+ DB 66h
+ mov ecx, 0c0000080h
+ rdmsr
+ and ah, NOT 1
+ wrmsr ; clear LME bit
+ mov rax, cr4
+ and al, NOT 30h ; clear PAE & PSE
+ mov cr4, rax
+ retf
+@@:
+ xor rax, rax
+ mov eax, ss
+ shl eax, 4
+ add eax, esp ; rax <- address of 16-bit stack
+ mov rsp, r15
+ lidt fword ptr [rsp + 58h] ; restore IDTR
+ mov ds, r12d
+ mov es, r13d
+ mov ss, r14d
+ pop gs
+ pop fs
+ ret
+_Thunk16 ENDP
+
+ ALIGN 10h
+
+_Code16Addr PROC
+_Code16Addr ENDP
+
+RealMode PROC
+ mov ss, edi
+ mov sp, bx ; set up 16-bit stack
+ DB 2eh, 0fh, 1, 1eh
+ DW _16Idtr - _Code16Addr ; lidt _16Idtr
+ DB 66h, 61h ; popad
+ DB 1fh ; pop ds
+ DB 7 ; pop es
+ pop fs
+ pop gs
+
+ add esp, 8 ; skip RFLAGS
+ DB 67h, 0f7h, 44h, 24h, 0eh, 1, 0 ; test [esp + 0eh], 1
+ jz @F
+ pushfq ; pushf, actually
+@@:
+ DB 0eh ; push cs
+ DB 68h ; push /iw
+ DW @FarCallRet - _Code16Addr
+ jz @F
+ DB 66h
+ jmp fword ptr [esp + 6]
+@@:
+ DB 66h
+ jmp fword ptr [esp + 4]
+@FarCallRet:
+ DB 66h
+ push 0 ; push a dword of zero
+ pushf ; pushfd, actually
+ push gs
+ push fs
+ DB 6 ; push es
+ DB 1eh ; push ds
+ DB 66h, 60h ; pushad
+ cli
+
+ DB 66h
+ lgdt (_STK16 ptr [esp + sizeof(IA32_REGS)]).SavedGdtr
+ DB 66h
+ mov eax, (_STK16 ptr [esp + sizeof(IA32_REGS)]).SavedCr4
+ mov cr4, rax
+ DB 66h
+ mov ecx, 0c0000080h
+ rdmsr
+ or ah, 1
+ wrmsr ; set LME
+ DB 66h
+ mov eax, (_STK16 ptr [esp + sizeof(IA32_REGS)]).SavedCr0
+ mov cr0, rax
+ DB 66h
+ jmp fword ptr (_STK16 ptr [esp + sizeof(IA32_REGS)]).RetEip
+
+RealMode ENDP
+
+_16Idtr FWORD (1 SHL 10) - 1
+
+_Code16End:
+
+ END
diff --git a/ReferenceCode/Haswell/Library/ThunkLib/x64/ThunkLibx64.cif b/ReferenceCode/Haswell/Library/ThunkLib/x64/ThunkLibx64.cif
new file mode 100644
index 0000000..aa6ac0f
--- /dev/null
+++ b/ReferenceCode/Haswell/Library/ThunkLib/x64/ThunkLibx64.cif
@@ -0,0 +1,11 @@
+<component>
+ name = "ThunkLib x64"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Haswell\Library\ThunkLib\x64"
+ RefName = "ThunkLibx64"
+[files]
+"x86Thunk.c"
+"Thunk16.asm"
+"FxSave.asm"
+"FxRestore.asm"
+<endComponent>
diff --git a/ReferenceCode/Haswell/Library/ThunkLib/x64/x86Thunk.c b/ReferenceCode/Haswell/Library/ThunkLib/x64/x86Thunk.c
new file mode 100644
index 0000000..dadb37e
--- /dev/null
+++ b/ReferenceCode/Haswell/Library/ThunkLib/x64/x86Thunk.c
@@ -0,0 +1,272 @@
+/** @file
+ Real Mode Thunk Functions for IA32 and X64
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "ThunkLib.h"
+#define _THUNK_INTERRUPT 0x10000
+#endif
+
+extern const UINTN mCode16Size;
+
+extern
+IA32_REGISTER_SET *
+EFIAPI
+_Thunk16 (
+ IN OUT IA32_REGISTER_SET *RegisterSet,
+ IN UINT32 ThunkFlags,
+ IN UINT32 RealModeCs
+ );
+
+extern
+VOID
+EFIAPI
+_Code16Addr (
+ VOID
+ );
+
+extern
+void
+EFIAPI
+AsmFxRestore (
+ IN CONST IA32_FX_BUFFER *Buffer
+ );
+
+extern
+void
+EFIAPI
+AsmFxSave (
+ OUT IA32_FX_BUFFER *Buffer
+ );
+
+/**
+ Returns the properties of this real mode thunk implementation. Currently
+ there are 2 properties has been defined, the minimum real mode buffer size
+ and the minimum stack size.
+
+ @param[in] MinimumStackSize - The minimum size required for a 16-bit stack.
+
+ @retval The minimum size of the real mode buffer needed by this thunk implementation
+ @retval is returned.
+**/
+UINTN
+EFIAPI
+R8AsmThunk16GetProperties (
+ OUT UINTN *MinimumStackSize
+ )
+{
+ ///
+ /// This size should be large enough to hold the register set as well as saved
+ /// CPU contexts including GDTR, CR0 and CR4
+ ///
+ if (MinimumStackSize) {
+ *MinimumStackSize = sizeof (IA32_REGISTER_SET) + 0x200;
+ }
+
+ return mCode16Size;
+}
+
+/**
+ Tell this real mode thunk implementation the address and size of the real
+ mode buffer needed.
+
+ @param[in] ThunkContext - The thunk context whose properties to set.
+ @param[in] RealModeBuffer - The address of the buffer allocated by caller. It should be
+ aligned on a 16-byte boundary.
+ This buffer must be in identity mapped pages.
+ @param[in] BufferSize - The size of RealModeBuffer. Must be larger than the minimum
+ size required as returned by R8AsmThunk16GetProperties().
+**/
+THUNK16_CONTEXT *
+EFIAPI
+R8AsmThunk16SetProperties (
+ OUT THUNK16_CONTEXT *ThunkContext,
+ IN VOID *RealModeBuffer,
+ IN UINTN BufferSize
+ )
+{
+ BufferSize &= ~3;
+
+ ASSERT ((UINTN) RealModeBuffer < 0x100000);
+ ASSERT (((UINTN) RealModeBuffer & 0xf) == 0);
+ ASSERT (BufferSize >= mCode16Size);
+
+ ThunkContext->RealModeBuffer = (UINT32) (UINTN) RealModeBuffer;
+ ThunkContext->DefaultStack = (UINT32) (ThunkContext->RealModeBuffer + BufferSize);
+ CopyMem (RealModeBuffer, (VOID *) (UINTN) _Code16Addr, mCode16Size);
+ return ThunkContext;
+}
+
+/**
+ Reset all internal states to their initial values. The caller should not
+ release the real mode buffer until after a call to this function.
+
+ @param[in] ThunkContext - The thunk context to destroy.
+**/
+VOID
+EFIAPI
+R8AsmThunk16Destroy (
+ IN OUT THUNK16_CONTEXT *ThunkContext
+ )
+{
+ ThunkContext->RealModeBuffer = 0;
+}
+
+/**
+ Do the 16-bit thunk code.
+
+ NOTE: This function must be called on TPL_HIGH_LEVEL or with interrupts
+ disabled because of GDTR and IDTR manipulations.
+ This function must be placed in identity mapped pages.
+
+ @param[in] ThunkContext - Thunk context to use.
+ @param[in] RegisterSet - CPU registers would be set to the values contained in this
+ structure before making the far call. Then CPU registers are
+ copied back to this structure.
+ SS:ESP points to the real mode stack if THUNK_USER_STACK is
+ set on input, otherwise ignored.
+ EFlages is ignored on input.
+ On output, values of CS, EIP, SS and ESP should be ignored.
+ @param[in] ThunkFlags - 2 flags have currently been defined, THUNK_SAVE_FP_STATE and
+ THUNK_USER_STACK.
+ THUNK_SAVE_FP_STATE - FPU state would be saved/restored
+ before/after calling real mode code.
+ THUNK_USER_STACK - The stack specified by SS:ESP would be
+ used instead of the default stack.
+
+ @retval RegisterSet is returned.
+**/
+static
+IA32_REGISTER_SET *
+EFIAPI
+R8AsmThunk16 (
+ IN THUNK16_CONTEXT *ThunkContext,
+ IN OUT IA32_REGISTER_SET *RegisterSet,
+ IN UINT32 ThunkFlags
+ )
+{
+ IA32_FX_BUFFER *FpSavedState;
+ UINT8 FpBuffer[sizeof (*FpSavedState) + 0x10];
+
+ ASSERT (ThunkContext->RealModeBuffer != 0);
+ ASSERT ((ThunkContext->RealModeBuffer & 0xf) == 0);
+
+ FpSavedState = (IA32_FX_BUFFER *) (((UINTN) FpBuffer + 0xf) &~0xf);
+
+ if (!(ThunkFlags & THUNK_USER_STACK)) {
+ RegisterSet->E.ESP = (UINT16) ThunkContext->DefaultStack;
+ RegisterSet->E.SS = (UINT16) ((ThunkContext->DefaultStack >> 4) & 0xf000);
+ }
+
+ if (ThunkFlags & THUNK_SAVE_FP_STATE) {
+ AsmFxSave (FpSavedState);
+ }
+
+ ASSERT ((RegisterSet->E.ESP >> 16) == 0);
+
+ CopyMem (
+ RegisterSet,
+ _Thunk16 (RegisterSet,
+ (UINT16) (ThunkFlags >> 16),
+ ThunkContext->RealModeBuffer >> 4),
+ sizeof (*RegisterSet)
+ );
+
+ if (ThunkFlags & THUNK_SAVE_FP_STATE) {
+ AsmFxRestore (FpSavedState);
+ }
+
+ return RegisterSet;
+}
+
+/**
+ Make a far call to 16-bit code.
+
+ NOTE: This function must be called on TPL_HIGH_LEVEL or with interrupts
+ disabled because of GDTR and IDTR manipulations.
+ This function must be placed in identity mapped pages.
+
+ @param[in] ThunkContext - Thunk context to use.
+ @param[in] RegisterSet - CPU registers would be set to the values contained in this
+ structure before making the far call. Then CPU registers are
+ copied back to this structure.
+ CS:EIP points to the real mode code being called on input.
+ SS:ESP points to the real mode stack if THUNK_USER_STACK is
+ set on input, otherwise ignored.
+ EFlages is ignored on input.
+ On output, values of CS, EIP, SS and ESP should be ignored.
+ @param[in] Flags - 2 flags have currently been defined, THUNK_SAVE_FP_STATE and
+ THUNK_USER_STACK.
+ THUNK_SAVE_FP_STATE - FPU state would be saved/restored
+ before/after calling real mode code.
+ THUNK_USER_STACK - The stack specified by SS:ESP would be
+ used instead of the default stack.
+
+ @retval RegisterSet is returned.
+**/
+IA32_REGISTER_SET *
+EFIAPI
+R8AsmThunk16FarCall86 (
+ IN THUNK16_CONTEXT *ThunkContext,
+ IN OUT IA32_REGISTER_SET *RegisterSet,
+ IN UINT32 Flags
+ )
+{
+ return R8AsmThunk16 (ThunkContext, RegisterSet, Flags);
+}
+
+/**
+ Invoke a 16-bit interrupt handler.
+
+ NOTE: This function must be called on TPL_HIGH_LEVEL or with interrupts
+ disabled because of GDTR and IDTR manipulations.
+ This function must be placed in identity mapped pages.
+
+ @param[in] ThunkContext - Thunk context to use.
+ @param[in] IntNumber - The ordinal of the interrupt handler ranging from 0 to 255.
+ @param[in] RegisterSet - CPU registers would be set to the values contained in this
+ structure before making the far call. Then CPU registers are
+ copied back to this structure.
+ SS:ESP points to the real mode stack if THUNK_USER_STACK is
+ set on input, otherwise ignored.
+ EFlages is ignored on input.
+ On output, values of CS, EIP, SS and ESP should be ignored.
+ @param[in] Flags - 2 flags have currently been defined, THUNK_SAVE_FP_STATE and
+ THUNK_USER_STACK.
+ THUNK_SAVE_FP_STATE - FPU state would be saved/restored
+ before/after calling real mode code.
+ THUNK_USER_STACK - The stack specified by SS:ESP would be
+ used instead of the default stack.
+
+ @retval RegisterSet is returned.
+**/
+IA32_REGISTER_SET *
+EFIAPI
+R8AsmThunk16Int86 (
+ IN THUNK16_CONTEXT *ThunkContext,
+ IN UINT8 IntNumber,
+ IN OUT IA32_REGISTER_SET *RegisterSet,
+ IN UINT32 Flags
+ )
+{
+ RegisterSet->E.Eip = (UINT16) ((UINT32 *) NULL)[IntNumber];
+ RegisterSet->E.CS = (UINT16) (((UINT32 *) NULL)[IntNumber] >> 16);
+ return R8AsmThunk16 (ThunkContext, RegisterSet, Flags | _THUNK_INTERRUPT);
+}
diff --git a/ReferenceCode/Haswell/Library/TxtLib.cif b/ReferenceCode/Haswell/Library/TxtLib.cif
new file mode 100644
index 0000000..3d672e9
--- /dev/null
+++ b/ReferenceCode/Haswell/Library/TxtLib.cif
@@ -0,0 +1,11 @@
+<component>
+ name = "TxtLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Haswell\Library\"
+ RefName = "TxtLib"
+[files]
+"TxtLib.sdl"
+"TxtLib.mak"
+"TxtLib\TxtLib.inf"
+"TxtLib\Ia32\TxtPeiLib.asm"
+<endComponent>
diff --git a/ReferenceCode/Haswell/Library/TxtLib.mak b/ReferenceCode/Haswell/Library/TxtLib.mak
new file mode 100644
index 0000000..f933155
--- /dev/null
+++ b/ReferenceCode/Haswell/Library/TxtLib.mak
@@ -0,0 +1,16 @@
+# MAK file for the ModulePart:CpuPlatformLib
+
+$(TxtLib_LIB) : TxtLib
+
+TxtLib : $(BUILD_DIR)\TxtLib.mak TxtLibBin
+
+$(BUILD_DIR)\TxtLib.mak : $(TxtLib_DIR)\$(@B).cif $(TxtLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(TxtLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+TxtLibBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\TxtLib.mak all\
+ BUILD_DIR=$(BUILD_DIR)\IA32 \
+ "AFLAGS=$(AFLAGS) $(PROJECT_CPU_INCLUDES)" \
+ "MY_INCLUDES=$(EDK_INCLUDES) $(EdkIIGlueLib_INCLUDES) $(PROJECT_CPU_INCLUDES) $(INTEL_PCH_INCLUDES)" \
+ TYPE=PEI_LIBRARY "PARAMETERS=LIBRARY_NAME=$$(TxtLib_LIB)"
diff --git a/ReferenceCode/Haswell/Library/TxtLib.sdl b/ReferenceCode/Haswell/Library/TxtLib.sdl
new file mode 100644
index 0000000..028362b
--- /dev/null
+++ b/ReferenceCode/Haswell/Library/TxtLib.sdl
@@ -0,0 +1,32 @@
+TOKEN
+ Name = TxtLib_SUPPORT
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable TxtLib support in Project"
+End
+
+TOKEN
+ Name = "TxtLib_LIB"
+ Value = "$$(LIB_BUILD_DIR)\TxtLib.lib"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+PATH
+ Name = "TxtLib_DIR"
+End
+
+ELINK
+ Name = "/I$(TxtLib_DIR)\TxtLib"
+ Parent = "PROJECT_CPU_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+MODULE
+ Help = "Includes TxtLib.mak to Project"
+ File = "TxtLib.mak"
+End
+
diff --git a/ReferenceCode/Haswell/Library/TxtLib/Ia32/TxtPeiLib.asm b/ReferenceCode/Haswell/Library/TxtLib/Ia32/TxtPeiLib.asm
new file mode 100644
index 0000000..34fcd35
--- /dev/null
+++ b/ReferenceCode/Haswell/Library/TxtLib/Ia32/TxtPeiLib.asm
@@ -0,0 +1,99 @@
+;/*++
+; This file contains an 'Intel Peripheral Driver' and uniquely
+; identified as "Intel Reference Module" and is
+; licensed for Intel CPUs and chipsets under the terms of your
+; license agreement with Intel or your vendor. This file may
+; be modified by the user, subject to additional terms of the
+; license agreement
+;--*/
+;
+;/*++
+;
+; Copyright (c) 2012 Intel Corporation. All rights reserved
+; This software and associated documentation (if any) is furnished
+; under a license and may only be used or copied in accordance
+; with the terms of the license. Except as permitted by such
+; license, no part of this software or documentation may be
+; reproduced, stored in a retrieval system, or transmitted in any
+; form or by any means without the express written consent of
+; Intel Corporation.
+;
+;
+; Module Name:
+;
+; TxtPeiLib.asm
+;
+; Abstract:
+;
+; This file contains the code to determine Processor/Chipset TXT capaiblity
+;
+;--*/
+
+ .XLIST
+ include txt.inc
+ .LIST
+
+ .686P
+ .MMX
+ .XMM
+ .MODEL FLAT,C
+ .CODE
+
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+; Procedure: CheckSmxCapabilities
+;
+; Input: None
+;
+; Output: None
+;
+; Registers: None are preserved
+;
+; Description: Execute GETSEC[CAPABILITIES] to report the SMX capabilities
+;
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+
+CheckSmxCapabilities PROC PUBLIC USES ebx
+
+ ;
+ ; Check whether SMX is supported
+ ;
+ mov eax, 1
+ cpuid
+ bt ecx, IA32_CPUID_SMX_B
+
+ .IF !CARRY?
+ mov eax, 0
+ jmp @F
+ .ENDIF
+
+ ;
+ ; Save cr4
+ ;
+ mov edx, CR4
+
+ ;
+ ; Enable SMXE
+ ;
+ mov eax, CR4
+ or eax, CR4_SMXE
+ mov CR4, eax
+
+ ;
+ ; Call GETSEC[CAPABILITIES]
+ ;
+ mov eax, CAPABILITIES ; eax = CAPABILITIES
+ mov ebx, 0
+ _GETSEC
+
+ ;
+ ; Restore cr4
+ ;
+ mov CR4, edx
+
+@@:
+ ret
+CheckSmxCapabilities ENDP
+
+END
diff --git a/ReferenceCode/Haswell/Library/TxtLib/TxtLib.inf b/ReferenceCode/Haswell/Library/TxtLib/TxtLib.inf
new file mode 100644
index 0000000..46ae16b
--- /dev/null
+++ b/ReferenceCode/Haswell/Library/TxtLib/TxtLib.inf
@@ -0,0 +1,60 @@
+## @file
+# Component description file for TXT Lib
+#
+#@copyright
+# Copyright (c) 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = TxtLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ Ia32/TxtPeiLib.asm
+
+[sources.ia32]
+
+[sources.x64]
+
+[sources.ipf]
+
+[includes.common]
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include/Library
+
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[libraries.common]
+
+[nmake.common]
diff --git a/ReferenceCode/Haswell/PowerManagement/AcpiTables/PowerMgmtAcpiTables.cif b/ReferenceCode/Haswell/PowerManagement/AcpiTables/PowerMgmtAcpiTables.cif
new file mode 100644
index 0000000..20c2418
--- /dev/null
+++ b/ReferenceCode/Haswell/PowerManagement/AcpiTables/PowerMgmtAcpiTables.cif
@@ -0,0 +1,19 @@
+<component>
+ name = "PowerManagementAcpiTables"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Haswell\PowerManagement\AcpiTables\"
+ RefName = "PowerManagementAcpiTables"
+[files]
+"PowerMgmtAcpiTables.sdl"
+"PowerMgmtAcpiTables.mak"
+"PowerMgmtAcpiTables.inf"
+"Ssdt\ApCst.asl"
+"Ssdt\ApIst.asl"
+"Ssdt\ApTst.asl"
+"Ssdt\Cpu0Cst.asl"
+"Ssdt\Cpu0Ist.asl"
+"Ssdt\Cpu0Tst.asl"
+"Ssdt\CpuPm.asl"
+"Ssdt\LakeTiny.asl"
+"Ssdt\Ctdp.asl"
+<endComponent>
diff --git a/ReferenceCode/Haswell/PowerManagement/AcpiTables/PowerMgmtAcpiTables.inf b/ReferenceCode/Haswell/PowerManagement/AcpiTables/PowerMgmtAcpiTables.inf
new file mode 100644
index 0000000..511a086
--- /dev/null
+++ b/ReferenceCode/Haswell/PowerManagement/AcpiTables/PowerMgmtAcpiTables.inf
@@ -0,0 +1,77 @@
+## @file
+# Component description file for the ACPI tables
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains an 'Intel Peripheral Driver' and uniquely
+# identified as "Intel Reference Module" and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+
+
+[defines]
+BASE_NAME = PowerManagementAcpiTables2
+FILE_GUID = 299141BB-211A-48a5-92C0-6F9A0A3A006E
+COMPONENT_TYPE = ACPITABLE
+FFS_EXT = .ffs
+
+[sources.common]
+ Ssdt/Cpu0Cst.asl
+ Ssdt/Cpu0Ist.asl
+ Ssdt/Cpu0Tst.asl
+ Ssdt/ApCst.asl
+ Ssdt/ApIst.asl
+ Ssdt/ApTst.asl
+ Ssdt/CpuPm.asl
+ Ssdt/LakeTiny.asl
+ Ssdt/Ctdp.asl
+
+[libraries.common]
+
+[includes.common]
+ .
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Include
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+# $(EFI_SOURCE)/$(PROJECT_PPM_ROOT)/SampleCode/Include
+
+#
+# Edk II Glue Library, some hearder are included by R9 header so have to include
+#
+
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Framework
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[nmake.common]
diff --git a/ReferenceCode/Haswell/PowerManagement/AcpiTables/PowerMgmtAcpiTables.mak b/ReferenceCode/Haswell/PowerManagement/AcpiTables/PowerMgmtAcpiTables.mak
new file mode 100644
index 0000000..1f737f3
--- /dev/null
+++ b/ReferenceCode/Haswell/PowerManagement/AcpiTables/PowerMgmtAcpiTables.mak
@@ -0,0 +1,168 @@
+# /*++
+# Copyright (c) 2009 Intel Corporation. All rights reserved.
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+# --*/
+# MAK file for the ModulePart:PowerManagementAcpiTables
+
+#-----------------------------------------------------------------------
+# ASL compiler definition
+#-----------------------------------------------------------------------
+MASL = $(SILENT)asl.exe # Microsoft ASL compiler
+!IF "$(ACPIPLATFORM_ASL_COMPILER)"==""
+!ERROR It is an invalid path, please check your ASL compiler path.
+!ENDIF
+
+IASL = $(ACPIPLATFORM_ASL_COMPILER)
+#-----------------------------------------------------------------------
+ASL_COMPILER = IASL # Default ASL compiler. Can be 'IASL' for Intel ASL and 'MASL' for Microsoft ASL compiler.
+# Note. Msft. ASL compiler of version 1.0.14NT correctly process ACPI 2.0 extended ASL objects.
+#-----------------------------------------------------------------------
+EDK : PPMASL
+
+ALLPPMSEC = $(BUILD_DIR)\CPUPM.sec\
+ $(BUILD_DIR)\CPU0IST.sec\
+ $(BUILD_DIR)\APIST.sec\
+ $(BUILD_DIR)\CPU0TST.sec\
+ $(BUILD_DIR)\APTST.sec\
+ $(BUILD_DIR)\CPU0CST.sec\
+ $(BUILD_DIR)\APCST.sec\
+ $(BUILD_DIR)\LakeTiny.sec\
+ $(BUILD_DIR)\Ctdp.sec
+
+PPMASL: $(BUILD_DIR)\PPMACPI.ffs
+
+$(BUILD_DIR)\CPUPM.aml: $(INTEL_CPUPPM_ASL_FILE)
+!if "$(ASL_COMPILER)" == "MASL"
+ @$(MASL) /Fo=$@ $**
+!elseif "$(ASL_COMPILER)" == "IASL"
+ @cl /C /EP -I $(PROJECT_CPU_INCLUDES) $(INTEL_CPUPPM_ASL_FILE) > $(BUILD_DIR)\CpuPm.asl
+ $(IASL) -p $(BUILD_DIR)\CPUPM.aml $(BUILD_DIR)\CpuPm.asl
+!endif
+
+$(BUILD_DIR)\CPU0IST.aml: $(INTEL_CPU0IST_ASL_FILE)
+!if "$(ASL_COMPILER)" == "MASL"
+ $(MASL) /Fo=$@ $**
+!elseif "$(ASL_COMPILER)" == "IASL"
+ @cl /C /EP -I $(PROJECT_CPU_INCLUDES) $(INTEL_CPU0IST_ASL_FILE) > $(BUILD_DIR)\Cpu0Ist.asl
+ $(IASL) -p $(BUILD_DIR)\CPU0IST.aml $(BUILD_DIR)\Cpu0Ist.asl
+!endif
+
+$(BUILD_DIR)\APIST.aml: $(INTEL_APIST_ASL_FILE)
+!if "$(ASL_COMPILER)" == "MASL"
+ $(MASL) /Fo=$@ $**
+!elseif "$(ASL_COMPILER)" == "IASL"
+ $(IASL) -p $(BUILD_DIR)\APIST.aml $(INTEL_APIST_ASL_FILE)
+!endif
+
+$(BUILD_DIR)\CPU0CST.aml: $(INTEL_CPU0CST_ASL_FILE)
+!if "$(ASL_COMPILER)" == "MASL"
+ $(MASL) /Fo=$@ $**
+!elseif "$(ASL_COMPILER)" == "IASL"
+ @cl /C /EP $(PROJECT_CPU_INCLUDES) $(INTEL_CPU0CST_ASL_FILE) > $(BUILD_DIR)\Cpu0Cst.asl
+ $(IASL) -p $(BUILD_DIR)\CPU0CST.aml $(BUILD_DIR)\Cpu0Cst.asl
+!endif
+
+$(BUILD_DIR)\CPU0TST.aml: $(INTEL_CPU0TST_ASL_FILE)
+!if "$(ASL_COMPILER)" == "MASL"
+ $(MASL) /Fo=$@ $**
+!elseif "$(ASL_COMPILER)" == "IASL"
+ @cl /C /EP $(PROJECT_CPU_INCLUDES) $(INTEL_CPU0TST_ASL_FILE) > $(BUILD_DIR)\Cpu0Tst.asl
+ $(IASL) -p $(BUILD_DIR)\CPU0TST.aml $(BUILD_DIR)\Cpu0Tst.asl
+!endif
+
+$(BUILD_DIR)\APCST.aml: $(INTEL_APCST_ASL_FILE)
+!if "$(ASL_COMPILER)" == "MASL"
+ $(MASL) /Fo=$@ $**
+!elseif "$(ASL_COMPILER)" == "IASL"
+ $(IASL) -p $(BUILD_DIR)\APCST.aml $(INTEL_APCST_ASL_FILE)
+!endif
+
+$(BUILD_DIR)\CPU0TST.aml: $(INTEL_CPU0TST_ASL_FILE)
+!if "$(ASL_COMPILER)" == "MASL"
+ $(MASL) /Fo=$@ $**
+!elseif "$(ASL_COMPILER)" == "IASL"
+ $(IASL) -p $(BUILD_DIR)\CPU0TST.aml $(INTEL_CPU0TST_ASL_FILE)
+!endif
+
+$(BUILD_DIR)\APTST.aml: $(INTEL_APTST_ASL_FILE)
+!if "$(ASL_COMPILER)" == "MASL"
+ $(MASL) /Fo=$@ $**
+!elseif "$(ASL_COMPILER)" == "IASL"
+ $(IASL) -p $(BUILD_DIR)\ApTst.aml $(INTEL_APTST_ASL_FILE)
+!endif
+
+$(BUILD_DIR)\LakeTiny.aml: $(INTEL_LAKETINY_ASL_FILE)
+!if "$(ASL_COMPILER)" == "MASL"
+ $(MASL) /Fo=$@ $**
+!elseif "$(ASL_COMPILER)" == "IASL"
+ $(IASL) -p $(BUILD_DIR)\LakeTiny.aml $(INTEL_LAKETINY_ASL_FILE)
+!endif
+
+$(BUILD_DIR)\Ctdp.aml: $(INTEL_CTDP_ASL_FILE)
+!if "$(ASL_COMPILER)" == "MASL"
+ $(MASL) /Fo=$@ $**
+!elseif "$(ASL_COMPILER)" == "IASL"
+ $(IASL) -p $(BUILD_DIR)\Ctdp.aml $(INTEL_CTDP_ASL_FILE)
+!endif
+
+$(BUILD_DIR)\CPUPM.sec: $(BUILD_DIR)\CPUPM.aml
+ $(GENSECTION) -I $** -O $@ -S EFI_SECTION_RAW
+
+$(BUILD_DIR)\CPU0IST.sec: $(BUILD_DIR)\CPU0IST.aml
+ $(GENSECTION) -I $** -O $@ -S EFI_SECTION_RAW
+
+$(BUILD_DIR)\APIST.sec: $(BUILD_DIR)\APIST.aml
+ $(GENSECTION) -I $** -O $@ -S EFI_SECTION_RAW
+
+$(BUILD_DIR)\CPU0TST.sec: $(BUILD_DIR)\CPU0TST.aml
+ $(GENSECTION) -I $** -O $@ -S EFI_SECTION_RAW
+
+$(BUILD_DIR)\APTST.sec: $(BUILD_DIR)\APTST.aml
+ $(GENSECTION) -I $** -O $@ -S EFI_SECTION_RAW
+
+$(BUILD_DIR)\CPU0CST.sec: $(BUILD_DIR)\CPU0CST.aml
+ $(GENSECTION) -I $** -O $@ -S EFI_SECTION_RAW
+
+$(BUILD_DIR)\APCST.sec: $(BUILD_DIR)\APCST.aml
+ $(GENSECTION) -I $** -O $@ -S EFI_SECTION_RAW
+
+$(BUILD_DIR)\LakeTiny.sec: $(BUILD_DIR)\LakeTiny.aml
+ $(GENSECTION) -I $** -O $@ -S EFI_SECTION_RAW
+
+$(BUILD_DIR)\Ctdp.sec: $(BUILD_DIR)\Ctdp.aml
+ $(GENSECTION) -I $** -O $@ -S EFI_SECTION_RAW
+
+#.SUFFIXES: .aml
+#{$(BUILD_DIR)}.aml{$(BUILD_DIR)}.sec:
+# $(GENSECTION) -I $< -O $@ -S EFI_SECTION_RAW
+
+$(BUILD_DIR)\PPMACPI.ffs: $(ALLPPMSEC) $(PowerMgmtDxe_DIR)\PowerMgmtDxe.mak
+ $(GENFFSFILE) -B $(BUILD_DIR) -V -o $@ -P1 <<$(BUILD_DIR)\PPMACPI.pkg
+PACKAGE.INF
+[.]
+BASE_NAME = PPMACPI
+FFS_FILEGUID = 299141BB-211A-48a5-92C0-6F9A0A3A006E
+FFS_FILETYPE = EFI_FV_FILETYPE_FREEFORM
+FFS_ATTRIB_CHECKSUM = TRUE
+
+IMAGE_SCRIPT =
+{
+ Compress (dummy) {
+ $(PROJECT_DIR)\$(BUILD_DIR)\CPUPM.sec
+ $(PROJECT_DIR)\$(BUILD_DIR)\CPU0IST.sec
+ $(PROJECT_DIR)\$(BUILD_DIR)\APIST.sec
+ $(PROJECT_DIR)\$(BUILD_DIR)\CPU0TST.sec
+ $(PROJECT_DIR)\$(BUILD_DIR)\APTST.sec
+ $(PROJECT_DIR)\$(BUILD_DIR)\CPU0CST.sec
+ $(PROJECT_DIR)\$(BUILD_DIR)\APCST.sec
+ $(PROJECT_DIR)\$(BUILD_DIR)\LakeTiny.sec
+ $(PROJECT_DIR)\$(BUILD_DIR)\Ctdp.sec
+ }
+}
+<<KEEP
diff --git a/ReferenceCode/Haswell/PowerManagement/AcpiTables/PowerMgmtAcpiTables.sdl b/ReferenceCode/Haswell/PowerManagement/AcpiTables/PowerMgmtAcpiTables.sdl
new file mode 100644
index 0000000..bd2bf63
--- /dev/null
+++ b/ReferenceCode/Haswell/PowerManagement/AcpiTables/PowerMgmtAcpiTables.sdl
@@ -0,0 +1,87 @@
+TOKEN
+ Name = PowerManagementAcpiTables_SUPPORT
+ Value = 1
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable PowerManagementAcpiTables support in Project"
+End
+
+MODULE
+ Help = "Includes PowerMgmtAcpiTables.mak to Project"
+ File = "PowerMgmtAcpiTables.mak"
+End
+
+PATH
+ Name = "PPMACPI_DIR"
+End
+
+TOKEN
+ Name = "INTEL_CPUPPM_ASL_FILE"
+ Value = "$(PPMACPI_DIR)\Ssdt\CpuPm.asl"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+TOKEN
+ Name = "INTEL_CPU0IST_ASL_FILE"
+ Value = "$(PPMACPI_DIR)\Ssdt\Cpu0Ist.asl"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+TOKEN
+ Name = "INTEL_APIST_ASL_FILE"
+ Value = "$(PPMACPI_DIR)\Ssdt\ApIst.asl"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+TOKEN
+ Name = "INTEL_CPU0CST_ASL_FILE"
+ Value = "$(PPMACPI_DIR)\Ssdt\Cpu0Cst.asl"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+TOKEN
+ Name = "INTEL_CPU0TST_ASL_FILE"
+ Value = "$(PPMACPI_DIR)\Ssdt\Cpu0Tst.asl"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+TOKEN
+ Name = "INTEL_APCST_ASL_FILE"
+ Value = "$(PPMACPI_DIR)\Ssdt\ApCst.asl"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+TOKEN
+ Name = "INTEL_APTST_ASL_FILE"
+ Value = "$(PPMACPI_DIR)\Ssdt\ApTst.asl"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+TOKEN
+ Name = "INTEL_LAKETINY_ASL_FILE"
+ Value = "$(PPMACPI_DIR)\Ssdt\LakeTiny.asl"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+TOKEN
+ Name = "INTEL_CTDP_ASL_FILE"
+ Value = "$(PPMACPI_DIR)\Ssdt\Ctdp.asl"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PPMACPI.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/Haswell/PowerManagement/AcpiTables/Ssdt/ApCst.asl b/ReferenceCode/Haswell/PowerManagement/AcpiTables/Ssdt/ApCst.asl
new file mode 100644
index 0000000..3be877d
--- /dev/null
+++ b/ReferenceCode/Haswell/PowerManagement/AcpiTables/Ssdt/ApCst.asl
@@ -0,0 +1,146 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2011 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ ApCst.asl
+
+Abstract:
+
+ Intel Processor Power Management ACPI Code
+
+ WARNING: You are authorized and licensed to install and use this BIOS code
+ ONLY on an IST PC. This utility may damage any system that does not
+ meet these requirements.
+
+ An IST PC is a computer which
+ (1) Is capable of seamlessly and automatically transitioning among
+ multiple performance states (potentially operating at different
+ efficiency ratings) based upon power source changes, END user
+ preference, processor performance demand, and thermal conditions; and
+ (2) Includes an Intel Pentium II processors, Intel Pentium III
+ processor, Mobile Intel Pentium III Processor-M, Mobile Intel Pentium 4
+ Processor-M, Intel Pentium M Processor, or any other future Intel
+ processors that incorporates the capability to transition between
+ different performance states by altering some, or any combination of,
+ the following processor attributes: core voltage, core frequency, bus
+ frequency, number of processor cores available, or any other attribute
+ that changes the efficiency (instructions/unit time-power) at which the
+ processor operates.
+
+--*/
+
+
+DefinitionBlock (
+ "APCST.aml",
+ "SSDT",
+ 1,
+ "PmRef",
+ "ApCst",
+ 0x3000
+ )
+{
+External(\_PR.CPU1, DeviceObj)
+External(\_PR.CPU2, DeviceObj)
+External(\_PR.CPU3, DeviceObj)
+External(\_PR.CPU4, DeviceObj)
+External(\_PR.CPU5, DeviceObj)
+External(\_PR.CPU6, DeviceObj)
+External(\_PR.CPU7, DeviceObj)
+External(\_PR.CPU0._CST)
+
+ Scope(\_PR.CPU1)
+ {
+ Method(_CST,0)
+ {
+ //
+ // Return P0's _CST object.
+ //
+ Return(\_PR.CPU0._CST)
+ }
+ }
+
+ Scope(\_PR.CPU2)
+ {
+ Method(_CST,0)
+ {
+ //
+ // Return P0's _CST object.
+ //
+ Return(\_PR.CPU0._CST)
+ }
+ }
+
+ Scope(\_PR.CPU3)
+ {
+ Method(_CST,0)
+ {
+ //
+ // Return P0's _CST object.
+ //
+ Return(\_PR.CPU0._CST)
+ }
+ }
+
+ Scope(\_PR.CPU4)
+ {
+ Method(_CST,0)
+ {
+ //
+ // Return P0's _CST object.
+ //
+ Return(\_PR.CPU0._CST)
+ }
+ }
+
+ Scope(\_PR.CPU5)
+ {
+ Method(_CST,0)
+ {
+ //
+ // Return P0's _CST object.
+ //
+ Return(\_PR.CPU0._CST)
+ }
+ }
+
+ Scope(\_PR.CPU6)
+ {
+ Method(_CST,0)
+ {
+ //
+ // Return P0's _CST object.
+ //
+ Return(\_PR.CPU0._CST)
+ }
+ }
+
+ Scope(\_PR.CPU7)
+ {
+ Method(_CST,0)
+ {
+ //
+ // Return P0's _CST object.
+ //
+ Return(\_PR.CPU0._CST)
+ }
+ }
+
+} // End of Definition Block
diff --git a/ReferenceCode/Haswell/PowerManagement/AcpiTables/Ssdt/ApIst.asl b/ReferenceCode/Haswell/PowerManagement/AcpiTables/Ssdt/ApIst.asl
new file mode 100644
index 0000000..612101c
--- /dev/null
+++ b/ReferenceCode/Haswell/PowerManagement/AcpiTables/Ssdt/ApIst.asl
@@ -0,0 +1,408 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ ApIst.asl
+
+Abstract:
+
+ Intel Processor Power Management ACPI Code
+
+ WARNING: You are authorized and licensed to install and use this BIOS code
+ ONLY on an IST PC. This utility may damage any system that does not
+ meet these requirements.
+
+ An IST PC is a computer which
+ (1) Is capable of seamlessly and automatically transitioning among
+ multiple performance states (potentially operating at different
+ efficiency ratings) based upon power source changes, END user
+ preference, processor performance demand, and thermal conditions; and
+ (2) Includes an Intel Pentium II processors, Intel Pentium III
+ processor, Mobile Intel Pentium III Processor-M, Mobile Intel Pentium 4
+ Processor-M, Intel Pentium M Processor, or any other future Intel
+ processors that incorporates the capability to transition between
+ different performance states by altering some, or any combination of,
+ the following processor attributes: core voltage, core frequency, bus
+ frequency, number of processor cores available, or any other attribute
+ that changes the efficiency (instructions/unit time-power) at which the
+ processor operates.
+
+--*/
+
+
+DefinitionBlock (
+ "APIST.aml",
+ "SSDT",
+ 1,
+ "PmRef",
+ "ApIst",
+ 0x3000
+ )
+{
+ External(\_PR.CPU0._PSS, MethodObj)
+ External(\_PR.CPU0._PCT, MethodObj)
+ External(\_PR.CPU0._PPC, IntObj)
+ External(\_PR.CPU0._PSD, MethodObj)
+ External(\_PR.CPU1, DeviceObj)
+ External(\_PR.CPU2, DeviceObj)
+ External(\_PR.CPU3, DeviceObj)
+ External(\_PR.CPU4, DeviceObj)
+ External(\_PR.CPU5, DeviceObj)
+ External(\_PR.CPU6, DeviceObj)
+ External(\_PR.CPU7, DeviceObj)
+ External (CFGD)
+ External (PDC0)
+ External (MPMF)
+ External (TCNT)
+
+ Scope(\_PR.CPU1)
+ {
+ Method(_PPC,0)
+ {
+ Return(\_PR.CPU0._PPC) // Return P0 _PPC value.
+ }
+
+ Method(_PCT,0)
+ {
+ Return(\_PR.CPU0._PCT) // Return P0 _PCT.
+
+ }
+
+ Method(_PSS,0)
+ {
+ //Return the same table as CPU0 for CMP cases.
+ Return(\_PR.CPU0._PSS)
+ }
+
+ Name (PSDF, 0)
+ //
+ // The _PSD object provides information to the OSPM related
+ // to P-State coordination between processors in a multi-processor
+ // configurations.
+ //
+ Method(_PSD,0)
+ {
+ If ( LNot(PSDF) )
+ {
+ Store (TCNT, Index(DerefOf(Index(HPSD, 0)),4))
+ Store (TCNT, Index(DerefOf(Index(SPSD, 0)),4))
+ Store (Ones, PSDF)
+ }
+ If(And(PDC0,0x0800))
+ {
+ Return(HPSD)
+ }
+ Return(SPSD)
+ }
+ Name(HPSD,Package() // HW_ALL
+ {
+ Package(){5, 0, 0, 0xFE, 0x80}
+ })
+ Name(SPSD,Package() // SW_ALL
+ {
+ Package(){5, 0, 0, 0xFC, 0x80}
+ })
+ }
+
+ Scope(\_PR.CPU2)
+ {
+ Method(_PPC,0)
+ {
+ Return(\_PR.CPU0._PPC) // Return CPU0 _PPC value.
+ }
+
+ Method(_PCT,0)
+ {
+ Return(\_PR.CPU0._PCT) // Return CPU0 _PCT value.
+ }
+
+ Method(_PSS,0)
+ {
+ Return(\_PR.CPU0._PSS) // Return CPU0 _PSS.
+ }
+
+ Name (PSDF, 0)
+ //
+ // The _PSD object provides information to the OSPM related
+ // to P-State coordination between processors in a multi-processor
+ // configurations.
+ //
+ Method(_PSD,0)
+ {
+ If ( LNot(PSDF) )
+ {
+ Store (TCNT, Index(DerefOf(Index(HPSD, 0)),4))
+ Store (TCNT, Index(DerefOf(Index(SPSD, 0)),4))
+ Store (Ones, PSDF)
+ }
+ If(And(PDC0,0x0800))
+ {
+ Return(HPSD)
+ }
+ Return(SPSD)
+ }
+ Name(HPSD,Package() // HW_ALL
+ {
+ Package(){5, 0, 0, 0xFE, 0x80}
+ })
+ Name(SPSD,Package() // SW_ALL
+ {
+ Package(){5, 0, 0, 0xFC, 0x80}
+ })
+ }
+
+
+ Scope(\_PR.CPU3)
+ {
+ Method(_PPC,0)
+ {
+ Return(\_PR.CPU0._PPC) // Return CPU0 _PPC value.
+ }
+
+ Method(_PCT,0)
+ {
+ Return(\_PR.CPU0._PCT) // Return CPU0 _PCT value.
+ }
+
+ Method(_PSS,0)
+ {
+ Return(\_PR.CPU0._PSS) // Return CPU0 _PSS.
+ }
+
+ Name (PSDF, 0)
+ //
+ // The _PSD object provides information to the OSPM related
+ // to P-State coordination between processors in a multi-processor
+ // configurations.
+ //
+ Method(_PSD,0)
+ {
+ If ( LNot(PSDF) )
+ {
+ Store (TCNT, Index(DerefOf(Index(HPSD, 0)),4))
+ Store (TCNT, Index(DerefOf(Index(SPSD, 0)),4))
+ Store (Ones, PSDF)
+ }
+ If(And(PDC0,0x0800))
+ {
+ Return(HPSD)
+ }
+ Return(SPSD)
+ }
+ Name(HPSD,Package() // HW_ALL
+ {
+ Package(){5, 0, 0, 0xFE, 0x80}
+ })
+ Name(SPSD,Package() // SW_ALL
+ {
+ Package(){5, 0, 0, 0xFC, 0x80}
+ })
+ }
+
+ Scope(\_PR.CPU4)
+ {
+ Method(_PPC,0)
+ {
+ Return(\_PR.CPU0._PPC) // Return CPU0 _PPC value.
+ }
+
+ Method(_PCT,0)
+ {
+ Return(\_PR.CPU0._PCT) // Return CPU0 _PCT value.
+ }
+
+ Method(_PSS,0)
+ {
+ Return(\_PR.CPU0._PSS) // Return CPU0 _PSS.
+ }
+
+ Name (PSDF, 0)
+ //
+ // The _PSD object provides information to the OSPM related
+ // to P-State coordination between processors in a multi-processor
+ // configurations.
+ //
+ Method(_PSD,0)
+ {
+ If ( LNot(PSDF) )
+ {
+ Store (TCNT, Index(DerefOf(Index(HPSD, 0)),4))
+ Store (TCNT, Index(DerefOf(Index(SPSD, 0)),4))
+ Store (Ones, PSDF)
+ }
+ If(And(PDC0,0x0800))
+ {
+ Return(HPSD)
+ }
+ Return(SPSD)
+ }
+ Name(HPSD,Package() // HW_ALL
+ {
+ Package(){5, 0, 0, 0xFE, 0x80}
+ })
+ Name(SPSD,Package() // SW_ALL
+ {
+ Package(){5, 0, 0, 0xFC, 0x80}
+ })
+ }
+
+ Scope(\_PR.CPU5)
+ {
+ Method(_PPC,0)
+ {
+ Return(\_PR.CPU0._PPC) // Return CPU0 _PPC value.
+ }
+
+ Method(_PCT,0)
+ {
+ Return(\_PR.CPU0._PCT) // Return CPU0 _PCT value.
+ }
+
+ Method(_PSS,0)
+ {
+ Return(\_PR.CPU0._PSS) // Return CPU0 _PSS.
+ }
+
+ Name (PSDF, 0)
+ //
+ // The _PSD object provides information to the OSPM related
+ // to P-State coordination between processors in a multi-processor
+ // configurations.
+ //
+ Method(_PSD,0)
+ {
+ If ( LNot(PSDF) )
+ {
+ Store (TCNT, Index(DerefOf(Index(HPSD, 0)),4))
+ Store (TCNT, Index(DerefOf(Index(SPSD, 0)),4))
+ Store (Ones, PSDF)
+ }
+ If(And(PDC0,0x0800))
+ {
+ Return(HPSD)
+ }
+ Return(SPSD)
+ }
+ Name(HPSD,Package() // HW_ALL
+ {
+ Package(){5, 0, 0, 0xFE, 0x80}
+ })
+ Name(SPSD,Package() // SW_ALL
+ {
+ Package(){5, 0, 0, 0xFC, 0x80}
+ })
+ }
+
+ Scope(\_PR.CPU6)
+ {
+ Method(_PPC,0)
+ {
+ Return(\_PR.CPU0._PPC) // Return CPU0 _PPC value.
+ }
+
+ Method(_PCT,0)
+ {
+ Return(\_PR.CPU0._PCT) // Return CPU0 _PCT value.
+ }
+
+ Method(_PSS,0)
+ {
+ Return(\_PR.CPU0._PSS) // Return CPU0 _PSS.
+ }
+
+ Name (PSDF, 0)
+ //
+ // The _PSD object provides information to the OSPM related
+ // to P-State coordination between processors in a multi-processor
+ // configurations.
+ //
+ Method(_PSD,0)
+ {
+ If ( LNot(PSDF) )
+ {
+ Store (TCNT, Index(DerefOf(Index(HPSD, 0)),4))
+ Store (TCNT, Index(DerefOf(Index(SPSD, 0)),4))
+ Store (Ones, PSDF)
+ }
+ If(And(PDC0,0x0800))
+ {
+ Return(HPSD)
+ }
+ Return(SPSD)
+ }
+ Name(HPSD,Package() // HW_ALL
+ {
+ Package(){5, 0, 0, 0xFE, 0x80}
+ })
+ Name(SPSD,Package() // SW_ALL
+ {
+ Package(){5, 0, 0, 0xFC, 0x80}
+ })
+ }
+
+ Scope(\_PR.CPU7)
+ {
+ Method(_PPC,0)
+ {
+ Return(\_PR.CPU0._PPC) // Return CPU0 _PPC value.
+ }
+
+ Method(_PCT,0)
+ {
+ Return(\_PR.CPU0._PCT) // Return CPU0 _PCT value.
+ }
+
+ Method(_PSS,0)
+ {
+ Return(\_PR.CPU0._PSS) // Return CPU0 _PSS.
+ }
+
+ Name (PSDF, 0)
+ //
+ // The _PSD object provides information to the OSPM related
+ // to P-State coordination between processors in a multi-processor
+ // configurations.
+ //
+ Method(_PSD,0)
+ {
+ If ( LNot(PSDF) )
+ {
+ Store (TCNT, Index(DerefOf(Index(HPSD, 0)),4))
+ Store (TCNT, Index(DerefOf(Index(SPSD, 0)),4))
+ Store (Ones, PSDF)
+ }
+ If(And(PDC0,0x0800))
+ {
+ Return(HPSD)
+ }
+ Return(SPSD)
+ }
+ Name(HPSD,Package() // HW_ALL
+ {
+ Package(){5, 0, 0, 0xFE, 0x80}
+ })
+ Name(SPSD,Package() // SW_ALL
+ {
+ Package(){5, 0, 0, 0xFC, 0x80}
+ })
+ }
+
+} // End of Definition Block
diff --git a/ReferenceCode/Haswell/PowerManagement/AcpiTables/Ssdt/ApTst.asl b/ReferenceCode/Haswell/PowerManagement/AcpiTables/Ssdt/ApTst.asl
new file mode 100644
index 0000000..13972c2
--- /dev/null
+++ b/ReferenceCode/Haswell/PowerManagement/AcpiTables/Ssdt/ApTst.asl
@@ -0,0 +1,481 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ ApTst.asl
+
+Abstract:
+
+ Intel Processor Power Management ACPI Code
+
+ WARNING: You are authorized and licensed to install and use this BIOS code
+ ONLY on an IST PC. This utility may damage any system that does not
+ meet these requirements.
+
+ An IST PC is a computer which
+ (1) Is capable of seamlessly and automatically transitioning among
+ multiple performance states (potentially operating at different
+ efficiency ratings) based upon power source changes, END user
+ preference, processor performance demand, and thermal conditions; and
+ (2) Includes an Intel Pentium II processors, Intel Pentium III
+ processor, Mobile Intel Pentium III Processor-M, Mobile Intel Pentium 4
+ Processor-M, Intel Pentium M Processor, or any other future Intel
+ processors that incorporates the capability to transition between
+ different performance states by altering some, or any combination of,
+ the following processor attributes: core voltage, core frequency, bus
+ frequency, number of processor cores available, or any other attribute
+ that changes the efficiency (instructions/unit time-power) at which the
+ processor operates.
+
+--*/
+
+
+DefinitionBlock(
+ "APTST.aml",
+ "SSDT",
+ 0x01,
+ "PmRef",
+ "ApTst",
+ 0x3000
+ )
+{
+ External(\_PR.CPU1, DeviceObj)
+ External(\_PR.CPU2, DeviceObj)
+ External(\_PR.CPU3, DeviceObj)
+ External(\_PR.CPU4, DeviceObj)
+ External(\_PR.CPU5, DeviceObj)
+ External(\_PR.CPU6, DeviceObj)
+ External(\_PR.CPU7, DeviceObj)
+ External(\_PR.CPU0._PTC)
+ External(\_PR.CPU0._TSS)
+ External(PDC0)
+ External(CFGD)
+ External(TCNT)
+
+ Scope(\_PR.CPU1)
+ {
+ Name(_TPC, 0) // All T-States are available
+
+ //
+ // T-State Control/Status interface
+ //
+ Method(_PTC, 0)
+ {
+ Return(\_PR.CPU0._PTC)
+ }
+
+ Method(_TSS, 0)
+ {
+ Return(\_PR.CPU0._TSS)
+ }
+
+ //
+ // T-State Dependency
+ //
+ Method(_TSD, 0)
+ {
+ //
+ // IF four cores are supported/enabled && !(direct access to MSR)
+ // Report 4 processors and SW_ANY as the coordination
+ // IF two cores are supported/enabled && !(direct access to MSR)
+ // Report 2 processors and SW_ANY as the coordination type
+ // ELSE
+ // Report 1 processor and SW_ALL as the coordination type (domain 1)
+ //
+ // PDCx[2] = OSPM is capable of direct access to On
+ // Demand throttling MSR
+ //
+
+ If(LNot(And(PDC0,4)))
+ {
+ Return(Package(){ // SW_ANY
+ Package(){
+ 5, // # entries.
+ 0, // Revision.
+ 0, // Domain #.
+ 0xFD, // Coord Type- SW_ANY
+ TCNT // # processors.
+ }
+ })
+ }
+ Return(Package(){ // SW_ALL
+ Package(){
+ 5, // # entries.
+ 0, // Revision.
+ 1, // Domain #.
+ 0xFC, // Coord Type- SW_ALL
+ 1 // # processors.
+ }
+ })
+ }
+ } // End of CPU1
+
+
+ Scope(\_PR.CPU2)
+ {
+ Name(_TPC, 0) // All T-States are available
+
+ //
+ // T-State Control/Status interface
+ //
+ Method(_PTC, 0)
+ {
+ Return(\_PR.CPU0._PTC)
+ }
+
+ Method(_TSS, 0)
+ {
+ Return(\_PR.CPU0._TSS)
+ }
+
+ //
+ // T-State Dependency
+ //
+ Method(_TSD, 0)
+ {
+ //
+ // IF four cores are supported/enabled && !(direct access to MSR)
+ // Report 4 processors and SW_ANY as the coordination
+ // IF two cores are supported/enabled && !(direct access to MSR)
+ // Report 2 processors and SW_ANY as the coordination type
+ // ELSE
+ // Report 1 processor and SW_ALL as the coordination type (domain 2)
+ //
+ // PDCx[2] = OSPM is capable of direct access to On
+ // Demand throttling MSR
+ //
+
+ If(LNot(And(PDC0,4)))
+ {
+ Return(Package(){ // SW_ANY
+ Package(){
+ 5, // # entries.
+ 0, // Revision.
+ 0, // Domain #.
+ 0xFD, // Coord Type- SW_ANY
+ TCNT // # processors.
+ }
+ })
+ }
+ Return(Package(){ // SW_ALL
+ Package(){
+ 5, // # entries.
+ 0, // Revision.
+ 2, // Domain #.
+ 0xFC, // Coord Type- SW_ALL
+ 1 // # processors.
+ }
+ })
+ }
+ } // End of CPU2
+
+
+ Scope(\_PR.CPU3)
+ {
+ Name(_TPC, 0) // All T-States are available
+
+ //
+ // T-State Control/Status interface
+ //
+ Method(_PTC, 0)
+ {
+ Return(\_PR.CPU0._PTC)
+ }
+
+ Method(_TSS, 0)
+ {
+ Return(\_PR.CPU0._TSS)
+ }
+
+ //
+ // T-State Dependency
+ //
+ Method(_TSD, 0)
+ {
+ //
+ // IF four cores are supported/enabled && !(direct access to MSR)
+ // Report 4 processors and SW_ANY as the coordination
+ // IF two cores are supported/enabled && !(direct access to MSR)
+ // Report 2 processors and SW_ANY as the coordination type
+ // ELSE
+ // Report 1 processor and SW_ALL as the coordination type (domain 3)
+ //
+ // PDCx[2] = OSPM is capable of direct access to On
+ // Demand throttling MSR
+ //
+
+ If(LNot(And(PDC0,4)))
+ {
+ Return(Package(){ // SW_ANY
+ Package(){
+ 5, // # entries.
+ 0, // Revision.
+ 0, // Domain #.
+ 0xFD, // Coord Type- SW_ANY
+ TCNT // # processors.
+ }
+ })
+ }
+ Return(Package(){ // SW_ALL
+ Package(){
+ 5, // # entries.
+ 0, // Revision.
+ 3, // Domain #.
+ 0xFC, // Coord Type- SW_ALL
+ 1 // # processors.
+ }
+ })
+ }
+ } // End of CPU3
+
+ Scope(\_PR.CPU4)
+ {
+ Name(_TPC, 0) // All T-States are available
+
+ //
+ // T-State Control/Status interface
+ //
+ Method(_PTC, 0)
+ {
+ Return(\_PR.CPU0._PTC)
+ }
+
+ Method(_TSS, 0)
+ {
+ Return(\_PR.CPU0._TSS)
+ }
+
+ //
+ // T-State Dependency
+ //
+ Method(_TSD, 0)
+ {
+ //
+ // IF four cores are supported/enabled && !(direct access to MSR)
+ // Report 4 processors and SW_ANY as the coordination
+ // IF two cores are supported/enabled && !(direct access to MSR)
+ // Report 2 processors and SW_ANY as the coordination type
+ // ELSE
+ // Report 1 processor and SW_ALL as the coordination type (domain 3)
+ //
+ // PDCx[2] = OSPM is capable of direct access to On
+ // Demand throttling MSR
+ //
+
+ If(LNot(And(PDC0,4)))
+ {
+ Return(Package(){ // SW_ANY
+ Package(){
+ 5, // # entries.
+ 0, // Revision.
+ 0, // Domain #.
+ 0xFD, // Coord Type- SW_ANY
+ TCNT // # processors.
+ }
+ })
+ }
+ Return(Package(){ // SW_ALL
+ Package(){
+ 5, // # entries.
+ 0, // Revision.
+ 4, // Domain #.
+ 0xFC, // Coord Type- SW_ALL
+ 1 // # processors.
+ }
+ })
+ }
+ } // End of CPU4
+
+ Scope(\_PR.CPU5)
+ {
+ Name(_TPC, 0) // All T-States are available
+
+ //
+ // T-State Control/Status interface
+ //
+ Method(_PTC, 0)
+ {
+ Return(\_PR.CPU0._PTC)
+ }
+
+ Method(_TSS, 0)
+ {
+ Return(\_PR.CPU0._TSS)
+ }
+
+ //
+ // T-State Dependency
+ //
+ Method(_TSD, 0)
+ {
+ //
+ // IF four cores are supported/enabled && !(direct access to MSR)
+ // Report 4 processors and SW_ANY as the coordination
+ // IF two cores are supported/enabled && !(direct access to MSR)
+ // Report 2 processors and SW_ANY as the coordination type
+ // ELSE
+ // Report 1 processor and SW_ALL as the coordination type (domain 3)
+ //
+ // PDCx[2] = OSPM is capable of direct access to On
+ // Demand throttling MSR
+ //
+
+ If(LNot(And(PDC0,4)))
+ {
+ Return(Package(){ // SW_ANY
+ Package(){
+ 5, // # entries.
+ 0, // Revision.
+ 0, // Domain #.
+ 0xFD, // Coord Type- SW_ANY
+ TCNT // # processors.
+ }
+ })
+ }
+ Return(Package(){ // SW_ALL
+ Package(){
+ 5, // # entries.
+ 0, // Revision.
+ 5, // Domain #.
+ 0xFC, // Coord Type- SW_ALL
+ 1 // # processors.
+ }
+ })
+ }
+ } // End of CPU5
+
+ Scope(\_PR.CPU6)
+ {
+ Name(_TPC, 0) // All T-States are available
+
+ //
+ // T-State Control/Status interface
+ //
+ Method(_PTC, 0)
+ {
+ Return(\_PR.CPU0._PTC)
+ }
+
+ Method(_TSS, 0)
+ {
+ Return(\_PR.CPU0._TSS)
+ }
+
+ //
+ // T-State Dependency
+ //
+ Method(_TSD, 0)
+ {
+ //
+ // IF four cores are supported/enabled && !(direct access to MSR)
+ // Report 4 processors and SW_ANY as the coordination
+ // IF two cores are supported/enabled && !(direct access to MSR)
+ // Report 2 processors and SW_ANY as the coordination type
+ // ELSE
+ // Report 1 processor and SW_ALL as the coordination type (domain 3)
+ //
+ // PDCx[2] = OSPM is capable of direct access to On
+ // Demand throttling MSR
+ //
+
+ If(LNot(And(PDC0,4)))
+ {
+ Return(Package(){ // SW_ANY
+ Package(){
+ 5, // # entries.
+ 0, // Revision.
+ 0, // Domain #.
+ 0xFD, // Coord Type- SW_ANY
+ TCNT // # processors.
+ }
+ })
+ }
+ Return(Package(){ // SW_ALL
+ Package(){
+ 5, // # entries.
+ 0, // Revision.
+ 6, // Domain #.
+ 0xFC, // Coord Type- SW_ALL
+ 1 // # processors.
+ }
+ })
+ }
+ } // End of CPU6
+
+ Scope(\_PR.CPU7)
+ {
+ Name(_TPC, 0) // All T-States are available
+
+ //
+ // T-State Control/Status interface
+ //
+ Method(_PTC, 0)
+ {
+ Return(\_PR.CPU0._PTC)
+ }
+
+ Method(_TSS, 0)
+ {
+ Return(\_PR.CPU0._TSS)
+ }
+
+ //
+ // T-State Dependency
+ //
+ Method(_TSD, 0)
+ {
+ //
+ // IF four cores are supported/enabled && !(direct access to MSR)
+ // Report 4 processors and SW_ANY as the coordination
+ // IF two cores are supported/enabled && !(direct access to MSR)
+ // Report 2 processors and SW_ANY as the coordination type
+ // ELSE
+ // Report 1 processor and SW_ALL as the coordination type (domain 3)
+ //
+ // PDCx[2] = OSPM is capable of direct access to On
+ // Demand throttling MSR
+ //
+
+ If(LNot(And(PDC0,4)))
+ {
+ Return(Package(){ // SW_ANY
+ Package(){
+ 5, // # entries.
+ 0, // Revision.
+ 0, // Domain #.
+ 0xFD, // Coord Type- SW_ANY
+ TCNT // # processors.
+ }
+ })
+ }
+ Return(Package(){ // SW_ALL
+ Package(){
+ 5, // # entries.
+ 0, // Revision.
+ 7, // Domain #.
+ 0xFC, // Coord Type- SW_ALL
+ 1 // # processors.
+ }
+ })
+ }
+ } // End of CPU7
+} // End of Definition Block
+
diff --git a/ReferenceCode/Haswell/PowerManagement/AcpiTables/Ssdt/Cpu0Cst.asl b/ReferenceCode/Haswell/PowerManagement/AcpiTables/Ssdt/Cpu0Cst.asl
new file mode 100644
index 0000000..6c0c48a
--- /dev/null
+++ b/ReferenceCode/Haswell/PowerManagement/AcpiTables/Ssdt/Cpu0Cst.asl
@@ -0,0 +1,319 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ Cpu0Cst.asl
+
+Abstract:
+
+ Intel Processor Power Management ACPI Code
+
+ WARNING: You are authorized and licensed to install and use this BIOS code
+ ONLY on an IST PC. This utility may damage any system that does not
+ meet these requirements.
+
+ An IST PC is a computer which
+ (1) Is capable of seamlessly and automatically transitioning among
+ multiple performance states (potentially operating at different
+ efficiency ratings) based upon power source changes, END user
+ preference, processor performance demand, and thermal conditions; and
+ (2) Includes an Intel Pentium II processors, Intel Pentium III
+ processor, Mobile Intel Pentium III Processor-M, Mobile Intel Pentium 4
+ Processor-M, Intel Pentium M Processor, or any other future Intel
+ processors that incorporates the capability to transition between
+ different performance states by altering some, or any combination of,
+ the following processor attributes: core voltage, core frequency, bus
+ frequency, number of processor cores available, or any other attribute
+ that changes the efficiency (instructions/unit time-power) at which the
+ processor operates.
+
+--*/
+
+
+#include "PowerMgmtDefinitions.h"
+
+DefinitionBlock (
+ "CPU0CST.aml",
+ "SSDT",
+ 1,
+ "PmRef",
+ "Cpu0Cst",
+ 0x3001
+ )
+{
+External(\_PR.CPU0, DeviceObj)
+External(PWRS)
+External(CFGD)
+External(PDC0)
+External(FMBL)
+External(FEMD)
+External(PFLV)
+External(C3MW) // Mwait Hint value for C3
+External(C6MW) // Mwait Hint value for C6
+External(C7MW) // Mwait Hint value for C7
+External(CDMW) // Mwait Hint value for C8/C9/C10
+External(C3LT) // Latency value for C3
+External(C6LT) // Latency Value for C6
+External(C7LT) // Latency Value for C7
+External(CDLT) // Latency Value for C8/C9/C10
+External(CDLV) // IO Level value for C8/C9/C10
+External(CDPW) // Power value for C8/C9/C10
+
+Scope(\_PR.CPU0)
+{
+ //
+ // Create Temp packages for each C-state and Initialize them to default IO_LVL
+ //
+ // C1 Temp Package (C1 - HLT)
+ //
+ Name ( C1TM, Package()
+ {
+ ResourceTemplate () {Register(FFixedHW, 0, 0, 0)},
+ 1,
+ C1_LATENCY,
+ C1_POWER
+ })
+ //
+ // C3 Temp Package
+ //
+ Name ( C3TM, Package()
+ {
+ ResourceTemplate () {Register(SystemIO, 8, 0, PCH_ACPI_LV2)},
+ 2,
+ 0,
+ C3_POWER
+ })
+ //
+ // C6 Temp Package
+ //
+ Name ( C6TM, Package()
+ {
+ ResourceTemplate () {Register(SystemIO, 8, 0, PCH_ACPI_LV3)},
+ 2,
+ 0,
+ C6_POWER
+ })
+
+ //
+ // C7 Temp Package
+ //
+ Name ( C7TM, Package()
+ {
+ ResourceTemplate () {Register(SystemIO, 8, 0, PCH_ACPI_LV4)},
+ 2,
+ 0,
+ C7_POWER
+ })
+
+ //
+ // CD Temp Package - Deep C-states - covers C8/C9/C10
+ //
+ Name ( CDTM, Package()
+ {
+ ResourceTemplate () {Register(SystemIO, 8, 0, PCH_ACPI_LV4)},
+ 3,
+ 0,
+ 0
+ })
+ //
+ // ResourceTemplate for MWait Extentions Supported.
+ //
+ Name ( MWES, ResourceTemplate(){Register(FFixedHW, 1, 2, 0x00, 1)})
+ //
+ // Valid/Invalid Flags for ACPI C2 and C3
+ //
+ Name (AC2V, 0)
+ Name (AC3V, 0)
+ //
+ // Package for reporting 3 C-states
+ //
+ Name ( C3ST, Package()
+ {
+ 3,
+ Package() {},
+ Package() {},
+ Package() {}
+ })
+ //
+ // Package for reporting 2 C-states
+ //
+ Name ( C2ST, Package()
+ {
+ 2,
+ Package() {},
+ Package() {}
+ })
+ //
+ // Package for reporting 1 C-state
+ //
+ Name ( C1ST, Package()
+ {
+ 1,
+ Package() {}
+ })
+ //
+ // C-state initialization flag
+ //
+ Name(CSTF, 0)
+ //
+ // Lake Tiny Gear control setting (deafult value for Gear1)
+ //
+ Name (GEAR, 0)
+ //
+ // Returns the C-state table based on platform configuration.
+ // This method is serialized since it uses various global packages and updates them in run time to return the current C-state table.
+ //
+ Method (_CST, 0, Serialized)
+ {
+ If(LNot(CSTF))
+ {
+ //
+ // First call to _CST.
+ // Update Latency Values for C3/C6/C7/CD based on the Latency values passed through PPM NVS
+ //
+ Store (C3LT, Index(C3TM, 2))
+ Store (C6LT, Index(C6TM, 2))
+ Store (C7LT, Index(C7TM, 2))
+ Store (CDLT, Index(CDTM, 2))
+ //
+ // Update the IO_LVL and Power values in CD temp package
+ //
+ Store (CDPW, Index(CDTM, 3))
+ Store (CDLV, Index (DerefOf (Index (CDTM, 0)),7))
+ //
+ // CFGD[11] = 1 - MWAIT extensions supported
+ // PDCx[9] = 1 - OS supports MWAIT extensions
+ // PDCx[8] = 1 - OS supports MWAIT for C1 (Inferred from PDCx[9] = 1.)
+ //
+ If(LAnd(And(CFGD, PPM_MWAIT_EXT), And(PDC0,0x200)))
+ {
+ //
+ // Processor MWAIT extensions supported and OS supports MWAIT extensions
+ // 1. Replace the IO LVL ResourceTemplate of C1TM, C3TM, C6TM, C7TM, CDTM with MWAIT EXT ResourceTemplate (FFixedHW)
+ // 2. Update the Mwait Hint Values for C3/C6/C7/CD based on the Latency values passed through PPM NVS
+ //
+
+ Store (MWES, Index (C1TM, 0))
+ Store (MWES, Index (C3TM, 0))
+ Store (MWES, Index (C6TM, 0))
+ Store (MWES, Index (C7TM, 0))
+ Store (MWES, Index (CDTM, 0))
+
+ Store (C3MW, Index (DerefOf (Index (C3TM, 0)),7))
+ Store (C6MW, Index (DerefOf (Index (C6TM, 0)),7))
+ Store (C7MW, Index (DerefOf (Index (C7TM, 0)),7))
+ Store (CDMW, Index (DerefOf (Index (CDTM, 0)),7))
+ }
+ ElseIf (LAnd(And(CFGD, PPM_MWAIT_EXT), And(PDC0,0x100)))
+ {
+ //
+ // Update C1 temp package ResourceTemplate if OS supports Mwait for C1
+ //
+ Store (MWES, Index (C1TM, 0))
+ }
+
+ Store (Ones, CSTF)
+ }
+ //
+ // Initialize the ACPI C2, C3 Valid/Invalid flags to Invalid (0)
+ //
+ Store(Zero, AC2V)
+ Store(Zero, AC3V)
+ //
+ // Create C state Package with Acpi C1= C1,ACPI C2=MaxSupported(C6,C3,C7),ACPI C3=MaxSupported(C8,C9,C10).
+ // It is safe to assume C1 always supported if we enable C-states.
+ //
+ Store (C1TM, Index (C3ST,1))
+
+ If(And(CFGD,PPM_C7))
+ {
+ Store (C7TM, Index (C3ST,2))
+ Store (Ones, AC2V)
+ }ElseIf(And(CFGD,PPM_C6))
+ {
+ Store (C6TM, Index (C3ST,2))
+ Store (Ones, AC2V)
+ }ElseIf(And(CFGD,PPM_C3))
+ {
+ Store (C3TM, Index (C3ST,2))
+ Store (Ones, AC2V)
+ }
+ If(And(CFGD,PPM_CD)) {
+ Store (CDTM, Index (C3ST,3))
+ Store (Ones, AC3V)
+ }
+ //
+ // Modify the ACPI C2 and C3 states if LakeTiny GEAR2 or GEAR3. GEAR1- No Change
+ //
+ If(LEqual (GEAR, 1))
+ {
+ //
+ // GEAR2 - Deepest C-state is replaced with C3 and with C1 (if C3 not supported)
+ //
+ If (And(CFGD,PPM_C3))
+ {
+ Store (C3TM, Index (C3ST,2))
+ Store (Ones, AC2V)
+ Store (Zero, AC3V)
+ }
+ Else
+ {
+ Store (Zero, AC2V)
+ Store (Zero, AC3V)
+ }
+ }
+ If(LEqual (GEAR, 2))
+ {
+ //
+ // GEAR3 - Replace all C-states with C1
+ //
+ Store (Zero, AC2V)
+ Store (Zero, AC3V)
+ }
+
+ //
+ // Filter and return the final C-state package
+ //
+ If(LAnd(AC2V, AC3V))
+ {
+ Return (C3ST)
+ }
+ ElseIf(AC2V)
+ {
+ Store (DerefOf (Index (C3ST,1)), Index (C2ST,1))
+ Store (DerefOf (Index (C3ST,2)), Index (C2ST,2))
+ Return (C2ST)
+ }
+ ElseIf(AC3V)
+ {
+ Store (DerefOf (Index (C3ST,1)), Index (C2ST,1))
+ Store (DerefOf (Index (C3ST,3)), Index (C2ST,2))
+ Store (2, Index (DerefOf (Index (C2ST, 2)),1))
+ Return (C2ST)
+ }
+ Else
+ {
+ Store (DerefOf (Index (C3ST,1)), Index (C1ST,1))
+ Return (C1ST)
+ }
+ }
+}
+}
diff --git a/ReferenceCode/Haswell/PowerManagement/AcpiTables/Ssdt/Cpu0Ist.asl b/ReferenceCode/Haswell/PowerManagement/AcpiTables/Ssdt/Cpu0Ist.asl
new file mode 100644
index 0000000..83b5294
--- /dev/null
+++ b/ReferenceCode/Haswell/PowerManagement/AcpiTables/Ssdt/Cpu0Ist.asl
@@ -0,0 +1,163 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ Cpu0Ist.asl
+
+Abstract:
+
+ Intel Processor Power Management ACPI Code
+
+ WARNING: You are authorized and licensed to install and use this BIOS code
+ ONLY on an IST PC. This utility may damage any system that does not
+ meet these requirements.
+
+ An IST PC is a computer which
+ (1) Is capable of seamlessly and automatically transitioning among
+ multiple performance states (potentially operating at different
+ efficiency ratings) based upon power source changes, END user
+ preference, processor performance demand, and thermal conditions; and
+ (2) Includes an Intel Pentium II processors, Intel Pentium III
+ processor, Mobile Intel Pentium III Processor-M, Mobile Intel Pentium 4
+ Processor-M, Intel Pentium M Processor, or any other future Intel
+ processors that incorporates the capability to transition between
+ different performance states by altering some, or any combination of,
+ the following processor attributes: core voltage, core frequency, bus
+ frequency, number of processor cores available, or any other attribute
+ that changes the efficiency (instructions/unit time-power) at which the
+ processor operates.
+
+--*/
+
+
+DefinitionBlock (
+ "CPU0IST.aml",
+ "SSDT",
+ 0x01,
+ "PmRef",
+ "Cpu0Ist",
+ 0x3000
+ )
+{
+ External (\_PR.CPU0, DeviceObj)
+ External (\_PR.CPPC)
+ External (PDC0)
+ External (CFGD)
+ External (TCNT)
+ External (MPMF)
+ Scope(\_PR.CPU0)
+ {
+ //
+ // Report supported P-States.
+ //
+ Name(_PPC, 0)
+
+ //
+ // NOTE: For CMP systems; this table is not loaded unless
+ // the required driver support is present.
+ // So, we do not check for those cases here.
+ //
+ // CFGD[0] = GV3 Capable/Enabled
+ // PDCx[0] = OS Capable of Hardware P-State control
+ //
+ Method(_PCT,0)
+ {
+ // Update the _PPC value
+ //
+ Store (\_PR.CPPC, \_PR.CPU0._PPC)
+
+ If(LAnd(And(CFGD,0x0001), And(PDC0,0x0001)))
+ {
+ Return(Package() // Native Mode
+ {
+ ResourceTemplate(){Register(FfixedHW, 0, 0, 0)},
+ ResourceTemplate(){Register(FfixedHW, 0, 0, 0)}
+ })
+ }
+ }
+
+ Name(_PSS,Package()
+ {
+ Package(){0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000},
+ Package(){0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000},
+ Package(){0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000},
+ Package(){0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000},
+ Package(){0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000},
+ Package(){0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000},
+ Package(){0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000},
+ Package(){0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000},
+ Package(){0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000},
+ Package(){0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000},
+ Package(){0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000},
+ Package(){0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000},
+ Package(){0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000},
+ Package(){0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000},
+ Package(){0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000},
+ Package(){0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000},
+ Package(){0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000},
+ Package(){0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000},
+ Package(){0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000},
+ Package(){0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000},
+ Package(){0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000},
+ Package(){0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000},
+ Package(){0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000},
+ Package(){0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000},
+ Package(){0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000},
+ Package(){0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000},
+ Package(){0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000},
+ Package(){0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000},
+ Package(){0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000},
+ Package(){0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000},
+ Package(){0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000},
+ Package(){0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000}
+ })
+
+ Name (PSDF, 0)
+ //
+ // The _PSD object provides information to the OSPM related
+ // to P-State coordination between processors in a multi-processor
+ // configurations.
+ //
+ Method(_PSD,0)
+ {
+ If ( LNot(PSDF) )
+ {
+ Store (TCNT, Index(DerefOf(Index(HPSD, 0)),4))
+ Store (TCNT, Index(DerefOf(Index(SPSD, 0)),4))
+ Store (Ones, PSDF)
+ }
+
+ If(And(PDC0,0x0800))
+ {
+ Return(HPSD)
+ }
+ Return(SPSD)
+ }
+ Name(HPSD,Package() // HW_ALL
+ {
+ Package(){5, 0, 0, 0xFE, 0x80}
+ })
+ Name(SPSD,Package() // SW_ALL
+ {
+ Package(){5, 0, 0, 0xFC, 0x80}
+ })
+ }
+} // End of Definition Block
diff --git a/ReferenceCode/Haswell/PowerManagement/AcpiTables/Ssdt/Cpu0Tst.asl b/ReferenceCode/Haswell/PowerManagement/AcpiTables/Ssdt/Cpu0Tst.asl
new file mode 100644
index 0000000..a695091
--- /dev/null
+++ b/ReferenceCode/Haswell/PowerManagement/AcpiTables/Ssdt/Cpu0Tst.asl
@@ -0,0 +1,258 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ Cpu0Tst.asl
+
+Abstract:
+
+ Intel Processor Power Management ACPI Code
+
+ WARNING: You are authorized and licensed to install and use this BIOS code
+ ONLY on an IST PC. This utility may damage any system that does not
+ meet these requirements.
+
+ An IST PC is a computer which
+ (1) Is capable of seamlessly and automatically transitioning among
+ multiple performance states (potentially operating at different
+ efficiency ratings) based upon power source changes, END user
+ preference, processor performance demand, and thermal conditions; and
+ (2) Includes an Intel Pentium II processors, Intel Pentium III
+ processor, Mobile Intel Pentium III Processor-M, Mobile Intel Pentium 4
+ Processor-M, Intel Pentium M Processor, or any other future Intel
+ processors that incorporates the capability to transition between
+ different performance states by altering some, or any combination of,
+ the following processor attributes: core voltage, core frequency, bus
+ frequency, number of processor cores available, or any other attribute
+ that changes the efficiency (instructions/unit time-power) at which the
+ processor operates.
+
+--*/
+
+
+
+#include "PowerMgmtDefinitions.h"
+
+DefinitionBlock(
+ "CPU0TST.aml",
+ "SSDT",
+ 0x01,
+ "PmRef",
+ "Cpu0Tst",
+ 0x3000
+ )
+{
+ External(\_PR.CPU0, DeviceObj)
+ External(PDC0)
+ External(CFGD)
+ External(_PSS)
+ External (TCNT)
+
+ Scope(\_PR.CPU0)
+ {
+ Name(_TPC, 0) // All T-States are available
+
+ //
+ // T-State Control/Status interface
+ //
+ Method(_PTC, 0)
+ {
+ //
+ // IF OSPM is capable of direct access to MSR
+ // Report MSR interface
+ // ELSE
+ // Report I/O interface
+ //
+ // PDCx[2] = OSPM is capable of direct access to On
+ // Demand throttling MSR
+ //
+ If(And(PDC0, 0x0004)) {
+
+ Return(Package() {
+ ResourceTemplate(){Register(FFixedHW, 0, 0, 0)},
+ ResourceTemplate(){Register(FFixedHW, 0, 0, 0)}
+ })
+ }
+
+ Return(Package() {
+ ResourceTemplate(){Register(SystemIO, 5, 0, PCH_ACPI_PBLK)},
+ ResourceTemplate(){Register(SystemIO, 5, 0, PCH_ACPI_PBLK)}
+ })
+ }
+
+ //
+ // _TSS package for fine-grained T-State control.
+ // "Power" fields are replaced with real values by the first
+ // call of _TSS method.
+ //
+ Name(TSMF, Package() {
+ Package(){100, 1000, 0, 0x00, 0},
+ Package(){ 94, 940, 0, 0x1F, 0},
+ Package(){ 88, 880, 0, 0x1E, 0},
+ Package(){ 82, 820, 0, 0x1D, 0},
+ Package(){ 75, 760, 0, 0x1C, 0},
+ Package(){ 69, 700, 0, 0x1B, 0},
+ Package(){ 63, 640, 0, 0x1A, 0},
+ Package(){ 57, 580, 0, 0x19, 0},
+ Package(){ 50, 520, 0, 0x18, 0},
+ Package(){ 44, 460, 0, 0x17, 0},
+ Package(){ 38, 400, 0, 0x16, 0},
+ Package(){ 32, 340, 0, 0x15, 0},
+ Package(){ 25, 280, 0, 0x14, 0},
+ Package(){ 19, 220, 0, 0x13, 0},
+ Package(){ 13, 160, 0, 0x12, 0},
+ Package(){ 7, 100, 0, 0x11, 0}
+ })
+
+ //
+ // _TSS package for T-State control (Coarse grained)
+ // "Power" fields are replaced with real values by the first
+ // call of _TSS method.
+ //
+ Name(TSMC, Package() {
+ Package(){100, 1000, 0, 0x00, 0},
+ Package(){ 88, 875, 0, 0x1E, 0},
+ Package(){ 75, 750, 0, 0x1C, 0},
+ Package(){ 63, 625, 0, 0x1A, 0},
+ Package(){ 50, 500, 0, 0x18, 0},
+ Package(){ 38, 375, 0, 0x16, 0},
+ Package(){ 25, 250, 0, 0x14, 0},
+ Package(){ 13, 125, 0, 0x12, 0}
+ })
+
+ Name(TSSF, 0) // Flag for TSIF/TSIC/TSMF/TSMC initialization
+ Mutex(TSMO, 0) // Mutex object to ensure the _TSS initalization code is only executed once
+ Method(_TSS, 0)
+ {
+ //
+ // Update "Power" fields of TSIC or TSIF or TSMC or TSMF with the LFM
+ // power data IF _PSS is available
+ // Power caluclation:
+ // n - Number of T-states available
+ // _TSS(x).power = LFM.Power * (n-x)/n
+ //
+ IF (LAnd(LNot(TSSF),CondRefOf(_PSS)))
+ {
+ //
+ // Acquire Mutex to make sure the initialization happens only once.
+ //
+ Acquire (TSMO, 0xFFFF)
+ //
+ // Only one thread will be able to acquire the mutex at a time, but the other threads which have acquired the mutex previously, will eventually try to execute the TSS initalization code.
+ // So, let's check if TSS has already been initalized once again. If its initalized, skip the initalization.
+ //
+ IF (LAnd(LNot(TSSF),CondRefOf(_PSS)))
+ {
+ Name ( LFMI, 0)
+ Store (SizeOf(_PSS), LFMI)
+ Decrement(LFMI) // Index of LFM entry in _PSS
+ Name ( LFMP, 0) //LFM Power from _PSS
+ Store ( DerefOf(Index(DerefOf(Index(_PSS,LFMI)),1)) , LFMP)
+ Store (0, Local0)
+
+ //
+ // Copy reference of appropiate TSS package based on Fine grained T-state support
+ // We'll update the power in the package directly (via the reference variable Local1)
+ //
+ // If Fine Grained T-states is enabled
+ // TSMF
+ // ELSE
+ // TSMC
+ //
+ If(And(CFGD,PPM_TSTATE_FINE_GRAINED))
+ {
+ Store ( RefOf(TSMF), Local1 )
+ Store ( SizeOf(TSMF),Local2 )
+ }
+ Else
+ {
+ Store ( RefOf(TSMC), Local1 )
+ Store ( SizeOf(TSMC),Local2 )
+ }
+
+ While(LLess(Local0, Local2))
+ {
+ Store(Divide(Multiply(LFMP, Subtract(Local2, Local0)), Local2),
+ Local4) // Power for this entry
+ Store(Local4,Index(DerefOf(Index(DerefOf(Local1),Local0)),1))
+ Increment(Local0)
+ }
+
+ Store(Ones, TSSF) // Set flag to indicate TSS table initalization is complete
+ }
+
+ Release (TSMO)
+
+ }
+ //
+ // If Fine Grained T-states is enabled
+ // Report TSMF
+ // ELSE
+ // Report TSMC
+ //
+ If(And(CFGD, PPM_TSTATE_FINE_GRAINED))
+ {
+ Return(TSMF)
+ }
+ Else
+ {
+ Return(TSMC)
+ }
+ }
+
+ //
+ // T-State Dependency
+ //
+ Method(_TSD, 0)
+ {
+ //
+ // IF !(direct access to MSR)
+ // Report SW_ANY as the coordination type
+ // ELSE
+ // Report SW_ALL as the coordination type
+ //
+ // PDCx[2] = OSPM is capable of direct access to On
+ // Demand throttling MSR
+ //
+ If (LNot(And(PDC0,4))) {
+ Return(Package(){ // SW_ANY
+ Package(){
+ 5, // # entries.
+ 0, // Revision.
+ 0, // Domain #.
+ 0xFD, // Coord Type- SW_ANY
+ TCNT // # processors.
+ }
+ })
+ }
+ Return(Package(){ // SW_ALL
+ Package(){
+ 5, // # entries.
+ 0, // Revision.
+ 0, // Domain #.
+ 0xFC, // Coord Type- SW_ALL
+ 1 // # processors.
+ }
+ })
+ }
+ }
+} // End of Definition Block
+
diff --git a/ReferenceCode/Haswell/PowerManagement/AcpiTables/Ssdt/CpuPm.asl b/ReferenceCode/Haswell/PowerManagement/AcpiTables/Ssdt/CpuPm.asl
new file mode 100644
index 0000000..2ba3e1b
--- /dev/null
+++ b/ReferenceCode/Haswell/PowerManagement/AcpiTables/Ssdt/CpuPm.asl
@@ -0,0 +1,1061 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ CpuPm.asl
+
+Abstract:
+
+ Intel Processor Power Management ACPI Code
+
+ WARNING: You are authorized and licensed to install and use this BIOS code
+ ONLY on an IST PC. This utility may damage any system that does not
+ meet these requirements.
+
+ An IST PC is a computer which
+ (1) Is capable of seamlessly and automatically transitioning among
+ multiple performance states (potentially operating at different
+ efficiency ratings) based upon power source changes, END user
+ preference, processor performance demand, and thermal conditions; and
+ (2) Includes an Intel Pentium II processors, Intel Pentium III
+ processor, Mobile Intel Pentium III Processor-M, Mobile Intel Pentium 4
+ Processor-M, Intel Pentium M Processor, or any other future Intel
+ processors that incorporates the capability to transition between
+ different performance states by altering some, or any combination of,
+ the following processor attributes: core voltage, core frequency, bus
+ frequency, number of processor cores available, or any other attribute
+ that changes the efficiency (instructions/unit time-power) at which the
+ processor operates.
+
+--*/
+
+#include "PowerMgmtDefinitions.h"
+
+DefinitionBlock (
+ "CPUPM.aml",
+ "SSDT",
+ 0x01,
+ "PmRef",
+ "CpuPm",
+ 0x3000
+ )
+{
+ External(\_PR.CPU0, DeviceObj)
+ External(\_PR.CPU1, DeviceObj)
+ External(\_PR.CPU2, DeviceObj)
+ External(\_PR.CPU3, DeviceObj)
+ External(\_PR.CPU4, DeviceObj)
+ External(\_PR.CPU5, DeviceObj)
+ External(\_PR.CPU6, DeviceObj)
+ External(\_PR.CPU7, DeviceObj)
+ External(\_PR.CPU0._PPC, IntObj)
+ External(SMIF)
+
+Scope(\)
+{
+
+ // Package of pointers to SSDT's
+ //
+ // First column is SSDT name, used for debug only.
+ // (First column must be EXACTLY eight characters.)
+ // Second column is physical address.
+ // Third column is table length.
+ //
+ // IF modifying this file, see warnings listed in ppminit.asm.
+ //
+ Name(SSDT,Package()
+ {
+ "CPU0IST ", 0x80000000, 0x80000000,
+ "APIST ", 0x80000000, 0x80000000,
+ "CPU0CST ", 0x80000000, 0x80000000,
+ "APCST ", 0x80000000, 0x80000000
+ })
+
+ Name(\PDC0,0x80000000) // CPU0 _PDC Flags.
+ Name(\PDC1,0x80000000) // CPU1 _PDC Flags.
+ Name(\PDC2,0x80000000) // CPU2 _PDC Flags.
+ Name(\PDC3,0x80000000) // CPU3 _PDC Flags.
+ Name(\PDC4,0x80000000) // CPU4 _PDC Flags.
+ Name(\PDC5,0x80000000) // CPU5 _PDC Flags.
+ Name(\PDC6,0x80000000) // CPU6 _PDC Flags.
+ Name(\PDC7,0x80000000) // CPU7 _PDC Flags.
+
+ Name(\SDTL,0x00) // Loaded SSDT Flags.
+}
+
+Scope(\_PR)
+{
+ //
+ // Define a Processor scope ACPI PPM GlobalNvs NVS Region
+ //
+ OperationRegion(PPMT,SystemMemory,0xFFFF0000,0xAA55)
+ Field(PPMT,AnyAcc,Lock,Preserve)
+ {
+ PGRV, 8, // (0) PPM GlobalNvs Revision
+ CFGD, 32, // CFGD - PpmFlags
+ Offset(6), // (5) Reserved
+ //
+ // Thermal Configuration Values
+ //
+ ACRT, 8, // (6) Auto Critical Trip Point
+ APSV, 8, // (7) Auto Passive Trip Point
+ AAC0, 8, // (8) Auto Active Trip Point
+ CPID, 32, // (9) CPUID
+ //
+ // ConfigTDP Value
+ //
+ CPPC, 8, // (13) Boot Mode vlues for _PPC
+ //
+ // ConfigTDP Level settngs
+ //
+ CCTP, 8, // (14) Custom ConfigTdp Enabled/Disabled
+ CLVL, 8, // (15) ConfigTdp Number Of Levels
+ CBMI, 8, // (16) CTDP Boot Mode Index
+ PL10, 16, // (17) CTDP Level 0 Power Limit1
+ PL20, 16, // (19) CTDP Level 0 Power Limit2
+ PLW0, 8, // (21) CTDP Level 0 Power Limit1 Time Window
+ CTC0, 8, // (22) CTDP Level 0 CTC
+ TAR0, 8, // (23) CTDP Level 0 TAR
+ PPC0, 8, // (24) CTDP Level 0 PPC
+ PL11, 16, // (25) CTDP Level 1 Power Limit1
+ PL21, 16, // (27) CTDP Level 1 Power Limit2
+ PLW1, 8, // (29) CTDP Level 1 Power Limit1 Time Window
+ CTC1, 8, // (30) CTDP Level 1 CTC
+ TAR1, 8, // (31) CTDP Level 1 TAR
+ PPC1, 8, // (32) CTDP Level 1 PPC
+ PL12, 16, // (33) CTDP Level 2 Power Limit1
+ PL22, 16, // (35) CTDP Level 2 Power Limit2
+ PLW2, 8, // (37) CTDP Level 2 Power Limit1 Time Window
+ CTC2, 8, // (38) CTDP Level 2 CTC
+ TAR2, 8, // (39) CTDP Level 2 TAR
+ PPC2, 8, // (40) CTDP Level 2 PPC
+ //
+ // Mwait Hints and Latency values for C3/C6/C7/C7S
+ //
+ C3MW, 8, // (41) Mwait Hint value for C3
+ C6MW, 8, // (42) Mwait Hint value for C6
+ C7MW, 8, // (43) Mwait Hint value for C7/C7s
+ CDMW, 8, // (44) Mwait Hint value for C8/C9/C10
+ C3LT, 16, // (45-46) Latency value for C3
+ C6LT, 16, // (47-48) Latency Value for C6
+ C7LT, 16, // (49-50) Latency Value for C7/C7S
+ CDLT, 16, // (51-52) Latency Value for C8/C9/C10
+ CDLV, 16, // (53-54) IO LVL value for C8/C9/C10
+ CDPW, 16, // (55-56) Power value for C8/C9/C10
+ MPMF, 8 // (57) MiscPowerManagementFlags
+ }
+}
+
+Scope(\_PR.CPU0)
+{
+ //
+ // Define handles for opregions (used by load.)
+ //
+ Name(HI0,0) // Handle to CPU0IST
+ Name(HC0,0) // Handle to CPU0CST
+
+ Method(_PDC,1)
+ {
+ //
+ // Update the _PPC value
+ //
+ if(CondRefOf(\_PR.CPU0._PPC)) {
+ Store (CPPC, \_PR.CPU0._PPC)
+ }
+ //
+ // Check and extract the _PDC information.
+ //
+ Store(CPDC(Arg0), Local0)
+ //
+ // Save the capability information and load tables as needed.
+ //
+ GCAP(Local0)
+ //
+ // Return status.
+ //
+ Return (Local0)
+ }
+
+ Method(_OSC, 4)
+ {
+ //
+ // Check and extract the _OSC information.
+ //
+ Store(COSC(Arg0, Arg1, Arg2, Arg3), Local0)
+ //
+ // Save the capability information and load tables as needed.
+ //
+ GCAP(Local0)
+ //
+ // Return status.
+ //
+ Return (Local0)
+ }
+
+ //
+ // Implement a generic Method to check _PDC information which may be called
+ // by any of the processor scopes. (The use of _PDC is deprecated in ACPI 3.
+ // in favor of _OSC. However, for backwards compatibility, _PDC may be
+ // implemented using _OSC as follows:)
+ //
+ Method(CPDC,1)
+ {
+ CreateDwordField (Arg0, 0, REVS)
+ CreateDwordField (Arg0, 4, SIZE)
+
+ //
+ // Local0 = Number of bytes for Arg0
+ //
+ Store (SizeOf (Arg0), Local0)
+
+ //
+ // Local1 = Number of Capabilities bytes in Arg0
+ //
+ Store (Subtract (Local0, 8), Local1)
+
+ //
+ // TEMP = Temporary field holding Capability DWORDs
+ //
+ CreateField (Arg0, 64, Multiply (Local1, 8), TEMP)
+
+ //
+ // Create the Status (STAT) buffer with the first DWORD = 0
+ // This is required as per ACPI 3.0 Spec which says the
+ // first DWORD is used to return errors defined by _OSC.
+ //
+ Name (STS0, Buffer () {0x00, 0x00, 0x00, 0x00})
+
+ //
+ // Concatenate the _PDC capabilities bytes to the STS0 Buffer
+ // and store them in a local variable for calling OSC
+ //
+ Concatenate (STS0, TEMP, Local2)
+
+ Return(COSC (ToUUID("4077A616-290C-47BE-9EBD-D87058713953"), REVS, SIZE, Local2))
+ }
+
+ //
+ // Implement a generic Method to check _OSC information which may be called
+ // by any of the processor scopes.
+ //
+ Method(COSC, 4)
+ {
+ //
+ // Point to Status DWORD in the Arg3 buffer (STATUS)
+ //
+ CreateDWordField(Arg3, 0, STS0)
+ //
+ // Point to Caps DWORDs of the Arg3 buffer (CAPABILITIES)
+ //
+ CreateDwordField(Arg3, 4, CAP0)
+
+ //
+ // _OSC needs to validate the UUID and Revision.
+ //
+ // IF Unrecognized UUID
+ // Return Unrecognized UUID _OSC Failure
+ // IF Unsupported Revision
+ // Return Unsupported Revision _OSC Failure
+ //
+ // STS0[0] = Reserved
+ // STS0[1] = _OSC Failure
+ // STS0[2] = Unrecognized UUID
+ // STS0[3] = Unsupported Revision
+ // STS0[4] = Capabilities masked
+ //
+ // Note: The comparison method used is necessary due to
+ // limitations of certain OSes which cannot perform direct
+ // buffer comparisons.
+ //
+ // Create a set of "Input" UUID fields.
+ //
+ CreateDwordField(Arg0, 0x0, IID0)
+ CreateDwordField(Arg0, 0x4, IID1)
+ CreateDwordField(Arg0, 0x8, IID2)
+ CreateDwordField(Arg0, 0xC, IID3)
+ //
+ // Create a set of "Expected" UUID fields.
+ //
+ Name(UID0, ToUUID("4077A616-290C-47BE-9EBD-D87058713953"))
+ CreateDwordField(UID0, 0x0, EID0)
+ CreateDwordField(UID0, 0x4, EID1)
+ CreateDwordField(UID0, 0x8, EID2)
+ CreateDwordField(UID0, 0xC, EID3)
+ //
+ // Verify the input UUID matches the expected UUID.
+ //
+ If(LNot(LAnd(LAnd(LEqual(IID0, EID0),LEqual(IID1, EID1)),LAnd(LEqual(IID2, EID2),LEqual(IID3, EID3)))))
+ {
+ //
+ // Return Unrecognized UUID _OSC Failure
+ //
+ Store (0x6, STS0)
+ Return (Arg3)
+ }
+
+ If(LNot(LEqual(Arg1,1)))
+ {
+ //
+ // Return Unsupported Revision _OSC Failure
+ //
+ Store (0xA, STS0)
+ Return (Arg3)
+ }
+
+ Return (Arg3)
+ }
+
+ //
+ // Get the capability information and load appropriate tables as needed.
+ //
+ Method(GCAP, 1)
+ {
+ //
+ // Point to Status DWORD in the Arg0 buffer (STATUS)
+ //
+ CreateDWordField(Arg0, 0, STS0)
+ //
+ // Point to Caps DWORDs of the Arg0 buffer (CAPABILITIES)
+ //
+ CreateDwordField(Arg0, 4, CAP0)
+
+ //
+ // If the UUID was unrecognized or the _OSC revision was unsupported,
+ // return without updating capabilities.
+ //
+ If(LOr(LEqual(STS0,0x6),LEqual(STS0,0xA)))
+ {
+ Return()
+ }
+
+ //
+ // Check if this is a query (BIT0 of Status = 1).
+ // If so, mask off the bits we support and return.
+ //
+ if (And(STS0, 1))
+ {
+ And(CAP0, 0xBFF, CAP0)
+ Return()
+ }
+
+ //
+ // Store result of PDC. (We clear out the MSB, which was just
+ // used as a placeholder for the compiler; and then "OR" the
+ // value in case we get multiple calls, each of which only
+ // reports partial support.)
+ //
+ Or(And(PDC0, 0x7FFFFFFF), CAP0, PDC0)
+
+ //
+ // Check IF the CST SSDTs should be loaded.
+ // CFGD[5:1] = C7, C6, C3, C1E, C1 Capable/Enabled
+ If(And(CFGD, PPM_C_STATES))
+ {
+ //
+ // Load the CST SSDTs if:
+ // (1) CMP capable/enabled
+ // (2) Driver supports multi-processor configurations
+ // (3) CPU0 CST ISDT is not already loaded
+ //
+ // CFGD[9] = Two or more cores enabled
+ // PDCx[3] = OS supports C1 and P-states in MP systems
+ // PDCx[4] = OS supports ind. C2/C3 in MP systems
+ // SDTL[1] = CPU0 CST SSDT Loaded
+ //
+ If(LAnd(LAnd(And(CFGD, PPM_CMP),And(PDC0,0x0018)),LNot(And(SDTL,0x02))))
+ {
+ //
+ // Flag the CST SSDT as loaded for CPU0
+ //
+ Or(SDTL, 0x02, SDTL)
+
+ OperationRegion(CST0,SystemMemory,DeRefOf(Index(SSDT,7)),DeRefOf(Index(SSDT,8)))
+ Load(CST0, HC0) // Dynamically load the CPU0CST SSDT
+ }
+ }
+
+ Return ()
+ }
+}
+
+
+Scope(\_PR.CPU1)
+{
+ //
+ // Define handles for opregions (used by load.)
+ //
+ Name(HI1,0) // Handle to APIST
+ Name(HC1,0) // Handle to APCST
+
+ Method(_PDC,1)
+ {
+ //
+ // Refer to \_PR.CPU0._PDC for description.
+ //
+ Store(\_PR.CPU0.CPDC(Arg0), Local0)
+ GCAP(Local0)
+ Return (Local0)
+ }
+
+ Method(_OSC, 4)
+ {
+ //
+ // Refer to \_PR.CPU0._OSC for description.
+ //
+ Store(\_PR.CPU0.COSC(Arg0, Arg1, Arg2, Arg3), Local0)
+ GCAP(Local0)
+ Return (Local0)
+ }
+
+ //
+ // Get the capability information and load appropriate tables as needed.
+ //
+ Method(GCAP, 1)
+ {
+ //
+ // Point to Status DWORD in the Arg0 buffer (STATUS)
+ //
+ CreateDWordField(Arg0, 0, STS1)
+ //
+ // Point to Caps DWORDs of the Arg0 buffer (CAPABILITIES)
+ //
+ CreateDwordField(Arg0, 4, CAP1)
+ //
+ // If the UUID was unrecognized or the _OSC revision was unsupported,
+ // return without updating capabilities.
+ //
+ If(LOr(LEqual(STS1,0x6),LEqual(STS1,0xA)))
+ {
+ Return()
+ }
+
+ //
+ // Check if this is a query (BIT0 of Status = 1).
+ // If so, mask off the bits we support and return.
+ //
+ if (And(STS1, 1))
+ {
+ And(CAP1, 0xBFF, CAP1)
+ Return()
+ }
+
+ //
+ // Store result of PDC. (We clear out the MSB, which was just
+ // used as a placeholder for the compiler; and then "OR" the
+ // value in case we get multiple calls, each of which only
+ // reports partial support.)
+ //
+ Or(And(PDC1, 0x7FFFFFFF), CAP1, PDC1)
+
+ //
+ // Attempt to dynamically load the IST SSDTs if:
+ // (1) Driver supports P-States in MP configurations
+ // (2) Driver supports direct HW P-State control
+ //
+ // PDCx[3] = OS supports C1 and P-states in MP systems
+ // PDCx[0] = OS supports direct access of the perf MSR
+ //
+ If(LEqual(And(PDC1, 0x0009), 0x0009))
+ {
+ APPT()
+ }
+
+ //
+ // Load the CST SSDTs if:
+ // (1) Driver supports multi-processor configurations
+ //
+ // PDCx[3] = OS supports C1 and P-states in MP systems
+ // PDCx[4] = OS supports ind. C2/C3 in MP systems
+ //
+ If(And(PDC1,0x0018))
+ {
+ APCT()
+ }
+
+ Store (PDC1, PDC0)
+
+ Return()
+ }
+
+ //
+ // Dynamically load the CST SSDTs if:
+ // (1) C-States are enabled
+ // (2) SSDT is not already loaded
+ //
+ // CFGD[5:1] = Basic C-States supported (C1, C1E, C3, C6, C7)
+ // SDTL[5] = AP CST SSDT Loaded
+ //
+ Method(APCT,0)
+ {
+ If(LAnd(And(CFGD,PPM_C_STATES),LNot(And(SDTL,0x20))))
+ {
+ //
+ // Flag the CST SSDT as loaded for the AP's
+ //
+ Or(SDTL, 0x20, SDTL)
+ //
+ // Dynamically load the APCST SSDT
+ //
+ OperationRegion(CST1,SystemMemory,DeRefOf(Index(SSDT,10)),DeRefOf(Index(SSDT,11)))
+ Load(CST1, HC1)
+ }
+ }
+
+ //
+ // Dynamically load the IST SSDTs if:
+ // (1) If GV3 capable and enabled
+ // (2) SSDT is not already loaded
+ //
+ // CFGD[0] = GV3 Capable/Enabled
+ // SDTL[4] = AP IST SSDT Loaded
+ //
+ Method(APPT,0)
+ {
+ If(LAnd(And(CFGD,PPM_EIST),LNot(And(SDTL,0x10))))
+ {
+ //
+ // Flag the IST SSDT as loaded for CPU0
+ //
+ Or(SDTL, 0x10, SDTL)
+
+ OperationRegion(IST1,SystemMemory,DeRefOf(Index(SSDT,4)),DeRefOf(Index(SSDT,5)))
+ Load(IST1, HI1) // Dynamically load the CPU1IST SSDT
+ }
+ }
+} // End CPU1
+
+
+Scope(\_PR.CPU2)
+{
+ Method(_PDC,1)
+ {
+ //
+ // Call the _PDC for CPU1.
+ //
+ Store(\_PR.CPU0.CPDC(Arg0), Local0)
+ GCAP(Local0)
+ Return (Local0)
+ }
+
+ Method(_OSC, 4)
+ {
+ //
+ // Call the _OSC for CPU1.
+ //
+ Store(\_PR.CPU0.COSC(Arg0, Arg1, Arg2, Arg3), Local0)
+ GCAP(Local0)
+ Return (Local0)
+ }
+
+ Method(GCAP,1)
+ {
+ // Point to Status DWORD in the Arg0 buffer (STATUS)
+ CreateDWordField(Arg0, 0, STS2)
+
+ // Point to Caps DWORDs of the Arg0 buffer (CAPABILITIES)
+ CreateDwordField(Arg0, 4, CAP2)
+
+ //
+ // If the UUID was unrecognized or the _OSC revision was unsupported,
+ // return without updating capabilities.
+ //
+ If(LOr(LEqual(STS2,0x6),LEqual(STS2,0xA)))
+ {
+ Return()
+ }
+
+ //
+ // Check if this is a query (BIT0 of Status = 1).
+ // If so, mask off the bits we support and return.
+ //
+ if (And(STS2, 1))
+ {
+ And(CAP2, 0xBFF, CAP2)
+ Return()
+ }
+
+ //
+ // Store result of PDC. (We clear out the MSB, which was just
+ // used as a placeholder for the compiler; and then "OR" the
+ // value in case we get multiple calls, each of which only
+ // reports partial support.)
+ //
+ Or(And(PDC2, 0x7FFFFFFF), CAP2, PDC2)
+ //
+ // Attempt to dynamically load the IST SSDTs if:
+ // (1) Driver supports P-States in MP configurations
+ // (2) Driver supports direct HW P-State control
+ //
+ // PDCx[3] = OS supports C1 and P-states in MP systems
+ // PDCx[0] = OS supports direct access of the perf MSR
+ //
+ If(LEqual(And(PDC2, 0x0009), 0x0009))
+ {
+ \_PR.CPU1.APPT()
+ }
+
+ //
+ // Load the CST SSDTs if:
+ // (1) Driver supports multi-processor configurations
+ //
+ // PDCx[3] = OS supports C1 and P-states in MP systems
+ // PDCx[4] = OS supports ind. C2/C3 in MP systems
+ //
+ If(And(PDC2,0x0018))
+ {
+ \_PR.CPU1.APCT()
+ }
+
+ Store (PDC2, PDC0)
+ Return()
+ }
+} // End CPU2
+
+Scope(\_PR.CPU3)
+{
+ Method(_PDC,1)
+ {
+ //
+ // Call the _PDC for CPU1.
+ //
+ Store(\_PR.CPU0.CPDC(Arg0), Local0)
+ GCAP(Local0)
+ Return (Local0)
+ }
+
+ Method(_OSC, 4)
+ {
+ //
+ // Call the _OSC for CPU1.
+ //
+ Store(\_PR.CPU0.COSC(Arg0, Arg1, Arg2, Arg3), Local0)
+ GCAP(Local0)
+ Return (Local0)
+ }
+
+ Method(GCAP,1)
+ {
+ // Point to Status DWORD in the Arg0 buffer (STATUS)
+ CreateDWordField(Arg0, 0, STS3)
+
+ // Point to Caps DWORDs of the Arg0 buffer (CAPABILITIES)
+ CreateDwordField(Arg0, 4, CAP3)
+
+ //
+ // If the UUID was unrecognized or the _OSC revision was unsupported,
+ // return without updating capabilities.
+ //
+ If(LOr(LEqual(STS3,0x6),LEqual(STS3,0xA)))
+ {
+ Return()
+ }
+
+ //
+ // Check if this is a query (BIT0 of Status = 1).
+ // If so, mask off the bits we support and return.
+ //
+ if (And(STS3, 1))
+ {
+ And(CAP3, 0xBFF, CAP3)
+ Return()
+ }
+
+ //
+ // Store result of PDC. (We clear out the MSB, which was just
+ // used as a placeholder for the compiler; and then "OR" the
+ // value in case we get multiple calls, each of which only
+ // reports partial support.)
+ //
+ Or(And(PDC3, 0x7FFFFFFF), CAP3, PDC3)
+ //
+ // Attempt to dynamically load the IST SSDTs if:
+ // (1) Driver supports P-States in MP configurations
+ // (2) Driver supports direct HW P-State control
+ //
+ // PDCx[3] = OS supports C1 and P-states in MP systems
+ // PDCx[0] = OS supports direct access of the perf MSR
+ //
+ If(LEqual(And(PDC3, 0x0009), 0x0009))
+ {
+ \_PR.CPU1.APPT()
+ }
+
+ //
+ // Load the CST SSDTs if:
+ // (1) Driver supports multi-processor configurations
+ //
+ // PDCx[3] = OS supports C1 and P-states in MP systems
+ // PDCx[4] = OS supports ind. C2/C3 in MP systems
+ //
+ If(And(PDC3,0x0018))
+ {
+ \_PR.CPU1.APCT()
+ }
+
+ Store (PDC3, PDC0)
+ Return()
+ }
+} // End CPU3
+
+Scope(\_PR.CPU4)
+{
+ Method(_PDC,1)
+ {
+ //
+ // Call the _PDC for CPU1.
+ //
+ Store(\_PR.CPU0.CPDC(Arg0), Local0)
+ GCAP(Local0)
+ Return (Local0)
+ }
+
+ Method(_OSC, 4)
+ {
+ //
+ // Call the _OSC for CPU1.
+ //
+ Store(\_PR.CPU0.COSC(Arg0, Arg1, Arg2, Arg3), Local0)
+ GCAP(Local0)
+ Return (Local0)
+ }
+
+ Method(GCAP,1)
+ {
+ // Point to Status DWORD in the Arg0 buffer (STATUS)
+ CreateDWordField(Arg0, 0, STS4)
+
+ // Point to Caps DWORDs of the Arg0 buffer (CAPABILITIES)
+ CreateDwordField(Arg0, 4, CAP4)
+
+ //
+ // If the UUID was unrecognized or the _OSC revision was unsupported,
+ // return without updating capabilities.
+ //
+ If(LOr(LEqual(STS4,0x6),LEqual(STS4,0xA)))
+ {
+ Return()
+ }
+
+ //
+ // Check if this is a query (BIT0 of Status = 1).
+ // If so, mask off the bits we support and return.
+ //
+ if (And(STS4, 1))
+ {
+ And(CAP4, 0xBFF, CAP4)
+ Return()
+ }
+
+ //
+ // Store result of PDC. (We clear out the MSB, which was just
+ // used as a placeholder for the compiler; and then "OR" the
+ // value in case we get multiple calls, each of which only
+ // reports partial support.)
+ //
+ Or(And(PDC4, 0x7FFFFFFF), CAP4, PDC4)
+ //
+ // Attempt to dynamically load the IST SSDTs if:
+ // (1) Driver supports P-States in MP configurations
+ // (2) Driver supports direct HW P-State control
+ //
+ // PDCx[3] = OS supports C1 and P-states in MP systems
+ // PDCx[0] = OS supports direct access of the perf MSR
+ //
+ If(LEqual(And(PDC4, 0x0009), 0x0009))
+ {
+ \_PR.CPU1.APPT()
+ }
+
+ //
+ // Load the CST SSDTs if:
+ // (1) Driver supports multi-processor configurations
+ //
+ // PDCx[3] = OS supports C1 and P-states in MP systems
+ // PDCx[4] = OS supports ind. C2/C3 in MP systems
+ //
+ If(And(PDC4,0x0018))
+ {
+ \_PR.CPU1.APCT()
+ }
+
+ Store (PDC4, PDC0)
+ Return()
+ }
+} // End CPU4
+
+Scope(\_PR.CPU5)
+{
+ Method(_PDC,1)
+ {
+ //
+ // Call the _PDC for CPU1.
+ //
+ Store(\_PR.CPU0.CPDC(Arg0), Local0)
+ GCAP(Local0)
+ Return (Local0)
+ }
+
+ Method(_OSC, 4)
+ {
+ //
+ // Call the _OSC for CPU1.
+ //
+ Store(\_PR.CPU0.COSC(Arg0, Arg1, Arg2, Arg3), Local0)
+ GCAP(Local0)
+ Return (Local0)
+ }
+
+ Method(GCAP,1)
+ {
+ // Point to Status DWORD in the Arg0 buffer (STATUS)
+ CreateDWordField(Arg0, 0, STS5)
+
+ // Point to Caps DWORDs of the Arg0 buffer (CAPABILITIES)
+ CreateDwordField(Arg0, 4, CAP5)
+
+ //
+ // If the UUID was unrecognized or the _OSC revision was unsupported,
+ // return without updating capabilities.
+ //
+ If(LOr(LEqual(STS5,0x6),LEqual(STS5,0xA)))
+ {
+ Return()
+ }
+
+ //
+ // Check if this is a query (BIT0 of Status = 1).
+ // If so, mask off the bits we support and return.
+ //
+ if (And(STS5, 1))
+ {
+ And(CAP5, 0xBFF, CAP5)
+ Return()
+ }
+
+ //
+ // Store result of PDC. (We clear out the MSB, which was just
+ // used as a placeholder for the compiler; and then "OR" the
+ // value in case we get multiple calls, each of which only
+ // reports partial support.)
+ //
+ Or(And(PDC5, 0x7FFFFFFF), CAP5, PDC5)
+ //
+ // Attempt to dynamically load the IST SSDTs if:
+ // (1) Driver supports P-States in MP configurations
+ // (2) Driver supports direct HW P-State control
+ //
+ // PDCx[3] = OS supports C1 and P-states in MP systems
+ // PDCx[0] = OS supports direct access of the perf MSR
+ //
+ If(LEqual(And(PDC5, 0x0009), 0x0009))
+ {
+ \_PR.CPU1.APPT()
+ }
+
+ //
+ // Load the CST SSDTs if:
+ // (1) Driver supports multi-processor configurations
+ //
+ // PDCx[3] = OS supports C1 and P-states in MP systems
+ // PDCx[4] = OS supports ind. C2/C3 in MP systems
+ //
+ If(And(PDC5,0x0018))
+ {
+ \_PR.CPU1.APCT()
+ }
+
+ Store (PDC5, PDC0)
+ Return()
+ }
+} // End CPU5
+
+Scope(\_PR.CPU6)
+{
+ Method(_PDC,1)
+ {
+ //
+ // Call the _PDC for CPU1.
+ //
+ Store(\_PR.CPU0.CPDC(Arg0), Local0)
+ GCAP(Local0)
+ Return (Local0)
+ }
+
+ Method(_OSC, 4)
+ {
+ //
+ // Call the _OSC for CPU1.
+ //
+ Store(\_PR.CPU0.COSC(Arg0, Arg1, Arg2, Arg3), Local0)
+ GCAP(Local0)
+ Return (Local0)
+ }
+
+ Method(GCAP,1)
+ {
+ // Point to Status DWORD in the Arg0 buffer (STATUS)
+ CreateDWordField(Arg0, 0, STS6)
+
+ // Point to Caps DWORDs of the Arg0 buffer (CAPABILITIES)
+ CreateDwordField(Arg0, 4, CAP6)
+
+ //
+ // If the UUID was unrecognized or the _OSC revision was unsupported,
+ // return without updating capabilities.
+ //
+ If(LOr(LEqual(STS6,0x6),LEqual(STS6,0xA)))
+ {
+ Return()
+ }
+
+ //
+ // Check if this is a query (BIT0 of Status = 1).
+ // If so, mask off the bits we support and return.
+ //
+ if (And(STS6, 1))
+ {
+ And(CAP6, 0xBFF, CAP6)
+ Return()
+ }
+
+ //
+ // Store result of PDC. (We clear out the MSB, which was just
+ // used as a placeholder for the compiler; and then "OR" the
+ // value in case we get multiple calls, each of which only
+ // reports partial support.)
+ //
+ Or(And(PDC6, 0x7FFFFFFF), CAP6, PDC6)
+ //
+ // Attempt to dynamically load the IST SSDTs if:
+ // (1) Driver supports P-States in MP configurations
+ // (2) Driver supports direct HW P-State control
+ //
+ // PDCx[3] = OS supports C1 and P-states in MP systems
+ // PDCx[0] = OS supports direct access of the perf MSR
+ //
+ If(LEqual(And(PDC6, 0x0009), 0x0009))
+ {
+ \_PR.CPU1.APPT()
+ }
+
+ //
+ // Load the CST SSDTs if:
+ // (1) Driver supports multi-processor configurations
+ //
+ // PDCx[3] = OS supports C1 and P-states in MP systems
+ // PDCx[4] = OS supports ind. C2/C3 in MP systems
+ //
+ If(And(PDC6,0x0018))
+ {
+ \_PR.CPU1.APCT()
+ }
+
+ Store (PDC6, PDC0)
+ Return()
+ }
+} // End CPU6
+
+Scope(\_PR.CPU7)
+{
+ Method(_PDC,1)
+ {
+ //
+ // Call the _PDC for CPU1.
+ //
+ Store(\_PR.CPU0.CPDC(Arg0), Local0)
+ GCAP(Local0)
+ Return (Local0)
+ }
+
+ Method(_OSC, 4)
+ {
+ //
+ // Call the _OSC for CPU1.
+ //
+ Store(\_PR.CPU0.COSC(Arg0, Arg1, Arg2, Arg3), Local0)
+ GCAP(Local0)
+ Return (Local0)
+ }
+
+ Method(GCAP,1)
+ {
+ // Point to Status DWORD in the Arg0 buffer (STATUS)
+ CreateDWordField(Arg0, 0, STS7)
+
+ // Point to Caps DWORDs of the Arg0 buffer (CAPABILITIES)
+ CreateDwordField(Arg0, 4, CAP7)
+
+ //
+ // If the UUID was unrecognized or the _OSC revision was unsupported,
+ // return without updating capabilities.
+ //
+ If(LOr(LEqual(STS7,0x6),LEqual(STS7,0xA)))
+ {
+ Return()
+ }
+
+ //
+ // Check if this is a query (BIT0 of Status = 1).
+ // If so, mask off the bits we support and return.
+ //
+ if (And(STS7, 1))
+ {
+ And(CAP7, 0xBFF, CAP7)
+ Return()
+ }
+
+ //
+ // Store result of PDC. (We clear out the MSB, which was just
+ // used as a placeholder for the compiler; and then "OR" the
+ // value in case we get multiple calls, each of which only
+ // reports partial support.)
+ //
+ Or(And(PDC7, 0x7FFFFFFF), CAP7, PDC7)
+ //
+ // Attempt to dynamically load the IST SSDTs if:
+ // (1) Driver supports P-States in MP configurations
+ // (2) Driver supports direct HW P-State control
+ //
+ // PDCx[3] = OS supports C1 and P-states in MP systems
+ // PDCx[0] = OS supports direct access of the perf MSR
+ //
+ If(LEqual(And(PDC7, 0x0009), 0x0009))
+ {
+ \_PR.CPU1.APPT()
+ }
+
+ //
+ // Load the CST SSDTs if:
+ // (1) Driver supports multi-processor configurations
+ //
+ // PDCx[3] = OS supports C1 and P-states in MP systems
+ // PDCx[4] = OS supports ind. C2/C3 in MP systems
+ //
+ If(And(PDC7,0x0018))
+ {
+ \_PR.CPU1.APCT()
+ }
+
+ Store (PDC7, PDC0)
+ Return()
+ }
+} // End CPU7
+} // End of Definition Block
diff --git a/ReferenceCode/Haswell/PowerManagement/AcpiTables/Ssdt/Ctdp.asl b/ReferenceCode/Haswell/PowerManagement/AcpiTables/Ssdt/Ctdp.asl
new file mode 100644
index 0000000..3ac992f
--- /dev/null
+++ b/ReferenceCode/Haswell/PowerManagement/AcpiTables/Ssdt/Ctdp.asl
@@ -0,0 +1,310 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ Ctdp.asl - Enable CTDP without using a driver or EC, i.e. this is the BIOS only solution.
+
+Abstract:
+
+ Intel Processor Power Management ACPI Code
+
+ WARNING: You are authorized and licensed to install and use this BIOS code
+ ONLY on an IST PC. This utility may damage any system that does not
+ meet these requirements.
+
+ An IST PC is a computer which
+ (1) Is capable of seamlessly and automatically transitioning among
+ multiple performance states (potentially operating at different
+ efficiency ratings) based upon power source changes, END user
+ preference, processor performance demand, and thermal conditions; and
+ (2) Includes an Intel Pentium II processors, Intel Pentium III
+ processor, Mobile Intel Pentium III Processor-M, Mobile Intel Pentium 4
+ Processor-M, Intel Pentium M Processor, or any other future Intel
+ processors that incorporates the capability to transition between
+ different performance states by altering some, or any combination of,
+ the following processor attributes: core voltage, core frequency, bus
+ frequency, number of processor cores available, or any other attribute
+ that changes the efficiency (instructions/unit time-power) at which the
+ processor operates.
+
+--*/
+
+DefinitionBlock (
+ "CTDP.aml",
+ "SSDT",
+ 0x01,
+ "CtdpB",
+ "CtdpB",
+ 0x1000
+ )
+{
+
+External(TCNT, IntObj)
+External(PNHM, IntObj)
+External(\_SB.PCI0, DeviceObj)
+External(\_SB.PCI0.MHBR, FieldUnitObj)
+External(\_PR.CPU0, DeviceObj)
+External(\_PR.CPU1, DeviceObj)
+External(\_PR.CPU2, DeviceObj)
+External(\_PR.CPU3, DeviceObj)
+External(\_PR.CPU4, DeviceObj)
+External(\_PR.CPU5, DeviceObj)
+External(\_PR.CPU6, DeviceObj)
+External(\_PR.CPU7, DeviceObj)
+External(\_PR.CPU0._PPC, IntObj)
+External(\_PR.CPU0._PSS, MethodObj)
+External(\_SB.PCCD.PENB, IntObj)
+
+Scope(\_SB.PCI0)
+{
+ //
+ // Memory window to the CTDP registers starting at MCHBAR+5000h.
+ //
+ OperationRegion (MBAR, SystemMemory, Add(ShiftLeft(MHBR,15),0x5000), 0x1000)
+ Field (MBAR, ByteAcc, NoLock, Preserve)
+ {
+ Offset (0x930), // PACKAGE_POWER_SKU (MCHBAR+0x5930)
+ PTDP, 15, // TDP Package Power [14:0]
+ , 1, // reserved [15]
+ PMIN, 15, // Minimal Package Power [30:16]
+ , 1, // Reserved [31]
+ PMAX, 15, // Maximal Package Power [46:32]
+ , 1, // Reserved [47]
+ TMAX, 7, // Maximal Time Window [54:48]
+ Offset (0x938), // PACKAGE_POWER_SKU_UNIT (MCHBAR+0x5938)
+ PWRU, 4, // Power Units [3:0]
+ , 4, // Reserved [7:4]
+ EGYU, 5, // Energy Units [12:8]
+ , 3, // Reserved [15:13]
+ TIMU, 4, // Time Units [19:16]
+ Offset (0x958), // PLATFORM_INFO (MCHBAR+0x5958)
+ , 32, // [31:0]
+ LPMS, 1, // LPM Support [32]
+ CTNL, 2, // CONFIG_TDP_NUM_LEVELS [34:33]
+ Offset (0x9A0), // TURBO_POWER_LIMIT1 (MCHBAR+0x59A0)
+ PPL1, 15, // PKG_PWR_LIM_1 [14:0]
+ PL1E,1, // PKG_PWR_LIM1_EN [15]
+ , 1, // reserved [16]
+ PL1T, 7, // PKG_PWR_LIM_1_TIME [23:17]
+ Offset (0x9A4), // TURBO_POWER_LIMIT2 (MCHBAR+0x59A4)
+ PPL2, 15, // PKG_PWR_LIM_2 [14:0]
+ PL2E,1, // PKG_PWR_LIM2_EN [15]
+ , 1, // reserved [16]
+ PL2T, 7, // PKG_PWR_LIM_2_TIME [23:17]
+ Offset (0xF3C), // CONFIG_TDP_NOMINAL (MCHBAR+0x5F3C)
+ TARN, 8, // TDP Ratio [7:0]
+ Offset (0xF40), // CONFIG_TDP_LEVEL1 (MCHBAR+0x5F40)
+ PTD1, 15, // Package TDP [14:0]
+ , 1, // reserved [15]
+ TAR1, 8, // TDP Ratio [23:16]
+ , 8, // reserved [31:24]
+ PMX1, 15, // Package MAX Power [46:32]
+ , 1, // reserved [47]
+ PMN1, 15, // Package MIN Power [62:48]
+ Offset (0xF48), // CONFIG_TDP_LEVEL2 (MCHBAR+0x5F48)
+ PTD2, 15, // Package TDP [14:0]
+ , 1, // reserved [15]
+ TAR2, 8, // TDP Ratio [23:16]
+ , 8, // reserved [31:24]
+ PMX2, 15, // Package MAX Power [46:32]
+ , 1, // reserved [47]
+ PMN2, 15, // Package MIN Power [62:48]
+ Offset (0xF50), // CONFIG_TDP_CONTROL (MCHBAR+0x5F50)
+ CTCL, 2, // TDP Level [1:0]
+ , 29, // reserved [30:2]
+ CLCK, 1, // Config TDP Lock [31]
+ Offset (0xF54), // TURBO_ACTIVATION_RATIO (MCHBAR+0x5F54)
+ TAR_, 8, // Max Non Turbo Ratio [7:0]
+ }
+
+ // CTCU (Config Tdp Control Up)
+ //
+ // Program the CTDP Up point.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // None
+ //
+ Method(CTCU)
+ {
+ Store(PTD2,PPL1) // Set PL1
+ Store(1,PL1E) // Set PL1 enable
+ Store(CLC2(PTD2),PPL2) // Set PL2
+ Store(1,PL2E) // Set PL2 enable
+ SPPC(1) // Set _PPC
+ Subtract(TAR2,1,TAR_) // Set TAR
+ Store(2,CTCL) // Set CTC
+ }
+
+ // CTCN (Config Tdp Control Nominal)
+ //
+ // Program the CTDP Nominal point.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // None
+ //
+ Method(CTCN)
+ {
+ If(LEqual(CTCL,1)) // algorithm for going to Nominal from Down
+ {
+ Store(PTDP,PPL1) // Set PL1
+ Store(1,PL1E) // Set PL1 enable
+ Store(CLC2(PTDP),PPL2) // Set PL2
+ Store(1,PL2E) // Set PL2 enable
+ NPPC(TARN) // Set _PPC
+ Subtract(TARN,1,TAR_) // Set TAR
+ Store(0,CTCL) // Set CTC
+ }
+ ElseIf(LEqual(CTCL,2)) // algorithm for going to Nominal from Up
+ {
+ Store(0,CTCL) // Set CTC
+ Subtract(TARN,1,TAR_) // Set TAR
+ NPPC(TARN) // Set _PPC
+ Store(CLC2(PTDP),PPL2) // Set PL2
+ Store(1,PL2E) // Set PL2 enable
+ Store(PTDP,PPL1) // Set PL1
+ Store(1,PL1E) // Set PL1 enable
+ }
+ }
+
+ // CTCD (Config Tdp Control Down)
+ //
+ // Program the CTDP Down point.
+ //
+ // Arguments: (0)
+ // None
+ // Return Value:
+ // None
+ //
+ Method(CTCD)
+ {
+ Store(1,CTCL) // Set CTC
+ Subtract(TAR1,1,TAR_) // Set TAR
+ NPPC(TAR1) // Set _PPC
+ Store(CLC2(PTD1),PPL2) // Set PL2
+ Store(1,PL2E) // Set PL2 enable
+ Store(PTD1,PPL1) // Set PL1
+ Store(1,PL1E) // Set PL1 enable
+ }
+
+ // NPPC (Notify _PPC object)
+ //
+ // Find the ratio or next highest ratio in the _PSS table and program _PPC with the index of that ratio.
+ //
+ // Arguments: (1)
+ // Arg0 - Turbo Activation Ratio
+ // Return Value:
+ // None
+ //
+ Method(NPPC,1)
+ {
+ Name(TRAT,0) // holder for the target ratio
+ Name(PRAT,0) // holder for the ratio in _PSS table
+ Name(TMPI,0) // index
+ Store(Arg0,TRAT) // init target ratio from caller
+ Store(SizeOf(\_PR.CPU0._PSS),TMPI) // init index from _PSS
+
+ While(LNotEqual(TMPI,0)){
+ Decrement(TMPI) // convert from 1 based count to 0 based count
+ Store(DeRefOf(Index(DeRefOf(Index(\_PR.CPU0._PSS, TMPI)),4)),PRAT)
+ ShiftRight(PRAT,8,PRAT)
+ If(LGreaterEqual(PRAT,TRAT)){
+ SPPC(TMPI)
+ Break
+ }
+ }
+ }
+
+ // SPPC (Set Participant Performance Capability)
+ //
+ // Progam the _PPC object and notify the OSPM.
+ //
+ // Arguments: (1)
+ // Arg0 - integer
+ // Return Value:
+ // None
+ //
+ Method(SPPC,1,Serialized)
+ {
+ Store(Arg0, \_PR.CPU0._PPC) // Note: CPU0._PPC is an Integer not a Method
+
+ If(CondRefOf(\_SB.PCCD.PENB)) { // is CPPC enabled in SETUP?
+ Notify(\_SB.PCCD,0x82) // CPPC notify
+ } Else {
+ Switch(ToInteger(TCNT)){
+ Case(8){
+ Notify(\_PR.CPU0, 0x80) // Tell CPU0 driver to re-eval _PPC
+ Notify(\_PR.CPU1, 0x80) // Tell CPU1 driver to re-eval _PPC
+ Notify(\_PR.CPU2, 0x80) // Tell CPU2 driver to re-eval _PPC
+ Notify(\_PR.CPU3, 0x80) // Tell CPU3 driver to re-eval _PPC
+ Notify(\_PR.CPU4, 0x80) // Tell CPU4 driver to re-eval _PPC
+ Notify(\_PR.CPU5, 0x80) // Tell CPU5 driver to re-eval _PPC
+ Notify(\_PR.CPU6, 0x80) // Tell CPU6 driver to re-eval _PPC
+ Notify(\_PR.CPU7, 0x80) // Tell CPU7 driver to re-eval _PPC
+ }
+ Case(4){
+ Notify(\_PR.CPU0, 0x80) // Tell CPU0 driver to re-eval _PPC
+ Notify(\_PR.CPU1, 0x80) // Tell CPU1 driver to re-eval _PPC
+ Notify(\_PR.CPU2, 0x80) // Tell CPU2 driver to re-eval _PPC
+ Notify(\_PR.CPU3, 0x80) // Tell CPU3 driver to re-eval _PPC
+ }
+ Case(2){
+ Notify(\_PR.CPU0, 0x80) // Tell CPU0 driver to re-eval _PPC
+ Notify(\_PR.CPU1, 0x80) // Tell CPU1 driver to re-eval _PPC
+ }
+ Default{
+ Notify(\_PR.CPU0, 0x80) // Tell CPU0 driver to re-eval _PPC
+ }
+ }
+ }
+ }
+
+ // CLC2 (CaLCulate PL2)
+ //
+ // IF Haswell Traditional THEN multiply PL1 by 1.25 to get PL2.
+ // ELSE IF Haswell ULT THEN use 25 watts as the PL2.
+ //
+ // Arguments: (1)
+ // Arg0 - integer
+ // Return Value:
+ // integer
+ //
+ Method(CLC2,1)
+ {
+ And(PNHM,0x0FFF0FF0,Local0) // remove stepping from CPUID
+ Switch(Local0){
+ Case(0x000306C0){ // Haswell Traditional
+ Return(Divide(Multiply(Arg0,5),4)) // Multiply a number by 1.25
+ }
+ Case(0x00040650){ // Haswell ULT
+ Return(Multiply(25,8))
+ }
+ Default{
+ Return(Divide(Multiply(Arg0,5),4)) // Multiply a number by 1.25
+ }
+ }
+ }
+
+} // end of scope(\_SB.PCI0)
+} // end of definition block
diff --git a/ReferenceCode/Haswell/PowerManagement/AcpiTables/Ssdt/LakeTiny.asl b/ReferenceCode/Haswell/PowerManagement/AcpiTables/Ssdt/LakeTiny.asl
new file mode 100644
index 0000000..1d2922c
--- /dev/null
+++ b/ReferenceCode/Haswell/PowerManagement/AcpiTables/Ssdt/LakeTiny.asl
@@ -0,0 +1,157 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 2012 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ LakeTiny.asl
+
+Abstract:
+
+ Intel Processor Power Management ACPI Code - LakeTiny Support
+
+ WARNING: You are authorized and licensed to install and use this BIOS code
+ ONLY on an IST PC. This utility may damage any system that does not
+ meet these requirements.
+
+ An IST PC is a computer which
+ (1) Is capable of seamlessly and automatically transitioning among
+ multiple performance states (potentially operating at different
+ efficiency ratings) based upon power source changes, END user
+ preference, processor performance demand, and thermal conditions; and
+ (2) Includes an Intel Pentium II processors, Intel Pentium III
+ processor, Mobile Intel Pentium III Processor-M, Mobile Intel Pentium 4
+ Processor-M, Intel Pentium M Processor, or any other future Intel
+ processors that incorporates the capability to transition between
+ different performance states by altering some, or any combination of,
+ the following processor attributes: core voltage, core frequency, bus
+ frequency, number of processor cores available, or any other attribute
+ that changes the efficiency (instructions/unit time-power) at which the
+ processor operates.
+
+--*/
+
+
+DefinitionBlock (
+ "LakeTiny.aml",
+ "SSDT",
+ 1,
+ "PmRef",
+ "LakeTiny",
+ 0x3000
+ )
+{
+External(\_SB.PCI0.SAT0, DeviceObj)
+External(\_SB.PCI0.SAT1, DeviceObj)
+External(\PNOT, MethodObj)
+External(\_PR.CPU0.GEAR)
+External(MPMF) //Bit0: LakeTiny Support Enable/Disable
+
+Scope(\_SB.PCI0.SAT0) {
+ //
+ // Lake Tiny Performance Control Methods
+ //
+ Method(SLT1,0, Serialized)
+ {
+ If (CondRefOf(\_PR.CPU0.GEAR))
+ {
+ Store (0x00, \_PR.CPU0.GEAR) // Select Lake Tiny CST GEAR 1
+ \PNOT () // OS notification for _CST evaluation
+ }
+ Return(0)
+ }
+
+ Method(SLT2,0, Serialized)
+ {
+ If (CondRefOf(\_PR.CPU0.GEAR))
+ {
+ Store (0x01, \_PR.CPU0.GEAR) // Select Lake Tiny CST GEAR 2
+ \PNOT () // OS notification for _CST evaluation
+ }
+
+ Return(0)
+ }
+
+ Method(SLT3,0, Serialized)
+ {
+ If (CondRefOf(\_PR.CPU0.GEAR))
+ {
+ Store (0x02, \_PR.CPU0.GEAR) // Select Lake Tiny CST GEAR 3
+ \PNOT () // OS notification for _CST evaluation
+ }
+
+ Return(0)
+ }
+
+ Method(GLTS,0, Serialized)
+ {
+ Store(\_PR.CPU0.GEAR,local0)
+ ShiftLeft(local0,1,local0) // Bits 1:2 is Gear
+ Or(local0,0x01,local0) // Bit 0 enable/disable
+ Return(local0)
+ }
+}
+
+Scope(\_SB.PCI0.SAT1){
+ //
+ // Lake Tiny Performance Control Methods
+ //
+ Method(SLT1,0, Serialized)
+ {
+ If (CondRefOf(\_PR.CPU0.GEAR))
+ {
+ Store (0x00, \_PR.CPU0.GEAR) // Select Lake Tiny CST GEAR 1
+ \PNOT () // OS notification for _CST evaluation
+ }
+ Return(0)
+ }
+
+ Method(SLT2,0, Serialized)
+ {
+ If (CondRefOf(\_PR.CPU0.GEAR))
+ {
+ Store (0x01, \_PR.CPU0.GEAR) // Select Lake Tiny CST GEAR 2
+ \PNOT () // OS notification for _CST evaluation
+ }
+
+ Return(0)
+ }
+
+ Method(SLT3,0, Serialized)
+ {
+ If (CondRefOf(\_PR.CPU0.GEAR))
+ {
+ Store (0x02, \_PR.CPU0.GEAR) // Select Lake Tiny CST GEAR 3
+ \PNOT () // OS notification for _CST evaluation
+ }
+
+ Return(0)
+ }
+
+ Method(GLTS,0, Serialized)
+ {
+ Store(\_PR.CPU0.GEAR,local0)
+ ShiftLeft(local0,1,local0) // Bits 1:2 is Gear
+ And(MPMF,01,local1)
+ Or(local0,local1,local0) // Bit 0 enable/disable
+ Return(local0)
+ }
+}
+
+} // End of Definition Block
diff --git a/ReferenceCode/Haswell/PowerManagement/Dxe/IdleStates.c b/ReferenceCode/Haswell/PowerManagement/Dxe/IdleStates.c
new file mode 100644
index 0000000..a450b5d
--- /dev/null
+++ b/ReferenceCode/Haswell/PowerManagement/Dxe/IdleStates.c
@@ -0,0 +1,918 @@
+/** @file
+ This file contains power management C State configuration functions for
+ Haswell processors.
+
+ Acronyms:
+ PPM - Processor Power Management
+ TM - Thermal Monitor
+ IST - Intel(R) Speedstep technology
+ HT - Hyper-Threading Technology
+
+@copyright
+ Copyright (c) 2012 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "PowerMgmtCommon.h"
+
+/**
+ Initializes C States Power management features
+
+ @param[in] CpuPmConfig Pointer to policy protocol instance
+**/
+VOID
+InitializeCState (
+ IN POWER_MGMT_CONFIG *CpuPmConfig
+ )
+{
+ EFI_STATUS Status;
+ UINT16 mAcpiBaseAddr;
+ ///
+ /// Get the ACPI Base Address
+ ///
+ mAcpiBaseAddr = PchLpcPciCfg16 (R_PCH_LPC_ACPI_BASE) & 0xFFFE;
+
+ ///
+ /// Initialize C states, some are general, some are processor specific.
+ /// Dynamic loading of CST SSDT tables occurs at PpmPostInit.
+ ///
+ EnableCStates (mAcpiBaseAddr + PM_CST_LVL2);
+ ///
+ /// Calibrate C State 24MHz BCLK
+ ///
+//@todo: Need to finalize on whether or not re-calibration option should be provided
+ Status = CalibrateBclkForCStates ();
+ if (Status != EFI_SUCCESS) {
+ DEBUG ((EFI_D_INFO, "24MHz BCLK calibration Failed \n"));
+//@todo: Need to finalize on how to handle failure of 24 MHz calibration
+ }
+
+ if (mPpmGlobalNvsAreaProtocol->Area->PpmFlags & PPM_C_STATES) {
+ ///
+ /// Update Fadt table for C State support.
+ ///
+ ConfigureFadtCStates ();
+ }
+ InitCstatePreWake (mCpuPmConfig);
+
+}
+
+/**
+ Disable/Enable the CState Pre-Wake Feature
+
+ @param[in] CpuPmConfig Pointer to policy protocol instance
+**/
+VOID
+InitCstatePreWake (
+ IN POWER_MGMT_CONFIG *CpuPmConfig
+ )
+{
+ MSR_REGISTER TempMsr;
+
+ TempMsr.Qword = AsmReadMsr64 (MSR_POWER_CTL);
+ TempMsr.Dwords.Low &= ~(B_MSR_POWER_CTL_CSTATE_PRE_WAKE_DISABLE);
+ if (CpuPmConfig->pFunctionEnables->CStatePreWake == PPM_DISABLE) {
+ TempMsr.Dwords.Low |= B_MSR_POWER_CTL_CSTATE_PRE_WAKE_DISABLE;
+ }
+ AsmWriteMsr64 (MSR_POWER_CTL, TempMsr.Qword);
+
+ return;
+}
+
+/**
+ Enables C-State support as specified by the input flags on all logical
+ processors and sets associated timing requirements in the chipset.
+
+ @param[in] C3IoAddress IO address to generate C3 states (PM base + 014 usually)
+**/
+VOID
+EnableCStates (
+ IN UINT16 C3IoAddress
+ )
+{
+ MSR_REGISTER PowerCtl;
+ MSR_REGISTER TempMsr;
+ UINT32 LCR0Latency;
+ UINT32 LCR1Latency;
+ UINT32 LCR2Latency;
+ UINT32 LCR3Latency;
+ UINT32 LCR4Latency;
+ UINT32 LCR5Latency;
+ UINT16 EnableCStateParameters;
+ CPU_FAMILY mCpuFamilyId;
+
+ mCpuFamilyId = mPpmGlobalNvsAreaProtocol->Area->Cpuid & CPUID_FULL_FAMILY_MODEL;
+ ///
+ /// Load the C-State parameters to pass to the core function.
+ ///
+ EnableCStateParameters = C3IoAddress;
+ ///
+ /// Enable C-States on all logical processors.
+ ///
+ RunOnAllLogicalProcessors (ApSafeEnableCStates, &EnableCStateParameters);
+ ///
+ /// If C-states are disabled or not supported, Disable C1e and retrun
+ ///
+ if ((mPpmGlobalNvsAreaProtocol->Area->PpmFlags & PPM_C_STATES) == 0) {
+ PowerCtl.Qword = AsmReadMsr64 (MSR_POWER_CTL);
+ PowerCtl.Dwords.Low &= ~B_MSR_POWER_CTL_C1E;
+ AsmWriteMsr64 (MSR_POWER_CTL, PowerCtl.Qword);
+ DEBUG (
+ (EFI_D_INFO,
+ "Setup C state disabled.Disable C1e. MSR(1FC) : %X %X\n",
+ PowerCtl.Dwords.High,
+ PowerCtl.Dwords.Low)
+ );
+ return;
+ }
+ ///
+ /// Configure supported enhanced C-states
+ ///
+ /// Read Power Ctl MSR
+ ///
+ PowerCtl.Qword = AsmReadMsr64 (MSR_POWER_CTL);
+ DEBUG ((EFI_D_INFO, "MSR(1FC) before configuring C1E: %X %X\n", PowerCtl.Dwords.High, PowerCtl.Dwords.Low));
+ ///
+ /// Enable supported states
+ ///
+ if (mPpmGlobalNvsAreaProtocol->Area->PpmFlags & PPM_C1E) {
+ PowerCtl.Dwords.Low |= B_MSR_POWER_CTL_C1E;
+ } else {
+ PowerCtl.Dwords.Low &= ~B_MSR_POWER_CTL_C1E;
+ }
+ ///
+ /// Update Power Control MSR
+ ///
+ AsmWriteMsr64 (MSR_POWER_CTL, PowerCtl.Qword);
+ DEBUG ((EFI_D_INFO, "MSR(1FC) after configuring C1E: %X %X\n", PowerCtl.Dwords.High, PowerCtl.Dwords.Low));
+ ///
+ /// Program Interrupt response time limits used by processor to decided when to get into
+ /// package C3, C6 and C7
+ ///
+ DEBUG ((EFI_D_INFO, "Programming the 0xC3/C6/C7 (MSR 0x60A, 0x60B ,0X60C Latencies \n"));
+ //
+ // Package C3 Interrupt response time
+ //
+ TempMsr.Qword = AsmReadMsr64 (MSR_C_STATE_LATENCY_CONTROL_0);
+ DEBUG ((EFI_D_INFO, "MSR(60A) before configuring Latency: %X %X\n", TempMsr.Dwords.High, TempMsr.Dwords.Low));
+ TempMsr.Dwords.Low &= ~(B_INTERRUPT_RESPONSE_TIME_LIMIT_MASK | B_TIME_UNIT_MASK | B_PKG_IRTL_VALID);
+ ///
+ /// Program Interrupt Response Time Unit and Latency for MSR 0x60A
+ ///
+ TempMsr.Dwords.Low |= mCpuPmConfig->CstateLatencyControl0Irtl;
+ TempMsr.Dwords.Low |= LShiftU64 (mCpuPmConfig->CstateLatencyControl0TimeUnit, N_TIME_UNIT_OFFSET);
+ TempMsr.Dwords.Low |= B_PKG_IRTL_VALID;
+ AsmWriteMsr64 (MSR_C_STATE_LATENCY_CONTROL_0, TempMsr.Qword);
+ //
+ // Package C6/C7 short Interrupt response time
+ //
+ TempMsr.Qword = AsmReadMsr64 (MSR_C_STATE_LATENCY_CONTROL_1);
+ DEBUG ((EFI_D_INFO, "MSR(60B) before configuring Latency: %X %X\n", TempMsr.Dwords.High, TempMsr.Dwords.Low));
+ TempMsr.Dwords.Low &= ~(B_INTERRUPT_RESPONSE_TIME_LIMIT_MASK | B_TIME_UNIT_MASK | B_PKG_IRTL_VALID);
+ ///
+ /// Program Interrupt Response Time Unit and Latency for MSR 0x60B
+ ///
+ TempMsr.Dwords.Low |= mCpuPmConfig->CstateLatencyControl1Irtl;
+ TempMsr.Dwords.Low |= LShiftU64 (mCpuPmConfig->CstateLatencyControl1TimeUnit, N_TIME_UNIT_OFFSET);
+ TempMsr.Dwords.Low |= B_PKG_IRTL_VALID;
+ AsmWriteMsr64 (MSR_C_STATE_LATENCY_CONTROL_1, TempMsr.Qword);
+ //
+ // Package C6/C7 long Interrupt response time
+ //
+ TempMsr.Qword = AsmReadMsr64 (MSR_C_STATE_LATENCY_CONTROL_2);
+ DEBUG ((EFI_D_INFO, "MSR(60C) before configuring Latency: %X %X\n", TempMsr.Dwords.High, TempMsr.Dwords.Low));
+ TempMsr.Dwords.Low &= ~(B_INTERRUPT_RESPONSE_TIME_LIMIT_MASK | B_TIME_UNIT_MASK | B_PKG_IRTL_VALID);
+ ///
+ /// Program Interrupt Response Time Unit and Latency for MSR 0x60C
+ ///
+ TempMsr.Dwords.Low |= mCpuPmConfig->CstateLatencyControl2Irtl;
+ TempMsr.Dwords.Low |= LShiftU64 (mCpuPmConfig->CstateLatencyControl2TimeUnit, N_TIME_UNIT_OFFSET);
+ TempMsr.Dwords.Low |= B_PKG_IRTL_VALID;
+ AsmWriteMsr64 (MSR_C_STATE_LATENCY_CONTROL_2, TempMsr.Qword);
+ if (mCpuFamilyId == EnumCpuHswUlt) {
+ //
+ // Package C8 Interrupt response time
+ //
+ TempMsr.Qword = AsmReadMsr64 (MSR_C_STATE_LATENCY_CONTROL_3);
+ DEBUG ((EFI_D_INFO, "MSR(633) before configuring Latency: %X %X\n", TempMsr.Dwords.High, TempMsr.Dwords.Low));
+ TempMsr.Dwords.Low &= ~(B_INTERRUPT_RESPONSE_TIME_LIMIT_MASK | B_TIME_UNIT_MASK | B_PKG_IRTL_VALID);
+ ///
+ /// Program Interrupt Response Time Unit and Latency for MSR 0x633
+ ///
+ TempMsr.Dwords.Low |= mCpuPmConfig->CstateLatencyControl3Irtl;
+ TempMsr.Dwords.Low |= LShiftU64 (mCpuPmConfig->CstateLatencyControl3TimeUnit, N_TIME_UNIT_OFFSET);
+ TempMsr.Dwords.Low |= B_PKG_IRTL_VALID;
+ AsmWriteMsr64 (MSR_C_STATE_LATENCY_CONTROL_3, TempMsr.Qword);
+ //
+ // Package C9 Interrupt response time
+ //
+ TempMsr.Qword = AsmReadMsr64 (MSR_C_STATE_LATENCY_CONTROL_4);
+ DEBUG ((EFI_D_INFO, "MSR(634) before configuring Latency: %X %X\n", TempMsr.Dwords.High, TempMsr.Dwords.Low));
+ TempMsr.Dwords.Low &= ~(B_INTERRUPT_RESPONSE_TIME_LIMIT_MASK | B_TIME_UNIT_MASK | B_PKG_IRTL_VALID);
+ ///
+ /// Program Interrupt Response Time Unit and Latency for MSR 0x634
+ ///
+ TempMsr.Dwords.Low |= mCpuPmConfig->CstateLatencyControl4Irtl;
+ TempMsr.Dwords.Low |= LShiftU64 (mCpuPmConfig->CstateLatencyControl4TimeUnit, N_TIME_UNIT_OFFSET);
+ TempMsr.Dwords.Low |= B_PKG_IRTL_VALID;
+ AsmWriteMsr64 (MSR_C_STATE_LATENCY_CONTROL_4, TempMsr.Qword);
+ //
+ // Package C10 Interrupt response time
+ //
+ TempMsr.Qword = AsmReadMsr64 (MSR_C_STATE_LATENCY_CONTROL_5);
+ DEBUG ((EFI_D_INFO, "MSR(635) before configuring Latency: %X %X\n", TempMsr.Dwords.High, TempMsr.Dwords.Low));
+ TempMsr.Dwords.Low &= ~(B_INTERRUPT_RESPONSE_TIME_LIMIT_MASK | B_TIME_UNIT_MASK | B_PKG_IRTL_VALID);
+ ///
+ /// Program Interrupt Response Time Unit and Latency for MSR 0x635
+ ///
+ TempMsr.Dwords.Low |= mCpuPmConfig->CstateLatencyControl5Irtl;
+ TempMsr.Dwords.Low |= LShiftU64 (mCpuPmConfig->CstateLatencyControl5TimeUnit, N_TIME_UNIT_OFFSET);
+ TempMsr.Dwords.Low |= B_PKG_IRTL_VALID;
+ AsmWriteMsr64 (MSR_C_STATE_LATENCY_CONTROL_5, TempMsr.Qword);
+ }
+ ///
+ /// Update the PPM Global NVS Area
+ ///
+ LCR0Latency = (1 << (mCpuPmConfig->CstateLatencyControl0TimeUnit * 5));
+ LCR0Latency = (LCR0Latency * mCpuPmConfig->CstateLatencyControl0Irtl) / 1000;
+ //
+ // _CST Latency: WordConst, so limit the latency value to max 0xFFFF
+ //
+ if (LCR0Latency > 0xFFFF) {
+ LCR0Latency = 0xFFFF;
+ }
+ LCR1Latency = (1 << (mCpuPmConfig->CstateLatencyControl1TimeUnit * 5));
+ LCR1Latency = (LCR1Latency * mCpuPmConfig->CstateLatencyControl1Irtl) / 1000;
+ if (LCR1Latency > 0xFFFF) {
+ LCR1Latency = 0xFFFF;
+ }
+ LCR2Latency = (1 << (mCpuPmConfig->CstateLatencyControl2TimeUnit * 5));
+ LCR2Latency = (LCR2Latency * mCpuPmConfig->CstateLatencyControl2Irtl) / 1000;
+ if (LCR2Latency > 0xFFFF) {
+ LCR2Latency = 0xFFFF;
+ }
+
+ LCR3Latency = (1 << (mCpuPmConfig->CstateLatencyControl3TimeUnit * 5));
+ LCR3Latency = (LCR3Latency * mCpuPmConfig->CstateLatencyControl3Irtl) / 1000;
+ if (LCR3Latency > 0xFFFF) {
+ LCR3Latency = 0xFFFF;
+ }
+
+ LCR4Latency = (1 << (mCpuPmConfig->CstateLatencyControl4TimeUnit * 5));
+ LCR4Latency = (LCR4Latency * mCpuPmConfig->CstateLatencyControl4Irtl) / 1000;
+ if (LCR4Latency > 0xFFFF) {
+ LCR4Latency = 0xFFFF;
+ }
+
+ LCR5Latency = (1 << (mCpuPmConfig->CstateLatencyControl5TimeUnit * 5));
+ LCR5Latency = (LCR5Latency * mCpuPmConfig->CstateLatencyControl5Irtl) / 1000;
+ if (LCR5Latency > 0xFFFF) {
+ LCR5Latency = 0xFFFF;
+ }
+
+ ///
+ /// Update the PPM Global NVS Area.
+ /// Update the PPM NVRAM values for C3
+ ///
+ mPpmGlobalNvsAreaProtocol->Area->C3MwaitValue = 0x10;
+ mPpmGlobalNvsAreaProtocol->Area->C3Latency = (UINT16) LCR0Latency;
+ ///
+ /// Update PPM NVRAM Values for C6
+ ///
+ if ((mCpuPmConfig->pFunctionEnables->LongLatencyC6) &&( mPpmGlobalNvsAreaProtocol->Area->PpmFlags & C6_LONG_LATENCY_ENABLE)) {
+ mPpmGlobalNvsAreaProtocol->Area->C6MwaitValue = 0x21;
+ mPpmGlobalNvsAreaProtocol->Area->C6Latency = (UINT16) LCR2Latency;
+ } else {
+ mPpmGlobalNvsAreaProtocol->Area->C6MwaitValue = 0x20;
+ mPpmGlobalNvsAreaProtocol->Area->C6Latency = (UINT16) LCR1Latency;
+ }
+ ///
+ /// Update PPM NVRAM Values for C7 - select the C-state supported among- C7 / C7S
+ ///
+ if (mPpmGlobalNvsAreaProtocol->Area->PpmFlags & PPM_C7) { // Is C7 supported ?
+ if ((mCpuPmConfig->pFunctionEnables->LongLatencyC7) && (mPpmGlobalNvsAreaProtocol->Area->PpmFlags & C7_LONG_LATENCY_ENABLE)) {
+ mPpmGlobalNvsAreaProtocol->Area->C7MwaitValue = 0x31;
+ mPpmGlobalNvsAreaProtocol->Area->C7Latency = (UINT16) LCR2Latency;
+ } else {
+ mPpmGlobalNvsAreaProtocol->Area->C7MwaitValue = 0x30;
+ mPpmGlobalNvsAreaProtocol->Area->C7Latency = (UINT16) LCR1Latency;
+ }
+ }
+ if (mPpmGlobalNvsAreaProtocol->Area->PpmFlags & PPM_C7S) { // Is C7S supported ?
+ if ((mCpuPmConfig->pFunctionEnables->LongLatencyC7) && (mPpmGlobalNvsAreaProtocol->Area->PpmFlags & C7s_LONG_LATENCY_ENABLE)) {
+ mPpmGlobalNvsAreaProtocol->Area->C7MwaitValue = 0x33;
+ mPpmGlobalNvsAreaProtocol->Area->C7Latency = (UINT16) LCR2Latency;
+ } else {
+ mPpmGlobalNvsAreaProtocol->Area->C7MwaitValue = 0x32;
+ mPpmGlobalNvsAreaProtocol->Area->C7Latency = (UINT16) LCR1Latency;
+ }
+ }
+ ///
+ /// Update PPM NVRAM Values for CD - select the deepest C-state supported among- C8 / C9 / C10
+ ///
+ if (mPpmGlobalNvsAreaProtocol->Area->PpmFlags & PPM_C10) { // C10 supported
+ mPpmGlobalNvsAreaProtocol->Area->CDIOLevel = PCH_ACPI_LV7;
+ mPpmGlobalNvsAreaProtocol->Area->CDPowerValue = C10_POWER;
+ mPpmGlobalNvsAreaProtocol->Area->CDMwaitValue = 0x60;
+ mPpmGlobalNvsAreaProtocol->Area->CDLatency = (UINT16) LCR5Latency;
+ } else if (mPpmGlobalNvsAreaProtocol->Area->PpmFlags & PPM_C9) { // C9 supported
+ mPpmGlobalNvsAreaProtocol->Area->CDIOLevel = PCH_ACPI_LV6;
+ mPpmGlobalNvsAreaProtocol->Area->CDPowerValue = C9_POWER;
+ mPpmGlobalNvsAreaProtocol->Area->CDMwaitValue = 0x50;
+ mPpmGlobalNvsAreaProtocol->Area->CDLatency = (UINT16) LCR4Latency;
+ } else if (mPpmGlobalNvsAreaProtocol->Area->PpmFlags & PPM_C8) { // C8 supported
+ mPpmGlobalNvsAreaProtocol->Area->CDIOLevel = PCH_ACPI_LV5;
+ mPpmGlobalNvsAreaProtocol->Area->CDPowerValue = C8_POWER;
+ mPpmGlobalNvsAreaProtocol->Area->CDMwaitValue = 0x40;
+ mPpmGlobalNvsAreaProtocol->Area->CDLatency = (UINT16) LCR3Latency;
+ }
+
+ return;
+}
+
+/**
+ BootScript for PCode Mailbox function for mailbox write commands.
+ This function will poll the mailbox interface for control, issue the command
+ during s3 resume
+
+ @param[IN] MailboxCommand,
+ @param[IN] MailboxData,
+**/
+VOID
+MailboxS3Write (
+ IN UINT32 MailboxCommand,
+ IN UINT32 MailboxData
+ )
+{
+#ifdef ULT_FLAG
+ UINT32 Data32Mask;
+ UINT32 Data32Value;
+ UINT16 StallCount;
+ UINT32 MchBar;
+
+ StallCount = 0;
+
+ ///
+ /// Poll the run/busy to ensure the interface is available
+ ///
+ Data32Mask = BIT31;
+ Data32Value = 0;
+ MchBar = (MmioRead32 (MmPciAddress (0, 0, 0, 0, MCHBAR_OFFSET)) &~BIT0);
+ SCRIPT_MEM_POLL (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (MchBar + PCODE_MAILBOX_INTERFACE_OFFSET),
+ &Data32Mask,
+ &Data32Value,
+ MAILBOX_WAIT_STALL,
+ MAILBOX_WAIT_TIMEOUT
+ );
+
+ ///
+ /// Write the PCODE mailbox DATA field
+ ///
+ MchBar = (MmioRead32 (MmPciAddress (0, 0, 0, 0, MCHBAR_OFFSET)) &~BIT0);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) ((MchBar + PCODE_MAILBOX_DATA_OFFSET)),
+ 1,
+ &(MailboxData)
+ );
+ ///
+ /// Write the PCODE mailbox Command field
+ ///
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (MchBar + PCODE_MAILBOX_INTERFACE_OFFSET),
+ 1,
+ &(MailboxCommand)
+ );
+#endif // ULT_FLAG
+ return;
+}
+
+/**
+ Calibrate 24MHz BCLK support to reduce the power consumption in idle states.
+
+ @retval EFI_UNSUPPORTED Unrecognized 24MHz BCLK Calibration Type.
+ @retval EFI_SUCCESS Processor C-State 24MHz BCLK support calibrated successfully.
+**/
+EFI_STATUS
+CalibrateBclkForCStates (
+ VOID
+ )
+{
+ /*****************************************************************************************************************
+ - BIOS can choose to configure the conversion factor or allow PCODE to calibrate itself or have NO calibration at all.
+ - If NO Calibration then the below steps are needed
+ o BIOS should bypass all calibration process and write a constant value via "WRITE convert ratio"
+ - If BIOS chooses PCODE calibration then the below steps are needed
+ o BIOS writes FSM interval: A value of all Fs is recommended for this
+ o Read PCODE calibration factor
+ o Store and use if needed on next Power up for BIOS calibration
+ - If BIOS chooses to calibrate itself then the below steps are needed
+ o Send command for calibration to prevent BCLK shut off
+ o Read TSC counter values (send command for atomic sampling of TSC100 and TSC24, then read the values)
+ o Delay (what is the maximum tolerable delay?)
+ o Read counters again
+ o Divide 100 MHz ticks by 24 MHz ticks to get the calibration factor
+ o Store the calibration factor value
+ o Write calibration factor using mailbox command during subsequent power-ups
+
+ Command: Command Name: Description:
+ 0x80000009 WriteTsc24_100Cmd Sample 24 MHz and 100 MHz TSC simultaneously
+ 0x80000109 ReadTsc24LowerCmd Read lower 32 bits of 24 MHz TSC
+ 0x80000209 ReadTsc24UpperCmd Read upper 32 bits of 24 MHz TSC
+ 0x80000309 ReadTsc100LowerCmd Read lower 32 bits of 100 MHz TSC
+ 0x80000409 ReadTsc100UpperCmd Read upper 32 bits of 100 MHz TSC
+ 0x80000509 ReadPcodeCalibratedCmd Read PCODE calibrated conversion factor
+ 0x80000609 WriteConversionRatioCmd Command for writing the conversion ratio
+ 0x80000709 WritePreventBclkOffCmd Command for calibration prevents BCLK from shutting off and prevents package
+ from entering deep C states
+ 0x80000809 WRITE_MEASURE_INTERVAL_CMD Measurement interval for pCode calibration of TSC24-to-TSC100 conversion factor
+ 0x80000909 WriteFsmMeasureIntvlCmd Write FSM measure interval
+ 0x85000000 StartCalValue Constant value to start calibration
+ 0xFFFFFFFF PcodeIntervalValue PCODE flow calibration time value
+
+ ***************************************************************************************************************/
+
+ EFI_STATUS Status = EFI_SUCCESS;
+
+#ifdef ULT_FLAG
+ CPU_FAMILY mCpuFamilyId;
+ mCpuFamilyId = mPpmGlobalNvsAreaProtocol->Area->Cpuid & CPUID_FULL_FAMILY_MODEL;
+ if (mCpuFamilyId == EnumCpuHswUlt) {
+ UINT32 PcodeIntervalValue;
+ UINT32 BiosMeasureIntervalValue;
+ UINT32 PcalFactor_Lower;
+ UINT32 PcalFactor_Upper;
+ UINT32 LibStatus;
+ UINT64 Tsc24_64;
+ UINT64 Tsc100_64;
+ UINT64 Temp24_64;
+ UINT64 Temp100_64;
+ UINT64 PcalFactor;
+ UINT64 SafeCalibrationValue;
+ UINT64 TscRemainder;
+
+ PCODE_BCLK_CALIBRATION_MAILBOX ReturnCalVal;
+
+ PcodeIntervalValue = 0xFFFFFFFF;
+ BiosMeasureIntervalValue = 0x7270E00;
+ PcalFactor_Lower = 0x0;
+ PcalFactor_Upper = 0x0;
+ Tsc24_64 = 0x0;
+ Tsc100_64 = 0x0;
+ Temp24_64 = 0x0;
+ Temp100_64 = 0x0;
+ PcalFactor = 0x0;
+ SafeCalibrationValue = 0x0;
+ TscRemainder = 0x0;
+ LibStatus = 0x0;
+ DEBUG ((EFI_D_INFO, "Initializing 24MHz BCLK calibration \n"));
+
+ switch (mCpuPmConfig->PcodeCalibration) {
+ case NO_CALIBRATE:
+ ///
+ /// Bypass all calibration process
+ ///
+ DEBUG ((EFI_D_INFO, "Bypass the 24MHz BCLK calibration \n"));
+ ///
+ /// Write a constant value
+ ///
+ Status = MailboxWrite(MAILBOX_TYPE_PCODE, WRITE_CONVERTION_RATIO_CMD, START_CAL_VALUE, &LibStatus);
+ if (Status != EFI_SUCCESS) {
+ DEBUG ((EFI_D_ERROR, "24 MHz BCLK Calibration: Failed to write a constant value \n"));
+ break;
+ }
+ MailboxS3Write(WRITE_CONVERTION_RATIO_CMD, START_CAL_VALUE);
+ break;
+
+ case PCODE_CALIBRATE:
+ ///
+ /// Initiate the PCODE calibration
+ ///
+ DEBUG ((EFI_D_INFO, "Initiate PCODE 24MHz BCLK calibration \n"));
+ ///
+ /// BIOS writes FSM interval: A value of all F's is recommended for this
+ ///
+ Status = MailboxWrite(MAILBOX_TYPE_PCODE, WRITE_FSM_MEASURE_INTVL_CMD, PcodeIntervalValue, &LibStatus);
+ if (Status != EFI_SUCCESS) {
+ DEBUG ((EFI_D_ERROR, "24 MHz BCLK Calibration: Failed BIOS writes FSM interval \n"));
+ break;
+ }
+ MailboxS3Write(WRITE_FSM_MEASURE_INTVL_CMD, PcodeIntervalValue);
+ break;
+
+ case BIOS_CALIBRATE:
+ ///
+ /// Initiate Bios calibration
+ ///
+ DEBUG ((EFI_D_INFO, "Initiate BIOS 24MHz BCLK calibration \n"));
+ ///
+ /// Send command for calibration to prevent BCLK shut off
+ ///
+ Status = MailboxWrite(MAILBOX_TYPE_PCODE, WRITE_PREVENT_BCLKOFF_CMD, 1, &LibStatus);
+ if (Status != EFI_SUCCESS) {
+ DEBUG ((EFI_D_ERROR, "24 MHz BCLK Calibration: Failed Send command for calibration to prevent BCLK shut off \n"));
+ break;
+ }
+ ///
+ /// Read TSC counter values (send command for atomic sampling of TSC100 and TSC24)
+ ///
+ Status = MailboxWrite(MAILBOX_TYPE_PCODE, SAMPLE_TSC_24AND100_CMD, 0, &LibStatus);
+ if (Status != EFI_SUCCESS) {
+ DEBUG ((EFI_D_ERROR, "24 MHz BCLK Calibration: Failed First Write TSC counter values (send command for atomic sampling of TSC100 and TSC24) \n"));
+ break;
+ }
+ Status = MailboxRead(MAILBOX_TYPE_PCODE, READ_TSC24_LOWER_CMD, &ReturnCalVal.TSC24_L1, &LibStatus);
+ if (Status != EFI_SUCCESS) {
+ DEBUG ((EFI_D_ERROR, "24 MHz BCLK Calibration: Failed First read TSC-24 Lower 32 bits \n"));
+ break;
+ }
+ Status = MailboxRead(MAILBOX_TYPE_PCODE, READ_TSC24_UPPER_CMD, &ReturnCalVal.TSC24_U1, &LibStatus);
+ if (Status != EFI_SUCCESS) {
+ DEBUG ((EFI_D_ERROR, "24 MHz BCLK Calibration: Failed First read TSC-24 Upper 32 bits \n"));
+ break;
+ }
+ Status = MailboxRead(MAILBOX_TYPE_PCODE, READ_TSC100_LOWER_CMD, &ReturnCalVal.TSC100_L1, &LibStatus);
+ if (Status != EFI_SUCCESS) {
+ DEBUG ((EFI_D_ERROR, "24 MHz BCLK Calibration: Failed First read TSC-100 Lower 32 bits \n"));
+ break;
+ }
+ Status = MailboxRead(MAILBOX_TYPE_PCODE, READ_TSC100_UPPER_CMD, &ReturnCalVal.TSC100_U1, &LibStatus);
+ if (Status != EFI_SUCCESS) {
+ DEBUG ((EFI_D_ERROR, "24 MHz BCLK Calibration: Failed First read TSC-100 Upper 32 bits \n"));
+ break;
+ }
+ ///
+ /// Store initial clock values
+ ///
+ Tsc24_64 = ((UINT64)ReturnCalVal.TSC24_U1 << 32);
+ Temp24_64 = (Tsc24_64 |= (ReturnCalVal.TSC24_L1));
+ Tsc100_64 = ((UINT64)ReturnCalVal.TSC100_U1 << 32);
+ Temp100_64 = (Tsc100_64 |= (ReturnCalVal.TSC100_L1));
+
+ ///
+ /// Delay for 22 ms
+ ///
+ gBS->Stall (PCODE_BCLK_CALIBRATION_TIMEOUT * STALL_ONE_MILLI_SECOND);
+
+ ///
+ /// Read TSC 24 and TSC 100 counters again, and calculate calibration factor
+ ///
+ Status = MailboxWrite(MAILBOX_TYPE_PCODE, SAMPLE_TSC_24AND100_CMD, 0, &LibStatus);
+ if (Status != EFI_SUCCESS) {
+ DEBUG ((EFI_D_ERROR, "24 MHz BCLK Calibration: Failed Second Write TSC counter values (send command for atomic sampling of TSC100 and TSC24) \n"));
+ break;
+ }
+ Status = MailboxRead(MAILBOX_TYPE_PCODE, READ_TSC24_LOWER_CMD, &ReturnCalVal.TSC24_L2, &LibStatus);
+ if (Status != EFI_SUCCESS) {
+ DEBUG ((EFI_D_ERROR, "24 MHz BCLK Calibration: Failed Second read TSC-24 Lower 32 bits \n"));
+ break;
+ }
+ Status = MailboxRead(MAILBOX_TYPE_PCODE, READ_TSC24_UPPER_CMD, &ReturnCalVal.TSC24_U2, &LibStatus);
+ if (Status != EFI_SUCCESS) {
+ DEBUG ((EFI_D_ERROR, "24 MHz BCLK Calibration: Failed Second read TSC-24 Upper 32 bits \n"));
+ break;
+ }
+ Status = MailboxRead(MAILBOX_TYPE_PCODE, READ_TSC100_LOWER_CMD, &ReturnCalVal.TSC100_L2, &LibStatus);
+ if (Status != EFI_SUCCESS) {
+ DEBUG ((EFI_D_ERROR, "24 MHz BCLK Calibration: Failed Second read TSC-100 Lower 32 bits \n"));
+ break;
+ }
+ Status = MailboxRead(MAILBOX_TYPE_PCODE, READ_TSC100_UPPER_CMD, &ReturnCalVal.TSC100_U2, &LibStatus);
+ if (Status != EFI_SUCCESS) {
+ DEBUG ((EFI_D_ERROR, "24 MHz BCLK Calibration: Second read TSC-100 Upper 32 bits \n"));
+ break;
+ }
+ ///
+ /// Store current clock values, and calculate difference
+ ///
+ Tsc24_64 = ((UINT64)ReturnCalVal.TSC24_U2 << 32);
+ Tsc24_64 = ((Tsc24_64 |= (ReturnCalVal.TSC24_L2)) - Temp24_64);
+ Tsc100_64 = ((UINT64)ReturnCalVal.TSC100_U2 << 32);
+ Tsc100_64 = ((Tsc100_64 |= (ReturnCalVal.TSC100_L2)) - Temp100_64);
+
+ ///
+ /// Calculate updated conversion factor in fixed point format (U32.3.29)
+ ///
+ Tsc100_64 = (Tsc100_64 << 29);
+ if (Tsc24_64 !=0) {
+ PcalFactor = InternalMathDivRemS64x64 (Tsc100_64, Tsc24_64, (INT64 *) &TscRemainder);
+ }
+
+ ///
+ /// Read the TSC24-to-TSC100 conversion factor currently in use by pCode
+ ///
+ Status = MailboxRead(MAILBOX_TYPE_PCODE, READ_PCODE_CALIBRATED_CMD, &ReturnCalVal.PCalFactor, &LibStatus);
+ if (Status != EFI_SUCCESS) {
+ DEBUG ((EFI_D_ERROR, "24 MHz BCLK Calibration: Failed read TSC24-to-TSC100 PCalFactor from pCode currently\n"));
+ break;
+ }
+
+ if (PcalFactor <= 0) {
+ ///
+ /// Set Safe Calibration Value as ReturnCalVal.PCalFactor which is TSC24-to-TSC100 PCalFactor read from pCode by READ_PCODE_CALIBRATED_CMD
+ ///
+ PcalFactor = ReturnCalVal.PCalFactor;
+ DEBUG ((EFI_D_ERROR, "24 MHz BCLK Calibration: Warning - SafeCalibrationValue used \n"));
+ }
+ PcalFactor_Lower |= PcalFactor;
+ PcalFactor_Upper |= (PcalFactor >> 32);
+ ///
+ /// Calibrate 24MHz BCLK using the calculated calibration factor value
+ ///
+ Status = MailboxWrite(MAILBOX_TYPE_PCODE, WRITE_CONVERTION_RATIO_CMD, PcalFactor_Lower, &LibStatus);
+ if (Status != EFI_SUCCESS) {
+ DEBUG ((EFI_D_ERROR, "24 MHz BCLK Calibration: Failed Calibrate 24MHz BCLK using the calculated lower calibration factor value \n"));
+ break;
+ }
+ MailboxS3Write(WRITE_CONVERTION_RATIO_CMD, PcalFactor_Lower);
+
+ ///
+ /// Send command for calibration to turn BCLK on
+ ///
+ Status = MailboxWrite(MAILBOX_TYPE_PCODE, WRITE_PREVENT_BCLKOFF_CMD, 0, &LibStatus);
+ if (Status != EFI_SUCCESS) {
+ DEBUG ((EFI_D_ERROR, "24 MHz BCLK Calibration: Failed Send command for calibration to turn BCLK on \n"));
+ break;
+ }
+ MailboxS3Write(WRITE_PREVENT_BCLKOFF_CMD, 0);
+
+ ///
+ /// Write measurement interval for pCode calibration of TSC24-to-TSC100 conversion factor
+ ///
+ Status = MailboxWrite(MAILBOX_TYPE_PCODE, WRITE_MEASURE_INTERVAL_CMD, BiosMeasureIntervalValue, &LibStatus);
+ if (Status != EFI_SUCCESS) {
+ DEBUG ((EFI_D_ERROR, "24 MHz BCLK Calibration: Failed Send command for calibration to meature interval for pCode calibration \n"));
+ break;
+ }
+ MailboxS3Write(WRITE_MEASURE_INTERVAL_CMD, BiosMeasureIntervalValue);
+ break;
+
+ default:
+ DEBUG ((EFI_D_ERROR, "Unrecognized 24MHz BCLK Calibration Type \n"));
+ Status = EFI_UNSUPPORTED;
+ break;
+ }
+
+ DEBUG ((EFI_D_INFO, "24MHz BCLK calibration completed \n"));
+
+ }
+#endif // ULT_FLAG
+
+ return Status;
+}
+
+/**
+ Enable C-State support as specified by the input flags on a logical processor.
+ Configure BIOS C1 Coordination (SMI coordination)
+ Enable IO redirection coordination
+ Choose proper coordination method
+ Configure extended C-States
+
+ This function must be MP safe.
+
+ @param[in] Buffer Pointer to a ENABLE_CSTATE_PARAMS containing the necessary
+ information to enable C-States
+
+ @retval EFI_SUCCESS Processor C-State support configured successfully.
+**/
+VOID
+EFIAPI
+ApSafeEnableCStates (
+ IN OUT VOID *Buffer
+ )
+{
+ MSR_REGISTER Ia32MiscEnable;
+ MSR_REGISTER PmCfgCtrl;
+ MSR_REGISTER IoCaptAddr;
+ UINT16 C3IoAddress;
+ CPU_STEPPING mCpuSteppingId;
+ CPU_FAMILY mCpuFamilyId;
+ mCpuFamilyId = mPpmGlobalNvsAreaProtocol->Area->Cpuid & CPUID_FULL_FAMILY_MODEL;
+ mCpuSteppingId = mPpmGlobalNvsAreaProtocol->Area->Cpuid & CPUID_FULL_STEPPING;
+ ///
+ /// Extract parameters from the buffer
+ ///
+ C3IoAddress = *((UINT16 *) Buffer);
+ ///
+ /// If C-states are disabled in setup, disable C-states
+ ///
+ if (!(mPpmGlobalNvsAreaProtocol->Area->PpmFlags & PPM_C_STATES)) {
+ PmCfgCtrl.Qword = AsmReadMsr64 (MSR_PMG_CST_CONFIG);
+ PmCfgCtrl.Dwords.Low &= ~B_PACKAGE_C_STATE_LIMIT;
+ AsmWriteMsr64 (MSR_PMG_CST_CONFIG, PmCfgCtrl.Qword);
+ return;
+ }
+ ///
+ /// Set C-state package limit to the highest C-state enabled
+ ///
+ PmCfgCtrl.Qword = AsmReadMsr64 (MSR_PMG_CST_CONFIG);
+ if (mCpuPmConfig->PkgCStateLimit != PkgCpuDefault) {
+ PmCfgCtrl.Dwords.Low &= ~B_PACKAGE_C_STATE_LIMIT;
+
+ if ((mPpmGlobalNvsAreaProtocol->Area->PpmFlags & PPM_C10) && (mCpuPmConfig->PkgCStateLimit == PkgAuto)) {
+ PmCfgCtrl.Dwords.Low |= V_CSTATE_LIMIT_C10;
+ } else if ((mPpmGlobalNvsAreaProtocol->Area->PpmFlags & PPM_C9) && (mCpuPmConfig->PkgCStateLimit == PkgAuto)) {
+ PmCfgCtrl.Dwords.Low |= V_CSTATE_LIMIT_C9;
+ } else if ((mPpmGlobalNvsAreaProtocol->Area->PpmFlags & PPM_C8) && (mCpuPmConfig->PkgCStateLimit == PkgAuto)) {
+ PmCfgCtrl.Dwords.Low |= V_CSTATE_LIMIT_C8;
+ } else if ((mPpmGlobalNvsAreaProtocol->Area->PpmFlags & PPM_C7S) &&
+ !((mCpuFamilyId == EnumCpuHsw) && (mCpuSteppingId == EnumHswA0) && (mCpuPmConfig->PkgCStateLimit == PkgAuto))) { // When user selects Auto - Disable Package C7s state on Haswell A-step processors
+ PmCfgCtrl.Dwords.Low |= V_CSTATE_LIMIT_C7S;
+ } else if ((mPpmGlobalNvsAreaProtocol->Area->PpmFlags & PPM_C7)&&
+ !((mCpuFamilyId == EnumCpuHsw) && (mCpuSteppingId == EnumHswA0) && (mCpuPmConfig->PkgCStateLimit == PkgAuto))) { // When user selects Auto - Disable Package C7 state on Haswell A-step processors
+ PmCfgCtrl.Dwords.Low |= V_CSTATE_LIMIT_C7;
+ } else if (mPpmGlobalNvsAreaProtocol->Area->PpmFlags & PPM_C6) {
+ PmCfgCtrl.Dwords.Low |= V_CSTATE_LIMIT_C6;
+ } else if (mPpmGlobalNvsAreaProtocol->Area->PpmFlags & PPM_C3) {
+ PmCfgCtrl.Dwords.Low |= V_CSTATE_LIMIT_C3;
+ } else if (mPpmGlobalNvsAreaProtocol->Area->PpmFlags & PPM_C1) {
+ PmCfgCtrl.Dwords.Low |= V_CSTATE_LIMIT_C1;
+ }
+ if (mCpuPmConfig->PkgCStateLimit < PkgCMax) {
+ PmCfgCtrl.Dwords.Low &= ~B_PACKAGE_C_STATE_LIMIT;
+ PmCfgCtrl.Dwords.Low |= (mCpuPmConfig->PkgCStateLimit & B_PACKAGE_C_STATE_LIMIT);
+ }
+ }
+ ///
+ /// Enable C State IO redirection by default
+ ///
+ PmCfgCtrl.Dwords.Low |= B_IO_MWAIT_REDIRECTION_ENABLE;
+ //
+ // Enable TimedMwait
+ //
+ if (mPpmGlobalNvsAreaProtocol->Area->PpmFlags & PPM_TIMED_MWAIT) {
+ PmCfgCtrl.Dwords.Low &= (~B_TIMED_MWAIT_ENABLE);
+ PmCfgCtrl.Dwords.Low |= B_TIMED_MWAIT_ENABLE;
+ }
+ ///
+ /// Configure C-state auto-demotion
+ ///
+ PmCfgCtrl.Dwords.Low &= ~(B_C1_AUTO_DEMOTION_ENABLE | B_C3_AUTO_DEMOTION_ENABLE);
+ if (mCpuPmConfig->pFunctionEnables->C3AutoDemotion) {
+ ///
+ /// Enable C6/C7 Auto-demotion to C3
+ ///
+ PmCfgCtrl.Dwords.Low |= B_C3_AUTO_DEMOTION_ENABLE;
+ }
+ if (mCpuPmConfig->pFunctionEnables->C1AutoDemotion) {
+ ///
+ /// Enable C3/C6/C7 Auto-demotion to C1
+ ///
+ PmCfgCtrl.Dwords.Low |= B_C1_AUTO_DEMOTION_ENABLE;
+ }
+ ///
+ /// Configure C-state un-demotion
+ ///
+ PmCfgCtrl.Dwords.Low &= ~(B_C1_AUTO_UNDEMOTION_ENABLE | B_C3_AUTO_UNDEMOTION_ENABLE);
+ if (mCpuPmConfig->pFunctionEnables->C3UnDemotion) {
+ ///
+ /// Enable un-demotion from demoted C3
+ ///
+ PmCfgCtrl.Dwords.Low |= B_C3_AUTO_UNDEMOTION_ENABLE;
+ }
+ if (mCpuPmConfig->pFunctionEnables->C1UnDemotion) {
+ ///
+ /// Enable un-demotion from demoted C1
+ ///
+ PmCfgCtrl.Dwords.Low |= B_C1_AUTO_UNDEMOTION_ENABLE;
+ }
+ ///
+ /// Configure Package C-state Demotion / un-demotion - Supported only on HSW B0 and Above
+ ///
+ if (mCpuSteppingId > EnumHswA0) {
+ PmCfgCtrl.Dwords.Low &= ~(B_PKG_CSTATE_DEMOTION_ENABLE | B_PKG_CSTATE_UNDEMOTION_ENABLE);
+ if (mCpuPmConfig->pFunctionEnables->PkgCStateDemotion) {
+ ///
+ /// Enable Package C-state Demotion
+ ///
+ PmCfgCtrl.Dwords.Low |= B_PKG_CSTATE_DEMOTION_ENABLE;
+ }
+ if (mCpuPmConfig->pFunctionEnables->PkgCStateUnDemotion) {
+ ///
+ /// Enable Package C-state un-demotion
+ ///
+ PmCfgCtrl.Dwords.Low |= B_PKG_CSTATE_UNDEMOTION_ENABLE;
+ }
+ }
+ AsmWriteMsr64 (MSR_PMG_CST_CONFIG, PmCfgCtrl.Qword);
+ ///
+ /// Enable MONITOR/MWAIT support
+ /// (already done on BSP, but must be done on all components.)
+ ///
+ Ia32MiscEnable.Qword = AsmReadMsr64 (MSR_IA32_MISC_ENABLE);
+ Ia32MiscEnable.Qword |= B_MSR_IA32_MISC_ENABLE_MONITOR;
+ AsmWriteMsr64 (MSR_IA32_MISC_ENABLE, Ia32MiscEnable.Qword);
+ ///
+ /// Haswell specific configuration of I/O capture and I/O coordination SMI MSR.
+ /// Configure the base port and range in the MSR to match LVL_X settings in ACPI tables
+ /// Set I/O capture base port and range
+ ///
+ IoCaptAddr.Qword = AsmReadMsr64 (MSR_PMG_IO_CAPTURE_BASE);
+ ///
+ /// Mask off CST range and set the CST range
+ ///
+ IoCaptAddr.Dwords.Low &= ~B_MSR_PMG_CST_RANGE;
+ if (mPpmGlobalNvsAreaProtocol->Area->PpmFlags & PPM_C10) {
+ IoCaptAddr.Dwords.Low |= V_IO_CAPT_LVL7;
+ } else if (mPpmGlobalNvsAreaProtocol->Area->PpmFlags & PPM_C9) {
+ IoCaptAddr.Dwords.Low |= V_IO_CAPT_LVL6;
+ } else if (mPpmGlobalNvsAreaProtocol->Area->PpmFlags & PPM_C8) {
+ IoCaptAddr.Dwords.Low |= V_IO_CAPT_LVL5;
+ } else if (mPpmGlobalNvsAreaProtocol->Area->PpmFlags & PPM_C7) {
+ IoCaptAddr.Dwords.Low |= V_IO_CAPT_LVL4;
+ } else if (mPpmGlobalNvsAreaProtocol->Area->PpmFlags & PPM_C6) {
+ IoCaptAddr.Dwords.Low |= V_IO_CAPT_LVL3;
+ } else if (mPpmGlobalNvsAreaProtocol->Area->PpmFlags & PPM_C3) {
+ IoCaptAddr.Dwords.Low |= V_IO_CAPT_LVL2;
+ }
+ ///
+ /// Set the base CST address
+ ///
+ IoCaptAddr.Dwords.Low &= ~(V_IO_CAPT_LVL2_BASE_ADDR_MASK);
+ IoCaptAddr.Dwords.Low |= C3IoAddress;
+ AsmWriteMsr64 (MSR_PMG_IO_CAPTURE_BASE, IoCaptAddr.Qword);
+ return;
+}
+
+
+//
+// Update ACPI IdleStates tables
+//
+
+/**
+ Configure the FACP for C state support
+**/
+VOID
+ConfigureFadtCStates (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ EFI_ACPI_DESCRIPTION_HEADER *Table;
+ EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *FadtPointer;
+ INTN Index;
+ UINTN Handle;
+ EFI_ACPI_TABLE_VERSION Version;
+
+ ///
+ /// Locate table with matching ID
+ ///
+ Index = 0;
+ do {
+ Status = mAcpiSupport->GetAcpiTable (mAcpiSupport, Index, (VOID **) &Table, &Version, &Handle);
+ if (Status == EFI_NOT_FOUND) {
+ break;
+ }
+ ASSERT_EFI_ERROR (Status);
+ Index++;
+ } while (Table->Signature != EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE);
+ //
+ // Can't have ACPI without FADT, so safe to assert
+ //
+ ASSERT (Table->Signature == EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE);
+ FadtPointer = (EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *) Table;
+ //
+ // Verify expected state. Should be initialized to off during build.
+ //
+ ASSERT (FadtPointer->PLvl3Lat >= FADT_C3_LATENCY_DISABLED);
+ ///
+ /// Configure C states
+ ///
+ if (mPpmGlobalNvsAreaProtocol->Area->PpmFlags & PPM_C3) {
+ ///
+ /// Enable C3 in FADT.
+ ///
+ FadtPointer->PLvl3Lat = FADT_C3_LATENCY;
+ }
+ ///
+ /// Update the table
+ ///
+ Status = mAcpiTable->InstallAcpiTable (
+ mAcpiTable,
+ Table,
+ Table->Length,
+ &Handle
+ );
+ FreePool (Table);
+
+ return;
+} \ No newline at end of file
diff --git a/ReferenceCode/Haswell/PowerManagement/Dxe/MiscFunctions.c b/ReferenceCode/Haswell/PowerManagement/Dxe/MiscFunctions.c
new file mode 100644
index 0000000..5ad9fc8
--- /dev/null
+++ b/ReferenceCode/Haswell/PowerManagement/Dxe/MiscFunctions.c
@@ -0,0 +1,853 @@
+/** @file
+ This file contains Processor Power Management ACPI related functions for
+ Haswell processors.
+
+ Acronyms:
+ PPM - Processor Power Management
+ TM - Thermal Monitor
+ IST - Intel(R) Speedstep technology
+ HT - Hyper-Threading Technology
+
+@copyright
+ Copyright (c) 2012-2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "PowerMgmtCommon.h"
+
+///
+/// Table to convert PL1 / Pl2 Seconds into equivalent MSR values
+/// This table is used for TDP Time Window programming
+///
+UINT8 mSecondsToMsrValueMapTable[][2] = {
+ ///
+ /// Seconds, MSR Value
+ ///
+ { 1, 0x0A },
+ { 2, 0x0B },
+ { 3, 0x4B },
+ { 4, 0x0C },
+ { 5, 0x2C },
+ { 6, 0x4C },
+ { 7, 0x6C },
+ { 8, 0x0D },
+ { 10, 0x2D },
+ { 12, 0x4D },
+ { 14, 0x6D },
+ { 16, 0x0E },
+ { 20, 0x2E },
+ { 24, 0x4E },
+ { 28, 0x6E },
+ { 32, 0x0F },
+ { 40, 0x2F },
+ { 48, 0x4F },
+ { 56, 0x6F },
+ { 64, 0x10 },
+ { 80, 0x30 },
+ { 96, 0x50 },
+ { 112, 0x70 },
+ { 128, 0x11 },
+ { END_OF_TABLE, END_OF_TABLE }
+};
+
+///
+/// Table to convert PL3 Milli Seconds into equivalent MSR values
+/// This table is used for TDP Time Window programming
+///
+UINT8 mMilliSecondsToMsrValueMapTable[][2] = {
+ ///
+ /// MilliSeconds, MSR Value
+ ///
+ { 3, 0x41 },
+ { 4, 0x02 },
+ { 5, 0x22 },
+ { 6, 0x42 },
+ { 7, 0x62 },
+ { 8, 0x03 },
+ { 10, 0x23 },
+ { 12, 0x43 },
+ { 14, 0x63 },
+ { 16, 0x04 },
+ { 20, 0x24 },
+ { 24, 0x44 },
+ { 28, 0x64 },
+ { 32, 0x05 },
+ { 40, 0x25 },
+ { 48, 0x45 },
+ { 56, 0x65 },
+ { 64, 0x06 },
+ { END_OF_TABLE, END_OF_TABLE }
+};
+
+/**
+ This will perform Miscellaneous Power Management related programming.
+
+ @param[in] CtdpSupport Status of InitializeConfigurableTdp funtion
+**/
+VOID
+InitMiscFeatures (
+ EFI_STATUS CtdpSupport
+ )
+{
+ InitPchPowerSharing(mCpuPmConfig);
+ ///
+ /// Configure Package Turbo Power Limits
+ ///
+ if (CtdpSupport == EFI_SUCCESS) {
+ ConfigureCtdp (mCpuPmConfig);
+ } else {
+ ConfigurePowerLimitsNonConfigTdpSkus (mCpuPmConfig);
+ }
+
+ ///
+ /// This will perform PowerLimit 1 algorithm will be used to control Thermal Throttling features
+ ///
+ InitPl1ThermalControl (mCpuPmConfig);
+
+ ///
+ /// Configure PL3
+ ///
+ ConfigurePL3PowerLimits(mCpuPmConfig);
+
+ ///
+ /// Configure DDR RAPL PowerLimits
+ ///
+ ConfigureDdrPowerLimits(mCpuPmConfig);
+}
+
+/**
+ Private helper function to convert various Turbo Power Limit Time from Seconds to CPU units
+
+ @param[in] TimeInSeconds Time in seconds
+ @param[in] PowerLimitLevel Power Limit Level
+
+ @retval UINT8 Converted time in CPU units
+**/
+UINT8
+GetConvertedTime (
+ IN UINT32 TimeInSeconds,
+ IN UINT8 PowerLimitLevel
+ )
+{
+ UINT8 ConvertedPowerLimitTime;
+ UINT8 Index;
+
+ ///
+ /// Convert seconds to MSR value. Since not all values are programmable, we'll select
+ /// the entry from mapping table which is either equal to the user selected value. OR to a value in the mapping table
+ /// which is closest (but less than) to the user-selected value.
+ ///
+ ConvertedPowerLimitTime = 0;
+ switch(PowerLimitLevel) {
+ case PL12TimeWindowCovert:
+ ConvertedPowerLimitTime = mSecondsToMsrValueMapTable[0][1];
+ for (Index = 0; mSecondsToMsrValueMapTable[Index][0] != END_OF_TABLE; Index++) {
+ if (TimeInSeconds == mSecondsToMsrValueMapTable[Index][0]) {
+ ConvertedPowerLimitTime = mSecondsToMsrValueMapTable[Index][1];
+ break;
+ }
+ if (TimeInSeconds > mSecondsToMsrValueMapTable[Index][0]) {
+ ConvertedPowerLimitTime = mSecondsToMsrValueMapTable[Index][1];
+ } else {
+ break;
+ }
+ }
+ break;
+ case PL3TimeWindowConvert:
+ ConvertedPowerLimitTime = mMilliSecondsToMsrValueMapTable[0][1];
+ for (Index = 0; mMilliSecondsToMsrValueMapTable[Index][0] != END_OF_TABLE; Index++) {
+ if (TimeInSeconds == mMilliSecondsToMsrValueMapTable[Index][0]) {
+ ConvertedPowerLimitTime = mMilliSecondsToMsrValueMapTable[Index][1];
+ break;
+ }
+ if (TimeInSeconds > mMilliSecondsToMsrValueMapTable[Index][0]) {
+ ConvertedPowerLimitTime = mMilliSecondsToMsrValueMapTable[Index][1];
+ } else {
+ break;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ return ConvertedPowerLimitTime;
+}
+
+/**
+ Configure PMSYNC_TPR_CFG and PMSYNC_TPR_CFG2 using values returned by CPU BIOS Mail box
+
+ @param[in] CpuPmConfig Pointer to policy protocol instance
+**/
+VOID
+InitPchPowerSharing (
+ IN OUT POWER_MGMT_CONFIG *CpuPmConfig
+ )
+{
+ UINT32 PcodeMailBoxPchPowerLevels;
+ UINT32 MailBoxStatus;
+ UINT32 Rcba;
+ UINT32 Index;
+ UINT8 PchPowerLevel;
+ UINT32 Data32And;
+ UINT32 Data32Or;
+ UINT16 LpcDeviceId;
+ UINT8 PchRevId;
+ UINT8 IsLptLp;
+ CPU_STEPPING CpuSteppingId;
+ CPU_FAMILY CpuFamilyId;
+
+ CpuFamilyId = mPpmGlobalNvsAreaProtocol->Area->Cpuid & CPUID_FULL_FAMILY_MODEL;
+ CpuSteppingId = mPpmGlobalNvsAreaProtocol->Area->Cpuid & CPUID_FULL_STEPPING;
+
+ ///
+ /// PCH Power sharing supported only on HSW ULT.
+ ///
+ if (CpuFamilyId != EnumCpuHswUlt) {
+ return;
+ }
+
+ ///
+ /// Read PCH Power Limit from PCODE Mail Box.
+ ///
+ MailboxRead (MAILBOX_TYPE_PCODE,READ_PCH_POWER_LEVELS_CMD,&PcodeMailBoxPchPowerLevels,&MailBoxStatus);
+
+ DEBUG ((EFI_D_ERROR, "Read PCH Power Limit from PCODE Mail Box : %x \n",PcodeMailBoxPchPowerLevels));
+ Rcba = MmioRead32 (
+ MmPciAddress (
+ 0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_RCBA
+ )
+ );
+ Rcba &= (UINT32) (~BIT0);
+ if (MailBoxStatus == PCODE_MAILBOX_CC_SUCCESS) {
+ ///
+ /// Program RCBA+PMSYNC_TPR_CONFIG PCH power limit values.
+ /// READ_PCH_POWER_LEVELS_CMD MailBox[0:5],MailBox[6:11],MailBox[12:17] to PCHReg [0:4],[8:12],[16:20]
+ ///
+ Data32And =0x0;
+ Data32Or =0x0;
+
+ for (Index = 0; Index < HSW_ULT_PCH_POWER_LEVELS; Index++) {
+ PchPowerLevel = PcodeMailBoxPchPowerLevels & 0x3F;
+ PcodeMailBoxPchPowerLevels = PcodeMailBoxPchPowerLevels >> 6;
+ Data32And |= 0x1F << (Index * 8);
+ Data32Or |= (PchPowerLevel & 0x1F) << (Index * 8);
+ }
+ Data32And = ~Data32And;
+ MmioAndThenOr32(Rcba+PMSYNC_TPR_CONFIG,Data32And,Data32Or);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (Rcba + PMSYNC_TPR_CONFIG),
+ 1,
+ (VOID *) (UINTN) (Rcba + PMSYNC_TPR_CONFIG)
+ );
+ } else {
+ DEBUG ((EFI_D_ERROR, "Failure - Read PCH Power Limit from PCODE Mail Box\n"));
+ }
+ ///
+ /// Extended PCH power sharing supported on HSW ULT C0 & LPT-LP B0 and later
+ ///
+ ///
+ PchRevId = MmioRead8 (
+ MmPciAddress (0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_RID)
+ );
+
+ LpcDeviceId = MmioRead16 (
+ MmPciAddress (0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_DEVICE_ID)
+ );
+ IsLptLp = IS_PCH_LPTLP_LPC_DEVICE_ID(LpcDeviceId);
+
+ if(IsLptLp && (PchRevId < V_PCH_LPT_LPC_RID_2) && (CpuSteppingId < EnumHswUltC0)) {
+ return;
+ }
+ ///
+ /// Program RCBA+PMSYNC_TPR_CONFIG Extnded PCH power limit values.
+ /// READ_PCH_POWER_LEVELS_CMD-MailBox[23:18],READ_EXT_PCH_POWER_LEVELS_CMD- MailBox[6:11],MailBox[12:17],MailBox[18:22] to PCHReg [0:4],[8:12],[16:20],[24:28]
+ ///
+ Data32And = 0x1F;
+ Data32Or = (PcodeMailBoxPchPowerLevels & 0x1F);
+ ///
+ /// Read Extended PCH Power Limit from PCODE Mail Box.
+ ///
+ MailboxRead (MAILBOX_TYPE_PCODE,READ_EXT_PCH_POWER_LEVELS_CMD,&PcodeMailBoxPchPowerLevels,&MailBoxStatus);
+ DEBUG ((EFI_D_ERROR, "Read Extended PCH Power Limit from PCODE Mail Box : %x \n",PcodeMailBoxPchPowerLevels));
+ if (MailBoxStatus == PCODE_MAILBOX_CC_SUCCESS) {
+ for (Index = 1; Index < EXTENDED_PCH_POWER_LEVELS; Index++) {
+ PchPowerLevel = PcodeMailBoxPchPowerLevels & 0x3F;
+ PcodeMailBoxPchPowerLevels = PcodeMailBoxPchPowerLevels >> 6;
+ Data32And |= 0x1F << (Index * 8);
+ Data32Or |= (PchPowerLevel & 0x1F) << (Index * 8);
+ }
+ Data32And = ~Data32And;
+ MmioAndThenOr32(Rcba+PMSYNC_TPR_CONFIG2,Data32And,Data32Or);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (Rcba + PMSYNC_TPR_CONFIG2),
+ 1,
+ (VOID *) (UINTN) (Rcba + PMSYNC_TPR_CONFIG2)
+ );
+ } else {
+ DEBUG ((EFI_D_ERROR, "Failure -Extended Read PCH Power Limit from PCODE Mail Box\n"));
+ }
+}
+
+/**
+ Locks down all settings.
+
+ @param[in] CpuPmConfig Pointer to PPM Policy structure.
+**/
+VOID
+PpmLockDown (
+ IN OUT POWER_MGMT_CONFIG *CpuPmConfig
+ )
+{
+ MSR_REGISTER TempMsr;
+ ///
+ /// Program PMG_CST_CONFIG MSR [15] (CFG lock bit)
+ ///
+ RunOnAllLogicalProcessors (ApSafeLockDown, CpuPmConfig);
+ ///
+ /// Lock Package power limit MSR
+ ///
+ TempMsr.Qword = AsmReadMsr64 (MSR_PACKAGE_POWER_LIMIT);
+ TempMsr.Dwords.High &= ~(B_POWER_LIMIT_LOCK);
+ if (CpuPmConfig->pTurboSettings->TurboPowerLimitLock) {
+ TempMsr.Dwords.High |= B_POWER_LIMIT_LOCK;
+ }
+ AsmWriteMsr64 (MSR_PACKAGE_POWER_LIMIT, TempMsr.Qword);
+ ///
+ /// Program the OverClocking Lock Bit.
+ ///
+ TempMsr.Qword = AsmReadMsr64 (MSR_FLEX_RATIO);
+ TempMsr.Dwords.Low &= ~(B_OVERCLOCKING_LOCK);
+ if (CpuPmConfig->pPpmLockEnables->OverclockingLock) {
+ TempMsr.Dwords.Low |= B_OVERCLOCKING_LOCK;
+ }
+ AsmWriteMsr64 (MSR_FLEX_RATIO, TempMsr.Qword);
+ ///
+ /// Program the PROCHOT_Lock
+ ///
+ TempMsr.Qword = AsmReadMsr64 (MSR_POWER_CTL);
+ TempMsr.Dwords.Low &= ~(B_MSR_POWER_CTL_PROC_HOT_LOCK);
+ if (CpuPmConfig->pPpmLockEnables->ProcHotLock) {
+ TempMsr.Dwords.Low |= B_MSR_POWER_CTL_PROC_HOT_LOCK;
+ }
+ AsmWriteMsr64 (MSR_POWER_CTL, TempMsr.Qword);
+ ///
+ /// Program Ddr RAPL LIMIT Lock
+ ///
+ TempMsr.Qword = AsmReadMsr64 (MSR_DDR_RAPL_LIMIT);
+ TempMsr.Dwords.High &= ~(B_POWER_LIMIT_LOCK);
+ if (CpuPmConfig->pTurboSettings->TurboPowerLimitLock) {
+ TempMsr.Dwords.High |= B_POWER_LIMIT_LOCK;
+ }
+ AsmWriteMsr64 (MSR_DDR_RAPL_LIMIT, TempMsr.Qword);
+
+ return;
+}
+
+/**
+ Lock MSR_PMG_CST_CONFIG.
+ This function must be MP safe.
+
+ @param[in] Buffer Not used (needed for API compatibility)
+
+ @retval EFI_SUCCESS Processor C-State locked successfully.
+**/
+VOID
+EFIAPI
+ApSafeLockDown (
+ IN OUT VOID *Buffer
+ )
+{
+ MSR_REGISTER PmCfgCtrl;
+ POWER_MGMT_CONFIG *CpuPmConfig;
+ UINT8 CfgLock;
+
+ CpuPmConfig = (POWER_MGMT_CONFIG *) Buffer;
+ if (CpuPmConfig == NULL) {
+ CfgLock = PPM_ENABLE;
+ } else {
+ CfgLock = (UINT8) CpuPmConfig->pPpmLockEnables->PmgCstCfgCtrlLock;
+ }
+ PmCfgCtrl.Qword = AsmReadMsr64 (MSR_PMG_CST_CONFIG);
+ PmCfgCtrl.Dwords.Low &= ~B_CST_CONTROL_LOCK;
+ if (CfgLock == PPM_ENABLE) {
+ PmCfgCtrl.Dwords.Low |= B_CST_CONTROL_LOCK;
+ }
+ AsmWriteMsr64 (MSR_PMG_CST_CONFIG, PmCfgCtrl.Qword);
+
+ return;
+}
+
+/**
+ Runs the specified procedure on all logical processors, passing in the
+ parameter buffer to the procedure.
+
+ @param[in] Procedure The function to be run.
+ @param[in] Buffer Pointer to a parameter buffer.
+
+ @retval EFI_SUCCESS
+**/
+EFI_STATUS
+RunOnAllLogicalProcessors (
+ IN OUT EFI_AP_PROCEDURE Procedure,
+ IN OUT VOID *Buffer
+ )
+{
+ EFI_STATUS Status;
+
+ ///
+ /// Run the procedure on all logical processors.
+ ///
+ (*Procedure)(Buffer);
+ Status = mMpService->StartupAllAPs (
+ mMpService,
+ (EFI_AP_PROCEDURE) Procedure,
+ TRUE,
+ NULL,
+ MP_TIMEOUT_FOR_STARTUP_ALL_APS,
+ Buffer,
+ NULL
+ );
+
+ return Status;
+}
+
+/**
+ Configures the RFI Tunning MSR (0xE3) for FIVR switching freq.
+
+ @param[in] CpuPmConfig Pointer to PPM Policy structure.
+**/
+VOID
+InitFivrSwitchingFreq (
+ IN OUT POWER_MGMT_CONFIG *CpuPmConfig
+ )
+{
+ MSR_REGISTER RfiTuningValue;
+ UINT16 FreqTuningOffsetValue;
+ UINT32 Remainder;
+
+ ///
+ /// Check if we have to change the RFI Freq Tunning offset.
+ /// Check PLATFORM_INFO MSR[25] == 1 before accessing the MSR_RFI_TUNNING
+ ///
+ if ((CpuPmConfig->RfiFreqTunningOffset != AUTO) &&
+ ((AsmReadMsr64 (MSR_PLATFORM_INFO)) & B_FIVR_RFI_TUNING_AVAIL)
+ ) {
+ ///
+ /// Convert the Policy Freq Tunning offset.
+ /// Target frequency encoding = int(value*2^16+0.5) for positive offsets and inv(int(value*2^16+0.5))+1 for negative offsets
+ ///
+ FreqTuningOffsetValue = (UINT16) DivU64x32Remainder (
+ (UINT64) (CpuPmConfig->RfiFreqTunningOffset * (1 << 16)),
+ 1000,
+ &Remainder
+ );
+ if (Remainder >= 500) {
+ FreqTuningOffsetValue += 1;
+ }
+ ///
+ /// Check if Freq Tunning offset value is -ve
+ ///
+ if (CpuPmConfig->RfiFreqTunningOffsetIsNegative == 1) {
+ FreqTuningOffsetValue = (UINT16) (~FreqTuningOffsetValue + 1);
+ }
+ ///
+ /// Write to the RFI_TUNING_MSR. System BIOS must set the desired frequency offset in bits 15:0 of this MSR.
+ ///
+ RfiTuningValue.Qword = AsmReadMsr64 (MSR_RFI_TUNNING);
+
+ ///
+ /// Set the Tuning Frequency
+ ///
+ RfiTuningValue.Qword = ((RfiTuningValue.Qword & V_FREQ_TUNNING_MASK) | FreqTuningOffsetValue);
+ AsmWriteMsr64 (MSR_RFI_TUNNING, RfiTuningValue.Qword);
+ }
+}
+
+/**
+ Update the SSDT table pointers and config DWORD CFGD with the PpmFlags current configuration value
+**/
+VOID
+PatchCpuPmTable (
+ VOID
+ )
+{
+ UINT8 *CurrPtr;
+ UINT32 *Signature;
+ SSDT_LAYOUT *SsdtPackage;
+
+ ///
+ /// Locate the SSDT package
+ ///
+ SsdtPackage = NULL;
+ CurrPtr = (UINT8 *) mCpuPmTable;
+ for (CurrPtr; CurrPtr <= ((UINT8 *) mCpuPmTable + mCpuPmTable->Length); CurrPtr++) {
+ Signature = (UINT32 *) (CurrPtr + 1);
+ if ((*CurrPtr == AML_NAME_OP) && *Signature == EFI_SIGNATURE_32 ('S', 'S', 'D', 'T')) {
+ ///
+ /// Update the SSDT table pointers for dynamically loaded tables
+ ///
+ SsdtPackage = (SSDT_LAYOUT *) CurrPtr;
+ ///
+ /// Set the P-State SSDT table information
+ ///
+ SsdtPackage->Cpu0IstAddr = (UINT32) (UINTN) mCpu0IstTable;
+ SsdtPackage->Cpu0IstLen = mCpu0IstTable->Length;
+ SsdtPackage->ApIstAddr = (UINT32) (UINTN) mApIstTable;
+ SsdtPackage->ApIstLen = mApIstTable->Length;
+ ///
+ /// Set the C-State SSDT table information
+ ///
+ SsdtPackage->Cpu0CstAddr = (UINT32) (UINTN) mCpu0CstTable;
+ SsdtPackage->Cpu0CstLen = mCpu0CstTable->Length;
+ SsdtPackage->ApCstAddr = (UINT32) (UINTN) mApCstTable;
+ SsdtPackage->ApCstLen = mApCstTable->Length;
+ }
+ ///
+ /// Update the PPM GlobalNvs area
+ ///
+ if ((*CurrPtr == AML_OPREGION_OP) && *Signature == EFI_SIGNATURE_32 ('P', 'P', 'M', 'T')) {
+ ASSERT_EFI_ERROR (*(UINT32 *) (CurrPtr + 1 + sizeof (*Signature) + 2) == 0xFFFF0000);
+ ASSERT_EFI_ERROR (*(UINT16 *) (CurrPtr + 1 + sizeof (*Signature) + 2 + sizeof (UINT32) + 1) == 0xAA55);
+ ///
+ /// PPM Global NVS Area address
+ ///
+ *(UINT32 *) (CurrPtr + 1 + sizeof (*Signature) + 2) = (UINT32) (UINTN) mPpmGlobalNvsAreaProtocol->Area;
+ ///
+ /// PPM Global NVS Area size
+ ///
+ *(UINT16 *) (CurrPtr + 1 + sizeof (*Signature) + 2 + sizeof (UINT32) + 1) = sizeof (PPM_GLOBAL_NVS_AREA);
+ break;
+ }
+ }
+ //
+ // Assert if we didn't update the PM table
+ //
+ ASSERT (SsdtPackage != NULL);
+
+ return;
+}
+
+/**
+ Locate the PPM ACPI tables data file and read ACPI SSDT tables.
+ Publish the appropriate SSDT based on current configuration and capabilities.
+
+ @retval EFI_SUCCESS - On success
+ @retval EFI_NOT_FOUND - Required firmware volume not found
+ @retval - Appropiate failure code on error
+**/
+EFI_STATUS
+InitializePpmAcpiTable (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ EFI_HANDLE *HandleBuffer;
+ UINTN NumberOfHandles;
+ EFI_FV_FILETYPE FileType;
+ UINT32 FvStatus;
+ EFI_FV_FILE_ATTRIBUTES Attributes;
+ UINTN Size;
+ UINTN i;
+ EFI_FIRMWARE_VOLUME_PROTOCOL *FwVol;
+ INTN Instance;
+ EFI_ACPI_TABLE_VERSION Version;
+ EFI_ACPI_COMMON_HEADER *CurrentTable;
+ EFI_ACPI_DESCRIPTION_HEADER *TempTable;
+ UINTN AcpiTableHandle;
+
+ ///
+ /// Locate Firmware volume protocol.
+ /// There is little chance we can't find an FV protocol
+ ///
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiFirmwareVolumeProtocolGuid,
+ NULL,
+ &NumberOfHandles,
+ &HandleBuffer
+ );
+ ASSERT_EFI_ERROR (Status);
+ ///
+ /// Look for FV with ACPI storage file
+ ///
+ FwVol = NULL;
+ for (i = 0; i < NumberOfHandles; i++) {
+ ///
+ /// Get the protocol on this handle
+ /// This should not fail because of LocateHandleBuffer
+ ///
+ Status = gBS->HandleProtocol (
+ HandleBuffer[i],
+ &gEfiFirmwareVolumeProtocolGuid,
+ (VOID **) &FwVol
+ );
+ ASSERT_EFI_ERROR (Status);
+ ///
+ /// See if it has the ACPI storage file
+ ///
+ Size = 0;
+ FvStatus = 0;
+ Status = FwVol->ReadFile (
+ FwVol,
+ &gPowerMgmtAcpiTableStorageGuid,
+ NULL,
+ &Size,
+ &FileType,
+ &Attributes,
+ &FvStatus
+ );
+ ///
+ /// If we found it, then we are done
+ ///
+ if (Status == EFI_SUCCESS) {
+ break;
+ }
+ }
+ ///
+ /// Our exit status is determined by the success of the previous operations
+ /// If the protocol was found, Instance already points to it.
+ /// Free any allocated buffers
+ ///
+ FreePool (HandleBuffer);
+ ///
+ /// Sanity check that we found our data file
+ ///
+ ASSERT (FwVol != NULL);
+ if (FwVol == NULL) {
+ return EFI_NOT_FOUND;
+ }
+ ///
+ /// By default, a table belongs in all ACPI table versions published.
+ ///
+ Version = EFI_ACPI_TABLE_VERSION_1_0B | EFI_ACPI_TABLE_VERSION_2_0 | EFI_ACPI_TABLE_VERSION_3_0;
+ ///
+ /// Read tables from the storage file.
+ ///
+ Instance = 0;
+ CurrentTable = NULL;
+ while (Status == EFI_SUCCESS) {
+ Status = FwVol->ReadSection (
+ FwVol,
+ &gPowerMgmtAcpiTableStorageGuid,
+ EFI_SECTION_RAW,
+ Instance,
+ (VOID **) &CurrentTable,
+ &Size,
+ &FvStatus
+ );
+ if (!EFI_ERROR (Status)) {
+ ///
+ /// Check the table ID to modify the table
+ ///
+ switch (((EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable)->OemTableId) {
+ case (EFI_SIGNATURE_64 ('C', 'p', 'u', '0', 'I', 's', 't', 0)):
+ mCpu0IstTable = (EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable;
+ if (mPpmGlobalNvsAreaProtocol->Area->PpmFlags & PPM_EIST) {
+ ///
+ /// Patch the native _PSS package with the GV3 values
+ ///
+ Status = AcpiPatchPss ();
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ }
+ break;
+ case (EFI_SIGNATURE_64 ('C', 'p', 'u', '0', 'C', 's', 't', 0)):
+ mCpu0CstTable = (EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable;
+ break;
+ case (EFI_SIGNATURE_64 ('C', 'p', 'u', '0', 'T', 's', 't', 0)):
+ mCpu0TstTable = (EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable;
+ break;
+ case (EFI_SIGNATURE_64 ('A', 'p', 'I', 's', 't', 0, 0, 0)):
+ mApIstTable = (EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable;
+ break;
+ case (EFI_SIGNATURE_64 ('A', 'p', 'C', 's', 't', 0, 0, 0)):
+ mApCstTable = (EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable;
+ break;
+ case (EFI_SIGNATURE_64 ('A', 'p', 'T', 's', 't', 0, 0, 0)):
+ mApTstTable = (EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable;
+ break;
+ case (EFI_SIGNATURE_64 ('C', 'p', 'u', 'P', 'm', 0, 0, 0)):
+ mCpuPmTable = (EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable;
+ break;
+ case (EFI_SIGNATURE_64 ('L', 'a', 'k', 'e', 'T','i', 'n', 'y')):
+ mLakeTinyTable = (EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable;
+ break;
+ case (EFI_SIGNATURE_64 ('C', 't', 'd', 'p', 'B', 0, 0, 0)):
+ mCtdpTable = (EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable;
+ break;
+ default:
+ break;
+ }
+ Instance++; // Increment the instance
+ CurrentTable = NULL;
+ }
+ }
+ ///
+ /// Statically load IST SSDT if EIST is enabled
+ ///
+ if (mPpmGlobalNvsAreaProtocol->Area->PpmFlags & PPM_EIST) {
+ AcpiTableHandle = 0;
+ Status = mAcpiTable->InstallAcpiTable (
+ mAcpiTable,
+ mCpu0IstTable,
+ mCpu0IstTable->Length,
+ &AcpiTableHandle
+ );
+ //
+ // Free this table as it has been copied into ACPI tables
+ //
+ FreePool (mCpu0IstTable);
+ }
+ ///
+ /// If we are CMP, then the PPM tables are dynamically loaded:
+ /// We need to publish the CpuPm table to the ACPI tables, and move the CST
+ /// tables that are dynamically loaded to a separate location so that we can fix the
+ /// addresses in the CpuPm table.
+ /// Otherwise (non-CMP):
+ /// We need to publish CPU 0 tables only, and CST tables only if CST is enabled
+ ///
+ if (mPpmGlobalNvsAreaProtocol->Area->PpmFlags & PPM_CMP) {
+ //
+ // Copy tables to our own location and checksum them
+ //
+ Status = (gBS->AllocatePool) (EfiReservedMemoryType, mApIstTable->Length, (VOID **) &TempTable);
+ ASSERT_EFI_ERROR (Status);
+ CopyMem (TempTable, mApIstTable, mApIstTable->Length);
+ FreePool (mApIstTable);
+ mApIstTable = TempTable;
+ AcpiChecksum (mApIstTable, mApIstTable->Length, EFI_FIELD_OFFSET (EFI_ACPI_DESCRIPTION_HEADER, Checksum));
+ Status = (gBS->AllocatePool) (EfiReservedMemoryType, mCpu0CstTable->Length, (VOID **) &TempTable);
+ ASSERT_EFI_ERROR (Status);
+ CopyMem (TempTable, mCpu0CstTable, mCpu0CstTable->Length);
+ FreePool (mCpu0CstTable);
+ mCpu0CstTable = TempTable;
+ AcpiChecksum (mCpu0CstTable, mCpu0CstTable->Length, EFI_FIELD_OFFSET (EFI_ACPI_DESCRIPTION_HEADER, Checksum));
+ Status = (gBS->AllocatePool) (EfiReservedMemoryType, mApCstTable->Length, (VOID **) &TempTable);
+ ASSERT_EFI_ERROR (Status);
+ CopyMem (TempTable, mApCstTable, mApCstTable->Length);
+ FreePool (mApCstTable);
+ mApCstTable = TempTable;
+ AcpiChecksum (mApCstTable, mApCstTable->Length, EFI_FIELD_OFFSET (EFI_ACPI_DESCRIPTION_HEADER, Checksum));
+ } else {
+ //
+ // CMP disabled, so statically load the tables
+ //
+ // Add CST SSDT if C states are enabled
+ //
+ if (mPpmGlobalNvsAreaProtocol->Area->PpmFlags & PPM_C_STATES) {
+ AcpiTableHandle = 0;
+ Status = mAcpiTable->InstallAcpiTable (
+ mAcpiTable,
+ mCpu0CstTable,
+ mCpu0CstTable->Length,
+ &AcpiTableHandle
+ );
+ }
+ ///
+ /// Since we are UP, there is no need for the CPU 1 tables
+ ///
+ ///
+ /// Free all tables, since they have been copied into ACPI tables by ACPI support protocol
+ ///
+ FreePool (mCpu0CstTable);
+ FreePool (mApIstTable);
+ FreePool (mApCstTable);
+ }
+ ///
+ /// Update the CpuPm SSDT table in the ACPI tables.
+ ///
+ PatchCpuPmTable ();
+ AcpiTableHandle = 0;
+ Status = mAcpiTable->InstallAcpiTable (
+ mAcpiTable,
+ mCpuPmTable,
+ mCpuPmTable->Length,
+ &AcpiTableHandle
+ );
+ FreePool (mCpuPmTable);
+ if (mPpmGlobalNvsAreaProtocol->Area->PpmFlags & PPM_TSTATES) {
+ ///
+ /// Load the Cpu0Tst SSDT table in the ACPI tables
+ ///
+ AcpiTableHandle = 0;
+ Status = mAcpiTable->InstallAcpiTable (
+ mAcpiTable,
+ mCpu0TstTable,
+ mCpu0TstTable->Length,
+ &AcpiTableHandle
+ );
+ FreePool (mCpu0TstTable);
+ ///
+ /// If the CMP is enabled then load the ApTst SSDT table in the ACPI tables
+ ///
+ if (mPpmGlobalNvsAreaProtocol->Area->PpmFlags & PPM_CMP) {
+ AcpiTableHandle = 0;
+ Status = mAcpiTable->InstallAcpiTable (
+ mAcpiTable,
+ mApTstTable,
+ mApTstTable->Length,
+ &AcpiTableHandle
+ );
+ }
+ }
+ FreePool (mApTstTable);
+ ///
+ /// Load LakeTiny SSDT only when it is enabled in policy and laketiny SSDT is included.
+ ///
+ if ((mCpuPmConfig->pFunctionEnables->LakeTiny) && (mLakeTinyTable != NULL)) {
+ AcpiTableHandle = 0;
+ Status = mAcpiTable->InstallAcpiTable (
+ mAcpiTable,
+ mLakeTinyTable,
+ mLakeTinyTable->Length,
+ &AcpiTableHandle
+ );
+ FreePool (mLakeTinyTable);
+ }
+ ///
+ /// Load Ctdp SSDT
+ ///
+ if (mCpuPmConfig->pTurboSettings->ConfigTdpBios == 1) {
+ AcpiTableHandle = 0;
+ Status = mAcpiTable->InstallAcpiTable (
+ mAcpiTable,
+ mCtdpTable,
+ mCtdpTable->Length,
+ &AcpiTableHandle
+ );
+ FreePool (mCtdpTable);
+ }
+
+ return Status;
+} \ No newline at end of file
diff --git a/ReferenceCode/Haswell/PowerManagement/Dxe/PerformanceStates.c b/ReferenceCode/Haswell/PowerManagement/Dxe/PerformanceStates.c
new file mode 100644
index 0000000..bcb03b2
--- /dev/null
+++ b/ReferenceCode/Haswell/PowerManagement/Dxe/PerformanceStates.c
@@ -0,0 +1,930 @@
+/** @file
+ This file contains P States and Turbo Power Management configuration functions for
+ Haswell processors.
+
+ Acronyms:
+ PPM - Processor Power Management
+ TM - Thermal Monitor
+ IST - Intel(R) Speedstep technology
+ HT - Hyper-Threading Technology
+
+@copyright
+ Copyright (c) 2012 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "PowerMgmtCommon.h"
+
+//(AMI_CHG)>
+VOID
+EFIAPI
+ApSafeSetEnergyPolicy (
+ IN OUT VOID *Buffer
+ );
+//<(AMI_CHG)
+
+extern UINT16 mCpuConfigTdpBootRatio;
+
+/**
+ Initializes P States and Turbo Power management features
+**/
+VOID
+InitializePStates (
+ VOID
+ )
+{
+ MSR_REGISTER Ia32MiscEnableMsr;
+
+ //
+ // InitTurboRatioLimits has to be called before InitGV3 as InitGV3 uses the Turbo Ratio Limit programmed.
+ //
+ InitTurboRatioLimits (mCpuPmConfig); ///< Initialize InitTurboRatioLimits
+
+ InitEnergyEfficientPState (mCpuPmConfig); ///< Initialize Energy Efficient P-state
+
+ //
+ // Initialize P states
+ //
+ if (mPpmGlobalNvsAreaProtocol->Area->PpmFlags & PPM_EIST) {
+ InitGv3 (mFvidPointer, mCpuPmConfig);
+ mNumberOfStates = mFvidPointer[0].FvidHeader.Gv3States;
+ } else {
+ //
+ // Clear EIST bit in IA32 Misc Enable MSR that was intially set in PEI
+ //
+ Ia32MiscEnableMsr.Qword = AsmReadMsr64 (MSR_IA32_MISC_ENABLE);
+ Ia32MiscEnableMsr.Qword &= ~B_MSR_IA32_MISC_ENABLE_EIST;
+ ///
+ /// Disable Turbo if EIST is disabled
+ ///
+ if (mPpmGlobalNvsAreaProtocol->Area->PpmFlags & PPM_TURBO) {
+ Ia32MiscEnableMsr.Qword |= (UINT64)B_MSR_IA32_MISC_DISABLE_TURBO;
+ }
+ AsmWriteMsr64 (MSR_IA32_MISC_ENABLE, Ia32MiscEnableMsr.Qword);
+ }
+
+ ///
+ /// Initialize PAIR Configuration
+ /// HSW BWG Rev 0.6.0, Section 16.4.1 Power Aware Interrupt Routing
+ ///
+ InitPpmIrmConfiguration (mCpuPmConfig);
+
+}
+
+/**
+ Initializes Turbo Ratio limits in the processor.
+
+ @param[in] CpuPmConfig Pointer to PPM Policy protocol instance
+**/
+VOID
+InitTurboRatioLimits (
+ IN OUT POWER_MGMT_CONFIG *CpuPmConfig
+ )
+{
+ MSR_REGISTER TurboRatioLimit;
+ MSR_REGISTER CoreThreadCount;
+ MSR_REGISTER FlexRatioMsr;
+ UINT8 CoreCount;
+ UINT8 OverclockingBins;
+ UINT8 OneCoreRatioLimit;
+ UINT8 TwoCoreRatioLimit;
+ UINT8 ThreeCoreRatioLimit;
+ UINT8 FourCoreRatioLimit;
+
+ ///
+ /// Check if processor turbo-ratio can be overriden
+ ///
+ // Haswell BWG Section 15.13.7
+ // If PLATFORM INFO MSR [28] == 1
+ //
+ if (!mRatioLimitProgrammble) {
+ DEBUG ((EFI_D_WARN, "Turbo Ratio Limit is NOT programmable. Platform Info MSR (0xCE) [28] is not set \n"));
+ return;
+ }
+ ///
+ /// Read the overclocking bins
+ ///
+ FlexRatioMsr.Qword = AsmReadMsr64 (MSR_FLEX_RATIO);
+ OverclockingBins = (UINT8) RShiftU64 ((FlexRatioMsr.Dwords.Low & B_OVERCLOCKING_BINS), 17);
+ if (FlexRatioMsr.Dwords.Low & B_OVERCLOCKING_LOCK) { ///< Check for Overclocking Lock bit
+ DEBUG ((EFI_D_ERROR, "ERROR: OverClocking Lock Bit is set. Disable the Lock and reset the system\n"));
+ return;
+ }
+ TurboRatioLimit.Qword = AsmReadMsr64 (MSR_TURBO_RATIO_LIMIT);
+ OneCoreRatioLimit = (UINT8) (TurboRatioLimit.Dwords.Low & B_MSR_TURBO_RATIO_LIMIT_1C);
+ TwoCoreRatioLimit = (UINT8) RShiftU64 (
+ (TurboRatioLimit.Dwords.Low & B_MSR_TURBO_RATIO_LIMIT_2C),
+ N_MSR_TURBO_RATIO_LIMIT_2C
+ );
+ ThreeCoreRatioLimit = (UINT8) RShiftU64 (
+ (TurboRatioLimit.Dwords.Low & B_MSR_TURBO_RATIO_LIMIT_3C),
+ N_MSR_TURBO_RATIO_LIMIT_3C
+ );
+ FourCoreRatioLimit = (UINT8) RShiftU64 (
+ (TurboRatioLimit.Dwords.Low & B_MSR_TURBO_RATIO_LIMIT_4C),
+ N_MSR_TURBO_RATIO_LIMIT_4C
+ );
+ ///
+ /// For Overclocking and locked parts, verify ratio overide is within the allowable limits
+ /// Locked parts will have OverclockingBins value as 0 so the below condition will take care of locked parts also
+ ///
+ if (OverclockingBins < MAX_OVERCLOCKING_BINS) {
+ if (CpuPmConfig->pRatioLimit[0] > (OneCoreRatioLimit + OverclockingBins)) {
+ CpuPmConfig->pRatioLimit[0] = OneCoreRatioLimit + OverclockingBins;
+ }
+ if (CpuPmConfig->pRatioLimit[1] > (TwoCoreRatioLimit + OverclockingBins)) {
+ CpuPmConfig->pRatioLimit[1] = TwoCoreRatioLimit + OverclockingBins;
+ }
+ if (CpuPmConfig->pRatioLimit[2] > (ThreeCoreRatioLimit + OverclockingBins)) {
+ CpuPmConfig->pRatioLimit[2] = ThreeCoreRatioLimit + OverclockingBins;
+ }
+ if (CpuPmConfig->pRatioLimit[3] > (FourCoreRatioLimit + OverclockingBins)) {
+ CpuPmConfig->pRatioLimit[3] = FourCoreRatioLimit + OverclockingBins;
+ }
+ }
+
+ ///
+ /// Max Turbo ratio or P0 = Fused 1C Turbo Ratio Limit + No of over clocking Bins.
+ ///
+ mTurboBusRatio = OneCoreRatioLimit + OverclockingBins;
+ ///
+ /// Initialize turbo ratio limit MSR.
+ /// Find the number of active cores and initialize the ratio limits only if they are available.
+ ///
+ CoreThreadCount.Qword = AsmReadMsr64 (MSR_CORE_THREAD_COUNT);
+ CoreCount = (UINT8) RShiftU64 (CoreThreadCount.Dwords.Low, N_CORE_COUNT_OFFSET);
+ if (CpuPmConfig->pRatioLimit[0] >= CpuPmConfig->pRatioLimit[1] &&
+ CpuPmConfig->pRatioLimit[0] >= CpuPmConfig->pRatioLimit[2] &&
+ CpuPmConfig->pRatioLimit[0] >= CpuPmConfig->pRatioLimit[3] &&
+ CpuPmConfig->pRatioLimit[1] >= mMaxBusRatio &&
+ CpuPmConfig->pRatioLimit[2] >= mMaxBusRatio &&
+ CpuPmConfig->pRatioLimit[3] >= mMaxBusRatio
+ ) {
+ if (CoreCount >= 1) {
+ TurboRatioLimit.Dwords.Low &= ~B_MSR_TURBO_RATIO_LIMIT_1C;
+ TurboRatioLimit.Dwords.Low |= CpuPmConfig->pRatioLimit[0];
+ }
+ if (CoreCount >= 2) {
+ TurboRatioLimit.Dwords.Low &= ~B_MSR_TURBO_RATIO_LIMIT_2C;
+ TurboRatioLimit.Dwords.Low |= LShiftU64 (CpuPmConfig->pRatioLimit[1], 8);
+ }
+ if (CoreCount >= 3) {
+ TurboRatioLimit.Dwords.Low &= ~B_MSR_TURBO_RATIO_LIMIT_3C;
+ TurboRatioLimit.Dwords.Low |= LShiftU64 (CpuPmConfig->pRatioLimit[2], 16);
+ }
+ if (CoreCount >= 4) {
+ TurboRatioLimit.Dwords.Low &= ~B_MSR_TURBO_RATIO_LIMIT_4C;
+ TurboRatioLimit.Dwords.Low |= LShiftU64 (CpuPmConfig->pRatioLimit[3], 24);
+ }
+ AsmWriteMsr64 (MSR_TURBO_RATIO_LIMIT, TurboRatioLimit.Qword);
+ }
+ //
+ // For fully unlocked CPU's, configure Turbo Ratio as 0xFF (max possible P-State)
+ //
+ if (OverclockingBins == MAX_OVERCLOCKING_BINS) {
+ mTurboBusRatio = 0xFF;
+ }
+
+ return;
+}
+
+/**
+ Initializes Energy efficient P-state feature.
+
+ @param[in] CpuPmConfig Pointer to policy protocol instance
+**/
+VOID
+InitEnergyEfficientPState (
+ IN OUT POWER_MGMT_CONFIG *CpuPmConfig
+ )
+{
+ MSR_REGISTER PowerCtlMsr;
+
+ ///
+ /// Configure Energy Efficient P-state : POWER_CTL[18]
+ ///
+ PowerCtlMsr.Qword = AsmReadMsr64 (MSR_POWER_CTL);
+ PowerCtlMsr.Dwords.Low &= ~B_ENERGY_EFFICIENT_P_STATE_FEATURE_ENABLE;
+ if (mPpmGlobalNvsAreaProtocol->Area->PpmFlags & PPM_EEPST) {
+ PowerCtlMsr.Dwords.Low |= B_ENERGY_EFFICIENT_P_STATE_FEATURE_ENABLE;
+ }
+ AsmWriteMsr64 (MSR_POWER_CTL, PowerCtlMsr.Qword);
+
+//(AMI_CHG)>
+ if (mPpmGlobalNvsAreaProtocol->Area->PpmFlags & PPM_EEPST) {
+ RunOnAllLogicalProcessors (ApSafeSetEnergyPolicy, CpuPmConfig);
+ }
+//<(AMI_CHG)
+ return;
+}
+
+/**
+ Sets the MSR_IA32_ENERGY_PERFROMANCE_BIAS.Energy Efficiency Policy.
+ This function must be MP safe.
+
+ @param[in] Buffer Pointer to PPM Policy
+
+ @retval EFI_SUCCESS Energy policy is set successfully.
+**/
+//(AMI_CHG)>
+VOID
+EFIAPI
+ApSafeSetEnergyPolicy (
+ IN OUT VOID *Buffer
+ )
+{
+ POWER_MGMT_CONFIG *CpuPmConfig;
+ MSR_REGISTER Ia32EnergyPerfBiasMsr;
+
+ CpuPmConfig = (POWER_MGMT_CONFIG *) Buffer;
+ Ia32EnergyPerfBiasMsr.Qword = AsmReadMsr64 (MSR_IA32_ENERGY_PERFORMANCE_BIAS);
+ Ia32EnergyPerfBiasMsr.Dwords.Low &= ~B_ENERGY_POLICY_MASK;
+ Ia32EnergyPerfBiasMsr.Dwords.Low |= CpuPmConfig->pTurboSettings->EnergyPolicy;
+ AsmWriteMsr64 (MSR_IA32_ENERGY_PERFORMANCE_BIAS, Ia32EnergyPerfBiasMsr.Qword);
+
+ return;
+}
+/*EFI_STATUS
+ApSafeSetEnergyPolicy (
+ IN OUT VOID *Buffer
+ )
+{
+ POWER_MGMT_CONFIG *CpuPmConfig;
+ MSR_REGISTER Ia32EnergyPerfBiasMsr;
+
+ CpuPmConfig = (POWER_MGMT_CONFIG *) Buffer;
+ Ia32EnergyPerfBiasMsr.Qword = AsmReadMsr64 (MSR_IA32_ENERGY_PERFORMANCE_BIAS);
+ Ia32EnergyPerfBiasMsr.Dwords.Low &= ~B_ENERGY_POLICY_MASK;
+ Ia32EnergyPerfBiasMsr.Dwords.Low |= CpuPmConfig->pTurboSettings->EnergyPolicy;
+ AsmWriteMsr64 (MSR_IA32_ENERGY_PERFORMANCE_BIAS, Ia32EnergyPerfBiasMsr.Qword);
+
+ return EFI_SUCCESS;
+}*/
+//<(AMI_CHG)
+/**
+ Initializes required structures for P-State table creation and enables GV3
+ support in the processor.
+
+ @param[in] FvidPointer Table to update, must be initialized.
+ @param[in] CpuPmConfig Pointer to policy protocol instance
+**/
+VOID
+InitGv3 (
+ IN OUT FVID_TABLE *FvidPointer,
+ IN OUT POWER_MGMT_CONFIG *CpuPmConfig
+ )
+{
+ MSR_REGISTER Ia32MiscEnableMsr;
+ EFI_CPUID_REGISTER Cpuid = { 0, 0, 0, 0 };
+
+ ///
+ /// Test for Turbo Mode supported and initialize if true.
+ ///
+ AsmCpuid (CPUID_POWER_MANAGEMENT_PARAMS, &Cpuid.RegEax, &Cpuid.RegEbx, &Cpuid.RegEcx, &Cpuid.RegEdx);
+ Ia32MiscEnableMsr.Qword = AsmReadMsr64 (MSR_IA32_MISC_ENABLE);
+ if (mPpmGlobalNvsAreaProtocol->Area->PpmFlags & PPM_TURBO) {
+ ///
+ /// Clear Turbo Mode disable bit in IA32 Misc Enable MSR
+ ///
+ Ia32MiscEnableMsr.Qword &= ~B_MSR_IA32_MISC_DISABLE_TURBO;
+ AsmWriteMsr64 (MSR_IA32_MISC_ENABLE, Ia32MiscEnableMsr.Qword);
+ } else if (((Ia32MiscEnableMsr.Qword & B_MSR_IA32_MISC_DISABLE_TURBO) == 0) &&
+ ((Cpuid.RegEax & B_CPUID_POWER_MANAGEMENT_EAX_TURBO) == B_CPUID_POWER_MANAGEMENT_EAX_TURBO)) {
+ ///
+ /// If Turbo mode is supported but required to be disabled (by platform policy setting)
+ /// Set Turbo Mode disable bit in IA32 Misc Enable MSR since it might be temporarily enabled earlier.
+ ///
+ Ia32MiscEnableMsr.Qword |= B_MSR_IA32_MISC_DISABLE_TURBO;
+ AsmWriteMsr64 (MSR_IA32_MISC_ENABLE, Ia32MiscEnableMsr.Qword);
+ }
+
+ ///
+ /// Initialize the FVID tables.
+ ///
+ InitFvidTable (FvidPointer, FVID_MAX_STATES, FVID_MIN_STEP_SIZE, FALSE);
+ ASSERT (FvidPointer->FvidHeader.Gv3States != 0);
+
+ ///
+ /// Enable GV3 on all logical processors.
+ ///
+ RunOnAllLogicalProcessors (ApSafeEnableGv3, NULL);
+
+ return;
+}
+
+/**
+ Enables GV3 support in a logical processor.
+
+ This function must be MP safe.
+
+ @param[in] Buffer Pointer to arguments - not used
+
+ @retval EFI_SUCCESS
+**/
+VOID
+EFIAPI
+ApSafeEnableGv3 (
+ IN OUT VOID *Buffer
+ )
+{
+ MSR_REGISTER Ia32MiscEnable;
+ MSR_REGISTER MiscPwrMgmt;
+
+ ///
+ /// Enable GV3 in the CPU MSR.
+ ///
+ Ia32MiscEnable.Qword = AsmReadMsr64 (MSR_IA32_MISC_ENABLE);
+ Ia32MiscEnable.Qword |= B_MSR_IA32_MISC_ENABLE_EIST;
+ AsmWriteMsr64 (MSR_IA32_MISC_ENABLE, Ia32MiscEnable.Qword);
+
+ ///
+ /// If CMP is disabled, disable hardware coordination.
+ ///
+ if (!(mPpmGlobalNvsAreaProtocol->Area->PpmFlags & PPM_CMP)) {
+ MiscPwrMgmt.Qword = AsmReadMsr64 (MSR_MISC_PWR_MGMT);
+ MiscPwrMgmt.Qword |= B_MSR_MISC_PWR_MGMT_EIST_HW;
+ AsmWriteMsr64 (MSR_MISC_PWR_MGMT, MiscPwrMgmt.Qword);
+ }
+
+ return;
+}
+
+/**
+ Configures the Interrupt Redirection Mode Selection for Logical Interrupts.
+
+ @param[in] CpuPmConfig Pointer to PPM Policy structure.
+**/
+VOID
+InitPpmIrmConfiguration (
+ IN OUT POWER_MGMT_CONFIG *CpuPmConfig
+ )
+{
+ UINTN PciD0F0RegBase;
+ UINTN MchBar;
+ UINT32 Data32And;
+ UINT32 Data32Or;
+ UINT8 PpmIrmSetting;
+
+ //
+ ///
+ /// HSW BWG Rev 0.6.0, Section 16.4.1 Power Aware Interrupt Routing
+ /// Program Interrupt Routiong Control register MCHBAR+0x5418 as PAIR with Fixed Priority
+ ///
+ PpmIrmSetting = 4;
+ ///
+ /// Get the MCH space base address and program MMIO register MCHBAR+0x5418 to enable specific routing algorithm.
+ ///
+ PciD0F0RegBase = MmPciAddress (0, 0, 0, 0, 0);
+ MchBar = MmioRead32 (PciD0F0RegBase + 0x48) &~BIT0;
+ Data32And = (UINT32) ~(BIT2 + BIT1 + BIT0);
+ Data32Or = (UINT32) (PpmIrmSetting & (BIT2 + BIT1 + BIT0));
+ MmioAndThenOr32 (MchBar + 0x5418, Data32And, Data32Or);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (MchBar + 0x5418),
+ 1,
+ (VOID *) (UINTN) (MchBar + 0x5418)
+ );
+}
+
+/**
+ This function updates the table provided with the FVID data for the processor.
+ If CreateDefaultTable is TRUE, a minimam FVID table will be provided.
+ The maximum number of states must be greater then or equal to two.
+ The table should be initialized in such a way as for the caller to determine if the
+ table was updated successfully. This function should be deprecated in the future when
+ Release 8 is integrated in favor of the EIST protocol calculating FVID information.
+
+ @param[in] FvidPointer Pointer to a table to be updated
+ @param[in] MaxNumberOfStates Number of entries in the table pointed to by FvidPointer
+ @param[in] MinStepSize Minimum step size for generating the FVID table
+ @param[in] CreateDefaultTable Create default FVID table rather then full state support
+**/
+VOID
+InitFvidTable (
+ IN OUT FVID_TABLE *FvidPointer,
+ IN UINT16 MaxNumberOfStates,
+ IN UINT16 MinStepSize,
+ IN BOOLEAN CreateDefaultTable
+ )
+{
+ EFI_STATUS Status;
+
+ ///
+ /// Return the function, if the FVID tables have already been created.
+ ///
+ if (FvidPointer[0].FvidHeader.Gv3States != 0) {
+ return;
+ }
+ ///
+ /// Create FVID table
+ ///
+ if (CreateDefaultTable) {
+ CreateDefaultFvidTable (FvidPointer);
+ mPpmGlobalNvsAreaProtocol->Area->PpmFlags &= ~PPM_TURBO;
+ } else {
+ Status = CreateFvidTable (FvidPointer, MaxNumberOfStates);
+ if (EFI_ERROR (Status)) {
+ CreateDefaultFvidTable (FvidPointer);
+ mPpmGlobalNvsAreaProtocol->Area->PpmFlags &= ~PPM_TURBO;
+ }
+ }
+
+ return;
+}
+
+/**
+ Create default FVID table with max and min states only.
+
+ @param[in] FvidPointer Pointer to a table to be updated
+**/
+VOID
+CreateDefaultFvidTable (
+ IN OUT FVID_TABLE *FvidPointer
+ )
+{
+ UINT64 wPower1;
+ UINT64 wPower2;
+
+ ///
+ /// Fill in the FVid table header.
+ ///
+ FvidPointer[0].FvidHeader.Stepping = mPpmGlobalNvsAreaProtocol->Area->Cpuid;
+ FvidPointer[0].FvidHeader.MaxBusRatio = mMaxBusRatio;
+ FvidPointer[0].FvidHeader.Gv3States = 2;
+ ///
+ /// First entry is state 0, highest state.
+ ///
+ FvidPointer[1].FvidState.State = 0;
+ FvidPointer[1].FvidState.BusRatio = mMaxBusRatio;
+ ///
+ /// Power is calculated in milliwatts
+ ///
+ FvidPointer[1].FvidState.Power = (mPackageTdpWatt * 1000);
+ ///
+ /// Second entry is state 1, lowest state.
+ ///
+ FvidPointer[2].FvidState.State = 1;
+ FvidPointer[2].FvidState.BusRatio = (UINT16) mMinBusRatio;
+ ///
+ /// Calculate Relative Power per HSW BWG (0.6.0 section 13.10.4)
+ ///
+ wPower1 = (mMaxBusRatio - FvidPointer[2].FvidState.BusRatio) * 625;
+ wPower1 = (110000 - wPower1);
+ wPower1 = DivU64x32 (wPower1, 11);
+ wPower1 = DivU64x32 (MultU64x64 (wPower1, wPower1), 1000);
+ //
+ // Power is calculated in milliwatts
+ //
+ wPower2 = (((FvidPointer[2].FvidState.BusRatio * 100000) / mMaxBusRatio) / 100);
+ wPower2 = DivU64x32 (MultU64x32 (MultU64x64 (wPower2, DivU64x32 (wPower1, 100)), mPackageTdpWatt), 1000);
+ FvidPointer[2].FvidState.Power = (UINT16) wPower2;
+}
+
+/**
+ Calculate the ratio for the requested p state based on HSW BWG recommendation
+
+ @param[in] MaxRatio Maximum Supported Ratio (HFM)
+ @param[in] MinRatio Minimum Supported Ratio (LFM)
+ @param[in] MaxNumberOfStates Number of entries in the table pointed to by FvidPointer
+ @param[in] PStateNumber Desired P State from range 0..MaxNumberOfStates
+
+ @retval Ratio for the requested Pstate
+**/
+UINT16
+ComputePstateRatio (
+ IN UINT16 MaxRatio,
+ IN UINT16 MinRatio,
+ IN UINT16 MaxNumberOfStates,
+ IN UINT16 PStateNumber
+ )
+{
+ UINT16 RatioRange;
+ UINT16 NumGaps;
+ UINT16 PStateRatio;
+
+ RatioRange = MaxRatio - MinRatio;
+ NumGaps = MaxNumberOfStates - 1;
+ PStateRatio = MaxRatio - (((PStateNumber * RatioRange) + (NumGaps / 2)) / NumGaps);
+
+ return PStateRatio;
+}
+
+/**
+ Create an FVID table based on the algorithm provided by the HSW BIOS writer's guide.
+
+ @param[in] FvidPointer Pointer to a table to be updated
+ @param[in] MaxNumberOfStates Number of entries in the table pointed to by FvidPointer
+
+ @retval EFI_SUCCESS FVID table created successfully.
+ @retval EFI_INVALID_PARAMETER The bus ratio range don't permit FVID table calculation;
+ a default FVID table should be constructed.
+**/
+EFI_STATUS
+CreateFvidTable (
+ IN OUT FVID_TABLE *FvidPointer,
+ IN UINT16 MaxNumberOfStates
+ )
+{
+ UINT16 BusRatioRange;
+ UINT16 PowerRange;
+ UINT16 NumberOfStates;
+ UINT16 Turbo;
+ UINT16 index;
+ UINT64 wPower1;
+ UINT64 wPower2;
+
+ ///
+ /// Determine the bus ratio range
+ ///
+ BusRatioRange = mMaxBusRatio - mMinBusRatio;
+ if (((INT16) BusRatioRange < 0) || (MaxNumberOfStates == 0)) {
+ return EFI_INVALID_PARAMETER;
+ }
+ ///
+ /// Determine the Power range
+ ///
+ PowerRange = FVID_MAX_POWER - FVID_MIN_POWER;
+ ///
+ /// Determine the HFM state index
+ ///
+ Turbo = ((mPpmGlobalNvsAreaProtocol->Area->PpmFlags & PPM_TURBO) ? 1 : 0);
+ ///
+ /// Determine the number of states as cpu supported range or Maximum _PSS limit
+ ///
+ NumberOfStates = ((BusRatioRange + 1) < MaxNumberOfStates ? (BusRatioRange + 1) : MaxNumberOfStates);
+ ///
+ /// Ensure we have at least two states
+ ///
+ if ((NumberOfStates + Turbo) < 2) {
+ ///
+ /// In case HFM = LFM and no Turbo, at least have two states with same ratio values
+ ///
+ NumberOfStates = 2;
+ }
+ ///
+ /// Fill in the table header
+ ///
+ FvidPointer[0].FvidHeader.Stepping = mPpmGlobalNvsAreaProtocol->Area->Cpuid;
+ FvidPointer[0].FvidHeader.MaxBusRatio = (Turbo ? mTurboBusRatio : mMaxBusRatio);
+ FvidPointer[0].FvidHeader.Gv3States = (UINT16) (NumberOfStates < MaxNumberOfStates ? (NumberOfStates + Turbo) : NumberOfStates);
+ ///
+ /// Add Turbo as P0 if Turbo Mode supported and initialize.
+ ///
+ if (mPpmGlobalNvsAreaProtocol->Area->PpmFlags & PPM_TURBO) {
+ FvidPointer[1].FvidState.BusRatio = mTurboBusRatio;
+ FvidPointer[1].FvidState.Power = (mPackageTdpWatt * 1000); // power is calculated in milliwatts
+ ///
+ /// Reserve on P-State for Max Turbo
+ ///
+ if (NumberOfStates == MaxNumberOfStates) {
+ NumberOfStates--;
+ }
+ }
+ ///
+ /// Add HFM as P0 or P1 based on Max Turbo availablity
+ ///
+ FvidPointer[1 + Turbo].FvidState.State = Turbo;
+ FvidPointer[1 + Turbo].FvidState.BusRatio = mMaxBusRatio;
+ //
+ // Power is calculated in milliwatts
+ //
+ FvidPointer[1 + Turbo].FvidState.Power = (mPackageTdpWatt * 1000);
+ ///
+ /// Fill in the table starting at the last entry
+ /// The algorithm is available in the processor BIOS writer's guide.
+ ///
+ for (index = 1; index < NumberOfStates; index++) {
+ FvidPointer[index + 1 + Turbo].FvidState.State = index + Turbo;
+ FvidPointer[index + 1 + Turbo].FvidState.BusRatio = ComputePstateRatio (mMaxBusRatio, mMinBusRatio, NumberOfStates, index);
+ ///
+ /// Calculate Relative Power per HSW BWG
+ ///
+ wPower1 = (mMaxBusRatio - FvidPointer[index + 1 + Turbo].FvidState.BusRatio) * 625;
+ wPower1 = (110000 - wPower1);
+ wPower1 = DivU64x32 (wPower1, 11);
+ wPower1 = MultU64x64 (wPower1, wPower1);
+ ///
+ /// Power is calculated in milliwatts
+ ///
+ wPower2 = (((FvidPointer[index + 1 + Turbo].FvidState.BusRatio * 100) / mMaxBusRatio));
+ wPower2 = DivU64x32 (MultU64x32 (MultU64x64 (wPower2, wPower1), mPackageTdpWatt), 10000000);
+ FvidPointer[index + 1 + Turbo].FvidState.Power = (UINT32) wPower2;
+ ///
+ /// For Controllable Tdp -- Configure PPC as LFM (i.e fake LFM + 1)
+ ///
+ if (mControllableTdpEnable == 1 && FvidPointer[index + 1 + Turbo].FvidState.BusRatio == (mMinBusRatio + 1)) {
+ mPpmGlobalNvsAreaProtocol->Area->ConfigurablePpc = (UINT8)FvidPointer[index + 1 + Turbo].FvidState.State;
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Set processor P state to HFM or LFM.
+
+ @exception EFI_UNSUPPORTED EIST not supported.
+ @retval EFI_SUCCESS Processor P state has been set.
+**/
+VOID
+SetBootPState (
+ VOID
+ )
+{
+ MSR_REGISTER Ia32MiscEnable;
+ MSR_REGISTER Ia32PerfCtl;
+ BOOLEAN EistEnabled;
+
+ ///
+ /// This function will be executed even when EIST is disabled so processor can be switched to HFM
+ /// Only skip this when EIST is not capable.
+ ///
+ if ((mCpuid01.RegEcx & B_CPUID_VERSION_INFO_ECX_EIST) == 0) {
+ return;
+ }
+ ///
+ /// Read EIST.
+ ///
+ Ia32MiscEnable.Qword = AsmReadMsr64 (MSR_IA32_MISC_ENABLE);
+ EistEnabled = (BOOLEAN) RShiftU64 (
+ (Ia32MiscEnable.Qword & B_MSR_IA32_MISC_ENABLE_EIST),
+ N_MSR_IA32_MISC_ENABLE_EIST_OFFSET
+ );
+ ///
+ /// If EIST is disabled, temporarily enable it
+ ///
+ if (EistEnabled == 0) {
+ Ia32MiscEnable.Qword |= B_MSR_IA32_MISC_ENABLE_EIST;
+ AsmWriteMsr64 (MSR_IA32_MISC_ENABLE, Ia32MiscEnable.Qword);
+ }
+ Ia32PerfCtl.Qword = AsmReadMsr64 (MSR_IA32_PERF_CTRL);
+ Ia32PerfCtl.Qword &= B_IA32_PERF_CTRLP_STATE_TARGET;
+ mBspBootRatio = (UINT16) RShiftU64 (Ia32PerfCtl.Qword, N_IA32_PERF_CTRLP_STATE_TARGET);
+ ///
+ /// Set P-state on all cores
+ ///
+ RunOnAllLogicalProcessors (ApSafeSetBootPState, NULL);
+ ///
+ /// Disable EIST if we enabled it previously
+ ///
+ if (EistEnabled == 0) {
+ Ia32MiscEnable.Qword = AsmReadMsr64 (MSR_IA32_MISC_ENABLE);
+ Ia32MiscEnable.Qword &= ~B_MSR_IA32_MISC_ENABLE_EIST;
+ AsmWriteMsr64 (MSR_IA32_MISC_ENABLE, Ia32MiscEnable.Qword);
+ }
+
+ return;
+}
+
+/**
+ Set processor P state based on Boot ConfigTdp level.
+
+ @param[in] Buffer Unused
+
+ @retval EFI_SUCCESS Processor MSR setting is saved.
+**/
+VOID
+EFIAPI
+ApSafeSetBootPState (
+ IN OUT VOID *Buffer
+ )
+{
+ MSR_REGISTER Ia32PerfCtl;
+ UINT16 BootRatio;
+
+ Ia32PerfCtl.Qword = AsmReadMsr64 (MSR_IA32_PERF_CTRL);
+ Ia32PerfCtl.Qword &= ~B_IA32_PERF_CTRLP_STATE_TARGET;
+ /*AMI_CHG+>
+ if (mCpuConfigTdpBootRatio != 0) {
+ ///
+ /// For ConfigTDP enabled SKU use (ConfigTDP boot ratio - 1 / TAR Ratio) as max non-turbo ratio
+ ///
+ BootRatio = mCpuConfigTdpBootRatio-1;
+ //
+ // If EIST is disabled use boot ratio ConfigTDP boot ratio / TAR+1.
+ //
+ if((mPpmGlobalNvsAreaProtocol->Area->PpmFlags & PPM_EIST)== 0) {
+ BootRatio = mCpuConfigTdpBootRatio;
+ }
+ } else {
+ ///
+ /// For Non-ConfigTDP enabled SKU set BSP ratio on all threads.
+ ///
+ BootRatio = mBspBootRatio;
+ }<AMI_CHG*/
+ BootRatio = mBspBootRatio;
+ Ia32PerfCtl.Qword |= LShiftU64 (BootRatio, N_IA32_PERF_CTRLP_STATE_TARGET);
+ AsmWriteMsr64 (MSR_IA32_PERF_CTRL, Ia32PerfCtl.Qword);
+
+ return;
+}
+
+//
+// Update ACPI PerfomanceStates tables
+//
+
+/**
+ Patch the native _PSS package with the GV3 values
+ Uses ratio/VID values from the FVID table to fix up the control values in the _PSS.
+
+ (1) Find _PSS package:
+ (1.1) Find the _PR_CPU0 scope.
+ (1.2) Save a pointer to the package length.
+ (1.3) Find the _PSS AML name object.
+ (2) Resize the _PSS package.
+ (3) Fix up the _PSS package entries
+ (3.1) Check Turbo mode support.
+ (3.2) Check Dynamic FSB support.
+ (4) Fix up the Processor block and \_PR_CPU0 Scope length.
+ (5) Update SSDT Header with new length.
+
+ @retval EFI_SUCCESS - on success
+ @retval EFI_NOT_FOUND - if _PR_.CPU0 scope is not foud in the ACPI tables
+**/
+EFI_STATUS
+AcpiPatchPss (
+ VOID
+ )
+{
+ UINT8 *CurrPtr;
+ UINT8 *EndOfTable;
+ UINT8 index;
+ UINT16 NewPackageLength;
+ UINT16 MaxPackageLength;
+ UINT16 Temp;
+ UINT16 *PackageLength;
+ UINT16 *ScopePackageLengthPtr;
+ UINT32 *Signature;
+ PSS_PACKAGE_LAYOUT *PssPackage;
+ MSR_REGISTER TempMsr;
+ UINT16 MaximumEfficiencyRatio;
+ UINT16 MaximumNonTurboRatio;
+ UINT16 PnPercent;
+
+ ScopePackageLengthPtr = NULL;
+ PssPackage = NULL;
+
+ //
+ // Get Maximum Efficiency bus ratio (LFM) from Platform Info MSR Bits[47:40]
+ // Get Maximum Non Turbo bus ratio from Platform Info MSR Bits[15:8]
+ //
+ TempMsr.Qword = AsmReadMsr64 (MSR_PLATFORM_INFO);
+ MaximumEfficiencyRatio = TempMsr.Bytes.SixthByte;
+ MaximumNonTurboRatio = TempMsr.Bytes.SecondByte;
+
+ ///
+ /// Calculate new package length
+ ///
+ NewPackageLength = Temp = (UINT16) (mNumberOfStates * sizeof (PSS_PACKAGE_LAYOUT) + 3);
+ MaxPackageLength = (UINT16) (FVID_MAX_STATES * sizeof (PSS_PACKAGE_LAYOUT) + 3);
+ ///
+ /// Locate the SSDT package in the IST table
+ ///
+ CurrPtr = (UINT8 *) mCpu0IstTable;
+ EndOfTable = (UINT8 *) (CurrPtr + mCpu0IstTable->Length);
+ for (CurrPtr; CurrPtr <= EndOfTable; CurrPtr++) {
+ Signature = (UINT32 *) (CurrPtr + 1);
+ ///
+ /// If we find the _PR_CPU0 scope, save a pointer to the package length
+ ///
+ if ((*CurrPtr == AML_SCOPE_OP) &&
+ (*(Signature + 1) == EFI_SIGNATURE_32 ('_', 'P', 'R', '_')) &&
+ (*(Signature + 2) == EFI_SIGNATURE_32 ('C', 'P', 'U', '0'))
+ ) {
+ ScopePackageLengthPtr = (UINT16 *) (CurrPtr + 1);
+ }
+ ///
+ /// Patch the native _PSS package with the GV3 values
+ ///
+ if ((*CurrPtr == AML_NAME_OP) && (*Signature == EFI_SIGNATURE_32 ('_', 'P', 'S', 'S'))) {
+ ///
+ /// Check table dimensions.
+ /// PSS package reserve space for FVID_MAX_STATES number of P-states so check if the
+ /// current number of P- states is more than FVID_MAX_STATES. Also need to update the SSDT contents
+ /// if the current number of P-states is less than FVID_MAX_STATES.
+ ///
+ ASSERT (mNumberOfStates <= FVID_MAX_STATES);
+ if (mNumberOfStates <= FVID_MAX_STATES) {
+ *(CurrPtr + 8) = (UINT8) mNumberOfStates;
+ PackageLength = (UINT16 *) (CurrPtr + 6);
+ ///
+ /// Update the Package length in AML package length format
+ ///
+ *PackageLength = ((NewPackageLength & 0x0F) | 0x40) | ((Temp << 4) & 0x0FF00);
+ ///
+ /// Move SSDT contents
+ ///
+ CopyMem (
+ (CurrPtr + NewPackageLength),
+ (CurrPtr + MaxPackageLength),
+ EndOfTable - (CurrPtr + MaxPackageLength)
+ );
+ ///
+ /// Save the new end of the SSDT
+ ///
+ EndOfTable = EndOfTable - (MaxPackageLength - NewPackageLength);
+ }
+ PssPackage = (PSS_PACKAGE_LAYOUT *) (CurrPtr + 9);
+ for (index = 1; index <= mNumberOfStates; index++) {
+ ///
+ /// Update the _PSS table
+ ///
+ ///
+ /// If Turbo mode is supported, add one to the Max Non-Turbo frequency
+ ///
+ if ((mPpmGlobalNvsAreaProtocol->Area->PpmFlags & PPM_TURBO) && (index == 1)) {
+ PssPackage->CoreFrequency = (UINT32)((mFvidPointer[index + 1].FvidState.BusRatio)* 100)+1;
+ }else if (mFvidPointer[index].FvidState.BusRatio < MaximumEfficiencyRatio) {
+ //
+ // If cTDP Down Ratio == LFM, set it to 1% lower than LFM.
+ //
+ PnPercent = (MaximumEfficiencyRatio * 100) / MaximumNonTurboRatio;
+ PssPackage->CoreFrequency = (MaximumNonTurboRatio * (PnPercent - 1)); // Simplified Calculation.
+ } else {
+ PssPackage->CoreFrequency = (UINT32)(mFvidPointer[index].FvidState.BusRatio) * 100;
+ }
+ PssPackage->Power = (UINT32) mFvidPointer[index].FvidState.Power;
+ ///
+ /// If it's PSS table, Control is the PERF_CTL value.
+ /// Status entry is the same as control entry.
+ /// TransLatency uses 10
+ ///
+ PssPackage->TransLatency = NATIVE_PSTATE_LATENCY;
+ PssPackage->Control = (UINT32) LShiftU64 (mFvidPointer[index].FvidState.BusRatio, 8);
+ //
+ // Ensure any future OS would not look for the IA32_PERF_STATUS MSR to check if the value matches
+ //
+ if (mFvidPointer[index].FvidState.BusRatio < MaximumEfficiencyRatio) {
+ PssPackage->Status = (UINT32) LShiftU64 (MaximumEfficiencyRatio, 8);
+ } else {
+ PssPackage->Status = (UINT32) LShiftU64 (mFvidPointer[index].FvidState.BusRatio, 8);
+ }
+ PssPackage->BMLatency = PSTATE_BM_LATENCY;
+ PssPackage++;
+ }
+ }
+ }
+ ASSERT (ScopePackageLengthPtr != NULL);
+ if (ScopePackageLengthPtr == NULL) {
+ return EFI_NOT_FOUND;
+ }
+ ///
+ /// Update the Package length in AML package length format
+ ///
+ CurrPtr = (UINT8 *) ScopePackageLengthPtr;
+ NewPackageLength = Temp = (UINT16) (EndOfTable - CurrPtr);
+ *ScopePackageLengthPtr = ((NewPackageLength & 0x0F) | 0x40) | ((Temp << 4) & 0x0FF00);
+ mCpu0IstTable->Length = (UINT32) (EndOfTable - (UINT8 *) mCpu0IstTable);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Completes processor power management initialization
+ (1) Initializes the TSC update variables.
+ (2) Initializes the GV state for processors.
+ (3) Adds a callback (SMI) in S3 resume script to restore the MSR
+ (4) Registers callback (SMI) for late PPM Initialization
+**/
+VOID
+PpmPostInit (
+ VOID
+ )
+{
+ UINT8 Data8;
+
+ ///
+ /// Set Boot P-state based on Policy.
+ ///
+ SetBootPState ();
+ ///
+ /// Save the SW SMI number to trigger SMI to restore the MSRs when resuming from S3
+ ///
+ Data8 = mCpuPmConfig->S3RestoreMsrSwSmiNumber;
+ SCRIPT_IO_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint8,
+ (UINTN) (R_PCH_APM_CNT),
+ 1,
+ &Data8
+ );
+ ///
+ /// Lock down all settings
+ ///
+ PpmLockDown (mCpuPmConfig);
+} \ No newline at end of file
diff --git a/ReferenceCode/Haswell/PowerManagement/Dxe/PowerLimits.c b/ReferenceCode/Haswell/PowerManagement/Dxe/PowerLimits.c
new file mode 100644
index 0000000..9c0c19e
--- /dev/null
+++ b/ReferenceCode/Haswell/PowerManagement/Dxe/PowerLimits.c
@@ -0,0 +1,1302 @@
+/** @file
+ This file contains power management configuration functions for
+ Haswell processors.
+
+ Acronyms:
+ PPM - Processor Power Management
+ TM - Thermal Monitor
+ IST - Intel(R) Speedstep technology
+ HT - Hyper-Threading Technology
+
+@copyright
+ Copyright (c) 2012 - 2014 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "PowerMgmtCommon.h"
+
+PPM_CTDP_OVERRIDE_TABLE mHswUltPpmCtdpOverideTable[]={
+/// TDP Icc MSR PL1 MSR PL2 TdpUp TdpUp TdpNominal TdpNominal TdpDown TdpDown
+/// Max PL1 PL2 PL1 PL2 PL1 PL2
+ { 5700, 0, 6700, 8375, 0, 8375, 0, 8375, 0, 8375 }, /// 57W Sku Overrides
+ { 1500, 0, 2500, 2500, 0, 2500, 0, 2500, 0, 2500 }, /// 15W Sku Overrides
+ { 1150, 0, 0, 2500, 0, 2500, 0, 2500, 0, 2500 }, /// 11.5W Sku Overrides
+ { 2800, 40, 0, 3500, 0, 3500, 0, 3500, 0, 3500 } /// 28W 40A Sku Overrides
+};
+
+PPM_CTRL_TDP_SKU_TBL mHswCtrlTdpSkuTable[] = {
+ {"Celeron",03,{"2955U","2957U","2005U"}}
+};
+
+/**
+ Configurable TDP BIOS Initialization
+
+ @param[in] CpuPmConfig Pointer to policy protocol instance
+ @param[in] FvidPointer Pointer to Fvid Table
+
+ @exception EFI_UNSUPPORTED Ctdp not Supported
+ @retval EFI_SUCCESS Ctdp Initiation done
+**/
+EFI_STATUS
+InitializeConfigurableTdp (
+ IN OUT POWER_MGMT_CONFIG *CpuPmConfig
+ )
+{
+ EFI_STATUS Status;
+ EFI_STATUS CustomCtdpSettings;
+ UINTN Index;
+
+
+ if (mPpmGlobalNvsAreaProtocol == NULL) {
+ DEBUG ((EFI_D_INFO, "PPM:: ConfigTDP Require mPpmGlobalNvsAreaProtocol.\n"));
+ return EFI_UNSUPPORTED;
+ }
+ ///
+ /// Intialize PPM Global NVS with custom CTDP level settings or CPU provided.
+ ///
+ CustomCtdpSettings = InitCustomConfigurableTdp (CpuPmConfig);
+ if (CustomCtdpSettings != EFI_SUCCESS) {
+ Status = InitConfigurableTdpSettings (CpuPmConfig);
+ if (Status != EFI_SUCCESS) {
+ ///
+ /// Check for Controllable TDP enable if Ctdp not supported
+ ///
+ InitControllableTdp(CpuPmConfig);
+ return EFI_UNSUPPORTED;
+ }
+ }
+ ///
+ /// In case of LFM == TDP Down Ratio/Tdp Nominal , consider TDP Down TAR as the new LFM to insert fake P state.
+ ///
+ for (Index = 0; Index < (mPpmGlobalNvsAreaProtocol->Area->CtdpLevelsSupported); Index++) {
+ if (mMinBusRatio == mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[Index].CtdpTar+1) {
+ mMinBusRatio = mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[Index].CtdpTar;
+ DEBUG ((EFI_D_INFO, "PPM:: mMinBusRatio Modified for Ctdp %d\n", mMinBusRatio));
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Custom Configurable TDP Table BIOS Initialization
+
+ @param[in] CpuPmConfig Pointer to policy protocol instance
+
+ @exception EFI_UNSUPPORTED Custom Ctdp settings are not available
+ @retval EFI_SUCCESS Successfully Initialized Custom Ctdp Settings
+**/
+EFI_STATUS
+InitCustomConfigurableTdp (
+ IN OUT POWER_MGMT_CONFIG *CpuPmConfig
+ )
+{
+ UINT8 Index;
+
+ if (!CpuPmConfig->pCustomCtdpSettings->ConfigTdpCustom) {
+ return EFI_UNSUPPORTED;
+ }
+ ///
+ /// CTC value should not be more Custom configured levels.
+ ///
+ if (CpuPmConfig->pCustomCtdpSettings->CustomBootModeIndex > CpuPmConfig->pCustomCtdpSettings->CustomTdpCount - 1) {
+ CpuPmConfig->pCustomCtdpSettings->CustomBootModeIndex = 0;
+ }
+ if (mPpmGlobalNvsAreaProtocol != NULL) {
+ ///
+ /// Update Custom ConfigTdp table for ACPI
+ ///
+ if (CpuPmConfig->pCustomCtdpSettings->CustomTdpCount != 0) {
+ mPpmGlobalNvsAreaProtocol->Area->CustomConfigTdp = PPM_ENABLE;
+ mPpmGlobalNvsAreaProtocol->Area->CtdpLevelsSupported = CpuPmConfig->pCustomCtdpSettings->CustomTdpCount;
+ mPpmGlobalNvsAreaProtocol->Area->ConfigTdpBootModeIndex = CpuPmConfig->pCustomCtdpSettings->CustomBootModeIndex;
+ for (Index = 0; Index < (CpuPmConfig->pCustomCtdpSettings->CustomTdpCount); Index++) {
+ ///
+ /// Verify and fix Custom configured CTDP Levels PL1 and PL2
+ ///
+ CpuPmConfig->pCustomCtdpSettings->CustomConfigTdpTable[Index].CustomPowerLimit1 = VerifyAndFixCustomPowerLimit (CpuPmConfig->pCustomCtdpSettings->CustomConfigTdpTable[Index].CustomPowerLimit1,mCustomPowerUnit);
+ CpuPmConfig->pCustomCtdpSettings->CustomConfigTdpTable[Index].CustomPowerLimit2 = VerifyAndFixCustomPowerLimit (CpuPmConfig->pCustomCtdpSettings->CustomConfigTdpTable[Index].CustomPowerLimit2,mCustomPowerUnit);
+ CpuPmConfig->pCustomCtdpSettings->CustomConfigTdpTable[Index].CustomTurboActivationRatio = VerifyAndFixCustomRatio (CpuPmConfig->pCustomCtdpSettings->CustomConfigTdpTable[Index].CustomTurboActivationRatio+1)-1;
+ mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[Index].CtdpPowerLimit1 = (UINT16) CpuPmConfig->pCustomCtdpSettings->CustomConfigTdpTable[Index].CustomPowerLimit1;
+ mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[Index].CtdpPowerLimit2 = (UINT16) CpuPmConfig->pCustomCtdpSettings->CustomConfigTdpTable[Index].CustomPowerLimit2;
+ mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[Index].CtdpPowerLimitWindow = CpuPmConfig->pCustomCtdpSettings->CustomConfigTdpTable[Index].CustomPowerLimit1Time;
+ mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[Index].CtdpTar = CpuPmConfig->pCustomCtdpSettings->CustomConfigTdpTable[Index].CustomTurboActivationRatio;
+ mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[Index].CtdpCtc = CpuPmConfig->pCustomCtdpSettings->CustomConfigTdpTable[Index].CustomConfigTdpControl;
+ }
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Verify and fix Custom Power Limit values
+
+ @param[in] CustomPowerLimit Custom Power Limit value
+ @param[in] CustomPlUnit Custom Power Limit Unit
+**/
+UINT16
+VerifyAndFixCustomPowerLimit (
+ IN UINT32 CustomPowerLimit,
+ IN UINT16 CustomPlUnit
+ )
+{
+ UINT16 ConvertedPowerLimit;
+ UINT16 CpuConvertedPowerLimitMaxLimit;
+
+ ConvertedPowerLimit = (UINT16) ((CustomPowerLimit * mProcessorPowerUnit) / CustomPlUnit);
+ if (mPackageMaxPower == 0 && ConvertedPowerLimit >= mPackageMinPower) {
+ ///
+ /// If PACKAGE_POWER_SKU_MSR [46:32] = 0 means there is no upper limit ( since this field is 15 bits, the max value is 2^15 - 1 )
+ ///
+ CpuConvertedPowerLimitMaxLimit = (UINT16) (LShiftU64 (2, 15) - 1);
+ if (ConvertedPowerLimit > CpuConvertedPowerLimitMaxLimit) {
+ ///
+ /// If new Power Limit 1 is > CpuConvertedPowerLimit1MaxLimit, program Power Limit 1 to CpuConvertedPowerLimit1MaxLimit
+ ///
+ ConvertedPowerLimit = CpuConvertedPowerLimitMaxLimit;
+ }
+ } else if (mPackageMinPower == 0 && ConvertedPowerLimit > 0 && ConvertedPowerLimit <= mPackageMaxPower) {
+ ///
+ /// If PACKAGE_POWER_SKU_MSR [30:16] = 0 means there is no lower limit
+ ///
+ ConvertedPowerLimit = (UINT16) ((CustomPowerLimit * mProcessorPowerUnit) / CustomPlUnit);
+ } else {
+ ///
+ /// Power Limit 1 needs to be between mPackageMinPower and mPackageMaxPower
+ ///
+ CpuConvertedPowerLimitMaxLimit = mPackageMaxPower;
+ if (ConvertedPowerLimit < mPackageMinPower) {
+ ///
+ /// If new Power Limit 1 is < mPackageMinPower, program Power Limit 1 to mPackageMinPower
+ ///
+ ConvertedPowerLimit = mPackageMinPower;
+ } else if (ConvertedPowerLimit > CpuConvertedPowerLimitMaxLimit) {
+ ///
+ /// If new Power Limit 1 is > mPackageMaxPower, program Power Limit 1 to mPackageMaxPower
+ ///
+ ConvertedPowerLimit = CpuConvertedPowerLimitMaxLimit;
+ }
+ }
+
+ return ConvertedPowerLimit;
+}
+
+/**
+ Verify and fix Custom Ratio values
+ Custom Ratio should be between MaxTurboFrequency and LFM
+
+ @param[in] CustomRatio Custom Ratio value
+**/
+UINT8
+VerifyAndFixCustomRatio (
+ IN UINT8 CustomRatio
+ )
+{
+ if (CustomRatio > mTurboBusRatio) {
+ ///
+ /// Use HFM as max value if Turbo is not supported
+ ///
+ if (mTurboBusRatio == 0) {
+ CustomRatio = (UINT8) mMaxBusRatio;
+ } else {
+ CustomRatio = (UINT8) mTurboBusRatio;
+ }
+ } else if (CustomRatio < mMinBusRatio) {
+ ///
+ /// Use LFM as min value
+ ///
+ CustomRatio = (UINT8) mMinBusRatio;
+ }
+
+ return CustomRatio;
+}
+
+/**
+ CTDP BIOS settings Initialization(From Msrs)
+
+ @param[in] CpuPmConfig Pointer to policy protocol instance
+
+ @exception EFI_UNSUPPORTED Ctdp not supported
+ @retval EFI_SUCCESS Ctdp Settings Initialized successfully from MSRs
+**/
+EFI_STATUS
+InitConfigurableTdpSettings (
+ IN OUT POWER_MGMT_CONFIG *CpuPmConfig
+ )
+{
+ MSR_REGISTER TempMsr;
+ UINTN Index;
+ UINT16 CpuConfigTdpNominalTdp;
+ UINT16 CpuConfigTdpLevel1Tdp;
+ UINT16 CpuConfigTdpLevel2Tdp;
+ UINT8 CpuConfigTdpNominalRatio;
+ UINT8 CpuConfigTdpLevel1Ratio;
+ UINT8 CpuConfigTdpLevel2Ratio;
+ UINT16 CpuConfigTdpLevels;
+
+ ///
+ /// Get the number of configurable TDP Levels supported
+ ///
+ TempMsr.Qword = AsmReadMsr64 (MSR_PLATFORM_INFO);
+ TempMsr.Qword &= V_CONFIG_TDP_NUM_LEVELS_MASK;
+ CpuConfigTdpLevels = (UINT8) RShiftU64 (TempMsr.Qword, N_MSR_PLATFORM_INFO_CONFIG_TDP_NUM_LEVELS_OFFSET);
+ DEBUG ((EFI_D_INFO, "PPM:: ConfigTDP Supported Levels=%d\n", CpuConfigTdpLevels));
+ ///
+ /// Return if ConfigTDP Levels not supported
+ ///
+ if (CpuConfigTdpLevels == 0) {
+ DEBUG ((EFI_D_INFO, "PPM:: ConfigTDP Levels not supported\n"));
+ return EFI_UNSUPPORTED;
+ }
+ mPpmGlobalNvsAreaProtocol->Area->CustomConfigTdp = PPM_DISABLE;
+ mPpmGlobalNvsAreaProtocol->Area->CtdpLevelsSupported = (UINT8) CpuConfigTdpLevels + 1;
+ mPpmGlobalNvsAreaProtocol->Area->ConfigTdpBootModeIndex = CpuPmConfig->pTurboSettings->ConfigTdpLevel;
+ ///
+ /// Get PKG_TDP for Config TDP Nominal
+ ///
+ TempMsr.Qword = AsmReadMsr64 (MSR_CONFIG_TDP_NOMINAL);
+ CpuConfigTdpNominalRatio = (UINT8) (TempMsr.Dwords.Low & CONFIG_TDP_NOMINAL_RATIO_MASK);
+ CpuConfigTdpNominalTdp = mPackageTdp;
+ DEBUG ((EFI_D_INFO, "PPM:: ConfigTDP Nominal Ratio=%d Tdp=%d\n", CpuConfigTdpNominalRatio, CpuConfigTdpNominalTdp));
+ ///
+ /// Set Level0 as Tdp Nominal
+ ///
+ mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[0].CtdpPowerLimit1 = mPackageTdp;
+ mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[0].CtdpPowerLimit2 = GetCtdpPowerLimit2 (mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[0].CtdpPowerLimit1);
+ if (IS_SA_DEVICE_ID_MOBILE(mProcessorFlavor)) {
+ mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[0].CtdpPowerLimitWindow = MB_POWER_LIMIT1_TIME_DEFAULT;
+ } else {
+ mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[0].CtdpPowerLimitWindow = DT_POWER_LIMIT1_TIME_DEFAULT;
+ }
+ mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[0].CtdpTar = (UINT8) (CpuConfigTdpNominalRatio - 1);
+ mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[0].CtdpCtc = CONFIG_TDP_NOMINAL;
+ ///
+ /// Get PKG_TDP and Ratio for Config TDP Level1
+ ///
+ TempMsr.Qword = AsmReadMsr64 (MSR_CONFIG_TDP_LVL1);
+ CpuConfigTdpLevel1Ratio = (UINT8) RShiftU64 (
+ TempMsr.Qword & CONFIG_TDP_LVL1_RATIO_MASK,
+ CONFIG_TDP_LVL1_RATIO_OFFSET
+ );
+ CpuConfigTdpLevel1Tdp = (UINT16) (TempMsr.Dwords.Low & CONFIG_TDP_LVL1_PKG_TDP_MASK);
+ DEBUG ((EFI_D_INFO, "PPM:: ConfigTDP Level1 Ratio=%d Tdp=%d\n", CpuConfigTdpLevel1Ratio, CpuConfigTdpLevel1Tdp));
+ ///
+ /// Set Level 1
+ ///
+ Index = 1;
+ if (CpuConfigTdpLevel1Ratio != 0) {
+ mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[Index].CtdpPowerLimit1 = CpuConfigTdpLevel1Tdp;
+ mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[Index].CtdpPowerLimit2 = GetCtdpPowerLimit2 (mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[Index].CtdpPowerLimit1);
+ mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[Index].CtdpPowerLimitWindow = mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[0].CtdpPowerLimitWindow;
+ mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[Index].CtdpTar = (UINT8) (CpuConfigTdpLevel1Ratio - 1);
+ mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[Index].CtdpCtc = CONFIG_TDP_LEVEL1;
+ Index++;
+ }
+ ///
+ /// If two levels are supported or Level1 was not valid
+ /// then read Level2 registers
+ ///
+ if (CpuConfigTdpLevels == CONFIG_TDP_LEVEL2 || CpuConfigTdpLevel1Ratio == 0) {
+ ///
+ /// Get PKG_TDP and Ratio for Config TDP Level2
+ ///
+ TempMsr.Qword = AsmReadMsr64 (MSR_CONFIG_TDP_LVL2);
+ CpuConfigTdpLevel2Ratio = (UINT8) RShiftU64 (
+ TempMsr.Qword & CONFIG_TDP_LVL2_RATIO_MASK,
+ CONFIG_TDP_LVL2_RATIO_OFFSET
+ );
+ CpuConfigTdpLevel2Tdp = (UINT16) (TempMsr.Dwords.Low & CONFIG_TDP_LVL2_PKG_TDP_MASK);
+ DEBUG ((EFI_D_INFO, "PPM:: ConfigTDP Level2 Ratio=%d Tdp=%d\n", CpuConfigTdpLevel2Ratio, CpuConfigTdpLevel2Tdp));
+ ///
+ /// Set Level2
+ ///
+ mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[Index].CtdpPowerLimit1 = CpuConfigTdpLevel2Tdp;
+ mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[Index].CtdpPowerLimit2 = GetCtdpPowerLimit2 (mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[Index].CtdpPowerLimit1);
+ mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[Index].CtdpPowerLimitWindow = mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[0].CtdpPowerLimitWindow;
+ mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[Index].CtdpTar = (UINT8) (CpuConfigTdpLevel2Ratio - 1);
+ mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[Index].CtdpCtc = CONFIG_TDP_LEVEL2;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Get Power Limit2 based on Power Limit1 on Config TDP
+
+ @param[in] PowerLimit1 Power Limit 1 Value
+
+ @retval Calculated Power Limit2 value
+**/
+UINT16
+GetCtdpPowerLimit2 (
+ IN UINT16 PowerLimit1
+ )
+{
+ UINT16 ConvertedPowerLimit2;
+ UINT16 Mutliplier;
+
+ ///
+ /// By default,for Mobile & Desktop Processors: Short duration Power Limit = 1.25 * Package TDP
+ ///
+ Mutliplier = 125;
+ ///
+ /// For XE/non-ULV skus Configure PL2 as (1.25 x cTDP).
+ ///
+ ConvertedPowerLimit2 = EFI_IDIV_ROUND ((Mutliplier * PowerLimit1), 100);
+
+ return ConvertedPowerLimit2;
+}
+
+/**
+ Patch Fvid Table with Ctdp Tar ratio and Tar-1 Ratio
+
+ @param[in] FvidPointer Pointer to Fvid Table
+**/
+VOID
+CtdpPatchFvidTable (
+ IN OUT FVID_TABLE *FvidPointer
+ )
+{
+ UINTN PssIndex;
+ UINTN Index;
+ UINTN TempRatio;
+ UINT8 Turbo;
+
+ ///
+ /// Check P0 is Turbo Ratio or HFM
+ ///
+ Turbo = ((mPpmGlobalNvsAreaProtocol->Area->PpmFlags & PPM_TURBO) ? 1 : 0);
+
+ ///
+ /// Check and patch Fvid table for TAR ratios
+ ///
+ for (Index = 0; Index < mPpmGlobalNvsAreaProtocol->Area->CtdpLevelsSupported; Index++) {
+ TempRatio = mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[Index].CtdpTar;
+ for (PssIndex = (Turbo + 2); PssIndex < FvidPointer[0].FvidHeader.Gv3States; PssIndex++) {
+ if (FvidPointer[PssIndex].FvidState.BusRatio < TempRatio) {
+ if (FvidPointer[PssIndex - 1].FvidState.BusRatio != TempRatio) {
+ ///
+ /// If Tar not Found ,Replace Turbo Active ratio at PssIndex-1
+ /// P0 - Turbo ratio P1- HFM ,exclude these two ratios
+ ///
+ if (PssIndex == (Turbo + 2)) {
+ CtdpReplaceFvidRatio (FvidPointer, PssIndex, TempRatio);
+ DEBUG ((EFI_D_INFO, " TAR Ratio Replace at %x with %x \n", PssIndex, TempRatio));
+ } else {
+ CtdpReplaceFvidRatio (FvidPointer, PssIndex - 1, TempRatio);
+ DEBUG ((EFI_D_INFO, " TAR Ratio Replace at %x with %x \n", PssIndex-1, TempRatio));
+
+ }
+ }
+ break;
+ }
+ }
+ }
+ ///
+ /// Check and patch Fvid table for CTDP ratios.
+ /// This is done separately to make sure Ctdp ratios are not override by Tar ratios
+ /// when ctdp ratios are adjacent
+ ///
+ for (Index = 0; Index < mPpmGlobalNvsAreaProtocol->Area->CtdpLevelsSupported; Index++) {
+ TempRatio = mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[Index].CtdpTar + 1;
+ for (PssIndex = (Turbo + 1); PssIndex < FvidPointer[0].FvidHeader.Gv3States; PssIndex++) {
+
+ if (FvidPointer[PssIndex].FvidState.BusRatio == TempRatio) {
+ mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[Index].CtdpPpc = (UINT8) FvidPointer[PssIndex].FvidState.State;
+ }
+
+ if (FvidPointer[PssIndex].FvidState.BusRatio < TempRatio) {
+ if (FvidPointer[PssIndex - 1].FvidState.BusRatio == TempRatio) {
+ ///
+ /// Found Turbo Active ratio at PssIndex-1
+ ///
+ mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[Index].CtdpPpc = (UINT8) FvidPointer[PssIndex - 1].FvidState.State;
+ break;
+ } else {
+ ///
+ /// If Tar not Found, Replace Turbo Active ratio at PssIndex-1
+ ///
+ if(PssIndex == (Turbo + 1)) {
+ CtdpReplaceFvidRatio (FvidPointer, PssIndex, TempRatio);
+ mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[Index].CtdpPpc = (UINT8) FvidPointer[PssIndex].FvidState.State;
+ DEBUG ((EFI_D_INFO, " CTDP Ratio Replace at %x with %x \n", PssIndex, TempRatio));
+ } else {
+ CtdpReplaceFvidRatio (FvidPointer, PssIndex - 1, TempRatio);
+ mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[Index].CtdpPpc = (UINT8) FvidPointer[PssIndex - 1].FvidState.State;
+ DEBUG ((EFI_D_INFO, " CTDP Ratio Replace at %x with %x \n", PssIndex-1, TempRatio));
+
+ }
+ break;
+ }
+ }
+ }
+ }
+}
+
+/**
+ Replace P state with given ratio
+
+ @param[in] FvidPointer Pointer to Fvid Table
+ @param[in] PssIndex FVID table index of P state to be replaced
+ @param[in] Ratio Target Ratio to put in
+**/
+VOID
+CtdpReplaceFvidRatio (
+ IN OUT FVID_TABLE *FvidPointer,
+ UINTN PssIndex,
+ UINTN Ratio
+ )
+{
+ UINT64 wPower1;
+ UINT64 wPower2;
+
+ FvidPointer[PssIndex].FvidState.BusRatio = (UINT16) Ratio; ///< Replace Ratio
+ ///
+ /// Relative Power calculation per HSW BWG
+ ///
+ wPower1 = (mMaxBusRatio - FvidPointer[PssIndex].FvidState.BusRatio) * 625;
+ wPower1 = (110000 - wPower1);
+ wPower1 = DivU64x32 (wPower1, 11);
+ wPower1 = MultU64x64 (wPower1, wPower1);
+ //
+ // Power is calculated in milliwatts
+ //
+ wPower2 = (((FvidPointer[PssIndex].FvidState.BusRatio * 100) / mMaxBusRatio));
+ wPower2 = DivU64x32 (MultU64x32 (MultU64x64 (wPower2, wPower1), mPackageTdpWatt), 10000000);
+ FvidPointer[PssIndex].FvidState.Power = (UINT32) wPower2;
+}
+
+/**
+ Configures following fields of MSR 0x610 based on user configuration:
+ Configures Long duration Turbo Mode (power limit 1) power level and time window
+ Configures Short duration turbo mode (power limit 2)
+
+ @param[in] CpuPmConfig Pointer to policy protocol instance
+**/
+VOID
+ConfigurePowerLimitsNonConfigTdpSkus (
+ IN OUT POWER_MGMT_CONFIG *CpuPmConfig
+ )
+{
+ MSR_REGISTER PakagePowerLimitMsr;
+ UINT16 ConvertedPowerLimit1;
+ UINT8 ConvertedPowerLimit1Time;
+ UINT16 ConvertedShortDurationPowerLimit;
+ UINT16 CpuConvertedPowerLimit1MaxLimit;
+ UINT16 CpuConvertedPowerLimit2MaxLimit;
+ UINT16 Multiplier;
+
+ CpuConvertedPowerLimit1MaxLimit = 0;
+ CpuConvertedPowerLimit2MaxLimit = 0;
+ ConvertedPowerLimit1Time = 0;
+ ///
+ /// By default, for Mobile & Desktop Processors: Short duration Power Limit = 1.25 * Package TDP
+ ///
+ Multiplier = 125;
+ ///
+ /// Check if TDP limits are programmable
+ /// - Platform Info MSR (0xCE) [29]
+ ///
+ if (mTdpLimitProgrammble) {
+ PakagePowerLimitMsr.Qword = AsmReadMsr64 (MSR_PACKAGE_POWER_LIMIT);
+ ///
+ /// Initialize the Power Limit 1 and Power Limit 1 enable bit
+ /// - Power Limit 1: Turbo Power Limit MSR [14:0]
+ /// - Power Limit 1 Enable: Turbo Power Limit MSR [15]
+ ///
+ ///
+ /// By default, program Power Limit 1 to Package TDP limit
+ ///
+ ConvertedPowerLimit1 = mPackageTdp;
+ if (CpuPmConfig->pTurboSettings->PowerLimit1 != AUTO) {
+ ///
+ /// CpuPmConfig->pTurboSettings->PowerLimit1 is in mW or watts. We need to convert it to
+ /// CPU Power unit, specified in PACKAGE_POWER_SKU_UNIT_MSR[3:0].
+ /// Since we are converting from Watts to CPU power units, multiply by
+ /// PACKAGE_POWER_SKU_UNIT_MSR[3:0].
+ /// Refer to BWG 14.13.7 for Power Limit 1 limits.
+ ///
+ ConvertedPowerLimit1 = (UINT16) ((CpuPmConfig->pTurboSettings->PowerLimit1 * mProcessorPowerUnit) / mCustomPowerUnit);
+ if (mPackageMaxPower == 0 && ConvertedPowerLimit1 >= mPackageMinPower) {
+ ///
+ /// If PACKAGE_POWER_SKU_MSR [46:32] = 0 means there is no upper limit ( since this field is 15 bits, the max value is 2^15 - 1 )
+ ///
+ CpuConvertedPowerLimit1MaxLimit = (UINT16) (LShiftU64 (2, 15) - 1);
+ if (ConvertedPowerLimit1 > CpuConvertedPowerLimit1MaxLimit) {
+ ///
+ /// If new Power Limit 1 is > CpuConvertedPowerLimit1MaxLimit, program Power Limit 1 to CpuConvertedPowerLimit1MaxLimit
+ ///
+ ConvertedPowerLimit1 = CpuConvertedPowerLimit1MaxLimit;
+ }
+ } else if (mPackageMinPower == 0 && ConvertedPowerLimit1 > 0 && ConvertedPowerLimit1 <= mPackageMaxPower) {
+ ///
+ /// If PACKAGE_POWER_SKU_MSR [30:16] = 0 means there is no lower limit
+ ///
+ ConvertedPowerLimit1 = (UINT16) ((CpuPmConfig->pTurboSettings->PowerLimit1 * mProcessorPowerUnit) / mCustomPowerUnit);
+
+ } else {
+ ///
+ /// Power Limit 1 needs to be between mPackageMinPower and mPackageMaxPower
+ ///
+ CpuConvertedPowerLimit1MaxLimit = mPackageMaxPower;
+
+ if (ConvertedPowerLimit1 < mPackageMinPower) {
+ ///
+ /// If new Power Limit 1 is < mPackageMinPower, program Power Limit 1 to mPackageMinPower
+ ///
+ ConvertedPowerLimit1 = mPackageMinPower;
+ } else if (ConvertedPowerLimit1 > CpuConvertedPowerLimit1MaxLimit) {
+ ///
+ /// If new Power Limit 1 is > mPackageMaxPower, program Power Limit 1 to mPackageMaxPower
+ ///
+ ConvertedPowerLimit1 = CpuConvertedPowerLimit1MaxLimit;
+ }
+ }
+ }
+ PakagePowerLimitMsr.Dwords.Low &= ~POWER_LIMIT_MASK;
+ PakagePowerLimitMsr.Dwords.Low |= (UINT32) (ConvertedPowerLimit1);
+ DEBUG (
+ (EFI_D_INFO,
+ "New Power Limit 1 %d watt (%d in CPU power unit)\n",
+ CpuPmConfig->pTurboSettings->PowerLimit1,
+ ConvertedPowerLimit1)
+ );
+ ///
+ /// Force Power Limit 1 override to be enabled
+ ///
+ PakagePowerLimitMsr.Dwords.Low |= B_POWER_LIMIT_ENABLE;
+ ///
+ /// Program Power Limit 1 (Long Duration Turbo) Time Window
+ /// If PowerLimit1Time is AUTO OR If PowerLimit1Time is > MAX_POWER_LIMIT_1_TIME_IN_SECONDS
+ /// program default values
+ ///
+ if ((CpuPmConfig->pTurboSettings->PowerLimit1Time == AUTO) ||
+ (CpuPmConfig->pTurboSettings->PowerLimit1Time > MAX_POWER_LIMIT_1_TIME_IN_SECONDS)
+ ) {
+ if (IS_SA_DEVICE_ID_MOBILE(mProcessorFlavor)) {
+ ///
+ /// For Mobile, default value is 28 seconds
+ ///
+ CpuPmConfig->pTurboSettings->PowerLimit1Time = MB_POWER_LIMIT1_TIME_DEFAULT;
+ } else {
+ ///
+ /// For Desktop, default value is 1 second
+ ///
+ CpuPmConfig->pTurboSettings->PowerLimit1Time = DT_POWER_LIMIT1_TIME_DEFAULT;
+ }
+ }
+ ConvertedPowerLimit1Time = GetConvertedTime (CpuPmConfig->pTurboSettings->PowerLimit1Time, PL12TimeWindowCovert);
+ ///
+ /// Configure Power Limit 1 (Long Duration Turbo) time windows: Turbo Power Limit MSR [23:17]
+ ///
+ PakagePowerLimitMsr.Dwords.Low &= ~POWER_LIMIT_1_TIME_MASK;
+ PakagePowerLimitMsr.Dwords.Low |= (UINT32) LShiftU64 (ConvertedPowerLimit1Time, 17);
+ ///
+ /// Initialize Short Duration Power limit and enable bit
+ /// Short duration Power Limit: Turbo Power Limit MSR (0x450h) [46:32]
+ /// Short duration Power Limit Enable:Turbo Power Limit MSR (0x450h) [47]
+ ///
+ /// CpuPmConfig->pTurboSettings->PowerLimit2 value is in mW or watts. We need to convert it to
+ /// CPU Power unit, specified in PACKAGE_POWER_SKU_UNIT_MSR[3:0].
+ /// Since we are converting from Watts to CPU power units, multiply by
+ /// PACKAGE_POWER_SKU_UNIT_MSR[3:0]
+ ///
+ ConvertedShortDurationPowerLimit = (UINT16) ((CpuPmConfig->pTurboSettings->PowerLimit2 * mProcessorPowerUnit) / mCustomPowerUnit);
+ PakagePowerLimitMsr.Dwords.High &= ~(POWER_LIMIT_MASK | B_POWER_LIMIT_ENABLE);
+ ///
+ /// If PowerLimit2 is AUTO OR if PowerLimit2 is > mPackageMaxPower OR if PowerLimit2 < mPackageMinPower
+ /// program defaul values.
+ ///
+ CpuConvertedPowerLimit2MaxLimit = mPackageMaxPower;
+ if (CpuConvertedPowerLimit2MaxLimit == 0) {
+ CpuConvertedPowerLimit2MaxLimit = (UINT16) (LShiftU64 (2, 15) - 1);
+ }
+ if (CpuPmConfig->pTurboSettings->PowerLimit2 == AUTO) {
+ ConvertedShortDurationPowerLimit = EFI_IDIV_ROUND ((Multiplier * mPackageTdp), 100);
+
+ }
+ if (ConvertedShortDurationPowerLimit > CpuConvertedPowerLimit2MaxLimit) {
+ ConvertedShortDurationPowerLimit = CpuConvertedPowerLimit2MaxLimit;
+ }
+ if (ConvertedShortDurationPowerLimit < mPackageMinPower) {
+ ConvertedShortDurationPowerLimit = mPackageMinPower;
+ }
+ PakagePowerLimitMsr.Dwords.High |= (UINT32) (ConvertedShortDurationPowerLimit);
+
+ if (CpuPmConfig->pFunctionEnables->PowerLimit2 == PPM_ENABLE) {
+ PakagePowerLimitMsr.Dwords.High |= B_POWER_LIMIT_ENABLE;
+ } else {
+ PakagePowerLimitMsr.Dwords.High &= (~B_POWER_LIMIT_ENABLE);
+ }
+
+ DEBUG (
+ (EFI_D_INFO,
+ "Short duration Power limit enabled, Power Limit = %d Watts\n",
+ CpuPmConfig->pTurboSettings->PowerLimit2)
+ );
+
+ DEBUG ((EFI_D_INFO,"MSR(610h)=%08X%08X\n",PakagePowerLimitMsr.Dwords.High,PakagePowerLimitMsr.Dwords.Low));
+
+ AsmWriteMsr64 (MSR_PACKAGE_POWER_LIMIT, PakagePowerLimitMsr.Qword);
+ }
+
+ ///
+ /// Enable Power Clamp when Controllable TDP is enabled.
+ ///
+ if (mControllableTdpEnable) {
+ PakagePowerLimitMsr.Qword = AsmReadMsr64 (MSR_PACKAGE_POWER_LIMIT);
+ PakagePowerLimitMsr.Dwords.Low |= B_CRITICAL_POWER_CLAMP_ENABLE;
+ DEBUG ((EFI_D_INFO, "Critical Power Clamp1 enabled : %x\n",PakagePowerLimitMsr.Qword));
+ AsmWriteMsr64 (MSR_PACKAGE_POWER_LIMIT, PakagePowerLimitMsr.Qword);
+ }
+
+ ///
+ ///BIOS to override 41W PL1 for 47W 2C parts (Cahce Size = 3MB)
+ ///
+ if((CpuPmConfig->pTurboSettings->PowerLimit1 == AUTO) && (mPackageTdp == 47) && (mCpuCacheSize == 3 * 1024)) {
+ PakagePowerLimitMsr.Qword = AsmReadMsr64 (MSR_PACKAGE_POWER_LIMIT);
+ PakagePowerLimitMsr.Dwords.Low &= ~POWER_LIMIT_MASK;
+ PakagePowerLimitMsr.Dwords.Low |= (UINT32) ((41 * mProcessorPowerUnit) & POWER_LIMIT_MASK);
+ AsmWriteMsr64 (MSR_PACKAGE_POWER_LIMIT, PakagePowerLimitMsr.Qword);
+ }
+ ///
+ /// PL1 and PL2 BIOS Overrides for 57W Non CTDP SKU
+ ///
+ if((CpuPmConfig->pTurboSettings->PowerLimit1 == AUTO) &&
+ (CpuPmConfig->pTurboSettings->PowerLimit2 == AUTO) &&
+ (mPackageTdp == 57 * mProcessorPowerUnit)) {
+ PakagePowerLimitMsr.Qword = AsmReadMsr64 (MSR_PACKAGE_POWER_LIMIT);
+ ///
+ /// PL1=67W
+ ///
+ PakagePowerLimitMsr.Dwords.Low &= ~POWER_LIMIT_MASK;
+ PakagePowerLimitMsr.Dwords.Low |= (UINT32) ((67 * mProcessorPowerUnit) & POWER_LIMIT_MASK);
+ ///
+ /// PL2=83.75W
+ ///
+ PakagePowerLimitMsr.Dwords.High &= ~POWER_LIMIT_MASK;
+ PakagePowerLimitMsr.Dwords.High |= (UINT32) (((8375 * mProcessorPowerUnit) / 100) & POWER_LIMIT_MASK);
+
+ AsmWriteMsr64 (MSR_PACKAGE_POWER_LIMIT, PakagePowerLimitMsr.Qword);
+ }
+ //
+ // End if ((PlatformInfoMsr.Dwords.Low & B_EFI_PLATFORM_INFO_TDC_TDP_LIMIT))
+ //
+ ///
+ /// Pass the power limits of the non-CTDP part to the Global NVS Area for use by DPTF
+ ///
+ PakagePowerLimitMsr.Qword = AsmReadMsr64 (MSR_PACKAGE_POWER_LIMIT);
+ mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[0].CtdpPowerLimit1 = (UINT16) (PakagePowerLimitMsr.Dwords.Low & POWER_LIMIT_MASK);
+ mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[0].CtdpPowerLimit2 = (UINT16) (PakagePowerLimitMsr.Dwords.High & POWER_LIMIT_MASK);
+ mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[0].CtdpPowerLimitWindow = (UINT8) CpuPmConfig->pTurboSettings->PowerLimit1Time;
+ mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[0].CtdpTar = (UINT8) mTurboBusRatio;
+ mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[0].CtdpCtc = 1;
+ mPpmGlobalNvsAreaProtocol->Area->CtdpLevelsSupported = 1;
+ mPpmGlobalNvsAreaProtocol->Area->ConfigTdpBootModeIndex = 0;
+}
+
+/**
+ Configures following fields of MSR 0x615
+ Configures power limit 3 power level and time window
+
+ @param[in] CpuPmConfig Pointer to policy protocol instance
+**/
+VOID
+ConfigurePL3PowerLimits (
+ IN OUT POWER_MGMT_CONFIG *CpuPmConfig
+ )
+{
+ MSR_REGISTER PlatformPowerLimitMsr;
+ UINT16 ConvertedPowerLimit3;
+ UINT8 ConvertedPowerLimit3Time;
+ CPU_STEPPING CpuSteppingId;
+ CPU_FAMILY CpuFamilyId;
+
+ CpuFamilyId = mPpmGlobalNvsAreaProtocol->Area->Cpuid & CPUID_FULL_FAMILY_MODEL;
+ CpuSteppingId = mPpmGlobalNvsAreaProtocol->Area->Cpuid & CPUID_FULL_STEPPING;
+
+ ///
+ /// PL3 is supported on HSW ULT C0 & HSW C0 and later
+ ///
+ if(((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId >= EnumHswC0))
+ || ((CpuFamilyId == EnumCpuHswUlt) && (CpuSteppingId >= EnumHswUltC0))) {
+ ///
+ /// Return if No user overrides selected.
+ ///
+ if((CpuPmConfig->pTurboSettings->PowerLimit3 == AUTO)
+ && (CpuPmConfig->pTurboSettings->PowerLimit3Time == AUTO)
+ && (CpuPmConfig->pTurboSettings->PowerLimit3DutyCycle == AUTO)){
+ return;
+ }
+
+ PlatformPowerLimitMsr.Qword = AsmReadMsr64 (MSR_PLATFORM_POWER_LIMIT);
+ DEBUG ((EFI_D_INFO," PL3 MSR 615 Before Writing %x ",PlatformPowerLimitMsr.Dwords.Low));
+ ///
+ /// Configure PL3 Power Limit if custom value is avaiable
+ ///
+ if (CpuPmConfig->pTurboSettings->PowerLimit3 != AUTO) {
+ ConvertedPowerLimit3 = (UINT16) ((CpuPmConfig->pTurboSettings->PowerLimit3 * mProcessorPowerUnit) / mCustomPowerUnit);
+ PlatformPowerLimitMsr.Dwords.Low &= ~POWER_LIMIT_MASK;
+ PlatformPowerLimitMsr.Dwords.Low |= (UINT32) (ConvertedPowerLimit3);
+ PlatformPowerLimitMsr.Dwords.Low |= B_POWER_LIMIT_ENABLE;
+ }
+
+ ///
+ /// Configure PL3 Time window if custom value is avaiable
+ ///
+ if (CpuPmConfig->pTurboSettings->PowerLimit3Time != AUTO) {
+ ConvertedPowerLimit3Time = GetConvertedTime (CpuPmConfig->pTurboSettings->PowerLimit3Time, PL3TimeWindowConvert);
+ PlatformPowerLimitMsr.Dwords.Low &= ~POWER_LIMIT_3_TIME_MASK;
+ PlatformPowerLimitMsr.Dwords.Low |= (UINT32) LShiftU64 (ConvertedPowerLimit3Time, 17);
+ PlatformPowerLimitMsr.Dwords.Low |= B_POWER_LIMIT_ENABLE;
+ }
+
+ ///
+ /// Configure PL3 Duty Cycle if custom value is avaiable
+ ///
+ if (CpuPmConfig->pTurboSettings->PowerLimit3DutyCycle != AUTO) {
+ PlatformPowerLimitMsr.Dwords.Low &= ~POWER_LIMIT_3_DUTY_CYCLE_MASK;
+ PlatformPowerLimitMsr.Dwords.Low |= (UINT32) LShiftU64 (CpuPmConfig->pTurboSettings->PowerLimit3DutyCycle, 24);
+ PlatformPowerLimitMsr.Dwords.Low |= B_POWER_LIMIT_ENABLE;
+ }
+ //
+ // Enable/Disable PL3 lock
+ //
+ if (CpuPmConfig->pTurboSettings->PowerLimit3Lock == PPM_ENABLE) {
+ PlatformPowerLimitMsr.Dwords.Low |= (UINT32) B_POWER_LIMIT_LOCK;
+ }else {
+ PlatformPowerLimitMsr.Dwords.Low &= (~((UINT32) B_POWER_LIMIT_LOCK));
+ }
+
+ AsmWriteMsr64 (MSR_PLATFORM_POWER_LIMIT, PlatformPowerLimitMsr.Qword);
+ DEBUG ((EFI_D_INFO," PL3 MSR 615 After Writing %x ",PlatformPowerLimitMsr.Dwords.Low));
+ } // End if Processor Check
+}
+
+/**
+ Configures following fields of MSR 0x610
+ Configures Long duration Turbo Mode (power limit 1) power level and time window
+ Configures Short duration turbo mode (power limit 2)
+
+ @param[in] CpuPmConfig Pointer to policy protocol instance
+**/
+VOID
+ConfigureCtdpPowerLimits (
+ IN OUT POWER_MGMT_CONFIG *CpuPmConfig
+ )
+{
+ MSR_REGISTER PakagePowerLimitMsr;
+ UINT16 ConvertedPowerLimit1;
+ UINT16 ConvertedPowerLimit2;
+ UINT8 ConvertedPowerLimit1Time;
+ UINT16 Mutliplier;
+ UINTN Index;
+ CPU_FAMILY mCpuFamilyId;
+
+ mCpuFamilyId = mPpmGlobalNvsAreaProtocol->Area->Cpuid & CPUID_FULL_FAMILY_MODEL;
+ ConvertedPowerLimit1Time = 0;
+ ///
+ /// By default, for Mobile & Desktop Processors: Short duration Power Limit = 1.25 * Package TDP
+ ///
+ Mutliplier = 125;
+ //
+ // For ConfigTdp enabled skus
+ //
+ PakagePowerLimitMsr.Qword = AsmReadMsr64 (MSR_PACKAGE_POWER_LIMIT);
+ PakagePowerLimitMsr.Dwords.Low &= ~POWER_LIMIT_MASK;
+ PakagePowerLimitMsr.Dwords.High &= ~POWER_LIMIT_MASK;
+ ///
+ /// Initialize the Power Limit 1/2 and Power Limit 2 enable bit in MSR
+ /// Power Limit 1: Turbo Power Limit MSR [14:0] and Power Limit 2: Turbo Power Limit MSR [46:32]
+ /// Set MSR value for Power Limit 1/2 to Max Package Power Value or Maximum Supported Value
+ ///
+ ///
+ if (mPackageMaxPower) {
+ ConvertedPowerLimit1 = mPackageMaxPower;
+ ///
+ /// Short duration Power Limit (PL2) = 1.25 * PL1
+ ///
+ ConvertedPowerLimit2 = EFI_IDIV_ROUND ((Mutliplier * ConvertedPowerLimit1), 100);
+ if (ConvertedPowerLimit2 > PACKAGE_TDP_POWER_MASK) {
+ ConvertedPowerLimit2 = PACKAGE_TDP_POWER_MASK;
+ }
+ } else {
+ ///
+ /// Set Maximum value for Turbo Power Limit MSR [14:0] and [46:32] =
+ /// Max of CTDP Level Power Limts
+ ///
+ ConvertedPowerLimit1 = 0;
+ for (Index = 0; Index < mPpmGlobalNvsAreaProtocol->Area->CtdpLevelsSupported; Index++) {
+ if (ConvertedPowerLimit1 < mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[Index].CtdpPowerLimit1) {
+ ConvertedPowerLimit1 = mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[Index].CtdpPowerLimit1;
+ }
+ }
+ ConvertedPowerLimit2 = 0;
+ for (Index = 0; Index < mPpmGlobalNvsAreaProtocol->Area->CtdpLevelsSupported; Index++) {
+ if (ConvertedPowerLimit2 < mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[Index].CtdpPowerLimit2) {
+ ConvertedPowerLimit2 = mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[Index].CtdpPowerLimit2;
+ }
+ }
+ }
+ ///
+ /// Program Power Limit 1 (Long Duration Turbo) Time Window
+ /// If PowerLimit1Time is AUTO OR If PowerLimit1Time is > MAX_POWER_LIMIT_1_TIME_IN_SECONDS
+ /// program default values
+ ///
+ if (CpuPmConfig->pCustomCtdpSettings->ConfigTdpCustom == PPM_ENABLE) {
+ ConvertedPowerLimit1Time = GetConvertedTime (CpuPmConfig->pCustomCtdpSettings->CustomConfigTdpTable[0].CustomPowerLimit1Time, PL12TimeWindowCovert);
+ } else {
+ if (IS_SA_DEVICE_ID_MOBILE(mProcessorFlavor)) {
+ ///
+ /// For Mobile, default value is 28 seconds
+ ///
+ CpuPmConfig->pTurboSettings->PowerLimit1Time = MB_POWER_LIMIT1_TIME_DEFAULT;
+ } else {
+ ///
+ /// For Desktop, default value is 1 second
+ ///
+ CpuPmConfig->pTurboSettings->PowerLimit1Time = DT_POWER_LIMIT1_TIME_DEFAULT;
+ }
+ ConvertedPowerLimit1Time = GetConvertedTime (CpuPmConfig->pTurboSettings->PowerLimit1Time, PL12TimeWindowCovert);
+ }
+ ///
+ /// Configure Power Limit 1 (Long Duration Turbo) time windows: Turbo Power Limit MSR [23:17]
+ ///
+ PakagePowerLimitMsr.Dwords.Low &= ~POWER_LIMIT_1_TIME_MASK;
+ PakagePowerLimitMsr.Dwords.Low |= (UINT32) LShiftU64 (ConvertedPowerLimit1Time, 17);
+ PakagePowerLimitMsr.Dwords.High |= B_POWER_LIMIT_ENABLE;
+ PakagePowerLimitMsr.Dwords.Low |= (UINT32) (ConvertedPowerLimit1);
+ PakagePowerLimitMsr.Dwords.High |= (UINT32) (ConvertedPowerLimit2);
+ AsmWriteMsr64 (MSR_PACKAGE_POWER_LIMIT, PakagePowerLimitMsr.Qword);
+}
+
+/**
+ Configures BIOS overrides in MSR 0x610
+ Configures Long duration Turbo Mode (power limit 1) power level and time window
+ Configures Short duration turbo mode (power limit 2)
+
+ @param[in] None
+**/
+VOID
+ConfigureCtdpPowerLimitsOverrides (
+ ){
+ UINTN Index;
+ UINTN NoOfOverrides;
+ CPU_FAMILY mCpuFamilyId;
+ UINT32 LibStatus;
+ UINT32 IccMaxValue;
+ EFI_STATUS Status;
+ UINTN PackageTdp;
+ MSR_REGISTER PakagePowerLimitMsr;
+ PPM_CTDP_OVERRIDE_TABLE *PpmCtdpOverideTable;
+
+ mCpuFamilyId = mPpmGlobalNvsAreaProtocol->Area->Cpuid & CPUID_FULL_FAMILY_MODEL;
+
+ if(mCpuFamilyId == EnumCpuHswUlt) {
+ PpmCtdpOverideTable = mHswUltPpmCtdpOverideTable;
+ NoOfOverrides = (sizeof(mHswUltPpmCtdpOverideTable))/(sizeof(PPM_CTDP_OVERRIDE_TABLE));
+ }else {
+ return;
+ }
+
+ PackageTdp = (mPackageTdpWatt * 100);
+ if((mPackageTdp % mProcessorPowerUnit) !=0) {
+ PackageTdp += ((mPackageTdp % mProcessorPowerUnit)* 100) / mProcessorPowerUnit ;
+ }
+
+ for(Index = 0; Index < NoOfOverrides;Index++,PpmCtdpOverideTable++) {
+ if(PpmCtdpOverideTable->SkuPackageTdp == PackageTdp) {
+
+ if(PpmCtdpOverideTable->SkuIccMax) {
+ ///
+ /// If SkuIccMax is not Zero check ICC Max for SKU detection.if No match go to next entry.
+ /// Read Icc Max from BIOS P code Mail box
+ ///
+ Status = MailboxRead(MAILBOX_TYPE_PCODE, READ_ICC_MAX_CMD, &IccMaxValue, &LibStatus);
+ IccMaxValue = IccMaxValue & 0x0FFF;
+ IccMaxValue = IccMaxValue /8;
+ if ((Status == EFI_SUCCESS) && (IccMaxValue != 0) && (IccMaxValue != PpmCtdpOverideTable->SkuIccMax)) {
+ continue;
+ }
+ }
+
+ DEBUG ((EFI_D_INFO, "PPM:: Ctdp BIOS PL1/PL2 Override Ctdp SKU Found :%d override table index :%d\n",PpmCtdpOverideTable->SkuPackageTdp,Index));
+ ///
+ /// MSR Overrides
+ ///
+ PakagePowerLimitMsr.Qword = AsmReadMsr64 (MSR_PACKAGE_POWER_LIMIT);
+ if(PpmCtdpOverideTable->MsrCtdpPowerLimit1) {
+ PakagePowerLimitMsr.Dwords.Low &= ~POWER_LIMIT_MASK;
+ PakagePowerLimitMsr.Dwords.Low |= ((PpmCtdpOverideTable->MsrCtdpPowerLimit1 * mProcessorPowerUnit)/100) & POWER_LIMIT_MASK;
+ }
+ if(PpmCtdpOverideTable->MsrCtdpPowerLimit2) {
+ PakagePowerLimitMsr.Dwords.High &= ~POWER_LIMIT_MASK;
+ PakagePowerLimitMsr.Dwords.High |=((PpmCtdpOverideTable->MsrCtdpPowerLimit2 * mProcessorPowerUnit)/100) & POWER_LIMIT_MASK;
+ }
+ AsmWriteMsr64 (MSR_PACKAGE_POWER_LIMIT, PakagePowerLimitMsr.Qword);
+
+ ///
+ /// MMIO Overrides
+ ///
+ if(PpmCtdpOverideTable->CtdpNominalPowerLimit1) {
+ mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[0].CtdpPowerLimit1 = (UINT16)(PpmCtdpOverideTable->CtdpNominalPowerLimit1 * mProcessorPowerUnit)/100;
+ }
+ if(PpmCtdpOverideTable->CtdpNominalPowerLimit2) {
+ mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[0].CtdpPowerLimit2 = (UINT16)(PpmCtdpOverideTable->CtdpNominalPowerLimit2 * mProcessorPowerUnit)/100;
+ }
+ if(PpmCtdpOverideTable->CtdpDownPowerLimit1) {
+ mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[1].CtdpPowerLimit1 = (UINT16)(PpmCtdpOverideTable->CtdpDownPowerLimit1 * mProcessorPowerUnit)/100;
+ }
+ if(PpmCtdpOverideTable->CtdpDownPowerLimit2) {
+ mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[1].CtdpPowerLimit2 = (UINT16)(PpmCtdpOverideTable->CtdpDownPowerLimit2 * mProcessorPowerUnit)/100;
+ }
+ if(PpmCtdpOverideTable->CtdpDownPowerLimit1) {
+ mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[2].CtdpPowerLimit1 = (UINT16)(PpmCtdpOverideTable->CtdpUpPowerLimit1 * mProcessorPowerUnit)/100;
+ }
+ if(PpmCtdpOverideTable->CtdpUpPowerLimit2) {
+ mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[2].CtdpPowerLimit2 = (UINT16)(PpmCtdpOverideTable->CtdpUpPowerLimit2 * mProcessorPowerUnit)/100;
+ }
+ break;
+ }
+ }
+}
+
+/**
+ Configure cTDP BIOS MSRs to Boot Ctdp values
+ - Configures CONFIG_TDP_CONTROL MSR
+ - Configures TURBO_ACTIVATION_RATIO MSR
+
+ @param[in] CpuPmConfig Pointer to policy protocol instance
+ @param[in] CpuConfigTdpBootLevel ConfigTdpBootLevel policy setting by user
+**/
+VOID
+SelectCtdpLevel (
+ IN POWER_MGMT_CONFIG *CpuPmConfig,
+ IN UINT8 CpuConfigTdpBootLevel
+ )
+{
+ MSR_REGISTER TempMsr;
+
+ ///
+ /// Select cTDP Nominal if Ctdp disabled or boot level not supported.
+ ///
+ if (CpuConfigTdpBootLevel == CONFIG_TDP_DEACTIVATE || CpuConfigTdpBootLevel >= mPpmGlobalNvsAreaProtocol->Area->CtdpLevelsSupported) {
+ CpuConfigTdpBootLevel = 0;
+ }
+
+ mCpuConfigTdpBootRatio = mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[CpuConfigTdpBootLevel].CtdpTar+1;
+ mPpmGlobalNvsAreaProtocol->Area->ConfigurablePpc = mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[CpuConfigTdpBootLevel].CtdpPpc;
+ ///
+ /// Program the selected level 00:nominal,01:level1,10:level2 to
+ /// CONFIG TDP CONTROL MSR.
+ ///
+ TempMsr.Qword = AsmReadMsr64 (MSR_CONFIG_TDP_CONTROL);
+ if ((TempMsr.Qword & CONFIG_TDP_CONTROL_LOCK) == 0) {
+ TempMsr.Dwords.Low = (UINT16) TempMsr.Dwords.Low &~CONFIG_TDP_CONTROL_LVL_MASK;
+ TempMsr.Dwords.Low = (UINT16) TempMsr.Dwords.Low | (CpuConfigTdpBootLevel & CONFIG_TDP_CONTROL_LVL_MASK);
+ if (CpuPmConfig->pTurboSettings->ConfigTdpLock == PPM_ENABLE) {
+ TempMsr.Dwords.Low |= CONFIG_TDP_CONTROL_LOCK;
+ DEBUG ((EFI_D_INFO, "PPM:: ConfigTDP MSR_CONFIG_TDP_CONTROL is locked\n"));
+ }
+ AsmWriteMsr64 (MSR_CONFIG_TDP_CONTROL, TempMsr.Qword);
+ DEBUG ((EFI_D_INFO, "PPM:: ConfigTDP MSR_CONFIG_TDP_CONTROL=%x\n", TempMsr.Qword));
+ } else {
+ DEBUG ((EFI_D_INFO, "PPM:: Could not write MSR_CONFIG_TDP_CONTROL\n"));
+ }
+ ///
+ /// Program the max non-turbo ratio corresponding to default selected level
+ /// in TURBO_ACTIVATION_RATIO MSR.
+ ///
+ TempMsr.Qword = AsmReadMsr64 (MSR_TURBO_ACTIVATION_RATIO);
+ if ((TempMsr.Qword & MSR_TURBO_ACTIVATION_RATIO_LOCK) == 0) {
+ TempMsr.Dwords.Low &= ~MSR_TURBO_ACTIVATION_RATIO_MASK;
+ TempMsr.Dwords.Low |= (UINT16) ((mCpuConfigTdpBootRatio-1) & MSR_TURBO_ACTIVATION_RATIO_MASK);
+ if (CpuPmConfig->pTurboSettings->ConfigTdpLock == PPM_ENABLE ) {
+ TempMsr.Dwords.Low |= MSR_TURBO_ACTIVATION_RATIO_LOCK;
+ DEBUG ((EFI_D_INFO, "PPM:: ConfigTDP MSR_TURBO_ACTIVATION_RATIO is locked\n"));
+ }
+ AsmWriteMsr64 (MSR_TURBO_ACTIVATION_RATIO, TempMsr.Qword);
+ DEBUG ((EFI_D_INFO, "PPM:: ConfigTDP MSR_TURBO_ACTIVATION_RATIO=%x\n", TempMsr.Qword));
+ } else {
+ DEBUG ((EFI_D_INFO, "PPM:: Could not write MSR_TURBO_ACTIVATION_RATIO\n"));
+ }
+}
+
+/**
+ Configures the TURBO_POWER_LIMIT MMIO for Boot ConfigTdp Level
+
+ @param[in] CpuPmConfig Pointer to policy protocol instance
+ @param[in] CpuConfigTdpBootLevel ConfigTdpBootLevel policy setting by user
+**/
+VOID
+SelectCtdpPowerLimits (
+ IN POWER_MGMT_CONFIG *CpuPmConfig,
+ IN UINT8 CpuConfigTdpBootLevel
+ )
+{
+ UINTN PciD0F0RegBase;
+ UINTN MchBar;
+ UINT32 Data32And;
+ UINT32 Data32Or;
+ UINT16 PowerLimit1;
+ UINT16 PowerLimit2;
+ MSR_REGISTER TempMsr;
+
+ ///
+ /// If Ctdp deactivate, Program MSRs to Nominal and MMIO to 0 to enable overclocking
+ ///
+ if (CpuConfigTdpBootLevel == CONFIG_TDP_DEACTIVATE) {
+ PowerLimit1 = mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[0].CtdpPowerLimit1;
+ PowerLimit2 = mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[0].CtdpPowerLimit2;
+ TempMsr.Qword = AsmReadMsr64 (MSR_PACKAGE_POWER_LIMIT);
+ TempMsr.Dwords.Low &= ~POWER_LIMIT_MASK;
+ TempMsr.Dwords.Low |= PowerLimit1;
+ TempMsr.Dwords.High &= ~POWER_LIMIT_MASK;
+ TempMsr.Dwords.High |= PowerLimit2;
+ AsmWriteMsr64 (MSR_PACKAGE_POWER_LIMIT, TempMsr.Qword);
+ return;
+ }
+
+ ///
+ /// Select cTDP Nominal if Ctdp disabled or boot level not supported.
+ ///
+ if (CpuConfigTdpBootLevel >= mPpmGlobalNvsAreaProtocol->Area->CtdpLevelsSupported) {
+ CpuConfigTdpBootLevel = 0;
+ }
+
+ PowerLimit1 = mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[CpuConfigTdpBootLevel].CtdpPowerLimit1;
+ PowerLimit2 = mPpmGlobalNvsAreaProtocol->Area->CtdpLevelSettings[CpuConfigTdpBootLevel].CtdpPowerLimit2;
+ ///
+ /// Get the MCH space base address.
+ /// Program Turbo Power Limit MMIO register MCHBAR+0x59A0 Bits [14:0] and [46:32]
+ /// for ConfigTdp mode PL1 and PL2
+ ///
+ PciD0F0RegBase = MmPciAddress (0, 0, 0, 0, 0);
+ MchBar = MmioRead32 (PciD0F0RegBase + 0x48) &~BIT0;
+ ///
+ /// Read PowerLimit MSR
+ ///
+ TempMsr.Qword = AsmReadMsr64 (MSR_PACKAGE_POWER_LIMIT);
+ ///
+ /// Program cTDP Power Limit1
+ ///
+ Data32And = (UINT32) ~(PACKAGE_TDP_POWER_MASK);
+ Data32Or = (UINT32) (PowerLimit1 | (TempMsr.Dwords.Low &~PACKAGE_TDP_POWER_MASK));
+ MmioAndThenOr32 (MchBar + MMIO_TURBO_POWER_LIMIT, Data32And, Data32Or);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (MchBar + MMIO_TURBO_POWER_LIMIT),
+ 1,
+ (VOID *) (UINTN) (MchBar + MMIO_TURBO_POWER_LIMIT)
+ );
+ ///
+ /// Program cTDP Power Limit2
+ ///
+ Data32And = (UINT32) ~(PACKAGE_TDP_POWER_MASK);
+ Data32Or = (UINT32) (PowerLimit2 | (TempMsr.Dwords.High &~PACKAGE_TDP_POWER_MASK));
+ MmioAndThenOr32 (MchBar + MMIO_TURBO_POWER_LIMIT + 4, Data32And, Data32Or);
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (MchBar + MMIO_TURBO_POWER_LIMIT + 4),
+ 1,
+ (VOID *) (UINTN) (MchBar + MMIO_TURBO_POWER_LIMIT + 4)
+ );
+}
+
+
+/**
+ Configures following fields of MSR 0x618 based on corresponding MMIO register (MCHBAR+0x58E0):
+ Configures Long duration Turbo Mode (power limit 1) power level and time window for DDR domain
+ Configures Short duration Turbo Mode (power limit 2) power level and time window for DDR domain
+
+ @param[in] CpuPmConfig Pointer to policy protocol instance
+**/
+VOID
+ConfigureDdrPowerLimits (
+ IN OUT POWER_MGMT_CONFIG *CpuPmConfig
+ )
+{
+ MSR_REGISTER DdrPowerLimitMsr;
+ UINTN PciD0F0RegBase;
+ UINTN MchBar;
+
+ PciD0F0RegBase = MmPciAddress (0, 0, 0, 0, 0);
+ MchBar = MmioRead32 (PciD0F0RegBase + 0x48) &~BIT0;
+
+ DdrPowerLimitMsr.Qword = 0;
+ DdrPowerLimitMsr.Qword = MmioRead64 (MchBar + MMIO_DDR_RAPL_LIMIT);
+
+ DEBUG (
+ (EFI_D_INFO,
+ "DDR Power Limit 1 = %d\n",
+ DdrPowerLimitMsr.Dwords.Low & POWER_LIMIT_MASK)
+ );
+ DEBUG (
+ (EFI_D_INFO,
+ "DDR Power Limit 2 = %d\n",
+ DdrPowerLimitMsr.Dwords.High & POWER_LIMIT_MASK)
+ );
+
+ AsmWriteMsr64 (MSR_DDR_RAPL_LIMIT, DdrPowerLimitMsr.Qword);
+}
+
+/**
+ Configures PowerLimits and Config TDP values
+
+ @param[in] CpuPmConfig Pointer to policy protocol instance
+**/
+VOID
+ConfigureCtdp (
+ IN OUT POWER_MGMT_CONFIG *CpuPmConfig
+ )
+{
+ ///
+ /// Configure CTDP power limits.Refer Rev 0.6.0 BWG sec 16.7.1: Enabling Intel Configurable TDP support
+ ///
+ ConfigureCtdpPowerLimits (CpuPmConfig);
+
+ ///
+ /// BIOS power limit overrides
+ /// Don't override if custom ctdp settings are provided.
+ ///
+ if (!CpuPmConfig->pCustomCtdpSettings->ConfigTdpCustom) {
+ ConfigureCtdpPowerLimitsOverrides();
+ }
+ ///
+ /// To avoid issues and race conditions it is recommended that the below order of be followed
+ /// - For TDP Up program the Config TDP Level followed by Power Limits
+ /// - For TDP down program the Power Limits followed by Config TDP level
+ ///
+ if (CpuPmConfig->pTurboSettings->ConfigTdpLevel == CONFIG_TDP_UP) {
+ SelectCtdpPowerLimits (CpuPmConfig, mPpmGlobalNvsAreaProtocol->Area->ConfigTdpBootModeIndex);
+ SelectCtdpLevel (CpuPmConfig, mPpmGlobalNvsAreaProtocol->Area->ConfigTdpBootModeIndex);
+ } else {
+ SelectCtdpLevel (CpuPmConfig, mPpmGlobalNvsAreaProtocol->Area->ConfigTdpBootModeIndex);
+ SelectCtdpPowerLimits (CpuPmConfig, mPpmGlobalNvsAreaProtocol->Area->ConfigTdpBootModeIndex);
+ }
+}
+
+EFI_STATUS
+InitControllableTdp (
+ IN OUT POWER_MGMT_CONFIG *CpuPmConfig
+ )
+/**
+ Check for Ctrl TDP enabled SKUs and enable Controllable TDP
+
+ @param[in] CpuPmConfig Pointer to policy protocol instance
+
+ @exception EFI_UNSUPPORTED Controllable TDP not Supported
+ @retval EFI_SUCCESS Controllable TDP Supported
+**/
+{
+ UINTN CpuFamilyIndex;
+ UINTN CpuModelIndex;
+ UINT32 CtrlTdpSkuSize;
+ UINT8 CtrlTdpSkuDetected;
+ CHAR8 BrandIdString[MAXIMUM_CPU_BRAND_STRING_LENGTH + 1];
+ CPU_FAMILY CpuFamilyId;
+ CPU_STEPPING CpuSteppingId;
+ EFI_CPUID_REGISTER CpuExtendedSupport;
+ EFI_CPUID_REGISTER CpuBrandString;
+ PPM_CTRL_TDP_SKU_TBL *CtrlTdpSku;
+ MSR_REGISTER TempMsr;
+///
+/// Debug
+///
+
+ CtrlTdpSkuDetected = 0;
+ CtrlTdpSkuSize = 0;
+
+ CpuFamilyId = mPpmGlobalNvsAreaProtocol->Area->Cpuid & CPUID_FULL_FAMILY_MODEL;
+ CpuSteppingId = mPpmGlobalNvsAreaProtocol->Area->Cpuid & CPUID_FULL_STEPPING;
+
+ if((CpuFamilyId == EnumCpuHswUlt) || (CpuFamilyId == EnumCpuHsw) || (CpuFamilyId == EnumCpuCrw)) {
+ CtrlTdpSku = mHswCtrlTdpSkuTable;
+ CtrlTdpSkuSize = 1;
+ }else {
+ return EFI_UNSUPPORTED;
+ }
+
+ DEBUG ((EFI_D_ERROR, "\n Function InitControllableTdp \n"));
+ //
+ // Get CPU Brand String
+ //
+ AsmCpuid (CPUID_EXTENDED_FUNCTION, &CpuExtendedSupport.RegEax, &CpuExtendedSupport.RegEbx, &CpuExtendedSupport.RegEcx, &CpuExtendedSupport.RegEdx);
+ AsmCpuid (CPUID_BRAND_STRING1, &CpuBrandString.RegEax, &CpuBrandString.RegEbx, &CpuBrandString.RegEcx, &CpuBrandString.RegEdx);
+ //
+ // Check if Brand ID String is supported or filled up
+ //
+ if (CpuExtendedSupport.RegEax == 0) {
+ return EFI_UNSUPPORTED;
+ }
+ CopyMem ((CHAR8 *) &BrandIdString[0],(CHAR8 *) &CpuBrandString,16);
+ AsmCpuid (CPUID_BRAND_STRING2, &CpuBrandString.RegEax, &CpuBrandString.RegEbx, &CpuBrandString.RegEcx, &CpuBrandString.RegEdx);
+ CopyMem ((CHAR8 *) &BrandIdString[16],(CHAR8 *) &CpuBrandString,16);
+ AsmCpuid (CPUID_BRAND_STRING3, &CpuBrandString.RegEax, &CpuBrandString.RegEbx, &CpuBrandString.RegEcx, &CpuBrandString.RegEdx);
+ CopyMem ((CHAR8 *) &BrandIdString[31],(CHAR8 *) &CpuBrandString,16);
+ BrandIdString[MAXIMUM_CPU_BRAND_STRING_LENGTH] = 0;
+
+ //
+ // Check for Match with Controllable TDP SKU list
+ //
+ for(CpuFamilyIndex = 0;CpuFamilyIndex < CtrlTdpSkuSize;CpuFamilyIndex++) {
+ if(EfiAsciiStrStr((CHAR8 *) BrandIdString, (CHAR8 *) CtrlTdpSku[CpuFamilyIndex].CpuFamily)) {
+ //
+ // If NoOfCpus=0xff ,all processors in the family are ULV skus
+ //
+ if(CtrlTdpSku[CpuFamilyIndex].NoOfCpus == 0xFF) {
+ CtrlTdpSkuDetected = 1;
+ DEBUG ((EFI_D_ERROR, "\n Found Control TDP SKU"));
+ break;
+ }
+ for(CpuModelIndex = 0;CpuModelIndex < CtrlTdpSku[CpuFamilyIndex].NoOfCpus; CpuModelIndex++) {
+ if(EfiAsciiStrStr((CHAR8 *) BrandIdString,(CHAR8 *) CtrlTdpSku[CpuFamilyIndex].CpuModel[CpuModelIndex])) {
+ CtrlTdpSkuDetected = 1;
+ DEBUG ((EFI_D_ERROR, "\n Found Control TDP SKU"));
+ break;
+ }
+ } // end of CpuModelIndex
+ break;
+ }
+ } // end of if CpuFamilyIndex
+
+ ///
+ /// Enable Controllable TDp when
+ /// Power Limt1 is less than Package Tdp
+ /// Min Power is Zero
+ ///
+ if (CpuPmConfig->pTurboSettings->PowerLimit1 != AUTO && (CpuPmConfig->pTurboSettings->PowerLimit1 * mProcessorPowerUnit) / mCustomPowerUnit < mPackageTdp
+ && (mPackageMinPower == 0) && (CtrlTdpSkuDetected == 1)){
+ mControllableTdpEnable = 1;
+ //
+ // For ControllableTDP enabled systems add fake P-State below LFM and set PPC as LFM
+ //
+ mMinBusRatio = mMinBusRatio - 1;
+ //
+ // Set TAR MSR to LFM-1 (Fake LFM)
+ //
+ TempMsr.Qword = AsmReadMsr64 (MSR_TURBO_ACTIVATION_RATIO);
+ TempMsr.Dwords.Low &= ~MSR_TURBO_ACTIVATION_RATIO_MASK;
+ TempMsr.Dwords.Low |= (UINT16)((mMinBusRatio) & MSR_TURBO_ACTIVATION_RATIO_MASK);
+ DEBUG ((EFI_D_INFO, "\n Wrting MSR_TURBO_ACTIVATION_RATIO : %x \n",TempMsr.Qword));
+ AsmWriteMsr64 (MSR_TURBO_ACTIVATION_RATIO, TempMsr.Qword);
+ }
+ return EFI_SUCCESS;
+}
+
diff --git a/ReferenceCode/Haswell/PowerManagement/Dxe/PowerMgmtCommon.h b/ReferenceCode/Haswell/PowerManagement/Dxe/PowerMgmtCommon.h
new file mode 100644
index 0000000..2ee19bd
--- /dev/null
+++ b/ReferenceCode/Haswell/PowerManagement/Dxe/PowerMgmtCommon.h
@@ -0,0 +1,877 @@
+/** @file
+ This header file contains power management definitions specific to
+ Haswell processors.
+
+ Acronyms:
+ PPM - Processor Power Management
+ TM Thermal Monitor
+ IST Intel(R) Speedstep technology
+ HT Hyper-Threading Technology
+
+@copyright
+ Copyright (c) 2012-2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#ifndef _POWER_MGMT_COMMON_H_
+#define _POWER_MGMT_COMMON_H_
+
+#include "EdkIIGlueDxe.h"
+#include "EfiScriptLib.h"
+#include "PowerMgmtDefinitions.h"
+#include "Cpu.h"
+#include "CpuAccess.h"
+#include "CpuPlatformLib.h"
+#include "BaseLibInternal.h"
+#include "PchAccess.h"
+#include "PchPlatformLib.h"
+#include "SaAccess.h"
+#include "AslUpdateLib.h"
+
+#include EFI_PROTOCOL_DEPENDENCY (BootScriptSave)
+#include EFI_PROTOCOL_DEPENDENCY (CpuPlatformPolicy)
+#include EFI_PROTOCOL_PRODUCER (PowerMgmtInitDone)
+#include EFI_PROTOCOL_CONSUMER (MpService)
+#include EFI_PROTOCOL_CONSUMER (LoadedImage)
+#include EFI_PROTOCOL_DEPENDENCY (AcpiSupport)
+#include EFI_PROTOCOL_DEPENDENCY (AcpiTable)
+#include EFI_GUID_DEFINITION (PowerMgmtAcpiTableStorage)
+#include EFI_PROTOCOL_PRODUCER (PpmGlobalNvsArea)
+
+#define HSW_ULT_PCH_POWER_LEVELS 0x3
+#define EXTENDED_PCH_POWER_LEVELS 0x4
+#define PM_CST_LVL2 0x14
+
+#define FADT_C3_LATENCY 57
+#define FADT_C3_LATENCY_DISABLED 1001
+
+#define NATIVE_PSTATE_LATENCY 10
+#define PSTATE_BM_LATENCY 10
+
+#define MP_TIMEOUT_FOR_STARTUP_ALL_APS 0 ///< Set 0 for BSP always wait for APs
+
+#define NO_CALIBRATE 0
+#define PCODE_CALIBRATE 1
+#define BIOS_CALIBRATE 2
+#define PCODE_BCLK_CALIBRATION_TIMEOUT 22
+
+///
+/// Limit the number of P-states to 16. Up to Windows 7, the OS allocates 1KB buffer for the PSS package.
+/// So the maximum number of P-state OS can handle is 19. This is not an OS issue. Having too many P-states
+/// is not good for the system performance.
+///
+#define FVID_MAX_STATES 16
+#define FVID_MIN_STEP_SIZE 1
+
+///
+/// Cpu Brandstring length
+///
+#define MAXIMUM_CPU_BRAND_STRING_LENGTH 48
+
+///
+/// Power Limit Level
+///
+#define PL12TimeWindowCovert 1
+#define PL3TimeWindowConvert 3
+//
+// Global variables
+//
+///
+/// CpuPlatformPolicy Revision
+///
+extern UINT8 mCpuPolicyRevision;
+
+extern POWER_MGMT_CONFIG *mCpuPmConfig; ///< Power Managment policy configurations
+extern EFI_CPUID_REGISTER mCpuid01; // CPUID 01 values
+//
+// Values for FVID table calculate.
+//
+extern UINT16 mTurboBusRatio;
+extern UINT16 mMaxBusRatio;
+extern UINT16 mMinBusRatio;
+extern UINT16 mProcessorFlavor;
+extern UINT16 mBspBootRatio;
+extern UINT16 mPackageTdp;
+extern UINT16 mPackageTdpWatt;
+extern UINT16 mCpuConfigTdpBootRatio;
+extern UINT16 mCustomPowerUnit;
+extern UINT16 mCpuCacheSize;
+///
+/// Fractional part of Processor Power Unit in Watts. (i.e. Unit is 1/mProcessorPowerUnit)
+///
+extern UINT8 mProcessorPowerUnit;
+///
+/// Fractional part of Processor Time Unit in seconds. (i.e Unit is 1/mProcessorTimeUnit)
+///
+extern UINT8 mProcessorTimeUnit;
+///
+/// Maximum allowed power limit value in TURBO_POWER_LIMIT_MSR and PRIMARY_PLANE_POWER_LIMIT_MSR
+/// in units specified by PACKAGE_POWER_SKU_UNIT_MSR
+///
+extern UINT16 mPackageMaxPower;
+///
+/// Minimum allowed power limit value in TURBO_POWER_LIMIT_MSR and PRIMARY_PLANE_POWER_LIMIT_MSR
+/// in units specified by PACKAGE_POWER_SKU_UNIT_MSR
+///
+extern UINT16 mPackageMinPower;
+extern UINT8 mControllableTdpEnable; ///< Controllable TDP Enable/Disable
+extern UINT8 mRatioLimitProgrammble; ///< Porgrammable Ratio Limit
+extern UINT8 mTdpLimitProgrammble; ///< Porgrammable TDP Limit
+
+extern PPM_GLOBAL_NVS_AREA_PROTOCOL *mPpmGlobalNvsAreaProtocol; ///< Ppm GlobalNvs Protocol
+extern EFI_MP_SERVICES_PROTOCOL *mMpService; ///< Mp Services Protocol
+
+//
+// Globals to support updating ACPI Tables
+//
+extern EFI_ACPI_SUPPORT_PROTOCOL *mAcpiSupport;
+extern EFI_ACPI_TABLE_PROTOCOL *mAcpiTable;
+extern EFI_ACPI_DESCRIPTION_HEADER *mCpu0IstTable;
+extern EFI_ACPI_DESCRIPTION_HEADER *mApIstTable;
+extern EFI_ACPI_DESCRIPTION_HEADER *mCpu0CstTable;
+extern EFI_ACPI_DESCRIPTION_HEADER *mApCstTable;
+extern EFI_ACPI_DESCRIPTION_HEADER *mCpuPmTable;
+extern EFI_ACPI_DESCRIPTION_HEADER *mCpu0TstTable;
+extern EFI_ACPI_DESCRIPTION_HEADER *mApTstTable;
+extern EFI_ACPI_DESCRIPTION_HEADER *mLakeTinyTable;
+extern EFI_ACPI_DESCRIPTION_HEADER *mCtdpTable;
+
+//
+// Structure Declarations
+//
+
+typedef struct _FVID_HEADER {
+ UINT32 Stepping; ///< Matches value returned by CPUID function 1
+ UINT16 MaxBusRatio; ///< Matches BUS_RATIO_MAX field in PERF_STS_MSR
+ UINT16 Gv3States; ///< Number of states of FVID (N)
+} FVID_HEADER;
+
+typedef struct _FVID_STATE {
+ UINT32 State; ///< State Number (0 - N-1)
+ UINT16 BusRatio; ///< BUS_RATIO_SEL value to be written to PERF_CTL
+ UINT32 Power; ///< Typical power consumed by CPU in this state
+} FVID_STATE;
+
+typedef union _FVID_TABLE {
+ FVID_HEADER FvidHeader;
+ FVID_STATE FvidState;
+ UINT64 FvidData;
+} FVID_TABLE;
+
+typedef struct _ENABLE_CSTATE_PARAMS {
+ UINT16 C3IoAddress;
+} ENABLE_CSTATE_PARAMS;
+
+typedef struct _ENABLE_EMTTM_PARAMS {
+ FVID_TABLE *FvidPointer;
+} ENABLE_EMTTM_PARAMS;
+
+typedef struct _PCODE_BCLK_CALIBRATION_MAILBOX {
+ UINT32 PCalFactor;
+ UINT32 TSC24_L1;
+ UINT32 TSC24_L2;
+ UINT32 TSC24_U1;
+ UINT32 TSC24_U2;
+ UINT32 TSC100_L1;
+ UINT32 TSC100_L2;
+ UINT32 TSC100_U1;
+ UINT32 TSC100_U2;
+} PCODE_BCLK_CALIBRATION_MAILBOX;
+
+///
+/// ASL SSDT structure layout
+///
+#pragma pack(1)
+typedef struct {
+ UINT8 NameOp; ///< First opcode is a NameOp.
+ UINT32 NameString; ///< 'TDSS' ; Name of object.
+ UINT8 PackageOp; ///< db 12h ; Sixth OpCode is PackageOp.
+ UINT16 PackageLen; ///< dw 0h ; Seventh/Eighth OpCode is PackageLength.
+ UINT8 PackageEntryNum; ///< db 0Ch ; Ninth OpCode is number of package entries.
+ UINT8 StringPrefix1; ///< 0Dh
+ UINT64 Cpu0IstStr; ///< 00h
+ UINT8 StringNull1; ///< 00h
+ UINT8 DwordPrefix1a; ///< 0Ch
+ UINT32 Cpu0IstAddr; ///< 00h
+ UINT8 DwordPrefix1b; ///< 0Ch
+ UINT32 Cpu0IstLen; ///< 00h
+ UINT8 StringPrefix2; ///< 0Dh
+ UINT64 Cpu1IstStr; ///< 00h
+ UINT8 StringNull2; ///< 00h
+ UINT8 DwordPrefix2a; ///< 0Ch
+ UINT32 ApIstAddr; ///< 00h
+ UINT8 DwordPrefix2b; ///< 0Ch
+ UINT32 ApIstLen; ///< 00h
+ UINT8 StringPrefix3; ///< 0Dh
+ UINT64 Cpu0CstStr; ///< 00h
+ UINT8 StringNull3; ///< 00h
+ UINT8 DwordPrefix3a; ///< 0Ch
+ UINT32 Cpu0CstAddr; ///< 00h
+ UINT8 DwordPrefix3b; ///< 0Ch
+ UINT32 Cpu0CstLen; ///< 00h
+ UINT8 StringPrefix4; ///< 0Dh
+ UINT64 ApCstStr; ///< 00h
+ UINT8 StringNull4; ///< 00h
+ UINT8 DwordPrefix4a; ///< 0Ch
+ UINT32 ApCstAddr; ///< 00h
+ UINT8 DwordPrefix4b; ///< 0Ch
+ UINT32 ApCstLen; ///< 00h
+} SSDT_LAYOUT;
+#pragma pack()
+
+///
+/// ASL PCTP structure layout
+///
+#pragma pack(1)
+typedef struct {
+ UINT8 RegDes; ///< Byte [0]=0x82:Register descriptor code
+ UINT16 RegLen; ///< Byte [2:1]=0x0C:Register descriptor length
+ UINT8 RegType; ///< Byte [3]=0x01:Register type (System IO)
+ UINT8 RegWidth; ///< Byte [4]=0x10:Register width (16-bit)
+ UINT8 RegBitOffst; ///< Byte [5]=0x00:Register bit offset (0)
+ UINT8 RegAccSize; ///< Byte [6]=0x00:Register access size (0)
+ UINT64 RegAddress; ///< Byte [14:7]=Register address
+ UINT16 EndTag; ///< Byte [16:15]=End tag
+} PCTP_LAYOUT;
+#pragma pack()
+
+typedef struct {
+ UINT16 SkuPackageTdp;
+ UINTN SkuIccMax;
+ UINTN MsrCtdpPowerLimit1;
+ UINTN MsrCtdpPowerLimit2;
+ UINTN CtdpUpPowerLimit1;
+ UINTN CtdpUpPowerLimit2;
+ UINTN CtdpNominalPowerLimit1;
+ UINTN CtdpNominalPowerLimit2;
+ UINTN CtdpDownPowerLimit1;
+ UINTN CtdpDownPowerLimit2;
+ UINTN Reserved;
+} PPM_CTDP_OVERRIDE_TABLE;
+
+///
+/// PL1 Thermal Control structure layout
+///
+typedef union {
+ struct {
+ UINT8 Disable:1; ///< [0] Disable
+ UINT8 Reserved:7; ///< [7:2] Reserved
+ UINT8 FloorIA; ///< [15:8] Percent Throttle for IA component 255-0; 255=0%, 0=100%
+ UINT8 FloorGT; ///< [23:16] Percent Throttle for GT component 255-0; 255=0%, 0=100%
+ UINT8 FloorPCH; ///< [31:24] Percent Throttle for PCH component 255-0; 255=0%, 0=100%
+ } Bits;
+ UINT32 Uint32;
+ } PL1_THERMAL_CONTROL;
+
+typedef struct _PPM_CTRL_TDP_SKU_TBL{
+ UINT8 CpuFamily[MAXIMUM_CPU_BRAND_STRING_LENGTH]; ///< Cpu Family Brand String
+ UINTN NoOfCpus; ///< Number of Cpus,FF mean all cpus matching CpuFamily string above
+ UINT8 CpuModel[20][MAXIMUM_CPU_BRAND_STRING_LENGTH]; ///< Processor Model Number
+} PPM_CTRL_TDP_SKU_TBL;
+
+//
+// FVID Table Information
+// Default FVID table
+// One header field plus states
+//
+extern UINT16 mNumberOfStates;
+extern FVID_TABLE mEmptyFvidTable[FVID_MAX_STATES + 1];
+extern FVID_TABLE *mFvidPointer;
+
+//
+// Function prototypes
+//
+/**
+ Initializes P States and Turbo Power management features
+**/
+VOID
+InitializePStates (
+ VOID
+ );
+
+/**
+ Initializes XE support in the processor.
+
+ @param[in] CpuPmConfig Pointer to policy protocol instance
+**/
+VOID
+InitTurboRatioLimits (
+ IN OUT POWER_MGMT_CONFIG *CpuPmConfig
+ );
+
+/**
+ Initializes required structures for P-State table creation and enables GV3
+ support in the processor.
+
+ @param[in] FvidPointer Table to update, must be initialized.
+ @param[in] CpuPmConfig Pointer to policy protocol instance
+**/
+VOID
+InitGv3 (
+ IN OUT FVID_TABLE *FvidPointer,
+ IN OUT POWER_MGMT_CONFIG *CpuPmConfig
+ );
+
+/**
+ Enables GV3 support in a logical processor.
+
+ This function must be MP safe.
+
+ @param[in] Buffer Pointer to the function parameters passed in.
+
+ @retval EFI_SUCCESS
+**/
+VOID
+EFIAPI
+ApSafeEnableGv3 (
+ IN OUT VOID *Buffer
+ );
+
+/**
+ This function updates the table provided with the FVID data for the processor.
+ If CreateDefaultTable is TRUE, a minimam FVID table will be provided.
+ The maximum number of states must be greater then or equal to two.
+ The table should be initialized in such a way as for the caller to determine if the
+ table was updated successfully. This function should be deprecated in the future when
+ Release 8 is integrated in favor of the EIST protocol calculating FVID information.
+
+ @param[in] FvidPointer Pointer to a table to be updated
+ @param[in] MaxNumberOfStates Number of entries in the table pointed to by FvidPointer
+ @param[in] MinStepSize Minimum step size for generating the FVID table
+ @param[in] CreateDefaultTable Create default FVID table rather then full state support
+**/
+VOID
+InitFvidTable (
+ IN OUT FVID_TABLE *FvidPointer,
+ IN UINT16 MaxNumberOfStates,
+ IN UINT16 MinStepSize,
+ IN BOOLEAN CreateDefaultTable
+ );
+
+/**
+ Create an FVID table based on the algorithm provided by the BIOS writer's guide.
+
+ @param[in] FvidPointer Pointer to a table to be updated
+ @param[in] MaxNumberOfStates Number of entries in the table pointed to by FvidPointer
+
+ @retval EFI_SUCCESS FVID table created successfully.
+ @retval EFI_INVALID_PARAMETER The bus ratio range don't permit FVID table calculation;
+ a default FVID table should be constructed.
+**/
+EFI_STATUS
+CreateFvidTable (
+ IN OUT FVID_TABLE *FvidPointer,
+ IN UINT16 MaxNumberOfStates
+ );
+
+/**
+ Create default FVID table with max and min states only.
+
+ @param[in] FvidPointer Pointer to a table to be updated
+**/
+VOID
+CreateDefaultFvidTable (
+ IN OUT FVID_TABLE *FvidPointer
+ );
+
+/**
+ Initializes Energy efficient P-state feature.
+
+ @param[in] CpuPmConfig Pointer to policy protocol instance
+**/
+VOID
+InitEnergyEfficientPState (
+ IN OUT POWER_MGMT_CONFIG *CpuPmConfig
+ );
+
+
+/**
+ Configures the Interrupt Redirection Mode Selection for Logical Interrupts.
+
+ @param[in] CpuPmConfig Pointer to PPM Policy structure.
+**/
+VOID
+InitPpmIrmConfiguration (
+ IN OUT POWER_MGMT_CONFIG *CpuPmConfig
+ );
+
+/**
+ Completes platform power management initialization
+ (1) Initializes the TSC update variables.
+ (2) Initializes the GV state for processors.
+ (3) Saves MSR state for S3
+ (4) Adds a callback (SMI) in S3 resume script to restore the MSR
+**/
+VOID
+PpmPostInit (
+ VOID
+ );
+
+/**
+ Set processor P state to HFM or LFM
+**/
+VOID
+SetBootPState (
+ VOID
+ );
+
+/**
+ Set processor P state to HFM or LFM.
+
+ @param[in] Buffer Unused
+
+ @retval EFI_SUCCESS Processor MSR setting is saved.
+**/
+VOID
+EFIAPI
+ApSafeSetBootPState (
+ IN OUT VOID *Buffer
+ );
+
+/**
+ Initializes C States Power management features
+**/
+VOID
+InitializeCState (
+ IN POWER_MGMT_CONFIG *CpuPmConfig
+ );
+
+/**
+ Disable/Enable the CState Pre-Wake Feature
+
+ @param[in] CpuPmConfig - Pointer to policy protocol instance
+**/
+VOID
+InitCstatePreWake (
+ IN POWER_MGMT_CONFIG *CpuPmConfig
+ );
+
+/**
+ BootScript for PCode Mailbox function for mailbox write commands.
+ This function will poll the mailbox interface for control, issue the command
+ during s3 resume
+
+ @param[IN] MailboxCommand,
+ @param[IN] MailboxData,
+**/
+VOID
+MailboxS3Write (
+ IN UINT32 MailboxCommand,
+ IN UINT32 MailboxData
+ );
+
+/**
+ Calibrate 24MHz BCLK support to reduce the power consumption in idle states.
+
+ @retval EFI_UNSUPPORTED Unrecognized 24MHz BCLK Calibration Type.
+ @retval EFI_SUCCESS Processor C-State 24MHz BCLK support calibrated successfully.
+**/
+EFI_STATUS
+CalibrateBclkForCStates (
+ VOID
+ );
+
+/**
+ Enables C-State support as specified by the input flags on all logical
+ processors and sets associated timing requirements in the chipset.
+
+ @param[in] This Pointer to the protocol instance
+ @param[in] C3IoAddress IO address to generate C3 states (PM base + 014 usually)
+**/
+VOID
+EnableCStates (
+ IN UINT16 C3IoAddress
+ );
+
+/**
+ Enable C-State support as specified by the input flags on a logical processor.
+ Configure BIOS C1 Coordination (SMI coordination)
+ Enable IO redirection coordination
+ Choose proper coordination method
+ Configure extended C-States
+
+ This function must be MP safe.
+
+ @param[in] Buffer Pointer to a ENABLE_CSTATE_PARAMS containing the necessary
+ information to enable C-States
+
+ @retval EFI_SUCCESS Processor C-State support configured successfully.
+**/
+VOID
+EFIAPI
+ApSafeEnableCStates (
+ IN OUT VOID *Buffer
+ );
+
+/**
+ This will perform Miscellaneous Power Management related programming.
+
+ @param[in] CtdpSupport Status of InitializeConfigurableTdp funtion
+**/
+VOID
+InitMiscFeatures (
+ EFI_STATUS CtdpSupport
+ );
+
+/**
+ CTDP BIOS settings Initialization(Msr)
+
+ @param[in] CpuPmConfig Pointer to policy protocol instance
+ @param[in] FvidPointer Table to update, must be initialized.
+
+ @exception EFI_UNSUPPORTED Ctdp not supported
+ @retval EFI_SUCCESS Ctdp Settings Initialized successfully from MSRs
+**/
+EFI_STATUS
+InitializeConfigurableTdp (
+ IN OUT POWER_MGMT_CONFIG *CpuPmConfig
+ );
+
+/**
+ Configures PowerLimits and Config TDP values
+
+ @param[in] CpuPmConfig Pointer to policy protocol instance
+**/
+VOID
+ConfigureCtdp (
+ IN OUT POWER_MGMT_CONFIG *CpuPmConfig
+ );
+
+/**
+ This will perform general thermal initialization other then TM1, TM2, or
+ PROCHOT# on all logical processors.
+
+ @param[in] This Pointer to the protocol instance
+ @param[in] CpuPmConfig Pointer to policy protocol instance
+**/
+VOID
+InitThermal (
+ IN OUT POWER_MGMT_CONFIG *CpuPmConfig
+ );
+
+/**
+ This will perform enable thermal initialization. TM1, TM2 and adaptive thermal
+ throttling are enabled/disabled together.
+
+ This function must be MP safe.
+
+ @param[in] Buffer Pointer to the function parameters passed in.
+
+ @retval EFI_SUCCESS General thermal initialization completed successfully
+**/
+VOID
+EFIAPI
+ApSafeInitThermal (
+ IN OUT VOID *Buffer
+ );
+
+/**
+ Enables the bi-directional PROCHOT# signal.
+
+ @retval EFI_SUCCESS PROCHOT# configured successfully
+**/
+EFI_STATUS
+EnableProcHot (
+ VOID
+ );
+
+
+/**
+ Locks down all settings.
+
+ @param[in] CpuPmConfig Pointer to PPM Policy structure.
+**/
+VOID
+PpmLockDown (
+ IN OUT POWER_MGMT_CONFIG *CpuPmConfig
+ );
+
+/**
+ Lock MSR_PMG_CST_CONFIG
+ This function must be MP safe.
+
+ @param[in] Buffer Not used (needed for API compatibility)
+
+ @retval EFI_SUCCESS Processor C-State locked successfully.
+**/
+VOID
+EFIAPI
+ApSafeLockDown (
+ IN OUT VOID *Buffer
+ );
+
+/**
+ Runs the specified procedure on all logical processors, passing in the
+ parameter buffer to the procedure.
+
+ @param[in] Procedure The function to be run.
+ @param[in] Buffer Pointer to a parameter buffer.
+
+ @retval EFI_SUCCESS
+**/
+EFI_STATUS
+RunOnAllLogicalProcessors (
+ IN OUT EFI_AP_PROCEDURE Procedure,
+ IN OUT VOID *Buffer
+ );
+
+/**
+ Configures following fields of MSR 0x610 based on user configuration:
+ Configures Long duration Turbo Mode (power limit 1) power level and time window
+ Configures Short duration Turbo mode (power limit 2)
+
+ @param[in] CpuPmConfig Pointer to policy protocol instance
+**/
+VOID
+ConfigurePowerLimits (
+ IN OUT POWER_MGMT_CONFIG *CpuPmConfig
+ );
+
+/**
+ Configures following fields of MSR 0x610 based on user configuration:
+ Configures Long duration Turbo Mode (power limit 1) power level and time window
+ Configures Short duration Turbo mode (power limit 2)
+
+ @param[in] CpuPmConfig Pointer to policy protocol instance
+**/
+VOID
+ConfigurePowerLimitsNonConfigTdpSkus (
+ IN OUT POWER_MGMT_CONFIG *CpuPmConfig
+ );
+
+/**
+ Configures following fields of PL3 MSR 0x615 based on user configuration:
+ Configures PL 3 power level and time window
+ @param[in] CpuPmConfig Pointer to policy protocol instance
+**/
+VOID
+ConfigurePL3PowerLimits (
+ IN OUT POWER_MGMT_CONFIG *CpuPmConfig
+ );
+
+/**
+ This will perform PowerLimit 1 algorithm will be used to control Thermal Throttling features
+
+ @param[in] CpuPmConfig Pointer to policy protocol instance
+**/
+
+/**
+ This will perform PowerLimit 1 algorithm will be used to control Thermal Throttling features
+
+ @param[in] CpuPmConfig Pointer to policy protocol instance
+**/
+VOID
+InitPl1ThermalControl (
+ IN OUT POWER_MGMT_CONFIG *CpuPmConfig
+ );
+
+/**
+ Configures following fields of MSR 0x618 based on user configuration:
+ Configures Long duration Turbo Mode (power limit 1) power level and time window for DDR domain
+ Configures Short duration Turbo mode (power limit 2)
+
+ @param[in] CpuPmConfig Pointer to policy protocol instance
+**/
+VOID
+ConfigureDdrPowerLimits (
+ IN OUT POWER_MGMT_CONFIG *CpuPmConfig
+ );
+
+/**
+ Verify and fix Custom Power Limit values
+
+ @param[in] CustomPowerLimit Custom Power Limit value
+
+ @retval Verified Custom power limit value
+**/
+UINT16
+VerifyAndFixCustomPowerLimit (
+ IN UINT32 CustomPowerLimit,
+ IN UINT16 CustomPlUnit
+ );
+
+/**
+ Verify and fix Custom Ratio values
+ Custom Ratio should be between MaxTurboFrequency and LFM
+
+ @param[in] CustomPowerLimit Custom Power Limit value
+ @param[in] CustomPlUnit Custom Power Limit Unit
+
+ @retval Verified Custom Ratio value
+**/
+UINT8
+VerifyAndFixCustomRatio (
+ IN UINT8 CustomRatio
+ );
+
+/**
+ CTDP BIOS settings Initialization(From Msrs)
+
+ @param[in] CpuPmConfig Pointer to policy protocol instance
+
+ @exception EFI_UNSUPPORTED Ctdp not supported
+ @retval EFI_SUCCESS Ctdp Settings Initialized successfully from MSRs
+**/
+EFI_STATUS
+InitConfigurableTdpSettings (
+ IN OUT POWER_MGMT_CONFIG *CpuPmConfig
+ );
+
+/**
+ Get Power Limit2 based on Power Limit1 on Config TDP
+
+ @param[in] PowerLimit1 Power Limit 1 Value
+
+ @retval Calculated Power Limit2 value
+**/
+UINT16
+GetCtdpPowerLimit2 (
+ IN UINT16 PowerLimit1
+ );
+
+/**
+ Custom Configurable TDP Table BIOS Initialization
+
+ @param[in] CpuPmConfig Pointer to policy protocol instance
+
+ @exception EFI_UNSUPPORTED Custom Ctdp settings are not available
+ @retval EFI_SUCCESS Successfully Initialized Custom Ctdp Settings
+**/
+EFI_STATUS
+InitCustomConfigurableTdp (
+ IN OUT POWER_MGMT_CONFIG *CpuPmConfig
+ );
+
+/**
+ Configures following fields of MSR 0x610 based on user configuration:
+ - Configures Long duration Turbo Mode (power limit 1) power level and time window
+ - Configures Short duration turbo mode (power limit 2)
+
+ @param[in] CpuPmConfig Pointer to policy protocol instance
+**/
+VOID
+InitPchPowerSharing (
+ IN OUT POWER_MGMT_CONFIG *CpuPmConfig
+ );
+
+/**
+ Private helper function to convert various Turbo Power Limit Time from Seconds to CPU units
+
+ @param[in] TimeInSeconds Time in seconds
+ @param[in] PowerLimitLevel Power Limit Level
+
+ @retval UINT8 Converted time in CPU units
+**/
+UINT8
+GetConvertedTime (
+ IN UINT32 TimeInSeconds,
+ IN UINT8 PowerLimitLevel
+ );
+
+/**
+ Configures following fields of MSR 0x610
+ Configures Long duration Turbo Mode (power limit 1) power level and time window
+ Configures Short duration turbo mode (power limit 2)
+
+ @param[in] CpuPmConfig Pointer to policy protocol instance
+**/
+VOID
+ConfigureCtdpPowerLimits (
+ IN OUT POWER_MGMT_CONFIG *CpuPmConfig
+ );
+
+/**
+ Patch Fvid Table with Ctdp Tar ratio and Tar-1 Ratio
+
+ @param[in] FvidPointer Pointer to Fvid Table
+**/
+VOID
+CtdpPatchFvidTable (
+ IN OUT FVID_TABLE *FvidPointer
+ );
+
+/**
+ Replace P state with given ratio
+
+ @param[in] FvidPointer Pointer to Fvid Table
+ @param[in] PssIndex FVID table index of P state to be replaced
+ @param[in] Ratio Target Ratio to put in
+**/
+VOID
+CtdpReplaceFvidRatio (
+ IN OUT FVID_TABLE *FvidPointer,
+ UINTN PssIndex,
+ UINTN Ratio
+ );
+
+/**
+ Patch the native _PSS package with the GV3 values
+ Uses ratio/VID values from the FVID table to fix up the control values in the _PSS.
+
+ (1) Find _PSS package:
+ (1.1) Find the _PR_CPU0 scope.
+ (1.2) Save a pointer to the package length.
+ (1.3) Find the _PSS AML name object.
+ (2) Resize the _PSS package.
+ (3) Fix up the _PSS package entries
+ (3.1) Check Turbo mode support.
+ (3.2) Check Dynamic FSB support.
+ (4) Fix up the Processor block and \_PR_CPU0 Scope length.
+ (5) Update SSDT Header with new length.
+
+ @retval EFI_SUCCESS
+ @retval EFI_NOT_FOUND - If _PR_.CPU0 scope is not foud in the ACPI tables
+**/
+EFI_STATUS
+AcpiPatchPss (
+ VOID
+ );
+
+/**
+ Configure the FACP for C state support
+**/
+VOID
+ConfigureFadtCStates (
+ VOID
+ );
+
+/**
+ Locate the PPM ACPI tables data file and read ACPI SSDT tables.
+ Publish the appropriate SSDT based on current configuration and capabilities.
+
+ @param[in] This Pointer to the protocol instance
+
+ @retval EFI_SUCCESS - on success
+ @retval Appropiate failure code on error
+**/
+EFI_STATUS
+InitializePpmAcpiTable (
+ VOID
+ );
+
+/**
+ Check for Ctrl TDP enabled SKUs and enable Controllable TDP
+
+ @param[in] CpuPmConfig Pointer to policy protocol instance
+
+ @exception EFI_UNSUPPORTED Controllable TDP not Supported
+ @retval EFI_SUCCESS Controllable TDP Supported
+**/
+EFI_STATUS
+InitControllableTdp (
+ IN OUT POWER_MGMT_CONFIG *CpuPmConfig
+ );
+#endif
diff --git a/ReferenceCode/Haswell/PowerManagement/Dxe/PowerMgmtDxe.cif b/ReferenceCode/Haswell/PowerManagement/Dxe/PowerMgmtDxe.cif
new file mode 100644
index 0000000..99b6d76
--- /dev/null
+++ b/ReferenceCode/Haswell/PowerManagement/Dxe/PowerMgmtDxe.cif
@@ -0,0 +1,19 @@
+<component>
+ name = "PowerMgmtInit"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Haswell\PowerManagement\Dxe"
+ RefName = "PowerMgmtInit"
+[files]
+"PowerMgmtDxe.mak"
+"PowerMgmtDxe.sdl"
+"PowerMgmtDxe.inf"
+"PowerMgmtDxe.dxs"
+"PowerMgmtInit.c"
+"IdleStates.c"
+"MiscFunctions.c"
+"PerformanceStates.c"
+"PowerLimits.c"
+"Thermal.c"
+"PowerMgmtCommon.h"
+"PowerMgmtInit.h"
+<endComponent>
diff --git a/ReferenceCode/Haswell/PowerManagement/Dxe/PowerMgmtDxe.dxs b/ReferenceCode/Haswell/PowerManagement/Dxe/PowerMgmtDxe.dxs
new file mode 100644
index 0000000..199a064
--- /dev/null
+++ b/ReferenceCode/Haswell/PowerManagement/Dxe/PowerMgmtDxe.dxs
@@ -0,0 +1,38 @@
+/** @file
+ Dependency expression source file.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+
+#include "EfiDepex.h"
+
+#include EFI_PROTOCOL_DEFINITION (MpService)
+#include EFI_PROTOCOL_DEPENDENCY (BootScriptSave)
+#include EFI_PROTOCOL_DEPENDENCY (AcpiSupport)
+#include EFI_PROTOCOL_DEPENDENCY (CpuPlatformPolicy)
+#include EFI_PROTOCOL_DEPENDENCY (GlobalNvsArea)
+
+DEPENDENCY_START
+ EFI_BOOT_SCRIPT_SAVE_PROTOCOL_GUID AND
+ EFI_ACPI_SUPPORT_GUID AND
+ EFI_MP_SERVICES_PROTOCOL_GUID AND
+ EFI_GLOBAL_NVS_AREA_PROTOCOL_GUID AND
+ DXE_CPU_PLATFORM_POLICY_PROTOCOL_GUID
+DEPENDENCY_END
diff --git a/ReferenceCode/Haswell/PowerManagement/Dxe/PowerMgmtDxe.inf b/ReferenceCode/Haswell/PowerManagement/Dxe/PowerMgmtDxe.inf
new file mode 100644
index 0000000..4eb4666
--- /dev/null
+++ b/ReferenceCode/Haswell/PowerManagement/Dxe/PowerMgmtDxe.inf
@@ -0,0 +1,114 @@
+## @file
+# Component description file for Power Management module
+#
+#@copyright
+# Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains an 'Intel Peripheral Driver' and uniquely
+# identified as "Intel Reference Module" and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+
+[defines]
+BASE_NAME = PowerMgmtDxe
+FILE_GUID = f7731b4c-58a2-4df4-8980-5645d39ece58
+COMPONENT_TYPE = BS_DRIVER
+
+[sources.common]
+ PowerMgmtinit.h
+ PowerMgmtinit.c
+ PowerMgmtCommon.h
+ PerformanceStates.c
+ IdleStates.c
+ PowerLimits.c
+ Thermal.c
+ MiscFunctions.c
+
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueDxeDriverEntryPoint.c
+
+[includes.common]
+ .
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Library/BaseLib
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Framework
+ $(EFI_SOURCE)/Include
+ $(EFI_SOURCE)/Include/IndustryStandard
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include/Library
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/SampleCode
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/SampleCode/Include
+
+[libraries.common]
+ CpuGuidLib
+ CpuProtocolLib
+ DxeAslUpdateLib
+ EfiProtocolLib
+ EdkFrameworkProtocolLib
+ EdkIIGlueBaseLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueBaseMemoryLib
+ EdkIIGlueDxeMemoryAllocationLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueDxeReportStatusCodeLib
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueUefiDevicePathLib
+ EfiScriptLib
+ EdkProtocolLib
+ CpuPlatformLib
+ EfiCommonLib
+
+[libraries.ia32,libraries.x64]
+ CpuIa32Lib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = PowerMgmtDxe.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=InitializePowerManagement
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_LIB__ \
+ -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_DEVICE_PATH_LIB__
diff --git a/ReferenceCode/Haswell/PowerManagement/Dxe/PowerMgmtDxe.mak b/ReferenceCode/Haswell/PowerManagement/Dxe/PowerMgmtDxe.mak
new file mode 100644
index 0000000..3c65a6b
--- /dev/null
+++ b/ReferenceCode/Haswell/PowerManagement/Dxe/PowerMgmtDxe.mak
@@ -0,0 +1,82 @@
+# MAK file for the eModule:PowerManagement
+
+EDK : PowerMgmtDxe
+
+BUILD_PowerMgmtDxe_DIR = $(BUILD_DIR)\$(PowerMgmtDxe_DIR)
+
+$(BUILD_DIR)\PowerMgmtDxe.mak : $(PowerMgmtDxe_DIR)\PowerMgmtDxe.cif $(BUILD_RULES)
+ $(CIF2MAK) $(PowerMgmtDxe_DIR)\PowerMgmtDxe.cif $(CIF2MAK_DEFAULTS)
+
+PowerMgmtDxe : $(BUILD_DIR)\PowerMgmtDxe.MAK PowerMgmtDxeBin
+
+PowerMgmtDxe_OBJECTS = \
+ $(BUILD_PowerMgmtDxe_DIR)\IdleStates.obj \
+ $(BUILD_PowerMgmtDxe_DIR)\MiscFunctions.obj \
+ $(BUILD_PowerMgmtDxe_DIR)\PerformanceStates.obj \
+ $(BUILD_PowerMgmtDxe_DIR)\PowerLimits.obj \
+ $(BUILD_PowerMgmtDxe_DIR)\Thermal.obj \
+ $(BUILD_PowerMgmtDxe_DIR)\PowerMgmtInit.obj
+
+PowerMgmtDxe_MY_INCLUDES= \
+ $(EdkIIGlueLib_INCLUDES)\
+ /I$(EdkIIGlueBaseLib_DIR)\
+ $(EDK_INCLUDES)\
+ $(PROJECT_CPU_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+ $(INTEL_MCH_INCLUDES)\
+ $(INTEL_PLATFORM_PROTOCOL_INCLUDES)
+
+PowerMgmtDxe_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=InitializePowerManagement"\
+ /D __EDKII_GLUE_BASE_LIB__ \
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_UEFI_DEVICE_PATH_LIB__
+
+PowerMgmtDxe_LIBS =\
+ $(EFIGUIDLIB)\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(EDKPROTOCOLLIB)\
+ $(EFISCRIPTLIB)\
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueDxeServicesTableLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueUefiLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(EdkIIGlueDxeMemoryAllocationLib_LIB)\
+ $(EdkIIGlueBaseTimerLibLocalApic_LIB)\
+ $(EdkIIGlueDxeHobLib_LIB)\
+ $(EdkIIGlueHiiLib_LIB)\
+ $(EFIDRIVERLIB)\
+ $(UEFIEFIIFRSUPPORTLIB)\
+ $(CpuProtocolLib_LIB)\
+ $(CpuGuidLib_LIB)\
+ $(PchPlatformDxeLib_LIB)\
+ $(CpuPlatformLib_LIB)\
+ $(PpmAslUpdateLib_LIB)
+
+
+PowerMgmtDxeBin : $(PowerMgmtDxe_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\PowerMgmtDxe.mak all\
+ NAME=PowerMgmtDxe\
+ MAKEFILE=$(BUILD_DIR)\PowerMgmtDxe.mak \
+ "MY_INCLUDES=$(PowerMgmtDxe_MY_INCLUDES)" \
+ "MY_DEFINES=$(PowerMgmtDxe_DEFINES)"\
+ OBJECTS="$(PowerMgmtDxe_OBJECTS)" \
+ GUID=f7731b4c-58a2-4df4-8980-5645d39ece58\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=RT_DRIVER \
+ EDKIIModule=DXEDRIVER\
+ DEPEX1=$(PowerMgmtDxe_DIR)\PowerMgmtDxe.dxs \
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \
+ COMPRESS=1
diff --git a/ReferenceCode/Haswell/PowerManagement/Dxe/PowerMgmtDxe.sdl b/ReferenceCode/Haswell/PowerManagement/Dxe/PowerMgmtDxe.sdl
new file mode 100644
index 0000000..af4c594
--- /dev/null
+++ b/ReferenceCode/Haswell/PowerManagement/Dxe/PowerMgmtDxe.sdl
@@ -0,0 +1,25 @@
+TOKEN
+ Name = "Haswell_PowerMgmtDxe_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable Cpu Pei init support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "PowerMgmtDxe_DIR"
+End
+
+MODULE
+ Help = "Includes PowerMgmtDxe.mak to Project"
+ File = "PowerMgmtDxe.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PowerMgmtDxe.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/Haswell/PowerManagement/Dxe/PowerMgmtInit.c b/ReferenceCode/Haswell/PowerManagement/Dxe/PowerMgmtInit.c
new file mode 100644
index 0000000..414167d
--- /dev/null
+++ b/ReferenceCode/Haswell/PowerManagement/Dxe/PowerMgmtInit.c
@@ -0,0 +1,840 @@
+/** @file
+ Processor Power Management initialization code. This code determines current
+ user configuration and modifies and loads ASL as well as initializing chipset
+ and processor features to enable the proper power management.
+
+ Acronyms:
+ PPM - Processor Power Management
+ TM - Thermal Monitor
+ IST - Intel(R) Speedstep technology
+ HT - Hyper-Threading Technology
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+#include "PowerMgmtInit.h"
+
+//
+// Global variables
+//
+#include <Protocol\GlobalNvsArea\GlobalNvsArea.h> // <<<<
+///
+/// Power Managment policy configurations
+///
+POWER_MGMT_CONFIG *mCpuPmConfig = NULL;
+EFI_CPUID_REGISTER mCpuid01 = { 0, 0, 0, 0 }; // CPUID 01 values
+//
+// Values for FVID table calculate.
+//
+UINT16 mTurboBusRatio = 0;
+UINT16 mMaxBusRatio = 0;
+UINT16 mMinBusRatio = 0;
+UINT16 mProcessorFlavor = 0;
+UINT16 mBspBootRatio = 0;
+UINT16 mPackageTdp = 0; ///< Processor TDP value in MSR_PACKAGE_POWER_SKU.
+UINT16 mPackageTdpWatt = 0; ///< Processor TDP value in Watts.
+UINT16 mCpuConfigTdpBootRatio = 0; ///< Config TDP Boot settings
+UINT16 mCustomPowerUnit = 1;
+UINT16 mCpuCacheSize = 0; ///< Cache Size in KB
+UINT8 mCpuPolicyRevision = 0;
+DXE_CPU_PLATFORM_POLICY_PROTOCOL *mCpuPlatformPolicy = NULL;
+
+///
+/// Fractional part of Processor Power Unit in Watts. (i.e. Unit is 1/mProcessorPowerUnit)
+///
+UINT8 mProcessorPowerUnit = 0;
+///
+/// Maximum allowed power limit value in TURBO_POWER_LIMIT_MSR and PRIMARY_PLANE_POWER_LIMIT_MSR
+/// in units specified by PACKAGE_POWER_SKU_UNIT_MSR
+///
+UINT16 mPackageMaxPower = 0;
+///
+/// Minimum allowed power limit value in TURBO_POWER_LIMIT_MSR and PRIMARY_PLANE_POWER_LIMIT_MSR
+/// in units specified by PACKAGE_POWER_SKU_UNIT_MSR
+///
+UINT16 mPackageMinPower = 0;
+
+UINT8 mControllableTdpEnable = 0; ///< Controllable TDP enable/Disable
+UINT8 mRatioLimitProgrammble = 0; ///< Programmable Ratio Limit
+UINT8 mTdpLimitProgrammble = 0; ///< Porgrammable TDP Limit
+PPM_GLOBAL_NVS_AREA_PROTOCOL *mPpmGlobalNvsAreaProtocol = NULL; ///< Ppm GlobalNvs Protocol
+EFI_MP_SERVICES_PROTOCOL *mMpService = NULL; ///< Mp Services Protocol
+
+//
+// FVID Table Information
+// Default FVID table
+// One header field plus states
+//
+UINT16 mNumberOfStates = 0;
+FVID_TABLE mEmptyFvidTable[FVID_MAX_STATES + 1];
+FVID_TABLE *mFvidPointer = &mEmptyFvidTable[0];
+
+//
+// Globals to support updating ACPI Tables
+//
+EFI_ACPI_SUPPORT_PROTOCOL *mAcpiSupport = NULL;
+EFI_ACPI_TABLE_PROTOCOL *mAcpiTable = NULL;
+EFI_ACPI_DESCRIPTION_HEADER *mCpu0IstTable = NULL;
+EFI_ACPI_DESCRIPTION_HEADER *mApIstTable = NULL;
+EFI_ACPI_DESCRIPTION_HEADER *mCpu0CstTable = NULL;
+EFI_ACPI_DESCRIPTION_HEADER *mApCstTable = NULL;
+EFI_ACPI_DESCRIPTION_HEADER *mCpuPmTable = NULL;
+EFI_ACPI_DESCRIPTION_HEADER *mCpu0TstTable = NULL;
+EFI_ACPI_DESCRIPTION_HEADER *mApTstTable = NULL;
+EFI_ACPI_DESCRIPTION_HEADER *mLakeTinyTable = NULL;
+EFI_ACPI_DESCRIPTION_HEADER *mCtdpTable = NULL;
+
+/**
+ Initialize the power management support.
+ This function will do boot time configuration:
+ Detect HW capabilities and SW configuration
+ Initialize HW and software state (primarily MSR and ACPI tables)
+
+ @param[in] ImageHandle Pointer to the loaded image protocol for this driver
+ @param[in] SystemTable Pointer to the EFI System Table
+
+ @retval EFI_SUCCESS The driver installes/initialized correctly.
+ @retval Driver will ASSERT in debug builds on error. PPM functionality is considered critical for mobile systems.
+**/
+EFI_STATUS
+InitializePowerManagement (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ EFI_HANDLE Handle;
+ PPM_GLOBAL_NVS_AREA_PROTOCOL PpmGlobalNvsAreaProtocol;
+ EFI_GUID EfiPpmGlobalNvsAreaProtocolGuid = EFI_PPM_GLOBAL_NVS_AREA_PROTOCOL_GUID;
+
+ Handle = NULL;
+
+ ///
+ /// Locate platform configuration information
+ ///
+ Status = gBS->LocateProtocol (&gDxeCpuPlatformPolicyProtocolGuid, NULL, (VOID **) &mCpuPlatformPolicy);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Initialize the Global pointer for Power Managment Platform policy
+ ///
+ mCpuPmConfig = mCpuPlatformPolicy->PowerMgmtConfig;
+
+ Status = (gBS->AllocatePool) (EfiACPIMemoryNVS, sizeof (PPM_GLOBAL_NVS_AREA), (VOID **) &PpmGlobalNvsAreaProtocol.Area);
+ ASSERT_EFI_ERROR (Status);
+ ZeroMem ((VOID *) PpmGlobalNvsAreaProtocol.Area, sizeof (PPM_GLOBAL_NVS_AREA));
+
+ PpmGlobalNvsAreaProtocol.Area->Revision = PPM_GLOBAL_NVS_AREA_REVISION_1;
+ PpmGlobalNvsAreaProtocol.Area->MiscPowerManagementFlags |= mCpuPmConfig->pFunctionEnables->LakeTiny;
+
+ ///
+ /// Install Cpu Power management GlobalNVS Area protocol
+ ///
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &ImageHandle,
+ &EfiPpmGlobalNvsAreaProtocolGuid,
+ &PpmGlobalNvsAreaProtocol,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ DumpCpuPmConfig ();
+
+ ///
+ /// Locate the S3 resume scripting protocol
+ ///
+ INITIALIZE_SCRIPT (ImageHandle, SystemTable);
+
+ ///
+ /// Initialize Power management Global variables
+ ///
+ InitializePowerManagementGlobalVariables ();
+
+ ///
+ /// Initialize CPU Power management code (determine HW and configured state, configure hardware and software accordingly)
+ ///
+ Status = InitializePpm ();
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Install the PowerMgmtInitDone Protocol so that PowerMgmtS3 driver can load to save the MSRs for S3 resume
+ ///
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &Handle,
+ &gEfiPowerMgmtInitDoneProtocolGuid,
+ NULL,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Initializes the platform power management global variable.
+ This must be called prior to any of the functions being used.
+
+ @retval EFI_SUCCESS Library was initialized successfully
+ @retval EFI_DEVICE_ERROR If CPU is not supported by this library
+**/
+VOID
+InitializePowerManagementGlobalVariables (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ MSR_REGISTER TempMsr;
+ MSR_REGISTER PackagePowerSKUUnitMsr;
+ MSR_REGISTER PlatformInfoMsr;
+ EFI_GUID EfiMpServiceProtocolGuid = EFI_MP_SERVICES_PROTOCOL_GUID;
+ UINT16 Associativity;
+ UINT16 CachePartitions;
+ UINT16 CacheLineSize;
+ UINT16 CacheNumberofSets;
+ EFI_CPUID_REGISTER Cpuid04;
+// >>>>
+ EFI_GLOBAL_NVS_AREA_PROTOCOL *GlobalNvsArea;
+ EFI_GUID gEfiGlobalNvsAreaProtocolGuid = EFI_GLOBAL_NVS_AREA_PROTOCOL_GUID;
+// <<<<
+ //
+ // Read the CPUID information
+ //
+ AsmCpuid (CPUID_VERSION_INFO, &mCpuid01.RegEax, &mCpuid01.RegEbx, &mCpuid01.RegEcx, &mCpuid01.RegEdx);
+
+ ///
+ /// Locate Ppm GlobalNvs Protocol.
+ ///
+ Status = gBS->LocateProtocol (
+ &gPpmGlobalNvsAreaProtocolGuid,
+ NULL,
+ (VOID **) &mPpmGlobalNvsAreaProtocol
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "Ppm GloableNvs protocol not found"));
+ }
+ ASSERT_EFI_ERROR (Status);
+ if (mPpmGlobalNvsAreaProtocol != NULL) {
+ mPpmGlobalNvsAreaProtocol->Area->Cpuid = GetCpuFamily() | GetCpuStepping();
+ }
+
+ ///
+ /// Locate MP service protocol
+ ///
+ Status = gBS->LocateProtocol (
+ &EfiMpServiceProtocolGuid,
+ NULL,
+ (VOID **) &mMpService
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Get Platform ID by reading System Agent's Device ID (B0:D0:F0:R02)
+ ///
+ mProcessorFlavor = McD0PciCfg16 (R_SA_MC_DEVICE_ID);
+
+ //
+ // Read the CPUID4 information for LLC size
+ //
+ AsmCpuidEx (CPUID_FUNCTION_4, 0x3, &Cpuid04.RegEax, &Cpuid04.RegEbx, &Cpuid04.RegEcx, &Cpuid04.RegEdx);
+ //
+ // Determine Cache Size in Kilo Bytes
+ // This Cache Size in Bytes = (Associativity) * (Partitions + 1) * (Line_Size + 1) * (Sets + 1)
+ // = (EBX[31:22] + 1) * (EBX[21:12] + 1) * (EBX[11:0] + 1) * (ECX + 1)
+ //
+ Associativity = (UINT16) (((Cpuid04.RegEbx >> 22) & CPU_CACHE_ASSOCIATIVITY_MASK) + 1);
+ CachePartitions = (UINT16) (((Cpuid04.RegEbx >> 12) & CPU_CACHE_PARTITION_MASK) + 1);
+ CacheLineSize = (UINT16) (((UINT16) Cpuid04.RegEbx & CPU_CACHE_LINE_SIZE_MASK) + 1);
+ CacheNumberofSets = (UINT16) (Cpuid04.RegEcx + 1);
+ mCpuCacheSize = (UINT16) ((Associativity * CachePartitions * CacheLineSize * CacheNumberofSets) / 1024);
+ ///
+ /// Get Maximum Non-Turbo bus ratio (HFM) from Platform Info MSR Bits[15:8]
+ ///
+ PlatformInfoMsr.Qword = AsmReadMsr64 (MSR_PLATFORM_INFO);
+ mMaxBusRatio = PlatformInfoMsr.Bytes.SecondByte;
+ ///
+ /// Get Maximum Efficiency bus ratio (LFM) from Platform Info MSR Bits[47:40]
+ ///
+ mMinBusRatio = PlatformInfoMsr.Bytes.SixthByte;
+ ///
+ /// Get Max Turbo Ratio from Turbo Ratio Limit MSR Bits [7:0]
+ ///
+ TempMsr.Qword = AsmReadMsr64 (MSR_TURBO_RATIO_LIMIT);
+ mTurboBusRatio = (UINT16) (TempMsr.Dwords.Low & B_MSR_TURBO_RATIO_LIMIT_1C);
+ ///
+ /// Check if Turbo Ratio Limit is programmable
+ /// Platform Info MSR (0xCE) [28]
+ ///
+ mRatioLimitProgrammble = (UINT8) RShiftU64 ((PlatformInfoMsr.Qword & B_PLATFORM_INFO_RATIO_LIMIT), 28);
+ ///
+ /// Check if TDP Limit is programmable
+ /// Platform Info MSR (0xCE) [29]
+ ///
+ mTdpLimitProgrammble = (UINT8) RShiftU64 ((PlatformInfoMsr.Qword & B_PLATFORM_INFO_TDC_TDP_LIMIT), 29);
+
+ ///
+ /// Get Processor TDP
+ /// Get Maximum Power from Turbo Power Limit MSR Bits[14:0]
+ /// and convert it to units specified by Package Power SKU
+ /// Unit MSR [3:0]
+ ///
+ TempMsr.Qword = EfiReadMsr (MSR_PACKAGE_POWER_SKU);
+ PackagePowerSKUUnitMsr.Qword = EfiReadMsr (MSR_PACKAGE_POWER_SKU_UNIT);
+ mProcessorPowerUnit = (PackagePowerSKUUnitMsr.Bytes.FirstByte & PACKAGE_POWER_UNIT_MASK);
+ if (mProcessorPowerUnit == 0) {
+ mProcessorPowerUnit = 1;
+ } else {
+ mProcessorPowerUnit = (UINT8) LShiftU64 (2, (mProcessorPowerUnit - 1));
+ }
+ mPackageTdp = (TempMsr.Dwords.Low & PACKAGE_TDP_POWER_MASK);
+ mPackageTdpWatt = (UINT16) DivU64x32 (mPackageTdp , mProcessorPowerUnit);
+ mPackageMaxPower = (UINT16) (TempMsr.Dwords.High & PACKAGE_MAX_POWER_MASK);
+ mPackageMinPower = (UINT16) RShiftU64 ((TempMsr.Dwords.Low & PACKAGE_MIN_POWER_MASK), 16);
+ mCpuPolicyRevision = mCpuPlatformPolicy->Revision;
+
+ ///
+ /// Set mCustomPowerUnit to user selected Power unit
+ ///
+ mCustomPowerUnit = 1;
+ if ((mCpuPlatformPolicy->Revision >= DXE_PLATFORM_CPU_POLICY_PROTOCOL_REVISION_6 )
+ && (mCpuPmConfig->CustomPowerUnit == PowerUnit125MilliWatts)) {
+ mCustomPowerUnit = 8; ///< Unit is 125 milli watt
+ }
+
+ ///
+ /// If specified, create a custom the FVID table.
+ /// (The settings populating the FVID table may not be correct for the
+ /// specific processor, and it is up to the user to specify settings
+ /// applicable to the processor being used.)
+ ///
+ ZeroMem (mFvidPointer, sizeof (mEmptyFvidTable));
+ if (mCpuPmConfig->pCustomRatioTable->NumberOfEntries >= 2) {
+ CreateCustomFvidTable (mFvidPointer);
+ }
+
+ ///
+ /// Initialize flags based on processor capablities
+ ///
+ SetPpmFlags ();
+
+ ///
+ /// Determine current user configuration
+ ///
+ SetUserConfigurationPpmFlags ();
+
+// >>>>
+ //
+ // Locate the Global NVS Protocol.
+ //
+ Status = gBS->LocateProtocol (&gEfiGlobalNvsAreaProtocolGuid,
+ NULL, &GlobalNvsArea );
+ DEBUG((EFI_D_ERROR, "Status=gBS->LocateProtocol (&gEfiGlobalNvsAreaProtocolGuid) ===> %r !!!\n", Status));
+
+ if(!EFI_ERROR(Status)) {
+ GlobalNvsArea->Area->PpmFlags = mPpmGlobalNvsAreaProtocol->Area->PpmFlags;
+ }
+// <<<<
+ ///
+ /// Locate ACPI support protocol
+ ///
+ Status = gBS->LocateProtocol (&gEfiAcpiSupportProtocolGuid, NULL, (VOID **) &mAcpiSupport);
+ ASSERT_EFI_ERROR (Status);
+ Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **) &mAcpiTable);
+ ASSERT_EFI_ERROR (Status);
+ return;
+}
+
+/**
+ Create a custom FVID table based on setup options.
+ Caller is responsible for providing a large enough table.
+
+ @param[in] FvidPointer Table to update, must be initialized.
+**/
+VOID
+CreateCustomFvidTable (
+ IN OUT FVID_TABLE *FvidPointer
+ )
+{
+ UINT16 Index;
+
+ ///
+ /// BWG Section 14.6.2 Determining Number of Operating Points
+ /// It is recommended that system BIOS limit the number of P states to 16
+ ///
+ if (mCpuPmConfig->pCustomRatioTable->NumberOfEntries > FVID_MAX_STATES) {
+ DEBUG (
+ (EFI_D_WARN,
+ "VidNumber(%d) is greater than maximum(%d) supported.",
+ mCpuPmConfig->pCustomRatioTable->NumberOfEntries,
+ FVID_MAX_STATES)
+ );
+ mCpuPmConfig->pCustomRatioTable->NumberOfEntries = FVID_MAX_STATES;
+ }
+ ///
+ /// Fill in the table header
+ ///
+ FvidPointer[0].FvidHeader.Stepping = mCpuPmConfig->pCustomRatioTable->Cpuid;
+ FvidPointer[0].FvidHeader.MaxBusRatio = mCpuPmConfig->pCustomRatioTable->MaxRatio;
+ FvidPointer[0].FvidHeader.Gv3States = mCpuPmConfig->pCustomRatioTable->NumberOfEntries;
+ ///
+ /// Fill in the state data
+ ///
+ for (Index = 0; Index < mCpuPmConfig->pCustomRatioTable->NumberOfEntries; Index++) {
+ FvidPointer[Index + 1].FvidState.State = Index;
+ FvidPointer[Index + 1].FvidState.BusRatio = mCpuPmConfig->pCustomRatioTable->StateRatio[Index];
+ }
+}
+
+/**
+ Set the PPM flags specific to Haswell processors
+
+ @retval EFI_SUCCESS PpmFlags updated with the features supported by the processor
+**/
+VOID
+SetPpmFlags (
+ VOID
+ )
+{
+ MSR_REGISTER CoreThreadCount;
+ MSR_REGISTER Ia32MiscEnable;
+ EFI_CPUID_REGISTER Cpuid01;
+ EFI_CPUID_REGISTER Cpuid05;
+ EFI_CPUID_REGISTER Cpuid06;
+ UINTN States;
+ BOOLEAN CpuidLimitingEnabled;
+ UINT32 PpmFlags;
+
+ ZeroMem (&Cpuid01, sizeof (Cpuid01));
+ ZeroMem (&Cpuid05, sizeof (Cpuid05));
+ ZeroMem (&Cpuid06, sizeof (Cpuid06));
+ PpmFlags = 0;
+
+ ///
+ /// Check if the processor has multiple cores
+ ///
+ CoreThreadCount.Qword = AsmReadMsr64 (MSR_CORE_THREAD_COUNT);
+ if ((CoreThreadCount.Dwords.Low & B_THREAD_COUNT_MASK) > 1) {
+ PpmFlags |= PPM_CMP;
+ }
+ if (mCpuid01.RegEdx & B_CPUID_VERSION_INFO_EDX_TM1) { ///< Check TM capable and update the flag
+ PpmFlags |= PPM_TM;
+ }
+ ///
+ /// Check EIST capable. If EIST capable, also set the boot P-state to HFM flag.
+ ///
+ if (mCpuid01.RegEcx & B_CPUID_VERSION_INFO_ECX_EIST) {
+ PpmFlags |= (PPM_EIST);
+ DEBUG ((EFI_D_INFO, "GV3 capable\n"));
+ }
+ ///
+ /// Disable CPUID limiting (and save current setting) if enabled
+ /// and enable MONITOR/MWAIT support
+ ///
+ Ia32MiscEnable.Qword = AsmReadMsr64 (MSR_IA32_MISC_ENABLE);
+ CpuidLimitingEnabled = (BOOLEAN) (Ia32MiscEnable.Qword & B_MSR_IA32_MISC_ENABLE_CPUID_MAX);
+ if (CpuidLimitingEnabled) {
+ Ia32MiscEnable.Qword &= ~B_MSR_IA32_MISC_ENABLE_CPUID_MAX;
+ }
+ AsmWriteMsr64 (MSR_IA32_MISC_ENABLE, Ia32MiscEnable.Qword);
+ ///
+ /// Read the CPUID values we care about. We cannot use the stored
+ /// values because they may have changes since we disabled limiting
+ /// and enabled MONITOR/MWAIT
+ ///
+ AsmCpuid (1, &Cpuid01.RegEax, &Cpuid01.RegEbx, &Cpuid01.RegEcx, &Cpuid01.RegEdx);
+ AsmCpuid (5, &Cpuid05.RegEax, &Cpuid05.RegEbx, &Cpuid05.RegEcx, &Cpuid05.RegEdx);
+ AsmCpuid (6, &Cpuid06.RegEax, &Cpuid06.RegEbx, &Cpuid06.RegEcx, &Cpuid06.RegEdx);
+ ///
+ /// Determine if the MONITOR/MWAIT instructions are supported.
+ ///
+ if ((Cpuid01.RegEcx & B_CPUID_VERSION_INFO_ECX_MWAIT && Cpuid05.RegEcx & B_CPUID_MONITOR_MWAIT_ECX_EXTENSIONS)) {
+ PpmFlags |= PPM_MWAIT_EXT;
+ }
+ ///
+ /// Determine the C-State and Enhanced C-State support present.
+ /// Monitor/MWAIT parameters function describes the numbers supported.
+ ///
+ States = RShiftU64 (Cpuid05.RegEdx, 4) & 0xF;
+ if (States >= ENHANCED_CSTATE_SUPPORTED) {
+ PpmFlags |= PPM_C1 + PPM_C1E;
+ } else if (States == CSTATE_SUPPORTED) {
+ PpmFlags |= PPM_C1;
+ }
+ States = RShiftU64 (Cpuid05.RegEdx, 8) & 0xF;
+ if ((States >= CSTATE_SUPPORTED) && (PpmFlags & PPM_C1)) {
+ PpmFlags |= PPM_C3;
+ }
+ States = RShiftU64 (Cpuid05.RegEdx, 12) & 0xF;
+ if (States >= C6_C7_LONG_LATENCY_SUPPORTED) { // Both Long and Short Latency C6 supported
+ PpmFlags |= (PPM_C6 | C6_LONG_LATENCY_ENABLE);
+ } else if (States >= C6_C7_SHORT_LATENCY_SUPPORTED) { // Only Short Latency C6 supported.
+ PpmFlags |= PPM_C6;
+ }
+
+ States = RShiftU64 (Cpuid05.RegEdx, 16) & 0xF;
+ switch (States) {
+ case C7s_LONG_LATENCY_SUPPORTED:
+ //
+ // C7 & C7s Long and Short supported
+ //
+ PpmFlags |= (PPM_C7S | C7s_LONG_LATENCY_ENABLE | PPM_C7 | C7_LONG_LATENCY_ENABLE);
+ break;
+ case C7s_SHORT_LATENCY_SUPPORTED:
+ //
+ // C7s Long Latency is not supported.
+ //
+ PpmFlags |= (PPM_C7S | PPM_C7 | C7_LONG_LATENCY_ENABLE);
+ break;
+ case C6_C7_LONG_LATENCY_SUPPORTED:
+ //
+ // C7 Long and Short supported
+ //
+ PpmFlags |= (PPM_C7 | C7_LONG_LATENCY_ENABLE);
+ break;
+ case C6_C7_SHORT_LATENCY_SUPPORTED:
+ //
+ // C7 Long Latency is not supported.
+ //
+ PpmFlags |= PPM_C7;
+ break;
+ }
+
+ States = RShiftU64 (Cpuid05.RegEdx, 20) & 0xF;
+ if (States >= CSTATE_SUPPORTED) {
+ PpmFlags |= PPM_C8;
+ }
+ States = RShiftU64 (Cpuid05.RegEdx, 24) & 0xF;
+ if (States >= CSTATE_SUPPORTED) {
+ PpmFlags |= PPM_C9;
+ }
+ States = RShiftU64 (Cpuid05.RegEdx, 28) & 0xF;
+ if (States >= CSTATE_SUPPORTED) {
+ PpmFlags |= PPM_C10;
+ }
+ ///
+ /// Check TimedMwait is supported and update the flag
+ ///
+ if (AsmReadMsr64 (MSR_PLATFORM_INFO) & B_PLATFORM_INFO_TIMED_MWAIT_SUPPORTED) {
+ PpmFlags |= PPM_TIMED_MWAIT;
+ }
+ if (PpmFlags & (PPM_C8 |PPM_C9 | PPM_C10)) {
+ PpmFlags |= PPM_CD;
+ }
+ ///
+ /// Check if turbo mode is supported and update the flag
+ ///
+ Ia32MiscEnable.Qword = AsmReadMsr64 (MSR_IA32_MISC_ENABLE);
+ if (((Cpuid06.RegEax & B_CPUID_POWER_MANAGEMENT_EAX_TURBO) == 0) &&
+ ((Ia32MiscEnable.Qword & B_MSR_IA32_MISC_DISABLE_TURBO) == 0)
+ ) {
+ ///
+ /// Turbo Mode is not available in this physical processor package.
+ /// BIOS should not attempt to enable Turbo Mode via IA32_MISC_ENABLE MSR.
+ /// BIOS should show Turbo Mode as Disabled and Not Configurable.
+ ///
+ } else if ((Cpuid06.RegEax & B_CPUID_POWER_MANAGEMENT_EAX_TURBO) == 0) {
+ ///
+ /// Turbo Mode is available but globally disabled for the all logical
+ /// processors in this processor package.
+ /// BIOS can enable Turbo Mode by IA32_MISC_ENABLE MSR 1A0h bit [38] = 0.
+ ///
+ PpmFlags |= PPM_TURBO;
+ } else if ((Cpuid06.RegEax & B_CPUID_POWER_MANAGEMENT_EAX_TURBO) == B_CPUID_POWER_MANAGEMENT_EAX_TURBO) {
+ ///
+ /// Turbo Mode is factory-configured as available and enabled for all logical processors in this processor package.
+ /// This case handles the cases where turbo mode is enabled before PPM gets chance to enable it
+ ///
+ PpmFlags |= PPM_TURBO;
+ }
+ ///
+ /// Restore the CPUID limit setting.
+ ///
+ if (CpuidLimitingEnabled) {
+ Ia32MiscEnable.Qword = AsmReadMsr64 (MSR_IA32_MISC_ENABLE);
+ Ia32MiscEnable.Qword |= B_MSR_IA32_MISC_ENABLE_CPUID_MAX;
+ AsmWriteMsr64 (MSR_IA32_MISC_ENABLE, Ia32MiscEnable.Qword);
+ }
+ PpmFlags |= PPM_TSTATES; ///< Set the T-states flag
+ ///
+ /// Determine if Fine grained clock modulation contol is supported
+ ///
+ if (Cpuid06.RegEax & B_CPUID_POWER_MANAGEMENT_EAX_FINE_GRAINED_CLOCK_MODULATION) {
+ PpmFlags |= PPM_TSTATE_FINE_GRAINED;
+ }
+ PpmFlags |= PPM_EEPST; ///< Energy Efficient P-state feature is supported
+ mPpmGlobalNvsAreaProtocol->Area->PpmFlags = PpmFlags; ///< Update the PPM NVS area PPM flags
+
+ return;
+}
+
+/**
+ Set the PPM flags based on current user configuration
+**/
+VOID
+SetUserConfigurationPpmFlags (
+ VOID
+ )
+{
+ UINT32 UserPpmFlag;
+ //
+ // In advance to clear following PPM flags which are related with policies that user can enabled/disabled.
+ //
+ UserPpmFlag = (UINT32)~(PPM_EIST | PPM_C1 | PPM_C1E | PPM_C3 | PPM_C6 | C6_LONG_LATENCY_ENABLE |
+ PPM_C7S | PPM_C7 | C7_LONG_LATENCY_ENABLE | C7s_LONG_LATENCY_ENABLE | PPM_CD |
+ PPM_C8 | PPM_C9 | PPM_C10 | PPM_TM | PPM_TURBO | PPM_TSTATES | PPM_TSTATE_FINE_GRAINED |
+ PPM_EEPST | PPM_TIMED_MWAIT);
+ ///
+ /// Configure flag based on user selections
+ ///
+ if (mCpuPmConfig->pFunctionEnables->Eist) {
+ UserPpmFlag |= PPM_EIST;
+ }
+ if (mCpuPmConfig->pFunctionEnables->Cx) {
+ UserPpmFlag |= PPM_C1;
+ if (mCpuPmConfig->pFunctionEnables->C1e) {
+ UserPpmFlag |= PPM_C1E;
+ }
+ if (mCpuPmConfig->pFunctionEnables->C3) {
+ UserPpmFlag |= PPM_C3;
+ }
+ if (mCpuPmConfig->pFunctionEnables->C6) {
+ UserPpmFlag |= PPM_C6;
+ }
+ if (mCpuPmConfig->pFunctionEnables->LongLatencyC6) {
+ UserPpmFlag |= C6_LONG_LATENCY_ENABLE;
+ }
+ switch (mCpuPmConfig->pFunctionEnables->DeepCState) {
+ case DeepC7S:
+ UserPpmFlag |= PPM_C7S;
+ case DeepC7:
+ UserPpmFlag |= PPM_C7;
+ break;
+ }
+ if (mCpuPmConfig->pFunctionEnables->LongLatencyC7) {
+ UserPpmFlag |= (C7_LONG_LATENCY_ENABLE | C7s_LONG_LATENCY_ENABLE);
+ }
+ if (mCpuPmConfig->pFunctionEnables->C8) {
+ UserPpmFlag |= PPM_C8;
+ }
+ if (mCpuPmConfig->pFunctionEnables->C9) {
+ UserPpmFlag |= PPM_C9;
+ }
+ if (mCpuPmConfig->pFunctionEnables->C10) {
+ UserPpmFlag |= PPM_C10;
+ }
+ if (UserPpmFlag & (PPM_C8 |PPM_C9 | PPM_C10)) {
+ UserPpmFlag |= PPM_CD;
+ }
+ }
+ if (mCpuPmConfig->ThermalFuncEnables->ThermalMonitor) {
+ UserPpmFlag |= PPM_TM;
+ }
+ if (mCpuPmConfig->pFunctionEnables->TurboMode) {
+ UserPpmFlag |= PPM_TURBO;
+ }
+ if (mCpuPmConfig->ThermalFuncEnables->TStates) {
+ UserPpmFlag |= (PPM_TSTATES | PPM_TSTATE_FINE_GRAINED);
+ }
+ if (mCpuPmConfig->pFunctionEnables->EnergyEfficientPState) {
+ UserPpmFlag |= PPM_EEPST;
+ }
+ if (mCpuPmConfig->pFunctionEnables->TimedMwait) {
+ UserPpmFlag |= PPM_TIMED_MWAIT;
+ }
+ ///
+ /// Modify PpmFlags based on user selections
+ ///
+ mPpmGlobalNvsAreaProtocol->Area->PpmFlags &= UserPpmFlag;
+}
+
+/**
+ Initialize the processor power management based on hardware capabilities
+ and user configuration settings.
+
+ @retval EFI_SUCCESS - on success
+ @retval Appropiate failure code on error
+**/
+EFI_STATUS
+InitializePpm (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ EFI_STATUS CtdpSupport;
+
+ Status = EFI_SUCCESS;
+ CtdpSupport = EFI_UNSUPPORTED;
+
+ ///
+ /// Initialize Config TDP
+ ///
+ CtdpSupport = InitializeConfigurableTdp (mCpuPmConfig);
+
+ ///
+ /// Initialize P states
+ ///
+ InitializePStates();
+
+ ///
+ /// Initialize C State(IdleStates)
+ ///
+ InitializeCState(mCpuPmConfig);
+
+ //
+ // Patch P state table (Fvid table) with ctdp settings.
+ //
+ CtdpPatchFvidTable (mFvidPointer);
+
+ Status = InitializePpmAcpiTable ();
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ ///
+ /// Initialize thermal features
+ ///
+ InitThermal (mCpuPmConfig);
+
+ ///
+ /// Initialise Miscellaneous features
+ ///
+ InitMiscFeatures(CtdpSupport);
+
+ ///
+ /// Complete with Ppmpost initialization
+ ///
+ PpmPostInit ();
+
+ return Status;
+}
+
+
+/**
+ This is a debug function to print PPM Policy
+**/
+VOID
+DumpCpuPmConfig (
+ VOID
+ )
+{
+#ifdef EFI_DEBUG
+ UINT32 Index;
+ DEBUG ((EFI_D_INFO, "\n\n------------------------ PowerMangement Policy dump Begin -----------------\n\n"));
+ DEBUG ((EFI_D_INFO, " S3RestoreMsrSwSmiNumber : %x\n", mCpuPmConfig->S3RestoreMsrSwSmiNumber));
+ DEBUG ((EFI_D_INFO, "\n Ppm Lock Enables... \n"));
+ DEBUG ((EFI_D_INFO, " PmgCstCfgCtrlLock : %x\n", mCpuPmConfig->pPpmLockEnables->PmgCstCfgCtrlLock));
+ DEBUG ((EFI_D_INFO, " ProcHotLock : %x\n", mCpuPmConfig->pPpmLockEnables->ProcHotLock));
+ DEBUG ((EFI_D_INFO, "\n FunctionEnables... \n"));
+ DEBUG ((EFI_D_INFO, " Eist : %x\n", mCpuPmConfig->pFunctionEnables->Eist));
+ DEBUG ((EFI_D_INFO, " Cx : %x\n", mCpuPmConfig->pFunctionEnables->Cx));
+ DEBUG ((EFI_D_INFO, " C1e : %x\n", mCpuPmConfig->pFunctionEnables->C1e));
+ DEBUG ((EFI_D_INFO, " C3 : %x\n", mCpuPmConfig->pFunctionEnables->C3));
+ DEBUG ((EFI_D_INFO, " C6 : %x\n", mCpuPmConfig->pFunctionEnables->C6));
+ DEBUG ((EFI_D_INFO, " C6 Long Latency: %x\n", mCpuPmConfig->pFunctionEnables->LongLatencyC6));
+ DEBUG ((EFI_D_INFO, " DeepCState : %x\n", mCpuPmConfig->pFunctionEnables->DeepCState));
+ DEBUG ((EFI_D_INFO, " C7 Long Latency : %x\n", mCpuPmConfig->pFunctionEnables->LongLatencyC7));
+ DEBUG ((EFI_D_INFO, " C1Autodemotion : %x\n", mCpuPmConfig->pFunctionEnables->C1AutoDemotion));
+ DEBUG ((EFI_D_INFO, " C3AutoDemotion : %x\n", mCpuPmConfig->pFunctionEnables->C3AutoDemotion));
+ DEBUG ((EFI_D_INFO, " C1Undemotion : %x\n", mCpuPmConfig->pFunctionEnables->C1UnDemotion));
+ DEBUG ((EFI_D_INFO, " C3UnDemotion : %x\n", mCpuPmConfig->pFunctionEnables->C3UnDemotion));
+ DEBUG ((EFI_D_INFO, " PkgCstateUndemotion : %x\n", mCpuPmConfig->pFunctionEnables->PkgCStateUnDemotion));
+ DEBUG ((EFI_D_INFO, " PkgCState Demotion : %x\n", mCpuPmConfig->pFunctionEnables->PkgCStateDemotion));
+ DEBUG ((EFI_D_INFO, " CStatePreWake : %x\n", mCpuPmConfig->pFunctionEnables->CStatePreWake));
+ DEBUG ((EFI_D_INFO, " TurboMode : %x\n", mCpuPmConfig->pFunctionEnables->TurboMode));
+ DEBUG ((EFI_D_INFO, " PowerLimit2 : %x\n", mCpuPmConfig->pFunctionEnables->PowerLimit2));
+ DEBUG ((EFI_D_INFO, " EnergyEfficientPState : %x\n", mCpuPmConfig->pFunctionEnables->EnergyEfficientPState));
+ DEBUG ((EFI_D_INFO, " LakeTiny Support : %x\n", mCpuPmConfig->pFunctionEnables->LakeTiny));
+ DEBUG ((EFI_D_INFO, " PkgCStateLimit : %x\n", mCpuPmConfig->PkgCStateLimit));
+ DEBUG ((EFI_D_INFO, " TimedMwait : %x\n", mCpuPmConfig->pFunctionEnables->TimedMwait));
+ DEBUG ((EFI_D_INFO, " CstateLatencyControl0TimeUnit : %x\n", mCpuPmConfig->CstateLatencyControl0TimeUnit));
+ DEBUG ((EFI_D_INFO, " CstateLatencyControl1TimeUnit : %x\n", mCpuPmConfig->CstateLatencyControl1TimeUnit));
+ DEBUG ((EFI_D_INFO, " CstateLatencyControl2TimeUnit : %x\n", mCpuPmConfig->CstateLatencyControl2TimeUnit));
+ DEBUG ((EFI_D_INFO, " CstateLatencyControl3TimeUnit : %x\n", mCpuPmConfig->CstateLatencyControl3TimeUnit));
+ DEBUG ((EFI_D_INFO, " CstateLatencyControl4TimeUnit : %x\n", mCpuPmConfig->CstateLatencyControl4TimeUnit));
+ DEBUG ((EFI_D_INFO, " CstateLatencyControl5TimeUnit : %x\n", mCpuPmConfig->CstateLatencyControl5TimeUnit));
+ DEBUG ((EFI_D_INFO, " CstateLatencyControl0Irtl : %x\n", mCpuPmConfig->CstateLatencyControl0Irtl));
+ DEBUG ((EFI_D_INFO, " CstateLatencyControl1Irtl : %x\n", mCpuPmConfig->CstateLatencyControl1Irtl));
+ DEBUG ((EFI_D_INFO, " CstateLatencyControl2Irtl : %x\n", mCpuPmConfig->CstateLatencyControl2Irtl));
+ DEBUG ((EFI_D_INFO, " RfiFreqTunningOffsetIsNegative : %x\n", mCpuPmConfig->RfiFreqTunningOffsetIsNegative));
+ DEBUG ((EFI_D_INFO, " RfiFreqTunningOffset : %x\n", mCpuPmConfig->RfiFreqTunningOffset));
+ DEBUG ((EFI_D_INFO, "\n Turbo settings... \n"));
+ DEBUG ((EFI_D_INFO, " PowerLimit1 : %x\n", mCpuPmConfig->pTurboSettings->PowerLimit1));
+ DEBUG ((EFI_D_INFO, " PowerLimit1Time : %x\n", mCpuPmConfig->pTurboSettings->PowerLimit1Time));
+ DEBUG ((EFI_D_INFO, " PowerLimit2 : %x\n", mCpuPmConfig->pTurboSettings->PowerLimit2));
+ DEBUG ((EFI_D_INFO, " PowerLimit3 : %x\n", mCpuPmConfig->pTurboSettings->PowerLimit3));
+ DEBUG ((EFI_D_INFO, " PowerLimit3Time : %x\n", mCpuPmConfig->pTurboSettings->PowerLimit3Time));
+ DEBUG ((EFI_D_INFO, " PowerLimit3DutyCycle : %x\n", mCpuPmConfig->pTurboSettings->PowerLimit3DutyCycle));
+ DEBUG ((EFI_D_INFO, " PowerLimit3Lock : %x\n", mCpuPmConfig->pTurboSettings->PowerLimit3Lock));
+ DEBUG ((EFI_D_INFO, " TurboPowerLimitLock : %x\n", mCpuPmConfig->pTurboSettings->TurboPowerLimitLock));
+ DEBUG ((EFI_D_INFO, " ConfigTdpLevel : %x\n", mCpuPmConfig->pTurboSettings->ConfigTdpLevel));
+ DEBUG ((EFI_D_INFO, " ConfigTdpLock : %x\n", mCpuPmConfig->pTurboSettings->ConfigTdpLock));
+ DEBUG ((EFI_D_INFO, " ConfigTdpCustom : %x\n", mCpuPmConfig->pCustomCtdpSettings->ConfigTdpCustom));
+ if (mCpuPmConfig->pCustomCtdpSettings->ConfigTdpCustom) {
+ DEBUG ((EFI_D_INFO, " CustomTdpCount : %d\n", mCpuPmConfig->pCustomCtdpSettings->CustomTdpCount));
+ DEBUG ((EFI_D_INFO, " CustomBootModeIndex : %d\n", mCpuPmConfig->pCustomCtdpSettings->CustomBootModeIndex));
+ for (Index = 0; Index < MAX_CUSTOM_CTDP_ENTRIES; Index++) {
+ DEBUG (
+ (EFI_D_INFO,
+ " CustomConfigTdpTable[%d] CustomPowerLimit1 : 0x%x\n",
+ Index,mCpuPmConfig->pCustomCtdpSettings->CustomConfigTdpTable[Index].CustomPowerLimit1)
+ );
+ DEBUG (
+ (EFI_D_INFO,
+ " CustomConfigTdpTable[%d] CustomPowerLimit2 : 0x%x\n",
+ Index,mCpuPmConfig->pCustomCtdpSettings->CustomConfigTdpTable[Index].CustomPowerLimit2)
+ );
+ DEBUG (
+ (EFI_D_INFO,
+ " CustomConfigTdpTable[%d] CustomPowerLimit1Time : %d\n",
+ Index,mCpuPmConfig->pCustomCtdpSettings->CustomConfigTdpTable[Index].CustomPowerLimit1Time)
+ );
+ DEBUG (
+ (EFI_D_INFO,
+ " CustomConfigTdpTable[%d] CustomTurboActivationRatio : %d\n",
+ Index,mCpuPmConfig->pCustomCtdpSettings->CustomConfigTdpTable[Index].CustomTurboActivationRatio)
+ );
+ DEBUG (
+ (EFI_D_INFO,
+ " ConfigTdpTable[%d] CustomConfigTdpControl : %d\n",
+ Index,mCpuPmConfig->pCustomCtdpSettings->CustomConfigTdpTable[Index].CustomConfigTdpControl)
+ );
+ }
+ }
+ DEBUG ((EFI_D_INFO, "\n CustomRatioTable... \n"));
+ DEBUG ((EFI_D_INFO, " VidNumber : %x\n", mCpuPmConfig->pCustomRatioTable->NumberOfEntries));
+ DEBUG ((EFI_D_INFO, " VidCpuid : %x\n", mCpuPmConfig->pCustomRatioTable->Cpuid));
+ DEBUG ((EFI_D_INFO, " VidMaxRatio : %x\n", mCpuPmConfig->pCustomRatioTable->MaxRatio));
+ for (Index = 0; Index < MAX_CUSTOM_RATIO_TABLE_ENTRIES; Index++) {
+ DEBUG ((EFI_D_INFO, " StateRatio[%d] : %x\n", Index, mCpuPmConfig->pCustomRatioTable->StateRatio[Index]));
+ }
+ DEBUG ((EFI_D_INFO, "\n XeConfig... \n"));
+ DEBUG ((EFI_D_INFO, " Xe : %x\n", mCpuPmConfig->pFunctionEnables->Xe));
+ for (Index = 0; Index < 4; Index++) {
+ DEBUG ((EFI_D_INFO, " RatioLimit[%d] : %x\n", Index, mCpuPmConfig->pRatioLimit[Index]));
+ }
+ DEBUG ((EFI_D_INFO, " BiProcHot : %x\n", mCpuPmConfig->ThermalFuncEnables->BiProcHot));
+ DEBUG ((EFI_D_INFO, " DisableProcHotOut : %x\n", mCpuPmConfig->ThermalFuncEnables->DisableProcHotOut));
+ DEBUG ((EFI_D_INFO, " DisableVRThermalAlert : %x\n", mCpuPmConfig->ThermalFuncEnables->DisableVRThermalAlert));
+ DEBUG ((EFI_D_INFO, " ProcHotResponce : %x\n", mCpuPmConfig->ThermalFuncEnables->ProcHotResponce));
+ DEBUG ((EFI_D_INFO, " TStates : %x\n", mCpuPmConfig->ThermalFuncEnables->TStates));
+ DEBUG ((EFI_D_INFO, " AutoThermalReporting : %x\n", mCpuPmConfig->ThermalFuncEnables->AutoThermalReporting));
+ DEBUG ((EFI_D_INFO, " ThermalMonitor : %x\n", mCpuPmConfig->ThermalFuncEnables->ThermalMonitor));
+ DEBUG ((EFI_D_INFO, "\n\n------------------------ PowerMangement Policy dump End -------------------\n\n"));
+#endif
+}
diff --git a/ReferenceCode/Haswell/PowerManagement/Dxe/PowerMgmtInit.h b/ReferenceCode/Haswell/PowerManagement/Dxe/PowerMgmtInit.h
new file mode 100644
index 0000000..9e138c6
--- /dev/null
+++ b/ReferenceCode/Haswell/PowerManagement/Dxe/PowerMgmtInit.h
@@ -0,0 +1,127 @@
+/** @file
+ This header file contains power management definitions specific to
+ Haswell processors.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _POWER_MANAGEMENT_H_
+#define _POWER_MANAGEMENT_H_
+
+#include "PowerMgmtCommon.h"
+
+//
+// Function prototypes
+//
+/**
+ Initialize the power management support.
+ This function will do boot time configuration:
+ Install into SMRAM/SMM
+ Detect HW capabilities and SW configuration
+ Initialize HW and software state (primarily MSR and ACPI tables)
+ Install SMI handlers for runtime interfacess
+
+ @param[in] ImageHandle Pointer to the loaded image protocol for this driver
+ @param[in] SystemTable Pointer to the EFI System Table
+
+ @retval EFI_SUCCESS The driver installed/initialized correctly.
+ @retval Driver will ASSERT in debug builds on error. PPM functionality is considered critical for mobile systems.
+**/
+EFI_STATUS
+InitializePowerManagement (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ );
+
+/**
+ Initializes the CPU power management global variable.
+ This must be called prior to any of the functions being used.
+
+ @retval EFI_SUCCESS Library was initialized successfully
+ @retval EFI_DEVICE_ERROR If CPU is not supported by this library
+**/
+VOID
+InitializePowerManagementGlobalVariables (
+ VOID
+ );
+
+/**
+ Create a custom FVID table based on setup options.
+ Caller is responsible for providing a large enough table.
+
+ @param[in] FvidPointer Table to update, must be initialized.
+**/
+VOID
+CreateCustomFvidTable (
+ IN OUT FVID_TABLE *FvidPointer
+ );
+
+/**
+ Sets up the PPM flags based upon capabilities
+
+ @param[in] This - None
+
+ @retval EFI_STATUS
+**/
+VOID
+SetPpmFlags (
+ VOID
+ );
+
+/**
+ Set the PPM flags based on current user configuration obtained from PPM platform policy protocol
+
+ @param[in] PpmFlagsMask Mask of feature options to be enabled as specified by the policy
+**/
+VOID
+SetUserConfigurationPpmFlags (
+ );
+
+/**
+ Initialize the platform power management based on hardware capabilities
+ and user configuration settings.
+
+ This includes creating FVID table, updating ACPI tables,
+ and updating processor and chipset hardware configuration.
+
+ This should be called prior to any Px, Cx, Tx activity.
+
+ @retval EFI_SUCCESS - on success
+ @retval Appropiate failure code on error
+**/
+EFI_STATUS
+InitializePpm (
+ VOID
+ );
+
+/**
+ This is a debug function to print PPM Policy
+**/
+VOID
+DumpCpuPmConfig (
+ VOID
+ );
+
+/**
+ This is a debug function to print PPM Global NVS area
+**/
+VOID
+DumpPPMGlobalNvs (
+ VOID
+ );
+
+#endif
diff --git a/ReferenceCode/Haswell/PowerManagement/Dxe/Thermal.c b/ReferenceCode/Haswell/PowerManagement/Dxe/Thermal.c
new file mode 100644
index 0000000..d60635e
--- /dev/null
+++ b/ReferenceCode/Haswell/PowerManagement/Dxe/Thermal.c
@@ -0,0 +1,301 @@
+/** @file
+ This library contains power management configuration functions for
+ Haswell processors.
+
+ Acronyms:
+ PPM - Processor Power Management
+ TM - Thermal Monitor
+ IST - Intel(R) Speedstep technology
+ HT - Hyper-Threading Technology
+
+@copyright
+ Copyright (c) 2012 - 2014 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "PowerMgmtCommon.h"
+
+/**
+ This will perform general thermal initialization other then TM1, TM2, or
+ PROCHOT# on all logical processors.
+
+ @param[in] CpuPmConfig Pointer to policy protocol instance
+ @param[in] PpmGlobalNvsAreaProtocol Pointer to PPM Global Nvs area
+
+ @retval EFI_SUCCESS General thermal initialization completed successfully
+**/
+VOID
+InitThermal (
+ IN OUT POWER_MGMT_CONFIG *CpuPmConfig
+ )
+{
+ MSR_REGISTER TempMsr;
+ UINT8 MaxRefTemp;
+ CPU_FAMILY CpuFamilyId;
+ CPU_STEPPING CpuStepping;
+ UINT8 TccActivationOffsetMask;
+
+ ///
+ /// Run thermal code on all logical processors.
+ ///
+ RunOnAllLogicalProcessors (ApSafeInitThermal, CpuPmConfig);
+ ///
+ /// Automatic Thermal Reporting for Thermal Management
+ ///
+ if (CpuPmConfig->ThermalFuncEnables->AutoThermalReporting) {
+ ///
+ /// Thermal Reporting for Critical trip
+ /// MSR 1A2 bits 23:16 define the temperature that this specific processor can
+ /// function upto. It is recommended that this value + 5 be used as default Critical trip point
+ /// _CRT.
+ ///
+ TempMsr.Qword = AsmReadMsr64 (MSR_TEMPERATURE_TARGET);
+ TempMsr.Qword &= B_MSR_TEMPERATURE_TARGET_TCC_ACTIVATION_TEMPERATURE_MASK;
+ MaxRefTemp = (UINT8) RShiftU64 (TempMsr.Qword, N_MSR_TEMPERATURE_TARGET_TCC_ACTIVATION_TEMPERATURE_OFFSET);
+ mPpmGlobalNvsAreaProtocol->Area->AutoCriticalTripPoint = MaxRefTemp + 5;
+ ///
+ /// Thermal Reporting for Active Thermal Management
+ /// It is recommended that the processor specific value in MSR 1A2 bits 15:8
+ /// be used as the highest Active trip point i.e. _AC0.
+ ///
+ TempMsr.Qword = AsmReadMsr64 (MSR_TEMPERATURE_TARGET);
+ TempMsr.Qword &= B_MSR_TEMPERATURE_TARGET_FAN_TEMP_TARGET_OFFSET;
+ mPpmGlobalNvsAreaProtocol->Area->AutoActiveTripPoint = MaxRefTemp - (UINT8) RShiftU64 (
+ TempMsr.Qword,
+ N_MSR_TEMPERATURE_TARGET_FAN_TEMP_TARGET_OFFSET
+ );
+
+ ///
+ /// Tcc activation offset in temperature target MSR changes from 4 bits [27:24] to 6 bits [29:24] on ULT C step onwards
+ ///
+ CpuFamilyId = mPpmGlobalNvsAreaProtocol->Area->Cpuid & CPUID_FULL_FAMILY_MODEL;
+ CpuStepping = mPpmGlobalNvsAreaProtocol->Area->Cpuid & CPUID_FULL_STEPPING;
+ if ((CpuFamilyId == EnumCpuHswUlt) && (CpuStepping >= EnumHswUltC0)) {
+ TccActivationOffsetMask = 0x3F;
+ } else {
+ TccActivationOffsetMask = 0xF;
+ }
+
+ ///
+ /// Thermal Reporting for Passive Thermal Management
+ /// On all turbo enabled systems, it is recommended that the ACPI _PSV point be
+ /// set to a temperature above the Active cooling temperature and Tcc activation
+ /// temperature.
+ /// If platform embedded controller will issue PECI commands to reduce power as a
+ /// passive thermal action, then it is recommended to use the package's max temperature
+ /// for passive thermal control.
+ ///
+ TempMsr.Qword = AsmReadMsr64 (MSR_TEMPERATURE_TARGET);
+ TempMsr.Qword &= (TccActivationOffsetMask << N_MSR_TEMPERATURE_TARGET_TCC_OFFSET_LIMIT);
+ mPpmGlobalNvsAreaProtocol->Area->AutoPassiveTripPoint = mPpmGlobalNvsAreaProtocol->Area->AutoCriticalTripPoint+3;
+ }
+
+ EnableProcHot ();
+ return;
+}
+
+/**
+ This will perform enable thermal initialization. TM1, TM2 and adaptive thermal
+ throttling are enabled/disabled together.
+
+ This function must be MP safe.
+
+ @param[in] Buffer Pointer to the function parameters passed in.
+
+ @retval EFI_SUCCESS General thermal initialization completed successfully
+**/
+VOID
+EFIAPI
+ApSafeInitThermal (
+ IN OUT VOID *Buffer
+ )
+{
+ MSR_REGISTER TempMsr;
+ POWER_MGMT_CONFIG *This;
+
+ ///
+ /// Extract parameters from the buffer
+ ///
+ This = (POWER_MGMT_CONFIG *) Buffer;
+ ///
+ /// Configure Adaptive thermal monitor. IA32_MISC_ENABLE[3]
+ /// HSW BWG (1A0h)IA32_MISC_ENABLE - Bit3:Intel Adaptive Thermal Monitor Enable
+ /// System BIOS must always set this bit to be operating within spec.
+ ///
+ TempMsr.Qword = AsmReadMsr64 (MSR_IA32_MISC_ENABLE);
+ TempMsr.Dwords.Low |= B_MSR_IA32_MISC_ENABLE_TME;
+ if (This->ThermalFuncEnables->ThermalMonitor == 0) {
+ TempMsr.Dwords.Low &= ~B_MSR_IA32_MISC_ENABLE_TME;
+ }
+ AsmWriteMsr64 (MSR_IA32_MISC_ENABLE, TempMsr.Qword);
+ ///
+ /// Set the Lock TM interrupt bit so that thermal interrupts are routed to all the cores
+ ///
+ TempMsr.Qword = AsmReadMsr64 (MSR_MISC_PWR_MGMT);
+ TempMsr.Qword |= B_MSR_MISC_PWR_MGMT_LTMI;
+ AsmWriteMsr64 (MSR_MISC_PWR_MGMT, TempMsr.Qword);
+ ///
+ /// Enable Critical Temperature Interrupt
+ ///
+ TempMsr.Qword = AsmReadMsr64 (IA32_THERM_INTERRUPT);
+ TempMsr.Qword |= B_IA32_THERM_INTERRUPT_VIE;
+ AsmWriteMsr64 (IA32_THERM_INTERRUPT, TempMsr.Qword);
+
+ return;
+}
+
+/**
+ Enables the bi-directional PROCHOT# signal.
+
+ @retval EFI_SUCCESS PROCHOT# configured successfully
+**/
+EFI_STATUS
+EnableProcHot (
+ VOID
+ )
+{
+ MSR_REGISTER PowerCtl;
+
+ ///
+ /// Enable PROCHOT# in the CPU MSR if TM is enabled,
+ /// else disable it.
+ ///
+ PowerCtl.Qword = AsmReadMsr64 (MSR_POWER_CTL);
+ if (mPpmGlobalNvsAreaProtocol->Area->PpmFlags & (PPM_TM)) {
+ PowerCtl.Qword &= ~B_MSR_POWER_CTL_DISABLE_VR_THERMAL_ALERT;
+ if ((mCpuPmConfig->ThermalFuncEnables->DisableVRThermalAlert == 1)) {
+ DEBUG ((EFI_D_INFO, "VR Thermal Alert is disabled\n"));
+ PowerCtl.Qword |= B_MSR_POWER_CTL_DISABLE_VR_THERMAL_ALERT;
+ }
+ ///
+ /// Check PROCHOT Lock,skip programming the below as it will lock bits 0, 21, 22
+ ///
+ if (!(PowerCtl.Qword & B_MSR_POWER_CTL_PROC_HOT_LOCK)) {
+ PowerCtl.Qword &= ~B_MSR_POWER_CTL_BROCHOT;
+ if (mCpuPmConfig->ThermalFuncEnables->BiProcHot) {
+ PowerCtl.Qword |= B_MSR_POWER_CTL_BROCHOT;
+ ///
+ /// Initialize PROCHOT# OUT basing on Bi-directional PROCHOT# setting
+ /// If Bi-directional PROCHOT# is enabled, PROCHOT# OUT can be disabled selectively
+ ///
+ PowerCtl.Qword &= ~B_MSR_POWER_CTL_DISABLE_PHOT_OUT;
+ if ((mCpuPmConfig->ThermalFuncEnables->DisableProcHotOut == 1)) {
+ DEBUG ((EFI_D_INFO, "PROCHOT# OUT is disabled\n"));
+ PowerCtl.Qword |= B_MSR_POWER_CTL_DISABLE_PHOT_OUT;
+ }
+ }
+ PowerCtl.Qword &= ~B_MSR_POWER_CTL_PROC_HOT_RESPONSE;
+ if ((mCpuPmConfig->ThermalFuncEnables->ProcHotResponce == 1)) {
+ DEBUG ((EFI_D_INFO, "PROCHOT# Response is enabled\n"));
+ PowerCtl.Qword |= B_MSR_POWER_CTL_PROC_HOT_RESPONSE;
+ }
+ }
+ AsmWriteMsr64 (MSR_POWER_CTL, PowerCtl.Qword);
+ }
+
+ return EFI_SUCCESS;
+}
+/**
+ This will perform PowerLimit 1 algorithm will be used to control Thermal Throttling features
+
+ @param[in] CpuPmConfig Pointer to policy protocol instance
+**/
+VOID
+InitPl1ThermalControl (
+ IN OUT POWER_MGMT_CONFIG *CpuPmConfig
+ )
+{
+ UINT32 MailBoxStatus;
+ PL1_THERMAL_CONTROL WritePL1ThermalControl;
+ PL1_THERMAL_CONTROL ReadPL1ThermalControl;
+ CPU_FAMILY CpuFamilyId;
+ CPU_STEPPING CpuSteppingId;
+ MSR_REGISTER PakagePowerLimitMsr;
+ UINTN PciD0F0RegBase;
+ UINTN MchBar;
+
+ MailBoxStatus = 0;
+ ReadPL1ThermalControl.Uint32 = 0;
+ WritePL1ThermalControl.Uint32 = 0;
+
+ CpuFamilyId = mPpmGlobalNvsAreaProtocol->Area->Cpuid & CPUID_FULL_FAMILY_MODEL;
+ CpuSteppingId = mPpmGlobalNvsAreaProtocol->Area->Cpuid & CPUID_FULL_STEPPING;
+
+
+ if (((CpuFamilyId == EnumCpuHswUlt) && (CpuSteppingId >= EnumHswUltC0))
+ || ((CpuFamilyId == EnumCpuHsw) && (CpuSteppingId >= EnumHswC0))
+ || ((CpuFamilyId == EnumCpuCrw) && (CpuSteppingId >= EnumCrwC0))
+ ) {
+ ///
+ /// If User selects Auto,Enable by default on ULX and disable on orther processor
+ ///
+ if (CpuPmConfig->ThermalFuncEnables->Pl1ThermalControl == 1) { // 0 = disable, 1 = enable (manual), 2 = auto
+ WritePL1ThermalControl.Bits.Disable = 0;
+ } else if (CpuPmConfig->ThermalFuncEnables->Pl1ThermalControl == 2) {
+ if (mPackageTdp < 15 * mProcessorPowerUnit) { // ULX
+ WritePL1ThermalControl.Bits.Disable = 0;
+ } else {
+ WritePL1ThermalControl.Bits.Disable = 1;
+ }
+ } else {
+ WritePL1ThermalControl.Bits.Disable = 1;
+ }
+ if (mCpuPolicyRevision >= 7) {
+ WritePL1ThermalControl.Bits.FloorIA = CpuPmConfig->ThermalFuncEnables->Pl1ThermalControlFloor.FloorIA;
+ WritePL1ThermalControl.Bits.FloorGT = CpuPmConfig->ThermalFuncEnables->Pl1ThermalControlFloor.FloorGT;
+ WritePL1ThermalControl.Bits.FloorPCH = CpuPmConfig->ThermalFuncEnables->Pl1ThermalControlFloor.FloorPCH;
+ }
+
+ MailboxRead(MAILBOX_TYPE_PCODE, READ_PL1_DUTY_CYCLE_CLAMP_ENABLE, (UINT32 *) &ReadPL1ThermalControl, &MailBoxStatus);
+ if (MailBoxStatus != PCODE_MAILBOX_CC_SUCCESS) {
+ DEBUG ((EFI_D_ERROR, "Failure to read PowerLimit1 duty sysle clamp enable. \n"));
+ return;
+ }
+ DEBUG ((EFI_D_INFO, "Current Pl1ThermalControl reading from Mailbox : %d. Requested setting to Mailbox: %d\n", ReadPL1ThermalControl.Uint32, WritePL1ThermalControl.Uint32));
+ ///
+ /// If Mailbox returns differnt from user selection send command to set user selection
+ ///
+ if (ReadPL1ThermalControl.Uint32 != WritePL1ThermalControl.Uint32) {
+ MailboxWrite(MAILBOX_TYPE_PCODE, WRITE_PL1_DUTY_CYCLE_CLAMP_ENABLE, WritePL1ThermalControl.Uint32,&MailBoxStatus);
+ if (MailBoxStatus != PCODE_MAILBOX_CC_SUCCESS) {
+ DEBUG ((EFI_D_ERROR, "Failure to write PowerLimit1 duty sysle clamp enable. \n"));
+ return;
+ }
+ }
+ MailboxS3Write(WRITE_PL1_DUTY_CYCLE_CLAMP_ENABLE, WritePL1ThermalControl.Uint32);
+
+ ///
+ /// Set PACKAGE_POWER_LIMIT.CRITICAL_POWER_CLAMP_1(bit 16)
+ /// And MMIO_TURBO_POWER_LIMIT.CRITICAL_POWER_CLAMP_1(bit 16)
+ ///
+ PakagePowerLimitMsr.Qword = AsmReadMsr64 (MSR_PACKAGE_POWER_LIMIT);
+ PakagePowerLimitMsr.Dwords.Low |= B_CRITICAL_POWER_CLAMP_ENABLE;
+ AsmWriteMsr64 (MSR_PACKAGE_POWER_LIMIT, PakagePowerLimitMsr.Qword);
+
+ PciD0F0RegBase = MmPciAddress (0, 0, 0, 0, 0);
+ MchBar = MmioRead32 (PciD0F0RegBase + 0x48) &~BIT0;
+ MmioOr32 (MchBar + MMIO_TURBO_POWER_LIMIT, B_CRITICAL_POWER_CLAMP_ENABLE);
+
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) (MchBar + MMIO_TURBO_POWER_LIMIT),
+ 1,
+ (VOID *) (UINTN) (MchBar + MMIO_TURBO_POWER_LIMIT)
+ );
+ }
+ return;
+}
diff --git a/ReferenceCode/Haswell/PowerManagement/Smm/PowerMgmtS3.c b/ReferenceCode/Haswell/PowerManagement/Smm/PowerMgmtS3.c
new file mode 100644
index 0000000..6a26231
--- /dev/null
+++ b/ReferenceCode/Haswell/PowerManagement/Smm/PowerMgmtS3.c
@@ -0,0 +1,333 @@
+/** @file
+ This is the SMM driver for saving and restoring the powermanagement related MSRs
+
+@copyright
+ Copyright (c) 2011 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "PowerMgmtS3.h"
+#include "PowerMgmtDefinitions.h"
+#include "CpuAccess.h"
+#include "CpuPlatformLib.h"
+
+#include EFI_PROTOCOL_DEPENDENCY (CpuPlatformPolicy)
+#include EFI_PROTOCOL_DEPENDENCY (SmmSwDispatch)
+#include EFI_PROTOCOL_DEPENDENCY (SmmBase)
+
+///
+/// SMM system table pointer
+///
+EFI_SMM_SYSTEM_TABLE *mSmst;
+DXE_CPU_PLATFORM_POLICY_PROTOCOL *mCpuPlatformPolicy;
+///
+/// MSR table for S3 resume
+///
+STATIC EFI_MSR_VALUES mMsrValues[] = {
+ { MSR_IA32_PERF_CTRL, 0, B_IA32_PERF_CTRLP_STATE_TARGET, TRUE },
+ { MSR_PMG_IO_CAPTURE_BASE, 0, 0xFFFFFFFFFFFFFFFF, TRUE },
+ { MSR_PMG_CST_CONFIG, 0, 0xFFFFFFFFFFFFFFFF, TRUE },
+ { MSR_MISC_PWR_MGMT, 0, 0xFFFFFFFFFFFFFFFF, TRUE },
+ { MSR_IA32_MISC_ENABLE, 0, B_CPUID_POWER_MANAGEMENT_EAX_TURBO | B_MSR_IA32_MISC_DISABLE_TURBO | B_MSR_IA32_MISC_ENABLE_MONITOR | B_MSR_IA32_MISC_ENABLE_TME | B_MSR_IA32_MISC_ENABLE_EIST, TRUE },
+ { MSR_POWER_CTL, 0, 0xFFFFFFFFFFFFFFFF, TRUE },
+ { MSR_PACKAGE_POWER_LIMIT, 0, 0xFFFFFFFFFFFFFFFF, TRUE },
+ { MSR_PLATFORM_POWER_LIMIT, 0, 0xFFFFFFFFFFFFFFFF, FALSE },
+ { MSR_C_STATE_LATENCY_CONTROL_0, 0, 0xFFFFFFFFFFFFFFFF, TRUE },
+ { MSR_C_STATE_LATENCY_CONTROL_1, 0, 0xFFFFFFFFFFFFFFFF, TRUE },
+ { MSR_C_STATE_LATENCY_CONTROL_2, 0, 0xFFFFFFFFFFFFFFFF, TRUE },
+ { MSR_C_STATE_LATENCY_CONTROL_3, 0, 0xFFFFFFFFFFFFFFFF, FALSE },
+ { MSR_C_STATE_LATENCY_CONTROL_4, 0, 0xFFFFFFFFFFFFFFFF, FALSE },
+ { MSR_C_STATE_LATENCY_CONTROL_5, 0, 0xFFFFFFFFFFFFFFFF, FALSE },
+ { MSR_FLEX_RATIO, 0, 0xFFFFFFFFFFFFFFFF, TRUE },
+ { MSR_IA32_ENERGY_PERFORMANCE_BIAS, 0, 0xFFFFFFFFFFFFFFFF, TRUE },
+ { MSR_CONFIG_TDP_CONTROL, 0, 0xFFFFFFFFFFFFFFFF, FALSE },
+ { MSR_RFI_TUNNING, 0, 0xFFFFFFFFFFFFFFFF, FALSE },
+ { MSR_TURBO_ACTIVATION_RATIO, 0, 0xFFFFFFFFFFFFFFFF, FALSE },
+ { MSR_DDR_RAPL_LIMIT, 0, 0xFFFFFFFFFFFFFFFF, FALSE },
+ { MSR_TURBO_RATIO_LIMIT, 0, 0xFFFFFFFFFFFFFFFF, TRUE }
+};
+
+/**
+ Save processor MSR runtime settings for S3.
+
+ @retval EFI_SUCCESS Processor MSR setting is saved.
+**/
+STATIC
+EFI_STATUS
+S3SaveMsr (
+ VOID
+ )
+{
+ UINT32 Index;
+ EFI_CPUID_REGISTER Cpuid06 = { 0, 0, 0, 0 };
+ UINT64 MsrValue;
+
+ for (Index = 0; Index < sizeof (mMsrValues) / sizeof (EFI_MSR_VALUES); Index++) {
+ DEBUG ((EFI_D_INFO, " MSR Number: %x\n", mMsrValues[Index].Index));
+ if (mMsrValues[Index].Index == MSR_IA32_ENERGY_PERFORMANCE_BIAS) {
+ ///
+ /// MSR_IA32_ENERGY_PERFORMANCE_BIAS (1B0h) is accessible only if CPUID(6), ECX[3] = 1 to indicate feature availability.
+ ///
+ AsmCpuid (CPUID_FUNCTION_6, &Cpuid06.RegEax, &Cpuid06.RegEbx, &Cpuid06.RegEcx, &Cpuid06.RegEdx);
+ if (!(Cpuid06.RegEcx & B_CPUID_POWER_MANAGEMENT_ECX_ENERGY_EFFICIENT_POLICY_SUPPORT)) {
+ mMsrValues[Index].RestoreFlag = FALSE;
+ continue;
+ }
+ }
+ ///
+ /// Check for HSW specific MSRs
+ ///
+ MsrValue = AsmReadMsr64 (MSR_PLATFORM_INFO);
+ ///
+ ///
+ /// Check PLATFORM_INFO MSR[34:33] > 0 before accessing the MSR_CONFIG_TDP_CONTROL
+ ///
+ if ((mMsrValues[Index].Index == MSR_CONFIG_TDP_CONTROL) &&
+ ((RShiftU64 (MsrValue, N_MSR_PLATFORM_INFO_CONFIG_TDP_NUM_LEVELS_OFFSET) & 0x03))
+ ) {
+ mMsrValues[Index].RestoreFlag = TRUE;
+ }
+ ///
+ /// MSR_TURBO_ACTIVATION_RATIO, MSR_DDR_RAPL_LIMIT, MSR_RFI_TUNNING are supported only on HSW A0 or above.
+ ///
+ if (mMsrValues[Index].Index == MSR_TURBO_ACTIVATION_RATIO) {
+ mMsrValues[Index].RestoreFlag = TRUE;
+ }
+ if (mMsrValues[Index].Index == MSR_DDR_RAPL_LIMIT) {
+ mMsrValues[Index].RestoreFlag = TRUE;
+ }
+ ///
+ /// Check PLATFORM_INFO MSR[25] == 1 before accessing the MSR_RFI_TUNNING
+ ///
+ if (mMsrValues[Index].Index == MSR_RFI_TUNNING) {
+ if ((mCpuPlatformPolicy->PowerMgmtConfig->RfiFreqTunningOffset != AUTO) && (MsrValue & B_FIVR_RFI_TUNING_AVAIL)) {
+ mMsrValues[Index].RestoreFlag = TRUE;
+ }
+ }
+
+ if(GetCpuSku()== EnumCpuUlt) {
+ if ((mMsrValues[Index].Index == MSR_C_STATE_LATENCY_CONTROL_3) ||
+ (mMsrValues[Index].Index == MSR_C_STATE_LATENCY_CONTROL_4)||
+ (mMsrValues[Index].Index == MSR_C_STATE_LATENCY_CONTROL_5)){
+ mMsrValues[Index].RestoreFlag = TRUE;
+ }
+ }
+
+ ///
+ /// PL3 is supported on HSW ULT C0 & HSW C0 and later
+ ///
+ if (mMsrValues[Index].Index == MSR_PLATFORM_POWER_LIMIT) {
+ if (((GetCpuFamily() == EnumCpuHsw) && (GetCpuStepping() >= EnumHswC0))
+ || ((GetCpuFamily() == EnumCpuHswUlt) && (GetCpuStepping() >= EnumHswUltC0))) {
+ mMsrValues[Index].RestoreFlag = TRUE;
+ }
+ }
+
+ if (mMsrValues[Index].RestoreFlag == TRUE) {
+ mMsrValues[Index].Value = AsmReadMsr64 (mMsrValues[Index].Index);
+ DEBUG ((EFI_D_INFO, " MSR Number %x read Done \n", mMsrValues[Index].Index));
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Restore processor MSR runtime settings for S3.
+
+ @param[in] DispatchHandle - The handle of this callback, obtained when registering
+ @param[in] DispatchContex - Pointer to the EFI_SMM_SW_DISPATCH_CONTEXT
+
+ @retval EFI_SUCCESS Processor MSR setting is restored.
+**/
+void
+S3RestoreMsr (
+ IN EFI_HANDLE DispatchHandle,
+ IN EFI_SMM_SW_DISPATCH_CONTEXT *DispatchContex
+ )
+{
+ ///
+ /// Restore MSR's on all logical processors.
+ ///
+ RunOnAllLogicalProcessors (ApSafeRestoreMsr, NULL);
+}
+
+/**
+ Runs the specified procedure on all logical processors, passing in the
+ parameter buffer to the procedure.
+
+ @param[in] Procedure The function to be run.
+ @param[in] Buffer Pointer to a parameter buffer.
+
+ @retval EFI_SUCCESS
+**/
+STATIC
+EFI_STATUS
+RunOnAllLogicalProcessors (
+ IN OUT EFI_AP_PROCEDURE Procedure,
+ IN OUT VOID *Buffer
+ )
+{
+ UINTN Index;
+ EFI_STATUS Status;
+ ///
+ /// Run the procedure on all logical processors.
+ ///
+ (*Procedure)(Buffer);
+ for (Index = 1; Index < mSmst->NumberOfCpus; Index++) {
+ Status = EFI_NOT_READY;
+ while (Status != EFI_SUCCESS) {
+ Status = mSmst->SmmStartupThisAp (Procedure, Index, Buffer);
+ if (Status != EFI_SUCCESS) {
+ ///
+ /// SmmStartupThisAp might return failure if AP is busy executing some other code. Let's wait for sometime and try again.
+ ///
+ PchPmTimerStall (PPM_WAIT_PERIOD);
+ }
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This function will restore MSR settings.
+
+ This function must be MP safe.
+
+ @param[in] Buffer Unused
+
+ @retval EFI_SUCCESS MSR restored
+**/
+VOID
+EFIAPI
+ApSafeRestoreMsr (
+ IN OUT VOID *Buffer
+ )
+{
+ UINT32 Index;
+ UINT64 MsrValue;
+
+ for (Index = 0; Index < sizeof (mMsrValues) / sizeof (EFI_MSR_VALUES); Index++) {
+ ///
+ /// Check RestoreFlag and skip restoring the MSR if it is set to FALSE
+ ///
+ if (mMsrValues[Index].RestoreFlag == FALSE) {
+ DEBUG ((EFI_D_INFO, "Skipping MSR : %x as RestoreFalg is set to FALSE \n", mMsrValues[Index].Index));
+ continue;
+ }
+ ///
+ /// Check for Lock bits before programming
+ ///
+ MsrValue = AsmReadMsr64 (mMsrValues[Index].Index);
+ if ((mMsrValues[Index].Index == MSR_CONFIG_TDP_CONTROL) && (MsrValue & CONFIG_TDP_CONTROL_LOCK)) {
+ continue;
+ }
+
+ if ((mMsrValues[Index].Index == MSR_TURBO_ACTIVATION_RATIO) && (MsrValue & MSR_TURBO_ACTIVATION_RATIO_LOCK)) {
+ continue;
+ }
+
+ if ((mMsrValues[Index].Index == MSR_PACKAGE_POWER_LIMIT) && (MsrValue & B_POWER_LIMIT_LOCK)) {
+ continue;
+ }
+
+ if ((mMsrValues[Index].Index == MSR_PLATFORM_POWER_LIMIT) && (MsrValue & B_POWER_LIMIT_LOCK)) {
+ continue;
+ }
+
+ if ((mMsrValues[Index].Index == MSR_DDR_RAPL_LIMIT) && (MsrValue & B_POWER_LIMIT_LOCK)) {
+ continue;
+ }
+
+ MsrValue = AsmReadMsr64 (mMsrValues[Index].Index);
+ MsrValue &= ~mMsrValues[Index].BitMask;
+ MsrValue |= (mMsrValues[Index].Value & mMsrValues[Index].BitMask);
+ AsmWriteMsr64 (mMsrValues[Index].Index, MsrValue);
+ }
+
+ return;
+}
+
+/**
+ Initialize the S3 power management Handler.
+
+ @param[in] ImageHandle - Pointer to the loaded image protocol for this driver
+ @param[in] SystemTable - Pointer to the EFI System Table
+
+ @retval EFI_SUCCESS The driver installes/initialized correctly.
+**/
+EFI_STATUS
+PowerMgmtS3SmmEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+
+ EFI_STATUS Status;
+ EFI_SMM_SW_DISPATCH_CONTEXT SwContext;
+ EFI_SMM_SW_DISPATCH_PROTOCOL *SwDispatch;
+ EFI_HANDLE SwHandle;
+ EFI_SMM_BASE_PROTOCOL *SmmBase;
+
+ SwHandle = 0;
+ DEBUG ((EFI_D_INFO, " PpmS3SmmEntryPoint Started : \n"));
+ ///
+ /// Determine if we are in boot service or SMM.
+ ///
+ Status = gBS->LocateProtocol (&gEfiSmmBaseProtocolGuid, NULL, (VOID **) &SmmBase);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Initialize global variables
+ ///
+ Status = SmmBase->GetSmstLocation (SmmBase, &mSmst);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Locate platform configuration information
+ ///
+ Status = gBS->LocateProtocol (&gDxeCpuPlatformPolicyProtocolGuid, NULL, (VOID **) &mCpuPlatformPolicy);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Locate the ICH SMM SW dispatch protocol
+ ///
+ Status = gBS->LocateProtocol (&gEfiSmmSwDispatchProtocolGuid, NULL, (VOID **) &SwDispatch);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Register ACPI S3 MSR restore handler
+ ///
+ SwContext.SwSmiInputValue = mCpuPlatformPolicy->PowerMgmtConfig->S3RestoreMsrSwSmiNumber;
+
+ Status = SwDispatch->Register (
+ SwDispatch,
+ (EFI_SMM_SW_DISPATCH) S3RestoreMsr,
+ &SwContext,
+ &SwHandle
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Save MSRs for S3 Resume.
+ ///
+ DEBUG ((EFI_D_INFO, " Saving Processor MSR for S3 Resume \n"));
+
+ S3SaveMsr ();
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/Haswell/PowerManagement/Smm/PowerMgmtS3.cif b/ReferenceCode/Haswell/PowerManagement/Smm/PowerMgmtS3.cif
new file mode 100644
index 0000000..8e974fc
--- /dev/null
+++ b/ReferenceCode/Haswell/PowerManagement/Smm/PowerMgmtS3.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "PowerMgmtS3"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Haswell\PowerManagement\Smm"
+ RefName = "PowerMgmtS3"
+[files]
+"PowerMgmtS3.mak"
+"PowerMgmtS3.sdl"
+"PowerMgmtS3.inf"
+"PowerMgmtS3.c"
+"PowerMgmtS3.dxs"
+"PowerMgmtS3.h"
+<endComponent>
diff --git a/ReferenceCode/Haswell/PowerManagement/Smm/PowerMgmtS3.dxs b/ReferenceCode/Haswell/PowerManagement/Smm/PowerMgmtS3.dxs
new file mode 100644
index 0000000..9a4a4a2
--- /dev/null
+++ b/ReferenceCode/Haswell/PowerManagement/Smm/PowerMgmtS3.dxs
@@ -0,0 +1,45 @@
+/** @file
+ Dispatch dependency expression file for the PpmS3Dxe driver.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+#include "AutoGen.h"
+#include "DxeDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+
+//-#include EFI_PROTOCOL_DEFINITION (SmmControl)
+#include EFI_PROTOCOL_DEFINITION (SmmBase)
+#include EFI_PROTOCOL_DEPENDENCY (SmmSwDispatch)
+#include EFI_PROTOCOL_DEFINITION (PowerMgmtInitDone)
+#include EFI_PROTOCOL_DEFINITION (SaInfo)
+#endif
+
+DEPENDENCY_START
+ //-EFI_SMM_CONTROL_PROTOCOL_GUID AND
+ EFI_SMM_BASE_PROTOCOL_GUID AND
+ EFI_SMM_SW_DISPATCH_PROTOCOL_GUID AND
+ EFI_POWER_MGMT_INIT_DONE_PROTOCOL_GUID AND
+ EFI_SA_INFO_PROTOCOL_GUID
+DEPENDENCY_END
diff --git a/ReferenceCode/Haswell/PowerManagement/Smm/PowerMgmtS3.h b/ReferenceCode/Haswell/PowerManagement/Smm/PowerMgmtS3.h
new file mode 100644
index 0000000..211ef02
--- /dev/null
+++ b/ReferenceCode/Haswell/PowerManagement/Smm/PowerMgmtS3.h
@@ -0,0 +1,68 @@
+/** @file
+ Header file for PpmS3 Smm Driver.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _POWER_MGMT_S3_SMM_H_
+#define _POWER_MGMT_S3_SMM_H_
+
+#include "EdkIIGlueDxe.h"
+#include "EfiScriptLib.h"
+#include "PchAccess.h"
+#include "PchPlatformLib.h"
+
+#define PPM_WAIT_PERIOD 15
+
+typedef struct _EFI_MSR_VALUES {
+ UINT16 Index;
+ UINT64 Value;
+ UINT64 BitMask;
+ BOOLEAN RestoreFlag;
+} EFI_MSR_VALUES;
+
+/**
+ Runs the specified procedure on all logical processors, passing in the
+ parameter buffer to the procedure.
+
+ @param[in] Procedure The function to be run.
+ @param[in] Buffer Pointer to a parameter buffer.
+
+ @retval EFI_SUCCESS
+**/
+STATIC
+EFI_STATUS
+RunOnAllLogicalProcessors (
+ IN OUT EFI_AP_PROCEDURE Procedure,
+ IN OUT VOID *Buffer
+ );
+/**
+ This function will restore MSR settings.
+
+ This function must be MP safe.
+
+ @param[in] Buffer Unused
+
+ @retval EFI_SUCCESS MSR restored
+**/
+VOID
+EFIAPI
+ApSafeRestoreMsr (
+ IN OUT VOID *Buffer
+ );
+
+#endif
diff --git a/ReferenceCode/Haswell/PowerManagement/Smm/PowerMgmtS3.inf b/ReferenceCode/Haswell/PowerManagement/Smm/PowerMgmtS3.inf
new file mode 100644
index 0000000..8b93a5d
--- /dev/null
+++ b/ReferenceCode/Haswell/PowerManagement/Smm/PowerMgmtS3.inf
@@ -0,0 +1,97 @@
+## @file
+# Component description file for PowerManagementDxe driver
+#
+#@copyright
+# Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = PowerMgmtS3
+FILE_GUID = 8F0B5301-C79B-44f1-8FD3-26D73E316700
+COMPONENT_TYPE = RT_DRIVER
+
+[sources.common]
+ PowerMgmtS3.h
+ PowerMgmtS3.c
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueSmmDriverEntryPoint.c
+
+[includes.common]
+ .
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EFI_SOURCE)/Include
+ $(EFI_SOURCE)/Include/IndustryStandard
+ $(EFI_SOURCE)/Framework
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include/Library
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/protocol
+
+[libraries.common]
+ CpuGuidLib
+ CpuProtocolLib
+ DxeAslUpdateLib
+ EfiProtocolLib
+ EdkFrameworkProtocolLib
+ EdkIIGlueBaseLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueBaseMemoryLib
+ EdkIIGlueDxeMemoryAllocationLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueSmmRuntimeDxeReportStatusCodeLib
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueUefiDevicePathLib
+ EfiScriptLib
+ EdkProtocolLib
+ EfiRuntimeLib
+ PchPlatformLib
+ CpuPlatformLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = PowerMgmtS3.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS)-D __EDKII_GLUE_MODULE_ENTRY_POINT__=PowerMgmtS3SmmEntryPoint
+ C_FLAGS = $(C_FLAGS)-D __EDKII_GLUE_BASE_LIB__ \
+ -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_SMM_RUNTIME_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_DEVICE_PATH_LIB__ \ No newline at end of file
diff --git a/ReferenceCode/Haswell/PowerManagement/Smm/PowerMgmtS3.mak b/ReferenceCode/Haswell/PowerManagement/Smm/PowerMgmtS3.mak
new file mode 100644
index 0000000..e534020
--- /dev/null
+++ b/ReferenceCode/Haswell/PowerManagement/Smm/PowerMgmtS3.mak
@@ -0,0 +1,64 @@
+# MAK file for the Module Part: PowerMgmtS3
+
+EDK : PowerMgmtS3
+
+BUILD_PowerMgmtS3_DIR = $(BUILD_DIR)\$(PowerMgmtS3_DIR)
+
+$(BUILD_DIR)\PowerMgmtS3.mak : $(PowerMgmtS3_DIR)\PowerMgmtS3.cif $(BUILD_RULES)
+ $(CIF2MAK) $(PowerMgmtS3_DIR)\PowerMgmtS3.cif $(CIF2MAK_DEFAULTS)
+
+PowerMgmtS3 : $(BUILD_DIR)\PowerMgmtS3.mak PowerMgmtS3Bin
+
+PowerMgmtS3_OBJECTS = \
+ $(BUILD_PowerMgmtS3_DIR)\PowerMgmtS3.obj
+
+
+PowerMgmtS3_MY_INCLUDES= \
+ $(EDK_INCLUDES) \
+ $(PROJECT_CPU_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+ $(INTEL_MCH_INCLUDES)
+
+
+PowerMgmtS3_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=PowerMgmtS3SmmEntryPoint"\
+ /D __EDKII_GLUE_BASE_LIB__ \
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_SMM_RUNTIME_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_UEFI_DEVICE_PATH_LIB__
+
+PowerMgmtS3_LIBS =\
+ $(EFIGUIDLIB)\
+ $(EDKFRAMEWORKGUIDLIB)\
+ $(EDKPROTOCOLLIB)\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueSmmRuntimeDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(CpuProtocolLib_LIB)\
+ $(CpuPlatformLib_LIB)\
+ $(PchPlatformSmmLib_LIB)
+
+PowerMgmtS3Bin : $(PowerMgmtS3_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\PowerMgmtS3.mak all\
+ MAKEFILE=$(BUILD_DIR)\PowerMgmtS3.mak \
+ "MY_INCLUDES=$(PowerMgmtS3_MY_INCLUDES)" \
+ "MY_DEFINES=$(PowerMgmtS3_DEFINES)"\
+ OBJECTS="$(PowerMgmtS3_OBJECTS)" \
+ GUID=8F0B5301-C79B-44f1-8FD3-26D73E316700\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=RT_DRIVER \
+ EDKIIModule=SMMDRIVER\
+ DEPEX1=$(PowerMgmtS3_DIR)\PowerMgmtS3.dxs \
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \
+ COMPRESS=1
+
diff --git a/ReferenceCode/Haswell/PowerManagement/Smm/PowerMgmtS3.sdl b/ReferenceCode/Haswell/PowerManagement/Smm/PowerMgmtS3.sdl
new file mode 100644
index 0000000..513e535
--- /dev/null
+++ b/ReferenceCode/Haswell/PowerManagement/Smm/PowerMgmtS3.sdl
@@ -0,0 +1,25 @@
+TOKEN
+ Name = "Haswell_PowerMgmtS3_SUPPORT"
+ Value = "1"
+ Help = "Main switch to include CPU RC PowerMgmtS3 driver to the Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "PowerMgmtS3_DIR"
+End
+
+MODULE
+ Help = "Includes PowerMgmtS3.mak to Project"
+ File = "PowerMgmtS3.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PowerMgmtS3.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/Haswell/Ppi/Cache/Cache.c b/ReferenceCode/Haswell/Ppi/Cache/Cache.c
new file mode 100644
index 0000000..75e8535
--- /dev/null
+++ b/ReferenceCode/Haswell/Ppi/Cache/Cache.c
@@ -0,0 +1,25 @@
+/** @file
+ CPU IO PPI GUID as defined in EFI 2.0
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains 'Framework Code' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may not be modified, except as allowed by
+ additional terms of your license agreement.
+**/
+#include "Tiano.h"
+#include "Pei.h"
+#include EFI_PPI_DEFINITION (Cache)
+
+EFI_GUID gPeiCachePpiGuid = PEI_CACHE_PPI_GUID;
+
+EFI_GUID_STRING(&gPeiCachePpiGuid, "Cache", "Cache PPI");
diff --git a/ReferenceCode/Haswell/Ppi/Cache/Cache.h b/ReferenceCode/Haswell/Ppi/Cache/Cache.h
new file mode 100644
index 0000000..cbd846b
--- /dev/null
+++ b/ReferenceCode/Haswell/Ppi/Cache/Cache.h
@@ -0,0 +1,86 @@
+/** @file
+ Cache PPI defined in EFI 2.0
+ This code abstracts Cache Settings
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains 'Framework Code' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may not be modified, except as allowed by
+ additional terms of your license agreement.
+**/
+#ifndef _PEI_CACHE_PPI_H_
+#define _PEI_CACHE_PPI_H_
+
+#define PEI_CACHE_PPI_GUID \
+ { \
+ 0x9be4bc2, 0x790e, 0x4dea, 0x8b, 0xdc, 0x38, 0x5, 0x16, 0x98, 0x39, 0x44 \
+ }
+
+EFI_FORWARD_DECLARATION (PEI_CACHE_PPI);
+
+typedef enum _EFI_MEMORY_CACHE_TYPE
+{
+ EfiCacheTypeUncacheable = 0,
+ EfiCacheTypeWriteCombining= 1,
+ EfiCacheTypeReserved2 = 2,
+ EfiCacheTypeReserved3 = 3,
+ EfiCacheTypeWriteThrough = 4,
+ EfiCacheTypeWriteProtected= 5,
+ EfiCacheTypeWriteBack = 6,
+ EfiCacheTypeMaximumType = 7
+} EFI_MEMORY_CACHE_TYPE;
+
+typedef
+EFI_STATUS
+(EFIAPI *PEI_SET_CACHE_PPI)(
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_CACHE_PPI *This,
+ IN EFI_PHYSICAL_ADDRESS MemoryAddress,
+ IN UINT64 MemoryLength,
+ IN EFI_MEMORY_CACHE_TYPE MemoryCacheType
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *PEI_RESET_CACHE_PPI)(
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_CACHE_PPI *This
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *PEI_ACTIVATE_CACHE_PPI)(
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_CACHE_PPI *This
+ );
+
+///
+/// Platform code can use this interface to arrange MTRR configuration in PEI phase.
+///
+struct _PEI_CACHE_PPI {
+ ///
+ /// Set MTRR configuration for a memory region.
+ ///
+ PEI_SET_CACHE_PPI SetCache;
+ ///
+ /// Clean up MTRR in MTRR buffer.
+ ///
+ PEI_RESET_CACHE_PPI ResetCache;
+ ///
+ /// Disable NEM if in NEM mode, and sync MTRR configuration from buffer to MSR.
+ ///
+ PEI_ACTIVATE_CACHE_PPI ActivateCache;
+};
+
+extern EFI_GUID gPeiCachePpiGuid;
+
+#endif
diff --git a/ReferenceCode/Haswell/Ppi/CpuPlatformPolicy/CpuPlatformPolicy.c b/ReferenceCode/Haswell/Ppi/CpuPlatformPolicy/CpuPlatformPolicy.c
new file mode 100644
index 0000000..61cf0be
--- /dev/null
+++ b/ReferenceCode/Haswell/Ppi/CpuPlatformPolicy/CpuPlatformPolicy.c
@@ -0,0 +1,43 @@
+/** @file
+ CPU policy PPI produced by a platform driver specifying various
+ expected CPU settings. This protocol is consumed by the CPU PEI modules.
+
+@copyright
+ Copyright (c) 2009 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+///
+/// Statements that include other files
+///
+///
+/// External include files do NOT need to be explicitly specified in real EDKII
+/// environment
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+
+#include "EdkIIGluePeim.h"
+#endif
+
+#include "CpuPlatformPolicy.h"
+
+///
+/// Protocol GUID definition
+///
+EFI_GUID gPeiCpuPlatformPolicyPpiGuid = PEI_CPU_PLATFORM_POLICY_PPI_GUID;
+
+///
+/// Protocol description
+///
+EFI_GUID_STRING(&gPeiCpuPlatformPolicyPpiGuid, "CpuPlatformPolicy PPI", "Intel(R) PEI Phase CPU Platform Policy PPI");
diff --git a/ReferenceCode/Haswell/Ppi/CpuPlatformPolicy/CpuPlatformPolicy.h b/ReferenceCode/Haswell/Ppi/CpuPlatformPolicy/CpuPlatformPolicy.h
new file mode 100644
index 0000000..55c8890
--- /dev/null
+++ b/ReferenceCode/Haswell/Ppi/CpuPlatformPolicy/CpuPlatformPolicy.h
@@ -0,0 +1,358 @@
+/** @file
+ CPU policy PPI produced by a platform driver specifying various
+ expected CPU settings. This PPI is consumed by CPU PEI modules.
+
+@copyright
+ Copyright (c) 2009 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef CPU_PLATFORM_POLICY_H_
+#define CPU_PLATFORM_POLICY_H_
+
+#include "PfatDefinitions.h"
+
+//
+// CPU policy provided by platform for PEI phase
+//
+//
+// EDK and EDKII have different GUID formats
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#define PEI_CPU_PLATFORM_POLICY_PPI_GUID \
+ { \
+ 0xf8d5438e, 0x26e1, 0x481d, 0xb6, 0x3c, 0x30, 0xd6, 0xef, 0xf4, 0xa4, 0x20 \
+ }
+#else
+#define PEI_CPU_PLATFORM_POLICY_PPI_GUID \
+ { \
+ 0xf8d5438e, 0x26e1, 0x481d, \
+ { \
+ 0xb6, 0x3c, 0x30, 0xd6, 0xef, 0xf4, 0xa4, 0x20 \
+ } \
+ }
+#endif
+
+extern EFI_GUID gPeiCpuPlatformPolicyPpiGuid;
+
+//
+// Forward reference for ANSI C compatibility
+//
+typedef struct _PEI_CPU_PLATFORM_POLICY_PPI PEI_CPU_PLATFORM_POLICY_PPI;
+
+#define CPU_FEATURE_ENABLE 1
+#define CPU_FEATURE_DISABLE 0
+
+///
+/// PPI revision number
+/// Any backwards compatible changes to this PPI will result in an update in the revision number
+/// Major changes will require publication of a new PPI
+///
+
+///
+///Revision 1: Original version
+///
+#define PEI_CPU_PLATFORM_POLICY_PPI_REVISION_1 1
+///
+///Revision 2: Added policies for PFAT-BIOS-EC Interface to PFAT_CONFIG
+/// Added PfatLog to PFAT_CONFIG
+#define PEI_CPU_PLATFORM_POLICY_PPI_REVISION_2 2
+///
+///Revision 3: Added VR_MISC MSR configuration policies
+/// POWER_MGMT_CONFIG.VrMiscMinVid;
+/// POWER_MGMT_CONFIG.VrMiscIdleExitRampRate;
+/// POWER_MGMT_CONFIG.VrMiscIdleEntryRampRate;
+/// POWER_MGMT_CONFIG.VrMiscIdleEntryDecayEnable;
+/// POWER_MGMT_CONFIG.VrMiscSlowSlewRateConfig;
+/// Added VR_MISC2 MSR configuration policies
+/// POWER_MGMT_CONFIG.VrMisc2FastRampVoltage;
+/// POWER_MGMT_CONFIG.VrMisc2MinC8Voltage;
+/// Extended POWER_MGMT_CONFIG.BootInLfm settings from 0(HFM)/ 1(LFM) to 0(HFM)/ 1(LFM)/ 2(TURBO)
+///
+#define PEI_CPU_PLATFORM_POLICY_PPI_REVISION_3 3
+///
+///Revision 4: Added VR_MISC MSR configuration policies
+/// POWER_MGMT_CONFIG.VrMiscIoutSlope;
+/// POWER_MGMT_CONFIG.VrMiscIoutOffsetSign;
+/// POWER_MGMT_CONFIG.VrMiscIoutOffset;
+///
+#define PEI_CPU_PLATFORM_POLICY_PPI_REVISION_4 4
+///
+///Revision 5: Added POWER_MGMT_CONFIG_PPI policies
+/// POWER_MGMT_CONFIG_PPI.VrPSI4enable;
+/// POWER_MGMT_CONFIG_PPI.Psi1Threshold;
+/// POWER_MGMT_CONFIG_PPI.Psi2Threshold;
+/// POWER_MGMT_CONFIG_PPI.Psi3Threshold;
+///
+#define PEI_CPU_PLATFORM_POLICY_PPI_REVISION_5 5
+///
+///Revision 6: Added POWER_MGMT_CONFIG_PPI Fivr polcies
+/// POWER_MGMT_CONFIG_PPI.FivrSscEnable
+/// POWER_MGMT_CONFIG_PPI.FivrSscPercent
+///
+#define PEI_CPU_PLATFORM_POLICY_PPI_REVISION_6 6
+///
+///Revision 7: Added CpuPlatformPpiPtr
+/// BOOT_GUARD_CONFIG.BootGuardSupport
+/// BOOT_GUARD_CONFIG.DisconnectAllTpms
+///
+#define PEI_CPU_PLATFORM_POLICY_PPI_REVISION_7 7
+///
+///Revision 8: Added BOOT_GUARD_CONFIG configuration policies
+/// BOOT_GUARD_CONFIG.ByPassTpmEventLog
+///
+#define PEI_CPU_PLATFORM_POLICY_PPI_REVISION_8 8
+
+///
+/// General CPU features configration for all processor features enabling / configuration bit definitions are in
+/// this field. Platform code can enable/disable/configure features thru this field.
+///
+typedef struct {
+ //
+ // Byte 0, bit definition for functionality enable/disable
+ //
+ UINT8 BistOnReset : 1; ///< Enable or Disable BIST on Reset.
+ UINT8 HyperThreading : 1; ///< Enable or Disable Hyper Threading.
+ UINT8 CpuRatioOverride : 1; ///< Enable or Disable CPU Radio Override.
+ UINT8 VmxEnable : 1; ///< Enable or Disable VMX.
+ UINT8 Pfat : 1; ///< Enable or Disable PFAT.
+ UINT8 MlcStreamerPrefetcher : 1; ///< Enable or Disable MLC Streamer Prefetcher.
+ UINT8 MlcSpatialPrefetcher : 1; ///< Enable or Disable MLC Spatial Prefetcher.
+ UINT8 Txt : 1; ///< Enable or Disable TXT.
+
+ //
+ // Byte 1, bit definition for functionality enable/disable
+ //
+ UINT8 Rsvdbyte : 8; ///< A place holder for additonal functionalites expected in futture platforms.
+ //
+ // Generic CPU feature configuration
+ //
+ UINT8 ActiveCoreCount; ///< Number of active cores.
+ UINT8 CpuRatio; ///< CPU ratio value
+ UINT8 CpuMaxNonTurboRatio; ///< CPU Maximum Non-Turbo ratio value
+} CPU_CONFIG_PPI;
+
+///
+/// Power management Configuration for all Processor Power Management Features
+/// Configs are in this field. Platform code can enable/disable features thru this field.
+///
+typedef struct {
+ UINT8 BootInLfm; ///< Boot in Low-Frequency-Mode.
+ ///
+ /// TCC Activation Offset. Offset from factory set TCC activation temperature at which the Thermal Control Circuit
+ /// must be activated. TCC will be activated at TCC Activation Temp V TCC Activation Offset.
+ ///
+ UINT8 TccActivationOffset;
+ ///
+ /// MSR 0x601[12:0], Primary (IA) Current Limit, in 1/8 A units, 0=Auto. Maximum instantaneous current allowed at
+ /// any given time. Setting a value too far below the Iccmax specification for this platform/CPU might result
+ /// in System hang / CATERR / BSOD depending on the platform configuration.
+ ///
+ UINT16 VrCurrentLimit;
+ UINT8 VrCurrentLimitLock; ///< MSR 0x601[31]: when set, locks bits 31:0 of this MSR.
+ UINT8 Xe; ///< Enable or Disable Intel Extreme Edition support.
+ ///
+ /// 1-Core Ratio Limit: For XE part: LFM to 255, For overclocking part: LFM to Fused 1-Core Ratio Limit + OC Bins.
+ /// This 1-Core Ratio Limit Must be greater than or equal to 2-Core Ratio Limit, 3-Core Ratio Limit, 4-Core
+ /// Ratio Limit.
+ /// 2-Core Ratio Limit: For XE part: LFM to 255, For overclocking part: LFM to Fused 2-Core Ratio Limit + OC Bins.
+ /// This 2-Core Ratio Limit Must be Less than or equal to 1-Core Ratio Limit.
+ /// 3-Core Ratio Limit: For XE part: LFM to 255, For overclocking part: LFM to Fused 3-Core Ratio Limit + OC Bins.
+ /// This 3-Core Ratio Limit Must be Less than or equal to 1-Core Ratio Limit.
+ /// 4-Core Ratio Limit: For XE part: LFM to 255, For overclocking part: LFM to Fused 4-Core Ratio Limit + OC Bins.
+ /// This 4-Core Ratio Limit Must be Less than or equal to 1-Core Ratio Limit.
+ ///
+ UINT8 RatioLimit[4];
+ UINT8 VrMiscMinVid; ///< MSR 0x603[31:24]: Used to constrain the CPU's minimum voltage during package C-states.
+ UINT8 VrMiscIdleExitRampRate; ///< MSR 0x603[50]: Controls the VR ramp rate on package C-state wake events.
+ UINT8 VrMiscIdleEntryRampRate; ///< MSR 0x603[51]: Controls the VR ramp rate on package C-state entry events.
+ UINT8 VrMiscIdleEntryDecayEnable; ///< MSR 0x603[52]: Enables decay mode on package C-state entry.
+ UINT8 VrMiscSlowSlewRateConfig; ///< MSR 0x53[54:53]: Slow Slew rate configuration.
+ UINT8 VrMisc2FastRampVoltage; ///< MSR 0x636[7:0]: Update FAST_RAMP_VOLTAGE; must be 0 to 0xFF, resolution 10mV.
+ UINT8 VrMisc2MinC8Voltage; ///< MSR 0x636[15:8]: Update MIN_C8_VOLTAGE; must be 0 to 0xFF, resolution 10mV.
+ UINT16 VrMiscIoutSlope; ///< MSR 0x603[49-40]: IOUT SLOPE. Default is 200.
+ UINT8 VrMiscIoutOffsetSign; ///< IOUT OFFSET Sign. 0 = positive offset. 1= negative offset.
+ UINT16 VrMiscIoutOffset; ///< MSR 0x603[39-32]: IOUT_OFFSET. 0 = 0%, 625 = 6.25% (Range is +6.25% ~ -6.25%)
+ UINT8 VrPSI4enable; ///< MSR 0x601[62]: PSI4 Enabled/Disabled bit in VR_CURRENT_CONFIG, it's only applied to HSW ULT.
+ UINT8 Psi1Threshold; ///< MSR 0x601[41:32]: Current Threshold for PSI1_CODE specified in Amps.
+ UINT8 Psi2Threshold; ///< MSR 0x601[51:42]: Current Threshold for PSI2_CODE specified in Amps.
+ UINT8 Psi3Threshold; ///< MSR 0x601[61:52]: Current Threshold for PSI3_CODE specified in Amps.
+ UINT8 FivrSscEnable; ///< Enable/Disable FIVR Spread Spectrum support
+ UINT8 FivrSscPercent; ///< PCODE MMIO Mailbox: FIVR spread spectrum percentage value.
+} POWER_MGMT_CONFIG_PPI;
+
+///
+/// PFAT Configuration for all processor security features configuration structures
+/// are in this field. Platform code can pass relevant configuration data thru this field.
+///
+typedef struct {
+ ///
+ /// PFAT update package header that will be packaged along with PFAT script and update data.
+ ///
+ PUP_HEADER PupHeader;
+ ///
+ /// PFAT Platform Data Table contains all the platform data that will be parsed by PFAT module.
+ ///
+ PPDT Ppdt;
+ UINT64 PpdtHash[4]; ///< Hash of the PPDT that will be programmed to PLAT_FRMW_PROT_HASH_0/1/2/3 MSR.
+ UINT8 NumSpiComponents; ///< Number of SPI flash components on platform.
+ UINT8 ComponentSize[MAX_SPI_COMPONENTS]; ///< Size of each flash component on platform.
+ UINT8 PfatMemSize; ///< PFAT memory size.
+ UINT8 EcCmdDiscovery; ///< EC Command discovery.
+ UINT8 EcCmdProvisionEav; ///< EC Command Provision Eav.
+ UINT8 EcCmdLock; ///< EC Command Lock.
+ PFAT_LOG PfatLog; ///< PFAT log.
+} PFAT_CONFIG;
+
+//
+// TxT Configuraion Policy
+//
+#define TXT_SINIT_MEMORY_SIZE 0x20000
+#define TXT_HEAP_MEMORY_SIZE 0xE0000
+#define TXT_DPR_MEMORY_SIZE 0x400000
+#define TXT_DEVICE_MEMORY_SIZE (TXT_SINIT_MEMORY_SIZE + TXT_HEAP_MEMORY_SIZE)
+
+#define TXT_LCP_PD_BASE 0x0 ///< Platform default LCP
+#define TXT_LCP_PD_SIZE 0x0 ///< Platform default LCP
+#define TXT_TGA_MEMORY_SIZE 0x0 ///< Maximum 512K of TGA memory (aperture)
+#define TXT_TGTT_MEMORY_SIZE 0x80000 ///< 512K of TGTT memory
+#define TXT_TGR_MEMORY_SIZE 0x80000 ///< 512K of TGR memory (Registers)
+#define TXT_TOTAL_STOLEN_MEMORY_SIZE (TXT_DPR_MEMORY_SIZE)
+
+typedef struct {
+ UINT64 SinitMemorySize; ///< Size of SINIT module if installed in flash part. Zero otherwise.
+ UINT64 TxtHeapMemorySize; ///< Size of memory reserved for TXT Heap. This memory is used by MLE.
+ EFI_PHYSICAL_ADDRESS TxtDprMemoryBase; ///< Base address of DPR protected memory reserved for Intel TXT component.
+ UINT64 TxtDprMemorySize; ///< Size of DPR protected memory reserved for Intel TXT component.
+ ///
+ /// Base address of BIOS ACM in flash part. It can be passed through platform code for customization; Intel TXT
+ /// reference code would skip searching the BIOS ACM in PEI firmware volume if the field is not zero.
+ ///
+ EFI_PHYSICAL_ADDRESS BiosAcmBase;
+ UINT64 BiosAcmSize; ///< Size of ACM Binary.
+ ///
+ /// Base address of CPU micro code patch loaded into BSP. It can be passed through platform code for customization;
+ /// Intel TXT reference code would skip searching the micro code path in PEI firmware volume if the field is not zero.
+ ///
+ EFI_PHYSICAL_ADDRESS McuUpdateDataAddr;
+ ///
+ /// Size of Trusted Graphics Aperture if supported by chipset. For Cantiga must be 0.
+ ///
+ UINT64 TgaSize;
+ ///
+ /// Base address of Platform Default Launch Control Policy data if installed in flash part. Zero otherwise.
+ ///
+ EFI_PHYSICAL_ADDRESS TxtLcpPdBase;
+ ///
+ /// Size of Platform Default Launch Control Policy data if installed in flash part. Zero otherwise.
+ ///
+ UINT64 TxtLcpPdSize;
+} TXT_CONFIG;
+
+//
+// Boot Guard Configuration
+//
+typedef enum {
+ TpmNone = 0,
+ dTpm12,
+ dTpm20,
+ Ptt,
+ TpmTypeMax
+} TPM_TYPE;
+
+typedef struct {
+ BOOLEAN MeasuredBoot;
+ BOOLEAN BypassTpmInit;
+ TPM_TYPE TpmType;
+ BOOLEAN BootGuardSupport;
+ BOOLEAN DisconnectAllTpms;
+ BOOLEAN ByPassTpmEventLog;
+} BOOT_GUARD_CONFIG;
+
+///
+/// Security Configuration
+///
+typedef struct {
+ PFAT_CONFIG *PfatConfig; ///< PFAT Configuration settings.
+ TXT_CONFIG *TxtConfig; ///< TxT Configuration settings.
+ BOOT_GUARD_CONFIG *BootGuardConfig; ///< Boot Guard Configuration settings.
+} SECURITY_CONFIG_PPI;
+
+///
+/// Overclocking Configuration controls which use the CPU overclocking mailbox interface are defined in this structure.
+/// Platform code can pass in data to the mailbox through this structure.
+///
+typedef struct {
+ INT16 CoreVoltageOffset; ///< The voltage offset applied to the core while operating in turbo mode.
+ ///
+ /// The core voltage override which is applied to the entire range of cpu core frequencies.
+ ///
+ UINT16 CoreVoltageOverride;
+ ///
+ /// Extra Turbo voltage applied to the cpu core when the cpu is operating in turbo mode.
+ ///
+ UINT16 CoreExtraTurboVoltage;
+ ///
+ /// Maximum core turbo ratio override allows to increase CPU core frequency beyond the fused max turbo ratio limit.
+ ///
+ UINT16 CoreMaxOcTurboRatio;
+ INT16 ClrVoltageOffset; ///< The voltage offset applied to CLR while operating in turbo mode.
+ UINT16 ClrVoltageOverride; ///< The clr voltage override which is applied to the entire range of cpu frequencies.
+ UINT16 ClrExtraTurboVoltage; ///< Extra Turbo voltage applied to clr.
+ ///
+ /// Maximum clr turbo ratio override allows to increase CPU clr frequency beyond the fused max turbo ratio limit.
+ ///
+ UINT16 ClrMaxOcTurboRatio;
+ UINT16 SvidVoltageOverride; ///< Overrides the VR voltage through SVID bus to apply a new input voltage to the cpu.
+ UINT8 SvidEnable : 1; ///< Enable or Disable SVID communication from FIVR to the external VR.
+ UINT8 FivrFaultsEnable : 1; ///< Enable or Disable FIVR Fault management.
+ UINT8 FivrEfficiencyEnable : 1; ///< Enable or Disable FIVR efficiency.
+ UINT8 CoreVoltageMode : 1; ///< 0: Adaptive, 1: Override
+ UINT8 ClrVoltageMode : 1; ///< 0: Adaptive, 1:Override
+ UINT8 OcSupport : 1; ///< 0: Disable, 1: Enable
+ UINT8 BitReserved : 2; ///< Bits reserved for future use
+} OVERCLOCKING_CONFIG_PPI;
+
+///
+/// CPU Platform Policy PPI definition, this PPI provides interface to configure
+/// the processor. Platform code needs to configure the policies for processor
+/// ref code to finish the initialization.
+///
+struct _PEI_CPU_PLATFORM_POLICY_PPI {
+ ///
+ /// Revision for the PPI structure.
+ ///
+ UINT8 Revision;
+ ///
+ /// Processor Features Configuration.
+ ///
+ CPU_CONFIG_PPI *CpuConfig;
+ ///
+ /// Processor Power ManagementFeatures Configuration.
+ ///
+ POWER_MGMT_CONFIG_PPI *PowerMgmtConfig;
+ ///
+ /// Processor Security features Configuration.
+ ///
+ SECURITY_CONFIG_PPI *SecurityConfig;
+ ///
+ /// Processor OverClocking features Configuration.
+ ///
+ OVERCLOCKING_CONFIG_PPI *OverclockingConfig;
+ ///
+ /// PEI_CPU_PLATFORM_POLICY_PPI Ptr.
+ ///
+ UINTN CpuPlatformPpiPtr;
+};
+
+#endif
diff --git a/ReferenceCode/Haswell/Ppi/CpuPpiLib.cif b/ReferenceCode/Haswell/Ppi/CpuPpiLib.cif
new file mode 100644
index 0000000..fe862f1
--- /dev/null
+++ b/ReferenceCode/Haswell/Ppi/CpuPpiLib.cif
@@ -0,0 +1,18 @@
+<component>
+ name = "CpuPpiLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Haswell\Ppi\"
+ RefName = "CpuPpiLib"
+[files]
+"CpuPpiLib.sdl"
+"CpuPpiLib.mak"
+"CpuPpiLib.inf"
+"Cache\Cache.c"
+"Cache\Cache.h"
+"CpuPlatformPolicy\CpuPlatformPolicy.c"
+"CpuPlatformPolicy\CpuPlatformPolicy.h"
+"TxtMemoryUnlocked\TxtMemoryUnlocked.c"
+"TxtMemoryUnlocked\TxtMemoryUnlocked.h"
+"TpmInitialized\TpmInitialized.c"
+"TpmInitialized\TpmInitialized.h"
+<endComponent>
diff --git a/ReferenceCode/Haswell/Ppi/CpuPpiLib.inf b/ReferenceCode/Haswell/Ppi/CpuPpiLib.inf
new file mode 100644
index 0000000..7d348d0
--- /dev/null
+++ b/ReferenceCode/Haswell/Ppi/CpuPpiLib.inf
@@ -0,0 +1,65 @@
+## @file
+# Component description file for CPU PPI library.
+#
+#@copyright
+# Copyright (c) 2005 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains an 'Intel Peripheral Driver' and uniquely
+# identified as "Intel Reference Module" and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+
+[defines]
+BASE_NAME = CpuPpiLib
+COMPONENT_TYPE = LIBRARY
+
+[includes.common]
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Pei/Include
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include
+
+#
+# Edk II Glue Library, some hearder are included by R9 header so have to include
+#
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Framework
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[sources.common]
+ Cache/Cache.c
+ Cache/Cache.h
+ CpuPlatformPolicy/CpuPlatformPolicy.c
+ CpuPlatformPolicy/CpuPlatformPolicy.h
+ TxtMemoryUnlocked/TxtMemoryUnlocked.c
+ TxtMemoryUnlocked/TxtMemoryUnlocked.h
+ TpmInitialized/TpmInitialized.c
+ TpmInitialized/TpmInitialized.h
+
+[nmake.common]
+C_STD_INCLUDE=
+
diff --git a/ReferenceCode/Haswell/Ppi/CpuPpiLib.mak b/ReferenceCode/Haswell/Ppi/CpuPpiLib.mak
new file mode 100644
index 0000000..e5dc158
--- /dev/null
+++ b/ReferenceCode/Haswell/Ppi/CpuPpiLib.mak
@@ -0,0 +1,21 @@
+# MAK file for the ModulePart:IntelSaPpiLib
+EDK : CpuPpiLib
+
+$(BUILD_DIR)\CpuPpiLib.lib : CpuPpiLib
+
+CpuPpiLib : $(BUILD_DIR)\CpuPpiLib.mak CpuPpiLibBin
+
+$(BUILD_DIR)\CpuPpiLib.mak : $(CPU_PPI_LIB_DIR)\$(@B).cif $(CPU_PPI_LIB_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(CPU_PPI_LIB_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+CpuPpiLib_INCLUDES =\
+ $(PROJECT_CPU_INCLUDES)\
+ $(EDK_INCLUDES) \
+ $(INTEL_MCH_INCLUDES)
+
+CpuPpiLibBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\CpuPpiLib.mak all\
+ "MY_INCLUDES=$(CpuPpiLib_INCLUDES)" \
+ TYPE=PEI_LIBRARY \
+ LIBRARY_NAME=$(CPU_PPI_LIB) \ No newline at end of file
diff --git a/ReferenceCode/Haswell/Ppi/CpuPpiLib.sdl b/ReferenceCode/Haswell/Ppi/CpuPpiLib.sdl
new file mode 100644
index 0000000..096d206
--- /dev/null
+++ b/ReferenceCode/Haswell/Ppi/CpuPpiLib.sdl
@@ -0,0 +1,31 @@
+TOKEN
+ Name = CpuPpiLib_SUPPORT
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable SaPpiLib support in Project"
+End
+
+MODULE
+ Help = "Includes SaPpiLib.mak to Project"
+ File = "CpuPpiLib.mak"
+End
+
+ELINK
+ Name = "CPU_PPI_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\CpuPpiLib.lib"
+ Parent = "CPU_PPI_LIB"
+ InvokeOrder = AfterParent
+End
+
+PATH
+ Name = "CPU_PPI_LIB_DIR"
+End
+
+
diff --git a/ReferenceCode/Haswell/Ppi/TpmInitialized/TpmInitialized.c b/ReferenceCode/Haswell/Ppi/TpmInitialized/TpmInitialized.c
new file mode 100644
index 0000000..958301b
--- /dev/null
+++ b/ReferenceCode/Haswell/Ppi/TpmInitialized/TpmInitialized.c
@@ -0,0 +1,24 @@
+/** @file
+ Tpm Initialized PPI
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#include "Tiano.h"
+#include EFI_PPI_DEFINITION (TpmInitialized)
+
+EFI_GUID gPeiTpmInitializedPpiGuid = PEI_TPM_INITIALIZED_PPI_GUID;
+
+EFI_GUID_STRING(&gPeiTpmInitializedPpiGuid, "TpmInitialized PPI", "TpmInitialized PPI");
diff --git a/ReferenceCode/Haswell/Ppi/TpmInitialized/TpmInitialized.h b/ReferenceCode/Haswell/Ppi/TpmInitialized/TpmInitialized.h
new file mode 100644
index 0000000..27c09c9
--- /dev/null
+++ b/ReferenceCode/Haswell/Ppi/TpmInitialized/TpmInitialized.h
@@ -0,0 +1,29 @@
+/** @file
+ Tpm Initialized PPI definition, used to notify any code after TPM initialized.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _PEI_TPM_INITIALIZED_PPI_H_
+#define _PEI_TPM_INITIALIZED_PPI_H_
+
+#define PEI_TPM_INITIALIZED_PPI_GUID \
+ { \
+ 0xe9db0d58, 0xd48d, 0x47f6, 0x9c, 0x6e, 0x6f, 0x40, 0xe8, 0x6c, 0x7b, 0x41 \
+ }
+
+extern EFI_GUID gPeiTpmInitializedPpiGuid;
+
+#endif
diff --git a/ReferenceCode/Haswell/Ppi/TxtMemoryUnlocked/TxtMemoryUnlocked.c b/ReferenceCode/Haswell/Ppi/TxtMemoryUnlocked/TxtMemoryUnlocked.c
new file mode 100644
index 0000000..d905414
--- /dev/null
+++ b/ReferenceCode/Haswell/Ppi/TxtMemoryUnlocked/TxtMemoryUnlocked.c
@@ -0,0 +1,33 @@
+/** @file
+ This file contains GUID to use for defining of TXT Memory Unlocked PPI.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+///
+/// External include files do NOT need to be explicitly specified in real EDKII
+/// environment
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#include EFI_PPI_DEFINITION (TxtMemoryUnlocked)
+#endif
+
+EFI_GUID gPeiTxtMemoryUnlockedPpiGuid = PEI_TXT_MEMORY_UNLOCKED_PPI_GUID;
+
+EFI_GUID_STRING(&gPeiTxtMemoryUnlockedPpiGuid, "TXT PPI", "TXT PPI");
diff --git a/ReferenceCode/Haswell/Ppi/TxtMemoryUnlocked/TxtMemoryUnlocked.h b/ReferenceCode/Haswell/Ppi/TxtMemoryUnlocked/TxtMemoryUnlocked.h
new file mode 100644
index 0000000..8b1be06
--- /dev/null
+++ b/ReferenceCode/Haswell/Ppi/TxtMemoryUnlocked/TxtMemoryUnlocked.h
@@ -0,0 +1,32 @@
+/** @file
+ This file contains PPI definition that is installed
+ by TXT PEIM
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PEI_TXT_MEMORY_UNLOCKED_PPI_H_
+#define _PEI_TXT_MEMORY_UNLOCKED_PPI_H_
+
+#define PEI_TXT_MEMORY_UNLOCKED_PPI_GUID \
+ { \
+ 0x38cdd10b, 0x767d, 0x4f6e, 0xa7, 0x44, 0x67, 0xee, 0x1d, 0xfe, 0x2f, 0xa5 \
+ }
+
+extern EFI_GUID gPeiTxtMemoryUnlockedPpiGuid;
+
+#endif
diff --git a/ReferenceCode/Haswell/Protocol/CpuInfo/CpuInfo.c b/ReferenceCode/Haswell/Protocol/CpuInfo/CpuInfo.c
new file mode 100644
index 0000000..01f84c5
--- /dev/null
+++ b/ReferenceCode/Haswell/Protocol/CpuInfo/CpuInfo.c
@@ -0,0 +1,25 @@
+/** @file
+ Protocol used for CPU driver to provide the CPU information.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "Tiano.h"
+#include EFI_PROTOCOL_DEFINITION (CpuInfo)
+
+EFI_GUID gDxeCpuInfoProtocolGuid = DXE_CPU_INFO_PROTOCOL_GUID;
+
+EFI_GUID_STRING(&gDxeCpuInfoProtocolGuid, "CPU Information", "CPU information from CPU Drivers");
diff --git a/ReferenceCode/Haswell/Protocol/CpuInfo/CpuInfo.h b/ReferenceCode/Haswell/Protocol/CpuInfo/CpuInfo.h
new file mode 100644
index 0000000..394386f
--- /dev/null
+++ b/ReferenceCode/Haswell/Protocol/CpuInfo/CpuInfo.h
@@ -0,0 +1,79 @@
+/** @file
+ Protocol used to report CPU information
+
+@copyright
+ Copyright (c) 1999 - 2014 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _CPU_INFO_H_
+#define _CPU_INFO_H_
+
+EFI_FORWARD_DECLARATION (DXE_CPU_INFO_PROTOCOL_GUID);
+#define DXE_CPU_INFO_PROTOCOL_GUID \
+ { \
+ 0xe223cf65, 0xf6ce, 0x4122, 0xb3, 0xaf, 0x4b, 0xd1, 0x8a, 0xff, 0x40, 0xa1 \
+ }
+
+///
+/// Protocol revision number
+/// Any backwards compatible changes to this protocol will result in an update in the revision number
+/// Major changes will require publication of a new protocol
+///
+#define DXE_CPU_INFO_REVISION_1 1
+
+///
+/// RCVersion[7:0] is the release number.
+/// For example:
+/// Version 0.7.1 should be 00 07 01 00 (0x00070100)
+///
+#define CPU_RC_VERSION 0x01090000
+
+extern EFI_GUID gDxeCpuInfoProtocolGuid;
+
+//
+// Forward reference for ANSI C compatibility
+//
+typedef struct _DXE_CPU_INFO_PROTOCOL DXE_CPU_INFO_PROTOCOL;
+
+//
+// CPU Common Feature Definition
+//
+
+///
+/// The processor Command Feature Definition is a super set and abstracts from hardware.
+///
+#define TXT_SUPPORT 1
+#define VMX_SUPPORT (1 << 1)
+#define XD_SUPPORT (1 << 2)
+#define DCA_SUPPORT (1 << 3)
+#define XAPIC_SUPPORT (1 << 4)
+#define AES_SUPPORT (1 << 5)
+#define HT_SUPPORT (1 << 6)
+#define DEBUG_SUPPORT (1 << 7)
+#define DEBUG_LOCK_SUPPORT (1 << 8)
+
+///
+/// Interface structure for the CPU Info Protocol
+///
+struct _DXE_CPU_INFO_PROTOCOL {
+ UINT8 Revision; ///< Revision for the protocol structure.
+ UINT32 RcVersion; ///< Processor Features information.
+ //
+ // Bit definition for functionality enable/disable
+ //
+ UINT64 CpuCommonFeatures; ///< CPU Supported Feature. Output from CPU code.
+};
+
+#endif
diff --git a/ReferenceCode/Haswell/Protocol/CpuPlatformPolicy/CpuPlatformPolicy.c b/ReferenceCode/Haswell/Protocol/CpuPlatformPolicy/CpuPlatformPolicy.c
new file mode 100644
index 0000000..906c2e5
--- /dev/null
+++ b/ReferenceCode/Haswell/Protocol/CpuPlatformPolicy/CpuPlatformPolicy.c
@@ -0,0 +1,26 @@
+/** @file
+ Protocol used for specifying platform related CPU information and policy setting.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "Tiano.h"
+#include EFI_PROTOCOL_DEFINITION (CpuPlatformPolicy)
+
+EFI_GUID gDxeCpuPlatformPolicyProtocolGuid = DXE_CPU_PLATFORM_POLICY_PROTOCOL_GUID;
+
+EFI_GUID_STRING
+ (&gDxeCpuPlatformPolicyProtocolGuid, "CPU Platform Policy", "Platform related CPU information and policy settings");
diff --git a/ReferenceCode/Haswell/Protocol/CpuPlatformPolicy/CpuPlatformPolicy.h b/ReferenceCode/Haswell/Protocol/CpuPlatformPolicy/CpuPlatformPolicy.h
new file mode 100644
index 0000000..37fe5a1
--- /dev/null
+++ b/ReferenceCode/Haswell/Protocol/CpuPlatformPolicy/CpuPlatformPolicy.h
@@ -0,0 +1,329 @@
+/** @file
+ Protocol used for specifying platform related CPU information and policy setting.
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _CPU_PLATFORM_POLICY_H_
+#define _CPU_PLATFORM_POLICY_H_
+
+#include "CpuPmConfig.h"
+
+#include EFI_PROTOCOL_DEFINITION (MpService)
+#include EFI_GUID_DEFINITION (DataHubRecords)
+
+#if (EFI_SPECIFICATION_VERSION >= 0x2000A)
+#include EFI_PROTOCOL_DEFINITION (HiiDatabase)
+#else
+#include EFI_PROTOCOL_DEFINITION (Hii)
+#endif
+
+EFI_FORWARD_DECLARATION (DXE_CPU_PLATFORM_POLICY_PROTOCOL_GUID);
+#define DXE_CPU_PLATFORM_POLICY_PROTOCOL_GUID \
+ { \
+ 0x1279e288, 0x24cd, 0x47e9, 0x96, 0xba, 0xd7, 0xa3, 0x8c, 0x17, 0xbd, 0x64 \
+ }
+
+///
+/// Protocol revision number
+/// Any backwards compatible changes to this protocol will result in an update in the revision number
+/// Major changes will require publication of a new protocol
+///
+
+///
+/// Revision 1: Initial version
+///
+#define DXE_PLATFORM_CPU_POLICY_PROTOCOL_REVISION_1 1
+///
+/// Revision 2: Added CPU_CONFIG.DebugInterfaceEnable
+/// Added CPU_CONFIG.DebugInterfaceLockEnable
+///
+#define DXE_PLATFORM_CPU_POLICY_PROTOCOL_REVISION_2 2
+///
+/// Revision 3: Added CPU_CONFIG.ApIdleManner
+/// Added CPU_CONFIG.ApHandoffManner
+///
+#define DXE_PLATFORM_CPU_POLICY_PROTOCOL_REVISION_3 3
+
+///
+/// Revision 4: Added POWER_MGMT_CONFIG.THERM_FUNCTION_ENABLES.Pl1ThermalControl
+///
+#define DXE_PLATFORM_CPU_POLICY_PROTOCOL_REVISION_4 4
+///
+/// Revision 5: Added POWER_MGMT_CONFIG.PPM_TURBO_SETTINGS.PowerLimit3
+/// POWER_MGMT_CONFIG.PPM_TURBO_SETTINGS.PowerLimit3Time
+/// POWER_MGMT_CONFIG.PPM_TURBO_SETTINGS.PowerLimit3DutyCycle
+/// POWER_MGMT_CONFIG.PPM_TURBO_SETTINGS.PowerLimit3Lock
+///
+#define DXE_PLATFORM_CPU_POLICY_PROTOCOL_REVISION_5 5
+
+///
+/// Revision 6: Added POWER_MGMT_CONFIG.CustomPowerUnit .Support for user to configuration custom Power Limts in milli watts
+/// Default Power Unit for follwing Items changes to MilliWatts
+/// POWER_MGMT_CONFIG.PPM_TURBO_SETTINGS
+/// PowerLimit1
+/// PowerLimit2
+/// PowerLimit3
+/// POWER_MGMT_CONFIG.PPM_CUSTOM_CTDP
+/// CustomPowerLimit1
+/// CustomPowerLimit2
+///
+///
+
+#define DXE_PLATFORM_CPU_POLICY_PROTOCOL_REVISION_6 6
+
+///
+/// Revision 7: Added POWER_MGMT_CONFIG.THERM_FUNCTION_ENABLES.Pl1ThermalControlFloor. Changed definition of
+/// POWER_MGMT_CONFIG.THERM_FUNCTION_ENABLES.Pl1ThermalControl from 1 (enable) to 1 (enable/manual)
+/// POWER_MGMT_CONFIG.THERM_FUNCTION_ENABLES.Pl1ThermalControlFloor
+///
+
+#define DXE_PLATFORM_CPU_POLICY_PROTOCOL_REVISION_7 7
+
+
+extern EFI_GUID gDxeCpuPlatformPolicyProtocolGuid;
+
+//
+// Forward reference for ANSI C compatibility
+//
+typedef struct _DXE_CPU_PLATFORM_POLICY_PROTOCOL DXE_CPU_PLATFORM_POLICY_PROTOCOL;
+
+//
+// Prototypes for the Platform CPU Protocol
+//
+
+///
+/// This function is for platform code to provide Microcode location since different BIOS has different flash layout.
+/// Platform code need to provide a function for CPU code to call to get the Microcode location in flash or memory.
+///
+typedef
+EFI_STATUS
+(EFIAPI *PLATFORM_CPU_RETRIEVE_MICROCODE)(
+ IN DXE_CPU_PLATFORM_POLICY_PROTOCOL *This,
+ OUT UINT8 **MicrocodeData
+ );
+
+typedef struct {
+ UINT32 Package;
+ UINT32 Die;
+ UINT32 Core;
+ UINT32 Thread;
+} CPU_PHYSICAL_LOCATION;
+
+///
+/// The platform category, Server, Desktop and Mobile are defined.
+///
+typedef enum {
+ CpuPlatformUnknown= 0,
+ CpuPlatformDesktop,
+ CpuPlatformMobile,
+ CpuPlatformServer,
+ CpuPlatformMax
+} CPU_PLATFORM_CATEGORY;
+
+///
+/// The reason for changing the state of the processor Only applies to Disabling processors.
+/// In future, we can add add/remove support
+///
+#define CPU_CAUSE_NOT_DISABLED 0x0000
+#define CPU_CAUSE_INTERNAL_ERROR 0x0001
+#define CPU_CAUSE_THERMAL_ERROR 0x0002
+#define CPU_CAUSE_SELFTEST_FAILURE 0x0004
+#define CPU_CAUSE_PREBOOT_TIMEOUT 0x0008
+#define CPU_CAUSE_FAILED_TO_START 0x0010
+#define CPU_CAUSE_CONFIG_ERROR 0x0020
+#define CPU_CAUSE_USER_SELECTION 0x0080
+#define CPU_CAUSE_BY_ASSOCIATION 0x0100
+#define CPU_CAUSE_UNSPECIFIED 0x8000
+
+typedef UINT32 CPU_STATE_CHANGE_CAUSE;
+
+typedef struct {
+ EFI_MP_PROC_CONTEXT *Context;
+ EFI_EXP_BASE10_DATA CoreFreq;
+ EFI_EXP_BASE10_DATA BusFreq;
+ EFI_EXP_BASE2_DATA CacheSize[EFI_CACHE_LMAX];
+ EFI_PROCESSOR_ID_DATA CpuId;
+ EFI_PROCESSOR_MICROCODE_REVISION_DATA MuData;
+ EFI_PROCESSOR_STATUS_DATA Status;
+} EFI_DETAILED_CPU_INFO;
+
+///
+/// Platform Specific Processor Information
+///
+typedef struct {
+ UINT64 ApicID; ///< APIC ID
+ STRING_REF ReferenceString; ///< Reference String
+ EFI_PROCESSOR_SOCKET_TYPE_DATA SocketType; ///< Socket Type
+ EFI_PROCESSOR_SOCKET_NAME_DATA SocketName; ///< Socket Name
+ EFI_PROCESSOR_MAX_CORE_FREQUENCY_DATA MaxCoreFrequency; ///< Maximum Core Frequency
+ EFI_PROCESSOR_MAX_FSB_FREQUENCY_DATA MaxFsbFrequency; ///< Maximum FSB Frequency
+ EFI_PROCESSOR_CORE_FREQUENCY_LIST_DATA PlatformCoreFrequencyList; ///< Platform Core Frequency List
+ EFI_PROCESSOR_FSB_FREQUENCY_LIST_DATA PlatformFsbFrequencyList; ///< Platform FSB Frequency List
+ STRING_REF AssetTag; ///< Asset Tag
+ EFI_HII_HANDLE StringHandle; ///< String Handle
+ STRING_REF SerialNumber; ///< Serial Number
+ STRING_REF PartNumber; ///< Part Number
+} PLATFORM_CPU_INFORMATION;
+
+///
+/// This interface is for platform to provide processor support layout, such as how many packages we want
+/// processor code to support. If return EFI_UNSUPPORTED, processor code will assume MAXIMUM_CPU_NUMBER and
+/// allocate MAX memory for all APs.
+///
+typedef
+EFI_STATUS
+(EFIAPI *PLATFORM_CPU_GET_MAX_COUNT)(
+ IN DXE_CPU_PLATFORM_POLICY_PROTOCOL *This,
+ OUT UINT32 *MaxThreadsPerCore,
+ OUT UINT32 *MaxCoresPerDie,
+ OUT UINT32 *MaxDiesPerPackage,
+ OUT UINT32 *MaxPackages
+ );
+
+///
+/// Platform code can provide platform specific processor information, such as processor socket Name on board,
+/// processor Socket Type, and so on for SMBIOS table creation.
+///
+typedef
+EFI_STATUS
+(EFIAPI *PLATFORM_CPU_GET_CPU_INFO)(
+ IN DXE_CPU_PLATFORM_POLICY_PROTOCOL *This,
+ IN CPU_PHYSICAL_LOCATION *Location,
+ IN OUT PLATFORM_CPU_INFORMATION *PlatformCpuInfo
+ );
+
+//
+// Generic definitions for device enabling/disabling used by CPU code
+//
+#define CPU_FEATURE_ENABLE 1
+#define CPU_FEATURE_DISABLE 0
+
+//
+// Generic definitions for DTS
+//
+#define DTS_OUT_OF_SPEC_ONLY 2
+#define DTS_OUT_OF_SPEC_OCCURRED 3
+
+///
+/// General CPU feature Configuration for all processor features enabling bit definitions are in this field.
+/// Platform code can enable/disable features thru this field.
+///
+typedef struct {
+ //
+ // Byte 0, bit definition for functionality enable/disable
+ //
+ UINT8 HtState : 1; ///< Enable or Disable Hyper Threading State; 0: Disable; 1: Enable
+ UINT8 LimitCpuidMaximumValue : 1; ///< Enable or Disable Limit Cpuid Maximum Value; 0: Disable; 1: Enable
+ UINT8 DcaState : 1; ///< @deprecated Deprecated for Client (Server specific)
+ UINT8 ExecuteDisableBit : 1; ///< Enable or Disable Execute Disable Bit; 0: Disable; 1: Enable
+ UINT8 VmxEnable : 1; ///< Enable or Disable VMX; 0: Disable; 1: Enable
+ UINT8 SmxEnable : 1; ///< Enable or Disable SMX; 0: Disable; 1: Enable
+ UINT8 FastString : 1; ///< @deprecated
+ UINT8 MachineCheckEnable : 1; ///< Enable or Disable Machine Check; 0: Disable; 1: Enable
+ //
+ // Byte 1, bit definition for functionality enable/disable
+ //
+ UINT8 MonitorMwaitEnable : 1; ///< Enable or Disable Monitor Mwait mode; 0: Disable; 1: Enable
+ UINT8 XapicEnable : 1; ///< Enable or Disable Xapic mode; 0: Disable; 1: Enable
+ UINT8 MachineCheckStatusClean : 1; ///< @deprecated
+ UINT8 IsColdReset : 1; ///< Check if is Cold Reset; 0: Not Cold Reset; 1: Cold Reset
+ UINT8 MlcStreamerPrefetcher : 1; ///< Enable or Disable MlcStreamerPrefetcher; 0: Disable; 1: Enable
+ UINT8 MlcSpatialPrefetcher : 1; ///< Enable or Disable MlcSpatialPrefetcher; 0: Disable; 1: Enable
+ UINT8 EnableDts : 2; ///< Enable or Disable DTS feature; 0=Disable; 1=Enable; 2=OUT_OF_SPEC;
+ //
+ // Byte 2, byte definition for addiional functionalities expected later
+ //
+ UINT8 FviReport : 1; ///< Enable or Disable FVI report; 0: Disable; 1: Enable
+ UINT8 AesEnable : 1; ///< Enable or Disable AES feature; 0: Disable; 1: Enable
+ UINT8 DebugInterfaceEnable : 1; ///< Enable or Disable Debug Interface; This policy must be disabled for production BIOS. <b>0: Disable</b>; 1: Enable
+ UINT8 DebugInterfaceLockEnable : 1; ///< Enable or Disable Debug Interface Lock; This policy must be enabled on production platforms. 0: Disable; <b>1: Enable</b>
+ UINT8 ApIdleManner : 2; ///< Settings for AP Threads Idle; 1: HALT 2:MWAIT 3:RUN
+ UINT8 ApHandoffManner : 2; ///< Settings for AP Handoff to OS; 1: HALT 2:MWAIT32
+ //
+ // CPU feature configuration
+ //
+ UINT8 BspSelection; ///< Select BSP
+ UINT32 DcaPrefetchDelayValue; ///< @deprecated Deprecated for Client (Server specific)
+ UINT8 VirtualWireMode; ///< @deprecated
+ UINT8 SmmbaseSwSmiNumber; ///< SW SMI Number from Smbase.
+ //
+ // CPU Misc Config
+ //
+ UINT8 FviSmbiosType; ///< Create SMBIOS Table Type for FVI
+ //
+ // Functions provided by platform code
+ //
+ ///
+ /// Platform code can provide microcode location thru this function.
+ ///
+ PLATFORM_CPU_RETRIEVE_MICROCODE RetrieveMicrocode;
+ ///
+ /// Platform to provide the processor detail about Max Thread per Core, Max Cores per Die, Max Dies per
+ /// Package and Max packages.
+ ///
+ PLATFORM_CPU_GET_MAX_COUNT GetMaxCount;
+ ///
+ /// Platform code to provide platform specific processor information
+ ///
+ PLATFORM_CPU_GET_CPU_INFO GetCpuInfo;
+} CPU_CONFIG;
+
+///
+/// TxT Platform Configuration
+///
+typedef struct {
+ UINT8 ResetAux : 1; ///< Reset Auxiliary content when it is set "TRUE"
+ UINT8 Reserved : 7; ///< Reserved for future use
+ UINT8 ByetReserved[1]; ///< Reserved for future use
+} TXT_FUNCTION_CONFIG;
+
+
+///
+/// All processor security features enabling definitions are in this field.
+/// Platform code can enable/disable features thru this field.
+///
+typedef struct {
+ TXT_FUNCTION_CONFIG *TxtFunctionConfig;
+} SECURITY_CONFIG;
+
+///
+/// The CPU platform policy protocol allows the platform code to publish a set of configuration information that the
+/// CPU drivers will use to configure the processor. Platform code needs to provide the information for processor
+/// drivers to finish the initialization.
+///
+typedef struct _DXE_CPU_PLATFORM_POLICY_PROTOCOL {
+ ///
+ /// This member specifies the revision of the CPU Policy protocol. This field is used to indicate backwards
+ /// compatible changes to the protocol. Platform code that produces this protocol must fill with the correct revision
+ /// value for the PCH reference code to correctly interpret the content of the protocol fields.
+ ///
+ UINT8 Revision;
+ ///
+ /// Processor standard features configuration.
+ ///
+ CPU_CONFIG *CpuConfig;
+ ///
+ /// Processor power management features configuration.
+ ///
+ POWER_MGMT_CONFIG *PowerMgmtConfig;
+ ///
+ /// Processor security features configuration.
+ ///
+ SECURITY_CONFIG *SecurityConfig;
+} DXE_CPU_PLATFORM_POLICY_PROTOCOL;
+
+#endif
diff --git a/ReferenceCode/Haswell/Protocol/CpuPlatformPolicy/CpuPmConfig.h b/ReferenceCode/Haswell/Protocol/CpuPlatformPolicy/CpuPmConfig.h
new file mode 100644
index 0000000..d84ccab
--- /dev/null
+++ b/ReferenceCode/Haswell/Protocol/CpuPlatformPolicy/CpuPmConfig.h
@@ -0,0 +1,302 @@
+/** @file
+ Describes the defintions / functions visible to the rest of the PPM.
+
+@copyright
+ Copyright (c) 2011 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _CPU_PM_CONFIG_H_
+#define _CPU_PM_CONFIG_H_
+
+///
+/// Define maximum number of custom ratio states supported
+///
+#define MAX_CUSTOM_RATIO_TABLE_ENTRIES 16
+
+///
+/// Define maximum number of custom ConfigTdp entries supported
+///
+#define MAX_CUSTOM_CTDP_ENTRIES 3
+
+///
+/// This structure is used to describe the custom processor ratio table desired by the platform
+///
+typedef struct {
+ ///
+ /// The number of custom ratio state entries, it must be a value from 2 to 16 for a valid custom ratio table.
+ ///
+ UINT8 NumberOfEntries;
+ UINT32 Cpuid; ///< The CPU ID for which this custom ratio table applies.
+ UINT16 MaxRatio; ///< The maximum ratio of the custom ratio table.
+ UINT16 StateRatio[MAX_CUSTOM_RATIO_TABLE_ENTRIES]; ///< The processor ratios in the custom ratio table.
+} PPM_CUSTOM_RATIO_TABLE;
+
+///
+/// This structure is used to describe which of the PPM functions will be enabled by PPM implementation.
+///
+typedef struct {
+ UINT32 Eist : 1; ///< Enable or Disable Intel SpeedStep Technology.
+ UINT32 Cx : 1; ///< Enable or Disable CPU power states (C-states).
+ UINT32 C1e : 1; ///< Enable or Disable Enhanced C-states.
+ UINT32 C3 : 1; ///< Enable or Disable C3.
+ UINT32 C6 : 1; ///< Enable or Disable C6.
+ UINT32 DeepCState : 3; ///< Enable or Disable C7/C7S.
+ UINT32 LongLatencyC6 : 1; ///< Enable or Disable C6 Long Latency.
+ UINT32 LongLatencyC7 : 1; ///< Enable or Disable C7 Long Latency.
+ UINT32 C8 : 1; ///< Enable or Disable C8.
+ UINT32 C9 : 1; ///< Enable or Disable C9.
+ UINT32 C10 : 1; ///< Enable or Disable C10.
+ UINT32 C1AutoDemotion : 1; ///< Enable or Disable C1 Auto Demotion.
+ UINT32 C3AutoDemotion : 1; ///< Enable or Disable C3 Auto Demotion.
+ UINT32 TurboMode : 1; ///< Enable or Disable long duration Turbo Mode.
+ UINT32 PowerLimit2 : 1; ///< Enable or Disable short duration Turbo Mode.
+ UINT32 EnergyEfficientPState : 1; ///< Enable or Disable Energy Efficient P-state will be applied in Turbo mode.
+ UINT32 BiProcHot : 1; ///< @deprecated in Powermgmt policy and moved to THERM_FUNCTION_ENABLES.
+ UINT32 TStates : 1; ///< @deprecated in Powermgmt policy and moved to THERM_FUNCTION_ENABLES.
+ UINT32 Xe : 1; ///< Enable or Disable Intel Extreme Edition support.
+ UINT32 C1UnDemotion : 1; ///< Enable or Disable C1UnDemotion.
+ UINT32 C3UnDemotion : 1; ///< Enable or Disable C3UnDemotion.
+ UINT32 PkgCStateDemotion : 1; ///< Enable or Disable Package Cstate Demotion.
+ UINT32 PkgCStateUnDemotion : 1; ///< Enable or Disable Package Cstate UnDemotion.
+ UINT32 DisableProcHotOut : 1; ///< @deprecated in Powermgmt policy and moved to THERM_FUNCTION_ENABLES.
+ UINT32 DisableVRThermalAlert : 1; ///< @deprecated in Powermgmt policy and moved to THERM_FUNCTION_ENABLES.
+ UINT32 ProcHotResponce : 1; ///< @deprecated in Powermgmt policy and moved to THERM_FUNCTION_ENABLES.
+ UINT32 AutoThermalReporting : 1; ///< @deprecated in Powermgmt policy and moved to THERM_FUNCTION_ENABLES.
+ UINT32 CStatePreWake : 1; ///< Enable or Disable CState-Pre wake.
+ UINT32 ThermalMonitor : 1; ///< @deprecated in Powermgmt policy and moved to THERM_FUNCTION_ENABLES.
+ UINT32 LakeTiny : 1; ///< Enable or Disable LakeTiny Support.
+ UINT32 TimedMwait : 1; ///< Enable or Disable TimedMwait Support.
+ UINT32 Reserved : 2; ///< Bits reserved for future use.
+} PPM_FUNCTION_ENABLES;
+
+///
+/// This structure is used to describe various PPM turbo settings
+///
+typedef struct _PPM_TURBO_SETTINGS {
+ UINT16 PowerLimit1; ///< Package Long duration turbo mode power limit in 125mw or watts.
+ UINT32 PowerLimit1Time; ///< Package Long duration turbo mode time window in seconds.
+ UINT16 PowerLimit2; ///< Package Short duration turbo mode power limit in 125mw or watts.
+ ///
+ /// Describes whether TURBO_POWER_LIMIT[63] should be set. Setting this bit will lock all Turbo settings.
+ ///
+ UINT8 TurboPowerLimitLock;
+ UINT16 DdrPowerLimit1; ///< @deprecated in Powermgmt policy
+ UINT32 DdrPowerLimit1Time; ///< @deprecated in Powermgmt policy
+ UINT16 DdrPowerLimit2; ///< @deprecated in Powermgmt policy
+ UINT8 DdrPowerLimitLock; ///< @deprecated in Powermgmt policy
+ ///
+ /// Configuration for boot TDP selection, value 0 describes TDP Nominal, value 1 describes TDP Down and
+ /// value 2 describes TDP Up.
+ ///
+ UINT8 ConfigTdpLevel;
+ ///
+ /// Configurable TDP Mode Lock can be sets the to Lock ConfigTdp mode settings from runtime change.
+ ///
+ UINT8 ConfigTdpLock;
+ UINT8 ConfigTdpBios; ///< Configuration whether load Configurable TDP SSDT.
+ UINT8 EnergyPolicy; ///< Describes the Energy efficiency policy to be set in MSR 0x1B0.
+
+ //
+ // PL3 configuration
+ //
+ UINT16 PowerLimit3; ///< Package PL3 power limit in 125mw or watts.
+ UINT32 PowerLimit3Time; ///< Package PL3 time window in seconds.
+ UINT8 PowerLimit3DutyCycle; ///< Package PL3 Duty Cycle.
+ UINT8 PowerLimit3Lock; ///< Package PL3 MSR 615h lock.
+
+} PPM_TURBO_SETTINGS;
+
+///
+/// PPM Custom ConfigTdp Settings
+///
+typedef struct _PPM_CUSTOM_CTDP_TABLE {
+ UINT16 CustomPowerLimit1; ///< Short term Power Limit value for custom cTDP level in 125mw or watts.
+ UINT16 CustomPowerLimit2; ///< Long term Power Limit value for custom cTDP level in 125mw or watts.
+ UINT8 CustomPowerLimit1Time; ///< Short term Power Limit time window value for custom cTDP level.
+ UINT8 CustomTurboActivationRatio; ///< Turbo Activation Ratio for custom cTDP level.
+ UINT8 CustomConfigTdpControl; ///< Config Tdp Control (0/1/2) value for custom cTDP level.
+} PPM_CUSTOM_CTDP_TABLE;
+
+///
+/// This structure is used to configure custom ConfigTdp level settings.
+///
+typedef struct _PPM_CUSTOM_CTDP {
+ UINT8 ConfigTdpCustom; ///< Describes whether or not Custom Config Tdp should be enabled.
+ UINT8 CustomTdpCount; ///< Describes the number of Custom Config Tdp levels required (1/2/3).
+ UINT8 CustomBootModeIndex; ///< Describes the Boot mode index selection from Custom Tdp levels.Index to CustomConfigTdpTable. valid values are 0,1,2.
+ ///
+ /// Describes the details of each Custom Config Tdp levels. This supports up to MAX_CUSTOM_CTDP_ENTRIES number
+ /// of Custom ConfigTdp levels.
+ ///
+ PPM_CUSTOM_CTDP_TABLE CustomConfigTdpTable[MAX_CUSTOM_CTDP_ENTRIES];
+} PPM_CUSTOM_CTDP;
+
+///
+/// This structure is used to control enabled / disabled various PPM MSR lock settings
+///
+typedef struct _PPM_LOCK_ENABLES {
+ UINT32 PmgCstCfgCtrlLock : 1; ///< Setting this to 1 will set MSR 0xE2[15]
+ UINT32 OverclockingLock : 1; ///< Setting this to 1 will set MSR 0x194[20]
+ UINT32 ProcHotLock : 1; ///< Setting this to 1 will set MSR 0x1FC[23]
+ UINT32 Reserved : 29; ///< Bits reserved for future use.
+} PPM_LOCK_ENABLES;
+///
+/// PM Deep C State Limit
+///
+typedef enum {
+ Disabled = 0,
+ DeepC7,
+ DeepC7S
+} DEEP_C_STATE;
+///
+/// PPM Package C State Limit
+///
+typedef enum {
+ PkgC0C1 = 0,
+ PkgC2,
+ PkgC3,
+ PkgC6,
+ PkgC7,
+ PkgC7s,
+ PkgC8,
+ PkgC9,
+ PkgC10,
+ PkgCMax,
+ PkgCpuDefault = 254,
+ PkgAuto = 255
+} MAX_PKG_C_STATE;
+///
+/// PPM Package C State Time Limit
+///
+typedef enum {
+ TimeUnit1ns = 0,
+ TimeUnit32ns,
+ TimeUnit1024ns,
+ TimeUnit32768ns,
+ TimeUnit1048576ns,
+ TimeUnit33554432ns
+} C_STATE_TIME_UNIT;
+///
+/// Custom Power Uints.User can choose to enter in MilliWatts or Watts
+///
+typedef enum {
+ PowerUnitWatts = 0, ///< in Watts
+ PowerUnit125MilliWatts, ///< in 125 Milli Watts. Example 11.250 W Value to use for Power limts 90
+ PowerUnitMax
+} CUSTOM_POWER_UNIT;
+
+typedef enum {
+ Percent5 = 242,
+ Percent10 = 229,
+ Percent15 = 217,
+ Percent20 = 204,
+ Percent25 = 191,
+ Percent30 = 178,
+ Percent35 = 166,
+ Percent40 = 153,
+ Percent45 = 140,
+ Percent50 = 127,
+ Percent55 = 115,
+ Percent60 = 102,
+ Percent65 = 89,
+ Percent70 = 76,
+ Percent75 = 64,
+ Percent80 = 51,
+ Percent85 = 38,
+ Percent90 = 25,
+ Percent95 = 13,
+ Percent100 = 0
+} PL1_THERMAL_THROTTLE_FLOOR_UNIT;
+
+typedef struct {
+ PL1_THERMAL_THROTTLE_FLOOR_UNIT FloorIA; /// < FLOOR_IA, Default: 0 (Percent100)
+ PL1_THERMAL_THROTTLE_FLOOR_UNIT FloorGT; /// < FLOOR_GT, Default: 0 (Percent100)
+ PL1_THERMAL_THROTTLE_FLOOR_UNIT FloorPCH; /// < FLOOR_PCH, Default: 0 (Percent100)
+} PL1_THERMAL_CONTROL_FLOOR;
+
+///
+/// This structure is used to describe which of the Thermal functions will be enabled by Thermal implementation.
+///
+typedef struct {
+ UINT16 BiProcHot : 1; ///< Enable or Disable Bi-Directional PROCHOT#.
+ UINT16 TStates : 1; ///< Enable or Disable T states.
+ UINT16 DisableProcHotOut : 1; ///< Enable or Disable PROCHOT# signal being driven externally.
+ UINT16 DisableVRThermalAlert : 1; ///< Enable or Disable VR Thermal Alert.
+ UINT16 ProcHotResponce : 1; ///< Enable or Disable PROCHOT# Responce.
+ UINT16 AutoThermalReporting : 1; ///< Enable or Disable Thermal Reporting through ACPI tables.
+ UINT16 ThermalMonitor : 1; ///< Enable or Disable Thermal Monitor.
+ UINT16 Pl1ThermalControl : 2; ///< Disable(0), Enable/Manual(1), Auto(2) PL1 thermal throttling features
+ UINT16 ThermReserved : 7; ///< Reserved
+ PL1_THERMAL_CONTROL_FLOOR Pl1ThermalControlFloor; ///< PL1 Floor Throttle Values
+} THERM_FUNCTION_ENABLES;
+
+///
+/// Power management Configuration for all processor Power Management features enabling definitions are in this field.
+/// Platform code can enable/disable features thru this field.
+///
+typedef struct {
+ ///
+ /// This structure is used to describe which of the PPM functions should be enabled. For details of this structure,
+ /// please see Related Definitions.
+ ///
+ PPM_FUNCTION_ENABLES *pFunctionEnables;
+ ///
+ /// This structure is used to describe the custom CPU Frequency Table that should be used. For details of this
+ /// structure, please see Related Definitions.
+ ///
+ PPM_CUSTOM_RATIO_TABLE *pCustomRatioTable;
+ ///
+ /// This structure is used to describe long duration and short duration turbo settings. For details of this
+ /// structure, please see Related Definitions.
+ ///
+ PPM_TURBO_SETTINGS *pTurboSettings;
+ UINT8 S3RestoreMsrSwSmiNumber; ///< SW SMI number to restore the power Mgmt MSRs during S3 resume.
+ UINT8 *pRatioLimit; ///< This field is a pointer to Ratio Limit.
+ PPM_LOCK_ENABLES *pPpmLockEnables; ///< This field is a pointer to PPM_LOCK_ENABLES structure.
+ PPM_CUSTOM_CTDP *pCustomCtdpSettings; ///< This structure is used to describe the custom config TDP settings.
+ ///
+ /// This field is used to set the Max Pkg Cstate. Default set to Auto which limits the Max Pkg Cstate to deep C-state.
+ ///
+ MAX_PKG_C_STATE PkgCStateLimit;
+ C_STATE_TIME_UNIT CstateLatencyControl0TimeUnit; ///< TimeUnit for Latency Control0 MSR 0x60A[12:10].
+ C_STATE_TIME_UNIT CstateLatencyControl1TimeUnit; ///< TimeUnit for Latency Control1 MSR 0x60B[12:10].
+ C_STATE_TIME_UNIT CstateLatencyControl2TimeUnit; ///< TimeUnit for Latency Control2 MSR 0x60C[12:10].
+ C_STATE_TIME_UNIT CstateLatencyControl3TimeUnit; ///< TimeUnit for Latency Control3 MSR 0x633[12:10].
+ C_STATE_TIME_UNIT CstateLatencyControl4TimeUnit; ///< TimeUnit for Latency Control4 MSR 0x634[12:10].
+ C_STATE_TIME_UNIT CstateLatencyControl5TimeUnit; ///< TimeUnit for Latency Control5 MSR 0x635[12:10].
+ UINT16 CstateLatencyControl0Irtl; ///< Interrupt Response Time Limit of LatencyContol0 MSR 0x60A[9:0].
+ UINT16 CstateLatencyControl1Irtl; ///< Interrupt Response Time Limit of LatencyContol1 MSR 0x60B[9:0].
+ UINT16 CstateLatencyControl2Irtl; ///< Interrupt Response Time Limit of LatencyContol2 MSR 0x60C[9:0].
+ UINT16 CstateLatencyControl3Irtl; ///< Interrupt Response Time Limit of LatencyContol3 MSR 0x633[9:0].
+ UINT16 CstateLatencyControl4Irtl; ///< Interrupt Response Time Limit of LatencyContol4 MSR 0x634[9:0].
+ UINT16 CstateLatencyControl5Irtl; ///< Interrupt Response Time Limit of LatencyContol5 MSR 0x635[9:0].
+ BOOLEAN RfiFreqTunningOffsetIsNegative; ///< Specify RfiFreqTunningOffset is Positive or Negative.
+ UINT8 RfiFreqTunningOffset; ///< specify the Target FIVR Frequency offset.
+ ///
+ /// Calibrate 24MHz BCLK support; 0: NO_CALIBRATE, 1: PCODE_CALIBRATE, 2: BIOS_CALIBRATE (Default :1)
+ ///
+ UINT8 PcodeCalibration;
+ BOOLEAN EnableRerunPcodeCalibration; ///< Calibrate C state 24MHz BCLK support.
+ ///
+ /// This structure is used to describe which of the Thermal functions should be enabled. For details of this
+ /// structure, please see Related Definitions.
+ ///
+ THERM_FUNCTION_ENABLES *ThermalFuncEnables;
+ CUSTOM_POWER_UNIT CustomPowerUnit; ///< Power Management Custom Power Limit Unit.
+
+} POWER_MGMT_CONFIG;
+
+#endif
diff --git a/ReferenceCode/Haswell/Protocol/CpuProtocolLib.cif b/ReferenceCode/Haswell/Protocol/CpuProtocolLib.cif
new file mode 100644
index 0000000..4a25ea6
--- /dev/null
+++ b/ReferenceCode/Haswell/Protocol/CpuProtocolLib.cif
@@ -0,0 +1,27 @@
+<component>
+ name = "CpuProtocolLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Haswell\Protocol\"
+ RefName = "CpuProtocolLib"
+[files]
+"CpuProtocolLib.sdl"
+"CpuProtocolLib.mak"
+"CpuProtocolLib.inf"
+"CpuInfo\CpuInfo.c"
+"CpuInfo\CpuInfo.h"
+"CpuPlatformPolicy\CpuPlatformPolicy.c"
+"CpuPlatformPolicy\CpuPlatformPolicy.h"
+"CpuPlatformPolicy\CpuPmConfig.h"
+"MpService\MpService.c"
+"MpService\MpService.h"
+"Pfat\Pfat.c"
+"Pfat\Pfat.h"
+"PiMpService\PiMpService.c"
+"PiMpService\PiMpService.h"
+"PowerMgmtInitDone\PowerMgmtInitDone.c"
+"PowerMgmtInitDone\PowerMgmtInitDone.h"
+"PpmGlobalNvsArea\PpmGlobalNvsArea.c"
+"PpmGlobalNvsArea\PpmGlobalNvsArea.h"
+"SmmThunk\SmmThunk.c"
+"SmmThunk\SmmThunk.h"
+<endComponent>
diff --git a/ReferenceCode/Haswell/Protocol/CpuProtocolLib.inf b/ReferenceCode/Haswell/Protocol/CpuProtocolLib.inf
new file mode 100644
index 0000000..afd4836
--- /dev/null
+++ b/ReferenceCode/Haswell/Protocol/CpuProtocolLib.inf
@@ -0,0 +1,75 @@
+## @file
+# Component description file for the CPU protocol library
+#
+#@copyright
+# Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains an 'Intel Peripheral Driver' and uniquely
+# identified as "Intel Reference Module" and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+
+
+[defines]
+BASE_NAME = CpuProtocolLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ MpService/MpService.c
+ MpService/MpService.h
+ CpuPlatformPolicy/CpuPlatformPolicy.c
+ CpuPlatformPolicy/CpuPlatformPolicy.h
+ SmmThunk/SmmThunk.c
+ SmmThunk/SmmThunk.h
+ CpuInfo/CpuInfo.c
+ CpuInfo/CpuInfo.h
+ PiMpService/PiMpService.c
+ PiMpService/PiMpService.h
+ Pfat/Pfat.c
+ Pfat/Pfat.h
+ PowerMgmtInitDone/PowerMgmtInitDone.h
+ PowerMgmtInitDone/PowerMgmtInitDone.c
+ PpmGlobalNvsArea/PpmGlobalNvsArea.h
+ PpmGlobalNvsArea/PpmGlobalNvsArea.c
+
+[includes.common]
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/SampleCode
+
+#
+# Edk II Glue Library, some hearder are included by R9 header so have to include
+#
+
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Framework
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[nmake.common]
+C_STD_INCLUDE=
diff --git a/ReferenceCode/Haswell/Protocol/CpuProtocolLib.mak b/ReferenceCode/Haswell/Protocol/CpuProtocolLib.mak
new file mode 100644
index 0000000..e83e201
--- /dev/null
+++ b/ReferenceCode/Haswell/Protocol/CpuProtocolLib.mak
@@ -0,0 +1,28 @@
+# MAK file for the ModulePart:PpmProtocolLib
+
+all : CpuProtocolLib
+
+$(BUILD_DIR)\CpuProtocolLib.lib : CpuProtocolLib
+
+CpuProtocolLib : $(BUILD_DIR)\CpuProtocolLib.mak CpuProtocolLibBin
+
+$(BUILD_DIR)\CpuProtocolLib.mak : $(CpuProtocolLib_DIR)\$(@B).cif $(CpuProtocolLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(CpuProtocolLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+
+CpuProtocolLibDxe_DEFINES = \
+ $(CFLAGS) \
+!IF "$(x64_BUILD)"=="1"
+ /DMDE_CPU_X64 \
+!ELSE
+ /DMDE_CPU_IA32 \
+!ENDIF
+
+
+CpuProtocolLibBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\CpuProtocolLib.mak all\
+ "MY_INCLUDES=$(EDK_INCLUDES) $(PROJECT_CPU_INCLUDES) $(EdkIIGlueLib_INCLUDES)" \
+ "CFLAGS=$(CpuProtocolLibDxe_DEFINES)"\
+ TYPE=LIBRARY \
+ LIBRARY_NAME=$(CpuProtocolLib_LIB)
diff --git a/ReferenceCode/Haswell/Protocol/CpuProtocolLib.sdl b/ReferenceCode/Haswell/Protocol/CpuProtocolLib.sdl
new file mode 100644
index 0000000..7fb311c
--- /dev/null
+++ b/ReferenceCode/Haswell/Protocol/CpuProtocolLib.sdl
@@ -0,0 +1,29 @@
+TOKEN
+ Name = CpuProtocolLib_SUPPORT
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable CpuProtocolLib support in Project"
+End
+
+MODULE
+ Help = "Includes CpuProtocolLib.mak to Project"
+ File = "CpuProtocolLib.mak"
+End
+
+PATH
+ Name = "CpuProtocolLib_DIR"
+End
+
+ELINK
+ Name = "CpuProtocolLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\CpuProtocolLib.lib"
+ Parent = "CpuProtocolLib_LIB"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/Haswell/Protocol/MpService/MpService.c b/ReferenceCode/Haswell/Protocol/MpService/MpService.c
new file mode 100644
index 0000000..bf3c0c2
--- /dev/null
+++ b/ReferenceCode/Haswell/Protocol/MpService/MpService.c
@@ -0,0 +1,24 @@
+/** @file
+ This is a protocol produced by the MP DXE driver.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains 'Framework Code' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may not be modified, except as allowed by
+ additional terms of your license agreement.
+**/
+#include "Tiano.h"
+#include EFI_PROTOCOL_DEFINITION (MpService)
+
+EFI_GUID gEfiMpServiceProtocolGuid = EFI_MP_SERVICES_PROTOCOL_GUID;
+
+EFI_GUID_STRING(&gEfiMpServiceProtocolGuid, "MP SERVICE", "MP Service Protocol");
diff --git a/ReferenceCode/Haswell/Protocol/MpService/MpService.h b/ReferenceCode/Haswell/Protocol/MpService/MpService.h
new file mode 100644
index 0000000..03d3d2a
--- /dev/null
+++ b/ReferenceCode/Haswell/Protocol/MpService/MpService.h
@@ -0,0 +1,216 @@
+/** @file
+ This protocol produces MP Protocol
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains 'Framework Code' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may not be modified, except as allowed by
+ additional terms of your license agreement.
+**/
+#ifndef _MP_H_
+#define _MP_H_
+
+#include "LinkedList.h"
+
+#include EFI_PROTOCOL_CONSUMER(SmmBase) // added for EFI_AP_PROCEDURE
+
+#include EFI_PROTOCOL_CONSUMER (CpuIo)
+
+#define EFI_MP_SERVICES_PROTOCOL_GUID \
+ { \
+ 0xf33261e7, 0x23cb, 0x11d5, 0xbd, 0x5c, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 \
+ }
+
+EFI_FORWARD_DECLARATION (EFI_MP_SERVICES_PROTOCOL);
+
+#ifndef DELIVERY_MODE_FIXED
+#define DELIVERY_MODE_FIXED 0x0
+#define DELIVERY_MODE_LOWEST_PRIORITY 0x1
+#define DELIVERY_MODE_SMI 0x2
+#define DELIVERY_MODE_REMOTE_READ 0x3
+#define DELIVERY_MODE_NMI 0x4
+#define DELIVERY_MODE_INIT 0x5
+#define DELIVERY_MODE_SIPI 0x6
+#define DELIVERY_MODE_MAX 0x7
+
+#define TRIGGER_MODE_EDGE 0x0
+#define TRIGGER_MODE_LEVEL 0x1
+#endif
+
+typedef union {
+ struct {
+ UINT32 Status : 2;
+ UINT32 Tested : 1;
+ UINT32 Reserved1 : 13;
+ UINT32 VirtualMemoryUnavailable : 1;
+ UINT32 Ia32ExecutionUnavailable : 1;
+ UINT32 FloatingPointUnavailable : 1;
+ UINT32 MiscFeaturesUnavailable : 1;
+ UINT32 Reserved2 : 12;
+ } Bits;
+ UINT32 Uint32;
+} EFI_MP_HEALTH_FLAGS;
+
+#define EFI_MP_HEALTH_FLAGS_STATUS_HEALTHY 0x0
+#define EFI_MP_HEALTH_FLAGS_STATUS_PERFORMANCE_RESTRICTED 0x1
+#define EFI_MP_HEALTH_FLAGS_STATUS_FUNCTIONALLY_RESTRICTED 0x2
+
+typedef struct {
+ EFI_MP_HEALTH_FLAGS Flags;
+ UINT32 TestStatus;
+} EFI_MP_HEALTH;
+
+typedef enum {
+ EfiCpuAP = 0,
+ EfiCpuBSP,
+ EfiCpuDesignationMaximum
+} EFI_CPU_DESIGNATION;
+
+typedef struct {
+ UINT32 Package;
+ UINT32 Die;
+ UINT32 Core;
+ UINT32 Thread;
+} PHYSICAL_LOCATION;
+
+typedef struct {
+ UINT32 ApicID;
+ BOOLEAN Enabled;
+ EFI_CPU_DESIGNATION Designation;
+ EFI_MP_HEALTH Health;
+ UINTN PackageNumber;
+ UINTN NumberOfCores;
+ UINTN NumberOfThreads;
+ UINT64 ProcessorPALCompatibilityFlags;
+ UINT64 ProcessorTestMask;
+} EFI_MP_PROC_CONTEXT;
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MP_SERVICES_GET_GENERAL_MP_INFO)(
+ IN EFI_MP_SERVICES_PROTOCOL *This,
+ OUT UINTN *NumberOfCPUs,
+ OUT UINTN *MaximumNumberOfCPUs,
+ OUT UINTN *NumberOfEnabledCPUs,
+ OUT UINTN *RendezvousIntNumber,
+ OUT UINTN *RendezvousProcLength
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MP_SERVICES_GET_PROCESSOR_CONTEXT)(
+ IN EFI_MP_SERVICES_PROTOCOL *This,
+ IN UINTN ProcessorNumber,
+ IN OUT UINTN *BufferLength,
+ IN OUT EFI_MP_PROC_CONTEXT *ProcessorContextBuffer
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MP_SERVICES_STARTUP_ALL_APS)(
+ IN EFI_MP_SERVICES_PROTOCOL *This,
+ IN EFI_AP_PROCEDURE Procedure,
+ IN BOOLEAN SingleThread,
+ IN EFI_EVENT WaitEvent OPTIONAL,
+ IN UINTN TimeoutInMicroSecs OPTIONAL,
+ IN OUT VOID *ProcArguments OPTIONAL,
+ OUT UINTN *FailedCPUList OPTIONAL
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MP_SERVICES_STARTUP_THIS_AP)(
+ IN EFI_MP_SERVICES_PROTOCOL *This,
+ IN EFI_AP_PROCEDURE Procedure,
+ IN UINTN ProcessorNumber,
+ IN EFI_EVENT WaitEvent OPTIONAL,
+ IN UINTN TimeoutInMicroSecs OPTIONAL,
+ IN OUT VOID *ProcArguments OPTIONAL
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MP_SERVICES_SWITCH_BSP)(
+ IN EFI_MP_SERVICES_PROTOCOL *This,
+ IN UINTN ProcessorNumber,
+ IN BOOLEAN EnableOldBSP
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MP_SERVICES_SEND_IPI)(
+ IN EFI_MP_SERVICES_PROTOCOL *This,
+ IN UINTN ProcessorNumber,
+ IN UINTN VectorNumber,
+ IN UINTN DeliveryMode
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MP_SERVICES_ENABLEDISABLEAP)(
+ IN EFI_MP_SERVICES_PROTOCOL *This,
+ IN UINTN ProcessorNumber,
+ IN BOOLEAN NewAPState,
+ IN EFI_MP_HEALTH *HealthState
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MP_SERVICES_WHOAMI)(
+ IN EFI_MP_SERVICES_PROTOCOL *This,
+ OUT UINTN *ProcessorNumber
+ );
+
+///
+/// This information is basically from Intel Platform Innovation Framework for EFI Multiprocessor Services Protocol
+/// Specification. When installed, the MP Services Protocol produces a collection of services that are needed for MP
+/// management, such as initialization and management of application processors.
+///
+struct _EFI_MP_SERVICES_PROTOCOL {
+ ///
+ /// This service retrieves general information of multiprocessors in the system.
+ ///
+ EFI_MP_SERVICES_GET_GENERAL_MP_INFO GetGeneralMPInfo;
+ ///
+ /// This service gets detailed MP-related information of the requested processor.
+ ///
+ EFI_MP_SERVICES_GET_PROCESSOR_CONTEXT GetProcessorContext;
+ ///
+ /// This function is used to dispatch all enabled APs to the function specified by Procedure.
+ ///
+ EFI_MP_SERVICES_STARTUP_ALL_APS StartupAllAPs;
+ ///
+ /// This function is used to dispatch one enabled AP to the function provided by the caller.
+ ///
+ EFI_MP_SERVICES_STARTUP_THIS_AP StartupThisAP;
+ ///
+ /// This service switches the requested AP to be the BSP from that point onward.
+ ///
+ EFI_MP_SERVICES_SWITCH_BSP SwitchBSP;
+ ///
+ /// This service sends an IPI to a specified AP.
+ ///
+ EFI_MP_SERVICES_SEND_IPI SendIPI;
+ ///
+ /// This service lets the caller enable or disable an AP.
+ ///
+ EFI_MP_SERVICES_ENABLEDISABLEAP EnableDisableAP;
+ ///
+ /// This service lets the caller processor get its handle number, with which any processor in the system can be
+ /// uniquely identified.
+ ///
+ EFI_MP_SERVICES_WHOAMI WhoAmI;
+};
+
+extern EFI_GUID gEfiMpServiceProtocolGuid;
+
+#endif
diff --git a/ReferenceCode/Haswell/Protocol/Pfat/Pfat.c b/ReferenceCode/Haswell/Protocol/Pfat/Pfat.c
new file mode 100644
index 0000000..b86e1f8
--- /dev/null
+++ b/ReferenceCode/Haswell/Protocol/Pfat/Pfat.c
@@ -0,0 +1,45 @@
+/** @file
+ This file defines PFAT Abstraction Protocol
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+///
+/// Statements that include other files
+///
+///
+/// External include files do NOT need to be explicitly specified in real EDKII
+/// environment
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#endif
+///
+/// Include the PFAT SMM Protocol header file
+///
+#include "Pfat.h"
+
+///
+/// PFAT SMM Protocol GUID definition
+///
+EFI_GUID gSmmPfatProtocolGuid = SMM_PFAT_PROTOCOL_GUID;
+
+///
+/// PFAT SMM Protocol description
+///
+EFI_GUID_STRING(&gSmmPfatProtocolGuid, "SMM PFAT Protocol", "Intel(R) Platform Firmware Armoring Technology Protocol");
diff --git a/ReferenceCode/Haswell/Protocol/Pfat/Pfat.h b/ReferenceCode/Haswell/Protocol/Pfat/Pfat.h
new file mode 100644
index 0000000..b78905a
--- /dev/null
+++ b/ReferenceCode/Haswell/Protocol/Pfat/Pfat.h
@@ -0,0 +1,129 @@
+/** @file
+ This file defines the PFAT Protocol which implements the
+ Intel(R) PFAT Host Controller Compatibility Interface.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _PFAT_H_
+#define _PFAT_H_
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+///
+/// GUID to locate PFAT SMM Protocol
+///
+#define SMM_PFAT_PROTOCOL_GUID \
+ { \
+ 0xc3e156e4, 0x27b3, 0x4dff, 0xb8, 0x96, 0xfb, 0x11, 0x3b, 0x2e, 0x68, 0xb5 \
+ }
+#else
+///
+/// GUID to locate PFAT SMM Protocol
+///
+#define SMM_PFAT_PROTOCOL_GUID \
+ { \
+ 0xc3e156e4, 0x27b3, 0x4dff, \
+ { \
+ 0xb8, 0x96, 0xfb, 0x11, 0x3b, 0x2e, 0x68, 0xb5 \
+ } \
+ }
+#endif
+
+///
+/// Extern the GUID for protocol users.
+///
+extern EFI_GUID gSmmPfatProtocolGuid;
+
+//
+// Forward reference for ANSI C compatibility
+//
+typedef struct _PFAT_PROTOCOL PFAT_PROTOCOL;
+
+/**
+ This service will write PFAT_DIRECTORY MSR and invoke the PFAT Module by writing to PLAT_FRMW_PROT_TRIGGER MSR for writing/erasing to flash.
+ BIOS should invoke PFAT_PROTOCOL.Write() or PFAT_PROTOCOL.Erase() function prior to calling PFAT_PROTOCOL.Execute() for flash writes/erases (except for BiosUpdate).
+ Write()/Erase() function will render PFAT script during execution.
+ Execute() function will implement the following steps:
+ 1. Update PFAT directory with address of PUP.
+ 2. All the AP's except the master thread are put to sleep.
+ 3. PFAT module is invoked from BSP to execute desired operation.
+ If BiosUpdate flag is set to true, PUP (PUP Header + PFAT Script + Update data) is part of data that is passed to SMI Handler. SMI Handler invokes PFAT module to process the update.
+ This function would be called by runtime driver, please do not use any MMIO macro here.
+
+ @param[in] This Pointer to the PFAT_PROTOCOL instance.
+ @param[in] BiosUpdate Flag to indicate flash update is requested by the Tool
+
+ @retval EFI_SUCCESS Successfully completed flash operation.
+ @retval EFI_INVALID_PARAMETER The parameters specified are not valid.
+ @retval EFI_UNSUPPORTED The CPU or SPI memory is not supported.
+ @retval EFI_DEVICE_ERROR Device error, command aborts abnormally.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *PFAT_EXECUTE)(
+ IN PFAT_PROTOCOL *This,
+ IN BOOLEAN BiosUpdate
+ );
+
+/**
+ This service fills PFAT script buffer for flash writes.
+ BIOS should invoke this function prior to calling PFAT_PROTOCOL.Execute() with all the relevant data required for flash write.
+ This function will not invoke PFAT Module, only create script required for writing to flash.
+ This function would be called by runtime driver, please do not use any MMIO macro here.
+
+ @param[in] This Pointer to the PFAT_PROTOCOL instance.
+ @param[in] Address This value specifies the offset from the start of the SPI Flash component where BIOS Image is located.
+ @param[in] DataByteCount Number of bytes in the data portion.
+ @param[in] Buffer Pointer to caller-allocated buffer containing the dada sent.
+**/
+typedef
+VOID
+(EFIAPI *PFAT_WRITE)(
+ IN PFAT_PROTOCOL *This,
+ IN UINTN Address,
+ IN UINT32 DataByteCount,
+ IN OUT UINT8 *Buffer
+ );
+
+/**
+ This service fills PFAT script buffer for erasing blocks in flash.
+ BIOS should invoke this function prior to calling PFAT_PROTOCOL.Execute() with all the relevant data required for flash erase.
+ This function will not invoke PFAT module, only create script required for erasing each block in the flash.
+ This function would be called by runtime driver, please do not use any MMIO macro here.
+
+ @param[in] This Pointer to the PFAT_PROTOCOL instance.
+ @param[in] Address This value specifies the offset from the start of the SPI Flash component where BIOS Image is located.
+**/
+typedef
+VOID
+(EFIAPI *PFAT_ERASE)(
+ IN PFAT_PROTOCOL *This,
+ IN UINTN Address
+ );
+
+/**
+ This protocol provides all the services required for flash writes/erases via PFAT
+ PFAT Module can only be launched from SMM, this means that all flash writes & erases
+ that BIOS needs to do must flow thru SMI Handler and so dependency on SMM_BASE_PROTOCOL
+ for installing PFAT Protocol. Prior to PFAT SMM Protocol being installed there should
+ be no writes/erases to flash.
+**/
+struct _PFAT_PROTOCOL {
+ PFAT_WRITE Write; ///< Invoked to fill up PFAT script buffer for flash writes
+ PFAT_ERASE Erase; ///< Invoked to fill up PFAT script buffer for flash erases
+ PFAT_EXECUTE Execute; ///< Will trigger invocation of PFAT module
+};
+
+#endif
diff --git a/ReferenceCode/Haswell/Protocol/PiMpService/PiMpService.c b/ReferenceCode/Haswell/Protocol/PiMpService/PiMpService.c
new file mode 100644
index 0000000..c1a65e5
--- /dev/null
+++ b/ReferenceCode/Haswell/Protocol/PiMpService/PiMpService.c
@@ -0,0 +1,24 @@
+/** @file
+ GUID Definition for the MP Services Protocol defined in the PI 1.1 spec.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains 'Framework Code' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may not be modified, except as allowed by
+ additional terms of your license agreement.
+**/
+#include "Tiano.h"
+#include EFI_PROTOCOL_DEFINITION (PiMpService)
+
+EFI_GUID gEfiPiMpServiceProtocolGuid = EFI_PI_MP_SERVICES_PROTOCOL_GUID;
+
+EFI_GUID_STRING(&gEfiPiMpServiceProtocolGuid, "PI MP SERVICE", "PI MP Service Protocol");
diff --git a/ReferenceCode/Haswell/Protocol/PiMpService/PiMpService.h b/ReferenceCode/Haswell/Protocol/PiMpService/PiMpService.h
new file mode 100644
index 0000000..1bf33b1
--- /dev/null
+++ b/ReferenceCode/Haswell/Protocol/PiMpService/PiMpService.h
@@ -0,0 +1,500 @@
+/** @file
+ Definitions for the PI MP Services Protocol defined in the PI spec.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains 'Framework Code' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may not be modified, except as allowed by
+ additional terms of your license agreement.
+
+**/
+#ifndef _PI_MP_SERVICES_H_
+#define _PI_MP_SERVICES_H_
+
+///
+/// Share some definitions from Framework MP Services Protocol
+///
+#include EFI_PROTOCOL_CONSUMER (MpService)
+
+///
+/// Global ID for the EFI_PI_MP_SERVICES_PROTOCOL.
+///
+#define EFI_PI_MP_SERVICES_PROTOCOL_GUID \
+ { \
+ 0x3fdda605, 0xa76e, 0x4f46, \
+ { \
+ 0xad, 0x29, 0x12, 0xf4, 0x53, 0x1b, 0x3d, 0x08 \
+ } \
+ }
+
+///
+/// Forward declaration for the EFI_PI_MP_SERVICES_PROTOCOL.
+///
+typedef struct _EFI_PI_MP_SERVICES_PROTOCOL EFI_PI_MP_SERVICES_PROTOCOL;
+
+///
+/// Terminator for a list of failed CPUs returned by StartAllAPs().
+///
+#define END_OF_CPU_LIST 0xffffffff
+
+///
+/// This bit is used in the StatusFlag field of EFI_PROCESSOR_INFORMATION and
+/// indicates whether the processor is playing the role of BSP. If the bit is 1,
+/// then the processor is BSP. Otherwise, it is AP.
+///
+#define PROCESSOR_AS_BSP_BIT 0x00000001
+
+///
+/// This bit is used in the StatusFlag field of EFI_PROCESSOR_INFORMATION and
+/// indicates whether the processor is enabled. If the bit is 1, then the
+/// processor is enabled. Otherwise, it is disabled.
+///
+#define PROCESSOR_ENABLED_BIT 0x00000002
+
+///
+/// This bit is used in the StatusFlag field of EFI_PROCESSOR_INFORMATION and
+/// indicates whether the processor is healthy. If the bit is 1, then the
+/// processor is healthy. Otherwise, some fault has been detected for the processor.
+///
+#define PROCESSOR_HEALTH_STATUS_BIT 0x00000004
+
+///
+/// Structure that describes the pyhiscal location of a logical CPU.
+///
+typedef struct {
+ ///
+ /// Zero-based physical package number that identifies the cartridge of the processor.
+ ///
+ UINT32 Package;
+ ///
+ /// Zero-based physical core number within package of the processor.
+ ///
+ UINT32 Core;
+ ///
+ /// Zero-based logical thread number within core of the processor.
+ ///
+ UINT32 Thread;
+} EFI_CPU_PHYSICAL_LOCATION;
+
+///
+/// Structure that describes information about a logical CPU.
+///
+typedef struct {
+ ///
+ /// The unique processor ID determined by system hardware. For IA32 and X64,
+ /// the processor ID is the same as the Local APIC ID. Only the lower 8 bits
+ /// are used, and higher bits are reserved. For IPF, the lower 16 bits contains
+ /// id/eid, and higher bits are reserved.
+ ///
+ UINT64 ProcessorId;
+ ///
+ /// Flags indicating if the processor is BSP or AP, if the processor is enabled
+ /// or disabled, and if the processor is healthy. Bits 3..31 are reserved and
+ /// must be 0.
+ ///
+ /// <pre>
+ /// BSP ENABLED HEALTH Description
+ /// === ======= ====== ===================================================
+ /// 0 0 0 Unhealthy Disabled AP.
+ /// 0 0 1 Healthy Disabled AP.
+ /// 0 1 0 Unhealthy Enabled AP.
+ /// 0 1 1 Healthy Enabled AP.
+ /// 1 0 0 Invalid. The BSP can never be in the disabled state.
+ /// 1 0 1 Invalid. The BSP can never be in the disabled state.
+ /// 1 1 0 Unhealthy Enabled BSP.
+ /// 1 1 1 Healthy Enabled BSP.
+ /// </pre>
+ ///
+ UINT32 StatusFlag;
+ ///
+ /// The physical location of the processor, including the physical package number
+ /// that identifies the cartridge, the physical core number within package, and
+ /// logical thread number within core.
+ ///
+ EFI_CPU_PHYSICAL_LOCATION Location;
+} EFI_PROCESSOR_INFORMATION;
+
+/**
+ This service retrieves the number of logical processor in the platform
+ and the number of those logical processors that are enabled on this boot.
+ This service may only be called from the BSP.
+
+ This function is used to retrieve the following information:
+ - The number of logical processors that are present in the system.
+ - The number of enabled logical processors in the system at the instant
+ this call is made.
+
+ Because MP Service Protocol provides services to enable and disable processors
+ dynamically, the number of enabled logical processors may vary during the
+ course of a boot session.
+
+ If this service is called from an AP, then EFI_DEVICE_ERROR is returned.
+ If NumberOfProcessors or NumberOfEnabledProcessors is NULL, then
+ EFI_INVALID_PARAMETER is returned. Otherwise, the total number of processors
+ is returned in NumberOfProcessors, the number of currently enabled processor
+ is returned in NumberOfEnabledProcessors, and EFI_SUCCESS is returned.
+
+ @param[in] This - A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
+ @param[in] NumberOfProcessors - Pointer to the total number of logical processors in the system,
+ including the BSP and disabled APs.
+ @param[in] NumberOfEnabledProcessors - Pointer to the number of enabled logical processors that exist
+ in system, including the BSP.
+
+ @retval EFI_SUCCESS - Number of logical processors and enabled logical processors retrieved.
+ @retval EFI_DEVICE_ERROR - Caller processor is AP.
+ @retval EFI_INVALID_PARAMETER - NumberOfProcessors is NULL.
+ @retval EFI_INVALID_PARAMETER - NumberOfEnabledProcessors is NULL.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_PI_MP_SERVICES_GET_NUMBER_OF_PROCESSORS)(
+ IN EFI_PI_MP_SERVICES_PROTOCOL *This,
+ OUT UINTN *NumberOfProcessors,
+ OUT UINTN *NumberOfEnabledProcessors
+ );
+
+/**
+ Gets detailed MP-related information on the requested processor at the
+ instant this call is made. This service may only be called from the BSP.
+
+ This service retrieves detailed MP-related information about any processor
+ on the platform. Note the following:
+ - The processor information may change during the course of a boot session.
+ - The information presented here is entirely MP related.
+
+ Information regarding the number of caches and their sizes, frequency of operation,
+ slot numbers is all considered platform-related information and is not provided
+ by this service.
+
+ @param[in] This - A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
+ @param[in] ProcessorNumber - The handle number of processor.
+ @param[in] ProcessorInfoBuffer - A pointer to the buffer where information for the requested processor is deposited.
+
+ @retval EFI_SUCCESS - Processor information successfully returned.
+ @retval EFI_DEVICE_ERROR - Caller processor is AP.
+ @retval EFI_INVALID_PARAMETER - ProcessorInfoBuffer is NULL
+ @retval EFI_NOT_FOUND - Processor with the handle specified by ProcessorNumber does not exist.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_PI_MP_SERVICES_GET_PROCESSOR_INFO)(
+ IN EFI_PI_MP_SERVICES_PROTOCOL *This,
+ IN UINTN ProcessorNumber,
+ OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer
+ );
+
+/**
+ This service executes a caller provided function on all enabled APs. APs can
+ run either simultaneously or one at a time in sequence. This service supports
+ both blocking and non-blocking requests. The non-blocking requests use EFI
+ events so the BSP can detect when the APs have finished. This service may only
+ be called from the BSP.
+
+ This function is used to dispatch all the enabled APs to the function specified
+ by Procedure. If any enabled AP is busy, then EFI_NOT_READY is returned
+ immediately and Procedure is not started on any AP.
+
+ If SingleThread is TRUE, all the enabled APs execute the function specified by
+ Procedure one by one, in ascending order of processor handle number. Otherwise,
+ all the enabled APs execute the function specified by Procedure simultaneously.
+
+ If WaitEvent is NULL, execution is in blocking mode. The BSP waits until all
+ APs finish or TimeoutInMicroSecs expires. Otherwise, execution is in non-blocking
+ mode, and the BSP returns from this service without waiting for APs. If a
+ non-blocking mode is requested after the UEFI Event EFI_EVENT_GROUP_READY_TO_BOOT
+ is signaled, then EFI_UNSUPPORTED must be returned.
+
+ If the timeout specified by TimeoutInMicroseconds expires before all APs return
+ from Procedure, then Procedure on the failed APs is terminated. All enabled APs
+ are always available for further calls to EFI_PI_MP_SERVICES_PROTOCOL.StartupAllAPs()
+ and EFI_PI_MP_SERVICES_PROTOCOL.StartupThisAP(). If FailedCpuList is not NULL, its
+ content points to the list of processor handle numbers in which Procedure was
+ terminated.
+
+ Note: It is the responsibility of the consumer of the EFI_PI_MP_SERVICES_PROTOCOL.StartupAllAPs()
+ to make sure that the nature of the code that is executed on the BSP and the
+ dispatched APs is well controlled. The MP Services Protocol does not guarantee
+ that the Procedure function is MP-safe. Hence, the tasks that can be run in
+ parallel are limited to certain independent tasks and well-controlled exclusive
+ code. EFI services and protocols may not be called by APs unless otherwise
+ specified.
+
+ In blocking execution mode, BSP waits until all APs finish or
+ TimeoutInMicroSeconds expires.
+
+ In non-blocking execution mode, BSP is freed to return to the caller and then
+ proceed to the next task without having to wait for APs. The following
+ sequence needs to occur in a non-blocking execution mode:
+
+ -# The caller that intends to use this MP Services Protocol in non-blocking
+ mode creates WaitEvent by calling the EFI CreateEvent() service. The caller
+ invokes EFI_PI_MP_SERVICES_PROTOCOL.StartupAllAPs(). If the parameter WaitEvent
+ is not NULL, then StartupAllAPs() executes in non-blocking mode. It requests
+ the function specified by Procedure to be started on all the enabled APs,
+ and releases the BSP to continue with other tasks.
+ -# The caller can use the CheckEvent() and WaitForEvent() services to check
+ the state of the WaitEvent created in step 1.
+ -# When the APs complete their task or TimeoutInMicroSecondss expires, the MP
+ Service signals WaitEvent by calling the EFI SignalEvent() function. If
+ FailedCpuList is not NULL, its content is available when WaitEvent is
+ signaled. If all APs returned from Procedure prior to the timeout, then
+ FailedCpuList is set to NULL. If not all APs return from Procedure before
+ the timeout, then FailedCpuList is filled in with the list of the failed
+ APs. The buffer is allocated by MP Service Protocol using AllocatePool().
+ It is the caller's responsibility to free the buffer with FreePool() service.
+ -# This invocation of SignalEvent() function informs the caller that invoked
+ EFI_PI_MP_SERVICES_PROTOCOL.StartupAllAPs() that either all the APs completed
+ the specified task or a timeout occurred. The contents of FailedCpuList
+ can be examined to determine which APs did not complete the specified task
+ prior to the timeout.
+
+ @param[in] This - A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
+ @param[in] Procedure - A pointer to the function to be run on enabled APs of the system.
+ @param[in] SingleThread - Indicates whether to execute the function simultaneously or one by one..
+ @param[in] WaitEvent - The event created by the caller.
+ If it is NULL, then execute in blocking mode.
+ If it is not NULL, then execute in non-blocking mode.
+ @param[in] TimeoutInMicrosecsond - The time limit in microseconds for this AP to finish the function.
+ Zero means infinity.
+ @param[in] ProcArgument - Pointer to the optional parameter of the assigned function.
+ @param[in] FailedCpuList - The list of processor numbers that fail to finish the function before
+ TimeoutInMicrosecsond expires.
+
+ @retval EFI_SUCCESS - In blocking mode, all APs have finished before the timeout expired.
+ @retval EFI_SUCCESS - In non-blocking mode, function has been dispatched to all enabled APs.
+ @retval EFI_DEVICE_ERROR - Caller processor is AP.
+ @retval EFI_NOT_STARTED - No enabled AP exists in the system.
+ @retval EFI_NOT_READY - Any enabled AP is busy.
+ @retval EFI_TIMEOUT - In blocking mode, The timeout expired before all enabled APs have finished.
+ @retval EFI_INVALID_PARAMETER - Procedure is NULL.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_PI_MP_SERVICES_STARTUP_ALL_APS)(
+ IN EFI_PI_MP_SERVICES_PROTOCOL *This,
+ IN EFI_AP_PROCEDURE Procedure,
+ IN BOOLEAN SingleThread,
+ IN EFI_EVENT WaitEvent OPTIONAL,
+ IN UINTN TimeoutInMicroSeconds,
+ IN VOID *ProcedureArgument OPTIONAL,
+ OUT UINTN **FailedCpuList OPTIONAL
+ );
+
+/**
+ This service lets the caller get one enabled AP to execute a caller-provided
+ function. The caller can request the BSP to either wait for the completion
+ of the AP or just proceed with the next task by using the EFI event mechanism.
+ See EFI_PI_MP_SERVICES_PROTOCOL.StartupAllAPs() for more details on non-blocking
+ execution support. This service may only be called from the BSP.
+
+ This function is used to dispatch one enabled AP to the function specified by
+ Procedure passing in the argument specified by ProcedureArgument. If WaitEvent
+ is NULL, execution is in blocking mode. The BSP waits until the AP finishes or
+ TimeoutInMicroSecondss expires. Otherwise, execution is in non-blocking mode.
+ BSP proceeds to the next task without waiting for the AP. If a non-blocking mode
+ is requested after the UEFI Event EFI_EVENT_GROUP_READY_TO_BOOT is signaled,
+ then EFI_UNSUPPORTED must be returned.
+
+ If the timeout specified by TimeoutInMicroseconds expires before the AP returns
+ from Procedure, then execution of Procedure by the AP is terminated. The AP is
+ available for subsequent calls to EFI_PI_MP_SERVICES_PROTOCOL.StartupAllAPs() and
+ EFI_PI_MP_SERVICES_PROTOCOL.StartupThisAP().
+
+ @param[in] This - A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
+ @param[in] Procedure - A pointer to the function to be run on the designated AP.
+ @param[in] ProcessorNumber - The handle number of AP..
+ @param[in] WaitEvent - The event created by the caller.
+ If it is NULL, then execute in blocking mode.
+ If it is not NULL, then execute in non-blocking mode.
+ @param[in] TimeoutInMicroseconds - The time limit in microseconds for this AP to finish the function.
+ Zero means infinity.
+ @param[in] ProcArgument - Pointer to the optional parameter of the assigned function.
+ @param[in] Finished - Indicates whether AP has finished assigned function.
+ In blocking mode, it is ignored.
+
+ @retval EFI_SUCCESS - In blocking mode, specified AP has finished before the timeout expires.
+ @retval EFI_SUCCESS - In non-blocking mode, function has been dispatched to specified AP.
+ @retval EFI_DEVICE_ERROR - Caller processor is AP.
+ @retval EFI_TIMEOUT - In blocking mode, the timeout expires before specified AP has finished.
+ @retval EFI_NOT_READY - Specified AP is busy.
+ @retval EFI_NOT_FOUND - Processor with the handle specified by ProcessorNumber does not exist.
+ @retval EFI_INVALID_PARAMETER - ProcessorNumber specifies the BSP or disabled AP.
+ @retval EFI_INVALID_PARAMETER - Procedure is NULL.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_PI_MP_SERVICES_STARTUP_THIS_AP)(
+ IN EFI_PI_MP_SERVICES_PROTOCOL *This,
+ IN EFI_AP_PROCEDURE Procedure,
+ IN UINTN ProcessorNumber,
+ IN EFI_EVENT WaitEvent OPTIONAL,
+ IN UINTN TimeoutInMicroseconds,
+ IN VOID *ProcedureArgument OPTIONAL,
+ OUT BOOLEAN *Finished OPTIONAL
+ );
+
+/**
+ This service switches the requested AP to be the BSP from that point onward.
+ This service changes the BSP for all purposes. This call can only be performed
+ by the current BSP.
+
+ This service switches the requested AP to be the BSP from that point onward.
+ This service changes the BSP for all purposes. The new BSP can take over the
+ execution of the old BSP and continue seamlessly from where the old one left
+ off. This service may not be supported after the UEFI Event EFI_EVENT_GROUP_READY_TO_BOOT
+ is signaled.
+
+ If the BSP cannot be switched prior to the return from this service, then
+ EFI_UNSUPPORTED must be returned.
+
+ @param[in] This - A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
+ @param[in] ProcessorNumber - The handle number of processor.
+ @param[in] EnableOldBSP - Whether to enable or disable the original BSP.
+
+ @retval EFI_SUCCESS - BSP successfully switched.
+ @retval EFI_DEVICE_ERROR - Caller processor is AP.
+ @retval EFI_NOT_FOUND - Processor with the handle specified by ProcessorNumber does not exist.
+ @retval EFI_INVALID_PARAMETER - ProcessorNumber specifies the BSP or disabled AP.
+ @retval EFI_NOT_READY - Specified AP is busy.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_PI_MP_SERVICES_SWITCH_BSP)(
+ IN EFI_PI_MP_SERVICES_PROTOCOL *This,
+ IN UINTN ProcessorNumber,
+ IN BOOLEAN EnableOldBSP
+ );
+
+/**
+ This service lets the caller enable or disable an AP from this point onward.
+ This service may only be called from the BSP.
+
+ This service allows the caller enable or disable an AP from this point onward.
+ The caller can optionally specify the health status of the AP by Health. If
+ an AP is being disabled, then the state of the disabled AP is implementation
+ dependent. If an AP is enabled, then the implementation must guarantee that a
+ complete initialization sequence is performed on the AP, so the AP is in a state
+ that is compatible with an MP operating system. This service may not be supported
+ after the UEFI Event EFI_EVENT_GROUP_READY_TO_BOOT is signaled.
+
+ If the enable or disable AP operation cannot be completed prior to the return
+ from this service, then EFI_UNSUPPORTED must be returned.
+
+ @param[in] This - A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
+ @param[in] ProcessorNumber - The handle number of processor.
+ @param[in] EnableAP - Indicates whether the newstate of the AP is enabled or disabled.
+ @param[in] HealthFlag - Indicates new health state of the AP..
+
+ @retval EFI_SUCCESS - AP successfully enabled or disabled.
+ @retval EFI_DEVICE_ERROR - Caller processor is AP.
+ @retval EFI_NOT_FOUND - Processor with the handle specified by ProcessorNumber does not exist.
+ @retval EFI_INVALID_PARAMETERS - ProcessorNumber specifies the BSP.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_PI_MP_SERVICES_ENABLEDISABLEAP)(
+ IN EFI_PI_MP_SERVICES_PROTOCOL *This,
+ IN UINTN ProcessorNumber,
+ IN BOOLEAN EnableAP,
+ IN UINT32 *HealthFlag OPTIONAL
+ );
+
+/**
+ This return the handle number for the calling processor. This service may be
+ called from the BSP and APs.
+
+ This service returns the processor handle number for the calling processor.
+ The returned value is in the range from 0 to the total number of logical
+ processors minus 1. The total number of logical processors can be retrieved
+ with EFI_PI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors(). This service may be
+ called from the BSP and APs. If ProcessorNumber is NULL, then EFI_INVALID_PARAMETER
+ is returned. Otherwise, the current processors handle number is returned in
+ ProcessorNumber, and EFI_SUCCESS is returned.
+
+ @param[in] This - A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
+ @param[in] ProcessorNumber - Pointer to the handle number of AP.
+
+ @retval EFI_SUCCESS - Processor number successfully returned.
+ @retval EFI_INVALID_PARAMETER - ProcessorNumber is NULL
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_PI_MP_SERVICES_WHOAMI)(
+ IN EFI_PI_MP_SERVICES_PROTOCOL *This,
+ OUT UINTN *ProcessorNumber
+ );
+
+///
+/// When installed, the MP Services Protocol produces a collection of services
+/// that are needed for MP management.
+///
+/// Before the UEFI event EFI_EVENT_GROUP_READY_TO_BOOT is signaled, the module
+/// that produces this protocol is required to place all APs into an idle state
+/// whenever the APs are disabled or the APs are not executing code as requested
+/// through the StartupAllAPs() or StartupThisAP() services. The idle state of
+/// an AP before the UEFI event EFI_EVENT_GROUP_READY_TO_BOOT is signaled is
+/// implementation dependent.
+///
+/// After the UEFI event EFI_EVENT_GROUP_READY_TO_BOOT is signaled, all the APs
+/// must be placed in the OS compatible CPU state as defined by the UEFI
+/// Specification. Implementations of this protocol may use the UEFI event
+/// EFI_EVENT_GROUP_READY_TO_BOOT to force APs into the OS compatible state as
+/// defined by the UEFI Specification. Modules that use this protocol must
+/// guarantee that all non-blocking mode requests on all APs have been completed
+/// before the UEFI event EFI_EVENT_GROUP_READY_TO_BOOT is signaled. Since the
+/// order that event notification functions in the same event group are executed
+/// is not deterministic, an event of type EFI_EVENT_GROUP_READY_TO_BOOT cannot
+/// be used to guarantee that APs have completed their non-blocking mode requests.
+///
+/// When the UEFI event EFI_EVENT_GROUP_READY_TO_BOOT is signaled, the StartAllAPs()
+/// and StartupThisAp() services must no longer support non-blocking mode requests.
+/// The support for SwitchBSP() and EnableDisableAP() may no longer be supported
+/// after this event is signaled. Since UEFI Applications and UEFI OS Loaders
+/// execute after the UEFI event EFI_EVENT_GROUP_READY_TO_BOOT is signaled, these
+/// UEFI images must be aware that the functionality of this protocol may be reduced.
+///
+struct _EFI_PI_MP_SERVICES_PROTOCOL {
+ ///
+ /// This service retrieves the number of logical processor in the platform and the number of those logical
+ /// processors that are enabled on this boot. This service may only be called from the BSP.
+ ///
+ EFI_PI_MP_SERVICES_GET_NUMBER_OF_PROCESSORS GetNumberOfProcessors;
+ ///
+ /// This service retrieves detailed MP-related information about any processor on the platform.
+ ///
+ EFI_PI_MP_SERVICES_GET_PROCESSOR_INFO GetProcessorInfo;
+ ///
+ /// This service executes a caller provided function on all enabled APs.
+ ///
+ EFI_PI_MP_SERVICES_STARTUP_ALL_APS StartupAllAPs;
+ ///
+ /// This service lets the caller get one enabled AP to execute a caller-provided function.
+ ///
+ EFI_PI_MP_SERVICES_STARTUP_THIS_AP StartupThisAP;
+ ///
+ /// This service switches the requested AP to be the BSP from that point onward.
+ ///
+ EFI_PI_MP_SERVICES_SWITCH_BSP SwitchBSP;
+ ///
+ /// This service lets the caller enable or disable an AP from this point onward. This service may only be
+ /// called from the BSP.
+ ///
+ EFI_PI_MP_SERVICES_ENABLEDISABLEAP EnableDisableAP;
+ ///
+ /// This return the handle number for the calling processor. This service may be called from the BSP and APs.
+ ///
+ EFI_PI_MP_SERVICES_WHOAMI WhoAmI;
+};
+
+extern EFI_GUID gEfiPiMpServiceProtocolGuid;
+
+#endif
diff --git a/ReferenceCode/Haswell/Protocol/PowerMgmtInitDone/PowerMgmtInitDone.c b/ReferenceCode/Haswell/Protocol/PowerMgmtInitDone/PowerMgmtInitDone.c
new file mode 100644
index 0000000..6849c6e
--- /dev/null
+++ b/ReferenceCode/Haswell/Protocol/PowerMgmtInitDone/PowerMgmtInitDone.c
@@ -0,0 +1,42 @@
+/** @file
+ This file defines the Ppm Info Protocol.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+///
+/// Statements that include other files
+///
+///
+/// External include files do NOT need to be explicitly specified in real EDKII
+/// environment
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#endif
+
+#include "PowerMgmtInitDone.h"
+
+///
+/// Protocol GUID definition
+///
+EFI_GUID gEfiPowerMgmtInitDoneProtocolGuid = EFI_POWER_MGMT_INIT_DONE_PROTOCOL_GUID;
+
+///
+/// Protocol description
+///
+EFI_GUID_STRING
+ (&gEfiPowerMgmtInitDoneProtocolGuid, "PowerMgmtInitDone Protocol", "Power Managment Initialization done Protocol");
diff --git a/ReferenceCode/Haswell/Protocol/PowerMgmtInitDone/PowerMgmtInitDone.h b/ReferenceCode/Haswell/Protocol/PowerMgmtInitDone/PowerMgmtInitDone.h
new file mode 100644
index 0000000..5de11d1
--- /dev/null
+++ b/ReferenceCode/Haswell/Protocol/PowerMgmtInitDone/PowerMgmtInitDone.h
@@ -0,0 +1,52 @@
+/** @file
+ This file defines the PowerMgmtInitDone Protocol.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _POWER_MGMT_INIT_DONE_H_
+#define _POWER_MGMT_INIT_DONE_H_
+
+///
+/// Define PPM INFO protocol GUID
+///
+/// EDK and EDKII have different GUID formats
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#define EFI_POWER_MGMT_INIT_DONE_PROTOCOL_GUID \
+ { \
+ 0xd71db106, 0xe32d, 0x4225, 0xbf, 0xf4, 0xde, 0x6d, 0x77, 0x87, 0x17, 0x61 \
+ }
+
+#else
+#define EFI_POWER_MGMT_INIT_DONE_PROTOCOL_GUID \
+ { \
+ 0xd71db106, 0xe32d, 0x4225, \
+ { \
+ 0xbf, 0xf4, 0xde, 0x6d, 0x77, 0x87, 0x17, 0x61 \
+ } \
+ }
+#endif
+///
+/// Extern the GUID for protocol users.
+///
+extern EFI_GUID gEfiPowerMgmtInitDoneProtocolGuid;
+
+//
+// Forward reference for ANSI C compatibility
+//
+typedef struct _EFI_POWER_MGMT_INIT_DONE_PROTOCOL EFI_POWER_MGMT_INIT_DONE_PROTOCOL;
+
+#endif
diff --git a/ReferenceCode/Haswell/Protocol/PpmGlobalNvsArea/PpmGlobalNvsArea.c b/ReferenceCode/Haswell/Protocol/PpmGlobalNvsArea/PpmGlobalNvsArea.c
new file mode 100644
index 0000000..0c803c9
--- /dev/null
+++ b/ReferenceCode/Haswell/Protocol/PpmGlobalNvsArea/PpmGlobalNvsArea.c
@@ -0,0 +1,31 @@
+/** @file
+ Processor Power Management Global NVS Area description protocol implementation.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Mobile Silicon Support Module" and is
+ licensed for Intel Mobile CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "EdkIIGlueDxe.h"
+
+#include "PpmGlobalNvsArea.h"
+
+EFI_GUID gPpmGlobalNvsAreaProtocolGuid = EFI_PPM_GLOBAL_NVS_AREA_PROTOCOL_GUID;
+
+EFI_GUID_STRING
+(
+ &gPpmGlobalNvsAreaProtocolGuid, "PPM Global NVS Area Protocol",
+ "Protocol describing PPM ACPI NVS memory region used by ACPI subsystem."
+);
diff --git a/ReferenceCode/Haswell/Protocol/PpmGlobalNvsArea/PpmGlobalNvsArea.h b/ReferenceCode/Haswell/Protocol/PpmGlobalNvsArea/PpmGlobalNvsArea.h
new file mode 100644
index 0000000..ebae019
--- /dev/null
+++ b/ReferenceCode/Haswell/Protocol/PpmGlobalNvsArea/PpmGlobalNvsArea.h
@@ -0,0 +1,129 @@
+/** @file
+ Definition of the CPU PM global NVS area protocol. This protocol
+ publishes the address and format of a global ACPI NVS buffer used as a communications
+ buffer between SMM/DXE/PEI code and ASL code.
+ @todo The format is derived from the ACPI reference code, version 0.95.
+
+ Note: Data structures defined in this protocol are not naturally aligned.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _PPM_GLOBAL_NVS_AREA_H_
+#define _PPM_GLOBAL_NVS_AREA_H_
+
+///
+/// Forward reference for pure ANSI compatability
+///
+EFI_FORWARD_DECLARATION (PPM_GLOBAL_NVS_AREA_PROTOCOL);
+
+///
+/// Processor PM Global NVS Area Protocol GUID - {6C50CDCB-7F46-4dcc-8DDD-D9F0A3C61128}
+///
+#define EFI_PPM_GLOBAL_NVS_AREA_PROTOCOL_GUID \
+ { \
+ 0x6c50cdcb, 0x7f46, 0x4dcc, 0x8d, 0xdd, 0xd9, 0xf0, 0xa3, 0xc6, 0x11, 0x28 \
+ }
+
+///
+/// Extern the GUID for protocol users.
+///
+extern EFI_GUID gPpmGlobalNvsAreaProtocolGuid;
+
+//
+// Processor Power Management GlobalNvs Revisions
+//
+#define PPM_GLOBAL_NVS_AREA_REVISION_1 1 ///< Initial Version
+
+#pragma pack(1)
+
+typedef struct {
+ UINT16 CtdpPowerLimit1; ///< CTDP Power Limit1
+ UINT16 CtdpPowerLimit2; ///< CTDP Power Limit2
+ UINT8 CtdpPowerLimitWindow; ///< CTDP Power Limit Time Window
+ UINT8 CtdpCtc; ///< CTDP CTC
+ UINT8 CtdpTar; ///< CTDP TAR
+ UINT8 CtdpPpc; ///< CTDP PPC
+} PPM_CTDP_LEVEL_SETTINGS;
+
+///
+/// Global NVS Area definition
+///
+typedef struct {
+ UINT8 Revision; ///< (0) PPM GlobalNvs Revision
+ UINT32 PpmFlags; ///< (1-4) PPM Flags
+ UINT8 Reserved; ///< (5) Reserved
+ //
+ // Thermal Configuration Values
+ //
+ UINT8 AutoCriticalTripPoint; ///< (6) Auto Critical Trip Point
+ UINT8 AutoPassiveTripPoint; ///< (7) Auto Passive Trip Point
+ UINT8 AutoActiveTripPoint; ///< (8) Auto Active Trip Point
+ UINT32 Cpuid; ///< (9) CPUID
+ //
+ // ConfigTDP Values
+ //
+ UINT8 ConfigurablePpc; ///< (13) Boot Mode vlues for _PPC
+ //
+ // ConfigTDP Level settngs
+ //
+ UINT8 CustomConfigTdp; ///< (14) ConfigTdp Enabled/Disabled
+ UINT8 CtdpLevelsSupported; ///< (15) ConfigTdp Number Of Levels
+ UINT8 ConfigTdpBootModeIndex; ///< (16) CTDP Boot Mode Index
+ ///
+ /// (17) CTDP Level 0 Power Limit1
+ /// (19) CTDP Level 0 Power Limit2
+ /// (21) CTDP Level 0 Power Limit1 Time Window
+ /// (22) CTDP Level 0 CTC
+ /// (23) CTDP Level 0 TAR
+ /// (24) CTDP Level 0 PPC
+ /// (25) CTDP Level 1 Power Limit1
+ /// (27) CTDP Level 1 Power Limit2
+ /// (29) CTDP Level 1 Power Limit1 Time Window
+ /// (30) CTDP Level 1 CTC
+ /// (31) CTDP Level 1 TAR
+ /// (32) CTDP Level 1 PPC
+ /// (33) CTDP Level 2 Power Limit1
+ /// (35) CTDP Level 2 Power Limit2
+ /// (37) CTDP Level 2 Power Limit1 Time Window
+ /// (38) CTDP Level 2 CTC
+ /// (39) CTDP Level 2 TAR
+ /// (40) CTDP Level 2 PPC
+ ///
+ PPM_CTDP_LEVEL_SETTINGS CtdpLevelSettings[3];
+ //
+ // Mwait Hints and Latency values for C3/C6/C7/C7S
+ //
+ UINT8 C3MwaitValue; ///< (41) Mwait Hint value for C3
+ UINT8 C6MwaitValue; ///< (42) Mwait Hint value for C6
+ UINT8 C7MwaitValue; ///< (43) Mwait Hint value for C6
+ UINT8 CDMwaitValue; ///< (44) Mwait Hint value for C7/C8/C9/C10
+ UINT16 C3Latency; ///< (45-46) Latency value for C3
+ UINT16 C6Latency; ///< (47-48) Latency Value for C6
+ UINT16 C7Latency; ///< (49-50) Latency Value for C6
+ UINT16 CDLatency; ///< (51-52) Latency Value for C7/C8/C9/C10
+ UINT16 CDIOLevel; ///< (53-54) IO Level Value for C7/C8/C9/C10
+ UINT16 CDPowerValue; ///< (55-56) Power Value for C7/C8/C9/C10
+ UINT8 MiscPowerManagementFlags; ///< (57) MiscPowerManagementFlags
+} PPM_GLOBAL_NVS_AREA;
+#pragma pack()
+///
+/// PPM Global NVS Area Protocol
+///
+struct _PPM_GLOBAL_NVS_AREA_PROTOCOL {
+ PPM_GLOBAL_NVS_AREA *Area;
+};
+
+#endif
diff --git a/ReferenceCode/Haswell/Protocol/SmmThunk/SmmThunk.c b/ReferenceCode/Haswell/Protocol/SmmThunk/SmmThunk.c
new file mode 100644
index 0000000..fd03cf8
--- /dev/null
+++ b/ReferenceCode/Haswell/Protocol/SmmThunk/SmmThunk.c
@@ -0,0 +1,25 @@
+/** @file
+ This file defines SMM thunk abstraction protocol
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "Tiano.h"
+#include EFI_PROTOCOL_DEFINITION (SmmThunk)
+
+EFI_GUID gEfiSmmThunkProtocolGuid = EFI_SMM_THUNK_PROTOCOL_GUID;
+
+EFI_GUID_STRING(&gEfiSmmThunkProtocolGuid, "SMM Thunk Protocol", "SMM Thunk protocol");
diff --git a/ReferenceCode/Haswell/Protocol/SmmThunk/SmmThunk.h b/ReferenceCode/Haswell/Protocol/SmmThunk/SmmThunk.h
new file mode 100644
index 0000000..0c85718
--- /dev/null
+++ b/ReferenceCode/Haswell/Protocol/SmmThunk/SmmThunk.h
@@ -0,0 +1,64 @@
+/** @file
+ This file defines SMM Thunk abstraction protocol.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _SMM_THUNK_H_
+#define _SMM_THUNK_H_
+
+EFI_FORWARD_DECLARATION (EFI_SMM_THUNK_PROTOCOL);
+
+///
+/// include LegacyBios Protocol for IA32_REGISTER_SET
+///
+#include EFI_PROTOCOL_DEFINITION (LegacyBios)
+
+#define EFI_SMM_THUNK_PROTOCOL_GUID \
+ { \
+ 0x2a82fce6, 0x8bb6, 0x413e, 0xb9, 0xeb, 0x45, 0xdf, 0xc0, 0x52, 0x2d, 0xf3 \
+ }
+
+typedef
+BOOLEAN
+(EFIAPI *EFI_SMM_FARCALL86)(
+ IN EFI_SMM_THUNK_PROTOCOL *This,
+ IN UINT16 Segment,
+ IN UINT16 Offset,
+ IN OUT EFI_IA32_REGISTER_SET *Regs OPTIONAL,
+ IN VOID *Stack OPTIONAL,
+ IN UINTN StackSize
+ );
+
+typedef
+BOOLEAN
+(EFIAPI *EFI_SMM_INTCALL86)(
+ IN EFI_SMM_THUNK_PROTOCOL *This,
+ IN UINT16 Segment,
+ IN UINT16 Offset,
+ IN OUT EFI_IA32_REGISTER_SET *Regs OPTIONAL,
+ IN VOID *Stack OPTIONAL,
+ IN UINTN StackSize
+ );
+
+struct _EFI_SMM_THUNK_PROTOCOL {
+ EFI_SMM_FARCALL86 FarCall86;
+ EFI_SMM_INTCALL86 IntCall86;
+};
+
+extern EFI_GUID gEfiSmmThunkProtocolGuid;
+
+#endif
diff --git a/ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Dxe/CpuPolicyDxe.cif b/ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Dxe/CpuPolicyDxe.cif
new file mode 100644
index 0000000..123e37c
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Dxe/CpuPolicyDxe.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "Cpu Policy DXE"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Haswell\SampleCode\CpuPolicyInit\Dxe"
+ RefName = "Cpu Policy Dxe"
+[files]
+"CpuPolicyDxe.mak"
+"CpuPolicyDxe.sdl"
+"CpuPolicyInitDxe.c"
+"CpuPolicyInitDxe.h"
+"CpuPolicyInitDxe.dxs"
+"CpuPolicyInitDxe.inf"
+<endComponent>
diff --git a/ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Dxe/CpuPolicyDxe.mak b/ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Dxe/CpuPolicyDxe.mak
new file mode 100644
index 0000000..da3c6dc
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Dxe/CpuPolicyDxe.mak
@@ -0,0 +1,92 @@
+# MAK file for the eModule:PowerManagement
+
+EDK : CpuPolicyInitDxe
+
+BUILD_CpuPolicyInitDxe_DIR = $(BUILD_DIR)\$(CpuPolicyInitDxe_DIR)
+
+$(BUILD_DIR)\CpuPolicyDxe.mak : $(CpuPolicyInitDxe_DIR)\CpuPolicyDxe.cif $(BUILD_RULES)
+ $(CIF2MAK) $(CpuPolicyInitDxe_DIR)\CpuPolicyDxe.cif $(CIF2MAK_DEFAULTS)
+
+CpuPolicyInitDxe : $(BUILD_DIR)\CpuPolicyDxe.MAK CpuPolicyInitDxeBin
+
+CpuInitDxe_OBJECTS = \
+ $(BUILD_CpuPolicyInitDxe_DIR)\CpuPolicyInitDxe.obj \
+
+CpuInitDxe_MY_INCLUDES= \
+ $(EDK_INCLUDES)\
+ $(PROJECT_CPU_INCLUDES)\
+ /I$(PROJECT_CPU_ROOT)\
+ /I$(UefiEfiIfrSupportLib_DIR)\
+ /I$(PROJECT_CPU_ROOT)\Include \
+
+CpuInitDxe_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=CpuPolicyInitDxeEntryPoint"\
+ /D TXT_SUPPORT_FLAG=1 \
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_BASE_LIB__ \
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_UEFI_DEVICE_PATH_LIB__ \
+ /D FV_MICROCODE_BASE=$(FV_MICROCODE_BASE) \
+ /D __EDKII_GLUE_HII_LIB__ \
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+!ifdef PACK_MICROCODE
+ /D PACK_MICROCODE=$(PACK_MICROCODE) \
+!else
+ /D PACK_MICROCODE=0 \
+!endif
+ /D SMM_FROM_SMBASE_DRIVER=$(SMM_FROM_SMBASE_DRIVER) \
+ /D MICROCODE_BLOCK_SIZE=$(MICROCODE_BLOCK_SIZE) \
+
+CpuInitDxe_LIBS =\
+ $(PchPlatformLib)\
+ $(EfiRuntimeLib_LIB)\
+ $(INTEL_PCH_PROTOCOL_LIB)\
+ $(EFIRUNTIMELIB)\
+ $(CPUIA32LIB)\
+ $(EFIPROTOCOLLIB)\
+ $(EdkIIGlueUefiLib_LIB)\
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueDxeHobLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(CpuGuidLib_LIB)\
+!IF $(EFI_SPECIFICATION_VERSION) >= 0x0002000A
+ $(UEFIEFIIFRSUPPORTLIB)\
+!ELSE
+ $(EFIIFRSUPPORTLIB) \
+!ENDIF
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueDxeMemoryAllocationLib_LIB)\
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueUefiDevicePathLib_LIB)\
+ $(CpuProtocolLib_LIB)\
+ $(EFIDRIVERLIB)\
+ $(CpuPlatformLib_LIB)\
+ $(PchPlatformDxeLib_LIB)\
+ $(EFISCRIPTLIB)
+
+CpuPolicyInitDxeBin : $(CpuInitDxe_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\CpuPolicyDxe.mak all\
+ NAME=CpuPolicyDxe\
+ MAKEFILE=$(BUILD_DIR)\CpuPolicyDxe.mak \
+ "MY_INCLUDES=$(CpuInitDxe_MY_INCLUDES)" \
+ "MY_DEFINES=$(CpuInitDxe_DEFINES)"\
+ OBJECTS="$(CpuInitDxe_OBJECTS)" \
+ GUID=15B9B6DA-00A9-4de7-B8E8-ED7AFB88F16E\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=BS_DRIVER \
+ EDKIIModule=DXEDRIVER\
+ DEPEX1=$(CpuPolicyInitDxe_DIR)\CpuPolicyInitDxe.dxs \
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \
+ COMPRESS=1
+#-----------------------------------------------------------------------
diff --git a/ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Dxe/CpuPolicyDxe.sdl b/ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Dxe/CpuPolicyDxe.sdl
new file mode 100644
index 0000000..be33503
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Dxe/CpuPolicyDxe.sdl
@@ -0,0 +1,58 @@
+#****************************************************************************
+#****************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30071 **
+#** **
+#** Phone (770)-246-8600 **
+#** **
+#****************************************************************************
+#****************************************************************************
+#****************************************************************************
+# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/Haswell/Intel Haswell Cpu RC PKG/Cpu Policy DXE/CpuPolicyDxe.sdl 1 2/07/12 3:56a Davidhsieh $
+#
+# $Revision: 1 $
+#
+# $Date: 2/07/12 3:56a $
+#
+#****************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/Haswell/Intel Haswell Cpu RC PKG/Cpu Policy DXE/CpuPolicyDxe.sdl $
+#
+# 1 2/07/12 3:56a Davidhsieh
+#
+# 1 5/06/11 6:06a Davidhsieh
+# First release
+#
+#
+#****************************************************************************
+TOKEN
+ Name = "CpuDxePolicy_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable Cpu Pei init support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "CpuPolicyInitDxe_DIR"
+End
+
+MODULE
+ Help = "Includes CpuPeiInit.mak to Project"
+ File = "CpuPolicyDxe.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\CpuPolicyDxe.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+
diff --git a/ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Dxe/CpuPolicyInitDxe.c b/ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Dxe/CpuPolicyInitDxe.c
new file mode 100644
index 0000000..f78b89e
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Dxe/CpuPolicyInitDxe.c
@@ -0,0 +1,461 @@
+/** @file
+ This file is SampleCode for Intel CPU DXE Platform Policy initialzation.
+
+@copyright
+ Copyright (c) 2009 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+
+#if (EFI_SPECIFICATION_VERSION >= 0x2000A)
+#include EFI_PROTOCOL_DEFINITION (HiiDatabase)
+#else
+#include EFI_PROTOCOL_DEFINITION (Hii)
+#endif
+#include EFI_PROTOCOL_DEFINITION (CpuInfo)
+#include "CpuPolicyInitDxe.h"
+#if (EFI_SPECIFICATION_VERSION >= 0x2000A)
+#include "UefiIfrLibrary.h"
+#endif
+
+//-#include "FlashMap.h"
+#include "CpuPlatformLib.h"
+
+#define SMM_FROM_SMBASE_DRIVER 0x55
+#define SW_SMI_FROM_SMMBASE SMM_FROM_SMBASE_DRIVER
+
+#define PLATFORM_CPU_MAX_FSB_FREQUENCY 1066
+#endif
+
+//(AMI_CHG+)>
+VOID CallDxeCpuPolicyInitList(
+ IN EFI_SYSTEM_TABLE *SystemTable,
+ IN OUT DXE_CPU_PLATFORM_POLICY_PROTOCOL *mCpuPolicyDataPtr);
+//<(AMI_CHG+)
+EFI_EXP_BASE10_DATA mCoreFrequencyList[] = {
+ { 0, 0}, ///< 0 Means "Auto", also, the first is the default.
+ {-1, 0} ///< End marker
+};
+
+EFI_EXP_BASE10_DATA mFsbFrequencyList[] = {
+ { 0, 0}, ///< 0 Means "Auto", also, the first is the default.
+ {-1, 0} ///< End marker
+};
+
+DXE_CPU_PLATFORM_POLICY_PROTOCOL mCpuPolicyData = { 0 };
+CPU_CONFIG mCpuConfig = { 0 };
+POWER_MGMT_CONFIG mCpuPmConfig = { 0 };
+SECURITY_CONFIG mSecurityConfig = { 0 };
+#if defined(TXT_SUPPORT_FLAG) && (TXT_SUPPORT_FLAG == 1)
+TXT_FUNCTION_CONFIG mTxtFunctionConfig = { 0 };
+#endif
+
+///
+/// Function implementations
+///
+/**
+ Platform function to get MAX CPU count
+
+ @param[in] This - platform policy protocol
+ @param[in] MaxThreadsPerCore - variable that will store MaxThreadsPerCore
+ @param[in] MaxCoresPerDie - variable that will store MaxCoresPerDie
+ @param[in] MaxDiesPerPackage - variable that will store MaxDiesPerPackage
+ @param[in] MaxPackages - variable that will store MaxPackages
+
+ @retval EFI_SUCCESS - Always return success
+**/
+EFI_STATUS
+EFIAPI
+PlatformCpuGetMaxCount (
+ IN DXE_CPU_PLATFORM_POLICY_PROTOCOL *This,
+ OUT UINT32 *MaxThreadsPerCore,
+ OUT UINT32 *MaxCoresPerDie,
+ OUT UINT32 *MaxDiesPerPackage,
+ OUT UINT32 *MaxPackages
+ )
+{
+ *MaxThreadsPerCore = 2;
+ *MaxCoresPerDie = 4;
+ *MaxDiesPerPackage = 1;
+ *MaxPackages = 1;
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Get CPU information
+
+ @param[in] This - platform policy protocol
+ @param[in] Location - structure that describe CPU location information
+ @param[in] PlatformCpuInfo - structure that will be updated for platform CPU information
+
+ @retval EFI_INVALID_PARAMETER - PlatformCpuInfo is NULL
+ @retval EFI_SUCCESS - platform CPU info structure has been updated
+**/
+EFI_STATUS
+EFIAPI
+PlatformCpuGetCpuInfo (
+ IN DXE_CPU_PLATFORM_POLICY_PROTOCOL *This,
+ IN CPU_PHYSICAL_LOCATION *Location,
+ IN OUT PLATFORM_CPU_INFORMATION *PlatformCpuInfo
+ )
+{
+#if (EFI_SPECIFICATION_VERSION < 0x2000A)
+ EFI_HII_PROTOCOL *Hii;
+#endif
+ STRING_REF SocketNameToken;
+ STRING_REF FillByOemToken;
+ EFI_STATUS Status;
+ UINT64 MsrValue;
+ UINT8 CpuSku;
+
+ SocketNameToken = 0;
+ FillByOemToken = 0;
+
+ ///
+ /// For Processor SocketName definition.
+ ///
+ if (PlatformCpuInfo == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+#if (EFI_SPECIFICATION_VERSION >= 0x2000A)
+ Status = IfrLibNewString (PlatformCpuInfo->StringHandle, &SocketNameToken, L"U3E1");
+ ASSERT_EFI_ERROR (Status);
+
+ Status = IfrLibNewString (PlatformCpuInfo->StringHandle, &FillByOemToken, L"To Be Filled By O.E.M.");
+ ASSERT_EFI_ERROR (Status);
+#else
+ Status = gBS->LocateProtocol (
+ &gEfiHiiProtocolGuid,
+ NULL,
+ (VOID **) &Hii
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Hii->NewString (
+ Hii,
+ NULL,
+ PlatformCpuInfo->StringHandle,
+ &SocketNameToken,
+ L"U3E1"
+ );
+
+ Hii->NewString (
+ Hii,
+ NULL,
+ PlatformCpuInfo->StringHandle,
+ &FillByOemToken,
+ L"To Be Filled By O.E.M."
+ );
+#endif
+
+ PlatformCpuInfo->ApicID = Location->Thread;
+ PlatformCpuInfo->ReferenceString = 0;
+ CpuSku = GetCpuSku ();
+ switch (CpuSku) {
+ case EnumCpuTrad:
+ PlatformCpuInfo->SocketType = 0x2d; // @todo EfiProcessorSocketLGA1150, pending updated SMBIOS spec release
+ break;
+
+ case EnumCpuUlt:
+ PlatformCpuInfo->SocketType = 0x2e; // @todo EfiProcessorSocketBGA1168, pending updated SMBIOS spec release
+ break;
+
+ default:
+ PlatformCpuInfo->SocketType = EfiProcessorSocketOther;
+ break;
+ }
+ PlatformCpuInfo->SocketName = SocketNameToken;
+
+ MsrValue = AsmReadMsr64 (MSR_PLATFORM_INFO);
+ PlatformCpuInfo->MaxCoreFrequency.Value = (100 * (((UINT32) MsrValue >> N_PLATFORM_INFO_MAX_RATIO) & B_PLATFORM_INFO_RATIO_MASK));
+ PlatformCpuInfo->MaxCoreFrequency.Exponent = 6;
+
+ PlatformCpuInfo->MaxFsbFrequency.Value = PLATFORM_CPU_MAX_FSB_FREQUENCY;
+ PlatformCpuInfo->MaxFsbFrequency.Exponent = 6;
+
+ PlatformCpuInfo->PlatformCoreFrequencyList = mCoreFrequencyList;
+ PlatformCpuInfo->PlatformFsbFrequencyList = mFsbFrequencyList;
+
+ PlatformCpuInfo->AssetTag = FillByOemToken;
+ PlatformCpuInfo->SerialNumber = FillByOemToken;
+ PlatformCpuInfo->PartNumber = FillByOemToken;
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Get the microcode patch.
+
+ @param[in] This - Driver context.
+ @param[in] MicrocodeData - Retrieved image of the microcode.
+
+ @retval EFI_SUCCESS - Image found.
+ @retval EFI_NOT_FOUND - image not found.
+**/
+EFI_STATUS
+PlatformCpuRetrieveMicrocode (
+ IN DXE_CPU_PLATFORM_POLICY_PROTOCOL *This,
+ OUT UINT8 **MicrocodeData
+ )
+{
+ /*EFI_CPU_MICROCODE_HEADER *Microcode;
+ UINTN MicrocodeStart;
+ UINTN MicrocodeEnd;
+ UINTN TotalSize;
+
+ ///
+ /// Microcode binary in SEC
+ ///
+ MicrocodeStart = FLASH_REGION_MICROCODE_BASE +
+ ((EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) FLASH_REGION_MICROCODE_BASE)->HeaderLength +
+ sizeof (EFI_FFS_FILE_HEADER);
+
+ MicrocodeEnd = FLASH_REGION_MICROCODE_BASE + FLASH_REGION_MICROCODE_SIZE;
+
+ if (*MicrocodeData == NULL) {
+ *MicrocodeData = (UINT8 *) (UINTN) MicrocodeStart;
+ } else {
+ if (*MicrocodeData < (UINT8 *) (UINTN) MicrocodeStart) {
+ return EFI_NOT_FOUND;
+ }
+
+ TotalSize = (UINTN) (((EFI_CPU_MICROCODE_HEADER *) *MicrocodeData)->TotalSize);
+ if (TotalSize == 0) {
+ TotalSize = 2048;
+ }
+ //
+ // Add alignment check - begin
+ //
+ if ((TotalSize & 0x7FF) != 0) {
+ TotalSize = (TotalSize & 0xFFFFF800) + 0x800;
+ }
+ //
+ // Add alignment check - end
+ //
+
+ *MicrocodeData += TotalSize;
+
+ Microcode = (EFI_CPU_MICROCODE_HEADER *) *MicrocodeData;
+ if (*MicrocodeData >= (UINT8 *) (UINTN) (MicrocodeEnd) || Microcode->TotalSize == (UINT32) -1) {
+ return EFI_NOT_FOUND;
+ }
+
+ }
+
+
+ return EFI_SUCCESS;*/
+ return EFI_NOT_FOUND;
+}
+
+/**
+ Initilize Intel Cpu DXE Platform Policy
+
+ @param[in] ImageHandle Image handle of this driver.
+ @param[in] SystemTable Global system service table.
+
+ @retval EFI_SUCCESS Initialization complete.
+ @exception EFI_UNSUPPORTED The chipset is unsupported by this driver.
+ @retval EFI_OUT_OF_RESOURCES Do not have enough resources to initialize the driver.
+ @retval EFI_DEVICE_ERROR Device error, driver exits abnormally.
+**/
+EFI_STATUS
+EFIAPI
+CpuPolicyInitDxeEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ CPU_FAMILY CpuFamilyId;
+
+ CpuFamilyId = GetCpuFamily();
+
+ mCpuPolicyData.Revision = DXE_PLATFORM_CPU_POLICY_PROTOCOL_REVISION_7;
+ mCpuPolicyData.CpuConfig = &mCpuConfig;
+ mCpuPolicyData.PowerMgmtConfig = &mCpuPmConfig;
+ mCpuPolicyData.SecurityConfig = &mSecurityConfig;
+
+ mCpuConfig.RetrieveMicrocode = PlatformCpuRetrieveMicrocode;
+ mCpuConfig.GetMaxCount = PlatformCpuGetMaxCount;
+ mCpuConfig.GetCpuInfo = PlatformCpuGetCpuInfo;
+ mSecurityConfig.TxtFunctionConfig = NULL;
+#ifdef TXT_SUPPORT_FLAG
+ mSecurityConfig.TxtFunctionConfig = &mTxtFunctionConfig;
+#endif // TXT_SUPPORT_FLAG
+ mCpuConfig.SmmbaseSwSmiNumber = SW_SMI_FROM_SMMBASE;
+
+ mCpuConfig.HtState = CPU_FEATURE_ENABLE;
+ mCpuConfig.LimitCpuidMaximumValue = CPU_FEATURE_DISABLE;
+ mCpuConfig.ExecuteDisableBit = CPU_FEATURE_ENABLE;
+ mCpuConfig.VmxEnable = CPU_FEATURE_ENABLE;
+ mCpuConfig.SmxEnable = CPU_FEATURE_ENABLE;
+ mCpuConfig.MachineCheckEnable = CPU_FEATURE_ENABLE;
+ mCpuConfig.MonitorMwaitEnable = CPU_FEATURE_ENABLE;
+ mCpuConfig.XapicEnable = CPU_FEATURE_DISABLE;
+ mCpuConfig.AesEnable = CPU_FEATURE_ENABLE;
+ mCpuConfig.DebugInterfaceEnable = CPU_FEATURE_DISABLE;
+ mCpuConfig.DebugInterfaceLockEnable = CPU_FEATURE_ENABLE;
+ mCpuConfig.MlcStreamerPrefetcher = CPU_FEATURE_ENABLE;
+ mCpuConfig.MlcSpatialPrefetcher = CPU_FEATURE_ENABLE;
+ mCpuConfig.EnableDts = CPU_FEATURE_DISABLE;
+ mCpuConfig.BspSelection = 0;
+ mCpuConfig.ApIdleManner = 1;
+ mCpuConfig.ApHandoffManner = 1;
+ ///
+ /// Virtual wire to A
+ ///
+ mCpuConfig.FviReport = 1;
+ ///
+ /// Default Enable FVI SMBIOS Report
+ ///
+ mCpuConfig.FviSmbiosType = 0xDD;
+ ///
+ /// Default SMBIOS Type 221
+ ///
+ /// Initialize Power Management Config
+ /// Allocate and set Power Management policy structure to recommended defaults
+ ///
+ mCpuPmConfig.pFunctionEnables = AllocateZeroPool (sizeof (PPM_FUNCTION_ENABLES));
+ mCpuPmConfig.pCustomRatioTable = AllocateZeroPool (sizeof (PPM_CUSTOM_RATIO_TABLE));
+ mCpuPmConfig.pTurboSettings = AllocateZeroPool (sizeof (PPM_TURBO_SETTINGS));
+ mCpuPmConfig.pRatioLimit = AllocateZeroPool ((sizeof (UINT8) * 4));
+ mCpuPmConfig.pPpmLockEnables = AllocateZeroPool (sizeof (PPM_LOCK_ENABLES));
+ mCpuPmConfig.pCustomCtdpSettings = AllocateZeroPool (sizeof (PPM_CUSTOM_CTDP));
+ mCpuPmConfig.ThermalFuncEnables = AllocateZeroPool (sizeof (THERM_FUNCTION_ENABLES));
+
+ if ((mCpuPmConfig.pFunctionEnables == NULL) ||
+ (mCpuPmConfig.pCustomRatioTable == NULL) ||
+ (mCpuPmConfig.pTurboSettings == NULL) ||
+ (mCpuPmConfig.pPpmLockEnables == NULL) ||
+ (mCpuPmConfig.pCustomCtdpSettings == NULL) ||
+ (mCpuPmConfig.ThermalFuncEnables == NULL)
+ ) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ mCpuPmConfig.pFunctionEnables->Eist = PPM_ENABLE;
+ mCpuPmConfig.pFunctionEnables->Cx = PPM_ENABLE;
+ mCpuPmConfig.pFunctionEnables->C1e = PPM_ENABLE;
+ mCpuPmConfig.pFunctionEnables->C3 = PPM_ENABLE;
+ mCpuPmConfig.pFunctionEnables->C6 = PPM_ENABLE;
+ if (CpuFamilyId == EnumCpuHswUlt) {
+ mCpuPmConfig.pFunctionEnables->C8 = PPM_ENABLE;
+ mCpuPmConfig.pFunctionEnables->C9 = PPM_ENABLE;
+ mCpuPmConfig.pFunctionEnables->C10 = PPM_ENABLE;
+ }
+ mCpuPmConfig.pFunctionEnables->DeepCState = DeepC7S;
+ mCpuPmConfig.pFunctionEnables->C1AutoDemotion = PPM_ENABLE;
+ mCpuPmConfig.pFunctionEnables->C3AutoDemotion = PPM_ENABLE;
+ mCpuPmConfig.pFunctionEnables->C1UnDemotion = PPM_ENABLE;
+ mCpuPmConfig.pFunctionEnables->C3UnDemotion = PPM_ENABLE;
+ mCpuPmConfig.pFunctionEnables->PkgCStateDemotion = PPM_DISABLE;
+ mCpuPmConfig.pFunctionEnables->PkgCStateUnDemotion = PPM_DISABLE;
+ mCpuPmConfig.ThermalFuncEnables->BiProcHot = PPM_ENABLE;
+ mCpuPmConfig.ThermalFuncEnables->DisableProcHotOut = PPM_DISABLE;
+ mCpuPmConfig.ThermalFuncEnables->DisableVRThermalAlert= PPM_DISABLE;
+ mCpuPmConfig.ThermalFuncEnables->ProcHotResponce = PPM_DISABLE;
+ mCpuPmConfig.ThermalFuncEnables->TStates = PPM_DISABLE;
+ mCpuPmConfig.pFunctionEnables->Xe = PPM_DISABLE;
+ mCpuPmConfig.pFunctionEnables->TurboMode = PPM_ENABLE;
+ mCpuPmConfig.pFunctionEnables->PowerLimit2 = PPM_ENABLE;
+ mCpuPmConfig.pFunctionEnables->EnergyEfficientPState = PPM_ENABLE;
+ mCpuPmConfig.pFunctionEnables->CStatePreWake = PPM_ENABLE;
+ mCpuPmConfig.ThermalFuncEnables->AutoThermalReporting = PPM_ENABLE;
+
+ mCpuPmConfig.pFunctionEnables->LongLatencyC6 = PPM_DISABLE;
+ mCpuPmConfig.pFunctionEnables->LongLatencyC7 = PPM_ENABLE;
+ mCpuPmConfig.ThermalFuncEnables->ThermalMonitor = PPM_ENABLE;
+ mCpuPmConfig.ThermalFuncEnables->Pl1ThermalControl = 2; ///< AUTO
+ mCpuPmConfig.ThermalFuncEnables->Pl1ThermalControlFloor.FloorIA = Percent100;
+ mCpuPmConfig.ThermalFuncEnables->Pl1ThermalControlFloor.FloorGT = Percent100;
+ mCpuPmConfig.ThermalFuncEnables->Pl1ThermalControlFloor.FloorPCH = Percent100;
+ mCpuPmConfig.pFunctionEnables->LakeTiny = PPM_DISABLE;
+ mCpuPmConfig.pFunctionEnables->TimedMwait = PPM_DISABLE;
+
+ mCpuPmConfig.CustomPowerUnit = PowerUnit125MilliWatts;
+ mCpuPmConfig.pTurboSettings->PowerLimit1 = AUTO;
+ mCpuPmConfig.pTurboSettings->PowerLimit2 = AUTO;
+ mCpuPmConfig.pTurboSettings->PowerLimit1Time = AUTO;
+ mCpuPmConfig.pTurboSettings->PowerLimit3 = AUTO;
+ mCpuPmConfig.pTurboSettings->PowerLimit3Time = AUTO;
+ mCpuPmConfig.pTurboSettings->PowerLimit3DutyCycle = AUTO;
+ mCpuPmConfig.pTurboSettings->PowerLimit3Lock = PPM_ENABLE;
+ mCpuPmConfig.pTurboSettings->ConfigTdpLevel = 0;
+ mCpuPmConfig.pTurboSettings->ConfigTdpLock = PPM_DISABLE;
+ mCpuPmConfig.pCustomCtdpSettings->ConfigTdpCustom = PPM_DISABLE;
+
+ mCpuPmConfig.pTurboSettings->TurboPowerLimitLock = PPM_DISABLE;
+ mCpuPmConfig.pTurboSettings->EnergyPolicy = 0;
+
+ mCpuPmConfig.pPpmLockEnables->PmgCstCfgCtrlLock = PPM_ENABLE;
+ mCpuPmConfig.pPpmLockEnables->OverclockingLock = PPM_DISABLE;
+ mCpuPmConfig.pPpmLockEnables->ProcHotLock = PPM_DISABLE;
+ mCpuPmConfig.S3RestoreMsrSwSmiNumber = SW_SMI_S3_RESTORE_MSR;
+ mCpuPmConfig.PkgCStateLimit = PkgAuto;
+
+ mCpuPmConfig.CstateLatencyControl0TimeUnit = TimeUnit1024ns;
+ mCpuPmConfig.CstateLatencyControl1TimeUnit = TimeUnit1024ns;
+ mCpuPmConfig.CstateLatencyControl2TimeUnit = TimeUnit1024ns;
+ mCpuPmConfig.CstateLatencyControl0Irtl = C3_LATENCY;
+ mCpuPmConfig.CstateLatencyControl1Irtl = C6_C7_SHORT_LATENCY;
+ mCpuPmConfig.CstateLatencyControl2Irtl = C6_C7_LONG_LATENCY;
+ if (CpuFamilyId == EnumCpuHswUlt) {
+ mCpuPmConfig.CstateLatencyControl3TimeUnit = TimeUnit1024ns;
+ mCpuPmConfig.CstateLatencyControl4TimeUnit = TimeUnit1024ns;
+ mCpuPmConfig.CstateLatencyControl5TimeUnit = TimeUnit1024ns;
+ mCpuPmConfig.CstateLatencyControl3Irtl = C8_LATENCY;
+ mCpuPmConfig.CstateLatencyControl4Irtl = C9_LATENCY;
+ //
+ // If PS4 is disabled, program 2750us to MSR_C_STATE_LATENCY_CONTROL_5
+ //
+ mCpuPmConfig.CstateLatencyControl5Irtl = C10_LATENCY;
+ }
+ mCpuPmConfig.RfiFreqTunningOffsetIsNegative = 0;
+ mCpuPmConfig.RfiFreqTunningOffset = 0;
+
+ if (CpuFamilyId == EnumCpuHswUlt) {
+ //
+ // Calibrate 24MHz BCLK support; 0: NO_CALIBRATE, 1: PCODE_CALIBRATE, 2: BIOS_CALIBRATE (Default :1)
+ //
+ mCpuPmConfig.PcodeCalibration = 1;
+ mCpuPmConfig.EnableRerunPcodeCalibration = PPM_DISABLE;
+ }
+ ///
+ /// TxT platform config initiate
+ ///
+#if defined(TXT_SUPPORT_FLAG) && (TXT_SUPPORT_FLAG == 1)
+ mTxtFunctionConfig.ResetAux = 0;
+#endif
+
+ //AMI_REMOVE_TEMP_FOR_COMPILE
+ //UpdateDxeCpuPlatformPolicy (&mCpuPolicyData); //(AMI_CHG)
+ CallDxeCpuPolicyInitList(SystemTable, &mCpuPolicyData); // (AMI_CHG+)
+ ///
+ /// Install the DXE_CPU_PLATFORM_POLICY_PROTOCOL interface
+ ///
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &ImageHandle,
+ &gDxeCpuPlatformPolicyProtocolGuid,
+ &mCpuPolicyData,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+ return Status;
+}
diff --git a/ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Dxe/CpuPolicyInitDxe.dxs b/ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Dxe/CpuPolicyInitDxe.dxs
new file mode 100644
index 0000000..7ff094a
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Dxe/CpuPolicyInitDxe.dxs
@@ -0,0 +1,42 @@
+/** @file
+ Dependency expression source file.
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "PeimDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+#endif
+
+#include EFI_ARCH_PROTOCOL_DEFINITION (Variable)
+
+
+DEPENDENCY_START
+ EFI_VARIABLE_ARCH_PROTOCOL_GUID
+DEPENDENCY_END \ No newline at end of file
diff --git a/ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Dxe/CpuPolicyInitDxe.h b/ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Dxe/CpuPolicyInitDxe.h
new file mode 100644
index 0000000..8524faf
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Dxe/CpuPolicyInitDxe.h
@@ -0,0 +1,50 @@
+/** @file
+ Header file for the CpuPolicyInitDxe Driver.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _CPU_PLATFORM_POLICY_DXE_H_
+#define _CPU_PLATFORM_POLICY_DXE_H_
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "CpuAccess.h"
+#endif
+
+#include "UefiIfrLibrary.h"
+#include "PowermgmtDefinitions.h"
+#include EFI_PROTOCOL_PRODUCER (CpuPlatformPolicy)
+//AMI_REMOVE_FOR_COMPILE
+//#include "CpuPlatformPolicyUpdateDxeLib.h"
+
+/**
+ Initilize Intel CPU DXE Policy
+
+ @param[in] ImageHandle Image handle of this driver.
+ @param[in] SystemTable Global system service table.
+
+ @retval EFI_SUCCESS Initialization complete.
+ @exception EFI_UNSUPPORTED The chipset is unsupported by this driver.
+ @retval EFI_OUT_OF_RESOURCES Do not have enough resources to initialize the driver.
+ @retval EFI_DEVICE_ERROR Device error, driver exits abnormally.
+**/
+EFI_STATUS
+CpuPolicyInitDxeEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN OUT EFI_SYSTEM_TABLE *SystemTable
+ );
+
+#endif
diff --git a/ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Dxe/CpuPolicyInitDxe.inf b/ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Dxe/CpuPolicyInitDxe.inf
new file mode 100644
index 0000000..b331411
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Dxe/CpuPolicyInitDxe.inf
@@ -0,0 +1,93 @@
+## @file
+# Component description file for the CpuPolicyInitDxe DXE driver.
+#
+#@copyright
+# Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = CpuPolicyInitDxe
+FILE_GUID = 15B9B6DA-00A9-4de7-B8E8-ED7AFB88F16E
+COMPONENT_TYPE = BS_DRIVER
+
+[sources.common]
+ CpuPolicyInitDxe.h
+ CpuPolicyInitDxe.c
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueDxeDriverEntryPoint.c
+
+[includes.common]
+ $(DEST_DIR)
+ $(BUILD_DIR)/$(PROCESSOR)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include/Pcd
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Cpu/Pentium/Include
+#
+# if (EFI_SPECIFICATION_VERSION < 0x0002000A), use EfiIfrSupportLib
+# if (EFI_SPECIFICATION_VERSION >= 0x0002000A), use UefiEfiIfrSupportLib
+#
+# $(EDK_SOURCE)/Foundation/Library/Dxe/EfiIfrSupportLib
+ $(EDK_SOURCE)/Foundation/Library/Dxe/UefiEfiIfrSupportLib
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Include
+ $(EFI_SOURCE)/Library/CpuPolicyInitLib/Dxe
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include/Library
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Samplecode/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Include
+
+[libraries.common]
+ EdkIIGlueDxeReportStatusCodeLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueDxeMemoryAllocationLib
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkFrameworkProtocolLib
+ EdkProtocolLib
+#
+# if (EFI_SPECIFICATION_VERSION < 0x0002000A), use EfiIfrSupportLib
+# if (EFI_SPECIFICATION_VERSION >= 0x0002000A), use UefiEfiIfrSupportLib, EfiDriverLib
+#
+# EfiIfrSupportLib
+ EfiDriverLib
+ UefiEfiIfrSupportLib
+ CpuProtocolLib
+ CpuIA32Lib
+ PlatformPolicyUpdateDxeLib
+ CpuPlatformLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = CpuPolicyInitDxe.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=CpuPolicyInitDxeEntryPoint
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__
diff --git a/ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Pei/CpuPolicyInitPei.c b/ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Pei/CpuPolicyInitPei.c
new file mode 100644
index 0000000..c0badcf
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Pei/CpuPolicyInitPei.c
@@ -0,0 +1,268 @@
+/** @file
+ This file is SampleCode for Intel CPU PEI Platform Policy initialization.
+
+@copyright
+ Copyright (c) 2010 - 2014 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+#include "CpuPolicyInitPei.h"
+
+//(AMI_CHG+)>
+VOID CallPeiCpuPolicyInitList(
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN OUT PEI_CPU_PLATFORM_POLICY_PPI *PeiCpuPolicyPpi);
+//<(AMI_CHG+)
+/**
+ This PEIM performs CPU PEI Platform Policy initialization.
+
+ @param[in] FfsHeader Pointer to Firmware File System file header.
+ @param[in] PeiServices General purpose services available to every PEIM.
+
+ @retval EFI_SUCCESS The PPI is installed and initialized.
+ @retval EFI ERRORS The PPI is not successfully installed.
+**/
+EFI_STATUS
+EFIAPI
+CpuPolicyInitPeiEntryPoint (
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_STATUS Status;
+ EFI_PEI_PPI_DESCRIPTOR *CpuPlatformPolicyPpiDesc;
+ PEI_CPU_PLATFORM_POLICY_PPI *CpuPlatformPolicyPpi;
+ CPU_CONFIG_PPI *CpuConfig;
+ SECURITY_CONFIG_PPI *SecurityConfig;
+ PFAT_CONFIG *PfatConfig;
+ POWER_MGMT_CONFIG_PPI *PowerMgmtConfig;
+ OVERCLOCKING_CONFIG_PPI *OcConfig;
+ BOOT_GUARD_CONFIG *BootGuardConfig;
+#if defined(TXT_SUPPORT_FLAG) && (TXT_SUPPORT_FLAG == 1)
+ TXT_CONFIG *TxtConfig;
+#endif
+ UINT8 PlatIdStr[] = "SHARK BAY";
+
+ ///
+ /// Allocate memory for the CPU Policy Ppi and Descriptor
+ ///
+ Status = ((*PeiServices)->AllocatePool)(PeiServices, sizeof (EFI_PEI_PPI_DESCRIPTOR), &CpuPlatformPolicyPpiDesc);
+ ASSERT_EFI_ERROR (Status);
+
+ Status = ((*PeiServices)->AllocatePool)(PeiServices, sizeof (PEI_CPU_PLATFORM_POLICY_PPI), &CpuPlatformPolicyPpi);
+ ASSERT_EFI_ERROR (Status);
+
+ Status = ((*PeiServices)->AllocatePool)(PeiServices, sizeof (CPU_CONFIG_PPI), &CpuConfig);
+ ASSERT_EFI_ERROR (Status);
+
+ Status = ((*PeiServices)->AllocatePool)(PeiServices, sizeof (SECURITY_CONFIG_PPI), &SecurityConfig);
+ ASSERT_EFI_ERROR (Status);
+
+ Status = ((*PeiServices)->AllocatePool)(PeiServices, sizeof (PFAT_CONFIG), &PfatConfig);
+ ASSERT_EFI_ERROR (Status);
+
+ Status = ((*PeiServices)->AllocatePool)(PeiServices, sizeof (POWER_MGMT_CONFIG_PPI), &PowerMgmtConfig);
+ ASSERT_EFI_ERROR (Status);
+
+ Status = ((*PeiServices)->AllocatePool)(PeiServices, sizeof (OVERCLOCKING_CONFIG_PPI), &OcConfig);
+ ASSERT_EFI_ERROR (Status);
+
+#if defined(TXT_SUPPORT_FLAG) && (TXT_SUPPORT_FLAG == 1)
+ Status = ((*PeiServices)->AllocatePool)(PeiServices, sizeof (TXT_CONFIG), &TxtConfig);
+ ASSERT_EFI_ERROR (Status);
+#endif
+
+ Status = ((*PeiServices)->AllocatePool) (PeiServices, sizeof (BOOT_GUARD_CONFIG), &BootGuardConfig);
+ ASSERT_EFI_ERROR (Status);
+
+ CpuPlatformPolicyPpi->Revision = PEI_CPU_PLATFORM_POLICY_PPI_REVISION_8;
+ CpuPlatformPolicyPpi->CpuConfig = CpuConfig;
+ CpuPlatformPolicyPpi->SecurityConfig = SecurityConfig;
+ CpuPlatformPolicyPpi->SecurityConfig->PfatConfig = PfatConfig;
+ CpuPlatformPolicyPpi->PowerMgmtConfig = PowerMgmtConfig;
+ CpuPlatformPolicyPpi->OverclockingConfig = OcConfig;
+ CpuPlatformPolicyPpi->CpuPlatformPpiPtr = (UINTN) CpuPlatformPolicyPpi;
+
+#if defined(TXT_SUPPORT_FLAG) && (TXT_SUPPORT_FLAG == 1)
+ CpuPlatformPolicyPpi->SecurityConfig->TxtConfig = TxtConfig;
+#else
+ CpuPlatformPolicyPpi->SecurityConfig->TxtConfig = NULL;
+#endif
+
+ CpuPlatformPolicyPpi->SecurityConfig->BootGuardConfig = BootGuardConfig;
+
+ CpuConfig->CpuRatioOverride = CPU_FEATURE_DISABLE;
+ CpuConfig->CpuRatio = 63;
+ CpuConfig->CpuMaxNonTurboRatio = 63;
+ CpuConfig->BistOnReset = CPU_FEATURE_DISABLE;
+ CpuConfig->HyperThreading = CPU_FEATURE_ENABLE;
+ CpuConfig->VmxEnable = CPU_FEATURE_ENABLE;
+ CpuConfig->ActiveCoreCount = 0;
+
+ ///
+ /// If CpuConfig->Pfat is set to ENABLE '1' then
+ /// PlatformData->SmmBwp (found in PchPolicyInitPei.c file) has to be set to ENABLE '1'
+ /// This is a PFAT Security requirement that needs to be addressed
+ /// If CpuConfig->Pfat is set to DISABLE '0' then
+ /// PlatformData->SmmBwp (found in PchPolicyInitPei.c file) value don't care, it can be
+ /// set to either ENABLE '1' or DISABLE '0' based on customer implementation
+ ///
+ CpuConfig->Pfat = CPU_FEATURE_DISABLE;
+ ZeroMem (&PfatConfig->Ppdt, sizeof (PPDT));
+ PfatConfig->Ppdt.PpdtMajVer = PPDT_MAJOR_VERSION;
+ PfatConfig->Ppdt.PpdtMinVer = PPDT_MINOR_VERSION;
+ CopyMem (&PfatConfig->Ppdt.PlatId[0], &PlatIdStr[0], sizeof (PlatIdStr));
+ PfatConfig->Ppdt.PfatModSvn = PFAT_SVN;
+ PfatConfig->Ppdt.BiosSvn = 0x01380000;
+ PfatConfig->Ppdt.ExecLim = 0;
+ PfatConfig->Ppdt.PlatAttr = 0;
+ PfatConfig->Ppdt.LastSfam = MIN_SFAM_COUNT - 1;
+ if (PfatConfig->Ppdt.LastSfam > (MAX_SFAM_COUNT - 1)) {
+ PfatConfig->Ppdt.LastSfam = MAX_SFAM_COUNT - 1;
+ }
+ ///
+ /// SfamData [LastSfam + 1]
+ ///
+ PfatConfig->Ppdt.SfamData[0].FirstByte = 0x00580000;
+ PfatConfig->Ppdt.SfamData[0].LastByte = 0x0058FFFF;
+ PfatConfig->Ppdt.PpdtSize = (sizeof (PPDT) - sizeof (PfatConfig->Ppdt.SfamData) + ((PfatConfig->Ppdt.LastSfam + 1) * sizeof (SFAM_DATA)));
+ PfatConfig->PpdtHash[0] = 0xae7295370672663c;
+ PfatConfig->PpdtHash[1] = 0x220375c996d23a36;
+ PfatConfig->PpdtHash[2] = 0x73aaea0f2afded9d;
+ PfatConfig->PpdtHash[3] = 0x707193b768a0829e;
+ ZeroMem (&PfatConfig->PupHeader, sizeof (PUP_HEADER));
+ PfatConfig->PupHeader.Version = PUP_HDR_VERSION;
+ CopyMem (&PfatConfig->PupHeader.PlatId[0], &PlatIdStr[0], sizeof (PlatIdStr));
+ PfatConfig->PupHeader.PkgAttributes = 0;
+ PfatConfig->PupHeader.PslMajorVer = PSL_MAJOR_VERSION;
+ PfatConfig->PupHeader.PslMinorVer = PSL_MINOR_VERSION;
+ PfatConfig->PupHeader.BiosSvn = PfatConfig->Ppdt.BiosSvn;
+ PfatConfig->PupHeader.EcSvn = 0;
+ PfatConfig->PupHeader.VendorSpecific = 0x808655AA;
+ ZeroMem (&PfatConfig->PfatLog, sizeof (PFAT_LOG));
+ PfatConfig->PfatLog.Version = PFAT_LOG_VERSION;
+ PfatConfig->PfatLog.LastPage = 0;
+ if (PfatConfig->PfatLog.LastPage > (MAX_PFAT_LOG_PAGE - 1)) {
+ PfatConfig->PfatLog.LastPage = MAX_PFAT_LOG_PAGE - 1;
+ }
+ PfatConfig->PfatLog.LoggingOptions = 0;
+ PfatConfig->NumSpiComponents = 2;
+ PfatConfig->ComponentSize[0] = EnumSpiCompSize8MB;
+ PfatConfig->ComponentSize[1] = EnumSpiCompSize8MB;
+ PfatConfig->PfatMemSize = 0x05;
+
+ CpuConfig->MlcStreamerPrefetcher = CPU_FEATURE_ENABLE;
+ CpuConfig->MlcSpatialPrefetcher = CPU_FEATURE_ENABLE;
+
+ PowerMgmtConfig->RatioLimit[0] = 0;
+ PowerMgmtConfig->RatioLimit[1] = 0;
+ PowerMgmtConfig->RatioLimit[2] = 0;
+ PowerMgmtConfig->RatioLimit[3] = 0;
+ PowerMgmtConfig->TccActivationOffset = 0;
+ PowerMgmtConfig->VrCurrentLimit = VR_CURRENT_DEFAULT;
+ PowerMgmtConfig->VrCurrentLimitLock = CPU_FEATURE_DISABLE;
+ PowerMgmtConfig->Xe = CPU_FEATURE_DISABLE;
+ PowerMgmtConfig->BootInLfm = CPU_FEATURE_DISABLE;
+ ///
+ /// VrMiscIoutSlope = 0x200 default
+ /// VrMiscIoutOffsetSign = 0 means it's positive offset. 1= negative offset
+ /// VrMiscIoutOffset = 0 means it's 0%, 625 means 6.25% (range is +6.25% ~ -6.25%)
+ ///
+ PowerMgmtConfig->VrMiscIoutSlope = 0x200;
+ PowerMgmtConfig->VrMiscIoutOffsetSign = 0;
+ PowerMgmtConfig->VrMiscIoutOffset = 0;
+
+ PowerMgmtConfig->VrMiscMinVid = V_MSR_VR_MISC_CONFIG_MIN_VID_DEFAULT;
+ PowerMgmtConfig->VrMiscIdleExitRampRate = CPU_FEATURE_ENABLE;
+ PowerMgmtConfig->VrMiscIdleEntryRampRate = CPU_FEATURE_DISABLE;
+ PowerMgmtConfig->VrMiscIdleEntryDecayEnable = CPU_FEATURE_ENABLE;
+ if (GetCpuFamily() == EnumCpuHswUlt) {
+ PowerMgmtConfig->VrMiscSlowSlewRateConfig = V_MSR_VR_MISC_CONFIG_SLOW_SLEW_RATE_CONFIG_DEFAULT;
+ PowerMgmtConfig->VrMisc2FastRampVoltage = V_MSR_VR_MISC_CONFIG2_FAST_RAMP_VOLTAGE_DEFAULT;
+ PowerMgmtConfig->VrMisc2MinC8Voltage = V_MSR_VR_MISC_CONFIG2_MIN_C8_VOLTAGE_DEFAULT;
+ PowerMgmtConfig->VrPSI4enable = CPU_FEATURE_ENABLE;
+ }
+ PowerMgmtConfig->Psi1Threshold = PSI1_THRESHOLD_DEFAULT;
+ PowerMgmtConfig->Psi2Threshold = PSI2_THRESHOLD_DEFAULT;
+ PowerMgmtConfig->Psi3Threshold = PSI3_THRESHOLD_DEFAULT;
+
+ PowerMgmtConfig->FivrSscEnable = 1;
+ PowerMgmtConfig->FivrSscPercent = 62;
+
+ ///
+ /// Initiate TxT policy
+ ///
+#if defined(TXT_SUPPORT_FLAG) && (TXT_SUPPORT_FLAG == 1)
+ ZeroMem (TxtConfig, sizeof (TXT_CONFIG));
+ CpuConfig->Txt = 0;
+ TxtConfig->SinitMemorySize = TXT_SINIT_MEMORY_SIZE;
+ TxtConfig->TxtHeapMemorySize = TXT_HEAP_MEMORY_SIZE;
+ TxtConfig->TxtDprMemoryBase = 0;
+ TxtConfig->TxtDprMemorySize = 0;
+ TxtConfig->BiosAcmBase = 0;
+ TxtConfig->BiosAcmSize = 0;
+ TxtConfig->McuUpdateDataAddr = 0;
+ TxtConfig->TgaSize = TXT_TGA_MEMORY_SIZE;
+ TxtConfig->TxtLcpPdBase = TXT_LCP_PD_BASE;
+ TxtConfig->TxtLcpPdSize = TXT_LCP_PD_SIZE;
+#endif
+ ///
+ /// Initialize Overclocking Data
+ ///
+ OcConfig->CoreVoltageOffset = 0;
+ OcConfig->CoreVoltageOverride = 0;
+ OcConfig->CoreExtraTurboVoltage = 0;
+ OcConfig->CoreMaxOcTurboRatio = 0;
+ OcConfig->ClrVoltageOffset = 0;
+ OcConfig->ClrVoltageOverride = 0;
+ OcConfig->ClrExtraTurboVoltage = 0;
+ OcConfig->ClrMaxOcTurboRatio = 0;
+ OcConfig->SvidVoltageOverride = 0;
+ OcConfig->SvidEnable = 0;
+ OcConfig->FivrFaultsEnable = 0;
+ OcConfig->FivrEfficiencyEnable = 0;
+ OcConfig->CoreVoltageMode = 0;
+ OcConfig->ClrVoltageMode = 0;
+ OcConfig->OcSupport = 0;
+ OcConfig->BitReserved = 0;
+
+ //
+ // Initialize Boot Guard data
+ //
+ BootGuardConfig->TpmType = TpmTypeMax;
+ BootGuardConfig->BypassTpmInit = FALSE;
+ BootGuardConfig->MeasuredBoot = FALSE;
+ BootGuardConfig->BootGuardSupport = FALSE;
+ BootGuardConfig->DisconnectAllTpms = FALSE;
+ BootGuardConfig->ByPassTpmEventLog = FALSE;
+
+ //AMI_CHG
+ //UpdatePeiCpuPlatformPolicy (PeiServices, CpuPlatformPolicyPpi); //(AMI_CHG)
+ CallPeiCpuPolicyInitList(PeiServices, CpuPlatformPolicyPpi); // (AMI_CHG+)
+
+ ///
+ /// Update the CPU Policy Ppi Descriptor
+ ///
+ CpuPlatformPolicyPpiDesc->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;
+ CpuPlatformPolicyPpiDesc->Guid = &gPeiCpuPlatformPolicyPpiGuid;
+ CpuPlatformPolicyPpiDesc->Ppi = CpuPlatformPolicyPpi;
+
+ ///
+ /// Install the CPU PEI Platform Policy PPI
+ ///
+ Status = (**PeiServices).InstallPpi (PeiServices, CpuPlatformPolicyPpiDesc);
+ ASSERT_EFI_ERROR (Status);
+
+ return Status;
+}
diff --git a/ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Pei/CpuPolicyInitPei.dxs b/ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Pei/CpuPolicyInitPei.dxs
new file mode 100644
index 0000000..1e93c04
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Pei/CpuPolicyInitPei.dxs
@@ -0,0 +1,41 @@
+/** @file
+ Dependency expression source file.
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "PeimDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+#endif
+
+#include EFI_PPI_DEPENDENCY (Variable)
+
+DEPENDENCY_START
+ PEI_READ_ONLY_VARIABLE_ACCESS_PPI_GUID
+DEPENDENCY_END
diff --git a/ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Pei/CpuPolicyInitPei.h b/ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Pei/CpuPolicyInitPei.h
new file mode 100644
index 0000000..47a9f2b
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Pei/CpuPolicyInitPei.h
@@ -0,0 +1,55 @@
+/** @file
+ Header file for the CpuPeiPolicy PEIM.
+
+@copyright
+ Copyright (c) 2009 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _CPU_POLICY_INIT_PEI_H_
+#define _CPU_POLICY_INIT_PEI_H_
+
+///
+/// External include files do NOT need to be explicitly specified in real EDKII
+/// environment
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#include "PfatDefinitions.h"
+#include EFI_PPI_PRODUCER (CpuPlatformPolicy)
+#include "CpuInitPeim.h"
+#include "CpuRegs.h"
+#include "CpuPlatformLib.h"
+#include "PowerMgmtDefinitions.h"
+#endif
+//#include "CpuPlatformPolicyUpdatePeiLib.h" //(AMI_CHG)
+
+///
+/// Functions
+///
+/**
+ This PEIM performs CPU PEI Platform Policy initialzation.
+
+ @param[in] FfsHeader Pointer to Firmware File System file header.
+ @param[in] PeiServices General purpose services available to every PEIM.
+
+ @retval EFI_SUCCESS The PPI is installed and initialized.
+ @retval EFI ERRORS The PPI is not successfully installed.
+**/
+EFI_STATUS
+EFIAPI
+CpuPolicyInitPeiEntryPoint (
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+ );
+#endif
diff --git a/ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Pei/CpuPolicyInitPei.inf b/ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Pei/CpuPolicyInitPei.inf
new file mode 100644
index 0000000..1a07029
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Pei/CpuPolicyInitPei.inf
@@ -0,0 +1,87 @@
+## @file
+# Component description file for the CpuPolicyInitPei PEIM.
+#
+#@copyright
+# Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = CpuPolicyInitPei
+FILE_GUID = 567F05DE-D174-48e4-A7C0-C19868A11F9B
+COMPONENT_TYPE = PE32_PEIM
+
+[sources.common]
+ CpuPolicyInitPei.h
+ CpuPolicyInitPei.c
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGluePeimEntryPoint.c
+
+[includes.common]
+ .
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include/Library
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/CpuInit/Pei
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Pei/Include
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(PLATFORM_ECP_PACKAGE)/Include
+ $(PLATFORM_ECP_PACKAGE)/Library/OpensslLib
+ $(PLATFORM_ECP_PACKAGE)/Library/PeiCryptLib
+
+[libraries.common]
+ $(PROJECT_PCH_FAMILY)PpiLib
+ EdkFrameworkPpiLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueBaseMemoryLib
+ EdkIIGluePeiDebugLibReportStatusCode
+ EdkIIGluePeiReportStatusCodeLib
+ EdkIIGluePeiServicesLib
+ EdkIIGluePeiMemoryAllocationLib
+ EdkPpiLib
+ CpuPpiLib
+ PlatformPolicyUpdatePeiLib
+ OpensslLib
+ PeiCryptLib
+ CpuPlatformLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = CpuPolicyInitPei.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=CpuPolicyInitPeiEntryPoint
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_PEI_SERVICES_LIB__ \
+ -D __EDKII_GLUE_PEI_MEMORY_ALLOCATION_LIB__
diff --git a/ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Pei/CpuPolicyPei.cif b/ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Pei/CpuPolicyPei.cif
new file mode 100644
index 0000000..c241162
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Pei/CpuPolicyPei.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "Cpu Policy PEI"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Haswell\SampleCode\CpuPolicyInit\Pei"
+ RefName = "Cpu Policy Pei"
+[files]
+"CpuPolicyPei.sdl"
+"CpuPolicyPei.mak"
+"CpuPolicyInitPei.c"
+"CpuPolicyInitPei.h"
+"CpuPolicyInitPei.dxs"
+"CpuPolicyInitPei.inf"
+<endComponent>
diff --git a/ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Pei/CpuPolicyPei.mak b/ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Pei/CpuPolicyPei.mak
new file mode 100644
index 0000000..3576f9e
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Pei/CpuPolicyPei.mak
@@ -0,0 +1,139 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2010, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#**********************************************************************
+# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/Haswell/Intel Haswell Cpu RC PKG/Cpu Policy PEI/CpuPolicyPei.mak 5 7/02/12 7:23a Davidhsieh $
+#
+# $Revision: 5 $
+#
+# $Date: 7/02/12 7:23a $
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/Haswell/Intel Haswell Cpu RC PKG/Cpu Policy PEI/CpuPolicyPei.mak $
+#
+# 5 7/02/12 7:23a Davidhsieh
+#
+# 4 5/22/12 4:36a Davidhsieh
+# Add TXT_SUPPORT_FLAG define
+#
+# 3 5/14/12 2:20a Davidhsieh
+#
+# 2 2/23/12 2:46a Davidhsieh
+#
+# 1 2/07/12 3:56a Davidhsieh
+#
+# 2 9/21/11 11:22p Davidhsieh
+#
+# 1 5/06/11 6:06a Davidhsieh
+# First release
+#
+#**********************************************************************
+#<AMI_FHDR_START>
+#
+# Name:
+#
+# Description:
+#
+#<AMI_FHDR_END>
+#**********************************************************************
+EDK : CpuPolicyPei
+
+BUILD_CpuInitPei_DIR = $(BUILD_DIR)\$(CpuPolicyPei_DIR)
+
+$(BUILD_DIR)\CpuPolicyPei.mak : $(CpuPolicyPei_DIR)\CpuPolicyPei.cif $(BUILD_RULES)
+ $(CIF2MAK) $(CpuPolicyPei_DIR)\CpuPolicyPei.cif $(CIF2MAK_DEFAULTS)
+
+CpuPolicyPei : $(BUILD_DIR)\CpuPolicyPei.mak CpuPolicyPeiBin
+
+CpuPolicyPei_OBJECTS = \
+ $(BUILD_CpuInitPei_DIR)\CpuPolicyInitPei.obj
+
+CpuPolicyPei_MY_INCLUDES= \
+ $(EDK_INCLUDES) \
+ /I$(PROJECT_CPU_ROOT)\
+ /I$(PROJECT_CPU_ROOT)\Include \
+ /I$(PROJECT_CPU_ROOT)\Include\Library \
+ /I$(PROJECT_CPU_ROOT)\\Library \
+ /I$(CpuInitPei_DIR)
+
+CpuPolicyPei_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=CpuPolicyInitPeiEntryPoint"\
+ /D TXT_SUPPORT_FLAG=1 \
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_BASE_LIB__ \
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_MM7__ \
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+
+
+CpuPolicyPei_LIBS =\
+ $(PchPlatformLib)\
+ $(EfiRuntimeLib_LIB)\
+ $(INTEL_PCH_PROTOCOL_LIB)\
+ $(EFIRUNTIMELIB)\
+ $(EDKFRAMEWORKPPILIB) \
+ $(CPUIA32LIB)\
+ $(EFIPROTOCOLLIB)\
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGluePeiDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+ $(IntelPchPpiLib_LIB)\
+ $(EdkIIGlueBaseLibIA32_LIB)\
+ $(EdkIIGluePeiHobLib_LIB) \
+ $(CpuGuidLib_LIB) \
+ $(EdkIIGluePeiServicesLib_LIB) \
+ $(EdkIIGluePeiReportStatusCodeLib_LIB) \
+ $(PEIHOBLIB) \
+ $(EdkIIGlueDxeMemoryAllocationLib_LIB)\
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueUefiDevicePathLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB) \
+ $(EdkIIGlueBasePciExpressLib_LIB)\
+ $(CPU_PPI_LIB)\
+ $(PchPlatformPeiLib_LIB)\
+ $(CpuPlatformLib_LIB)\
+ $(EFISCRIPTLIB)
+
+CpuPolicyPeiBin : $(CpuPolicyPei_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\CpuPolicyPei.mak all\
+ NAME=CpuPolicyPei\
+ MAKEFILE=$(BUILD_DIR)\CpuPolicyPei.mak \
+ "MY_INCLUDES=$(CpuPolicyPei_MY_INCLUDES)" \
+ "MY_DEFINES=$(CpuPolicyPei_DEFINES)"\
+ OBJECTS="$(CpuPolicyPei_OBJECTS)" \
+ GUID=0ac2d35d-1c77-1033-a6f8-7ca55df7d0aa\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=PEIM \
+ EDKIIModule=PEIM\
+ DEPEX1=$(CpuPolicyPei_DIR)\CpuPolicyInitPei.dxs \
+ DEPEX1_TYPE=EFI_SECTION_PEI_DEPEX \
+ COMPRESS=0
+
+#---------------------------------------------------------------------------
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2010, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Pei/CpuPolicyPei.sdl b/ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Pei/CpuPolicyPei.sdl
new file mode 100644
index 0000000..947bdb1
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/CpuPolicyInit/Pei/CpuPolicyPei.sdl
@@ -0,0 +1,58 @@
+#****************************************************************************
+#****************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30071 **
+#** **
+#** Phone (770)-246-8600 **
+#** **
+#****************************************************************************
+#****************************************************************************
+#****************************************************************************
+# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/Haswell/Intel Haswell Cpu RC PKG/Cpu Policy PEI/CpuPolicyPei.sdl 1 2/07/12 3:56a Davidhsieh $
+#
+# $Revision: 1 $
+#
+# $Date: 2/07/12 3:56a $
+#
+#****************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/Haswell/Intel Haswell Cpu RC PKG/Cpu Policy PEI/CpuPolicyPei.sdl $
+#
+# 1 2/07/12 3:56a Davidhsieh
+#
+# 1 5/06/11 6:06a Davidhsieh
+# First release
+#
+#
+#****************************************************************************
+TOKEN
+ Name = "CpuPeiPolicySupport"
+ Value = "1"
+ Help = "Main switch to enable Cpu Policy Pei support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "CpuPolicyPei_DIR"
+End
+
+MODULE
+ Help = "Includes CpuPeiPolicy.mak to Project"
+ File = "CpuPolicyPei.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\CpuPolicyPei.ffs"
+ Parent = "FV_BB"
+ InvokeOrder = AfterParent
+End
+
diff --git a/ReferenceCode/Haswell/SampleCode/CpuSampleCode.cif b/ReferenceCode/Haswell/SampleCode/CpuSampleCode.cif
new file mode 100644
index 0000000..886b397
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/CpuSampleCode.cif
@@ -0,0 +1,15 @@
+<component>
+ name = "CpuSampleCode"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Haswell\SampleCode\"
+ RefName = "CpuSampleCode"
+[files]
+"Include\AslUpdateLib.h"
+"Include\PeiKscLib.h"
+"Include\SmmIoLib.h"
+"Include\KscLib.h"
+"Include\acpibuild.dsc"
+"Include\Cpu.h"
+"Include\FlashMap.h"
+"Include\BootGuardRevocationLib.h"
+<endComponent>
diff --git a/ReferenceCode/Haswell/SampleCode/Include/AslUpdateLib.h b/ReferenceCode/Haswell/SampleCode/Include/AslUpdateLib.h
new file mode 100644
index 0000000..eb9d1cf
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Include/AslUpdateLib.h
@@ -0,0 +1,178 @@
+/** @file
+ ASL dynamic update library definitions.
+
+ This library provides dymanic update to various ASL structures.
+
+ There may be different libraries for different environments (PEI, BS, RT, SMM).
+ Make sure you meet the requirements for the library (protocol dependencies, use
+ restrictions, etc).
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _ASL_UPDATE_LIB_H_
+#define _ASL_UPDATE_LIB_H_
+
+///
+/// Include files
+///
+#include "Tiano.h"
+#include "Acpi.h"
+#include "Acpi3_0.h"
+
+#include EFI_PROTOCOL_DEPENDENCY (AcpiSupport)
+#include EFI_PROTOCOL_DEPENDENCY (AcpiTable)
+
+///
+/// AML parsing definitions
+///
+#define AML_NAME_OP 0x08
+#define AML_BYTE_OP 0x0A
+#define AML_WORD_OP 0x0B
+#define AML_DWORD_OP 0x0C
+#define AML_QWORD_OP 0x0E
+#define AML_SCOPE_OP 0x10
+#define AML_BUFFER_OP 0x11
+#define AML_PACKAGE_OP 0x12
+#define AML_METHOD_OP 0x14
+#define AML_EXT_OP 0x5B
+#define AML_OPREGION_OP 0x80
+#define AML_DEVICE_OP 0x82
+#define AML_PROCESSOR_OP 0x83
+
+///
+/// Magic number definition for values to be updated
+///
+#define UINT16_BIT_MAGIC_NUMBER 0xFFFF
+#define UINT32_BIT_MAGIC_NUMBER 0xFFFFFFFF
+
+///
+/// ASL PSS package structure layout
+///
+#pragma pack(1)
+typedef struct {
+ UINT8 NameOp; ///< 12h ;First opcode is a NameOp.
+ UINT8 PackageLead; ///< 20h ;First opcode is a NameOp.
+ UINT8 NumEntries; ///< 06h ;First opcode is a NameOp.
+ UINT8 DwordPrefix1; ///< 0Ch
+ UINT32 CoreFrequency; ///< 00h
+ UINT8 DwordPrefix2; ///< 0Ch
+ UINT32 Power; ///< 00h
+ UINT8 DwordPrefix3; ///< 0Ch
+ UINT32 TransLatency; ///< 00h
+ UINT8 DwordPrefix4; ///< 0Ch
+ UINT32 BMLatency; ///< 00h
+ UINT8 DwordPrefix5; ///< 0Ch
+ UINT32 Control; ///< 00h
+ UINT8 DwordPrefix6; ///< 0Ch
+ UINT32 Status; ///< 00h
+} PSS_PACKAGE_LAYOUT;
+#pragma pack()
+
+/**
+ Initialize the ASL update library state.
+ This must be called prior to invoking other library functions.
+
+ @retval EFI_SUCCESS - The function completed successfully.
+**/
+EFI_STATUS
+InitializeAslUpdateLib (
+ VOID
+ );
+
+/**
+ This function locates an ACPI structure and updates it.
+ This function knows how to update operation regions and BUFA/BUFB resource structures.
+
+ This function may not be implemented in all instantiations of this library.
+
+ @param[in] AslSignature - The signature of Operation Region that we want to update.
+ @param[in] BaseAddress - Base address of IO trap.
+ @param[in] Length - Length of IO address.
+
+ @retval EFI_SUCCESS - The function completed successfully.
+**/
+EFI_STATUS
+UpdateAslCode (
+ IN UINT32 AslSignature,
+ IN UINT16 BaseAddress,
+ IN UINT8 Length
+ );
+
+/**
+ This function uses the ACPI support protocol to locate an ACPI table using the .
+ It is really only useful for finding tables that only have a single instance,
+ e.g. FADT, FACS, MADT, etc. It is not good for locating SSDT, etc.
+ Matches are determined by finding the table with ACPI table that has
+ a matching signature and version.
+
+ @param[in] TableId - Pointer to an ASCII string containing the Signature to match
+ @param[in] Table - Updated with a pointer to the table
+ @param[in] Handle - AcpiSupport protocol table handle for the table found
+ @param[in] Version - On input, the version of the table desired,
+ on output, the versions the table belongs to
+ (see AcpiSupport protocol for details)
+
+ @retval EFI_SUCCESS - The function completed successfully.
+**/
+EFI_STATUS
+LocateAcpiTableBySignature (
+ IN UINT32 Signature,
+ IN OUT EFI_ACPI_DESCRIPTION_HEADER **Table,
+ IN OUT UINTN *Handle,
+ IN OUT EFI_ACPI_TABLE_VERSION *Version
+ );
+
+/**
+ This function uses the ACPI support protocol to locate an ACPI SSDT table.
+ The table is located by searching for a matching OEM Table ID field.
+ Partial match searches are supported via the TableIdSize parameter.
+
+ @param[in] TableId - Pointer to an ASCII string containing the OEM Table ID from the ACPI table header
+ @param[in] TableIdSize - Length of the TableId to match. Table ID are 8 bytes long, this function
+ will consider it a match if the first TableIdSize bytes match
+ @param[in] Table - Updated with a pointer to the table
+ @param[in] Handle - AcpiSupport protocol table handle for the table found
+ @param[in] Version - See AcpiSupport protocol, GetAcpiTable function for use
+
+ @retval EFI_SUCCESS - The function completed successfully.
+**/
+EFI_STATUS
+LocateAcpiTableByOemTableId (
+ IN UINT8 *TableId,
+ IN UINT8 TableIdSize,
+ IN OUT EFI_ACPI_DESCRIPTION_HEADER **Table,
+ IN OUT UINTN *Handle,
+ IN OUT EFI_ACPI_TABLE_VERSION *Version
+ );
+
+/**
+ This function calculates and updates an UINT8 checksum.
+
+ @param[in] Buffer Pointer to buffer to checksum
+ @param[in] Size Number of bytes to checksum
+ @param[in] ChecksumOffset Offset to place the checksum result in
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFI_BOOTSERVICE
+AcpiChecksum (
+ IN VOID *Buffer,
+ IN UINTN Size,
+ IN UINTN ChecksumOffset
+ );
+
+#endif
diff --git a/ReferenceCode/Haswell/SampleCode/Include/BootGuardRevocationLib.h b/ReferenceCode/Haswell/SampleCode/Include/BootGuardRevocationLib.h
new file mode 100644
index 0000000..f7d0fbc
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Include/BootGuardRevocationLib.h
@@ -0,0 +1,35 @@
+/** @file
+ Header file for Boot Guard revocation notification.
+
+@copyright
+ Copyright (c) 2012 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _BOOT_GUARD_REVOCATION_LIB_H_
+#define _BOOT_GUARD_REVOCATION_LIB_H_
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#endif
+
+/**
+ Provide a hook for OEM to deal with Boot Guard revocation flow.
+**/
+VOID
+EFIAPI
+BootGuardOemRevocationHook (
+ VOID
+ );
+
+#endif
diff --git a/ReferenceCode/Haswell/SampleCode/Include/Cpu.h b/ReferenceCode/Haswell/SampleCode/Include/Cpu.h
new file mode 100644
index 0000000..94b7e56
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Include/Cpu.h
@@ -0,0 +1,63 @@
+/** @file
+ Various CPU-specific definitions.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _CPU_H_
+#define _CPU_H_
+
+#define B_FAMILY_MODEL_STEPPING 0x00000FFF
+
+#define EFI_MSR_IA32_PERF_STS 0x198
+#define EFI_MSR_IA32_PERF_CTL 0x199
+#define EFI_MSR_IA32_CLOCK_MODULATION 0x19A
+#define EFI_MSR_IA32_THERM_STATUS 0x19C
+
+#define B_BS_VID 0x0000003F
+#define N_BS_VID 0
+#define B_BS_RATIO 0x00001F00
+#define N_BS_RATIO 8
+
+///
+/// UINT64 workaround
+///
+/// The MS compiler doesn't handle QWORDs very well. I'm breaking
+/// them into DWORDs to circumvent the problems. Converting back
+/// shouldn't be a big deal.
+///
+#pragma pack(1)
+typedef union _MSR_REGISTER {
+ UINT64 Qword;
+
+ struct _DWORDS {
+ UINT32 Low;
+ UINT32 High;
+ } Dwords;
+
+ struct _BYTES {
+ UINT8 FirstByte;
+ UINT8 SecondByte;
+ UINT8 ThirdByte;
+ UINT8 FouthByte;
+ UINT8 FifthByte;
+ UINT8 SixthByte;
+ UINT8 SeventhByte;
+ UINT8 EighthByte;
+ } Bytes;
+
+} MSR_REGISTER;
+#pragma pack()
+#endif
diff --git a/ReferenceCode/Haswell/SampleCode/Include/FlashMap.h b/ReferenceCode/Haswell/SampleCode/Include/FlashMap.h
new file mode 100644
index 0000000..b72df34
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Include/FlashMap.h
@@ -0,0 +1,27 @@
+/** @file
+ File content auto-generated by FlashMap utility
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _FLASH_MAP_H_
+#define _FLASH_MAP_H_
+
+///
+/// Please confirm following configuration from your platform setting.
+///
+#define FLASH_REGION_MICROCODE_SIZE 0xffd90000
+#define FLASH_REGION_MICROCODE_BASE 0x00040000
+#endif ///< #ifndef _FLASH_MAP_H_
diff --git a/ReferenceCode/Haswell/SampleCode/Include/KscLib.h b/ReferenceCode/Haswell/SampleCode/Include/KscLib.h
new file mode 100644
index 0000000..a428f77
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Include/KscLib.h
@@ -0,0 +1,232 @@
+/** @file
+ KSC library functions and definitions.
+
+ This library provides basic KSC interface. It is deemed simple enough and uses in
+ so few cases that there is not currently benefit to implementing a protocol.
+ If more consumers are added, it may be benefitial to implement as a protocol.
+
+ There may be different libraries for different environments (PEI, BS, RT, SMM).
+ Make sure you meet the requirements for the library (protocol dependencies, use
+ restrictions, etc).
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _KSC_LIB_H_
+#define _KSC_LIB_H_
+
+///
+/// Include files
+///
+#include "Tiano.h"
+
+///
+/// Timeout if KSC command/data fails
+///
+#define KSC_TIME_OUT 0x20000
+
+///
+/// The Keyboard and System management Controller (KSC) implements a standard 8042 keyboard
+/// controller interface at ports 0x60/0x64 and a ACPI compliant system management controller
+/// at ports 0x62/0x66. Port 0x66 is the command and status port, port 0x62 is the data port.
+///
+#define KSC_D_PORT 0x62
+#define KSC_C_PORT 0x66
+
+///
+/// Status Port 0x62
+///
+#define KSC_S_OVR_TMP 0x80 ///< Current CPU temperature exceeds the threshold
+#define KSC_S_SMI_EVT 0x40 ///< SMI event is pending
+#define KSC_S_SCI_EVT 0x20 ///< SCI event is pending
+#define KSC_S_BURST 0x10 ///< KSC is in burst mode or normal mode
+#define KSC_S_CMD 0x08 ///< Byte in data register is command/data
+#define KSC_S_IGN 0x04 ///< Ignored
+#define KSC_S_IBF 0x02 ///< Input buffer is full/empty
+#define KSC_S_OBF 0x01 ///< Output buffer is full/empty
+///
+/// KSC commands that are issued to the KSC through the command port (0x66).
+/// New commands and command parameters should only be written by the host when IBF=0.
+/// Data read from the KSC data port is valid only when OBF=1.
+///
+#define KSC_C_SMI_NOTIFY_ENABLE 0x04 ///< Enable SMI notifications to the host
+#define KSC_C_SMI_NOTIFY_DISABLE 0x05 ///< SMI notifications are disabled and pending notifications cleared
+#define KSC_C_QUERY_SYS_STATUS 0x06 ///< Returns 1 byte of information about the system status
+#define KSC_B_SYS_STATUS_FAN 0x40 ///< Fan status (1 = ON)
+#define KSC_B_SYS_STATUS_DOCK 0x20 ///< Dock status (1 = Docked)
+#define KSC_B_SYS_STATUS_AC 0x10 ///< AC power (1 = AC powered)
+#define KSC_B_SYS_STATUS_THERMAL 0x0F ///< CPU thermal state (0 ~ 9)
+#define KSC_C_FAB_ID 0x0D ///< Get the board fab ID in the lower 3 bits
+#define KSC_C_SYSTEM_POWER_OFF 0x22 ///< Turn off the system power
+#define KSC_C_LAN_ON 0x46 ///< Turn on the power to LAN through EC/KSC
+#define KSC_C_LAN_OFF 0x47 ///< Turn off the power to LAN through EC/KSC
+#define KSC_C_GET_TEMP 0x50 ///< Returns the CPU temperature as read from the SMBus thermal sensor.
+#define KSC_C_SET_CTEMP 0x58 ///< The next byte written to the data port will be the shutdown temperature
+#define KSC_EC_PCH_SMBUS_EN 0x60 ///< EC PCH SMBus thermal monitoring Enable cmd
+#define KSC_EC_PCH_SMBUS_DIS 0x61 ///< EC PCH SMBus thermal monitoring Disable cmd
+#define KSC_TS_ON_DIMM_EN 0x6B ///< TS-on-DIMM thermal monitoring enable command
+#define KSC_TS_ON_DIMM_DIS 0x6C ///< TS-on-DIMM thermal monitoring disable command
+#define KSC_C_PCH_SMBUS_MSG_LENGTH 0x6D ///< PCH SMBus block read buffer length
+#define KSC_C_PCH_SMBUS_PEC_EN 0x6E ///< PCH SMBus Packet Error Checking (PEC) Enable command.
+#define KSC_C_PCH_SMBUS_PEC_DIS 0x76 ///< PCH SMBus Packet Error Checking (PEC) Disable command.
+#define KSC_C_EC_SMBUS_HIGH_SPEED 0x75 ///< EC SMBus high speed mode command
+#define KSC_EC_PCH_SMBUS_WRITE_EN 0x68 ///< EC PCH SMBus Write Enable cmd
+#define KSC_EC_PCH_SMBUS_WRITE_DIS 0x69 ///< EC PCH SMBus Write Disable cmd
+#define KSC_C_SMI_QUERY 0x70 ///< The host reads the data port to retrieve the notifications
+#define KSC_C_SMI_TIMER 0x71 ///< Commands the KSC to generate a periodic SMI to the host
+#define KSC_C_SMI_HOTKEY 0x72 ///< Get the scan code of hotkey pressed (CTRL + ALT + SHIFT + key)
+#define KSC_C_READ_MEM 0x80 ///< Read the KSC memory
+#define KSC_C_WRITE_MEM 0x81 ///< Write the KSC memory
+#define KSC_C_DOCK_STATUS 0x8A ///< Get the dock status
+#define KSC_B_DOCK_STATUS_ATTACH 0x01 ///< Dock status (1 = Attach)
+#define KSC_C_KSC_REVISION 0x90 ///< Get the revision for the KSC
+#define KSC_C_SMI_INJECT 0xBA ///< The next byte written to the data port will generate an immediate SMI
+#define KSC_C_SMI_DISABLE 0xBC ///< SMI generation by the KSC is disabled
+#define KSC_C_SMI_ENABLE 0xBD ///< SMI generation by the KSC is enabled
+#define KSC_C_ACPI_ENABLE 0xAA ///< Enable ACPI mode
+#define KSC_C_ACPI_DISABLE 0xAB ///< Disable ACPI mode
+///
+/// KSC commands that are only valid if the EC has ACPI mode enabled.
+/// Note that capacity and voltage are 16 bit values, thus you need to read them from
+/// ACPI space with two reads (little Endian).
+///
+#define KSC_VIRTUAL_BAT_STATUS 48 ///< Status of the virtual battery (present)
+#define KSC_VIRTUAL_BAT_PRESENT_MASK 0x10 ///< Bit 4 is the indicator
+#define KSC_REAL_BAT1_STATUS 50 ///< Status of the first real battery (present, charging)
+#define KSC_REAL_BAT1_REMAINING_CAPACITY 89 ///< Remaining capacity in mWh
+#define KSC_REAL_BAT1_RESOLUTION_VOLTAGE 93 ///< Full resolution voltage in mV
+#define KSC_REAL_BAT2_STATUS 54 ///< Status of the second real battery (present, charging)
+#define KSC_REAL_BAT2_REMAINING_CAPACITY 99 ///< Remaining capacity in mWh
+#define KSC_REAL_BAT2_RESOLUTION_VOLTAGE 103 ///< Full resolution voltage in mV
+#define KSC_REAL_BAT_PRESENT_MASK 0x8 ///< Bit 3 is the indicator
+#define KSC_REAL_BAT_CHARGING_MASK 0x1 ///< Bit 1 is the indicator
+///
+/// SMI notification code table, read through command KSC_C_SMI_QUERY
+///
+#define KSC_N_SMI_NULL 0x00 ///< Null marks the end of the SMI notification queue
+#define KSC_N_SMI_HOTKEY 0x20 ///< Hotkey pressed SMI
+#define KSC_N_SMI_ACINSERTION 0x30 ///< AC insertion SMI
+#define KSC_N_SMI_ACREMOVAL 0x31 ///< AC removal SMI
+#define KSC_N_SMI_PWRSW 0x32 ///< Power switch press SMI
+#define KSC_N_SMI_LID 0x33 ///< Lid switch change SMI
+#define KSC_N_SMI_VB 0x34 ///< Virtual battery switch change SMI
+#define KSC_N_SMI_THERM_0 0x60 ///< Thermal state 0 SMI
+#define KSC_N_SMI_THERM_1 0x61 ///< Thermal state 1 SMI
+#define KSC_N_SMI_THERM_2 0x62 ///< Thermal state 2 SMI
+#define KSC_N_SMI_THERM_3 0x63 ///< Thermal state 3 SMI
+#define KSC_N_SMI_THERM_4 0x64 ///< Thermal state 4 SMI
+#define KSC_N_SMI_THERM_5 0x65 ///< Thermal state 5 SMI
+#define KSC_N_SMI_THERM_6 0x66 ///< Thermal state 6 SMI
+#define KSC_N_SMI_THERM_7 0x67 ///< Thermal state 7 SMI
+#define KSC_N_SMI_THERM_8 0x68 ///< Thermal state 8 SMI
+#define KSC_N_SMI_DOCKED 0x70 ///< Dock complete SMI
+#define KSC_N_SMI_UNDOCKED 0x71 ///< Undock complete SMI
+#define KSC_N_SMI_UNDOCKREQUEST 0x72 ///< Undocking request SMI
+#define KSC_N_SMI_TIMER 0x80 ///< Timer wakeup SMI
+///
+/// Hotkey scan code (CTRL + ALT + SHIFT + key)
+///
+#define KSC_HK_ESC 0x01 ///< ESC
+#define KSC_HK_1 0x02 ///< 1 !
+#define KSC_HK_2 0x03 ///< 2 @
+#define KSC_HK_3 0x04 ///< 3 #
+#define KSC_HK_4 0x05 ///< 4 $
+#define KSC_HK_5 0x06 ///< 5 %
+#define KSC_HK_6 0x07 ///< 6 ^
+#define KSC_HK_7 0x08 ///< 7 &
+#define KSC_HK_8 0x09 ///< 8 *
+#define KSC_HK_9 0x0A ///< 9 (
+#define KSC_HK_0 0x0B ///< 0 )
+#define KSC_HK_MINUS 0x0C ///< - _
+#define KSC_HK_ADD 0x0D ///< = +
+#define KSC_HK_F1 0x3B ///< F1
+#define KSC_HK_F2 0x3C ///< F2
+#define KSC_HK_F3 0x3D ///< F3
+#define KSC_HK_F4 0x3E ///< F4
+#define KSC_HK_F5 0x3F ///< F5
+#define KSC_HK_F6 0x40 ///< F6
+#define KSC_HK_F7 0x41 ///< F7
+#define KSC_HK_F8 0x42 ///< F8
+#define KSC_HK_F9 0x43 ///< F9
+#define KSC_HK_F10 0x44 ///< F10
+#define KSC_HK_F11 0x57 ///< F11
+#define KSC_HK_F12 0x58 ///< F12
+///
+/// Function declarations
+///
+/**
+ This function initializes the KSC library.
+ It must be called before using any of the other KSC library functions.
+
+ @param[in] None.
+
+ @retval EFI_SUCCESS - KscLib is successfully initialized.
+**/
+EFI_STATUS
+InitializeKscLib (
+ VOID
+ );
+/**
+ Send a command to the Keyboard System Controller.
+
+ @param[in] Command - Command byte to send
+
+ @retval EFI_SUCCESS - Command success
+ @retval EFI_TIMEOUT - Command timeout
+ @retval Other - Command failed
+**/
+EFI_STATUS
+SendKscCommand (
+ UINT8 Command
+ );
+/**
+ Sends data to Keyboard System Controller.
+
+ @param[in] Data - Data byte to send
+
+ @retval EFI_SUCCESS - Success
+ @retval EFI_TIMEOUT - Timeout
+ @retval Other - Failed
+**/
+EFI_STATUS
+SendKscData (
+ UINT8 Data
+ );
+/**
+ Receives data from Keyboard System Controller.
+
+ @param[in] Data - Data byte received
+
+ @retval EFI_SUCCESS - Read success
+ @retval EFI_TIMEOUT - Read timeout
+ @retval Other - Read failed
+**/
+EFI_STATUS
+ReceiveKscData (
+ UINT8 *Data
+ );
+/**
+ Receives status from Keyboard System Controller.
+
+ @param[in] KscStatus - Status byte to receive
+
+ @retval EFI_SUCCESS - Success
+ @retval Other - Failed
+**/
+EFI_STATUS
+ReceiveKscStatus (
+ UINT8 *KscStatus
+ );
+#endif
diff --git a/ReferenceCode/Haswell/SampleCode/Include/PeiKscLib.h b/ReferenceCode/Haswell/SampleCode/Include/PeiKscLib.h
new file mode 100644
index 0000000..76c3dfa
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Include/PeiKscLib.h
@@ -0,0 +1,224 @@
+/** @file
+ KSC library functions and definitions.
+
+ This library provides basic KSC interface. It is deemed simple enough and uses in
+ so few cases that there is not currently benefit to implementing a protocol.
+ If more consumers are added, it may be benefitial to implement as a protocol.
+
+ There may be different libraries for different environments (PEI, BS, RT, SMM).
+ Make sure you meet the requirements for the library (protocol dependencies, use
+ restrictions, etc).
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _PEI_KSC_LIB_H_
+#define _PEI_KSC_LIB_H_
+
+///
+/// Timeout if KSC command/data fails
+///
+#define KSC_TIME_OUT 0x20000
+
+///
+/// The Keyboard and System management Controller (KSC) implements a standard 8042 keyboard
+/// controller interface at ports 0x60/0x64 and a ACPI compliant system management controller
+/// at ports 0x62/0x66. Port 0x66 is the command and status port, port 0x62 is the data port.
+///
+#define KSC_D_PORT 0x62
+#define KSC_C_PORT 0x66
+
+///
+/// Status Port 0x62
+///
+#define KSC_S_OVR_TMP 0x80 ///< Current CPU temperature exceeds the threshold
+#define KSC_S_SMI_EVT 0x40 ///< SMI event is pending
+#define KSC_S_SCI_EVT 0x20 ///< SCI event is pending
+#define KSC_S_BURST 0x10 ///< KSC is in burst mode or normal mode
+#define KSC_S_CMD 0x08 ///< Byte in data register is command/data
+#define KSC_S_IGN 0x04 ///< Ignored
+#define KSC_S_IBF 0x02 ///< Input buffer is full/empty
+#define KSC_S_OBF 0x01 ///< Output buffer is full/empty
+
+///
+/// KSC commands that are issued to the KSC through the command port (0x66).
+/// New commands and command parameters should only be written by the host when IBF=0.
+/// Data read from the KSC data port is valid only when OBF=1.
+///
+#define KSC_C_SMI_NOTIFY_ENABLE 0x04 ///< Enable SMI notifications to the host
+#define KSC_C_SMI_NOTIFY_DISABLE 0x05 ///< SMI notifications are disabled and pending notifications cleared
+#define KSC_C_QUERY_SYS_STATUS 0x06 ///< Returns 1 byte of information about the system status
+#define KSC_B_SYS_STATUS_FAN 0x40 ///< Fan status (1 = ON)
+#define KSC_B_SYS_STATUS_DOCK 0x20 ///< Dock status (1 = Docked)
+#define KSC_B_SYS_STATUS_AC 0x10 ///< AC power (1 = AC powered)
+#define KSC_B_SYS_STATUS_THERMAL 0x0F ///< CPU thermal state (0 ~ 9)
+#define KSC_C_FAB_ID 0x0D ///< Get the board fab ID in the lower 3 bits
+#define KSC_B_BOARD_ID 0x0F ///< Board ID = [3:0]
+#define KSC_C_SYSTEM_POWER_OFF 0x22 ///< Turn off the system power
+#define KSC_C_LAN_ON 0x46 ///< Turn on the power to LAN through EC/KSC
+#define KSC_C_LAN_OFF 0x47 ///< Turn off the power to LAN through EC/KSC
+#define KSC_C_GET_DTEMP 0x50 ///< Returns the CPU temperature as read from the SMBus thermal sensor.
+#define KSC_C_SET_CTEMP 0x58 ///< The next byte written to the data port will be the shutdown temperature
+#define KSC_C_EN_DTEMP 0x5E ///< Commands KSC to begin reading Thermal Diode and comparing to Critical Temperature
+#define KSC_C_DIS_DTEMP 0x5F ///< Commands KSC to stop reading Thermal Diode
+#define KSC_C_SMI_QUERY 0x70 ///< The host reads the data port to retrieve the notifications
+#define KSC_C_SMI_TIMER 0x71 ///< Commands the KSC to generate a periodic SMI to the host
+#define KSC_C_SMI_HOTKEY 0x72 ///< Get the scan code of hotkey pressed (CTRL + ALT + SHIFT + key)
+#define KSC_C_READ_MEM 0x80 ///< Read the KSC memory
+#define KSC_C_WRITE_MEM 0x81 ///< Write the KSC memory
+#define KSC_C_KSC_REVISION 0x90 ///< Get the revision for the KSC
+#define KSC_C_SMI_INJECT 0xBA ///< The next byte written to the data port will generate an immediate SMI
+#define KSC_C_SMI_DISABLE 0xBC ///< SMI generation by the KSC is disabled
+#define KSC_C_SMI_ENABLE 0xBD ///< SMI generation by the KSC is enabled
+#define KSC_C_ACPI_ENABLE 0xAA ///< Enable ACPI mode
+#define KSC_C_ACPI_DISABLE 0xAB ///< Disable ACPI mode
+
+///
+/// SMI notification code table, read through command KSC_C_SMI_QUERY
+///
+#define KSC_N_SMI_NULL 0x00 ///< Null marks the end of the SMI notification queue
+#define KSC_N_SMI_HOTKEY 0x20 ///< Hotkey pressed SMI
+#define KSC_N_SMI_ACINSERTION 0x30 ///< AC insertion SMI
+#define KSC_N_SMI_ACREMOVAL 0x31 ///< AC removal SMI
+#define KSC_N_SMI_PWRSW 0x32 ///< Power switch press SMI
+#define KSC_N_SMI_LID 0x33 ///< Lid switch change SMI
+#define KSC_N_SMI_VB 0x34 ///< Virtual battery switch change SMI
+#define KSC_N_SMI_THERM_0 0x60 ///< Thermal state 0 SMI
+#define KSC_N_SMI_THERM_1 0x61 ///< Thermal state 1 SMI
+#define KSC_N_SMI_THERM_2 0x62 ///< Thermal state 2 SMI
+#define KSC_N_SMI_THERM_3 0x63 ///< Thermal state 3 SMI
+#define KSC_N_SMI_THERM_4 0x64 ///< Thermal state 4 SMI
+#define KSC_N_SMI_THERM_5 0x65 ///< Thermal state 5 SMI
+#define KSC_N_SMI_THERM_6 0x66 ///< Thermal state 6 SMI
+#define KSC_N_SMI_THERM_7 0x67 ///< Thermal state 7 SMI
+#define KSC_N_SMI_THERM_8 0x68 ///< Thermal state 8 SMI
+#define KSC_N_SMI_DOCKED 0x70 ///< Dock complete SMI
+#define KSC_N_SMI_UNDOCKED 0x71 ///< Undock complete SMI
+#define KSC_N_SMI_UNDOCKREQUEST 0x72 ///< Undocking request SMI
+#define KSC_N_SMI_TIMER 0x80 ///< Timer wakeup SMI
+
+///
+/// Hotkey scan code (CTRL + ALT + SHIFT + key)
+///
+#define KSC_HK_ESC 0x01 ///< ESC
+#define KSC_HK_1 0x02 ///< 1 !
+#define KSC_HK_2 0x03 ///< 2 @
+#define KSC_HK_3 0x04 ///< 3 #
+#define KSC_HK_4 0x05 ///< 4 $
+#define KSC_HK_5 0x06 ///< 5 %
+#define KSC_HK_6 0x07 ///< 6 ^
+#define KSC_HK_7 0x08 ///< 7 &
+#define KSC_HK_8 0x09 ///< 8 *
+#define KSC_HK_9 0x0A ///< 9 (
+#define KSC_HK_0 0x0B ///< 0 )
+#define KSC_HK_MINUS 0x0C ///< - _
+#define KSC_HK_ADD 0x0D ///< = +
+#define KSC_HK_F1 0x3B ///< F1
+#define KSC_HK_F2 0x3C ///< F2
+#define KSC_HK_F3 0x3D ///< F3
+#define KSC_HK_F4 0x3E ///< F4
+#define KSC_HK_F5 0x3F ///< F5
+#define KSC_HK_F6 0x40 ///< F6
+#define KSC_HK_F7 0x41 ///< F7
+#define KSC_HK_F8 0x42 ///< F8
+#define KSC_HK_F9 0x43 ///< F9
+#define KSC_HK_F10 0x44 ///< F10
+#define KSC_HK_F11 0x57 ///< F11
+#define KSC_HK_F12 0x58 ///< F12
+
+#include EFI_PPI_DEPENDENCY (CpuIo)
+#include EFI_PPI_DEPENDENCY (Stall)
+
+///
+/// Function declarations
+///
+EFI_STATUS
+SendKscCommand (
+ EFI_PEI_SERVICES **PeiServices,
+ PEI_CPU_IO_PPI *CpuIo,
+ PEI_STALL_PPI *StallPpi,
+ UINT8 Command
+ );
+/**
+ Sends command to Keyboard System Controller.
+
+ @param[in] PeiServices - PEI Services
+ @param[in] CpiIo - Pointer to CPU IO protocol
+ @param[in] StallPpi - Pointer to Stall PPI
+ @param[in] Command - Command byte to send
+
+ @retval EFI_SUCCESS - Command success
+ @retval EFI_DEVICE_ERROR - Command error
+ @retval EFI_TIMEOUT - Command timeout
+**/
+
+EFI_STATUS
+SendKscData (
+ EFI_PEI_SERVICES **PeiServices,
+ PEI_CPU_IO_PPI *CpuIo,
+ PEI_STALL_PPI *StallPpi,
+ UINT8 Data
+ );
+/**
+ Sends data to Keyboard System Controller.
+
+ @param[in] PeiServices - PEI Services
+ @param[in] CpiIo - Pointer to CPU IO protocol
+ @param[in] StallPpi - Pointer to Stall PPI
+ @param[in] Data - Data byte to send
+
+ @retval EFI_SUCCESS - Success
+ @retval EFI_DEVICE_ERROR - Error
+ @retval EFI_TIMEOUT - Command timeout
+**/
+
+EFI_STATUS
+ReceiveKscData (
+ EFI_PEI_SERVICES **PeiServices,
+ PEI_CPU_IO_PPI *CpuIo,
+ PEI_STALL_PPI *StallPpi,
+ UINT8 *Data
+ );
+/**
+ Receives data from Keyboard System Controller.
+
+ @param[in] PeiServices - PEI Services
+ @param[in] CpiIo - Pointer to CPU IO protocol
+ @param[in] StallPpi - Pointer to Stall PPI
+ @param[in] Data - Data byte received
+
+ @retval EFI_SUCCESS - Read success
+ @retval EFI_DEVICE_ERROR - Read error
+ @retval EFI_TIMEOUT - Command timeout
+**/
+
+EFI_STATUS
+ReceiveKscStatus (
+ EFI_PEI_SERVICES **PeiServices,
+ PEI_CPU_IO_PPI *CpuIo,
+ UINT8 *KscStatus
+ );
+/**
+ Receives status from Keyboard System Controller.
+
+ @param[in] PeiServices - PEI Services
+ @param[in] CpiIo - Pointer to CPU IO protocol
+ @param[in] KscStatus - Status byte to receive
+
+ @retval EFI_DEVICE_ERROR - Ksc library has not initialized yet or KSC not present
+ @retval EFI_SUCCESS - Get KSC status successfully
+**/
+
+#endif
diff --git a/ReferenceCode/Haswell/SampleCode/Include/SmmIoLib.h b/ReferenceCode/Haswell/SampleCode/Include/SmmIoLib.h
new file mode 100644
index 0000000..cc9eee9
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Include/SmmIoLib.h
@@ -0,0 +1,265 @@
+/** @file
+ This library provides SMM functions for IO and PCI IO access.
+ These can be used to save size and simplify code.
+ All contents must be runtime and SMM safe.
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _SMM_IO_LIB_H_
+#define _SMM_IO_LIB_H_
+
+#include "EdkIIGlueDxe.h"
+#include "Pci22.h"
+
+///
+/// Utility consumed protocols
+///
+#include EFI_PROTOCOL_DEFINITION (SmmBase)
+
+///
+/// Global variables that must be defined and initialized to use this library
+///
+extern EFI_SMM_SYSTEM_TABLE *mSmst;
+
+///
+/// Definitions
+///
+#define ICH_ACPI_TIMER_MAX_VALUE 0x1000000 ///< The timer is 24 bit overflow
+///
+/// Pci I/O related data structure deifinition
+///
+typedef enum {
+ SmmPciWidthUint8 = 0,
+ SmmPciWidthUint16 = 1,
+ SmmPciWidthUint32 = 2,
+ SmmPciWidthUint64 = 3,
+ SmmPciWidthMaximum
+} SMM_PCI_IO_WIDTH;
+
+#define SMM_PCI_ADDRESS(bus, dev, func, reg) \
+ ((UINT64) ((((UINT32) bus) << 24) + (((UINT32) dev) << 16) + (((UINT32) func) << 8) + ((UINT32) reg)))
+
+typedef struct {
+ UINT8 Register;
+ UINT8 Function;
+ UINT8 Device;
+ UINT8 Bus;
+ UINT32 ExtendedRegister;
+} SMM_PCI_IO_ADDRESS;
+
+///
+/// CPU I/O Access Functions
+///
+/**
+ Do a one byte IO read
+
+ @param[in] Address - IO address to read
+
+ @retval Data read
+**/
+UINT8
+SmmIoRead8 (
+ IN UINT16 Address
+ );
+
+/**
+ Do a one byte IO write
+
+ @param[in] Address - IO address to write
+ @param[in] Data - Data to write
+**/
+VOID
+SmmIoWrite8 (
+ IN UINT16 Address,
+ IN UINT8 Data
+ );
+
+/**
+ Do a two byte IO read
+
+ @param[in] Address - IO address to read
+
+ @retval Data read
+**/
+UINT16
+SmmIoRead16 (
+ IN UINT16 Address
+ );
+
+/**
+ Do a two byte IO write
+
+ @param[in] Address - IO address to write
+ @param[in] Data - Data to write
+**/
+VOID
+SmmIoWrite16 (
+ IN UINT16 Address,
+ IN UINT16 Data
+ );
+
+/**
+ Do a four byte IO read
+
+ @param[in] Address - IO address to read
+
+ @retval Data read
+**/
+UINT32
+SmmIoRead32 (
+ IN UINT16 Address
+ );
+
+/**
+ Do a four byte IO write
+
+ @param[in] Address - IO address to write
+ @param[in] Data - Data to write
+**/
+VOID
+SmmIoWrite32 (
+ IN UINT16 Address,
+ IN UINT32 Data
+ );
+
+/**
+ Do a one byte Memory write
+
+ @param[in] Dest - Memory address to write
+ @param[in] Data - Data to write
+
+ @retval None
+**/
+VOID
+SmmMemWrite8 (
+ IN UINT64 Dest,
+ IN UINT8 Data
+ );
+
+/**
+ Do a one byte Memory read
+
+ @param[in] Dest - Memory address to read
+
+ @retval Data read
+**/
+UINT8
+SmmMemRead8 (
+ IN UINT64 Dest
+ );
+
+/**
+ Do a two bytes Memory write
+
+ @param[in] Dest - Memory address to write
+ @param[in] Data - Data to write
+
+ @retval None
+**/
+VOID
+SmmMemWrite16 (
+ IN UINT64 Dest,
+ IN UINT16 Data
+ );
+
+/**
+ Do a two bytes Memory read
+
+ @param[in] Dest - Memory address to read
+
+ @retval Data read
+**/
+UINT16
+SmmMemRead16 (
+ IN UINT64 Dest
+ );
+
+/**
+ Do a four bytes Memory write
+
+ @param[in] Dest - Memory address to write
+ @param[in] Data - Data to write
+
+ @retval None
+**/
+VOID
+SmmMemWrite32 (
+ IN UINT64 Dest,
+ IN UINT32 Data
+ );
+
+/**
+ Do a four bytes Memory read
+
+ @param[in] Dest - Memory address to read
+
+ @retval Data read
+**/
+UINT32
+SmmMemRead32 (
+ IN UINT64 Dest
+ );
+
+/**
+ Do a four bytes Memory read, then AND with Data, then write back to the same address
+
+ @param[in] Dest - Memory address to write
+ @param[in] Data - Data to do AND
+
+ @retval None
+**/
+VOID
+SmmMemAnd32 (
+ IN UINT64 Dest,
+ IN UINT32 Data
+ );
+///
+/// Pci Configuration Space access functions definition
+///
+/**
+ Read value from the specified PCI config space register
+
+ @param[in] Width - The width (8, 16 or 32 bits) of accessed pci config space register
+ @param[in] Address - The address of the accessed pci register (bus, dev, func, offset)
+ @param[in] Buffer - The returned value
+
+ @retval EFI_SUCCESS - All operations successfully
+ @retval EFI_INVALID_PARAMETER - Width is not valid or dosn't match register address
+ @retval Other error code - If any error occured when calling libiary functions
+**/
+EFI_STATUS
+SmmPciCfgRead (
+ IN SMM_PCI_IO_WIDTH Width,
+ IN SMM_PCI_IO_ADDRESS *Address,
+ IN OUT VOID *Buffer
+ );
+/**
+ Write value into the specified PCI config space register
+
+ @param[in] Width - The width (8, 16 or 32 bits) of accessed pci config space register
+ @param[in] Address - The address of the accessed pci register (bus, dev, func, offset)
+ @param[in] Buffer - The returned value
+
+ @retval EFI_SUCCESS - All operations successfully
+ @retval EFI_INVALID_PARAMETER - Width is not valid or dosn't match register address
+ @retval Other error code - If any error occured when calling libiary functions
+**/
+EFI_STATUS
+SmmPciCfgWrite (
+ IN SMM_PCI_IO_WIDTH Width,
+ IN SMM_PCI_IO_ADDRESS *Address,
+ IN OUT VOID *Buffer
+ );
+#endif
diff --git a/ReferenceCode/Haswell/SampleCode/Include/acpibuild.dsc b/ReferenceCode/Haswell/SampleCode/Include/acpibuild.dsc
new file mode 100644
index 0000000..cc3fb3d
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Include/acpibuild.dsc
@@ -0,0 +1,96 @@
+## @file
+# Build description file for building ASL and ACT file types used in ACPI tables
+# You should not put platform details, like how to build DSDT, SSDT, or how to
+# package the ACPI tables into a data file in this build. This should be platform
+# neutral code only.
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[=============================================================================]
+[Compile.Ia32.act,Compile.x64.act]
+#
+# Instructions to create ACPI table sections out of ACPI table C source files.
+#
+
+#/*++
+#
+# If it already exists, then include the dependency list file for this
+# source file. If it doesn't exist, then this is a clean build and the
+# dependency file will get created below and the source file will get
+# compiled. Don't do any of this if NO_MAKEDEPS is defined.
+#
+#--*/
+!IF ("$(NO_MAKEDEPS)" == "")
+
+!IF EXIST($(DEST_DIR)\$(FILE).dep)
+!INCLUDE $(DEST_DIR)\$(FILE).dep
+!ENDIF
+
+#
+# This is how to create the dependency file.
+#
+DEP_FILE = $(DEST_DIR)\$(FILE).dep
+
+$(DEP_FILE) : $(SOURCE_FILE_NAME)
+ $(MAKEDEPS) -ignorenotfound -f $(SOURCE_FILE_NAME) -q -target \
+ $(DEST_DIR)\$(FILE).obj \
+ -o $(DEP_FILE) $(INC)
+
+!ENDIF
+
+#
+# Compile the file
+#
+$(DEST_DIR)\$(FILE).obj : $(SOURCE_FILE_NAME) $(INC_DEPS) $(DEP_FILE)
+ $(CC) $(C_FLAGS) /TC $(SOURCE_FILE_NAME)
+
+#
+# Link it
+#
+$(DEST_DIR)\$(FILE).exe : $(DEST_DIR)\$(FILE).obj
+ $(LINK) $(LINK_FLAGS_EXE) $(DEST_DIR)\$(FILE).obj /OUT:$(DEST_DIR)\$(FILE).exe /ENTRY:main
+
+#
+# Strip out the ACPI table
+#
+$(DEST_DIR)\$(FILE).acpi : $(DEST_DIR)\$(FILE).exe
+ $(GENACPITABLE) $(DEST_DIR)\$(FILE).exe $(DEST_DIR)\$(FILE).acpi
+
+#
+# Create a section from the ACPI table
+#
+$(DEST_DIR)\$(FILE).sec : $(DEST_DIR)\$(FILE).acpi
+ $(GENSECTION) -I $(DEST_DIR)\$(FILE).acpi -O $(DEST_DIR)\$(FILE).sec -S EFI_SECTION_RAW
+
+#
+# Add it to the targets to build
+#
+SECTIONS = $(SECTIONS) $(DEST_DIR)\$(FILE).sec
+
+[=============================================================================]
+[Compile.Ia32.asl,Compile.x64.asl]
+#
+# We run the ASL through the C Preprocessor to resolve definitions.
+#
+$(DEST_DIR)\$(FILE).asl : $(SOURCE_FILE_NAME)
+ $(CC) $(ASL_CPP_FLAGS) /nologo /C /EP /TC $(INC) -oa $(SOURCE_FILE_NAME) > $(DEST_DIR)\$(FILE).asl
+
+#
+# Add it to the targets to build
+#
+ASL_FILES = $(ASL_FILES) $(DEST_DIR)\$(FILE).asl
+
diff --git a/ReferenceCode/Haswell/SampleCode/Library/AslUpdate/Dxe/DxeAslUpdateLib.c b/ReferenceCode/Haswell/SampleCode/Library/AslUpdate/Dxe/DxeAslUpdateLib.c
new file mode 100644
index 0000000..8adbe64
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Library/AslUpdate/Dxe/DxeAslUpdateLib.c
@@ -0,0 +1,333 @@
+/** @file
+ Boot service DXE ASL update library implementation.
+
+ These functions in this file can be called during DXE and cannot be called during runtime
+ or in SMM which should use a RT or SMM library.
+
+ This library uses the ACPI Support protocol.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "AslUpdateLib.h"
+#endif
+///
+/// Function implemenations
+///
+static EFI_ACPI_SUPPORT_PROTOCOL *mAcpiSupport = NULL;
+static EFI_ACPI_TABLE_PROTOCOL *mAcpiTable = NULL;
+
+/**
+ Initialize the ASL update library state.
+ This must be called prior to invoking other library functions.
+
+ @retval EFI_SUCCESS - The function completed successfully.
+**/
+EFI_STATUS
+InitializeAslUpdateLib (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+
+ ///
+ /// Locate ACPI tables
+ ///
+ Status = gBS->LocateProtocol (&gEfiAcpiSupportGuid, NULL, (VOID **) &mAcpiSupport);
+ ASSERT_EFI_ERROR (Status);
+ Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **) &mAcpiTable);
+ return EFI_SUCCESS;
+}
+
+/**
+ This procedure will update two kinds of asl code.
+ 1: Operating Region base address and length.
+ 2: Resource Consumption structures in device LDRC.
+
+ @param[in] AslSignature - The signature of Operation Region that we want to update.
+ @param[in] BaseAddress - Base address of IO trap.
+ @param[in] Length - Length of IO address.
+
+ @retval EFI_SUCCESS - The function completed successfully.
+**/
+EFI_STATUS
+UpdateAslCode (
+ IN UINT32 AslSignature,
+ IN UINT16 BaseAddress,
+ IN UINT8 Length
+ )
+{
+ EFI_STATUS Status;
+ EFI_ACPI_DESCRIPTION_HEADER *Table;
+ EFI_ACPI_TABLE_VERSION Version;
+ UINT8 *CurrPtr;
+ UINT8 *Operation;
+ UINT32 *Signature;
+ UINT8 *DsdtPointer;
+ INTN Index;
+ UINTN Handle;
+ UINT16 AslLength;
+
+ ///
+ /// Locate table with matching ID
+ ///
+ Index = 0;
+ AslLength = 0;
+ do {
+ Status = mAcpiSupport->GetAcpiTable (mAcpiSupport, Index, (VOID **) &Table, &Version, &Handle);
+ if (Status == EFI_NOT_FOUND) {
+ break;
+ }
+
+ ASSERT_EFI_ERROR (Status);
+ Index++;
+ } while (Table->Signature != EFI_ACPI_3_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE);
+
+ ///
+ /// Fix up the following ASL Code in DSDT:
+ /// (1) OperationRegion's IO Base Address and Length.
+ /// (2) Resource Consumption in LPC Device.
+ ///
+ CurrPtr = (UINT8 *) Table;
+
+ ///
+ /// Loop through the ASL looking for values that we must fix up.
+ ///
+ for (DsdtPointer = CurrPtr; DsdtPointer <= (CurrPtr + ((EFI_ACPI_COMMON_HEADER *) CurrPtr)->Length); DsdtPointer++) {
+ ///
+ /// Get a pointer to compare for signature
+ ///
+ Signature = (UINT32 *) DsdtPointer;
+
+ ///
+ /// Check if this is the signature we are looking for
+ ///
+ if ((*Signature) == AslSignature) {
+ ///
+ /// Conditional match. For Region Objects, the Operator will always be the
+ /// byte immediately before the specific name. Therefore, subtract 1 to check
+ /// the Operator.
+ ///
+ Operation = DsdtPointer - 1;
+
+ ///
+ /// If we have an operation region, update the base address and length
+ ///
+ if (*Operation == AML_OPREGION_OP) {
+ ///
+ /// Fixup the Base Address in OperationRegion.
+ ///
+ *(UINT16 *) (DsdtPointer + 6) = BaseAddress;
+
+ ///
+ /// Fixup the Length in OperationRegion.
+ ///
+ *(DsdtPointer + 9) = Length;
+ }
+
+ } else if ((*Signature) == EFI_SIGNATURE_32 ('L', 'D', 'R', 'C')) {
+ ///
+ /// Make sure it's device of LDRC and read the length
+ ///
+ if (*(DsdtPointer - 2) == AML_DEVICE_OP) {
+ AslLength = *(DsdtPointer - 1);
+ } else if (*(DsdtPointer - 3) == AML_DEVICE_OP) {
+ AslLength = *(UINT16 *) (DsdtPointer - 2);
+ AslLength = (AslLength & 0x0F) + ((AslLength & 0x0FF00) >> 4);
+ }
+ ///
+ /// Conditional match. Search _CSR in Device (LDRC).
+ ///
+ for (Operation = DsdtPointer; Operation <= DsdtPointer + AslLength; Operation++) {
+ ///
+ /// Get a pointer to compare for signature
+ ///
+ Signature = (UINT32 *) Operation;
+
+ ///
+ /// Check if this is the signature we are looking for
+ ///
+ if ((*Signature) == EFI_SIGNATURE_32 ('_', 'C', 'R', 'S')) {
+ ///
+ /// Now look for an empty resource entry, fix the base address and length fields
+ ///
+ for (Index = 0; *(UINT16 *) (Operation + 9 + 8 * Index) != 0x0079; Index++) {
+ if (*(UINT16 *) (Operation + 11 + 8 * Index) == UINT16_BIT_MAGIC_NUMBER) {
+ ///
+ /// Fixup the Base Address and Length.
+ ///
+ *(UINT16 *) (Operation + 11 + 8 * Index) = BaseAddress;
+ *(UINT16 *) (Operation + 13 + 8 * Index) = BaseAddress;
+ *(Operation + 16 + 8 * Index) = Length;
+
+ break;
+ }
+ }
+ }
+ }
+
+ DsdtPointer = DsdtPointer + AslLength;
+ }
+ }
+ ///
+ /// Update the modified ACPI table
+ ///
+ Status = mAcpiTable->InstallAcpiTable (
+ mAcpiTable,
+ Table,
+ Table->Length,
+ &Handle
+ );
+ FreePool (Table);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This function uses the ACPI support protocol to locate an ACPI table.
+ It is really only useful for finding tables that only have a single instance,
+ e.g. FADT, FACS, MADT, etc. It is not good for locating SSDT, etc.
+
+ @param[in] Signature - Pointer to an ASCII string containing the OEM Table ID from the ACPI table header
+ @param[in] Table - Updated with a pointer to the table
+ @param[in] Handle - AcpiSupport protocol table handle for the table found
+ @param[in] Version - The version of the table desired
+
+ @retval EFI_SUCCESS - The function completed successfully.
+**/
+EFI_STATUS
+LocateAcpiTableBySignature (
+ IN UINT32 Signature,
+ IN OUT EFI_ACPI_DESCRIPTION_HEADER **Table,
+ IN OUT UINTN *Handle,
+ IN OUT EFI_ACPI_TABLE_VERSION *Version
+ )
+{
+ EFI_STATUS Status;
+ INTN Index;
+ EFI_ACPI_TABLE_VERSION DesiredVersion;
+
+ DesiredVersion = *Version;
+ ///
+ /// Locate table with matching ID
+ ///
+ Index = 0;
+ do {
+ Status = mAcpiSupport->GetAcpiTable (mAcpiSupport, Index, (VOID **) Table, Version, Handle);
+ if (Status == EFI_NOT_FOUND) {
+ break;
+ }
+
+ ASSERT_EFI_ERROR (Status);
+ Index++;
+ } while ((*Table)->Signature != Signature || !(*Version & DesiredVersion));
+
+ ///
+ /// If we found the table, there will be no error.
+ ///
+ return Status;
+}
+
+/**
+ This function uses the ACPI support protocol to locate an ACPI SSDT table.
+
+ @param[in] TableId - Pointer to an ASCII string containing the OEM Table ID from the ACPI table header
+ @param[in] TableIdSize - Length of the TableId to match. Table ID are 8 bytes long, this function
+ will consider it a match if the first TableIdSize bytes match
+ @param[in] Table - Updated with a pointer to the table
+ @param[in] Handle - AcpiSupport protocol table handle for the table found
+ @param[in] Version - See AcpiSupport protocol, GetAcpiTable function for use
+
+ @retval EFI_SUCCESS - The function completed successfully.
+**/
+EFI_STATUS
+LocateAcpiTableByOemTableId (
+ IN UINT8 *TableId,
+ IN UINT8 TableIdSize,
+ IN OUT EFI_ACPI_DESCRIPTION_HEADER **Table,
+ IN OUT UINTN *Handle,
+ IN OUT EFI_ACPI_TABLE_VERSION *Version
+ )
+{
+ EFI_STATUS Status;
+ INTN Index;
+
+ ///
+ /// Locate table with matching ID
+ ///
+ Index = 0;
+ do {
+ Status = mAcpiSupport->GetAcpiTable (mAcpiSupport, Index, (VOID **) Table, Version, Handle);
+ if (Status == EFI_NOT_FOUND) {
+ break;
+ }
+
+ ASSERT_EFI_ERROR (Status);
+ Index++;
+ } while (CompareMem (&(*Table)->OemTableId, TableId, TableIdSize));
+
+ ///
+ /// If we found the table, there will be no error.
+ ///
+ return Status;
+}
+
+/**
+ This function calculates and updates an UINT8 checksum.
+
+ @param[in] Buffer Pointer to buffer to checksum
+ @param[in] Size Number of bytes to checksum
+ @param[in] ChecksumOffset Offset to place the checksum result in
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+AcpiChecksum (
+ IN VOID *Buffer,
+ IN UINTN Size,
+ IN UINTN ChecksumOffset
+ )
+{
+ UINT8 Sum;
+ UINT8 *Ptr;
+
+ Sum = 0;
+ ///
+ /// Initialize pointer
+ ///
+ Ptr = Buffer;
+
+ ///
+ /// set checksum to 0 first
+ ///
+ Ptr[ChecksumOffset] = 0;
+
+ ///
+ /// add all content of buffer
+ ///
+ while (Size--) {
+ Sum = (UINT8) (Sum + (*Ptr++));
+ }
+ ///
+ /// set checksum
+ ///
+ Ptr = Buffer;
+ Ptr[ChecksumOffset] = (UINT8) (0xff - Sum + 1);
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/Haswell/SampleCode/Library/AslUpdate/Dxe/DxeAslUpdateLib.inf b/ReferenceCode/Haswell/SampleCode/Library/AslUpdate/Dxe/DxeAslUpdateLib.inf
new file mode 100644
index 0000000..138e053
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Library/AslUpdate/Dxe/DxeAslUpdateLib.inf
@@ -0,0 +1,46 @@
+## @file
+# Component description file.
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = DxeAslUpdateLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ DxeAslUpdateLib.c
+
+[includes.common]
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EFI_SOURCE)/Framework
+ .
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EDK_SOURCE)/Foundation
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/SampleCode/Include
+
+[libraries.common]
+ EdkFrameworkProtocolLib
+
+[nmake.common]
diff --git a/ReferenceCode/Haswell/SampleCode/Library/AslUpdate/Dxe/PpmAslUpdateLib.cif b/ReferenceCode/Haswell/SampleCode/Library/AslUpdate/Dxe/PpmAslUpdateLib.cif
new file mode 100644
index 0000000..5cfa2b1
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Library/AslUpdate/Dxe/PpmAslUpdateLib.cif
@@ -0,0 +1,11 @@
+<component>
+ name = "PpmAslUpdateLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Haswell\SampleCode\Library\AslUpdate\Dxe"
+ RefName = "PpmAslUpdateLib"
+[files]
+"PpmAslUpdateLib.sdl"
+"PpmAslUpdateLib.mak"
+"DxeAslUpdateLib.c"
+"DxeAslUpdateLib.inf"
+<endComponent>
diff --git a/ReferenceCode/Haswell/SampleCode/Library/AslUpdate/Dxe/PpmAslUpdateLib.mak b/ReferenceCode/Haswell/SampleCode/Library/AslUpdate/Dxe/PpmAslUpdateLib.mak
new file mode 100644
index 0000000..adcce28
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Library/AslUpdate/Dxe/PpmAslUpdateLib.mak
@@ -0,0 +1,31 @@
+# MAK file for the ModulePart:AslUpdateLib
+all : PpmAslUpdateLib
+
+$(BUILD_DIR)\PpmAslUpdateLib.lib : PpmAslUpdateLib
+
+PpmAslUpdateLib : $(BUILD_DIR)\PpmAslUpdateLib.mak PpmAslUpdateLibBin
+
+$(BUILD_DIR)\PpmAslUpdateLib.mak : $(PpmAslUpdateLib_DIR)\$(@B).cif $(PpmAslUpdateLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(PpmAslUpdateLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+PpmAslUpdateLib_INCLUDES=\
+ $(PROJECT_CPU_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(iAMT_INCLUDES)\
+ $(IndustryStandard_INCLUDES)
+
+PpmAslUpdateLib_DEFINES=\
+ $(MY_DEFINES)\
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__\
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__\
+
+PpmAslUpdateLib_LIBS=\
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+
+PpmAslUpdateLibBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\PpmAslUpdateLib.mak all \
+ "MY_INCLUDES=$(PpmAslUpdateLib_INCLUDES)"\
+ "MY_DEFINES=$(PpmAslUpdateLib_DEFINES)"\
+ TYPE=LIBRARY\ \ No newline at end of file
diff --git a/ReferenceCode/Haswell/SampleCode/Library/AslUpdate/Dxe/PpmAslUpdateLib.sdl b/ReferenceCode/Haswell/SampleCode/Library/AslUpdate/Dxe/PpmAslUpdateLib.sdl
new file mode 100644
index 0000000..0a74ab2
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Library/AslUpdate/Dxe/PpmAslUpdateLib.sdl
@@ -0,0 +1,29 @@
+TOKEN
+ Name = PpmAslUpdateLib_SUPPORT
+ Value = 1
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable AslUpdateLib support in Project"
+End
+
+MODULE
+ Help = "Includes PpmAslUpdateLib.mak to Project"
+ File = "PpmAslUpdateLib.mak"
+End
+
+PATH
+ Name = "PpmAslUpdateLib_DIR"
+End
+
+ELINK
+ Name = "PpmAslUpdateLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PpmAslUpdateLib.lib"
+ Parent = "PpmAslUpdateLib_LIB"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/Haswell/SampleCode/Library/BootGuardRevocationLib/Dxe/BootGuardRevocationLib.c b/ReferenceCode/Haswell/SampleCode/Library/BootGuardRevocationLib/Dxe/BootGuardRevocationLib.c
new file mode 100644
index 0000000..2a3ff51
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Library/BootGuardRevocationLib/Dxe/BootGuardRevocationLib.c
@@ -0,0 +1,34 @@
+/** @file
+ This file is SampleCode for Boot Guard revocation notification.
+
+@copyright
+ Copyright (c) 2012 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+#include "BootGuardRevocationLib.h"
+
+/**
+ Provide a hook for OEM to deal with Boot Guard revocation flow.
+**/
+VOID
+EFIAPI
+BootGuardOemRevocationHook (
+ VOID
+ )
+{
+
+ return;
+}
diff --git a/ReferenceCode/Haswell/SampleCode/Library/BootGuardRevocationLib/Dxe/BootGuardRevocationLib.cif b/ReferenceCode/Haswell/SampleCode/Library/BootGuardRevocationLib/Dxe/BootGuardRevocationLib.cif
new file mode 100644
index 0000000..fdad18a
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Library/BootGuardRevocationLib/Dxe/BootGuardRevocationLib.cif
@@ -0,0 +1,11 @@
+<component>
+ name = "BootGuardRevocationLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Haswell\SampleCode\Library\BootGuardRevocationLib\Dxe"
+ RefName = "BootGuardRevocationLib"
+[files]
+"BootGuardRevocationLib.sdl"
+"BootGuardRevocationLib.mak"
+"BootGuardRevocationLib.c"
+"BootGuardRevocationLib.inf"
+<endComponent>
diff --git a/ReferenceCode/Haswell/SampleCode/Library/BootGuardRevocationLib/Dxe/BootGuardRevocationLib.inf b/ReferenceCode/Haswell/SampleCode/Library/BootGuardRevocationLib/Dxe/BootGuardRevocationLib.inf
new file mode 100644
index 0000000..295dcf6
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Library/BootGuardRevocationLib/Dxe/BootGuardRevocationLib.inf
@@ -0,0 +1,73 @@
+## @file
+# Provides services to display Boot Guard revocation notification.
+#
+#@copyright
+# Copyright (c) 2012 - 2013 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = BootGuardRevocationLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ BootGuardRevocationLib.c
+
+[includes.common]
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/SampleCode/Include
+
+#
+# Edk II Glue Library, some hearder are included by R9 header so have to include
+#
+
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Framework
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[libraries.common]
+ EdkIIGlueDxeReportStatusCodeLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueBaseMemoryLib
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueUefiLib
+ EdkFrameworkProtocolLib
+
+[nmake.common]
+
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_LIB__ \ No newline at end of file
diff --git a/ReferenceCode/Haswell/SampleCode/Library/BootGuardRevocationLib/Dxe/BootGuardRevocationLib.mak b/ReferenceCode/Haswell/SampleCode/Library/BootGuardRevocationLib/Dxe/BootGuardRevocationLib.mak
new file mode 100644
index 0000000..2d3c433
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Library/BootGuardRevocationLib/Dxe/BootGuardRevocationLib.mak
@@ -0,0 +1,31 @@
+# MAK file for the ModulePart:AslUpdateLib
+all : BootGuardRevocationLib
+
+$(BUILD_DIR)\BootGuardRevocationLib.lib : BootGuardRevocationLib
+
+BootGuardRevocationLib : $(BUILD_DIR)\BootGuardRevocationLib.mak BootGuardRevocationLibBin
+
+$(BUILD_DIR)\BootGuardRevocationLib.mak : $(BootGuardRevocationLib_DIR)\$(@B).cif $(BootGuardRevocationLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(BootGuardRevocationLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+BootGuardRevocationLib_INCLUDES=\
+ $(PROJECT_CPU_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(iAMT_INCLUDES)\
+ $(IndustryStandard_INCLUDES)
+
+BootGuardRevocationLib_DEFINES=\
+ $(MY_DEFINES)\
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__\
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__\
+
+BootGuardRevocationLib_LIBS=\
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+
+BootGuardRevocationLibBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\BootGuardRevocationLib.mak all \
+ "MY_INCLUDES=$(BootGuardRevocationLib_INCLUDES)"\
+ "MY_DEFINES=$(BootGuardRevocationLib_DEFINES)"\
+ TYPE=LIBRARY\ \ No newline at end of file
diff --git a/ReferenceCode/Haswell/SampleCode/Library/BootGuardRevocationLib/Dxe/BootGuardRevocationLib.sdl b/ReferenceCode/Haswell/SampleCode/Library/BootGuardRevocationLib/Dxe/BootGuardRevocationLib.sdl
new file mode 100644
index 0000000..b7405cf
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Library/BootGuardRevocationLib/Dxe/BootGuardRevocationLib.sdl
@@ -0,0 +1,29 @@
+TOKEN
+ Name = BootGuardRevocationLib_SUPPORT
+ Value = 1
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable BootGuardRevocationLib support in Project"
+End
+
+MODULE
+ Help = "Includes BootGuardRevocationLib.mak to Project"
+ File = "BootGuardRevocationLib.mak"
+End
+
+PATH
+ Name = "BootGuardRevocationLib_DIR"
+End
+
+ELINK
+ Name = "BootGuardRevocationLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\BootGuardRevocationLib.lib"
+ Parent = "BootGuardRevocationLib_LIB"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/Haswell/SampleCode/Library/BootGuardTpmEventLogLib/BootGuardTpmEventLogLib.c b/ReferenceCode/Haswell/SampleCode/Library/BootGuardTpmEventLogLib/BootGuardTpmEventLogLib.c
new file mode 100644
index 0000000..ffb8480
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Library/BootGuardTpmEventLogLib/BootGuardTpmEventLogLib.c
@@ -0,0 +1,838 @@
+/** @file
+ This file is SampleCode for Boot Guard TPM event log.
+
+@copyright
+ Copyright (c) 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueBase.h"
+#include "EdkIIGluePeim.h"
+#include "CpuAccess.h"
+#endif
+
+#include <EfiTpm.h>
+#include "BootGuardTpmEventLogLib.h"
+
+//
+// Data structure definition
+//
+#pragma pack (1)
+
+#define BASE_4GB 0x0000000100000000ULL
+//
+// FIT definition
+//
+#define FIT_TABLE_TYPE_HEADER 0x0
+#define FIT_TABLE_TYPE_MICROCODE 0x1
+#define FIT_TABLE_TYPE_STARTUP_ACM 0x2
+#define FIT_TABLE_TYPE_BIOS_MODULE 0x7
+#define FIT_TABLE_TYPE_KEY_MANIFEST 0xB
+#define FIT_TABLE_TYPE_BOOT_POLICY_MANIFEST 0xC
+
+typedef struct {
+ UINT64 Address;
+ UINT8 Size[3];
+ UINT8 Reserved;
+ UINT16 Version;
+ UINT8 Type : 7;
+ UINT8 Cv : 1;
+ UINT8 Chksum;
+} FIRMWARE_INTERFACE_TABLE_ENTRY;
+
+//
+// ACM definition
+//
+#define MMIO_ACM_STATUS (TXT_PUBLIC_BASE + R_CPU_BOOT_GUARD_ACM_STATUS)
+#define ACM_KEY_HASH_MMIO_ADDR_0 0xFED30400
+#define ACM_KEY_HASH_MMIO_ADDR_1 (ACM_KEY_HASH_MMIO_ADDR_0 + 8)
+#define ACM_KEY_HASH_MMIO_ADDR_2 (ACM_KEY_HASH_MMIO_ADDR_0 + 16)
+#define ACM_KEY_HASH_MMIO_ADDR_3 (ACM_KEY_HASH_MMIO_ADDR_0 + 24)
+#define ACM_PKCS_1_5_RSA_SIGNATURE_SIZE 256
+#define ACM_HEADER_FLAG_DEBUG_SIGNED BIT15
+#define ACM_NPW_SVN 0x2
+
+typedef struct {
+ UINT32 ModuleType;
+ UINT32 HeaderLen;
+ UINT32 HeaderVersion;
+ UINT16 ChipsetId;
+ UINT16 Flags;
+ UINT32 ModuleVendor;
+ UINT32 Date;
+ UINT32 Size;
+ UINT16 AcmSvn;
+ UINT16 Reserved1;
+ UINT32 CodeControl;
+ UINT32 ErrorEntryPoint;
+ UINT32 GdtLimit;
+ UINT32 GdtBasePtr;
+ UINT32 SegSel;
+ UINT32 EntryPoint;
+ UINT8 Reserved2[64];
+ UINT32 KeySize;
+ UINT32 ScratchSize;
+ UINT8 RsaPubKey[64 * 4];
+ UINT32 RsaPubExp;
+ UINT8 RsaSig[256];
+} ACM_FORMAT;
+
+//
+// Manifest definition
+//
+#define SHA256_DIGEST_SIZE 32
+
+typedef struct {
+ UINT16 HashAlg;
+ UINT16 Size;
+ UINT8 HashBuffer[SHA256_DIGEST_SIZE];
+} HASH_STRUCTURE;
+
+#define RSA_PUBLIC_KEY_STRUCT_KEY_SIZE_DEFAULT 2048
+#define RSA_PUBLIC_KEY_STRUCT_KEY_LEN_DEFAULT (RSA_PUBLIC_KEY_STRUCT_KEY_SIZE_DEFAULT/8)
+
+typedef struct {
+ UINT8 Version;
+ UINT16 KeySize;
+ UINT32 Exponent;
+ UINT8 Modulus[RSA_PUBLIC_KEY_STRUCT_KEY_LEN_DEFAULT];
+} RSA_PUBLIC_KEY_STRUCT;
+
+#define RSASSA_SIGNATURE_STRUCT_KEY_SIZE_DEFAULT 2048
+#define RSASSA_SIGNATURE_STRUCT_KEY_LEN_DEFAULT (RSASSA_SIGNATURE_STRUCT_KEY_SIZE_DEFAULT/8)
+typedef struct {
+ UINT8 Version;
+ UINT16 KeySize;
+ UINT16 HashAlg;
+ UINT8 Signature[RSASSA_SIGNATURE_STRUCT_KEY_LEN_DEFAULT];
+} RSASSA_SIGNATURE_STRUCT;
+
+typedef struct {
+ UINT8 Version;
+ UINT16 KeyAlg;
+ RSA_PUBLIC_KEY_STRUCT Key;
+ UINT16 SigScheme;
+ RSASSA_SIGNATURE_STRUCT Signature;
+} KEY_SIGNATURE_STRUCT;
+
+#define BOOT_POLICY_MANIFEST_HEADER_STRUCTURE_ID (*(UINT64 *)"__ACBP__")
+typedef struct {
+ UINT8 StructureId[8];
+ UINT8 StructVersion;
+ UINT8 HdrStructVersion;
+ UINT8 PMBPMVersion;
+ UINT8 BPSVN;
+ UINT8 ACMSVN;
+ UINT8 Reserved;
+ UINT16 NEMDataStack;
+} BOOT_POLICY_MANIFEST_HEADER;
+
+#define IBB_SEGMENT_FLAG_IBB 0x0
+#define IBB_SEGMENT_FLAG_NON_IBB 0x1
+typedef struct {
+ UINT8 Reserved[2];
+ UINT16 Flags;
+ UINT32 Base;
+ UINT32 Size;
+} IBB_SEGMENT_ELEMENT;
+
+#define BOOT_POLICY_MANIFEST_IBB_ELEMENT_STRUCTURE_ID (*(UINT64 *)"__IBBS__")
+#define IBB_FLAG_AUTHORITY_MEASURE 0x4
+
+typedef struct {
+ UINT8 StructureId[8];
+ UINT8 StructVersion;
+ UINT8 Reserved1[2];
+ UINT8 PbetValue;
+ UINT32 Flags;
+ UINT64 IbbMchBar;
+ UINT64 VtdBar;
+ UINT32 PmrlBase;
+ UINT32 PmrlLimit;
+ UINT64 Reserved2[2];
+ HASH_STRUCTURE PostIbbHash;
+ UINT32 EntryPoint;
+ HASH_STRUCTURE Digest;
+ UINT8 SegmentCount;
+ IBB_SEGMENT_ELEMENT IbbSegment[1];
+} IBB_ELEMENT;
+
+#define BOOT_POLICY_MANIFEST_PLATFORM_MANUFACTURER_ELEMENT_STRUCTURE_ID (*(UINT64 *)"__PMDA__")
+typedef struct {
+ UINT8 StructureId[8];
+ UINT8 StructVersion;
+ UINT16 PmDataSize;
+} PLATFORM_MANUFACTURER_ELEMENT;
+
+#define BOOT_POLICY_MANIFEST_SIGNATURE_ELEMENT_STRUCTURE_ID (*(UINT64 *)"__PMSG__")
+typedef struct {
+ UINT8 StructureId[8];
+ UINT8 StructVersion;
+ KEY_SIGNATURE_STRUCT KeySignature;
+} BOOT_POLICY_MANIFEST_SIGNATURE_ELEMENT;
+
+#define KEY_MANIFEST_STRUCTURE_ID (*(UINT64 *)"__KEYM__")
+typedef struct {
+ UINT8 StructureId[8];
+ UINT8 StructVersion;
+ UINT8 KeyManifestVersion;
+ UINT8 KmSvn;
+ UINT8 KeyManifestId;
+ HASH_STRUCTURE BpKey;
+ KEY_SIGNATURE_STRUCT KeyManifestSignature;
+} KEY_MANIFEST_STRAUCTURE;
+
+//
+// DetailPCR data
+//
+typedef struct {
+ UINT8 BpRstrLow;
+ UINT8 BpTypeLow;
+ UINT16 AcmSvn;
+ UINT8 AcmRsaSignature[ACM_PKCS_1_5_RSA_SIGNATURE_SIZE];
+ UINT8 KmRsaSignature[RSASSA_SIGNATURE_STRUCT_KEY_LEN_DEFAULT];
+ UINT8 BpmRsaSignature[RSASSA_SIGNATURE_STRUCT_KEY_LEN_DEFAULT];
+ UINT8 IbbHash[SHA256_DIGEST_SIZE];
+} DETAIL_PCR_DATA;
+
+//
+// AuthorityPCR data
+//
+typedef struct {
+ UINT8 BpRstrLow;
+ UINT8 BpTypeLow;
+ UINT16 AcmSvn;
+ UINT8 AcmKeyHash[SHA256_DIGEST_SIZE];
+ UINT8 BpKeyHash[SHA256_DIGEST_SIZE];
+ UINT8 BpmKeyHashFromKm[SHA256_DIGEST_SIZE];
+ UINT8 VerifiedBoot;
+} AUTHORITY_PCR_DATA;
+
+//
+// Boot Policy Restrictions definition
+//
+typedef union {
+ struct {
+ UINT8 Facb : 1;
+ UINT8 Dcd : 1;
+ UINT8 Dbi : 1;
+ UINT8 Pbe : 1;
+ UINT8 Bbp : 1;
+ UINT8 Reserved : 2;
+ UINT8 BpInvd : 1;
+ } Bits;
+ UINT8 Data;
+} BP_RSTR_LOW;
+
+//
+// Boot Policy Type definition
+//
+typedef union {
+ struct {
+ UINT8 MeasuredBoot : 1;
+ UINT8 VerifiedBoot : 1;
+ UINT8 Hap : 1;
+ UINT8 Reserved : 5;
+ } Bits;
+ UINT8 Data;
+} BP_TYPE_LOW;
+
+#pragma pack ()
+
+//
+// OEM_IMPLEMENTATION_BEGIN
+//
+// SHA calculation and TPM functions are OEM Core/Platform code depended,
+// OEM can customize these empty functions for their specific.
+//
+// For the detail of SHA algorithm, please refer to FIPS PUB 180-2.
+// For TPM event log, please refer to TCG EFI Protocol Specification.
+//
+
+//
+// Null-defined macro for passing EDK build
+//
+#define SHA_INIT
+#define SHA_UPDATE
+#define SHA_FINAL
+
+/**
+ Calculate SHA-1 Hash
+
+ @param[in] Data Data to be hashed.
+ @param[in] Size Size of data.
+ @param[out] Digest SHA-1 digest value.
+**/
+VOID
+CreateSha1Hash (
+ IN UINT8 *Data,
+ IN UINTN Size,
+ OUT UINT8 *Digest
+ )
+{
+ VOID *Context;
+
+ SHA_INIT (Context);
+ SHA_UPDATE (Context, Data, Size);
+ SHA_FINAL (Context, Digest);
+
+ return;
+}
+
+/**
+ Calculate SHA256 Hash
+
+ @param[in] Data Data to be hashed.
+ @param[in] Size Size of data.
+ @param[out] Digest SHA256 digest value.
+**/
+VOID
+CreateSha256Hash (
+ IN UINT8 *Data,
+ IN UINTN Size,
+ OUT UINT8 *Digest
+ )
+{
+ VOID *Context;
+
+ SHA_INIT (Context);
+ SHA_UPDATE (Context, Data, Size);
+ SHA_FINAL (Context, Digest);
+
+ return;
+}
+
+/**
+ Add a new entry to the Event Log.
+
+ @param[in] NewEventHdr Pointer to a TCG_PCR_EVENT_HDR data structure.
+ @param[in] NewEventData Pointer to the new event data.
+
+ @retval EFI_SUCCESS The new event log entry was added.
+ @retval EFI_OUT_OF_RESOURCES No enough memory to log the new event.
+**/
+EFI_STATUS
+LogEvent (
+ IN TCG_PCR_EVENT_HDR *NewEventHdr,
+ IN UINT8 *NewEventData
+ )
+{
+
+ return EFI_SUCCESS;
+}
+//
+// OEM_IMPLEMENTATION_END
+//
+
+/**
+ Find FIT Entry address data by type
+
+ @param[in] Type FIT Entry type
+
+ @return FIT entry address
+**/
+VOID *
+FindFitEntryData (
+ IN UINT8 Type
+ )
+{
+ FIRMWARE_INTERFACE_TABLE_ENTRY *FitEntry;
+ UINT32 EntryNum;
+ UINT64 FitTableOffset;
+ UINT32 Index;
+
+ FitTableOffset = *(UINT64 *)(UINTN)(BASE_4GB - 0x40);
+ FitEntry = (FIRMWARE_INTERFACE_TABLE_ENTRY *)(UINTN)FitTableOffset;
+ if (FitEntry[0].Address != *(UINT64 *)"_FIT_ ") {
+ return NULL;
+ }
+ if (FitEntry[0].Type != FIT_TABLE_TYPE_HEADER) {
+ return NULL;
+ }
+ EntryNum = *(UINT32 *)(&FitEntry[0].Size[0]) & 0xFFFFFF;
+ for (Index = 0; Index < EntryNum; Index++) {
+ if (FitEntry[Index].Type == Type) {
+ return (VOID *)(UINTN)FitEntry[Index].Address;
+ }
+ }
+
+ return NULL;
+}
+
+/**
+ Find the address of ACM.
+
+ @return A pointer to ACM.
+**/
+VOID *
+FindAcm (
+ VOID
+ )
+{
+ return FindFitEntryData (FIT_TABLE_TYPE_STARTUP_ACM);
+}
+
+/**
+ Find the address of Boot Policy Manifest.
+
+ @return A pointer to Key Manifest data structure.
+**/
+VOID *
+FindBpm (
+ VOID
+ )
+{
+ return FindFitEntryData (FIT_TABLE_TYPE_BOOT_POLICY_MANIFEST);
+}
+
+/**
+ Find the address of Key Manifest.
+
+ @return A pointer to Key Manifest data structure.
+**/
+VOID *
+FindKm (
+ VOID
+ )
+{
+ return FindFitEntryData (FIT_TABLE_TYPE_KEY_MANIFEST);
+}
+
+/**
+ Find BPM element by structureID
+
+ @param[in] Bpm A pointer to BPM data structure.
+ @param[in] StructureId BPM element StructureID
+
+ @return A pointer to BPM element data structure.
+**/
+VOID *
+FindBpmElement (
+ IN BOOT_POLICY_MANIFEST_HEADER *Bpm,
+ IN UINT64 StructureId
+ )
+{
+ BOOT_POLICY_MANIFEST_HEADER *BpmHeader;
+ IBB_ELEMENT *IbbElement;
+ PLATFORM_MANUFACTURER_ELEMENT *PmElement;
+ BOOT_POLICY_MANIFEST_SIGNATURE_ELEMENT *BpmSignatureElement;
+ UINT8 *Buffer;
+
+ Buffer = (UINT8 *)Bpm;
+
+ BpmHeader = (BOOT_POLICY_MANIFEST_HEADER *)Buffer;
+ if (*(UINT64 *)BpmHeader->StructureId != BOOT_POLICY_MANIFEST_HEADER_STRUCTURE_ID) {
+ return NULL;
+ }
+ if (StructureId == BOOT_POLICY_MANIFEST_HEADER_STRUCTURE_ID) {
+ return Buffer;
+ }
+ Buffer += sizeof(BOOT_POLICY_MANIFEST_HEADER);
+
+ IbbElement = (IBB_ELEMENT *)Buffer;
+ if (*(UINT64 *)IbbElement->StructureId != BOOT_POLICY_MANIFEST_IBB_ELEMENT_STRUCTURE_ID) {
+ return NULL;
+ }
+ if (StructureId == BOOT_POLICY_MANIFEST_IBB_ELEMENT_STRUCTURE_ID) {
+ return Buffer;
+ }
+ Buffer += sizeof(IBB_ELEMENT) + sizeof(IBB_SEGMENT_ELEMENT) * (IbbElement->SegmentCount - 1);
+
+ PmElement = (PLATFORM_MANUFACTURER_ELEMENT *)Buffer;
+ while (*(UINT64 *)PmElement->StructureId == BOOT_POLICY_MANIFEST_PLATFORM_MANUFACTURER_ELEMENT_STRUCTURE_ID) {
+ if (StructureId == BOOT_POLICY_MANIFEST_PLATFORM_MANUFACTURER_ELEMENT_STRUCTURE_ID) {
+ return Buffer;
+ }
+ Buffer += sizeof(PLATFORM_MANUFACTURER_ELEMENT) + PmElement->PmDataSize;
+ PmElement = (PLATFORM_MANUFACTURER_ELEMENT *)Buffer;
+ }
+
+ BpmSignatureElement = (BOOT_POLICY_MANIFEST_SIGNATURE_ELEMENT *)Buffer;
+ if (*(UINT64 *)BpmSignatureElement->StructureId != BOOT_POLICY_MANIFEST_SIGNATURE_ELEMENT_STRUCTURE_ID) {
+ return NULL;
+ }
+ if (StructureId == BOOT_POLICY_MANIFEST_SIGNATURE_ELEMENT_STRUCTURE_ID) {
+ return Buffer;
+ }
+ return NULL;
+}
+
+/**
+ Find BPM IBB element
+
+ @param[in] Bpm A pointer to BPM data structure.
+
+ @return A pointer to BPM IBB element data structure.
+**/
+VOID *
+FindBpmIbb (
+ IN BOOT_POLICY_MANIFEST_HEADER *Bpm
+ )
+{
+ return FindBpmElement (Bpm, BOOT_POLICY_MANIFEST_IBB_ELEMENT_STRUCTURE_ID);
+}
+
+/**
+ Find BPM Signature element
+
+ @param[in] Bpm BPM address
+
+ @return BPM Signature element
+**/
+VOID *
+FindBpmSignature (
+ IN BOOT_POLICY_MANIFEST_HEADER *Bpm
+ )
+{
+ return FindBpmElement (Bpm, BOOT_POLICY_MANIFEST_SIGNATURE_ELEMENT_STRUCTURE_ID);
+}
+
+/**
+ Check if ACM is a NPW ACM.
+
+ @retval TRUE It is a NPW ACM
+ @retval FALSE It is NOT a NPW ACM
+**/
+BOOLEAN
+IsNpwAcm (
+ VOID
+ )
+{
+ ACM_FORMAT *Acm;
+
+ Acm = FindAcm ();
+ ASSERT (Acm != NULL);
+ if (Acm == NULL) {
+ return FALSE;
+ }
+
+ if (((Acm->Flags & ACM_HEADER_FLAG_DEBUG_SIGNED) == 0) && (Acm->AcmSvn < ACM_NPW_SVN)) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+}
+
+/**
+ Check if Boot Guard verifies the IBB.
+
+ @retval TRUE It is VerifiedBoot
+ @retval FALSE It is NOT VerifiedBoot
+**/
+BOOLEAN
+IsVerifiedBoot (
+ VOID
+ )
+{
+ if ((AsmReadMsr64 (MSR_BOOT_GUARD_SACM_INFO) & B_VERIFIED) != 0) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+}
+
+/**
+ Check if Boot Guard measures IBB into TPM's PCRs.
+
+ @retval TRUE It is MeasuredBoot
+ @retval FALSE It is NOT MeasuredBoot
+**/
+BOOLEAN
+IsMeasuredBoot (
+ VOID
+ )
+{
+ if ((AsmReadMsr64 (MSR_BOOT_GUARD_SACM_INFO) & B_MEASURED) != 0) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+}
+
+/**
+ Get the lower 8 bits of Boot Policy Restrictions
+
+ @return The lower 8 bits of BP.RSTR
+**/
+UINT8
+GetBpRstrLow (
+ VOID
+ )
+{
+ BP_RSTR_LOW BpRstr;
+ UINT32 AcmStatus;
+ UINT64 SacmInfo;
+
+ AcmStatus = MmioRead32 (MMIO_ACM_STATUS);
+ SacmInfo = AsmReadMsr64 (MSR_BOOT_GUARD_SACM_INFO);
+
+ BpRstr.Bits.Facb = (UINT8)((SacmInfo & BIT4) >> 4);
+ BpRstr.Bits.Dcd = (UINT8)((AcmStatus & BIT21) >> 21);
+ BpRstr.Bits.Dbi = (UINT8)((AcmStatus & BIT22) >> 22);
+ BpRstr.Bits.Pbe = (UINT8)((AcmStatus & BIT23) >> 23);
+ BpRstr.Bits.Bbp = (UINT8)((AcmStatus & BIT24) >> 24);
+ BpRstr.Bits.Reserved = 0;
+ BpRstr.Bits.BpInvd = 0;
+
+ return BpRstr.Data;
+}
+
+/**
+ Get the lower 8 bits of Boot Policy Type
+
+ @return The lower 8 bits of BP.TYPE
+**/
+UINT8
+GetBpTypeLow (
+ VOID
+ )
+{
+ BP_TYPE_LOW BpType;
+ UINT32 AcmStatus;
+ UINT64 SacmInfo;
+
+ AcmStatus = MmioRead32 (MMIO_ACM_STATUS);
+ SacmInfo = AsmReadMsr64 (MSR_BOOT_GUARD_SACM_INFO);
+
+ BpType.Bits.MeasuredBoot = (UINT8)((SacmInfo & BIT5) >> 5);
+ BpType.Bits.VerifiedBoot = (UINT8)((SacmInfo & BIT6) >> 6);
+ BpType.Bits.Hap = (UINT8)((AcmStatus & BIT20) >> 20);
+ BpType.Bits.Reserved = 0;
+
+ return BpType.Data;
+}
+
+/**
+ Calculate IBB Hash
+
+ @param[in] BpmIbb A pointer to BPM IBB element data structure.
+ @param[out] Digest IBB digest value.
+**/
+VOID
+CreateIbbHash (
+ IN IBB_ELEMENT *BpmIbb,
+ OUT UINT8 *Digest
+ )
+{
+ VOID *Context;
+ UINTN Index;
+
+ SHA_INIT (Context);
+
+ for (Index = 0; Index < BpmIbb->SegmentCount; Index++) {
+ if (BpmIbb->IbbSegment[Index].Flags == IBB_SEGMENT_FLAG_IBB) {
+ SHA_UPDATE (Context, (VOID *)(UINTN)BpmIbb->IbbSegment[Index].Base, BpmIbb->IbbSegment[Index].Size);
+ }
+ }
+
+ SHA_FINAL (Context, Digest);
+
+ return;
+}
+
+/**
+ Calculate DetailPCR extend value
+
+ @param[out] Digest DetailPCR digest
+**/
+VOID
+CaculateDetailPCRExtendValue (
+ OUT TCG_DIGEST *Digest
+ )
+{
+ ACM_FORMAT *Acm;
+ KEY_MANIFEST_STRAUCTURE *Km;
+ BOOT_POLICY_MANIFEST_HEADER *Bpm;
+ IBB_ELEMENT *BpmIbb;
+ BOOT_POLICY_MANIFEST_SIGNATURE_ELEMENT *BpmSignature;
+ DETAIL_PCR_DATA DetailPcrData;
+
+ Acm = FindAcm ();
+ ASSERT (Acm != NULL);
+
+ Km = FindKm ();
+ ASSERT (Km != NULL);
+
+ Bpm = FindBpm ();
+ ASSERT (Bpm != NULL);
+
+ BpmIbb = FindBpmIbb (Bpm);
+ ASSERT (BpmIbb != NULL);
+
+ BpmSignature = FindBpmSignature (Bpm);
+ ASSERT (BpmSignature != NULL);
+
+ DetailPcrData.BpRstrLow = GetBpRstrLow ();
+ DetailPcrData.BpTypeLow = GetBpTypeLow ();
+ DetailPcrData.AcmSvn = Acm->AcmSvn;
+ CopyMem (&DetailPcrData.AcmRsaSignature, &Acm->RsaSig, sizeof(DetailPcrData.AcmRsaSignature));
+ CopyMem (&DetailPcrData.KmRsaSignature, &Km->KeyManifestSignature.Signature.Signature, sizeof(DetailPcrData.KmRsaSignature));
+ CopyMem (&DetailPcrData.BpmRsaSignature, &BpmSignature->KeySignature.Signature.Signature, sizeof(DetailPcrData.BpmRsaSignature));
+ if (IsVerifiedBoot ()) {
+ CopyMem (&DetailPcrData.IbbHash, &BpmIbb->Digest.HashBuffer, sizeof(DetailPcrData.IbbHash));
+ } else {
+ //
+ // Calculate IBB hash because it is NOT verified boot, the Digest from IBB can not be trust.
+ //
+ CreateIbbHash (BpmIbb, (UINT8 *)&DetailPcrData.IbbHash);
+ }
+
+ CreateSha1Hash ((UINT8 *)&DetailPcrData, sizeof(DetailPcrData), (UINT8 *)Digest);
+}
+
+/**
+ Calculate AuthorityPCR extend value
+
+ @param[out] Digest AuthorityPCR digest
+**/
+VOID
+CaculateAuthorityPCRExtendValue (
+ OUT TCG_DIGEST *Digest
+ )
+{
+ ACM_FORMAT *Acm;
+ KEY_MANIFEST_STRAUCTURE *Km;
+ AUTHORITY_PCR_DATA AuthorityPcrData;
+
+ Acm = FindAcm ();
+ ASSERT (Acm != NULL);
+
+ Km = FindKm ();
+ ASSERT (Km != NULL);
+
+ AuthorityPcrData.BpRstrLow = GetBpRstrLow ();
+ AuthorityPcrData.BpTypeLow = GetBpTypeLow ();
+ AuthorityPcrData.AcmSvn = Acm->AcmSvn;
+
+ //
+ // Get ACM Key hash
+ //
+ *(UINT64 *)&AuthorityPcrData.AcmKeyHash[0] = MmioRead64 (ACM_KEY_HASH_MMIO_ADDR_0);
+ *(UINT64 *)&AuthorityPcrData.AcmKeyHash[8] = MmioRead64 (ACM_KEY_HASH_MMIO_ADDR_1);
+ *(UINT64 *)&AuthorityPcrData.AcmKeyHash[16] = MmioRead64 (ACM_KEY_HASH_MMIO_ADDR_2);
+ *(UINT64 *)&AuthorityPcrData.AcmKeyHash[24] = MmioRead64 (ACM_KEY_HASH_MMIO_ADDR_3);
+
+ //
+ // Calculate BP Key hash
+ //
+ CreateSha256Hash ((UINT8 *)&Km->KeyManifestSignature.Key.Modulus, sizeof(Km->KeyManifestSignature.Key.Modulus), (UINT8 *)&AuthorityPcrData.BpKeyHash);
+
+ CopyMem (&AuthorityPcrData.BpmKeyHashFromKm, &Km->BpKey.HashBuffer, sizeof(AuthorityPcrData.BpmKeyHashFromKm));
+ if (IsVerifiedBoot ()) {
+ AuthorityPcrData.VerifiedBoot = 0;
+ } else {
+ AuthorityPcrData.VerifiedBoot = 1;
+ }
+
+ CreateSha1Hash ((UINT8 *)&AuthorityPcrData, sizeof(AuthorityPcrData), (UINT8 *)Digest);
+}
+
+/**
+ Check if we need AuthorityPCR measurement
+
+ @retval TRUE Need AuthorityPCR measurement
+ @retval FALSE Do NOT need AuthorityPCR measurement
+**/
+BOOLEAN
+NeedAuthorityMeasure (
+ VOID
+ )
+{
+ BOOT_POLICY_MANIFEST_HEADER *Bpm;
+ IBB_ELEMENT *BpmIbb;
+
+ Bpm = FindBpm ();
+ ASSERT (Bpm != NULL);
+
+ BpmIbb = FindBpmIbb (Bpm);
+ ASSERT (BpmIbb != NULL);
+
+ if ((BpmIbb->Flags & IBB_FLAG_AUTHORITY_MEASURE) != 0) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+}
+
+/**
+ Create DetailPCR event log
+
+ @param[in] TpmType TPM type
+**/
+VOID
+CreateDetailPcrEvent (
+ IN TPM_TYPE TpmType
+ )
+{
+ TCG_PCR_EVENT_HDR NewEventHdr;
+
+ NewEventHdr.PCRIndex = 0;
+ NewEventHdr.EventType = EV_S_CRTM_CONTENTS;
+ CaculateDetailPCRExtendValue (&NewEventHdr.Digest);
+
+ if (IsNpwAcm()) {
+ NewEventHdr.EventSize = sizeof ("Boot Guard Debug Measured S-CRTM");
+ LogEvent (&NewEventHdr, "Boot Guard Debug Measured S-CRTM");
+ } else {
+ NewEventHdr.EventSize = sizeof ("Boot Guard Measured S-CRTM");
+ LogEvent (&NewEventHdr, "Boot Guard Measured S-CRTM");
+ }
+}
+
+/**
+ Create AuthorityPCR event log
+
+ @param[in] TpmType TPM type
+**/
+VOID
+CreateAuthorityPcrEvent (
+ IN TPM_TYPE TpmType
+ )
+{
+ TCG_PCR_EVENT_HDR NewEventHdr;
+
+ if (NeedAuthorityMeasure() && IsVerifiedBoot()) {
+ if (TpmType == dTpm12) {
+ NewEventHdr.PCRIndex = 6;
+ } else {
+ NewEventHdr.PCRIndex = 7;
+ }
+ NewEventHdr.EventType = EV_EFI_VARIABLE_DRIVER_CONFIG;
+ CaculateAuthorityPCRExtendValue (&NewEventHdr.Digest);
+
+ if (IsNpwAcm()) {
+ NewEventHdr.EventSize = sizeof (L"Boot Guard Debug Measured S-CRTM");
+ LogEvent (&NewEventHdr, (UINT8 *)L"Boot Guard Debug Measured S-CRTM");
+ } else {
+ NewEventHdr.EventSize = sizeof (L"Boot Guard Measured S-CRTM");
+ LogEvent (&NewEventHdr, (UINT8 *)L"Boot Guard Measured S-CRTM");
+ }
+ }
+}
+
+/**
+ Create Boot Guard TPM event log
+
+ @param[in] TpmType Which type of TPM is available on system.
+**/
+VOID
+CreateTpmEventLog (
+ IN TPM_TYPE TpmType
+ )
+{
+ if (IsMeasuredBoot()) {
+ CreateDetailPcrEvent (TpmType);
+ CreateAuthorityPcrEvent (TpmType);
+ }
+}
diff --git a/ReferenceCode/Haswell/SampleCode/Library/BootGuardTpmEventLogLib/BootGuardTpmEventLogLib.cif b/ReferenceCode/Haswell/SampleCode/Library/BootGuardTpmEventLogLib/BootGuardTpmEventLogLib.cif
new file mode 100644
index 0000000..06d608a
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Library/BootGuardTpmEventLogLib/BootGuardTpmEventLogLib.cif
@@ -0,0 +1,11 @@
+<component>
+ name = "BootGuardTpmEventLogLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Haswell\SampleCode\Library\BootGuardTpmEventLogLib"
+ RefName = "BootGuardTpmEventLogLib"
+[files]
+"BootGuardTpmEventLogLib.sdl"
+"BootGuardTpmEventLogLib.mak"
+"BootGuardTpmEventLogLib.c"
+"BootGuardTpmEventLogLib.h"
+<endComponent>
diff --git a/ReferenceCode/Haswell/SampleCode/Library/BootGuardTpmEventLogLib/BootGuardTpmEventLogLib.h b/ReferenceCode/Haswell/SampleCode/Library/BootGuardTpmEventLogLib/BootGuardTpmEventLogLib.h
new file mode 100644
index 0000000..ca91990
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Library/BootGuardTpmEventLogLib/BootGuardTpmEventLogLib.h
@@ -0,0 +1,33 @@
+/** @file
+ Header file for Boot Guard TPM event log.
+
+@copyright
+ Copyright (c) 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _BOOT_GUARD_TPM_EVENT_LOG_LIB_H_
+#define _BOOT_GUARD_TPM_EVENT_LOG_LIB_H_
+
+#include EFI_PPI_DEFINITION (CpuPlatformPolicy)
+
+/**
+ Create Boot Guard TPM event log
+
+ @param[in] TpmType - Which type of TPM is available on system.
+**/
+VOID
+CreateTpmEventLog (
+ IN TPM_TYPE TpmType
+ );
+
+#endif
diff --git a/ReferenceCode/Haswell/SampleCode/Library/BootGuardTpmEventLogLib/BootGuardTpmEventLogLib.mak b/ReferenceCode/Haswell/SampleCode/Library/BootGuardTpmEventLogLib/BootGuardTpmEventLogLib.mak
new file mode 100644
index 0000000..47a3d87
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Library/BootGuardTpmEventLogLib/BootGuardTpmEventLogLib.mak
@@ -0,0 +1,31 @@
+# MAK file for the ModulePart:AslUpdateLib
+all : BootGuardTpmEventLogLib
+
+$(BUILD_DIR)\BootGuardTpmEventLogLib.lib : BootGuardTpmEventLogLib
+
+BootGuardTpmEventLogLib : $(BUILD_DIR)\BootGuardTpmEventLogLib.mak BootGuardTpmEventLogLibBin
+
+$(BUILD_DIR)\BootGuardTpmEventLogLib.mak : $(BootGuardTpmEventLogLib_DIR)\$(@B).cif $(BootGuardTpmEventLogLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(BootGuardTpmEventLogLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+BootGuardTpmEventLogLib_INCLUDES=\
+ $(PROJECT_CPU_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(iAMT_INCLUDES)\
+ $(IndustryStandard_INCLUDES)
+
+BootGuardTpmEventLogLib_DEFINES=\
+ $(MY_DEFINES)\
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__\
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__\
+
+BootGuardTpmEventLogLib_LIBS=\
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+
+BootGuardTpmEventLogLibBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\BootGuardTpmEventLogLib.mak all \
+ "MY_INCLUDES=$(BootGuardTpmEventLogLib_INCLUDES)"\
+ "MY_DEFINES=$(BootGuardTpmEventLogLib_DEFINES)"\
+ TYPE=LIBRARY\ \ No newline at end of file
diff --git a/ReferenceCode/Haswell/SampleCode/Library/BootGuardTpmEventLogLib/BootGuardTpmEventLogLib.sdl b/ReferenceCode/Haswell/SampleCode/Library/BootGuardTpmEventLogLib/BootGuardTpmEventLogLib.sdl
new file mode 100644
index 0000000..37c7417
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Library/BootGuardTpmEventLogLib/BootGuardTpmEventLogLib.sdl
@@ -0,0 +1,29 @@
+TOKEN
+ Name = BootGuardTpmEventLogLib_SUPPORT
+ Value = 1
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable BootGuardTpmEventLogLib support in Project"
+End
+
+MODULE
+ Help = "Includes BootGuardTpmEventLogLib.mak to Project"
+ File = "BootGuardTpmEventLogLib.mak"
+End
+
+PATH
+ Name = "BootGuardTpmEventLogLib_DIR"
+End
+
+ELINK
+ Name = "BootGuardTpmEventLogLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\BootGuardTpmEventLogLib.lib"
+ Parent = "BootGuardTpmEventLogLib_LIB"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/Haswell/SampleCode/Library/DTSHookLib/Smm/DTSHookLib.c b/ReferenceCode/Haswell/SampleCode/Library/DTSHookLib/Smm/DTSHookLib.c
new file mode 100644
index 0000000..05878cd
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Library/DTSHookLib/Smm/DTSHookLib.c
@@ -0,0 +1,71 @@
+/** @file
+ Digital Thermal Sensor (DTS) SMM Library.
+ This SMM Library configures and supports the DigitalThermalSensor features
+ for the platform.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#include "DTSHookLib.h"
+
+/**
+ Prepare data and protocol for Dts Hooe Lib
+
+ @retval EFI_SUCCESS - Initialize complete
+**/
+EFI_STATUS
+InitializeDtsHookLib (
+ VOID
+ )
+{
+ ///
+ /// Nothing to do on CRB.
+ ///
+ return EFI_SUCCESS;
+}
+
+/**
+ Platform may need to register some data to private data structure before generate
+ software SMI or SCI.
+**/
+VOID
+PlatformHookBeforeGenerateSCI (
+ VOID
+ )
+{
+ ///
+ /// Nothing to do on CRB.
+ ///
+}
+
+/**
+ When system temperature out of specification, do platform specific programming to prevent
+ system damage.
+**/
+VOID
+PlatformEventOutOfSpec (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+
+ ///
+ /// Handle critical event by shutting down via EC
+ ///
+ Status = InitializeKscLib ();
+ if (Status == EFI_SUCCESS) {
+ SendKscCommand (KSC_C_SYSTEM_POWER_OFF);
+ }
+}
diff --git a/ReferenceCode/Haswell/SampleCode/Library/DTSHookLib/Smm/DTSHookLib.cif b/ReferenceCode/Haswell/SampleCode/Library/DTSHookLib/Smm/DTSHookLib.cif
new file mode 100644
index 0000000..6eddca3
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Library/DTSHookLib/Smm/DTSHookLib.cif
@@ -0,0 +1,12 @@
+<component>
+ name = "DTSHookLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Haswell\SampleCode\Library\DTSHookLib\Smm\"
+ RefName = "DTSHookLib"
+[files]
+"DTSHookLib.sdl"
+"DTSHookLib.mak"
+"DTSHookLib.inf"
+"DTSHookLib.c"
+"DTSHookLib.h"
+<endComponent>
diff --git a/ReferenceCode/Haswell/SampleCode/Library/DTSHookLib/Smm/DTSHookLib.h b/ReferenceCode/Haswell/SampleCode/Library/DTSHookLib/Smm/DTSHookLib.h
new file mode 100644
index 0000000..7dfaa9b
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Library/DTSHookLib/Smm/DTSHookLib.h
@@ -0,0 +1,27 @@
+/** @file
+ Defines and prototypes for the DigitalThermalSensor SMM driver
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _DTS_LIB_H_
+#define _DTS_LIB_H_
+///
+/// Include files
+///
+#include "Tiano.h"
+#include "KscLib.h"
+
+#endif
diff --git a/ReferenceCode/Haswell/SampleCode/Library/DTSHookLib/Smm/DTSHookLib.inf b/ReferenceCode/Haswell/SampleCode/Library/DTSHookLib/Smm/DTSHookLib.inf
new file mode 100644
index 0000000..f4011cf
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Library/DTSHookLib/Smm/DTSHookLib.inf
@@ -0,0 +1,49 @@
+## @file
+# Component description file.
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+
+[defines]
+BASE_NAME = DTSHookLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ DTSHookLib.c
+ DTSHookLib.h
+
+[includes.common]
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EFI_SOURCE)/Framework
+ .
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EDK_SOURCE)/Foundation
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/SampleCode/Include
+
+[libraries.common]
+ EdkFrameworkProtocolLib
+
+[nmake.common]
+ C_STD_INCLUDE=
diff --git a/ReferenceCode/Haswell/SampleCode/Library/DTSHookLib/Smm/DTSHookLib.mak b/ReferenceCode/Haswell/SampleCode/Library/DTSHookLib/Smm/DTSHookLib.mak
new file mode 100644
index 0000000..9b10b29
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Library/DTSHookLib/Smm/DTSHookLib.mak
@@ -0,0 +1,15 @@
+# MAK file for the ModulePart:CpuPlatformLib
+
+$(DTSHookLib_LIB) : DTSHookLib
+
+DTSHookLib : $(BUILD_DIR)\DTSHookLib.mak DTSHookLibBin
+
+$(BUILD_DIR)\DTSHookLib.mak : $(DTSHookLib_DIR)\$(@B).cif $(DTSHookLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(DTSHookLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+DTSHookLibBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ BUILD_DIR=$(BUILD_DIR) \
+ /f $(BUILD_DIR)\DTSHookLib.mak all\
+ "MY_INCLUDES=$(EDK_INCLUDES) $(EdkIIGlueLib_INCLUDES) $(PROJECT_CPU_INCLUDES)" \
+ TYPE=LIBRARY "PARAMETERS=LIBRARY_NAME=$$(DTSHookLib_LIB)" \ No newline at end of file
diff --git a/ReferenceCode/Haswell/SampleCode/Library/DTSHookLib/Smm/DTSHookLib.sdl b/ReferenceCode/Haswell/SampleCode/Library/DTSHookLib/Smm/DTSHookLib.sdl
new file mode 100644
index 0000000..e49c48f
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Library/DTSHookLib/Smm/DTSHookLib.sdl
@@ -0,0 +1,25 @@
+TOKEN
+ Name = DTSHookLib_SUPPORT
+ Value = 1
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable DTSHookLib support in Project"
+End
+
+TOKEN
+ Name = "DTSHookLib_LIB"
+ Value = "$$(LIB_BUILD_DIR)\DTSHookLib.lib"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+MODULE
+ Help = "Includes DTSHookLib.mak to Project"
+ File = "DTSHookLib.mak"
+End
+
+PATH
+ Name = "DTSHookLib_DIR"
+End \ No newline at end of file
diff --git a/ReferenceCode/Haswell/SampleCode/Library/Ksc/Smm/SmmKscLib.c b/ReferenceCode/Haswell/SampleCode/Library/Ksc/Smm/SmmKscLib.c
new file mode 100644
index 0000000..079482f
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Library/Ksc/Smm/SmmKscLib.c
@@ -0,0 +1,228 @@
+/** @file
+ SMM KSC library implementation.
+
+ These functions need to be SMM safe.
+
+ These functions require the SMM IO library (SmmIoLib) to be present.
+ Caller must link those libraries and have the proper include path.
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#include "KscLib.h"
+#include "SmmIoLib.h"
+#include "PchAccess.h"
+#include "PchPlatformLib.h"
+
+BOOLEAN mSmmKscLibInitialized = FALSE;
+
+///
+/// Function implemenations
+///
+/**
+ Initialize the library.
+ The SMM library only requires SMM IO library and has no initialization.
+ However, this must be called prior to use of any other KSC library functions
+ for future compatibility.
+
+ @param[in] None.
+
+ @retval EFI_SUCCESS - KscLib is successfully initialized.
+**/
+EFI_STATUS
+InitializeKscLib (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+
+ ///
+ /// Fail if EC doesn't exist.
+ ///
+ if (SmmIoRead8 (KSC_C_PORT) == 0xff) {
+ mSmmKscLibInitialized = FALSE;
+ Status = EFI_DEVICE_ERROR;
+ } else {
+ mSmmKscLibInitialized = TRUE;
+ Status = EFI_SUCCESS;
+ }
+
+ return Status;
+}
+
+/**
+ Sends command to Keyboard System Controller.
+
+ @param[in] Command - Command byte to send
+
+ @retval EFI_SUCCESS - Command success
+ @retval EFI_DEVICE_ERROR - Command error
+**/
+EFI_STATUS
+SendKscCommand (
+ UINT8 Command
+ )
+{
+ UINTN Index;
+ UINT8 KscStatus;
+
+ KscStatus = 0;
+ ///
+ /// Verify if KscLib has been initialized, NOT if EC dose not exist.
+ ///
+ if (mSmmKscLibInitialized == FALSE) {
+ return EFI_DEVICE_ERROR;
+ }
+
+ Index = 0;
+
+ ///
+ /// Wait for KSC to be ready (with a timeout)
+ ///
+ ReceiveKscStatus (&KscStatus);
+ while (((KscStatus & KSC_S_IBF) != 0) && (Index < KSC_TIME_OUT)) {
+ PchPmTimerStall(15);
+ ReceiveKscStatus (&KscStatus);
+ Index++;
+ }
+
+ if (Index >= KSC_TIME_OUT) {
+ return EFI_DEVICE_ERROR;
+ }
+ ///
+ /// Send the KSC command
+ ///
+ SmmIoWrite8 (KSC_C_PORT, Command);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Receives status from Keyboard System Controller.
+
+ @param[in] KscStatus - Status byte to receive
+
+ @retval EFI_DEVICE_ERROR - Ksc library has not initialized yet or KSC not present
+ @retval EFI_SUCCESS - Get KSC status successfully
+**/
+EFI_STATUS
+ReceiveKscStatus (
+ UINT8 *KscStatus
+ )
+{
+ ///
+ /// Verify if KscLib has been initialized, NOT if EC dose not exist.
+ ///
+ if (mSmmKscLibInitialized == FALSE) {
+ return EFI_DEVICE_ERROR;
+ }
+ ///
+ /// Read and return the status
+ ///
+ *KscStatus = SmmIoRead8 (KSC_C_PORT);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Sends data to Keyboard System Controller.
+
+ @param[in] Data - Data byte to send
+
+ @retval EFI_SUCCESS - Success
+ @retval EFI_DEVICE_ERROR - Error
+**/
+EFI_STATUS
+SendKscData (
+ UINT8 Data
+ )
+{
+ UINTN Index;
+ UINT8 KscStatus;
+
+ ///
+ /// Verify if KscLib has been initialized, NOT if EC dose not exist.
+ ///
+ if (mSmmKscLibInitialized == FALSE) {
+ return EFI_DEVICE_ERROR;
+ }
+
+ Index = 0;
+
+ ///
+ /// Wait for KSC to be ready (with a timeout)
+ ///
+ ReceiveKscStatus (&KscStatus);
+ while (((KscStatus & KSC_S_IBF) != 0) && (Index < KSC_TIME_OUT)) {
+ PchPmTimerStall(15);
+ ReceiveKscStatus (&KscStatus);
+ Index++;
+ }
+
+ if (Index >= KSC_TIME_OUT) {
+ return EFI_DEVICE_ERROR;
+ }
+ ///
+ /// Send the data and return
+ ///
+ SmmIoWrite8 (KSC_D_PORT, Data);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Receives data from Keyboard System Controller.
+
+ @param[in] Data - Data byte received
+
+ @retval EFI_SUCCESS - Read success
+ @retval EFI_DEVICE_ERROR - Read error
+**/
+EFI_STATUS
+ReceiveKscData (
+ UINT8 *Data
+ )
+{
+ UINTN Index;
+ UINT8 KscStatus;
+
+ ///
+ /// Verify if KscLib has been initialized, NOT if EC dose not exist.
+ ///
+ if (mSmmKscLibInitialized == FALSE) {
+ return EFI_DEVICE_ERROR;
+ }
+
+ Index = 0;
+
+ ///
+ /// Wait for KSC to be ready (with a timeout)
+ ///
+ ReceiveKscStatus (&KscStatus);
+ while (((KscStatus & KSC_S_OBF) == 0) && (Index < KSC_TIME_OUT)) {
+ PchPmTimerStall(15);
+ ReceiveKscStatus (&KscStatus);
+ Index++;
+ }
+
+ if (Index >= KSC_TIME_OUT) {
+ return EFI_DEVICE_ERROR;
+ }
+ ///
+ /// Read KSC data and return
+ ///
+ *Data = SmmIoRead8 (KSC_D_PORT);
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/Haswell/SampleCode/Library/Ksc/Smm/SmmKscLib.cif b/ReferenceCode/Haswell/SampleCode/Library/Ksc/Smm/SmmKscLib.cif
new file mode 100644
index 0000000..3ee7072
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Library/Ksc/Smm/SmmKscLib.cif
@@ -0,0 +1,11 @@
+<component>
+ name = "SmmKscLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Haswell\SampleCode\Library\Ksc\Smm"
+ RefName = "SmmKscLib"
+[files]
+"SmmKscLib.sdl"
+"SmmKscLib.mak"
+"SmmKscLib.c"
+"SmmKscLib.inf"
+<endComponent>
diff --git a/ReferenceCode/Haswell/SampleCode/Library/Ksc/Smm/SmmKscLib.inf b/ReferenceCode/Haswell/SampleCode/Library/Ksc/Smm/SmmKscLib.inf
new file mode 100644
index 0000000..478ca1a
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Library/Ksc/Smm/SmmKscLib.inf
@@ -0,0 +1,51 @@
+## @file
+# Component description file.
+#
+#@copyright
+# Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+
+[defines]
+BASE_NAME = SmmKscLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ SmmKscLib.c
+
+[includes.common]
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EFI_SOURCE)/Framework
+ .
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EDK_SOURCE)/Foundation
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/SampleCode/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+
+[libraries.common]
+ EdkFrameworkProtocolLib
+ PchPlatformLib
+
+[nmake.common]
+ C_STD_INCLUDE=
diff --git a/ReferenceCode/Haswell/SampleCode/Library/Ksc/Smm/SmmKscLib.mak b/ReferenceCode/Haswell/SampleCode/Library/Ksc/Smm/SmmKscLib.mak
new file mode 100644
index 0000000..ee3a5b0
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Library/Ksc/Smm/SmmKscLib.mak
@@ -0,0 +1,15 @@
+# MAK file for the ModulePart:CpuPlatformLib
+
+$(SmmKscLib_LIB) : SmmKscLib
+
+SmmKscLib : $(BUILD_DIR)\SmmKscLib.mak SmmKscLibBin
+
+$(BUILD_DIR)\SmmKscLib.mak : $(SmmKscLib_DIR)\$(@B).cif $(SmmKscLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(SmmKscLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+SmmKscLibBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ BUILD_DIR=$(BUILD_DIR) \
+ /f $(BUILD_DIR)\SmmKscLib.mak all\
+ "MY_INCLUDES=$(EDK_INCLUDES) $(EdkIIGlueLib_INCLUDES) $(PROJECT_CPU_INCLUDES)" \
+ TYPE=LIBRARY "PARAMETERS=LIBRARY_NAME=$$(SmmKscLib_LIB)" \ No newline at end of file
diff --git a/ReferenceCode/Haswell/SampleCode/Library/Ksc/Smm/SmmKscLib.sdl b/ReferenceCode/Haswell/SampleCode/Library/Ksc/Smm/SmmKscLib.sdl
new file mode 100644
index 0000000..46ce94f
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Library/Ksc/Smm/SmmKscLib.sdl
@@ -0,0 +1,25 @@
+TOKEN
+ Name = SmmKscLib_SUPPORT
+ Value = 1
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable SmmKscLib support in Project"
+End
+
+TOKEN
+ Name = "SmmKscLib_LIB"
+ Value = "$$(LIB_BUILD_DIR)\SmmKscLib.lib"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+MODULE
+ Help = "Includes SmmKscLib.mak to Project"
+ File = "SmmKscLib.mak"
+End
+
+PATH
+ Name = "SmmKscLib_DIR"
+End \ No newline at end of file
diff --git a/ReferenceCode/Haswell/SampleCode/Library/SmmIo/SmmIo.c b/ReferenceCode/Haswell/SampleCode/Library/SmmIo/SmmIo.c
new file mode 100644
index 0000000..9f1e19d
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Library/SmmIo/SmmIo.c
@@ -0,0 +1,169 @@
+/** @file
+ SMM I/O access utility implementation file, for Ia32
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+///
+/// Include files
+///
+#include "SmmIoLib.h"
+
+/**
+ Do a one byte IO read
+
+ @param[in] Address - IO address to read
+
+ @retval Data read
+**/
+UINT8
+SmmIoRead8 (
+ IN UINT16 Address
+ )
+{
+ UINT8 Buffer;
+
+ ASSERT (mSmst);
+
+ mSmst->SmmIo.Io.Read (
+ &mSmst->SmmIo,
+ SMM_IO_UINT8,
+ Address,
+ 1,
+ &Buffer
+ );
+ return Buffer;
+}
+
+/**
+ Do a one byte IO write
+
+ @param[in] Address - IO address to write
+ @param[in] Data - Data to write
+**/
+VOID
+SmmIoWrite8 (
+ IN UINT16 Address,
+ IN UINT8 Data
+ )
+{
+ ASSERT (mSmst);
+
+ mSmst->SmmIo.Io.Write (
+ &mSmst->SmmIo,
+ SMM_IO_UINT8,
+ Address,
+ 1,
+ &Data
+ );
+}
+
+/**
+ Do a two byte IO read
+
+ @param[in] Address - IO address to read
+
+ @retval Data read
+**/
+UINT16
+SmmIoRead16 (
+ IN UINT16 Address
+ )
+{
+ UINT16 Buffer;
+
+ ASSERT (mSmst);
+
+ mSmst->SmmIo.Io.Read (
+ &mSmst->SmmIo,
+ SMM_IO_UINT16,
+ Address,
+ 1,
+ &Buffer
+ );
+ return Buffer;
+}
+
+/**
+ Do a two byte IO write
+
+ @param[in] Address - IO address to write
+ @param[in] Data - Data to write
+**/
+VOID
+SmmIoWrite16 (
+ IN UINT16 Address,
+ IN UINT16 Data
+ )
+{
+ ASSERT (mSmst);
+
+ mSmst->SmmIo.Io.Write (
+ &mSmst->SmmIo,
+ SMM_IO_UINT16,
+ Address,
+ 1,
+ &Data
+ );
+}
+
+/**
+ Do a four byte IO read
+
+ @param[in] Address - IO address to read
+
+ @retval Data read
+**/
+UINT32
+SmmIoRead32 (
+ IN UINT16 Address
+ )
+{
+ UINT32 Buffer;
+
+ ASSERT (mSmst);
+
+ mSmst->SmmIo.Io.Read (
+ &mSmst->SmmIo,
+ SMM_IO_UINT32,
+ Address,
+ 1,
+ &Buffer
+ );
+ return Buffer;
+}
+
+/**
+ Do a four byte IO write
+
+ @param[in] Address - IO address to write
+ @param[in] Data - Data to write
+**/
+VOID
+SmmIoWrite32 (
+ IN UINT16 Address,
+ IN UINT32 Data
+ )
+{
+ ASSERT (mSmst);
+
+ mSmst->SmmIo.Io.Write (
+ &mSmst->SmmIo,
+ SMM_IO_UINT32,
+ Address,
+ 1,
+ &Data
+ );
+}
diff --git a/ReferenceCode/Haswell/SampleCode/Library/SmmIo/SmmIoLib.cif b/ReferenceCode/Haswell/SampleCode/Library/SmmIo/SmmIoLib.cif
new file mode 100644
index 0000000..ec8cae7
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Library/SmmIo/SmmIoLib.cif
@@ -0,0 +1,12 @@
+<component>
+ name = "SmmIoLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Haswell\SampleCode\Library\SmmIo"
+ RefName = "SmmIoLib"
+[files]
+"SmmIoLib.sdl"
+"SmmIoLib.mak"
+"SmmIoLib.inf"
+"SmmIo.c"
+"SmmPciIo.c"
+<endComponent>
diff --git a/ReferenceCode/Haswell/SampleCode/Library/SmmIo/SmmIoLib.inf b/ReferenceCode/Haswell/SampleCode/Library/SmmIo/SmmIoLib.inf
new file mode 100644
index 0000000..43045eb
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Library/SmmIo/SmmIoLib.inf
@@ -0,0 +1,48 @@
+## @file
+# Component description file.
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+
+[defines]
+BASE_NAME = SmmIoLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ SmmIo.c
+ SmmPciIo.c
+
+[includes.common]
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EFI_SOURCE)/Framework
+ .
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EDK_SOURCE)/Foundation
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/SampleCode/Include
+
+[libraries.common]
+ EdkFrameworkProtocolLib
+
+[nmake.common]
diff --git a/ReferenceCode/Haswell/SampleCode/Library/SmmIo/SmmIoLib.mak b/ReferenceCode/Haswell/SampleCode/Library/SmmIo/SmmIoLib.mak
new file mode 100644
index 0000000..12b9d5e
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Library/SmmIo/SmmIoLib.mak
@@ -0,0 +1,15 @@
+# MAK file for the ModulePart:CpuPlatformLib
+
+$(SmmIoLib_LIB) : SmmIoLib
+
+SmmIoLib : $(BUILD_DIR)\SmmIoLib.mak SmmIoLibBin
+
+$(BUILD_DIR)\SmmIoLib.mak : $(SmmIoLib_DIR)\$(@B).cif $(SmmIoLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(SmmIoLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+SmmIoLibBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ BUILD_DIR=$(BUILD_DIR) \
+ /f $(BUILD_DIR)\SmmIoLib.mak all\
+ "MY_INCLUDES=$(EDK_INCLUDES) $(EdkIIGlueLib_INCLUDES) $(PROJECT_CPU_INCLUDES)" \
+ TYPE=LIBRARY "PARAMETERS=LIBRARY_NAME=$$(SmmIoLib_LIB)" \ No newline at end of file
diff --git a/ReferenceCode/Haswell/SampleCode/Library/SmmIo/SmmIoLib.sdl b/ReferenceCode/Haswell/SampleCode/Library/SmmIo/SmmIoLib.sdl
new file mode 100644
index 0000000..537a750
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Library/SmmIo/SmmIoLib.sdl
@@ -0,0 +1,25 @@
+TOKEN
+ Name = SmmIoLib_SUPPORT
+ Value = 1
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable SmmIoLib support in Project"
+End
+
+TOKEN
+ Name = "SmmIoLib_LIB"
+ Value = "$$(LIB_BUILD_DIR)\SmmIoLib.lib"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+MODULE
+ Help = "Includes SmmIoLib.mak to Project"
+ File = "SmmIoLib.mak"
+End
+
+PATH
+ Name = "SmmIoLib_DIR"
+End \ No newline at end of file
diff --git a/ReferenceCode/Haswell/SampleCode/Library/SmmIo/SmmPciIo.c b/ReferenceCode/Haswell/SampleCode/Library/SmmIo/SmmPciIo.c
new file mode 100644
index 0000000..f6fd18f
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Library/SmmIo/SmmPciIo.c
@@ -0,0 +1,161 @@
+/** @file
+ SMM PCI config space I/O access utility implementation file, for Ia32
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#include "SmmIoLib.h"
+
+STATIC
+EFI_STATUS
+SmmSingleSegmentPciAccess (
+ IN EFI_SMM_CPU_IO_INTERFACE *CpuIo,
+ IN BOOLEAN IsWrite,
+ IN SMM_PCI_IO_WIDTH Width,
+ IN SMM_PCI_IO_ADDRESS *Address,
+ IN OUT VOID *Buffer
+ );
+
+/**
+ Read value from the specified PCI config space register
+
+ @param[in] Width - The width (8, 16 or 32 bits) of accessed pci config space register
+ @param[in] Address - The address of the accessed pci register (bus, dev, func, offset)
+ @param[in] Buffer - The returned value
+
+ @retval EFI_SUCCESS - All operations successfully
+ @retval EFI_INVALID_PARAMETER - Width is not valid or dosn't match register address
+ @retval Other error code - If any error occured when calling libiary functions
+**/
+EFI_STATUS
+SmmPciCfgRead (
+ IN SMM_PCI_IO_WIDTH Width,
+ IN SMM_PCI_IO_ADDRESS *Address,
+ IN OUT VOID *Buffer
+ )
+{
+ EFI_SMM_CPU_IO_INTERFACE *SmmCpuIo;
+
+ ASSERT (mSmst);
+
+ SmmCpuIo = &(mSmst->SmmIo);
+
+ return SmmSingleSegmentPciAccess (SmmCpuIo, FALSE, Width, Address, Buffer);
+}
+
+/**
+ Write value into the specified PCI config space register
+
+ @param[in] Width - The width (8, 16 or 32 bits) of accessed pci config space register
+ @param[in] Address - The address of the accessed pci register (bus, dev, func, offset)
+ @param[in] Buffer - The returned value
+
+ @retval EFI_SUCCESS - All operations successfully
+ @retval EFI_INVALID_PARAMETER - Width is not valid or dosn't match register address
+ @retval Other error code - If any error occured when calling libiary functions
+**/
+EFI_STATUS
+SmmPciCfgWrite (
+ IN SMM_PCI_IO_WIDTH Width,
+ IN SMM_PCI_IO_ADDRESS *Address,
+ IN OUT VOID *Buffer
+ )
+{
+ EFI_SMM_CPU_IO_INTERFACE *SmmCpuIo;
+
+ ASSERT (mSmst);
+
+ SmmCpuIo = &(mSmst->SmmIo);
+
+ return SmmSingleSegmentPciAccess (SmmCpuIo, TRUE, Width, Address, Buffer);
+}
+
+/**
+ Access a PCI config space address, including read and write
+
+ @param[in] CpuIo - The cpu I/O accessing interface provided by EFI runtime sys table
+ @param[in] IsWrite - Indicates whether this operation is a write access or read
+ @param[in] Width - The width (8, 16 or 32 bits) of accessed pci config space register
+ @param[in] Address - The address of the accessed pci register (bus, dev, func, offset)
+ @param[in] Buffer - The returned value when this is a reading operation or the data
+ to be written when this is a writing one
+
+ @retval EFI_SUCCESS - All operations successfully
+ @retval EFI_INVALID_PARAMETER - Width is not valid or dosn't match register address
+ @retval Other error code - If any error occured when calling libiary functions
+**/
+STATIC
+EFI_STATUS
+SmmSingleSegmentPciAccess (
+ IN EFI_SMM_CPU_IO_INTERFACE *CpuIo,
+ IN BOOLEAN IsWrite,
+ IN SMM_PCI_IO_WIDTH Width,
+ IN SMM_PCI_IO_ADDRESS *Address,
+ IN OUT VOID *Buffer
+ )
+{
+ EFI_STATUS Status;
+ PCI_CONFIG_ACCESS_CF8 PciCf8Data;
+ UINT64 PciDataReg;
+
+ ///
+ /// PCI Config access are all 32-bit alligned, but by accessing the
+ /// CONFIG_DATA_REGISTER (0xcfc) with different widths more cycle types
+ /// are possible on PCI.
+ ///
+ /// To read a byte of PCI config space you load 0xcf8 and
+ /// read 0xcfc, 0xcfd, 0xcfe, 0xcff
+ ///
+ /// The validation of passed in arguments "Address" will be checked in the
+ /// CPU IO functions, so we don't check them here
+ ///
+ if (Width >= SmmPciWidthMaximum) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ PciCf8Data.Reg = Address->Register & 0xfc;
+ PciCf8Data.Func = Address->Function;
+ PciCf8Data.Dev = Address->Device;
+ PciCf8Data.Bus = Address->Bus;
+ PciCf8Data.Reserved = 0;
+ PciCf8Data.Enable = 1;
+
+ Status = CpuIo->Io.Write (CpuIo, SmmPciWidthUint32, 0xcf8, 1, &PciCf8Data);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ PciDataReg = 0xcfc + (Address->Register & 0x03);
+
+ if (IsWrite) {
+ ///
+ /// This is a Pci write operation, write data into (0xcfc + offset)
+ ///
+ Status = CpuIo->Io.Write (CpuIo, Width, PciDataReg, 1, Buffer);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ } else {
+ ///
+ /// This is a Pci Read operation, read returned data from (0xcfc + offset)
+ ///
+ Status = CpuIo->Io.Read (CpuIo, Width, PciDataReg, 1, Buffer);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/Haswell/SampleCode/Protocol/CpuSampleCodeProtocolLib.cif b/ReferenceCode/Haswell/SampleCode/Protocol/CpuSampleCodeProtocolLib.cif
new file mode 100644
index 0000000..96d3f7b
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Protocol/CpuSampleCodeProtocolLib.cif
@@ -0,0 +1,11 @@
+<component>
+ name = "CpuSampleCodeProtocolLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Haswell\SampleCode\Protocol\"
+ RefName = "CpuSampleCodeProtocolLib"
+[files]
+"CpuSampleCodeProtocolLib.mak"
+"CpuSampleCodeProtocolLib.sdl"
+"TxtOneTouchOp\TxtOneTouchOp.c"
+"TxtOneTouchOp\TxtOneTouchOp.h"
+<endComponent>
diff --git a/ReferenceCode/Haswell/SampleCode/Protocol/CpuSampleCodeProtocolLib.mak b/ReferenceCode/Haswell/SampleCode/Protocol/CpuSampleCodeProtocolLib.mak
new file mode 100644
index 0000000..f77edb4
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Protocol/CpuSampleCodeProtocolLib.mak
@@ -0,0 +1,25 @@
+all : CpuSampleCodeProtocolLib
+
+$(CpuSampleCodeProtocolLib_LIB) : CpuSampleCodeProtocolLib
+
+CpuSampleCodeProtocolLib : $(BUILD_DIR)\CpuSampleCodeProtocolLib.mak CpuSampleCodeProtocolLibBin
+
+$(BUILD_DIR)\CpuSampleCodeProtocolLib.mak : $(CpuSampleCodeProtocolLib_DIR)\$(@B).cif $(CpuSampleCodeProtocolLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(CpuSampleCodeProtocolLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+CpuSampleCodeProtocolLib_INCLUDES=\
+ $(EDK_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(PROJECT_CPU_INCLUDES)\
+
+CpuSampleCodeProtocolLibBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\CpuSampleCodeProtocolLib.mak all\
+ "MY_INCLUDES=$(CpuSampleCodeProtocolLib_INCLUDES)" \
+ TYPE=LIBRARY
+!IF "$(x64_BUILD)"=="1"
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS) BUILD_DIR=$(BUILD_DIR)\IA32\
+ /f $(BUILD_DIR)\CpuSampleCodeProtocolLib.mak all\
+ "MY_INCLUDES=$(CpuSampleCodeProtocolLib_INCLUDES)" \
+ TYPE=PEI_LIBRARY
+!ENDIF \ No newline at end of file
diff --git a/ReferenceCode/Haswell/SampleCode/Protocol/CpuSampleCodeProtocolLib.sdl b/ReferenceCode/Haswell/SampleCode/Protocol/CpuSampleCodeProtocolLib.sdl
new file mode 100644
index 0000000..6662a1b
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Protocol/CpuSampleCodeProtocolLib.sdl
@@ -0,0 +1,24 @@
+TOKEN
+ Name = "CpuSampleCodeProtocolLib_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable CpuSampleCodeProtocolLib support in Project"
+ TokenType = Boolean
+ TargetMAK = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "CpuSampleCodeProtocolLib_DIR"
+End
+
+MODULE
+ Help = "Includes CpuSampleCodeProtocolLib.mak to Project"
+ File = "CpuSampleCodeProtocolLib.mak"
+End
+
+TOKEN
+ Name = "CpuSampleCodeProtocolLib_LIB"
+ Value = "$$(LIB_BUILD_DIR)\CpuSampleCodeProtocolLib.lib"
+ TokenType = Expression
+ TargetMAK = Yes
+End \ No newline at end of file
diff --git a/ReferenceCode/Haswell/SampleCode/Protocol/TxtOneTouchOp/TxtOneTouchOp.c b/ReferenceCode/Haswell/SampleCode/Protocol/TxtOneTouchOp/TxtOneTouchOp.c
new file mode 100644
index 0000000..3e6f982
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Protocol/TxtOneTouchOp/TxtOneTouchOp.c
@@ -0,0 +1,32 @@
+/** @file
+ Txt specific PPI operation definition.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#endif
+#include "TxtOneTouchOp.h"
+
+///
+/// Protocol GUID definition
+///
+EFI_GUID gTxtOneTouchOpProtocolGuid = TXT_ONE_TOUCH_OP_PROTOCOL_GUID;
+
+///
+/// Protocol description
+///
+EFI_GUID_STRING(&gTxtOneTouchOpProtocolGuid, "Txt One Touch OP Protocol", "Txt One Touch OP Protocol");
diff --git a/ReferenceCode/Haswell/SampleCode/Protocol/TxtOneTouchOp/TxtOneTouchOp.h b/ReferenceCode/Haswell/SampleCode/Protocol/TxtOneTouchOp/TxtOneTouchOp.h
new file mode 100644
index 0000000..aaccb4e
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/Protocol/TxtOneTouchOp/TxtOneTouchOp.h
@@ -0,0 +1,106 @@
+/** @file
+ Txt specific PPI operation definition.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _TXT_PPI_OPERATION_H_
+#define _TXT_PPI_OPERATION_H_
+
+///
+/// EDK and EDKII have different GUID formats
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#define TXT_ONE_TOUCH_OP_PROTOCOL_GUID \
+ { \
+ 0xFA2338AD, 0x80DF, 0x49D0, 0x93, 0x96, 0xCF, 0x71, 0x45, 0xD0, 0x3A, 0x76 \
+ }
+#else
+#define TXT_ONE_TOUCH_OP_PROTOCOL_GUID \
+ { \
+ 0xFA2338AD, 0x80DF, 0x49D0, \
+ { \
+ 0x93, 0x96, 0xCF, 0x71, 0x45, 0xD0, 0x3A, 0x76 \
+ } \
+ }
+#endif
+///
+/// Extern the GUID for protocol users.
+///
+extern EFI_GUID gTxtOneTouchOpProtocolGuid;
+
+///
+/// Forward reference for ANSI C compatibility
+///
+typedef struct _TXT_ONE_TOUCH_OP_PROTOCOL TXT_ONE_TOUCH_OP_PROTOCOL;
+
+///
+/// Member functions
+///
+typedef
+EFI_STATUS
+(EFIAPI *TXT_PPI_EXEC_OPERATION)(
+ IN TXT_ONE_TOUCH_OP_PROTOCOL *This,
+ IN UINT8 Command
+ );
+
+/*
+
+@brief
+ Extend PPI operation for TxT.
+
+ @param[in] This - Point of TXT_ONE_TOUCH_OP_PROTOCOL
+ @param[in] Command - Operation value for TxT
+
+*/
+typedef
+EFI_STATUS
+(EFIAPI *TXT_CONFIRMATION_DIALOG)(
+ IN TXT_ONE_TOUCH_OP_PROTOCOL *This,
+ IN UINT8 Command,
+ IN OUT BOOLEAN *Confirm
+ );
+/*
+
+@brief
+ Confirmation dialog for TxT PPI
+
+ @param[in] This - Point of TXT_ONE_TOUCH_OP_PROTOCOL
+ @param[in] Command - Operation value for TxT
+ @param[in] Confirm - User confirm
+
+*/
+typedef
+EFI_STATUS
+(EFIAPI *TXT_RESET_SYSTEM)(
+ IN TXT_ONE_TOUCH_OP_PROTOCOL *This,
+ IN UINT8 Command
+ );
+
+/**
+ Reset system.
+
+ @param[in] This - Point of TXT_ONE_TOUCH_OP_PROTOCOL
+ @param[in] Command - Operation value for TxT
+
+ @retval EFI_SUCCESS - Always return EFI_SUCCESS
+**/
+struct _TXT_ONE_TOUCH_OP_PROTOCOL {
+ TXT_PPI_EXEC_OPERATION ExecuteOperation;
+ TXT_CONFIRMATION_DIALOG ConfirmationDialog;
+ TXT_RESET_SYSTEM ResetSystem;
+};
+
+#endif
diff --git a/ReferenceCode/Haswell/SampleCode/SecCore/CpuRcSec.cif b/ReferenceCode/Haswell/SampleCode/SecCore/CpuRcSec.cif
new file mode 100644
index 0000000..0bc0424
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/SecCore/CpuRcSec.cif
@@ -0,0 +1,20 @@
+<component>
+ name = "CpuRcSec"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Haswell\SampleCode\SecCore"
+ RefName = "CpuRcSec"
+[files]
+"CpuRcSec.mak"
+"CpuRcSec.sdl"
+"Sec\Ia32\Chipset.inc"
+"Sec\Ia32\CpuRcSec.asm"
+"Sec\Ia32\CrcSecPpi.c"
+"Sec\Ia32\Flat32.asm"
+"Sec\Ia32\Ia32.inc"
+"Sec\Ia32\SecFlat32.inc"
+"Sec\Ia32\Platform.inc"
+"Sec\Ia32\ResetVec.asm"
+"Sec\Ia32\ResetVec.raw"
+"Sec\Ia32\SecCore.inc"
+"Sec\Ia32\SecStartup.c"
+<endComponent>
diff --git a/ReferenceCode/Haswell/SampleCode/SecCore/CpuRcSec.mak b/ReferenceCode/Haswell/SampleCode/SecCore/CpuRcSec.mak
new file mode 100644
index 0000000..8f1b13f
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/SecCore/CpuRcSec.mak
@@ -0,0 +1,27 @@
+# MAK file for the ModulePart:CPU SEC RC
+CPU_RC_DEPENDANCIES = \
+$(CPU_RC_SEC_DIR)\Platform.inc \
+$(CPU_RC_SEC_DIR)\Chipset.inc \
+$(CPU_RC_SEC_DIR)\SecFlat32.inc
+
+$(BUILD_DIR)\CpuRcSec.obj : $(CPU_RC_SEC_DIR)\CpuRcSec.asm $(CPU_RC_DEPENDANCIES)
+ $(ASM) /c /nologo /coff /Sa /I$(BUILD_DIR) /Fo$@ $(CPU_RC_SEC_DIR)\CpuRcSec.asm
+
+
+# Add its own include path to
+MY_INC = \
+/ICore \
+/IEDK\Foundation\Framework\Ppi\SecPlatformInformation
+
+# Add CrcSecPpi.obj to CORE_PEIBin dependency list, so it will be linked with PEI CORE
+CORE_PEIBin: $(BUILD_DIR)\CrcSecPpi.obj
+# Add SecPlatformInformation.obj to CORE_PEIBin dependency list, so it will be linked with PEI CORE
+CORE_PEIBin: $(BUILD_DIR)\SecPlatformInformation.obj
+
+# Add a description block for CrcSecPpi.OBJ for cross-module link
+$(BUILD_DIR)\CrcSecPpi.OBJ : $(CPU_RC_SEC_DIR)\CrcSecPpi.c
+ $(CC) $(CFLAGS) $(MY_INC) /Fo$(BUILD_DIR)\CrcSecPpi.obj $(CPU_RC_SEC_DIR)\CrcSecPpi.c
+
+# Add a description block for SecPlatformInformation.OBJ
+$(BUILD_DIR)\SecPlatformInformation.obj : $(EdkFrameworkPpiLib_DIR)\SECPLATFORMINFORMATION\SecPlatformInformation.c
+ $(CC) $(CFLAGS) $(EDK_INCLUDES) /D TIANO_RELEASE_VERSION=0x00080006 /Fo$(BUILD_DIR)\SecPlatformInformation.obj $(EdkFrameworkPpiLib_DIR)\SECPLATFORMINFORMATION\SecPlatformInformation.c
diff --git a/ReferenceCode/Haswell/SampleCode/SecCore/CpuRcSec.sdl b/ReferenceCode/Haswell/SampleCode/SecCore/CpuRcSec.sdl
new file mode 100644
index 0000000..3c8a5b0
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/SecCore/CpuRcSec.sdl
@@ -0,0 +1,40 @@
+TOKEN
+ Name = "Intel_Haswell_SEC_RC_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+End
+
+MODULE
+ Help = "Includes CpuRcSec.mak to Project"
+ File = "CpuRcSec.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\CpuRcSec.obj"
+ Parent = "ADDON_SEC_CORE_OBJ_FILES"
+ InvokeOrder = AfterParent
+End
+
+PATH
+ Name = "CPU_RC_SEC_DIR"
+ Path = "ReferenceCode\Haswell\SampleCode\SecCore\Sec\Ia32"
+End
+
+ELINK
+ Name = "GainestownSecRcEntry"
+ Parent = "SECCoreAtPowerOn"
+ Priority = 1000
+ Help = "Gainestown RC"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "CrcSecPlatformInformationPpi,"
+ Parent = "PeiCoreInitialize"
+ InvokeOrder = AfterParent
+End
+
diff --git a/ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/Chipset.inc b/ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/Chipset.inc
new file mode 100644
index 0000000..ebd52ab
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/Chipset.inc
@@ -0,0 +1,107 @@
+;@file
+; Chipset constants and macros
+;
+;@copyright
+; Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+; This software and associated documentation (if any) is furnished
+; under a license and may only be used or copied in accordance
+; with the terms of the license. Except as permitted by such
+; license, no part of this software or documentation may be
+; reproduced, stored in a retrieval system, or transmitted in any
+; form or by any means without the express written consent of
+; Intel Corporation.
+;
+; This file contains a 'Sample Driver' and is licensed as such
+; under the terms of your license agreement with Intel or your
+; vendor. This file may be modified by the user, subject to
+; the additional terms of the license agreement
+;
+
+;
+; APIC register
+;
+APICID EQU 0FEE00020h
+
+;
+; Power Management I/O Registers
+;
+PCH_ACPI_BASE_ADDRESS EQU 0500h
+ACPI_PM1_STS EQU 000h
+ACPI_PM1_CNT EQU 004h
+
+;
+; PCH RCBA base address
+;
+PCH_RCRB_BASE EQU 0FED1C000h
+PCH_RCRB_BASE_REG EQU 8000F8F0h ; PCH Register B0:D31:RF0
+PCH_RCRB_GCS EQU 03410h
+PCH_RCRB_RTC_CONF EQU 03400h
+PCH_RCRB_RTC_CONF_UCMOS_EN EQU 04h
+PCH_RCRB_HPET EQU 03404h
+PCH_RCRB_HPET_DECODE EQU 080h
+
+;
+; HPET compare register
+;
+HPET_COMP_1 EQU 0FED00108h
+HPET_COMP_2 EQU 0FED0010Ch
+HPET_COMP_3 EQU 0FED00128h
+HPET_COMP_4 EQU 0FED00148h
+
+;
+; MCH PCIe base address
+;
+;Need to match PcdPciExpressBaseAddress or PCIEX_BASE_ADDRESS
+;CPU_HEC_BASE EQU 0E0000000h ; Must be X0000000
+;(AMI_CHG)>
+CPU_HEC_BASE EQU MKF_PCIEX_BASE_ADDRESS ; Must be X0000000
+;<(AMI_CHG)
+;CPU_HEC_SIZE EQU 000000000h ; 256M
+;(AMI_CHG)>
+CPU_HEC_SIZE EQU MKF_PCIEX_LENGTH_BIT_SETTING ; 64M, 128M, 256M
+;<(AMI_CHG)
+CPU_HEC_EN EQU 000000001h ; Enable
+CPU0_HEC_PCI_ADDR EQU 080FF0150h
+CPU1_HEC_PCI_ADDR EQU 080FE0150h
+
+PCI_LPC_BASE EQU 08000F800h
+
+GPIO_BASE_ADDRESS EQU 0800h
+R_GPIO_USE_SEL2 EQU 030h
+R_GPIO_IO_SEL2 EQU 034h
+R_GPIO_LVL2 EQU 038h
+
+;
+; PCI registers
+;
+PCH_LPC_PMBASE_PCI_ADDR EQU ((1Fh * 8 + 00h) * 1000h + 0040h + CPU_HEC_BASE)
+PCH_LPC_ACPICNTL_PCI_ADDR EQU ((1Fh * 8 + 00h) * 1000h + 0044h + CPU_HEC_BASE)
+PCH_LPC_GEN_PMCON_3_ADDR EQU ((1Fh * 8 + 00h) * 1000h + 00A4h + CPU_HEC_BASE)
+PCH_LPC_RCRB_PCI_ADDR EQU ((1Fh * 8 + 00h) * 1000h + 00F0h + CPU_HEC_BASE)
+PCH_LPC_BIOS_CNTL_PCI_ADDR EQU ((1Fh * 8 + 00h) * 1000h + 00DCh + CPU_HEC_BASE)
+MCH_UNCERRMASK_PCI_ADDR EQU ((00h * 8 + 00h) * 1000h + 0108h + CPU_HEC_BASE)
+MCH_SYRE_PCI_ADDR EQU ((10h * 8 + 00h) * 1000h + 0040h + CPU_HEC_BASE)
+
+SYRE_CPURST EQU 14
+
+;
+; PCIEXBAR constants for enable in bit [0]
+;
+ENABLE EQU 1
+
+;
+; PCIEXBAR constants for size in bit [2:1]
+;
+PCIEXBAR_64MB EQU 010b
+PCIEXBAR_128MB EQU 001b
+PCIEXBAR_256MB EQU 000b
+
+MMCFG_BASE EQU CPU_HEC_BASE ; 4GB-128MB
+MMCFG_LENGTH_BIT_SETTING EQU CPU_HEC_SIZE ; 64M, 128M, 256M
+
+DMIBAR_REG EQU (068h + CPU_HEC_BASE)
+DMI_BASE_ADDRESS EQU 0FED18000h
+
+MCHBAR_REG EQU (048h + CPU_HEC_BASE)
+MCH_BASE_ADDRESS EQU 0FED10000h
+
diff --git a/ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/CpuRcSec.asm b/ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/CpuRcSec.asm
new file mode 100644
index 0000000..1460ddf
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/CpuRcSec.asm
@@ -0,0 +1,38 @@
+
+ INCLUDE Token.equ
+ INCLUDE Platform.inc
+ INCLUDE Ia32.inc
+
+CPU_HEC_BASE EQU MKF_PCIEX_BASE_ADDRESS ; Must defined before include Chipset.inc
+ INCLUDE Chipset.inc
+
+ INCLUDE SecCore.inc
+
+ .686p
+ .xmm
+ .model small
+
+ extern FindMicrocode:NEAR32
+ extern GainestownSecRcEntryEnd:NEAR32
+
+STARTUP_SEG SEGMENT PARA PUBLIC USE32 'CODE'
+ ASSUME CS:STARTUP_SEG, DS:STARTUP_SEG
+
+ INCLUDE SecFlat32.inc
+
+GainestownSecRcEntry PROC
+
+ jmp ProtectedModeSECStart ; Jump to IvyBridge SEC sample code
+
+CallPeiCoreEntryPoint PROC
+ ; Set stack top pointer
+ mov esp, DATA_STACK_BASE_ADDRESS + DATA_STACK_SIZE
+
+ jmp GainestownSecRcEntryEnd ; Exit the eLink
+CallPeiCoreEntryPoint ENDP
+
+GainestownSecRcEntry ENDP
+
+STARTUP_SEG ENDS
+END
+
diff --git a/ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/CrcSecPpi.c b/ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/CrcSecPpi.c
new file mode 100644
index 0000000..28cc105
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/CrcSecPpi.c
@@ -0,0 +1,233 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+/*++
+
+Copyright (c) 1999 - 2008 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+
+Module Name:
+
+ CrcSecPpi.c
+
+Abstract:
+
+ Install SecPlatformInformation PPI.
+
+--*/
+
+//#include "Tiano.h"
+//#include "PeiCore.h"
+//#include "FlashMap.h"
+//#include "EfiFirmwareFileSystem.h"
+//#include "EfiFirmwareVolumeHeader.h"
+
+//#include EFI_PPI_DEFINITION (SecPlatformInformation)
+#include "Tiano.h"
+//#include <Core\Core_Pei\PeiCore.h>
+
+//#include "Efi.h"
+//#include "Pei.h"
+
+#include "EfiCommonLib.h"
+#include <Ppi\AmiEarlyBistPpi.h>
+static EFI_GUID gAmiEarlyBistGuid = AMI_EARLY_BIST_PPI_GUID;
+
+#include "SecPlatformInformation.h"
+
+EFI_STATUS
+SecPlatformInformation (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN OUT UINT64 *StructureSize,
+ IN OUT SEC_PLATFORM_INFORMATION_RECORD *PlatformInformationRecord
+ );
+
+EFI_SEC_PLATFORM_INFORMATION_PPI mSecPlatformInformationPpi = { SecPlatformInformation };
+
+EFI_PEI_PPI_DESCRIPTOR mPeiSecPlatformInformationPpi = {
+ (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+ &gEfiSecPlatformInformationPpiGuid,
+ &mSecPlatformInformationPpi
+};
+
+EFI_STATUS
+EFIAPI
+SecPlatformInformation (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN OUT UINT64 *StructureSize,
+ IN OUT SEC_PLATFORM_INFORMATION_RECORD *PlatformInformationRecord
+ )
+/*++
+
+Routine Description:
+
+ Implementation of the PlatformInformation service in
+ EFI_SEC_PLATFORM_INFORMATION_PPI.
+ This function conveys state information out of the SEC phase into PEI.
+
+Arguments:
+
+ PeiServices - Pointer to the PEI Services Table.
+ StructureSize - Pointer to the variable describing size of the input buffer.
+ PlatformInformationRecord - Pointer to the EFI_SEC_PLATFORM_INFORMATION_RECORD.
+
+Returns:
+
+ EFI_SUCCESS - The data was successfully returned.
+ EFI_BUFFER_TOO_SMALL - The buffer was too small.
+
+--*/
+{
+ UINT32 *BIST;
+ UINT32 Size;
+ UINT32 Count;
+ AMI_EARLY_BIST_PPI *AmiEarlyPpi;
+ EFI_STATUS Status;
+ CPU_BIST PrivateBist;
+
+ Status = (*PeiServices)->LocatePpi(
+ PeiServices,
+ &gAmiEarlyBistGuid,
+ 0, NULL,
+ &AmiEarlyPpi
+ );
+ //Force BIST no error if PPI not found
+ if (Status != EFI_SUCCESS) {
+ Size = sizeof (UINT64);
+ if ((*StructureSize) < (UINT64) Size) {
+ *StructureSize = Size;
+ return EFI_BUFFER_TOO_SMALL;
+ }
+ PrivateBist.ApicId = 0;
+ PrivateBist.Bist = 0;
+ BIST = (UINT32*)&PrivateBist;
+ } else{
+ Count = AmiEarlyPpi->NumBists;
+ Size = Count * sizeof (UINT64);
+ if ((*StructureSize) < (UINT64) Size) {
+ *StructureSize = Size;
+ return EFI_BUFFER_TOO_SMALL;
+ }
+ BIST = (UINT32 *) (&(AmiEarlyPpi->CpuBist));
+ }
+ *StructureSize = Size;
+ EfiCommonLibCopyMem (PlatformInformationRecord, BIST, Size);
+
+ return EFI_SUCCESS;
+
+/*
+ UINT32 *BIST;
+ UINT32 Size;
+ UINT32 Count;
+
+ //
+ // The entries of BIST information, together with the number of them,
+ // reside in the bottom of stack, left untouched by normal stack operation.
+ // This routine copies the BIST information to the buffer pointed by
+ // PlatformInformationRecord for output.
+ //
+ Count = *(TopOfCar - 1);
+ Size = Count * sizeof (UINT64);
+
+ if ((*StructureSize) < (UINT64) Size) {
+ *StructureSize = Size;
+ return EFI_BUFFER_TOO_SMALL;
+ }
+
+ *StructureSize = Size;
+ BIST = (UINT32 *) ((UINT32) TopOfCar - sizeof (UINT32) - Size);
+
+ EfiCommonLibCopyMem (PlatformInformationRecord, BIST, Size);
+
+ return EFI_SUCCESS;
+*/
+}
+
+//<AMI_PHDR_START>
+//**********************************************************************
+//
+// Procedure: CrcSecPlatformInformationPpi
+//
+// Description:
+// Install SecPlatformInformation PPI that Intel Ivybridge CPU reference code needs.
+// (conveys state information out of the SEC phase into PEI)
+//
+// Input:
+// IN EFI_FFS_FILE_HEADER *FfsHeader - pointer to the header of the current firmware file system
+// IN EFI_PEI_SERVICES **PeiServices - pointer to the PeiServices Table
+//
+// Output:
+// EFI_SUCCESS
+//
+// Notes:
+//
+//**********************************************************************
+//<AMI_PHDR_END>
+//PeiInitialize eLink
+
+EFI_STATUS EFIAPI CrcSecPlatformInformationPpi(
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+){
+ EFI_STATUS Status;
+
+ // Install the NB Init Policy PPI
+ Status = (*PeiServices)->InstallPpi(PeiServices, &mPeiSecPlatformInformationPpi);
+
+ return EFI_SUCCESS;
+}
+
+
+// VOID
+// SecStartup (
+// IN UINT32 SizeOfRam,
+// IN UINT32 BootFirmwareVolume,
+// IN PEI_MAIN_ENTRY_POINT PeiCoreEntryPoint
+// )
+/*++
+
+Routine Description:
+
+ Entry point to the C language phase of SEC. After the SEC assembly
+ code has initialized some temporary memory and set up the stack,
+ the control is transferred to this function.
+
+Arguments:
+
+ SizeOfRam - Size of the temporary memory available for use.
+ BootFirmwareVolume - Base address of the Boot Firmware Volume.
+ PeiCoreEntryPoint - Pointer to the entry point of the PEI core.
+
+Returns:
+
+ This function never returns
+
+--*/
+// {
+// EFI_PEI_STARTUP_DESCRIPTOR PeiStartup;
+//
+// PeiStartup.SizeOfCacheAsRam = SizeOfRam;
+// PeiStartup.BootFirmwareVolume = BootFirmwareVolume;
+// PeiStartup.DispatchTable = &mPeiSecPlatformInformationPpi;
+//
+// //
+// // Transfer the control to the PEI core
+// //
+// (*PeiCoreEntryPoint) (&PeiStartup);
+//
+// //
+// // Should not come here.
+// //
+// return ;
+// }
diff --git a/ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/Flat32.asm b/ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/Flat32.asm
new file mode 100644
index 0000000..3b973d8
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/Flat32.asm
@@ -0,0 +1,1490 @@
+;
+; This file contains a 'Sample Driver' and is licensed as such
+; under the terms of your license agreement with Intel or your
+; vendor. This file may be modified by the user, subject to
+; the additional terms of the license agreement
+;
+;------------------------------------------------------------------------------
+;
+; Copyright (c) 1999 - 2013, Intel Corporation. All rights reserved.<BR>
+; This software and associated documentation (if any) is furnished
+; under a license and may only be used or copied in accordance
+; with the terms of the license. Except as permitted by such
+; license, no part of this software or documentation may be
+; reproduced, stored in a retrieval system, or transmitted in any
+; form or by any means without the express written consent of
+; Intel Corporation.
+;
+; Module Name:
+;
+; Flat32.asm
+;
+; Abstract:
+;
+; This is the code that goes from real-mode to protected mode.
+; It consumes the reset vector.
+;
+;------------------------------------------------------------------------------
+ INCLUDE Platform.inc
+ INCLUDE Ia32.inc
+ INCLUDE Chipset.inc
+ INCLUDE SecCore.inc
+
+.686p
+.xmm
+.model small, c
+
+EXTRN SecStartup:NEAR
+
+; ECP porting
+EXTRN PcdGet32 (PcdFlashMicrocodeFvBase):DWORD
+EXTRN PcdGet32 (PcdFlashMicrocodeFvSize):DWORD
+EXTRN PcdGet32 (PcdNemCodeCacheSize):DWORD
+EXTRN PcdGet32 (PcdNemCodeCacheBase):DWORD
+EXTRN PcdGet32 (PcdFlashAreaBaseAddress):DWORD
+EXTRN PcdGet32 (PcdTemporaryRamBase):DWORD
+EXTRN PcdGet32 (PcdTemporaryRamSize):DWORD
+EXTRN PcdGet64 (PcdPciExpressBaseAddress):QWORD
+
+_TEXT_REALMODE SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:_TEXT_REALMODE, DS:_TEXT_REALMODE
+
+;------------------------------------------------------------------------------
+;
+; SEC "Security" Code module.
+;
+; Transition to non-paged flat-model protected mode from a
+; hard-coded GDT that provides exactly two descriptors.
+; This is a bare bones transition to protected mode only
+; used for while in PEI and possibly DXE.
+;
+; IA32 specific cache as RAM modules
+;
+; After enabling protected mode, a far jump is executed to
+; TransferToPEI using the newly loaded GDT.
+; This code also enables the Cache-as-RAM
+;
+; RETURNS: none
+;
+; MMX Usage:
+; MM0 = BIST State
+; MM1 = Current Package Physical Info
+; [7:0] = Cluster ID
+; [15:8] = Total Prossor pacakge detected in system
+; [16] = BAD CMOS Flag
+; [17] = AuburnDale or ClarksField
+; [0] = AuburnDale
+; [1] = ClarksField
+; [18] = Contain SEC reset flag
+; CPU Only Reset Flag
+; [19] = Contain SEC reset flag
+; Power Good Reset Flag
+; [23:20] = Reserved
+; [31:24] = Reserved
+; MM2 = store common MAX & MIN ratio
+; MM3 = Patch Revision
+; MM4 = Patch Pointer
+; MM5 = Save time-stamp counter value high32bit
+; MM6 = Save time-stamp counter value low32bit.
+; MM7 = Used in CALL_MMX & RET_ESI micaro
+;
+;------------------------------------------------------------------------------
+
+; Nehalem Reset Boot Flow Start
+
+align 4
+_ModuleEntryPoint PROC NEAR C PUBLIC
+ ;
+ ; Save BIST state in MM0
+ ;
+ fninit ; clear any pending Floating point exceptions
+ movd mm0, eax
+
+ ;
+ ; Save time-stamp counter value
+ ; rdtsc load 64bit time-stamp counter to EDX:EAX
+ ;
+ rdtsc
+ movd mm5, edx
+ movd mm6, eax
+;----------------------------------------------------------------------------------------
+; "Merlin" support
+;----------------------------------------------------------------------------------------
+ xor eax, eax
+ mov es, ax
+ mov ax, cs
+ mov ds, ax
+
+;******************************************************************************
+; BEGIN WARM-START CHANGE
+;******************************************************************************
+;
+; PLATFORM-SPECIFIC EQUATES!
+; These equates define an address which has the following requirements
+; on the target platform:
+; 1. After booting DOS, the memory is not used by other DOS applications
+; or drivers (thus very platform/configuration specific).
+; Minimum of roughly 8 bytes required.
+; 2. The memory contents and address range are not affected by an INIT
+; 3. By default, after booting DOS, the first 4 bytes at this address
+; contain either 0 (cleared memory) or 0xFFFFFFFF.
+; 4. After booting DOS, the memory is writable
+;
+; It's expected that a manual inspection (using ITP) is performed to ensure
+; that the requirements are met. If the manual inspection fails, then a
+; different address must be identified, the below two equates must be
+; changed accordingly, and the platform firmware must be rebuilt.
+; Note that simply changing the platform hardware configuration could
+; break this firmware because drivers may be loaded differently in
+; memory, potentially using the address arbitrarily chosen here.
+;
+ ;
+ ; Check if value in magic address contains non-zero/non-FF value.
+ ; It should actually contain executable code, typically a jmp
+ ; instruction.
+ ;
+ mov ax, MAGIC_SEG
+ mov es, ax
+ mov al, BYTE PTR es:[MAGIC_ADDRESS_IN_SEG]
+
+ ; Check for zero value
+ cmp al, 0EAh ; EA is the FAR JMP opcode that Merlin inserts
+ jz LegacyBiosWarmStart
+
+ ; Check INIT# is asserted by port 0xCF9
+ mov dx, 0CF9h
+ in al, dx
+ cmp al, 04h
+ jnz NotWarmStart
+
+ ;
+ ; Issue hard reset due to client silicon limitations, CPU Only Reset is not supported.
+ ;
+ mov dx, 0CF9h
+ mov al, 06h
+ out dx, al
+
+LegacyBiosWarmStart:
+
+ ;
+ ; Check APIC_BASE_MSR.BIT8 to see if we're the BSP
+ ;
+ mov cx, MSR_APIC_BASE
+ rdmsr
+ test ah, 1
+ jz TightLoop
+ ;
+ ; We're the BSP, so jump to the magic address.
+ ;
+ DB 0EAh
+ DW MAGIC_ADDRESS_IN_SEG
+ DW MAGIC_SEG
+
+ ; Not reached
+NotWarmStart:
+
+;******************************************************************************
+; END WARM-START CHANGE
+;******************************************************************************
+
+ ;
+ ; Enter Protected mode.
+ ;
+ STATUS_CODE (01h) ; BSP_PROTECTED_MODE_START
+ mov esi, OFFSET GdtDesc
+ DB 66h
+ lgdt fword ptr cs:[si]
+ mov eax, cr0 ; Get control register 0
+ or eax, 00000003h ; Set PE bit (bit #0) & MP bit (bit #1)
+ mov cr0, eax ; Activate protected mode
+ mov eax, cr4 ; Get control register 4
+ or eax, 00000600h ; Set OSFXSR bit (bit #9) & OSXMMEXCPT bit (bit #10)
+ mov cr4, eax
+
+ ;
+ ; Now we're in Protected16
+ ; Set up the selectors for protected mode entry
+ ;
+ mov ax, SYS_DATA_SEL
+ mov ds, ax
+ mov es, ax
+ mov fs, ax
+ mov gs, ax
+ mov ss, ax
+
+ ;
+ ; Go to Protected32
+ ;
+ mov esi, offset NemInitLinearAddress
+ jmp fword ptr cs:[si]
+
+TightLoop:
+ cli
+ hlt
+ jmp TightLoop
+
+_ModuleEntryPoint ENDP
+_TEXT_REALMODE ENDS
+
+_TEXT_PROTECTED_MODE SEGMENT PARA PUBLIC USE32 'CODE'
+ ASSUME CS:_TEXT_PROTECTED_MODE, DS:_TEXT_PROTECTED_MODE
+
+CALL_MMX macro RoutineLabel
+
+ local ReturnAddress
+ mov esi, offset ReturnAddress
+ movd mm7, esi ; save ReturnAddress into MM7
+ jmp RoutineLabel
+ReturnAddress:
+
+endm
+
+RET_ESI macro
+
+ movd esi, mm7 ; restore ESP from MM7
+ jmp esi
+
+endm
+
+CALL_EBP macro RoutineLabel
+
+ local ReturnAddress
+ mov ebp, offset ReturnAddress
+ jmp RoutineLabel
+ReturnAddress:
+
+endm
+
+RET_EBP macro
+
+ jmp ebp ; restore ESP from EBP
+
+endm
+
+align 4
+ProtectedModeSECStart PROC NEAR PUBLIC
+
+ STATUS_CODE (02h)
+ CALL_MMX EnableAccessCSR
+
+ STATUS_CODE (03h)
+ CALL_EBP VeryEarlyMicrocodeUpdate
+
+ STATUS_CODE (04h)
+ CALL_MMX DetectNumOfCPUSocket
+
+ STATUS_CODE (05h)
+ CALL_MMX PlatformInitialization
+
+ STATUS_CODE (06h)
+ CALL_MMX InitializeNEM
+
+ STATUS_CODE (07h)
+ CALL_MMX EstablishStack
+
+ STATUS_CODE (08h)
+ jmp CallPeiCoreEntryPoint
+
+ProtectedModeSECStart ENDP
+
+EnableAccessCSR PROC NEAR PRIVATE
+ ;
+ ; get Bus number from CPUID[1] EBX[31:24]
+ ;
+
+ mov eax, 0Bh
+ mov ecx, 1
+ cpuid
+ mov esi, eax
+
+ mov eax, 1 ; bus 0
+ cpuid
+ bswap ebx
+ movzx eax, bl
+ movzx ebx, bl
+ shl eax, BSPApicIDSaveStart ; Save current BSP APIC ID in MM1[31:24]
+ mov cx, si
+ shr bl, cl ; get Bus number in BL
+ or eax, ebx
+ movd mm1, eax ; save Bus number MM1[7:0]
+
+ ;
+ ; Enable MM PCI-E Config Space
+ ; --cr-- use register symbol name; should upper 32 bit be cleared
+ ;
+ mov eax, 080000060h ; MCHBAR
+ mov dx, 0CF8h
+ out dx, eax
+ mov dx, 0CFCh
+ mov eax, 04h
+ out dx, eax
+ in eax, dx
+ or eax, MMCFG_BASE OR ENABLE
+ out dx, eax
+
+ ; Clear reset flag
+ movd eax, mm1
+ and eax, NOT BIT18+BIT19
+ movd mm1, eax
+
+ ;
+ ; Enable SPI prefetching and caching
+ ;
+ mov esi, PCH_LPC_BIOS_CNTL_PCI_ADDR ; Bus0:Dev31:Func0:RegDCh
+ and BYTE PTR es:[esi], NOT (11b SHL 2)
+ or BYTE PTR es:[esi], (10b SHL 2) ; D31:F0:RegDCh[3:2] = 10b
+
+ RET_ESI
+
+EnableAccessCSR ENDP
+
+; STATUS_CODE (03h)
+PlatformInitialization PROC NEAR PRIVATE
+
+ ;
+ ; Program PCI Express base address
+ ;
+
+ mov eax, 80000060h ; 0:0:0:60
+ mov dx, 0CF8h
+ out dx, eax
+ mov dx, 0CFCh
+ ;using Pcd instead
+ ;mov eax, 0e0000000h OR 00h OR 1
+; mov eax, DWORD PTR PcdGet64 (PcdPciExpressBaseAddress)
+ mov eax, DWORD PTR PCIEXPRESS_BASE_ADDRESS
+ or eax, (PCIEX_LENGTH_BIT_SETTING OR 1)
+ out dx, eax
+
+ ;
+ ; Enable Mch Bar
+ ;
+ mov esi, MCHBAR_REG
+ mov eax, (MCH_BASE_ADDRESS + 1)
+ mov Dword Ptr [esi], eax
+
+ ;
+ ; Enable RCRB in PCH.
+ ;
+ mov esi, PCH_LPC_RCRB_PCI_ADDR
+ mov eax, PCH_RCRB_BASE + 1
+ mov Dword Ptr [esi], eax
+
+ ;
+ ; Configure GPIO to be able to initiate LVL change for GPIO48 for S3 resume time calculation.
+ ;
+ ; Enable GPIO BASE I/O registers
+ ;
+ mov eax, PCI_LPC_BASE + 48h
+ mov dx, 0CF8h
+ out dx, eax
+ mov eax, GPIO_BASE_ADDRESS
+ add dx, 4
+ out dx, eax
+
+ mov eax, PCI_LPC_BASE + 4Ch
+ mov dx, 0CF8h
+ out dx, eax
+ add dx, 4
+ in al, dx
+ or al, BIT4 ; GPIOBASE Enable
+ out dx, al
+
+ ;GPIO_USE_SEL2 Register -> 1 = GPIO 0 = Native
+ mov dx, GPIO_BASE_ADDRESS + R_GPIO_USE_SEL2
+ in eax, dx
+ or eax, 010000h ;Enable GPIO48
+ out dx, eax
+
+ ;GP_IO_SEL2 Register -> 1 = Input 0 = Output (if Native Mode don't care)
+ mov dx, GPIO_BASE_ADDRESS + R_GPIO_IO_SEL2
+ in eax, dx
+ and eax, 0FFFEFFFFh ;Configure GPIO48 as Output
+ out dx, eax
+
+ mov dx, GPIO_BASE_ADDRESS + R_GPIO_LVL2
+ in eax, dx
+ or eax, 010000h ;Configure GPIO48 as High
+ out dx, eax
+
+ ;
+ ; Program and Enable ACPI PM Base.
+ ;
+ mov esi, PCH_LPC_PMBASE_PCI_ADDR
+ mov eax, PCH_ACPI_BASE_ADDRESS + 1
+ mov Dword Ptr [esi], eax
+ mov esi, PCH_LPC_ACPICNTL_PCI_ADDR
+ or Dword Ptr [esi], 00000080h
+
+ ;
+ ; PCH BIOS Spec Rev 0.5.0 Section 12.9
+ ; Additional Programming Requirements for USB Support
+ ; Step 2.b
+ ; Clear RCBA + 3598h [0] to 0b
+ ;
+ mov esi, PCH_RCRB_BASE + 3598h
+ mov eax, 0
+ mov Dword Ptr [esi], eax
+
+ ;
+ ; Enable HPET decode in PCH.
+ ;
+ mov esi, PCH_RCRB_BASE + PCH_RCRB_HPET
+ mov eax, PCH_RCRB_HPET_DECODE
+ mov Dword Ptr [esi], eax
+ mov eax, Dword ptr [esi]
+ xor eax, eax
+ mov esi, HPET_COMP_1
+ mov Dword Ptr [esi], eax
+ mov esi, HPET_COMP_2
+ mov Dword ptr [esi], eax
+
+ ;
+ ; Enable the upper 128-byte bank of RTC RAM.
+ ;
+ mov esi, PCH_RCRB_BASE + PCH_RCRB_RTC_CONF
+ mov eax, Dword Ptr [esi]
+ or eax, PCH_RCRB_RTC_CONF_UCMOS_EN
+ mov Dword Ptr [esi], eax
+
+ ;
+ ; Choose Port80 Route
+ ;
+ mov esi, PCH_RCRB_BASE + PCH_RCRB_GCS
+ mov ebx, Dword Ptr [esi]
+ or bl, BIT5
+
+ ;
+ ; check SETUP option - PchPort80Route
+ ; 0 = LPC {Default]; 1 = PCI
+ ;
+; mov al, CMOS_PCH_PORT80_OFFSET ; CMOS Offset = 17h
+; mov dx, RTC_UPPER_INDEX
+; out dx, al
+; inc dx
+; in al, dx
+; test al, BIT0
+; jnz @F
+ and bl, NOT (BIT2) ; Port80h to LPC
+;@@:
+ mov Dword Ptr [esi], ebx
+
+ ;
+ ; Halt TCO Timer
+ ;
+ mov dx, 0468h
+ in ax, dx
+ or ax, BIT11
+ out dx, ax
+
+ ;
+ ; Clear the Second TO status bit
+ ;
+ mov dx, 0466h
+ in ax, dx
+ or ax, BIT1
+ out dx, ax
+
+ RET_ESI
+
+PlatformInitialization ENDP
+
+; STATUS_CODE (03h)
+DetectNumOfCPUSocket PROC NEAR PRIVATE
+
+ ; only one socket
+ movd eax, mm1 ; get MM1 value into EAX
+ mov ah, 01
+ movd mm1, eax ; save CPU pkg count into MM1[15:8]
+
+ RET_ESI
+
+DetectNumOfCPUSocket ENDP
+
+; STATUS_CODE (07h)
+VeryEarlyMicrocodeUpdate PROC NEAR PRIVATE
+
+IF EARLY_MICROCODE_SUPPORT
+ mov ecx, IA32_BIOS_SIGN_ID
+ rdmsr ; CPU PatchID -> EDX
+ cmp edx, 0 ; If microcode has been updated
+ jnz luExit ; Skip if patch already loaded
+
+ mov ecx, IA32_PLATFORM_ID ; To get Platform ID.
+ rdmsr
+ shr edx, 18 ; EDX[0-2] = Platform ID.
+ and dx, 07h ; DX = Platform ID.
+ mov si, dx ; Save Platform ID in FS.
+ mov eax, 01h ; To get CPU signature.
+ cpuid ; EAX = CPU signature.
+ mov cx, si ; CX = Platform ID
+ xor edx, edx
+ bts dx, cx ; EDX = Platform ID bit.
+
+; mov esi, PcdGet32 (PcdFlashMicrocodeFvBase)
+ mov esi, MICROCODE_FV_BASE_ADDRESS
+
+ mov ebx, esi
+ mov bx, FVHEADER_LEN_OFF
+ movzx ebx, WORD PTR [ebx]
+ add esi, ebx
+ add si, FFSHEADER_LEN ; add FFS header
+
+; mov edi, PcdGet32 (PcdFlashMicrocodeFvBase)
+; mov ebx, PcdGet32 (PcdFlashMicrocodeFvSize)
+ mov edi, MICROCODE_FV_BASE_ADDRESS
+ mov ebx, MICROCODE_FV_SIZE
+ add edi, ebx ;End addr of uCodes.
+
+ ; EAX = CPU signature.
+ ; EDX = Platform ID bit.
+ ; ESI = Abs addr of contiguous uCode blocks.
+ ; EDI = Abs addr of contiguous uCode blocks end.
+
+luCheckPatch:
+ cmp (UpdateHeaderStruc PTR ds:[esi]).dProcessorSignature, eax;Sig matched?
+ jnz luCheckUnprogrammed ; No.
+ test (UpdateHeaderStruc PTR ds:[esi]).dProcessorFlags, edx;Platform matched?
+ jnz luFoundMatch ; Yes.
+
+luCheckUnprogrammed:
+ mov ebx, (UpdateHeaderStruc PTR ds:[esi]).dDataSize
+ cmp ebx, 0FFFFFFFFh
+ je luUnprogrammed
+ cmp (UpdateHeaderStruc PTR ds:[esi]).dLoaderRevision, 1
+ je luCheckExtdHdrs
+
+luUnprogrammed:
+ mov ebx, 1024 ; Unprogrammed space, 1KB checks
+ jmp luPoinToNextBlock ; for backword compatibility.
+
+luCheckExtdHdrs:
+ add ebx, SIZEOF(UpdateHeaderStruc)
+ cmp ebx, (UpdateHeaderStruc PTR ds:[esi]).dTotalSize
+ jae luTryNextPatch ; No extd hdrs.
+
+ mov ecx, DWORD PTR ds:[esi + ebx]
+ jcxz luTryNextPatch ; No extd hdrs. (OK to use CX instead of ECX).
+ add ebx, 20 ; Point to the first Extd Sig.
+luNextSig:
+ cmp eax, DWORD PTR ds:[esi + ebx] ;Sig matched?
+ jne lu_00
+ test edx, DWORD PTR ds:[esi + ebx + 4] ;Platform matched?
+ jnz luFoundMatch
+lu_00:
+ add ebx, 12
+ loop luNextSig
+
+luTryNextPatch:
+ mov ebx, (UpdateHeaderStruc PTR ds:[esi]).dTotalSize
+ or ebx, ebx
+ jnz luPoinToNextBlock ; Variable size uCode format.
+ mov ebx, BLOCK_LENGTH_BYTES ; Fixed size uCode format.
+
+;
+; Add alignment check - begin
+;
+ test ebx, 0400h
+ jz @F
+ add ebx, 0400h
+@@:
+;
+; Add alignment check - end
+;
+
+luPoinToNextBlock:
+ add esi, ebx
+ cmp esi, edi
+ jb luCheckPatch ; Check with all patches.
+
+ ; Check possible multiple patch
+ movd eax, mm3
+ movd esi, mm4
+ or eax, eax
+ jnz luLoadPatch
+ jmp luExit ; No matching patch found.
+
+luFoundMatch:
+; MM3 = Patch Revision
+; MM4 = Patch Pointer
+ movd ebx, mm3
+ cmp (UpdateHeaderStruc PTR ds:[esi]).dUpdateRevision, ebx
+ jb luTryNextPatch
+
+ mov ebx, (UpdateHeaderStruc PTR ds:[esi]).dUpdateRevision
+
+luStoreRevPtr:
+ movd mm3, ebx ; save Patch Revision
+ movd mm4, esi ; save Patch Pointer
+ jmp luTryNextPatch
+
+luLoadPatch:
+ mov ecx, IA32_BIOS_UPDT_TRIG
+ mov eax, esi ; EAX - Abs addr of uCode patch.
+ add eax, SIZEOF(UpdateHeaderStruc) ; EAX - Abs addr of uCode data.
+ xor edx, edx ; EDX:EAX - Abs addr of uCode data.
+ wrmsr ; Trigger uCode load.
+
+luExit:
+
+ENDIF
+
+ RET_EBP
+VeryEarlyMicrocodeUpdate ENDP
+
+
+; STATUS_CODE (09h)
+;************************************************************
+; Description:
+;
+; This function initializes the Cache for Data, Stack, and Code
+; as specified in the BIOS Writer's Guide.
+;************************************************************
+InitializeNEM PROC NEAR PRIVATE
+IFDEF BOOT_GUARD_SUPPORT_FLAG
+ ;
+ ; Detect Boot Guard Boot
+ ;
+ mov ecx, MSR_BOOT_GUARD_SACM_INFO ;
+ rdmsr
+ and eax, 01h
+ jnz BootGuardNemSetup
+ENDIF
+
+ ;
+ ; Enable cache for use as stack and for caching code
+ ; The algorithm is specified in the processor BIOS writer's guide
+ ;
+
+ ;
+ ; Ensure that the system is in flat 32 bit protected mode.
+ ;
+ ; Platform Specific - configured earlier
+ ;
+ ; Ensure that only one logical processor in the system is the BSP.
+ ; (Required step for clustered systems).
+ ;
+ ; Platform Specific - configured earlier
+
+ ; Ensure all APs are in the Wait for SIPI state.
+ ; This includes all other logical processors in the same physical processor
+ ; as the BSP and all logical processors in other physical processors.
+ ; If any APs are awake, the BIOS must put them back into the Wait for
+ ; SIPI state by issuing a broadcast INIT IPI to all excluding self.
+ ;
+ mov edi, APIC_ICR_LO ; 0FEE00300h - Send INIT IPI to all excluding self
+ mov eax, ORAllButSelf + ORSelfINIT ; 0000C4500h
+ mov [edi], eax
+
+@@:
+ mov eax, [edi]
+ bt eax, 12 ; Check if send is in progress
+ jc @B ; Loop until idle
+
+ ;
+ ; Load microcode update into BSP.
+ ;
+ ; Ensure that all variable-range MTRR valid flags are clear and
+ ; IA32_MTRR_DEF_TYPE MSR E flag is clear. Note: This is the default state
+ ; after hardware reset.
+ ;
+ ; Platform Specific - MTRR are usually in default state.
+ ;
+
+ ;
+ ; Initialize all fixed-range and variable-range MTRR register fields to 0.
+ ;
+ mov ecx, IA32_MTRR_CAP ; get variable MTRR support
+ rdmsr
+ movzx ebx, al ; EBX = number of variable MTRR pairs
+ shl ebx, 2 ; *4 for Base/Mask pair and WORD size
+ add ebx, MtrrCountFixed * 2 ; EBX = size of Fixed and Variable MTRRs
+
+ xor eax, eax ; Clear the low dword to write
+ xor edx, edx ; Clear the high dword to write
+ ;;;mov ebx, MtrrCount * 2 ; ebx <- sizeof MtrrInitTable
+InitMtrrLoop:
+ add ebx, -2
+ movzx ecx, WORD PTR cs:MtrrInitTable[ebx] ; ecx <- address of mtrr to zero
+ wrmsr
+ jnz InitMtrrLoop ; loop through the whole table
+
+ ;
+ ; Configure the default memory type to un-cacheable (UC) in the
+ ; IA32_MTRR_DEF_TYPE MSR.
+ ;
+ mov ecx, MTRR_DEF_TYPE ; Load the MTRR default type index
+ rdmsr
+ and eax, NOT (00000CFFh) ; Clear the enable bits and def type UC.
+ wrmsr
+
+ ; Configure MTRR_PHYS_MASK_HIGH for proper addressing above 4GB
+ ; based on the physical address size supported for this processor
+ ; This is based on read from CPUID EAX = 080000008h, EAX bits [7:0]
+ ;
+ ; Examples:
+ ; MTRR_PHYS_MASK_HIGH = 00000000Fh For 36 bit addressing
+ ; MTRR_PHYS_MASK_HIGH = 0000000FFh For 40 bit addressing
+ ;
+ mov eax, 80000008h ; Address sizes leaf
+ cpuid
+ sub al, 32
+ movzx eax, al
+ xor esi, esi
+ bts esi, eax
+ dec esi ; esi <- MTRR_PHYS_MASK_HIGH
+
+ ;
+ ; Configure the DataStack region as write-back (WB) cacheable memory type
+ ; using the variable range MTRRs.
+ ;
+
+ ;
+ ; Set the base address of the DataStack cache range
+ ;
+; mov eax, PcdGet32 (PcdTemporaryRamBase)
+ mov eax, TEMPORARY_RAM_BASE_ADDRESS
+ or eax, MTRR_MEMORY_TYPE_WB
+ ; Load the write-back cache value
+ xor edx, edx ; clear upper dword
+ mov ecx, MTRR_PHYS_BASE_0 ; Load the MTRR index
+ wrmsr ; the value in MTRR_PHYS_BASE_0
+
+ ;
+ ; Set the mask for the DataStack cache range
+ ; Compute MTRR mask value: Mask = NOT (Size - 1)
+ ;
+; mov eax, PcdGet32 (PcdTemporaryRamSize)
+ mov eax, TEMPORARY_RAM_SIZE
+ dec eax
+ not eax
+ or eax, MTRR_PHYS_MASK_VALID
+ ; turn on the Valid flag
+ mov edx, esi ; edx <- MTRR_PHYS_MASK_HIGH
+ mov ecx, MTRR_PHYS_MASK_0 ; For proper addressing above 4GB
+ wrmsr ; the value in MTRR_PHYS_BASE_0
+
+ ;
+ ; Configure the BIOS code region as write-protected (WP) cacheable
+ ; memory type using a single variable range MTRR.
+ ;
+ ; Platform Specific - ensure region to cache meets MTRR requirements for
+ ; size and alignment.
+ ;
+
+ ;
+ ; Save MM5 into ESP before program MTRR, because program MTRR will use MM5 as the local variable.
+ ; And, ESP is not initialized before CAR is enabled. So, it is safe ot use ESP here.
+ ;
+ movd esp, mm5
+
+ ;
+ ; Get total size of cache from PCD if it need fix value
+ ;
+; mov eax, PcdGet32 (PcdNemCodeCacheSize)
+ mov eax, CODE_CACHE_SIZE
+ ;
+ ; Calculate NEM size
+ ; Determine LLC size by following RS - Haswell Processor Family BIOS Writer's Guide (BWG) 0.3.0
+ ; Section 4.4.5 - The size of the code region and data region combined must not exceed the size
+ ; of the (Last Level Cache - 0.5MB).
+ ;
+ ; Determine Cache Parameter by CPUID Function 04h
+ ;
+ xor ecx, ecx
+ xor edi, edi
+
+Find_LLC_parameter:
+ mov ecx, edi
+ mov eax, 4
+ cpuid
+ inc edi
+ and eax, 01Fh ; If EAX[4:0]=0, which indicates no more caches, then we can get LLC parameters
+ jnz Find_LLC_parameter
+ ;
+ ; LLC configuration is pointed to edi-2
+ ;
+ dec edi
+ dec edi
+ mov ecx, edi
+ mov eax, 4
+ cpuid
+ ;
+ ; Got LLC parameters
+ ;
+ ; This Cache Size in Bytes = (Ways + 1) * (Partitions + 1) * (Line_Size + 1) * (Sets + 1)
+ ; = (EBX[31:22] + 1) * (EBX[21:12] + 1) * (EBX[11:0] + 1) * (ECX + 1)
+ ;
+ mov eax, ecx
+ inc eax
+ mov edi, ebx
+ shr ebx, 22
+ inc ebx
+ mul ebx
+ mov ebx, edi
+ and ebx, NOT 0FFC00FFFh
+ shr ebx, 12
+ inc ebx
+ mul ebx
+ mov ebx, edi
+ and ebx, 0FFFh
+ inc ebx
+ mul ebx
+ ;
+ ; Maximum NEM size <= (Last Level Cache - 0.5MB)
+ ;
+ sub eax, 512*1024
+Got_NEM_size:
+ ;
+ ; Code cache size = Total NEM size - DataStack size
+ ;
+; sub eax, PcdGet32 (PcdTemporaryRamSize)
+ sub eax, TEMPORARY_RAM_SIZE
+ ;
+ ; Set the base address of the CodeRegion cache range from PCD
+ ; PcdNemCodeCacheBase is set to the offset to flash base,
+ ; so add PcdFlashAreaBaseAddress to get the real code base address.
+ ;
+; mov edi, PcdGet32 (PcdNemCodeCacheBase)
+; add edi, PcdGet32 (PcdFlashAreaBaseAddress)
+ mov edi, CODE_CACHE_BASE_ADDRESS
+ add edi, FLASH_AREA_BASE_ADDRESS
+
+ ;
+ ; Round up to page size
+ ;
+ mov ecx, eax ; Save
+ and ecx, 0FFFF0000h ; Number of pages in 64K
+ and eax, 0FFFFh ; Number of "less-than-page" bytes
+ jz Rounded
+ mov eax, 10000h ; Add the whole page size
+
+Rounded:
+ add eax, ecx ; eax - rounded up code cache size
+
+ ;
+ ; Define "local" vars for this routine
+ ; Note that mm0 is used to store BIST result for BSP,
+ ; mm1 is used to store the number of processor and BSP APIC ID,
+ ; mm6 is used to save time-stamp counter value.
+ ;
+ CODE_SIZE_TO_CACHE TEXTEQU <mm3>
+ CODE_BASE_TO_CACHE TEXTEQU <mm4>
+ NEXT_MTRR_INDEX TEXTEQU <mm5>
+ NEXT_MTRR_SIZE TEXTEQU <mm2>
+ ;
+ ; Initialize "locals"
+ ;
+ sub ecx, ecx
+ movd NEXT_MTRR_INDEX, ecx ; Count from 0 but start from MTRR_PHYS_BASE_1
+
+ ;
+ ; Save remaining size to cache
+ ;
+ movd CODE_SIZE_TO_CACHE, eax ; Size of code cache region that must be cached
+ movd CODE_BASE_TO_CACHE, edi ; Base code cache address
+
+NextMtrr:
+ ;
+ ; Get remaining size to cache
+ ;
+ movd eax, CODE_SIZE_TO_CACHE
+ and eax, eax
+ jz CodeRegionMtrrdone ; If no left size - we are done
+ ;
+ ; Determine next size to cache.
+ ; We start from bottom up. Use the following algorythm:
+ ; 1. Get our own alignment. Max size we can cache equals to our alignment
+ ; 2. Determine what is bigger - alignment or remaining size to cache.
+ ; If aligment is bigger - cache it.
+ ; Adjust remaing size to cache and base address
+ ; Loop to 1.
+ ; If remaining size to cache is bigger
+ ; Determine the biggest 2^N part of it and cache it.
+ ; Adjust remaing size to cache and base address
+ ; Loop to 1.
+ ; 3. End when there is no left size to cache or no left MTRRs
+ ;
+ movd edi, CODE_BASE_TO_CACHE
+ bsf ecx, edi ; Get index of lowest bit set in base address
+ ;
+ ; Convert index into size to be cached by next MTRR
+ ;
+ mov edx, 1h
+ shl edx, cl ; Alignment is in edx
+ cmp edx, eax ; What is bigger, alignment or remaining size?
+ jbe gotSize ; JIf aligment is less
+ ;
+ ; Remaining size is bigger. Get the biggest part of it, 2^N in size
+ ;
+ bsr ecx, eax ; Get index of highest set bit
+ ;
+ ; Convert index into size to be cached by next MTRR
+ ;
+ mov edx, 1
+ shl edx, cl ; Size to cache
+
+GotSize:
+ mov eax, edx
+ movd NEXT_MTRR_SIZE, eax ; Save
+
+ ;
+ ; Compute MTRR mask value: Mask = NOT (Size - 1)
+ ;
+ dec eax ; eax - size to cache less one byte
+ not eax ; eax contains low 32 bits of mask
+ or eax, MTRR_PHYS_MASK_VALID ; Set valid bit
+
+ ;
+ ; Program mask register
+ ;
+ mov ecx, MTRR_PHYS_MASK_1 ; setup variable mtrr
+ movd ebx, NEXT_MTRR_INDEX
+ add ecx, ebx
+
+ mov edx, esi ; edx <- MTRR_PHYS_MASK_HIGH
+ wrmsr
+ ;
+ ; Program base register
+ ;
+ sub edx, edx
+ mov ecx, MTRR_PHYS_BASE_1 ; setup variable mtrr
+ add ecx, ebx ; ebx is still NEXT_MTRR_INDEX
+
+ movd eax, CODE_BASE_TO_CACHE
+ or eax, MTRR_MEMORY_TYPE_WP ; set type to write protect
+ wrmsr
+ ;
+ ; Advance and loop
+ ; Reduce remaining size to cache
+ ;
+ movd ebx, CODE_SIZE_TO_CACHE
+ movd eax, NEXT_MTRR_SIZE
+ sub ebx, eax
+ movd CODE_SIZE_TO_CACHE, ebx
+
+ ;
+ ; Increment MTRR index
+ ;
+ movd ebx, NEXT_MTRR_INDEX
+ add ebx, 2
+ movd NEXT_MTRR_INDEX, ebx
+ ;
+ ; Increment base address to cache
+ ;
+ movd ebx, CODE_BASE_TO_CACHE
+ movd eax, NEXT_MTRR_SIZE
+ add ebx, eax
+ ;
+ ; if carry happens, means NEM base + size over 4G
+ ;
+ jc CodeRegionMtrrdone
+ movd CODE_BASE_TO_CACHE, ebx
+
+ jmp NextMtrr
+
+CodeRegionMtrrdone:
+ ; Program the variable MTRR's MASK register for WDB
+ ; (Write Data Buffer, used in MRC, must be WC type)
+ ;
+ mov ecx, MTRR_PHYS_MASK_1
+ movd ebx, NEXT_MTRR_INDEX
+ add ecx, ebx
+ mov edx, esi ; edx <- MTRR_PHYS_MASK_HIGH
+ mov eax, WDB_REGION_SIZE_MASK OR MTRR_PHYS_MASK_VALID ; turn on the Valid flag
+ wrmsr
+
+ ;
+ ; Program the variable MTRR's BASE register for WDB
+ ;
+ dec ecx
+ xor edx, edx
+ mov eax, WDB_REGION_BASE_ADDRESS OR MTRR_MEMORY_TYPE_WC
+ wrmsr
+
+ ;
+ ; Enable the MTRRs by setting the IA32_MTRR_DEF_TYPE MSR E flag.
+ ;
+ mov ecx, MTRR_DEF_TYPE ; Load the MTRR default type index
+ rdmsr
+ or eax, MTRR_DEF_TYPE_E ; Enable variable range MTRRs
+ wrmsr
+
+ ;
+ ; Enable the logical processor's (BSP) cache: execute INVD and set
+ ; CR0.CD = 0, CR0.NW = 0.
+ ;
+ mov eax, cr0
+ and eax, NOT (CR0_CACHE_DISABLE + CR0_NO_WRITE)
+ invd
+ mov cr0, eax
+ ;
+ ; Enable No-Eviction Mode Setup State by setting
+ ; NO_EVICT_MODE MSR 2E0h bit [0] = '1'.
+ ;
+ mov ecx, NO_EVICT_MODE
+ rdmsr
+ or eax, 1
+ wrmsr
+
+ ;
+ ; Restore MM5 from ESP after program MTRR
+ ;
+ movd mm5, esp
+
+ ;
+ ; One location in each 64-byte cache line of the DataStack region
+ ; must be written to set all cache values to the modified state.
+ ;
+; mov edi, PcdGet32 (PcdTemporaryRamBase)
+; mov ecx, PcdGet32 (PcdTemporaryRamSize)
+ mov edi, TEMPORARY_RAM_BASE_ADDRESS
+ mov ecx, TEMPORARY_RAM_SIZE
+ shr ecx, 6
+ mov eax, CACHE_INIT_VALUE
+@@:
+ mov [edi], eax
+ sfence
+ add edi, 64
+ loopd @b
+
+ ;
+ ; Enable No-Eviction Mode Run State by setting
+ ; NO_EVICT_MODE MSR 2E0h bit [1] = '1'.
+ ;
+ mov ecx, NO_EVICT_MODE
+ rdmsr
+ or eax, 2
+ wrmsr
+
+IFDEF BOOT_GUARD_SUPPORT_FLAG
+ jmp FinishedCacheConfig
+
+ ;
+ ; Jump to here when Boot Guard boot and NEM is initialized by Boot Guard ACM
+ ;
+BootGuardNemSetup:
+ ;
+ ; Finished with cache configuration
+ ;
+ ; Configure MTRR_PHYS_MASK_HIGH for proper addressing above 4GB
+ ; based on the physical address size supported for this processor
+ ; This is based on read from CPUID EAX = 080000008h, EAX bits [7:0]
+ ;
+ ; Examples:
+ ; MTRR_PHYS_MASK_HIGH = 00000000Fh For 36 bit addressing
+ ; MTRR_PHYS_MASK_HIGH = 0000000FFh For 40 bit addressing
+ ;
+ mov eax, 80000008h ; Address sizes leaf
+ cpuid
+ sub al, 32
+ movzx eax, al
+ xor esi, esi
+ bts esi, eax
+ dec esi ; esi <- MTRR_PHYS_MASK_HIGH
+
+ ;
+ ; Configure the DataStack region as write-back (WB) cacheable memory type
+ ; using the variable range MTRRs.
+ ;
+ ;
+ ; Find available MTRR
+ ;
+ CALL_EBP FindFreeMtrr
+
+ ;
+ ; Set the base address of the DataStack cache range
+ ;
+; mov eax, PcdGet32 (PcdTemporaryRamBase)
+ mov eax, TEMPORARY_RAM_BASE_ADDRESS
+ or eax, MTRR_MEMORY_TYPE_WB
+ ; Load the write-back cache value
+ xor edx, edx ; clear upper dword
+ wrmsr ; the value in MTRR_PHYS_BASE_0
+
+ ;
+ ; Set the mask for the DataStack cache range
+ ; Compute MTRR mask value: Mask = NOT (Size - 1)
+ ;
+; mov eax, PcdGet32 (PcdTemporaryRamSize)
+ mov eax, TEMPORARY_RAM_SIZE
+ dec eax
+ not eax
+ or eax, MTRR_PHYS_MASK_VALID
+ ; turn on the Valid flag
+ mov edx, esi ; edx <- MTRR_PHYS_MASK_HIGH
+ inc ecx
+ wrmsr ; the value in MTRR_PHYS_BASE_0
+
+ ;
+ ; Program the variable MTRR's MASK register for WDB
+ ; (Write Data Buffer, used in MRC, must be WC type)
+ ;
+
+ ;
+ ; Find available MTRR
+ ;
+ CALL_EBP FindFreeMtrr
+
+FoundAvailableMtrr:
+ ;
+ ; Program the variable MTRR's BASE register for WDB
+ ;
+ xor edx, edx
+ mov eax, WDB_REGION_BASE_ADDRESS OR MTRR_MEMORY_TYPE_WC
+ wrmsr
+
+ inc ecx
+ mov edx, esi ; edx <- MTRR_PHYS_MASK_HIGH
+ mov eax, WDB_REGION_SIZE_MASK OR MTRR_PHYS_MASK_VALID ; turn on the Valid flag
+ wrmsr
+
+ ;
+ ; One location in each 64-byte cache line of the DataStack region
+ ; must be written to set all cache values to the modified state.
+ ;
+; mov edi, PcdGet32 (PcdTemporaryRamBase)
+; mov ecx, PcdGet32 (PcdTemporaryRamSize)
+ mov edi, TEMPORARY_RAM_BASE_ADDRESS
+ mov ecx, TEMPORARY_RAM_SIZE
+ shr ecx, 6
+ mov eax, CACHE_INIT_VALUE
+@@:
+ mov [edi], eax
+ sfence
+ add edi, 64
+ loopd @b
+ENDIF
+
+ ;
+ ; Finished with cache configuration
+ ;
+FinishedCacheConfig:
+
+ ;
+ ; Optionally Test the Region...
+ ;
+
+ ;
+ ; Test area by writing and reading
+ ;
+ cld
+; mov edi, PcdGet32 (PcdTemporaryRamBase)
+; mov ecx, PcdGet32 (PcdTemporaryRamSize)
+ mov edi, TEMPORARY_RAM_BASE_ADDRESS
+ mov ecx, TEMPORARY_RAM_SIZE
+ shr ecx, 2
+ mov eax, CACHE_TEST_VALUE
+TestDataStackArea:
+ stosd
+ cmp eax, DWORD PTR [edi-4]
+ jnz DataStackTestFail
+ loop TestDataStackArea
+ jmp DataStackTestPass
+
+ ;
+ ; Cache test failed
+ ;
+DataStackTestFail:
+ STATUS_CODE (0D0h)
+ jmp $
+
+ ;
+ ; Configuration test failed
+ ;
+ConfigurationTestFailed:
+ STATUS_CODE (0D1h)
+ jmp $
+
+DataStackTestPass:
+
+ ;
+ ; At this point you may continue normal execution. Typically this would include
+ ; reserving stack, initializing the stack pointer, etc.
+ ;
+
+ ;
+ ; After memory initialization is complete, please follow the algorithm in the BIOS
+ ; Writer's Guide to properly transition to a normal system configuration.
+ ; The algorithm covers the required sequence to properly exit this mode.
+ ;
+
+ RET_ESI
+
+InitializeNEM ENDP
+
+; STATUS_CODE (09h)
+EstablishStack PROC NEAR PRIVATE
+
+ ;
+ ; Enable STACK
+ ;
+ RET_ESI
+
+EstablishStack ENDP
+
+FindFreeMtrr PROC NEAR PRIVATE
+ mov ecx, MTRR_PHYS_MASK_0
+
+@@:
+ rdmsr
+ test eax, 800h
+ jz FoundFreeMtrr
+ add ecx, 2
+ cmp ecx, MTRR_PHYS_MASK_9
+ jbe @b
+ ;
+ ; No available MTRR, halt system
+ ;
+ jmp $
+
+FoundFreeMtrr:
+ dec ecx
+
+ RET_EBP
+
+FindFreeMtrr ENDP
+
+; STATUS_CODE (0Bh)
+CallPeiCoreEntryPoint PROC NEAR PRIVATE
+ ;
+ ; Set stack top pointer
+ ;
+; mov esp, PcdGet32 (PcdTemporaryRamBase)
+; add esp, PcdGet32 (PcdTemporaryRamSize)
+ mov esp, TEMPORARY_RAM_BASE_ADDRESS
+ add esp, TEMPORARY_RAM_SIZE
+
+ ;
+ ; Push CPU count to stack first, then AP's (if there is one)
+ ; BIST status, and then BSP's
+ ;
+
+ ;
+ ; Here work around for BIST
+ ;
+ ; Get number of BSPs
+ movd ecx, mm1
+ movzx ecx, ch
+
+ ; Save number of BSPs
+ push ecx
+
+GetSBSPBist:
+ ; Save SBSP BIST
+ movd eax, mm0
+ push eax
+
+ ; Save SBSP APIC ID
+ movd eax, mm1
+ shr eax, BSPApicIDSaveStart ; Resume APIC ID
+ push eax
+
+ ; Save Time-Stamp Counter
+ movd eax, mm5
+ push eax
+
+ movd eax, mm6
+ push eax
+
+TransferToSecStartup:
+
+
+
+ ; Switch to "C" code
+ STATUS_CODE (0Ch)
+ ;
+ ; Pass entry point of the PEI core
+ ;
+ mov edi, PEI_CORE_ENTRY_BASE ; 0FFFFFFE0h
+ push DWORD PTR ds:[edi]
+
+ ;
+ ; Pass BFV into the PEI Core
+ ;
+ mov edi, FV_MAIN_BASE ; 0FFFFFFFCh
+ push DWORD PTR ds:[edi]
+
+ ; ECPoverride: SecStartup entry point needs 4 parameters
+; push PcdGet32 (PcdTemporaryRamBase)
+ push TEMPORARY_RAM_BASE_ADDRESS
+
+ ;
+ ; Pass stack size into the PEI Core
+ ;
+; push PcdGet32 (PcdTemporaryRamSize)
+ push TEMPORARY_RAM_SIZE
+
+ ;
+ ; Pass Control into the PEI Core
+ ;
+ call SecStartup
+CallPeiCoreEntryPoint ENDP
+
+StartUpAp PROC NEAR
+
+ mov esi, HPET_COMP_2
+ lock inc byte ptr [esi]
+
+ DISABLE_CACHE
+;
+; Halt the AP and wait for the next SIPI
+;
+Ap_Halt:
+ cli
+@@:
+ hlt
+ jmp @B
+ ret
+StartUpAp ENDP
+
+
+CheckValidCMOS PROC NEAR PRIVATE
+ ;
+ ; Check CMOS Status
+ ;
+ mov esi, PCH_LPC_GEN_PMCON_3_ADDR
+ mov eax, es:[esi]
+
+ ; check PWR_FLR and RTC_PWR_STS status
+ and eax, BIT2 + BIT1
+
+ RET_EBP
+CheckValidCMOS ENDP
+
+MtrrInitTable LABEL BYTE
+ DW MTRR_DEF_TYPE
+ DW MTRR_FIX_64K_00000
+ DW MTRR_FIX_16K_80000
+ DW MTRR_FIX_16K_A0000
+ DW MTRR_FIX_4K_C0000
+ DW MTRR_FIX_4K_C8000
+ DW MTRR_FIX_4K_D0000
+ DW MTRR_FIX_4K_D8000
+ DW MTRR_FIX_4K_E0000
+ DW MTRR_FIX_4K_E8000
+ DW MTRR_FIX_4K_F0000
+ DW MTRR_FIX_4K_F8000
+
+MtrrCountFixed EQU (($ - MtrrInitTable) / 2)
+
+ DW MTRR_PHYS_BASE_0
+ DW MTRR_PHYS_MASK_0
+ DW MTRR_PHYS_BASE_1
+ DW MTRR_PHYS_MASK_1
+ DW MTRR_PHYS_BASE_2
+ DW MTRR_PHYS_MASK_2
+ DW MTRR_PHYS_BASE_3
+ DW MTRR_PHYS_MASK_3
+ DW MTRR_PHYS_BASE_4
+ DW MTRR_PHYS_MASK_4
+ DW MTRR_PHYS_BASE_5
+ DW MTRR_PHYS_MASK_5
+ DW MTRR_PHYS_BASE_6
+ DW MTRR_PHYS_MASK_6
+ DW MTRR_PHYS_BASE_7
+ DW MTRR_PHYS_MASK_7
+ DW MTRR_PHYS_BASE_8
+ DW MTRR_PHYS_MASK_8
+ DW MTRR_PHYS_BASE_9
+ DW MTRR_PHYS_MASK_9
+MtrrCount EQU (($ - MtrrInitTable) / 2)
+
+align 10h
+PUBLIC BootGDTtable
+
+;
+; GDT[0]: 0x00: Null entry, never used.
+;
+NULL_SEL EQU $ - GDT_BASE ; Selector [0]
+GDT_BASE:
+BootGDTtable DD 0
+ DD 0
+;
+; Linear data segment descriptor
+;
+LINEAR_SEL EQU $ - GDT_BASE ; Selector [0x8]
+ DW 0FFFFh ; limit 0xFFFFF
+ DW 0 ; base 0
+ DB 0
+ DB 092h ; present, ring 0, data, expand-up, writable
+ DB 0CFh ; page-granular, 32-bit
+ DB 0
+;
+; Linear code segment descriptor
+;
+LINEAR_CODE_SEL EQU $ - GDT_BASE ; Selector [0x10]
+ DW 0FFFFh ; limit 0xFFFFF
+ DW 0 ; base 0
+ DB 0
+ DB 09Bh ; present, ring 0, data, expand-up, not-writable
+ DB 0CFh ; page-granular, 32-bit
+ DB 0
+;
+; System data segment descriptor
+;
+SYS_DATA_SEL EQU $ - GDT_BASE ; Selector [0x18]
+ DW 0FFFFh ; limit 0xFFFFF
+ DW 0 ; base 0
+ DB 0
+ DB 093h ; present, ring 0, data, expand-up, not-writable
+ DB 0CFh ; page-granular, 32-bit
+ DB 0
+
+;
+; System code segment descriptor
+;
+SYS_CODE_SEL EQU $ - GDT_BASE ; Selector [0x20]
+ DW 0FFFFh ; limit 0xFFFFF
+ DW 0 ; base 0
+ DB 0
+ DB 09Ah ; present, ring 0, data, expand-up, writable
+ DB 0CFh ; page-granular, 32-bit
+ DB 0
+;
+; Spare segment descriptor
+;
+SYS16_CODE_SEL EQU $ - GDT_BASE ; Selector [0x28]
+ DW 0FFFFh ; limit 0xFFFFF
+ DW 0 ; base 0
+ DB 0Eh ; Changed from F000 to E000.
+ DB 09Bh ; present, ring 0, code, expand-up, writable
+ DB 00h ; byte-granular, 16-bit
+ DB 0
+;
+; Spare segment descriptor
+;
+SYS16_DATA_SEL EQU $ - GDT_BASE ; Selector [0x30]
+ DW 0FFFFh ; limit 0xFFFF
+ DW 0 ; base 0
+ DB 0
+ DB 093h ; present, ring 0, data, expand-up, not-writable
+ DB 00h ; byte-granular, 16-bit
+ DB 0
+
+;
+; Spare segment descriptor
+;
+SPARE5_SEL EQU $ - GDT_BASE ; Selector [0x38]
+ DW 0 ; limit 0
+ DW 0 ; base 0
+ DB 0
+ DB 0 ; present, ring 0, data, expand-up, writable
+ DB 0 ; page-granular, 32-bit
+ DB 0
+GDT_SIZE EQU $ - BootGDTtable ; Size, in bytes
+
+GdtDesc: ; GDT descriptor
+OffsetGDTDesc EQU $ - _ModuleEntryPoint
+ DW GDT_SIZE - 1 ; GDT limit
+ DD OFFSET BootGDTtable ; GDT base address
+
+NemInitLinearAddress LABEL FWORD
+NemInitLinearOffset LABEL DWORD
+ DD OFFSET ProtectedModeSECStart ; Offset of our 32 bit code
+ DW LINEAR_CODE_SEL
+
+TopOfCar DD TEMPORARY_RAM_BASE_ADDRESS + TEMPORARY_RAM_SIZE
+
+_TEXT_PROTECTED_MODE ENDS
+END
diff --git a/ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/Ia32.inc b/ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/Ia32.inc
new file mode 100644
index 0000000..d799a1e
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/Ia32.inc
@@ -0,0 +1,164 @@
+;@file
+; IA32 architecture MSRs
+;
+;@copyright
+; Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+; This software and associated documentation (if any) is furnished
+; under a license and may only be used or copied in accordance
+; with the terms of the license. Except as permitted by such
+; license, no part of this software or documentation may be
+; reproduced, stored in a retrieval system, or transmitted in any
+; form or by any means without the express written consent of
+; Intel Corporation.
+;
+; This file contains a 'Sample Driver' and is licensed as such
+; under the terms of your license agreement with Intel or your
+; vendor. This file may be modified by the user, subject to
+; the additional terms of the license agreement
+;
+
+IA32_MTRR_CAP EQU 0FEh
+MTRR_PHYS_BASE_0 EQU 0200h
+MTRR_PHYS_MASK_0 EQU 0201h
+MTRR_PHYS_BASE_1 EQU 0202h
+MTRR_PHYS_MASK_1 EQU 0203h
+MTRR_PHYS_BASE_2 EQU 0204h
+MTRR_PHYS_MASK_2 EQU 0205h
+MTRR_PHYS_BASE_3 EQU 0206h
+MTRR_PHYS_MASK_3 EQU 0207h
+MTRR_PHYS_BASE_4 EQU 0208h
+MTRR_PHYS_MASK_4 EQU 0209h
+MTRR_PHYS_BASE_5 EQU 020Ah
+MTRR_PHYS_MASK_5 EQU 020Bh
+MTRR_PHYS_BASE_6 EQU 020Ch
+MTRR_PHYS_MASK_6 EQU 020Dh
+MTRR_PHYS_BASE_7 EQU 020Eh
+MTRR_PHYS_MASK_7 EQU 020Fh
+MTRR_PHYS_BASE_8 EQU 0210h
+MTRR_PHYS_MASK_8 EQU 0211h
+MTRR_PHYS_BASE_9 EQU 0212h
+MTRR_PHYS_MASK_9 EQU 0213h
+MTRR_FIX_64K_00000 EQU 0250h
+MTRR_FIX_16K_80000 EQU 0258h
+MTRR_FIX_16K_A0000 EQU 0259h
+MTRR_FIX_4K_C0000 EQU 0268h
+MTRR_FIX_4K_C8000 EQU 0269h
+MTRR_FIX_4K_D0000 EQU 026Ah
+MTRR_FIX_4K_D8000 EQU 026Bh
+MTRR_FIX_4K_E0000 EQU 026Ch
+MTRR_FIX_4K_E8000 EQU 026Dh
+MTRR_FIX_4K_F0000 EQU 026Eh
+MTRR_FIX_4K_F8000 EQU 026Fh
+MTRR_DEF_TYPE EQU 02FFh
+
+MTRR_MEMORY_TYPE_UC EQU 00h
+MTRR_MEMORY_TYPE_WC EQU 01h
+MTRR_MEMORY_TYPE_WT EQU 04h
+MTRR_MEMORY_TYPE_WP EQU 05h
+MTRR_MEMORY_TYPE_WB EQU 06h
+
+MTRR_DEF_TYPE_E EQU 0800h
+MTRR_DEF_TYPE_FE EQU 0400h
+MTRR_PHYSMASK_VALID EQU 0800h
+
+;
+; Define the high 32 bits of MTRR masking
+; This should be read from CPUID EAX = 080000008h, EAX bits [7:0]
+; But for most platforms this will be a fixed supported size so it is
+; fixed to save space.
+;
+MTRR_PHYS_MASK_VALID EQU 0800h
+MTRR_PHYS_MASK_HIGH EQU 00000000Fh ; For 36 bit addressing
+;MTRR_PHYS_MASK_HIGH EQU 0000000FFh ; For 40 bit addressing
+
+IA32_MISC_ENABLE EQU 1A0h
+FAST_STRING_ENABLE_BIT EQU 01h
+
+CR0_CACHE_DISABLE EQU 040000000h
+CR0_NO_WRITE EQU 020000000h
+
+IA32_PLATFORM_ID EQU 017h
+IA32_BIOS_UPDT_TRIG EQU 079h
+IA32_BIOS_SIGN_ID EQU 08Bh
+PLATFORM_INFO EQU 0CEh
+NO_EVICT_MODE EQU 2E0h
+NO_EVICTION_ENABLE_BIT EQU 01h
+
+;
+; MSR definitions
+;
+MSR_IA32_PLATFORM_ID EQU 0017h
+MSR_APIC_BASE EQU 001Bh
+MSR_SOCKET_ID EQU 0039h
+MSR_IA32_FEATURE_CONTROL EQU 003Ah
+MSR_CLOCK_CST_CONFIG_CONTROL EQU 00E2h
+MSR_CLOCK_FLEX_MAX EQU 0194h
+MSR_IA32_PERF_STS EQU 0198h
+MSR_IA32_PERF_CTL EQU 0199h
+MSR_IA32_MISC_ENABLES EQU 01A0h
+MSR_IA32_MC8_MISC2 EQU 0288h
+MSR_IA32_MC7_CTL EQU 041Ch
+MSR_BOOT_GUARD_SACM_INFO EQU 013Ah
+
+;
+; Processor MSR definitions
+;
+MSR_BBL_CR_CTL3 EQU 011Eh ; L2 cache configuration MSR
+B_MSR_BBL_CR_CTL3_L2_NOT_PRESENT EQU 23 ; L2 not present
+B_MSR_BBL_CR_CTL3_L2_ENABLED EQU 8 ; L2 enabled
+B_MSR_BBL_CR_CTL3_L2_HARDWARE_ENABLED EQU 0 ; L2 hardware enabled
+
+P6RatioBitsMask EQU 01Fh ; Bitmask for cpu ratio
+P6_FREQ_LOCKED_BIT EQU 15d
+
+;
+; Local APIC Register Equates
+;
+LOCAL_APIC_ID_REG EQU 0FEE00020h
+APIC_ICR_HI EQU 0FEE00310h
+APIC_ICR_LO EQU 0FEE00300h
+ANDICRMask EQU 0FFF32000h ; AND mask for ICR Saving reserved bits
+ORSelfINIT EQU 000004500h ; OR mask to send INIT IPI to itself
+ORAllButSelf EQU 0000C0000h ; OR mask to set dest field = "All But Self"
+
+;
+; Cache control macro
+;
+DISABLE_CACHE macro
+ mov eax, cr0
+ or eax, CR0_CACHE_DISABLE + CR0_NO_WRITE
+ wbinvd
+ mov cr0, eax
+endm
+
+ENABLE_CACHE macro
+ mov eax, cr0
+ and eax, NOT (CR0_CACHE_DISABLE + CR0_NO_WRITE)
+ wbinvd
+ mov cr0, eax
+endm
+
+VENDOR_ID_REG EQU 0
+PCI_REVISION_ID_REG EQU 8
+CPU_GENERIC_UNCORE_DEV EQU 0
+CPU_GENERIC_UNCORE_FUNC EQU 0
+CPU_LINK_1_DEV EQU 2
+CPU_LINK_1_FUNC EQU 4
+
+B0_CPU_STEPPING EQU 10h
+
+BLOCK_LENGTH_BYTES EQU 2048
+
+UpdateHeaderStruc STRUC
+ dHeaderVersion dd ? ; Header version#
+ dUpdateRevision dd ? ; Update revision#
+ dDate dd ? ; Date in binary (08/13/07 as 0x08132007)
+ dProcessorSignature dd ? ; CPU type, family, model, stepping
+ dChecksum dd ? ; Checksum
+ dLoaderRevision dd ? ; Update loader version#
+ dProcessorFlags dd ? ; Processor Flags
+ dDataSize dd ? ; Size of encrypted data
+ dTotalSize dd ? ; Total size of update in bytes
+ bReserved db 12 dup(?) ; 12 bytes reserved
+UpdateHeaderStruc ENDS
+
diff --git a/ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/Platform.inc b/ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/Platform.inc
new file mode 100644
index 0000000..b49f518
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/Platform.inc
@@ -0,0 +1,196 @@
+;@file
+; Platform Specific Definitions
+;
+;@copyright
+; Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+; This software and associated documentation (if any) is furnished
+; under a license and may only be used or copied in accordance
+; with the terms of the license. Except as permitted by such
+; license, no part of this software or documentation may be
+; reproduced, stored in a retrieval system, or transmitted in any
+; form or by any means without the express written consent of
+; Intel Corporation.
+;
+; This file contains an 'Intel Peripheral Driver' and uniquely
+; identified as "Intel Reference Module" and is
+; licensed for Intel CPUs and chipsets under the terms of your
+; license agreement with Intel or your vendor. This file may
+; be modified by the user, subject to additional terms of the
+; license agreement
+;
+
+;(AMI_CHG-)INCLUDE FlashMap.inc
+
+; Set "MINIMUM_BOOT_SUPPORT" flag allows BIOS boot as minimum feature in SEC phase.
+MINIMUM_BOOT_SUPPORT EQU 0 ; ="0", Normal Boot;
+ ; ="1", Minimum Feature Boot
+; "RESET_IN_SEC" flag allows BIOS doing RESET in SEC phase
+RESET_IN_SEC EQU 0 ; ="0", RESET occurs in OemIohInit.c
+ ; ="1", RESET occurs in SEC phase
+
+EARLY_MICROCODE_SUPPORT EQU 1
+DETERMINISTIC_BSP_SUPPORT EQU 0
+DEBUG EQU 1
+
+;
+; IO port to access the upper 128-byte of RTC RAM
+;
+RTC_UPPER_INDEX EQU 072h
+RTC_UPPER_DATA EQU 073h
+
+;
+; Offset of data stored in the upper 128-byte of RTC RAM.
+;
+CMOS_CPU_BSP_SELECT EQU 010h ; BspSelection
+CMOS_CPU_UP_MODE EQU 011h ; UpBootSelection
+
+;
+; Cpu Ratio and Vid stored in the upper 128-byte of RTC RAM.
+;
+CMOS_CPU_RATIO_OFFSET EQU 012h ; ProcessorFlexibleRatio
+CMOS_CPU_CORE_HT_OFFSET EQU 013h ; ProcessorHyperThreadingEnable & EnableCoresInSbsp & EnableCoresInNbsp
+
+;
+; CPU Feature
+;
+CMOS_CPU_BIST_OFFSET EQU 015h ; ProcessorBistEnable
+CMOS_CPU_VMX_OFFSET EQU 016h ; ProcessorVmxEnable
+
+;
+; Port80 Selection
+;
+CMOS_PCH_PORT80_OFFSET EQU 017h ; PchPort80Route
+
+;
+;Flash layout map
+;
+PEICODE_REGION_BASE_ADDRESS EQU FLASH_BASE
+PEICODE_REGION_SIZE EQU FLASH_SIZE
+PEICODE_REGION_SIZE_MASK EQU (NOT (PEICODE_REGION_SIZE - 1))
+
+BIOS_REGION_UPDATABLE_STATUS EQU 0058h ; Offset
+;----------------------------------------------------------------------------------------
+; "Merlin" support used equates
+;----------------------------------------------------------------------------------------
+MAGIC_ADDRESS_IN_SEG EQU 0FFF0h
+MAGIC_SEG EQU 0F000h
+
+;
+; -- Equates for CAR initialization
+; TileSize (must be a power of 2)
+;
+; Define the tile size
+; The tile size and tile placement are critical to ensuring that no data loss occurs
+; See BWG - chapter "Determining Tile Size"
+;
+TILE_SIZE EQU 000000000h
+
+;
+; See BWG - chapter "Determining Cacheable Code Region Base Addresses and Ranges".
+;
+; Now FvRecovery is 6 blocks, so it is seperated into 2 parts to set MTRR:
+; 1. base address = FFFA0000, length = 0x20000
+; 2. base address = FFFC0000, length = 0x40000
+;
+; *** NOTE: If FvRecovery size changes, this code needs to be changed accordingly.
+; Possible enhancement is to dynamically accomodate size changes.
+;
+
+;(AMI_CHG)>
+;-CODE_REGION_BASE_ADDRESS_PART1 EQU FLASH_REGION_FV_RECOVERY_BASE
+;-CODE_REGION_SIZE_PART1 EQU (TILE_SIZE + (128*1024))
+
+MIN_CODE_REGION_SIZE EQU 40000h
+MIN_CODE_REGION_SIZE_MASK EQU (NOT (MIN_CODE_REGION_SIZE - 1))
+CODE_REGION_BASE_ADDRESS_PART1 EQU MKF_CODE_CACHE_BASE_ADDRESS AND 0ffff0000h
+IF MKF_CODE_CACHE_SIZE lt 100000h
+ CODE_REGION_SIZE_PART1 EQU 100000h
+ELSE
+ CODE_REGION_SIZE_PART1 EQU MKF_CODE_CACHE_SIZE
+ENDIF
+
+CODE_REGION_SIZE_MASK_PART1 EQU (NOT (CODE_REGION_SIZE_PART1 - 1))
+
+IF MKF_CODE_CACHE_PART2_BASE
+;-CODE_REGION_BASE_ADDRESS_PART2 EQU CODE_REGION_BASE_ADDRESS_PART1 + CODE_REGION_SIZE_PART1
+;-CODE_REGION_SIZE_PART2 EQU (TILE_SIZE + (256*1024))
+CODE_REGION_BASE_ADDRESS_PART2 EQU MKF_CODE_CACHE_PART2_BASE
+CODE_REGION_SIZE_PART2 EQU MKF_CODE_CACHE_PART2_SIZE
+CODE_REGION_SIZE_MASK_PART2 EQU (NOT (CODE_REGION_SIZE_PART2 - 1))
+ENDIF
+
+IF MKF_WDB_REGION_BASE_ADDRESS
+;-WDB_REGION_BASE_ADDRESS EQU 040000000h
+;-WDB_REGION_SIZE EQU 01000h
+WDB_REGION_BASE_ADDRESS EQU MKF_WDB_REGION_BASE_ADDRESS
+WDB_REGION_SIZE EQU MKF_WDB_REGION_BASE_SIZE
+WDB_REGION_SIZE_MASK EQU (NOT (WDB_REGION_SIZE - 1))
+ENDIF
+;<(AMI_CHG)
+
+;
+; See BWG - chapter "Determining Data Stack Base Address and Range"
+;
+;(AMI_CHG)>
+;-;DATA_STACK_BASE_ADDRESS EQU (CODE_REGION_BASE_ADDRESS - TILE_SIZE - (16*1024 * 1024))
+;-DATA_STACK_BASE_ADDRESS EQU 0FFB00000h
+;-DATA_STACK_SIZE EQU (64*1024) ; 10000h
+DATA_STACK_BASE_ADDRESS EQU MKF_CAR_BASE_ADDRESS
+DATA_STACK_SIZE EQU MKF_CAR_TOTAL_SIZE
+DATA_STACK_SIZE_MASK EQU (NOT (DATA_STACK_SIZE - 1))
+TEMPORARY_RAM_BASE_ADDRESS EQU DATA_STACK_BASE_ADDRESS
+TEMPORARY_RAM_SIZE EQU DATA_STACK_SIZE
+;<(AMI_CHG)
+
+;
+; Cache init and test values
+; These are inverted to flip each bit at least once
+;
+CACHE_INIT_VALUE EQU 0A5A5A5A5h
+CACHE_TEST_VALUE EQU (NOT CACHE_INIT_VALUE)
+
+PEI_CORE_ENTRY_BASE EQU 0FFFFFFE0h
+FV_MAIN_BASE EQU 0FFFFFFFCh
+
+MAX_NR_BUS EQU 0FFh
+MAX_NR_CPU_SOCKETS EQU 2 ; DP example, MP may have 4 or more
+
+;
+; Support EDK1117 build - Sample BASE Address and Size insteads of PcdGet()
+;
+MICROCODE_FV_BASE_ADDRESS EQU 0FFF20000h ; PcdGet32 (PcdFlashMicrocodeFvBase)
+MICROCODE_FV_SIZE EQU 40000h ; PcdGet32 (PcdFlashMicrocodeFvSize)
+CODE_CACHE_BASE_ADDRESS EQU 0FFF80000h ; PcdGet32 (PcdNemCodeCacheBase)
+CODE_CACHE_SIZE EQU 80000h ; PcdGet32 (PcdNemCodeCacheSize)
+FLASH_AREA_BASE_ADDRESS EQU 0FF800000h ; PcdGet32 (PcdFlashAreaBaseAddress)
+;(AMI_CHG)>
+;TEMPORARY_RAM_BASE_ADDRESS EQU 0FEF00000h ; PcdGet32 (PcdTemporaryRamBase)
+;TEMPORARY_RAM_SIZE EQU 2000h ; PcdGet32 (PcdTemporaryRamSize)
+;<(AMI_CHG)
+PCIEXPRESS_BASE_ADDRESS EQU 0E0000000h ; PcdGet64 (PcdPciExpressBaseAddress)
+
+BIT0 EQU 01h
+BIT1 EQU 02h
+BIT2 EQU 04h
+BIT3 EQU 08h
+BIT4 EQU 10h
+BIT5 EQU 20h
+BIT6 EQU 40h
+BIT7 EQU 80h
+BIT8 EQU 100h
+BIT9 EQU 200h
+BIT10 EQU 400h
+BIT11 EQU 800h
+BIT12 EQU 1000h
+BIT13 EQU 2000h
+BIT14 EQU 4000h
+BIT15 EQU 8000h
+BIT16 EQU 10000h
+BIT17 EQU 20000h
+BIT18 EQU 40000h
+BIT19 EQU 80000h
+BIT23 EQU 0800000h
+BIT31 EQU 080000000h
+; Bit definition in MM1
+BadCMOSDetected EQU (BIT0 shl 17)
+BSPApicIDSaveStart EQU 24
diff --git a/ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/ResetVec.asm b/ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/ResetVec.asm
new file mode 100644
index 0000000..54376e5
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/ResetVec.asm
@@ -0,0 +1,108 @@
+;
+; This file contains a 'Sample Driver' and is licensed as such
+; under the terms of your license agreement with Intel or your
+; vendor. This file may be modified by the user, subject to
+; the additional terms of the license agreement
+;
+;------------------------------------------------------------------------------
+;
+; Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+; This software and associated documentation (if any) is furnished
+; under a license and may only be used or copied in accordance
+; with the terms of the license. Except as permitted by such
+; license, no part of this software or documentation may be
+; reproduced, stored in a retrieval system, or transmitted in any
+; form or by any means without the express written consent of
+; Intel Corporation.
+
+;
+; Module Name:
+;
+; ResetVec.asm
+;
+; Abstract:
+;
+; Reset Vector Data structure
+; This structure is located at 0xFFFFFFC0
+;
+;------------------------------------------------------------------------------
+
+ .model tiny
+ .686p
+ .stack 0h
+ .code
+
+_TEXT_REALMODE SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:_TEXT_REALMODE, DS:_TEXT_REALMODE
+
+ ORG 0h
+;
+; FIT table pointer for LT-SX.
+;
+FitTablePointer DD 0eeeeeeeeh, 0eeeeeeeeh
+
+ ORG 10h
+;
+; This is located at 0xFFFFFFD0h
+;
+ mov di, "AP"
+ jmp ApStartup
+
+ ORG 20h
+;
+; Pointer to the entry point of the PEI core
+; It is located at 0xFFFFFFE0, and is fixed up by some build tool
+; So if the value 8..1 appears in the final FD image, tool failure occurs.
+;
+PeiCoreEntryPoint DD 87654321h
+
+;
+; This is the handler for all kinds of exceptions. Since it's for debugging
+; purpose only, nothing except a deadloop would be done here. Developers could
+; analyze the cause of the exception if a debugger had been attached.
+;
+InterruptHandler PROC
+ jmp $
+ iret
+InterruptHandler ENDP
+
+ ORG 30h
+;
+; For IA32, the reset vector must be at 0xFFFFFFF0, i.e., 4G-16 byte
+; Execution starts here upon power-on/platform-reset.
+;
+ResetHandler:
+ nop
+ nop
+ApStartup:
+ ;
+ ; Jmp Rel16 instruction
+ ; Use machine code directly in case of the assembler optimization
+ ; SEC entry point relatvie address will be fixed up by some build tool.
+ ;
+
+ DB 0e9h
+ DW -3
+
+
+ ORG 38h
+;
+; Ap reset vector segment address is at 0xFFFFFFF8
+; This will be fixed up by some build tool,
+; so if the value 1..8 appears in the final FD image,
+; tool failure occurs
+;
+ApSegAddress dd 12345678h
+
+ ORG 3ch
+;
+; BFV Base is at 0xFFFFFFFC
+; This will be fixed up by some build tool,
+; so if the value 1..8 appears in the final FD image,
+; tool failure occurs.
+;
+BfvBase DD 12345678h
+
+_TEXT_REALMODE ENDS
+
+ END
diff --git a/ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/ResetVec.raw b/ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/ResetVec.raw
new file mode 100644
index 0000000..ca9dd3c
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/ResetVec.raw
Binary files differ
diff --git a/ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/SecCore.inc b/ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/SecCore.inc
new file mode 100644
index 0000000..0129cc9
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/SecCore.inc
@@ -0,0 +1,56 @@
+;@file
+; SecCore constants and macros
+;
+;@copyright
+; Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+; This software and associated documentation (if any) is furnished
+; under a license and may only be used or copied in accordance
+; with the terms of the license. Except as permitted by such
+; license, no part of this software or documentation may be
+; reproduced, stored in a retrieval system, or transmitted in any
+; form or by any means without the express written consent of
+; Intel Corporation.
+;
+; This file contains a 'Sample Driver' and is licensed as such
+; under the terms of your license agreement with Intel or your
+; vendor. This file may be modified by the user, subject to
+; the additional terms of the license agreement
+;
+
+;
+; Set to 1 to enable debug
+;
+NO_EVICTION_MODE_DEBUG EQU 1
+
+STATUS_CODE MACRO status
+IF NO_EVICTION_MODE_DEBUG
+ mov al, status
+ out 080h, al
+ENDIF
+ENDM
+
+FVHEADER_LEN_OFF EQU 30h
+FFSHEADER_LEN EQU 18h
+
+IMAGE_BASE_ADDRESS EQU 0FFFF0000h
+
+;
+; Set to 1 to enable debug support for "Deterministic BSP selection"
+;
+AP_ENTRY_DELAY EQU 10h
+AP_EXECUTION_DELAY EQU 1000h
+
+;
+; Define the segment used for AP start-up
+; It should be on the top of the recovery FV
+; Seg = 0100h - (BlockNumber of Recovery FV)
+; Here 0FCh = 0100h - 04h
+;
+AP_SEG EQU 0FFh
+
+;
+; Commands defined in the AP SIPI code
+;
+AP_SIPI_COLLECT_MAX_RATIO EQU 001h
+AP_SIPI_PROGRAM_MAX_RATIO EQU 002h
+AP_SIPI_SWITCH_BSP EQU 003h
diff --git a/ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/SecFlat32.inc b/ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/SecFlat32.inc
new file mode 100644
index 0000000..7b9dea4
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/SecFlat32.inc
@@ -0,0 +1,1024 @@
+;
+; This file contains a 'Sample Driver' and is licensed as such
+; under the terms of your license agreement with Intel or your
+; vendor. This file may be modified by the user, subject to
+; the additional terms of the license agreement
+;
+;------------------------------------------------------------------------------
+;
+; Copyright (c) 1999 - 2012, Intel Corporation. All rights reserved.<BR>
+; This software and associated documentation (if any) is furnished
+; under a license and may only be used or copied in accordance
+; with the terms of the license. Except as permitted by such
+; license, no part of this software or documentation may be
+; reproduced, stored in a retrieval system, or transmitted in any
+; form or by any means without the express written consent of
+; Intel Corporation.
+;
+; Module Name:
+;
+; SecFlat32.inc
+;
+; Abstract:
+;
+; This is the code that goes from real-mode to protected mode.
+; It consumes the reset vector.
+;
+;------------------------------------------------------------------------------
+
+CALL_MMX macro RoutineLabel
+
+ local ReturnAddress
+ mov esi, offset ReturnAddress
+ movd mm7, esi ; save ReturnAddress into MM7
+ jmp RoutineLabel
+ReturnAddress:
+
+endm
+
+RET_ESI macro
+
+ movd esi, mm7 ; restore ESP from MM7
+ jmp esi
+
+endm
+
+CALL_EBP macro RoutineLabel
+
+ local ReturnAddress
+ mov ebp, offset ReturnAddress
+ jmp RoutineLabel
+ReturnAddress:
+
+endm
+
+RET_EBP macro
+
+ jmp ebp ; restore ESP from EBP
+
+endm
+
+align 4
+ProtectedModeSECStart PROC NEAR PUBLIC
+ STATUS_CODE (02h)
+ CALL_MMX EnableAccessCSR
+
+;(AMI_CHG+)>
+ STATUS_CODE (07h)
+ CALL_MMX VeryEarlyMicrocodeUpdate
+;<(AMI_CHG+)
+
+ CALL_MMX DetectNumOfCPUSocket
+
+ STATUS_CODE (03h)
+;(AMI_CHG+)>
+ ;-Things in PlatformInitialization are ready done in chipset part
+ ;-CALL_MMX PlatformInitialization
+;<(AMI_CHG+)
+ STATUS_CODE (09h)
+ CALL_MMX InitializeNEM
+
+ STATUS_CODE (0Bh)
+ jmp CallPeiCoreEntryPoint
+
+ProtectedModeSECStart ENDP
+
+EnableAccessCSR PROC NEAR PRIVATE
+ ;
+ ; get Bus number from CPUID[1] EBX[31:24]
+ ;
+
+ mov eax, 0Bh
+ mov ecx, 1
+ cpuid
+ mov esi, eax
+
+ mov eax, 1 ; bus 0
+ cpuid
+ bswap ebx
+ movzx eax, bl
+ movzx ebx, bl
+ shl eax, BSPApicIDSaveStart ; Save current BSP APIC ID in MM1[31:24]
+ mov cx, si
+ shr bl, cl ; get Bus number in BL
+ or eax, ebx
+ movd mm1, eax ; save Bus number MM1[7:0]
+
+ ;
+ ; Enable MM PCI-E Config Space
+ ; --cr-- use register symbol name; should upper 32 bit be cleared
+ ;
+ mov eax, 080000060h ; MCHBAR
+ mov dx, 0CF8h
+ out dx, eax
+ mov dx, 0CFCh
+ mov eax, MMCFG_LENGTH_BIT_SETTING
+ out dx, eax
+ in eax, dx
+ or eax, MMCFG_BASE OR ENABLE
+ out dx, eax
+
+ ; Clear reset flag
+ movd eax, mm1
+ and eax, NOT BIT18+BIT19
+ movd mm1, eax
+ RET_ESI
+
+EnableAccessCSR ENDP
+
+; STATUS_CODE (03h)
+;PlatformInitialization PROC NEAR PRIVATE
+;
+; ;
+; ; Program PCI Express base address
+; ;
+;
+; mov eax, 80000060h ; 0:0:0:60
+; mov dx, 0CF8h
+; out dx, eax
+; mov dx, 0CFCh
+; ;using Pcd instead
+; ;mov eax, 0e0000000h OR 00h OR 1
+;; mov eax, DWORD PTR PcdGet64 (PcdPciExpressBaseAddress)
+; mov eax, DWORD PTR PCIEXPRESS_BASE_ADDRESS
+; or eax, (PCIEX_LENGTH_BIT_SETTING OR 1)
+; out dx, eax
+;
+; ;
+; ; Enable Mch Bar
+; ;
+; mov esi, MCHBAR_REG
+; mov eax, (MCH_BASE_ADDRESS + 1)
+; mov Dword Ptr [esi], eax
+;
+; ;
+; ; Enable RCRB in PCH.
+; ;
+; mov esi, PCH_LPC_RCRB_PCI_ADDR
+; mov eax, PCH_RCRB_BASE + 1
+; mov Dword Ptr [esi], eax
+;
+; ;
+; ; Configure GPIO to be able to initiate LVL change for GPIO48 for S3 resume time calculation.
+; ;
+; ; Enable GPIO BASE I/O registers
+; ;
+; mov eax, PCI_LPC_BASE + 48h
+; mov dx, 0CF8h
+; out dx, eax
+; mov eax, GPIO_BASE_ADDRESS
+; add dx, 4
+; out dx, eax
+;
+; mov eax, PCI_LPC_BASE + 4Ch
+; mov dx, 0CF8h
+; out dx, eax
+; add dx, 4
+; in al, dx
+; or al, BIT4 ; GPIOBASE Enable
+; out dx, al
+;
+; ;GPIO_USE_SEL2 Register -> 1 = GPIO 0 = Native
+; mov dx, GPIO_BASE_ADDRESS + R_GPIO_USE_SEL2
+; in eax, dx
+; or eax, 010000h ;Enable GPIO48
+; out dx, eax
+;
+; ;GP_IO_SEL2 Register -> 1 = Input 0 = Output (if Native Mode don't care)
+; mov dx, GPIO_BASE_ADDRESS + R_GPIO_IO_SEL2
+; in eax, dx
+; and eax, 0FFFEFFFFh ;Configure GPIO48 as Output
+; out dx, eax
+;
+; mov dx, GPIO_BASE_ADDRESS + R_GPIO_LVL2
+; in eax, dx
+; or eax, 010000h ;Configure GPIO48 as High
+; out dx, eax
+;
+; ;
+; ; Program and Enable ACPI PM Base.
+; ;
+; mov esi, PCH_LPC_PMBASE_PCI_ADDR
+; mov eax, PCH_ACPI_BASE_ADDRESS + 1
+; mov Dword Ptr [esi], eax
+; mov esi, PCH_LPC_ACPICNTL_PCI_ADDR
+; or Dword Ptr [esi], 00000080h
+;
+; ;
+; ; PCH BIOS Spec Rev 0.5.0 Section 12.9
+; ; Additional Programming Requirements for USB Support
+; ; Step 2.b
+; ; Clear RCBA + 3598h [0] to 0b
+; ;
+; mov esi, PCH_RCRB_BASE + 3598h
+; mov eax, 0
+; mov Dword Ptr [esi], eax
+;
+; ;
+; ; Enable HPET decode in PCH.
+; ;
+; mov esi, PCH_RCRB_BASE + PCH_RCRB_HPET
+; mov eax, PCH_RCRB_HPET_DECODE
+; mov Dword Ptr [esi], eax
+; mov eax, Dword ptr [esi]
+; xor eax, eax
+; mov esi, HPET_COMP_1
+; mov Dword Ptr [esi], eax
+; mov esi, HPET_COMP_2
+; mov Dword ptr [esi], eax
+;
+; ;
+; ; Enable the upper 128-byte bank of RTC RAM.
+; ;
+; mov esi, PCH_RCRB_BASE + PCH_RCRB_RTC_CONF
+; mov eax, Dword Ptr [esi]
+; or eax, PCH_RCRB_RTC_CONF_UCMOS_EN
+; mov Dword Ptr [esi], eax
+;
+; ;
+; ; Choose Port80 Route
+; ;
+; mov esi, PCH_RCRB_BASE + PCH_RCRB_GCS
+; mov ebx, Dword Ptr [esi]
+; or bl, BIT5
+;
+; ;
+; ; check SETUP option - PchPort80Route
+; ; 0 = LPC {Default]; 1 = PCI
+; ;
+;; mov al, CMOS_PCH_PORT80_OFFSET ; CMOS Offset = 17h
+;; mov dx, RTC_UPPER_INDEX
+;; out dx, al
+;; inc dx
+;; in al, dx
+;; test al, BIT0
+;; jnz @F
+; and bl, NOT (BIT2) ; Port80h to LPC
+;;@@:
+; mov Dword Ptr [esi], ebx
+;
+; ;
+; ; Halt TCO Timer
+; ;
+; mov dx, 0468h
+; in ax, dx
+; or ax, BIT11
+; out dx, ax
+;
+; ;
+; ; Clear the Second TO status bit
+; ;
+; mov dx, 0466h
+; in ax, dx
+; or ax, BIT1
+; out dx, ax
+;
+; RET_ESI
+;
+;PlatformInitialization ENDP
+
+; STATUS_CODE (03h)
+DetectNumOfCPUSocket PROC NEAR PRIVATE
+
+ ; only one socket
+ movd eax, mm1 ; get MM1 value into EAX
+ mov ah, 01
+ movd mm1, eax ; save CPU pkg count into MM1[15:8]
+
+ RET_ESI
+
+DetectNumOfCPUSocket ENDP
+
+; STATUS_CODE (07h)
+VeryEarlyMicrocodeUpdate PROC NEAR PRIVATE
+; (AMI_CHG+)>
+ public FindMicrocodeEnd
+ mov ecx,08bh
+ rdmsr
+ or dx,dx
+ jnz uc_exit
+ jmp FindMicrocode ;return to MicroCodeUpdateEnd
+FindMicrocodeEnd::
+ or eax, eax
+ jz uc_exit ;No microcode found:
+
+ ;Update microcode
+ mov ecx, 79h
+ xor edx, edx
+ add eax, 48 ;eax = Update data
+ wrmsr ;Update microcode
+uc_exit:
+ RET_ESI
+
+;-IF EARLY_MICROCODE_SUPPORT
+;- mov ecx, IA32_BIOS_SIGN_ID
+;- rdmsr ; CPU PatchID -> EDX
+;- cmp edx, 0 ; If microcode has been updated
+;- jnz luExit ; Skip if patch already loaded
+;-
+;- mov ecx, IA32_PLATFORM_ID ; To get Platform ID.
+;- rdmsr
+;- shr edx, 18 ; EDX[0-2] = Platform ID.
+;- and dx, 07h ; DX = Platform ID.
+;- mov si, dx ; Save Platform ID in FS.
+;- mov eax, 01h ; To get CPU signature.
+;- cpuid ; EAX = CPU signature.
+;- mov cx, si ; CX = Platform ID
+;- xor edx, edx
+;- bts dx, cx ; EDX = Platform ID bit.
+;-
+; mov esi, PcdGet32 (PcdFlashMicrocodeFvBase)
+;- mov esi, MICROCODE_FV_BASE_ADDRESS
+;-
+;- mov ebx, esi
+;- mov bx, FVHEADER_LEN_OFF
+;- movzx ebx, WORD PTR [ebx]
+;- add esi, ebx
+;- add si, FFSHEADER_LEN ; add FFS header
+;-
+;- mov edi, PcdGet32 (PcdFlashMicrocodeFvBase)
+;- mov ebx, PcdGet32 (PcdFlashMicrocodeFvSize)
+;- mov edi, MICROCODE_FV_BASE_ADDRESS
+;- mov ebx, MICROCODE_FV_SIZE
+;- add edi, ebx ;End addr of uCodes.
+;-
+;- ; EAX = CPU signature.
+;- ; EDX = Platform ID bit.
+;- ; ESI = Abs addr of contiguous uCode blocks.
+;- ; EDI = Abs addr of contiguous uCode blocks end.
+;-
+;-luCheckPatch:
+;- cmp (UpdateHeaderStruc PTR ds:[esi]).dProcessorSignature, eax;Sig matched?
+;- jnz luCheckUnprogrammed ; No.
+;- test (UpdateHeaderStruc PTR ds:[esi]).dProcessorFlags, edx;Platform matched?
+;- jnz luFoundMatch ; Yes.
+;-
+;-luCheckUnprogrammed:
+;- mov ebx, (UpdateHeaderStruc PTR ds:[esi]).dDataSize
+;- cmp ebx, 0FFFFFFFFh
+;- je luUnprogrammed
+;- cmp (UpdateHeaderStruc PTR ds:[esi]).dLoaderRevision, 1
+;- je luCheckExtdHdrs
+;-
+;-luUnprogrammed:
+;- mov ebx, 1024 ; Unprogrammed space, 1KB checks
+;- jmp luPoinToNextBlock ; for backword compatibility.
+;-
+;-luCheckExtdHdrs:
+;- add ebx, SIZEOF(UpdateHeaderStruc)
+;- cmp ebx, (UpdateHeaderStruc PTR ds:[esi]).dTotalSize
+;- jae luTryNextPatch ; No extd hdrs.
+;-
+;- mov ecx, DWORD PTR ds:[esi + ebx]
+;- jcxz luTryNextPatch ; No extd hdrs. (OK to use CX instead of ECX).
+;- add ebx, 20 ; Point to the first Extd Sig.
+;-luNextSig:
+;- cmp eax, DWORD PTR ds:[esi + ebx] ;Sig matched?
+;- jne lu_00
+;- test edx, DWORD PTR ds:[esi + ebx + 4] ;Platform matched?
+;- jnz luFoundMatch
+;-lu_00:
+;- add ebx, 12
+;- loop luNextSig
+;-
+;-luTryNextPatch:
+;- mov ebx, (UpdateHeaderStruc PTR ds:[esi]).dTotalSize
+;- or ebx, ebx
+;- jnz luPoinToNextBlock ; Variable size uCode format.
+;- mov ebx, BLOCK_LENGTH_BYTES ; Fixed size uCode format.
+
+;
+; Add alignment check - begin
+;
+;- test ebx, 0400h
+;- jz @F
+;- add ebx, 0400h
+;-@@:
+;
+; Add alignment check - end
+;
+
+;-luPoinToNextBlock:
+;- add esi, ebx
+;- cmp esi, edi
+;- jb luCheckPatch ; Check with all patches.
+;-
+;- ; Check possible multiple patch
+;- movd eax, mm3
+;- movd esi, mm4
+;- or eax, eax
+;- jnz luLoadPatch
+;- jmp luExit ; No matching patch found.
+;-
+;-luFoundMatch:
+;-; MM3 = Patch Revision
+;-; MM4 = Patch Pointer
+;- movd ebx, mm3
+;- cmp (UpdateHeaderStruc PTR ds:[esi]).dUpdateRevision, ebx
+;- jb luTryNextPatch
+;-
+;- mov ebx, (UpdateHeaderStruc PTR ds:[esi]).dUpdateRevision
+;-
+;-luStoreRevPtr:
+;- movd mm3, ebx ; save Patch Revision
+;- movd mm4, esi ; save Patch Pointer
+;- jmp luTryNextPatch
+;-
+;-luLoadPatch:
+;- mov ecx, IA32_BIOS_UPDT_TRIG
+;- mov eax, esi ; EAX - Abs addr of uCode patch.
+;- add eax, SIZEOF(UpdateHeaderStruc) ; EAX - Abs addr of uCode data.
+;- xor edx, edx ; EDX:EAX - Abs addr of uCode data.
+;- wrmsr ; Trigger uCode load.
+;-
+;-luExit:
+;-ENDIF
+;-
+;- RET_EBP
+;<(AMI_CHG+)
+VeryEarlyMicrocodeUpdate ENDP
+; STATUS_CODE (09h)
+;************************************************************
+; Description:
+;
+; This function initializes the Cache for Data, Stack, and Code
+; as specified in the BIOS Writer's Guide.
+;************************************************************
+InitializeNEM PROC NEAR PRIVATE
+IFDEF ANC_SUPPORT_FLAG
+ ;
+ ; Detect AnC Boot
+ ;
+ mov ecx, MSR_ANC_SACM_INFO ;
+ rdmsr
+ and eax, 01h
+ jnz AncNemSetup
+ENDIF
+
+ ;
+ ; Enable cache for use as stack and for caching code
+ ; The algorithm is specified in the processor BIOS writer's guide
+ ;
+
+ ;
+ ; Ensure that the system is in flat 32 bit protected mode.
+ ;
+ ; Platform Specific - configured earlier
+ ;
+ ; Ensure that only one logical processor in the system is the BSP.
+ ; (Required step for clustered systems).
+ ;
+ ; Platform Specific - configured earlier
+
+ ; Ensure all APs are in the Wait for SIPI state.
+ ; This includes all other logical processors in the same physical processor
+ ; as the BSP and all logical processors in other physical processors.
+ ; If any APs are awake, the BIOS must put them back into the Wait for
+ ; SIPI state by issuing a broadcast INIT IPI to all excluding self.
+ ;
+ mov edi, APIC_ICR_LO ; 0FEE00300h - Send INIT IPI to all excluding self
+ mov eax, ORAllButSelf + ORSelfINIT ; 0000C4500h
+ mov [edi], eax
+
+@@:
+ mov eax, [edi]
+ bt eax, 12 ; Check if send is in progress
+ jc @B ; Loop until idle
+
+ ;
+ ; Load microcode update into BSP.
+ ;
+ ; Ensure that all variable-range MTRR valid flags are clear and
+ ; IA32_MTRR_DEF_TYPE MSR E flag is clear. Note: This is the default state
+ ; after hardware reset.
+ ;
+ ; Platform Specific - MTRR are usually in default state.
+ ;
+
+ ;
+ ; Initialize all fixed-range and variable-range MTRR register fields to 0.
+ ;
+ mov ecx, IA32_MTRR_CAP ; get variable MTRR support
+ rdmsr
+ movzx ebx, al ; EBX = number of variable MTRR pairs
+ shl ebx, 2 ; *4 for Base/Mask pair and WORD size
+ add ebx, MtrrCountFixed * 2 ; EBX = size of Fixed and Variable MTRRs
+
+ xor eax, eax ; Clear the low dword to write
+ xor edx, edx ; Clear the high dword to write
+ ;;;mov ebx, MtrrCount * 2 ; ebx <- sizeof MtrrInitTable
+InitMtrrLoop:
+ add ebx, -2
+ movzx ecx, WORD PTR cs:MtrrInitTable[ebx] ; ecx <- address of mtrr to zero
+ wrmsr
+ jnz InitMtrrLoop ; loop through the whole table
+
+ ;
+ ; Configure the default memory type to un-cacheable (UC) in the
+ ; IA32_MTRR_DEF_TYPE MSR.
+ ;
+ mov ecx, MTRR_DEF_TYPE ; Load the MTRR default type index
+ rdmsr
+ and eax, NOT (00000CFFh) ; Clear the enable bits and def type UC.
+ wrmsr
+
+ ; Configure MTRR_PHYS_MASK_HIGH for proper addressing above 4GB
+ ; based on the physical address size supported for this processor
+ ; This is based on read from CPUID EAX = 080000008h, EAX bits [7:0]
+ ;
+ ; Examples:
+ ; MTRR_PHYS_MASK_HIGH = 00000000Fh For 36 bit addressing
+ ; MTRR_PHYS_MASK_HIGH = 0000000FFh For 40 bit addressing
+ ;
+ mov eax, 80000008h ; Address sizes leaf
+ cpuid
+ sub al, 32
+ movzx eax, al
+ xor esi, esi
+ bts esi, eax
+ dec esi ; esi <- MTRR_PHYS_MASK_HIGH
+
+ ;
+ ; Configure the DataStack region as write-back (WB) cacheable memory type
+ ; using the variable range MTRRs.
+ ;
+
+ ;
+ ; Set the base address of the DataStack cache range
+ ;
+; mov eax, PcdGet32 (PcdTemporaryRamBase)
+ mov eax, TEMPORARY_RAM_BASE_ADDRESS
+ or eax, MTRR_MEMORY_TYPE_WB
+ ; Load the write-back cache value
+ xor edx, edx ; clear upper dword
+ mov ecx, MTRR_PHYS_BASE_0 ; Load the MTRR index
+ wrmsr ; the value in MTRR_PHYS_BASE_0
+
+ ;
+ ; Set the mask for the DataStack cache range
+ ; Compute MTRR mask value: Mask = NOT (Size - 1)
+ ;
+; mov eax, PcdGet32 (PcdTemporaryRamSize)
+ mov eax, TEMPORARY_RAM_SIZE
+ dec eax
+ not eax
+ or eax, MTRR_PHYS_MASK_VALID
+ ; turn on the Valid flag
+ mov edx, esi ; edx <- MTRR_PHYS_MASK_HIGH
+ mov ecx, MTRR_PHYS_MASK_0 ; For proper addressing above 4GB
+ wrmsr ; the value in MTRR_PHYS_BASE_0
+
+ ;
+ ; Configure the BIOS code region as write-protected (WP) cacheable
+ ; memory type using a single variable range MTRR.
+ ;
+ ; Platform Specific - ensure region to cache meets MTRR requirements for
+ ; size and alignment.
+ ;
+
+ ;
+ ; Set the base address of the CodeRegion cache range part 1
+ ;
+ mov eax, CODE_REGION_BASE_ADDRESS_PART1 OR MTRR_MEMORY_TYPE_WP
+ ; Load the write-protected cache value
+ xor edx, edx ; clear upper dword
+ mov ecx, MTRR_PHYS_BASE_1 ; Load the MTRR index
+ wrmsr ; the value in MTRR_PHYS_BASE_1
+
+ ;
+ ; Set the mask for the CodeRegion cache range part 1
+ ;
+ mov eax, CODE_REGION_SIZE_MASK_PART1 OR MTRR_PHYS_MASK_VALID
+ ; turn on the Valid flag
+ mov edx, esi ; edx <- MTRR_PHYS_MASK_HIGH
+ mov ecx, MTRR_PHYS_MASK_1 ; Load the MTRR index
+ wrmsr ; the value in MTRR_PHYS_BASE_1
+
+;(AMI_CHG)>
+IF MKF_CODE_CACHE_PART2_BASE
+ ;
+ ; Set the base address of the CodeRegion cache range part 2
+ ;
+ mov eax, CODE_REGION_BASE_ADDRESS_PART2 OR MTRR_MEMORY_TYPE_WP
+ ; Load the write-protected cache value
+ xor edx, edx ; clear upper dword
+;- mov ecx, MTRR_PHYS_BASE_2 ; Load the MTRR index
+ inc ecx
+ wrmsr ; the value in MTRR_PHYS_BASE_2
+
+ ;
+ ; Set the mask for the CodeRegion cache range part 2
+ ;
+ mov eax, CODE_REGION_SIZE_MASK_PART2 OR MTRR_PHYS_MASK_VALID
+ ; turn on the Valid flag
+ mov edx, esi ; edx <- MTRR_PHYS_MASK_HIGH
+;- mov ecx, MTRR_PHYS_MASK_2 ; Load the MTRR index
+ inc ecx
+ wrmsr ; the value in MTRR_PHYS_BASE_1
+ENDIF
+
+IF MKF_WDB_REGION_BASE_ADDRESS
+ ;
+ ; Set the base address of the WDB range
+ ;
+ mov eax, WDB_REGION_BASE_ADDRESS OR MTRR_MEMORY_TYPE_WC
+ ; Load the write-combined cache value
+ xor edx, edx ; clear upper dword
+;- mov ecx, MTRR_PHYS_BASE_3 ; Load the MTRR index
+ inc ecx
+ wrmsr ; the value in MTRR_PHYS_BASE_2
+
+ ;
+ ; Set the mask for the WDB range
+ ;
+ mov eax, WDB_REGION_SIZE_MASK OR MTRR_PHYS_MASK_VALID
+ ; turn on the Valid flag
+ mov edx, esi ; edx <- MTRR_PHYS_MASK_HIGH
+;- mov ecx, MTRR_PHYS_MASK_3 ; Load the MTRR index
+ inc ecx
+ wrmsr ; the value in MTRR_PHYS_BASE_1
+ENDIF
+;<(AMI_CHG)
+
+ ;
+ ; Enable the MTRRs by setting the IA32_MTRR_DEF_TYPE MSR E flag.
+ ;
+ mov ecx, MTRR_DEF_TYPE ; Load the MTRR default type index
+ rdmsr
+ or eax, MTRR_DEF_TYPE_E ; Enable variable range MTRRs
+ wrmsr
+
+ ;
+ ; Enable the logical processor's (BSP) cache: execute INVD and set
+ ; CR0.CD = 0, CR0.NW = 0.
+ ;
+ mov eax, cr0
+ and eax, NOT (CR0_CACHE_DISABLE + CR0_NO_WRITE)
+ invd
+ mov cr0, eax
+ ;
+ ; Enable No-Eviction Mode Setup State by setting
+ ; NO_EVICT_MODE MSR 2E0h bit [0] = '1'.
+ ;
+ mov ecx, NO_EVICT_MODE
+ rdmsr
+ or eax, 1
+ wrmsr
+
+ ;
+ ; One location in each 64-byte cache line of the DataStack region
+ ; must be written to set all cache values to the modified state.
+ ;
+; mov edi, PcdGet32 (PcdTemporaryRamBase)
+; mov ecx, PcdGet32 (PcdTemporaryRamSize)
+ mov edi, TEMPORARY_RAM_BASE_ADDRESS
+ mov ecx, TEMPORARY_RAM_SIZE
+ shr ecx, 6
+ mov eax, CACHE_INIT_VALUE
+@@:
+ mov [edi], eax
+ sfence
+ add edi, 64
+ loopd @b
+
+ ;
+ ; Enable No-Eviction Mode Run State by setting
+ ; NO_EVICT_MODE MSR 2E0h bit [1] = '1'.
+ ;
+ mov ecx, NO_EVICT_MODE
+ rdmsr
+ or eax, 2
+ wrmsr
+
+IFDEF ANC_SUPPORT_FLAG
+ jmp FinishedCacheConfig
+
+ ;
+ ; Jump to here when AnC boot and NEM is initialized by AnC ACM
+ ;
+AncNemSetup:
+ ;
+ ; Finished with cache configuration
+ ;
+ ; Configure MTRR_PHYS_MASK_HIGH for proper addressing above 4GB
+ ; based on the physical address size supported for this processor
+ ; This is based on read from CPUID EAX = 080000008h, EAX bits [7:0]
+ ;
+ ; Examples:
+ ; MTRR_PHYS_MASK_HIGH = 00000000Fh For 36 bit addressing
+ ; MTRR_PHYS_MASK_HIGH = 0000000FFh For 40 bit addressing
+ ;
+ mov eax, 80000008h ; Address sizes leaf
+ cpuid
+ sub al, 32
+ movzx eax, al
+ xor esi, esi
+ bts esi, eax
+ dec esi ; esi <- MTRR_PHYS_MASK_HIGH
+
+ ;
+ ; Configure the DataStack region as write-back (WB) cacheable memory type
+ ; using the variable range MTRRs.
+ ;
+ ;
+ ; Find available MTRR
+ ;
+ CALL_EBP FindFreeMtrr
+
+ ;
+ ; Set the base address of the DataStack cache range
+ ;
+; mov eax, PcdGet32 (PcdTemporaryRamBase)
+ mov eax, TEMPORARY_RAM_BASE_ADDRESS
+ or eax, MTRR_MEMORY_TYPE_WB
+ ; Load the write-back cache value
+ xor edx, edx ; clear upper dword
+ wrmsr ; the value in MTRR_PHYS_BASE_0
+
+ ;
+ ; Set the mask for the DataStack cache range
+ ; Compute MTRR mask value: Mask = NOT (Size - 1)
+ ;
+; mov eax, PcdGet32 (PcdTemporaryRamSize)
+ mov eax, TEMPORARY_RAM_SIZE
+ dec eax
+ not eax
+ or eax, MTRR_PHYS_MASK_VALID
+ ; turn on the Valid flag
+ mov edx, esi ; edx <- MTRR_PHYS_MASK_HIGH
+ inc ecx
+ wrmsr ; the value in MTRR_PHYS_BASE_0
+
+ ;
+ ; Program the variable MTRR's MASK register for WDB
+ ; (Write Data Buffer, used in MRC, must be WC type)
+ ;
+
+ ;
+ ; Find available MTRR
+ ;
+ CALL_EBP FindFreeMtrr
+
+FoundAvailableMtrr:
+ ;
+ ; Program the variable MTRR's BASE register for WDB
+ ;
+ xor edx, edx
+ mov eax, WDB_REGION_BASE_ADDRESS OR MTRR_MEMORY_TYPE_WC
+ wrmsr
+
+ inc ecx
+ mov edx, esi ; edx <- MTRR_PHYS_MASK_HIGH
+ mov eax, WDB_REGION_SIZE_MASK OR MTRR_PHYS_MASK_VALID ; turn on the Valid flag
+ wrmsr
+
+ ;
+ ; One location in each 64-byte cache line of the DataStack region
+ ; must be written to set all cache values to the modified state.
+ ;
+; mov edi, PcdGet32 (PcdTemporaryRamBase)
+; mov ecx, PcdGet32 (PcdTemporaryRamSize)
+ mov edi, TEMPORARY_RAM_BASE_ADDRESS
+ mov ecx, TEMPORARY_RAM_SIZE
+ shr ecx, 6
+ mov eax, CACHE_INIT_VALUE
+@@:
+ mov [edi], eax
+ sfence
+ add edi, 64
+ loopd @b
+ENDIF
+
+ ;
+ ; Finished with cache configuration
+ ;
+FinishedCacheConfig:
+
+ ;
+ ; Optionally Test the Region...
+ ;
+
+ ;
+ ; Test area by writing and reading
+ ;
+ cld
+; mov edi, PcdGet32 (PcdTemporaryRamBase)
+; mov ecx, PcdGet32 (PcdTemporaryRamSize)
+ mov edi, TEMPORARY_RAM_BASE_ADDRESS
+ mov ecx, TEMPORARY_RAM_SIZE
+ shr ecx, 2
+ mov eax, CACHE_TEST_VALUE
+TestDataStackArea:
+ stosd
+ cmp eax, DWORD PTR [edi-4]
+ jnz DataStackTestFail
+ loop TestDataStackArea
+ jmp DataStackTestPass
+
+ ;
+ ; Cache test failed
+ ;
+DataStackTestFail:
+ STATUS_CODE (0D0h)
+ jmp $
+
+ ;
+ ; Configuration test failed
+ ;
+ConfigurationTestFailed:
+ STATUS_CODE (0D1h)
+ jmp $
+
+DataStackTestPass:
+
+ ;
+ ; At this point you may continue normal execution. Typically this would include
+ ; reserving stack, initializing the stack pointer, etc.
+ ;
+
+ ;
+ ; After memory initialization is complete, please follow the algorithm in the BIOS
+ ; Writer's Guide to properly transition to a normal system configuration.
+ ; The algorithm covers the required sequence to properly exit this mode.
+ ;
+
+ RET_ESI
+
+InitializeNEM ENDP
+
+; STATUS_CODE (09h)
+;-EstablishStack PROC NEAR PRIVATE
+;-
+;- ;
+;- ; Enable STACK
+;- ;
+;- RET_ESI
+;-
+;-EstablishStack ENDP
+;-
+;-FindFreeMtrr PROC NEAR PRIVATE
+;- mov ecx, MTRR_PHYS_MASK_0
+;-
+;-@@:
+;- rdmsr
+;- test eax, 800h
+;- jz FoundFreeMtrr
+;- add ecx, 2
+;- cmp ecx, MTRR_PHYS_MASK_9
+;- jbe @b
+;- ;
+;- ; No available MTRR, halt system
+;- ;
+;- jmp $
+;-
+;-FoundFreeMtrr:
+;- dec ecx
+;-
+;- RET_EBP
+;-
+;-FindFreeMtrr ENDP
+;-
+;-; STATUS_CODE (0Bh)
+;-CallPeiCoreEntryPoint PROC NEAR PRIVATE
+;- ;
+;- ; Set stack top pointer
+;- ;
+;-; mov esp, PcdGet32 (PcdTemporaryRamBase)
+;-; add esp, PcdGet32 (PcdTemporaryRamSize)
+;- mov esp, TEMPORARY_RAM_BASE_ADDRESS
+;- add esp, TEMPORARY_RAM_SIZE
+;-
+;- ;
+;- ; Push CPU count to stack first, then AP's (if there is one)
+;- ; BIST status, and then BSP's
+;- ;
+;-
+;- ;
+;- ; Here work around for BIST
+;- ;
+;- ; Get number of BSPs
+;- movd ecx, mm1
+;- movzx ecx, ch
+;-
+;- ; Save number of BSPs
+;- push ecx
+;-
+;-GetSBSPBist:
+;- ; Save SBSP BIST
+;- movd eax, mm0
+;- push eax
+;-
+;- ; Save SBSP APIC ID
+;- movd eax, mm1
+;- shr eax, BSPApicIDSaveStart ; Resume APIC ID
+;- push eax
+;-
+;- ; Save Time-Stamp Counter
+;- movd eax, mm5
+;- push eax
+;-
+;- movd eax, mm6
+;- push eax
+;-
+;-TransferToSecStartup:
+;-
+;-
+;-
+;- ; Switch to "C" code
+;- STATUS_CODE (0Ch)
+;- ;
+;- ; Pass entry point of the PEI core
+;- ;
+;- mov edi, PEI_CORE_ENTRY_BASE ; 0FFFFFFE0h
+;- push DWORD PTR ds:[edi]
+;-
+;- ;
+;- ; Pass BFV into the PEI Core
+;- ;
+;- mov edi, FV_MAIN_BASE ; 0FFFFFFFCh
+;- push DWORD PTR ds:[edi]
+;-
+;- ; ECPoverride: SecStartup entry point needs 4 parameters
+;-; push PcdGet32 (PcdTemporaryRamBase)
+;- push TEMPORARY_RAM_BASE_ADDRESS
+;-
+;- ;
+;- ; Pass stack size into the PEI Core
+;- ;
+;-; push PcdGet32 (PcdTemporaryRamSize)
+;- push TEMPORARY_RAM_SIZE
+;-
+;- ;
+;- ; Pass Control into the PEI Core
+;- ;
+;- call SecStartup
+;-CallPeiCoreEntryPoint ENDP
+;-
+;-StartUpAp PROC NEAR
+;-
+;- mov esi, HPET_COMP_2
+;- lock inc byte ptr [esi]
+;-
+;- DISABLE_CACHE
+;-;
+;-; Halt the AP and wait for the next SIPI
+;-;
+;-Ap_Halt:
+;- cli
+;-@@:
+;- hlt
+;- jmp @B
+;- ret
+;-StartUpAp ENDP
+;-
+;-
+;-CheckValidCMOS PROC NEAR PRIVATE
+;- ;
+;- ; Check CMOS Status
+;- ;
+;- mov esi, PCH_LPC_GEN_PMCON_3_ADDR
+;- mov eax, es:[esi]
+;-
+;- ; check PWR_FLR and RTC_PWR_STS status
+;- and eax, BIT2 + BIT1
+;-
+;- RET_EBP
+;-CheckValidCMOS ENDP
+
+MtrrInitTable LABEL BYTE
+ DW MTRR_DEF_TYPE
+ DW MTRR_FIX_64K_00000
+ DW MTRR_FIX_16K_80000
+ DW MTRR_FIX_16K_A0000
+ DW MTRR_FIX_4K_C0000
+ DW MTRR_FIX_4K_C8000
+ DW MTRR_FIX_4K_D0000
+ DW MTRR_FIX_4K_D8000
+ DW MTRR_FIX_4K_E0000
+ DW MTRR_FIX_4K_E8000
+ DW MTRR_FIX_4K_F0000
+ DW MTRR_FIX_4K_F8000
+
+MtrrCountFixed EQU (($ - MtrrInitTable) / 2)
+
+ DW MTRR_PHYS_BASE_0
+ DW MTRR_PHYS_MASK_0
+ DW MTRR_PHYS_BASE_1
+ DW MTRR_PHYS_MASK_1
+ DW MTRR_PHYS_BASE_2
+ DW MTRR_PHYS_MASK_2
+ DW MTRR_PHYS_BASE_3
+ DW MTRR_PHYS_MASK_3
+ DW MTRR_PHYS_BASE_4
+ DW MTRR_PHYS_MASK_4
+ DW MTRR_PHYS_BASE_5
+ DW MTRR_PHYS_MASK_5
+ DW MTRR_PHYS_BASE_6
+ DW MTRR_PHYS_MASK_6
+ DW MTRR_PHYS_BASE_7
+ DW MTRR_PHYS_MASK_7
+ DW MTRR_PHYS_BASE_8
+ DW MTRR_PHYS_MASK_8
+ DW MTRR_PHYS_BASE_9
+ DW MTRR_PHYS_MASK_9
+MtrrCount EQU (($ - MtrrInitTable) / 2)
diff --git a/ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/SecStartup.c b/ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/SecStartup.c
new file mode 100644
index 0000000..9c6f19c
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/SecCore/Sec/Ia32/SecStartup.c
@@ -0,0 +1,136 @@
+/** @file
+ SEC Startup function invoked after SEC Ram is started.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#include "Tiano.h"
+#include "PeiCore.h"
+#include "FlashMap.h"
+#include "EfiFirmwareFileSystem.h"
+#include "EfiFirmwareVolumeHeader.h"
+
+#include EFI_PPI_DEFINITION (SecPlatformInformation)
+
+///
+/// Define the Microcode FV base and size
+/// So as to be used by Flat32.asm
+/// Here the Microcode binary is embedded in a FFS within a FV
+/// So the header should be taken into count to get the raw data
+/// In FV header, the EFI_FV_BLOCK_MAP_ENTRY is an array with variable size
+/// If the map is changed, it has to be adjusted as well.
+///
+UINT32 MicrocodeStart = FLASH_REGION_NVSTORAGE_SUBREGION_MICROCODE_BASE +
+ sizeof (EFI_FFS_FILE_HEADER);
+UINT32 MicrocodeEnd = FLASH_REGION_NVSTORAGE_SUBREGION_MICROCODE_BASE +
+ FLASH_REGION_NVSTORAGE_SUBREGION_MICROCODE_SIZE;
+
+extern UINT32 *TopOfCar;
+
+EFI_STATUS
+SecPlatformInformation (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN OUT UINT64 *StructureSize,
+ IN OUT SEC_PLATFORM_INFORMATION_RECORD *PlatformInformationRecord
+ );
+
+EFI_SEC_PLATFORM_INFORMATION_PPI mSecPlatformInformationPpi = { SecPlatformInformation };
+
+EFI_PEI_PPI_DESCRIPTOR mPeiSecPlatformInformationPpi = {
+ (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+ &gEfiSecPlatformInformationPpiGuid,
+ &mSecPlatformInformationPpi
+};
+
+/**
+ Implementation of the PlatformInformation service in
+ EFI_SEC_PLATFORM_INFORMATION_PPI.
+ This function conveys state information out of the SEC phase into PEI.
+
+ @param[in] PeiServices - Pointer to the PEI Services Table.
+ @param[in] StructureSize - Pointer to the variable describing size of the input buffer.
+ @param[in] PlatformInformationRecord - Pointer to the EFI_SEC_PLATFORM_INFORMATION_RECORD.
+
+ @retval EFI_SUCCESS - The data was successfully returned.
+ @retval EFI_BUFFER_TOO_SMALL - The buffer was too small.
+**/
+EFI_STATUS
+EFIAPI
+SecPlatformInformation (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN OUT UINT64 *StructureSize,
+ IN OUT SEC_PLATFORM_INFORMATION_RECORD *PlatformInformationRecord
+ )
+{
+ UINT32 *BIST;
+ UINT32 Size;
+ UINT32 Count;
+
+ ///
+ /// The entries of BIST information, together with the number of them,
+ /// reside in the bottom of stack, left untouched by normal stack operation.
+ /// This routine copies the BIST information to the buffer pointed by
+ /// PlatformInformationRecord for output.
+ ///
+ Count = *(TopOfCar - 1);
+ Size = Count * sizeof (UINT64);
+
+ if ((*StructureSize) < (UINT64) Size) {
+ *StructureSize = Size;
+ return EFI_BUFFER_TOO_SMALL;
+ }
+
+ *StructureSize = Size;
+ BIST = (UINT32 *) ((UINT32) TopOfCar - sizeof (UINT32) - Size);
+
+ EfiCommonLibCopyMem (PlatformInformationRecord, BIST, Size);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Entry point to the C language phase of SEC. After the SEC assembly
+ code has initialized some temporary memory and set up the stack,
+ the control is transferred to this function.
+
+ @param[in] SizeOfRam - Size of the temporary memory available for use.
+ @param[in] BootFirmwareVolume - Base address of the Boot Firmware Volume.
+ @param[in] PeiCoreEntryPoint - Pointer to the entry point of the PEI core.
+
+ @retval This function never returns
+**/
+VOID
+SecStartup (
+ IN UINT32 SizeOfRam,
+ IN UINT32 BootFirmwareVolume,
+ IN PEI_MAIN_ENTRY_POINT PeiCoreEntryPoint
+ )
+{
+ EFI_PEI_STARTUP_DESCRIPTOR PeiStartup;
+
+ PeiStartup.SizeOfCacheAsRam = SizeOfRam;
+ PeiStartup.BootFirmwareVolume = BootFirmwareVolume;
+ PeiStartup.DispatchTable = &mPeiSecPlatformInformationPpi;
+
+ ///
+ /// Transfer the control to the PEI core
+ ///
+ (*PeiCoreEntryPoint)(&PeiStartup);
+
+ ///
+ /// Should not come here.
+ ///
+ return;
+}
diff --git a/ReferenceCode/Haswell/SampleCode/TxtOneTouch/Dxe/TxtOneTouchDxe.c b/ReferenceCode/Haswell/SampleCode/TxtOneTouch/Dxe/TxtOneTouchDxe.c
new file mode 100644
index 0000000..9c7efae
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/TxtOneTouch/Dxe/TxtOneTouchDxe.c
@@ -0,0 +1,631 @@
+/** @file
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+#include "TxtOneTouchDxe.h"
+
+TXT_ONE_TOUCH_OP_PROTOCOL mTxtOneTouchOpProtocol = {
+ TxtExecOperation,
+ TxtConfirmationDialog,
+ TxtResetState
+};
+
+EFI_TCG_PROTOCOL *mTcgProtocol;
+TXT_ONE_TOUCH_SETUP mTxtVariable;
+
+/**
+ @param[in] ImageHandle - A handle for this module
+ @param[in] SystemTable - A pointer to the EFI System Table
+
+ @retval EFI_SUCCESS - If TXT initialization succeed
+ @retval EFI_UNLOAD_IMAGE - If TXT criterias are not met
+**/
+EFI_STATUS
+EFIAPI
+DriverEntry (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ EFI_HANDLE Handle;
+
+ Handle = NULL;
+ ZeroMem (&mTxtVariable, sizeof (TXT_ONE_TOUCH_SETUP));
+
+ ///
+ /// Install the protocol
+ ///
+ Status = gBS->InstallProtocolInterface (
+ &Handle,
+ &gTxtOneTouchOpProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ &mTxtOneTouchOpProtocol
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Locate TcgProtocol
+ ///
+ mTcgProtocol = NULL;
+ Status = gBS->LocateProtocol (&gEfiTcgProtocolGuid, NULL, (VOID **) &mTcgProtocol);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Initiate the variable if it doesn't exist.
+ ///
+ if (ReadWriteVariable (&mTxtVariable, FALSE) != EFI_SUCCESS) {
+ ReadWriteVariable (&mTxtVariable, TRUE);
+ }
+
+ return Status;
+}
+
+/**
+ Read/Write variable for enable/disable TxT one
+ touch functions
+
+ @param[in] VariableData - Point to Setup variable buffer
+ @param[in] WriteData - TRUE, write changes to Setup Variable. FALSE, not to write variable.
+
+ @retval EFI_SUCCESS - Operation complete successful
+ @retval EFI_INVALID_PARAMETER - VariableData is NULL
+**/
+EFI_STATUS
+ReadWriteVariable (
+ IN OUT TXT_ONE_TOUCH_SETUP *VariableData,
+ IN BOOLEAN WriteData
+ )
+{
+ EFI_STATUS Status;
+ UINTN Size;
+ UINT32 VarAttrib;
+
+ Status = EFI_SUCCESS;
+ Size = 0;
+ VarAttrib = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS;
+
+ if (VariableData == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (WriteData == TRUE) {
+ ///
+ /// Write TxT variable
+ ///
+ Size = sizeof (TXT_ONE_TOUCH_SETUP);
+
+ Status = gRT->SetVariable (
+ TXT_ONE_TOUCH_VAR,
+ &gTxtOneTouchGuid,
+ VarAttrib,
+ Size,
+ VariableData
+ );
+ } else {
+ ///
+ /// Read TxT variable
+ ///
+ Size = sizeof (TXT_ONE_TOUCH_SETUP);
+
+ Status = gRT->GetVariable (
+ TXT_ONE_TOUCH_VAR,
+ &gTxtOneTouchGuid,
+ NULL,
+ &Size,
+ VariableData
+ );
+ }
+
+ return Status;
+}
+
+/**
+ Read TxT Maintenance flag
+
+ @retval TRUE - TxT Maintenance Flag is TRUE
+ @retval FALSE - TxT Maintenance Flag is FALSE
+**/
+BOOLEAN
+CheckTxtMaintenanceFlag (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+
+ Status = EFI_SUCCESS;
+
+ ///
+ /// TBD. Need to read TPM NV index 0x50010000
+ ///
+ ///
+ /// Read TxT variable first
+ ///
+ Status = ReadWriteVariable (&mTxtVariable, FALSE);
+ if (EFI_ERROR (Status)) {
+ return FALSE;
+ }
+
+ return mTxtVariable.NoTxtMaintenance;
+}
+
+/**
+ Extend PPI operation for TxT.
+
+ @param[in] This - Point of TXT_ONE_TOUCH_OP_PROTOCOL
+ @param[in] Command - Operation value for TxT
+
+ @retval EFI_SUCCESS - Execute the Command successful
+ @retval EFI_UNSUPPORTED - Command is not supported
+**/
+EFI_STATUS
+EFIAPI
+TxtExecOperation (
+ IN TXT_ONE_TOUCH_OP_PROTOCOL *This,
+ IN UINT8 Command
+ )
+{
+ EFI_STATUS Status;
+
+ Status = EFI_SUCCESS;
+
+ ///
+ /// Read TxT variable first
+ ///
+ Status = ReadWriteVariable (&mTxtVariable, FALSE);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ ///
+ /// Read variable for TxT One Touch function
+ /// The variable can be Setup variable
+ ///
+ switch (Command) {
+ case DISABLE_DEACTIVATE:
+ ///
+ /// Disable & Deactive TPM
+ /// Disable TxT
+ ///
+ mTxtVariable.TxtEnable = FALSE;
+ break;
+
+ case ENABLE_VT:
+ ///
+ /// Enable VT
+ ///
+ mTxtVariable.VtEnable = TRUE;
+ break;
+
+ case DISABLE_VT_TXT:
+ ///
+ /// Disable VT and TxT
+ ///
+ mTxtVariable.VtEnable = FALSE;
+ mTxtVariable.TxtEnable = FALSE;
+ break;
+
+ case ENABLE_VTD:
+ ///
+ /// Enable VT-d
+ ///
+ mTxtVariable.VtdEnable = TRUE;
+ break;
+
+ case DISABLE_VTD_TXT:
+ ///
+ /// Disable VT-d and TxT
+ ///
+ mTxtVariable.VtdEnable = FALSE;
+ break;
+
+ case ENABLE_ACTTPM_VT_VTD_TXT_DISABLE_STM:
+ ///
+ /// Enable-Active TPM
+ /// Enable VT, VT-d and TxT
+ /// Disable STM
+ ///
+ TpmEnableActive (ENABLE_ACTIVATE);
+ ///
+ /// mTxtVariable.TpmEnable = TRUE;
+ /// mTxtVariable.TpmActive = TRUE;
+ ///
+ mTxtVariable.VtEnable = TRUE;
+ mTxtVariable.VtdEnable = TRUE;
+ mTxtVariable.TxtEnable = TRUE;
+ mTxtVariable.StmEnable = FALSE;
+ break;
+
+ case ENABLE_ACTTPM_VT_VTD_TXT_STM:
+ ///
+ /// Enable-Active TPM
+ /// Enable VT, VT-d, TxT and STM
+ ///
+ TpmEnableActive (ENABLE_ACTIVATE);
+ ///
+ /// mTxtVariable.TpmEnable = TRUE;
+ /// mTxtVariable.TpmActive = TRUE;
+ ///
+ mTxtVariable.VtEnable = TRUE;
+ mTxtVariable.VtdEnable = TRUE;
+ mTxtVariable.TxtEnable = TRUE;
+ mTxtVariable.StmEnable = TRUE;
+ break;
+
+ case DISABLE_STM:
+ ///
+ /// Disable STM
+ ///
+ mTxtVariable.StmEnable = FALSE;
+ break;
+
+ case DISABLE_TXT_STM:
+ ///
+ /// Disable TxT and STM
+ ///
+ mTxtVariable.TxtEnable = FALSE;
+ mTxtVariable.StmEnable = FALSE;
+ break;
+
+ case DISABLE_SENTER_VMX:
+ ///
+ /// Disable SENTER and VMX
+ ///
+ Status = EFI_UNSUPPORTED;
+ break;
+
+ case ENABLE_VMX_SMX_ONLY:
+ ///
+ /// Enable VMX in SMX only
+ ///
+ Status = EFI_UNSUPPORTED;
+ break;
+
+ case ENABLE_VMX_OUTSIDE_SMX:
+ ///
+ /// Enable VMX outside SMX Only
+ ///
+ Status = EFI_UNSUPPORTED;
+ break;
+
+ case ENABLE_VMX:
+ ///
+ /// Enable VMX
+ ///
+ Status = EFI_UNSUPPORTED;
+ break;
+
+ case ENABLE_SENTER_ONLY:
+ ///
+ /// Enable SENTER Only
+ ///
+ Status = EFI_UNSUPPORTED;
+ break;
+
+ case ENABLE_SENTER_VMX_IN_SMX:
+ ///
+ /// Enable SENTER and VMX in SMX
+ ///
+ Status = EFI_UNSUPPORTED;
+ break;
+
+ case ENABLE_SENTER_VMX_OUTSIDE_SMX:
+ ///
+ /// Enable SENTER and VMX outside SMX
+ ///
+ Status = EFI_UNSUPPORTED;
+ break;
+
+ case ENABLE_SENTER_VMX:
+ ///
+ /// Enable SENTER and VMX
+ ///
+ Status = EFI_UNSUPPORTED;
+ break;
+
+ case SET_NO_TXT_MAINTENANCE_FALSE:
+ ///
+ /// Set NoTxtMaintenance Flag FALSE
+ ///
+ mTxtVariable.NoTxtMaintenance = FALSE;
+ break;
+
+ case SET_NO_TXT_MAINTENANCE_TRUE:
+ ///
+ /// Set NoTxtMaintenance Flag TRUE
+ ///
+ mTxtVariable.NoTxtMaintenance = TRUE;
+ break;
+
+ default:
+ return EFI_UNSUPPORTED;
+ }
+ ///
+ /// Validate states
+ ///
+ Status = ValidateTxtStates (&mTxtVariable);
+ if (EFI_ERROR (Status)) {
+ Status = EFI_UNSUPPORTED;
+ } else {
+ ///
+ /// if settings are correct, write it to variable
+ ///
+ Status = ReadWriteVariable (&mTxtVariable, TRUE);
+ }
+
+ return Status;
+}
+
+/**
+ Confirmation dialog for TxT PPI
+
+ @param[in] This - Point of TXT_ONE_TOUCH_OP_PROTOCOL
+ @param[in] Command - Operation value for TxT
+ @param[in] Confirm - User confirm
+
+ @retval EFI_SUCCESS - Execute the Command successful
+ @retval EFI_UNSUPPORTED - Command is not supported
+**/
+EFI_STATUS
+EFIAPI
+TxtConfirmationDialog (
+ IN TXT_ONE_TOUCH_OP_PROTOCOL *This,
+ IN UINT8 Command,
+ IN OUT BOOLEAN *Confirm
+ )
+{
+ EFI_STATUS Status;
+
+ Status = EFI_SUCCESS;
+
+ if (CheckTxtMaintenanceFlag ()) {
+ *Confirm = FALSE;
+ }
+
+ switch (Command) {
+ case DISABLE_DEACTIVATE:
+ ///
+ /// Disable & Deactive TPM
+ /// Disable TxT
+ ///
+ gST->ConOut->OutputString (
+ gST->ConOut,
+ L"\nA configuration change was requested to Disable TxT\n\n\r"
+ );
+
+ break;
+
+ case ENABLE_VT:
+ ///
+ /// Enable VT
+ ///
+ gST->ConOut->OutputString (
+ gST->ConOut,
+ L"\nA configuration change was requested to Enable VT\n\n\r"
+ );
+ break;
+
+ case DISABLE_VT_TXT:
+ ///
+ /// Disable VT and TxT
+ ///
+ gST->ConOut->OutputString (
+ gST->ConOut,
+ L"\nA configuration change was requested to Disable VT and TxT\n\n\r"
+ );
+ break;
+
+ case ENABLE_VTD:
+ ///
+ /// Enable VT-d
+ ///
+ gST->ConOut->OutputString (
+ gST->ConOut,
+ L"\nA configuration change was requested to Enable VT-d\n\n\r"
+ );
+ break;
+
+ case DISABLE_VTD_TXT:
+ ///
+ /// Disable VT-d and TxT
+ ///
+ gST->ConOut->OutputString (
+ gST->ConOut,
+ L"\nA configuration change was requested to Disable VT-d and TxT\n\n\r"
+ );
+ break;
+
+ case ENABLE_ACTTPM_VT_VTD_TXT_DISABLE_STM:
+ ///
+ /// Enable-Active TPM
+ /// Enable VT, VT-d and TxT
+ /// Disable STM
+ ///
+ gST->ConOut->OutputString (
+ gST->ConOut,
+ L"\nA configuration change was requested to Enable/Active TPM and Enable VT/VT-d/TxT, and Disable STM\n\n\r"
+ );
+ break;
+
+ case ENABLE_ACTTPM_VT_VTD_TXT_STM:
+ ///
+ /// Enable-Active TPM
+ /// Enable VT, VT-d, TxT and STM
+ ///
+ gST->ConOut->OutputString (
+ gST->ConOut,
+ L"\nA configuration change was requested to Enable/Active TPM and Enable VT/VT-d/TxT/STM\n\n\r"
+ );
+ break;
+
+ case DISABLE_STM:
+ ///
+ /// Disable STM
+ ///
+ gST->ConOut->OutputString (
+ gST->ConOut,
+ L"\nA configuration change was requested to Disable STM\n\n\r"
+ );
+ break;
+
+ case DISABLE_TXT_STM:
+ ///
+ /// Disable TxT and STM
+ ///
+ gST->ConOut->OutputString (
+ gST->ConOut,
+ L"\nA configuration change was requested to Disable TxT and STM\n\n\r"
+ );
+ break;
+
+ case DISABLE_SENTER_VMX:
+ ///
+ /// Disable SENTER and VMX
+ ///
+ gST->ConOut->OutputString (
+ gST->ConOut,
+ L"\nA configuration change was requested to Disable SENTER and VMX\n\n\r"
+ );
+ break;
+
+ case ENABLE_VMX_SMX_ONLY:
+ ///
+ /// Enable VMX in SMX only
+ ///
+ gST->ConOut->OutputString (
+ gST->ConOut,
+ L"\nA configuration change was requested to Enable VMX in SMX only\n\n\r"
+ );
+ break;
+
+ case ENABLE_VMX_OUTSIDE_SMX:
+ ///
+ /// Enable VMX outside SMX Only
+ ///
+ gST->ConOut->OutputString (
+ gST->ConOut,
+ L"\nA configuration change was requested to Enable VMX outside SMX Only\n\n\r"
+ );
+ break;
+
+ case ENABLE_VMX:
+ ///
+ /// Enable VMX
+ ///
+ gST->ConOut->OutputString (
+ gST->ConOut,
+ L"\nA configuration change was requested to Enable VMX\n\n\r"
+ );
+ break;
+
+ case ENABLE_SENTER_ONLY:
+ ///
+ /// Enable SENTER Only
+ ///
+ gST->ConOut->OutputString (
+ gST->ConOut,
+ L"\nA configuration change was requested to Enable SENTER only\n\n\r"
+ );
+ break;
+
+ case ENABLE_SENTER_VMX_IN_SMX:
+ ///
+ /// Enable SENTER and VMX in SMX
+ ///
+ gST->ConOut->OutputString (
+ gST->ConOut,
+ L"\nA configuration change was requested to Enable SENTER and VMX in SMX\n\n\r"
+ );
+ break;
+
+ case ENABLE_SENTER_VMX_OUTSIDE_SMX:
+ ///
+ /// Enable SENTER and VMX outside SMX
+ ///
+ gST->ConOut->OutputString (
+ gST->ConOut,
+ L"\nA configuration change was requested to Enable SENTER and VMX outside SMX\n\n\r"
+ );
+ break;
+
+ case ENABLE_SENTER_VMX:
+ ///
+ /// Enable SENTER and VMX
+ ///
+ gST->ConOut->OutputString (
+ gST->ConOut,
+ L"\nA configuration change was requested to Enable SENTER and VMX\n\n\r"
+ );
+ break;
+
+ case SET_NO_TXT_MAINTENANCE_FALSE:
+ ///
+ /// Set NoTxtMaintenance Flag FALSE
+ ///
+ gST->ConOut->OutputString (
+ gST->ConOut,
+ L"\nA configuration change was requested to Set TxT Maintenance Flag to FALSE\n\n\r"
+ );
+ break;
+
+ case SET_NO_TXT_MAINTENANCE_TRUE:
+ ///
+ /// Set NoTxtMaintenance Flag TRUE
+ ///
+ gST->ConOut->OutputString (
+ gST->ConOut,
+ L"\nA configuration change was requested to Set TxT Maintenance Flag to TRUE\n\n\r"
+ );
+ break;
+
+ default:
+ return EFI_UNSUPPORTED;
+ }
+
+ return Status;
+}
+
+/**
+ Reset system.
+
+ @param[in] This - Point of TXT_ONE_TOUCH_OP_PROTOCOL
+ @param[in] Command - Operation value for TxT
+
+ @retval EFI_SUCCESS - Always return EFI_SUCCESS
+**/
+EFI_STATUS
+EFIAPI
+TxtResetState (
+ IN TXT_ONE_TOUCH_OP_PROTOCOL *This,
+ IN UINT8 Command
+ )
+{
+ EFI_STATUS Status;
+ PCH_RESET_PROTOCOL *PchReset;
+
+ Status = gBS->LocateProtocol (&gPchResetProtocolGuid, NULL, (VOID **) &PchReset);
+ if (!EFI_ERROR (Status)) {
+ PchReset->Reset (PchReset, GlobalReset);
+ } else {
+ gRT->ResetSystem (EfiResetShutdown, EFI_SUCCESS, 0, NULL);
+ }
+
+ ASSERT (FALSE);
+ ///
+ /// Should not be here
+ ///
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/Haswell/SampleCode/TxtOneTouch/Dxe/TxtOneTouchDxe.cif b/ReferenceCode/Haswell/SampleCode/TxtOneTouch/Dxe/TxtOneTouchDxe.cif
new file mode 100644
index 0000000..7e4a219
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/TxtOneTouch/Dxe/TxtOneTouchDxe.cif
@@ -0,0 +1,14 @@
+<component>
+ name = "TxtOneTouch"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Haswell\SampleCode\TxtOneTouch\Dxe"
+ RefName = "TxtOneTouchDxe"
+[files]
+"TxtOneTouchDxe.sdl"
+"TxtOneTouchDxe.dxs"
+"TxtOneTouchDxe.mak"
+"TxtOneTouchDxe.inf"
+"TxtOneTouchDxe.c"
+"TxtOneTouchDxe.h"
+"TxtOneTouchOp.c"
+<endComponent>
diff --git a/ReferenceCode/Haswell/SampleCode/TxtOneTouch/Dxe/TxtOneTouchDxe.dxs b/ReferenceCode/Haswell/SampleCode/TxtOneTouch/Dxe/TxtOneTouchDxe.dxs
new file mode 100644
index 0000000..2b37172
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/TxtOneTouch/Dxe/TxtOneTouchDxe.dxs
@@ -0,0 +1,42 @@
+/** @file
+ This is the Dependency expression for the TXT Dxe architectural protocol
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "DxeDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+#include EFI_PROTOCOL_DEFINITION (CpuPlatformPolicy)
+#include EFI_PROTOCOL_CONSUMER (TcgService)
+#endif
+
+DEPENDENCY_START
+ EFI_TCG_PROTOCOL_GUID AND
+ DXE_CPU_PLATFORM_POLICY_PROTOCOL_GUID
+DEPENDENCY_END
diff --git a/ReferenceCode/Haswell/SampleCode/TxtOneTouch/Dxe/TxtOneTouchDxe.h b/ReferenceCode/Haswell/SampleCode/TxtOneTouch/Dxe/TxtOneTouchDxe.h
new file mode 100644
index 0000000..5722d40
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/TxtOneTouch/Dxe/TxtOneTouchDxe.h
@@ -0,0 +1,158 @@
+/** @file
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _TXT_ONE_TOUCH_DXE_H_
+#define _TXT_ONE_TOUCH_DXE_H_
+
+///
+/// External include files do NOT need to be explicitly specified in real EDKII
+/// environment
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include EFI_GUID_DEFINITION (TxtOneTouch)
+#include EFI_PROTOCOL_DEFINITION (TxtOneTouchOp)
+#include EFI_PROTOCOL_DEFINITION (PchReset)
+#include EFI_PROTOCOL_CONSUMER (TcgService)
+#endif
+
+#define H2NL(x) (H2NS ((x) >> 16) | (H2NS ((x) & 0xffff) << 16))
+#define H2NS(x) ((((x) << 8) | ((x) >> 8)) & 0xffff)
+#define TPM_PP_USER_ABORT ((TPM_RESULT) (-0x10))
+#define TPM_PP_BIOS_FAILURE ((TPM_RESULT) (-0x0f))
+
+///
+/// TPM PPI Commands
+///
+#define ENABLE 1
+#define ACTIVATE 3
+#define ENABLE_ACTIVATE 6
+#define DISABLE_DEACTIVATE 7
+
+///
+/// Definitions
+///
+#define TXT_ONE_TOUCH_VAR L"TxtOneTouch"
+#pragma pack(push, 1)
+typedef struct {
+ BOOLEAN NoTxtMaintenance;
+ BOOLEAN TpmEnable;
+ BOOLEAN TpmActive;
+ BOOLEAN VtEnable;
+ BOOLEAN VtdEnable;
+ BOOLEAN TxtEnable;
+ BOOLEAN StmEnable;
+ BOOLEAN VmxEnable;
+ BOOLEAN VmxInSmxEnable;
+ BOOLEAN VmxOutsideSmxEnable;
+ BOOLEAN SenterEnable;
+} TXT_ONE_TOUCH_SETUP;
+#pragma pack(pop)
+
+/**
+ Extend PPI operation for TxT.
+
+ @param[in] This - Point of TXT_ONE_TOUCH_OP_PROTOCOL
+ @param[in] Command - Operation value for TxT
+
+ @retval EFI_SUCCESS - Execute the Command successful
+ @retval EFI_UNSUPPORTED - Command is not supported
+**/
+EFI_STATUS
+EFIAPI
+TxtExecOperation (
+ IN TXT_ONE_TOUCH_OP_PROTOCOL *This,
+ IN UINT8 Command
+ );
+
+/**
+ Confirmation dialog for TxT PPI
+
+ @param[in] This - Point of TXT_ONE_TOUCH_OP_PROTOCOL
+ @param[in] Command - Operation value for TxT
+ @param[in] Confirm - User confirm
+
+ @retval EFI_SUCCESS - Execute the Command successful
+ @retval EFI_UNSUPPORTED - Command is not supported
+**/
+EFI_STATUS
+EFIAPI
+TxtConfirmationDialog (
+ IN TXT_ONE_TOUCH_OP_PROTOCOL *This,
+ IN UINT8 Command,
+ IN OUT BOOLEAN *Confirm
+ );
+
+/**
+ Reset system.
+
+ @param[in] This - Point of TXT_ONE_TOUCH_OP_PROTOCOL
+ @param[in] Command - Operation value for TxT
+
+ @retval EFI_SUCCESS - Always return EFI_SUCCESS
+**/
+EFI_STATUS
+EFIAPI
+TxtResetState (
+ IN TXT_ONE_TOUCH_OP_PROTOCOL *This,
+ IN UINT8 Command
+ );
+
+/**
+ Enable/Active TPM
+
+ @param[in] Command - The operation code for TxT One Touch function
+
+ @retval EFI_SUCCESS - TPM command lunch success
+ @retval EFI_UNSUPPORTED - The Command is not supported
+ @retval EFI_DEVICE_ERROR - Faile to lunch TPM command
+**/
+EFI_STATUS
+TpmEnableActive (
+ IN UINT8 Command
+ );
+
+/**
+ Read/Write variable for enable/disable TxT one
+ touch functions
+
+ @param[in] VariableData - Point to Setup variable buffer
+ @param[in] WriteData - TRUE, write changes to Setup Variable. FALSE, not to write variable.
+
+ @retval EFI_SUCCESS - Operation complete successful
+ @retval EFI_INVALID_PARAMETER - VariableData is NULL
+**/
+EFI_STATUS
+ReadWriteVariable (
+ IN OUT TXT_ONE_TOUCH_SETUP *VariableData,
+ IN BOOLEAN WriteData
+ );
+
+/**
+ Verify the status of Chipset capaibility and Setup settings
+
+ @param[in] Data - Point to TXT_ONE_TOUCH_SETUP
+
+ @exception EFI_UNSUPPORTED - The system is not able to lunch TxT
+ @retval EFI_SUCCESS - The system is able to lunch TxT
+**/
+EFI_STATUS
+ValidateTxtStates (
+ IN TXT_ONE_TOUCH_SETUP *Data
+ );
+
+#endif
diff --git a/ReferenceCode/Haswell/SampleCode/TxtOneTouch/Dxe/TxtOneTouchDxe.inf b/ReferenceCode/Haswell/SampleCode/TxtOneTouch/Dxe/TxtOneTouchDxe.inf
new file mode 100644
index 0000000..5a7038b
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/TxtOneTouch/Dxe/TxtOneTouchDxe.inf
@@ -0,0 +1,113 @@
+## @file
+# Component description file for TXTDXE module
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = TxtOneTouchDxe
+FILE_GUID = 67791e00-0c05-4ae7-a921-fc4057221653
+COMPONENT_TYPE = BS_DRIVER
+
+[sources.common]
+ TxtOneTouchDxe.c
+ TxtOneTouchOp.c
+ TxtOneTouchDxe.h
+
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueDxeDriverEntryPoint.c
+
+[includes.common]
+ .
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Framework/Protocol
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Sample/Include
+ $(EDK_SOURCE)/Foundation/Cpu/Pentium/Include
+
+#
+# Edk II Glue Library, some hearder are included by R9 header so have to include
+#
+
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Framework
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/SampleCode
+
+[libraries.common]
+ EfiGuidLib
+ EdkFrameworkProtocolLib
+ EdkProtocolLib
+ EfiScriptLib
+ CpuGuidLib
+ CpuProtocolLib
+ $(PROJECT_PCH_FAMILY)ProtocolLib
+ EdkIIGlueBaseLib
+ EdkIIGlueBaseMemoryLib
+ EdkIIGlueDxeReportStatusCodeLib
+ EdkIIGlueDxeServicesTableLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueUefiLib
+ EdkIIGlueDxeHobLib
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ CpuSampleProtocolLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = TxtOneTouchDxe.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=DriverEntry
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_LIB__ \
+ -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_UEFI_LIB__ \
+ -D __EDKII_GLUE_DXE_HOB_LIB__
diff --git a/ReferenceCode/Haswell/SampleCode/TxtOneTouch/Dxe/TxtOneTouchDxe.mak b/ReferenceCode/Haswell/SampleCode/TxtOneTouch/Dxe/TxtOneTouchDxe.mak
new file mode 100644
index 0000000..7481ab7
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/TxtOneTouch/Dxe/TxtOneTouchDxe.mak
@@ -0,0 +1,88 @@
+#/*++
+#Copyright (c) 2009 - 2011 Intel Corporation. All rights reserved.
+#This software and associated documentation (if any) is furnished
+#under a license and may only be used or copied in accordance
+#with the terms of the license. Except as permitted by such
+#license, no part of this software or documentation may be
+#reproduced, stored in a retrieval system, or transmitted in any
+#form or by any means without the express written consent of
+#Intel Corporation.
+#
+#Module Name:
+#
+# TxtPolicyInitDxeLib.mak
+#
+#Abstract:
+#
+# Make file for the TxtPolicyInitDxeLib component
+#
+#--*/
+all : TxtOneTouchDxe
+
+TxtOneTouchDxe : $(BUILD_DIR)\TxtOneTouchDxe.mak TxtOneTouchDxeBin
+
+$(BUILD_DIR)\TxtOneTouchDxe.mak : $(TxtOneTouchDxe_DIR)\$(@B).cif $(TxtOneTouchDxe_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(TxtOneTouchDxe_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+TxtOneTouchDxeIncludes=\
+ $(MISCFRAMEWORK_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ /I$(INTEL_PCH_DIR)\
+ $(PROJECT_CPU_INCLUDES)\
+ $(TXT_INCLUDES)\
+
+TxtOneTouchDxeDefines=\
+ $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=DriverEntry"\
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_BASE_LIB__ \
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_UEFI_LIB__ \
+ /D __EDKII_GLUE_UEFI_DEVICE_PATH_LIB__ \
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+ /D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ /D __EDKII_GLUE_DXE_HOB_LIB__ \
+
+TxtOneTouchDxeLibs=\
+ $(EFIGUIDLIB)\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(EDKPROTOCOLLIB)\
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueDxeServicesTableLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueUefiLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(EdkIIGlueDxeMemoryAllocationLib_LIB)\
+ $(EdkIIGlueBaseTimerLibLocalApic_LIB)\
+ $(EdkIIGlueDxeHobLib_LIB)\
+ $(EdkIIGlueHiiLib_LIB)\
+ $(EFIDRIVERLIB)\
+ $(UEFIEFIIFRSUPPORTLIB)\
+ $(EFISCRIPTLIB)\
+ $(CpuProtocolLib_LIB)\
+ $(CpuGuidLib_LIB)\
+ $(CPUIA32LIB)\
+ $(CpuSampleCodeProtocolLib_LIB)\
+ $(INTEL_PCH_PROTOCOL_LIB)
+
+TxtOneTouchDxeBin : $(TxtOneTouchDxeLibs)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\TxtOneTouchDxe.mak all\
+ "MY_INCLUDES=$(TxtOneTouchDxeIncludes)"\
+ "MY_DEFINES=$(TxtOneTouchDxeDefines)"\
+ "GUID=67791e00-0c05-4ae7-a921-fc4057221653"\
+ "AFLAGS=$(AFLAGS) $(TxtOneTouchDxeIncludes)"\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=BS_DRIVER \
+ EDKIIModule=DXEDRIVER\
+ DEPEX1=$(TxtOneTouchDxe_DIR)\TxtOneTouchDxe.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX\
+ COMPRESS=1\
diff --git a/ReferenceCode/Haswell/SampleCode/TxtOneTouch/Dxe/TxtOneTouchDxe.sdl b/ReferenceCode/Haswell/SampleCode/TxtOneTouch/Dxe/TxtOneTouchDxe.sdl
new file mode 100644
index 0000000..541ccf4
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/TxtOneTouch/Dxe/TxtOneTouchDxe.sdl
@@ -0,0 +1,28 @@
+TOKEN
+ Name = "TxtOneTouchSupport"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+ Help = "Main switch"
+End
+
+MODULE
+ Help = "Includes TxtOneTouchDxe.mak into project"
+ File = "TxtOneTouchDxe.mak"
+End
+
+PATH
+ Name = "TxtOneTouchDxe_DIR"
+ Help = "TxT DXE Policy Init directory"
+End
+
+
+ELINK
+ Name = "$(BUILD_DIR)\TxtOneTouchDxe.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+
diff --git a/ReferenceCode/Haswell/SampleCode/TxtOneTouch/Dxe/TxtOneTouchOp.c b/ReferenceCode/Haswell/SampleCode/TxtOneTouch/Dxe/TxtOneTouchOp.c
new file mode 100644
index 0000000..860e90d
--- /dev/null
+++ b/ReferenceCode/Haswell/SampleCode/TxtOneTouch/Dxe/TxtOneTouchOp.c
@@ -0,0 +1,178 @@
+/** @file
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#include "TxtOneTouchDxe.h"
+#include "Tpm12.h"
+#include "CpuIa32.h"
+
+extern EFI_TCG_PROTOCOL *mTcgProtocol;
+
+/**
+ Execute TPM command
+
+ @param[in] TcgProtocol - Point to EFI_TCG_PROTOCOL
+ @param[in] Ordinal - TPM Command code
+ @param[in] AdditionalParameterSize - Size of additional parameters
+ @param[in] AdditionalParameters - Point to the buffer saves additional parameters
+
+ @retval EFI_SUCCESS - TPM command lunch success
+ @retval TPM_PP_BIOS_FAILURE - BIOS fail to execute TPM command
+**/
+TPM_RESULT
+TpmCommandNoReturnData (
+ IN EFI_TCG_PROTOCOL *TcgProtocol,
+ IN TPM_COMMAND_CODE Ordinal,
+ IN UINTN AdditionalParameterSize,
+ IN VOID *AdditionalParameters
+ )
+{
+ EFI_STATUS Status;
+ TPM_RQU_COMMAND_HDR *TpmRqu;
+ TPM_RSP_COMMAND_HDR TpmRsp;
+ UINT32 Size;
+
+ TpmRqu = (TPM_RQU_COMMAND_HDR *) AllocatePool (sizeof (*TpmRqu) + AdditionalParameterSize);
+ if (TpmRqu == NULL) {
+ return TPM_PP_BIOS_FAILURE;
+ }
+
+ TpmRqu->tag = H2NS (TPM_TAG_RQU_COMMAND);
+ Size = (UINT32) (sizeof (*TpmRqu) + AdditionalParameterSize);
+ TpmRqu->paramSize = H2NL (Size);
+ TpmRqu->ordinal = H2NL (Ordinal);
+ CopyMem (TpmRqu + 1, AdditionalParameters, AdditionalParameterSize);
+
+ Status = TcgProtocol->PassThroughToTpm (
+ TcgProtocol,
+ Size,
+ (UINT8 *) TpmRqu,
+ (UINT32) sizeof (TpmRsp),
+ (UINT8 *) &TpmRsp
+ );
+ FreePool (TpmRqu);
+ if (EFI_ERROR (Status) || (TpmRsp.tag != H2NS (TPM_TAG_RSP_COMMAND))) {
+ return TPM_PP_BIOS_FAILURE;
+ }
+
+ return H2NL (TpmRsp.returnCode);
+}
+
+/**
+ Enable/Active TPM
+
+ @param[in] Command - The operation code for TxT One Touch function
+
+ @retval EFI_SUCCESS - TPM command lunch success
+ @retval EFI_UNSUPPORTED - The Command is not supported
+ @retval EFI_DEVICE_ERROR - Faile to lunch TPM command
+**/
+EFI_STATUS
+TpmEnableActive (
+ IN UINT8 Command
+ )
+{
+ TPM_RESULT TpmResponse;
+ EFI_STATUS Status;
+ BOOLEAN BoolVal;
+
+ BoolVal = FALSE;
+ TpmResponse = 0;
+ Status = EFI_SUCCESS;
+
+ switch (Command) {
+ case ENABLE:
+ TpmResponse = TpmCommandNoReturnData (
+ mTcgProtocol,
+ TPM_ORD_PhysicalEnable,
+ 0,
+ NULL
+ );
+ break;
+
+ case ACTIVATE:
+ BoolVal = FALSE;
+ TpmResponse = TpmCommandNoReturnData (
+ mTcgProtocol,
+ TPM_ORD_PhysicalSetDeactivated,
+ sizeof (BoolVal),
+ &BoolVal
+ );
+ break;
+
+ case ENABLE_ACTIVATE:
+ Status = TpmEnableActive (ENABLE);
+ if (Status == EFI_SUCCESS) {
+ Status = TpmEnableActive (ACTIVATE);
+ }
+
+ return Status;
+
+ default:
+ Status = EFI_UNSUPPORTED;
+ break;
+ }
+
+ if (TpmResponse != 0) {
+ Status = EFI_DEVICE_ERROR;
+ }
+
+ return Status;
+}
+
+/**
+ Verify the status of Chipset capaibility and Setup settings
+
+ @param[in] Data - Point to TXT_ONE_TOUCH_SETUP
+
+ @exception EFI_UNSUPPORTED - The system is not able to lunch TxT
+ @retval EFI_SUCCESS - The system is able to lunch TxT
+**/
+EFI_STATUS
+ValidateTxtStates (
+ IN TXT_ONE_TOUCH_SETUP *Data
+ )
+{
+ EFI_CPUID_REGISTER CpuidRegs;
+
+ AsmCpuid (
+ 1,
+ &CpuidRegs.RegEax,
+ &CpuidRegs.RegEbx,
+ &CpuidRegs.RegEcx,
+ &CpuidRegs.RegEdx
+ );
+
+ if (Data->VtEnable) {
+ ///
+ /// Check if VMX supported
+ ///
+ if ((CpuidRegs.RegEcx & 0x020) == 0) {
+ return EFI_UNSUPPORTED;
+ }
+ }
+
+ if (Data->TxtEnable) {
+ ///
+ /// Check if TxT & VMX supported
+ ///
+ if ((CpuidRegs.RegEcx & 0x060) == 0) {
+ return EFI_UNSUPPORTED;
+ }
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/Haswell/Txt/BiosAcm/HSW_BIOSAC_DBG_Rev1_5.BIN b/ReferenceCode/Haswell/Txt/BiosAcm/HSW_BIOSAC_DBG_Rev1_5.BIN
new file mode 100644
index 0000000..01478dc
--- /dev/null
+++ b/ReferenceCode/Haswell/Txt/BiosAcm/HSW_BIOSAC_DBG_Rev1_5.BIN
Binary files differ
diff --git a/ReferenceCode/Haswell/Txt/BiosAcm/HSW_BIOSAC_PRO_NPW_Rev1_5.BIN b/ReferenceCode/Haswell/Txt/BiosAcm/HSW_BIOSAC_PRO_NPW_Rev1_5.BIN
new file mode 100644
index 0000000..04461da
--- /dev/null
+++ b/ReferenceCode/Haswell/Txt/BiosAcm/HSW_BIOSAC_PRO_NPW_Rev1_5.BIN
Binary files differ
diff --git a/ReferenceCode/Haswell/Txt/BiosAcm/HSW_BIOSAC_PRO_Rev1_5.BIN b/ReferenceCode/Haswell/Txt/BiosAcm/HSW_BIOSAC_PRO_Rev1_5.BIN
new file mode 100644
index 0000000..9ac1a89
--- /dev/null
+++ b/ReferenceCode/Haswell/Txt/BiosAcm/HSW_BIOSAC_PRO_Rev1_5.BIN
Binary files differ
diff --git a/ReferenceCode/Haswell/Txt/BiosAcm/TxtBiosAcm.cif b/ReferenceCode/Haswell/Txt/BiosAcm/TxtBiosAcm.cif
new file mode 100644
index 0000000..1ccd13b
--- /dev/null
+++ b/ReferenceCode/Haswell/Txt/BiosAcm/TxtBiosAcm.cif
@@ -0,0 +1,14 @@
+<component>
+ name = "TxtBiosAcm"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Haswell\Txt\BiosAcm"
+ RefName = "TxtBiosAcm"
+[files]
+"TxtBiosAcm.sdl"
+"TxtBiosAcm.mak"
+"HSW_BIOSAC_DBG_Rev1_5.BIN"
+"HSW_BIOSAC_PRO_Rev1_5.BIN"
+"HSW_BIOSAC_PRO_NPW_Rev1_5.BIN"
+"TxtBiosAcm.inf"
+"makefile.new"
+<endComponent>
diff --git a/ReferenceCode/Haswell/Txt/BiosAcm/TxtBiosAcm.inf b/ReferenceCode/Haswell/Txt/BiosAcm/TxtBiosAcm.inf
new file mode 100644
index 0000000..93e53da
--- /dev/null
+++ b/ReferenceCode/Haswell/Txt/BiosAcm/TxtBiosAcm.inf
@@ -0,0 +1,33 @@
+## @file
+# Component description file for Biosac module
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+
+[defines]
+BASE_NAME = BiosAc
+FILE_GUID = 2d27c618-7dcd-41f5-bb10-21166be7e143
+COMPONENT_TYPE = FILE
+BUILD_TYPE = MAKEFILE
+
+[sources.common]
+
+[includes.common]
+
+[libraries.common]
+
+[nmake.common]
diff --git a/ReferenceCode/Haswell/Txt/BiosAcm/TxtBiosAcm.mak b/ReferenceCode/Haswell/Txt/BiosAcm/TxtBiosAcm.mak
new file mode 100644
index 0000000..e88a6d0
--- /dev/null
+++ b/ReferenceCode/Haswell/Txt/BiosAcm/TxtBiosAcm.mak
@@ -0,0 +1,13 @@
+# MAK file for the ModulePart:TxtBiosAcm binary
+all: $(BUILD_DIR)\BiosAcm.ffs $(TxtBiosAcm_DIR)\TxtBiosAcm.mak
+
+$(BUILD_DIR)\HSW_BIOSAC.bin :
+ COPY $(TxtBiosAcmFile) $(BUILD_DIR)\HSW_BIOSAC.bin $(SILENT_OUT)
+
+$(BUILD_DIR)\BiosAcm.ffs : $(BUILD_DIR)\HSW_BIOSAC.bin
+ $(MAKE) /f Core\FFS.mak \
+ BUILD_DIR=$(BUILD_DIR) \
+ GUID=2d27c618-7dcd-41f5-bb10-21166be7e143\
+ TYPE=EFI_FV_FILETYPE_RAW \
+ FFS_ALIGNMENT=5 FFS_CHECKSUM=0\
+ RAWFILE=$(BUILD_DIR)\HSW_BIOSAC.bin FFSFILE=$(BUILD_DIR)\BiosAcm.ffs COMPRESS=0 NAME=BiosAcm \ No newline at end of file
diff --git a/ReferenceCode/Haswell/Txt/BiosAcm/TxtBiosAcm.sdl b/ReferenceCode/Haswell/Txt/BiosAcm/TxtBiosAcm.sdl
new file mode 100644
index 0000000..a8d7700
--- /dev/null
+++ b/ReferenceCode/Haswell/Txt/BiosAcm/TxtBiosAcm.sdl
@@ -0,0 +1,39 @@
+TOKEN
+ Name = "TxtBiosAcm_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable TxtBiosAcm support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+End
+
+TOKEN
+ Name = "TxtBiosAcmFile"
+ Value = "ReferenceCode\Haswell\Txt\BiosAcm\HSW_BIOSAC_PRO_Rev1_5.BIN"
+ TokenType = File
+ TargetMAK = Yes
+End
+
+PATH
+ Name = "TxtBiosAcm_DIR"
+ Help = "TXT BIOS ACM directory"
+End
+
+MODULE
+ Help = "Includes TxtBiosAcm.mak to Project"
+ File = "TxtBiosAcm.mak"
+End
+
+ELINK
+ Name = "/I$(TxtBiosAcm_DIR)"
+ Parent = "TXT_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\BiosAcm.ffs"
+ Parent = "FV_BB"
+ InvokeOrder = AfterParent
+End
+
diff --git a/ReferenceCode/Haswell/Txt/BiosAcm/makefile.new b/ReferenceCode/Haswell/Txt/BiosAcm/makefile.new
new file mode 100644
index 0000000..47222aa
--- /dev/null
+++ b/ReferenceCode/Haswell/Txt/BiosAcm/makefile.new
@@ -0,0 +1,63 @@
+#++
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#--
+#++
+#
+# Copyright (c) 1999 - 2011 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# Module Name:
+#
+# makefile.new
+#
+# Abstract:
+#
+# makefile for Biosac.bin file
+#
+#--
+
+
+#
+# Globals
+#
+BIN_DIR = $(BUILD_DIR)\$(PROCESSOR)
+TOOLCHAIN = TOOLCHAIN_$(PROCESSOR)
+
+TOOLBIN_DIR = $(BUILD_DIR)\Tools
+
+#
+# Include CommonTools.env enviroment
+#
+
+!INCLUDE $(BUILD_DIR)\PlatformTools.env
+
+BIOSAC_GUID = 2d27c618-7dcd-41f5-bb10-21166be7e143
+
+
+all :
+ copy $(SOURCE_DIR)\BiosAc.bin $(BIN_DIR)\BiosAc.bin
+
+ $(GENFFSFILE) -B $(BIN_DIR) -V -P1 <<$(BIN_DIR)\BiosAc.pkg
+PACKAGE.INF
+[.]
+BASE_NAME = BiosAc
+FFS_FILEGUID = $(BIOSAC_GUID)
+FFS_FILETYPE = EFI_FV_FILETYPE_RAW
+FFS_ATTRIB_CHECKSUM = FALSE
+FFS_ALIGNMENT = 5
+
+IMAGE_SCRIPT =
+{
+ BiosAc.bin
+}
+<<KEEP
+
diff --git a/ReferenceCode/Haswell/Txt/Tools/Apfixup.txt b/ReferenceCode/Haswell/Txt/Tools/Apfixup.txt
new file mode 100644
index 0000000..b4e2c01
--- /dev/null
+++ b/ReferenceCode/Haswell/Txt/Tools/Apfixup.txt
@@ -0,0 +1,33 @@
+#/*++
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#--*/
+#
+#/*++
+#
+#Copyright (c) 1999 - 2011 Intel Corporation. All rights reserved
+#This software and associated documentation (if any) is furnished
+#under a license and may only be used or copied in accordance
+#with the terms of the license. Except as permitted by such
+#license, no part of this software or documentation may be
+#reproduced, stored in a retrieval system, or transmitted in any
+#form or by any means without the express written consent of
+#Intel Corporation.
+#form or by any means without the express written consent of
+#Intel Corporation.
+#
+#
+# Module Name:
+#
+# Apfixup.txt
+#
+# Abstract:
+#
+# File format:
+#-----------------
+# Offset, Width
+#
+
+0x12, 4
diff --git a/ReferenceCode/Haswell/Txt/Tools/Stafixup.exe b/ReferenceCode/Haswell/Txt/Tools/Stafixup.exe
new file mode 100644
index 0000000..6a646b4
--- /dev/null
+++ b/ReferenceCode/Haswell/Txt/Tools/Stafixup.exe
Binary files differ
diff --git a/ReferenceCode/Haswell/Txt/Tools/TxtTools.cif b/ReferenceCode/Haswell/Txt/Tools/TxtTools.cif
new file mode 100644
index 0000000..db90d14
--- /dev/null
+++ b/ReferenceCode/Haswell/Txt/Tools/TxtTools.cif
@@ -0,0 +1,10 @@
+<component>
+ name = "TxtTools"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Haswell\Txt\Tools"
+ RefName = "TxtTools"
+[files]
+"Apfixup.txt"
+"Stafixup.exe"
+"TxtTools.sdl"
+<endComponent>
diff --git a/ReferenceCode/Haswell/Txt/Tools/TxtTools.sdl b/ReferenceCode/Haswell/Txt/Tools/TxtTools.sdl
new file mode 100644
index 0000000..7dd99ed
--- /dev/null
+++ b/ReferenceCode/Haswell/Txt/Tools/TxtTools.sdl
@@ -0,0 +1,23 @@
+TOKEN
+ Name = "TxtTools_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable TxtTools support in Project"
+End
+
+PATH
+ Name = "TxtTools_DIR"
+ Help = "TXT Tools directory"
+End
+
+TOKEN
+ Name = "AP_FIXUP_FILE"
+ Value = "$(TxtTools_DIR)\Apfixup.txt"
+ Help = "Name of AP FFS fixup table file."
+ TokenType = Expression
+ TargetMAK = Yes
+ TargetH = Yes
+End
diff --git a/ReferenceCode/Haswell/Txt/TxtInit/Dxe/TxtDxe.c b/ReferenceCode/Haswell/Txt/TxtInit/Dxe/TxtDxe.c
new file mode 100644
index 0000000..ef7ca8b
--- /dev/null
+++ b/ReferenceCode/Haswell/Txt/TxtInit/Dxe/TxtDxe.c
@@ -0,0 +1,171 @@
+/** @file
+ This is the main DXE file for TXT. It represents an abstract outline of the
+ steps required during DXE for enabling TXT. Each individual step is further
+ abstracted behind a function call interface. This is intended to minimize
+ the need to modify this file when porting TXT to future platforms.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+///
+/// External include files do NOT need to be explicitly specified in real EDKII
+/// environment
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "Txt.h"
+#include "TxtDxeLib.h"
+#endif
+
+TXT_DXE_LIB_CONTEXT mTxtDxeCtx;
+
+/**
+ This function gets registered as a callback to run the SCHECK function
+ from the TXT BIOS ACM as a result of Boot Events.
+
+ @param[in] Event - A pointer to the Event that triggered the callback.
+ @param[in] Context - A pointer to private data registered with the callback function.
+
+ @retval EFI_SUCCESS - Always.
+
+ **/
+EFI_STATUS
+EFIAPI
+ScheckCallback (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ DEBUG ((EFI_D_INFO, "TXTDXE::Running of DoScheck\n"));
+
+ DoScheck (&mTxtDxeCtx);
+ ///
+ /// Closed the event to avoid call twice when launch shell
+ ///
+ gBS->CloseEvent (Event);
+
+ return EFI_SUCCESS;
+}
+/**
+ This is the entry point to the TXT DXE Driver. This routine checks to see if
+ the platform should be configured for TXT and if so, configures the platform
+ by reserving and initializing TXT Configuration Space and TXT Device Memory and
+ registering a callback to run SCHECK from the TXT BIOS ACM prior to boot.
+
+ If the platform should not be configured for TXT, this routine checks the
+ establishment bit in the TPM and resets it if it is asserted.
+
+ @param[in] ImageHandle - A handle for this module
+ @param[in] SystemTable - A pointer to the EFI System Table
+
+ @retval EFI_SUCCESS - If TXT initialization succeed
+ @retval EFI_UNLOAD_IMAGE - If TXT criterias are not met
+**/
+EFI_STATUS
+EFIAPI
+DriverEntry (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ EFI_EVENT ReadyToBootEvent;
+ ///
+ /// Initialize the platform specific code
+ ///
+ Status = InitializeTxtDxeLib (ImageHandle, SystemTable, &mTxtDxeCtx);
+ ///
+ /// If failure - assume TXT is not enabled
+ ///
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "TXTDXE::InitializeTxtDxeLib failed.... Unloading\n"));
+ return EFI_UNLOAD_IMAGE;
+ }
+ ///
+ /// If ESTS.TXTRESET bit is set, skip all other functions since
+ /// attempt to execute GETSEC will hang system. Skipping allows to
+ /// boot to OS and let MLE assess situation.
+ ///
+ if (IsTxtResetSet (&mTxtDxeCtx)) {
+ DEBUG ((EFI_D_ERROR, "TXTDXE::TXT_RESET bit is set.... Unloading\n"));
+ return EFI_UNLOAD_IMAGE;
+ }
+ ///
+ /// If TXT is enabled, configure platform appropriately.
+ /// Code assumes that if TXT is enabled by CPU driver than all checks
+ /// are passed, i.e. TPM is present, CPU and CS are TXT capable.
+ ///
+ ///
+ /// Add to check CPU TXT capable in case CPU drivers do not check additional requirements
+ ///
+ if ((mTxtDxeCtx.TxtInfoData->ChipsetIsTxtCapable) && IsTxtProcessor () && IsTxtEnabled (&mTxtDxeCtx)) {
+ DEBUG ((EFI_D_INFO, "TXTDXE::TXT Enabled\n"));
+ ///
+ /// Mark TXT Config Space as System Reserved in Memory Map
+ ///
+ ReserveTxtConfigSpace (&mTxtDxeCtx);
+
+ ///
+ /// Allocate and Initialize TXT Device Memory
+ ///
+ Status = SetupTxtDeviceMemory (&mTxtDxeCtx);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "TXTDXE::SetupTxtDeviceMemory failed.... Unloading\n"));
+ return EFI_UNLOAD_IMAGE;
+ }
+ ///
+ /// Create callback to run SCHECK on a Legacy Boot event
+ ///
+ Status = EfiCreateEventReadyToBootEx (
+ EFI_TPL_CALLBACK,
+ ScheckCallback,
+ NULL,
+ &ReadyToBootEvent
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ } else {
+ ///
+ /// TXT is not enabled, so make sure TPM Establishment
+ /// bit is de-asserted
+ ///
+ DEBUG ((EFI_D_INFO, "TXTDXE::TXT Disabled\n"));
+
+ if (IsTxtEstablished (&mTxtDxeCtx)) {
+ ///
+ /// We can invoke BIOS ACM function only if CS and CPU are TXT
+ /// capable
+ ///
+ if ((mTxtDxeCtx.TxtInfoData->ChipsetIsTxtCapable) &&
+ IsTxtProcessor () &&
+ !(mTxtDxeCtx.TxtInfoData->Flags & TPM_INIT_FAILED)
+ ) {
+ DEBUG ((EFI_D_INFO, "TXTDXE::Resetting TPM Establishment bit\n"));
+ ResetTpmEstBit (&mTxtDxeCtx);
+ }
+ }
+ ///
+ /// Reset AUX
+ ///
+ Status = ResetTpmAux (&mTxtDxeCtx);
+ ASSERT_EFI_ERROR (Status);
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/Haswell/Txt/TxtInit/Dxe/TxtDxe.cif b/ReferenceCode/Haswell/Txt/TxtInit/Dxe/TxtDxe.cif
new file mode 100644
index 0000000..2add449
--- /dev/null
+++ b/ReferenceCode/Haswell/Txt/TxtInit/Dxe/TxtDxe.cif
@@ -0,0 +1,18 @@
+<component>
+ name = "TxtDxe"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Haswell\Txt\TxtInit\Dxe\"
+ RefName = "TxtDxe"
+[files]
+"TxtDxe.c"
+"TxtDxe.dxs"
+"TxtDxe.mak"
+"TxtDxe.sdl"
+"TxtDxeLib.c"
+"TxtDxeLib.h"
+"TxtDxe.inf"
+"TxtDxeOem.c"
+"x64\TxtDxeBsp.asm"
+"x64\TxtDxeAp.asm"
+"x64\Mmx64.inc"
+<endComponent>
diff --git a/ReferenceCode/Haswell/Txt/TxtInit/Dxe/TxtDxe.dxs b/ReferenceCode/Haswell/Txt/TxtInit/Dxe/TxtDxe.dxs
new file mode 100644
index 0000000..7120727
--- /dev/null
+++ b/ReferenceCode/Haswell/Txt/TxtInit/Dxe/TxtDxe.dxs
@@ -0,0 +1,50 @@
+/** @file
+ This is the Dependency expression for the TXT Dxe architectural protocol
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "DxeDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+#include EFI_PROTOCOL_DEFINITION (MpService)
+#include EFI_PROTOCOL_DEFINITION (BootScriptSave)
+#include EFI_PROTOCOL_DEFINITION (SmmBase)
+#include EFI_PROTOCOL_DEFINITION (PciIo)
+#include EFI_PROTOCOL_DEFINITION (CpuIo)
+#include EFI_PROTOCOL_DEFINITION (CpuPlatformPolicy)
+#endif
+
+DEPENDENCY_START
+ EFI_BOOT_SCRIPT_SAVE_PROTOCOL_GUID AND
+ EFI_MP_SERVICES_PROTOCOL_GUID AND
+ EFI_SMM_BASE_PROTOCOL_GUID AND
+ DXE_CPU_PLATFORM_POLICY_PROTOCOL_GUID AND
+
+ EFI_CPU_IO_PROTOCOL_GUID
+DEPENDENCY_END
diff --git a/ReferenceCode/Haswell/Txt/TxtInit/Dxe/TxtDxe.inf b/ReferenceCode/Haswell/Txt/TxtInit/Dxe/TxtDxe.inf
new file mode 100644
index 0000000..f6c1e20
--- /dev/null
+++ b/ReferenceCode/Haswell/Txt/TxtInit/Dxe/TxtDxe.inf
@@ -0,0 +1,117 @@
+## @file
+# Component description file for TXTDXE module
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+
+[defines]
+BASE_NAME = TxtDxe
+FILE_GUID = FF917E22-A228-448d-BDAA-68EFCCDDA5D3
+COMPONENT_TYPE = BS_DRIVER
+
+[sources.common]
+ TxtDxe.c
+ TxtDxeLib.c
+ TxtDxeOem.c
+ X64/TxtDxeBsp.asm
+ X64/TxtDxeAp.asm
+
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueDxeDriverEntryPoint.c
+
+[includes.common]
+ .
+ ./X64
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Include
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Framework/Protocol
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Sample/Include
+
+#
+# Edk II Glue Library, some hearder are included by R9 header so have to include
+#
+
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Framework
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/SampleCode
+
+[libraries.common]
+ EfiGuidLib
+ EdkFrameworkProtocolLib
+ EdkProtocolLib
+ EfiScriptLib
+ CpuGuidLib
+ CpuProtocolLib
+ EdkIIGlueBaseLib
+ EdkIIGlueBaseMemoryLib
+ EdkIIGlueBasePciLibPciExpress
+ EdkIIGlueDxeReportStatusCodeLib
+ EdkIIGlueDxeServicesTableLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueUefiLib
+ EdkIIGlueDxeHobLib
+ CpuProtocolLib
+
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ CpuSampleProtocolLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = TxtDxe.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=DriverEntry
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_LIB__ \
+ -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_UEFI_LIB__ \
+ -D __EDKII_GLUE_DXE_HOB_LIB__
diff --git a/ReferenceCode/Haswell/Txt/TxtInit/Dxe/TxtDxe.mak b/ReferenceCode/Haswell/Txt/TxtInit/Dxe/TxtDxe.mak
new file mode 100644
index 0000000..876fc41
--- /dev/null
+++ b/ReferenceCode/Haswell/Txt/TxtInit/Dxe/TxtDxe.mak
@@ -0,0 +1,72 @@
+# MAK file for the ModulePart:TxtDxe
+#-jeff debug
+all : TxtDxe
+
+TxtDxe : $(BUILD_DIR)\TxtDxe.mak TxtDxeBin
+
+$(BUILD_DIR)\TxtDxe.mak : $(TxtDxe_DIR)\$(@B).cif $(TxtDxe_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(TxtDxe_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+TxtDxe_INCLUDES=\
+ $(MISCFRAMEWORK_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(PROJECT_CPU_INCLUDES)\
+ $(TXT_INCLUDES)\
+
+TxtDxe_DEFINES=\
+ $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=DriverEntry"\
+ /D PlatformPciExpressBaseAddress=$(PCIEX_BASE_ADDRESS) \
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_BASE_LIB__ \
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_UEFI_LIB__ \
+ /D __EDKII_GLUE_UEFI_DEVICE_PATH_LIB__ \
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+ /D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ /D __EDKII_GLUE_DXE_HOB_LIB__ \
+
+TxtDxe_LIBS=\
+ $(EFIGUIDLIB)\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(EDKPROTOCOLLIB)\
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EdkIIGlueBaseLibX64_LIB)\
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueDxeServicesTableLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueUefiLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(EdkIIGlueBasePciExpressLib_LIB)\
+ $(EdkIIGlueDxeMemoryAllocationLib_LIB)\
+ $(EdkIIGlueBaseTimerLibLocalApic_LIB)\
+ $(EdkIIGlueDxeHobLib_LIB)\
+ $(EdkIIGlueHiiLib_LIB)\
+ $(EFIDRIVERLIB)\
+ $(UEFIEFIIFRSUPPORTLIB)\
+ $(EFISCRIPTLIB)\
+ $(CpuProtocolLib_LIB)\
+ $(CpuGuidLib_LIB)\
+ $(SaPcieDxeLib_LIB)\
+ $(CPUIA32LIB)
+
+TxtDxeBin : $(TxtDxe_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\TxtDxe.mak all\
+ "MY_INCLUDES=$(TxtDxe_INCLUDES)"\
+ "MY_DEFINES=$(TxtDxe_DEFINES)"\
+ "GUID=FF917E22-A228-448d-BDAA-68EFCCDDA5D3"\
+ "AFLAGS=$(AFLAGS) $(PROJECT_CPU_INCLUDES)"\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=BS_DRIVER \
+ EDKIIModule=DXEDRIVER\
+ DEPEX1=$(TxtDxe_DIR)\TxtDxe.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX\
+ COMPRESS=1\
diff --git a/ReferenceCode/Haswell/Txt/TxtInit/Dxe/TxtDxe.sdl b/ReferenceCode/Haswell/Txt/TxtInit/Dxe/TxtDxe.sdl
new file mode 100644
index 0000000..c17f497
--- /dev/null
+++ b/ReferenceCode/Haswell/Txt/TxtInit/Dxe/TxtDxe.sdl
@@ -0,0 +1,27 @@
+TOKEN
+ Name = "TxtDxe_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable TXT DXE init support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "TxtDxe_DIR"
+ Help = "TXT DXE source directory"
+End
+
+MODULE
+ Help = "Includes TXTDXE.mak into project"
+ File = "TXTDXE.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\TxtDxe.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+ \ No newline at end of file
diff --git a/ReferenceCode/Haswell/Txt/TxtInit/Dxe/TxtDxeLib.c b/ReferenceCode/Haswell/Txt/TxtInit/Dxe/TxtDxeLib.c
new file mode 100644
index 0000000..6aef615
--- /dev/null
+++ b/ReferenceCode/Haswell/Txt/TxtInit/Dxe/TxtDxeLib.c
@@ -0,0 +1,1080 @@
+/** @file
+ This file contains an implementation of the function call interfaces
+ required by the main TXT DXE file. Hopefully, future platform porting
+ tasks will be mostly limited to modifying the functions in this file.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+///
+/// External include files do NOT need to be explicitly specified in real EDKII
+/// environment
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "Txt.h"
+#include "TxtDxeLib.h"
+#include "EfiScriptLib.h"
+#include EFI_PROTOCOL_DEFINITION (PciIo)
+#include EFI_PROTOCOL_DEFINITION (PciRootBridgeIo)
+#include EFI_PROTOCOL_DEPENDENCY (FirmwareVolume)
+#endif
+
+EFI_GUID mTxtBiosAcmPeiFileGuid = PEI_BIOS_ACM_FILE_GUID;
+
+UINT64 mMcuAddr;
+UINT64 mAcmBase;
+UINT64 mApMtrrTab[2 * (IA32_MTRR_PHYSMASK9 - IA32_MTRR_PHYSBASE0 + 1) + 1];
+UINT64 mApIdt[2];
+UINT64 mApCr4;
+UINT64 mApSavedIa32ThermInterruptMSR[2];
+UINT32 mApSavedApicThermalValue;
+
+/**
+ This routine initializes and collects all Protocols and data required
+ by the routines in this file.
+
+ @param[in] ImageHandle - A pointer to the Image Handle for this file.
+ @param[in] SystemTable - A pointer to the EFI System Table
+ @param[in] TxtDxeCtx - A pointer to a caller allocated data structure that contains
+ all of the Protocols and data required by the routines
+ in this file.
+
+ @retval EFI_SUCCESS - Return EFI_SUCCESS if no error happen
+ @retval EFI_UNLOAD_IMAGE - If TxtInfoHob is not found
+**/
+EFI_STATUS
+InitializeTxtDxeLib (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable,
+ IN OUT TXT_DXE_LIB_CONTEXT *TxtDxeCtx
+ )
+{
+ EFI_STATUS Status;
+ VOID *HobList;
+ TXT_INFO_HOB *TxtInfoHob;
+ UINTN tmp;
+
+ INITIALIZE_SCRIPT (ImageHandle, SystemTable);
+
+ TxtDxeCtx->ImageHandle = ImageHandle;
+ TxtDxeCtx->SystemTable = SystemTable;
+
+ ///
+ /// Find the TxtPolicyprotocol
+ ///
+ Status = gBS->LocateProtocol (
+ &gDxeCpuPlatformPolicyProtocolGuid,
+ NULL,
+ (VOID **) &(TxtDxeCtx->CpuPlatformPolicy)
+ );
+
+ if (EFI_ERROR (Status)) {
+ TxtDxeCtx->CpuPlatformPolicy = NULL;
+ }
+ ///
+ /// Find the CpuIo protocol
+ ///
+ Status = gBS->LocateProtocol (
+ &gEfiCpuIoProtocolGuid,
+ NULL,
+ (VOID **) &(TxtDxeCtx->CpuIo)
+ );
+
+ ASSERT_EFI_ERROR (Status);
+ ///
+ /// Find the MpService Protocol
+ ///
+ Status = gBS->LocateProtocol (
+ &gEfiMpServiceProtocolGuid,
+ NULL,
+ (VOID **) &(TxtDxeCtx->MpService)
+ );
+
+ ASSERT_EFI_ERROR (Status);
+ ///
+ /// Initialize CpuCount info. Current implemetation of
+ /// GetGeneralMPInfo doesn't honor optionality of arguments. Don't use
+ /// NULL pointers.
+ ///
+ Status = TxtDxeCtx->MpService->GetGeneralMPInfo (
+ TxtDxeCtx->MpService,
+ &(TxtDxeCtx->CpuCount),
+ &tmp,
+ &tmp,
+ &tmp,
+ &tmp
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Find TxtInfoHob
+ ///
+ HobList = GetFirstGuidHob (&gTxtInfoHobGuid);
+ if (HobList == NULL) {
+ return EFI_UNLOAD_IMAGE;
+ }
+
+ TxtInfoHob = (TXT_INFO_HOB *) HobList;
+ TxtDxeCtx->TxtInfoData = &(TxtInfoHob->Data);
+
+ ///
+ /// Print out the TxtInfo HOB
+ ///
+ DEBUG ((EFI_D_INFO, "TXTDXE: TxtInfoHob passed from platform as:\n"));
+ DEBUG ((EFI_D_INFO, "TXTDXE: ChipsetIsTxtCapable = %x\n", TxtDxeCtx->TxtInfoData->ChipsetIsTxtCapable));
+ DEBUG ((EFI_D_INFO, "TXTDXE: TxtMode = %x\n", TxtDxeCtx->TxtInfoData->TxtMode));
+ DEBUG ((EFI_D_INFO, "TXTDXE: PmBase = %x\n", TxtDxeCtx->TxtInfoData->PmBase));
+ DEBUG ((EFI_D_INFO, "TXTDXE: SinitMemorySize = %x\n", TxtDxeCtx->TxtInfoData->SinitMemorySize));
+ DEBUG ((EFI_D_INFO, "TXTDXE: TxtHeapMemorySize = %x\n", TxtDxeCtx->TxtInfoData->TxtHeapMemorySize));
+ DEBUG ((EFI_D_INFO, "TXTDXE: TxtDprMemoryBase = %x\n", TxtDxeCtx->TxtInfoData->TxtDprMemoryBase));
+ DEBUG ((EFI_D_INFO, "TXTDXE: TxtDprMemorySize = %x\n", TxtDxeCtx->TxtInfoData->TxtDprMemorySize));
+ DEBUG ((EFI_D_INFO, "TXTDXE: BiosAcmBase = %x\n", TxtDxeCtx->TxtInfoData->BiosAcmBase));
+ DEBUG ((EFI_D_INFO, "TXTDXE: BiosAcmSize = %x\n", TxtDxeCtx->TxtInfoData->BiosAcmSize));
+ DEBUG ((EFI_D_INFO, "TXTDXE: McuUpdateDataAddr = %x\n", TxtDxeCtx->TxtInfoData->McuUpdateDataAddr));
+ DEBUG ((EFI_D_INFO, "TXTDXE: SinitAcmBase = %x\n", TxtDxeCtx->TxtInfoData->SinitAcmBase));
+ DEBUG ((EFI_D_INFO, "TXTDXE: SinitAcmSize = %x\n", TxtDxeCtx->TxtInfoData->SinitAcmSize));
+ DEBUG ((EFI_D_INFO, "TXTDXE: TgaSize = %x\n", TxtDxeCtx->TxtInfoData->TgaSize));
+ DEBUG ((EFI_D_INFO, "TXTDXE: TxtLcpPdBase = %x\n", TxtDxeCtx->TxtInfoData->TxtLcpPdBase));
+ DEBUG ((EFI_D_INFO, "TXTDXE: TxtLcpPdSize = %x\n", TxtDxeCtx->TxtInfoData->TxtLcpPdSize));
+ DEBUG ((EFI_D_INFO, "TXTDXE: Flags = %x\n", TxtDxeCtx->TxtInfoData->Flags));
+ return EFI_SUCCESS;
+}
+
+/**
+ Determines whether or not the platform has executed an TXT launch by
+ examining the TPM Establishment bit.
+
+ @param[in] TxtDxeCtx - A pointer to an initialized TXT DXE Context data structure
+
+ @retval TRUE - If the TPM establishment bit is asserted.
+ @retval FALSE - If the TPM establishment bit is unasserted.
+**/
+BOOLEAN
+IsTxtEstablished (
+ IN TXT_DXE_LIB_CONTEXT *TxtDxeCtx
+ )
+{
+ EFI_STATUS Status;
+ UINT8 AccessReg;
+ UINT16 TimeOutCount;
+
+ ///
+ /// TO-DO: We might locate TCG protocol to access TPM status
+ ///
+ ///
+ /// Set TPM.ACCESS polling timeout about 750ms
+ ///
+ TimeOutCount = TPM_TIME_OUT;
+ do {
+ ///
+ /// Read TPM status register
+ ///
+ Status = TxtDxeCtx->CpuIo->Mem.Read (
+ TxtDxeCtx->CpuIo,
+ EfiCpuIoWidthUint8,
+ (UINT64) TPM_STATUS_REG_ADDRESS,
+ 1,
+ &AccessReg
+ );
+ ASSERT_EFI_ERROR (Status);
+ ///
+ /// if TPM.Access == 0xFF, TPM is not present
+ ///
+ if (AccessReg == 0xFF) {
+ return FALSE;
+ }
+ ///
+ /// Check tpmRegValidSts bit before checking establishment bit
+ ///
+ if ((AccessReg & 0x80) != 0x80) {
+ ///
+ /// Delay 1ms and read again
+ ///
+ gBS->Stall (1000);
+ } else {
+ ///
+ /// tpmRegValidSts set, we can check establishment bit now.
+ ///
+ break;
+ }
+
+ TimeOutCount--;
+ } while (TimeOutCount != 0);
+
+ ///
+ /// if tpmRegValidSts is not set, TPM is not usable
+ ///
+ if ((AccessReg & 0x80) != 0x80) {
+ DEBUG ((EFI_D_ERROR, "TXTDXE: TPM Valid Status is not set!! TPM.ACCESS=%x\n", AccessReg));
+ ASSERT (TRUE);
+ EFI_DEADLOOP ();
+ }
+ ///
+ /// The bit we're interested in uses negative logic:
+ /// If bit 0 == 1 then return False
+ /// Else return True
+ ///
+ return (AccessReg & 0x1) ? FALSE : TRUE;
+}
+
+/**
+ Determines whether or not the platform has executed an TXT launch by
+ examining the TPM Establishment bit.
+
+ @param[in] TxtDxeCtx - A pointer to an initialized TXT DXE Context data structure
+
+ @retval TRUE - If the TPM establishment bit is asserted.
+ @retval FALSE - If the TPM establishment bit is unasserted.
+**/
+BOOLEAN
+IsTxtResetSet (
+ IN TXT_DXE_LIB_CONTEXT *TxtDxeCtx
+ )
+{
+ EFI_STATUS Status;
+ UINT8 EstsReg;
+
+ ///
+ /// TO-DO: We might locate TCG protocol to access TPM status
+ ///
+ ///
+ /// Read TPM status register
+ ///
+ Status = TxtDxeCtx->CpuIo->Mem.Read (
+ TxtDxeCtx->CpuIo,
+ EfiCpuIoWidthUint8,
+ (UINT64) TXT_PUBLIC_BASE + TXT_ERROR_STATUS_REG_OFF,
+ 1,
+ &EstsReg
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ return (EstsReg & 0x1) ? TRUE : FALSE;
+}
+
+/**
+ Determines whether or not the platform requires initialization for TXT use.
+
+ @param[in] TxtDxeCtx - A pointer to an initialized TXT DXE Context data structure
+
+ @retval TRUE - If the the platoform should be configured for TXT.
+ @retval FALSE - If TXT is not to be used.
+**/
+BOOLEAN
+IsTxtEnabled (
+ IN TXT_DXE_LIB_CONTEXT *TxtDxeCtx
+ )
+{
+
+ UINT64 Ia32FeatureControl;
+ TXT_INFO_DATA *TxtInfoData;
+
+ TxtInfoData = TxtDxeCtx->TxtInfoData;
+
+ ///
+ /// If TxtInfoHob reported TXT disabled, return FALSE to indicate TXT should be be used
+ ///
+ if (TxtInfoData->TxtMode == 0) {
+ return FALSE;
+ }
+
+ Ia32FeatureControl = AsmReadMsr64 (MSR_IA32_FEATURE_CONTROL);
+
+ return ((Ia32FeatureControl & TXT_OPT_IN_VMX_AND_SMX_MSR_VALUE) == TXT_OPT_IN_VMX_AND_SMX_MSR_VALUE) ? TRUE : FALSE;
+}
+
+/**
+ Determines whether or not the current processor is TXT Capable.
+
+ @retval TRUE - If the current processor supports TXT
+ @retval FALSE - If the current processor does not support TXT
+**/
+BOOLEAN
+IsTxtProcessor (
+ VOID
+ )
+{
+ EFI_CPUID_REGISTER CpuidRegs;
+
+ AsmCpuid (1, &CpuidRegs.RegEax, &CpuidRegs.RegEbx, &CpuidRegs.RegEcx, &CpuidRegs.RegEdx);
+
+ return (CpuidRegs.RegEcx & B_CPUID_VERSION_INFO_ECX_SME) ? TRUE : FALSE;
+}
+
+/**
+ Add extened elements to BiosOsData
+
+ @param[in] TxtDxeCtx - A pointer to an initialized TXT DXE Context data structure
+ @param[in] Type - The element's type
+ @param[in] Buffer - A pointer to buffer which need to append the element
+ @param[in] Size - return the size of the appened element.
+
+ @retval None
+**/
+VOID
+AppendElement (
+ IN TXT_DXE_LIB_CONTEXT *TxtDxeCtx,
+ IN UINT32 Type,
+ IN VOID *Buffer,
+ OUT UINT32 *Size
+ )
+{
+ VOID *Element;
+ UINT32 NumberOfAcm;
+ UINT64 *AcmBase;
+
+ NumberOfAcm = 1;
+ AcmBase = NULL;
+ Element = NULL;
+ *Size = 0;
+
+ switch (Type) {
+ case HEAP_EXTDATA_TYPE_BIOS_SPEC_VER:
+ ///
+ /// Fill BIOS spec ver element
+ ///
+ Element = AllocatePool (sizeof (HEAP_BIOS_SPEC_VER_ELEMENT));
+
+ if (Element != NULL) {
+ *Size = sizeof (HEAP_BIOS_SPEC_VER_ELEMENT);
+ ((HEAP_BIOS_SPEC_VER_ELEMENT *) Element)->Header.Type = HEAP_EXTDATA_TYPE_BIOS_SPEC_VER;
+ ((HEAP_BIOS_SPEC_VER_ELEMENT *) Element)->Header.Size = sizeof (HEAP_BIOS_SPEC_VER_ELEMENT);
+ ((HEAP_BIOS_SPEC_VER_ELEMENT *) Element)->SpecVerMajor = TXT_BIOS_SPEC_VER_MAJOR;
+ ((HEAP_BIOS_SPEC_VER_ELEMENT *) Element)->SpecVerMinor = TXT_BIOS_SPEC_VER_MINOR;
+ ((HEAP_BIOS_SPEC_VER_ELEMENT *) Element)->SpecVerRevision = TXT_BIOS_SPEC_VER_REVISION;
+ }
+ break;
+
+ case HEAP_EXTDATA_TYPE_BIOSACM:
+ ///
+ /// Fill BIOS ACM element
+ ///
+ Element = AllocatePool (sizeof (HEAP_BIOSACM_ELEMENT) + NumberOfAcm * sizeof (UINT64));
+
+ if (Element != NULL) {
+ *Size = sizeof (HEAP_BIOSACM_ELEMENT) + sizeof (UINT64) * NumberOfAcm;
+ ((HEAP_BIOSACM_ELEMENT *) Element)->Header.Type = HEAP_EXTDATA_TYPE_BIOSACM;
+ ((HEAP_BIOSACM_ELEMENT *) Element)->Header.Size = sizeof (HEAP_BIOSACM_ELEMENT) + NumberOfAcm * sizeof (UINT64);
+ ((HEAP_BIOSACM_ELEMENT *) Element)->NumAcms = NumberOfAcm;
+ AcmBase = (UINT64 *) ((UINTN) Element + sizeof (HEAP_BIOSACM_ELEMENT));
+ *AcmBase = TxtDxeCtx->TxtInfoData->BiosAcmBase;
+ }
+ break;
+
+ case HEAP_EXTDATA_TYPE_END:
+ ///
+ /// Fill end type element
+ ///
+ Element = AllocatePool (sizeof (HEAP_EXT_DATA_ELEMENT));
+
+ if (Element != NULL) {
+ *Size = sizeof (HEAP_EXT_DATA_ELEMENT);
+ ((HEAP_EXT_DATA_ELEMENT *) Element)->Type = HEAP_EXTDATA_TYPE_END;
+ ((HEAP_EXT_DATA_ELEMENT *) Element)->Size = sizeof (HEAP_EXT_DATA_ELEMENT);
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ if (Element != NULL) {
+ CopyMem (Buffer, Element, *Size);
+ FreePool (Element);
+ }
+}
+
+/**
+ Allocates 1 MB of 1MB-aligned memory for use as TXT Device Memory. Records
+ the location of TXT Device Memory in TXT Chipset registers and then adds
+ programming instructions for these registers into BootScript.
+
+ @param[in] TxtDxeCtx - A pointer to an initialized TXT DXE Context data structure
+
+ @retval EFI_SUCCESS - TXT Device memory has been successfully initialized.
+ @exception EFI_UNSUPPORTED - TXT Device memory not available.
+**/
+EFI_STATUS
+SetupTxtDeviceMemory (
+ IN TXT_DXE_LIB_CONTEXT *TxtDxeCtx
+ )
+{
+ EFI_PHYSICAL_ADDRESS TopAddr;
+ UINT64 *Ptr64;
+ UINT64 Value64;
+ UINT32 Value32;
+ UINT64 TxtHeapMemoryBase;
+ UINT64 TxtSinitMemoryBase;
+ BOOLEAN Locked;
+ BIOS_OS_DATA_REGION *BiosOsDataRegion;
+ TXT_INFO_DATA *TxtInfoData;
+ UINT8 *Ptr8;
+
+ TxtHeapMemoryBase = 0;
+ TxtSinitMemoryBase = 0;
+ Locked = FALSE;
+ Ptr8 = NULL;
+ Value32 = 0;
+
+ TxtInfoData = TxtDxeCtx->TxtInfoData;
+
+ if ((TxtInfoData == 0) ||
+ (TxtInfoData->TxtDprMemoryBase == 0) ||
+ (TxtInfoData->TxtDprMemorySize == 0) ||
+ (TxtInfoData->TxtHeapMemorySize == 0) ||
+ (TxtInfoData->SinitMemorySize == 0)
+ ) {
+ return EFI_UNSUPPORTED;
+ } else {
+ ///
+ /// Use address passed from PEI
+ ///
+ TopAddr = TxtInfoData->TxtDprMemoryBase + TxtInfoData->TxtDprMemorySize;
+
+ TxtHeapMemoryBase = (UINT64) (TopAddr - TxtInfoData->TxtHeapMemorySize);
+
+ TxtSinitMemoryBase = TxtHeapMemoryBase - TxtInfoData->SinitMemorySize;
+ }
+ ///
+ /// Program TXT Device Memory Chipset Registers and record them in
+ /// BootScript so they will be saved and restored on S3
+ ///
+ ASSERT ((TopAddr & 0x0FFFFF) == 0);
+
+ ///
+ /// DPR registers
+ ///
+ Ptr64 = (UINT64 *) (UINTN) (TXT_PUBLIC_BASE + TXT_DPR_SIZE_REG_OFF);
+ Value64 = RShiftU64 (TxtInfoData->TxtDprMemorySize, 16) | 1;
+ *Ptr64 = Value64 | TopAddr;
+ ///
+ /// Assert error if programmed value is different from requested. This
+ /// means error is requested size.
+ ///
+ Value64 = *Ptr64;
+ ASSERT ((LShiftU64 ((Value64 & 0xFFE), 16)) == TxtInfoData->TxtDprMemorySize);
+
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINT64) (UINTN) (Ptr64),
+ 2,
+ &Value64
+ );
+
+ ///
+ /// HEAP Registers
+ /// Program size register first
+ ///
+ Ptr64 = (UINT64 *) (UINTN) (TXT_PUBLIC_BASE + TXT_HEAP_SIZE_REG_OFF);
+
+ ///
+ /// Test register locked status. If locked, skip programming since
+ /// this will be done by BIOS ACM
+ ///
+ *Ptr64 = TEST_PATTERN;
+ Value64 = *Ptr64;
+ if (Value64 != TEST_PATTERN) {
+ Locked = TRUE;
+ } else {
+ ///
+ /// To be safe invert pattern and try again
+ ///
+ *Ptr64 = (UINT64) ~TEST_PATTERN;
+ Value64 = *Ptr64;
+ if (Value64 != (UINT64) ~TEST_PATTERN) {
+ Locked = TRUE;
+ }
+ }
+
+ if (!Locked) {
+
+ *Ptr64 = TxtInfoData->TxtHeapMemorySize;
+ ///
+ /// Assert error if programmed value is different from requested. This
+ /// means error is requested size.
+ ///
+ Value64 = *Ptr64;
+ ASSERT (Value64 == TxtInfoData->TxtHeapMemorySize);
+
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINT64) (UINTN) (Ptr64),
+ 2,
+ &Value64
+ );
+
+ ///
+ /// Program base register.
+ ///
+ Ptr64 = (UINT64 *) (UINTN) (TXT_PUBLIC_BASE + TXT_HEAP_BASE_REG_OFF);
+ *Ptr64 = TxtHeapMemoryBase;
+
+ ///
+ /// Assert error if programmed value is different from requested. This
+ /// means error is requested size.
+ ///
+ Value64 = *Ptr64;
+ ASSERT (Value64 == TxtHeapMemoryBase);
+
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINT64) (UINTN) (Ptr64),
+ 2,
+ &Value64
+ );
+ }
+ ///
+ /// SINIT Registers
+ /// Program size register first
+ ///
+ Ptr64 = (UINT64 *) (UINTN) (TXT_PUBLIC_BASE + TXT_SINIT_SIZE_REG_OFF);
+ *Ptr64 = TxtInfoData->SinitMemorySize;
+ ///
+ /// Assert error if programmed value is different from requested. This
+ /// means error is requested size.
+ ///
+ Value64 = *Ptr64;
+ ASSERT (Value64 == TxtInfoData->SinitMemorySize);
+
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINT64) (UINTN) (Ptr64),
+ 2,
+ &Value64
+ );
+
+ ///
+ /// Program base register
+ ///
+ Ptr64 = (UINT64 *) (UINTN) (TXT_PUBLIC_BASE + TXT_SINIT_BASE_REG_OFF);
+ *Ptr64 = TxtSinitMemoryBase;
+ ///
+ /// Assert error if programmed value is different from requested. This
+ /// means error is requested size.
+ ///
+ Value64 = *Ptr64;
+ ASSERT (Value64 == TxtSinitMemoryBase);
+
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINT64) (UINTN) (Ptr64),
+ 2,
+ &Value64
+ );
+
+ ///
+ /// Make sure TXT Device Memory has been zeroed
+ ///
+ ZeroMem (
+ (VOID *) ((UINTN) TxtSinitMemoryBase),
+ (UINTN) (TopAddr - TxtSinitMemoryBase)
+ );
+
+ if (TxtInfoData->TgaSize) {
+ ;
+ ///
+ /// Placeholder for Trusted graphics support
+ ///
+ }
+
+ Ptr64 = (UINT64 *) TxtHeapMemoryBase;
+ *Ptr64 = sizeof (BIOS_OS_DATA_REGION);
+ ///
+ /// BiosOsDataSize plus sizew of data size feld itself
+ ///
+ BiosOsDataRegion = (BIOS_OS_DATA_REGION *) (Ptr64 + 1);
+ BiosOsDataRegion->Version = BIOS_OS_DATAREGION_VERSION;
+ BiosOsDataRegion->BiosSinitSize = 0;
+ BiosOsDataRegion->LcpPdBase = TxtInfoData->TxtLcpPdBase;
+ BiosOsDataRegion->LcpPdSize = TxtInfoData->TxtLcpPdSize;
+ BiosOsDataRegion->NumOfLogicalProcessors = (UINT32) (TxtDxeCtx->CpuCount);
+ BiosOsDataRegion->Flags = TxtInfoData->Flags;
+ Ptr8 = (UINT8 *) (UINTN) &(BiosOsDataRegion->ExtData);
+ AppendElement (TxtDxeCtx, HEAP_EXTDATA_TYPE_BIOS_SPEC_VER, Ptr8, &Value32);
+ Ptr8 += Value32;
+ AppendElement (TxtDxeCtx, HEAP_EXTDATA_TYPE_BIOSACM, Ptr8, &Value32);
+ Ptr8 += Value32;
+ AppendElement (TxtDxeCtx, HEAP_EXTDATA_TYPE_END, Ptr8, &Value32);
+ Value64 = (UINT64) Ptr8 - TxtHeapMemoryBase + Value32;
+ *Ptr64 = Value64;
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Adds and allocates architecturally defined TXT Configuration Space memory
+ region to GCD.
+
+ @param[in] TxtDxeCtx - A pointer to an initialized TXT DXE Context data structure
+
+ @retval EFI_SUCCESS - Always.
+**/
+EFI_STATUS
+ReserveTxtConfigSpace (
+ IN TXT_DXE_LIB_CONTEXT *TxtDxeCtx
+ )
+{
+ EFI_STATUS Status;
+ EFI_PHYSICAL_ADDRESS BaseAddr;
+
+ BaseAddr = TXT_PRIVATE_BASE;
+ Status = gDS->AddMemorySpace (
+ EfiGcdMemoryTypeReserved,
+ TXT_PRIVATE_BASE,
+ TXT_CONFIG_SPACE_LENGTH,
+ 0
+ );
+
+ ASSERT_EFI_ERROR (Status);
+
+ Status = gDS->AllocateMemorySpace (
+ EfiGcdAllocateAddress,
+ EfiGcdMemoryTypeReserved,
+ 12, ///< 4K Boundary
+ TXT_CONFIG_SPACE_LENGTH,
+ &BaseAddr,
+ TxtDxeCtx->ImageHandle,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Invokes TxtDxeLibLaunchBiosAcm to execute the SCHECK function.
+
+ @param[in] TxtDxeCtx - A pointer to an initialized TXT DXE Context data structure
+
+ @retval EFI_SUCCESS - Always.
+**/
+EFI_STATUS
+DoScheck (
+ IN TXT_DXE_LIB_CONTEXT *TxtDxeCtx
+ )
+{
+ return TxtDxeLibLaunchBiosAcm (TxtDxeCtx, TXT_LAUNCH_SCHECK);
+}
+
+/**
+ Invokes TxtDxeLibLaunchBiosAcm to reset the TPM's establishment bit.
+
+ @param[in] TxtDxeCtx - A pointer to an initialized TXT DXE Context data structure
+
+ @retval EFI_SUCCESS - Always.
+**/
+EFI_STATUS
+ResetTpmEstBit (
+ IN TXT_DXE_LIB_CONTEXT *TxtDxeCtx
+ )
+{
+ return TxtDxeLibLaunchBiosAcm (TxtDxeCtx, TXT_RESET_EST_BIT);
+}
+
+/**
+ Sets up the system and then launches the TXT BIOS ACM to run the function
+ requested by AcmFunction.
+
+ @param[in] AcmFunction - Constant that represents the function from the BIOS ACM
+ that should be executed.
+ @param[in] TxtDxeCtx - A pointer to an initialized TXT DXE Context data structure
+
+ @retval EFI_SUCCESS - BIOS ACM is set up.
+ @retval EFI_INVALID_PARAMETER - Wrong data in TxtInfoHob.
+ @retval EFI_NOT_FOUND - BIOS ACM is not found
+**/
+EFI_STATUS
+TxtDxeLibLaunchBiosAcm (
+ IN TXT_DXE_LIB_CONTEXT *TxtDxeCtx,
+ IN UINT64 AcmFunction
+ )
+{
+ EFI_STATUS Status;
+ EFI_TPL OldTpl;
+ UINTN CpuCount;
+ UINTN MyCpuNumber;
+ UINTN Index;
+ UINTN i;
+ EFI_MP_SERVICES_PROTOCOL *MpService;
+
+ UINTN NoHandles;
+ EFI_HANDLE *Buffer;
+ UINTN Size;
+ UINT32 FvStatus;
+ EFI_FV_FILETYPE FileType;
+ EFI_FIRMWARE_VOLUME_PROTOCOL *FwVol;
+ EFI_FV_FILE_ATTRIBUTES Attributes;
+ UINTN NumPages;
+ EFI_PHYSICAL_ADDRESS Addr;
+ EFI_PHYSICAL_ADDRESS AlignedAddr;
+
+ FwVol = NULL;
+ ///
+ /// Initialize local variables
+ ///
+ CpuCount = TxtDxeCtx->CpuCount;
+ MpService = TxtDxeCtx->MpService;
+ Size = 0;
+ FvStatus = 0;
+ NumPages = 0;
+ Addr = 0;
+
+ if (TxtDxeCtx->TxtInfoData == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+ ///
+ /// Get current running CPU number
+ ///
+ Status = MpService->WhoAmI (
+ MpService,
+ &MyCpuNumber
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ if ((TxtDxeCtx->TxtInfoData->BiosAcmBase == 0) || (TxtDxeCtx->TxtInfoData->BiosAcmSize == 0)) {
+ ///
+ /// If no information about placement of TXT BIOS ACM has been
+ /// passed from PEI - find it and load into memory dynamically.
+ ///
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiFirmwareVolumeProtocolGuid,
+ NULL,
+ &NoHandles,
+ &Buffer
+ );
+
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ for (i = 0; i < NoHandles; i++) {
+
+ Status = gBS->HandleProtocol (
+ Buffer[i],
+ &gEfiFirmwareVolumeProtocolGuid,
+ (VOID **) &FwVol
+ );
+
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// No output buffer - get size only
+ ///
+ Status = FwVol->ReadFile (
+ FwVol,
+ &mTxtBiosAcmPeiFileGuid,
+ NULL,
+ &Size,
+ &FileType,
+ &Attributes,
+ &FvStatus
+ );
+ if (Status == EFI_SUCCESS) {
+ break;
+ }
+ }
+
+ ASSERT (Size);
+ ///
+ /// Assert if file not found.
+ ///
+ FreePool (Buffer);
+
+ if (FwVol == NULL) {
+ return EFI_NOT_FOUND;
+ }
+ ///
+ /// Allocate 4K aligned memory to load BIOS ACM. For this allocate
+ /// 1 page more than BIOS ACM size.
+ ///
+ NumPages = (Size + EFI_PAGE_SIZE - 1) / EFI_PAGE_SIZE;
+
+ ///
+ /// Allocate buffer for BIOS ACM
+ ///
+ Status = (gBS->AllocatePages) (AllocateAnyPages, EfiRuntimeServicesData, NumPages, &Addr);
+
+ ASSERT_EFI_ERROR (Status);
+
+ AlignedAddr = Addr &~(EFI_PAGE_SIZE - 1);
+ AlignedAddr = AlignedAddr < Addr ? (AlignedAddr + EFI_PAGE_SIZE) : AlignedAddr;
+
+ ///
+ /// Read BIOS ACM into prepared buffer.
+ ///
+ Status = FwVol->ReadFile (
+ FwVol,
+ &mTxtBiosAcmPeiFileGuid,
+ ((VOID **) &AlignedAddr),
+ &Size,
+ &FileType,
+ &Attributes,
+ &FvStatus
+ );
+ } else {
+ ///
+ /// Use address passed from PEI
+ ///
+ AlignedAddr = TxtDxeCtx->TxtInfoData->BiosAcmBase;
+ }
+ ///
+ /// Save AP configuration. Run on one AP since all must be programmed
+ /// identically
+ ///
+ MpService->StartupThisAP (
+ MpService,
+ (EFI_AP_PROCEDURE) ApSaveConfig,
+ 1,
+ NULL,
+ 0,
+ NULL
+ );
+
+ ///
+ /// Initialize APs. Prepare data for DoApInit
+ ///
+ mAcmBase = AlignedAddr;
+ mMcuAddr = TxtDxeCtx->TxtInfoData->McuUpdateDataAddr;
+
+ DisableSmiSources (TxtDxeCtx, TRUE);
+
+#if defined(TXT_RLP_INIT) && (TXT_RLP_INIT == 1)
+ ///
+ /// Execute DoApInit on every AP
+ ///
+ MpService->StartupAllAPs (
+ MpService,
+ (EFI_AP_PROCEDURE) DoApInit,
+ TRUE,
+ NULL,
+ MP_TIMEOUT_FOR_STARTUP_ALL_APS,
+ NULL,
+ NULL
+ );
+#endif
+ ///
+ /// Disable every AP and put in WFS state
+ ///
+ for (Index = 0; Index < CpuCount; Index++) {
+ if (Index != MyCpuNumber) {
+ ///
+ /// Halt CPU otherwise it will not be re-enabled
+ ///
+ Status = MpService->EnableDisableAP (
+ MpService,
+ Index,
+ FALSE,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ Status = MpService->SendIPI (
+ MpService,
+ Index,
+ 0,
+ DELIVERY_MODE_INIT
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
+ }
+ ///
+ /// Launch the BIOS ACM to run the requested function
+ ///
+ OldTpl = gBS->RaiseTPL (EFI_TPL_HIGH_LEVEL);
+
+ LaunchBiosAcm (AlignedAddr, AcmFunction);
+
+ gBS->RestoreTPL (OldTpl);
+
+ ///
+ /// Free memory only if it was allocated
+ ///
+ if (Addr != 0) {
+ (gBS->FreePages)(Addr, NumPages);
+ }
+ ///
+ /// Restart APs
+ ///
+ for (Index = 0; Index < CpuCount; Index++) {
+ if (Index != MyCpuNumber) {
+ Status = MpService->EnableDisableAP (
+ MpService,
+ Index,
+ TRUE,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
+ }
+ ///
+ /// Restore AP configuration
+ ///
+ Status = MpService->StartupAllAPs (
+ MpService,
+ (EFI_AP_PROCEDURE) ApRestoreConfig,
+ TRUE,
+ NULL,
+ MP_TIMEOUT_FOR_STARTUP_ALL_APS,
+ NULL,
+ NULL
+ );
+
+ ASSERT_EFI_ERROR (Status);
+
+ DisableSmiSources (TxtDxeCtx, FALSE);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Disable or restore possible SMI sources before or after POST SCHECK
+
+ @param[in] TxtDxeCtx - A pointer to an initialized TXT DXE Context data structure
+ @param[in] Operation - Boolean value telling what operation is requested:
+ TRUE - to save and then disable possible SMI sources
+ FALSE - to restore original SMI settings
+
+ @retval EFI_SUCCESS - always return EFI_SUCCESS
+**/
+EFI_STATUS
+DisableSmiSources (
+ IN TXT_DXE_LIB_CONTEXT *TxtDxeCtx,
+ IN BOOLEAN Operation
+ )
+{
+ EFI_STATUS Status;
+ UINT64 GlobalSmiControlIoAddr;
+ UINT32 LocalApicBaseAddr;
+ static UINT64 SavedIa32ThermInterruptMSR;
+ static UINT32 SavedSmiControl;
+ static UINT32 SavedApicThermalValue;
+ BOOLEAN x2ApicEnabled;
+
+ x2ApicEnabled = (BOOLEAN) (((AsmReadMsr64 (MSR_IA32_APIC_BASE)) & (BIT11 + BIT10)) == BIT11 + BIT10);
+ GlobalSmiControlIoAddr = TxtDxeCtx->TxtInfoData->PmBase + 0x30;
+ LocalApicBaseAddr = ((UINT32) AsmReadMsr64 (MSR_IA32_APIC_BASE)) & BASE_ADDR_MASK;
+
+ if (Operation == TRUE) {
+ ///
+ /// Save IA32_THERMAL_INTERRUPT MSR and disable the interrupts
+ ///
+ SavedIa32ThermInterruptMSR = AsmReadMsr64 ((UINT32) IA32_THERM_INTERRUPT);
+ AsmWriteMsr64 (
+ (UINT32) IA32_THERM_INTERRUPT,
+ (UINT64) (SavedIa32ThermInterruptMSR &~(BIT0 + BIT1 + BIT2 + BIT4 + BIT15 + BIT23))
+ );
+ ///
+ /// Save THERMAL LVT in local APIC and mask THERMAL LVT
+ ///
+ if (x2ApicEnabled) {
+ SavedApicThermalValue = (UINT32) AsmReadMsr64 (MSR_EXT_XAPIC_LVT_THERM);
+ AsmWriteMsr64 (
+ MSR_EXT_XAPIC_LVT_THERM,
+ ((SavedApicThermalValue &~(B_INTERRUPT_MASK | B_DELIVERY_MODE | B_VECTOR)) | (B_INTERRUPT_MASK | V_MODE_SMI))
+ );
+ } else {
+ SavedApicThermalValue = *(UINT32 *) (UINTN) (LocalApicBaseAddr + LOCAL_APIC_THERMAL_DEF);
+ *(UINT32 *) (UINTN) (LocalApicBaseAddr + LOCAL_APIC_THERMAL_DEF) = (UINT32) ((SavedApicThermalValue &~(B_INTERRUPT_MASK | B_DELIVERY_MODE | B_VECTOR)) | (B_INTERRUPT_MASK | V_MODE_SMI));
+ }
+ ///
+ /// Save SMI control register and try to disable all SMIs indivitually.
+ ///
+ SavedSmiControl = IoRead32 ((UINTN) GlobalSmiControlIoAddr);
+ ///
+ /// We can not disable Global SMI since it should be locked after SCHECK. we can only disable SMI sources indivitually.
+ /// Call to TxtDxeOemDisableSmi() for platform specific SMIs.
+ ///
+ Status = TxtDxeOemDisableSmi (TxtDxeCtx, TRUE);
+ ASSERT_EFI_ERROR (Status);
+
+ IoWrite32 (
+ (UINTN) GlobalSmiControlIoAddr,
+ (UINT32) (SavedSmiControl & 0x01)
+ );
+ } else {
+ ///
+ /// We can not disable Global SMI since it should be locked after SCHECK. we can only disable SMI sources indivitually.
+ /// Restore original SMI setting after SCHECK
+ /// Call to TxtDxeOemDisableSmi() for platform specific SMIs.
+ ///
+ Status = TxtDxeOemDisableSmi (TxtDxeCtx, FALSE);
+ ASSERT_EFI_ERROR (Status);
+
+ IoWrite32 (
+ (UINTN) GlobalSmiControlIoAddr,
+ (UINT32) (SavedSmiControl)
+ );
+ ///
+ /// Restore IA32_THERMAL_INTERRUPT MSR
+ ///
+ AsmWriteMsr64 (
+ (UINT32) IA32_THERM_INTERRUPT,
+ (UINT64) SavedIa32ThermInterruptMSR
+ );
+ if (x2ApicEnabled) {
+ AsmWriteMsr64 (MSR_EXT_XAPIC_LVT_THERM, SavedApicThermalValue);
+ } else {
+ *(UINT32 *) (UINTN) (LocalApicBaseAddr + LOCAL_APIC_THERMAL_DEF) = (UINT32) SavedApicThermalValue;
+
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Read policy protocol to reset AUX content
+
+ @param[in] TxtDxeCtx - A pointer to an initialized TXT DXE Context data structure
+
+ @retval EFI_SUCCESS - No error happend
+ @retval EFI_NOT_FOUND - TxtPolicyProtocol is not found
+**/
+EFI_STATUS
+ResetTpmAux (
+ IN TXT_DXE_LIB_CONTEXT *TxtDxeCtx
+ )
+{
+ EFI_STATUS Status;
+
+ Status = EFI_SUCCESS;
+
+ ///
+ /// Check if TxtPolicy protocol installed
+ ///
+ if (TxtDxeCtx->CpuPlatformPolicy == NULL) {
+ return EFI_NOT_FOUND;
+ }
+ ///
+ ///
+ ///
+ if (TxtDxeCtx->CpuPlatformPolicy->SecurityConfig->TxtFunctionConfig->ResetAux == 1) {
+ DEBUG ((EFI_D_INFO, "TXTDXE: Reset AUX content\n"));
+ Status = TxtDxeLibLaunchBiosAcm (TxtDxeCtx, TXT_RESET_AUX);
+ }
+
+ return Status;
+}
diff --git a/ReferenceCode/Haswell/Txt/TxtInit/Dxe/TxtDxeLib.h b/ReferenceCode/Haswell/Txt/TxtInit/Dxe/TxtDxeLib.h
new file mode 100644
index 0000000..573a06a
--- /dev/null
+++ b/ReferenceCode/Haswell/Txt/TxtInit/Dxe/TxtDxeLib.h
@@ -0,0 +1,289 @@
+/** @file
+ This file contains function definitions that can determine
+ the TXT capabilities of a platform during DXE and perform
+ certain specific platform tasks that are required for TXT
+ during DXE.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#ifndef _TXT_DXE_LIB_H_
+#define _TXT_DXE_LIB_H_
+
+#include EFI_PROTOCOL_DEFINITION (MpService)
+#include "CpuAccess.h"
+
+#include EFI_PROTOCOL_DEFINITION (BootScriptSave)
+#include EFI_PROTOCOL_DEFINITION (CpuIo)
+#include EFI_GUID_DEFINITION (TxtInfoHob)
+#include EFI_PROTOCOL_DEFINITION (CpuPlatformPolicy)
+
+///
+/// The following switch is used in EfiScriptLib.h file. If enabled -
+/// forces linking to EfiScriptLib library
+///
+#define BASE_ADDR_MASK 0xFFFFF000
+#define TEST_PATTERN 0x5A5A5A5A5A5A5A5A
+#define MP_TIMEOUT_FOR_STARTUP_ALL_APS 0 ///< Set 0 for BSP always wait for APs
+
+///
+/// Chispet register
+///
+#define TXT_OPT_IN_VMX_AND_SMX_MSR_VALUE 0xFF03
+
+#define IA32_MTRR_PHYSBASE0 0x200
+#define IA32_MTRR_PHYSMASK9 0x213
+
+#define LOCAL_APIC_THERMAL_DEF 0x330
+ #define B_INTERRUPT_MASK (1 << 16)
+ #define B_DELIVERY_MODE (0x07 << 8)
+ #define V_MODE_SMI (0x02 << 8)
+ #define B_VECTOR (0xFF << 0)
+
+#pragma pack(push, 1)
+typedef struct _TXT_DXE_LIB_CONTEXT_ {
+ EFI_HANDLE ImageHandle;
+ EFI_SYSTEM_TABLE *SystemTable;
+ EFI_CPU_IO_PROTOCOL *CpuIo;
+ EFI_MP_SERVICES_PROTOCOL *MpService;
+
+ UINTN CpuCount;
+ TXT_INFO_DATA *TxtInfoData;
+ DXE_CPU_PLATFORM_POLICY_PROTOCOL *CpuPlatformPolicy;
+} TXT_DXE_LIB_CONTEXT;
+#pragma pack(pop)
+
+/**
+ This routine initializes and collects all Protocols and data required
+ by the routines in this file.
+
+ @param[in] ImageHandle - A pointer to the Image Handle for this file.
+ @param[in] SystemTable - A pointer to the EFI System Table
+ @param[in] TxtDxeCtx - A pointer to a caller allocated data structure that contains
+ all of the Protocols and data required by the routines
+ in this file.
+
+ @retval EFI_SUCCESS - Return EFI_SUCCESS if no error happen
+ @retval EFI_UNLOAD_IMAGE - If TxtInfoHob is not found
+**/
+EFI_STATUS
+InitializeTxtDxeLib (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable,
+ IN OUT TXT_DXE_LIB_CONTEXT *TxtDxeCtx
+ );
+/**
+ Determines whether or not the current processor is TXT Capable.
+
+ @retval TRUE - If the current processor supports TXT
+ @retval FALSE - If the current processor does not support TXT
+**/
+BOOLEAN
+IsTxtProcessor (
+ VOID
+ );
+/**
+ Determines whether or not the platform has executed an TXT launch by
+ examining the TPM Establishment bit.
+
+ @param[in] TxtDxeCtx - A pointer to an initialized TXT DXE Context data structure
+
+ @retval TRUE - If the TPM establishment bit is asserted.
+ @retval FALSE - If the TPM establishment bit is unasserted.
+**/
+BOOLEAN
+IsTxtEstablished (
+ IN TXT_DXE_LIB_CONTEXT *TxtDxeCtx
+ );
+
+/**
+ Determines whether or not the platform has executed an TXT launch by
+ examining the TPM Establishment bit.
+
+ @param[in] TxtDxeCtx - A pointer to an initialized TXT DXE Context data structure
+
+ @retval TRUE - If the TPM establishment bit is asserted.
+ @retval FALSE - If the TPM establishment bit is unasserted.
+**/
+BOOLEAN
+IsTxtResetSet (
+ IN TXT_DXE_LIB_CONTEXT *TxtDxeCtx
+ );
+/**
+ Determines whether or not the platform requires initialization for TXT use.
+
+ @param[in] TxtDxeCtx - A pointer to an initialized TXT DXE Context data structure
+
+ @retval TRUE - If the the platoform should be configured for TXT.
+ @retval FALSE - If TXT is not to be used.
+**/
+BOOLEAN
+IsTxtEnabled (
+ IN TXT_DXE_LIB_CONTEXT *TxtDxeCtx
+ );
+/**
+ Adds and allocates architecturally defined TXT Configuration Space memory
+ region to GCD.
+
+ @param[in] TxtDxeCtx - A pointer to an initialized TXT DXE Context data structure
+
+ @retval EFI_SUCCESS - Always.
+**/
+EFI_STATUS
+ReserveTxtConfigSpace (
+ IN TXT_DXE_LIB_CONTEXT *TxtDxeCtx
+ );
+/**
+ Allocates 1 MB of 1MB-aligned memory for use as TXT Device Memory. Records
+ the location of TXT Device Memory in TXT Chipset registers and then adds
+ programming instructions for these registers into BootScript.
+
+ @param[in] TxtDxeCtx - A pointer to an initialized TXT DXE Context data structure
+
+ @retval EFI_SUCCESS - TXT Device memory has been successfully initialized.
+ @retval EFI_ERROR - TXT Device memory not awailable.
+**/
+EFI_STATUS
+SetupTxtDeviceMemory (
+ IN TXT_DXE_LIB_CONTEXT *TxtDxeCtx
+ );
+/**
+ Invokes TxtDxeLibLaunchBiosAcm to execute the SCHECK function.
+
+ @param[in] TxtDxeCtx - A pointer to an initialized TXT DXE Context data structure
+
+ @retval EFI_SUCCESS - Always.
+**/
+EFI_STATUS
+DoScheck (
+ IN TXT_DXE_LIB_CONTEXT *TxtDxeCtx
+ );
+/**
+ Invokes TxtDxeLibLaunchBiosAcm to reset the TPM's establishment bit.
+
+ @param[in] TxtDxeCtx - A pointer to an initialized TXT DXE Context data structure
+
+ @retval EFI_SUCCESS - Always.
+**/
+EFI_STATUS
+ResetTpmEstBit (
+ IN TXT_DXE_LIB_CONTEXT *TxtDxeCtx
+ );
+/**
+ Sets up the system and then launches the TXT BIOS ACM to run the function
+ requested by AcmFunction.
+
+ @param[in] AcmBase - Base address of BIOS ACM location
+ @param[in] Funct - Function number of BIOS ACM to be executed
+
+ @retval EFI_SUCCESS - Always.
+**/
+VOID
+LaunchBiosAcm (
+ IN UINT64 AcmBase,
+ IN UINT64 Funct
+ );
+
+/**
+ Sets up the system and then launches the TXT BIOS ACM to run the function
+ requested by AcmFunction.
+
+ @param[in] AcmFunction - Constant that represents the function from the BIOS ACM
+ that should be executed.
+ @param[in] TxtDxeCtx - A pointer to an initialized TXT DXE Context data structure
+
+ @retval EFI_SUCCESS - Always.
+**/
+EFI_STATUS
+TxtDxeLibLaunchBiosAcm (
+ IN TXT_DXE_LIB_CONTEXT *TxtDxeCtx,
+ IN UINT64 AcmFunction
+ );
+/**
+ AP initial routine executed through MP service for TXT SCHECK
+**/
+VOID
+DoApInit (
+ VOID
+ );
+
+/**
+ Save AP configuration routine executed through MP service for TXT SCHECK
+**/
+VOID
+ApSaveConfig (
+ VOID
+ );
+
+/**
+ Restore AP configuration routine executed through MP service for TXT SCHECK
+**/
+VOID
+ApRestoreConfig (
+ VOID
+ );
+
+/**
+ Disable or restore possible SMI sources before or after POST SCHECK
+
+ @param[in] TxtDxeCtx - A pointer to an initialized TXT DXE Context data structure
+ @param[in] Operation - Boolean value telling what operation is requested:
+ TRUE - to save and then disable possible SMI sources
+ FALSE - to restore original SMI settings
+
+ @retval EFI_SUCCESS - always return EFI_SUCCESS
+**/
+EFI_STATUS
+DisableSmiSources (
+ IN TXT_DXE_LIB_CONTEXT *TxtDxeCtx,
+ IN BOOLEAN Operation
+ );
+
+/**
+ This function gets called before/after run the SCHECK function, intend to avoid platform specific SMIs to interfere in BIOS POST
+ if BIOS SMM MP services or synchonization code is not well considered that some of APs are not waken up from Wait-for-SIPI state.
+ Function should preserve original SMI enabling setting in augument is TRUE, and then restore it in augurment is FALSE.
+ The caller is DisableSmiSources() in TxtDxeLib.c
+
+ @param[in] Operation = TRUE - Calling before SCHECK to saved and disable platform specific SMIs setting
+ = FALSE - Calling after SCHECK to restore platform specific SMIs setting
+
+ @retval EFI_SUCCESS - Always.
+**/
+extern
+EFI_STATUS
+EFIAPI
+TxtDxeOemDisableSmi (
+ IN TXT_DXE_LIB_CONTEXT *TxtDxeCtx,
+ IN BOOLEAN Operation
+ );
+
+/**
+ Read policy protocol to reset AUX content
+
+ @param[in] TxtDxeCtx - A pointer to an initialized TXT DXE Context data structure
+
+ @retval EFI_SUCCESS - No error happend
+ @retval EFI_NOT_FOUND - TxtPolicyProtocol is not found
+**/
+EFI_STATUS
+ResetTpmAux (
+ IN TXT_DXE_LIB_CONTEXT *TxtDxeCtx
+ );
+
+#endif
diff --git a/ReferenceCode/Haswell/Txt/TxtInit/Dxe/TxtDxeOem.c b/ReferenceCode/Haswell/Txt/TxtInit/Dxe/TxtDxeOem.c
new file mode 100644
index 0000000..bed83ec
--- /dev/null
+++ b/ReferenceCode/Haswell/Txt/TxtInit/Dxe/TxtDxeOem.c
@@ -0,0 +1,78 @@
+/** @file
+ This file contain OEM/Platform implementation for TXT in DXE phase. It represents an abstract outline of the
+ steps required during DXE for enabling TXT. Each individual step is further
+ abstracted behind a function call interface. This is intended to minimize
+ the need to modify this file when porting TXT to future platforms.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+///
+/// External include files do NOT need to be explicitly specified in real EDKII
+/// environment
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "Txt.h"
+#include "TxtDxeLib.h"
+#endif
+
+/**
+ This function gets called before/after run the SCHECK function, intend to avoid platform specific SMIs to interfere in BIOS POST
+ if BIOS SMM MP services or synchonization code is not well considered that some of APs are not waken up from Wait-for-SIPI state.
+ Function should preserve original SMI enabling setting in augument is TRUE, and then restore it in augurment is FALSE.
+ The caller is DisableSmiSources() in TxtDxeLib.c
+
+ @param[in] TxtDxeCtx - Point to TXT_DXE_LIB_CONTEXT structure
+ @param[in] Operation = TRUE - Calling before SCHECK to saved and disable platform specific SMIs setting
+ = FALSE - Calling after SCHECK to restore platform specific SMIs setting
+
+ @retval EFI_SUCCESS - Always.
+
+ **/
+EFI_STATUS
+EFIAPI
+TxtDxeOemDisableSmi (
+ IN TXT_DXE_LIB_CONTEXT *TxtDxeCtx,
+ IN BOOLEAN Operation
+ )
+{
+ static UINT16 SavedSmiControlDev29;
+ static UINT16 SavedSmiControlDev26;
+
+ if (Operation == TRUE) {
+ ///
+ /// Save and disable OEM/Platform specific SMIs
+ ///
+ /// Disable EHCI SMIs before giving control to TXT ACM. EHCI controller generating SMI during TXT ACM results in USB kbd issue
+ ///
+ SavedSmiControlDev26 = MmioRead16 (MmPciAddress (0, 0, 0, 0x1A, 0x6C));
+ SavedSmiControlDev29 = MmioRead16 (MmPciAddress (0, 0, 0, 0x1D, 0x6C));
+
+ MmioWrite16 (MmPciAddress (0, 0, 0, 0x1A, 0x6C), 0);
+ MmioWrite16 (MmPciAddress (0, 0, 0, 0x1D, 0x6C), 0);
+ } else {
+ ///
+ /// Restore or re-enable OEM/Platform specific SMIs
+ ///
+ /// Enable EHCI SMIs before giving control to TXT ACM.
+ ///
+ MmioWrite16 (MmPciAddress (0, 0, 0, 0x1A, 0x6C), SavedSmiControlDev26);
+ MmioWrite16 (MmPciAddress (0, 0, 0, 0x1D, 0x6C), SavedSmiControlDev29);
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/Haswell/Txt/TxtInit/Dxe/x64/Mmx64.inc b/ReferenceCode/Haswell/Txt/TxtInit/Dxe/x64/Mmx64.inc
new file mode 100644
index 0000000..027e32e
--- /dev/null
+++ b/ReferenceCode/Haswell/Txt/TxtInit/Dxe/x64/Mmx64.inc
@@ -0,0 +1,494 @@
+;@file
+; This file contains macros supporting 64 bit assembly
+;
+;@copyright
+; Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+; This software and associated documentation (if any) is furnished
+; under a license and may only be used or copied in accordance
+; with the terms of the license. Except as permitted by such
+; license, no part of this software or documentation may be
+; reproduced, stored in a retrieval system, or transmitted in any
+; form or by any means without the express written consent of
+; Intel Corporation.
+;
+; This file contains an 'Intel Peripheral Driver' and uniquely
+; identified as "Intel Reference Module" and is
+; licensed for Intel CPUs and chipsets under the terms of your
+; license agreement with Intel or your vendor. This file may
+; be modified by the user, subject to additional terms of the
+; license agreement
+;
+
+
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+; Macro: _movq
+;
+; Input: rxx - general perpose 64 bit register
+; mmx - MMX register
+;
+; Output: None
+;
+; Registers:
+;
+; Description: Performs "movq rxx, mmx" and "movq mmx, rxx" operations
+;
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+
+_movq MACRO toReg:REQ, frReg:REQ
+ LOCAL gReg, mReg, op
+ db 48h ; ; REX.W prefix
+IFIDNI <toReg>, <rax>
+ gReg = 00h
+ op = 7Eh
+ELSEIFIDNI <toReg>, <rcx>
+ gReg = 01h
+ op = 7Eh
+ELSEIFIDNI <toReg>, <rdx>
+ gReg = 02h
+ op = 7Eh
+ELSEIFIDNI <toReg>, <rbx>
+ gReg = 03h
+ op = 7Eh
+ELSEIFIDNI <toReg>, <rsp>
+ gReg = 04h
+ op = 7Eh
+ELSEIFIDNI <toReg>, <rbp>
+ gReg = 05h
+ op = 7Eh
+ELSEIFIDNI <toReg>, <rsi>
+ gReg = 06h
+ op = 7Eh
+ELSEIFIDNI <toReg>, <rdi>
+ gReg = 07h
+ op = 7Eh
+ELSEIFIDNI <toReg>, <mm0>
+ mReg = 0C0h + 0 * 08h
+ op = 6Eh
+ELSEIFIDNI <toReg>, <mm1>
+ mReg = 0C0h + 1 * 08h
+ op = 6Eh
+ELSEIFIDNI <toReg>, <mm2>
+ mReg = 0C0h + 2 * 08h
+ op = 6Eh
+ELSEIFIDNI <toReg>, <mm3>
+ mReg = 0C0h + 3 * 08h
+ op = 6Eh
+ELSEIFIDNI <toReg>, <mm4>
+ mReg = 0C0h + 4 * 08h
+ op = 6Eh
+ELSEIFIDNI <toReg>, <mm5>
+ mReg = 0C0h + 5 * 08h
+ op = 6Eh
+ELSEIFIDNI <toReg>, <mm6>
+ mReg = 0C0h + 6 * 08h
+ op = 6Eh
+ELSEIFIDNI <toReg>, <mm7>
+ mReg = 0C0h + 7 * 08h
+ op = 6Eh
+ENDIF
+
+;; If op = 7E format movq rxx, mmx
+
+IFIDNI <frReg>, <rax>
+ gReg = 00h
+ IF op EQ 7Eh
+ .ERR
+ ENDIF
+ELSEIFIDNI <frReg>, <rcx>
+ gReg = 01h
+ IF op EQ 7Eh
+ .ERR
+ ENDIF
+ELSEIFIDNI <frReg>, <rdx>
+ gReg = 02h
+ IF op EQ 7Eh
+ .ERR
+ ENDIF
+ELSEIFIDNI <frReg>, <rbx>
+ gReg = 03h
+ IF op EQ 7Eh
+ .ERR
+ ENDIF
+ELSEIFIDNI <frReg>, <rsp>
+ gReg = 04h
+ IF op EQ 7Eh
+ .ERR
+ ENDIF
+ELSEIFIDNI <frReg>, <rbp>
+ gReg = 05h
+ IF op EQ 7Eh
+ .ERR
+ ENDIF
+ELSEIFIDNI <frReg>, <rsi>
+ gReg = 06h
+ IF op EQ 7Eh
+ .ERR
+ ENDIF
+ELSEIFIDNI <frReg>, <rdi>
+ gReg = 07h
+ IF op EQ 7Eh
+ .ERR
+ ENDIF
+ELSEIFIDNI <frReg>, <mm0>
+ mReg = 0C0h + 0 * 08h
+ IF op EQ 6Eh
+ .ERR
+ ENDIF
+ELSEIFIDNI <frReg>, <mm1>
+ mReg = 0C0h + 1 * 08h
+ IF op EQ 6Eh
+ .ERR
+ ENDIF
+ELSEIFIDNI <frReg>, <mm2>
+ mReg = 0C0h + 2 * 08h
+ IF op EQ 6Eh
+ .ERR
+ ENDIF
+ELSEIFIDNI <frReg>, <mm3>
+ mReg = 0C0h + 3 * 08h
+ IF op EQ 6Eh
+ .ERR
+ ENDIF
+ELSEIFIDNI <frReg>, <mm4>
+ mReg = 0C0h + 4 * 08h
+ IF op EQ 6Eh
+ .ERR
+ ENDIF
+ELSEIFIDNI <frReg>, <mm5>
+ mReg = 0C0h + 5 * 08h
+ IF op EQ 6Eh
+ .ERR
+ ENDIF
+ELSEIFIDNI <frReg>, <mm6>
+ mReg = 0C0h + 6 * 08h
+ IF op EQ 6Eh
+ .ERR
+ ENDIF
+ELSEIFIDNI <frReg>, <mm7>
+ mReg = 0C0h + 7 * 08h
+ IF op EQ 6Eh
+ .ERR
+ ENDIF
+ENDIF
+ db 0Fh, op, gReg + mReg
+ENDM
+
+
+
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+; Macro: _movd
+;
+; Input: exx - general perpose 32 bit register
+; mmx - MMX register
+;
+; Output: None
+;
+; Registers:
+;
+; Description: Performs "movd exx, mmx" and "movd mmx, exx" operations
+; coded to perform in compatibility or protected mode but
+; assembled by ml64
+;
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+
+
+_movd MACRO toReg:REQ, frReg:REQ
+ LOCAL gReg, mReg, op
+IFIDNI <toReg>, <eax>
+ gReg = 00h
+ op = 7Eh
+ELSEIFIDNI <toReg>, <ecx>
+ gReg = 01h
+ op = 7Eh
+ELSEIFIDNI <toReg>, <edx>
+ gReg = 02h
+ op = 7Eh
+ELSEIFIDNI <toReg>, <ebx>
+ gReg = 03h
+ op = 7Eh
+ELSEIFIDNI <toReg>, <esp>
+ gReg = 04h
+ op = 7Eh
+ELSEIFIDNI <toReg>, <ebp>
+ gReg = 05h
+ op = 7Eh
+ELSEIFIDNI <toReg>, <esi>
+ gReg = 06h
+ op = 7Eh
+ELSEIFIDNI <toReg>, <edi>
+ gReg = 07h
+ op = 7Eh
+ELSEIFIDNI <toReg>, <mm0>
+ mReg = 0C0h + 0 * 08h
+ op = 6Eh
+ELSEIFIDNI <toReg>, <mm1>
+ mReg = 0C0h + 1 * 08h
+ op = 6Eh
+ELSEIFIDNI <toReg>, <mm2>
+ mReg = 0C0h + 2 * 08h
+ op = 6Eh
+ELSEIFIDNI <toReg>, <mm3>
+ mReg = 0C0h + 3 * 08h
+ op = 6Eh
+ELSEIFIDNI <toReg>, <mm4>
+ mReg = 0C0h + 4 * 08h
+ op = 6Eh
+ELSEIFIDNI <toReg>, <mm5>
+ mReg = 0C0h + 5 * 08h
+ op = 6Eh
+ELSEIFIDNI <toReg>, <mm6>
+ mReg = 0C0h + 6 * 08h
+ op = 6Eh
+ELSEIFIDNI <toReg>, <mm7>
+ mReg = 0C0h + 7 * 08h
+ op = 6Eh
+ENDIF
+
+;; If op = 7E format movq exx, mmx
+
+IFIDNI <frReg>, <eax>
+ gReg = 00h
+ IF op EQ 7Eh
+ .ERR
+ ENDIF
+ELSEIFIDNI <frReg>, <ecx>
+ gReg = 01h
+ IF op EQ 7Eh
+ .ERR
+ ENDIF
+ELSEIFIDNI <frReg>, <edx>
+ gReg = 02h
+ IF op EQ 7Eh
+ .ERR
+ ENDIF
+ELSEIFIDNI <frReg>, <ebx>
+ gReg = 03h
+ IF op EQ 7Eh
+ .ERR
+ ENDIF
+ELSEIFIDNI <frReg>, <esp>
+ gReg = 04h
+ IF op EQ 7Eh
+ .ERR
+ ENDIF
+ELSEIFIDNI <frReg>, <ebp>
+ gReg = 05h
+ IF op EQ 7Eh
+ .ERR
+ ENDIF
+ELSEIFIDNI <frReg>, <esi>
+ gReg = 06h
+ IF op EQ 7Eh
+ .ERR
+ ENDIF
+ELSEIFIDNI <frReg>, <edi>
+ gReg = 07h
+ IF op EQ 7Eh
+ .ERR
+ ENDIF
+ELSEIFIDNI <frReg>, <mm0>
+ mReg = 0C0h + 0 * 08h
+ IF op EQ 6Eh
+ .ERR
+ ENDIF
+ELSEIFIDNI <frReg>, <mm1>
+ mReg = 0C0h + 1 * 08h
+ IF op EQ 6Eh
+ .ERR
+ ENDIF
+ELSEIFIDNI <frReg>, <mm2>
+ mReg = 0C0h + 2 * 08h
+ IF op EQ 6Eh
+ .ERR
+ ENDIF
+ELSEIFIDNI <frReg>, <mm3>
+ mReg = 0C0h + 3 * 08h
+ IF op EQ 6Eh
+ .ERR
+ ENDIF
+ELSEIFIDNI <frReg>, <mm4>
+ mReg = 0C0h + 4 * 08h
+ IF op EQ 6Eh
+ .ERR
+ ENDIF
+ELSEIFIDNI <frReg>, <mm5>
+ mReg = 0C0h + 5 * 08h
+ IF op EQ 6Eh
+ .ERR
+ ENDIF
+ELSEIFIDNI <frReg>, <mm6>
+ mReg = 0C0h + 6 * 08h
+ IF op EQ 6Eh
+ .ERR
+ ENDIF
+ELSEIFIDNI <frReg>, <mm7>
+ mReg = 0C0h + 7 * 08h
+ IF op EQ 6Eh
+ .ERR
+ ENDIF
+ENDIF
+ db 0Fh, op, gReg + mReg
+ENDM
+
+;-----------------------------------------------------------------------------
+; 64 bit macros
+;
+
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+; Macro: PUSHA_64
+;
+; Input: None
+;
+; Output: None
+;
+; Registers:
+;
+; Description: Saves all registers on stack
+;
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+PUSHA_64 MACRO
+ push rsp
+ push rbp
+ push rax
+ push rbx
+ push rcx
+ push rdx
+ push rsi
+ push rdi
+ push r8
+ push r9
+ push r10
+ push r11
+ push r12
+ push r13
+ push r14
+ push r15
+ENDM
+
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+; Macro: POPA_64
+;
+; Input: None
+;
+; Output: None
+;
+; Registers:
+;
+; Description: Restores all registers from stack
+;
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+
+POPA_64 MACRO
+ pop r15
+ pop r14
+ pop r13
+ pop r12
+ pop r11
+ pop r10
+ pop r9
+ pop r8
+ pop rdi
+ pop rsi
+ pop rdx
+ pop rcx
+ pop rbx
+ pop rax
+ pop rbp
+ pop rsp
+ENDM
+
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+; Macro: START_FRAME
+;
+; Input: None
+;
+; Output: None
+;
+; Registers:
+;
+; Description: Starts frame declaration. Creates variable to hold total
+; size of all local vars.
+;
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+
+START_FRAME MACRO
+ SZ = 0
+ENDM
+
+
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+; Macro: MAKE_LOCAL
+;
+; Input: ARG - var definition in form Label[Count]:QuolifiedType
+;
+; Output: None
+;
+; Registers:
+;
+; Description: Defines local procedure variable. Adds size of created variable
+; to total size of locals.
+; size of all local vars.
+;
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+
+MAKE_LOCAL MACRO ARG:REQ
+ LOCAL brk, rbrk, clm, lbl, cnt, qtp
+ brk INSTR <ARG>, <[>
+ rbrk INSTR <ARG>, <]>
+ clm INSTR <ARG>, <:>
+ IF brk GT 0
+ lbl SUBSTR <ARG>, 1, brk-1
+ cnt SUBSTR <ARG>, brk+1, rbrk-brk-1
+ qtp SUBSTR <ARG>, clm+1
+ LOCAL lbl[cnt]:qtp
+ ELSE
+ lbl SUBSTR <ARG>, 1, clm-1
+ qtp SUBSTR <ARG>, clm+1
+ LOCAL lbl:qtp
+ ENDIF
+
+ SZ = SZ + sizeof lbl
+ENDM
+
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+; Macro: END_FRAME
+;
+; Input: None
+;
+; Output: None
+;
+; Registers:
+;
+; Description: Ends frame declaration. Creates stack sufficient to hold
+; all declared variables.
+;
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+
+END_FRAME MACRO
+ SZ = SZ + 10h ; Margin
+ enter SZ, 0 ; With spare room on stack
+ .allocstack SZ
+ .endprolog
+ENDM
+
+
+
+SAVED_GDT TEXTEQU <mm0>
+SAVED_SS TEXTEQU <mm1>
+SAVED_ESP TEXTEQU <mm2>
+SAVED_EBP TEXTEQU <mm3>
+ \ No newline at end of file
diff --git a/ReferenceCode/Haswell/Txt/TxtInit/Dxe/x64/TxtDxeAp.asm b/ReferenceCode/Haswell/Txt/TxtInit/Dxe/x64/TxtDxeAp.asm
new file mode 100644
index 0000000..f1c44b9
--- /dev/null
+++ b/ReferenceCode/Haswell/Txt/TxtInit/Dxe/x64/TxtDxeAp.asm
@@ -0,0 +1,364 @@
+;/*++
+; This file contains an 'Intel Peripheral Driver' and uniquely
+; identified as "Intel Reference Module" and is
+; licensed for Intel CPUs and chipsets under the terms of your
+; license agreement with Intel or your vendor. This file may
+; be modified by the user, subject to additional terms of the
+; license agreement
+;--*/
+;
+;/*++
+;
+; Copyright (c) 1999 - 2011 Intel Corporation. All rights reserved
+; This software and associated documentation (if any) is furnished
+; under a license and may only be used or copied in accordance
+; with the terms of the license. Except as permitted by such
+; license, no part of this software or documentation may be
+; reproduced, stored in a retrieval system, or transmitted in any
+; form or by any means without the express written consent of
+; Intel Corporation.
+;
+;
+; Module Name:
+;
+; TxtDxeAp.asm
+;
+; Abstract:
+;
+; This file contains DXE AP initialization code.
+;
+;--*/
+
+ .xlist
+ include txt.inc
+ include mmx64.inc
+ .list
+
+
+ _TEXT SEGMENT
+
+
+EXTERN mAcmBase:QWORD
+EXTERN mMcuAddr:QWORD
+EXTERN mApMtrrTab:QWORD
+EXTERN mApIdt:QWORD
+EXTERN mApCr4:QWORD
+EXTERN mApSavedIa32ThermInterruptMSR:QWORD
+EXTERN mApSavedApicThermalValue:DWORD
+
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+; Procedure: DoApInit
+;
+; Input: AcmBase - Base address of LT BIOS ACM
+; McuAddr - Address of MCU patch in flash
+;
+; Output: None
+;
+; Registers: All are preserved
+;
+; Description: Initiatialize AP before GETSEC as per TXT BWG
+;
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+
+DoApInit PROC FRAME
+
+ START_FRAME
+ MAKE_LOCAL ACM_SIZE_TO_CACHE:QWORD
+ MAKE_LOCAL ACM_BASE_TO_CACHE:QWORD
+ MAKE_LOCAL NEXT_MTRR_INDEX:QWORD
+ MAKE_LOCAL NEXT_MTRR_SIZE:QWORD
+ ; jmp $
+ END_FRAME
+
+ pushf
+ cli
+ PUSHA_64
+ ;
+ ; Check uCode was loaded or not
+ ;
+ mov rcx, MCU_REV_MSR
+ xor rax, rax
+ xor rdx, rdx
+ wrmsr
+ mov rax, 1
+ cpuid
+ mov rcx, MCU_REV_MSR
+ rdmsr
+ or rdx, rdx
+ jnz uCode_loaded
+
+ ;
+ ; Load uCode update
+ ;
+ mov rax, 1
+ cpuid
+
+ mov rax, mMcuAddr
+ lea rax, [rax + SIZEOF MCU] ; RAX -> MCU data (after header)
+ xor rdx, rdx
+ mov rcx, MCU_LOAD_MSR ; Trigger to load MCU
+
+ wrmsr ; Load MCU
+
+ mov rax, 1
+ cpuid
+uCode_loaded:
+;-----------------------------------------------------------------------------
+;
+; Section: Initial RLPs cache requirements
+;
+; Description: Ensure CR0.CD and CR0.NW are cleared
+;
+;-----------------------------------------------------------------------------
+ ;
+ ; Clear CR0.CD and CR0.NW
+ ;
+ mov rax, cr0
+ and rax, NOT (CR0_CD_MASK + CR0_NW_MASK)
+ mov cr0, rax
+
+;-----------------------------------------------------------------------------
+;
+; Section: Clean all MCi_STATUS MSR registers
+;
+; Description: MCA registers are cleaned
+;
+;-----------------------------------------------------------------------------
+
+ mov rcx, MCG_CAP
+ rdmsr
+ movzx rbx, al ; ebx = MCR bank count
+ xor rax, rax ; Write 0 into all MCi_STATUS registers
+ xor rdx, rdx
+ mov rcx, MC0_STATUS
+
+McaErrorCleanLoopStart:
+ wrmsr
+ dec rbx
+ jz @F
+ add rcx, 4 ; ecx = number of MSRs per bank
+ jmp McaErrorCleanLoopStart
+
+@@:
+
+ mov rcx,IA32_APIC_BASE
+ rdmsr
+ and rax,BIT11+BIT10
+ cmp rax,BIT11+BIT10
+ jne x2ApicDisabled
+ mov rcx,EFI_MSR_EXT_XAPIC_LVT_THERM
+ rdmsr
+ and eax, NOT (B_INTERRUPT_MASK + B_DELIVERY_MODE + B_VECTOR)
+ or eax, (B_INTERRUPT_MASK + V_MODE_SMI)
+ wrmsr
+ jmp @f
+x2ApicDisabled:
+ ; mask thermal LVT
+ mov rcx, IA32_APIC_BASE
+ rdmsr ; Get APIC Base
+ and rax, BASE_ADDR_MASK ; Just need the address
+ mov edx, [rax+LOCAL_APIC_THERMAL_DEF]
+ and edx, NOT (B_INTERRUPT_MASK + B_DELIVERY_MODE + B_VECTOR)
+ or edx, (B_INTERRUPT_MASK + V_MODE_SMI)
+ mov DWORD PTR [rax+LOCAL_APIC_THERMAL_DEF], edx ;disable DTS SMIs
+@@:
+ POPA_64
+ popf
+
+ leave
+ ret 0
+DoApInit ENDP
+
+
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+; Procedure: ApSaveConfig
+;
+; Input: None
+;
+; Output: None
+;
+; Registers: All are preserved
+;
+; Description: Saves AP configuration
+;
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+ApSaveConfig PROC FRAME
+ START_FRAME
+ END_FRAME
+
+ pushf
+ cli
+ PUSHA_64
+
+ mov rcx, IA32_MTRR_CAP
+ rdmsr
+ and rax, 0FFh
+ shl rax, 1
+ mov rcx, rax
+
+ lea rbx, mApMtrrTab
+
+SaveNextMtrr:
+ add rcx, IA32_MTRR_PHYSBASE0 - 1
+ rdmsr
+ mov QWORD PTR [rbx+0], rax
+ mov QWORD PTR [rbx+8], rdx
+ sub rcx, IA32_MTRR_PHYSBASE0 - 1
+ add rbx, 10h
+ loop SaveNextMtrr
+
+ mov rcx, IA32_MTRR_DEF_TYPE
+ rdmsr
+ mov QWORD PTR [rbx+0], rax
+ mov QWORD PTR [rbx+8], rdx
+
+ lea rbx, mApIdt
+ sidt [rbx]
+ lea rbx, mApCr4
+ mov rax, cr4
+ mov QWORD PTR [rbx], rax
+
+ mov rcx,IA32_APIC_BASE
+ rdmsr
+ and rax,BIT11+BIT10
+ cmp rax,BIT11+BIT10
+ jne x2ApicDisabled
+ mov rcx,EFI_MSR_EXT_XAPIC_LVT_THERM
+ rdmsr
+ lea rbx, mApSavedApicThermalValue
+ mov DWORD PTR [rbx], eax ; read and save thermal LVT
+ jmp @f
+x2ApicDisabled:
+
+ mov rcx, IA32_APIC_BASE
+ rdmsr ; Get APIC Base
+ and rax, BASE_ADDR_MASK ; Just need the address
+ lea rbx, mApSavedApicThermalValue
+ mov edx, DWORD PTR [rax+LOCAL_APIC_THERMAL_DEF]
+ mov DWORD PTR [rbx], edx ; read and save thermal LVT
+@@:
+ mov rcx, EFI_MSR_IA32_THERM_INTERRUPT
+ rdmsr ;
+ lea rbx, mApSavedIa32ThermInterruptMSR
+ mov QWORD PTR [rbx+0], rax
+ mov QWORD PTR [rbx+8], rdx
+ ;disable THERMAL INT
+ and rax, NOT (BIT0+BIT1+BIT2+BIT4+BIT15+BIT23)
+ wrmsr
+
+ wbinvd
+
+ POPA_64
+ popf
+
+ leave
+ ret 0
+ApSaveConfig ENDP
+
+
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+; Procedure: ApRestoreConfig
+;
+; Input: None
+;
+; Output: None
+;
+; Registers: All are preserved
+;
+; Description: Saves AP configuration
+;
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+ApRestoreConfig PROC FRAME
+ START_FRAME
+ END_FRAME
+
+ pushf
+ cli
+ PUSHA_64
+
+ ;
+ ; Disable cache
+ ;
+ mov rax, cr0 ; set CR0:CD and CR0:NE, clear CR0:NW
+ or rax, CR0_CD_MASK OR CR0_NE_MASK
+ and rax, NOT CR0_NW_MASK
+ mov cr0, rax
+ wbinvd
+
+ mov rcx, IA32_MTRR_CAP
+ rdmsr
+ and rax, 0FFh
+ shl rax, 1
+ mov rcx, rax
+
+ lea rbx, mApMtrrTab
+
+RestoreNextMtrr:
+ add rcx, IA32_MTRR_PHYSBASE0 - 1
+ mov rax, QWORD PTR [rbx+0]
+ mov rdx, QWORD PTR [rbx+8]
+ wrmsr
+ sub rcx, IA32_MTRR_PHYSBASE0 - 1
+ add rbx, 10h
+ loop RestoreNextMtrr
+
+ mov rax, QWORD PTR [rbx+0]
+ mov rdx, QWORD PTR [rbx+8]
+ mov rcx, IA32_MTRR_DEF_TYPE
+ wrmsr
+
+ lea rbx, mApIdt
+ lidt FWORD PTR [rbx]
+ lea rbx, mApCr4
+ mov rax, QWORD PTR [rbx]
+ mov cr4, rax
+
+ mov rcx, EFI_MSR_IA32_THERM_INTERRUPT
+ lea rbx, mApSavedIa32ThermInterruptMSR
+ mov rax, QWORD PTR [rbx+0]
+ mov rdx, QWORD PTR [rbx+8]
+ wrmsr
+
+ mov rcx,IA32_APIC_BASE
+ rdmsr
+ and rax,BIT11+BIT10
+ cmp rax,BIT11+BIT10
+ jne x2ApicDisabled
+ mov rcx,EFI_MSR_EXT_XAPIC_LVT_THERM
+ lea rbx, mApSavedApicThermalValue
+ mov eax,DWORD PTR [rbx] ;restore thermal LVT
+ xor rdx,rdx
+ wrmsr
+ jmp @f
+x2ApicDisabled:
+
+ mov rcx, IA32_APIC_BASE
+ rdmsr ; Get APIC Base
+ and rax, BASE_ADDR_MASK ; Just need the address
+ lea rbx, mApSavedApicThermalValue
+ mov edx, DWORD PTR [rbx]
+ mov DWORD PTR [rax+LOCAL_APIC_THERMAL_DEF], edx ; restore thermal LVT
+@@:
+ ;
+ ; Enable cache
+ ;
+ mov rax, cr0
+ and rax, NOT CR0_CD_MASK
+ mov cr0, rax
+
+ POPA_64
+ popf
+
+ leave
+ ret 0
+ApRestoreConfig ENDP
+
+_TEXT ENDS
+
+ END
diff --git a/ReferenceCode/Haswell/Txt/TxtInit/Dxe/x64/TxtDxeBsp.asm b/ReferenceCode/Haswell/Txt/TxtInit/Dxe/x64/TxtDxeBsp.asm
new file mode 100644
index 0000000..00f9c87
--- /dev/null
+++ b/ReferenceCode/Haswell/Txt/TxtInit/Dxe/x64/TxtDxeBsp.asm
@@ -0,0 +1,712 @@
+;/*++
+; This file contains an 'Intel Peripheral Driver' and uniquely
+; identified as "Intel Reference Module" and is
+; licensed for Intel CPUs and chipsets under the terms of your
+; license agreement with Intel or your vendor. This file may
+; be modified by the user, subject to additional terms of the
+; license agreement
+;--*/
+;
+;/*++
+;
+; Copyright (c) 1999 - 2011 Intel Corporation. All rights reserved
+; This software and associated documentation (if any) is furnished
+; under a license and may only be used or copied in accordance
+; with the terms of the license. Except as permitted by such
+; license, no part of this software or documentation may be
+; reproduced, stored in a retrieval system, or transmitted in any
+; form or by any means without the express written consent of
+; Intel Corporation.
+;
+;
+; Module Name:
+;
+; TxtDxeBsp.asm
+;
+; Abstract:
+;
+; This file contains code to launch BIOS ACM functions in DXE phase
+;
+;--*/
+ .xlist
+ include txt.inc
+ include mmx64.inc
+ .list
+
+
+ _TEXT SEGMENT
+
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+; Procedure: LaunchBiosAcm
+;
+; Input: AcmBase - Base address of LT BIOS ACM
+; Function - function number to execute
+;
+; Output: None
+;
+; Registers: None are preserved
+;
+; Description: Setup GETSEC environment (protected mode, mtrrs, etc) and
+; invoke GETSEC:ENTERACCS with requested BIOS ACM entry point.
+;
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+
+LaunchBiosAcm PROC FRAME
+
+ START_FRAME
+ MAKE_LOCAL AcmBase:QWORD
+ MAKE_LOCAL Funct:QWORD
+ MAKE_LOCAL BIOS_GDT[2]:QWORD
+ MAKE_LOCAL CompModeSel:QWORD
+ MAKE_LOCAL CompModeOff:QWORD
+ MAKE_LOCAL LongModeSel:QWORD
+ MAKE_LOCAL LongModeOff:QWORD
+ MAKE_LOCAL SavedCR3:QWORD
+ MAKE_LOCAL SavedCR4:QWORD
+ MAKE_LOCAL SavedDS:QWORD
+ MAKE_LOCAL SavedES:QWORD
+ MAKE_LOCAL SavedGS:QWORD
+ MAKE_LOCAL SavedFS:QWORD
+ MAKE_LOCAL SavedMiscEnablesRax:QWORD
+ MAKE_LOCAL SavedMiscEnablesRdx:QWORD
+ MAKE_LOCAL MtrrTab[2*(IA32_MTRR_PHYSMASK9 - IA32_MTRR_PHYSBASE0 + 1)]:QWORD
+ MAKE_LOCAL ACM_SIZE_TO_CACHE:QWORD
+ MAKE_LOCAL ACM_BASE_TO_CACHE:QWORD
+ MAKE_LOCAL NEXT_MTRR_INDEX:QWORD
+ MAKE_LOCAL NEXT_MTRR_SIZE:QWORD
+ MAKE_LOCAL MTRR_COUNT:QWORD
+ MAKE_LOCAL MtrrTypeRax:QWORD
+ MAKE_LOCAL MtrrTypeRdx:QWORD
+ END_FRAME
+
+ ;
+ ; Save input parameters
+ ;
+ mov AcmBase, rcx
+
+ mov Funct, rdx
+
+ sgdt BIOS_GDT ; save gdtr
+
+ ;
+ ; Save the general purpose register state
+ ;
+ pushf
+ cli
+
+ PUSHA_64
+ ;
+ ; Tell where we are
+ ;
+ in ax, 80h
+ mov ah, BYTE PTR Funct
+ or ah, PORT80_CODE_PREFIX
+ out 80h, ax
+ ;
+ ; Save segment registers.
+ ;
+ mov ax, ds
+ mov SavedDS, rax
+ mov ax, es
+ mov SavedES, rax
+ mov ax, gs
+ mov SavedGS, rax
+ mov ax, fs
+ mov SavedFS, rax
+
+ ; Save cr4
+ ;
+ mov rax, cr4
+ mov SavedCR4, rax
+
+ ;
+ ; Save IA32_MISC_ENABLES MSR
+ ;
+ mov rcx, IA32_MISC_ENABLE_MSR
+ rdmsr
+ mov SavedMiscEnablesRax, rax
+ mov SavedMiscEnablesRdx, rdx
+
+;-----------------------------------------------------------------------------
+;
+; Section: Save variable MTRRs
+;
+; Description: All variable MTRRs are saved in local variables.
+; They will be restored after runnong of BIOS ACM
+;
+;-----------------------------------------------------------------------------
+ mov rcx, IA32_MTRR_CAP
+ rdmsr
+ and rax, 0FFh
+ shl rax, 1
+ mov MTRR_COUNT, rax
+ mov rcx, rax
+ lea rbx, MtrrTab
+
+SaveNextMtrr:
+ add rcx, IA32_MTRR_PHYSBASE0 - 1
+ rdmsr
+ mov [rbx+0], rax
+ mov [rbx+8], rdx
+ sub rcx, IA32_MTRR_PHYSBASE0 - 1
+ add rbx, 10h
+ loop SaveNextMtrr
+
+ ;
+ ; Save IA32_MTRR_DEF_TYPE MSR
+ ;
+ mov rcx, IA32_MTRR_DEF_TYPE
+ rdmsr
+ mov MtrrTypeRax, rax
+ mov MtrrTypeRdx, rdx
+
+;-----------------------------------------------------------------------------
+;
+; Section: Program MTRRs
+;
+; Description: Variable MTRRs are programmed to cache ACM as WB
+;
+;-----------------------------------------------------------------------------
+ ;
+ ; Enable SMXE, SSE and debug extensions
+ ;
+ mov rax, cr4
+ or rax, CR4_OSFXSR + CR4_DE + CR4_SMXE
+ mov cr4, rax
+
+ ;
+ ; Disable cache
+ ;
+ mov rax, cr0 ; set CR0:CD and CR0:NE, clear CR0:NW
+ or rax, CR0_CD_MASK OR CR0_NE_MASK
+ and rax, NOT CR0_NW_MASK
+ mov cr0, rax
+ wbinvd
+ ;
+ ; Disable MTRRs, set Default Type to UC
+ ;
+ mov rcx, IA32_MTRR_DEF_TYPE
+ xor rax, rax
+ xor rdx, rdx
+ wrmsr
+
+ ;
+ ; Clear all of the Variable MTRRs
+ ;
+ mov rcx, MTRR_COUNT
+
+ClearNextMttr:
+ add rcx, IA32_MTRR_PHYSBASE0 - 1
+ wrmsr
+ sub rcx, IA32_MTRR_PHYSBASE0 - 1
+ loop ClearNextMttr
+
+ ;
+ ; Determine size of AC module
+ ;
+ mov rsi, AcmBase
+ xor rax, rax
+ mov eax, DWORD PTR [rsi+ACM_HEADER.AcmSize]
+ shl rax, 2 ; ...in bytes (ACM header has size in dwords)
+ ;
+ ; Round up to page size
+ ;
+ add rax, 0FFFh ;
+ and rax, 0FFFFF000h ; Aligned to a page (4KB)
+
+ ;
+ ; Program MTRRs to cover BIOS ACM
+ ;
+ sub rcx, rcx
+ mov NEXT_MTRR_INDEX, rcx ; Start from MTRR0
+
+ ;
+ ; Save remaining size to cache
+ ;
+ mov ACM_SIZE_TO_CACHE, rax ; Size of ACM that must be cached
+ mov ACM_BASE_TO_CACHE, rsi ; Base ACM address
+
+nextMtrr:
+ ;
+ ; Get remaining size to cache
+ ;
+ mov rax, ACM_SIZE_TO_CACHE
+ and rax, rax
+ jz done ; If no left size - we are done
+ ;
+ ; Determine next size to cache.
+ ; We start from bottom up. Use the following algorythm:
+ ; 1. Get our own alignment. Max size we can cache equals to our alignment
+ ; 2. Determine what is bigger - alignment or remaining size to cache.
+ ; If aligment is bigger - cache it.
+ ; Adjust remaing size to cache and base address
+ ; Loop to 1.
+ ; If remaining size to cache is bigger
+ ; Determine the biggest 2^N part of it and cache it.
+ ; Adjust remaing size to cache and base address
+ ; Loop to 1.
+ ; 3. End when there is no left size to cache or no left MTRRs
+ ;
+ mov rsi, ACM_BASE_TO_CACHE
+ bsf rcx, rsi ; Get index of lowest bit set in base address
+ ;
+ ; Convert index into size to be cached by next MTRR
+ ;
+ mov rdx, 1h
+ shl rdx, cl ; Alignment is in rdx
+ cmp rdx, rax ; What is bigger, alignment or remaining size?
+ jbe gotSize ; JIf aligment is less
+ ;
+ ; Remaining size is bigger. Get the biggest part of it, 2^N in size
+ ;
+ bsr rcx, rax ; Get index of highest set bit
+ ;
+ ; Convert index into size to be cached by next MTRR
+ ;
+ mov rdx, 1
+ shl rdx, cl ; Size to cache
+
+gotSize:
+ mov rax, rdx
+ mov NEXT_MTRR_SIZE, rax ; Save
+
+ ;
+ ; Compute MTRR mask value: Mask = NOT (Size - 1)
+ ;
+ dec rax ; eax - size to cache less one byte
+ not rax ; eax contains low 32 bits of mask
+ or rax, MTRR_VALID ; Set valid bit
+ ;
+ ; Program mask register
+ ;
+ mov rcx, IA32_MTRR_PHYSMASK0 ; setup variable mtrr
+ mov rbx, NEXT_MTRR_INDEX
+ add rcx, rbx
+
+ mov rdx, 0Fh
+ wrmsr
+ ;
+ ; Program base register
+ ;
+ sub rdx, rdx
+ mov rcx, IA32_MTRR_PHYSBASE0 ; setup variable mtrr
+ add rcx, rbx ; ebx is still NEXT_MTRR_INDEX
+
+ mov rax, ACM_BASE_TO_CACHE
+ or rax, WB ; set type to write back
+ wrmsr
+ ;
+ ; Advance and loop
+ ; Reduce remaining size to cache
+ ;
+ mov rbx, ACM_SIZE_TO_CACHE
+ mov rax, NEXT_MTRR_SIZE
+ sub rbx, rax
+ mov ACM_SIZE_TO_CACHE, rbx
+
+ ;
+ ; Increment MTRR index
+ ;
+ mov rbx, NEXT_MTRR_INDEX
+ add rbx, 2
+ mov NEXT_MTRR_INDEX, rbx
+ ;
+ ; Increment base address to cache
+ ;
+ mov rbx, ACM_BASE_TO_CACHE
+ mov rax, NEXT_MTRR_SIZE
+ add rbx, rax
+ mov ACM_BASE_TO_CACHE, rbx
+
+ jmp nextMtrr
+
+done:
+ ;
+ ; Enable Variable MTRRs
+ ;
+ xor rdx, rdx
+ mov rax, MTRR_ENABLE
+ mov rcx, IA32_MTRR_DEF_TYPE
+ wrmsr
+ ;
+ ; Enable cache
+ ;
+ mov rax, cr0
+ and rax, NOT CR0_CD_MASK
+ mov cr0, rax
+
+ ;
+ ; Clean all MCi_STATUS MSR registers
+ ; SCLEAN will generate GPF otherwise
+ ;
+ mov rcx, MCG_CAP
+ rdmsr
+ movzx rbx, al ; ebx = MCR bank count
+ xor rax, rax ; Write 0 into all MCi_STATUS registers
+ xor rdx, rdx
+ mov rcx, MC0_STATUS
+
+McaErrorCleanLoopStart:
+ wrmsr
+ dec rbx
+ jz @F
+ add rcx, 4 ; ecx = number of MSRs per bank
+ jmp McaErrorCleanLoopStart
+
+@@:
+;-----------------------------------------------------------------------------
+;
+; Section: Find Compatible Segment Descriptor in GDT
+;
+; Description: GDT is scanned until code descriptor with L bit = 0 is found
+;
+;-----------------------------------------------------------------------------
+
+ lea rax, BIOS_GDT
+ add rax, 2 ; Point to base
+ mov rax, [rax] ; Get base of GDT
+ mov rbx, rax ; Save GDT base
+
+ mov cx, WORD PTR BIOS_GDT
+ movzx rcx, cx
+ inc rcx ; rcx - total size of GDT in bytes
+ add rcx, rax ; rcx - end of GDT
+
+loopStart:
+ cmp QWORD PTR [rax], 0 ; Reserved?
+ je ApplicationDescriptor
+ test BYTE PTR [rax].SEG_DESCRIPTOR.AR0_7, MASK D_T
+ jz nextDescriptor ; JIf system descriptor
+ ;
+ ; Application descriptor found
+ ;
+ test BYTE PTR [rax].SEG_DESCRIPTOR.AR0_7, 8 ; Bit 3 of sType - code segment if set
+ jz nextDescriptor ; JIf data descriptor
+ ;
+ ; Code descriptor is found
+ ;
+ test byte ptr [rax].SEG_DESCRIPTOR.LAR16_23, MASK L
+ jnz nextDescriptor
+ ;
+ ; Compatibility mode code descriptor is found
+ ;
+ sub rax, rbx ; rax is compatibility segment selector
+ jmp CompatibilityModeJump
+
+nextDescriptor:
+ cmp rax, rcx
+ jb @F
+ jmp $ ; Nothing found - impossible situation
+
+@@:
+ test BYTE PTR [rax].SEG_DESCRIPTOR.AR0_7, MASK D_T
+ jz @F
+
+ApplicationDescriptor:
+ ;
+ ; Application descriptor - 8 bytes
+ ;
+ add rax, 8
+ jmp loopStart
+
+@@:
+ add rax, 16
+ jmp loopStart
+
+;-----------------------------------------------------------------------------
+;
+; Section: Jump to compatibility mode
+;
+; Description: Found selector and known label offset
+; are used to transfer control to compatibility mode.
+;
+; NOTE!
+; Code programmed from this point on till the return to long mode
+; looks differently than code actually executed by CPU
+; This is because assembler is in x64 mode whereas CPU is not.
+; Whereever differences are present between written and executed code,
+; actual instructions are shown in comments.
+;
+; Example1: Programmed: mov rax, cr4
+; Executed: mov eax, cr4
+; Assembler fails to assemble "mov eax, cr4" since CR4 is
+; 64 bits wide in x64 mode. Generated opcodes are nevertheless
+; correct.
+;
+; Example2: Programmed: mov eax, DWORD PTR [rbx+0]
+; Executed: mov eax, DWORD PTR [ebx+0]
+; Default addressing in x64 mode is 64 bit. If ebx were coded
+; in this example, assembler would generate unneeded REX prefix.
+; By programming rbx this prefix is not generated and
+; opcode corresponds to ebx addressing in compatibility mode
+;
+;-----------------------------------------------------------------------------
+
+CompatibilityModeJump:
+ ;
+ ; Save Long mode and Compatibility mode selectors and offsets before transition
+ ;
+ mov CompModeSel, rax ; Save Compatibility Mode selector
+ mov rcx, OFFSET ProtectedMode2
+ mov CompModeOff, rcx
+ mov cx, cs
+ movzx rcx, cx
+ mov LongModeSel, rcx
+ mov rcx, OFFSET LongMode2
+ mov LongModeOff, rcx
+
+ shl rax, 32
+ mov rcx, OFFSET CompatibilityMode
+ or rax, rcx
+ push rax
+ retf
+
+CompatibilityMode:
+;-----------------------------------------------------------------------------
+;
+; Section: Jump to protected mode
+;
+; Description: Compatibility mode is disabled since BIOS ACM must run
+; in protected 32 bit mode.
+;
+;-----------------------------------------------------------------------------
+
+ ;
+ ; Disable paging
+ ;
+ mov rcx, cr0
+ and ecx, DWORD PTR (NOT BIT31)
+ mov cr0, rcx
+ ;
+ ; Clear EFER.LME
+ ;
+ mov ecx, IA32_EFER_MSR
+ rdmsr
+ and eax, NOT LME
+ wrmsr
+ jmp ProtectedMode
+
+ProtectedMode:
+
+;-----------------------------------------------------------------------------
+;
+; Section: Launch BIOS ACM
+;
+; Description: Prepare and execute GETSEC[ENTERACCS]
+;
+;-----------------------------------------------------------------------------
+
+ ;
+ ; Save return values in MMX registers
+ ;
+
+ mov ax, ss
+ movzx eax,ax
+% _movd SAVED_SS, eax
+% _movd SAVED_EBP, ebp
+% _movd SAVED_ESP, esp
+ lea eax, BIOS_GDT
+% _movd SAVED_GDT, eax
+ mov rax, cr3 ; mov eax, cr3 - in 32 bit mode
+ mov DWORD PTR SavedCR3, eax
+ ;
+ ; Call GETSEC[ENTERACCS]
+ ;
+ mov esi, DWORD PTR Funct ; esi = ACM function
+ mov eax, DWORD PTR AcmBase
+ mov ebx, eax ; ebx = AcmBase
+ mov ecx, DWORD PTR [rbx+ACM_HEADER.AcmSize] ; mov DWORD PTR [ebx+ACM_HEADER.AcmSize] - in 32 bit mode
+ ; ecx = size of ACM in dwords
+ shl ecx, 2 ; ecx = size of ACM in bytes
+ xor edx, edx
+ xor edi, edi
+ mov eax, ENTERACCS ; eax = ENTERACCS
+
+ _GETSEC
+
+;for debugging only
+; mov ax, 055AAh
+; out 80h, ax
+;; jmp $
+;-----------------------------------------------------------------------------
+;
+; Section: Restore protected mode environment
+;
+; Description: Since BIOS ACM changes GDT,
+; BIOS GDT, stack and and CS selector are restored.
+;
+;
+;-----------------------------------------------------------------------------
+
+ ;
+ ; Reload the GDTR. Upon return CPU is loaded with selector from ACM GDT
+ ; The following instruction works simply because whatever CS selector is
+ ; currently, it is flat selector.
+ ;
+% _movd eax, SAVED_GDT
+ lgdt FWORD ptr [rax] ; lgdt FWORD ptr [eax] - in 32 bit mode
+
+ ;
+ ; Restore the stack
+ ;
+% _movd eax, SAVED_EBP
+ mov ebp, eax ; restore ebp
+% _movd eax, SAVED_ESP
+ mov esp, eax ; restore esp
+% _movd eax, SAVED_SS
+ mov ss, ax ; restore ss
+
+ ;
+ ; Reload cs register
+ ;
+ mov eax, DWORD PTR CompModeSel
+ push rax ; push eax - in 32 bit mode
+
+ mov eax, DWORD PTR CompModeOff
+ push rax ; push eax - in 32 bit mode
+ retf ; will jump to Protected label below
+
+ProtectedMode2:
+
+;-----------------------------------------------------------------------------
+;
+; Section: Restore MTRRs
+;
+; Description: BIOS MTRR values are restored.
+;
+;-----------------------------------------------------------------------------
+ ;
+ ; Disable paging
+ ;
+ mov rax, cr0
+ and eax, DWORD PTR (NOT CR0_PG_MASK)
+ mov cr0, rax
+
+ mov rcx, MTRR_COUNT
+ lea ebx, MtrrTab
+
+RestoreNextMtrr:
+ add ecx, IA32_MTRR_PHYSBASE0 - 1
+ mov eax, DWORD PTR [rbx+0] ; mov eax, DWORD PTR [ebx+0] - in 32 bit mode
+ mov edx, DWORD PTR [rbx+8] ; mov eax, DWORD PTR [ebx+8] - in 32 bit mode
+ wrmsr
+ sub ecx, IA32_MTRR_PHYSBASE0 - 1
+ add ebx, 10h
+ loop RestoreNextMtrr
+
+ mov rcx, IA32_MTRR_DEF_TYPE
+ mov rdx, MtrrTypeRdx
+ mov rax, MtrrTypeRax
+ wrmsr
+;-----------------------------------------------------------------------------
+;
+; Section: Switch to compatibility mode
+;
+; Description: Compatibility mode i srestored by enabling of paging -
+; this is done by restoring CR4 contenxt, and setting of LME bit.
+;
+;-----------------------------------------------------------------------------
+
+ ;
+ ; Enable PAE in CR4
+ ;
+ mov eax, DWORD PTR SavedCR4
+ or eax, CR4_PAE
+ mov cr4, rax
+
+ ;
+ ; Reload CR3
+ ;
+ mov eax, DWORD PTR SavedCR3
+ mov cr3, rax
+
+ ;
+ ; Set EFER.LME to re-enable ia32-e
+ ;
+ mov ecx, IA32_EFER_MSR
+ rdmsr
+ or eax, LME
+ wrmsr
+ ;
+ ; Enable paging
+ ;
+ mov rax, cr0
+ or eax, CR0_PG_MASK
+ mov cr0, rax
+
+ jmp CompatibilityMode2
+
+CompatibilityMode2:
+ wbinvd ; Flush and invalidate the cache
+ ;
+ ; Now we're in Compatibility mode - restore segment registers.
+ ;
+ mov rax, SavedDS
+ mov ds, ax
+ mov rax, SavedES
+ mov es, ax
+ mov rax, SavedGS
+ mov gs, ax
+ mov rax, SavedFS
+ mov fs, ax
+ ;
+ ; Reastore IA32_MISC_ENABLES MSR
+ ;
+ mov rcx, IA32_MISC_ENABLE_MSR
+ mov rdx, SavedMiscEnablesRdx
+ mov rax, SavedMiscEnablesRax
+ wrmsr
+
+
+;-----------------------------------------------------------------------------
+;
+; Section: Switch to long mode
+;
+; Description: Previously saved selector and offset are used to return
+; CPU to long mode.
+;
+;-----------------------------------------------------------------------------
+ ;
+ ; Reload cs register
+ ;
+ mov eax, DWORD PTR LongModeSel
+ push rax ; push eax - in 32 bit mode
+
+ mov eax, DWORD PTR LongModeOff
+ push rax ; push eax - in 32 bit mode
+ retf
+
+LongMode2:
+;-----------------------------------------------------------------------------
+;
+; Section: Resore registers, stack and exit.
+;
+; Description: Previously saved registers are restored. Stack is restored
+; by execution leave instruction and control is returned to
+; caller.
+;
+; NOTE!
+; This section ends differences between programmed and
+; executed code.
+;
+;-----------------------------------------------------------------------------
+ ;
+ ; Now we're in Long Mode
+ ; Restore control registers
+ ;
+ mov rax, SavedCR4
+ mov cr4, rax
+
+ POPA_64
+ popf
+
+ leave
+ ret 0
+
+LaunchBiosAcm ENDP
+
+_TEXT ENDS
+
+ END
diff --git a/ReferenceCode/Haswell/Txt/TxtInit/Pei/Ia32/TxtPeiAp.asm16 b/ReferenceCode/Haswell/Txt/TxtInit/Pei/Ia32/TxtPeiAp.asm16
new file mode 100644
index 0000000..9855257
--- /dev/null
+++ b/ReferenceCode/Haswell/Txt/TxtInit/Pei/Ia32/TxtPeiAp.asm16
@@ -0,0 +1,305 @@
+;/*++
+; This file contains an 'Intel Peripheral Driver' and uniquely
+; identified as "Intel Reference Module" and is
+; licensed for Intel CPUs and chipsets under the terms of your
+; license agreement with Intel or your vendor. This file may
+; be modified by the user, subject to additional terms of the
+; license agreement
+;--*/
+;
+;/*++
+;
+; Copyright (c) 1999 - 2011 Intel Corporation. All rights reserved
+; This software and associated documentation (if any) is furnished
+; under a license and may only be used or copied in accordance
+; with the terms of the license. Except as permitted by such
+; license, no part of this software or documentation may be
+; reproduced, stored in a retrieval system, or transmitted in any
+; form or by any means without the express written consent of
+; Intel Corporation.
+;
+;
+; Module Name:
+;
+; TxtPeiAp.asm
+;
+; Abstract:
+;
+; This file contains AP initialization code in PEI phase
+;
+;--*/
+
+ .XLIST
+ include txt.inc
+ .LIST
+
+ .586p
+ .MMX
+
+TxtSegment16 SEGMENT PARA USE16 PUBLIC 'TXTCODE'
+
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+; Procedure:
+;
+; Input: None
+;
+; Output: None
+;
+; Registers: None are preserved
+;
+; Description: Entry point of AP startup code. Target of SIPI vector.
+;
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+;
+; This point is 4K aligned somewhere in boot block.
+;
+ jmp code16bitStart
+
+ ORG 10h
+
+GDTAddress:
+ dw GDTLen ; The length of the GDT
+ dd OFFSET GDTStart ; The 32-bit physical address
+
+;
+; AP GDT table
+;
+ ALIGN 16
+GDTStart LABEL BYTE
+
+ SEG_DESCRIPTOR <> ; Unused (selector 0)
+
+;
+; Selector 8
+;
+TXT_DATA32 EQU $ - GDTStart
+
+TXT_DATA32_OFF SEG_DESCRIPTOR {0FFFFh,\
+ 0000h, \
+ 00h, \
+ <SEG_PRESENT, 0, APPLSEGMENT, DATATYPE>, \
+ <PAGEGRANULARITY, BIGSEGMENT,,,0Fh>, \
+ 00h}
+
+GDTLen EQU $ - GDTStart - 1
+
+
+code16bitStart:
+
+;L1: jmp $
+ cli
+
+ mov si, OFFSET GDTAddress
+ ;
+ ; Set DS and ES limits
+ ;
+ db 66h ; Force 32 bit load
+ lgdt FWORD PTR cs:[si]
+
+ mov eax, CR0 ; get CPU control word 0
+ or al, 01 ; enable CPU protected mode
+ mov CR0, eax ; write back to CPU control word 0
+ jmp target
+
+target:
+
+ mov ax, TXT_DATA32
+ mov ds, ax ; set DS limit
+ mov es, ax ; set ES limit
+ mov fs, ax ; set FS limit
+ mov gs, ax ; set GS limit
+ mov ss, ax ; set SS limit
+
+ ;
+ ; Disable protected mode
+ ;
+ mov eax, CR0 ; get CPU control word 0
+ and al, 0FEh ; disable CPU protected mode
+ mov CR0, eax ; write back to CPU control word 0
+ jmp target3
+
+target3:
+ xor ax, ax
+ mov ds, ax ; set flat DS
+ mov es, ax ; set flat ES
+
+ ;
+ ; Fall through to main code
+ ;
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+;
+; Procedure: LoadVsmcuRetNS - Variable Size Processor Microcode Update (Stackless)
+;
+; Input: SP = Return address
+;
+; Output: None
+;
+; Registers: All but SP are modified
+;
+; Description:
+; Load MCU into processor.
+;
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+
+LoadVsmcuRetNS PROC NEAR PUBLIC
+ ;
+ ; Check uCode was loaded or not
+ ;
+ xor eax, eax
+ xor edx, edx
+ mov ecx, MCU_REV_MSR
+ wrmsr
+ mov eax, 1
+ cpuid
+ mov ecx, MCU_REV_MSR
+ rdmsr
+ or edx, edx
+ jnz uCode_loaded
+
+ ;
+ ; Restore MCU address from scratch register
+ ;
+ mov eax, 1
+ cpuid
+
+ mov eax, TXT_PUBLIC_BASE + MCU_BASE_ADDR
+ mov eax, [eax]
+
+ lea eax, [eax + SIZEOF MCU] ; EAX -> MCU data (after header)
+ xor edx, edx
+ mov ecx, MCU_LOAD_MSR ; Trigger to load MCU
+
+ wrmsr ; Load MCU
+
+ mov eax, 1
+ cpuid
+uCode_loaded:
+ ;
+ ; Fall through
+ ;
+LoadVsmcuRetNS ENDP
+
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+; Procedure: TxtPrepareCacheForAcModuleRetNS
+;
+; Input: None
+;
+; Output: None
+;
+; Registers: None are preserved
+;
+; Description: Cache initialization per TXT BIOS spec
+;
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+
+TxtPrepareCacheForAcModuleRetNS PROC NEAR PUBLIC
+
+ ;
+ ; Ensure CR0.CD and CR0.NW are cleared
+ ;
+ mov eax, cr0 ;
+ and eax, NOT (CR0_CD_MASK + CR0_NW_MASK)
+ mov cr0, eax
+ ;
+ ; Fall through
+ ;
+TxtPrepareCacheForAcModuleRetNS ENDP
+
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+; Procedure: TxtCleanMcaNS
+;
+; Input: None
+;
+; Output: None
+;
+; Registers: None are preserved
+;
+; Description: MCA registers are cleaned
+;
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+
+TxtCleanMcaNS PROC NEAR PUBLIC
+ ;
+ ; Clean MC[i]_STATUS MSR registers
+ ; SCLEAN will generate GPF otherwise
+ ;
+ mov ecx, MCG_CAP
+ rdmsr
+ movzx ebx, al ; Bank count to ebx
+ sub eax, eax ; Write 0 into all MCi_STATUS registers
+ sub edx, edx
+ mov ecx, MC0_STATUS
+
+McaErrorCleanLoopStart:
+ wrmsr
+ dec ebx
+ jz continue
+ add ecx, 4 ; Number of MSRs per bank
+ jmp McaErrorCleanLoopStart
+
+continue:
+ ;
+ ; Fall through
+ ;
+TxtCleanMcaNS ENDP
+
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+; Procedure: TxtHaltLoopNS
+;
+; Input: None
+;
+; Output: None
+;
+; Registers: None are preserved
+;
+; Description: APs enter halt loop
+;
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+TxtHaltLoopNS PROC NEAR PUBLIC
+
+ mov eax, CR4
+ or eax, CR4_OSFXSR + CR4_DE + CR4_SMXE
+ mov CR4, eax
+
+ mov eax, 1
+ cpuid
+ shr ebx, 24 ; ebx is initial APIC ID shifted rightmostly
+
+ ;
+ ; Since accesses to semaphore cannot be serialized, accesses among different CPUs
+ ; are orchestrated as following:
+ ; BSP will only READ semaphore
+ ; All APs will keep READING semaphore until its value EQUALS to that AP's
+ ; APIC ID minus 1. Only AFTER that AP will INCREMENT semaphore.
+ ; This allows BSP to judge WHEN all APs finished.
+ ;
+ mov ecx, [TXT_PUBLIC_BASE + SEMAPHORE]
+
+keepWaiting:
+ mov eax, [ecx]
+ inc eax
+ cmp eax, ebx
+ jb keepWaiting
+ ja hltLoop
+ mov [ecx], eax
+
+hltLoop:
+ cli
+ hlt
+ jmp hltLoop
+
+TxtHaltLoopNS ENDP
+
+TxtSegment16 ENDS
+
+END
diff --git a/ReferenceCode/Haswell/Txt/TxtInit/Pei/Ia32/TxtPeiAp.inf b/ReferenceCode/Haswell/Txt/TxtInit/Pei/Ia32/TxtPeiAp.inf
new file mode 100644
index 0000000..a6e8185
--- /dev/null
+++ b/ReferenceCode/Haswell/Txt/TxtInit/Pei/Ia32/TxtPeiAp.inf
@@ -0,0 +1,35 @@
+## @file
+# Component description file for TXTPEIAP module
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = TxtPeiAp
+FILE_GUID = D1E59F50-E8C3-4545-BF61-11F002233C97
+COMPONENT_TYPE = USER_DEFINED
+
+[sources.common]
+
+[sources.ia32]
+ TxtPeiAp.asm16
+
+[includes.common]
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include
+
+[libraries.common]
+
+[nmake.common]
diff --git a/ReferenceCode/Haswell/Txt/TxtInit/Pei/Ia32/TxtPeiApV7.inf b/ReferenceCode/Haswell/Txt/TxtInit/Pei/Ia32/TxtPeiApV7.inf
new file mode 100644
index 0000000..e649127
--- /dev/null
+++ b/ReferenceCode/Haswell/Txt/TxtInit/Pei/Ia32/TxtPeiApV7.inf
@@ -0,0 +1,35 @@
+## @file
+# Component description file for TXTPEIAP module
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = TxtPeiAp
+FILE_GUID = D1E59F50-E8C3-4545-BF61-11F002233C97
+COMPONENT_TYPE = FILE
+BUILD_TYPE = MAKEFILE
+
+[sources.common]
+
+[sources.ia32]
+ TxtPeiAp.asm16
+
+[includes.common]
+
+[libraries.common]
+
+[nmake.common]
diff --git a/ReferenceCode/Haswell/Txt/TxtInit/Pei/Ia32/TxtPeiBsp.asm b/ReferenceCode/Haswell/Txt/TxtInit/Pei/Ia32/TxtPeiBsp.asm
new file mode 100644
index 0000000..066aedc
--- /dev/null
+++ b/ReferenceCode/Haswell/Txt/TxtInit/Pei/Ia32/TxtPeiBsp.asm
@@ -0,0 +1,1387 @@
+;/*++
+; This file contains an 'Intel Peripheral Driver' and uniquely
+; identified as "Intel Reference Module" and is
+; licensed for Intel CPUs and chipsets under the terms of your
+; license agreement with Intel or your vendor. This file may
+; be modified by the user, subject to additional terms of the
+; license agreement
+;--*/
+;
+;/*++
+;
+; Copyright (c) 1999 - 2011 Intel Corporation. All rights reserved
+; This software and associated documentation (if any) is furnished
+; under a license and may only be used or copied in accordance
+; with the terms of the license. Except as permitted by such
+; license, no part of this software or documentation may be
+; reproduced, stored in a retrieval system, or transmitted in any
+; form or by any means without the express written consent of
+; Intel Corporation.
+;
+;
+; Module Name:
+;
+; TxtPeiBsp.asm
+;
+; Abstract:
+;
+; This file contains the code to launch BIOS ACM functions in PEI phase
+;
+;--*/
+
+ .XLIST
+ include txt.inc
+ .LIST
+
+ .686P
+ .MMX
+ .XMM
+ .MODEL FLAT,C
+ .CODE
+
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+; Procedure: LaunchBiosAcmSclean
+;
+; Input: None
+;
+; Output: None
+;
+; Registers: None are preserved
+;
+; Description: Setup GETSEC environment (protected mode, mtrrs, etc) and
+; invoke GETSEC:ENTERACCS with requested BIOS ACM entry point.
+;
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+
+LaunchBiosAcmSclean PROC PUBLIC
+ ;
+ ; Tell where we are
+ ;
+ mov eax, 11110000h
+ in ax, 80h
+ mov ah, PORT80_CODE_PREFIX + TXT_LAUNCH_SCLEAN
+ out 80h, eax
+
+ ;
+ ; Enable SMXE, SSE and debug extensions always.
+ ;
+ mov eax, CR4
+ or eax, CR4_OSFXSR + CR4_DE + CR4_SMXE
+ mov CR4, eax
+
+ ;
+ ; Prepare cache of BSP
+ ;
+ mov esi, TXT_PUBLIC_BASE + BIOACM_ADDR
+ mov edi, 0
+
+ CALL_NS PrepareCacheForAcModuleRetNS
+
+ CALL_NS CleanMcaRetNS
+
+ifdef MKF_TXT_RLP_INIT
+ if MKF_TXT_RLP_INIT
+ CALL_NS InitializeApsRetNS
+ endif
+endif
+
+
+ ;
+ ; Call GETSEC[ENTERACCS]
+ ;
+ cli
+ mov eax, ENTERACCS ; eax = ENTERACCS
+ mov ebx, TXT_PUBLIC_BASE + BIOACM_ADDR
+ mov ebx, [ebx]
+ mov ecx, [ebx].ACM_HEADER.AcmSize
+ shl ecx, 2
+ xor edx, edx
+ xor edi, edi
+ mov esi, 0
+
+ _GETSEC
+
+ jmp DoPowerCycleReset
+LaunchBiosAcmSclean ENDP
+
+DoGlobalReset PROC PUBLIC
+ mov dx, 0CF8h ; Make warm system reset through port 0CF9h
+ mov eax, 8000F8ACh ; to be global system reset - set bit 20
+ out dx, eax ; of device 1F
+ mov dx, 0CFCh
+ in eax, dx
+ or eax, (1 SHL 20)
+ out dx, eax
+
+ mov dx, 0CF9h ; After return from SCLEAN function
+ mov al, 0 ; system must be reset.
+ out dx, al
+ mov dx, 0CF9h ; After return from SCLEAN function
+ mov al, 6 ; system must be reset.
+ out dx, al
+ cli
+ hlt
+ jmp $
+
+DoGlobalReset ENDP
+
+DoPowerCycleReset PROC PUBLIC
+ mov dx, 0CF8h ; Make warm system reset through port 0CF9h
+ mov eax, 8000F8ACh ; to be global system reset - set bit 20
+ out dx, eax ; of device 1F
+ mov dx, 0CFCh
+ in eax, dx
+ and eax, NOT (1 SHL 20)
+ out dx, eax
+
+ mov dx, 0CF9h ; After return from SCLEAN function
+ mov al, 0 ; system must be reset.
+ out dx, al
+ mov dx, 0CF9h ; After return from SCLEAN function
+ mov al, 0Eh ; system must be reset.
+ out dx, al
+ cli
+ hlt
+ jmp $
+
+DoPowerCycleReset ENDP
+
+DoHostReset PROC PUBLIC
+ mov dx, 0CF8h ; Make warm system reset through port 0CF9h
+ mov eax, 8000F8ACh ; to be global system reset - set bit 20
+ out dx, eax ; of device 1F
+ mov dx, 0CFCh
+ in eax, dx
+ and eax, NOT (1 SHL 20)
+ out dx, eax
+
+ mov dx, 0CF9h ; After return from SCLEAN function
+ mov al, 0 ; system must be reset.
+ out dx, al
+ mov dx, 0CF9h ; After return from SCLEAN function
+ mov al, 6 ; system must be reset.
+ out dx, al
+ cli
+ hlt
+ jmp $
+
+DoHostReset ENDP
+
+DoCpuReset PROC PUBLIC
+ mov dx, 0CF8h ; Make warm system reset through port 0CF9h
+ mov eax, 8000F8ACh ; to be global system reset - clear bit 20
+ out dx, eax ; of device 1F
+ mov dx, 0CFCh
+ in eax, dx
+ and eax, NOT (1 SHL 20)
+ out dx, eax
+
+ mov dx, 0CF9h ; Issue a CPU only reset by CF9h
+ mov al, 0 ; toggle bit2 from 0 to 1
+ out dx, al
+ mov dx, 0CF9h ; Issue a CPU only reset by CF9h
+ mov al, 4 ;
+ out dx, al
+ cli
+ hlt
+ jmp $
+
+DoCpuReset ENDP
+
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+; Procedure: PrepareCacheForAcModuleRetNS
+;
+; Input: esi - bios acm address
+; edi - in memory flag
+;
+; Output: None
+;
+; Registers: None are preserved
+;
+; Description: MTRRs are set per BIOS spec
+;
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+
+PrepareCacheForAcModuleRetNS PROC FAR PUBLIC
+ ;
+ ; Enable local APIC
+ ;
+ mov ecx, IA32_APIC_BASE
+ rdmsr ; Get APIC Base
+ and eax, BASE_ADDR_MASK ; Just need the address
+ mov DWORD PTR [eax+SPURIOUS_VECTOR_1], 1FFh ; Enable APIC, keep spurious vector
+ ;
+ ; Disable cache
+ ;
+ mov eax, cr0 ; set CR0:CD and CR0:NE, clear CR0:NW
+ or eax, CR0_CD_MASK OR CR0_NE_MASK
+ and eax, NOT CR0_NW_MASK
+ mov cr0, eax
+ cmp edi, 0
+ je @F ; JIf stackless environment
+ wbinvd ; Invalidate the cache
+ jmp disableMtrrs
+
+@@:
+ invd
+
+disableMtrrs:
+ ;
+ ; Disable all MTRRs
+ ;
+ xor eax, eax
+ xor edx, edx
+ mov ecx, IA32_MTRR_DEF_TYPE
+ wrmsr
+
+ ;
+ ; Disable NEM
+ ;
+ mov ecx, NO_EVICT_MODE
+ rdmsr
+ and eax, NOT (BIT1)
+ wrmsr ; Clear No-Eviction Mode Run bit
+ mov ecx, NO_EVICT_MODE
+ rdmsr
+ and eax, NOT (BIT0)
+ wrmsr ; Clear No-Eviction Mode SETUP bit
+
+ invd
+
+ ;
+ ; Clear all variable MTRRs
+ ;
+ mov ecx, IA32_MTRR_CAP
+ rdmsr
+ and eax, 0FFh
+ shl eax, 1
+ mov ecx, eax
+ xor eax, eax
+ xor edx, edx
+@@:
+ add ecx, IA32_MTRR_PHYSBASE0 - 1
+ wrmsr
+ sub ecx, IA32_MTRR_PHYSBASE0 - 1
+ loop @B
+
+ ;
+ ; Determine size of AC module
+ ;
+ mov esi, [esi]
+ mov eax, [esi].ACM_HEADER.AcmSize
+ shl eax, 2 ; ...in bytes (ACM header has size in dwords)
+ ;
+ ; Round up to page size
+ ;
+ mov ecx, eax ; Save
+ and ecx, 0FFFFF000h ; Number of pages in AC module
+ and eax, 0FFFh ; Number of "less-than-page" bytes
+ jz rounded
+ mov eax, 1000h ; Add the whole page size
+
+rounded:
+ add eax, ecx ; eax - rounded up AC module size
+
+ ;
+ ; Define "local" vars for this routine
+ ;
+ ACM_SIZE_TO_CACHE TEXTEQU <mm0>
+ ACM_BASE_TO_CACHE TEXTEQU <mm1>
+ NEXT_MTRR_INDEX TEXTEQU <mm2>
+ NEXT_MTRR_SIZE TEXTEQU <mm3>
+ ;
+ ; Initialize "locals"
+ ;
+ sub ecx, ecx
+ movd NEXT_MTRR_INDEX, ecx ; Start from MTRR0
+
+ ;
+ ; Save remaining size to cache
+ ;
+ movd ACM_SIZE_TO_CACHE, eax ; Size of ACM that must be cached
+ movd ACM_BASE_TO_CACHE, esi ; Base ACM address
+
+nextMtrr:
+ ;
+ ; Get remaining size to cache
+ ;
+ movd eax, ACM_SIZE_TO_CACHE
+ and eax, eax
+ jz done ; If no left size - we are done
+ ;
+ ; Determine next size to cache.
+ ; We start from bottom up. Use the following algorythm:
+ ; 1. Get our own alignment. Max size we can cache equals to our alignment
+ ; 2. Determine what is bigger - alignment or remaining size to cache.
+ ; If aligment is bigger - cache it.
+ ; Adjust remaing size to cache and base address
+ ; Loop to 1.
+ ; If remaining size to cache is bigger
+ ; Determine the biggest 2^N part of it and cache it.
+ ; Adjust remaing size to cache and base address
+ ; Loop to 1.
+ ; 3. End when there is no left size to cache or no left MTRRs
+ ;
+ movd esi, ACM_BASE_TO_CACHE
+ bsf ecx, esi ; Get index of lowest bit set in base address
+ ;
+ ; Convert index into size to be cached by next MTRR
+ ;
+ mov edx, 1h
+ shl edx, cl ; Alignment is in edx
+ cmp edx, eax ; What is bigger, alignment or remaining size?
+ jbe gotSize ; JIf aligment is less
+ ;
+ ; Remaining size is bigger. Get the biggest part of it, 2^N in size
+ ;
+ bsr ecx, eax ; Get index of highest set bit
+ ;
+ ; Convert index into size to be cached by next MTRR
+ ;
+ mov edx, 1
+ shl edx, cl ; Size to cache
+
+gotSize:
+ mov eax, edx
+ movd NEXT_MTRR_SIZE, eax ; Save
+
+ ;
+ ; Compute MTRR mask value: Mask = NOT (Size - 1)
+ ;
+ dec eax ; eax - size to cache less one byte
+ not eax ; eax contains low 32 bits of mask
+ or eax, MTRR_VALID ; Set valid bit
+
+ ;
+ ; Program mask register
+ ;
+ mov ecx, IA32_MTRR_PHYSMASK0 ; setup variable mtrr
+ movd ebx, NEXT_MTRR_INDEX
+ add ecx, ebx
+
+ mov edx, 0Fh ; 8K range (FFFFFFE800)
+ wrmsr
+ ;
+ ; Program base register
+ ;
+ sub edx, edx
+ mov ecx, IA32_MTRR_PHYSBASE0 ; setup variable mtrr
+ add ecx, ebx ; ebx is still NEXT_MTRR_INDEX
+
+ movd eax, ACM_BASE_TO_CACHE
+ or eax, WB ; set type to write back
+ wrmsr
+ ;
+ ; Advance and loop
+ ; Reduce remaining size to cache
+ ;
+ movd ebx, ACM_SIZE_TO_CACHE
+ movd eax, NEXT_MTRR_SIZE
+ sub ebx, eax
+ movd ACM_SIZE_TO_CACHE, ebx
+
+ ;
+ ; Increment MTRR index
+ ;
+ movd ebx, NEXT_MTRR_INDEX
+ add ebx, 2
+ movd NEXT_MTRR_INDEX, ebx
+ ;
+ ; Increment base address to cache
+ ;
+ movd ebx, ACM_BASE_TO_CACHE
+ movd eax, NEXT_MTRR_SIZE
+ add ebx, eax
+ movd ACM_BASE_TO_CACHE, ebx
+
+ jmp nextMtrr
+
+done:
+ ;
+ ; Enable variable MTRRs
+ ;
+ xor edx, edx
+ mov eax, MTRR_ENABLE; enable mtrrs (but not fixed ones)
+ mov ecx, IA32_MTRR_DEF_TYPE
+ wrmsr
+ ;
+ ; Enable cache
+ ;
+ mov eax, cr0 ; Enable caching - WB (NW stays clear)
+ and eax, NOT CR0_CD_MASK
+ mov cr0, eax
+
+ RET_NS
+PrepareCacheForAcModuleRetNS ENDP
+
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+; Procedure: CleanMcaRetNS
+;
+; Input: None
+;
+; Output: None
+;
+; Registers: None are preserved
+;
+; Description: Setup GETSEC environment (protected mode, mtrrs, etc)
+; invoke GETSEC:ENTERACCS with requested module
+;
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+
+CleanMcaRetNS PROC NEAR PUBLIC
+
+ ;
+ ; Clean all MCi_STATUS MSR registers
+ ; SCLEAN will generate GPF otherwise
+ ;
+ mov ecx, MCG_CAP
+ rdmsr
+ movzx ebx, al ; Bank count to ebx
+ sub eax, eax ; Write 0 into all MCi_STATUS registers
+ sub edx, edx
+ mov ecx, MC0_STATUS
+
+McaErrorCleanLoopStart:
+ wrmsr
+ dec ebx
+ jz exit
+ add ecx, 4 ; Number of MSRs per bank
+ jmp McaErrorCleanLoopStart
+
+exit:
+ RET_NS
+CleanMcaRetNS ENDP
+
+
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+; Procedure: InitializeApsRetNS
+;
+; Input: None
+;
+; Output: None
+;
+; Registers: None are preserved
+;
+; Description:
+;
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+InitializeApsRetNS PROC NEAR
+ mov eax, 1
+ cpuid
+ shr ebx, 16 ; Total Logical Proc Count in BL
+ cmp bl, 1 ; If 1 thread - nothing to do
+ je exit
+
+ ;
+ ; Init Timer 1
+ ;
+ mov al, 54h
+ out 43h, al
+ mov al, 12h
+ out 41h, al
+
+ ;
+ ; More than one thread
+ ; Get APIC address
+ ;
+ mov ecx, IA32_APIC_BASE
+ rdmsr ; Get APIC Base
+ and eax, BASE_ADDR_MASK ; Just need the address
+ mov edi, eax ; edi points to APIC base
+
+ mov esi, TXT_PUBLIC_BASE ; esi points to public space
+
+ ;
+ ; Wait for APIC ready
+ ;
+ mov edx, IcrStatusRetNs
+ mov ecx, 15
+ CALL_NS ltWaitStatusRetNS
+
+ ;
+ ; Broadcast INIT message to put all APs into Wait for SIPI state
+ ; C0500 -> Destination = All excl self, Delivery = INIT
+ ;
+ mov DWORD PTR ICR_LOW[edi], 000C0500h
+ mov edx, NeverStatusRetNS
+ mov ecx, 667
+ CALL_NS ltWaitStatusRetNS ; Wait full 10ms
+ ;
+ ; Create vector used in the following SIPI message
+ ; Below address is the real mode address of AP code in Boot Block
+ ; LTCACHE.BIN containg AP thread code must be placed at the above address
+ ; in Boot block (FFFF0000h). See file LTCACHE.ASM
+ ;
+
+ mov ebx, [esi+APINIT_ADDR]
+ shr ebx, 12
+ and ebx, 0FFh
+ or ebx, 0C0600h ; This is message
+
+ ;
+ ; Broadcast SIPI message with our vector
+ ; Wait for APIC ready
+ ;
+ mov edx, IcrStatusRetNs
+ mov ecx, 15
+ CALL_NS ltWaitStatusRetNS
+ ;
+ ; Send message
+ ;
+ mov ICR_LOW[edi], ebx
+ ;
+ ; Wait 200us as recommended
+ ;
+ mov edx, NeverStatusRetNS
+ mov ecx, 14
+ CALL_NS ltWaitStatusRetNS
+ ;
+ ; Broadcast second SIPI message with our vector
+ ; Wait for APIC ready
+ ;
+ mov edx, IcrStatusRetNs
+ mov ecx, 15
+ CALL_NS ltWaitStatusRetNS
+ ;
+ ; Send message
+ ;
+ mov ICR_LOW[edi], ebx
+ ;
+ ; Wait for semaphore reflect number of CPUs
+ ;
+ mov eax, 1
+ cpuid
+ shr ebx, 16 ; Total Logical Proc Count in BL
+ dec bl ; bl is number of APs
+
+ mov edx, SemaphoreStatusRetNS
+ mov ecx, 6670
+ CALL_NS ltWaitStatusRetNS ; Wait for up to 100ms
+
+ ;
+ ; Broadcast INIT message to put all APs back into Wait for SIPI state
+ ; Wait for APIC ready
+ ;
+ mov edx, IcrStatusRetNs
+ mov ecx, 15
+ CALL_NS ltWaitStatusRetNS
+ ;
+ ; Send message
+ ;
+ mov DWORD PTR ICR_LOW[edi], 000C0500h
+
+ mov edx, NeverStatusRetNS
+ mov ecx, 667
+ CALL_NS ltWaitStatusRetNS ; Wait full 10ms
+
+exit:
+ RET_NS
+InitializeApsRetNS ENDP
+
+
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+; Procedure: SaveApConfig
+;
+; Input: ApCfg - pointer to save area
+;
+; Output: None
+;
+; Registers: All are preserved
+;
+; Description: Function is called in memory present environment on S3 resume
+; path. Saves contents of all MTRRs into table plus some registers.
+;
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+SaveApConfig PROC NEAR PUBLIC, ApCfg:PTR QWORD
+
+ pushad
+
+ mov esi, ApCfg
+ mov ecx, IA32_MTRR_CAP
+ rdmsr
+ and eax, 0FFh
+ shl eax, 1
+ mov ecx, eax
+
+@@:
+ add ecx, IA32_MTRR_PHYSBASE0 - 1
+ rdmsr
+ mov [esi], eax
+ mov [esi+4], edx
+ add esi, SIZEOF QWORD
+ sub ecx, IA32_MTRR_PHYSBASE0 - 1
+ loop @B
+
+ mov ecx, IA32_MTRR_DEF_TYPE
+ rdmsr
+ mov [esi], eax
+ mov [esi+4], edx
+
+ sidt [esi+8]
+
+ mov ecx, IA32_MISC_ENABLE_MSR
+ rdmsr
+ mov [esi+010h], eax
+ mov [esi+014h], edx
+
+ popad
+ ret
+SaveApConfig ENDP
+
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+; Procedure: StartupAllAPs
+;
+; Input: pFunction - pointer to function to execute on AP
+; pParam - pointre to pFunction parameters
+;
+; Output: None
+;
+; Registers: All are preserved
+;
+; Description: Procedure is called in memmory present enironment on S3
+; resume path and is executed on BSP
+; It saves memory at address 1000h into buffer
+; It then copies AP start-up code into address 1000h
+; Then variables in the 1000h area are updated and APs are started
+; After APs finish execution of function passed as parameter they
+; are halted. BSP restores contents 1000h area from buffer and
+; returns.
+;
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+
+Func TYPEDEF PROTO
+
+PFUNC TYPEDEF PTR Func
+
+StartUp STRUCT
+ db 0FAh ; cli
+ db 066h, 0BBh ; mov ebx, OFFSET gdtLim
+ db StartUp.gdtLim, 0,0,0
+ db 066h
+ db 067h, 02Eh, 00Fh, 001h, 013h ; lgdt FWORD PTR cs:[ebx]
+ db 00Fh, 020h, 0C0h ; mov eax, CR0
+ db 00Ch, 001h ; or al, 01
+ db 00Fh, 022h, 0C0h ; mov CR0, eax
+ ;
+ ; 32 bit jump to 32 bit Function handler
+ ;
+ db 066h
+ db 0eah
+fOff dd 0
+fCs dw 0
+
+ ALIGN 16
+fDs dw 0
+gdtLim dw ? ; Size of LT GDT in bytes
+gdtBas dd ? ; Physical address of LT GDT
+fParam dd ?
+smphr dd ?
+StartUp ENDS
+
+
+StartupAllAPs PROC NEAR, pFunction:PFUNC, pParam:PTR QWORD
+ LOCAL buffer:StartUp
+ LOCAL savedESP:DWORD
+
+ pushad
+ mov savedESP, esp
+ mov eax, 1
+ cpuid
+ shr ebx, 16 ; Total Logical Proc Count in BL
+ cmp bl, 1 ; If 1 thread - nothing to do
+ je exit
+
+ ;
+ ; Init Timer 1
+ ;
+ mov al, 54h
+ out 43h, al
+ mov al, 12h
+ out 41h, al
+
+ ;
+ ; More than one thread. Prepare Startup area
+ ;
+ mov esi, 1000h ; Source
+ lea edi, buffer ; Destination
+ mov ecx, sizeof StartUp / 4
+ CALL_NS MemCopyRetNS
+
+ mov esi, offset ApHandler16 ; Source
+ mov edi, 1000h ; Destination
+ mov ecx, sizeof StartUp / 4
+ CALL_NS MemCopyRetNS
+ ;
+ ; Update Srartup area variables
+ ;
+ mov edi, 1000h
+ mov ds:[edi].StartUp.fCs, cs
+ mov ds:[edi].StartUp.fDs, ds
+ mov eax, pFunction
+ mov ds:[edi].StartUp.fOff, eax
+ sub eax, eax
+ mov ds:[edi].StartUp.smphr, eax
+ mov eax, pParam
+ mov ds:[edi].StartUp.fParam, eax
+ sgdt ds:[edi].StartUp.gdtLim
+
+ ;
+ ; Get APIC address
+ ;
+ mov ecx, IA32_APIC_BASE
+ rdmsr ; Get APIC Base
+ and eax, BASE_ADDR_MASK ; Just need the address
+ mov edi, eax ; edi points to APIC base
+
+ ;
+ ; Wait for APIC ready
+ ;
+ mov edx, IcrStatusRetNs
+ mov ecx, 15
+ CALL_NS ltWaitStatusRetNS
+
+ ;
+ ; Broadcast INIT message to put all APs into Wait for SIPI state
+ ; C0500 -> Destination = All excl self, Delivery = INIT
+ ;
+ mov DWORD PTR ICR_LOW[edi], 000C0500h
+ mov edx, NeverStatusRetNS
+ mov ecx, 667
+ CALL_NS ltWaitStatusRetNS ; Wait full 10ms
+ ;
+ ; Create vector used in the following SIPI message
+ ;
+ mov ebx, 0C0600h + (1000h SHR 12)
+ ;
+ ; Broadcast SIPI message with our vector
+ ; Wait for APIC ready
+ ;
+ mov edx, IcrStatusRetNs
+ mov ecx, 15
+ CALL_NS ltWaitStatusRetNS
+ ;
+ ; Send message
+ ;
+ mov ICR_LOW[edi], ebx
+ ;
+ ; Wait 200us as recommended
+ ;
+ mov edx, NeverStatusRetNS
+ mov ecx, 14
+ CALL_NS ltWaitStatusRetNS
+ ;
+ ; Broadcast second SIPI message with our vector
+ ; Wait for APIC ready
+ ;
+ mov edx, IcrStatusRetNs
+ mov ecx, 15
+ CALL_NS ltWaitStatusRetNS
+ ;
+ ; Send message
+ ;
+ mov ICR_LOW[edi], ebx
+ ;
+ ; Wait for semaphore reflect number of CPUs
+ ;
+ mov eax, 1
+ cpuid
+ shr ebx, 16 ; Total Logical Proc Count in BL
+ dec bl ; bl is number of APs
+
+ mov edx, SemaphoreStatus2RetNS
+ mov ecx, 6670
+ CALL_NS ltWaitStatusRetNS ; Wait for up to 100ms
+ ;
+ ; Restore StartUp area
+ ;
+ lea esi, buffer ; Source
+ mov edi, 1000h ; Destination
+ mov ecx, sizeof StartUp / 4
+ CALL_NS MemCopyRetNS
+
+exit:
+ mov esp, savedESP
+ popad
+ ret
+
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+; Section: ApHandler16
+;
+; Input: None
+;
+; Output: None
+;
+; Registers: Irrelevant
+;
+; Description: This code is copied over address 0:1000. After recieving SIPI
+; AP is directed to this address where it starts execution in real mode.
+; AP first switches to protected mode, loads the same GDT which is used
+; by BSP and jumps to Procedure at fCs:fOff
+;
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+
+ ALIGN 16
+ ;
+ ; Note After coppying this code must be aligned on page boundary!
+ ;
+
+ApHandler16 StartUp <>
+
+StartupAllAPs ENDP
+
+
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+; Procedure: PutApsInWfs
+;
+; Input: None
+;
+; Output: None
+;
+; Registers: All are preserved
+;
+; Description: Procedure is called in memory present environment on S3 resume path.
+; INIT SIPI message is sent to all APs.
+;
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+
+PutApsInWfs PROC PUBLIC
+ LOCAL savedESP:DWORD
+ pushad
+ mov savedESP, esp
+
+ mov eax, 1
+ cpuid
+ shr ebx, 16 ; Total Logical Proc Count in BL
+ cmp bl, 1 ; If 1 thread - nothing to do
+ je exit
+
+ ;
+ ; Get APIC address
+ ;
+ mov ecx, IA32_APIC_BASE
+ rdmsr ; Get APIC Base
+ and eax, BASE_ADDR_MASK ; Just need the address
+ mov edi, eax ; edi points to APIC base
+ ;
+ ; Broadcast INIT message to put all APs back into Wait for SIPI state
+ ; Wait for APIC ready
+ ;
+ mov edx, IcrStatusRetNs
+ mov ecx, 15
+ CALL_NS ltWaitStatusRetNS
+ ;
+ ; Send message
+ ;
+ mov DWORD PTR ICR_LOW[edi], 000C0500h
+
+ mov edx, NeverStatusRetNS
+ mov ecx, 667
+ CALL_NS ltWaitStatusRetNS ; Wait full 10ms
+
+exit:
+ mov esp, savedESP
+ popad
+ ret
+PutApsInWfs ENDP
+
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+; Procedure: LaunchBiosAcmScheck
+;
+; Input: None
+;
+; Output: None
+;
+; Registers: None are preserved
+;
+; Description: Setup GETSEC environment (protected mode, mtrrs, etc) and
+; invoke GETSEC:ENTERACCS with requested BIOS ACM entry point.
+;
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+
+LaunchBiosAcmScheck PROC PUBLIC, BiosAcAddr:PTR QWORD
+
+ LOCAL SavedGdtr:QWORD
+ LOCAL SavedSS:dword
+ LOCAL SavedESP:dword
+ LOCAL SavedCS:dword
+ LOCAL SavedCR3:dword
+ pushf
+ cli
+ pushad
+ ;
+ ; Tell where we are
+ ;
+ in ax, 80h
+ mov ah, PORT80_CODE_PREFIX + TXT_LAUNCH_SCHECK
+ out 80h, ax
+ ;
+ ; Save control registers
+ ;
+ mov eax, cr4
+ push eax
+ mov eax, cr0
+ push eax
+ ;
+ ; Save segment registers
+ ;
+ push ds
+ push es
+ push gs
+ push fs
+ ;
+ ; Save CS
+ ;
+ sub eax, eax ; Clean upper word
+ mov ax, cs
+ mov SavedCS, eax
+ ;
+ ; Save stack at this level
+ ;
+ mov ax, ss
+ mov SavedSS, eax
+ mov SavedESP, esp
+ mov eax, cr3
+ mov SavedCR3, eax
+
+ ;
+ ; Save GDT
+ ;
+ sgdt SavedGdtr ; save value of gdtr in local variable
+ ;
+ ; Define "local" vars for this routine
+ ;
+ SAVED_EBP TEXTEQU <mm4>
+ ;
+ ; Save ebp in MMX register
+ ;
+ movd SAVED_EBP, ebp ; Size of ACM that must be cached
+
+ ;
+ ; Enable SMXE, SSE and debug extensions always.
+ ;
+ mov eax, CR4
+ or eax, CR4_OSFXSR + CR4_DE + CR4_SMXE
+ mov CR4, eax
+ ;
+ ; Prepare cache of BSP
+ ;
+ mov esi, BiosAcAddr
+ mov edi, 1
+
+ CALL_NS PrepareCacheForAcModuleRetNS
+
+ CALL_NS CleanMcaRetNS
+
+ ;
+ ; Call GETSEC[ENTERACCS]
+ ;
+ mov eax, ENTERACCS ; eax = ENTERACCS
+ mov ebx, BiosAcAddr
+ mov ebx, [ebx]
+ mov ecx, [ebx].ACM_HEADER.AcmSize
+ shl ecx, 2
+ xor edx, edx
+ mov edi, S3_RESUME_PATH
+ mov esi, 4
+
+ _GETSEC
+
+ ;
+ ; Return point after ACEXIT.
+ ;
+ movd ebp, SAVED_EBP
+ lea eax, SavedGdtr
+ lgdt FWORD PTR [eax]
+ mov eax, SavedSS
+ mov ss, ax
+ mov esp, SavedESP
+ mov eax, SavedCR3
+ mov cr3, eax
+ ;
+ ; Restore segment registers
+ ;
+ pop fs
+ pop gs
+ pop es
+ pop ds
+ ;
+ ; Restore control registers
+ ;
+ pop eax
+ ;
+ ;remain cache disabled until MTRRs restored
+ ;
+ or eax, CR0_CD_MASK
+ and eax, NOT CR0_NW_MASK
+ wbinvd
+;
+ mov cr0, eax
+ pop eax
+ mov cr4, eax
+ ;
+ ; Restore CS
+ ;
+ mov eax, SavedCS
+ push eax
+ push OFFSET ReloadCS
+ retf
+
+ReloadCS:
+ popad
+ popf
+ emms
+
+ ret
+LaunchBiosAcmScheck ENDP
+
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+; Procedure: RestoreMtrrProgramming
+;
+; Input: ApMtrrTab - pointer to save area
+;
+; Output: None
+;
+; Registers: All are preserved
+;
+; Description: Function is executed on BSP in memory present environment on S3
+; resume path. Restores contents of all MTRRs from table
+;
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+RestoreMtrrProgramming PROC NEAR PUBLIC, ApMtrrTab:PTR QWORD
+ LOCAL savedESP:DWORD
+ pushad
+ mov savedESP, esp
+
+ mov esi, ApMtrrTab
+ CALL_NS RestoreMtrrProgrammingRetNS
+
+ mov esp, savedESP
+ popad
+ ret
+RestoreMtrrProgramming ENDP
+
+
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+; Procedure: RestoreMtrrProgrammingRetNS
+;
+; Input: esi - pointer to save area
+;
+; Output: None
+;
+; Registers: None are preserved
+;
+; Description: Restores contents of all MTRRs from table
+;
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+RestoreMtrrProgrammingRetNS PROC NEAR PUBLIC
+ mov eax, cr0 ; set CR0:CD and CR0:NE, clear CR0:NW
+ or eax, CR0_CD_MASK OR CR0_NE_MASK
+ and eax, NOT CR0_NW_MASK
+ mov cr0, eax
+ wbinvd ; flush and invalidate the cache
+
+ xor edx, edx
+ mov eax, MTRR_ENABLE + MTRR_FIXED_ENABLE ; enable mtrrs
+ mov ecx, 2FFh
+ wrmsr
+
+ mov ecx, IA32_MTRR_CAP
+ rdmsr
+ and eax, 0FFh
+ shl eax, 1
+ mov ecx, eax
+
+@@:
+ add ecx, IA32_MTRR_PHYSBASE0 - 1
+ mov eax, [esi]
+ mov edx, [esi+4]
+ wrmsr
+ add esi, SIZEOF QWORD
+ sub ecx, IA32_MTRR_PHYSBASE0 - 1
+ loop @B
+
+ mov ecx, IA32_MTRR_DEF_TYPE
+ mov eax, [esi]
+ mov edx, [esi+4]
+ wrmsr
+ mov ecx, IA32_MISC_ENABLE_MSR
+ mov eax, [esi+010h]
+ mov edx, [esi+014h]
+ wrmsr
+
+ mov eax, cr0 ; Enable caching - WB (NW stays clear)
+ and eax, NOT CR0_CD_MASK
+ mov cr0, eax
+
+ RET_NS
+RestoreMtrrProgrammingRetNS ENDP
+
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+; Procedure: RestoreApConfig
+;
+; Input: esi - pointer to save area
+;
+; Output: None
+;
+; Registers: None are preserved
+;
+; Description: Function is executed on AP in memory present environment on S3
+; resume path. Restores contents of all MTRRs from table
+;
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+RestoreApConfig PROC NEAR PUBLIC
+ mov eax, CR4
+ or eax, CR4_OSFXSR + CR4_DE
+ mov CR4, eax
+
+ mov esi, 1000h
+ mov ds, cs:[esi].StartUp.fDs
+ mov es, cs:[esi].StartUp.fDs
+ mov fs, cs:[esi].StartUp.fDs
+ mov gs, cs:[esi].StartUp.fDs
+ mov ss, cs:[esi].StartUp.fDs
+
+ mov esi, [esi].StartUp.fParam
+
+ CALL_NS RestoreMtrrProgrammingRetNS
+
+ lidt FWORD PTR [esi+8]
+
+ jmp updateSemaphore
+
+RestoreApConfig ENDP
+
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+; Procedure: DoApInit
+;
+; Input: Contents of startup area at 1000h
+;
+; Output: None
+;
+; Registers: None are preserved
+;
+; Description: Executed on AP. Persforms CPU initialization for running
+; of GETSEC
+;
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+DoApInit PROC NEAR PUBLIC
+ mov eax, CR4
+ or eax, CR4_OSFXSR + CR4_DE + CR4_SMXE
+ mov CR4, eax
+
+ mov esi, 1000h
+ mov ds, cs:[esi].StartUp.fDs
+
+ mov esi, [esi].StartUp.fParam
+ mov edi, 1
+
+ CALL_NS PrepareCacheForAcModuleRetNS
+
+ CALL_NS CleanMcaRetNS
+
+updateSemaphore::
+ mov ecx, 1000h + StartUp.smphr
+ lock inc DWORD PTR [ecx]
+
+hltLoop:
+ cli
+ hlt
+ jmp hltLoop
+
+DoApInit ENDP
+
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+; Procedure: MemCopyRetNS
+;
+; Input: esi - from linear address
+; edi - to linear address
+; ecx - swap size in dwords
+; ds - flat segment
+;
+; Output: None
+;
+; Registers: None
+;
+; Description: Swaps contents of two input buffers.
+;
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+
+MemCopyRetNS PROC NEAR
+
+start:
+ mov eax, ds:[esi] ; source
+ mov ds:[edi], eax
+ add esi, 4
+ add edi, 4
+ loop start
+ RET_NS
+MemCopyRetNS ENDP
+
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+; Procedure: ltWaitStatusRetNS
+;
+; Input: cx - Refresh bit Toggle count
+; 750000us = 50000 toggles
+; edx - offset of Status procedure
+;
+; Output: Z if status is met
+; NZ - timeout occured
+; NC - always
+;
+; Stack: Not available
+;
+; Registers: cx, ax, esp
+;
+; Description: Calls status procedure. If status is met - returns Z and
+; NZ otherwise.
+; Status procedure is required to return Z if status is met and
+; NZ if not
+;
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+ltWaitStatusRetNS PROC NEAR
+
+ in al, PORTB ; Read initial setting.
+ and al, PORTBMASK ; Keep what we care about.
+ mov ah, al ; Keep a copy of the data.
+
+waitLoop:
+ CALL_NS edx ; Call status procedure.
+ jz exit ; Z - status met
+
+waitLoop0:
+ in al, PORTB
+ and al, PORTBMASK
+ cmp al, ah ; Refresh bit changed ?
+ je waitLoop0
+
+ mov ah, al
+ loop waitLoop
+ or ax, 1 ; Clear the ZERO flag - timeout.
+ ; This also clears C flag
+exit:
+ RET_NS
+ltWaitStatusRetNS ENDP
+
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+; Procedure: IcrStatusRetNS
+;
+; Input: ds: Flat, edi - xAPIC Base Address
+;
+; Output: Z if status is met
+;
+; Stack: Not available
+;
+; Registers: all are preserved
+;
+; Description: Returns Z if ICR is idle
+;
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+IcrStatusRetNS PROC NEAR PUBLIC
+ test DWORD PTR ICR_LOW[edi], BIT12
+ RET_NS
+IcrStatusRetNS ENDP
+
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+; Procedure: SemaphoreStatusRetNS
+;
+; Input: ds: Flat
+;
+; Output: Z if status is met
+;
+; Stack: Not available
+;
+; Registers: all are preserved
+;
+; Description: Returns Z if semaphore is 0
+;
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+SemaphoreStatusRetNS PROC NEAR PUBLIC
+ bswap eax
+ mov al, BYTE PTR [esi+SEMAPHORE]
+ cmp al, bl
+ bswap eax
+ RET_NS
+SemaphoreStatusRetNS ENDP
+
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+; Procedure: SemaphoreStatus2RetNS
+;
+; Input: ds: Flat
+;
+; Output: Z if status is met
+;
+; Stack: Not available
+;
+; Registers: Upper byte of eax is modified
+;
+; Description: Returns Z if semaphore is 0
+;
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+SemaphoreStatus2RetNS PROC NEAR PUBLIC
+ bswap eax
+ mov al, BYTE PTR [esi].StartUp.smphr
+ cmp al, bl
+ bswap eax
+ RET_NS
+SemaphoreStatus2RetNS ENDP
+
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+; Procedure: NeverStatusRetNS
+;
+; Input:
+;
+; Output: Z if status is met
+;
+; Stack: Not available
+;
+; Registers: All are preserved
+;
+; Description: Returns Z if ICR is idle
+;
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+NeverStatusRetNS PROC NEAR PUBLIC
+ or dx, dx ; dx is never 0 so return is NZ
+ RET_NS
+NeverStatusRetNS ENDP
+
+
+
+END
diff --git a/ReferenceCode/Haswell/Txt/TxtInit/Pei/Ia32/makefile.new b/ReferenceCode/Haswell/Txt/TxtInit/Pei/Ia32/makefile.new
new file mode 100644
index 0000000..e27781e
--- /dev/null
+++ b/ReferenceCode/Haswell/Txt/TxtInit/Pei/Ia32/makefile.new
@@ -0,0 +1,69 @@
+#++
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#--
+#++
+#
+# Copyright (c) 1999 - 2011 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# Module Name:
+#
+# makefile.new
+#
+# Abstract:
+#
+# makefile for TxtPeiAp.asm16 file
+#
+#--
+
+
+#
+# Globals
+#
+BIN_DIR = $(BUILD_DIR)\$(PROCESSOR)
+TOOLCHAIN = TOOLCHAIN_$(PROCESSOR)
+
+TOOLBIN_DIR = $(BUILD_DIR)\Tools
+
+#
+# Include CommonTools.env enviroment
+#
+
+!INCLUDE $(BUILD_DIR)\PlatformTools.env
+
+AP_GUID = D1E59F50-E8C3-4545-BF61-11F002233C97
+
+all : $(BIN_DIR)\TxtPeiAp.bin
+
+$(BIN_DIR)\TxtPeiAp.bin: $(BIN_DIR)\TxtPeiAp.obj
+
+$(BIN_DIR)\TxtPeiAp.obj: $(SOURCE_DIR)\TxtPeiAp.asm16
+ $(ASM) /c /nologo /Fl /Sa /I$(SOURCE_DIR)\..\..\..\..\Include /Fo$(BIN_DIR)\TxtPeiAp.obj $(SOURCE_DIR)\TxtPeiAp.asm16
+ cd $(BIN_DIR)
+ $(ASMLINK) TxtPeiAp.obj, TxtPeiAp.com,,,,
+ copy TxtPeiAp.com TxtPeiAp.bin
+ $(GENFFSFILE) -B $(BIN_DIR) -V -P1 <<$(BIN_DIR)\txtpeiap.pkg
+PACKAGE.INF
+[.]
+BASE_NAME = TxtPeiAp
+FFS_FILEGUID = $(AP_GUID)
+FFS_FILETYPE = EFI_FV_FILETYPE_RAW
+FFS_ATTRIB_CHECKSUM = FALSE
+FFS_ALIGNMENT = 5
+
+IMAGE_SCRIPT =
+{
+ txtpeiap.bin
+}
+<<KEEP
+
+
diff --git a/ReferenceCode/Haswell/Txt/TxtInit/Pei/TxtPei.c b/ReferenceCode/Haswell/Txt/TxtInit/Pei/TxtPei.c
new file mode 100644
index 0000000..b1b1ec5
--- /dev/null
+++ b/ReferenceCode/Haswell/Txt/TxtInit/Pei/TxtPei.c
@@ -0,0 +1,241 @@
+/** @file
+ This is the main PEIM file for TXT. It represents an abstract outline of the
+ steps required during PEI for enabling TXT. Each individual step is further
+ abstracted behind a function call interface. This is intended to minimize
+ the need to modify this file when porting TXT to future platforms.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+///
+/// External include files do NOT need to be explicitly specified in real EDKII
+/// environment
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#include "TxtPeiLib.h"
+///
+/// #include EFI_PPI_DEFINITION (BootScriptDone)
+///
+#include EFI_PPI_DEFINITION (TxtMemoryUnlocked)
+#include EFI_PPI_DEFINITION (EndOfPeiSignal)
+#include EFI_GUID_DEFINITION (TxtInfoHob)
+#include EFI_GUID_DEFINITION (SaDataHob)
+#endif
+
+STATIC EFI_PEI_PPI_DESCRIPTOR mPpiList = {
+ (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+ &gPeiTxtMemoryUnlockedPpiGuid,
+ NULL
+};
+
+STATIC EFI_PEI_NOTIFY_DESCRIPTOR mNotifyDesc = {
+ (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+ &gEndOfPeiSignalPpiGuid,
+ DprUpdate
+};
+
+/**
+ This is the entry point to the TXT PEIM. The TXT PEIM checks for an TXT
+ capable platform and determines whether SCLEAN should be run. If so,
+ it launches the BIOS ACM to run SCLEAN (which will reset the platform).
+ If not, the PEIM checks to see if the platform is resuming from S3.
+
+ If the platform is resuming from S3, this code will register a callback
+ so that SCHECK will be run when BootScript is done restoring the platform's
+ configuration.
+
+ @param[in] FfsHeader - A pointer the the FFS File containing this PEIM.
+ @param[in] PeiServices - A Pointer to the PEI Services Table.
+
+ @exception EFI_UNSUPPORTED - If the platform is not TXT capable.
+ @retval EFI_SUCCESS - In all other cases not listed above.
+**/
+EFI_STATUS
+EFIAPI
+PeimEntry (
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_STATUS Status;
+ TXT_PEI_LIB_CONTEXT ctx;
+ BOOLEAN TxtEnvInitFail;
+ TxtEnvInitFail = FALSE;
+
+ ///
+ /// Install PPI to tell memory code that it can run.
+ /// Do it always.
+ ///
+ Status = PeiServicesInstallPpi (&mPpiList);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Initialize the TXT PEI Lib functions
+ ///
+ Status = InitializeTxtPeiLib (
+ &ctx,
+ PeiServices
+ );
+
+ if (EFI_ERROR (Status)) {
+ TxtEnvInitFail = TRUE;
+ DEBUG ((EFI_D_ERROR, "TXTPEI::PEI Lib initialization failure\n"));
+ }
+ ///
+ /// Determine TPM presence. If TPM is not present - disabling TXT through TxtInfoHob by setting TxtMode=0
+ /// Incase TXT had been enabled but TPM was removed suddenly. Although TPM presence is precondition of this module
+ /// since all commands executed by BIOS ACM don't depend on TPM state.
+ /// TPM_NV_read will be successfully executed even if TPM is disabled
+ /// and/or deactivated because all indices defined for BIOS ACM
+ /// usage don't require authorization. TPM_ResetEstablishmentBit
+ /// doesn't depend on TPM state at all and can
+ /// be executed with disabled/deactivated TPM always.
+ /// Case when TPM is completely not functional is not considered.
+ ///
+ Status = IsTpmPresent (&ctx);
+ if (EFI_ERROR (Status)) {
+ ///
+ /// If TPM is not present / not supported, set TxtMode=0 incase TPM was removed after TXT enabled
+ ///
+ if (Status == EFI_UNSUPPORTED) {
+ DEBUG ((EFI_D_WARN, "TXTPEI::TPM Support is Disabled in BIOS! Disabling TXT! TxtMode=%x\n", ctx.Hob->Data.TxtMode));
+ } else {
+ DEBUG ((EFI_D_WARN, "TXTPEI::TPM is not present! Disabling TXT! TxtMode=%x\n", ctx.Hob->Data.TxtMode));
+ }
+
+ TxtEnvInitFail = TRUE;
+ }
+ ///
+ /// Detect TXT capable Processor & PCH
+ ///
+ if (!IsTxtChipset (&ctx)) {
+ DEBUG ((EFI_D_WARN, "TXTPEI::Platform or PCH is not TXT capable\n"));
+ return EFI_UNSUPPORTED;
+ } else if (!IsTxtProcessor ()) {
+ DEBUG ((EFI_D_WARN, "TXTPEI::Processor is not TXT capable\n"));
+ return EFI_UNSUPPORTED;
+ } else {
+ DEBUG ((EFI_D_WARN, "TXTPEI::Processor, PCH & Platform is TXT capable\n"));
+ ///
+ /// If Txt Lib or TPM is initiated successful, disable TxT support.
+ ///
+ if (TxtEnvInitFail) {
+ UnlockMemory (&ctx);
+ ctx.Hob->Data.TxtMode = 0;
+ ASSERT (TRUE);
+ return EFI_UNSUPPORTED;
+ }
+ }
+ ///
+ /// Memory is supposed to lock if system is TxT capable.
+ /// Check if we need to run SCLEAN. TxT BIOS spec Section 6.2.5
+ ///
+ if (IsEstablishmentBitAsserted (&ctx) && IsTxtWakeError (&ctx)) {
+
+ DEBUG ((EFI_D_INFO, "TXTPEI::EstablishmentBit is set\n"));
+ ///
+ /// If TXTRESET is set , we must clean TXTRESET bit otherwise SCLEAN
+ /// will fail
+ ///
+ if (IsTxtResetSet (&ctx)) {
+ DoGlobalReset ();
+ }
+ ///
+ /// Setup and Launch SCLEAN
+ ///
+ DEBUG ((EFI_D_INFO, "TXTPEI::Entering SCLEAN\n"));
+
+ DoSclean (&ctx);
+
+ ///
+ /// Reset platform - performed by DoSclean, should not return to execute the following dead looping
+ ///
+ EFI_DEADLOOP ();
+ } else {
+ ///
+ /// Unlock memory, and then continue running
+ ///
+ DEBUG ((EFI_D_INFO, "TXTPEI::EstablishmentBit not asserted - Unlock Memory\n"));
+ AsmWriteMsr64 (0x2e6, 0);
+ }
+
+ Status = PeiServicesNotifyPpi (&mNotifyDesc);
+ ASSERT_EFI_ERROR (Status);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Fix up pointers since they are located in real memory now.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] NotifyDescriptor The notification structure this PEIM registered on install.
+ @param[in] Ppi The memory discovered PPI. Not used.
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+DprUpdate (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
+ IN VOID *Ppi
+ )
+{
+ TXT_INFO_HOB *TxtInfoHob;
+ SA_DATA_HOB *SaDataHob;
+ DPR_DIRECTORY_ENTRY *DprDirectory;
+ UINT16 Index;
+
+ TxtInfoHob = NULL;
+ SaDataHob = NULL;
+ DprDirectory = NULL;
+ Index = 0;
+
+ //
+ // Get TxtInfoHob
+ //
+ TxtInfoHob = (TXT_INFO_HOB *)GetFirstGuidHob (&gTxtInfoHobGuid);
+ if (TxtInfoHob == NULL) {
+ return EFI_NOT_FOUND;
+ }
+ TxtInfoHob->Data.TxtDprMemoryBase = 0;
+
+ //
+ // Get SaDataHob
+ //
+ SaDataHob = (SA_DATA_HOB *)GetFirstGuidHob (&gSaDataHobGuid);
+ if (SaDataHob == NULL) {
+ return EFI_NOT_FOUND;
+ }
+ DprDirectory = (DPR_DIRECTORY_ENTRY *)&(SaDataHob->DprDirectory[0]);
+
+ //
+ // Find TxT DPR Directory
+ //
+ for (Index=0; Index<DPR_DIRECTORY_MAX; Index++) {
+ if (DprDirectory[Index].Type == DPR_DIRECTORY_TYPE_TXT) {
+ TxtInfoHob->Data.TxtDprMemoryBase = (EFI_PHYSICAL_ADDRESS)DprDirectory[Index].PhysBase;
+ break;
+ }
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/Haswell/Txt/TxtInit/Pei/TxtPei.dxs b/ReferenceCode/Haswell/Txt/TxtInit/Pei/TxtPei.dxs
new file mode 100644
index 0000000..fa940d7
--- /dev/null
+++ b/ReferenceCode/Haswell/Txt/TxtInit/Pei/TxtPei.dxs
@@ -0,0 +1,49 @@
+/** @file
+ This is the Dependency expression for the TXT Pei PPI
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "DxeDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+#include EFI_PPI_DEFINITION (Stall)
+#include EFI_PPI_CONSUMER (BootMode)
+#endif
+
+#include EFI_PPI_DEFINITION (TpmInitialized)
+#include EFI_PPI_DEFINITION (CpuPlatformPolicy)
+#include EFI_PPI_DEPENDENCY (SaPeiInit)
+
+DEPENDENCY_START
+ PEI_STALL_PPI_GUID AND
+ PEI_MASTER_BOOT_MODE_PEIM_PPI AND
+ PEI_CPU_PLATFORM_POLICY_PPI_GUID AND
+ SA_PEI_INIT_PPI_GUID
+DEPENDENCY_END
+
diff --git a/ReferenceCode/Haswell/Txt/TxtInit/Pei/TxtPei.inf b/ReferenceCode/Haswell/Txt/TxtInit/Pei/TxtPei.inf
new file mode 100644
index 0000000..428372a
--- /dev/null
+++ b/ReferenceCode/Haswell/Txt/TxtInit/Pei/TxtPei.inf
@@ -0,0 +1,104 @@
+## @file
+# Component description file for TXT PEI module
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = TxtPei
+FILE_GUID = CA9D8617-D652-403b-B6C5-BA47570116AD
+COMPONENT_TYPE = PE32_PEIM
+
+[sources.common]
+ TxtPei.c
+ TxtPeiLib.c
+ Ia32/TxtPeiBsp.asm
+
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGluePeimEntryPoint.c
+
+[includes.common]
+ .
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include/Library
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Cpu/Pentium/Include
+ $(EDK_SOURCE)/Foundation/Framework/Ppi/Stall
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+
+#
+# Edk II Glue Library, some hearder are included by R9 header so have to include
+#
+
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Framework
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/SampleCode
+
+[libraries.common]
+ EdkFrameworkPpiLib
+ SaGuidLib
+ CpuPpiLib
+ CpuGuidLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueBaseLib
+ EdkIIGlueBaseMemoryLib
+ EdkIIGlueBasePciLibPciExpress
+ EdkIIGluePeiDebugLibReportStatusCode
+ EdkIIGluePeiReportStatusCodeLib
+ EdkIIGluePeiServicesLib
+ EdkIIGluePeiMemoryAllocationLib
+ EdkIIGluePeiHobLib
+ AnchorCoveLib
+ TxtLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = TxtPei.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=PeimEntry
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_BASE_LIB__ \
+ -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_PEI_SERVICES_LIB__
diff --git a/ReferenceCode/Haswell/Txt/TxtInit/Pei/TxtPei.mak b/ReferenceCode/Haswell/Txt/TxtInit/Pei/TxtPei.mak
new file mode 100644
index 0000000..ecb55ef
--- /dev/null
+++ b/ReferenceCode/Haswell/Txt/TxtInit/Pei/TxtPei.mak
@@ -0,0 +1,105 @@
+# MAK file for the ModulePart:TxtPei
+
+all : TxtPei
+
+TxtPei : $(BUILD_DIR)\TxtPei.mak TxtPeiBin TxtPeiAp.bin $(BUILD_DIR)\TxtPeiap.ffs
+
+$(BUILD_DIR)\TxtPei.mak : $(TxtPei_DIR)\$(@B).cif $(TxtPei_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(TxtPei_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+MY_DEFINES=\
+ /DAMI_MICROCODE_PPI\
+!IF "$(TXT_DEBUG_INFO)"=="1"
+ /D"TXT_DEBUG_INFO=1"\
+!ELSE
+ /D"TXT_DEBUG_INFO=0"\
+!ENDIF
+
+TxtPei_INCLUDES=\
+ $(EDK_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(TXT_INCLUDES)\
+ $(PROJECT_CPU_INCLUDES)\
+ $(PROJECT_INCLUDES)\
+ $(INTEL_MCH_INCLUDES)\
+ $(TCG_INCLUDES)\
+
+TxtPei_DEFINES=\
+ $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=PeimEntry"\
+ /D PlatformPciExpressBaseAddress=$(PCIEX_BASE_ADDRESS) \
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_BASE_LIB__ \
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_PEI_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_PEI_SERVICES_LIB__\
+ /D __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_MM7__ \
+
+TxtPei_OBJECTS=\
+ $(BUILD_DIR)\$(TxtPei_DIR)\TxtPei.obj\
+ $(BUILD_DIR)\$(TxtPei_DIR)\TxtPeiLib.obj\
+ $(BUILD_DIR)\$(TxtPei_DIR)\Ia32\TxtPeiBsp.obj
+
+TxtPei_LIBS=\
+ $(EDKFRAMEWORKPPILIB)\
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(BUILD_DIR)\IA32\EdkIIGlueBaseLib.lib\
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGluePeiDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGluePeiReportStatusCodeLib_LIB)\
+ $(EdkIIGluePeiDebugLibReportStatusCode_LIB)\
+ $(EdkIIGluePeiServicesLib_LIB)\
+ $(EdkIIGluePeiHobLib_LIB)\
+ $(EdkIIGluePeiMemoryAllocationLib_LIB)\
+ $(CpuGuidLib_LIB)\
+ $(CPU_PPI_LIB)\
+ $(SaGuidLib_LIB)\
+ $(PEIHOBLIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(EdkIIGlueBasePciExpressLib_LIB)\
+ $(PchPlatformPeiLib_LIB)\
+ $(CpuPlatformLib_LIB)\
+ $(BootGuardLib_LIB)\
+ $(TxtLib_LIB)
+
+TxtPeiBin : $(TxtPei_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\TxtPei.mak all\
+ "MY_INCLUDES=$(TxtPei_INCLUDES)"\
+ "MY_DEFINES=$(TxtPei_DEFINES)"\
+ "OBJECTS=$(TxtPei_OBJECTS)" \
+ "AFLAGS=$(AFLAGS) $(PROJECT_CPU_INCLUDES)"\
+ GUID=CA9D8617-D652-403b-B6C5-BA47570116AD\
+ ENTRY_POINT=_ModuleEntryPoint\
+ TYPE=PEIM \
+ EDKIIModule=PEIM\
+ DEPEX1=$(TxtPei_DIR)\TxtPei.dxs \
+ DEPEX1_TYPE=EFI_SECTION_PEI_DEPEX \
+ COMPRESS=0\
+
+TxtPeiAp.bin: $(BUILD_DIR)\TxtPeiap.bin
+
+$(BUILD_DIR)\TxtPeiap.bin: $(BUILD_DIR)\TxtPeiAp.obj
+
+$(BUILD_DIR)\TxtPeiAp.obj:$(TxtPei_DIR)\Ia32\TxtPeiAp.asm16
+ $(ASM) /c /nologo $(PROJECT_CPU_INCLUDES) /Fo$(BUILD_DIR)\TxtPeiAp.obj $(TxtPei_DIR)\Ia32\TxtPeiAp.asm16
+ $(ASMLINK) $(BUILD_DIR)\TxtPeiAp.obj, $*.exe, $*.map,,,
+ exe2bin $*.exe $*.bin
+
+$(BUILD_DIR)\TxtPeiap.ffs : $(BUILD_DIR)\TxtPeiap.bin
+ $(MAKE) /f Core\FFS.mak \
+ BUILD_DIR=$(BUILD_DIR) \
+ GUID=$(AP_GUID) \
+ TYPE=EFI_FV_FILETYPE_RAW \
+ FFS_CHECKSUM=0 \
+ FFS_ALIGNMENT=5 \
+ RAWFILE=$(BUILD_DIR)\TxtPeiap.bin \
+ COMPRESS=0 \
+ FFSFILE=$@ \
+ NAME=DummyName
+
+TXT_AP_FIXUP:
+ $(TxtTools_DIR)\STAFixup.exe $(AP_GUID) $(AMI_ROM) $(AP_FIXUP_FILE) $(AP_OFFSET)
+
+AFTER_ROM: TXT_AP_FIXUP
diff --git a/ReferenceCode/Haswell/Txt/TxtInit/Pei/TxtPei.sdl b/ReferenceCode/Haswell/Txt/TxtInit/Pei/TxtPei.sdl
new file mode 100644
index 0000000..b438250
--- /dev/null
+++ b/ReferenceCode/Haswell/Txt/TxtInit/Pei/TxtPei.sdl
@@ -0,0 +1,86 @@
+TOKEN
+ Name = "TxtPei_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable TXT Pei init support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "TxtPei_DIR"
+ Help = "TXT PEI source directory"
+End
+
+TOKEN
+ Name = "TXT_TOOL_DIR"
+ Value = "$(TXT_DIR)\Tools"
+ Help = "TXT tools directory"
+ TokenType = Expression
+ TargetMAK = Yes
+ TargetH = Yes
+END
+
+TOKEN
+ Name = "AP_GUID"
+ Value = "D1E59F50-E8C3-4545-BF61-11F002233C97"
+ Help = "GUID of AP initialization file."
+ TokenType = Expression
+ TargetMAK = Yes
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "AP_FIXUP_FILE"
+ Value = "$(TXT_TOOL_DIR)\Apfixup.txt"
+ Help = "Name of AP FFS fixup table file."
+ TokenType = Expression
+ TargetMAK = Yes
+ TargetH = Yes
+End
+
+TOKEN
+ Name = "AP_OFFSET"
+ Value = "$(FV_BB_BLOCKS)*$(FLASH_BLOCK_SIZE)"
+ Help = "End-of-file offset of AP initialization file."
+ TokenType = Integer
+ TargetMAK = Yes
+ TargetH = Yes
+End
+
+MODULE
+ Help = "Includes TXTPEI.mak into project"
+ File = "TXTPEI.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\txtpeiap.ffs"
+ Parent = "FV_BB"
+ Priority = -2000
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "TYPE:HOLE LOCATION:0xfffff000"
+ Parent = "$(BUILD_DIR)\txtpeiap.ffs"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\TxtPei.ffs"
+ Parent = "FV_BB"
+ InvokeOrder = BeforeParent
+End
+
+ELINK
+ Name = "TXT_INCLUDES"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "/I$(TxtPei_DIR)"
+ Parent = "TXT_INCLUDES"
+ InvokeOrder = AfterParent
+End \ No newline at end of file
diff --git a/ReferenceCode/Haswell/Txt/TxtInit/Pei/TxtPeiLib.c b/ReferenceCode/Haswell/Txt/TxtInit/Pei/TxtPeiLib.c
new file mode 100644
index 0000000..436ca18
--- /dev/null
+++ b/ReferenceCode/Haswell/Txt/TxtInit/Pei/TxtPeiLib.c
@@ -0,0 +1,1045 @@
+/** @file
+ This file contains an implementation of the function call interfaces
+ required by the main TXT PEIM file. Hopefully, future platform porting
+ tasks will be mostly limited to modifying the functions in this file.
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "TxtPeiLib.h"
+#include "TxtLibrary.h"
+
+EFI_GUID mTxtBiosAcmPeiFileGuid = PEI_BIOS_ACM_FILE_GUID;
+EFI_GUID mTxtApStartupPeiFileGuid = PEI_AP_STARTUP_FILE_GUID;
+EFI_GUID mCpuMicrocodeFileGuid = CPU_MICROCODE_FILE_GUID;
+#define EFI_PEI_PCI_CFG2_PPI_GUID \
+ { 0x57a449a, 0x1fdc, 0x4c06, 0xbf, 0xc9, 0xf5, 0x3f, 0x6a, 0x99, 0xbb, 0x92 }
+
+EFI_GUID gPeiPciCfgPpiInServiceTableGuid2 = EFI_PEI_PCI_CFG2_PPI_GUID;
+///
+/**
+ This routine initializes and collects all PPIs and data required
+ by the routines in this file.
+
+ @param[in] pctx - A pointer to an initialized TXT PEI Context data structure
+ @param[in] mPS - A pointer to the PEI Service Table
+
+ @exception EFI_UNSUPPORTED - If any of the required PPIs or data are unavailable
+ @retval EFI_SUCCESS - In all cases not listed above
+**/
+EFI_STATUS
+InitializeTxtPeiLib (
+ IN TXT_PEI_LIB_CONTEXT *pctx,
+ IN EFI_PEI_SERVICES **mPS
+ )
+{
+ EFI_STATUS Status;
+
+ ///
+ /// Make sure our pointers start life as NULL pointers
+ ///
+ pctx->PeiStall = NULL;
+ pctx->BiosAcmBase = NULL;
+ pctx->ApStartup = NULL;
+ pctx->McuStart = NULL;
+
+ ///
+ /// Initialize all pointers
+ ///
+ pctx->PeiServices = mPS;
+ pctx->CpuIoPpi = (**mPS).CpuIo;
+
+ Status = PeiServicesLocatePpi (
+ &gPeiPciCfgPpiInServiceTableGuid2,
+ 0,
+ NULL,
+ (VOID **) &(pctx->PciCfgPpi)
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ Status = PeiServicesLocatePpi (
+ &gEfiPeiStallPpiGuid,
+ 0,
+ NULL,
+ (VOID **) &(pctx->PeiStall)
+ );
+
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Find TxtInfoHob by platfrom code
+ ///
+ Status = CreateTxtInfoHob (pctx);
+
+ if (Status == EFI_NOT_FOUND) {
+ DEBUG ((EFI_D_ERROR, "TXTPEI: TXT Info Hob not found.\n"));
+ return EFI_UNSUPPORTED;
+ }
+ ///
+ /// Print out the TxtInfo HOB if TXT_DEBUG_INFO is set
+ ///
+ DEBUG ((EFI_D_INFO, "TXTPEI: TxtInfoHob passed from platform as:\n"));
+ DEBUG ((EFI_D_INFO, "TXTPEI: ChipsetIsTxtCapable = %x\n", pctx->Hob->Data.ChipsetIsTxtCapable));
+ DEBUG ((EFI_D_INFO, "TXTPEI: TxtMode = %x\n", pctx->Hob->Data.TxtMode));
+ DEBUG ((EFI_D_INFO, "TXTPEI: PmBase = %x\n", pctx->Hob->Data.PmBase));
+ DEBUG ((EFI_D_INFO, "TXTPEI: SinitMemorySize = %x\n", pctx->Hob->Data.SinitMemorySize));
+ DEBUG ((EFI_D_INFO, "TXTPEI: TxtHeapMemorySize = %x\n", pctx->Hob->Data.TxtHeapMemorySize));
+ DEBUG ((EFI_D_INFO, "TXTPEI: TxtDprMemoryBase = %x\n", pctx->Hob->Data.TxtDprMemoryBase));
+ DEBUG ((EFI_D_INFO, "TXTPEI: TxtDprMemorySize = %x\n", pctx->Hob->Data.TxtDprMemorySize));
+ DEBUG ((EFI_D_INFO, "TXTPEI: BiosAcmBase = %x\n", pctx->Hob->Data.BiosAcmBase));
+ DEBUG ((EFI_D_INFO, "TXTPEI: BiosAcmSize = %x\n", pctx->Hob->Data.BiosAcmSize));
+ DEBUG ((EFI_D_INFO, "TXTPEI: McuUpdateDataAddr = %x\n", pctx->Hob->Data.McuUpdateDataAddr));
+ DEBUG ((EFI_D_INFO, "TXTPEI: SinitAcmBase = %x\n", pctx->Hob->Data.SinitAcmBase));
+ DEBUG ((EFI_D_INFO, "TXTPEI: SinitAcmSize = %x\n", pctx->Hob->Data.SinitAcmSize));
+ DEBUG ((EFI_D_INFO, "TXTPEI: TgaSize = %x\n", pctx->Hob->Data.TgaSize));
+ DEBUG ((EFI_D_INFO, "TXTPEI: TxtLcpPdBase = %x\n", pctx->Hob->Data.TxtLcpPdBase));
+ DEBUG ((EFI_D_INFO, "TXTPEI: TxtLcpPdSize = %x\n", pctx->Hob->Data.TxtLcpPdSize));
+ DEBUG ((EFI_D_INFO, "TXTPEI: Flags = %x\n", pctx->Hob->Data.Flags));
+
+ ///
+ /// Check if platform specify BIOS ACM addrss by itself, BIOS ACM address must be 4K alignment in FLASH address space
+ ///
+ if (pctx->Hob->Data.BiosAcmBase != 0) {
+ DEBUG ((EFI_D_INFO, "TXTPEI: Customized BIOS ACM location at %x\n", pctx->Hob->Data.BiosAcmBase));
+ ///
+ /// Check BIOS ACM is 4K alignment or not
+ ///
+ if ((pctx->Hob->Data.BiosAcmBase & 0xFFF) != 0) {
+ DEBUG ((EFI_D_ERROR, "TXTPEI: Customized BIOS ACM is not 4K aligned, force TxtMode=0 and unloaded!!\n"));
+ pctx->Hob->Data.TxtMode = 0;
+ return EFI_UNSUPPORTED;
+ }
+ ///
+ /// Get BIOS ACM base from TxtInfoHob provided by platform code
+ ///
+ pctx->BiosAcmBase = (ACM_HEADER *) (UINT32) pctx->Hob->Data.BiosAcmBase;
+ } else {
+ ///
+ /// Get BIOS ACM by seaching PEI firmware volume
+ ///
+ Status = FindBiosAcmInVolume (pctx, (UINT32 **) &pctx->BiosAcmBase);
+
+ ///
+ /// BIOS ACM not found, disable TXT and return EFI_UNLOAD_IMAGE
+ ///
+ if (((pctx->BiosAcmBase) == 0) || (Status == EFI_NOT_FOUND)) {
+ DEBUG ((EFI_D_ERROR, "TXTPEI: BIOS ACM not found, force TxtMode=0 and unloaded!\n"));
+ pctx->Hob->Data.TxtMode = 0;
+ return EFI_UNSUPPORTED;
+ }
+
+ DEBUG ((EFI_D_INFO, "TXTPEI: Found BIOS ACM location at %x\n", pctx->BiosAcmBase));
+
+ ///
+ /// Check BIOS ACM is 4K alignment, if not disable TXT and return EFI_UNLOAD_IMAGE
+ ///
+ if (((UINT32) pctx->BiosAcmBase & 0xFFF) != 0) {
+ DEBUG ((EFI_D_ERROR, "TXTPEI: BIOS ACM is not 4K aligned, force TxtMode=0 and unloaded!!\n"));
+ pctx->Hob->Data.TxtMode = 0;
+ return EFI_UNSUPPORTED;
+ }
+ }
+ ///
+ /// Check ACM is matched to chipset or not, if not, disable TXT and return EFI_UNLOAD_IMAGE
+ ///
+ if (!CheckTxtAcmMatch (pctx, pctx->BiosAcmBase)) {
+ DEBUG ((EFI_D_ERROR, "TXTPEI: BIOS ACM is not matched to chipset!! Force TxtMode=0 and unloaded!!\n"));
+ pctx->Hob->Data.TxtMode = 0;
+ return EFI_UNSUPPORTED;
+ }
+
+ pctx->BiosAcmSize = (pctx->BiosAcmBase->Size) << 2;
+
+ Status = FindApStartupInVolume (pctx, (UINT32 **) &(pctx->ApStartup));
+
+ if (Status == EFI_NOT_FOUND) {
+ DEBUG ((EFI_D_ERROR, "TXTPEI: AP Startup code not found.\n"));
+ pctx->Hob->Data.TxtMode = 0;
+ return EFI_UNSUPPORTED;
+ }
+
+ DEBUG ((EFI_D_INFO, "TXTPEI: Found AP init code at %x\n", pctx->ApStartup));
+
+ ///
+ /// Check if platform specify MCU addrss by itself
+ ///
+ if (pctx->Hob->Data.McuUpdateDataAddr != 0) {
+ DEBUG ((EFI_D_INFO, "Customized MCU location at %x\n", pctx->Hob->Data.McuUpdateDataAddr));
+ pctx->McuStart = (UINT32 *) (UINTN) pctx->Hob->Data.McuUpdateDataAddr;
+ } else {
+ ///
+ /// Find microcode update by searching PEI FV
+ ///
+ Status = FindMcuInVolume (pctx, (UINT32 **) &(pctx->McuStart));
+
+ if (Status == EFI_NOT_FOUND) {
+ DEBUG ((EFI_D_ERROR, "TXTPEI: MCU not found.\n"));
+ pctx->Hob->Data.TxtMode = 0;
+ return EFI_UNSUPPORTED;
+ }
+
+ DEBUG ((EFI_D_INFO, "TXTPEI: Found MCU at %x\n", pctx->McuStart));
+ }
+ ///
+ /// Initialize local APIC
+ ///
+ if ((((AsmReadMsr64 (MSR_IA32_APIC_BASE)) & (BIT11 + BIT10)) == BIT11 + BIT10)) {
+ AsmWriteMsr64 (EFI_MSR_EXT_XAPIC_SVR, 0x1FF);
+ } else {
+ ///
+ /// Determine address of Local APIC
+ ///
+ pctx->Ia32ApicBase = ((UINT32) AsmReadMsr64 (MSR_IA32_APIC_BASE)) & BASE_ADDR_MASK;
+ *(UINT32 *) (pctx->Ia32ApicBase + APIC_SPURIOUS_VECTOR_REGISTER) = 0x1FF;
+ }
+ ///
+ /// Initialize TxtInfoHob fields
+ ///
+ pctx->Hob->Data.BiosAcmBase = (UINTN) pctx->BiosAcmBase;
+ pctx->Hob->Data.BiosAcmSize = (UINTN) pctx->BiosAcmSize;
+ pctx->Hob->Data.McuUpdateDataAddr = (UINTN) pctx->McuStart;
+
+ ///
+ /// Make sure none of our pointers are still NULL
+ ///
+ if (!(pctx->PeiStall && pctx->BiosAcmBase && pctx->ApStartup && pctx->McuStart)) {
+ pctx->Hob->Data.TxtMode = 0;
+ return EFI_UNSUPPORTED;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Determines whether or not the current processor is TXT Capable.
+
+ @retval TRUE - If the current processor supports TXT
+ @retval FALSE - If the current processor does not support TXT
+**/
+BOOLEAN
+IsTxtProcessor (
+ VOID
+ )
+{
+ EFI_CPUID_REGISTER CpuidRegs;
+
+ AsmCpuid (1, &CpuidRegs.RegEax, &CpuidRegs.RegEbx, &CpuidRegs.RegEcx, &CpuidRegs.RegEdx);
+
+ return (CpuidRegs.RegEcx & B_CPUID_VERSION_INFO_ECX_SME) ? TRUE : FALSE;
+}
+
+/**
+ Determines whether or not the current chipset is TXT Capable.
+
+ @param[in] pctx - A pointer to an initialized TXT PEI Context data structure
+
+ @retval TRUE - If the current chipset supports TXT
+ @retval FALSE - If the current chipset doesn't supports TXT
+**/
+BOOLEAN
+IsTxtChipset (
+ IN TXT_PEI_LIB_CONTEXT *pctx
+ )
+{
+ BOOLEAN TxtCapable;
+ UINT32 Data32;
+
+ TxtCapable = FALSE;
+ Data32 = CheckSmxCapabilities();
+
+ if ((Data32 & BIT0) != 0) {
+ TxtCapable = TRUE;
+ DEBUG ((EFI_D_INFO, "Platform/PCH - TXT supported\n"));
+ } else {
+ TxtCapable = FALSE;
+ DEBUG ((EFI_D_INFO, "Platform/PCH - TXT not supported!!!\n"));
+ }
+
+ return TxtCapable;
+}
+
+/**
+ Determines whether TXT is enabled by platform setting
+
+ @param[in] pctx - A pointer to an initialized TXT PEI Context data structure
+
+ @retval TRUE - If TXT is enabled by platform setting
+ @retval FALSE - If TXT is disabled by platform setting
+**/
+BOOLEAN
+IsTxtEnabled (
+ IN TXT_PEI_LIB_CONTEXT *pctx
+ )
+{
+ if (pctx->Hob == 0) {
+ return FALSE;
+ }
+
+ return (BOOLEAN) (pctx->Hob->Data.TxtMode);
+}
+
+/**
+ Determines ACM is matched to chipset or not
+
+ @param[in] pctx - Point to TXT_PEI_LIB_CONTEXT structure
+ @param[in] BiosAcmBase - A pointer to BIOS ACM location
+
+ @retval TRUE - BIOS ACM is matched to chipset
+ @retval FALSE - BIOS ACM is NOT matched to chipset
+**/
+BOOLEAN
+CheckTxtAcmMatch (
+ IN TXT_PEI_LIB_CONTEXT *pctx,
+ IN ACM_HEADER *BiosAcmBase
+ )
+{
+ BOOLEAN ChipsetIsProduction;
+ BOOLEAN BiosAcmIsProduction;
+
+ if (BiosAcmBase == NULL) {
+ return FALSE;
+
+ }
+ ///
+ /// Initializing ChipsetIsProduction default value
+ ///
+ ChipsetIsProduction = (*(UINT32 *) (TXT_PUBLIC_BASE + 0x200) & BIT31) ? TRUE : FALSE;
+
+ ///
+ /// Check ACM is production or not
+ ///
+ BiosAcmIsProduction = (BiosAcmBase->ModuleID & BIT31) ? FALSE : TRUE;
+
+ return ChipsetIsProduction == BiosAcmIsProduction;
+}
+
+/**
+ Create TXT Info HOB
+
+ @param[in] pctx - A pointer to an initialized TXT PEI Context data structure
+
+ @retval EFI_SUCCESS - If TXT Info Hob is found
+ @retval EFI_NOT_FOUND - If TXT Info Hob is not found
+**/
+EFI_STATUS
+CreateTxtInfoHob (
+ IN TXT_PEI_LIB_CONTEXT *pctx
+ )
+{
+ EFI_STATUS Status;
+ PEI_CPU_PLATFORM_POLICY_PPI *CpuPlatformPolicy;
+ TXT_INFO_HOB *TxtInfoHob;
+
+ TxtInfoHob = NULL;
+
+ ///
+ /// Locate TPM Initialized Ppi to determine TPM is present and initialized properly.
+ ///
+ Status = PeiServicesLocatePpi (
+ &gPeiCpuPlatformPolicyPpiGuid,
+ 0,
+ NULL,
+ (VOID **) &CpuPlatformPolicy
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ ///
+ /// Create hob for storing TXT data
+ ///
+ Status = (*(pctx->PeiServices))->CreateHob (
+ pctx->PeiServices,
+ EFI_HOB_TYPE_GUID_EXTENSION,
+ sizeof (TXT_INFO_HOB),
+ (VOID **) &TxtInfoHob
+ );
+
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ pctx->Hob = TxtInfoHob;
+ TxtInfoHob->EfiHobGuidType.Name = gTxtInfoHobGuid;
+
+ ///
+ /// Initiate Txt Info Hob
+ ///
+ ZeroMem (&(TxtInfoHob->Data), sizeof (TXT_INFO_DATA));
+
+ TxtInfoHob->Data.ChipsetIsTxtCapable = IsTxtChipset (pctx);
+ if (CpuPlatformPolicy->CpuConfig->Txt == 1) {
+ TxtInfoHob->Data.TxtMode = 1;
+ }
+ TxtInfoHob->Data.PmBase = MmioRead32 (
+ MmPciAddress (0,
+ PCI_BUS_NUMBER_PCH_LPC,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_ACPI_BASE)
+ ) &~1;
+
+ TxtInfoHob->Data.SinitMemorySize = CpuPlatformPolicy->SecurityConfig->TxtConfig->SinitMemorySize;
+ TxtInfoHob->Data.TxtHeapMemorySize = CpuPlatformPolicy->SecurityConfig->TxtConfig->TxtHeapMemorySize;
+ TxtInfoHob->Data.TxtDprMemoryBase = CpuPlatformPolicy->SecurityConfig->TxtConfig->TxtDprMemoryBase;
+ TxtInfoHob->Data.TxtDprMemorySize = CpuPlatformPolicy->SecurityConfig->TxtConfig->TxtDprMemorySize;
+ TxtInfoHob->Data.BiosAcmBase = CpuPlatformPolicy->SecurityConfig->TxtConfig->BiosAcmBase;
+ TxtInfoHob->Data.BiosAcmSize = CpuPlatformPolicy->SecurityConfig->TxtConfig->BiosAcmSize;
+ TxtInfoHob->Data.McuUpdateDataAddr = CpuPlatformPolicy->SecurityConfig->TxtConfig->McuUpdateDataAddr;
+ TxtInfoHob->Data.TgaSize = CpuPlatformPolicy->SecurityConfig->TxtConfig->TgaSize;
+ TxtInfoHob->Data.TxtLcpPdBase = CpuPlatformPolicy->SecurityConfig->TxtConfig->TxtLcpPdBase;
+ TxtInfoHob->Data.TxtLcpPdSize = CpuPlatformPolicy->SecurityConfig->TxtConfig->TxtLcpPdSize;
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Determines whether or not the platform has executed an TXT launch by
+ examining the TPM Establishment bit.
+
+ @param[in] pctx - A pointer to an initialized TXT PEI Context data structure
+
+ @retval TRUE - If the TPM establishment bit is asserted.
+ @retval FALSE - If the TPM establishment bit is unasserted.
+**/
+BOOLEAN
+IsEstablishmentBitAsserted (
+ IN TXT_PEI_LIB_CONTEXT *pctx
+ )
+{
+ UINT8 Access;
+ UINT16 TimeOutCount;
+
+ ///
+ /// Set TPM.ACCESS polling timeout about 750ms
+ ///
+ TimeOutCount = TPM_TIME_OUT;
+ do {
+ ///
+ /// Read TPM status register
+ ///
+
+ Access = pctx->CpuIoPpi->MemRead8 (
+ pctx->PeiServices,
+ pctx->CpuIoPpi,
+ TPM_STATUS_REG_ADDRESS
+ );
+
+ ///
+ /// if TPM.Access == 0xFF, TPM is not present
+ ///
+ if (Access == 0xFF) {
+ return FALSE;
+ }
+ ///
+ /// Check tpmRegValidSts bit before checking establishment bit
+ ///
+ if (((pctx->PeiStall) != NULL) && ((Access & 0x80) != 0x80)) {
+ ///
+ /// Delay 1ms
+ ///
+ pctx->PeiStall->Stall (pctx->PeiServices, pctx->PeiStall, 1000);
+ } else {
+ ///
+ /// tpmRegValidSts set, we can check establishment bit now.
+ ///
+ break;
+ }
+
+ TimeOutCount--;
+ } while (TimeOutCount != 0);
+ ///
+ /// if tpmRegValidSts is not set, TPM is not usable
+ ///
+ if ((Access & 0x80) != 0x80) {
+ DEBUG ((EFI_D_ERROR, "TXTPEI: TPM Valid Status is not set!! TPM.ACCESS=%x\n", Access));
+ ASSERT (TRUE);
+ EFI_DEADLOOP ();
+ }
+ ///
+ /// The bit we're interested in uses negative logic:
+ /// If bit 0 == 1 then return False
+ /// Else return True
+ ///
+ return (Access & 0x1) ? FALSE : TRUE;
+}
+
+/**
+ Determines whether or not the platform has encountered an error during
+ a sleep or power-off state.
+
+ @param[in] pctx - A pointer to an initialized TXT PEI Context data structure
+
+ @retval TRUE - If the TXT_WAKE_ERROR bit is asserted.
+ @retval FALSE - If the TXT_WAKE_ERROR bit is unasserted.
+**/
+BOOLEAN
+IsTxtWakeError (
+ IN TXT_PEI_LIB_CONTEXT *pctx
+ )
+{
+ UINT8 Ests;
+
+ ///
+ /// Read TXT.ESTS register
+ ///
+ Ests = pctx->CpuIoPpi->MemRead8 (
+ pctx->PeiServices,
+ pctx->CpuIoPpi,
+ TXT_PUBLIC_BASE + TXT_ERROR_STATUS_REG_OFF
+ );
+
+ DEBUG ((EFI_D_INFO, "TXTPEI: TXT.ESTS=%x\n", Ests));
+
+ return (Ests & (0x1 << 6)) ? TRUE : FALSE;
+}
+
+/**
+ Determines whether or not the platform memory has been locked
+
+ @param[in] pctx - A pointer to an initialized TXT PEI Context data structure
+
+ @retval TRUE - If memroy is locked
+ @retval FALSE - If memory is unlocked
+**/
+BOOLEAN
+IsMemoryLocked (
+ IN TXT_PEI_LIB_CONTEXT *pctx
+ )
+{
+ UINT32 CpuMemLockStatus;
+
+ ///
+ /// Check status register for now.
+ ///
+ CpuMemLockStatus = pctx->CpuIoPpi->MemRead32 (
+ pctx->PeiServices,
+ pctx->CpuIoPpi,
+ TXT_PUBLIC_BASE + TXT_E2STS_REG_OFF
+ );
+
+ DEBUG ((EFI_D_INFO, "TXTPEI: CPU_UNCORE_MEMLOCK_STATUS=%x\n", CpuMemLockStatus));
+ ///
+ /// if BLOCK_MEM_STS (BIT2) is set to 1, memory is in unlock.
+ ///
+ return (CpuMemLockStatus & TXT_BLOCK_MEM_STS) ? TRUE : FALSE;
+}
+
+/**
+ Determines whether or not POISON bit is set in status register
+
+ @param[in] pctx - A pointer to an initialized TXT PEI Context data structure
+
+ @retval TRUE - If the TXT_WAKE_ERROR bit is asserted.
+ @retval FALSE - If the TXT_WAKE_ERROR bit is unasserted.
+**/
+BOOLEAN
+IsTxtResetSet (
+ IN TXT_PEI_LIB_CONTEXT *pctx
+ )
+{
+ UINT8 Ests;
+
+ ///
+ /// Read TXT.ESTS register
+ ///
+ Ests = pctx->CpuIoPpi->MemRead8 (
+ pctx->PeiServices,
+ pctx->CpuIoPpi,
+ TXT_PUBLIC_BASE + TXT_ERROR_STATUS_REG_OFF
+ );
+
+ return (Ests & (0x1 << 0)) ? TRUE : FALSE;
+}
+
+/**
+ Determines whether or not SECRETS.STS bit is set in E2STS status register
+
+ @param[in] pctx - A pointer to an initialized TXT PEI Context data structure
+
+ @retval TRUE - If the LT.SECRETS.STS bit is asserted.
+ @retval FALSE - If the LT.SECRETS.STS bit is unasserted.
+**/
+BOOLEAN
+IsTxtSecretsSet (
+ IN TXT_PEI_LIB_CONTEXT *pctx
+ )
+{
+ UINT8 E2sts;
+
+ ///
+ /// Read TXT.E2STS register
+ ///
+ E2sts = pctx->CpuIoPpi->MemRead8 (
+ pctx->PeiServices,
+ pctx->CpuIoPpi,
+ TXT_PUBLIC_BASE + TXT_E2STS_REG_OFF
+ );
+
+ return (E2sts & TXT_SECRETS_STS) ? TRUE : FALSE;
+}
+
+/**
+ Determines presence of TPM in system
+
+ @param[in] pctx - Point to TXT_PEI_LIB_CONTEXT structure
+ @param[in] TxtPeiCtx - A pointer to an initialized TXT PEI Context data structure
+
+ @retval EFI_SUCCESS - If the TPM is present.
+ @retval EFI_NOT_FOUND - If the TPM is not present.
+**/
+EFI_STATUS
+IsTpmPresent (
+ IN TXT_PEI_LIB_CONTEXT *pctx
+ )
+{
+ EFI_STATUS Status;
+ VOID *TpmInitialize;
+
+ ///
+ /// Locate TPM Initialized Ppi to determine TPM is present and initialized properly.
+ ///
+ Status = PeiServicesLocatePpi (
+ &gPeiTpmInitializedPpiGuid,
+ 0,
+ NULL,
+ &TpmInitialize
+ );
+ if (EFI_ERROR (Status)) {
+ ///
+ /// TPM initiated failed
+ ///
+ pctx->Hob->Data.Flags |= TPM_INIT_FAILED;
+ }
+
+ return Status;
+}
+
+/**
+ Clear Sleep Type register.
+
+ @param[in] pctx - A pointer to an initialized TXT PEI Context data structure
+
+ @retval EFI_SUCCESS - Always
+**/
+EFI_STATUS
+ClearSlpTyp (
+ IN TXT_PEI_LIB_CONTEXT *pctx
+ )
+{
+ UINT32 Pm1Addr;
+ UINT32 Pm1Value;
+
+ ///
+ /// Make address for PM1_CNT
+ ///
+ Pm1Addr = ((UINT32) pctx->Hob->Data.PmBase) + 4;
+
+ ///
+ /// Read 32-bits from PM1_CNT
+ ///
+ Pm1Value = IoRead32 ((UINTN) Pm1Addr);
+
+ ///
+ /// Clear SLP_TYP bits 10-12
+ ///
+ Pm1Value = Pm1Value & 0xffffe3ff;
+ IoWrite32 (
+ (UINTN) Pm1Addr,
+ (UINT32) (Pm1Value)
+ );
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Searches PEI firemare volume (FV_BB) for file containig BIOS ACM.
+
+ @param[in] pctx - A pointer to an initialized TXT PEI Context data structure
+ @param[in] BiosAcBase - A pointer to pointer to variable to hold found address
+
+ @retval EFI_SUCCESS - If address has been found
+ @retval EFI_NOT_FOUND - If address has not been found
+**/
+EFI_STATUS
+FindBiosAcmInVolume (
+ IN TXT_PEI_LIB_CONTEXT *pctx,
+ OUT UINT32 **BiosAcBase
+ )
+{
+ EFI_STATUS Status;
+
+ Status = FindModuleInFlash (pctx, &mTxtBiosAcmPeiFileGuid, BiosAcBase);
+
+ ///
+ /// If BIOS ACM is not found - don't hang system. Assume that TXT
+ /// must be disabled.
+ ///
+ if (EFI_ERROR (Status)) {
+ return EFI_NOT_FOUND;
+ }
+
+ ASSERT (((((UINT32) (*BiosAcBase)) & 0xFFF) == 0) ? TRUE : FALSE);
+
+ return EFI_SUCCESS;
+
+}
+
+/**
+ Searches PEI firmware volume (FV_BB) for file containig AP Startup code
+
+ @param[in] pctx - A pointer to an initialized TXT PEI Context data structure
+ @param[in] ApStartupBase - A pointer to pointer to variable to hold address
+
+ @retval EFI_SUCCESS - If address has been found
+ @retval EFI_NOT_FOUND - If address has not been found
+**/
+EFI_STATUS
+FindApStartupInVolume (
+ IN TXT_PEI_LIB_CONTEXT *pctx,
+ OUT UINT32 **ApStartupBase
+ )
+{
+ EFI_STATUS Status;
+ EFI_GUID PeiBiosApStartupFileGuid;
+ BOOLEAN GoodPlacement;
+
+ PeiBiosApStartupFileGuid = mTxtApStartupPeiFileGuid;
+ Status = FindModuleInFlash (pctx, &PeiBiosApStartupFileGuid, ApStartupBase);
+ ///
+ /// If AP Startup code is not found - don't hang system. Assume that TXT
+ /// must be disabled.
+ ///
+ if (EFI_ERROR (Status)) {
+ return EFI_NOT_FOUND;
+ }
+
+ ASSERT (((((UINT32) (*ApStartupBase)) & 0xFFF) == 0) ? TRUE : FALSE);
+
+ GoodPlacement = (BOOLEAN) (((UINT32) (*ApStartupBase) >= 0xFFFE0000) && ((UINT32) (*ApStartupBase) <= 0xFFFFF000));
+
+ ASSERT (GoodPlacement);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Searches PEI firmware volume (FV_BB) for offset of currently loaded MCU patch
+
+ @param[in] pctx - A pointer to an initialized TXT PEI Context data structure
+ @param[in] McuBase - A pointer to pointer to variable to hold found offset
+ @param[in] address.
+
+ @retval EFI_SUCCESS - If address has been found
+ @retval EFI_NOT_FOUND - If address has not been found
+**/
+EFI_STATUS
+FindMcuInVolume (
+ IN TXT_PEI_LIB_CONTEXT *pctx,
+ OUT UINT32 **McuBase
+ )
+{
+ EFI_STATUS Status;
+ EFI_GUID MicrocodeGuid;
+ MSR_REGISTER Reg;
+ UINT32 PlatformId;
+ UINT32 McuRevision;
+ EFI_CPUID_REGISTER CpuidRegs;
+ MCU *McuAddr;
+ UINT8 *i;
+ UINT8 *j;
+ UINT8 *b;
+ UINT32 c;
+ //(AMI_CHG+)>
+ UINT32 MicroCodeFfsMaxSize;
+ EFI_FFS_FILE_HEADER *MicroCodeFfs;
+ UINT8 *McuFfsAddress;
+ MicroCodeFfs = NULL;
+ //<(AMI_CHG+)
+ McuAddr = NULL;
+
+ McuRevision = 0;
+ MicrocodeGuid = mCpuMicrocodeFileGuid;
+ Status = FindModuleInFlash (pctx, &MicrocodeGuid, (UINT32 **) &McuAddr);
+ ///
+ /// If MCU update is not found - don't hang system. Assume that TXT
+ /// must be disabled.
+ ///
+ if (EFI_ERROR (Status)) {
+ return EFI_NOT_FOUND;
+ }
+ //(AMI_CHG+)>
+ McuFfsAddress = (UINT8 *) McuAddr;
+ MicroCodeFfs = (EFI_FFS_FILE_HEADER *)(McuFfsAddress - sizeof (EFI_FFS_FILE_HEADER));
+ MicroCodeFfsMaxSize = (UINT32)MicroCodeFfs->Size[2]*0x10000 + (UINT32)MicroCodeFfs->Size[1]*0x100 + (UINT32)MicroCodeFfs->Size[0];
+ DEBUG ((EFI_D_ERROR, "TXTPEI: MicroCodeFfsMaxSize = %X\n", MicroCodeFfsMaxSize));
+ //<(AMI_CHG+)
+ ///
+ /// MCU base address has been found. Find exact address of MCU
+ /// loaded in BSP
+ ///
+ Reg.Qword = AsmReadMsr64 (MSR_IA32_PLATFORM_ID);
+ PlatformId = (Reg.Dwords.High >> (PLATFORM_ID_SHIFT - 32)) & PLATFORM_ID_MASK;
+
+ AsmWriteMsr64 (MSR_IA32_BIOS_SIGN_ID, 0);
+
+ AsmCpuid (1, &CpuidRegs.RegEax, &CpuidRegs.RegEbx, &CpuidRegs.RegEcx, &CpuidRegs.RegEdx);
+
+ Reg.Qword = AsmReadMsr64 (MSR_IA32_BIOS_SIGN_ID);
+
+ McuRevision = Reg.Dwords.High;
+
+ ///
+ /// if BSP MCU is not loaded before. Return EFI_NOT_FOUND
+ /// This is pre-requisit.
+ ///
+ if (McuRevision == 0) {
+ DEBUG ((EFI_D_ERROR, "TXTPEI: BSP microcode is not loaded!! TXT aborted!\n"));
+ return EFI_NOT_FOUND;
+ }
+ //(AMI_CHG+)>
+ //for (i = (UINT8 *) McuAddr; i < ((UINT8 *) McuAddr) + 0x10000; i = i + 0x400) {
+ for (i = (UINT8 *) McuAddr; i < ((UINT8 *) McuAddr) + MicroCodeFfsMaxSize; i = i + 0x400) {
+ //<(AMI_CHG+)
+ if (((MCU *) i)->revision != McuRevision) {
+ continue;
+ }
+
+ if (!(((MCU *) i)->procFlags & (UINT32) LShiftU64 (1, PlatformId))) {
+ continue;
+ }
+
+ if ((((MCU *) i)->signature) == CpuidRegs.RegEax) {
+ *McuBase = (UINT32 *) i;
+ return EFI_SUCCESS;
+ }
+
+ if ((((MCU *) i)->dataSize) == 0) {
+ continue;
+ }
+
+ if ((((MCU *) i)->dataSize + sizeof (MCU)) >= (((MCU *) i)->totalSize)) {
+ continue;
+ }
+ ///
+ /// Extended signature table exists.
+ ///
+ b = i + (((MCU *) i)->dataSize);
+ ///
+ /// Base of EST table
+ ///
+ c = ((EST *) b)->count;
+ ///
+ /// Count of entries
+ ///
+ b += sizeof (EST);
+ ///
+ /// Base of PSS table entries
+ ///
+ for (j = b; j < b + (c * sizeof (PSS)); j = j + sizeof (PSS)) {
+ if ((((PSS *) j)->signature) == CpuidRegs.RegEax) {
+ *McuBase = (UINT32 *) i;
+ return EFI_SUCCESS;
+ }
+ }
+
+ continue;
+ }
+
+ return EFI_NOT_FOUND;
+}
+
+/**
+ Searches PEI firmware volume (FV_BB) for the file with specified GUID through pGuid
+
+ @param[in] pctx - A pointer to an initialized TXT PEI Context data structure
+ @param[in] Guid - A pointer GUID
+ @param[in] Module - A pointer to pointer to variable to hold address
+
+ @retval EFI_SUCCESS - If address has been found
+ @retval EFI ERROR - If address has not been found
+**/
+EFI_STATUS
+FindModuleInFlash (
+ IN TXT_PEI_LIB_CONTEXT *pctx,
+ IN EFI_GUID *Guid,
+ OUT UINT32 **Module
+ )
+{
+ EFI_FIRMWARE_VOLUME_HEADER *FvHeader;
+ EFI_FFS_FILE_HEADER *FfsFile;
+ EFI_STATUS Status;
+ UINTN Instance;
+
+ Instance = BFV;
+
+ while (TRUE) {
+ Status = (*(pctx->PeiServices))->FfsFindNextVolume (pctx->PeiServices, Instance, &FvHeader);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ FfsFile = NULL;
+ ///
+ /// Start new search in volume
+ ///
+ while (TRUE) {
+ Status = (*(pctx->PeiServices))->FfsFindNextFile (pctx->PeiServices, EFI_FV_FILETYPE_RAW, FvHeader, &FfsFile);
+ if (Status == EFI_NOT_FOUND) {
+ break;
+ }
+
+ if (CompareGuid (&(FfsFile->Name), Guid)) {
+ *Module = (UINT32 *) ((UINT8 *) FfsFile + sizeof (EFI_FFS_FILE_HEADER));
+ return EFI_SUCCESS;
+ }
+ }
+
+ Instance += 1;
+ }
+}
+
+/**
+ Initializes values passed to AP
+
+ @param[in] pctx - A pointer to an initialized TXT PEI Context data structure
+**/
+VOID
+PrepareApParams (
+ IN TXT_PEI_LIB_CONTEXT *pctx
+ )
+{
+ UINT32 TxtPublicSpace;
+
+ TxtPublicSpace = TXT_PUBLIC_BASE;
+
+ *(UINT32 *) (TxtPublicSpace + BIOACM_ADDR) = (UINT32) (pctx->BiosAcmBase);
+
+ *(UINT32 *) (TxtPublicSpace + MCU_BASE_ADDR) = (UINT32) (pctx->McuStart);
+
+ *(UINT32 *) (TxtPublicSpace + APINIT_ADDR) = (UINT32) (pctx->ApStartup);
+
+ *(UINT32 *) (TxtPublicSpace + SEMAPHORE) = 0;
+
+}
+
+/**
+ Returns CPU count
+
+ @retval Number of CPUs
+**/
+UINT32
+GetCpuCount (
+ VOID
+ )
+{
+ EFI_CPUID_REGISTER CpuidRegs;
+ AsmCpuid (1, &CpuidRegs.RegEax, &CpuidRegs.RegEbx, &CpuidRegs.RegEcx, &CpuidRegs.RegEdx);
+ return CpuidRegs.RegEbx >> 16;
+}
+
+/**
+ Invokes the SCLEAN function from the TXT BIOS ACM.
+ 1. Clearing of sleep type is necessary because SCLEAN destroys memory
+ context, so S3 after it is run and system is reset is impossible. We
+ do it here since there is no any indication that can sustain reset
+ for any other module to do it on our behalf.
+ 2. APs are initialized before calling of SCLEAN
+ 3. SCLEAN function is invoked.
+
+ @param[in] pctx - A pointer to an initialized TXT PEI Context data structure
+
+ @retval EFI_SUCCESS - Always.
+**/
+EFI_STATUS
+DoSclean (
+ IN TXT_PEI_LIB_CONTEXT *pctx
+ )
+{
+ ClearSlpTyp (pctx);
+
+ PrepareApParams (pctx);
+#ifdef BOOT_GUARD_SUPPORT_FLAG
+#if BOOT_GUARD_SUPPORT_FLAG == 1
+ //
+ // Disable PBET before send IPI to APs
+ //
+ StopPbeTimer ();
+#endif
+#endif
+
+ LaunchBiosAcmSclean ();
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Unlock memory when security is set and TxT is not enabled
+
+ @param[in] pctx - A pointer to an initialized TXT PEI Context data structure
+
+ @retval EFI_SUCCESS - Complete memory unlock
+ @exception EFI_UNSUPPORTED - CPU doesn't support TxT.
+**/
+EFI_STATUS
+UnlockMemory (
+ IN TXT_PEI_LIB_CONTEXT *pctx
+ )
+{
+ BOOLEAN EstablishmentBitAsserted;
+
+ EstablishmentBitAsserted = IsEstablishmentBitAsserted (pctx);
+
+ ///
+ /// Need to read FED40000 before unlocking memory
+ ///
+ if (!EstablishmentBitAsserted) {
+ DEBUG ((EFI_D_INFO, "TXTPEI::Unlock memory\n"));
+ AsmWriteMsr64 (0x2e6, 0);
+ } else {
+ ///
+ /// Lunch SCLEAN if wake error bit is set.
+ ///
+ if (IsTxtWakeError (pctx)) {
+ ///
+ /// If TXTRESET is set , we must clean TXTRESET bit otherwise SCLEAN
+ /// will fail
+ ///
+ if (IsTxtResetSet (pctx)) {
+ DoGlobalReset ();
+ }
+
+ if ((pctx->BiosAcmBase == 0) || (pctx->ApStartup == 0) || (pctx->McuStart == 0)) {
+ return EFI_UNSUPPORTED;
+ }
+ ///
+ /// Setup and Launch SCLEAN
+ ///
+ DEBUG ((EFI_D_INFO, "TXTPEI::Entering SCLEAN to unlock memory\n"));
+ DoSclean (pctx);
+
+ ///
+ /// Reset platform - performed by DoSclean, should not return to execute the following dead looping
+ ///
+ EFI_DEADLOOP ();
+ } else {
+ return EFI_UNSUPPORTED;
+ }
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/Haswell/Txt/TxtInit/Pei/TxtPeiLib.h b/ReferenceCode/Haswell/Txt/TxtInit/Pei/TxtPeiLib.h
new file mode 100644
index 0000000..28c1303
--- /dev/null
+++ b/ReferenceCode/Haswell/Txt/TxtInit/Pei/TxtPeiLib.h
@@ -0,0 +1,560 @@
+/** @file
+ This file contains function definitions that can determine
+ the TXT capabilities of a platform during PEI and perform
+ certain specific platform tasks that are required for TXT
+ during PEI.
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#ifndef _TXT_PEI_LIB_H_
+#define _TXT_PEI_LIB_H_
+
+
+///
+/// External include files do NOT need to be explicitly specified in real EDKII
+/// environment
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#include "Txt.h"
+#include "CpuAccess.h"
+#include "BootGuardLibrary.h"
+
+#include EFI_PPI_DEPENDENCY (Variable)
+#include EFI_PPI_DEPENDENCY (Stall)
+#include EFI_PPI_DEFINITION (TxtMemoryUnlocked)
+#include EFI_GUID_DEFINITION (TxtInfoHob)
+#include EFI_PPI_PRODUCER (CpuPlatformPolicy)
+#endif
+#include EFI_PPI_CONSUMER (TpmInitialized)
+
+#define RESET_PORT 0x0CF9
+#define FULL_RESET_VALUE 0xE
+
+#define PCI_BUS_NUMBER_PCH_LPC 0
+#define PCI_DEVICE_NUMBER_PCH_LPC 31
+#define PCI_FUNCTION_NUMBER_PCH_LPC 0
+#define R_PCH_LPC_ACPI_BASE 0x40
+
+#define APIC_SPURIOUS_VECTOR_REGISTER 0xF0
+#define DEST_FIELD (0 << 18)
+#define ALL_EXCLUDING_SELF BIT19 + BIT18
+#define SIPI BIT10 + BIT9
+#define INIT BIT10 + BIT8
+#define LEVEL_ASSERT BIT14
+#define LEVEL_DEASSERT (0 << 14)
+#define DELIVERY_STATUS BIT13
+#define BASE_ADDR_MASK 0xFFFFF000
+///
+/// #define EFI_MSR_EXT_XAPIC_LVT_THERM 0x833
+///
+#define EFI_MSR_EXT_XAPIC_SVR 0x80F
+#define AP_STARTUP_SIZE 0x1000
+#define AP_STARTUP_ADDR 0x1000
+#define AP_STARTUP_STKOFF AP_STARTUP_ADDR + 0xFF0
+
+#define BFV 0 ///< Boot Firmware Voume
+#define PCI_CMD 0x0004 ///< PCI Command Register
+#define BM_BIT 0x4 ///< Bus Master bit
+#define PCI_SCC 0x000A ///< Sub Class Code Register
+#define PCI_HDR 0x000E ///< Header Type Register
+#define MF_BIT 0x80 ///< Multi-function bit
+///
+/// Machne check architecture MSR registers
+///
+#define MCG_CAP 0x179
+#define MCG_STATUS 0x17A
+#define MCG_CTL 0x17B
+#define MC0_CTL 0x400
+#define MC0_STATUS 0x401
+#define MC0_ADDR 0x402
+#define MC0_MISC 0x403
+
+typedef struct _ACM_HEADER {
+ UINT32 ModuleType; ///< Module type
+ UINT32 HeaderLen; ///< 4 4 Header length (in multiples of four bytes)
+ /// (161 for version 0.0)
+ ///
+ UINT32 HeaderVersion; ///< 8 4 Module format version
+ UINT32 ModuleID; ///< 12 4 Module release identifier
+ UINT32 ModuleVendor; ///< 16 4 Module vendor identifier
+ UINT32 Date; ///< 20 4 Creation date (BCD format:
+ /// year.month.day)
+ ///
+ UINT32 Size; ///< 24 4 Module size (in multiples of four bytes)
+ UINT32 Reserved1; ///< 28 4 Reserved for future extensions
+ UINT32 CodeControl; ///< 32 4 Authenticated code control flags
+ UINT32 ErrorEntryPoint; ///< 36 4 Error response entry point offset (bytes)
+ UINT32 GDTLimit; ///< 40 4 GDT limit (defines last byte of GDT)
+ UINT32 GDTBasePtr; ///< 44 4 GDT base pointer offset (bytes)
+ UINT32 SegSel; ///< 48 4 Segment selector initializer
+ UINT32 EntryPoint; ///< 52 4 Authenticated code entry point offset (bytes)
+ UINT32 Reserved2; ///< 56 64 Reserved for future extensions
+ UINT32 KeySize; ///< 120 4 Module public key size less the exponent
+ /// (in multiples of four bytes
+ /// - 64 for version 0.0)
+ ///
+ UINT32 ScratchSize; ///< 124 4 Scratch field size (in multiples of four bytes)
+ /// (2 * KeySize + 15 for version 0.0)
+ ///
+ UINT8 RSAPubKey[65 * 4]; ///< 128 KeySize * 4 + 4 Module public key
+ UINT8 RSASig[256]; ///< 388 256 PKCS #1.5 RSA Signature.
+} ACM_HEADER;
+
+typedef struct _TXT_PEI_LIB_CONTEXT {
+ EFI_PEI_SERVICES **PeiServices;
+ PEI_CPU_IO_PPI *CpuIoPpi;
+ PEI_PCI_CFG_PPI *PciCfgPpi;
+ PEI_STALL_PPI *PeiStall;
+ ACM_HEADER *BiosAcmBase;
+ UINT32 BiosAcmSize;
+ VOID *ApStartup;
+ UINT32 *McuStart;
+ UINT32 Ia32ApicBase;
+ TXT_INFO_HOB *Hob;
+} TXT_PEI_LIB_CONTEXT;
+
+#pragma pack(1)
+typedef union _MSR_REGISTER {
+ UINT64 Qword;
+
+ struct _DWORDS {
+ UINT32 Low;
+ UINT32 High;
+ } Dwords;
+
+ struct _BYTES {
+ UINT8 FirstByte;
+ UINT8 SecondByte;
+ UINT8 ThirdByte;
+ UINT8 FouthByte;
+ UINT8 FifthByte;
+ UINT8 SixthByte;
+ UINT8 SeventhByte;
+ UINT8 EighthByte;
+ } Bytes;
+
+} MSR_REGISTER;
+
+
+#pragma pack()
+
+#define PLATFORM_ID_SHIFT 50
+#define PLATFORM_ID_MASK 7 ///< Bits 52:50
+typedef struct _MCU {
+ UINT32 headerVer; ///< MCU Header Version ( = 00000001h )
+ UINT32 revision; ///< MCU Revision
+ UINT32 date; ///< MCU Date
+ UINT32 signature; ///< MCU Processor Signature
+ UINT32 checksum; ///< MCU Main checksum
+ UINT32 loaderRev; ///< MCU Loader Revision
+ UINT32 procFlags; ///< MCU Processor Flags (Platform ID)
+ UINT32 dataSize; ///< MCU Data Size
+ UINT32 totalSize; ///< MCU Total Size
+ UINT32 reserved[3];
+} MCU;
+
+typedef struct _EST {
+ UINT32 count; ///< EST Count
+ UINT32 checksum; ///< EST Checksum
+ UINT32 reserved[3];
+} EST;
+
+typedef struct _PSS {
+ UINT32 signature; ///< PSS Processor Signature
+ UINT32 procFlags; ///< PSS Processor Flags (Platform ID)
+ UINT32 checksum; ///< PSS Checksum
+} PSS;
+
+/**
+ Returns CPU count
+
+ @retval Number of CPUs
+**/
+UINT32
+GetCpuCount (
+ VOID
+ );
+
+/**
+ Execute SCLEAN through BIOS ACM
+**/
+VOID
+LaunchBiosAcmSclean (
+ VOID
+ );
+
+/**
+ Issue a global reset through PCH and PORTCF9
+**/
+VOID
+DoGlobalReset (
+ VOID
+ );
+
+/**
+ Issue a cpu-only reset through PCH and PORTCF9
+**/
+VOID
+DoCpuReset (
+ VOID
+ );
+
+/**
+ Issue a HOST reset through PCH and PORTCF9
+**/
+VOID
+DoHostReset (
+ VOID
+ );
+
+/**
+ Dispatch APs to execute *Function with parameter pointed by *Param
+
+ @param[in] (*Function) - Address of Function to be executed by APs
+ @param[in] Param - Function parameter to be passed to
+**/
+VOID
+StartupAllAPs (
+ VOID (*Function)(),
+ UINT64 *Param
+ );
+
+/**
+ Put All APs into Wait-for-SIPI state
+**/
+VOID
+PutApsInWfs (
+ VOID
+ );
+
+/**
+ Restore MTRR registers
+
+ @param[in] ApCfg - Point to the MTRR buffer
+**/
+VOID
+RestoreMtrrProgramming (
+ UINT64 *ApCfg
+ );
+
+/**
+ Restore APs' registers
+
+ @param[in] ApCfg - Point to APs' registers buffer
+**/
+VOID
+RestoreApConfig (
+ UINT64 *ApCfg
+ );
+
+/**
+ Initializes values passed to AP
+
+ @param[in] pctx - A pointer to an initialized TXT PEI Context data structure
+**/
+VOID
+PrepareApParams (
+ TXT_PEI_LIB_CONTEXT *pctx
+ );
+
+/**
+ This routine initializes and collects all PPIs and data required
+ by the routines in this file.
+
+ @param[in] pctx - A pointer to an initialized TXT PEI Context data structure
+ @param[in] mPS - A pointer to the PEI Service Table
+
+ @exception EFI_UNSUPPORTED - If any of the required PPIs or data are unavailable
+ @retval EFI_SUCCESS - In all cases not listed above
+**/
+EFI_STATUS
+InitializeTxtPeiLib (
+ TXT_PEI_LIB_CONTEXT *pctx,
+ IN EFI_PEI_SERVICES **mPS
+ );
+
+/**
+ Determines whether or not the current processor is TXT Capable.
+
+ @retval TRUE - If the current processor supports TXT
+ @retval FALSE - If the current processor does not support TXT
+**/
+BOOLEAN
+IsTxtProcessor (
+ VOID
+ );
+
+/**
+ Determines whether or not the current chipset is TXT Capable.
+
+ @param[in] pctx - A pointer to an initialized TXT PEI Context data structure
+
+ @retval TRUE - If the current chipset supports TXT
+ @retval FALSE - If the current chipset doesn't supports TXT
+**/
+BOOLEAN
+IsTxtChipset (
+ TXT_PEI_LIB_CONTEXT *pctx
+ );
+
+/**
+ Determines whether or not POISON bit is set in status register
+
+ @param[in] pctx - A pointer to an initialized TXT PEI Context data structure
+
+ @retval TRUE - If the TXT_WAKE_ERROR bit is asserted.
+ @retval FALSE - If the TXT_WAKE_ERROR bit is unasserted.
+**/
+BOOLEAN
+IsTxtResetSet (
+ TXT_PEI_LIB_CONTEXT *pctx
+ );
+
+/**
+ Determines whether or not SECRETS.STS bit is set in E2STS status register
+
+ @param[in] pctx - A pointer to an initialized TXT PEI Context data structure
+
+ @retval TRUE - If the LT.SECRETS.STS bit is asserted.
+ @retval FALSE - If the LT.SECRETS.STS bit is unasserted.
+**/
+BOOLEAN
+IsTxtSecretsSet (
+ TXT_PEI_LIB_CONTEXT *pctx
+ );
+
+/**
+ Determines whether or not the platform has executed an TXT launch by
+ examining the TPM Establishment bit.
+
+ @param[in] pctx - A pointer to an initialized TXT PEI Context data structure
+
+ @retval TRUE - If the TPM establishment bit is asserted.
+ @retval FALSE - If the TPM establishment bit is unasserted.
+**/
+BOOLEAN
+IsEstablishmentBitAsserted (
+ IN TXT_PEI_LIB_CONTEXT *pctx
+ );
+
+/**
+ Determines whether or not the platform has encountered an error during
+ a sleep or power-off state.
+
+ @param[in] pctx - A pointer to an initialized TXT PEI Context data structure
+
+ @retval TRUE - If the TXT_WAKE_ERROR bit is asserted.
+ @retval FALSE - If the TXT_WAKE_ERROR bit is unasserted.
+**/
+BOOLEAN
+IsTxtWakeError (
+ TXT_PEI_LIB_CONTEXT *pctx
+ );
+
+/**
+ Determines whether or not the platform memory has been locked
+
+ @param[in] pctx - A pointer to an initialized TXT PEI Context data structure
+
+ @retval TRUE - If memroy is locked
+ @retval FALSE - If memory is unlocked
+**/
+BOOLEAN
+IsMemoryLocked (
+ TXT_PEI_LIB_CONTEXT *pctx
+ );
+
+/**
+ @param[in] pctx - A pointer to an initialized TXT PEI Context data structure
+
+ @retval TRUE - If TXT is enabled by platform setting
+ @retval FALSE - If TXT is disabled by platform setting
+**/
+BOOLEAN
+IsTxtEnabled (
+ TXT_PEI_LIB_CONTEXT *pctx
+ );
+
+/**
+ Determines ACM is matched to chipset or not
+
+ @param[in] pctx - Point to TXT_PEI_LIB_CONTEXT structure
+ @param[in] BiosAcmBase - A pointer to BIOS ACM location
+
+ @retval TRUE - BIOS ACM is matched to chipset
+ @retval FALSE - BIOS ACM is NOT matched to chipset
+**/
+BOOLEAN
+CheckTxtAcmMatch (
+ TXT_PEI_LIB_CONTEXT *pctx,
+ ACM_HEADER *BiosAcmBase
+ );
+
+/**
+ Clear Sleep Type register.
+
+ @param[in] pctx - A pointer to an initialized TXT PEI Context data structure
+
+ @retval EFI_SUCCESS - Always
+**/
+EFI_STATUS
+ClearSlpTyp (
+ TXT_PEI_LIB_CONTEXT *pctx
+ );
+
+/**
+ Invokes the SCLEAN function from the TXT BIOS ACM.
+ 1. Clearing of sleep type is necessary because SCLEAN destroys memory
+ context, so S3 after it is run and system is reset is impossible. We
+ do it here since there is no any indication that can sustain reset
+ for any other module to do it on our behalf.
+ 2. APs are initialized before calling of SCLEAN
+ 3. SCLEAN function is invoked.
+
+ @param[in] pctx - A pointer to an initialized TXT PEI Context data structure
+
+ @retval EFI_SUCCESS - Always.
+**/
+
+EFI_STATUS
+DoSclean (
+ TXT_PEI_LIB_CONTEXT *pctx
+ );
+
+/**
+ Determines presence of TPM in system
+
+ @param[in] pctx - Point to TXT_PEI_LIB_CONTEXT structure
+
+ @retval EFI_SUCCESS - If the TPM is present.
+ @retval EFI_NOT_FOUND - If the TPM is not present.
+**/
+EFI_STATUS
+IsTpmPresent (
+ TXT_PEI_LIB_CONTEXT *pctx
+ );
+
+/**
+ Searches PEI firemare volume (FV_BB) for file containig BIOS ACM.
+
+ @param[in] pctx - A pointer to an initialized TXT PEI Context data structure
+ @param[in] pBIOSAC_BASE - A pointer to pointer to variable to hold found address
+
+ @retval EFI_SUCCESS - If address has been found
+ @retval EFI_NOT_FOUND - If address has not been found
+**/
+EFI_STATUS
+FindBiosAcmInVolume (
+ TXT_PEI_LIB_CONTEXT *pctx,
+ OUT UINT32 **pBIOSAC_BASE
+ );
+
+/**
+ Searches PEI firmware volume (FV_BB) for file containig AP Startup code
+
+ @param[in] pctx - A pointer to an initialized TXT PEI Context data structure
+ @param[in] pAP_STARTUP - A pointer to pointer to variable to hold address
+ @param[in] address.
+
+ @retval EFI_SUCCESS - If address has been found
+ @retval EFI_NOT_FOUND - If address has not been found
+**/
+EFI_STATUS
+FindApStartupInVolume (
+ TXT_PEI_LIB_CONTEXT *pctx,
+ OUT UINT32 **pAP_STARTUP
+ );
+
+/**
+ Searches PEI firmware volume (FV_BB) for offset of currently loaded MCU patch
+
+ @param[in] pctx - A pointer to an initialized TXT PEI Context data structure
+ @param[in] pMCU - A pointer to pointer to variable to hold found offset
+ @param[in] address.
+
+ @retval EFI_SUCCESS - If address has been found
+ @retval EFI_NOT_FOUND - If address has not been found
+**/
+EFI_STATUS
+FindMcuInVolume (
+ TXT_PEI_LIB_CONTEXT *pctx,
+ OUT UINT32 **pMCU
+ );
+
+/**
+ Searches PEI firmware volume (FV_BB) for the file with specified GUID through pGuid
+
+ @param[in] pctx - A pointer to an initialized TXT PEI Context data structure
+ @param[in] pGuid - A pointer GUID
+ @param[in] pModule - A pointer to pointer to variable to hold address
+
+ @retval EFI_SUCCESS - If address has been found
+ @retval EFI ERROR - If address has not been found
+**/
+EFI_STATUS
+FindModuleInFlash (
+ TXT_PEI_LIB_CONTEXT *pctx,
+ EFI_GUID *pGuid,
+ OUT UINT32 **pModule
+ );
+
+/**
+ Parses Hob list for TXT Info HOB
+
+ @param[in] pctx - A pointer to an initialized TXT PEI Context data structure
+
+ @retval EFI_SUCCESS - If TXT Info Hob is found
+ @retval EFI_NOT_FOUND - If TXT Info Hob is not found
+**/
+EFI_STATUS
+CreateTxtInfoHob (
+ TXT_PEI_LIB_CONTEXT *pctx
+ );
+
+/**
+ Unlock memory when security is set ant TxT is not enabled
+
+ @param[in] pctx - A pointer to an initialized TXT PEI Context data structure
+
+ @retval EFI_SUCCESS - Complete memory unlock
+ @exception EFI_UNSUPPORTED - CPU doesn't support TxT.
+**/
+EFI_STATUS
+UnlockMemory (
+ IN TXT_PEI_LIB_CONTEXT *pctx
+ );
+
+/**
+ Fix up pointers since they are located in real memory now.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] NotifyDescriptor The notification structure this PEIM registered on install.
+ @param[in] Ppi The memory discovered PPI. Not used.
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+DprUpdate (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
+ IN VOID *Ppi
+ );
+
+#endif
diff --git a/ReferenceCode/Haswell/Txt/TxtInit/Pei/Txtpei.cif b/ReferenceCode/Haswell/Txt/TxtInit/Pei/Txtpei.cif
new file mode 100644
index 0000000..7cba3eb
--- /dev/null
+++ b/ReferenceCode/Haswell/Txt/TxtInit/Pei/Txtpei.cif
@@ -0,0 +1,19 @@
+<component>
+ name = "TxtPei"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Haswell\Txt\TxtInit\Pei\"
+ RefName = "TxtPei"
+[files]
+"TxtPei.sdl"
+"TxtPei.mak"
+"TxtPei.c"
+"TxtPeiLib.c"
+"TxtPeiLib.h"
+"TxtPei.dxs"
+"TxtPei.inf"
+"Ia32\TxtPeiBsp.asm"
+"Ia32\TxtPeiAp.asm16"
+"Ia32\TxtPeiAp.inf"
+"Ia32\TxtPeiApV7.inf"
+"Ia32\makefile.new"
+<endComponent>
diff --git a/ReferenceCode/ME/AcpiTables/MeSsdt/MeSsdt.asl b/ReferenceCode/ME/AcpiTables/MeSsdt/MeSsdt.asl
new file mode 100644
index 0000000..3cd5a1a
--- /dev/null
+++ b/ReferenceCode/ME/AcpiTables/MeSsdt/MeSsdt.asl
@@ -0,0 +1,56 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 2012 - 2013 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ MeSsdt.asl
+
+Abstract:
+
+ Me SSDT Table ASL code
+
+--*/
+
+
+DefinitionBlock (
+ "MeSsdt.aml",
+ "SSDT",
+ 0x01,
+ "MeSsdt",
+ "MeSsdt ",
+ 0x3000
+ )
+{
+
+ OperationRegion(MENV,SystemMemory,0xFFFF0000,0xAA55)
+ Field(MENV,AnyAcc,Lock,Preserve)
+ {
+ MERV, 32, /// (000) ME NVS Protocol Revision
+ ///
+ /// PTT Solution
+ ///
+ PTTS, 8, /// (004) PTT Solution Method Selection
+ ///
+ /// PTT Allocated Buffer Address
+ ///
+ PTTB, 64, /// (005) PTT Allocated Buffer Address
+
+ }
+} \ No newline at end of file
diff --git a/ReferenceCode/ME/AcpiTables/MeSsdt/MeSsdt.cif b/ReferenceCode/ME/AcpiTables/MeSsdt/MeSsdt.cif
new file mode 100644
index 0000000..4ae2bc5
--- /dev/null
+++ b/ReferenceCode/ME/AcpiTables/MeSsdt/MeSsdt.cif
@@ -0,0 +1,12 @@
+<component>
+ name = "MeSsdt"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Me\AcpiTables\MeSsdt\"
+ RefName = "MeAcpiTableSsdt"
+[files]
+"MeSsdt.sdl"
+"MeSsdt.mak"
+"MeSsdt.inf"
+"MeSsdt_Edk.inf"
+"MeSsdt.asl"
+<endComponent>
diff --git a/ReferenceCode/ME/AcpiTables/MeSsdt/MeSsdt.inf b/ReferenceCode/ME/AcpiTables/MeSsdt/MeSsdt.inf
new file mode 100644
index 0000000..6af6685
--- /dev/null
+++ b/ReferenceCode/ME/AcpiTables/MeSsdt/MeSsdt.inf
@@ -0,0 +1,69 @@
+## @file
+# Component description file for the ACPI tables
+#
+#@copyright
+# Copyright (c) 2012 - 2013 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains an 'Intel Peripheral Driver' and uniquely
+# identified as "Intel Reference Module" and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+
+
+[defines]
+BASE_NAME = MeSsdt
+FILE_GUID = 9A8F82D5-39B1-48DA-92DC-A22DA8834DF6
+COMPONENT_TYPE = ACPITABLE
+FFS_EXT = .ffs
+
+[sources.common]
+ MeSsdt.ASL
+
+[libraries.common]
+
+[includes.common]
+ .
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Include
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Include
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+# $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/SampleCode/Include
+
+#
+# Edk II Glue Library, some headers are included by R9 header so have to include
+#
+
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Framework
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[nmake.common]
diff --git a/ReferenceCode/ME/AcpiTables/MeSsdt/MeSsdt.mak b/ReferenceCode/ME/AcpiTables/MeSsdt/MeSsdt.mak
new file mode 100644
index 0000000..b768a60
--- /dev/null
+++ b/ReferenceCode/ME/AcpiTables/MeSsdt/MeSsdt.mak
@@ -0,0 +1,64 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+#<AMI_FHDR_START>
+#
+# Name: MeSsdt.mak
+#
+# Description: MAK file for the ModulePart:MeSsdt
+#
+#
+#<AMI_FHDR_END>
+#*************************************************************************
+all : BuildMeSsdt
+
+BuildMeSsdt : $(BUILD_DIR)\MeSsdt.ffs
+
+#-----------------------------------------------------------------------
+# ASL compiler definition
+#-----------------------------------------------------------------------
+!IF "$(ACPIPLATFORM_ASL_COMPILER)"==""
+!ERROR It is an invalid path, please check your ASL compiler path.
+!ENDIF
+
+IASL = $(ACPIPLATFORM_ASL_COMPILER)
+#-----------------------------------------------------------------------
+$(BUILD_DIR)\MeSsdt.aml : $(INTEL_MESSDT_ASL_FILE)
+ $(CP) /FI$(BUILD_DIR)\tokenasl.h $(INTEL_MESSDT_ASL_FILE) > $(BUILD_DIR)\MeSsdt.asl
+ $(ASLEXPANDER) $(BUILD_DIR)\MeSsdt.asl $(BUILD_DIR)\MeSsdt_Temp.asl $(BUILD_DIR)
+ $(IASL) -p $(BUILD_DIR)\MeSsdt.aml $(BUILD_DIR)\MeSsdt_Temp.asl
+
+
+$(BUILD_DIR)\MeSsdt.sec: $(BUILD_DIR)\MeSsdt.aml
+ $(GENSECTION) -I $*.aml -O $@ -S EFI_SECTION_RAW
+
+$(BUILD_DIR)\MeSsdt.ffs: $(BUILD_DIR)\MeSsdt.sec
+ $(GENFFSFILE) -B $(BUILD_DIR) -V -o $@ -P1 <<$(BUILD_DIR)\MeSsdt.pkg
+
+PACKAGE.INF
+[.]
+BASE_NAME = MeSsdt
+FFS_FILEGUID = 9A8F82D5-39B1-48DA-92DC-A22DA8834DF6
+FFS_FILETYPE = EFI_FV_FILETYPE_FREEFORM
+FFS_ATTRIB_CHECKSUM = TRUE
+
+IMAGE_SCRIPT =
+{
+ Compress (dummy) {
+ $(PROJECT_DIR)\$(BUILD_DIR)\MeSsdt.sec
+ }
+}
+<<KEEP
+
diff --git a/ReferenceCode/ME/AcpiTables/MeSsdt/MeSsdt.sdl b/ReferenceCode/ME/AcpiTables/MeSsdt/MeSsdt.sdl
new file mode 100644
index 0000000..d1974ef
--- /dev/null
+++ b/ReferenceCode/ME/AcpiTables/MeSsdt/MeSsdt.sdl
@@ -0,0 +1,31 @@
+TOKEN
+ Name = "MeSsdt_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable MeSsdt support in Project"
+End
+
+MODULE
+ Help = "Includes MeSsdt.mak to Project"
+ File = "MeSsdt.mak"
+End
+
+PATH
+ Name = "MeSsdt_DIR"
+End
+
+TOKEN
+ Name = "INTEL_MESSDT_ASL_FILE"
+ Value = "$(MeSsdt_DIR)\MeSsdt.asl"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\MeSsdt.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/ME/AcpiTables/MeSsdt/MeSsdt_Edk.inf b/ReferenceCode/ME/AcpiTables/MeSsdt/MeSsdt_Edk.inf
new file mode 100644
index 0000000..464e98b
--- /dev/null
+++ b/ReferenceCode/ME/AcpiTables/MeSsdt/MeSsdt_Edk.inf
@@ -0,0 +1,69 @@
+## @file
+# Component description file for the ACPI tables (for EDK1117)
+#
+#@copyright
+# Copyright (c) 2012 - 2013 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains an 'Intel Peripheral Driver' and uniquely
+# identified as "Intel Reference Module" and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+
+
+[defines]
+BASE_NAME = MeSsdt
+FILE_GUID = 9a8f82d5-39b1-48da-92dc-a22da8834df6
+COMPONENT_TYPE = ME_SSDT_ACPITABLE
+FFS_EXT = .ffs
+
+[sources.common]
+ MeSsdt.ASL
+
+[libraries.common]
+
+[includes.common]
+ .
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Include
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Include
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+# $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/SampleCode/Include
+
+#
+# Edk II Glue Library, some hearder are included by R9 header so have to include
+#
+
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Framework
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[nmake.common]
diff --git a/ReferenceCode/ME/ActiveManagement/ActiveManagement.cif b/ReferenceCode/ME/ActiveManagement/ActiveManagement.cif
new file mode 100644
index 0000000..9730d82
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/ActiveManagement.cif
@@ -0,0 +1,14 @@
+<component>
+ name = "ActiveManagement"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\ActiveManagement\"
+ RefName = "ActiveManagement"
+[files]
+"ActiveManagement.sdl"
+[parts]
+"AmtBootOptions"
+"AlertStandardFormat"
+"IdeRController"
+"PciSerial"
+"StartWatchDog"
+<endComponent>
diff --git a/ReferenceCode/ME/ActiveManagement/ActiveManagement.sdl b/ReferenceCode/ME/ActiveManagement/ActiveManagement.sdl
new file mode 100644
index 0000000..7f4c373
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/ActiveManagement.sdl
@@ -0,0 +1,16 @@
+TOKEN
+ Name = "iAMT_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable iAMT support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+ Token = "iME_SUPPORT" "=" "1"
+End
+
+PATH
+ Name = "AMT_DIR"
+ Help = "iAMT Driver files source directory"
+End
diff --git a/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/AlertStandardFormat.cif b/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/AlertStandardFormat.cif
new file mode 100644
index 0000000..ad65d2c
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/AlertStandardFormat.cif
@@ -0,0 +1,12 @@
+<component>
+ name = "AlertStandardFormat"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\ActiveManagement\AlertStandardFormat\Heci\"
+ RefName = "AlertStandardFormat"
+[files]
+"AlertStandardFormat.sdl"
+[parts]
+"AlertStandardFormatCommon"
+"AlertStandardFormatDxe"
+"AlertStandardFormatPei"
+<endComponent>
diff --git a/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/AlertStandardFormat.sdl b/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/AlertStandardFormat.sdl
new file mode 100644
index 0000000..d02eb68
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/AlertStandardFormat.sdl
@@ -0,0 +1,19 @@
+TOKEN
+ Name = AlertStandardFormat_SUPPORT
+ Value = 1
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable AlertStandardFormat support in Project"
+End
+
+PATH
+ Name = "AlertStandardFormat_SOURCE"
+ Help = "AlertStandardFormat Driver files source directory"
+End
+
+ELINK
+ Name = "AlertStandardFormat_INCLUDES"
+ InvokeOrder = ReplaceParent
+End
diff --git a/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Common/AlertStandardFormatCommon.c b/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Common/AlertStandardFormatCommon.c
new file mode 100644
index 0000000..7f5bf69
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Common/AlertStandardFormatCommon.c
@@ -0,0 +1,1561 @@
+/** @file
+ Processes ASF messages
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights
+ reserved This software and associated documentation (if any)
+ is furnished under a license and may only be used or copied in
+ accordance with the terms of the license. Except as permitted
+ by such license, no part of this software or documentation may
+ be reproduced, stored in a retrieval system, or transmitted in
+ any form or by any means without the express written consent
+ of Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+EFI_ASF_DATA_HUB_MAP mAsfProgressDataHubMap[] = {
+ {
+ EfiAsfMessageBiosPresent,
+ EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_PC_POWER_ON_INIT
+ },
+ {
+ EfiAsfMessageMemInit,
+ EFI_COMPUTING_UNIT_MEMORY | EFI_CU_HP_PC_RAM_INIT
+ },
+ {
+ EfiAsfMessageMemInitDone,
+ EFI_COMPUTING_UNIT_MEMORY | EFI_CU_PC_INIT_END
+ },
+ {
+ EfiAsfMessageCacheInit,
+ EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_PC_CACHE_INIT
+ },
+ {
+ EfiAsfMessageSmbusInit,
+ EFI_IO_BUS_SMBUS | EFI_P_PC_ENABLE
+ },
+ {
+ EfiAsfMessageOSWakeVector,
+ EFI_SOFTWARE_PEI_MODULE | EFI_SW_DXE_RT_PC_S3
+ },
+ {
+ EfiAsfMessageMotherBoardInit,
+ EFI_COMPUTING_UNIT_CHIPSET | EFI_CU_PC_INIT_BEGIN
+ },
+ {
+ EfiAsfMessageBspInit,
+ EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_PC_BSP_SELECT
+ },
+#ifndef ASF_PEI
+ {
+ EfiAsfMessageHddInit,
+ EFI_PERIPHERAL_FIXED_MEDIA | EFI_P_PC_ENABLE
+ },
+ {
+ EfiAsfMessageApInit,
+ EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_PC_AP_INIT
+ },
+ {
+ EfiAsfMessageUserAuthentication,
+ EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_PC_AUTHENTICATE_BEGIN
+ },
+ {
+ EfiAsfMessageUserInitSetup,
+ EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_PC_USER_SETUP
+ },
+ {
+ EfiAsfMessageUsbResourceConfig,
+ EFI_IO_BUS_USB | EFI_P_PC_ENABLE
+ },
+ {
+ EfiAsfMessagePciResourceConfig,
+ EFI_IO_BUS_PCI | EFI_IOB_PCI_PC_BUS_ENUM
+ },
+ {
+ EfiAsfMessageOptionRomInit,
+ EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_PC_LEGACY_OPROM_INIT
+ },
+ {
+ EfiAsfMessageVideoInit,
+ EFI_PERIPHERAL_LOCAL_CONSOLE | EFI_P_PC_ENABLE
+ },
+ {
+ EfiAsfMessageKbcInit,
+ EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_ENABLE
+ },
+ {
+ EfiAsfMessageEmControllerInit,
+ EFI_PERIPHERAL_EMBEDDED_CONTROLLER | EFI_P_PC_INIT
+ },
+ {
+ EfiAsfMessageDockAttached,
+ EFI_PERIPHERAL_DOCK | EFI_P_PC_INIT
+ },
+ {
+ EfiAsfMessageEnableDock,
+ EFI_PERIPHERAL_DOCK | EFI_P_PC_ENABLE
+ },
+ {
+ EfiAsfMessageDockEject,
+ EFI_PERIPHERAL_DOCK | EFI_P_PC_RESET
+ },
+ {
+ EfiAsfMessageDisableDock,
+ EFI_PERIPHERAL_DOCK | EFI_P_PC_DISABLE
+ },
+ {
+ EfiAsfMessageFdcInit,
+ EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_ENABLE
+ },
+ {
+ EfiAsfMessageKeyboardTest,
+ EFI_PERIPHERAL_KEYBOARD | EFI_P_KEYBOARD_PC_SELF_TEST
+ },
+ {
+ EfiAsfMessageMouseTest,
+ EFI_PERIPHERAL_MOUSE | EFI_P_MOUSE_PC_SELF_TEST
+ },
+ {
+ EfiAsfMessageAmtBxDone,
+ EFI_SOFTWARE_UNSPECIFIED | EFI_SW_DXE_AMTBX_OPROM_DONE
+ },
+ {
+ EfiAsfMessageBatteryPresenceDetected,
+ EFI_PERIPHERAL_BATTERY | EFI_P_PC_PRESENCE_DETECT
+ },
+#endif
+};
+
+EFI_ASF_DATA_HUB_MAP mAsfErrorDataHubMap[] = {
+ {
+ EfiAsfMessageNoMemory,
+ EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_NONE_DETECTED
+ },
+ {
+ EfiAsfMessageMemoryFailure,
+ EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_NONE_USEFUL
+ },
+ {
+ EfiAsfMessageBoardFailure,
+ EFI_COMPUTING_UNIT_CHIPSET | EFI_CU_EC_NOT_CONFIGURED
+ },
+ {
+ EfiAsfMessageFirmwareCorruption,
+ EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_CORE_EC_DXE_CORRUPT
+ },
+ {
+ EfiAsfMessageChassisIntrusion,
+ EFI_COMPUTING_UNIT_CHIPSET | EFI_CU_CHIPSET_PC_INTRUDER_DETECT
+ },
+#ifndef ASF_PEI
+ {
+ EfiAsfMessageHddFailure,
+ EFI_PERIPHERAL_FIXED_MEDIA | EFI_P_EC_NOT_DETECTED
+ },
+ {
+ EfiAsfMessageFdcFailure,
+ EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_EC_CONTROLLER_ERROR
+ },
+ {
+ EfiAsfMessageHdcFailure,
+ EFI_PERIPHERAL_FIXED_MEDIA | EFI_P_EC_CONTROLLER_ERROR
+ },
+ {
+ EfiAsfMessageKbdFailure,
+ EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_NOT_DETECTED
+ },
+ {
+ EfiAsfMessageNoFdd,
+ EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_EC_NOT_DETECTED
+ },
+ {
+ EfiAsfMessageVideoControllerFailure,
+ EFI_PERIPHERAL_LOCAL_CONSOLE | EFI_P_EC_CONTROLLER_ERROR
+ },
+ {
+ EfiAsfMessageNoVideo,
+ EFI_PERIPHERAL_LOCAL_CONSOLE | EFI_P_EC_NOT_DETECTED
+ },
+ {
+ EfiAsfMessageCpuVidMismatch,
+ EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_VID_MISMATCH
+ },
+ {
+ EfiAsfMessageCpuSpeedMatchingFailure,
+ EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_SPEED_MATCHING_FAILURE
+ },
+ {
+ EfiAsfMessageNoBootMedia,
+ EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_EC_NO_BOOT_MEDIA
+ },
+ {
+ EfiAsfMessageUserAuthenticationInvalid,
+ EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_EC_AUTHENTICATE_USER_INVALID
+ },
+ {
+ EfiAsfMessageHddAuthenticationInvalid,
+ EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_EC_AUTHENTICATE_HDD_INVALID,
+ },
+ {
+ EfiAsfMessageTemperatureGenericCritical,
+ EFI_PERIPHERAL_TEMPERATURE | EFI_P_TEMERATURE_EC_GENERIC_CRITICAL
+ },
+ {
+ EfiAsfMessageTemperatureOverCritical,
+ EFI_PERIPHERAL_TEMPERATURE | EFI_P_TEMERATURE_EC_OVER_CRITICAL
+ },
+ {
+ EfiAsfMessageTemperatureUnderCritical,
+ EFI_PERIPHERAL_TEMPERATURE | EFI_P_TEMERATURE_EC_UNDER_CRITICAL
+ },
+ {
+ EfiAsfMessageVoltageGenericCritical,
+ EFI_PERIPHERAL_VOLTAGE | EFI_P_VOLTAGE_EC_GENERIC_CRITICAL
+ },
+ {
+ EfiAsfMessageVoltageOverCritical,
+ EFI_PERIPHERAL_VOLTAGE | EFI_P_VOLTAGE_EC_OVER_CRITICAL
+ },
+ {
+ EfiAsfMessageVoltageUnderCritical,
+ EFI_PERIPHERAL_VOLTAGE | EFI_P_VOLTAGE_EC_UNDER_CRITICAL
+ },
+ {
+ EfiAsfMessageFanGenericCritical,
+ EFI_PERIPHERAL_FAN | EFI_P_FAN_EC_GENERIC_CRITICAL
+ },
+ {
+ EfiAsfMessageFanPredictiveFailure,
+ EFI_PERIPHERAL_FAN | EFI_P_FAN_EC_PREDICTIVE_FAILURE
+ },
+ {
+ EfiAsfMessageFanLowSpeedCritical,
+ EFI_PERIPHERAL_FAN | EFI_P_FAN_EC_LOW_SPEED_CRITICAL
+ },
+ {
+ EfiAsfMessageBatteryLowCritical,
+ EFI_PERIPHERAL_BATTERY | EFI_P_BATTERY_EC_LOW_CRITICAL
+ },
+ {
+ EfiAsfMessageTemperatureGenericWarning,
+ EFI_PERIPHERAL_TEMPERATURE | EFI_P_TEMERATURE_PC_GENERIC_WARNING
+ },
+ {
+ EfiAsfMessageTemperatureOverWarning,
+ EFI_PERIPHERAL_TEMPERATURE | EFI_P_TEMERATURE_PC_OVER_WARNING
+ },
+ {
+ EfiAsfMessageTemperatureUnderWarning,
+ EFI_PERIPHERAL_TEMPERATURE | EFI_P_TEMERATURE_PC_UNDER_WARNING
+ },
+ {
+ EfiAsfMessageFanLowSpeedWarning,
+ EFI_PERIPHERAL_FAN | EFI_P_FAN_PC_LOW_SPEED_WARNING
+ },
+ {
+ EfiAsfMessageBatteryLowWarning,
+ EFI_PERIPHERAL_BATTERY | EFI_P_BATTERY_PC_LOW_WARNING
+ },
+ {
+ EfiAsfMessagePowerFailure,
+ EFI_PERIPHERAL_POWER_SUPPLY | EFI_P_BATTERY_PC_LOW_WARNING
+ },
+ {
+ EfiAsfMessageAmtBxNotStarted,
+ EFI_SOFTWARE_UNSPECIFIED | EFI_SW_DXE_AMTBX_OPROM_NOT_STARTED
+ },
+ {
+ EfiAsfMessageAmtBxSleepS4ReportedNotTaken,
+ EFI_SOFTWARE_UNSPECIFIED | EFI_SW_DXE_AMTBX_SLEEP_S4_NOT_TAKEN
+ },
+ {
+ EfiAsfMessageAmtBxSleepS5ReportedNotTaken,
+ EFI_SOFTWARE_UNSPECIFIED | EFI_SW_DXE_AMTBX_SLEEP_S5_NOT_TAKEN
+ },
+ {
+ EfiAsfMessageAmtBxSleepUnspecifiedReportedNotTaken,
+ EFI_SOFTWARE_UNSPECIFIED | EFI_SW_DXE_AMTBX_SLEEP_UNSPECD_NOT_TAKEN
+ },
+ {
+ EfiAsfMessageAmtBxErrActionIntF,
+ EFI_SOFTWARE_UNSPECIFIED | EFI_SW_DXE_AMTBX_ERROR_ACTION_INTF
+ },
+ {
+ EfiAsfMessageAmtBxErrActionInv,
+ EFI_SOFTWARE_UNSPECIFIED | EFI_SW_DXE_AMTBX_ERROR_ACTION_INV
+ },
+ {
+ EfiAsfMessageAmtBxErrActionSetup,
+ EFI_SOFTWARE_UNSPECIFIED | EFI_SW_DXE_AMTBX_ERROR_ACTION_SETUP
+ },
+ {
+ EfiAsfMessageAmtBxErrActionFailure,
+ EFI_SOFTWARE_UNSPECIFIED | EFI_SW_DXE_AMTBX_ERROR_ACTION_FAIL
+ },
+ {
+ EfiAsfMessageAmtBxErrActionUnspecified,
+ EFI_SOFTWARE_UNSPECIFIED | EFI_SW_DXE_AMTBX_ERROR_ACTION_UNSPECD
+ },
+ {
+ EfiAsfMessageAmtBxOtherUnspecified,
+ EFI_SOFTWARE_UNSPECIFIED | EFI_SW_DXE_AMTBX_OTHER_UNSPECD
+ },
+#endif
+};
+
+EFI_ASF_FRAMEWORK_MESSAGE mAsfFrameworkMessage[] = {
+ {
+ EfiAsfMessageBiosPresent,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_ENTITY_PRESENCE,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_PROGRESS,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_MONITOR,
+ 0xFF,
+ 0xFF,
+ EFI_ASF_ENTITY_BIOS,
+ 0,
+ 0x40,
+ EFI_ASF_FP_BOARD_INIT
+ }
+ },
+ {
+ EfiAsfMessageMemInit,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_PROGRESS,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_MONITOR,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_MEMORY,
+ 0, // Instance
+ EFI_ASF_FP_EVENT_DATA0,
+ EFI_ASF_FP_MEMORY_INIT
+ }
+ },
+ {
+ EfiAsfMessageMemInitDone,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_PROGRESS | 0x80, // Exit
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_MONITOR,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_MEMORY,
+ 0, // Instance
+ EFI_ASF_FP_EVENT_DATA0,
+ EFI_ASF_FP_MEMORY_INIT
+ }
+ },
+ {
+ EfiAsfMessageCacheInit,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_PROGRESS,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_MONITOR,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_PROCESSOR,
+ 0, // Instance
+ EFI_ASF_FP_EVENT_DATA0,
+ EFI_ASF_FP_CACHE_INIT
+ }
+ },
+ {
+ EfiAsfMessageSmbusInit,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_PROGRESS,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_MONITOR,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_SYSTEM_BOARD,
+ 0, // Instance
+ EFI_ASF_FP_EVENT_DATA0,
+ EFI_ASF_FP_SMBUS_INIT
+ }
+ },
+ {
+ EfiAsfMessageOSWakeVector,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_PROGRESS,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_MONITOR,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_UNSPECIFIED,
+ 0, // Instance
+ EFI_ASF_FP_EVENT_DATA0,
+ EFI_ASF_FP_WAKE_OS
+ }
+ },
+ {
+ EfiAsfMessageMotherBoardInit,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_PROGRESS,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_MONITOR,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_SYSTEM_BOARD,
+ 0, // Instance
+ EFI_ASF_FP_EVENT_DATA0,
+ EFI_ASF_FP_BOARD_INIT
+ }
+ },
+ //
+ // Error Event
+ //
+ {
+ EfiAsfMessageNoMemory,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_ERROR,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_NONCRITICAL,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_MEMORY,
+ 0, // Instance
+ EFI_ASF_FE_EVENT_DATA0,
+ EFI_ASF_FE_NO_MEMORY
+ }
+ },
+ {
+ EfiAsfMessageMemoryFailure,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_ERROR,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_NONCRITICAL,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_MEMORY,
+ 0, // Instance
+ EFI_ASF_FE_EVENT_DATA0,
+ EFI_ASF_FE_MEMORY_FAILURE
+ }
+ },
+ {
+ EfiAsfMessageBoardFailure,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_ERROR,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_NONRECOVERABLE,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_SYSTEM_BOARD,
+ 0, // Instance
+ EFI_ASF_FE_EVENT_DATA0,
+ EFI_ASF_FE_BOARD_FAILURE
+ }
+ },
+ {
+ EfiAsfMessageFirmwareCorruption,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_ERROR,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_NONCRITICAL,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_SYSTEM_BOARD,
+ 0, // Insnce
+ EFI_ASF_FE_EVENT_DATA0,
+ EFI_ASF_FE_ROM_CORRUPTED
+ }
+ },
+ //
+ // Chassis Intrusion
+ //
+ {
+ EfiAsfMessageChassisIntrusion,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_CHASSIS_INTRUSION,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_CHASSIS_INTRUSION_GENERIC,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_MONITOR,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_SYSTEM_BOARD,
+ 0, // Instance
+ }
+ },
+#ifndef ASF_PEI
+ //
+ // Progress Event
+ //
+ {
+ EfiAsfMessageHddInit,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_PROGRESS,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_MONITOR,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_DISK,
+ 0, // Instance
+ EFI_ASF_FP_EVENT_DATA0,
+ EFI_ASF_FP_HDD_INIT
+ }
+ },
+ {
+ EfiAsfMessageApInit,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_PROGRESS,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_MONITOR,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_PROCESSOR,
+ 0, // Instance
+ EFI_ASF_FP_EVENT_DATA0,
+ EFI_ASF_FP_AP_INIT
+ }
+ },
+ {
+ EfiAsfMessageUserAuthentication,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_PROGRESS,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_MONITOR,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_BIOS,
+ 0, // Instance
+ EFI_ASF_FP_EVENT_DATA0,
+ EFI_ASF_FP_USER_AUTHENTICATION
+ }
+ },
+ {
+ EfiAsfMessageUserInitSetup,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_PROGRESS,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_MONITOR,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_BIOS,
+ 0, // Instance
+ EFI_ASF_FP_EVENT_DATA0,
+ EFI_ASF_FP_USER_SETUP
+ }
+ },
+ {
+ EfiAsfMessageUsbResourceConfig,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_PROGRESS,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_MONITOR,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_BIOS,
+ 0, // Instance
+ EFI_ASF_FP_EVENT_DATA0,
+ EFI_ASF_FP_USB_RESOURCE_CONFIG
+ }
+ },
+ {
+ EfiAsfMessagePciResourceConfig,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_PROGRESS,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_MONITOR,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_BIOS,
+ 0, // Instance
+ EFI_ASF_FP_EVENT_DATA0,
+ EFI_ASF_FP_PCI_RESOURCE_CONFIG
+ }
+ },
+ {
+ EfiAsfMessageOptionRomInit,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_PROGRESS,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_MONITOR,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_ADDIN_CARD,
+ 0, // Instance
+ EFI_ASF_FP_EVENT_DATA0,
+ EFI_ASF_FP_OPTION_ROM_INIT
+ }
+ },
+ {
+ EfiAsfMessageVideoInit,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_PROGRESS,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_MONITOR,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_SYSTEM_BOARD,
+ 0, // Instance
+ EFI_ASF_FP_EVENT_DATA0,
+ EFI_ASF_FP_VIDEO_INIT
+ }
+ },
+ {
+ EfiAsfMessageKbcInit,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_PROGRESS,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_MONITOR,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_SYSTEM_BOARD,
+ 0, // Instance
+ EFI_ASF_FP_EVENT_DATA0,
+ EFI_ASF_FP_KBC_INIT
+ }
+ },
+ {
+ EfiAsfMessageEmControllerInit,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_PROGRESS,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_MONITOR,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_SYSTEM_BOARD,
+ 0, // Instance
+ EFI_ASF_FP_EVENT_DATA0,
+ EFI_ASF_FP_EC_INIT
+ }
+ },
+ {
+ EfiAsfMessageDockAttached,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_PROGRESS,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_MONITOR,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_SYSTEM_BOARD,
+ 0, // Instance
+ EFI_ASF_FP_EVENT_DATA0,
+ EFI_ASF_FP_ATTACH_DOCK
+ }
+ },
+ {
+ EfiAsfMessageEnableDock,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_PROGRESS,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_MONITOR,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_SYSTEM_BOARD,
+ 0, // Instance
+ EFI_ASF_FP_EVENT_DATA0,
+ EFI_ASF_FP_ENABLE_DOCK
+ }
+ },
+ {
+ EfiAsfMessageDockEject,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_PROGRESS,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_MONITOR,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_SYSTEM_BOARD,
+ 0, // Instance
+ EFI_ASF_FP_EVENT_DATA0,
+ EFI_ASF_FP_EJECT_DOCK
+ }
+ },
+ {
+ EfiAsfMessageDisableDock,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_PROGRESS,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_MONITOR,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_SYSTEM_BOARD,
+ 0, // Instance
+ EFI_ASF_FP_EVENT_DATA0,
+ EFI_ASF_FP_DISABLE_DOCK
+ }
+ },
+ {
+ EfiAsfMessageFdcInit,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_PROGRESS,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_MONITOR,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_SYSTEM_BOARD,
+ 0, // Instance
+ EFI_ASF_FP_EVENT_DATA0,
+ EFI_ASF_FP_FDC_INIT
+ }
+ },
+ {
+ EfiAsfMessageKeyboardTest,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_PROGRESS,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_MONITOR,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_SYSTEM_BOARD,
+ 0, // Instance
+ EFI_ASF_FP_EVENT_DATA0,
+ EFI_ASF_FP_KBD_TEST
+ }
+ },
+ {
+ EfiAsfMessageMouseTest,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_PROGRESS,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_MONITOR,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_SYSTEM_BOARD,
+ 0, // Instance
+ EFI_ASF_FP_EVENT_DATA0,
+ EFI_ASF_FP_MOUSE_TEST
+ }
+ },
+ {
+ EfiAsfMessageBspInit,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_PROGRESS,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_MONITOR,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_PROCESSOR,
+ 0, // Instance
+ EFI_ASF_FP_EVENT_DATA0,
+ EFI_ASF_FP_BSP_INIT
+ }
+ },
+ //
+ // Error Event
+ //
+ {
+ EfiAsfMessageHddFailure,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_ERROR,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_NONRECOVERABLE,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_DISK,
+ 0, // Instance
+ EFI_ASF_FE_EVENT_DATA0,
+ EFI_ASF_FE_HDD_FAILURE
+ }
+ },
+ {
+ EfiAsfMessageFdcFailure,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_ERROR,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_NONRECOVERABLE,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_DISK,
+ 0, // Instance
+ EFI_ASF_FE_EVENT_DATA0,
+ EFI_ASF_FE_FDC_FAILURE
+ }
+ },
+ {
+ EfiAsfMessageHdcFailure,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_ERROR,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_NONRECOVERABLE,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_DISK,
+ 0, // Instance
+ EFI_ASF_FE_EVENT_DATA0,
+ EFI_ASF_FE_HDC_FAILURE
+ }
+ },
+ {
+ EfiAsfMessageKbdFailure,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_ERROR,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_NONCRITICAL,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_SYSTEM_BOARD,
+ 0, // Instance
+ EFI_ASF_FE_EVENT_DATA0,
+ EFI_ASF_FE_KBD_FAILURE
+ }
+ },
+ {
+ EfiAsfMessageNoFdd,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_ERROR,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_NONRECOVERABLE,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_DISK,
+ 0, // Instance
+ EFI_ASF_FE_EVENT_DATA0,
+ EFI_ASF_FE_REMOVABLE_BOOT_MEDIA_NOT_FOUND
+ }
+ },
+ {
+ EfiAsfMessageVideoControllerFailure,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_ERROR,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_NONRECOVERABLE,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_DISK,
+ 0, // Instance
+ EFI_ASF_FE_EVENT_DATA0,
+ EFI_ASF_FE_VIDEO_CONTROLLER_FAILURE
+ }
+ },
+ {
+ EfiAsfMessageNoVideo,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_ERROR,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_NONCRITICAL,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_SYSTEM_BOARD,
+ 0, // Instance
+ EFI_ASF_FE_EVENT_DATA0,
+ EFI_ASF_FE_VIDEO_DEVICE_NOT_FOUND
+ }
+ },
+ {
+ EfiAsfMessageCpuVidMismatch,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_ERROR,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_NONCRITICAL,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_PROCESSOR,
+ 0, // Instance
+ EFI_ASF_FE_EVENT_DATA0,
+ EFI_ASF_FE_CPU_VOLTAGE_FAILURE
+ }
+ },
+ {
+ EfiAsfMessageCpuSpeedMatchingFailure,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_ERROR,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_NONCRITICAL,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_PROCESSOR,
+ 0, // Instance
+ EFI_ASF_FE_EVENT_DATA0,
+ EFI_ASF_FE_CPU_MISMATCH_FAILURE
+ }
+ },
+ {
+ EfiAsfMessageUserAuthenticationInvalid,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_RETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SECURITY_VIOLATION,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SECURITY_VIOLATION_USER_PASSWORD,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_NONCRITICAL,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_BIOS,
+ 0, // Instance
+ }
+ },
+ {
+ EfiAsfMessageHddAuthenticationInvalid,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_RETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SECURITY_VIOLATION,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SECURITY_VIOLATION_OTHER_PASSWORD,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_NONCRITICAL,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_BIOS,
+ 0, // Instance
+ }
+ },
+ //
+ // Boot Error
+ //
+ {
+ EfiAsfMessageNoBootMedia,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_ERROR,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_NONRECOVERABLE,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_DISK,
+ 0, // Insnce
+ EFI_ASF_FE_EVENT_DATA0,
+ EFI_ASF_FE_REMOVABLE_BOOT_MEDIA_NOT_FOUND
+ }
+ },
+ {
+ EfiAsfMessageAmtBxDone,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_PROGRESS,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_MONITOR,
+ 0xFF,
+ 0xFF,
+ EFI_ASF_ENTITY_INTEL_AMT,
+ 0,
+ 0x40,
+ EFI_ASF_FP_AMTBX_INIT
+ }
+ },
+ {
+ EfiAsfMessageAmtBxNotStarted,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_ERROR,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_NONRECOVERABLE,
+ 0xFF,
+ 0xFF,
+ EFI_ASF_ENTITY_INTEL_AMT,
+ 0,
+ 0x40,
+ EFI_ASF_FE_AMTBX_FAILURE
+ }
+ },
+ {
+ EfiAsfMessageAmtBxSleepS4ReportedNotTaken,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_ERROR,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_NONCRITICAL,
+ 0xFF,
+ 0xFF,
+ EFI_ASF_ENTITY_INTEL_AMT,
+ 0,
+ 0x40,
+ EFI_ASF_FE_AMTBX_FAILURE
+ }
+ },
+ {
+ EfiAsfMessageAmtBxSleepS5ReportedNotTaken,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_ERROR,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_NONCRITICAL,
+ 0xFF,
+ 0xFF,
+ EFI_ASF_ENTITY_INTEL_AMT,
+ 0,
+ 0x40,
+ EFI_ASF_FE_AMTBX_FAILURE
+ }
+ },
+ {
+ EfiAsfMessageAmtBxSleepUnspecifiedReportedNotTaken,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_ERROR,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_NONCRITICAL,
+ 0xFF,
+ 0xFF,
+ EFI_ASF_ENTITY_INTEL_AMT,
+ 0,
+ 0x40,
+ EFI_ASF_FE_AMTBX_FAILURE
+ }
+ },
+ {
+ EfiAsfMessageAmtBxErrActionIntF,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_ERROR,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_NONRECOVERABLE,
+ 0xFF,
+ 0xFF,
+ EFI_ASF_ENTITY_INTEL_AMT,
+ 0,
+ 0x40,
+ EFI_ASF_FE_AMTBX_FAILURE
+ }
+ },
+ {
+ EfiAsfMessageAmtBxErrActionInv,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_ERROR,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_NONCRITICAL,
+ 0xFF,
+ 0xFF,
+ EFI_ASF_ENTITY_INTEL_AMT,
+ 0,
+ 0x40,
+ EFI_ASF_FE_AMTBX_FAILURE
+ }
+ },
+ {
+ EfiAsfMessageAmtBxErrActionSetup,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_ERROR,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_NONCRITICAL,
+ 0xFF,
+ 0xFF,
+ EFI_ASF_ENTITY_INTEL_AMT,
+ 0,
+ 0x40,
+ EFI_ASF_FE_AMTBX_FAILURE
+ }
+ },
+ {
+ EfiAsfMessageAmtBxErrActionFailure,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_ERROR,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_NONRECOVERABLE,
+ 0xFF,
+ 0xFF,
+ EFI_ASF_ENTITY_INTEL_AMT,
+ 0,
+ 0x40,
+ EFI_ASF_FE_AMTBX_FAILURE
+ }
+ },
+ {
+ EfiAsfMessageAmtBxErrActionUnspecified,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_ERROR,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_NONCRITICAL,
+ 0xFF,
+ 0xFF,
+ EFI_ASF_ENTITY_INTEL_AMT,
+ 0,
+ 0x40,
+ EFI_ASF_FE_AMTBX_FAILURE
+ }
+ },
+ {
+ EfiAsfMessageAmtBxOtherUnspecified,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_SYS_FW_ERROR,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_NONCRITICAL,
+ 0xFF,
+ 0xFF,
+ EFI_ASF_ENTITY_INTEL_AMT,
+ 0,
+ 0x40,
+ EFI_ASF_FE_AMTBX_FAILURE
+ }
+ },
+ //
+ // Temperature
+ //
+ {
+ EfiAsfMessageTemperatureGenericCritical,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_TEMPERATURE,
+ EFI_ASF_EVENT_TYPE_SEVERITY_STATE,
+ EFI_ASF_EVENT_OFFSET_SEVERITY_MORE_CRITICAL,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_CRITICAL,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_SYSTEM_BOARD,
+ 0, // Instance
+ }
+ },
+ {
+ EfiAsfMessageTemperatureGenericWarning,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_TEMPERATURE,
+ EFI_ASF_EVENT_TYPE_SEVERITY_STATE,
+ EFI_ASF_EVENT_OFFSET_SEVERITY_MORE_NONCRITICAL,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_NONCRITICAL,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_SYSTEM_BOARD,
+ 0, // Instance
+ }
+ },
+ {
+ EfiAsfMessageTemperatureOverCritical,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_TEMPERATURE,
+ EFI_ASF_EVENT_TYPE_THRESHOLD_BASED,
+ EFI_ASF_EVENT_OFFSET_THRESHOLD_UPPER_CRITICAL,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_CRITICAL,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_SYSTEM_BOARD,
+ 0, // Instance
+ }
+ },
+ {
+ EfiAsfMessageTemperatureOverWarning,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_TEMPERATURE,
+ EFI_ASF_EVENT_TYPE_THRESHOLD_BASED,
+ EFI_ASF_EVENT_OFFSET_THRESHOLD_UPPER_NONCRITICAL,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_NONCRITICAL,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_SYSTEM_BOARD,
+ 0, // Instance
+ }
+ },
+ {
+ EfiAsfMessageTemperatureUnderCritical,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_TEMPERATURE,
+ EFI_ASF_EVENT_TYPE_THRESHOLD_BASED,
+ EFI_ASF_EVENT_OFFSET_THRESHOLD_LOWER_CRITICAL,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_CRITICAL,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_SYSTEM_BOARD,
+ 0, // Instance
+ }
+ },
+ {
+ EfiAsfMessageTemperatureUnderWarning,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_TEMPERATURE,
+ EFI_ASF_EVENT_TYPE_THRESHOLD_BASED,
+ EFI_ASF_EVENT_OFFSET_THRESHOLD_LOWER_NONCRITICAL,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_NONCRITICAL,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_SYSTEM_BOARD,
+ 0, // Instance
+ }
+ },
+ //
+ // Voltage
+ //
+ {
+ EfiAsfMessageVoltageGenericCritical,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_VOLTAGE,
+ EFI_ASF_EVENT_TYPE_SEVERITY_STATE,
+ EFI_ASF_EVENT_OFFSET_SEVERITY_MORE_CRITICAL,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_CRITICAL,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_SYSTEM_BOARD,
+ 0, // Instance
+ }
+ },
+ {
+ EfiAsfMessageVoltageOverCritical,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_VOLTAGE,
+ EFI_ASF_EVENT_TYPE_THRESHOLD_BASED,
+ EFI_ASF_EVENT_OFFSET_THRESHOLD_UPPER_CRITICAL,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_CRITICAL,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_SYSTEM_BOARD,
+ 0, // Instance
+ }
+ },
+ {
+ EfiAsfMessageVoltageUnderCritical,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_VOLTAGE,
+ EFI_ASF_EVENT_TYPE_THRESHOLD_BASED,
+ EFI_ASF_EVENT_OFFSET_THRESHOLD_LOWER_CRITICAL,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_CRITICAL,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_SYSTEM_BOARD,
+ 0, // Instance
+ }
+ },
+ //
+ // Fan
+ //
+ {
+ EfiAsfMessageFanGenericCritical,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_FAN,
+ EFI_ASF_EVENT_TYPE_SEVERITY_STATE,
+ EFI_ASF_EVENT_OFFSET_SEVERITY_MORE_CRITICAL,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_CRITICAL,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_SYSTEM_BOARD,
+ 0, // Instance
+ }
+ },
+ {
+ EfiAsfMessageFanPredictiveFailure,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_FAN,
+ EFI_ASF_EVENT_TYPE_DISCRETE_EVENT_PREDICTIVE_FAIL,
+ EFI_ASF_EVENT_OFFSET_DISCRETE_EVENT_PREDICTIVE_FAIL_ASSERT,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_CRITICAL,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_SYSTEM_BOARD,
+ 0, // Instance
+ }
+ },
+ {
+ EfiAsfMessageFanLowSpeedCritical,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_FAN,
+ EFI_ASF_EVENT_TYPE_THRESHOLD_BASED,
+ EFI_ASF_EVENT_OFFSET_THRESHOLD_LOWER_CRITICAL,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_CRITICAL,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_SYSTEM_BOARD,
+ 0, // Instance
+ }
+ },
+ {
+ EfiAsfMessageFanLowSpeedWarning,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_FAN,
+ EFI_ASF_EVENT_TYPE_THRESHOLD_BASED,
+ EFI_ASF_EVENT_OFFSET_THRESHOLD_LOWER_NONCRITICAL,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_NONCRITICAL,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_SYSTEM_BOARD,
+ 0, // Instance
+ }
+ },
+ //
+ // Battery
+ //
+ {
+ EfiAsfMessageBatteryLowWarning,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_BATTERY,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_BATTERY_LOW_WARNING,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_NONCRITICAL,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_POWER_SUPPLY,
+ 0, // Instance
+ }
+ },
+ {
+ EfiAsfMessageBatteryLowCritical,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_BATTERY,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_BATTERY_LOW_CRITICAL,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_CRITICAL,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_POWER_SUPPLY,
+ 0, // Insnce
+ }
+ },
+ {
+ EfiAsfMessageBatteryPresenceDetected,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_BATTERY,
+ EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC,
+ EFI_ASF_EVENT_OFFSET_BATTERY_PRESENCE_DETECTED,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_MONITOR,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_POWER_SUPPLY,
+ 0, // Insnce
+ }
+ },
+ {
+ EfiAsfMessagePowerFailure,
+ {
+ EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT,
+ EFI_ASF_VERSION,
+ EFI_ASF_EVENT_SENSOR_TYPE_POWER_SUPPLY,
+ EFI_ASF_EVENT_TYPE_SEVERITY_STATE,
+ EFI_ASF_EVENT_OFFSET_POWER_SUPPLY_FAILURE,
+ EFI_ASF_EVENT_SOURCE_TYPE_ASF10,
+ EFI_ASF_EVENT_SEVERITY_CODE_NONRECOVERABLE,
+ EFI_ASF_SENSOR_DEVICE,
+ EFI_ASF_SENSOR_NUMBER,
+ EFI_ASF_ENTITY_SYSTEM_BOARD,
+ 0, // Insnce
+ }
+ },
+#endif
+};
diff --git a/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Common/AlertStandardFormatCommon.cif b/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Common/AlertStandardFormatCommon.cif
new file mode 100644
index 0000000..ee34575
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Common/AlertStandardFormatCommon.cif
@@ -0,0 +1,10 @@
+<component>
+ name = "AlertStandardFormatCommon"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\ActiveManagement\AlertStandardFormat\Heci\Common\"
+ RefName = "AlertStandardFormatCommon"
+[files]
+"AlertStandardFormatCommon.sdl"
+"AlertStandardFormatCommon.c"
+"AlertStandardFormatCommon.h"
+<endComponent>
diff --git a/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Common/AlertStandardFormatCommon.h b/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Common/AlertStandardFormatCommon.h
new file mode 100644
index 0000000..5949fb9
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Common/AlertStandardFormatCommon.h
@@ -0,0 +1,397 @@
+/** @file
+ Include file for ASF Driver
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights
+ reserved This software and associated documentation (if any)
+ is furnished under a license and may only be used or copied in
+ accordance with the terms of the license. Except as permitted
+ by such license, no part of this software or documentation may
+ be reproduced, stored in a retrieval system, or transmitted in
+ any form or by any means without the express written consent
+ of Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _ALERT_STANDARD_FORMAT_COMMON_H
+#define _ALERT_STANDARD_FORMAT_COMMON_H
+
+#define EFI_ASF_VERSION 0x10
+
+//
+// ASF SMBUS Messages
+//
+#define EFI_ASF_MESSAGE_COMMAND_SENSE_DEVICE_SYSTEM_STATE 0x01
+#define EFI_ASF_MESSAGE_COMMAND_MANAGEMENT_CONTROL 0x02
+#define EFI_ASF_MESSAGE_COMMAND_ASF_CONFIGURATION 0x03
+#define EFI_ASF_MESSAGE_COMMAND_MESSAGE 0x04
+#define EFI_ASF_MESSAGE_COMMAND_GETUUID 0xC7
+
+#define EFI_ASF_MESSAGE_BYTECOUNT_RETURN_BOOT_OPT 0x0D
+#define EFI_ASF_MESSAGE_BYTECOUNT_CLEAR_BOOT_OPT 0x02
+#define EFI_ASF_MESSAGE_BYTEOUNTT_GET_BOOT_OPT 0x02
+#define EFI_ASF_MESSAGE_BYTECOUNT_DEVICE_TYPE_POLL 0x03
+#define EFI_ASF_MESSAGE_BYTECOUNT_STOP_WATCH_DOG_TIMER 0x02
+#define EFI_ASF_MESSAGE_BYTECOUNT_START_WATCH_DOG_TIMER 0x0D
+
+#define EFI_ASF_MESSAGE_SUBCOMMAND_RETURN_BOOT_OPT 0x16
+#define EFI_ASF_MESSAGE_SUBCOMMAND_CLEAR_BOOT_OPT 0x15
+#define EFI_ASF_MESSAGE_SUBCOMMAND_DEVICE_TYPE_POLL 0x13
+#define EFI_ASF_MESSAGE_SUBCOMMAND_STOP_WATCH_DOG_TIMER 0x14
+#define EFI_ASF_MESSAGE_SUBCOMMAND_START_WATCH_DOG_TIMER 0x13
+#define EFI_ASF_MESSAGE_SUBCOMMAND_RETRANSMIT 0x15
+#define EFI_ASF_MESSAGE_SUBCOMMAND_NORETRANSMIT 0x16
+#define EFI_ASF_MESSAGE_SUBCOMMAND_SYSTEM_STATE 0x18
+
+#define EFI_ASF_MESSAGE_VERSIONNUMBER 0x10
+
+//
+// ASF Event Sensor Type Codes
+//
+#define EFI_ASF_EVENT_SENSOR_TYPE_SYS_FW_ERR_PROG 0x0F
+#define EFI_ASF_EVENT_SENSOR_TYPE_POST_ERR_PROG 0x0F
+#define EFI_ASF_EVENT_SENSOR_TYPE_BOOT_ERROR 0x1E
+#define EFI_ASF_EVENT_SENSOR_TYPE_OS_BOOT 0x1F
+#define EFI_ASF_EVENT_SENSOR_TYPE_ENTITY_PRESENCE 0x25
+#define EFI_ASF_EVENT_SENSOR_TYPE_WATCHDOG2 0x23
+
+#define EFI_ASF_EVENT_SENSOR_TYPE_TEMPERATURE 0x01
+#define EFI_ASF_EVENT_SENSOR_TYPE_VOLTAGE 0x02
+#define EFI_ASF_EVENT_SENSOR_TYPE_FAN 0x04
+#define EFI_ASF_EVENT_SENSOR_TYPE_CHASSIS_INTRUSION 0x05
+#define EFI_ASF_EVENT_SENSOR_TYPE_SECURITY_VIOLATION 0x06
+#define EFI_ASF_EVENT_SENSOR_TYPE_PROCESSOR 0x07
+#define EFI_ASF_EVENT_SENSOR_TYPE_POWER_SUPPLY 0x08
+#define EFI_ASF_EVENT_SENSOR_TYPE_POWER_UNIT 0x09
+#define EFI_ASF_EVENT_SENSOR_TYPE_CHIPSET 0x19
+#define EFI_ASF_EVENT_SENSOR_TYPE_BATTERY 0x29
+
+//
+// ASF Event Type Codes
+// IPMI/PET related stuff
+//
+#define EFI_ASF_EVENT_TYPE_SENSOR_SPECIFIC 0x6F
+
+#define EFI_ASF_EVENT_TYPE_THRESHOLD_BASED 0x01
+#define EFI_ASF_EVENT_TYPE_USAGE_STATE 0x02
+#define EFI_ASF_EVENT_TYPE_DISCRETE_EVENT_STATE 0x03
+#define EFI_ASF_EVENT_TYPE_DISCRETE_EVENT_PREDICTIVE_FAIL 0x04
+#define EFI_ASF_EVENT_TYPE_DISCRETE_EVENT_LIMIT 0x05
+#define EFI_ASF_EVENT_TYPE_DISCRETE_EVENT_PERFORMANCE 0x06
+#define EFI_ASF_EVENT_TYPE_SEVERITY_STATE 0x07
+#define EFI_ASF_EVENT_TYPE_AVAILABILITY_STATUS_PRESENT 0x08
+#define EFI_ASF_EVENT_TYPE_AVAILABILITY_STATUS_ENABLE 0x09
+#define EFI_ASF_EVENT_TYPE_AVAILABILITY_STATUS_RUNNING 0x0A
+#define EFI_ASF_EVENT_TYPE_AVAILABILITY_STATUS_OTHER 0x0B
+#define EFI_ASF_EVENT_TYPE_DEVICE_POWER_STATES 0x0C
+
+//
+// ASF Event Offset Codes
+// IPMI/PET related stuff
+//
+#define EFI_ASF_EVENT_OFFSET_ENTITY_PRESENT 0x00
+#define EFI_ASF_EVENT_OFFSET_TIMER_EXPIRED 0x00
+#define EFI_ASF_EVENT_OFFSET_SYS_FW_ERROR 0x00
+#define EFI_ASF_EVENT_OFFSET_SYS_FW_HANG 0x01
+#define EFI_ASF_EVENT_OFFSET_SYS_FW_PROGRESS 0x02
+
+#define EFI_ASF_EVENT_OFFSET_THRESHOLD_LOWER_NONCRITICAL 0x00
+#define EFI_ASF_EVENT_OFFSET_THRESHOLD_LOWER_NONCRITICAL_GO_HIGH 0x01
+#define EFI_ASF_EVENT_OFFSET_THRESHOLD_LOWER_CRITICAL 0x02
+#define EFI_ASF_EVENT_OFFSET_THRESHOLD_LOWER_CRITICAL_GO_HIGH 0x03
+#define EFI_ASF_EVENT_OFFSET_THRESHOLD_LOWER_NONRECOVERABLE 0x04
+#define EFI_ASF_EVENT_OFFSET_THRESHOLD_LOWER_NONRECOVERABLE_GO_HIGH 0x05
+#define EFI_ASF_EVENT_OFFSET_THRESHOLD_UPPER_NONCRITICAL_GO_LOW 0x06
+#define EFI_ASF_EVENT_OFFSET_THRESHOLD_UPPER_NONCRITICAL 0x07
+#define EFI_ASF_EVENT_OFFSET_THRESHOLD_UPPER_CRITICAL_GO_LOW 0x08
+#define EFI_ASF_EVENT_OFFSET_THRESHOLD_UPPER_CRITICAL 0x09
+#define EFI_ASF_EVENT_OFFSET_THRESHOLD_UPPER_NONRECOVERABLE_GO_LOW 0x0A
+#define EFI_ASF_EVENT_OFFSET_THRESHOLD_UPPER_NONRECOVERABLE 0x0B
+
+#define EFI_ASF_EVENT_OFFSET_DISCRETE_EVENT_PREDICTIVE_FAIL_DEASSERT 0x00
+#define EFI_ASF_EVENT_OFFSET_DISCRETE_EVENT_PREDICTIVE_FAIL_ASSERT 0x01
+
+#define EFI_ASF_EVENT_OFFSET_SEVERITY_TO_OK 0x00
+#define EFI_ASF_EVENT_OFFSET_SEVERITY_MORE_NONCRITICAL 0x01
+#define EFI_ASF_EVENT_OFFSET_SEVERITY_MORE_CRITICAL 0x02
+#define EFI_ASF_EVENT_OFFSET_SEVERITY_MORE_NONRECOVERABLE 0x03
+#define EFI_ASF_EVENT_OFFSET_SEVERITY_LESS_NONCRITICAL 0x04
+#define EFI_ASF_EVENT_OFFSET_SEVERITY_LESS_CRITICAL 0x05
+#define EFI_ASF_EVENT_OFFSET_SEVERITY_TO_NONRECOVERABLE 0x06
+#define EFI_ASF_EVENT_OFFSET_SEVERITY_MONITOR 0x07
+#define EFI_ASF_EVENT_OFFSET_SEVERITY_INFORMATIONAL 0x08
+
+#define EFI_ASF_EVENT_OFFSET_CHASSIS_INTRUSION_GENERIC 0x00
+
+#define EFI_ASF_EVENT_OFFSET_PROCESSOR_IERR 0x00
+
+#define EFI_ASF_EVENT_OFFSET_SECURITY_VIOLATION_USER_PASSWORD 0x01
+#define EFI_ASF_EVENT_OFFSET_SECURITY_VIOLATION_SUPERVISOR_PASSWORD 0x02
+#define EFI_ASF_EVENT_OFFSET_SECURITY_VIOLATION_NETWORK_PASSWORD 0x03
+#define EFI_ASF_EVENT_OFFSET_SECURITY_VIOLATION_OTHER_PASSWORD 0x04
+#define EFI_ASF_EVENT_OFFSET_SECURITY_VIOLATION_OUTOFBAND_PASSWORD 0x05
+
+#define EFI_ASF_EVENT_OFFSET_BATTERY_LOW_WARNING 0x00
+#define EFI_ASF_EVENT_OFFSET_BATTERY_LOW_CRITICAL 0x01
+#define EFI_ASF_EVENT_OFFSET_BATTERY_PRESENCE_DETECTED 0x02
+
+#define EFI_ASF_EVENT_OFFSET_POWER_SUPPLY_PRESENCE 0x00
+#define EFI_ASF_EVENT_OFFSET_POWER_SUPPLY_FAILURE 0x01
+#define EFI_ASF_EVENT_OFFSET_POWER_SUPPLY_PREDICTIVE_FAILURE 0x02
+
+#define EFI_ASF_EVENT_OFFSET_POWER_UNIT_DOWN 0x00
+#define EFI_ASF_EVENT_OFFSET_POWER_UNIT_CYCLE 0x01
+#define EFI_ASF_EVENT_OFFSET_POWER_UNIT_240VA_DOWN 0x02
+#define EFI_ASF_EVENT_OFFSET_POWER_UNIT_INTERLOCK_DOWN 0x03
+#define EFI_ASF_EVENT_OFFSET_POWER_UNIT_AC_LOST 0x04
+#define EFI_ASF_EVENT_OFFSET_POWER_UNIT_SOFT_CONTROL_FAILURE 0x05
+#define EFI_ASF_EVENT_OFFSET_POWER_UNIT_FAILURE 0x06
+
+//
+// ASF Event Source Type Code
+// IPMI/PET related stuff
+//
+#define EFI_ASF_EVENT_SOURCE_TYPE_ASF10 0x68
+#define EFI_ASF_EVENT_SOURCE_TYPE_PLATFORM_FIRMWARE 0x00
+#define EFI_ASF_EVENT_SOURCE_TYPE_OS 0x48
+
+//
+// ASF Event Severity Codes
+// IPMI/PET related stuff
+//
+#define EFI_ASF_EVENT_SEVERITY_CODE_MONITOR 0x01
+#define EFI_ASF_EVENT_SEVERITY_CODE_INFORMATION 0x02
+#define EFI_ASF_EVENT_SEVERITY_CODE_OK 0x04
+#define EFI_ASF_EVENT_SEVERITY_CODE_NONCRITICAL 0x08
+#define EFI_ASF_EVENT_SEVERITY_CODE_CRITICAL 0x10
+#define EFI_ASF_EVENT_SEVERITY_CODE_NONRECOVERABLE 0x20
+
+///
+/// ASF Sensor Device Codes
+/// IPMI/PET related stuff
+///
+#define EFI_ASF_SENSOR_DEVICE 0xFF
+
+///
+/// ASF Sensor Number Codes
+/// IPMI/PET related stuff
+///
+#define EFI_ASF_SENSOR_NUMBER 0xFF
+
+//
+// ASF Entity Codes
+// IPMI/PET related stuff
+//
+#define EFI_ASF_ENTITY_UNSPECIFIED 0x00
+#define EFI_ASF_ENTITY_OTHER 0x01
+#define EFI_ASF_ENTITY_UNKNOWN 0x02
+#define EFI_ASF_ENTITY_PROCESSOR 0x03
+#define EFI_ASF_ENTITY_DISK 0x04
+#define EFI_ASF_ENTITY_PERIPHERAL 0x05
+#define EFI_ASF_ENTITY_SYSTEM_MGMT_MOD 0x06
+#define EFI_ASF_ENTITY_SYSTEM_BOARD 0x07
+#define EFI_ASF_ENTITY_POWER_SUPPLY 0x0A
+#define EFI_ASF_ENTITY_ADDIN_CARD 0x0B
+#define EFI_ASF_ENTITY_CHASIS_BACK_PANEL_BOARD 0x17
+#define EFI_ASF_ENTITY_MEMORY 0x20
+#define EFI_ASF_ENTITY_SYSTEM_MGMT_SW 0x21
+#define EFI_ASF_ENTITY_BIOS 0x22
+#define EFI_ASF_ENTITY_OS 0x23
+#define EFI_ASF_ENTITY_REMOTE_OOB_MGMT 0x26
+#define EFI_ASF_ENTITY_INTEL_AMT 0x26
+
+///
+/// ASF Event Data Codes for System Firmware Progress Events
+/// IPMI/PET related stuff
+///
+#define EFI_ASF_FP_EVENT_DATA0 0x40
+
+#define EFI_ASF_FP_UNSPECIFIED 0x00
+#define EFI_ASF_FP_MEMORY_INIT 0x01
+#define EFI_ASF_FP_HDD_INIT 0x02
+#define EFI_ASF_FP_AP_INIT 0x03
+#define EFI_ASF_FP_USER_AUTHENTICATION 0x04
+#define EFI_ASF_FP_USER_SETUP 0x05
+#define EFI_ASF_FP_USB_RESOURCE_CONFIG 0x06
+#define EFI_ASF_FP_PCI_RESOURCE_CONFIG 0x07
+#define EFI_ASF_FP_OPTION_ROM_INIT 0x08
+#define EFI_ASF_FP_VIDEO_INIT 0x09
+#define EFI_ASF_FP_CACHE_INIT 0x0A
+#define EFI_ASF_FP_SMBUS_INIT 0x0B
+#define EFI_ASF_FP_KBC_INIT 0x0C
+#define EFI_ASF_FP_EC_INIT 0x0D
+#define EFI_ASF_FP_AMTBX_INIT 0x0D
+#define EFI_ASF_FP_ATTACH_DOCK 0x0E
+#define EFI_ASF_FP_ENABLE_DOCK 0x0F
+#define EFI_ASF_FP_EJECT_DOCK 0x10
+#define EFI_ASF_FP_DISABLE_DOCK 0x11
+#define EFI_ASF_FP_WAKE_OS 0x12
+#define EFI_ASF_FP_BOOT_OS 0x13
+#define EFI_ASF_FP_BOARD_INIT 0x14
+#define EFI_ASF_FP_RESERVED 0x15
+#define EFI_ASF_FP_FDC_INIT 0x16
+#define EFI_ASF_FP_KBD_TEST 0x17
+#define EFI_ASF_FP_MOUSE_TEST 0x18
+#define EFI_ASF_FP_BSP_INIT 0x19
+
+///
+/// ASF Event Data Codes for System Firmware Error Events
+/// IPMI/PET related stuff
+///
+#define EFI_ASF_FE_EVENT_DATA0 0x40
+
+#define EFI_ASF_FE_UNSPECIFIED 0x00
+#define EFI_ASF_FE_AMTBX_FAILURE 0x00
+#define EFI_ASF_FE_NO_MEMORY 0x01
+#define EFI_ASF_FE_MEMORY_FAILURE 0x02
+#define EFI_ASF_FE_HDD_FAILURE 0x03
+#define EFI_ASF_FE_BOARD_FAILURE 0x04
+#define EFI_ASF_FE_FDC_FAILURE 0x05
+#define EFI_ASF_FE_HDC_FAILURE 0x06
+#define EFI_ASF_FE_KBD_FAILURE 0x07
+#define EFI_ASF_FE_REMOVABLE_BOOT_MEDIA_NOT_FOUND 0x08
+#define EFI_ASF_FE_VIDEO_CONTROLLER_FAILURE 0x09
+#define EFI_ASF_FE_VIDEO_DEVICE_NOT_FOUND 0x0A
+#define EFI_ASF_FE_ROM_CORRUPTED 0x0B
+#define EFI_ASF_FE_CPU_VOLTAGE_FAILURE 0x0C
+#define EFI_ASF_FE_CPU_MISMATCH_FAILURE 0x0D
+
+//
+// AMT BX Software Class DXE Subclass Progress Code definitions.
+//
+#define EFI_SW_DXE_AMTBX_OPROM_DONE (EFI_OEM_SPECIFIC | 0x00000000)
+#define EFI_SW_DXE_AMTBX_OPROM_NOT_STARTED (EFI_OEM_SPECIFIC | 0x00000001)
+#define EFI_SW_DXE_AMTBX_SLEEP_S4_NOT_TAKEN (EFI_OEM_SPECIFIC | 0x00000002)
+#define EFI_SW_DXE_AMTBX_SLEEP_S5_NOT_TAKEN (EFI_OEM_SPECIFIC | 0x00000003)
+#define EFI_SW_DXE_AMTBX_SLEEP_UNSPECD_NOT_TAKEN (EFI_OEM_SPECIFIC | 0x00000004)
+#define EFI_SW_DXE_AMTBX_ERROR_ACTION_INTF (EFI_OEM_SPECIFIC | 0x00000005)
+#define EFI_SW_DXE_AMTBX_ERROR_ACTION_INV (EFI_OEM_SPECIFIC | 0x00000006)
+#define EFI_SW_DXE_AMTBX_ERROR_ACTION_SETUP (EFI_OEM_SPECIFIC | 0x00000007)
+#define EFI_SW_DXE_AMTBX_ERROR_ACTION_FAIL (EFI_OEM_SPECIFIC | 0x00000008)
+#define EFI_SW_DXE_AMTBX_ERROR_ACTION_UNSPECD (EFI_OEM_SPECIFIC | 0x00000009)
+#define EFI_SW_DXE_AMTBX_OTHER_UNSPECD (EFI_OEM_SPECIFIC | 0x00000009)
+
+typedef enum {
+ EfiAsfMessageBiosPresent,
+ EfiAsfMessageMemInit,
+ EfiAsfMessageMemInitDone,
+ EfiAsfMessageHddInit,
+ EfiAsfMessageApInit,
+ EfiAsfMessageUserAuthentication,
+ EfiAsfMessageUserInitSetup,
+ EfiAsfMessageUsbResourceConfig,
+ EfiAsfMessagePciResourceConfig,
+ EfiAsfMessageOptionRomInit,
+ EfiAsfMessageVideoInit,
+ EfiAsfMessageCacheInit,
+ EfiAsfMessageSmbusInit,
+ EfiAsfMessageKbcInit,
+ EfiAsfMessageEmControllerInit,
+ EfiAsfMessageDockAttached,
+ EfiAsfMessageEnableDock,
+ EfiAsfMessageDockEject,
+ EfiAsfMessageDisableDock,
+ EfiAsfMessageOSWakeVector,
+ EfiAsfMessageMotherBoardInit,
+ EfiAsfMessageFdcInit,
+ EfiAsfMessageKeyboardTest,
+ EfiAsfMessageMouseTest,
+ EfiAsfMessageBspInit,
+ EfiAsfMessageAmtBxDone,
+ EfiAsfMessageAmtBxNotStarted,
+ EfiAsfMessageAmtBxSleepS4ReportedNotTaken,
+ EfiAsfMessageAmtBxSleepS5ReportedNotTaken,
+ EfiAsfMessageAmtBxSleepUnspecifiedReportedNotTaken,
+ EfiAsfMessageAmtBxErrActionIntF,
+ EfiAsfMessageAmtBxErrActionInv,
+ EfiAsfMessageAmtBxErrActionSetup,
+ EfiAsfMessageAmtBxErrActionFailure,
+ EfiAsfMessageAmtBxErrActionUnspecified,
+ EfiAsfMessageAmtBxOtherUnspecified,
+ EfiAsfMessageNoMemory,
+ EfiAsfMessageMemoryFailure,
+ EfiAsfMessageHddFailure,
+ EfiAsfMessageBoardFailure,
+ EfiAsfMessageFdcFailure,
+ EfiAsfMessageHdcFailure,
+ EfiAsfMessageKbdFailure,
+ EfiAsfMessageNoFdd,
+ EfiAsfMessageVideoControllerFailure,
+ EfiAsfMessageNoVideo,
+ EfiAsfMessageFirmwareCorruption,
+ EfiAsfMessageCpuVidMismatch,
+ EfiAsfMessageCpuSpeedMatchingFailure,
+ EfiAsfMessageUserAuthenticationInvalid,
+ EfiAsfMessageHddAuthenticationInvalid,
+ EfiAsfMessageNoBootMedia,
+ EfiAsfMessageTemperatureGenericCritical,
+ EfiAsfMessageTemperatureGenericWarning,
+ EfiAsfMessageTemperatureOverCritical,
+ EfiAsfMessageTemperatureOverWarning,
+ EfiAsfMessageTemperatureUnderCritical,
+ EfiAsfMessageTemperatureUnderWarning,
+ EfiAsfMessageVoltageGenericCritical,
+ EfiAsfMessageVoltageOverCritical,
+ EfiAsfMessageVoltageUnderCritical,
+ EfiAsfMessageFanGenericCritical,
+ EfiAsfMessageFanPredictiveFailure,
+ EfiAsfMessageFanLowSpeedCritical,
+ EfiAsfMessageFanLowSpeedWarning,
+ EfiAsfMessageBatteryLowWarning,
+ EfiAsfMessageBatteryLowCritical,
+ EfiAsfMessageBatteryPresenceDetected,
+ EfiAsfMessagePowerFailure,
+ EfiAsfMessageChassisIntrusion,
+} EFI_FRAMEWORK_MESSAGE_TYPE;
+
+//
+// StatusCode extension for ASF -- start
+//
+#define EFI_CU_HP_EC_VID_MISMATCH (EFI_SUBCLASS_SPECIFIC | 0x0000000E)
+#define EFI_CU_HP_EC_SPEED_MATCHING_FAILURE (EFI_SUBCLASS_SPECIFIC | 0x0000000F)
+
+#define EFI_PERIPHERAL_EMBEDDED_CONTROLLER (EFI_PERIPHERAL | 0x000D0000)
+#define EFI_PERIPHERAL_DOCK (EFI_PERIPHERAL | 0x000E0000)
+
+#define EFI_PERIPHERAL_BATTERY (EFI_PERIPHERAL | 0x000F0000)
+#define EFI_P_BATTERY_PC_LOW_WARNING (EFI_SUBCLASS_SPECIFIC | 0x00000000)
+#define EFI_P_BATTERY_EC_LOW_CRITICAL (EFI_SUBCLASS_SPECIFIC | 0x00000000)
+
+#define EFI_PERIPHERAL_FAN (EFI_PERIPHERAL | 0x00100000)
+#define EFI_P_FAN_EC_GENERIC_CRITICAL (EFI_SUBCLASS_SPECIFIC | 0x00000000)
+#define EFI_P_FAN_EC_PREDICTIVE_FAILURE (EFI_SUBCLASS_SPECIFIC | 0x00000001)
+#define EFI_P_FAN_EC_LOW_SPEED_CRITICAL (EFI_SUBCLASS_SPECIFIC | 0x00000002)
+#define EFI_P_FAN_PC_LOW_SPEED_WARNING (EFI_SUBCLASS_SPECIFIC | 0x00000002)
+
+#define EFI_PERIPHERAL_TEMPERATURE (EFI_PERIPHERAL | 0x00110000)
+#define EFI_P_TEMERATURE_EC_GENERIC_CRITICAL (EFI_SUBCLASS_SPECIFIC | 0x00000000)
+#define EFI_P_TEMERATURE_PC_GENERIC_WARNING (EFI_SUBCLASS_SPECIFIC | 0x00000000)
+#define EFI_P_TEMERATURE_EC_OVER_CRITICAL (EFI_SUBCLASS_SPECIFIC | 0x00000001)
+#define EFI_P_TEMERATURE_PC_OVER_WARNING (EFI_SUBCLASS_SPECIFIC | 0x00000001)
+#define EFI_P_TEMERATURE_EC_UNDER_CRITICAL (EFI_SUBCLASS_SPECIFIC | 0x00000002)
+#define EFI_P_TEMERATURE_PC_UNDER_WARNING (EFI_SUBCLASS_SPECIFIC | 0x00000002)
+
+#define EFI_PERIPHERAL_VOLTAGE (EFI_PERIPHERAL | 0x00120000)
+#define EFI_P_VOLTAGE_EC_GENERIC_CRITICAL (EFI_SUBCLASS_SPECIFIC | 0x00000000)
+#define EFI_P_VOLTAGE_EC_OVER_CRITICAL (EFI_SUBCLASS_SPECIFIC | 0x00000001)
+#define EFI_P_VOLTAGE_EC_UNDER_CRITICAL (EFI_SUBCLASS_SPECIFIC | 0x00000002)
+
+#define EFI_PERIPHERAL_POWER_SUPPLY (EFI_PERIPHERAL | 0x00130000)
+#define EFI_P_POWER_SUPPLY_EC_FAILURE (EFI_SUBCLASS_SPECIFIC | 0x00000000)
+#define EFI_P_POWER_SUPPLY_EC_PREDICTIVE_FAILURE (EFI_SUBCLASS_SPECIFIC | 0x00000001)
+
+#define EFI_CU_CHIPSET_PC_INTRUDER_DETECT (EFI_SUBCLASS_SPECIFIC | 0x00000000)
+
+#define EFI_SW_DXE_BS_EC_NO_BOOT_MEDIA (EFI_SUBCLASS_SPECIFIC | 0x00000001)
+#define EFI_SW_DXE_BS_EC_AUTHENTICATE_USER_INVALID (EFI_SUBCLASS_SPECIFIC | 0x00000002)
+#define EFI_SW_DXE_BS_EC_AUTHENTICATE_HDD_INVALID (EFI_SUBCLASS_SPECIFIC | 0x00000003)
+
+//
+// StatusCode extension for ASF -- end
+//
+#endif
diff --git a/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Common/AlertStandardFormatCommon.sdl b/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Common/AlertStandardFormatCommon.sdl
new file mode 100644
index 0000000..8ec0f9c
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Common/AlertStandardFormatCommon.sdl
@@ -0,0 +1,10 @@
+PATH
+ Name = "AlertStandardFormatCommon_DIR"
+ Help = "AlertStandardFormat files source directory"
+End
+
+ELINK
+ Name = "/I$(AlertStandardFormatCommon_DIR)"
+ Parent = "AlertStandardFormat_INCLUDES"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Dxe/AlertStandardFormatDxe.c b/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Dxe/AlertStandardFormatDxe.c
new file mode 100644
index 0000000..5119b8e
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Dxe/AlertStandardFormatDxe.c
@@ -0,0 +1,1234 @@
+/** @file
+ Processes ASF messages
+
+@copyright
+ Copyright (c) 2005 - 2012 Intel Corporation. All rights
+ reserved This software and associated documentation (if any)
+ is furnished under a license and may only be used or copied in
+ accordance with the terms of the license. Except as permitted
+ by such license, no part of this software or documentation may
+ be reproduced, stored in a retrieval system, or transmitted in
+ any form or by any means without the express written consent
+ of Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "AlertStandardFormatDxe.h"
+#include "MeLib.h"
+#endif
+
+#include "AlertStandardFormatCommon.c"
+
+UINT64 mAsfMonotonicCount;
+EFI_ASF_BOOT_OPTIONS mAsfBootOptions;
+BOOLEAN mBootOptionsValid;
+BOOLEAN mAsfAddressValid;
+BOOLEAN mProgressEventEnabled;
+
+ALERT_STANDARD_FORMAT_INSTANCE *mAsfContext;
+
+EFI_GUID gAmtForcePushPetVariableGuid = AMT_FORCE_PUSH_PET_VARIABLE_GUID;
+EFI_GUID gAmtPetQueueHobGuid = AMT_PET_QUEUE_HOB_GUID;
+EFI_GUID gAmtForcePushPetHobGuid = AMT_FORCE_PUSH_PET_HOB_GUID;
+
+AMT_PET_QUEUE_PROTOCOL gAmtPetQueue;
+AMT_PET_QUEUE_PROTOCOL *gAmtPetQueueProtocol;
+AMT_FORCE_PUSH_PET_POLICY_HOB *gAmtForcePushPETPolicyHob;
+
+/**
+ Update ASF Boot Options data in ACPI ASF RCMP table
+
+ @param[in] AsfBootOptions ASF Boot Options data for ACPI ASF RCMP table used
+**/
+VOID
+UpdateAcpiAsfRcmpBootOptions (
+ EFI_ASF_BOOT_OPTIONS *AsfBootOptions
+ )
+{
+ EFI_STATUS Status;
+ EFI_ACPI_1_0_ASF_DESCRIPTION_TABLE *AcpiAsfTable;
+ UINTN Handle;
+ UINTN VersionCount;
+ UINT16 *WordPointer;
+ EFI_ACPI_TABLE_VERSION Version[] = {
+ EFI_ACPI_TABLE_VERSION_1_0B,
+ EFI_ACPI_TABLE_VERSION_2_0,
+ EFI_ACPI_TABLE_VERSION_3_0
+ };
+ EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
+
+ ///
+ /// Locate ACPI Table Protocol
+ ///
+ Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **) &AcpiTable);
+
+ ///
+ /// Initialize ASL manipulation library
+ ///
+ InitializeAslUpdateLib ();
+
+ for (VersionCount = 0; VersionCount < sizeof (Version) / sizeof (EFI_ACPI_TABLE_VERSION); VersionCount++) {
+ Handle = 0;
+ ///
+ /// Locate the ASF Table
+ ///
+ Status = LocateAcpiTableBySignature (
+ EFI_ACPI_1_0_ASF_DESCRIPTION_TABLE_SIGNATURE,
+ (EFI_ACPI_DESCRIPTION_HEADER **) &AcpiAsfTable,
+ &Handle,
+ &Version[VersionCount]
+ );
+ if (EFI_ERROR (Status)) {
+ continue;
+ }
+
+ if (AsfBootOptions->SubCommand == ASF_BOOT_OPTIONS_PRESENT) {
+ ///
+ /// Check Asf table if get boot option successfully
+ ///
+ AcpiAsfTable->AsfRmcp.RMCPCompletionCode = 00;
+ AcpiAsfTable->AsfRmcp.RMCPIANA = AsfBootOptions->IanaId;
+ AcpiAsfTable->AsfRmcp.RMCPSpecialCommand = AsfBootOptions->SpecialCommand;
+ WordPointer = (UINT16 *) &AcpiAsfTable->AsfRmcp.RMCPSpecialCommandParameter;
+ *WordPointer = AsfBootOptions->SpecialCommandParam;
+ WordPointer = (UINT16 *) &AcpiAsfTable->AsfRmcp.RMCPBootOptions;
+ *WordPointer = AsfBootOptions->BootOptions;
+ WordPointer = (UINT16 *) &AcpiAsfTable->AsfRmcp.RMCPOEMParameters;
+ *WordPointer = AsfBootOptions->OemParameters;
+ } else {
+ ///
+ /// Failed to get boot option, update the completion code to 0x1
+ ///
+ AcpiAsfTable->AsfRmcp.RMCPCompletionCode = 01;
+ }
+ if (Handle != 0) {
+ Status = AcpiTable->UninstallAcpiTable (
+ AcpiTable,
+ Handle
+ );
+ }
+ ///
+ /// Update the Acpi Asf table
+ ///
+ Status = AcpiTable->InstallAcpiTable (
+ AcpiTable,
+ AcpiAsfTable,
+ sizeof(EFI_ACPI_1_0_ASF_DESCRIPTION_TABLE),
+ &Handle
+ );
+ FreePool (AcpiAsfTable);
+ }
+}
+
+/**
+ 16 bits are changed backward for string transfer to value used
+
+ @param[in] Value The value to be transferred
+
+ @retval UINT16 Value The value after transferring
+**/
+UINT16
+Swap16 (
+ IN UINT16 Value
+ )
+{
+ UINT16 OutValue;
+ UINT8 *TempIn;
+ UINT8 *TempOut;
+
+ TempIn = (UINT8 *) &Value;
+ TempOut = (UINT8 *) &OutValue;
+
+ TempOut[0] = TempIn[1];
+ TempOut[1] = TempIn[0];
+
+ return OutValue;
+}
+
+/**
+ The driver entry point - detect ASF support or not, if support, will install relative protocol.
+
+ @param[in] ImageHandle Handle for this drivers loaded image protocol.
+ @param[in] SystemTable EFI system table.
+
+ @retval EFI_SUCCESS The driver installed without error.
+ @exception EFI_UNSUPPORTED The chipset is unsupported by this driver.
+ @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary data structures.
+**/
+EFI_STATUS
+EFIAPI
+AlertStandardFormatDriverEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ EFI_DATA_HUB_PROTOCOL *DataHub;
+ EFI_EVENT DataHubEvent;
+ UINT64 DataClass;
+ EFI_ASF_BOOT_OPTIONS *AsfBootOptions;
+
+ ///
+ /// First check if ASF support is enabled in Setup.
+ ///
+ if (!AsfSupported ()) {
+ return EFI_UNSUPPORTED;
+ }
+
+ mBootOptionsValid = FALSE;
+ mAsfAddressValid = FALSE;
+
+ mAsfContext = AllocateZeroPool (sizeof (ALERT_STANDARD_FORMAT_INSTANCE));
+ ASSERT (mAsfContext != NULL);
+ if (mAsfContext == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ ///
+ /// Get the Data Hub Protocol. Assume only one instance
+ /// of Data Hub Protocol is available in the system.
+ ///
+ Status = gBS->LocateProtocol (
+ &gEfiDataHubProtocolGuid,
+ NULL,
+ (VOID **) &DataHub
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ mAsfContext->Handle = ImageHandle;
+ mAsfContext->Signature = ALERT_STANDARD_FORMAT_PRIVATE_DATA_SIGNATURE;
+ mAsfContext->AlertStandardFormat.GetSmbusAddr = GetSmbusAddr;
+ mAsfContext->AlertStandardFormat.SetSmbusAddr = SetSmbusAddr;
+ mAsfContext->AlertStandardFormat.GetBootOptions = GetBootOptions;
+ mAsfContext->AlertStandardFormat.SendAsfMessage = SendAsfMessage;
+
+ ///
+ /// Sending ASF Messaging if ManageabilityMode is not zero
+ ///
+ if (ManageabilityModeSetting () != MNT_OFF) {
+ ///
+ /// ActiveManagement Protocol is not ready at this point. Need to Check Boot Options Manually
+ ///
+ mProgressEventEnabled = FALSE;
+ Status = GetBootOptions (&(mAsfContext->AlertStandardFormat), &AsfBootOptions);
+ if (!EFI_ERROR (Status)) {
+ if (AsfBootOptions->SubCommand == ASF_BOOT_OPTIONS_PRESENT) {
+ if ((AsfBootOptions->BootOptions & FORCE_PROGRESS_EVENTS) == FORCE_PROGRESS_EVENTS) {
+ mProgressEventEnabled = TRUE;
+ }
+ }
+ }
+ ///
+ /// If no boot options available, check policy
+ ///
+ if (!mProgressEventEnabled) {
+ mProgressEventEnabled = FwProgressSupport ();
+ }
+ ///
+ /// Create message queue
+ ///
+ AmtCreateMessageQueue ();
+
+ ///
+ /// Get ForcePushPetPolicy Hob
+ ///
+ gAmtForcePushPETPolicyHob = GetForcePushPetPolicy ();
+
+ ///
+ /// save PEI force push error event from hob to variable
+ ///
+ SaveForcePushErrorEventFromPeiToDxe ();
+
+ ///
+ /// Try to send message
+ ///
+ SendPETMessageInQueue ();
+
+ ///
+ /// Register our Setup Data Filter Function.
+ /// This function is notified at the lowest TPL
+ ///
+ Status = gBS->CreateEvent (
+ EVENT_NOTIFY_SIGNAL,
+ TPL_CALLBACK,
+ DataHubEventCallback,
+ NULL,
+ &DataHubEvent
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ if (mProgressEventEnabled) {
+ DataClass = EFI_DATA_RECORD_CLASS_ERROR | EFI_DATA_RECORD_CLASS_PROGRESS_CODE;
+ } else {
+ DataClass = EFI_DATA_RECORD_CLASS_ERROR;
+ }
+
+ Status = DataHub->RegisterFilterDriver (
+ DataHub,
+ DataHubEvent,
+ EFI_TPL_APPLICATION,
+ DataClass,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
+ ///
+ /// Install the AlertStandardFormat interface
+ ///
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &mAsfContext->Handle,
+ &gEfiAlertStandardFormatProtocolGuid,
+ &mAsfContext->AlertStandardFormat,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ return Status;
+}
+
+/**
+ Return the SMBus address used by the ASF driver.
+ Not applicable in Intel ME/HECI system, need to return EFI_UNSUPPORTED.
+
+ @param[in] This The address of protocol
+ @param[in] SmbusDeviceAddress Out put the Smbus Address
+
+ @exception EFI_UNSUPPORTED The function is unsupported by this driver
+**/
+EFI_STATUS
+EFIAPI
+GetSmbusAddr (
+ IN EFI_ALERT_STANDARD_FORMAT_PROTOCOL *This,
+ OUT UINTN *SmbusDeviceAddress
+ )
+{
+ return EFI_UNSUPPORTED;
+}
+
+/**
+ Set the SMBus address used by the ASF driver. 0 is an invalid address.
+ Not applicable in Intel ME/HECI system, need to return EFI_UNSUPPORTED.
+
+ @param[in] This The address of protocol
+ @param[in] SmbusDeviceAddress SMBus address of the device
+
+ @exception EFI_UNSUPPORTED The function is unsupported by this driver
+**/
+EFI_STATUS
+EFIAPI
+SetSmbusAddr (
+ IN EFI_ALERT_STANDARD_FORMAT_PROTOCOL *This,
+ IN UINTN SmbusDeviceAddress
+ )
+{
+ return EFI_UNSUPPORTED;
+}
+
+/**
+ Return EFI_SUCCESS if Firmware Init Complete is set in HFS[9].
+
+ @param[in] Heci EFI_HECI_PROTOCOL
+ @param[in] Timeout Time in second
+
+ @retval EFI_SUCCESS Firmware Init Complete is set
+ @retval EFI_TIMEOUT Firmware Init Complete is not set in 5 seconds
+**/
+EFI_STATUS
+WaitFirmwareInitDone (
+ EFI_HECI_PROTOCOL *Heci,
+ UINT32 Timeout
+ )
+{
+ UINT32 idx;
+ EFI_STATUS Status;
+ UINT32 MeStatus;
+
+ Status = EFI_SUCCESS;
+ idx = 0;
+
+ Heci->GetMeStatus (&MeStatus);
+
+ while (!ME_STATUS_IS_ME_FW_INIT_COMPLETE (MeStatus)) {
+ gBS->Stall (100000);
+ idx++;
+ if (idx > Timeout * 10) {
+ Status = EFI_TIMEOUT;
+ break;
+ }
+
+ Heci->GetMeStatus (&MeStatus);
+ }
+
+ return Status;
+}
+
+/**
+ Initialize KVM by sending HECI messafe to ME
+
+ @param[in] Event The event registered.
+ @param[in] Context Event context. Not used in this event handler.
+**/
+VOID
+EFIAPI
+QueryKvm (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ BdsKvmInitialization ();
+ gBS->CloseEvent (Event);
+}
+
+/**
+ Return the ASF Boot Options obtained from the controller. If the
+ Boot Options parameter is NULL and no boot options have been retrieved,
+ Query the ASF controller for its boot options.
+ Get ASF Boot Options through HECI.
+
+ @param[in] This The address of protocol
+ @param[in] AsfBootOptions Pointer to ASF boot options to copy current ASF Boot options
+
+ @retval EFI_SUCCESS Boot options copied
+ @retval EFI_NOT_READY No boot options
+**/
+EFI_STATUS
+EFIAPI
+GetBootOptions (
+ IN EFI_ALERT_STANDARD_FORMAT_PROTOCOL *This,
+ IN OUT EFI_ASF_BOOT_OPTIONS **AsfBootOptions
+ )
+{
+ EFI_STATUS Status;
+ UINT8 ConsoleLock;
+ UINT32 MeStatus;
+ UINT32 MeMode;
+ EFI_STATUS TempStatus;
+ VOID *AfterConsolOutNotifyReg;
+ EFI_EVENT AfterConsolOutInstalledEvent;
+ EFI_GUID guidConOutStarted = EFI_CONSOLE_OUT_DEVICE_GUID;
+ EFI_HECI_PROTOCOL *Heci;
+ HECI_ASF_GET_BOOT_OPTIONS_RESPONSE HeciAsfGetBootOptionsResponse;
+ HECI_ASF_CLEAR_BOOT_OPTION HeciAsfClearBootOption;
+ UINT32 HeciLength;
+
+ if (!mBootOptionsValid) {
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "ASF Get Boot Options failed!, Status = %r\n", Status));
+ return Status;
+ }
+
+ ZeroMem ((VOID *) &mAsfBootOptions, sizeof (EFI_ASF_BOOT_OPTIONS));
+ mAsfBootOptions.SubCommand = ASF_BOOT_OPTIONS_NOT_PRESENT;
+ mAsfBootOptions.Version = 0x10;
+ UpdateAcpiAsfRcmpBootOptions (&mAsfBootOptions);
+
+ ///
+ /// Get ME Status
+ ///
+ TempStatus = Heci->GetMeStatus (&MeStatus);
+ ASSERT_EFI_ERROR (TempStatus);
+
+ ///
+ /// Get ME Operation Mode
+ ///
+ Heci->GetMeMode (&MeMode);
+
+ ///
+ /// Only Send ASF Get Boot Options message when ME is ready and ME FW INIT is completed
+ ///
+ if (ME_STATUS_IS_ME_FW_BOOT_OPTIONS_PRESENT (MeStatus) &&
+ (ManageabilityModeSetting () != MNT_OFF) &&
+ (MeMode == ME_MODE_NORMAL)
+ ) {
+ if (WaitFirmwareInitDone (Heci, 5) != EFI_TIMEOUT) {
+ ///
+ /// Prepare Boot Option Command header
+ ///
+ HeciAsfGetBootOptionsResponse.Command = EFI_ASF_MESSAGE_COMMAND_ASF_CONFIGURATION;
+ HeciAsfGetBootOptionsResponse.ByteCount = EFI_ASF_MESSAGE_BYTEOUNTT_GET_BOOT_OPT;
+ HeciAsfGetBootOptionsResponse.AsfBootOptions.SubCommand = EFI_ASF_MESSAGE_SUBCOMMAND_RETURN_BOOT_OPT;
+ HeciAsfGetBootOptionsResponse.AsfBootOptions.Version = 0x10;
+ HeciLength = HECI_ASF_GET_BOOT_OPTIONS_LENGTH;
+ Status = Heci->SendMsg (
+ (UINT32 *) &HeciAsfGetBootOptionsResponse,
+ HeciLength,
+ BIOS_ASF_HOST_ADDR,
+ HECI_ASF_MESSAGE_ADDR
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "ASF Get Boot Options failed!(SendwACK), Status = %r\n", Status));
+ return Status;
+ }
+
+ HeciLength = HECI_ASF_GET_BOOT_OPTIONS_RESPONSE_LENGTH;
+ Status = Heci->ReadMsg (
+ BLOCKING,
+ (UINT32 *) &HeciAsfGetBootOptionsResponse,
+ &HeciLength
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "ASF Get Boot Options failed!(ReadMsg), Status = %r\n", Status));
+ return Status;
+ }
+
+ CopyMem (
+ (VOID *) &mAsfBootOptions,
+ (VOID *) &(HeciAsfGetBootOptionsResponse.AsfBootOptions),
+ sizeof (EFI_ASF_BOOT_OPTIONS)
+ );
+
+ ///
+ /// By default, this table is belong to all ACPI table versions.
+ /// It is ok if the table is not found and that means the platform does not publish that version.
+ ///
+ UpdateAcpiAsfRcmpBootOptions (&mAsfBootOptions);
+
+ mAsfBootOptions.SpecialCommandParam = Swap16 (mAsfBootOptions.SpecialCommandParam);
+
+ ///
+ /// ASF Get Boot Options - Clear Boot Options
+ /// Need to do this so don't get caught in an endless loop plus by
+ /// definition get boot options is a one time boot situation.
+ /// So if server on other end of ASF device wants another back to back
+ /// boot it will request it. Do this only if there were boot options
+ ///
+ if (mAsfBootOptions.SubCommand == ASF_BOOT_OPTIONS_PRESENT) {
+ HeciAsfClearBootOption.Command = EFI_ASF_MESSAGE_COMMAND_ASF_CONFIGURATION;
+ HeciAsfClearBootOption.AsfClearBootOptions.SubCommand = EFI_ASF_MESSAGE_SUBCOMMAND_CLEAR_BOOT_OPT;
+ HeciAsfClearBootOption.AsfClearBootOptions.Version = EFI_ASF_MESSAGE_VERSIONNUMBER;
+ HeciAsfClearBootOption.ByteCount = EFI_ASF_MESSAGE_BYTECOUNT_CLEAR_BOOT_OPT;
+ HeciLength = HECI_ASF_CLEAR_BOOT_OPTION_LENGTH;
+
+ Status = Heci->SendMsg (
+ (UINT32 *) &HeciAsfClearBootOption,
+ HeciLength,
+ BIOS_ASF_HOST_ADDR,
+ HECI_ASF_MESSAGE_ADDR
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "ASF Clear Boot Options failed!, Status = %r\n", Status));
+ return Status;
+ }
+ }
+ }
+ }
+ ///
+ /// Set flag so we don't try to get the Boot options again.
+ ///
+ mBootOptionsValid = TRUE;
+
+ ///
+ /// Set up Event for KVM for when Output Display Console is installed
+ ///
+ if ((mAsfBootOptions.SpecialCommandParam & USE_KVM) == USE_KVM) {
+
+ Status = gBS->CreateEvent (
+ EFI_EVENT_NOTIFY_SIGNAL,
+ EFI_TPL_NOTIFY,
+ QueryKvm,
+ NULL,
+ &AfterConsolOutInstalledEvent
+ );
+
+ Status = gBS->RegisterProtocolNotify (
+ &guidConOutStarted,
+ AfterConsolOutInstalledEvent,
+ &AfterConsolOutNotifyReg
+ );
+
+ }
+ ///
+ /// Check for keyboard locking in the boot options
+ ///
+ ConsoleLock = NO_LOCK_CONSOLE;
+
+ if (mAsfBootOptions.SubCommand == ASF_BOOT_OPTIONS_PRESENT) {
+ if ((mAsfBootOptions.BootOptions & LOCK_KEYBOARD) == LOCK_KEYBOARD) {
+ ConsoleLock = LOCK_CONSOLE;
+ }
+ }
+ ///
+ /// Save the console lock flag for later usage in console locking determination
+ ///
+ gRT->SetVariable (
+ EFI_CONSOLE_LOCK_VARIABLE_NAME,
+ &gEfiConsoleLockGuid,
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
+ sizeof (ConsoleLock),
+ &ConsoleLock
+ );
+ }
+
+ if (AsfBootOptions) {
+ *AsfBootOptions = &mAsfBootOptions;
+
+ ///
+ /// If we're asking for the options, then resend them to the debug output just encase they've been hosed.
+ ///
+ DEBUG ((EFI_D_ERROR, "mAsfBootOptions.SubCommand = 0x%x\n", mAsfBootOptions.SubCommand));
+ DEBUG ((EFI_D_ERROR, "mAsfBootOptions.Version = 0x%x\n", mAsfBootOptions.Version));
+ DEBUG ((EFI_D_ERROR, "mAsfBootOptions.IanaId = 0x%x\n", mAsfBootOptions.IanaId));
+ DEBUG ((EFI_D_ERROR, "mAsfBootOptions.SpecialCommand = 0x%x\n", mAsfBootOptions.SpecialCommand));
+ DEBUG ((EFI_D_ERROR, "mAsfBootOptions.SpecialCommandParam = 0x%x\n", mAsfBootOptions.SpecialCommandParam));
+ DEBUG ((EFI_D_ERROR, "mAsfBootOptions.BootOptions = 0x%x\n", mAsfBootOptions.BootOptions));
+ DEBUG ((EFI_D_ERROR, "mAsfBootOptions.OemParameters = 0x%x\n", mAsfBootOptions.OemParameters));
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Send ASF Message through HECI.
+
+ @param[in] This The address of protocol
+ @param[in] AsfMessage Pointer to ASF message
+
+ @retval EFI_SUCCESS Boot options copied
+ @retval EFI_INVALID_PARAMETER Invalid pointer
+ @retval EFI_NOT_READY No controller
+**/
+EFI_STATUS
+EFIAPI
+SendAsfMessage (
+ IN EFI_ALERT_STANDARD_FORMAT_PROTOCOL *This,
+ IN EFI_ASF_MESSAGE *AsfMessage
+ )
+{
+ EFI_STATUS Status;
+ EFI_HECI_PROTOCOL *Heci;
+ UINT32 HeciLength;
+ HECI_ASF_PUSH_PROGRESS_CODE HeciAsfPushProgressCode;
+ UINT32 MeStatus;
+ UINT32 MeMode;
+ EFI_STATUS TempStatus;
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+
+ if (!EFI_ERROR (Status)) {
+ TempStatus = Heci->GetMeStatus (&MeStatus);
+ ASSERT_EFI_ERROR (TempStatus);
+
+ ///
+ /// Get ME Operation Mode
+ ///
+ Heci->GetMeMode (&MeMode);
+
+ ///
+ /// Only send ASF Push Progress code when ME is ready and ME is in normal mode. Ignore FW Init Status.
+ ///
+ if (ME_STATUS_ME_STATE_ONLY (MeStatus) == ME_READY && MeMode == ME_MODE_NORMAL) {
+ ZeroMem ((VOID *) &HeciAsfPushProgressCode, sizeof (HECI_ASF_PUSH_PROGRESS_CODE));
+ HeciAsfPushProgressCode.Command = EFI_ASF_MESSAGE_COMMAND_MESSAGE;
+ HeciAsfPushProgressCode.ByteCount = 0x10;
+ HeciLength = HECI_ASF_PUSH_PROGRESS_CODE_LENGTH;
+ CopyMem ((VOID *) &(HeciAsfPushProgressCode.AsfMessage), (VOID *) AsfMessage, sizeof (EFI_ASF_MESSAGE));
+
+ Status = Heci->SendMsg (
+ (UINT32 *) &HeciAsfPushProgressCode,
+ HeciLength,
+ BIOS_ASF_HOST_ADDR,
+ HECI_ASF_MESSAGE_ADDR
+ );
+ }
+ }
+
+ return Status;
+}
+
+/**
+ This routine returns ForcePushPetPolicy information.
+
+ @param[in] None
+
+ @retval AMT_FORCE_PUSH_PET_POLICY_HOB ForcePushPetPolicy information.
+**/
+AMT_FORCE_PUSH_PET_POLICY_HOB *
+GetForcePushPetPolicy (
+ VOID
+ )
+{
+ AMT_FORCE_PUSH_PET_POLICY_HOB *AmtForcePushPETPolicyHob;
+ EFI_STATUS Status;
+
+ Status = EfiGetSystemConfigurationTable (&gEfiHobListGuid, (VOID **) &AmtForcePushPETPolicyHob);
+ ASSERT_EFI_ERROR (Status);
+
+ return GetNextGuidHob (&gAmtForcePushPetPolicyGuid, AmtForcePushPETPolicyHob);
+}
+
+/**
+ This routine checks whethre current message is ForcePush message.
+
+ @param[in] MessageType AMT PET Message Type.
+
+ @retval TRUE It is ForcePush message.
+ @retval FALSE It is not ForcePush message.
+**/
+BOOLEAN
+IsForcePushErrorEvent (
+ IN EFI_FRAMEWORK_MESSAGE_TYPE MessageType
+ )
+{
+ UINTN Index;
+ UINTN Number;
+
+ Number = (gAmtForcePushPETPolicyHob->EfiHobGuidType.Header.HobLength - sizeof (EFI_HOB_GUID_TYPE)) /
+ sizeof (EFI_FRAMEWORK_MESSAGE_TYPE);
+ for (Index = 0; Index < Number; Index++) {
+ if (gAmtForcePushPETPolicyHob->MessageType[Index] == MessageType) {
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+/**
+ Filters all the progress and error codes for Asf.
+
+ @param[in] Event The event registered.
+ @param[in] Context Event context. Not used in this event handler.
+**/
+VOID
+EFIAPI
+DataHubEventCallback (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ EFI_STATUS Status;
+ EFI_DATA_HUB_PROTOCOL *DataHub;
+ EFI_DATA_RECORD_HEADER *Record;
+ DATA_HUB_STATUS_CODE_DATA_RECORD *StatusRecord;
+ UINTN Index;
+
+ ///
+ /// Get the Data Hub Protocol. Assume only one instance
+ ///
+ Status = gBS->LocateProtocol (&gEfiDataHubProtocolGuid, NULL, (VOID **) &DataHub);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Get all available data records from data hub
+ ///
+ Record = NULL;
+
+ do {
+ Status = DataHub->GetNextRecord (DataHub, &mAsfMonotonicCount, &Event, &Record);
+ if (!EFI_ERROR (Status)) {
+ if (mProgressEventEnabled) {
+ if (Record->DataRecordClass == EFI_DATA_RECORD_CLASS_PROGRESS_CODE) {
+ StatusRecord = (DATA_HUB_STATUS_CODE_DATA_RECORD *) (Record + 1);
+ for (Index = 0; Index < sizeof (mAsfProgressDataHubMap) / sizeof (EFI_ASF_DATA_HUB_MAP); Index++) {
+ if (mAsfProgressDataHubMap[Index].StatusCodeValue == StatusRecord->Value) {
+ Status = SendPostPacket (mAsfProgressDataHubMap[Index].MessageType);
+ break;
+ }
+ }
+ }
+ }
+
+ if (Record->DataRecordClass == EFI_DATA_RECORD_CLASS_ERROR) {
+ StatusRecord = (DATA_HUB_STATUS_CODE_DATA_RECORD *) (Record + 1);
+ for (Index = 0; Index < sizeof (mAsfErrorDataHubMap) / sizeof (EFI_ASF_DATA_HUB_MAP); Index++) {
+ if (mAsfErrorDataHubMap[Index].StatusCodeValue == StatusRecord->Value) {
+ Status = SendPostPacket (mAsfErrorDataHubMap[Index].MessageType);
+ if ((Status == EFI_DEVICE_ERROR) && IsForcePushErrorEvent (mAsfErrorDataHubMap[Index].MessageType)) {
+ SaveForcePushErrorEvent (mAsfErrorDataHubMap[Index].MessageType);
+ }
+ break;
+ }
+ }
+ }
+ }
+ } while (!EFI_ERROR (Status) && (mAsfMonotonicCount != 0));
+}
+
+/**
+ Sends a POST packet across ASF
+
+ @param[in] MessageType POST Status Code
+
+ @retval EFI_DEVICE_ERROR No message found
+ @retval EFI_SUCCESS Boot options copied
+ @retval EFI_INVALID_PARAMETER Invalid pointer
+ @retval EFI_NOT_READY No controller
+**/
+EFI_STATUS
+SendPostPacket (
+ IN EFI_FRAMEWORK_MESSAGE_TYPE MessageType
+ )
+{
+ EFI_STATUS Status;
+ UINTN Index;
+
+ Status = EFI_DEVICE_ERROR;
+ ///
+ /// Find the message to send across the wire
+ ///
+ for (Index = 0; Index < sizeof (mAsfFrameworkMessage) / sizeof (EFI_ASF_FRAMEWORK_MESSAGE); Index++) {
+ if (mAsfFrameworkMessage[Index].MessageType == MessageType) {
+ Status = SendAsfMessage (NULL, &mAsfFrameworkMessage[Index].Message);
+ break;
+ }
+ }
+
+ return Status;
+}
+
+/**
+ Provides an interface that a software module can call to report an ASF DXE status code.
+
+ @param[in] Type Indicates the type of status code being reported.
+ @param[in] Value Describes the current status of a hardware or software entity.
+ This included information about the class and subclass that is
+ used to classify the entity as well as an operation.
+ @param[in] Instance The enumeration of a hardware or software entity within
+ the system. Valid instance numbers start with 1.
+ @param[in] CallerId This optional parameter may be used to identify the caller.
+ This parameter allows the status code driver to apply different
+ rules to different callers.
+ @param[in] Data This optional parameter may be used to pass additional data.
+
+ @retval EFI_SUCCESS The function completed successfully
+ @retval EFI_DEVICE_ERROR The function should not be completed due to a device error.
+**/
+EFI_STATUS
+EFIAPI
+AmtReportStatusCode (
+ IN EFI_STATUS_CODE_TYPE Type,
+ IN EFI_STATUS_CODE_VALUE Value,
+ IN UINT32 Instance,
+ IN EFI_GUID * CallerId OPTIONAL,
+ IN EFI_STATUS_CODE_DATA * Data OPTIONAL
+ )
+{
+ UINTN Index;
+ EFI_STATUS Status;
+
+ if (mProgressEventEnabled) {
+ if ((Type & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) {
+ for (Index = 0; Index < sizeof (mAsfProgressDataHubMap) / sizeof (EFI_ASF_DATA_HUB_MAP); Index++) {
+ if (mAsfProgressDataHubMap[Index].StatusCodeValue == Value) {
+ return SendPostPacket (mAsfProgressDataHubMap[Index].MessageType);
+ }
+ }
+ }
+ }
+
+ if ((Type & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) {
+ for (Index = 0; Index < sizeof (mAsfErrorDataHubMap) / sizeof (EFI_ASF_DATA_HUB_MAP); Index++) {
+ if (mAsfErrorDataHubMap[Index].StatusCodeValue == Value) {
+ Status = SendPostPacket (mAsfErrorDataHubMap[Index].MessageType);
+ if ((Status == EFI_DEVICE_ERROR) && IsForcePushErrorEvent (mAsfErrorDataHubMap[Index].MessageType)) {
+ SaveForcePushErrorEvent (mAsfErrorDataHubMap[Index].MessageType);
+ }
+
+ return Status;
+ }
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This routine puts PET message to MessageQueue, which will be sent later.
+
+ @param[in] Type StatusCode message type.
+ @param[in] Value StatusCode message value.
+
+ @retval EFI_SUCCESS The function completed successfully
+ @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary data structures
+**/
+EFI_STATUS
+QueuePetMessage (
+ IN EFI_STATUS_CODE_TYPE Type,
+ IN EFI_STATUS_CODE_VALUE Value
+ )
+{
+ AMT_PET_QUEUE_NODE *NewNode;
+
+ NewNode = AllocateZeroPool (sizeof (AMT_PET_QUEUE_NODE));
+ ASSERT (NewNode != NULL);
+ if (NewNode == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ NewNode->Signature = AMT_PET_QUEUE_NODE_SIGNATURE;
+ NewNode->Type = Type;
+ NewNode->Value = Value;
+ InsertTailList ((LIST_ENTRY *) &gAmtPetQueueProtocol->MessageList, (LIST_ENTRY *) &NewNode->Link);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This routine sends PET message in MessageQueue.
+
+ @param[in] PeiServices PeiServices pointer.
+
+ @retval EFI_SUCCESS The function completed successfully
+ @retval EFI_NOT_READY No controller
+**/
+EFI_STATUS
+SendPETMessageInQueue (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ AMT_PET_QUEUE_HOB *PETQueueHob;
+ EFI_LIST_ENTRY *Link;
+ AMT_PET_QUEUE_NODE *Node;
+ EFI_PEI_HOB_POINTERS Hob;
+
+ EFI_HECI_PROTOCOL *Heci;
+ UINT32 MeStatus;
+ EFI_STATUS TempStatus;
+
+ ///
+ /// Try HECI state
+ ///
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+ if (EFI_ERROR (Status)) {
+ return EFI_NOT_READY;
+ }
+
+ TempStatus = Heci->GetMeStatus (&MeStatus);
+ ASSERT_EFI_ERROR (TempStatus);
+
+ ///
+ /// Only send ASF Push Progress code when ME is ready. Ignore FW Init Status.
+ ///
+ if (ME_STATUS_ME_STATE_ONLY (MeStatus) != ME_READY) {
+ return EFI_NOT_READY;
+ }
+ ///
+ /// Get PETQueueHob
+ ///
+ Status = EfiGetSystemConfigurationTable (&gEfiHobListGuid, (VOID **) &PETQueueHob);
+
+ while (TRUE) {
+ PETQueueHob = GetNextGuidHob (&gAmtPetQueueHobGuid, PETQueueHob);
+ if (PETQueueHob == NULL) {
+ break;
+ }
+ ///
+ /// Send message
+ ///
+ AmtReportStatusCode (PETQueueHob->Type, PETQueueHob->Value, 0, NULL, NULL);
+
+ ///
+ /// Mark it as sent
+ ///
+ PETQueueHob->Type = (UINT32) -1;
+
+ ///
+ /// Need find next one
+ ///
+ Hob.Raw = (VOID *) PETQueueHob;
+ PETQueueHob = (AMT_PET_QUEUE_HOB *) GET_NEXT_HOB (Hob);
+ }
+ ///
+ /// Send DXEQueue
+ ///
+ Link = (EFI_LIST_ENTRY *) GetFirstNode ((LIST_ENTRY *) &gAmtPetQueueProtocol->MessageList);
+
+ while (!IsNull ((LIST_ENTRY *) &gAmtPetQueueProtocol->MessageList, (LIST_ENTRY *) Link)) {
+ Node = AMT_PET_QUEUE_NODE_FROM_LINK (Link);
+
+ ///
+ /// Send message
+ ///
+ AmtReportStatusCode (Node->Type, Node->Value, 0, NULL, NULL);
+
+ ///
+ /// Mark it as sent
+ ///
+ Node->Type = (UINT32) -1;
+
+ Link = (EFI_LIST_ENTRY *) GetNextNode (
+ (LIST_ENTRY *) &gAmtPetQueueProtocol->MessageList,
+ (LIST_ENTRY *) &Node->Link
+ );
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This routine creats PET MessageQueue.
+
+ @param[in] None
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+AmtCreateMessageQueue (
+ VOID
+ )
+{
+ ///
+ /// Create Queue for later usage
+ ///
+ gAmtPetQueueProtocol = &gAmtPetQueue;
+
+ InitializeListHead ((LIST_ENTRY *) &gAmtPetQueueProtocol->MessageList);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This routine saves current ForcePush ErrorEvent to Variable, which will be sent again.
+
+ @param[in] MessageType ASF PET message type.
+
+ @retval EFI_SUCCESS The function completed successfully
+ @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary data structures
+**/
+EFI_STATUS
+SaveForcePushErrorEvent (
+ IN EFI_FRAMEWORK_MESSAGE_TYPE MessageType
+ )
+{
+ EFI_STATUS Status;
+ UINTN Size;
+ EFI_FRAMEWORK_MESSAGE_TYPE *Message;
+
+ ///
+ /// Create PET queue variable
+ ///
+ Message = NULL;
+ Size = 0;
+ Status = gRT->GetVariable (
+ AMT_FORCE_PUSH_PET_VARIABLE_NAME,
+ &gAmtForcePushPetVariableGuid,
+ NULL,
+ &Size,
+ NULL
+ );
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ ///
+ /// Get the exist message
+ ///
+ Message = AllocateZeroPool (Size + sizeof (MessageType));
+ ASSERT (Message != NULL);
+ if (Message == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Status = gRT->GetVariable (
+ AMT_FORCE_PUSH_PET_VARIABLE_NAME,
+ &gAmtForcePushPetVariableGuid,
+ NULL,
+ &Size,
+ Message
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Fill new item
+ ///
+ *(EFI_FRAMEWORK_MESSAGE_TYPE *) ((UINTN) Message + Size) = MessageType;
+ Size += sizeof (MessageType);
+ } else if (Status == EFI_NOT_FOUND) {
+ ///
+ /// Create a new one
+ ///
+ Size = sizeof (MessageType);
+ Message = AllocateZeroPool (sizeof (MessageType));
+ ASSERT (Message != NULL);
+ if (Message == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ *Message = MessageType;
+ } else {
+ ASSERT (FALSE);
+ }
+ ///
+ /// Set PET message to variable
+ ///
+ if (Message != NULL) {
+ Status = gRT->SetVariable (
+ AMT_FORCE_PUSH_PET_VARIABLE_NAME,
+ &gAmtForcePushPetVariableGuid,
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
+ Size,
+ Message
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ FreePool (Message);
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This routine converts Hob ForcePush ErrorEvent to Variable, which will be sent again.
+
+ @param[in] None
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+SaveForcePushErrorEventFromPeiToDxe (
+ VOID
+ )
+{
+ AMT_FORCE_PUSH_PET_HOB *AmtForcePushPETHob;
+ EFI_STATUS Status;
+ EFI_PEI_HOB_POINTERS Hob;
+
+ ///
+ /// Find ASF ForcePush PET Hob
+ ///
+ Status = EfiGetSystemConfigurationTable (&gEfiHobListGuid, (VOID **) &AmtForcePushPETHob);
+
+ while (TRUE) {
+ AmtForcePushPETHob = GetNextGuidHob (&gAmtForcePushPetHobGuid, AmtForcePushPETHob);
+ if (AmtForcePushPETHob == NULL) {
+ break;
+ }
+
+ SaveForcePushErrorEvent (AmtForcePushPETHob->MessageType);
+
+ ///
+ /// Need find next one
+ ///
+ Hob.Raw = (VOID *) AmtForcePushPETHob;
+ AmtForcePushPETHob = (AMT_FORCE_PUSH_PET_HOB *) GET_NEXT_HOB (Hob);
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This routine tries to send all ForcePush ErrorEvent.
+ If message is sent, it will be deleted from Variable.
+ If message is not sent, it will be still stored to Variable.
+
+ @param[in] None
+
+ @retval EFI_SUCCESS The function completed successfully
+ @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary data structures
+**/
+EFI_STATUS
+SendAllForcePushErrorEvent (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ UINTN Size;
+ EFI_FRAMEWORK_MESSAGE_TYPE *Message;
+ UINTN Index;
+ EFI_FRAMEWORK_MESSAGE_TYPE *NewMessage;
+ UINTN NewIndex;
+
+ ///
+ /// Create PET queue variable
+ ///
+ Message = NULL;
+ Size = 0;
+ Status = gRT->GetVariable (
+ AMT_FORCE_PUSH_PET_VARIABLE_NAME,
+ &gAmtForcePushPetVariableGuid,
+ NULL,
+ &Size,
+ NULL
+ );
+ if (Status == EFI_NOT_FOUND) {
+ return EFI_SUCCESS;
+ }
+
+ if (Status != EFI_BUFFER_TOO_SMALL) {
+ return Status;
+ }
+ ///
+ /// Get the exist message
+ ///
+ Message = AllocateZeroPool (Size);
+ ASSERT (Message != NULL);
+ if (Message == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ NewMessage = AllocateZeroPool (Size);
+ ASSERT (NewMessage != NULL);
+ if (NewMessage == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Status = gRT->GetVariable (
+ AMT_FORCE_PUSH_PET_VARIABLE_NAME,
+ &gAmtForcePushPetVariableGuid,
+ NULL,
+ &Size,
+ Message
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ NewIndex = 0;
+ for (Index = 0; Index < Size / sizeof (EFI_FRAMEWORK_MESSAGE_TYPE); Index++) {
+ Status = SendPostPacket (Message[Index]);
+ if (EFI_ERROR (Status)) {
+ ///
+ /// Fail, save it again.
+ ///
+ NewMessage[NewIndex] = Message[Index];
+ NewIndex++;
+ }
+ }
+
+ FreePool (Message);
+
+ ///
+ /// SetVariable again
+ ///
+ if (NewIndex == 0) {
+ FreePool (NewMessage);
+ NewMessage = NULL;
+ }
+
+ Status = gRT->SetVariable (
+ AMT_FORCE_PUSH_PET_VARIABLE_NAME,
+ &gAmtForcePushPetVariableGuid,
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
+ NewIndex * sizeof (EFI_FRAMEWORK_MESSAGE_TYPE),
+ NewMessage
+ );
+
+ if (NewMessage != NULL) {
+ FreePool (NewMessage);
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Dxe/AlertStandardFormatDxe.cif b/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Dxe/AlertStandardFormatDxe.cif
new file mode 100644
index 0000000..f091a20
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Dxe/AlertStandardFormatDxe.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "AlertStandardFormatDxe"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\ActiveManagement\AlertStandardFormat\Heci\Dxe\"
+ RefName = "AlertStandardFormatDxe"
+[files]
+"AlertStandardFormatDxe.sdl"
+"AlertStandardFormatDxe.mak"
+"AlertStandardFormatDxe.c"
+"AlertStandardFormatDxe.dxs"
+"AlertStandardFormatDxe.h"
+"AlertStandardFormatDxe.inf"
+<endComponent>
diff --git a/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Dxe/AlertStandardFormatDxe.dxs b/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Dxe/AlertStandardFormatDxe.dxs
new file mode 100644
index 0000000..dd340c9
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Dxe/AlertStandardFormatDxe.dxs
@@ -0,0 +1,47 @@
+/** @file
+ Dependency expression source file.
+
+@copyright
+ Copyright (c) 2005 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "DxeDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+
+#include EFI_PROTOCOL_DEFINITION (DataHub)
+#include EFI_PROTOCOL_DEFINITION (Heci)
+#include EFI_PROTOCOL_DEFINITION (AcpiSupport)
+#include EFI_PROTOCOL_DEFINITION (AmtPlatformPolicy)
+
+#endif
+
+DEPENDENCY_START
+ EFI_DATA_HUB_PROTOCOL_GUID AND
+ EFI_HECI_PROTOCOL_GUID AND
+ EFI_ACPI_SUPPORT_GUID AND
+ DXE_PLATFORM_AMT_POLICY_GUID
+DEPENDENCY_END
diff --git a/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Dxe/AlertStandardFormatDxe.h b/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Dxe/AlertStandardFormatDxe.h
new file mode 100644
index 0000000..0e6b947
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Dxe/AlertStandardFormatDxe.h
@@ -0,0 +1,340 @@
+/** @file
+ Include file for ASF Driver
+
+@copyright
+ Copyright (c) 2005 - 2012 Intel Corporation. All rights
+ reserved This software and associated documentation (if any)
+ is furnished under a license and may only be used or copied in
+ accordance with the terms of the license. Except as permitted
+ by such license, no part of this software or documentation may
+ be reproduced, stored in a retrieval system, or transmitted in
+ any form or by any means without the express written consent
+ of Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _ALERT_STANDARD_FORMAT_H
+#define _ALERT_STANDARD_FORMAT_H
+
+#include "AslUpdateLib.h"
+#include "AlertStandardFormatTable.h"
+#include "AmtLib.h"
+#include "AlertStandardFormatCommon.h"
+
+//
+// Driver Consumed Protocol Prototypes
+//
+#include EFI_PROTOCOL_CONSUMER (DataHub)
+#include EFI_PROTOCOL_CONSUMER (AlertStandardFormat)
+#include EFI_PROTOCOL_CONSUMER (HECI)
+#include EFI_PROTOCOL_CONSUMER (ConsoleControl)
+#include EFI_GUID_DEFINITION (ConsoleLock)
+#include EFI_GUID_DEFINITION (AmtForcePushPetPolicy)
+
+///
+/// ASF Over HECI
+///
+typedef struct _HECI_ASF_PUSH_PROGRESS_CODE {
+ UINT8 Command;
+ UINT8 ByteCount;
+ EFI_ASF_MESSAGE AsfMessage;
+ UINT8 EventData[3];
+ UINT8 Reserved[2];
+} HECI_ASF_PUSH_PROGRESS_CODE;
+
+#define HECI_ASF_PUSH_PROGRESS_CODE_LENGTH 0x12
+
+typedef struct _HECI_ASF_GET_BOOT_OPTIONS {
+ UINT8 Command;
+ UINT8 ByteCount;
+ UINT8 SubCommand;
+ UINT8 VersionNumber;
+} HECI_ASF_GET_BOOT_OPTIONS;
+
+#define HECI_ASF_GET_BOOT_OPTIONS_LENGTH 0x04
+
+typedef struct _HECI_ASF_GET_BOOT_OPTIONS_RESPONSE {
+ UINT8 Command;
+ UINT8 ByteCount;
+ EFI_ASF_BOOT_OPTIONS AsfBootOptions;
+ UINT8 Reserved;
+} HECI_ASF_GET_BOOT_OPTIONS_RESPONSE;
+
+#define HECI_ASF_GET_BOOT_OPTIONS_RESPONSE_LENGTH 0x0F
+
+typedef struct _HECI_ASF_CLEAR_BOOT_OPTION {
+ UINT8 Command;
+ UINT8 ByteCount;
+ EFI_ASF_CLEAR_BOOT_OPTIONS AsfClearBootOptions;
+} HECI_ASF_CLEAR_BOOT_OPTION;
+
+#define HECI_ASF_CLEAR_BOOT_OPTION_LENGTH 0x04
+
+typedef enum _HASFM_COMMAND_CODE
+{
+ ASF_MESSAGING_CMD = 0x04,
+ ASF_PUSH_PROGESS_CODE_SUBCMD = 0x12,
+ ASF_MENAGEMENT_CONTROL = 0x02,
+ ASF_WDT_START_SUBCMD = 0x13,
+ ASF_WDT_STOP_SUBCMD = 0x14,
+ ASF_CONFIGURATION_CMD = 0x03,
+ ASF_CLEAR_BOOT_OPTION_SUBCMD = 0x15,
+ ASF_RETURN_BOOT_OPTION_SUBCMD = 0x16,
+ ASF_NO_BOOT_OPTION_SUBCMD = 0x17
+} HASFM_COMMAND_CODE;
+
+typedef struct {
+ EFI_FRAMEWORK_MESSAGE_TYPE MessageType;
+ EFI_ASF_MESSAGE Message;
+} EFI_ASF_FRAMEWORK_MESSAGE;
+
+typedef struct {
+ EFI_FRAMEWORK_MESSAGE_TYPE MessageType;
+ EFI_STATUS_CODE_VALUE StatusCodeValue;
+} EFI_ASF_DATA_HUB_MAP;
+
+#define ALERT_STANDARD_FORMAT_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('a', 's', 'f', 'd')
+
+///
+/// Declare a local instance structure for this driver
+///
+typedef struct _ALERT_STANDARD_FORMAT_INSTANCE {
+ UINTN Signature;
+ EFI_HANDLE Handle;
+
+ ///
+ /// Published interface
+ ///
+ EFI_ALERT_STANDARD_FORMAT_PROTOCOL AlertStandardFormat;
+
+} ALERT_STANDARD_FORMAT_INSTANCE;
+
+#include "Pei.h"
+#include EFI_PPI_DEFINITION (AmtStatusCode)
+
+#define EFI_CONSOLE_OUT_DEVICE_GUID \
+ { \
+ 0xd3b36f2c, 0xd551, 0x11d4, \
+ { \
+ 0x9a, 0x46, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d \
+ } \
+ }
+
+#define AMT_FORCE_PUSH_PET_VARIABLE_GUID \
+ { \
+ 0xd7ac94af, 0xa498, 0x45ec, 0xbf, 0xa2, 0xa5, 0x6e, 0x95, 0x34, 0x61, 0x8b \
+ }
+
+#define AMT_FORCE_PUSH_PET_VARIABLE_NAME L"AmtForcePushErrorPET"
+
+#define AMT_PET_QUEUE_NODE_SIGNATURE EFI_SIGNATURE_32 ('A', 'M', 'T', 'Q')
+
+typedef struct _AMT_PET_QUEUE_NODE {
+ UINT32 Signature;
+ EFI_LIST_ENTRY Link;
+ EFI_STATUS_CODE_VALUE Value;
+ EFI_STATUS_CODE_TYPE Type;
+} AMT_PET_QUEUE_NODE;
+
+#define AMT_PET_QUEUE_NODE_FROM_LINK(_node) CR (_node, AMT_PET_QUEUE_NODE, Link, AMT_PET_QUEUE_NODE_SIGNATURE)
+
+typedef struct {
+ EFI_LIST_ENTRY MessageList;
+} AMT_PET_QUEUE_PROTOCOL;
+
+//
+// Prototypes
+//
+
+/**
+ The driver entry point - detect ASF support or not, if support, will install relative protocol.
+
+ @param[in] ImageHandle Handle for this drivers loaded image protocol.
+ @param[in] SystemTable EFI system table.
+
+ @retval EFI_SUCCESS The driver installed without error.
+ @exception EFI_UNSUPPORTED The chipset is unsupported by this driver.
+ @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary data structures.
+**/
+EFI_STATUS
+EFIAPI
+AlertStandardFormatDriverEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+;
+
+/**
+ Return the SMBus address used by the ASF driver.
+ Not applicable in Intel ME/HECI system, need to return EFI_UNSUPPORTED.
+
+ @param[in] This The address of protocol
+ @param[in] SmbusDeviceAddress Out put the Smbus Address
+
+ @exception EFI_UNSUPPORTED The function is unsupported by this driver
+**/
+EFI_STATUS
+EFIAPI
+GetSmbusAddr (
+ IN EFI_ALERT_STANDARD_FORMAT_PROTOCOL *This,
+ OUT UINTN *SmbusDeviceAddress
+ )
+;
+
+/**
+ Set the SMBus address used by the ASF driver. 0 is an invalid address.
+ Not applicable in Intel ME/HECI system, need to return EFI_UNSUPPORTED.
+
+ @param[in] This The address of protocol
+ @param[in] SmbusDeviceAddress SMBus address of the device
+
+ @exception EFI_UNSUPPORTED The function is unsupported by this driver
+**/
+EFI_STATUS
+EFIAPI
+SetSmbusAddr (
+ IN EFI_ALERT_STANDARD_FORMAT_PROTOCOL *This,
+ IN UINTN SmbusDeviceAddress
+ )
+;
+
+/**
+ Return the ASF Boot Options obtained from the controller. If the
+ Boot Options parameter is NULL and no boot options have been retrieved,
+ Query the ASF controller for its boot options.
+ Get ASF Boot Options through HECI.
+
+ @param[in] This The address of protocol
+ @param[in] AsfBootOptions Pointer to ASF boot options to copy current ASF Boot options
+
+ @retval EFI_SUCCESS Boot options copied
+ @retval EFI_NOT_READY No boot options
+**/
+EFI_STATUS
+EFIAPI
+GetBootOptions (
+ IN EFI_ALERT_STANDARD_FORMAT_PROTOCOL *This,
+ IN OUT EFI_ASF_BOOT_OPTIONS **AsfBootOptions
+ )
+;
+
+/**
+ Send ASF Message through HECI.
+
+ @param[in] This The address of protocol
+ @param[in] AsfMessage Pointer to ASF message
+
+ @retval EFI_SUCCESS Boot options copied
+ @retval EFI_INVALID_PARAMETER Invalid pointer
+ @retval EFI_NOT_READY No controller
+**/
+EFI_STATUS
+EFIAPI
+SendAsfMessage (
+ IN EFI_ALERT_STANDARD_FORMAT_PROTOCOL *This,
+ IN EFI_ASF_MESSAGE *AsfMessage
+ )
+;
+
+/**
+ This routine returns ForcePushPetPolicy information.
+
+ @param[in] None
+
+ @retval AMT_FORCE_PUSH_PET_POLICY_HOB ForcePushPetPolicy information.
+**/
+AMT_FORCE_PUSH_PET_POLICY_HOB *
+GetForcePushPetPolicy (
+ VOID
+ )
+;
+
+/**
+ Filters all the progress and error codes for Asf.
+
+ @param[in] Event The event registered.
+ @param[in] Context Event context. Not used in this event handler.
+**/
+VOID
+EFIAPI
+DataHubEventCallback (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+;
+
+/**
+ Sends a POST packet across ASF
+
+ @param[in] MessageType POST Status Code
+
+ @retval EFI_DEVICE_ERROR No message found
+ @retval EFI_SUCCESS Boot options copied
+ @retval EFI_INVALID_PARAMETER Invalid pointer
+ @retval EFI_NOT_READY No controller
+**/
+EFI_STATUS
+SendPostPacket (
+ IN EFI_FRAMEWORK_MESSAGE_TYPE MessageType
+ )
+;
+
+/**
+ This routine sends PET message in MessageQueue.
+
+ @param[in] PeiServices PeiServices pointer.
+
+ @retval EFI_SUCCESS The function completed successfully
+ @retval EFI_NOT_READY No controller
+**/
+EFI_STATUS
+SendPETMessageInQueue (
+ VOID
+ )
+;
+
+/**
+ This routine creats PET MessageQueue.
+
+ @param[in] None
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+AmtCreateMessageQueue (
+ VOID
+ )
+;
+
+/**
+ This routine saves current ForcePush ErrorEvent to Variable, which will be sent again.
+
+ @param[in] MessageType ASF PET message type.
+
+ @retval EFI_SUCCESS The function completed successfully
+ @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary data structures
+**/
+EFI_STATUS
+SaveForcePushErrorEvent (
+ IN EFI_FRAMEWORK_MESSAGE_TYPE MessageType
+ )
+;
+
+/**
+ This routine converts Hob ForcePush ErrorEvent to Variable, which will be sent again.
+
+ @param[in] None
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+SaveForcePushErrorEventFromPeiToDxe (
+ VOID
+ )
+;
+#endif
diff --git a/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Dxe/AlertStandardFormatDxe.inf b/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Dxe/AlertStandardFormatDxe.inf
new file mode 100644
index 0000000..b484230
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Dxe/AlertStandardFormatDxe.inf
@@ -0,0 +1,99 @@
+## @file
+# Component description file for Alert Standard Format driver.
+#
+#@copyright
+# Copyright (c) 2005 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = AlertStandardFormatDxe
+FILE_GUID = 33c6406d-2f6b-41b5-8705-52bafb633c09
+COMPONENT_TYPE = BS_DRIVER
+
+[sources.common]
+ AlertStandardFormatDxe.c
+ AlertStandardFormatDxe.h
+
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueDxeDriverEntryPoint.c
+
+[libraries.common]
+ AmtLib
+ MeGuidLib
+ MeProtocolLib
+ AslUpdateLib
+ EdkProtocolLib
+ EdkFrameworkProtocolLib
+ EdkIIGlueBaseMemoryLib
+ EdkIIGlueDxeReportStatusCodeLib
+ EdkIIGlueDxeHobLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueDxeMemoryAllocationLib
+
+[includes.common]
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/ActiveManagement/AlertStandardFormat/Heci/Common
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Heci/Include
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/AMT/Dxe
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/Dxe
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/SampleCode/Include
+
+#
+# Edk II Glue Library, some hearder are included by R9 header so have to include
+#
+
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Framework
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = AlertStandardFormatDxe.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=AlertStandardFormatDriverEntryPoint
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__
diff --git a/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Dxe/AlertStandardFormatDxe.mak b/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Dxe/AlertStandardFormatDxe.mak
new file mode 100644
index 0000000..202d1c9
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Dxe/AlertStandardFormatDxe.mak
@@ -0,0 +1,59 @@
+# MAK file for the ModulePart:AlertStandardFormatDxe
+
+all : AlertStandardFormatDxe
+
+AlertStandardFormatDxe : $(BUILD_DIR)\AlertStandardFormatDxe.mak AlertStandardFormatDxeBin
+
+$(BUILD_DIR)\AlertStandardFormatDxe.mak : $(AlertStandardFormatDxe_DIR)\$(@B).cif $(AlertStandardFormatDxe_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(AlertStandardFormatDxe_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+AlertStandardFormatDxe_INCLUDES=\
+ $(EDK_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(ME_INCLUDES)\
+ $(AlertStandardFormat_INCLUDES)\
+ $(IndustryStandard_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+
+AlertStandardFormatDxe_LIBS=\
+ $(EDKPROTOCOLLIB)\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(AmtLibDxe_LIB)\
+ $(MeGuidLib_LIB)\
+ $(MeProtocolLib_LIB)\
+ $(MeAslUpdateLib_LIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueUefiLib_LIB)\
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueEdkDxeRuntimeDriverLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueDxeMemoryAllocationLib_LIB)\
+ $(EdkIIGlueDxeHobLib_LIB)\
+
+AlertStandardFormatDxe_DEFINES=\
+ $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=AlertStandardFormatDriverEntryPoint"\
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__\
+
+AlertStandardFormatDxeBin : $(AlertStandardFormatDxe_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\AlertStandardFormatDxe.mak all\
+ "MY_INCLUDES=$(AlertStandardFormatDxe_INCLUDES)" \
+ "MY_DEFINES=$(AlertStandardFormatDxe_DEFINES)"\
+ GUID=33c6406d-2f6b-41b5-8705-52bafb633c09 \
+ ENTRY_POINT=_ModuleEntryPoint \
+ EDKIIModule=DXEDRIVER\
+ TYPE=BS_DRIVER \
+ DEPEX1=$(AlertStandardFormatDxe_DIR)\AlertStandardFormatDxe.dxs \
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \
+ COMPRESS=1
diff --git a/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Dxe/AlertStandardFormatDxe.sdl b/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Dxe/AlertStandardFormatDxe.sdl
new file mode 100644
index 0000000..938ff01
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Dxe/AlertStandardFormatDxe.sdl
@@ -0,0 +1,25 @@
+TOKEN
+ Name = AlertStandardFormatDxe_SUPPORT
+ Value = 1
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable AlertStandardFormatDxe support in Project"
+End
+
+MODULE
+ Help = "Includes AlertStandardFormatDxe.mak to Project"
+ File = "AlertStandardFormatDxe.mak"
+End
+
+PATH
+ Name = "AlertStandardFormatDxe_DIR"
+ Help = "AlertStandardFormatDxe files source directory"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\AlertStandardFormatDxe.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End \ No newline at end of file
diff --git a/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Pei/AlertStandardFormatPei.c b/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Pei/AlertStandardFormatPei.c
new file mode 100644
index 0000000..10afe73
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Pei/AlertStandardFormatPei.c
@@ -0,0 +1,437 @@
+/** @file
+ Processes ASF messages
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights
+ reserved This software and associated documentation (if any)
+ is furnished under a license and may only be used or copied in
+ accordance with the terms of the license. Except as permitted
+ by such license, no part of this software or documentation may
+ be reproduced, stored in a retrieval system, or transmitted in
+ any form or by any means without the express written consent
+ of Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#include "AlertStandardFormatPei.h"
+#include "MeLibPei.h"
+#endif
+
+#define ASF_PEI
+#include "AlertStandardFormatCommon.c"
+
+static PEI_AMT_STATUS_CODE_PPI mPeiAmtStatusCodePpi = { PeiAmtReportStatusCode };
+
+static EFI_PEI_PPI_DESCRIPTOR mInstallPeiAmtStatusCodePpi = {
+ EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
+ &gPeiAmtStatusCodePpiGuid,
+ &mPeiAmtStatusCodePpi
+};
+
+/**
+ Perform AMT PET message sending
+
+ @param[in] FfsHeader FFS file header pointer of this driver.
+ @param[in] PeiServices General purpose services available to every PEIM.
+
+ @retval EFI_SUCCESS if the AMT StatusCode PPI is successfully installed.
+ @exception EFI_UNSUPPORTED ASF is not enabled or ManageabilityMode is zero.
+**/
+EFI_STATUS
+EFIAPI
+AlertStandardFormatDriverPeiEntryPoint (
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_STATUS Status;
+
+ ///
+ /// First check if ASF support is enabled in Setup.
+ ///
+ if (!PeiAsfSupported (PeiServices)) {
+ return EFI_UNSUPPORTED;
+ }
+ ///
+ /// Sending ASF Messaging if ManageabilityMode is not zero
+ ///
+ if (ManageabilityModeSetting (PeiServices) == MNT_OFF) {
+ return EFI_UNSUPPORTED;
+ }
+ ///
+ /// Install AMT report status code PPI
+ ///
+ Status = (**PeiServices).InstallPpi (PeiServices, &mInstallPeiAmtStatusCodePpi);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Try to send PET message
+ ///
+ SendPETMessageInQueue (PeiServices);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Send ASF Message.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] AsfMessage Pointer to ASF message
+
+ @retval EFI_SUCCESS Boot options copied
+ @retval EFI_INVALID_PARAMETER Invalid pointer
+ @retval EFI_NOT_READY No controller
+ @retval EFI_DEVICE_ERROR The function should not be completed due to a device error
+**/
+EFI_STATUS
+SendAsfMessage (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_ASF_MESSAGE *AsfMessage
+ )
+{
+ EFI_STATUS Status;
+ PEI_HECI_PPI *Heci;
+ UINT32 HeciMemBar;
+ UINT32 HeciLength;
+ HECI_ASF_PUSH_PROGRESS_CODE HeciAsfPushProgressCode;
+ UINT32 MeStatus;
+
+ Status = (*PeiServices)->LocatePpi (
+ PeiServices,
+ &gPeiHeciPpiGuid, // GUID
+ 0, // INSTANCE
+ NULL, // EFI_PEI_PPI_DESCRIPTOR
+ (VOID **) &Heci // PPI
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ Status = Heci->InitializeHeci (PeiServices, Heci, &HeciMemBar);
+ if (EFI_ERROR (Status)) {
+ return EFI_NOT_READY;
+ }
+
+ Status = Heci->GetMeStatus (PeiServices, &MeStatus);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Only send ASF Push Progress code when ME is ready. Ignore FW Init Status.
+ ///
+ if (ME_STATUS_ME_STATE_ONLY (MeStatus) != ME_READY) {
+ return EFI_NOT_READY;
+ }
+
+ ZeroMem ((VOID *) &HeciAsfPushProgressCode, sizeof (HECI_ASF_PUSH_PROGRESS_CODE));
+ HeciAsfPushProgressCode.Command = EFI_ASF_MESSAGE_COMMAND_MESSAGE;
+ HeciAsfPushProgressCode.ByteCount = 0x10;
+ HeciLength = HECI_ASF_PUSH_PROGRESS_CODE_LENGTH;
+ CopyMem ((VOID *) &(HeciAsfPushProgressCode.AsfMessage), (VOID *) AsfMessage, sizeof (EFI_ASF_MESSAGE));
+
+ Status = Heci->SendMsg (
+ PeiServices,
+ Heci,
+ (UINT32 *) &HeciAsfPushProgressCode,
+ HeciMemBar,
+ HeciLength,
+ BIOS_ASF_HOST_ADDR,
+ HECI_ASF_MESSAGE_ADDR
+ );
+ if (EFI_ERROR (Status)) {
+ return EFI_DEVICE_ERROR;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This routine checks whethre current message is ForcePush message.
+
+ @param[in] PeiServices PeiServices pointer.
+ @param[in] MessageType AMT PET Message Type.
+
+ @retval TRUE It is ForcePush message.
+ @retval FALSE It is not ForcePush message.
+**/
+BOOLEAN
+IsForcePushErrorEvent (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_FRAMEWORK_MESSAGE_TYPE MessageType
+ )
+{
+ AMT_FORCE_PUSH_PET_POLICY_HOB *AmtForcePushPETPolicyHob;
+ UINTN Index;
+ UINTN Number;
+ EFI_STATUS Status;
+
+ Status = (*PeiServices)->GetHobList (PeiServices, (VOID **) &AmtForcePushPETPolicyHob);
+ ASSERT_EFI_ERROR (Status);
+
+ AmtForcePushPETPolicyHob = GetNextGuidHob (&gAmtForcePushPetPolicyGuid, AmtForcePushPETPolicyHob);
+ if (AmtForcePushPETPolicyHob == NULL) {
+ return FALSE;
+ }
+
+ Number = (AmtForcePushPETPolicyHob->EfiHobGuidType.Header.HobLength - sizeof (EFI_HOB_GUID_TYPE)) /
+ sizeof (EFI_FRAMEWORK_MESSAGE_TYPE);
+ for (Index = 0; Index < Number; Index++) {
+ if (AmtForcePushPETPolicyHob->MessageType[Index] == MessageType) {
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+/**
+ Provides an interface that a software module can call to report an ASF PEI status code.
+
+ @param[in] PeiServices PeiServices pointer.
+ @param[in] This This interface.
+ @param[in] Type Indicates the type of status code being reported.
+ @param[in] Value Describes the current status of a hardware or software entity.
+ This included information about the class and subclass that is
+ used to classify the entity as well as an operation.
+ @param[in] Instance The enumeration of a hardware or software entity within
+ the system. Valid instance numbers start with 1.
+ @param[in] CallerId This optional parameter may be used to identify the caller.
+ This parameter allows the status code driver to apply different
+ rules to different callers.
+ @param[in] Data This optional parameter may be used to pass additional data.
+
+ @retval EFI_SUCCESS The function completed successfully
+ @retval EFI_DEVICE_ERROR The function should not be completed due to a device error.
+**/
+EFI_STATUS
+EFIAPI
+PeiAmtReportStatusCode (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_AMT_STATUS_CODE_PPI * This,
+ IN EFI_STATUS_CODE_TYPE Type,
+ IN EFI_STATUS_CODE_VALUE Value,
+ IN UINT32 Instance,
+ IN EFI_GUID * CallerId OPTIONAL,
+ IN EFI_STATUS_CODE_DATA * Data OPTIONAL
+ )
+{
+ UINTN Index;
+ EFI_STATUS Status;
+
+ Status = EFI_SUCCESS;
+
+ if (PeiFwProgressSupport (PeiServices)) {
+ if ((Type & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) {
+ for (Index = 0; Index < sizeof (mAsfProgressDataHubMap) / sizeof (EFI_ASF_DATA_HUB_MAP); Index++) {
+ if (mAsfProgressDataHubMap[Index].StatusCodeValue == Value) {
+ ///
+ /// Queue Progress Code and send PET after checking Boot Options
+ ///
+ QueuePetMessage (PeiServices, Type, Value);
+ }
+ }
+ }
+ }
+
+ if ((Type & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) {
+ for (Index = 0; Index < sizeof (mAsfErrorDataHubMap) / sizeof (EFI_ASF_DATA_HUB_MAP); Index++) {
+ if (mAsfErrorDataHubMap[Index].StatusCodeValue == Value) {
+ Status = SendPostPacket (PeiServices, mAsfErrorDataHubMap[Index].MessageType);
+ if ((Status == EFI_DEVICE_ERROR) && IsForcePushErrorEvent (PeiServices, mAsfErrorDataHubMap[Index].MessageType)) {
+ SaveForcePushErrorEvent (PeiServices, mAsfErrorDataHubMap[Index].MessageType);
+ }
+
+ if (Status == EFI_NOT_READY) {
+ QueuePetMessage (PeiServices, Type, Value);
+ }
+ }
+ }
+ }
+
+ return Status;
+}
+
+/**
+ Sends a POST packet across ASF
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] MessageType POST Status Code
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+SendPostPacket (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_FRAMEWORK_MESSAGE_TYPE MessageType
+ )
+{
+ UINTN Index;
+
+ ///
+ /// Find the message to send across the wire
+ ///
+ for (Index = 0; Index < sizeof (mAsfFrameworkMessage) / sizeof (EFI_ASF_FRAMEWORK_MESSAGE); Index++) {
+ if (mAsfFrameworkMessage[Index].MessageType == MessageType) {
+ return SendAsfMessage (PeiServices, &mAsfFrameworkMessage[Index].Message);
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This routine saves current ForcePush ErrorEvent to Hob, which will be sent again.
+
+ @param[in] PeiServices PeiServices pointer.
+ @param[in] MessageType ASF PET message type.
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+SaveForcePushErrorEvent (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_FRAMEWORK_MESSAGE_TYPE MessageType
+ )
+{
+ AMT_FORCE_PUSH_PET_HOB *ForcePushPETHob;
+ EFI_STATUS Status;
+
+ ///
+ /// Create PET queue hob
+ ///
+ Status = (**PeiServices).CreateHob (
+ PeiServices,
+ EFI_HOB_TYPE_GUID_EXTENSION,
+ sizeof (AMT_FORCE_PUSH_PET_HOB),
+ (VOID **) &ForcePushPETHob
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ForcePushPETHob->EfiHobGuidType.Name = gAmtForcePushPetHobGuid;
+ ForcePushPETHob->MessageType = MessageType;
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This routine puts PET message to MessageQueue, which will be sent later.
+
+ @param[in] PeiServices PeiServices pointer.
+ @param[in] Type StatusCode message type.
+ @param[in] Value StatusCode message value.
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+QueuePetMessage (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_STATUS_CODE_TYPE Type,
+ IN EFI_STATUS_CODE_VALUE Value
+ )
+{
+ AMT_PET_QUEUE_HOB *PETQueueHob;
+ EFI_STATUS Status;
+
+ ///
+ /// Create PET queue hob
+ ///
+ Status = (**PeiServices).CreateHob (
+ PeiServices,
+ EFI_HOB_TYPE_GUID_EXTENSION,
+ sizeof (AMT_PET_QUEUE_HOB),
+ (VOID **) &PETQueueHob
+ );
+ ASSERT_EFI_ERROR (Status);
+ PETQueueHob->EfiHobGuidType.Name = gAmtPetQueueHobGuid;
+ PETQueueHob->Value = Value;
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This routine sends PET message in MessageQueue.
+
+ @param[in] PeiServices PeiServices pointer.
+
+ @retval EFI_SUCCESS The function completed successfully
+ @retval EFI_NOT_READY No controller
+**/
+EFI_STATUS
+SendPETMessageInQueue (
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_STATUS Status;
+ AMT_PET_QUEUE_HOB *PETQueueHob;
+ EFI_PEI_HOB_POINTERS Hob;
+
+ PEI_HECI_PPI *Heci;
+ UINT32 HeciMemBar;
+ UINT32 MeStatus;
+
+ ///
+ /// Try HECI state
+ ///
+ Status = (*PeiServices)->LocatePpi (
+ PeiServices,
+ &gPeiHeciPpiGuid, // GUID
+ 0, // INSTANCE
+ NULL, // EFI_PEI_PPI_DESCRIPTOR
+ (VOID **) &Heci // PPI
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ Status = Heci->InitializeHeci (PeiServices, Heci, &HeciMemBar);
+ if (EFI_ERROR (Status)) {
+ return EFI_NOT_READY;
+ }
+
+ Status = Heci->GetMeStatus (PeiServices, &MeStatus);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Only send ASF Push Progress code when ME is ready. Ignore FW Init Status.
+ ///
+ if (ME_STATUS_ME_STATE_ONLY (MeStatus) != ME_READY) {
+ return EFI_NOT_READY;
+ }
+ ///
+ /// Get PETQueueHob
+ ///
+ Status = (*PeiServices)->GetHobList (PeiServices, (VOID **) &PETQueueHob);
+ ASSERT_EFI_ERROR (Status);
+
+ while (TRUE) {
+ PETQueueHob = GetNextGuidHob (&gAmtPetQueueHobGuid, PETQueueHob);
+ if (PETQueueHob == NULL) {
+ break;
+ }
+ ///
+ /// Send message
+ ///
+ PeiAmtReportStatusCode (PeiServices, NULL, PETQueueHob->Type, PETQueueHob->Value, 0, NULL, NULL);
+
+ ///
+ /// Mark it as sent
+ ///
+ PETQueueHob->Type = (UINT32) -1;
+
+ ///
+ /// Need find next one
+ ///
+ Hob.Raw = (VOID *) PETQueueHob;
+ PETQueueHob = (AMT_PET_QUEUE_HOB *) GET_NEXT_HOB (Hob);
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Pei/AlertStandardFormatPei.cif b/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Pei/AlertStandardFormatPei.cif
new file mode 100644
index 0000000..ee123bf
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Pei/AlertStandardFormatPei.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "AlertStandardFormatPei"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\ActiveManagement\AlertStandardFormat\Heci\Pei\"
+ RefName = "AlertStandardFormatPei"
+[files]
+"AlertStandardFormatPei.sdl"
+"AlertStandardFormatPei.mak"
+"AlertStandardFormatPei.c"
+"AlertStandardFormatPei.dxs"
+"AlertStandardFormatPei.h"
+"AlertStandardFormatPei.inf"
+<endComponent>
diff --git a/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Pei/AlertStandardFormatPei.dxs b/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Pei/AlertStandardFormatPei.dxs
new file mode 100644
index 0000000..236c6ec
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Pei/AlertStandardFormatPei.dxs
@@ -0,0 +1,29 @@
+/** @file
+ Dependency expression source file.
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+#include "EfiDepex.h"
+
+#include EFI_PPI_DEFINITION (Heci)
+#include EFI_PPI_DEFINITION (AmtPlatformPolicyPei)
+
+DEPENDENCY_START
+ PEI_HECI_PPI_GUID AND
+ PEI_AMT_PLATFORM_POLICY_PPI_GUID
+DEPENDENCY_END
diff --git a/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Pei/AlertStandardFormatPei.h b/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Pei/AlertStandardFormatPei.h
new file mode 100644
index 0000000..b24dd69
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Pei/AlertStandardFormatPei.h
@@ -0,0 +1,204 @@
+/** @file
+ Processes ASF messages
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights
+ reserved This software and associated documentation (if any)
+ is furnished under a license and may only be used or copied in
+ accordance with the terms of the license. Except as permitted
+ by such license, no part of this software or documentation may
+ be reproduced, stored in a retrieval system, or transmitted in
+ any form or by any means without the express written consent
+ of Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _ALERT_STANDARD_FORMAT_PEI_H
+#define _ALERT_STANDARD_FORMAT_PEI_H
+
+#include "AmtLibPei.h"
+#include "MkhiMsgs.h"
+#include "AlertStandardFormatCommon.h"
+
+//
+// Driver Consumed Protocol Prototypes
+//
+#include EFI_PPI_CONSUMER (HECI)
+#include EFI_PPI_PRODUCER (AmtStatusCode)
+#include EFI_GUID_DEFINITION (MeBiosExtensionSetup)
+#include EFI_GUID_DEFINITION (AmtForcePushPetPolicy)
+
+///
+/// ASF Over HECI
+///
+#pragma pack(1)
+typedef struct {
+ UINT8 SubCommand;
+ UINT8 Version;
+ UINT8 EventSensorType;
+ UINT8 EventType;
+ UINT8 EventOffset;
+ UINT8 EventSourceType;
+ UINT8 EventSeverity;
+ UINT8 SensorDevice;
+ UINT8 SensorNumber;
+ UINT8 Entity;
+ UINT8 EntityInstance;
+ UINT8 Data0;
+ UINT8 Data1;
+} EFI_ASF_MESSAGE;
+#pragma pack()
+
+typedef struct _HECI_ASF_PUSH_PROGRESS_CODE {
+ UINT8 Command;
+ UINT8 ByteCount;
+ EFI_ASF_MESSAGE AsfMessage;
+ UINT8 EventData[3];
+ UINT8 Reserved[2];
+} HECI_ASF_PUSH_PROGRESS_CODE;
+
+#define HECI_ASF_PUSH_PROGRESS_CODE_LENGTH 0x12
+
+typedef enum _HASFM_COMMAND_CODE
+{
+ ASF_MESSAGING_CMD = 0x04,
+ ASF_PUSH_PROGESS_CODE_SUBCMD = 0x12,
+ ASF_MENAGEMENT_CONTROL = 0x02,
+ ASF_WDT_START_SUBCMD = 0x13,
+ ASF_WDT_STOP_SUBCMD = 0x14,
+ ASF_CONFIGURATION_CMD = 0x03,
+ ASF_CLEAR_BOOT_OPTION_SUBCMD = 0x15,
+ ASF_RETURN_BOOT_OPTION_SUBCMD = 0x16,
+ ASF_NO_BOOT_OPTION_SUBCMD = 0x17
+} HASFM_COMMAND_CODE;
+
+typedef struct {
+ EFI_FRAMEWORK_MESSAGE_TYPE MessageType;
+ EFI_ASF_MESSAGE Message;
+} EFI_ASF_FRAMEWORK_MESSAGE;
+
+typedef struct {
+ EFI_FRAMEWORK_MESSAGE_TYPE MessageType;
+ EFI_STATUS_CODE_VALUE StatusCodeValue;
+} EFI_ASF_DATA_HUB_MAP;
+
+//
+// Prototypes
+//
+
+/**
+ Send ASF Message.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] AsfMessage Pointer to ASF message
+
+ @retval EFI_SUCCESS Boot options copied
+ @retval EFI_INVALID_PARAMETER Invalid pointer
+ @retval EFI_NOT_READY No controller
+ @retval EFI_DEVICE_ERROR The function should not be completed due to a device error
+**/
+EFI_STATUS
+SendAsfMessage (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_ASF_MESSAGE *AsfMessage
+ )
+;
+
+/**
+ Provides an interface that a software module can call to report an ASF PEI status code.
+
+ @param[in] PeiServices PeiServices pointer.
+ @param[in] This This interface.
+ @param[in] Type Indicates the type of status code being reported.
+ @param[in] Value Describes the current status of a hardware or software entity.
+ This included information about the class and subclass that is
+ used to classify the entity as well as an operation.
+ @param[in] Instance The enumeration of a hardware or software entity within
+ the system. Valid instance numbers start with 1.
+ @param[in] CallerId This optional parameter may be used to identify the caller.
+ This parameter allows the status code driver to apply different
+ rules to different callers.
+ @param[in] Data This optional parameter may be used to pass additional data.
+
+ @retval EFI_SUCCESS The function completed successfully
+ @retval EFI_DEVICE_ERROR The function should not be completed due to a device error.
+**/
+EFI_STATUS
+EFIAPI
+PeiAmtReportStatusCode (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_AMT_STATUS_CODE_PPI * This,
+ IN EFI_STATUS_CODE_TYPE Type,
+ IN EFI_STATUS_CODE_VALUE Value,
+ IN UINT32 Instance,
+ IN EFI_GUID * CallerId OPTIONAL,
+ IN EFI_STATUS_CODE_DATA * Data OPTIONAL
+ )
+;
+
+/**
+ Sends a POST packet across ASF
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] MessageType POST Status Code
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+SendPostPacket (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_FRAMEWORK_MESSAGE_TYPE MessageType
+ )
+;
+
+/**
+ This routine saves current ForcePush ErrorEvent to Hob, which will be sent again.
+
+ @param[in] PeiServices PeiServices pointer.
+ @param[in] MessageType ASF PET message type.
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+SaveForcePushErrorEvent (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_FRAMEWORK_MESSAGE_TYPE MessageType
+ )
+;
+
+/**
+ This routine puts PET message to MessageQueue, which will be sent later.
+
+ @param[in] PeiServices PeiServices pointer.
+ @param[in] Type StatusCode message type.
+ @param[in] Value StatusCode message value.
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+QueuePetMessage (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_STATUS_CODE_TYPE Type,
+ IN EFI_STATUS_CODE_VALUE Value
+ )
+;
+
+/**
+ This routine sends PET message in MessageQueue.
+
+ @param[in] PeiServices PeiServices pointer.
+
+ @retval EFI_SUCCESS The function completed successfully
+ @retval EFI_NOT_READY No controller
+**/
+EFI_STATUS
+SendPETMessageInQueue (
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+;
+#endif
diff --git a/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Pei/AlertStandardFormatPei.inf b/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Pei/AlertStandardFormatPei.inf
new file mode 100644
index 0000000..8bd8d0f
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Pei/AlertStandardFormatPei.inf
@@ -0,0 +1,93 @@
+## @file
+# Component description file for Alert Standard Format driver.
+#
+#@copyright
+# Copyright (c) 2005 - 2013 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = AlertStandardFormatPei
+FILE_GUID = 3e4817fd-2742-4351-b59f-91493280329c
+COMPONENT_TYPE = PE32_PEIM
+
+[sources.common]
+ AlertStandardFormatPei.c
+ AlertStandardFormatPei.h
+
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGluePeimEntryPoint.c
+
+[libraries.common]
+ PeiLib
+ AmtLibPei
+ MeGuidLib
+ MeLibPpi
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGluePeiDebugLibReportStatusCode
+ EdkIIGluePeiReportStatusCodeLib
+ EdkIIGluePeiServicesLib
+ EdkIIGlueBasePciLibPciExpress
+ EdkIIGlueBasePciExpressLib
+ EdkIIGluePeiHobLib
+
+[includes.common]
+ $(EDK_SOURCE)/Foundation/library/Pei/Include
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Library/Pei
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/ActiveManagement/AlertStandardFormat/Heci/Common
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/AMT/Pei
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/Pei
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/Include
+
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/SampleCode/Include
+
+#
+# Edk II Glue Library, some hearder are included by R9 header so have to include
+#
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Framework
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = AlertStandardFormatPei.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=AlertStandardFormatDriverPeiEntryPoint
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_PEI_SERVICES_LIB__ \
+ -D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__
diff --git a/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Pei/AlertStandardFormatPei.mak b/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Pei/AlertStandardFormatPei.mak
new file mode 100644
index 0000000..8ff971a
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Pei/AlertStandardFormatPei.mak
@@ -0,0 +1,50 @@
+# MAK file for the ModulePart:AlertStandardFormat
+all : AlertStandardFormatPei
+
+AlertStandardFormatPei : $(BUILD_DIR)\AlertStandardFormatPei.mak AlertStandardFormatPeiBin
+
+$(BUILD_DIR)\AlertStandardFormatPei.mak : $(AlertStandardFormatPei_DIR)\$(@B).cif $(AlertStandardFormatPei_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(AlertStandardFormatPei_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+AlertStandardFormatPei_INCLUDES=\
+ $(EDK_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(ME_INCLUDES)\
+ $(AlertStandardFormat_INCLUDES)\
+ $(IndustryStandard_INCLUDES)\
+
+AlertStandardFormatPei_LIBS=\
+ $(EDKPROTOCOLLIB)\
+ $(MeGuidLib_LIB)\
+ $(MeLibPpi_LIB)\
+ $(AmtLibPei_LIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGlueBaseLibIA32_LIB)\
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGluePeiDebugLibReportStatusCode_LIB)\
+ $(EdkIIGluePeiReportStatusCodeLib_LIB)\
+ $(EdkIIGluePeiServicesLib_LIB)\
+ $(EdkIIGluePeiHobLib_LIB)\
+
+AlertStandardFormatPei_DEFINES=\
+ $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=AlertStandardFormatDriverPeiEntryPoint"\
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_PEI_SERVICES_LIB__\
+ /D __EDKII_GLUE_PEI_MEMORY_ALLOCATION_LIB__ \
+
+AlertStandardFormatPeiBin : $(AlertStandardFormatPei_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\AlertStandardFormatPei.mak all\
+ "MY_INCLUDES=$(AlertStandardFormatPei_INCLUDES)"\
+ "MY_DEFINES=$(AlertStandardFormatPei_DEFINES)"\
+ GUID=3e4817fd-2742-4351-b59f-91493280329c \
+ ENTRY_POINT=_ModuleEntryPoint \
+ EDKIIModule=PEIM\
+ TYPE=PEIM \
+ DEPEX1=$(AlertStandardFormatPei_DIR)\AlertStandardFormatPei.dxs \
+ DEPEX1_TYPE=EFI_SECTION_PEI_DEPEX \
+ COMPRESS=0
diff --git a/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Pei/AlertStandardFormatPei.sdl b/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Pei/AlertStandardFormatPei.sdl
new file mode 100644
index 0000000..ec7b2cd
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/AlertStandardFormat/Heci/Pei/AlertStandardFormatPei.sdl
@@ -0,0 +1,25 @@
+TOKEN
+ Name = AlertStandardFormatPei_SUPPORT
+ Value = 1
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable AlertStandardFormat support in Project"
+End
+
+MODULE
+ Help = "Includes AlertStandardFormat.mak to Project"
+ File = "AlertStandardFormatPei.mak"
+End
+
+PATH
+ Name = "AlertStandardFormatPei_DIR"
+ Help = "AlertStandardFormatPei files source directory"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\AlertStandardFormatPei.ffs"
+ Parent = "FV_BB"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/ME/ActiveManagement/AmtBootOptions/AmtBootOptions.cif b/ReferenceCode/ME/ActiveManagement/AmtBootOptions/AmtBootOptions.cif
new file mode 100644
index 0000000..a1c7a9f
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/AmtBootOptions/AmtBootOptions.cif
@@ -0,0 +1,10 @@
+<component>
+ name = "AmtBootOptions"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\ActiveManagement\AmtBootOptions\"
+ RefName = "AmtBootOptions"
+[files]
+"AmtBootOptions.sdl"
+[parts]
+"AmtDxe"
+<endComponent>
diff --git a/ReferenceCode/ME/ActiveManagement/AmtBootOptions/AmtBootOptions.sdl b/ReferenceCode/ME/ActiveManagement/AmtBootOptions/AmtBootOptions.sdl
new file mode 100644
index 0000000..86d7fc9
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/AmtBootOptions/AmtBootOptions.sdl
@@ -0,0 +1,21 @@
+TOKEN
+ Name = AmtBootOptions_SUPPORT
+ Value = 1
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable AMT support in Project"
+End
+
+PATH
+ Name = "AmtBootOptions_SOURCE"
+ Help = "AMT Driver files source directory"
+End
+
+ELINK
+ Name = "/I$(AmtBootOptions_SOURCE)\Include"
+ Parent = "ME_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
diff --git a/ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/AMTDxe.cif b/ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/AMTDxe.cif
new file mode 100644
index 0000000..295ac90
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/AMTDxe.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "AMTDxe"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\ActiveManagement\AmtBootOptions\Dxe\"
+ RefName = "AMTDxe"
+[files]
+"AMTDxe.sdl"
+"AMTDxe.mak"
+"ActiveManagement.c"
+"ActiveManagement.dxs"
+"ActiveManagement.h"
+"ActiveManagement.inf"
+<endComponent>
diff --git a/ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/AMTDxe.mak b/ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/AMTDxe.mak
new file mode 100644
index 0000000..981a295
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/AMTDxe.mak
@@ -0,0 +1,58 @@
+# MAK file for the eModule:AMTDxe
+
+all : AMTDxe
+
+
+AMTDxe : $(BUILD_DIR)\AMTDxe.mak AMTDxeBin
+
+$(BUILD_DIR)\AMTDxe.mak : $(AMTDxe_DIR)\$(@B).cif $(AMTDxe_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(AMTDxe_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+
+AMTDxe_INCLUDES=\
+ $(ME_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)
+
+
+AMTDxe_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=ActiveManagementEntryPoint"\
+ /D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__\
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+
+
+AMTDxe_LIB_LINKS =\
+ $(EDKPROTOCOLLIB)\
+ $(ProtocolLib_LIB)\
+ $(EFISCRIPTLIB)\
+ $(AmtLibDxe_LIB)\
+ $(MeLibDxe_LIB)\
+ $(MeChipsetDxeLib_LIB)\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(PchPlatformDxeLib_LIB)
+
+
+AMTDxeBin : $(AMTDxe_LIB_LINKS) $(MeDxe_LIB_LINKS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\AMTDxe.mak all\
+ "MY_INCLUDES=$(AMTDxe_INCLUDES)"\
+ "MY_DEFINES=$(AMTDxe_DEFINES)"\
+ GUID=D739F969-FB2D-4bc2-AFE7-081327D3FEDE \
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=BS_DRIVER \
+ EDKIIModule=DXEDRIVER\
+ DEPEX1=$(AMTDxe_DIR)\ActiveManagement.dxs \
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \
+ COMPRESS=1\
diff --git a/ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/AMTDxe.sdl b/ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/AMTDxe.sdl
new file mode 100644
index 0000000..be1bfc0
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/AMTDxe.sdl
@@ -0,0 +1,29 @@
+TOKEN
+ Name = "AMTDxe_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable AMT Dxe support in Project"
+End
+MODULE
+ Help = "Includes AMTDxe.mak to Project"
+ File = "AMTDxe.mak"
+End
+
+PATH
+ Name = "AMTDxe_DIR"
+ Help = "AMT Driver files source directory"
+End
+
+PATH
+ Name = "AMTDxe_SOURCE"
+ Help = "AMT Driver files source directory"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\AMTDxe.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/ActiveManagement.c b/ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/ActiveManagement.c
new file mode 100644
index 0000000..681bb6b
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/ActiveManagement.c
@@ -0,0 +1,553 @@
+/** @file
+ Defines and prototypes for the ActiveManagement driver.
+ This driver implements the ActiveManagement protocol for iAMT.
+ It provides some functions to get Boot Options from ASF.
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights
+ reserved This software and associated documentation (if any)
+ is furnished under a license and may only be used or copied in
+ accordance with the terms of the license. Except as permitted
+ by such license, no part of this software or documentation may
+ be reproduced, stored in a retrieval system, or transmitted in
+ any form or by any means without the express written consent
+ of Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "ActiveManagement.h"
+#include "MeLib.h"
+#include "MeAccess.h"
+#endif
+//
+// Global variables
+//
+EFI_ASF_BOOT_OPTIONS *mAsfBootOptions;
+
+ACTIVE_MANAGEMENT_INSTANCE ActiveManagementInstance = {
+ ACTIVE_MANAGEMENT_PRIVATE_DATA_SIGNATURE,
+ NULL,
+ {
+ (EFI_ACTIVE_MANAGEMENT_BOOT_OPTIONS_STATE) GetIderState,
+ (EFI_ACTIVE_MANAGEMENT_BOOT_OPTIONS_STATE) GetEnforceSecureBootState,
+ (EFI_ACTIVE_MANAGEMENT_BOOT_OPTIONS_STATE) GetSolState,
+ (EFI_ACTIVE_MANAGEMENT_BOOT_OPTIONS_STATE) GetRemoteFlashState,
+ (EFI_ACTIVE_MANAGEMENT_BOOT_OPTIONS_STATE) GetBiosSetupState,
+ (EFI_ACTIVE_MANAGEMENT_BOOT_OPTIONS_STATE) GetBiosPauseState,
+ (EFI_ACTIVE_MANAGEMENT_BOOT_OPTIONS_STATE) GetConsoleLockState,
+ (EFI_ACTIVE_MANAGEMENT_BOOT_OPTIONS_STATE) GetKvmState,
+ (EFI_ACTIVE_MANAGEMENT_IDER_BOOT_DEVICE_SELECTED) GetIderBootDeviceSelectd,
+ (EFI_ACTIVE_MANAGEMENT_ASF_BOOT_OPTIONS_GET) GetAsfBootOptions,
+ (EFI_ACTIVE_MANAGEMENT_BOOT_OPTIONS_STATE) GetProgressMsgRequest
+ },
+ NULL
+};
+
+//
+// Function implementations
+//
+
+/**
+ Check if ASF boot options is present.
+
+ @param[in] None.
+
+ @retval True ASF boot option is present.
+ @retval False ASF boot option is not present
+**/
+BOOLEAN
+IsBootOptionsPresent (
+ VOID
+ )
+{
+ return mAsfBootOptions->SubCommand == ASF_BOOT_OPTIONS_PRESENT;
+}
+
+/**
+ Check if LANA ID of ASF boot options is Industry ID.
+
+ @param[in] None.
+
+ @retval True IANA ID of ASF boot options is Industry ID.
+ @retval False IANA ID of ASF boot options is not Industry ID.
+**/
+BOOLEAN
+IsIndustryIanaId (
+ VOID
+ )
+{
+ volatile BOOLEAN RetVal;
+
+ RetVal = FALSE;
+ if (IsBootOptionsPresent ()) {
+ if (mAsfBootOptions->IanaId == ASF_INDUSTRY_CONVERTED_IANA) {
+ RetVal = TRUE;
+ }
+ }
+
+ return RetVal;
+}
+
+/**
+ Check if LANA ID of ASF boot options is Intel ID.
+
+ @param[in] None.
+
+ @retval True IANA ID of ASF boot options is Intel ID.
+ @retval False IANA ID of ASF boot options is not Intel ID.
+**/
+BOOLEAN
+IsIntelIanaId (
+ VOID
+ )
+{
+ volatile BOOLEAN RetVal;
+
+ RetVal = FALSE;
+
+ if (IsBootOptionsPresent ()) {
+ if (mAsfBootOptions->IanaId == ASF_INTEL_CONVERTED_IANA) {
+ RetVal = TRUE;
+ }
+ }
+
+ return RetVal;
+}
+
+/**
+ Check if it is Intel ASF boot options.
+
+ @param[in] None.
+
+ @retval True It is Intel ASF boot options.
+ @retval False It is not Intel ASF boot options.
+**/
+BOOLEAN
+IsIntelAmtBootOptions (
+ VOID
+ )
+{
+ BOOLEAN RetVal;
+
+ RetVal = FALSE;
+
+ if (IsIntelIanaId ()) {
+ if (mAsfBootOptions->SpecialCommand == ASF_INTEL_OEM_CMD) {
+ RetVal = TRUE;
+ }
+ }
+
+ return RetVal;
+}
+
+/**
+ Check the Special Command Parameter of Intel ASF boot options
+
+ @param[in] Options Special Command Parameter bit we want to check
+ Bit 0: Set if IDER is to be used on the next boot. Parameter 2 is set
+ to the driver number to be used.
+ Bit 1: Set if Secure Boot is enforced over IDER
+ Bit 2: Set if the BIOS is to be re-flashed on the next boot
+ Bit 3: Set if the BIOS is to boot into the BIOS set-up screen.
+ Bit 4: Boot into BIOS Pause on the next boot is supported
+ Bit 5: Set if the BIOS is to participate in KVM session
+ @param[in] CurrentState Return the state of result
+ True - Special Command Parameter bit in Options is enabled.
+ False - Special Command Parameter bit in Options is disabled.
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+GetSpecialParamState (
+ IN UINT16 Options,
+ IN OUT BOOLEAN *CurrentState
+ )
+{
+ *CurrentState = FALSE;
+ if (IsIntelAmtBootOptions ()) {
+ if ((mAsfBootOptions->SpecialCommandParam & Options) == Options) {
+ *CurrentState = TRUE;
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Check the OEM Parameter of Intel ASF boot options
+
+ @param[in] Options OEM Parameter bit we want to check
+ Bit 0: Set if SOL is to be used on the next boot.
+ @param[in] CurrentState Return the state of result
+ True : OEM Parameter bit in Options is enabled.
+ False : OEM Parameter bit in Options is disabled.
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+GetOemParamatersState (
+ IN UINT16 Options,
+ IN OUT BOOLEAN *CurrentState
+ )
+{
+ *CurrentState = FALSE;
+ if (IsIntelAmtBootOptions ()) {
+ if ((mAsfBootOptions->OemParameters & Options) == Options) {
+ *CurrentState = TRUE;
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Check the OEM Parameter of Intel ASF boot options
+
+ @param[in] Options OEM Parameter bit we want to check
+ Bit 0: Set if SOL is to be used on the next boot.
+ @param[in] CurrentState Return the state of result
+ True : OEM Parameter bit in Options is enabled.
+ False : OEM Parameter bit in Options is disabled.
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+GetBootOptionsMaskState (
+ IN UINT16 Options,
+ IN OUT BOOLEAN *CurrentState
+ )
+{
+ *CurrentState = FALSE;
+ if (IsBootOptionsPresent ()) {
+ if ((mAsfBootOptions->BootOptions & Options) == Options) {
+ *CurrentState = TRUE;
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This will return IDE Redirection Boot Option.
+ True if the option is enabled.
+
+ @param[in] This The address of protocol
+ @param[in] CurrentState Return the state of IDE Redireciton Boot Opiton
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+GetIderState (
+ IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This,
+ IN OUT BOOLEAN *CurrentState
+ )
+{
+ GetSpecialParamState (USE_IDER, CurrentState);
+ return EFI_SUCCESS;
+}
+
+/**
+ This will return IDE Redirection boot device to boot
+
+ @param[in] This The address of protocol
+ @param[in] IdeBootDevice Return the boot device number to boot
+ Bits 0-1: If IDER boot is selected in Perimeter 1 then Bits 1,2 define the drive on the IDER controller to be used as the boot driver.
+ Bit 1 Bit0
+ 0 0 Primary Master Drive
+ 0 1 Primary Slave Drive
+ 1 0 Secondary Master Drive
+ 1 1 Secondary Slave Drive
+ Bits 2-7: Reserved set to 0
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+GetIderBootDeviceSelectd (
+ IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This,
+ IN OUT UINT8 *IdeBootDevice
+ )
+{
+ *IdeBootDevice = (UINT8) ((mAsfBootOptions->SpecialCommandParam & IDER_BOOT_DEVICE_MASK) >> IDER_BOOT_DEVICE_SHIFT);
+ return EFI_SUCCESS;
+}
+
+/**
+ This will return Enforce Secure Boot over IDER Boot Option.
+ True if the option is enabled.
+
+ @param[in] This The address of protocol
+ @param[in] CurrentState Return the state of Enforce Secure Boot over IDER Boot Option
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+GetEnforceSecureBootState (
+ IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This,
+ IN OUT BOOLEAN *CurrentState
+ )
+{
+ GetSpecialParamState (ENFORCE_SECURE_BOOT, CurrentState);
+ return EFI_SUCCESS;
+}
+
+/**
+ This will return Serial-over-Lan Boot Option.
+ True if the option is enabled.
+
+ @param[in] This The address of protocol
+ @param[in] CurrentState Return the state of Serial-over-Lan Boot Opiton
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+GetSolState (
+ IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This,
+ IN OUT BOOLEAN *CurrentState
+ )
+{
+ GetOemParamatersState (USE_SOL, CurrentState);
+ return EFI_SUCCESS;
+}
+
+/**
+ This will return Remote Flash Boot Option.
+ True if the option is enabled.
+
+ @param[in] This The address of protocol
+ @param[in] CurrentState Return the state of Remote Flash Boot Opiton
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+GetRemoteFlashState (
+ IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This,
+ IN OUT BOOLEAN *CurrentState
+ )
+{
+ GetSpecialParamState (REFLASH_BIOS, CurrentState);
+ return EFI_SUCCESS;
+}
+
+/**
+ This will return BIOS Setup Boot Option.
+ True if the option is enabled.
+
+ @param[in] This The address of protocol
+ @param[in] CurrentState Return the state of BIOS Setup Boot Opiton
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+GetBiosSetupState (
+ IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This,
+ IN OUT BOOLEAN *CurrentState
+ )
+{
+ GetSpecialParamState (BIOS_SETUP, CurrentState);
+ return EFI_SUCCESS;
+}
+
+/**
+ This will return BIOS Pause Boot Option.
+ True if the option is enabled.
+
+ @param[in] This The address of protocol
+ @param[in] CurrentState Return the state of BIOS Pause Boot Opiton
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+GetBiosPauseState (
+ IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This,
+ IN OUT BOOLEAN *CurrentState
+ )
+{
+ GetSpecialParamState (BIOS_PAUSE, CurrentState);
+ return EFI_SUCCESS;
+}
+
+/**
+ This will return Console Lock Boot Option.
+ True if the option is enabled.
+
+ @param[in] This The address of protocol
+ @param[in] CurrentState Return the state of BIOS Pause Boot Opiton
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+GetConsoleLockState (
+ IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This,
+ IN OUT BOOLEAN *CurrentState
+ )
+{
+ GetBootOptionsMaskState (LOCK_KEYBOARD, CurrentState);
+ return EFI_SUCCESS;
+}
+
+/**
+ This will return KVM Boot Option.
+ True if the option is enabled.
+
+ @param[in] This The address of protocol
+ @param[in] CurrentState Return the state of KVM Boot Opiton
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+GetKvmState (
+ IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This,
+ IN OUT BOOLEAN *CurrentState
+ )
+{
+ GetSpecialParamState (USE_KVM, CurrentState);
+ return EFI_SUCCESS;
+}
+
+/**
+ Return current ASF Boot Options
+
+ @param[in] This Pointer to the EFI_ACTIVE_MANAGEMENT_PROTOCOL instance.
+ @param[in] AsfBootOptions ASF Boot Options
+
+ @retval EFI_SUCCESS Boot options updated
+**/
+EFI_STATUS
+EFIAPI
+GetAsfBootOptions (
+ IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This,
+ IN OUT EFI_ASF_BOOT_OPTIONS **AsfBootOptions
+ )
+{
+ *AsfBootOptions = mAsfBootOptions;
+ return EFI_SUCCESS;
+}
+
+/**
+ Disable these two driver of Sol & Ider
+
+ @param[in] None
+**/
+VOID
+SolIderDisable (
+ VOID
+ )
+{
+ IderDisable ();
+ SolDisable ();
+}
+
+/**
+ Disable Usbr
+
+ @param[in] None
+**/
+VOID
+UsbrDisable (
+ VOID
+ )
+{
+ Usbr1Disable ();
+ Usbr2Disable ();
+}
+
+/**
+ This will return progress event Option.
+ True if the option is enabled.
+
+ @param[in] This The address of protocol
+ @param[in] CurrentState Return the state of progress event Opiton
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+GetProgressMsgRequest (
+ IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This,
+ IN OUT BOOLEAN *CurrentState
+ )
+{
+ GetBootOptionsMaskState (FORCE_PROGRESS_EVENTS, CurrentState);
+ return EFI_SUCCESS;
+}
+
+/**
+ Entry point for the Active Management Driver.
+
+ @param[in] ImageHandle Image handle of this driver.
+ @param[in] SystemTable Global system service table.
+
+ @retval EFI_SUCCESS Initialization complete.
+ @exception EFI_UNSUPPORTED The chipset is unsupported by this driver.
+ @retval EFI_OUT_OF_RESOURCES Do not have enough resources to initialize the driver.
+ @retval EFI_DEVICE_ERROR Device error, driver exits abnormally.
+**/
+EFI_STATUS
+EFIAPI
+ActiveManagementEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+
+ ///
+ /// Check policy if AMT is supported
+ ///
+ if (!AmtSupported () || !AsfSupported ()) {
+ SolIderDisable ();
+ UsbrDisable ();
+ return EFI_UNSUPPORTED;
+ }
+ ///
+ /// Get Protocol for ASF
+ ///
+ Status = gBS->LocateProtocol (
+ &gEfiAlertStandardFormatProtocolGuid,
+ NULL,
+ (VOID **) &(ActiveManagementInstance.Asf)
+ );
+ if (EFI_ERROR (Status)) {
+ return EFI_UNSUPPORTED;
+ }
+ ///
+ /// Get ASF Boot Options
+ ///
+ Status = ActiveManagementInstance.Asf->GetBootOptions (ActiveManagementInstance.Asf, &mAsfBootOptions);
+ if (EFI_ERROR (Status)) {
+ return EFI_UNSUPPORTED;
+ }
+ ///
+ /// Install the EFI_ACTIVE_MANAGEMENT_PROTOCOL interface
+ ///
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &(ActiveManagementInstance.Handle),
+ &gEfiActiveManagementProtocolGuid,
+ &(ActiveManagementInstance.ActiveManagementProtocol),
+ NULL
+ );
+
+ return Status;
+}
diff --git a/ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/ActiveManagement.dxs b/ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/ActiveManagement.dxs
new file mode 100644
index 0000000..6c5fd38
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/ActiveManagement.dxs
@@ -0,0 +1,45 @@
+/** @file
+ Dependency expression source file.
+
+@copyright
+ Copyright (c) 2005 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "DxeDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+
+#include EFI_PROTOCOL_DEFINITION (AlertStandardFormat)
+#include EFI_PROTOCOL_DEFINITION (AmtPlatformPolicy)
+#include EFI_PROTOCOL_DEFINITION (MePlatformPolicy)
+#endif
+
+DEPENDENCY_START
+ EFI_ALERT_STANDARD_FORMAT_PROTOCOL_GUID AND
+ DXE_PLATFORM_AMT_POLICY_GUID AND
+ DXE_PLATFORM_ME_POLICY_GUID
+DEPENDENCY_END
diff --git a/ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/ActiveManagement.h b/ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/ActiveManagement.h
new file mode 100644
index 0000000..72bb113
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/ActiveManagement.h
@@ -0,0 +1,272 @@
+/** @file
+ Header file for the Active Management Driver.
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights
+ reserved This software and associated documentation (if any)
+ is furnished under a license and may only be used or copied in
+ accordance with the terms of the license. Except as permitted
+ by such license, no part of this software or documentation may
+ be reproduced, stored in a retrieval system, or transmitted in
+ any form or by any means without the express written consent
+ of Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#ifndef _ACTIVE_MANAGEMENT_H_
+#define _ACTIVE_MANAGEMENT_H_
+#include "Amt.h"
+#include "AmtLib.h"
+
+//
+// Used during initialization
+//
+#include EFI_PROTOCOL_CONSUMER (AlertStandardFormat)
+
+//
+// Driver Produced Protocols
+//
+#include EFI_PROTOCOL_PRODUCER (ActiveManagement)
+
+//
+// Private data structure definitions for the driver
+//
+#define ACTIVE_MANAGEMENT_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('A', 'M', 'T', 'P')
+
+typedef struct {
+ UINTN Signature;
+ EFI_HANDLE Handle;
+ EFI_ACTIVE_MANAGEMENT_PROTOCOL ActiveManagementProtocol;
+ EFI_ALERT_STANDARD_FORMAT_PROTOCOL *Asf;
+} ACTIVE_MANAGEMENT_INSTANCE;
+
+#define ACTIVE_MANAGEMENT_INSTANCE_FROM_ACTIVE_MANAGEMENT_PROTOCOL(a) \
+ CR ( \
+ a, \
+ ACTIVE_MANAGEMENT_INSTANCE, \
+ ActiveManagementProtocol, \
+ ACTIVE_MANAGEMENT_PRIVATE_DATA_SIGNATURE \
+ )
+
+//
+// Function prototypes used by the AMT protocol.
+//
+
+/**
+ This will return IDE Redirection Boot Option.
+ True if the option is enabled.
+
+ @param[in] This The address of protocol
+ @param[in] CurrentState Return the state of IDE Redireciton Boot Opiton
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+GetIderState (
+ IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This,
+ IN OUT BOOLEAN *CurrentState
+ )
+;
+
+/**
+ This will return IDE Redirection boot device to boot
+
+ @param[in] This The address of protocol
+ @param[in] IdeBootDevice Return the boot device number to boot
+ Bits 0-1: If IDER boot is selected in Perimeter 1 then Bits 1,2 define the drive on the IDER controller to be used as the boot driver.
+ Bit 1 Bit0
+ 0 0 Primary Master Drive
+ 0 1 Primary Slave Drive
+ 1 0 Secondary Master Drive
+ 1 1 Secondary Slave Drive
+ Bits 2-7: Reserved set to 0
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+GetIderBootDeviceSelectd (
+ IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This,
+ IN OUT UINT8 *IdeBootDevice
+ )
+;
+
+/**
+ This will return Enforce Secure Boot over IDER Boot Option.
+ True if the option is enabled.
+
+ @param[in] This The address of protocol
+ @param[in] CurrentState Return the state of Enforce Secure Boot over IDER Boot Option
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+GetEnforceSecureBootState (
+ IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This,
+ IN OUT BOOLEAN *CurrentState
+ )
+;
+
+/**
+ This will return Serial-over-Lan Boot Option.
+ True if the option is enabled.
+
+ @param[in] This The address of protocol
+ @param[in] CurrentState Return the state of Serial-over-Lan Boot Opiton
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+GetSolState (
+ IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This,
+ IN OUT BOOLEAN *CurrentState
+ )
+;
+
+/**
+ This will return Remote Flash Boot Option.
+ True if the option is enabled.
+
+ @param[in] This The address of protocol
+ @param[in] CurrentState Return the state of Remote Flash Boot Opiton
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+GetRemoteFlashState (
+ IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This,
+ IN OUT BOOLEAN *CurrentState
+ )
+;
+
+/**
+ This will return BIOS Setup Boot Option.
+ True if the option is enabled.
+
+ @param[in] This The address of protocol
+ @param[in] CurrentState Return the state of BIOS Setup Boot Opiton
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+GetBiosSetupState (
+ IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This,
+ IN OUT BOOLEAN *CurrentState
+ )
+;
+
+/**
+ This will return BIOS Pause Boot Option.
+ True if the option is enabled.
+
+ @param[in] This The address of protocol
+ @param[in] CurrentState Return the state of BIOS Pause Boot Opiton
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+GetBiosPauseState (
+ IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This,
+ IN OUT BOOLEAN *CurrentState
+ )
+;
+
+/**
+ This will return Console Lock Boot Option.
+ True if the option is enabled.
+
+ @param[in] This The address of protocol
+ @param[in] CurrentState Return the state of BIOS Pause Boot Opiton
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+GetConsoleLockState (
+ IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This,
+ IN OUT BOOLEAN *CurrentState
+ )
+;
+
+/**
+ This will return KVM Boot Option.
+ True if the option is enabled.
+
+ @param[in] This The address of protocol
+ @param[in] CurrentState Return the state of KVM Boot Opiton
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+GetKvmState (
+ IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This,
+ IN OUT BOOLEAN *CurrentState
+ )
+;
+
+/**
+ Return current ASF Boot Options
+
+ @param[in] This Pointer to the EFI_ACTIVE_MANAGEMENT_PROTOCOL instance.
+ @param[in] AsfBootOptions ASF Boot Options
+
+ @retval EFI_SUCCESS Boot options updated
+**/
+EFI_STATUS
+EFIAPI
+GetAsfBootOptions (
+ IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This,
+ IN OUT EFI_ASF_BOOT_OPTIONS **AsfBootOptions
+ )
+;
+
+/**
+ This will return progress event Option.
+ True if the option is enabled.
+
+ @param[in] This The address of protocol
+ @param[in] CurrentState Return the state of progress event Opiton
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+GetProgressMsgRequest (
+ IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This,
+ IN OUT BOOLEAN *CurrentState
+ )
+;
+
+/**
+ Entry point for the Active Management Driver.
+
+ @param[in] ImageHandle Image handle of this driver.
+ @param[in] SystemTable Global system service table.
+
+ @retval EFI_SUCCESS Initialization complete.
+ @exception EFI_UNSUPPORTED The chipset is unsupported by this driver.
+ @retval EFI_OUT_OF_RESOURCES Do not have enough resources to initialize the driver.
+ @retval EFI_DEVICE_ERROR Device error, driver exits abnormally.
+**/
+EFI_STATUS
+EFIAPI
+ActiveManagementEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+;
+
+#endif
diff --git a/ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/ActiveManagement.inf b/ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/ActiveManagement.inf
new file mode 100644
index 0000000..3dd5fe3
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/AmtBootOptions/Dxe/ActiveManagement.inf
@@ -0,0 +1,100 @@
+## @file
+# Component description file for the AMT driver.
+#
+#@copyright
+# Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = ActiveManagement
+FILE_GUID = D739F969-FB2D-4bc2-AFE7-081327D3FEDE
+COMPONENT_TYPE = BS_DRIVER
+
+[sources.common]
+ ActiveManagement.h
+ ActiveManagement.c
+
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueDxeDriverEntryPoint.c
+
+[includes.common]
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Heci/Include
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/AMT/Dxe
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/AMT/Include
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/Dxe
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/SampleCode/Include
+
+#
+# Edk II Glue Library, some hearder are included by R9 header so have to include
+#
+
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Framework
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[libraries.common]
+ AmtLib
+ MeProtocolLib
+ MeLib
+ MeChipsetLib
+ EdkProtocolLib
+ EdkFrameworkProtocolLib
+ EdkIIGlueDxeReportStatusCodeLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueBasePciLibPciExpress
+ EdkIIGlueBasePciExpressLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = Activemanagement.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=ActiveManagementEntryPoint
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__\
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__
+
diff --git a/ReferenceCode/ME/ActiveManagement/IdeR/Dxe/IdeRController.c b/ReferenceCode/ME/ActiveManagement/IdeR/Dxe/IdeRController.c
new file mode 100644
index 0000000..8465de8
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/IdeR/Dxe/IdeRController.c
@@ -0,0 +1,927 @@
+/** @file
+ This driver module produces IDE_CONTROLLER_INIT protocol and will be used by
+ IDE Bus driver to support platform dependent timing information. This driver
+ is responsible for early initialization of IDE Redirect controller.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights
+ reserved This software and associated documentation (if any)
+ is furnished under a license and may only be used or copied in
+ accordance with the terms of the license. Except as permitted
+ by such license, no part of this software or documentation may
+ be reproduced, stored in a retrieval system, or transmitted in
+ any form or by any means without the express written consent
+ of Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "IdeRController.h"
+#include "MeLib.h"
+#endif
+
+///
+/// EFI_DRIVER_BINDING_PROTOCOL instance
+///
+EFI_DRIVER_BINDING_PROTOCOL mIdeRControllerDriverBinding = {
+ IdeRControllerSupported,
+ IdeRControllerStart,
+ IdeRControllerStop,
+ 1, // Version
+ NULL, // ImageHandle
+ NULL // DriverBindingHandle
+};
+
+/**
+ This function is used to calculate the best PIO mode supported by
+ specific IDE device
+
+ Since the LPT IDE-R doesn't support changing the timing
+ registers because they are RO 0x00, we'll just return PIO mode 2.
+
+ @param[in] IdentifyData The identify data of specific IDE device
+ @param[in] DisPioMode Disqualified PIO modes collection
+ @param[in] SelectedMode Available PIO modes collection
+
+ @retval EFI_SUCCESS SelectedMode calculated.
+**/
+EFI_STATUS
+CalculateBestPioMode (
+ IN EFI_IDENTIFY_DATA *IdentifyData,
+ IN UINT16 *DisPioMode OPTIONAL,
+ OUT UINT16 *SelectedMode
+ )
+{
+ ///
+ /// ATA_PIO_MODE_2;
+ ///
+ *SelectedMode = 2;
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This function is used to calculate the best UDMA mode supported by
+ specific IDE device
+
+ Since the LPT IDE-R doesn't support changing the timing
+ registers because they are RO 0x00, we'll just return DMA mode 2.
+
+ @param[in] IdentifyData The identify data of specific IDE device
+ @param[in] DisUDmaMode Disqualified UDMA modes collection
+ @param[in] SelectedMode Available UMDA modes collection
+
+ @retval EFI_SUCCESS SelectedMode calculated.
+**/
+EFI_STATUS
+CalculateBestUdmaMode (
+ IN EFI_IDENTIFY_DATA *IdentifyData,
+ IN UINT16 *DisUDmaMode OPTIONAL,
+ OUT UINT16 *SelectedMode
+ )
+{
+ ///
+ /// ATA_UDMA_MODE_2;
+ ///
+ *SelectedMode = 2;
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This function is used to set appropriate PIO timing on Ide
+ controller according supported PIO modes
+
+ @param[in] Channel IDE channel number (0 based, either 0 or 1).
+ For LPT IDE-R there is only one (See IDER_MAX_CHANNEL).
+ @param[in] Device IDE device number
+ @param[in] PciIo Pointer to PciIo protocol opened by Ide controller driver
+ @param[in] IdentifyData The identify struct submitted by IDE device
+ @param[in] Modes The PIO mode collection supported by IDE device
+
+ @retval EFI_SUCCESS PIO timing initialized or no need to program PIO mode
+**/
+EFI_STATUS
+IdeInitSetPioTiming (
+ IN UINT8 Channel,
+ IN UINT8 Device,
+ IN EFI_PCI_IO_PROTOCOL *PciIo,
+ IN EFI_IDENTIFY_DATA *IdentifyData,
+ IN EFI_ATA_COLLECTIVE_MODE *Modes
+ )
+{
+ ///
+ /// Since the Cantiga version of the ME IDER doesn't support registers 40-4F (they are RO),
+ /// there is no need to program PIO mode.
+ ///
+ return EFI_SUCCESS;
+}
+
+/**
+ This function is used to set appropriate UDMA timing on Ide
+ controller according supported UDMA modes
+
+ @param[in] Channel IDE channel number (0 based, either 0 or 1).
+ For LPT IDE-R there is only one (See IDER_MAX_CHANNEL).
+ @param[in] Device IDE device number
+ @param[in] PciIo Pointer to PciIo protocol opened by Ide controller driver
+ @param[in] Modes The UDMA mode collection supported by IDE device
+
+ @retval Status code returned by PciIo operations
+**/
+EFI_STATUS
+IdeInitSetUdmaTiming (
+ IN UINT8 Channel,
+ IN UINT8 Device,
+ IN EFI_PCI_IO_PROTOCOL *PciIo,
+ IN EFI_ATA_COLLECTIVE_MODE *Modes
+ )
+{
+ ///
+ /// Since the Cantiga version of the ME IDE-R doesn't support registers 40-C7 (they are RO),
+ /// there is no need to program PIO/UDMA mode.
+ ///
+ EFI_STATUS Status;
+ UINT16 PciCommandReg;
+ UINT8 BusMasterIdeStatusReg;
+
+ ///
+ /// PCI Command Register, offset 0x4, default 00
+ ///
+ Status = PciIo->Pci.Read (
+ PciIo,
+ EfiPciIoWidthUint16,
+ PCI_COMMAND_REGISTER,
+ 1,
+ &PciCommandReg
+ );
+ ///
+ /// Now set the PCH IDE Bus Master Enable bit, one bit for PCH controller
+ /// If BME bit is not set, set it
+ ///
+ if (!(PciCommandReg & BME_BUS_MASTER_ENABLE_BIT)) {
+ PciCommandReg |= BME_BUS_MASTER_ENABLE_BIT;
+
+ Status = PciIo->Pci.Write (
+ PciIo,
+ EfiPciIoWidthUint16,
+ PCI_COMMAND_REGISTER, // offset 0x4
+ 1,
+ &PciCommandReg
+ );
+ }
+
+ Status = PciIo->Io.Read (
+ PciIo,
+ EfiPciIoWidthUint8,
+ 4,
+ (Channel == 0 ? 0x2 : 0xA),
+ 1,
+ &BusMasterIdeStatusReg
+ );
+
+ BusMasterIdeStatusReg = (UINT8) (BusMasterIdeStatusReg | (Device == 0 ? BIT5 : BIT6));
+
+ Status = PciIo->Io.Write (
+ PciIo,
+ EfiPciIoWidthUint8,
+ 4,
+ (Channel == 0 ? 0x2 : 0xA),
+ 1,
+ &BusMasterIdeStatusReg
+ );
+
+ return Status;
+}
+
+/**
+ This function is called after IdeBus driver submits its EFI_IDENTIFY_DATA data struct
+ to IDE controller driver. The main purpose is to detect IDE
+ cable type.
+
+ @param[in] Channel IDE channel number (0 based, either 0 or 1).
+ For LPT IDE-R there is only one (See IDER_MAX_CHANNEL).
+ @param[in] Device IDE device number
+ @param[in] PciIo Pointer to PciIo protocol instance opened by Ide driver
+ @param[in] IdentifyData A pointer to EFI_IDENTIFY_DATA data structure
+
+ @retval EFI_SUCCESS Cable type detected
+**/
+EFI_STATUS
+IdeDetectCableType (
+ IN UINT8 Channel,
+ IN UINT8 Device,
+ IN EFI_PCI_IO_PROTOCOL *PciIo,
+ IN EFI_IDENTIFY_DATA *IdentifyData
+ )
+{
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+AdjustUdmaModeByCableType (
+ IN UINT8 Channel,
+ IN UINT8 Device,
+ IN EFI_PCI_IO_PROTOCOL *PciIo,
+ IN OUT EFI_ATA_COLLECTIVE_MODE *Modes
+ )
+/**
+ This function is called AFTER IdeBus driver submits its EFI_IDENTIFY_DATA data struct.
+ The main objective of this function is to adjust best calculated UDMA mode
+ according to current cable type. LPT IDE-R is hardcoded to 40 pin UDMA-2/33 mode.
+ Note that the cable reporting bits should be set prior to this function call
+
+ @param[in] Channel IDE channel number (0 based, either 0 or 1).
+ For LPT IDE-R there is only one (See IDER_MAX_CHANNEL).
+ @param[in] Device IDE device number
+ @param[in] PciIo Pointer to PciIo protocol instance opened by Ide driver
+ @param[in] Modes The current best supported mode calculated by this driver
+
+ @retval EFI_SUCCESS UdmaMode copied
+**/
+{
+ Modes->UdmaMode.Mode = 2;
+ return EFI_SUCCESS;
+}
+
+///
+/// Interface functions of IDE_CONTROLLER_INIT protocol
+///
+
+/**
+ This function can be used to obtain information about a specified channel.
+ It's usually used by IDE Bus driver during enumeration process.
+
+ @param[in] This The EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.
+ @param[in] Channel Channel number (0 based, either 0 or 1)
+ @param[in] Enabled TRUE if the channel is enabled. If the channel is disabled,
+ then it will no be enumerated.
+ @param[in] MaxDevices The Max number of IDE devices that the bus driver can expect
+ on this channel. For ATA/ATAPI, this number is either 1 or 2.
+
+ @retval EFI_SUCCESS Information copied
+ @retval EFI_INVALID_PARAMETER Invalid channel
+**/
+EFI_STATUS
+EFIAPI
+IdeInitGetChannelInfo (
+ IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
+ IN UINT8 Channel,
+ OUT BOOLEAN *Enabled,
+ OUT UINT8 *MaxDevices
+ )
+{
+ ///
+ /// Channel number (0 based, either 0 or 1)
+ /// For LPT IDE-R there is only one (See IDER_MAX_CHANNEL).
+ ///
+ if (Channel < IDER_MAX_CHANNEL) {
+ *Enabled = TRUE;
+ *MaxDevices = IDER_MAX_DEVICES;
+ return EFI_SUCCESS;
+
+ } else {
+ return EFI_INVALID_PARAMETER;
+ }
+}
+
+/**
+ This function is called by IdeBus driver before executing certain actions.
+ This allows IDE Controller Init to prepare for each action.
+
+ @param[in] This The EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.
+ @param[in] Phase Phase indicator defined by IDE_CONTROLLER_INIT protocol
+ @param[in] Channel Channel number (0 based, either 0 or 1)
+
+ @retval EFI_SUCCESS Preparation done
+ @retval EFI_INVALID_PARAMETER Invalid channel
+ @exception EFI_UNSUPPORTED Invalid phase
+**/
+EFI_STATUS
+EFIAPI
+IdeInitNotifyPhase (
+ IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
+ IN EFI_IDE_CONTROLLER_ENUM_PHASE Phase,
+ IN UINT8 Channel
+ )
+{
+ if (Channel >= IDER_MAX_CHANNEL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ switch (Phase) {
+
+ case EfiIdeBeforeChannelEnumeration:
+ case EfiIdeAfterChannelEnumeration:
+ case EfiIdeBeforeChannelReset:
+ case EfiIdeAfterChannelReset:
+ case EfiIdeBusBeforeDevicePresenceDetection:
+ case EfiIdeBusAfterDevicePresenceDetection:
+ case EfiIdeResetMode:
+ ///
+ /// Do nothing at present
+ ///
+ break;
+
+ default:
+ return EFI_UNSUPPORTED;
+ break;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This function is called by IdeBus driver to submit EFI_IDENTIFY_DATA data structure
+ obtained from IDE deivce. This structure is used to set IDE timing
+
+ @param[in] This The EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.
+ @param[in] Channel IDE channel number (0 based, either 0 or 1)
+ @param[in] Device IDE device number
+ @param[in] IdentifyData A pointer to EFI_IDENTIFY_DATA data structure
+
+ @retval EFI_SUCCESS Data submitted
+ @retval EFI_INVALID_PARAMETER Invalid channel
+**/
+EFI_STATUS
+EFIAPI
+IdeInitSubmitData (
+ IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
+ IN UINT8 Channel,
+ IN UINT8 Device,
+ IN EFI_IDENTIFY_DATA *IdentifyData
+ )
+{
+ EFI_IDE_CONTROLLER_PRIVATE_DATA *IdePrivateData;
+
+ if (Channel >= IDER_MAX_CHANNEL || Device >= IDER_MAX_DEVICES) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ IdePrivateData = IDE_CONTROLLER_PRIVATE_DATA_FROM_THIS (This);
+ ASSERT (IdePrivateData);
+
+ ///
+ /// Make a local copy of device's IdentifyData and mark the valid flag
+ ///
+ if (IdentifyData != NULL) {
+ CopyMem (
+ &(IdePrivateData->IdentifyData[Channel][Device]),
+ IdentifyData,
+ sizeof (EFI_IDENTIFY_DATA)
+ );
+
+ IdePrivateData->IdentifyValid[Channel][Device] = TRUE;
+
+ ///
+ /// Detect cable type and set cable type reg once we get identify data
+ ///
+ IdeDetectCableType (
+ Channel,
+ Device,
+ IdePrivateData->PciIo,
+ &(IdePrivateData->IdentifyData[Channel][Device])
+ );
+
+ } else {
+ IdePrivateData->IdentifyValid[Channel][Device] = FALSE;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This function is called by IdeBus driver to disqualify unsupported operation
+ mode on specfic IDE device
+
+ @param[in] This The EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.
+ @param[in] Channel IDE channel number (0 based, either 0 or 1)
+ @param[in] Device IDE device number
+ @param[in] BadModes Operation mode indicator
+
+ @retval EFI_SUCCESS Disqulified Modes recorded
+ @retval EFI_INVALID_PARAMETER Invalid channel or invalid BadModes pointer
+**/
+EFI_STATUS
+EFIAPI
+IdeInitDisqualifyMode (
+ IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
+ IN UINT8 Channel,
+ IN UINT8 Device,
+ IN EFI_ATA_COLLECTIVE_MODE *BadModes
+ )
+{
+ EFI_IDE_CONTROLLER_PRIVATE_DATA *IdePrivateData;
+
+ if (Channel >= IDER_MAX_CHANNEL || Device >= IDER_MAX_DEVICES || BadModes == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ IdePrivateData = IDE_CONTROLLER_PRIVATE_DATA_FROM_THIS (This);
+ ASSERT (IdePrivateData);
+
+ ///
+ /// Record the disqualified modes per channel per device. From ATA/ATAPI spec,
+ /// if a mode is not supported, the modes higher than it is also not
+ /// supported
+ ///
+ CopyMem (
+ &(IdePrivateData->DisqulifiedModes[Channel][Device]),
+ BadModes,
+ sizeof (EFI_ATA_COLLECTIVE_MODE)
+ );
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This function is called by IdeBus driver to calculate the best operation mode
+ supported by specific IDE device
+
+ @param[in] This The EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.
+ @param[in] Channel IDE channel number (0 based, either 0 or 1)
+ @param[in] Device IDE device number
+ @param[in] SupportedModes Modes collection supported by IDE device
+
+ @retval EFI_SUCCESS Disqulified Modes recorded
+ @retval EFI_INVALID_PARAMETER Invalid channel or invalid SupportedModes pointer
+ @retval EFI_NOT_READY IdentifyData is not valid
+ @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary data structures
+**/
+EFI_STATUS
+EFIAPI
+IdeInitCalculateMode (
+ IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
+ IN UINT8 Channel,
+ IN UINT8 Device,
+ OUT EFI_ATA_COLLECTIVE_MODE **SupportedModes
+ )
+{
+ EFI_IDE_CONTROLLER_PRIVATE_DATA *IdePrivateData;
+ EFI_IDENTIFY_DATA *IdentifyData;
+ BOOLEAN IdentifyValid;
+ EFI_ATA_COLLECTIVE_MODE *DisqulifiedModes;
+ UINT16 SelectedMode;
+ EFI_STATUS Status;
+
+ if (Channel >= IDER_MAX_CHANNEL || Device >= IDER_MAX_DEVICES || SupportedModes == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ IdePrivateData = IDE_CONTROLLER_PRIVATE_DATA_FROM_THIS (This);
+ ASSERT (IdePrivateData);
+
+ IdentifyData = &(IdePrivateData->IdentifyData[Channel][Device]);
+ DisqulifiedModes = &(IdePrivateData->DisqulifiedModes[Channel][Device]);
+ IdentifyValid = IdePrivateData->IdentifyValid[Channel][Device];
+
+ ///
+ /// Make sure we've got the valid identify data of the device from SubmitData()
+ ///
+ if (!IdentifyValid) {
+ return EFI_NOT_READY;
+ }
+
+ *SupportedModes = AllocateZeroPool (sizeof (EFI_ATA_COLLECTIVE_MODE));
+ if (*SupportedModes == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Status = CalculateBestPioMode (
+ IdentifyData,
+ (DisqulifiedModes->PioMode.Valid ? ((UINT16 *) &(DisqulifiedModes->PioMode.Mode)) : NULL),
+ &SelectedMode
+ );
+ if (!EFI_ERROR (Status)) {
+ (*SupportedModes)->PioMode.Valid = TRUE;
+ (*SupportedModes)->PioMode.Mode = SelectedMode;
+
+ } else {
+ (*SupportedModes)->PioMode.Valid = FALSE;
+ }
+
+ Status = CalculateBestUdmaMode (
+ IdentifyData,
+ (DisqulifiedModes->UdmaMode.Valid ? ((UINT16 *) &(DisqulifiedModes->UdmaMode.Mode)) : NULL),
+ &SelectedMode
+ );
+ if (!EFI_ERROR (Status)) {
+ (*SupportedModes)->UdmaMode.Valid = TRUE;
+ (*SupportedModes)->UdmaMode.Mode = SelectedMode;
+
+ } else {
+ (*SupportedModes)->UdmaMode.Valid = FALSE;
+ }
+ ///
+ /// It is only referenced here.
+ ///
+ (*SupportedModes)->ExtModeCount = 1;
+ ///
+ /// The modes other than PIO and UDMA are not supported by Ide controller
+ ///
+ return EFI_SUCCESS;
+}
+
+/**
+ This function is called by IdeBus driver to set appropriate timing on IDE
+ controller according supported operation mode
+
+ @param[in] This The EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.
+ @param[in] Channel IDE channel number (0 based, either 0 or 1)
+ @param[in] Device IDE device number
+ @param[in] Modes IDE device mode
+
+ @retval EFI_SUCCESS Disqulified Modes recorded
+ @retval EFI_INVALID_PARAMETER Invalid channel or invalid Modes pointer
+ @retval EFI_NOT_READY IdentifyData is not valid
+ @exception EFI_UNSUPPORTED Failed to set PIO/MDMA/SDMA timing
+**/
+EFI_STATUS
+EFIAPI
+IdeInitSetTiming (
+ IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
+ IN UINT8 Channel,
+ IN UINT8 Device,
+ IN EFI_ATA_COLLECTIVE_MODE *Modes
+ )
+{
+ EFI_IDE_CONTROLLER_PRIVATE_DATA *IdePrivateData;
+
+ if (Channel >= IDER_MAX_CHANNEL || Device >= IDER_MAX_DEVICES || Modes == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ IdePrivateData = IDE_CONTROLLER_PRIVATE_DATA_FROM_THIS (This);
+ ASSERT (IdePrivateData);
+
+ ///
+ /// Make sure we've got the valid identify data of the device from SubmitData()
+ ///
+ if (!(IdePrivateData->IdentifyValid[Channel][Device])) {
+ return EFI_NOT_READY;
+ }
+ ///
+ /// Set UMDA timing
+ ///
+ if (Modes->UdmaMode.Valid) {
+ IdeInitSetUdmaTiming (
+ Channel,
+ Device,
+ IdePrivateData->PciIo,
+ Modes
+ );
+ }
+ ///
+ /// Set PIO/MDMA/SDMA timing (They generally share the same timing values)
+ ///
+ if (Modes->PioMode.Valid) {
+ IdeInitSetPioTiming (
+ Channel,
+ Device,
+ IdePrivateData->PciIo,
+ &(IdePrivateData->IdentifyData[Channel][Device]),
+ Modes
+ );
+
+ } else {
+ return EFI_UNSUPPORTED;
+ }
+
+ return EFI_SUCCESS;
+}
+
+///
+/// IDE-R Controller Binding protocol declaration
+///
+
+/**
+ This function checks to see if the driver supports a device specified by
+ "Controller handle" parameter. It is called by DXE Core StartImage() or
+ ConnectController() routines. The driver uses 'device path' and/or
+ 'services' from the Bus I/O abstraction attached to the controller handle
+ to determine if the driver support this controller handle.
+
+ Note: In the BDS (Boot Device Selection) phase, the DXE core enumerate all
+ devices (or, controller) and assigns GUIDs to them.
+
+ @param[in] This a pointer points to the Binding Protocol instance
+ @param[in] Controller The handle of controller to be tested.
+ @param[in] RemainingDevicePath A pointer to the device path. Ignored by device
+ driver but used by bus driver
+
+ @retval EFI_SUCCESS Have device to support
+ @retval EFI_NOT_FOUND Relative environment not ready
+ @exception EFI_UNSUPPORTED The device doesn't support
+**/
+EFI_STATUS
+EFIAPI
+IdeRControllerSupported (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE Controller,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
+ )
+{
+ EFI_STATUS Status;
+ EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
+ EFI_PCI_IO_PROTOCOL *PciIo;
+ PCI_TYPE00 PciData;
+
+
+ ///
+ /// Ide Controller is a device driver, and should ingore the
+ /// "RemainingDevicePath" according to EFI spec
+ ///
+ Status = gBS->OpenProtocol (
+ Controller,
+ &gEfiDevicePathProtocolGuid,
+ (VOID *) &ParentDevicePath,
+ This->DriverBindingHandle,
+ Controller,
+ EFI_OPEN_PROTOCOL_BY_DRIVER
+ );
+ if (EFI_ERROR (Status)) {
+ ///
+ /// EFI_ALREADY_STARTED is also an error
+ ///
+ return Status;
+ }
+ ///
+ /// Close the protocol because we don't use it here
+ ///
+ gBS->CloseProtocol (
+ Controller, // handle of the controller
+ &gEfiDevicePathProtocolGuid, // Porotcol to be closed
+ This->DriverBindingHandle, // agent of opening the protocol
+ Controller
+ );
+
+ ///
+ /// Now test the EfiPciIoProtocol
+ ///
+ Status = gBS->OpenProtocol (
+ Controller,
+ &gEfiPciIoProtocolGuid,
+ (VOID **) &PciIo,
+ This->DriverBindingHandle,
+ Controller,
+ EFI_OPEN_PROTOCOL_BY_DRIVER
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ ///
+ /// Now further check the PCI header: Base class (offset 0x0B) and
+ /// Sub Class (offset 0x0A). This controller should be an Ide controller
+ ///
+ Status = PciIo->Pci.Read (
+ PciIo,
+ EfiPciIoWidthUint8,
+ 0,
+ sizeof (PciData),
+ &PciData
+ );
+
+ if (EFI_ERROR (Status)) {
+ gBS->CloseProtocol (
+ Controller,
+ &gEfiPciIoProtocolGuid,
+ This->DriverBindingHandle,
+ Controller
+ );
+ return EFI_UNSUPPORTED;
+ }
+ ///
+ /// Examine IDE-R PCI Configuration table fields
+ ///
+ if ((PciData.Hdr.ClassCode[2] != PCI_CLASS_MASS_STORAGE) ||
+ (PciData.Hdr.ClassCode[1] != PCI_SUB_CLASS_IDE) ||
+ (PciData.Hdr.VendorId != V_ME_IDER_VENDOR_ID) ||
+ !IS_PCH_LPT_IDER_DEVICE_ID(PciData.Hdr.DeviceId)
+ ) {
+
+ Status = EFI_UNSUPPORTED;
+ }
+ ///
+ /// Close the I/O Abstraction(s) used to perform the supported test
+ ///
+ gBS->CloseProtocol (
+ Controller,
+ &gEfiPciIoProtocolGuid,
+ This->DriverBindingHandle,
+ Controller
+ );
+
+ return Status;
+}
+
+/**
+ This routine is called right after the .Supported() called and return
+ EFI_SUCCESS. Notes: The supported protocols are checked but the Protocols
+ are closed.
+
+ @param[in] This a pointer points to the Binding Protocol instance
+ @param[in] Controller The handle of controller to be tested. Parameter
+ passed by the caller
+ @param[in] RemainingDevicePath A pointer to the device path. Should be ignored by
+ device driver
+
+ @retval EFI_SUCCESS The driver ready and initial complete.
+ @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary data structures
+ @retval EFI_DEVICE_ERROR The device doesn't initial.
+**/
+EFI_STATUS
+EFIAPI
+IdeRControllerStart (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE Controller,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
+ )
+{
+ EFI_STATUS Status;
+ EFI_PCI_IO_PROTOCOL *PciIo;
+ EFI_IDE_CONTROLLER_PRIVATE_DATA *IdePrivateData;
+ UINT64 CommandVal;
+
+ ///
+ /// Now test and open the EfiPciIoProtocol
+ ///
+ Status = gBS->OpenProtocol (
+ Controller,
+ &gEfiPciIoProtocolGuid,
+ (VOID **) &PciIo,
+ This->DriverBindingHandle,
+ Controller,
+ EFI_OPEN_PROTOCOL_BY_DRIVER
+ );
+
+ ///
+ /// Status == 0 - A normal execution flow, SUCCESS and the program proceeds.
+ /// Status == ALREADY_STARTED - A non-zero Status code returned. It indicates
+ /// that the protocol has been opened and should be treated as a
+ /// normal condition and the program proceeds. The Protocol will not
+ /// opened 'again' by this call.
+ /// Status != ALREADY_STARTED - Error status, terminate program execution
+ ///
+ if (EFI_ERROR (Status)) {
+ ///
+ /// EFI_ALREADY_STARTED is also an error
+ ///
+ return Status;
+ }
+ ///
+ /// Allocate Ide private data structure
+ ///
+ IdePrivateData = AllocatePool (sizeof (EFI_IDE_CONTROLLER_PRIVATE_DATA));
+ ASSERT (IdePrivateData != NULL);
+ if (IdePrivateData == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ ///
+ /// Initialize IdeR controller private data
+ ///
+ ZeroMem (IdePrivateData, sizeof (EFI_IDE_CONTROLLER_PRIVATE_DATA));
+ IdePrivateData->Signature = IDER_CONTROLLER_SIGNATURE;
+ IdePrivateData->PciIo = PciIo;
+ IdePrivateData->IdeInit.GetChannelInfo = IdeInitGetChannelInfo;
+ IdePrivateData->IdeInit.NotifyPhase = IdeInitNotifyPhase;
+ IdePrivateData->IdeInit.SubmitData = IdeInitSubmitData;
+ IdePrivateData->IdeInit.DisqualifyMode = IdeInitDisqualifyMode;
+ IdePrivateData->IdeInit.CalculateMode = IdeInitCalculateMode;
+ IdePrivateData->IdeInit.SetTiming = IdeInitSetTiming;
+ IdePrivateData->IdeInit.EnumAll = IDER_ENUMER_ALL;
+ IdePrivateData->IdeInit.ChannelCount = IDER_MAX_CHANNEL;
+
+ //
+ // Get device capabilities
+ //
+ Status = PciIo->Attributes (
+ PciIo,
+ EfiPciIoAttributeOperationSupported,
+ 0,
+ &CommandVal
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Enable Command Register
+ //
+ Status = PciIo->Attributes (
+ PciIo,
+ EfiPciIoAttributeOperationEnable,
+ CommandVal & EFI_PCI_DEVICE_ENABLE,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Install IDE_CONTROLLER_INIT protocol & private data to this instance
+ ///
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &Controller,
+ &gEfiIderControllerDriverProtocolGuid,
+ IdePrivateData,
+ &gEfiIdeControllerInitProtocolGuid,
+ &(IdePrivateData->IdeInit),
+ NULL
+ );
+
+ return Status;
+}
+
+/**
+ Stop.
+
+ @param[in] This Pointer to driver binding protocol
+ @param[in] Controller Controller handle to connect
+ @param[in] NumberOfChildren Number of children handle created by this driver
+ @param[in] ChildHandleBuffer Buffer containing child handle created
+
+ @retval EFI_SUCCESS Driver disconnected successfully from controller
+ @exception EFI_UNSUPPORTED Cannot find BIOS_VIDEO_DEV structure
+**/
+EFI_STATUS
+EFIAPI
+IdeRControllerStop (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE Controller,
+ IN UINTN NumberOfChildren,
+ IN EFI_HANDLE *ChildHandleBuffer
+ )
+{
+ EFI_STATUS Status;
+ EFI_IDE_CONTROLLER_PRIVATE_DATA *IdePrivateData;
+
+ ///
+ /// Get private data
+ ///
+ Status = gBS->OpenProtocol (
+ Controller,
+ &gEfiIderControllerDriverProtocolGuid,
+ (VOID **) &IdePrivateData,
+ This->DriverBindingHandle,
+ Controller,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Close protocols opened by Ide controller driver
+ ///
+ Status = gBS->CloseProtocol (
+ Controller,
+ &gEfiPciIoProtocolGuid,
+ This->DriverBindingHandle,
+ Controller
+ );
+
+ gBS->UninstallMultipleProtocolInterfaces (
+ Controller,
+ &gEfiIderControllerDriverProtocolGuid,
+ IdePrivateData,
+ &gEfiIdeControllerInitProtocolGuid,
+ &(IdePrivateData->IdeInit),
+ NULL
+ );
+
+ FreePool (IdePrivateData);
+
+ return EFI_SUCCESS;
+}
+
+///
+/// IDE-R Controller Driver Entry Point
+///
+
+/**
+ Chipset Ide Driver EntryPoint function. It follows the standard EFI driver
+ model. It's called by StartImage() of DXE Core
+
+ @param[in] ImageHandle - While the driver image loaded be the ImageLoader(),
+ an image handle is assigned to this driver binary,
+ all activities of the driver is tied to this ImageHandle
+ @param[in] SystemTable - A pointer to the system table, for all BS(Boo Services) and
+ RT(Runtime Services)
+
+ @retval EFI_SUCCESS Always return EFI_SUCCESS
+**/
+EFI_STATUS
+EFIAPI
+InitializeIdeRControllerDriver (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/ME/ActiveManagement/IdeR/Dxe/IdeRController.cif b/ReferenceCode/ME/ActiveManagement/IdeR/Dxe/IdeRController.cif
new file mode 100644
index 0000000..08416f6
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/IdeR/Dxe/IdeRController.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "IdeRController"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\ActiveManagement\IdeR\Dxe\"
+ RefName = "IdeRController"
+[files]
+"IdeRController.sdl"
+"IdeRController.mak"
+"IdeRController.c"
+"IdeRControllerName.c"
+"IdeRController.h"
+"IdeRController.inf"
+<endComponent>
diff --git a/ReferenceCode/ME/ActiveManagement/IdeR/Dxe/IdeRController.h b/ReferenceCode/ME/ActiveManagement/IdeR/Dxe/IdeRController.h
new file mode 100644
index 0000000..86ab159
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/IdeR/Dxe/IdeRController.h
@@ -0,0 +1,422 @@
+/** @file
+ Header file for chipset IDER ATA controller driver.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights
+ reserved This software and associated documentation (if any)
+ is furnished under a license and may only be used or copied in
+ accordance with the terms of the license. Except as permitted
+ by such license, no part of this software or documentation may
+ be reproduced, stored in a retrieval system, or transmitted in
+ any form or by any means without the express written consent
+ of Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#ifndef _IDER_ATA_CONTROLLER_H
+#define _IDER_ATA_CONTROLLER_H
+
+#include "pci22.h"
+#include "AmtLib.h"
+#include "MeAccess.h"
+
+//
+// Constant definition
+//
+#include EFI_PROTOCOL_DEFINITION (PciIo)
+#include EFI_PROTOCOL_DEFINITION (IdeControllerInit)
+#include EFI_PROTOCOL_CONSUMER (PciRootBridgeIo)
+#include EFI_PROTOCOL_DEFINITION (IderControllerDriver)
+
+//
+// Global Variables definitions
+//
+extern EFI_COMPONENT_NAME_PROTOCOL mIdeRControllerName;
+extern EFI_DRIVER_BINDING_PROTOCOL mIdeRControllerDriverBinding;
+
+//
+// Symbol definition, for PCI IDE configuration field
+//
+#define PCI_SUB_CLASS_IDE 0x01
+
+#define IDER_MAX_CHANNEL 0x01 ///< Max channels number of single sata controller
+#define IDER_MAX_DEVICES 0x02 ///< Max devices number of single sata channel
+#define IDER_ENUMER_ALL TRUE
+
+//
+// PIO and DMA Mode Timing and Control Registers definition
+//
+#define PCI_COMMAND_REGISTER 0x04
+#define PCI_BUS_MASTER_IDE_BASE 0x20
+#define IDE_TIMING_REGISTER_1 0x40
+#define IDE_TIMING_REGISTER_2 0x42
+#define IDE_SLAVE_TIMING_REGISTER 0x44
+#define ULTRA_DMA_CONTROL_REGISTER 0x48
+#define ULTRA_DMA_TIMING_REGISTER 0x4A
+#define IDE_IO_CONFIG_REGISTER 0x54
+
+#define R_PCI_SVID 0x2C
+
+//
+// IDE Register Field definition
+//
+#define ENABLE_DECODE_PRIMARY 0x8000
+
+#define BME_BUS_MASTER_ENABLE_BIT BIT2
+
+//
+// Ide Timing Register 1/2 Field offset 0x40-41 / 0x42-43
+//
+#define DTE0_DRIVE_0_DMA_TIMING_ENABLE bit3
+#define DTE1_DRIVE_1_DMA_TIMING_ENABLE bit7
+
+//
+// UDMA Control Register field offset 0x48
+//
+#define PSDE0_PRIMARY_DRIVE_0_UDMA_ENABLE bit0
+#define PSDE1_PRIMARY_DRIVE_1_UDMA_ENABLE bit1
+#define SSDE0_SECONDARY_DRIVE_0_UDMA_ENABLE bit2
+#define SSDE1_SECONDARY_DRIVE_1_UDMA_ENABLE bit3
+
+//
+// UDMA Timing Register
+//
+#define CT4_RP6 0x00
+#define CT3_RP5 0x01
+#define CT2_RP4 0x02
+
+#define CT3_RP8 0x01
+#define CT2_RP8 0x02
+
+#define CT3_RP16 0x01
+
+//
+// Ide I/O Configuration Register Field offset 0x54
+//
+#define PCB0_PRIMARY_DRIVE_0_BASE_CLOCK bit0
+#define PCB1_PRIMARY_DRIVE_1_BASE_CLOCK bit1
+#define SCB0_SECONDARY_DRIVE_0_BASE_CLOCK bit2
+#define SCB1_SECONDARY_DRIVE_1_BASE_CLOCK bit3
+#define ATA_FAST_PCB0_PRIMARY_DRIVE_0 bit12
+#define ATA_FAST_PCB1_PRIMARY_DRIVE_1 bit13
+#define ATA_FAST_SCB0_SECONDARY_DRIVE_0 bit14
+#define ATA_FAST_SCB1_SECONDARY_DRIVE_1 bit15
+
+//
+// PCH timing register structure
+//
+#pragma pack(1)
+
+typedef struct _IDER_TIMING_REG {
+ //
+ // PIO/MDMA/SDMA timing control for drive 0
+ //
+ UINT16 Time0 : 1;
+ UINT16 Ie0 : 1;
+ UINT16 Ppe0 : 1;
+ UINT16 Dte0 : 1;
+
+ //
+ // PIO/MDMA/SDMA timing control for drive 1
+ //
+ UINT16 Time1 : 1;
+ UINT16 Ie1 : 1;
+ UINT16 Ppe1 : 1;
+ UINT16 Dte1 : 1;
+
+ //
+ // PIO/MDMA/SDMA timing
+ //
+ UINT16 RecoveryTime : 2;
+ UINT16 Reserved0 : 2;
+ UINT16 IoRdySample : 2;
+ UINT16 Sitre : 1;
+ UINT16 IdeDecode : 1;
+
+} IDER_TIMING_REG;
+
+typedef struct _IDER_SLAVE_TIMING_REG {
+ //
+ // PIO/MDMA/SDMA timing control for primary slave device
+ //
+ UINT16 PrimaryRecoveryTime : 2;
+ UINT16 PrimaryIoRdySample : 2;
+
+ //
+ // PIO/MDMA/SDMA timing control for secondary slave device
+ //
+ UINT16 SecondaryRecoveryTime : 2;
+ UINT16 SecondaryIoRdySample : 2;
+
+} IDER_SLAVE_TIMING_REG;
+
+#pragma pack()
+
+#define IDER_CONTROLLER_SIGNATURE EFI_SIGNATURE_32 ('I', 'D', 'E', 'R')
+
+///
+/// Ide controller driver private data structure
+///
+typedef struct _EFI_IDE_CONTROLLER_PRIVATE_DATA {
+ ///
+ /// Standard signature used to identify Ide controller private data
+ ///
+ UINT32 Signature;
+
+ ///
+ /// Protocol instance of IDE_CONTROLLER_INIT produced by this driver
+ ///
+ EFI_IDE_CONTROLLER_INIT_PROTOCOL IdeInit;
+
+ ///
+ /// copy of protocol pointers used by this driver
+ ///
+ EFI_PCI_IO_PROTOCOL *PciIo;
+
+ ///
+ /// The highest disqulified mode for each attached Ide device.
+ /// Per ATA/ATAPI spec, if a mode is not supported, the modes higher than
+ /// it should not be supported
+ ///
+ EFI_ATA_COLLECTIVE_MODE DisqulifiedModes[IDER_MAX_CHANNEL][IDER_MAX_DEVICES];
+
+ ///
+ /// A copy of EFI_IDENTIFY_DATA data for each attached Ide device and its flag
+ ///
+ EFI_IDENTIFY_DATA IdentifyData[IDER_MAX_CHANNEL][IDER_MAX_DEVICES];
+ BOOLEAN IdentifyValid[IDER_MAX_CHANNEL][IDER_MAX_DEVICES];
+} EFI_IDE_CONTROLLER_PRIVATE_DATA;
+
+#define IDE_CONTROLLER_PRIVATE_DATA_FROM_THIS(a) \
+ CR ( \
+ a, \
+ EFI_IDE_CONTROLLER_PRIVATE_DATA, \
+ IdeInit, \
+ IDER_CONTROLLER_SIGNATURE \
+ )
+
+//
+// IDE-R controller IDE_CONTROLLER_INIT protocol declaration
+//
+
+/**
+ This function can be used to obtain information about a specified channel.
+ It's usually used by IDE Bus driver during enumeration process.
+
+ @param[in] This The EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.
+ @param[in] Channel Channel number (0 based, either 0 or 1)
+ @param[in] Enabled TRUE if the channel is enabled. If the channel is disabled,
+ then it will no be enumerated.
+ @param[in] MaxDevices The Max number of IDE devices that the bus driver can expect
+ on this channel. For ATA/ATAPI, this number is either 1 or 2.
+
+ @retval EFI_SUCCESS Information copied
+ @retval EFI_INVALID_PARAMETER Invalid channel
+**/
+EFI_STATUS
+EFIAPI
+IdeInitGetChannelInfo (
+ IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
+ IN UINT8 Channel,
+ OUT BOOLEAN *Enabled,
+ OUT UINT8 *MaxDevices
+ )
+;
+
+/**
+ This function is called by IdeBus driver before executing certain actions.
+ This allows IDE Controller Init to prepare for each action.
+
+ @param[in] This The EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.
+ @param[in] Phase Phase indicator defined by IDE_CONTROLLER_INIT protocol
+ @param[in] Channel Channel number (0 based, either 0 or 1)
+
+ @retval EFI_SUCCESS Preparation done
+ @retval EFI_INVALID_PARAMETER Invalid channel
+ @exception EFI_UNSUPPORTED Invalid phase
+**/
+EFI_STATUS
+EFIAPI
+IdeInitNotifyPhase (
+ IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
+ IN EFI_IDE_CONTROLLER_ENUM_PHASE Phase,
+ IN UINT8 Channel
+ )
+;
+
+/**
+ This function is called by IdeBus driver to submit EFI_IDENTIFY_DATA data structure
+ obtained from IDE deivce. This structure is used to set IDE timing
+
+ @param[in] This The EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.
+ @param[in] Channel IDE channel number (0 based, either 0 or 1)
+ @param[in] Device IDE device number
+ @param[in] IdentifyData A pointer to EFI_IDENTIFY_DATA data structure
+
+ @retval EFI_SUCCESS Data submitted
+ @retval EFI_INVALID_PARAMETER Invalid channel
+**/
+EFI_STATUS
+EFIAPI
+IdeInitSubmitData (
+ IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
+ IN UINT8 Channel,
+ IN UINT8 Device,
+ IN EFI_IDENTIFY_DATA *IdentifyData
+ )
+;
+
+/**
+ This function is called by IdeBus driver to disqualify unsupported operation
+ mode on specfic IDE device
+
+ @param[in] This The EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.
+ @param[in] Channel IDE channel number (0 based, either 0 or 1)
+ @param[in] Device IDE device number
+ @param[in] BadModes Operation mode indicator
+
+ @retval EFI_SUCCESS Disqulified Modes recorded
+ @retval EFI_INVALID_PARAMETER Invalid channel or invalid BadModes pointer
+**/
+EFI_STATUS
+EFIAPI
+IdeInitDisqualifyMode (
+ IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
+ IN UINT8 Channel,
+ IN UINT8 Device,
+ IN EFI_ATA_COLLECTIVE_MODE *BadModes
+ )
+;
+
+/**
+ This function is called by IdeBus driver to calculate the best operation mode
+ supported by specific IDE device
+
+ @param[in] This The EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.
+ @param[in] Channel IDE channel number (0 based, either 0 or 1)
+ @param[in] Device IDE device number
+ @param[in] SupportedModes Modes collection supported by IDE device
+
+ @retval EFI_SUCCESS Disqulified Modes recorded
+ @retval EFI_INVALID_PARAMETER Invalid channel or invalid SupportedModes pointer
+ @retval EFI_NOT_READY IdentifyData is not valid
+ @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary data structures
+**/
+EFI_STATUS
+EFIAPI
+IdeInitCalculateMode (
+ IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
+ IN UINT8 Channel,
+ IN UINT8 Device,
+ OUT EFI_ATA_COLLECTIVE_MODE **SupportedModes
+ )
+;
+
+/**
+ This function is called by IdeBus driver to set appropriate timing on IDE
+ controller according supported operation mode
+
+ @param[in] This The EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.
+ @param[in] Channel IDE channel number (0 based, either 0 or 1)
+ @param[in] Device IDE device number
+ @param[in] Modes IDE device mode
+
+ @retval EFI_SUCCESS Disqulified Modes recorded
+ @retval EFI_INVALID_PARAMETER Invalid channel or invalid Modes pointer
+ @retval EFI_NOT_READY IdentifyData is not valid
+ @exception EFI_UNSUPPORTED Failed to set PIO/MDMA/SDMA timing
+**/
+EFI_STATUS
+EFIAPI
+IdeInitSetTiming (
+ IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
+ IN UINT8 Channel,
+ IN UINT8 Device,
+ IN EFI_ATA_COLLECTIVE_MODE *Modes
+ )
+;
+
+//
+// IDE-R Controller Binding protocol declaration
+//
+
+/**
+ This function checks to see if the driver supports a device specified by
+ "Controller handle" parameter. It is called by DXE Core StartImage() or
+ ConnectController() routines. The driver uses 'device path' and/or
+ 'services' from the Bus I/O abstraction attached to the controller handle
+ to determine if the driver support this controller handle.
+
+ Note: In the BDS (Boot Device Selection) phase, the DXE core enumerate all
+ devices (or, controller) and assigns GUIDs to them.
+
+ @param[in] This a pointer points to the Binding Protocol instance
+ @param[in] Controller The handle of controller to be tested.
+ @param[in] RemainingDevicePath A pointer to the device path. Ignored by device
+ driver but used by bus driver
+
+ @retval EFI_SUCCESS Have device to support
+ @retval EFI_NOT_FOUND Relative environment not ready
+ @exception EFI_UNSUPPORTED The device doesn't support
+**/
+EFI_STATUS
+EFIAPI
+IdeRControllerSupported (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE Controller,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
+ )
+;
+
+/**
+ This routine is called right after the .Supported() called and return
+ EFI_SUCCESS. Notes: The supported protocols are checked but the Protocols
+ are closed.
+
+ @param[in] This a pointer points to the Binding Protocol instance
+ @param[in] Controller The handle of controller to be tested. Parameter
+ passed by the caller
+ @param[in] RemainingDevicePath A pointer to the device path. Should be ignored by
+ device driver
+
+ @retval EFI_SUCCESS The driver ready and initial complete.
+ @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary data structures
+ @retval EFI_DEVICE_ERROR The device doesn't initial.
+**/
+EFI_STATUS
+EFIAPI
+IdeRControllerStart (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE Controller,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
+ )
+;
+
+/**
+ Stop.
+
+ @param[in] This Pointer to driver binding protocol
+ @param[in] Controller Controller handle to connect
+ @param[in] NumberOfChildren Number of children handle created by this driver
+ @param[in] ChildHandleBuffer Buffer containing child handle created
+
+ @retval EFI_SUCCESS Driver disconnected successfully from controller
+ @exception EFI_UNSUPPORTED Cannot find BIOS_VIDEO_DEV structure
+**/
+EFI_STATUS
+EFIAPI
+IdeRControllerStop (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE Controller,
+ IN UINTN NumberOfChildren,
+ IN EFI_HANDLE *ChildHandleBuffer
+ )
+;
+
+#endif // _IDER_ATA_CONTROLLER_H
diff --git a/ReferenceCode/ME/ActiveManagement/IdeR/Dxe/IdeRController.inf b/ReferenceCode/ME/ActiveManagement/IdeR/Dxe/IdeRController.inf
new file mode 100644
index 0000000..954e20e
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/IdeR/Dxe/IdeRController.inf
@@ -0,0 +1,86 @@
+## @file
+# Component description file for IDE-R Controller Driver module.
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = IdeRController
+FILE_GUID = C4F2D007-37FD-422d-B63D-7ED73886E6CA
+COMPONENT_TYPE = BS_DRIVER
+
+[sources.common]
+ IdeRController.h
+ IdeRController.c
+ IdeRControllerName.c
+
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueDxeDriverEntryPoint.c
+
+[includes.common]
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/AMT/Dxe
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/AMT/Include
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/Include
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/Dxe
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Heci/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[libraries.common]
+ MeGuidLib
+ AmtLib
+ EdkProtocolLib
+ EdkFrameworkProtocolLib
+ EdkIIGlueBaseMemoryLib
+ EdkIIGlueDxeReportStatusCodeLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueUefiLib
+ EdkIIGlueUefiDriverModelLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=InitializeIdeRControllerDriver \
+ -D __EDKII_GLUE_DRIVER_BINDING_PROTOCOL_INSTANCE__=mIdeRControllerDriverBinding \
+ -D __EDKII_GLUE_COMPONENT_NAME_PROTOCOL_INSTANCE__=mIdeRControllerName
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_LIB__ \
+ -D __EDKII_GLUE_UEFI_DRIVER_MODEL_LIB__
diff --git a/ReferenceCode/ME/ActiveManagement/IdeR/Dxe/IdeRController.mak b/ReferenceCode/ME/ActiveManagement/IdeR/Dxe/IdeRController.mak
new file mode 100644
index 0000000..e7abc52
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/IdeR/Dxe/IdeRController.mak
@@ -0,0 +1,55 @@
+# MAK file for the ModulePart:IdeRController
+all : IdeRController
+
+$(BUILD_DIR)\IdeRController.mak : $(IdeRController_DIR)\$(@B).cif $(IdeRController_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(IdeRController_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+IdeRController : $(BUILD_DIR)\IdeRController.mak IdeRControllerBin
+
+IdeRController_INCLUDES=\
+ $(ME_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(EDK_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)
+
+IdeRController_DEFINES=\
+ $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=InitializeIdeRControllerDriver"\
+ /D"__EDKII_GLUE_DRIVER_BINDING_PROTOCOL_INSTANCE__=mIdeRControllerDriverBinding"\
+ /D"__EDKII_GLUE_COMPONENT_NAME_PROTOCOL_INSTANCE__=mIdeRControllerName"\
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_UEFI_LIB__ \
+ /D __EDKII_GLUE_UEFI_DRIVER_MODEL_LIB__
+
+IdeRController_LIBS=\
+ $(EDKPROTOCOLLIB)\
+ $(AmtGuidLib_LIB)\
+ $(AmtLibDxe_LIB)\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueUefiLib_LIB)\
+ $(EdkIIGlueUefiDriverModelLib_LIB)\
+
+
+IdeRControllerBin : $(IdeRController_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\IdeRController.mak all \
+ "MY_INCLUDES=$(IdeRController_INCLUDES)"\
+ "MY_DEFINES=$(IdeRController_DEFINES)"\
+ GUID=C4F2D007-37FD-422d-B63D-7ED73886E6CA \
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=BS_DRIVER \
+ EDKIIModule=DXEDRIVER\
+ COMPRESS=1
diff --git a/ReferenceCode/ME/ActiveManagement/IdeR/Dxe/IdeRController.sdl b/ReferenceCode/ME/ActiveManagement/IdeR/Dxe/IdeRController.sdl
new file mode 100644
index 0000000..b73480f
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/IdeR/Dxe/IdeRController.sdl
@@ -0,0 +1,24 @@
+TOKEN
+ Name = "IdeRController_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable IdeRController support in Project"
+End
+MODULE
+ Help = "Includes IdeRController.mak to Project"
+ File = "IdeRController.mak"
+End
+
+PATH
+ Name = "IdeRController_DIR"
+ Help = "iAMT IdeRController file source directory"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\IdeRController.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End \ No newline at end of file
diff --git a/ReferenceCode/ME/ActiveManagement/IdeR/Dxe/IdeRControllerName.c b/ReferenceCode/ME/ActiveManagement/IdeR/Dxe/IdeRControllerName.c
new file mode 100644
index 0000000..15f3bf9
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/IdeR/Dxe/IdeRControllerName.c
@@ -0,0 +1,172 @@
+/** @file
+ This portion is to register the IDE Redirect Controller Driver name
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights
+ reserved This software and associated documentation (if any)
+ is furnished under a license and may only be used or copied in
+ accordance with the terms of the license. Except as permitted
+ by such license, no part of this software or documentation may
+ be reproduced, stored in a retrieval system, or transmitted in
+ any form or by any means without the express written consent
+ of Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "IdeRController.h"
+#endif
+
+//
+// Forward reference declaration
+//
+EFI_STATUS
+EFIAPI
+IdeRControllerGetDriverName (
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN CHAR8 *Language,
+ OUT CHAR16 **DriverName
+ );
+
+EFI_STATUS
+EFIAPI
+IdeRControllerGetControllerName (
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_HANDLE ChildHandle OPTIONAL,
+ IN CHAR8 *Language,
+ OUT CHAR16 **ControllerName
+ );
+
+///
+/// EFI Component Name Protocol
+/// This portion declares a gloabl variable of EFI_COMPONENT_NAME_PROTOCOL type.
+/// It initializes the followings:
+/// - GetDriverName() to PlatformIdeGetDriverName()
+/// - SupportedLanguages to "eng" (3 char ISO639-2 language indetifier)
+///
+EFI_COMPONENT_NAME_PROTOCOL mIdeRControllerName = {
+ IdeRControllerGetDriverName,
+ IdeRControllerGetControllerName,
+ "eng" // English
+};
+
+//
+// Define the Driver's unicode name string
+// IDE controller Driver name string and IDE Controller Name string
+//
+static EFI_UNICODE_STRING_TABLE mIdeRControllerDriverNameTable[] = {
+ {
+ "eng",
+ L"IDER Controller Init Driver"
+ },
+ {
+ NULL,
+ NULL
+ }
+};
+
+static EFI_UNICODE_STRING_TABLE mIdeRControllerControllerNameTable[] = {
+ {
+ "eng",
+ L"IDER Controller"
+ },
+ {
+ NULL,
+ NULL
+ }
+};
+
+/**
+ This is a function definition of EFI_COMPONENT_NAME_PROTOCOL.GetDriverName(). This function
+ is to provide the user readable name of IDE Driver, defined in mPlaformIdeNameTable
+ This function is called by the platform management utilities to display the name of component.
+
+ @param[in] This The address of protocol
+ @param[in] Language If the caller specificed Language matches SupportedLanguage, a pointer
+ to the Driver name is returned in the DriverName.
+ @param[in] DriverName If the caller specificed Language matches SupportedLanguage, a pointer
+ to the Driver name is returned in the DriverName.
+
+ @retval EFI_SUCCESS If the caller specificed Language matches SupportedLanguage.
+ i.e. Language == gPlatformIdeName.SupportedLanguages
+ @exception EFI_UNSUPPORTED If the caller specificed Language doesn't match SupportedLanguage.
+**/
+EFI_STATUS
+EFIAPI
+IdeRControllerGetDriverName (
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN CHAR8 *Language,
+ OUT CHAR16 **DriverName
+ )
+{
+
+ return LookupUnicodeString (
+ Language,
+ mIdeRControllerName.SupportedLanguages,
+ mIdeRControllerDriverNameTable,
+ DriverName
+ );
+
+}
+
+/**
+ Retrieves a Unicode string that is the user readable name of
+ the controller that is being managed by an EFI Driver.
+
+ @param[in] This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
+ @param[in] ControllerHandle The handle of a controller that the driver specified by
+ This is managing. This handle specifies the controller
+ whose name is to be returned.
+ @param[in] ChildHandle The handle of the child controller to retrieve the name
+ of. This is an optional parameter that may be NULL. It
+ will be NULL for device drivers. It will also be NULL
+ for a bus drivers that wish to retrieve the name of the
+ bus controller. It will not be NULL for a bus driver
+ that wishes to retrieve the name of a child controller.
+ @param[in] Language A pointer to a three character ISO 639-2 language
+ identifier. This is the language of the controller name
+ that that the caller is requesting, and it must match one
+ of the languages specified in SupportedLanguages. The
+ number of languages supported by a driver is up to the
+ driver writer.
+ @param[in] ControllerName A pointer to the Unicode string to return. This Unicode
+ string is the name of the controller specified by
+ ControllerHandle and ChildHandle in the language
+ specified by Language from the point of view of the
+ driver specified by This.
+
+ @retval EFI_SUCCESS The Unicode string for the user readable name in the
+ language specified by Language for the driver
+ specified by This was returned in DriverName.
+ @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE. Language
+ or ControllerName is NULL.
+ @exception EFI_UNSUPPORTED The driver specified by this is not currently
+ managing the controller specified by
+ ControllerHandle and ChildHandle. Or the driver
+ specified by This does not support the language specified
+ by Language.
+**/
+EFI_STATUS
+EFIAPI
+IdeRControllerGetControllerName (
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_HANDLE ChildHandle OPTIONAL,
+ IN CHAR8 *Language,
+ OUT CHAR16 **ControllerName
+ )
+{
+ return LookupUnicodeString (
+ Language,
+ mIdeRControllerName.SupportedLanguages,
+ mIdeRControllerControllerNameTable,
+ ControllerName
+ );
+}
diff --git a/ReferenceCode/ME/ActiveManagement/Sol/Dxe/ComponentName.c b/ReferenceCode/ME/ActiveManagement/Sol/Dxe/ComponentName.c
new file mode 100644
index 0000000..3e6ba9f
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/Sol/Dxe/ComponentName.c
@@ -0,0 +1,187 @@
+/** @file
+ This portion is to register the Serial over Lan Controller Driver name
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights
+ reserved This software and associated documentation (if any)
+ is furnished under a license and may only be used or copied in
+ accordance with the terms of the license. Except as permitted
+ by such license, no part of this software or documentation may
+ be reproduced, stored in a retrieval system, or transmitted in
+ any form or by any means without the express written consent
+ of Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "PciSerial.h"
+#endif
+//
+// EFI Component Name Functions
+//
+EFI_STATUS
+EFIAPI
+PciSerialComponentNameGetDriverName (
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN CHAR8 *Language,
+ OUT CHAR16 **DriverName
+ );
+
+EFI_STATUS
+EFIAPI
+PciSerialComponentNameGetControllerName (
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_HANDLE ChildHandle OPTIONAL,
+ IN CHAR8 *Language,
+ OUT CHAR16 **ControllerName
+ );
+
+//
+// EFI Component Name Protocol
+//
+EFI_COMPONENT_NAME_PROTOCOL mPciSerialComponentName = {
+ PciSerialComponentNameGetDriverName,
+ PciSerialComponentNameGetControllerName,
+ "eng"
+};
+
+static EFI_UNICODE_STRING_TABLE mPciSerialDriverNameTable[] = {
+ {
+ "eng",
+ L"PCI Serial Driver"
+ },
+ {
+ NULL,
+ NULL
+ }
+};
+
+/**
+ Retrieves a Unicode string that is the user readable name of the EFI Driver.
+
+ @param[in] This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
+ @param[in] Language A pointer to a three character ISO 639-2 language identifier.
+ This is the language of the driver name that that the caller
+ is requesting, and it must match one of the languages specified
+ in SupportedLanguages. The number of languages supported by a
+ driver is up to the driver writer.
+ @param[in] DriverName A pointer to the Unicode string to return. This Unicode string
+ is the name of the driver specified by This in the language
+ specified by Language.
+
+ @retval EFI_SUCCESS The Unicode string for the Driver specified by This
+ and the language specified by Language was returned in DriverName.
+ @retval EFI_INVALID_PARAMETER Language or DriverName is NULL.
+ @exception EFI_UNSUPPORTED The driver specified by This does not support the
+ language specified by Language.
+**/
+EFI_STATUS
+EFIAPI
+PciSerialComponentNameGetDriverName (
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN CHAR8 *Language,
+ OUT CHAR16 **DriverName
+ )
+{
+ return LookupUnicodeString (
+ Language,
+ mPciSerialComponentName.SupportedLanguages,
+ mPciSerialDriverNameTable,
+ DriverName
+ );
+}
+
+/**
+ Retrieves a Unicode string that is the user readable name of the controller
+ that is being managed by an EFI Driver.
+
+ @param[in] This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
+ @param[in] ControllerHandle The handle of a controller that the driver specified by
+ This is managing. This handle specifies the controller
+ whose name is to be returned.
+ @param[in] ChildHandle The handle of the child controller to retrieve the name
+ of. This is an optional parameter that may be NULL. It
+ will be NULL for device drivers. It will also be NULL
+ for a bus drivers that wish to retrieve the name of the
+ bus controller. It will not be NULL for a bus driver
+ that wishes to retrieve the name of a child controller.
+ @param[in] Language A pointer to a three character ISO 639-2 language
+ identifier. This is the language of the controller name
+ that that the caller is requesting, and it must match one
+ of the languages specified in SupportedLanguages. The
+ number of languages supported by a driver is up to the
+ driver writer.
+ @param[in] ControllerName A pointer to the Unicode string to return. This Unicode
+ string is the name of the controller specified by
+ ControllerHandle and ChildHandle in the language
+ specified by Language from the point of view of the
+ driver specified by This.
+
+ @retval EFI_SUCCESS The Unicode string for the user readable name in the
+ language specified by Language for the driver
+ specified by This was returned in DriverName.
+ @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE. Language or
+ ControllerName is NULL.
+ @exception EFI_UNSUPPORTED The driver specified by This is not currently
+ managing the controller specified by
+ ControllerHandle and ChildHandle. The driver specified by This
+ does not support the language specified by Language.
+**/
+EFI_STATUS
+EFIAPI
+PciSerialComponentNameGetControllerName (
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_HANDLE ChildHandle OPTIONAL,
+ IN CHAR8 *Language,
+ OUT CHAR16 **ControllerName
+ )
+{
+ EFI_STATUS Status;
+ EFI_SERIAL_IO_PROTOCOL *SerialIo;
+ SERIAL_DEV *SerialDevice;
+
+ ///
+ /// This is a device driver, so ChildHandle must be NULL.
+ ///
+ if (ChildHandle != NULL) {
+ return EFI_UNSUPPORTED;
+ }
+ ///
+ /// Get the Block I/O Protocol on Controller
+ ///
+ Status = gBS->OpenProtocol (
+ ControllerHandle,
+ &gEfiSerialIoProtocolGuid,
+ (VOID **) &SerialIo,
+ mPciSerialControllerDriverBinding.DriverBindingHandle,
+ ControllerHandle,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ ///
+ /// Get the Serial Controller's Device structure
+ ///
+ SerialDevice = SERIAL_DEV_FROM_THIS (SerialIo);
+
+ return LookupUnicodeString (
+ Language,
+ mPciSerialComponentName.SupportedLanguages,
+ SerialDevice->ControllerNameTable,
+ ControllerName
+ );
+}
diff --git a/ReferenceCode/ME/ActiveManagement/Sol/Dxe/PciSerial.c b/ReferenceCode/ME/ActiveManagement/Sol/Dxe/PciSerial.c
new file mode 100644
index 0000000..6dba7fa
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/Sol/Dxe/PciSerial.c
@@ -0,0 +1,1807 @@
+/** @file
+ PCI Serial driver for standard UARTS on an PCI bus.
+ Customized for Intel AMT SErial OVer LAN (82573E-Tekoa) 16550 UART Driver.
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights
+ reserved This software and associated documentation (if any)
+ is furnished under a license and may only be used or copied in
+ accordance with the terms of the license. Except as permitted
+ by such license, no part of this software or documentation may
+ be reproduced, stored in a retrieval system, or transmitted in
+ any form or by any means without the express written consent
+ of Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "PciSerial.h"
+#include "MeAccess.h"
+#endif
+
+//
+// PCI Serial Driver Binding Protocol
+//
+EFI_DRIVER_BINDING_PROTOCOL mPciSerialControllerDriverBinding = {
+ PciSerialControllerDriverSupported,
+ PciSerialControllerDriverStart,
+ PciSerialControllerDriverStop,
+ 0x10,
+ NULL,
+ NULL
+};
+
+/**
+ This function checks to see if the driver supports a device specified by
+ "Controller handle" parameter. It is called by DXE Core StartImage() or
+ ConnectController() routines. The driver uses 'device path' and/or
+ 'services' from the Bus I/O abstraction attached to the controller handle
+ to determine if the driver support this controller handle.
+
+ Note: In the BDS (Boot Device Selection) phase, the DXE core enumerate all
+ devices (or, controller) and assigns GUIDs to them.
+
+ @param[in] This a pointer points to the Binding Protocol instance
+ @param[in] Controller The handle of controller to be tested.
+ @param[in] RemainingDevicePath A pointer to the device path. Ignored by device
+ driver but used by bus driver
+
+ @retval EFI_SUCCESS Have device to support
+ @retval EFI_NOT_FOUND The device doesn't support or relative environment not ready
+**/
+EFI_STATUS
+EFIAPI
+PciSerialControllerDriverSupported (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE Controller,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
+ )
+{
+ EFI_STATUS Status;
+ EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
+ EFI_PCI_IO_PROTOCOL *PciIo;
+ UART_DEVICE_PATH UartNode;
+ UINT16 Buffer[2];
+ UINT16 Temp;
+ UINT8 *ByteBuffer;
+
+ ///
+ /// Init AMT library
+ ///
+ Status = AmtLibInit ();
+
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ ///
+ /// We don't want the SOL Controller enabled unless
+ /// there is an remote control request. The AMT usage model
+ /// dictates this. Thus here we check for the ASF Remote
+ /// Control command wants SOL before we start the controller.
+ ///
+ if (ActiveManagementEnableSol () == FALSE) {
+ return EFI_NOT_FOUND;
+ }
+ ///
+ /// Open the IO Abstraction(s) needed to perform the supported test
+ ///
+ Status = gBS->OpenProtocol (
+ Controller,
+ &gEfiDevicePathProtocolGuid,
+ (VOID **) &ParentDevicePath,
+ This->DriverBindingHandle,
+ Controller,
+ EFI_OPEN_PROTOCOL_BY_DRIVER
+ );
+ if (Status == EFI_ALREADY_STARTED) {
+ return EFI_SUCCESS;
+ }
+
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ gBS->CloseProtocol (
+ Controller,
+ &gEfiDevicePathProtocolGuid,
+ This->DriverBindingHandle,
+ Controller
+ );
+
+ ///
+ /// Now test the EfiPciIoProtocol
+ ///
+ Status = gBS->OpenProtocol (
+ Controller,
+ &gEfiPciIoProtocolGuid,
+ (VOID **) &PciIo,
+ This->DriverBindingHandle,
+ Controller,
+ EFI_OPEN_PROTOCOL_BY_DRIVER
+ );
+
+ if (Status == EFI_ALREADY_STARTED) {
+ return EFI_SUCCESS;
+ }
+
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ ///
+ /// Use the PCI I/O Protocol to see if Controller is standard ISA UART that
+ /// can be managed by this driver.
+ ///
+ Status = EFI_SUCCESS;
+
+ ///
+ /// Looks for a PCI CLASS / SUBCLASS / INTERFACE of 0x07 / 0x00 / 0x02
+ /// To allow supportting all PCI Devices that are 16550 compatible UARTS.
+ ///
+ /// This is point where Tekoa iAMT SOL support enabling via
+ /// Get Boot Options ASF info is used to customize PCISerial
+ /// to work for iAMT.
+ ///
+ /// Also if want general PCI Serial com devices to work as well
+ /// can duplicate this driver one for tekoa and iAMT and the other
+ /// for general serial devices.
+ ///
+ Status = PciIo->Pci.Read (
+ PciIo,
+ EfiPciIoWidthUint32,
+ (UINT32) PCI_VENDOR_ID_OFFSET,
+ (UINTN) 1,
+ (VOID *) &Buffer
+ );
+ ///
+ /// If Buffer is Not Valid (no setup info in NVRAM/FLASH) use auto mode for PTBx cfg.
+ ///
+ if ((Buffer[0] != V_ME_SOL_VENDOR_ID) || !IS_PCH_LPT_SOL_DEVICE_ID(Buffer[1])
+ ) {
+ Status = EFI_UNSUPPORTED;
+ goto Error;
+ }
+
+ Status = PciIo->Pci.Read (
+ PciIo,
+ EfiPciIoWidthUint32,
+ (UINT32) PCI_REVISION_ID_OFFSET,
+ (UINTN) 1,
+ (VOID *) &Buffer
+ );
+ ByteBuffer = (UINT8 *) Buffer;
+ if ((ByteBuffer[3] != PCI_CLASS_SCC) || (ByteBuffer[2] != PCI_SUBCLASS_SERIAL) || (ByteBuffer[1] != PCI_IF_16550)) {
+ Status = EFI_UNSUPPORTED;
+ goto Error;
+ }
+ ///
+ /// Make sure the PCI io space is enabled
+ ///
+ Temp = 0x0003;
+ PciIo->Pci.Write (
+ PciIo,
+ EfiPciIoWidthUint16,
+ PCI_COMMAND_OFFSET,
+ 0x01,
+ (VOID*) &Temp
+ );
+
+ ///
+ /// Make sure RemainingDevicePath is valid
+ ///
+ if (RemainingDevicePath != NULL) {
+ Status = EFI_UNSUPPORTED;
+ CopyMem (&UartNode, (UART_DEVICE_PATH *) RemainingDevicePath, sizeof (UART_DEVICE_PATH));
+ if (UartNode.Header.Type != MESSAGING_DEVICE_PATH ||
+ UartNode.Header.SubType != MSG_UART_DP ||
+ DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *) &UartNode) != sizeof (UART_DEVICE_PATH)
+ ) {
+ goto Error;
+ }
+
+ if (UartNode.BaudRate > SERIAL_PORT_MAX_BAUD_RATE) {
+ goto Error;
+ }
+
+ if (UartNode.Parity < NoParity || UartNode.Parity > SpaceParity) {
+ goto Error;
+ }
+
+ if (UartNode.DataBits < 5 || UartNode.DataBits > 8) {
+ goto Error;
+ }
+
+ if (UartNode.StopBits < OneStopBit || UartNode.StopBits > TwoStopBits) {
+ goto Error;
+ }
+
+ if ((UartNode.DataBits == 5) && (UartNode.StopBits == TwoStopBits)) {
+ goto Error;
+ }
+
+ if ((UartNode.DataBits >= 6) && (UartNode.DataBits <= 8) && (UartNode.StopBits == OneFiveStopBits)) {
+ goto Error;
+ }
+
+ Status = EFI_SUCCESS;
+ }
+
+Error:
+ ///
+ /// Close the I/O Abstraction(s) used to perform the supported test
+ ///
+ gBS->CloseProtocol (
+ Controller,
+ &gEfiPciIoProtocolGuid,
+ This->DriverBindingHandle,
+ Controller
+ );
+ return Status;
+}
+
+/**
+ This routine is called right after the .Supported() called
+ and return EFI_SUCCESS. Notes: The supported protocols are
+ checked but the Protocols are closed.
+
+ @param[in] This A pointer points to the Binding Protocol instance
+ @param[in] Controller The handle of controller to be tested. Parameter
+ passed by the caller
+ @param[in] RemainingDevicePath A pointer to the device path. Should be ignored by
+ device driver
+
+ @retval EFI_SUCCESS The driver ready and initial complete.
+ @retval Other The device doesn't initial.
+**/
+EFI_STATUS
+EFIAPI
+PciSerialControllerDriverStart (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE Controller,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
+ )
+{
+ EFI_STATUS Status;
+ EFI_PCI_IO_PROTOCOL *PciIo;
+ SERIAL_DEV *SerialDevice;
+ UINTN Index;
+ UART_DEVICE_PATH Node;
+ EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
+ CHAR16 SerialPortName[sizeof (PCI_SERIAL_PORT_NAME)];
+ EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfoBuffer;
+ UINTN EntryCount;
+ EFI_SERIAL_IO_PROTOCOL *SerialIo;
+ UINT64 *Supports;
+ UINT64 Temp;
+ EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Ptr;
+ VOID **Resources;
+ EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR Temp1;
+
+ SerialDevice = NULL;
+
+ ///
+ /// Get the Parent Device Path
+ ///
+ Status = gBS->OpenProtocol (
+ Controller,
+ &gEfiDevicePathProtocolGuid,
+ (VOID **) &ParentDevicePath,
+ This->DriverBindingHandle,
+ Controller,
+ EFI_OPEN_PROTOCOL_BY_DRIVER
+ );
+ if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {
+ return Status;
+ }
+ ///
+ /// Grab the IO abstraction we need to get any work done
+ ///
+ Status = gBS->OpenProtocol (
+ Controller,
+ &gEfiPciIoProtocolGuid,
+ (VOID **) &PciIo,
+ This->DriverBindingHandle,
+ Controller,
+ EFI_OPEN_PROTOCOL_BY_DRIVER
+ );
+ if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {
+ goto Error;
+ }
+
+ if (Status == EFI_ALREADY_STARTED) {
+
+ if (RemainingDevicePath == NULL) {
+ return EFI_SUCCESS;
+ }
+ ///
+ /// Make sure a child handle does not already exist. This driver can only
+ /// produce one child per serial port.
+ ///
+ Status = gBS->OpenProtocolInformation (
+ Controller,
+ &gEfiPciIoProtocolGuid,
+ &OpenInfoBuffer,
+ &EntryCount
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = EFI_ALREADY_STARTED;
+ for (Index = 0; Index < EntryCount; Index++) {
+ if (OpenInfoBuffer[Index].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) {
+ Status = gBS->OpenProtocol (
+ OpenInfoBuffer[Index].ControllerHandle,
+ &gEfiSerialIoProtocolGuid,
+ (VOID **) &SerialIo,
+ This->DriverBindingHandle,
+ Controller,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ if (!EFI_ERROR (Status)) {
+ CopyMem (&Node, RemainingDevicePath, sizeof (UART_DEVICE_PATH));
+ Status = SerialIo->SetAttributes (
+ SerialIo,
+ Node.BaudRate,
+ SerialIo->Mode->ReceiveFifoDepth,
+ SerialIo->Mode->Timeout,
+ Node.Parity,
+ Node.DataBits,
+ Node.StopBits
+ );
+ }
+ break;
+ }
+ }
+
+ FreePool (OpenInfoBuffer);
+ return Status;
+ }
+ ///
+ /// Initialize the serial device instance
+ ///
+ SerialDevice = AllocatePool (sizeof (SERIAL_DEV));
+ if (SerialDevice == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
+ goto Error;
+ }
+
+ ZeroMem (SerialDevice, sizeof (SERIAL_DEV));
+
+ SerialDevice->PciIo = PciIo;
+ SerialDevice->ParentDevicePath = ParentDevicePath;
+ SerialDevice->ControllerNameTable = NULL;
+
+ StrCpy (SerialPortName, L"PCI Serial Port # ");
+ SerialPortName[sizeof (PCI_SERIAL_PORT_NAME) - 2] = (CHAR16) (L'0');
+ AddUnicodeString (
+ "eng",
+ mPciSerialComponentName.SupportedLanguages,
+ &SerialDevice->ControllerNameTable,
+ (CHAR16 *) SerialPortName
+ );
+
+ Ptr = &Temp1;
+ Resources = (VOID **) &Ptr;
+ Supports = &Temp;
+ *Supports = 0x01;
+ for (Index = 0; Index < PCI_MAX_BAR; Index++) {
+ Status = SerialDevice->PciIo->GetBarAttributes (
+ PciIo,
+ (UINT8) Index,
+ Supports,
+ Resources
+ );
+ Ptr = *Resources;
+ if (Ptr->ResType == ACPI_ADDRESS_SPACE_TYPE_IO) {
+ SerialDevice->BarIndex = (UINT16) Index;
+ Status = EFI_SUCCESS;
+ break;
+ }
+ }
+
+ if (PciSerialPortPresent (SerialDevice) != TRUE) {
+ Status = EFI_DEVICE_ERROR;
+ goto Error;
+ }
+
+ SerialDevice->Signature = SERIAL_DEV_SIGNATURE;
+ SerialDevice->Type = UART16450;
+ SerialDevice->SoftwareLoopbackEnable = FALSE;
+ SerialDevice->HardwareFlowControl = FALSE;
+ SerialDevice->Handle = NULL;
+ SerialDevice->Receive.First = 0;
+ SerialDevice->Receive.Last = 0;
+ SerialDevice->Receive.Surplus = SERIAL_MAX_BUFFER_SIZE;
+ SerialDevice->Transmit.First = 0;
+ SerialDevice->Transmit.Last = 0;
+ SerialDevice->Transmit.Surplus = SERIAL_MAX_BUFFER_SIZE;
+
+ ///
+ /// Serial I/O
+ ///
+ SerialDevice->SerialIo.Revision = EFI_SERIAL_IO_PROTOCOL_REVISION;
+ SerialDevice->SerialIo.Reset = PciSerialReset;
+ SerialDevice->SerialIo.SetAttributes = PciSerialSetAttributes;
+ SerialDevice->SerialIo.SetControl = PciSerialSetControl;
+ SerialDevice->SerialIo.GetControl = PciSerialGetControl;
+ SerialDevice->SerialIo.Write = PciSerialWrite;
+ SerialDevice->SerialIo.Read = PciSerialRead;
+ SerialDevice->SerialIo.Mode = &(SerialDevice->SerialMode);
+
+ if (RemainingDevicePath != NULL) {
+ ///
+ /// Match the configuration of the RemainingDevicePath. IsHandleSupported()
+ /// already checked to make sure the RemainingDevicePath contains settings
+ /// that we can support.
+ ///
+ CopyMem (&SerialDevice->UartDevicePath, RemainingDevicePath, sizeof (UART_DEVICE_PATH));
+ } else {
+ ///
+ /// Build the device path by appending the UART node to the ParentDevicePath
+ /// from the WinNtIo handle. The Uart setings are zero here, since
+ /// SetAttribute() will update them to match the default setings.
+ ///
+ ZeroMem (&SerialDevice->UartDevicePath, sizeof (UART_DEVICE_PATH));
+ SerialDevice->UartDevicePath.Header.Type = MESSAGING_DEVICE_PATH;
+ SerialDevice->UartDevicePath.Header.SubType = MSG_UART_DP;
+ SetDevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *) &SerialDevice->UartDevicePath, sizeof (UART_DEVICE_PATH));
+ }
+ ///
+ /// Build the device path by appending the UART node to the ParentDevicePath
+ /// from the WinNtIo handle. The Uart setings are zero here, since
+ /// SetAttribute() will update them to match the current setings.
+ ///
+ SerialDevice->DevicePath = AppendDevicePathNode (
+ ParentDevicePath,
+ (EFI_DEVICE_PATH_PROTOCOL *) &SerialDevice->UartDevicePath
+ );
+
+ if (SerialDevice->DevicePath == NULL) {
+ Status = EFI_DEVICE_ERROR;
+ goto Error;
+ }
+ ///
+ /// Fill in Serial I/O Mode structure based on either the RemainingDevicePath or defaults.
+ ///
+ SerialDevice->SerialMode.ControlMask = SERIAL_PORT_DEFAULT_CONTROL_MASK;
+ SerialDevice->SerialMode.Timeout = SERIAL_PORT_DEFAULT_TIMEOUT;
+ SerialDevice->SerialMode.BaudRate = SerialDevice->UartDevicePath.BaudRate;
+ SerialDevice->SerialMode.ReceiveFifoDepth = SERIAL_PORT_DEFAULT_RECEIVE_FIFO_DEPTH;
+ SerialDevice->SerialMode.DataBits = SerialDevice->UartDevicePath.DataBits;
+ SerialDevice->SerialMode.Parity = SerialDevice->UartDevicePath.Parity;
+ SerialDevice->SerialMode.StopBits = SerialDevice->UartDevicePath.StopBits;
+
+ ///
+ /// Issue a reset to initialize the COM port
+ ///
+ Status = SerialDevice->SerialIo.Reset (&SerialDevice->SerialIo);
+ if (EFI_ERROR (Status)) {
+ Status = EFI_SUCCESS;
+ goto Error;
+ }
+ ///
+ /// Install protocol interfaces for the serial device.
+ ///
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &SerialDevice->Handle,
+ &gEfiDevicePathProtocolGuid,
+ SerialDevice->DevicePath,
+ &gEfiSerialIoProtocolGuid,
+ &SerialDevice->SerialIo,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ goto Error;
+ }
+ ///
+ /// Open For Child Device
+ ///
+ Status = gBS->OpenProtocol (
+ Controller,
+ &gEfiPciIoProtocolGuid,
+ (VOID **) &PciIo,
+ This->DriverBindingHandle,
+ SerialDevice->Handle,
+ EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
+ );
+
+Error:
+ if (EFI_ERROR (Status)) {
+ gBS->CloseProtocol (
+ Controller,
+ &gEfiDevicePathProtocolGuid,
+ This->DriverBindingHandle,
+ Controller
+ );
+ gBS->CloseProtocol (
+ Controller,
+ &gEfiPciIoProtocolGuid,
+ This->DriverBindingHandle,
+ Controller
+ );
+ if (SerialDevice) {
+ if (SerialDevice->DevicePath) {
+ FreePool (SerialDevice->DevicePath);
+ }
+
+ FreeUnicodeStringTable (SerialDevice->ControllerNameTable);
+ FreePool (SerialDevice);
+ }
+ }
+
+ return Status;
+}
+
+/**
+ Stop.
+
+ @param[in] This Pointer to driver binding protocol
+ @param[in] Controller Controller handle to connect
+ @param[in] NumberOfChildren Number of children handle created by this driver
+ @param[in] ChildHandleBuffer Buffer containing child handle created
+
+ @retval EFI_SUCCESS Driver disconnected successfully from controller
+ @retval EFI_DEVICE_ERROR Cannot find BIOS_VIDEO_DEV structure
+**/
+EFI_STATUS
+EFIAPI
+PciSerialControllerDriverStop (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE Controller,
+ IN UINTN NumberOfChildren,
+ IN EFI_HANDLE *ChildHandleBuffer
+ )
+{
+ EFI_STATUS Status;
+ UINTN Index;
+ BOOLEAN AllChildrenStopped;
+ EFI_SERIAL_IO_PROTOCOL *SerialIo;
+ SERIAL_DEV *SerialDevice;
+ EFI_PCI_IO_PROTOCOL *PciIo;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+
+ Status = gBS->HandleProtocol (
+ Controller,
+ &gEfiDevicePathProtocolGuid,
+ (VOID **) &DevicePath
+ );
+
+ ///
+ /// Complete all outstanding transactions to Controller.
+ /// Don't allow any new transaction to Controller to be started.
+ ///
+ if (NumberOfChildren == 0) {
+ ///
+ /// Close the bus driver
+ ///
+ Status = gBS->CloseProtocol (
+ Controller,
+ &gEfiPciIoProtocolGuid,
+ This->DriverBindingHandle,
+ Controller
+ );
+
+ Status = gBS->CloseProtocol (
+ Controller,
+ &gEfiDevicePathProtocolGuid,
+ This->DriverBindingHandle,
+ Controller
+ );
+ return Status;
+ }
+
+ AllChildrenStopped = TRUE;
+
+ for (Index = 0; Index < NumberOfChildren; Index++) {
+ Status = gBS->OpenProtocol (
+ ChildHandleBuffer[Index],
+ &gEfiSerialIoProtocolGuid,
+ (VOID **) &SerialIo,
+ This->DriverBindingHandle,
+ Controller,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ if (!EFI_ERROR (Status)) {
+
+ SerialDevice = SERIAL_DEV_FROM_THIS (SerialIo);
+
+ Status = gBS->CloseProtocol (
+ Controller,
+ &gEfiPciIoProtocolGuid,
+ This->DriverBindingHandle,
+ ChildHandleBuffer[Index]
+ );
+
+ Status = gBS->UninstallMultipleProtocolInterfaces (
+ ChildHandleBuffer[Index],
+ &gEfiDevicePathProtocolGuid,
+ SerialDevice->DevicePath,
+ &gEfiSerialIoProtocolGuid,
+ &SerialDevice->SerialIo,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ gBS->OpenProtocol (
+ Controller,
+ &gEfiPciIoProtocolGuid,
+ (VOID **) &PciIo,
+ This->DriverBindingHandle,
+ ChildHandleBuffer[Index],
+ EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
+ );
+ } else {
+ if (SerialDevice->DevicePath) {
+ FreePool (SerialDevice->DevicePath);
+ }
+
+ FreeUnicodeStringTable (SerialDevice->ControllerNameTable);
+ FreePool (SerialDevice);
+ }
+ }
+
+ if (EFI_ERROR (Status)) {
+ AllChildrenStopped = FALSE;
+ }
+ }
+
+ if (AllChildrenStopped == FALSE) {
+ return EFI_DEVICE_ERROR;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Detect whether specific FIFO is full or not
+
+ @param[in] Fifo A pointer to the Data Structure SERIAL_DEV_FIFO
+
+ @retval TRUE The FIFO is full
+ @retval FALSE The FIFO is not full
+**/
+BOOLEAN
+PciSerialFifoFull (
+ IN SERIAL_DEV_FIFO *Fifo
+ )
+{
+ if (Fifo->Surplus == 0) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/**
+ Detect whether specific FIFO is empty or not
+
+ @param[in] Fifo A pointer to the Data Structure SERIAL_DEV_FIFO
+
+ @retval TRUE The FIFO is empty
+ @retval FALSE The FIFO is not empty
+**/
+BOOLEAN
+PciSerialFifoEmpty (
+ IN SERIAL_DEV_FIFO *Fifo
+ )
+{
+ if (Fifo->Surplus == SERIAL_MAX_BUFFER_SIZE) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/**
+ Add data to specific FIFO
+
+ @param[in] Fifo A pointer to the Data Structure SERIAL_DEV_FIFO
+ @param[in] Data The data added to FIFO
+
+ @retval EFI_SUCCESS Add data to specific FIFO successfully
+ @retval EFI_OUT_OF_RESOURCES Failed to add data because FIFO is already full
+**/
+EFI_STATUS
+PciSerialFifoAdd (
+ IN SERIAL_DEV_FIFO *Fifo,
+ IN UINT8 Data
+ )
+{
+ ///
+ /// if FIFO full can not add data
+ ///
+ if (PciSerialFifoFull (Fifo)) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ ///
+ /// FIFO is not full can add data
+ ///
+ Fifo->Data[Fifo->Last] = Data;
+ Fifo->Surplus--;
+ Fifo->Last++;
+ if (Fifo->Last == SERIAL_MAX_BUFFER_SIZE) {
+ Fifo->Last = 0;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Remove data from specific FIFO
+
+ @param[in] Fifo A pointer to the Data Structure SERIAL_DEV_FIFO
+ @param[in] Data The data removed from FIFO
+
+ @retval EFI_SUCCESS Remove data from specific FIFO successfully
+ @retval EFI_OUT_OF_RESOURCES Failed to remove data because FIFO is empty
+**/
+EFI_STATUS
+PciSerialFifoRemove (
+ IN SERIAL_DEV_FIFO *Fifo,
+ OUT UINT8 *Data
+ )
+{
+ ///
+ /// if FIFO is empty, no data can remove
+ ///
+ if (PciSerialFifoEmpty (Fifo)) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ ///
+ /// FIFO is not empty, can remove data
+ ///
+ *Data = Fifo->Data[Fifo->First];
+ Fifo->Surplus++;
+ Fifo->First++;
+ if (Fifo->First == SERIAL_MAX_BUFFER_SIZE) {
+ Fifo->First = 0;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Reads and writes all avaliable data.
+
+ @param[in] SerialDevice The device to flush
+
+ @retval EFI_SUCCESS Data was read/written successfully.
+ @retval EFI_OUT_OF_RESOURCES Failed because software receive FIFO is full. Note, when
+ this happens, pending writes are not done.
+**/
+EFI_STATUS
+PciSerialReceiveTransmit (
+ IN SERIAL_DEV *SerialDevice
+ )
+{
+ SERIAL_PORT_LSR Lsr;
+ UINT8 Data;
+ BOOLEAN ReceiveFifoFull;
+ SERIAL_PORT_MSR Msr;
+ SERIAL_PORT_MCR Mcr;
+ UINTN TimeOut;
+
+ Data = 0;
+
+ ///
+ /// Begin the read or write
+ ///
+ if (SerialDevice->SoftwareLoopbackEnable) {
+ do {
+ ReceiveFifoFull = PciSerialFifoFull (&SerialDevice->Receive);
+ if (!PciSerialFifoEmpty (&SerialDevice->Transmit)) {
+ PciSerialFifoRemove (&SerialDevice->Transmit, &Data);
+ if (ReceiveFifoFull) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ PciSerialFifoAdd (&SerialDevice->Receive, Data);
+ }
+ } while (!PciSerialFifoEmpty (&SerialDevice->Transmit));
+ } else {
+ ReceiveFifoFull = PciSerialFifoFull (&SerialDevice->Receive);
+ do {
+ Lsr.Data = READ_LSR (SerialDevice->PciIo, SerialDevice->BarIndex);
+#ifdef EFI_NT_EMULATOR
+ ///
+ /// This is required for NT to avoid a forever-spin...
+ /// This would be better if READ_LSR was a polling operation
+ /// that would timeout.
+ ///
+ Lsr.Bits.THRE = 1;
+#endif
+ ///
+ /// Flush incomming data to prevent a an overrun during a long write
+ ///
+ if (Lsr.Bits.DR && !ReceiveFifoFull) {
+ ReceiveFifoFull = PciSerialFifoFull (&SerialDevice->Receive);
+ if (!ReceiveFifoFull) {
+ if (Lsr.Bits.FIFOE || Lsr.Bits.OE || Lsr.Bits.PE || Lsr.Bits.FE || Lsr.Bits.BI) {
+ if (Lsr.Bits.FIFOE || Lsr.Bits.PE || Lsr.Bits.FE || Lsr.Bits.BI) {
+ Data = READ_RBR (SerialDevice->PciIo, SerialDevice->BarIndex);
+ continue;
+ }
+ }
+ ///
+ /// Make sure the receive data will not be missed, Assert DTR
+ ///
+ if (SerialDevice->HardwareFlowControl) {
+ Mcr.Data = READ_MCR (SerialDevice->PciIo, SerialDevice->BarIndex);
+ Mcr.Bits.DTRC &= 0;
+ WRITE_MCR (SerialDevice->PciIo, SerialDevice->BarIndex, Mcr.Data);
+ }
+
+ Data = READ_RBR (SerialDevice->PciIo, SerialDevice->BarIndex);
+
+ ///
+ /// Deassert DTR
+ ///
+ if (SerialDevice->HardwareFlowControl) {
+ Mcr.Data = READ_MCR (SerialDevice->PciIo, SerialDevice->BarIndex);
+ Mcr.Bits.DTRC |= 1;
+ WRITE_MCR (SerialDevice->PciIo, SerialDevice->BarIndex, Mcr.Data);
+ }
+
+ PciSerialFifoAdd (&SerialDevice->Receive, Data);
+
+ continue;
+ }
+ }
+ ///
+ /// Do the write
+ ///
+ if (Lsr.Bits.THRE && !PciSerialFifoEmpty (&SerialDevice->Transmit)) {
+ ///
+ /// Make sure the transmit data will not be missed
+ ///
+ if (SerialDevice->HardwareFlowControl) {
+ ///
+ /// Send RTS
+ ///
+ Mcr.Data = READ_MCR (SerialDevice->PciIo, SerialDevice->BarIndex);
+ Mcr.Bits.RTS |= 1;
+ WRITE_MCR (SerialDevice->PciIo, SerialDevice->BarIndex, Mcr.Data);
+ ///
+ /// Wait for CTS
+ ///
+ TimeOut = 0;
+ Msr.Data = READ_MSR (SerialDevice->PciIo, SerialDevice->BarIndex);
+ while (!Msr.Bits.CTS) {
+ gBS->Stall (TIMEOUT_STALL_INTERVAL);
+ TimeOut++;
+ if (TimeOut > 5) {
+ break;
+ }
+
+ Msr.Data = READ_MSR (SerialDevice->PciIo, SerialDevice->BarIndex);
+ }
+
+ if (Msr.Bits.CTS) {
+ PciSerialFifoRemove (&SerialDevice->Transmit, &Data);
+ WRITE_THR (SerialDevice->PciIo, SerialDevice->BarIndex, Data);
+ }
+ }
+ ///
+ /// write the data out
+ ///
+ if (!SerialDevice->HardwareFlowControl) {
+ PciSerialFifoRemove (&SerialDevice->Transmit, &Data);
+ WRITE_THR (SerialDevice->PciIo, SerialDevice->BarIndex, Data);
+ }
+ ///
+ /// Make sure the transmit data will not be missed
+ ///
+ if (SerialDevice->HardwareFlowControl) {
+ ///
+ /// Assert RTS
+ ///
+ Mcr.Data = READ_MCR (SerialDevice->PciIo, SerialDevice->BarIndex);
+ Mcr.Bits.RTS &= 0;
+ WRITE_MCR (SerialDevice->PciIo, SerialDevice->BarIndex, Mcr.Data);
+ }
+ }
+ } while (Lsr.Bits.THRE && !PciSerialFifoEmpty (&SerialDevice->Transmit));
+ }
+
+ return EFI_SUCCESS;
+}
+
+///
+/// Interface Functions
+///
+
+/**
+ Reset serial device
+
+ @param[in] This Pointer to EFI_SERIAL_IO_PROTOCOL
+
+ @retval EFI_SUCCESS Reset successfully
+ @retval EFI_DEVICE_ERROR Failed to reset
+**/
+EFI_STATUS
+EFIAPI
+PciSerialReset (
+ IN EFI_SERIAL_IO_PROTOCOL *This
+ )
+{
+ EFI_STATUS Status;
+ SERIAL_DEV *SerialDevice;
+ SERIAL_PORT_LCR Lcr;
+ SERIAL_PORT_IER Ier;
+ SERIAL_PORT_MCR Mcr;
+ SERIAL_PORT_FCR Fcr;
+ EFI_TPL Tpl;
+
+ SerialDevice = SERIAL_DEV_FROM_THIS (This);
+
+ Tpl = gBS->RaiseTPL (TPL_NOTIFY);
+
+ ///
+ /// Make sure DLAB is 0.
+ ///
+ Lcr.Data = READ_LCR (SerialDevice->PciIo, SerialDevice->BarIndex);
+ Lcr.Bits.DLAB = 0;
+ WRITE_LCR (SerialDevice->PciIo, SerialDevice->BarIndex, Lcr.Data);
+
+ ///
+ /// Turn off all interrupts
+ ///
+ Ier.Data = READ_IER (SerialDevice->PciIo, SerialDevice->BarIndex);
+ Ier.Bits.RAVIE = 0;
+ Ier.Bits.THEIE = 0;
+ Ier.Bits.RIE = 0;
+ Ier.Bits.MIE = 0;
+ WRITE_IER (SerialDevice->PciIo, SerialDevice->BarIndex, Ier.Data);
+
+ ///
+ /// Disable the FIFO.
+ ///
+ Fcr.Bits.TRFIFOE = 0;
+ WRITE_FCR (SerialDevice->PciIo, SerialDevice->BarIndex, Fcr.Data);
+
+ ///
+ /// Turn off loopback and disable device interrupt.
+ ///
+ Mcr.Data = READ_MCR (SerialDevice->PciIo, SerialDevice->BarIndex);
+ Mcr.Bits.OUT1 = 0;
+ Mcr.Bits.OUT2 = 0;
+ Mcr.Bits.LME = 0;
+ WRITE_MCR (SerialDevice->PciIo, SerialDevice->BarIndex, Mcr.Data);
+
+ ///
+ /// Clear the scratch pad register
+ ///
+ WRITE_SCR (SerialDevice->PciIo, SerialDevice->BarIndex, 0);
+
+ ///
+ /// Go set the current attributes
+ ///
+ Status = This->SetAttributes (
+ This,
+ This->Mode->BaudRate,
+ This->Mode->ReceiveFifoDepth,
+ This->Mode->Timeout,
+ This->Mode->Parity,
+ (UINT8) This->Mode->DataBits,
+ This->Mode->StopBits
+ );
+
+ if (EFI_ERROR (Status)) {
+ gBS->RestoreTPL (Tpl);
+ return EFI_DEVICE_ERROR;
+ }
+ ///
+ /// Go set the current control bits
+ ///
+ Status = This->SetControl (
+ This,
+ This->Mode->ControlMask
+ );
+
+ if (EFI_ERROR (Status)) {
+ gBS->RestoreTPL (Tpl);
+ return EFI_DEVICE_ERROR;
+ }
+
+ gBS->RestoreTPL (Tpl);
+
+ ///
+ /// Device reset is complete
+ ///
+ return EFI_SUCCESS;
+}
+
+/**
+ Set new attributes to a serial device
+
+ @param[in] This Pointer to EFI_SERIAL_IO_PROTOCOL
+ @param[in] BaudRate The baudrate of the serial device
+ @param[in] ReceiveFifoDepth Fifo depth
+ @param[in] Timeout The request timeout for a single char
+ @param[in] Parity The type of parity used in serial device
+ @param[in] DataBits Number of databits used in serial device
+ @param[in] StopBits Number of stopbits used in serial device
+
+ @retval EFI_SUCCESS The new attributes were set
+ @retval EFI_INVALID_PARAMETERS One or more attributes have an unsupported value
+ @exception EFI_UNSUPPORTED Data Bits can not set to 5 or 6
+ @retval EFI_DEVICE_ERROR The serial device is not functioning correctly (no return)
+**/
+EFI_STATUS
+EFIAPI
+PciSerialSetAttributes (
+ IN EFI_SERIAL_IO_PROTOCOL *This,
+ IN UINT64 BaudRate,
+ IN UINT32 ReceiveFifoDepth,
+ IN UINT32 Timeout,
+ IN EFI_PARITY_TYPE Parity,
+ IN UINT8 DataBits,
+ IN EFI_STOP_BITS_TYPE StopBits
+ )
+{
+ EFI_STATUS Status;
+ SERIAL_DEV *SerialDevice;
+ UINT32 Divisor;
+ UINT32 Remained;
+ SERIAL_PORT_LCR Lcr;
+ EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
+ EFI_TPL Tpl;
+
+ SerialDevice = SERIAL_DEV_FROM_THIS (This);
+
+ ///
+ /// DEBUG ((EFI_D_ERROR, "Info: Timeout = %d\n", Timeout));
+ ///
+ /// Increase timeout by a factor of 3 to fix character drop-out with SOL.
+ ///
+ Timeout = Timeout * 100;
+
+ ///
+ /// Check for default settings and fill in actual values.
+ ///
+ if (BaudRate == 0) {
+ BaudRate = SERIAL_PORT_DEFAULT_BAUD_RATE;
+ }
+
+ if (ReceiveFifoDepth == 0) {
+ ReceiveFifoDepth = SERIAL_PORT_DEFAULT_RECEIVE_FIFO_DEPTH;
+ }
+
+ if (Timeout == 0) {
+ Timeout = SERIAL_PORT_DEFAULT_TIMEOUT;
+ }
+
+ if (Parity == DefaultParity) {
+ Parity = SERIAL_PORT_DEFAULT_PARITY;
+ }
+
+ if (DataBits == 0) {
+ DataBits = SERIAL_PORT_DEFAULT_DATA_BITS;
+ }
+
+ if (StopBits == DefaultStopBits) {
+ StopBits = SERIAL_PORT_DEFAULT_STOP_BITS;
+ }
+ ///
+ /// 5 and 6 data bits can not be verified on a 16550A UART
+ /// Return EFI_INVALID_PARAMETER if an attempt is made to use these settings.
+ ///
+ if ((DataBits == 5) || (DataBits == 6)) {
+ return EFI_INVALID_PARAMETER;
+ }
+ ///
+ /// Make sure all parameters are valid
+ ///
+ if ((BaudRate > SERIAL_PORT_MAX_BAUD_RATE) || (BaudRate < SERIAL_PORT_MIN_BAUD_RATE)) {
+ return EFI_INVALID_PARAMETER;
+ }
+ ///
+ /// 50,75,110,134,150,300,600,1200,1800,2000,2400,3600,4800,7200,9600,19200,
+ /// 38400,57600,115200
+ ///
+ if (BaudRate < 75) {
+ BaudRate = 50;
+ } else if (BaudRate < 110) {
+ BaudRate = 75;
+ } else if (BaudRate < 134) {
+ BaudRate = 110;
+ } else if (BaudRate < 150) {
+ BaudRate = 134;
+ } else if (BaudRate < 300) {
+ BaudRate = 150;
+ } else if (BaudRate < 600) {
+ BaudRate = 300;
+ } else if (BaudRate < 1200) {
+ BaudRate = 600;
+ } else if (BaudRate < 1800) {
+ BaudRate = 1200;
+ } else if (BaudRate < 2000) {
+ BaudRate = 1800;
+ } else if (BaudRate < 2400) {
+ BaudRate = 2000;
+ } else if (BaudRate < 3600) {
+ BaudRate = 2400;
+ } else if (BaudRate < 4800) {
+ BaudRate = 3600;
+ } else if (BaudRate < 7200) {
+ BaudRate = 4800;
+ } else if (BaudRate < 9600) {
+ BaudRate = 7200;
+ } else if (BaudRate < 19200) {
+ BaudRate = 9600;
+ } else if (BaudRate < 38400) {
+ BaudRate = 19200;
+ } else if (BaudRate < 57600) {
+ BaudRate = 38400;
+ } else if (BaudRate < 115200) {
+ BaudRate = 57600;
+ } else if (BaudRate <= SERIAL_PORT_MAX_BAUD_RATE) {
+ BaudRate = 115200;
+ }
+
+ if ((ReceiveFifoDepth < 1) || (ReceiveFifoDepth > SERIAL_PORT_MAX_RECEIVE_FIFO_DEPTH)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if ((Timeout < SERIAL_PORT_MIN_TIMEOUT) || (Timeout > SERIAL_PORT_MAX_TIMEOUT)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if ((Parity < NoParity) || (Parity > SpaceParity)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if ((DataBits < 5) || (DataBits > 8)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if ((StopBits < OneStopBit) || (StopBits > TwoStopBits)) {
+ return EFI_INVALID_PARAMETER;
+ }
+ ///
+ /// for DataBits = 5, StopBits can not set TwoStopBits
+ ///
+ /// if ((DataBits == 5) && (StopBits == TwoStopBits)) {
+ /// return EFI_INVALID_PARAMETER;
+ /// }
+ ///
+ /// for DataBits = 6,7,8, StopBits can not set OneFiveStopBits
+ ///
+ if ((DataBits >= 6) && (DataBits <= 8) && (StopBits == OneFiveStopBits)) {
+ return EFI_INVALID_PARAMETER;
+ }
+ ///
+ /// See if the new attributes already match the current attributes
+ ///
+ if (SerialDevice->UartDevicePath.BaudRate == BaudRate &&
+ SerialDevice->UartDevicePath.DataBits == DataBits &&
+ SerialDevice->UartDevicePath.Parity == Parity &&
+ SerialDevice->UartDevicePath.StopBits == StopBits &&
+ SerialDevice->SerialMode.ReceiveFifoDepth == ReceiveFifoDepth &&
+ SerialDevice->SerialMode.Timeout == Timeout
+ ) {
+ return EFI_SUCCESS;
+ }
+ ///
+ /// Compute divisor use to program the baud rate using a round determination
+ ///
+ Divisor = (UINT32) DivU64x32Remainder (SERIAL_PORT_INPUT_CLOCK, ((UINT32) BaudRate * 16), &Remained);
+ if (Remained) {
+ Divisor += 1;
+ }
+
+ if ((Divisor == 0) || (Divisor & 0xffff0000)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Tpl = gBS->RaiseTPL (TPL_NOTIFY);
+
+ ///
+ /// Compute the actual baud rate that the serial port will be programmed for.
+ ///
+ BaudRate = SERIAL_PORT_INPUT_CLOCK / Divisor / 16;
+
+ ///
+ /// Put serial port on Divisor Latch Mode
+ ///
+ Lcr.Data = READ_LCR (SerialDevice->PciIo, SerialDevice->BarIndex);
+ Lcr.Bits.DLAB = 1;
+ WRITE_LCR (SerialDevice->PciIo, SerialDevice->BarIndex, Lcr.Data);
+
+ ///
+ /// Write the divisor to the serial port
+ ///
+ WRITE_DLL (SerialDevice->PciIo, SerialDevice->BarIndex, (UINT8) (Divisor & 0xff));
+ WRITE_DLM (SerialDevice->PciIo, SerialDevice->BarIndex, (UINT8) ((Divisor >> 8) & 0xff));
+
+ ///
+ /// Put serial port back in normal mode and set remaining attributes.
+ ///
+ Lcr.Bits.DLAB = 0;
+
+ switch (Parity) {
+ case NoParity:
+ Lcr.Bits.PAREN = 0;
+ Lcr.Bits.EVENPAR = 0;
+ Lcr.Bits.STICPAR = 0;
+ break;
+
+ case EvenParity:
+ Lcr.Bits.PAREN = 1;
+ Lcr.Bits.EVENPAR = 1;
+ Lcr.Bits.STICPAR = 0;
+ break;
+
+ case OddParity:
+ Lcr.Bits.PAREN = 1;
+ Lcr.Bits.EVENPAR = 0;
+ Lcr.Bits.STICPAR = 0;
+ break;
+
+ case SpaceParity:
+ Lcr.Bits.PAREN = 1;
+ Lcr.Bits.EVENPAR = 1;
+ Lcr.Bits.STICPAR = 1;
+ break;
+
+ case MarkParity:
+ Lcr.Bits.PAREN = 1;
+ Lcr.Bits.EVENPAR = 0;
+ Lcr.Bits.STICPAR = 1;
+ break;
+ default:
+ break;
+ }
+
+ switch (StopBits) {
+ case OneStopBit:
+ Lcr.Bits.STOPB = 0;
+ break;
+
+ case OneFiveStopBits:
+ case TwoStopBits:
+ Lcr.Bits.STOPB = 1;
+ break;
+ default:
+ break;
+ }
+ ///
+ /// DataBits
+ ///
+ Lcr.Bits.SERIALDB = (UINT8) ((DataBits - 5) & 0x03);
+ WRITE_LCR (SerialDevice->PciIo, SerialDevice->BarIndex, Lcr.Data);
+
+ ///
+ /// Set the Serial I/O mode
+ ///
+ This->Mode->BaudRate = BaudRate;
+ This->Mode->ReceiveFifoDepth = ReceiveFifoDepth;
+ This->Mode->Timeout = Timeout;
+ This->Mode->Parity = Parity;
+ This->Mode->DataBits = DataBits;
+ This->Mode->StopBits = StopBits;
+
+ ///
+ /// See if Device Path Node has actually changed
+ ///
+ if (SerialDevice->UartDevicePath.BaudRate == BaudRate &&
+ SerialDevice->UartDevicePath.DataBits == DataBits &&
+ SerialDevice->UartDevicePath.Parity == Parity &&
+ SerialDevice->UartDevicePath.StopBits == StopBits
+ ) {
+ gBS->RestoreTPL (Tpl);
+ return EFI_SUCCESS;
+ }
+ ///
+ /// Update the device path
+ ///
+ SerialDevice->UartDevicePath.BaudRate = BaudRate;
+ SerialDevice->UartDevicePath.DataBits = DataBits;
+ SerialDevice->UartDevicePath.Parity = (UINT8) Parity;
+ SerialDevice->UartDevicePath.StopBits = (UINT8) StopBits;
+
+ NewDevicePath = AppendDevicePathNode (
+ SerialDevice->ParentDevicePath,
+ (EFI_DEVICE_PATH_PROTOCOL *) &SerialDevice->UartDevicePath
+ );
+ if (NewDevicePath == NULL) {
+ gBS->RestoreTPL (Tpl);
+ return EFI_DEVICE_ERROR;
+ }
+
+ if (SerialDevice->Handle != NULL) {
+ Status = gBS->ReinstallProtocolInterface (
+ SerialDevice->Handle,
+ &gEfiDevicePathProtocolGuid,
+ SerialDevice->DevicePath,
+ NewDevicePath
+ );
+ if (EFI_ERROR (Status)) {
+ gBS->RestoreTPL (Tpl);
+ return Status;
+ }
+ }
+
+ if (SerialDevice->DevicePath) {
+ FreePool (SerialDevice->DevicePath);
+ }
+
+ SerialDevice->DevicePath = NewDevicePath;
+
+ gBS->RestoreTPL (Tpl);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Set ControlBits
+
+ @param[in] This Pointer to EFI_SERIAL_IO_PROTOCOL
+ @param[in] Control Control bits that can be settable
+
+ @retval EFI_SUCCESS New Control bits were set successfully
+ @retval EFI_UNSUPPORTED The Control bits wanted to set are not supported
+**/
+EFI_STATUS
+EFIAPI
+PciSerialSetControl (
+ IN EFI_SERIAL_IO_PROTOCOL *This,
+ IN UINT32 Control
+ )
+{
+ SERIAL_DEV *SerialDevice;
+ SERIAL_PORT_MCR Mcr;
+ EFI_TPL Tpl;
+
+ ///
+ /// The control bits that can be set are :
+ /// EFI_SERIAL_DATA_TERMINAL_READY: 0x0001 // WO
+ /// EFI_SERIAL_REQUEST_TO_SEND: 0x0002 // WO
+ /// EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE: 0x1000 // RW
+ /// EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE: 0x2000 // RW
+ ///
+ SerialDevice = SERIAL_DEV_FROM_THIS (This);
+
+ ///
+ /// first determine the parameter is invalid
+ ///
+ if (Control & 0xffff8ffc) {
+ return EFI_UNSUPPORTED;
+ }
+
+ Tpl = gBS->RaiseTPL (TPL_NOTIFY);
+
+ Mcr.Data = READ_MCR (SerialDevice->PciIo, SerialDevice->BarIndex);
+ Mcr.Bits.DTRC = 0;
+ Mcr.Bits.RTS = 0;
+ Mcr.Bits.LME = 0;
+ SerialDevice->SoftwareLoopbackEnable = FALSE;
+ SerialDevice->HardwareFlowControl = FALSE;
+
+ if (Control & EFI_SERIAL_DATA_TERMINAL_READY) {
+ Mcr.Bits.DTRC = 1;
+ }
+
+ if (Control & EFI_SERIAL_REQUEST_TO_SEND) {
+ Mcr.Bits.RTS = 1;
+ }
+
+ if (Control & EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE) {
+ Mcr.Bits.LME = 1;
+ }
+
+ if (Control & EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE) {
+ SerialDevice->HardwareFlowControl = TRUE;
+ }
+
+ WRITE_MCR (SerialDevice->PciIo, SerialDevice->BarIndex, Mcr.Data);
+
+ if (Control & EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE) {
+ SerialDevice->SoftwareLoopbackEnable = TRUE;
+ }
+
+ gBS->RestoreTPL (Tpl);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Get ControlBits
+
+ @param[in] This Pointer to EFI_SERIAL_IO_PROTOCOL
+ @param[in] Control Control signals of the serial device
+
+ @retval EFI_SUCCESS Get Control signals successfully
+**/
+EFI_STATUS
+EFIAPI
+PciSerialGetControl (
+ IN EFI_SERIAL_IO_PROTOCOL *This,
+ OUT UINT32 *Control
+ )
+{
+ SERIAL_DEV *SerialDevice;
+ SERIAL_PORT_MSR Msr;
+ SERIAL_PORT_MCR Mcr;
+ EFI_TPL Tpl;
+
+ Tpl = gBS->RaiseTPL (TPL_NOTIFY);
+
+ SerialDevice = SERIAL_DEV_FROM_THIS (This);
+
+ *Control = 0;
+
+ ///
+ /// Read the Modem Status Register
+ ///
+ Msr.Data = READ_MSR (SerialDevice->PciIo, SerialDevice->BarIndex);
+
+ if (Msr.Bits.CTS) {
+ *Control |= EFI_SERIAL_CLEAR_TO_SEND;
+ }
+
+ if (Msr.Bits.DSR) {
+ *Control |= EFI_SERIAL_DATA_SET_READY;
+ }
+
+ if (Msr.Bits.RI) {
+ *Control |= EFI_SERIAL_RING_INDICATE;
+ }
+
+ if (Msr.Bits.DCD) {
+ *Control |= EFI_SERIAL_CARRIER_DETECT;
+ }
+ ///
+ /// Read the Modem Control Register
+ ///
+ Mcr.Data = READ_MCR (SerialDevice->PciIo, SerialDevice->BarIndex);
+
+ if (Mcr.Bits.DTRC) {
+ *Control |= EFI_SERIAL_DATA_TERMINAL_READY;
+ }
+
+ if (Mcr.Bits.RTS) {
+ *Control |= EFI_SERIAL_REQUEST_TO_SEND;
+ }
+
+ if (Mcr.Bits.LME) {
+ *Control |= EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE;
+ }
+
+ if (SerialDevice->HardwareFlowControl) {
+ *Control |= EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE;
+ }
+ ///
+ /// See if the Transmit FIFO is empty
+ ///
+ PciSerialReceiveTransmit (SerialDevice);
+
+ if (PciSerialFifoEmpty (&SerialDevice->Transmit)) {
+ *Control |= EFI_SERIAL_OUTPUT_BUFFER_EMPTY;
+ }
+ ///
+ /// See if the Receive FIFO is empty.
+ ///
+ PciSerialReceiveTransmit (SerialDevice);
+
+ if (PciSerialFifoEmpty (&SerialDevice->Receive)) {
+ *Control |= EFI_SERIAL_INPUT_BUFFER_EMPTY;
+ }
+
+ if (SerialDevice->SoftwareLoopbackEnable) {
+ *Control |= EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE;
+ }
+
+ gBS->RestoreTPL (Tpl);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Write the specified number of bytes to serial device
+
+ @param[in] This Pointer to EFI_SERIAL_IO_PROTOCOL
+ @param[in] BufferSize On input the size of Buffer, on output the amount of data actually written
+ @param[in] Buffer The buffer of data to write
+
+ @retval EFI_SUCCESS The data were written successfully
+ @retval EFI_DEVICE_ERROR The device reported an error
+ @retval EFI_TIMEOUT The write operation was stopped due to timeout
+**/
+EFI_STATUS
+EFIAPI
+PciSerialWrite (
+ IN EFI_SERIAL_IO_PROTOCOL *This,
+ IN OUT UINTN *BufferSize,
+ IN VOID *Buffer
+ )
+{
+ SERIAL_DEV *SerialDevice;
+ UINT8 *CharBuffer;
+ UINT32 Index;
+ UINTN Elapsed;
+ UINTN ActualWrite;
+ EFI_TPL Tpl;
+ SERIAL_PORT_MCR Mcr;
+
+ SerialDevice = SERIAL_DEV_FROM_THIS (This);
+ Elapsed = 0;
+ ActualWrite = 0;
+
+ if (*BufferSize == 0) {
+ return EFI_SUCCESS;
+ }
+
+ if (!Buffer) {
+ return EFI_DEVICE_ERROR;
+ }
+
+ Tpl = gBS->RaiseTPL (TPL_NOTIFY);
+
+ CharBuffer = (UINT8 *) Buffer;
+
+ for (Index = 0; Index < *BufferSize; Index++) {
+ PciSerialFifoAdd (&SerialDevice->Transmit, CharBuffer[Index]);
+
+ while
+ (
+ PciSerialReceiveTransmit (SerialDevice) != EFI_SUCCESS ||
+ PciSerialFifoEmpty (&SerialDevice->Transmit) == FALSE
+ ) {
+ ///
+ /// Unsuccessful write so check if timeout has expired, if not,
+ /// stall for a bit, increment time elapsed, and try again
+ ///
+ if (Elapsed >= This->Mode->Timeout) {
+ *BufferSize = ActualWrite;
+ if (PciSerialFifoEmpty (&SerialDevice->Transmit)) {
+ gBS->RestoreTPL (Tpl);
+ return EFI_TIMEOUT;
+ }
+ }
+
+ gBS->Stall (TIMEOUT_STALL_INTERVAL);
+
+ Elapsed += TIMEOUT_STALL_INTERVAL;
+ } // end while
+ ActualWrite++;
+ ///
+ /// Successful write so reset timeout
+ ///
+ Elapsed = 0;
+
+ } // end for
+ ///
+ /// FW expects DTR bit to be SET before sending data. So enable DTR bit always.
+ ///
+ Mcr.Data = READ_MCR (SerialDevice->PciIo, SerialDevice->BarIndex);
+ Mcr.Bits.DTRC |= 1;
+ WRITE_MCR (SerialDevice->PciIo, SerialDevice->BarIndex, Mcr.Data);
+
+ gBS->RestoreTPL (Tpl);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Read the specified number of bytes from serial device
+
+ @param[in] This Pointer to EFI_SERIAL_IO_PROTOCOL
+ @param[in] BufferSize On input the size of Buffer, on output the amount of data returned in buffer
+ @param[in] Buffer The buffer to return the data into
+
+ @retval EFI_SUCCESS The data were read successfully
+ @retval EFI_DEVICE_ERROR The device reported an error
+ @retval EFI_TIMEOUT The read operation was stopped due to timeout
+**/
+EFI_STATUS
+EFIAPI
+PciSerialRead (
+ IN EFI_SERIAL_IO_PROTOCOL *This,
+ IN OUT UINTN *BufferSize,
+ OUT VOID *Buffer
+ )
+{
+ SERIAL_DEV *SerialDevice;
+ UINT32 Index;
+ UINT8 *CharBuffer;
+ UINTN Elapsed;
+ EFI_STATUS Status;
+ EFI_TPL Tpl;
+
+ SerialDevice = SERIAL_DEV_FROM_THIS (This);
+ Elapsed = 0;
+
+ if (*BufferSize == 0) {
+ return EFI_SUCCESS;
+ }
+
+ if (!Buffer) {
+ return EFI_DEVICE_ERROR;
+ }
+ ///
+ /// SerialDevice->Receive.First = 0;
+ /// SerialDevice->Receive.Last = 0;
+ /// SerialDevice->Receive.Surplus = SERIAL_MAX_BUFFER_SIZE;
+ ///
+ Tpl = gBS->RaiseTPL (TPL_NOTIFY);
+
+ Status = PciSerialReceiveTransmit (SerialDevice);
+
+ if (EFI_ERROR (Status)) {
+ *BufferSize = 0;
+
+ gBS->RestoreTPL (Tpl);
+
+ return EFI_DEVICE_ERROR;
+ }
+
+ CharBuffer = (UINT8 *) Buffer;
+ for (Index = 0; Index < *BufferSize; Index++) {
+ while (PciSerialFifoRemove (&SerialDevice->Receive, &(CharBuffer[Index])) != EFI_SUCCESS) {
+ ///
+ /// Unsuccessful read so check if timeout has expired, if not,
+ /// stall for a bit, increment time elapsed, and try again
+ /// Need this time out to get conspliter to work.
+ ///
+ if (Elapsed >= This->Mode->Timeout) {
+ *BufferSize = Index;
+ gBS->RestoreTPL (Tpl);
+ return EFI_TIMEOUT;
+ }
+
+ gBS->Stall (TIMEOUT_STALL_INTERVAL);
+ Elapsed += TIMEOUT_STALL_INTERVAL;
+
+ Status = PciSerialReceiveTransmit (SerialDevice);
+ if (Status == EFI_DEVICE_ERROR) {
+ *BufferSize = Index;
+ gBS->RestoreTPL (Tpl);
+ return EFI_DEVICE_ERROR;
+ }
+ } // end while
+ ///
+ /// Successful read so reset timeout
+ ///
+ Elapsed = 0;
+ } // end for
+ PciSerialReceiveTransmit (SerialDevice);
+
+ gBS->RestoreTPL (Tpl);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Check serial port status.
+
+ @param[in] SerialDevice The serial device instance
+
+ @retval True It is present.
+ @retval False No present.
+**/
+BOOLEAN
+PciSerialPortPresent (
+ IN SERIAL_DEV *SerialDevice
+ )
+{
+ UINT8 Temp;
+ BOOLEAN Status;
+
+ Status = TRUE;
+
+ ///
+ /// Save SCR reg
+ ///
+ Temp = READ_SCR (SerialDevice->PciIo, SerialDevice->BarIndex);
+ WRITE_SCR (SerialDevice->PciIo, SerialDevice->BarIndex, 0xAA);
+
+ if (READ_SCR (SerialDevice->PciIo, SerialDevice->BarIndex) != 0xAA) {
+#ifndef EFI_NT_EMULATOR
+ Status = FALSE;
+#endif
+ }
+
+ WRITE_SCR (SerialDevice->PciIo, SerialDevice->BarIndex, 0x55);
+
+ if (READ_SCR (SerialDevice->PciIo, SerialDevice->BarIndex) != 0x55) {
+#ifndef EFI_NT_EMULATOR
+ Status = FALSE;
+#endif
+ }
+ ///
+ /// Restore SCR
+ ///
+ WRITE_SCR (SerialDevice->PciIo, SerialDevice->BarIndex, Temp);
+ return Status;
+}
+
+/**
+ PCI I/O read for byte only
+
+ @param[in] PciIo Pointer of Pci IO protocol
+ @param[in] BarIndex Index of the BAR within PCI device
+ @param[in] Offset Offset of the BARIndex within PCI device
+
+ @retval Return value read
+**/
+UINT8
+PciSerialReadPort (
+ IN EFI_PCI_IO_PROTOCOL *PciIo,
+ IN UINT16 BarIndex,
+ IN UINT16 Offset
+ )
+{
+ UINT8 Data;
+
+ ///
+ /// Use PciIo to access IO
+ ///
+ PciIo->Io.Read (
+ PciIo,
+ EfiPciIoWidthUint8,
+ (UINT8) BarIndex,
+ (UINT16) Offset,
+ (UINTN) 1,
+ &Data
+ );
+ return Data;
+}
+
+/**
+ PCI I/O - write a byte
+
+ @param[in] PciIo Pointer of Pci IO protocol
+ @param[in] BarIndex Index of the BAR within PCI device
+ @param[in] Offset Offset of the BARIndex within PCI device
+ @param[in] Data Written value
+**/
+VOID
+PciSerialWritePort (
+ IN EFI_PCI_IO_PROTOCOL *PciIo,
+ IN UINT16 BarIndex,
+ IN UINT16 Offset,
+ IN UINT8 Data
+ )
+{
+ ///
+ /// Use PciIo to access IO
+ ///
+ PciIo->Io.Write (
+ PciIo,
+ EfiPciIoWidthUint8,
+ (UINT8) BarIndex,
+ (UINT16) Offset,
+ (UINTN) 1,
+ &Data
+ );
+}
+
+/**
+ Sol driver entry
+
+ @param[in] ImageHandle Handle for this drivers loaded image protocol.
+ @param[in] SystemTable EFI system table.
+
+ @retval EFI_SUCCESS Always return EFI_SUCCESS
+**/
+EFI_STATUS
+EFIAPI
+PciSerialControllerDriverEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/ME/ActiveManagement/Sol/Dxe/PciSerial.cif b/ReferenceCode/ME/ActiveManagement/Sol/Dxe/PciSerial.cif
new file mode 100644
index 0000000..950205e
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/Sol/Dxe/PciSerial.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "PciSerial"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\ActiveManagement\Sol\Dxe\"
+ RefName = "PciSerial"
+[files]
+"PciSerial.sdl"
+"PciSerial.mak"
+"PciSerial.c"
+"ComponentName.c"
+"PciSerial.h"
+"PciSerial.inf"
+<endComponent>
diff --git a/ReferenceCode/ME/ActiveManagement/Sol/Dxe/PciSerial.h b/ReferenceCode/ME/ActiveManagement/Sol/Dxe/PciSerial.h
new file mode 100644
index 0000000..320de88
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/Sol/Dxe/PciSerial.h
@@ -0,0 +1,787 @@
+/** @file
+ Include for Pci Serial Driver
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights
+ reserved This software and associated documentation (if any)
+ is furnished under a license and may only be used or copied in
+ accordance with the terms of the license. Except as permitted
+ by such license, no part of this software or documentation may
+ be reproduced, stored in a retrieval system, or transmitted in
+ any form or by any means without the express written consent
+ of Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#ifndef _PCI_SERIAL_H
+#define _PCI_SERIAL_H
+#include "Pci22.h"
+#include "Acpi.h"
+#include "AmtLib.h"
+
+//
+// Driver Consumed Protocol Prototypes
+//
+#include EFI_PROTOCOL_DEFINITION (PciIo)
+#include EFI_PROTOCOL_DEFINITION (DevicePath)
+#include EFI_PROTOCOL_CONSUMER (PciRootBridgeIo)
+
+//
+// Driver Produced Protocol Prototypes
+//
+#include EFI_PROTOCOL_DEFINITION (DriverBinding)
+#include EFI_PROTOCOL_DEFINITION (ComponentName)
+#include EFI_PROTOCOL_DEFINITION (SerialIo)
+
+//
+// Status code GUID
+//
+#include EFI_GUID_DEFINITION (StatusCodeDataTypeId)
+
+//
+// Internal Data Structures
+//
+#define SERIAL_DEV_SIGNATURE EFI_SIGNATURE_32 ('s', 'e', 'r', 'd')
+#define SERIAL_MAX_BUFFER_SIZE 16
+#define TIMEOUT_STALL_INTERVAL 300
+
+///
+/// Name: SERIAL_DEV_FIFO
+/// Purpose: To define Receive FIFO and Transmit FIFO
+/// Context: Used by serial data transmit and receive
+/// Fields:
+/// First UINT32: The index of the first data in array Data[]
+/// Last UINT32: The index, which you can put a new data into array Data[]
+/// Surplus UINT32: Identify how many data you can put into array Data[]
+/// Data[] UINT8 : An array, which used to store data
+///
+typedef struct {
+ UINT32 First;
+ UINT32 Last;
+ UINT32 Surplus;
+ UINT8 Data[SERIAL_MAX_BUFFER_SIZE];
+} SERIAL_DEV_FIFO;
+
+typedef enum {
+ UART8250 = 0,
+ UART16450 = 1,
+ UART16550 = 2,
+ UART16550A= 3
+} EFI_UART_TYPE;
+
+///
+/// Name: SERIAL_DEV
+/// Purpose: To provide device specific information
+/// Context:
+/// Fields:
+/// Signature UINTN: The identity of the serial device
+/// SerialIo SERIAL_IO_PROTOCOL: Serial I/O protocol interface
+/// SerialMode SERIAL_IO_MODE:
+/// DevicePath EFI_DEVICE_PATH_PROTOCOL *: Device path of the serial device
+/// Handle EFI_HANDLE: The handle instance attached to serial device
+/// BarIndex UINT16: The bar index in pci cfg space that contains the base address
+/// of specific serial device
+/// Receive SERIAL_DEV_FIFO: The FIFO used to store data,
+/// which is received by UART
+/// Transmit SERIAL_DEV_FIFO: The FIFO used to store data,
+/// which you want to transmit by UART
+/// SoftwareLoopbackEnable BOOLEAN:
+/// Type EFI_UART_TYPE: Specify the UART type of certain serial device
+///
+typedef struct {
+ UINTN Signature;
+
+ EFI_HANDLE Handle;
+ EFI_SERIAL_IO_PROTOCOL SerialIo;
+ EFI_SERIAL_IO_MODE SerialMode;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+
+ EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
+ UART_DEVICE_PATH UartDevicePath;
+ EFI_PCI_IO_PROTOCOL *PciIo;
+
+ UINT16 BarIndex;
+ SERIAL_DEV_FIFO Receive;
+ SERIAL_DEV_FIFO Transmit;
+ BOOLEAN SoftwareLoopbackEnable;
+ BOOLEAN HardwareFlowControl;
+ EFI_UART_TYPE Type;
+ EFI_UNICODE_STRING_TABLE *ControllerNameTable;
+} SERIAL_DEV;
+
+#define SERIAL_DEV_FROM_THIS(a) CR (a, SERIAL_DEV, SerialIo, SERIAL_DEV_SIGNATURE)
+
+//
+// Globale Variables
+//
+extern EFI_DRIVER_BINDING_PROTOCOL mPciSerialControllerDriverBinding;
+extern EFI_COMPONENT_NAME_PROTOCOL mPciSerialComponentName;
+
+//
+// Serial Driver Defaults
+//
+#define SERIAL_PORT_DEFAULT_BAUD_RATE 115200
+#define SERIAL_PORT_DEFAULT_RECEIVE_FIFO_DEPTH 1
+#define SERIAL_PORT_DEFAULT_TIMEOUT 1000000 ///< 1 seconds
+#define SERIAL_PORT_DEFAULT_PARITY NoParity
+#define SERIAL_PORT_DEFAULT_DATA_BITS 8
+#define SERIAL_PORT_DEFAULT_STOP_BITS 1
+#define SERIAL_PORT_DEFAULT_CONTROL_MASK EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE
+
+///
+/// (24000000/13)MHz input clock
+///
+#define SERIAL_PORT_INPUT_CLOCK 1843200
+
+///
+/// 115200 baud with rounding errors
+///
+#define SERIAL_PORT_MAX_BAUD_RATE 115400
+#define SERIAL_PORT_MIN_BAUD_RATE 50
+
+#define SERIAL_PORT_MAX_RECEIVE_FIFO_DEPTH 16
+#define SERIAL_PORT_MIN_TIMEOUT 1 ///< 1 uS
+#define SERIAL_PORT_MAX_TIMEOUT 10000000000 ///< 10000 seconds
+//
+// UART Registers
+//
+#define SERIAL_REGISTER_THR 0 ///< WO Transmit Holding Register
+#define SERIAL_REGISTER_RBR 0 ///< RO Receive Buffer Register
+#define SERIAL_REGISTER_DLL 0 ///< R/W Divisor Latch LSB
+#define SERIAL_REGISTER_DLM 1 ///< R/W Divisor Latch MSB
+#define SERIAL_REGISTER_IER 1 ///< R/W Interrupt Enable Register
+#define SERIAL_REGISTER_IIR 2 ///< RO Interrupt Identification Register
+#define SERIAL_REGISTER_FCR 2 ///< WO FIFO Cotrol Register
+#define SERIAL_REGISTER_LCR 3 ///< R/W Line Control Register
+#define SERIAL_REGISTER_MCR 4 ///< R/W Modem Control Register
+#define SERIAL_REGISTER_LSR 5 ///< R/W Line Status Register
+#define SERIAL_REGISTER_MSR 6 ///< R/W Modem Status Register
+#define SERIAL_REGISTER_SCR 7 ///< R/W Scratch Pad Register
+#define TEKOA_SOL_VENDOR_ID 0x8086
+#define TEKOA_SOL_DEVICE_ID 0x108F
+
+#define PCI_CLASS_SCC 0x07
+#define PCI_SUBCLASS_SERIAL 0x00
+#define PCI_IF_GENERIC_XT 0x00
+#define PCI_IF_16450 0x01
+#define PCI_IF_16550 0x02
+#define PCI_IF_16650 0x03
+#define PCI_IF_16750 0x04
+#define PCI_IF_16850 0x05
+#define PCI_IF_16950 0x06
+#define PCI_SUBCLASS_PARALLEL 0x01
+#define PCI_SUBCLASS_MULTIPORT_SERIAL 0x02
+#define PCI_SUBCLASS_MODEM 0x03
+#define PCI_SUBCLASS_OTHER 0x80
+
+#pragma pack(1)
+///
+/// Name: SERIAL_PORT_IER_BITS
+/// Purpose: Define each bit in Interrupt Enable Register
+/// Context:
+/// Fields:
+/// RAVIE Bit0: Receiver Data Available Interrupt Enable
+/// THEIE Bit1: Transmistter Holding Register Empty Interrupt Enable
+/// RIE Bit2: Receiver Interrupt Enable
+/// MIE Bit3: Modem Interrupt Enable
+/// Reserved Bit4-Bit7: Reserved
+///
+typedef struct {
+ UINT8 RAVIE : 1;
+ UINT8 THEIE : 1;
+ UINT8 RIE : 1;
+ UINT8 MIE : 1;
+ UINT8 Reserved : 4;
+} SERIAL_PORT_IER_BITS;
+
+///
+/// Name: SERIAL_PORT_IER
+/// Purpose:
+/// Context:
+/// Fields:
+/// Bits SERIAL_PORT_IER_BITS: Bits of the IER
+/// Data UINT8: the value of the IER
+///
+typedef union {
+ SERIAL_PORT_IER_BITS Bits;
+ UINT8 Data;
+} SERIAL_PORT_IER;
+
+///
+/// Name: SERIAL_PORT_IIR_BITS
+/// Purpose: Define each bit in Interrupt Identification Register
+/// Context:
+/// Fields:
+/// IPS Bit0: Interrupt Pending Status
+/// IIB Bit1-Bit3: Interrupt ID Bits
+/// Reserved Bit4-Bit5: Reserved
+/// FIFOES Bit6-Bit7: FIFO Mode Enable Status
+///
+typedef struct {
+ UINT8 IPS : 1;
+ UINT8 IIB : 3;
+ UINT8 Reserved : 2;
+ UINT8 FIFOES : 2;
+} SERIAL_PORT_IIR_BITS;
+
+///
+/// Name: SERIAL_PORT_IIR
+/// Purpose:
+/// Context:
+/// Fields:
+/// Bits SERIAL_PORT_IIR_BITS: Bits of the IIR
+/// Data UINT8: the value of the IIR
+///
+typedef union {
+ SERIAL_PORT_IIR_BITS Bits;
+ UINT8 Data;
+} SERIAL_PORT_IIR;
+
+///
+/// Name: SERIAL_PORT_FCR_BITS
+/// Purpose: Define each bit in FIFO Control Register
+/// Context:
+/// Fields:
+/// TRFIFOE Bit0: Transmit and Receive FIFO Enable
+/// RESETRF Bit1: Reset Reciever FIFO
+/// RESETTF Bit2: Reset Transmistter FIFO
+/// DMS Bit3: DMA Mode Select
+/// Reserved Bit4-Bit5: Reserved
+/// RTB Bit6-Bit7: Receive Trigger Bits
+///
+typedef struct {
+ UINT8 TRFIFOE : 1;
+ UINT8 RESETRF : 1;
+ UINT8 RESETTF : 1;
+ UINT8 DMS : 1;
+ UINT8 Reserved : 2;
+ UINT8 RTB : 2;
+} SERIAL_PORT_FCR_BITS;
+
+///
+/// Name: SERIAL_PORT_FCR
+/// Purpose:
+/// Context:
+/// Fields:
+/// Bits SERIAL_PORT_FCR_BITS: Bits of the FCR
+/// Data UINT8: the value of the FCR
+///
+typedef union {
+ SERIAL_PORT_FCR_BITS Bits;
+ UINT8 Data;
+} SERIAL_PORT_FCR;
+
+///
+/// Name: SERIAL_PORT_LCR_BITS
+/// Purpose: Define each bit in Line Control Register
+/// Context:
+/// Fields:
+/// SERIALDB Bit0-Bit1: Number of Serial Data Bits
+/// STOPB Bit2: Number of Stop Bits
+/// PAREN Bit3: Parity Enable
+/// EVENPAR Bit4: Even Parity Select
+/// STICPAR Bit5: Sticky Parity
+/// BRCON Bit6: Break Control
+/// DLAB Bit7: Divisor Latch Access Bit
+///
+typedef struct {
+ UINT8 SERIALDB : 2;
+ UINT8 STOPB : 1;
+ UINT8 PAREN : 1;
+ UINT8 EVENPAR : 1;
+ UINT8 STICPAR : 1;
+ UINT8 BRCON : 1;
+ UINT8 DLAB : 1;
+} SERIAL_PORT_LCR_BITS;
+
+///
+/// Name: SERIAL_PORT_LCR
+/// Purpose:
+/// Context:
+/// Fields:
+/// Bits SERIAL_PORT_LCR_BITS: Bits of the LCR
+/// Data UINT8: the value of the LCR
+///
+typedef union {
+ SERIAL_PORT_LCR_BITS Bits;
+ UINT8 Data;
+} SERIAL_PORT_LCR;
+
+///
+/// Name: SERIAL_PORT_MCR_BITS
+/// Purpose: Define each bit in Modem Control Register
+/// Context:
+/// Fields:
+/// DTRC Bit0: Data Terminal Ready Control
+/// RTS Bit1: Request To Send Control
+/// OUT1 Bit2: Output1
+/// OUT2 Bit3: Output2, used to disable interrupt
+/// LME; Bit4: Loopback Mode Enable
+/// Reserved Bit5-Bit7: Reserved
+///
+typedef struct {
+ UINT8 DTRC : 1;
+ UINT8 RTS : 1;
+ UINT8 OUT1 : 1;
+ UINT8 OUT2 : 1;
+ UINT8 LME : 1;
+ UINT8 Reserved : 3;
+} SERIAL_PORT_MCR_BITS;
+
+///
+/// Name: SERIAL_PORT_MCR
+/// Purpose:
+/// Context:
+/// Fields:
+/// Bits SERIAL_PORT_MCR_BITS: Bits of the MCR
+/// Data UINT8: the value of the MCR
+///
+typedef union {
+ SERIAL_PORT_MCR_BITS Bits;
+ UINT8 Data;
+} SERIAL_PORT_MCR;
+
+///
+/// Name: SERIAL_PORT_LSR_BITS
+/// Purpose: Define each bit in Line Status Register
+/// Context:
+/// Fields:
+/// DR Bit0: Receiver Data Ready Status
+/// OE Bit1: Overrun Error Status
+/// PE Bit2: Parity Error Status
+/// FE Bit3: Framing Error Status
+/// BI Bit4: Break Interrupt Status
+/// THRE Bit5: Transmistter Holding Register Status
+/// TEMT Bit6: Transmitter Empty Status
+/// FIFOE Bit7: FIFO Error Status
+///
+typedef struct {
+ UINT8 DR : 1;
+ UINT8 OE : 1;
+ UINT8 PE : 1;
+ UINT8 FE : 1;
+ UINT8 BI : 1;
+ UINT8 THRE : 1;
+ UINT8 TEMT : 1;
+ UINT8 FIFOE : 1;
+} SERIAL_PORT_LSR_BITS;
+
+///
+/// Name: SERIAL_PORT_LSR
+/// Purpose:
+/// Context:
+/// Fields:
+/// Bits SERIAL_PORT_LSR_BITS: Bits of the LSR
+/// Data UINT8: the value of the LSR
+///
+typedef union {
+ SERIAL_PORT_LSR_BITS Bits;
+ UINT8 Data;
+} SERIAL_PORT_LSR;
+
+///
+/// Name: SERIAL_PORT_MSR_BITS
+/// Purpose: Define each bit in Modem Status Register
+/// Context:
+/// Fields:
+/// DeltaCTS Bit0: Delta Clear To Send Status
+/// DeltaDSR Bit1: Delta Data Set Ready Status
+/// TrailingEdgeRI Bit2: Trailing Edge of Ring Indicator Status
+/// DeltaDCD Bit3: Delta Data Carrier Detect Status
+/// CTS Bit4: Clear To Send Status
+/// DSR Bit5: Data Set Ready Status
+/// RI Bit6: Ring Indicator Status
+/// DCD Bit7: Data Carrier Detect Status
+///
+typedef struct {
+ UINT8 DeltaCTS : 1;
+ UINT8 DeltaDSR : 1;
+ UINT8 TrailingEdgeRI : 1;
+ UINT8 DeltaDCD : 1;
+ UINT8 CTS : 1;
+ UINT8 DSR : 1;
+ UINT8 RI : 1;
+ UINT8 DCD : 1;
+} SERIAL_PORT_MSR_BITS;
+
+///
+/// Name: SERIAL_PORT_MSR
+/// Purpose:
+/// Context:
+/// Fields:
+/// Bits SERIAL_PORT_MSR_BITS: Bits of the MSR
+/// Data UINT8: the value of the MSR
+///
+typedef union {
+ SERIAL_PORT_MSR_BITS Bits;
+ UINT8 Data;
+} SERIAL_PORT_MSR;
+
+#pragma pack()
+//
+// Define serial register I/O macros
+//
+#define READ_RBR(IO, B) PciSerialReadPort (IO, B, SERIAL_REGISTER_RBR)
+#define READ_DLL(IO, B) PciSerialReadPort (IO, B, SERIAL_REGISTER_DLL)
+#define READ_DLM(IO, B) PciSerialReadPort (IO, B, SERIAL_REGISTER_DLM)
+#define READ_IER(IO, B) PciSerialReadPort (IO, B, SERIAL_REGISTER_IER)
+#define READ_IIR(IO, B) PciSerialReadPort (IO, B, SERIAL_REGISTER_IIR)
+#define READ_LCR(IO, B) PciSerialReadPort (IO, B, SERIAL_REGISTER_LCR)
+#define READ_MCR(IO, B) PciSerialReadPort (IO, B, SERIAL_REGISTER_MCR)
+#define READ_LSR(IO, B) PciSerialReadPort (IO, B, SERIAL_REGISTER_LSR)
+#define READ_MSR(IO, B) PciSerialReadPort (IO, B, SERIAL_REGISTER_MSR)
+#define READ_SCR(IO, B) PciSerialReadPort (IO, B, SERIAL_REGISTER_SCR)
+
+#define WRITE_THR(IO, B, D) PciSerialWritePort (IO, B, SERIAL_REGISTER_THR, D)
+#define WRITE_DLL(IO, B, D) PciSerialWritePort (IO, B, SERIAL_REGISTER_DLL, D)
+#define WRITE_DLM(IO, B, D) PciSerialWritePort (IO, B, SERIAL_REGISTER_DLM, D)
+#define WRITE_IER(IO, B, D) PciSerialWritePort (IO, B, SERIAL_REGISTER_IER, D)
+#define WRITE_FCR(IO, B, D) PciSerialWritePort (IO, B, SERIAL_REGISTER_FCR, D)
+#define WRITE_LCR(IO, B, D) PciSerialWritePort (IO, B, SERIAL_REGISTER_LCR, D)
+#define WRITE_MCR(IO, B, D) PciSerialWritePort (IO, B, SERIAL_REGISTER_MCR, D)
+#define WRITE_LSR(IO, B, D) PciSerialWritePort (IO, B, SERIAL_REGISTER_LSR, D)
+#define WRITE_MSR(IO, B, D) PciSerialWritePort (IO, B, SERIAL_REGISTER_MSR, D)
+#define WRITE_SCR(IO, B, D) PciSerialWritePort (IO, B, SERIAL_REGISTER_SCR, D)
+
+#define PCI_SERIAL_PORT_NAME "PCI Serial Port # "
+
+#define R_PCI_SVID 0x2C
+
+/**
+ This function checks to see if the driver supports a device specified by
+ "Controller handle" parameter. It is called by DXE Core StartImage() or
+ ConnectController() routines. The driver uses 'device path' and/or
+ 'services' from the Bus I/O abstraction attached to the controller handle
+ to determine if the driver support this controller handle.
+
+ Note: In the BDS (Boot Device Selection) phase, the DXE core enumerate all
+ devices (or, controller) and assigns GUIDs to them.
+
+ @param[in] This a pointer points to the Binding Protocol instance
+ @param[in] Controller The handle of controller to be tested.
+ @param[in] RemainingDevicePath A pointer to the device path. Ignored by device
+ driver but used by bus driver
+
+ @retval EFI_SUCCESS Have device to support
+ @retval EFI_NOT_FOUND The device doesn't support or relative environment not ready
+**/
+EFI_STATUS
+EFIAPI
+PciSerialControllerDriverSupported (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE Controller,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
+ )
+;
+
+/**
+ This routine is called right after the .Supported() called
+ and return EFI_SUCCESS. Notes: The supported protocols are
+ checked but the Protocols are closed.
+
+ @param[in] This A pointer points to the Binding Protocol instance
+ @param[in] Controller The handle of controller to be tested. Parameter
+ passed by the caller
+ @param[in] RemainingDevicePath A pointer to the device path. Should be ignored by
+ device driver
+
+ @retval EFI_SUCCESS The driver ready and initial complete.
+ @retval Other The device doesn't initial.
+**/
+EFI_STATUS
+EFIAPI
+PciSerialControllerDriverStart (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE Controller,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
+ )
+;
+
+/**
+ Stop.
+
+ @param[in] This Pointer to driver binding protocol
+ @param[in] Controller Controller handle to connect
+ @param[in] NumberOfChildren Number of children handle created by this driver
+ @param[in] ChildHandleBuffer Buffer containing child handle created
+
+ @retval EFI_SUCCESS Driver disconnected successfully from controller
+ @retval EFI_DEVICE_ERROR Cannot find BIOS_VIDEO_DEV structure
+**/
+EFI_STATUS
+EFIAPI
+PciSerialControllerDriverStop (
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE Controller,
+ IN UINTN NumberOfChildren,
+ IN EFI_HANDLE *ChildHandleBuffer
+ )
+;
+
+/**
+ Detect whether specific FIFO is full or not
+
+ @param[in] Fifo A pointer to the Data Structure SERIAL_DEV_FIFO
+
+ @retval TRUE The FIFO is full
+ @retval FALSE The FIFO is not full
+**/
+BOOLEAN
+PciSerialFifoFull (
+ IN SERIAL_DEV_FIFO *Fifo
+ )
+;
+
+/**
+ Detect whether specific FIFO is empty or not
+
+ @param[in] Fifo A pointer to the Data Structure SERIAL_DEV_FIFO
+
+ @retval TRUE The FIFO is empty
+ @retval FALSE The FIFO is not empty
+**/
+BOOLEAN
+PciSerialFifoEmpty (
+ IN SERIAL_DEV_FIFO *Fifo
+ )
+;
+
+/**
+ Add data to specific FIFO
+
+ @param[in] Fifo A pointer to the Data Structure SERIAL_DEV_FIFO
+ @param[in] Data The data added to FIFO
+
+ @retval EFI_SUCCESS Add data to specific FIFO successfully
+ @retval EFI_OUT_OF_RESOURCES Failed to add data because FIFO is already full
+**/
+EFI_STATUS
+PciSerialFifoAdd (
+ IN SERIAL_DEV_FIFO *Fifo,
+ IN UINT8 Data
+ )
+;
+
+/**
+ Remove data from specific FIFO
+
+ @param[in] Fifo A pointer to the Data Structure SERIAL_DEV_FIFO
+ @param[in] Data The data removed from FIFO
+
+ @retval EFI_SUCCESS Remove data from specific FIFO successfully
+ @retval EFI_OUT_OF_RESOURCES Failed to remove data because FIFO is empty
+**/
+EFI_STATUS
+PciSerialFifoRemove (
+ IN SERIAL_DEV_FIFO *Fifo,
+ OUT UINT8 *Data
+ )
+;
+
+/**
+ Reads and writes all avaliable data.
+
+ @param[in] SerialDevice The device to flush
+
+ @retval EFI_SUCCESS Data was read/written successfully.
+ @retval EFI_OUT_OF_RESOURCES Failed because software receive FIFO is full. Note, when
+ this happens, pending writes are not done.
+**/
+EFI_STATUS
+PciSerialReceiveTransmit (
+ IN SERIAL_DEV *SerialDevice
+ )
+;
+///
+/// Serial I/O Protocol Interface
+///
+/**
+ Reset serial device
+
+ @param[in] This Pointer to EFI_SERIAL_IO_PROTOCOL
+
+ @retval EFI_SUCCESS Reset successfully
+ @retval EFI_DEVICE_ERROR Failed to reset
+**/
+EFI_STATUS
+EFIAPI
+PciSerialReset (
+ IN EFI_SERIAL_IO_PROTOCOL *This
+ )
+;
+
+/**
+ Set new attributes to a serial device
+
+ @param[in] This Pointer to EFI_SERIAL_IO_PROTOCOL
+ @param[in] BaudRate The baudrate of the serial device
+ @param[in] ReceiveFifoDepth Fifo depth
+ @param[in] Timeout The request timeout for a single char
+ @param[in] Parity The type of parity used in serial device
+ @param[in] DataBits Number of databits used in serial device
+ @param[in] StopBits Number of stopbits used in serial device
+
+ @retval EFI_SUCCESS The new attributes were set
+ @retval EFI_INVALID_PARAMETERS One or more attributes have an unsupported value
+ @exception EFI_UNSUPPORTED Data Bits can not set to 5 or 6
+ @retval EFI_DEVICE_ERROR The serial device is not functioning correctly (no return)
+**/
+EFI_STATUS
+EFIAPI
+PciSerialSetAttributes (
+ IN EFI_SERIAL_IO_PROTOCOL *This,
+ IN UINT64 BaudRate,
+ IN UINT32 ReceiveFifoDepth,
+ IN UINT32 Timeout,
+ IN EFI_PARITY_TYPE Parity,
+ IN UINT8 DataBits,
+ IN EFI_STOP_BITS_TYPE StopBits
+ )
+;
+
+/**
+ Set ControlBits
+
+ @param[in] This Pointer to EFI_SERIAL_IO_PROTOCOL
+ @param[in] Control Control bits that can be settable
+
+ @retval EFI_SUCCESS New Control bits were set successfully
+ @retval EFI_UNSUPPORTED The Control bits wanted to set are not supported
+**/
+EFI_STATUS
+EFIAPI
+PciSerialSetControl (
+ IN EFI_SERIAL_IO_PROTOCOL *This,
+ IN UINT32 Control
+ )
+;
+
+/**
+ Get ControlBits
+
+ @param[in] This Pointer to EFI_SERIAL_IO_PROTOCOL
+ @param[in] Control Control signals of the serial device
+
+ @retval EFI_SUCCESS Get Control signals successfully
+**/
+EFI_STATUS
+EFIAPI
+PciSerialGetControl (
+ IN EFI_SERIAL_IO_PROTOCOL *This,
+ OUT UINT32 *Control
+ )
+;
+
+/**
+ Write the specified number of bytes to serial device
+
+ @param[in] This Pointer to EFI_SERIAL_IO_PROTOCOL
+ @param[in] BufferSize On input the size of Buffer, on output the amount of data actually written
+ @param[in] Buffer The buffer of data to write
+
+ @retval EFI_SUCCESS The data were written successfully
+ @retval EFI_DEVICE_ERROR The device reported an error
+ @retval EFI_TIMEOUT The write operation was stopped due to timeout
+**/
+EFI_STATUS
+EFIAPI
+PciSerialWrite (
+ IN EFI_SERIAL_IO_PROTOCOL *This,
+ IN OUT UINTN *BufferSize,
+ IN VOID *Buffer
+ )
+;
+
+/**
+ Read the specified number of bytes from serial device
+
+ @param[in] This Pointer to EFI_SERIAL_IO_PROTOCOL
+ @param[in] BufferSize On input the size of Buffer, on output the amount of data returned in buffer
+ @param[in] Buffer The buffer to return the data into
+
+ @retval EFI_SUCCESS The data were read successfully
+ @retval EFI_DEVICE_ERROR The device reported an error
+ @retval EFI_TIMEOUT The read operation was stopped due to timeout
+**/
+EFI_STATUS
+EFIAPI
+PciSerialRead (
+ IN EFI_SERIAL_IO_PROTOCOL *This,
+ IN OUT UINTN *BufferSize,
+ OUT VOID *Buffer
+ )
+;
+
+///
+/// Internal Functions
+///
+/**
+ Check serial port status.
+
+ @param[in] SerialDevice The serial device instance
+
+ @retval True It is present.
+ @retval False No present.
+**/
+BOOLEAN
+PciSerialPortPresent (
+ IN SERIAL_DEV *SerialDevice
+ )
+;
+
+/**
+ PCI I/O read for byte only
+
+ @param[in] PciIo Pointer of Pci IO protocol
+ @param[in] BarIndex Index of the BAR within PCI device
+ @param[in] Offset Offset of the BARIndex within PCI device
+
+ @retval Return value read
+**/
+UINT8
+PciSerialReadPort (
+ IN EFI_PCI_IO_PROTOCOL *PciIo,
+ IN UINT16 BarIndex,
+ IN UINT16 Offset
+ )
+;
+
+/**
+ PCI I/O - write a byte
+
+ @param[in] PciIo Pointer of Pci IO protocol
+ @param[in] BarIndex Index of the BAR within PCI device
+ @param[in] Offset Offset of the BARIndex within PCI device
+ @param[in] Data Written value
+**/
+VOID
+PciSerialWritePort (
+ IN EFI_PCI_IO_PROTOCOL *PciIo,
+ IN UINT16 BarIndex,
+ IN UINT16 Offset,
+ IN UINT8 Data
+ )
+;
+
+/**
+ Sol driver entry
+
+ @param[in] ImageHandle Handle for this drivers loaded image protocol.
+ @param[in] SystemTable EFI system table.
+
+ @retval EFI_SUCCESS Always return EFI_SUCCESS
+**/
+EFI_STATUS
+EFIAPI
+PciSerialControllerDriverEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+;
+#endif
diff --git a/ReferenceCode/ME/ActiveManagement/Sol/Dxe/PciSerial.inf b/ReferenceCode/ME/ActiveManagement/Sol/Dxe/PciSerial.inf
new file mode 100644
index 0000000..a3b4e0b
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/Sol/Dxe/PciSerial.inf
@@ -0,0 +1,87 @@
+## @file
+# Component description file for PciSerial module.
+#
+#@copyright
+# Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = PciSerial
+FILE_GUID = FB142B99-DF57-46cb-BC69-0BF858A734F9
+COMPONENT_TYPE = BS_DRIVER
+
+[sources.common]
+ PciSerial.c
+ PciSerial.h
+ ComponentName.c
+
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueDxeDriverEntryPoint.c
+
+[includes.common]
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/AMT/Dxe
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/AMT/Include
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[libraries.common]
+ AmtLib
+ EdkProtocolLib
+ EdkIIGlueBaseLib
+ EdkIIGlueBaseMemoryLib
+ EdkIIGlueDxeReportStatusCodeLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueUefiDevicePathLib
+ EdkIIGlueUefiLib
+ EdkIIGlueUefiDriverModelLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=PciSerialControllerDriverEntryPoint \
+ -D __EDKII_GLUE_DRIVER_BINDING_PROTOCOL_INSTANCE__=mPciSerialControllerDriverBinding \
+ -D __EDKII_GLUE_COMPONENT_NAME_PROTOCOL_INSTANCE__=mPciSerialComponentName
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_LIB__ \
+ -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_DEVICE_PATH_LIB__
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_UEFI_LIB__ \
+ -D __EDKII_GLUE_UEFI_DRIVER_MODEL_LIB__
diff --git a/ReferenceCode/ME/ActiveManagement/Sol/Dxe/PciSerial.mak b/ReferenceCode/ME/ActiveManagement/Sol/Dxe/PciSerial.mak
new file mode 100644
index 0000000..a94fda5
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/Sol/Dxe/PciSerial.mak
@@ -0,0 +1,55 @@
+# MAK file for the ModulePart:PciSerial
+
+all : PciSerial
+
+$(BUILD_DIR)\PciSerial.mak : $(PciSerial_DIR)\$(@B).cif $(PciSerial_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(PciSerial_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+PciSerial : $(BUILD_DIR)\PciSerial.mak PciSerialBin
+
+PciSerial_INCLUDES=\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(ME_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)
+
+PciSerial_LIBS=\
+ $(EDKPROTOCOLLIB)\
+ $(AmtLibDxe_LIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueUefiDevicePathLib_LIB)\
+ $(EdkIIGlueUefiLib_LIB)\
+ $(EdkIIGlueUefiDriverModelLib_LIB)\
+
+PciSerial_DEFINES=\
+ $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=PciSerialControllerDriverEntryPoint"\
+ /D"__EDKII_GLUE_DRIVER_BINDING_PROTOCOL_INSTANCE__=mPciSerialControllerDriverBinding"\
+ /D"__EDKII_GLUE_COMPONENT_NAME_PROTOCOL_INSTANCE__=mPciSerialComponentName"\
+ /D __EDKII_GLUE_BASE_LIB__\
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__\
+ /D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__\
+ /D __EDKII_GLUE_UEFI_DEVICE_PATH_LIB__\
+ /D __EDKII_GLUE_UEFI_LIB__ \
+ /D __EDKII_GLUE_UEFI_DRIVER_MODEL_LIB__
+
+PciSerialBin : $(PciSerial_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\PciSerial.mak all \
+ "MY_INCLUDES=$(PciSerial_INCLUDES)"\
+ "MY_DEFINES=$(PciSerial_DEFINES)"\
+ GUID=FB142B99-DF57-46cb-BC69-0BF858A734F9 \
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=BS_DRIVER \
+ EDKIIModule=DXEDRIVER\
+ COMPRESS=1
diff --git a/ReferenceCode/ME/ActiveManagement/Sol/Dxe/PciSerial.sdl b/ReferenceCode/ME/ActiveManagement/Sol/Dxe/PciSerial.sdl
new file mode 100644
index 0000000..b485486
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/Sol/Dxe/PciSerial.sdl
@@ -0,0 +1,24 @@
+TOKEN
+ Name = "PciSerial_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable PciSerial support in Project"
+End
+MODULE
+ Help = "Includes PciSerial.mak to Project"
+ File = "PciSerial.mak"
+End
+
+PATH
+ Name = "PciSerial_DIR"
+ Help = "iAMT PciSerial file source directory"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PciSerial.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End \ No newline at end of file
diff --git a/ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.c b/ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.c
new file mode 100644
index 0000000..87c0818
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.c
@@ -0,0 +1,96 @@
+/** @file
+ Start Watchdog timer in PEI phase
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights
+ reserved This software and associated documentation (if any)
+ is furnished under a license and may only be used or copied in
+ accordance with the terms of the license. Except as permitted
+ by such license, no part of this software or documentation may
+ be reproduced, stored in a retrieval system, or transmitted in
+ any form or by any means without the express written consent
+ of Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#include "StartWatchDog.h"
+#include "MeLibPei.h"
+#endif
+
+/**
+ Perform the platform spefific initializations.
+
+ @param[in] FfsHeader FFS file header pointer of this driver.
+ @param[in] PeiServices General purpose services available to every PEIM.
+
+ @retval EFI_SUCCESS if the interface could be successfully installed.
+**/
+EFI_STATUS
+EFIAPI
+PeiInitStartWatchDog (
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_STATUS Status;
+ EFI_BOOT_MODE BootMode;
+ PEI_HECI_PPI *HeciPpi;
+ UINT32 HeciMemBar;
+ UINT16 WaitTimerBios;
+ UINT32 MeStatus;
+
+ Status = (*PeiServices)->GetBootMode (PeiServices, &BootMode);
+ ASSERT_EFI_ERROR (Status);
+
+ if (!EFI_ERROR (Status) && (BootMode == BOOT_ON_S3_RESUME)) {
+ return EFI_SUCCESS;
+ }
+
+ if (PeiAmtWatchDog (PeiServices)) {
+ Status = PeiServicesLocatePpi (
+ &gPeiHeciPpiGuid, // GUID
+ 0, // INSTANCE
+ NULL, // EFI_PEI_PPI_DESCRIPTOR
+ (VOID **) &HeciPpi // PPI
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ Status = HeciPpi->InitializeHeci (PeiServices, HeciPpi, &HeciMemBar);
+ if (!EFI_ERROR (Status)) {
+ ///
+ /// Get ME Status
+ ///
+ Status = HeciPpi->GetMeStatus (PeiServices, &MeStatus);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// If ME is ready, send AsfStartWatchDog message
+ ///
+ if (ME_STATUS_ME_STATE_ONLY (MeStatus) == ME_READY) {
+ WaitTimerBios = PeiAmtWatchTimerBiosGet (PeiServices);
+
+ Status = PeiHeciAsfStartWatchDog (
+ PeiServices,
+ HeciPpi,
+ HeciMemBar,
+ WaitTimerBios
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
+ }
+ }
+
+ return Status;
+}
diff --git a/ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.cif b/ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.cif
new file mode 100644
index 0000000..0dfa5a9
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "StartWatchDog"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\ActiveManagement\StartWatchDog\Pei\"
+ RefName = "StartWatchDog"
+[files]
+"StartWatchDog.sdl"
+"StartWatchDog.mak"
+"StartWatchDog.h"
+"StartWatchDog.c"
+"StartWatchDog.dxs"
+"StartWatchDog.inf"
+<endComponent>
diff --git a/ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.dxs b/ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.dxs
new file mode 100644
index 0000000..3c05cbb
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.dxs
@@ -0,0 +1,47 @@
+/** @file
+ Dependency expression file for the StartWatchDog PEIM.
+
+@copyright
+ Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "PeimDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+
+#include EFI_PPI_DEFINITION (Heci)
+#include EFI_PPI_DEFINITION (AmtPlatformPolicyPei)
+#include EFI_PPI_CONSUMER (BootMode)
+#endif
+
+DEPENDENCY_START
+ PEI_HECI_PPI_GUID AND
+ PEI_MASTER_BOOT_MODE_PEIM_PPI AND
+ PEI_AMT_PLATFORM_POLICY_PPI_GUID
+DEPENDENCY_END
+
+
diff --git a/ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.h b/ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.h
new file mode 100644
index 0000000..5415206
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.h
@@ -0,0 +1,49 @@
+/** @file
+ StartWatchDog header file
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights
+ reserved This software and associated documentation (if any)
+ is furnished under a license and may only be used or copied in
+ accordance with the terms of the license. Except as permitted
+ by such license, no part of this software or documentation may
+ be reproduced, stored in a retrieval system, or transmitted in
+ any form or by any means without the express written consent
+ of Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _EFI_START_WATCH_DOG_H_
+#define _EFI_START_WATCH_DOG_H_
+
+#include "BootMode.h"
+#include "AmtLibPei.h"
+
+#include EFI_PPI_DEPENDENCY (Heci)
+
+//
+// Function Prototypes
+//
+
+/**
+ Perform the platform spefific initializations.
+
+ @param[in] FfsHeader FFS file header pointer of this driver.
+ @param[in] PeiServices General purpose services available to every PEIM.
+
+ @retval EFI_SUCCESS if the interface could be successfully installed.
+**/
+EFI_STATUS
+EFIAPI
+PeiInitStartWatchDog (
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+;
+
+#endif // _EFI_START_WATCH_DOG_H_
diff --git a/ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.inf b/ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.inf
new file mode 100644
index 0000000..1dd3811
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.inf
@@ -0,0 +1,74 @@
+## @file
+# Component description file for the Start Watch Dog PEIM driver.
+#
+#@copyright
+# Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = StartWatchDog
+FILE_GUID = 5479E09C-2E74-481b-89F8-B0172E388D1F
+COMPONENT_TYPE = PE32_PEIM
+
+[sources.common]
+ StartWatchDog.h
+ StartWatchDog.c
+
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGluePeimEntryPoint.c
+
+[includes.common]
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/AMT/Pei
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/Pei
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/Include
+
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[libraries.common]
+ MeLibPpi
+ MeLibPei
+ AmtLibPei
+ EdkIIGlueBaseMemoryLib
+ EdkIIGluePeiDebugLibReportStatusCode
+ EdkIIGluePeiReportStatusCodeLib
+ EdkIIGluePeiServicesLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = StartWatchDog.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=PeiInitStartWatchDog
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_PEI_SERVICES_LIB__
diff --git a/ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.mak b/ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.mak
new file mode 100644
index 0000000..489c455
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.mak
@@ -0,0 +1,52 @@
+# MAK file for the ModulePart:StartWatchDog
+
+all: StartWatchDog
+
+StartWatchDog: $(BUILD_DIR)\StartWatchDog.mak StartWatchDogBin
+
+$(BUILD_DIR)\StartWatchDog.mak : $(StartWatchDog_DIR)\$(@B).cif $(StartWatchDog_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(StartWatchDog_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+
+StartWatchDog_INCLUDES=\
+ $(EDK_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(ME_INCLUDES)\
+
+StartWatchDog_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=PeiInitStartWatchDog"\
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_PEI_SERVICES_LIB__\
+ /D __EDKII_GLUE_PEI_MEMORY_ALLOCATION_LIB__ \
+
+StartWatchDog_LIBS =\
+ $(EDKPROTOCOLLIB)\
+ $(AmtLibPei_LIB)\
+ $(MeLibPpi_LIB)\
+ $(MeLibPei_LIB)\
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGlueBaseLibIA32_LIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGluePeiDebugLibReportStatusCode_LIB)\
+ $(EdkIIGluePeiReportStatusCodeLib_LIB)\
+ $(EdkIIGluePeiServicesLib_LIB)\
+ $(EdkIIGluePeiMemoryAllocationLib_LIB)\
+
+StartWatchDogBin : $(StartWatchDog_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\StartWatchDog.mak all\
+ NAME=StartWatchDog\
+ MAKEFILE=$(BUILD_DIR)\StartWatchDog.mak \
+ GUID=5479E09C-2E74-481b-89F8-B0172E388D1F\
+ "MY_INCLUDES=$(StartWatchDog_INCLUDES)"\
+ "MY_DEFINES=$(StartWatchDog_DEFINES)"\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=PEIM \
+ EDKIIModule=PEIM\
+ DEPEX1=$(StartWatchDog_DIR)\StartWatchDog.dxs DEPEX1_TYPE=EFI_SECTION_PEI_DEPEX \
+ COMPRESS=0
diff --git a/ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.sdl b/ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.sdl
new file mode 100644
index 0000000..ec760e6
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.sdl
@@ -0,0 +1,25 @@
+TOKEN
+ Name = "StartWatchDog_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable StartWatchDog support in Project"
+End
+
+MODULE
+ Help = "Includes StartWatchDog.mak to Project"
+ File = "StartWatchDog.mak"
+End
+
+PATH
+ Name = "StartWatchDog_DIR"
+ Help = "iAMT Heci Pei file source directory"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\StartWatchDog.ffs"
+ Parent = "FV_BB"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/ME/At/At.cif b/ReferenceCode/ME/At/At.cif
new file mode 100644
index 0000000..16018b3
--- /dev/null
+++ b/ReferenceCode/ME/At/At.cif
@@ -0,0 +1,10 @@
+<component>
+ name = "Anti-Theft"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\At\"
+ RefName = "AntiTheft"
+[files]
+"At.sdl"
+[parts]
+"AtAmDxe"
+<endComponent>
diff --git a/ReferenceCode/ME/At/At.sdl b/ReferenceCode/ME/At/At.sdl
new file mode 100644
index 0000000..587d4a2
--- /dev/null
+++ b/ReferenceCode/ME/At/At.sdl
@@ -0,0 +1,25 @@
+TOKEN
+ Name = "AT_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable TDT support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "AT_DIR"
+ Help = "TDT Driver files source directory"
+End
+
+ELINK
+ Name = "/I$(AT_DIR)"
+ Parent = "AT_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "AT_INCLUDES"
+ InvokeOrder = ReplaceParent
+End
diff --git a/ReferenceCode/ME/At/AtAm/Dxe/At.c b/ReferenceCode/ME/At/AtAm/Dxe/At.c
new file mode 100644
index 0000000..a47ddeb
--- /dev/null
+++ b/ReferenceCode/ME/At/AtAm/Dxe/At.c
@@ -0,0 +1,1015 @@
+/** @file
+ Implementation for the AT driver.
+ This driver implements the AT protocol.
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights
+ reserved This software and associated documentation (if any)
+ is furnished under a license and may only be used or copied in
+ accordance with the terms of the license. Except as permitted
+ by such license, no part of this software or documentation may
+ be reproduced, stored in a retrieval system, or transmitted in
+ any form or by any means without the express written consent
+ of Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+#include "At.h"
+
+AT_INSTANCE mAtInstance = {
+ AT_PRIVATE_DATA_SIGNATURE,
+ NULL,
+ {
+ (UINT8) AT_PROTOCOL_REVISION,
+ (EFI_AT_AUTHETICATE_CREDENTIAL) AuthenticateCredential,
+ (EFI_AT_COMPUTE_HASH) ComputeHash,
+ (EFI_AT_GET_NONCE) GetNonce,
+ (EFI_AT_GET_TIMER_INFO) GetTimerInfo,
+ (EFI_AT_GET_RECOVERY_STRING) GetRecoveryString,
+ (EFI_AT_GET_ISV_ID) GetIsvId,
+ (EFI_AT_SEND_ASSERT_STOLEN) SendAssertStolen,
+ (EFI_AT_SET_SUSPEND_STATE) SetSuspendState,
+ (EFI_AT_INIT_WWAN_RECOV) InitWWANREcov,
+ (EFI_AT_GET_WWAN_NIC_STATUS) GetWWANNicStatus,
+ (EFI_AT_GET_STATE_UNSIGNED) GetStateUnsigned
+
+ }
+};
+
+EFI_HECI_PROTOCOL *mHeci = NULL;
+
+/**
+ Entry point for the AT Driver.
+
+ @param[in] ImageHandle Image handle of this driver.
+ @param[in] SystemTable Global system service table.
+
+ @retval EFI_SUCCESS Initialization complete.
+ @exception EFI_UNSUPPORTED The chipset is unsupported by this driver.
+ @retval EFI_OUT_OF_RESOURCES Do not have enough resources to initialize the driver.
+ @retval EFI_DEVICE_ERROR Device error, driver exits abnormally.
+**/
+EFI_STATUS
+EFIAPI
+AtEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+
+ DEBUG ((EFI_D_INFO, "ATAM: AtEntryPoint()\n"));
+ ///
+ /// Install the EFI_AT_PROTOCOL interface
+ ///
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &(mAtInstance.Handle),
+ &gEfiAtProtocolGuid,
+ &(mAtInstance.AtProtocol),
+ NULL
+ );
+
+ return Status;
+}
+
+/**
+ This function sends a request to ME AT Services to validate AT
+ recovery credentials. The user input is captured in UTF-16
+ format and then passed to this funtion. This function converts
+ the User recovery password into a HASH by using Salt & Nonce
+ and then send the password HASH to ME AT Services for
+ validation. ME AT Service compares the Password HASH and
+ returns either pass or fail.
+
+ @param[in] This The address of protocol
+ @param[in] PassPhrase Passphrase that needs to be authenticated sent to ME
+ @param[in] PassType Password type user or server generated
+ @param[in][out] IsAuthenticated The return of the password match 1 for success and 0 for fail
+
+ @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary data structures
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+EFIAPI
+AuthenticateCredential (
+ IN EFI_AT_PROTOCOL *This,
+ IN UINT8 *PassPhrase,
+ IN UINT32 *PassType,
+ IN OUT UINT8 *IsAuthenticated
+ )
+{
+ UINT32 HeciLength;
+ EFI_STATUS Status;
+ EFI_HECI_PROTOCOL *mHeci;
+ ATHI_AUTHENTICATE_CREDENTIAL_CMD *AtAuthCmd;
+ ATHI_AUTHENTICATE_CREDENTIAL_RSP AtAuthRsp;
+
+ mHeci = NULL;
+
+ AtAuthCmd = AllocateZeroPool (sizeof (ATHI_AUTHENTICATE_CREDENTIAL_CMD) + AT_PASSWORD_LENGTH);
+ if (AtAuthCmd == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ ZeroMem ((VOID *) &AtAuthRsp, sizeof (ATHI_AUTHENTICATE_CREDENTIAL_RSP));
+
+ DEBUG ((EFI_D_ERROR, "AT::AutheticateCrdential Password Type: %x\n", *PassType));
+
+ AtAuthCmd->Credential.Type = *PassType;
+ AtAuthCmd->Credential.Length = (UINT32) AT_USR_PASS_HASH_LENGTH_MAX;
+ AtAuthCmd->Header.Version.Minor = ATHI_PROTOCOL_VERSION_MINOR;
+ AtAuthCmd->Header.Version.Major = ATHI_PROTOCOL_VERSION_MAJOR;
+ AtAuthCmd->Header.Command.Category = ATHI_CMD_GROUP_RECOVERY;
+ AtAuthCmd->Header.Command.IsResponse = AT_COMMAND;
+ AtAuthCmd->Header.Command.Code = ATHI_RECOVERY_GRP_AUTH_CREDENTIAL_CMD;
+ AtAuthCmd->Header.Length = sizeof (AT_CREDENTIAL) + AT_USR_PASS_HASH_LENGTH_MAX - sizeof (UINT8);
+
+ HeciLength = sizeof (ATHI_AUTHENTICATE_CREDENTIAL_CMD) + AT_USR_PASS_HASH_LENGTH_MAX - sizeof (UINT8);
+
+#ifdef EFI_DEBUG
+ DEBUG ((EFI_D_ERROR, "AT::AutheticateCrdential AtAuthCmd Body 1: \n"));
+ DEBUG_CODE (
+ ShowBuffer ((UINT8 *) AtAuthCmd, HeciLength);
+ );
+#endif
+
+ CopyMem (&AtAuthCmd->Credential.Value, PassPhrase, AT_USR_PASS_HASH_LENGTH_MAX);
+
+#ifdef EFI_DEBUG
+ DEBUG ((EFI_D_ERROR, "AT::AutheticateCrdential AtAuthCmd Body 2: \n"));
+ DEBUG_CODE (
+ ShowBuffer ((UINT8 *) AtAuthCmd, HeciLength);
+ );
+ DEBUG ((EFI_D_ERROR, "AT::AutheticateCrdential PassPhrase Body 3: \n"));
+ DEBUG_CODE (
+ ShowBuffer ((UINT8 *) PassPhrase, AtAuthCmd->Credential.Length);
+ );
+#endif
+ if (mHeci == NULL) {
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &mHeci
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "AutheticateCrdential: Locating for HECI Driver Failed!, Status = %r\n", Status));
+ FreePool (AtAuthCmd);
+ return Status;
+ }
+ }
+
+ DEBUG ((EFI_D_ERROR, "AT::AutheticateCrdential PassPhrase Length: %x\n", AtAuthCmd->Credential.Length));
+ DEBUG ((EFI_D_ERROR, "AT::AutheticateCrdential AtAuthCmd HeciLength: %x\n", HeciLength));
+#ifdef EFI_DEBUG
+ DEBUG ((EFI_D_ERROR, "AT::AutheticateCrdential AtAuthCmd Body 3: \n"));
+ DEBUG_CODE (
+ ShowBuffer ((UINT8 *) AtAuthCmd, HeciLength);
+ );
+#endif
+
+ Status = mHeci->SendMsg (
+ (UINT32 *) AtAuthCmd,
+ HeciLength,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_AT_MESSAGE_ADDR
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "AutheticateCrdential failed to send message over HECI!(SendMsg), Status = %r\n", Status));
+ FreePool (AtAuthCmd);
+ return Status;
+ }
+
+ FreePool (AtAuthCmd);
+
+ HeciLength = sizeof (ATHI_AUTHENTICATE_CREDENTIAL_RSP);
+ Status = mHeci->ReadMsg (
+ BLOCKING,
+ (UINT32 *) &AtAuthRsp,
+ &HeciLength
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "AutheticateCrdential failed to receive message over HECI!(ReadMsg), Status = %r\n", Status));
+ return Status;
+ }
+
+#ifdef EFI_DEBUG
+ DEBUG ((EFI_D_ERROR, "AT::AutheticateCrdential AtAuthCmd Body 4: %x\n", AtAuthCmd));
+ DEBUG_CODE (
+ ShowBuffer ((UINT8 *) AtAuthCmd, HeciLength);
+ );
+#endif
+ DEBUG ((EFI_D_ERROR, "AT::AutheticateCrdential AtAuthRsp HeciLength: %x\n", HeciLength));
+ DEBUG ((EFI_D_ERROR, "AT::AutheticateCrdential AtAuthRsp.CompletionCode: %x\n", AtAuthRsp.CompletionCode));
+ DEBUG ((EFI_D_ERROR,
+ "AT::AutheticateCrdential AtAuthRsp.Header.Command.IsResponse: %x\n", AtAuthRsp.Header.Command.
+ IsResponse));
+ DEBUG ((EFI_D_ERROR, "checkRecoveryPassword AtAuthRsp.Authenticated: %d\n", AtAuthRsp.Authenticated));
+
+ ///
+ /// Assuming 0 is for success
+ ///
+ *IsAuthenticated = AtAuthRsp.Authenticated;
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This API compute the SHA1 hash of the user enterted password
+
+ @param[in] This The address of protocol
+ @param[in] PassPhrase The passphrase for which SHA1 hash to be computed
+ @param[in][out] Hash The return value of the SHA1 hash
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+ComputeHash (
+ IN EFI_AT_PROTOCOL *This,
+ IN UINT8 *PassPhrase,
+ IN OUT UINT8 *Hash
+ )
+{
+
+ UINT32 HeciLength;
+ EFI_STATUS Status;
+
+ ATHI_COMPUTE_HASH_CMD AtComputeHashCmd;
+ ATHI_COMPUTE_HASH_RSP AtComputeHashRsp;
+
+ ZeroMem ((VOID *) &AtComputeHashCmd, sizeof (ATHI_COMPUTE_HASH_CMD));
+ ZeroMem ((VOID *) &AtComputeHashRsp, sizeof (ATHI_COMPUTE_HASH_RSP));
+
+ DEBUG ((EFI_D_ERROR, "AT::AtComputeHashRsp DEBUG in ComputHash\n"));
+
+ AtComputeHashCmd.Header.Version.Minor = ATHI_PROTOCOL_VERSION_MINOR;
+ AtComputeHashCmd.Header.Version.Major = ATHI_PROTOCOL_VERSION_MAJOR;
+ AtComputeHashCmd.Header.Command.Category = ATHI_CMD_GROUP_RECOVERY;
+ AtComputeHashCmd.Header.Command.IsResponse = AT_COMMAND;
+ AtComputeHashCmd.Header.Command.Code = ATHI_RECOVERY_GRP_COMPUTE_HASH_CMD;
+
+ AtComputeHashCmd.Algorithm = AT_HASH_ALGO_ID_SHA1;
+ AtComputeHashCmd.InputLength = (UINT8) AsciiStrLen ((CHAR8 *) PassPhrase);
+
+ //
+ // Check for length
+ //
+ //
+ // 0- Length 0 only header with command is send as message
+ //
+ AtComputeHashCmd.Header.Length = sizeof (ATHI_COMPUTE_HASH_CMD) -
+ 48 -
+ sizeof (ATHI_HEADER) +
+ AtComputeHashCmd.InputLength;
+
+ CopyMem (&AtComputeHashCmd.InputBuffer, PassPhrase, AtComputeHashCmd.InputLength);
+ HeciLength = sizeof (ATHI_COMPUTE_HASH_CMD) - AT_MAX_HASH_OUTPUT_SIZE + AtComputeHashCmd.InputLength;
+
+#ifdef EFI_DEBUG
+ DEBUG ((EFI_D_ERROR, "AT::AtComputeHashCmd message length = %x\n", HeciLength));
+ DEBUG_CODE (
+ ShowBuffer ((UINT8 *) &AtComputeHashCmd, HeciLength);
+ );
+ DEBUG ((EFI_D_ERROR, "AT::Look for UINT8Pass\n"));
+ DEBUG_CODE (
+ ShowBuffer ((UINT8 *) PassPhrase, AtComputeHashCmd.InputLength);
+ );
+#endif
+
+ if (mHeci == NULL) {
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &mHeci
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "AtComputeHash: Locating for HECI Driver Failed!, Status = %r\n", Status));
+ return Status;
+ }
+ }
+
+ Status = mHeci->SendMsg (
+ (UINT32 *) &AtComputeHashCmd,
+ HeciLength,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_AT_MESSAGE_ADDR
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "AtComputeHashCmd failed to send message over HECI!(SendMsg), Status = %r\n", Status));
+ return Status;
+ }
+
+ HeciLength = sizeof (ATHI_COMPUTE_HASH_RSP);
+ Status = mHeci->ReadMsg (
+ BLOCKING,
+ (UINT32 *) &AtComputeHashRsp,
+ &HeciLength
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "AtComputeHashRsp failed to receive message over HECI!(ReadMsg), Status = %r\n", Status));
+ return Status;
+ }
+
+ DEBUG ((EFI_D_ERROR, "AT::AtComputeHashRsp response message length %x\n", HeciLength));
+ DEBUG ((EFI_D_ERROR, "AtComputeHashRsp.CompletionCode = %x\n", AtComputeHashRsp.CompletionCode));
+ DEBUG ((EFI_D_ERROR, "AtComputeHashRsp.OutputLength = %x\n", AtComputeHashRsp.OutputLength));
+
+ if (AtComputeHashRsp.OutputLength != 0) {
+ DEBUG ((EFI_D_ERROR, "AtComputeHashRsp.OutputLength = %x\n", AtComputeHashRsp.OutputLength));
+ }
+
+ CopyMem (Hash, &AtComputeHashRsp.OutputBuffer, AtComputeHashRsp.OutputLength);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This API get the AT Unlock Timer values
+
+ @param[in] This The address of protocol
+ @param[in] Interval The return value of the Unlock Time Interval that was set by AT Server
+ @param[in] TimeLeft The Timeleft in the Unlock Timer
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+GetTimerInfo (
+ IN EFI_AT_PROTOCOL *This,
+ IN OUT UINT32 *Interval,
+ IN OUT UINT32 *TimeLeft
+ )
+{
+
+ UINT32 HeciLength;
+ EFI_STATUS Status;
+
+ ATHI_GET_TIMER_INFO_CMD AtGetTimerInfoCmd;
+ ATHI_GET_TIMER_INFO_RSP AtGetTimerInfoRsp;
+
+ ZeroMem ((VOID *) &AtGetTimerInfoCmd, sizeof (ATHI_GET_TIMER_INFO_CMD));
+ ZeroMem ((VOID *) &AtGetTimerInfoRsp, sizeof (ATHI_GET_TIMER_INFO_RSP));
+
+ AtGetTimerInfoCmd.Header.Version.Minor = ATHI_PROTOCOL_VERSION_MINOR;
+ AtGetTimerInfoCmd.Header.Version.Major = ATHI_PROTOCOL_VERSION_MAJOR;
+ AtGetTimerInfoCmd.Header.Command.Category = ATHI_CMD_GROUP_THEFT_DETECTION;
+ AtGetTimerInfoCmd.Header.Command.IsResponse = AT_COMMAND;
+ AtGetTimerInfoCmd.Header.Command.Code = ATHI_THEFT_DETECT_GRP_GET_TIMER_INFO_CMD;
+ //
+ // 0- Length 0 only header with command is send as message
+ //
+ AtGetTimerInfoCmd.Header.Length = sizeof (ATHI_GET_TIMER_INFO_CMD) - sizeof (ATHI_HEADER);
+ AtGetTimerInfoCmd.TimerId = AT_TID_UNLOCK_TIMER;
+
+ if (mHeci == NULL) {
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &mHeci
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "AtGetTimerInfo: Locating for HECI Driver Failed!, Status = %r\n", Status));
+ return Status;
+ }
+ }
+
+ HeciLength = sizeof (ATHI_GET_TIMER_INFO_CMD);
+
+ Status = mHeci->SendMsg (
+ (UINT32 *) &AtGetTimerInfoCmd,
+ HeciLength,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_AT_MESSAGE_ADDR
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "AtGetTimerInfo failed to send message over HECI!(SendMsg), Status = %r\n", Status));
+ return Status;
+ }
+
+ HeciLength = sizeof (ATHI_GET_TIMER_INFO_RSP);
+
+ DEBUG ((EFI_D_ERROR, "AT::AtGetTimerInfo response message length = %x\n", HeciLength));
+
+ Status = mHeci->ReadMsg (
+ BLOCKING,
+ (UINT32 *) &AtGetTimerInfoRsp,
+ &HeciLength
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "AtGetTimerInfoRsp failed to receive message over HECI!(ReadMsg), Status = %r\n", Status));
+ return Status;
+ }
+
+ DEBUG ((EFI_D_ERROR, "AT::AtGetTimerInfo response message length = %x\n", HeciLength));
+ DEBUG ((EFI_D_ERROR, "AtGetTimerInfoRsp.CompletionCode = %x\n", AtGetTimerInfoRsp.CompletionCode));
+ DEBUG ((EFI_D_ERROR, "AtGetTimerInfoRsp.TimerInfo.Interval = %x\n", AtGetTimerInfoRsp.TimerInfo.Interval));
+ DEBUG ((EFI_D_ERROR, "AtGetTimerInfoRsp.TimerInfo.TimeLeft = %x\n", AtGetTimerInfoRsp.TimerInfo.TimeLeft));
+
+ *Interval = AtGetTimerInfoRsp.TimerInfo.Interval;
+ *TimeLeft = AtGetTimerInfoRsp.TimerInfo.TimeLeft;
+
+ return EFI_SUCCESS;
+
+}
+
+/**
+ This gets the ME nonce
+ @param[in] This The address of protocol
+ @param[in][out] Nonce The return value of the 16 Byte nonce received from ME
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+GetNonce (
+ IN EFI_AT_PROTOCOL *This,
+ IN OUT UINT8 *Nonce
+ )
+{
+
+ UINT32 HeciLength;
+ EFI_STATUS Status;
+
+ ATHI_GET_NONCE_CMD AtGetNonceCmd;
+ ATHI_GET_NONCE_RSP AtGetNonceRsp;
+
+ ZeroMem ((VOID *) &AtGetNonceCmd, sizeof (ATHI_GET_NONCE_CMD));
+ ZeroMem ((VOID *) &AtGetNonceRsp, sizeof (ATHI_GET_NONCE_RSP));
+
+ AtGetNonceCmd.Version.Minor = ATHI_PROTOCOL_VERSION_MINOR;
+ AtGetNonceCmd.Version.Major = ATHI_PROTOCOL_VERSION_MAJOR;
+ AtGetNonceCmd.Command.Category = ATHI_CMD_GROUP_GENERAL;
+ AtGetNonceCmd.Command.IsResponse = AT_COMMAND;
+ AtGetNonceCmd.Command.Code = ATHI_GENERAL_GRP_GET_NONCE_CMD;
+
+ //
+ // 0- Length 0 only header with command is send as message
+ //
+ AtGetNonceCmd.Length = sizeof (ATHI_GET_STATE_CMD) - sizeof (ATHI_HEADER);
+
+ if (mHeci == NULL) {
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &mHeci
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "AtGetNonce: Locating for HECI Driver Failed!, Status = %r\n", Status));
+ return Status;
+ }
+ }
+
+ HeciLength = sizeof (ATHI_GET_NONCE_CMD);
+
+ Status = mHeci->SendMsg (
+ (UINT32 *) &AtGetNonceCmd,
+ HeciLength,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_AT_MESSAGE_ADDR
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "AtGetNonce failed to send message over HECI!(SendMsg), Status = %r\n", Status));
+ return Status;
+ }
+
+ HeciLength = sizeof (ATHI_GET_NONCE_RSP);
+ Status = mHeci->ReadMsg (
+ BLOCKING,
+ (UINT32 *) &AtGetNonceRsp,
+ &HeciLength
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "AtGetNonce failed to receive message over HECI!(ReadMsg), Status = %r\n", Status));
+ return Status;
+ }
+
+#ifdef EFI_DEBUG
+ DEBUG ((EFI_D_ERROR, "AT::AtGetNonce response message length %x\n", HeciLength));
+ DEBUG ((EFI_D_ERROR, "AtGetNonceRsp.CompletionCode = %x\n", AtGetNonceRsp.CompletionCode));
+ DEBUG ((EFI_D_ERROR, "AtGetNonceRsp.Nonce = %x\n", AtGetNonceRsp.Nonce));
+ DEBUG_CODE (
+ ShowBuffer ((UINT8 *) &AtGetNonceRsp.Nonce, AT_NONCE_LENGTH);
+ );
+#endif
+
+ if (AtGetNonceRsp.CompletionCode == ATHI_COMPCODE_SUCCESS) {
+ DEBUG ((EFI_D_ERROR, "AtGetNonceRsp.CompletionCode = %x\n", AtGetNonceRsp.CompletionCode));
+ }
+
+ CopyMem (Nonce, &AtGetNonceRsp.Nonce, AT_NONCE_LENGTH);
+
+ return EFI_SUCCESS;
+
+}
+
+/**
+ This retrives the ISV String stored by AT Server that BIOS will display during Platform lock state
+
+ @param[in] This The address of protocol
+ @param[in] StringId The String buffer ID to retrive the ISV String
+ @param[out] IsvString 256 Bytes of ISV string array, the
+ @param[out] IsvStringLength The String length
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+GetRecoveryString (
+ IN EFI_AT_PROTOCOL *This,
+ IN UINT32 *StringId,
+ OUT UINT8 *IsvString,
+ OUT UINT32 *IsvStringLength
+ )
+{
+
+ UINT32 HeciLength;
+ EFI_STATUS Status;
+ ATHI_GET_VENDOR_STRING_CMD AtIsvStringCmd;
+ ATHI_GET_VENDOR_STRING_RSP AtIsvStringRsp;
+
+ ZeroMem ((VOID *) &AtIsvStringCmd, sizeof (ATHI_GET_VENDOR_STRING_CMD));
+ ZeroMem ((VOID *) &AtIsvStringRsp, sizeof (ATHI_GET_VENDOR_STRING_RSP));
+ //
+ // Setting the length of IsvString to 0 here.
+ //
+ *IsvStringLength = 0;
+
+ AtIsvStringCmd.Header.Version.Minor = ATHI_PROTOCOL_VERSION_MINOR;
+ AtIsvStringCmd.Header.Version.Major = ATHI_PROTOCOL_VERSION_MAJOR;
+ AtIsvStringCmd.Header.Command.Category = ATHI_CMD_GROUP_DATA_STORAGE;
+ AtIsvStringCmd.Header.Command.IsResponse = AT_COMMAND;
+ AtIsvStringCmd.Header.Command.Code = ATHI_DATA_STORE_GRP_GET_VENDOR_STRING_CMD;
+ AtIsvStringCmd.Header.Length = sizeof (ATHI_GET_VENDOR_STRING_CMD) - sizeof (ATHI_HEADER);
+ AtIsvStringCmd.Id = (UINT8) *StringId;
+
+ if (mHeci == NULL) {
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &mHeci
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "AtIsvStringCmd: Locating for HECI Driver Failed!, Status = %r\n", Status));
+ return Status;
+ }
+ }
+
+ HeciLength = sizeof (ATHI_GET_VENDOR_STRING_CMD);
+
+ PERF_START_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x8200);
+ Status = mHeci->SendMsg (
+ (UINT32 *) &AtIsvStringCmd,
+ HeciLength,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_AT_MESSAGE_ADDR
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "AtIsvStringCmd failed to send message over HECI!(SendMsg), Status = %r\n", Status));
+ return Status;
+ }
+
+ HeciLength = sizeof (ATHI_GET_VENDOR_STRING_RSP);
+ Status = mHeci->ReadMsg (
+ BLOCKING,
+ (UINT32 *) &AtIsvStringRsp,
+ &HeciLength
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "AtIsvStringRsp failed to receive message over HECI!(ReadMsg), Status = %r\n", Status));
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x8202);
+ return Status;
+ }
+
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x8201);
+
+#ifdef EFI_DEBUG
+ DEBUG ((EFI_D_ERROR, "AT::AtIsvStringRsp response message length = %x\n", HeciLength));
+ DEBUG ((EFI_D_ERROR, "AtIsvStringRsp.CompletionCode = %x\n", AtIsvStringRsp.CompletionCode));
+ DEBUG ((EFI_D_ERROR, "AtIsvStringRsp.String.Length = %x\n", AtIsvStringRsp.String.Length));
+ DEBUG_CODE (
+ ShowBuffer ((UINT8 *) &AtIsvStringRsp.String.Value, (UINT32) AtIsvStringRsp.String.Length);
+ );
+#endif
+
+ if ((AtIsvStringRsp.CompletionCode == 0) &&
+ (AtIsvStringRsp.String.Length > 0 && AtIsvStringRsp.String.Length < 256)
+ ) {
+
+ CopyMem (IsvString, &AtIsvStringRsp.String.Value, AtIsvStringRsp.String.Length);
+ *IsvStringLength = AtIsvStringRsp.String.Length;
+ return EFI_SUCCESS;
+ }
+
+ return EFIERR (AtIsvStringRsp.CompletionCode);;
+}
+
+/**
+ This send an AssertStolen Message to ME when OEM has set the AllowAssertStolen bit to be accepted by BIOS.
+
+ @param[in] This The address of protocol
+ @param[out] CompletionCode The return ME Firmware return code for this request
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+SendAssertStolen (
+ IN EFI_AT_PROTOCOL *This,
+ OUT UINT8 *CompletionCode
+ )
+{
+
+ UINT32 HeciLength;
+ EFI_STATUS Status;
+ ATHI_ASSERT_STOLEN_CMD AtAssertStolenCmd;
+ ATHI_ASSERT_STOLEN_RSP AtAssertStolenRsp;
+
+ //
+ // Initialize Variables
+ //
+ ZeroMem ((VOID *) &AtAssertStolenCmd, sizeof (ATHI_ASSERT_STOLEN_CMD));
+ ZeroMem ((VOID *) &AtAssertStolenRsp, sizeof (ATHI_ASSERT_STOLEN_RSP));
+
+ ///
+ /// Populate AtAssertStolenCmd
+ ///
+ AtAssertStolenCmd.Header.Version.Minor = ATHI_PROTOCOL_VERSION_MINOR;
+ AtAssertStolenCmd.Header.Version.Major = ATHI_PROTOCOL_VERSION_MAJOR;
+ AtAssertStolenCmd.Header.Command.Category = ATHI_CMD_GROUP_THEFT_DETECTION;
+ AtAssertStolenCmd.Header.Command.IsResponse = AT_COMMAND;
+ AtAssertStolenCmd.Header.Command.Code = ATHI_THEFT_DETECT_GRP_UNSIGNED_ASSERT_STOLEN_CMD;
+ AtAssertStolenCmd.Header.Length = sizeof (ATHI_ASSERT_STOLEN_CMD) - sizeof (ATHI_HEADER);
+
+ if (mHeci == NULL) {
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &mHeci
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "SendAssertStolen: Locating for HECI Driver Failed!, Status = %r\n", Status));
+ return Status;
+ }
+ }
+
+ ///
+ /// Send AtAssertStolenCmd Request
+ ///
+ HeciLength = sizeof (ATHI_ASSERT_STOLEN_CMD);
+
+ Status = mHeci->SendMsg (
+ (UINT32 *) &AtAssertStolenCmd,
+ HeciLength,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_AT_MESSAGE_ADDR
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "AtAssertStolenCmd failed to send message over HECI!(SendMsg), Status = %r\n", Status));
+ return Status;
+ }
+ ///
+ /// Receive AtAssertStolenCmd Response
+ ///
+ HeciLength = sizeof (ATHI_ASSERT_STOLEN_RSP);
+ Status = mHeci->ReadMsg (
+ BLOCKING,
+ (UINT32 *) &AtAssertStolenRsp,
+ &HeciLength
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "AtAssertStolenRsp failed to receive message over HECI!(ReadMsg), Status = %r\n", Status));
+ return Status;
+ }
+
+ DEBUG ((EFI_D_ERROR, "ATAM: AtAssertStolen response message length %x\n", HeciLength));
+ DEBUG ((EFI_D_ERROR, "ATAM: AtAssertStolenRsp.CompletionCode = %x\n", AtAssertStolenRsp.CompletionCode));
+
+ *CompletionCode = AtAssertStolenRsp.CompletionCode;
+
+ return EFI_SUCCESS;
+
+}
+
+/**
+ This receives the ISV ID from ME and display the ID, when the platform is in stolen state
+
+ @param[in] This The address of protocol
+ @param[out] IsvId The pointer to 4 byte ISV ID
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+GetIsvId (
+ IN EFI_AT_PROTOCOL *This,
+ OUT UINT32 *IsvId
+ )
+{
+
+ UINT32 HeciLength;
+ EFI_STATUS Status;
+
+ ATHI_GET_ISVID_CMD AtGetIsvIdCmd;
+ ATHI_GET_ISVID_RSP AtGetIsvIdRsp;
+
+ ZeroMem ((VOID *) &AtGetIsvIdCmd, sizeof (ATHI_GET_ISVID_CMD));
+ ZeroMem ((VOID *) &AtGetIsvIdRsp, sizeof (ATHI_GET_ISVID_RSP));
+
+ AtGetIsvIdCmd.Version.Minor = ATHI_PROTOCOL_VERSION_MINOR;
+ AtGetIsvIdCmd.Version.Major = ATHI_PROTOCOL_VERSION_MAJOR;
+ AtGetIsvIdCmd.Command.Category = ATHI_CMD_GROUP_RECOVERY;
+ AtGetIsvIdCmd.Command.IsResponse = AT_COMMAND;
+ AtGetIsvIdCmd.Command.Code = ATHI_RECOVERY_GRP_GET_ISVID_CMD;
+ AtGetIsvIdCmd.Length = sizeof (ATHI_GET_ISVID_CMD) - sizeof (ATHI_HEADER);
+
+ if (mHeci == NULL) {
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &mHeci
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "GetIsvId: Locating for HECI Driver Failed!, Status = %r\n", Status));
+ return Status;
+ }
+ }
+
+ HeciLength = sizeof (ATHI_GET_ISVID_CMD);
+
+ Status = mHeci->SendMsg (
+ (UINT32 *) &AtGetIsvIdCmd,
+ HeciLength,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_AT_MESSAGE_ADDR
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "GetIsvId failed to send message over HECI!(SendMsg), Status = %r\n", Status));
+ return Status;
+ }
+
+ HeciLength = sizeof (ATHI_GET_ISVID_RSP);
+ Status = mHeci->ReadMsg (
+ BLOCKING,
+ (UINT32 *) &AtGetIsvIdRsp,
+ &HeciLength
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "GetIsvId failed to receive message over HECI!(ReadMsg), Status = %r\n", Status));
+ return Status;
+ }
+
+ DEBUG ((EFI_D_ERROR, "AT::AtGetIsvIdRsp response message length = %x\n", HeciLength));
+ DEBUG ((EFI_D_ERROR, "AtGetIsvIdRsp.CompletionCode = %x\n", AtGetIsvIdRsp.CompletionCode));
+ DEBUG ((EFI_D_ERROR, "AtGetIsvIdRsp.IsvId = %x\n", AtGetIsvIdRsp.IsvId));
+
+ if (!AtGetIsvIdRsp.CompletionCode) {
+ *IsvId = AtGetIsvIdRsp.IsvId;
+ }
+
+ return EFI_SUCCESS;
+
+}
+
+/**
+ This requests FW to enter or exit Suspend mode based on user input
+
+ @param[in] This The address of protocol
+ @param[in] TransitionState 0: Exit Suspend Mode
+ 1: Enter Suspend Mode
+ @param[in] Token SSTK generated Token
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary data structures.
+**/
+EFI_STATUS
+EFIAPI
+SetSuspendState (
+ IN EFI_AT_PROTOCOL *This,
+ IN UINT32 TransitionState,
+ IN UINT8 *Token
+ )
+{
+ UINT32 HeciLength;
+ EFI_STATUS Status;
+ EFI_HECI_PROTOCOL *Heci;
+
+ ATHI_SET_SUSPEND_STATE_CMD *AtSetSuspendStateCmd;
+ ATHI_SET_SUSPEND_STATE_RSP AtSetSuspendStateRsp;
+
+ AtSetSuspendStateCmd = AllocateZeroPool (sizeof (ATHI_SET_SUSPEND_STATE_CMD) + AT_USR_PASS_HASH_LENGTH_MAX);
+ if (AtSetSuspendStateCmd == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ ZeroMem ((VOID *) &AtSetSuspendStateRsp, sizeof (ATHI_SET_SUSPEND_STATE_RSP));
+
+ AtSetSuspendStateCmd->Header.Version.Minor = ATHI_PROTOCOL_VERSION_MINOR;
+ AtSetSuspendStateCmd->Header.Version.Major = ATHI_PROTOCOL_VERSION_MAJOR;
+ AtSetSuspendStateCmd->Header.Command.Category = ATHI_CMD_GROUP_GENERAL;
+ AtSetSuspendStateCmd->Header.Command.IsResponse = AT_COMMAND;
+ AtSetSuspendStateCmd->Header.Command.Code = ATHI_GENERAL_GRP_SET_SUSPEND_CMD;
+ AtSetSuspendStateCmd->TransitionState = TransitionState;
+
+ //
+ // AT_CREDENTIAL has extra UINT8 (can't have zero length array like FW) that must be subtracted
+ //
+ AtSetSuspendStateCmd->Header.Length = (sizeof (ATHI_SET_SUSPEND_STATE_CMD) - sizeof (UINT8)) - (sizeof (ATHI_HEADER)) + AT_USR_PASS_HASH_LENGTH_MAX;
+ AtSetSuspendStateCmd->Credential.Type = AT_CREDENTIAL_TYPE_SSTK;
+ AtSetSuspendStateCmd->Credential.Length = AT_USR_PASS_HASH_LENGTH_MAX;
+ CopyMem (AtSetSuspendStateCmd->Credential.Value, Token, AT_USR_PASS_HASH_LENGTH_MAX);
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "SetSuspendState: Locating for HECI Driver Failed!, Status = %r\n", Status));
+ FreePool (AtSetSuspendStateCmd);
+ return Status;
+ }
+
+ HeciLength = sizeof (ATHI_SET_SUSPEND_STATE_CMD) - sizeof (UINT8) + AT_USR_PASS_HASH_LENGTH_MAX;
+
+ Status = Heci->SendMsg (
+ (UINT32 *) AtSetSuspendStateCmd,
+ HeciLength,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_AT_MESSAGE_ADDR
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "SetSuspendState failed to send message over HECI!(SendMsg), Status = %r\n", Status));
+ FreePool (AtSetSuspendStateCmd);
+ return Status;
+ }
+
+ FreePool (AtSetSuspendStateCmd);
+
+ HeciLength = sizeof (ATHI_SET_SUSPEND_STATE_RSP);
+ Status = Heci->ReadMsg (
+ BLOCKING,
+ (UINT32 *) &AtSetSuspendStateRsp,
+ &HeciLength
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "SetSuspendState failed to receive message over HECI!(ReadMsg), Status = %r\n", Status));
+ return Status;
+ }
+
+ DEBUG ((EFI_D_ERROR, "AT::SetSuspendState response message length %x\n", HeciLength));
+ DEBUG ((EFI_D_ERROR, "AtSetSuspendStateRsp.CompletionCode = %x\n", AtSetSuspendStateRsp.CompletionCode));
+
+ if (AtSetSuspendStateRsp.CompletionCode) {
+ return EFIERR (AtSetSuspendStateRsp.CompletionCode);
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This instructs FW that a WWAN recovery is desired and thus the Radio needs to be initialized.
+
+ This command in not supported.
+
+ @param[in] This The address of protocol
+**/
+EFI_STATUS
+InitWWANREcov (
+ IN EFI_AT_PROTOCOL *This
+ )
+{
+ ///
+ /// This command in not supported.
+ ///
+ return EFI_UNSUPPORTED;
+}
+
+/**
+ This queries FW of the NIC Radio Status
+
+ This command in not supported.
+
+ @param[in] This The address of protocol
+ @param[in] RadioStatus Radio status
+ @param[in] NetworkStatus Network status
+**/
+EFI_STATUS
+GetWWANNicStatus (
+ IN EFI_AT_PROTOCOL *This,
+ IN OUT UINT8 *RadioStatus,
+ IN OUT UINT8 *NetworkStatus
+ )
+{
+ ///
+ /// This command in not supported.
+ ///
+ return EFI_UNSUPPORTED;
+}
+
+/**
+ This queries FW of the AT Status in Unsigned mode
+
+ @param[in] This The address of protocol
+ @param[out] StateUnsigned Structure retrieved from ME describing current AT state
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+GetStateUnsigned (
+ IN EFI_AT_PROTOCOL *This,
+ OUT AT_STATE_INFO *StateUnsigned
+ )
+{
+ UINT32 HeciLength;
+ EFI_STATUS Status;
+
+ ATHI_GET_STATE_CMD AtGetStateCmd;
+ ATHI_GET_STATE_RSP AtGetStateRsp;
+
+ ZeroMem ((VOID *) &AtGetStateCmd, sizeof (ATHI_GET_STATE_CMD));
+ ZeroMem ((VOID *) &AtGetStateRsp, sizeof (ATHI_GET_STATE_RSP));
+
+ AtGetStateCmd.Version.Major = ATHI_PROTOCOL_VERSION_MAJOR;
+ AtGetStateCmd.Version.Minor = ATHI_PROTOCOL_VERSION_MINOR;
+ AtGetStateCmd.Command.Code = ATHI_THEFT_DETECT_GRP_GET_STATE_UNSIGNED;
+ AtGetStateCmd.Command.Category = ATHI_CMD_GROUP_THEFT_DETECTION;
+ AtGetStateCmd.Command.IsResponse = AT_COMMAND;
+ AtGetStateCmd.Length = sizeof (ATHI_GET_STATE_CMD) - sizeof (ATHI_HEADER);
+
+ if (mHeci == NULL) {
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &mHeci
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "AtGetStateUnsigned: Locating HECI Protocol failed!, Status = %r\n", Status));
+ return Status;
+ }
+ }
+
+ HeciLength = sizeof (ATHI_GET_STATE_CMD);
+
+ Status = mHeci->SendMsg (
+ (UINT32 *) &AtGetStateCmd,
+ HeciLength,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_AT_MESSAGE_ADDR
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "AtGetStateUnsigned failed to send message over HECI!(SendMsg), Status = %r\n", Status));
+ return Status;
+ }
+
+ HeciLength = sizeof (ATHI_GET_STATE_RSP);
+ Status = mHeci->ReadMsg (
+ BLOCKING,
+ (UINT32 *) &AtGetStateRsp,
+ &HeciLength
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "AtGetStateUnsigned failed to receive message over HECI!(ReadMsg), Status = %r\n", Status));
+ return Status;
+ }
+
+ if (AtGetStateRsp.CompletionCode == ATHI_COMPCODE_SUCCESS) {
+ DEBUG ((EFI_D_ERROR, "AtGetStateRsp.CompletionCode = %x\n", AtGetStateRsp.CompletionCode));
+ CopyMem (StateUnsigned, &(AtGetStateRsp.StateInfo), sizeof (AT_STATE_INFO));
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/ME/At/AtAm/Dxe/At.h b/ReferenceCode/ME/At/AtAm/Dxe/At.h
new file mode 100644
index 0000000..cc19c9d
--- /dev/null
+++ b/ReferenceCode/ME/At/AtAm/Dxe/At.h
@@ -0,0 +1,280 @@
+/** @file
+ Defines and prototypes for the AT driver.
+ This driver implements the AT protocol.
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights
+ reserved This software and associated documentation (if any)
+ is furnished under a license and may only be used or copied in
+ accordance with the terms of the license. Except as permitted
+ by such license, no part of this software or documentation may
+ be reproduced, stored in a retrieval system, or transmitted in
+ any form or by any means without the express written consent
+ of Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#ifndef _AT_H_
+#define _AT_H_
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "AtHi.h"
+#include "MeLib.h"
+#include "AtAmHelper.h"
+#endif
+
+//
+// Used during initialization
+//
+#include EFI_PROTOCOL_CONSUMER (FirmwareVolume)
+#include EFI_PROTOCOL_CONSUMER (HECI)
+
+//
+// Driver Produced Protocols
+//
+#include EFI_PROTOCOL_PRODUCER (At)
+
+//
+// extern EFI_GUID gDxePlatformAtGuid;
+//
+#define AT_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('A', 'T', 'D', 'R')
+
+#pragma pack(1)
+///
+/// MKHI host message header. This header is part of HECI message sent from MEBx via
+/// Host Configuration Interface (HCI). ME Configuration Manager or Power Configuration
+/// Manager also include this header with appropriate fields set as part of the
+/// response message to the HCI.
+///
+typedef struct {
+ UINTN Signature;
+ EFI_HANDLE Handle;
+ EFI_AT_PROTOCOL AtProtocol;
+
+} AT_INSTANCE;
+
+#define AT_INSTANCE_FROM_AT_PROTOCOL(a) CR (a, AT_INSTANCE, At, AT_PRIVATE_DATA_SIGNATURE)
+
+#pragma pack()
+
+/**
+ Entry point for the AT Driver.
+
+ @param[in] ImageHandle Image handle of this driver.
+ @param[in] SystemTable Global system service table.
+
+ @retval EFI_SUCCESS Initialization complete.
+ @exception EFI_UNSUPPORTED The chipset is unsupported by this driver.
+ @retval EFI_OUT_OF_RESOURCES Do not have enough resources to initialize the driver.
+ @retval EFI_DEVICE_ERROR Device error, driver exits abnormally.
+**/
+EFI_STATUS
+EFIAPI
+AtEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+;
+
+/**
+ This function sends a request to ME AT Services to validate AT
+ recovery credentials. The user input is captured in UTF-16
+ format and then passed to this funtion. This function converts
+ the User recovery password into a HASH by using Salt & Nonce
+ and then send the password HASH to ME AT Services for
+ validation. ME AT Service compares the Password HASH and
+ returns either pass or fail.
+
+ @param[in] This The address of protocol
+ @param[in] PassPhrase Passphrase that needs to be authenticated sent to ME
+ @param[in] PassType Password type user or server generated
+ @param[in][out] IsAuthenticated The return of the password match 1 for success and 0 for fail
+
+ @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary data structures
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+EFIAPI
+AuthenticateCredential (
+ IN EFI_AT_PROTOCOL *This,
+ IN UINT8 *PassPhrase,
+ IN UINT32 *PassType,
+ IN OUT UINT8 *IsAuthenticated
+ )
+;
+
+/**
+ This API compute the SHA1 hash of the user enterted password
+
+ @param[in] This The address of protocol
+ @param[in] PassPhrase The passphrase for which SHA1 hash to be computed
+ @param[in][out] Hash The return value of the SHA1 hash
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+ComputeHash (
+ IN EFI_AT_PROTOCOL *This,
+ IN UINT8 *PassPhrase,
+ IN OUT UINT8 *Hash
+ )
+;
+
+/**
+ This API get the AT Unlock Timer values
+
+ @param[in] This The address of protocol
+ @param[in] Interval The return value of the Unlock Time Interval that was set by AT Server
+ @param[in] TimeLeft The Timeleft in the Unlock Timer
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+GetTimerInfo (
+ IN EFI_AT_PROTOCOL *This,
+ IN OUT UINT32 *Interval,
+ IN OUT UINT32 *TimeLeft
+ )
+;
+
+/**
+ This gets the ME nonce
+ @param[in] This The address of protocol
+ @param[in][out] Nonce The return value of the 16 Byte nonce received from ME
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+GetNonce (
+ IN EFI_AT_PROTOCOL *This,
+ IN OUT UINT8 *Nonce
+ )
+;
+
+/**
+ This retrives the ISV String stored by AT Server that BIOS will display during Platform lock state
+
+ @param[in] This The address of protocol
+ @param[in] StringId The String buffer ID to retrive the ISV String
+ @param[out] IsvString 256 Bytes of ISV string array, the
+ @param[out] IsvStringLength The String length
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+GetRecoveryString (
+ IN EFI_AT_PROTOCOL *This,
+ IN UINT32 *StringId,
+ OUT UINT8 *IsvString,
+ OUT UINT32 *IsvStringLength
+ )
+;
+
+/**
+ This send an AssertStolen Message to ME when OEM has set the AllowAssertStolen bit to be accepted by BIOS.
+
+ @param[in] This The address of protocol
+ @param[out] CompletionCode The return ME Firmware return code for this request
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+SendAssertStolen (
+ IN EFI_AT_PROTOCOL *This,
+ OUT UINT8 *CompletionCode
+ )
+;
+
+/**
+ This receives the ISV ID from ME and display the ID, when the platform is in stolen state
+
+ @param[in] This The address of protocol
+ @param[out] IsvId The pointer to 4 byte ISV ID
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+GetIsvId (
+ IN EFI_AT_PROTOCOL *This,
+ OUT UINT32 *IsvId
+ )
+;
+
+/**
+ This requests FW to enter or exit Suspend mode based on user input
+
+ @param[in] This The address of protocol
+ @param[in] TransitionState 0: Exit Suspend Mode
+ 1: Enter Suspend Mode
+ @param[in] Token SRTK generated Token
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary data structures.
+**/
+EFI_STATUS
+EFIAPI
+SetSuspendState (
+ IN EFI_AT_PROTOCOL *This,
+ IN UINT32 TransitionState,
+ IN UINT8 *Token
+ )
+;
+
+/**
+ This instructs FW that a WWAN recovery is desired and thus the Radio needs to be initialized.
+
+ This command in not supported.
+
+ @param[in] This The address of protocol
+**/
+EFI_STATUS
+InitWWANREcov (
+ IN EFI_AT_PROTOCOL *This
+ )
+;
+
+/**
+ This queries FW of the NIC Radio Status
+
+ This command in not supported.
+
+ @param[in] This The address of protocol
+ @param[in] RadioStatus Radio status
+ @param[in] NetworkStatus Network status
+**/
+EFI_STATUS
+GetWWANNicStatus (
+ IN EFI_AT_PROTOCOL *This,
+ IN OUT UINT8 *RadioStatus,
+ IN OUT UINT8 *NetworkStatus
+ )
+;
+
+/**
+ This queries FW of the AT Status in Unsigned mode
+
+ @param[in] This The address of protocol
+ @param[out] StateUnsigned Structure retrieved from ME describing current AT state
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+GetStateUnsigned (
+ IN EFI_AT_PROTOCOL *This,
+ OUT AT_STATE_INFO *StateUnsigned
+ )
+;
+
+#endif
diff --git a/ReferenceCode/ME/At/AtAm/Dxe/AtAm.c b/ReferenceCode/ME/At/AtAm/Dxe/AtAm.c
new file mode 100644
index 0000000..4be107f
--- /dev/null
+++ b/ReferenceCode/ME/At/AtAm/Dxe/AtAm.c
@@ -0,0 +1,694 @@
+/** @file
+ This file contines routines responsible for hangling AT and provide interface for creating UI.
+
+@copyright
+ Copyright (c) 2013 Intel Corporation. All rights
+ reserved This software and associated documentation (if any)
+ is furnished under a license and may only be used or copied in
+ accordance with the terms of the license. Except as permitted
+ by such license, no part of this software or documentation may
+ be reproduced, stored in a retrieval system, or transmitted in
+ any form or by any means without the express written consent
+ of Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "AtAm.h"
+
+DXE_AT_POLICY_PROTOCOL *mDxePlatformAtPolicy;
+static AT_BIOS_RECOVERY_CONFIG gBiosRecoveryGlobalVar;
+static AT_STATE_INFO gAtStateGlobalVar;
+static UINT16 gRecoveryAMGlobalVar;
+static BOOLEAN gAtAmPrefUpdatedToATAM = FALSE;
+
+EFI_GUID gEfiPBAVariableGuid = PBA_FAILED_COUNT_VARIABLE_GUID;
+EFI_GUID gEfiAtAmProtocolGuid = EFI_ATAM_PROTOCOL_GUID;
+
+extern AT_INSTANCE mAtInstance;
+
+ATAM_INSTANCE AtAmInstance = {
+ ATAM_PRIVATE_DATA_SIGNATURE,
+ NULL,
+ {
+ (UINT8) ATAM_PROTOCOL_REVISION,
+ (EFI_ATAM_GET_ISV_ID) AtAmGetIsvId,
+ (EFI_ATAM_GET_RECOVERY_CONFIG) AtAmGetRecoveryConfig,
+ (EFI_ATAM_GET_TIMER) AtAmGetTimer,
+ (EFI_ATAM_GET_NONCE) AtAmGetNonce,
+ (EFI_ATAM_VERIFY_PASSWORD) AtAmVerifyPassword,
+ (EFI_ATAM_SET_SUSPEND_STATE) AtAmSetSuspendState,
+ (EFI_ATAM_GET_AT_STATE_INFO) AtAmGetAtStateInfo,
+ (EFI_ATAM_GET_PBA_COUNTER) AtAmGetPbaCounter
+ }
+};
+
+/**
+ Driver entry point.
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+AtAmEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ UINT32 MeStatus;
+ EFI_HECI_PROTOCOL *Heci;
+ UINT8 AtState;
+ UINT16 AtAmPref;
+ DXE_MBP_DATA_PROTOCOL *MbpData;
+
+
+ MeStatus = 0;
+ AtState = 0;
+ AtAmPref = 0;
+
+ ///
+ ///Install AT protocol
+ ///
+ Status = AtEntryPoint(0, 0);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "ATAM: AT Protocol isn't installed, Status = %r\n", Status));
+ return Status;
+ }
+
+ Status = gBS->LocateProtocol (
+ &gDxePlatformAtPolicyGuid,
+ NULL,
+ (VOID **) &mDxePlatformAtPolicy
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "ATAM: No AT Platform Policy Protocol available"));
+ return Status;
+ }
+ ASSERT_EFI_ERROR (Status);
+
+#ifdef EFI_DEBUG
+ ///
+ /// Dump the AT platform policy
+ ///
+ DxeAtPolicyDebugDump ();
+#endif
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "ATAM: failed to locate HECI driver, Status = %r\n", Status));
+ return Status;
+ }
+
+ Status = Heci->GetMeStatus (&MeStatus);
+ ASSERT_EFI_ERROR (Status);
+
+ if (mDxePlatformAtPolicy->At.AtAmBypass == 0) {
+
+ ///
+ /// Check if ME is Normal State or Recovery Mode
+ ///
+ if (ME_STATUS_ME_STATE_ONLY (MeStatus) == ME_READY ||
+ ME_STATUS_ME_STATE_ONLY (MeStatus) == ME_IN_RECOVERY_MODE ||
+ ME_STATUS_ME_STATE_ONLY (MeStatus) == ME_FW_UPDATES_IN_PROGRESS) {
+ ///
+ /// Get the MBP Data.
+ ///
+ Status = gBS->LocateProtocol (&gMeBiosPayloadDataProtocolGuid, NULL, (VOID **) &MbpData);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "ATAM: No MBP Data Protocol available - Exit Early"));
+ return EFI_SUCCESS;
+ }
+
+ if (!MbpData->MeBiosPayload.FwCapsSku.FwCapabilities.Fields.IntelAT) {
+ DEBUG ((EFI_D_INFO, "ATAM: Exit Early - MEFWCAPS_SKU_RULE_ID indicates AT does not exist"));
+ return EFI_SUCCESS;
+ } else {
+ DEBUG ((EFI_D_INFO, "ATAM: ME FW SKU Info Variables indicates that AT exists"));
+ }
+
+ DEBUG ((EFI_D_INFO, "ATAM::GetMeStatus is ME_READY\n", Status));
+
+ Status = GetAtStateInfo (
+ &gAtStateGlobalVar
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "ATAM::GetAtStateInfo failed, Status = %r\n", Status));
+ return Status;
+ }
+
+ ///
+ /// Update Static Variable
+ ///
+ gRecoveryAMGlobalVar = gAtStateGlobalVar.flags.AuthenticateModule;
+
+ DEBUG ((EFI_D_INFO, "ATAM: MeAtRuleDate AtState = %x\n", gAtStateGlobalVar.State));
+ DEBUG ((EFI_D_INFO, "ATAM: MeAtRuleDate AtAmPref = %x\n", gAtStateGlobalVar.flags.AuthenticateModule));
+
+ ///
+ /// Check for PBA_ERROR_THRESHOLDS Level .... i.e. if PBA fails for x number of times then BIOS AM will
+ /// Ignore the PREFERRED_AM Selection
+ ///
+ AtAmPref = gAtStateGlobalVar.flags.AuthenticateModule;
+ AtState = gAtStateGlobalVar.State;
+
+ Status = AtAmValidatePreferredAM (&AtState, &AtAmPref);
+ DEBUG ((EFI_D_INFO, "ATAM: ValidatePreferredAM, AtAmPref = %d\n", AtAmPref));
+
+ ///
+ /// Ignore the PREFERRED_AM Selection
+ ///
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_INFO, "ATAM: ValidatePreferredAM failed, Status = %r\n", Status));
+ }
+ } else {
+ DEBUG ((EFI_D_INFO, "ATAM: ME_READY Failed\n"));
+ Status = EFI_DEVICE_ERROR;
+ }
+ } else {
+ DEBUG ((EFI_D_INFO, "ATAM: AT Disabled in the BIOS\n"));
+
+ Status = GetAtStateInfo (
+ &gAtStateGlobalVar
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "ATAM::GetAtStateInfo failed, Status = %r\n", Status));
+ return Status;
+ }
+ }
+
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &(AtAmInstance.Handle),
+ &gEfiAtAmProtocolGuid,
+ &(AtAmInstance.AtAmProtocol),
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "ATAM: ATAM Protocol NOT Installed, Status = %r\n", Status));
+ } else {
+ DEBUG ((EFI_D_ERROR, "ATAM: ATAM Protocol Installed, Status = %r\n", Status));
+ }
+
+ return Status;
+}
+
+/**
+ This function gets the ISV Strings stored by AT Server that BIOS will display.
+
+ @param[in] This The address of protocol
+ @param[out] IsvString Isv string pointer
+ @param[out] IsvId Intel(R) Anti-Theft service provider Id
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+AtAmGetIsvId (
+ IN EFI_AT_PROTOCOL *This,
+ OUT UINT8 *IsvString,
+ OUT UINT32 *IsvId
+ )
+{
+ EFI_STATUS Status;
+ UINT32 StringLength;
+ UINT32 StringId;
+
+ StringLength = 0;
+
+ Status = mAtInstance.AtProtocol.GetIsvId (&mAtInstance.AtProtocol, IsvId);
+ if (EFI_ERROR (Status)) {
+ ///
+ /// Let it continue even if the error ....
+ ///
+ DEBUG ((EFI_D_ERROR, "ATAM: GetIsvId failed, Status = %r\n", Status));
+ } else {
+ DEBUG ((EFI_D_ERROR, "ATAM: GetIsvId IsvId = %r\n", *IsvId));
+ }
+
+ StringId = AT_VENDOR_STRING_ID_RECOVERY_HELP;
+ Status = mAtInstance.AtProtocol.GetRecoveryString (&mAtInstance.AtProtocol, &StringId, IsvString, &StringLength);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "ATAM: GetRecoveryString AT_VENDOR_STRING_ID_RECOVERY_HELP failed, Status = %r\n", Status));
+ ///
+ /// Let it continue even if the error
+ ///
+ }
+
+ return Status;
+}
+
+/**
+ This function returns time left to enter password.
+
+ @param[in] This The address of protocol
+ @param[out] TimeLeft Time
+ @param[out] TimeInterval Time interval
+
+ @retval EFI_SUCCESS The function completed
+ successfully.
+**/
+EFI_STATUS
+AtAmGetTimer (
+ IN EFI_AT_PROTOCOL *This,
+ OUT UINT32 *TimeLeft,
+ OUT UINT32 *TimeInterval
+ )
+{
+ EFI_STATUS Status;
+
+ Status = mAtInstance.AtProtocol.GetTimerInfo (&mAtInstance.AtProtocol, TimeInterval, TimeLeft);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "ATAM: GetTimerInfo failed, Status = %r\n", Status));
+ }
+
+ return Status;
+}
+
+/**
+ This function gets 16 bytes nonce from firmware and also converts it to string according to format "XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XX".
+
+ @param[in] This The address of protocol
+ @param[out] NonceStr Pointer to Nonce string
+
+ @retval EFI_SUCCESS The function completed
+ successfully.
+**/
+EFI_STATUS
+AtAmGetNonce (
+ IN EFI_AT_PROTOCOL *This,
+ OUT UINT8 *NonceStr
+ )
+{
+ EFI_STATUS Status;
+ UINTN StrNonceLength;
+ UINT8 Nonce[NONCE_LENGTH];
+ CHAR16 *UniCodeNonceStr;
+
+ StrNonceLength = STR_NONCE_LENGTH;
+
+ UniCodeNonceStr = AllocateZeroPool ((STR_NONCE_LENGTH + 1) * sizeof (CHAR16));
+ if (UniCodeNonceStr == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Status = mAtInstance.AtProtocol.GetNonce (&mAtInstance.AtProtocol, Nonce);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "ATAM: GetSuspendAuthentication::GetNonce failed, Status = %r\n", Status));
+ return Status;
+ }
+
+ Base32Encode (NonceStr, &StrNonceLength, Nonce, NONCE_LENGTH);
+ Uint8ToUnicode ((CHAR8 *) NonceStr, UniCodeNonceStr);
+
+ FreePool (UniCodeNonceStr);
+
+ return Status;
+}
+
+/**
+ This function gets recovery config.
+
+ @param[in] This The address of protocol
+ @param[out] RecoveryConfig Pointer to structure
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+AtAmGetRecoveryConfig (
+ IN EFI_AT_PROTOCOL *This,
+ OUT AT_BIOS_RECOVERY_CONFIG *RecoveryConfig
+ )
+{
+ EFI_STATUS Status;
+ UINT32 StringId;
+ UINT32 StringLength;
+
+ StringLength = 0;
+
+ StringId = AT_CUSTOM_RECOVERY_ID_CONFIGURATIONS;
+ Status = mAtInstance.AtProtocol.GetRecoveryString (&mAtInstance.AtProtocol, &StringId, (UINT8 *) RecoveryConfig, &StringLength);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "ATAM: GetRecoveryString failed, Status = %r\n", Status));
+ ///
+ /// Let it continue even if the error
+ ///
+ } else {
+ DEBUG ((EFI_D_ERROR, "ATAM: GetRecoveryString StringLength = %d\n", StringLength));
+ DEBUG ((EFI_D_ERROR, "ATAM: GetRecoveryString *IsvString = %d\n", *RecoveryConfig));
+ DEBUG ((EFI_D_ERROR, "ATAM: GetRecoveryString StringId = %d\n", StringId));
+ }
+
+ return Status;
+}
+
+/**
+ This routine receives the data (passphrase or SRTK) from UI and verifies it if the password (either passphrase or SRTK) is acceptable.
+
+ @param[in] This The address of protocol
+ @param[in] PasswordEntered Pointer to string
+ @param[in] PassType Password type
+ @param[out] IsAuthenticated Pointer to result of verification
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+AtAmVerifyPassword (
+ IN EFI_AT_PROTOCOL *This,
+ IN UINT8 *PasswordEntered,
+ IN UINT32 PassType,
+ OUT UINT8 *IsAuthenticated
+ )
+{
+ EFI_STATUS Status;
+ UINT8 *Hash;
+ UINT8 *PasswordHex;
+ UINT8 AtState;
+ UINT16 AtAmPref;
+ UINT8 IsAuthTmp = 0;
+
+ Status = EFI_SUCCESS;
+
+ PasswordHex = AllocateZeroPool ((ATAM_SETUP_PASSWORD_LENGTH + 1) * sizeof (UINT8));
+ Hash = AllocateZeroPool ((ATAM_SETUP_PASSWORD_LENGTH + 1) * sizeof (UINT8));
+ if (Hash == NULL || PasswordHex == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ if (PassType == AT_CREDENTIAL_TYPE_USER_PASSPHRASE) {
+
+ Status = mAtInstance.AtProtocol.ComputeHash (&mAtInstance.AtProtocol, PasswordEntered, Hash);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "ATAM: ComputeHash failed, Status = %r\n", Status));
+ }
+
+ Status = mAtInstance.AtProtocol.AuthenticateCredential (&mAtInstance.AtProtocol, Hash, &PassType, &IsAuthTmp);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "ATAM: AuthenticateCredential, Status = %r\n", Status));
+ }
+
+ } else if (PassType == AT_CREDENTIAL_TYPE_SRTK) {
+ ///
+ /// User selected Base32 based Server based recovery, for BASE32 the length is always 32
+ ///
+ if (AsciiStrLen((CHAR8 *) PasswordEntered) == 32) {
+ DEBUG ((EFI_D_ERROR, "ATAM: Password entered is SRTK BASE32 PASSWORD\n"));
+ ///
+ /// Decoded value is 20 byte hex
+ ///
+ Base32Decode (PasswordEntered, PasswordHex);
+ } else if (AsciiStrLen((CHAR8 *) PasswordEntered) > 40) {
+ ///
+ /// User selected Basee10 based Server based recovery, for BASE10 the length is always more than 40
+ ///
+ DEBUG ((EFI_D_ERROR, "ATAM: Password entered is SRTK BASE10 PASSWORD\n"));
+ ///
+ /// Decoded value is 20 byte hex
+ ///
+ DecimalToHexString ((CHAR8 *) PasswordEntered, PasswordHex, MAX_HEX_BYTES - 1);
+ }
+
+ Status = mAtInstance.AtProtocol.AuthenticateCredential (&mAtInstance.AtProtocol, PasswordHex, &PassType, &IsAuthTmp);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "ATAM: AuthenticateCredential, Status = %r\n", Status));
+ }
+ } else {
+ DEBUG ((EFI_D_ERROR, "ATAM: Unknown Pass type \n"));
+ }
+
+ ///
+ /// Calling ValidatePreferredAM to reset the PbafailedCount
+ ///
+ if (gAtStateGlobalVar.flags.AuthenticateModule == AT_AM_SELECTION_PBAM && IsAuthTmp == 1) {
+ AtState = AT_STATE_ACTIVE;
+ AtAmPref = AT_AM_SELECTION_PBAM;
+ Status = AtAmValidatePreferredAM (&AtState, &AtAmPref);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "ATAM: AtAmValidatePreferredAM failed, Status = %r\n", Status));
+ }
+ }
+
+ *IsAuthenticated = IsAuthTmp;
+
+ ZeroMem (Hash, (ATAM_SETUP_PASSWORD_LENGTH + 1) * sizeof (UINT8));
+ ZeroMem (PasswordHex, (ATAM_SETUP_PASSWORD_LENGTH + 1) * sizeof (UINT8));
+ FreePool (Hash);
+ FreePool (PasswordHex);
+
+ return Status;
+}
+
+/**
+ This routine receives the SSTK from UI and verifies it if the password is acceptable. This requests FW to enter or exit Suspend mode based on user input.
+
+ @param[in] This The address of protocol
+ @param[in] TransitionState 1- enter suspend state, 0 - exit suspend state
+ @param[in] Token Pointer to token
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+AtAmSetSuspendState (
+ IN EFI_AT_PROTOCOL *This,
+ IN UINT32 TransitionState,
+ IN UINT8 *Token
+ )
+{
+ EFI_STATUS Status;
+ UINT8 TokenHex[ATAM_SETUP_PASSWORD_LENGTH];
+
+ DEBUG ((EFI_D_ERROR, "ATAM: SetSuspendState: Transition state = %x\n", TransitionState));
+
+ if(AsciiStrLen((CHAR8 *)Token) == 32) {
+ DEBUG ((EFI_D_ERROR, "ATAM: Suspend Password entered is in Base32\n"));
+ Base32Decode(Token, TokenHex);
+ } else if(AsciiStrLen((CHAR8 *)Token) > 40) {
+ DEBUG ((EFI_D_ERROR, "ATAM: Password entered is in Base10\n"));
+ DecimalToHexString((CHAR8 *) Token,TokenHex, MAX_HEX_BYTES - 1);
+ } else {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ DEBUG ((EFI_D_ERROR, "ATAM: SrtkPass = %x\n", TokenHex));
+
+ Status = mAtInstance.AtProtocol.SetSuspendState (&mAtInstance.AtProtocol, TransitionState, TokenHex);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "ATAM: SetSuspendState failed, Status = %r\n", Status));
+ } else {
+ DEBUG ((EFI_D_ERROR, "ATAM: Successfully set suspended state\n"));
+ }
+
+ return Status;
+}
+
+/**
+ This routine gets AT state.
+
+ @param[in] This The address of protocol
+ @param[out] AtStateInfo State of AT
+
+ @retval EFI_SUCCESS The function completed successfully
+**/
+EFI_STATUS
+AtAmGetAtStateInfo (
+ IN EFI_AT_PROTOCOL *This,
+ OUT AT_STATE_INFO *AtStateInfo
+ )
+{
+
+ AtStateInfo->State = gAtStateGlobalVar.State;
+ AtStateInfo->LastTheftTrigger = gAtStateGlobalVar.LastTheftTrigger;
+ AtStateInfo->flags.LockState = gAtStateGlobalVar.flags.LockState;
+ AtStateInfo->flags.AuthenticateModule = gAtStateGlobalVar.flags.AuthenticateModule;
+ AtStateInfo->flags.S3Authentication = gAtStateGlobalVar.flags.S3Authentication;
+ AtStateInfo->flags.FlashVariableSecurity = gAtStateGlobalVar.flags.FlashVariableSecurity;
+ AtStateInfo->flags.FlashWearOut = gAtStateGlobalVar.flags.FlashWearOut;
+ if (gAtAmPrefUpdatedToATAM == TRUE) {
+ AtStateInfo->flags.AuthenticateModule = AT_AM_SELECTION_ATAM;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Validate preffered AM.
+
+ @param[in] AtState State of AT
+ @param[in] AtAmPref Preferred AT authentication method
+
+ @retval EFI_SUCCESS The function completed
+ successfully.
+**/
+EFI_STATUS
+AtAmValidatePreferredAM (
+ IN UINT8 *AtState,
+ IN UINT16 *AtAmPref
+ )
+{
+ EFI_STATUS Status;
+ UINTN VarSize;
+ UINT8 PbaFailedCount;
+ UINT32 Attributes;
+ AT_BIOS_RECOVERY_CONFIG RecoveryConfig;
+
+ VarSize = sizeof (UINT8);
+
+ if (*AtAmPref == AT_AM_SELECTION_ATAM) {
+ return EFI_SUCCESS;
+ }
+
+ if (*AtState == AT_STATE_ACTIVE) {
+
+ Attributes = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS;
+ Status = gRT->GetVariable (
+ L"PBA_FAILED_COUNT",
+ &gEfiPBAVariableGuid,
+ &Attributes,
+ &VarSize,
+ &PbaFailedCount
+ );
+ if (EFI_ERROR (Status) && Status != EFI_NOT_FOUND) {
+ DEBUG ((EFI_D_ERROR, "ATAM: ValidatePreferredAM failed, Status = %r\n", Status));
+ return Status;
+ }
+
+ if (Status == EFI_NOT_FOUND || PbaFailedCount > 0) {
+
+ DEBUG ((EFI_D_INFO, "ATAM: ValidatePreferredAM In State Active PbaFailedCount not yet defined\n"));
+ ///
+ /// This will be the case 1st time after enrollment when PbaFailedCount i.e PREFERRED_AM is not defined
+ /// Define this variable here
+ ///
+ PbaFailedCount = 0;
+ Status = gRT->SetVariable (
+ L"PBA_FAILED_COUNT",
+ &gEfiPBAVariableGuid,
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
+ sizeof (UINT8),
+ &PbaFailedCount
+ );
+ }
+ }
+ ///
+ /// Now get NVRAM Varible that store the PBA_Preferred_Failed count .. i.e. STOLEN_STATE which
+ /// which is incremented every boot
+ ///
+ if (*AtState == AT_STATE_STOLEN && *AtAmPref == AT_AM_SELECTION_PBAM) {
+
+ AtAmGetRecoveryConfig (NULL, &RecoveryConfig);
+
+ VarSize = sizeof (UINT8);
+ Attributes = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS;
+ Status = gRT->GetVariable (
+ L"PBA_FAILED_COUNT",
+ &gEfiPBAVariableGuid,
+ &Attributes,
+ &VarSize,
+ &PbaFailedCount
+ );
+ if (EFI_ERROR (Status) && Status != EFI_NOT_FOUND) {
+ DEBUG ((EFI_D_ERROR, "ATAM: ValidatePreferredAM failed, Status = %r\n", Status));
+ return Status;
+ }
+
+ if (Status == EFI_NOT_FOUND) {
+ DEBUG ((EFI_D_ERROR, "ATAM: ValidatePreferredAM In State Stolen PbaFailedCount not yet defined\n"));
+
+ ///
+ /// This will be the case 1st time after enrollment when PbaFailedCount i.e PREFERRED_AM is not defined and
+ /// AT somehow got into stolen mode
+ /// Define this variable here
+ ///
+ PbaFailedCount = 0;
+ Status = gRT->SetVariable (
+ L"PBA_FAILED_COUNT",
+ &gEfiPBAVariableGuid,
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
+ sizeof (UINT8),
+ &PbaFailedCount
+ );
+ } else if (PbaFailedCount > 0 && PbaFailedCount >= (UINT8) RecoveryConfig.PbaOverRideThreshold) {
+ ///
+ /// Set the PREFERRED_AM to BIOS AM here
+ ///
+ *AtAmPref = AT_AM_SELECTION_ATAM;
+ gAtAmPrefUpdatedToATAM = TRUE;
+ DEBUG ((EFI_D_ERROR, "ATAM: ValidatePreferredAM PbaFailedCount = %d\n", PbaFailedCount));
+ }
+ ///
+ /// Increment the PbaFailedCount count here
+ ///
+ PbaFailedCount = PbaFailedCount + 1;
+ Status = gRT->SetVariable (
+ L"PBA_FAILED_COUNT",
+ &gEfiPBAVariableGuid,
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
+ sizeof (UINT8),
+ &PbaFailedCount
+ );
+
+ DEBUG((EFI_D_INFO, "ATAM: ValidatePreferredAM PbaFailedCount incremented here:%d\n", PbaFailedCount));
+ DEBUG((EFI_D_INFO, "ATAM: ValidatePreferredAM gBiosRecoveryGlobalVar.PbaOverRideThreshold:%d\n",
+ RecoveryConfig.PbaOverRideThreshold));
+
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This routine checks if the PbaOverrideThreshold is exceeded.
+
+ @param[out] PbaFailedExceeded TRUE when the PbaOverrideThreshold is exceeded
+ @param[out] PbaFailedAttempts Number of failed attempts
+ @param[out] PbaFailedThreshold Pba failed count treshold
+
+ @retval EFI_SUCCESS The function completed
+ successfully.
+**/
+EFI_STATUS
+AtAmGetPbaCounter (
+ OUT UINT8* PbaFailedExceeded,
+ OUT UINT16* PbaFailedAttempts,
+ OUT UINT16* PbaFailedThreshold
+ )
+{
+ EFI_STATUS Status;
+ UINTN VarSize;
+ UINT32 Attributes;
+ UINT8 PbaCount;
+ AT_BIOS_RECOVERY_CONFIG RecoveryConfig;
+
+ DEBUG ((EFI_D_ERROR, "ATAM: AtAmGetPbaCounter\n"));
+
+ *PbaFailedExceeded = FALSE;
+ VarSize = sizeof (UINT8);
+
+ AtAmGetRecoveryConfig (NULL, &RecoveryConfig);
+
+ Status = gRT->GetVariable (
+ L"PBA_FAILED_COUNT",
+ &gEfiPBAVariableGuid,
+ &Attributes,
+ &VarSize,
+ &PbaCount
+ );
+
+ DEBUG ((EFI_D_ERROR, "ATAM: PbaCount = %d\n", PbaCount));
+ DEBUG ((EFI_D_ERROR, "ATAM: PbaOverRideThreshold = %d\n", RecoveryConfig.PbaOverRideThreshold));
+
+ *PbaFailedAttempts = PbaCount;
+ *PbaFailedThreshold = RecoveryConfig.PbaOverRideThreshold;
+
+ if (PbaCount >= (UINT8) RecoveryConfig.PbaOverRideThreshold) {
+ *PbaFailedExceeded = TRUE;
+ }
+
+ return Status;
+}
diff --git a/ReferenceCode/ME/At/AtAm/Dxe/AtAm.dxs b/ReferenceCode/ME/At/AtAm/Dxe/AtAm.dxs
new file mode 100644
index 0000000..5aac1dc
--- /dev/null
+++ b/ReferenceCode/ME/At/AtAm/Dxe/AtAm.dxs
@@ -0,0 +1,41 @@
+/** @file
+ Dependency expression file for ATAM Invocation Driver.
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+
+#include "AutoGen.h"
+#include "DxeDepex.h"
+
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+#include EFI_PROTOCOL_DEFINITION (LegacyBios)
+#include EFI_PROTOCOL_DEFINITION (BootScriptSave)
+#include EFI_PROTOCOL_DEFINITION (At)
+#include EFI_PROTOCOL_DEFINITION (Heci)
+#include EFI_PROTOCOL_DEPENDENCY (MeBiosPayloadData)
+#include EFI_PROTOCOL_DEFINITION (AtPlatformPolicy)
+#endif
+
+DEPENDENCY_START
+ DXE_PLATFORM_AT_POLICY_GUID AND
+ EFI_HECI_PROTOCOL_GUID AND
+ ME_BIOS_PAYLOAD_DATA_PROTOCOL_GUID
+DEPENDENCY_END
diff --git a/ReferenceCode/ME/At/AtAm/Dxe/AtAm.h b/ReferenceCode/ME/At/AtAm/Dxe/AtAm.h
new file mode 100644
index 0000000..ece69d8
--- /dev/null
+++ b/ReferenceCode/ME/At/AtAm/Dxe/AtAm.h
@@ -0,0 +1,239 @@
+/** @file
+ Header file for hangling AT and provide interface for creating UI.
+
+@copyright
+ Copyright (c) 2012 - 2013 Intel Corporation. All rights
+ reserved This software and associated documentation (if any)
+ is furnished under a license and may only be used or copied in
+ accordance with the terms of the license. Except as permitted
+ by such license, no part of this software or documentation may
+ be reproduced, stored in a retrieval system, or transmitted in
+ any form or by any means without the express written consent
+ of Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+#ifndef _ATAM_H_
+#define _ATAM_H_
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "AtHi.h"
+#include "MeLib.h"
+#include "AtAmHelper.h"
+#include "AtPolicyLib.h"
+#include "At.h"
+#endif
+
+//
+// Used during initialization
+//
+#include EFI_PROTOCOL_CONSUMER (FirmwareVolume)
+#include EFI_PROTOCOL_CONSUMER (HECI)
+#include EFI_PROTOCOL_CONSUMER (At)
+#include EFI_PROTOCOL_CONSUMER (AtPlatformPolicy)
+
+//
+// Driver Produced Protocols
+//
+#include EFI_PROTOCOL_PRODUCER (AtAm)
+
+#define ATAM_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('A', 'T', 'A', 'M')
+
+#define MAX_HEX_BYTES 20
+#define ATAM_ENTER_SUSPEND_STATE 1
+#define ATAM_EXIT_SUSPEND_STATE 0
+
+#define PBA_FAILED_COUNT_VARIABLE_GUID \
+ { \
+ 0x7c66ffdc, 0x423c, 0xe5d4, 0x25, 0x1b, 0x55, 0xad, 0xba, 0x95, 0x26, 0x98 \
+ }
+
+#pragma pack(1)
+
+typedef struct {
+ UINTN Signature;
+ EFI_HANDLE Handle;
+ EFI_ATAM_PROTOCOL AtAmProtocol;
+} ATAM_INSTANCE;
+
+#define ATAM_INSTANCE_FROM_ATAM_PROTOCOL(a) CR (a, ATAM_INSTANCE, AtAm, ATAM_PRIVATE_DATA_SIGNATURE)
+
+#pragma pack()
+
+#define NONCE_LENGTH 16
+#define STR_NONCE_LENGTH 33
+#define ATAM_SETUP_PASSWORD_LENGTH 49
+#define ATAM_TIMER_STRING_LENGTH 10
+#define ISV_PLATFORM_ID_LENGTH 16
+#define SERVER_SHORTCODE_LENGTH 16
+#define DEFAULT_LANGUAGE_STRING 4
+#define RECOVERY_STRING_LENGTH 256
+#define MX_SMS_MESSAGES 99
+
+typedef enum _AT_AM_SELECTION
+{
+ AT_AM_SELECTION_ATAM = 0,
+ AT_AM_SELECTION_PBAM,
+ AT_AM_SELECTION_MAX
+} AT_AM_SELECTION;
+
+/**
+ This function gets the ISV Strings stored by AT Server that BIOS will display.
+
+ @param[in] This The address of protocol
+ @param[out] IsvString Isv string pointer
+ @param[out] IsvId Intel(R) Anti-Theft service provider Id
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+AtAmGetIsvId (
+ IN EFI_AT_PROTOCOL *This,
+ OUT UINT8 *IsvString,
+ OUT UINT32 *IsvId
+ )
+;
+
+/**
+ This function returns time left to enter password.
+
+ @param[in] This The address of protocol
+ @param[out] TimeLeft Time
+ @param[out] TimeInterval Time interval
+
+ @retval EFI_SUCCESS The function completed
+ successfully.
+**/
+EFI_STATUS
+AtAmGetTimer (
+ IN EFI_AT_PROTOCOL *This,
+ OUT UINT32 *TimeLeft,
+ OUT UINT32 *TimeInterval
+ )
+;
+
+/**
+ This function gets 16 bytes nonce from firmware and also converts it to string according to format "XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XX".
+
+ @param[in] This The address of protocol
+ @param[out] NonceStr Pointer to Nonce string
+
+ @retval EFI_SUCCESS The function completed
+ successfully.
+**/
+EFI_STATUS
+AtAmGetNonce (
+ IN EFI_AT_PROTOCOL *This,
+ OUT UINT8 *NonceStr
+ )
+;
+
+/**
+ This function gets recovery config.
+
+ @param[in] This The address of protocol
+ @param[out] RecoveryConfig Pointer to structure
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+AtAmGetRecoveryConfig (
+ IN EFI_AT_PROTOCOL *This,
+ OUT AT_BIOS_RECOVERY_CONFIG *RecoveryConfig
+ )
+;
+
+/**
+ This routine receives the data (passphrase or SRTK) from UI and verifies it if the password (either passphrase or SRTK) is acceptable.
+
+ @param[in] This The address of protocol
+ @param[in] PasswordEntered Pointer to string
+ @param[in] PassType Password type
+ @param[out] IsAuthenticated Pointer to result of verification
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+AtAmVerifyPassword (
+ IN EFI_AT_PROTOCOL *This,
+ IN UINT8 *PasswordEntered,
+ IN UINT32 PassType,
+ OUT UINT8 *IsAuthenticated
+ )
+;
+
+/**
+ This routine receives the SSTK from UI and verifies it if the password is acceptable. This requests FW to enter or exit Suspend mode based on user input.
+
+ @param[in] This The address of protocol
+ @param[in] TransitionState 1- enter suspend state, 0 - exit suspend state
+ @param[in] Token Pointer to token
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+AtAmSetSuspendState (
+ IN EFI_AT_PROTOCOL *This,
+ IN UINT32 TransitionState,
+ IN UINT8 *Token
+ )
+;
+
+/**
+ This routine gets AT state.
+
+ @param[in] This The address of protocol
+ @param[out] AtStateInfo State of AT
+
+ @retval EFI_SUCCESS The function completed
+ successfully.
+**/
+EFI_STATUS
+AtAmGetAtStateInfo (
+ IN EFI_AT_PROTOCOL *This,
+ OUT AT_STATE_INFO *AtStateInfo
+ )
+;
+
+/**
+ Validate preffered AM.
+
+ @param[in] AtState State of AT
+ @param[in] AtAmPref Preferred AT authentication
+
+ @retval EFI_SUCCESS The function completed
+ successfully.
+**/
+EFI_STATUS
+AtAmValidatePreferredAM (
+ IN UINT8 *AtState,
+ IN UINT16 *AtAmPref
+ )
+;
+
+/**
+ This routine checks if the PbaOverrideThreshold is exceeded.
+
+ @param[out] PbaFailedExceeded TRUE when the PbaOverrideThreshold is exceeded
+ @param[out] PbaFailedAttempts Number of failed attempts
+ @param[out] PbaFailedThreshold Pba failed count treshold
+
+ @retval EFI_SUCCESS The function completed
+ successfully.
+**/
+EFI_STATUS
+AtAmGetPbaCounter (
+ OUT UINT8* PbaFailedExceeded,
+ OUT UINT16* PbaFailedAttempts,
+ OUT UINT16* PbaFailedThreshold
+ )
+;
+
+#endif // _ATAM_H_
diff --git a/ReferenceCode/ME/At/AtAm/Dxe/AtAm.inf b/ReferenceCode/ME/At/AtAm/Dxe/AtAm.inf
new file mode 100644
index 0000000..8322e18
--- /dev/null
+++ b/ReferenceCode/ME/At/AtAm/Dxe/AtAm.inf
@@ -0,0 +1,95 @@
+## @file
+# @todo ADD DESCRIPTION
+#
+#@copyright
+# Copyright (c) 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains an 'Intel Peripheral Driver' and uniquely
+# identified as "Intel Reference Module" and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+
+
+[defines]
+BASE_NAME = AtAm
+FILE_GUID = C810485E-D0EC-4e98-AAB5-120C7E554428
+COMPONENT_TYPE = BS_DRIVER
+
+[sources.common]
+ AtAm.c
+ AtAm.h
+ At.c
+ At.h
+ AtHi.h
+
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueDxeDriverEntryPoint.c
+
+[includes.common]
+ .
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/At
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/At/AtAm/Dxe
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Heci/Include
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/AtLibrary
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/AtLibrary/Dxe
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/Dxe
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include/Library
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+
+[libraries.common]
+ AtDxeLib
+ MeProtocolLib
+ MeLib
+ MeGuidLib
+ EdkIIGlueBaseLib
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueDxeReportStatusCodeLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueUefiLib
+ EdkIIGlueDxeMemoryAllocationLib
+ EdkIIGlueBasePrintLib
+ EdkProtocolLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT=_ModuleEntryPoint
+ DPX_SOURCE=AtAm.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=AtAmEntryPoint
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+ -D __EDKII_GLUE_BASE_LIB__ \
+ -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_UEFI_DEVICE_PATH_LIB__ \
+ -D __EDKII_GLUE_UEFI_LIB__\
+ -D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__\
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__
diff --git a/ReferenceCode/ME/At/AtAm/Dxe/AtAmDxe.cif b/ReferenceCode/ME/At/AtAm/Dxe/AtAmDxe.cif
new file mode 100644
index 0000000..e482950
--- /dev/null
+++ b/ReferenceCode/ME/At/AtAm/Dxe/AtAmDxe.cif
@@ -0,0 +1,18 @@
+<component>
+ name = "AtAmDxe"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\At\AtAm\Dxe\"
+ RefName = "AtAmDxe"
+[files]
+"At.c"
+"At.h"
+"AtAm.c"
+"AtAm.h"
+"AtAm.dxs"
+"AtAm.inf"
+"AtAmDxe.mak"
+"AtAmDxe.sdl"
+"AtHi.h"
+[parts]
+"ATAMProtocols"
+<endComponent>
diff --git a/ReferenceCode/ME/At/AtAm/Dxe/AtAmDxe.mak b/ReferenceCode/ME/At/AtAm/Dxe/AtAmDxe.mak
new file mode 100644
index 0000000..b129b70
--- /dev/null
+++ b/ReferenceCode/ME/At/AtAm/Dxe/AtAmDxe.mak
@@ -0,0 +1,81 @@
+# MAK file for the ModulePart:AtAmDxe
+
+all : AtAmDxe
+
+AtAmDxe : $(BUILD_DIR)\AtAmDxe.mak AtAmDxeBin
+
+$(BUILD_DIR)\AtAmDxe.mak : $(AtAmDxe_DIR)\$(@B).cif $(AtAmDxe_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(AtAmDxe_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+
+AtAmDxe_INCLUDES=\
+ $(AT_INCLUDES)\
+ $(ME_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(EdkIIGlueInclude)\
+ $(IndustryStandard_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+
+
+AtAmDxe_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=AtAmEntryPoint"\
+ /D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__\
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+ /D __EDKII_GLUE_BASE_LIB__ \
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_UEFI_DEVICE_PATH_LIB__ \
+ /D __EDKII_GLUE_UEFI_LIB__\
+ /D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+
+
+AtAmDxe_LIB_LINKS =\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(INTEL_PCH_PROTOCOL_LIB)\
+ $(EdkIIGlueBasePrintLib_LIB) \
+ $(EdkIIGlueUefiLib_LIB)\
+ $(TdtProtocolLib_LIB)\
+ $(ProtocolLib_LIB)\
+ $(EFISCRIPTLIB)\
+ $(AmtLibDxe_LIB)\
+ $(MeLibDxe_LIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+ $(AmtGuidLib_LIB)\
+ $(EFIGUIDLIB)\
+ $(EDKPROTOCOLLIB)\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueEdkDxeRuntimeDriverLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueDxeMemoryAllocationLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(EFIDRIVERLIB)\
+ $(MeChipsetDxeLib_LIB)\
+ $(AtDxeLib_LIB)\
+ $(PchPlatformDxeLib_LIB)
+
+
+
+# MAK file for the eModule:AtAmDxe
+
+AtAmDxeBin : $(AtAmDxe_LIB_LINKS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\AtAmDxe.mak all\
+ "MY_INCLUDES=$(AtAmDxe_INCLUDES)"\
+ "MY_DEFINES=$(AtAmDxe_DEFINES)"\
+ GUID=C810485E-D0EC-4e98-AAB5-120C7E554428\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=BS_DRIVER \
+ EDKIIModule=DXEDRIVER\
+ DEPEX1=$(AtAmDxe_DIR)\AtAm.dxs \
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \
+ COMPRESS=1\
+
+
diff --git a/ReferenceCode/ME/At/AtAm/Dxe/AtAmDxe.sdl b/ReferenceCode/ME/At/AtAm/Dxe/AtAmDxe.sdl
new file mode 100644
index 0000000..513a1a6
--- /dev/null
+++ b/ReferenceCode/ME/At/AtAm/Dxe/AtAmDxe.sdl
@@ -0,0 +1,33 @@
+TOKEN
+ Name = "AtAmDxe_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable TdtDxe support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Token = "AT_SUPPORT" "=" "1"
+End
+
+MODULE
+ Help = "Includes TdtDxe.mak to Project"
+ File = "AtAmDxe.mak"
+End
+
+PATH
+ Name = "AtAmDxe_DIR"
+ Help = "Tdt file source directory"
+End
+
+PATH
+ Name = "AtAmDxe_SOURCE"
+ Help = "iAMT Driver files source directory"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\AtAmDxe.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+
+
diff --git a/ReferenceCode/ME/At/AtAm/Dxe/AtHi.h b/ReferenceCode/ME/At/AtAm/Dxe/AtHi.h
new file mode 100644
index 0000000..ee03cf8
--- /dev/null
+++ b/ReferenceCode/ME/At/AtAm/Dxe/AtHi.h
@@ -0,0 +1,1275 @@
+/** @file
+ Definition of AT Host Interface (ATHI) Protocol messages between the
+ AT Service and HOST Applications.
+
+@copyright
+ Copyright (c) 2007 - 2012 Intel Corporation. All rights
+ reserved This software and associated documentation (if any)
+ is furnished under a license and may only be used or copied in
+ accordance with the terms of the license. Except as permitted
+ by such license, no part of this software or documentation may
+ be reproduced, stored in a retrieval system, or transmitted in
+ any form or by any means without the express written consent
+ of Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _AT_HI_H
+#define _AT_HI_H
+
+#include "MeLib.h"
+
+#define AT_COMMAND 0
+#define AT_RESPONSE 1
+
+#define AT_ME_RULE_ID 0xd0000
+#define AT_ME_RULE_GROUP 0x03
+#define AT_ME_RULE_COMMAND 0x02
+
+#pragma pack(1)
+///
+/// ATHI Protocol Identifier
+///
+/// AT Host Interface protocol GUID
+///
+#define ATHI_PROTOCOL_GUID \
+ { \
+ 0x3C4852D6, 0xD47B, 0x4f46, 0xB0, 0x5E, 0xB5, 0xED, 0xC1, 0xAA, 0x43, 0x0A \
+ }
+
+#define ATHI_PROTOCOL_FIXED_GUID \
+ { \
+ 0xfa8f55e8, 0xab22, 0x42dd, 0xb9, 0x16, 0x7d, 0xce, 0x39, 0x00, 0x25, 0x74 \
+ }
+
+///
+/// AT Host Interface protocol version (for ME FW internal use)
+///
+#define ATHI_PROTOCOL_VERSION_ME 1
+
+///
+/// AT Host Interface protocol major version
+///
+#define ATHI_PROTOCOL_VERSION_MAJOR 5
+
+///
+/// AT Host Interface protocol minor version
+///
+#define ATHI_PROTOCOL_VERSION_MINOR 0
+
+///
+/// ATHI Framing Structures
+/// Defines the ATHI header and creates a type name.
+///
+/// Refer to AtHiHeader.dot "ATHI Header"
+///
+typedef struct _ATHI_HEADER {
+ ///
+ /// The version number for the ATHI protocol.
+ ///
+ struct {
+ ///
+ /// The major version number. The major version number shall advance if
+ /// and only if backwards compatibility is broken by a change to the
+ /// protocol. If ME firmware doesn't specifically support the version
+ /// number supplied in the header, an error shall be returned.
+ ///
+ UINT8 Major;
+
+ ///
+ /// The minor version number. All minor versions under a given major
+ /// version shall be backwards compatible with prevision minor versions
+ /// under that major version. If the version number supplied in the
+ /// header is higher than the minor version number supported by ME
+ /// firmware, an error shall be returned.
+
+ UINT8 Minor;
+ } Version;
+
+ ///
+ /// Specifies the command or response in the message.
+ ///
+ struct {
+ ///
+ /// The operation with which the command is associated.
+ ///
+ UINT16 Code : 7;
+
+ ///
+ /// Command/Response indicator:
+ /// 0 The message contains a command.
+ /// 1 The message contains a response.
+ ///
+ UINT16 IsResponse : 1;
+
+ ///
+ /// The functional category of the command
+ ///
+ /// See _ATHI_CMD_GROUP
+ ///
+ UINT16 Category : 8;
+ } Command;
+
+ ///
+ /// The length in bytes of the message. The length applies to the message
+ /// body (excludes the header and signature fields).
+ ///
+ UINT32 Length;
+} ATHI_HEADER;
+
+///
+/// Maximum blob data size.
+///
+#define AT_BLOB_LENGTH_MAX 256
+
+///
+/// Structure that defines the format of the Blob to be stored and retrieved
+/// for the ISV software.
+///
+typedef struct _AT_BLOB {
+ ///
+ /// The length of the data to be securely stored
+ ///
+ UINT32 Length;
+
+ ///
+ /// The data to be securely stored
+ ///
+ UINT8 Value[AT_BLOB_LENGTH_MAX];
+} AT_BLOB;
+
+#define AT_NONCE_LENGTH 16 ///< Maximum nonce length.
+
+///
+/// Type definition for a nonce. To prevent replay of commands, a nonce
+/// shall be added to each command message. A nonce is a value that is used
+/// once. Ideally, each nonce value should not be used more than once during
+/// the lifetime of the AT laptop computer. However, a nonce generation function
+/// that guarantees a very low probability of nonce values being repeated shall
+/// suffice.
+///
+
+typedef UINT8 AT_NONCE[AT_NONCE_LENGTH];
+
+///
+/// Command Completion Codes. Each response message contains a completion code
+/// that indicates whether the command completed successfully, and the nature
+/// of the failure if it did not.
+///
+typedef enum _ATHI_COMPLETION_CODE
+{
+ ///
+ /// The command completed successfully.
+ ///
+ ATHI_COMPCODE_SUCCESS = 0,
+
+ ///
+ /// The command failed due to an internal error.
+ ///
+ ATHI_COMPCODE_INTERNAL_FAILURE,
+
+ ///
+ /// The command is not recognized, or is recognized but not supported.
+ ///
+ ATHI_COMPCODE_INVALID_OPERATION,
+
+ ///
+ /// A parameter value does not satisfy the requirements of the command.
+ ///
+ ATHI_COMPCODE_INVALID_PARAM = 6,
+
+ ///
+ /// The value of the length field in the message header is outside the
+ /// supported range for the command.
+ ///
+ ATHI_COMPCODE_INVALID_MSG_LEN,
+
+ ///
+ /// The command failed, but no information about the nature of the failure is available.
+ ///
+ ATHI_COMPCODE_GENERAL_FAILURE,
+
+ ///
+ /// Maximum value for a completion code.
+ ///
+ ATHI_COMPCODE_MAXIMUM
+} ATHI_COMPLETION_CODE;
+
+///
+/// Useful definitions for basic commands (commands without a body)
+///
+
+///
+/// Type name for an unsigned command message that has no body (header only).
+///
+typedef ATHI_HEADER ATHI_BASIC_CMD;
+
+///
+/// Definition and type name for a basic response. The basic response has a
+/// header and a minimal body (just the Completion Code).
+///
+typedef struct _ATHI_BASIC_RSP {
+ ATHI_HEADER Header; ///< Message header
+
+ ATHI_COMPLETION_CODE CompletionCode; ///< Completion code
+} ATHI_BASIC_RSP;
+
+///
+/// AT Command Groups
+///
+
+/// Related ATHI commands are grouped into several categories. Each command
+/// code contains the code of its category. See #ATHI_HEADER.
+///
+typedef enum _ATHI_CMD_GROUP
+{
+ ATHI_CMD_GROUP_RESERVED = 0, ///< Reserved
+
+ ///
+ /// Commands related to the ME's theft protection capabilities.
+ ///
+ /// See _ATHI_THEFT_DETECT_GRP_CMD
+ ///
+ ATHI_CMD_GROUP_THEFT_DETECTION,
+
+ ///
+ /// Commands related to non-volatile data storage services provided to
+ /// the FDE/FLE software present on the AT laptop computer.
+ ///
+ /// See _ATHI_DATA_STORE_GRP_CMD
+ ///
+ ATHI_CMD_GROUP_DATA_STORAGE,
+
+ ///
+ /// Commands related to securely recovering the AT laptop computer for
+ /// AT disablement actions.
+ ///
+ /// See _ATHI_RECOVERY_GRP_CMD
+ ///
+ ATHI_CMD_GROUP_RECOVERY,
+
+ ///
+ /// Commands related to ATHI infrastructure.
+ ///
+ /// See _ATHI_GENERAL_GRP_CMD
+ ///
+ ATHI_CMD_GROUP_GENERAL,
+
+ ///
+ /// Event notifications serve to inform the ME AT Service when an
+ /// event occurs in the PBA or AT server.
+ ///
+ /// See _ATHI_NOTIFICATION_GRP_CMD
+ ///
+ ATHI_CMD_GROUP_NOTIFICATIONS,
+
+ ///
+ /// 3G NIC commands allow BIOS to initialize and request Radio
+ /// status from FW
+ ///
+ /// See _ATHI_3G_NIC_GRP_CMD
+ ///
+ ATHI_CMD_GROUP_3G_NIC,
+
+ ///
+ /// Boundary check.
+ ///
+ ATHI_CMD_GROUP_MAX
+} ATHI_CMD_GROUP;
+
+///
+/// ATHI THEFT DETECTION Group Commands
+///
+
+/// Theft detection commands control and configure the theft protection
+/// capabilities of the ME AT Service.
+///
+typedef enum _ATHI_THEFT_DETECT_GRP_CMD
+{
+ ///
+ /// Returns the AT state of the monitored system.
+ ///
+ /// See ATHI_GET_STATE_CMD
+ ///
+ ATHI_THEFT_DETECT_GRP_GET_STATE_CMD,
+
+ ///
+ /// Returns the state of the specified timer.
+ ///
+ /// See ATHI_GET_TIMER_INFO_CMD
+ ///
+ ATHI_THEFT_DETECT_GRP_GET_TIMER_INFO_CMD,
+
+ ///
+ /// Resets the specified timer to its configured reset interval.
+ ///
+ /// See ATHI_RESET_TIMER_CMD
+ ///
+ ATHI_THEFT_DETECT_GRP_RST_TIMER_CMD,
+
+ ///
+ /// Configures the actions that the ME AT Service shall take if the
+ /// specified event occurs.
+ ///
+ /// See ATHI_SET_POLICY_CMD
+ ///
+ ATHI_THEFT_DETECT_GRP_SET_POLICY_CMD,
+
+ ///
+ /// Returns the actions that the ME AT Service shall take if the
+ /// specified event occurs.
+ ///
+ /// See ATHI_GET_POLICY_CMD
+ ///
+ ATHI_THEFT_DETECT_GRP_GET_POLICY_CMD,
+
+ ///
+ /// Sets the reset interval for the specified timer. The timer counts down
+ /// and expires if it reaches 0.
+ ///
+ /// See ATHI_SET_TIMER_INTERVAL_CMD
+ ///
+ ATHI_THEFT_DETECT_GRP_SET_TIMER_INTERVAL_CMD,
+
+ ///
+ /// Asserts that the AT laptop is stolen. The ME AT Service shall proceed
+ /// immediately to the Stolen state, executing all actions in the
+ /// AssertStolenPolicy.
+ ///
+ /// See ATHI_ASSERT_STOLEN_CMD
+ ///
+ ATHI_THEFT_DETECT_GRP_ASSERT_STOLEN_CMD,
+
+ ///
+ /// Same as the AssertStolen command but not signed.
+ ///
+ /// See ATHI_ASSERT_STOLEN_CMD
+ ///
+ ATHI_THEFT_DETECT_GRP_UNSIGNED_ASSERT_STOLEN_CMD,
+
+ ///
+ /// Returns the AT current state in unsigned mode.
+ ///
+ /// See GET_STATE_UNSIGNED
+ ///
+ ATHI_THEFT_DETECT_GRP_GET_STATE_UNSIGNED,
+
+ ///
+ /// Boundary check.
+ ///
+ ATHI_THEFT_DETECT_GRP_MAX
+} ATHI_THEFT_DETECT_GRP_CMD;
+
+///
+/// This flag indicates that AT is in the STOLEN state and the policies are set
+/// to "do nothing". The mask must be applied to the AT state rule.
+///
+/// NOTE: This flag is only cleared when the FW receives an AssertStolen
+/// message.
+///
+#define AT_PSEUDO_STOLEN_STATE_MASK 0x00000080
+
+///
+/// Enumeration of AT theft triggers IDs
+///
+typedef enum _AT_THEFT_TRIGGER
+{
+ ///
+ /// None.
+ ///
+ AT_THEFT_TRIGGER_NA = 0,
+
+ ///
+ /// Theft trigger identifier for disable timer expiration
+ ///
+ AT_THEFT_TRIGGER_DISABLE_TIMER_EXPIRATION,
+
+ ///
+ /// Theft trigger identifier for command driven disablement.
+ ///
+ AT_THEFT_TRIGGER_ASSERT_STOLEN,
+
+ ///
+ /// Theft trigger identifier for PBA logon failure exceeded threshold.
+ ///
+ AT_THEFT_TRIGGER_THRESHOLD_EXCEEDED,
+
+ ///
+ /// Theft trigger identifier for platform attack detection.
+ ///
+ AT_THEFT_TRIGGER_ATTACK_DETECTED,
+
+ ///
+ /// Bounday check.
+ ///
+ AT_THEFT_TRIGGER_MAX
+} AT_THEFT_TRIGGER;
+
+///
+/// Enumeration of AT timer types.
+///
+typedef enum _AT_TIMER_ID
+{
+ ///
+ /// Reserved.
+ ///
+ AT_TID_RSVD = 0,
+
+ ///
+ /// The disable timer is a variation on the watchdog timer. It is periodically
+ /// reset by ISV software to indicate that the system is behaving as expected.
+ /// If it is not reset before it expires, the ME AT Service shall execute the
+ /// protective actions configured in its disable timer policy.
+ /// The first line of defense when the system begins to exhibit behavior that
+ /// indicates it has been stolen is the ISV software, which may invoke the
+ /// ATHI SetPolicy function to protect the platform.
+ /// The disable timer is designed to protect the system if the ISV software
+ /// is disabled. In this case, the ISV software will be unable to reset the
+ /// disable timer before it expires, and the ME AT Service will take the
+ /// configured protective actions.
+ ///
+ AT_TID_DISABLE_TIMER,
+
+ ///
+ /// The unlock timer used when the AT laptop computer is locked. The ME AT Service
+ /// sets the recovery timer when it sees that the AT state is Stolen during
+ /// the host boot flow. If the user doesn't successfully complete the
+ /// platform_enable_flow recovery flow before the unlock timer expires,
+ /// the ME AT Service shall power down the platform immediately.
+ /// The variable UnlockTimerInterval shall be configurable within a range
+ /// that is long enough to facilitate a bona fide recovery attempt, but short
+ /// enough to prevent exploitation of the platform by a thief that does not
+ /// have the recovery credential.
+ ///
+ AT_TID_UNLOCK_TIMER,
+
+ ///
+ /// The grace timer allows the user of a AT laptop computer time to take
+ /// actions to cause a ResetTimer command to be issued by the AT service.
+ /// The grace period shall be applied if and only if the ME AT service
+ /// determines that the Disable Timer logically expired while the AT
+ /// laptop computer was in Sx (sleeping).
+ ///
+ AT_TID_GRACE_TIMER,
+
+ ///
+ /// The PBA Logon Timer shall be used to count down the allotted time for
+ /// PBA Logon. The ME AT Service shall start a PBA Logon Timer upon
+ /// transition from S4/S5 to S0. If the ME AT Service receives a property
+ /// authenticated PBA Logon notification message before the PBA Logon Timer
+ /// expires, it shall stop the timer and allow operation to continue normally.
+ /// If instead the PBA Logon Timer expires before the ME AT Service has
+ /// received a properly authenticated PBA Logon notification message, the
+ /// ME AT Service shall power down the system immediately, but shall not
+ /// transition to the Stolen state.
+ ///
+ AT_TID_PBA_LOGON_TIMER,
+
+ ///
+ /// The activity timer is used to extend the period of the Disable Timer in
+ /// the event that a ATHI client has recently invoked a ATHI command when
+ /// the Disable Timer expires. The intent is to allow the client to complete
+ /// a command flow that may include a ResetTimer command.
+ /// The AT activity timer shall be reset each time a ATHI command is completed.
+ /// The interval of the AT activity timer shall be 30 seconds. This interval
+ /// shall not be externally configurable.
+ ///
+ AT_TID_ACTIVITY_TIMER,
+
+ ///
+ /// Bounday check.
+ ///
+ AT_TID_MAX
+} AT_TIMER_ID;
+
+///
+/// A timer with an interval of -1 means that the timer is disabled. Applies to
+/// AT_TIMER_CONFIG and AT_TIMER_INFO.
+///
+#define AT_TIMER_DISABLED 0xFFFFFFFF
+
+///
+/// Maximum timer value besides the disabled timer value. This value is due to
+/// the maximum timer value allowed by the FW resources.
+///
+#define AT_TIMER_MAX (AT_TIMER_DISABLED / 1024)
+
+///
+/// Remaining grace timer in which the user is not assumed not to be able to
+/// complete a TimerResetCmd due to OS context loading from S3 -> S0.
+///
+/// Value is 30 seconds.
+///
+#define AT_LOW_GRACE_THRESHOLD 30
+
+///
+/// Minumium DISABLE timer value (in seconds)
+///
+#define AT_TMR_DISABLE_MIN 60
+
+///
+/// Minumium DISABLE timer value (in seconds)
+///
+#define AT_TMR_DISABLE_MAX AT_TIMER_DISABLED
+
+///
+// Minumium UNLOCK timer value (in seconds)
+///
+#define AT_TMR_UNLOCK_MIN 60
+
+///
+/// Minumium UNLOCK timer value (in seconds)
+///
+#define AT_TMR_UNLOCK_MAX AT_TIMER_MAX
+
+///
+/// Minumium GRACE timer value (in seconds)
+///
+#define AT_TMR_GRACE_MIN 60
+
+///
+/// Minumium GRACE timer value (in seconds)
+///
+#define AT_TMR_GRACE_MAX AT_TIMER_MAX
+
+///
+// Minumium PBALOGON timer value (in seconds)
+///
+#define AT_TMR_PBALOGON_MIN 60
+
+///
+/// Minumium PBALOGON timer value (in seconds)
+///
+#define AT_TMR_PBALOGON_MAX AT_TIMER_DISABLED
+
+///
+/// Structure that contains the configuration and state information for
+/// a specified timer.
+///
+typedef struct _AT_TIMER_INFO {
+ ///
+ /// Identifies the timer that shall be configured. See #AT_TIMER_ID.
+ ///
+ UINT8 Id;
+
+ ///
+ /// Padding for now
+ ///
+ UINT8 Reserved[3];
+
+ ///
+ /// The interval configured in the timer, in seconds.
+ ///
+ UINT32 Interval;
+
+ ///
+ /// The number of ticks remaining in the current timer countdown.
+ ///
+ UINT32 TimeLeft;
+} AT_TIMER_INFO;
+
+///
+/// Structure defining the PBAM Configuration.
+///
+typedef struct _AT_POLICY_PBA_CONFIG {
+ UINT8 RunAfterPost : 1;
+ UINT8 IsInstalled : 1;
+ UINT8 Reserved : 6;
+} AT_POLICY_PBA_CONFIG;
+
+///
+/// Optional union defining the PBAM Configuration.
+///
+typedef union _AT_POLICY_PBA_CONFIG_U {
+ UINT8 Value;
+ AT_POLICY_PBA_CONFIG Bits;
+} AT_POLICY_PBA_CONFIG_U;
+
+///
+/// Enumeration of the platform lock state
+///
+typedef enum _AT_PLATFORM_LOCKSTATE
+{
+ AT_PLATFORM_LOCKSTATE_NOTLOCKED = 0,
+ AT_PLATFORM_LOCKSTATE_LOCKED,
+ AT_PLATFORM_LOCKSTATE_MAX
+} AT_PLATFORM_LOCKSTATE;
+
+//
+// Command definition structures
+//
+
+///
+/// The GetATState command. Returns the AT state of the laptop computer.
+///
+/// Sender: AT AM | PBA
+/// Signing Key: None | None
+///
+/// Refer to AtHiGetStateCmd.dot "GetState command"
+///
+/// See ATHI_GET_STATE_RSP
+///
+typedef ATHI_BASIC_CMD ATHI_GET_STATE_CMD;
+
+///
+// The GetATState response.
+///
+/// Refer to AtHiGetStateRsp.dot "GetState response"
+///
+///
+typedef struct _ATHI_GET_STATE_RSP {
+ ATHI_HEADER Header;
+ ATHI_COMPLETION_CODE CompletionCode;
+ AT_STATE_INFO StateInfo;
+} ATHI_GET_STATE_RSP;
+
+///
+/// The GetTimerInfo command. Returns configuration and state information about
+/// the specified timer.
+///
+/// Sender: PBA
+/// Signing Key: PBASK
+///
+/// Refer to AtHiGetTimerInfoCmd.dot "GetTimerInfo command"
+///
+/// See ATHI_GET_TIMER_INFO_RSP
+///
+typedef struct _ATHI_GET_TIMER_INFO_CMD {
+ ATHI_HEADER Header;
+ UINT8 TimerId;
+} ATHI_GET_TIMER_INFO_CMD;
+
+///
+/// ATHI_GET_TIMER_INFO response.
+///
+/// Refer to AtHiGetTimerInfoRsp.dot "GetTimerInfo response"
+///
+typedef struct _ATHI_GET_TIMER_INFO_RSP {
+ ATHI_HEADER Header;
+ ATHI_COMPLETION_CODE CompletionCode;
+ AT_TIMER_INFO TimerInfo;
+} ATHI_GET_TIMER_INFO_RSP;
+
+///
+/// ATHI RECOVERY Group Commands
+///
+typedef enum _ATHI_RECOVERY_GRP_CMD
+{
+ ///
+ /// SetCredential stores the recovery credential in non-volatile storage,
+ /// where it is used for validation purposes when the credential is presented
+ /// by a user during recovery flow.
+ ///
+ /// See #ATHI_SET_CREDENTIAL_CMD
+ ///
+ ATHI_RECOVERY_GRP_SET_CREDENTIAL_CMD,
+ ///
+ /// AuthenticateRecoveryCredential presents the a credential to the ME AT
+ /// Service for validation during the recovery flow.
+ ///
+ /// See ATHI_AUTHENTICATE_CREDENTIAL_CMD
+ ///
+ ATHI_RECOVERY_GRP_AUTH_CREDENTIAL_CMD,
+ ///
+ /// The ComputeHash command computes a specified hash of input data. Maximum
+ /// size of the digest value shall be 384 bits (48 bytes). This command may
+ /// be used to preprocess authentication tokens if the specified hash
+ /// algorithm is not supported by the requester.
+ ///
+ /// See ATHI_COMPUTE_HASH_CMD
+ ///
+ ATHI_RECOVERY_GRP_COMPUTE_HASH_CMD,
+ ///
+ /// The DeAssertStolen command is used to recovery the platfrom from stolen state
+ /// by PBAM or AT server
+ /// See ATHI_DEASSERT_STOLEN_CMD
+ ///
+ ATHI_RECOVERY_GRP_DEASSERT_STOLEN_CMD,
+ ///
+ /// The GetIsvId command exports the identity of the service provider (ISV)
+ /// that activated the AT service
+ /// See ATHI_GET_ISVID_CMD
+ ///
+ ATHI_RECOVERY_GRP_GET_ISVID_CMD,
+ ///
+ /// Bounday check.
+ ///
+ ATHI_RECOVERY_GRP_MAX
+} ATHI_RECOVERY_GRP_CMD;
+
+///
+/// This enumeration defines the credential types.
+///
+typedef enum _AT_CREDENTIAL_TYPE
+{
+ ///
+ // Reserved.
+ ///
+ AT_CREDENTIAL_TYPE_RSVD = 0,
+
+ ///
+ // User defined recovery passphrase
+ ///
+ AT_CREDENTIAL_TYPE_USER_PASSPHRASE,
+
+ ///
+ /// Server generated random token
+ ///
+ AT_CREDENTIAL_TYPE_SRTK,
+
+ ///
+ /// Server suspend token
+ ///
+ AT_CREDENTIAL_TYPE_SSTK,
+
+ ///
+ /// Base key
+ ///
+ AT_CREDENTIAL_TYPE_BK,
+
+ ///
+ /// Boundary check.
+ ///
+ AT_CREDENTIAL_TYPE_MAX
+} AT_CREDENTIAL_TYPE;
+
+///
+// This enumeration defines the salt IDs.
+///
+typedef enum _AT_HASH_ALGO_ID
+{
+ ///
+ /// Reserved.
+ ///
+ AT_HASH_ALGO_ID_RSVD = 0,
+
+ ///
+ /// SHA-1 algorithm (160-bit output)
+ ///
+ AT_HASH_ALGO_ID_SHA1,
+
+ ///
+ /// Boundary check
+ ///
+ AT_HASH_ALGO_ID_MAX
+} AT_HASH_ALGO_ID;
+
+///
+/// Defines the maximum length of a user passpharse recovery hash (will be 32 in 2009).
+///
+#define AT_USR_PASS_HASH_LENGTH_MAX 20
+
+///
+/// Defines the maximum length of a SRTK recovery token
+///
+#define AT_SRTK_LENGTH_MAX 32
+
+///
+/// Maximium credential length.
+///
+#define AT_CREDENTIAL_VALUE_LENGTH_MAX AT_SRTK_LENGTH_MAX
+
+#define AT_PASSWORD_LENGTH 64
+
+///
+/// Structure that defines a credential for storage, validation, and export operations.
+///
+typedef struct _AT_CREDENTIAL {
+ ///
+ /// The credential type
+ ///
+ AT_CREDENTIAL_TYPE Type;
+
+ ///
+ /// The credential length
+ ///
+ UINT32 Length;
+
+ ///
+ /// The credential value
+ ///
+ UINT8 Value[1]; /// Need a pointer but cannot make a zero length array
+} AT_CREDENTIAL;
+
+///
+/// The AuthenticateCredential command. Sets the value of the specified
+/// credential in the ME AT Service.
+///
+/// Sender: AT AM
+/// Signing Key: None
+///
+/// Refer to AtHiAuthenticateCredentialCmd.dot "AuthenticateCredential command"
+///
+/// See ATHI_AUTHENTICATE_CREDENTIAL_RSP
+///
+typedef struct _ATHI_AUTHENTICATE_CREDENTIAL_CMD {
+ ATHI_HEADER Header;
+ AT_CREDENTIAL Credential;
+} ATHI_AUTHENTICATE_CREDENTIAL_CMD;
+
+///
+/// The AuthenticateCredential response.
+///
+/// Refer to AtHiAuthenticateCredentialRsp.dot "AuthenticateCredential response"
+///
+typedef struct _ATHI_AUTHENTICATE_CREDENTIAL_RSP {
+ ATHI_HEADER Header;
+ ATHI_COMPLETION_CODE CompletionCode;
+ UINT8 Authenticated;
+} ATHI_AUTHENTICATE_CREDENTIAL_RSP;
+
+///
+/// Definition for the maximum hash output size.
+///
+#define AT_MAX_HASH_OUTPUT_SIZE 48
+
+///
+/// The ComputeHash command. Computes a specified hash of input data. Maximum
+/// size of the digest value shall be 384 bits (48 bytes).
+///
+/// Sender: AT AM
+/// Signing Key: None
+///
+/// Refer to AtHiComputeHashCmd.dot "ComputeHash command"
+///
+/// See ATHI_COMPUTE_HASH_RSP
+///
+typedef struct _ATHI_COMPUTE_HASH_CMD {
+ ATHI_HEADER Header;
+
+ ///
+ /// see AT_HASH_ALGO_ID for values
+ ///
+ UINT8 Algorithm;
+ UINT8 InputLength;
+ UINT8 InputBuffer[AT_MAX_HASH_OUTPUT_SIZE];
+} ATHI_COMPUTE_HASH_CMD;
+
+///
+/// The ComputeHash response.
+///
+/// Refer to AtHiComputeHashRsp.dot "ComputeHash response"
+///
+///
+typedef struct _ATHI_COMPUTE_HASH_RSP {
+ ATHI_HEADER Header;
+ ATHI_COMPLETION_CODE CompletionCode;
+
+ ///
+ /// see AT_HASH_ALGO_ID for values
+ ///
+ UINT8 OutputLength;
+ UINT8 OutputBuffer[AT_MAX_HASH_OUTPUT_SIZE];
+} ATHI_COMPUTE_HASH_RSP;
+
+///
+/// The DeassertStolen command. Recover the laptop from stolen state. The ME AT
+/// Service shall proceed immediately to the NotStolen state.
+///
+/// Sender: ISV SW
+/// Signing Key: PBASK, TSSK
+///
+/// Refer to AtHiDeassertStolenCmd.dot "DeassertStolen command"
+///
+/// See ATHI_DEASSERT_STOLEN_RSP
+///
+typedef ATHI_BASIC_CMD ATHI_DEASSERT_STOLEN_CMD;
+
+typedef ATHI_BASIC_RSP ATHI_DEASSERT_STOLEN_RSP;
+
+///
+/// The GetIsvId command exports the identity of the service provider (ISV) that
+/// activated the AT service. This allows for system recovery in cases where the user
+/// may not be sure who to contact when he/she is unable to recover the system locally.
+/// Note that this command is allowed only while the system in the STOLEN state
+///
+/// Sender: AT AM
+/// Signing Key: None
+///
+/// See ATHI_GET_ISVID_RSP
+///
+typedef ATHI_BASIC_CMD ATHI_GET_ISVID_CMD;
+
+typedef struct _ATHI_GET_ISVID_RSP {
+ ATHI_HEADER Header;
+ ATHI_COMPLETION_CODE CompletionCode;
+ UINT32 IsvId;
+} ATHI_GET_ISVID_RSP;
+
+///
+/// ATHI General Group Commands
+///
+typedef enum _ATHI_GENERAL_GRP_CMD
+{
+ ///
+ /// GetNonce returns a nonce generated by the ME AT Service. The purpose of
+ /// this nonce is to prevent replay of AT command messages.
+ ///
+ /// See ATHI_GET_NONCE_CMD
+ ///
+ ATHI_GENERAL_GRP_GET_NONCE_CMD,
+
+ ///
+ /// GetATCapabilities requests that the ME AT Service return the
+ /// capabilities it has implemented.
+ ///
+ /// See ATHI_GET_AT_CAPABILITIES_CMD
+ ///
+ ATHI_GENERAL_GRP_GET_AT_CAPABILITIES_CMD,
+
+ ///
+ /// The SetPublicKey command saves the specified public key of an RSA
+ /// key-pair for use by the ME AT Service.
+ ///
+ /// See ATHI_GET_PUBLIC_KEY_CMD
+ ///
+ ATHI_GENERAL_GRP_SET_PUBLIC_KEY_CMD,
+
+ ///
+ /// The GetPublicKey command returns the specified public key of an RSA
+ /// key-pair owned by the ME AT Service.
+ ///
+ /// See ATHI_GET_PUBLIC_KEY_CMD
+ ///
+ ATHI_GENERAL_GRP_GET_PUBLIC_KEY_CMD,
+
+ ///
+ /// The GetEventHistory command retrieves entries from the AT Event History
+ /// in the ME.
+ ///
+ /// See ATHI_GET_EVENT_HISTORY_CMD
+ ///
+ ATHI_GENERAL_GRP_GET_EVENT_HISTORY_CMD,
+
+ ///
+ /// The ClearEventHistory command deletes all entries from the AT Event
+ /// History in the ME.
+ ///
+ /// See ATHI_CLEAR_EVENT_HISTORY_CMD
+ ///
+ ATHI_GENERAL_GRP_CLEAR_EVENT_HISTORY_CMD,
+
+ ///
+ /// The SetSysTime command synchronizes the time between the FW with the
+ /// AT server.
+ ///
+ /// See ATHI_SET_SYS_TIME_CMD
+ ///
+ ATHI_GENERAL_GRP_SET_SYS_TIME_CMD,
+
+ ///
+ /// The Set Supend Mode command requests FW transition
+ /// into or out of Suspend Mode.
+ ///
+
+ ATHI_GENERAL_GRP_SET_SUSPEND_CMD = 8,
+
+ ///
+ /// Bounday check.
+ ///
+ ATHI_GENERAL_GRP_MAX
+} ATHI_GENERAL_GRP_CMD;
+
+///
+/// ATHI 3G WWAN Commands
+///
+typedef enum _ATHI_3G_NIC_GRP_CMD
+{ ///
+ /// 3G NIC Init Command tells FW to intialize the NIC radio
+ ///
+ ATHI_3G_NIC_GRP_INIT_CMD = 3,
+
+ ///
+ /// The 3G NIC Query Command asks FW about the status of the NIC radio
+ ///
+ ATHI_3G_NIC_GRP_QUERY_CMD,
+
+ ///
+ /// Bounday check.
+ ///
+ ATHI_3G_NIC_GRP_MAX
+} ATHI_3G_NIC_GRP_CMD;
+
+///
+/// The GetNonce command. Requests that the ME AT Service generate and return
+/// a nonce to be used in a subsequent ATHI command. The nonce prevents
+/// replay of a command.
+///
+/// Sender: ISV SW
+/// Signing Key: Any
+///
+/// Refer to AtHiGetNonceCmd.dot "GetNonce command"
+///
+/// See ATHI_GET_NONCE_RSP
+///
+typedef ATHI_BASIC_CMD ATHI_GET_NONCE_CMD;
+
+///
+/// The GetNonce response.
+///
+/// Refer to AtHiGetNonceRsp.dot "GetNonce response"
+///
+typedef struct _ATHI_GET_NONCE_RSP {
+ ATHI_HEADER Header;
+ ATHI_COMPLETION_CODE CompletionCode;
+ AT_NONCE Nonce;
+} ATHI_GET_NONCE_RSP;
+
+///
+/// ATHI NOTIFICATION Group Commands
+///
+typedef enum _ATHI_NOTIFICATION_GRP_CMD
+{
+ ///
+ /// A PBA sends a PBALogon notification message to notify the ME AT service
+ /// of a successful user logon.
+ ///
+ /// See ATHI_PBA_LOGON
+ ///
+ ATHI_NOTIFICATION_GRP_PBA_LOGON,
+
+ ///
+ /// Bounday check.
+ ///
+ ATHI_NOTIFICATION_GRP_MAX
+} ATHI_NOTIFICATION_GRP_CMD;
+
+///
+/// PBALogon notification. Notifies the ME AT service of a successful user logon.
+///
+/// Sender: PBA
+/// Signing Key: PBASK
+///
+/// Refer to AtHiPbaLogonNotify.dot "PBALogon notification"
+///
+/// See ATHI_GET_NONCE_RSP
+///
+typedef ATHI_BASIC_CMD ATHI_PBA_LOGON_NOTIFY;
+
+///
+/// The GetNonce response.
+///
+/// Refer to AtHiPbaLogonAck.dot "PBALogon ack"
+///
+typedef ATHI_BASIC_RSP ATHI_PBA_LOGON_ACK;
+
+///
+/// ATHI DATA STORAGE Group Commands
+///
+typedef enum _ATHI_DATA_STORE_GRP_CMD
+{
+ ///
+ /// SetBlob stores data in the ME AT FDE/FLE ISV non-volatile storage area.
+ ///
+ /// See #ATHI_SET_BLOB_CMD.
+ ///
+ ATHI_DATA_STORE_GRP_SET_BLOB_CMD,
+
+ ///
+ /// GetBlob returns the data stored in the ME AT FDE/FLE ISV non-volatile
+ /// storage area.
+ ///
+ /// See ATHI_GET_BLOB_CMD.
+ ///
+ ATHI_DATA_STORE_GRP_GET_BLOB_CMD,
+
+ ///
+ /// Stores a vendor string the ME's non-volatile storage area.
+ ///
+ /// See ATHI_SET_VENDOR_STRING_CMD
+ ///
+ ATHI_DATA_STORE_GRP_SET_VENDOR_STRING_CMD,
+
+ ///
+ /// Retrieves the vendor string from the ME's non-volatile storage area.
+ ///
+ /// See ATHI_GET_VENDOR_STRING_CMD
+ ///
+ ATHI_DATA_STORE_GRP_GET_VENDOR_STRING_CMD,
+
+ ///
+ /// Bounday check.
+ ///
+ ATHI_DATA_STORE_GRP_MAX
+} ATHI_DATA_STORE_GRP_CMD;
+
+///
+/// This enumeration defines the vendor string identifiers.
+///
+typedef enum _AT_VENDOR_STRING_ID
+{
+ ///
+ /// Reserved.
+ ///
+ AT_VENDOR_STRING_ID_RSVD = 0,
+
+ ///
+ /// User defined recovery passphrase
+ ///
+ AT_VENDOR_STRING_ID_RECOVERY_HELP,
+ ///
+ /// AT_VENDOR_STRING_ID_RECOVERY_HELP,
+ ///
+
+ ///
+ /// Server generated random token
+ ///
+ AT_CUSTOM_RECOVERY_ID_CONFIGURATIONS,
+
+ ///
+ /// Boundary check.
+ ///
+ AT_VENDOR_STRING_ID_MAX
+} AT_VENDOR_STRING_ID;
+
+///
+/// Maximum blob data size.
+///
+#define AT_VENDOR_STRING_LENGTH_MAX 256
+
+///
+/// The SetVendorString command. Stores a vendor string the ME's
+/// non-volatile storage area.
+///
+/// Sender: ISV SW
+/// Signing Key: TSSK
+///
+/// See ATHI_SET_VENDOR_STRING_RSP
+///
+typedef struct _ATHI_SET_VENDOR_STRING_CMD {
+ ATHI_HEADER Header;
+ UINT8 Id;
+ UINT8 Reserved[3];
+ AT_BLOB String;
+} ATHI_SET_VENDOR_STRING_CMD;
+
+///
+/// The SetVendorString response.
+///
+typedef ATHI_BASIC_RSP ATHI_SET_VENDOR_STRING_RSP;
+
+///
+/// The GetVendorString command. Retrieves the vendor string data from the ME's
+/// non-volatile storage area.
+///
+/// Sender: ISV SW
+/// Signing Key: None
+///
+/// See ATHI_GET_VENDOR_STRING_RSP
+///
+typedef struct _ATHI_GET_VENDOR_STRING_CMD {
+ ATHI_HEADER Header;
+ UINT8 Id;
+} ATHI_GET_VENDOR_STRING_CMD;
+
+///
+/// The GetVendorString response.
+///
+/// Sender: ISV SW
+/// Signing Key: None
+///
+///
+typedef struct _ATHI_GET_VENDOR_STRING_RSP {
+ ATHI_HEADER Header;
+ ATHI_COMPLETION_CODE CompletionCode;
+ AT_BLOB String;
+} ATHI_GET_VENDOR_STRING_RSP;
+
+///
+/// The SendAssertStolen Request
+///
+/// Sender: ISV SW
+/// Signing Key: None
+///
+///
+typedef struct _ATHI_ASSERT_STOLEN_CMD {
+ ATHI_HEADER Header;
+ UINT32 DelayTime;
+} ATHI_ASSERT_STOLEN_CMD;
+
+///
+/// The SendAssertStolen response.
+///
+typedef ATHI_BASIC_RSP ATHI_ASSERT_STOLEN_RSP;
+
+///
+/// The Set Supend State Request Message
+///
+/// Sender: BIOS
+/// Signing Key: SSTK One Time Token
+///
+///
+typedef struct _ATHI_SET_SUSPEND_STATE_CMD {
+ ATHI_HEADER Header;
+ UINT32 TransitionState; /// 0=Exit, 1=Enter
+ AT_CREDENTIAL Credential;
+} ATHI_SET_SUSPEND_STATE_CMD;
+
+///
+/// The Set Supend State Response Message
+///
+/// Sender: FW
+/// Signing Key: None
+///
+///
+typedef struct _ATHI_SET_SUSPEND_STATE_RSP {
+ ATHI_HEADER Header;
+ UINT32 CompletionCode;
+} ATHI_SET_SUSPEND_STATE_RSP;
+
+///
+/// The Initialize WWAN Recovery Request Message
+///
+/// Sender: BIOS
+/// Signing Key: None
+///
+///
+typedef struct _ATHI_INIT_WWAN_RECOV_CMD {
+ ATHI_HEADER Header;
+} ATHI_INIT_WWAN_RECOV_CMD;
+
+///
+/// The Initialize WWAN Recovery Response Message
+///
+/// Sender: FW
+/// Signing Key: None
+///
+///
+typedef struct _ATHI_INIT_WWAN_RECOV_RSP {
+ ATHI_HEADER Header;
+ UINT32 CompletionCode;
+} ATHI_INIT_WWAN_RECOV_RSP;
+
+///
+/// The Initialize WWAN Status Request Message
+///
+/// Sender: BIOS
+/// Signing Key: None
+///
+///
+typedef struct _ATHI_WWAN_STATUS_CMD {
+ ATHI_HEADER Header;
+} ATHI_WWAN_STATUS_CMD;
+
+///
+/// The Initialize WWAN Status Response Message
+///
+/// Sender: FW
+/// Signing Key: None
+///
+///
+typedef struct _ATHI_WWAN_STATUS_RSP {
+ ATHI_HEADER Header;
+ UINT32 CompletionCode;
+ UINT8 RadioStatus;
+ UINT8 NetworkStatus;
+} ATHI_WWAN_STATUS_RSP;
+
+#pragma pack()
+
+#endif // _AT_HI_H
diff --git a/ReferenceCode/ME/BiosExtension/BiosExtension.cif b/ReferenceCode/ME/BiosExtension/BiosExtension.cif
new file mode 100644
index 0000000..a41f8ee
--- /dev/null
+++ b/ReferenceCode/ME/BiosExtension/BiosExtension.cif
@@ -0,0 +1,9 @@
+<component>
+ name = "BiosExtension"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\BiosExtension\"
+ RefName = "BiosExtension"
+[parts]
+"BiosExtensionLoader"
+"EfiMebx"
+<endComponent>
diff --git a/ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/BiosExtensionLoader.c b/ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/BiosExtensionLoader.c
new file mode 100644
index 0000000..ce16459
--- /dev/null
+++ b/ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/BiosExtensionLoader.c
@@ -0,0 +1,1273 @@
+/** @file
+ Loads the AMT Bios Extensions and calls the module prior to boot.
+ Setup options control whether the user is allowed to change the provisioning of AMT
+ or not for boot speed optimization.
+
+ Configuration and invokation of the AMT Bios Extensions is done as per
+ the AMT Bios Writers Guide.
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights
+ reserved This software and associated documentation (if any)
+ is furnished under a license and may only be used or copied in
+ accordance with the terms of the license. Except as permitted
+ by such license, no part of this software or documentation may
+ be reproduced, stored in a retrieval system, or transmitted in
+ any form or by any means without the express written consent
+ of Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "BiosExtensionLoader.h"
+#include "MeLib.h"
+#include "MeChipset.h"
+#include "PchPlatformLib.h"
+#include "AmtPolicyLib.h"
+#endif
+
+extern DXE_AMT_POLICY_PROTOCOL *mDxePlatformAmtPolicy;
+BOOLEAN mFirstBoot;
+
+ME_BIOS_EXTENSION_SETUP mMeBiosExtensionSetup = {0};
+
+UINT32 mMebxSetupVariableAttributes;
+UINTN mMebxSetupVariableDataSize;
+AMT_READY_TO_BOOT_PROTOCOL mAmtReadyToBoot = { AmtReadyToBoot };
+UINT8 mFwImageType;
+UINT8 mFwPlatformBrand;
+BOOLEAN mFwMediaTableReqAvail = FALSE;
+BOOLEAN mFwMediaTablePush = FALSE;
+BOOLEAN mMebxLaunched = FALSE;
+EFI_HANDLE mImageHandle;
+
+/**
+ Signal a event for Amt ready to boot.
+
+ @param[in] None
+
+ @retval EFI_SUCCESS Mebx launched or no controller
+**/
+EFI_STATUS
+EFIAPI
+AmtReadyToBoot (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ EFI_HECI_PROTOCOL *Heci;
+ UINT32 MeStatus;
+
+ ///
+ /// only launch MEBx once during POST
+ ///
+ if (mMebxLaunched) {
+ return EFI_SUCCESS;
+ }
+
+ mMebxLaunched = TRUE;
+
+ ///
+ /// Launch MEBx, do not assert on error as this may be valid case
+ ///
+ Status = MebxNotifyEvent ();
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+
+ if (!EFI_ERROR (Status)) {
+ ///
+ /// Check ME Status
+ ///
+ Status = Heci->GetMeStatus (&MeStatus);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Send WDT message when ME is ready. Do not care about if ME FW INIT is completed.
+ ///
+ if (ME_STATUS_ME_STATE_ONLY (MeStatus) == ME_READY) {
+ if (AmtWatchDog ()) {
+ ///
+ /// Stop BIOS ASF Watch Dog before ready to boot
+ ///
+ AsfStopWatchDog ();
+ ///
+ /// Start OS ASF Watch Dog
+ ///
+ AsfStartWatchDog (ASF_START_OS_WDT);
+ }
+ ///
+ /// End of watch dog setup option
+ ///
+ }
+ }
+ //
+ // End of EFI_ERROR of locate HECI driver
+ //
+ return EFI_SUCCESS;
+}
+
+/**
+ Create the FRU table to send to AMT FW
+
+ @param[in] AssetTableData Buffer of all Asset tables to send to FW
+ @param[in] AmtData Structure holds BIOS pointers for Asset tables
+
+ @retval EFI_SUCCESS FRU table calculated
+**/
+EFI_STATUS
+CalulateFruTable (
+ TABLE_PUSH_DATA *AssetTableData,
+ AMT_DATA *AmtData
+ )
+{
+
+ PCI_DEV_INFO PciDevInfoPtr;
+ HWAI_FRU_TABLE *FruHeader;
+ HWAI_PCI_FRU *PciFru;
+ UINT32 TableAddress;
+ UINT16 i;
+
+ i = 0;
+ AssetTableData->Tables[HWAI_TABLE_TYPE_INDEX_FRU_DEVICE].Offset = 0;
+
+ FruHeader = (HWAI_FRU_TABLE *) &AssetTableData->TableData[0];
+ PciFru = (HWAI_PCI_FRU *) &FruHeader->Data[0];
+
+ CopyMem (&PciDevInfoPtr, (VOID *) (UINTN) AmtData->PciDevAssertInfoPtr, sizeof (PCI_DEV_INFO));
+
+ if (AmtData->SupportedTablesFlags & MEBX_STF_PCI_DEV_TABLE) {
+ FruHeader->StructureCount = PciDevInfoPtr.PciDevCount;
+ } else {
+ FruHeader->StructureCount = 0;
+ }
+
+ TableAddress = (UINT32) AmtData->PciDevAssertInfoPtr + sizeof (PCI_DEV_INFO);
+
+ if (FruHeader->StructureCount) {
+ FruHeader->TableByteCount = FruHeader->StructureCount * sizeof (HWAI_PCI_FRU);
+ for (i = 0; i < FruHeader->StructureCount; i++) {
+ PciFru->SmbiosType = 0;
+ PciFru->Length = sizeof (HWAI_PCI_FRU);
+ PciFru->SmbiosHandle = 0;
+ PciFru->FruType = HWAI_FRU_TYPE_PCI;
+ CopyMem (&PciFru->FruData, (VOID *) (UINTN) TableAddress, sizeof (HWAI_PCI_DATA));
+ ++PciFru;
+ TableAddress += sizeof (HWAI_PCI_DATA);
+ }
+ } else {
+ FruHeader->TableByteCount = 0;
+ }
+
+ AssetTableData->Tables[HWAI_TABLE_TYPE_INDEX_FRU_DEVICE].Length = FruHeader->TableByteCount +
+ sizeof (FruHeader->StructureCount) + sizeof (FruHeader->TableByteCount);
+
+ return EFI_SUCCESS;
+
+}
+
+/**
+ Create the Media table to send to AMT FW
+
+ @param[in] AssetTableData Buffer of all Asset tables to send to FW
+ @param[in] TableOffset Offset into AssetTableData that Media table will be located
+ @param[in] AmtDataPtr Structure holds BIOS pointers for Asset tables
+
+ @retval EFI_SUCCESS Media table created
+**/
+EFI_STATUS
+CalulateMediaTable (
+ TABLE_PUSH_DATA *AssetTableData,
+ UINT16 TableOffset,
+ AMT_DATA *AmtDataPtr
+ )
+{
+
+ HWAI_MEDIA_TABLE *MediaHeaderPtr;
+ HWAI_MEDIA_ENTRY *MediaEntryPtr;
+ MEDIA_DEV_INFO MediaDevStruct;
+ UINT32 TableAddress;
+ UINT16 i;
+
+ i = 0;
+
+ AssetTableData->Tables[HWAI_TABLE_TYPE_INDEX_MEDIA_DEVICE].Offset = TableOffset;
+
+ MediaHeaderPtr = (HWAI_MEDIA_TABLE *) &AssetTableData->TableData[TableOffset];
+ MediaEntryPtr = (HWAI_MEDIA_ENTRY *) &MediaHeaderPtr->Data[0];
+
+ CopyMem (&MediaDevStruct, (VOID *) (UINTN) AmtDataPtr->MediaDevAssetInfoPtr, sizeof (MEDIA_DEV_INFO));
+ TableAddress = (UINT32) AmtDataPtr->MediaDevAssetInfoPtr + sizeof (MEDIA_DEV_INFO);
+
+ if (!(AmtDataPtr->SupportedTablesFlags & MEBX_STF_MEDIA_DEV_TABLE)) {
+ MediaHeaderPtr->TableByteCount = 0;
+ AssetTableData->Tables[HWAI_TABLE_TYPE_INDEX_MEDIA_DEVICE].Length = 0;
+ return EFI_SUCCESS;
+ }
+
+ MediaHeaderPtr->StructureCount = MediaDevStruct.MediaDevCount;
+ MediaHeaderPtr->TableByteCount = (MediaHeaderPtr->StructureCount * sizeof (HWAI_MEDIA_ENTRY));
+ for (i = 0; i < MediaHeaderPtr->StructureCount; i++) {
+ MediaEntryPtr->Length = sizeof (HWAI_MEDIA_ENTRY);
+ MediaEntryPtr->SmbiosHandle = 0;
+ MediaEntryPtr->SmbiosType = 0;
+
+ CopyMem (&MediaEntryPtr->MediaData, (VOID *) (UINTN) TableAddress, sizeof (HWAI_MEDIA_DATA));
+ ++MediaEntryPtr;
+ TableAddress += sizeof (HWAI_MEDIA_DATA);
+ }
+
+ AssetTableData->Tables[HWAI_TABLE_TYPE_INDEX_MEDIA_DEVICE].Length = MediaHeaderPtr->TableByteCount +
+ sizeof (MediaHeaderPtr->StructureCount) + sizeof (MediaHeaderPtr->TableByteCount);
+
+ return EFI_SUCCESS;
+
+}
+
+/**
+ Create the SMBIOS table to send to AMT FW
+
+ @param[in] AssetTableData Buffer of all Asset tables to send to FW
+ @param[in] TableOffset Offset into AssetTableData that the SMBIOS table will be located
+ @param[in] PtrSmbiosTable Pointer to BIOS SMBIOS tables
+
+ @retval EFI_ABORTED PtrSmbiosTable data is invalid.
+ @retval EFI_SUCCESS Smbios table created.
+**/
+EFI_STATUS
+CalulateSmbiosTable (
+ TABLE_PUSH_DATA *AssetTableData,
+ UINT16 TableOffset,
+ UINT32 PtrSmbiosTable
+ )
+{
+
+ SMBIOS_ENTRY_POINT SmbEntryStruct;
+ SMBIOS_HEADER *SmbiosHeaderPtr;
+ SMBIOS_TABLE_TYPE_ONE *Type1Ptr;
+ SMBIOS_TABLE_TYPE_THREE *Type3Ptr;
+ SMBIOS_TABLE_TYPE_FOUR *Type4Ptr;
+ SMBIOS_TABLE_TYPE_TWENTY_THREE *Type23Ptr;
+ UINT32 TableAddress;
+ UINT16 OrignalTableOffset;
+ UINT16 StringCounter;
+ UINT8 DataByte;
+ BOOLEAN EndOfTable;
+ BOOLEAN EndOfEntry;
+ BOOLEAN PreviousNull;
+ BOOLEAN KeepEntry;
+
+ OrignalTableOffset = 0;
+ StringCounter = 1;
+ DataByte = 0;
+ EndOfTable = FALSE;
+ EndOfEntry = FALSE;
+ PreviousNull = FALSE;
+ KeepEntry = FALSE;
+
+ OrignalTableOffset = TableOffset;
+ AssetTableData->Tables[HWAI_TABLE_TYPE_INDEX_SMBIOS].Offset = OrignalTableOffset;
+
+ CopyMem (&SmbEntryStruct, (VOID *) (UINTN) PtrSmbiosTable, sizeof (SMBIOS_ENTRY_POINT));
+
+ if (SmbEntryStruct.Signature != SMB_SIG) {
+ DEBUG ((EFI_D_ERROR, "CalulateSmbiosTable Error: SmbEntryStruct.Signature != SMB_SIG\n"));
+ return EFI_ABORTED;
+ }
+
+ if (SmbEntryStruct.TableLength == 0) {
+ DEBUG ((EFI_D_ERROR, "CalulateSmbiosTable Error: TableSize == 0\n"));
+ return EFI_ABORTED;
+ }
+
+ if (SmbEntryStruct.TableLength > (MAX_ASSET_TABLE_ALLOCATED_SIZE - TableOffset)) {
+ DEBUG (
+ (EFI_D_ERROR,
+ "SMBIOS Tables Are Larger Than 0x%x\n",
+ (MAX_ASSET_TABLE_ALLOCATED_SIZE - TableOffset))
+ );
+ return EFI_ABORTED;
+ }
+
+ TableAddress = SmbEntryStruct.TableAddress;
+
+ while (!EndOfTable) {
+
+ CopyMem (&AssetTableData->TableData[TableOffset], (VOID *) (UINTN) TableAddress, sizeof (SMBIOS_HEADER));
+
+ SmbiosHeaderPtr = (SMBIOS_HEADER *) &AssetTableData->TableData[TableOffset];
+
+ switch (SmbiosHeaderPtr->Type) {
+ case 13:
+ case 15:
+ case 25:
+ case 32:
+ KeepEntry = FALSE;
+ ///
+ /// Not needed by AMT
+ ///
+ break;
+
+ case 127:
+ KeepEntry = TRUE;
+ EndOfTable = TRUE;
+ break;
+
+ default:
+ KeepEntry = TRUE;
+
+ }
+
+ if (KeepEntry) {
+ TableOffset += sizeof (SMBIOS_HEADER);
+ TableAddress += sizeof (SMBIOS_HEADER);
+
+ CopyMem (
+ &AssetTableData->TableData[TableOffset],
+ (VOID *) (UINTN) TableAddress,
+ (SmbiosHeaderPtr->Length - sizeof (SMBIOS_HEADER))
+ );
+
+ ///
+ /// Make any need modifications to entrys with changing fields
+ ///
+ switch (SmbiosHeaderPtr->Type) {
+ case 1:
+ Type1Ptr = (SMBIOS_TABLE_TYPE_ONE *) SmbiosHeaderPtr;
+ Type1Ptr->WakeUp = 0;
+ break;
+
+ case 3:
+ Type3Ptr = (SMBIOS_TABLE_TYPE_THREE *) SmbiosHeaderPtr;
+ Type3Ptr->BootState = 0;
+ Type3Ptr->PowerSupplyState = 0;
+ Type3Ptr->ThermalState = 0;
+ Type3Ptr->SecurityStatus = 0;
+ break;
+
+ case 4:
+ Type4Ptr = (SMBIOS_TABLE_TYPE_FOUR *) SmbiosHeaderPtr;
+ Type4Ptr->MaxSpeed = Type4Ptr->MaxSpeed - (Type4Ptr->MaxSpeed % 100);
+ Type4Ptr->CurrentSpeed = Type4Ptr->CurrentSpeed - (Type4Ptr->CurrentSpeed % 100);
+ break;
+
+ case 23:
+ Type23Ptr = (SMBIOS_TABLE_TYPE_TWENTY_THREE *) SmbiosHeaderPtr;
+ Type23Ptr->ResetCount = 0;
+ break;
+
+ default:
+ break;
+ }
+ ///
+ /// update both table pointer and scratch offset to be beyond this entry
+ ///
+ TableOffset += (SmbiosHeaderPtr->Length - sizeof (SMBIOS_HEADER));
+ TableAddress += (SmbiosHeaderPtr->Length - sizeof (SMBIOS_HEADER));
+
+ } else {
+ ///
+ /// skip this entry
+ /// Move table address to beyond this entry, do not change scratch table offset
+ ///
+ TableAddress += SmbiosHeaderPtr->Length;
+ }
+ ///
+ /// Copy any remaining unformatted data til end of type structure
+ /// that is marked by double NULL bytes.
+ ///
+ EndOfEntry = FALSE;
+ PreviousNull = FALSE;
+ do {
+ ///
+ /// Read byte from bios data
+ ///
+ CopyMem (&DataByte, (VOID *) (UINTN) TableAddress++, 1);
+ if (DataByte == 0x00) {
+ if (SmbiosHeaderPtr->Type == 0) {
+ StringCounter++;
+
+ }
+
+ if (PreviousNull) {
+ ///
+ /// this null marks end of entry
+ ///
+ EndOfEntry = TRUE;
+ } else {
+ ///
+ /// flag we have seen first null
+ ///
+ PreviousNull = TRUE;
+ }
+ } else {
+ ///
+ /// clear null that terminated string
+ ///
+ PreviousNull = FALSE;
+
+ }
+
+ if (KeepEntry) {
+ AssetTableData->TableData[TableOffset++] = DataByte;
+
+ }
+
+ } while (!EndOfEntry);
+
+ }
+ ///
+ /// while !EndOfTable
+ ///
+ AssetTableData->Tables[HWAI_TABLE_TYPE_INDEX_SMBIOS].Length = TableOffset - OrignalTableOffset;
+
+ return EFI_SUCCESS;
+
+}
+
+/**
+ Create the ASF table to send to AMT FW
+
+ @param[in] AssetTableData Buffer of all Asset tables to send to FW
+ @param[in] TableOffset Offset into AssetTableData that the ASF table will be located
+ @param[in] PtrAcpiRsdt Pointer to BIOS ASF constructed tables
+
+ @retval EFI_ABORTED AssetTableData data is invalid.
+ @retval EFI_SUCCESS ASF table created.
+**/
+EFI_STATUS
+CalulateAsfTable (
+ TABLE_PUSH_DATA *AssetTableData,
+ UINT16 TableOffset,
+ UINT32 PtrAcpiRsdt
+ )
+{
+
+ ACPI_HEADER *AcpiHeaderPtr;
+ UINT32 TableAddress;
+ UINT32 ListAddress;
+ UINT16 ArrayLength;
+
+ TableAddress = 0;
+
+ AssetTableData->Tables[HWAI_TABLE_TYPE_INDEX_ASF].Offset = TableOffset;
+
+ CopyMem ((UINT8 *) &AssetTableData->TableData[TableOffset], (VOID *) (UINTN) PtrAcpiRsdt, sizeof (ACPI_HEADER));
+
+ AcpiHeaderPtr = (ACPI_HEADER *) &AssetTableData->TableData[TableOffset];
+
+ if (AcpiHeaderPtr->Signature != RSDT_SIG) {
+ DEBUG ((EFI_D_ERROR, "ASF ACPI Signature Does Not Match\n"));
+ return EFI_ABORTED;
+ }
+
+ ArrayLength = (((UINT16) AcpiHeaderPtr->Length) - sizeof (ACPI_HEADER)) / sizeof (UINT32);
+ ListAddress = PtrAcpiRsdt + sizeof (ACPI_HEADER);
+
+ while (ArrayLength) {
+ ///
+ /// copy header at this new table address into scratch area
+ ///
+ CopyMem (&TableAddress, (VOID *) (UINTN) ListAddress, sizeof (UINT32));
+ CopyMem (&AssetTableData->TableData[TableOffset], (VOID *) (UINTN) TableAddress, sizeof (ACPI_HEADER));
+
+ if (AcpiHeaderPtr->Signature == ASF_SIG) {
+ break;
+
+ }
+
+ ArrayLength--;
+ ListAddress += sizeof (UINT32);
+ }
+
+ if (!ArrayLength) {
+ ///
+ /// We hit end of table
+ ///
+ DEBUG ((EFI_D_ERROR, "Did Not Find ASF Signature \n"));
+ return EFI_ABORTED;
+ }
+
+ CopyMem (&AssetTableData->TableData[TableOffset], (VOID *) (UINTN) TableAddress, AcpiHeaderPtr->Length);
+
+ AssetTableData->Tables[HWAI_TABLE_TYPE_INDEX_ASF].Length = (UINT16) AcpiHeaderPtr->Length;
+
+ return EFI_SUCCESS;
+
+}
+
+/**
+ Constructs each of the lower level asset tables
+
+ @param[in] AssetTablesData Buffer of all Asset tables to send to FW
+ @param[in] TablesSize Size of all tables combined
+ @param[in] AmtData Structure that holds all the BIOS constructed tables
+
+ @retval EFI_SUCCESS Tables crated.
+ @retval EFI_ABORTED AssetTableData data is invalid.
+**/
+EFI_STATUS
+CalculateTableData (
+ TABLE_PUSH_DATA*AssetTablesData,
+ UINT16 *TablesSize,
+ AMT_DATA *AmtData
+ )
+{
+
+ EFI_STATUS Status;
+ UINT16 TableOffset;
+
+ Status = EFI_SUCCESS;
+ TableOffset = 0;
+
+ Status = CalulateFruTable (AssetTablesData, AmtData);
+ if (EFI_ERROR (Status)) {
+ return Status;
+
+ }
+
+ TableOffset = AssetTablesData->Tables[HWAI_TABLE_TYPE_INDEX_FRU_DEVICE].Length;
+ Status = CalulateMediaTable (AssetTablesData, TableOffset, AmtData);
+ if (EFI_ERROR (Status)) {
+ return Status;
+
+ }
+
+ TableOffset = TableOffset + AssetTablesData->Tables[HWAI_TABLE_TYPE_INDEX_MEDIA_DEVICE].Length;
+ Status = CalulateSmbiosTable (AssetTablesData, TableOffset, AmtData->PtrSmbiosTable);
+ if (EFI_ERROR (Status)) {
+ return Status;
+
+ }
+
+ TableOffset = TableOffset + AssetTablesData->Tables[HWAI_TABLE_TYPE_INDEX_SMBIOS].Length;
+ Status = CalulateAsfTable (AssetTablesData, TableOffset, AmtData->PtrAcpiRsdt);
+ if (EFI_ERROR (Status)) {
+ return Status;
+
+ }
+
+ TableOffset = TableOffset + AssetTablesData->Tables[HWAI_TABLE_TYPE_INDEX_ASF].Length;
+
+ *TablesSize = TableOffset;
+
+ return EFI_SUCCESS;
+
+}
+
+/**
+ Constructs all asset tables and send them to FW
+
+ @param[in] AmtData Structure that holds all the BIOS constructed tables
+
+ @retval EFI_ABORTED Unable to allocate necessary AssetTableData data structure.
+**/
+EFI_STATUS
+SendAssetTables2Firmware (
+ AMT_DATA *AmtData
+ )
+{
+
+ EFI_HECI_PROTOCOL *Heci;
+ TABLE_PUSH_DATA *AssetTablesData;
+ EFI_STATUS Status;
+ UINT16 TableOffset;
+ UINT32 MeMode;
+ UINT32 MeStatus;
+
+ Status = EFI_SUCCESS;
+ TableOffset = 0;
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ AssetTablesData = AllocateZeroPool (sizeof (TABLE_PUSH_DATA) + MAX_ASSET_TABLE_ALLOCATED_SIZE);
+
+ if (AssetTablesData == NULL) {
+ DEBUG ((EFI_D_ERROR, "SendAssetTables2Firmware Error: Could not allocate Memory\n"));
+ return EFI_ABORTED;
+ }
+
+ Status = CalculateTableData (AssetTablesData, &TableOffset, AmtData);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "SendAssetTables2Firmware: Error calculating Asset tables - No Data Pushed\n"));
+ return Status;
+ }
+
+ Status = Heci->GetMeMode (&MeMode);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "SendAssetTables2Firmware: Could not read FW Mode\n"));
+ return Status;
+ }
+
+ Status = Heci->GetMeStatus (&MeStatus);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "SendAssetTables2Firmware: Could not read FW Status"));
+ return Status;
+ }
+
+ if ((MeMode == ME_MODE_NORMAL) && (ME_STATUS_ME_STATE_ONLY (MeStatus) == ME_READY)) {
+ Status = HeciAssetUpdateFwMsg (mImageHandle, AssetTablesData, TableOffset);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "SendAssetTables2Firmware Error: AssetUpdateFwMsg() returned Status %x\n", Status));
+ }
+ }
+
+ FreePool (AssetTablesData);
+
+ return Status;
+}
+
+/**
+ This routine is run at boot time.
+ 1) Initialize AMT library.
+ 2) Check if MEBx is required to be launched by user.
+ 3) Build and send asset tables to ME FW.
+ 4) Check USB provision.
+ 5) Hide unused AMT devices in prior to boot.
+
+ @param[in] None.
+
+ @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary data structure.
+ @retval EFI_NOT_FOUND 1.5M FW SKU detected - there is no MEBx on 1.5 FW SKU
+**/
+EFI_STATUS
+MebxNotifyEvent (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ UINT8 *CoreImage;
+ UINT8 *CallBackImage;
+ MEBX_BPF *MebxBiosParams;
+ AMT_DATA AmtData;
+ EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Acpi3RsdPtr;
+ EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Acpi2RsdPtr;
+ EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Acpi1RsdPtr;
+ EFI_ACTIVE_MANAGEMENT_PROTOCOL *Amt;
+ VOID *TempPointer;
+ USB_KEY_PROVISIONING *UsbKeyProvisioningData;
+ EFI_HANDLE Handle;
+ UINT8 InvokeMebx;
+ UINT8 Data8;
+ EFI_BOOT_MODE BootMode;
+ BOOLEAN WarmReset;
+ BOOLEAN SendTables;
+
+ DEBUG ((EFI_D_ERROR, "Entering BiosExtensionLoader Driver\n"));
+
+ MebxBiosParams = NULL;
+ CoreImage = NULL;
+ CallBackImage = NULL;
+ Amt = NULL;
+ Handle = NULL;
+ InvokeMebx = 0;
+ Data8 = 0;
+
+ ///
+ /// Verify FW SKU - dispatch correct images 5MB FW SKU only
+ ///
+ if (mFwImageType == FW_IMAGE_TYPE_1_5MB) {
+ ///
+ /// 1.5M FW SKU detected - there is no MEBx on 1.5 FW SKU
+ ///
+ Status = EFI_NOT_FOUND;
+ goto Done;
+ }
+
+ ///
+ /// Initialize MEBX Setup Variable
+ ///
+ mMebxSetupVariableAttributes = EFI_VARIABLE_BOOTSERVICE_ACCESS |
+ EFI_VARIABLE_RUNTIME_ACCESS |
+ EFI_VARIABLE_NON_VOLATILE;
+ mMebxSetupVariableDataSize = sizeof (ME_BIOS_EXTENSION_SETUP);
+
+ Status = gST->RuntimeServices->GetVariable (
+ gEfiMeBiosExtensionSetupName,
+ &gEfiMeBiosExtensionSetupGuid,
+ &mMebxSetupVariableAttributes,
+ &mMebxSetupVariableDataSize,
+ &mMeBiosExtensionSetup
+ );
+
+ if (EFI_ERROR (Status) || mMeBiosExtensionSetup.InterfaceVersion == 0) {
+ DEBUG ((EFI_D_ERROR, "MeBiosExtensionSetup variable does not exist: create with default values\n"));
+ ///
+ /// create the variable when not exist
+ ///
+ mFirstBoot = TRUE;
+
+ mMeBiosExtensionSetup.InterfaceVersion = MEBX_SETUP_VERSION;
+ mMeBiosExtensionSetup.Flags = 0;
+ mMeBiosExtensionSetup.PlatformMngSel = MEBX_SETUP_PLATFORM_MNT_DEFAULT;
+ mMeBiosExtensionSetup.AmtSolIder = MEBX_SETUP_SOL_IDER_DEFAULT;
+ mMeBiosExtensionSetup.RemoteAssistanceTriggerAvailablilty = 0;
+ mMeBiosExtensionSetup.KvmEnable = 0;
+ mMeBiosExtensionSetup.MebxDefaultSolIder = TRUE;
+
+ Status = gST->RuntimeServices->SetVariable (
+ gEfiMeBiosExtensionSetupName,
+ &gEfiMeBiosExtensionSetupGuid,
+ mMebxSetupVariableAttributes,
+ mMebxSetupVariableDataSize,
+ &mMeBiosExtensionSetup
+ );
+ ASSERT_EFI_ERROR (Status);
+ } else {
+ mFirstBoot = FALSE;
+ }
+
+#ifdef EFI_DEBUG
+ DEBUG ((EFI_D_ERROR, "mMeBiosExtensionSetup before calling MEBx:\n"));
+ DxeMebxSetupVariableDebugDump (&mMeBiosExtensionSetup);
+#endif
+
+#ifdef EFI_DEBUG
+ ///
+ /// Dump the AMT platform policy
+ ///
+ //
+ // The global mDxePlatformAmtPolicy is initialized by the driver
+ // entry point.
+ //
+ DxeAmtPolicyDebugDump ();
+#endif
+
+ ///
+ /// Allocate memory for BPF
+ ///
+ MebxBiosParams = AllocatePool (sizeof (MEBX_BPF));
+ ASSERT (MebxBiosParams != NULL);
+ if (MebxBiosParams == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ ZeroMem (MebxBiosParams, sizeof (MEBX_BPF));
+
+ ///
+ /// Init AMT Library, still launch MEBx even if AMT Library Init fail
+ ///
+ Status = AmtLibInit ();
+
+ ZeroMem ((VOID *) &AmtData, sizeof (AMT_DATA));
+
+ ///
+ /// Check if MEBx hotkey has been pressed in BIOS
+ ///
+ if (AmtHotkeyPressed ()) {
+ MebxBiosParams->OemFlags |= MEBX_USER_ENTERED_RESPONSE;
+ }
+ ///
+ /// Check if MEBx selection screen enabled
+ ///
+ if (AmtSelectionScreen ()) {
+ MebxBiosParams->OemFlags |= MEBX_RA_SELECTION_MENU;
+ }
+ ///
+ /// Check if UnConfigureMe request
+ ///
+ if (AmtUnConfigureMe ()) {
+ MebxBiosParams->OemFlags |= MEBX_UNCONFIGURE;
+ }
+ ///
+ /// Check if 'Hide UnConfigureMe Confirmation Prompt' request
+ ///
+ if (AmtHideUnConfigureMeConfPrompt ()) {
+ MebxBiosParams->OemFlags |= MEBX_HIDE_UNCONFIGURE_CONF_PROMPT;
+ }
+ ///
+ /// Check if want to show MEBx debug message
+ ///
+ if (AmtMebxDebugMsg ()) {
+ MebxBiosParams->OemFlags |= MEBX_DEBUG_MSG;
+ }
+
+ MebxBiosParams->BpfVersion = MEBX_VERSION;
+ MebxBiosParams->CpuReplacementTimeout = mDxePlatformAmtPolicy->AmtConfig.CpuReplacementTimeout;
+ MebxBiosParams->MeBiosSyncDataPtr = (UINT32) (UINTN) &mMeBiosExtensionSetup;
+ MebxBiosParams->MebxDebugFlags.Port80 = 1;
+
+ ///
+ /// pass OEM MEBx resolution settings through BPF
+ ///
+ MebxBiosParams->OemResolutionSettings.MebxGraphicsMode = mDxePlatformAmtPolicy->AmtConfig.MebxGraphicsMode;
+ MebxBiosParams->OemResolutionSettings.MebxNonUiTextMode = mDxePlatformAmtPolicy->AmtConfig.MebxNonUiTextMode;
+ MebxBiosParams->OemResolutionSettings.MebxUiTextMode = mDxePlatformAmtPolicy->AmtConfig.MebxUiTextMode;
+
+ AmtData.PciDevAssertInfoPtr = (UINT32) (UINTN) &mAmtPciFru;
+ AmtData.MediaDevAssetInfoPtr = (UINT32) (UINTN) &mAmtMediaFru;
+ AmtData.VersionInfo = AMT_DATA_VERSION;
+
+ ///
+ /// Setup CIRA data
+ ///
+ if (AmtCiraRequestTrigger ()) {
+ MebxBiosParams->ActiveRemoteAssistanceProcess = 1;
+ MebxBiosParams->CiraTimeout = AmtCiraRequestTimeout ();
+ }
+ ///
+ /// Now set the PCI devices
+ ///
+ Status = BuildPciFru ();
+ if (EFI_ERROR (Status)) {
+ goto Done;
+ }
+
+ if (mAmtPciFru.PciDevicesHeader.DevCount != 0) {
+ AmtData.SupportedTablesFlags |= MEBX_STF_PCI_DEV_TABLE;
+ }
+
+ ///
+ /// HW asset tables need to be sent when:
+ /// - FW asked for it, or
+ /// - FW is alive (brand!=0) and platform isn't booting from a warm reset unless it's first boot
+ ///
+ Data8 = PciRead8 (PCI_LIB_ADDRESS (ME_BUS, PCI_DEVICE_NUMBER_PCH_LPC, PCI_FUNCTION_NUMBER_PCH_LPC, R_PCH_LPC_GEN_PMCON_2));
+ WarmReset = (BOOLEAN) !!(Data8 & B_PCH_LPC_GEN_PMCON_MEM_SR);
+
+ SendTables = (mFwMediaTableReqAvail && mFwMediaTablePush) || (mFwPlatformBrand != NO_BRAND && (!WarmReset || mFirstBoot));
+
+ ///
+ /// ME BWG HWT_PushBIOSTables
+ /// Built Media List for 8.1 firmware onwards only if Firmware request it or full BIOS boot path (Note 2, 4)
+ /// Always built media list with older firmware (indicated by missing mFwMediaTableReqAvail)
+ /// Above all, don't waste time building media list if tables are not going to be sent.
+ ///
+ BootMode = GetBootModeHob();
+
+ if (SendTables &&
+ ((BootMode != BOOT_WITH_MINIMAL_CONFIGURATION && BootMode != BOOT_ON_S4_RESUME) ||
+ !mFwMediaTableReqAvail || (mFwMediaTableReqAvail && mFwMediaTablePush))) {
+ //
+ // Build Media List
+ //
+ BuildMediaList ();
+ AmtData.SupportedTablesFlags |= MEBX_STF_MEDIA_DEV_TABLE;
+ } else {
+ DEBUG ((EFI_D_INFO, "No Media Asset Table is sent\n"));
+ }
+
+ mUsbProvsionDone = FALSE;
+ ///
+ /// If user selected for USB provisioning, then only use the provisioning file.
+ ///
+ if (USBProvisionSupport ()) {
+ ///
+ /// Check USB Key Provision
+ ///
+ UsbKeyProvisioning ();
+ }
+ ///
+ /// fill in the USB provisioning data...
+ ///
+ if (mUsbProvsionDone == TRUE) {
+ UsbKeyProvisioningData = (USB_KEY_PROVISIONING *) (UINTN) AllocatePool (mUsbProvDataSize + sizeof (USB_KEY_PROVISIONING));
+ ASSERT (UsbKeyProvisioningData != NULL);
+ UsbKeyProvisioningData->USBKeyLocationInfo = (mUsbKeyPort << 16) |
+ (mUsbKeyBus << 8) |
+ (mUsbKeyDevice << 3) |
+ mUsbKeyFunction;
+ MebxBiosParams->UsbKeyDataStructurePtr = (UINT32) (UINTN) UsbKeyProvisioningData;
+ CopyMem (
+ (VOID *) ((UINTN) MebxBiosParams->UsbKeyDataStructurePtr + sizeof (USB_KEY_PROVISIONING)),
+ mUsbProvData,
+ mUsbProvDataSize
+ );
+ UsbConsumedDataRecordRemove ();
+ }
+ ///
+ /// Get SMBIOS table pointer.
+ ///
+ EfiGetSystemConfigurationTable (&gEfiSmbiosTableGuid, (VOID **) &TempPointer);
+ AmtData.PtrSmbiosTable = (UINT32) (UINTN) TempPointer;
+
+ ///
+ /// Find the AcpiSupport protocol returns RSDP (or RSD PTR) address.
+ ///
+ Status = EfiGetSystemConfigurationTable (&gEfiAcpi30TableGuid, (VOID *) &Acpi3RsdPtr);
+
+ if (EFI_ERROR (Status) || (Acpi3RsdPtr == NULL)) {
+ Status = EfiGetSystemConfigurationTable (&gEfiAcpi20TableGuid, (VOID *) &Acpi2RsdPtr);
+
+ if (EFI_ERROR (Status) || (Acpi2RsdPtr == NULL)) {
+ Status = EfiGetSystemConfigurationTable (&gEfiAcpiTableGuid, (VOID *) &Acpi1RsdPtr);
+ if (EFI_ERROR (Status) || (Acpi1RsdPtr == NULL)) {
+ DEBUG ((EFI_D_ERROR, "Error getting ACPI Table -> %r\n", Status));
+ goto Done;
+ } else {
+ AmtData.PtrAcpiRsdt = Acpi1RsdPtr->RsdtAddress;
+ }
+ } else {
+ AmtData.PtrAcpiRsdt = Acpi2RsdPtr->RsdtAddress;
+ }
+ } else {
+ AmtData.PtrAcpiRsdt = Acpi3RsdPtr->RsdtAddress;
+ }
+
+ ///
+ /// ME BWG HWT_PushBIOSTables
+ /// Send Tables to Firmware as long as not on warm reset and AMT not permanently disabled (brand = 0)
+ /// 8.1 firmware onwards, still send table to firmware as long as not on warm reset and AMT not permanently disable (note 2, 3)
+ /// 8.1 firmware onwards, warm reset with MediaPush set will send asset table to firmware (Note 1)
+ ///
+ if (SendTables) {
+ Status = SendAssetTables2Firmware (&AmtData);
+ DEBUG ((EFI_D_INFO, "Send Asset Tables to AMT FW - Status = 0x%x %r\n", Status));
+ }
+
+ ///
+ /// Check if firmware INVOKE_MEBX bit is set
+ ///
+ Data8 = 0;
+ Data8 = PciRead8 (PCI_LIB_ADDRESS (ME_BUS, ME_DEVICE_NUMBER, HECI_FUNCTION_NUMBER, R_ME_GS_SHDW));
+ InvokeMebx = (Data8 & INVOKE_MEBX_BIT) >> 3;
+ DEBUG ((EFI_D_ERROR, "InvokeMebx = 0x%x %r\n", InvokeMebx, Status));
+
+ ///
+ /// Check for BIOS invoke reason
+ ///
+ if (!InvokeMebx) {
+ CheckForBiosInvokeReason (&InvokeMebx, MebxBiosParams);
+
+ }
+
+ if (InvokeMebx) {
+ PERF_START_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x8000);
+ Status = AdjustAndExecuteMebxImage (MebxBiosParams);
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x8001);
+ }
+
+Done:
+ ///
+ /// Free up used RAM for MEBx as done now.
+ ///
+ if (MebxBiosParams != NULL) {
+ FreePool (MebxBiosParams);
+ }
+ ///
+ /// Hide the unused ME device. This will handle both cases MEBx running or not
+ ///
+ AmtDeviceConfigure (&mMeBiosExtensionSetup);
+
+ return Status;
+}
+
+/**
+ Check the status of Amt devices
+
+ @param[in] MeBiosExtensionSetupData MEBx setting data
+**/
+VOID
+AmtDeviceConfigure (
+ IN ME_BIOS_EXTENSION_SETUP *MeBiosExtensionSetupData
+ )
+{
+ if (mFirstBoot || (MeBiosExtensionSetupData->AmtSolIder & SOL_ENABLE) == 0) {
+ SolDisable ();
+ }
+
+ if (mFirstBoot || (MeBiosExtensionSetupData->AmtSolIder & IDER_ENABLE) == 0) {
+ IderDisable ();
+ }
+}
+
+/**
+ Detect EFI MEBx support; Loading and execute.
+
+ @param[in] MebxBiosParamsBuffer MebxBiosParams Flat pointer
+**/
+EFI_STATUS
+AdjustAndExecuteMebxImage (
+ IN VOID *MebxBiosParamsBuffer
+ )
+{
+ EFI_STATUS Status;
+ EFI_HECI_PROTOCOL *Heci;
+ MEBX_BPF *MebxBiosParams;
+ EFI_MEBX_PROTOCOL *MebxProtocol;
+ DATA32_UNION MebxExitCode;
+
+ MebxBiosParams = (MEBX_BPF *) MebxBiosParamsBuffer;
+
+ MebxExitCode.Data32 = 0;
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ DEBUG ((EFI_D_ERROR, "Calling MEBx\n"));
+
+ ///
+ /// Stop ASF Watch Dog before entering MEBx Setup
+ ///
+ AsfStopWatchDog ();
+
+ ///
+ /// Locate MEBX protocol
+ ///
+ Status = gBS->LocateProtocol (&gEfiMebxProtocolGuid, NULL, (VOID **) &MebxProtocol);
+ if (!EFI_ERROR (Status)) {
+#ifdef EFI_DEBUG
+ ///
+ /// Dump MebxBiosParams before launching MEBx
+ ///
+ DxeMebxBiosParamsDebugDump (MebxBiosParams);
+#endif
+ MebxProtocol->CoreMebxEntry ((UINT32) (UINTN) MebxBiosParams, (UINT32 *) &MebxExitCode);
+ }
+ ///
+ ///
+ /// Re-Start ASF Watch Dog after exiting MEBx Setup
+ ///
+ AsfStartWatchDog (ASF_START_BIOS_WDT);
+
+ DEBUG ((EFI_D_ERROR, "MEBx return BIOS_CMD_DATA:%x, BIOS_CMD:%x)\n", MebxExitCode.Data8[1], MebxExitCode.Data8[0]));
+ DEBUG ((EFI_D_ERROR, "MEBx return MEBX_STATUS_CODE:%x)\n", MebxExitCode.Data16[1]));
+
+ ///
+ /// Restore data record when needed
+ ///
+ if (mUsbProvsionDone == TRUE) {
+ CopyMem (
+ mUsbProvDataBackup,
+ (VOID *) ((UINTN) MebxBiosParams->UsbKeyDataStructurePtr + sizeof (USB_KEY_PROVISIONING)),
+ mUsbProvDataSize
+ );
+ UsbConsumedDataRecordRestore ();
+ }
+ ///
+ /// BIOS Sync-up DATA
+ ///
+ if (mMeBiosExtensionSetup.Flags == 1 || mMeBiosExtensionSetup.MebxDefaultSolIder == TRUE) {
+ mMeBiosExtensionSetup.Flags = 0;
+ mMeBiosExtensionSetup.MebxDefaultSolIder = FALSE;
+ ///
+ /// Update the variable to sync with MEBX Setup
+ ///
+ Status = gST->RuntimeServices->SetVariable (
+ gEfiMeBiosExtensionSetupName,
+ &gEfiMeBiosExtensionSetupGuid,
+ mMebxSetupVariableAttributes,
+ mMebxSetupVariableDataSize,
+ &mMeBiosExtensionSetup
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
+
+ switch (MebxExitCode.Data8[0] & MEBX_RET_CODE_MASK) {
+ ///
+ /// mask off reserved bits 3-7 from mebx exit status code
+ ///
+ case MEBX_RET_ACTION_CONTINUE_TO_BOOT:
+ REPORT_STATUS_CODE (
+ EFI_PROGRESS_CODE,
+ EFI_SOFTWARE_UNSPECIFIED | EFI_SW_DXE_MEBX_OPROM_DONE
+ );
+ break;
+
+ case MEBX_RET_ACTION_RESET:
+ REPORT_STATUS_CODE (
+ EFI_ERROR_CODE,
+ EFI_SOFTWARE_UNSPECIFIED | EFI_SW_DXE_MEBX_RESET_ACTION
+ );
+ if (!(MebxExitCode.Data8[1] & MEBX_RET_ACTION_GLOBAL_RESET)) {
+ DEBUG ((EFI_D_ERROR, "MEBx requires Global Reset.\n"));
+ HeciSendCbmResetRequest (CBM_RR_REQ_ORIGIN_BIOS_POST, CBM_HRR_GLOBAL_RESET);
+ } else {
+ DEBUG ((EFI_D_ERROR, "MEBx requires Host Reset.\n"));
+ gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
+ }
+
+ DEBUG ((EFI_D_ERROR, "No reset occurs after we get a reset cmd from MEBx.\n"));
+ EFI_DEADLOOP ();
+ break;
+
+ default:
+ REPORT_STATUS_CODE (
+ EFI_ERROR_CODE,
+ EFI_SOFTWARE_UNSPECIFIED | EFI_SW_DXE_MEBX_OTHER_UNSPECD
+ );
+ Status = EFI_NOT_STARTED;
+ break;
+ }
+
+#ifdef EFI_DEBUG
+ Status = gST->RuntimeServices->GetVariable (
+ gEfiMeBiosExtensionSetupName,
+ &gEfiMeBiosExtensionSetupGuid,
+ &mMebxSetupVariableAttributes,
+ &mMebxSetupVariableDataSize,
+ &mMeBiosExtensionSetup
+ );
+ DEBUG ((EFI_D_ERROR, "mMeBiosExtensionSetup after calling MEBx:\n"));
+ DxeMebxSetupVariableDebugDump (&mMeBiosExtensionSetup);
+#endif
+ ///
+ /// Send PET Alert Message
+ ///
+ /// BIOS Specific Code
+ ///
+ /// Indicate OS BOOT handoff so that PET/ASF Push msg can be sent out to indicate
+ /// all done now booting os.
+ ///
+ REPORT_STATUS_CODE (
+ EFI_PROGRESS_CODE,
+ EFI_SOFTWARE_UNSPECIFIED | EFI_SW_DXE_BS_PC_LEGACY_BOOT_EVENT
+ );
+
+ return Status;
+}
+
+/**
+ The driver entry point - MEBx Driver main body.
+
+ @param[in] ImageHandle Handle for this drivers loaded image protocol.
+ @param[in] SystemTable EFI system table.
+
+ @retval EFI_SUCCESS The driver installed without error.
+ @exception EFI_UNSUPPORTED The chipset is unsupported by this driver.
+**/
+EFI_STATUS
+MebxDriverEntry (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ EFI_HECI_PROTOCOL *Heci;
+ UINT32 MeMode;
+ EFI_HANDLE Handle;
+ DXE_MBP_DATA_PROTOCOL *MbpData;
+
+ mImageHandle = ImageHandle;
+ mFwImageType = FW_IMAGE_TYPE_5MB;
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Heci->GetMeMode (&MeMode);
+ if (MeMode != ME_MODE_NORMAL) {
+ return EFI_UNSUPPORTED;
+ }
+
+ ///
+ /// Init AMT Policy Library
+ ///
+ Status = AmtPolicyLibInit ();
+ if (EFI_ERROR (Status)) {
+ return EFI_UNSUPPORTED;
+ }
+
+ ///
+ /// Install an Amt ready to boot protocol.
+ ///
+ Handle = NULL;
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &Handle,
+ &gAmtReadyToBootProtocolGuid,
+ &mAmtReadyToBoot,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+ if (!EFI_ERROR (Status)) {
+ ///
+ /// Get the MBP Data.
+ ///
+ Status = gBS->LocateProtocol (&gMeBiosPayloadDataProtocolGuid, NULL, (VOID **) &MbpData);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "MEBx: No MBP Data Protocol available\n"));
+ return Status;
+ } else {
+ ///
+ /// Pass FW SKU Type
+ ///
+ mFwImageType = (UINT8) MbpData->MeBiosPayload.FwPlatType.RuleData.Fields.IntelMeFwImageType;
+ mFwPlatformBrand = (UINT8) MbpData->MeBiosPayload.FwPlatType.RuleData.Fields.PlatformBrand;
+ ///
+ /// Save for Later use when MBPdata is deallocated
+ ///
+ mFwMediaTableReqAvail = MbpData->MeBiosPayload.HwaRequest.Available;
+ mFwMediaTablePush = (BOOLEAN)MbpData->MeBiosPayload.HwaRequest.Data.Fields.MediaTablePush;
+ }
+ }
+
+ return Status;
+}
+
+/**
+ Detect BIOS invoke reasons.
+
+ @param[in] InvokeMebx Pointer to the Invoke MEBx flag
+ @param[in] MebxBiosParamsBuffer MebxBiosParams Flat pointer
+**/
+VOID
+CheckForBiosInvokeReason (
+ IN UINT8 *InvokeMebx,
+ IN MEBX_BPF *MebxBiosParams
+ )
+{
+ ///
+ /// Check for BIOS invoke reason
+ ///
+ if (MebxBiosParams->OemFlags & MEBX_USER_ENTERED_RESPONSE) {
+ DEBUG ((EFI_D_ERROR, "InvokeMebx Reason = MEBX_USER_ENTERED_RESPONSE %r\n"));
+ *InvokeMebx = 1;
+ }
+
+ if (MebxBiosParams->OemFlags & MEBX_UNCONFIGURE) {
+ DEBUG ((EFI_D_ERROR, "InvokeMebx Reason = MEBX_UNCONFIGURE %r\n"));
+ *InvokeMebx = 1;
+ }
+
+ if (MebxBiosParams->UsbKeyDataStructurePtr) {
+ DEBUG ((EFI_D_ERROR, "InvokeMebx Reason = UsbKeyDataStructurePtr %r\n"));
+ *InvokeMebx = 1;
+ }
+
+ if (MebxBiosParams->ActiveRemoteAssistanceProcess) {
+ DEBUG ((EFI_D_ERROR, "InvokeMebx Reason = ActiveRemoteAssistanceProcess %r\n"));
+ *InvokeMebx = 1;
+ }
+
+ if (AmtForcMebxSyncUp ()) {
+ DEBUG ((EFI_D_ERROR, "InvokeMebx Reason = forcing ME-BIOS sync-up %r\n"));
+ MebxBiosParams->OemFlags = 0;
+ *InvokeMebx = 1;
+ }
+
+ return ;
+}
diff --git a/ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/BiosExtensionLoader.cif b/ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/BiosExtensionLoader.cif
new file mode 100644
index 0000000..2984166
--- /dev/null
+++ b/ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/BiosExtensionLoader.cif
@@ -0,0 +1,18 @@
+<component>
+ name = "BiosExtensionLoader"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\BiosExtension\Efi\BiosExtensionLoader\Dxe\"
+ RefName = "BiosExtensionLoader"
+[files]
+"BiosExtensionLoader.sdl"
+"BiosExtensionLoader.mak"
+"BiosExtensionLoader.c"
+"BiosExtensionLoader.dxs"
+"BiosExtensionLoader.h"
+"Inventory.c"
+"Inventory.h"
+"UsbProvision.c"
+"UsbProvision.h"
+"BiosExtensionLoader.inf"
+"MebxBiosParamsDebugDumpDxe.c"
+<endComponent>
diff --git a/ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/BiosExtensionLoader.dxs b/ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/BiosExtensionLoader.dxs
new file mode 100644
index 0000000..d33438c
--- /dev/null
+++ b/ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/BiosExtensionLoader.dxs
@@ -0,0 +1,52 @@
+/** @file
+ Dependency expression file for BIOS Extension Invocation Driver.
+
+@copyright
+ Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "DxeDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+#include EFI_PROTOCOL_DEFINITION (Heci)
+#if (PI_SPECIFICATION_VERSION < 0x00010000)
+#include EFI_PROTOCOL_DEFINITION (FirmwareVolume)
+#else
+#include EFI_PROTOCOL_DEFINITION (FirmwareVolume2)
+#endif
+#include EFI_PROTOCOL_DEFINITION (AmtPlatformPolicy)
+#endif
+
+DEPENDENCY_START
+ EFI_HECI_PROTOCOL_GUID AND
+#if (PI_SPECIFICATION_VERSION < 0x00010000)
+ EFI_FIRMWARE_VOLUME_PROTOCOL_GUID AND
+#else
+ EFI_FIRMWARE_VOLUME2_PROTOCOL_GUID AND
+#endif
+ DXE_PLATFORM_AMT_POLICY_GUID
+DEPENDENCY_END
diff --git a/ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/BiosExtensionLoader.h b/ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/BiosExtensionLoader.h
new file mode 100644
index 0000000..c366d0b
--- /dev/null
+++ b/ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/BiosExtensionLoader.h
@@ -0,0 +1,440 @@
+/** @file
+ Include for AMT Bios Extentions Loader
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights
+ reserved This software and associated documentation (if any)
+ is furnished under a license and may only be used or copied in
+ accordance with the terms of the license. Except as permitted
+ by such license, no part of this software or documentation may
+ be reproduced, stored in a retrieval system, or transmitted in
+ any form or by any means without the express written consent
+ of Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _AMT_PTBX_H_
+#define _AMT_PTBX_H_
+
+#include "Acpi1_0.h"
+#include "Acpi2_0.h"
+#include "Acpi3_0.h"
+#include "MeAccess.h"
+#include "Inventory.h"
+#include "AmtLib.h"
+#include "UsbProvision.h"
+#include "Pci22.h"
+#include "AmtPlatformPolicy.h"
+
+#include EFI_PROTOCOL_CONSUMER (FirmwareVolume)
+#include EFI_PROTOCOL_CONSUMER (AcpiSupport)
+#include EFI_PROTOCOL_CONSUMER (DiskInfo)
+#include EFI_PROTOCOL_CONSUMER (BlockIO)
+#include EFI_PROTOCOL_CONSUMER (DevicePath)
+#include EFI_PROTOCOL_CONSUMER (IdeControllerInit)
+#include EFI_PROTOCOL_CONSUMER (AlertStandardFormat)
+#include EFI_PROTOCOL_CONSUMER (ActiveManagement)
+#include EFI_PROTOCOL_CONSUMER (Heci)
+#include EFI_PROTOCOL_CONSUMER (Smbus)
+#include EFI_PROTOCOL_CONSUMER (SimpleFileSystem)
+#include EFI_PROTOCOL_CONSUMER (Wdt)
+#include EFI_PROTOCOL_CONSUMER (MebxProtocol)
+
+#include EFI_GUID_DEFINITION (Smbios)
+#include EFI_GUID_DEFINITION (AcpiTableStorage)
+#include EFI_GUID_DEFINITION (Acpi)
+#include EFI_GUID_DEFINITION (Hob)
+#include EFI_GUID_DEFINITION (MeBiosExtensionSetup)
+#include EFI_PROTOCOL_DEFINITION (AmtPlatformPolicy)
+#include EFI_PROTOCOL_DEFINITION (MeplatformPolicy)
+#include EFI_PROTOCOL_DEFINITION (AmtReadyToBoot)
+
+#define MEBX_RET_ACTION_CONTINUE_TO_BOOT 0x01
+#define MEBX_RET_ACTION_RESET 0x04
+#define MEBX_RET_CODE_MASK 0x07
+
+#define MEBX_RET_ACTION_GLOBAL_RESET 0x01
+
+#define FW_IMAGE_TYPE_1_5MB 3
+#define FW_IMAGE_TYPE_5MB 4
+
+#define MEBX_USER_ENTERED_RESPONSE 0x0002
+#define MEBX_RA_SELECTION_MENU 0x0004
+#define MEBX_HIDE_UNCONFIGURE_CONF_PROMPT 0x0040
+#define MEBX_DEBUG_MSG 0x4000
+#define MEBX_UNCONFIGURE 0x8000
+
+#define MEBX_STF_PCI_DEV_TABLE 0x0001
+#define MEBX_STF_MEDIA_DEV_TABLE 0x0002
+
+#define MEBX_MEDIA_IN_ATA 0x0000
+#define MEBX_MEDIA_IN_ATAPI 0x0001
+#define MEBX_MEDIA_IN_SATA 0x0002
+
+#define MEBX_MEDIA_DT_HDD 0x0000
+#define MEBX_MEDIA_DT_CDROM 0x0001
+#define MEBX_MEDIA_DT_DVD 0x0002
+#define MEBX_MEDIA_DT_FDD 0x0003
+#define MEBX_MEDIA_DT_MO 0x0004
+
+//
+// MEBX Software Class DXE Subclass Progress Code definitions.
+//
+#define EFI_SW_DXE_MEBX_OPROM_DONE (EFI_OEM_SPECIFIC | 0x00000000)
+#define EFI_SW_DXE_MEBX_OTHER_UNSPECD (EFI_OEM_SPECIFIC | 0x00000009)
+#define EFI_SW_DXE_MEBX_RESET_ACTION (EFI_OEM_SPECIFIC | 0x0000000a)
+
+#pragma pack(1)
+
+#define DEVICES_LIST_VERSION 0x0001
+#define AMT_DATA_VERSION 0x0101
+#define MEBX_SETUP_VERSION 0x9000
+#define MEBX_VERSION 0x9000 ///< for MEBx 9.0.0 or later
+#define MEBX_SETUP_PLATFORM_MNT_DEFAULT MNT_OFF
+#define MEBX_SETUP_SOL_IDER_DEFAULT 0
+#define PCI_DEVICE_MAX_NUM 256
+#define MEDIA_DEVICE_MAX_NUM 32
+
+#define SMB_SIG 0x5F4D535F
+#define RSDT_SIG 0x54445352 ///< RSDT (in reverse)
+#define ASF_SIG 0x21465341 ///< ASF! (in reverse)
+#define ONEMIN 60000000
+#define FIVEMIN 300000000
+#define TENMIN 600000000
+
+#define INVOKE_MEBX_BIT 0x08
+
+typedef enum _HWAI_FRU_TYPE_
+{
+ HWAI_FRU_TYPE_NONE= 0,
+ HWAI_FRU_TYPE_PCI
+} HWAI_FRU_TYPE;
+
+typedef struct {
+ UINT16 VersionInfo;
+ UINT8 DevCount;
+ UINT8 Reserved1[5];
+} AMT_FRU_DEVICES_HEADER;
+
+typedef struct {
+ UINT16 Vid;
+ UINT16 Did;
+ UINT16 Rid;
+ UINT16 SubSysVid;
+ UINT16 SubSysDid;
+ UINT32 ClassCode;
+ UINT16 BusDevFcn;
+} MEBX_FRU_PCI_DEVICES;
+
+typedef struct {
+ AMT_FRU_DEVICES_HEADER PciDevicesHeader;
+ MEBX_FRU_PCI_DEVICES PciDevInfo[PCI_DEVICE_MAX_NUM];
+} AMT_PCI_FRU;
+
+typedef struct _PCI_DEV_INFO {
+ UINT16 VersionInfo;
+ UINT8 PciDevCount;
+ UINT8 Reserved[5];
+} PCI_DEV_INFO;
+
+typedef struct _HWAI_PCI_FRU_DATA_ {
+ UINT16 VendorID;
+ UINT16 DeviceID;
+ UINT16 RevID;
+ UINT16 SubsystemVendorID;
+ UINT16 SubsystemDeviceID;
+ UINT32 ClassCode;
+ UINT16 BusDevFunc;
+} HWAI_PCI_DATA;
+
+typedef struct _HWAI_PCI_FRU_ENTRY {
+ UINT8 SmbiosType;
+ UINT8 Length;
+ UINT16 SmbiosHandle;
+ UINT32 FruType;
+ HWAI_PCI_DATA FruData;
+} HWAI_PCI_FRU;
+
+typedef struct _HWAI_FRU_TABLE_HEADER {
+ UINT16 TableByteCount;
+ UINT16 StructureCount;
+ HWAI_PCI_FRU Data[1];
+} HWAI_FRU_TABLE;
+
+typedef struct _HWAI_MEDIA_DATA_ {
+ UINT16 Length;
+ UINT8 Interface;
+ UINT8 DevType;
+ UINT8 Manufacturer[40];
+ UINT8 SerialNumber[20];
+ UINT8 Version[8];
+ UINT8 ModelNumber[40];
+ UINT32 MaxMediaSizeLow;
+ UINT32 MaxMediaSizeHigh;
+ UINT16 Capabilities[3];
+} HWAI_MEDIA_DATA;
+
+typedef struct _HWAI_MEDIA_ENTRY {
+ UINT8 SmbiosType;
+ UINT8 Length;
+ UINT16 SmbiosHandle;
+ HWAI_MEDIA_DATA MediaData;
+} HWAI_MEDIA_ENTRY;
+
+typedef struct _HWAI_MEDIA_DEVICE_TABLE_HEADER {
+ UINT16 TableByteCount;
+ UINT16 StructureCount;
+ HWAI_MEDIA_ENTRY Data[1];
+} HWAI_MEDIA_TABLE;
+
+typedef struct _MEDIA_DEV_INFO {
+ UINT16 VersionInfo;
+ UINT8 MediaDevCount;
+ UINT8 Reserved[5];
+} MEDIA_DEV_INFO;
+
+typedef struct {
+ UINT16 StructSize;
+ UINT8 Interface;
+ UINT8 DevType;
+ UINT8 Rsvd[40];
+ UINT8 SerialNo[20];
+ UINT8 VersionNo[8];
+ UINT8 ModelNo[40];
+ UINT64 MaxMediaSize;
+ UINT16 SupportedCmdSets[3];
+} MEBX_FRU_MEDIA_DEVICES;
+
+typedef struct {
+ AMT_FRU_DEVICES_HEADER MediaDevicesHeader;
+ MEBX_FRU_MEDIA_DEVICES MediaDevInfo[MEDIA_DEVICE_MAX_NUM];
+} AMT_MEDIA_FRU;
+
+typedef struct _COMMON_HEADER_ {
+ UINT8 Type;
+ UINT8 Length;
+ UINT16 Handle;
+} SMBIOS_HEADER;
+
+typedef struct _SMBIOS_MAIN_ {
+ UINT32 Signature;
+ UINT8 EpChecksum;
+ UINT8 EpLength;
+ UINT8 MajorVersion;
+ UINT8 MinorVersion;
+ UINT16 MaxStruct_Size;
+ UINT8 EpRevision;
+ UINT8 RevInfo[5];
+ UINT8 DmiSignature[5]; ///< _DMI_
+ UINT8 IntChecksum;
+ UINT16 TableLength;
+ UINT32 TableAddress;
+ UINT16 StructureCnt;
+ UINT8 SmbBcdRevision;
+} SMBIOS_ENTRY_POINT;
+
+typedef struct _SMBIOS_TABLE_TYPE_ONE {
+ SMBIOS_HEADER Header;
+ UINT8 ManufacturerStr;
+ UINT8 ProductNameStr;
+ UINT8 VersionStr;
+ UINT8 SerialNumberStr;
+ UINT8 Uuid[16];
+ UINT8 WakeUp;
+} SMBIOS_TABLE_TYPE_ONE;
+
+typedef struct _SMBIOS_TABLE_TYPE_THREE {
+ SMBIOS_HEADER Header;
+ UINT8 ManufacturerStr;
+ UINT8 Type;
+ UINT8 VersionStr;
+ UINT8 SerialNumberStr;
+ UINT8 AssetTagStr;
+ UINT8 BootState;
+ UINT8 PowerSupplyState;
+ UINT8 ThermalState;
+ UINT8 SecurityStatus;
+ UINT32 VendorInfo;
+} SMBIOS_TABLE_TYPE_THREE;
+
+typedef struct _SMBIOS_TABLE_TYPE_FOUR {
+ SMBIOS_HEADER Header;
+ UINT8 SocketStr;
+ UINT8 Type;
+ UINT8 Family;
+ UINT8 Manufacturer;
+ UINT8 ProcId[8];
+ UINT8 VersionStr;
+ UINT8 Voltage;
+ UINT16 ExternalClock;
+ UINT16 MaxSpeed;
+ UINT16 CurrentSpeed;
+ UINT8 Status;
+ UINT8 Upgrade;
+ UINT16 L1CacheHandle;
+ UINT16 L2CacheHandle;
+ UINT16 L3CacheHandle;
+} SMBIOS_TABLE_TYPE_FOUR;
+
+typedef struct _SMBIOS_TABLE_TYPE_TWENTY_THREE {
+ SMBIOS_HEADER Header;
+ UINT8 Capabilities;
+ UINT16 ResetCount;
+ UINT16 ResetLimit;
+ UINT16 TimerInterval;
+ UINT16 Timeout;
+} SMBIOS_TABLE_TYPE_TWENTY_THREE;
+
+typedef struct _ACPI_DESCRIPTOR_HEADER_ {
+ UINT32 Signature;
+ UINT32 Length;
+ UINT8 Revision;
+ UINT8 Checksum;
+ UINT8 OemId[6];
+ UINT8 OemTableId[8];
+ UINT32 OemRevision;
+ UINT8 CreatorId[4];
+ UINT32 CreatorRev;
+} ACPI_HEADER;
+
+typedef struct _MEBX_DEBUG_FLAGS_ {
+ UINT16 Port80 : 1; ///< Port 80h
+ UINT16 Rsvd : 15; ///< Reserved
+} MEBX_DEBUG_FLAGS;
+
+typedef struct _MEBX_OEM_RESOLUTION_SETTINGS_ {
+ UINT16 MebxNonUiTextMode : 4;
+ UINT16 MebxUiTextMode : 4;
+ UINT16 MebxGraphicsMode : 4;
+ UINT16 Rsvd : 4;
+} MEBX_OEM_RESOLUTION_SETTINGS;
+
+typedef struct {
+ UINT16 BpfVersion;
+ UINT8 CpuReplacementTimeout;
+ UINT8 Reserved[7];
+ UINT8 ActiveRemoteAssistanceProcess;
+ UINT8 CiraTimeout;
+ UINT16 OemFlags;
+ MEBX_DEBUG_FLAGS MebxDebugFlags;
+ UINT32 MeBiosSyncDataPtr;
+ UINT32 UsbKeyDataStructurePtr;
+ MEBX_OEM_RESOLUTION_SETTINGS OemResolutionSettings;
+ UINT8 Reserved3[0x2E];
+} MEBX_BPF;
+
+typedef struct {
+ UINT16 VersionInfo;
+ UINT8 Reserved[2];
+ UINT32 PtrSmbiosTable;
+ UINT32 PtrAcpiRsdt;
+ UINT16 SupportedTablesFlags;
+ UINT32 PciDevAssertInfoPtr;
+ UINT32 MediaDevAssetInfoPtr;
+} AMT_DATA;
+
+typedef union {
+ UINT32 Data32;
+ UINT16 Data16[2];
+ UINT8 Data8[4];
+} DATA32_UNION;
+
+#pragma pack()
+
+/**
+ Signal a event for Amt ready to boot.
+
+ @param[in] None
+
+ @retval EFI_SUCCESS Mebx launched or no controller
+**/
+EFI_STATUS
+EFIAPI
+AmtReadyToBoot (
+ VOID
+ )
+;
+
+/**
+ This routine is run at boot time.
+ 1) Initialize AMT library.
+ 2) Check if MEBx is required to be launched by user.
+ 3) Build and send asset tables to ME FW.
+ 4) Check USB provision.
+ 5) Hide unused AMT devices in prior to boot.
+
+ @param[in] None.
+
+ @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary data structure.
+ @retval EFI_NOT_FOUND 1.5M FW SKU detected - there is no MEBx on 1.5 FW SKU
+**/
+EFI_STATUS
+MebxNotifyEvent (
+ VOID
+ )
+;
+
+/**
+ Check the status of Amt devices
+
+ @param[in] MeBiosExtensionSetupData MEBx setting data
+**/
+VOID
+AmtDeviceConfigure (
+ IN ME_BIOS_EXTENSION_SETUP *MeBiosExtensionSetupData
+ )
+;
+
+/**
+ Detect EFI MEBx support; Loading and execute.
+
+ @param[in] MebxBiosParamsBuffer MebxBiosParams Flat pointer
+**/
+EFI_STATUS
+AdjustAndExecuteMebxImage (
+ IN VOID *MebxBiosParamsBuffer
+ )
+;
+
+/**
+ Detect BIOS invoke reasons.
+
+ @param[in] InvokeMebx Pointer to the Invoke MEBx flag
+ @param[in] MebxBiosParamsBuffer MebxBiosParams Flat pointer
+**/
+VOID
+CheckForBiosInvokeReason (
+ IN UINT8 *InvokeMebx,
+ IN MEBX_BPF *MebxBiosParams
+ )
+;
+
+/**
+ Dump MEBx BIOS Params
+
+ @param[in] MebxBiosParams - MEBx BIOS params
+**/
+VOID
+DxeMebxBiosParamsDebugDump (
+ IN MEBX_BPF *MebxBiosParams
+ )
+;
+
+extern AMT_MEDIA_FRU mAmtMediaFru;
+extern AMT_PCI_FRU mAmtPciFru;
+
+//
+// USB Provisioning
+//
+extern VOID *mUsbProvData;
+extern VOID *mUsbProvDataBackup;
+extern UINTN mUsbProvDataSize;
+extern BOOLEAN mUsbProvsionDone;
+extern UINT8 mUsbKeyBus, mUsbKeyPort, mUsbKeyDevice, mUsbKeyFunction;
+
+#endif // _AMT_PTBX_H_
diff --git a/ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/BiosExtensionLoader.inf b/ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/BiosExtensionLoader.inf
new file mode 100644
index 0000000..689cfe8
--- /dev/null
+++ b/ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/BiosExtensionLoader.inf
@@ -0,0 +1,116 @@
+## @file
+# @todo ADD DESCRIPTION
+#
+#@copyright
+# Copyright (c) 2005 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = BiosExtensionLoader
+FILE_GUID = 32C1C9F8-D53F-41c8-94D0-F6739F231011
+COMPONENT_TYPE = BS_DRIVER
+
+[sources.common]
+ BiosExtensionLoader.h
+ BiosExtensionLoader.c
+ Inventory.c
+ Inventory.h
+ UsbProvision.h
+ UsbProvision.c
+ MebxBiosParamsDebugDumpDxe.c
+
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueDxeDriverEntryPoint.c
+
+[includes.common]
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/AMT/Dxe
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/Include
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/Dxe
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Protocol/AmtPlatformPolicy
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Heci/Include
+
+
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/SampleCode/Include
+
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[libraries.common]
+ MeProtocolLib
+ MeGuidLib
+ AmtLib
+ MeLib
+ MeChipsetLib
+ $(PROJECT_PCH_FAMILY)ProtocolLib
+ EdkProtocolLib
+ EfiGuidLib
+ EdkGuidLib
+ EdkFrameworkGuidLib
+ EdkFrameworkProtocolLib
+ EfiProtocolLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueBaseLib
+ EdkIIGlueBaseMemoryLib
+ EdkIIGlueDxeReportStatusCodeLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueUefiDevicePathLib
+ EdkIIGlueUefiLib
+ EdkIIGlueBasePciLibPciExpress
+ EdkIIGlueBasePciExpressLib
+ EdkIIGlueDxeHobLib
+ PchPlatformLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = BiosExtensionLoader.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=MebxDriverEntry
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_BASE_LIB__ \
+ -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_DEVICE_PATH_LIB__ \
+ -D __EDKII_GLUE_UEFI_LIB__ \
+ -D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+ -D __EDKII_GLUE_DXE_HOB_LIB__
diff --git a/ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/BiosExtensionLoader.mak b/ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/BiosExtensionLoader.mak
new file mode 100644
index 0000000..5285798
--- /dev/null
+++ b/ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/BiosExtensionLoader.mak
@@ -0,0 +1,80 @@
+# MAK file for the ModulePart:BiosExtensionLoader
+
+all : BiosExtensionLoader
+
+BiosExtensionLoader : $(BUILD_DIR)\BiosExtensionLoader.mak BiosExtensionLoaderBin
+
+$(BUILD_DIR)\BiosExtensionLoader.mak : $(BiosExtensionLoader_DIR)\$(@B).cif $(BiosExtensionLoader_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(BiosExtensionLoader_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+BiosExtensionLoader_INCLUDES=\
+ $(EDK_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(ME_INCLUDES)\
+ /I$(MeProtocolLib_DIR)\AmtPlatformPolicy\
+ $(IndustryStandard_INCLUDES)\
+ $(NB_INCLUDES) \
+ $(INTEL_PCH_INCLUDES)\
+ /I$(INTEL_COUGAR_POINT_DIR)\
+ /I$(PROJECT_DIR)\Core\EM\Terminal
+
+BiosExtensionLoader_DEFINES=$(MY_DEFINES)\
+!IF "$(TCG_SUPPORT)"=="1"
+ /D TCG_SUPPORT\
+!ENDIF
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=MebxDriverEntry"\
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_BASE_LIB__ \
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__\
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_UEFI_DEVICE_PATH_LIB__ \
+ /D __EDKII_GLUE_UEFI_LIB__\
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+ /D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ /D __EDKII_GLUE_DXE_HOB_LIB__
+
+BiosExtensionLoader_LIB_LINKS =\
+ $(AmtLibDxe_LIB)\
+ $(MeLibDxe_LIB)\
+ $(MeChipsetDxeLib_LIB)\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(MeGuidLib_LIB)\
+ $(EFIGUIDLIB)\
+ $(EDKPROTOCOLLIB)\
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueEdkDxeRuntimeDriverLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueUefiDevicePathLib_LIB)\
+ $(EdkIIGlueUefiLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(EdkIIGlueDxeMemoryAllocationLib_LIB)\
+ $(EdkIIGlueDxeHobLib_LIB)\
+ $(AmtProtocolLib_LIB)\
+ $(EFIDRIVERLIB)\
+ $(INTEL_PCH_PROTOCOL_LIB)\
+ $(PchPlatformDxeLib_LIB)
+
+BiosExtensionLoaderBin : $(BiosExtensionLoader_LIB_LINKS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\BiosExtensionLoader.mak all\
+ "MY_INCLUDES=$(BiosExtensionLoader_INCLUDES)"\
+ "MY_DEFINES=$(BiosExtensionLoader_DEFINES)"\
+ GUID=97cc7188-79c9-449f-b969-065b64bf9c69 \
+ ENTRY_POINT=_ModuleEntryPoint \
+ EDKIIModule=DXEDRIVER\
+ TYPE=BS_DRIVER \
+ DEPEX1=$(BiosExtensionLoader_DIR)\BiosExtensionLoader.dxs \
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \
+ COMPRESS=1\
+
diff --git a/ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/BiosExtensionLoader.sdl b/ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/BiosExtensionLoader.sdl
new file mode 100644
index 0000000..9a9d9de
--- /dev/null
+++ b/ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/BiosExtensionLoader.sdl
@@ -0,0 +1,32 @@
+TOKEN
+ Name = "BiosExtensionLoader_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable BiosExtensionLoader support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Token = "iAMT_SUPPORT" "=" "1"
+End
+
+PATH
+ Name = "BiosExtensionLoader_DIR"
+ Help = "iAMT BiosExtensionLoader file source directory"
+End
+
+MODULE
+ Help = "Includes BiosExtensionLoader.mak to Project"
+ File = "BiosExtensionLoader.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\BiosExtensionLoader.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(BiosExtensionLoader_DIR)"
+ Parent = "ME_INCLUDES"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/Inventory.c b/ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/Inventory.c
new file mode 100644
index 0000000..b025e97
--- /dev/null
+++ b/ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/Inventory.c
@@ -0,0 +1,828 @@
+/** @file
+ Performs PCI and Media device inventory for AMT.
+
+@copyright
+ Copyright (c) 2005 - 2012 Intel Corporation. All rights
+ reserved This software and associated documentation (if any)
+ is furnished under a license and may only be used or copied in
+ accordance with the terms of the license. Except as permitted
+ by such license, no part of this software or documentation may
+ be reproduced, stored in a retrieval system, or transmitted in
+ any form or by any means without the express written consent
+ of Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "BiosExtensionLoader.h"
+#include "Inventory.h"
+#endif
+
+AMT_MEDIA_FRU mAmtMediaFru;
+AMT_PCI_FRU mAmtPciFru;
+
+/**
+ Transfer each other while being front and back.
+
+ @param[in] Data The address of data
+ @param[in] Size Size of data
+
+ @retval None
+**/
+VOID
+SwapEntries (
+ IN CHAR8 *Data,
+ IN UINT8 Size
+ )
+{
+ UINT16 Index;
+ CHAR8 Temp8;
+
+ Index = 0;
+ while (Data[Index] != 0 && Data[Index + 1] != 0) {
+ Temp8 = Data[Index];
+ Data[Index] = Data[Index + 1];
+ Data[Index + 1] = Temp8;
+ Index += 2;
+ if (Index >= Size) {
+ break;
+ }
+ }
+
+ return ;
+}
+
+/**
+ This function get the next bus range of given address space descriptors.
+ It also moves the pointer backward a node, to get prepared to be called
+ again.
+
+ @param[in] Descriptors points to current position of a serial of address space
+ descriptors
+ @param[in] MinBus The lower range of bus number
+ @param[in] MaxBus The upper range of bus number
+ @param[in] IsEnd Meet end of the serial of descriptors
+
+ @retval EFI_SUCCESS The command completed successfully
+**/
+EFI_STATUS
+PciGetNextBusRange (
+ IN OUT EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR **Descriptors,
+ OUT UINT16 *MinBus,
+ OUT UINT16 *MaxBus,
+ OUT BOOLEAN *IsEnd
+ )
+{
+ *IsEnd = FALSE;
+
+ ///
+ /// When *Descriptors is NULL, Configuration() is not implemented, so assume
+ /// range is 0~PCI_MAX_BUS
+ ///
+ if ((*Descriptors) == NULL) {
+ *MinBus = 0;
+ *MaxBus = PCI_MAX_BUS;
+ return EFI_SUCCESS;
+ }
+ ///
+ /// *Descriptors points to one or more address space descriptors, which
+ /// ends with a end tagged descriptor. Examine each of the descriptors,
+ /// if a bus typed one is found and its bus range covers bus, this handle
+ /// is the handle we are looking for.
+ ///
+ if ((*Descriptors)->Desc == ACPI_END_TAG_DESCRIPTOR) {
+ *IsEnd = TRUE;
+ }
+
+ while ((*Descriptors)->Desc != ACPI_END_TAG_DESCRIPTOR) {
+ if ((*Descriptors)->ResType == ACPI_ADDRESS_SPACE_TYPE_BUS) {
+ *MinBus = (UINT16) (*Descriptors)->AddrRangeMin;
+ *MaxBus = (UINT16) (*Descriptors)->AddrRangeMax;
+ }
+
+ (*Descriptors)++;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This function gets the protocol interface from the given handle, and
+ obtains its address space descriptors.
+
+ @param[in] Handle The PCI_ROOT_BRIDIGE_IO_PROTOCOL handle
+ @param[in] IoDev Handle used to access configuration space of PCI device
+ @param[in] Descriptors Points to the address space descriptors
+
+ @retval EFI_SUCCESS The command completed successfully
+**/
+EFI_STATUS
+PciGetProtocolAndResource (
+ IN EFI_HANDLE Handle,
+ OUT EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL **IoDev,
+ OUT EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR **Descriptors
+ )
+{
+ EFI_STATUS Status;
+
+ ///
+ /// Get inferface from protocol
+ ///
+ Status = gBS->HandleProtocol (
+ Handle,
+ &gEfiPciRootBridgeIoProtocolGuid,
+ (VOID **) IoDev
+ );
+
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ ///
+ /// Call Configuration() to get address space descriptors
+ ///
+ Status = (*IoDev)->Configuration (*IoDev, (VOID **) Descriptors);
+ if (Status == EFI_UNSUPPORTED) {
+ *Descriptors = NULL;
+ return EFI_SUCCESS;
+
+ } else {
+ return Status;
+ }
+}
+///
+/// This is where we list any chipset PCI device that is NOT a FRU.
+/// Platform specific PCI devices are listed elsewhere.
+///
+UINT64 mPciDeviceFilterOutTable[] = {
+ EFI_PCI_ADDRESS(00, 00, 00, 00), ///< MCH
+ EFI_PCI_ADDRESS(00, 01, 00, 00), ///< PCIe PEG
+ EFI_PCI_ADDRESS(00, 02, 00, 00), ///< IGD
+ EFI_PCI_ADDRESS(00, 03, 00, 00), ///< Intel High Definition Audio Controller (inside processor)
+ EFI_PCI_ADDRESS(00, 30, 00, 00), ///< DMI to PCI Express Bridge
+ EFI_PCI_ADDRESS(00, 31, 00, 00), ///< LPC Controller
+ EFI_PCI_ADDRESS(00, 31, 02, 00), ///< Serial ATA Controller #1
+ EFI_PCI_ADDRESS(00, 31, 03, 00), ///< SMBus Controller
+ EFI_PCI_ADDRESS(00, 31, 05, 00), ///< Serial ATA Controller #2
+ EFI_PCI_ADDRESS(00, 31, 06, 00), ///< Thermal Subsystem
+ EFI_PCI_ADDRESS(00, 29, 00, 00), ///< USB EHCI Controller #1
+ EFI_PCI_ADDRESS(00, 29, 01, 00), ///< USB UHCI Controller #1
+ EFI_PCI_ADDRESS(00, 29, 02, 00), ///< USB UHCI Controller #2
+ EFI_PCI_ADDRESS(00, 29, 03, 00), ///< USB UHCI Controller #3
+ EFI_PCI_ADDRESS(00, 29, 04, 00), ///< USB UHCI Controller #4
+ EFI_PCI_ADDRESS(00, 29, 07, 00), ///< USBr #1
+ EFI_PCI_ADDRESS(00, 28, 00, 00), ///< PCI Express Port #1
+ EFI_PCI_ADDRESS(00, 28, 01, 00), ///< PCI Express Port #2
+ EFI_PCI_ADDRESS(00, 28, 02, 00), ///< PCI Express Port #3
+ EFI_PCI_ADDRESS(00, 28, 03, 00), ///< PCI Express Port #4
+ EFI_PCI_ADDRESS(00, 28, 04, 00), ///< PCI Express Port #5
+ EFI_PCI_ADDRESS(00, 28, 05, 00), ///< PCI Express Port #6
+ EFI_PCI_ADDRESS(00, 28, 06, 00), ///< PCI Express Port #7
+ EFI_PCI_ADDRESS(00, 28, 07, 00), ///< PCI Express Port #8
+ EFI_PCI_ADDRESS(00, 27, 00, 00), ///< Intel High Definition Audio Controller (inside chipset)
+ EFI_PCI_ADDRESS(00, 26, 00, 00), ///< USB EHCI Controller #2
+ EFI_PCI_ADDRESS(00, 26, 01, 00), ///< USB UHCI Controller #5
+ EFI_PCI_ADDRESS(00, 26, 02, 00), ///< USB UHCI Controller #6
+ EFI_PCI_ADDRESS(00, 26, 03, 00), ///< USB UHCI Controller #7
+ EFI_PCI_ADDRESS(00, 26, 07, 00), ///< USBr #2
+ EFI_PCI_ADDRESS(00, 25, 00, 00), ///< GbE Controller
+ EFI_PCI_ADDRESS(00, 24, 00, 00), ///< Dual Channel NAND Controller
+ EFI_PCI_ADDRESS(00, 23, 00, 00), ///< Virtualization Engine
+ EFI_PCI_ADDRESS(00, 22, 00, 00), ///< HECI #1
+ EFI_PCI_ADDRESS(00, 22, 01, 00), ///< HECI #2
+ EFI_PCI_ADDRESS(00, 22, 02, 00), ///< IDER
+ EFI_PCI_ADDRESS(00, 22, 03, 00), ///< KT
+ EFI_PCI_ADDRESS(00, 21, 00, 00), ///< Virtualized SATA Controller
+ EFI_PCI_ADDRESS(00, 20, 00, 00), ///< xHCI Controller
+ EFI_MAX_ADDRESS,
+};
+#define MAX_FILTER_OUT_DEVICE_NUMBER 0x100
+
+/**
+ AMT only need to know removable PCI device information.
+
+ @param[in] None
+
+ @retval EFI_SUCCESS mAmtPciFru will be update.
+ @retval EFI_OUT_OF_RESOURCES System on-board device list is larger than
+ MAX_FILTER_OUT_DEVICE_NUMBER supported.
+**/
+EFI_STATUS
+BuildPciFru (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ EFI_HANDLE *HandleBuffer;
+ UINTN NumberOfHandles;
+ UINTN Index;
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev;
+ EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptors;
+ UINT16 MinBus;
+ UINT16 MaxBus;
+ BOOLEAN IsEnd;
+ UINT16 Bus;
+ UINT16 Device;
+ UINT16 Func;
+ UINT64 Address;
+ PCI_COMMON_HEADER PciHeader;
+ PCI_CONFIG_SPACE ConfigSpace;
+ BOOLEAN ValidDevice;
+ UINT8 CurrentFruDev;
+ UINTN FilterOutIndex;
+ UINT64 *PciDeviceFilterOutTable;
+ UINT64 *PlatformPciDeviceFilterOutTable;
+
+ CurrentFruDev = 0;
+ ValidDevice = FALSE;
+
+ ///
+ /// Get PCI Device Filter Out table about on-board device list from AMT Platform Policy
+ /// Only need to report removeable device to AMT
+ ///
+ PlatformPciDeviceFilterOutTable = (UINT64 *) (UINTN) AmtPciDeviceFilterOutTable ();
+
+ ///
+ /// System on-board device list
+ ///
+ if (sizeof (mPciDeviceFilterOutTable) / sizeof (UINT64) > MAX_FILTER_OUT_DEVICE_NUMBER) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ PciDeviceFilterOutTable = mPciDeviceFilterOutTable;
+
+ ///
+ /// Get all instances of PciRootBridgeIo
+ ///
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiPciRootBridgeIoProtocolGuid,
+ NULL,
+ &NumberOfHandles,
+ &HandleBuffer
+ );
+
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ ///
+ /// For each handle, which decides a segment and a bus number range,
+ /// enumerate all devices on it.
+ ///
+ for (Index = 0; Index < NumberOfHandles; Index++) {
+ Status = PciGetProtocolAndResource (
+ HandleBuffer[Index],
+ &IoDev,
+ &Descriptors
+ );
+ if (EFI_ERROR (Status)) {
+ FreePool (HandleBuffer);
+ return Status;
+ }
+ ///
+ /// No document say it's impossible for a RootBridgeIo protocol handle
+ /// to have more than one address space descriptors, so find out every
+ /// bus range and for each of them do device enumeration.
+ ///
+ while (TRUE) {
+ Status = PciGetNextBusRange (&Descriptors, &MinBus, &MaxBus, &IsEnd);
+
+ if (EFI_ERROR (Status)) {
+ FreePool (HandleBuffer);
+ return Status;
+ }
+
+ if (IsEnd) {
+ break;
+ }
+
+ for (Bus = MinBus; Bus <= MaxBus; Bus++) {
+ ///
+ /// For each devices, enumerate all functions it contains
+ ///
+ for (Device = 0; Device <= PCI_MAX_DEVICE; Device++) {
+ ///
+ /// For each function, read its configuration space and print summary
+ ///
+ for (Func = 0; Func <= PCI_MAX_FUNC; Func++) {
+ Address = EFI_PCI_ADDRESS (Bus, Device, Func, 0);
+ ///
+ /// Read the vendor information
+ ///
+ IoDev->Pci.Read (
+ IoDev,
+ EfiPciWidthUint16,
+ Address,
+ 1,
+ &PciHeader.VendorId
+ );
+
+ ///
+ /// If VendorId = 0xffff, there does not exist a device at this
+ /// location. For each device, if there is any function on it,
+ /// there must be 1 function at Function 0. So if Func = 0, there
+ /// will be no more functions in the same device, so we can break
+ /// loop to deal with the next device.
+ ///
+ if (PciHeader.VendorId == 0xffff && Func == 0) {
+ break;
+ }
+
+ if (PciHeader.VendorId != 0xffff) {
+ IoDev->Pci.Read (
+ IoDev,
+ EfiPciWidthUint32,
+ Address,
+ sizeof (PciHeader) / sizeof (UINT32),
+ &PciHeader
+ );
+
+ ValidDevice = TRUE;
+
+ ///
+ /// Check if any onboard system devices which need to be filter-out and do not report to AMT
+ ///
+ if (ValidDevice == TRUE) {
+ for (FilterOutIndex = 0; FilterOutIndex < (sizeof (mPciDeviceFilterOutTable) / sizeof (UINT64)); FilterOutIndex++) {
+ if (PciDeviceFilterOutTable[FilterOutIndex] == Address) {
+ ///
+ /// Match found so ignore it.
+ ///
+ ValidDevice = FALSE;
+ }
+
+ if (PciDeviceFilterOutTable[FilterOutIndex] == Address ||
+ PciDeviceFilterOutTable[FilterOutIndex] == EFI_MAX_ADDRESS
+ ) {
+ ///
+ /// Match or end of list.
+ ///
+ break;
+ }
+ }
+ }
+ ///
+ /// Check if any Platform specific onboard devices which need to be filter-out and do not report to AMT
+ ///
+ if (ValidDevice == TRUE) {
+ if (PlatformPciDeviceFilterOutTable != NULL) {
+ for (FilterOutIndex = 0; FilterOutIndex < MAX_FILTER_OUT_DEVICE_NUMBER; FilterOutIndex++) {
+ if (PlatformPciDeviceFilterOutTable[FilterOutIndex] == Address) {
+ ///
+ /// Match found so ignore it.
+ ///
+ ValidDevice = FALSE;
+ }
+
+ if (PlatformPciDeviceFilterOutTable[FilterOutIndex] == Address ||
+ PlatformPciDeviceFilterOutTable[FilterOutIndex] == EFI_MAX_ADDRESS
+ ) {
+ ///
+ /// Match or end of list.
+ ///
+ break;
+ }
+ }
+ }
+ }
+ ///
+ /// Filter-out bridge
+ ///
+ if (ValidDevice == TRUE) {
+ switch (PciHeader.ClassCode[2]) {
+ case PCI_CLASS_BRIDGE:
+ ValidDevice = FALSE;
+ break;
+ }
+ }
+
+ if (ValidDevice == TRUE) {
+ mAmtPciFru.PciDevInfo[CurrentFruDev].Vid = PciHeader.VendorId;
+ mAmtPciFru.PciDevInfo[CurrentFruDev].Did = PciHeader.DeviceId;
+ mAmtPciFru.PciDevInfo[CurrentFruDev].Rid = PciHeader.RevisionId;
+ mAmtPciFru.PciDevInfo[CurrentFruDev].ClassCode = ((UINT32) PciHeader.ClassCode[0]) | ((UINT32) PciHeader.ClassCode[1] << 0x8) | ((UINT32) PciHeader.ClassCode[2] << 0x10);
+
+ Status = IoDev->Pci.Read (
+ IoDev,
+ EfiPciWidthUint8,
+ Address,
+ sizeof (ConfigSpace),
+ &ConfigSpace
+ );
+
+ mAmtPciFru.PciDevInfo[CurrentFruDev].SubSysVid = ConfigSpace.NonCommon.Device.SubVendorId;
+ mAmtPciFru.PciDevInfo[CurrentFruDev].SubSysDid = ConfigSpace.NonCommon.Device.SubSystemId;
+ mAmtPciFru.PciDevInfo[CurrentFruDev].BusDevFcn = (UINT16) (Bus << 0x08 | Device << 0x03 | Func);
+
+ if (CurrentFruDev >= PCI_DEVICE_MAX_NUM - 1) {
+ Status = EFI_DEVICE_ERROR;
+ goto Done;
+ }
+
+ CurrentFruDev++;
+ }
+ ///
+ /// If this is not a multi-function device, we can leave the loop
+ /// to deal with the next device.
+ ///
+ if (Func == 0 && ((PciHeader.HeaderType & HEADER_TYPE_MULTI_FUNCTION) == 0x00)) {
+ break;
+ }
+ }
+ }
+ }
+ }
+ ///
+ /// If Descriptor is NULL, Configuration() returns EFI_UNSUPPRORED,
+ /// we assume the bus range is 0~PCI_MAX_BUS. After enumerated all
+ /// devices on all bus, we can leave loop.
+ ///
+ if (Descriptors == NULL) {
+ break;
+ }
+ }
+ }
+
+ mAmtPciFru.PciDevicesHeader.VersionInfo = DEVICES_LIST_VERSION;
+ mAmtPciFru.PciDevicesHeader.DevCount = CurrentFruDev;
+
+Done:
+ FreePool (HandleBuffer);
+
+ return Status;
+}
+
+/**
+ Collect all media devices.
+
+ @param[in] None
+
+ @retval None
+**/
+VOID
+EFIAPI
+BuildMediaList (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ UINTN HandleCount;
+ EFI_HANDLE *HandleBuffer;
+ UINTN IderHandleCount;
+ EFI_HANDLE *IderHandleBuffer;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePathNode;
+ PCI_DEVICE_PATH *PciDevicePath;
+ PCI_DEVICE_PATH *IderPciDevicePath;
+ ACPI_HID_DEVICE_PATH *AcpiHidDevicePath;
+ UINTN Index;
+ EFI_DISK_INFO_PROTOCOL *DiskInfo;
+ EFI_BLOCK_IO_PROTOCOL *BlkIo;
+ UINT32 IdeChannel;
+ UINT32 IdeDevice;
+ EFI_IDENTIFY_DATA *IdentifyDriveInfo;
+ UINT8 Index1;
+ UINT32 BufferSize;
+ UINT64 DriveSize;
+ UINT8 MediaDeviceCount;
+
+ MediaDeviceCount = 0;
+ PciDevicePath = NULL;
+ Status = EFI_SUCCESS;
+ IderHandleCount = 0;
+ IderPciDevicePath = NULL;
+
+ ///
+ /// Look for IDER PCI Device Path
+ ///
+ gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiIderControllerDriverProtocolGuid,
+ NULL,
+ &IderHandleCount,
+ &IderHandleBuffer
+ );
+
+ if (IderHandleCount != 0) {
+ Status = gBS->HandleProtocol (
+ IderHandleBuffer[0],
+ &gEfiDevicePathProtocolGuid,
+ (VOID *) &DevicePath
+ );
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ return ;
+ }
+ ///
+ /// First traverse the device path and look for IDER PCI Device Path
+ ///
+ DevicePathNode = DevicePath;
+ while (!IsDevicePathEnd (DevicePathNode)) {
+ if ((DevicePathType (DevicePathNode) == HARDWARE_DEVICE_PATH) &&
+ (DevicePathSubType (DevicePathNode) == HW_PCI_DP)
+ ) {
+ IderPciDevicePath = (PCI_DEVICE_PATH *) DevicePathNode;
+ break;
+ }
+
+ DevicePathNode = NextDevicePathNode (DevicePathNode);
+ }
+
+ FreePool (IderHandleBuffer);
+ if (IderPciDevicePath == NULL) {
+ DEBUG ((EFI_D_ERROR, " No Ider Pci device \n"));
+ return;
+ }
+
+ }
+ ///
+ /// Locate all media devices connected.
+ /// We look for the Block I/O protocol to be attached to the device.
+ ///
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiBlockIoProtocolGuid,
+ NULL,
+ &HandleCount,
+ &HandleBuffer
+ );
+ if (EFI_ERROR (Status) || HandleCount == 0) {
+ return ;
+ }
+
+ DEBUG ((EFI_D_ERROR, "HandleCount=%X\n", HandleCount));
+ for (Index = 0; Index < HandleCount; Index++) {
+ Status = gBS->HandleProtocol (
+ HandleBuffer[Index],
+ &gEfiBlockIoProtocolGuid,
+ (VOID **) &BlkIo
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ Status = gBS->HandleProtocol (
+ HandleBuffer[Index],
+ &gEfiDevicePathProtocolGuid,
+ (VOID *) &DevicePath
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// We want to remove any Block I/O instances that refer to Logical partitions.
+ /// A Block I/O instance is added to the raw device and any partition discovered on
+ /// the media. This prevents duplications in our table.
+ ///
+ if (BlkIo->Media->LogicalPartition) {
+ continue;
+ }
+ ///
+ /// First traverse the device path and look for our PCI Device Path Type
+ ///
+ DevicePathNode = DevicePath;
+ PciDevicePath = NULL;
+ while (!IsDevicePathEnd (DevicePathNode)) {
+ if ((DevicePathType (DevicePathNode) == HARDWARE_DEVICE_PATH) &&
+ (DevicePathSubType (DevicePathNode) == HW_PCI_DP)
+ ) {
+ PciDevicePath = (PCI_DEVICE_PATH *) DevicePathNode;
+ break;
+ }
+
+ DevicePathNode = NextDevicePathNode (DevicePathNode);
+ }
+
+ if (PciDevicePath == NULL) {
+ continue;
+ }
+ ///
+ /// Skip IDE-R
+ ///
+ if (IderPciDevicePath != NULL) {
+ if (PciDevicePath->Function == IderPciDevicePath->Function && PciDevicePath->Device == IderPciDevicePath->Device) {
+ continue;
+ }
+ }
+
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].StructSize = sizeof (MEBX_FRU_MEDIA_DEVICES);
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].Rsvd[0] = 0;
+
+ ///
+ /// Next take a look at the Function field of the current device path node to determine if it is
+ /// a floppy, or ATA/ATAPI device.
+ ///
+ Status = gBS->HandleProtocol (
+ HandleBuffer[Index],
+ &gEfiDiskInfoProtocolGuid,
+ (VOID **) &DiskInfo
+ );
+ if (EFI_ERROR (Status)) {
+ ///
+ /// No DiskInfo available, check message field
+ /// Currently USB does not have a DiskInfo available
+ ///
+ DevicePathNode = NextDevicePathNode (DevicePathNode);
+ while (!IsDevicePathEnd (DevicePathNode)) {
+ if ((DevicePathType (DevicePathNode) == MESSAGING_DEVICE_PATH)) {
+ switch (DevicePathSubType (DevicePathNode)) {
+ case MSG_USB_DP:
+ ///
+ /// USB Mass Storage Device
+ ///
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].Interface = MEBX_MEDIA_IN_ATA;
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].DevType = MEBX_MEDIA_DT_HDD;
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].SerialNo[0] = 0;
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].VersionNo[0] = 0;
+ AsciiStrCpy ((CHAR8 *) mAmtMediaFru.MediaDevInfo[MediaDeviceCount].ModelNo, "USB");
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].MaxMediaSize = MultU64x32 (
+ BlkIo->Media->LastBlock + 1,
+ BlkIo->Media->BlockSize
+ );
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].SupportedCmdSets[0] = 0;
+ break;
+
+ case MSG_ATAPI_DP:
+ ///
+ /// Should be SATA if no DiskInfo Protocol available
+ ///
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].Interface = MEBX_MEDIA_IN_SATA;
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].DevType = MEBX_MEDIA_DT_HDD;
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].SerialNo[0] = 0;
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].VersionNo[0] = 0;
+ AsciiStrCpy ((CHAR8 *) mAmtMediaFru.MediaDevInfo[MediaDeviceCount].ModelNo, "Native SATA");
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].MaxMediaSize = MultU64x32 (
+ BlkIo->Media->LastBlock + 1,
+ BlkIo->Media->BlockSize
+ );
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].SupportedCmdSets[0] = 0;
+ break;
+
+ default:
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].Interface = MEBX_MEDIA_IN_ATA;
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].DevType = MEBX_MEDIA_DT_MO;
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].SerialNo[0] = 0;
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].VersionNo[0] = 0;
+ AsciiStrCpy ((CHAR8 *) mAmtMediaFru.MediaDevInfo[MediaDeviceCount].ModelNo, "Unknown");
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].MaxMediaSize = MultU64x32 (
+ BlkIo->Media->LastBlock + 1,
+ BlkIo->Media->BlockSize
+ );
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].SupportedCmdSets[0] = 0;
+ break;
+ }
+ //
+ // End of Switch
+ //
+ } else if ((DevicePathType (DevicePathNode) == ACPI_DEVICE_PATH)) {
+ AcpiHidDevicePath = (ACPI_HID_DEVICE_PATH *) DevicePathNode;
+ if (EISA_ID_TO_NUM (AcpiHidDevicePath->HID) == 0x0604) {
+ ///
+ /// Floppy
+ ///
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].Interface = MEBX_MEDIA_IN_ATA;
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].DevType = MEBX_MEDIA_DT_FDD;
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].SerialNo[0] = 0;
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].VersionNo[0] = 0;
+ AsciiStrCpy ((CHAR8 *) mAmtMediaFru.MediaDevInfo[MediaDeviceCount].ModelNo, "Floppy");
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].MaxMediaSize = MultU64x32 (
+ BlkIo->Media->LastBlock + 1,
+ BlkIo->Media->BlockSize
+ );
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].SupportedCmdSets[0] = 0;
+ }
+ }
+
+ DevicePathNode = NextDevicePathNode (DevicePathNode);
+ }
+ } else {
+ Status = DiskInfo->WhichIde (
+ DiskInfo,
+ &IdeChannel,
+ &IdeDevice
+ );
+ if (Status == EFI_UNSUPPORTED) {
+ continue;
+ }
+
+ BufferSize = sizeof (EFI_IDENTIFY_DATA);
+ IdentifyDriveInfo = AllocatePool (BufferSize);
+ ASSERT (IdentifyDriveInfo != NULL);
+ if (IdentifyDriveInfo == NULL) {
+ return ;
+ }
+
+ Status = DiskInfo->Identify (
+ DiskInfo,
+ IdentifyDriveInfo,
+ &BufferSize
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ if (PciDevicePath->Function == 1) {
+ ///
+ /// PATA Device
+ ///
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].Interface = MEBX_MEDIA_IN_ATA;
+ } else if (PciDevicePath->Function == 2) {
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].Interface = MEBX_MEDIA_IN_SATA;
+ }
+ ///
+ /// Reverse the bytes for proper ordering of characters
+ ///
+ SwapEntries ((CHAR8 *) &IdentifyDriveInfo->AtaData.ModelName, sizeof (IdentifyDriveInfo->AtaData.ModelName));
+ SwapEntries ((CHAR8 *) &IdentifyDriveInfo->AtaData.SerialNo, sizeof (IdentifyDriveInfo->AtaData.SerialNo));
+
+ CopyMem (
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].ModelNo,
+ IdentifyDriveInfo->AtaData.ModelName,
+ sizeof (mAmtMediaFru.MediaDevInfo[MediaDeviceCount].ModelNo)
+ );
+
+ ///
+ /// For HardDisk append the size. Otherwise display atapi
+ ///
+ if ((IdentifyDriveInfo->AtaData.config & 0x8000) == 00) {
+ ///
+ /// 48 bit address feature set is supported, get maximum capacity
+ ///
+ if ((IdentifyDriveInfo->AtaData.command_set_supported_83 & 0x0400) == 0) {
+ DriveSize =
+ (
+ (IdentifyDriveInfo->AtaData.user_addressable_sectors_hi << 16) +
+ IdentifyDriveInfo->AtaData.user_addressable_sectors_lo
+ );
+ } else {
+ DriveSize = IdentifyDriveInfo->AtapiData.max_user_lba_for_48bit_addr[0];
+ for (Index1 = 1; Index1 < 4; Index1++) {
+ ///
+ /// Lower byte goes first: word[100] is the lowest word, word[103] is highest
+ ///
+ DriveSize |= LShiftU64 (
+ IdentifyDriveInfo->AtapiData.max_user_lba_for_48bit_addr[Index1],
+ 16 * Index1
+ );
+ }
+ }
+
+ DriveSize = MultU64x32 (DriveSize, 512);
+ CopyMem (
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].SerialNo,
+ IdentifyDriveInfo->AtaData.SerialNo,
+ sizeof (mAmtMediaFru.MediaDevInfo[MediaDeviceCount].SerialNo)
+ );
+ CopyMem (
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].VersionNo,
+ IdentifyDriveInfo->AtaData.FirmwareVer,
+ sizeof (mAmtMediaFru.MediaDevInfo[MediaDeviceCount].VersionNo)
+ );
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].SupportedCmdSets[0] = IdentifyDriveInfo->AtaData.command_set_supported_82;
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].SupportedCmdSets[1] = IdentifyDriveInfo->AtaData.command_set_supported_83;
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].SupportedCmdSets[2] = IdentifyDriveInfo->AtaData.command_set_feature_extn;
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].MaxMediaSize = DriveSize;
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].DevType = MEBX_MEDIA_DT_HDD;
+ } else {
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].Interface = MEBX_MEDIA_IN_ATAPI;
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].MaxMediaSize = MultU64x32 (
+ BlkIo->Media->LastBlock + 1,
+ BlkIo->Media->BlockSize
+ );
+ CopyMem (
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].SerialNo,
+ IdentifyDriveInfo->AtapiData.SerialNo,
+ sizeof (mAmtMediaFru.MediaDevInfo[MediaDeviceCount].SerialNo)
+ );
+ CopyMem (
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].VersionNo,
+ IdentifyDriveInfo->AtapiData.FirmwareVer,
+ sizeof (mAmtMediaFru.MediaDevInfo[MediaDeviceCount].VersionNo)
+ );
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].SupportedCmdSets[0] = IdentifyDriveInfo->AtapiData.cmd_set_support_82;
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].SupportedCmdSets[1] = IdentifyDriveInfo->AtapiData.cmd_set_support_83;
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].SupportedCmdSets[2] = IdentifyDriveInfo->AtapiData.cmd_feature_support;
+ if (BlkIo->Media->RemovableMedia) {
+ mAmtMediaFru.MediaDevInfo[MediaDeviceCount].DevType = MEBX_MEDIA_DT_DVD;
+ }
+ }
+ }
+
+ DEBUG ((EFI_D_ERROR, "%x DevType=%x, \n", MediaDeviceCount, mAmtMediaFru.MediaDevInfo[MediaDeviceCount].DevType));
+ DEBUG ((EFI_D_ERROR, "Interface=%x, \n", mAmtMediaFru.MediaDevInfo[MediaDeviceCount].Interface));
+ DEBUG ((EFI_D_ERROR, "MaxMediaSize=%x, \n", mAmtMediaFru.MediaDevInfo[MediaDeviceCount].MaxMediaSize));
+ DEBUG ((EFI_D_ERROR, "SupportedCmdSets=%x, \n", mAmtMediaFru.MediaDevInfo[MediaDeviceCount].SupportedCmdSets));
+
+ MediaDeviceCount++;
+ if (MediaDeviceCount >= MEDIA_DEVICE_MAX_NUM) {
+ break;
+ }
+ } // end of handlebuffer blockio
+ mAmtMediaFru.MediaDevicesHeader.VersionInfo = DEVICES_LIST_VERSION;
+ mAmtMediaFru.MediaDevicesHeader.DevCount = MediaDeviceCount;
+
+ if (HandleBuffer != NULL) {
+ FreePool (HandleBuffer);
+ }
+}
diff --git a/ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/Inventory.h b/ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/Inventory.h
new file mode 100644
index 0000000..77ccd13
--- /dev/null
+++ b/ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/Inventory.h
@@ -0,0 +1,159 @@
+/** @file
+ Include for AMT Bios Extentions Loader Inventory Functions
+
+@copyright
+ Copyright (c) 2005 - 2012 Intel Corporation. All rights
+ reserved This software and associated documentation (if any)
+ is furnished under a license and may only be used or copied in
+ accordance with the terms of the license. Except as permitted
+ by such license, no part of this software or documentation may
+ be reproduced, stored in a retrieval system, or transmitted in
+ any form or by any means without the express written consent
+ of Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _INVENTORY_H_
+#define _INVENTORY_H_
+
+#include EFI_PROTOCOL_CONSUMER (DiskInfo)
+#include EFI_PROTOCOL_CONSUMER (IderControllerDriver)
+
+///
+/// Common part of the PCI configuration space header for devices, P2P bridges,
+/// and cardbus bridges
+///
+typedef struct {
+ UINT16 VendorId;
+ UINT16 DeviceId;
+
+ UINT16 Command;
+ UINT16 Status;
+
+ UINT8 RevisionId;
+ UINT8 ClassCode[3];
+
+ UINT8 CacheLineSize;
+ UINT8 PrimaryLatencyTimer;
+ UINT8 HeaderType;
+ UINT8 BIST;
+
+} PCI_COMMON_HEADER;
+
+///
+/// PCI configuration space header for devices(after the common part)
+///
+typedef struct {
+ UINT32 Bar[6]; ///< Base Address Registers
+ UINT32 CardBusCISPtr; ///< CardBus CIS Pointer
+ UINT16 SubVendorId; ///< Subsystem Vendor ID
+ UINT16 SubSystemId; ///< Subsystem ID
+ UINT32 ROMBar; ///< Expansion ROM Base Address
+ UINT8 CapabilitiesPtr; ///< Capabilities Pointer
+ UINT8 Reserved[3];
+
+ UINT32 Reserved1;
+
+ UINT8 InterruptLine; ///< Interrupt Line
+ UINT8 InterruptPin; ///< Interrupt Pin
+ UINT8 MinGnt; ///< Min_Gnt
+ UINT8 MaxLat; ///< Max_Lat
+} PCI_DEVICE_HEADER;
+
+///
+/// PCI configuration space header for pci-to-pci bridges(after the common part)
+///
+typedef struct {
+ UINT32 Bar[2]; ///< Base Address Registers
+ UINT8 PrimaryBus; ///< Primary Bus Number
+ UINT8 SecondaryBus; ///< Secondary Bus Number
+ UINT8 SubordinateBus; ///< Subordinate Bus Number
+ UINT8 SecondaryLatencyTimer; ///< Secondary Latency Timer
+ UINT8 IoBase; ///< I/O Base
+ UINT8 IoLimit; ///< I/O Limit
+ UINT16 SecondaryStatus; ///< Secondary Status
+ UINT16 MemoryBase; ///< Memory Base
+ UINT16 MemoryLimit; ///< Memory Limit
+ UINT16 PrefetchableMemBase; ///< Pre-fetchable Memory Base
+ UINT16 PrefetchableMemLimit; ///< Pre-fetchable Memory Limit
+ UINT32 PrefetchableBaseUpper; ///< Pre-fetchable Base Upper 32 bits
+ UINT32 PrefetchableLimitUpper; ///< Pre-fetchable Limit Upper 32 bits
+ UINT16 IoBaseUpper; ///< I/O Base Upper 16 bits
+ UINT16 IoLimitUpper; ///< I/O Limit Upper 16 bits
+ UINT8 CapabilitiesPtr; ///< Capabilities Pointer
+ UINT8 Reserved[3];
+
+ UINT32 ROMBar; ///< Expansion ROM Base Address
+ UINT8 InterruptLine; ///< Interrupt Line
+ UINT8 InterruptPin; ///< Interrupt Pin
+ UINT16 BridgeControl; ///< Bridge Control
+} PCI_BRIDGE_HEADER;
+
+///
+/// PCI configuration space header for cardbus bridges(after the common part)
+///
+typedef struct {
+ UINT32 CardBusSocketReg; ///< Cardus Socket/ExCA Base Address Register
+ UINT16 Reserved;
+ UINT16 SecondaryStatus; ///< Secondary Status
+ UINT8 PciBusNumber; ///< PCI Bus Number
+ UINT8 CardBusBusNumber; ///< CardBus Bus Number
+ UINT8 SubordinateBusNumber; ///< Subordinate Bus Number
+ UINT8 CardBusLatencyTimer; ///< CardBus Latency Timer
+ UINT32 MemoryBase0; ///< Memory Base Register 0
+ UINT32 MemoryLimit0; ///< Memory Limit Register 0
+ UINT32 MemoryBase1;
+ UINT32 MemoryLimit1;
+ UINT32 IoBase0;
+ UINT32 IoLimit0; ///< I/O Base Register 0
+ UINT32 IoBase1; ///< I/O Limit Register 0
+ UINT32 IoLimit1;
+ UINT8 InterruptLine; ///< Interrupt Line
+ UINT8 InterruptPin; ///< Interrupt Pin
+ UINT16 BridgeControl; ///< Bridge Control
+} PCI_CARDBUS_HEADER;
+
+typedef struct {
+ PCI_COMMON_HEADER Common;
+ union {
+ PCI_DEVICE_HEADER Device;
+ PCI_BRIDGE_HEADER Bridge;
+ PCI_CARDBUS_HEADER CardBus;
+ } NonCommon;
+ UINT32 Data[48];
+} PCI_CONFIG_SPACE;
+
+/**
+ AMT only need to know removable PCI device information.
+
+ @param[in] None
+
+ @retval EFI_SUCCESS mAmtPciFru will be update.
+ @retval EFI_OUT_OF_RESOURCES System on-board device list is larger than
+ MAX_FILTER_OUT_DEVICE_NUMBER supported.
+**/
+EFI_STATUS
+BuildPciFru (
+ VOID
+ )
+;
+
+/**
+ Collect all media devices.
+
+ @param[in] None
+
+ @retval None
+**/
+VOID
+EFIAPI
+BuildMediaList (
+ VOID
+ )
+;
+#endif // _INVENTORY_H_
diff --git a/ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/MebxBiosParamsDebugDumpDxe.c b/ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/MebxBiosParamsDebugDumpDxe.c
new file mode 100644
index 0000000..dda4561
--- /dev/null
+++ b/ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/MebxBiosParamsDebugDumpDxe.c
@@ -0,0 +1,55 @@
+/** @file
+ Dump whole MEBX_BPF and serial out.
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved This
+ software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "BiosExtensionLoader.h"
+#endif
+
+/**
+ Dump MEBx BIOS Params
+
+ @param[in] MebxBiosParams MEBx BIOS params
+
+ @retval None
+**/
+VOID
+DxeMebxBiosParamsDebugDump (
+ IN MEBX_BPF *MebxBiosParams
+ )
+{
+ DEBUG ((EFI_D_INFO, "\n------------------------ MebxBiosParams Dump Begin -----------------\n"));
+ DEBUG ((EFI_D_INFO, " BpfVersion : 0x%x\n", MebxBiosParams->BpfVersion));
+ DEBUG ((EFI_D_INFO, " CpuReplacementTimeout : 0x%x\n", MebxBiosParams->CpuReplacementTimeout));
+ DEBUG ((EFI_D_INFO, " ActiveRemoteAssistanceProcess : 0x%x\n", MebxBiosParams->ActiveRemoteAssistanceProcess));
+ DEBUG ((EFI_D_INFO, " CiraTimeout : 0x%x\n", MebxBiosParams->CiraTimeout));
+ DEBUG ((EFI_D_INFO, " OemFlags : 0x%x\n", MebxBiosParams->OemFlags));
+ DEBUG ((EFI_D_INFO, "MebxDebugFlags ---\n"));
+ DEBUG ((EFI_D_INFO, " Port80 : 0x%x\n", MebxBiosParams->MebxDebugFlags.Port80));
+ DEBUG ((EFI_D_INFO, " MeBiosSyncDataPtr : 0x%x\n", MebxBiosParams->MeBiosSyncDataPtr));
+ DEBUG ((EFI_D_INFO, " UsbKeyDataStructurePtr : 0x%x\n", MebxBiosParams->UsbKeyDataStructurePtr));
+ DEBUG ((EFI_D_INFO, "OemResolutionSettings ---\n"));
+ DEBUG ((EFI_D_INFO, " MebxNonUiTextMode : 0x%x\n", MebxBiosParams->OemResolutionSettings.MebxNonUiTextMode));
+ DEBUG ((EFI_D_INFO, " MebxUiTextMode : 0x%x\n", MebxBiosParams->OemResolutionSettings.MebxUiTextMode));
+ DEBUG ((EFI_D_INFO, " MebxUiTextMode : 0x%x\n", MebxBiosParams->OemResolutionSettings.MebxGraphicsMode));
+ DEBUG ((EFI_D_INFO, "\n------------------------ MebxBiosParams Dump End -------------------\n"));
+}
+
diff --git a/ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/UsbProvision.c b/ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/UsbProvision.c
new file mode 100644
index 0000000..50dbffc
--- /dev/null
+++ b/ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/UsbProvision.c
@@ -0,0 +1,753 @@
+/** @file
+ Performs USB Key Provisioning for AMT.
+
+@copyright
+ Copyright (c) 2005 - 2012 Intel Corporation. All rights
+ reserved This software and associated documentation (if any)
+ is furnished under a license and may only be used or copied in
+ accordance with the terms of the license. Except as permitted
+ by such license, no part of this software or documentation may
+ be reproduced, stored in a retrieval system, or transmitted in
+ any form or by any means without the express written consent
+ of Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "UsbProvision.h"
+#endif
+
+VOID *mUsbProvData;
+VOID *mUsbProvDataBackup;
+UINTN mUsbProvDataSize;
+BOOLEAN mUsbProvsionDone;
+UINT8 mUsbKeyBus, mUsbKeyPort, mUsbKeyDevice, mUsbKeyFunction;
+EFI_GUID mFileTypeUuid = FILE_TYPE_UUID;
+EFI_GUID mFileTypeUuid2x = FILE_TYPE_UUID_2X;
+EFI_GUID mFileTypeUuid3 = FILE_TYPE_UUID_3;
+EFI_GUID mFileTypeUuid4 = FILE_TYPE_UUID_4;
+
+EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *mUsbProvisionFileVolume;
+VOID *mUsbProvisionFileBuffer;
+UINTN mUsbCurrentRecordOffset;
+BOOLEAN mVersion2OrAbove;
+
+/**
+ Helper function called as part of the code needed
+ to allocate the proper sized buffer for various
+ EFI interfaces.
+
+ @param[in] Status Current status
+ @param[in] Buffer Current allocated buffer, or NULL
+ @param[in] BufferSize Current buffer size needed
+
+ @retval TRUE if the buffer was reallocated and the caller should try the
+ API again.
+**/
+BOOLEAN
+GrowBuffer (
+ IN OUT EFI_STATUS *Status,
+ IN OUT VOID **Buffer,
+ IN UINTN BufferSize
+ )
+{
+ BOOLEAN TryAgain;
+
+ ///
+ /// If this is an initial request, buffer will be null with a new buffer size
+ ///
+ if (!*Buffer && BufferSize) {
+ *Status = EFI_BUFFER_TOO_SMALL;
+ }
+ ///
+ /// If the status code is "buffer too small", resize the buffer
+ ///
+ TryAgain = FALSE;
+ if (*Status == EFI_BUFFER_TOO_SMALL) {
+
+ if (*Buffer) {
+ FreePool (*Buffer);
+ }
+
+ *Buffer = AllocatePool (BufferSize);
+
+ if (*Buffer) {
+ TryAgain = TRUE;
+ } else {
+ *Status = EFI_OUT_OF_RESOURCES;
+ }
+ }
+ ///
+ /// If there's an error, free the buffer
+ ///
+ if (!TryAgain && EFI_ERROR (*Status) && *Buffer) {
+ FreePool (*Buffer);
+ *Buffer = NULL;
+ }
+
+ return TryAgain;
+}
+
+/**
+ Function gets the file information from an open file descriptor, and stores it
+ in a buffer allocated from pool.
+
+ @param[in] FHand A file handle
+
+ @retval EFI_FILE_INFO A pointer to a buffer with file information or NULL is returned
+**/
+EFI_FILE_INFO *
+LibFileInfo (
+ IN EFI_FILE_HANDLE FHand
+ )
+{
+ EFI_STATUS Status;
+ EFI_FILE_INFO *Buffer;
+ UINTN BufferSize;
+
+ ///
+ /// Initialize for GrowBuffer loop
+ ///
+ Buffer = NULL;
+ BufferSize = SIZE_OF_EFI_FILE_INFO + 200;
+
+ ///
+ /// Call the real function
+ ///
+ while (GrowBuffer (&Status, (VOID **) &Buffer, BufferSize)) {
+ Status = FHand->GetInfo (
+ FHand,
+ &gEfiFileInfoGuid,
+ &BufferSize,
+ Buffer
+ );
+ }
+
+ return Buffer;
+}
+
+/**
+ Search device which it is match the device path.
+
+ @param[in] DevicePath The list of Device patch
+ @param[in] DevicePathHeader Path hoping to be found.
+
+ @retval DevicePath Can be matched
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+GetDevicePathTypeMatch (
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath,
+ EFI_DEVICE_PATH_PROTOCOL *DevicePathHeader
+ )
+{
+ while (!IsDevicePathEnd (DevicePath)) {
+ if (DevicePath->Type == DevicePathHeader->Type && DevicePath->SubType == DevicePathHeader->SubType) {
+ return DevicePath;
+ } else {
+ DevicePath = NextDevicePathNode (DevicePath);
+ }
+ }
+
+ return NULL;
+}
+
+/**
+ Get USB device path from the list of devices
+
+ @param[in] DevicePath The list of Device patch
+
+ @retval DevicePath Can be matched
+**/
+USB_DEVICE_PATH *
+GetUsbDevicePath (
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath
+ )
+{
+ EFI_DEVICE_PATH_PROTOCOL UsbDevicePath = { MESSAGING_DEVICE_PATH, MSG_USB_DP };
+ return (USB_DEVICE_PATH *) GetDevicePathTypeMatch (DevicePath, &UsbDevicePath);
+}
+
+/**
+ Get Media device path from the list of devices
+
+ @param[in] DevicePath The list of Device patch
+
+ @retval DevicePath Can be matched
+**/
+HARDDRIVE_DEVICE_PATH *
+GetMediaDevicePath (
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath
+ )
+{
+ EFI_DEVICE_PATH_PROTOCOL MediaDevicePath = { MESSAGING_DEVICE_PATH, MEDIA_HARDDRIVE_DP };
+ return (HARDDRIVE_DEVICE_PATH *) GetDevicePathTypeMatch (DevicePath, &MediaDevicePath);
+}
+
+/**
+ Get PCI device path from the list of devices
+
+ @param[in] DevicePath The list of Device patch
+
+ @retval DevicePath Can be matched
+**/
+PCI_DEVICE_PATH *
+GetPciDevicePath (
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath
+ )
+{
+ EFI_DEVICE_PATH_PROTOCOL PciDevicePath = { HARDWARE_DEVICE_PATH, HW_PCI_DP };
+ return (PCI_DEVICE_PATH *) GetDevicePathTypeMatch (DevicePath, &PciDevicePath);
+}
+
+#pragma optimize("", off)
+
+/**
+ Read provisioning file and checking if header is valid.
+
+ @param[in] FileHandle File handle will be checking.
+
+ @retval None
+**/
+VOID
+DoProvision (
+ EFI_FILE_HANDLE FileHandle
+ )
+{
+ EFI_STATUS Status;
+ EFI_FILE_INFO *FileInfo;
+ UINTN FileInfoSize;
+ FILE_HEADER_RECORD *FileHeaderRecord;
+ DATA_RECORD_HEADER *DataRecordHeader;
+ UINT16 DataRecordEntryCount;
+ UINTN FileHeaderSize;
+ UINTN DataRecordSize;
+ DATA_RECORD_ENTRY *DataRecordEntry;
+ UINTN ConsumedDataRecordSize;
+ UINTN UsbProvisionFileSize;
+#ifdef EFI_DEBUG
+ UINT16 Padding;
+#endif
+
+ FileInfoSize = 0;
+ FileInfo = NULL;
+ FileHeaderRecord = NULL;
+ DataRecordEntryCount = 0;
+ DataRecordSize = 0;
+ DataRecordHeader = NULL;
+
+ FileInfo = LibFileInfo (FileHandle);
+ if (FileInfo == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
+ goto Done;
+ }
+
+ mUsbProvisionFileBuffer = AllocatePool ((UINTN) FileInfo->FileSize);
+ if (mUsbProvisionFileBuffer != NULL) {
+ UsbProvisionFileSize = (UINTN) FileInfo->FileSize;
+
+ Status = FileHandle->Read (FileHandle, &UsbProvisionFileSize, mUsbProvisionFileBuffer);
+ if (EFI_ERROR (Status)) {
+ goto Done;
+ }
+ } else {
+ Status = EFI_OUT_OF_RESOURCES;
+ goto Done;
+ }
+ ///
+ /// Check if Valid File header record
+ ///
+ FileHeaderRecord = (FILE_HEADER_RECORD *) mUsbProvisionFileBuffer;
+ if (CompareGuid ((EFI_GUID *) &(FileHeaderRecord->FileTypeUUID), &mFileTypeUuid) == TRUE) {
+ if (FileHeaderRecord->MajorVersion == MAJOR_VERSION) {
+ if (FileHeaderRecord->MinorVersion != MINOR_VERSION) {
+ return ;
+ }
+ } else {
+ return ;
+ }
+ } else if (CompareGuid ((EFI_GUID *) &(FileHeaderRecord->FileTypeUUID), &mFileTypeUuid2x) == TRUE) {
+ if (FileHeaderRecord->MajorVersion == MAJOR_VERSION_20) {
+ if ((FileHeaderRecord->MinorVersion != MINOR_VERSION_20) && (FileHeaderRecord->MinorVersion != MINOR_VERSION_21)) {
+ return ;
+ }
+ } else {
+ return ;
+ }
+ } else if (CompareGuid ((EFI_GUID *) &(FileHeaderRecord->FileTypeUUID), &mFileTypeUuid3) == TRUE) {
+ if (FileHeaderRecord->MajorVersion == MAJOR_VERSION_30) {
+ if (FileHeaderRecord->MinorVersion != MINOR_VERSION_30) {
+ return ;
+ }
+ } else {
+ return ;
+ }
+ } else if (CompareGuid ((EFI_GUID *) &(FileHeaderRecord->FileTypeUUID), &mFileTypeUuid4) == TRUE) {
+ if (FileHeaderRecord->MajorVersion == MAJOR_VERSION_40) {
+ if (FileHeaderRecord->MinorVersion != MINOR_VERSION_40) {
+ return ;
+ }
+ } else {
+ return ;
+ }
+
+ } else {
+ return ;
+ }
+
+ if (FileHeaderRecord->MajorVersion >= MAJOR_VERSION_20) {
+ mVersion2OrAbove = TRUE;
+ } else {
+ mVersion2OrAbove = FALSE;
+ }
+ ///
+ /// Check if all records are consumed.
+ ///
+ if (FileHeaderRecord->DataRecordsConsumed == FileHeaderRecord->DataRecordCount) {
+ return ;
+ }
+ ///
+ /// Calculate Data Record size
+ ///
+ DataRecordSize = (FileHeaderRecord->DataRecordChunkCount) * CHUNK_SIZE;
+
+ ///
+ /// Calculate Consumed Data Record size
+ ///
+ ConsumedDataRecordSize = (FileHeaderRecord->DataRecordsConsumed) * DataRecordSize;
+
+ ///
+ /// Calculate File Header Size
+ ///
+ FileHeaderSize = (FileHeaderRecord->RecordChunkCount) * CHUNK_SIZE;
+
+ ///
+ /// Calculate Current Data Record Header Offset
+ ///
+ mUsbCurrentRecordOffset = FileHeaderSize + ConsumedDataRecordSize;
+
+ ///
+ /// Get current Data Record Header pointer
+ ///
+ DataRecordHeader = (DATA_RECORD_HEADER *) ((UINTN) mUsbProvisionFileBuffer + mUsbCurrentRecordOffset);
+
+ ///
+ /// Check if this is a data record
+ ///
+ if (DataRecordHeader->RecordTypeIdentifier == DATA_RECORD_TYPE_DATA_RECORD) {
+ ///
+ /// Check the if valid flag is set
+ ///
+ if ((DataRecordHeader->RecordFlags) & DATA_RECORD_FLAG_VALID) {
+ ///
+ /// Found a valid Data Record
+ ///
+ mUsbProvsionDone = TRUE;
+
+ ///
+ /// fetch the first entry
+ ///
+ DataRecordEntry = (DATA_RECORD_ENTRY *) ((UINTN) DataRecordHeader + DataRecordHeader->RecordHeaderByteCount);
+
+#ifdef EFI_DEBUG
+ DataRecordEntryCount = 0;
+ do {
+ switch (DataRecordEntry->ModuleIdentifier) {
+ case MODULE_IDENTIFIER_INVALID:
+ goto Done;
+ break;
+
+ case MODULE_IDENTIFIER_ME_KERNEL:
+ DEBUG ((EFI_D_ERROR, "MODULE_IDENTIFIER_ME_KERNEL\n"));
+ switch (DataRecordEntry->VariableIdentifier) {
+ case VARIABLE_IDENTIFIER_ME_KERNEL_INVALID:
+ goto Done;
+
+ case VARIABLE_IDENTIFIER_ME_KERNEL_CURRENT_MEBX_PASSWORD:
+ DataRecordEntryCount++;
+ DEBUG ((EFI_D_ERROR, "VARIABLE_IDENTIFIER_ME_KERNEL_CURRENT_MEBX_PASSWORD\n"));
+ break;
+
+ case VARIABLE_IDENTIFIER_ME_KERNEL_NEW_MEBX_PASSWORD:
+ DataRecordEntryCount++;
+ DEBUG ((EFI_D_ERROR, "VARIABLE_IDENTIFIER_ME_KERNEL_NEW_MEBX_PASSWORD\n"));
+ break;
+ } // end of switch VariableIdentifier
+ break;
+
+ case MODULE_IDENTIFIER_INTEL_AMT_CM:
+ DEBUG ((EFI_D_ERROR, "MODULE_IDENTIFIER_ME_KERNEL\n"));
+ switch (DataRecordEntry->VariableIdentifier) {
+ case VARIABLE_IDENTIFIER_INTEL_AMT_CM_INVALID:
+ goto Done;
+
+ case VARIABLE_IDENTIFIER_INTEL_AMT_CM_PID:
+ DataRecordEntryCount++;
+ DEBUG ((EFI_D_ERROR, "VARIABLE_IDENTIFIER_INTEL_AMT_CM_PID\n"));
+ break;
+
+ case VARIABLE_IDENTIFIER_INTEL_AMT_CM_PPS:
+ DataRecordEntryCount++;
+ DEBUG ((EFI_D_ERROR, "VARIABLE_IDENTIFIER_INTEL_AMT_CM_PPS\n"));
+ break;
+ } // end of switch VariableIdentifier
+ break;
+ } // End of switch ModuleIdentifier
+ ///
+ /// Move to the next entry
+ ///
+ ///
+ /// Calculate the padding required
+ ///
+ Padding = (4 - (DataRecordEntry->VariableLenght % 4)) % 4;
+
+ DataRecordEntry = (DATA_RECORD_ENTRY *) ((UINTN) DataRecordEntry + 8 + DataRecordEntry->VariableLenght + Padding);
+ } while ((UINTN) DataRecordEntry < ((UINTN) DataRecordHeader + DataRecordSize));
+#endif // end of EFI_DEBUG
+ } // end of if RecordFlags
+ } // end of if RecordTypeIdentifier
+
+Done:
+ if (mUsbProvsionDone) {
+ DEBUG ((EFI_D_ERROR, "Found Total %x Entries\n", DataRecordEntryCount));
+ DEBUG ((EFI_D_ERROR, "Found Consumed %x Entries\n", FileHeaderRecord->DataRecordsConsumed));
+ mUsbProvData = (VOID *) DataRecordHeader;
+ mUsbProvDataSize = DataRecordSize;
+ DEBUG ((EFI_D_ERROR, "Total Size is %x\n", mUsbProvDataSize));
+ mUsbProvDataBackup = AllocateZeroPool ((UINTN) DataRecordSize);
+ }
+
+ return ;
+}
+
+#pragma optimize("", on)
+
+/**
+ Remove Consumed Data Record in USB Key Provisioning Data File
+
+ @param[in] None.
+
+ @retval None
+**/
+VOID
+UsbConsumedDataRecordRemove (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ EFI_FILE_HANDLE UsbRootFileHandle;
+ EFI_FILE_HANDLE UsbProvisionFileHandle;
+ FILE_HEADER_RECORD *FileHeaderRecord;
+ UINTN FileSize;
+ DATA_RECORD_HEADER *DataRecordHeader;
+
+ if (mUsbProvsionDone) {
+ DataRecordHeader = (DATA_RECORD_HEADER *) mUsbProvData;
+ FileHeaderRecord = (FILE_HEADER_RECORD *) mUsbProvisionFileBuffer;
+
+ ///
+ /// If version 2 or above and DONT_CONSUME_RECORDS is set, don't remove the record
+ ///
+ if (mVersion2OrAbove && ((FileHeaderRecord->FileFlags) & FILE_FLAGS_DONT_CONSUME_RECORDS)) {
+ return ;
+ }
+ ///
+ /// check if file is present in the root dir
+ ///
+ Status = mUsbProvisionFileVolume->OpenVolume (mUsbProvisionFileVolume, &UsbRootFileHandle);
+ ASSERT_EFI_ERROR (Status);
+
+ Status = UsbRootFileHandle->Open (
+ UsbRootFileHandle,
+ &UsbProvisionFileHandle,
+ USB_PROVISIONING_DATA_FILE_NAME,
+ EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE,
+ 0
+ );
+ if (!EFI_ERROR (Status)) {
+ (FileHeaderRecord->DataRecordsConsumed)++;
+ ///
+ /// Zero-out data record body and set valid flag to invalid
+ ///
+ ZeroMem (
+ (VOID *) ((UINTN) mUsbProvData + DataRecordHeader->RecordHeaderByteCount),
+ mUsbProvDataSize - DataRecordHeader->RecordHeaderByteCount
+ );
+ DataRecordHeader->RecordFlags &= ~DATA_RECORD_FLAG_VALID;
+
+ UsbProvisionFileHandle->SetPosition (
+ UsbProvisionFileHandle,
+ (UINT64) USB_DATA_RECORD_CONSUMED_OFFSET
+ );
+
+ FileSize = sizeof (FileHeaderRecord->DataRecordsConsumed);
+ UsbProvisionFileHandle->Write (
+ UsbProvisionFileHandle,
+ &FileSize,
+ &FileHeaderRecord->DataRecordsConsumed
+ );
+
+ UsbProvisionFileHandle->SetPosition (
+ UsbProvisionFileHandle,
+ (UINT64) mUsbCurrentRecordOffset
+ );
+ FileSize = mUsbProvDataSize;
+ UsbProvisionFileHandle->Write (
+ UsbProvisionFileHandle,
+ &FileSize,
+ mUsbProvData
+ );
+ UsbProvisionFileHandle->Close (UsbProvisionFileHandle);
+ }
+
+ UsbRootFileHandle->Close (UsbRootFileHandle);
+ }
+
+ return ;
+}
+
+/**
+ Restore Consumed Data Record in USB Key Provisioning Data File
+
+ @param[in] None.
+
+ @retval None
+**/
+VOID
+UsbConsumedDataRecordRestore (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ EFI_FILE_HANDLE UsbRootFileHandle;
+ EFI_FILE_HANDLE UsbProvisionFileHandle;
+ FILE_HEADER_RECORD *FileHeaderRecord;
+ UINTN FileSize;
+ DATA_RECORD_HEADER *DataRecordHeader;
+
+ if (mUsbProvsionDone) {
+ DataRecordHeader = (DATA_RECORD_HEADER *) mUsbProvDataBackup;
+ FileHeaderRecord = (FILE_HEADER_RECORD *) mUsbProvisionFileBuffer;
+
+ ///
+ /// If version 2 or above and DONT_CONSUME_RECORDS is set, don't need to restore the record
+ /// If DataRecordHeader->RecordFlags, DATA_RECORD_FLAG_VALID is not set, don't need to restore the record
+ ///
+ if ((mVersion2OrAbove && ((FileHeaderRecord->FileFlags) & FILE_FLAGS_DONT_CONSUME_RECORDS)) ||
+ (((DataRecordHeader->RecordFlags) & DATA_RECORD_FLAG_VALID) == 0)
+ ) {
+ FreePool (mUsbProvisionFileBuffer);
+ FreePool (mUsbProvDataBackup);
+ return ;
+ }
+ ///
+ /// check if file is present in the root dir
+ ///
+ Status = mUsbProvisionFileVolume->OpenVolume (mUsbProvisionFileVolume, &UsbRootFileHandle);
+ ASSERT_EFI_ERROR (Status);
+
+ Status = UsbRootFileHandle->Open (
+ UsbRootFileHandle,
+ &UsbProvisionFileHandle,
+ USB_PROVISIONING_DATA_FILE_NAME,
+ EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE,
+ 0
+ );
+ if (!EFI_ERROR (Status)) {
+ ///
+ /// Restore DataRecordsConsumed number
+ ///
+ (FileHeaderRecord->DataRecordsConsumed)--;
+ UsbProvisionFileHandle->SetPosition (
+ UsbProvisionFileHandle,
+ (UINT64) USB_DATA_RECORD_CONSUMED_OFFSET
+ );
+
+ FileSize = sizeof (FileHeaderRecord->DataRecordsConsumed);
+ UsbProvisionFileHandle->Write (
+ UsbProvisionFileHandle,
+ &FileSize,
+ &FileHeaderRecord->DataRecordsConsumed
+ );
+
+ UsbProvisionFileHandle->SetPosition (
+ UsbProvisionFileHandle,
+ (UINT64) mUsbCurrentRecordOffset
+ );
+ FileSize = mUsbProvDataSize;
+ UsbProvisionFileHandle->Write (
+ UsbProvisionFileHandle,
+ &FileSize,
+ mUsbProvDataBackup
+ );
+ UsbProvisionFileHandle->Close (UsbProvisionFileHandle);
+ }
+
+ UsbRootFileHandle->Close (UsbRootFileHandle);
+ FreePool (mUsbProvisionFileBuffer);
+ FreePool (mUsbProvDataBackup);
+ }
+
+ return ;
+}
+
+/**
+ Check USB Key Provisioning Data
+
+ @param[in] None.
+
+ @retval None
+**/
+VOID
+UsbKeyProvisioning (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ UINTN NumberFileSystemHandles;
+ EFI_HANDLE *FileSystemHandles;
+ UINTN Index;
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ USB_DEVICE_PATH *UsbDevicePath;
+ PCI_DEVICE_PATH *PciDevicePath;
+ PCI_DEVICE_PATH *ParentPciDevicePath;
+ PCI_DEVICE_PATH *NextPciDevicePath;
+ EFI_DEVICE_PATH_PROTOCOL *NextDevicePath;
+ EFI_FILE_HANDLE UsbRootFileHandle;
+ EFI_FILE_HANDLE UsbProvisionFileHandle;
+ UINT8 UsbBusNumber;
+ UINT64 PciAddress;
+
+ ///
+ /// This flag will be set only when some meaningfull data is read from USB key
+ ///
+ mUsbProvsionDone = FALSE;
+
+ ///
+ /// Parse Fixed Disk Devices.
+ ///
+ gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiSimpleFileSystemProtocolGuid,
+ NULL,
+ &NumberFileSystemHandles,
+ &FileSystemHandles
+ );
+
+ for (Index = 0; Index < NumberFileSystemHandles; Index++) {
+ DevicePath = DevicePathFromHandle (FileSystemHandles[Index]);
+ if (DevicePath == NULL) {
+ continue;
+ }
+
+ UsbDevicePath = GetUsbDevicePath (DevicePath);
+ if (UsbDevicePath == NULL) {
+ continue;
+ }
+
+ Status = gBS->HandleProtocol (
+ FileSystemHandles[Index],
+ &gEfiSimpleFileSystemProtocolGuid,
+ (VOID **) &mUsbProvisionFileVolume
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// check if file is present in the root dir
+ ///
+ Status = mUsbProvisionFileVolume->OpenVolume (mUsbProvisionFileVolume, &UsbRootFileHandle);
+ ASSERT_EFI_ERROR (Status);
+
+ Status = UsbRootFileHandle->Open (
+ UsbRootFileHandle,
+ &UsbProvisionFileHandle,
+ USB_PROVISIONING_DATA_FILE_NAME,
+ EFI_FILE_MODE_READ,
+ 0
+ );
+
+ if (!EFI_ERROR (Status)) {
+ ///
+ /// USB Key Provisioning Data File is exist.
+ ///
+ ///
+ /// Locate PCI IO protocol for PCI registers read
+ ///
+ Status = gBS->LocateProtocol (
+ &gEfiPciRootBridgeIoProtocolGuid,
+ NULL,
+ (VOID **) &PciRootBridgeIo
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Get bus number by analysis Device Path and PCI Register - PCI_BRIDGE_SECONDARY_BUS_REGISTER_OFFSET
+ ///
+ PciDevicePath = GetPciDevicePath (DevicePath);
+ if (PciDevicePath == NULL) {
+ break;
+ }
+
+ ParentPciDevicePath = NULL;
+ UsbBusNumber = 0;
+ while (TRUE) {
+ NextDevicePath = (EFI_DEVICE_PATH_PROTOCOL *) PciDevicePath;
+ NextDevicePath = NextDevicePathNode (NextDevicePath);
+ NextPciDevicePath = GetPciDevicePath (NextDevicePath);
+ if (NextPciDevicePath == NULL) {
+ break;
+ }
+ ///
+ /// If found next PCI Device Path, current Device Path is a P2P bridge
+ ///
+ ParentPciDevicePath = PciDevicePath;
+ PciDevicePath = NextPciDevicePath;
+ ///
+ /// Read Bus number
+ ///
+ PciAddress = EFI_PCI_ADDRESS (
+ UsbBusNumber,
+ ParentPciDevicePath->Device,
+ ParentPciDevicePath->Function,
+ PCI_BRIDGE_SECONDARY_BUS_REGISTER_OFFSET
+ );
+ Status = PciRootBridgeIo->Pci.Read (
+ PciRootBridgeIo,
+ EfiPciWidthUint8,
+ PciAddress,
+ 1,
+ &UsbBusNumber
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
+ ///
+ /// Need a way to get this information
+ ///
+ mUsbKeyPort = UsbDevicePath->InterfaceNumber;
+ mUsbKeyBus = UsbBusNumber;
+ mUsbKeyDevice = PciDevicePath->Device;
+ mUsbKeyFunction = PciDevicePath->Function;
+ DoProvision (UsbProvisionFileHandle);
+ UsbProvisionFileHandle->Close (UsbProvisionFileHandle);
+ }
+
+ UsbRootFileHandle->Close (UsbRootFileHandle);
+ ///
+ /// Break if found a valid provisioning file
+ ///
+ if (mUsbProvsionDone == TRUE) {
+ break;
+ }
+ } // End of For NumberFileSystem Loop
+
+ if (NumberFileSystemHandles != 0) {
+ FreePool (FileSystemHandles);
+ }
+}
diff --git a/ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/UsbProvision.h b/ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/UsbProvision.h
new file mode 100644
index 0000000..74f8c08
--- /dev/null
+++ b/ReferenceCode/ME/BiosExtension/Efi/BiosExtensionLoader/Dxe/UsbProvision.h
@@ -0,0 +1,249 @@
+/** @file
+ Include for USB Key Provisioning for AMT.
+
+@copyright
+ Copyright (c) 2005 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _USB_PROVISION_H_
+#define _USB_PROVISION_H_
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#include "Pci22.h"
+
+#include EFI_PROTOCOL_CONSUMER (PciRootBridgeIo)
+#include EFI_PROTOCOL_CONSUMER (DiskInfo)
+#include EFI_PROTOCOL_CONSUMER (SimpleFileSystem)
+#include EFI_PROTOCOL_CONSUMER (FileInfo)
+#include EFI_PROTOCOL_CONSUMER (BlockIo)
+
+#pragma pack(1)
+
+typedef struct {
+ EFI_GUID FileTypeUUID;
+ UINT16 RecordChunkCount;
+ UINT16 RecordHeaderByteCount;
+ UINT32 RecordNumber;
+ UINT8 MajorVersion;
+ UINT8 MinorVersion;
+ UINT16 FileFlags;
+ UINT32 DataRecordCount;
+ UINT32 DataRecordsConsumed;
+ UINT16 DataRecordChunkCount;
+ UINT16 Reserved2;
+ UINT16 ModuleList[(127 - 9) * 2];
+} FILE_HEADER_RECORD;
+
+///
+/// File Flags definition (V2 and above)
+///
+#define FILE_FLAGS_DONT_CONSUME_RECORDS 0x01
+
+//
+// FileTypeUUID
+//
+#define FILE_TYPE_UUID \
+ { \
+ 0x71FB16B5, 0xCB87, 0x4AF9, 0xB4, 0x41, 0xCA, 0x7B, 0x38, 0x35, 0x78, 0xF9 \
+ }
+
+#define FILE_TYPE_UUID_2X \
+ { \
+ 0x5881B296, 0x6BCF, 0x4C72, 0x8B, 0x91, 0xA1, 0x5E, 0x51, 0x2E, 0x99, 0xC4 \
+ }
+
+#define FILE_TYPE_UUID_3 \
+ { \
+ 0xC6F6F7A7, 0xC489, 0x47F6, 0x93, 0xED, 0xE2, 0xE5, 0x02, 0x0D, 0xA5, 0x1D \
+ }
+
+#define FILE_TYPE_UUID_4 \
+ { \
+ 0x5234A9AA, 0x29E1, 0x44A9, 0x8D, 0x4D, 0x08, 0x1C, 0x07, 0xB9, 0x63, 0x53 \
+ }
+
+//
+// MajorVersion
+//
+#define MAJOR_VERSION 0x01 ///< Check this value
+#define MINOR_VERSION 0x00 ///< Check this value
+#define MAJOR_VERSION_20 0x02
+#define MINOR_VERSION_20 0x00
+#define MAJOR_VERSION_21 0x02
+#define MINOR_VERSION_21 0x01
+#define MAJOR_VERSION_30 0x03
+#define MINOR_VERSION_30 0x00
+#define MAJOR_VERSION_40 0x04
+#define MINOR_VERSION_40 0x00
+
+#define VERSION_10 0x0001
+#define VERSION_20 0x0002
+#define VERSION_21 0x0102
+#define VERSION_30 0x0003
+
+typedef struct {
+ UINT32 RecordTypeIdentifier;
+ UINT32 RecordFlags;
+ UINT32 Reserved1[2];
+ UINT16 RecordChunkCount;
+ UINT16 RecordHeaderByteCount;
+ UINT32 RecordNumber;
+} DATA_RECORD_HEADER;
+
+//
+// RecordTypeIdentifier
+//
+#define DATA_RECORD_TYPE_INVALID 0
+#define DATA_RECORD_TYPE_DATA_RECORD 1
+
+///
+/// RecordFlags
+///
+#define DATA_RECORD_FLAG_VALID 1
+
+typedef struct {
+ UINT16 ModuleIdentifier;
+ UINT16 VariableIdentifier;
+ UINT16 VariableLenght;
+ UINT16 Reserved1;
+ VOID *VariableValue;
+} DATA_RECORD_ENTRY;
+
+//
+// ModuleIdentifier
+//
+#define MODULE_IDENTIFIER_INVALID 0
+#define MODULE_IDENTIFIER_ME_KERNEL 1
+#define MODULE_IDENTIFIER_INTEL_AMT_CM 2
+
+//
+// VariableIdentifier
+// MODULE_IDENTIFIER_ME_KERNEL
+//
+#define VARIABLE_IDENTIFIER_ME_KERNEL_INVALID 0
+#define VARIABLE_IDENTIFIER_ME_KERNEL_CURRENT_MEBX_PASSWORD 1
+#define VARIABLE_IDENTIFIER_ME_KERNEL_NEW_MEBX_PASSWORD 2
+
+//
+// MODULE_IDENTIFIER_INTEL_AMT_CM
+//
+#define VARIABLE_IDENTIFIER_INTEL_AMT_CM_INVALID 0
+#define VARIABLE_IDENTIFIER_INTEL_AMT_CM_PID 1
+#define VARIABLE_IDENTIFIER_INTEL_AMT_CM_PPS 2
+
+typedef struct {
+ UINT32 USBKeyLocationInfo;
+ UINT32 Reserved1[3];
+} USB_KEY_PROVISIONING;
+
+//
+// DISK Definition
+//
+///
+/// PART_RECORD
+///
+typedef struct _PART_RECORD {
+ UINT8 BootIndicator;
+ UINT8 StartHead;
+ UINT8 StartSector;
+ UINT8 StartCylinder;
+ UINT8 PartitionType;
+ UINT8 EndHead;
+ UINT8 EndSector;
+ UINT8 EndCylinder;
+ UINT32 StartLba;
+ UINT32 SizeInLba;
+} PART_RECORD;
+
+///
+/// MBR Partition table
+///
+typedef struct _MBR {
+ UINT8 CodeArea[440];
+ UINT32 OptionalDiskSig;
+ UINT16 Reserved;
+ PART_RECORD PartRecord[4];
+ UINT16 Sig;
+} MASTER_BOOT_RECORD;
+
+typedef struct _BPB_RECORD {
+ UINT8 BS_JmpBoot[3];
+ UINT8 BS_OEMName[8];
+ UINT16 BPB_BytePerSec;
+ UINT8 BPB_SecPerClus;
+ UINT16 BPB_RsvdSecCnt;
+ UINT8 BPB_NumFATs;
+ UINT16 BPB_RootEntCnt;
+ UINT16 BPB_TotSec16;
+ UINT8 BPB_Media;
+ UINT16 BPB_FATSz16;
+ UINT16 BPB_SecPerTrk;
+ UINT16 BPB_NumHeads;
+ UINT32 BPB_Hiddsec;
+ UINT32 BPB_TotSec32;
+} BPB_RECORD;
+
+#pragma pack()
+
+#define CHUNK_SIZE 512
+
+#define USB_PROVISIONING_DATA_FILE_NAME L"\\setup.bin"
+
+#define USB_DATA_RECORD_CONSUMED_OFFSET EFI_FIELD_OFFSET (FILE_HEADER_RECORD, DataRecordsConsumed)
+
+/**
+ Remove Consumed Data Record in USB Key Provisioning Data File
+
+ @param[in] None.
+
+ @retval None
+**/
+VOID
+UsbConsumedDataRecordRemove (
+ VOID
+ )
+;
+
+/**
+ Restore Consumed Data Record in USB Key Provisioning Data File
+
+ @param[in] None.
+
+ @retval None
+**/
+VOID
+UsbConsumedDataRecordRestore (
+ VOID
+ )
+;
+
+/**
+ Check USB Key Provisioning Data
+
+ @param[in] None.
+
+ @retval None
+**/
+VOID
+UsbKeyProvisioning (
+ VOID
+ )
+;
+
+#endif // _USB_PROVISION_H_
diff --git a/ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/EfiMEBx.cif b/ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/EfiMEBx.cif
new file mode 100644
index 0000000..b0c0203
--- /dev/null
+++ b/ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/EfiMEBx.cif
@@ -0,0 +1,9 @@
+<component>
+ name = "EfiMEBx"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\BiosExtension\Efi\EfiMEBx\"
+ RefName = "EfiMEBx"
+[parts]
+"Mebx"
+"MebxSetupBrowser"
+<endComponent>
diff --git a/ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/Mebx/MEBx.cif b/ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/Mebx/MEBx.cif
new file mode 100644
index 0000000..b9b87b3
--- /dev/null
+++ b/ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/Mebx/MEBx.cif
@@ -0,0 +1,12 @@
+<component>
+ name = "MEBx"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\BiosExtension\Efi\EfiMEBx\Mebx"
+ RefName = "MEBx"
+[files]
+"Mebx.dxs"
+"Mebx.inf"
+"Mebx.mak"
+"Mebx.sdl"
+"Mebx.efi"
+<endComponent>
diff --git a/ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/Mebx/Mebx.dxs b/ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/Mebx/Mebx.dxs
new file mode 100644
index 0000000..a42e841
--- /dev/null
+++ b/ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/Mebx/Mebx.dxs
@@ -0,0 +1,29 @@
+/**
+
+Copyright (c) 2012 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+
+Module Name:
+
+ Mebx.dxs
+
+Abstract:
+
+ Dependency expression file for EFI MEBx Setup Browser
+
+**/
+
+#include "EfiDepex.h"
+#include EFI_PROTOCOL_DEPENDENCY (AmtPlatformPolicy)
+
+
+DEPENDENCY_START
+ DXE_PLATFORM_AMT_POLICY_GUID
+DEPENDENCY_END
diff --git a/ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/Mebx/Mebx.efi b/ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/Mebx/Mebx.efi
new file mode 100644
index 0000000..78bc805
--- /dev/null
+++ b/ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/Mebx/Mebx.efi
Binary files differ
diff --git a/ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/Mebx/Mebx.inf b/ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/Mebx/Mebx.inf
new file mode 100644
index 0000000..ff0daa0
--- /dev/null
+++ b/ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/Mebx/Mebx.inf
@@ -0,0 +1,38 @@
+## @file
+# Component description file for LegacyBios Extension Above 1M Driver.
+#
+#@copyright
+# Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains an 'Intel Peripheral Driver' and uniquely
+# identified as "Intel Reference Module" and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+
+[defines]
+BASE_NAME = Mebx
+FILE_GUID = 9cfd802c-09a1-43d6-8217-aa49c1f90d2c
+COMPONENT_TYPE = BS_DRIVER
+BUILD_TYPE = BS_DRIVER_EFI
+
+[sources.common]
+
+[includes.common]
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)
+
+[nmake.common]
+ DPX_SOURCE = Mebx.dxs
diff --git a/ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/Mebx/Mebx.mak b/ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/Mebx/Mebx.mak
new file mode 100644
index 0000000..741abc5
--- /dev/null
+++ b/ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/Mebx/Mebx.mak
@@ -0,0 +1,91 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2010, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+#**********************************************************************
+#
+# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/BiosExtension/EfiMEBx/MEBx/Mebx.mak 2 4/23/12 10:51p Klzhan $
+#
+# $Revision: 2 $
+#
+# $Date: 4/23/12 10:51p $
+#
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/BiosExtension/EfiMEBx/MEBx/Mebx.mak $
+#
+# 2 4/23/12 10:51p Klzhan
+# 1. Update MEBX binary
+# 2. Add Elink for OEM to locate MEBX path.
+#
+# 1 2/08/12 12:59a Klzhan
+# Initial Check in
+#
+# 3 9/26/11 5:35a Klzhan
+# [TAG] EIP70516
+# [Category] Spec Update
+# [Severity] Important
+# [Description] Update ME 8.0 RC 0.8
+#
+# 2 3/25/11 3:23a Klzhan
+# Improvement : Remove un-use lines,and update Include path.
+#
+# 1 3/24/11 2:09a Klzhan
+# [TAG] EIP56501
+# [Category] Improvement
+# [Description] Support EFI MEBX.
+#
+#
+#**********************************************************************
+#
+#<AMI_FHDR_START>
+#----------------------------------------------------------------------------
+#
+# Name: MEBX.mak
+#
+# Description: EFI MEBX
+#
+#----------------------------------------------------------------------------
+#<AMI_FHDR_END>
+all : $(BUILD_DIR)\Mebx.ffs
+
+Mebx_INCLUDES=\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(ME_INCLUDES)\
+ $(EDK_INCLUDES)
+
+
+$(BUILD_DIR)\Mebx.ffs : $(EFIMebx_FILE_PATH) $(Mebx_DIR)\$(@B).mak Core\FFS.mak
+ $(MAKE) /$(MAKEFLAGS) /f Core\FFS.mak \
+ CPFLAGS="$(GLOBAL_DEFINES) /D TIANO_RELEASE_VERSION=0x00080006 $(EXTRA_DEFINES) $(Mebx_INCLUDES)" \
+ BUILD_DIR=$(BUILD_DIR) SOURCE_DIR=$(Mebx_DIR) \
+ GUID=9cfd802c-09a1-43d6-8217-aa49c1f90d2c\
+ NAME=$(@B)\
+ TYPE=EFI_FV_FILETYPE_DRIVER \
+ DEPEX1=$(Mebx_DIR)\Mebx.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \
+ PEFILE=$(EFIMebx_FILE_PATH) FFSFILE=$@ COMPRESS=1 \
+
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2010, 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/ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/Mebx/Mebx.sdl b/ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/Mebx/Mebx.sdl
new file mode 100644
index 0000000..7664926
--- /dev/null
+++ b/ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/Mebx/Mebx.sdl
@@ -0,0 +1,34 @@
+TOKEN
+ Name = "EFIMebx_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+ Help = "Main switch to enable IccOverClocking support in Project"
+ Token = "iAMT_SUPPORT" "=" "1"
+End
+
+MODULE
+ Help = "Includes Mebx.mak to Project"
+ File = "Mebx.mak"
+End
+
+PATH
+ Name = "Mebx_DIR"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\Mebx.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+
+TOKEN
+ Name = "EFIMebx_FILE_PATH"
+ Value = "$(Mebx_DIR)\Mebx.efi"
+ TokenType = Expression
+ TargetMAK = Yes
+ Help = "Mebx File name and path"
+End
diff --git a/ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/MebxSetupBrowser/MebxSetupBrowser.cif b/ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/MebxSetupBrowser/MebxSetupBrowser.cif
new file mode 100644
index 0000000..aaaa1fa
--- /dev/null
+++ b/ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/MebxSetupBrowser/MebxSetupBrowser.cif
@@ -0,0 +1,12 @@
+<component>
+ name = MebxSetupBrowser
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\BiosExtension\Efi\EfiMEBx\MebxSetupBrowser\"
+ RefName = "MebxSetupBrowser"
+[files]
+"MebxSetupBrowser.dxs"
+"MebxSetupBrowser.inf"
+"MebxSetupBrowser.mak"
+"MebxSetupBrowser.efi"
+"MebxSetupBrowser.sdl"
+<endComponent>
diff --git a/ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/MebxSetupBrowser/MebxSetupBrowser.dxs b/ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/MebxSetupBrowser/MebxSetupBrowser.dxs
new file mode 100644
index 0000000..2e2e12c
--- /dev/null
+++ b/ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/MebxSetupBrowser/MebxSetupBrowser.dxs
@@ -0,0 +1,33 @@
+/**
+
+Copyright (c) 2012 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+
+Module Name:
+
+ MebxSetupBrowser.dxs
+
+Abstract:
+
+ Dependency expression file for EFI MEBx Setup Browser
+
+**/
+
+#include "EfiDepex.h"
+#include EFI_PROTOCOL_DEPENDENCY (AmtPlatformPolicy)
+#include EFI_PROTOCOL_DEFINITION (SimpleTextIn)
+#include EFI_PROTOCOL_DEFINITION (SimpleTextOut)
+
+
+DEPENDENCY_START
+ DXE_PLATFORM_AMT_POLICY_GUID AND
+ EFI_SIMPLE_TEXT_OUT_PROTOCOL_GUID AND
+ EFI_SIMPLE_TEXT_IN_PROTOCOL_GUID
+DEPENDENCY_END
diff --git a/ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/MebxSetupBrowser/MebxSetupBrowser.efi b/ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/MebxSetupBrowser/MebxSetupBrowser.efi
new file mode 100644
index 0000000..d212aef
--- /dev/null
+++ b/ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/MebxSetupBrowser/MebxSetupBrowser.efi
Binary files differ
diff --git a/ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/MebxSetupBrowser/MebxSetupBrowser.inf b/ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/MebxSetupBrowser/MebxSetupBrowser.inf
new file mode 100644
index 0000000..7bfd8d0
--- /dev/null
+++ b/ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/MebxSetupBrowser/MebxSetupBrowser.inf
@@ -0,0 +1,38 @@
+## @file
+# Component description file for LegacyBios Extension Above 1M Driver.
+#
+#@copyright
+# Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains an 'Intel Peripheral Driver' and uniquely
+# identified as "Intel Reference Module" and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+
+[defines]
+BASE_NAME = MebxSetupBrowser
+FILE_GUID = b62efbbb-3923-4cb9-a6e8-db818e828a80
+COMPONENT_TYPE = BS_DRIVER
+BUILD_TYPE = BS_DRIVER_EFI
+
+[sources.common]
+
+[includes.common]
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)
+
+[nmake.common]
+ DPX_SOURCE = MebxSetupBrowser.dxs
diff --git a/ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/MebxSetupBrowser/MebxSetupBrowser.mak b/ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/MebxSetupBrowser/MebxSetupBrowser.mak
new file mode 100644
index 0000000..cf65f06
--- /dev/null
+++ b/ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/MebxSetupBrowser/MebxSetupBrowser.mak
@@ -0,0 +1,92 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2010, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+#**********************************************************************
+#
+# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/BiosExtension/EfiMEBx/MebxSetupBrowser/MebxSetupBrowser.mak 2 4/23/12 10:58p Klzhan $
+#
+# $Revision: 2 $
+#
+# $Date: 4/23/12 10:58p $
+#
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/BiosExtension/EfiMEBx/MebxSetupBrowser/MebxSetupBrowser.mak $
+#
+# 2 4/23/12 10:58p Klzhan
+# 1. Update MEBX binary
+# 2. Add Elink for MEBX binary path.
+#
+# 1 2/08/12 1:00a Klzhan
+# Initial Check in
+#
+# 2 3/25/11 2:50a Klzhan
+# Improvement : Remove un-use line.
+#
+# 1 3/24/11 2:19a Klzhan
+# [TAG] EIP56501
+# [Category] Improvement
+# [Description] Support EFI MEBX.
+#
+#
+#**********************************************************************
+#
+#<AMI_FHDR_START>
+#----------------------------------------------------------------------------
+#
+# Name: MebxSetupBrowser.mak
+#
+# Description: Mebx Setup Screen
+#
+#----------------------------------------------------------------------------
+#<AMI_FHDR_END>
+all : $(BUILD_DIR)\MebxSetupBrowser.ffs
+
+MebxSetupBrowser_INCLUDES=\
+ $(EDK_SOURCE_INCLUDES)\
+ $(ME_INCLUDES)\
+ -I$(EDK_SOURCE)\Foundation\Efi\
+ -I$(EDK_SOURCE)\Foundation\Include\
+ -I$(EDK_SOURCE)\Foundation\Efi\Include\
+ -I$(EDK_SOURCE)\Foundation\Framework\Include\
+!IF "$(x64_BUILD)" == "1"
+ -I$(EDK_SOURCE)\Foundation\Include\x64
+!ELSE
+ -I$(EDK_SOURCE)\Foundation\Include\ia32
+!ENDIF
+
+$(BUILD_DIR)\MebxSetupBrowser.ffs : $(EFIMebxSetup_FILE_PATH) $(MebxSetupBrowser_DIR)\$(@B).mak Core\FFS.mak
+ $(MAKE) /$(MAKEFLAGS) /f Core\FFS.mak \
+ CPFLAGS="$(GLOBAL_DEFINES) /D TIANO_RELEASE_VERSION=0x00080006 $(EXTRA_DEFINES) $(MebxSetupBrowser_INCLUDES)" \
+ BUILD_DIR=$(BUILD_DIR) SOURCE_DIR=$(MebxSetupBrowser_DIR) \
+ GUID=b62efbbb-3923-4cb9-a6e8-db818e828a80\
+ NAME=$(@B)\
+ TYPE=EFI_FV_FILETYPE_DRIVER \
+ DEPEX1=$(MebxSetupBrowser_DIR)\MebxSetupBrowser.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \
+ PEFILE=$(EFIMebxSetup_FILE_PATH) FFSFILE=$@ COMPRESS=1 \
+
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2010, 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/ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/MebxSetupBrowser/MebxSetupBrowser.sdl b/ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/MebxSetupBrowser/MebxSetupBrowser.sdl
new file mode 100644
index 0000000..b8eec64
--- /dev/null
+++ b/ReferenceCode/ME/BiosExtension/Efi/EfiMEBx/MebxSetupBrowser/MebxSetupBrowser.sdl
@@ -0,0 +1,34 @@
+TOKEN
+ Name = "MebxSetupBrowser_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+ Help = "Main switch to enable IccOverClocking support in Project"
+ Token = "iAMT_SUPPORT" "=" "1"
+End
+
+MODULE
+ Help = "Includes MebxSetupBrowser.mak to Project"
+ File = "MebxSetupBrowser.mak"
+End
+
+PATH
+ Name = "MebxSetupBrowser_DIR"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\MebxSetupBrowser.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+
+TOKEN
+ Name = "EFIMebxSetup_FILE_PATH"
+ Value = "$(MebxSetupBrowser_DIR)\MebxSetupBrowser.efi"
+ TokenType = Expression
+ TargetMAK = Yes
+ Help = "Mebx Setup Browser File name and path"
+End
diff --git a/ReferenceCode/ME/FwUpdate/MeFwDowngrade/Dxe/MeFwDowngrade.c b/ReferenceCode/ME/FwUpdate/MeFwDowngrade/Dxe/MeFwDowngrade.c
new file mode 100644
index 0000000..4dfc8b0
--- /dev/null
+++ b/ReferenceCode/ME/FwUpdate/MeFwDowngrade/Dxe/MeFwDowngrade.c
@@ -0,0 +1,261 @@
+/** @file
+ MeFwDowngrade driver
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights
+ reserved This software and associated documentation (if any)
+ is furnished under a license and may only be used or copied in
+ accordance with the terms of the license. Except as permitted
+ by such license, no part of this software or documentation may
+ be reproduced, stored in a retrieval system, or transmitted in
+ any form or by any means without the express written consent
+ of Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "MeLib.h"
+#include "MeAccess.h"
+#include "AmtLib.h"
+#include "HeciRegs.h"
+
+#include EFI_GUID_DEFINITION (MePlatformReadyToBoot)
+#endif
+
+#define ERROR_HANDLING_DELAY 7000000 ///< show warning msg and stay for 7 seconds.
+#define FW_MSG_DELAY 1000 ///< show warning msg and stay for 1 milisecond.
+#define FW_MSG_DELAY_TIMEOUT 10
+
+UINT8 HeciHmrfpoLockResult, HeciHmrfpoEnableResult;
+
+VOID
+EFIAPI
+MeFwDowngradeMsgEvent (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+/**
+ Tell User that we failed to lock/unlock the flash - Do this after we have graphics initialized
+
+ @param[in] Event The event that triggered this notification function
+ @param[in] Context Pointer to the notification functions context
+
+ @retval None
+**/
+{
+ if (HeciHmrfpoLockResult != HMRFPO_LOCK_SUCCESS) {
+ MeReportError (MSG_HMRFPO_LOCK_FAILURE);
+ }
+
+ if (HeciHmrfpoEnableResult != HMRFPO_ENABLE_SUCCESS) {
+ MeReportError (MSG_HMRFPO_UNLOCK_FAILURE);
+ }
+
+ gBS->CloseEvent (Event);
+ return;
+}
+
+VOID
+EFIAPI
+MeHmrfpoDisableEvent (
+ EFI_EVENT Event,
+ VOID *Context
+ )
+/**
+ Send the HMRFPO_DISABLE MEI message.
+
+ @param[in] Event The event that triggered this notification function
+ @param[in] Context Pointer to the notification functions context
+
+ @retval None
+**/
+{
+ UINT32 FWstatus;
+ UINT8 WriteValue;
+ UINT8 StallCount;
+
+ FWstatus = 0;
+ WriteValue = 0;
+ StallCount = 0;
+
+ DEBUG ((EFI_D_ERROR, "(B3) Me FW Downgrade - Send the HMRFPO_DISABLE MEI message\n"));
+
+ WriteValue = HeciPciRead8 (R_GEN_STS + 3);
+ WriteValue = WriteValue & BRNGUP_HMRFPO_DISABLE_CMD_MASK;
+ WriteValue = WriteValue | BRNGUP_HMRFPO_DISABLE_CMD;
+ DEBUG ((EFI_D_ERROR, "Me FW Downgrade Writing %x to register %x of PCI space\n", WriteValue, (R_GEN_STS + 3)));
+ ///
+ /// Set the highest Byte of General Status Register (Bits 28-31)
+ ///
+ HeciPciWrite8 (R_GEN_STS + 3, WriteValue);
+ FWstatus = HeciPciRead32 (R_FWSTATE);
+ while
+ (
+ ((FWstatus & BRNGUP_HMRFPO_DISABLE_OVR_MASK) != BRNGUP_HMRFPO_DISABLE_OVR_RSP) &&
+ (StallCount < FW_MSG_DELAY_TIMEOUT)
+ ) {
+ DEBUG ((EFI_D_ERROR, "Me FW Downgrade - ME HMRFPO Disable Status = 0x%x\n", FWstatus));
+ FWstatus = HeciPciRead32 (R_FWSTATE);
+ gBS->Stall (FW_MSG_DELAY);
+ StallCount = StallCount + 1;
+ }
+
+ if ((FWstatus & BRNGUP_HMRFPO_DISABLE_OVR_MASK) == BRNGUP_HMRFPO_DISABLE_OVR_RSP) {
+ DEBUG ((EFI_D_ERROR, "Me FW Downgrade Disable Msg Received Successfully\n"));
+ } else {
+ DEBUG ((EFI_D_ERROR, "Me FW Downgrade Disable Msg ACK not Received\n"));
+
+ }
+ ///
+ /// Hide ME devices so we don't get a yellow bang in OS with disabled devices
+ ///
+ DisableAllMEDevices ();
+
+ gBS->CloseEvent (Event);
+
+ return;
+}
+
+/**
+ Entry point for the MeFwDowngrade driver
+
+ @param[in] ImageHandle Standard entry point parameter.
+ @param[in] SystemTable Standard entry point parameter.
+
+ @exception EFI_UNSUPPORTED ME policy library initization failure.
+ @retval Status code returned by CreateEventEx.
+**/
+EFI_STATUS
+MeFwDowngradeEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ EFI_EVENT MeFwDowngradeEvent;
+ EFI_HECI_PROTOCOL *Heci;
+ UINT32 MeMode;
+ UINT32 MeStatus;
+ UINT64 Nonce;
+ UINT32 FactoryDefaultBase;
+ UINT32 FactoryDefaultLimit;
+ HECI_FWS_REGISTER MeFirmwareStatus;
+
+ MeFirmwareStatus.ul = HeciPciRead32 (R_FWSTATE);
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ Status = Heci->GetMeMode (&MeMode);
+ ASSERT_EFI_ERROR (Status);
+
+ Status = Heci->GetMeStatus (&MeStatus);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// (B1) Whcih mode ?
+ ///
+ if (MeMode == ME_MODE_NORMAL) {
+ ///
+ /// (A2) Intel Me image re-flash is requested?
+ ///
+ if (MeFwDowngradeSupported ()) {
+ ///
+ /// (A4)(A5) The BIOS sends the HMRFPO ENABLE MEI message and wiat for response.
+ ///
+ HeciHmrfpoEnableResult = HMRFPO_ENABLE_UNKNOWN_FAILURE;
+ Status = HeciHmrfpoEnable (0, &HeciHmrfpoEnableResult);
+ if (Status == EFI_SUCCESS && HeciHmrfpoEnableResult == HMRFPO_ENABLE_SUCCESS) {
+ ///
+ /// (A6) The BIOS sends the GLOBAL RESET MEI message
+ ///
+ DEBUG ((EFI_D_ERROR, "Me FW Downgrade !!- Step A6\n"));
+
+ HeciSendCbmResetRequest (CBM_RR_REQ_ORIGIN_BIOS_POST, CBM_HRR_GLOBAL_RESET);
+ EFI_DEADLOOP ();
+ }
+ ///
+ /// (A8) Error Handling, HeciHmrfpoEnable include error handling.
+ ///
+ DEBUG (
+ (
+ EFI_D_ERROR, "Me FW Downgrade Error !!- Step A8, the Status is %r, The result is %x\n", Status,
+ HeciHmrfpoEnableResult
+ )
+ );
+ IoWrite8 (0x80, 0xA8);
+ } else {
+ ///
+ /// (A7) The BIOS sends the HMRFPO Lock MEI message and continues the normal boot
+ ///
+ HeciHmrfpoLockResult = HMRFPO_LOCK_SUCCESS;
+ ///
+ /// The ME firmware will ignore the HMRFPO LOCK command if ME is in ME manufacturing mode
+ ///
+ if ((MeFirmwareStatus.r.ManufacturingMode == 0) &&
+ (
+ (ME_STATUS_ME_STATE_ONLY (MeStatus) == ME_IN_RECOVERY_MODE) ||
+ (ME_STATUS_ME_STATE_ONLY (MeStatus) == ME_READY)
+ )
+ ) {
+
+ DEBUG (
+ (
+ EFI_D_ERROR,
+ "(A7) Me FW Downgrade - The BIOS sends the HMRFPO Lock MEI message and continues the normal boot\n"
+ )
+ );
+
+ FactoryDefaultBase = 0;
+ FactoryDefaultLimit = 0;
+ Status = HeciHmrfpoLock (&Nonce, &FactoryDefaultBase, &FactoryDefaultLimit, &HeciHmrfpoLockResult);
+ if (Status != EFI_SUCCESS) {
+ HeciHmrfpoLockResult = HMRFPO_LOCK_FAILURE;
+ }
+ }
+ }
+
+ Status = gBS->CreateEventEx (
+ EFI_EVENT_NOTIFY_SIGNAL,
+ EFI_TPL_NOTIFY,
+ MeFwDowngradeMsgEvent,
+ (VOID *) &ImageHandle,
+ &gMePlatformReadyToBootGuid,
+ &MeFwDowngradeEvent
+ );
+
+ }
+ ///
+ /// (B3) Create an event that will call the HMRFPO_DISABLE
+ ///
+ if ((MeFirmwareStatus.r.MeOperationMode == ME_OPERATION_MODE_SECOVR_HECI_MSG) &&
+ (ME_STATUS_ME_STATE_ONLY (MeStatus) == ME_READY)
+ ) {
+ Status = gBS->CreateEventEx (
+ EFI_EVENT_NOTIFY_SIGNAL,
+ EFI_TPL_NOTIFY,
+ MeHmrfpoDisableEvent,
+ (VOID *) &ImageHandle,
+ &gMePlatformReadyToBootGuid,
+ &MeFwDowngradeEvent
+ );
+ }
+
+ return Status;
+}
diff --git a/ReferenceCode/ME/FwUpdate/MeFwDowngrade/Dxe/MeFwDowngrade.cif b/ReferenceCode/ME/FwUpdate/MeFwDowngrade/Dxe/MeFwDowngrade.cif
new file mode 100644
index 0000000..0d62ae2
--- /dev/null
+++ b/ReferenceCode/ME/FwUpdate/MeFwDowngrade/Dxe/MeFwDowngrade.cif
@@ -0,0 +1,12 @@
+<component>
+ name = "MeFwDowngrade"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\FwUpdate\MeFwDowngrade\Dxe\"
+ RefName = "MeFwDowngrade"
+[files]
+"MeFwDowngrade.sdl"
+"MeFwDowngrade.mak"
+"MeFwDowngrade.c"
+"MeFwDowngrade.dxs"
+"MeFwDowngrade.inf"
+<endComponent>
diff --git a/ReferenceCode/ME/FwUpdate/MeFwDowngrade/Dxe/MeFwDowngrade.dxs b/ReferenceCode/ME/FwUpdate/MeFwDowngrade/Dxe/MeFwDowngrade.dxs
new file mode 100644
index 0000000..9352025
--- /dev/null
+++ b/ReferenceCode/ME/FwUpdate/MeFwDowngrade/Dxe/MeFwDowngrade.dxs
@@ -0,0 +1,45 @@
+/** @file
+ Dependency expression source file.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "DxeDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+#include EFI_PROTOCOL_DEFINITION (Heci)
+#include EFI_PROTOCOL_DEFINITION (MePlatformPolicy)
+#include EFI_PROTOCOL_DEFINITION (Spi)
+#endif
+
+DEPENDENCY_START
+ EFI_HECI_PROTOCOL_GUID AND
+ DXE_PLATFORM_ME_POLICY_GUID AND
+ EFI_SPI_PROTOCOL_GUID
+DEPENDENCY_END
+
diff --git a/ReferenceCode/ME/FwUpdate/MeFwDowngrade/Dxe/MeFwDowngrade.inf b/ReferenceCode/ME/FwUpdate/MeFwDowngrade/Dxe/MeFwDowngrade.inf
new file mode 100644
index 0000000..1c86bc5
--- /dev/null
+++ b/ReferenceCode/ME/FwUpdate/MeFwDowngrade/Dxe/MeFwDowngrade.inf
@@ -0,0 +1,85 @@
+## @file
+# Component description file for MeFwDowngrade DXE driver
+#
+#@copyright
+# Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = MeFwDowngrade
+FILE_GUID = 5820EEB4-C135-4854-9D2A-AA9EFC4475E9
+COMPONENT_TYPE = BS_DRIVER
+
+[sources.common]
+ MeFwDowngrade.c
+
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueDxeDriverEntryPoint.c
+
+[includes.common]
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/AMT/Dxe
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/Include
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/Dxe
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Heci/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[libraries.common]
+ MeLib
+ MeChipsetLib
+ AmtLib
+ MeGuidLib
+ EfiScriptLib
+ EdkProtocolLib
+ EdkFrameworkProtocolLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueDxeReportStatusCodeLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueUefiLib
+ EdkIIGlueBasePciLibPciExpress
+ EdkIIGlueBasePciExpressLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT=_ModuleEntryPoint
+ DPX_SOURCE=MeFwDowngrade.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=MeFwDowngradeEntryPoint
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_LIB__
diff --git a/ReferenceCode/ME/FwUpdate/MeFwDowngrade/Dxe/MeFwDowngrade.mak b/ReferenceCode/ME/FwUpdate/MeFwDowngrade/Dxe/MeFwDowngrade.mak
new file mode 100644
index 0000000..e7d8134
--- /dev/null
+++ b/ReferenceCode/ME/FwUpdate/MeFwDowngrade/Dxe/MeFwDowngrade.mak
@@ -0,0 +1,56 @@
+# MAK file for the ModulePart:MeFwDowngrade
+all : MeFwDowngrade
+
+MeFwDowngrade : $(BUILD_DIR)\MeFwDowngrade.mak MeFwDowngradeBin
+
+$(BUILD_DIR)\MeFwDowngrade.mak : $(MeFwDowngrade_DIR)\$(@B).cif $(MeFwDowngrade_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(MeFwDowngrade_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+MeFwDowngrade_INCLUDES= \
+ $(EDK_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(ME_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+
+MeFwDowngrade_LIBS=\
+ $(EDKPROTOCOLLIB)\
+ $(MeLibDxe_LIB)\
+ $(MeChipsetDxeLib_LIB)\
+ $(AmtLibDxe_LIB)\
+ $(MeGuidLib_LIB)\
+ $(INTEL_PCH_PROTOCOL_LIB)\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(EFIGUIDLIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueEdkDxeRuntimeDriverLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueUefiLib_LIB)\
+ $(EFIDRIVERLIB)\
+ $(PchPlatformDxeLib_LIB)
+
+MeFwDowngrade_DEFINES=$(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=MeFwDowngradeEntryPoint"\
+ /D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_UEFI_LIB__\
+
+MeFwDowngradeBin : $(MeFwDowngrade_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\MeFwDowngrade.mak all\
+ "MY_INCLUDES=$(MeFwDowngrade_INCLUDES)"\
+ "MY_DEFINES=$(MeFwDowngrade_DEFINES)"\
+ GUID=5820EEB4-C135-4854-9D2A-AA9EFC4475E9 \
+ ENTRY_POINT=_ModuleEntryPoint \
+ EDKIIModule=DXEDRIVER\
+ TYPE=BS_DRIVER \
+ DEPEX1=$(MeFwDowngrade_DIR)\MeFwDowngrade.dxs \
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \
+ COMPRESS=1\
diff --git a/ReferenceCode/ME/FwUpdate/MeFwDowngrade/Dxe/MeFwDowngrade.sdl b/ReferenceCode/ME/FwUpdate/MeFwDowngrade/Dxe/MeFwDowngrade.sdl
new file mode 100644
index 0000000..80c4125
--- /dev/null
+++ b/ReferenceCode/ME/FwUpdate/MeFwDowngrade/Dxe/MeFwDowngrade.sdl
@@ -0,0 +1,35 @@
+TOKEN
+ Name = "MeFwDowngrade_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable MeFwDowngrade support in Project"
+End
+
+MODULE
+ Help = "Includes MeFwDowngrade.mak to Project"
+ File = "MeFwDowngrade.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\MeFwDowngrade.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+
+PATH
+ Name = "MeFwDowngrade_DIR"
+ Help = "ME Driver files source directory"
+End
+
+TOKEN
+ Name = "Always_MeFwDowngrade"
+ Value = "0"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Help = "MeFwDowngrade Setup item will not switch automatically when this item is TRUE"
+End
diff --git a/ReferenceCode/ME/Guid/AmtForcePushPetPolicy/AmtForcePushPetPolicy.c b/ReferenceCode/ME/Guid/AmtForcePushPetPolicy/AmtForcePushPetPolicy.c
new file mode 100644
index 0000000..ed9ab5e
--- /dev/null
+++ b/ReferenceCode/ME/Guid/AmtForcePushPetPolicy/AmtForcePushPetPolicy.c
@@ -0,0 +1,33 @@
+/** @file
+ AmtForcePushPetPolicy Guid data declarations.
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights
+ reserved This software and associated documentation (if any)
+ is furnished under a license and may only be used or copied in
+ accordance with the terms of the license. Except as permitted
+ by such license, no part of this software or documentation may
+ be reproduced, stored in a retrieval system, or transmitted in
+ any form or by any means without the express written consent
+ of Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include EFI_GUID_DEFINITION (AmtForcePushPetPolicy)
+#endif
+
+EFI_GUID gAmtForcePushPetPolicyGuid = AMT_FORCE_PUSH_PET_POLICY_GUID;
+
+EFI_GUID_STRING(&gAmtForcePushPetPolicyGuid, "AmtForcePushPetPolicy GUID", "AmtForcePushPetPolicy GUID")
diff --git a/ReferenceCode/ME/Guid/AmtForcePushPetPolicy/AmtForcePushPetPolicy.h b/ReferenceCode/ME/Guid/AmtForcePushPetPolicy/AmtForcePushPetPolicy.h
new file mode 100644
index 0000000..872045f
--- /dev/null
+++ b/ReferenceCode/ME/Guid/AmtForcePushPetPolicy/AmtForcePushPetPolicy.h
@@ -0,0 +1,36 @@
+/** @file
+ AmtForcePushPetPolicy Guid definitions
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _EFI_AMT_FORCE_PUSH_PET_POLICY_GUID_H_
+#define _EFI_AMT_FORCE_PUSH_PET_POLICY_GUID_H_
+
+#define AMT_FORCE_PUSH_PET_POLICY_GUID \
+ { \
+ 0xacc8e1e4, 0x9f9f, 0x4e40, 0xa5, 0x7e, 0xf9, 0x9e, 0x52, 0xf3, 0x4c, 0xa5 \
+ }
+
+typedef struct {
+ EFI_HOB_GUID_TYPE EfiHobGuidType;
+ INT32 MessageType[1];
+} AMT_FORCE_PUSH_PET_POLICY_HOB;
+
+extern EFI_GUID gAmtForcePushPetPolicyGuid;
+
+#endif
diff --git a/ReferenceCode/ME/Guid/ConsoleLock/ConsoleLock.c b/ReferenceCode/ME/Guid/ConsoleLock/ConsoleLock.c
new file mode 100644
index 0000000..ad71b6e
--- /dev/null
+++ b/ReferenceCode/ME/Guid/ConsoleLock/ConsoleLock.c
@@ -0,0 +1,35 @@
+/** @file
+ Console Lock Guid data declarations.
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include EFI_GUID_DEFINITION (ConsoleLock)
+#endif
+
+EFI_GUID gEfiConsoleLockGuid = EFI_CONSOLE_LOCK_GUID;
+
+EFI_GUID_STRING(&gEfiConsoleLockGuid, "EFI", "Efi Console Lock GUID")
+
+CHAR16 gEfiConsoleLockName[] = EFI_CONSOLE_LOCK_VARIABLE_NAME;
diff --git a/ReferenceCode/ME/Guid/ConsoleLock/ConsoleLock.h b/ReferenceCode/ME/Guid/ConsoleLock/ConsoleLock.h
new file mode 100644
index 0000000..9e7acf9
--- /dev/null
+++ b/ReferenceCode/ME/Guid/ConsoleLock/ConsoleLock.h
@@ -0,0 +1,39 @@
+/** @file
+ Console Lock Guid definitions
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _EFI_CONSOLE_LOCK_GUID_H_
+#define _EFI_CONSOLE_LOCK_GUID_H_
+
+#define EFI_CONSOLE_LOCK_GUID \
+ { \
+ 0x368cda0d, 0xcf31, 0x4b9b, 0x8c, 0xf6, 0xe7, 0xd1, 0xbf, 0xff, 0x15, 0x7e \
+ }
+
+#define EFI_CONSOLE_LOCK_VARIABLE_NAME (L"ConsoleLock")
+#define EFI_CONSOLE_LOCK_FORMAT_VARIABLE_NAME ("ConsoleLock")
+
+extern CHAR16 gEfiConsoleLockName[];
+
+extern EFI_GUID gEfiConsoleLockGuid;
+
+#define LOCK_CONSOLE 1
+#define NO_LOCK_CONSOLE 0
+
+#endif
diff --git a/ReferenceCode/ME/Guid/MeBiosExtensionSetup/MeBiosExtensionSetup.c b/ReferenceCode/ME/Guid/MeBiosExtensionSetup/MeBiosExtensionSetup.c
new file mode 100644
index 0000000..d3d76c5
--- /dev/null
+++ b/ReferenceCode/ME/Guid/MeBiosExtensionSetup/MeBiosExtensionSetup.c
@@ -0,0 +1,35 @@
+/** @file
+ ME BIOS Extension 16 Setup Options Guid data declarations.
+
+@copyright
+ Copyright (c) 2005 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include EFI_GUID_DEFINITION (MeBiosExtensionSetup)
+#endif
+
+EFI_GUID gEfiMeBiosExtensionSetupGuid = EFI_ME_BIOS_EXTENSION_SETUP_GUID;
+
+EFI_GUID_STRING(&gEfiMeBiosExtensionSetupGuid, "EFI", "Efi Me Bios Extension 16 Setup Options GUID")
+
+CHAR16 gEfiMeBiosExtensionSetupName[] = EFI_ME_BIOS_EXTENSION_SETUP_VARIABLE_NAME;
diff --git a/ReferenceCode/ME/Guid/MeBiosExtensionSetup/MeBiosExtensionSetup.h b/ReferenceCode/ME/Guid/MeBiosExtensionSetup/MeBiosExtensionSetup.h
new file mode 100644
index 0000000..24e5c75
--- /dev/null
+++ b/ReferenceCode/ME/Guid/MeBiosExtensionSetup/MeBiosExtensionSetup.h
@@ -0,0 +1,95 @@
+/** @file
+ Me Bios Extension 16 Setup Options Guid definitions
+
+@copyright
+ Copyright (c) 2005 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _EFI_ME_BIOS_EXTENSION_SETUP_GUID_H_
+#define _EFI_ME_BIOS_EXTENSION_SETUP_GUID_H_
+
+///
+/// A NV-RAM variable for storing Intel MEBX setup option settings is created if this variable is not
+/// present. Those settings are used by BIOS during POST to bypass portions of the code if the
+/// Intel ME features are not available
+///
+#define EFI_ME_BIOS_EXTENSION_SETUP_GUID \
+ { \
+ 0x1bad711c, 0xd451, 0x4241, 0xb1, 0xf3, 0x85, 0x37, 0x81, 0x2e, 0xc, 0x70 \
+ }
+
+#define EFI_ME_BIOS_EXTENSION_SETUP_VARIABLE_NAME (L"MeBiosExtensionSetup")
+#define EFI_ME_BIOS_EXTENSION_SETUP_FORMAT_VARIABLE_NAME ("MeBiosExtensionSetup")
+
+extern CHAR16 gEfiMeBiosExtensionSetupName[];
+
+extern EFI_GUID gEfiMeBiosExtensionSetupGuid;
+
+#pragma pack(1)
+
+///
+/// A NV-RAM variable for storing Intel MEBX setup option settings is created if this variable is not
+/// present. Those settings are used by BIOS during POST to bypass portions of the code if the
+/// Intel ME features are not available. The information is obtained from Intel MEBx BIOS sync data
+/// structure
+///
+typedef struct {
+ ///
+ /// Sync Data Structure Version, a non-zero version indicates the variable is being initialized or valid
+ ///
+ UINT16 InterfaceVersion;
+ UINT16 Reserved;
+ ///
+ /// Bit 0 - UPDATED - this structure has been updated by MEBX
+ ///
+ UINT32 Flags;
+ ///
+ /// Platform Manageability Selection
+ /// 00h - Off
+ /// 01h - On
+ ///
+ UINT8 PlatformMngSel;
+ UINT8 Reserved4;
+ UINT8 AmtSolIder;
+ UINT8 Reserved1[2];
+ ///
+ /// CIRA Feature
+ /// 00h - DISABLED
+ /// 01h - ENABLED
+ ///
+ UINT8 RemoteAssistanceTriggerAvailablilty;
+ ///
+ /// KVM state (0 - DISABLED, 1 - ENABLED)
+ ///
+ UINT8 KvmEnable;
+ ///
+ /// 0 - On every later boot after BIOS 1st boot
+ /// 1 - Mebx will not require a reboot for synchronizing SOL/IDER state, used when BIOS 1st boot only.
+ ///
+ UINT8 MebxDefaultSolIder;
+ UINT8 Reserved2[10];
+} ME_BIOS_EXTENSION_SETUP;
+
+#define MNT_OFF 0x00
+#define MNT_ON 0x01
+#define LAN_ENABLE 0x01
+#define SOL_ENABLE 0x01
+#define IDER_ENABLE 0x02
+#define KVM_ENABLE 0x01
+
+#pragma pack()
+
+#endif
diff --git a/ReferenceCode/ME/Guid/MeDataHob/MeDataHob.c b/ReferenceCode/ME/Guid/MeDataHob/MeDataHob.c
new file mode 100644
index 0000000..bb07932
--- /dev/null
+++ b/ReferenceCode/ME/Guid/MeDataHob/MeDataHob.c
@@ -0,0 +1,27 @@
+/** @file
+ The GUID definition for MeDataHob
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+#include "Tiano.h"
+#include "MeDataHob.h"
+
+EFI_GUID gMeDataHobGuid = ME_DATA_HOB_GUID;
+
+EFI_GUID_STRING(&gMeDataHobGuid, "ME Data HOB", "GUID for ME Data HOB");
diff --git a/ReferenceCode/ME/Guid/MeDataHob/MeDataHob.h b/ReferenceCode/ME/Guid/MeDataHob/MeDataHob.h
new file mode 100644
index 0000000..69c1c5f
--- /dev/null
+++ b/ReferenceCode/ME/Guid/MeDataHob/MeDataHob.h
@@ -0,0 +1,55 @@
+/** @file
+ The GUID definition for MeDataHob
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+#ifndef _ME_DATA_HOB_H_
+#define _ME_DATA_HOB_H_
+
+#define ME_DATA_HOB_GUID \
+ { 0x1e94f097, 0x5acd, 0x4089, 0xb2, 0xe3, 0xb9, 0xa5, 0xc8, 0x79, 0xa7, 0x0c }
+
+extern EFI_GUID gMeDataHobGuid;
+
+#ifndef _PEI_HOB_H_
+#ifndef __HOB__H__
+#ifndef __PI_HOB_H__
+typedef struct _EFI_HOB_GENERIC_HEADER {
+ UINT16 HobType;
+ UINT16 HobLength;
+ UINT32 Reserved;
+} EFI_HOB_GENERIC_HEADER;
+
+typedef struct _EFI_HOB_GUID_TYPE {
+ EFI_HOB_GENERIC_HEADER Header;
+ EFI_GUID Name;
+ //
+ // Guid specific data goes here
+ //
+} EFI_HOB_GUID_TYPE;
+#endif
+#endif
+#endif
+
+typedef struct {
+ EFI_HOB_GUID_TYPE EfiHobGuidType;
+ UINT64 FtpmBufferAddress;
+} ME_DATA_HOB;
+
+#endif
diff --git a/ReferenceCode/ME/Guid/MeGuidLib.cif b/ReferenceCode/ME/Guid/MeGuidLib.cif
new file mode 100644
index 0000000..79c935b
--- /dev/null
+++ b/ReferenceCode/ME/Guid/MeGuidLib.cif
@@ -0,0 +1,22 @@
+<component>
+ name = "MeGuidLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\Guid\"
+ RefName = "MeGuidLib"
+[files]
+"MeGuidLib.sdl"
+"MeGuidLib.mak"
+"MeGuidLib.inf"
+"AmtForcePushPetPolicy\AmtForcePushPetPolicy.h"
+"AmtForcePushPetPolicy\AmtForcePushPetPolicy.c"
+"ConsoleLock\ConsoleLock.h"
+"ConsoleLock\ConsoleLock.c"
+"MeBiosExtensionSetup\MeBiosExtensionSetup.c"
+"MeBiosExtensionSetup\MeBiosExtensionSetup.h"
+"MePlatformReadyToBoot\MePlatformReadyToBoot.c"
+"MePlatformReadyToBoot\MePlatformReadyToBoot.h"
+"MeDataHob\MeDataHob.c"
+"MeDataHob\MeDataHob.h"
+"MeSsdtTableStorage\MeSsdtTableStorage.c"
+"MeSsdtTableStorage\MeSsdtTableStorage.h"
+<endComponent>
diff --git a/ReferenceCode/ME/Guid/MeGuidLib.inf b/ReferenceCode/ME/Guid/MeGuidLib.inf
new file mode 100644
index 0000000..d0809c5
--- /dev/null
+++ b/ReferenceCode/ME/Guid/MeGuidLib.inf
@@ -0,0 +1,55 @@
+## @file
+# Component description file for MeGuidLib
+#
+#@copyright
+# Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = MeGuidLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ AmtForcePushPetPolicy/AmtForcePushPetPolicy.h
+ AmtForcePushPetPolicy/AmtForcePushPetPolicy.c
+ ConsoleLock/ConsoleLock.h
+ ConsoleLock/ConsoleLock.c
+ MeBiosExtensionSetup/MeBiosExtensionSetup.h
+ MeBiosExtensionSetup/MeBiosExtensionSetup.c
+ MePlatformReadyToBoot/MePlatformReadyToBoot.h
+ MePlatformReadyToBoot/MePlatformReadyToBoot.c
+ MeDataHob/MeDataHob.c
+ MeDataHob/MeDataHob.h
+ MeSsdtTableStorage/MeSsdtTableStorage.h
+ MeSsdtTableStorage/MeSsdtTableStorage.c
+[includes.common]
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)
+
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[nmake.common]
+C_STD_INCLUDE=
diff --git a/ReferenceCode/ME/Guid/MeGuidLib.mak b/ReferenceCode/ME/Guid/MeGuidLib.mak
new file mode 100644
index 0000000..3d88d99
--- /dev/null
+++ b/ReferenceCode/ME/Guid/MeGuidLib.mak
@@ -0,0 +1,49 @@
+# /*++
+# Copyright (c) 2009 Intel Corporation. All rights reserved.
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+# --*/
+all : MeGuidLib
+
+$(MeGuidLib_LIB) : MeGuidLib
+
+MeGuidLib : $(BUILD_DIR)\MeGuidLib.mak MeGuidLibBin
+
+$(BUILD_DIR)\MeGuidLib.mak : $(MeGuidLib_DIR)\$(@B).cif $(MeGuidLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(MeGuidLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+
+MeGuidLib_INCLUDES=\
+ $(ME_INCLUDES)\
+ $(EDK_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+
+MeGuidLibBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\MeGuidLib.mak all\
+ "MY_INCLUDES=$(MeGuidLib_INCLUDES)" \
+ TYPE=LIBRARY
+!IF "$(x64_BUILD)"=="1"
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS) BUILD_DIR=$(BUILD_DIR)\IA32\
+ /f $(BUILD_DIR)\MeGuidLib.mak all\
+ "MY_INCLUDES=$(MeGuidLib_INCLUDES)" \
+ TYPE=PEI_LIBRARY
+!ENDIF
+#**********************************************************************
+#**********************************************************************
+#** **
+#** (C)Copyright 1985-2006, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 6145-F Northbelt Pkwy, Norcross, GA 30071 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#**********************************************************************
+#********************************************************************** \ No newline at end of file
diff --git a/ReferenceCode/ME/Guid/MeGuidLib.sdl b/ReferenceCode/ME/Guid/MeGuidLib.sdl
new file mode 100644
index 0000000..cf56f0e
--- /dev/null
+++ b/ReferenceCode/ME/Guid/MeGuidLib.sdl
@@ -0,0 +1,24 @@
+TOKEN
+ Name = "MeGuidLib_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable MeGuidLib support in Project"
+ TokenType = Boolean
+ TargetMAK = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "MeGuidLib_DIR"
+End
+
+MODULE
+ Help = "Includes MeGuidLib.mak to Project"
+ File = "MeGuidLib.mak"
+End
+
+TOKEN
+ Name = "MeGuidLib_LIB"
+ Value = "$$(LIB_BUILD_DIR)\MeGuidLib.lib"
+ TokenType = Expression
+ TargetMAK = Yes
+End
diff --git a/ReferenceCode/ME/Guid/MePlatformReadyToBoot/MePlatformReadyToBoot.c b/ReferenceCode/ME/Guid/MePlatformReadyToBoot/MePlatformReadyToBoot.c
new file mode 100644
index 0000000..574f715
--- /dev/null
+++ b/ReferenceCode/ME/Guid/MePlatformReadyToBoot/MePlatformReadyToBoot.c
@@ -0,0 +1,33 @@
+/** @file
+ EFI PlatformReadyToBoot Guid data declarations.
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include EFI_GUID_DEFINITION (MePlatformReadyToBoot)
+#endif
+
+EFI_GUID gMePlatformReadyToBootGuid = EFI_EVENT_ME_PLATFORM_READY_TO_BOOT;
+
+EFI_GUID_STRING(&gMePlatformReadyToBootGuid, "MePlatformReadyToBoot GUID", "MePlatformReadyToBoot GUID")
diff --git a/ReferenceCode/ME/Guid/MePlatformReadyToBoot/MePlatformReadyToBoot.h b/ReferenceCode/ME/Guid/MePlatformReadyToBoot/MePlatformReadyToBoot.h
new file mode 100644
index 0000000..e1bd9ac
--- /dev/null
+++ b/ReferenceCode/ME/Guid/MePlatformReadyToBoot/MePlatformReadyToBoot.h
@@ -0,0 +1,31 @@
+/** @file
+ MePlatformReadyToBoot Guid definitions
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _EFI_ME_PLATFORM_READY_TO_BOOT_GUID_H_
+#define _EFI_ME_PLATFORM_READY_TO_BOOT_GUID_H_
+
+#define EFI_EVENT_ME_PLATFORM_READY_TO_BOOT \
+ { \
+ 0x3fdf171, 0x1d67, 0x4ace, 0xa9, 0x4, 0x3e, 0x36, 0xd3, 0x38, 0xfa, 0x74 \
+ }
+
+extern EFI_GUID gMePlatformReadyToBootGuid;
+
+#endif
diff --git a/ReferenceCode/ME/Guid/MeSsdtTableStorage/MeSsdtTableStorage.c b/ReferenceCode/ME/Guid/MeSsdtTableStorage/MeSsdtTableStorage.c
new file mode 100644
index 0000000..82816a1
--- /dev/null
+++ b/ReferenceCode/ME/Guid/MeSsdtTableStorage/MeSsdtTableStorage.c
@@ -0,0 +1,27 @@
+/** @file
+ The GUID definition for ME ACPI table storage file name
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "Tiano.h"
+#include "MeSsdtTableStorage.h"
+
+EFI_GUID gMeSsdtAcpiTableStorageGuid = ME_SSDT_ACPI_TABLE_STORAGE_GUID;
+
+EFI_GUID_STRING
+ (&gMeSsdtAcpiTableStorageGuid, "ME SSDT ACPI Table Storage File Name", "ME SSDT ACPI Table Storage file name GUID");
diff --git a/ReferenceCode/ME/Guid/MeSsdtTableStorage/MeSsdtTableStorage.h b/ReferenceCode/ME/Guid/MeSsdtTableStorage/MeSsdtTableStorage.h
new file mode 100644
index 0000000..74b72c9
--- /dev/null
+++ b/ReferenceCode/ME/Guid/MeSsdtTableStorage/MeSsdtTableStorage.h
@@ -0,0 +1,31 @@
+/** @file
+ GUID definition for the ME SSDT ACPI table storage file name
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _ME_SSDT_TABLE_STORAGE_H_
+#define _ME_SSDT_TABLE_STORAGE_H_
+
+#define ME_SSDT_ACPI_TABLE_STORAGE_GUID \
+ { \
+ 0x9A8F82D5, 0x39B1, 0x48DA, 0x92, 0xDC, 0xA2, 0x2D, 0xA8, 0x83, 0x4D, 0xF6 \
+ }
+
+extern EFI_GUID gMeSsdtAcpiTableStorageGuid;
+
+#endif
diff --git a/ReferenceCode/ME/Heci/Dxe/HeciDxe.cif b/ReferenceCode/ME/Heci/Dxe/HeciDxe.cif
new file mode 100644
index 0000000..bd3469d
--- /dev/null
+++ b/ReferenceCode/ME/Heci/Dxe/HeciDxe.cif
@@ -0,0 +1,18 @@
+<component>
+ name = "HeciDxe"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\Heci\Dxe\"
+ RefName = "HeciDxe"
+[files]
+"HeciDxe.sdl"
+"HeciDxe.mak"
+"Hecicore.c"
+"Hecicore.h"
+"Hecidrv.c"
+"Hecidrv.h"
+"Hecidrv.dxs"
+"HeciHpet.c"
+"HeciHpet.h"
+"Hecidrv.inf"
+"MeFvi.c"
+<endComponent>
diff --git a/ReferenceCode/ME/Heci/Dxe/HeciDxe.mak b/ReferenceCode/ME/Heci/Dxe/HeciDxe.mak
new file mode 100644
index 0000000..e343b51
--- /dev/null
+++ b/ReferenceCode/ME/Heci/Dxe/HeciDxe.mak
@@ -0,0 +1,65 @@
+# MAK file for the ModulePart:HeciDxe
+all : HeciDxe
+
+HeciDxe : $(BUILD_DIR)\HeciDxe.mak HeciDxeBin
+
+$(BUILD_DIR)\HeciDxe.mak : $(HeciDxe_DIR)\$(@B).cif $(HeciDxe_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(HeciDxe_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+HeciDxe_INCLUDES= \
+ $(EDK_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(ME_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)
+
+HeciDxe_LIBS=\
+ $(EDKPROTOCOLLIB)\
+ $(MeProtocolLib_LIB)\
+ $(MeLibDxe_LIB)\
+ $(MeChipsetDxeLib_LIB)\
+ $(MeGuidLib_LIB)\
+ $(EFISCRIPTLIB)\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(EFIGUIDLIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueUefiLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(EdkIIGlueDxeServicesTableLib_LIB)\
+ $(EdkIIGlueBasePrintLib_LIB)\
+ $(EFIDRIVERLIB)\
+ $(RcFviDxeLib_LIB)\
+ $(PchPlatformDxeLib_LIB)\
+ $(INTEL_PCH_PROTOCOL_LIB)\
+
+HeciDxe_DEFINES=$(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=InitializeHECI"\
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_UEFI_LIB__\
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+ /D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+# /D iFFS_FLAG \
+
+HeciDxeBin : $(HeciDxe_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\HeciDxe.mak all\
+ "MY_INCLUDES=$(HeciDxe_INCLUDES)"\
+ "MY_DEFINES=$(HeciDxe_DEFINES)"\
+ GUID=55E76644-78A5-4a82-A900-7126A5798892 \
+ ENTRY_POINT=_ModuleEntryPoint \
+ EDKIIModule=DXEDRIVER\
+ TYPE=BS_DRIVER \
+ DEPEX1=$(HeciDxe_DIR)\Hecidrv.dxs \
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \
+ COMPRESS=1\
diff --git a/ReferenceCode/ME/Heci/Dxe/HeciDxe.sdl b/ReferenceCode/ME/Heci/Dxe/HeciDxe.sdl
new file mode 100644
index 0000000..f547413
--- /dev/null
+++ b/ReferenceCode/ME/Heci/Dxe/HeciDxe.sdl
@@ -0,0 +1,24 @@
+TOKEN
+ Name = "HeciDxe_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable HeciDxe support in Project"
+End
+MODULE
+ Help = "Includes HeciDxe.mak to Project"
+ File = "HeciDxe.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\HeciDxe.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+
+PATH
+ Name = "HeciDxe_DIR"
+ Help = "iAMT Hec Driver files source directory"
+End \ No newline at end of file
diff --git a/ReferenceCode/ME/Heci/Dxe/HeciHpet.c b/ReferenceCode/ME/Heci/Dxe/HeciHpet.c
new file mode 100644
index 0000000..318757c
--- /dev/null
+++ b/ReferenceCode/ME/Heci/Dxe/HeciHpet.c
@@ -0,0 +1,168 @@
+/** @file
+ Definitions for HECI driver
+
+@copyright
+ Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "HeciDrv.h"
+#include "HeciHpet.h"
+#include "HeciRegs.h"
+#include "HeciCore.h"
+
+//
+// Extern for shared HECI data and protocols
+//
+extern HECI_INSTANCE *mHeciContext;
+VOLATILE UINT32 mSaveHpetConfigReg;
+
+/**
+ Store the value of High Performance Timer
+
+ @param[in] None
+
+ @retval None
+**/
+VOID
+SaveHpet (
+ VOID
+ )
+{
+ mSaveHpetConfigReg = MmioRead32 (PCH_RCRB_BASE + R_PCH_RCRB_HPTC);
+}
+
+/**
+ Restore the value of High Performance Timer
+
+ @param[in] None
+
+ @retval None
+**/
+VOID
+RestoreHpet (
+ VOID
+ )
+{
+ MmioWrite32 (PCH_RCRB_BASE + R_PCH_RCRB_HPTC, mSaveHpetConfigReg);
+}
+
+/**
+ Used for calculating timeouts
+
+ @param[out] Start Snapshot of the HPET timer
+ @param[out] End Calculated time when timeout period will be done
+ @param[in] Time Timeout period in microseconds
+
+ @retval None
+**/
+VOID
+StartTimer (
+ OUT UINT32 *Start,
+ OUT UINT32 *End,
+ IN UINT32 Time
+ )
+{
+ UINT32 Ticks;
+
+ ///
+ /// Make sure that HPET is enabled and running
+ ///
+ EnableHpet ();
+
+ ///
+ /// Read current timer value into start time from HPET
+ ///
+ *Start = mHeciContext->HpetTimer[HPET_MAIN_COUNTER_LOW];
+
+ ///
+ /// Convert microseconds into 70ns timer ticks
+ ///
+ Ticks = Time * HPET_TICKS_PER_MICRO;
+
+ ///
+ /// Compute end time
+ ///
+ *End = *Start + Ticks;
+
+ return ;
+}
+
+/**
+ Used to determine if a timeout has occured.
+
+ @param[in] Start Snapshot of the HPET timer when the timeout period started.
+ @param[in] End Calculated time when timeout period will be done.
+
+ @retval EFI_TIMEOUT Timeout occured.
+ @retval EFI_SUCCESS Not yet timed out
+**/
+EFI_STATUS
+Timeout (
+ IN UINT32 Start,
+ IN UINT32 End
+ )
+{
+ UINT32 Current;
+
+ ///
+ /// Read HPET and assign the value as the current time.
+ ///
+ Current = mHeciContext->HpetTimer[HPET_MAIN_COUNTER_LOW];
+
+ ///
+ /// Test basic case (no overflow)
+ ///
+ if ((Start < End) && (End <= Current)) {
+ return EFI_TIMEOUT;
+ }
+ ///
+ /// Test basic start/end conditions with overflowed timer
+ ///
+ if ((Start < End) && (Current < Start)) {
+ return EFI_TIMEOUT;
+ }
+ ///
+ /// Test for overflowed start/end condition
+ ///
+ if ((Start > End) && ((Current < Start) && (Current > End))) {
+ return EFI_TIMEOUT;
+ }
+ ///
+ /// Catch corner case of broken arguments
+ ///
+ if (Start == End) {
+ return EFI_TIMEOUT;
+ }
+ ///
+ /// Else, we have not yet timed out
+ ///
+ return EFI_SUCCESS;
+}
+
+/**
+ Delay for at least the request number of microseconds
+
+ @param[in] delayTime Number of microseconds to delay.
+
+ @retval None
+**/
+VOID
+IoDelay (
+ IN UINT32 delayTime
+ )
+{
+ gBS->Stall (delayTime);
+}
diff --git a/ReferenceCode/ME/Heci/Dxe/HeciHpet.h b/ReferenceCode/ME/Heci/Dxe/HeciHpet.h
new file mode 100644
index 0000000..8743b3a
--- /dev/null
+++ b/ReferenceCode/ME/Heci/Dxe/HeciHpet.h
@@ -0,0 +1,115 @@
+/** @file
+ Definitions for HECI driver
+
+@copyright
+ Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _HECI_HPET_H
+#define _HECI_HPET_H
+
+#include "EdkIIGlueDxe.h"
+#include "MeAccess.h"
+#include "HeciRegs.h"
+#include "Pci22.h"
+
+/**
+ Store the value of High Performance Timer
+
+ @param[in] None
+
+ @retval None
+**/
+VOID
+SaveHpet (
+ VOID
+ )
+;
+
+/**
+ Restore the value of High Performance Timer
+
+ @param[in] None
+
+ @retval None
+**/
+
+VOID
+RestoreHpet (
+ VOID
+ )
+;
+
+/**
+ Used for calculating timeouts
+
+ @param[out] Start Snapshot of the HPET timer
+ @param[out] End Calculated time when timeout period will be done
+ @param[in] Time Timeout period in microseconds
+
+ @retval None
+**/
+VOID
+StartTimer (
+ OUT UINT32 *Start,
+ OUT UINT32 *End,
+ IN UINT32 Time
+ )
+;
+
+/**
+ Used to determine if a timeout has occured.
+
+ @param[in] Start Snapshot of the HPET timer when the timeout period started.
+ @param[in] End Calculated time when timeout period will be done.
+
+ @retval EFI_TIMEOUT Timeout occured.
+ @retval EFI_SUCCESS Not yet timed out
+**/
+EFI_STATUS
+Timeout (
+ IN UINT32 Start,
+ IN UINT32 End
+ )
+;
+
+/**
+ Enable Hpet function.
+
+ @param[in] None.
+
+ @retval None
+**/
+VOID
+EnableHpet (
+ VOID
+ )
+;
+
+/**
+ Delay for at least the request number of microseconds
+
+ @param[in] delayTime Number of microseconds to delay.
+
+ @retval None
+**/
+VOID
+IoDelay (
+ IN UINT32 delayTime
+ )
+;
+
+#endif // _HECI_HPET_H
diff --git a/ReferenceCode/ME/Heci/Dxe/Hecicore.c b/ReferenceCode/ME/Heci/Dxe/Hecicore.c
new file mode 100644
index 0000000..176fbed
--- /dev/null
+++ b/ReferenceCode/ME/Heci/Dxe/Hecicore.c
@@ -0,0 +1,1461 @@
+/** @file
+ Heci driver core. For Dxe Phase, determines the HECI device and initializes it.
+
+@copyright
+ Copyright (c) 2007 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "HeciDrv.h"
+#include "HeciHpet.h"
+#include "HeciCore.h"
+#include "HeciRegs.h"
+#include "MeState.h"
+
+//
+// Globals used in Heci driver
+//
+UINT16 HECICtlrBDF;
+static UINT64 HeciMBAR = 0;
+
+//
+// Extern for shared HECI data and protocols
+//
+extern HECI_INSTANCE *mHeciContext;
+
+/**
+ The routing of MmIo Read Dword
+
+ @param[in] a The address of Mmio
+
+ @retval Return the valut of MmIo Read
+**/
+UINT32
+MmIoReadDword (
+ IN UINT64 a
+ )
+{
+ volatile HECI_HOST_CONTROL_REGISTER *HeciRegHCsrPtr;
+
+ HeciRegHCsrPtr = (HECI_HOST_CONTROL_REGISTER *) a;
+ return HeciRegHCsrPtr->ul;
+}
+
+/**
+ The routing of MmIo Write Dword
+
+ @param[in] a The address of Mmio
+ @param[in] b Value revised
+
+ @retval None
+**/
+VOID
+MmIoWriteDword (
+ IN UINT64 a,
+ IN UINT32 b
+ )
+{
+ volatile HECI_HOST_CONTROL_REGISTER *HeciRegHCsrPtr;
+
+ HeciRegHCsrPtr = (HECI_HOST_CONTROL_REGISTER *) a;
+
+ HeciRegHCsrPtr->ul = b;
+}
+
+//
+// Macro definition for function used in Heci driver
+//
+#define MMIOREADDWORD(a) MmIoReadDword (a)
+#define MMIOWRITEDWORD(a, b) MmIoWriteDword (a, b)
+
+#ifdef EFI_DEBUG
+
+/**
+ For serial debugger used, it will show the buffer message line by line to serial console.
+
+ @param[in] Message the address point of buffer message
+ @param[in] Length message length
+
+ @retval None
+**/
+VOID
+ShowBuffer (
+ IN UINT8 *Message,
+ IN UINT32 Length
+ )
+{
+ UINT32 Index;
+ UINT32 Offset;
+ CHAR16 Buffer[51]; // To construct a line needs 51 chars.
+
+ Index = 0;
+ Offset = 0;
+ ZeroMem (Buffer, sizeof (Buffer));
+
+ while (Length-- > 0) {
+ //
+ // Get the corresponding offset value from the index of buffer message.
+ //
+ Offset = ((Index & 0x0F) > 7) ? (((Index & 0x0F) * 3) + 2) : ((Index & 0x0F) * 3);
+
+ //
+ // Print "- " at the half of a line increases the readability of debug message.
+ //
+ if ((Index & 0x0F) == 0x08) {
+ UnicodeSPrint (&Buffer[24], 3 * sizeof (CHAR16), L"- ");
+ }
+
+ //
+ // Collect the data of buffer message.
+ //
+ UnicodeSPrint (&Buffer[Offset], 4 * sizeof (CHAR16), L"%02x ", Message[Index]);
+
+ //
+ // A line contains 16 bytes of buffer message. If a line is complete, it will be shown through DEBUG macro.
+ //
+ if (Offset == 47) {
+ DEBUG ((EFI_D_ERROR, "%02x: %s\n", (Index & 0xF0), Buffer));
+ }
+
+ Index++;
+ }
+
+ //
+ // If a line isn't complete, show the remaining data.
+ //
+ if (Offset != 47) {
+ DEBUG ((EFI_D_ERROR, "%02x: %s\n", (Index & 0xF0), Buffer));
+ }
+ return ;
+}
+
+#endif // End Of EFI_DEBUG
+
+//
+// Heci driver function definitions
+//
+
+/**
+ Determines if the HECI device is present and, if present, initializes it for
+ use by the BIOS.
+
+ @param[in] None.
+
+ @retval EFI_SUCCESS HECI device is present and initialized.
+ @retval EFI_DEVICE_ERROR No HECI controller.
+ @exception EFI_UNSUPPORTED HECI MSG is unsupported because ME MODE is in ME ALT Disabled &
+ SECOVR JMPR
+ @retval EFI_TIMEOUT ME is not ready
+**/
+EFI_STATUS
+InitializeHeciPrivate (
+ VOID
+ )
+{
+ HECI_HOST_CONTROL_REGISTER HeciRegHCsr;
+ VOLATILE HECI_HOST_CONTROL_REGISTER *HeciRegHCsrPtr;
+ EFI_STATUS Status;
+ HECI_FWS_REGISTER MeFirmwareStatus;
+
+ Status = EFI_SUCCESS;
+
+ SaveHpet ();
+ do {
+ ///
+ /// Store HECI vendor and device information away
+ ///
+ mHeciContext->DeviceInfo = HeciPciRead16 (PCI_DEVICE_ID_OFFSET);
+
+ ///
+ /// Check for HECI-1 PCI device availability
+ ///
+ if (mHeciContext->DeviceInfo == 0xFFFF) {
+ Status = EFI_DEVICE_ERROR;
+ break;
+ }
+
+ MeFirmwareStatus.ul = HeciPciRead32 (R_FWSTATE);
+
+ ///
+ /// Check for ME FPT Bad
+ ///
+ if (MeFirmwareStatus.r.FptBad) {
+ Status = EFI_DEVICE_ERROR;
+ break;
+ }
+ ///
+ /// Check for ME error status
+ ///
+ if (MeFirmwareStatus.r.ErrorCode) {
+ Status = EFI_NOT_READY;
+ if (MeFirmwareStatus.r.ErrorCode == ME_ERROR_CODE_UNKNOWN || MeFirmwareStatus.r.ErrorCode == ME_ERROR_CODE_IMAGE_FAILURE) {
+ ///
+ /// ME failed to start so no HECI
+ ///
+ Status = EFI_DEVICE_ERROR;
+ break;
+ }
+ }
+ ///
+ /// HECI MSG is unsupported if ME MODE is in ME ALT Disabled & SECOVR JMPR
+ ///
+ if ((MeFirmwareStatus.r.MeOperationMode == ME_OPERATION_MODE_SECOVR_JMPR) ||
+ (MeFirmwareStatus.r.MeOperationMode == ME_OPERATION_MODE_DEBUG)
+ ) {
+ Status = EFI_UNSUPPORTED;
+ break;
+ }
+ ///
+ /// Store HECI revision ID
+ ///
+ mHeciContext->RevisionInfo = HeciPciRead8 (PCI_REVISION_ID_OFFSET);
+
+ ///
+ /// Check if Base register is 64 bits wide.
+ ///
+ if (HeciPciRead32 (R_HECIMBAR) & 0x4) {
+ mHeciContext->HeciMBAR = (((UINT64) HeciPciRead32 (R_HECIMBAR + 4) << 32) |
+ (UINT64) HeciPciRead32 (R_HECIMBAR)) & 0xFFFFFFF0;
+ } else {
+ mHeciContext->HeciMBAR = (UINT64) HeciPciRead32 (R_HECIMBAR) & 0xFFFFFFF0;
+ }
+ ///
+ /// Get HECI_MBAR and see if it is programmed
+ /// to a useable value
+ ///
+ HeciMBAR = mHeciContext->HeciMBAR;
+
+ ///
+ /// Load temporary address for HECI_MBAR if one is not assigned
+ ///
+ if (mHeciContext->HeciMBAR == 0) {
+ DEBUG ((EFI_D_ERROR, "Heci MMIO Bar not programmed in DXE phase\n"));
+ }
+ ///
+ /// Enable HECI BME and MSE
+ ///
+ HeciPciOr8 (
+ PCI_COMMAND_OFFSET,
+ EFI_PCI_COMMAND_MEMORY_SPACE | EFI_PCI_COMMAND_BUS_MASTER
+ );
+
+ ///
+ /// Set HECI interrupt delivery mode.
+ /// HECI-1 using legacy/MSI interrupt
+ ///
+ HeciPciAnd8 (R_HIDM, 0xFC);
+
+ ///
+ /// Need to do following on ME init:
+ ///
+ /// 1) wait for ME_CSR_HA reg ME_RDY bit set
+ ///
+ if (WaitForMEReady () != EFI_SUCCESS) {
+ Status = EFI_TIMEOUT;
+ break;
+ }
+ ///
+ /// 2) setup H_CSR reg as follows:
+ /// a) Make sure H_RST is clear
+ /// b) Set H_RDY
+ /// c) Set H_IG
+ ///
+ HeciRegHCsrPtr = (VOID *) (UINTN) (mHeciContext->HeciMBAR + H_CSR);
+ HeciRegHCsr.ul = HeciRegHCsrPtr->ul;
+ if (HeciRegHCsrPtr->r.H_RDY == 0) {
+ HeciRegHCsr.r.H_RST = 0;
+ HeciRegHCsr.r.H_RDY = 1;
+ HeciRegHCsr.r.H_IG = 1;
+ HeciRegHCsrPtr->ul = HeciRegHCsr.ul;
+ }
+ } while (Status != EFI_SUCCESS && Status != EFI_NOT_READY);
+
+ RestoreHpet ();
+
+ return Status;
+}
+
+/**
+ Waits for the ME to report that it is ready for communication over the HECI
+ interface.
+
+ @param[in] None.
+
+ @retval EFI_SUCCESS ME is ready
+ @retval EFI_TIMEOUT ME is not ready
+**/
+EFI_STATUS
+WaitForMEReady (
+ VOID
+ )
+{
+ UINT32 TimerStart;
+ UINT32 TimerEnd;
+ HECI_ME_CONTROL_REGISTER HeciRegMeCsrHa;
+
+ ///
+ /// Wait for ME ready
+ ///
+ ///
+ /// Check for ME ready status
+ ///
+ StartTimer (&TimerStart, &TimerEnd, HECI_INIT_TIMEOUT);
+ HeciRegMeCsrHa.ul = MMIOREADDWORD (HeciMBAR + ME_CSR_HA);
+ while (HeciRegMeCsrHa.r.ME_RDY_HRA == 0) {
+ ///
+ /// If 5 second timeout has expired, return fail
+ ///
+ if (Timeout (TimerStart, TimerEnd) != EFI_SUCCESS) {
+ return EFI_TIMEOUT;
+ }
+ ///
+ /// Perform IO delay
+ ///
+ IoDelay (HECI_WAIT_DELAY);
+
+ HeciRegMeCsrHa.ul = MMIOREADDWORD (HeciMBAR + ME_CSR_HA);
+ }
+ ///
+ /// ME ready!!!
+ ///
+ return EFI_SUCCESS;
+}
+
+/**
+ Checks if HECI reset has occured.
+
+ @param[in] None.
+
+ @retval TRUE HECI reset occurred
+ @retval FALSE No HECI reset occurred
+**/
+BOOLEAN
+CheckForHeciReset (
+ VOID
+ )
+{
+ HECI_HOST_CONTROL_REGISTER HeciRegHCsr;
+ HECI_ME_CONTROL_REGISTER HeciRegMeCsrHa;
+
+ ///
+ /// Init Host & ME CSR
+ ///
+ HeciRegHCsr.ul = MMIOREADDWORD (HeciMBAR + H_CSR);
+ HeciRegMeCsrHa.ul = MMIOREADDWORD (HeciMBAR + ME_CSR_HA);
+
+ if ((HeciRegMeCsrHa.r.ME_RDY_HRA == 0) || (HeciRegHCsr.r.H_RDY == 0)) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/**
+ Determines if the HECI device is present and, if present, initializes it for
+ use by the BIOS.
+
+ @param[in] None.
+
+ @retval EFI_SUCCESS HECI device is present and initialized
+ @retval EFI_TIMEOUT ME is not ready
+**/
+EFI_STATUS
+EFIAPI
+HeciInitialize (
+ VOID
+ )
+{
+ HECI_HOST_CONTROL_REGISTER HeciRegHCsr;
+
+ ///
+ /// Make sure that HECI device BAR is correct and device is enabled.
+ ///
+ HeciMBAR = CheckAndFixHeciForAccess ();
+
+ ///
+ /// Need to do following on ME init:
+ ///
+ /// 1) wait for ME_CSR_HA reg ME_RDY bit set
+ ///
+ if (WaitForMEReady () != EFI_SUCCESS) {
+ return EFI_TIMEOUT;
+ }
+ ///
+ /// 2) setup H_CSR reg as follows:
+ /// a) Make sure H_RST is clear
+ /// b) Set H_RDY
+ /// c) Set H_IG
+ ///
+ HeciRegHCsr.ul = MMIOREADDWORD (HeciMBAR + H_CSR);
+ if (HeciRegHCsr.r.H_RDY == 0) {
+ HeciRegHCsr.r.H_RST = 0;
+ HeciRegHCsr.r.H_RDY = 1;
+ HeciRegHCsr.r.H_IG = 1;
+ MMIOWRITEDWORD (HeciMBAR + H_CSR, HeciRegHCsr.ul);
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Heci Re-initializes it for Host
+
+ @param[in] None.
+
+ @retval EFI_TIMEOUT ME is not ready
+ @retval EFI_STATUS Status code returned by ResetHeciInterface
+**/
+EFI_STATUS
+EFIAPI
+HeciReInitialize (
+ VOID
+ )
+{
+ HECI_HOST_CONTROL_REGISTER HeciRegHCsr;
+ EFI_STATUS Status;
+
+ Status = EFI_SUCCESS;
+ ///
+ /// Need to do following on ME init:
+ ///
+ /// 1) wait for HOST_CSR_HA reg H_RDY bit set
+ ///
+ /// if (WaitForHostReady() != EFI_SUCCESS) {
+ ///
+ if (MeResetWait (HECI_INIT_TIMEOUT) != EFI_SUCCESS) {
+ return EFI_TIMEOUT;
+ }
+
+ HeciRegHCsr.ul = MMIOREADDWORD (HeciMBAR + H_CSR);
+ if (HeciRegHCsr.r.H_RDY == 0) {
+ Status = ResetHeciInterface ();
+
+ }
+
+ return Status;
+}
+
+/**
+ Heci Re-initializes it for Me
+
+ @param[in] None.
+
+ @retval EFI_TIMEOUT ME is not ready
+ @retval EFI_SUCCESS Re-initialization done
+**/
+EFI_STATUS
+EFIAPI
+HeciReInitialize2 (
+ VOID
+ )
+{
+ HECI_ME_CONTROL_REGISTER HeciRegMeCsrHa;
+ EFI_STATUS Status;
+ UINT32 TimerStart;
+ UINT32 TimerEnd;
+
+ Status = EFI_SUCCESS;
+ ///
+ /// Need to do following on ME init:
+ ///
+ /// 1) wait for HOST_CSR_HA reg H_RDY bit set
+ ///
+ /// if (WaitForHostReady() != EFI_SUCCESS) {
+ ///
+ StartTimer (&TimerStart, &TimerEnd, HECI_INIT_TIMEOUT);
+ HeciRegMeCsrHa.ul = MMIOREADDWORD (HeciMBAR + ME_CSR_HA);
+ while (HeciRegMeCsrHa.r.ME_RDY_HRA == 1) {
+ ///
+ /// If 5 second timeout has expired, return fail
+ ///
+ if (Timeout (TimerStart, TimerEnd) != EFI_SUCCESS) {
+ return EFI_TIMEOUT;
+ }
+
+ IoDelay (HECI_WAIT_DELAY);
+
+ HeciRegMeCsrHa.ul = MMIOREADDWORD (HeciMBAR + ME_CSR_HA);
+ }
+
+ if (WaitForMEReady () != EFI_SUCCESS) {
+ return EFI_TIMEOUT;
+ }
+
+ return Status;
+}
+
+/**
+ Function to pull one messsage packet off the HECI circular buffer.
+ Corresponds to HECI HPS (part of) section 4.2.4
+
+ @param[in] Blocking Used to determine if the read is BLOCKING or NON_BLOCKING.
+ @param[out] MessageHeader Pointer to a buffer for the message header.
+ @param[in] MessageData Pointer to a buffer to recieve the message in.
+ @param[in][out] Length On input is the size of the callers buffer in bytes. On
+ output this is the size of the packet in bytes.
+
+ @retval EFI_SUCCESS One message packet read.
+ @retval EFI_DEVICE_ERROR The circular buffer is overflowed.
+ @retval EFI_NO_RESPONSE The circular buffer is empty
+ @retval EFI_TIMEOUT Failed to receive a full message
+ @retval EFI_BUFFER_TOO_SMALL Message packet is larger than caller's buffer
+**/
+EFI_STATUS
+HECIPacketRead (
+ IN UINT32 Blocking,
+ OUT HECI_MESSAGE_HEADER *MessageHeader,
+ OUT UINT32 *MessageData,
+ IN OUT UINT32 *Length
+ )
+{
+ BOOLEAN GotMessage;
+ UINT32 TimerStart;
+ UINT32 TimerEnd;
+ UINT32 TimerStart1;
+ UINT32 TimerEnd1;
+ UINT32 i;
+ UINT32 LengthInDwords;
+ HECI_ME_CONTROL_REGISTER HeciRegMeCsrHa;
+ HECI_HOST_CONTROL_REGISTER HeciRegHCsr;
+
+ GotMessage = FALSE;
+ ///
+ /// Initialize memory mapped register pointers
+ ///
+ /// VOLATILE HECI_HOST_CONTROL_REGISTER *HeciRegHCsrPtr = (VOID*)(mHeciContext->HeciMBAR + H_CSR);
+ /// VOLATILE HECI_ME_CONTROL_REGISTER *HeciRegMeCsrHaPtr = (VOID*)(mHeciContext->HeciMBAR + ME_CSR_HA);
+ /// VOLATILE UINT32 *HeciRegMeCbrwPtr = (VOID*)(mHeciContext->HeciMBAR + ME_CB_RW);
+ ///
+ /// clear Interrupt Status bit
+ ///
+ HeciRegHCsr.ul = MMIOREADDWORD (HeciMBAR + H_CSR);
+ HeciRegHCsr.r.H_IS = 1;
+
+ ///
+ /// test for circular buffer overflow
+ ///
+ HeciRegMeCsrHa.ul = MMIOREADDWORD (HeciMBAR + ME_CSR_HA);
+ if (OverflowCB (
+ HeciRegMeCsrHa.r.ME_CBRP_HRA,
+ HeciRegMeCsrHa.r.ME_CBWP_HRA,
+ HeciRegMeCsrHa.r.ME_CBD_HRA
+ ) != EFI_SUCCESS) {
+ ///
+ /// if we get here, the circular buffer is overflowed
+ ///
+ *Length = 0;
+ return EFI_DEVICE_ERROR;
+ }
+ ///
+ /// If NON_BLOCKING, exit if the circular buffer is empty
+ ///
+ HeciRegMeCsrHa.ul = MMIOREADDWORD (HeciMBAR + ME_CSR_HA);;
+ if ((FilledSlots (HeciRegMeCsrHa.r.ME_CBRP_HRA, HeciRegMeCsrHa.r.ME_CBWP_HRA) == 0) && (Blocking == NON_BLOCKING)) {
+ *Length = 0;
+ return EFI_NO_RESPONSE;
+ }
+ ///
+ /// Start timeout counter
+ ///
+ StartTimer (&TimerStart, &TimerEnd, HECI_READ_TIMEOUT);
+
+ ///
+ /// loop until we get a message packet
+ ///
+ while (!GotMessage) {
+ ///
+ /// If 1 second timeout has expired, return fail as we have not yet received a full message.
+ ///
+ if (Timeout (TimerStart, TimerEnd) != EFI_SUCCESS) {
+ *Length = 0;
+ return EFI_TIMEOUT;
+ }
+ ///
+ /// Read one message from HECI buffer and advance read pointer. Make sure
+ /// that we do not pass the write pointer.
+ ///
+ HeciRegMeCsrHa.ul = MMIOREADDWORD (HeciMBAR + ME_CSR_HA);;
+ if (FilledSlots (HeciRegMeCsrHa.r.ME_CBRP_HRA, HeciRegMeCsrHa.r.ME_CBWP_HRA) > 0) {
+ ///
+ /// Eat the HECI Message header
+ ///
+ MessageHeader->Data = MMIOREADDWORD (HeciMBAR + ME_CB_RW);
+
+ ///
+ /// Compute required message length in DWORDS
+ ///
+ LengthInDwords = ((MessageHeader->Fields.Length + 3) / 4);
+
+ ///
+ /// Just return success if Length is 0
+ ///
+ if (MessageHeader->Fields.Length == 0) {
+ ///
+ /// Set Interrupt Generate bit and return
+ ///
+ MMIOREADDWORD (HeciMBAR + H_CSR);
+ HeciRegHCsr.r.H_IG = 1;
+ MMIOWRITEDWORD (HeciMBAR + H_CSR, HeciRegHCsr.ul);
+ *Length = 0;
+ return EFI_SUCCESS;
+ }
+ ///
+ /// Make sure that the message does not overflow the circular buffer.
+ ///
+ HeciRegMeCsrHa.ul = MMIOREADDWORD (HeciMBAR + ME_CSR_HA);
+ if ((MessageHeader->Fields.Length + sizeof (HECI_MESSAGE_HEADER)) > (HeciRegMeCsrHa.r.ME_CBD_HRA * 4)) {
+ *Length = 0;
+ return EFI_DEVICE_ERROR;
+ }
+ ///
+ /// Make sure that the callers buffer can hold the correct number of DWORDS
+ ///
+ if ((MessageHeader->Fields.Length) <= *Length) {
+ ///
+ /// Start timeout counter for inner loop
+ ///
+ StartTimer (&TimerStart1, &TimerEnd1, HECI_READ_TIMEOUT);
+
+ ///
+ /// Wait here until entire message is present in circular buffer
+ ///
+ HeciRegMeCsrHa.ul = MMIOREADDWORD (HeciMBAR + ME_CSR_HA);
+ while (LengthInDwords > FilledSlots (HeciRegMeCsrHa.r.ME_CBRP_HRA, HeciRegMeCsrHa.r.ME_CBWP_HRA)) {
+ ///
+ /// If 1 second timeout has expired, return fail as we have not yet received a full message
+ ///
+ if (Timeout (TimerStart1, TimerEnd1) != EFI_SUCCESS) {
+ *Length = 0;
+ return EFI_TIMEOUT;
+ }
+ ///
+ /// Wait before we read the register again
+ ///
+ IoDelay (HECI_WAIT_DELAY);
+
+ ///
+ /// Read the register again
+ ///
+ HeciRegMeCsrHa.ul = MMIOREADDWORD (HeciMBAR + ME_CSR_HA);
+ }
+ ///
+ /// copy rest of message
+ ///
+ for (i = 0; i < LengthInDwords; i++) {
+ MessageData[i] = MMIOREADDWORD (HeciMBAR + ME_CB_RW);
+ }
+ ///
+ /// Update status and length
+ ///
+ GotMessage = TRUE;
+ *Length = MessageHeader->Fields.Length;
+
+ } else {
+ ///
+ /// Message packet is larger than caller's buffer
+ ///
+ *Length = 0;
+ return EFI_BUFFER_TOO_SMALL;
+ }
+ }
+ ///
+ /// Wait before we try to get a message again
+ ///
+ IoDelay (HECI_WAIT_DELAY);
+ }
+ ///
+ /// Read ME_CSR_HA. If the ME_RDY bit is 0, then an ME reset occurred during the
+ /// transaction and the message should be discarded as bad data may have been retrieved
+ /// from the host's circular buffer
+ ///
+ HeciRegMeCsrHa.ul = MMIOREADDWORD (HeciMBAR + ME_CSR_HA);
+ if (HeciRegMeCsrHa.r.ME_RDY_HRA == 0) {
+ *Length = 0;
+ return EFI_DEVICE_ERROR;
+ }
+ ///
+ /// Set Interrupt Generate bit
+ ///
+ HeciRegHCsr.ul = MMIOREADDWORD (HeciMBAR + H_CSR);
+ HeciRegHCsr.r.H_IG = 1;
+ MMIOWRITEDWORD (HeciMBAR + H_CSR, HeciRegHCsr.ul);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Reads a message from the ME across HECI.
+
+ @param[in] Blocking Used to determine if the read is BLOCKING or NON_BLOCKING.
+ @param[in][out] MessageBody Pointer to a buffer used to receive a message.
+ @param[in][out] Length Pointer to the length of the buffer on input and the length
+ of the message on return. (in bytes)
+
+ @retval EFI_SUCCESS One message packet read.
+ @retval EFI_DEVICE_ERROR Failed to initialize HECI or zero-length message packet read
+ @retval EFI_TIMEOUT HECI is not ready for communication
+ @retval EFI_BUFFER_TOO_SMALL The caller's buffer was not large enough
+**/
+EFI_STATUS
+EFIAPI
+HeciReceive (
+ IN UINT32 Blocking,
+ IN OUT UINT32 *MessageBody,
+ IN OUT UINT32 *Length
+ )
+{
+ HECI_MESSAGE_HEADER PacketHeader;
+ UINT32 CurrentLength;
+ UINT32 MessageComplete;
+ EFI_STATUS ReadError;
+ EFI_STATUS Status;
+ UINT32 PacketBuffer;
+ UINT32 timer_start;
+ UINT32 timer_end;
+ BOOLEAN QuitFlag;
+
+ CurrentLength = 0;
+ MessageComplete = 0;
+ Status = EFI_SUCCESS;
+ QuitFlag = FALSE;
+
+ SaveHpet ();
+
+ do {
+ ///
+ /// Make sure that HECI device BAR is correct and device is enabled.
+ ///
+ HeciMBAR = CheckAndFixHeciForAccess ();
+
+ ///
+ /// Make sure we do not have a HECI reset
+ ///
+ if (CheckForHeciReset ()) {
+ ///
+ /// if HECI reset than try to re-init HECI
+ ///
+ Status = HeciInitialize ();
+
+ if (EFI_ERROR (Status)) {
+ Status = EFI_DEVICE_ERROR;
+ break;
+ }
+ }
+ ///
+ /// Make sure that HECI is ready for communication.
+ ///
+ if (WaitForMEReady () != EFI_SUCCESS) {
+ Status = EFI_TIMEOUT;
+ break;
+ }
+ ///
+ /// Set up timer for BIOS timeout.
+ ///
+ StartTimer (&timer_start, &timer_end, HECI_READ_TIMEOUT);
+ while ((CurrentLength < *Length) && (MessageComplete == 0)) {
+ ///
+ /// If 1 second timeout has expired, return fail as we have not yet received a full message
+ ///
+ if (Timeout (timer_start, timer_end) != EFI_SUCCESS) {
+ Status = EFI_TIMEOUT;
+ QuitFlag = TRUE;
+ break;
+ }
+
+ PacketBuffer = *Length - CurrentLength;
+ ReadError = HECIPacketRead (
+ Blocking,
+ &PacketHeader,
+ (UINT32 *) &MessageBody[CurrentLength / 4],
+ &PacketBuffer
+ );
+
+ ///
+ /// Check for error condition on read
+ ///
+ if (EFI_ERROR (ReadError)) {
+ *Length = 0;
+ Status = ReadError;
+ QuitFlag = TRUE;
+ break;
+ }
+ ///
+ /// Get completion status from the packet header
+ ///
+ MessageComplete = PacketHeader.Fields.MessageComplete;
+
+ ///
+ /// Check for zero length messages
+ ///
+ if (PacketBuffer == 0) {
+ ///
+ /// If we are not in the middle of a message, and we see Message Complete,
+ /// this is a valid zero-length message.
+ ///
+ if ((CurrentLength == 0) && (MessageComplete == 1)) {
+ *Length = 0;
+ Status = EFI_SUCCESS;
+ QuitFlag = TRUE;
+ break;
+ } else {
+ ///
+ /// We should not expect a zero-length message packet except as described above.
+ ///
+ *Length = 0;
+ Status = EFI_DEVICE_ERROR;
+ QuitFlag = TRUE;
+ break;
+ }
+ }
+ ///
+ /// Track the length of what we have read so far
+ ///
+ CurrentLength += PacketBuffer;
+
+ }
+
+ if (QuitFlag == TRUE) {
+ break;
+ }
+ ///
+ /// If we get here the message should be complete, if it is not
+ /// the caller's buffer was not large enough.
+ ///
+ if (MessageComplete == 0) {
+ *Length = 0;
+ Status = EFI_BUFFER_TOO_SMALL;
+ break;
+ }
+
+ *Length = CurrentLength;
+
+ DEBUG ((EFI_D_ERROR, "HECI ReadMsg:\n"));
+#ifdef EFI_DEBUG
+ DEBUG_CODE (
+ ShowBuffer ((UINT8 *) MessageBody, *Length);
+ );
+#endif
+ } while (EFI_ERROR (Status));
+
+ RestoreHpet ();
+
+ return Status;
+}
+
+/**
+ Function sends one messsage (of any length) through the HECI circular buffer.
+
+ @param[in] Message Pointer to the message data to be sent.
+ @param[in] Length Length of the message in bytes.
+ @param[in] HostAddress The address of the host processor.
+ @param[in] MeAddress Address of the ME subsystem the message is being sent to.
+
+ @retval EFI_SUCCESS One message packet sent.
+ @retval EFI_DEVICE_ERROR Failed to initialize HECI
+ @retval EFI_TIMEOUT HECI is not ready for communication
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support send message through HECI
+**/
+EFI_STATUS
+EFIAPI
+HeciSend (
+ IN UINT32 *Message,
+ IN UINT32 Length,
+ IN UINT8 HostAddress,
+ IN UINT8 MeAddress
+ )
+{
+ UINT32 CBLength;
+ UINT32 SendLength;
+ UINT32 CurrentLength;
+ HECI_MESSAGE_HEADER MessageHeader;
+ EFI_STATUS WriteStatus;
+ EFI_STATUS Status;
+ HECI_HOST_CONTROL_REGISTER HeciRegHCsr;
+ UINT32 MeMode;
+
+ CurrentLength = 0;
+ Status = EFI_SUCCESS;
+
+ SaveHpet ();
+
+ HeciGetMeMode (&MeMode);
+ do {
+ if (MeMode == ME_MODE_SECOVER) {
+ Status = EFI_UNSUPPORTED;
+ break;
+ }
+ ///
+ /// Make sure that HECI device BAR is correct and device is enabled.
+ ///
+ HeciMBAR = CheckAndFixHeciForAccess ();
+
+ ///
+ /// Make sure we do not have a HECI reset
+ ///
+ if (CheckForHeciReset ()) {
+ ///
+ /// if HECI reset than try to re-init HECI
+ ///
+ Status = HeciInitialize ();
+
+ if (EFI_ERROR (Status)) {
+ Status = EFI_DEVICE_ERROR;
+ break;
+ }
+ }
+
+ DEBUG ((EFI_D_ERROR, "HECI SendMsg:\n"));
+#ifdef EFI_DEBUG
+ DEBUG_CODE (
+ ShowBuffer ((UINT8 *) Message, Length);
+ );
+#endif
+ ///
+ /// Make sure that HECI is ready for communication.
+ ///
+ if (WaitForMEReady () != EFI_SUCCESS) {
+ Status = EFI_TIMEOUT;
+ break;
+ }
+ ///
+ /// Set up memory mapped registers
+ ///
+ HeciRegHCsr.ul = MMIOREADDWORD (HeciMBAR + H_CSR);
+
+ ///
+ /// Grab Circular Buffer length
+ ///
+ CBLength = HeciRegHCsr.r.H_CBD;
+
+ ///
+ /// Prepare message header
+ ///
+ MessageHeader.Data = 0;
+ MessageHeader.Fields.MeAddress = MeAddress;
+ MessageHeader.Fields.HostAddress = HostAddress;
+
+ ///
+ /// Break message up into CB-sized packets and loop until completely sent
+ ///
+ while (Length > CurrentLength) {
+ ///
+ /// Set the Message Complete bit if this is our last packet in the message.
+ /// Needs to be 'less than' to account for the header OR Needs to be exactly equal to CB depth.
+ ///
+ if (((((Length - CurrentLength) + 3) / 4) < CBLength) ||
+ ((((((Length - CurrentLength) + 3) / 4) == CBLength) && ((((Length - CurrentLength) + 3) % 4) == 0)))
+ ) {
+ MessageHeader.Fields.MessageComplete = 1;
+ }
+ ///
+ /// Calculate length for Message Header
+ /// header length == smaller of circular buffer or remaining message (both account for the size of the header)
+ ///
+ SendLength = ((CBLength <= (((Length - CurrentLength) + 3) / 4)) ? ((CBLength - 1) * 4) : (Length - CurrentLength));
+ MessageHeader.Fields.Length = SendLength;
+
+ DEBUG ((EFI_D_ERROR, "HECI Header: %08x\n", MessageHeader.Data));
+
+ ///
+ /// send the current packet (CurrentLength can be treated as the index into the message buffer)
+ ///
+ WriteStatus = HeciPacketWrite (&MessageHeader, (UINT32 *) ((UINTN) Message + CurrentLength));
+ if (EFI_ERROR (WriteStatus)) {
+ Status = WriteStatus;
+ break;
+ }
+ ///
+ /// Update the length information
+ ///
+ CurrentLength += SendLength;
+ }
+
+ if (EFI_ERROR (Status)) {
+ break;
+ }
+ } while (EFI_ERROR (Status));
+
+ RestoreHpet ();
+
+ return Status;
+
+}
+
+/**
+ Function sends one messsage packet through the HECI circular buffer
+ Corresponds to HECI HPS (part of) section 4.2.3
+
+ @param[in] MessageHeader Pointer to the message header.
+ @param[in] MessageData Pointer to the actual message data.
+
+ @retval EFI_SUCCESS One message packet sent
+ @retval EFI_DEVICE_ERROR ME is not ready
+ @retval EFI_TIMEOUT HECI is not ready for communication
+**/
+EFI_STATUS
+HeciPacketWrite (
+ IN HECI_MESSAGE_HEADER *MessageHeader,
+ IN UINT32 *MessageData
+ )
+{
+ UINT32 timer_start;
+ UINT32 timer_end;
+ UINT32 i;
+ UINT32 LengthInDwords;
+ HECI_HOST_CONTROL_REGISTER HeciRegHCsr;
+ HECI_ME_CONTROL_REGISTER HeciRegMeCsrHa;
+
+ ///
+ /// Make sure that HECI is ready for communication.
+ ///
+ if (WaitForMEReady () != EFI_SUCCESS) {
+ return EFI_TIMEOUT;
+ }
+ ///
+ /// Start timeout counter
+ ///
+ StartTimer (&timer_start, &timer_end, HECI_SEND_TIMEOUT);
+
+ ///
+ /// Compute message length in DWORDS
+ ///
+ LengthInDwords = ((MessageHeader->Fields.Length + 3) / 4);
+
+ ///
+ /// Wait until there is sufficient room in the circular buffer
+ /// Must have room for message and message header
+ ///
+ HeciRegHCsr.ul = MMIOREADDWORD (HeciMBAR + H_CSR);
+ while ((LengthInDwords + 1) > (HeciRegHCsr.r.H_CBD - FilledSlots (HeciRegHCsr.r.H_CBRP, HeciRegHCsr.r.H_CBWP))) {
+ ///
+ /// If 1 second timeout has expired, return fail as the circular buffer never emptied
+ ///
+ if (Timeout (timer_start, timer_end) != EFI_SUCCESS) {
+ return EFI_TIMEOUT;
+ }
+ ///
+ /// Wait before we read the register again
+ ///
+ IoDelay (HECI_WAIT_DELAY);
+
+ ///
+ /// Read Host CSR for next iteration
+ ///
+ HeciRegHCsr.ul = MMIOREADDWORD (HeciMBAR + H_CSR);
+ }
+ ///
+ /// Write Message Header
+ ///
+ MMIOWRITEDWORD (HeciMBAR + H_CB_WW, MessageHeader->Data);
+
+ ///
+ /// Write Message Body
+ ///
+ for (i = 0; i < LengthInDwords; i++) {
+ MMIOWRITEDWORD (HeciMBAR + H_CB_WW, MessageData[i]);
+ }
+ ///
+ /// Set Interrupt Generate bit
+ ///
+ HeciRegHCsr.ul = MMIOREADDWORD (HeciMBAR + H_CSR);
+ HeciRegHCsr.r.H_IG = 1;
+ MMIOWRITEDWORD (HeciMBAR + H_CSR, HeciRegHCsr.ul);
+
+ ///
+ /// Test if ME Ready bit is set to 1, if set to 0 a fatal error occured during
+ /// the transmission of this message.
+ ///
+ HeciRegMeCsrHa.ul = MMIOREADDWORD (HeciMBAR + ME_CSR_HA);
+ if (HeciRegMeCsrHa.r.ME_RDY_HRA == 0) {
+ return EFI_DEVICE_ERROR;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Function sends one messsage through the HECI circular buffer and waits
+ for the corresponding ACK message.
+
+ @param[in][out] Message Pointer to the message buffer.
+ @param[in] Length Length of the message in bytes.
+ @param[in][out] RecLength Length of the message response in bytes.
+ @param[in] HostAddress Address of the sending entity.
+ @param[in] MeAddress Address of the ME entity that should receive the message.
+
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the bufferbefore timeout
+ @retval EFI_BUFFER_TOO_SMALL Message Buffer is too small for the Acknowledge
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support send message through HECI
+**/
+EFI_STATUS
+EFIAPI
+HeciSendwACK (
+ IN OUT UINT32 *Message,
+ IN UINT32 Length,
+ IN OUT UINT32 *RecLength,
+ IN UINT8 HostAddress,
+ IN UINT8 MeAddress
+ )
+{
+ EFI_STATUS Status;
+ UINT16 RetryCount;
+ UINT32 TempRecLength;
+ UINT32 MeMode;
+
+ HeciGetMeMode (&MeMode);
+ if (MeMode == ME_MODE_SECOVER) {
+ return EFI_UNSUPPORTED;
+ }
+ ///
+ /// Send the message
+ ///
+ Status = HeciSend (Message, Length, HostAddress, MeAddress);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ ///
+ /// Wait for ACK message
+ ///
+ TempRecLength = *RecLength;
+ for (RetryCount = 0; RetryCount < HECI_MAX_RETRY; RetryCount++) {
+ ///
+ /// Read Message
+ ///
+ Status = HeciReceive (BLOCKING, Message, &TempRecLength);
+ if (!EFI_ERROR (Status)) {
+ break;
+ }
+ ///
+ /// Reload receive length as it has been modified by the read function
+ ///
+ TempRecLength = *RecLength;
+ }
+ ///
+ /// Return read length and status
+ ///
+ *RecLength = TempRecLength;
+ return Status;
+}
+
+/**
+ Me reset and waiting for ready
+
+ @param[in] Delay The biggest waiting time
+
+ @retval EFI_TIMEOUT ME is not ready
+ @retval EFI_SUCCESS Me is ready
+**/
+EFI_STATUS
+EFIAPI
+MeResetWait (
+ IN UINT32 Delay
+ )
+{
+ HECI_HOST_CONTROL_REGISTER HeciRegHCsr;
+ UINT32 TimerStart;
+ UINT32 TimerEnd;
+
+ ///
+ /// Make sure that HECI device BAR is correct and device is enabled.
+ ///
+ HeciMBAR = CheckAndFixHeciForAccess ();
+
+ ///
+ /// Wait for the HOST Ready bit to be cleared to signal a reset
+ ///
+ StartTimer (&TimerStart, &TimerEnd, Delay);
+ HeciRegHCsr.ul = MMIOREADDWORD (HeciMBAR + H_CSR);
+ while (HeciRegHCsr.r.H_RDY == 1) {
+ ///
+ /// If timeout has expired, return fail
+ ///
+ if (Timeout (TimerStart, TimerEnd) != EFI_SUCCESS) {
+ return EFI_TIMEOUT;
+ }
+
+ HeciRegHCsr.ul = MMIOREADDWORD (HeciMBAR + H_CSR);
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Function forces a reinit of the heci interface by following the reset heci interface via host algorithm
+ in HPS 0.90 doc 4-17-06 njy
+
+ @param[in] none
+
+ @retval EFI_TIMEOUT ME is not ready
+ @retval EFI_SUCCESS Interface reset
+**/
+EFI_STATUS
+EFIAPI
+ResetHeciInterface (
+ VOID
+ )
+{
+ HECI_HOST_CONTROL_REGISTER HeciRegHCsr;
+ HECI_ME_CONTROL_REGISTER HeciRegMeCsrHa;
+ UINT32 TimerStart;
+ UINT32 TimerEnd;
+
+ ///
+ /// Make sure that HECI device BAR is correct and device is enabled.
+ ///
+ HeciMBAR = CheckAndFixHeciForAccess ();
+
+ ///
+ /// Enable Reset
+ ///
+ HeciRegHCsr.ul = MMIOREADDWORD (HeciMBAR + H_CSR);
+ HeciRegHCsr.r.H_RST = 1;
+ HeciRegHCsr.r.H_IG = 1;
+ MMIOWRITEDWORD (HeciMBAR + H_CSR, HeciRegHCsr.ul);
+
+ ///
+ /// Make sure that the reset started
+ ///
+ /// HeciRegHCsr.ul = MMIOREADDWORD(HeciMBAR + H_CSR);
+ ///
+ StartTimer (&TimerStart, &TimerEnd, HECI_INIT_TIMEOUT);
+ do {
+ ///
+ /// If 5 second timeout has expired, return fail
+ ///
+ if (Timeout (TimerStart, TimerEnd) != EFI_SUCCESS) {
+ return EFI_TIMEOUT;
+ }
+ ///
+ /// Read the ME CSR
+ ///
+ HeciRegHCsr.ul = MMIOREADDWORD (HeciMBAR + H_CSR);
+ } while (HeciRegHCsr.r.H_RDY == 1);
+
+ ///
+ /// Wait for ME to perform reset
+ ///
+ /// HeciRegMeCsrHa.ul = MMIOREADDWORD(HeciMBAR + ME_CSR_HA);
+ ///
+ StartTimer (&TimerStart, &TimerEnd, HECI_INIT_TIMEOUT);
+ do {
+ ///
+ /// If 5 second timeout has expired, return fail
+ ///
+ if (Timeout (TimerStart, TimerEnd) != EFI_SUCCESS) {
+ return EFI_TIMEOUT;
+ }
+ ///
+ /// Read the ME CSR
+ ///
+ HeciRegMeCsrHa.ul = MMIOREADDWORD (HeciMBAR + ME_CSR_HA);
+ } while (HeciRegMeCsrHa.r.ME_RDY_HRA == 0);
+
+ ///
+ /// Make sure IS has been signaled on the HOST side
+ ///
+ /// HeciRegHCsr.ul = MMIOREADDWORD(HeciMBAR + H_CSR);
+ ///
+ StartTimer (&TimerStart, &TimerEnd, HECI_INIT_TIMEOUT);
+ do {
+ ///
+ /// If 5 second timeout has expired, return fail
+ ///
+ if (Timeout (TimerStart, TimerEnd) != EFI_SUCCESS) {
+ return EFI_TIMEOUT;
+ }
+ ///
+ /// Read the ME CSR
+ ///
+ HeciRegHCsr.ul = MMIOREADDWORD (HeciMBAR + H_CSR);
+ } while (HeciRegHCsr.r.H_IS == 0);
+
+ ///
+ /// Enable host side interface
+ ///
+ HeciRegHCsr.ul = MMIOREADDWORD (HeciMBAR + H_CSR);;
+ HeciRegHCsr.r.H_RST = 0;
+ HeciRegHCsr.r.H_IG = 1;
+ HeciRegHCsr.r.H_RDY = 1;
+ MMIOWRITEDWORD (HeciMBAR + H_CSR, HeciRegHCsr.ul);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Calculate if the circular buffer has overflowed.
+ Corresponds to HECI HPS (part of) section 4.2.1
+
+ @param[in] ReadPointer Location of the read pointer.
+ @param[in] WritePointer Location of the write pointer.
+
+ @retval Number of filled slots.
+**/
+UINT8
+FilledSlots (
+ IN UINT32 ReadPointer,
+ IN UINT32 WritePointer
+ )
+{
+ UINT8 FilledSlots;
+
+ ///
+ /// Calculation documented in HECI HPS 0.68 section 4.2.1
+ ///
+ FilledSlots = (((INT8) WritePointer) - ((INT8) ReadPointer));
+
+ return FilledSlots;
+}
+
+/**
+ Calculate if the circular buffer has overflowed
+ Corresponds to HECI HPS (part of) section 4.2.1
+
+ @param[in] ReadPointer Value read from host/me read pointer
+ @param[in] WritePointer Value read from host/me write pointer
+ @param[in] BufferDepth Value read from buffer depth register
+
+ @retval EFI_DEVICE_ERROR The circular buffer has overflowed
+ @retval EFI_SUCCESS The circular buffer does not overflowed
+**/
+EFI_STATUS
+OverflowCB (
+ IN UINT32 ReadPointer,
+ IN UINT32 WritePointer,
+ IN UINT32 BufferDepth
+ )
+{
+ UINT8 FilledSlots;
+
+ ///
+ /// Calculation documented in HECI HPS 0.68 section 4.2.1
+ ///
+ FilledSlots = (((INT8) WritePointer) - ((INT8) ReadPointer));
+
+ ///
+ /// test for overflow
+ ///
+ if (FilledSlots > ((UINT8) BufferDepth)) {
+ return EFI_DEVICE_ERROR;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Get an abstract Intel ME State from Firmware Status Register.
+ This is used to control BIOS flow for different Intel ME
+ functions
+
+ @param[out] MeStatus Pointer for status report
+ see MeState.h - Abstract ME status definitions.
+
+ @retval EFI_SUCCESS MeStatus copied
+ @retval EFI_INVALID_PARAMETER Pointer of MeStatus is invalid
+**/
+EFI_STATUS
+EFIAPI
+HeciGetMeStatus (
+ OUT UINT32 *MeStatus
+ )
+{
+ HECI_FWS_REGISTER MeFirmwareStatus;
+
+ if (MeStatus == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ MeFirmwareStatus.ul = HeciPciRead32 (R_FWSTATE);
+
+ if (MeFirmwareStatus.r.CurrentState == ME_STATE_NORMAL && MeFirmwareStatus.r.ErrorCode == ME_ERROR_CODE_NO_ERROR) {
+ *MeStatus = ME_READY;
+ } else if (MeFirmwareStatus.r.CurrentState == ME_STATE_RECOVERY) {
+ *MeStatus = ME_IN_RECOVERY_MODE;
+ } else if (MeFirmwareStatus.r.CurrentState == ME_STATE_INIT) {
+ *MeStatus = ME_INITIALIZING;
+ } else if (MeFirmwareStatus.r.CurrentState == ME_STATE_DISABLE_WAIT) {
+ *MeStatus = ME_DISABLE_WAIT;
+ } else if (MeFirmwareStatus.r.CurrentState == ME_STATE_TRANSITION) {
+ *MeStatus = ME_TRANSITION;
+ } else {
+ *MeStatus = ME_NOT_READY;
+ }
+
+ if (MeFirmwareStatus.r.FwUpdateInprogress) {
+ *MeStatus |= ME_FW_UPDATES_IN_PROGRESS;
+ }
+
+ if (MeFirmwareStatus.r.FwInitComplete == ME_FIRMWARE_COMPLETED) {
+ *MeStatus |= ME_FW_INIT_COMPLETE;
+ }
+
+ if (MeFirmwareStatus.r.MeBootOptionsPresent == ME_BOOT_OPTIONS_PRESENT) {
+ *MeStatus |= ME_FW_BOOT_OPTIONS_PRESENT;
+ }
+
+ DEBUG ((EFI_D_ERROR, "HECI MeStatus %X\n", MeFirmwareStatus.ul));
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Return ME Mode
+
+ @param[out] MeMode Pointer for ME Mode report
+
+ @retval EFI_SUCCESS MeMode copied
+ @retval EFI_INVALID_PARAMETER Pointer of MeMode is invalid
+**/
+EFI_STATUS
+EFIAPI
+HeciGetMeMode (
+ OUT UINT32 *MeMode
+ )
+{
+ HECI_FWS_REGISTER MeFirmwareStatus;
+
+ if (MeMode == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ MeFirmwareStatus.ul = HeciPciRead32 (R_FWSTATE);
+
+ switch (MeFirmwareStatus.r.MeOperationMode) {
+ case ME_OPERATION_MODE_NORMAL:
+ *MeMode = ME_MODE_NORMAL;
+ break;
+
+ case ME_OPERATION_MODE_DEBUG:
+ *MeMode = ME_MODE_DEBUG;
+ break;
+
+ case ME_OPERATION_MODE_SOFT_TEMP_DISABLE:
+ *MeMode = ME_MODE_TEMP_DISABLED;
+ break;
+
+ case ME_OPERATION_MODE_SECOVR_JMPR:
+ case ME_OPERATION_MODE_SECOVR_HECI_MSG:
+ *MeMode = ME_MODE_SECOVER;
+ break;
+
+ default:
+ *MeMode = ME_MODE_FAILED;
+ }
+ DEBUG ((EFI_D_ERROR, "HECI MeMode %X\n", MeFirmwareStatus.r.MeOperationMode));
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/ME/Heci/Dxe/Hecicore.h b/ReferenceCode/ME/Heci/Dxe/Hecicore.h
new file mode 100644
index 0000000..4e60526
--- /dev/null
+++ b/ReferenceCode/ME/Heci/Dxe/Hecicore.h
@@ -0,0 +1,342 @@
+/** @file
+ Definitions for HECI driver
+
+@copyright
+ Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#ifndef _HECI_CORE_H
+#define _HECI_CORE_H
+
+#include "CoreBiosMsg.h"
+
+//
+// HECI bus function version
+//
+#define HBM_MINOR_VERSION 0
+#define HBM_MAJOR_VERSION 1
+
+//
+// Prototypes
+//
+
+/**
+ Determines if the HECI device is present and, if present, initializes it for
+ use by the BIOS.
+
+ @param[in] None.
+
+ @retval EFI_SUCCESS HECI device is present and initialized.
+ @retval EFI_DEVICE_ERROR No HECI controller.
+ @exception EFI_UNSUPPORTED HECI MSG is unsupported because ME MODE is in ME ALT Disabled &
+ SECOVR JMPR
+ @retval EFI_TIMEOUT ME is not ready
+**/
+EFI_STATUS
+InitializeHeciPrivate (
+ VOID
+ )
+;
+/**
+ Waits for the ME to report that it is ready for communication over the HECI
+ interface.
+
+ @param[in] None.
+
+ @retval EFI_SUCCESS ME is ready
+ @retval EFI_TIMEOUT ME is not ready
+**/
+EFI_STATUS
+WaitForMEReady (
+ VOID
+ )
+;
+
+/**
+ Determines if the HECI device is present and, if present, initializes it for
+ use by the BIOS.
+
+ @param[in] None.
+
+ @retval EFI_SUCCESS HECI device is present and initialized
+ @retval EFI_TIMEOUT ME is not ready
+**/
+EFI_STATUS
+EFIAPI
+HeciInitialize (
+ VOID
+ )
+;
+
+/**
+ Heci Re-initializes it for Host
+
+ @param[in] None.
+
+ @retval EFI_TIMEOUT ME is not ready
+ @retval EFI_STATUS Status code returned by ResetHeciInterface
+**/
+EFI_STATUS
+EFIAPI
+HeciReInitialize (
+ VOID
+ )
+;
+
+/**
+ Heci Re-initializes it for Me
+
+ @param[in] None.
+
+ @retval EFI_TIMEOUT ME is not ready
+ @retval EFI_SUCCESS Re-initialization done
+**/
+EFI_STATUS
+EFIAPI
+HeciReInitialize2 (
+ VOID
+ )
+;
+
+/**
+ Function to pull one messsage packet off the HECI circular buffer.
+ Corresponds to HECI HPS (part of) section 4.2.4
+
+ @param[in] Blocking Used to determine if the read is BLOCKING or NON_BLOCKING.
+ @param[out] MessageHeader Pointer to a buffer for the message header.
+ @param[in] MessageData Pointer to a buffer to recieve the message in.
+ @param[in][out] Length On input is the size of the callers buffer in bytes. On
+ output this is the size of the packet in bytes.
+
+ @retval EFI_SUCCESS One message packet read.
+ @retval EFI_DEVICE_ERROR The circular buffer is overflowed.
+ @retval EFI_NO_RESPONSE The circular buffer is empty
+ @retval EFI_TIMEOUT Failed to receive a full message
+ @retval EFI_BUFFER_TOO_SMALL Message packet is larger than caller's buffer
+**/
+EFI_STATUS
+HECIPacketRead (
+ IN UINT32 Blocking,
+ OUT HECI_MESSAGE_HEADER *MessageHeader,
+ OUT UINT32 *MessageData,
+ IN OUT UINT32 *Length
+ )
+;
+
+/**
+ Reads a message from the ME across HECI.
+
+ @param[in] Blocking Used to determine if the read is BLOCKING or NON_BLOCKING.
+ @param[in][out] MessageBody Pointer to a buffer used to receive a message.
+ @param[in][out] Length Pointer to the length of the buffer on input and the length
+ of the message on return. (in bytes)
+
+ @retval EFI_SUCCESS One message packet read.
+ @retval EFI_DEVICE_ERROR Failed to initialize HECI or zero-length message packet read
+ @retval EFI_TIMEOUT HECI is not ready for communication
+ @retval EFI_BUFFER_TOO_SMALL The caller's buffer was not large enough
+**/
+EFI_STATUS
+EFIAPI
+HeciReceive (
+ IN UINT32 Blocking,
+ IN OUT UINT32 *MessageBody,
+ IN OUT UINT32 *Length
+ )
+;
+
+/**
+ Function sends one messsage (of any length) through the HECI circular buffer.
+
+ @param[in] Message Pointer to the message data to be sent.
+ @param[in] Length Length of the message in bytes.
+ @param[in] HostAddress The address of the host processor.
+ @param[in] MeAddress Address of the ME subsystem the message is being sent to.
+
+ @retval EFI_SUCCESS One message packet sent.
+ @retval EFI_DEVICE_ERROR Failed to initialize HECI
+ @retval EFI_TIMEOUT HECI is not ready for communication
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support send message through HECI
+**/
+EFI_STATUS
+EFIAPI
+HeciSend (
+ IN UINT32 *Message,
+ IN UINT32 Length,
+ IN UINT8 HostAddress,
+ IN UINT8 MeAddress
+ )
+;
+/**
+ Function sends one messsage packet through the HECI circular buffer
+ Corresponds to HECI HPS (part of) section 4.2.3
+
+ @param[in] MessageHeader Pointer to the message header.
+ @param[in] MessageData Pointer to the actual message data.
+
+ @retval EFI_SUCCESS One message packet sent
+ @retval EFI_DEVICE_ERROR ME is not ready
+ @retval EFI_TIMEOUT HECI is not ready for communication
+**/
+EFI_STATUS
+HeciPacketWrite (
+ IN HECI_MESSAGE_HEADER *MessageHeader,
+ IN UINT32 *MessageData
+ )
+;
+
+/**
+ Function sends one messsage through the HECI circular buffer and waits
+ for the corresponding ACK message.
+
+ @param[in][out] Message Pointer to the message buffer.
+ @param[in] Length Length of the message in bytes.
+ @param[in][out] RecLength Length of the message response in bytes.
+ @param[in] HostAddress Address of the sending entity.
+ @param[in] MeAddress Address of the ME entity that should receive the message.
+
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the bufferbefore timeout
+ @retval EFI_BUFFER_TOO_SMALL Message Buffer is too small for the Acknowledge
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support send message through HECI
+**/
+EFI_STATUS
+EFIAPI
+HeciSendwACK (
+ IN OUT UINT32 *Message,
+ IN UINT32 Length,
+ IN OUT UINT32 *RecLength,
+ IN UINT8 HostAddress,
+ IN UINT8 MeAddress
+ )
+;
+
+/**
+ Me reset and waiting for ready
+
+ @param[in] Delay The biggest waiting time
+
+ @retval EFI_TIMEOUT ME is not ready
+ @retval EFI_SUCCESS Me is ready
+**/
+EFI_STATUS
+EFIAPI
+MeResetWait (
+ IN UINT32 Delay
+ )
+;
+
+/**
+ Function forces a reinit of the heci interface by following the reset heci interface via host algorithm
+ in HPS 0.90 doc 4-17-06 njy
+
+ @param[in] none
+
+ @retval EFI_TIMEOUT ME is not ready
+ @retval EFI_SUCCESS Interface reset
+**/
+EFI_STATUS
+EFIAPI
+ResetHeciInterface (
+ VOID
+ )
+;
+
+/**
+ Calculate if the circular buffer has overflowed.
+ Corresponds to HECI HPS (part of) section 4.2.1
+
+ @param[in] ReadPointer Location of the read pointer.
+ @param[in] WritePointer Location of the write pointer.
+
+ @retval Number of filled slots.
+**/
+UINT8
+FilledSlots (
+ IN UINT32 ReadPointer,
+ IN UINT32 WritePointer
+ )
+;
+
+/**
+ Calculate if the circular buffer has overflowed
+ Corresponds to HECI HPS (part of) section 4.2.1
+
+ @param[in] ReadPointer Value read from host/me read pointer
+ @param[in] WritePointer Value read from host/me write pointer
+ @param[in] BufferDepth Value read from buffer depth register
+
+ @retval EFI_DEVICE_ERROR The circular buffer has overflowed
+ @retval EFI_SUCCESS The circular buffer does not overflowed
+**/
+EFI_STATUS
+OverflowCB (
+ IN UINT32 ReadPointer,
+ IN UINT32 WritePointer,
+ IN UINT32 BufferDepth
+ )
+;
+
+/**
+ Get an abstract Intel ME State from Firmware Status Register.
+ This is used to control BIOS flow for different Intel ME
+ functions
+
+ @param[out] MeStatus Pointer for status report
+ see MeState.h - Abstract ME status definitions.
+
+ @retval EFI_SUCCESS MeStatus copied
+ @retval EFI_INVALID_PARAMETER Pointer of MeStatus is invalid
+**/
+EFI_STATUS
+EFIAPI
+HeciGetMeStatus (
+ OUT UINT32 *MeStatus
+ )
+;
+
+/**
+ Return ME Mode
+
+ @param[out] MeMode Pointer for ME Mode report
+
+ @retval EFI_SUCCESS MeMode copied
+ @retval EFI_INVALID_PARAMETER Pointer of MeMode is invalid
+**/
+EFI_STATUS
+EFIAPI
+HeciGetMeMode (
+ OUT UINT32 *MeMode
+ )
+;
+
+/**
+ This function provides a standard way to verify the HECI cmd and MBAR regs
+ in its PCI cfg space are setup properly and that the local mHeciContext
+ variable matches this info.
+
+ @param[in] None.
+
+ @retval UINT64 HeciMar address
+**/
+UINT64
+CheckAndFixHeciForAccess (
+ VOID
+ )
+;
+#endif // _HECI_CORE_H
diff --git a/ReferenceCode/ME/Heci/Dxe/Hecidrv.c b/ReferenceCode/ME/Heci/Dxe/Hecidrv.c
new file mode 100644
index 0000000..b34ea6f
--- /dev/null
+++ b/ReferenceCode/ME/Heci/Dxe/Hecidrv.c
@@ -0,0 +1,1540 @@
+/** @file
+ HECI driver
+
+@copyright
+ Copyright (c) 2007 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "HeciDrv.h"
+#include "HeciHpet.h"
+#include "HeciCore.h"
+#include "MeLib.h"
+#include "EfiScriptLib.h"
+#include "PchPlatformLib.h"
+
+#include EFI_GUID_DEFINITION (MePlatformReadyToBoot)
+#include EFI_GUID_DEFINITION (MeBiosExtensionSetup)
+#include EFI_PROTOCOL_DEFINITION (MeplatformPolicy)
+#include EFI_PROTOCOL_DEFINITION (AmtReadyToBoot)
+#include EFI_PROTOCOL_CONSUMER (ExitPmAuth)
+
+extern DXE_ME_POLICY_PROTOCOL *mDxePlatformMePolicy;
+
+#ifdef TCG_SUPPORT_FLAG
+#include "Acpi1_0.h"
+#include "Acpi2_0.h"
+#include "Acpi3_0.h"
+#include EFI_PROTOCOL_DEFINITION (TcgService)
+#include "TpmPc.h"
+#endif // TCG_SUPPORT_FLAG
+#endif // EDK_RELEASE_VERSION
+#define ONE_SECOND_TIMEOUT 1000000
+#define FWU_TIMEOUT 90
+
+//
+// Global driver data
+//
+HECI_INSTANCE *mHeciContext;
+EFI_HANDLE mHeciDrv;
+EFI_EVENT mExitBootServicesEvent;
+EFI_EVENT mLegacyBootEvent;
+DXE_MBP_DATA_PROTOCOL mMbpData;
+
+/**
+ This function provides a standard way to verify the HECI cmd and MBAR regs
+ in its PCI cfg space are setup properly and that the local mHeciContext
+ variable matches this info.
+
+ @param[in] None.
+
+ @retval UINT64 HeciMar address
+**/
+UINT64
+CheckAndFixHeciForAccess (
+ VOID
+ )
+{
+ ///
+ /// Read HECI_MBAR in case it has changed
+ ///
+ ///
+ /// Check if Base register is 64 bits wide.
+ ///
+ if (HeciPciRead32 (R_HECIMBAR) & 0x4) {
+ mHeciContext->HeciMBAR = (((UINT64) HeciPciRead32 (R_HECIMBAR + 4) << 32) |
+ (UINT64) HeciPciRead32 (R_HECIMBAR)) & 0xFFFFFFF0;
+ } else {
+ mHeciContext->HeciMBAR = (UINT64) HeciPciRead32 (R_HECIMBAR) & 0xFFFFFFF0;
+ }
+ ///
+ /// Check if HECI_MBAR is disabled
+ ///
+ if ((HeciPciRead8 (PCI_COMMAND_OFFSET) & (EFI_PCI_COMMAND_MEMORY_SPACE | EFI_PCI_COMMAND_BUS_MASTER)) !=
+ (EFI_PCI_COMMAND_MEMORY_SPACE | EFI_PCI_COMMAND_BUS_MASTER)
+ ) {
+ ///
+ /// If cmd reg in pci cfg space is not turned on turn it on.
+ ///
+ HeciPciOr8 (
+ PCI_COMMAND_OFFSET,
+ EFI_PCI_COMMAND_MEMORY_SPACE | EFI_PCI_COMMAND_BUS_MASTER
+ );
+ }
+
+ return mHeciContext->HeciMBAR;
+}
+
+/**
+ Enable Hpet function.
+
+ @param[in] None.
+
+ @retval None
+**/
+VOID
+EnableHpet (
+ VOID
+ )
+{
+ VOLATILE UINT32 *HpetConfigReg;
+
+ HpetConfigReg = NULL;
+ ///
+ /// Get the High Precision Event Timer base address and enable the memory range
+ ///
+ HpetConfigReg = (UINT32 *) (UINTN) (PCH_RCRB_BASE + R_PCH_RCRB_HPTC);
+ switch (*HpetConfigReg & B_PCH_RCRB_HPTC_AS) {
+ case 0:
+ mHeciContext->HpetTimer = (VOID *) (UINTN) (HPET_ADDRESS_0);
+ break;
+
+ case 1:
+ mHeciContext->HpetTimer = (VOID *) (UINTN) (HPET_ADDRESS_1);
+ break;
+
+ case 2:
+ mHeciContext->HpetTimer = (VOID *) (UINTN) (HPET_ADDRESS_2);
+ break;
+
+ case 3:
+ mHeciContext->HpetTimer = (VOID *) (UINTN) (HPET_ADDRESS_3);
+ break;
+
+ default:
+ mHeciContext->HpetTimer = NULL;
+ break;
+ }
+ ///
+ /// Read this back to force the write-back.
+ ///
+ *HpetConfigReg = *HpetConfigReg | B_PCH_RCRB_HPTC_AE;
+
+ ///
+ /// Start the timer so it is up and running
+ ///
+ mHeciContext->HpetTimer[HPET_GEN_CONFIG_LOW] = HPET_START;
+ mHeciContext->HpetTimer[HPET_GEN_CONFIG_LOW] = HPET_START;
+
+ return ;
+}
+
+#ifdef TCG_SUPPORT_FLAG
+
+/**
+ Perform measurement for HER register.
+
+ @param[in] HerValue The value of HECI Extend Register.
+ @param[in] Index HerValue Size.
+
+ @retval EFI_SUCCESS Measurement performed
+**/
+EFI_STATUS
+MeasureHer (
+ IN UINT32 *HerValue,
+ IN UINT8 Index
+ )
+{
+ EFI_STATUS Status;
+ EFI_TCG_PROTOCOL *TcgProtocol;
+ EFI_TCG_PCR_EVENT TcgEvent;
+ UINT32 EventNumber;
+ EFI_PHYSICAL_ADDRESS EventLogLastEntry;
+
+ Status = gBS->LocateProtocol (
+ &gEfiTcgProtocolGuid,
+ NULL,
+ (VOID **) &TcgProtocol
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ ///
+ /// This below data will be stored in Tcg eventlog
+ ///
+ TcgEvent.Event.PostCode.PostCodeAddress = *HerValue;
+ TcgEvent.Event.PostCode.PostCodeLength = sizeof (UINT32);
+
+ ///
+ /// Fill the TcgEvent Header
+ ///
+ TcgEvent.Header.PCRIndex = PCRi_CRTM_AND_POST_BIOS;
+ TcgEvent.Header.EventType = EV_S_CRTM_CONTENTS;
+
+ TcgEvent.Header.EventDataSize = (Index * sizeof (UINT32));
+
+ Status = TcgProtocol->HashLogExtendEvent (
+ TcgProtocol,
+ (EFI_PHYSICAL_ADDRESS) HerValue,
+ TcgEvent.Header.EventDataSize,
+ TPM_ALG_SHA,
+ (TCG_PCR_EVENT *) &TcgEvent,
+ &EventNumber,
+ &EventLogLastEntry
+ );
+ return Status;
+}
+
+/**
+ Me Measurement.
+
+ @param[in] None.
+
+ @retval EFI_NOT_READY Not ready for measurement.
+ @retval EFI_SUCCESS Measurement done
+**/
+EFI_STATUS
+MeMeasurement (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ DATA32_UNION Data32[7];
+ UINT8 HerMax;
+ UINT8 HerIndex;
+ UINT8 Index;
+
+ Index = 0;
+ ///
+ /// Measure HER
+ ///
+ HerMax = R_ME_HER5;
+ Data32[Index].Data32 = PciRead32 (PCI_LIB_ADDRESS (ME_BUS, ME_DEVICE_NUMBER, HECI_FUNCTION_NUMBER, R_ME_HERS));
+
+ if ((Data32[Index].Data32 & B_ME_EXTEND_REG_VALID) == B_ME_EXTEND_REG_VALID) {
+ if ((Data32[Index].Data8[0] & B_ME_EXTEND_REG_ALGORITHM) == V_ME_SHA_256) {
+ HerMax = R_ME_HER8;
+ }
+
+ for (HerIndex = R_ME_HER1, Index = 0; HerIndex <= HerMax; HerIndex += 4, Index++) {
+ Data32[Index].Data32 = PciRead32 (PCI_LIB_ADDRESS (ME_BUS, ME_DEVICE_NUMBER, HECI_FUNCTION_NUMBER, HerIndex));
+ }
+
+ Status = MeasureHer (&Data32->Data32, Index);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "ME Measurement feature failed, Status is %r \n", Status));
+ }
+ } else {
+ Status = EFI_NOT_READY;
+ }
+
+ return Status;
+}
+
+/**
+ Signal a event for last checking.
+
+ @param[in] Event The event that triggered this notification function
+ @param[in] Context Pointer to the notification functions context
+
+ @retval EFI_SUCCESS Event excuted and closed.
+**/
+EFI_STATUS
+MeMeasurementEvent (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ MeMeasurement ();
+
+ gBS->CloseEvent (Event);
+
+ return EFI_SUCCESS;
+}
+#endif
+
+/**
+ Show warning message to user.
+
+ @param[in] None.
+
+ @retval EFI_SUCCESS Warning reported
+**/
+EFI_STATUS
+MeWarningMessage (
+ VOID
+ )
+{
+ HECI_FWS_REGISTER MeFirmwareStatus;
+
+ MeFirmwareStatus.ul = HeciPciRead32 (R_FWSTATE);
+
+ ///
+ /// Check for ME FPT Bad & FT BUP LD FLR
+ ///
+ if (MeFirmwareStatus.r.FptBad != 0 || MeFirmwareStatus.r.FtBupLdFlr != 0) {
+ MeReportError (MSG_ME_FW_UPDATE_FAILED);
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Store the current value of DEVEN for S3 resume path
+
+ @param[in] None
+
+ @retval None
+**/
+VOID
+DeviceStatusSave (
+ VOID
+ )
+{
+ UINT32 Data;
+
+ ///
+ /// Read RCBA register for saving
+ ///
+ Data = Mmio16 (PCH_RCRB_BASE, R_PCH_RCRB_FD2);
+
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PCH_RCRB_BASE + R_PCH_RCRB_FD2),
+ 1,
+ &Data
+ );
+ Data = Mmio16 (PCH_RCRB_BASE, R_PCH_RCRB_FDSW);
+
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PCH_RCRB_BASE + R_PCH_RCRB_FDSW),
+ 1,
+ &Data
+ );
+}
+
+/**
+ ME BWG 1.0 5.3.1.1: IDER Workaround, perform this only when IDER device is present.
+
+ @param[in] None
+
+ @retval None
+**/
+VOID
+PerformIderWorkaround (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ UINT64 BaseAddress;
+ UINT64 BaseAddress2;
+ UINT64 Index;
+ BOOLEAN WorkaroundFlag;
+
+ WorkaroundFlag = TRUE;
+
+ Status = gDS->AllocateIoSpace (
+ EfiGcdAllocateAnySearchBottomUp,
+ EfiGcdIoTypeIo,
+ 4,
+ 0x10,
+ &BaseAddress,
+ mHeciDrv,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Program BAR4
+ ///
+ PciWrite32 (PCI_LIB_ADDRESS (ME_BUS, ME_DEVICE_NUMBER, IDER_FUNCTION_NUMBER, 0x20), (UINT32) BaseAddress);
+
+ ///
+ /// Enable IDER IOE
+ ///
+ PciOr8 (
+ PCI_LIB_ADDRESS (ME_BUS,
+ ME_DEVICE_NUMBER,
+ IDER_FUNCTION_NUMBER,
+ PCI_COMMAND_OFFSET),
+ EFI_PCI_COMMAND_IO_SPACE
+ );
+
+ ///
+ /// Perform the workaround if offset 3 bit 0 is not set
+ ///
+ if ((IoRead8 ((UINTN) BaseAddress + 3) & 0x01) == 00) {
+ Status = gDS->AllocateIoSpace (
+ EfiGcdAllocateAnySearchBottomUp,
+ EfiGcdIoTypeIo,
+ 4,
+ 0x10,
+ &BaseAddress2,
+ mHeciDrv,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+ PciWrite32 (PCI_LIB_ADDRESS (ME_BUS, ME_DEVICE_NUMBER, IDER_FUNCTION_NUMBER, 0x10), (UINT32) BaseAddress2);
+ ///
+ /// check all ports to make sure all are 0x7f before running the workaround
+ ///
+ for (Index = 0; Index <= 7; Index++) {
+ if (IoRead8 ((UINTN) BaseAddress2 + (UINTN) Index) != 0x7f) {
+ WorkaroundFlag = FALSE;
+ break;
+ }
+ }
+ ///
+ /// Disable IDER IOE and clear BAR0 and BAR4
+ ///
+ PciAnd8 (
+ PCI_LIB_ADDRESS (ME_BUS,
+ ME_DEVICE_NUMBER,
+ IDER_FUNCTION_NUMBER,
+ PCI_COMMAND_OFFSET),
+ (UINT8)~EFI_PCI_COMMAND_IO_SPACE
+ );
+ PciWrite32 (PCI_LIB_ADDRESS (ME_BUS, ME_DEVICE_NUMBER, IDER_FUNCTION_NUMBER, 0x10), 0);
+ PciWrite32 (PCI_LIB_ADDRESS (ME_BUS, ME_DEVICE_NUMBER, IDER_FUNCTION_NUMBER, 0x20), 0);
+
+ if (WorkaroundFlag) {
+ IderDisable ();
+ }
+
+ gDS->FreeIoSpace (BaseAddress2, (UINT64) 0x10);
+ } else {
+ PciAnd8 (
+ PCI_LIB_ADDRESS (ME_BUS,
+ ME_DEVICE_NUMBER,
+ IDER_FUNCTION_NUMBER,
+ PCI_COMMAND_OFFSET),
+ (UINT8)~EFI_PCI_COMMAND_IO_SPACE
+ );
+ PciWrite32 (PCI_LIB_ADDRESS (ME_BUS, ME_DEVICE_NUMBER, IDER_FUNCTION_NUMBER, 0x20), 0);
+ }
+
+ gDS->FreeIoSpace (BaseAddress, (UINT64) 0x10);
+ return ;
+}
+
+/**
+ Disable ME Devices when needed
+
+ @param[in] None
+
+ @retval EFI_SUCCESS Always return EFI_SUCCESS
+**/
+EFI_STATUS
+MeDeviceConfigure (
+ VOID
+ )
+{
+ UINT32 MeMode;
+ UINT16 VendorID;
+ UINT16 DeviceID;
+
+ HeciGetMeMode (&MeMode);
+ if (MeMode == ME_MODE_NORMAL) {
+ if (mHeciContext->MeFwImageType != INTEL_ME_5MB_FW) {
+ ///
+ /// We will disable all AMT relevant devices in 1.5M SKU
+ ///
+ IderDisable ();
+ SolDisable ();
+ Usbr1Disable ();
+ Usbr2Disable ();
+ } else {
+ ///
+ /// ME BWG 1.0 5.3.1.1: IDER Workaround, perform this only when IDER device is present.
+ ///
+ VendorID = PciRead16 (PCI_LIB_ADDRESS (ME_BUS, ME_DEVICE_NUMBER, IDER_FUNCTION_NUMBER, 0x00));
+ DeviceID = PciRead16 (PCI_LIB_ADDRESS (ME_BUS, ME_DEVICE_NUMBER, IDER_FUNCTION_NUMBER, 0x02));
+ if ((VendorID == V_ME_IDER_VENDOR_ID) && IS_PCH_LPT_IDER_DEVICE_ID(DeviceID)
+ ) {
+ PerformIderWorkaround ();
+ }
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Send ME the BIOS end of Post message.
+
+ @param[in] None.
+
+ @retval EFI_SUCCESS Always return EFI_SUCCESS except for policy initization failure.
+ @exception EFI_UNSUPPORTED Policy initization failure.
+**/
+EFI_STATUS
+MeEndOfPostEvent (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ EFI_HECI_PROTOCOL *Heci;
+ UINT32 MeStatus;
+ UINT8 EopSendRetries;
+ UINT32 HECI_BASE_ADDRESS;
+ HECI_HOST_CONTROL_REGISTER HeciRegHCsr;
+ VOLATILE HECI_HOST_CONTROL_REGISTER *HeciRegHCsrPtr;
+ VOLATILE HECI_ME_CONTROL_REGISTER *HeciRegMeCsrHaPtr;
+
+ //
+ // Init ME Policy Library, continue to send EOP message even if can't find Me Platform Policy
+ //
+ if (mDxePlatformMePolicy == NULL) {
+ MePolicyLibInit ();
+ }
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+ if (!EFI_ERROR (Status)) {
+ ///
+ /// Send EOP message when ME is ready. Do not care about if ME FW INIT is completed.
+ ///
+ Status = Heci->GetMeStatus (&MeStatus);
+ ASSERT_EFI_ERROR (Status);
+
+ if (ME_STATUS_ME_STATE_ONLY (MeStatus) == ME_READY) {
+
+ if (MeEndOfPostEnabled ()) {
+ DEBUG ((EFI_D_INFO, "Sending EOP...\n"));
+
+ //
+ // Initialize pointers to control registers
+ //
+ HECI_BASE_ADDRESS = PciRead32 (PCI_LIB_ADDRESS (ME_BUS, ME_DEVICE_NUMBER, HECI_FUNCTION_NUMBER, R_HECIMBAR)) & 0xFFFFFFF0;
+ HeciRegHCsrPtr = (VOID *) (UINTN) (HECI_BASE_ADDRESS + H_CSR);
+ HeciRegMeCsrHaPtr = (VOID *) (UINTN) (HECI_BASE_ADDRESS + ME_CSR_HA);
+
+ for (EopSendRetries = 0; EopSendRetries <= MAX_EOP_SEND_RETRIES; EopSendRetries++) {
+
+ Status = HeciSendEndOfPostMessage (mHeciDrv);
+ if (Status == EFI_SUCCESS) {
+ break;
+ }
+
+ MeReportError (MSG_EOP_ERROR);
+
+ //
+ // Set H_RST and H_IG bits to reset HECI
+ //
+ HeciRegHCsr.ul = HeciRegHCsrPtr->ul;
+ HeciRegHCsr.r.H_RST = 1;
+ HeciRegHCsr.r.H_IG = 1;
+ HeciRegHCsrPtr->ul = HeciRegHCsr.ul;
+
+ //
+ // Wait for ME_RDY
+ //
+ if (WaitForMEReady () != EFI_SUCCESS) {
+ Status = EFI_TIMEOUT;
+ break;
+ }
+
+ //
+ // Clear H_RST, set H_RDY & H_IG bits
+ //
+ HeciRegHCsr.ul = HeciRegHCsrPtr->ul;
+ HeciRegHCsr.r.H_RST = 0;
+ HeciRegHCsr.r.H_IG = 1;
+ HeciRegHCsr.r.H_RDY = 1;
+ HeciRegHCsrPtr->ul = HeciRegHCsr.ul;
+ }
+
+ if (EFI_ERROR(Status)) {
+ //
+ // Send HECI_BUS_DISABLE
+ //
+ for (EopSendRetries = 0; EopSendRetries <= MAX_EOP_SEND_RETRIES; EopSendRetries++) {
+ Status = HeciDisableHeciBusMsg();
+ if (!EFI_ERROR(Status)) {
+ break;
+ }
+ }
+
+ //
+ // Disable HECI function
+ //
+ HeciDisable();
+ Heci2Disable();
+ }
+
+ }
+ } else if (ME_STATUS_ME_STATE_ONLY (MeStatus) == ME_DISABLE_WAIT) {
+ MeReportError (MSG_PLAT_DISABLE_WAIT);
+ }
+
+ }
+
+ return Status;
+}
+
+/**
+ 1. Cf9Gr Lock Config
+ - PCH BIOS Spec Rev 0.9 Section 18.4 Additional Power Management Programming
+ Step 2
+ Set "Power Management Initialization Register (PMIR) Field 1", D31:F0:ACh[31] = 1b
+ for production machine according to "RS - PCH Intel Management Engine
+ (Intel(r) ME) BIOS Writer's Guide".
+ 2. Function Disable SUS Well Lock
+ - PCH EDS 10.1.76 request that FDSW must be set when Intel Active Management Technology
+ is Enabled
+
+ @param[in] None
+
+ @retval Status.
+**/
+EFI_STATUS
+LockConfig (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ EFI_HECI_PROTOCOL *Heci;
+ UINT32 MeMode;
+ HECI_FWS_REGISTER MeFirmwareStatus;
+ UINTN Address;
+ UINT32 Data;
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+ if (!EFI_ERROR (Status)) {
+ ///
+ /// Check ME Status
+ ///
+ Status = Heci->GetMeMode (&MeMode);
+ ASSERT_EFI_ERROR (Status);
+
+ MeFirmwareStatus.ul = HeciPciRead32 (R_FWSTATE);
+
+ ///
+ /// PCH BIOS Spec Rev 0.9 Section 18.4 Additional Power Management Programming
+ /// Step 2
+ /// Set "Power Management Initialization Register (PMIR) Field 1", D31:F0:ACh[31] = 1b
+ /// for production machine according to "RS - PCH Intel Management Engine
+ /// (Intel(r) ME) BIOS Writer's Guide".
+ ///
+ /// PCH ME BWG section 4.5.1
+ /// The IntelR FPT tool /GRST option uses CF9GR bit to trigger global reset.
+ /// Based on above reason, the BIOS should not lock down CF9GR bit during Manufacturing and
+ /// Re-manufacturing environment.
+ ///
+ Data = 0;
+ if ((((MeMode == ME_MODE_NORMAL) || (MeMode == ME_MODE_TEMP_DISABLED)) && !(MeFirmwareStatus.r.ManufacturingMode))) {
+ ///
+ /// PCH ME BWG section 4.4.1
+ /// BIOS must also ensure that CF9GR is cleared and locked (via bit31 of the same register) before
+ /// handing control to the OS in order to prevent the host from issuing global resets and reseting
+ /// Intel Management Engine.
+ ///
+ Data |= B_PCH_LPC_PMIR_CF9LOCK;
+ }
+
+ Address = PCI_LIB_ADDRESS (
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_PMIR
+ );
+ PciAndThenOr32 (
+ Address,
+ (UINT32) (~(B_PCH_LPC_PMIR_CF9LOCK | B_PCH_LPC_PMIR_CF9GR)),
+ (UINT32) Data
+ );
+
+ ///
+ /// Function Disable SUS Well lockdown
+ ///
+ if (MeMode == ME_MODE_NORMAL) {
+ if (mHeciContext->MeFwImageType == INTEL_ME_5MB_FW) {
+ DEBUG ((EFI_D_ERROR, "Function Disable SUS Well lockdown!\n"));
+ FunctionDisableWellLockdown ();
+ }
+ }
+ }
+
+ return Status;
+}
+
+/**
+ Halt Boot for up to 90 seconds if Bit 11 of FW Status Register (FW_UPD_IN_PROGRESS) is set
+
+ @param[in] None
+
+ @retval None
+**/
+VOID
+CheckFwUpdInProgress (
+ VOID
+ )
+{
+ HECI_FWS_REGISTER FwStatus;
+ UINT8 StallCount;
+ EFI_STATUS Status;
+
+ StallCount = 0;
+ Status = mHeciContext->HeciCtlr.GetMeStatus (&FwStatus.ul);
+ if (!EFI_ERROR (Status)) {
+ if (FwStatus.ul & ME_FW_UPDATES_IN_PROGRESS) {
+ MeReportError (MSG_ME_FW_UPDATE_WAIT);
+ }
+
+ while ((FwStatus.ul & ME_FW_UPDATES_IN_PROGRESS) && (StallCount < FWU_TIMEOUT)) {
+ gBS->Stall (ONE_SECOND_TIMEOUT);
+ StallCount = StallCount + 1;
+ Status = mHeciContext->HeciCtlr.GetMeStatus (&FwStatus.ul);
+ }
+ }
+
+ return ;
+}
+
+/**
+ Signal a event for Me ready to boot.
+
+ @param[in] Event The event that triggered this notification function
+ @param[in] Context Pointer to the notification functions context
+
+ @retval None
+**/
+VOID
+EFIAPI
+MeReadyToBootEvent (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ EFI_STATUS Status;
+ EFI_EVENT MePlatformReadyToBootEvent;
+ EFI_HANDLE *Handles;
+ UINTN Index;
+ UINTN Count;
+ AMT_READY_TO_BOOT_PROTOCOL *AmtReadyToBoot;
+ UINT32 MeMode;
+ UINT32 MeStatus;
+#ifdef TCG_SUPPORT_FLAG
+ EFI_EVENT LegacyBootEvent;
+ EFI_EVENT ExitBootServicesEvent;
+
+ Status = MeMeasurement ();
+ if (Status == EFI_NOT_READY) {
+ ///
+ /// Create a Legacy Boot event.
+ ///
+ Status = EfiCreateEventLegacyBootEx (
+ EFI_TPL_CALLBACK,
+ MeMeasurementEvent,
+ NULL,
+ &LegacyBootEvent
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Create a ExitBootService event.
+ ///
+ Status = gBS->CreateEvent (
+ EVENT_SIGNAL_EXIT_BOOT_SERVICES,
+ EFI_TPL_CALLBACK,
+ MeMeasurementEvent,
+ NULL,
+ &ExitBootServicesEvent
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
+
+#endif //TCG_SUPPORT_FLAG
+ ///
+ /// PCH BIOS Spec Rev 0.8.0, Section 22.8.3.1 ASPM on DMI and the PCI Express Root Ports
+ /// Step g
+ /// Issue "WRITE_ICC_REGISTER" MEI message to program ICC register offset 0x4 with 0x000999999
+ /// This is always needed for PCIE with hotplug on and off and PCIE RP enabled and disabled.
+ ///
+ if(GetPchSeries() == PchLp) {
+ Status = HeciWriteIccRegDword(0x0004, 0x00999999, ICC_RESPONSE_MODE_SKIP);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "Heci writes to TMCSRCCLK failed. Status = %X\n", Status));
+ }
+ }
+
+ ///
+ /// We will trigger all events in order
+ ///
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gAmtReadyToBootProtocolGuid,
+ NULL,
+ &Count,
+ &Handles
+ );
+ if (!EFI_ERROR (Status)) {
+ for (Index = 0; Index < Count; Index++) {
+ Status = gBS->HandleProtocol (Handles[Index], &gAmtReadyToBootProtocolGuid, (VOID **) &AmtReadyToBoot);
+ ASSERT_EFI_ERROR (Status);
+ AmtReadyToBoot->Signal ();
+ }
+ }
+
+ Status = gBS->CreateEventEx (
+ EFI_EVENT_NOTIFY_SIGNAL,
+ EFI_TPL_CALLBACK,
+ MeEmptyEvent,
+ NULL,
+ &gMePlatformReadyToBootGuid,
+ &MePlatformReadyToBootEvent
+ );
+ ASSERT_EFI_ERROR (Status);
+ if (!EFI_ERROR (Status)) {
+ gBS->SignalEvent (MePlatformReadyToBootEvent);
+ gBS->CloseEvent (MePlatformReadyToBootEvent);
+ }
+
+ HeciGetMeMode (&MeMode);
+ HeciGetMeStatus (&MeStatus);
+ if ((MeMode == ME_MODE_NORMAL) &&
+ ((ME_STATUS_ME_STATE_ONLY (MeStatus) == ME_IN_RECOVERY_MODE) || (ME_STATUS_ME_STATE_ONLY (MeStatus) == ME_READY))
+ ) {
+
+ CheckFwUpdInProgress ();
+
+ Status = MeWarningMessage ();
+ ASSERT_EFI_ERROR (Status);
+
+ Status = MeEndOfPostEvent ();
+ ASSERT_EFI_ERROR (Status);
+ }
+
+ ///
+ /// Set EndOfPostDone regardless whether the EOP msg was sent
+ ///
+ if (MeEndOfPostEnabled ()) {
+ mDxePlatformMePolicy->MeConfig.EndOfPostDone = 1;
+ }
+
+ ///
+ /// PMIR Configuration & FDSW Lockdown
+ ///
+ Status = LockConfig ();
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Disable Heci2 if policy dictates
+ ///
+ Heci2Disable ();
+
+ ///
+ /// If ME Mode is running in ME Temp Disable state, disable Heci1, HECI2, Ider and Sol
+ ///
+ HeciGetMeMode (&MeMode);
+ if (MeMode == ME_MODE_TEMP_DISABLED) {
+ DisableAllMEDevices ();
+ }
+
+ gBS->CloseEvent (Event);
+
+ return;
+}
+
+/**
+ Signal a event to save Me relevant registers and this event must be run before ExitPmAuth.
+
+ @param[in] Event The event that triggered this notification function
+ @param[in] ParentImageHandle Pointer to the notification functions context
+
+ @retval None
+**/
+VOID
+EFIAPI
+MeScriptSaveEvent (
+ IN EFI_EVENT Event,
+ IN VOID *ParentImageHandle
+ )
+{
+ EFI_STATUS Status;
+ VOID *ProtocolPointer;
+ EFI_HECI_PROTOCOL *Heci;
+ UINT32 MeMode;
+ HECI_FWS_REGISTER MeFirmwareStatus;
+ UINTN Address;
+ UINT32 Data;
+ UINT32 MebxSetupVariableAttributes;
+ UINTN MebxSetupVariableDataSize;
+ ME_BIOS_EXTENSION_SETUP MeBiosExtensionSetup;
+ const UINT8 Str5MBFw[sizeof (MEFW_5M_STRING)] = MEFW_5M_STRING;
+ EFI_MEBX_PROTOCOL *MebxProtocol;
+
+ INITIALIZE_SCRIPT (ParentImageHandle, gST);
+
+ ///
+ /// Check whether this is real ExitPmAuth notification, or just a SignalEvent
+ ///
+ Status = gBS->LocateProtocol (&gExitPmAuthProtocolGuid, NULL, &ProtocolPointer);
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+ ///
+ /// PMIR Configuration Save
+ ///
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+ ///
+ /// Check ME Status
+ ///
+ Status = Heci->GetMeMode (&MeMode);
+ ASSERT_EFI_ERROR (Status);
+
+ MeFirmwareStatus.ul = HeciPciRead32 (R_FWSTATE);
+
+ ///
+ /// Init ME Policy Library
+ ///
+ Status = MePolicyLibInit ();
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+
+#ifdef EFI_DEBUG
+ //
+ // Dump the ME platform policy
+ //
+ DxeMePolicyDebugDump ();
+#endif
+
+ ///
+ /// Report ME components version information to FVI
+ ///
+ InitFviDataHubCbContext (
+ mDxePlatformMePolicy->MeMiscConfig.FviSmbiosType,
+ (UINT8) mMeFviElements,
+ &mMeFviVersionData
+ );
+
+ mMeFviElementsData[EnumMeFw].Element.Version.MajorVersion = (UINT8) mMbpData.MeBiosPayload.FwVersionName.MajorVersion;
+ mMeFviElementsData[EnumMeFw].Element.Version.MinorVersion = (UINT8) mMbpData.MeBiosPayload.FwVersionName.MinorVersion;
+ mMeFviElementsData[EnumMeFw].Element.Version.Revision = (UINT8) mMbpData.MeBiosPayload.FwVersionName.HotfixVersion;
+ mMeFviElementsData[EnumMeFw].Element.Version.BuildNum = (UINT16) mMbpData.MeBiosPayload.FwVersionName.BuildVersion;
+ if (mMbpData.MeBiosPayload.FwPlatType.RuleData.Fields.IntelMeFwImageType == INTEL_ME_5MB_FW) {
+ CopyMem (mMeFviElementsData[EnumMeFw].Element.VerString, Str5MBFw, sizeof (MEFW_5M_STRING));
+ }
+ Status = gBS->LocateProtocol (&gEfiMebxProtocolGuid, NULL, (VOID **) &MebxProtocol);
+ if (!EFI_ERROR (Status)) {
+ mMeFviElementsData[EnumMebx].Element.Version.MajorVersion = (UINT8) MebxProtocol->MebxVersion.Major;
+ mMeFviElementsData[EnumMebx].Element.Version.MinorVersion = (UINT8) MebxProtocol->MebxVersion.Minor;
+ mMeFviElementsData[EnumMebx].Element.Version.Revision = (UINT8) MebxProtocol->MebxVersion.Hotfix;
+ mMeFviElementsData[EnumMebx].Element.Version.BuildNum = (UINT16) MebxProtocol->MebxVersion.Build;
+ }
+
+ CreateRcFviDatahub (&mMeFviVersionData);
+
+ ///
+ /// PCH BIOS Spec Rev 0.9 Section 18.4 Additional Power Management Programming
+ /// Step 2
+ /// Set "Power Management Initialization Register (PMIR) Field 1", D31:F0:ACh[31] = 1b
+ /// for production machine according to "RS - PCH Intel Management Engine
+ /// (Intel(r) ME) BIOS Writer's Guide".
+ ///
+ /// PCH ME BWG section 4.5.1
+ /// The IntelR FPT tool /GRST option uses CF9GR bit to trigger global reset.
+ /// Based on above reason, the BIOS should not lock down CF9GR bit during Manufacturing and
+ /// Re-manufacturing environment.
+ ///
+ Address = PCI_LIB_ADDRESS (
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_PMIR
+ );
+ Data = PciRead32 (Address);
+ Data &= (UINT32) (~(B_PCH_LPC_PMIR_CF9LOCK | B_PCH_LPC_PMIR_CF9GR));
+
+ if ((((MeMode == ME_MODE_NORMAL) || (MeMode == ME_MODE_TEMP_DISABLED)) && !(MeFirmwareStatus.r.ManufacturingMode))) {
+ ///
+ /// PCH ME BWG section 4.4.1
+ /// BIOS must also ensure that CF9GR is cleared and locked (via bit31 of the same register) before
+ /// handing control to the OS in order to prevent the host from issuing global resets and reseting
+ /// Intel Management Engine.
+ ///
+ Data |= (UINT32) (B_PCH_LPC_PMIR_CF9LOCK);
+ }
+#ifdef SUS_WELL_RESTORE
+ ///
+ /// PMIR is a resume well register and has no script save for it.
+ /// System may go through S3 resume path from G3 if RapidStart is enabled,
+ /// that means all resume well registers will be reset to defaults.
+ /// Save boot script for PMIR register if RapidStart is enabled.
+ ///
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint32,
+ (UINTN) MmPciAddress (0x0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_PMIR),
+ 1,
+ &Data
+ );
+#endif
+ ///
+ ///
+ /// Read RCBA register for saving
+ ///
+ Data = Mmio16 (PCH_RCRB_BASE, R_PCH_RCRB_FD2);
+ ///
+ /// Disable Heci2 if policy dictates
+ ///
+ Data |= (BIT0 << HECI2);
+
+ ///
+ /// If ME Mode is running in ME Temp Disable state, disable Heci1, HECI2, Ider and Sol
+ ///
+ if ((MeMode == ME_MODE_TEMP_DISABLED) || (MeMode == ME_MODE_SECOVER)) {
+ Data |= ((BIT0 << HECI1) + (BIT0 << HECI2) + (BIT0 << IDER) + (BIT0 << SOL));
+ }
+
+ if (MeMode == ME_MODE_NORMAL) {
+ if (mHeciContext->MeFwImageType == INTEL_ME_1_5MB_FW) {
+ ///
+ /// We will disable HECI2, Ider and Sol in 1.5M SKU
+ ///
+ Data |= ((BIT0 << HECI2) + (BIT0 << IDER) + (BIT0 << SOL));
+ } else if (mHeciContext->MeFwImageType == INTEL_ME_5MB_FW) {
+ MebxSetupVariableAttributes = EFI_VARIABLE_BOOTSERVICE_ACCESS |
+ EFI_VARIABLE_RUNTIME_ACCESS |
+ EFI_VARIABLE_NON_VOLATILE;
+ MebxSetupVariableDataSize = sizeof (ME_BIOS_EXTENSION_SETUP);
+
+ Status = gST->RuntimeServices->GetVariable (
+ gEfiMeBiosExtensionSetupName,
+ &gEfiMeBiosExtensionSetupGuid,
+ &MebxSetupVariableAttributes,
+ &MebxSetupVariableDataSize,
+ &MeBiosExtensionSetup
+ );
+ if (!EFI_ERROR (Status)) {
+ if ((MeBiosExtensionSetup.AmtSolIder & SOL_ENABLE) == 0) {
+ Data |= (BIT0 << SOL);
+ }
+
+ if ((MeBiosExtensionSetup.AmtSolIder & IDER_ENABLE) == 0) {
+ Data |= (BIT0 << IDER);
+ }
+ }
+ }
+ }
+
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PCH_RCRB_BASE + R_PCH_RCRB_FD2),
+ 1,
+ &Data
+ );
+ ///
+ /// Function Disable SUS Well lockdown
+ ///
+ Data = Mmio16 (PCH_RCRB_BASE, R_PCH_RCRB_FDSW);
+
+ if (MeMode == ME_MODE_NORMAL) {
+ if (mHeciContext->MeFwImageType == INTEL_ME_5MB_FW) {
+ Data |= B_PCH_RCRB_FDSW_FDSWL;
+ }
+ }
+
+ SCRIPT_MEM_WRITE (
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,
+ EfiBootScriptWidthUint16,
+ (UINTN) (PCH_RCRB_BASE + R_PCH_RCRB_FDSW),
+ 1,
+ &Data
+ );
+
+ gBS->CloseEvent (Event);
+ return;
+}
+
+/**
+ Send Get Firmware SKU Request to ME
+
+ @param[out] FwCapsSku Return FwCapsSku mask for Get Firmware Capability SKU
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+ @retval EFI_BUFFER_TOO_SMALL Message Buffer is too smallfor the Acknowledge
+**/
+EFI_STATUS
+MbpGetFwCapsSkuThroughHeci (
+ OUT MEFWCAPS_SKU *FwCapsSku
+ )
+{
+ EFI_STATUS Status;
+ GEN_GET_FW_CAPS_SKU_BUFFER MsgGenGetFwCapsSku;
+ UINT32 Length;
+ UINT32 RespLength;
+
+ MsgGenGetFwCapsSku.Request.MKHIHeader.Data = 0;
+ MsgGenGetFwCapsSku.Request.MKHIHeader.Fields.GroupId = MKHI_FWCAPS_GROUP_ID;
+ MsgGenGetFwCapsSku.Request.MKHIHeader.Fields.Command = FWCAPS_GET_RULE_CMD;
+ MsgGenGetFwCapsSku.Request.MKHIHeader.Fields.IsResponse = 0;
+ MsgGenGetFwCapsSku.Request.Data.RuleId = 0;
+ Length = sizeof (GEN_GET_FW_CAPSKU);
+ RespLength = sizeof(GEN_GET_FW_CAPS_SKU_ACK);
+
+ ///
+ /// Send Get FW SKU Request to ME
+ ///
+ Status = HeciSendwACK (
+ (UINT32 *) &MsgGenGetFwCapsSku,
+ Length,
+ &RespLength,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_CORE_MESSAGE_ADDR
+ );
+
+ if (!EFI_ERROR(Status) &&
+ ((MsgGenGetFwCapsSku.Response.MKHIHeader.Fields.Command) == FWCAPS_GET_RULE_CMD) &&
+ ((MsgGenGetFwCapsSku.Response.MKHIHeader.Fields.IsResponse) == 1) &&
+ (MsgGenGetFwCapsSku.Response.MKHIHeader.Fields.Result == 0)
+ ) {
+ *FwCapsSku = MsgGenGetFwCapsSku.Response.Data.FWCapSku;
+ return EFI_SUCCESS;
+ }
+
+ return Status;
+}
+
+/**
+ Send Get Platform Type Request to ME
+
+ @param[in] RuleData PlatformBrand,
+ IntelMeFwImageType,
+ SuperSku,
+ PlatformTargetMarketType,
+ PlatformTargetUsageType
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+ @retval EFI_BUFFER_TOO_SMALL Message Buffer is too smallfor the Acknowledge
+**/
+EFI_STATUS
+MbpGetPlatformTypeThroughHeci (
+ OUT PLATFORM_TYPE_RULE_DATA *RuleData
+ )
+{
+ EFI_STATUS Status;
+ GEN_GET_PLATFORM_TYPE_BUFFER MsgGenGetPlatformType;
+ UINT32 Length;
+ UINT32 RespLength;
+
+ MsgGenGetPlatformType.Request.MKHIHeader.Data = 0;
+ MsgGenGetPlatformType.Request.MKHIHeader.Fields.GroupId = MKHI_FWCAPS_GROUP_ID;
+ MsgGenGetPlatformType.Request.MKHIHeader.Fields.Command = FWCAPS_GET_RULE_CMD;
+ MsgGenGetPlatformType.Request.MKHIHeader.Fields.IsResponse = 0;
+ MsgGenGetPlatformType.Request.Data.RuleId = 0x1D;
+ Length = sizeof (GEN_GET_PLATFORM_TYPE);
+ RespLength = sizeof(GEN_GET_PLATFORM_TYPE_ACK);
+
+ ///
+ /// Send Get FW SKU Request to ME
+ ///
+ Status = HeciSendwACK (
+ (UINT32 *) &MsgGenGetPlatformType,
+ Length,
+ &RespLength,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_CORE_MESSAGE_ADDR
+ );
+
+ if (!EFI_ERROR(Status) &&
+ ((MsgGenGetPlatformType.Response.MKHIHeader.Fields.Command) == FWCAPS_GET_RULE_CMD) &&
+ ((MsgGenGetPlatformType.Response.MKHIHeader.Fields.IsResponse) == 1) &&
+ (MsgGenGetPlatformType.Response.MKHIHeader.Fields.Result == 0)
+ ) {
+ *RuleData = MsgGenGetPlatformType.Response.Data.RuleData;
+ return EFI_SUCCESS;
+ }
+
+ return Status;
+}
+
+/**
+ Send Get Firmware Features State Request to ME
+
+ @param[out] FwFeaturesState Return FwFeaturesState mask for Get Firmware Features State
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+ @retval EFI_BUFFER_TOO_SMALL Message Buffer is too smallfor the Acknowledge
+**/
+EFI_STATUS
+MbpGetFwFeaturesStateThroughHeci (
+ OUT MEFWCAPS_SKU *FwFeaturesState
+ )
+{
+ EFI_STATUS Status;
+ GEN_GET_FW_CAPS_SKU_BUFFER MsgGenGetFwCapsSku;
+ UINT32 Length;
+ UINT32 RespLength;
+
+ MsgGenGetFwCapsSku.Request.MKHIHeader.Data = 0;
+ MsgGenGetFwCapsSku.Request.MKHIHeader.Fields.GroupId = MKHI_FWCAPS_GROUP_ID;
+ MsgGenGetFwCapsSku.Request.MKHIHeader.Fields.Command = FWCAPS_GET_RULE_CMD;
+ MsgGenGetFwCapsSku.Request.MKHIHeader.Fields.IsResponse = 0;
+ MsgGenGetFwCapsSku.Request.Data.RuleId = 0x20;
+ Length = sizeof (GEN_GET_FW_CAPSKU);
+ RespLength = sizeof(GEN_GET_FW_CAPS_SKU_ACK);
+
+ ///
+ /// Send Get FW SKU Request to ME
+ ///
+ Status = HeciSendwACK (
+ (UINT32 *) &MsgGenGetFwCapsSku,
+ Length,
+ &RespLength,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_CORE_MESSAGE_ADDR
+ );
+
+ if (!EFI_ERROR(Status) &&
+ ((MsgGenGetFwCapsSku.Response.MKHIHeader.Fields.Command) == FWCAPS_GET_RULE_CMD) &&
+ ((MsgGenGetFwCapsSku.Response.MKHIHeader.Fields.IsResponse) == 1) &&
+ (MsgGenGetFwCapsSku.Response.MKHIHeader.Fields.Result == 0)
+ ) {
+ *FwFeaturesState = MsgGenGetFwCapsSku.Response.Data.FWCapSku;
+ return EFI_SUCCESS;
+ }
+
+ return Status;
+}
+
+/**
+ Install MbpData protocol.
+
+ @param[in] None
+
+ @retval None
+**/
+VOID
+InstallMbpDataProtocol (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ UINT32 MeMode;
+ UINT32 MeStatus;
+ MEFWCAPS_SKU FwCapsSku;
+ PLATFORM_TYPE_RULE_DATA RuleData;
+
+ ZeroMem (&mMbpData, sizeof (DXE_MBP_DATA_PROTOCOL));
+
+ HeciGetMeMode (&MeMode);
+
+ mMbpData.Revision = DXE_MBP_DATA_PROTOCOL_REVISION_2;
+
+ PERF_START_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc (), 0x8010);
+ Status = PrepareMeBiosPayload (&mMbpData.MeBiosPayload);
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc (), 0x8011);
+
+ if (!EFI_ERROR (Status)) {
+ HeciGetMeStatus (&MeStatus);
+ HeciGetMeMode (&MeMode);
+
+ if (mMbpData.MeBiosPayload.FwCapsSku.Available == 0) {
+ if ((MeMode == ME_MODE_NORMAL) &&
+ (
+ (ME_STATUS_ME_STATE_ONLY (MeStatus) == ME_IN_RECOVERY_MODE) ||
+ (ME_STATUS_ME_STATE_ONLY (MeStatus) == ME_READY)
+ )
+ ) {
+ Status = MbpGetFwCapsSkuThroughHeci (&FwCapsSku);
+ if (!EFI_ERROR (Status)) {
+ mMbpData.MeBiosPayload.FwCapsSku.FwCapabilities.Data = FwCapsSku.Data;
+ mMbpData.MeBiosPayload.FwCapsSku.Available = TRUE;
+ }
+ }
+ }
+
+ if (mMbpData.MeBiosPayload.FwPlatType.Available == 0) {
+ if ((MeMode == ME_MODE_NORMAL) &&
+ (
+ (ME_STATUS_ME_STATE_ONLY (MeStatus) == ME_IN_RECOVERY_MODE) ||
+ (ME_STATUS_ME_STATE_ONLY (MeStatus) == ME_READY)
+ )
+ ) {
+ Status = MbpGetPlatformTypeThroughHeci (&RuleData);
+ if (!EFI_ERROR (Status)) {
+ mMbpData.MeBiosPayload.FwPlatType.RuleData.Data = RuleData.Data;
+ mMbpData.MeBiosPayload.FwPlatType.Available = TRUE;
+ }
+ }
+ }
+
+ if (mMbpData.MeBiosPayload.FwVersionName.MajorVersion == 10) {
+ //
+ // For ME 10 get the FW features state mask
+ //
+ if (mMbpData.MeBiosPayload.FwFeaturesState.Available == 0) {
+ if ((MeMode == ME_MODE_NORMAL) &&
+ (
+ (ME_STATUS_ME_STATE_ONLY (MeStatus) == ME_IN_RECOVERY_MODE) ||
+ (ME_STATUS_ME_STATE_ONLY (MeStatus) == ME_READY)
+ )
+ ) {
+ Status = MbpGetFwFeaturesStateThroughHeci ((MEFWCAPS_SKU*)&RuleData.Data);
+ if (!EFI_ERROR (Status)) {
+ mMbpData.MeBiosPayload.FwFeaturesState.FwFeatures.Data = RuleData.Data;
+ mMbpData.MeBiosPayload.FwFeaturesState.Available = TRUE;
+ }
+ }
+ }
+ }
+
+#ifdef EFI_DEBUG
+ //
+ // Dump the Mbp data
+ //
+ DxeMbpDebugDump (&mMbpData);
+#endif
+
+ ///
+ /// Install the MBP protocol
+ ///
+ mMbpData.Handle = NULL;
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &mMbpData.Handle,
+ &gMeBiosPayloadDataProtocolGuid,
+ &mMbpData,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "MBP data protocol install failed, Status is %r \n", Status));
+ }
+ }
+}
+
+/**
+ HECI driver entry point used to initialize support for the HECI device.
+
+ @param[in] ImageHandle Standard entry point parameter.
+ @param[in] SystemTable Standard entry point parameter.
+
+ @retval EFI_SUCCESS Always return EFI_SUCCESS
+**/
+EFI_STATUS
+InitializeHECI (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ EFI_EVENT ReadyToBootEvent;
+ VOID *Registration;
+ BOOLEAN HeciInitializeError;
+ UINT32 MeStatus;
+ UINT32 MeMode;
+ MEFWCAPS_SKU FwCapsSku;
+ PLATFORM_TYPE_RULE_DATA RuleData;
+ DXE_MBP_DATA_PROTOCOL *MbpData;
+
+ INITIALIZE_SCRIPT (ImageHandle, SystemTable);
+
+ mHeciDrv = ImageHandle;
+ HeciInitializeError = FALSE;
+ mHeciContext = AllocateZeroPool (sizeof (HECI_INSTANCE));
+ ///
+ /// Initialize HECI protocol pointers
+ ///
+ if (mHeciContext != NULL) {
+ mHeciContext->HeciCtlr.ResetHeci = ResetHeciInterface;
+ mHeciContext->HeciCtlr.SendwACK = HeciSendwACK;
+ mHeciContext->HeciCtlr.ReadMsg = HeciReceive;
+ mHeciContext->HeciCtlr.SendMsg = HeciSend;
+ mHeciContext->HeciCtlr.InitHeci = HeciInitialize;
+ mHeciContext->HeciCtlr.ReInitHeci = HeciReInitialize;
+ mHeciContext->HeciCtlr.MeResetWait = MeResetWait;
+ mHeciContext->HeciCtlr.GetMeStatus = HeciGetMeStatus;
+ mHeciContext->HeciCtlr.GetMeMode = HeciGetMeMode;
+ }
+ ///
+ /// Initialize the HECI device
+ ///
+ Status = InitializeHeciPrivate ();
+ if ((EFI_ERROR (Status)) || (mHeciContext == NULL)) {
+ HeciInitializeError = TRUE;
+ }
+ ///
+ /// Install the MBP information
+ ///
+ InstallMbpDataProtocol ();
+
+ if (HeciInitializeError) {
+ ///
+ /// Don't install on ERR
+ ///
+ if (Status != EFI_NOT_READY) {
+ DEBUG ((EFI_D_ERROR, "HECI not initialized - Removing devices from PCI space!\n"));
+ DisableAllMEDevices ();
+ ///
+ /// Store the current value of DEVEN for S3 resume path
+ ///
+ }
+ DeviceStatusSave ();
+ return EFI_SUCCESS;
+ }
+ ///
+ /// Install the HECI interface
+ ///
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &mHeciContext->Handle,
+ &gEfiHeciProtocolGuid,
+ &mHeciContext->HeciCtlr,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ return EFI_SUCCESS;
+ }
+
+ HeciGetMeStatus (&MeStatus);
+ HeciGetMeMode (&MeMode);
+
+ Status = gBS->LocateProtocol (
+ &gMeBiosPayloadDataProtocolGuid,
+ NULL,
+ (VOID **) &MbpData
+ );
+ if (!EFI_ERROR (Status)) {
+ if (MbpData->MeBiosPayload.FwCapsSku.Available == 0) {
+ if ((MeMode == ME_MODE_NORMAL) &&
+ (
+ (ME_STATUS_ME_STATE_ONLY (MeStatus) == ME_IN_RECOVERY_MODE) ||
+ (ME_STATUS_ME_STATE_ONLY (MeStatus) == ME_READY)
+ )
+ ) {
+ Status = HeciGetFwCapsSku (&FwCapsSku);
+ if (!EFI_ERROR (Status)) {
+ MbpData->MeBiosPayload.FwCapsSku.FwCapabilities.Data = FwCapsSku.Data;
+ }
+ }
+ }
+
+ if (MbpData->MeBiosPayload.FwPlatType.Available == 0) {
+ if ((MeMode == ME_MODE_NORMAL) &&
+ (
+ (ME_STATUS_ME_STATE_ONLY (MeStatus) == ME_IN_RECOVERY_MODE) ||
+ (ME_STATUS_ME_STATE_ONLY (MeStatus) == ME_READY)
+ )
+ ) {
+ Status = HeciGetPlatformType (&RuleData);
+ if (!EFI_ERROR (Status)) {
+ MbpData->MeBiosPayload.FwPlatType.RuleData.Data = RuleData.Data;
+ }
+ }
+ }
+ ///
+ /// Dxe Mbp data is gone after ExitPmAuth, so we keep MeFwImageType for the inspection after ExitPmAuth
+ ///
+ mHeciContext->MeFwImageType = (UINT8) MbpData->MeBiosPayload.FwPlatType.RuleData.Fields.IntelMeFwImageType;
+ }
+
+
+ ///
+ /// Hide Me relevant Devices
+ ///
+ Status = MeDeviceConfigure ();
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Initialize the Me Reference Code Information
+ ///
+ mHeciContext->MeRcInfo.Revision = ME_RC_INFO_PROTOCOL_REVISION_1;
+ mHeciContext->MeRcInfo.RCVersion = ME_RC_VERSION;
+
+ ///
+ /// Install the Me Reference Code Information
+ ///
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &mHeciContext->Handle,
+ &gEfiMeRcInfoProtocolGuid,
+ &mHeciContext->MeRcInfo,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ return EFI_SUCCESS;
+ }
+
+ ///
+ /// Create an ExitPmAuth protocol call back event.
+ ///
+ EfiCreateProtocolNotifyEvent (
+ &gExitPmAuthProtocolGuid,
+ EFI_TPL_CALLBACK,
+ MeScriptSaveEvent,
+ NULL,
+ &Registration
+ );
+
+ ///
+ /// Create a Ready to Boot event.
+ ///
+ Status = EfiCreateEventReadyToBootEx (
+ EFI_TPL_CALLBACK,
+ MeReadyToBootEvent,
+ (VOID *) &ImageHandle,
+ &ReadyToBootEvent
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ return Status;
+}
diff --git a/ReferenceCode/ME/Heci/Dxe/Hecidrv.dxs b/ReferenceCode/ME/Heci/Dxe/Hecidrv.dxs
new file mode 100644
index 0000000..647c8e0
--- /dev/null
+++ b/ReferenceCode/ME/Heci/Dxe/Hecidrv.dxs
@@ -0,0 +1,43 @@
+/** @file
+ Dependency expression source file.
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "DxeDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+#include EFI_PROTOCOL_DEFINITION (CpuIo)
+#include EFI_PROTOCOL_DEFINITION (PciRootBridgeIo)
+#endif
+
+DEPENDENCY_START
+ EFI_CPU_IO_PROTOCOL_GUID AND
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GUID
+DEPENDENCY_END
+
diff --git a/ReferenceCode/ME/Heci/Dxe/Hecidrv.h b/ReferenceCode/ME/Heci/Dxe/Hecidrv.h
new file mode 100644
index 0000000..d3cea85
--- /dev/null
+++ b/ReferenceCode/ME/Heci/Dxe/Hecidrv.h
@@ -0,0 +1,70 @@
+/** @file
+ Definitions for HECI driver
+
+@copyright
+ Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _HECI_DRV_H
+#define _HECI_DRV_H
+
+#include "EdkIIGlueDxe.h"
+#include "MeAccess.h"
+#include "HeciRegs.h"
+#include "Pci22.h"
+#include "RcFviDxeLib.h"
+
+#include EFI_PROTOCOL_CONSUMER (PciRootBridgeIo)
+
+#define HECI_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('H', 'e', 'c', 'i')
+#define HECI_ROUND_UP_BUFFER_LENGTH(Length) ((UINT32) ((((Length) + 3) / 4) * 4))
+
+//
+// Driver Produced Protocol Prototypes
+//
+#include EFI_PROTOCOL_PRODUCER (Heci)
+#include EFI_PROTOCOL_PRODUCER (MeRcInfo)
+
+//
+// Driver Consumed Protocol Prototypes
+//
+#include EFI_PROTOCOL_CONSUMER (MebxProtocol)
+
+extern FVI_ELEMENT_AND_FUNCTION mMeFviElementsData[];
+extern FVI_DATA_HUB_CALLBACK_CONTEXT mMeFviVersionData;
+extern UINTN mMeFviElements;
+
+typedef union {
+ UINT32 Data32;
+ UINT16 Data16[2];
+ UINT8 Data8[4];
+} DATA32_UNION;
+
+///
+/// HECI private data structure
+///
+typedef struct {
+ UINTN Signature;
+ EFI_HANDLE Handle;
+ UINT64 HeciMBAR;
+ UINT16 DeviceInfo;
+ UINT32 RevisionInfo;
+ EFI_HECI_PROTOCOL HeciCtlr;
+ VOLATILE UINT32 *HpetTimer;
+ EFI_ME_RC_INFO_PROTOCOL MeRcInfo;
+ UINT8 MeFwImageType;
+} HECI_INSTANCE;
+#endif
diff --git a/ReferenceCode/ME/Heci/Dxe/Hecidrv.inf b/ReferenceCode/ME/Heci/Dxe/Hecidrv.inf
new file mode 100644
index 0000000..d82403e
--- /dev/null
+++ b/ReferenceCode/ME/Heci/Dxe/Hecidrv.inf
@@ -0,0 +1,99 @@
+## @file
+# Component description file for Heci DXE driver
+#
+#@copyright
+# Copyright (c) 2007 - 2013 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = Hecidrv
+FILE_GUID = 55E76644-78A5-4a82-A900-7126A5798892
+COMPONENT_TYPE = BS_DRIVER
+
+[sources.common]
+ HeciDrv.c
+ Hecidrv.h
+ HeciCore.c
+ HeciCore.h
+ HeciHpet.c
+ HeciHpet.h
+ MeFvi.c
+
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueDxeDriverEntryPoint.c
+
+[includes.common]
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/Dxe
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/Include
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Heci/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[libraries.common]
+ MeGuidLib
+ MeProtocolLib
+ MeLib
+ MeChipsetLib
+ IntelPchProtocolLib
+ $(PROJECT_PCH_FAMILY)ProtocolLib
+ RcFviDxeLib
+ EfiScriptLib
+ EfiProtocolLib
+ EdkProtocolLib
+ EdkFrameworkProtocolLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueDxeReportStatusCodeLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiLib
+ EdkIIGlueBasePciLibPciExpress
+ EdkIIGlueBasePciExpressLib
+ EdkIIGlueDxeServicesTableLib
+ EdkIIGlueBasePrintLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT=_ModuleEntryPoint
+ DPX_SOURCE=Hecidrv.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=InitializeHECI
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_LIB__ \
+ -D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+# Uncomment the following line if RapidStart is supported
+# C_FLAGS = $(C_FLAGS) -DRAPID_START_FLAG
diff --git a/ReferenceCode/ME/Heci/Dxe/MeFvi.c b/ReferenceCode/ME/Heci/Dxe/MeFvi.c
new file mode 100644
index 0000000..f41b616
--- /dev/null
+++ b/ReferenceCode/ME/Heci/Dxe/MeFvi.c
@@ -0,0 +1,49 @@
+/** @file
+ ME Firmware Version Info implementation.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "Hecidrv.h"
+
+FVI_ELEMENT_AND_FUNCTION mMeFviElementsData[] = {
+ {
+ DEFAULT_FVI_ELEMENT_DATA(ME),
+ NULL
+ },
+ {
+ DEFAULT_FVI_ELEMENT_DATA(MEBX),
+ NULL
+ },
+ {
+ {
+ 1,
+ 3,
+ MEFW_VERSION,
+ MEFW_FVI_STRING,
+ MEFW_1_5M_STRING,
+ },
+ NULL
+ }
+};
+
+FVI_DATA_HUB_CALLBACK_CONTEXT mMeFviVersionData = {
+ MISC_SUBCLASS_FVI_HEADER_ENTRY(ME),
+ mMeFviElementsData,
+};
+
+UINTN mMeFviElements = sizeof (mMeFviElementsData) / sizeof (FVI_ELEMENT_AND_FUNCTION);
diff --git a/ReferenceCode/ME/Heci/Include/HeciInclude.cif b/ReferenceCode/ME/Heci/Include/HeciInclude.cif
new file mode 100644
index 0000000..4379006
--- /dev/null
+++ b/ReferenceCode/ME/Heci/Include/HeciInclude.cif
@@ -0,0 +1,9 @@
+<component>
+ name = "HeciInclude"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\Heci\Include\"
+ RefName = "HeciInclude"
+[files]
+"HeciInclude.sdl"
+"HeciRegs.h"
+<endComponent>
diff --git a/ReferenceCode/ME/Heci/Include/HeciInclude.sdl b/ReferenceCode/ME/Heci/Include/HeciInclude.sdl
new file mode 100644
index 0000000..9f9d6a7
--- /dev/null
+++ b/ReferenceCode/ME/Heci/Include/HeciInclude.sdl
@@ -0,0 +1,9 @@
+PATH
+ Name = "HeciInclude_DIR"
+End
+
+ELINK
+ Name = "/I$(HeciInclude_DIR)"
+ Parent = "ME_INCLUDES"
+ InvokeOrder = AfterParent
+End \ No newline at end of file
diff --git a/ReferenceCode/ME/Heci/Include/HeciRegs.h b/ReferenceCode/ME/Heci/Include/HeciRegs.h
new file mode 100644
index 0000000..5bc0a09
--- /dev/null
+++ b/ReferenceCode/ME/Heci/Include/HeciRegs.h
@@ -0,0 +1,275 @@
+/** @file
+ Register Definitions for HECI
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _HECI_REGS_H
+#define _HECI_REGS_H
+
+#define HECI_BUS ME_BUS
+#define HECI_DEV ME_DEVICE_NUMBER
+#define HECI_FUN HECI_FUNCTION_NUMBER
+#define HECI_PCI_ADDR (HECI_BUS << 24) | (HECI_DEV << 16) | (HECI_FUN << 8)
+#define REVID_MSK 0x000000FF
+
+#define BRNGUP_HMRFPO_DISABLE_CMD_MASK 0x0F
+#define BRNGUP_HMRFPO_DISABLE_CMD 0x30
+#define BRNGUP_HMRFPO_DISABLE_OVR_MASK 0xF0000000
+#define BRNGUP_HMRFPO_DISABLE_OVR_RSP 0x30000000
+
+//
+// HECI PCI register definition
+//
+#define R_VENDORID 0x00
+#define R_DEVICEID 0x02
+#define R_COMMAND 0x04
+#define B_BME 0x04
+#define B_MSE 0x02
+#define R_REVID 0x08
+#define R_HECIMBAR 0x10
+#define R_FWSTATE 0x40
+#define R_GEN_STS 0x4C
+#define R_HIDM 0xA0
+
+//
+// HECIMBAR register definition
+//
+#define H_CB_WW 0x00
+#define H_CSR 0x04
+#define ME_CB_RW 0x08
+#define ME_CSR_HA 0x0C
+
+///
+/// PCH related registers address
+///
+#define PCH_ACPI_TIMER_MAX_VALUE 0x1000000 ///< The timer is 24 bit overflow
+//
+// HPET Information
+//
+#define HPET_ADDRESS_0 0xFED00000
+#define HPET_ADDRESS_1 0xFED01000
+#define HPET_ADDRESS_2 0xFED02000
+#define HPET_ADDRESS_3 0xFED03000
+//
+// HPET Registers will be used as DWORD index
+//
+#define HPET_CAPS_REG_LOW 0x00 / 4
+#define HPET_CAPS_REG_HIGH 0x04 / 4
+#define HPET_GEN_CONFIG_LOW 0x10 / 4
+#define HPET_GEN_CONFIG_HIGH 0x14 / 4
+#define HPET_INT_STATUS_LOW 0x20 / 4
+#define HPET_INT_STATUS_HIGH 0x24 / 4
+#define HPET_MAIN_COUNTER_LOW 0xF0 / 4
+#define HPET_MAIN_COUNTER_HIGH 0xF4 / 4
+
+#define HPET_START 0x01
+#define HPET_TICKS_PER_MICRO 14 ///< 70ns tick so 14.2 ticks per microsecond ish
+//
+// PEI Timeout values
+//
+#define PEI_HECI_WAIT_DELAY 50000 ///< 50ms timeout for IO delay
+#define PEI_HECI_INIT_TIMEOUT 10000000 ///< 10 sec timeout in microseconds
+#define PEI_HECI_READ_TIMEOUT 10000000 ///< 10sec timeout in microseconds
+#define PEI_HECI_SEND_TIMEOUT 10000000 ///< 10sec timeout in microseconds
+//
+// DXE Timeout values based on HPET
+//
+#define HECI_WAIT_DELAY 1000 ///< 1ms timeout for IO delay
+#define HECI_INIT_TIMEOUT 15000000 ///< 15sec timeout in microseconds
+#define HECI_READ_TIMEOUT 5000000 ///< 5sec timeout in microseconds
+#define HECI_SEND_TIMEOUT 5000000 ///< 5sec timeout in microseconds
+#define HECI_MAX_RETRY 3 ///< Value based off HECI HPS
+#define HECI_MSG_DELAY 2000000 ///< show warning msg and stay for 2 seconds.
+#define HECI_MBP_RDY_TIMEOUT 50000 ///< 50ms timeout
+#define HECI_MBP_CLR_TIMEOUT 1000000 ///< 1s timeout
+#define HECI_MBP_READ_MAX_RETRIES 2 ///< MBP read will be retried twice
+#pragma pack(1)
+//
+// REGISTER EQUATES
+//
+
+///
+/// ME_CSR_HA - ME Control Status Host Access
+///
+typedef union {
+ UINT32 ul;
+ struct {
+ UINT32 ME_IE_HRA : 1; ///< 0 - ME Interrupt Enable (Host Read Access)
+ UINT32 ME_IS_HRA : 1; ///< 1 - ME Interrupt Status (Host Read Access)
+ UINT32 ME_IG_HRA : 1; ///< 2 - ME Interrupt Generate (Host Read Access)
+ UINT32 ME_RDY_HRA : 1; ///< 3 - ME Ready (Host Read Access)
+ UINT32 ME_RST_HRA : 1; ///< 4 - ME Reset (Host Read Access)
+ UINT32 Reserved : 3; ///< 7:5
+ UINT32 ME_CBRP_HRA : 8; ///< 15:8 - ME CB Read Pointer (Host Read Access)
+ UINT32 ME_CBWP_HRA : 8; ///< 23:16 - ME CB Write Pointer (Host Read Access)
+ UINT32 ME_CBD_HRA : 8; ///< 31:24 - ME Circular Buffer Depth (Host Read Access)
+ } r;
+} HECI_ME_CONTROL_REGISTER;
+
+///
+/// H_CSR - Host Control Status
+///
+typedef union {
+ UINT32 ul;
+ struct {
+ UINT32 H_IE : 1; ///< 0 - Host Interrupt Enable ME
+ UINT32 H_IS : 1; ///< 1 - Host Interrupt Status ME
+ UINT32 H_IG : 1; ///< 2 - Host Interrupt Generate
+ UINT32 H_RDY : 1; ///< 3 - Host Ready
+ UINT32 H_RST : 1; ///< 4 - Host Reset
+ UINT32 Reserved : 3; ///< 7:5
+ UINT32 H_CBRP : 8; ///< 15:8 - Host CB Read Pointer
+ UINT32 H_CBWP : 8; ///< 23:16 - Host CB Write Pointer
+ UINT32 H_CBD : 8; ///< 31:24 - Host Circular Buffer Depth
+ } r;
+} HECI_HOST_CONTROL_REGISTER;
+
+///
+/// FWS
+///
+typedef union {
+ UINT32 ul;
+ struct {
+ UINT32 CurrentState : 4; ///< 0:3 - Current State
+ UINT32 ManufacturingMode : 1; ///< 4 Manufacturing Mode
+ UINT32 FptBad : 1; ///< 5 FPT(Flash Partition Table ) Bad
+ UINT32 MeOperationState : 3; ///< 6:8 - ME Operation State
+ UINT32 FwInitComplete : 1; ///< 9
+ UINT32 FtBupLdFlr : 1; ///< 10 - This bit is set when firmware is not able to load BRINGUP from the fault tolerant (FT) code.
+ UINT32 FwUpdateInprogress : 1; ///< 11
+ UINT32 ErrorCode : 4; ///< 12:15 - Error Code
+ UINT32 MeOperationMode : 4; ///< 16:19 - Management Engine Current Operation Mode
+ UINT32 Reserved2 : 4; ///< 20:23
+ UINT32 MeBootOptionsPresent : 1; ///< 24 - If this bit is set, an Boot Options is present
+ UINT32 AckData : 3; ///< 25:27 Ack Data
+ UINT32 BiosMessageAck : 4; ///< 28:31 BIOS Message Ack
+ } r;
+} HECI_FWS_REGISTER;
+
+///
+/// MISC_SHDW
+///
+typedef union {
+ UINT32 ul;
+ struct {
+ UINT32 MUSZ : 6; ///< 0:5 - ME UMA Size
+ UINT32 Reserved : 8; ///< 6:13 - Reserved
+ UINT32 Reserved2 : 2; ///< 14:15 - Reserved
+ UINT32 MUSZV : 1; ///< 16:16 - ME UMA Size Valid
+ UINT32 Reserved3 : 8; ///< 17:24 - Reserved
+ UINT32 Reserved4 : 6; ///< 25:30 - Reserved
+ UINT32 MSVLD : 1; ///< 31:31 - Miscellaneous Shadow Valid
+ } r;
+} HECI_MISC_SHDW_REGISTER;
+
+///
+/// GS_SHDW
+///
+typedef union {
+ UINT32 ul;
+ struct {
+ UINT32 BistInProg : 1; ///< 0 - BIST in progress
+ UINT32 IccProgSts : 2; ///< 1:2 - ICC Prog STS
+ UINT32 InvokeMEBx : 1; ///< 3 - Invoke MEBX
+ UINT32 CpuReplacedSts : 1; ///< 4 - CPU Replaced STS
+ UINT32 MbpRdy : 1; ///< 5 - MBP RDY
+ UINT32 MfsFailure : 1; ///< 6 - MFS Failure
+ UINT32 WarmRstReqForDF : 1; ///< 7 - Warm Reset Required for Dynamic Fusing
+ UINT32 CpuReplacedValid : 1; ///< 8 - CPU Replaced Valid
+ UINT32 Reserved : 2; ///< 9:10 - Reserved
+ UINT32 FwUpdIpu : 1; ///< 11 - FW UPD IPU Needed
+ UINT32 Reserved2 : 1; ///< 12 - Reserved
+ UINT32 MbpCleared : 1; ///< 13 - MBP Cleared
+ UINT32 Reserved3 : 2; ///< 14:15 - Reserved
+ UINT32 ExtStatCode1 : 8; ///< 16:23 - EXT Status Code 1
+ UINT32 ExtStatCode2 : 4; ///< 24:27 - EXT Status Code 2
+ UINT32 InfPhaseCode : 4; ///< 31:28 - Infra. Phase code
+ } r;
+} HECI_GS_SHDW_REGISTER;
+
+///
+/// HECI_GS2
+///
+typedef union {
+ UINT32 ul;
+ struct {
+ UINT32 MbpGiveUp : 1; ///< 0 - MBP Give Up
+ UINT32 Reserved :31; ///< 1-31 - Reserved
+ } r;
+} HECI_GS2_REGISTER;
+
+//
+// ME Current State Values
+//
+#define ME_STATE_RESET 0x00
+#define ME_STATE_INIT 0x01
+#define ME_STATE_RECOVERY 0x02
+#define ME_STATE_NORMAL 0x05
+#define ME_STATE_DISABLE_WAIT 0x06
+#define ME_STATE_TRANSITION 0x07
+#define ME_STATE_INVALID_CPU 0x08
+
+//
+// DRAM Initiailization Response Codes.
+//
+#define CBM_DIR_NON_PCR 0x01
+#define CBM_DIR_PCR 0x02
+#define CBM_DIR_GLOBAL_RESET 0x06
+#define CBM_DIR_CONTINUE_POST 0x07
+//
+// ME Firmware FwInitComplete
+//
+#define ME_FIRMWARE_COMPLETED 0x01
+#define ME_FIRMWARE_INCOMPLETED 0x00
+
+//
+// ME Boot Options Present
+//
+#define ME_BOOT_OPTIONS_PRESENT 0x01
+#define ME_BOOT_OPTIONS_NOT_PRESENT 0x00
+
+//
+// ME Operation State Values
+//
+#define ME_OPERATION_STATE_PREBOOT 0x00
+#define ME_OPERATION_STATE_M0_UMA 0x01
+#define ME_OPERATION_STATE_M3 0x04
+#define ME_OPERATION_STATE_M0 0x05
+#define ME_OPERATION_STATE_BRINGUP 0x06
+#define ME_OPERATION_STATE_M0_ERROR 0x07
+
+//
+// ME Error Code Values
+//
+#define ME_ERROR_CODE_NO_ERROR 0x00
+#define ME_ERROR_CODE_UNKNOWN 0x01
+#define ME_ERROR_CODE_IMAGE_FAILURE 0x03
+#define ME_ERROR_CODE_DEBUG_FAILURE 0x04
+
+//
+// Management Engine Current Operation Mode
+//
+#define ME_OPERATION_MODE_NORMAL 0x00
+
+#define ME_OPERATION_MODE_DEBUG 0x02
+#define ME_OPERATION_MODE_SOFT_TEMP_DISABLE 0x03
+#define ME_OPERATION_MODE_SECOVR_JMPR 0x04
+#define ME_OPERATION_MODE_SECOVR_HECI_MSG 0x05
+#pragma pack()
+
+#endif // HECI_REGS_H
diff --git a/ReferenceCode/ME/Heci/MeHeci.cif b/ReferenceCode/ME/Heci/MeHeci.cif
new file mode 100644
index 0000000..73fdc6d
--- /dev/null
+++ b/ReferenceCode/ME/Heci/MeHeci.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "MeHeci"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\Heci\"
+ RefName = "MeHeci"
+[files]
+"MeHeci.sdl"
+[parts]
+"HeciDxe"
+"HeciPei"
+"HeciInclude"
+"HeciSmm"
+<endComponent>
diff --git a/ReferenceCode/ME/Heci/MeHeci.sdl b/ReferenceCode/ME/Heci/MeHeci.sdl
new file mode 100644
index 0000000..8755bf8
--- /dev/null
+++ b/ReferenceCode/ME/Heci/MeHeci.sdl
@@ -0,0 +1,19 @@
+TOKEN
+ Name = "MeHeci_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable MeHeci support in Project"
+End
+
+PATH
+ Name = "MeHeci_DIR"
+ Help = "Me Heci Driver files source directory"
+End
+ELINK
+ Name = "/I$(MeHeci_DIR)\Include"
+ Parent = "ME_INCLUDES"
+ InvokeOrder = AfterParent
+End \ No newline at end of file
diff --git a/ReferenceCode/ME/Heci/Pei/HeciCore.c b/ReferenceCode/ME/Heci/Pei/HeciCore.c
new file mode 100644
index 0000000..e248118
--- /dev/null
+++ b/ReferenceCode/ME/Heci/Pei/HeciCore.c
@@ -0,0 +1,1247 @@
+/** @file
+ Heci driver core. For PEI Phase, determines the HECI device and initializes it.
+
+@copyright
+ Copyright (c) 2008 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#include "HeciInit.h"
+/**
+ Delay for at least the request number of microseconds
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] Microseconds Number of microseconds to delay.
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+Stall (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN UINTN Microseconds
+ )
+{
+ UINTN Ticks;
+ UINTN Counts;
+ UINT32 CurrentTick;
+ UINT32 OriginalTick;
+ UINT32 RemainingTick;
+ UINT32 AcpiPm1TimerBar;
+
+ if (Microseconds == 0) {
+ return EFI_SUCCESS;
+ }
+
+ AcpiPm1TimerBar = (
+ PciRead32 (PCI_LIB_ADDRESS (DEFAULT_PCI_BUS_NUMBER_PCH, PCI_DEVICE_NUMBER_PCH_LPC, 0, R_PCH_LPC_ACPI_BASE)) & B_PCH_LPC_ACPI_BASE_BAR
+ ) +
+ R_PCH_ACPI_PM1_TMR;
+
+ OriginalTick = IoRead32 ((UINTN) (UINT64) AcpiPm1TimerBar);
+ OriginalTick &= (PCH_ACPI_TIMER_MAX_VALUE - 1);
+ CurrentTick = OriginalTick;
+
+ ///
+ /// The timer frequency is 3.579545MHz, so 1 ms corresponds to 3.58 clocks
+ ///
+ Ticks = Microseconds * 358 / 100 + OriginalTick + 1;
+
+ ///
+ /// The loops needed for timer overflow
+ ///
+ Counts = Ticks / PCH_ACPI_TIMER_MAX_VALUE;
+
+ ///
+ /// Remaining clocks within one loop
+ ///
+ RemainingTick = Ticks % PCH_ACPI_TIMER_MAX_VALUE;
+
+ ///
+ /// Do not intend to use TMROF_STS bit of register PM1_STS, because this add extra
+ /// one I/O operation, and may generate SMI
+ ///
+ while (Counts != 0) {
+ CurrentTick = IoRead32 ((UINTN) (UINT64) AcpiPm1TimerBar);
+ CurrentTick &= (PCH_ACPI_TIMER_MAX_VALUE - 1);
+ if (CurrentTick <= OriginalTick) {
+ Counts--;
+ }
+
+ OriginalTick = CurrentTick;
+ }
+
+ while ((RemainingTick > CurrentTick) && (OriginalTick <= CurrentTick)) {
+ OriginalTick = CurrentTick;
+ CurrentTick = IoRead32 ((UINTN) (UINT64) AcpiPm1TimerBar);
+ CurrentTick &= (PCH_ACPI_TIMER_MAX_VALUE - 1);
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Enable Hpet function.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+
+ @retval UINT32 Return the High Precision Event Timer base address
+**/
+VOLATILE
+UINT32 *
+EnableHpet (
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ VOLATILE UINT32 *HpetConfigReg;
+ VOLATILE UINT32 *HpetTimer;
+ UINT32 Temp32;
+ HpetConfigReg = NULL;
+ ///
+ /// Get the High Precision Event Timer base address and enable the memory range
+ ///
+ HpetConfigReg = (UINT32 *) (PCH_RCRB_BASE + R_PCH_RCRB_HPTC);
+ switch (*HpetConfigReg & B_PCH_RCRB_HPTC_AS) {
+ case 0:
+ HpetTimer = (VOID *) (HPET_ADDRESS_0);
+ break;
+
+ case 1:
+ HpetTimer = (VOID *) (HPET_ADDRESS_1);
+ break;
+
+ case 2:
+ HpetTimer = (VOID *) (HPET_ADDRESS_2);
+ break;
+
+ case 3:
+ HpetTimer = (VOID *) (HPET_ADDRESS_3);
+ break;
+
+ default:
+ HpetTimer = NULL;
+ break;
+ }
+
+ *HpetConfigReg = *HpetConfigReg | B_PCH_RCRB_HPTC_AE;
+ ///
+ /// Read back from RCBA area.
+ ///
+ Temp32 = *HpetConfigReg;
+
+ ///
+ /// Start the timer so it is up and running
+ ///
+ HpetTimer[HPET_GEN_CONFIG_LOW] = HPET_START;
+
+ return HpetTimer;
+}
+
+/**
+ This function provides a standard way to verify the HECI cmd and MBAR regs
+ in its PCI cfg space are setup properly and that the local mHeciContext
+ variable matches this info.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] This The address of HECI PPI
+ @param[in][out] HeciMemBar HECI Memory BAR
+
+ @retval None
+**/
+VOID
+CheckAndFixHeciForAccess (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_HECI_PPI *This,
+ IN OUT UINT32 *HeciMemBar
+ )
+{
+ UINT32 Buffer;
+
+ ///
+ /// Check if HECI_MBAR has changed
+ ///
+ Buffer = HeciPciRead32 (R_HECIMBAR) & 0xFFFFFFF0;
+ if (*HeciMemBar != Buffer) {
+ ///
+ /// If it did change update the mHeciContext variable so we use the proper address for acceses
+ ///
+ *HeciMemBar = Buffer;
+ }
+ ///
+ /// Enable HECI BME and MSE
+ ///
+ HeciPciOr8 (
+ PCI_COMMAND_OFFSET,
+ EFI_PCI_COMMAND_MEMORY_SPACE | EFI_PCI_COMMAND_BUS_MASTER
+ );
+ return ;
+}
+
+#ifdef EFI_DEBUG
+
+/**
+ For EFI debug used, will show the message of buffer to terminal.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] Message The address of message.
+ @param[in] Length The length of message.
+**/
+VOID
+ShowBuffer (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN UINT8 *Message,
+ IN UINT32 Length
+ )
+{
+ UINT32 LineBreak;
+ UINT32 Index;
+ LineBreak = 0;
+ Index = 0;
+
+ while (Length-- > 0) {
+ if (LineBreak == 0) {
+ DEBUG ((EFI_D_ERROR, "%02x: ", (Index & 0xF0)));
+ }
+
+ DEBUG ((EFI_D_ERROR, "%02x ", Message[Index++]));
+ LineBreak++;
+ if (LineBreak == 16) {
+ DEBUG ((EFI_D_ERROR, "\n"));
+ LineBreak = 0;
+ }
+
+ if (LineBreak == 8) {
+ DEBUG ((EFI_D_ERROR, "- "));
+ }
+ }
+
+ DEBUG ((EFI_D_ERROR, "\n"));
+ return ;
+}
+#endif // End Of EFI_DEBUG
+
+/**
+ Determines if the HECI device is present and, if present, initializes it for
+ use by the BIOS.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] This The address of HECI PPI
+ @param[in][out] HeciMemBar HECI Memory BAR
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_DEVICE_ERROR No HECI device
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+ @exception EFI_UNSUPPORTED HECI MSG is unsupported
+**/
+EFI_STATUS
+EFIAPI
+InitializeHeci (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_HECI_PPI *This,
+ IN OUT UINT32 *HeciMemBar
+ )
+{
+ HECI_HOST_CONTROL_REGISTER HeciRegHCsr;
+ VOLATILE HECI_HOST_CONTROL_REGISTER *HeciRegHCsrPtr;
+ VOLATILE HECI_ME_CONTROL_REGISTER *HeciRegMeCsrHaPtr;
+ UINT32 HeciMBar;
+ UINT32 MeMode;
+
+ HeciRegHCsrPtr = NULL;
+ HeciRegMeCsrHaPtr = NULL;
+
+ ///
+ /// Check for HECI-1 PCI device availability
+ ///
+ if (HeciPciRead16 (PCI_DEVICE_ID_OFFSET) == 0xFFFF) {
+ return EFI_DEVICE_ERROR;
+ }
+ ///
+ /// Check for ME error status
+ ///
+ if ((HeciPciRead32 (R_FWSTATE) & 0xF000) != 0) {
+ ///
+ /// ME failed to start so no HECI
+ ///
+ return EFI_DEVICE_ERROR;
+ }
+ ///
+ /// HECI MSG is unsupported if ME MODE is in Security Override
+ ///
+ HeciGetMeMode (PeiServices, &MeMode);
+ if (MeMode == ME_MODE_SECOVER) {
+ return EFI_UNSUPPORTED;
+ }
+ ///
+ /// Get HECI_MBAR and see if it is programmed
+ /// to a useable value
+ ///
+ HeciMBar = HeciPciRead32 (R_HECIMBAR) & 0xFFFFFFF0;
+
+ ///
+ /// Load temporary address for HECI_MBAR if one is not assigned
+ ///
+ if (HeciMBar == 0) {
+ DEBUG ((EFI_D_ERROR, "Heci MMIO Bar not programmed in PEI phase\n"));
+ }
+
+ *HeciMemBar = HeciMBar;
+
+ ///
+ /// Enable HECI BME and MSE
+ ///
+ HeciPciOr8 (
+ PCI_COMMAND_OFFSET,
+ EFI_PCI_COMMAND_MEMORY_SPACE | EFI_PCI_COMMAND_BUS_MASTER
+ );
+
+ ///
+ /// Set HECI interrupt delivery mode.
+ /// HECI-1 using legacy/MSI interrupt
+ ///
+ HeciPciAnd8 (R_HIDM, 0xFC);
+
+ ///
+ /// 2) setup H_CSR reg as follows:
+ /// a) Make sure H_RST is clear
+ /// b) Set H_RDY
+ /// c) Set H_IG
+ ///
+ HeciRegHCsrPtr = (VOID *) (HeciMBar + H_CSR);
+ HeciRegHCsr.ul = HeciRegHCsrPtr->ul;
+ if (HeciRegHCsrPtr->r.H_RDY == 0) {
+ HeciRegHCsr.r.H_RST = 0;
+ HeciRegHCsr.r.H_RDY = 1;
+ HeciRegHCsr.r.H_IG = 1;
+ HeciRegHCsrPtr->ul = HeciRegHCsr.ul;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Waits for the ME to report that it is ready for communication over the HECI
+ interface.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] This The address of HECI PPI.
+ @param[in] HeciMemBar HECI Memory BAR.
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_TIMEOUT If 5 second timeout has expired, return fail.
+**/
+EFI_STATUS
+WaitForMEReady (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_HECI_PPI *This,
+ IN UINT32 HeciMemBar
+ )
+{
+ UINT32 TimerStart;
+ UINT32 TimerEnd;
+ VOLATILE HECI_ME_CONTROL_REGISTER *HeciRegMeCsrHaPtr;
+ VOLATILE UINT32 *HpetTimer;
+
+ HeciRegMeCsrHaPtr = (VOID *) (HeciMemBar + ME_CSR_HA);
+ ///
+ /// Wait for ME ready
+ ///
+ ///
+ /// Check for ME ready status
+ ///
+ HpetTimer = StartTimer (PeiServices, &TimerStart, &TimerEnd, PEI_HECI_INIT_TIMEOUT);
+ while (HeciRegMeCsrHaPtr->r.ME_RDY_HRA == 0) {
+ ///
+ /// If 5 second timeout has expired, return fail
+ ///
+ if (Timeout (TimerStart, TimerEnd, HpetTimer) != EFI_SUCCESS) {
+ return EFI_TIMEOUT;
+ }
+ ///
+ /// Perform IO delay
+ ///
+ Stall (PeiServices, PEI_HECI_WAIT_DELAY);
+ }
+ ///
+ /// ME ready!!!
+ ///
+ return EFI_SUCCESS;
+}
+
+/**
+ Read the HECI Message from Intel ME with size in Length into
+ buffer Message. Set Blocking to BLOCKING and code will wait
+ until one message packet is received. When set to
+ NON_BLOCKING, if the circular buffer is empty at the time, the
+ code not wait for the message packet read.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] This The address of HECI PPI.
+ @param[in] HeciMemBar HECI Memory BAR.
+ @param[in] Blocking Used to determine if the read is BLOCKING or NON_BLOCKING.
+ @param[in] MessageBody Pointer to a buffer used to receive a message.
+ @param[in][out] Length Pointer to the length of the buffer on input and the length
+ of the message on return. (in bytes)
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS One message packet read
+ @retval EFI_TIMEOUT HECI is not ready for communication
+ @retval EFI_DEVICE_ERROR Zero-length message packet read
+ @retval EFI_BUFFER_TOO_SMALL The caller's buffer was not large enough
+**/
+EFI_STATUS
+EFIAPI
+HeciReadMsg (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_HECI_PPI *This,
+ IN UINT32 Blocking,
+ IN UINT32 HeciMemBar,
+ IN UINT32 *MessageBody,
+ IN OUT UINT32 *Length
+ )
+{
+ HECI_MESSAGE_HEADER PacketHeader;
+ UINT32 CurrentLength;
+ UINT32 MessageComplete;
+ EFI_STATUS ReadError;
+ UINT32 PacketBuffer;
+ UINT32 timer_start;
+ UINT32 timer_end;
+ VOLATILE UINT32 *HpetTimer;
+ UINT32 MeMode;
+
+ CurrentLength = 0;
+ MessageComplete = 0;
+
+ HeciGetMeMode (PeiServices, &MeMode);
+ if (MeMode == ME_MODE_SECOVER) {
+ return EFI_UNSUPPORTED;
+ }
+ ///
+ /// Make sure that HECI device BAR is correct and device is enabled.
+ ///
+ /// CheckAndFixHeciForAccess (PeiServices, This);
+ ///
+ /// Make sure that HECI is ready for communication.
+ ///
+ if (WaitForMEReady (PeiServices, This, HeciMemBar) != EFI_SUCCESS) {
+ return EFI_TIMEOUT;
+ }
+ ///
+ /// Set up timer for BIOS timeout.
+ ///
+ HpetTimer = StartTimer (PeiServices, &timer_start, &timer_end, PEI_HECI_READ_TIMEOUT);
+ while ((CurrentLength < *Length) && (MessageComplete == 0)) {
+ ///
+ /// If 1 second timeout has expired, return fail as we have not yet received a full message
+ ///
+ if (Timeout (timer_start, timer_end, HpetTimer) != EFI_SUCCESS) {
+ return EFI_TIMEOUT;
+ }
+
+ PacketBuffer = *Length - CurrentLength;
+ ReadError = HeciPacketRead (
+ PeiServices,
+ Blocking,
+ HeciMemBar,
+ &PacketHeader,
+ (UINT32 *) &MessageBody[CurrentLength / 4],
+ &PacketBuffer
+ );
+
+ ///
+ /// Check for error condition on read
+ ///
+ if (EFI_ERROR (ReadError)) {
+ *Length = 0;
+ return ReadError;
+ }
+ ///
+ /// Get completion status from the packet header
+ ///
+ MessageComplete = PacketHeader.Fields.MessageComplete;
+
+ ///
+ /// Check for zero length messages
+ ///
+ if (PacketBuffer == 0) {
+ ///
+ /// If we are not in the middle of a message, and we see Message Complete,
+ /// this is a valid zero-length message.
+ ///
+ if ((CurrentLength == 0) && (MessageComplete == 1)) {
+ *Length = 0;
+ return EFI_SUCCESS;
+ } else {
+ ///
+ /// We should not expect a zero-length message packet except as described above.
+ ///
+ *Length = 0;
+ return EFI_DEVICE_ERROR;
+ }
+ }
+ ///
+ /// Track the length of what we have read so far
+ ///
+ CurrentLength += PacketBuffer;
+
+ }
+ ///
+ /// If we get here the message should be complete, if it is not
+ /// the caller's buffer was not large enough.
+ ///
+ if (MessageComplete == 0) {
+ *Length = 0;
+ return EFI_BUFFER_TOO_SMALL;
+ }
+
+ *Length = CurrentLength;
+
+ DEBUG ((EFI_D_ERROR, "HECI ReadMsg:\n"));
+#ifdef EFI_DEBUG
+ DEBUG_CODE (
+ ShowBuffer (PeiServices, (UINT8 *) MessageBody, *Length);
+ );
+#endif // End Of EFI_DEBUG
+ return EFI_SUCCESS;
+}
+
+/**
+ Function to pull one messsage packet off the HECI circular buffer.
+ Corresponds to HECI HPS (part of) section 4.2.4
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] HeciMemBar HECI Memory BAR.
+ @param[in] Blocking Used to determine if the read is BLOCKING or NON_BLOCKING.
+ @param[out] MessageHeader Pointer to a buffer for the message header.
+ @param[out] MessageData Pointer to a buffer to recieve the message in.
+ @param[in][out] Length On input is the size of the callers buffer in bytes. On
+ output this is the size of the packet in bytes.
+
+ @retval EFI_SUCCESS One message packet read.
+ @retval EFI_DEVICE_ERROR The circular buffer is overflowed.
+ @retval EFI_NO_RESPONSE The circular buffer is empty
+ @retval EFI_TIMEOUT Failed to receive a full message
+ @retval EFI_BUFFER_TOO_SMALL Message packet is larger than caller's buffer
+**/
+EFI_STATUS
+HeciPacketRead (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN UINT32 Blocking,
+ IN UINT32 HeciMemBar,
+ OUT HECI_MESSAGE_HEADER *MessageHeader,
+ OUT UINT32 *MessageData,
+ IN OUT UINT32 *Length
+ )
+{
+ BOOLEAN GotMessage;
+ UINT32 TimerStart;
+ UINT32 TimerEnd;
+ UINT32 TimerStart1;
+ UINT32 TimerEnd1;
+ UINT32 i;
+ UINT32 LengthInDwords;
+ HECI_ME_CONTROL_REGISTER HeciRegMeCsrHa;
+ VOLATILE UINT32 *HpetTimer;
+ ///
+ /// Initialize memory mapped register pointers
+ ///
+ VOLATILE HECI_HOST_CONTROL_REGISTER *HeciRegHCsrPtr;
+ VOLATILE HECI_ME_CONTROL_REGISTER *HeciRegMeCsrHaPtr;
+ VOLATILE UINT32 *HeciRegMeCbrwPtr;
+
+ HeciRegHCsrPtr = (VOID *) (HeciMemBar + H_CSR);
+ HeciRegMeCsrHaPtr = (VOID *) (HeciMemBar + ME_CSR_HA);
+ HeciRegMeCbrwPtr = (VOID *) (HeciMemBar + ME_CB_RW);
+
+ GotMessage = FALSE;
+
+ ///
+ /// clear Interrupt Status bit
+ ///
+ HeciRegHCsrPtr->r.H_IS = 1;
+
+ ///
+ /// test for circular buffer overflow
+ ///
+ HeciRegMeCsrHa.ul = HeciRegMeCsrHaPtr->ul;
+ if (OverflowCB (
+ HeciRegMeCsrHa.r.ME_CBRP_HRA,
+ HeciRegMeCsrHa.r.ME_CBWP_HRA,
+ HeciRegMeCsrHa.r.ME_CBD_HRA
+ ) != EFI_SUCCESS) {
+ ///
+ /// if we get here, the circular buffer is overflowed
+ ///
+ *Length = 0;
+ return EFI_DEVICE_ERROR;
+ }
+ ///
+ /// If NON_BLOCKING, exit if the circular buffer is empty
+ ///
+ HeciRegMeCsrHa.ul = HeciRegMeCsrHaPtr->ul;
+ if ((FilledSlots (HeciRegMeCsrHa.r.ME_CBRP_HRA, HeciRegMeCsrHa.r.ME_CBWP_HRA) == 0) && (Blocking == NON_BLOCKING)) {
+ *Length = 0;
+ return EFI_NO_RESPONSE;
+ }
+ ///
+ /// Start timeout counter
+ ///
+ HpetTimer = StartTimer (PeiServices, &TimerStart, &TimerEnd, PEI_HECI_READ_TIMEOUT);
+
+ ///
+ /// loop until we get a message packet
+ ///
+ while (!GotMessage) {
+ ///
+ /// If 1 second timeout has expired, return fail as we have not yet received a full message.
+ ///
+ if (Timeout (TimerStart, TimerEnd, HpetTimer) != EFI_SUCCESS) {
+ *Length = 0;
+ return EFI_TIMEOUT;
+ }
+ ///
+ /// Read one message from HECI buffer and advance read pointer. Make sure
+ /// that we do not pass the write pointer.
+ ///
+ HeciRegMeCsrHa.ul = HeciRegMeCsrHaPtr->ul;
+ if (FilledSlots (HeciRegMeCsrHa.r.ME_CBRP_HRA, HeciRegMeCsrHa.r.ME_CBWP_HRA) > 0) {
+ ///
+ /// Eat the HECI Message header
+ ///
+ MessageHeader->Data = *HeciRegMeCbrwPtr;
+
+ ///
+ /// Compute required message length in DWORDS
+ ///
+ LengthInDwords = ((MessageHeader->Fields.Length + 3) / 4);
+
+ ///
+ /// Just return success if Length is 0
+ ///
+ if (MessageHeader->Fields.Length == 0) {
+ ///
+ /// Set Interrupt Generate bit and return
+ ///
+ HeciRegHCsrPtr->r.H_IG = 1;
+ *Length = 0;
+ return EFI_SUCCESS;
+ }
+ ///
+ /// Make sure that the message does not overflow the circular buffer.
+ ///
+ if ((MessageHeader->Fields.Length + sizeof (HECI_MESSAGE_HEADER)) > (HeciRegMeCsrHaPtr->r.ME_CBD_HRA * 4)) {
+ *Length = 0;
+ return EFI_DEVICE_ERROR;
+ }
+ ///
+ /// Make sure that the callers buffer can hold the correct number of DWORDS
+ ///
+ if ((MessageHeader->Fields.Length) <= *Length) {
+ ///
+ /// Start timeout counter for inner loop
+ ///
+ HpetTimer = StartTimer (PeiServices, &TimerStart1, &TimerEnd1, PEI_HECI_READ_TIMEOUT);
+
+ ///
+ /// Wait here until entire message is present in circular buffer
+ ///
+ HeciRegMeCsrHa.ul = HeciRegMeCsrHaPtr->ul;
+ while (LengthInDwords > FilledSlots (HeciRegMeCsrHa.r.ME_CBRP_HRA, HeciRegMeCsrHa.r.ME_CBWP_HRA)) {
+ ///
+ /// If 1 second timeout has expired, return fail as we have not yet received a full message
+ ///
+ if (Timeout (TimerStart1, TimerEnd1, HpetTimer) != EFI_SUCCESS) {
+ *Length = 0;
+ return EFI_TIMEOUT;
+ }
+ ///
+ /// Wait before we read the register again
+ ///
+ Stall (PeiServices, PEI_HECI_WAIT_DELAY);
+
+ ///
+ /// Read the register again
+ ///
+ HeciRegMeCsrHa.ul = HeciRegMeCsrHaPtr->ul;
+ }
+ ///
+ /// copy rest of message
+ ///
+ for (i = 0; i < LengthInDwords; i++) {
+ MessageData[i] = *HeciRegMeCbrwPtr;
+ }
+ ///
+ /// Update status and length
+ ///
+ GotMessage = TRUE;
+ *Length = MessageHeader->Fields.Length;
+
+ } else {
+ ///
+ /// Message packet is larger than caller's buffer
+ ///
+ *Length = 0;
+ return EFI_BUFFER_TOO_SMALL;
+ }
+ }
+ ///
+ /// Wait before we try to get a message again
+ ///
+ Stall (PeiServices, PEI_HECI_WAIT_DELAY);
+ }
+ ///
+ /// Read ME_CSR_HA. If the ME_RDY bit is 0, then an ME reset occurred during the
+ /// transaction and the message should be discarded as bad data may have been retrieved
+ /// from the host's circular buffer
+ ///
+ if (HeciRegMeCsrHaPtr->r.ME_RDY_HRA == 0) {
+ *Length = 0;
+ return EFI_DEVICE_ERROR;
+ }
+ ///
+ /// Set Interrupt Generate bit
+ ///
+ HeciRegHCsrPtr->r.H_IG = 1;
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Function sends one messsage (of any length) through the HECI circular buffer.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] This The address of HECI PPI.
+ @param[in] HeciMemBar HECI Memory BAR.
+ @param[in] Message Pointer to the message data to be sent.
+ @param[in] Length Length of the message in bytes.
+ @param[in] HostAddress The address of the host processor.
+ @param[in] MeAddress Address of the ME subsystem the message is being sent to.
+
+ @retval EFI_SUCCESS One message packet sent.
+ @retval EFI_DEVICE_ERROR Failed to initialize HECI
+ @retval EFI_TIMEOUT HECI is not ready for communication
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support send message through HEC
+**/
+EFI_STATUS
+HeciSendMsg (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_HECI_PPI *This,
+ IN UINT32 *Message,
+ IN UINT32 HeciMemBar,
+ IN UINT32 Length,
+ IN UINT8 HostAddress,
+ IN UINT8 MeAddress
+ )
+{
+ UINT32 CBLength;
+ UINT32 SendLength;
+ UINT32 CurrentLength;
+ HECI_MESSAGE_HEADER MessageHeader;
+ EFI_STATUS WriteStatus;
+ VOLATILE HECI_HOST_CONTROL_REGISTER *HeciRegHCsrPtr;
+ UINT32 MeMode;
+
+ CurrentLength = 0;
+ HeciRegHCsrPtr = NULL;
+
+ HeciGetMeMode (PeiServices, &MeMode);
+ if (MeMode == ME_MODE_SECOVER) {
+ return EFI_UNSUPPORTED;
+ }
+
+ DEBUG ((EFI_D_ERROR, "HECI SendMsg:\n"));
+#ifdef EFI_DEBUG
+ DEBUG_CODE (
+ ShowBuffer (PeiServices, (UINT8 *) Message, Length);
+ );
+#endif // End Of EFI_DEBUG
+ ///
+ /// Make sure that HECI device BAR is correct and device is enabled.
+ ///
+ /// CheckAndFixHeciForAccess (PeiServices, This);
+ ///
+ /// Make sure that HECI is ready for communication.
+ ///
+ if (WaitForMEReady (PeiServices, This, HeciMemBar) != EFI_SUCCESS) {
+ return EFI_TIMEOUT;
+ }
+ ///
+ /// Set up memory mapped registers
+ ///
+ HeciRegHCsrPtr = (VOID *) (HeciMemBar + H_CSR);
+
+ ///
+ /// Grab Circular Buffer length
+ ///
+ CBLength = HeciRegHCsrPtr->r.H_CBD;
+
+ ///
+ /// Prepare message header
+ ///
+ MessageHeader.Data = 0;
+ MessageHeader.Fields.MeAddress = MeAddress;
+ MessageHeader.Fields.HostAddress = HostAddress;
+
+ ///
+ /// Break message up into CB-sized packets and loop until completely sent
+ ///
+ while (Length > CurrentLength) {
+ ///
+ /// Set the Message Complete bit if this is our last packet in the message.
+ /// Needs to be 'less than' to account for the header.
+ ///
+ if ((((Length - CurrentLength) + 3) / 4) < CBLength) {
+ MessageHeader.Fields.MessageComplete = 1;
+ }
+ ///
+ /// Calculate length for Message Header
+ /// header length == smaller of circular buffer or remaining message (both account for the size of the header)
+ ///
+ SendLength = ((CBLength < (((Length - CurrentLength) + 3) / 4)) ? ((CBLength - 1) * 4) : (Length - CurrentLength));
+ MessageHeader.Fields.Length = SendLength;
+
+ DEBUG ((EFI_D_ERROR, "HECI Header: %08x\n", MessageHeader.Data));
+ ///
+ /// send the current packet (CurrentLength can be treated as the index into the message buffer)
+ ///
+ WriteStatus = HeciPacketWrite (
+ PeiServices,
+ This,
+ HeciMemBar,
+ &MessageHeader,
+ (UINT32 *) ((UINT32) Message + CurrentLength)
+ );
+ if (EFI_ERROR (WriteStatus)) {
+ return WriteStatus;
+ }
+ ///
+ /// Update the length information
+ ///
+ CurrentLength += SendLength;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Function sends one messsage packet through the HECI circular buffer
+ Corresponds to HECI HPS (part of) section 4.2.3
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] This The address of HECI PPI.
+ @param[in] HeciMemBar HECI Memory BAR.
+ @param[in] MessageHeader Pointer to the message header.
+ @param[in] MessageData Pointer to the actual message data.
+
+ @retval EFI_SUCCESS One message packet sent
+ @retval EFI_DEVICE_ERROR ME is not ready
+ @retval EFI_TIMEOUT HECI is not ready for communication
+**/
+EFI_STATUS
+HeciPacketWrite (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_HECI_PPI *This,
+ IN UINT32 HeciMemBar,
+ IN HECI_MESSAGE_HEADER *MessageHeader,
+ IN UINT32 *MessageData
+ )
+{
+ UINT32 timer_start;
+ UINT32 timer_end;
+ UINT32 i;
+ UINT32 LengthInDwords;
+ HECI_HOST_CONTROL_REGISTER HeciRegHCsr;
+ VOLATILE UINT32 *HpetTimer;
+ VOLATILE HECI_HOST_CONTROL_REGISTER *HeciRegHCsrPtr;
+ VOLATILE HECI_ME_CONTROL_REGISTER *HeciRegMeCsrHaPtr;
+ VOLATILE UINT32 *HeciRegHCbwwPtr;
+
+ HeciRegHCsrPtr = (VOID *) (HeciMemBar + H_CSR);
+ HeciRegMeCsrHaPtr = (VOID *) (HeciMemBar + ME_CSR_HA);
+ HeciRegHCbwwPtr = (VOID *) (HeciMemBar + H_CB_WW);
+ ///
+ /// Make sure that HECI is ready for communication.
+ ///
+ if (WaitForMEReady (PeiServices, This, HeciMemBar) != EFI_SUCCESS) {
+ return EFI_TIMEOUT;
+ }
+ ///
+ /// Start timeout counter
+ ///
+ HpetTimer = StartTimer (PeiServices, &timer_start, &timer_end, PEI_HECI_SEND_TIMEOUT);
+
+ ///
+ /// Compute message length in DWORDS
+ ///
+ LengthInDwords = ((MessageHeader->Fields.Length + 3) / 4);
+
+ ///
+ /// Wait until there is sufficient room in the circular buffer
+ /// Must have room for message and message header
+ ///
+ HeciRegHCsr.ul = HeciRegHCsrPtr->ul;
+ while ((LengthInDwords + 1) > (HeciRegHCsr.r.H_CBD - FilledSlots (HeciRegHCsr.r.H_CBRP, HeciRegHCsr.r.H_CBWP))) {
+ ///
+ /// If 1 second timeout has expired, return fail as the circular buffer never emptied
+ ///
+ if (Timeout (timer_start, timer_end, HpetTimer) != EFI_SUCCESS) {
+ return EFI_TIMEOUT;
+ }
+ ///
+ /// Wait before we read the register again
+ ///
+ Stall (PeiServices, PEI_HECI_WAIT_DELAY);
+
+ ///
+ /// Read Host CSR for next iteration
+ ///
+ HeciRegHCsr.ul = HeciRegHCsrPtr->ul;
+ }
+ ///
+ /// Write Message Header
+ ///
+ *HeciRegHCbwwPtr = MessageHeader->Data;
+
+ ///
+ /// Write Message Body
+ ///
+ for (i = 0; i < LengthInDwords; i++) {
+ *HeciRegHCbwwPtr = MessageData[i];
+ }
+ ///
+ /// Set Interrupt Generate bit
+ ///
+ HeciRegHCsrPtr->r.H_IG = 1;
+
+ ///
+ /// Test if ME Ready bit is set to 1, if set to 0 a fatal error occured during
+ /// the transmission of this message.
+ ///
+ if (HeciRegMeCsrHaPtr->r.ME_RDY_HRA == 0) {
+ return EFI_DEVICE_ERROR;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Function sends one messsage through the HECI circular buffer and waits
+ for the corresponding ACK message.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] This The address of HECI PPI.
+ @param[in][out] Message Pointer to the message buffer.
+ @param[in] HeciMemBar HECI Memory BAR.
+ @param[in][out] Length Length of the message in bytes.
+ @param[in] HostAddress Address of the sending entity.
+ @param[in] MeAddress Address of the ME entity that should receive the message.
+
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the bufferbefore timeout
+ @retval EFI_BUFFER_TOO_SMALL Message Buffer is too small for the Acknowledge
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support send message through HECI
+**/
+EFI_STATUS
+HeciSendwAck (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_HECI_PPI *This,
+ IN OUT UINT32 *Message,
+ IN UINT32 HeciMemBar,
+ IN OUT UINT32 *Length,
+ IN UINT8 HostAddress,
+ IN UINT8 MeAddress
+ )
+{
+ EFI_STATUS Status;
+ UINT32 MeMode;
+
+ HeciGetMeMode (PeiServices, &MeMode);
+ if (MeMode == ME_MODE_SECOVER) {
+ return EFI_UNSUPPORTED;
+ }
+ ///
+ /// Send the message
+ ///
+ Status = HeciSendMsg (PeiServices, This, Message, HeciMemBar, *Length, HostAddress, MeAddress);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ ///
+ /// Wait for ACK message
+ ///
+ return HeciReadMsg (PeiServices, This, BLOCKING, HeciMemBar, Message, Length);
+}
+
+/**
+ Calculate if the circular buffer has overflowed.
+ Corresponds to HECI HPS (part of) section 4.2.1
+
+ @param[in] ReadPointer Location of the read pointer.
+ @param[in] WritePointer Location of the write pointer.
+
+ @retval UINT8 Number of filled slots.
+**/
+UINT8
+FilledSlots (
+ IN UINT32 ReadPointer,
+ IN UINT32 WritePointer
+ )
+{
+ UINT8 FilledSlots;
+
+ ///
+ /// Calculation documented in HECI HPS 0.68 section 4.2.1
+ ///
+ FilledSlots = (((INT8) WritePointer) - ((INT8) ReadPointer));
+
+ return FilledSlots;
+}
+
+/**
+ Calculate if the circular buffer has overflowed
+ Corresponds to HECI HPS (part of) section 4.2.1
+
+ @param[in] ReadPointer Value read from host/me read pointer
+ @param[in] WritePointer Value read from host/me write pointer
+ @param[in] BufferDepth Value read from buffer depth register
+
+ @retval EFI_DEVICE_ERROR The circular buffer has overflowed
+ @retval EFI_SUCCESS The circular buffer does not overflowed
+**/
+EFI_STATUS
+OverflowCB (
+ IN UINT32 ReadPointer,
+ IN UINT32 WritePointer,
+ IN UINT32 BufferDepth
+ )
+{
+ UINT8 FilledSlots;
+
+ ///
+ /// Calculation documented in HECI HPS 0.68 section 4.2.1
+ ///
+ FilledSlots = (((INT8) WritePointer) - ((INT8) ReadPointer));
+
+ ///
+ /// test for overflow
+ ///
+ if (FilledSlots > ((UINT8) BufferDepth)) {
+ return EFI_DEVICE_ERROR;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Used for calculating timeouts
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] Start Snapshot of the HPET timer
+ @param[in] End Calculated time when timeout period will be done
+ @param[in] Time Timeout period in microseconds
+
+ @retval None
+**/
+VOLATILE
+UINT32 *
+StartTimer (
+ IN EFI_PEI_SERVICES **PeiServices,
+ OUT UINT32 *Start,
+ OUT UINT32 *End,
+ IN UINT32 Time
+ )
+{
+ UINT32 Ticks;
+ VOLATILE UINT32 *HpetTimer;
+ ///
+ /// Make sure that HPET is enabled and running
+ ///
+ HpetTimer = EnableHpet (PeiServices);
+
+ ///
+ /// Read current timer value into start time from HPET
+ ///
+ *Start = HpetTimer[HPET_MAIN_COUNTER_LOW];
+
+ ///
+ /// Convert microseconds into 70ns timer ticks
+ ///
+ Ticks = Time * HPET_TICKS_PER_MICRO;
+
+ ///
+ /// Compute end time
+ ///
+ *End = *Start + Ticks;
+
+ return HpetTimer;
+}
+
+/**
+ Used to determine if a timeout has occured.
+
+ @param[in] Start Snapshot of the HPET timer when the timeout period started.
+ @param[in] End Calculated time when timeout period will be done.
+ @param[in] HpetTimer The value of High Precision Event Timer
+
+ @retval EFI_TIMEOUT Timeout occured.
+ @retval EFI_SUCCESS Not yet timed out
+**/
+EFI_STATUS
+Timeout (
+ IN UINT32 Start,
+ IN UINT32 End,
+ IN VOLATILE UINT32 *HpetTimer
+ )
+{
+ UINT32 Current;
+
+ ///
+ /// Read HPET and assign the value as the current time.
+ ///
+ Current = HpetTimer[HPET_MAIN_COUNTER_LOW];
+
+ ///
+ /// If no timeout, current timer always is +1 to Start timer
+ ///
+ /// if(This->HeciTimeout == 0){
+ /// Current = Start + 1;
+ /// }
+ ///
+ /// Test basic case (no overflow)
+ ///
+ if ((Start < End) && (End <= Current)) {
+ return EFI_TIMEOUT;
+ }
+ ///
+ /// Test basic start/end conditions with overflowed timer
+ ///
+ if ((Start < End) && (Current < Start)) {
+ return EFI_TIMEOUT;
+ }
+ ///
+ /// Test for overflowed start/end condition
+ ///
+ if ((Start > End) && ((Current < Start) && (Current > End))) {
+ return EFI_TIMEOUT;
+ }
+ ///
+ /// Catch corner case of broken arguments
+ ///
+ if (Start == End) {
+ return EFI_TIMEOUT;
+ }
+ ///
+ /// Else, we have not yet timed out
+ ///
+ return EFI_SUCCESS;
+}
+
+/**
+ Get an abstract Intel ME Status from Firmware Status Register.
+ This is used to control BIOS flow for different Intel ME
+ functions.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] MeStatus Pointer for status report,
+ see MeState.h - Abstract ME status definitions.
+
+ @retval EFI_SUCCESS MeStatus copied
+ @retval EFI_INVALID_PARAMETER Pointer of MeStatus is invalid
+**/
+EFI_STATUS
+EFIAPI
+HeciGetMeStatus (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN UINT32 *MeStatus
+ )
+{
+ HECI_FWS_REGISTER MeFirmwareStatus;
+
+ if (MeStatus == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ MeFirmwareStatus.ul = HeciPciRead32 (R_FWSTATE);
+ if (MeFirmwareStatus.r.CurrentState == ME_STATE_NORMAL && MeFirmwareStatus.r.ErrorCode == ME_ERROR_CODE_NO_ERROR) {
+ *MeStatus = ME_READY;
+ } else if (MeFirmwareStatus.r.CurrentState == ME_STATE_RECOVERY) {
+ *MeStatus = ME_IN_RECOVERY_MODE;
+ } else {
+ *MeStatus = ME_NOT_READY;
+ }
+
+ if (MeFirmwareStatus.r.FwInitComplete == ME_FIRMWARE_COMPLETED) {
+ *MeStatus |= ME_FW_INIT_COMPLETE;
+ }
+
+ DEBUG ((EFI_D_ERROR, "HECI MeStatus %X\n", MeFirmwareStatus.ul));
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Get an abstract ME operation mode from firmware status
+ register. This is used to control BIOS flow for different
+ Intel ME functions.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] MeMode Pointer for ME Mode report,
+ see MeState.h - Abstract ME Mode definitions.
+
+ @retval EFI_SUCCESS MeMode copied
+ @retval EFI_INVALID_PARAMETER Pointer of MeMode is invalid
+**/
+EFI_STATUS
+EFIAPI
+HeciGetMeMode (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN UINT32 *MeMode
+ )
+{
+ HECI_FWS_REGISTER MeFirmwareStatus;
+
+ if (MeMode == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ MeFirmwareStatus.ul = HeciPciRead32 (R_FWSTATE);
+
+ switch (MeFirmwareStatus.r.MeOperationMode) {
+ case ME_OPERATION_MODE_NORMAL:
+ *MeMode = ME_MODE_NORMAL;
+ break;
+
+ case ME_OPERATION_MODE_DEBUG:
+ *MeMode = ME_MODE_DEBUG;
+ break;
+
+ case ME_OPERATION_MODE_SOFT_TEMP_DISABLE:
+ *MeMode = ME_MODE_TEMP_DISABLED;
+ break;
+
+ case ME_OPERATION_MODE_SECOVR_JMPR:
+ case ME_OPERATION_MODE_SECOVR_HECI_MSG:
+ *MeMode = ME_MODE_SECOVER;
+ break;
+
+ default:
+ *MeMode = ME_MODE_FAILED;
+ }
+ DEBUG ((EFI_D_ERROR, "HECI MeMode %X\n", MeFirmwareStatus.r.MeOperationMode));
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/ME/Heci/Pei/HeciInit.c b/ReferenceCode/ME/Heci/Pei/HeciInit.c
new file mode 100644
index 0000000..0375bd7
--- /dev/null
+++ b/ReferenceCode/ME/Heci/Pei/HeciInit.c
@@ -0,0 +1,182 @@
+/** @file
+ Framework PEIM to HECI.
+
+@copyright
+ Copyright (c) 2008 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+//
+// Statements that include other files
+//
+#include "HeciInit.h"
+#endif
+//
+// Function Declarations
+//
+static PEI_HECI_PPI mHeciPpi = {
+ HeciSendwAck,
+ HeciReadMsg,
+ HeciSendMsg,
+ InitializeHeci,
+ HeciGetMeStatus,
+ HeciGetMeMode
+};
+
+static EFI_PEI_PPI_DESCRIPTOR mInstallHeciPpi = {
+ EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
+ &gPeiHeciPpiGuid,
+ &mHeciPpi
+};
+
+//
+// Function Implementations
+//
+
+/**
+ Internal function performing Heci platform PPIs init needed in PEI phase
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_DEVICE_ERROR ME FPT is bad
+**/
+EFI_STATUS
+EFIAPI
+PeiInstallHeciPpi (
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_STATUS Status;
+
+ ///
+ /// Check for ME FPT Bad
+ ///
+ if ((HeciPciRead32 (R_FWSTATE) & 0x0020) != 0) {
+
+ return EFI_DEVICE_ERROR;
+ }
+ ///
+ /// Initialize Heci platform PPIs
+ /// Do not use EdkIIGlueLib here because PeiService pointer used in GlueLib
+ /// is not updated after memory installed.
+ ///
+ Status = (**PeiServices).InstallPpi (PeiServices, &mInstallHeciPpi);
+ ASSERT_EFI_ERROR (Status);
+
+ DEBUG ((EFI_D_ERROR, "Install Heci Ppi Complete.\n"));
+ return Status;
+}
+
+/**
+ Internal function performing PM register initialization for Me
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+
+ @retval EFI_SUCCESS Always return EFI_SUCCESS
+**/
+EFI_STATUS
+EFIAPI
+MePmInit (
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ UINT16 PmBase;
+ UINT16 Pm1Cnt;
+
+ ///
+ /// Before system memory initialization, BIOS should check the WAK_STS bit in PM1_STS[15] (PCH register PMBASE+00h)
+ /// to determine if Intel Management Engine has reset the system while the host was in a sleep state. If WAK_STS is
+ /// not set, BIOS should ensure a non-sleep exit path is taken. One way to accomplish this is by overwriting
+ /// PM1_CNT[12:10] (PCH register PMBASE+04h) to 111b to force an S5 exit path by the BIOS.
+ ///
+ PmBase = PciRead16 (
+ PCI_LIB_ADDRESS (DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ 0,
+ R_PCH_LPC_ACPI_BASE)
+ ) & B_PCH_LPC_ACPI_BASE_BAR;
+
+ ASSERT (PmBase != 0);
+
+ if (PmBase != 0) {
+ if ((IoRead16 (PmBase + R_PCH_ACPI_PM1_STS) & B_PCH_ACPI_PM1_STS_WAK) == 0) {
+ Pm1Cnt = IoRead16 (PmBase + R_PCH_ACPI_PM1_CNT) | V_PCH_ACPI_PM1_CNT_S5;
+ IoWrite16 (PmBase + R_PCH_ACPI_PM1_CNT, Pm1Cnt);
+ DEBUG ((EFI_D_ERROR, "Force an S5 exit path.\n"));
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Internal function performing Me initialization.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+
+ @retval EFI_SUCCESS Heci initialization completed successfully.
+ @retval All other error conditions encountered result in an ASSERT.
+**/
+EFI_STATUS
+EFIAPI
+MeInit (
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_STATUS Status;
+
+ Status = MePmInit (PeiServices);
+ return Status;
+}
+
+/**
+ Initialize ME after reset
+
+ @param[in] FfsHeader Not used.
+ @param[in] PeiServices General purpose services available to every PEIM.
+
+ @retval EFI_SUCCESS Heci initialization completed successfully.
+ @retval All other error conditions encountered result in an ASSERT.
+**/
+EFI_STATUS
+PeimHeciInit (
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_STATUS Status;
+
+ ///
+ /// Performing Me initialization
+ ///
+ Status = MeInit (PeiServices);
+ ASSERT_EFI_ERROR (Status);
+
+ Status = PeiInstallHeciPpi (PeiServices);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "(ICC) Failed to PeiInstallHeciPpi! Status = %r\n", Status));
+ } else {
+ DEBUG ((EFI_D_INFO, "HeciInit Complete.\n"));
+ }
+
+ return Status;
+}
diff --git a/ReferenceCode/ME/Heci/Pei/HeciInit.dxs b/ReferenceCode/ME/Heci/Pei/HeciInit.dxs
new file mode 100644
index 0000000..2db83cd
--- /dev/null
+++ b/ReferenceCode/ME/Heci/Pei/HeciInit.dxs
@@ -0,0 +1,45 @@
+/** @file
+ Dependency expression file for Heci Init PEIM.
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "PeimDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+
+#endif
+
+
+DEPENDENCY_START
+
+ TRUE
+DEPENDENCY_END
+
+
+
+
diff --git a/ReferenceCode/ME/Heci/Pei/HeciInit.h b/ReferenceCode/ME/Heci/Pei/HeciInit.h
new file mode 100644
index 0000000..a8dab69
--- /dev/null
+++ b/ReferenceCode/ME/Heci/Pei/HeciInit.h
@@ -0,0 +1,390 @@
+/** @file
+ Framework PEIM to provide Heci.
+
+@copyright
+ Copyright (c) 2008 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#ifndef _HECI_INIT_H_
+#define _HECI_INIT_H_
+
+#include "EdkIIGluePeim.h"
+#include "MeAccess.h"
+#include "HeciRegs.h"
+#include "MeState.h"
+#include "CoreBiosMsg.h"
+#include "Pci22.h"
+
+//
+// Driver Consumed PPI Prototypes
+//
+#include EFI_PPI_DEPENDENCY (CpuIo)
+#include EFI_PPI_DEPENDENCY (PciCfg)
+#include EFI_PPI_DEPENDENCY (Heci)
+#include EFI_PPI_DEPENDENCY (MemoryDiscovered)
+
+//
+// Prototypes
+//
+
+/**
+ Enable Hpet function.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+
+ @retval UINT32 Return the High Precision Event Timer base address
+**/
+VOLATILE
+UINT32 *
+EnableHpet (
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+;
+
+/**
+ This function provides a standard way to verify the HECI cmd and MBAR regs
+ in its PCI cfg space are setup properly and that the local mHeciContext
+ variable matches this info.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] This The address of HECI PPI
+ @param[in][out] HeciMemBar HECI Memory BAR
+
+ @retval None
+**/
+VOID
+CheckAndFixHeciForAccess (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_HECI_PPI *This,
+ IN OUT UINT32 *HeciMemBar
+ )
+;
+
+/**
+ Determines if the HECI device is present and, if present, initializes it for
+ use by the BIOS.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] This The address of HECI PPI
+ @param[in][out] HeciMemBar HECI Memory BAR
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_DEVICE_ERROR No HECI device
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+ @exception EFI_UNSUPPORTED HECI MSG is unsupported
+**/
+EFI_STATUS
+EFIAPI
+InitializeHeci (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_HECI_PPI *This,
+ IN OUT UINT32 *HeciMemBar
+ )
+;
+
+/**
+ Waits for the ME to report that it is ready for communication over the HECI
+ interface.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] This The address of HECI PPI.
+ @param[in] HeciMemBar HECI Memory BAR.
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_TIMEOUT If 5 second timeout has expired, return fail.
+**/
+EFI_STATUS
+WaitForMEReady (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_HECI_PPI *This,
+ IN UINT32 HeciMemBar
+ )
+;
+
+/**
+ Read the HECI Message from Intel ME with size in Length into
+ buffer Message. Set Blocking to BLOCKING and code will wait
+ until one message packet is received. When set to
+ NON_BLOCKING, if the circular buffer is empty at the time, the
+ code not wait for the message packet read.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] This The address of HECI PPI.
+ @param[in] HeciMemBar HECI Memory BAR.
+ @param[in] Blocking Used to determine if the read is BLOCKING or NON_BLOCKING.
+ @param[in] MessageBody Pointer to a buffer used to receive a message.
+ @param[in][out] Length Pointer to the length of the buffer on input and the length
+ of the message on return. (in bytes)
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS One message packet read
+ @retval EFI_TIMEOUT HECI is not ready for communication
+ @retval EFI_DEVICE_ERROR Zero-length message packet read
+ @retval EFI_BUFFER_TOO_SMALL The caller's buffer was not large enough
+**/
+EFI_STATUS
+EFIAPI
+HeciReadMsg (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_HECI_PPI *This,
+ IN UINT32 Blocking,
+ IN UINT32 HeciMemBar,
+ IN UINT32 *MessageBody,
+ IN OUT UINT32 *Length
+ )
+;
+
+/**
+ Function to pull one messsage packet off the HECI circular buffer.
+ Corresponds to HECI HPS (part of) section 4.2.4
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] HeciMemBar HECI Memory BAR.
+ @param[in] Blocking Used to determine if the read is BLOCKING or NON_BLOCKING.
+ @param[out] MessageHeader Pointer to a buffer for the message header.
+ @param[out] MessageData Pointer to a buffer to recieve the message in.
+ @param[in][out] Length On input is the size of the callers buffer in bytes. On
+ output this is the size of the packet in bytes.
+
+ @retval EFI_SUCCESS One message packet read.
+ @retval EFI_DEVICE_ERROR The circular buffer is overflowed.
+ @retval EFI_NO_RESPONSE The circular buffer is empty
+ @retval EFI_TIMEOUT Failed to receive a full message
+ @retval EFI_BUFFER_TOO_SMALL Message packet is larger than caller's buffer
+**/
+EFI_STATUS
+HeciPacketRead (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN UINT32 Blocking,
+ IN UINT32 HeciMemBar,
+ OUT HECI_MESSAGE_HEADER *MessageHeader,
+ OUT UINT32 *MessageData,
+ IN OUT UINT32 *Length
+ )
+;
+
+/**
+ Function sends one messsage (of any length) through the HECI circular buffer.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] This The address of HECI PPI.
+ @param[in] HeciMemBar HECI Memory BAR.
+ @param[in] Message Pointer to the message data to be sent.
+ @param[in] Length Length of the message in bytes.
+ @param[in] HostAddress The address of the host processor.
+ @param[in] MeAddress Address of the ME subsystem the message is being sent to.
+
+ @retval EFI_SUCCESS One message packet sent.
+ @retval EFI_DEVICE_ERROR Failed to initialize HECI
+ @retval EFI_TIMEOUT HECI is not ready for communication
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support send message through HEC
+**/
+EFI_STATUS
+HeciSendMsg (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_HECI_PPI *This,
+ IN UINT32 *Message,
+ IN UINT32 HeciMemBar,
+ IN UINT32 Length,
+ IN UINT8 HostAddress,
+ IN UINT8 MeAddress
+ )
+;
+
+/**
+ Function sends one messsage packet through the HECI circular buffer
+ Corresponds to HECI HPS (part of) section 4.2.3
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] This The address of HECI PPI.
+ @param[in] HeciMemBar HECI Memory BAR.
+ @param[in] MessageHeader Pointer to the message header.
+ @param[in] MessageData Pointer to the actual message data.
+
+ @retval EFI_SUCCESS One message packet sent
+ @retval EFI_DEVICE_ERROR ME is not ready
+ @retval EFI_TIMEOUT HECI is not ready for communication
+**/
+EFI_STATUS
+HeciPacketWrite (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_HECI_PPI *This,
+ IN UINT32 HeciMemBar,
+ IN HECI_MESSAGE_HEADER *MessageHeader,
+ IN UINT32 *MessageData
+ )
+;
+
+/**
+ Function sends one messsage through the HECI circular buffer and waits
+ for the corresponding ACK message.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] This The address of HECI PPI.
+ @param[in][out] Message Pointer to the message buffer.
+ @param[in] HeciMemBar HECI Memory BAR.
+ @param[in][out] Length Length of the message in bytes.
+ @param[in] HostAddress Address of the sending entity.
+ @param[in] MeAddress Address of the ME entity that should receive the message.
+
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the bufferbefore timeout
+ @retval EFI_BUFFER_TOO_SMALL Message Buffer is too small for the Acknowledge
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support send message through HECI
+**/
+EFI_STATUS
+HeciSendwAck (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_HECI_PPI *This,
+ IN OUT UINT32 *Message,
+ IN UINT32 HeciMemBar,
+ IN OUT UINT32 *Length,
+ IN UINT8 HostAddress,
+ IN UINT8 MeAddress
+ )
+;
+
+/**
+ Calculate if the circular buffer has overflowed
+ Corresponds to HECI HPS (part of) section 4.2.1
+
+ @param[in] ReadPointer Value read from host/me read pointer
+ @param[in] WritePointer Value read from host/me write pointer
+ @param[in] BufferDepth Value read from buffer depth register
+
+ @retval EFI_DEVICE_ERROR The circular buffer has overflowed
+ @retval EFI_SUCCESS The circular buffer does not overflowed
+**/
+EFI_STATUS
+OverflowCB (
+ IN UINT32 ReadPointer,
+ IN UINT32 WritePointer,
+ IN UINT32 BufferDepth
+ )
+;
+
+/**
+ Used for calculating timeouts
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] Start Snapshot of the HPET timer
+ @param[in] End Calculated time when timeout period will be done
+ @param[in] Time Timeout period in microseconds
+
+ @retval None
+**/
+VOLATILE
+UINT32 *
+StartTimer (
+ IN EFI_PEI_SERVICES **PeiServices,
+ OUT UINT32 *Start,
+ OUT UINT32 *End,
+ IN UINT32 Time
+ )
+;
+
+/**
+ Used to determine if a timeout has occured.
+
+ @param[in] Start Snapshot of the HPET timer when the timeout period started.
+ @param[in] End Calculated time when timeout period will be done.
+ @param[in] HpetTimer The value of High Precision Event Timer
+
+ @retval EFI_TIMEOUT Timeout occured.
+ @retval EFI_SUCCESS Not yet timed out
+**/
+EFI_STATUS
+Timeout (
+ IN UINT32 Start,
+ IN UINT32 End,
+ IN VOLATILE UINT32 *HpetTimer
+ )
+;
+
+/**
+ Get an abstract Intel ME Status from Firmware Status Register.
+ This is used to control BIOS flow for different Intel ME
+ functions.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] MeStatus Pointer for status report,
+ see MeState.h - Abstract ME status definitions.
+
+ @retval EFI_SUCCESS MeStatus copied
+ @retval EFI_INVALID_PARAMETER Pointer of MeStatus is invalid
+**/
+EFI_STATUS
+EFIAPI
+HeciGetMeStatus (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN UINT32 *MeStatus
+ )
+;
+
+/**
+ Get an abstract ME operation mode from firmware status
+ register. This is used to control BIOS flow for different
+ Intel ME functions.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] MeMode Pointer for ME Mode report,
+ see MeState.h - Abstract ME Mode definitions.
+
+ @retval EFI_SUCCESS MeMode copied
+ @retval EFI_INVALID_PARAMETER Pointer of MeMode is invalid
+**/
+EFI_STATUS
+EFIAPI
+HeciGetMeMode (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN UINT32 *MeMode
+ )
+;
+
+/**
+ Initialize ME after reset
+
+ @param[in] FfsHeader Not used.
+ @param[in] PeiServices General purpose services available to every PEIM.
+
+ @retval EFI_SUCCESS Heci initialization completed successfully.
+ @retval All other error conditions encountered result in an ASSERT.
+**/
+EFI_STATUS
+PeimHeciInit (
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+;
+
+/**
+ Calculate if the circular buffer has overflowed.
+ Corresponds to HECI HPS (part of) section 4.2.1
+
+ @param[in] ReadPointer Location of the read pointer.
+ @param[in] WritePointer Location of the write pointer.
+
+ @retval UINT8 Number of filled slots.
+**/
+UINT8
+FilledSlots (
+ IN UINT32 ReadPointer,
+ IN UINT32 WritePointer
+ )
+;
+#endif // _HECI_INIT_H_
diff --git a/ReferenceCode/ME/Heci/Pei/HeciInit.inf b/ReferenceCode/ME/Heci/Pei/HeciInit.inf
new file mode 100644
index 0000000..2181282
--- /dev/null
+++ b/ReferenceCode/ME/Heci/Pei/HeciInit.inf
@@ -0,0 +1,82 @@
+## @file
+# Component description file for HeciInit module
+#
+#@copyright
+# Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = HeciInit
+FILE_GUID = 4862aff3-667c-5458-b274-a1c62df8ba80
+COMPONENT_TYPE = PE32_PEIM
+
+[sources.common]
+ HeciInit.c
+ HeciInit.h
+ HeciCore.c
+ ../Include/HeciRegs.h
+
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGluePeimEntryPoint.c
+
+[includes.common]
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/Dxe
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/Include
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Heci/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+
+
+[libraries.common]
+ EdkFrameworkPpiLib
+ MeLibPpi
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGluePeiDebugLibReportStatusCode
+ EdkIIGluePeiReportStatusCodeLib
+ EdkIIGluePeiServicesLib
+ EdkIIGlueBasePciLibPciExpress
+ EdkIIGlueBasePciExpressLib
+ EdkPpiLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = HeciInit.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=PeimHeciInit
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_PEI_SERVICES_LIB__ \
+ -D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__
diff --git a/ReferenceCode/ME/Heci/Pei/HeciPei.cif b/ReferenceCode/ME/Heci/Pei/HeciPei.cif
new file mode 100644
index 0000000..c009607
--- /dev/null
+++ b/ReferenceCode/ME/Heci/Pei/HeciPei.cif
@@ -0,0 +1,14 @@
+<component>
+ name = "HeciPei"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\Heci\Pei\"
+ RefName = "HeciPei"
+[files]
+"HeciPei.sdl"
+"HeciPei.mak"
+"HeciCore.c"
+"HeciInit.c"
+"HeciInit.dxs"
+"HeciInit.h"
+"HeciInit.inf"
+<endComponent>
diff --git a/ReferenceCode/ME/Heci/Pei/HeciPei.mak b/ReferenceCode/ME/Heci/Pei/HeciPei.mak
new file mode 100644
index 0000000..990bcf1
--- /dev/null
+++ b/ReferenceCode/ME/Heci/Pei/HeciPei.mak
@@ -0,0 +1,48 @@
+# MAK file for the ModulePart:HeciPei
+
+all: HeciPei
+
+$(BUILD_DIR)\HeciPei.mak : $(HeciPei_DIR)\HeciPei.cif $(BUILD_RULES)
+ $(CIF2MAK) $(HeciPei_DIR)\HeciPei.cif $(CIF2MAK_DEFAULTS)
+
+HeciPei: $(BUILD_DIR)\HeciPei.mak HeciPeiBin
+
+HeciPei_INCLUDES=\
+ $(EDK_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(ME_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)
+
+
+HeciPei_DEFINES=$(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=PeimHeciInit"\
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__\
+ /D __EDKII_GLUE_PEI_SERVICES_LIB__ \
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+
+HeciPei_LIBS =\
+ $(EDKPROTOCOLLIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EdkIIGlueBaseLibIA32_LIB)\
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGluePeiDebugLibReportStatusCode_LIB)\
+ $(EdkIIGluePeiReportStatusCodeLib_LIB)\
+ $(EdkIIGluePeiServicesLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+
+
+HeciPeiBin : $(EDKFRAMEWORKPPILIB) $(MeLibPpi_LIB) $(HeciPei_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\HeciPei.mak all\
+ NAME=HeciPei\
+ MAKEFILE=$(BUILD_DIR)\HeciPei.mak \
+ GUID=9cf30325-dc5c-4556-a8b0-74215c5f7fc4\
+ "MY_INCLUDES=$(HeciPei_INCLUDES)" \
+ "MY_DEFINES=$(HeciPei_DEFINES)"\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=PEIM \
+ EDKIIModule=PEIM\
+ DEPEX1=$(HeciPei_DIR)\HeciInit.dxs DEPEX1_TYPE=EFI_SECTION_PEI_DEPEX \
+ COMPRESS=0
diff --git a/ReferenceCode/ME/Heci/Pei/HeciPei.sdl b/ReferenceCode/ME/Heci/Pei/HeciPei.sdl
new file mode 100644
index 0000000..e193446
--- /dev/null
+++ b/ReferenceCode/ME/Heci/Pei/HeciPei.sdl
@@ -0,0 +1,24 @@
+TOKEN
+ Name = HeciPei_SUPPORT
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable HeciPei support in Project"
+End
+MODULE
+ Help = "Includes HeciPei.mak to Project"
+ File = "HeciPei.mak"
+End
+
+PATH
+ Name = "HeciPei_DIR"
+ Help = "Me Heci Pei file source directory"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\HeciPei.ffs"
+ Parent = "FV_BB"
+ InvokeOrder = AfterParent
+End \ No newline at end of file
diff --git a/ReferenceCode/ME/Heci/Smm/HeciHpet.c b/ReferenceCode/ME/Heci/Smm/HeciHpet.c
new file mode 100644
index 0000000..2f75571
--- /dev/null
+++ b/ReferenceCode/ME/Heci/Smm/HeciHpet.c
@@ -0,0 +1,282 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+/*++
+
+Copyright (c) 2006 - 2010 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ HeciHpet.c
+
+Abstract:
+
+ Definitions for HECI driver
+
+--*/
+#include "HeciHpet.h"
+#include "HeciRegs.h"
+#include "HeciCore.h"
+
+//
+// Extern for shared HECI data and protocols
+//
+extern HECI_INSTANCE_SMM *mHeciContext;
+VOLATILE UINT32 mSaveHpetConfigReg;
+
+VOID
+SaveHpet (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Store the value of High Performance Timer
+
+Arguments:
+
+ None
+
+Returns:
+
+ None
+
+--*/
+{
+ mSaveHpetConfigReg = MmioRead32 (PCH_RCRB_BASE + R_PCH_RCRB_HPTC);
+}
+
+VOID
+RestoreHpet (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Restore the value of High Performance Timer
+
+Arguments:
+
+ None
+
+Returns:
+
+ None
+
+--*/
+{
+ MmioWrite32 (PCH_RCRB_BASE + R_PCH_RCRB_HPTC, mSaveHpetConfigReg);
+}
+
+VOID
+StartTimer (
+ OUT UINT32 *Start,
+ OUT UINT32 *End,
+ IN UINT32 Time
+ )
+/*++
+
+ Routine Description:
+
+ Used for calculating timeouts
+
+ Arguments:
+
+ Start - Snapshot of the HPET timer
+ End - Calculated time when timeout period will be done
+ Time - Timeout period in microseconds
+
+ Returns:
+
+ VOID
+
+--*/
+{
+ UINT32 Ticks;
+
+ //
+ // Make sure that HPET is enabled and running
+ //
+ EnableHpet ();
+
+ //
+ // Read current timer value into start time from HPET
+ //
+ *Start = mHeciContext->HpetTimer[HPET_MAIN_COUNTER_LOW];
+
+ //
+ // Convert microseconds into 70ns timer ticks
+ //
+ Ticks = Time * HPET_TICKS_PER_MICRO;
+
+ //
+ // Compute end time
+ //
+ *End = *Start + Ticks;
+
+ return ;
+}
+
+EFI_STATUS
+Timeout (
+ IN UINT32 Start,
+ IN UINT32 End
+ )
+/*++
+
+ Routine Description:
+ Used to determine if a timeout has occured.
+
+ Arguments:
+ Start - Snapshot of the HPET timer when the timeout period started.
+ End - Calculated time when timeout period will be done.
+
+ Returns:
+ EFI_STATUS
+
+--*/
+{
+ UINT32 Current;
+
+ //
+ // Read HPET and assign the value as the current time.
+ //
+ Current = mHeciContext->HpetTimer[HPET_MAIN_COUNTER_LOW];
+
+ //
+ // Test basic case (no overflow)
+ //
+ if ((Start < End) && (End <= Current)) {
+ return EFI_TIMEOUT;
+ }
+ //
+ // Test basic start/end conditions with overflowed timer
+ //
+ if ((Start < End) && (Current < Start)) {
+ return EFI_TIMEOUT;
+ }
+ //
+ // Test for overflowed start/end condition
+ //
+ if ((Start > End) && ((Current < Start) && (Current > End))) {
+ return EFI_TIMEOUT;
+ }
+ //
+ // Catch corner case of broken arguments
+ //
+ if (Start == End) {
+ return EFI_TIMEOUT;
+ }
+ //
+ // Else, we have not yet timed out
+ //
+ return EFI_SUCCESS;
+}
+
+VOID
+IoDelay (
+ UINT32 delayTime
+ )
+/*++
+
+Routine Description:
+
+ Delay for at least the request number of microseconds
+
+Arguments:
+
+ delayTime - Number of microseconds to delay.
+
+Returns:
+
+ None.
+
+--*/
+{
+ SmmStall (delayTime);
+}
+
+VOID
+SmmStall (
+ IN UINTN Microseconds
+ )
+/*++
+
+Routine Description:
+
+ Delay for at least the request number of microseconds.
+ Timer used is DMA refresh timer, which has 15us granularity.
+ You can call with any number of microseconds, but this
+ implementation cannot support 1us granularity.
+
+Arguments:
+
+ Microseconds - Number of microseconds to delay.
+
+Returns:
+
+ None
+
+--*/
+{
+ UINT8 Data;
+ UINT8 InitialState;
+ UINTN CycleIterations;
+
+ CycleIterations = 0;
+ Data = 0;
+ InitialState = 0;
+
+ //
+ // The time-source is 15 us granular, so calibrate the timing loop
+ // based on this baseline
+ // Error is possible 15us.
+ //
+ CycleIterations = (Microseconds / 15) + 1;
+
+ //
+ // Use the DMA Refresh timer in port 0x61. Cheap but effective.
+ // The only issue is that the granularity is 15us, and we want to
+ // guarantee "at least" one full transition to avoid races.
+ //
+ //
+ // _____________/----------\__________/--------
+ //
+ // |<--15us-->|
+ //
+ // --------------------------------------------------> Time (us)
+ //
+ while (CycleIterations--) {
+ Data = IoRead8 (0x61);
+ InitialState = Data;
+
+ //
+ // Capture first transition (strictly less than one period)
+ //
+ while (InitialState == Data) {
+ Data = IoRead8 (0x61);
+ }
+
+ InitialState = Data;
+ //
+ // Capture next transition (guarantee at least one full pulse)
+ //
+ while (InitialState == Data) {
+ Data = IoRead8 (0x61);
+ }
+ }
+}
diff --git a/ReferenceCode/ME/Heci/Smm/HeciHpet.h b/ReferenceCode/ME/Heci/Smm/HeciHpet.h
new file mode 100644
index 0000000..8624445
--- /dev/null
+++ b/ReferenceCode/ME/Heci/Smm/HeciHpet.h
@@ -0,0 +1,197 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+/*++
+
+Copyright (c) 2006 - 2010 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ HeciHpet.h
+
+Abstract:
+
+ Definitions for HECI driver
+
+--*/
+#ifndef _HECI_HPET_H
+#define _HECI_HPET_H
+
+#include "EdkIIGlueDxe.h"
+#include "MeAccess.h"
+#include "HeciRegs.h"
+#include "Pci22.h"
+
+#define HECI_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('H', 'e', 'c', 'i')
+#define HECI_ROUND_UP_BUFFER_LENGTH(Length) ((UINT32) ((((Length) + 3) / 4) * 4))
+
+//
+// Driver Produced Protocol Prototypes
+//
+#include EFI_PROTOCOL_PRODUCER (HeciSmm)
+
+VOID
+SaveHpet (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Store the value of High Performance Timer
+
+Arguments:
+
+ None
+
+Returns:
+
+ None
+
+--*/
+;
+
+VOID
+RestoreHpet (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Restore the value of High Performance Timer
+
+Arguments:
+
+ None
+
+Returns:
+
+ None
+
+--*/
+;
+
+VOID
+StartTimer (
+ OUT UINT32 *Start,
+ OUT UINT32 *End,
+ IN UINT32 Time
+ )
+/*++
+
+ Routine Description:
+
+ Used for calculating timeouts
+
+ Arguments:
+
+ Start - Snapshot of the HPET timer
+ End - Calculated time when timeout period will be done
+ Time - Timeout period in microseconds
+
+ Returns:
+
+ VOID
+
+--*/
+;
+
+EFI_STATUS
+Timeout (
+ IN UINT32 Start,
+ IN UINT32 End
+ )
+/*++
+
+ Routine Description:
+ Used to determine if a timeout has occured.
+
+ Arguments:
+ Start - Snapshot of the HPET timer when the timeout period started.
+ End - Calculated time when timeout period will be done.
+
+ Returns:
+ EFI_STATUS
+
+--*/
+;
+
+VOID
+EnableHpet (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Enable Hpet function.
+
+Arguments:
+
+ None.
+
+Returns:
+
+ None.
+
+--*/
+;
+
+VOID
+IoDelay (
+ UINT32 delayTime
+ )
+/*++
+
+Routine Description:
+
+ Delay for at least the request number of microseconds
+
+Arguments:
+
+ delayTime - Number of microseconds to delay.
+
+Returns:
+
+ None.
+
+--*/
+;
+
+VOID
+SmmStall (
+ IN UINTN Microseconds
+ )
+/*++
+
+Routine Description:
+
+ Delay for at least the request number of microseconds.
+ Timer used is DMA refresh timer, which has 15us granularity.
+ You can call with any number of microseconds, but this
+ implementation cannot support 1us granularity.
+
+Arguments:
+
+ Microseconds - Number of microseconds to delay.
+
+Returns:
+
+ None
+
+--*/
+;
+#endif // _HECI_HPET_H
diff --git a/ReferenceCode/ME/Heci/Smm/HeciSmm.c b/ReferenceCode/ME/Heci/Smm/HeciSmm.c
new file mode 100644
index 0000000..df1f165
--- /dev/null
+++ b/ReferenceCode/ME/Heci/Smm/HeciSmm.c
@@ -0,0 +1,228 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+/*++
+
+Copyright (c) 2008 - 2010 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ HeciSmm.c
+
+Abstract:
+
+ SMM HECI driver
+
+--*/
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "HeciHpet.h"
+#include "HeciCore.h"
+#endif // EDK_RELEASE_VERSION
+//
+// Global driver data
+//
+EFI_SMM_BASE_PROTOCOL *mSmmBase;
+HECI_INSTANCE_SMM *mHeciContext;
+
+UINT32
+CheckAndFixHeciForAccess (
+ VOID
+ )
+/*++
+
+Routine Description:
+ This function provides a standard way to verify the HECI cmd and MBAR regs
+ in its PCI cfg space are setup properly and that the local mHeciContext
+ variable matches this info.
+
+Arguments:
+ None.
+
+Returns:
+ VOID
+
+--*/
+{
+ UINTN HeciPciAddressBase;
+
+ HeciPciAddressBase = mHeciContext->PciAddressBase;
+
+ //
+ // Read HECI_MBAR in case it has changed
+ //
+ mHeciContext->HeciMBAR = PciRead32 (HeciPciAddressBase + R_HECIMBAR) & 0xFFFFFFF0;
+
+ //
+ // Check if HECI_MBAR is disabled
+ //
+ if ((
+ PciRead8 (HeciPciAddressBase + PCI_COMMAND_OFFSET) & (EFI_PCI_COMMAND_MEMORY_SPACE | EFI_PCI_COMMAND_BUS_MASTER)
+ ) != (EFI_PCI_COMMAND_MEMORY_SPACE | EFI_PCI_COMMAND_BUS_MASTER)
+ ) {
+ //
+ // If cmd reg in pci cfg space is not turned on turn it on.
+ //
+ PciOr8 (
+ HeciPciAddressBase + PCI_COMMAND_OFFSET,
+ EFI_PCI_COMMAND_MEMORY_SPACE | EFI_PCI_COMMAND_BUS_MASTER
+ );
+ }
+
+ return mHeciContext->HeciMBAR;
+}
+
+VOID
+EnableHpet (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Enable Hpet function.
+
+Arguments:
+
+ None.
+
+Returns:
+
+ None.
+
+--*/
+{
+ VOLATILE UINT32 *HpetConfigReg;
+
+ HpetConfigReg = NULL;
+ //
+ // Get the High Precision Event Timer base address and enable the memory range
+ //
+ HpetConfigReg = (UINT32 *) (UINTN) (PCH_RCRB_BASE + R_PCH_RCRB_HPTC);
+ switch (*HpetConfigReg & B_PCH_RCRB_HPTC_AS) {
+ case 0:
+ mHeciContext->HpetTimer = (VOID *) (UINTN) (HPET_ADDRESS_0);
+ break;
+
+ case 1:
+ mHeciContext->HpetTimer = (VOID *) (UINTN) (HPET_ADDRESS_1);
+ break;
+
+ case 2:
+ mHeciContext->HpetTimer = (VOID *) (UINTN) (HPET_ADDRESS_2);
+ break;
+
+ case 3:
+ mHeciContext->HpetTimer = (VOID *) (UINTN) (HPET_ADDRESS_3);
+ break;
+
+ default:
+ mHeciContext->HpetTimer = NULL;
+ break;
+ }
+ //
+ // Read this back to force the write-back.
+ //
+ *HpetConfigReg = *HpetConfigReg | B_PCH_RCRB_HPTC_AE;
+
+ //
+ // Start the timer so it is up and running
+ //
+ mHeciContext->HpetTimer[HPET_GEN_CONFIG_LOW] = HPET_START;
+ mHeciContext->HpetTimer[HPET_GEN_CONFIG_LOW] = HPET_START;
+
+ return ;
+}
+
+EFI_STATUS
+InitializeHECI (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+/*++
+
+Routine Description:
+ HECI driver entry point used to initialize support for the HECI device.
+
+Arguments:
+ ImageHandle - Standard entry point parameter.
+ SystemTable - Standard entry point parameter.
+
+Returns:
+ EFI_STATUS
+
+--*/
+{
+ EFI_STATUS Status;
+
+ Status = gBS->LocateProtocol (&gEfiSmmBaseProtocolGuid, NULL, &mSmmBase);
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ //
+ // Create database record and add to database
+ //
+ Status = mSmmBase->SmmAllocatePool (
+ mSmmBase,
+ EfiRuntimeServicesData,
+ sizeof (HECI_INSTANCE_SMM),
+ &mHeciContext
+ );
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ mHeciContext->Handle = ImageHandle;
+
+ //
+ // Initialize HECI protocol pointers
+ //
+ mHeciContext->HeciCtlr.ResetHeci = ResetHeciInterface;
+ mHeciContext->HeciCtlr.SendwACK = HeciSendwACK;
+ mHeciContext->HeciCtlr.ReadMsg = HeciReceive;
+ mHeciContext->HeciCtlr.SendMsg = HeciSend;
+ mHeciContext->HeciCtlr.InitHeci = HeciInitialize;
+ mHeciContext->HeciCtlr.ReInitHeci = HeciReInitialize;
+ mHeciContext->HeciCtlr.MeResetWait = MeResetWait;
+ mHeciContext->HeciCtlr.GetMeStatus = HeciGetMeStatus;
+ mHeciContext->HeciCtlr.GetMeMode = HeciGetMeMode;
+ //
+ // Initialize the HECI device
+ //
+ Status = InitializeHeciPrivate ();
+ if (EFI_ERROR (Status)) {
+ return EFI_SUCCESS;
+ }
+ //
+ // Install the HECI interface
+ //
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &mHeciContext->Handle,
+ &gSmmHeciProtocolGuid,
+ &mHeciContext->HeciCtlr,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ return EFI_SUCCESS;
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/ME/Heci/Smm/HeciSmm.cif b/ReferenceCode/ME/Heci/Smm/HeciSmm.cif
new file mode 100644
index 0000000..3ddcf24
--- /dev/null
+++ b/ReferenceCode/ME/Heci/Smm/HeciSmm.cif
@@ -0,0 +1,16 @@
+<component>
+ name = "HeciSmm"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\Heci\Smm\"
+ RefName = "HeciSmm"
+[files]
+"HeciSmm.sdl"
+"HeciSmm.mak"
+"Hecicore.c"
+"Hecicore.h"
+"HeciSmm.c"
+"HeciSmm.dxs"
+"HeciHpet.c"
+"HeciHpet.h"
+"HeciSmm.inf"
+<endComponent>
diff --git a/ReferenceCode/ME/Heci/Smm/HeciSmm.dxs b/ReferenceCode/ME/Heci/Smm/HeciSmm.dxs
new file mode 100644
index 0000000..9c3676a
--- /dev/null
+++ b/ReferenceCode/ME/Heci/Smm/HeciSmm.dxs
@@ -0,0 +1,51 @@
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+/*++
+
+Copyright (c) 2010 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ HeciSmm.dxs
+
+Abstract:
+
+ Dependency expression source file.
+
+--*/
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "DxeDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+#include EFI_PROTOCOL_DEFINITION (SmmBase)
+#include EFI_PROTOCOL_DEFINITION (CpuIo)
+#include EFI_PROTOCOL_DEFINITION (PciRootBridgeIo)
+#endif
+
+DEPENDENCY_START
+ EFI_CPU_IO_PROTOCOL_GUID AND
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GUID AND
+ EFI_SMM_BASE_PROTOCOL_GUID
+DEPENDENCY_END
+
diff --git a/ReferenceCode/ME/Heci/Smm/HeciSmm.inf b/ReferenceCode/ME/Heci/Smm/HeciSmm.inf
new file mode 100644
index 0000000..600e1f2
--- /dev/null
+++ b/ReferenceCode/ME/Heci/Smm/HeciSmm.inf
@@ -0,0 +1,102 @@
+#/*++
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#--*/
+#/*++
+#
+# Copyright (c) 2007 - 2010 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# Module Name:
+#
+# HeciSmm.inf
+#
+# Abstract:
+#
+# Component description file for Heci SMM driver
+#
+#--*/
+
+[defines]
+BASE_NAME = HeciSmm
+FILE_GUID = 921CD783-3E22-4579-A71F-00D74197FCC8
+COMPONENT_TYPE = BS_DRIVER
+
+[sources.common]
+ HeciSmm.c
+ Hecicore.c
+ HeciCore.h
+ HeciHpet.c
+ HeciHpet.h
+
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueSmmDriverEntryPoint.c
+
+[includes.common]
+ $(EDK_SOURCE)\Foundation
+ $(EDK_SOURCE)\Foundation\Framework
+ $(EDK_SOURCE)\Foundation\Efi
+ $(EDK_SOURCE)\Foundation\Include
+ $(EDK_SOURCE)\Foundation\Efi\Include
+ $(EDK_SOURCE)\Foundation\Framework\Include
+ $(EDK_SOURCE)\Foundation\Library\Dxe\Include
+ $(EDK_SOURCE)\Foundation\Include\IndustryStandard
+ $(EDK_SOURCE)\Foundation\Cpu\Pentium\Include
+ $(EFI_SOURCE)\$(PROJECT_ME_ROOT)
+ $(EFI_SOURCE)\$(PROJECT_ME_ROOT)\Library\MeKernel\Dxe
+ $(EFI_SOURCE)\$(PROJECT_ME_ROOT)\Library\MeKernel\Include
+ $(EFI_SOURCE)\$(PROJECT_ME_ROOT)\Heci\Include
+
+#
+# Edk II Glue Library, some hearder are included by R9 header so have to include
+#
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)\Framework
+ $(EDK_SOURCE)\Foundation
+ $(EDK_SOURCE)\Foundation\Framework
+ $(EDK_SOURCE)\Foundation\Include\IndustryStandard
+ $(EDK_SOURCE)\Foundation\Core\Dxe
+ $(EDK_SOURCE)\Foundation\Include\Pei
+ $(EDK_SOURCE)\Foundation\Library\Dxe\Include
+ $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\Include
+
+[libraries.common]
+ MeProtocolLib
+ MeLib
+ MeChipsetLib
+ EdkProtocolLib
+ EdkFrameworkProtocolLib
+ EdkIIGlueBaseLib
+ EdkIIGlueBasePciLibPciExpress
+ EdkIIGlueDxeMemoryAllocationLib
+ EdkIIGlueDxeServicesTableLib
+ EdkIIGluePeiDxeDebugLibReportStatusCode
+ EdkIIGlueSmmRuntimeDxeReportStatusCodeLib
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiDevicePathLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT=_ModuleEntryPoint
+ DPX_SOURCE=HeciSmm.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) /D__EDKII_GLUE_MODULE_ENTRY_POINT__=InitializeHECI
+ C_FLAGS = $(C_FLAGS) /D __EDKII_GLUE_BASE_LIB__ \
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+ /D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ /D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_PEI_DXE_DEBUG_LIB_REPORT_STATUS_CODE__\
+ /D __EDKII_GLUE_SMM_RUNTIME_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__\
+ /D __EDKII_GLUE_UEFI_DEVICE_PATH_LIB__
diff --git a/ReferenceCode/ME/Heci/Smm/HeciSmm.mak b/ReferenceCode/ME/Heci/Smm/HeciSmm.mak
new file mode 100644
index 0000000..31006bc
--- /dev/null
+++ b/ReferenceCode/ME/Heci/Smm/HeciSmm.mak
@@ -0,0 +1,64 @@
+# MAK file for the ModulePart:HeciSmm
+all : HeciSmm
+
+HeciSmm : $(BUILD_DIR)\HeciSmm.mak HeciSmmBin
+
+$(BUILD_DIR)\HeciSmm.mak : $(HeciSmm_DIR)\$(@B).cif $(HeciSmm_DIR)\$(@B).mak $(CP_BUILD_RULES)
+ $(CIF2MAK) $(HeciSmm_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+HeciSmm_INCLUDES= \
+ $(EDK_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(ME_INCLUDES)\
+ /I$(INTEL_COUGAR_POINT_INCLUDE_DIR)
+
+
+HeciSmm_LIBS=\
+ $(EDKPROTOCOLLIB)\
+ $(MeProtocolLib_LIB)\
+ $(MeLibDxe_LIB)\
+ $(MeChipsetDxeLib_LIB)\
+ $(MeGuidLib_LIB)\
+ $(EFISCRIPTLIB)\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(EFIGUIDLIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueUefiLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(EdkIIGlueDxeServicesTableLib_LIB)\
+ $(EFIDRIVERLIB)\
+ $(RcFviDxeLib_LIB)\
+ $(PchPlatformDxeLib_LIB)
+
+HeciSmm_DEFINES=$(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=InitializeHECI"\
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_UEFI_LIB__\
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+ /D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+
+HeciSmmBin : $(HeciSmm_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\HeciSmm.mak all\
+ MAKEFILE=$(BUILD_DIR)\HeciSmm.mak\
+ "MY_INCLUDES=$(HeciSmm_INCLUDES)"\
+ "MY_DEFINES=$(HeciSmm_DEFINES)"\
+ GUID=921CD783-3E22-4579-A71F-00D74197FCC8\
+ DEPEX1=$(HeciSmm_DIR)\HeciSmm.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=RT_DRIVER\
+ EDKIIModule=SMMDRIVER\
+ COMPRESS=1
diff --git a/ReferenceCode/ME/Heci/Smm/HeciSmm.sdl b/ReferenceCode/ME/Heci/Smm/HeciSmm.sdl
new file mode 100644
index 0000000..3165eee
--- /dev/null
+++ b/ReferenceCode/ME/Heci/Smm/HeciSmm.sdl
@@ -0,0 +1,25 @@
+TOKEN
+ Name = "HeciSmm_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable HeciSmm Suppport in Project"
+End
+
+MODULE
+ Help = "Includes HeciSmm.mak to Project"
+ File = "HeciSmm.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\HeciSmm.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+
+PATH
+ Name = "HeciSmm_DIR"
+ Help = "iAMT Hec SMM Driver files source directory"
+End \ No newline at end of file
diff --git a/ReferenceCode/ME/Heci/Smm/Hecicore.c b/ReferenceCode/ME/Heci/Smm/Hecicore.c
new file mode 100644
index 0000000..612f2f6
--- /dev/null
+++ b/ReferenceCode/ME/Heci/Smm/Hecicore.c
@@ -0,0 +1,1585 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+/*++
+
+Copyright (c) 2008 - 2010 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ Hecicore.c
+
+Abstract:
+
+ Heci driver core. For Dxe Phase, determines the HECI device and initializes it.
+
+--*/
+#include "HeciHpet.h"
+#include "HeciCore.h"
+#include "HeciRegs.h"
+#include "MeState.h"
+
+//
+// //////////////////////////////////////////////////////////////////////////////////
+// Globals used in Heci driver
+////////////////////////////////////////////////////////////////////////////////////
+//
+UINT16 HECICtlrBDF;
+static UINT32 HeciMBAR = 0;
+
+//
+// //////////////////////////////////////////////////////////////////////////////////
+// Macro definition for function used in Heci driver
+////////////////////////////////////////////////////////////////////////////////////
+//
+#define R_PCH_RCRB_FUNC_DIS2 0x3428
+
+UINT32
+MmIoReadDword (
+ UINTN a
+ )
+/*++
+
+Routine Description:
+
+ The routing of MmIo Read Dword
+
+Arguments:
+
+ a - The address of Mmio
+
+Returns:
+
+ Return the valut of MmIo Read
+
+--*/
+{
+ volatile HECI_HOST_CONTROL_REGISTER *HeciRegHCsrPtr;
+
+ HeciRegHCsrPtr = (HECI_HOST_CONTROL_REGISTER *) a;
+ return HeciRegHCsrPtr->ul;
+}
+
+VOID
+MmIoWriteDword (
+ UINTN a,
+ UINT32 b
+ )
+/*++
+
+Routine Description:
+
+ The routing of MmIo Write Dword
+
+Arguments:
+
+ a - The address of Mmio
+ b - Value revised
+
+Returns:
+
+ None
+
+--*/
+{
+ volatile HECI_HOST_CONTROL_REGISTER *HeciRegHCsrPtr;
+
+ HeciRegHCsrPtr = (HECI_HOST_CONTROL_REGISTER *) a;
+
+ HeciRegHCsrPtr->ul = b;
+}
+
+#define MMIOREADDWORD(a) MmIoReadDword (a)
+#define MMIOWRITEDWORD(a, b) MmIoWriteDword (a, b)
+
+//
+// Extern for shared HECI data and protocols
+//
+extern HECI_INSTANCE_SMM *mHeciContext;
+
+//
+// //////////////////////////////////////////////////////////////////////////////////
+// Forward declaration
+////////////////////////////////////////////////////////////////////////////////////
+//
+UINT8
+FilledSlots (
+ IN UINT32 ReadPointer,
+ IN UINT32 WritePointer
+ );
+
+EFI_STATUS
+OverflowCB (
+ IN UINT32 ReadPointer,
+ IN UINT32 WritePointer,
+ IN UINT32 BufferDepth
+ );
+
+EFI_STATUS
+WaitForMEReady (
+ VOID
+ );
+
+//
+// Heci driver function definitions
+//
+EFI_STATUS
+InitializeHeciPrivate (
+ VOID
+ )
+/*++
+
+ Routine Description:
+ Determines if the HECI device is present and, if present, initializes it for
+ use by the BIOS.
+
+ Arguments:
+ None.
+
+ Returns:
+ EFI_STATUS
+
+--*/
+{
+ HECI_HOST_CONTROL_REGISTER HeciRegHCsr;
+ VOLATILE HECI_HOST_CONTROL_REGISTER *HeciRegHCsrPtr;
+ UINT32 MeMode;
+ EFI_STATUS Status;
+ UINTN HeciPciAddressBase;
+
+ Status = EFI_SUCCESS;
+
+ SaveHpet ();
+
+ do {
+ //
+ // Check for ME FPT Bad
+ //
+ if ((HeciPciRead32 (R_FWSTATE) & 0x0020) != 0) {
+ Status = EFI_DEVICE_ERROR;
+ break;
+ }
+ //
+ // Check for ME error status
+ //
+ if ((HeciPciRead32 (R_FWSTATE) & 0xF000) != 0) {
+ //
+ // ME failed to start so no HECI
+ //
+ Status = EFI_DEVICE_ERROR;
+ break;
+ }
+ //
+ // Check ME Operation Mode to decice which HECI to use in SMM mode
+ //
+ Status = HeciGetMeMode (&MeMode);
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // HECI MSG is unsupported if ME MODE is in Security Override
+ //
+ mHeciContext->MeMode = MeMode;
+ if (mHeciContext->MeMode == ME_MODE_DEBUG) {
+ Status = EFI_UNSUPPORTED;
+ break;
+ }
+
+ HeciPciAddressBase = PCI_LIB_ADDRESS (
+ ME_BUS,
+ ME_DEVICE_NUMBER,
+ HECI_FUNCTION_NUMBER,
+ 0
+ );
+ mHeciContext->HeciDevSaveEnable = Heci2DevSaveEnable;
+ mHeciContext->PciAddressBase = HeciPciAddressBase;
+
+ //
+ // Store HECI vendor and device information away
+ //
+ mHeciContext->DeviceInfo = PciRead16 (HeciPciAddressBase + PCI_DEVICE_ID_OFFSET);
+
+ //
+ // Check for HECI-2 PCI device availability
+ //
+ if (mHeciContext->DeviceInfo == 0xFFFF) {
+ Status = EFI_DEVICE_ERROR;
+ break;
+ }
+ //
+ // Store HECI revision ID
+ //
+ mHeciContext->RevisionInfo = PciRead8 (HeciPciAddressBase + PCI_REVISION_ID_OFFSET);
+
+ //
+ // Get HECI_MBAR and see if it is programmed
+ // to a useable value
+ //
+ mHeciContext->HeciMBAR = PciRead32 (HeciPciAddressBase + R_HECIMBAR) & 0xFFFFFFF0;
+ HeciMBAR = mHeciContext->HeciMBAR;
+
+ //
+ // Load temporary address for HECI_MBAR if one is not assigned
+ //
+ if (mHeciContext->HeciMBAR == 0) {
+ //
+ // mHeciContext->HeciMBAR = mHeciContext->DefaultHeciBar;
+ // PciWrite32 (HeciPciAddressBase + R_HECIMBAR, mHeciContext->HeciMBAR);
+ // HeciMBAR = mHeciContext->HeciMBAR;
+ //
+ DEBUG ((EFI_D_ERROR, "Heci MMIO Bar not programmed in SMM phase\n"));
+ }
+ //
+ // Enable HECI BME and MSE
+ //
+ PciOr8 (
+ HeciPciAddressBase + PCI_COMMAND_OFFSET,
+ EFI_PCI_COMMAND_MEMORY_SPACE | EFI_PCI_COMMAND_BUS_MASTER
+ );
+
+ //
+ // Set HECI interrupt delivery mode.
+ // HECI-2 using legacy/MSI interrupt
+ //
+ PciAnd8 (HeciPciAddressBase + R_HIDM, 0xFC);
+
+ //
+ // Need to do following on ME init:
+ //
+ // 1) wait for ME_CSR_HA reg ME_RDY bit set
+ //
+ if (WaitForMEReady () != EFI_SUCCESS) {
+ Status = EFI_TIMEOUT;
+ break;
+ }
+ //
+ // 2) setup H_CSR reg as follows:
+ // a) Make sure H_RST is clear
+ // b) Set H_RDY
+ // c) Set H_IG
+ //
+ HeciRegHCsrPtr = (VOID *) (UINTN) (mHeciContext->HeciMBAR + H_CSR);
+ HeciRegHCsr.ul = HeciRegHCsrPtr->ul;
+ if (HeciRegHCsrPtr->r.H_RDY == 0) {
+ HeciRegHCsr.r.H_RST = 0;
+ HeciRegHCsr.r.H_RDY = 1;
+ HeciRegHCsr.r.H_IG = 1;
+ HeciRegHCsrPtr->ul = HeciRegHCsr.ul;
+ }
+
+ } while (EFI_ERROR (Status));
+
+ RestoreHpet ();
+
+ return Status;
+}
+
+EFI_STATUS
+WaitForMEReady (
+ VOID
+ )
+/*++
+
+ Routine Description:
+ Waits for the ME to report that it is ready for communication over the HECI
+ interface.
+
+ Arguments:
+ None.
+
+ Returns:
+ EFI_STATUS
+
+--*/
+{
+ UINT32 TimerStart;
+ UINT32 TimerEnd;
+ HECI_ME_CONTROL_REGISTER HeciRegMeCsrHa;
+
+ //
+ // Wait for ME ready
+ //
+ //
+ // Check for ME ready status
+ //
+ StartTimer (&TimerStart, &TimerEnd, HECI_INIT_TIMEOUT);
+ HeciRegMeCsrHa.ul = MMIOREADDWORD (HeciMBAR + ME_CSR_HA);
+ while (HeciRegMeCsrHa.r.ME_RDY_HRA == 0) {
+ //
+ // If 5 second timeout has expired, return fail
+ //
+ if (Timeout (TimerStart, TimerEnd) != EFI_SUCCESS) {
+ return EFI_TIMEOUT;
+ }
+ //
+ // Perform IO delay
+ //
+ IoDelay (HECI_WAIT_DELAY);
+
+ HeciRegMeCsrHa.ul = MMIOREADDWORD (HeciMBAR + ME_CSR_HA);
+ }
+ //
+ // ME ready!!!
+ //
+ return EFI_SUCCESS;
+}
+
+BOOLEAN
+CheckForHeciReset (
+ VOID
+ )
+/*++
+
+ Routine Description:
+ Checks if HECI reset has occured.
+
+ Arguments:
+ None.
+
+ Returns:
+ TRUE - HECI reset occurred
+ FALSE - No HECI reset occurred
+
+--*/
+{
+ HECI_HOST_CONTROL_REGISTER HeciRegHCsr;
+ HECI_ME_CONTROL_REGISTER HeciRegMeCsrHa;
+
+ //
+ // Init Host & ME CSR
+ //
+ HeciRegHCsr.ul = MMIOREADDWORD (HeciMBAR + H_CSR);
+ HeciRegMeCsrHa.ul = MMIOREADDWORD (HeciMBAR + ME_CSR_HA);
+
+ if ((HeciRegMeCsrHa.r.ME_RDY_HRA == 0) || (HeciRegHCsr.r.H_RDY == 0)) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+EFI_STATUS
+HeciInitialize (
+ VOID
+ )
+/*++
+
+ Routine Description:
+ Determines if the HECI device is present and, if present, initializes it for
+ use by the BIOS.
+
+ Arguments:
+ None.
+
+ Returns:
+ EFI_STATUS
+
+--*/
+{
+ HECI_HOST_CONTROL_REGISTER HeciRegHCsr;
+
+ //
+ // Make sure that HECI device BAR is correct and device is enabled.
+ //
+ HeciMBAR = CheckAndFixHeciForAccess ();
+
+ //
+ // Need to do following on ME init:
+ //
+ // 1) wait for ME_CSR_HA reg ME_RDY bit set
+ //
+ if (WaitForMEReady () != EFI_SUCCESS) {
+ return EFI_TIMEOUT;
+ }
+ //
+ // 2) setup H_CSR reg as follows:
+ // a) Make sure H_RST is clear
+ // b) Set H_RDY
+ // c) Set H_IG
+ //
+ HeciRegHCsr.ul = MMIOREADDWORD (HeciMBAR + H_CSR);
+ if (HeciRegHCsr.r.H_RDY == 0) {
+ HeciRegHCsr.r.H_RST = 0;
+ HeciRegHCsr.r.H_RDY = 1;
+ HeciRegHCsr.r.H_IG = 1;
+ MMIOWRITEDWORD (HeciMBAR + H_CSR, HeciRegHCsr.ul);
+ }
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+HeciReInitialize (
+ VOID
+ )
+/*++
+
+ Routine Description:
+ Heci Re-initializes it for Host
+
+ Arguments:
+ None.
+
+ Returns:
+ EFI_STATUS
+
+--*/
+{
+ HECI_HOST_CONTROL_REGISTER HeciRegHCsr;
+ EFI_STATUS Status;
+
+ Status = EFI_SUCCESS;
+ //
+ // Need to do following on ME init:
+ //
+ // 1) wait for HOST_CSR_HA reg H_RDY bit set
+ //
+ // if (WaitForHostReady() != EFI_SUCCESS) {
+ //
+ if (MeResetWait (HECI_INIT_TIMEOUT) != EFI_SUCCESS) {
+ return EFI_TIMEOUT;
+ }
+
+ HeciRegHCsr.ul = MMIOREADDWORD (HeciMBAR + H_CSR);
+ if (HeciRegHCsr.r.H_RDY == 0) {
+ Status = ResetHeciInterface ();
+
+ }
+
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+HeciReInitialize2 (
+ VOID
+ )
+/*++
+
+ Routine Description:
+ Heci Re-initializes it for Me
+
+ Arguments:
+ None.
+
+ Returns:
+ EFI_STATUS
+
+--*/
+{
+ HECI_ME_CONTROL_REGISTER HeciRegMeCsrHa;
+ EFI_STATUS Status;
+ UINT32 TimerStart;
+ UINT32 TimerEnd;
+ Status = EFI_SUCCESS;
+ //
+ // Need to do following on ME init:
+ //
+ // 1) wait for HOST_CSR_HA reg H_RDY bit set
+ //
+ // if (WaitForHostReady() != EFI_SUCCESS) {
+ //
+ StartTimer (&TimerStart, &TimerEnd, HECI_INIT_TIMEOUT);
+ HeciRegMeCsrHa.ul = MMIOREADDWORD (HeciMBAR + ME_CSR_HA);
+ while (HeciRegMeCsrHa.r.ME_RDY_HRA == 1) {
+ //
+ // If 5 second timeout has expired, return fail
+ //
+ if (Timeout (TimerStart, TimerEnd) != EFI_SUCCESS) {
+ return EFI_TIMEOUT;
+ }
+
+ IoDelay (HECI_WAIT_DELAY);
+
+ HeciRegMeCsrHa.ul = MMIOREADDWORD (HeciMBAR + ME_CSR_HA);
+ }
+
+ if (WaitForMEReady () != EFI_SUCCESS) {
+ return EFI_TIMEOUT;
+ }
+
+ return Status;
+}
+
+EFI_STATUS
+HECIPacketRead (
+ IN UINT32 Blocking,
+ OUT HECI_MESSAGE_HEADER *MessageHeader,
+ OUT UINT32 *MessageData,
+ IN OUT UINT32 *Length
+ )
+/*++
+
+ Routine Description:
+ Function to pull one messsage packet off the HECI circular buffer.
+ Corresponds to HECI HPS (part of) section 4.2.4
+
+
+ Arguments:
+ Blocking - Used to determine if the read is BLOCKING or NON_BLOCKING.
+ MessageHeader - Pointer to a buffer for the message header.
+ MessageData - Pointer to a buffer to recieve the message in.
+ Length - On input is the size of the callers buffer in bytes. On
+ output this is the size of the packet in bytes.
+
+ Returns:
+ EFI_STATUS
+
+--*/
+{
+ BOOLEAN GotMessage;
+ UINT32 TimerStart;
+ UINT32 TimerEnd;
+ UINT32 TimerStart1;
+ UINT32 TimerEnd1;
+ UINT32 i;
+ UINT32 LengthInDwords;
+ HECI_ME_CONTROL_REGISTER HeciRegMeCsrHa;
+ HECI_HOST_CONTROL_REGISTER HeciRegHCsr;
+
+ GotMessage = FALSE;
+ //
+ // Initialize memory mapped register pointers
+ //
+ // VOLATILE HECI_HOST_CONTROL_REGISTER *HeciRegHCsrPtr = (VOID*)(mHeciContext->HeciMBAR + H_CSR);
+ // VOLATILE HECI_ME_CONTROL_REGISTER *HeciRegMeCsrHaPtr = (VOID*)(mHeciContext->HeciMBAR + ME_CSR_HA);
+ // VOLATILE UINT32 *HeciRegMeCbrwPtr = (VOID*)(mHeciContext->HeciMBAR + ME_CB_RW);
+ //
+ // clear Interrupt Status bit
+ //
+ HeciRegHCsr.ul = MMIOREADDWORD (HeciMBAR + H_CSR);
+ HeciRegHCsr.r.H_IS = 1;
+
+ //
+ // test for circular buffer overflow
+ //
+ HeciRegMeCsrHa.ul = MMIOREADDWORD (HeciMBAR + ME_CSR_HA);
+ if (OverflowCB (
+ HeciRegMeCsrHa.r.ME_CBRP_HRA,
+ HeciRegMeCsrHa.r.ME_CBWP_HRA,
+ HeciRegMeCsrHa.r.ME_CBD_HRA
+ ) != EFI_SUCCESS) {
+ //
+ // if we get here, the circular buffer is overflowed
+ //
+ *Length = 0;
+ return EFI_DEVICE_ERROR;
+ }
+ //
+ // If NON_BLOCKING, exit if the circular buffer is empty
+ //
+ HeciRegMeCsrHa.ul = MMIOREADDWORD (HeciMBAR + ME_CSR_HA);;
+ if ((FilledSlots (HeciRegMeCsrHa.r.ME_CBRP_HRA, HeciRegMeCsrHa.r.ME_CBWP_HRA) == 0) && (Blocking == NON_BLOCKING)) {
+ *Length = 0;
+ return EFI_NO_RESPONSE;
+ }
+ //
+ // Start timeout counter
+ //
+ StartTimer (&TimerStart, &TimerEnd, HECI_READ_TIMEOUT);
+
+ //
+ // loop until we get a message packet
+ //
+ while (!GotMessage) {
+ //
+ // If 1 second timeout has expired, return fail as we have not yet received a full message.
+ //
+ if (Timeout (TimerStart, TimerEnd) != EFI_SUCCESS) {
+ *Length = 0;
+ return EFI_TIMEOUT;
+ }
+ //
+ // Read one message from HECI buffer and advance read pointer. Make sure
+ // that we do not pass the write pointer.
+ //
+ HeciRegMeCsrHa.ul = MMIOREADDWORD (HeciMBAR + ME_CSR_HA);;
+ if (FilledSlots (HeciRegMeCsrHa.r.ME_CBRP_HRA, HeciRegMeCsrHa.r.ME_CBWP_HRA) > 0) {
+ //
+ // Eat the HECI Message header
+ //
+ MessageHeader->Data = MMIOREADDWORD (HeciMBAR + ME_CB_RW);
+
+ //
+ // Compute required message length in DWORDS
+ //
+ LengthInDwords = ((MessageHeader->Fields.Length + 3) / 4);
+
+ //
+ // Just return success if Length is 0
+ //
+ if (MessageHeader->Fields.Length == 0) {
+ //
+ // Set Interrupt Generate bit and return
+ //
+ MMIOREADDWORD (HeciMBAR + H_CSR);
+ HeciRegHCsr.r.H_IG = 1;
+ MMIOWRITEDWORD (HeciMBAR + H_CSR, HeciRegHCsr.ul);
+ *Length = 0;
+ return EFI_SUCCESS;
+ }
+ //
+ // Make sure that the message does not overflow the circular buffer.
+ //
+ HeciRegMeCsrHa.ul = MMIOREADDWORD (HeciMBAR + ME_CSR_HA);
+ if ((MessageHeader->Fields.Length + sizeof (HECI_MESSAGE_HEADER)) > (HeciRegMeCsrHa.r.ME_CBD_HRA * 4)) {
+ *Length = 0;
+ return EFI_DEVICE_ERROR;
+ }
+ //
+ // Make sure that the callers buffer can hold the correct number of DWORDS
+ //
+ if ((MessageHeader->Fields.Length) <= *Length) {
+ //
+ // Start timeout counter for inner loop
+ //
+ StartTimer (&TimerStart1, &TimerEnd1, HECI_READ_TIMEOUT);
+
+ //
+ // Wait here until entire message is present in circular buffer
+ //
+ HeciRegMeCsrHa.ul = MMIOREADDWORD (HeciMBAR + ME_CSR_HA);
+ while (LengthInDwords > FilledSlots (HeciRegMeCsrHa.r.ME_CBRP_HRA, HeciRegMeCsrHa.r.ME_CBWP_HRA)) {
+ //
+ // If 1 second timeout has expired, return fail as we have not yet received a full message
+ //
+ if (Timeout (TimerStart1, TimerEnd1) != EFI_SUCCESS) {
+ *Length = 0;
+ return EFI_TIMEOUT;
+ }
+ //
+ // Wait before we read the register again
+ //
+ IoDelay (HECI_WAIT_DELAY);
+
+ //
+ // Read the register again
+ //
+ HeciRegMeCsrHa.ul = MMIOREADDWORD (HeciMBAR + ME_CSR_HA);
+ }
+ //
+ // copy rest of message
+ //
+ for (i = 0; i < LengthInDwords; i++) {
+ MessageData[i] = MMIOREADDWORD (HeciMBAR + ME_CB_RW);
+ }
+ //
+ // Update status and length
+ //
+ GotMessage = TRUE;
+ *Length = MessageHeader->Fields.Length;
+
+ } else {
+ //
+ // Message packet is larger than caller's buffer
+ //
+ *Length = 0;
+ return EFI_BUFFER_TOO_SMALL;
+ }
+ }
+ //
+ // Wait before we try to get a message again
+ //
+ IoDelay (HECI_WAIT_DELAY);
+ }
+ //
+ // Read ME_CSR_HA. If the ME_RDY bit is 0, then an ME reset occurred during the
+ // transaction and the message should be discarded as bad data may have been retrieved
+ // from the host's circular buffer
+ //
+ HeciRegMeCsrHa.ul = MMIOREADDWORD (HeciMBAR + ME_CSR_HA);
+ if (HeciRegMeCsrHa.r.ME_RDY_HRA == 0) {
+ *Length = 0;
+ return EFI_DEVICE_ERROR;
+ }
+ //
+ // Set Interrupt Generate bit
+ //
+ HeciRegHCsr.ul = MMIOREADDWORD (HeciMBAR + H_CSR);
+ HeciRegHCsr.r.H_IG = 1;
+ MMIOWRITEDWORD (HeciMBAR + H_CSR, HeciRegHCsr.ul);
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+HeciReceive (
+ IN UINT32 Blocking,
+ IN OUT UINT32 *MessageBody,
+ IN OUT UINT32 *Length
+ )
+/*++
+
+ Routine Description:
+ Reads a message from the ME across HECI.
+
+ Arguments:
+ Blocking - Used to determine if the read is BLOCKING or NON_BLOCKING.
+ MessageBody - Pointer to a buffer used to receive a message.
+ Length - Pointer to the length of the buffer on input and the length
+ of the message on return. (in bytes)
+
+ Returns:
+ EFI_STATUS
+
+--*/
+{
+ HECI_MESSAGE_HEADER PacketHeader;
+ UINT32 CurrentLength;
+ UINT32 MessageComplete;
+ EFI_STATUS Status;
+ UINT32 PacketBuffer;
+ UINT32 timer_start;
+ UINT32 timer_end;
+ UINT32 MeDeviceState;
+ BOOLEAN QuitFlag;
+
+ Status = EFI_SUCCESS;
+ CurrentLength = 0;
+ MessageComplete = 0;
+ QuitFlag = FALSE;
+
+ SaveHpet ();
+
+ do {
+ if (mHeciContext->MeMode == ME_MODE_SECOVER) {
+ Status = EFI_UNSUPPORTED;
+ break;
+ }
+ //
+ // Enable HECI and Save the Device State
+ //
+ mHeciContext->HeciDevSaveEnable (&MeDeviceState);
+
+ //
+ // Make sure that HECI device BAR is correct and device is enabled.
+ //
+ HeciMBAR = CheckAndFixHeciForAccess ();
+
+ //
+ // Make sure we do not have a HECI reset
+ //
+ if (CheckForHeciReset ()) {
+ //
+ // if HECI reset than try to re-init HECI
+ //
+ Status = HeciInitialize ();
+
+ if (EFI_ERROR (Status)) {
+ HeciDevRestore (MeDeviceState);
+ Status = EFI_DEVICE_ERROR;
+ break;
+ }
+ }
+ //
+ // Make sure that HECI is ready for communication.
+ //
+ if (WaitForMEReady () != EFI_SUCCESS) {
+ HeciDevRestore (MeDeviceState);
+ Status = EFI_TIMEOUT;
+ break;
+ }
+ //
+ // Set up timer for BIOS timeout.
+ //
+ StartTimer (&timer_start, &timer_end, HECI_READ_TIMEOUT);
+ while ((CurrentLength < *Length) && (MessageComplete == 0)) {
+ //
+ // If 1 second timeout has expired, return fail as we have not yet received a full message
+ //
+ if (Timeout (timer_start, timer_end) != EFI_SUCCESS) {
+ Status = EFI_TIMEOUT;
+ QuitFlag = TRUE;
+ break;
+ }
+
+ PacketBuffer = *Length - CurrentLength;
+ Status = HECIPacketRead (
+ Blocking,
+ &PacketHeader,
+ (UINT32 *) &MessageBody[CurrentLength / 4],
+ &PacketBuffer
+ );
+
+ //
+ // Check for error condition on read
+ //
+ if (EFI_ERROR (Status)) {
+ *Length = 0;
+ QuitFlag = TRUE;
+ break;
+ }
+ //
+ // Get completion status from the packet header
+ //
+ MessageComplete = PacketHeader.Fields.MessageComplete;
+
+ //
+ // Check for zero length messages
+ //
+ if (PacketBuffer == 0) {
+ //
+ // If we are not in the middle of a message, and we see Message Complete,
+ // this is a valid zero-length message.
+ //
+ if ((CurrentLength == 0) && (MessageComplete == 1)) {
+ *Length = 0;
+ QuitFlag = TRUE;
+ break;
+ } else {
+ //
+ // We should not expect a zero-length message packet except as described above.
+ //
+ *Length = 0;
+ Status = EFI_DEVICE_ERROR;
+ QuitFlag = TRUE;
+ break;
+ }
+ }
+ //
+ // Track the length of what we have read so far
+ //
+ CurrentLength += PacketBuffer;
+
+ }
+
+ if (QuitFlag == TRUE) {
+ break;
+ }
+ //
+ // If we get here the message should be complete, if it is not
+ // the caller's buffer was not large enough.
+ //
+ if (MessageComplete == 0) {
+ *Length = 0;
+ Status = EFI_BUFFER_TOO_SMALL;
+ }
+
+ if (*Length != 0) {
+ *Length = CurrentLength;
+ }
+ //
+ // Restore HECI Device State
+ //
+ HeciDevRestore (MeDeviceState);
+
+ } while (EFI_ERROR (Status) && (Status != EFI_BUFFER_TOO_SMALL));
+ RestoreHpet ();
+
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+HeciSend (
+ IN UINT32 *Message,
+ IN UINT32 Length,
+ IN UINT8 HostAddress,
+ IN UINT8 MeAddress
+ )
+/*++
+
+ Routine Description:
+ Function sends one messsage (of any length) through the HECI circular buffer.
+
+ Arguments:
+ Message - Pointer to the message data to be sent.
+ Length - Length of the message in bytes.
+ HostAddress - The address of the host processor.
+ MeAddress - Address of the ME subsystem the message is being sent to.
+
+ Returns:
+ EFI_STATUS
+
+--*/
+{
+ UINT32 CBLength;
+ UINT32 SendLength;
+ UINT32 CurrentLength;
+ HECI_MESSAGE_HEADER MessageHeader;
+ EFI_STATUS Status;
+ HECI_HOST_CONTROL_REGISTER HeciRegHCsr;
+ UINT32 MeDeviceState;
+
+ Status = EFI_SUCCESS;
+ CurrentLength = 0;
+
+ SaveHpet ();
+
+ do {
+ if (mHeciContext->MeMode == ME_MODE_SECOVER) {
+ Status = EFI_UNSUPPORTED;
+ break;
+ }
+ //
+ // Enable HECI and Save the Device State
+ //
+ mHeciContext->HeciDevSaveEnable (&MeDeviceState);
+
+ //
+ // Make sure that HECI device BAR is correct and device is enabled.
+ //
+ HeciMBAR = CheckAndFixHeciForAccess ();
+
+ //
+ // Make sure we do not have a HECI reset
+ //
+ if (CheckForHeciReset ()) {
+ //
+ // if HECI reset than try to re-init HECI
+ //
+ Status = HeciInitialize ();
+
+ if (EFI_ERROR (Status)) {
+ HeciDevRestore (MeDeviceState);
+ Status = EFI_DEVICE_ERROR;
+ break;
+ }
+ }
+ //
+ // Make sure that HECI is ready for communication.
+ //
+ if (WaitForMEReady () != EFI_SUCCESS) {
+ HeciDevRestore (MeDeviceState);
+ Status = EFI_TIMEOUT;
+ break;
+ }
+ //
+ // Set up memory mapped registers
+ //
+ HeciRegHCsr.ul = MMIOREADDWORD (HeciMBAR + H_CSR);
+
+ //
+ // Grab Circular Buffer length
+ //
+ CBLength = HeciRegHCsr.r.H_CBD;
+
+ //
+ // Prepare message header
+ //
+ MessageHeader.Data = 0;
+ MessageHeader.Fields.MeAddress = MeAddress;
+ MessageHeader.Fields.HostAddress = HostAddress;
+
+ //
+ // Break message up into CB-sized packets and loop until completely sent
+ //
+ while (Length > CurrentLength) {
+ //
+ // Set the Message Complete bit if this is our last packet in the message.
+ // Needs to be 'less than' to account for the header.
+ //
+ if ((((Length - CurrentLength) + 3) / 4) < CBLength) {
+ MessageHeader.Fields.MessageComplete = 1;
+ }
+ //
+ // Calculate length for Message Header
+ // header length == smaller of circular buffer or remaining message (both account for the size of the header)
+ //
+ SendLength = ((CBLength < (((Length - CurrentLength) + 3) / 4)) ? ((CBLength - 1) * 4) : (Length - CurrentLength));
+ MessageHeader.Fields.Length = SendLength;
+
+ //
+ // send the current packet (CurrentLength can be treated as the index into the message buffer)
+ //
+ Status = HeciPacketWrite (&MessageHeader, (UINT32 *) ((UINTN) Message + CurrentLength));
+ if (EFI_ERROR (Status)) {
+ break;
+ }
+ //
+ // Update the length information
+ //
+ CurrentLength += SendLength;
+ }
+
+ if (EFI_ERROR (Status)) {
+ break;
+ }
+ //
+ // Restore HECI Device State
+ //
+ HeciDevRestore (MeDeviceState);
+
+ } while (EFI_ERROR (Status));
+
+ RestoreHpet ();
+
+ return Status;
+}
+
+EFI_STATUS
+HeciPacketWrite (
+ IN HECI_MESSAGE_HEADER *MessageHeader,
+ IN UINT32 *MessageData
+ )
+/*++
+
+ Routine Description:
+ Function sends one messsage packet through the HECI circular buffer
+ Corresponds to HECI HPS (part of) section 4.2.3
+
+ Arguments:
+ MessageHeader - Pointer to the message header.
+ MessageData - Pointer to the actual message data.
+
+ Returns:
+ EFI_STATUS
+
+--*/
+{
+ UINT32 timer_start;
+ UINT32 timer_end;
+ UINT32 i;
+ UINT32 LengthInDwords;
+ HECI_HOST_CONTROL_REGISTER HeciRegHCsr;
+ HECI_ME_CONTROL_REGISTER HeciRegMeCsrHa;
+
+ //
+ // VOLATILE HECI_HOST_CONTROL_REGISTER *HeciRegHCsrPtr = (VOID*)(mHeciContext->HeciMBAR + H_CSR);
+ // VOLATILE HECI_ME_CONTROL_REGISTER *HeciRegMeCsrHaPtr = (VOID*)(mHeciContext->HeciMBAR + ME_CSR_HA);
+ // VOLATILE UINT32 *HeciRegHCbwwPtr = (VOID*)(mHeciContext->HeciMBAR + H_CB_WW);
+ //
+ // Make sure that HECI is ready for communication.
+ //
+ if (WaitForMEReady () != EFI_SUCCESS) {
+ return EFI_TIMEOUT;
+ }
+ //
+ // Start timeout counter
+ //
+ StartTimer (&timer_start, &timer_end, HECI_SEND_TIMEOUT);
+
+ //
+ // Compute message length in DWORDS
+ //
+ LengthInDwords = ((MessageHeader->Fields.Length + 3) / 4);
+
+ //
+ // Wait until there is sufficient room in the circular buffer
+ // Must have room for message and message header
+ //
+ HeciRegHCsr.ul = MMIOREADDWORD (HeciMBAR + H_CSR);
+ while ((LengthInDwords + 1) > (HeciRegHCsr.r.H_CBD - FilledSlots (HeciRegHCsr.r.H_CBRP, HeciRegHCsr.r.H_CBWP))) {
+ //
+ // If 1 second timeout has expired, return fail as the circular buffer never emptied
+ //
+ if (Timeout (timer_start, timer_end) != EFI_SUCCESS) {
+ return EFI_TIMEOUT;
+ }
+ //
+ // Wait before we read the register again
+ //
+ IoDelay (HECI_WAIT_DELAY);
+
+ //
+ // Read Host CSR for next iteration
+ //
+ HeciRegHCsr.ul = MMIOREADDWORD (HeciMBAR + H_CSR);
+ }
+ //
+ // Write Message Header
+ //
+ MMIOWRITEDWORD (HeciMBAR + H_CB_WW, MessageHeader->Data);
+
+ //
+ // Write Message Body
+ //
+ for (i = 0; i < LengthInDwords; i++) {
+ MMIOWRITEDWORD (HeciMBAR + H_CB_WW, MessageData[i]);
+ }
+ //
+ // Set Interrupt Generate bit
+ //
+ HeciRegHCsr.ul = MMIOREADDWORD (HeciMBAR + H_CSR);
+ HeciRegHCsr.r.H_IG = 1;
+ MMIOWRITEDWORD (HeciMBAR + H_CSR, HeciRegHCsr.ul);
+
+ //
+ // Test if ME Ready bit is set to 1, if set to 0 a fatal error occured during
+ // the transmission of this message.
+ //
+ HeciRegMeCsrHa.ul = MMIOREADDWORD (HeciMBAR + ME_CSR_HA);
+ if (HeciRegMeCsrHa.r.ME_RDY_HRA == 0) {
+ return EFI_DEVICE_ERROR;
+ }
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+HeciSendwACK (
+ IN OUT UINT32 *Message,
+ IN UINT32 Length,
+ IN OUT UINT32 *RecLength,
+ IN UINT8 HostAddress,
+ IN UINT8 MeAddress
+ )
+/*++
+
+ Routine Description:
+ Function sends one messsage through the HECI circular buffer and waits
+ for the corresponding ACK message.
+
+ Arguments:
+ Message - Pointer to the message buffer.
+ SendLength - Length of the message in bytes.
+ RecLength - Length of the message response in bytes.
+ HostAddress - Address of the sending entity.
+ MeAddress - Address of the ME entity that should receive the message.
+
+ Returns:
+ EFI_STATUS
+
+--*/
+{
+ EFI_STATUS Status;
+ UINT16 RetryCount;
+ UINT32 TempRecLength;
+
+ if (mHeciContext->MeMode == ME_MODE_SECOVER) {
+ return EFI_UNSUPPORTED;
+ }
+ //
+ // Send the message
+ //
+ Status = HeciSend (Message, Length, HostAddress, MeAddress);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ //
+ // Wait for ACK message
+ //
+ TempRecLength = *RecLength;
+ for (RetryCount = 0; RetryCount < HECI_MAX_RETRY; RetryCount++) {
+ //
+ // Read Message
+ //
+ Status = HeciReceive (BLOCKING, Message, &TempRecLength);
+ if (!EFI_ERROR (Status)) {
+ break;
+ }
+ //
+ // Reload receive length as it has been modified by the read function
+ //
+ TempRecLength = *RecLength;
+ }
+ //
+ // Return read length and status
+ //
+ *RecLength = TempRecLength;
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+MeResetWait (
+ IN UINT32 Delay
+ )
+/*++
+
+Routine Description:
+
+ Me reset and waiting for ready
+
+Arguments:
+
+ Delay - The biggest waiting time
+
+Returns:
+
+ EFI_TIMEOUT - Time out
+ EFI_SUCCESS - Me ready
+
+--*/
+{
+ HECI_HOST_CONTROL_REGISTER HeciRegHCsr;
+ UINT32 TimerStart;
+ UINT32 TimerEnd;
+
+ //
+ // Make sure that HECI device BAR is correct and device is enabled.
+ //
+ HeciMBAR = CheckAndFixHeciForAccess ();
+
+ //
+ // Wait for the HOST Ready bit to be cleared to signal a reset
+ //
+ StartTimer (&TimerStart, &TimerEnd, Delay);
+ HeciRegHCsr.ul = MMIOREADDWORD (HeciMBAR + H_CSR);
+ while (HeciRegHCsr.r.H_RDY == 1) {
+ //
+ // If timeout has expired, return fail
+ //
+ if (Timeout (TimerStart, TimerEnd) != EFI_SUCCESS) {
+ return EFI_TIMEOUT;
+ }
+
+ HeciRegHCsr.ul = MMIOREADDWORD (HeciMBAR + H_CSR);
+ }
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+ResetHeciInterface (
+ VOID
+ )
+/*++
+
+ Routine Description:
+ Function forces a reinit of the heci interface by following the reset heci interface via host algorithm
+ in HPS 0.90 doc 4-17-06 njy
+
+ Arguments:
+ none
+
+ Returns:
+ EFI_STATUS
+
+--*/
+{
+ HECI_HOST_CONTROL_REGISTER HeciRegHCsr;
+ HECI_ME_CONTROL_REGISTER HeciRegMeCsrHa;
+ UINT32 TimerStart;
+ UINT32 TimerEnd;
+
+ //
+ // Make sure that HECI device BAR is correct and device is enabled.
+ //
+ HeciMBAR = CheckAndFixHeciForAccess ();
+
+ //
+ // Enable Reset
+ //
+ HeciRegHCsr.ul = MMIOREADDWORD (HeciMBAR + H_CSR);
+ HeciRegHCsr.r.H_RST = 1;
+ HeciRegHCsr.r.H_IG = 1;
+ MMIOWRITEDWORD (HeciMBAR + H_CSR, HeciRegHCsr.ul);
+
+ //
+ // Make sure that the reset started
+ //
+ // HeciRegHCsr.ul = MMIOREADDWORD(HeciMBAR + H_CSR);
+ //
+ StartTimer (&TimerStart, &TimerEnd, HECI_INIT_TIMEOUT);
+ do {
+ //
+ // If 5 second timeout has expired, return fail
+ //
+ if (Timeout (TimerStart, TimerEnd) != EFI_SUCCESS) {
+ return EFI_TIMEOUT;
+ }
+ //
+ // Read the ME CSR
+ //
+ HeciRegHCsr.ul = MMIOREADDWORD (HeciMBAR + H_CSR);
+ } while (HeciRegHCsr.r.H_RDY == 1);
+
+ //
+ // Wait for ME to perform reset
+ //
+ // HeciRegMeCsrHa.ul = MMIOREADDWORD(HeciMBAR + ME_CSR_HA);
+ //
+ StartTimer (&TimerStart, &TimerEnd, HECI_INIT_TIMEOUT);
+ do {
+ //
+ // If 5 second timeout has expired, return fail
+ //
+ if (Timeout (TimerStart, TimerEnd) != EFI_SUCCESS) {
+ return EFI_TIMEOUT;
+ }
+ //
+ // Read the ME CSR
+ //
+ HeciRegMeCsrHa.ul = MMIOREADDWORD (HeciMBAR + ME_CSR_HA);
+ } while (HeciRegMeCsrHa.r.ME_RDY_HRA == 0);
+
+ //
+ // Make sure IS has been signaled on the HOST side
+ //
+ // HeciRegHCsr.ul = MMIOREADDWORD(HeciMBAR + H_CSR);
+ //
+ StartTimer (&TimerStart, &TimerEnd, HECI_INIT_TIMEOUT);
+ do {
+ //
+ // If 5 second timeout has expired, return fail
+ //
+ if (Timeout (TimerStart, TimerEnd) != EFI_SUCCESS) {
+ return EFI_TIMEOUT;
+ }
+ //
+ // Read the ME CSR
+ //
+ HeciRegHCsr.ul = MMIOREADDWORD (HeciMBAR + H_CSR);
+ } while (HeciRegHCsr.r.H_IS == 0);
+
+ //
+ // Enable host side interface
+ //
+ HeciRegHCsr.ul = MMIOREADDWORD (HeciMBAR + H_CSR);;
+ HeciRegHCsr.r.H_RST = 0;
+ HeciRegHCsr.r.H_IG = 1;
+ HeciRegHCsr.r.H_RDY = 1;
+ MMIOWRITEDWORD (HeciMBAR + H_CSR, HeciRegHCsr.ul);
+
+ return EFI_SUCCESS;
+}
+
+UINT8
+FilledSlots (
+ IN UINT32 ReadPointer,
+ IN UINT32 WritePointer
+ )
+/*++
+
+ Routine Description:
+ Calculate if the circular buffer has overflowed.
+ Corresponds to HECI HPS (part of) section 4.2.1
+
+ Arguments:
+ ReadPointer - Location of the read pointer.
+ WritePointer - Location of the write pointer.
+
+ Returns:
+ Number of filled slots.
+
+--*/
+{
+ UINT8 FilledSlots;
+
+ //
+ // Calculation documented in HECI HPS 0.68 section 4.2.1
+ //
+ FilledSlots = (((INT8) WritePointer) - ((INT8) ReadPointer));
+
+ return FilledSlots;
+}
+
+EFI_STATUS
+OverflowCB (
+ IN UINT32 ReadPointer,
+ IN UINT32 WritePointer,
+ IN UINT32 BufferDepth
+ )
+/*++
+
+ Routine Description:
+ Calculate if the circular buffer has overflowed
+ Corresponds to HECI HPS (part of) section 4.2.1
+
+ Arguments:
+ ReadPointer - Value read from host/me read pointer
+ WritePointer - Value read from host/me write pointer
+ BufferDepth - Value read from buffer depth register
+
+ Returns:
+ EFI_STATUS
+
+--*/
+{
+ UINT8 FilledSlots;
+
+ //
+ // Calculation documented in HECI HPS 0.68 section 4.2.1
+ //
+ FilledSlots = (((INT8) WritePointer) - ((INT8) ReadPointer));
+
+ //
+ // test for overflow
+ //
+ if (FilledSlots > ((UINT8) BufferDepth)) {
+ return EFI_DEVICE_ERROR;
+ }
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+HeciGetMeStatus (
+ IN UINT32 *MeStatus
+ )
+/*++
+
+ Routine Description:
+ Return ME Status
+
+ Arguments:
+ MeStatus pointer for status report
+
+ Returns:
+ EFI_STATUS
+
+--*/
+{
+ HECI_FWS_REGISTER MeFirmwareStatus;
+ UINT32 MeDeviceState;
+
+ if (MeStatus == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+ //
+ // Save HECI1 Device State and Enable it
+ //
+ Heci1DevSaveEnable (&MeDeviceState);
+
+ MeFirmwareStatus.ul = HeciPciRead32 (R_FWSTATE);
+
+ if (MeFirmwareStatus.r.CurrentState == ME_STATE_NORMAL && MeFirmwareStatus.r.ErrorCode == ME_ERROR_CODE_NO_ERROR) {
+ *MeStatus = ME_READY;
+ } else if (MeFirmwareStatus.r.CurrentState == ME_STATE_RECOVERY) {
+ *MeStatus = ME_IN_RECOVERY_MODE;
+ } else {
+ *MeStatus = ME_NOT_READY;
+ }
+
+ if (MeFirmwareStatus.r.FwInitComplete == ME_FIRMWARE_COMPLETED) {
+ *MeStatus |= ME_FW_INIT_COMPLETE;
+ }
+ //
+ // Save HECI Device State and Enable it
+ //
+ HeciDevRestore (MeDeviceState);
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+HeciGetMeMode (
+ IN UINT32 *MeMode
+ )
+/*++
+
+ Routine Description:
+ Return ME Mode
+
+ Arguments:
+ MeMode pointer for ME Mode report
+
+ Returns:
+ EFI_STATUS
+
+--*/
+{
+ HECI_FWS_REGISTER MeFirmwareStatus;
+ UINT32 MeDeviceState;
+
+ if (MeMode == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+ //
+ // Save HECI1 Device State and Enable it
+ //
+ Heci1DevSaveEnable (&MeDeviceState);
+
+ MeFirmwareStatus.ul = HeciPciRead32 (R_FWSTATE);
+ switch (MeFirmwareStatus.r.MeOperationMode) {
+ case ME_OPERATION_MODE_NORMAL:
+ *MeMode = ME_MODE_NORMAL;
+ break;
+
+ case ME_OPERATION_MODE_DEBUG:
+ *MeMode = ME_MODE_DEBUG;
+ break;
+
+ case ME_OPERATION_MODE_SOFT_TEMP_DISABLE:
+ *MeMode = ME_MODE_TEMP_DISABLED;
+ break;
+
+ case ME_OPERATION_MODE_SECOVR_JMPR:
+ case ME_OPERATION_MODE_SECOVR_HECI_MSG:
+ *MeMode = ME_MODE_SECOVER;
+ break;
+
+ default:
+ *MeMode = ME_MODE_FAILED;
+ }
+ //
+ // Save HECI Device State and Enable it
+ //
+ HeciDevRestore (MeDeviceState);
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+Heci1DevSaveEnable (
+ IN OUT UINT32 *DevState
+ )
+/*++
+
+ Routine Description:
+ Save HECI1 State and Enable it
+
+ Arguments:
+ DevState - Device State Save Buffer
+
+ Returns:
+ EFI_STATUS
+
+--*/
+{
+ *DevState = MMIOREADDWORD (PCH_RCRB_BASE + R_PCH_RCRB_FUNC_DIS2);
+ HeciEnable ();
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+Heci2DevSaveEnable (
+ IN OUT UINT32 *DevState
+ )
+/*++
+
+ Routine Description:
+ Save HECI2 State and Enable it
+
+ Arguments:
+ DevState - Device State Save Buffer
+
+ Returns:
+ EFI_STATUS
+
+--*/
+{
+ *DevState = MMIOREADDWORD (PCH_RCRB_BASE + R_PCH_RCRB_FUNC_DIS2);
+ Heci2Enable ();
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+HeciDevRestore (
+ IN UINT32 DevState
+ )
+/*++
+
+ Routine Description:
+ Restore HECI1&HECI2 State
+
+ Arguments:
+ DevState - Device State Save Buffer
+
+ Returns:
+ EFI_STATUS
+
+--*/
+{
+ MMIOWRITEDWORD (PCH_RCRB_BASE + R_PCH_RCRB_FUNC_DIS2, DevState);
+ MMIOREADDWORD (PCH_RCRB_BASE + R_PCH_RCRB_FUNC_DIS2);
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/ME/Heci/Smm/Hecicore.h b/ReferenceCode/ME/Heci/Smm/Hecicore.h
new file mode 100644
index 0000000..5f05c10
--- /dev/null
+++ b/ReferenceCode/ME/Heci/Smm/Hecicore.h
@@ -0,0 +1,512 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+/*++
+
+Copyright (c) 2006 - 2010 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ HeciCore.h
+
+Abstract:
+
+ Definitions for HECI driver
+
+--*/
+#ifndef _HECI_CORE_H
+#define _HECI_CORE_H
+
+#include "CpuIa32.h"
+#include "CoreBiosMsg.h"
+
+//
+// HECI bus function version
+//
+#define HBM_MINOR_VERSION 0
+#define HBM_MAJOR_VERSION 1
+
+//
+// HECI save/restore Function
+//
+typedef
+EFI_STATUS
+(EFIAPI *HECI_DEV_SAVE_ENABLE) (
+ IN OUT UINT32 *DevState
+ );
+
+//
+// HECI private data structure
+//
+typedef struct {
+ UINTN Signature;
+ EFI_HANDLE Handle;
+ UINT32 HeciMBAR;
+ UINT16 DeviceInfo;
+ UINT32 RevisionInfo;
+ SMM_HECI_PROTOCOL HeciCtlr;
+ VOLATILE UINT32 *HpetTimer;
+ UINTN PciAddressBase;
+ UINT32 DefaultHeciBar;
+ HECI_DEV_SAVE_ENABLE HeciDevSaveEnable;
+ UINT32 MeMode;
+} HECI_INSTANCE_SMM;
+
+//
+// Prototypes
+//
+EFI_STATUS
+EFIAPI
+HeciInitialize (
+ VOID
+ )
+/*++
+
+ Routine Description:
+ Determines if the HECI device is present and, if present, initializes it for
+ use by the BIOS.
+
+ Arguments:
+ None.
+
+ Returns:
+ EFI_STATUS
+
+--*/
+;
+
+EFI_STATUS
+EFIAPI
+HeciReInitialize (
+ VOID
+ )
+/*++
+
+ Routine Description:
+ Heci Re-initializes it for Host
+
+ Arguments:
+ None.
+
+ Returns:
+ EFI_STATUS
+
+--*/
+;
+
+EFI_STATUS
+EFIAPI
+HeciReInitialize2 (
+ VOID
+ )
+/*++
+
+ Routine Description:
+ Heci Re-initializes it for Me
+
+ Arguments:
+ None.
+
+ Returns:
+ EFI_STATUS
+
+--*/
+;
+
+EFI_STATUS
+EFIAPI
+HeciReceive (
+ IN UINT32 Blocking,
+ OUT UINT32 *MessageData,
+ IN OUT UINT32 *Length
+ )
+/*++
+
+ Routine Description:
+ Reads a message from the ME across HECI.
+
+ Arguments:
+ Blocking - Used to determine if the read is BLOCKING or NON_BLOCKING.
+ MessageData - Pointer to a buffer used to receive a message.
+ Length - Pointer to the length of the buffer on input and the length
+ of the message on return. (in bytes)
+
+ Returns:
+ EFI_STATUS
+
+--*/
+;
+
+EFI_STATUS
+EFIAPI
+HeciSend (
+ IN UINT32 *Message,
+ IN UINT32 Length,
+ IN UINT8 HostAddress,
+ IN UINT8 MeAddress
+ )
+/*++
+
+ Routine Description:
+ Function sends one messsage (of any length) through the HECI circular buffer.
+
+ Arguments:
+ Message - Pointer to the message data to be sent.
+ Length - Length of the message in bytes.
+ HostAddress - The address of the host processor.
+ MeAddress - Address of the ME subsystem the message is being sent to.
+
+ Returns:
+ EFI_STATUS
+
+--*/
+;
+
+EFI_STATUS
+EFIAPI
+HeciSendwACK (
+ IN OUT UINT32 *Message,
+ IN UINT32 Length,
+ IN OUT UINT32 *RecLength,
+ IN UINT8 HostAddress,
+ IN UINT8 MeAddress
+ )
+/*++
+
+ Routine Description:
+ Function sends one messsage through the HECI circular buffer and waits
+ for the corresponding ACK message.
+
+ Arguments:
+ Message - Pointer to the message buffer.
+ SendLength - Length of the message in bytes.
+ RecLength - Length of the message response in bytes.
+ HostAddress - Address of the sending entity.
+ MeAddress - Address of the ME entity that should receive the message.
+
+ Returns:
+ EFI_STATUS
+
+--*/
+;
+
+EFI_STATUS
+EFIAPI
+MeResetWait (
+ IN UINT32 Delay
+ )
+/*++
+
+Routine Description:
+
+ Me reset and waiting for ready
+
+Arguments:
+
+ Delay - The biggest waiting time
+
+Returns:
+
+ EFI_TIMEOUT - Time out
+ EFI_SUCCESS - Me ready
+
+--*/
+;
+
+EFI_STATUS
+EFIAPI
+ResetHeciInterface (
+ VOID
+ )
+/*++
+
+ Routine Description:
+ Function forces a reinit of the heci interface by following the reset heci interface via host algorithm
+ in HPS 0.90 doc 4-17-06 njy
+
+ Arguments:
+ none
+
+ Returns:
+ EFI_STATUS
+
+--*/
+;
+
+EFI_STATUS
+EFIAPI
+HeciGetMeStatus (
+ IN UINT32 *MeStatus
+ )
+/*++
+
+ Routine Description:
+ Return ME Status
+
+ Arguments:
+ MeStatus pointer for status report
+
+ Returns:
+ EFI_STATUS
+
+--*/
+;
+
+EFI_STATUS
+EFIAPI
+HeciGetMeMode (
+ IN UINT32 *MeMode
+ )
+/*++
+
+ Routine Description:
+ Return ME Mode
+
+ Arguments:
+ MeMode pointer for ME Mode report
+
+ Returns:
+ EFI_STATUS
+
+--*/
+;
+
+//
+// Local/Private functions not part of EFIAPI for HECI
+//
+EFI_STATUS
+InitializeHECI (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+/*++
+
+Routine Description:
+ HECI driver entry point used to initialize support for the HECI device.
+
+Arguments:
+ ImageHandle - Standard entry point parameter.
+ SystemTable - Standard entry point parameter.
+
+Returns:
+ EFI_STATUS
+
+--*/
+;
+
+EFI_STATUS
+InitializeHeciPrivate (
+ VOID
+ )
+/*++
+
+ Routine Description:
+ Determines if the HECI device is present and, if present, initializes it for
+ use by the BIOS.
+
+ Arguments:
+ None.
+
+ Returns:
+ EFI_STATUS
+
+--*/
+;
+
+UINT32
+CheckAndFixHeciForAccess (
+ VOID
+ )
+/*++
+
+Routine Description:
+ This function provides a standard way to verify the HECI cmd and MBAR regs
+ in its PCI cfg space are setup properly and that the local mHeciContext
+ variable matches this info.
+
+Arguments:
+ None.
+
+Returns:
+ VOID
+
+--*/
+;
+
+EFI_STATUS
+WaitForMEReady (
+ VOID
+ )
+/*++
+
+ Routine Description:
+ Waits for the ME to report that it is ready for communication over the HECI
+ interface.
+
+ Arguments:
+ None.
+
+ Returns:
+ EFI_STATUS
+
+--*/
+;
+
+UINT8
+FilledSlots (
+ IN UINT32 ReadPointer,
+ IN UINT32 WritePointer
+ )
+/*++
+
+ Routine Description:
+ Calculate if the circular buffer has overflowed.
+ Corresponds to HECI HPS (part of) section 4.2.1
+
+ Arguments:
+ ReadPointer - Location of the read pointer.
+ WritePointer - Location of the write pointer.
+
+ Returns:
+ Number of filled slots.
+
+--*/
+;
+
+EFI_STATUS
+OverflowCB (
+ IN UINT32 ReadPointer,
+ IN UINT32 WritePointer,
+ IN UINT32 BufferDepth
+ )
+/*++
+
+ Routine Description:
+ Calculate if the circular buffer has overflowed
+ Corresponds to HECI HPS (part of) section 4.2.1
+
+ Arguments:
+ ReadPointer - Value read from host/me read pointer
+ WritePointer - Value read from host/me write pointer
+ BufferDepth - Value read from buffer depth register
+
+ Returns:
+ EFI_STATUS
+
+--*/
+;
+
+EFI_STATUS
+HeciPacketRead (
+ IN UINT32 Blocking,
+ OUT HECI_MESSAGE_HEADER *MessageHeader,
+ OUT UINT32 *MessageData,
+ IN OUT UINT32 *Length
+ )
+/*++
+
+ Routine Description:
+ Function to pull one messsage packet off the HECI circular buffer.
+ Corresponds to HECI HPS (part of) section 4.2.4
+
+
+ Arguments:
+ Blocking - Used to determine if the read is BLOCKING or NON_BLOCKING.
+ MessageHeader - Pointer to a buffer for the message header.
+ MessageData - Pointer to a buffer to recieve the message in.
+ Length - On input is the size of the callers buffer in bytes. On
+ output this is the size of the packet in bytes.
+
+ Returns:
+ EFI_STATUS
+
+--*/
+;
+
+EFI_STATUS
+HeciPacketWrite (
+ IN HECI_MESSAGE_HEADER *MessageHeader,
+ IN UINT32 *MessageData
+ )
+/*++
+
+ Routine Description:
+ Function sends one messsage packet through the HECI circular buffer
+ Corresponds to HECI HPS (part of) section 4.2.3
+
+ Arguments:
+ MessageHeader - Pointer to the message header.
+ MessageData - Pointer to the actual message data.
+
+ Returns:
+ EFI_STATUS
+
+--*/
+;
+
+EFI_STATUS
+Heci1DevSaveEnable (
+ IN OUT UINT32 *DevState
+ )
+/*++
+
+ Routine Description:
+ Save HECI1 State and Enable it
+
+ Arguments:
+ DevState - Device State Save Buffer
+
+ Returns:
+ EFI_STATUS
+
+--*/
+;
+
+EFI_STATUS
+Heci2DevSaveEnable (
+ IN OUT UINT32 *DevState
+ )
+/*++
+
+ Routine Description:
+ Save HECI2 State and Enable it
+
+ Arguments:
+ DevState - Device State Save Buffer
+
+ Returns:
+ EFI_STATUS
+
+--*/
+;
+
+EFI_STATUS
+HeciDevRestore (
+ IN UINT32 DevState
+ )
+/*++
+
+ Routine Description:
+ Restore HECI1 State
+
+ Arguments:
+ DevState - Device State Save Buffer
+
+ Returns:
+ EFI_STATUS
+
+--*/
+;
+#endif // _HECI_CORE_H
diff --git a/ReferenceCode/ME/Include/IntelMeSsdtAcpiTables.dsc b/ReferenceCode/ME/Include/IntelMeSsdtAcpiTables.dsc
new file mode 100644
index 0000000..f6428ea
--- /dev/null
+++ b/ReferenceCode/ME/Include/IntelMeSsdtAcpiTables.dsc
@@ -0,0 +1,67 @@
+## @file
+# Build description file for building the ME SSDT ACPI tables
+#
+#@copyright
+# Copyright (c) 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[=============================================================================]
+#
+# Instructions for building the ME SSDT ACPI table storage file
+#
+[=============================================================================]
+[Build.Ia32.ME_SSDT_ACPITABLE,Build.x64.ME_SSDT_ACPITABLE]
+#
+# Check if we have any source to work with.
+#
+!IFNDEF SECTIONS
+!IFNDEF ASL_FILES
+!ERROR No ASL source files to build were defined in the INF file
+!ENDIF
+!ENDIF
+
+#
+# Define some macros to simplify changes
+#
+TARGET_FFS_FILE = $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).ffs
+
+$(DEST_DIR)\MeSsdt.sec : $(ASL_SOURCE_FILES) $(ASL_FILES)
+ $(ASL) $(ASL_FLAGS) $(DEST_DIR)\MeSsdt.asl
+ -copy $(DEST_DIR)\MeSsdt.aml $(DEST_DIR)\MeSsdt.acpi
+ $(GENSECTION) -I $(DEST_DIR)\MeSsdt.acpi -O $(DEST_DIR)\MeSsdt.sec -S EFI_SECTION_RAW
+
+#
+# Build FFS file
+#
+$(TARGET_FFS_FILE) : $(SECTIONS) $(DEST_DIR)\MeSsdt.sec
+ $(GENFFSFILE) -B $(DEST_DIR) -P1 $(DEST_DIR)\$(BASE_NAME).pkg -V
+
+all : $(TARGET_FFS_FILE)
+
+[=============================================================================]
+[Package.ME_SSDT_ACPITABLE.Default]
+PACKAGE.INF
+\[.]
+BASE_NAME = $(BASE_NAME)
+FFS_FILEGUID = $(FILE_GUID)
+FFS_FILETYPE = EFI_FV_FILETYPE_FREEFORM
+FFS_ATTRIB_CHECKSUM = TRUE
+
+IMAGE_SCRIPT =
+{
+ Compress (Dummy) {
+ $(DEST_DIR)\MeSsdt.sec
+ }
+}
diff --git a/ReferenceCode/ME/Include/MeDxe.dsc b/ReferenceCode/ME/Include/MeDxe.dsc
new file mode 100644
index 0000000..3c3791d
--- /dev/null
+++ b/ReferenceCode/ME/Include/MeDxe.dsc
@@ -0,0 +1,41 @@
+## @file
+# Build description file DXE Drivers for building the Me
+#
+#@copyright
+# Copyright (c) 1999 - 2014 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains an 'Intel Peripheral Driver' and uniquely
+# identified as "Intel Reference Module" and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+
+$(PROJECT_ME_ROOT)\Heci\Dxe\Hecidrv.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_ME_ROOT)\ActiveManagement\AlertStandardFormat\Heci\Dxe\AlertStandardFormatDxe.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_ME_ROOT)\ActiveManagement\AmtBootOptions\Dxe\ActiveManagement.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_ME_ROOT)\BiosExtension\Efi\BiosExtensionLoader\Dxe\BiosExtensionLoader.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_ME_ROOT)\ActiveManagement\ider\Dxe\IdeRController.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_ME_ROOT)\ActiveManagement\sol\Dxe\PciSerial.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_ME_ROOT)\FwUpdate\MeFwDowngrade\Dxe\MeFwDowngrade.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_ME_ROOT)\At\AtAm\Dxe\AtAm.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+#
+# Disable the following driver if PTT is not supported
+#
+$(PROJECT_ME_ROOT)\Ptt\Smm\PttHciSmm.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_ME_ROOT)\Acpitables\MeSsdt\MeSsdt_Edk.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+
+#
+# Uncomment the following line if the Mebx and MebxSetupBrowser are included by this build description
+#
+# $(PROJECT_ME_ROOT)\BiosExtension\Efi\Mebx\Mebx.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+# $(PROJECT_ME_ROOT)\BiosExtension\Efi\MebxSetupBrowser\MebxSetupBrowser.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+
diff --git a/ReferenceCode/ME/Include/MeDxeLib.dsc b/ReferenceCode/ME/Include/MeDxeLib.dsc
new file mode 100644
index 0000000..efab364
--- /dev/null
+++ b/ReferenceCode/ME/Include/MeDxeLib.dsc
@@ -0,0 +1,31 @@
+## @file
+# Build description file for building the Me Libries for DXE
+#
+#@copyright
+# Copyright (c) 2008 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains an 'Intel Peripheral Driver' and uniquely
+# identified as "Intel Reference Module" and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+
+$(PROJECT_ME_ROOT)\Guid\MeGuidLib.inf
+$(PROJECT_ME_ROOT)\Protocol\MeProtocolLib.inf
+$(PROJECT_ME_ROOT)\Library\MeKernel\Common\MeChipsetLib\MeChipsetLib.inf
+$(PROJECT_ME_ROOT)\Library\MeKernel\Dxe\MeLib.inf
+$(PROJECT_ME_ROOT)\Library\AMT\Dxe\AmtLib.inf
+$(PROJECT_ME_ROOT)\Library\AtLibrary\Dxe\AtDxeLib.inf
+#
+# Disable the following library if PTT is not supported
+#
+$(PROJECT_ME_ROOT)\Library\Ptt\Dxe\PttHciDeviceDxeLib.inf
diff --git a/ReferenceCode/ME/Include/MeInclude.cif b/ReferenceCode/ME/Include/MeInclude.cif
new file mode 100644
index 0000000..b45f94f
--- /dev/null
+++ b/ReferenceCode/ME/Include/MeInclude.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "MeInclude"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\Include\"
+ RefName = "MeInclude"
+[files]
+"MeInclude.sdl"
+"MePeiLib.dsc"
+"MeDxe.dsc"
+"MeDxeLib.dsc"
+"MePei.dsc"
+"IntelMeSsdtAcpiTables.dsc"
+<endComponent>
diff --git a/ReferenceCode/ME/Include/MeInclude.sdl b/ReferenceCode/ME/Include/MeInclude.sdl
new file mode 100644
index 0000000..ccba82a
--- /dev/null
+++ b/ReferenceCode/ME/Include/MeInclude.sdl
@@ -0,0 +1,9 @@
+PATH
+ Name = "MeInclude_DIR"
+End
+
+ELINK
+ Name = "/I$(MeInclude_DIR)"
+ Parent = "ME_INCLUDES"
+ InvokeOrder = AfterParent
+End \ No newline at end of file
diff --git a/ReferenceCode/ME/Include/MePei.dsc b/ReferenceCode/ME/Include/MePei.dsc
new file mode 100644
index 0000000..5110525
--- /dev/null
+++ b/ReferenceCode/ME/Include/MePei.dsc
@@ -0,0 +1,25 @@
+## @file
+# Build description file PEI Drivers for building
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains an 'Intel Peripheral Driver' and uniquely
+# identified as "Intel Reference Module" and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+
+$(PROJECT_ME_ROOT)\PchMeUma\PchMeUma.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_ME_ROOT)\Heci\Pei\HeciInit.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_ME_ROOT)\ActiveManagement\StartWatchDog\Pei\StartWatchDog.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_ME_ROOT)\ActiveManagement\AlertStandardFormat\Heci\Pei\AlertStandardFormatPei.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
diff --git a/ReferenceCode/ME/Include/MePeiLib.dsc b/ReferenceCode/ME/Include/MePeiLib.dsc
new file mode 100644
index 0000000..e5fc450
--- /dev/null
+++ b/ReferenceCode/ME/Include/MePeiLib.dsc
@@ -0,0 +1,30 @@
+## @file
+# Build description file for building the Libraries for PEIM
+#
+#@copyright
+# Copyright (c) 2008 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains an 'Intel Peripheral Driver' and uniquely
+# identified as "Intel Reference Module" and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+
+$(PROJECT_ME_ROOT)\Guid\MeGuidLib.inf
+$(PROJECT_ME_ROOT)\Ppi\MeLibPpi.inf
+$(PROJECT_ME_ROOT)\Library\MeKernel\Pei\MeLibPei.inf
+$(PROJECT_ME_ROOT)\Library\AMT\Pei\AmtLibPei.inf
+#
+# Disable the following library if PTT is not supported
+#
+$(PROJECT_ME_ROOT)\Library\Ptt\Pei\PttHciDevicePeiLib.inf
+
diff --git a/ReferenceCode/ME/Library/AMT/AmtLibrary.cif b/ReferenceCode/ME/Library/AMT/AmtLibrary.cif
new file mode 100644
index 0000000..c5be1a2
--- /dev/null
+++ b/ReferenceCode/ME/Library/AMT/AmtLibrary.cif
@@ -0,0 +1,11 @@
+<component>
+ name = "AmtLibrary"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\Library\AMT\"
+ RefName = "AmtLibrary"
+[files]
+"AmtLibrary.sdl"
+[parts]
+"AmtLibDxe"
+"AmtLibPei"
+<endComponent>
diff --git a/ReferenceCode/ME/Library/AMT/AmtLibrary.sdl b/ReferenceCode/ME/Library/AMT/AmtLibrary.sdl
new file mode 100644
index 0000000..0e43375
--- /dev/null
+++ b/ReferenceCode/ME/Library/AMT/AmtLibrary.sdl
@@ -0,0 +1,20 @@
+TOKEN
+ Name = "AmtLibrary_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable AmtLibDxe support in Project"
+End
+
+PATH
+ Name = "AmtLibrary_DIR"
+ Help = "iAMT Library file source directory"
+End
+
+ELINK
+ Name = "/I$(AmtLibrary_DIR)\Include"
+ Parent = "ME_INCLUDES"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/ME/Library/AMT/Dxe/AmtLib.c b/ReferenceCode/ME/Library/AMT/Dxe/AmtLib.c
new file mode 100644
index 0000000..6b69b16
--- /dev/null
+++ b/ReferenceCode/ME/Library/AMT/Dxe/AmtLib.c
@@ -0,0 +1,526 @@
+/** @file
+ Implementation file for AMT functionality
+
+@copyright
+ Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+
+#include "EdkIIGlueDxe.h"
+#include "AmtLib.h"
+#include "MeLib.h"
+
+#include EFI_PROTOCOL_CONSUMER (Heci)
+#include EFI_PROTOCOL_CONSUMER (ActiveManagement)
+#include EFI_PROTOCOL_CONSUMER (AmtPlatformPolicy)
+#include EFI_GUID_DEFINITION (MeBiosExtensionSetup)
+#endif
+
+EFI_ACTIVE_MANAGEMENT_PROTOCOL *mActiveManagement = NULL;
+//
+// AMT GUID and Variable Name
+//
+EFI_GUID mEfiMeBiosExtensionSetupGuid = EFI_ME_BIOS_EXTENSION_SETUP_GUID;
+CHAR16 mEfiMeBiosExtensionSetupName[] = EFI_ME_BIOS_EXTENSION_SETUP_VARIABLE_NAME;
+
+/**
+ Check if Asf is enabled in setup options.
+
+ @param[in] None.
+ @retval EFI_SUCCESS mActiveManagement is not NULL
+ @retval Error Status code returned by
+ LocateProtocol.
+**/
+EFI_STATUS
+AmtLibInit (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+
+ if (mActiveManagement == NULL) {
+ Status = gBS->LocateProtocol (
+ &gEfiActiveManagementProtocolGuid,
+ NULL,
+ (VOID **) &mActiveManagement
+ );
+ } else {
+ Status = EFI_SUCCESS;
+ }
+
+ return Status;
+}
+
+/**
+ This will return IDE Redirection Boot Option.
+ True if the option is enabled.
+
+ @param[in] None.
+
+ @retval True IDE-R is enabled.
+ @retval False IDE-R is disabled.
+**/
+BOOLEAN
+ActiveManagementEnableIdeR (
+ VOID
+ )
+{
+ BOOLEAN CurrentState;
+ UINTN VariableSize;
+ EFI_STATUS Status;
+ ME_BIOS_EXTENSION_SETUP MeBiosExtensionSetupData;
+
+ CurrentState = FALSE;
+ VariableSize = 0;
+
+ if (mActiveManagement != NULL) {
+ mActiveManagement->GetIderState (mActiveManagement, &CurrentState);
+ }
+
+ VariableSize = sizeof (MeBiosExtensionSetupData);
+ Status = gRT->GetVariable (
+ mEfiMeBiosExtensionSetupName,
+ &mEfiMeBiosExtensionSetupGuid,
+ NULL,
+ &VariableSize,
+ &MeBiosExtensionSetupData
+ );
+ if (!EFI_ERROR (Status)) {
+ if ((MeBiosExtensionSetupData.AmtSolIder & IDER_ENABLE) == 0) {
+ CurrentState = FALSE;
+ }
+ }
+
+ return CurrentState;
+}
+
+/**
+ This will return Enforce Secure Boot over IDER Boot Option.
+ True if the option is enabled.
+
+ @param[in] None.
+
+ @retval True Enforce Secure Boot is enabled.
+ @retval False Enforce Secure Boot is disabled.
+**/
+BOOLEAN
+ActiveManagementEnforceSecureBoot (
+ VOID
+ )
+{
+ BOOLEAN CurrentState;
+
+ CurrentState = FALSE;
+
+ if (mActiveManagement != NULL) {
+ mActiveManagement->GetEnforceSecureBootState (mActiveManagement, &CurrentState);
+ }
+
+ return CurrentState;
+}
+
+/**
+ This will return BIOS Pause Boot Option.
+ True if the option is enabled.
+
+ @param[in] None.
+
+ @retval True BIOS Pause is enabled.
+ @retval False BIOS Pause is disabled.
+**/
+BOOLEAN
+ActiveManagementPauseBoot (
+ VOID
+ )
+{
+ BOOLEAN CurrentState;
+
+ CurrentState = FALSE;
+
+ if (mActiveManagement != NULL) {
+ mActiveManagement->GetBiosPauseState (mActiveManagement, &CurrentState);
+ }
+
+ return CurrentState;
+}
+
+/**
+ This will return BIOS Setup Boot Option.
+ True if the option is enabled.
+
+ @param[in] None.
+
+ @retval True BIOS Setup is enabled.
+ @retval False BIOS Setup is disabled.
+**/
+BOOLEAN
+ActiveManagementEnterSetup (
+ VOID
+ )
+{
+ BOOLEAN CurrentState;
+
+ CurrentState = FALSE;
+
+ if (mActiveManagement != NULL) {
+ mActiveManagement->GetBiosSetupState (mActiveManagement, &CurrentState);
+ }
+
+ return CurrentState;
+}
+
+/**
+ This will return Serial-over-Lan Boot Option.
+ True if the option is enabled.
+
+ @param[in] None.
+
+ @retval True Console Lock is enabled.
+ @retval False Console Lock is disabled.
+**/
+BOOLEAN
+ActiveManagementConsoleLocked (
+ VOID
+ )
+{
+ BOOLEAN CurrentState;
+
+ CurrentState = FALSE;
+
+ if (mActiveManagement != NULL) {
+ mActiveManagement->GetConsoleLockState (mActiveManagement, &CurrentState);
+ }
+
+ return CurrentState;
+}
+
+/**
+ This will return KVM Boot Option.
+ True if the option is enabled.
+
+ @param[in] None.
+
+ @retval True KVM is enabled.
+ @retval False KVM is disabled.
+**/
+BOOLEAN
+ActiveManagementEnableKvm (
+ VOID
+ )
+{
+ BOOLEAN CurrentState;
+
+ CurrentState = FALSE;
+
+ if (mActiveManagement != NULL) {
+ mActiveManagement->GetKvmState (mActiveManagement, &CurrentState);
+ }
+
+ return CurrentState;
+}
+
+/**
+ This will return Serial-over-Lan Boot Option.
+ True if the option is enabled.
+
+ @param[in] None.
+
+ @retval True Serial-over-Lan is enabled.
+ @retval False Serial-over-Lan is disabled.
+**/
+BOOLEAN
+ActiveManagementEnableSol (
+ VOID
+ )
+{
+ BOOLEAN CurrentState;
+ UINTN VariableSize;
+ EFI_STATUS Status;
+ ME_BIOS_EXTENSION_SETUP MeBiosExtensionSetupData;
+
+ CurrentState = FALSE;
+ VariableSize = 0;
+
+ if (mActiveManagement != NULL) {
+ mActiveManagement->GetSolState (mActiveManagement, &CurrentState);
+ }
+
+ VariableSize = sizeof (MeBiosExtensionSetupData);
+ Status = gRT->GetVariable (
+ mEfiMeBiosExtensionSetupName,
+ &mEfiMeBiosExtensionSetupGuid,
+ NULL,
+ &VariableSize,
+ &MeBiosExtensionSetupData
+ );
+ if (!EFI_ERROR (Status)) {
+ if ((MeBiosExtensionSetupData.AmtSolIder & SOL_ENABLE) == 0) {
+ CurrentState = FALSE;
+ }
+ }
+
+ return CurrentState;
+}
+
+/**
+ This will return IDE Redirection boot device index to boot
+
+ @param[in] None.
+
+ @retval IdeBootDevice Return the boot device number to boot
+ Bits 0-1: If IDER boot is selected in Perimeter 1 then Bits 1,2 define the drive on the IDER controller to be used as the boot driver.
+ Bit 1 Bit0
+ 0 0 Primary Master Drive
+ 0 1 Primary Slave Drive
+ 1 0 Secondary Master Drive
+ 1 1 Secondary Slave Drive
+ Bits 2-7: Reserved set to 0
+**/
+UINT8
+ActiveManagementIderBootDeviceGet (
+ VOID
+ )
+{
+ UINT8 IderBootDevice;
+ IderBootDevice = 0;
+
+ if (mActiveManagement != NULL) {
+ mActiveManagement->GetIderBootDeviceSelectd (mActiveManagement, &IderBootDevice);
+ }
+
+ return IderBootDevice;
+}
+
+/**
+ Stop ASF Watch Dog Timer
+
+ @param[in] None.
+
+ @retval None
+**/
+VOID
+AsfStopWatchDog (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ UINT32 HeciLength;
+ ASF_STOP_WDT AsfStopWdt;
+ UINT32 MeStatus;
+ UINT32 MeMode;
+ EFI_HECI_PROTOCOL *Heci;
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+
+ if (!EFI_ERROR (Status)) {
+ Status = Heci->GetMeMode (&MeMode);
+ if (EFI_ERROR (Status) || (MeMode != ME_MODE_NORMAL)) {
+ DEBUG ((EFI_D_ERROR, "MeMode is %x, Unable to Stop ME BIOS Watch Dog Timer", MeMode));
+
+ return ;
+ }
+ ///
+ /// Check ME Status
+ ///
+ Status = Heci->GetMeStatus (&MeStatus);
+ ASSERT_EFI_ERROR (Status);
+ ///
+ /// Send EOP/WDT message when ME is ready. Do not care about if ME FW INIT is completed.
+ ///
+ if (ME_STATUS_ME_STATE_ONLY (MeStatus) == ME_READY) {
+ ///
+ /// Check if watch dog is enabled in BIOS Setup
+ ///
+ if (AmtWatchDog ()) {
+ ZeroMem ((VOID *) &AsfStopWdt, sizeof (ASF_STOP_WDT));
+ AsfStopWdt.Command = EFI_ASF_MESSAGE_COMMAND_MANAGEMENT_CONTROL;
+ AsfStopWdt.ByteCount = EFI_ASF_STOP_WDT_BYTE_COUNT;
+ AsfStopWdt.SubCommand = ASF_SUB_COMMAND_STOP_WDT;
+ AsfStopWdt.VersionNumber = EFI_ASF_STOP_WDT_VERSION;
+
+ HeciLength = ASF_STOP_WDT_LENGTH;
+ Status = Heci->SendMsg (
+ (UINT32 *) &AsfStopWdt,
+ HeciLength,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_ASF_MESSAGE_ADDR
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "Unable to Stop ME BIOS Watch Dog Timer"));
+ }
+ }
+ }
+ }
+
+ return ;
+}
+
+/**
+ Start ASF Watch Dog Timer
+
+ @param[in] WatchDogType Which kind of WatchDog, ASF OS WatchDog Timer setting or ASF BIOS WatchDog Timer setting
+
+ @retval None
+**/
+VOID
+AsfStartWatchDog (
+ IN UINT8 WatchDogType
+ )
+{
+ EFI_STATUS Status;
+ UINT32 HeciLength;
+ ASF_START_WDT AsfStartWdt;
+ EFI_HECI_PROTOCOL *Heci;
+ UINT32 MeStatus;
+ UINT32 MeMode;
+ UINT16 WaitTimer;
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+
+ if (!EFI_ERROR (Status)) {
+ Status = Heci->GetMeMode (&MeMode);
+ if (EFI_ERROR (Status) || (MeMode != ME_MODE_NORMAL)) {
+ DEBUG ((EFI_D_ERROR, "MeMode is %x, Unable to Start ME Watch Dog Timer", MeMode));
+
+ return ;
+ }
+ ///
+ /// Check ME Status
+ ///
+ Status = Heci->GetMeStatus (&MeStatus);
+ ASSERT_EFI_ERROR (Status);
+ ///
+ /// Send EOP/WDT message when ME is ready. Do not care about if ME FW INIT is completed.
+ ///
+ if (ME_STATUS_ME_STATE_ONLY (MeStatus) == ME_READY) {
+ ///
+ /// Check if watch dog is enabled in BIOS Setup
+ ///
+ if (AmtWatchDog ()) {
+ ZeroMem ((VOID *) &AsfStartWdt, sizeof (ASF_START_WDT));
+ AsfStartWdt.Command = EFI_ASF_MESSAGE_COMMAND_MANAGEMENT_CONTROL;
+ AsfStartWdt.ByteCount = EFI_ASF_START_WDT_BYTE_COUNT;
+ AsfStartWdt.SubCommand = ASF_SUB_COMMAND_START_WDT;
+ AsfStartWdt.VersionNumber = EFI_ASF_START_WDT_VERSION_NUMBER;
+ AsfStartWdt.EventSensorType = EFI_ASF_START_WDT_EVENT_SENSOR_TYPE;
+ AsfStartWdt.EventType = EFI_ASF_START_WDT_EVENT_TYPE;
+ AsfStartWdt.EventOffset = EFI_ASF_START_WDT_EVENT_OFFSET;
+ AsfStartWdt.EventSeverity = EFI_ASF_START_WDT_EVENT_SEVERITY;
+ AsfStartWdt.SensorDevice = EFI_ASF_START_WDT_SENSOR_DEVICE;
+ AsfStartWdt.SensorNumber = EFI_ASF_START_WDT_SENSOR_NUMBER;
+ AsfStartWdt.Entity = EFI_ASF_START_WDT_ENTITY;
+ AsfStartWdt.EntityInstance = EFI_ASF_START_WDT_ENTITY_INSTANCE;
+ AsfStartWdt.EventData[0] = EFI_ASF_START_WDT_EVENT_DATA_BYTE_0;
+ if (WatchDogType == ASF_START_BIOS_WDT) {
+ AsfStartWdt.EventSourceType = EFI_ASF_START_WDT_EVENT_SOURCE_TYPE_BIOS;
+ AsfStartWdt.EventData[1] = EFI_ASF_START_WDT_EVENT_DATA_BYTE_1_BIOS_TIMEOUT;
+ WaitTimer = AmtWatchDogTimerBiosGet ();
+ } else {
+ AsfStartWdt.EventSourceType = EFI_ASF_START_WDT_EVENT_SOURCE_TYPE_OS;
+ AsfStartWdt.EventData[1] = EFI_ASF_START_WDT_EVENT_DATA_BYTE_1_OS_TIMEOUT;
+ WaitTimer = AmtWatchDogTimerOsGet ();
+ }
+
+ AsfStartWdt.TimeoutLow = (UINT8) WaitTimer;
+ AsfStartWdt.TimeoutHigh = (UINT8) (WaitTimer >> 8);
+
+ HeciLength = ASF_START_WDT_LENGTH;
+
+ Status = Heci->SendMsg (
+ (UINT32 *) &AsfStartWdt,
+ HeciLength,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_ASF_MESSAGE_ADDR
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "Unable to Start ME Watch Dog Timer"));
+ }
+ }
+ }
+ }
+
+ return ;
+}
+
+/**
+ This will return progress event Option.
+ True if the option is enabled.
+
+ @param[in] None.
+
+ @retval True progress event is enabled.
+ @retval False progress event is disabled.
+**/
+BOOLEAN
+ActiveManagementFwProgress (
+ VOID
+ )
+{
+ BOOLEAN CurrentState;
+
+ CurrentState = FALSE;
+
+ if (mActiveManagement != NULL) {
+ mActiveManagement->GetProgressMsgRequest (mActiveManagement, &CurrentState);
+ }
+
+ return CurrentState;
+}
+
+/**
+ Sent initialize KVM message
+
+ @param[in] None.
+
+ @retval True KVM Initialization is successful
+ @retval False KVM is not enabled
+**/
+BOOLEAN
+BdsKvmInitialization (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ UINT32 ResponseCode;
+
+ MeReportError (MSG_KVM_WAIT);
+ Status = HeciQueryKvmRequest (QUERY_REQUEST, &ResponseCode);
+ if (EFI_ERROR (Status)) {
+ MeReportError (MSG_KVM_TIMES_UP);
+ Status = HeciQueryKvmRequest (CANCEL_REQUEST, &ResponseCode);
+ } else if (ResponseCode == KVM_SESSION_CANCELLED) {
+ MeReportError (MSG_KVM_REJECTED);
+ } else {
+ return TRUE;
+ }
+
+ return FALSE;
+}
diff --git a/ReferenceCode/ME/Library/AMT/Dxe/AmtLib.h b/ReferenceCode/ME/Library/AMT/Dxe/AmtLib.h
new file mode 100644
index 0000000..b89ae0a
--- /dev/null
+++ b/ReferenceCode/ME/Library/AMT/Dxe/AmtLib.h
@@ -0,0 +1,257 @@
+/** @file
+ Header file for AMT functionality
+
+@copyright
+ Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _AMT_LIB_H_
+#define _AMT_LIB_H_
+
+#include "AmtPolicyLib.h"
+
+//
+// ASF Message
+//
+#define EFI_ASF_START_WDT_VERSION 0x10
+#define EFI_ASF_STOP_WDT_VERSION 0x10
+
+#define EFI_ASF_MESSAGE_COMMAND_SENSE_DEVICE_SYSTEM_STATE 0x01
+#define EFI_ASF_MESSAGE_COMMAND_MANAGEMENT_CONTROL 0x02
+#define EFI_ASF_MESSAGE_COMMAND_ASF_CONFIGURATION 0x03
+#define EFI_ASF_MESSAGE_COMMAND_MESSAGE 0x04
+#define EFI_ASF_MESSAGE_COMMAND_GETUUID 0xC7
+
+//
+// HECI ASF Command
+//
+#define EFI_ASF_START_WDT_BYTE_COUNT 0x0F
+#define EFI_ASF_START_WDT_VERSION_NUMBER 0x10
+#define EFI_ASF_START_WDT_EVENT_SENSOR_TYPE 0x23
+#define EFI_ASF_START_WDT_EVENT_TYPE 0x6F
+#define EFI_ASF_START_WDT_EVENT_OFFSET 0x00
+#define EFI_ASF_START_WDT_EVENT_SOURCE_TYPE_OS 0x48
+#define EFI_ASF_START_WDT_EVENT_SOURCE_TYPE_BIOS 0x00
+#define EFI_ASF_START_WDT_EVENT_SOURCE_TYPE 0x00 ///< 0x00 - BIOs, 0x48 - OS
+#define EFI_ASF_START_WDT_EVENT_SEVERITY 0x10 ///< critical
+#define EFI_ASF_START_WDT_SENSOR_DEVICE 0xFF ///< unspecified
+#define EFI_ASF_START_WDT_SENSOR_NUMBER 0xFF ///< unspecified
+#define EFI_ASF_START_WDT_ENTITY 0x00 ///< unspecified
+#define EFI_ASF_START_WDT_ENTITY_INSTANCE 0x00 ///< unspecified
+#define EFI_ASF_START_WDT_EVENT_DATA_BYTE_0 0x40
+#define EFI_ASF_START_WDT_EVENT_DATA_BYTE_1 0x02 ///< 0x02 BIOS POST WDT Timeout, 0x04 OS WDT timeout
+#define EFI_ASF_START_WDT_EVENT_DATA_BYTE_1_BIOS_TIMEOUT 0x02
+#define EFI_ASF_START_WDT_EVENT_DATA_BYTE_1_OS_TIMEOUT 0x04
+
+#define EFI_ASF_STOP_WDT_BYTE_COUNT 0x02
+
+#define ASF_START_BIOS_WDT 0
+#define ASF_START_OS_WDT 1
+
+/**
+ Check if Asf is enabled in setup options.
+
+ @param[in] None.
+ @retval EFI_SUCCESS mActiveManagement is not NULL
+ @retval Error Status code returned by
+ LocateProtocol.
+**/
+EFI_STATUS
+AmtLibInit (
+ VOID
+ )
+;
+
+/**
+ This will return IDE Redirection Boot Option.
+ True if the option is enabled.
+
+ @param[in] None.
+
+ @retval True IDE-R is enabled.
+ @retval False IDE-R is disabled.
+**/
+BOOLEAN
+ActiveManagementEnableIdeR (
+ VOID
+ )
+;
+
+/**
+ This will return Enforce Secure Boot over IDER Boot Option.
+ True if the option is enabled.
+
+ @param[in] None.
+
+ @retval True Enforce Secure Boot is enabled.
+ @retval False Enforce Secure Boot is disabled.
+**/
+BOOLEAN
+ActiveManagementEnforceSecureBoot (
+ VOID
+ )
+;
+
+/**
+ This will return BIOS Pause Boot Option.
+ True if the option is enabled.
+
+ @param[in] None.
+
+ @retval True BIOS Pause is enabled.
+ @retval False BIOS Pause is disabled.
+**/
+BOOLEAN
+ActiveManagementPauseBoot (
+ VOID
+ )
+;
+
+/**
+ This will return BIOS Setup Boot Option.
+ True if the option is enabled.
+
+ @param[in] None.
+
+ @retval True BIOS Setup is enabled.
+ @retval False BIOS Setup is disabled.
+**/
+BOOLEAN
+ActiveManagementEnterSetup (
+ VOID
+ )
+;
+
+/**
+ This will return Serial-over-Lan Boot Option.
+ True if the option is enabled.
+
+ @param[in] None.
+
+ @retval True Console Lock is enabled.
+ @retval False Console Lock is disabled.
+**/
+BOOLEAN
+ActiveManagementConsoleLocked (
+ VOID
+ )
+;
+
+/**
+ This will return KVM Boot Option.
+ True if the option is enabled.
+
+ @param[in] None.
+
+ @retval True KVM is enabled.
+ @retval False KVM is disabled.
+**/
+BOOLEAN
+ActiveManagementEnableKvm (
+ VOID
+ )
+;
+
+/**
+ This will return Serial-over-Lan Boot Option.
+ True if the option is enabled.
+
+ @param[in] None.
+
+ @retval True Serial-over-Lan is enabled.
+ @retval False Serial-over-Lan is disabled.
+**/
+BOOLEAN
+ActiveManagementEnableSol (
+ VOID
+ )
+;
+
+/**
+ This will return IDE Redirection boot device index to boot
+
+ @param[in] None.
+
+ @retval IdeBootDevice Return the boot device number to boot
+ Bits 0-1: If IDER boot is selected in Perimeter 1 then Bits 1,2 define the drive on the IDER controller to be used as the boot driver.
+ Bit 1 Bit0
+ 0 0 Primary Master Drive
+ 0 1 Primary Slave Drive
+ 1 0 Secondary Master Drive
+ 1 1 Secondary Slave Drive
+ Bits 2-7: Reserved set to 0
+**/
+UINT8
+ActiveManagementIderBootDeviceGet (
+ VOID
+ )
+;
+
+/**
+ Stop ASF Watch Dog Timer
+
+ @param[in] None.
+
+ @retval None
+**/
+VOID
+AsfStopWatchDog (
+ VOID
+ )
+;
+
+/**
+ Start ASF Watch Dog Timer
+
+ @param[in] WatchDogType Which kind of WatchDog, ASF OS WatchDog Timer setting or ASF BIOS WatchDog Timer setting
+
+ @retval None
+**/
+VOID
+AsfStartWatchDog (
+ IN UINT8 WatchDogType
+ )
+;
+
+/**
+ This will return progress event Option.
+ True if the option is enabled.
+
+ @param[in] None.
+
+ @retval True progress event is enabled.
+ @retval False progress event is disabled.
+**/
+BOOLEAN
+ActiveManagementFwProgress (
+ VOID
+ )
+;
+
+/**
+ Sent initialize KVM message
+
+ @param[in] None.
+
+ @retval True KVM Initialization is successful
+ @retval False KVM is not enabled
+**/
+BOOLEAN
+BdsKvmInitialization (
+ VOID
+ )
+;
+#endif
diff --git a/ReferenceCode/ME/Library/AMT/Dxe/AmtLib.inf b/ReferenceCode/ME/Library/AMT/Dxe/AmtLib.inf
new file mode 100644
index 0000000..4089248
--- /dev/null
+++ b/ReferenceCode/ME/Library/AMT/Dxe/AmtLib.inf
@@ -0,0 +1,75 @@
+## @file
+# Component description file for AMT functionality
+#
+#@copyright
+# Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = AmtLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ AmtLib.c
+ AmtLib.h
+ AmtPolicyLib.c
+ AmtPolicyLib.h
+ AmtPolicyDebugDumpDxe.c
+ MebxSetupDebugDumpDxe.c
+
+[includes.common]
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/Include
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/Dxe
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Heci/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/SampleCode
+
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[libraries.common]
+ MeLib
+ MeProtocolLib
+ EdkIIGlueBaseMemoryLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueBasePciLibPciExpress
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueDxeReportStatusCodeLib
+
+[nmake.common]
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__
diff --git a/ReferenceCode/ME/Library/AMT/Dxe/AmtLibDxe.cif b/ReferenceCode/ME/Library/AMT/Dxe/AmtLibDxe.cif
new file mode 100644
index 0000000..9aae0a8
--- /dev/null
+++ b/ReferenceCode/ME/Library/AMT/Dxe/AmtLibDxe.cif
@@ -0,0 +1,16 @@
+<component>
+ name = "AmtLibDxe"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\Library\AMT\Dxe\"
+ RefName = "AmtLibDxe"
+[files]
+"AmtLib.c"
+"AmtLib.h"
+"AmtLib.inf"
+"AmtLibDxe.mak"
+"AmtLibDxe.sdl"
+"AmtPolicyLib.c"
+"AmtPolicyLib.h"
+"AmtPolicyDebugDumpDxe.c"
+"MebxSetupDebugDumpDxe.c"
+<endComponent>
diff --git a/ReferenceCode/ME/Library/AMT/Dxe/AmtLibDxe.mak b/ReferenceCode/ME/Library/AMT/Dxe/AmtLibDxe.mak
new file mode 100644
index 0000000..1d0a64b
--- /dev/null
+++ b/ReferenceCode/ME/Library/AMT/Dxe/AmtLibDxe.mak
@@ -0,0 +1,54 @@
+# /*++
+# Copyright (c) 2009 Intel Corporation. All rights reserved.
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+# --*/
+# MAK file for the ModulePart:AmtLibDxe
+all : AmtLibDxe
+
+$(BUILD_DIR)\AmtLibDxe.lib : AmtLibDxe
+
+AmtLibDxe : $(BUILD_DIR)\AmtLibDxe.mak AmtLibDxeBin
+
+$(BUILD_DIR)\AmtLibDxe.mak : $(AmtLibDxe_DIR)\$(@B).cif $(AmtLibDxe_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(AmtLibDxe_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+AmtLibDxe_INCLUDES=\
+ $(EDK_INCLUDES) \
+ $(EdkIIGlueLib_INCLUDES) \
+ $(ME_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+
+AmtLibDxe_DEFINES=\
+ $(MY_DEFINES)/D __EDKII_GLUE_BASE_MEMORY_LIB__\
+ /D __EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__\
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__\
+
+AmtLibDxe_LIBS=\
+ $(MeProtocolLib_LIB)\
+ $(MeLibDxe_LIB)
+
+AmtLibDxeBin : $(AmtLibDxe_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS) \
+ /f $(BUILD_DIR)\AmtLibDxe.mak all \
+ "MY_INCLUDES=$(AmtLibDxe_INCLUDES)" \
+ "MY_DEFINES=$(AmtLibDxe_DEFINES)"\
+ TYPE=LIBRARY \
+#**********************************************************************
+#**********************************************************************
+#** **
+#** (C)Copyright 1985-2006, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 6145-F Northbelt Pkwy, Norcross, GA 30071 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#**********************************************************************
+#**********************************************************************
diff --git a/ReferenceCode/ME/Library/AMT/Dxe/AmtLibDxe.sdl b/ReferenceCode/ME/Library/AMT/Dxe/AmtLibDxe.sdl
new file mode 100644
index 0000000..054446f
--- /dev/null
+++ b/ReferenceCode/ME/Library/AMT/Dxe/AmtLibDxe.sdl
@@ -0,0 +1,36 @@
+TOKEN
+ Name = "AmtLibDxe_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable AmtLibDxe support in Project"
+End
+
+MODULE
+ Help = "Includes AmtLibDxe.mak to Project"
+ File = "AmtLibDxe.mak"
+End
+
+PATH
+ Name = "AmtLibDxe_DIR"
+ Help = "iAMT Library file source directory"
+End
+
+ELINK
+ Name = "AmtLibDxe_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\AmtLibDxe.lib"
+ Parent = "AmtLibDxe_LIB"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(AmtLibDxe_DIR)"
+ Parent = "ME_INCLUDES"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/ME/Library/AMT/Dxe/AmtPolicyDebugDumpDxe.c b/ReferenceCode/ME/Library/AMT/Dxe/AmtPolicyDebugDumpDxe.c
new file mode 100644
index 0000000..608f886
--- /dev/null
+++ b/ReferenceCode/ME/Library/AMT/Dxe/AmtPolicyDebugDumpDxe.c
@@ -0,0 +1,115 @@
+/** @file
+ Dump whole DXE_AMT_POLICY_PROTOCOL and serial out.
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "AmtPolicyLib.h"
+#endif
+
+extern DXE_AMT_POLICY_PROTOCOL *mDxePlatformAmtPolicy;
+
+/**
+ Dump DXE Amt Platform Policy
+
+ @param[in] None.
+
+ @retval None
+**/
+VOID
+DxeAmtPolicyDebugDump (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+
+ Status = AmtPolicyLibInit ();
+ if (EFI_ERROR(Status)) {
+ return;
+ }
+
+ DEBUG ((EFI_D_INFO, "\n------------------------ AmtPlatformPolicy Dump Begin -----------------\n"));
+ DEBUG ((EFI_D_INFO, " Revision : 0x%x\n", mDxePlatformAmtPolicy->Revision));
+ DEBUG ((EFI_D_INFO, "AmtConfig ---\n"));
+ //
+ // Byte 0, bit definition for functionality enable/disable
+ //
+ DEBUG ((EFI_D_INFO, " AsfEnabled : 0x%x\n", mDxePlatformAmtPolicy->AmtConfig.AsfEnabled));
+ DEBUG ((EFI_D_INFO, " iAmtEnabled : 0x%x\n", mDxePlatformAmtPolicy->AmtConfig.iAmtEnabled));
+ DEBUG ((EFI_D_INFO, " iAmtbxPasswordWrite : 0x%x\n", mDxePlatformAmtPolicy->AmtConfig.iAmtbxPasswordWrite));
+ DEBUG ((EFI_D_INFO, " WatchDog : 0x%x\n", mDxePlatformAmtPolicy->AmtConfig.WatchDog));
+ DEBUG ((EFI_D_INFO, " CiraRequest : 0x%x\n", mDxePlatformAmtPolicy->AmtConfig.CiraRequest));
+ DEBUG ((EFI_D_INFO, " ManageabilityMode : 0x%x\n", mDxePlatformAmtPolicy->AmtConfig.ManageabilityMode));
+ DEBUG ((EFI_D_INFO, " UnConfigureMe : 0x%x\n", mDxePlatformAmtPolicy->AmtConfig.UnConfigureMe));
+ DEBUG ((EFI_D_INFO, " MebxDebugMsg : 0x%x\n", mDxePlatformAmtPolicy->AmtConfig.MebxDebugMsg));
+
+ //
+ // Byte 1, bit definition for functionality enable/disable
+ //
+ DEBUG ((EFI_D_INFO, " ForcMebxSyncUp : 0x%x\n", mDxePlatformAmtPolicy->AmtConfig.ForcMebxSyncUp));
+ DEBUG ((EFI_D_INFO, " UsbrEnabled : 0x%x\n", mDxePlatformAmtPolicy->AmtConfig.UsbrEnabled));
+ DEBUG ((EFI_D_INFO, " UsbLockingEnabled : 0x%x\n", mDxePlatformAmtPolicy->AmtConfig.UsbLockingEnabled));
+ DEBUG ((EFI_D_INFO, " HideUnConfigureMeConfirm : 0x%x\n", mDxePlatformAmtPolicy->AmtConfig.HideUnConfigureMeConfirm));
+ DEBUG ((EFI_D_INFO, " USBProvision : 0x%x\n", mDxePlatformAmtPolicy->AmtConfig.USBProvision));
+ DEBUG ((EFI_D_INFO, " FWProgress : 0x%x\n", mDxePlatformAmtPolicy->AmtConfig.FWProgress));
+ DEBUG ((EFI_D_INFO, " iAmtbxHotKeyPressed : 0x%x\n", mDxePlatformAmtPolicy->AmtConfig.iAmtbxHotkeyPressed));
+ DEBUG ((EFI_D_INFO, " iAmtbxSelectionScreen : 0x%x\n", mDxePlatformAmtPolicy->AmtConfig.iAmtbxSelectionScreen));
+
+ //
+ // Byte 2, bit definition for functionality enable/disable
+ //
+ DEBUG ((EFI_D_INFO, " AtEnabled : 0x%x\n", mDxePlatformAmtPolicy->AmtConfig.AtEnabled));
+
+ //
+ // Byte 3-4 OS WatchDog Timer
+ //
+ DEBUG ((EFI_D_INFO, " WatchDogTimerOs : 0x%x\n", mDxePlatformAmtPolicy->AmtConfig.WatchDogTimerOs));
+
+ //
+ // Byte 5-6 BIOS WatchDog Timer
+ //
+ DEBUG ((EFI_D_INFO, " WatchDogTimerBios : 0x%x\n", mDxePlatformAmtPolicy->AmtConfig.WatchDogTimerBios));
+
+ //
+ // Byte 7 CIRA Timeout, Client Initiated Remote Access Timeout
+ // OEM defined timeout for MPS connection to be established.
+ //
+ DEBUG ((EFI_D_INFO, " CiraTimeout : 0x%x\n", mDxePlatformAmtPolicy->AmtConfig.CiraTimeout));
+
+ //
+ // Byte 8 CPU Replacement Timeout
+ //
+ DEBUG ((EFI_D_INFO, " CPU Replacement Timeout : 0x%x\n", mDxePlatformAmtPolicy->AmtConfig.CpuReplacementTimeout));
+
+ //
+ // Byte 9-10 OemResolutionSettings
+ //
+ DEBUG ((EFI_D_INFO, " MebxNonUiTextMode : 0x%x\n", mDxePlatformAmtPolicy->AmtConfig.MebxNonUiTextMode));
+ DEBUG ((EFI_D_INFO, " MebxUiTextMode : 0x%x\n", mDxePlatformAmtPolicy->AmtConfig.MebxUiTextMode));
+ DEBUG ((EFI_D_INFO, " MebxGraphicsMode : 0x%x\n", mDxePlatformAmtPolicy->AmtConfig.MebxGraphicsMode));
+
+ //
+ // Byte 11-14 Pointer to a list which contain on-board devices bus/device/fun number
+ //
+ DEBUG ((EFI_D_INFO, " PciDeviceFilterOutTable Pointer : 0x%x\n", mDxePlatformAmtPolicy->AmtConfig.PciDeviceFilterOutTable));
+
+ DEBUG ((EFI_D_INFO, "\n------------------------ AmtPlatformPolicy Dump End -------------------\n"));
+}
+
diff --git a/ReferenceCode/ME/Library/AMT/Dxe/AmtPolicyLib.c b/ReferenceCode/ME/Library/AMT/Dxe/AmtPolicyLib.c
new file mode 100644
index 0000000..4448504
--- /dev/null
+++ b/ReferenceCode/ME/Library/AMT/Dxe/AmtPolicyLib.c
@@ -0,0 +1,547 @@
+/** @file
+ Implementation file for AMT Policy functionality
+
+@copyright
+ Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+
+#include "EdkIIGlueDxe.h"
+#include "AmtPolicyLib.h"
+#include "MeLib.h"
+
+#include EFI_PROTOCOL_CONSUMER (ActiveManagement)
+#include EFI_PROTOCOL_CONSUMER (AmtPlatformPolicy)
+#endif
+//
+// Global variables
+//
+DXE_AMT_POLICY_PROTOCOL *mDxePlatformAmtPolicy = NULL;
+
+/**
+ Check if AMT is enabled in setup options.
+
+ @param[in] None.
+
+ @retval EFI_SUCCESS AMT platform policy pointer is initialized.
+ @retval All other error conditions encountered when no AMT platform policy available.
+**/
+EFI_STATUS
+AmtPolicyLibInit (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+
+ if (mDxePlatformAmtPolicy != NULL) {
+ return EFI_SUCCESS;
+ }
+ //
+ // Get the desired platform setup policy.
+ //
+ Status = gBS->LocateProtocol (&gDxePlatformAmtPolicyGuid, NULL, (VOID **) &mDxePlatformAmtPolicy);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "No AMT Platform Policy Protocol available"));
+ ASSERT_EFI_ERROR(Status);
+ } else if (mDxePlatformAmtPolicy == NULL) {
+ DEBUG ((EFI_D_ERROR, "No AMT Platform Policy Protocol available"));
+ Status = EFI_UNSUPPORTED;
+ }
+
+ return Status;
+}
+
+/**
+ Check if Asf is enabled in setup options.
+
+ @param[in] None.
+
+ @retval FALSE Asf is disabled.
+ @retval TRUE Asf is enabled.
+**/
+BOOLEAN
+AsfSupported (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+
+ if (mDxePlatformAmtPolicy == NULL) {
+ Status = AmtPolicyLibInit();
+ if (EFI_ERROR(Status)) {
+ return FALSE;
+ }
+ }
+ //
+ // First check if ASF support is enabled in Setup.
+ //
+ if (mDxePlatformAmtPolicy->AmtConfig.AsfEnabled != 1) {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/**
+ Check if Amt is enabled in setup options.
+
+ @param[in] None.
+
+ @retval FALSE Amt is disabled.
+ @retval TRUE Amt is enabled.
+**/
+BOOLEAN
+AmtSupported (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+
+ if (mDxePlatformAmtPolicy == NULL) {
+ Status = AmtPolicyLibInit();
+ if (EFI_ERROR(Status)) {
+ return FALSE;
+ }
+ }
+ //
+ // First check if AMT support is enabled in Setup.
+ //
+ if (mDxePlatformAmtPolicy->AmtConfig.iAmtEnabled != 1) {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/**
+ Check if AMT BIOS Extension hotkey was pressed during BIOS boot.
+
+ @param[in] None.
+
+ @retval FALSE MEBx hotkey was not pressed.
+ @retval TRUE MEBx hotkey was pressed.
+**/
+BOOLEAN
+AmtHotkeyPressed (
+ VOID
+ )
+{
+ BOOLEAN Supported;
+ EFI_STATUS Status;
+
+ if (mDxePlatformAmtPolicy == NULL) {
+ Status = AmtPolicyLibInit();
+ if (EFI_ERROR(Status)) {
+ return FALSE;
+ }
+ }
+ //
+ // First check if AMT Setup Prompt is enabled in Setup.
+ //
+ if (mDxePlatformAmtPolicy->AmtConfig.iAmtbxHotkeyPressed == 1) {
+ Supported = TRUE;
+ } else {
+ Supported = FALSE;
+ }
+
+ return Supported;
+}
+
+/**
+ Check if AMT BIOS Extension Selection Screen is enabled in setup options.
+
+ @param[in] None.
+
+ @retval FALSE AMT Selection Screen is disabled.
+ @retval TRUE AMT Selection Screen is enabled.
+**/
+BOOLEAN
+AmtSelectionScreen (
+ VOID
+ )
+{
+ BOOLEAN Supported;
+ EFI_STATUS Status;
+
+ if (mDxePlatformAmtPolicy == NULL) {
+ Status = AmtPolicyLibInit();
+ if (EFI_ERROR(Status)) {
+ return FALSE;
+ }
+ }
+ //
+ // First check if AMT Selection Screen is enabled in Setup.
+ //
+ if (mDxePlatformAmtPolicy->AmtConfig.iAmtbxSelectionScreen == 1) {
+ Supported = TRUE;
+ } else {
+ Supported = FALSE;
+ }
+
+ return Supported;
+}
+
+/**
+ Check if AMT WatchDog is enabled in setup options.
+
+ @param[in] None.
+
+ @retval FALSE AMT WatchDog is disabled.
+ @retval TRUE AMT WatchDog is enabled.
+**/
+BOOLEAN
+AmtWatchDog (
+ VOID
+ )
+{
+ BOOLEAN Supported;
+ EFI_STATUS Status;
+
+ if (mDxePlatformAmtPolicy == NULL) {
+ Status = AmtPolicyLibInit();
+ if (EFI_ERROR(Status)) {
+ return FALSE;
+ }
+ }
+ Supported = FALSE;
+ if (ManageabilityModeSetting () != 0) {
+ //
+ // First check if AMT WatchDog is enabled in Setup.
+ //
+ if (AsfSupported ()) {
+ if (mDxePlatformAmtPolicy->AmtConfig.WatchDog == 1) {
+ Supported = TRUE;
+ }
+ }
+ }
+
+ return Supported;
+}
+
+/**
+ Return BIOS watchdog timer
+
+ @param[in] None.
+
+ @retval UINT16 BIOS ASF Watchdog Timer
+**/
+UINT16
+AmtWatchDogTimerBiosGet (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+
+ if (mDxePlatformAmtPolicy == NULL) {
+ Status = AmtPolicyLibInit();
+ if (EFI_ERROR(Status)) {
+ return 0;
+ }
+ }
+ return mDxePlatformAmtPolicy->AmtConfig.WatchDogTimerBios;
+}
+
+/**
+ Return OS watchdog timer
+
+ @param[in] None.
+
+ @retval UINT16 OS ASF Watchdog Timer
+**/
+UINT16
+AmtWatchDogTimerOsGet (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+
+ if (mDxePlatformAmtPolicy == NULL) {
+ Status = AmtPolicyLibInit();
+ if (EFI_ERROR(Status)) {
+ return 0;
+ }
+ }
+ return mDxePlatformAmtPolicy->AmtConfig.WatchDogTimerOs;
+}
+
+/**
+ Provide CIRA request information from OEM code.
+
+ @param[in] None.
+
+ @retval Check if any CIRA requirement during POST
+**/
+BOOLEAN
+AmtCiraRequestTrigger (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+
+ if (mDxePlatformAmtPolicy == NULL) {
+ Status = AmtPolicyLibInit();
+ if (EFI_ERROR(Status)) {
+ return FALSE;
+ }
+ }
+ return mDxePlatformAmtPolicy->AmtConfig.CiraRequest == 1;
+}
+
+/**
+ Provide CIRA request Timeout from OEM code.
+
+ @param[in] None.
+
+ @retval CIRA require Timeout for MPS connection to be estabilished
+**/
+UINT8
+AmtCiraRequestTimeout (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+
+ if (mDxePlatformAmtPolicy == NULL) {
+ Status = AmtPolicyLibInit();
+ if (EFI_ERROR(Status)) {
+ return FALSE;
+ }
+ }
+ return mDxePlatformAmtPolicy->AmtConfig.CiraTimeout;
+}
+
+/**
+ Provide Manageability Mode setting from MEBx BIOS Sync Data
+
+ @param[in] None
+
+ @retval UINT8 Manageability Mode = MNT_AMT or MNT_ASF
+**/
+UINT8
+ManageabilityModeSetting (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+
+ if (mDxePlatformAmtPolicy == NULL) {
+ Status = AmtPolicyLibInit();
+ if (EFI_ERROR(Status)) {
+ return 0;
+ }
+ }
+ return (UINT8) (mDxePlatformAmtPolicy->AmtConfig.ManageabilityMode);
+}
+
+/**
+ Provide UnConfigure ME without password request from OEM code.
+
+ @param[in] None.
+
+ @retval Check if unConfigure ME without password request
+**/
+BOOLEAN
+AmtUnConfigureMe (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+
+ if (mDxePlatformAmtPolicy == NULL) {
+ Status = AmtPolicyLibInit();
+ if (EFI_ERROR(Status)) {
+ return FALSE;
+ }
+ }
+ return mDxePlatformAmtPolicy->AmtConfig.UnConfigureMe == 1;
+}
+
+/**
+ Provide 'Hiding the Unconfigure ME without password confirmation prompt' request from OEM code.
+
+ @param[in] None.
+
+ @retval Check if 'Hide unConfigure ME without password Confirmation prompt' request
+**/
+BOOLEAN
+AmtHideUnConfigureMeConfPrompt (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+
+ if (mDxePlatformAmtPolicy == NULL) {
+ Status = AmtPolicyLibInit();
+ if (EFI_ERROR(Status)) {
+ return FALSE;
+ }
+ }
+ return mDxePlatformAmtPolicy->AmtConfig.HideUnConfigureMeConfirm == 1;
+}
+
+/**
+ Provide show MEBx debug message request from OEM code.
+
+ @param[in] None.
+
+ @retval Check show MEBx debug message request
+ **/
+BOOLEAN
+AmtMebxDebugMsg (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+
+ if (mDxePlatformAmtPolicy == NULL) {
+ Status = AmtPolicyLibInit();
+ if (EFI_ERROR(Status)) {
+ return FALSE;
+ }
+ }
+ return mDxePlatformAmtPolicy->AmtConfig.MebxDebugMsg == 1;
+}
+
+/**
+ Provide on-board device list table and do not need to report them to AMT. AMT only need to know removable PCI device
+ information.
+
+ @param[in] None.
+
+ @retval on-board device list table pointer other than system device.
+**/
+UINT32
+AmtPciDeviceFilterOutTable (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+
+ if (mDxePlatformAmtPolicy == NULL) {
+ Status = AmtPolicyLibInit();
+ if (EFI_ERROR(Status)) {
+ return 0;
+ }
+ }
+ return mDxePlatformAmtPolicy->AmtConfig.PciDeviceFilterOutTable;
+}
+
+/**
+ Check if USB provisioning enabled/disabled in platform policy.
+
+ @param[in] None.
+
+ @retval FALSE USB provisioning is disabled.
+ @retval TRUE USB provisioning is enabled.
+**/
+BOOLEAN
+USBProvisionSupport (
+ VOID
+ )
+{
+ BOOLEAN Supported;
+ EFI_STATUS Status;
+
+ if (mDxePlatformAmtPolicy == NULL) {
+ Status = AmtPolicyLibInit();
+ if (EFI_ERROR(Status)) {
+ return FALSE;
+ }
+ }
+ Supported = FALSE;
+
+ //
+ // First check if USB Provision is enabled in Setup.
+ //
+ if (mDxePlatformAmtPolicy->AmtConfig.USBProvision == 1) {
+ Supported = TRUE;
+ }
+
+ return Supported;
+}
+
+/**
+ This will return progress event Option.
+ True if the option is enabled.
+
+ @param[in] None.
+
+ @retval True progress event is enabled.
+ @retval False progress event is disabled.
+**/
+BOOLEAN
+FwProgressSupport (
+ VOID
+ )
+{
+ BOOLEAN Supported;
+ EFI_STATUS Status;
+
+ if (mDxePlatformAmtPolicy == NULL) {
+ Status = AmtPolicyLibInit();
+ if (EFI_ERROR(Status)) {
+ return FALSE;
+ }
+ }
+ Supported = FALSE;
+
+ //
+ // First check if FW Progress is enabled in Setup.
+ //
+ if (mDxePlatformAmtPolicy->AmtConfig.FWProgress == 1) {
+ Supported = TRUE;
+ }
+
+ return Supported;
+}
+
+/**
+ Check if ForcMebxSyncUp is enabled in setup options.
+
+ @param[in] None.
+
+ @retval FALSE ForcMebxSyncUp is disabled.
+ @retval TRUE ForcMebxSyncUp is enabled.
+**/
+BOOLEAN
+AmtForcMebxSyncUp (
+ VOID
+ )
+{
+ BOOLEAN Supported;
+ EFI_STATUS Status;
+
+ if (mDxePlatformAmtPolicy == NULL) {
+ Status = AmtPolicyLibInit();
+ if (EFI_ERROR(Status)) {
+ return FALSE;
+ }
+ }
+ if (mDxePlatformAmtPolicy->AmtConfig.ForcMebxSyncUp == 1) {
+ Supported = TRUE;
+ } else {
+ Supported = FALSE;
+ }
+
+ return Supported;
+}
diff --git a/ReferenceCode/ME/Library/AMT/Dxe/AmtPolicyLib.h b/ReferenceCode/ME/Library/AMT/Dxe/AmtPolicyLib.h
new file mode 100644
index 0000000..866c5c0
--- /dev/null
+++ b/ReferenceCode/ME/Library/AMT/Dxe/AmtPolicyLib.h
@@ -0,0 +1,298 @@
+/** @file
+ Header file for AMT Policy functionality
+
+@copyright
+ Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _AMT_POLICY_LIB_H_
+#define _AMT_POLICY_LIB_H_
+
+#include EFI_PROTOCOL_DEFINITION (AmtPlatformPolicy)
+#include EFI_GUID_DEFINITION (MeBiosExtensionSetup)
+
+/**
+ Check if AMT is enabled in setup options.
+
+ @param[in] None.
+
+ @retval EFI_SUCCESS AMT platform policy is initialized.
+ @retval All other error conditions encountered when no AMT platform policy available.
+**/
+EFI_STATUS
+AmtPolicyLibInit (
+ VOID
+ )
+;
+
+/**
+ Check if Asf is enabled in setup options.
+
+ @param[in] None.
+
+ @retval FALSE Asf is disabled.
+ @retval TRUE Asf is enabled.
+**/
+BOOLEAN
+AsfSupported (
+ VOID
+ )
+;
+
+/**
+ Check if Amt is enabled in setup options.
+
+ @param[in] None.
+
+ @retval FALSE Amt is disabled.
+ @retval TRUE Amt is enabled.
+**/
+BOOLEAN
+AmtSupported (
+ VOID
+ )
+;
+
+/**
+ Check if AMT BIOS Extension hotkey was pressed during BIOS boot.
+
+ @param[in] None.
+
+ @retval FALSE MEBx hotkey was not pressed.
+ @retval TRUE MEBx hotkey was pressed.
+**/
+BOOLEAN
+AmtHotkeyPressed (
+ VOID
+ )
+;
+
+/**
+ Check if AMT BIOS Extension Selection Screen is enabled in setup options.
+
+ @param[in] None.
+
+ @retval FALSE AMT Selection Screen is disabled.
+ @retval TRUE AMT Selection Screen is enabled.
+**/
+BOOLEAN
+AmtSelectionScreen (
+ VOID
+ )
+;
+
+/**
+ Check if AMT WatchDog is enabled in setup options.
+
+ @param[in] None.
+
+ @retval FALSE AMT WatchDog is disabled.
+ @retval TRUE AMT WatchDog is enabled.
+**/
+BOOLEAN
+AmtWatchDog (
+ VOID
+ )
+;
+
+/**
+ Return BIOS watchdog timer
+
+ @param[in] None.
+
+ @retval UINT16 BIOS ASF Watchdog Timer
+**/
+UINT16
+AmtWatchDogTimerBiosGet (
+ VOID
+ )
+;
+
+/**
+ Return OS watchdog timer
+
+ @param[in] None.
+
+ @retval UINT16 OS ASF Watchdog Timer
+**/
+UINT16
+AmtWatchDogTimerOsGet (
+ VOID
+ )
+;
+
+/**
+ Provide CIRA request information from OEM code.
+
+ @param[in] None.
+
+ @retval Check if any CIRA requirement during POST
+**/
+BOOLEAN
+AmtCiraRequestTrigger (
+ VOID
+ )
+;
+
+/**
+ Provide CIRA request Timeout from OEM code.
+
+ @param[in] None.
+
+ @retval CIRA require Timeout for MPS connection to be estabilished
+**/
+UINT8
+AmtCiraRequestTimeout (
+ VOID
+ )
+
+;
+
+/**
+ Provide Manageability Mode setting from MEBx BIOS Sync Data
+
+ @param[in] None
+
+ @retval UINT8 Manageability Mode = MNT_AMT or MNT_ASF
+**/
+UINT8
+ManageabilityModeSetting (
+ VOID
+ )
+;
+
+/**
+ Provide UnConfigure ME without password request from OEM code.
+
+ @param[in] None.
+
+ @retval Check if unConfigure ME without password request
+**/
+BOOLEAN
+AmtUnConfigureMe (
+ VOID
+ )
+;
+
+/**
+ Provide 'Hiding the Unconfigure ME without password confirmation prompt' request from OEM code.
+
+ @param[in] None.
+
+ @retval Check if 'Hide unConfigure ME without password Confirmation prompt' request
+**/
+BOOLEAN
+AmtHideUnConfigureMeConfPrompt (
+ VOID
+ )
+;
+
+/**
+ Provide show MEBx debug message request from OEM code.
+
+ @param[in] None.
+
+ @retval Check show MEBx debug message request
+ **/
+BOOLEAN
+AmtMebxDebugMsg (
+ VOID
+ )
+;
+
+/**
+ Provide on-board device list table and do not need to report them to AMT. AMT only need to know removable PCI device
+ information.
+
+ @param[in] None.
+
+ @retval on-board device list table pointer other than system device.
+**/
+UINT32
+AmtPciDeviceFilterOutTable (
+ VOID
+ )
+;
+
+/**
+ Check if USB provisioning enabled/disabled in platform policy.
+
+ @param[in] None.
+
+ @retval FALSE USB provisioning is disabled.
+ @retval TRUE USB provisioning is enabled.
+**/
+BOOLEAN
+USBProvisionSupport (
+ VOID
+ )
+;
+
+/**
+ This will return progress event Option.
+ True if the option is enabled.
+
+ @param[in] None.
+
+ @retval True progress event is enabled.
+ @retval False progress event is disabled.
+**/
+BOOLEAN
+FwProgressSupport (
+ VOID
+ )
+;
+
+/**
+ Check if ForcMebxSyncUp is enabled in setup options.
+
+ @param[in] None.
+
+ @retval FALSE ForcMebxSyncUp is disabled.
+ @retval TRUE ForcMebxSyncUp is enabled.
+**/
+BOOLEAN
+AmtForcMebxSyncUp (
+ VOID
+ )
+;
+
+/**
+ Dump DXE Amt Platform Policy
+
+ @param[in] None.
+
+ @retval None
+**/
+VOID
+DxeAmtPolicyDebugDump (
+ VOID
+ )
+;
+
+/**
+ Dump ME_BIOS_EXTENSION_SETUP variable
+
+ @param[in] MeBiosExtensionSetup Pointer to ME_BIOS_EXTENSION_SETUP variable
+
+ @retval None
+**/
+VOID
+DxeMebxSetupVariableDebugDump (
+ IN ME_BIOS_EXTENSION_SETUP *MeBiosExtensionSetup OPTIONAL
+ )
+;
+#endif
diff --git a/ReferenceCode/ME/Library/AMT/Dxe/MebxSetupDebugDumpDxe.c b/ReferenceCode/ME/Library/AMT/Dxe/MebxSetupDebugDumpDxe.c
new file mode 100644
index 0000000..7fd5048
--- /dev/null
+++ b/ReferenceCode/ME/Library/AMT/Dxe/MebxSetupDebugDumpDxe.c
@@ -0,0 +1,75 @@
+/** @file
+ Dump whole ME_BIOS_EXTENSION_SETUP and serial out.
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "AmtPolicyLib.h"
+#endif
+
+/**
+ Dump ME_BIOS_EXTENSION_SETUP variable
+
+ @param[in] MeBiosExtensionSetup Pointer to ME_BIOS_EXTENSION_SETUP variable
+
+ @retval None
+**/
+VOID
+DxeMebxSetupVariableDebugDump (
+ IN ME_BIOS_EXTENSION_SETUP *MeBiosExtensionSetup OPTIONAL
+ )
+{
+ EFI_STATUS Status;
+ UINTN VariableSize;
+ ME_BIOS_EXTENSION_SETUP MeBxSetup;
+ ME_BIOS_EXTENSION_SETUP *MeBxSetupPtr;
+
+ if (MeBiosExtensionSetup == NULL) {
+ Status = gRT->GetVariable (
+ gEfiMeBiosExtensionSetupName,
+ &gEfiMeBiosExtensionSetupGuid,
+ NULL,
+ &VariableSize,
+ &MeBxSetup
+ );
+ if (EFI_ERROR(Status)) {
+ return;
+ }
+ MeBxSetupPtr = &MeBxSetup;
+ } else {
+ MeBxSetupPtr = MeBiosExtensionSetup;
+ }
+
+ DEBUG ((EFI_D_INFO, "\n------------------------ MeBiosExtensionSetup Dump Begin -----------------\n"));
+ DEBUG ((EFI_D_INFO, " InterfaceVersion : 0x%x\n", MeBxSetupPtr->InterfaceVersion));
+ DEBUG ((EFI_D_INFO, " Flags : 0x%x\n", MeBxSetupPtr->Flags));
+ DEBUG ((EFI_D_INFO, " PlatformMngSel : 0x%x\n", MeBxSetupPtr->PlatformMngSel));
+ DEBUG ((EFI_D_INFO, " AmtSolIder : 0x%x\n", MeBxSetupPtr->AmtSolIder));
+ DEBUG (
+ (EFI_D_INFO,
+ " RemoteAssistanceTriggerAvailablilty : 0x%x\n",
+ MeBxSetupPtr->RemoteAssistanceTriggerAvailablilty)
+ );
+ DEBUG ((EFI_D_INFO, " KvmEnable : 0x%x\n", MeBxSetupPtr->KvmEnable));
+ DEBUG ((EFI_D_INFO, " MebxDefaultSolIder : 0x%x\n", MeBxSetupPtr->MebxDefaultSolIder));
+
+ DEBUG ((EFI_D_INFO, "\n------------------------ MeBiosExtensionSetup Dump End -------------------\n"));
+
+}
diff --git a/ReferenceCode/ME/Library/AMT/Include/Amt.h b/ReferenceCode/ME/Library/AMT/Include/Amt.h
new file mode 100644
index 0000000..9698218
--- /dev/null
+++ b/ReferenceCode/ME/Library/AMT/Include/Amt.h
@@ -0,0 +1,59 @@
+/** @file
+ Header file for common Active Management Technology defines.
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _AMT_H_
+#define _AMT_H_
+
+///
+/// Intel Internet Assigned Numbers Authority Manufacturer ID
+/// (The firmware sends 0x57010000 for decimal value 343)
+///
+#define INTEL_IANA_SWAP32(x) ((((x) & 0xff) << 24) | (((x) & 0xff00) << 8) | \
+ (((x) & 0xff0000) >> 8) | (((x) & 0xff000000) >> 24))
+#define ASF_INTEL_IANA 0x00000157
+#define ASF_INTEL_CONVERTED_IANA INTEL_IANA_SWAP32 (ASF_INTEL_IANA) ///< 0X57010000, received from ME
+///
+/// Intel OEM Special Command
+///
+#define ASF_INTEL_OEM_CMD 0xC1
+
+///
+/// Intel OEM Parameters 16 bit OEM Parameter values
+///
+#define USE_SOL 0x0001 ///< 0000 0000 0000 0001 - bit 0, use SOL on the next boot
+//
+// Intel OEM Command 16 bit special command parameter values
+//
+#define USE_IDER 0x0001 ///< 0000 0000 0000 0001 - bit 0 Paramater 2 will be used to indicate the channel
+#define ENFORCE_SECURE_BOOT 0x0002 ///< 0000 0000 0000 0010 - bit 1 Enforce secure boot over IDER
+#define REFLASH_BIOS 0x0004 ///< 0000 0000 0000 0100 - bit 2
+#define BIOS_SETUP 0x0008 ///< 0000 0000 0000 1000 - bit 3
+#define BIOS_PAUSE 0x0010 ///< 0000 0000 0001 0000 - bit 4
+#define USE_KVM 0x0020 ///< 0000 0000 0010 0000 - bit 5
+#define IDER_CD 0x0100 ///< 0000 0001 0000 0000 - bit 8 Primary Slave Drive
+#define IDER_PRIMARY_MASTER 0x0000
+#define IDER_PRIMARY_SLAVE 0x0100
+#define IDER_SECONDARY_MASTER 0x0200
+#define IDER_SECONDARY_SLAVE 0x0300
+
+#define IDER_BOOT_DEVICE_MASK 0x0300
+#define IDER_BOOT_DEVICE_SHIFT 8
+
+#endif
diff --git a/ReferenceCode/ME/Library/AMT/Pei/AmtLibPei.cif b/ReferenceCode/ME/Library/AMT/Pei/AmtLibPei.cif
new file mode 100644
index 0000000..1c34f45
--- /dev/null
+++ b/ReferenceCode/ME/Library/AMT/Pei/AmtLibPei.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "AmtLibPei"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\Library\AMT\Pei\"
+ RefName = "AmtLibPei"
+[files]
+"AmtLibPei.sdl"
+"AmtLibPei.mak"
+"AmtPolicyLibPei.c"
+"AmtPolicyLibPei.h"
+"AmtLibPei.h"
+"AmtLibPei.inf"
+<endComponent>
diff --git a/ReferenceCode/ME/Library/AMT/Pei/AmtLibPei.h b/ReferenceCode/ME/Library/AMT/Pei/AmtLibPei.h
new file mode 100644
index 0000000..4b29fc9
--- /dev/null
+++ b/ReferenceCode/ME/Library/AMT/Pei/AmtLibPei.h
@@ -0,0 +1,26 @@
+/** @file
+ Header file for PEI AMT functionality
+
+@copyright
+ Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PEI_AMT_LIB_H_
+#define _PEI_AMT_LIB_H_
+
+#include "AmtPolicyLibPei.h"
+
+#endif
diff --git a/ReferenceCode/ME/Library/AMT/Pei/AmtLibPei.inf b/ReferenceCode/ME/Library/AMT/Pei/AmtLibPei.inf
new file mode 100644
index 0000000..44d88ad
--- /dev/null
+++ b/ReferenceCode/ME/Library/AMT/Pei/AmtLibPei.inf
@@ -0,0 +1,51 @@
+## @file
+# Component description file for AMT Library functions for PEIMs
+#
+#@copyright
+# Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = AmtLibPei
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ AmtPolicyLibPei.c
+ AmtPolicyLibPei.h
+ AmtLibPei.h
+
+[includes.common]
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)
+
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[libraries.common]
+ EdkIIGluePeiServicesLib
+
+[nmake.common]
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_PEI_SERVICES_LIB__
diff --git a/ReferenceCode/ME/Library/AMT/Pei/AmtLibPei.mak b/ReferenceCode/ME/Library/AMT/Pei/AmtLibPei.mak
new file mode 100644
index 0000000..e31ecc5
--- /dev/null
+++ b/ReferenceCode/ME/Library/AMT/Pei/AmtLibPei.mak
@@ -0,0 +1,50 @@
+# /*++
+# Copyright (c) 2009 Intel Corporation. All rights reserved.
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+# --*/
+# MAK file for the ModulePart:AmtLibPei
+all : AmtLibPei
+
+$(BUILD_DIR)\AmtLibPei.lib : AmtLibPei
+
+AmtLibPei : $(BUILD_DIR)\AmtLibPei.mak AmtLibPeiBin
+
+$(BUILD_DIR)\AmtLibPei.mak : $(AmtLibPei_DIR)\$(@B).cif $(AmtLibPei_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(AmtLibPei_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+AmtLibPei_INCLUDES=\
+ $(EDK_INCLUDES) \
+ $(EdkIIGlueLib_INCLUDES)\
+ $(ME_INCLUDES) \
+
+AmtLibPei_DEFINES=\
+ /D __EDKII_GLUE_PEI_SERVICES_LIB__
+
+AmtLibPei_LIBS=\
+ $(EdkIIGluePeiServicesLib_LIB)\
+
+AmtLibPeiBin : $(AmtLibPei_LIBS) $(MeLibPei_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS) \
+ /f $(BUILD_DIR)\AmtLibPei.mak all \
+ "MY_INCLUDES=$(AmtLibPei_INCLUDES)" \
+ "CFLAGS=$(CFLAGS) $(AmtLibPei_DEFINES)"\
+ TYPE=PEI_LIBRARY \
+#**********************************************************************
+#**********************************************************************
+#** **
+#** (C)Copyright 1985-2006, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 6145-F Northbelt Pkwy, Norcross, GA 30071 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#**********************************************************************
+#**********************************************************************
diff --git a/ReferenceCode/ME/Library/AMT/Pei/AmtLibPei.sdl b/ReferenceCode/ME/Library/AMT/Pei/AmtLibPei.sdl
new file mode 100644
index 0000000..b3a63bd
--- /dev/null
+++ b/ReferenceCode/ME/Library/AMT/Pei/AmtLibPei.sdl
@@ -0,0 +1,36 @@
+TOKEN
+ Name = "AmtLibPei_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable AmtLibPei support in Project"
+End
+
+MODULE
+ Help = "Includes AmtLibPei.mak to Project"
+ File = "AmtLibPei.mak"
+End
+
+PATH
+ Name = "AmtLibPei_DIR"
+ Help = "iAMT Library file source directory"
+End
+
+ELINK
+ Name = "AmtLibPei_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\AmtLibPei.lib"
+ Parent = "AmtLibPei_LIB"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(AmtLibPei_DIR)"
+ Parent = "ME_INCLUDES"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/ME/Library/AMT/Pei/AmtPolicyLibPei.c b/ReferenceCode/ME/Library/AMT/Pei/AmtPolicyLibPei.c
new file mode 100644
index 0000000..472ebbc
--- /dev/null
+++ b/ReferenceCode/ME/Library/AMT/Pei/AmtPolicyLibPei.c
@@ -0,0 +1,241 @@
+/** @file
+ Implementation file for AMT Policy functionality for PEIM
+
+@copyright
+ Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#include "AmtPolicyLibPei.h"
+#endif
+
+EFI_GUID mPeiAmtStatusCodePpiGuid = PEI_AMT_STATUS_CODE_PPI_GUID;
+
+/**
+ Check if Amt is enabled in setup options.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] PeiAmtPlatformPolicy The AMT Platform Policy protocol instance
+
+ @retval EFI_SUCCESS AMT platform policy Ppi located
+ @retval All other error conditions encountered result in an ASSERT.
+**/
+EFI_STATUS
+PeiAmtPolicyLibInit (
+ EFI_PEI_SERVICES **PeiServices,
+ PEI_AMT_PLATFORM_POLICY_PPI **PeiAmtPlatformPolicy
+ )
+{
+ EFI_STATUS Status;
+
+ ///
+ /// Locate system configuration variable
+ ///
+ Status = PeiServicesLocatePpi (
+ &gPeiAmtPlatformPolicyPpiGuid, // GUID
+ 0, // INSTANCE
+ NULL, // EFI_PEI_PPI_DESCRIPTOR
+ (VOID **) PeiAmtPlatformPolicy // PPI
+ );
+ ASSERT_EFI_ERROR (Status);
+ return Status;
+}
+
+/**
+ Check if AMT WatchDog is enabled in setup options.
+
+ @param[in] PeiServices Point to Pei Services structure
+
+ @retval FALSE AMT WatchDog is disabled.
+ @retval TRUE AMT WatchDog is enabled.
+**/
+BOOLEAN
+PeiAmtWatchDog (
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_STATUS Status;
+ BOOLEAN Supported;
+ PEI_AMT_PLATFORM_POLICY_PPI *PeiAmtPlatformPolicy;
+
+ Supported = FALSE;
+ if (ManageabilityModeSetting (PeiServices) != 0) {
+ Status = PeiAmtPolicyLibInit (PeiServices, &PeiAmtPlatformPolicy);
+ ASSERT_EFI_ERROR (Status);
+ //
+ // First check if AMT WatchDog is enabled in Setup.
+ //
+ if (PeiAmtPlatformPolicy->WatchDog == 1) {
+ Supported = TRUE;
+ }
+ }
+
+ return Supported;
+}
+
+/**
+ Get WatchDog BIOS Timmer.
+
+ @param[in] PeiServices Point to Pei Services structure
+
+ @retval UINT16 WatchDog BIOS Timer
+**/
+UINT16
+PeiAmtWatchTimerBiosGet (
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_STATUS Status;
+ PEI_AMT_PLATFORM_POLICY_PPI *PeiAmtPlatformPolicy;
+
+ Status = PeiAmtPolicyLibInit (PeiServices, &PeiAmtPlatformPolicy);
+ ASSERT_EFI_ERROR (Status);
+
+ return PeiAmtPlatformPolicy->WatchDogTimerBios;
+}
+
+/**
+ Check if AMT is enabled in setup options.
+
+ @param[in] PeiServices Point to Pei Services structure
+
+ @retval FALSE ActiveManagement is disabled.
+ @retval TRUE ActiveManagement is enabled.
+**/
+BOOLEAN
+PeiAmtSupported (
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_STATUS Status;
+ BOOLEAN Supported;
+ PEI_AMT_PLATFORM_POLICY_PPI *PeiAmtPlatformPolicy;
+
+ Status = PeiAmtPolicyLibInit (PeiServices, &PeiAmtPlatformPolicy);
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // First check if AMT support is enabled in Setup.
+ //
+ if (PeiAmtPlatformPolicy->iAmtEnabled == 1) {
+ Supported = TRUE;
+ } else {
+ Supported = FALSE;
+ }
+
+ return Supported;
+}
+
+/**
+ Check if ASF is enabled in setup options.
+
+ @param[in] PeiServices Point to Pei Services structure
+
+ @retval FALSE ASF is disabled.
+ @retval TRUE ASF is enabled.
+**/
+BOOLEAN
+PeiAsfSupported (
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_STATUS Status;
+ BOOLEAN Supported;
+ PEI_AMT_PLATFORM_POLICY_PPI *PeiAmtPlatformPolicy;
+
+ Status = PeiAmtPolicyLibInit (PeiServices, &PeiAmtPlatformPolicy);
+ ASSERT_EFI_ERROR (Status);
+
+ if (PeiAmtPlatformPolicy->Revision < PEI_AMT_PLATFORM_POLICY_PPI_REVISION_2) {
+ return FALSE;
+ }
+ //
+ // First check if ASF support is enabled in Setup.
+ //
+ if (PeiAmtPlatformPolicy->AsfEnabled == 1) {
+ Supported = TRUE;
+ } else {
+ Supported = FALSE;
+ }
+
+ return Supported;
+}
+
+/**
+ Provide Manageability Mode setting from MEBx BIOS Sync Data
+
+ @param[in] PeiServices Point to Pei Services structure
+
+ @retval UINT8 Manageability Mode = MNT_AMT or MNT_ASF
+**/
+UINT8
+ManageabilityModeSetting (
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_STATUS Status;
+ PEI_AMT_PLATFORM_POLICY_PPI *PeiAmtPlatformPolicy;
+
+ Status = PeiAmtPolicyLibInit (PeiServices, &PeiAmtPlatformPolicy);
+ ASSERT_EFI_ERROR (Status);
+
+ if (PeiAmtPlatformPolicy->Revision < PEI_AMT_PLATFORM_POLICY_PPI_REVISION_2) {
+ return 0;
+ }
+
+ return (UINT8) (PeiAmtPlatformPolicy->ManageabilityMode);
+}
+
+/**
+ This will return progress event Option.
+ True if the option is enabled.
+
+ @param[in] PeiServices Point to Pei Services structure
+
+ @retval True progress event is enabled.
+ @retval False progress event is disabled.
+**/
+BOOLEAN
+PeiFwProgressSupport (
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_STATUS Status;
+ BOOLEAN Supported;
+ PEI_AMT_PLATFORM_POLICY_PPI *PeiAmtPlatformPolicy;
+
+ Status = PeiAmtPolicyLibInit (PeiServices, &PeiAmtPlatformPolicy);
+ ASSERT_EFI_ERROR (Status);
+
+ Supported = FALSE;
+
+ if (PeiAmtPlatformPolicy->Revision >= PEI_AMT_PLATFORM_POLICY_PPI_REVISION_3) {
+ //
+ // Check if progress event is enabled in Setup.
+ //
+ if (PeiAmtPlatformPolicy->FWProgress == 1) {
+ Supported = TRUE;
+ }
+ }
+
+ return Supported;
+}
diff --git a/ReferenceCode/ME/Library/AMT/Pei/AmtPolicyLibPei.h b/ReferenceCode/ME/Library/AMT/Pei/AmtPolicyLibPei.h
new file mode 100644
index 0000000..b7361f4
--- /dev/null
+++ b/ReferenceCode/ME/Library/AMT/Pei/AmtPolicyLibPei.h
@@ -0,0 +1,126 @@
+/** @file
+ Header file for PEI AMT Policy functionality
+
+@copyright
+ Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PEI_AMT_POLICY_LIB_H_
+#define _PEI_AMT_POLICY_LIB_H_
+
+#include EFI_PPI_DEFINITION (AmtPlatformPolicyPei)
+#include EFI_PPI_DEFINITION (AmtStatusCode)
+
+/**
+ Check if Amt is enabled in setup options.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] PeiAmtPlatformPolicy The AMT Platform Policy protocol instance
+
+ @retval EFI_SUCCESS AMT platform policy Ppi located
+ @retval All other error conditions encountered result in an ASSERT.
+**/
+EFI_STATUS
+PeiAmtPolicyLibInit (
+ EFI_PEI_SERVICES **PeiServices,
+ PEI_AMT_PLATFORM_POLICY_PPI **PeiAmtPlatformPolicy
+ )
+;
+
+/**
+ Check if AMT WatchDog is enabled in setup options.
+
+ @param[in] PeiServices Point to Pei Services structure
+
+ @retval FALSE AMT WatchDog is disabled.
+ @retval TRUE AMT WatchDog is enabled.
+**/
+BOOLEAN
+PeiAmtWatchDog (
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+;
+
+/**
+ Get WatchDog BIOS Timmer.
+
+ @param[in] PeiServices Point to Pei Services structure
+
+ @retval UINT16 WatchDog BIOS Timer
+**/
+UINT16
+PeiAmtWatchTimerBiosGet (
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+;
+
+/**
+ Check if AMT is enabled in setup options.
+
+ @param[in] PeiServices Point to Pei Services structure
+
+ @retval FALSE ActiveManagement is disabled.
+ @retval TRUE ActiveManagement is enabled.
+**/
+BOOLEAN
+PeiAmtSupported (
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+;
+
+/**
+ Check if ASF is enabled in setup options.
+
+ @param[in] PeiServices Point to Pei Services structure
+
+ @retval FALSE ASF is disabled.
+ @retval TRUE ASF is enabled.
+**/
+BOOLEAN
+PeiAsfSupported (
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+;
+
+/**
+ Provide Manageability Mode setting from MEBx BIOS Sync Data
+
+ @param[in] PeiServices Point to Pei Services structure
+
+ @retval UINT8 Manageability Mode = MNT_AMT or MNT_ASF
+**/
+UINT8
+ManageabilityModeSetting (
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+;
+
+/**
+ This will return progress event Option.
+ True if the option is enabled.
+
+ @param[in] PeiServices Point to Pei Services structure
+
+ @retval True progress event is enabled.
+ @retval False progress event is disabled.
+**/
+BOOLEAN
+PeiFwProgressSupport (
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+;
+
+#endif
diff --git a/ReferenceCode/ME/Library/AtLibrary/AtLibrary.cif b/ReferenceCode/ME/Library/AtLibrary/AtLibrary.cif
new file mode 100644
index 0000000..1584c4d
--- /dev/null
+++ b/ReferenceCode/ME/Library/AtLibrary/AtLibrary.cif
@@ -0,0 +1,10 @@
+<component>
+ name = "AtLibrary"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\Library\AtLibrary\"
+ RefName = "AtLibrary"
+[files]
+"AtLibrary.sdl"
+[parts]
+"AtDxeLib"
+<endComponent>
diff --git a/ReferenceCode/ME/Library/AtLibrary/AtLibrary.sdl b/ReferenceCode/ME/Library/AtLibrary/AtLibrary.sdl
new file mode 100644
index 0000000..c712a95
--- /dev/null
+++ b/ReferenceCode/ME/Library/AtLibrary/AtLibrary.sdl
@@ -0,0 +1,20 @@
+TOKEN
+ Name = "AtLibrary_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable AmtLibDxe support in Project"
+End
+
+PATH
+ Name = "AtLibrary_DIR"
+ Help = "iAMT Library file source directory"
+End
+
+ELINK
+ Name = "/I$(AtLibrary_DIR)"
+ Parent = "ME_INCLUDES"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/ME/Library/AtLibrary/Dxe/AtAmHelper.c b/ReferenceCode/ME/Library/AtLibrary/Dxe/AtAmHelper.c
new file mode 100644
index 0000000..54b5959
--- /dev/null
+++ b/ReferenceCode/ME/Library/AtLibrary/Dxe/AtAmHelper.c
@@ -0,0 +1,630 @@
+/** @file
+ AT authetication module for using AT DXE driver.
+ This driver uses the AT protocol, HECI Protocol and AT Platform Policy to implement Theft Deterrence Technology AM module.
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+
+#include "AtAmHelper.h"
+
+const CHAR8 *PEMCodes = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-!=";
+const CHAR8 *LineBreak = " \n\t";
+
+/**
+ Convert Hex values into Base32 values
+
+ @param[in] encodedStr Array of encoded BASE values.
+ @param[in] encodedLen Length of encoded values.
+ @param[out] rawData Array of Hex strings that needs to be encoded into BASE32.
+ @param[out] rawDataLen Length of Hex values.
+
+ @retval EFI_BUFFER_TOO_SMALL Buffer to store encoded string too small.
+ @retval EFI_SUCCESS Initialization complete.
+**/
+EFI_STATUS
+Base32Encode (
+ IN UINT8 *encodedStr,
+ IN UINTN *encodedLen,
+ OUT UINT8 *rawData,
+ OUT UINTN rawDataLen
+ )
+{
+ UINTN i;
+ UINTN j;
+ UINT8 value;
+ INTN shift;
+ INTN shifttable[] = { 3, -2, 1, -4, -1, 2, -3, 0 };
+
+ if (encodedLen && *encodedLen < (rawDataLen * 8) / 5) {
+ DEBUG ((EFI_D_ERROR, "ATAm::Base32Encode: Buffer to store encoded string too small"));
+ return EFI_BUFFER_TOO_SMALL;
+ }
+
+ for (i = 0, j = 0; i < rawDataLen; j++) {
+ shift = shifttable[j % 8];
+ if (shift > 0) {
+ value = (UINT8) (rawData[i] >> shift);
+ } else {
+ value = (UINT8) (rawData[i] << (-shift));
+ if (i++ < rawDataLen - 1) {
+ value |= (rawData[i] >> (8 + shift));
+ }
+ }
+
+ value &= 0x1f;
+ if (25 >= value) {
+ value += 'A';
+ } else {
+ value += '2' - 26;
+ }
+
+ if (encodedStr && encodedLen) {
+ encodedStr[j] = value;
+ }
+ }
+
+ if (encodedStr && encodedLen) {
+ *encodedLen = j;
+ encodedStr[j] = L'\0';
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Convert Base32 values into Hex values.
+
+ @param[in] encodedStr Array of Decimal numbers.
+ @param[out] decodedData Converted Hex values.
+
+ @retval Length of the Hex Strings that expected.
+**/
+INTN
+Base32Decode (
+ IN UINT8 *encodedStr,
+ IN UINT8 *decodedData
+ )
+{
+ UINTN i;
+ UINTN j;
+ INTN retVal;
+ UINT8 value;
+ UINTN decodedLen;
+ INTN shifttable[] = { 3, -2, 1, -4, -1, 2, -3, 0 };
+ INTN shift;
+ UINTN encodedLen;
+
+ retVal = 1;
+ encodedLen = AsciiStrLen ((char *) encodedStr);
+
+ decodedLen = (encodedLen * 5) / 8;
+
+ decodedData[0] = 0;
+ for (i = 0, j = 0; i < encodedLen; i++) {
+ if ('A' <= encodedStr[i] && 'Z' >= encodedStr[i]) {
+ value = encodedStr[i] - 'A';
+ } else if ('a' <= encodedStr[i] && 'z' >= encodedStr[i]) {
+ value = encodedStr[i] - 'a';
+ } else if ('2' <= encodedStr[i] && '7' >= encodedStr[i]) {
+ value = encodedStr[i] - '2' + 26;
+ } else {
+ retVal = 0;
+ break;
+ }
+
+ shift = shifttable[i % 8];
+ if (shift > 0) {
+ decodedData[j] |= (value << shift);
+ } else {
+ decodedData[j] |= (value >> (-shift));
+ ///
+ /// Pack the bits that are going to fall off due to right shift in next byte
+ /// (left justfied) unless decoding the last character. In case of last
+ /// character, the extra bits are just padding to make the length of input
+ /// bits a multiple of 5 while encoding - so ignore them
+ ///
+ if (i != encodedLen - 1) {
+ decodedData[++j] = (UINT8) (value << (8 + shift));
+ }
+ }
+ }
+
+ return retVal;
+}
+
+/**
+ Decimal large (BASE10) into hex value.
+
+ @param[in][out] decStr Array of Decimal numbers.
+ @param[out] u8Hex Converted Hex values.
+ @param[in] hexIndex Length of the Hex Strings that expected
+
+ @retval None
+**/
+VOID
+DecimalToHexString (
+ IN OUT CHAR8 *decStr,
+ OUT UINT8 *u8Hex,
+ IN UINTN hexIndex
+ )
+{
+
+ UINTN i;
+ UINTN j;
+ UINTN Remainder;
+ CHAR8 Quotient;
+ UINTN num;
+ UINTN len;
+ UINTN leadingZero;
+
+ leadingZero = 1;
+
+ len = AsciiStrLen ((CHAR8 *) decStr);
+ Remainder = decStr[0] - '0';
+
+ if (len > 1) {
+ Remainder = Remainder * 10 + decStr[1] - '0';
+ }
+
+ if (len < 3) {
+ u8Hex[hexIndex] = (UINT8) Remainder;
+ return;
+ }
+
+ i = 2;
+ j = 0;
+ while (i < len) {
+ num = Remainder * 10 + decStr[i] - '0';
+ Quotient = (CHAR8) (num / 256);
+ if (!leadingZero || Quotient) {
+ decStr[j++] = '0' + Quotient;
+ leadingZero = 0;
+ }
+
+ Remainder = num % 256;
+ i++;
+
+ }
+
+ decStr[j] = L'\0';
+ u8Hex[hexIndex--] = (UINT8) Remainder;
+
+ if (decStr[0] != L'\0') {
+ DecimalToHexString (decStr, u8Hex, hexIndex);
+ }
+
+ return;
+}
+
+/**
+ Convert the CHAR8 ASCII into CHAR16 Unicode strings.
+
+ @param[in] AsciiString Ascii String.
+ @param[out] UnicodeString Buffer for converted Unicode string.
+
+ @retval None
+**/
+VOID
+Uint8ToUnicode (
+ IN CHAR8 *AsciiString,
+ OUT CHAR16 *UnicodeString
+ )
+{
+ UINT8 Index;
+
+ Index = 0;
+
+ while (AsciiString[Index] != 0) {
+ UnicodeString[Index] = (CHAR16) AsciiString[Index];
+ Index++;
+ }
+}
+
+/**
+ Decode a PEM-encoded character.
+
+ @param[in] pemChar PEM-encoded character.
+
+ @retval Value orresponding to the character, or PEM_INVALID_CHARACTER if the input character could not be decoded.
+**/
+UINT8
+DecodePEMChar (
+ IN UINT8 pemChar
+ )
+{
+ if ((pemChar >= 'A') && (pemChar <= 'Z')) {
+ return pemChar - 'A';
+ }
+
+ if ((pemChar >= 'a') && (pemChar <= 'z')) {
+ return (pemChar - 'a') + 26;
+ }
+
+ if ((pemChar >= '0') && (pemChar <= '9')) {
+ return (pemChar - '0') + 52;
+ }
+
+ if (pemChar == '-') {
+ return 62;
+ }
+
+ if (pemChar == '!') {
+ return 63;
+ }
+
+ if (pemChar == '=') {
+ return PEM_PAD_CHAR;
+
+ }
+
+ DEBUG ((EFI_D_ERROR, "DecodePEMChar: Invalid character %d\n", pemChar));
+ return PEM_INVALID_CHAR;
+}
+
+/**
+ Decode character in ASCII to hexadecimal
+
+ @param[in] base16char Character in ASCII
+
+ @retval Value in hexadecimal.
+**/
+UINT8
+DecodeBase16Char (
+ IN UINT8 base16char
+ )
+{
+ if (base16char >= '0' && base16char <= '9') {
+ return base16char - '0';
+ } else if (base16char >= 'A' && base16char <= 'F') {
+ return base16char - 'A' + 0xA;
+ } else if (base16char >= 'a' && base16char <= 'f') {
+ return base16char - 'a' + 0xA;
+ }
+
+ return 0;
+}
+
+/**
+ Decode ASCII string to hexadecimal string
+
+ @param[in] pString Pointer of ASCII string
+ @param[in] stringLen Size of the ASCII string
+ @param[out] pDecodedData Pointer of hexadecimal string
+ @param[out] pBufLength Pointer to buffer length returned
+
+ @retval FALSE Failed to decode the string by invalid length or buffer size
+ @retval TRUE The hexadecimal string returned
+**/
+BOOLEAN
+Base16Decode (
+ IN UINT8 *pString,
+ IN UINT32 stringLen,
+ OUT UINT8 *pDecodedData,
+ OUT UINT32 *pBufLength
+ )
+{
+ UINT32 i;
+ if (stringLen % 2 != 0) {
+ DEBUG ((EFI_D_ERROR, "Cannot decode hexadecimal string -- invalid length\n"));
+ } else if (*pBufLength < stringLen / 2) {
+ DEBUG ((EFI_D_ERROR, "Base16 decode - output buffer too small\n"));
+ } else {
+ for (i = 0; i < (UINT32) stringLen / 2; i++) {
+ pDecodedData[i] = DecodeBase16Char (pString[2 * i]) << 4;
+ pDecodedData[i] |= DecodeBase16Char (pString[2 * i + 1]);
+ }
+
+ *pBufLength = i;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/**
+ Encode string to ASCII code
+
+ @param[in] pData Pointer of string to be encoded
+ @param[in] dataLength Size of the string to be
+ @param[out] pEncodedData Pointer of encoded string
+ @param[out] pBufLength Pointer to buffer length returned
+
+ @retval FALSE Failed to encode the string by invalid length or buffer size
+ @retval TRUE The encoded string returned
+**/
+BOOLEAN
+Base16Encode (
+ IN UINT8 *pData,
+ IN UINT32 dataLength,
+ OUT UINT8 *pEncodedData,
+ OUT UINT32 *pBufLength
+ )
+{
+ UINT32 i;
+ if (*pBufLength < 2 * dataLength) {
+ DEBUG ((EFI_D_ERROR, "Cannot encode data -- output buffer too small\n"));
+ return FALSE;
+ }
+
+ DEBUG ((EFI_D_ERROR, "Base16Encode dataLength : %d\n", dataLength));
+
+ for (i = 0; i < dataLength; i++) {
+ AsciiSPrint ((CHAR8 *) &pEncodedData[2 * i], 3 * sizeof (UINT8), "%02x", pData[i] & 0xFF);
+ }
+
+ DEBUG ((EFI_D_ERROR, "Base16Encode AsciiSPrint : %s\n", (char *) pEncodedData));
+ DEBUG ((EFI_D_ERROR, "Base16Encode Sprint : %s\n", (char *) pEncodedData));
+
+ *pBufLength = 2 * dataLength;
+
+ return TRUE;
+}
+
+/**
+ Decode PEM-Encoded data
+
+ @param[in] pPEMString Pointer to PEM-Encoded buffer
+ @param[in] lineLength Length in bytes
+ @param[in] pDecodedData Pointer to buffer to receive decoded bytes
+ @param[in] pBufLength Pointer to the size of the output buffer. Upon return this will
+ contain the length of the decoded data
+
+ @retval Returns status code indicating outcome of operation
+**/
+BOOLEAN
+PEMSMSDecode (
+ IN UINT8 *pPEMString,
+ IN UINT32 lineLength,
+ OUT UINT8 *pDecodedData,
+ OUT UINT32 *pBufLength
+ )
+{
+ UINT8 *pStr;
+ UINT32 curOutLen;
+ UINT8 *pOut;
+ UINT32 i;
+ UINT32 padBytes;
+ UINT8 val1;
+ UINT8 val2;
+ UINT8 decodedValue[4];
+ UINT32 ii;
+ UINT32 unitCount;
+ UINT32 decodedBytes;
+
+ pStr = pPEMString;
+ curOutLen = *pBufLength;
+ pOut = pDecodedData;
+ padBytes = 0;
+
+ if (pStr != NULL) {
+ if ((lineLength % 4) != 0) {
+ DEBUG ((EFI_D_ERROR, "Cannot decode PEM string -- invalid length -1\n"));
+ return FALSE;
+ }
+
+ unitCount = lineLength / 4;
+
+ for (i = 0; (i < unitCount) && (padBytes == 0); i++) {
+ val1 = DecodePEMChar (*pStr++);
+ val2 = DecodePEMChar (*pStr++);
+
+ if ((val1 == PEM_INVALID_CHAR) || (val2 == PEM_INVALID_CHAR)) {
+ DEBUG ((EFI_D_ERROR, "Cannot decode PEM string -- invalid character -2\n"));
+ return FALSE;
+ }
+
+ decodedValue[0] = ((val1 << 2) | (val2 >> 4));
+ val1 = DecodePEMChar (*pStr++);
+ if (val1 == PEM_INVALID_CHAR) {
+ DEBUG ((EFI_D_ERROR, "Cannot decode PEM string -- invalid character -3\n"));
+ return FALSE;
+ }
+
+ if (val1 != PEM_PAD_CHAR) {
+ decodedValue[1] = ((val2 << 4) | (val1 >> 2));
+ val2 = DecodePEMChar (*pStr++);
+ if (val2 == PEM_INVALID_CHAR) {
+ DEBUG ((EFI_D_ERROR, "Cannot decode PEM string -- invalid character -4\n"));
+ return FALSE;
+ }
+
+ if (val2 == PEM_PAD_CHAR) {
+ padBytes = 1;
+ } else {
+ decodedValue[2] = ((val1 << 6) | val2);
+ }
+ } else {
+ val2 = DecodePEMChar (*pStr++);
+ if (val2 != PEM_PAD_CHAR) {
+ DEBUG ((EFI_D_ERROR, "Cannot decode PEM string -- invalid encoding -4\n"));
+ return FALSE;
+ }
+
+ padBytes = 2;
+ }
+
+ decodedBytes = (3 - padBytes);
+ if (curOutLen < decodedBytes) {
+ DEBUG ((EFI_D_ERROR, "Cannot decode PEM string -- out buffer too small-5\n"));
+ return FALSE;
+ }
+
+ for (ii = 0; ii < decodedBytes; ii++) {
+ pOut[ii] = decodedValue[ii];
+
+ }
+
+ curOutLen -= decodedBytes;
+ pOut += decodedBytes;
+ }
+ }
+
+ *pBufLength = *pBufLength - curOutLen;
+ return TRUE;
+}
+
+/**
+ Encoded data
+
+ @param[in] pData Pointer to buffer
+ @param[in] dataLength Length in bytes
+ @param[out] pPEMString Pointer to buffer to receive encoded bytes
+ @param[out] pBufLength Pointer to the size of the output buffer. Upon return this will
+ contain the length of the encoded data
+
+ @retval Returns status code indicating outcome of operation
+**/
+BOOLEAN
+PEMSMSEncode (
+ IN UINT8 *pData,
+ IN UINT32 dataLength,
+ OUT UINT8 *pPEMString,
+ OUT UINT32 *pBufLength
+ )
+{
+ UINT32 encodeUnits;
+ UINT32 paddedInputLength;
+ UINT32 padBytes;
+ UINT32 outLength;
+ UINT8 encodeBuf[3];
+ UINT32 i;
+ UINT8 *pOctet;
+ UINT32 ipos;
+ UINT32 opos;
+ UINT32 index;
+
+ encodeUnits = (dataLength + 2) / 3;
+ paddedInputLength = encodeUnits * 3;
+ padBytes = paddedInputLength - dataLength;
+ outLength = encodeUnits * 4;
+ pOctet = pData;
+ ipos = 0;
+ opos = 0;
+
+ outLength = encodeUnits * 4;
+ if (outLength % 64) {
+ outLength += ((outLength / 64) + 1);
+ } else {
+ outLength += (outLength / 64);
+
+ }
+
+ outLength++;
+ DEBUG ((EFI_D_ERROR, "ATAM: Pbuflength: %d OutLength: %d \n", *pBufLength, outLength));
+ if (*pBufLength < outLength) {
+ DEBUG ((EFI_D_ERROR, "ATAM: Failed \n"));
+ return FALSE;
+ }
+
+ for (i = 0; i < encodeUnits; i++) {
+ if ((i == encodeUnits - 1) && (padBytes > 0)) {
+ //
+ // Encode last piece, with padding
+ //
+ encodeBuf[0] = *pOctet++;
+ encodeBuf[1] = (padBytes == 1) ? encodeBuf[1] = *pOctet++ : 0;
+ encodeBuf[2] = 0;
+ ipos += (3 - padBytes);
+
+ index = encodeBuf[0] >> 2;
+ pPEMString[opos++] = PEMCodes[index];
+ index = ((encodeBuf[0] & 0x03) << 4) | (encodeBuf[1] >> 4);
+ pPEMString[opos++] = PEMCodes[index];
+
+ if (padBytes == 1) {
+ index = ((encodeBuf[1] & 0x0f) << 2) | (encodeBuf[2] >> 6);
+ pPEMString[opos++] = PEMCodes[index];
+ pPEMString[opos++] = '=';
+ } else {
+ pPEMString[opos++] = '=';
+ pPEMString[opos++] = '=';
+ }
+ } else {
+ //
+ // Encode next 3 bytes
+ //
+ encodeBuf[0] = *pOctet++;
+ encodeBuf[1] = *pOctet++;
+ encodeBuf[2] = *pOctet++;
+ ipos += 3;
+ index = encodeBuf[0] >> 2;
+ pPEMString[opos++] = PEMCodes[index];
+ index = ((encodeBuf[0] & 0x03) << 4) | (encodeBuf[1] >> 4);
+ pPEMString[opos++] = PEMCodes[index];
+ index = ((encodeBuf[1] & 0x0f) << 2) | (encodeBuf[2] >> 6);
+ pPEMString[opos++] = PEMCodes[index];
+ index = encodeBuf[2] & 0x3f;
+ pPEMString[opos++] = PEMCodes[index];
+ }
+ }
+
+ pPEMString[opos] = 0;
+ *pBufLength = opos;
+
+ return TRUE;
+}
+
+#ifdef EFI_DEBUG
+
+/**
+ This routine displays the debug message in ASCII
+
+ @param[in] Message Message to be displayed
+ @param[in] Length Length of the message
+
+ @retval None
+**/
+VOID
+ShowBuffer (
+ IN UINT8 *Message,
+ IN UINT32 Length
+ )
+{
+ UINT32 LineBreak;
+ UINT32 Index;
+ LineBreak = 0;
+ Index = 0;
+
+ while (Length-- > 0) {
+ if (LineBreak == 0) {
+ DEBUG ((EFI_D_ERROR, "%02x: ", (Index & 0xF0)));
+ }
+
+ DEBUG ((EFI_D_ERROR, "%02x ", Message[Index++]));
+ LineBreak++;
+ if (LineBreak == 16) {
+ DEBUG ((EFI_D_ERROR, "\n"));
+ LineBreak = 0;
+ }
+
+ if (LineBreak == 8) {
+ DEBUG ((EFI_D_ERROR, "- "));
+ }
+ }
+
+ DEBUG ((EFI_D_ERROR, "\n"));
+ return ;
+}
+
+#endif // End Of EFI_DEBUG
diff --git a/ReferenceCode/ME/Library/AtLibrary/Dxe/AtAmHelper.h b/ReferenceCode/ME/Library/AtLibrary/Dxe/AtAmHelper.h
new file mode 100644
index 0000000..43f2ffe
--- /dev/null
+++ b/ReferenceCode/ME/Library/AtLibrary/Dxe/AtAmHelper.h
@@ -0,0 +1,119 @@
+/** @file
+ AT authetication module for using AT DXE driver.
+ This library is utilized by the AT and related drivers to implement Theft Deterrence Technology AM module.
+
+@copyright
+ Copyright (c) 2004-2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+#ifndef _ATAM_HELPER_H_
+#define _ATAM_HELPER_H_
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#endif
+#include "Tiano.h"
+
+#define PEM_LINE_SIZE 64
+#define PEM_INPUT_LINE_SIZE 48
+#define PEM_UNITS_PER_LINE (PEM_INPUT_LINE_SIZE / 3)
+#define PEM_DECODED_LINE_SIZE 48
+#define PEM_INVALID_CHAR 255
+#define PEM_PAD_CHAR 64
+
+/**
+ Convert Hex values into Base32 values
+
+ @param[in] encodedStr Array of encoded BASE values.
+ @param[in] encodedLen Length of encoded values.
+ @param[out] rawData Array of Hex strings that needs to be encoded into BASE32.
+ @param[out] rawDataLen Length of Hex values.
+
+ @retval EFI_BUFFER_TOO_SMALL Buffer to store encoded string too small.
+ @retval EFI_SUCCESS Initialization complete.
+**/
+EFI_STATUS
+Base32Encode (
+ IN UINT8 *encodedStr,
+ IN UINTN *encodedLen,
+ OUT UINT8 *rawData,
+ OUT UINTN rawDataLen
+ )
+;
+
+/**
+ Convert Base32 values into Hex values.
+
+ @param[in] encodedStr Array of Decimal numbers.
+ @param[out] decodedData Converted Hex values.
+
+ @retval Length of the Hex Strings that expected.
+**/
+INTN
+Base32Decode (
+ IN UINT8 *encodedStr,
+ IN UINT8 *decodedData
+ )
+;
+
+/**
+ Decimal large (BASE10) into hex value.
+
+ @param[in][out] decStr Array of Decimal numbers.
+ @param[out] u8Hex Converted Hex values.
+ @param[in] hexIndex Length of the Hex Strings that expected
+
+ @retval None
+**/
+VOID
+DecimalToHexString (
+ IN OUT CHAR8 *decStr,
+ OUT UINT8 *u8Hex,
+ IN UINTN hexIndex
+ )
+;
+
+/**
+ Convert the CHAR8 ASCII into CHAR16 Unicode strings.
+
+ @param[in] AsciiString Ascii String.
+ @param[out] UnicodeString Buffer for converted Unicode string.
+
+ @retval None
+**/
+VOID
+Uint8ToUnicode (
+ IN CHAR8 *AsciiString,
+ OUT CHAR16 *UnicodeString
+)
+;
+
+/**
+ This routine displays the debug message in ASCII
+
+ @param[in] Message Message to be displayed
+ @param[in] Length Length of the message
+
+ @retval None
+**/
+VOID
+ShowBuffer (
+ IN UINT8 *Message,
+ IN UINT32 Length
+ )
+;
+
+#endif // _ATAM_HELPER_H_
diff --git a/ReferenceCode/ME/Library/AtLibrary/Dxe/AtDxeLib.cif b/ReferenceCode/ME/Library/AtLibrary/Dxe/AtDxeLib.cif
new file mode 100644
index 0000000..f7268fd
--- /dev/null
+++ b/ReferenceCode/ME/Library/AtLibrary/Dxe/AtDxeLib.cif
@@ -0,0 +1,14 @@
+<component>
+ name = "AtDxeLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\Library\AtLibrary\Dxe\"
+ RefName = "AtDxeLib"
+[files]
+"AtDxeLib.mak"
+"AtDxeLib.sdl"
+"AtAmHelper.c"
+"AtDxeLib.inf"
+"AtPolicyDebugDumpDxe.c"
+"AtAmHelper.h"
+"AtPolicyLib.h"
+<endComponent>
diff --git a/ReferenceCode/ME/Library/AtLibrary/Dxe/AtDxeLib.inf b/ReferenceCode/ME/Library/AtLibrary/Dxe/AtDxeLib.inf
new file mode 100644
index 0000000..e99a072
--- /dev/null
+++ b/ReferenceCode/ME/Library/AtLibrary/Dxe/AtDxeLib.inf
@@ -0,0 +1,69 @@
+## @file
+# Component description file for AT functionality
+#
+#@copyright
+# Copyright (c) 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = AtDxeLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ AtAmHelper.c
+ AtAmHelper.h
+ AtPolicyLib.h
+ AtPolicyDebugDumpDxe.c
+
+[includes.common]
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)
+
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/SampleCode
+
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[libraries.common]
+ MeLib
+ MeProtocolLib
+ EdkIIGlueBaseMemoryLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueBasePciLibPciExpress
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueDxeReportStatusCodeLib
+
+[nmake.common]
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__
diff --git a/ReferenceCode/ME/Library/AtLibrary/Dxe/AtDxeLib.mak b/ReferenceCode/ME/Library/AtLibrary/Dxe/AtDxeLib.mak
new file mode 100644
index 0000000..67282e9
--- /dev/null
+++ b/ReferenceCode/ME/Library/AtLibrary/Dxe/AtDxeLib.mak
@@ -0,0 +1,54 @@
+# /*++
+# Copyright (c) 2009 Intel Corporation. All rights reserved.
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+# --*/
+# MAK file for the ModulePart:AtDxeLib
+all : AtDxeLib
+
+$(BUILD_DIR)\AtDxeLib.lib : AtDxeLib
+
+AtDxeLib : $(BUILD_DIR)\AtDxeLib.mak AtDxeLibBin
+
+$(BUILD_DIR)\AtDxeLib.mak : $(AtDxeLib_DIR)\$(@B).cif $(AtDxeLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(AtDxeLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+AtDxeLib_INCLUDES=\
+ $(EDK_INCLUDES) \
+ $(EdkIIGlueLib_INCLUDES) \
+ $(ME_INCLUDES)\
+
+AtDxeLib_DEFINES=\
+ $(MY_DEFINES)\
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__\
+ /D __EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__\
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__\
+
+AtDxeLib_LIBS=\
+ $(MeProtocolLib_LIB)\
+ $(MeLibDxe_LIB)
+
+AtDxeLibBin : $(AtDxeLib_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS) \
+ /f $(BUILD_DIR)\AtDxeLib.mak all \
+ "MY_INCLUDES=$(AtDxeLib_INCLUDES)" \
+ "MY_DEFINES=$(AtDxeLib_DEFINES)"\
+ TYPE=LIBRARY \
+#**********************************************************************
+#**********************************************************************
+#** **
+#** (C)Copyright 1985-2006, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 6145-F Northbelt Pkwy, Norcross, GA 30071 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#**********************************************************************
+#**********************************************************************
diff --git a/ReferenceCode/ME/Library/AtLibrary/Dxe/AtDxeLib.sdl b/ReferenceCode/ME/Library/AtLibrary/Dxe/AtDxeLib.sdl
new file mode 100644
index 0000000..746b618
--- /dev/null
+++ b/ReferenceCode/ME/Library/AtLibrary/Dxe/AtDxeLib.sdl
@@ -0,0 +1,36 @@
+TOKEN
+ Name = "AtDxeLib_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable AtDxeLib support in Project"
+End
+
+MODULE
+ Help = "Includes AtDxeLib.mak to Project"
+ File = "AtDxeLib.mak"
+End
+
+PATH
+ Name = "AtDxeLib_DIR"
+ Help = "iAMT Library file source directory"
+End
+
+ELINK
+ Name = "AtDxeLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\AtDxeLib.lib"
+ Parent = "AtDxeLib_LIB"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(AtDxeLib_DIR)"
+ Parent = "AT_INCLUDES"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/ME/Library/AtLibrary/Dxe/AtPolicyDebugDumpDxe.c b/ReferenceCode/ME/Library/AtLibrary/Dxe/AtPolicyDebugDumpDxe.c
new file mode 100644
index 0000000..699ed1b
--- /dev/null
+++ b/ReferenceCode/ME/Library/AtLibrary/Dxe/AtPolicyDebugDumpDxe.c
@@ -0,0 +1,51 @@
+/** @file
+ Dump whole DXE_AT_POLICY_PROTOCOL and serial out.
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "AtPolicyLib.h"
+#endif
+
+extern DXE_AT_POLICY_PROTOCOL *mDxePlatformAtPolicy;
+
+/**
+ Dump DXE AT Platform Policy
+
+ @param[in] None.
+
+ @retval None
+**/
+VOID
+DxeAtPolicyDebugDump (
+ VOID
+ )
+{
+ if (mDxePlatformAtPolicy == NULL) {
+ return;
+ }
+ DEBUG ((EFI_D_INFO, "\n------------------------ AtPlatformPolicy Dump Begin ------------------\n"));
+ DEBUG ((EFI_D_INFO, " Revision : 0x%x\n", mDxePlatformAtPolicy->Revision));
+ DEBUG ((EFI_D_INFO, "At ---\n"));
+ DEBUG ((EFI_D_INFO, " AtConfig : 0x%x\n", mDxePlatformAtPolicy->At.AtAmBypass));
+ DEBUG ((EFI_D_INFO, " AtEnterSuspendState : 0x%x\n", mDxePlatformAtPolicy->At.AtEnterSuspendState));
+ DEBUG ((EFI_D_INFO, "\n------------------------ AtPlatformPolicy Dump End --------------------\n"));
+}
+
diff --git a/ReferenceCode/ME/Library/AtLibrary/Dxe/AtPolicyLib.h b/ReferenceCode/ME/Library/AtLibrary/Dxe/AtPolicyLib.h
new file mode 100644
index 0000000..edde46a
--- /dev/null
+++ b/ReferenceCode/ME/Library/AtLibrary/Dxe/AtPolicyLib.h
@@ -0,0 +1,39 @@
+/** @file
+ Header file for AT Policy functionality
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _AT_POLICY_LIB_H_
+#define _AT_POLICY_LIB_H_
+
+#include EFI_PROTOCOL_DEFINITION (AtPlatformPolicy)
+
+/**
+ Dump DXE AT Platform Policy
+
+ @param[in] None.
+
+ @retval None
+**/
+VOID
+DxeAtPolicyDebugDump (
+ VOID
+ )
+;
+
+#endif
diff --git a/ReferenceCode/ME/Library/MeKernel/Common/MeChipsetLib/MeChipsetLib.c b/ReferenceCode/ME/Library/MeKernel/Common/MeChipsetLib/MeChipsetLib.c
new file mode 100644
index 0000000..aac3afb
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeKernel/Common/MeChipsetLib/MeChipsetLib.c
@@ -0,0 +1,112 @@
+/** @file
+ Me Chipset Lib implementation.
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueBase.h"
+#include "MeAccess.h"
+#include "PchPlatformLib.h"
+#endif
+
+/**
+ Enable/Disable Me devices
+
+ @param[in] WhichDevice Select of Me device
+ @param[in] DeviceFuncCtrl Function control
+
+ @retval None
+**/
+VOID
+MeDeviceControl (
+ IN ME_DEVICE WhichDevice,
+ IN ME_DEVICE_FUNC_CTRL DeviceFuncCtrl
+ )
+{
+ switch (WhichDevice) {
+ case HECI1:
+ case HECI2:
+ case IDER:
+ case SOL:
+ if (DeviceFuncCtrl) {
+ Mmio16And (PCH_RCRB_BASE, R_PCH_RCRB_FD2, ~(BIT0 << WhichDevice));
+ } else {
+ Mmio16Or (PCH_RCRB_BASE, R_PCH_RCRB_FD2, BIT0 << WhichDevice);
+ }
+ Mmio16 (PCH_RCRB_BASE, R_PCH_RCRB_FD2);
+ break;
+
+ case USBR1:
+ if (DeviceFuncCtrl) {
+ MmioOr16 (
+ MmPciAddress (0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_USB,
+ PCI_FUNCTION_NUMBER_PCH_EHCI,
+ 0x7A),
+ (UINT16) (0x100)
+ );
+ } else {
+ MmioAnd16 (
+ MmPciAddress (0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_USB,
+ PCI_FUNCTION_NUMBER_PCH_EHCI,
+ 0x7A),
+ (UINT16) (~0x100)
+ );
+ }
+ break;
+
+ case USBR2:
+ if (GetPchSeries() == PchH) {
+ if (DeviceFuncCtrl) {
+ MmioOr16 (
+ MmPciAddress (0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_USB_EXT,
+ PCI_FUNCTION_NUMBER_PCH_EHCI2,
+ 0x7A),
+ (UINT16) (0x100)
+ );
+ } else {
+ MmioAnd16 (
+ MmPciAddress (0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_USB_EXT,
+ PCI_FUNCTION_NUMBER_PCH_EHCI2,
+ 0x7A),
+ (UINT16) (~0x100)
+ );
+ }
+ }
+ break;
+
+ ///
+ /// Function Disable SUS well lockdown
+ ///
+ case FDSWL:
+ if (DeviceFuncCtrl) {
+ Mmio16Or (PCH_RCRB_BASE, R_PCH_RCRB_FDSW, (UINT16) B_PCH_RCRB_FDSW_FDSWL);
+ } else {
+ Mmio16And (PCH_RCRB_BASE, R_PCH_RCRB_FDSW, (UINT16)~(B_PCH_RCRB_FDSW_FDSWL));
+ }
+ Mmio16 (PCH_RCRB_BASE, R_PCH_RCRB_FDSW);
+ break;
+ }
+} \ No newline at end of file
diff --git a/ReferenceCode/ME/Library/MeKernel/Common/MeChipsetLib/MeChipsetLib.cif b/ReferenceCode/ME/Library/MeKernel/Common/MeChipsetLib/MeChipsetLib.cif
new file mode 100644
index 0000000..d4962a1
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeKernel/Common/MeChipsetLib/MeChipsetLib.cif
@@ -0,0 +1,11 @@
+<component>
+ name = "MeChipsetLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\Library\MeKernel\Common\MeChipsetLib\"
+ RefName = "MeChipsetLib"
+[files]
+"MeChipsetLib.mak"
+"MeChipsetLib.sdl"
+"MeChipsetLib.c"
+"MeChipsetLib.inf"
+<endComponent>
diff --git a/ReferenceCode/ME/Library/MeKernel/Common/MeChipsetLib/MeChipsetLib.inf b/ReferenceCode/ME/Library/MeKernel/Common/MeChipsetLib/MeChipsetLib.inf
new file mode 100644
index 0000000..aa44c98
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeKernel/Common/MeChipsetLib/MeChipsetLib.inf
@@ -0,0 +1,61 @@
+## @file
+# Component description file for PEI/DXE ME Chipset Lib
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = MeChipsetLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ MeChipsetLib.c
+
+[sources.ia32]
+
+[sources.x64]
+
+[sources.ipf]
+
+[includes.common]
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[libraries.common]
+ MeProtocolLib
+ PchPlatformLib
+
+[nmake.common]
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__
diff --git a/ReferenceCode/ME/Library/MeKernel/Common/MeChipsetLib/MeChipsetLib.mak b/ReferenceCode/ME/Library/MeKernel/Common/MeChipsetLib/MeChipsetLib.mak
new file mode 100644
index 0000000..91ac39a
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeKernel/Common/MeChipsetLib/MeChipsetLib.mak
@@ -0,0 +1,53 @@
+# MAK file for the ModulePart:MeChipsetLib
+EDK : MeChipsetLib
+
+MeChipsetLib : MeChipsetSmmLib MeChipsetDxeLib MeChipsetPeiLib
+
+$(MeChipsetSmmLib_LIB) : MeChipsetSmmLib
+$(MeChipsetDxeLib_LIB) : MeChipsetDxeLib
+$(MeChipsetPeiLib_LIB) : MeChipsetPeiLib
+
+MeChipsetSmmLib : $(BUILD_DIR)\MeChipsetLib.mak MeChipsetLibSmmBin
+
+MeChipsetDxeLib : $(BUILD_DIR)\MeChipsetLib.mak MeChipsetLibDxeBin
+
+MeChipsetPeiLib : $(BUILD_DIR)\MeChipsetLib.mak MeChipsetLibPeiBin
+
+$(BUILD_DIR)\MeChipsetLib.mak : $(MeChipsetLib_DIR)\$(@B).cif $(MeChipsetLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(MeChipsetLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+MeChipsetLib_INCLUDES =\
+ $(EDK_INCLUDES) \
+ $(EdkIIGlueLib_INCLUDES) \
+ $(ME_INCLUDES) \
+ $(INTEL_PCH_INCLUDES)
+
+MeChipsetLibSmmBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\MeChipsetLib.mak all\
+ "MY_INCLUDES=$(MeChipsetLib_INCLUDES)" \
+ TYPE=LIBRARY \
+ LIBRARIES=\
+ LIBRARY_NAME=$(MeChipsetSmmLib_LIB)
+
+MeChipsetLibDxeBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\MeChipsetLib.mak all\
+ "MY_INCLUDES=$(MeChipsetLib_INCLUDES)" \
+ "CFLAGS=$(CFLAGS) $(MeChipsetLib_DEFINES)"\
+ TYPE=LIBRARY \
+ LIBRARIES=\
+ LIBRARY_NAME=$(MeChipsetDxeLib_LIB)
+
+MeChipsetLibPeiBin :
+!IF "$(x64_BUILD)"=="1"
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS) BUILD_DIR=$(BUILD_DIR)\IA32\
+!ELSE
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+!ENDIF
+ /f $(BUILD_DIR)\MeChipsetLib.mak all\
+ "MY_INCLUDES=$(MeChipsetLib_INCLUDES)"\
+ "CFLAGS=$(CFLAGS) $(MeChipsetLib_DEFINES)"\
+ TYPE=PEI_LIBRARY \
+ LIBRARIES=\
+ LIBRARY_NAME=$(MeChipsetPeiLib_LIB)
diff --git a/ReferenceCode/ME/Library/MeKernel/Common/MeChipsetLib/MeChipsetLib.sdl b/ReferenceCode/ME/Library/MeKernel/Common/MeChipsetLib/MeChipsetLib.sdl
new file mode 100644
index 0000000..a668016
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeKernel/Common/MeChipsetLib/MeChipsetLib.sdl
@@ -0,0 +1,70 @@
+TOKEN
+ Name = "MeChipsetLib_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable MeChipsetLib support in Project"
+End
+
+MODULE
+ Help = "Includes MeChipsetLib.mak to Project"
+ File = "MeChipsetLib.mak"
+End
+
+PATH
+ Name = "MeChipsetLib_DIR"
+ Help = "Me Chipset Library file source directory"
+End
+
+ELINK
+ Name = "MeChipsetPeiLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\MeChipsetPeiLib.lib"
+ Parent = "MeChipsetPeiLib_LIB"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(MeChipsetLib_DIR)"
+ Parent = "ME_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "MeChipsetDxeLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\MeChipsetDxeLib.lib"
+ Parent = "MeChipsetDxeLib_LIB"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(MeChipsetLib_DIR)"
+ Parent = "ME_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "MeChipsetSmmLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\MeChipsetSmmLib.lib"
+ Parent = "MeChipsetSmmLib_LIB"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(MeChipsetLib_DIR)"
+ Parent = "ME_INCLUDES"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/ME/Library/MeKernel/Dxe/HeciMsgLib.c b/ReferenceCode/ME/Library/MeKernel/Dxe/HeciMsgLib.c
new file mode 100644
index 0000000..fd83e9b
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeKernel/Dxe/HeciMsgLib.c
@@ -0,0 +1,2702 @@
+/** @file
+ Implementation file for Heci Message functionality
+
+@copyright
+ Copyright (c) 2006 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "HeciMsgLib.h"
+#include "MeAccess.h"
+#include "HeciRegs.h"
+#include "CoreBiosMsg.h"
+#include EFI_PROTOCOL_CONSUMER (Wdt)
+#include EFI_PROTOCOL_CONSUMER (PchReset)
+#endif
+
+BOOLEAN
+IsAfterEndOfPost (
+ VOID
+ );
+
+//
+// Internal function for HeciMsgLib used only
+//
+
+/**
+ Convert EFI Status Code severity to Mdes severity.
+
+ @param[in] statusToConv EFI Status Code severity.
+
+ @retval UINT16 Mdes severity.
+**/
+STATIC
+UINT16
+BiosToMdesSeverity (
+ IN EFI_STATUS statusToConv
+ )
+{
+ UINT16 MdesSev;
+
+ MdesSev = SEV_NO_ERROR;
+ switch (statusToConv & EFI_STATUS_CODE_SEVERITY_MASK) {
+ case (EFI_ERROR_MINOR):
+ MdesSev = SEV_LOW_ERROR;
+ break;
+
+ case (EFI_ERROR_MAJOR):
+ MdesSev = SEV_HIGH_ERROR;
+ break;
+
+ case (EFI_ERROR_UNRECOVERED):
+ MdesSev = SEV_CRITICAL_ERROR;
+ break;
+
+ case (EFI_ERROR_UNCONTAINED):
+ MdesSev = SEV_CRITICAL_ERROR;
+ break;
+ }
+
+ return MdesSev;
+}
+
+//
+// Interface functions of HeciMsgLib
+//
+
+/**
+ Send the required system ChipsetInit Table to ME FW.
+
+ @param[in] ChipsetInitTable The required system ChipsetInit Table.
+ @param[in] ChipsetInitTableLen Length of the table in bytes
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+**/
+EFI_STATUS
+HeciChipsetInitSyncMsg (
+ IN UINT8 *ChipsetInitTable,
+ IN UINT32 ChipsetInitTableLen
+ )
+{
+ EFI_HECI_PROTOCOL *Heci;
+ EFI_STATUS Status;
+ UINT32 ReqSize;
+ PCH_RESET_PROTOCOL *PchResetProtocol;
+ EFI_GUID PchResetProtocolGuid = PCH_RESET_PROTOCOL_GUID;
+ MPHY_WRITE_SETTINGS_REQ *MPhyWriteSettingsReqPtr;
+
+ DEBUG ((EFI_D_ERROR, "HeciChipsetInitSyncMsg(0x%08X, %d): Start\n", ChipsetInitTable, ChipsetInitTableLen));
+ PERF_START_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x8130);
+ ASSERT(ChipsetInitTableLen <= 1024); // ChipsetInit table should not get too large
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "EfiHeciProtocol not found.\n"));
+ return Status;
+ }
+
+ Status = gBS->LocateProtocol (
+ &PchResetProtocolGuid,
+ NULL,
+ (VOID **) &PchResetProtocol);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "PchResetProtocol not found.\n"));
+ return Status;
+ }
+
+ //
+ // Allocate a buffer for the Request Structure and the ChipsetInit Table
+ //
+ ReqSize = sizeof (MPHY_WRITE_SETTINGS_REQ) + ChipsetInitTableLen;
+ MPhyWriteSettingsReqPtr = AllocateZeroPool (ReqSize);
+ if (MPhyWriteSettingsReqPtr == NULL) {
+ DEBUG ((EFI_D_ERROR, "(MPHY) HeciChipsetInitSyncMsg: Could not allocate Memory\n"));
+ return EFI_ABORTED;
+ }
+
+ //
+ // Setup the HECI message for a MPHY Write
+ //
+ MPhyWriteSettingsReqPtr->Header.ApiVersion = LYNX_POINT_PLATFORM;
+ MPhyWriteSettingsReqPtr->Header.IccCommand = WRITE_MPHY_SETTINGS;
+ MPhyWriteSettingsReqPtr->Header.BufferLength = ReqSize - sizeof (ICC_HEADER);
+ MPhyWriteSettingsReqPtr->PostedWrite = FALSE;
+ CopyMem (MPhyWriteSettingsReqPtr+1, ChipsetInitTable, ChipsetInitTableLen);
+
+ DEBUG ((EFI_D_ERROR, "(MPHY) mPhyChipsetInitTable[] = \n"));
+ DEBUG ((EFI_D_ERROR, " Ver=%d CRC=0x%04X NumEntries=%d\n",
+ *((UINT16*)&ChipsetInitTable[2]), *((UINT16*)&ChipsetInitTable[0]), ChipsetInitTable[4]));
+ #ifdef EFI_DEBUG
+ {
+ int ii;
+ UINT8* entry_ptr = &ChipsetInitTable[5];
+ for (ii = 0; ii < ChipsetInitTable[4]; ii++) {
+ DEBUG ((EFI_D_ERROR, " %d: EP=0x%02X OFFSET=0x%04X VALUE=0x%08X\n",
+ ii, entry_ptr[6],*((UINT16*)&entry_ptr[0]),*((UINT32*)&entry_ptr[2])));
+ entry_ptr += 7;
+ }
+ }
+ #endif
+
+ //
+ // Send ChipsetInit Table to ME
+ //
+ Status = Heci->SendwACK (
+ (UINT32 *)MPhyWriteSettingsReqPtr,
+ ReqSize,
+ &ReqSize,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_ICC_MESSAGE_ADDR
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_INFO, "(MPHY) Write MPHY Settings Message failed! EFI_STATUS = %r\n", Status));
+ }
+ else if (MPhyWriteSettingsReqPtr->Header.IccResponse != ICC_STATUS_SUCCESS) {
+ DEBUG ((EFI_D_ERROR,"(MPHY) Write MPHY Settings failed!: FW Response=0x%x\n",MPhyWriteSettingsReqPtr->Header.IccResponse));
+ Status = EFI_DEVICE_ERROR;
+ }
+
+ FreePool (MPhyWriteSettingsReqPtr);
+ if (EFI_ERROR (Status)) {
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x8140);
+ return Status;
+ }
+
+ if (PchResetProtocol != NULL) {
+ DEBUG ((EFI_D_ERROR, "HeciChipsetInitSyncMsg(): Reset required for ChipsetInit Settings synch\n"));
+ PchResetProtocol->Reset (PchResetProtocol, ColdReset);
+ }
+
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x8140);
+ DEBUG ((EFI_D_ERROR, "HeciChipsetInitSyncMsg(): End\n"));
+ return Status;
+}
+
+//
+// Interface functions of HeciMsgLib
+//
+
+/**
+ Send Core BIOS Reset Request Message through HECI to reset the system.
+
+ @param[in] ResetOrigin Reset source
+ @param[in] ResetType Global or Host reset
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+**/
+EFI_STATUS
+HeciSendCbmResetRequest (
+ IN UINT8 ResetOrigin,
+ IN UINT8 ResetType
+ )
+{
+ EFI_HECI_PROTOCOL *Heci;
+ EFI_STATUS Status;
+ UINT32 HeciLength;
+ CBM_RESET_REQ CbmResetRequest;
+ PLATFORM_ME_HOOK_PROTOCOL *PlatformMeHook;
+ EFI_GUID WdtProtocolGuid = WDT_PROTOCOL_GUID;
+ WDT_PROTOCOL *WdtProtocol;
+ UINT32 MeMode;
+
+ if (IsAfterEndOfPost ()) {
+ return EFI_UNSUPPORTED;
+ }
+
+ Status = gBS->LocateProtocol (
+ &gPlatformMeHookProtocolGuid,
+ NULL,
+ (VOID **) &PlatformMeHook
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "Unable to Locate PlatformMeHook Protocol for Global Reset Hook, so skip instead.- %r\n", Status));
+ } else {
+ PlatformMeHook->PreGlobalReset ();
+ }
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = Heci->GetMeMode (&MeMode);
+ if (EFI_ERROR (Status) || (MeMode != ME_MODE_NORMAL)) {
+ return EFI_UNSUPPORTED;
+ }
+
+ CbmResetRequest.MKHIHeader.Data = 0;
+ CbmResetRequest.MKHIHeader.Fields.Command = CBM_RESET_REQ_CMD;
+ CbmResetRequest.MKHIHeader.Fields.IsResponse = 0;
+ CbmResetRequest.MKHIHeader.Fields.GroupId = MKHI_CBM_GROUP_ID;
+ CbmResetRequest.MKHIHeader.Fields.Reserved = 0;
+ CbmResetRequest.MKHIHeader.Fields.Result = 0;
+ CbmResetRequest.Data.RequestOrigin = ResetOrigin;
+ CbmResetRequest.Data.ResetType = ResetType;
+
+ HeciLength = sizeof (CBM_RESET_REQ);
+
+ Status = gBS->LocateProtocol (&WdtProtocolGuid, NULL, (VOID **) &WdtProtocol);
+ ASSERT_EFI_ERROR (Status);
+ WdtProtocol->AllowKnownReset ();
+
+ Status = Heci->SendMsg (
+ (UINT32 *) &CbmResetRequest,
+ HeciLength,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_CORE_MESSAGE_ADDR
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "Unable to Send Reset Request - %r\n", Status));
+ }
+
+ return Status;
+}
+
+/**
+ Send Hardware Asset Tables to Firmware
+
+ @param[in] Handle A handle for this module
+ @param[in] AssetTableData Hardware Asset Table Data
+ @param[in] TableDataSize Size of Asset table
+
+ @retval EFI_SUCCESS Table sent
+ @retval EFI_ABORTED Could not allocate Memory
+**/
+EFI_STATUS
+HeciAssetUpdateFwMsg (
+ IN EFI_HANDLE Handle,
+ IN TABLE_PUSH_DATA *AssetTableData,
+ IN UINT16 TableDataSize
+ )
+{
+ AU_TABLE_PUSH_MSG *SendAssetTableDataMsg;
+ EFI_STATUS Status;
+ EFI_HECI_PROTOCOL *Heci;
+
+ Status = EFI_SUCCESS;
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ ///
+ /// Subtract off single byte from TABLE_PUSH_DATA.TableData[1]
+ ///
+ SendAssetTableDataMsg = AllocateZeroPool (sizeof (AU_TABLE_PUSH_MSG) + MAX_ASSET_TABLE_ALLOCATED_SIZE - 1);
+ if (SendAssetTableDataMsg == NULL) {
+ DEBUG ((EFI_D_ERROR, "AssetUpdateFwMsg Error: Could not allocate Memory\n"));
+ return EFI_ABORTED;
+ }
+
+ if (TableDataSize > MAX_ASSET_TABLE_ALLOCATED_SIZE) {
+ TableDataSize = MAX_ASSET_TABLE_ALLOCATED_SIZE;
+ }
+
+ SendAssetTableDataMsg->Header.Data = 0;
+ ///
+ /// Subtract off single byte from TABLE_PUSH_DATA.TableData[1]
+ ///
+ SendAssetTableDataMsg->Header.Fields.MessageLength = TableDataSize + sizeof (TABLE_PUSH_DATA) - 1;
+ SendAssetTableDataMsg->Header.Fields.Command = HWA_TABLE_PUSH_CMD;
+ SendAssetTableDataMsg->Header.Fields.FRUTablePresent = 1;
+ SendAssetTableDataMsg->Header.Fields.SMBIOSTablePresent = 1;
+ SendAssetTableDataMsg->Header.Fields.ASFTablePresent = 1;
+ if (AssetTableData->Tables[HWAI_TABLE_TYPE_INDEX_MEDIA_DEVICE].Length == 0) {
+ SendAssetTableDataMsg->Header.Fields.MediaTablePresent = 0;
+ } else {
+ SendAssetTableDataMsg->Header.Fields.MediaTablePresent = 1;
+ }
+
+ CopyMem (&SendAssetTableDataMsg->Data, AssetTableData, SendAssetTableDataMsg->Header.Fields.MessageLength);
+
+ PERF_START_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x8020);
+ Status = Heci->SendMsg (
+ (UINT32 *) SendAssetTableDataMsg,
+ SendAssetTableDataMsg->Header.Fields.MessageLength,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_HWA_CLIENT_ID
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "AssetUpdateFwMsg: Failed to Send SendAssetTableDataMsg\n"));
+
+ }
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x8021);
+
+ FreePool (SendAssetTableDataMsg);
+
+ return Status;
+
+}
+
+/**
+ Send End of Post Request Message through HECI.
+
+ @param[in] Handle A handle for this module
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+**/
+EFI_STATUS
+HeciSendEndOfPostMessage (
+ IN EFI_HANDLE Handle
+ )
+{
+ EFI_STATUS Status;
+ UINT32 HeciSendLength;
+ UINT32 HeciRecvLength;
+ GEN_END_OF_POST_ACK CbmEndOfPost;
+ UINT32 MeMode;
+ EFI_HECI_PROTOCOL *Heci;
+ PCH_RESET_PROTOCOL *PchResetProtocol;
+ EFI_GUID PchResetProtocolGuid = PCH_RESET_PROTOCOL_GUID;
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = gBS->LocateProtocol (&PchResetProtocolGuid, NULL, (VOID **) &PchResetProtocol);
+
+ if (EFI_ERROR (Status)) {
+ PchResetProtocol = NULL;
+ }
+
+ Status = Heci->GetMeMode (&MeMode);
+ if (EFI_ERROR (Status) || (MeMode != ME_MODE_NORMAL)) {
+ return EFI_UNSUPPORTED;
+ }
+
+ CbmEndOfPost.Header.Data = 0;
+ CbmEndOfPost.Header.Fields.Command = CBM_END_OF_POST_CMD;
+ CbmEndOfPost.Header.Fields.IsResponse = 0;
+ CbmEndOfPost.Header.Fields.GroupId = MKHI_GEN_GROUP_ID;
+ CbmEndOfPost.Data.RequestedActions = 0;
+
+ HeciSendLength = sizeof (MKHI_MESSAGE_HEADER);
+ HeciRecvLength = sizeof (GEN_END_OF_POST_ACK);
+
+ PERF_START_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x8030);
+ Status = Heci->SendMsg (
+ (UINT32 *) &CbmEndOfPost,
+ HeciSendLength,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_CORE_MESSAGE_ADDR
+ );
+
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ Status = Heci->ReadMsg (
+ BLOCKING,
+ (UINT32 *) &CbmEndOfPost,
+ &HeciRecvLength
+ );
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x8031);
+
+ if (CbmEndOfPost.Data.RequestedActions == HECI_EOP_PERFORM_GLOBAL_RESET) {
+ if (PchResetProtocol != NULL) {
+ DEBUG ((EFI_D_ERROR, "HeciSendEndOfPostMessage(): Reset requested by FW EOP ACK %r\n"));
+ PchResetProtocol->Reset (PchResetProtocol, GlobalReset);
+ }
+ }
+
+ return Status;
+}
+
+/**
+ Send Get Firmware SKU Request to ME
+
+ @param[in] MsgGenGetFwCapsSku Return message for Get Firmware Capability SKU
+ @param[in] MsgGenGetFwCapsSkuAck Return message for Get Firmware Capability SKU ACK
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+ @retval EFI_BUFFER_TOO_SMALL Message Buffer is too smallfor the Acknowledge
+**/
+EFI_STATUS
+HeciGetFwCapsSkuMsg (
+ IN OUT GEN_GET_FW_CAPSKU *MsgGenGetFwCapsSku,
+ IN OUT GEN_GET_FW_CAPS_SKU_ACK *MsgGenGetFwCapsSkuAck
+ )
+{
+ EFI_STATUS Status;
+ UINT32 Length;
+ EFI_HECI_PROTOCOL *Heci;
+ UINT32 MeMode;
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = Heci->GetMeMode (&MeMode);
+ if (EFI_ERROR (Status) || (MeMode != ME_MODE_NORMAL)) {
+ return EFI_UNSUPPORTED;
+ }
+
+ MsgGenGetFwCapsSku->MKHIHeader.Data = 0;
+ MsgGenGetFwCapsSku->MKHIHeader.Fields.GroupId = MKHI_FWCAPS_GROUP_ID;
+ MsgGenGetFwCapsSku->MKHIHeader.Fields.Command = FWCAPS_GET_RULE_CMD;
+ MsgGenGetFwCapsSku->MKHIHeader.Fields.IsResponse = 0;
+ MsgGenGetFwCapsSku->Data.RuleId = 0;
+ Length = sizeof (GEN_GET_FW_CAPSKU);
+
+ ///
+ /// Send Get FW SKU Request to ME
+ ///
+ PERF_START_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x8040);
+ Status = Heci->SendMsg (
+ (UINT32 *) MsgGenGetFwCapsSku,
+ Length,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_CORE_MESSAGE_ADDR
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Length = sizeof (GEN_GET_FW_CAPS_SKU_ACK);
+ Status = Heci->ReadMsg (
+ BLOCKING,
+ (UINT32 *) MsgGenGetFwCapsSkuAck,
+ &Length
+ );
+ if (EFI_ERROR (Status)) {
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x8042);
+ return Status;
+ }
+
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x8041);
+ return Status;
+}
+
+/**
+ Send Get Firmware Version Request to ME
+
+ @param[in][out] MsgGenGetFwVersionAck Return themessage of FW version
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+ @retval EFI_BUFFER_TOO_SMALL Message Buffer is too smallfor the Acknowledge
+**/
+EFI_STATUS
+HeciGetFwVersionMsg (
+ IN OUT GEN_GET_FW_VER_ACK *MsgGenGetFwVersionAck
+ )
+{
+ EFI_STATUS Status;
+ UINT32 Length;
+ GEN_GET_FW_VER *MsgGenGetFwVersion;
+ GEN_GET_FW_VER GenGetFwVersion;
+ EFI_HECI_PROTOCOL *Heci;
+ UINT32 MeMode;
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = Heci->GetMeMode (&MeMode);
+ if (EFI_ERROR (Status) || (MeMode != ME_MODE_NORMAL)) {
+ return EFI_UNSUPPORTED;
+ }
+ ///
+ /// Allocate MsgGenGetFwVersion data structure
+ ///
+ MsgGenGetFwVersion = &GenGetFwVersion;
+ MsgGenGetFwVersion->MKHIHeader.Data = 0;
+ MsgGenGetFwVersion->MKHIHeader.Fields.GroupId = MKHI_GEN_GROUP_ID;
+ MsgGenGetFwVersion->MKHIHeader.Fields.Command = GEN_GET_FW_VERSION_CMD;
+ MsgGenGetFwVersion->MKHIHeader.Fields.IsResponse = 0;
+ Length = sizeof (GEN_GET_FW_VER);
+ ///
+ /// Send Get Firmware Version Request to ME
+ ///
+ PERF_START_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x8050);
+ Status = Heci->SendMsg (
+ (UINT32 *) MsgGenGetFwVersion,
+ Length,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_CORE_MESSAGE_ADDR
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Length = sizeof (GEN_GET_FW_VER_ACK);
+ Status = Heci->ReadMsg (
+ BLOCKING,
+ (UINT32 *) MsgGenGetFwVersionAck,
+ &Length
+ );
+ if (EFI_ERROR (Status)) {
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x8052);
+ return Status;
+ }
+
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x8051);
+ return Status;
+}
+
+/**
+ Sends a message to ME to unlock a specified SPI Flash region for writing and receiving a response message.
+ It is recommended that HMRFPO_ENABLE MEI message needs to be sent after all OROMs finish their initialization.
+
+ @param[in] Nonce Nonce received in previous HMRFPO_ENABLE Response Message
+ @param[in] Result HMRFPO_ENABLE response
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+**/
+EFI_STATUS
+HeciHmrfpoEnable (
+ IN UINT64 Nonce,
+ OUT UINT8 *Result
+ )
+{
+ EFI_STATUS Status;
+ EFI_HECI_PROTOCOL *Heci;
+ MKHI_HMRFPO_ENABLE HmrfpoEnableRequest;
+ MKHI_HMRFPO_ENABLE_RESPONSE HmrfpoEnableResponse;
+ UINT32 HeciLength;
+ UINT32 MeMode;
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = Heci->GetMeMode (&MeMode);
+ if (EFI_ERROR (Status) || (MeMode != ME_MODE_NORMAL)) {
+ return EFI_UNSUPPORTED;
+ }
+
+ HmrfpoEnableRequest.MkhiHeader.Data = 0;
+ HmrfpoEnableRequest.MkhiHeader.Fields.GroupId = MKHI_SPI_GROUP_ID;
+ HmrfpoEnableRequest.MkhiHeader.Fields.Command = HMRFPO_ENABLE_CMD_ID;
+ HmrfpoEnableRequest.MkhiHeader.Fields.IsResponse = 0;
+ HmrfpoEnableRequest.Nonce = Nonce;
+
+ HeciLength = sizeof (MKHI_HMRFPO_ENABLE);
+
+ PERF_START_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x8070);
+ Status = Heci->SendMsg (
+ (UINT32 *) &HmrfpoEnableRequest,
+ HeciLength,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_CORE_MESSAGE_ADDR
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "Unable to Send HMRFPO_ENABLE_CMD_ID Request - %r\n", Status));
+ return Status;
+ }
+
+ HeciLength = sizeof (MKHI_HMRFPO_ENABLE_RESPONSE);
+ Status = Heci->ReadMsg (
+ BLOCKING,
+ (UINT32 *) &HmrfpoEnableResponse,
+ &HeciLength
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "Unable to Read HMRFPO_ENABLE_CMD_ID Result - %r\n", Status));
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x8072);
+ return Status;
+ }
+
+ *Result = HmrfpoEnableResponse.Status;
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x8071);
+
+ return Status;
+}
+
+/**
+ Sends a message to ME to lock a specified SPI Flash region for writing and receiving a response message.
+
+ @param[out] Nonce Random number generated by Ignition ME FW. When BIOS
+ want to unlock region it should use this value
+ in HMRFPO_ENABLE Request Message
+ @param[out] FactoryDefaultBase The base of the factory default calculated from the start of the ME region.
+ BIOS sets a Protected Range (PR) register "Protected Range Base" field with this value
+ + the base address of the region.
+ @param[out] FactoryDefaultLimit The length of the factory image.
+ BIOS sets a Protected Range (PR) register "Protected Range Limit" field with this value
+ @param[out] Result Status report
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+**/
+EFI_STATUS
+HeciHmrfpoLock (
+ OUT UINT64 *Nonce,
+ OUT UINT32 *FactoryDefaultBase,
+ OUT UINT32 *FactoryDefaultLimit,
+ OUT UINT8 *Result
+ )
+{
+ EFI_STATUS Status;
+ EFI_HECI_PROTOCOL *Heci;
+ MKHI_HMRFPO_LOCK HmrfpoLockRequest;
+ MKHI_HMRFPO_LOCK_RESPONSE HmrfpoLockResponse;
+ UINT32 HeciLength;
+ UINT32 MeMode;
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = Heci->GetMeMode (&MeMode);
+ if (EFI_ERROR (Status) || (MeMode != ME_MODE_NORMAL)) {
+ return EFI_UNSUPPORTED;
+ }
+
+ HmrfpoLockRequest.MkhiHeader.Data = 0;
+ HmrfpoLockRequest.MkhiHeader.Fields.GroupId = MKHI_SPI_GROUP_ID;
+ HmrfpoLockRequest.MkhiHeader.Fields.Command = HMRFPO_LOCK_CMD_ID;
+ HmrfpoLockRequest.MkhiHeader.Fields.IsResponse = 0;
+
+ HeciLength = sizeof (MKHI_HMRFPO_LOCK);
+
+ PERF_START_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x8080);
+ Status = Heci->SendMsg (
+ (UINT32 *) &HmrfpoLockRequest,
+ HeciLength,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_CORE_MESSAGE_ADDR
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "Unable to Send HMRFPO_LOCK_CMD_ID Request - %r\n", Status));
+ return Status;
+ }
+
+ HeciLength = sizeof (MKHI_HMRFPO_LOCK_RESPONSE);
+ Status = Heci->ReadMsg (
+ BLOCKING,
+ (UINT32 *) &HmrfpoLockResponse,
+ &HeciLength
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "Unable to read HMRFPO_LOCK_CMD_ID response - %r.\n", Status));
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x8082);
+ return Status;
+ }
+
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x8081);
+
+ *Nonce = HmrfpoLockResponse.Nonce;
+ *FactoryDefaultBase = HmrfpoLockResponse.FactoryDefaultBase;
+ *FactoryDefaultLimit = HmrfpoLockResponse.FactoryDefaultLimit;
+ *Result = HmrfpoLockResponse.Status;
+
+ return Status;
+}
+
+/**
+ System BIOS sends this message to get status for HMRFPO_LOCK message.
+
+ @param[out] Result HMRFPO_GET_STATUS response
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+**/
+EFI_STATUS
+HeciHmrfpoGetStatus (
+ OUT UINT8 *Result
+ )
+{
+ EFI_STATUS Status;
+ EFI_HECI_PROTOCOL *Heci;
+ MKHI_HMRFPO_GET_STATUS HmrfpoGetStatusRequest;
+ MKHI_HMRFPO_GET_STATUS_RESPONSE HmrfpoGetStatusResponse;
+ UINT32 HeciLength;
+ UINT32 MeMode;
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = Heci->GetMeMode (&MeMode);
+ if (EFI_ERROR (Status) || (MeMode != ME_MODE_NORMAL)) {
+ return EFI_UNSUPPORTED;
+ }
+
+ HmrfpoGetStatusRequest.MkhiHeader.Data = 0;
+ HmrfpoGetStatusRequest.MkhiHeader.Fields.GroupId = MKHI_SPI_GROUP_ID;
+ HmrfpoGetStatusRequest.MkhiHeader.Fields.Command = HMRFPO_GET_STATUS_CMD_ID;
+ HmrfpoGetStatusRequest.MkhiHeader.Fields.IsResponse = 0;
+
+ HeciLength = sizeof (MKHI_HMRFPO_GET_STATUS);
+
+ PERF_START_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x8090);
+ Status = Heci->SendMsg (
+ (UINT32 *) &HmrfpoGetStatusRequest,
+ HeciLength,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_CORE_MESSAGE_ADDR
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "Unable to Send HMRFPO_GET_STATUS_CMD_ID - %r\n", Status));
+ return Status;
+ }
+
+ HeciLength = sizeof (MKHI_HMRFPO_GET_STATUS_RESPONSE);
+ Status = Heci->ReadMsg (
+ BLOCKING,
+ (UINT32 *) &HmrfpoGetStatusResponse,
+ &HeciLength
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "Unable to Read HMRFPO_GET_STATUS_CMD_ID Result - %r\n", Status));
+ }
+
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x8091);
+ *Result = HmrfpoGetStatusResponse.Status;
+
+ return Status;
+}
+
+/**
+ This is used to send KVM request message to Intel ME. When
+ Bootoptions indicate that a KVM session is requested then BIOS
+ will send this message before any graphical display output to
+ ensure that FW is ready for KVM session.
+
+ @param[in] QueryType 0 - Query Request
+ 1 - Cancel Request
+ @param[out] ResponseCode 1h - Continue, KVM session established.
+ 2h - Continue, KVM session cancelled.
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+ @retval EFI_BUFFER_TOO_SMALL Message Buffer is too smallfor the Acknowledge
+**/
+EFI_STATUS
+HeciQueryKvmRequest (
+ IN UINT32 QueryType,
+ OUT UINT32 *ResponseCode
+ )
+{
+ EFI_STATUS Status;
+ EFI_HECI_PROTOCOL *Heci;
+ AMT_QUERY_KVM_REQUEST QueryKvmRequest;
+ AMT_QUERY_KVM_RESPONSE QueryKvmResponse;
+ UINT32 HeciLength;
+ UINT16 TimeOut;
+ UINT32 MeMode;
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = Heci->GetMeMode (&MeMode);
+ if (EFI_ERROR (Status) || (MeMode != ME_MODE_NORMAL)) {
+ return EFI_UNSUPPORTED;
+ }
+
+ QueryKvmRequest.Command = EFI_KVM_MESSAGE_COMMAND;
+ QueryKvmRequest.ByteCount = EFI_KVM_BYTE_COUNT;
+ QueryKvmRequest.SubCommand = EFI_KVM_QUERY_REQUES;
+ QueryKvmRequest.VersionNumber = EFI_KVM_VERSION;
+ QueryKvmRequest.QueryType = QueryType;
+
+ HeciLength = sizeof (AMT_QUERY_KVM_REQUEST);
+
+ PERF_START_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x8060);
+ Status = Heci->SendMsg (
+ (UINT32 *) &QueryKvmRequest,
+ HeciLength,
+ BIOS_ASF_HOST_ADDR,
+ HECI_ASF_MESSAGE_ADDR
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "Query KVM failed %r\n", Status));
+ }
+
+ TimeOut = 0;
+ HeciLength = sizeof (AMT_QUERY_KVM_RESPONSE);
+ Status = Heci->ReadMsg (
+ BLOCKING,
+ (UINT32 *) &QueryKvmResponse,
+ &HeciLength
+ );
+
+ if (QueryType == QUERY_REQUEST) {
+ while (EFI_ERROR (Status)) {
+ gBS->Stall (EFI_KVM_STALL_1_SECOND);
+ TimeOut++;
+
+ if (TimeOut > EFI_KVM_MAX_WAIT_TIME) {
+ break;
+ }
+
+ HeciLength = sizeof (AMT_QUERY_KVM_RESPONSE);
+ Status = Heci->ReadMsg (
+ NON_BLOCKING,
+ (UINT32 *) &QueryKvmResponse,
+ &HeciLength
+ );
+ }
+ }
+
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x8061);
+ *ResponseCode = QueryKvmResponse.ResponseCode;
+
+ return Status;
+}
+
+/**
+ This message is sent by the BIOS or IntelR MEBX prior to the End of Post (EOP) on the boot
+ where host wants to query the local firmware update interface status.
+
+ @param[out] RuleData 1 - local firmware update interface enable
+ 0 - local firmware update interface disable
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+ @retval EFI_BUFFER_TOO_SMALL Message Buffer is too smallfor the Acknowledge
+**/
+EFI_STATUS
+HeciGetLocalFwUpdate (
+ OUT UINT8 *RuleData
+ )
+{
+ EFI_STATUS Status;
+ UINT32 Length;
+ EFI_HECI_PROTOCOL *Heci;
+ GEN_GET_LOCAL_FW_UPDATE MsgGenGetLocalFwUpdate;
+ GEN_GET_LOCAL_FW_UPDATE_ACK MsgGenGetLocalFwUpdatekuAck;
+ UINT32 MeMode;
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = Heci->GetMeMode (&MeMode);
+ if (EFI_ERROR (Status) || (MeMode != ME_MODE_NORMAL)) {
+ return EFI_UNSUPPORTED;
+ }
+
+ MsgGenGetLocalFwUpdate.MKHIHeader.Data = 0;
+ MsgGenGetLocalFwUpdate.MKHIHeader.Fields.GroupId = MKHI_FWCAPS_GROUP_ID;
+ MsgGenGetLocalFwUpdate.MKHIHeader.Fields.Command = FWCAPS_GET_RULE_CMD;
+ MsgGenGetLocalFwUpdate.MKHIHeader.Fields.IsResponse = 0;
+ MsgGenGetLocalFwUpdate.Data.RuleId = 7;
+ Length = sizeof (GEN_GET_LOCAL_FW_UPDATE);
+
+ ///
+ /// Send Get Local FW update Request to ME
+ ///
+ PERF_START_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x80A0);
+ Status = Heci->SendMsg (
+ (UINT32 *) &MsgGenGetLocalFwUpdate,
+ Length,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_CORE_MESSAGE_ADDR
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Length = sizeof (GEN_GET_LOCAL_FW_UPDATE_ACK);
+ Status = Heci->ReadMsg (
+ BLOCKING,
+ (UINT32 *) &MsgGenGetLocalFwUpdatekuAck,
+ &Length
+ );
+ if (EFI_ERROR (Status)) {
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x80A2);
+ return Status;
+ }
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x80A1);
+ *RuleData = MsgGenGetLocalFwUpdatekuAck.Data.RuleData;
+
+ return Status;
+}
+
+/**
+ This message is sent by the BIOS or IntelR MEBX prior to the End of Post (EOP) on the boot
+ where host wants to enable or disable the local firmware update interface.
+ The firmware allows a single update once it receives the enable command
+
+ @param[in] RuleData 1 - local firmware update interface enable
+ 0 - local firmware update interface disable
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+ @retval EFI_BUFFER_TOO_SMALL Message Buffer is too smallfor the Acknowledge
+**/
+EFI_STATUS
+HeciSetLocalFwUpdate (
+ IN UINT8 RuleData
+ )
+{
+ EFI_STATUS Status;
+ UINT32 Length;
+ EFI_HECI_PROTOCOL *Heci;
+ GEN_SET_LOCAL_FW_UPDATE MsgGenSetLocalFwUpdate;
+ GEN_SET_LOCAL_FW_UPDATE_ACK MsgGenSetLocalFwUpdateAck;
+ UINT32 MeMode;
+
+ if (IsAfterEndOfPost ()) {
+ return EFI_UNSUPPORTED;
+ }
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = Heci->GetMeMode (&MeMode);
+ if (EFI_ERROR (Status) || (MeMode != ME_MODE_NORMAL)) {
+ return EFI_UNSUPPORTED;
+ }
+
+ MsgGenSetLocalFwUpdate.MKHIHeader.Data = 0;
+ MsgGenSetLocalFwUpdate.MKHIHeader.Fields.GroupId = MKHI_FWCAPS_GROUP_ID;
+ MsgGenSetLocalFwUpdate.MKHIHeader.Fields.Command = FWCAPS_SET_RULE_CMD;
+ MsgGenSetLocalFwUpdate.MKHIHeader.Fields.IsResponse = 0;
+ MsgGenSetLocalFwUpdate.Data.RuleId = 7;
+ MsgGenSetLocalFwUpdate.Data.RuleDataLen = 1;
+ MsgGenSetLocalFwUpdate.Data.RuleData = RuleData;
+ Length = sizeof (GEN_SET_LOCAL_FW_UPDATE);
+
+ ///
+ /// Send Get Local FW update Request to ME
+ ///
+ PERF_START_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x80B0);
+ Status = Heci->SendMsg (
+ (UINT32 *) &MsgGenSetLocalFwUpdate,
+ Length,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_CORE_MESSAGE_ADDR
+ );
+ if (EFI_ERROR (Status)) {
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x80B2);
+ return Status;
+ }
+
+ Length = sizeof (GEN_SET_LOCAL_FW_UPDATE_ACK);
+ Status = Heci->ReadMsg (
+ BLOCKING,
+ (UINT32 *) &MsgGenSetLocalFwUpdateAck,
+ &Length
+ );
+
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x80B1);
+ return Status;
+}
+
+/**
+ This message is sent by the BIOS or IntelR MEBX prior to the End of Post (EOP)
+ on the boot where host wants to enable the ME State. The firmware allows a single
+ update once it receives the enable command. Once firmware receives this message,
+ the firmware will be in normal mode after a global reset.
+
+ @param[in] None
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS ME enabled message sent
+**/
+EFI_STATUS
+HeciSetMeEnableMsg (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ UINT32 Length;
+ EFI_HECI_PROTOCOL *Heci;
+ GEN_SET_FW_CAPSKU_ACK MsgMeStateControlAck;
+ HECI_FWS_REGISTER MeFirmwareStatus;
+ UINTN HeciPciAddressBase;
+ UINT16 TimeOut;
+ UINT32 MeMode;
+
+ TimeOut = 0;
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = Heci->GetMeMode (&MeMode);
+ if (MeMode == ME_MODE_NORMAL) {
+ return EFI_SUCCESS;
+ }
+
+ if (IsAfterEndOfPost ()) {
+ return EFI_UNSUPPORTED;
+ }
+
+ if (EFI_ERROR (Status) || (MeMode != ME_MODE_TEMP_DISABLED)) {
+ return EFI_UNSUPPORTED;
+ }
+
+ HeciPciAddressBase = PCI_LIB_ADDRESS (
+ ME_BUS,
+ ME_DEVICE_NUMBER,
+ HECI_FUNCTION_NUMBER,
+ 0
+ );
+ PciWrite8 (HeciPciAddressBase + R_GEN_STS + 3, 0x20);
+ do {
+ MeFirmwareStatus.ul = PciRead32 (HeciPciAddressBase + R_FWSTATE);
+ gBS->Stall (EFI_ME_STATE_STALL_1_SECOND);
+ TimeOut++;
+ } while ((MeFirmwareStatus.r.FwInitComplete != ME_FIRMWARE_COMPLETED) && (TimeOut < EFI_ME_STATE_MAX_TIMEOUT));
+
+ Length = sizeof (GEN_SET_FW_CAPSKU_ACK);
+ Status = Heci->ReadMsg (
+ BLOCKING,
+ (UINT32 *) &MsgMeStateControlAck,
+ &Length
+ );
+ return Status;
+}
+
+/**
+ This message is sent by the BIOS or IntelR MEBX prior to the End of Post (EOP)
+ on the boot where host wants to disable the ME State. The firmware allows a single
+ update once it receives the disable command Once firmware receives this message,
+ the firmware will work in "Soft Temporary Disable" mode (HFS[19:16] = 3) after a
+ global reset. Note, this message is not allowed when AT firmware is enrolled/configured.
+
+ @param[in] None
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS ME is disabled
+**/
+EFI_STATUS
+HeciSetMeDisableMsg (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ UINT32 Length;
+ EFI_HECI_PROTOCOL *Heci;
+ GEN_SET_FW_CAPSKU MsgMeStateControl;
+ UINT32 MeMode;
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = Heci->GetMeMode (&MeMode);
+ if (MeMode == ME_MODE_TEMP_DISABLED) {
+ return EFI_SUCCESS;
+ }
+
+ if (IsAfterEndOfPost ()) {
+ return EFI_UNSUPPORTED;
+ }
+
+ Status = Heci->GetMeMode (&MeMode);
+ if (EFI_ERROR (Status) || (MeMode != ME_MODE_NORMAL)) {
+ return EFI_UNSUPPORTED;
+ }
+
+ MsgMeStateControl.MKHIHeader.Data = 0;
+ MsgMeStateControl.MKHIHeader.Fields.GroupId = MKHI_FWCAPS_GROUP_ID;
+ MsgMeStateControl.MKHIHeader.Fields.Command = FWCAPS_SET_RULE_CMD;
+ MsgMeStateControl.MKHIHeader.Fields.IsResponse = 0;
+ MsgMeStateControl.Data.RuleId.Data = 6;
+ MsgMeStateControl.Data.RuleDataLen = 1;
+ MsgMeStateControl.Data.RuleData = 0;
+
+ Length = sizeof (GEN_SET_FW_CAPSKU);
+
+ Status = Heci->SendwACK (
+ (UINT32 *) &MsgMeStateControl,
+ Length,
+ &Length,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_CORE_MESSAGE_ADDR
+ );
+ return Status;
+}
+
+/**
+ This message is sent by the BIOS or IntelR MEBX prior to the End of Post (EOP)
+ on the boot where host wants to get Ibex Peak platform type.
+ One of usages is to utilize this command to determine if the platform runs in
+ 1.5M or 5M size firmware.
+
+ @param[in] RuleData PlatformBrand,
+ IntelMeFwImageType,
+ SuperSku,
+ PlatformTargetMarketType,
+ PlatformTargetUsageType
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+ @retval EFI_BUFFER_TOO_SMALL Message Buffer is too smallfor the Acknowledge
+**/
+EFI_STATUS
+HeciGetPlatformTypeMsg (
+ OUT PLATFORM_TYPE_RULE_DATA *RuleData
+ )
+{
+ EFI_STATUS Status;
+ UINT32 Length;
+ EFI_HECI_PROTOCOL *Heci;
+ GEN_GET_PLATFORM_TYPE MsgGenGetPlatformType;
+ GEN_GET_PLATFORM_TYPE_ACK MsgGenGetPlatformTypeAck;
+ UINT32 MeMode;
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = Heci->GetMeMode (&MeMode);
+ if (EFI_ERROR (Status) || (MeMode != ME_MODE_NORMAL)) {
+ return EFI_UNSUPPORTED;
+ }
+
+ MsgGenGetPlatformType.MKHIHeader.Data = 0;
+ MsgGenGetPlatformType.MKHIHeader.Fields.GroupId = MKHI_FWCAPS_GROUP_ID;
+ MsgGenGetPlatformType.MKHIHeader.Fields.Command = FWCAPS_GET_RULE_CMD;
+ MsgGenGetPlatformType.MKHIHeader.Fields.IsResponse = 0;
+ MsgGenGetPlatformType.Data.RuleId = 0x1D;
+ Length = sizeof (GEN_GET_PLATFORM_TYPE);
+
+ ///
+ /// Send Get Platform Type Request to ME
+ ///
+ PERF_START_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x80C0);
+ Status = Heci->SendMsg (
+ (UINT32 *) &MsgGenGetPlatformType,
+ Length,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_CORE_MESSAGE_ADDR
+ );
+ if (EFI_ERROR (Status)) {
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x80C2);
+ return Status;
+ }
+
+ Length = sizeof (GEN_GET_PLATFORM_TYPE_ACK);
+ Status = Heci->ReadMsg (
+ BLOCKING,
+ (UINT32 *) &MsgGenGetPlatformTypeAck,
+ &Length
+ );
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x80C1);
+ *RuleData = MsgGenGetPlatformTypeAck.Data.RuleData;
+
+ return Status;
+}
+
+/**
+ This message is sent by the BIOS on the boot where the host wants to get the firmware provisioning state.
+ The firmware will respond to AMT BIOS SYNCH INFO message even after the End of Post.
+
+ @param[out] RuleData Bit [2:0] Reserved
+ Bit [4:3] Provisioning State
+ 00 - Pre -provisioning
+ 01 - In -provisioning
+ 02 - Post !Vprovisioning
+ Bit [31:5] Reserved
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Firmware provisioning state returned
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+ @retval EFI_BUFFER_TOO_SMALL Message Buffer is too smallfor the Acknowledge
+**/
+EFI_STATUS
+HeciAmtBiosSynchInfo (
+ OUT UINT32 *RuleData
+ )
+{
+ EFI_STATUS Status;
+ UINT32 Length;
+ EFI_HECI_PROTOCOL *Heci;
+ GEN_AMT_BIOS_SYNCH_INFO MsgGenAmtBiosSynchInfo;
+ GEN_AMT_BIOS_SYNCH_INFO_ACK MsgGenAmtBiosSynchInfoAck;
+ UINT32 MeMode;
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = Heci->GetMeMode (&MeMode);
+ if (EFI_ERROR (Status) || (MeMode != ME_MODE_NORMAL)) {
+ return EFI_UNSUPPORTED;
+ }
+
+ MsgGenAmtBiosSynchInfo.MKHIHeader.Data = 0;
+ MsgGenAmtBiosSynchInfo.MKHIHeader.Fields.GroupId = MKHI_FWCAPS_GROUP_ID;
+ MsgGenAmtBiosSynchInfo.MKHIHeader.Fields.Command = FWCAPS_GET_RULE_CMD;
+ MsgGenAmtBiosSynchInfo.MKHIHeader.Fields.IsResponse = 0;
+ MsgGenAmtBiosSynchInfo.Data.RuleId = 0x30005;
+ Length = sizeof (GEN_AMT_BIOS_SYNCH_INFO);
+
+ PERF_START_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x8130);
+ Status = Heci->SendMsg (
+ (UINT32 *) &MsgGenAmtBiosSynchInfo,
+ Length,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_CORE_MESSAGE_ADDR
+ );
+ if (EFI_ERROR (Status)) {
+ PERF_START_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x8132);
+ return Status;
+ }
+
+ Length = sizeof (GEN_AMT_BIOS_SYNCH_INFO_ACK);
+ Status = Heci->ReadMsg (
+ BLOCKING,
+ (UINT32 *) &MsgGenAmtBiosSynchInfoAck,
+ &Length
+ );
+ if (EFI_ERROR (Status)) {
+ PERF_START_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x8133);
+ return Status;
+ }
+
+ *RuleData = MsgGenAmtBiosSynchInfoAck.RuleData;
+
+ PERF_START_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x8131);
+ return Status;
+}
+
+/**
+ The firmware will respond to GET OEM TAG message even after the End of Post (EOP).
+
+ @param[in] RuleData Default is zero. Tool can create the OEM specific OEM TAG data.
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+ @retval EFI_BUFFER_TOO_SMALL Message Buffer is too smallfor the Acknowledge
+**/
+EFI_STATUS
+HeciGetOemTagMsg (
+ OUT UINT32 *RuleData
+ )
+{
+ EFI_STATUS Status;
+ UINT32 Length;
+ EFI_HECI_PROTOCOL *Heci;
+ GEN_GET_OEM_TAG_MSG MsgGenGetOemTagMsg;
+ GEN_GET_OEM_TAG_MSG_ACK MsgGenGetOemTagMsgAck;
+ UINT32 MeMode;
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = Heci->GetMeMode (&MeMode);
+ if (EFI_ERROR (Status) || (MeMode != ME_MODE_NORMAL)) {
+ return EFI_UNSUPPORTED;
+ }
+
+ MsgGenGetOemTagMsg.MKHIHeader.Data = 0;
+ MsgGenGetOemTagMsg.MKHIHeader.Fields.GroupId = MKHI_FWCAPS_GROUP_ID;
+ MsgGenGetOemTagMsg.MKHIHeader.Fields.Command = FWCAPS_GET_RULE_CMD;
+ MsgGenGetOemTagMsg.MKHIHeader.Fields.IsResponse = 0;
+ MsgGenGetOemTagMsg.Data.RuleId = 0x2B;
+ Length = sizeof (GEN_GET_OEM_TAG_MSG);
+
+ Status = Heci->SendMsg (
+ (UINT32 *) &MsgGenGetOemTagMsg,
+ Length,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_CORE_MESSAGE_ADDR
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Length = sizeof (GEN_GET_OEM_TAG_MSG_ACK);
+ Status = Heci->ReadMsg (
+ BLOCKING,
+ (UINT32 *) &MsgGenGetOemTagMsgAck,
+ &Length
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ *RuleData = MsgGenGetOemTagMsgAck.RuleData;
+
+ return Status;
+}
+
+/**
+ Enables/disables clocks. Used to turn off clocks in unused pci/pcie slots.
+ BIOS use this command when it enumerates PCI slots. When PCI slot is found unpopulated, the
+ BIOS can disable its clock through this MEI message. It is the BIOS requirement to know which
+ slot is controlled by which control bit.
+
+ @param[in] Enables each bit means corresponding clock should be turned on (1) or off (0)
+ @param[in] EnablesMask each bit means corresponding enable bit is valid (1) or should be ignored (0)
+ @param[in] ResponseMode 0 wait for response, 1 - skip
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_DEVICE_ERROR Wrong response
+ @retval EFI_NOT_READY ME is not ready
+ @retval EFI_INVALID_PARAMETER ResponseMode is invalid value
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+HeciSetIccClockEnables (
+ IN UINT32 Enables,
+ IN UINT32 EnablesMask,
+ IN UINT8 ResponseMode
+ )
+{
+ EFI_STATUS Status;
+ ICC_SET_CLK_ENABLES_BUFFER Buffer;
+ UINT32 CommandSize;
+ UINT32 ResponseSize;
+ EFI_HECI_PROTOCOL *Heci;
+ UINT32 MeMode;
+ UINT32 MeStatus;
+
+ if (IsAfterEndOfPost ()) {
+ return EFI_UNSUPPORTED;
+ }
+
+ if ((ResponseMode != ICC_RESPONSE_MODE_SKIP) && (ResponseMode != ICC_RESPONSE_MODE_WAIT)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = Heci->GetMeMode (&MeMode);
+ if (EFI_ERROR (Status) || (MeMode != ME_MODE_NORMAL)) {
+ return EFI_UNSUPPORTED;
+ }
+
+ Status = Heci->GetMeStatus (&MeStatus);
+ if (EFI_ERROR (Status) || ((MeStatus & 0xF) != ME_READY)) {
+ return EFI_NOT_READY;
+ }
+
+ CommandSize = sizeof (ICC_SET_CLK_ENABLES_MESSAGE);
+ ResponseSize = sizeof (ICC_SET_CLK_ENABLES_RESPONSE);
+
+ Buffer.message.Header.ApiVersion = LYNX_POINT_PLATFORM;
+ Buffer.message.Header.IccCommand = SET_CLOCK_ENABLES;
+ Buffer.message.Header.IccResponse = 0;
+ Buffer.message.Header.BufferLength = CommandSize - sizeof (ICC_HEADER);
+ Buffer.message.Header.Reserved = 0;
+ Buffer.message.ClockEnables = Enables;
+ Buffer.message.ClockEnablesMask = EnablesMask;
+ Buffer.message.Params = ResponseMode;
+
+ PERF_START_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x80D0);
+ Status = Heci->SendMsg (
+ (UINT32 *) &Buffer,
+ CommandSize,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_ICC_MESSAGE_ADDR
+ );
+
+ if (ResponseMode == ICC_RESPONSE_MODE_WAIT) {
+ Status = Heci->ReadMsg (
+ BLOCKING,
+ (UINT32 *) &Buffer,
+ &ResponseSize
+ );
+ }
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "(ICC) IccSetClockEnables: Message failed! EFI_STATUS = %r\n", Status));
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x80D2);
+ return Status;
+ }
+
+ if (ResponseMode == ICC_RESPONSE_MODE_SKIP) {
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x80D3);
+ return EFI_SUCCESS;
+ }
+
+ if (Buffer.response.Header.IccResponse != ICC_STATUS_SUCCESS) {
+ DEBUG (
+ (EFI_D_ERROR,
+ "(ICC) IccSetClockEnables: Wrong response! IccHeader.Response = 0x%x\n",
+ Buffer.response.Header.IccResponse)
+ );
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x80D4);
+ return EFI_DEVICE_ERROR;
+ }
+
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x80D1);
+ return Status;
+}
+
+/**
+ Sets or reads Lock mask on ICC registers.
+ @param[in] AccessMode 0 - set, 1 - get
+ @param[in] ResponseMode 0 - firmware will answer, 1 - firmware will not answer
+ @param[in][out] LockRegInfo bundle count info and mask of registers to become (for 'set' mode) or are
+ (for 'get' mode) locked. Each bit represents a register. 0=lock, 1=don't lock
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_INVALID_PARAMETER ResponseMode or pointer of Mask is invalid value
+ @retval EFI_DEVICE_ERROR Wrong response
+ @retval EFI_NOT_READY Heci device hasn't ready yet
+**/
+EFI_STATUS
+HeciLockIccRegisters (
+ IN UINT8 AccessMode,
+ IN UINT8 ResponseMode,
+ IN OUT ICC_LOCK_REGS_INFO *LockRegInfo
+ )
+{
+ EFI_STATUS Status;
+ ICC_LOCK_REGISTERS_BUFFER Buffer;
+ UINT32 CommandSize;
+ UINT32 ResponseSize;
+ EFI_HECI_PROTOCOL *Heci;
+ UINT32 MeMode;
+ UINT32 MeStatus;
+ UINT32 i;
+
+ if (IsAfterEndOfPost ()) {
+ return EFI_UNSUPPORTED;
+ }
+
+ if ((ResponseMode != ICC_RESPONSE_MODE_SKIP) && (ResponseMode != ICC_RESPONSE_MODE_WAIT)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = Heci->GetMeMode (&MeMode);
+ if (EFI_ERROR (Status) || (MeMode != ME_MODE_NORMAL)) {
+ return EFI_UNSUPPORTED;
+ }
+
+ Status = Heci->GetMeStatus (&MeStatus);
+ if (EFI_ERROR (Status) || ((MeStatus & 0xF) != ME_READY)) {
+ return EFI_NOT_READY;
+ }
+
+ DEBUG ((EFI_D_INFO, "(ICC) LockIccRegisters\n"));
+ if (LockRegInfo == NULL) {
+ return EFI_INVALID_PARAMETER;
+
+ }
+
+ CommandSize = sizeof (ICC_LOCK_REGISTERS_MESSAGE) -
+ sizeof(UINT32) * ICC_LOCK_MASK_COUNT +
+ sizeof(UINT32) * LockRegInfo->RegBundles.BundlesCnt;
+ ResponseSize = sizeof (ICC_LOCK_REGISTERS_RESPONSE);
+
+ Buffer.message.Header.ApiVersion = LYNX_POINT_PLATFORM;
+ Buffer.message.Header.IccCommand = LOCK_ICC_REGISTERS;
+ Buffer.message.Header.IccResponse = 0;
+ Buffer.message.Header.BufferLength = CommandSize - sizeof (ICC_HEADER);
+ Buffer.message.Header.Reserved = 0;
+ Buffer.message.AccessMode = AccessMode;
+ Buffer.message.Parameters = ResponseMode;
+ Buffer.message.Reserved[0] = 0;
+ Buffer.message.Reserved[1] = 0;
+ Buffer.message.LockRegInfo.RegBundles = LockRegInfo->RegBundles;
+ for (i = 0; i < LockRegInfo->RegBundles.BundlesCnt; i++) {
+ Buffer.message.LockRegInfo.RegMask[i] = LockRegInfo->RegMask[i];
+ }
+
+ PERF_START_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x80E0);
+ Status = Heci->SendMsg (
+ (UINT32 *) &Buffer,
+ CommandSize,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_ICC_MESSAGE_ADDR
+ );
+
+ if (ResponseMode == ICC_RESPONSE_MODE_WAIT) {
+ Status = Heci->ReadMsg (
+ BLOCKING,
+ (UINT32 *) &Buffer,
+ &ResponseSize
+ );
+ }
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "(ICC) LockIccRegisters: Message failed! EFI_STATUS = %r\n", Status));
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x80E2);
+ return Status;
+ }
+
+ if (ResponseMode == ICC_RESPONSE_MODE_SKIP) {
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x80E3);
+ return EFI_SUCCESS;
+ }
+
+ if (Buffer.response.Header.IccResponse != ICC_STATUS_SUCCESS) {
+ DEBUG (
+ (EFI_D_ERROR,
+ "(ICC) LockIccRegisters: Wrong response! IccHeader.Response = 0x%x\n",
+ Buffer.response.Header.IccResponse)
+ );
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x80E4);
+ return EFI_DEVICE_ERROR;
+ }
+
+ if (AccessMode == ICC_LOCK_ACCESS_MODE_GET) {
+ LockRegInfo->RegBundles = Buffer.response.LockRegInfo.RegBundles;
+ LockRegInfo->RegMask[0] = Buffer.response.LockRegInfo.RegMask[0];
+ LockRegInfo->RegMask[1] = Buffer.response.LockRegInfo.RegMask[1];
+ LockRegInfo->RegMask[2] = Buffer.response.LockRegInfo.RegMask[2];
+ }
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x80E1);
+
+ return Status;
+}
+
+/**
+ retrieves the number of currently used ICC clock profile
+
+ @param[out] Profile number of current ICC clock profile
+
+ @exception EFI_UNSUPPORTED ICC clock profile doesn't support
+ @retval EFI_NOT_READY Heci device hasn't ready yet
+**/
+EFI_STATUS
+HeciGetIccProfile (
+ OUT UINT8 *Profile
+ )
+{
+ EFI_STATUS Status;
+ ICC_GET_PROFILE_BUFFER Buffer;
+ UINT32 CommandSize;
+ UINT32 ResponseSize;
+ EFI_HECI_PROTOCOL *Heci;
+ UINT32 MeMode;
+ UINT32 MeStatus;
+
+ if (IsAfterEndOfPost ()) {
+ return EFI_UNSUPPORTED;
+ }
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = Heci->GetMeMode (&MeMode);
+ if (EFI_ERROR (Status) || (MeMode != ME_MODE_NORMAL)) {
+ return EFI_UNSUPPORTED;
+ }
+
+ Status = Heci->GetMeStatus (&MeStatus);
+ if (EFI_ERROR (Status) || ((MeStatus & 0xF) != ME_READY)) {
+ return EFI_NOT_READY;
+ }
+
+ DEBUG ((EFI_D_INFO, "(ICC) GetIccProfile\n"));
+ CommandSize = sizeof (ICC_GET_PROFILE_MESSAGE);
+ ResponseSize = sizeof (ICC_GET_PROFILE_RESPONSE);
+
+ Buffer.message.Header.ApiVersion = LYNX_POINT_PLATFORM;
+ Buffer.message.Header.IccCommand = GET_ICC_PROFILE;
+ Buffer.message.Header.IccResponse = 0;
+ Buffer.message.Header.BufferLength = CommandSize - sizeof (ICC_HEADER);
+ Buffer.message.Header.Reserved = 0;
+
+ PERF_START_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x80F0);
+ Status = Heci->SendwACK (
+ (UINT32 *) &Buffer,
+ CommandSize,
+ &ResponseSize,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_ICC_MESSAGE_ADDR
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_INFO, "(ICC) GetIccProfile: Message failed! EFI_STATUS = %r\n", Status));
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x80F2);
+ return Status;
+ }
+
+ if (Buffer.response.Header.IccResponse != ICC_STATUS_SUCCESS) {
+ DEBUG (
+ (EFI_D_ERROR,
+ "(ICC) GetIccProfile: Wrong response! IccHeader.Response = 0x%x\n",
+ Buffer.response.Header.IccResponse)
+ );
+ Status = EFI_DEVICE_ERROR;
+ } else {
+ DEBUG ((EFI_D_INFO, "(ICC) GetIccProfile: Current profile = 0x%x\n", Buffer.response.IccProfileIndex));
+ }
+
+ if (Profile != NULL) {
+ *Profile = Buffer.response.IccProfileIndex;
+ }
+
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x80F1);
+
+ return Status;
+}
+
+/**
+ Sets ICC clock profile to be used on next and following boots
+
+ @param[in] Profile number of profile to be used
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_DEVICE_ERROR Wrong response
+ @retval EFI_NOT_READY Heci device hasn't ready yet
+**/
+EFI_STATUS
+HeciSetIccProfile (
+ IN UINT8 Profile
+ )
+{
+ EFI_STATUS Status;
+ ICC_SET_PROFILE_BUFFER Buffer;
+ UINT32 CommandSize;
+ UINT32 ResponseSize;
+ EFI_HECI_PROTOCOL *Heci;
+ UINT32 MeMode;
+ UINT32 MeStatus;
+
+ if (IsAfterEndOfPost ()) {
+ return EFI_UNSUPPORTED;
+ }
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = Heci->GetMeMode (&MeMode);
+ if (EFI_ERROR (Status) || (MeMode != ME_MODE_NORMAL)) {
+ return EFI_UNSUPPORTED;
+ }
+
+ Status = Heci->GetMeStatus (&MeStatus);
+ if (EFI_ERROR (Status) || ((MeStatus & 0xF) != ME_READY)) {
+ return EFI_NOT_READY;
+ }
+
+ DEBUG ((EFI_D_INFO, "(ICC) SetIccProfile\n"));
+
+ CommandSize = sizeof (ICC_SET_PROFILE_MESSAGE);
+ ResponseSize = sizeof (ICC_SET_PROFILE_RESPONSE);
+
+ Buffer.message.Header.ApiVersion = LYNX_POINT_PLATFORM;
+ Buffer.message.Header.IccCommand = SET_ICC_PROFILE;
+ Buffer.message.Header.IccResponse = 0;
+ Buffer.message.Header.BufferLength = CommandSize - sizeof (ICC_HEADER);
+ Buffer.message.Header.Reserved = 0;
+ Buffer.message.ProfileBIOS = Profile;
+ Buffer.message.PaddingA = 0;
+ Buffer.message.PaddingB = 0;
+
+ PERF_START_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x8100);
+ Status = Heci->SendwACK (
+ (UINT32 *) &Buffer,
+ CommandSize,
+ &ResponseSize,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_ICC_MESSAGE_ADDR
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "(ICC) SetIccProfile: Message failed! EFI_STATUS = %r\n", Status));
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x8102);
+ return Status;
+ }
+
+ if (Buffer.response.Header.IccResponse != ICC_STATUS_SUCCESS) {
+ DEBUG (
+ (EFI_D_ERROR,
+ "(ICC) SetIccProfile: Wrong response! IccHeader.Response = 0x%x\n",
+ Buffer.response.Header.IccResponse)
+ );
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x8103);
+ return EFI_DEVICE_ERROR;
+ }
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x8101);
+
+ return Status;
+}
+
+/**
+ Writes 1 dword of data to the icc register offset specified by RegOffset in the ICC Aux space
+ @param[in] RegOffset Register Offset in ICC Aux Space to write
+ @param[in] RegData Dword ICC register data to write
+ @param[in] ResponseMode 0 Wait for response, 1 - skip
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_DEVICE_ERROR Wrong response
+ @retval EFI_NOT_READY ME is not ready
+ @retval EFI_INVALID_PARAMETER ResponseMode is invalid value
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+HeciWriteIccRegDword (
+ IN UINT16 RegOffset,
+ IN UINT32 RegData,
+ IN UINT8 ResponseMode
+ )
+{
+ EFI_STATUS Status;
+ ICC_WRITE_ICC_REG_BUFFER Buffer;
+ UINT32 CommandSize;
+ UINT32 ResponseSize;
+ EFI_HECI_PROTOCOL *Heci;
+ UINT32 MeMode;
+ UINT32 MeStatus;
+
+ if (IsAfterEndOfPost ()) {
+ return EFI_UNSUPPORTED;
+ }
+
+ if ((ResponseMode != ICC_RESPONSE_MODE_SKIP) && (ResponseMode != ICC_RESPONSE_MODE_WAIT)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ &Heci
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = Heci->GetMeMode (&MeMode);
+ if (EFI_ERROR (Status) || (MeMode != ME_MODE_NORMAL)) {
+ return EFI_UNSUPPORTED;
+ }
+
+ Status = Heci->GetMeStatus (&MeStatus);
+ if (EFI_ERROR (Status) || ((MeStatus & 0xF) != ME_READY)) {
+ return EFI_NOT_READY;
+ }
+
+ CommandSize = sizeof (ICC_WRITE_ICC_REG_DWORD_MESSAGE);
+ ResponseSize = sizeof (ICC_WRITE_ICC_REG_DWORD_RESPONSE);
+
+ Buffer.message.Header.ApiVersion = LYNX_POINT_PLATFORM;
+ Buffer.message.Header.IccCommand = WRITE_ICC_REGISTER;
+ Buffer.message.Header.IccResponse = 0;
+ Buffer.message.Header.BufferLength = CommandSize - sizeof (ICC_HEADER);
+ Buffer.message.Header.Reserved = 0;
+ Buffer.message.Reserved = 0;
+ Buffer.message.Reserved1 = 0;
+ Buffer.message.Params = ResponseMode;
+ Buffer.message.RecordDword.RecordFlags = WRITE_ICC_RECORD_FLAGS;
+ Buffer.message.RecordDword.BundleCount.BundlesCnt = WRITE_ICC_REG_BUNDLE_COUNT;
+ Buffer.message.RecordDword.BundleCount.AU = 0;
+ Buffer.message.RecordDword.BundleCount.Reserved = 0;
+ Buffer.message.RecordDword.AddressMask.AddressMaskData = RegOffset | ADDRESS_MASK_FIXED_DATA;
+ Buffer.message.RecordDword.RegValue = RegData;
+
+ PERF_START_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x80D0);
+ Status = Heci->SendMsg (
+ (UINT32 *) &Buffer,
+ CommandSize,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_ICC_MESSAGE_ADDR
+ );
+
+ if (ResponseMode == ICC_RESPONSE_MODE_WAIT) {
+ Status = Heci->ReadMsg (
+ BLOCKING,
+ (UINT32 *) &Buffer,
+ &ResponseSize
+ );
+
+ }
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "(ICC) HeciWriteIccRegDword: Message failed! EFI_STATUS = %r\n", Status));
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x80D2);
+ return Status;
+ }
+
+ if (ResponseMode == ICC_RESPONSE_MODE_SKIP) {
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x80D3);
+ return EFI_SUCCESS;
+ }
+
+ if (Buffer.response.Header.IccResponse != ICC_STATUS_SUCCESS) {
+ DEBUG (
+ (EFI_D_ERROR,
+ "(ICC) HeciWriteIccRegDword: Wrong response! IccHeader.Response = 0x%x\n",
+ Buffer.response.Header.IccResponse)
+ );
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x80D4);
+ return EFI_DEVICE_ERROR;
+ }
+
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x80D1);
+ return Status;
+}
+
+/**
+ This message is used to turn on the Intel ME firmware MDES
+ capability, Intel SVT for PCH capability or both when the
+ system is in a post-manufactured state. Once firmware receives
+ this message, the firmware will enable selected platform debug
+ capabilities . The firmware will automatically disable all
+ platform debug capabilities if this message is not received
+ before receiving End Of Post.
+
+ @param[in] Data capabilities to be enabled
+ @param[out] Result 0x00 : Enable Success
+ Others : Enable Failure
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+ @retval EFI_BUFFER_TOO_SMALL Message Buffer is too smallfor the Acknowledge
+**/
+EFI_STATUS
+HeciPlatformDebugCapabilityMsg (
+ IN PLATFORM_DEBUG_CAP Data,
+ OUT UINT8 *Result
+ )
+{
+ EFI_STATUS Status;
+ UINT32 Length;
+ EFI_HECI_PROTOCOL *Heci;
+ GEN_PLATFORM_DEBUG_CAP_MKHI_CMD_MSG PlatformDebug;
+ UINT32 MeMode;
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = Heci->GetMeMode (&MeMode);
+ if (EFI_ERROR (Status) || (MeMode != ME_MODE_NORMAL)) {
+ return EFI_UNSUPPORTED;
+ }
+
+ PlatformDebug.MKHIHeader.Data = 0;
+ PlatformDebug.MKHIHeader.Fields.GroupId = MKHI_MDES_GROUP_ID;
+ PlatformDebug.MKHIHeader.Fields.Command = MDES_ENABLE_MKHI_CMD;
+ PlatformDebug.MKHIHeader.Fields.IsResponse = 0;
+ PlatformDebug.Capability = Data;
+ Length = sizeof (GEN_PLATFORM_DEBUG_CAP_MKHI_CMD_MSG);
+
+ Status = Heci->SendwACK (
+ (UINT32 *) &PlatformDebug,
+ Length,
+ &Length,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_CORE_MESSAGE_ADDR
+ );
+
+ if (Status == EFI_SUCCESS) {
+ *Result = (UINT8) PlatformDebug.MKHIHeader.Fields.Result;
+ }
+
+ return Status;
+}
+
+/**
+ It creates and sends Heci messages.
+
+ Remark:
+ Functionality is available only in release mode.
+ Using MDES in debug mode causes recursive calling of this function
+ because debug messages are sending from Heci->SendMsg function.
+
+ @param[in] CodeType Indicates the type of status code being reported.
+ @param[in] Value Describes the current status of a hardware or software entity.
+ This included information about the class and subclass that is
+ used to classify the entity as well as an operation.
+ @param[in] Instance The enumeration of a hardware or software entity within
+ the system. Valid instance numbers start with 1.
+ @param[in] CallerId This optional parameter may be used to identify the caller.
+ This parameter allows the status code driver to apply different
+ rules to different callers.
+ @param[in] Data This optional parameter may be used to pass additional data.
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Opcode evaluation success.
+ @retval Other Opcode evaluation failed.
+**/
+EFI_STATUS
+HeciSendMdesStatusCode (
+ IN EFI_STATUS_CODE_TYPE CodeType,
+ IN EFI_STATUS_CODE_VALUE Value,
+ IN UINT32 Instance,
+ IN EFI_GUID * CallerId OPTIONAL,
+ IN EFI_STATUS_CODE_DATA * Data OPTIONAL
+ )
+{
+ CBM_BIOS_MDES_MSG_REQ MsgData;
+ EFI_STATUS Status;
+ UINT32 HeciLength;
+ UINT32 MeMode;
+ EFI_HECI_PROTOCOL *Heci;
+ static UINT32 sNr = 0;
+ UINT32 ExtendedDataSize;
+ UINT32 StringCnt;
+
+ ExtendedDataSize = 0;
+ StringCnt = 0;
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = Heci->GetMeMode (&MeMode);
+ if (EFI_ERROR (Status) || (MeMode != ME_MODE_NORMAL)) {
+ return EFI_UNSUPPORTED;
+ }
+
+ MsgData.MKHIHeader.Fields.GroupId = MKHI_MDES_GROUP_ID;
+ MsgData.MKHIHeader.Fields.Command = MDES_BIOS_MSG_LOG_REQ_CMD;
+ MsgData.MKHIHeader.Fields.IsResponse = 0;
+ MsgData.MKHIHeader.Fields.Result = 0;
+
+ MsgData.Data.MdesAttr.Severity = BiosToMdesSeverity (CodeType);
+ MsgData.Data.MdesAttr.PayLoadType = EFI_STATUS_CODE;
+ MsgData.Data.BiosAttr.CallerIdData = (CallerId == 0) ? 0 : 1;
+ MsgData.Data.BiosAttr.ExtendedDataHeader = (Data == 0) ? 0 : 1;
+ MsgData.Data.Serial = sNr++;
+ MsgData.Data.StatusType = CodeType;
+ MsgData.Data.StatusCode = Value;
+ MsgData.Data.Instance = Instance;
+
+ if (CallerId != 0) {
+ CopyMem (&MsgData.Data.CallerId, CallerId, sizeof(EFI_GUID));
+ }
+
+ if (Data != 0) {
+ ExtendedDataSize = Data->Size;
+ if (ExtendedDataSize > SIZE_OF_MDES_EXTENDED_DATA) {
+ ASSERT (FALSE);
+ //
+ // extended data too long
+ //
+ ExtendedDataSize = SIZE_OF_MDES_EXTENDED_DATA;
+ }
+
+ if (CompareGuid (&gEfiStatusCodeDataTypeStringGuid, &Data->Type)) {
+
+ EFI_STATUS_CODE_STRING_DATA *str_data;
+
+ str_data = (EFI_STATUS_CODE_STRING_DATA *) Data;
+ MsgData.Data.ExtendedData[0] = (UINT8) (str_data->StringType);
+ MsgData.Data.ExtendedData[1] = 0;
+ MsgData.Data.ExtendedData[2] = 0;
+ MsgData.Data.ExtendedData[3] = 0;
+
+ if (str_data->StringType == EfiStringAscii) {
+ AsciiStrnCpy ((CHAR8 *) &MsgData.Data.ExtendedData[4], str_data->String.Ascii, SIZE_OF_MDES_EXTENDED_DATA);
+ StringCnt = (UINT32) AsciiStrLen ((CHAR8 *) &MsgData.Data.ExtendedData[4]);
+ ExtendedDataSize = 4 + StringCnt;
+ if (ExtendedDataSize > SIZE_OF_MDES_EXTENDED_DATA) {
+ ExtendedDataSize = SIZE_OF_MDES_EXTENDED_DATA;
+ }
+
+ } else if (str_data->StringType == EfiStringUnicode) {
+ StrnCpy ((CHAR16 *) &MsgData.Data.ExtendedData[4], str_data->String.Unicode, SIZE_OF_MDES_EXTENDED_DATA);
+ StringCnt = (UINT32) StrLen ((CHAR16 *) &MsgData.Data.ExtendedData[4]);
+ ExtendedDataSize = 4 + StringCnt;
+ if (ExtendedDataSize > SIZE_OF_MDES_EXTENDED_DATA) {
+ ExtendedDataSize = SIZE_OF_MDES_EXTENDED_DATA;
+ }
+
+ } else if (str_data->StringType == EfiStringToken) {
+ CopyMem (MsgData.Data.ExtendedData, Data + Data->HeaderSize, ExtendedDataSize);
+ }
+ } else {
+ CopyMem (MsgData.Data.ExtendedData, Data + Data->HeaderSize, ExtendedDataSize);
+ }
+
+ MsgData.Data.ExtendedDataHeader.Size = (UINT16) ExtendedDataSize;
+ MsgData.Data.ExtendedDataHeader.HeaderSize = sizeof (MDES_EXTENDED_DATA_HEADER);
+ CopyMem (&MsgData.Data.ExtendedDataHeader.Type, &Data->Type, sizeof(EFI_GUID));
+ }
+
+ if (CallerId != 0) {
+ HeciLength = sizeof (CBM_BIOS_MDES_MSG_REQ) - SIZE_OF_MDES_EXTENDED_DATA - sizeof (MDES_EXTENDED_DATA_HEADER);
+ } else {
+ HeciLength = sizeof (CBM_BIOS_MDES_MSG_REQ) -
+ SIZE_OF_MDES_EXTENDED_DATA -
+ sizeof (MDES_EXTENDED_DATA_HEADER) -
+ sizeof (EFI_GUID);
+ }
+
+ if (Data != 0) {
+ HeciLength = sizeof (CBM_BIOS_MDES_MSG_REQ) - SIZE_OF_MDES_EXTENDED_DATA + ExtendedDataSize;
+ }
+
+ Status = Heci->SendMsg (
+ (UINT32 *) &MsgData,
+ HeciLength,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_CORE_MESSAGE_ADDR
+ );
+
+ return Status;
+}
+
+/**
+ Provides an interface to call function to send HECI message.
+
+ @param[in] Flags Indicates the status of the BIOS MDES.
+ @param[in] BiosEventFilters Indicates the status of the BIOS event filter group.
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS HECI sent with success.
+**/
+EFI_STATUS
+HeciGetMdesConfig (
+ OUT MDES_BIOS_FLAGS *Flags,
+ OUT UINT32 *BiosEventFilters
+ )
+{
+ EFI_STATUS Status;
+ EFI_HECI_PROTOCOL *Heci;
+ UINT32 MeMode;
+ UINT32 Length;
+ MKHI_CBM_BIOS_MDES_MSG_GET_CONFIG_ACK MsgMdesAvailabilityAck;
+ MKHI_CBM_BIOS_MDES_MSG_GET_CONFIG_REQ MsgMdesAvailabilityReq;
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = Heci->GetMeMode (&MeMode);
+ if (EFI_ERROR (Status) || (MeMode != ME_MODE_NORMAL)) {
+ return EFI_UNSUPPORTED;
+ }
+
+ MsgMdesAvailabilityReq.MKHIHeader.Fields.GroupId = MKHI_MDES_GROUP_ID;
+ MsgMdesAvailabilityReq.MKHIHeader.Fields.Command = MDES_BIOS_MSG_GET_CONFIG_CMD;
+ MsgMdesAvailabilityReq.MKHIHeader.Fields.IsResponse = 0;
+ MsgMdesAvailabilityReq.MKHIHeader.Fields.Result = 0;
+
+ Length = sizeof (MKHI_CBM_BIOS_MDES_MSG_GET_CONFIG_REQ);
+ Status = Heci->SendMsg (
+ (UINT32 *) &MsgMdesAvailabilityReq,
+ Length,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_CORE_MESSAGE_ADDR
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Length = sizeof (MKHI_CBM_BIOS_MDES_MSG_GET_CONFIG_ACK);
+ Status = Heci->ReadMsg (
+ BLOCKING,
+ (UINT32 *) &MsgMdesAvailabilityAck,
+ &Length
+ );
+
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ *Flags = MsgMdesAvailabilityAck.Data.Flags;
+ *BiosEventFilters = MsgMdesAvailabilityAck.Data.BiosEventFilters;
+
+ return Status;
+}
+
+
+/**
+ Sends the MKHI Enable/Disable manageability message.
+ The message will only work if bit 2 in the bitmasks is toggled.
+ To enable manageability:
+ EnableState = 0x00000004, and
+ DisableState = 0x00000000.
+ To disable manageability:
+ EnableState = 0x00000000, and
+ DisableState = 0x00000004
+
+ @param[in] EnableState Enable Bit Mask
+ @param[in] DisableState Disable Bit Mask
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+ @retval EFI_BUFFER_TOO_SMALL Message Buffer is too smallfor the Acknowledge
+**/
+EFI_STATUS
+HeciFwFeatureStateOverride (
+ IN UINT32 EnableState,
+ IN UINT32 DisableState
+ )
+{
+ EFI_STATUS Status;
+ UINT32 HeciLength;
+ UINT32 MeMode;
+ FIRMWARE_CAPABILITY_OVERRIDE MngStateCmd;
+ FIRMWARE_CAPABILITY_OVERRIDE_ACK MngStateAck;
+ EFI_HECI_PROTOCOL *Heci;
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = Heci->GetMeMode (&MeMode);
+ if (EFI_ERROR (Status) || (MeMode != ME_MODE_NORMAL)) {
+ return EFI_UNSUPPORTED;
+ }
+
+ MngStateCmd.MKHIHeader.Data = 0;
+ MngStateCmd.MKHIHeader.Fields.Command = FIRMWARE_CAPABILITY_OVERRIDE_CMD;
+ MngStateCmd.MKHIHeader.Fields.IsResponse = 0;
+ MngStateCmd.MKHIHeader.Fields.GroupId = MKHI_GEN_GROUP_ID;
+ MngStateCmd.MKHIHeader.Fields.Reserved = 0;
+ MngStateCmd.MKHIHeader.Fields.Result = 0;
+ MngStateCmd.FeatureState.EnableFeature = EnableState;
+ MngStateCmd.FeatureState.DisableFeature = DisableState;
+ HeciLength = sizeof (FIRMWARE_CAPABILITY_OVERRIDE);
+
+ Status = Heci->SendMsg (
+ (UINT32 *) &MngStateCmd,
+ HeciLength,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_CORE_MESSAGE_ADDR
+ );
+
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ HeciLength = sizeof (FIRMWARE_CAPABILITY_OVERRIDE_ACK);
+ Status = Heci->ReadMsg (
+ BLOCKING,
+ (UINT32 *) &MngStateAck,
+ &HeciLength
+ );
+
+ return Status;
+}
+
+/**
+ The Get FW Feature Status message is based on MKHI interface.
+ This command is used by BIOS/IntelR MEBX to get firmware runtime status.
+ The GET FW RUNTIME STATUS message doesn't need to check the HFS.
+ FWInitComplete value before sending the command.
+ It means this message can be sent regardless of HFS.FWInitComplete.
+
+ @param[out] RuleData MEFWCAPS_SKU message
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+**/
+EFI_STATUS
+HeciGetFwFeatureStateMsg (
+ OUT MEFWCAPS_SKU *RuleData
+ )
+{
+ EFI_STATUS Status;
+ UINT32 Length;
+ GEN_GET_FW_FEATURE_STATUS GetFwFeatureStatus;
+ GEN_GET_FW_FEATURE_STATUS_ACK GetFwFeatureStatusAck;
+ UINT32 MeMode;
+ EFI_HECI_PROTOCOL *Heci;
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = Heci->GetMeMode (&MeMode);
+ if (EFI_ERROR (Status) || (MeMode != ME_MODE_NORMAL)) {
+ return EFI_UNSUPPORTED;
+ }
+
+ GetFwFeatureStatus.MKHIHeader.Data = 0;
+ GetFwFeatureStatus.MKHIHeader.Fields.GroupId = MKHI_FWCAPS_GROUP_ID;
+ GetFwFeatureStatus.MKHIHeader.Fields.Command = FWCAPS_GET_RULE_CMD;
+ GetFwFeatureStatus.MKHIHeader.Fields.IsResponse = 0;
+ GetFwFeatureStatus.Data.RuleId = 0x20;
+
+ Length = sizeof (GEN_GET_FW_FEATURE_STATUS);
+ Status = Heci->SendMsg (
+ (UINT32 *) &GetFwFeatureStatus,
+ Length,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_CORE_MESSAGE_ADDR
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Length = sizeof (GEN_GET_FW_FEATURE_STATUS_ACK);
+ Status = Heci->ReadMsg (
+ BLOCKING,
+ (UINT32 *) &GetFwFeatureStatusAck,
+ &Length
+ );
+
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ RuleData->Data = GetFwFeatureStatusAck.RuleData.Data;
+
+ return Status;
+}
+
+/**
+ This message is sent by the BIOS when it wants to query
+ the independent firmware recovery (IFR).
+
+ @param[in] RuleData 1 - local firmware update interface enable
+
+ 0 - local firmware update interface disable
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+ @retval EFI_BUFFER_TOO_SMALL Message Buffer is too smallfor the Acknowledge
+**/
+EFI_STATUS
+HeciGetIfrUpdate (
+ OUT UINT8 *RuleData
+ )
+{
+ EFI_STATUS Status;
+ UINT32 Length;
+ EFI_HECI_PROTOCOL *Heci;
+ GEN_GET_LOCAL_FW_UPDATE MsgGenGetLocalFwUpdate;
+ GEN_GET_LOCAL_FW_UPDATE_ACK MsgGenGetLocalFwUpdatekuAck;
+ UINT32 MeMode;
+
+ Status = EFI_SUCCESS;
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = Heci->GetMeMode (&MeMode);
+ if (EFI_ERROR (Status) || (MeMode != ME_MODE_NORMAL)) {
+ return EFI_UNSUPPORTED;
+ }
+
+ MsgGenGetLocalFwUpdate.MKHIHeader.Data = 0;
+ MsgGenGetLocalFwUpdate.MKHIHeader.Fields.GroupId = MKHI_FWCAPS_GROUP_ID;
+ MsgGenGetLocalFwUpdate.MKHIHeader.Fields.Command = FWCAPS_GET_RULE_CMD;
+ MsgGenGetLocalFwUpdate.MKHIHeader.Fields.IsResponse = 0;
+ MsgGenGetLocalFwUpdate.Data.RuleId = MEFWCAPS_ME_FWU_IFR_RULE;
+ Length = sizeof (GEN_GET_LOCAL_FW_UPDATE);
+
+ ///
+ /// Send Get Local FW update Request to ME
+ ///
+ PERF_START_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x8110);
+ Status = Heci->SendMsg (
+ (UINT32 *) &MsgGenGetLocalFwUpdate,
+ Length,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_CORE_MESSAGE_ADDR
+ );
+ if (EFI_ERROR (Status)) {
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x8112);
+ return Status;
+ }
+
+ Length = sizeof (GEN_GET_LOCAL_FW_UPDATE_ACK);
+ Status = Heci->ReadMsg (
+ BLOCKING,
+ (UINT32 *) &MsgGenGetLocalFwUpdatekuAck,
+ &Length
+ );
+ if (EFI_ERROR (Status)) {
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x8113);
+ return Status;
+ }
+
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x8111);
+ *RuleData = MsgGenGetLocalFwUpdatekuAck.Data.RuleData;
+
+ return Status;
+}
+
+/**
+ This message is sent by the BIOS when it wants to set
+ the independent firmware recovery (IFR) state.
+
+ @param[in] RuleData 1 - local firmware update interface enable
+ 0 - local firmware update interface disable
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+ @retval EFI_BUFFER_TOO_SMALL Message Buffer is too smallfor the Acknowledge
+**/
+EFI_STATUS
+HeciSetIfrUpdate (
+ IN UINT8 RuleData
+ )
+{
+ EFI_STATUS Status;
+ UINT32 Length;
+ EFI_HECI_PROTOCOL *Heci;
+ GEN_SET_LOCAL_FW_UPDATE MsgGenSetLocalFwUpdate;
+ GEN_SET_LOCAL_FW_UPDATE_ACK MsgGenSetLocalFwUpdateAck;
+ UINT32 MeMode;
+
+ Status = EFI_SUCCESS;
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = Heci->GetMeMode (&MeMode);
+ if (EFI_ERROR (Status) || (MeMode != ME_MODE_NORMAL)) {
+ return EFI_UNSUPPORTED;
+ }
+
+ MsgGenSetLocalFwUpdate.MKHIHeader.Data = 0;
+ MsgGenSetLocalFwUpdate.MKHIHeader.Fields.GroupId = MKHI_FWCAPS_GROUP_ID;
+ MsgGenSetLocalFwUpdate.MKHIHeader.Fields.Command = FWCAPS_SET_RULE_CMD;
+ MsgGenSetLocalFwUpdate.MKHIHeader.Fields.IsResponse = 0;
+ MsgGenSetLocalFwUpdate.Data.RuleId = MEFWCAPS_ME_FWU_IFR_RULE;
+ MsgGenSetLocalFwUpdate.Data.RuleDataLen = 1;
+ MsgGenSetLocalFwUpdate.Data.RuleData = RuleData;
+ Length = sizeof (GEN_SET_LOCAL_FW_UPDATE);
+
+ ///
+ /// Send Set Local FW update Request to ME
+ ///
+ PERF_START_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x8120);
+ Status = Heci->SendMsg (
+ (UINT32 *) &MsgGenSetLocalFwUpdate,
+ Length,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_CORE_MESSAGE_ADDR
+ );
+ if (EFI_ERROR (Status)) {
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x8122);
+ return Status;
+ }
+
+ Length = sizeof (GEN_SET_LOCAL_FW_UPDATE_ACK);
+ Status = Heci->ReadMsg (
+ BLOCKING,
+ (UINT32 *) &MsgGenSetLocalFwUpdateAck,
+ &Length
+ );
+
+ PERF_END_EX (NULL, EVENT_REC_TOK, NULL, AsmReadTsc(), 0x8121);
+ return Status;
+}
+
+/**
+ This message is sent by the BIOS if EOP-ACK not received to force ME to disable
+ HECI interfaces.
+
+ @param[in] None
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS HECI interfaces disabled by ME
+**/
+EFI_STATUS
+HeciDisableHeciBusMsg (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ UINT32 Length;
+ EFI_HECI_PROTOCOL *Heci;
+ HECI_BUS_DISABLE_CMD_ACK MsgHeciBusDisable;
+
+ ZeroMem(&MsgHeciBusDisable, sizeof(HECI_BUS_DISABLE_CMD_ACK));
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ if (IsAfterEndOfPost ()) {
+ return EFI_UNSUPPORTED;
+ }
+
+ MsgHeciBusDisable.Command.Data = HECI_BUS_DISABLE_OPCODE;
+ Length = sizeof (HECI_BUS_DISABLE_CMD_ACK);
+
+ Status = Heci->SendMsg (
+ (UINT32 *) &MsgHeciBusDisable,
+ Length,
+ BIOS_FIXED_HOST_ADDR,
+ ME_HECI_FIXED_ADDRESS
+ );
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ Status = Heci->ReadMsg (
+ BLOCKING,
+ (UINT32 *) &MsgHeciBusDisable,
+ &Length
+ );
+ if ((MsgHeciBusDisable.Command.Data != HECI_BUS_DISABLE_ACK_OPCODE)
+ || (MsgHeciBusDisable.Status != 0)) {
+ Status = EFI_ABORTED;
+ }
+
+ return Status;
+}
+
+/**
+ This message is sent by the BIOS to inform ME FW whether or not to take the
+ TPM 1.2 Deactivate flow
+
+ @param[in] UINT8 TpmDeactivate 0 - ME FW should not take the
+ deactivate flow.
+ 1 - ME FW should take the deactivate
+ flow.
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS HECI interfaces disabled by ME
+**/
+EFI_STATUS
+HeciSendTpmData (
+ IN UINT8 TpmDeactivate
+ )
+{
+ EFI_STATUS Status;
+ UINT32 HeciSendLength;
+ UINT32 HeciRecvLength;
+ EFI_HECI_PROTOCOL *Heci;
+ BIOSNV_SET_ACM_TPM SetAcmTpmMsg;
+ BIOSNV_SET_ACM_TPM_ACK SetAcmTpmMsgAck;
+
+ DEBUG ((EFI_D_ERROR, "HeciSendTpmData Message. TpmDeactivate Setup Data = %d\n", TpmDeactivate));
+
+ ZeroMem(&SetAcmTpmMsg, sizeof(BIOSNV_SET_ACM_TPM));
+ ZeroMem(&SetAcmTpmMsgAck, sizeof(BIOSNV_SET_ACM_TPM_ACK));
+
+ Status = gBS->LocateProtocol (
+ &gEfiHeciProtocolGuid,
+ NULL,
+ (VOID **) &Heci
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ if (IsAfterEndOfPost ()) {
+ return EFI_UNSUPPORTED;
+ }
+
+ SetAcmTpmMsg.MKHIHeader.Data = ACM_TPM_DATA_MKHI_DATA;
+ SetAcmTpmMsg.AcmTpmData.RuleId.Fields.RuleTypeId = ACM_TPM_DATA_RULE_TYPE_ID;
+ SetAcmTpmMsg.AcmTpmData.RuleDataLen = ACM_TPM_DATA_RULE_DATA_LENGTH;
+ SetAcmTpmMsg.AcmTpmData.TpmState.Fields.TpmDeactivate = FALSE;
+
+ if (TpmDeactivate == 1) {
+ SetAcmTpmMsg.AcmTpmData.TpmState.Fields.TpmDeactivate = TRUE;
+ }
+
+ //
+ // Send Set ACM TPM Data MKHI message
+ //
+ HeciSendLength = sizeof (BIOSNV_SET_ACM_TPM);
+ Status = Heci->SendMsg (
+ (UINT32 *) &SetAcmTpmMsg,
+ HeciSendLength,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_CORE_MESSAGE_ADDR
+ );
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ //
+ // Get Set ACM TPM Data MKHI ACK message
+ //
+ HeciRecvLength = sizeof (BIOSNV_SET_ACM_TPM_ACK);
+ Status = Heci->ReadMsg (
+ BLOCKING,
+ (UINT32 *) &SetAcmTpmMsgAck,
+ &HeciRecvLength
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ return Status;
+}
diff --git a/ReferenceCode/ME/Library/MeKernel/Dxe/HeciMsgLib.h b/ReferenceCode/ME/Library/MeKernel/Dxe/HeciMsgLib.h
new file mode 100644
index 0000000..4622608
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeKernel/Dxe/HeciMsgLib.h
@@ -0,0 +1,782 @@
+/** @file
+ Header file for Heci Message functionality
+
+@copyright
+ Copyright (c) 2006 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+#ifndef _HECI_MESSAGE_LIB_H_
+#define _HECI_MESSAGE_LIB_H_
+
+#include "CoreBiosMsg.h"
+
+#include EFI_PROTOCOL_DEFINITION (HECI)
+#include EFI_PROTOCOL_DEFINITION (PlatformMeHook)
+#include EFI_PROTOCOL_DEFINITION (MePlatformPolicy)
+
+//
+// Reset Request Origin Codes.
+//
+#define PEI_HECI_REQ_ORIGIN_BIOS_MEMORY_INIT 0x01
+#define PEI_HECI_REQ_ORIGIN_BIOS_POST 0x02
+#define PEI_HECI_REQ_ORIGIN_AMTBX_LAN_DISABLE 0x03
+
+//
+// End of Post Codes
+//
+#define HECI_EOP_STATUS_SUCCESS 0x0
+#define HECI_EOP_PERFORM_GLOBAL_RESET 0x1
+#define MAX_EOP_SEND_RETRIES 0x2
+
+//
+// IFR Update states
+//
+#define IFR_UPDATE_ENABLE 1
+#define IFR_UPDATE_DISABLE 0
+
+#define EFI_ME_FW_SKU_VARIABLE_GUID \
+ { \
+ 0xe1a21d94, 0x4a20, 0x4e0e, 0xae, 0x9, 0xa9, 0xa2, 0x1f, 0x24, 0xbb, 0x9e \
+ }
+
+//
+// Heci Bus Disable defines
+//
+#define HECI_BUS_DISABLE_OPCODE 0x0C
+#define HECI_BUS_DISABLE_ACK_OPCODE 0x8C
+#define ME_HECI_FIXED_ADDRESS 0x0
+
+//
+// Defines the HECI request buffer format for the ICC_MPHY_WRITE_SETTINGS_CMD.
+//
+typedef struct _ICC_MPHY_WRITE_SETTINGS_REQ
+{
+ ICC_HEADER Header; // Standard ICC HECI Header
+ UINT32 Reserved : 4; // Reserved for future use
+ UINT32 PostedWrite : 1; // 0-Response returned, 1-No Response returned
+ UINT32 Reserved2 : 23; // Reserved for future use
+}MPHY_WRITE_SETTINGS_REQ;
+
+typedef union _HBM_COMMAND {
+ UINT8 Data;
+ struct {
+ UINT8 Command : 7;
+ UINT8 IsResponse : 1;
+ } Fields;
+} HBM_COMMAND;
+
+typedef struct _HECI_BUS_DISABLE_CMD {
+ HBM_COMMAND Command;
+ UINT8 Reserved[3];
+} HECI_BUS_DISABLE_CMD;
+
+typedef struct _HECI_BUS_DISABLE_CMD_ACK {
+ HBM_COMMAND Command;
+ UINT8 Status;
+ UINT8 Reserved[2];
+} HECI_BUS_DISABLE_CMD_ACK;
+
+typedef struct {
+ UINT32 MeEnabled : 1; ///< [0] ME enabled/Disabled
+ UINT32 Reserved : 2; ///< [2:1] Reserved, must set to 0
+ UINT32 IntelAmtFw : 1; ///< [3] Intel AMT FW support
+ UINT32 IntelAmtFwStandard : 1; ///< [4] Intel AMT Standard FW support
+ UINT32 IntelSmallBusiness : 1; ///< [5] Intel Small Business Technology support
+ UINT32 Reserved1 : 7; ///< [12:6] Reserved
+ UINT32 AtSupported : 1; ///< [13] AT Support
+ UINT32 IntelKVM : 1; ///< [14] Intel KVM supported
+ UINT32 LocalWakeupTimer : 1; ///< [15] Local Wakeup Timer support
+ UINT32 Reserved2 : 16; ///< [31:16] Reserved, must set to 0
+ UINT32 MeMinorVer : 16; ///< [47:32] ME FW Minor Version.
+ UINT32 MeMajorVer : 16; ///< [63:48] ME FW Major Version.
+ UINT32 MeBuildNo : 16; ///< [79:64] ME FW Build Number.
+ UINT32 MeHotFixNo : 16; ///< [95:80] ME FW Hotfix Number
+} ME_CAP;
+
+#define MAX_ASSET_TABLE_ALLOCATED_SIZE 0x3000
+#define HECI_HWA_CLIENT_ID 11
+#define HWA_TABLE_PUSH_CMD 0
+
+#pragma pack(1)
+
+typedef enum _HWAI_TABLE_TYPE_INDEX
+{
+ HWAI_TABLE_TYPE_INDEX_FRU_DEVICE = 0,
+ HWAI_TABLE_TYPE_INDEX_MEDIA_DEVICE,
+ HWAI_TABLE_TYPE_INDEX_SMBIOS,
+ HWAI_TABLE_TYPE_INDEX_ASF,
+ HWAI_TABLE_TYPE_INDEX_MAX = 4,
+} HWAI_TABLE_TYPE_INDEX;
+
+typedef struct _SINGLE_TABLE_POSITION {
+ UINT16 Offset;
+ UINT16 Length;
+} SINGLE_TABLE_POSITION;
+
+typedef struct _TABLE_PUSH_DATA {
+ SINGLE_TABLE_POSITION Tables[HWAI_TABLE_TYPE_INDEX_MAX];
+ UINT8 TableData[1];
+} TABLE_PUSH_DATA;
+
+typedef union {
+ UINT32 Data;
+ struct {
+ UINT32 MessageLength : 16;
+ UINT32 Command : 4; ///< only supported command would be HWA_TABLE_PUSH=0;
+ UINT32 FRUTablePresent : 1;
+ UINT32 MediaTablePresent : 1;
+ UINT32 SMBIOSTablePresent : 1;
+ UINT32 ASFTablePresent : 1;
+ UINT32 Reserved : 8;
+ } Fields;
+} AU_MESSAGE_HEADER;
+
+typedef struct _AU_TABLE_PUSH_MSG {
+ AU_MESSAGE_HEADER Header;
+ TABLE_PUSH_DATA Data;
+} AU_TABLE_PUSH_MSG;
+
+typedef enum {
+ SEV_NO_ERROR = 0,
+ SEV_LOW_ERROR,
+ SEV_HIGH_ERROR,
+ SEV_CRITICAL_ERROR
+} MDES_SEVERITY_LEVEL;
+
+typedef enum {
+ EFI_STATUS_CODE = 1,
+ RAW_BUFFER,
+ ASCII_DATA,
+} MDES_BIOS_PAYLOAD_TYPE;
+
+#pragma pack()
+
+/**
+ Send the required system ChipsetInit Table to ME FW.
+
+ @param[in] ChipsetInitTable The required system ChipsetInit Table.
+ @param[in] ChipsetInitTableLen Length of the table in bytes
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+**/
+EFI_STATUS
+HeciChipsetInitSyncMsg (
+ IN UINT8 *ChipsetInitTable,
+ IN UINT32 ChipsetInitTableLen
+ )
+;
+
+/**
+ Send Core BIOS Reset Request Message through HECI to reset the system.
+
+ @param[in] ResetOrigin Reset source
+ @param[in] ResetType Global or Host reset
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+**/
+EFI_STATUS
+HeciSendCbmResetRequest (
+ IN UINT8 ResetOrigin,
+ IN UINT8 ResetType
+ )
+;
+
+/**
+ Send Hardware Asset Tables to Firmware
+
+ @param[in] Handle A handle for this module
+ @param[in] AssetTableData Hardware Asset Table Data
+ @param[in] TableDataSize Size of Asset table
+
+ @retval EFI_SUCCESS Table sent
+ @retval EFI_ABORTED Could not allocate Memory
+**/
+EFI_STATUS
+HeciAssetUpdateFwMsg (
+ IN EFI_HANDLE Handle,
+ IN TABLE_PUSH_DATA *AssetTableData,
+ IN UINT16 TableDataSize
+ )
+;
+
+/**
+ Send End of Post Request Message through HECI.
+
+ @param[in] Handle A handle for this module
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+**/
+EFI_STATUS
+HeciSendEndOfPostMessage (
+ IN EFI_HANDLE Handle
+ )
+;
+
+/**
+ Send Get Firmware SKU Request to ME
+
+ @param[in] MsgGenGetFwCapsSku Return message for Get Firmware Capability SKU
+ @param[in] MsgGenGetFwCapsSkuAck Return message for Get Firmware Capability SKU ACK
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+ @retval EFI_BUFFER_TOO_SMALL Message Buffer is too smallfor the Acknowledge
+**/
+EFI_STATUS
+HeciGetFwCapsSkuMsg (
+ IN OUT GEN_GET_FW_CAPSKU *MsgGenGetFwCapsSku,
+ IN OUT GEN_GET_FW_CAPS_SKU_ACK *MsgGenGetFwCapsSkuAck
+ )
+;
+
+/**
+ Send Get Firmware Version Request to ME
+
+ @param[in][out] MsgGenGetFwVersionAck Return themessage of FW version
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+ @retval EFI_BUFFER_TOO_SMALL Message Buffer is too smallfor the Acknowledge
+**/
+EFI_STATUS
+HeciGetFwVersionMsg (
+ IN OUT GEN_GET_FW_VER_ACK *MsgGenGetFwVersionAck
+ )
+;
+
+/**
+ Sends a message to ME to unlock a specified SPI Flash region for writing and receiving a response message.
+ It is recommended that HMRFPO_ENABLE MEI message needs to be sent after all OROMs finish their initialization.
+
+ @param[in] Nonce Nonce received in previous HMRFPO_ENABLE Response Message
+ @param[in] Result HMRFPO_ENABLE response
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+**/
+EFI_STATUS
+HeciHmrfpoEnable (
+ IN UINT64 Nonce,
+ OUT UINT8 *Result
+ )
+;
+
+/**
+ Sends a message to ME to lock a specified SPI Flash region for writing and receiving a response message.
+
+ @param[out] Nonce Random number generated by Ignition ME FW. When BIOS
+ want to unlock region it should use this value
+ in HMRFPO_ENABLE Request Message
+ @param[out] FactoryDefaultBase The base of the factory default calculated from the start of the ME region.
+ BIOS sets a Protected Range (PR) register "Protected Range Base" field with this value
+ + the base address of the region.
+ @param[out] FactoryDefaultLimit The length of the factory image.
+ BIOS sets a Protected Range (PR) register "Protected Range Limit" field with this value
+ @param[out] Result Status report
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+**/
+EFI_STATUS
+HeciHmrfpoLock (
+ OUT UINT64 *Nonce,
+ OUT UINT32 *FactoryDefaultBase,
+ OUT UINT32 *FactoryDefaultLimit,
+ OUT UINT8 *Result
+ )
+;
+
+/**
+ System BIOS sends this message to get status for HMRFPO_LOCK message.
+
+ @param[out] Result HMRFPO_GET_STATUS response
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+**/
+EFI_STATUS
+HeciHmrfpoGetStatus (
+ OUT UINT8 *Result
+ )
+;
+
+/**
+ This is used to send KVM request message to Intel ME. When
+ Bootoptions indicate that a KVM session is requested then BIOS
+ will send this message before any graphical display output to
+ ensure that FW is ready for KVM session.
+
+ @param[in] QueryType 0 - Query Request
+ 1 - Cancel Request
+ @param[out] ResponseCode 1h - Continue, KVM session established.
+ 2h - Continue, KVM session cancelled.
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+ @retval EFI_BUFFER_TOO_SMALL Message Buffer is too smallfor the Acknowledge
+**/
+EFI_STATUS
+HeciQueryKvmRequest (
+ IN UINT32 QueryType,
+ OUT UINT32 *ResponseCode
+ )
+;
+
+/**
+ This message is sent by the BIOS or IntelR MEBX prior to the End of Post (EOP) on the boot
+ where host wants to query the local firmware update interface status.
+
+ @param[out] RuleData 1 - local firmware update interface enable
+ 0 - local firmware update interface disable
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+ @retval EFI_BUFFER_TOO_SMALL Message Buffer is too smallfor the Acknowledge
+**/
+EFI_STATUS
+HeciGetLocalFwUpdate (
+ OUT UINT8 *RuleData
+ )
+;
+
+/**
+ This message is sent by the BIOS or IntelR MEBX prior to the End of Post (EOP) on the boot
+ where host wants to enable or disable the local firmware update interface.
+ The firmware allows a single update once it receives the enable command
+
+ @param[in] RuleData 1 - local firmware update interface enable
+ 0 - local firmware update interface disable
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+ @retval EFI_BUFFER_TOO_SMALL Message Buffer is too smallfor the Acknowledge
+**/
+EFI_STATUS
+HeciSetLocalFwUpdate (
+ IN UINT8 RuleData
+ )
+;
+
+/**
+ This message is sent by the BIOS or IntelR MEBX prior to the End of Post (EOP)
+ on the boot where host wants to enable the ME State. The firmware allows a single
+ update once it receives the enable command. Once firmware receives this message,
+ the firmware will be in normal mode after a global reset.
+
+ @param[in] None
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS ME enabled message sent
+**/
+EFI_STATUS
+HeciSetMeEnableMsg (
+ VOID
+ )
+;
+
+/**
+ This message is sent by the BIOS or IntelR MEBX prior to the End of Post (EOP)
+ on the boot where host wants to disable the ME State. The firmware allows a single
+ update once it receives the disable command Once firmware receives this message,
+ the firmware will work in "Soft Temporary Disable" mode (HFS[19:16] = 3) after a
+ global reset. Note, this message is not allowed when AT firmware is enrolled/configured.
+
+ @param[in] None
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS ME is disabled
+**/
+EFI_STATUS
+HeciSetMeDisableMsg (
+ VOID
+ )
+;
+
+/**
+ This message is sent by the BIOS or IntelR MEBX prior to the End of Post (EOP)
+ on the boot where host wants to get Ibex Peak platform type.
+ One of usages is to utilize this command to determine if the platform runs in
+ 1.5M or 5M size firmware.
+
+ @param[in] RuleData PlatformBrand,
+ IntelMeFwImageType,
+ SuperSku,
+ PlatformTargetMarketType,
+ PlatformTargetUsageType
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+ @retval EFI_BUFFER_TOO_SMALL Message Buffer is too smallfor the Acknowledge
+**/
+EFI_STATUS
+HeciGetPlatformTypeMsg (
+ OUT PLATFORM_TYPE_RULE_DATA *RuleData
+ )
+;
+
+/**
+ This message is sent by the BIOS on the boot where the host wants to get the firmware provisioning state.
+ The firmware will respond to AMT BIOS SYNCH INFO message even after the End of Post.
+
+ @param[out] RuleData Bit [2:0] Reserved
+ Bit [4:3] Provisioning State
+ 00 - Pre -provisioning
+ 01 - In -provisioning
+ 02 - Post !Vprovisioning
+ Bit [31:5] Reserved
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Firmware provisioning state returned
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+ @retval EFI_BUFFER_TOO_SMALL Message Buffer is too smallfor the Acknowledge
+**/
+EFI_STATUS
+HeciAmtBiosSynchInfo (
+ OUT UINT32 *RuleData
+ )
+;
+
+/**
+ The firmware will respond to GET OEM TAG message even after the End of Post (EOP).
+
+ @param[in] RuleData Default is zero. Tool can create the OEM specific OEM TAG data.
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+ @retval EFI_BUFFER_TOO_SMALL Message Buffer is too smallfor the Acknowledge
+**/
+EFI_STATUS
+HeciGetOemTagMsg (
+ OUT UINT32 *RuleData
+ )
+;
+
+/**
+ Enables/disables clocks. Used to turn off clocks in unused pci/pcie slots.
+ BIOS use this command when it enumerates PCI slots. When PCI slot is found unpopulated, the
+ BIOS can disable its clock through this MEI message. It is the BIOS requirement to know which
+ slot is controlled by which control bit.
+
+ @param[in] Enables each bit means corresponding clock should be turned on (1) or off (0)
+ @param[in] EnablesMask each bit means corresponding enable bit is valid (1) or should be ignored (0)
+ @param[in] ResponseMode 0 wait for response, 1 - skip
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_DEVICE_ERROR Wrong response
+ @retval EFI_NOT_READY ME is not ready
+ @retval EFI_INVALID_PARAMETER ResponseMode is invalid value
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+HeciSetIccClockEnables (
+ IN UINT32 Enables,
+ IN UINT32 EnablesMask,
+ IN UINT8 ResponseMode
+ )
+;
+
+/**
+ Sets or reads Lock mask on ICC registers.
+ @param[in] AccessMode 0 - set, 1 - get
+ @param[in] ResponseMode 0 - firmware will answer, 1 - firmware will not answer
+ @param[in][out] LockRegInfo bundle count info and mask of registers to become (for 'set' mode) or are
+ (for 'get' mode) locked. Each bit represents a register. 0=lock, 1=don't lock
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_INVALID_PARAMETER ResponseMode or pointer of Mask is invalid value
+ @retval EFI_DEVICE_ERROR Wrong response
+ @retval EFI_NOT_READY Heci device hasn't ready yet
+**/
+EFI_STATUS
+HeciLockIccRegisters (
+ IN UINT8 AccessMode,
+ IN UINT8 ResponseMode,
+ IN OUT ICC_LOCK_REGS_INFO *LockRegInfo
+ )
+;
+
+/**
+ retrieves the number of currently used ICC clock profile
+
+ @param[out] Profile number of current ICC clock profile
+
+ @exception EFI_UNSUPPORTED ICC clock profile doesn't support
+ @retval EFI_NOT_READY Heci device hasn't ready yet
+**/
+EFI_STATUS
+HeciGetIccProfile (
+ OUT UINT8 *Profile
+ )
+;
+
+/**
+ Sets ICC clock profile to be used on next and following boots
+
+ @param[in] Profile number of profile to be used
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_DEVICE_ERROR Wrong response
+ @retval EFI_NOT_READY Heci device hasn't ready yet
+**/
+EFI_STATUS
+HeciSetIccProfile (
+ IN UINT8 Profile
+ )
+;
+
+/**
+ Writes 1 dword of data to the icc register offset specified by RegOffset in the ICC Aux space
+ @param[in] RegOffset Register Offset in ICC Aux Space to write
+ @param[in] RegData Dword ICC register data to write
+ @param[in] ResponseMode 0 Wait for response, 1 - skip
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_DEVICE_ERROR Wrong response
+ @retval EFI_NOT_READY ME is not ready
+ @retval EFI_INVALID_PARAMETER ResponseMode is invalid value
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+EFIAPI
+HeciWriteIccRegDword (
+ IN UINT16 RegOffset,
+ IN UINT32 RegData,
+ IN UINT8 ResponseMode
+ )
+;
+/**
+ This message is used to turn on the Intel ME firmware MDES
+ capability, Intel SVT for PCH capability or both when the
+ system is in a post-manufactured state. Once firmware receives
+ this message, the firmware will enable selected platform debug
+ capabilities . The firmware will automatically disable all
+ platform debug capabilities if this message is not received
+ before receiving End Of Post.
+
+ @param[in] Data capabilities to be enabled
+ @param[out] Result 0x00 : Enable Success
+ Others : Enable Failure
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+ @retval EFI_BUFFER_TOO_SMALL Message Buffer is too smallfor the Acknowledge
+**/
+EFI_STATUS
+HeciPlatformDebugCapabilityMsg (
+ IN PLATFORM_DEBUG_CAP Data,
+ OUT UINT8 *Result
+ )
+;
+
+/**
+ It creates and sends Heci messages.
+
+ Remark:
+ Functionality is available only in release mode.
+ Using MDES in debug mode causes recursive calling of this function
+ because debug messages are sending from Heci->SendMsg function.
+
+ @param[in] CodeType Indicates the type of status code being reported.
+ @param[in] Value Describes the current status of a hardware or software entity.
+ This included information about the class and subclass that is
+ used to classify the entity as well as an operation.
+ @param[in] Instance The enumeration of a hardware or software entity within
+ the system. Valid instance numbers start with 1.
+ @param[in] CallerId This optional parameter may be used to identify the caller.
+ This parameter allows the status code driver to apply different
+ rules to different callers.
+ @param[in] Data This optional parameter may be used to pass additional data.
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Opcode evaluation success.
+ @retval Other Opcode evaluation failed.
+**/
+EFI_STATUS
+HeciSendMdesStatusCode (
+ IN EFI_STATUS_CODE_TYPE CodeType,
+ IN EFI_STATUS_CODE_VALUE Value,
+ IN UINT32 Instance,
+ IN EFI_GUID * CallerId OPTIONAL,
+ IN EFI_STATUS_CODE_DATA * Data OPTIONAL
+ )
+;
+
+/**
+ Provides an interface to call function to send HECI message.
+
+ @param[in] Flags Indicates the status of the BIOS MDES.
+ @param[in] BiosEventFilters Indicates the status of the BIOS event filter group.
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS HECI sent with success.
+**/
+EFI_STATUS
+HeciGetMdesConfig (
+ OUT MDES_BIOS_FLAGS *Flags,
+ OUT UINT32 *BiosEventFilters
+ )
+;
+
+
+/**
+ Sends the MKHI Enable/Disable manageability message.
+ The message will only work if bit 2 in the bitmasks is toggled.
+ To enable manageability:
+ EnableState = 0x00000004, and
+ DisableState = 0x00000000.
+ To disable manageability:
+ EnableState = 0x00000000, and
+ DisableState = 0x00000004
+
+ @param[in] EnableState Enable Bit Mask
+ @param[in] DisableState Disable Bit Mask
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+ @retval EFI_BUFFER_TOO_SMALL Message Buffer is too smallfor the Acknowledge
+**/
+EFI_STATUS
+HeciFwFeatureStateOverride (
+ IN UINT32 EnableState,
+ IN UINT32 DisableState
+ )
+;
+
+/**
+ The Get FW Feature Status message is based on MKHI interface.
+ This command is used by BIOS/IntelR MEBX to get firmware runtime status.
+ The GET FW RUNTIME STATUS message doesn't need to check the HFS.
+ FWInitComplete value before sending the command.
+ It means this message can be sent regardless of HFS.FWInitComplete.
+
+ @param[out] RuleData MEFWCAPS_SKU message
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+**/
+EFI_STATUS
+HeciGetFwFeatureStateMsg (
+ OUT MEFWCAPS_SKU *RuleData
+ )
+;
+
+/**
+ This message is sent by the BIOS when it wants to query
+ the independent firmware recovery (IFR).
+
+ @param[in] RuleData 1 - local firmware update interface enable
+
+ 0 - local firmware update interface disable
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+ @retval EFI_BUFFER_TOO_SMALL Message Buffer is too smallfor the Acknowledge
+**/
+EFI_STATUS
+HeciGetIfrUpdate (
+ OUT UINT8 *RuleData
+ )
+;
+
+/**
+ This message is sent by the BIOS when it wants to set
+ the independent firmware recovery (IFR) state.
+
+ @param[in] RuleData 1 - local firmware update interface enable
+ 0 - local firmware update interface disable
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+ @retval EFI_BUFFER_TOO_SMALL Message Buffer is too smallfor the Acknowledge
+**/
+EFI_STATUS
+HeciSetIfrUpdate (
+ IN UINT8 RuleData
+ )
+;
+
+/**
+ This message is sent by the BIOS if EOP-ACK not received to force ME to disable
+ HECI interfaces.
+
+ @param[in] None
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS HECI interfaces disabled by ME
+**/
+EFI_STATUS
+HeciDisableHeciBusMsg (
+ VOID
+ )
+;
+
+/**
+ This message is sent by the BIOS to inform ME FW whether or not to take the
+ TPM 1.2 Deactivate flow
+
+ @param[in] UINT8 TpmDeactivate 0 - ME FW should not take the
+ deactivate flow.
+ 1 - ME FW should take the deactivate
+ flow.
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS HECI interfaces disabled by ME
+**/
+EFI_STATUS
+HeciSendTpmData (
+ IN UINT8 TpmDeactivate
+ )
+;
+
+#endif
diff --git a/ReferenceCode/ME/Library/MeKernel/Dxe/MbpDebugDumpDxe.c b/ReferenceCode/ME/Library/MeKernel/Dxe/MbpDebugDumpDxe.c
new file mode 100644
index 0000000..b7cc842
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeKernel/Dxe/MbpDebugDumpDxe.c
@@ -0,0 +1,150 @@
+/** @file
+ Dump whole DXE_MBP_DATA_PROTOCOL and serial out.
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include EFI_PROTOCOL_CONSUMER (MeBiosPayloadData)
+#endif
+
+/**
+ Dump DXE_MBP_DATA_PROTOCOL
+
+ @param[in] MbpData Pointer to DXE_MBP_DATA_PROTOCOL
+
+ @retval None
+**/
+VOID
+DxeMbpDebugDump (
+ IN DXE_MBP_DATA_PROTOCOL *MbpPtr
+ )
+{
+ UINTN i;
+
+ if (MbpPtr == NULL) {
+ return;
+ }
+ DEBUG ((EFI_D_INFO, "\n------------------------ MeBiosPayload Data Protocol Dump Begin -----------------\n"));
+ DEBUG ((EFI_D_INFO, " Revision : 0x%x\n", MbpPtr->Revision));
+ DEBUG ((EFI_D_INFO, "MeBiosPayload FwVersionName ---\n"));
+ DEBUG ((EFI_D_INFO, " ME FW MajorVersion : 0x%x\n", MbpPtr->MeBiosPayload.FwVersionName.MajorVersion));
+ DEBUG ((EFI_D_INFO, " ME FW MinorVersion : 0x%x\n", MbpPtr->MeBiosPayload.FwVersionName.MinorVersion));
+ DEBUG ((EFI_D_INFO, " ME FW HotfixVersion : 0x%x\n", MbpPtr->MeBiosPayload.FwVersionName.HotfixVersion));
+ DEBUG ((EFI_D_INFO, " ME FW BuildVersion : 0x%x\n", MbpPtr->MeBiosPayload.FwVersionName.BuildVersion));
+
+ if (MbpPtr->MeBiosPayload.FwCapsSku.Available == TRUE) {
+ DEBUG ((EFI_D_INFO, "MeBiosPayload FwCapabilities ---\n"));
+ DEBUG ((EFI_D_INFO, " FullNet : 0x%x\n", MbpPtr->MeBiosPayload.FwCapsSku.FwCapabilities.Fields.FullNet));
+ DEBUG ((EFI_D_INFO, " StdNet : 0x%x\n", MbpPtr->MeBiosPayload.FwCapsSku.FwCapabilities.Fields.StdNet));
+ DEBUG ((EFI_D_INFO, " Manageability : 0x%x\n", MbpPtr->MeBiosPayload.FwCapsSku.FwCapabilities.Fields.Manageability));
+ DEBUG ((EFI_D_INFO, " SmallBusiness : 0x%x\n", MbpPtr->MeBiosPayload.FwCapsSku.FwCapabilities.Fields.SmallBusiness));
+ DEBUG ((EFI_D_INFO, " IntelAT : 0x%x\n", MbpPtr->MeBiosPayload.FwCapsSku.FwCapabilities.Fields.IntelAT));
+ DEBUG ((EFI_D_INFO, " IntelCLS : 0x%x\n", MbpPtr->MeBiosPayload.FwCapsSku.FwCapabilities.Fields.IntelCLS));
+ DEBUG ((EFI_D_INFO, " IntelMPC : 0x%x\n", MbpPtr->MeBiosPayload.FwCapsSku.FwCapabilities.Fields.IntelMPC));
+ DEBUG ((EFI_D_INFO, " IccOverClocking : 0x%x\n", MbpPtr->MeBiosPayload.FwCapsSku.FwCapabilities.Fields.IccOverClocking));
+ DEBUG ((EFI_D_INFO, " PAVP : 0x%x\n", MbpPtr->MeBiosPayload.FwCapsSku.FwCapabilities.Fields.PAVP));
+ DEBUG ((EFI_D_INFO, " IPV6 : 0x%x\n", MbpPtr->MeBiosPayload.FwCapsSku.FwCapabilities.Fields.IPV6));
+ DEBUG ((EFI_D_INFO, " KVM : 0x%x\n", MbpPtr->MeBiosPayload.FwCapsSku.FwCapabilities.Fields.KVM));
+ DEBUG ((EFI_D_INFO, " OCH : 0x%x\n", MbpPtr->MeBiosPayload.FwCapsSku.FwCapabilities.Fields.OCH));
+ DEBUG ((EFI_D_INFO, " VLAN : 0x%x\n", MbpPtr->MeBiosPayload.FwCapsSku.FwCapabilities.Fields.VLAN));
+ DEBUG ((EFI_D_INFO, " TLS : 0x%x\n", MbpPtr->MeBiosPayload.FwCapsSku.FwCapabilities.Fields.TLS));
+ DEBUG ((EFI_D_INFO, " WLAN : 0x%x\n", MbpPtr->MeBiosPayload.FwCapsSku.FwCapabilities.Fields.WLAN));
+ DEBUG ((EFI_D_INFO, " NFC : 0x%x\n", MbpPtr->MeBiosPayload.FwCapsSku.FwCapabilities.Fields.NFC));
+ }
+
+ if (MbpPtr->MeBiosPayload.FwFeaturesState.Available == TRUE) {
+ DEBUG ((EFI_D_INFO, "MeBiosPayload FwFeaturesState ---\n"));
+ DEBUG ((EFI_D_INFO, " FullNet : 0x%x\n", MbpPtr->MeBiosPayload.FwFeaturesState.FwFeatures.Fields.FullNet));
+ DEBUG ((EFI_D_INFO, " StdNet : 0x%x\n", MbpPtr->MeBiosPayload.FwFeaturesState.FwFeatures.Fields.StdNet));
+ DEBUG ((EFI_D_INFO, " Manageability : 0x%x\n", MbpPtr->MeBiosPayload.FwFeaturesState.FwFeatures.Fields.Manageability));
+ DEBUG ((EFI_D_INFO, " SmallBusiness : 0x%x\n", MbpPtr->MeBiosPayload.FwFeaturesState.FwFeatures.Fields.SmallBusiness));
+ DEBUG ((EFI_D_INFO, " IntelAT : 0x%x\n", MbpPtr->MeBiosPayload.FwFeaturesState.FwFeatures.Fields.IntelAT));
+ DEBUG ((EFI_D_INFO, " IntelCLS : 0x%x\n", MbpPtr->MeBiosPayload.FwFeaturesState.FwFeatures.Fields.IntelCLS));
+ DEBUG ((EFI_D_INFO, " IntelMPC : 0x%x\n", MbpPtr->MeBiosPayload.FwFeaturesState.FwFeatures.Fields.IntelMPC));
+ DEBUG ((EFI_D_INFO, " IccOverClocking : 0x%x\n", MbpPtr->MeBiosPayload.FwFeaturesState.FwFeatures.Fields.IccOverClocking));
+ DEBUG ((EFI_D_INFO, " PAVP : 0x%x\n", MbpPtr->MeBiosPayload.FwFeaturesState.FwFeatures.Fields.PAVP));
+ DEBUG ((EFI_D_INFO, " IPV6 : 0x%x\n", MbpPtr->MeBiosPayload.FwFeaturesState.FwFeatures.Fields.IPV6));
+ DEBUG ((EFI_D_INFO, " KVM : 0x%x\n", MbpPtr->MeBiosPayload.FwFeaturesState.FwFeatures.Fields.KVM));
+ DEBUG ((EFI_D_INFO, " OCH : 0x%x\n", MbpPtr->MeBiosPayload.FwFeaturesState.FwFeatures.Fields.OCH));
+ DEBUG ((EFI_D_INFO, " VLAN : 0x%x\n", MbpPtr->MeBiosPayload.FwFeaturesState.FwFeatures.Fields.VLAN));
+ DEBUG ((EFI_D_INFO, " TLS : 0x%x\n", MbpPtr->MeBiosPayload.FwFeaturesState.FwFeatures.Fields.TLS));
+ DEBUG ((EFI_D_INFO, " WLAN : 0x%x\n", MbpPtr->MeBiosPayload.FwFeaturesState.FwFeatures.Fields.WLAN));
+ DEBUG ((EFI_D_INFO, " NFC : 0x%x\n", MbpPtr->MeBiosPayload.FwFeaturesState.FwFeatures.Fields.NFC));
+ }
+
+ DEBUG ((EFI_D_INFO, "MeBiosPayload RomBistData ---\n"));
+ DEBUG ((EFI_D_INFO, " DeviceId : 0x%x\n", MbpPtr->MeBiosPayload.RomBistData.DeviceId));
+ DEBUG ((EFI_D_INFO, " FuseTestFlags : 0x%x\n", MbpPtr->MeBiosPayload.RomBistData.FuseTestFlags));
+ for (i = 0; i < 4; i++) {
+ DEBUG ((EFI_D_INFO, " UMCHID[0x%x] : 0x%x \n", i, MbpPtr->MeBiosPayload.RomBistData.UMCHID[i]));
+ }
+
+ DEBUG ((EFI_D_INFO, "MeBiosPayload Platform Key ---\n"));
+ for (i = 0; i < 8; i++) {
+ DEBUG ((EFI_D_INFO, " Key[0x%x] : 0x%x \n", i, MbpPtr->MeBiosPayload.PlatformKey.Key[i]));
+ }
+
+ if (MbpPtr->MeBiosPayload.FwPlatType.Available == TRUE) {
+ DEBUG ((EFI_D_INFO, "MeBiosPayload ME Platform TYpe ---\n"));
+ DEBUG ((EFI_D_INFO, " PlatformTargetUsageType : 0x%x\n", MbpPtr->MeBiosPayload.FwPlatType.RuleData.Fields.PlatformTargetUsageType));
+ DEBUG ((EFI_D_INFO, " PlatformTargetMarketType : 0x%x\n", MbpPtr->MeBiosPayload.FwPlatType.RuleData.Fields.PlatformTargetMarketType));
+ DEBUG ((EFI_D_INFO, " SuperSku : 0x%x\n", MbpPtr->MeBiosPayload.FwPlatType.RuleData.Fields.SuperSku));
+ DEBUG ((EFI_D_INFO, " IntelMeFwImageType : 0x%x\n", MbpPtr->MeBiosPayload.FwPlatType.RuleData.Fields.IntelMeFwImageType));
+ DEBUG ((EFI_D_INFO, " PlatformBrand : 0x%x\n", MbpPtr->MeBiosPayload.FwPlatType.RuleData.Fields.PlatformBrand));
+ }
+
+ DEBUG ((EFI_D_INFO, "MeBiosPayload IccProfile ---\n"));
+ DEBUG ((EFI_D_INFO, " NumIccProfiles : 0x%x\n", MbpPtr->MeBiosPayload.IccProfile.NumIccProfiles));
+ DEBUG ((EFI_D_INFO, " IccProfileSoftStrap : 0x%x\n", MbpPtr->MeBiosPayload.IccProfile.IccProfileSoftStrap));
+ DEBUG ((EFI_D_INFO, " IccProfileIndex : 0x%x\n", MbpPtr->MeBiosPayload.IccProfile.IccProfileIndex));
+ DEBUG ((EFI_D_INFO, " RegBundles : 0x%x\n", MbpPtr->MeBiosPayload.IccProfile.IccLockRegInfo.RegBundles));
+ for (i = 0; i < MbpPtr->MeBiosPayload.IccProfile.IccLockRegInfo.RegBundles.BundlesCnt; i++) {
+ DEBUG ((EFI_D_INFO, " RegMask[0x%x] : 0x%x\n", i, MbpPtr->MeBiosPayload.IccProfile.IccLockRegInfo.RegMask[i]));
+ }
+
+ DEBUG ((EFI_D_INFO, "MeBiosPayload AtState ---\n"));
+ DEBUG ((EFI_D_INFO, " State : 0x%x\n", MbpPtr->MeBiosPayload.AtState.State));
+ DEBUG ((EFI_D_INFO, " LastTheftTrigger : 0x%x\n", MbpPtr->MeBiosPayload.AtState.LastTheftTrigger));
+ DEBUG ((EFI_D_INFO, " LockState : 0x%x\n", MbpPtr->MeBiosPayload.AtState.flags.LockState));
+ DEBUG ((EFI_D_INFO, " AuthenticateModule : 0x%x\n", MbpPtr->MeBiosPayload.AtState.flags.AuthenticateModule));
+ DEBUG ((EFI_D_INFO, " S3Authentication : 0x%x\n", MbpPtr->MeBiosPayload.AtState.flags.S3Authentication));
+ DEBUG ((EFI_D_INFO, " FlashWearOut : 0x%x\n", MbpPtr->MeBiosPayload.AtState.flags.FlashWearOut));
+ DEBUG ((EFI_D_INFO, " FlashVariableSecurity : 0x%x\n", MbpPtr->MeBiosPayload.AtState.flags.FlashVariableSecurity));
+
+ DEBUG ((EFI_D_INFO, "MeBiosPayload MFSIntegrity: 0x%x\n", MbpPtr->MeBiosPayload.MFSIntegrity));
+
+ if (MbpPtr->MeBiosPayload.HwaRequest.Available == TRUE) {
+ DEBUG ((EFI_D_INFO, "MeBiosPayload HwaRequest ---\n"));
+ DEBUG ((EFI_D_INFO, " MediaTablePush : 0x%x\n", MbpPtr->MeBiosPayload.HwaRequest.Data.Fields.MediaTablePush));
+ }
+
+ if (MbpPtr->MeBiosPayload.NfcSupport.Available == TRUE) {
+ DEBUG ((EFI_D_INFO, "MeBiosPayload NFC ---\n"));
+ DEBUG ((EFI_D_INFO, " DeviceType : 0x%x\n", MbpPtr->MeBiosPayload.NfcSupport.NfcData.DeviceType));
+ DEBUG ((EFI_D_INFO, " Hide : 0x%x\n", MbpPtr->MeBiosPayload.NfcSupport.NfcData.Hide));
+ }
+
+ DEBUG ((EFI_D_INFO, "\n------------------------ MeBiosPayload Data Protocol Dump End -------------------\n"));
+}
+
diff --git a/ReferenceCode/ME/Library/MeKernel/Dxe/MeLib.c b/ReferenceCode/ME/Library/MeKernel/Dxe/MeLib.c
new file mode 100644
index 0000000..b0df6c6
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeKernel/Dxe/MeLib.c
@@ -0,0 +1,712 @@
+/** @file
+ This is a library to get Intel ME information
+
+@copyright
+ Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "MeLib.h"
+#include "MeAccess.h"
+#endif
+
+/**
+ Check if Me is enabled
+
+ @param[in] None.
+
+ @retval None
+**/
+EFI_STATUS
+MeLibInit (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+
+ Status = EFI_SUCCESS;
+
+ return Status;
+}
+
+/**
+ Send Get Firmware SKU Request to ME
+
+ @param[in] FwCapsSku Return Data from Get Firmware Capabilities MKHI Request
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+HeciGetFwCapsSku (
+ MEFWCAPS_SKU *FwCapsSku
+ )
+{
+ EFI_STATUS Status;
+ GEN_GET_FW_CAPSKU MsgGenGetFwCapsSku;
+ GEN_GET_FW_CAPS_SKU_ACK MsgGenGetFwCapsSkuAck;
+
+ Status = HeciGetFwCapsSkuMsg (&MsgGenGetFwCapsSku, &MsgGenGetFwCapsSkuAck);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ if (((MsgGenGetFwCapsSkuAck.MKHIHeader.Fields.Command) == FWCAPS_GET_RULE_CMD) &&
+ ((MsgGenGetFwCapsSkuAck.MKHIHeader.Fields.IsResponse) == 1) &&
+ (MsgGenGetFwCapsSkuAck.MKHIHeader.Fields.Result == 0)
+ ) {
+ *FwCapsSku = MsgGenGetFwCapsSkuAck.Data.FWCapSku;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This message is sent by the BIOS or IntelR MEBX prior to the End of Post (EOP)
+ on the boot where host wants to get Ibex Peak platform type.
+ One of usages is to utilize this command to determine if the platform runs in
+ 4M or 8M size firmware.
+
+ @param[in] RuleData PlatformBrand,
+ IntelMeFwImageType,
+ SuperSku,
+ PlatformTargetMarketType,
+ PlatformTargetUsageType
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+HeciGetPlatformType (
+ OUT PLATFORM_TYPE_RULE_DATA *RuleData
+ )
+{
+ EFI_STATUS Status;
+
+ Status = HeciGetPlatformTypeMsg (RuleData);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ return EFI_SUCCESS;
+}
+
+VOID
+MbpGiveUp (
+ IN VOID
+ )
+{
+ UINT32 HECI_BASE_ADDRESS;
+ HECI_HOST_CONTROL_REGISTER HeciRegHCsr;
+ VOLATILE HECI_HOST_CONTROL_REGISTER *HeciRegHCsrPtr;
+
+ HECI_BASE_ADDRESS = PciRead32 (PCI_LIB_ADDRESS (ME_BUS, ME_DEVICE_NUMBER, HECI_FUNCTION_NUMBER, R_HECIMBAR)) & 0xFFFFFFF0;
+ HeciRegHCsrPtr = (VOID *) (UINTN) (HECI_BASE_ADDRESS + H_CSR);
+
+ //
+ // Set MBP_GIVE_UP bit
+ //
+ HeciPciOr32(R_ME_H_GS2, B_ME_MBP_GIVE_UP);
+
+ //
+ // Set H_RST and H_IG bits to reset HECI
+ //
+ HeciRegHCsr.ul = HeciRegHCsrPtr->ul;
+ HeciRegHCsr.r.H_RST = 1;
+ HeciRegHCsr.r.H_IG = 1;
+ HeciRegHCsrPtr->ul = HeciRegHCsr.ul;
+}
+
+/**
+ Routine checks whether MBP buffer has been cleared form HECI buffer or not.
+ BIOS must check this before executing any 3rd paty code or Oprom
+
+ @param[in] Event The event that triggered this notification function
+ @param[in] Context Pointer to the notification functions context
+**/
+VOID
+EFIAPI
+MbpCleared (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ EFI_STATUS Status;
+ HECI_GS_SHDW_REGISTER MeFwsts2;
+ DXE_MBP_DATA_PROTOCOL *MbpData;
+ HECI_FWS_REGISTER MeFirmwareStatus;
+ UINT32 Timeout;
+
+ gBS->CloseEvent (Event);
+
+ Status = gBS->LocateProtocol (&gMeBiosPayloadDataProtocolGuid, NULL, (VOID **) &MbpData);
+ if (!EFI_ERROR (Status)) {
+ //
+ // UnInstall the MBP protocol
+ //
+ Status = gBS->UninstallMultipleProtocolInterfaces (
+ MbpData->Handle,
+ &gMeBiosPayloadDataProtocolGuid,
+ MbpData,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "Unable to Uninstall Mbp protocol and Status is %r\n", Status));
+ }
+ }
+
+ //
+ // Check for MEI1 PCI device availability
+ //
+ if (HeciPciRead32 (R_VENDORID) == 0xFFFFFFFF) {
+ DEBUG ((EFI_D_ERROR, "MEI1 PCI device does not exist\n"));
+ return;
+ }
+
+ //
+ // BIOS polls on FWSTS.MbpCleared until it is set or 1s timeout reached
+ //
+ Timeout = 0;
+
+ do {
+ MeFwsts2.ul = HeciPciRead32 (R_ME_GS_SHDW);
+
+ if (MeFwsts2.r.MbpCleared) {
+ break;
+ }
+
+ gBS->Stall (FIVE_MS_TIMEOUT);
+ Timeout += FIVE_MS_TIMEOUT;
+ } while (Timeout <= HECI_MBP_CLR_TIMEOUT);
+
+ DEBUG ((EFI_D_ERROR, "MbpCleared = %x\n", MeFwsts2.r.MbpCleared));
+
+ if (!MeFwsts2.r.MbpCleared) {
+ MbpGiveUp();
+ }
+
+ MeFirmwareStatus.ul = HeciPciRead32 (R_FWSTATE);
+ if (MeFirmwareStatus.r.ErrorCode == ME_ERROR_CODE_UNKNOWN || MeFirmwareStatus.r.ErrorCode == ME_ERROR_CODE_IMAGE_FAILURE) {
+ DisableAllMEDevices ();
+ }
+
+ return;
+}
+
+/**
+ Calculate if the circular buffer has overflowed.
+ Corresponds to HECI HPS (part of) section 4.2.1
+
+ @param[in] ReadPointer Location of the read pointer.
+ @param[in] WritePointer Location of the write pointer.
+
+ @retval UINT8 Number of filled slots.
+**/
+UINT8
+FilledSlots2 (
+ IN UINT32 ReadPointer,
+ IN UINT32 WritePointer
+ )
+{
+ UINT8 FilledSlots;
+
+ ///
+ /// Calculation documented in HECI HPS 0.68 section 4.2.1
+ ///
+ FilledSlots = (((INT8) WritePointer) - ((INT8) ReadPointer));
+
+ return FilledSlots;
+}
+
+/**
+ This routine returns ME-BIOS Payload information.
+
+ @param[out] MbpPtr ME-BIOS Payload information.
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_DEVICE_ERROR Failed to consume MBP
+**/
+EFI_STATUS
+PrepareMeBiosPayload (
+ OUT ME_BIOS_PAYLOAD *MbpPtr
+ )
+{
+ EFI_STATUS Status;
+ UINT32 *Ptr;
+ UINT32 MbpItemId;
+ UINT32 MbpItemSize;
+ UINT32 i;
+ UINT32 Index;
+ UINT32 Timeout;
+ UINT8 MbpReadAttempts;
+ MBP_HEADER MbpHeader;
+ MBP_ITEM_HEADER MbpItemHeader;
+ VOID *Registration;
+ EFI_EVENT Event;
+
+ HECI_GS_SHDW_REGISTER MeFwsts2;
+ UINT32 HECI_BASE_ADDRESS;
+ HECI_ME_CONTROL_REGISTER HeciRegMeCsrHa;
+ HECI_HOST_CONTROL_REGISTER HeciRegHCsr;
+ VOLATILE HECI_HOST_CONTROL_REGISTER *HeciRegHCsrPtr;
+ VOLATILE HECI_ME_CONTROL_REGISTER *HeciRegMeCsrHaPtr;
+ VOLATILE UINT32 *HeciRegMeCbrwPtr;
+ VOID *DestPtr;
+ UINTN DestSize;
+ BOOLEAN MbpReadError;
+
+ Ptr = NULL;
+ Status = EFI_SUCCESS;
+
+ //
+ // Initialize memory mapped register pointers
+ //
+ HECI_BASE_ADDRESS = PciRead32 (PCI_LIB_ADDRESS (ME_BUS, ME_DEVICE_NUMBER, HECI_FUNCTION_NUMBER, R_HECIMBAR)) & 0xFFFFFFF0;
+ HeciRegHCsrPtr = (VOID *) (UINTN) (HECI_BASE_ADDRESS + H_CSR);
+ HeciRegMeCsrHaPtr = (VOID *) (UINTN) (HECI_BASE_ADDRESS + ME_CSR_HA);
+ HeciRegMeCbrwPtr = (VOID *) (UINTN) (HECI_BASE_ADDRESS + ME_CB_RW);
+
+ MeFwsts2.ul = HeciPciRead32 (R_ME_GS_SHDW);
+
+ for (MbpReadAttempts = 0; MbpReadAttempts <= HECI_MBP_READ_MAX_RETRIES; MbpReadAttempts++) {
+
+ DEBUG ((EFI_D_INFO, "MbpPresent = %x\n", MeFwsts2.r.MbpRdy));
+
+ if (MeFwsts2.r.MbpRdy) {
+
+ MbpReadError = FALSE;
+ HeciRegMeCsrHa.ul = HeciRegMeCsrHaPtr->ul;
+
+ if (FilledSlots2 (HeciRegMeCsrHa.r.ME_CBRP_HRA, HeciRegMeCsrHa.r.ME_CBWP_HRA) == 0) {
+ //
+ // Exit if the circular buffer is empty
+ //
+ DEBUG ((EFI_D_ERROR, "MBP is present but circular buffer is empty, exit.\n"));
+ MbpReadError = TRUE;
+ } else {
+
+ MbpHeader.Data = *HeciRegMeCbrwPtr;
+
+ DEBUG ((EFI_D_INFO, "MBP header: %x\n", MbpHeader.Data));
+ DEBUG ((EFI_D_INFO, "MbpSize: %x\n", MbpHeader.Fields.MbpSize));
+ DEBUG ((EFI_D_INFO, "No. of Mbp Entries: %x\n", MbpHeader.Fields.NumEntries));
+
+ MbpPtr->FwCapsSku.Available = FALSE;
+ MbpPtr->FwPlatType.Available = FALSE;
+ MbpPtr->HwaRequest.Available = FALSE;
+ MbpPtr->PlatBootPerfData.Available = FALSE;
+ MbpPtr->HwaRequest.Data.Fields.MediaTablePush = FALSE;
+ MbpPtr->NfcSupport.Available = FALSE;
+
+ for (i = 0; i < MbpHeader.Fields.NumEntries; i++) {
+ //
+ // If MBP Data Item is available but, RD and WR pointer are same, it indicates an error
+ // ME FW indication of number of MBP entries and size are wrong
+ //
+ HeciRegMeCsrHa.ul = HeciRegMeCsrHaPtr->ul;
+ if (FilledSlots2 (HeciRegMeCsrHa.r.ME_CBRP_HRA, HeciRegMeCsrHa.r.ME_CBWP_HRA) == 0) {
+ //
+ // Exit if the circular buffer is empty
+ //
+ DEBUG ((EFI_D_ERROR, "MBP Item is present but circular buffer is empty, exit.\n"));
+ MbpReadError = TRUE;
+ break;
+ }
+ //
+ // Consume MBP Item Header
+ //
+ MbpItemHeader.Data = *HeciRegMeCbrwPtr;
+ DEBUG ((EFI_D_INFO, "MBP Item %x header: %x\n", i + 1, MbpItemHeader.Data));
+
+ MbpItemId = (MbpItemHeader.Fields.AppId << 4) | MbpItemHeader.Fields.ItemId;
+ //
+ // Copy data from HECI buffer per size of each MBP item
+ //
+ MbpItemSize = MbpItemHeader.Fields.Length - 1;
+ Ptr = AllocateZeroPool ((MbpItemSize) * 4);
+ ASSERT (Ptr);
+ if (Ptr == NULL) {
+ goto MbpGiveup;
+ }
+
+ for (Index = 0; Index < MbpItemSize; Index++) {
+ Ptr[Index] = *HeciRegMeCbrwPtr;
+ DEBUG ((EFI_D_INFO, "MBP Item Data: %x\n", Ptr[Index]));
+ }
+
+ switch (MbpItemId) {
+ case 0x11:
+ //
+ // FW Version Name
+ //
+ DestSize = sizeof (MbpPtr->FwVersionName);
+ DestPtr = &MbpPtr->FwVersionName;
+ break;
+
+ case 0x12:
+ //
+ // FW Capabilities
+ //
+ DestSize = sizeof (MbpPtr->FwCapsSku.FwCapabilities);
+ DestPtr = &MbpPtr->FwCapsSku.FwCapabilities;
+ MbpPtr->FwCapsSku.Available = TRUE;
+ break;
+
+ case 0x13:
+ //
+ // ROM BIST Data
+ //
+ DestSize = sizeof (MbpPtr->RomBistData);
+ DestPtr = &MbpPtr->RomBistData;
+ break;
+
+ case 0x14:
+ //
+ // Platform Key
+ //
+ DestSize = sizeof (MbpPtr->PlatformKey);
+ DestPtr = &MbpPtr->PlatformKey;
+ break;
+
+ case 0x15:
+ //
+ // ME Platform TYpe
+ //
+ DestSize = sizeof (MbpPtr->FwPlatType.RuleData);
+ DestPtr = &MbpPtr->FwPlatType.RuleData;
+ MbpPtr->FwPlatType.Available = TRUE;
+ break;
+
+ case 0x16:
+ //
+ // ME MFS status
+ //
+ DestSize = sizeof (MbpPtr->MFSIntegrity);
+ DestPtr = &MbpPtr->MFSIntegrity;
+ break;
+
+ case 0x17:
+ ///
+ /// Platform timing information
+ ///
+ DestSize = sizeof (MbpPtr->PlatBootPerfData.MbpPerfData);
+ DestPtr = &MbpPtr->PlatBootPerfData.MbpPerfData;
+ MbpPtr->PlatBootPerfData.Available = TRUE;
+ break;
+
+ case 0x19:
+ //
+ // FW Features State
+ //
+ DestSize = sizeof (MbpPtr->FwFeaturesState.FwFeatures);
+ DestPtr = &MbpPtr->FwFeaturesState.FwFeatures;
+ MbpPtr->FwFeaturesState.Available = TRUE;
+ break;
+
+ case 0x31:
+ //
+ // AT State
+ //
+ DestSize = sizeof (MbpPtr->AtState);
+ DestPtr = &MbpPtr->AtState;
+ break;
+
+ case 0x41:
+ //
+ // HWA Request
+ //
+ DestSize = sizeof (MbpPtr->HwaRequest.Data);
+ DestPtr = &MbpPtr->HwaRequest.Data;
+ MbpPtr->HwaRequest.Available = TRUE;
+ break;
+
+ case 0x51:
+ //
+ // ICC Profile
+ //
+ DestSize = sizeof (MbpPtr->IccProfile);
+ DestPtr = &MbpPtr->IccProfile;
+ break;
+
+ case 0x61:
+ //
+ // NFC Data
+ //
+ DestSize = sizeof (MbpPtr->NfcSupport.NfcData);
+ DestPtr = &MbpPtr->NfcSupport.NfcData;
+ MbpPtr->NfcSupport.Available = TRUE;
+ break;
+
+ default:
+ //
+ // default case
+ //
+ DestSize = 0;
+ DestPtr = NULL;
+ break;
+ }
+ if (DestPtr != NULL) {
+ if ((MbpItemSize * 4) <= DestSize) {
+ CopyMem (DestPtr, Ptr, (MbpItemSize * 4));
+ } else {
+ DEBUG ((EFI_D_INFO, "Data size is larger than destination buffer. This item is not copied.\n"));
+ }
+ //
+ // Clear buffer
+ //
+ ZeroMem (Ptr, MbpItemSize * 4);
+ FreePool (Ptr);
+ }
+ }
+
+ //
+ // Check if after consuming MBP R/W counters are ok:
+ // ME_CBRP_HRA == ME_CBWP_HRA != 0
+ //
+ HeciRegMeCsrHa.ul = HeciRegMeCsrHaPtr->ul;
+
+ if (FilledSlots2 (HeciRegMeCsrHa.r.ME_CBRP_HRA, HeciRegMeCsrHa.r.ME_CBWP_HRA) != 0
+ || HeciRegMeCsrHa.r.ME_CBWP_HRA == 0) {
+ DEBUG ((EFI_D_INFO, "R/W pointers mismatch after MBP consume: ME_CBRP_HRA = %x, ME_CBWP_HRA = %x\n",
+ HeciRegMeCsrHa.r.ME_CBRP_HRA, HeciRegMeCsrHa.r.ME_CBWP_HRA));
+ MbpReadError = TRUE;
+ }
+
+ if (!MbpReadError) {
+ //
+ // Interrupt ME FW so FW can clear HECI buffer after MBP is consumed
+ //
+ HeciRegHCsr.ul = HeciRegHCsrPtr->ul;
+ HeciRegHCsr.r.H_IG = 1;
+ HeciRegHCsrPtr->ul = HeciRegHCsr.ul;
+
+ //
+ // Create a callback event to check MBP FWSTS bit
+ //
+ Status = gBS->CreateEvent (
+ EFI_EVENT_NOTIFY_SIGNAL,
+ EFI_TPL_CALLBACK,
+ MbpCleared,
+ NULL,
+ &Event
+ );
+ ASSERT_EFI_ERROR (Status);
+ //
+ // Register EXIT_PM_AUTH_PROTOCOL notify function
+ //
+ Status = gBS->RegisterProtocolNotify (
+ &gExitPmAuthProtocolGuid,
+ Event,
+ &Registration
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ goto Done;
+ }
+ }
+ } else {
+ //
+ // If MBP_RDY not set, give up reading MBP and continue
+ //
+ goto MbpGiveup;
+ }
+
+ //
+ // If MAX_RETRIES exceeded, give up
+ //
+ if (MbpReadError && MbpReadAttempts == HECI_MBP_READ_MAX_RETRIES) {
+ goto MbpGiveup;
+ }
+
+ //
+ // Interrupt ME FW so FW knows we're done with this MBP read attempt
+ //
+ HeciRegHCsr.ul = HeciRegHCsrPtr->ul;
+ HeciRegHCsr.r.H_IG = 1;
+ HeciRegHCsrPtr->ul = HeciRegHCsr.ul;
+
+ //
+ // Wait for MBP_RDY after failed read attempt
+ //
+ Timeout = 0;
+
+ do {
+ MeFwsts2.ul = HeciPciRead32 (R_ME_GS_SHDW);
+
+ if (MeFwsts2.r.MbpRdy) {
+ break;
+ }
+
+ gBS->Stall (FIVE_MS_TIMEOUT);
+ Timeout += FIVE_MS_TIMEOUT;
+ } while (Timeout <= HECI_MBP_RDY_TIMEOUT);
+ }
+
+MbpGiveup:
+ MbpGiveUp();
+ Status = EFI_DEVICE_ERROR;
+
+Done:
+ return Status;
+}
+
+/**
+ Send Get Firmware Version Request to ME
+
+ @param[in] MsgGenGetFwVersionAckData Return themessage of FW version
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+HeciGetFwVersion (
+ IN OUT GEN_GET_FW_VER_ACK_DATA *MsgGenGetFwVersionAckData
+ )
+{
+ EFI_STATUS Status;
+ GEN_GET_FW_VER_ACK MsgGenGetFwVersionAck;
+
+ Status = HeciGetFwVersionMsg (&MsgGenGetFwVersionAck);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ if ((MsgGenGetFwVersionAck.MKHIHeader.Fields.Command == GEN_GET_FW_VERSION_CMD) &&
+ (MsgGenGetFwVersionAck.MKHIHeader.Fields.IsResponse == 1) &&
+ (MsgGenGetFwVersionAck.MKHIHeader.Fields.Result == 0)
+ ) {
+ *MsgGenGetFwVersionAckData = MsgGenGetFwVersionAck.Data;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Host client gets Firmware update info from ME client
+
+ @param[in] MECapability Structure of FirmwareUpdateInfo
+
+ @exception EFI_UNSUPPORTED No MBP Data Protocol available
+**/
+EFI_STATUS
+HeciGetMeFwInfo (
+ IN OUT ME_CAP *MECapability
+ )
+{
+ EFI_STATUS Status;
+ DXE_MBP_DATA_PROTOCOL *MbpData;
+ MEFWCAPS_SKU FwCapsSku;
+
+ //
+ // Get the MBP Data.
+ //
+ Status = gBS->LocateProtocol (&gMeBiosPayloadDataProtocolGuid, NULL, (VOID **) &MbpData);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "HeciGetMeFwInfo: No MBP Data Protocol available\n"));
+ return EFI_UNSUPPORTED;
+ }
+
+ MECapability->MeEnabled = 1;
+
+ FwCapsSku.Data = MbpData->MeBiosPayload.FwCapsSku.FwCapabilities.Data;
+ if (FwCapsSku.Fields.IntelAT) {
+ MECapability->AtSupported = 1;
+ }
+
+ if (FwCapsSku.Fields.KVM) {
+ MECapability->IntelKVM = 1;
+ }
+
+ switch (MbpData->MeBiosPayload.FwPlatType.RuleData.Fields.PlatformBrand) {
+ case INTEL_AMT_BRAND:
+ MECapability->IntelAmtFw = 1;
+ MECapability->LocalWakeupTimer = 1;
+ break;
+
+ case INTEL_STAND_MANAGEABILITY_BRAND:
+ MECapability->IntelAmtFwStandard = 1;
+ break;
+
+ case INTEL_SMALL_BUSINESS_TECHNOLOGY_BRAND:
+ MECapability->IntelSmallBusiness = 1;
+ break;
+ }
+
+ MECapability->MeMajorVer = MbpData->MeBiosPayload.FwVersionName.MajorVersion;
+ MECapability->MeMinorVer = MbpData->MeBiosPayload.FwVersionName.MinorVersion;
+ MECapability->MeBuildNo = MbpData->MeBiosPayload.FwVersionName.BuildVersion;
+ MECapability->MeHotFixNo = MbpData->MeBiosPayload.FwVersionName.HotfixVersion;
+
+ return Status;
+}
+
+/**
+ Dummy return for Me signal event use
+
+ @param[in] Event The event that triggered this notification function
+ @param[in] Context Pointer to the notification functions context
+**/
+VOID
+EFIAPI
+MeEmptyEvent (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ return;
+}
+
+/**
+ Get AT State Information From Stored ME platform policy
+
+ @param[in] AtState Pointer to AT State Information
+ @param[in] AtLastTheftTrigger Pointer to Variable holding the cause of last AT Stolen Stae
+ @param[in] AtLockState Pointer to variable indicating whether AT is locked or not
+ @param[in] AtAmPref Pointer to variable indicating whether ATAM or PBA should be used
+
+ @retval EFI_SUCCESS The function completed successfully
+ @exception EFI_UNSUPPORTED No MBP Data Protocol available
+**/
+EFI_STATUS
+GetAtStateInfo (
+ IN AT_STATE_INFO *AtStateInfo
+ )
+{
+ EFI_STATUS Status;
+ DXE_MBP_DATA_PROTOCOL *MbpData;
+
+ //
+ // Get the ME platform policy.
+ //
+ Status = gBS->LocateProtocol (&gMeBiosPayloadDataProtocolGuid, NULL, (VOID **) &MbpData);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "GetAtStateInfo: No MBP Data Protocol available\n"));
+ return EFI_UNSUPPORTED;
+ }
+ AtStateInfo->State = MbpData->MeBiosPayload.AtState.State;
+ AtStateInfo->LastTheftTrigger = MbpData->MeBiosPayload.AtState.LastTheftTrigger;
+ AtStateInfo->flags.LockState = MbpData->MeBiosPayload.AtState.flags.LockState;
+ AtStateInfo->flags.AuthenticateModule = MbpData->MeBiosPayload.AtState.flags.AuthenticateModule;
+ AtStateInfo->flags.S3Authentication = MbpData->MeBiosPayload.AtState.flags.S3Authentication;
+ AtStateInfo->flags.FlashVariableSecurity = MbpData->MeBiosPayload.AtState.flags.FlashVariableSecurity;
+ AtStateInfo->flags.FlashWearOut = MbpData->MeBiosPayload.AtState.flags.FlashWearOut;
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/ME/Library/MeKernel/Dxe/MeLib.h b/ReferenceCode/ME/Library/MeKernel/Dxe/MeLib.h
new file mode 100644
index 0000000..00ceec0
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeKernel/Dxe/MeLib.h
@@ -0,0 +1,203 @@
+/** @file
+ Header file for functions to get Intel ME information
+
+@copyright
+ Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _ME_LIB_H_
+#define _ME_LIB_H_
+
+#include "MePolicyLib.h"
+#include "HeciMsgLib.h"
+#include "MeChipset.h"
+#include "HeciRegs.h"
+#include EFI_PROTOCOL_CONSUMER (MeBiosPayloadData)
+
+#define MBP_PRESENT_MASK 0x00000020
+#define FIVE_MS_TIMEOUT 5000
+
+extern EFI_GUID gExitPmAuthProtocolGuid;
+
+#pragma pack(push, 1)
+
+typedef union _MBP_HEADER {
+ UINT32 Data;
+ struct {
+ UINT32 MbpSize : 8; ///< Byte 0 - MBP Size in DW including Header
+ UINT32 NumEntries : 8; ///< Byte 1 - Number of Entries (Data Items) in MBP
+ UINT32 Rsvd : 16; ///< Byte 3:2 - Reserved
+ } Fields;
+} MBP_HEADER;
+
+typedef union _MBP_ITEM_HEADER {
+ UINT32 Data;
+ struct {
+ UINT32 AppId : 8; ///< Byte 0 - Application ID
+ UINT32 ItemId : 8; ///< Byte 1 - Item ID
+ UINT32 Length : 8; ///< Byte 2 - Length in DW
+ UINT32 Rsvd : 8; ///< Byte 3 - Reserved
+ } Fields;
+} MBP_ITEM_HEADER;
+
+#pragma pack(pop)
+
+/**
+ Check if Me is enabled
+
+ @param[in] None.
+
+ @retval None
+**/
+EFI_STATUS
+MeLibInit (
+ VOID
+ )
+;
+
+/**
+ Send Get Firmware SKU Request to ME
+
+ @param[in] FwCapsSku Return Data from Get Firmware Capabilities MKHI Request
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+HeciGetFwCapsSku (
+ MEFWCAPS_SKU *FwCapsSku
+ )
+;
+
+/**
+ This message is sent by the BIOS or Intel(R) MEBX prior to the End of Post (EOP) on the boot
+ where host wants to get Lynx Point platform type. One of usages is to utilize this command to
+ determine if the platform runs in 1.5M or 5M size firmware.
+
+ @param[out] RuleData PlatformBrand,
+ IntelMeFwImageType,
+ SuperSku,
+ PlatformTargetMarketType,
+ PlatformTargetUsageType
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+HeciGetPlatformType (
+ OUT PLATFORM_TYPE_RULE_DATA *RuleData
+ )
+;
+
+/**
+ Routine checks whether MBP buffer has been cleared form HECI buffer or not.
+ BIOS must check this before executing any 3rd paty code or Oprom
+
+ @param[in] Event The event that triggered this notification function
+ @param[in] Context Pointer to the notification functions context
+**/
+VOID
+EFIAPI
+MbpCleared (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+;
+
+/**
+ This routine returns ME-BIOS Payload information from HECI buffer
+
+ @param[out] MbpPtr ME-BIOS Payload information.
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_DEVICE_ERROR Failed to consume MBP
+**/
+EFI_STATUS
+PrepareMeBiosPayload (
+ OUT ME_BIOS_PAYLOAD *MbpPtr
+ )
+;
+
+/**
+ Send Get Firmware Version Request to ME
+
+ @param[in] MsgGenGetFwVersionAckData Return themessage of FW version
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+HeciGetFwVersion (
+ IN OUT GEN_GET_FW_VER_ACK_DATA *MsgGenGetFwVersionAckData
+ )
+;
+
+/**
+ Host client gets Firmware update info from ME client for SMBIOS Table 131
+
+ @param[in][out] MECapability Structure of FirmwareUpdateInfo
+
+ @exception EFI_UNSUPPORTED No MBP Data Protocol available
+**/
+EFI_STATUS
+HeciGetMeFwInfo (
+ IN OUT ME_CAP *MECapability
+ )
+;
+
+/**
+ This is a dummy event to be hooked to provide ME or Platform
+ code before EOP Heci message is sent
+
+ @param[in] Event The event that triggered this notification function
+ @param[in] Context Pointer to the notification functions context
+**/
+VOID
+EFIAPI
+MeEmptyEvent (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+;
+
+/**
+ Get AT State Information From ME FW
+
+ @param[in] AtState Pointer to AT State Information
+ @param[in] AtLastTheftTrigger Pointer to Variable holding the cause of last AT Stolen Stae
+ @param[in] AtLockState Pointer to variable indicating whether AT is locked or not
+ @param[in] AtAmPref Pointer to variable indicating whether ATAM or PBA should be used
+
+ @retval EFI_SUCCESS The function completed successfully
+ @exception EFI_UNSUPPORTED No MBP Data Protocol available
+**/
+EFI_STATUS
+GetAtStateInfo (
+ IN AT_STATE_INFO *AtStateInfo
+ )
+;
+
+/**
+ Dump DXE_MBP_DATA_PROTOCOL
+
+ @param[in] MbpData Pointer to DXE_MBP_DATA_PROTOCOL
+
+ @retval None
+**/
+VOID
+DxeMbpDebugDump (
+ IN DXE_MBP_DATA_PROTOCOL *MbpPtr
+ )
+;
+
+#endif
diff --git a/ReferenceCode/ME/Library/MeKernel/Dxe/MeLib.inf b/ReferenceCode/ME/Library/MeKernel/Dxe/MeLib.inf
new file mode 100644
index 0000000..5e340e4
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeKernel/Dxe/MeLib.inf
@@ -0,0 +1,68 @@
+## @file
+# Component description file for Me functionality
+#
+#@copyright
+# Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = MeLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ MeLib.c
+ MeLib.h
+ MePolicyLib.c
+ MePolicyLib.h
+ HeciMsgLib.c
+ HeciMsgLib.h
+ MePolicyDebugDumpDxe.c
+ MbpDebugDumpDxe.c
+
+[includes.common]
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/Include
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Heci/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[libraries.common]
+ MeProtocolLib
+ MeChipsetLib
+ EdkIIGlueBasePciLibPciExpress
+ EdkIIGlueDxeMemoryAllocationLib
+ EdkFrameworkProtocolLib
+ PrintLib
+ EfiCommonLib
+ EdkIIGlueDxeFirmwarePerformanceLib
+
+[nmake.common]
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__
diff --git a/ReferenceCode/ME/Library/MeKernel/Dxe/MeLibDxe.cif b/ReferenceCode/ME/Library/MeKernel/Dxe/MeLibDxe.cif
new file mode 100644
index 0000000..3fc38ab
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeKernel/Dxe/MeLibDxe.cif
@@ -0,0 +1,18 @@
+<component>
+ name = "MeLibDxe"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\Library\MeKernel\Dxe\"
+ RefName = "MeLibDxe"
+[files]
+"MeLib.c"
+"MeLib.h"
+"MeLibDxe.mak"
+"MeLibDxe.sdl"
+"MePolicyLib.c"
+"MePolicyLib.h"
+"MeLib.inf"
+"HeciMsgLib.c"
+"HeciMsgLib.h"
+"MbpDebugDumpDxe.c"
+"MePolicyDebugDumpDxe.c"
+<endComponent>
diff --git a/ReferenceCode/ME/Library/MeKernel/Dxe/MeLibDxe.mak b/ReferenceCode/ME/Library/MeKernel/Dxe/MeLibDxe.mak
new file mode 100644
index 0000000..367e4c0
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeKernel/Dxe/MeLibDxe.mak
@@ -0,0 +1,60 @@
+# /*++
+# Copyright (c) 2009 Intel Corporation. All rights reserved.
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+# --*/
+# MAK file for the ModulePart:MeLibDxe
+all : MeLibDxe
+
+$(BUILD_DIR)\MeLibDxe.lib : MeLibDxe
+
+MeLibDxe : $(BUILD_DIR)\MeLibDxe.mak MeLibDxeBin
+
+$(BUILD_DIR)\MeLibDxe.mak : $(MeLibDxe_DIR)\$(@B).cif $(MeLibDxe_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(MeLibDxe_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+MeLibDxe_INCLUDES=\
+ $(EDK_INCLUDES) \
+ $(EdkIIGlueLib_INCLUDES) \
+ $(ME_INCLUDES) \
+ -I$(INTEL_COUGAR_POINT_DIR)\
+ $(INTEL_PCH_INCLUDES)
+
+MeLibDxe_DEFINES=\
+ $(MY_DEFINES)/D __EDKII_GLUE_BASE_MEMORY_LIB__\
+ /D __EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__\
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__\
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__
+
+MeLibDxe_LIBS=\
+ $(MeProtocolLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(COMPILERSTUB)\
+ $(EdkIIGlueSmmFirmwarePerformanceLib_LIB)\
+ $(EDKFRAMEWORKGUIDLIB)\
+
+
+MeLibDxeBin : $(MeLibDxe_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS) \
+ /f $(BUILD_DIR)\MeLibDxe.mak all \
+ "MY_INCLUDES=$(MeLibDxe_INCLUDES)" \
+ "MY_DEFINES=$(MeLibDxe_DEFINES)"\
+ TYPE=LIBRARY \
+#**********************************************************************
+#**********************************************************************
+#** **
+#** (C)Copyright 1985-2006, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 6145-F Northbelt Pkwy, Norcross, GA 30071 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#**********************************************************************
+#**********************************************************************
diff --git a/ReferenceCode/ME/Library/MeKernel/Dxe/MeLibDxe.sdl b/ReferenceCode/ME/Library/MeKernel/Dxe/MeLibDxe.sdl
new file mode 100644
index 0000000..f69bf74
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeKernel/Dxe/MeLibDxe.sdl
@@ -0,0 +1,36 @@
+TOKEN
+ Name = "MeLibDxe_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable MeLibDxe support in Project"
+End
+
+MODULE
+ Help = "Includes MeLibDxe.mak to Project"
+ File = "MeLibDxe.mak"
+End
+
+PATH
+ Name = "MeLibDxe_DIR"
+ Help = "Me Library file source directory"
+End
+
+ELINK
+ Name = "MeLibDxe_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\MeLibDxe.lib"
+ Parent = "MeLibDxe_LIB"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(MeLibDxe_DIR)"
+ Parent = "ME_INCLUDES"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/ME/Library/MeKernel/Dxe/MePolicyDebugDumpDxe.c b/ReferenceCode/ME/Library/MeKernel/Dxe/MePolicyDebugDumpDxe.c
new file mode 100644
index 0000000..bdfe7e5
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeKernel/Dxe/MePolicyDebugDumpDxe.c
@@ -0,0 +1,72 @@
+/** @file
+ Dump whole DXE_ME_POLICY_PROTOCOL and serial out.
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "MePolicyLib.h"
+#endif
+
+extern DXE_ME_POLICY_PROTOCOL *mDxePlatformMePolicy;
+
+/**
+ Dump DXE ME Platform Policy
+
+ @param[in] None.
+
+ @retval None
+**/
+VOID
+DxeMePolicyDebugDump (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+
+ Status = MePolicyLibInit ();
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+
+#ifdef EFI_DEBUG
+ DEBUG ((EFI_D_INFO, "\n------------------------ MePlatformPolicy Dump Begin -----------------\n"));
+ DEBUG ((EFI_D_INFO, " Revision : 0x%x\n", mDxePlatformMePolicy->Revision));
+ DEBUG ((EFI_D_INFO, "MeConfig ---\n"));
+ //
+ // Byte 0, bit definition for functionality enable/disable
+ //
+ DEBUG ((EFI_D_INFO, " MeFwDownGrade : 0x%x\n", mDxePlatformMePolicy->MeConfig.MeFwDownGrade));
+ DEBUG ((EFI_D_INFO, " MeLocalFwUpdEnabled : 0x%x\n", mDxePlatformMePolicy->MeConfig.MeLocalFwUpdEnabled));
+ DEBUG ((EFI_D_INFO, " EndOfPostEnabled : 0x%x\n", mDxePlatformMePolicy->MeConfig.EndOfPostEnabled));
+ DEBUG ((EFI_D_INFO, " EndOfPostDone : 0x%x\n", mDxePlatformMePolicy->MeConfig.EndOfPostDone));
+ DEBUG ((EFI_D_INFO, " MdesCapability : 0x%x\n", mDxePlatformMePolicy->MeConfig.MdesCapability));
+ DEBUG ((EFI_D_INFO, " SvtForPchCap : 0x%x\n", mDxePlatformMePolicy->MeConfig.SvtForPchCap));
+ DEBUG ((EFI_D_INFO, " MdesForBiosState : 0x%x\n", mDxePlatformMePolicy->MeConfig.MdesForBiosState));
+
+ DEBUG ((EFI_D_INFO, "MeMiscConfig ---\n"));
+ DEBUG ((EFI_D_INFO, " FviSmbiosType : 0x%x\n", mDxePlatformMePolicy->MeMiscConfig.FviSmbiosType));
+ DEBUG ((EFI_D_INFO, "\n------------------------ MePlatformPolicy Dump End -------------------\n"));
+#endif
+}
+
diff --git a/ReferenceCode/ME/Library/MeKernel/Dxe/MePolicyLib.c b/ReferenceCode/ME/Library/MeKernel/Dxe/MePolicyLib.c
new file mode 100644
index 0000000..5f69857
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeKernel/Dxe/MePolicyLib.c
@@ -0,0 +1,182 @@
+/** @file
+ Implementation file for Me Policy functionality
+
+@copyright
+ Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "MePolicyLib.h"
+#include "MeAccess.h"
+#include EFI_PROTOCOL_DEFINITION (HECI)
+#endif
+
+//
+// Global variables
+//
+DXE_ME_POLICY_PROTOCOL *mDxePlatformMePolicy = NULL;
+
+/**
+ Check if Me is enabled.
+
+ @param[in] None.
+
+ @retval EFI_SUCCESS ME platform policy pointer is initialized.
+ @retval All other error conditions encountered when no ME platform policy available.
+**/
+EFI_STATUS
+MePolicyLibInit (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+
+ if (mDxePlatformMePolicy != NULL) {
+ return EFI_SUCCESS;
+ }
+ //
+ // Get the desired platform setup policy.
+ //
+ Status = gBS->LocateProtocol (&gDxePlatformMePolicyGuid, NULL, (VOID **) &mDxePlatformMePolicy);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "No ME Platform Policy Protocol available"));
+ ASSERT_EFI_ERROR (Status);
+ } else if (mDxePlatformMePolicy == NULL) {
+ DEBUG ((EFI_D_ERROR, "No ME Platform Policy Protocol available"));
+ Status = EFI_UNSUPPORTED;
+ }
+ return Status;
+}
+
+/**
+ Check if End of Post Message is enabled in setup options.
+
+ @param[in] None.
+
+ @retval FALSE EndOfPost is disabled.
+ @retval TRUE EndOfPost is enabled.
+**/
+BOOLEAN
+MeEndOfPostEnabled (
+ VOID
+ )
+{
+ BOOLEAN Supported;
+ EFI_STATUS Status;
+
+ if (mDxePlatformMePolicy == NULL) {
+ Status = MePolicyLibInit();
+ if (EFI_ERROR(Status)) {
+ return FALSE;
+ }
+ }
+ if (mDxePlatformMePolicy->MeConfig.EndOfPostEnabled != 1) {
+ Supported = FALSE;
+ } else {
+ Supported = TRUE;
+ }
+
+ return Supported;
+}
+
+/**
+ Checks if EndOfPost event already happened
+
+ @param[in] None
+
+ @retval TRUE if end of post happened
+ @retval FALSE if not yet
+**/
+BOOLEAN
+IsAfterEndOfPost (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+
+ if (mDxePlatformMePolicy == NULL) {
+ Status = MePolicyLibInit();
+ if (EFI_ERROR(Status)) {
+ return FALSE;
+ }
+ }
+
+ if (mDxePlatformMePolicy->MeConfig.EndOfPostDone == TRUE) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/**
+ Show Me Error message. This is used to support display error message on the screen for localization
+ description
+
+ @param[in] MsgId Me error message ID for displaying on screen message
+
+ @retval None
+**/
+VOID
+MeReportError (
+ IN ME_ERROR_MSG_ID MsgId
+ )
+{
+ EFI_STATUS Status;
+
+ if (mDxePlatformMePolicy == NULL) {
+ Status = MePolicyLibInit();
+ if (EFI_ERROR(Status)) {
+ return;
+ }
+ }
+ mDxePlatformMePolicy->MeReportError (MsgId);
+
+ return ;
+}
+
+/**
+ Check if MeFwDowngrade is enabled in setup options.
+
+ @param[in] None.
+
+ @retval FALSE MeFwDowngrade is disabled.
+ @retval TRUE MeFwDowngrade is enabled.
+**/
+BOOLEAN
+MeFwDowngradeSupported (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+
+ if (mDxePlatformMePolicy == NULL) {
+ Status = MePolicyLibInit();
+ if (EFI_ERROR(Status)) {
+ return FALSE;
+ }
+ }
+ if (mDxePlatformMePolicy->MeConfig.MeFwDownGrade == 1) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
diff --git a/ReferenceCode/ME/Library/MeKernel/Dxe/MePolicyLib.h b/ReferenceCode/ME/Library/MeKernel/Dxe/MePolicyLib.h
new file mode 100644
index 0000000..1d315b5
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeKernel/Dxe/MePolicyLib.h
@@ -0,0 +1,95 @@
+/** @file
+ Header file for Me Policy functionality
+
+@copyright
+ Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _ME_POLICY_LIB_H_
+#define _ME_POLICY_LIB_H_
+
+#include EFI_PROTOCOL_DEFINITION (MePlatformPolicy)
+
+/**
+ Check if Me is enabled.
+
+ @param[in] None.
+
+ @retval EFI_SUCCESS ME platform policy pointer is initialized.
+ @retval All other error conditions encountered when no ME platform policy available.
+**/
+EFI_STATUS
+MePolicyLibInit (
+ VOID
+ )
+;
+
+/**
+ Check if End of Post Message is enabled in setup options.
+
+ @param[in] None.
+
+ @retval FALSE EndOfPost is disabled.
+ @retval TRUE EndOfPost is enabled.
+**/
+BOOLEAN
+MeEndOfPostEnabled (
+ VOID
+ )
+;
+
+
+/**
+ Show Me Error message. This is used to support display error message on the screen for localization
+ description
+
+ @param[in] MsgId Me error message ID for displaying on screen message
+
+ @retval None
+**/
+VOID
+MeReportError (
+ IN ME_ERROR_MSG_ID MsgId
+ )
+;
+
+/**
+ Check if MeFwDowngrade is enabled in setup options.
+
+ @param[in] None.
+
+ @retval FALSE MeFwDowngrade is disabled.
+ @retval TRUE MeFwDowngrade is enabled.
+**/
+BOOLEAN
+MeFwDowngradeSupported (
+ VOID
+ )
+;
+
+/**
+ Dump DXE ME Platform Policy
+
+ @param[in] None.
+
+ @retval None
+**/
+VOID
+DxeMePolicyDebugDump (
+ VOID
+ )
+;
+#endif
diff --git a/ReferenceCode/ME/Library/MeKernel/MeKernelLibrary.cif b/ReferenceCode/ME/Library/MeKernel/MeKernelLibrary.cif
new file mode 100644
index 0000000..eaef885
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeKernel/MeKernelLibrary.cif
@@ -0,0 +1,12 @@
+<component>
+ name = "MeKernelLibrary"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Me\Library\MeKernel\"
+ RefName = "MeKernelLibrary"
+[files]
+"MeKernelLibrary.sdl"
+[parts]
+"MeChipsetLib"
+"MeLibDxe"
+"MeLibPei"
+<endComponent>
diff --git a/ReferenceCode/ME/Library/MeKernel/MeKernelLibrary.sdl b/ReferenceCode/ME/Library/MeKernel/MeKernelLibrary.sdl
new file mode 100644
index 0000000..6055d0a
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeKernel/MeKernelLibrary.sdl
@@ -0,0 +1,20 @@
+TOKEN
+ Name = "MeKernelLibrary_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable Me Kernel Library support in Project"
+End
+
+PATH
+ Name = "MeKernelLibrary_DIR"
+ Help = "Me Library file source directory"
+End
+
+ELINK
+ Name = "/I$(MeKernelLibrary_DIR)\Include"
+ Parent = "ME_INCLUDES"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/ME/Library/MeKernel/Pei/HeciMsgLibPei.c b/ReferenceCode/ME/Library/MeKernel/Pei/HeciMsgLibPei.c
new file mode 100644
index 0000000..905020b
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeKernel/Pei/HeciMsgLibPei.c
@@ -0,0 +1,185 @@
+/** @file
+ Implementation file for Heci Message functionality
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights
+ reserved This software and associated documentation (if any)
+ is furnished under a license and may only be used or copied in
+ accordance with the terms of the license. Except as permitted
+ by such license, no part of this software or documentation may
+ be reproduced, stored in a retrieval system, or transmitted in
+ any form or by any means without the express written consent
+ of Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#include "CoreBiosMsg.h"
+#include "HeciMsgLibPei.h"
+#include EFI_PPI_CONSUMER (Wdt)
+
+#endif
+
+/**
+ Start Watch Dog Timer HECI message
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] HeciPpi The pointer to HECI PPI
+ @param[in] HeciMemBar HECI Memory BAR
+ @param[in] WaitTimerBios The value of waiting limit
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+**/
+EFI_STATUS
+PeiHeciAsfStartWatchDog (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_HECI_PPI *HeciPpi,
+ IN UINT32 HeciMemBar,
+ IN UINT16 WaitTimerBios
+ )
+{
+ EFI_STATUS Status;
+ ASF_START_WDT AsfStartWdt;
+ UINT32 HeciLength;
+ UINT32 MeMode;
+
+ Status = HeciPpi->GetMeMode (PeiServices, &MeMode);
+ if (EFI_ERROR (Status) || (MeMode != ME_MODE_NORMAL)) {
+ return EFI_UNSUPPORTED;
+ }
+ ///
+ /// Clear Start Watch Dog Timer HECI message
+ ///
+ ZeroMem ((VOID *) &AsfStartWdt, sizeof (ASF_START_WDT));
+
+ AsfStartWdt.Command = ASF_MANAGEMENT_CONTROL;
+ AsfStartWdt.ByteCount = START_WDT_BYTE_COUNT;
+ AsfStartWdt.SubCommand = ASF_SUB_COMMAND_START_WDT;
+ AsfStartWdt.VersionNumber = START_WDT_VERSION_NUMBER;
+ AsfStartWdt.TimeoutLow = (UINT8) WaitTimerBios;
+ AsfStartWdt.TimeoutHigh = (UINT8) (WaitTimerBios >> 8);
+ AsfStartWdt.EventSensorType = START_WDT_EVENT_SENSOR_TYPE;
+ AsfStartWdt.EventType = START_WDT_EVENT_TYPE;
+ AsfStartWdt.EventOffset = START_WDT_EVENT_OFFSET;
+ AsfStartWdt.EventSourceType = START_WDT_EVENT_SOURCE_TYPE_BIOS;
+ AsfStartWdt.EventSeverity = START_WDT_EVENT_SEVERITY;
+ AsfStartWdt.SensorDevice = START_WDT_SENSOR_DEVICE;
+ AsfStartWdt.SensorNumber = START_WDT_SENSOR_NUMBER;
+ AsfStartWdt.Entity = START_WDT_ENTITY;
+ AsfStartWdt.EntityInstance = START_WDT_ENTITY_INSTANCE;
+ AsfStartWdt.EventData[0] = START_WDT_EVENT_DATA_BYTE_0;
+ AsfStartWdt.EventData[1] = START_WDT_EVENT_DATA_BYTE_1_BIOS_TIMEOUT;
+
+ HeciLength = ASF_START_WDT_LENGTH;
+
+ Status = HeciPpi->SendMsg (
+ PeiServices,
+ HeciPpi,
+ (UINT32 *) &AsfStartWdt,
+ HeciMemBar,
+ HeciLength,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_ASF_MESSAGE_ADDR
+ );
+
+ return Status;
+}
+
+/**
+ Send Core BIOS Reset Request Message through HECI to reset the system.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] ResetOrigin Reset source
+ @param[in] ResetType Global or Host reset
+
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+**/
+EFI_STATUS
+PeiHeciSendCbmResetRequest (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN UINT8 ResetOrigin,
+ IN UINT8 ResetType
+ )
+{
+ EFI_STATUS Status;
+ PEI_HECI_PPI *HeciPpi;
+ CBM_RESET_REQ CbmResetRequest;
+ UINT32 HeciLength;
+ UINT32 HeciMemBar;
+ PLATFORM_ME_HOOK_PPI *PlatformMeHookPpi;
+ EFI_GUID WdtPpiGuid = WDT_PPI_GUID;
+ WDT_PPI *WdtPpi;
+
+ Status = PeiServicesLocatePpi (
+ &gPlatformMeHookPpiGuid, // GUID
+ 0, // INSTANCE
+ NULL, // EFI_PEI_PPI_DESCRIPTOR
+ (VOID **) &PlatformMeHookPpi // PPI
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "Unable to Locate PlatformMeHook Protocol for Global Reset Hook, so skip instead.", Status));
+ } else {
+ PlatformMeHookPpi->PreGlobalReset (PeiServices, PlatformMeHookPpi);
+ }
+
+ Status = PeiServicesLocatePpi (
+ &gPeiHeciPpiGuid, // GUID
+ 0, // INSTANCE
+ NULL, // EFI_PEI_PPI_DESCRIPTOR
+ (VOID **) &HeciPpi // PPI
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ Status = HeciPpi->InitializeHeci (PeiServices, HeciPpi, &HeciMemBar);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ CbmResetRequest.MKHIHeader.Data = 0;
+ CbmResetRequest.MKHIHeader.Fields.Command = CBM_RESET_REQ_CMD;
+ CbmResetRequest.MKHIHeader.Fields.IsResponse = 0;
+ CbmResetRequest.MKHIHeader.Fields.GroupId = MKHI_CBM_GROUP_ID;
+ CbmResetRequest.MKHIHeader.Fields.Reserved = 0;
+ CbmResetRequest.MKHIHeader.Fields.Result = 0;
+ CbmResetRequest.Data.RequestOrigin = CBM_RR_REQ_ORIGIN_BIOS_MEMORY_INIT;
+ CbmResetRequest.Data.ResetType = CBM_HRR_GLOBAL_RESET;
+
+ HeciLength = sizeof (CBM_RESET_REQ);
+
+ Status = PeiServicesLocatePpi (
+ &WdtPpiGuid, // GUID
+ 0, // INSTANCE
+ NULL, // EFI_PEI_PPI_DESCRIPTOR
+ (VOID **) &WdtPpi // PPI
+ );
+ ASSERT_EFI_ERROR (Status);
+ WdtPpi->AllowKnownReset ();
+
+ Status = HeciPpi->SendMsg (
+ PeiServices,
+ HeciPpi,
+ (UINT32 *) &CbmResetRequest,
+ HeciMemBar,
+ HeciLength,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_CORE_MESSAGE_ADDR
+ );
+
+ return Status;
+}
diff --git a/ReferenceCode/ME/Library/MeKernel/Pei/HeciMsgLibPei.h b/ReferenceCode/ME/Library/MeKernel/Pei/HeciMsgLibPei.h
new file mode 100644
index 0000000..7d5c7ce
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeKernel/Pei/HeciMsgLibPei.h
@@ -0,0 +1,86 @@
+/** @file
+ Header file for Heci Message functionality
+
+@copyright
+ Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PEI_HECI_MESSAGE_LIB_H_
+#define _PEI_HECI_MESSAGE_LIB_H_
+
+#include EFI_PPI_DEFINITION (Heci)
+#include EFI_PPI_DEFINITION (PlatformMeHook)
+
+#define START_WDT_BYTE_COUNT 0x0F
+#define START_WDT_VERSION_NUMBER 0x10
+#define START_WDT_EVENT_SENSOR_TYPE 0x23
+#define START_WDT_EVENT_TYPE 0x6F
+#define START_WDT_EVENT_OFFSET 0x00
+#define START_WDT_EVENT_SOURCE_TYPE_OS 0x48
+#define START_WDT_EVENT_SOURCE_TYPE_BIOS 0x00
+#define START_WDT_EVENT_SOURCE_TYPE 0x00 ///< 0x00 - BIOs, 0x48 - OS
+#define START_WDT_EVENT_SEVERITY 0x10 ///< critical
+#define START_WDT_SENSOR_DEVICE 0xFF ///< unspecified
+#define START_WDT_SENSOR_NUMBER 0xFF ///< unspecified
+#define START_WDT_ENTITY 0x00 ///< unspecified
+#define START_WDT_ENTITY_INSTANCE 0x00 ///< unspecified
+#define START_WDT_EVENT_DATA_BYTE_0 0x40
+#define START_WDT_EVENT_DATA_BYTE_1 0x02 ///< 0x02 BIOS POST WDT Timeout, 0x04 OS WDT timeout
+#define START_WDT_EVENT_DATA_BYTE_1_BIOS_TIMEOUT 0x02
+#define START_WDT_EVENT_DATA_BYTE_1_OS_TIMEOUT 0x04
+
+/**
+ Start Watch Dog Timer HECI message
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] HeciPpi The pointer to HECI PPI
+ @param[in] HeciMemBar HECI Memory BAR
+ @param[in] WaitTimerBios The value of waiting limit
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+**/
+EFI_STATUS
+PeiHeciAsfStartWatchDog (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_HECI_PPI *HeciPpi,
+ IN UINT32 HeciMemBar,
+ IN UINT16 WaitTimerBios
+ )
+;
+
+/**
+ Send Core BIOS Reset Request Message through HECI to reset the system.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] ResetOrigin Reset source
+ @param[in] ResetType Global or Host reset
+
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+**/
+EFI_STATUS
+PeiHeciSendCbmResetRequest (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN UINT8 ResetOrigin,
+ IN UINT8 ResetType
+ )
+;
+
+#endif
diff --git a/ReferenceCode/ME/Library/MeKernel/Pei/MeLibPei.cif b/ReferenceCode/ME/Library/MeKernel/Pei/MeLibPei.cif
new file mode 100644
index 0000000..195b908
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeKernel/Pei/MeLibPei.cif
@@ -0,0 +1,15 @@
+<component>
+ name = "MeLibPei"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\Library\MeKernel\Pei\"
+ RefName = "MeLibPei"
+[files]
+"MeLibPei.sdl"
+"MeLibPei.mak"
+"MePolicyLibPei.c"
+"MePolicyLibPei.h"
+"HeciMsgLibPei.c"
+"HeciMsgLibPei.h"
+"MeLibPei.h"
+"MeLibPei.inf"
+<endComponent>
diff --git a/ReferenceCode/ME/Library/MeKernel/Pei/MeLibPei.h b/ReferenceCode/ME/Library/MeKernel/Pei/MeLibPei.h
new file mode 100644
index 0000000..af3ad62
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeKernel/Pei/MeLibPei.h
@@ -0,0 +1,27 @@
+/** @file
+ Header file for PEI Me functionality
+
+@copyright
+ Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PEI_ME_LIB_H_
+#define _PEI_ME_LIB_H_
+
+#include "MePolicyLibPei.h"
+#include "HeciMsgLibPei.h"
+
+#endif
diff --git a/ReferenceCode/ME/Library/MeKernel/Pei/MeLibPei.inf b/ReferenceCode/ME/Library/MeKernel/Pei/MeLibPei.inf
new file mode 100644
index 0000000..78478c4
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeKernel/Pei/MeLibPei.inf
@@ -0,0 +1,56 @@
+## @file
+# Component description file for Me Library functions for PEIMs
+#
+#@copyright
+# Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = MeLibPei
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ MePolicyLibPei.c
+ MePolicyLibPei.h
+ HeciMsgLibPei.c
+ HEciMsgLibPei.h
+ MeLibPei.h
+
+[includes.common]
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[libraries.common]
+ MeLibPpi
+ EdkIIGluePeiServicesLib
+
+[nmake.common]
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_PEI_SERVICES_LIB__
diff --git a/ReferenceCode/ME/Library/MeKernel/Pei/MeLibPei.mak b/ReferenceCode/ME/Library/MeKernel/Pei/MeLibPei.mak
new file mode 100644
index 0000000..b9abbdf
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeKernel/Pei/MeLibPei.mak
@@ -0,0 +1,53 @@
+# /*++
+# Copyright (c) 2009 Intel Corporation. All rights reserved.
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+# --*/
+# MAK file for the ModulePart:MeLibPei
+all : MeLibPei
+
+$(BUILD_DIR)\MeLibPei.lib : MeLibPei
+
+MeLibPei : $(BUILD_DIR)\MeLibPei.mak MeLibPeiBin
+
+$(BUILD_DIR)\MeLibPei.mak : $(MeLibPei_DIR)\$(@B).cif $(MeLibPei_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(MeLibPei_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+MeLibPei_INCLUDES=\
+ $(EDK_INCLUDES) \
+ $(EdkIIGlueLib_INCLUDES)\
+ $(ME_INCLUDES) \
+ /I$(NB_BOARD_DIR)\
+ -I$(INTEL_COUGAR_POINT_DIR)\
+
+MeLibPei_DEFINES=\
+ /D __EDKII_GLUE_PEI_SERVICES_LIB__
+
+MeLibPei_LIBS=\
+ $(EdkIIGluePeiServicesLib_LIB)\
+ $(MeLibPpi_LIB)
+
+MeLibPeiBin : $(MeLibPei_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS) \
+ /f $(BUILD_DIR)\MeLibPei.mak all \
+ "MY_INCLUDES=$(MeLibPei_INCLUDES)" \
+ "CFLAGS=$(CFLAGS) $(MeLibPei_DEFINES)"\
+ TYPE=PEI_LIBRARY \
+#**********************************************************************
+#**********************************************************************
+#** **
+#** (C)Copyright 1985-2006, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 6145-F Northbelt Pkwy, Norcross, GA 30071 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#**********************************************************************
+#**********************************************************************
diff --git a/ReferenceCode/ME/Library/MeKernel/Pei/MeLibPei.sdl b/ReferenceCode/ME/Library/MeKernel/Pei/MeLibPei.sdl
new file mode 100644
index 0000000..9dfe312
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeKernel/Pei/MeLibPei.sdl
@@ -0,0 +1,36 @@
+TOKEN
+ Name = "MeLibPei_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable MeLibPei support in Project"
+End
+
+MODULE
+ Help = "Includes MeLibPei.mak to Project"
+ File = "MeLibPei.mak"
+End
+
+PATH
+ Name = "MeLibPei_DIR"
+ Help = "Me Library file source directory"
+End
+
+ELINK
+ Name = "MeLibPei_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\MeLibPei.lib"
+ Parent = "MeLibPei_LIB"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(MeLibPei_DIR)"
+ Parent = "ME_INCLUDES"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/ME/Library/MeKernel/Pei/MePolicyLibPei.c b/ReferenceCode/ME/Library/MeKernel/Pei/MePolicyLibPei.c
new file mode 100644
index 0000000..733d6e3
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeKernel/Pei/MePolicyLibPei.c
@@ -0,0 +1,59 @@
+/** @file
+ Implementation file for Me Policy functionality for PEIM
+
+@copyright
+ Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#include "MePolicyLibPei.h"
+#endif
+
+/**
+ Check if Me is enabled.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] PeiMePlatformPolicy The Me Platform Policy protocol instance
+
+ @retval EFI_SUCCESS ME platform policy Ppi loacted
+ @retval All other error conditions encountered when no ME platform policy Ppi
+**/
+EFI_STATUS
+PeiMePolicyLibInit (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_ME_PLATFORM_POLICY_PPI **PeiMePlatformPolicy
+ )
+{
+ EFI_STATUS Status;
+
+ //
+ // Locate system configuration variable
+ //
+ Status = PeiServicesLocatePpi (
+ &gPeiMePlatformPolicyPpiGuid, // GUID
+ 0, // INSTANCE
+ NULL, // EFI_PEI_PPI_DESCRIPTOR
+ (VOID **) PeiMePlatformPolicy // PPI
+ );
+ ASSERT_EFI_ERROR (Status);
+ return Status;
+}
diff --git a/ReferenceCode/ME/Library/MeKernel/Pei/MePolicyLibPei.h b/ReferenceCode/ME/Library/MeKernel/Pei/MePolicyLibPei.h
new file mode 100644
index 0000000..7de458b
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeKernel/Pei/MePolicyLibPei.h
@@ -0,0 +1,42 @@
+/** @file
+ Header file to define some function for getting the Intel ME policy PEI phase.
+
+@copyright
+ Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PEI_ME_POLICY_LIB_H_
+#define _PEI_ME_POLICY_LIB_H_
+
+#include EFI_PPI_DEFINITION (MePlatformPolicyPei)
+
+/**
+ Check if Me is enabled.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] PeiMePlatformPolicy The Me Platform Policy protocol instance
+
+ @retval EFI_SUCCESS ME platform policy Ppi loacted
+ @retval All other error conditions encountered when no ME platform policy Ppi
+**/
+EFI_STATUS
+PeiMePolicyLibInit (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_ME_PLATFORM_POLICY_PPI **PeiMePlatformPolicy
+ )
+;
+
+#endif
diff --git a/ReferenceCode/ME/Library/MeKernel/include/CoreBiosMsg.h b/ReferenceCode/ME/Library/MeKernel/include/CoreBiosMsg.h
new file mode 100644
index 0000000..bda1bc4
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeKernel/include/CoreBiosMsg.h
@@ -0,0 +1,625 @@
+/** @file
+ Core BIOS Messages
+
+@copyright
+ Copyright (c) 2008 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef CORE_BIOS_MSG_H
+#define CORE_BIOS_MSG_H
+
+#include "MkhiMsgs.h"
+
+#pragma pack(1)
+
+#define CBM_RESET_REQ_CMD 0x0B
+#define CBM_RESET_REQ_CMD_ACK 0x8B
+#define CBM_END_OF_POST_CMD 0x0C
+#define CBM_END_OF_POST_CMD_ACK 0x8C
+#define GEN_SET_DEBUG_MEMORY_CMD 0x11
+
+//
+// HECI Client Address - Core Messages
+// Core messages to coordinate memory initialization and UMA allocation with ME
+// as well as to inform ME of the end of POST event
+//
+#define HECI_CLIENT_CORE_MSG_DISPATCHER 0x07
+#define HOST_FIXED_ADDRESS 0x00
+
+typedef union _HECI_MESSAGE_HEADER {
+ UINT32 Data;
+ struct {
+ UINT32 MeAddress : 8;
+ UINT32 HostAddress : 8;
+ UINT32 Length : 9;
+ UINT32 Reserved : 6;
+ UINT32 MessageComplete : 1;
+ } Fields;
+} HECI_MESSAGE_HEADER;
+
+///
+/// Reset request message
+///
+typedef struct _CBM_RESET_REQ_DATA {
+ UINT8 RequestOrigin;
+ UINT8 ResetType;
+} CBM_RESET_REQ_DATA;
+
+typedef struct _CBM_RESET_REQ {
+ MKHI_MESSAGE_HEADER MKHIHeader;
+ CBM_RESET_REQ_DATA Data;
+} CBM_RESET_REQ;
+
+typedef struct _MKHI_CBM_RESET_REQ {
+ HECI_MESSAGE_HEADER Header;
+ CBM_RESET_REQ Msg;
+} MKHI_CBM_RESET_REQ;
+
+///
+/// Reset request ack message
+///
+typedef struct _CBM_RESET_ACK {
+ MKHI_MESSAGE_HEADER MKHIHeader;
+} CBM_RESET_ACK;
+
+typedef struct _MKHI_CBM_RESET_ACK {
+ HECI_MESSAGE_HEADER Header;
+ CBM_RESET_ACK Msg;
+} MKHI_CBM_RESET_ACK;
+
+//
+// ASF Watch Dog Timer
+//
+#define ASF_MANAGEMENT_CONTROL 0x02
+#define ASF_SUB_COMMAND_START_WDT 0x13
+#define ASF_SUB_COMMAND_STOP_WDT 0x14
+
+///
+/// ASF Start Watch Dog
+///
+typedef struct _ASF_START_WDT {
+ UINT8 Command;
+ UINT8 ByteCount;
+ UINT8 SubCommand;
+ UINT8 VersionNumber;
+ UINT8 TimeoutLow;
+ UINT8 TimeoutHigh;
+ UINT8 EventSensorType;
+ UINT8 EventType;
+ UINT8 EventOffset;
+ UINT8 EventSourceType;
+ UINT8 EventSeverity;
+ UINT8 SensorDevice;
+ UINT8 SensorNumber;
+ UINT8 Entity;
+ UINT8 EntityInstance;
+ UINT8 EventData[5];
+} ASF_START_WDT;
+
+#define ASF_START_WDT_LENGTH 0x14
+
+///
+/// ASF Stop Watch Dog
+///
+typedef struct _ASF_STOP_WDT {
+ UINT8 Command;
+ UINT8 ByteCount;
+ UINT8 SubCommand;
+ UINT8 VersionNumber;
+} ASF_STOP_WDT;
+
+#define ASF_STOP_WDT_LENGTH 0x04
+
+//
+// HECI Header Definitions for Core BIOS Messages
+//
+#define CBM_END_OF_POST_HECI_HDR 0x80080001
+#define CBM_END_OF_POST_RESPONSE_HECI_HDR 0x80010001
+#define CBM_RESET_REQUEST_HECI_HDR 0x80030001
+#define CBM_RESET_RESPONSE_HECI_HDR 0x80020001
+
+//
+// Enumerations used in Core BIOS Messages
+//
+// End Of Post Codes.
+//
+#define CBM_EOP_EXITING_G3 0x01
+#define CBM_EOP_RESERVED 0x02
+#define CBM_EOP_EXITING_S3 0x03
+#define CBM_EOP_EXITING_S4 0x04
+#define CBM_EOP_EXITING_S5 0x05
+
+//
+// Reset Request Origin Codes.
+//
+#define CBM_RR_REQ_ORIGIN_BIOS_MEMORY_INIT 0x01
+#define CBM_RR_REQ_ORIGIN_BIOS_POST 0x02
+#define CBM_RR_REQ_ORIGIN_MEBX 0x03
+
+//
+// Reset Type Codes.
+//
+#define CBM_HRR_GLOBAL_RESET 0x01
+
+//
+// Reset Response Codes.
+//
+#define CBM_HRR_RES_REQ_NOT_ACCEPTED 0x01
+
+//
+// definitions for ICC MEI Messages
+//
+#define IBEX_PEAK_PLATFORM 0x00010000
+#define COUGAR_POINT_PLATFORM 0x00020000
+#define LYNX_POINT_PLATFORM 0x00030000
+
+typedef enum {
+ ICC_STATUS_SUCCESS = 0,
+ ICC_STATUS_SUCCESS_WAITING_FOR_RESET,
+ ICC_STATUS_INCORRECT_API_VERSION,
+ ICC_STATUS_INVALID_FUNCTION,
+ ICC_STATUS_INVALID_BUFFER_LENGTH,
+ ICC_STATUS_INVALID_PARAMETERS,
+ ICC_STATUS_FLASH_WEAR_OUT_VIOLATION,
+ ICC_STATUS_CLOCK_REQ_ENTRY_VIOLATION,
+ ICC_STATUS_STATIC_REGISTER_MASK_VIOLATION,
+ ICC_STATUS_DYNAMIC_REGISTER_MASK_VIOLATION,
+ ICC_STATUS_IMMEDIATE_REQUIRES_POWER_CYCLE,
+ ICC_STATUS_ILLEGAL_RECORD_ID,
+ ICC_STATUS_ENABLED_CLOCK_MASK_VIOLATION,
+ ICC_STATUS_INVALID = 0xFFFFFFFF
+} ICC_MEI_CMD_STATUS;
+
+typedef union _ICC_CLOCK_ENABLES_CONTROL_MASK {
+ UINT32 Dword;
+ struct {
+ UINT32 Flex0 : 1;
+ UINT32 Flex1 : 1;
+ UINT32 Flex2 : 1;
+ UINT32 Flex3 : 1;
+ UINT32 Reserved1 : 3;
+ UINT32 PCI_Clock0 : 1;
+ UINT32 PCI_Clock1 : 1;
+ UINT32 PCI_Clock2 : 1;
+ UINT32 PCI_Clock3 : 1;
+ UINT32 PCI_Clock4 : 1;
+ UINT32 Reserved2 : 4;
+ UINT32 SRC0 : 1;
+ UINT32 SRC1 : 1;
+ UINT32 SRC2 : 1;
+ UINT32 SRC3 : 1;
+ UINT32 SRC4 : 1;
+ UINT32 SRC5 : 1;
+ UINT32 SRC6 : 1;
+ UINT32 SRC7 : 1;
+ UINT32 CSI_SRC8 : 1;
+ UINT32 CSI_DP : 1;
+ UINT32 PEG_A : 1;
+ UINT32 PEG_B : 1;
+ UINT32 DMI : 1;
+ UINT32 Reserved3 : 3;
+ } Fields;
+} ICC_CLOCK_ENABLES_CONTROL_MASK;
+
+typedef enum {
+ LOCK_ICC_REGISTERS = 0x2,
+ SET_CLOCK_ENABLES = 0x3,
+ GET_ICC_PROFILE = 0x4,
+ SET_ICC_PROFILE = 0x5,
+ GET_ICC_CLOCKS_CAPABILITIES = 0x6,
+ GET_OEM_CLOCK_RANGE_DEFINITION_RECORD = 0x7,
+ GET_ICC_RECORD = 0x8,
+ READ_ICC_REGISTER = 0x9,
+ WRITE_ICC_REGISTER = 0xa,
+ WRITE_UOB_RECORD = 0xb,
+ READ_MPHY_SETTINGS = 0xe,
+ WRITE_MPHY_SETTINGS = 0xf
+} ICC_MEI_COMMAND_ID;
+
+typedef struct {
+ UINT32 ApiVersion;
+ ICC_MEI_COMMAND_ID IccCommand;
+ ICC_MEI_CMD_STATUS IccResponse;
+ UINT32 BufferLength;
+ UINT32 Reserved;
+} ICC_HEADER;
+
+typedef struct {
+ ICC_HEADER Header;
+} ICC_GET_PROFILE_MESSAGE;
+
+typedef struct {
+ ICC_HEADER Header;
+ UINT8 SupportedProfilesNumber;
+ UINT8 IccProfileSoftStrap;
+ UINT8 IccProfileIndex;
+ UINT8 Padding;
+} ICC_GET_PROFILE_RESPONSE;
+
+typedef union {
+ ICC_GET_PROFILE_MESSAGE message;
+ ICC_GET_PROFILE_RESPONSE response;
+} ICC_GET_PROFILE_BUFFER;
+
+typedef struct {
+ ICC_HEADER Header;
+ UINT8 ProfileBIOS;
+ UINT8 PaddingA;
+ UINT16 PaddingB;
+} ICC_SET_PROFILE_MESSAGE;
+
+typedef struct {
+ ICC_HEADER Header;
+} ICC_SET_PROFILE_RESPONSE;
+
+typedef union {
+ ICC_SET_PROFILE_MESSAGE message;
+ ICC_SET_PROFILE_RESPONSE response;
+} ICC_SET_PROFILE_BUFFER;
+
+typedef struct {
+ ICC_HEADER Header;
+ UINT32 ClockEnables;
+ UINT32 ClockEnablesMask;
+ UINT32 Params;
+} ICC_SET_CLK_ENABLES_MESSAGE;
+
+typedef struct {
+ ICC_HEADER Header;
+} ICC_SET_CLK_ENABLES_RESPONSE;
+
+typedef union {
+ ICC_SET_CLK_ENABLES_MESSAGE message;
+ ICC_SET_CLK_ENABLES_RESPONSE response;
+} ICC_SET_CLK_ENABLES_BUFFER;
+
+typedef struct {
+ ICC_HEADER Header;
+} ICC_GET_CLK_CAPABILITIES_MESSAGE;
+
+typedef struct {
+ ICC_HEADER Header;
+ UINT32 VersionNumber;
+ UINT8 IccHwSku;
+ UINT8 Reserved;
+ UINT16 MaxSusramRecordSize;
+ UINT64 IccSkuEnforcementTable;
+ UINT32 IccBootStatusReport;
+} ICC_GET_CLK_CAPABILITIES_RESPONSE;
+
+typedef union {
+ ICC_GET_CLK_CAPABILITIES_MESSAGE message;
+ ICC_GET_CLK_CAPABILITIES_RESPONSE response;
+} ICC_GET_CLK_CAPABILITIES_BUFFER;
+
+#define ICC_RESPONSE_MODE_WAIT 0
+#define ICC_RESPONSE_MODE_SKIP 1
+#define ICC_LOCK_ACCESS_MODE_SET 0
+#define ICC_LOCK_ACCESS_MODE_GET 1
+#define ICC_LOCK_MASK_COUNT 255
+#define WRITE_ICC_REG_BUNDLE_COUNT 1 ///< 1 bundle for 1 DWORD register write
+#define ADDRESS_MASK_FIXED_DATA 0x00017F01 ///< Target ID = 7F (Aux), MWM = 1(16 bits)
+#define WRITE_ICC_RECORD_FLAGS 0x00012010 ///< 16 byte record length, No param section, valid bit
+
+typedef struct _ICC_REG_BUNDLES
+{
+ UINT32 BundlesCnt :16; ///< Bundles Count - number of Address Mask entries
+ UINT32 AU :1; ///< AU=1 -> All regisaters are Unlocked
+ UINT32 Reserved :15;
+} ICC_REG_BUNDLES;
+
+typedef struct {
+ ICC_REG_BUNDLES RegBundles;
+ UINT32 RegMask[ICC_LOCK_MASK_COUNT];
+} ICC_LOCK_REGS_INFO;
+
+typedef struct {
+ ICC_HEADER Header;
+ UINT8 AccessMode;
+ UINT8 Parameters;
+ UINT8 Reserved[2];
+ ICC_LOCK_REGS_INFO LockRegInfo;
+} ICC_LOCK_REGISTERS_MESSAGE;
+
+typedef struct {
+ ICC_HEADER Header;
+ UINT32 Reserved;
+ ICC_LOCK_REGS_INFO LockRegInfo;
+} ICC_LOCK_REGISTERS_RESPONSE;
+
+typedef union {
+ ICC_LOCK_REGISTERS_MESSAGE message;
+ ICC_LOCK_REGISTERS_RESPONSE response;
+} ICC_LOCK_REGISTERS_BUFFER;
+
+typedef union _ICC_ADDRESS_MASK
+{
+ UINT32 AddressMaskData;
+ struct
+ {
+ UINT32 MaskWidthModifier :2;
+ UINT32 Offset :6;
+ UINT32 TargetId :7;
+ UINT32 Reserved :1;
+ }Fields;
+} ICC_ADDRESS_MASK;
+
+typedef struct _ICC_DWORD_RECORD
+{
+ UINT32 RecordFlags;
+ ICC_REG_BUNDLES BundleCount;
+ ICC_ADDRESS_MASK AddressMask;
+ UINT32 RegValue;
+} ICC_RECORD_DWORD;
+
+typedef struct {
+ ICC_HEADER Header;
+ UINT16 Reserved;
+ UINT8 Params;
+ UINT8 Reserved1;
+ ICC_RECORD_DWORD RecordDword;
+} ICC_WRITE_ICC_REG_DWORD_MESSAGE;
+
+typedef struct {
+ ICC_HEADER Header;
+ UINT16 BytesProcessed;
+ UINT16 Reserved;
+} ICC_WRITE_ICC_REG_DWORD_RESPONSE;
+
+typedef union {
+ ICC_WRITE_ICC_REG_DWORD_MESSAGE message;
+ ICC_WRITE_ICC_REG_DWORD_RESPONSE response;
+} ICC_WRITE_ICC_REG_BUFFER;
+
+//
+// SPI MEI Messages
+//
+#define HMRFPO_ENABLE_CMD_ID 0x01
+#define HMRFPO_LOCK_CMD_ID 0x02
+#define HMRFPO_GET_STATUS_CMD_ID 0x03
+
+typedef enum {
+ HMRFPO_ENABLE_SUCCESS = 0,
+ HMRFPO_ENABLE_LOCKED,
+ HMRFPO_NVAR_FAILURE,
+ HMRFOP_ATP_POLICY,
+ HMRFPO_ENABLE_UNKNOWN_FAILURE
+} HMRFPO_ENABLE_STATUS;
+
+typedef struct _MKHI_HMRFPO_ENABLE {
+ MKHI_MESSAGE_HEADER MkhiHeader;
+ UINT64 Nonce;
+} MKHI_HMRFPO_ENABLE;
+
+typedef struct _HMRFPO_ENABLE {
+ HECI_MESSAGE_HEADER Header;
+ MKHI_HMRFPO_ENABLE Msg;
+} HMRFPO_ENABLE;
+
+typedef struct _MKHI_HMRFPO_ENABLE_RESPONSE {
+ MKHI_MESSAGE_HEADER MkhiHeader;
+ UINT32 FactoryDefaultBase;
+ UINT32 FactoryDefaultLimit;
+ UINT8 Status;
+ UINT8 Rsvd[3];
+} MKHI_HMRFPO_ENABLE_RESPONSE;
+
+typedef struct _HMRFPO_ENABLE_RESPONSE {
+ HECI_MESSAGE_HEADER Header;
+ MKHI_HMRFPO_ENABLE_RESPONSE Msg;
+} HMRFPO_ENABLE_RESPONSE;
+
+typedef enum {
+ HMRFPO_LOCK_SUCCESS = 0,
+ HMRFPO_LOCK_FAILURE
+} HMRFPO_LOCK_STATUS;
+
+typedef struct _MKHI_HMRFPO_LOCK {
+ MKHI_MESSAGE_HEADER MkhiHeader;
+} MKHI_HMRFPO_LOCK;
+
+typedef struct _HMRFPO_LOCK {
+ HECI_MESSAGE_HEADER Header;
+ MKHI_HMRFPO_LOCK Msg;
+} HMRFPO_LOCK;
+
+typedef struct _MKHI_HMRFPO_LOCK_RESPONSE {
+ MKHI_MESSAGE_HEADER MkhiHeader;
+ UINT64 Nonce;
+ UINT32 FactoryDefaultBase;
+ UINT32 FactoryDefaultLimit;
+ UINT8 Status;
+ UINT8 Reserved[3];
+} MKHI_HMRFPO_LOCK_RESPONSE;
+
+typedef struct _HMRFPO_LOCK_RESPONSE {
+ HECI_MESSAGE_HEADER Header;
+ MKHI_HMRFPO_LOCK_RESPONSE Data;
+} HMRFPO_LOCK_RESPONSE;
+
+typedef struct _MKHI_HMRFPO_GET_STATUS {
+ MKHI_MESSAGE_HEADER MkhiHeader;
+} MKHI_HMRFPO_GET_STATUS;
+
+typedef struct _HMRFPO_GET_STATUS {
+ HECI_MESSAGE_HEADER Header;
+ MKHI_HMRFPO_GET_STATUS Msg;
+} HMRFPO_GET_STATUS;
+
+typedef struct _MKHI_HMRFPO_GET_STATUS_RESPONSE {
+ MKHI_MESSAGE_HEADER MkhiHeader;
+ UINT8 Status;
+ UINT8 Reserved[3];
+} MKHI_HMRFPO_GET_STATUS_RESPONSE;
+
+typedef struct _HMRFPO_GET_STATUS_RESPONSE {
+ HECI_MESSAGE_HEADER Header;
+ MKHI_HMRFPO_GET_STATUS_RESPONSE Data;
+} HMRFPO_GET_STATUS_RESPONSE;
+
+#define HMRFPO_LOCKED 1
+#define HMRFPO_ENABLED 2
+
+//
+// ME State Control
+//
+#define EFI_ME_STATE_STALL_1_SECOND 1000000
+#define EFI_ME_STATE_MAX_TIMEOUT 20
+//
+// KVM support
+//
+#define EFI_KVM_MESSAGE_COMMAND 0x08
+#define EFI_KVM_BYTE_COUNT 0x06
+#define EFI_KVM_QUERY_REQUES 0x01
+#define EFI_KVM_QUERY_RESPONSE 0x02
+#define EFI_KVM_VERSION 0x10
+
+#define EFI_KVM_STALL_1_SECOND 1000000 ///< Stall 1 second
+#define EFI_KVM_MAX_WAIT_TIME (60 * 8) ///< 8 Mins
+typedef enum {
+ QUERY_REQUEST = 0,
+ CANCEL_REQUEST
+} QUERY_TYPE;
+
+typedef struct _AMT_QUERY_KVM_REQUEST {
+ UINT8 Command;
+ UINT8 ByteCount;
+ UINT8 SubCommand;
+ UINT8 VersionNumber;
+ UINT32 QueryType;
+} AMT_QUERY_KVM_REQUEST;
+
+typedef enum {
+ KVM_SESSION_ESTABLISHED = 1,
+ KVM_SESSION_CANCELLED
+} RESPONSE_CODE;
+
+typedef struct _AMT_QUERY_KVM_RESPONSE {
+ UINT8 Command;
+ UINT8 ByteCount;
+ UINT8 SubCommand;
+ UINT8 VersionNumber;
+ UINT32 ResponseCode;
+} AMT_QUERY_KVM_RESPONSE;
+
+///
+/// ME Memory Debug support
+///
+typedef struct _SET_DEBUG_MEMORY_DATA {
+ UINT32 BiosDebugMemoryAddress;
+ UINT32 BiosDebugMemorySize;
+ UINT32 MeVeDebugMemoryAddress;
+ UINT32 MeVeDebugMemorySize;
+} SET_DEBUG_MEMORY_DATA;
+
+typedef struct _GEN_SET_DEBUG_MEMORY {
+ MKHI_MESSAGE_HEADER MKHIHeader;
+ SET_DEBUG_MEMORY_DATA Data;
+} GEN_SET_DEBUG_MEMORY;
+
+typedef struct _GEN_SET_DEBUG_MEMORY_ACK {
+ MKHI_MESSAGE_HEADER Header;
+} GEN_SET_DEBUG_MEMORY_ACK;
+
+//
+// BIOS MDES messaging
+//
+#define MDES_BIOS_MSG_LOG_REQ_CMD 0x0B
+#define MDES_BIOS_MSG_GET_CONFIG_CMD 0x0C
+
+typedef struct _MDES_ATTR {
+ UINT16 Severity : 2;
+ UINT16 PayLoadType : 6;
+ UINT16 Reserved : 8;
+} MDES_ATTR;
+
+typedef struct _BIOS_ATTR {
+ UINT16 CallerIdData : 1;
+ UINT16 ExtendedDataHeader : 1;
+ UINT16 Reserved : 14;
+} BIOS_ATTR;
+
+typedef struct {
+ UINT16 HeaderSize;
+ UINT16 Size;
+ EFI_GUID Type;
+} MDES_EXTENDED_DATA_HEADER;
+
+#define SIZE_OF_MDES_EXTENDED_DATA (2048 - \
+ ( \
+ 16 + sizeof (MDES_ATTR) + sizeof (BIOS_ATTR) + sizeof (EFI_GUID) + sizeof (MDES_EXTENDED_DATA_HEADER) + \
+ sizeof (MKHI_MESSAGE_HEADER) \
+ ) \
+ )
+
+typedef struct _CBM_BIOS_MDES_MSG_DATA {
+ MDES_ATTR MdesAttr;
+ BIOS_ATTR BiosAttr;
+ UINT32 Serial;
+ UINT32 StatusType;
+ UINT32 StatusCode;
+ UINT32 Instance;
+ EFI_GUID CallerId;
+ MDES_EXTENDED_DATA_HEADER ExtendedDataHeader;
+ UINT8 ExtendedData[SIZE_OF_MDES_EXTENDED_DATA];
+} CBM_BIOS_MDES_MSG_DATA;
+
+typedef struct _CBM_BIOS_MDES_MSG_REQ {
+ MKHI_MESSAGE_HEADER MKHIHeader;
+ CBM_BIOS_MDES_MSG_DATA Data;
+} CBM_BIOS_MDES_MSG_REQ;
+
+typedef struct _MKHI_CBM_BIOS_MDES_MSG_REQ {
+ HECI_MESSAGE_HEADER Header;
+ CBM_BIOS_MDES_MSG_REQ Msg;
+} MKHI_CBM_BIOS_MDES_MSG_REQ;
+
+typedef struct _MKHI_CBM_BIOS_MDES_MSG_GET_CONFIG_REQ {
+ MKHI_MESSAGE_HEADER MKHIHeader;
+} MKHI_CBM_BIOS_MDES_MSG_GET_CONFIG_REQ;
+
+typedef union _MDES_BIOS_FLAGS {
+ volatile UINT32 ul;
+ struct {
+ UINT32 MdesEnabled : 1; ///< High level indication if MDES is enabled
+ UINT32 MdesLogPaused : 1; ///< A caller paused MDES logging as part of the log retrieval process
+ UINT32 LanInterfaceEnabled : 1; ///< The user configuration has enabled the LAN debug interface
+ UINT32 SmbusInterfaceEnabled : 1; ///< The user configuration has enabled the SMBus debug interface
+ UINT32 PramLogEnabled : 1; ///< The user configuration has enabled the PRAM debug log
+ UINT32 FlashLogEnabled : 1; ///< The user configuration has enabled the flash error log
+ UINT32 MdesBlockingModeEn : 1; ///< Set to 0 when operating in buffered mode, set to 1 when MDES blocks the caller until the event is dispatched.
+ UINT32 Reserved7 : 2;
+ UINT32 SensitiveMsgEnabled : 1; ///< Set to 1 to indicate Sensitive messages are enabled
+ UINT32 DescriptorUnlocked : 1; ///< Set when FW reads all regions are unlocked. Enables 'none' sensitivity messages.
+ UINT32 MdesPolicyEnabled : 1; ///< Set to 1 to indicate MDES is enabled due to BIOS sending the enable message (on current or previous boot)
+ UINT32 MdesEnableRcvdFromBios : 1; ///< BIOS has sent the MDES policy to 'enabled' via a MKHI message on this current boot
+ UINT32 Reserved13 : 19;
+ } fl;
+} MDES_BIOS_FLAGS;
+
+typedef struct _CBM_BIOS_MDES_MSG_GET_CONFIG_DATA {
+ MDES_BIOS_FLAGS Flags;
+ UINT32 BiosEventFilters;
+} CBM_BIOS_MDES_MSG_GET_CONFIG_DATA;
+
+typedef struct _MKHI_CBM_BIOS_MDES_MSG_GET_CONFIG_ACK {
+ MKHI_MESSAGE_HEADER Header;
+ CBM_BIOS_MDES_MSG_GET_CONFIG_DATA Data;
+} MKHI_CBM_BIOS_MDES_MSG_GET_CONFIG_ACK;
+
+#pragma pack()
+
+#endif
diff --git a/ReferenceCode/ME/Library/MeKernel/include/MeAccess.h b/ReferenceCode/ME/Library/MeKernel/include/MeAccess.h
new file mode 100644
index 0000000..6a7c16d
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeKernel/include/MeAccess.h
@@ -0,0 +1,338 @@
+/** @file
+ Macros to simplify and abstract the interface to PCI configuration.
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _ME_ACCESS_H_
+#define _ME_ACCESS_H_
+
+#include "MeChipset.h"
+#include "PchAccess.h"
+
+///
+/// HECI PCI Access Macro
+///
+#define HeciPciRead32(Register) PciRead32 (PCI_LIB_ADDRESS (ME_BUS, ME_DEVICE_NUMBER, HECI_FUNCTION_NUMBER, Register))
+
+#define HeciPciWrite32(Register, Data) \
+ PciWrite32 ( \
+ PCI_LIB_ADDRESS (ME_BUS, \
+ ME_DEVICE_NUMBER, \
+ HECI_FUNCTION_NUMBER, \
+ Register), \
+ (UINT32) Data \
+ )
+
+#define HeciPciOr32(Register, Data) \
+ PciOr32 ( \
+ PCI_LIB_ADDRESS (ME_BUS, \
+ ME_DEVICE_NUMBER, \
+ HECI_FUNCTION_NUMBER, \
+ Register), \
+ (UINT32) Data \
+ )
+
+#define HeciPciAnd32(Register, Data) \
+ PciAnd32 ( \
+ PCI_LIB_ADDRESS (ME_BUS, \
+ ME_DEVICE_NUMBER, \
+ HECI_FUNCTION_NUMBER, \
+ Register), \
+ (UINT32) Data \
+ )
+
+#define HeciPciAndThenOr32(Register, AndData, OrData) \
+ PciAndThenOr32 ( \
+ PCI_LIB_ADDRESS (ME_BUS, \
+ ME_DEVICE_NUMBER, \
+ HECI_FUNCTION_NUMBER, \
+ Register), \
+ (UINT32) AndData, \
+ (UINT32) OrData \
+ )
+
+#define HeciPciRead16(Register) PciRead16 (PCI_LIB_ADDRESS (ME_BUS, ME_DEVICE_NUMBER, HECI_FUNCTION_NUMBER, Register))
+
+#define HeciPciWrite16(Register, Data) \
+ PciWrite16 ( \
+ PCI_LIB_ADDRESS (ME_BUS, \
+ ME_DEVICE_NUMBER, \
+ HECI_FUNCTION_NUMBER, \
+ Register), \
+ (UINT16) Data \
+ )
+
+#define HeciPciOr16(Register, Data) \
+ PciOr16 ( \
+ PCI_LIB_ADDRESS (ME_BUS, \
+ ME_DEVICE_NUMBER, \
+ HECI_FUNCTION_NUMBER, \
+ Register), \
+ (UINT16) Data \
+ )
+
+#define HeciPciAnd16(Register, Data) \
+ PciAnd16 ( \
+ PCI_LIB_ADDRESS (ME_BUS, \
+ ME_DEVICE_NUMBER, \
+ HECI_FUNCTION_NUMBER, \
+ Register), \
+ (UINT16) Data \
+ )
+
+#define HeciPciAndThenOr16(Register, AndData, OrData) \
+ PciAndThenOr16 ( \
+ PCI_LIB_ADDRESS (ME_BUS, \
+ ME_DEVICE_NUMBER, \
+ HECI_FUNCTION_NUMBER, \
+ Register), \
+ (UINT16) AndData, \
+ (UINT16) OrData \
+ )
+
+#define HeciPciRead8(Register) PciRead8 (PCI_LIB_ADDRESS (ME_BUS, ME_DEVICE_NUMBER, HECI_FUNCTION_NUMBER, Register))
+
+#define HeciPciWrite8(Register, Data) \
+ PciWrite8 ( \
+ PCI_LIB_ADDRESS (ME_BUS, \
+ ME_DEVICE_NUMBER, \
+ HECI_FUNCTION_NUMBER, \
+ Register), \
+ (UINT8) Data \
+ )
+
+#define HeciPciOr8(Register, Data) \
+ PciOr8 ( \
+ PCI_LIB_ADDRESS (ME_BUS, \
+ ME_DEVICE_NUMBER, \
+ HECI_FUNCTION_NUMBER, \
+ Register), \
+ (UINT8) Data \
+ )
+
+#define HeciPciAnd8(Register, Data) \
+ PciAnd8 ( \
+ PCI_LIB_ADDRESS (ME_BUS, \
+ ME_DEVICE_NUMBER, \
+ HECI_FUNCTION_NUMBER, \
+ Register), \
+ (UINT8) Data \
+ )
+
+#define HeciPciAndThenOr8(Register, AndData, OrData) \
+ PciAndThenOr8 ( \
+ PCI_LIB_ADDRESS (ME_BUS, \
+ ME_DEVICE_NUMBER, \
+ HECI_FUNCTION_NUMBER, \
+ Register), \
+ (UINT8) AndData, \
+ (UINT8) OrData \
+ )
+
+///
+/// HECI2 PCI Access Macro
+///
+#define Heci2PciRead32(Register) PciRead32 (PCI_LIB_ADDRESS (ME_BUS, ME_DEVICE_NUMBER, HECI2_FUNCTION_NUMBER, Register))
+
+#define Heci2PciWrite32(Register, Data) \
+ PciWrite32 ( \
+ PCI_LIB_ADDRESS (ME_BUS, \
+ ME_DEVICE_NUMBER, \
+ HECI2_FUNCTION_NUMBER, \
+ Register), \
+ (UINT32) Data \
+ )
+
+#define Heci2PciOr32(Register, Data) \
+ PciOr32 ( \
+ PCI_LIB_ADDRESS (ME_BUS, \
+ ME_DEVICE_NUMBER, \
+ HECI2_FUNCTION_NUMBER, \
+ Register), \
+ (UINT32) Data \
+ )
+
+#define Heci2PciAnd32(Register, Data) \
+ PciAnd32 ( \
+ PCI_LIB_ADDRESS (ME_BUS, \
+ ME_DEVICE_NUMBER, \
+ HECI2_FUNCTION_NUMBER, \
+ Register), \
+ (UINT32) Data \
+ )
+
+#define Heci2PciAndThenOr32(Register, AndData, OrData) \
+ PciAndThenOr32 ( \
+ PCI_LIB_ADDRESS (ME_BUS, \
+ ME_DEVICE_NUMBER, \
+ HECI2_FUNCTION_NUMBER, \
+ Register), \
+ (UINT32) AndData, \
+ (UINT32) OrData \
+ )
+
+#define Heci2PciRead16(Register) PciRead16 (PCI_LIB_ADDRESS (ME_BUS, ME_DEVICE_NUMBER, HECI2_FUNCTION_NUMBER, Register))
+
+#define Heci2PciWrite16(Register, Data) \
+ PciWrite16 ( \
+ PCI_LIB_ADDRESS (ME_BUS, \
+ ME_DEVICE_NUMBER, \
+ HECI2_FUNCTION_NUMBER, \
+ Register), \
+ (UINT16) Data \
+ )
+
+#define Heci2PciOr16(Register, Data) \
+ PciOr16 ( \
+ PCI_LIB_ADDRESS (ME_BUS, \
+ ME_DEVICE_NUMBER, \
+ HECI2_FUNCTION_NUMBER, \
+ Register), \
+ (UINT16) Data \
+ )
+
+#define Heci2PciAnd16(Register, Data) \
+ PciAnd16 ( \
+ PCI_LIB_ADDRESS (ME_BUS, \
+ ME_DEVICE_NUMBER, \
+ HECI2_FUNCTION_NUMBER, \
+ Register), \
+ (UINT16) Data \
+ )
+
+#define Heci2PciAndThenOr16(Register, AndData, OrData) \
+ PciAndThenOr16 ( \
+ PCI_LIB_ADDRESS (ME_BUS, \
+ ME_DEVICE_NUMBER, \
+ HECI2_FUNCTION_NUMBER, \
+ Register), \
+ (UINT16) AndData, \
+ (UINT16) OrData \
+ )
+
+#define Heci2PciRead8(Register) PciRead8 (PCI_LIB_ADDRESS (ME_BUS, ME_DEVICE_NUMBER, HECI2_FUNCTION_NUMBER, Register))
+
+#define Heci2PciWrite8(Register, Data) \
+ PciWrite8 ( \
+ PCI_LIB_ADDRESS (ME_BUS, \
+ ME_DEVICE_NUMBER, \
+ HECI2_FUNCTION_NUMBER, \
+ Register), \
+ (UINT8) Data \
+ )
+
+#define Heci2PciOr8(Register, Data) \
+ PciOr8 ( \
+ PCI_LIB_ADDRESS (ME_BUS, \
+ ME_DEVICE_NUMBER, \
+ HECI2_FUNCTION_NUMBER, \
+ Register), \
+ (UINT8) Data \
+ )
+
+#define Heci2PciAnd8(Register, Data) \
+ PciAnd8 ( \
+ PCI_LIB_ADDRESS (ME_BUS, \
+ ME_DEVICE_NUMBER, \
+ HECI2_FUNCTION_NUMBER, \
+ Register), \
+ (UINT8) Data \
+ )
+
+#define Heci2PciAndThenOr8(Register, AndData, OrData) \
+ PciAndThenOr8 ( \
+ PCI_LIB_ADDRESS (ME_BUS, \
+ ME_DEVICE_NUMBER, \
+ HECI2_FUNCTION_NUMBER, \
+ Register), \
+ (UINT8) AndData, \
+ (UINT8) OrData \
+ )
+
+#ifndef MmPciAddress
+#define MmPciAddress(Segment, Bus, Device, Function, Register) \
+ ( \
+ (UINTN) (PciRead32 (PCI_LIB_ADDRESS (0,0,0,0x60)) & 0xFC000000) + \
+ (UINTN) (Bus << 20) + (UINTN) (Device << 15) + (UINTN) \
+ (Function << 12) + (UINTN) (Register) \
+ )
+#endif
+///
+/// ME Macro Setting
+///
+#define McD0PciCfg64(Register) MmPci64 (0, SA_MC_BUS, 0, 0, Register)
+#define McD0PciCfg32And(Register, AndData) PciAnd32 (PCI_LIB_ADDRESS (SA_MC_BUS, 0, 0, Register), (UINT32) AndData)
+#define McD0PciCfg16And(Register, AndData) PciAnd16 (PCI_LIB_ADDRESS (SA_MC_BUS, 0, 0, Register), (UINT16) AndData)
+
+///
+/// MMIO access macros
+///
+#define MmioAddress(BaseAddr, Register) ((UINTN) BaseAddr + (UINTN) (Register))
+
+///
+/// 16 bit MMIO access
+///
+#define Mmio16Ptr(BaseAddr, Register) ((volatile UINT16 *) MmioAddress (BaseAddr, Register))
+
+#define Mmio16(BaseAddr, Register) *Mmio16Ptr (BaseAddr, Register)
+
+#define Mmio16Or(BaseAddr, Register, OrData) \
+ Mmio16 (BaseAddr, Register) = (UINT16) \
+ (Mmio16 (BaseAddr, Register) | (UINT16) (OrData))
+
+#define Mmio16And(BaseAddr, Register, AndData) \
+ Mmio16 (BaseAddr, Register) = (UINT16) \
+ (Mmio16 (BaseAddr, Register) & (UINT16) (AndData))
+
+#define Mmio16AndThenOr(BaseAddr, Register, AndData, OrData) \
+ Mmio16 (BaseAddr, Register) = (UINT16) \
+ ((Mmio16 (BaseAddr, Register) & (UINT16) (AndData)) | (UINT16) (OrData))
+
+///
+/// 32 bit MMIO access
+///
+#define Mmio32Ptr(BaseAddr, Register) ((volatile UINT32 *) MmioAddress (BaseAddr, Register))
+
+#define Mmio32(BaseAddr, Register) *Mmio32Ptr (BaseAddr, Register)
+
+#define Mmio32Or(BaseAddr, Register, OrData) \
+ Mmio32 (BaseAddr, Register) = (UINT32) \
+ (Mmio32 (BaseAddr, Register) | (UINT32) (OrData))
+
+#define Mmio32And(BaseAddr, Register, AndData) \
+ Mmio32 (BaseAddr, Register) = (UINT32) \
+ (Mmio32 (BaseAddr, Register) & (UINT32) (AndData))
+
+#define Mmio32AndThenOr(BaseAddr, Register, AndData, OrData) \
+ Mmio32 (BaseAddr, Register) = (UINT32) \
+ ((Mmio32 (BaseAddr, Register) & (UINT32) (AndData)) | (UINT32) (OrData))
+
+///
+/// Memory Controller PCI access macros
+///
+#define MCH_REGION_BASE (McD0PciCfg64 (MC_MCHBAR_OFFSET) &~BIT0)
+#define McMmioAddress(Register) ((UINTN) MCH_REGION_BASE + (UINTN) (Register))
+
+#define McMmio8Ptr(Register) ((volatile UINT8 *) McMmioAddress (Register))
+#define McMmio8(Register) *McMmio8Ptr (Register)
+#define McMmio8Or(Register, OrData) (McMmio8 (Register) |= (UINT8) (OrData))
+#define McMmio8And(Register, AndData) (McMmio8 (Register) &= (UINT8) (AndData))
+#define McMmio8AndThenOr(Register, AndData, OrData) \
+ (McMmio8 (Register) = (McMmio8 (Register) & (UINT8) (AndData)) | (UINT8) (OrData))
+
+#endif
diff --git a/ReferenceCode/ME/Library/MeKernel/include/MeChipset.h b/ReferenceCode/ME/Library/MeKernel/include/MeChipset.h
new file mode 100644
index 0000000..f18ac61
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeKernel/include/MeChipset.h
@@ -0,0 +1,196 @@
+/** @file
+ Chipset definition for ME Devices.
+
+ Conventions:
+
+ - Prefixes:
+ Definitions beginning with "R_" are registers
+ Definitions beginning with "B_" are bits within registers
+ Definitions beginning with "V_" are meaningful values of bits within the registers
+ Definitions beginning with "S_" are register sizes
+ Definitions beginning with "N_" are the bit position
+ - In general, ME registers are denoted by "_ME_" in register names
+ - Registers / bits that are different between ME generations are denoted by
+ "_ME_<generation_name>_" in register/bit names. e.g., "_ME_CPT_"
+ - Registers / bits that are different between SKUs are denoted by "_<SKU_name>"
+ at the end of the register/bit names
+ - Registers / bits of new devices introduced in a ME generation will be just named
+ as "_ME_" without <generation_name> inserted.
+
+@copyright
+ Copyright (c) 2011 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _ME_CHIPSET_H_
+#define _ME_CHIPSET_H_
+
+#include "MeChipsetLib.h"
+
+#define ME_BUS 0
+#define ME_DEVICE_NUMBER 22
+
+#define HECI_FUNCTION_NUMBER 0x00
+#define HECI2_FUNCTION_NUMBER 0x01
+#define IDER_FUNCTION_NUMBER 0x02
+#define SOL_FUNCTION_NUMBER 0x03
+
+#define IDER_BUS_NUMBER ME_BUS
+#define IDER_DEVICE_NUMBER ME_DEVICE_NUMBER
+#define SOL_BUS_NUMBER ME_BUS
+#define SOL_DEVICE_NUMBER ME_DEVICE_NUMBER
+#define HECI_DEV_FCN ((ME_DEVICE_NUMBER) << 3 | (HECI_FUNCTION_NUMBER))
+#define HECI2_DEV_FCN ((ME_DEVICE_NUMBER) << 3 | (HECI2_FUNCTION_NUMBER))
+
+///
+/// Default Vendor ID and Device ID
+///
+#define V_INTEL_VENDOR_ID 0x8086
+
+#define V_ME_HECI_VENDOR_ID V_INTEL_VENDOR_ID
+#define V_ME_IDER_VENDOR_ID V_INTEL_VENDOR_ID
+#define V_ME_SOL_VENDOR_ID V_INTEL_VENDOR_ID
+
+#define V_ME_HECI_DEVICE_ID 0x8C3A
+#define V_ME_HECI2_DEVICE_ID 0x8C3B
+#define V_ME_IDER_DEVICE_ID 0x8C3C
+#define V_ME_SOL_DEVICE_ID 0x8C3D
+
+#define V_ME_LPTLP_HECI_DEVICE_ID 0x9C3A
+#define V_ME_LPTLP_HECI2_DEVICE_ID 0x9C3B
+#define V_ME_LPTLP_IDER_DEVICE_ID 0x9C3C
+#define V_ME_LPTLP_SOL_DEVICE_ID 0x9C3D
+
+#define R_ME_HFS 0x40
+#define R_ME_MISC_SHDW 0x44
+#define R_ME_GS_SHDW 0x48
+#define R_ME_HFS_4 0x64
+#define R_ME_HFS_5 0x68
+#define R_ME_HFS_6 0x6C
+#define B_BOOT_GUARD_ENF_MASK 0x0200
+#define B_TPM_DISCONNECT 0x1000
+#define B_TPM1_2_DEACTIVATED 0x0100
+
+#define R_ME_H_GS 0x4C
+#define B_ME_DID_RAPID_START_BIT BIT23
+#define B_ME_DID_TYPE_MASK BIT28
+#define R_ME_H_GS2 0x70
+#define B_ME_MBP_GIVE_UP BIT0
+#define R_ME_HERS 0xBC
+#define B_ME_EXTEND_REG_VALID BIT31
+#define B_ME_EXTEND_REG_ALGORITHM (BIT0 | BIT1 | BIT2 | BIT3)
+#define V_ME_SHA_1 0x00
+#define V_ME_SHA_256 0x02
+#define R_ME_HER1 0xC0
+#define R_ME_HER2 0xC4
+#define R_ME_HER3 0xC8
+#define R_ME_HER4 0xCC
+#define R_ME_HER5 0xD0
+#define R_ME_HER6 0xD4
+#define R_ME_HER7 0xD8
+#define R_ME_HER8 0xDC
+
+///
+/// ME-related Chipset Definition
+///
+#define HeciEnable() MeDeviceControl (HECI1, Enabled);
+#define Heci2Enable() MeDeviceControl (HECI2, Enabled);
+#define IderEnable() MeDeviceControl (IDER, Enabled);
+#define SolEnable() MeDeviceControl (SOL, Enabled);
+#define Usbr1Enable() MeDeviceControl (USBR1, Enabled);
+#define Usbr2Enable() MeDeviceControl (USBR2, Enabled);
+
+#define HeciDisable() MeDeviceControl (HECI1, Disabled);
+#define Heci2Disable() MeDeviceControl (HECI2, Disabled);
+#define IderDisable() MeDeviceControl (IDER, Disabled);
+#define SolDisable() MeDeviceControl (SOL, Disabled);
+#define Usbr1Disable() MeDeviceControl (USBR1, Disabled);
+#define Usbr2Disable() MeDeviceControl (USBR2, Disabled);
+#define DisableAllMEDevices() \
+ HeciDisable (); \
+ Heci2Disable (); \
+ IderDisable (); \
+ SolDisable ();
+
+#define IS_PCH_LPTH_HECI_DEVICE_ID(DeviceId) \
+ ( \
+ (DeviceId == V_ME_HECI_DEVICE_ID) \
+ )
+
+#define IS_PCH_LPTLP_HECI_DEVICE_ID(DeviceId) \
+ ( \
+ (DeviceId == V_ME_LPTLP_HECI_DEVICE_ID) \
+ )
+
+#define IS_PCH_LPT_HECI_DEVICE_ID(DeviceId) \
+ ( \
+ IS_PCH_LPTH_HECI_DEVICE_ID(DeviceId) || \
+ IS_PCH_LPTLP_HECI_DEVICE_ID(DeviceId) \
+ )
+
+#define IS_PCH_LPTH_HECI2_DEVICE_ID(DeviceId) \
+ ( \
+ (DeviceId == V_ME_HECI2_DEVICE_ID) \
+ )
+
+#define IS_PCH_LPTLP_HECI2_DEVICE_ID(DeviceId) \
+ ( \
+ (DeviceId == V_ME_LPTLP_HECI2_DEVICE_ID) \
+ )
+
+#define IS_PCH_LPT_HECI2_DEVICE_ID(DeviceId) \
+ ( \
+ IS_PCH_LPTH_HECI2_DEVICE_ID(DeviceId) || \
+ IS_PCH_LPTLP_HECI2_DEVICE_ID(DeviceId) \
+ )
+
+#define IS_PCH_LPTH_IDER_DEVICE_ID(DeviceId) \
+ ( \
+ (DeviceId == V_ME_IDER_DEVICE_ID) \
+ )
+
+#define IS_PCH_LPTLP_IDER_DEVICE_ID(DeviceId) \
+ ( \
+ (DeviceId == V_ME_LPTLP_IDER_DEVICE_ID) \
+ )
+
+#define IS_PCH_LPT_IDER_DEVICE_ID(DeviceId) \
+ ( \
+ IS_PCH_LPTH_IDER_DEVICE_ID(DeviceId) || \
+ IS_PCH_LPTLP_IDER_DEVICE_ID(DeviceId) \
+ )
+
+#define IS_PCH_LPTH_SOL_DEVICE_ID(DeviceId) \
+ ( \
+ (DeviceId == V_ME_SOL_DEVICE_ID) \
+ )
+
+#define IS_PCH_LPTLP_SOL_DEVICE_ID(DeviceId) \
+ ( \
+ (DeviceId == V_ME_LPTLP_SOL_DEVICE_ID) \
+ )
+
+#define IS_PCH_LPT_SOL_DEVICE_ID(DeviceId) \
+ ( \
+ IS_PCH_LPTH_SOL_DEVICE_ID(DeviceId) || \
+ IS_PCH_LPTLP_SOL_DEVICE_ID(DeviceId) \
+ )
+
+///
+/// Function Disable SUS well lockdown
+///
+#define FunctionDisableWellLockdown() MeDeviceControl (FDSWL, Enabled);
+
+#endif
diff --git a/ReferenceCode/ME/Library/MeKernel/include/MeChipsetLib.h b/ReferenceCode/ME/Library/MeKernel/include/MeChipsetLib.h
new file mode 100644
index 0000000..dfa9417
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeKernel/include/MeChipsetLib.h
@@ -0,0 +1,54 @@
+/** @file
+ Header file for Me Chipset Lib
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _ME_CHIPSET_LIB_H_
+#define _ME_CHIPSET_LIB_H_
+
+typedef enum {
+ HECI1 = 1,
+ HECI2,
+ IDER,
+ SOL,
+ USBR1,
+ USBR2,
+ FDSWL,
+} ME_DEVICE;
+
+typedef enum {
+ Disabled= 0,
+ Enabled,
+} ME_DEVICE_FUNC_CTRL;
+
+/**
+ Enable/Disable Me devices
+
+ @param[in] WhichDevice Select of Me device
+ @param[in] DeviceFuncCtrl Function control
+
+ @retval None
+**/
+VOID
+MeDeviceControl (
+ IN ME_DEVICE WhichDevice,
+ IN ME_DEVICE_FUNC_CTRL DeviceFuncCtrl
+ )
+;
+
+#endif
diff --git a/ReferenceCode/ME/Library/MeKernel/include/MeState.h b/ReferenceCode/ME/Library/MeKernel/include/MeState.h
new file mode 100644
index 0000000..55bb7bd
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeKernel/include/MeState.h
@@ -0,0 +1,67 @@
+/** @file
+ Register Definitions for Me States
+
+@copyright
+ Copyright (c) 2009 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _ME_STATE_H
+#define _ME_STATE_H
+///
+/// Ignore ME_FW_INIT_COMPLETE status Macro
+///
+#define ME_STATUS_ME_STATE_ONLY(a) ((a) & (~(ME_FW_INIT_COMPLETE | ME_FW_BOOT_OPTIONS_PRESENT)))
+
+///
+/// Macro to check if ME FW INIT is completed
+///
+#define ME_STATUS_IS_ME_FW_INIT_COMPLETE(a) (((a) & ME_FW_INIT_COMPLETE) == ME_FW_INIT_COMPLETE)
+
+///
+/// Marco to combind the complete bit to status
+///
+#define ME_STATUS_WITH_ME_INIT_COMPLETE(a) ((a) | ME_FW_INIT_COMPLETE)
+
+///
+/// Macro to check ME Boot Option Present
+///
+#define ME_STATUS_IS_ME_FW_BOOT_OPTIONS_PRESENT(a) (((a) & ME_FW_BOOT_OPTIONS_PRESENT) == ME_FW_BOOT_OPTIONS_PRESENT)
+
+//
+// Abstract ME Mode Definitions
+//
+#define ME_MODE_NORMAL 0x00
+#define ME_MODE_DEBUG 0x02
+#define ME_MODE_TEMP_DISABLED 0x03
+#define ME_MODE_SECOVER 0x04
+#define ME_MODE_FAILED 0x06
+
+//
+// Abstract ME Status definitions
+//
+#define ME_READY 0x00
+#define ME_INITIALIZING 0x01
+#define ME_IN_RECOVERY_MODE 0x02
+#define ME_DISABLE_WAIT 0x06
+#define ME_TRANSITION 0x07
+#define ME_NOT_READY 0x0F
+#define ME_FW_INIT_COMPLETE 0x80
+#define ME_FW_BOOT_OPTIONS_PRESENT 0x100
+#define ME_FW_UPDATES_IN_PROGRESS 0x200
+
+#pragma pack()
+
+#endif // ME_STATE_H
diff --git a/ReferenceCode/ME/Library/MeKernel/include/MkhiMsgs.h b/ReferenceCode/ME/Library/MeKernel/include/MkhiMsgs.h
new file mode 100644
index 0000000..9005d62
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeKernel/include/MkhiMsgs.h
@@ -0,0 +1,533 @@
+/** @file
+ MKHI Messages
+
+@copyright
+ Copyright (c) 2010 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _MKHI_MSGS_H
+#define _MKHI_MSGS_H
+
+#pragma pack(1)
+
+#define BIOS_FIXED_HOST_ADDR 0
+#define PREBOOT_FIXED_ME_ADDR 7
+#define BIOS_ASF_HOST_ADDR 1
+
+#define HECI_CORE_MESSAGE_ADDR 0x07
+#define HECI_ASF_MESSAGE_ADDR 0x02
+#define HECI_FSC_MESSAGE_ADDR 0x03
+#define HECI_POLICY_MANAGER_ADDR 0x05
+#define HECI_AT_MESSAGE_ADDR 0x05 ///< Added to support AT
+#define HECI_ME_PASSWORD_SERVICE_ADDR 0x06
+#define HECI_ICC_MESSAGE_ADDR 0x08
+#define HECI_TR_MESSAGE_ADDR 0x09
+#define HECI_SPI_MESSAGE_ADDR 0x0A
+
+#define NON_BLOCKING 0
+#define BLOCKING 1
+
+//
+// command handle by HCI
+//
+#define GEN_GET_MKHI_VERSION_CMD 0x01
+#define GEN_GET_MKHI_VERSION_CMD_ACK 0x81
+#define GEN_GET_FW_VERSION_CMD 0x02
+#define GEN_GET_FW_VERSION_CMD_ACK 0x82
+#define GEN_UNCFG_WO_PWD_CMD 0x0D
+#define GEN_UNCFG_WO_PWD_CMD_ACK 0x8D
+
+#define FWCAPS_GET_RULE_CMD 0x02
+#define FWCAPS_SET_RULE_CMD 0x03
+
+#define AT_ME_RULE_ID 0xd0000
+
+//
+// Enums for Result field of MHKI Header
+//
+#define ME_SUCCESS 0x00
+#define ME_ERROR_ALIAS_CHECK_FAILED 0x01
+#define ME_INVALID_MESSAGE 0x02
+#define ME_M1_DATA_OLDER_VER 0x03
+#define ME_M1_DATA_INVALID_VER 0x04
+#define ME_INVALID_M1_DATA 0x05
+
+//
+// MDES
+//
+#define MDES_ENABLE_MKHI_CMD 0x09
+#define MDES_ENABLE_MKHI_CMD_ACK 0x89
+
+///
+/// IFR Update
+///
+#define MEFWCAPS_ME_FWU_IFR_RULE 0x2E
+
+//
+// Manageability State Control
+//
+#define FIRMWARE_CAPABILITY_OVERRIDE_CMD 0x14
+#define FIRMWARE_CAPABILITY_OVERRIDE_CMD_ACK 0x94
+
+///
+/// Typedef for GroupID
+///
+typedef enum {
+ MKHI_CBM_GROUP_ID = 0,
+ MKHI_PM_GROUP_ID,
+ MKHI_PWD_GROUP_ID,
+ MKHI_FWCAPS_GROUP_ID,
+ MKHI_APP_GROUP_ID,
+ MKHI_SPI_GROUP_ID,
+ MKHI_MDES_GROUP_ID = 8,
+ MKHI_MAX_GROUP_ID,
+ MKHI_GEN_GROUP_ID = 0xFF
+} MKHI_GROUP_ID;
+
+///
+/// Typedef for AT State
+///
+typedef enum _AT_STATE
+{
+ AT_STATE_INACTIVE = 0,
+ AT_STATE_ACTIVE,
+ AT_STATE_STOLEN,
+ AT_STATE_SUSPEND,
+ AT_STATE_MAX
+} AT_STATE;
+
+///
+/// MKHI host message header. This header is part of HECI message sent from MEBx via
+/// Host Configuration Interface (HCI). ME Configuration Manager or Power Configuration
+/// Manager also include this header with appropriate fields set as part of the
+/// response message to the HCI.
+///
+typedef union _MKHI_MESSAGE_HEADER {
+ UINT32 Data;
+ struct {
+ UINT32 GroupId : 8;
+ UINT32 Command : 7;
+ UINT32 IsResponse : 1;
+ UINT32 Reserved : 8;
+ UINT32 Result : 8;
+ } Fields;
+} MKHI_MESSAGE_HEADER;
+
+///
+/// End of Post ACK message
+///
+typedef struct _CBM_EOP_ACK_DATA {
+ UINT32 RequestedActions;
+} CBM_EOP_ACK_DATA;
+
+typedef struct _GEN_END_OF_POST_ACK {
+ MKHI_MESSAGE_HEADER Header;
+ CBM_EOP_ACK_DATA Data;
+} GEN_END_OF_POST_ACK;
+
+typedef union _MKHI_VERSION {
+ UINT32 Data;
+ struct {
+ UINT32 Minor : 16;
+ UINT32 Major : 16;
+ } Fields;
+} MKHI_VERSION;
+
+///
+/// MKHI version messages
+///
+typedef struct _GEN_GET_MKHI_VERSION {
+ MKHI_MESSAGE_HEADER MKHIHeader;
+} GEN_GET_MKHI_VERSION;
+
+typedef struct _GET_MKHI_VERSION_ACK_DATA {
+ MKHI_VERSION MKHIVersion;
+} GET_MKHI_VERSION_ACK_DATA;
+
+typedef struct _GEN_GET_MKHI_VERSION_ACK {
+ MKHI_MESSAGE_HEADER MKHIHeader;
+ GET_MKHI_VERSION_ACK_DATA Data;
+} GEN_GET_MKHI_VERSION_ACK;
+
+///
+/// FW version messages
+///
+typedef struct _GEN_GET_FW_VER {
+ MKHI_MESSAGE_HEADER MKHIHeader;
+} GEN_GET_FW_VER;
+
+typedef struct _GEN_GET_FW_VER_ACK_DATA {
+ UINT32 CodeMinor : 16;
+ UINT32 CodeMajor : 16;
+ UINT32 CodeBuildNo : 16;
+ UINT32 CodeHotFix : 16;
+ UINT32 RcvyMinor : 16;
+ UINT32 RcvyMajor : 16;
+ UINT32 RcvyBuildNo : 16;
+ UINT32 RcvyHotFix : 16;
+ UINT32 FitcMinor : 16;
+ UINT32 FitcMajor : 16;
+ UINT32 FitcBuildNo : 16;
+ UINT32 FitcHotFix : 16;
+} GEN_GET_FW_VER_ACK_DATA;
+
+typedef struct _GEN_GET_FW_VER_ACK {
+ MKHI_MESSAGE_HEADER MKHIHeader;
+ GEN_GET_FW_VER_ACK_DATA Data;
+} GEN_GET_FW_VER_ACK;
+
+///
+/// Unconfig without password messages
+///
+typedef struct _GEN_UNCFG_WO_PWD {
+ MKHI_MESSAGE_HEADER MKHIHeader;
+} GEN_UNCFG_WO_PWD;
+
+typedef struct _GEN_UNCFG_WO_PWD_ACK {
+ MKHI_MESSAGE_HEADER MKHIHeader;
+} GEN_UNCFG_WO_PWD_ACK;
+
+///
+/// Get Firmware Capability MKHI
+///
+typedef struct _GET_RULE_DATA {
+ UINT32 RuleId;
+} GET_RULE_DATA;
+
+typedef struct _GEN_GET_FW_CAPSKU {
+ MKHI_MESSAGE_HEADER MKHIHeader;
+ GET_RULE_DATA Data;
+} GEN_GET_FW_CAPSKU;
+
+typedef union _RULE_ID {
+ UINT32 Data;
+ struct {
+ UINT32 RuleTypeId : 16;
+ UINT32 FeatureId : 8;
+ UINT32 Reserved : 8;
+ } Fields;
+} RULE_ID;
+
+typedef struct _SET_RULE_DATA {
+ RULE_ID RuleId;
+ UINT8 RuleDataLen;
+ UINT8 RuleData;
+} SET_RULE_DATA;
+
+typedef struct _SET_RULE_ACK_DATA {
+ UINT32 RuleId;
+} SET_RULE_ACK_DATA;
+
+typedef struct _GEN_SET_FW_CAPSKU {
+ MKHI_MESSAGE_HEADER MKHIHeader;
+ SET_RULE_DATA Data;
+} GEN_SET_FW_CAPSKU;
+
+typedef struct _GEN_SET_FW_CAPSKU_ACK {
+ MKHI_MESSAGE_HEADER MKHIHeader;
+ SET_RULE_ACK_DATA Data;
+} GEN_SET_FW_CAPSKU_ACK;
+typedef union _MEFWCAPS_SKU {
+ UINT32 Data;
+ struct {
+ UINT32 FullNet : 1; ///< [0] Full network manageability
+ UINT32 StdNet : 1; ///< [1] Standard network manageability
+ UINT32 Manageability : 1; ///< [2] Manageability
+ UINT32 SmallBusiness : 1; ///< [3] Small business technology
+ UINT32 Reserved2 : 1; ///< [4] Reserved
+ UINT32 IntelAT : 1; ///< [5] IntelR Anti-Theft (AT)
+ UINT32 IntelCLS : 1; ///< [6] IntelR Capability Licensing Service (CLS)
+ UINT32 Reserved : 3; ///< [9:7] Reserved
+ UINT32 IntelMPC : 1; ///< [10] IntelR Power Sharing Technology (MPC)
+ UINT32 IccOverClocking : 1; ///< [11] ICC Over Clocking
+ UINT32 PAVP : 1; ///< [12] Protected Audio Video Path (PAVP)
+ UINT32 Reserved1 : 4; ///< [16:13] Reserved
+ UINT32 IPV6 : 1; ///< [17] IPV6
+ UINT32 KVM : 1; ///< [18] KVM Remote Control (KVM)
+ UINT32 OCH : 1; ///< [19] Outbreak Containment Heuristic (OCH)
+ UINT32 VLAN : 1; ///< [20] Virtual LAN (VLAN)
+ UINT32 TLS : 1; ///< [21] TLS
+ UINT32 Reserved4 : 1; ///< [22] Reserved
+ UINT32 WLAN : 1; ///< [23] Wireless LAN (WLAN)
+ UINT32 Reserved5 : 5; ///< [28:24] Reserved
+ UINT32 PTT : 1; ///< [29] Platform Trust Technoogy (PTT)
+ UINT32 Reserved6 : 1; ///< [30] Reserved
+ UINT32 NFC : 1; ///< [31] NFC
+ } Fields;
+} MEFWCAPS_SKU;
+
+typedef struct _AT_STATE_FLAG {
+ UINT16 LockState : 1; ///< Indicate whether the platform is locked */
+ UINT16 AuthenticateModule : 1; ///< Preferred Authentication Module */
+ UINT16 S3Authentication : 1; ///< indicates whether S3 authentication is enabled */
+ UINT16 FlashWearOut : 1; ///< indicates whether the AT flash partition is currently in violation of flash wear out rules */
+ UINT16 FlashVariableSecurity : 1; ///< indicates whether the AT flash variables have been tampered with */
+ UINT16 Reserved : 11;
+} AT_STATE_FLAG;
+
+typedef struct _AT_STATE_INFO {
+ UINT8 State;
+ UINT8 LastTheftTrigger;
+ AT_STATE_FLAG flags;
+} AT_STATE_INFO;
+
+typedef struct {
+ UINT8 AtState; ///< State of AT
+ UINT8 AtLastTheftTrigger; ///< Reason for the last trigger
+ AT_STATE_FLAG AtStateFlags; ///< State of AT Fw
+} AT_STATE_STRUCT;
+
+typedef struct _GEN_GET_FW_CAPS_SKU_ACK_DATA {
+ UINT32 RuleID;
+ UINT8 RuleDataLen;
+ MEFWCAPS_SKU FWCapSku;
+} GEN_GET_FW_CAPS_SKU_ACK_DATA;
+
+typedef struct _GEN_GET_FW_CAPSKU_ACK {
+ MKHI_MESSAGE_HEADER MKHIHeader;
+ GEN_GET_FW_CAPS_SKU_ACK_DATA Data;
+} GEN_GET_FW_CAPS_SKU_ACK;
+
+typedef union _GEN_GET_FW_CAPS_SKU_BUFFER {
+ GEN_GET_FW_CAPSKU Request;
+ GEN_GET_FW_CAPS_SKU_ACK Response;
+} GEN_GET_FW_CAPS_SKU_BUFFER;
+
+typedef enum {
+ UPDATE_DISABLED = 0,
+ UPDATE_ENABLED
+} LOCAL_FW_UPDATE;
+
+typedef enum {
+ LOCAL_FW_ALWAYS = 0,
+ LOCAL_FW_NEVER,
+ LOCAL_FW_RESTRICTED,
+} LOCAL_FW_QUALIFIER;
+
+typedef struct _GEN_LOCAL_FW_UPDATE_DATA {
+ UINT32 RuleId;
+ UINT8 RuleDataLen;
+ UINT8 RuleData;
+ UINT8 Reserved[30];
+} GEN_LOCAL_FW_UPDATE_DATA;
+
+typedef struct _GEN_GET_LOCAL_FW_UPDATE {
+ MKHI_MESSAGE_HEADER MKHIHeader;
+ GET_RULE_DATA Data;
+} GEN_GET_LOCAL_FW_UPDATE;
+
+typedef struct _GEN_GET_LOCAL_FW_UPDATE_ACK {
+ MKHI_MESSAGE_HEADER MKHIHeader;
+ GEN_LOCAL_FW_UPDATE_DATA Data;
+} GEN_GET_LOCAL_FW_UPDATE_ACK;
+
+typedef struct _GEN_SET_LOCAL_FW_UPDATE {
+ MKHI_MESSAGE_HEADER MKHIHeader;
+ GEN_LOCAL_FW_UPDATE_DATA Data;
+} GEN_SET_LOCAL_FW_UPDATE;
+
+typedef struct _GEN_SET_LOCAL_FW_UPDATE_ACK {
+ MKHI_MESSAGE_HEADER MKHIHeader;
+ GET_RULE_DATA Data;
+} GEN_SET_LOCAL_FW_UPDATE_ACK;
+
+typedef enum {
+ NO_BRAND = 0,
+ INTEL_AMT_BRAND,
+ INTEL_STAND_MANAGEABILITY_BRAND,
+ INTEL_LEVEL_III_MANAGEABILITY_UPGRADE_BRAND,
+ INTEL_RESERVED_BRAND,
+ INTEL_SMALL_BUSINESS_TECHNOLOGY_BRAND,
+} PLATFORM_BRAND;
+
+typedef enum {
+ INTEL_ME_1_5MB_FW = 3,
+ INTEL_ME_5MB_FW,
+} ME_IMAGE_TYPE;
+
+#define REGULAR_SKU 0
+#define SUPER_SKU 1
+
+#define PLATFORM_MARKET_CORPORATE 1
+#define PLATFORM_MARKET_CONSUMER 2
+
+#define PLATFORM_MOBILE 1
+#define PLATFORM_DESKTOP 2
+#define PLATFORM_SERVER 4
+#define PLATFORM_WORKSTATION 8
+
+typedef union _PLATFORM_TYPE_RULE_DATA {
+ UINT32 Data;
+ struct {
+ UINT32 PlatformTargetUsageType : 4;
+ UINT32 PlatformTargetMarketType : 2;
+ UINT32 SuperSku : 1;
+ UINT32 Reserved : 1;
+ UINT32 IntelMeFwImageType : 4;
+ UINT32 PlatformBrand : 4;
+ UINT32 Reserved1 : 16;
+ } Fields;
+} PLATFORM_TYPE_RULE_DATA;
+
+typedef struct _GEN_PLATFORM_TYPE_DATA {
+ UINT32 RuleId;
+ UINT8 RuleDataLen;
+ PLATFORM_TYPE_RULE_DATA RuleData;
+ UINT8 Reserved[27];
+} GEN_PLATFORM_TYPE_DATA;
+
+typedef struct _GEN_GET_PLATFORM_TYPE {
+ MKHI_MESSAGE_HEADER MKHIHeader;
+ GET_RULE_DATA Data;
+} GEN_GET_PLATFORM_TYPE;
+
+typedef struct _GEN_GET_PLATFORM_TYPE_ACK {
+ MKHI_MESSAGE_HEADER MKHIHeader;
+ GEN_PLATFORM_TYPE_DATA Data;
+} GEN_GET_PLATFORM_TYPE_ACK;
+
+typedef union _GEN_GET_PLATFORM_TYPE_BUFFER {
+ GEN_GET_PLATFORM_TYPE Request;
+ GEN_GET_PLATFORM_TYPE_ACK Response;
+} GEN_GET_PLATFORM_TYPE_BUFFER;
+
+typedef struct _GET_AT_ME_RULE_CMD {
+ MKHI_MESSAGE_HEADER MKHIHeader;
+ UINT32 RuleId;
+
+} GET_AT_ME_RULE_CMD;
+
+typedef struct _GET_AT_ME_RULE_RSP {
+ MKHI_MESSAGE_HEADER MKHIHeader;
+ UINT32 RuleId;
+ UINT8 RuleDataLength;
+ AT_STATE_INFO AtRuleData;
+
+} GET_AT_ME_RULE_RSP;
+
+typedef struct _GET_FW_FEATURE_STATUS {
+ MKHI_MESSAGE_HEADER MKHIHeader;
+ GET_RULE_DATA Data;
+} GEN_GET_FW_FEATURE_STATUS;
+
+typedef struct _GET_FW_FEATURE_STATUS_ACK {
+ MKHI_MESSAGE_HEADER MKHIHeader;
+ UINT32 RuleId;
+ UINT8 RuleDataLength;
+ MEFWCAPS_SKU RuleData;
+} GEN_GET_FW_FEATURE_STATUS_ACK;
+
+typedef struct _GEN_AMT_BIOS_SYNCH_INFO {
+ MKHI_MESSAGE_HEADER MKHIHeader;
+ GET_RULE_DATA Data;
+} GEN_AMT_BIOS_SYNCH_INFO;
+
+typedef struct _GEN_AMT_BIOS_SYNCH_INFO_ACK {
+ MKHI_MESSAGE_HEADER MKHIHeader;
+ UINT32 RuleId;
+ UINT8 RuleDataLength;
+ UINT32 RuleData;
+} GEN_AMT_BIOS_SYNCH_INFO_ACK;
+
+typedef struct _GEN_GET_OEM_TAG_MSG {
+ MKHI_MESSAGE_HEADER MKHIHeader;
+ GET_RULE_DATA Data;
+} GEN_GET_OEM_TAG_MSG;
+
+typedef struct _GEN_GET_OEM_TAG_MSG_ACK {
+ MKHI_MESSAGE_HEADER MKHIHeader;
+ UINT32 RuleId;
+ UINT8 RuleDataLength;
+ UINT32 RuleData;
+} GEN_GET_OEM_TAG_MSG_ACK;
+
+typedef union _PLATFORM_DEBUG_CAP {
+ UINT8 Data;
+ struct {
+ UINT8 Mdes : 1;
+ UINT8 SvtForPch : 1;
+ UINT8 Reserved : 6;
+ } Fields;
+} PLATFORM_DEBUG_CAP;
+
+typedef struct _GEN_PLATFORM_DEBUG_CAP_MKHI_CMD_MSG {
+ MKHI_MESSAGE_HEADER MKHIHeader;
+ PLATFORM_DEBUG_CAP Capability;
+} GEN_PLATFORM_DEBUG_CAP_MKHI_CMD_MSG;
+
+///
+/// Manageability State Control MKHI definitions
+///
+typedef struct _FIRMWARE_CAPABILITY_OVERRIDE_DATA {
+ UINT32 EnableFeature;
+ UINT32 DisableFeature;
+} FIRMWARE_CAPABILITY_OVERRIDE_DATA;
+
+typedef struct _FIRMWARE_CAPABILITY_OVERRIDE {
+ MKHI_MESSAGE_HEADER MKHIHeader;
+ FIRMWARE_CAPABILITY_OVERRIDE_DATA FeatureState;
+} FIRMWARE_CAPABILITY_OVERRIDE;
+
+typedef enum _FIRMWARE_CAPABILITY_RESPONSE
+{
+ SET_FEATURE_STATE_ACCEPTED = 0,
+ SET_FEATURE_STATE_REJECTED
+} FIRMWARE_CAPABILITY_RESPONSE;
+
+typedef struct _FIRMWARE_CAPABILITY_OVERRIDE_ACK_DATA {
+ FIRMWARE_CAPABILITY_RESPONSE Response;
+} FIRMWARE_CAPABILITY_OVERRIDE_ACK_DATA;
+
+typedef struct _FIRMWARE_CAPABILITY_OVERRIDE_ACK {
+ MKHI_MESSAGE_HEADER Header;
+ FIRMWARE_CAPABILITY_OVERRIDE_ACK_DATA Data;
+} FIRMWARE_CAPABILITY_OVERRIDE_ACK;
+
+///
+/// Set ACM TPM Data MKHI
+///
+#define ACM_TPM_DATA_MKHI_DATA 0x00000303
+#define ACM_TPM_DATA_RULE_TYPE_ID 0x2F
+#define ACM_TPM_DATA_RULE_DATA_LENGTH 0x04
+
+typedef union _TPM_STATE {
+ UINT16 Data;
+ struct {
+ UINT16 Reserved_0: 8;
+ UINT16 TpmDeactivate: 1;
+ UINT16 Reserved_1: 7;
+ } Fields;
+} TPM_STATE;
+
+typedef struct _ACM_TPM_DATA {
+ RULE_ID RuleId;
+ UINT8 RuleDataLen;
+ TPM_STATE TpmState;
+ UINT8 Reserved[2];
+} ACM_TPM_DATA;
+
+typedef struct _BIOSNV_SET_ACM_TPM_DATA {
+ MKHI_MESSAGE_HEADER MKHIHeader;
+ ACM_TPM_DATA AcmTpmData;
+} BIOSNV_SET_ACM_TPM;
+
+typedef struct _BIOSNV_SET_ACM_TPM_DATA_ACK {
+ MKHI_MESSAGE_HEADER MKHIHeader;
+ RULE_ID RuleId;
+} BIOSNV_SET_ACM_TPM_ACK;
+
+#pragma pack()
+
+#endif // _MKHI_MSGS_H
diff --git a/ReferenceCode/ME/Library/MeLibrary.cif b/ReferenceCode/ME/Library/MeLibrary.cif
new file mode 100644
index 0000000..76bce81
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeLibrary.cif
@@ -0,0 +1,22 @@
+<component>
+ name = "MeLibrary"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\Library\"
+ RefName = "MeLibrary"
+[files]
+"MeLibrary.sdl"
+"MeKernel\include\CoreBiosMsg.h"
+"MeKernel\include\MkhiMsgs.h"
+"MeKernel\include\MeAccess.h"
+"MeKernel\include\MeChipset.h"
+"MeKernel\include\MeChipsetLib.h"
+"MeKernel\include\MeState.h"
+"AMT\Include\Amt.h"
+"PttHeci\Include\PttHeciLib.h"
+[parts]
+"MeKernelLibrary"
+"AmtLibrary"
+"AtLibrary"
+"PttLibrary"
+"PttHeciDxeLib"
+<endComponent>
diff --git a/ReferenceCode/ME/Library/MeLibrary.sdl b/ReferenceCode/ME/Library/MeLibrary.sdl
new file mode 100644
index 0000000..6617dce
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeLibrary.sdl
@@ -0,0 +1,32 @@
+TOKEN
+ Name = "MeLibrary_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable MeLibrary support in Project"
+End
+
+PATH
+ Name = "MeLibrary_DIR"
+ Help = "Me Library file source directory"
+End
+
+ELINK
+ Name = "/I$(MeLibrary_DIR)\Include"
+ Parent = "ME_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(MeLibrary_DIR)\PttHeci\Include"
+ Parent = "ME_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(INTEL_PCH_INCLUDES)"
+ Parent = "ME_INCLUDES"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/ME/Library/Ptt/Common/PttHciDeviceLib.c b/ReferenceCode/ME/Library/Ptt/Common/PttHciDeviceLib.c
new file mode 100644
index 0000000..38b33b5
--- /dev/null
+++ b/ReferenceCode/ME/Library/Ptt/Common/PttHciDeviceLib.c
@@ -0,0 +1,606 @@
+/** @file
+ Implements Platform Trust Technology (FTPM) HCI Device Library.
+
+@copyright
+ Copyright (c) 2012 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueBase.h"
+#endif
+
+#ifdef PTT_FLAG
+#include "PttHciRegs.h"
+#include "PttHciDeviceLib.h"
+#include <IndustryStandard/Tpm20.h>
+
+
+#ifdef EFI_DEBUG
+/**
+ Prints command or response buffer for debugging purposes.
+
+ @param[in] Buffer Buffer to print.
+ @param[in] BufferSize Buffer data length.
+**/
+VOID
+EFIAPI
+PttHciPrintBuffer(IN UINT8 *Buffer, IN UINT32 BufferSize)
+{
+ UINT32 Index;
+
+ DEBUG ((EFI_D_INFO, "Buffer Address: 0x%08x, Size: 0x%08x, Value:\n", Buffer, BufferSize));
+ for(Index = 0; Index < BufferSize; Index++){
+ DEBUG ((EFI_D_INFO, "%02x ", *(Buffer + Index)));
+ if((Index+1) % 16 == 0) DEBUG ((EFI_D_INFO, "\n"));
+ }
+ DEBUG ((EFI_D_INFO, "\n"));
+}
+#endif // EFI_DEBUG
+
+
+VOID MicroSecDelay (
+ UINTN Delay
+)
+{
+ UINTN Counter, i;
+ UINT32 Data32, PrevData;
+ UINT32 Remainder;
+
+ Counter = (UINTN)DivU64x32Remainder ((UINT64)(Delay * 10), 3, &Remainder);
+ if (Remainder != 0) {
+ Counter++;
+ }
+ //
+ // Call WaitForTick for Counter + 1 ticks to try to guarantee Counter tick
+ // periods, thus attempting to ensure Microseconds of stall time.
+ //
+ if (Counter != 0) {
+
+ PrevData = IoRead32(PM_BASE_ADDRESS + 8);
+ for (i = 0; i < Counter; ) {
+ Data32 = IoRead32(PM_BASE_ADDRESS + 8);
+ if (Data32 < PrevData) { // Reset if there is a overlap
+ PrevData=Data32;
+ continue;
+ }
+ i += (Data32 - PrevData);
+ PrevData = Data32;
+ }
+ }
+ return;
+}
+
+
+/**
+ Copy data from the MMIO region to system memory by using 32-bit access.
+
+ Copy data from the MMIO region specified by starting address StartAddress
+ to system memory specified by Buffer by using 32-bit access. The total
+ number of byte to be copied is specified by Length. Buffer is returned.
+
+ If StartAddress is not aligned on a 32-bit boundary, then ASSERT().
+
+ If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
+ If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
+
+ If Length is not aligned on a 32-bit boundary, then ASSERT().
+ If Buffer is not aligned on a 32-bit boundary, then ASSERT().
+
+ @param StartAddress The starting address for the MMIO region to be copied from.
+ @param Length The size, in bytes, of Buffer.
+ @param Buffer The pointer to a system memory buffer receiving the data read.
+
+ @return Buffer
+**/
+UINT32 *
+EFIAPI
+MmioReadBuffer32 (
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ OUT UINT32 *Buffer
+ )
+{
+ UINT32 *ReturnBuffer;
+
+ ASSERT ((StartAddress & (sizeof (UINT32) - 1)) == 0);
+
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
+
+ ASSERT ((Length & (sizeof (UINT32) - 1)) == 0);
+ ASSERT (((UINTN) Buffer & (sizeof (UINT32) - 1)) == 0);
+
+ ReturnBuffer = Buffer;
+
+ while (Length != 0) {
+ *(Buffer++) = MmioRead32 (StartAddress);
+ StartAddress += sizeof (UINT32);
+ Length -= sizeof (UINT32);
+ }
+
+ return ReturnBuffer;
+}
+
+/**
+ Copy data from system memory to the MMIO region by using 32-bit access.
+
+ Copy data from system memory specified by Buffer to the MMIO region specified
+ by starting address StartAddress by using 32-bit access. The total number
+ of byte to be copied is specified by Length. Buffer is returned.
+
+ If StartAddress is not aligned on a 32-bit boundary, then ASSERT().
+
+ If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
+ If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().
+
+ If Length is not aligned on a 32-bit boundary, then ASSERT().
+
+ If Buffer is not aligned on a 32-bit boundary, then ASSERT().
+
+ @param StartAddress The starting address for the MMIO region to be copied to.
+ @param Length The size, in bytes, of Buffer.
+ @param Buffer The pointer to a system memory buffer containing the data to write.
+
+ @return Buffer
+**/
+UINT32 *
+EFIAPI
+MmioWriteBuffer32 (
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ IN CONST UINT32 *Buffer
+ )
+{
+ UINT32 *ReturnBuffer;
+
+ ASSERT ((StartAddress & (sizeof (UINT32) - 1)) == 0);
+
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
+
+ ASSERT ((Length & (sizeof (UINT32) - 1)) == 0);
+ ASSERT (((UINTN) Buffer & (sizeof (UINT32) - 1)) == 0);
+
+ ReturnBuffer = (UINT32 *) Buffer;
+
+ while (Length != 0) {
+ MmioWrite32 (StartAddress, *(Buffer++));
+
+ StartAddress += sizeof (UINT32);
+ Length -= sizeof (UINT32);
+ }
+
+ return ReturnBuffer;
+}
+
+/**
+ Checks whether FTPM is enabled (FTPM_STS::FTPM_EN).
+
+ @retval TRUE FTPM is enabled.
+ @retval FALSE FTPM is disabled. All LT writes will be dropped.
+ All LT reads will be returned with read data value of all 0's.
+ The bit can only be written once per ME power cycle.
+
+**/
+BOOLEAN
+EFIAPI
+PttHciPresenceCheck (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ DEBUG ((EFI_D_INFO, "PTT: PttHciPresenceCheck start\n"));
+
+ DEBUG ((EFI_D_INFO, "Check FTPM_STS - ENABLED bit (@ 0x%08x)\n", (R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_STS)));
+ Status = PttHciWaitRegisterBits(
+ (EFI_PHYSICAL_ADDRESS)(UINTN)(R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_STS),
+ B_PTT_HCI_STS_ENABLED,
+ V_PTT_HCI_IGNORE_BITS,
+ PTT_HCI_TIMEOUT_A
+ );
+ if(Status == EFI_SUCCESS){
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/**
+ Checks whether PTT is Ready
+
+ @retval TRUE PTT is ready.
+ @retval FALSE PTT is not ready
+
+**/
+BOOLEAN
+EFIAPI
+PttHciReadyCheck (
+ VOID
+ )
+{
+ UINT32 RegRead;
+
+ RegRead = MmioRead32 ((UINTN) ( R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_STS ));
+ DEBUG ((EFI_D_INFO, "Check PTT_STS - READY bit (@ 0x%08x)\n", RegRead));
+
+ if(( B_PTT_HCI_STS_READY & RegRead) != 0){
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/**
+ Checks whether TPM2_Startup command has been executed (FTPM_STS::STARTUP_EXEC).
+ If command was executed, it should not be redundantly issued again.
+
+ @retval TRUE Startup command executed already.
+ @retval FALSE Startup command not executed yet.
+
+**/
+BOOLEAN
+EFIAPI
+PttHciStartupExecuted (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+
+ DEBUG ((EFI_D_INFO, "PTT: PttHciStartupExecuted start\n"));
+ DEBUG ((EFI_D_INFO, "Check FTPM_STS - STARTUP_EXECECUTED bit (@ 0x%08x)\n", (R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_STS)));
+ Status = PttHciWaitRegisterBits(
+ (EFI_PHYSICAL_ADDRESS)(UINTN)(R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_STS),
+ B_PTT_HCI_STS_STARTUP_EXEC,
+ V_PTT_HCI_IGNORE_BITS,
+ PTT_HCI_TIMEOUT_A
+ );
+ if(Status == EFI_SUCCESS){
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/**
+ Sets FTPM_CMD and CA_START register to a defined value to indicate that a command is
+ available for processing.
+ Any host write to this register shall result in an interrupt to the ME firmware.
+
+ @retval EFI_SUCCESS Register successfully written.
+ @retval TBD
+
+**/
+EFI_STATUS
+EFIAPI
+PttHciRequestCommandExec (
+ VOID
+ )
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+
+ DEBUG ((EFI_D_INFO, "PTT: PttHciRequestCommandExec start\n"));
+
+ DEBUG ((EFI_D_INFO, "Command ready for processing - write 0x%08x to FTPM_CA_START register (@ 0x%08x)\n",
+ V_PTT_HCI_COMMAND_AVAILABLE_START,
+ (R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CA_START)));
+ MmioWrite32((UINTN)R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CA_START, V_PTT_HCI_COMMAND_AVAILABLE_START);
+
+ ///
+ /// Write 0x1 to HCI CMD register to indicate that a command is available for processing
+ ///
+ DEBUG ((EFI_D_INFO, "Command ready for processing - write 0x%08x to FTPM_CMD register (@ 0x%08x)\n",
+ V_PTT_HCI_COMMAND_AVAILABLE_CMD,
+ (R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CMD)));
+ MmioWrite32((UINTN)R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CMD, V_PTT_HCI_COMMAND_AVAILABLE_CMD);
+
+ return Status;
+}
+
+/**
+ Checks whether the value of a FTPM register satisfies the input BIT setting.
+
+ @param[in] Register Address port of register to be checked.
+ @param[in] BitSet Check these data bits are set.
+ @param[in] BitClear Check these data bits are clear.
+ @param[in] TimeOut The max wait time (unit MicroSecond) when checking register.
+
+ @retval EFI_SUCCESS The register satisfies the check bit.
+ @retval EFI_TIMEOUT The register can't run into the expected status in time.
+**/
+EFI_STATUS
+EFIAPI
+PttHciWaitRegisterBits(
+ IN EFI_PHYSICAL_ADDRESS RegAddress,
+ IN UINT32 BitSet,
+ IN UINT32 BitClear,
+ IN UINT32 TimeOut
+ )
+{
+ UINT32 RegRead;
+ UINT32 WaitTime;
+
+ DEBUG ((EFI_D_INFO, "PTT: PttHciWaitRegisterBits start\n"));
+
+ for (WaitTime = 0; WaitTime < TimeOut; WaitTime += PTT_HCI_POLLING_PERIOD){
+ RegRead = MmioRead32 ((UINTN)RegAddress);
+ DEBUG ((EFI_D_INFO, "RegRead: 0x%08x, BitSetMask: 0x%08x, BitClearMask: 0x%08x, WaitTime: %d (microsec)\n", RegRead, BitSet, BitClear, WaitTime));
+
+ if (RegRead == 0xFFFFFFFF)
+ continue;
+
+ if ((RegRead & BitSet) == BitSet && (RegRead & BitClear) == 0) {
+ return EFI_SUCCESS;
+ }
+// MicroSecondDelay (PTT_HCI_POLLING_PERIOD); Override
+ MicroSecDelay(PTT_HCI_POLLING_PERIOD);
+ }
+ return EFI_TIMEOUT;
+}
+
+/**
+ Sends command to FTPM for execution.
+
+ @param[in] FtpmBuffer Buffer for TPM command data.
+ @param[in] DataLength TPM command data length.
+
+ @retval EFI_SUCCESS Operation completed successfully.
+ @retval EFI_TIMEOUT The register can't run into the expected status in time.
+**/
+EFI_STATUS
+EFIAPI
+PttHciSend(
+ IN UINT8 *FtpmBuffer,
+ IN UINT32 DataLength
+ )
+{
+ EFI_STATUS Status;
+
+ DEBUG ((EFI_D_INFO, "PTT: PttHciSend start\n"));
+
+ Status = PttHciWaitRegisterBits(
+ (EFI_PHYSICAL_ADDRESS)(UINTN)(R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CA_START),
+ V_PTT_HCI_IGNORE_BITS,
+ V_PTT_HCI_START_CLEAR,
+ PTT_HCI_TIMEOUT_A
+ );
+
+ if(EFI_ERROR (Status)){
+ DEBUG ((EFI_D_ERROR, "FTPM_CA_START register not clear - TPM2 command cannot be sent! EFI_ERROR = %r\n", Status));
+ return EFI_NOT_READY;
+ }
+ ///
+ /// Align command size to dword before writing to FTPM_CRB
+ ///
+ if(DataLength % 4 != 0){
+ DEBUG ((EFI_D_INFO, "Alignment: DataLength change from %d ", DataLength));
+ DataLength += (4 - (DataLength % 4));
+ DEBUG ((EFI_D_INFO, "to %d\n", DataLength));
+ }
+
+ MmioWriteBuffer32((UINTN)(R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CRB), (UINTN)DataLength, (UINT32*)FtpmBuffer);
+
+ ///
+ /// FTPM_CA_CMD - the physical address to which the TPM 2.0 driver will write the command to execute
+ ///
+ MmioWrite32((UINTN)(R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CA_CMD), R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CRB);
+ MmioWrite32((UINTN)(R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CA_CMD_SZ), S_PTT_HCI_CRB_LENGTH);
+
+ DEBUG ((EFI_D_INFO, "FTPM_CA_CMD (@ 0x%08x) written, value = 0x%08x\n",
+ (R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CA_CMD),
+ R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CRB));
+ DEBUG ((EFI_D_INFO, "FTPM_CA_CMD_SZ (@ 0x%08x) written, value = 0x%08x\n",
+ (R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CA_CMD_SZ), DataLength));
+
+ ///
+ /// Set FTPM_CMD and FTPM_CA_START registers to indicate TPM command ready for execution
+ ///
+ Status = PttHciRequestCommandExec();
+#ifdef EFI_DEBUG
+ if(Status == EFI_SUCCESS){
+ DEBUG ((EFI_D_INFO, "FTPM_CMD register written - TPM2 command available for processing\n"));
+ }
+#endif
+
+ return Status;
+}
+
+/**
+ Receives response data of last command from FTPM.
+
+ @param[out] FtpmBuffer Buffer for response data.
+ @param[out] RespSize Response data length.
+
+ @retval EFI_SUCCESS Operation completed successfully.
+ @retval EFI_TIMEOUT The register can't run into the expected status in time.
+ @retval EFI_DEVICE_ERROR Unexpected device status.
+ @retval EFI_BUFFER_TOO_SMALL Response data is too long.
+**/
+EFI_STATUS
+EFIAPI
+PttHciReceive(
+ OUT UINT8 *FtpmBuffer,
+ OUT UINT32 *RespSize
+ )
+{
+ EFI_STATUS Status;
+ UINT16 Data16;
+ UINT32 Data32;
+ DEBUG ((EFI_D_INFO, "PTT: PttHciReceive start\n"));
+
+ ///
+ /// Wait for the command completion - poll FTPM_CA_START clear
+ ///
+ DEBUG ((EFI_D_INFO, "PTT: Check Start status (FTPM_CA_START)\n"));
+ Status = PttHciWaitRegisterBits(
+ (EFI_PHYSICAL_ADDRESS)(UINTN)(R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CA_START),
+ V_PTT_HCI_IGNORE_BITS,
+ V_PTT_HCI_START_CLEAR,
+ PTT_HCI_TIMEOUT_D
+ );
+ if(EFI_ERROR (Status)){
+ DEBUG ((EFI_D_ERROR, "FTPM_CA_START register not clear - TPM2 response cannot be read! EFI_ERROR = %r\n", Status));
+ goto Exit;
+ }
+
+ ///
+ /// Check for error condition - FTPM_CA_ERROR
+ ///
+ DEBUG ((EFI_D_INFO, "PTT: Check Error status (FTPM_CA_ERROR)\n"));
+ Status = PttHciWaitRegisterBits(
+ (EFI_PHYSICAL_ADDRESS)(UINTN)(R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CA_ERROR),
+ V_PTT_HCI_IGNORE_BITS,
+ V_PTT_HCI_ALL_BITS_CLEAR,
+ PTT_HCI_TIMEOUT_A
+ );
+ if(EFI_ERROR (Status)){
+ DEBUG ((EFI_D_ERROR, "FTPM_CA_ERROR register set - TPM2 response cannot be provided! EFI_ERROR = %r\n", Status));
+ Status = EFI_DEVICE_ERROR;
+ goto Exit;
+ }
+
+ DEBUG ((EFI_D_INFO, "FTPM_CA_START register clear - TPM2 command processing completed - ready to read\n"));
+
+ ///
+ /// Read the response data header
+ ///
+ MmioReadBuffer32((UINTN)R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CRB, PTT_HCI_RESPONSE_HEADER_SIZE, (UINT32*)FtpmBuffer);
+
+ ///
+ /// Check the reponse data header (tag, parasize and returncode)
+ ///
+ CopyMem (&Data16, FtpmBuffer, sizeof (UINT16));
+ DEBUG ((EFI_D_INFO, "TPM2_RESPONSE_HEADER.tag = 0x%04x\n", SwapBytes16(Data16)));
+
+ ///
+ /// TPM Rev 2.0 Part 2 - 6.9 TPM_ST (Structure Tags)
+ /// TPM_ST_RSP_COMMAND - Used in a response that has an error in the tag.
+ ///
+ if (SwapBytes16(Data16) == TPM_ST_RSP_COMMAND) {
+ DEBUG ((EFI_D_ERROR, "TPM2_RESPONSE_HEADER.tag = TPM_ST_RSP_COMMAND - Error in response!\n"));
+ Status = EFI_DEVICE_ERROR;
+ goto Exit;
+ }
+
+ CopyMem(&Data32, (FtpmBuffer + 2), sizeof(UINT32));
+ DEBUG ((EFI_D_INFO, "TPM2_RESPONSE_HEADER.paramSize = 0x%08x\n", SwapBytes32(Data32)));
+
+ *RespSize = SwapBytes32(Data32);
+
+ if(*RespSize == sizeof(TPM2_RESPONSE_HEADER)) {
+ Status = EFI_SUCCESS;
+ goto Exit;
+ }
+ if(*RespSize < sizeof(TPM2_RESPONSE_HEADER)) {
+ Status = EFI_DEVICE_ERROR;
+ goto Exit;
+ }
+ if(*RespSize > S_PTT_HCI_CRB_LENGTH) {
+ Status = EFI_BUFFER_TOO_SMALL;
+ goto Exit;
+ }
+
+ ///
+ /// Align command size to dword before writing to FTPM_CRB
+ ///
+ if(*RespSize % 4 != 0){
+ DEBUG ((EFI_D_INFO, "Alignment: RespSize change from %d ", *RespSize));
+ *RespSize += (4 - (*RespSize % 4));
+ DEBUG ((EFI_D_INFO, "to %d\n", *RespSize));
+ }
+
+ ///
+ /// Reading the entire response data
+ ///
+ MmioReadBuffer32((UINTN)R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CRB, *RespSize, (UINT32*)FtpmBuffer);
+
+ Exit:
+ if(!EFI_ERROR(Status)){
+ ///
+ /// FTPM_CA_CMD - the physical address from which the TPM 2.0 driver will read command responses
+ ///
+ MmioWrite32((UINTN)(R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CA_RSP), R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CRB);
+ MmioWrite32((UINTN)(R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CA_RSP_SZ),S_PTT_HCI_CRB_LENGTH);
+ DEBUG ((EFI_D_INFO, "FTPM_CA_RSP (@ 0x%08x) written, value = 0x%08x\n",
+ (R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CA_RSP),
+ (R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CRB)));
+ DEBUG ((EFI_D_INFO, "FTPM_CA_RSP_SZ (@ 0x%08x) written, value = 0x%08x\n",
+ (R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CA_RSP_SZ), *RespSize));
+ }
+
+ return Status;
+}
+
+/**
+ Sends formatted command to FTPM for execution and returns formatted response data.
+
+ @param[in] InputBuffer Buffer for the input data.
+ @param[in] InputBufferSize Size of the input buffer.
+ @param[out] ReturnBuffer Buffer for the output data.
+ @param[out] ReturnBufferSize Size of the output buffer.
+
+ @retval EFI_SUCCESS Operation completed successfully.
+ @retval EFI_TIMEOUT The register can't run into the expected status in time.
+**/
+EFI_STATUS
+EFIAPI
+PttHciSubmitCommand(
+ IN UINT8 *InputBuffer,
+ IN UINT32 InputBufferSize,
+ OUT UINT8 *ReturnBuffer,
+ OUT UINT32 *ReturnBufferSize
+ )
+{
+ EFI_STATUS Status;
+ DEBUG ((EFI_D_INFO, "PTT: PttHciSubmitCommand start\n"));
+
+ if(!PttHciReadyCheck()){
+ DEBUG ((EFI_D_ERROR, "PTT device not ready. \n"));
+ return EFI_NOT_READY;
+ }
+
+ if(InputBuffer == NULL || ReturnBuffer == NULL || InputBufferSize == 0){
+ DEBUG ((EFI_D_ERROR, "Buffer == NULL or InputBufferSize == 0\n"));
+ return EFI_INVALID_PARAMETER;
+ }
+
+ DEBUG ((EFI_D_INFO, "PTT: Command Buffer dump\n"));
+
+ ///
+ /// Send the command to TPM
+ ///
+ Status = PttHciSend(InputBuffer, InputBufferSize);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "FTpmHciSend EFI_ERROR = %r\n", Status));
+ return Status;
+ }
+
+ ///
+ /// Receive the response data from TPM
+ ///
+ Status = PttHciReceive(ReturnBuffer, ReturnBufferSize);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "FTpmHciReceive EFI_ERROR = %r\n", Status));
+ return Status;
+ }
+
+ DEBUG ((EFI_D_INFO, "PTT: Response Buffer dump\n"));
+
+ return Status;
+}
+
+#endif // PTT_FLAG
diff --git a/ReferenceCode/ME/Library/Ptt/Common/PttHciDeviceLib.cif b/ReferenceCode/ME/Library/Ptt/Common/PttHciDeviceLib.cif
new file mode 100644
index 0000000..56a7865
--- /dev/null
+++ b/ReferenceCode/ME/Library/Ptt/Common/PttHciDeviceLib.cif
@@ -0,0 +1,8 @@
+<component>
+ name = "PTT Common Library"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\Library\Ptt\Common\"
+ RefName = "PttHciDeviceLib"
+[files]
+"PttHciDeviceLib.c"
+<endComponent>
diff --git a/ReferenceCode/ME/Library/Ptt/Dxe/PttHciDeviceDxeLib.cif b/ReferenceCode/ME/Library/Ptt/Dxe/PttHciDeviceDxeLib.cif
new file mode 100644
index 0000000..341920f
--- /dev/null
+++ b/ReferenceCode/ME/Library/Ptt/Dxe/PttHciDeviceDxeLib.cif
@@ -0,0 +1,9 @@
+<component>
+ name = "PTT Dxe Library"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Me\Library\Ptt\Dxe\"
+ RefName = "PttHciDeviceDxeLib"
+[files]
+"PttHciDeviceDxeLib.inf"
+"PttHciDeviceDxeLib.h"
+<endComponent>
diff --git a/ReferenceCode/ME/Library/Ptt/Dxe/PttHciDeviceDxeLib.h b/ReferenceCode/ME/Library/Ptt/Dxe/PttHciDeviceDxeLib.h
new file mode 100644
index 0000000..c8a042f
--- /dev/null
+++ b/ReferenceCode/ME/Library/Ptt/Dxe/PttHciDeviceDxeLib.h
@@ -0,0 +1,37 @@
+/** @file
+ Platform Trust Technology (FTPM) HCI Device Dxe Library
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PTT_HCI_DEVICE_DXE_LIB_H_
+#define _PTT_HCI_DEVICE_DXE_LIB_H_
+
+#ifdef PTT_FLAG
+///
+/// External include files do NOT need to be explicitly specified in real EDKII
+/// environment
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#endif
+///
+/// Common header for HCI Library
+///
+#include "PttHciDeviceLib.h"
+#endif // PTT_FLAG
+#endif
diff --git a/ReferenceCode/ME/Library/Ptt/Dxe/PttHciDeviceDxeLib.inf b/ReferenceCode/ME/Library/Ptt/Dxe/PttHciDeviceDxeLib.inf
new file mode 100644
index 0000000..7bc28ad
--- /dev/null
+++ b/ReferenceCode/ME/Library/Ptt/Dxe/PttHciDeviceDxeLib.inf
@@ -0,0 +1,73 @@
+## @file
+# Component description file for PttHciDevice DXE Library.
+#
+#@copyright
+# Copyright (c) 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = PttHciDeviceDxeLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ PttHciDeviceDxeLib.h
+ ../Common/PttHciDeviceLib.c
+ ../Include/PttHciRegs.h
+ ../Include/PttHciDeviceLib.h
+
+[includes.common]
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/Ptt/Include
+#
+# Path to Tpm20.h should be updated when available in the code tree (core)
+# $(EFI_SOURCE)/SecurityPkg/Include/IndustryStandard
+
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/SampleCode
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/SampleCode/Include
+
+[libraries.common]
+ EdkIIGlueBaseLib
+ EdkIIGlueUefiLib
+ EdkIIGlueBaseMemoryLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueBaseTimerLibLocalApic
+ EdkIIGlueDxeDebugLibReportStatusCode
+
+[nmake.common]
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_LIB__ \
+ -D __EDKII_GLUE_UEFI_LIB__ \
+ -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D PTT_FLAG
diff --git a/ReferenceCode/ME/Library/Ptt/Include/PttHciDeviceLib.h b/ReferenceCode/ME/Library/Ptt/Include/PttHciDeviceLib.h
new file mode 100644
index 0000000..e6e92de
--- /dev/null
+++ b/ReferenceCode/ME/Library/Ptt/Include/PttHciDeviceLib.h
@@ -0,0 +1,175 @@
+/** @file
+ Platform Trust Technology (FTPM) HCI Device Library
+
+@copyright
+ Copyright (c) 2012 -2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PTT_HCI_DEVICE_LIB_H_
+#define _PTT_HCI_DEVICE_LIB_H_
+
+#ifdef PTT_FLAG
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueBase.h"
+#endif
+
+///
+/// Default Timeout values
+/// @todo these values should be adjusted on actual silicon after power-on
+///
+#define PTT_HCI_TIMEOUT_A 500 ///< 500 microseconds
+// AMI-Core Override for PTT +
+//#define PTT_HCI_TIMEOUT_B 10 * 1000 ///< 10ms (max command processing time in PK-TPM ca. 3ms)
+#define PTT_HCI_TIMEOUT_B 500 * 1000 ///< 10ms (max command processing time in PK-TPM ca. 3ms)
+// AMI-Core Override for PTT -
+#define PTT_HCI_TIMEOUT_C 1000 * 1000 ///< 1s
+#define PTT_HCI_TIMEOUT_D 500 * 1000 ///< 500 ms
+#define PTT_HCI_POLLING_PERIOD 140 ///< Poll register every 140 microsecondss
+
+/// TPM2_RESPONSE_HEADER size (10B) aligned to dword
+#define PTT_HCI_RESPONSE_HEADER_SIZE 12 ///< 12B
+
+/**
+ Checks whether FTPM is enabled (FTPM_STS::FTPM_EN).
+
+ @retval TRUE FTPM is enabled.
+ @retval FALSE FTPM is disabled. All LT writes will be dropped.
+ All LT reads will be returned with read data value of all 0's.
+ The bit can only be written once per ME power cycle.
+**/
+BOOLEAN
+EFIAPI
+PttHciPresenceCheck (
+ VOID
+ );
+
+/**
+ Checks whether TPM2_Startup command has been executed (FTPM_STS::STARTUP_EXEC).
+ If command was executed, it should not be redundantly issued again.
+
+ @retval TRUE Startup command executed already.
+ @retval FALSE Startup command not executed yet.
+**/
+BOOLEAN
+EFIAPI
+PttHciStartupExecuted (
+ VOID
+ );
+
+/**
+ Sets FTPM_CMD and CA_START register to a defined value to indicate that a command is
+ available for processing.
+ Any host write to this register shall result in an interrupt to the ME firmware.
+
+ @retval EFI_SUCCESS Register successfully written.
+ @retval TBD
+**/
+EFI_STATUS
+EFIAPI
+PttHciRequestCommandExec (
+ VOID
+ );
+
+/**
+ Checks whether the value of a FTPM register satisfies the input BIT setting.
+
+ @param[in] Register Address port of register to be checked.
+ @param[in] BitSet Check these data bits are set.
+ @param[in] BitClear Check these data bits are clear.
+ @param[in] TimeOut The max wait time (unit MicroSecond) when checking register.
+
+ @retval EFI_SUCCESS The register satisfies the check bit.
+ @retval EFI_TIMEOUT The register can't run into the expected status in time.
+**/
+EFI_STATUS
+EFIAPI
+PttHciWaitRegisterBits(
+ IN EFI_PHYSICAL_ADDRESS RegAddress,
+ IN UINT32 BitSet,
+ IN UINT32 BitClear,
+ IN UINT32 TimeOut
+ );
+
+/**
+ Sends command to FTPM for execution.
+
+ @param[in] FtpmBuffer Buffer for TPM command data.
+ @param[in] DataLength TPM command data length.
+
+ @retval EFI_SUCCESS Operation completed successfully.
+ @retval EFI_TIMEOUT The register can't run into the expected status in time.
+**/
+EFI_STATUS
+EFIAPI
+PttHciSend(
+ IN UINT8 *FtpmBuffer,
+ IN UINT32 DataLength
+ );
+
+/**
+ Receives response data of last command from FTPM.
+
+ @param[out] FtpmBuffer Buffer for response data.
+ @param[out] RespSize Response data length.
+
+ @retval EFI_SUCCESS Operation completed successfully.
+ @retval EFI_TIMEOUT The register can't run into the expected status in time.
+ @retval EFI_DEVICE_ERROR Unexpected device status.
+ @retval EFI_BUFFER_TOO_SMALL Response data is too long.
+**/
+EFI_STATUS
+EFIAPI
+PttHciReceive(
+ OUT UINT8 *FtpmBuffer,
+ OUT UINT32 *RespSize
+ );
+
+/**
+ Sends formatted command to FTPM for execution and returns formatted response data.
+
+ @param[in] InputBuffer Buffer for the input data.
+ @param[in] InputBufferSize Size of the input buffer.
+ @param[out] ReturnBuffer Buffer for the output data.
+ @param[out] ReturnBufferSize Size of the output buffer.
+
+ @retval EFI_SUCCESS Operation completed successfully.
+ @retval EFI_TIMEOUT The register can't run into the expected status in time.
+**/
+EFI_STATUS
+EFIAPI
+PttHciSubmitCommand(
+ IN UINT8 *InputBuffer,
+ IN UINT32 InputBufferSize,
+ OUT UINT8 *ReturnBuffer,
+ OUT UINT32 *ReturnBufferSize
+ );
+
+/**
+ Checks whether PTT is Ready
+
+ @retval TRUE PTT is ready.
+ @retval FALSE PTT is not ready
+
+**/
+BOOLEAN
+EFIAPI
+PttHciReadyCheck (
+ VOID
+ );
+
+#endif // PTT_FLAG
+#endif
diff --git a/ReferenceCode/ME/Library/Ptt/Include/PttHciRegs.h b/ReferenceCode/ME/Library/Ptt/Include/PttHciRegs.h
new file mode 100644
index 0000000..cba0c8a
--- /dev/null
+++ b/ReferenceCode/ME/Library/Ptt/Include/PttHciRegs.h
@@ -0,0 +1,100 @@
+/** @file
+ Register definitions for PTT HCI (Platform Trust Technology - Host Controller Interface).
+
+ Conventions:
+
+ - Prefixes:
+ Definitions beginning with "R_" are registers
+ Definitions beginning with "B_" are bits within registers
+ Definitions beginning with "V_" are meaningful values of bits within the registers
+ Definitions beginning with "S_" are register sizes
+ Definitions beginning with "N_" are the bit position
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PTT_HCI_REGS_H_
+#define _PTT_HCI_REGS_H_
+
+#ifdef PTT_FLAG
+
+///
+/// FTPM HCI register base address
+///
+#define R_PTT_HCI_BASE_ADDRESS 0xFED70000
+
+//
+// FTPM HCI Control Area
+//
+#define R_PTT_HCI_CA_RSVD 0x00
+#define R_PTT_HCI_CA_ERROR 0x04
+#define R_PTT_HCI_CA_CANCEL 0x08
+#define R_PTT_HCI_CA_START 0x0C
+#define R_PTT_HCI_CA_INT_RSVD 0x10
+#define R_PTT_HCI_CA_CMD_SZ 0x18
+#define R_PTT_HCI_CA_CMD 0x1C
+#define R_PTT_HCI_CA_RSP_SZ 0x24
+#define R_PTT_HCI_CA_RSP 0x28
+
+//
+// FTPM HCI Private Area
+//
+#define R_PTT_HCI_CMD 0x40
+#define R_PTT_HCI_STS 0x44
+
+///
+/// FTPM HCI Command and Response Buffer
+///
+#define R_PTT_HCI_CRB 0x80
+
+//
+// R_PTT_HCI_STS Flags
+//
+#define B_PTT_HCI_STS_ENABLED 0x00000001 ///< BIT0
+#define B_PTT_HCI_STS_READY 0x00000002 ///< BIT1
+#define B_PTT_HCI_STS_ACM_AS_CRTM 0x00000004 ///< BIT2
+#define B_PTT_HCI_STS_STARTUP_EXEC 0x00000008 ///< BIT3
+
+//
+// Value written to R_PTT_HCI_CMD and CA_START
+// to indicate that a command is available for processing
+//
+#define V_PTT_HCI_COMMAND_AVAILABLE_START 0x00000001
+#define V_PTT_HCI_COMMAND_AVAILABLE_CMD 0x00000000
+#define V_PTT_HCI_BUFFER_ADDRESS_RDY 0x00000003
+
+///
+/// Ignore bit setting mask for WaitRegisterBits
+///
+#define V_PTT_HCI_IGNORE_BITS 0x00000000
+
+///
+/// All bits clear mask for WaitRegisterBits
+///
+#define V_PTT_HCI_ALL_BITS_CLEAR 0xFFFFFFFF
+#define V_PTT_HCI_START_CLEAR 0x00000001
+
+///
+/// Max FTPM command/reponse buffer length
+///
+#define S_PTT_HCI_CRB_LENGTH 3968 ///< 0xFED70080:0xFED70FFF = 3968 Bytes
+// AMI-Core Override for PTT +
+#define PM_BASE_ADDRESS 0x1800
+// AMI-Core Override for PTT -
+
+#endif // PTT_FLAG
+#endif
diff --git a/ReferenceCode/ME/Library/Ptt/Include/PttLibInc.cif b/ReferenceCode/ME/Library/Ptt/Include/PttLibInc.cif
new file mode 100644
index 0000000..a444f07
--- /dev/null
+++ b/ReferenceCode/ME/Library/Ptt/Include/PttLibInc.cif
@@ -0,0 +1,9 @@
+<component>
+ name = "PttLibrary Include"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Me\Library\Ptt\Include"
+ RefName = "PttLibInc"
+[files]
+"PttHciDeviceLib.h"
+"PttHciRegs.h"
+<endComponent>
diff --git a/ReferenceCode/ME/Library/Ptt/Pei/PttHciDeviceLib.c b/ReferenceCode/ME/Library/Ptt/Pei/PttHciDeviceLib.c
new file mode 100644
index 0000000..107a3ca
--- /dev/null
+++ b/ReferenceCode/ME/Library/Ptt/Pei/PttHciDeviceLib.c
@@ -0,0 +1,590 @@
+/**
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+/**
+
+Copyright (c) 2012 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+ @file
+ PttHciDeviceLib.c
+
+ @brief
+ Implements Platform Trust Technology (FTPM) HCI Device Library.
+
+**/
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueBase.h"
+#endif
+
+#ifdef PTT_FLAG
+#include "PttHciRegs.h"
+#include "PttHciDeviceLib.h"
+#include <IndustryStandard/Tpm20.h>
+
+#ifdef EFI_DEBUG
+/**
+
+ Prints command or response buffer for debugging purposes.
+
+ @param[in] Buffer Buffer to print.
+ @param[in] BufferSize Buffer data length.
+
+**/
+VOID
+EFIAPI
+PttHciPrintBuffer(IN UINT8 *Buffer, IN UINT32 BufferSize)
+{
+ UINT32 Index;
+
+ DEBUG ((EFI_D_INFO, "Buffer Address: 0x%08x, Size: 0x%08x, Value:\n", Buffer, BufferSize));
+ for(Index = 0; Index < BufferSize; Index++){
+ DEBUG ((EFI_D_INFO, "%02x ", *(Buffer + Index)));
+ if((Index+1) % 16 == 0) DEBUG ((EFI_D_INFO, "\n"));
+ }
+ DEBUG ((EFI_D_INFO, "\n"));
+}
+#endif // EFI_DEBUG
+
+
+
+VOID MicroSecDelay (
+ UINTN Delay
+)
+{
+ UINTN Counter, i;
+ UINT32 Data32, PrevData;
+ UINT32 Remainder;
+
+ Counter = (UINTN)DivU64x32Remainder ((UINT64)(Delay * 10), 3, &Remainder);
+ if (Remainder != 0) {
+ Counter++;
+ }
+ //
+ // Call WaitForTick for Counter + 1 ticks to try to guarantee Counter tick
+ // periods, thus attempting to ensure Microseconds of stall time.
+ //
+ if (Counter != 0) {
+
+ PrevData = IoRead32(PM_BASE_ADDRESS + 8);
+ for (i = 0; i < Counter; ) {
+ Data32 = IoRead32(PM_BASE_ADDRESS + 8);
+ if (Data32 < PrevData) { // Reset if there is a overlap
+ PrevData=Data32;
+ continue;
+ }
+ i += (Data32 - PrevData);
+ PrevData = Data32;
+ }
+ }
+ return;
+}
+
+/**
+ Copy data from the MMIO region to system memory by using 32-bit access.
+
+ Copy data from the MMIO region specified by starting address StartAddress
+ to system memory specified by Buffer by using 32-bit access. The total
+ number of byte to be copied is specified by Length. Buffer is returned.
+
+ If StartAddress is not aligned on a 32-bit boundary, then ASSERT().
+
+ If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
+ If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
+
+ If Length is not aligned on a 32-bit boundary, then ASSERT().
+ If Buffer is not aligned on a 32-bit boundary, then ASSERT().
+
+ @param StartAddress The starting address for the MMIO region to be copied from.
+ @param Length The size, in bytes, of Buffer.
+ @param Buffer The pointer to a system memory buffer receiving the data read.
+
+ @return Buffer
+
+**/
+UINT32 *
+EFIAPI
+MmioReadBuffer32 (
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ OUT UINT32 *Buffer
+ )
+{
+ UINT32 *ReturnBuffer;
+
+ ASSERT ((StartAddress & (sizeof (UINT32) - 1)) == 0);
+
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
+
+ ASSERT ((Length & (sizeof (UINT32) - 1)) == 0);
+ ASSERT (((UINTN) Buffer & (sizeof (UINT32) - 1)) == 0);
+
+ ReturnBuffer = Buffer;
+
+ while (Length != 0) {
+ *(Buffer++) = MmioRead32 (StartAddress);
+ StartAddress += sizeof (UINT32);
+ Length -= sizeof (UINT32);
+ }
+
+ return ReturnBuffer;
+}
+
+/**
+ Copy data from system memory to the MMIO region by using 32-bit access.
+
+ Copy data from system memory specified by Buffer to the MMIO region specified
+ by starting address StartAddress by using 32-bit access. The total number
+ of byte to be copied is specified by Length. Buffer is returned.
+
+ If StartAddress is not aligned on a 32-bit boundary, then ASSERT().
+
+ If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
+ If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().
+
+ If Length is not aligned on a 32-bit boundary, then ASSERT().
+
+ If Buffer is not aligned on a 32-bit boundary, then ASSERT().
+
+ @param StartAddress The starting address for the MMIO region to be copied to.
+ @param Length The size, in bytes, of Buffer.
+ @param Buffer The pointer to a system memory buffer containing the data to write.
+
+ @return Buffer
+
+**/
+UINT32 *
+EFIAPI
+MmioWriteBuffer32 (
+ IN UINTN StartAddress,
+ IN UINTN Length,
+ IN CONST UINT32 *Buffer
+ )
+{
+ UINT32 *ReturnBuffer;
+
+ ASSERT ((StartAddress & (sizeof (UINT32) - 1)) == 0);
+
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
+ ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
+
+ ASSERT ((Length & (sizeof (UINT32) - 1)) == 0);
+ ASSERT (((UINTN) Buffer & (sizeof (UINT32) - 1)) == 0);
+
+ ReturnBuffer = (UINT32 *) Buffer;
+
+ while (Length != 0) {
+ MmioWrite32 (StartAddress, *(Buffer++));
+
+ StartAddress += sizeof (UINT32);
+ Length -= sizeof (UINT32);
+ }
+
+ return ReturnBuffer;
+}
+
+/**
+
+ Checks whether FTPM is enabled (FTPM_STS::FTPM_EN).
+
+ @retval TRUE FTPM is enabled.
+ @retval FALSE FTPM is disabled. All LT writes will be dropped.
+ All LT reads will be returned with read data value of all 0’s.
+ The bit can only be written once per ME power cycle.
+
+**/
+BOOLEAN
+EFIAPI
+PttHciPresenceCheck()
+{
+ EFI_STATUS Status;
+
+ DEBUG ((EFI_D_INFO, "PTT: PttHciPresenceCheck start\n"));
+ DEBUG ((EFI_D_INFO, "Check FTPM_STS - ENABLED bit (@ 0x%08x)\n", (R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_STS)));
+ Status = PttHciWaitRegisterBits(
+ (EFI_PHYSICAL_ADDRESS)(UINTN)(R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_STS),
+ B_PTT_HCI_STS_ENABLED,
+ V_PTT_HCI_IGNORE_BITS,
+ PTT_HCI_TIMEOUT_A
+ );
+ if(Status == EFI_SUCCESS){
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/**
+
+ Checks whether TPM2_Startup command has been executed (FTPM_STS::STARTUP_EXEC).
+ If command was executed, it should not be redundantly issued again.
+
+ @retval TRUE Startup command executed already.
+ @retval FALSE Startup command not executed yet.
+
+**/
+BOOLEAN
+EFIAPI
+PttHciStartupExecuted()
+{
+ EFI_STATUS Status;
+
+ DEBUG ((EFI_D_INFO, "PTT: PttHciStartupExecuted start\n"));
+ DEBUG ((EFI_D_INFO, "Check FTPM_STS - STARTUP_EXECECUTED bit (@ 0x%08x)\n", (R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_STS)));
+ Status = PttHciWaitRegisterBits(
+ (EFI_PHYSICAL_ADDRESS)(UINTN)(R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_STS),
+ B_PTT_HCI_STS_STARTUP_EXEC,
+ V_PTT_HCI_IGNORE_BITS,
+ PTT_HCI_TIMEOUT_A
+ );
+ if(Status == EFI_SUCCESS){
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/**
+
+ Sets FTPM_CMD and CA_START register to a defined value to indicate that a command is
+ available for processing.
+ Any host write to this register shall result in an interrupt to the ME firmware.
+
+ @retval EFI_SUCCESS Register successfully written.
+ @retval TBD
+
+**/
+EFI_STATUS
+EFIAPI
+PttHciRequestCommandExec()
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+
+ DEBUG ((EFI_D_INFO, "PTT: PttHciRequestCommandExec start\n"));
+
+ DEBUG ((EFI_D_INFO, "Command ready for processing - write 0x%08x to FTPM_CA_START register (@ 0x%08x)\n",
+ V_PTT_HCI_COMMAND_AVAILABLE_START,
+ (R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CA_START)));
+ MmioWrite32((UINTN)R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CA_START, V_PTT_HCI_COMMAND_AVAILABLE_START);
+
+ ///
+ /// Write 0x1 to HCI CMD register to indicate that a command is available for processing
+ ///
+ DEBUG ((EFI_D_INFO, "Command ready for processing - write 0x%08x to FTPM_CMD register (@ 0x%08x)\n",
+ V_PTT_HCI_COMMAND_AVAILABLE_CMD,
+ (R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CMD)));
+ MmioWrite32((UINTN)R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CMD, V_PTT_HCI_COMMAND_AVAILABLE_CMD);
+
+ return Status;
+}
+
+/**
+
+ Checks whether the value of a FTPM register satisfies the input BIT setting.
+
+ @param[in] Register Address port of register to be checked.
+ @param[in] BitSet Check these data bits are set.
+ @param[in] BitClear Check these data bits are clear.
+ @param[in] TimeOut The max wait time (unit MicroSecond) when checking register.
+
+ @retval EFI_SUCCESS The register satisfies the check bit.
+ @retval EFI_TIMEOUT The register can't run into the expected status in time.
+
+**/
+EFI_STATUS
+EFIAPI
+PttHciWaitRegisterBits(
+ IN EFI_PHYSICAL_ADDRESS RegAddress,
+ IN UINT32 BitSet,
+ IN UINT32 BitClear,
+ IN UINT32 TimeOut
+ )
+{
+ UINT32 RegRead;
+ UINT32 WaitTime;
+
+ DEBUG ((EFI_D_INFO, "PTT: PttHciWaitRegisterBits start\n"));
+
+ for (WaitTime = 0; WaitTime < TimeOut; WaitTime += PTT_HCI_POLLING_PERIOD){
+ RegRead = MmioRead32 ((UINTN)RegAddress);
+ DEBUG ((EFI_D_INFO, "RegRead: 0x%08x, BitSetMask: 0x%08x, BitClearMask: 0x%08x, WaitTime: %d (microsec)\n", RegRead, BitSet, BitClear, WaitTime));
+
+ if (RegRead == 0xFFFFFFFF)
+ continue;
+
+ if ((RegRead & BitSet) == BitSet && (RegRead & BitClear) == 0) {
+ return EFI_SUCCESS;
+ }
+
+// MicroSecondDelay (PTT_HCI_POLLING_PERIOD);
+ MicroSecDelay(PTT_HCI_POLLING_PERIOD);
+ }
+ return EFI_TIMEOUT;
+}
+
+/**
+
+ Sends command to FTPM for execution.
+
+ @param[in] FtpmBuffer Buffer for TPM command data.
+ @param[in] DataLength TPM command data length.
+
+ @retval EFI_SUCCESS Operation completed successfully.
+ @retval EFI_TIMEOUT The register can't run into the expected status in time.
+
+**/
+EFI_STATUS
+EFIAPI
+PttHciSend(
+ IN UINT8 *FtpmBuffer,
+ IN UINT32 DataLength
+ )
+{
+ EFI_STATUS Status;
+
+ DEBUG ((EFI_D_INFO, "PTT: PttHciSend start\n"));
+
+ Status = PttHciWaitRegisterBits(
+ (EFI_PHYSICAL_ADDRESS)(UINTN)(R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CA_START),
+ V_PTT_HCI_IGNORE_BITS,
+ V_PTT_HCI_START_CLEAR,
+ PTT_HCI_TIMEOUT_A
+ );
+
+ if(EFI_ERROR (Status)){
+ DEBUG ((EFI_D_ERROR, "FTPM_CA_START register not clear - TPM2 command cannot be sent! EFI_ERROR = %r\n", Status));
+ return EFI_NOT_READY;
+ }
+ ///
+ /// Align command size to dword before writing to FTPM_CRB
+ ///
+ if(DataLength % 4 != 0){
+ DEBUG ((EFI_D_INFO, "Alignment: DataLength change from %d ", DataLength));
+ DataLength += (4 - (DataLength % 4));
+ DEBUG ((EFI_D_INFO, "to %d\n", DataLength));
+ }
+
+ MmioWriteBuffer32((UINTN)(R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CRB), (UINTN)DataLength, (UINT32*)FtpmBuffer);
+
+ ///
+ /// FTPM_CA_CMD - the physical address to which the TPM 2.0 driver will write the command to execute
+ ///
+ MmioWrite32((UINTN)(R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CA_CMD), R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CRB);
+ MmioWrite32((UINTN)(R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CA_CMD_SZ), S_PTT_HCI_CRB_LENGTH);
+
+ DEBUG ((EFI_D_INFO, "FTPM_CA_CMD (@ 0x%08x) written, value = 0x%08x\n",
+ (R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CA_CMD),
+ R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CRB));
+ DEBUG ((EFI_D_INFO, "FTPM_CA_CMD_SZ (@ 0x%08x) written, value = 0x%08x\n",
+ (R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CA_CMD_SZ), DataLength));
+
+ ///
+ /// Set FTPM_CMD and FTPM_CA_START registers to indicate TPM command ready for execution
+ ///
+ Status = PttHciRequestCommandExec();
+#ifdef EFI_DEBUG
+ if(Status == EFI_SUCCESS){
+ DEBUG ((EFI_D_INFO, "FTPM_CMD register written - TPM2 command available for processing\n"));
+ }
+#endif
+
+ return Status;
+}
+
+/**
+
+ Receives response data of last command from FTPM.
+
+ @param[out] FtpmBuffer Buffer for response data.
+ @param[out] RespSize Response data length.
+
+ @retval EFI_SUCCESS Operation completed successfully.
+ @retval EFI_TIMEOUT The register can't run into the expected status in time.
+ @retval EFI_DEVICE_ERROR Unexpected device status.
+ @retval EFI_BUFFER_TOO_SMALL Response data is too long.
+
+**/
+EFI_STATUS
+EFIAPI
+PttHciReceive(
+ OUT UINT8 *FtpmBuffer,
+ OUT UINT32 *RespSize
+ )
+{
+ EFI_STATUS Status;
+ UINT16 Data16;
+ UINT32 Data32;
+ DEBUG ((EFI_D_INFO, "PTT: PttHciReceive start\n"));
+
+ ///
+ /// Wait for the command completion - poll FTPM_CA_START clear
+ ///
+ DEBUG ((EFI_D_INFO, "PTT: Check Start status (FTPM_CA_START)\n"));
+ Status = PttHciWaitRegisterBits(
+ (EFI_PHYSICAL_ADDRESS)(UINTN)(R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CA_START),
+ V_PTT_HCI_IGNORE_BITS,
+ V_PTT_HCI_START_CLEAR,
+ PTT_HCI_TIMEOUT_B
+ );
+ if(EFI_ERROR (Status)){
+ DEBUG ((EFI_D_ERROR, "FTPM_CA_START register not clear - TPM2 response cannot be read! EFI_ERROR = %r\n", Status));
+ goto Exit;
+ }
+
+ ///
+ /// Check for error condition - FTPM_CA_ERROR
+ ///
+ DEBUG ((EFI_D_INFO, "PTT: Check Error status (FTPM_CA_ERROR)\n"));
+ Status = PttHciWaitRegisterBits(
+ (EFI_PHYSICAL_ADDRESS)(UINTN)(R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CA_ERROR),
+ V_PTT_HCI_IGNORE_BITS,
+ V_PTT_HCI_ALL_BITS_CLEAR,
+ PTT_HCI_TIMEOUT_A
+ );
+ if(EFI_ERROR (Status)){
+ DEBUG ((EFI_D_ERROR, "FTPM_CA_ERROR register set - TPM2 response cannot be provided! EFI_ERROR = %r\n", Status));
+ Status = EFI_DEVICE_ERROR;
+ goto Exit;
+ }
+
+ DEBUG ((EFI_D_INFO, "FTPM_CA_START register clear - TPM2 command processing completed - ready to read\n"));
+
+ ///
+ /// Read the response data header
+ ///
+ MmioReadBuffer32((UINTN)R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CRB, PTT_HCI_RESPONSE_HEADER_SIZE, (UINT32*)FtpmBuffer);
+
+ ///
+ /// Check the reponse data header (tag, parasize and returncode)
+ ///
+ CopyMem (&Data16, FtpmBuffer, sizeof (UINT16));
+ DEBUG ((EFI_D_INFO, "TPM2_RESPONSE_HEADER.tag = 0x%04x\n", SwapBytes16(Data16)));
+
+ ///
+ /// TPM Rev 2.0 Part 2 - 6.9 TPM_ST (Structure Tags)
+ /// TPM_ST_RSP_COMMAND - Used in a response that has an error in the tag.
+ ///
+ if (SwapBytes16(Data16) == TPM_ST_RSP_COMMAND) {
+ DEBUG ((EFI_D_ERROR, "TPM2_RESPONSE_HEADER.tag = TPM_ST_RSP_COMMAND - Error in response!\n"));
+ Status = EFI_DEVICE_ERROR;
+ goto Exit;
+ }
+
+ CopyMem(&Data32, (FtpmBuffer + 2), sizeof(UINT32));
+ DEBUG ((EFI_D_INFO, "TPM2_RESPONSE_HEADER.paramSize = 0x%08x\n", SwapBytes32(Data32)));
+
+ *RespSize = SwapBytes32(Data32);
+
+ if(*RespSize == sizeof(TPM2_RESPONSE_HEADER)) {
+ Status = EFI_SUCCESS;
+ goto Exit;
+ }
+ if(*RespSize < sizeof(TPM2_RESPONSE_HEADER)) {
+ Status = EFI_DEVICE_ERROR;
+ goto Exit;
+ }
+ if(*RespSize > S_PTT_HCI_CRB_LENGTH) {
+ Status = EFI_BUFFER_TOO_SMALL;
+ goto Exit;
+ }
+
+ ///
+ /// Align command size to dword before writing to FTPM_CRB
+ ///
+ if(*RespSize % 4 != 0){
+ DEBUG ((EFI_D_INFO, "Alignment: RespSize change from %d ", *RespSize));
+ *RespSize += (4 - (*RespSize % 4));
+ DEBUG ((EFI_D_INFO, "to %d\n", *RespSize));
+ }
+
+ ///
+ /// Reading the entire response data
+ ///
+ MmioReadBuffer32((UINTN)R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CRB, *RespSize, (UINT32*)FtpmBuffer);
+
+ Exit:
+ if(!EFI_ERROR(Status)){
+ ///
+ /// FTPM_CA_CMD - the physical address from which the TPM 2.0 driver will read command responses
+ ///
+ MmioWrite32((UINTN)(R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CA_RSP), R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CRB);
+ MmioWrite32((UINTN)(R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CA_RSP_SZ),S_PTT_HCI_CRB_LENGTH);
+ DEBUG ((EFI_D_INFO, "FTPM_CA_RSP (@ 0x%08x) written, value = 0x%08x\n",
+ (R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CA_RSP),
+ (R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CRB)));
+ DEBUG ((EFI_D_INFO, "FTPM_CA_RSP_SZ (@ 0x%08x) written, value = 0x%08x\n",
+ (R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CA_RSP_SZ), *RespSize));
+ }
+
+ return Status;
+}
+
+/**
+
+ Sends formatted command to FTPM for execution and returns formatted response data.
+
+ @param[in] InputBuffer Buffer for the input data.
+ @param[in] InputBufferSize Size of the input buffer.
+ @param[out] ReturnBuffer Buffer for the output data.
+ @param[out] ReturnBufferSize Size of the output buffer.
+
+ @retval EFI_SUCCESS Operation completed successfully.
+ @retval EFI_TIMEOUT The register can't run into the expected status in time.
+
+**/
+EFI_STATUS
+EFIAPI
+PttHciSubmitCommand(
+ IN UINT8 *InputBuffer,
+ IN UINT32 InputBufferSize,
+ OUT UINT8 *ReturnBuffer,
+ OUT UINT32 *ReturnBufferSize
+ )
+{
+ EFI_STATUS Status;
+ DEBUG ((EFI_D_INFO, "PTT: PttHciSubmitCommand start\n"));
+
+ if(InputBuffer == NULL || ReturnBuffer == NULL || InputBufferSize == 0){
+ DEBUG ((EFI_D_ERROR, "Buffer == NULL or InputBufferSize == 0\n"));
+ return EFI_INVALID_PARAMETER;
+ }
+
+ DEBUG ((EFI_D_INFO, "PTT: Command Buffer dump\n"));
+
+ ///
+ /// Send the command to TPM
+ ///
+ Status = PttHciSend(InputBuffer, InputBufferSize);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "FTpmHciSend EFI_ERROR = %r\n", Status));
+ return Status;
+ }
+
+ ///
+ /// Receive the response data from TPM
+ ///
+ Status = PttHciReceive(ReturnBuffer, ReturnBufferSize);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "FTpmHciReceive EFI_ERROR = %r\n", Status));
+ return Status;
+ }
+
+ DEBUG ((EFI_D_INFO, "PTT: Response Buffer dump\n"));
+
+ return Status;
+}
+
+#endif // PTT_FLAG \ No newline at end of file
diff --git a/ReferenceCode/ME/Library/Ptt/Pei/PttHciDevicePeiLib.cif b/ReferenceCode/ME/Library/Ptt/Pei/PttHciDevicePeiLib.cif
new file mode 100644
index 0000000..c0c66b4
--- /dev/null
+++ b/ReferenceCode/ME/Library/Ptt/Pei/PttHciDevicePeiLib.cif
@@ -0,0 +1,12 @@
+<component>
+ name = "PTT Pei Library"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Me\Library\Ptt\Pei\"
+ RefName = "PttHciDevicePeiLib"
+[files]
+"PttHciDevicePeiLib.inf"
+"PttHciDeviceLib.c"
+"PttHciDevicePeiLib.h"
+"PttHciDevicePeiLib.sdl"
+"PttHciDevicePeiLib.mak"
+<endComponent>
diff --git a/ReferenceCode/ME/Library/Ptt/Pei/PttHciDevicePeiLib.h b/ReferenceCode/ME/Library/Ptt/Pei/PttHciDevicePeiLib.h
new file mode 100644
index 0000000..2decd76
--- /dev/null
+++ b/ReferenceCode/ME/Library/Ptt/Pei/PttHciDevicePeiLib.h
@@ -0,0 +1,37 @@
+/** @file
+ Platform Trust Technology (FTPM) HCI Device Pei Library
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PTT_HCI_DEVICE_PEI_LIB_H_
+#define _PTT_HCI_DEVICE_PEI_LIB_H_
+
+#ifdef PTT_FLAG
+///
+/// External include files do NOT need to be explicitly specified in real EDKII
+/// environment
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#endif
+///
+/// Common header for HCI Library
+///
+#include "PttHciDeviceLib.h"
+#endif // PTT_FLAG
+#endif
diff --git a/ReferenceCode/ME/Library/Ptt/Pei/PttHciDevicePeiLib.inf b/ReferenceCode/ME/Library/Ptt/Pei/PttHciDevicePeiLib.inf
new file mode 100644
index 0000000..faac249
--- /dev/null
+++ b/ReferenceCode/ME/Library/Ptt/Pei/PttHciDevicePeiLib.inf
@@ -0,0 +1,71 @@
+## @file
+# Component description file for PttHciDevice PEI Library.
+#
+#@copyright
+# Copyright (c) 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = PttHciDevicePeiLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ PttHciDevicePeiLib.h
+ ../Common/PttHciDeviceLib.c
+ ../Include/PttHciRegs.h
+ ../Include/PttHciDeviceLib.h
+
+[includes.common]
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/Ptt/Include
+# Path to Tpm20.h should be updated when available in the code tree (core)
+# $(EFI_SOURCE)/SecurityPkg/Include/IndustryStandard
+
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/SampleCode
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/SampleCode/Include
+
+[libraries.common]
+ EdkIIGlueBaseLib
+ EdkIIGlueBaseMemoryLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueBaseTimerLibLocalApic
+ EdkIIGluePeiDebugLibReportStatusCode
+
+[nmake.common]
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_LIB__ \
+ -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D PTT_FLAG
+
diff --git a/ReferenceCode/ME/Library/Ptt/Pei/PttHciDevicePeiLib.mak b/ReferenceCode/ME/Library/Ptt/Pei/PttHciDevicePeiLib.mak
new file mode 100644
index 0000000..d791a33
--- /dev/null
+++ b/ReferenceCode/ME/Library/Ptt/Pei/PttHciDevicePeiLib.mak
@@ -0,0 +1,80 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2010, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+#**********************************************************************
+#
+# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeLibrary/PTT/PTT Pei Library/PttHciDevicePeiLib.mak 1 12/18/12 5:48a Klzhan $
+#
+# $Revision: 1 $
+#
+# $Date: 12/18/12 5:48a $
+#
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeLibrary/PTT/PTT Pei Library/PttHciDevicePeiLib.mak $
+#
+# 1 12/18/12 5:48a Klzhan
+# [TAG] EIPNone
+# [Category] Improvement
+# [Description] AMI modify for TPM2.0
+#
+#**********************************************************************
+#
+#<AMI_FHDR_START>
+#----------------------------------------------------------------------------
+#
+# Name:
+#
+# Description:
+#
+#----------------------------------------------------------------------------
+#<AMI_FHDR_END>
+all : PttHciDevicePeiLib
+
+PttHciDevicePeiLib : $(BUILD_DIR)\PttHciDevicePeiLib.mak PttHciDevicePeiLibBin
+
+$(BUILD_DIR)\PttHciDevicePeiLib.mak : $(PttHciDevicePeiLib_DIR)\PttHciDevicePeiLib.cif $(PttHciDevicePeiLib_DIR)\PttHciDevicePeiLib.mak $(BUILD_RULES)
+ $(CIF2MAK) $(PttHciDevicePeiLib_DIR)\PttHciDevicePeiLib.cif $(CIF2MAK_DEFAULTS)
+
+PttHciDevicePeiLib_INCLUDES= \
+ $(ME_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(EdkIIGlueInclude)\
+ $(IndustryStandard_INCLUDES)\
+ /IReferenceCode\ME\SampleCode\
+ $(INTEL_PCH_INCLUDES)\
+
+
+PttHciDevicePeiLib_DEFINES = $(MY_DEFINES)\
+ /D __EDKII_GLUE_PEI_SERVICES_LIB__ \
+!IF "$(IntelPTT_SUPPORT)"=="1"
+ /D PTT_FLAG
+!ENDIF
+
+
+PttHciDevicePeiLib_LIB_LINKS =\
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGluePeiDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueBaseTimerLibLocalApic_LIB)
+
+
+PttHciDevicePeiLibBin: $(PttHciDevicePeiLib_LIB_LINKS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\PttHciDevicePeiLib.mak all\
+ "MY_INCLUDES=$(PttHciDevicePeiLib_INCLUDES)"\
+ "MY_DEFINES=$(PttHciDevicePeiLib_DEFINES)"\
+ GUID=D58E4250-FDFF-4f6c-B972-9FCA453B3397\
+ TYPE=PEI_LIBRARY
diff --git a/ReferenceCode/ME/Library/Ptt/Pei/PttHciDevicePeiLib.sdl b/ReferenceCode/ME/Library/Ptt/Pei/PttHciDevicePeiLib.sdl
new file mode 100644
index 0000000..fc3f8cf
--- /dev/null
+++ b/ReferenceCode/ME/Library/Ptt/Pei/PttHciDevicePeiLib.sdl
@@ -0,0 +1,36 @@
+TOKEN
+ Name = "PttHciDevicePeiLib_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable PttHciDevicePeiLib support in Project"
+End
+
+MODULE
+ Help = "Includes PttHciDevicePeiLib.mak to Project"
+ File = "PttHciDevicePeiLib.mak"
+End
+
+PATH
+ Name = "PttHciDevicePeiLib_DIR"
+ Help = ""
+End
+
+ELINK
+ Name = "PttHciDevicePeiLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PttHciDevicePeiLib.lib"
+ Parent = "PttHciDevicePeiLib_LIB"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(PttHciDevicePeiLib_DIR)"
+ Parent = "ME_INCLUDES"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/ME/Library/Ptt/PttLibrary.cif b/ReferenceCode/ME/Library/Ptt/PttLibrary.cif
new file mode 100644
index 0000000..f768f03
--- /dev/null
+++ b/ReferenceCode/ME/Library/Ptt/PttLibrary.cif
@@ -0,0 +1,14 @@
+<component>
+ name = "PttLibrary"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Me\Library\Ptt\"
+ RefName = "PttLibrary"
+[files]
+"PttLibrary.sdl"
+"PttLibrary.mak"
+[parts]
+"PttHciDeviceLib"
+"PttHciDeviceDxeLib"
+"PttHciDevicePeiLib"
+"PttLibInc"
+<endComponent>
diff --git a/ReferenceCode/ME/Library/Ptt/PttLibrary.mak b/ReferenceCode/ME/Library/Ptt/PttLibrary.mak
new file mode 100644
index 0000000..0f65d78
--- /dev/null
+++ b/ReferenceCode/ME/Library/Ptt/PttLibrary.mak
@@ -0,0 +1,101 @@
+# /*++
+# Copyright (c) 2009 Intel Corporation. All rights reserved.
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+# --*/
+# MAK file for the ModulePart:AtDxeLib
+all : PttDxeLib PttPeiLib
+
+
+$(BUILD_DIR)\PttDxeLibrary.lib : PttDxeLib
+
+PttDxeLib : $(BUILD_DIR)\PttLibrary.mak PttDxeLibBin
+
+PttDxeLib_INCLUDES=\
+ $(EDK_INCLUDES) \
+ $(EdkIIGlueLib_INCLUDES) \
+ $(ME_INCLUDES) \
+ -IReferenceCode\ME\SampleCode\Include\IndustryStandard\
+
+PttDxeLib_DEFINES=\
+ -D __EDKII_GLUE_BASE_LIB__ \
+ -D __EDKII_GLUE_UEFI_LIB__ \
+ -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D TIANO_RELEASE_VERSION=0x00080006\
+ -D PTT_FLAG
+
+$(BUILD_DIR)\PttLibrary.mak : $(MePttLibrary_DIR)\Common\PttHciDeviceLib.cif $(MePttLibrary_DIR)\PttLibrary.mak $(BUILD_RULES)
+ $(CIF2MAK) $(MePttLibrary_DIR)\Common\PttHciDeviceLib.cif $(CIF2MAK_DEFAULTS)
+
+PttDxeLib_LIBS=\
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EdkIIGlueUefiLib_LIB)\
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueBaseTimerLibLocalApic_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+
+PttDxeLibBin : $(PttDxeLib_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS) \
+ MAKEFILE=$(BUILD_DIR)\PttLibrary.mak \
+ /f $(BUILD_DIR)\PttLibrary.mak all \
+ "MY_INCLUDES=$(PttDxeLib_INCLUDES)" \
+ "MY_DEFINES=$(PttDxeLib_DEFINES)"\
+ LIBRARY_NAME=$(BUILD_DIR)\PttDxeLibrary.lib\
+ TYPE=LIBRARY \
+
+$(BUILD_DIR)\PttPeiLibrary.lib : PttPeiLib
+
+PttPeiLib : $(BUILD_DIR)\PttLibrary.mak PttPeiLibBin
+
+PttPeiLib_DEFINES=\
+ -D __EDKII_GLUE_BASE_LIB__ \
+ -D __EDKII_GLUE_UEFI_LIB__ \
+ -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D TIANO_RELEASE_VERSION=0x00080006\
+ -D PTT_FLAG
+
+PttPeiLib_LIBS=\
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EdkIIGlueUefiLib_LIB)\
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueBaseTimerLibLocalApic_LIB)\
+ $(EdkIIGluePeiDebugLibReportStatusCode_LIB)\
+
+PttPeiLibBin : $(PttPeiLib_LIBS)
+!IF "$(x64_BUILD)"=="1"
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS) BUILD_DIR=$(BUILD_DIR)\IA32\
+!ELSE
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+!ENDIF
+ MAKEFILE=$(BUILD_DIR)\PttLibrary.mak \
+ /f $(BUILD_DIR)\PttLibrary.mak all \
+ "MY_INCLUDES=$(PttDxeLib_INCLUDES)" \
+ "MY_DEFINES=$(PttPeiLib_DEFINES)"\
+ LIBRARY_NAME=$(BUILD_DIR)\PttPeiLibrary.lib\
+ TYPE=PEI_LIBRARY \
+
+
+#**********************************************************************
+#**********************************************************************
+#** **
+#** (C)Copyright 1985-2006, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 6145-F Northbelt Pkwy, Norcross, GA 30071 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#**********************************************************************
+#**********************************************************************
diff --git a/ReferenceCode/ME/Library/Ptt/PttLibrary.sdl b/ReferenceCode/ME/Library/Ptt/PttLibrary.sdl
new file mode 100644
index 0000000..3dd234e
--- /dev/null
+++ b/ReferenceCode/ME/Library/Ptt/PttLibrary.sdl
@@ -0,0 +1,59 @@
+TOKEN
+ Name = "MePttLibrary_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable Me Kernel Library support in Project"
+End
+
+PATH
+ Name = "MePttLibrary_DIR"
+ Help = "Me Library file source directory"
+End
+
+ELINK
+ Name = "/I$(MePttLibrary_DIR)\Include"
+ Parent = "ME_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(MePttLibrary_DIR)\Pei"
+ Parent = "ME_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(MePttLibrary_DIR)\Dxe"
+ Parent = "ME_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+MODULE
+ Help = "Includes PttLibrary.mak to Project"
+ File = "PttLibrary.mak"
+End
+
+ELINK
+ Name = "PttPei_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "PttDxe_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PttPeiLibrary.lib"
+ Parent = "PttPei_LIB"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PttDxeLibrary.lib"
+ Parent = "PttDxe_LIB"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/ME/Library/PttHeci/Dxe/PttHeciDxeLib.c b/ReferenceCode/ME/Library/PttHeci/Dxe/PttHeciDxeLib.c
new file mode 100644
index 0000000..2e87dd6
--- /dev/null
+++ b/ReferenceCode/ME/Library/PttHeci/Dxe/PttHeciDxeLib.c
@@ -0,0 +1,145 @@
+/** @file
+ Implements Platform Trust Technology (FTPM) HECI SkuMgr Interface Library.
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueBase.h"
+#endif
+
+#ifdef PTT_FLAG
+#include "PttHeciLib.h"
+#include "HeciMsgLib.h"
+
+#define PTT_BITMASK 0x20000000 //BIT29
+
+#define CLEAR_PTT_BIT 0x00000000
+
+/**
+ Checks whether ME FW has the Platform Trust Technology capability.
+
+ @param[out] PttCapability TRUE if PTT is supported, FALSE othewrwise.
+
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+**/
+EFI_STATUS
+EFIAPI
+PttHeciGetCapability(
+ OUT BOOLEAN *PttCapability
+ )
+{
+ EFI_STATUS Status;
+ GEN_GET_FW_CAPSKU MsgGenGetFwCapsSku;
+ GEN_GET_FW_CAPS_SKU_ACK MsgGenGetFwCapsSkuAck;
+
+ *PttCapability = FALSE;
+
+ Status = HeciGetFwCapsSkuMsg (&MsgGenGetFwCapsSku, &MsgGenGetFwCapsSkuAck);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ if (((MsgGenGetFwCapsSkuAck.MKHIHeader.Fields.Command) == FWCAPS_GET_RULE_CMD) &&
+ ((MsgGenGetFwCapsSkuAck.MKHIHeader.Fields.IsResponse) == 1) &&
+ (MsgGenGetFwCapsSkuAck.MKHIHeader.Fields.Result == 0)
+ ) {
+
+ if (MsgGenGetFwCapsSkuAck.Data.FWCapSku.Fields.PTT) {
+ *PttCapability = TRUE;
+ }
+ }
+ DEBUG ((EFI_D_INFO, "PTT SkuMgr: PttCapability = %d\n", *PttCapability));
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Checks Platform Trust Technology enablement state.
+
+ @param[out] IsPttEnabledState TRUE if PTT is enabled, FALSE othewrwise.
+
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+**/
+EFI_STATUS
+EFIAPI
+PttHeciGetState(
+ OUT BOOLEAN *IsPttEnabledState
+ )
+{
+ EFI_STATUS Status;
+ MEFWCAPS_SKU CurrentFeatures;
+
+ *IsPttEnabledState = FALSE;
+
+ Status = HeciGetFwFeatureStateMsg (&CurrentFeatures);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ if (CurrentFeatures.Fields.PTT) {
+ *IsPttEnabledState = TRUE;
+ }
+
+ DEBUG ((EFI_D_INFO, "PTT SkuMgr: PttState = %d\n", *IsPttEnabledState));
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Changes current Platform Trust Technology state.
+
+ @param[in] PttEnabledState TRUE to enable, FALSE to disable.
+
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+**/
+EFI_STATUS
+EFIAPI
+PttHeciSetState(
+ IN BOOLEAN PttEnabledState
+ )
+{
+ EFI_STATUS Status;
+ UINT32 EnableBitmap;
+ UINT32 DisableBitmap;
+
+ if (PttEnabledState) {
+ //
+ // Enable PTT
+ //
+ DEBUG ((EFI_D_INFO, "PTT SkuMgr: Enable PTT\n"));
+ EnableBitmap = PTT_BITMASK;
+ DisableBitmap = CLEAR_PTT_BIT;
+ } else {
+ //
+ // Disable PTT
+ //
+ DEBUG ((EFI_D_INFO, "PTT SkuMgr: Disable PTT\n"));
+ EnableBitmap = CLEAR_PTT_BIT;
+ DisableBitmap = PTT_BITMASK;
+ }
+ Status = HeciFwFeatureStateOverride (EnableBitmap, DisableBitmap);
+
+ return Status;
+}
+
+#endif // PTT_FLAG
diff --git a/ReferenceCode/ME/Library/PttHeci/Dxe/PttHeciDxeLib.cif b/ReferenceCode/ME/Library/PttHeci/Dxe/PttHeciDxeLib.cif
new file mode 100644
index 0000000..60dd251
--- /dev/null
+++ b/ReferenceCode/ME/Library/PttHeci/Dxe/PttHeciDxeLib.cif
@@ -0,0 +1,12 @@
+<component>
+ name = "PttHeciDxeLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Me\Library\PttHeci\Dxe\"
+ RefName = "PttHeciDxeLib"
+[files]
+"PttHeciDxeLib.sdl"
+"PttHeciDxeLib.mak"
+"PttHeciDxeLib.c"
+"PttHeciDxeLib.h"
+"PttHeciDxeLib.inf"
+<endComponent>
diff --git a/ReferenceCode/ME/Library/PttHeci/Dxe/PttHeciDxeLib.h b/ReferenceCode/ME/Library/PttHeci/Dxe/PttHeciDxeLib.h
new file mode 100644
index 0000000..6b370f4
--- /dev/null
+++ b/ReferenceCode/ME/Library/PttHeci/Dxe/PttHeciDxeLib.h
@@ -0,0 +1,37 @@
+/** @file
+ Platform Trust Technology (FTPM) HECI SkuMgr Dxe Library
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PTT_HECI_DXE_LIB_H_
+#define _PTT_HECI_DXE_LIB_H_
+
+#ifdef PTT_FLAG
+///
+/// External include files do NOT need to be explicitly specified in real EDKII
+/// environment
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#endif
+///
+/// Common header for HECI Library
+///
+#include "PttHeciLib.h"
+#endif // PTT_FLAG
+#endif
diff --git a/ReferenceCode/ME/Library/PttHeci/Dxe/PttHeciDxeLib.inf b/ReferenceCode/ME/Library/PttHeci/Dxe/PttHeciDxeLib.inf
new file mode 100644
index 0000000..da2f485
--- /dev/null
+++ b/ReferenceCode/ME/Library/PttHeci/Dxe/PttHeciDxeLib.inf
@@ -0,0 +1,68 @@
+## @file
+# Component description file for PTT Heci DXE Library.
+#
+#@copyright
+# Copyright (c) 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = PttHeciDxeLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ PttHeciDxeLib.h
+ PttHeciDxeLib.c
+ ../Include/PttHeciLib.h
+
+[includes.common]
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/PttHeci/Include
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/include
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/Dxe
+
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/SampleCode
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/SampleCode/Include
+
+[libraries.common]
+ EdkIIGlueBaseLib
+ EdkIIGlueUefiLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ MeLib
+
+[nmake.common]
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_LIB__ \
+ -D __EDKII_GLUE_UEFI_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D PTT_FLAG \ No newline at end of file
diff --git a/ReferenceCode/ME/Library/PttHeci/Dxe/PttHeciDxeLib.mak b/ReferenceCode/ME/Library/PttHeci/Dxe/PttHeciDxeLib.mak
new file mode 100644
index 0000000..ed8afdd
--- /dev/null
+++ b/ReferenceCode/ME/Library/PttHeci/Dxe/PttHeciDxeLib.mak
@@ -0,0 +1,40 @@
+all : PttHeciDxeLib
+
+$(BUILD_DIR)\PttHeciDxeLib.lib : PttHeciDxeLib
+
+PttHeciDxeLib : $(BUILD_DIR)\PttHeciDxeLib.mak PttHeciDxeLibBin
+
+$(BUILD_DIR)\PttHeciDxeLib.mak : $(PttHeciDxeLib_DIR)\$(@B).cif $(PttHeciDxeLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(PttHeciDxeLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+PttHeciDxeLib_INCLUDES=\
+ $(EDK_INCLUDES) \
+ $(EdkIIGlueLib_INCLUDES) \
+ $(ME_INCLUDES) \
+ -I$(INTEL_COUGAR_POINT_DIR)\
+ $(INTEL_PCH_INCLUDES)
+
+PttHeciDxeLib_DEFINES=$(MY_DEFINES)\
+ /D __EDKII_GLUE_BASE_LIB__ \
+ /D __EDKII_GLUE_UEFI_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D PTT_FLAG
+
+PttHeciDxeLib_LIBS=\
+ $(EdkIIGlueBaseLib_LIB)\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueUefiLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(MeProtocolLib_LIB)\
+
+
+PttHeciDxeLibBin : $(PttHeciDxeLib_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS) \
+ /f $(BUILD_DIR)\PttHeciDxeLib.mak all \
+ "MY_INCLUDES=$(PttHeciDxeLib_INCLUDES)" \
+ "MY_DEFINES=$(PttHeciDxeLib_DEFINES)"\
+ TYPE=LIBRARY \
diff --git a/ReferenceCode/ME/Library/PttHeci/Dxe/PttHeciDxeLib.sdl b/ReferenceCode/ME/Library/PttHeci/Dxe/PttHeciDxeLib.sdl
new file mode 100644
index 0000000..8d6ba28
--- /dev/null
+++ b/ReferenceCode/ME/Library/PttHeci/Dxe/PttHeciDxeLib.sdl
@@ -0,0 +1,36 @@
+TOKEN
+ Name = "PttHeciDxeLib_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable PttHeciDxeLib support in Project"
+End
+
+MODULE
+ Help = "Includes PttHeciDxeLib.mak to Project"
+ File = "PttHeciDxeLib.mak"
+End
+
+PATH
+ Name = "PttHeciDxeLib_DIR"
+ Help = "Me Library file source directory"
+End
+
+ELINK
+ Name = "PttHeciDxeLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PttHeciDxeLib.lib"
+ Parent = "PttHeciDxeLib_LIB"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(PttHeciDxeLib_DIR)"
+ Parent = "ME_INCLUDES"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/ME/Library/PttHeci/Include/PttHeciLib.h b/ReferenceCode/ME/Library/PttHeci/Include/PttHeciLib.h
new file mode 100644
index 0000000..4b74795
--- /dev/null
+++ b/ReferenceCode/ME/Library/PttHeci/Include/PttHeciLib.h
@@ -0,0 +1,73 @@
+/** @file
+ Platform Trust Technology (FTPM) HECI SkuMgr Library
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PTT_HECI_LIB_H_
+#define _PTT_HECI_LIB_H_
+
+#ifdef PTT_FLAG
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueBase.h"
+#endif
+
+/**
+ Checks whether ME FW has the Platform Trust Technology capability.
+
+ @param[out] PttCapability TRUE if PTT is supported, FALSE othewrwise.
+
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+**/
+EFI_STATUS
+EFIAPI
+PttHeciGetCapability(
+ OUT BOOLEAN *PttCapability
+ );
+
+/**
+ Checks Platform Trust Technology enablement state.
+
+ @param[out] IsPttEnabledState TRUE if PTT is enabled, FALSE othewrwise.
+
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+**/
+EFI_STATUS
+EFIAPI
+PttHeciGetState(
+ OUT BOOLEAN *IsPttEnabledState
+ );
+
+/**
+ Changes current Platform Trust Technology state.
+
+ @param[in] PttEnabledState TRUE to enable, FALSE to disable.
+
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+**/
+EFI_STATUS
+EFIAPI
+PttHeciSetState(
+ IN BOOLEAN PttEnabledState
+ );
+
+#endif // PTT_FLAG
+#endif
diff --git a/ReferenceCode/ME/ME.cif b/ReferenceCode/ME/ME.cif
new file mode 100644
index 0000000..9684de1
--- /dev/null
+++ b/ReferenceCode/ME/ME.cif
@@ -0,0 +1,25 @@
+<component>
+ name = "ME"
+ category = eModule
+ LocalRoot = "ReferenceCode\ME"
+ RefName = "ME"
+[files]
+"ME.sdl"
+[parts]
+"MeHeci"
+"MeGuidLib"
+"MeInclude"
+"MeProtocolLib"
+"MeLibPpi"
+"MeSampleCode"
+"MeLibrary"
+"MeFwDowngrade"
+"BiosExtension"
+"ActiveManagement"
+"PchMeUma"
+"AntiTheft"
+"MeWrapper"
+"AmtWrapper"
+"PttSmm"
+"MeAcpiTableSsdt"
+<endComponent>
diff --git a/ReferenceCode/ME/ME.sdl b/ReferenceCode/ME/ME.sdl
new file mode 100644
index 0000000..adf574e
--- /dev/null
+++ b/ReferenceCode/ME/ME.sdl
@@ -0,0 +1,50 @@
+TOKEN
+ Name = "iME_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable iAMT support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+End
+
+TOKEN
+ Name = "IntelPTT_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable Intel PTT support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+End
+
+#TOKEN
+# Name = "INTEL_ME_RELEASE_VERSION"
+# Value = "0.80"
+# Help = "Follow Intel Release Reference Code version"
+# TokenType = Integer
+#End
+
+PATH
+ Name = "ME_DIR"
+ Help = "ME Driver files source directory"
+End
+
+ELINK
+ Name = "/I$(ME_DIR)"
+ Parent = "ME_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(ME_DIR)\SampleCode\Include"
+ Parent = "ME_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "ME_INCLUDES"
+ InvokeOrder = ReplaceParent
+End
+
diff --git a/ReferenceCode/ME/PchMeUma/PchMeUma.c b/ReferenceCode/ME/PchMeUma/PchMeUma.c
new file mode 100644
index 0000000..dd8b51b
--- /dev/null
+++ b/ReferenceCode/ME/PchMeUma/PchMeUma.c
@@ -0,0 +1,765 @@
+/** @file
+ Framework PEIM to PchMeUma
+
+@copyright
+ Copyright (c) 2010 - 2013 Intel Corporation. All rights
+ reserved This software and associated documentation (if any)
+ is furnished under a license and may only be used or copied in
+ accordance with the terms of the license. Except as permitted
+ by such license, no part of this software or documentation may
+ be reproduced, stored in a retrieval system, or transmitted in
+ any form or by any means without the express written consent
+ of Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+//
+// Statements that include other files
+//
+#include "EdkIIGluePeim.h"
+#include "MeAccess.h"
+#include "HeciRegs.h"
+#include "Pci22.h"
+#include "PchMeUma.h"
+#include "PchPlatformLib.h"
+#include "PttHciDeviceLib.h"
+#include "PttHciRegs.h"
+#include EFI_PPI_DEFINITION (PchMeUma)
+#ifdef PTT_FLAG
+#include EFI_PPI_DEFINITION (MePlatformPolicyPei)
+#endif
+#include EFI_PPI_DEFINITION (Stall)
+#include EFI_PPI_CONSUMER (Wdt)
+
+//
+// Function Declarations
+//
+static PCH_ME_UMA_PPI mPchMeUmaPpi = {
+ MeSendUmaSize,
+ CpuReplacementCheck,
+ MeConfigDidReg,
+ HandleMeBiosAction
+};
+
+static EFI_PEI_PPI_DESCRIPTOR mPchMeUmaPpiList[] = {
+ {
+ (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+ &gPchMeUmaPpiGuid,
+ &mPchMeUmaPpi
+ }
+};
+
+/**
+ This procedure will read and return the amount of ME UMA requested
+ by ME ROM from the HECI device.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] FfsHeader Pointer to the FFS file header
+
+ @retval UINT32 Return ME UMA Size
+ @retval EFI_SUCCESS Do not check for ME UMA
+**/
+UINT32
+MeSendUmaSize (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_FFS_FILE_HEADER *FfsHeader
+ )
+{
+ UINT32 Timeout;
+ HECI_MISC_SHDW_REGISTER MeMiscShdw;
+ HECI_FWS_REGISTER MeHfs;
+ EFI_STATUS Status;
+ PEI_STALL_PPI *StallPpi;
+
+ MeMiscShdw.ul = HeciPciRead32 (R_ME_MISC_SHDW);
+ MeHfs.ul = HeciPciRead32 (R_ME_HFS);
+ Timeout = 0x0;
+
+ if (MeHfs.r.MeOperationMode == ME_OPERATION_MODE_DEBUG) {
+ DEBUG ((EFI_D_INFO, "ME debug mode, do not check for ME UMA. \n"));
+ return EFI_SUCCESS;
+ }
+
+ if (MeHfs.r.ErrorCode != 0) {
+ DEBUG ((EFI_D_INFO, "ME error, do not check for ME UMA. \n"));
+ return EFI_SUCCESS;
+ }
+ ///
+ /// Poll on MUSZV until it indicates a valid size is present or 5s timeout expires.
+ ///
+ Status = (*PeiServices)->LocatePpi (PeiServices, &gPeiStallPpiGuid, 0, NULL, (VOID **) &StallPpi);
+ ASSERT_PEI_ERROR (PeiServices, Status);
+
+ PERF_START_EX (FfsHeader, L"MUSZV", NULL, AsmReadTsc (), 0x4000);
+ while ((MeMiscShdw.r.MUSZV == 0) && (Timeout < MUSZV_TIMEOUT_MULTIPLIER)) {
+ StallPpi->Stall (PeiServices, StallPpi, STALL_1_MILLISECOND);
+ MeMiscShdw.ul = HeciPciRead32 (R_ME_MISC_SHDW);
+ Timeout++;
+ }
+
+ if (Timeout >= MUSZV_TIMEOUT_MULTIPLIER) {
+ DEBUG ((EFI_D_INFO, "Timeout occurred waiting for MUSZV. \n"));
+ return EFI_SUCCESS;
+ }
+ PERF_END_EX (FfsHeader, L"MUSZV", NULL, AsmReadTsc (), 0x4001);
+
+ ///
+ /// Return MeUmaSize value
+ ///
+ DEBUG ((EFI_D_INFO, "ME UMA Size Requested: %x\n", MeMiscShdw.r.MUSZ));
+
+ return MeMiscShdw.r.MUSZ;
+}
+
+/**
+ Init and Install ME Hob
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+
+ @retval EFI_SUCCESS
+**/
+EFI_STATUS
+InstallMeHob (
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_STATUS Status;
+ ME_DATA_HOB *MeDataHob;
+
+ ///
+ /// Create HOB for ME Data
+ ///
+ Status = (**PeiServices).CreateHob (
+ PeiServices,
+ EFI_HOB_TYPE_GUID_EXTENSION,
+ sizeof (ME_DATA_HOB),
+ &MeDataHob
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Initialize default HOB data
+ ///
+ MeDataHob->EfiHobGuidType.Name = gMeDataHobGuid;
+ ZeroMem (&(MeDataHob->FtpmBufferAddress), sizeof (UINT64));
+
+ DEBUG ((EFI_D_INFO, "ME Data HOB installed\n"));
+
+ return EFI_SUCCESS;
+}
+
+#ifdef PTT_FLAG
+/**
+ Internal function performing Heci platform ME Debug Dump in PEI phase
+
+ @param[in] PeiMePolicyPpi Policy Ppi
+
+ @retval None
+**/
+VOID
+DumpMePlatformPolicyPei (
+ IN PEI_ME_PLATFORM_POLICY_PPI *PeiMePolicyPpi
+ )
+{
+ DEBUG ((EFI_D_INFO, "\n------------------------ MePlatformPolicyPpi Dump Begin -----------------\n"));
+ DEBUG ((EFI_D_INFO, " Revision : 0x%x\n", PeiMePolicyPpi->Revision));
+ DEBUG ((EFI_D_INFO, " FTpmSwitch : 0x%x\n", PeiMePolicyPpi->FTpmSwitch));
+ DEBUG ((EFI_D_INFO, "\n------------------------ MePlatformPolicyPpi Dump End -------------------\n"));
+}
+#endif
+
+/**
+ This procedure will determine whether or not the CPU was replaced
+ during system power loss or via dynamic fusing.
+ Calling this procedure could result in a warm reset (if ME FW is requesting one).
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] FfsHeader Not used.
+ @param[out] ForceFullTraining When set = 0x1, MRC will be forced to perform a full
+ memory training cycle.
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+CpuReplacementCheck (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ OUT UINT8 *ForceFullTraining
+ )
+{
+ HECI_GS_SHDW_REGISTER MeFwsts2;
+ EFI_STATUS Status;
+ UINT32 Timeout;
+ PEI_STALL_PPI *StallPpi;
+ Status = EFI_SUCCESS;
+ Timeout = 0x0;
+
+ ///
+ /// Read ME FWS2
+ ///
+ MeFwsts2.ul = HeciPciRead32 (R_ME_GS_SHDW);
+ DEBUG ((EFI_D_INFO, "MeFwsts2 = %x.\n", MeFwsts2.r));
+
+ ///
+ /// Locate Stall Ppi
+ ///
+ Status = (*PeiServices)->LocatePpi (PeiServices, &gPeiStallPpiGuid, 0, NULL, (VOID **) &StallPpi);
+ ASSERT_PEI_ERROR (PeiServices, Status);
+
+ PERF_START_EX (FfsHeader, L"CPURLOP", NULL, AsmReadTsc (), 0x4010);
+ ///
+ /// Poll 50 ms on CPU Replaced Valid bit
+ ///
+ while ((((MeFwsts2.r.CpuReplacedValid == 0) && Timeout < CPURV_TIMEOUT_MULTIPLIER))
+ ) {
+ StallPpi->Stall (PeiServices, StallPpi, STALL_1_MILLISECOND);
+ MeFwsts2.ul = HeciPciRead32 (R_ME_GS_SHDW);
+ Timeout++;
+ }
+ PERF_END_EX (FfsHeader, L"CPURLOP", NULL, AsmReadTsc (), 0x4011);
+
+ DEBUG ((EFI_D_INFO, "CpuReplacedValid = %x, ", MeFwsts2.r.CpuReplacedValid));
+ DEBUG ((EFI_D_INFO, "CpuReplacedStatus = %x, ", MeFwsts2.r.CpuReplacedSts));
+ DEBUG ((EFI_D_INFO, "WarmRstReqForDF = %x.\n", MeFwsts2.r.WarmRstReqForDF));
+
+ if (Timeout >= CPURV_TIMEOUT_MULTIPLIER || MeFwsts2.r.CpuReplacedValid == 0x0) {
+ DEBUG ((EFI_D_ERROR, "Timeout occurred, the CPU Replacement Valid Bit is not set.\n"));
+ *ForceFullTraining = 0x1;
+ } else {
+ if (MeFwsts2.r.CpuReplacedValid == 0x1) {
+ if (MeFwsts2.r.WarmRstReqForDF == 0x1) {
+ ///
+ /// Clear DISB and Issue a Non-Power Cycle Reset
+ ///
+ Status = ClearDisb ();
+ Status = PerformReset (PeiServices, CBM_DIR_NON_PCR);
+ }
+
+ if ((MeFwsts2.r.CpuReplacedSts == 0x1 && MeFwsts2.r.WarmRstReqForDF == 0x0)) {
+ *ForceFullTraining = 0x1;
+ }
+ }
+ }
+
+ return Status;
+}
+
+/**
+ This procedure will configure the ME Host General Status register,
+ indicating that DRAM Initialization is complete and ME FW may
+ begin using the allocated ME UMA space.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] FfsHeader Pointer to the FFS file header
+ @param[in] MrcBootMode MRC BootMode
+ @param[in] InitStat H_GS[27:24] Status
+ @param[in] FtpmStolenBase The base of FTPM
+ @retval EFI_SUCCESS
+**/
+EFI_STATUS
+MeConfigDidReg (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN MRC_BOOT_MODE_T MrcBootMode,
+ IN UINT8 InitStat,
+ IN UINT32 FtpmStolenBase,
+ IN UINT32 MeUmaSize
+ )
+{
+ UINT32 MeUmaBase;
+ UINT32 MeUmaBaseExt;
+ UINT32 MeHgs;
+ UINT32 Timeout;
+ HECI_FWS_REGISTER MeHfs;
+ EFI_STATUS Status;
+ PEI_STALL_PPI *StallPpi;
+#ifdef PTT_FLAG
+ PEI_ME_PLATFORM_POLICY_PPI *PeiMePolicyPpi;
+ EFI_GUID gPeiMePlatformPolicyPpiGuid = PEI_ME_PLATFORM_POLICY_PPI_GUID;
+ ME_DATA_HOB *MeDataHob;
+ EFI_GUID gMeDataHobGuid = ME_DATA_HOB_GUID;
+ UINT32 RegRead;
+ UINT32 WaitTime;
+#endif //PTT_FLAG
+
+#ifdef PTT_FLAG
+ ///
+ /// Get platform policy settings through the MePlatformPolicy PPI
+ ///
+ Status = (**PeiServices).LocatePpi (
+ PeiServices,
+ &gPeiMePlatformPolicyPpiGuid,
+ 0,
+ NULL,
+ (VOID **) &PeiMePolicyPpi
+ );
+ ASSERT_PEI_ERROR (PeiServices, Status);
+
+ DumpMePlatformPolicyPei (PeiMePolicyPpi);
+#endif //PTT_FLAG
+
+
+ Status = (*PeiServices)->LocatePpi (PeiServices, &gPeiStallPpiGuid, 0, NULL, (VOID **) &StallPpi);
+ ASSERT_PEI_ERROR (PeiServices, Status);
+
+ MeHgs = 0x0;
+ Timeout = 0x0;
+ MeHfs.ul = HeciPciRead32 (R_ME_HFS);
+
+ DEBUG ((EFI_D_INFO, "ME status: 0x%08x\n", MeHfs.ul));
+
+ if (MeHfs.r.MeOperationMode == ME_OPERATION_MODE_DEBUG) {
+ DEBUG ((EFI_D_INFO, "ME debug mode, do not check for ME UMA. \n"));
+ return EFI_SUCCESS;
+ }
+
+ if (MeHfs.r.ErrorCode != 0) {
+ DEBUG ((EFI_D_INFO, "ME error, do not check for ME UMA. \n"));
+ return EFI_SUCCESS;
+ }
+
+ DEBUG ((EFI_D_INFO, "Entered ME DRAM Init Done procedure.\n"));
+
+#ifdef PTT_FLAG
+ if ((GetPchSeries() == PchLp) &&
+ (MmioRead32 (R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_STS)& BIT0) &&
+ (PeiMePolicyPpi->FTpmSwitch == 0) &&
+ (InitStat != 0x1)) {
+ ///
+ /// Install ME HOBs
+ ///
+ InstallMeHob (PeiServices);
+
+ MeDataHob = NULL;
+ MeDataHob = GetFirstGuidHob (&gMeDataHobGuid);
+
+ if (MeDataHob != NULL) {
+ MeDataHob->FtpmBufferAddress = FtpmStolenBase;
+ DEBUG ((EFI_D_INFO, " Ftpm Allocated Buffer Address: %x\n", MeDataHob->FtpmBufferAddress ));
+
+ ///
+ /// Poll Ready Bit
+ ///
+ RegRead = 0;
+ for (WaitTime = 0; WaitTime < PTT_HCI_TIMEOUT_B * 3; WaitTime += PTT_HCI_POLLING_PERIOD){
+ RegRead = MmioRead32 (R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_STS);
+ DEBUG ((EFI_D_INFO, " Ftpm Waiting on Ready Bit, HCI_STS Register = %x\n", RegRead));
+ if((BIT1 & RegRead) != 0){
+ MmioWrite64 ((UINTN)(R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CRB),(UINTN) MeDataHob->FtpmBufferAddress );
+ ///
+ /// Issue command to start.
+ ///
+ MmioWrite32 ((UINTN)R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CA_START, V_PTT_HCI_BUFFER_ADDRESS_RDY);
+ if( MeUmaSize == 32 )
+ {
+ ///
+ /// Trigger interrupt command processing only for 5MB sku
+ ///
+ MmioWrite32 ((UINTN)R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CMD, 0);
+ }
+ break;
+ }
+ StallPpi->Stall (PeiServices, StallPpi, PTT_HCI_POLLING_PERIOD);
+ }
+
+ ///
+ /// Poll state, wait for Ftpm to finish processing
+ ///
+ for (WaitTime = 0; WaitTime < PTT_HCI_TIMEOUT_B; WaitTime += PTT_HCI_POLLING_PERIOD){
+ RegRead = MmioRead32 (R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_CA_START);
+ if (RegRead == 0){
+ break;
+ }
+ StallPpi->Stall (PeiServices, StallPpi, PTT_HCI_POLLING_PERIOD);
+ }
+ } else {
+ DEBUG ((EFI_D_INFO, "ME DataHob error, MeDataHob not found\n"));
+ }
+ }
+#endif
+
+ ///
+ /// Read MESEGBASE value
+ ///
+ MeUmaBase = PciRead32 (PCI_LIB_ADDRESS (0, 0, 0, R_MESEG_BASE));
+ MeUmaBaseExt = PciRead32 (PCI_LIB_ADDRESS (0, 0, 0, R_MESEG_BASE + 0x04));
+ DEBUG ((EFI_D_INFO, " MeUmaBase read: %x\n", MeUmaBase));
+
+ ///
+ /// Write DRAM Init Done (DID) data to the ME H_GS[23:0].
+ /// H_GS[23:16] = extended UMA base address (reserved)
+ /// H_GS[15:0] = 1M aligned UMA base address
+ /// ME FW will 0 extend these values to determine MeUmaBase
+ ///
+ MeUmaBase = ((MeUmaBaseExt << 28) + (MeUmaBase >> 4)) >> 16;
+ MeHgs = MeUmaBase;
+
+ ///
+ /// Set H_GS[31:28] = 0x1 indicating DRAM Init Done
+ ///
+ MeHgs |= B_ME_DID_TYPE_MASK;
+
+ ///
+ /// RapidStart
+ ///
+ if (InitStat & 0x80) {
+ MeHgs |= B_ME_DID_RAPID_START_BIT;
+ }
+
+ InitStat &= 0x7F;
+
+ ///
+ /// Set H_GS[27:24] = Status
+ /// 0x0 = Success
+ /// 0x1 = No Memory in channels
+ /// 0x2 = Memory Init Error
+ /// 0x3 = Memory not preserved across reset
+ /// 0x4-0xF = Reserved
+ ///
+ MeHgs |= (InitStat << 24);
+
+ PERF_START_EX (FfsHeader, L"DID", NULL, AsmReadTsc (), 0x4020);
+ HeciPciAndThenOr32 (R_ME_H_GS, 0, MeHgs);
+ DEBUG ((EFI_D_INFO, " ME H_GS written: %x\n", MeHgs));
+
+ ///
+ /// ME FW typically responds with the DID ACK w/in 1ms
+ /// Adding short delay to avoid wasting time in the timeout loop
+ ///
+ StallPpi->Stall (PeiServices, StallPpi, STALL_1_MILLISECOND + STALL_100_MICROSECONDS);
+
+ ///
+ /// Read the ME H_FS Register to look for DID ACK.
+ ///
+ MeHfs.ul = HeciPciRead32 (R_ME_HFS);
+ DEBUG ((EFI_D_INFO, " HFS read before DID ACK: %x\n", MeHfs.r));
+
+ ///
+ /// ~5 second Timeout for DID ACK
+ ///
+ while (((MeHfs.r.BiosMessageAck == 0) && Timeout < DID_TIMEOUT_MULTIPLIER)
+ ) {
+ StallPpi->Stall (PeiServices, StallPpi, STALL_1_MILLISECOND);
+ MeHfs.ul = HeciPciRead32 (R_ME_HFS);
+ Timeout++;
+ }
+
+ if ((Timeout >= DID_TIMEOUT_MULTIPLIER)
+ ) {
+ DEBUG ((EFI_D_ERROR, "Timeout occurred waiting for DID ACK.\n"));
+ } else {
+ DEBUG ((EFI_D_INFO, "ME DRAM Init Done ACK received.\n"));
+ DEBUG ((EFI_D_INFO, "HFS read after DID ACK: %x\n", MeHfs.r));
+ }
+ PERF_END_EX (FfsHeader, L"DID", NULL, AsmReadTsc (), 0x4021);
+
+ DEBUG ((EFI_D_ERROR, "BiosAction = %x\n", MeHfs.r.AckData));
+
+ return HandleMeBiosAction (PeiServices, MrcBootMode, (UINT8) MeHfs.r.AckData);
+}
+
+/**
+ This procedure will enforce the BIOS Action that was requested by ME FW
+ as part of the DRAM Init Done message.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] MrcBootMode MRC BootMode
+ @param[in] BiosAction Me requests BIOS to act
+
+ @retval EFI_SUCCESS Always return EFI_SUCCESS
+**/
+EFI_STATUS
+HandleMeBiosAction (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN MRC_BOOT_MODE_T MrcBootMode,
+ IN UINT8 BiosAction
+ )
+{
+ EFI_STATUS Status;
+ HECI_GS_SHDW_REGISTER MeFwsts2;
+ ///
+ /// Read ME FWS2
+ ///
+ MeFwsts2.ul = HeciPciRead32 (R_ME_GS_SHDW);
+ DEBUG ((EFI_D_INFO, "MeFwsts2 = %x.\n", MeFwsts2.r));
+
+ switch (BiosAction) {
+ case 0:
+ ///
+ /// Case: DID ACK was not received
+ ///
+ DEBUG ((EFI_D_ERROR, "DID Ack was not received, no BIOS Action to process.\n"));
+ break;
+
+ case CBM_DIR_NON_PCR:
+ ///
+ /// Case: Perform Non-Power Cycle Reset
+ ///
+ DEBUG ((EFI_D_ERROR, "ME FW has requested a Non-PCR.\n"));
+ Status = PerformReset (PeiServices, CBM_DIR_NON_PCR);
+ break;
+
+ case CBM_DIR_PCR:
+ ///
+ /// Case: Perform Power Cycle Reset
+ ///
+ DEBUG ((EFI_D_ERROR, "ME FW has requested a PCR.\n"));
+ Status = PerformReset (PeiServices, CBM_DIR_PCR);
+ break;
+
+ case 3:
+ ///
+ /// Case: Go To S3
+ ///
+ DEBUG ((EFI_D_INFO, "ME FW DID ACK has requested entry to S3. Not defined, continuing to POST.\n"));
+ break;
+
+ case 4:
+ ///
+ /// Case: Go To S4
+ ///
+ DEBUG ((EFI_D_INFO, "ME FW DID ACK has requested entry to S4. Not defined, continuing to POST.\n"));
+ break;
+
+ case 5:
+ ///
+ /// Case: Go To S5
+ ///
+ DEBUG ((EFI_D_INFO, "ME FW DID ACK has requested entry to S5. Not defined, continuing to POST.\n"));
+ break;
+
+ case CBM_DIR_GLOBAL_RESET:
+ ///
+ /// Case: Perform Global Reset
+ ///
+ DEBUG ((EFI_D_ERROR, "ME FW has requested a Global Reset.\n"));
+ Status = PerformReset (PeiServices, CBM_DIR_GLOBAL_RESET);
+ break;
+
+ case CBM_DIR_CONTINUE_POST:
+ ///
+ /// Case: Continue to POST
+ ///
+ DEBUG ((EFI_D_INFO, "ME FW DID Ack requested to continue to POST.\n"));
+ break;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This procedure will issue a Non-Power Cycle, Power Cycle, or Global Rest.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] ResetType Type of reset to be issued.
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval All other error conditions encountered result in an ASSERT.
+**/
+EFI_STATUS
+PerformReset (
+ IN EFI_PEI_SERVICES **PeiServices,
+ UINT8 ResetType
+ )
+{
+ EFI_STATUS Status;
+ UINT32 ETR3;
+ UINT32 GpioBase;
+ UINT8 Reset;
+ WDT_PPI *Wdt;
+ PCH_SERIES PchSeries;
+
+ ETR3 = 0;
+ Reset = 0;
+ GpioBase = 0;
+ Wdt = NULL;
+ PchSeries = GetPchSeries();
+
+ ///
+ /// Locate WDT PPI for access to Wdt->AllowKnownReset()
+ ///
+ Status = (*PeiServices)->LocatePpi (
+ PeiServices,
+ &gWdtPpiGuid,
+ 0,
+ NULL,
+ (VOID **) &Wdt
+ );
+ ASSERT_PEI_ERROR (PeiServices, Status);
+
+ ///
+ /// Clear CF9GR of PCH (B0/D31/f0 offset 0x0AC[20] = 1b) to indicate Host reset
+ /// Make sure CWORWRE (CF9 Without Resume Well Reset Enable) is cleared
+ ///
+ ETR3 = PciRead32 (PCI_LIB_ADDRESS (0, PCI_DEVICE_NUMBER_PCH_LPC, 0, R_PCH_LPC_PMIR));
+ ETR3 = ETR3 &~BIT20;
+ ETR3 = ETR3 &~BIT18;
+ PciWrite32 (PCI_LIB_ADDRESS (0, PCI_DEVICE_NUMBER_PCH_LPC, 0, R_PCH_LPC_PMIR), ETR3);
+
+ Reset = IoRead8 (R_PCH_RST_CNT);
+ Reset &= 0xF1;
+
+ ///
+ /// If global reset required
+ ///
+ if (ResetType == CBM_DIR_GLOBAL_RESET) {
+ ///
+ /// Get GPIO Base Address
+ ///
+ GpioBase = PciRead32 (PCI_LIB_ADDRESS (0, PCI_DEVICE_NUMBER_PCH_LPC, 0, R_PCH_LPC_GPIO_BASE)) &~BIT0;
+ }
+
+ switch (ResetType) {
+ case CBM_DIR_NON_PCR:
+ ///
+ /// Case: Non Power Cycle Reset requested
+ ///
+ DEBUG ((EFI_D_ERROR, "ME FW DID ACK has requested a Non Power Cycle Reset.\n"));
+ Reset |= 0x06;
+ break;
+
+ case CBM_DIR_PCR:
+ ///
+ /// Case: Power Cycle Reset requested
+ ///
+ Wdt->ReloadAndStart (2);
+ DEBUG ((EFI_D_INFO, "ME FW DID ACK has requested a Power Cycle Reset.\n"));
+ Reset |= 0x0E;
+ break;
+
+ case CBM_DIR_GLOBAL_RESET:
+ ///
+ /// Case: Global Reset
+ ///
+ DEBUG ((EFI_D_ERROR, "ME FW DID Ack requested a global reset.\n"));
+
+ ///
+ /// Drive GPIO[30] (SPDNA#) low prior to 0xCF9 write
+ ///
+ if (PchSeries == PchH) {
+ /// 1. Set GPIOBASE + offset 00h[30] = 1b (for non-Deep Sx enabled platforms)
+ /// 2. Set GPIOBASE + offset 04h[30] = 0b (for non-Deep Sx enabled platforms)
+ /// 3. Set GPIOBASE + offset 0Ch[30] = 0b (for non-Deep Sx enabled platforms)
+ /// 4. Set GPIOBASE + offset 60h[30] = 1b (for non-Deep Sx enabled platforms)
+ /// NOTE: For Deep Sx enabled platforms steps 1,2 and 3 should be skipped and pin should be left in native mode
+ /// 5. Set CF9GR bit, D31:F0:ACh[20], issue a Global Reset through a 0xCF9 write of either 06h or 0Eh commands.
+ /// Global Reset MEI Message
+ /// 1. BIOS makes sure GPIO30 is left in native mode (default mode) before sending a Global Reset MEI message.
+ ///
+ IoOr32 ((UINTN) (GpioBase + R_PCH_GPIO_USE_SEL), (UINT32) (BIT30));
+ IoAnd32 ((UINTN) (GpioBase + R_PCH_GPIO_IO_SEL), (UINT32) (~BIT30));
+ IoAnd32 ((UINTN) (GpioBase + R_PCH_GPIO_LVL), (UINT32) (~BIT30));
+ }
+
+ if (PchSeries == PchLp) {
+ /// 1. Set GPIOBASE + offset 1F0h[0] = 1b (for non-Deep Sx enabled platforms)
+ /// 2. Set GPIOBASE + offset 1F0h[2] = 0b (for non-Deep Sx enabled platforms)
+ /// 3. Set GPIOBASE + offset 1F0h[31] = 0b (for non-Deep Sx enabled platforms)
+ /// 4. Set GPIOBASE + offset 60h[30] = 1h (for non-Deep Sx enabled platforms)
+ /// NOTE: For Deep Sx enabled platforms steps 1,2 and 3 should be skipped and pin should be left in native mode
+ /// 5. Set CF9GR bit, D31:F0:ACh[20], issue a Global Reset through a 0xCF9 write of either 06h or 0Eh commands.
+ /// Global Reset MEI Message
+ /// 1. BIOS makes sure GPIO30 is left in native mode (default mode) before sending a Global Reset MEI message.
+ ///
+ IoOr32 ((UINTN) (GpioBase + R_PCH_GP_30_CONFIG0), (UINT32) (B_PCH_GPIO_OWN0_GPIO_USE_SEL));
+ IoAnd32 ((UINTN) (GpioBase + R_PCH_GP_30_CONFIG0), (UINT32) (~B_PCH_GPIO_OWN0_GPIO_IO_SEL));
+ IoAnd32 ((UINTN) (GpioBase + R_PCH_GP_30_CONFIG0), (UINT32) (~B_PCH_GPIO_OWN0_GPO_LVL));
+ }
+
+ IoOr32 ((UINTN) (GpioBase + R_PCH_GP_RST_SEL), (UINT32) (BIT30));
+
+ PciOr32 (
+ PCI_LIB_ADDRESS (DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_PMIR),
+ (UINT32) (B_PCH_LPC_PMIR_CF9GR)
+ );
+
+ ///
+ /// Issue global reset CF9 = 0x0E
+ ///
+ DEBUG ((EFI_D_ERROR, "Issuing global reset.\n"));
+ Reset |= 0x0E;
+ break;
+ }
+ ///
+ /// Write PCH RST CNT, Issue Reset
+ ///
+ Wdt->AllowKnownReset ();
+
+ IoWrite8 (R_PCH_RST_CNT, Reset);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This procedure will clear the DISB.
+
+ @param[in] None
+
+ @retval EFI_SUCCESS Always return EFI_SUCCESS
+**/
+EFI_STATUS
+ClearDisb (
+ VOID
+ )
+{
+ UINT16 Data16;
+
+ Data16 = PciRead16 (PCI_LIB_ADDRESS (0, PCI_DEVICE_NUMBER_PCH_LPC, 0, R_PCH_LPC_GEN_PMCON_2));
+ Data16 = Data16 &~B_PCH_LPC_GEN_PMCON_DRAM_INIT;
+ PciWrite16 (PCI_LIB_ADDRESS (0, PCI_DEVICE_NUMBER_PCH_LPC, 0, R_PCH_LPC_GEN_PMCON_2), Data16);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This procedure will clear the DISB.
+
+ @param[in] None
+
+ @retval EFI_SUCCESS Always return EFI_SUCCESS
+**/
+EFI_STATUS
+SetDISB (
+ VOID
+ )
+{
+ UINT16 Data16;
+
+ Data16 = PciRead16 (PCI_LIB_ADDRESS (0, PCI_DEVICE_NUMBER_PCH_LPC, 0, R_PCH_LPC_GEN_PMCON_2));
+ Data16 = Data16 & B_PCH_LPC_GEN_PMCON_DRAM_INIT;
+ PciWrite16 (PCI_LIB_ADDRESS (0, PCI_DEVICE_NUMBER_PCH_LPC, 0, R_PCH_LPC_GEN_PMCON_2), Data16);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This function is the entry point for this PEI.
+
+ @param[in] FfsHeader Pointer to the FFS file header
+ @param[in] PeiServices Pointer to the PEI services table
+
+ @retval Return Status based on errors that occurred while waiting for time to expire.
+**/
+EFI_STATUS
+EFIAPI
+PchMeUmaEntry (
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_STATUS Status;
+ Status = EFI_SUCCESS;
+ Status = (*PeiServices)->InstallPpi (PeiServices, mPchMeUmaPpiList);
+
+ return Status;
+}
diff --git a/ReferenceCode/ME/PchMeUma/PchMeUma.cif b/ReferenceCode/ME/PchMeUma/PchMeUma.cif
new file mode 100644
index 0000000..4a3d2b0
--- /dev/null
+++ b/ReferenceCode/ME/PchMeUma/PchMeUma.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "PchMeUma"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\PchMeUma\"
+ RefName = "PchMeUma"
+[files]
+"PchMeUma.sdl"
+"PchMeUma.mak"
+"PchMeUma.c"
+"PchMeUma.h"
+"PchMeUma.dxs"
+"PchMeUma.inf"
+<endComponent> \ No newline at end of file
diff --git a/ReferenceCode/ME/PchMeUma/PchMeUma.dxs b/ReferenceCode/ME/PchMeUma/PchMeUma.dxs
new file mode 100644
index 0000000..0d942cb
--- /dev/null
+++ b/ReferenceCode/ME/PchMeUma/PchMeUma.dxs
@@ -0,0 +1,50 @@
+/** @file
+ Dependency expression file for PchMeUma Init PEIM.
+
+@copyright
+ Copyright (c) 2010 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "PeimDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+
+#endif
+
+#include EFI_PPI_DEPENDENCY (Wdt)
+#include EFI_PPI_DEPENDENCY (Stall)
+#include EFI_PPI_DEFINITION (MePlatformPolicyPei)
+
+DEPENDENCY_START
+ WDT_PPI_GUID AND
+ PEI_STALL_PPI_GUID AND
+ PEI_ME_PLATFORM_POLICY_PPI_GUID
+DEPENDENCY_END
+
+
+
+
diff --git a/ReferenceCode/ME/PchMeUma/PchMeUma.h b/ReferenceCode/ME/PchMeUma/PchMeUma.h
new file mode 100644
index 0000000..6530b23
--- /dev/null
+++ b/ReferenceCode/ME/PchMeUma/PchMeUma.h
@@ -0,0 +1,178 @@
+/** @file
+ Header file for Framework PEIM to PchMeUma
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights
+ reserved This software and associated documentation (if any)
+ is furnished under a license and may only be used or copied in
+ accordance with the terms of the license. Except as permitted
+ by such license, no part of this software or documentation may
+ be reproduced, stored in a retrieval system, or transmitted in
+ any form or by any means without the express written consent
+ of Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PCH_ME_UMA_H_
+#define _PCH_ME_UMA_H_
+
+#include EFI_PPI_DEFINITION (PchMeUma)
+#include EFI_GUID_DEFINITION (MeDataHob)
+
+///
+/// LPT PCI Register Definition(s)
+///
+#define R_MESEG_BASE 0x70
+
+//
+// ME FW communication timeout value definitions
+//
+#define DID_TIMEOUT_MULTIPLIER 0x1388
+#define MUSZV_TIMEOUT_MULTIPLIER 0x1388
+#define CPURV_TIMEOUT_MULTIPLIER 0x32
+#define STALL_1_MILLISECOND 1000
+#define STALL_100_MICROSECONDS 100
+
+//
+// Function Prototype(s)
+//
+
+/**
+ This procedure will read and return the amount of ME UMA requested
+ by ME ROM from the HECI device.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] FfsHeader Pointer to the FFS file header
+
+ @retval UINT32 Return ME UMA Size
+ @retval EFI_SUCCESS Do not check for ME UMA
+**/
+UINT32
+MeSendUmaSize (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_FFS_FILE_HEADER *FfsHeader
+ )
+;
+
+/**
+ Init and Install ME Hob
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+
+ @retval EFI_SUCCESS
+**/
+EFI_STATUS
+InstallMeHob (
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+;
+
+/**
+ This procedure will determine whether or not the CPU was replaced
+ during system power loss or via dynamic fusing.
+ Calling this procedure could result in a warm reset (if ME FW is requesting one).
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] FfsHeader Not used.
+ @param[out] ForceFullTraining When set = 0x1, MRC will be forced to perform a full
+ memory training cycle.
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+CpuReplacementCheck (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ OUT UINT8 *ForceFullTraining
+ )
+;
+
+/**
+ This procedure will configure the ME Host General Status register,
+ indicating that DRAM Initialization is complete and ME FW may
+ begin using the allocated ME UMA space.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] FfsHeader Pointer to the FFS file header
+ @param[in] MrcBootMode MRC BootMode
+ @param[in] InitStat H_GS[27:24] Status
+ @param[in] FtpmStolenBase The base of FTPM
+
+ @retval EFI_SUCCESS
+**/
+EFI_STATUS
+MeConfigDidReg (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN MRC_BOOT_MODE_T MrcBootMode,
+ IN UINT8 InitStat,
+ IN UINT32 FtpmStolenBase,
+ IN UINT32 MeUmaSize
+ )
+;
+
+/**
+ This procedure will enforce the BIOS Action that was requested by ME FW
+ as part of the DRAM Init Done message.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] MrcBootMode MRC BootMode
+ @param[in] BiosAction Me requests BIOS to act
+
+ @retval EFI_SUCCESS Always return EFI_SUCCESS
+**/
+EFI_STATUS
+HandleMeBiosAction (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN MRC_BOOT_MODE_T MrcBootMode,
+ IN UINT8 BiosAction
+ )
+;
+
+/**
+ This procedure will issue a Non-Power Cycle, Power Cycle, or Global Rest.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] ResetType Type of reset to be issued.
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval All other error conditions encountered result in an ASSERT.
+**/
+EFI_STATUS
+PerformReset (
+ IN EFI_PEI_SERVICES **PeiServices,
+ UINT8 ResetType
+ )
+;
+
+/**
+ This procedure will clear the DISB.
+
+ @param[in] None
+
+ @retval EFI_SUCCESS Always return EFI_SUCCESS
+**/
+EFI_STATUS
+ClearDisb (
+ VOID
+ )
+;
+
+/**
+ This procedure will clear the DISB.
+
+ @param[in] None
+
+ @retval EFI_SUCCESS Always return EFI_SUCCESS
+**/
+EFI_STATUS
+SetDISB (
+ VOID
+ )
+;
+#endif
diff --git a/ReferenceCode/ME/PchMeUma/PchMeUma.inf b/ReferenceCode/ME/PchMeUma/PchMeUma.inf
new file mode 100644
index 0000000..5aae62d
--- /dev/null
+++ b/ReferenceCode/ME/PchMeUma/PchMeUma.inf
@@ -0,0 +1,88 @@
+## @file
+# Component description file for PchMeUma module
+#
+#@copyright
+# Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = PchMeUma
+FILE_GUID = b6a2aff3-767c-5658-c37a-d1c82ef76543
+COMPONENT_TYPE = PE32_PEIM
+
+[sources.common]
+ PchMeUma.c
+ PchMeUma.h
+
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGluePeimEntryPoint.c
+
+[includes.common]
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Heci/Include
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/Include
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/Include
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Guid/MeDataHob
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/Ptt/Include
+
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/library/Pei/Include
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+
+[libraries.common]
+ EdkFrameworkPpiLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGluePeiDebugLibReportStatusCode
+ EdkIIGluePeiReportStatusCodeLib
+ EdkIIGluePeiServicesLib
+ EdkIIGlueBasePciLibPciExpress
+ EdkIIGlueBasePciExpressLib
+ PeiLib
+ $(PROJECT_PCH_FAMILY)PpiLib
+ MeLibPpi
+ EdkIIGluePeiFirmwarePerformanceLib
+ PchPlatformLib
+ MeGuidLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = PchMeUma.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=PchMeUmaEntry
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_PEI_SERVICES_LIB__ \
+ -D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__
diff --git a/ReferenceCode/ME/PchMeUma/PchMeUma.mak b/ReferenceCode/ME/PchMeUma/PchMeUma.mak
new file mode 100644
index 0000000..426692e
--- /dev/null
+++ b/ReferenceCode/ME/PchMeUma/PchMeUma.mak
@@ -0,0 +1,62 @@
+# MAK file for the ModulePart:PchMeUma
+
+all: PchMeUma
+
+$(BUILD_DIR)\PchMeUma.mak : $(PchMeUma_DIR)\PchMeUma.cif $(BUILD_RULES)
+ $(CIF2MAK) $(PchMeUma_DIR)\PchMeUma.cif $(CIF2MAK_DEFAULTS)
+
+PchMeUma: $(BUILD_DIR)\PchMeUma.mak PchMeUmaBin
+
+PchMeUma_Pei_INCLUDES=\
+ $(EDK_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+ $(ME_INCLUDES)\
+ /I$(MePttLibrary_DIR)\Pei
+
+
+PchMeUma_DEFINES=$(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=PchMeUmaEntry"\
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__\
+ /D __EDKII_GLUE_PEI_SERVICES_LIB__ \
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+!IF "$(IntelPTT_SUPPORT)"=="1"
+ /D PTT_FLAG
+!ENDIF
+
+PchMeUma_LIBS =\
+ $(EDKPROTOCOLLIB)\
+ $(EDKFRAMEWORKPPILIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EdkIIGlueBaseLibIA32_LIB)\
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGluePeiDebugLibReportStatusCode_LIB)\
+ $(EdkIIGluePeiReportStatusCodeLib_LIB)\
+ $(EdkIIGluePeiServicesLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(IntelPchPpiLib_LIB)\
+ $(EFIDRIVERLIB)\
+ $(PEILIB)\
+ $(MeLibPpi_LIB)\
+ $(PchPlatformPeiLib_LIB)\
+ $(MeGuidLib_LIB)\
+ $(EdkIIGluePeiHobLib_LIB)\
+ $(EFIGUIDLIB)\
+ $(EFIPROTOCOLLIB)
+## $(EdkIIGluePeiFirmwarePerformanceLib_LIB)
+
+PchMeUmaBin : $(PchMeUma_LIBS) $(HeciPei_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\PchMeUma.mak all\
+ NAME=PchMeUma\
+ MAKEFILE=$(BUILD_DIR)\PchMeUma.mak \
+ GUID=8C376010-2400-4d7d-B47B-9D851DF3C9D1\
+ "MY_INCLUDES=$(PchMeUma_Pei_INCLUDES)" \
+ "MY_DEFINES=$(PchMeUma_DEFINES)"\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=PEIM \
+ EDKIIModule=PEIM\
+ DEPEX1=$(PchMeUma_DIR)\PchMeUma.dxs DEPEX1_TYPE=EFI_SECTION_PEI_DEPEX \
+ COMPRESS=0
diff --git a/ReferenceCode/ME/PchMeUma/PchMeUma.sdl b/ReferenceCode/ME/PchMeUma/PchMeUma.sdl
new file mode 100644
index 0000000..fc09086
--- /dev/null
+++ b/ReferenceCode/ME/PchMeUma/PchMeUma.sdl
@@ -0,0 +1,41 @@
+TOKEN
+ Name = PchMeUma_SUPPORT
+ Value = 1
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable PchMeUma support in Project"
+End
+MODULE
+ Help = "Includes PchMeUma.mak to Project"
+ File = "PchMeUma.mak"
+End
+
+PATH
+ Name = "PchMeUma_DIR"
+ Help = "PCH ME UMA file source directory"
+End
+
+ELINK
+ Name = "PchMeUma_INCLUDES"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "/I$(PchMeUma_DIR)"
+ Parent = "PchMeUma_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PchMeUma.ffs"
+ Parent = "FV_BB"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(ME_DIR)"
+ Parent = "PchMeUma_INCLUDES"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/ME/Ppi/AmtPlatformPolicyPei/AmtPlatformPolicyPei.c b/ReferenceCode/ME/Ppi/AmtPlatformPolicyPei/AmtPlatformPolicyPei.c
new file mode 100644
index 0000000..86e3155
--- /dev/null
+++ b/ReferenceCode/ME/Ppi/AmtPlatformPolicyPei/AmtPlatformPolicyPei.c
@@ -0,0 +1,31 @@
+/** @file
+ AMT Platform Policy for AMT PEIMs
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#include EFI_PPI_DEFINITION (AmtPlatformPolicyPei)
+#endif
+
+EFI_GUID gPeiAmtPlatformPolicyPpiGuid = PEI_AMT_PLATFORM_POLICY_PPI_GUID;
+
+EFI_GUID_STRING(&gPeiAmtPlatformPolicyPpiGuid, "PeiAmtPlatformPolicyPpi", "PEI Amt Platform Policy PPI");
diff --git a/ReferenceCode/ME/Ppi/AmtPlatformPolicyPei/AmtPlatformPolicyPei.h b/ReferenceCode/ME/Ppi/AmtPlatformPolicyPei/AmtPlatformPolicyPei.h
new file mode 100644
index 0000000..d41d187
--- /dev/null
+++ b/ReferenceCode/ME/Ppi/AmtPlatformPolicyPei/AmtPlatformPolicyPei.h
@@ -0,0 +1,77 @@
+/** @file
+ AMT Platform Policy for AMT PEIMs
+
+@copyright
+ Copyright (c) 2008 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _PEI_AMT_PLATFORM_POLICY_PPI_H_
+#define _PEI_AMT_PLATFORM_POLICY_PPI_H_
+
+//
+// Include other definitions
+//
+///
+/// Intel AMT Platform Policy PPI GUID
+/// This PPI provides an interface to get the current Intel AMT SKU information
+///
+#define PEI_AMT_PLATFORM_POLICY_PPI_GUID \
+ { \
+ 0xb4a1208e, 0x4d9a, 0x4ea2, 0x9d, 0x6b, 0xe4, 0x1a, 0x61, 0xe6, 0xc5, 0xac \
+ }
+
+//
+// Extern the GUID for PPI users.
+//
+extern EFI_GUID gPeiAmtPlatformPolicyPpiGuid;
+
+///
+/// Revision
+///
+#define PEI_AMT_PLATFORM_POLICY_PPI_REVISION_1 1
+///
+/// Add AsfEnabled, and ManageabilityMode
+///
+#define PEI_AMT_PLATFORM_POLICY_PPI_REVISION_2 2
+///
+/// Added FWProgress
+///
+#define PEI_AMT_PLATFORM_POLICY_PPI_REVISION_3 3
+///
+/// Cleanup
+///
+#define PEI_AMT_PLATFORM_POLICY_PPI_REVISION_4 4
+///
+/// Cleanup
+///
+#define PEI_AMT_PLATFORM_POLICY_PPI_REVISION_5 5
+
+///
+/// Intel AMT Platform Policy PPI
+/// The Intel AMT Platform Policy PPI returns the Intel ME feature set in PEI phase
+///
+typedef struct _PEI_AMT_PLATFORM_POLICY_PPI {
+ UINT8 Revision; ///< Policy structure revision number
+ UINT8 iAmtEnabled : 1; ///< Intel AMT features enabled/disable
+ UINT8 WatchDog : 1; ///< Asf Watch Dog timer message enabled/disable
+ UINT8 Reserved : 1;
+ UINT8 AsfEnabled : 1; ///< Asf features enable/disable
+ UINT8 ManageabilityMode : 1; ///< Manageability Mode, 0: Off, 1:On
+ UINT8 Reserved1 : 1;
+ UINT16 WatchDogTimerOs; ///< Watch Dog timeout value for OS
+ UINT16 WatchDogTimerBios; ///< Watch Dog timeout value for BIOS
+ UINT8 FWProgress; ///< Progress Event option enable/disable
+} PEI_AMT_PLATFORM_POLICY_PPI;
+
+#endif
diff --git a/ReferenceCode/ME/Ppi/AmtStatusCode/AmtStatusCode.c b/ReferenceCode/ME/Ppi/AmtStatusCode/AmtStatusCode.c
new file mode 100644
index 0000000..c1f850e
--- /dev/null
+++ b/ReferenceCode/ME/Ppi/AmtStatusCode/AmtStatusCode.c
@@ -0,0 +1,30 @@
+/** @file
+ AMT Status Code support at PEI phase
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#include "Tiano.h"
+#include "Pei.h"
+
+#include EFI_PPI_DEFINITION (AmtStatusCode)
+
+EFI_GUID gPeiAmtStatusCodePpiGuid = PEI_AMT_STATUS_CODE_PPI_GUID;
+EFI_GUID gAmtPetQueueHobGuid = AMT_PET_QUEUE_HOB_GUID;
+EFI_GUID gAmtForcePushPetHobGuid = AMT_FORCE_PUSH_PET_HOB_GUID;
+
+EFI_GUID_STRING(&gPeiAmtStatusCodePpiGuid, "PEI AMT Status Code PPI", "PEI AMT Status Code PPI");
+EFI_GUID_STRING(&gAmtPetQueueHobGuid, "PEI AMT PET Queue Hob", "PEI AMT PET Queue Hob");
+EFI_GUID_STRING(&gAmtForcePushPetHobGuid, "PEI AMT Force Push PET Hob", "PEI AMT Force Push PET Hob");
diff --git a/ReferenceCode/ME/Ppi/AmtStatusCode/AmtStatusCode.h b/ReferenceCode/ME/Ppi/AmtStatusCode/AmtStatusCode.h
new file mode 100644
index 0000000..733a57f
--- /dev/null
+++ b/ReferenceCode/ME/Ppi/AmtStatusCode/AmtStatusCode.h
@@ -0,0 +1,120 @@
+/** @file
+ Header file for AMT Status Code support at PEI phase
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _PEI_AMT_STATUS_CODE_PPI_H_
+#define _PEI_AMT_STATUS_CODE_PPI_H_
+
+///
+/// Intel AMT PEI Status Code PPI GUID
+/// This driver produces interface to let PEI Status Code generic driver report status to
+/// Intel AMT, so that Intel AMT PET message can be sent out in PEI phase.
+///
+#define PEI_AMT_STATUS_CODE_PPI_GUID \
+ { \
+ 0x881807d2, 0x98d1, 0x4ec9, 0xaf, 0xa0, 0x77, 0x46, 0xc4, 0x2f, 0x24, 0x49 \
+ }
+
+extern EFI_GUID gPeiAmtStatusCodePpiGuid;
+
+EFI_FORWARD_DECLARATION (PEI_AMT_STATUS_CODE_PPI);
+
+/**
+ Provides an interface that a software module can call to report an ASF PEI status code.
+ The extension to report status code to Intel AMT, so that Intel AMT PET message will
+ be sent out in PEI.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] This This interface.
+ @param[in] Type Indicates the type of status code being reported.
+ @param[in] Value Describes the current status of a hardware or software entity.
+ This included information about the class and subclass that is
+ used to classify the entity as well as an operation.
+ @param[in] Instance The enumeration of a hardware or software entity within
+ the system. Valid instance numbers start with 1.
+ @param[in] CallerId This optional parameter may be used to identify the caller.
+ This parameter allows the status code driver to apply different
+ rules to different callers.
+ @param[in] Data This optional parameter may be used to pass additional data.
+
+ @retval EFI_SUCCESS The function completed successfully
+ @retval EFI_DEVICE_ERROR The function should not be completed due to a device error.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *PEI_AMT_STATUS_CODE_PPI_REPORT_STATUS_CODE) (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_AMT_STATUS_CODE_PPI *This,
+ IN EFI_STATUS_CODE_TYPE Type,
+ IN EFI_STATUS_CODE_VALUE Value,
+ IN UINT32 Instance,
+ IN EFI_GUID *CallerId OPTIONAL,
+ IN EFI_STATUS_CODE_DATA *Data OPTIONAL
+ )
+;
+
+///
+/// Intel AMT PEI Status Code PPI
+/// The PEI platform status code driver should be responsible to use this interface to report
+/// status code to Intel AMT. For example, memory init, memory init done, chassis intrusion.
+/// So that Intel AMT driver will send corresponding PET message out.
+///
+struct _PEI_AMT_STATUS_CODE_PPI {
+ ///
+ /// The extension to report status code to Intel AMT, so that Intel AMT PET message will
+ /// be sent out in PEI.
+ ///
+ PEI_AMT_STATUS_CODE_PPI_REPORT_STATUS_CODE ReportStatusCode;
+};
+
+///
+/// Queue Hob.
+/// This hob is used by PEI Status Code generic driver before Intel AMT PEI status code driver
+/// starts.
+/// 1) If AMT driver is not ready yet, StatusCode driver can save information
+/// to QueueHob.
+/// 2) If after AMT driver start, but ME is not ready, the AMT
+/// driver can also save information to QueueHob.
+/// Later, when ME is ready, AMT driver will send all the
+/// message in the QueueHob.
+///
+typedef struct {
+ EFI_HOB_GUID_TYPE EfiHobGuidType; ///< The GUID type hob header
+ EFI_STATUS_CODE_VALUE Value; ///< Status code value
+ EFI_STATUS_CODE_TYPE Type; ///< Status code type
+} AMT_PET_QUEUE_HOB;
+
+#define AMT_PET_QUEUE_HOB_GUID \
+ { \
+ 0xca0801d3, 0xafb1, 0x4dec, 0x9b, 0x65, 0x93, 0x65, 0xec, 0xc7, 0x93, 0x6b \
+ }
+
+extern EFI_GUID gAmtPetQueueHobGuid;
+
+#define AMT_FORCE_PUSH_PET_HOB_GUID \
+ { \
+ 0x4efa0db6, 0x26dc, 0x4bb1, 0xa7, 0x6f, 0x14, 0xbc, 0x63, 0x0c, 0x7b, 0x3c \
+ }
+
+typedef struct {
+ EFI_HOB_GUID_TYPE EfiHobGuidType;
+ INT32 MessageType;
+} AMT_FORCE_PUSH_PET_HOB;
+
+extern EFI_GUID gAmtForcePushPetHobGuid;
+
+#endif
diff --git a/ReferenceCode/ME/Ppi/Heci/Heci.c b/ReferenceCode/ME/Ppi/Heci/Heci.c
new file mode 100644
index 0000000..9b600a7
--- /dev/null
+++ b/ReferenceCode/ME/Ppi/Heci/Heci.c
@@ -0,0 +1,31 @@
+/** @file
+ PEI Heci PPI
+
+@copyright
+ Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#include EFI_PPI_DEFINITION (Heci)
+#endif
+
+EFI_GUID gPeiHeciPpiGuid = PEI_HECI_PPI_GUID;
+
+EFI_GUID_STRING(&gPeiHeciPpiGuid, "PEI Heci PPI", "PEI Heci PPI");
diff --git a/ReferenceCode/ME/Ppi/Heci/Heci.h b/ReferenceCode/ME/Ppi/Heci/Heci.h
new file mode 100644
index 0000000..2f026b3
--- /dev/null
+++ b/ReferenceCode/ME/Ppi/Heci/Heci.h
@@ -0,0 +1,201 @@
+/** @file
+ PEI Heci PPI
+
+@copyright
+ Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+#ifndef _PEI_HECI_PPI_H_
+#define _PEI_HECI_PPI_H_
+
+#include "MeState.h"
+
+///
+/// HECI PPI GUID
+/// This PPI provides an interface to communicate with Intel ME in PEI phase
+///
+#define PEI_HECI_PPI_GUID \
+ { \
+ 0xEE0EA811, 0xFBD9, 0x4777, 0xB9, 0x5A, 0xBA, 0x4F, 0x71, 0x10, 0x1F, 0x74 \
+ }
+
+extern EFI_GUID gPeiHeciPpiGuid;
+
+EFI_FORWARD_DECLARATION (PEI_HECI_PPI);
+
+/**
+ Function sends one messsage through the HECI circular buffer and waits
+ for the corresponding ACK message.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] This The address of HECI PPI.
+ @param[in][out] Message Pointer to the message buffer.
+ @param[in] HeciMemBar HECI Memory BAR.
+ @param[in][out] Length Length of the message in bytes.
+ @param[in] HostAddress Address of the sending entity.
+ @param[in] MeAddress Address of the ME entity that should receive the message.
+
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the bufferbefore timeout
+ @retval EFI_BUFFER_TOO_SMALL Message Buffer is too small for the Acknowledge
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support send message through HECI
+**/
+typedef
+EFI_STATUS
+(EFIAPI *PEI_HECI_SENDWACK) (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_HECI_PPI *This,
+ IN OUT UINT32 *Message,
+ IN UINT32 HeciMemBar,
+ IN OUT UINT32 *Length,
+ IN UINT8 HostAddress,
+ IN UINT8 MeAddress
+ );
+
+/**
+ Read the HECI Message from Intel ME with size in Length into
+ buffer Message. Set Blocking to BLOCKING and code will wait
+ until one message packet is received. When set to
+ NON_BLOCKING, if the circular buffer is empty at the time, the
+ code not wait for the message packet read.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] This The address of HECI PPI.
+ @param[in] HeciMemBar HECI Memory BAR.
+ @param[in] Blocking Used to determine if the read is BLOCKING or NON_BLOCKING.
+ @param[in] MessageBody Pointer to a buffer used to receive a message.
+ @param[in][out] Length Pointer to the length of the buffer on input and the length
+ of the message on return. (in bytes)
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS One message packet read
+ @retval EFI_TIMEOUT HECI is not ready for communication
+ @retval EFI_DEVICE_ERROR Zero-length message packet read
+ @retval EFI_BUFFER_TOO_SMALL The caller's buffer was not large enough
+**/
+typedef
+EFI_STATUS
+(EFIAPI *PEI_HECI_READ_MESSAGE) (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_HECI_PPI *This,
+ IN UINT32 Blocking,
+ IN UINT32 HeciMemBar,
+ IN UINT32 *MessageBody,
+ IN OUT UINT32 *Length
+ );
+
+/**
+ Function sends one messsage (of any length) through the HECI circular buffer.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] This The address of HECI PPI.
+ @param[in] HeciMemBar HECI Memory BAR.
+ @param[in] Message Pointer to the message data to be sent.
+ @param[in] Length Length of the message in bytes.
+ @param[in] HostAddress The address of the host processor.
+ @param[in] MeAddress Address of the ME subsystem the message is being sent to.
+
+ @retval EFI_SUCCESS One message packet sent.
+ @retval EFI_DEVICE_ERROR Failed to initialize HECI
+ @retval EFI_TIMEOUT HECI is not ready for communication
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support send message through HEC
+**/
+typedef
+EFI_STATUS
+(EFIAPI *PEI_HECI_SEND_MESSAGE) (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_HECI_PPI *This,
+ IN UINT32 *Message,
+ IN UINT32 HeciMemBar,
+ IN UINT32 Length,
+ IN UINT8 HostAddress,
+ IN UINT8 MEAddress
+ );
+
+/**
+ Determines if the HECI device is present and, if present, initializes it for
+ use by the BIOS.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] This The address of HECI PPI
+ @param[in][out] HeciMemBar HECI Memory BAR
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval EFI_DEVICE_ERROR No HECI device
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+ @exception EFI_UNSUPPORTED HECI MSG is unsupported
+**/
+typedef
+EFI_STATUS
+(EFIAPI *PEI_INITIALIZE_HECI) (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_HECI_PPI *This,
+ IN OUT UINT32 *HeciMemBar
+ );
+
+/**
+ Get an abstract Intel ME Status from Firmware Status Register.
+ This is used to control BIOS flow for different Intel ME
+ functions.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] MeStatus Pointer for status report,
+ see MeState.h - Abstract ME status definitions.
+
+ @retval EFI_SUCCESS MeStatus copied
+ @retval EFI_INVALID_PARAMETER Pointer of MeStatus is invalid
+**/
+typedef
+EFI_STATUS
+(EFIAPI *PEI_HECI_GET_ME_STATUS) (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN UINT32 *Status
+ );
+
+/**
+ Get an abstract ME operation mode from firmware status
+ register. This is used to control BIOS flow for different
+ Intel ME functions.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[out] MeMode Pointer for ME Mode report,
+ see MeState.h - Abstract ME Mode definitions.
+
+ @retval EFI_SUCCESS MeMode copied
+ @retval EFI_INVALID_PARAMETER Pointer of MeMode is invalid
+**/
+typedef
+EFI_STATUS
+(EFIAPI *PEI_HECI_GET_ME_MODE) (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN UINT32 *MeMode
+ );
+
+///
+/// HECI PPI
+/// The interface functions are for sending/receiving HECI messages between host and Intel ME subsystem
+/// in PEI phase
+///
+struct _PEI_HECI_PPI {
+ PEI_HECI_SENDWACK SendwAck; ///< Send HECI message and wait for respond
+ PEI_HECI_READ_MESSAGE ReadMsg; ///< Read message from HECI
+ PEI_HECI_SEND_MESSAGE SendMsg; ///< Send message to HECI
+ PEI_INITIALIZE_HECI InitializeHeci; ///< Init HECI
+ PEI_HECI_GET_ME_STATUS GetMeStatus; ///< Get Intel ME Status register
+ PEI_HECI_GET_ME_MODE GetMeMode; ///< Get Intel ME mode
+};
+
+#endif
diff --git a/ReferenceCode/ME/Ppi/MeLibPpi.cif b/ReferenceCode/ME/Ppi/MeLibPpi.cif
new file mode 100644
index 0000000..da1b41c
--- /dev/null
+++ b/ReferenceCode/ME/Ppi/MeLibPpi.cif
@@ -0,0 +1,22 @@
+<component>
+ name = "MeLibPpi"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\Ppi\"
+ RefName = "MeLibPpi"
+[files]
+"MeLibPpi.sdl"
+"MeLibPpi.mak"
+"MeLibPpi.inf"
+"AmtStatusCode\AmtStatusCode.h"
+"AmtStatusCode\AmtStatusCode.c"
+"Heci\Heci.h"
+"Heci\Heci.c"
+"AmtPlatformPolicyPei\AmtPlatformPolicyPei.c"
+"AmtPlatformPolicyPei\AmtPlatformPolicyPei.h"
+"MePlatformPolicyPei\MePlatformPolicyPei.h"
+"MePlatformPolicyPei\MePlatformPolicyPei.c"
+"PlatformMeHook\PlatformMeHook.h"
+"PlatformMeHook\PlatformMeHook.c"
+"PchMeUma\PchMeUma.c"
+"PchMeUma\PchMeUma.h"
+<endComponent>
diff --git a/ReferenceCode/ME/Ppi/MeLibPpi.inf b/ReferenceCode/ME/Ppi/MeLibPpi.inf
new file mode 100644
index 0000000..7a4973e
--- /dev/null
+++ b/ReferenceCode/ME/Ppi/MeLibPpi.inf
@@ -0,0 +1,59 @@
+## @file
+# Component description file for Me PPI library.
+#
+#@copyright
+# Copyright (c) 2005 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = MeLibPpi
+COMPONENT_TYPE = LIBRARY
+
+[includes.common]
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/Include
+
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[sources.common]
+ AmtStatusCode/AmtStatusCode.c
+ AmtStatusCode/AmtStatusCode.h
+ Heci/Heci.c
+ Heci/Heci.h
+ AmtPlatformPolicyPei/AmtPlatformPolicyPei.c
+ AmtPlatformPolicyPei/AmtPlatformPolicyPei.h
+ MePlatformPolicyPei/MePlatformPolicyPei.c
+ MePlatformPolicyPei/MePlatformPolicyPei.h
+ PlatformMeHook/PlatformMeHook.c
+ PlatformMeHook/PlatformMeHook.h
+ PchMeUma/PchMeUma.c
+ PchMeUma/PchMeUma.h
+
+[nmake.common]
+C_STD_INCLUDE=
+
diff --git a/ReferenceCode/ME/Ppi/MeLibPpi.mak b/ReferenceCode/ME/Ppi/MeLibPpi.mak
new file mode 100644
index 0000000..139f0d1
--- /dev/null
+++ b/ReferenceCode/ME/Ppi/MeLibPpi.mak
@@ -0,0 +1,43 @@
+# /*++
+# Copyright (c) 2009 Intel Corporation. All rights reserved.
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+# --*/
+# MAK file for the ModulePart:MeLibPpi
+all : MeLibPpi
+
+$(MeLibPpi_LIB) : MeLibPpi
+
+MeLibPpi : $(BUILD_DIR)\MeLibPpi.mak MeLibPpiBin
+
+$(BUILD_DIR)\MeLibPpi.mak : $(MeLibPpi_DIR)\$(@B).cif $(MeLibPpi_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(MeLibPpi_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+MeLibPpi_INCLUDES = \
+ $(EDK_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(ME_INCLUDES)
+
+MeLibPpiBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\MeLibPpi.mak all\
+ "MY_INCLUDES=$(MeLibPpi_INCLUDES)" \
+ TYPE=PEI_LIBRARY \
+#**********************************************************************
+#**********************************************************************
+#** **
+#** (C)Copyright 1985-2006, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 6145-F Northbelt Pkwy, Norcross, GA 30071 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#**********************************************************************
+#**********************************************************************
diff --git a/ReferenceCode/ME/Ppi/MeLibPpi.sdl b/ReferenceCode/ME/Ppi/MeLibPpi.sdl
new file mode 100644
index 0000000..cedbd4b
--- /dev/null
+++ b/ReferenceCode/ME/Ppi/MeLibPpi.sdl
@@ -0,0 +1,34 @@
+TOKEN
+ Name = "MeLibPpi_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable MeLibPpi support in Project"
+ TokenType = Boolean
+ TargetMAK = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "MeLibPpi_DIR"
+End
+
+MODULE
+ Help = "Includes MeLibPpi.mak to Project"
+ File = "MeLibPpi.mak"
+End
+
+ELINK
+ Name = "MeLibPpi_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\MeLibPpi.lib"
+ Parent = "MeLibPpi_LIB"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(MeLibPpi_DIR)"
+ Parent = "ME_INCLUDES"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/ME/Ppi/MePlatformPolicyPei/MePlatformPolicyPei.c b/ReferenceCode/ME/Ppi/MePlatformPolicyPei/MePlatformPolicyPei.c
new file mode 100644
index 0000000..e371be3
--- /dev/null
+++ b/ReferenceCode/ME/Ppi/MePlatformPolicyPei/MePlatformPolicyPei.c
@@ -0,0 +1,31 @@
+/** @file
+ ME Platform Policy for ME PEIMs
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#include EFI_PPI_DEFINITION (MePlatformPolicyPei)
+#endif
+
+EFI_GUID gPeiMePlatformPolicyPpiGuid = PEI_ME_PLATFORM_POLICY_PPI_GUID;
+
+EFI_GUID_STRING(&gPeiMePlatformPolicyPpiGuid, "PeiMePlatformPolicyPpi", "PEI Me Platform Policy PPI");
diff --git a/ReferenceCode/ME/Ppi/MePlatformPolicyPei/MePlatformPolicyPei.h b/ReferenceCode/ME/Ppi/MePlatformPolicyPei/MePlatformPolicyPei.h
new file mode 100644
index 0000000..034b955
--- /dev/null
+++ b/ReferenceCode/ME/Ppi/MePlatformPolicyPei/MePlatformPolicyPei.h
@@ -0,0 +1,58 @@
+/** @file
+ ME Platform Policy for ME PEIMs
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _PEI_ME_PLATFORM_POLICY_PPI_H_
+#define _PEI_ME_PLATFORM_POLICY_PPI_H_
+
+//
+// Include other definitions
+//
+///
+/// ME policy provided by platform for PEI phase
+/// The Platform Policy PPI returns the Intel ME feature set in PEI phase
+///
+#define PEI_ME_PLATFORM_POLICY_PPI_GUID \
+ { \
+ 0x7ae3ceb7, 0x2ee2, 0x48fa, 0xaa, 0x49, 0x35, 0x10, 0xbc, 0x83, 0xca, 0xbf \
+ }
+
+//
+// Extern the GUID for PPI users.
+//
+extern EFI_GUID gPeiMePlatformPolicyPpiGuid;
+
+//
+// Revision
+//
+#define PEI_ME_PLATFORM_POLICY_PPI_REVISION_1 1
+#define PEI_ME_PLATFORM_POLICY_PPI_REVISION_2 2
+
+///
+///
+/// ME policy provided by platform for PEI phase
+/// The Platform Policy PPI returns the Intel ME feature set in PEI phase
+///
+typedef struct _PEI_ME_PLATFORM_POLICY_PPI {
+ UINT8 Revision; ///< Revision for the protocol structure
+ UINT8 Reserved1 : 1; ///< Reserved for Intel internal use
+ UINT8 Reserved2 : 1; ///< Reserved for Intel internal use
+ UINT8 Reserved : 6; ///< Reserved for Intel internal use
+ UINT8 FTpmSwitch;
+} PEI_ME_PLATFORM_POLICY_PPI;
+
+#endif
diff --git a/ReferenceCode/ME/Ppi/PchMeUma/PchMeUma.c b/ReferenceCode/ME/Ppi/PchMeUma/PchMeUma.c
new file mode 100644
index 0000000..a7478d1
--- /dev/null
+++ b/ReferenceCode/ME/Ppi/PchMeUma/PchMeUma.c
@@ -0,0 +1,42 @@
+/** @file
+ This file defines the Pch Me UMA function
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+//
+// Statements that include other files
+//
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+//
+// Include the PPI header file
+//
+#include EFI_PPI_DEFINITION (PchMeUma)
+#endif
+//
+// PPI GUID definition
+//
+EFI_GUID gPchMeUmaPpiGuid = PCH_ME_UMA_PPI_GUID;
+
+//
+// PPI description
+//
+EFI_GUID_STRING(&gPchMeUmaPpiGuid, "PchMeUma PPI", "Intel(R) PCH ME UMA PPI");
diff --git a/ReferenceCode/ME/Ppi/PchMeUma/PchMeUma.h b/ReferenceCode/ME/Ppi/PchMeUma/PchMeUma.h
new file mode 100644
index 0000000..ef9b0a3
--- /dev/null
+++ b/ReferenceCode/ME/Ppi/PchMeUma/PchMeUma.h
@@ -0,0 +1,159 @@
+/** @file
+ Interface definition details for PCH Me UMA.
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _PCH_ME_UMA_PPI_H_
+#define _PCH_ME_UMA_PPI_H_
+
+///
+/// ME UMA PPI
+/// The interface functions are for configure/receiving Me FW in PEI phase.
+///
+#define PCH_ME_UMA_PPI_GUID \
+ { \
+ 0x8c376010, 0x2400, 0x4d7d, 0xb4, 0x7b, 0x9d, 0x85, 0x1d, 0xf3, 0xc9, 0xd1 \
+ }
+
+extern EFI_GUID gPchMeUmaPpiGuid;
+
+//
+// Revision
+//
+#define PCH_ME_UMA_PPI_REVISION 1
+
+///
+/// define the MRC recommended boot modes.
+///
+typedef enum {
+ s3Boot, ///< In current implementation, bmS3 == bmWarm
+ warmBoot,
+ coldBoot,
+ fastBoot,
+} MRC_BOOT_MODE_T;
+
+/**
+ This procedure will read and return the amount of ME UMA requested
+ by ME ROM from the HECI device.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] FfsHeader Pointer to the FFS file header
+
+ @retval UINT32 Return ME UMA Size
+ @retval EFI_SUCCESS Do not check for ME UMA
+**/
+typedef
+UINT32
+(EFIAPI *ME_SEND_UMA_SIZE) (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_FFS_FILE_HEADER *FfsHeader
+ )
+;
+
+/**
+ This procedure will determine whether or not the CPU was replaced
+ during system power loss or via dynamic fusing.
+ Calling this procedure could result in a warm reset (if ME FW is requesting one).
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] FfsHeader Not used.
+ @param[out] ForceFullTraining When set = 0x1, MRC will be forced to perform a full
+ memory training cycle.
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *CPU_REPLACEMENT_CHECK) (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ OUT UINT8 *ForceFullTraining
+ )
+;
+
+/**
+ This procedure will configure the ME Host General Status register,
+ indicating that DRAM Initialization is complete and ME FW may
+ begin using the allocated ME UMA space.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] FfsHeader Pointer to the FFS file header
+ @param[in] MrcBootMode MRC BootMode
+ @param[in] InitStat H_GS[27:24] Status
+ @param[in] FtpmStolenBase The base of FTPM
+
+ @retval EFI_SUCCESS
+**/
+typedef
+EFI_STATUS
+(EFIAPI *ME_CONFIG_DID_REG) (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN MRC_BOOT_MODE_T MrcBootMode,
+ IN UINT8 InitStat,
+ IN UINT32 FtpmStolenBase,
+ IN UINT32 MeUmaSize
+
+ )
+;
+
+/**
+ This procedure will enforce the BIOS Action that was requested by ME FW
+ as part of the DRAM Init Done message.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] MrcBootMode MRC BootMode
+ @param[in] BiosAction Me requests BIOS to act
+
+ @retval EFI_SUCCESS Always return EFI_SUCCESS
+**/
+typedef
+EFI_STATUS
+(EFIAPI *HANDLE_ME_BIOS_ACTION) (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN MRC_BOOT_MODE_T MrcBootMode,
+ IN UINT8 BiosAction
+ )
+;
+
+///
+/// ME UMA PPI
+/// This PPI provides an interface to get the ME UMA size and performs the DID handshake with ME
+///
+typedef struct PCH_ME_UMA_PPI {
+ ///
+ /// This procedure will read and return the amount of ME UMA requested by ME ROM from the
+ /// HECI device
+ ///
+ ME_SEND_UMA_SIZE MeSendUmaSize;
+ ///
+ /// This procedure will determine whether or not the CPU was replaced during system power loss
+ /// or via dynamic fusing
+ ///
+ CPU_REPLACEMENT_CHECK CpuReplacementCheck;
+ ///
+ /// This procedure will configure the ME Host General Status register, indicating that DRAM
+ /// Initialization is complete and ME FW may begin using the allocated ME UMA space
+ ///
+ ME_CONFIG_DID_REG MeConfigDidReg;
+ ///
+ /// This procedure will enforce the BIOS Action that was requested by ME FW as part of the
+ /// DRAM Init Done message
+ ///
+ HANDLE_ME_BIOS_ACTION HandleMeBiosAction;
+} PCH_ME_UMA_PPI;
+
+#endif
diff --git a/ReferenceCode/ME/Ppi/PlatformMeHook/PlatformMeHook.c b/ReferenceCode/ME/Ppi/PlatformMeHook/PlatformMeHook.c
new file mode 100644
index 0000000..96dc6c9
--- /dev/null
+++ b/ReferenceCode/ME/Ppi/PlatformMeHook/PlatformMeHook.c
@@ -0,0 +1,42 @@
+/** @file
+ This file defines the Platform ME Hook function
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+//
+// Statements that include other files
+//
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+//
+// Include the PPI header file
+//
+#include EFI_PPI_DEFINITION (PlatformMeHook)
+#endif
+//
+// PPI GUID definition
+//
+EFI_GUID gPlatformMeHookPpiGuid = PLATFORM_ME_HOOK_PPI_GUID;
+
+//
+// PPI description
+//
+EFI_GUID_STRING(&gPlatformMeHookPpiGuid, "PlatformMeHook PPI", "Intel(R) PEIM Phase ME Platform Hook PPI");
diff --git a/ReferenceCode/ME/Ppi/PlatformMeHook/PlatformMeHook.h b/ReferenceCode/ME/Ppi/PlatformMeHook/PlatformMeHook.h
new file mode 100644
index 0000000..92c0292
--- /dev/null
+++ b/ReferenceCode/ME/Ppi/PlatformMeHook/PlatformMeHook.h
@@ -0,0 +1,70 @@
+/** @file
+ Interface definition details for platform hook support to ME module.
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _PLATFORM_ME_HOOK_PPI_H_
+#define _PLATFORM_ME_HOOK_PPI_H_
+
+///
+/// ME Hook provided by platform for PEI phase
+/// This ppi provides an interface to hook reference code by OEM.
+///
+#define PLATFORM_ME_HOOK_PPI_GUID \
+ { \
+ 0xe806424f, 0xd425, 0x4b1a, 0xbc, 0x26, 0x5f, 0x69, 0x03, 0x89, 0xa1, 0x5a \
+ }
+
+extern EFI_GUID gPlatformMeHookPpiGuid;
+
+EFI_FORWARD_DECLARATION (PLATFORM_ME_HOOK_PPI);
+
+//
+// Revision
+//
+#define PLATFORM_ME_HOOK_PPI_REVISION 1
+
+/**
+ Platform hook before BIOS sends Global Reset Heci Message to ME
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] This Pointer to this PLATFORM_ME_HOOK_PPI
+
+ @retval EFI Status Code
+**/
+typedef
+EFI_STATUS
+(EFIAPI *PLATFORM_ME_HOOK_PRE_GLOBAL_RESET) (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PLATFORM_ME_HOOK_PPI *This
+ );
+
+///
+/// ME Hook provided by platform for PEI phase
+/// This ppi provides an interface to hook reference code by OEM.
+///
+struct _PLATFORM_ME_HOOK_PPI {
+ ///
+ /// Revision for the ppi structure
+ ///
+ UINT8 Revision;
+ ///
+ /// Function pointer for the hook called before BIOS sends Global Reset Heci Message to ME
+ //
+ PLATFORM_ME_HOOK_PRE_GLOBAL_RESET PreGlobalReset;
+};
+
+#endif
diff --git a/ReferenceCode/ME/Protocol/ActiveManagement/ActiveManagement.c b/ReferenceCode/ME/Protocol/ActiveManagement/ActiveManagement.c
new file mode 100644
index 0000000..521426b
--- /dev/null
+++ b/ReferenceCode/ME/Protocol/ActiveManagement/ActiveManagement.c
@@ -0,0 +1,46 @@
+/** @file
+ Defines and prototypes for the ActiveManagement driver.
+ This driver implements the ActiveManagement protocol for iAMT.
+ It provides some functions to get Boot Options from ASF.
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+//
+// Statements that include other files
+//
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+//
+// Include the protocol header file
+//
+#include EFI_PROTOCOL_DEFINITION (ActiveManagement)
+#endif
+//
+// Protocol GUID definition
+//
+EFI_GUID gEfiActiveManagementProtocolGuid = EFI_ACTIVE_MANAGEMENT_PROTOCOL_GUID;
+
+//
+// Protocol description
+//
+EFI_GUID_STRING(
+ &gEfiActiveManagementProtocolGuid, "Active Management Protocol", "The active management protocol provides services."
+ );
diff --git a/ReferenceCode/ME/Protocol/ActiveManagement/ActiveManagement.h b/ReferenceCode/ME/Protocol/ActiveManagement/ActiveManagement.h
new file mode 100644
index 0000000..17a5045
--- /dev/null
+++ b/ReferenceCode/ME/Protocol/ActiveManagement/ActiveManagement.h
@@ -0,0 +1,140 @@
+/** @file
+ Active Management Technology Protocol to return the state of ASF Boot Options
+ related to Active Management Technology.
+
+@copyright
+ Copyright (c) 2005 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _EFI_ACTIVE_MANAGEMENT_PROTOCOL_H_
+#define _EFI_ACTIVE_MANAGEMENT_PROTOCOL_H_
+
+#include EFI_PROTOCOL_DEFINITION (AlertStandardFormat)
+
+///
+/// Intel Active Management Technology Protocol
+/// This protocol provides interface to get ASF boot options status
+///
+#define EFI_ACTIVE_MANAGEMENT_PROTOCOL_GUID \
+ { \
+ 0x8555fd40, 0x140b, 0x4f3c, 0x90, 0x5e, 0x3b, 0xf3, 0x78, 0xa0, 0x99, 0xfa \
+ }
+
+//
+// Extern the GUID for protocol users.
+//
+extern EFI_GUID gEfiActiveManagementProtocolGuid;
+
+//
+// Forward reference for ANSI C compatibility
+//
+EFI_FORWARD_DECLARATION (EFI_ACTIVE_MANAGEMENT_PROTOCOL);
+
+//
+// Protocol definitions
+//
+
+/**
+ Return current state of Boot Options
+ @param[in] This Pointer to the EFI_ACTIVE_MANAGEMENT_PROTOCOL instance.
+ @param[in] CurrentState TRUE when the boot options is enabled
+
+ @retval EFI_SUCCESS Command succeed.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_ACTIVE_MANAGEMENT_BOOT_OPTIONS_STATE) (
+ IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This,
+ IN OUT BOOLEAN *CurrentState
+ )
+;
+
+/**
+ This will return IDE Redirection boot device to boot
+
+ @param[in] IdeBootDevice Return the boot device number to boot
+ Bits 0-1: If IDER boot is selected in Perimeter 1 then
+ Bits 1,2 define the drive on the IDER controller to be used as the
+ boot driver.
+ Bit 1 Bit0
+ 0 0 Primary Master Drive
+ 0 1 Primary Slave Drive
+ 1 0 Secondary Master Drive
+ 1 1 Secondary Slave Drive
+ Bits 2-7: Reserved set to 0
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_ACTIVE_MANAGEMENT_IDER_BOOT_DEVICE_SELECTED) (
+ IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This,
+ IN OUT UINT8 *IdeBootDevice
+ )
+;
+
+/**
+ Return current ASF Boot Options
+
+ @param[in] This Pointer to the EFI_ACTIVE_MANAGEMENT_PROTOCOL instance.
+ @param[in] AsfBootOptions ASF Boot Options
+
+ @retval EFI_SUCCESS Command succeed.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_ACTIVE_MANAGEMENT_ASF_BOOT_OPTIONS_GET) (
+ IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This,
+ IN OUT EFI_ASF_BOOT_OPTIONS **AsfBootOptions
+ )
+;
+
+/**
+ This will return verbosity request option
+
+ @param[in] CurrentState Return the state of verbosity option
+
+ @retval EFI_SUCCESS The function completed successfully.
+ @retval CurrentState 00 - No BootOption available
+ 01 - Non-Verbosity request
+ 02 - Verbosity request
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_ACTIVE_MANAGEMENT_VERBOSITY_REQUESTED) (
+ IN EFI_ACTIVE_MANAGEMENT_PROTOCOL *This,
+ IN OUT UINT8 *CurrentState
+ )
+;
+
+///
+/// Intel Active Management Technology Protocol
+/// It provides abstract level function of ASF boot options defined in ASF 2.0 specification for
+/// other modules to get ASF boot options status.
+///
+struct _EFI_ACTIVE_MANAGEMENT_PROTOCOL {
+ EFI_ACTIVE_MANAGEMENT_BOOT_OPTIONS_STATE GetIderState;
+ EFI_ACTIVE_MANAGEMENT_BOOT_OPTIONS_STATE GetEnforceSecureBootState;
+ EFI_ACTIVE_MANAGEMENT_BOOT_OPTIONS_STATE GetSolState;
+ EFI_ACTIVE_MANAGEMENT_BOOT_OPTIONS_STATE GetRemoteFlashState;
+ EFI_ACTIVE_MANAGEMENT_BOOT_OPTIONS_STATE GetBiosSetupState;
+ EFI_ACTIVE_MANAGEMENT_BOOT_OPTIONS_STATE GetBiosPauseState;
+ EFI_ACTIVE_MANAGEMENT_BOOT_OPTIONS_STATE GetConsoleLockState;
+ EFI_ACTIVE_MANAGEMENT_BOOT_OPTIONS_STATE GetKvmState;
+ EFI_ACTIVE_MANAGEMENT_IDER_BOOT_DEVICE_SELECTED GetIderBootDeviceSelectd;
+ EFI_ACTIVE_MANAGEMENT_ASF_BOOT_OPTIONS_GET GetAsfBootOptions;
+ EFI_ACTIVE_MANAGEMENT_BOOT_OPTIONS_STATE GetProgressMsgRequest;
+};
+
+#endif
diff --git a/ReferenceCode/ME/Protocol/AlertStandardFormat/AlertStandardFormat.c b/ReferenceCode/ME/Protocol/AlertStandardFormat/AlertStandardFormat.c
new file mode 100644
index 0000000..256fed5
--- /dev/null
+++ b/ReferenceCode/ME/Protocol/AlertStandardFormat/AlertStandardFormat.c
@@ -0,0 +1,32 @@
+/** @file
+ Definition of Alert Standard Format (ASF) 2.0
+
+@copyright
+ Copyright (c) 2005 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include EFI_PROTOCOL_DEFINITION (AlertStandardFormat)
+#endif
+
+EFI_GUID gEfiAlertStandardFormatProtocolGuid = EFI_ALERT_STANDARD_FORMAT_PROTOCOL_GUID;
+
+EFI_GUID_STRING
+ (&gEfiAlertStandardFormatProtocolGuid, "Alert Standard Format Protocol", "Alert Standard Format Protocol");
diff --git a/ReferenceCode/ME/Protocol/AlertStandardFormat/AlertStandardFormat.h b/ReferenceCode/ME/Protocol/AlertStandardFormat/AlertStandardFormat.h
new file mode 100644
index 0000000..3d4bf3b
--- /dev/null
+++ b/ReferenceCode/ME/Protocol/AlertStandardFormat/AlertStandardFormat.h
@@ -0,0 +1,185 @@
+/** @file
+ Definition of Alert Standard Format (ASF) 2.0
+
+@copyright
+ Copyright (c) 2005 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef __ALERT_STANDARD_FORMAT_PROTOCOL_H__
+#define __ALERT_STANDARD_FORMAT_PROTOCOL_H__
+
+///
+/// Alert Standard Format Protocol
+/// This protocol provides interfaces to get ASF Boot Options and send ASF messages
+///
+#define EFI_ALERT_STANDARD_FORMAT_PROTOCOL_GUID \
+ { \
+ 0xcc93a70b, 0xec27, 0x49c5, 0x8b, 0x34, 0x13, 0x93, 0x1e, 0xfe, 0xd6, 0xe2 \
+ }
+
+typedef struct _EFI_ALERT_STANDARD_FORMAT_PROTOCOL EFI_ALERT_STANDARD_FORMAT_PROTOCOL;
+
+#pragma pack(1)
+typedef struct {
+ UINT8 SubCommand;
+ UINT8 Version;
+ UINT32 IanaId;
+ UINT8 SpecialCommand;
+ UINT16 SpecialCommandParam;
+ UINT16 BootOptions;
+ UINT16 OemParameters;
+} EFI_ASF_BOOT_OPTIONS;
+
+typedef struct {
+ UINT8 SubCommand;
+ UINT8 Version;
+ UINT8 EventSensorType;
+ UINT8 EventType;
+ UINT8 EventOffset;
+ UINT8 EventSourceType;
+ UINT8 EventSeverity;
+ UINT8 SensorDevice;
+ UINT8 SensorNumber;
+ UINT8 Entity;
+ UINT8 EntityInstance;
+ UINT8 Data0;
+ UINT8 Data1;
+} EFI_ASF_MESSAGE;
+
+typedef struct {
+ UINT8 SubCommand;
+ UINT8 Version;
+} EFI_ASF_CLEAR_BOOT_OPTIONS;
+#pragma pack()
+//
+// Special Command Attributes
+//
+#define NOP 0x00
+#define FORCE_PXE 0x01
+#define FORCE_HARDDRIVE 0x02
+#define FORCE_SAFEMODE 0x03
+#define FORCE_DIAGNOSTICS 0x04
+#define FORCE_CDDVD 0x05
+
+//
+// Boot Options Mask
+//
+#define LOCK_POWER_BUTTON 0x0002 ///< 0000 0000 0000 0010 - bit 1
+#define LOCK_RESET_BUTTON 0x0004 ///< 0000 0000 0000 0200 - bit 2
+#define LOCK_KEYBOARD 0x0020 ///< 0000 0000 0010 0000 - bit 5
+#define LOCK_SLEEP_BUTTON 0x0040 ///< 0000 0000 0100 0000 - bit 6
+#define USER_PASSWORD_BYPASS 0x0800 ///< 0000 1000 0000 0000 - bit 3
+#define FORCE_PROGRESS_EVENTS 0x1000 ///< 0001 0000 0000 0000 - bit 4
+#define FIRMWARE_VERBOSITY_DEFAULT 0x0000 ///< 0000 0000 0000 0000 - bit 6:5
+#define FIRMWARE_VERBOSITY_QUIET 0x2000 ///< 0010 0000 0000 0000 - bit 6:5
+#define FIRMWARE_VERBOSITY_VERBOSE 0x4000 ///< 0100 0000 0000 0000 - bit 6:5
+#define FIRMWARE_VERBOSITY_BLANK 0x6000 ///< 0110 0000 0000 0000 - bit 6:5
+#define CONFIG_DATA_RESET 0x8000 ///< 1000 0000 0000 0000 - bit 7
+#define ASF_BOOT_OPTIONS_PRESENT 0x16
+#define ASF_BOOT_OPTIONS_NOT_PRESENT 0x17
+
+#define USE_KVM 0x0020 ///< 0000 0000 0010 0000 - bit 5
+///
+/// ASF Internet Assigned Numbers Authority Manufacturer ID
+/// (The firmware sends 0XBE110000 for decimal value 4542)
+///
+#define INDUSTRY_IANA_SWAP32(x) ((((x) & 0xff) << 24) | (((x) & 0xff00) << 8) | \
+ (((x) & 0xff0000) >> 8) | (((x) & 0xff000000) >> 24))
+#define ASF_INDUSTRY_IANA 0x000011BE
+#define ASF_INDUSTRY_CONVERTED_IANA INDUSTRY_IANA_SWAP32 (ASF_INDUSTRY_IANA) ///< 0XBE110000, received from ME FW
+
+/**
+ Return the SMBus address used by the ASF driver.
+ Not applicable in Intel ME/HECI system, need to return EFI_UNSUPPORTED.
+
+ @retval EFI_SUCCESS Address returned
+ @retval EFI_INVALID_PARAMETER Invalid SMBus address
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_ALERT_STANDARD_FORMAT_PROTOCOL_GET_SMBUSADDR) (
+ IN EFI_ALERT_STANDARD_FORMAT_PROTOCOL *This,
+ OUT UINTN *SmbusDeviceAddress
+ )
+;
+
+/**
+ Set the SMBus address used by the ASF driver. 0 is an invalid address.
+ Not applicable in Intel ME/HECI system, need to return EFI_UNSUPPORTED.
+
+ @param[in] SmbusAddr SMBus address of the controller
+
+ @retval EFI_SUCCESS Address set
+ @retval EFI_INVALID_PARAMETER Invalid SMBus address
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_ALERT_STANDARD_FORMAT_PROTOCOL_SET_SMBUSADDR) (
+ IN EFI_ALERT_STANDARD_FORMAT_PROTOCOL *This,
+ IN UINTN SmbusDeviceAddress
+ )
+;
+
+/**
+ Return the ASF Boot Options obtained from the controller. If the
+ Boot Options parameter is NULL and no boot options have been retrieved,
+ Query the ASF controller for its boot options.
+ Get ASF Boot Options through HECI.
+
+ @param[in] AsfBootOptions Pointer to ASF boot options to copy current ASF Boot options
+
+ @retval EFI_SUCCESS Boot options copied
+ @retval EFI_NOT_READY No boot options
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_ALERT_STANDARD_FORMAT_PROTOCOL_GET_BOOT_OPTIONS) (
+ IN EFI_ALERT_STANDARD_FORMAT_PROTOCOL *This,
+ IN OUT EFI_ASF_BOOT_OPTIONS **AsfBootOptions
+ )
+;
+
+/**
+ Send ASF Message.
+ Send ASF Message through HECI.
+
+ @param[in] AsfMessage Pointer to ASF message
+
+ @retval EFI_SUCCESS Boot options copied
+ @retval EFI_INVALID_PARAMETER Invalid pointer
+ @retval EFI_NOT_READY No controller
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_ALERT_STANDARD_FORMAT_PROTOCOL_SEND_ASF_MESSAGE) (
+ IN EFI_ALERT_STANDARD_FORMAT_PROTOCOL *This,
+ IN EFI_ASF_MESSAGE *AsfMessage
+ )
+;
+
+///
+/// Alert Standard Format Protocol
+/// This protocol provides interfaces to get ASF Boot Options and send ASF messages
+/// HECI protocol is consumed and used to send ASF messages and receive ASF Boot Options
+///
+struct _EFI_ALERT_STANDARD_FORMAT_PROTOCOL {
+ EFI_ALERT_STANDARD_FORMAT_PROTOCOL_GET_SMBUSADDR GetSmbusAddr;
+ EFI_ALERT_STANDARD_FORMAT_PROTOCOL_SET_SMBUSADDR SetSmbusAddr;
+ EFI_ALERT_STANDARD_FORMAT_PROTOCOL_GET_BOOT_OPTIONS GetBootOptions;
+ EFI_ALERT_STANDARD_FORMAT_PROTOCOL_SEND_ASF_MESSAGE SendAsfMessage;
+};
+
+extern EFI_GUID gEfiAlertStandardFormatProtocolGuid;
+
+#endif
diff --git a/ReferenceCode/ME/Protocol/AmtPlatformPolicy/AmtPlatformPolicy.c b/ReferenceCode/ME/Protocol/AmtPlatformPolicy/AmtPlatformPolicy.c
new file mode 100644
index 0000000..f947dfc
--- /dev/null
+++ b/ReferenceCode/ME/Protocol/AmtPlatformPolicy/AmtPlatformPolicy.c
@@ -0,0 +1,44 @@
+/** @file
+ This file defines the EFI AMT policy Protocol which implements the
+ Intel(R) Active Management Technology
+
+@copyright
+ Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+//
+// Statements that include other files
+//
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+//
+// Include the protocol header file
+//
+#include EFI_PROTOCOL_DEFINITION (AmtPlatformPolicy)
+#endif
+//
+// Protocol GUID definition
+//
+EFI_GUID gDxePlatformAmtPolicyGuid = DXE_PLATFORM_AMT_POLICY_GUID;
+
+//
+// Protocol description
+//
+EFI_GUID_STRING
+ (&gDxePlatformAmtPolicyGuid, "AmtPlatformPolicy Protocol", "Intel(R) DXE Phase AMT Platform Policy Protocol");
diff --git a/ReferenceCode/ME/Protocol/AmtPlatformPolicy/AmtPlatformPolicy.h b/ReferenceCode/ME/Protocol/AmtPlatformPolicy/AmtPlatformPolicy.h
new file mode 100644
index 0000000..bfc98ff
--- /dev/null
+++ b/ReferenceCode/ME/Protocol/AmtPlatformPolicy/AmtPlatformPolicy.h
@@ -0,0 +1,111 @@
+/** @file
+ Interface definition details between AMT and platform drivers during DXE phase.
+
+@copyright
+ Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _AMT_PLATFORM_POLICY_H_
+#define _AMT_PLATFORM_POLICY_H_
+
+///
+/// AMT policy provided by platform for DXE phase
+/// This protocol provides the information about Intel AMT platform configuration settings.
+///
+#define DXE_PLATFORM_AMT_POLICY_GUID \
+ { \
+ 0x6725e645, 0x4a7f, 0x9969, 0x82, 0xec, 0xd1, 0x87, 0x21, 0xde, 0x5a, 0x57 \
+ }
+
+///
+/// Protocol revision number
+/// Any backwards compatible changes to this protocol will result in an update in the revision number
+/// Major changes will require publication of a new protocol
+///
+#define DXE_PLATFORM_AMT_POLICY_PROTOCOL_REVISION_1 1 ///< Initial Revision
+
+extern EFI_GUID gDxePlatformAmtPolicyGuid;
+#pragma pack(1)
+typedef struct {
+ //
+ // Byte 0, bit definition for functionality enable/disable
+ //
+ UINT8 AsfEnabled : 1; ///< 0: Disabled; 1: Enabled
+ UINT8 iAmtEnabled : 1; ///< 0: Disabled; 1: Enabled
+ UINT8 iAmtbxPasswordWrite : 1; ///< 0: Disabled; 1: Enabled
+ UINT8 WatchDog : 1; ///< 0: Disabled; 1: Enabled
+ UINT8 CiraRequest : 1; ///< 0: No CIRA request; 1: Trigger CIRA request
+ UINT8 ManageabilityMode : 1; ///< 0: Disabled; 1:AMT
+ UINT8 UnConfigureMe : 1; ///< 0: No; 1: Un-configure ME without password
+ UINT8 MebxDebugMsg : 1; ///< 0: Disabled; 1: Enabled
+ //
+ // Byte 1, bit definition for functionality enable/disable
+ //
+ UINT8 ForcMebxSyncUp : 1; ///< 0: No; 1: Force MEBX execution
+ UINT8 UsbrEnabled : 1; ///< 0: Disabled; 1: Enabled
+ UINT8 UsbLockingEnabled : 1; ///< 0: Disabled; 1: Enabled
+ UINT8 HideUnConfigureMeConfirm : 1; ///< 0: Don't hide; 1: Hide Un-configure ME Confirmation Prompt
+ UINT8 USBProvision : 1; ///< 0: Disabled; 1: Enabled
+ UINT8 FWProgress : 1; ///< 0: Disabled; 1: Enabled
+ UINT8 iAmtbxHotkeyPressed : 1; ///< 0: Disabled; 1: Enabled
+ UINT8 iAmtbxSelectionScreen : 1; ///< 0: Disabled; 1: Enabled
+ //
+ // Byte 2, bit definition for functionality enable/disable
+ //
+ UINT8 AtEnabled : 1; ///< 0: Disabled; 1: Enabled
+ UINT8 Byte2Reserved : 7;
+ UINT16 WatchDogTimerOs; ///< Byte 3-4 OS WatchDog Timer
+ UINT16 WatchDogTimerBios; ///< Byte 5-6 BIOS WatchDog Timer
+ ///
+ /// Byte 7 CIRA Timeout: Client Initiated Remote Access Timeout
+ /// OEM defined timeout for MPS connection to be established.
+ /// 0: 60 seconds by default, 0xFF: Wait until the connection succeeds.
+ /// 1~0xFE: Values in seconds
+ ///
+ UINT8 CiraTimeout;
+
+ ///
+ /// Byte 8 CPU Replacement Timeout
+ /// 0: 10 seconds; 1: 30 seconds; 2~5: Reserved; 6: No delay; 7: Unlimited delay
+ ///
+ UINT8 CpuReplacementTimeout;
+ //
+ // Byte 9-10 OemResolutionSettings
+ //
+ UINT16 MebxNonUiTextMode : 4; ///< 0: Auto; 1: 80x25; 2: 100x31
+ UINT16 MebxUiTextMode : 4; ///< 0: Auto; 1: 80x25; 2: 100x31
+ UINT16 MebxGraphicsMode : 4; ///< 0: Auto; 1: 640x480; 2: 800x600; 3: 1024x768
+ UINT16 OemResolutionSettingsRsvd : 4;
+ //
+ // Byte 11-14 Pointer to a list which contain on-board devices bus/device/fun number
+ //
+ UINT32 PciDeviceFilterOutTable;
+ //
+ // Byte 15-23 Reserved and make AMT_CONFIG as 32 bit alignment
+ //
+ UINT8 ByteReserved[9];
+} AMT_CONFIG;
+
+#pragma pack()
+///
+/// AMT DXE Platform Policy
+/// This protocol is initialized by platform Policy driver. Other modules can locate this protocol
+/// to retrieve Intel AMT related setup options setting
+///
+typedef struct _DXE_AMT_POLICY_PROTOCOL {
+ UINT8 Revision; ///< Revision for the protocol structure
+ AMT_CONFIG AmtConfig; ///< AMT policy for platform code to pass to Reference Code
+} DXE_AMT_POLICY_PROTOCOL;
+
+#endif
diff --git a/ReferenceCode/ME/Protocol/AmtReadyToBoot/AmtReadyToBoot.c b/ReferenceCode/ME/Protocol/AmtReadyToBoot/AmtReadyToBoot.c
new file mode 100644
index 0000000..d23795c
--- /dev/null
+++ b/ReferenceCode/ME/Protocol/AmtReadyToBoot/AmtReadyToBoot.c
@@ -0,0 +1,31 @@
+/** @file
+ AmtReadyToBoot Protocol definitions
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include EFI_PROTOCOL_DEFINITION (AmtReadyToBoot)
+#endif
+
+EFI_GUID gAmtReadyToBootProtocolGuid = AMT_READY_TO_BOOT_PROTOCOL_GUID;
+
+EFI_GUID_STRING(&gAmtReadyToBootProtocolGuid, "AMT ReadyToBoot Protocol", "AMT ReadyToBoot Protocol")
diff --git a/ReferenceCode/ME/Protocol/AmtReadyToBoot/AmtReadyToBoot.h b/ReferenceCode/ME/Protocol/AmtReadyToBoot/AmtReadyToBoot.h
new file mode 100644
index 0000000..93e784f
--- /dev/null
+++ b/ReferenceCode/ME/Protocol/AmtReadyToBoot/AmtReadyToBoot.h
@@ -0,0 +1,56 @@
+/** @file
+ AmtReadyToBoot Protocol definitions
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _AMT_READY_TO_BOOT_PROTOCOL_H_
+#define _AMT_READY_TO_BOOT_PROTOCOL_H_
+
+///
+/// AMT Readt to Boot Protocol
+/// This protocol performs all Management Engine task
+///
+#define AMT_READY_TO_BOOT_PROTOCOL_GUID \
+ { \
+ 0x40b09b5a, 0xf0ef, 0x4627, 0x93, 0xd5, 0x27, 0xf0, 0x4b, 0x75, 0x4d, 0x5 \
+ }
+
+EFI_FORWARD_DECLARATION (AMT_READY_TO_BOOT_PROTOCOL);
+
+/**
+ Signal an event for Amt ready to boot.
+
+ @param[in] None
+
+ @retval EFI_SUCCESS Mebx launched or no controller
+**/
+typedef
+EFI_STATUS
+(EFIAPI *AMT_READY_TO_BOOT_PROTOCOL_SIGNAL) (
+ VOID
+ );
+
+///
+/// AMT Readt to Boot Protocol
+/// The interface functions are for Performing all Management Engine task
+///
+struct _AMT_READY_TO_BOOT_PROTOCOL {
+ AMT_READY_TO_BOOT_PROTOCOL_SIGNAL Signal; ///< Performs all Management Engine task
+};
+
+extern EFI_GUID gAmtReadyToBootProtocolGuid;
+
+#endif
diff --git a/ReferenceCode/ME/Protocol/At/At.c b/ReferenceCode/ME/Protocol/At/At.c
new file mode 100644
index 0000000..60a4c2c
--- /dev/null
+++ b/ReferenceCode/ME/Protocol/At/At.c
@@ -0,0 +1,39 @@
+/** @file
+ Defines and prototypes for the At driver.
+ This driver implements the At protocol.
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+//
+// Statements that include other files
+//
+#include "EdkIIGlueDxe.h"
+
+//
+// Include the protocol header file
+//
+#include EFI_PROTOCOL_DEFINITION (At)
+
+//
+// Protocol GUID definition
+//
+EFI_GUID gEfiAtProtocolGuid = EFI_AT_PROTOCOL_GUID;
+
+//
+// Protocol description
+//
+EFI_GUID_STRING(&gEfiAtProtocolGuid, "AT Protocol", "Intel (R) AT Protocol Services.");
diff --git a/ReferenceCode/ME/Protocol/At/At.h b/ReferenceCode/ME/Protocol/At/At.h
new file mode 100644
index 0000000..39a8dbd
--- /dev/null
+++ b/ReferenceCode/ME/Protocol/At/At.h
@@ -0,0 +1,247 @@
+/** @file
+ Defines and prototypes for the AT driver.
+ This driver implements the AT protocol.
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#ifndef _DXE_AT_PROTOCOL_H_
+#define _DXE_AT_PROTOCOL_H_
+#include "MkhiMsgs.h"
+///
+/// Define the protocol GUID
+///
+#define EFI_AT_PROTOCOL_GUID \
+ { \
+ 0x2df8cdbe, 0x79ce, 0x48a0, 0x8c, 0x59, 0x50, 0xf7, 0x1d, 0xe1, 0xad, 0xd1 \
+ }
+
+///
+/// Protocol revision number
+/// Any backwards compatible changes to this protocol will result in an update in the revision number
+/// Major changes will require publication of a new protocol
+///
+#define AT_PROTOCOL_REVISION 1
+
+//
+// Extern the GUID for protocol users.
+//
+extern EFI_GUID gEfiAtProtocolGuid;
+
+//
+// Forward reference for ANSI C compatibility
+//
+EFI_FORWARD_DECLARATION (EFI_AT_PROTOCOL);
+
+//
+// Protocol definitions
+//
+
+/**
+ This function sends a request to ME AT Services to validate AT
+ recovery credentials. The user input is captured in UTF-16
+ format and then passed to this funtion. This function converts
+ the User recovery password into a HASH by using Salt & Nonce
+ and then send the password HASH to ME AT Services for
+ validation. ME AT Service compares the Password HASH and
+ returns either pass or fail.
+
+ @param[in] This The address of protocol
+ @param[in] PassPhrase Passphrase that needs to be authenticated sent to ME
+ @param[in] PassType Password type user or server generated
+ @param[in][out] IsAuthenticated The return of the password match 1 for success and 0 for fail
+
+ @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary data structures
+ @retval EFI_SUCCESS The function completed successfully
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_AT_AUTHETICATE_CREDENTIAL) (
+ IN EFI_AT_PROTOCOL *This,
+ IN UINT8 *PassPhrase,
+ IN UINT32 *PassType,
+ IN OUT UINT8 *IsAuthenticated
+ );
+
+/**
+ This API compute the SHA1 hash of the user enterted password
+
+ @param[in] This The address of protocol
+ @param[in] PassPhrase The passphrase for which SHA1 hash to be computed
+ @param[in][out] Hash The return value of the SHA1 hash
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_AT_COMPUTE_HASH) (
+ IN EFI_AT_PROTOCOL *This,
+ IN UINT8 *PassPhrase,
+ IN OUT UINT8 *Hash
+ );
+
+/**
+ This gets the ME nonce
+ @param[in] This The address of protocol
+ @param[in][out] Nonce The return value of the 16 Byte nonce received from ME
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_AT_GET_NONCE) (
+ IN EFI_AT_PROTOCOL *This,
+ IN OUT UINT8 *Nonce
+ );
+
+/**
+ This API get the AT Unlock Timer values
+
+ @param[in] This The address of protocol
+ @param[in] Interval The return value of the Unlock Time Interval that was set by AT Server
+ @param[in] TimeLeft The Timeleft in the Unlock Timer
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_AT_GET_TIMER_INFO) (
+ IN EFI_AT_PROTOCOL *This,
+ IN OUT UINT32 *Interval,
+ IN OUT UINT32 *TimeLeft
+ );
+
+/**
+ This retrives the ISV String stored by AT Server that BIOS will display during Platform lock state
+
+ @param[in] This The address of protocol
+ @param[in] StringId The String buffer ID to retrive the ISV String
+ @param[out] IsvString 256 Bytes of ISV string array, the
+ @param[out] IsvStringLength The String length
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_AT_GET_RECOVERY_STRING) (
+ IN EFI_AT_PROTOCOL *This,
+ IN UINT32 *StringId,
+ IN OUT UINT8 *IsvString,
+ IN OUT UINT32 *IsvStringLength
+ );
+
+/**
+ This receives the ISV ID from ME and display the ID, when the platform is in stolen state
+
+ @param[in] This The address of protocol
+ @param[out] IsvId The pointer to 4 byte ISV ID
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/typedef
+EFI_STATUS
+(EFIAPI *EFI_AT_GET_ISV_ID) (
+ IN EFI_AT_PROTOCOL *This,
+ IN OUT UINT32 *IsvId
+ );
+
+/**
+ This instructs FW that a WWAN recovery is desired and thus the Radio needs to be initialized.
+
+ This command in not supported.
+
+ @param[in] This The address of protocol
+**/typedef
+EFI_STATUS
+(EFIAPI *EFI_AT_SET_SUSPEND_STATE) (
+ IN EFI_AT_PROTOCOL *This,
+ IN UINT32 TransitionState,
+ IN UINT8 *Token
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_AT_INIT_WWAN_RECOV) (
+ IN EFI_AT_PROTOCOL *This
+ );
+
+/**
+ This queries FW of the NIC Radio Status
+
+ This command in not supported.
+
+ @param[in] This The address of protocol
+ @param[in] RadioStatus Radio status
+ @param[in] NetworkStatus Network status
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_AT_GET_WWAN_NIC_STATUS) (
+ IN EFI_AT_PROTOCOL *This,
+ IN OUT UINT8 *RadioStatus,
+ IN OUT UINT8 *NetworkStatus
+ );
+
+/**
+ This send an AssertStolen Message to ME when OEM has set the AllowAssertStolen bit to be accepted by BIOS.
+
+ @param[in] This The address of protocol
+ @param[out] CompletionCode The return ME Firmware return code for this request
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_AT_SEND_ASSERT_STOLEN) (
+ IN EFI_AT_PROTOCOL *This,
+ IN OUT UINT8 *CompletionCode
+ );
+
+/**
+ This queries FW of the AT Status in Unsigned mode
+
+ @param[in] This The address of protocol
+ @param[out] StateUnsigned Structure retrieved from ME describing current AT state
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_AT_GET_STATE_UNSIGNED) (
+ IN EFI_AT_PROTOCOL *This,
+ IN OUT AT_STATE_INFO *StateUnsigned
+ );
+
+///
+/// Protocol definition
+///
+struct _EFI_AT_PROTOCOL {
+ UINT8 Revision;
+ EFI_AT_AUTHETICATE_CREDENTIAL AuthenticateCredential;
+ EFI_AT_COMPUTE_HASH ComputeHash;
+ EFI_AT_GET_NONCE GetNonce;
+ EFI_AT_GET_TIMER_INFO GetTimerInfo;
+ EFI_AT_GET_RECOVERY_STRING GetRecoveryString;
+ EFI_AT_GET_ISV_ID GetIsvId;
+ EFI_AT_SEND_ASSERT_STOLEN SendAssertStolen;
+ EFI_AT_SET_SUSPEND_STATE SetSuspendState;
+ EFI_AT_INIT_WWAN_RECOV InitWWAN;
+ EFI_AT_GET_WWAN_NIC_STATUS GetWWANNicStatus;
+ EFI_AT_GET_STATE_UNSIGNED GetStateUnsigned;
+};
+
+#endif
diff --git a/ReferenceCode/ME/Protocol/AtAm/ATAM.c b/ReferenceCode/ME/Protocol/AtAm/ATAM.c
new file mode 100644
index 0000000..04d86ee
--- /dev/null
+++ b/ReferenceCode/ME/Protocol/AtAm/ATAM.c
@@ -0,0 +1,40 @@
+/** @file
+ Defines AtAm protocol.
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights
+ reserved This software and associated documentation (if any)
+ is furnished under a license and may only be used or copied in
+ accordance with the terms of the license. Except as permitted
+ by such license, no part of this software or documentation may
+ be reproduced, stored in a retrieval system, or transmitted in
+ any form or by any means without the express written consent
+ of Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+//
+// Statements that include other files
+//
+#include "EdkIIGlueDxe.h"
+
+//
+// Include the protocol header file
+//
+#include EFI_PROTOCOL_DEFINITION (AtAm)
+
+//
+// Protocol GUID definition
+//
+EFI_GUID gEfiAtAmProtocolGuid = EFI_ATAM_PROTOCOL_GUID;
+
+//
+// Protocol description
+//
+EFI_GUID_STRING(&gEfiAtAmProtocolGuid, "AtAm Protocol", "Intel (R) AtAm Protocol Services.");
diff --git a/ReferenceCode/ME/Protocol/AtAm/ATAM.h b/ReferenceCode/ME/Protocol/AtAm/ATAM.h
new file mode 100644
index 0000000..5d75f33
--- /dev/null
+++ b/ReferenceCode/ME/Protocol/AtAm/ATAM.h
@@ -0,0 +1,249 @@
+/** @file
+ Header file for ATAM
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _DXE_ATAM_PROTOCOL_H_
+#define _DXE_ATAM_PROTOCOL_H_
+
+#include "MkhiMsgs.h"
+
+///
+/// Define the protocol GUID
+///
+#define EFI_ATAM_PROTOCOL_GUID \
+ { \
+ 0x8aebaa5a, 0x556f, 0x404b, 0x96, 0x05, 0x38, 0xe0, 0xde, 0x29, 0x76, 0x2f \
+ }
+
+//
+// Extern the GUID for protocol users.
+//
+extern EFI_GUID gEfiAtProtocolGuid;
+
+#define ATAM_PROTOCOL_REVISION 3
+
+//
+// Forward reference for ANSI C compatibility
+//
+
+#define ISV_PLATFORM_ID_LENGTH 16
+#define SERVER_SHORTCODE_LENGTH 16
+#define DEFAULT_LANGUAGE_STRING 4
+
+//
+// Forward reference for ANSI C compatibility
+//
+EFI_FORWARD_DECLARATION (EFI_ATAM_PROTOCOL);
+
+#pragma pack(1)
+typedef struct {
+
+ UINT8 BiosLanguageSupport[DEFAULT_LANGUAGE_STRING];
+ UINT8 Reserved[2];
+
+ ///
+ /// Defines the number which will be used by BIOS before making BIOS AM as a
+ /// default recovery mechanism
+ ///
+ UINT16 PbaOverRideThreshold;
+
+ ///
+ /// The value used by BIOS to try sending GPS location when AT stolen
+ ///
+ UINT8 BiosLocationBeconing;
+
+ ///
+ /// This will be used for Notebook transfer authorization request
+ ///
+ UINT8 PlatformAuthReq;
+
+ ///
+ /// This will be used for Notebook transfer authorization acknowledgement
+ ///
+ UINT8 PlatformAuthAck;
+
+ ///
+ /// This will be used for AT Server short code
+ ///
+ UINT8 ServerShortCode[SERVER_SHORTCODE_LENGTH];
+
+ ///
+ /// This allow ISV to set unique platform ID and will be used for displayed on need basis
+ ///
+ UINT16 IsvPlatformId[ISV_PLATFORM_ID_LENGTH];
+
+} AT_BIOS_RECOVERY_CONFIG;
+#pragma pack()
+
+///
+/// Protocol definitions
+///
+
+/**
+ This function gets the ISV Strings stored by AT Server that BIOS will display.
+
+ @param[in] This The address of protocol
+ @param[out] IsvString Isv string pointer
+ @param[out] IsvId Intel(R) Anti-Theft service provider Id
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_ATAM_GET_ISV_ID) (
+ IN EFI_ATAM_PROTOCOL *This,
+ OUT UINT8 *IsvString,
+ OUT UINT32 *IsvId
+ );
+
+/**
+ This function gets recovery config.
+
+ @param[in] This The address of protocol
+ @param[out] RecoveryConfig Pointer to structure
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_ATAM_GET_RECOVERY_CONFIG) (
+ IN EFI_ATAM_PROTOCOL *This,
+ OUT AT_BIOS_RECOVERY_CONFIG *RecoveryConfig
+ );
+
+/**
+ This function returns time left to enter password.
+
+ @param[in] This The address of protocol
+ @param[out] TimeLeft Time
+ @param[out] TimeInterval Time interval
+
+ @retval EFI_SUCCESS The function completed
+ successfully.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_ATAM_GET_TIMER) (
+ IN EFI_ATAM_PROTOCOL *This,
+ OUT UINT32 *TimeLeft,
+ OUT UINT32 *TimeInterval
+ );
+
+/**
+ This function gets 16 bytes nonce from firmware and also converts it to string according to format "XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XX".
+
+ @param[in] This The address of protocol
+ @param[out] NonceStr Pointer to Nonce string
+
+ @retval EFI_SUCCESS The function completed
+ successfully.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_ATAM_GET_NONCE) (
+ IN EFI_ATAM_PROTOCOL *This,
+ OUT UINT8 *NonceStr
+ );
+
+/**
+ This routine receives the data (passphrase or SRTK) from UI and verifies it if the password (either passphrase or SRTK) is acceptable.
+
+ @param[in] This The address of protocol
+ @param[in] PasswordEntered Pointer to string
+ @param[in] PassType Password type
+ @param[out] IsAuthenticated Pointer to result of verification
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_ATAM_VERIFY_PASSWORD) (
+ IN EFI_ATAM_PROTOCOL *This,
+ IN UINT8 *PasswordEntered,
+ IN UINT32 PassType,
+ OUT UINT8 *IsAuthenticated
+ );
+
+/**
+ This routine receives the SRTK from UI and verifies it if the password is acceptable. This requests FW to enter or exit Suspend mode based on user input.
+
+ @param[in] This The address of protocol
+ @param[in] TransitionState 1- enter suspend state, 0 - exit suspend state
+ @param[in] Token Pointer to token
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_ATAM_SET_SUSPEND_STATE) (
+ IN EFI_ATAM_PROTOCOL *This,
+ IN UINT32 TransitionState,
+ IN UINT8 *Token
+ );
+
+/**
+ This routine gets AT state.
+
+ @param[in] This The address of protocol
+ @param[out] AtStateInfo State of AT
+
+ @retval EFI_SUCCESS The function completed
+ successfully.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_ATAM_GET_AT_STATE_INFO) (
+ IN EFI_ATAM_PROTOCOL *This,
+ OUT AT_STATE_INFO *AtStateInfo
+ );
+
+/**
+ This routine gets PBA failed count value.
+
+ @param[out] PbaFailedExceeded TRUE when the PbaOverrideThreshold is exceeded
+ @param[out] PbaFailedAttempts Number of failed attempts
+ @param[out] PbaFailedThreshold Pba failed count treshold
+
+ @retval EFI_SUCCESS The function completed
+ successfully.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_ATAM_GET_PBA_COUNTER) (
+ OUT UINT8* PbaFailedExceeded,
+ OUT UINT16* PbaFailedAttempts,
+ OUT UINT16* PbaFailedThreshold
+ );
+
+///
+/// Protocol definition
+///
+struct _EFI_ATAM_PROTOCOL {
+ UINT8 Revision;
+ EFI_ATAM_GET_ISV_ID AtAmGetIsvId;
+ EFI_ATAM_GET_RECOVERY_CONFIG AtAmGetRecoveryConfig;
+ EFI_ATAM_GET_TIMER AtAmGetTimer;
+ EFI_ATAM_GET_NONCE AtAmGetNonce;
+ EFI_ATAM_VERIFY_PASSWORD AtAmVerifyPassword;
+ EFI_ATAM_SET_SUSPEND_STATE AtAmSetSuspendState;
+ EFI_ATAM_GET_AT_STATE_INFO AtAmGetAtStateInfo;
+ EFI_ATAM_GET_PBA_COUNTER AtAmGetPbaCounter;
+};
+
+#endif
diff --git a/ReferenceCode/ME/Protocol/AtAm/AtAm.cif b/ReferenceCode/ME/Protocol/AtAm/AtAm.cif
new file mode 100644
index 0000000..bd47708
--- /dev/null
+++ b/ReferenceCode/ME/Protocol/AtAm/AtAm.cif
@@ -0,0 +1,9 @@
+<component>
+ name = "ATAM Protocol"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Me\Protocol\AtAm"
+ RefName = "ATAMProtocols"
+[files]
+"ATAM.h"
+"ATAM.c"
+<endComponent>
diff --git a/ReferenceCode/ME/Protocol/AtPlatformPolicy/AtPlatformPolicy.c b/ReferenceCode/ME/Protocol/AtPlatformPolicy/AtPlatformPolicy.c
new file mode 100644
index 0000000..98e0c9d
--- /dev/null
+++ b/ReferenceCode/ME/Protocol/AtPlatformPolicy/AtPlatformPolicy.c
@@ -0,0 +1,43 @@
+/** @file
+ This driver implements the AT Platform Policy protocol.
+
+@copyright
+ Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+//
+// Statements that include other files
+//
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+//
+// Include the protocol header file
+//
+#include EFI_PROTOCOL_DEFINITION (AtPlatformPolicy)
+#endif
+//
+// Protocol GUID definition
+//
+EFI_GUID gDxePlatformAtPolicyGuid = DXE_PLATFORM_AT_POLICY_GUID;
+
+//
+// Protocol description
+//
+EFI_GUID_STRING
+ (&gDxePlatformAtPolicyGuid, "AtPlatformPolicy Protocol", "Intel(R) DXE Phase At Platform Policy Protocol");
diff --git a/ReferenceCode/ME/Protocol/AtPlatformPolicy/AtPlatformPolicy.h b/ReferenceCode/ME/Protocol/AtPlatformPolicy/AtPlatformPolicy.h
new file mode 100644
index 0000000..9cf00d7
--- /dev/null
+++ b/ReferenceCode/ME/Protocol/AtPlatformPolicy/AtPlatformPolicy.h
@@ -0,0 +1,57 @@
+/** @file
+ This driver implements the AT Platform Policy protocol.
+
+@copyright
+ Copyright (c) 2004 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _DXE_AT_PLATFORM_POLICY_H_
+#define _DXE_AT_PLATFORM_POLICY_H_
+
+///
+/// AT policy provided by platform for DXE phase
+///
+#define DXE_PLATFORM_AT_POLICY_GUID \
+ { \
+ 0x3f4ea4d4, 0xb465, 0x4f3f, 0x9c, 0x92, 0xb3, 0x40, 0xab, 0x58, 0x96, 0xb5 \
+ }
+
+///
+/// Protocol revision number
+/// Any backwards compatible changes to this protocol will result in an update in the revision number
+/// Major changes will require publication of a new protocol
+///
+#define DXE_PLATFORM_AT_POLICY_PROTOCOL_REVISION_1 1
+#define DXE_PLATFORM_AT_POLICY_PROTOCOL_REVISION_2 2
+
+extern EFI_GUID gDxePlatformAtPolicyGuid;
+#pragma pack(1)
+typedef struct {
+ UINT8 AtAmBypass; ///< Byte 0, bit definition for functionality enable/disable
+ UINT8 AtEnterSuspendState;
+ UINT8 AtSupported;
+ UINT8 AtPba;
+ UINT8 ByteReserved[28]; ///< Bytes 4-31 Reserved and make AT_CONFIG as 32 bit alignment
+} AT_CONFIG;
+#pragma pack()
+///
+/// AMT DXE Platform Policy
+///
+typedef struct _DXE_AT_POLICY_PROTOCOL {
+ UINT8 Revision;
+ AT_CONFIG At;
+} DXE_AT_POLICY_PROTOCOL;
+#endif
diff --git a/ReferenceCode/ME/Protocol/Heci/Heci.c b/ReferenceCode/ME/Protocol/Heci/Heci.c
new file mode 100644
index 0000000..64ac0f4
--- /dev/null
+++ b/ReferenceCode/ME/Protocol/Heci/Heci.c
@@ -0,0 +1,31 @@
+/** @file
+ EFI Heci Protocol
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include EFI_PROTOCOL_DEFINITION (Heci)
+#endif
+
+EFI_GUID gEfiHeciProtocolGuid = HECI_PROTOCOL_GUID;
+
+EFI_GUID_STRING(&gEfiHeciProtocolGuid, "HECI Protocol", "EFI 2.0 HECI Protocol");
diff --git a/ReferenceCode/ME/Protocol/Heci/Heci.h b/ReferenceCode/ME/Protocol/Heci/Heci.h
new file mode 100644
index 0000000..fcb14a1
--- /dev/null
+++ b/ReferenceCode/ME/Protocol/Heci/Heci.h
@@ -0,0 +1,243 @@
+/** @file
+ EFI HECI Protocol
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+#ifndef _EFI_HECI_H
+#define _EFI_HECI_H
+
+#include "MeState.h"
+
+///
+/// HECI protocol provided for DXE phase
+/// This protocol provides an interface to communicate with Intel ME subsystem via HECI
+///
+#define HECI_PROTOCOL_GUID \
+ { \
+ 0xcfb33810, 0x6e87, 0x4284, 0xb2, 0x3, 0xa6, 0x6a, 0xbe, 0x7, 0xf6, 0xe8 \
+ }
+
+#define EFI_HECI_PROTOCOL_GUID HECI_PROTOCOL_GUID
+
+EFI_FORWARD_DECLARATION (EFI_HECI_PROTOCOL);
+
+/**
+ Function sends one messsage through the HECI circular buffer and waits
+ for the corresponding ACK message.
+
+ @param[in][out] Message Pointer to the message buffer.
+ @param[in] SendLength Length of the message in bytes.
+ @param[in][out] RecLength Length of the message response in bytes.
+ @param[in] HostAddress Address of the sending entity.
+ @param[in] MeAddress Address of the ME entity that should receive the message.
+
+ @exception EFI_SUCCESS Command succeeded
+ @exception EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @exception EFI_TIMEOUT HECI does not return the buffer before timeout
+ @exception EFI_BUFFER_TOO_SMALL Message Buffer is too small for the Acknowledge
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support send message through HECI
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HECI_SENDWACK) (
+ IN OUT UINT32 *Message,
+ IN OUT UINT32 Length,
+ IN OUT UINT32 *RecLength,
+ IN UINT8 HostAddress,
+ IN UINT8 MEAddress
+ )
+;
+
+/**
+ Read the HECI Message from Intel ME with size in Length into
+ buffer MessageBody. Set Blocking to BLOCKING and code will
+ wait until one message packet is received. When set to
+ NON_BLOCKING, if the circular buffer is empty at the time, the
+ code will not wait for the message packet.
+
+ @param[in] Blocking Used to determine if the read is BLOCKING or NON_BLOCKING.
+ @param[in][out] MessageBody Pointer to a buffer used to receive a message.
+ @param[in][out] Length Pointer to the length of the buffer on input and the length
+ of the message on return. (in bytes)
+
+ @retval EFI_SUCCESS One message packet read.
+ @retval EFI_DEVICE_ERROR Failed to initialize HECI or zero-length message packet read
+ @retval EFI_TIMEOUT HECI is not ready for communication
+ @retval EFI_BUFFER_TOO_SMALL The caller's buffer was not large enough
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HECI_READ_MESSAGE) (
+ IN UINT32 Blocking,
+ IN UINT32 *MessageBody,
+ IN OUT UINT32 *Length
+ )
+;
+
+/**
+ Function sends one messsage (of any length) through the HECI circular buffer.
+
+ @param[in] Message Pointer to the message data to be sent.
+ @param[in] Length Length of the message in bytes.
+ @param[in] HostAddress The address of the host processor.
+ @param[in] MeAddress Address of the ME subsystem the message is being sent to.
+
+ @retval EFI_SUCCESS One message packet sent.
+ @retval EFI_DEVICE_ERROR Failed to initialize HECI
+ @retval EFI_TIMEOUT HECI is not ready for communication
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support send message through HECI
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HECI_SEND_MESSAGE) (
+ IN UINT32 *Message,
+ IN UINT32 Length,
+ IN UINT8 HostAddress,
+ IN UINT8 MEAddress
+ )
+;
+
+/**
+ Reset the HECI Controller with algorithm defined in the RS -
+ Intel(R) Management Engine - Host Embedded Controller
+ Interface Hardware Programming Specification (HPS)
+ @param[in] none
+
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+ @retval EFI_SUCCESS Interface reset
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HECI_RESET) (
+ VOID
+ )
+;
+
+/**
+ Initialize the HECI Controller with algorithm defined in the
+ RS - Intel(R) Management Engine - Host Embedded Controller
+ Interface Hardware Programming Specification (HPS).
+ Determines if the HECI device is present and, if present,
+ initializes it for use by the BIOS.
+
+ @param[in] None.
+
+ @retval EFI_SUCCESS HECI device is present and initialized
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HECI_INIT) (
+ VOID
+ )
+;
+
+/**
+ Re-initialize the HECI Controller with algorithm defined in the RS - Intel(R) Management Engine
+ - Host Embedded Controller Interface Hardware Programming Specification (HPS).
+ Heci Re-initializes it for Host
+
+ @param[in] None.
+
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+ @retval EFI_STATUS Status code returned by ResetHeciInterface
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HECI_REINIT) (
+ VOID
+ )
+;
+
+/**
+ Reset Intel ME and timeout if Ready is not set after Delay timeout
+
+ @param[in] Delay Timeout value in microseconds
+
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+ @retval EFI_SUCCESS Me is ready
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HECI_RESET_WAIT) (
+ IN UINT32 Delay
+ )
+;
+
+/**
+ Get an abstract Intel ME State from Firmware Status Register.
+ This is used to control BIOS flow for different Intel ME
+ functions.
+ The ME status information is obtained by sending HECI messages
+ to Intel ME and is used both by the platform code and
+ reference code. This will optimize boot time because system
+ BIOS only sends each HECI message once. It is recommended to
+ send the HECI messages to Intel ME only when ME mode is normal
+ (Except for HMRFPO Disable Message) and ME State is NORMAL or
+ RECOVERY (Suitable for AT and Kernel Messaging only).
+
+ @param[out] MeStatus Pointer for abstract status report,
+ see MeState.h - Abstract ME status definitions.
+
+ @retval EFI_SUCCESS MeStatus copied
+ @retval EFI_INVALID_PARAMETER Pointer of MeStatus is invalid
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HECI_GET_ME_STATUS) (
+ OUT UINT32 *Status
+ )
+;
+
+/**
+ Get an abstract ME operation mode from firmware status
+ register. This is used to control BIOS flow for different
+ Intel ME functions.
+
+ @param[out] MeMode Pointer for ME Mode report,
+ see MeState.h - Abstract ME Mode definitions.
+
+ @retval EFI_SUCCESS MeMode copied
+ @retval EFI_INVALID_PARAMETER Pointer of MeMode is invalid
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HECI_GET_ME_MODE) (
+ OUT UINT32 *Mode
+ )
+;
+
+///
+/// HECI protocol provided for DXE phase
+/// The interface functions are for sending/receiving HECI messages between host and Intel ME subsystem.
+/// There is also support to control HECI Initialization and get Intel ME status.
+///
+struct _EFI_HECI_PROTOCOL {
+ EFI_HECI_SENDWACK SendwACK; ///< Send HECI message and wait for respond
+ EFI_HECI_READ_MESSAGE ReadMsg; ///< Receive HECI message
+ EFI_HECI_SEND_MESSAGE SendMsg; ///< Send HECI message
+ EFI_HECI_RESET ResetHeci; ///< Reset HECI device
+ EFI_HECI_INIT InitHeci; ///< Initialize HECI device
+ EFI_HECI_RESET_WAIT MeResetWait; ///< Intel ME Reset Wait Timer
+ EFI_HECI_REINIT ReInitHeci; ///< Re-initialize HECI
+ EFI_HECI_GET_ME_STATUS GetMeStatus; ///< Get Intel ME Status register
+ EFI_HECI_GET_ME_MODE GetMeMode; ///< Get Intel ME mode
+};
+
+extern EFI_GUID gEfiHeciProtocolGuid;
+
+#endif // _EFI_HECI_H
diff --git a/ReferenceCode/ME/Protocol/HeciSmm/HeciSmm.c b/ReferenceCode/ME/Protocol/HeciSmm/HeciSmm.c
new file mode 100644
index 0000000..cd28c0e
--- /dev/null
+++ b/ReferenceCode/ME/Protocol/HeciSmm/HeciSmm.c
@@ -0,0 +1,40 @@
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+/*++
+
+Copyright (c) 1999 - 2010 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ HeciSmm.c
+
+Abstract:
+
+ SMM Heci Protocol
+Revision History
+
+--*/
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include EFI_PROTOCOL_DEFINITION (HeciSmm)
+#endif
+
+EFI_GUID gSmmHeciProtocolGuid = SMM_HECI_PROTOCOL_GUID;
+
+EFI_GUID_STRING(&gSmmHeciProtocolGuid, "SMM HECI Protocol", "EFI 2.0 SMM HECI Protocol");
diff --git a/ReferenceCode/ME/Protocol/HeciSmm/HeciSmm.h b/ReferenceCode/ME/Protocol/HeciSmm/HeciSmm.h
new file mode 100644
index 0000000..667a1fb
--- /dev/null
+++ b/ReferenceCode/ME/Protocol/HeciSmm/HeciSmm.h
@@ -0,0 +1,122 @@
+/*++
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+--*/
+/*++
+
+Copyright (c) 2010 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ HeciSmm.h
+
+Abstract:
+
+ SMM HECI Protocol
+
+--*/
+#ifndef _SMM_HECI_H
+#define _SMM_HECI_H
+
+#include "MeState.h"
+
+#define SMM_HECI_PROTOCOL_GUID \
+ { \
+ 0xFC9A50C1, 0x8B3D, 0x40D0, 0x99, 0x12, 0x6E, 0x26, 0xD7, 0x89, 0x6C, 0xBA \
+ }
+//- 0x826824b6, 0xcc9b, 0x4d62, 0x8e, 0x7a, 0xf, 0xfb, 0xf6, 0x1, 0x3c, 0xbe
+#define AMI_HECI_SMM_GUID \
+ { \
+ 0xFC9A50C1, 0x8B3D, 0x40D0, 0x99, 0x12, 0x6E, 0x26, 0xD7, 0x89, 0x6C, 0xBA \
+ }
+
+
+EFI_FORWARD_DECLARATION (SMM_HECI_PROTOCOL);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HECI_SENDWACK) (
+ IN OUT UINT32 *Message,
+ IN OUT UINT32 Length,
+ IN OUT UINT32 *RecLength,
+ IN UINT8 HostAddress,
+ IN UINT8 MEAddress
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HECI_READ_MESSAGE) (
+ IN UINT32 Blocking,
+ IN UINT32 *MessageBody,
+ IN OUT UINT32 *Length
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HECI_SEND_MESSAGE) (
+ IN UINT32 *Message,
+ IN UINT32 Length,
+ IN UINT8 HostAddress,
+ IN UINT8 MEAddress
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HECI_RESET) (
+ VOID
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HECI_INIT) (
+ VOID
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HECI_REINIT) (
+ VOID
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HECI_RESET_WAIT) (
+ IN UINT32 Delay
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HECI_GET_ME_STATUS) (
+ IN UINT32 *Status
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_HECI_GET_ME_MODE) (
+ IN UINT32 *Mode
+ );
+
+typedef struct _SMM_HECI_PROTOCOL {
+ EFI_HECI_SENDWACK SendwACK;
+ EFI_HECI_READ_MESSAGE ReadMsg;
+ EFI_HECI_SEND_MESSAGE SendMsg;
+ EFI_HECI_RESET ResetHeci;
+ EFI_HECI_INIT InitHeci;
+ EFI_HECI_RESET_WAIT MeResetWait;
+ EFI_HECI_REINIT ReInitHeci;
+ EFI_HECI_GET_ME_STATUS GetMeStatus;
+ EFI_HECI_GET_ME_MODE GetMeMode;
+} SMM_HECI_PROTOCOL;
+
+extern EFI_GUID gSmmHeciProtocolGuid;
+
+#endif // _SMM_HECI_H
diff --git a/ReferenceCode/ME/Protocol/IderControllerDriver/IderControllerDriver.c b/ReferenceCode/ME/Protocol/IderControllerDriver/IderControllerDriver.c
new file mode 100644
index 0000000..f68b7f4
--- /dev/null
+++ b/ReferenceCode/ME/Protocol/IderControllerDriver/IderControllerDriver.c
@@ -0,0 +1,31 @@
+/** @file
+ Protocol used for IDE-R Controller Driver.
+
+@copyright
+ Copyright (c) 2005 - 2012 Intel Corporation. All rights
+ reserved This software and associated documentation (if any)
+ is furnished under a license and may only be used or copied in
+ accordance with the terms of the license. Except as permitted
+ by such license, no part of this software or documentation may
+ be reproduced, stored in a retrieval system, or transmitted in
+ any form or by any means without the express written consent
+ of Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include EFI_PROTOCOL_DEFINITION (IderControllerDriver)
+#endif
+
+EFI_GUID gEfiIderControllerDriverProtocolGuid = EFI_IDER_CONTROLLER_DRIVER_PROTOCOL_GUID;
+
+EFI_GUID_STRING(&gEfiIderControllerDriverProtocolGuid, "IDE-R Controller Driver", "EFI IDE-R Controller Driver GUID")
diff --git a/ReferenceCode/ME/Protocol/IderControllerDriver/IderControllerDriver.h b/ReferenceCode/ME/Protocol/IderControllerDriver/IderControllerDriver.h
new file mode 100644
index 0000000..05ccf4e
--- /dev/null
+++ b/ReferenceCode/ME/Protocol/IderControllerDriver/IderControllerDriver.h
@@ -0,0 +1,34 @@
+/** @file
+ IDE-R Controller Driver Protocol definitions.
+ We can specify normal IDE contorller driver and IDE-R controller by checking this GUID
+
+@copyright
+ Copyright (c) 2005 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _EFI_IDER_CONTROLLER_DRIVER_PROTOCOL_H_
+#define _EFI_IDER_CONTROLLER_DRIVER_PROTOCOL_H_
+
+///
+/// IDER Controller Driver Protocol
+/// This protocol is used in Platform BDS phase to identify IDE-R boot devices.
+///
+#define EFI_IDER_CONTROLLER_DRIVER_PROTOCOL_GUID \
+ { \
+ 0x956a2ed0, 0xa6cf, 0x409a, 0xb8, 0xf5, 0x35, 0xf1, 0x4c, 0x3e, 0x3c, 0x2 \
+ }
+
+extern EFI_GUID gEfiIderControllerDriverProtocolGuid;
+
+#endif
diff --git a/ReferenceCode/ME/Protocol/MeBiosPayloadData/MeBiosPayloadData.c b/ReferenceCode/ME/Protocol/MeBiosPayloadData/MeBiosPayloadData.c
new file mode 100644
index 0000000..c52ff21
--- /dev/null
+++ b/ReferenceCode/ME/Protocol/MeBiosPayloadData/MeBiosPayloadData.c
@@ -0,0 +1,43 @@
+/** @file
+ This file defines the Me Bios Payload Data Protocol which implements the
+ Intel(R) Management Engine
+
+@copyright
+ Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+//
+// Statements that include other files
+//
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+//
+// Include the protocol header file
+//
+#include EFI_PROTOCOL_DEFINITION (MeBiosPayloadData)
+#endif
+//
+// Protocol GUID definition
+//
+EFI_GUID gMeBiosPayloadDataProtocolGuid = ME_BIOS_PAYLOAD_DATA_PROTOCOL_GUID;
+
+//
+// Protocol description
+//
+EFI_GUID_STRING(&gMeBiosPayloadDataProtocolGuid, "MeBiosPayloadData Protocol", "Intel(R) DXE Phase MBP Protocol");
diff --git a/ReferenceCode/ME/Protocol/MeBiosPayloadData/MeBiosPayloadData.h b/ReferenceCode/ME/Protocol/MeBiosPayloadData/MeBiosPayloadData.h
new file mode 100644
index 0000000..4a90ebb
--- /dev/null
+++ b/ReferenceCode/ME/Protocol/MeBiosPayloadData/MeBiosPayloadData.h
@@ -0,0 +1,138 @@
+/** @file
+ Interface definition details for MBP during DXE phase.
+
+@copyright
+ Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _MBP_DATA_PROTOCOL_H_
+#define _MBP_DATA_PROTOCOL_H_
+#include "CoreBiosMsg.h"
+
+///
+/// MBP Protocol for DXE phase
+///
+#define ME_BIOS_PAYLOAD_DATA_PROTOCOL_GUID \
+ { \
+ 0x71a19494, 0x2ab6, 0x4e96, 0x85, 0x81, 0xcf, 0x34, 0x25, 0x42, 0x73, 0xfe \
+ }
+
+///
+/// Revision 1: Original version
+///
+#define DXE_MBP_DATA_PROTOCOL_REVISION_1 1
+#define DXE_MBP_DATA_PROTOCOL_REVISION_2 2
+extern EFI_GUID gMeBiosPayloadDataProtocolGuid;
+
+#pragma pack(push, 1)
+typedef struct _MBP_FW_VERSION_NAME {
+ UINT32 MajorVersion : 16;
+ UINT32 MinorVersion : 16;
+ UINT32 HotfixVersion : 16;
+ UINT32 BuildVersion : 16;
+} MBP_FW_VERSION_NAME;
+
+typedef struct _MBP_ICC_PROFILE {
+ UINT8 NumIccProfiles;
+ UINT8 IccProfileSoftStrap;
+ UINT8 IccProfileIndex;
+ UINT8 Reserved;
+ ICC_LOCK_REGS_INFO IccLockRegInfo;
+} MBP_ICC_PROFILE;
+
+typedef struct _MBP_FW_CAPS_SKU {
+ MEFWCAPS_SKU FwCapabilities;
+ BOOLEAN Available;
+} MBP_FW_CAPS_SKU;
+
+typedef struct _MBP_FW_FEATURES_STATE {
+ MEFWCAPS_SKU FwFeatures;
+ BOOLEAN Available;
+} MBP_FW_FEATURES_STATE;
+
+typedef struct _MBP_ROM_BIST_DATA {
+ UINT16 DeviceId;
+ UINT16 FuseTestFlags;
+ UINT32 UMCHID[4];
+} MBP_ROM_BIST_DATA;
+
+typedef struct _MBP_PLATFORM_KEY {
+ UINT32 Key[8];
+} MBP_PLATFORM_KEY;
+
+typedef struct _MBP_PLAT_TYPE {
+ PLATFORM_TYPE_RULE_DATA RuleData;
+ BOOLEAN Available;
+} MBP_PLAT_TYPE;
+
+typedef union _HWA_DATA {
+ UINT32 Raw;
+ struct {
+ UINT32 MediaTablePush : 1;
+ UINT32 Reserved : 31;
+ } Fields;
+} HWA_DATA;
+
+typedef struct _MBP_HWA_REQ {
+ HWA_DATA Data;
+ BOOLEAN Available;
+} MBP_HWA_REQ;
+
+typedef struct _MBP_PERF_DATA {
+ UINT32 PwrbtnMrst;
+ UINT32 MrstPltrst;
+ UINT32 PltrstCpurst;
+} MBP_PERF_DATA;
+
+typedef struct _PLAT_BOOT_PERF_DATA {
+ MBP_PERF_DATA MbpPerfData;
+ BOOLEAN Available;
+} PLAT_BOOT_PERF_DATA;
+
+typedef struct _MBP_NFC_DATA {
+ UINT32 DeviceType :2;
+ UINT32 Reserved : 29;
+ UINT32 Hide :1;
+} MBP_NFC_DATA;
+
+typedef struct _MBP_NFC_SUPPORT {
+ MBP_NFC_DATA NfcData;
+ BOOLEAN Available;
+} MBP_NFC_SUPPORT;
+
+typedef struct {
+ MBP_FW_VERSION_NAME FwVersionName;
+ MBP_FW_CAPS_SKU FwCapsSku;
+ MBP_FW_FEATURES_STATE FwFeaturesState;
+ MBP_ROM_BIST_DATA RomBistData;
+ MBP_PLATFORM_KEY PlatformKey;
+ MBP_PLAT_TYPE FwPlatType;
+ MBP_ICC_PROFILE IccProfile;
+ AT_STATE_INFO AtState;
+ UINT32 MFSIntegrity;
+ MBP_HWA_REQ HwaRequest;
+ PLAT_BOOT_PERF_DATA PlatBootPerfData;
+ MBP_NFC_SUPPORT NfcSupport;
+} ME_BIOS_PAYLOAD;
+#pragma pack(pop)
+///
+/// MBP DXE Protocol
+///
+typedef struct _DXE_MBP_DATA_PROTOCOL {
+ EFI_HANDLE Handle;
+ UINT8 Revision;
+ ME_BIOS_PAYLOAD MeBiosPayload;
+} DXE_MBP_DATA_PROTOCOL;
+
+#endif
diff --git a/ReferenceCode/ME/Protocol/MeGlobalNvsArea/MeGlobalNvsArea.c b/ReferenceCode/ME/Protocol/MeGlobalNvsArea/MeGlobalNvsArea.c
new file mode 100644
index 0000000..351c98e
--- /dev/null
+++ b/ReferenceCode/ME/Protocol/MeGlobalNvsArea/MeGlobalNvsArea.c
@@ -0,0 +1,31 @@
+/** @file
+ ME FW Global NVS Area description protocol implementation.
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Mobile Silicon Support Module" and is
+ licensed for Intel Mobile CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "EdkIIGlueDxe.h"
+
+#include "MeGlobalNvsArea.h"
+
+EFI_GUID gMeGlobalNvsAreaProtocolGuid = ME_GLOBAL_NVS_AREA_PROTOCOL_GUID;
+
+EFI_GUID_STRING
+ (
+ &gMeGlobalNvsAreaProtocolGuid, "ME Global NVS Area Protocol",
+ "Protocol describing MEFW ACPI NVS memory region used by ACPI subsystem."
+ );
diff --git a/ReferenceCode/ME/Protocol/MeGlobalNvsArea/MeGlobalNvsArea.h b/ReferenceCode/ME/Protocol/MeGlobalNvsArea/MeGlobalNvsArea.h
new file mode 100644
index 0000000..ce037a1
--- /dev/null
+++ b/ReferenceCode/ME/Protocol/MeGlobalNvsArea/MeGlobalNvsArea.h
@@ -0,0 +1,72 @@
+/** @file
+ Definition of the MEFW global NVS area protocol. This protocol
+ publishes the address and format of a global ACPI NVS buffer used as a communications
+ buffer between SMM/DXE/PEI code and ASL code.
+ @todo The format is derived from the ACPI reference code, version 0.95.
+
+ Note: Data structures defined in this protocol are not naturally aligned.
+
+@copyright
+ Copyright (c) 2012 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _ME_GLOBAL_NVS_AREA_H_
+#define _ME_GLOBAL_NVS_AREA_H_
+
+///
+/// Includes
+///
+///
+/// Forward reference for pure ANSI compatability
+///
+EFI_FORWARD_DECLARATION (ME_GLOBAL_NVS_AREA_PROTOCOL);
+
+///
+/// ME Global NVS Area Protocol GUID
+///
+#define ME_GLOBAL_NVS_AREA_PROTOCOL_GUID \
+ { \
+ 0x3bffecfd, 0xd75f, 0x4975, 0xb8, 0x88, 0x39, 0x02, 0xbd, 0x69, 0x00, 0x2b \
+ }
+
+///
+/// Extern the GUID for protocol users.
+///
+extern EFI_GUID gMeGlobalNvsAreaProtocolGuid;
+
+///
+/// Global NVS Area definition
+///
+#pragma pack(1)
+typedef struct {
+ UINT32 MeNvsRevision; ///< 000 Me NVS Protocol Revision
+ ///
+ /// PTT Solution
+ ///
+ UINT8 FTpmSwitch; /// (004) fTPM Solution Method Selection
+ ///
+ /// PTT Allocated Buffer Address
+ ///
+ UINT64 PTTAddress; /// (005) PTT Allocated Buffer Address
+
+} ME_GLOBAL_NVS_AREA;
+#pragma pack()
+///
+/// ME Global NVS Area Protocol
+///
+typedef struct _ME_GLOBAL_NVS_AREA_PROTOCOL {
+ ME_GLOBAL_NVS_AREA *Area;
+} ME_GLOBAL_NVS_AREA_PROTOCOL;
+
+#endif
diff --git a/ReferenceCode/ME/Protocol/MePlatformPolicy/MePlatformPolicy.c b/ReferenceCode/ME/Protocol/MePlatformPolicy/MePlatformPolicy.c
new file mode 100644
index 0000000..8679604
--- /dev/null
+++ b/ReferenceCode/ME/Protocol/MePlatformPolicy/MePlatformPolicy.c
@@ -0,0 +1,44 @@
+/** @file
+ This file defines the EFI ME policy Protocol which implements the
+ Intel(R) Management Engine
+
+@copyright
+ Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+//
+// Statements that include other files
+//
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+//
+// Include the protocol header file
+//
+#include EFI_PROTOCOL_DEFINITION (MePlatformPolicy)
+#endif
+//
+// Protocol GUID definition
+//
+EFI_GUID gDxePlatformMePolicyGuid = DXE_PLATFORM_ME_POLICY_GUID;
+
+//
+// Protocol description
+//
+EFI_GUID_STRING
+ (&gDxePlatformMePolicyGuid, "MePlatformPolicy Protocol", "Intel(R) DXE Phase ME Platform Policy Protocol");
diff --git a/ReferenceCode/ME/Protocol/MePlatformPolicy/MePlatformPolicy.h b/ReferenceCode/ME/Protocol/MePlatformPolicy/MePlatformPolicy.h
new file mode 100644
index 0000000..ee3ef25
--- /dev/null
+++ b/ReferenceCode/ME/Protocol/MePlatformPolicy/MePlatformPolicy.h
@@ -0,0 +1,134 @@
+/** @file
+ Interface definition details between ME and platform drivers during DXE phase.
+
+@copyright
+ Copyright (c) 2006 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _ME_PLATFORM_POLICY_H_
+#define _ME_PLATFORM_POLICY_H_
+
+///
+/// ME policy provided by platform for DXE phase
+/// This protocol provides an interface to get Intel ME Configuration information
+///
+#define DXE_PLATFORM_ME_POLICY_GUID \
+ { \
+ 0x69bf9e8a, 0x4ad6, 0x9a28, 0x87, 0xf3, 0x09, 0xa0, 0x71, 0x29, 0x2a, 0x00 \
+ }
+
+///
+/// Initial Revision
+///
+#define DXE_PLATFORM_ME_POLICY_PROTOCOL_REVISION_1 1
+///
+/// Remove MbpSecurity
+///
+#define DXE_PLATFORM_ME_POLICY_PROTOCOL_REVISION_2 2
+extern EFI_GUID gDxePlatformMePolicyGuid;
+
+#pragma pack(1)
+
+typedef struct {
+ //
+ // Byte 0, bit definition for functionality enable/disable
+ //
+ UINT8 MeFwDownGrade : 1; ///< 0: Disabled; 1: Enabled
+ UINT8 MeLocalFwUpdEnabled : 1; ///< 0: Disabled; 1: Enabled
+ UINT8 Byte0ReservedBit2 : 1;
+ UINT8 EndOfPostEnabled : 1; ///< 0: Disabled; 1: Enabled
+ UINT8 EndOfPostDone : 1; ///< 0: Not yet; 1: Done
+ UINT8 MdesCapability : 1; ///< 0: Disabled; 1: Enabled
+ UINT8 SvtForPchCap: 1; ///< 0: Disabled; 1: Enabled
+ UINT8 MdesForBiosState : 1; ///< 0: Disabled; 1: Enabled
+ UINT8 ByteReserved[15]; ///< Byte 1-15 Reserved for other bit definitions in future
+} ME_CONFIG;
+
+///
+/// ME ERROR Message ID
+///
+typedef enum {
+ MSG_EOP_ERROR = 0,
+ MSG_ME_FW_UPDATE_FAILED,
+ MSG_ASF_BOOT_DISK_MISSING,
+ MSG_KVM_TIMES_UP,
+ MSG_KVM_REJECTED,
+ MSG_HMRFPO_LOCK_FAILURE,
+ MSG_HMRFPO_UNLOCK_FAILURE,
+ MSG_ME_FW_UPDATE_WAIT,
+ MSG_ILLEGAL_CPU_PLUGGED_IN,
+ MSG_KVM_WAIT,
+ MSG_PLAT_DISABLE_WAIT,
+ MAX_ERROR_ENUM
+} ME_ERROR_MSG_ID;
+
+/**
+ Show Me Error message. This is to display localized message in
+ the console. This is used to display message strings in local
+ language. To display the message, the routine will check the
+ message ID and ConOut the message strings. For example, the
+ End of Post error displayed in English will be:
+ gST->ConOut->OutputString (gST->ConOut, L"Error sending End Of
+ Post message to ME\n"); It is recommended to clear the screen
+ before displaying the error message and keep the message on
+ the screen for several seconds.
+ A sample is provided, see ShowMeReportError () to retrieve
+ details.
+
+ @param[in] MsgId Me error message ID for displaying on screen message
+
+ @retval None
+**/
+typedef
+VOID
+(EFIAPI *ME_REPORT_ERROR) (
+ IN ME_ERROR_MSG_ID MsgId
+ );
+
+typedef struct {
+ ///
+ /// This member determines the SMBIOS OEM type (0x80 to 0xFF) defined in SMBIOS
+ /// Type 14 - Group Associations structure - item type. FVI structure uses it as
+ /// SMBIOS OEM type to provide MEBx, ME FW and reference code version information
+ ///
+ UINT8 FviSmbiosType;
+} ME_MISC_CONFIG;
+
+#pragma pack()
+///
+/// ME DXE Platform Policy
+/// This protocol provides information of the current Intel ME feature selection. Information is
+/// passed from the platform code to the Intel ME Reference code using this structure. There are
+/// 2 types of information, BIOS setup option and ME status information.
+///
+typedef struct _DXE_ME_POLICY_PROTOCOL {
+ ///
+ /// Revision for the protocol structure
+ ///
+ UINT8 Revision;
+ ///
+ /// Intel ME feature selection enable/disable and firmware configuration information
+ ///
+ ME_CONFIG MeConfig;
+ ///
+ /// Support Localization for displaying on screen message
+ ///
+ ME_REPORT_ERROR MeReportError;
+ ///
+ /// Miscellaneous items
+ ///
+ ME_MISC_CONFIG MeMiscConfig;
+} DXE_ME_POLICY_PROTOCOL;
+
+#endif
diff --git a/ReferenceCode/ME/Protocol/MeProtocolLib.cif b/ReferenceCode/ME/Protocol/MeProtocolLib.cif
new file mode 100644
index 0000000..b256f15
--- /dev/null
+++ b/ReferenceCode/ME/Protocol/MeProtocolLib.cif
@@ -0,0 +1,40 @@
+<component>
+ name = "MeProtocolLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\Protocol\"
+ RefName = "MeProtocolLib"
+[files]
+"MeProtocolLib.sdl"
+"MeProtocolLib.mak"
+"MeProtocolLib.inf"
+"ActiveManagement\ActiveManagement.c"
+"ActiveManagement\ActiveManagement.h"
+"AlertStandardFormat\AlertStandardFormat.c"
+"AlertStandardFormat\AlertStandardFormat.h"
+"AmtPlatformPolicy\AmtPlatformPolicy.c"
+"AmtPlatformPolicy\AmtPlatformPolicy.h"
+"AmtReadyToBoot\AmtReadyToBoot.c"
+"AmtReadyToBoot\AmtReadyToBoot.h"
+"At\At.c"
+"At\At.h"
+"AtPlatformPolicy\AtPlatformPolicy.c"
+"AtPlatformPolicy\AtPlatformPolicy.h"
+"Heci\Heci.c"
+"Heci\Heci.h"
+"IderControllerDriver\IderControllerDriver.c"
+"IderControllerDriver\IderControllerDriver.h"
+"MeBiosPayloadData\MeBiosPayloadData.c"
+"MeBiosPayloadData\MeBiosPayloadData.h"
+"MebxProtocol\MebxProtocol.c"
+"MebxProtocol\MebxProtocol.h"
+"MePlatformPolicy\MePlatformPolicy.c"
+"MePlatformPolicy\MePlatformPolicy.h"
+"MeRcInfo\MeRcInfo.c"
+"MeRcInfo\MeRcInfo.h"
+"PlatformMeHook\PlatformMeHook.c"
+"PlatformMeHook\PlatformMeHook.h"
+"HeciSmm\HeciSmm.c"
+"HeciSmm\HeciSmm.h"
+"MeGlobalNvsArea\MeGlobalNvsArea.c"
+"MeGlobalNvsArea\MeGlobalNvsArea.h"
+<endComponent>
diff --git a/ReferenceCode/ME/Protocol/MeProtocolLib.inf b/ReferenceCode/ME/Protocol/MeProtocolLib.inf
new file mode 100644
index 0000000..f6b6590
--- /dev/null
+++ b/ReferenceCode/ME/Protocol/MeProtocolLib.inf
@@ -0,0 +1,73 @@
+## @file
+# Component description file for the Me protocol library
+#
+#@copyright
+# Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = MeProtocolLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ ActiveManagement/ActiveManagement.h
+ ActiveManagement/ActiveManagement.c
+ AlertStandardFormat/AlertStandardFormat.h
+ AlertStandardFormat/AlertStandardFormat.c
+ AmtPlatformPolicy/AmtPlatformPolicy.h
+ AmtPlatformPolicy/AmtPlatformPolicy.c
+ Heci/Heci.h
+ Heci/Heci.c
+ IderControllerDriver/IderControllerDriver.h
+ IderControllerDriver/IderControllerDriver.c
+ MePlatformPolicy/MePlatformPolicy.h
+ MePlatformPolicy/MePlatformPolicy.c
+ PlatformMeHook/PlatformMeHook.h
+ PlatformMeHook/PlatformMeHook.c
+ MeRcInfo/MeRcInfo.h
+ MeRcInfo/MeRcInfo.c
+ MebxProtocol/MebxProtocol.c
+ MebxProtocol/MebxProtocol.h
+ AmtReadyToBoot/AmtReadyToBoot.h
+ AmtReadyToBoot/AmtReadyToBoot.c
+ MeBiosPayloadData/MeBiosPayloadData.h
+ MeBiosPayloadData/MeBiosPayloadData.c
+ AtPlatformPolicy/AtPlatformPolicy.h
+ AtPlatformPolicy/AtPlatformPolicy.c
+ At/At.c
+ At/At.h
+ MeGlobalNvsArea/MeGlobalNvsArea.h
+ MeGlobalNvsArea/MeGlobalNvsArea.c
+
+[includes.common]
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/Include
+
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[nmake.common]
+C_STD_INCLUDE=
diff --git a/ReferenceCode/ME/Protocol/MeProtocolLib.mak b/ReferenceCode/ME/Protocol/MeProtocolLib.mak
new file mode 100644
index 0000000..c8ebec3
--- /dev/null
+++ b/ReferenceCode/ME/Protocol/MeProtocolLib.mak
@@ -0,0 +1,43 @@
+# /*++
+# Copyright (c) 2009 Intel Corporation. All rights reserved.
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+# --*/
+# MAK file for the ModulePart:MeProtocolLib
+all : MeProtocolLib
+
+$(MeProtocolLib_LIB): MeProtocolLib
+
+MeProtocolLib : $(BUILD_DIR)\MeProtocolLib.mak MeProtocolLibBin
+
+$(BUILD_DIR)\MeProtocolLib.mak : $(MeProtocolLib_DIR)\$(@B).cif $(MeProtocolLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(MeProtocolLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+MeProtocolLib_INCLUDES=\
+ $(EDK_INCLUDES) \
+ $(EdkIIGlueLib_INCLUDES) \
+ $(ME_INCLUDES)
+
+MeProtocolLibBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\MeProtocolLib.mak all\
+ "MY_INCLUDES=$(MeProtocolLib_INCLUDES)" \
+ TYPE=LIBRARY \
+#**********************************************************************
+#**********************************************************************
+#** **
+#** (C)Copyright 1985-2006, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 6145-F Northbelt Pkwy, Norcross, GA 30071 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#**********************************************************************
+#********************************************************************** \ No newline at end of file
diff --git a/ReferenceCode/ME/Protocol/MeProtocolLib.sdl b/ReferenceCode/ME/Protocol/MeProtocolLib.sdl
new file mode 100644
index 0000000..ca3d3c3
--- /dev/null
+++ b/ReferenceCode/ME/Protocol/MeProtocolLib.sdl
@@ -0,0 +1,28 @@
+TOKEN
+ Name = "MeProtocolLib_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable MeProtocolLib support in Project"
+ TokenType = Boolean
+ TargetMAK = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "MeProtocolLib_DIR"
+End
+
+MODULE
+ Help = "Includes MeProtocolLib.mak to Project"
+ File = "MeProtocolLib.mak"
+End
+
+ELINK
+ Name = "MeProtocolLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\MeProtocolLib.lib"
+ Parent = "MeProtocolLib_LIB"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/ME/Protocol/MeRcInfo/MeRcInfo.c b/ReferenceCode/ME/Protocol/MeRcInfo/MeRcInfo.c
new file mode 100644
index 0000000..0dedc85
--- /dev/null
+++ b/ReferenceCode/ME/Protocol/MeRcInfo/MeRcInfo.c
@@ -0,0 +1,43 @@
+/** @file
+
+@brief
+ This file defines the Me Info Protocol.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+//
+// Statements that include other files
+//
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#endif
+
+#include "MeRcInfo.h"
+
+//
+// Protocol GUID definition
+//
+EFI_GUID gEfiMeRcInfoProtocolGuid = EFI_ME_RC_INFO_PROTOCOL_GUID;
+
+//
+// Protocol description
+//
+EFI_GUID_STRING(&gEfiMeRcInfoProtocolGuid, "ME RC Info Protocol", "ME Reference Code Information Protocol");
diff --git a/ReferenceCode/ME/Protocol/MeRcInfo/MeRcInfo.h b/ReferenceCode/ME/Protocol/MeRcInfo/MeRcInfo.h
new file mode 100644
index 0000000..1862f0d
--- /dev/null
+++ b/ReferenceCode/ME/Protocol/MeRcInfo/MeRcInfo.h
@@ -0,0 +1,88 @@
+/** @file
+ This file defines the ME RC Info Protocol.
+
+@copyright
+ Copyright (c) 2011 - 2014 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _ME_RC_INFO_H_
+#define _ME_RC_INFO_H_
+
+///
+/// ME RC INFO protocol GUID
+/// This protocol provides the version information for Me RC.
+///
+#define EFI_ME_RC_INFO_PROTOCOL_GUID \
+ { \
+ 0x11fbfdfb, 0x10d2, 0x43e6, 0xb5, 0xb1, 0xb4, 0x38, 0x6e, 0xdc, 0xcb, 0x9a \
+ }
+
+//
+// Extern the GUID for protocol users.
+//
+extern EFI_GUID gEfiMeRcInfoProtocolGuid;
+
+///
+/// Revision 1: Original version
+///
+#define ME_RC_INFO_PROTOCOL_REVISION_1 1
+
+/**
+ Me Reference Code formats 0xAABBCCDD
+ DD - Build Number
+ CC - Reference Code Revision
+ BB - Reference Code Minor Version
+ AA - Reference Code Major Version
+ Example: Me Reference Code 0.7.1 should be 00 07 01 00 (0x00070100)
+**/
+#define ME_RC_VERSION 0x01090000
+#define ME_FVI_STRING "Reference Code - ME 9.0"
+#define ME_FVI_SMBIOS_TYPE 0xDD ///< Default value
+#define ME_FVI_SMBIOS_INSTANCE 0x03
+#define MEBX_RC_VERSION 0xFFFFFFFF
+#define MEBX_FVI_STRING "MEBx version"
+
+#define MEFW_VERSION \
+ { \
+ 0xFF, 0xFF, 0xFF, 0xFFFF \
+ }
+#define MEFW_FVI_STRING "ME Firmware Version"
+#define MEFW_1_5M_STRING "1.5MB SKU"
+#define MEFW_5M_STRING "5MB SKU "
+
+enum {
+ EnumMeRc = 0, ///< ME Reference Code Version
+ EnumMebx, ///< MEBx Version
+ EnumMeFw ///< ME FW Version
+} ME_FVI_INDEX;
+
+///
+/// ME RC INFO protocol
+/// This protocol provides the version information for Me RC.
+///
+typedef struct _EFI_ME_RC_INFO_PROTOCOL {
+ ///
+ /// Revision for the protocol structure
+ ///
+ UINT8 Revision;
+ /**
+ Me Reference Code formats 0xAABBCCDD
+ DD - Build Number
+ CC - Reference Code Revision
+ BB - Reference Code Minor Version
+ AA - Reference Code Major Version
+ **/
+ UINT32 RCVersion;
+} EFI_ME_RC_INFO_PROTOCOL;
+#endif
diff --git a/ReferenceCode/ME/Protocol/MebxProtocol/MebxProtocol.c b/ReferenceCode/ME/Protocol/MebxProtocol/MebxProtocol.c
new file mode 100644
index 0000000..1d81195
--- /dev/null
+++ b/ReferenceCode/ME/Protocol/MebxProtocol/MebxProtocol.c
@@ -0,0 +1,31 @@
+/** @file
+ EFI MEBx Protocol
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include EFI_PROTOCOL_DEFINITION (MebxProtocol)
+#endif
+
+EFI_GUID gEfiMebxProtocolGuid = INTEL_MEBX_PROTOCOL_GUID;
+
+EFI_GUID_STRING(&gEfiMebxProtocolGuid, "EFI MEBx Protocol", "EFI 2.1 MEBx Protocol");
diff --git a/ReferenceCode/ME/Protocol/MebxProtocol/MebxProtocol.h b/ReferenceCode/ME/Protocol/MebxProtocol/MebxProtocol.h
new file mode 100644
index 0000000..3ad33e8
--- /dev/null
+++ b/ReferenceCode/ME/Protocol/MebxProtocol/MebxProtocol.h
@@ -0,0 +1,72 @@
+/** @file
+ EFI MEBx Protocol
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _MEBX_PROTOCOL_H
+#define _MEBX_PROTOCOL_H
+
+#define MEBX_CALLBACK_INFO_SIGNATURE EFI_SIGNATURE_32 ('m', 'e', 'b', 'x')
+
+#define MEBX_CALLBACK_INFO_FROM_THIS(a) CR (a, MEBX_CALLBACK_INFO, DriverCallback, MEBX_CALLBACK_INFO_SIGNATURE)
+
+#ifndef INTEL_MEBX_PROTOCOL_GUID
+#define INTEL_MEBX_PROTOCOL_GUID \
+ { \
+ 0x01ab1829, 0xcecd, 0x4cfa, 0xa1, 0x8c, 0xea, 0x75, 0xd6, 0x6f, 0x3e, 0x74 \
+ }
+#endif
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_MEBX_API_ENTRY_POINT) (
+ IN UINT32 BiosParams,
+ OUT UINT32 *MebxReturnValue
+ );
+
+typedef struct _MEBX_VER {
+ UINT16 Major;
+ UINT16 Minor;
+ UINT16 Hotfix;
+ UINT16 Build;
+} MEBX_VER;
+
+typedef enum {
+ MEBX_GRAPHICS_AUTO = 0,
+ MEBX_GRAPHICS_640X480,
+ MEBX_GRAPHICS_800X600,
+ MEBX_GRAPHICS_1024X768
+} MEBX_GRAPHICS_MODE;
+
+typedef enum {
+ MEBX_TEXT_AUTO = 0,
+ MEBX_TEXT_80X25,
+ MEBX_TEXT_100X31
+} MEBX_TEXT_MODE;
+
+typedef struct _EFI_MEBX_PROTOCOL {
+ MEBX_VER MebxVersion;
+ EFI_MEBX_API_ENTRY_POINT CoreMebxEntry;
+} EFI_MEBX_PROTOCOL;
+
+typedef struct _MEBX_INSTANCE {
+ EFI_HANDLE Handle;
+ EFI_MEBX_PROTOCOL MebxProtocol;
+} MEBX_INSTANCE;
+
+extern EFI_GUID gEfiMebxProtocolGuid;
+
+#endif
diff --git a/ReferenceCode/ME/Protocol/PlatformMeHook/PlatformMeHook.c b/ReferenceCode/ME/Protocol/PlatformMeHook/PlatformMeHook.c
new file mode 100644
index 0000000..c34ce99
--- /dev/null
+++ b/ReferenceCode/ME/Protocol/PlatformMeHook/PlatformMeHook.c
@@ -0,0 +1,43 @@
+/** @file
+ This file defines the Platform ME Hook function
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+//
+// Statements that include other files
+//
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+//
+// Include the protocol header file
+//
+#include EFI_PROTOCOL_DEFINITION (PlatformMeHook)
+#endif
+//
+// Protocol GUID definition
+//
+EFI_GUID gPlatformMeHookProtocolGuid = PLATFORM_ME_HOOK_PROTOCOL_GUID;
+
+//
+// Protocol description
+//
+EFI_GUID_STRING
+ (&gPlatformMeHookProtocolGuid, "PlatformMeHook Protocol", "Intel(R) DXE Phase ME Platform Hook Protocol");
diff --git a/ReferenceCode/ME/Protocol/PlatformMeHook/PlatformMeHook.h b/ReferenceCode/ME/Protocol/PlatformMeHook/PlatformMeHook.h
new file mode 100644
index 0000000..eef2c47
--- /dev/null
+++ b/ReferenceCode/ME/Protocol/PlatformMeHook/PlatformMeHook.h
@@ -0,0 +1,64 @@
+/** @file
+ Interface definition details for platform hook support to ME module during DXE phase.
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _PLATFORM_ME_HOOK_H_
+#define _PLATFORM_ME_HOOK_H_
+
+///
+/// ME Hook provided by platform for DXE phase
+/// This protocol provides an interface to hook reference code by OEM.
+///
+#define PLATFORM_ME_HOOK_PROTOCOL_GUID \
+ { \
+ 0xbc52476e, 0xf67e, 0x4301, 0xb2, 0x62, 0x36, 0x9c, 0x48, 0x78, 0xaa, 0xc2 \
+ }
+
+#define PLATFORM_ME_HOOK_PROTOCOL_REVISION 1
+
+/**
+ Platform hook before BIOS sends Global Reset Heci Message to ME
+
+ @param[in] None
+
+ @retval EFI Status Code
+**/
+typedef
+EFI_STATUS
+(EFIAPI *PLATFORM_ME_HOOK_PRE_GLOBAL_RESET) (
+ VOID
+ )
+;
+
+///
+/// Platform Intel ME Hook Protocol
+/// This protocol provides an interface to hook reference code by OEM.
+///
+typedef struct _PLATFORM_ME_HOOK_PROTOCOL {
+ ///
+ /// Revision for the protocol structure
+ ///
+ UINT8 Revision;
+ ///
+ /// Function pointer for the hook called before BIOS sends Global Reset Heci Message to ME
+ ///
+ PLATFORM_ME_HOOK_PRE_GLOBAL_RESET PreGlobalReset;
+} PLATFORM_ME_HOOK_PROTOCOL;
+
+extern EFI_GUID gPlatformMeHookProtocolGuid;
+
+#endif
diff --git a/ReferenceCode/ME/Ptt/Smm/Ftpm.asl b/ReferenceCode/ME/Ptt/Smm/Ftpm.asl
new file mode 100644
index 0000000..234bb42
--- /dev/null
+++ b/ReferenceCode/ME/Ptt/Smm/Ftpm.asl
@@ -0,0 +1,447 @@
+/**************************************************************************;
+;* *;
+;* Intel Confidential *;
+;* *;
+;* Intel Corporation - ACPI Reference Code for the Haswell *;
+;* Family of Customer Reference Boards. *;
+;* *;
+;* *;
+;* Copyright (c) 2012 Intel Corporation. All rights reserved *;
+;* This software and associated documentation (if any) is furnished *;
+;* under a license and may only be used or copied in accordance *;
+;* with the terms of the license. Except as permitted by such *;
+;* license, no part of this software or documentation may be *;
+;* reproduced, stored in a retrieval system, or transmitted in any *;
+;* form or by any means without the express written consent of *;
+;* Intel Corporation. *;
+;* *;
+;* *;
+;**************************************************************************/
+/*++
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+/** @file
+ The TPM2 definition block in ACPI table for TrEE physical presence
+ and MemoryClear.
+**/
+
+DefinitionBlock (
+ "Tpm.aml",
+ "SSDT",
+ 1,
+ "Intel_",
+ "Tpm2Tabl",
+ 0x1000
+ )
+{
+ External(PTTS) // PTT Solution Method Selection
+ External(PTTB) // PTT Buffer Address
+
+ Scope (\_SB)
+ {
+ Device (TPM)
+ {
+ //
+ // Define _HID, "PNP0C31" is defined in
+ // "Secure Startup-FVE and TPM Admin BIOS and Platform Requirements"
+ //
+ Name (_HID, "MSFT0101")
+
+ //
+ // Readable name of this device, don't know if this way is correct yet
+ //
+ Name (_STR, Unicode ("TPM 2.0 Device"))
+
+ //
+ // Return the resource consumed by TPM device
+ //
+ Name (CRS, ResourceTemplate () {
+ Memory32Fixed (ReadOnly, 0xFED70000, 0x1000,PCRS)
+ })
+
+
+ Method(_CRS,0)
+ {
+ CreateDWordField (CRS, \_SB.TPM.PCRS._BAS, CBAS)
+ Store (PTTB, CBAS)
+ Return(CRS)
+ }
+
+ //
+ // Operational region for Smi port access
+ //
+ OperationRegion (SMIP, SystemIO, 0xB2, 1)
+ Field (SMIP, ByteAcc, NoLock, Preserve)
+ {
+ IOB2, 8
+ }
+
+ OperationRegion (FHCI, SystemMemory, 0xFED70000, 0x1000)
+ Field (FHCI, AnyAcc, NoLock, Preserve)
+ {
+ Offset(0x04),
+ HERR, 32,
+ Offset (0x40),
+ HCMD, 32,
+ Offset(0x44),
+ HSTS, 32,
+ }
+ //
+ // Operational region for TPM support, TPM Physical Presence and TPM Memory Clear
+ // Region Offset 0xFFFF0000 and Length 0xF0 will be fixed in C code.
+ //
+ OperationRegion (TNVS, SystemMemory, 0xFFFF0000, 0xF0)
+ Field (TNVS, AnyAcc, NoLock, Preserve)
+ {
+ PPIN, 8, // Software SMI for Physical Presence Interface
+ PPIP, 32, // Used for save physical presence paramter
+ PPRP, 32, // Physical Presence request operation response
+ PPRQ, 32, // Physical Presence request operation
+ LPPR, 32, // Last Physical Presence request operation
+ FRET, 32, // Physical Presence function return code
+ MCIN, 8, // Software SMI for Memory Clear Interface
+ MCIP, 32, // Used for save the Mor paramter
+ MORD, 32, // Memory Overwrite Request Data
+ MRET, 32 // Memory Overwrite function return code
+ }
+
+ Method (PTS, 1, Serialized)
+ {
+ //
+ // Detect Sx state for MOR, only S4, S5 need to handle
+ //
+ If (LAnd (LLess (Arg0, 6), LGreater (Arg0, 3)))
+ {
+ //
+ // Bit4 -- DisableAutoDetect. 0 -- Firmware MAY autodetect.
+ //
+ If (LNot (And (MORD, 0x10)))
+ {
+ //
+ // Triggle the SMI through ACPI _PTS method.
+ //
+ Store (0x02, MCIP)
+
+ //
+ // Triggle the SMI interrupt
+ //
+ Store (MCIN, IOB2)
+ }
+ }
+ Return (0)
+ }
+
+ Method (_STA, 0)
+ {
+ Return (0x0f)
+ }
+
+ //
+ // TCG Hardware Information
+ //
+ Method (HINF, 3, Serialized, 0, {BuffObj, PkgObj}, {UnknownObj, UnknownObj, UnknownObj}) // IntObj, IntObj, PkgObj
+ {
+ //
+ // Switch by function index
+ //
+ Switch (ToInteger(Arg1))
+ {
+ Case (0)
+ {
+ //
+ // Standard query
+ //
+ Return (Buffer () {0x03})
+ }
+ Case (1)
+ {
+ //
+ // Return failure if no TPM present
+ //
+ Name(TPMV, Package () {0x01, Package () {0x1, 0x20}})
+ if (LEqual (_STA (), 0x00))
+ {
+ Return (Package () {0x00})
+ }
+
+ //
+ // Return TPM version
+ //
+ Return (TPMV)
+ }
+ Default {BreakPoint}
+ }
+ Return (Buffer () {0})
+ }
+
+ Name(TPM2, Package (0x02){
+ Zero,
+ Zero
+ })
+
+ Name(TPM3, Package (0x03){
+ Zero,
+ Zero,
+ Zero
+ })
+
+ //
+ // TCG Physical Presence Interface
+ //
+ Method (TPPI, 3, Serialized, 0, {BuffObj, PkgObj, IntObj, StrObj}, {UnknownObj, UnknownObj, UnknownObj}) // IntObj, IntObj, PkgObj
+ {
+ //
+ // Switch by function index
+ //
+ Switch (ToInteger(Arg1))
+ {
+ Case (0)
+ {
+ //
+ // Standard query, supports function 1-8
+ //
+ Return (Buffer () {0xFF, 0x01})
+ }
+ Case (1)
+ {
+ //
+ // a) Get Physical Presence Interface Version
+ //
+ Return ("1.2")
+ }
+ Case (2)
+ {
+ //
+ // b) Submit TPM Operation Request to Pre-OS Environment
+ //
+
+ Store (DerefOf (Index (Arg2, 0x00)), PPRQ)
+ Store (0x02, PPIP)
+
+ //
+ // Triggle the SMI interrupt
+ //
+ Store (PPIN, IOB2)
+ Return (FRET)
+
+
+ }
+ Case (3)
+ {
+ //
+ // c) Get Pending TPM Operation Requested By the OS
+ //
+
+ Store (PPRQ, Index (TPM2, 0x01))
+ Return (TPM2)
+ }
+ Case (4)
+ {
+ //
+ // d) Get Platform-Specific Action to Transition to Pre-OS Environment
+ //
+ Return (2)
+ }
+ Case (5)
+ {
+ //
+ // e) Return TPM Operation Response to OS Environment
+ //
+ Store (0x05, PPIP)
+
+ //
+ // Triggle the SMI interrupt
+ //
+ Store (PPIN, IOB2)
+
+ Store (LPPR, Index (TPM3, 0x01))
+ Store (PPRP, Index (TPM3, 0x02))
+
+ Return (TPM3)
+ }
+ Case (6)
+ {
+
+ //
+ // f) Submit preferred user language (Not implemented)
+ //
+
+ Return (3)
+
+ }
+ Case (7)
+ {
+ //
+ // g) Submit TPM Operation Request to Pre-OS Environment 2
+ //
+ Store (7, PPIP)
+ Store (DerefOf (Index (Arg2, 0x00)), PPRQ)
+
+ //
+ // Triggle the SMI interrupt
+ //
+ Store (PPIN, IOB2)
+ Return (FRET)
+ }
+ Case (8)
+ {
+ //
+ // e) Get User Confirmation Status for Operation
+ //
+ Store (8, PPIP)
+ Store (DerefOf (Index (Arg2, 0x00)), PPRQ)
+
+ //
+ // Triggle the SMI interrupt
+ //
+ Store (PPIN, IOB2)
+
+ Return (FRET)
+ }
+
+ Default {BreakPoint}
+ }
+ Return (1)
+ }
+
+ Method (TMCI, 3, Serialized, 0, IntObj, {UnknownObj, UnknownObj, UnknownObj}) // IntObj, IntObj, PkgObj
+ {
+ //
+ // Switch by function index
+ //
+ Switch (ToInteger (Arg1))
+ {
+ Case (0)
+ {
+ //
+ // Standard query, supports function 1-1
+ //
+ Return (Buffer () {0x03})
+ }
+ Case (1)
+ {
+ //
+ // Save the Operation Value of the Request to MORD (reserved memory)
+ //
+ Store (DerefOf (Index (Arg2, 0x00)), MORD)
+
+ //
+ // Triggle the SMI through ACPI _DSM method.
+ //
+ Store (0x01, MCIP)
+
+ //
+ // Triggle the SMI interrupt
+ //
+ Store (MCIN, IOB2)
+ Return (MRET)
+ }
+ Default {BreakPoint}
+ }
+ Return (1)
+ }
+
+ Method (TSMI, 3, Serialized, 0, IntObj, {UnknownObj, UnknownObj, UnknownObj}) // IntObj, IntObj, PkgObj
+ {
+
+ //
+ // Operational region for TPM access
+ //
+ OperationRegion (TPMR, SystemMemory, PTTB, 0x1000)
+ Field (TPMR, AnyAcc, NoLock, Preserve)
+ {
+ Offset(0x04),
+ FERR, 32,
+ Offset(0x0c),
+ STRT, 32,
+ }
+
+ //
+ // Switch by function index
+ //
+ Switch (ToInteger (Arg1))
+ {
+ Case (0)
+ {
+ //
+ // Standard query, supports function 1-1
+ //
+ Return (Buffer () {0x03})
+ }
+ Case (1)
+ {
+ If(LEqual(PTTS, 0)) // GPDMA
+ {
+ If(LEqual(Or(And(HSTS,0x00000002),And(HSTS,0x00000001)),0x00000003))
+ {
+ //
+ // Trigger the FTPM_CMD interrupt
+ //
+ Store (0x00000001, HCMD)
+ }
+ Else
+ {
+ //Set Error Bit
+ Store(0x00000001,FERR)
+ //Clear Start Bit
+ Store(0x00000000,STRT)
+ }
+ }
+ If(LEqual(PTTS, 1)) // MSFT QFE
+ {
+ //
+ // Trigger the FTPM_CMD interrupt
+ //
+ Store (0x00000000, HCMD)
+ }
+ Return (0)
+ }
+ Default {BreakPoint}
+ }
+ Return (1)
+ }
+
+ Method (_DSM, 4, Serialized, 0, UnknownObj, {BuffObj, IntObj, IntObj, PkgObj})
+ {
+
+ //
+ // TCG Hardware Information
+ //
+ If(LEqual(Arg0, ToUUID ("cf8e16a5-c1e8-4e25-b712-4f54a96702c8")))
+ {
+ Return (HINF (Arg1, Arg2, Arg3))
+ }
+
+ //
+ // TCG Physical Presence Interface
+ //
+ If(LEqual(Arg0, ToUUID ("3dddfaa6-361b-4eb4-a424-8d10089d1653")))
+ {
+ Return (TPPI (Arg1, Arg2, Arg3))
+ }
+
+ //
+ // TCG Memory Clear Interface
+ //
+ If(LEqual(Arg0, ToUUID ("376054ed-cc13-4675-901c-4756d7f2d45d")))
+ {
+ Return (TMCI (Arg1, Arg2, Arg3))
+ }
+
+ //
+ // TPM2 ACPI Start Method
+ //
+ If(LEqual(Arg0, ToUUID ("6bbf6cab-5463-4714-b7cd-f0203c0368d4")))
+ {
+ Return (TSMI (Arg1, Arg2, Arg3))
+ }
+
+ Return (Buffer () {0})
+ }
+ }
+ }
+}
diff --git a/ReferenceCode/ME/Ptt/Smm/PttHciSmm.c b/ReferenceCode/ME/Ptt/Smm/PttHciSmm.c
new file mode 100644
index 0000000..570a554
--- /dev/null
+++ b/ReferenceCode/ME/Ptt/Smm/PttHciSmm.c
@@ -0,0 +1,847 @@
+/** @file
+ It updates TPM2 items in ACPI table and registers SMI2 callback
+ functions for TrEE physical presence, ClearMemory, and sample
+ for dTPM StartMethod.
+
+ Caution: This module requires additional review when modified.
+ This driver will have external input - variable and ACPINvs data in SMM mode.
+ This external input must be validated carefully to avoid security issue.
+
+ PhysicalPresenceCallback() and MemoryClearCallback() will receive untrusted input and do some check.
+
+@copyright
+ Copyright (c) 2012 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+#include "PttHciSmm.h"
+#include "MeAccess.h"
+#include "HeciRegs.h"
+
+EFI_GUID gTpm2AcpiTableStorageGuid = TPM2_ACPI_TABLE_STORAGE_GUID;
+EFI_GUID gEfiTrEEPhysicalPresenceGuid = EFI_TREE_PHYSICAL_PRESENCE_DATA_GUID;
+EFI_GUID gEfiMemoryOverwriteControlDataGuid = MEMORY_ONLY_RESET_CONTROL_GUID;
+EFI_GUID gEfiSmmVariableProtocolGuid = EFI_SMM_VARIABLE_PROTOCOL_GUID;
+EFI_GUID gMeGlobalNvsAreaProtocolGuid = ME_GLOBAL_NVS_AREA_PROTOCOL_GUID;
+EFI_GUID gMeSsdtAcpiTableStorageGuid = ME_SSDT_ACPI_TABLE_STORAGE_GUID;
+
+EFI_TPM2_ACPI_TABLE mTpm2AcpiTemplate = {
+ {
+ EFI_ACPI_5_0_TRUSTED_COMPUTING_PLATFORM_2_TABLE_SIGNATURE,
+ sizeof (mTpm2AcpiTemplate),
+ EFI_TPM2_ACPI_TABLE_REVISION,
+ //
+ // Compiler initializes the remaining bytes to 0
+ // These fields should be filled in in production
+ //
+ },
+ 0, // Flags
+ (EFI_PHYSICAL_ADDRESS)(UINTN)0xFFFFFFFF, // Control Area
+ EFI_TPM2_ACPI_TABLE_START_METHOD_ACPI,
+};
+
+EFI_SMM_VARIABLE_PROTOCOL *mSmmVariable;
+TCG_NVS *mTcgNvs;
+EFI_TPM2_ACPI_CONTROL_AREA mControlArea; // Smm copy, because we need cache Command & Response address
+ME_GLOBAL_NVS_AREA_PROTOCOL mMeGlobalNvsAreaProtocol;
+//<AMI_OVERRIDE> >>>
+#define EFI_SMM_RUNTIME_SERVICES_TABLE_GUID \
+ { 0x395c33fe, 0x287f, 0x413e, { 0xa0, 0x55, 0x80, 0x88, 0xc0, 0xe1, 0xd4, 0x3e } }
+
+EFI_RUNTIME_SERVICES *mRuntimeServices;
+
+EFI_STATUS
+GetSmmRtTable (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ EFI_GUID SmmRtServTableGuid = EFI_SMM_RUNTIME_SERVICES_TABLE_GUID;
+ EFI_SMM_BASE_PROTOCOL *SmmBase = NULL;
+ EFI_SMM_SYSTEM_TABLE *Smst = NULL;
+ EFI_CONFIGURATION_TABLE *Table = NULL;
+ UINTN Count = 0;
+
+ Status = gBS->LocateProtocol(
+ &gEfiSmmBaseProtocolGuid,
+ NULL,
+ &SmmBase );
+ if( EFI_ERROR(Status) ) return Status;
+
+ Status = SmmBase->GetSmstLocation( SmmBase, &Smst );
+ if( EFI_ERROR(Status) ) return Status;
+
+ Table = Smst->SmmConfigurationTable;
+ Count = Smst->NumberOfTableEntries;
+
+ mRuntimeServices = NULL;
+ for( ; Count ; --Count, ++Table )
+ {
+ if( CompareGuid( &Table->VendorGuid, &SmmRtServTableGuid ) )
+ {
+ mRuntimeServices = (EFI_RUNTIME_SERVICES*)Table->VendorTable;
+ return EFI_SUCCESS;
+ }
+ }
+
+ return EFI_NOT_FOUND;
+}
+//<AMI_OVERRIDE> <<<
+
+/**
+ Software SMI callback for TPM physical presence which is called from ACPI method.
+
+ Caution: This function may receive untrusted input.
+ Variable and ACPINvs are external input, so this function will validate
+ its data structure to be valid value.
+
+ @param[in] DispatchHandle The unique handle assigned to this handler by SmiHandlerRegister().
+ @param[in] Context Points to an optional handler context which was specified when the
+ handler was registered.
+
+ @retval EFI_SUCCESS The interrupt was handled successfully.
+**/
+EFI_STATUS
+EFIAPI
+PhysicalPresenceCallback (
+ IN EFI_HANDLE DispatchHandle,
+ IN EFI_SMM_SW_DISPATCH_CONTEXT *DispatchContext
+ )
+{
+ EFI_STATUS Status;
+ UINTN DataSize;
+ EFI_TREE_PHYSICAL_PRESENCE PpData;
+ UINT8 Flags;
+ BOOLEAN RequestConfirmed;
+
+ //
+ // Get the Physical Presence variable
+ //
+ DataSize = sizeof (EFI_TREE_PHYSICAL_PRESENCE);
+//<AMI_OVERRIDE> >>>
+ Status = mRuntimeServices->GetVariable (
+ TREE_PHYSICAL_PRESENCE_VARIABLE,
+ &gEfiTrEEPhysicalPresenceGuid,
+ NULL,
+ &DataSize,
+ &PpData
+ );
+//<AMI_OVERRIDE> <<<
+ if (EFI_ERROR (Status)) {
+ return EFI_SUCCESS;
+ }
+
+ DEBUG ((EFI_D_INFO, "[TPM2] PP callback, Parameter = %x\n", mTcgNvs->PhysicalPresence.Parameter));
+ if (mTcgNvs->PhysicalPresence.Parameter == ACPI_FUNCTION_RETURN_REQUEST_RESPONSE_TO_OS) {
+ mTcgNvs->PhysicalPresence.LastRequest = PpData.LastPPRequest;
+ mTcgNvs->PhysicalPresence.Response = PpData.PPResponse;
+ } else if ((mTcgNvs->PhysicalPresence.Parameter == ACPI_FUNCTION_SUBMIT_REQUEST_TO_BIOS)
+ || (mTcgNvs->PhysicalPresence.Parameter == ACPI_FUNCTION_SUBMIT_REQUEST_TO_BIOS_2)) {
+ if (PpData.PPRequest != mTcgNvs->PhysicalPresence.Request) {
+ PpData.PPRequest = (UINT8) mTcgNvs->PhysicalPresence.Request;
+ DataSize = sizeof (EFI_TREE_PHYSICAL_PRESENCE);
+//<AMI_OVERRIDE> >>>
+ Status = mRuntimeServices->SetVariable (
+ TREE_PHYSICAL_PRESENCE_VARIABLE,
+ &gEfiTrEEPhysicalPresenceGuid,
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
+ DataSize,
+ &PpData
+ );
+//<AMI_OVERRIDE> <<<
+ }
+
+ if (EFI_ERROR (Status)) {
+ mTcgNvs->PhysicalPresence.ReturnCode = PP_SUBMIT_REQUEST_GENERAL_FAILURE;
+ return EFI_SUCCESS;
+ }
+ mTcgNvs->PhysicalPresence.ReturnCode = PP_SUBMIT_REQUEST_SUCCESS;
+ } else if (mTcgNvs->PhysicalPresence.Parameter == ACPI_FUNCTION_GET_USER_CONFIRMATION_STATUS_FOR_REQUEST) {
+ Flags = PpData.Flags;
+ RequestConfirmed = FALSE;
+
+ switch (mTcgNvs->PhysicalPresence.Request) {
+
+ case TREE_PHYSICAL_PRESENCE_CLEAR_CONTROL_CLEAR:
+ case TREE_PHYSICAL_PRESENCE_CLEAR_CONTROL_CLEAR_2:
+ case TREE_PHYSICAL_PRESENCE_CLEAR_CONTROL_CLEAR_3:
+ case TREE_PHYSICAL_PRESENCE_CLEAR_CONTROL_CLEAR_4:
+ if ((Flags & TREE_FLAG_NO_PPI_CLEAR) != 0) {
+ RequestConfirmed = TRUE;
+ }
+ break;
+
+ case TREE_PHYSICAL_PRESENCE_SET_NO_PPI_CLEAR_FALSE:
+ RequestConfirmed = TRUE;
+ break;
+
+ case TREE_PHYSICAL_PRESENCE_SET_NO_PPI_CLEAR_TRUE:
+ break;
+
+ default:
+ if (mTcgNvs->PhysicalPresence.Request <= TREE_PHYSICAL_PRESENCE_NO_ACTION_MAX) {
+ RequestConfirmed = TRUE;
+ }
+ break;
+ }
+
+ if (RequestConfirmed) {
+ mTcgNvs->PhysicalPresence.ReturnCode = PP_REQUEST_ALLOWED_AND_PPUSER_NOT_REQUIRED;
+ } else {
+ mTcgNvs->PhysicalPresence.ReturnCode = PP_REQUEST_ALLOWED_AND_PPUSER_REQUIRED;
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Software SMI callback for MemoryClear which is called from ACPI method.
+
+ Caution: This function may receive untrusted input.
+ Variable and ACPINvs are external input, so this function will validate
+ its data structure to be valid value.
+
+ @param[in] DispatchHandle The unique handle assigned to this handler by SmiHandlerRegister().
+ @param[in] Context Points to an optional handler context which was specified when the
+ handler was registered.
+
+ @retval EFI_SUCCESS The interrupt was handled successfully.
+**/
+EFI_STATUS
+EFIAPI
+MemoryClearCallback (
+ IN EFI_HANDLE DispatchHandle,
+ IN EFI_SMM_SW_DISPATCH_CONTEXT *DispatchContext
+ )
+{
+ EFI_STATUS Status;
+ UINTN DataSize;
+ UINT8 MorControl;
+
+ mTcgNvs->MemoryClear.ReturnCode = MOR_REQUEST_SUCCESS;
+ if (mTcgNvs->MemoryClear.Parameter == ACPI_FUNCTION_DSM_MEMORY_CLEAR_INTERFACE) {
+ MorControl = (UINT8) mTcgNvs->MemoryClear.Request;
+ } else if (mTcgNvs->MemoryClear.Parameter == ACPI_FUNCTION_PTS_CLEAR_MOR_BIT) {
+ DataSize = sizeof (UINT8);
+//<AMI_OVERRIDE> >>>
+ Status = mRuntimeServices->GetVariable (
+ MEMORY_OVERWRITE_REQUEST_VARIABLE_NAME,
+ &gEfiMemoryOverwriteControlDataGuid,
+ NULL,
+ &DataSize,
+ &MorControl
+ );
+//<AMI_OVERRIDE> <<<
+ if (EFI_ERROR (Status)) {
+ return EFI_SUCCESS;
+ }
+
+ if (MOR_CLEAR_MEMORY_VALUE (MorControl) == 0x0) {
+ return EFI_SUCCESS;
+ }
+ MorControl &= ~MOR_CLEAR_MEMORY_BIT_MASK;
+ }
+
+ DataSize = sizeof (UINT8);
+//<AMI_OVERRIDE> >>>
+ Status = mRuntimeServices->SetVariable (
+ MEMORY_OVERWRITE_REQUEST_VARIABLE_NAME,
+ &gEfiMemoryOverwriteControlDataGuid,
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
+ DataSize,
+ &MorControl
+ );
+//<AMI_OVERRIDE> <<<
+ if (EFI_ERROR (Status)) {
+ mTcgNvs->MemoryClear.ReturnCode = MOR_REQUEST_GENERAL_FAILURE;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Find the operation region in TCG ACPI table by given Name and Size,
+ and initialize it if the region is found.
+
+ @param[in, out] Table The TPM item in ACPI table.
+ @param[in] Name The name string to find in TPM table.
+ @param[in] Size The size of the region to find.
+
+ @return The allocated address for the found region.
+**/
+VOID *
+AssignOpRegion (
+ EFI_ACPI_DESCRIPTION_HEADER *Table,
+ UINT32 Name,
+ UINT16 Size
+ )
+{
+ EFI_STATUS Status;
+ AML_OP_REGION_32_8 *OpRegion;
+ EFI_PHYSICAL_ADDRESS MemoryAddress;
+
+ MemoryAddress = 0xFFFFFFFF;
+
+ //
+ // Patch some pointers for the ASL code before loading the SSDT.
+ //
+ for (OpRegion = (AML_OP_REGION_32_8 *) (Table + 1);
+ OpRegion <= (AML_OP_REGION_32_8 *) ((UINT8 *) Table + Table->Length);
+ OpRegion = (AML_OP_REGION_32_8 *) ((UINT8 *) OpRegion + 1)) {
+ if ((OpRegion->OpRegionOp == AML_EXT_REGION_OP) &&
+ (OpRegion->NameString == Name) &&
+ (OpRegion->DWordPrefix == AML_DWORD_PREFIX) &&
+ (OpRegion->BytePrefix == AML_BYTE_PREFIX)) {
+
+ Status = (gBS->AllocatePages)(AllocateMaxAddress, EfiACPIMemoryNVS, EFI_SIZE_TO_PAGES (Size), &MemoryAddress);
+ ASSERT_EFI_ERROR (Status);
+ ZeroMem ((VOID *)(UINTN)MemoryAddress, Size);
+ OpRegion->RegionOffset = (UINT32) (UINTN) MemoryAddress;
+ OpRegion->RegionLen = (UINT8) Size;
+ break;
+ }
+ }
+
+ return (VOID *) (UINTN) MemoryAddress;
+}
+
+VOID *
+GetTpm2AcpiTableFromFv (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ EFI_HANDLE *HandleBuffer;
+ UINTN NumberOfHandles;
+ EFI_FV_FILETYPE FileType;
+ UINT32 FvStatus;
+ EFI_FV_FILE_ATTRIBUTES Attributes;
+ UINTN Size;
+ UINTN Index;
+ INTN Instance;
+ EFI_ACPI_COMMON_HEADER *CurrentTable;
+ EFI_FIRMWARE_VOLUME_PROTOCOL *FwVol;
+
+ ///
+ /// Locate protocol.
+ /// There is little chance we can't find an FV protocol
+ ///
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiFirmwareVolumeProtocolGuid,
+ NULL,
+ &NumberOfHandles,
+ &HandleBuffer
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ FwVol = NULL;
+ ///
+ /// Looking for FV with ACPI storage file
+ ///
+ for (Index = 0; Index < NumberOfHandles; Index++) {
+ ///
+ /// Get the protocol on this handle
+ /// This should not fail because of LocateHandleBuffer
+ ///
+ Status = gBS->HandleProtocol (
+ HandleBuffer[Index],
+ &gEfiFirmwareVolumeProtocolGuid,
+ &FwVol
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// See if it has the ACPI storage file
+ ///
+ Size = 0;
+ FvStatus = 0;
+ Status = FwVol->ReadFile (
+ FwVol,
+ &gTpm2AcpiTableStorageGuid,
+ NULL,
+ &Size,
+ &FileType,
+ &Attributes,
+ &FvStatus
+ );
+
+ ///
+ /// If we found it, then we are done
+ ///
+ if (Status == EFI_SUCCESS) {
+ break;
+ } else {
+ FwVol = NULL;
+ }
+ }
+
+ if ((Index == NumberOfHandles) || (FwVol == NULL)) {
+ return NULL;
+ }
+
+ Instance = 0;
+ CurrentTable = NULL;
+
+ while (Status == EFI_SUCCESS) {
+ Status = FwVol->ReadSection (
+ FwVol,
+ &gTpm2AcpiTableStorageGuid,
+ EFI_SECTION_RAW,
+ Instance,
+ &CurrentTable,
+ &Size,
+ &FvStatus
+ );
+
+ if (!EFI_ERROR (Status)) {
+ ///
+ /// Check the Signature ID to modify the table
+ ///
+ if ((((EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable)->Signature == EFI_SIGNATURE_32 ('S', 'S', 'D', 'T')) &&
+ (((EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable)->OemTableId == EFI_SIGNATURE_64 ('T', 'p', 'm', '2', 'T', 'a', 'b', 'l'))) {
+ //
+ // Find it.
+ //
+ break;
+ }
+ ///
+ /// Increment the instance
+ ///
+ Instance++;
+ CurrentTable = NULL;
+ }
+ }
+
+ ///
+ /// Our exit status is determined by the success of the previous operations
+ /// If the protocol was found, Instance already points to it.
+ ///
+ ///
+ /// Free any allocated buffers
+ ///
+ (gBS->FreePool) (HandleBuffer);
+
+ return CurrentTable;
+}
+
+/**
+ Initialize and publish TPM items in ACPI table.
+
+ @retval EFI_SUCCESS The TCG ACPI table is published successfully.
+ @retval Others The TCG ACPI table is not published.
+**/
+EFI_STATUS
+PublishAcpiTable (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
+ UINTN TableKey;
+ EFI_ACPI_DESCRIPTION_HEADER *Table;
+ UINTN TableSize;
+
+ Table = GetTpm2AcpiTableFromFv ();
+ ASSERT (Table != NULL);
+
+ if (Table == NULL) {
+ return EFI_NOT_FOUND;
+ }
+
+ TableSize = Table->Length;
+
+ ASSERT (Table->OemTableId == EFI_SIGNATURE_64 ('T', 'p', 'm', '2', 'T', 'a', 'b', 'l'));
+ mTcgNvs = AssignOpRegion (Table, EFI_SIGNATURE_32 ('T', 'N', 'V', 'S'), (UINT16) sizeof (TCG_NVS));
+ ASSERT (mTcgNvs != NULL);
+
+ //
+ // Publish the TPM ACPI table
+ //
+ Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **) &AcpiTable);
+ ASSERT_EFI_ERROR (Status);
+
+ TableKey = 0;
+ Status = AcpiTable->InstallAcpiTable (
+ AcpiTable,
+ Table,
+ TableSize,
+ &TableKey
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ return Status;
+}
+
+EFI_STATUS
+PublishFtpmAcpiTable (
+ VOID
+ )
+/**
+ Publish TPM2 ACPI table
+
+ @retval EFI_SUCCESS The TPM2 ACPI table is published successfully.
+ @retval Others The TPM2 ACPI table is not published.
+**/
+{
+ EFI_STATUS Status;
+ EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
+ UINTN TableKey;
+ EFI_TPM2_ACPI_CONTROL_AREA *ControlArea;
+ ME_DATA_HOB *MeDataHob;
+ EFI_GUID gMeDataHobGuid = ME_DATA_HOB_GUID;
+
+ ///
+ /// Construct ACPI table
+ ///
+ Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **) &AcpiTable);
+ ASSERT_EFI_ERROR (Status);
+
+ MeDataHob = NULL;
+ MeDataHob = GetFirstGuidHob (&gMeDataHobGuid);
+ if (MeDataHob != NULL) {
+ (UINTN)mTpm2AcpiTemplate.AddressOfControlArea = MeDataHob->FtpmBufferAddress;
+ } else {
+ (UINTN) mTpm2AcpiTemplate.AddressOfControlArea = 0xFED70000;
+ }
+
+ ControlArea = (EFI_TPM2_ACPI_CONTROL_AREA *)(UINTN)mTpm2AcpiTemplate.AddressOfControlArea;
+ ZeroMem (ControlArea, sizeof(*ControlArea));
+ ControlArea->CommandSize = 0xF80;
+ ControlArea->ResponseSize = 0xF80;
+ ControlArea->Command = (UINTN)mTpm2AcpiTemplate.AddressOfControlArea + 0x80;
+ ControlArea->Response = (UINTN)mTpm2AcpiTemplate.AddressOfControlArea + 0x80;
+ CopyMem (&mControlArea, ControlArea, sizeof(mControlArea));
+
+ DEBUG ((EFI_D_INFO, "Ftpm Windows Buffer Control Area Address = %x\n", mTpm2AcpiTemplate.AddressOfControlArea));
+ DEBUG ((EFI_D_INFO, "Ftpm Windows Command/Response Buffer Address = %x\n", ControlArea->Command));
+
+ Status = AcpiTable->InstallAcpiTable (
+ AcpiTable,
+ &mTpm2AcpiTemplate,
+ sizeof(mTpm2AcpiTemplate),
+ &TableKey
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ return Status;
+}
+
+BOOLEAN
+IsFtpmEnabled (
+ VOID
+ )
+{
+ UINT32 IsPttEnabled;
+ UINT32 IsPttReady;
+ UINT32 MeFwSts4;
+
+ IsPttEnabled = ( B_PTT_HCI_STS_ENABLED & MmioRead32((UINTN)(R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_STS)) );
+ ///
+ /// Read ME FWSTS4 to check if TPM_DISCONNECT_ALL BIT[12] is set
+ ///
+ MeFwSts4 = HeciPciRead32(R_ME_HFS_4);
+
+ ///
+ /// Read Ready Bit to identify if PTT is ready for accepting OS Commands
+ ///
+ IsPttReady = (B_PTT_HCI_STS_READY & MmioRead32((UINTN)(R_PTT_HCI_BASE_ADDRESS + R_PTT_HCI_STS)));
+
+ if ( (IsPttEnabled == 0) || (MeFwSts4 & BIT12) || (IsPttReady == 0) ) {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+EFI_STATUS
+InitializeMeSsdtAcpiTables (
+IN EFI_HANDLE ImageHandle
+ )
+/**
+@brief
+ Initialize MEFW SSDT ACPI tables
+
+ @retval EFI_SUCCESS ACPI tables are initialized successfully
+ @retval EFI_NOT_FOUND ACPI tables not found
+**/
+{
+ EFI_STATUS Status;
+ EFI_HANDLE *HandleBuffer;
+ UINTN NumberOfHandles;
+ EFI_FV_FILETYPE FileType;
+ UINT32 FvStatus;
+ EFI_FV_FILE_ATTRIBUTES Attributes;
+ UINTN Size;
+ UINTN i;
+ EFI_FIRMWARE_VOLUME_PROTOCOL *FwVol;
+ INTN Instance;
+ EFI_ACPI_COMMON_HEADER *CurrentTable;
+ UINTN AcpiTableKey;
+ UINT8 *CurrPtr;
+ UINT8 *EndPtr;
+ UINT32 *Signature;
+ EFI_ACPI_DESCRIPTION_HEADER *MeAcpiTable;
+ EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
+
+ Status = (gBS->AllocatePool) (EfiReservedMemoryType, sizeof (ME_GLOBAL_NVS_AREA), (VOID **) &mMeGlobalNvsAreaProtocol.Area);
+ ASSERT_EFI_ERROR (Status);
+ ZeroMem ((VOID *) mMeGlobalNvsAreaProtocol.Area, sizeof (ME_GLOBAL_NVS_AREA));
+
+ FwVol = NULL;
+ MeAcpiTable = NULL;
+
+ ///
+ /// Locate ACPI Table protocol
+ ///
+ DEBUG ((EFI_D_INFO, "Init ME SSDT table\n"));
+ Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, &AcpiTable);
+ if (Status != EFI_SUCCESS) {
+ DEBUG ((EFI_D_ERROR, "Fail to locate EfiAcpiTableProtocol.\n"));
+ return EFI_NOT_FOUND;
+ }
+
+ ///
+ /// Locate protocol.
+ /// There is little chance we can't find an FV protocol
+ ///
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiFirmwareVolumeProtocolGuid,
+ NULL,
+ &NumberOfHandles,
+ &HandleBuffer
+ );
+ ASSERT_EFI_ERROR (Status);
+ ///
+ /// Looking for FV with ACPI storage file
+ ///
+ for (i = 0; i < NumberOfHandles; i++) {
+ ///
+ /// Get the protocol on this handle
+ /// This should not fail because of LocateHandleBuffer
+ ///
+ Status = gBS->HandleProtocol (
+ HandleBuffer[i],
+ &gEfiFirmwareVolumeProtocolGuid,
+ &FwVol
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// See if it has the ACPI storage file
+ ///
+ Size = 0;
+ FvStatus = 0;
+ Status = FwVol->ReadFile (
+ FwVol,
+ &gMeSsdtAcpiTableStorageGuid,
+ NULL,
+ &Size,
+ &FileType,
+ &Attributes,
+ &FvStatus
+ );
+
+ ///
+ /// If we found it, then we are done
+ ///
+ if (Status == EFI_SUCCESS) {
+ break;
+ }
+ }
+ ///
+ /// Free any allocated buffers
+ ///
+ FreePool (HandleBuffer);
+
+ ///
+ /// Sanity check that we found our data file
+ ///
+ ASSERT (FwVol != NULL);
+ if (FwVol == NULL) {
+ DEBUG ((EFI_D_INFO, "ME Global NVS table not found\n"));
+ return EFI_NOT_FOUND;
+ }
+ ///
+ /// Our exit status is determined by the success of the previous operations
+ /// If the protocol was found, Instance already points to it.
+ /// Read tables from the storage file.
+ ///
+ Instance = 0;
+ CurrentTable = NULL;
+ while (Status == EFI_SUCCESS) {
+ Status = FwVol->ReadSection (
+ FwVol,
+ &gMeSsdtAcpiTableStorageGuid,
+ EFI_SECTION_RAW,
+ Instance,
+ &CurrentTable,
+ &Size,
+ &FvStatus
+ );
+
+ if (!EFI_ERROR (Status)) {
+ ///
+ /// Check the table ID to modify the table
+ ///
+ if (((EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable)->OemTableId == EFI_SIGNATURE_64 ('M', 'e', 'S', 's', 'd', 't', ' ', 0)) {
+ MeAcpiTable = (EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable;
+ ///
+ /// Locate the SSDT package
+ ///
+ CurrPtr = (UINT8 *) MeAcpiTable;
+ EndPtr = CurrPtr + MeAcpiTable->Length;
+
+ for (; CurrPtr <= EndPtr; CurrPtr++) {
+ Signature = (UINT32 *) (CurrPtr + 3);
+ if (*Signature == EFI_SIGNATURE_32 ('M', 'E', 'N', 'V')) {
+ ASSERT_EFI_ERROR (*(UINT32 *) (CurrPtr + 3 + sizeof (*Signature) + 2) == 0xFFFF0000);
+ ASSERT_EFI_ERROR (*(UINT16 *) (CurrPtr + 3 + sizeof (*Signature) + 2 + sizeof (UINT32) + 1) == 0xAA55);
+ ///
+ /// ME Global NVS Area address
+ ///
+
+ *(UINT32 *) (CurrPtr + 3 + sizeof (*Signature) + 2) = (UINT32) (UINTN) mMeGlobalNvsAreaProtocol.Area;
+ ///
+ /// ME Global NVS Area size
+ ///
+ *(UINT16 *) (CurrPtr + 3 + sizeof (*Signature) + 2 + sizeof (UINT32) + 1) =
+ sizeof (ME_GLOBAL_NVS_AREA);
+
+ AcpiTableKey = 0;
+ Status = AcpiTable->InstallAcpiTable (
+ AcpiTable,
+ MeAcpiTable,
+ MeAcpiTable->Length,
+ &AcpiTableKey
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &ImageHandle,
+ &gMeGlobalNvsAreaProtocolGuid,
+ &mMeGlobalNvsAreaProtocol,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+ return EFI_SUCCESS;
+ }
+ }
+ }
+ ///
+ /// Increment the instance
+ ///
+ Instance++;
+ CurrentTable = NULL;
+ }
+ }
+
+ return Status;
+}
+/**
+ The driver's entry point.
+
+ It install callbacks for TPM physical presence and MemoryClear, and locate
+ SMM variable to be used in the callback function.
+
+ @param[in] ImageHandle The firmware allocated handle for the EFI image.
+ @param[in] SystemTable A pointer to the EFI System Table.
+
+ @retval EFI_SUCCESS The entry point is executed successfully.
+ @retval Others Some error occurs when executing this entry point.
+**/
+EFI_STATUS
+EFIAPI
+InitializeFtpmSmm (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ EFI_SMM_SW_DISPATCH_PROTOCOL *SwDispatch;
+ EFI_SMM_SW_DISPATCH_CONTEXT SwContext;
+ EFI_HANDLE SwHandle;
+ ME_GLOBAL_NVS_AREA_PROTOCOL *MeGlobalNvsAreaProtocol;
+ ME_GLOBAL_NVS_AREA *MeGlobalNvsArea;
+
+ if (!IsFtpmEnabled ()) {
+ DEBUG ((EFI_D_ERROR, "InitializeFtpmSmm - FTPM not enabled\n"));
+ return EFI_SUCCESS;
+ }
+
+if (GetCpuFamily() == EnumCpuHswUlt) {
+ Status = PublishAcpiTable ();
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Get the Sw dispatch protocol and register SMI callback functions.
+ //
+ Status = gBS->LocateProtocol (&gEfiSmmSwDispatchProtocolGuid, NULL, (VOID**)&SwDispatch);
+ ASSERT_EFI_ERROR (Status);
+ SwContext.SwSmiInputValue = EFI_TPM2_PP_SW_SMI;
+ Status = SwDispatch->Register (SwDispatch, PhysicalPresenceCallback, &SwContext, &SwHandle);
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ mTcgNvs->PhysicalPresence.SoftwareSmi = (UINT8) SwContext.SwSmiInputValue;
+
+ SwContext.SwSmiInputValue = EFI_TPM2_MOR_SW_SMI;
+ Status = SwDispatch->Register (SwDispatch, MemoryClearCallback, &SwContext, &SwHandle);
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ mTcgNvs->MemoryClear.SoftwareSmi = (UINT8) SwContext.SwSmiInputValue;
+
+//<AMI_OVERRIDE> >>>
+ ///
+ /// Locate SmmVariableProtocol.
+ ///
+ //Status = gBS->LocateProtocol (&gEfiSmmVariableProtocolGuid, NULL, (VOID**)&mSmmVariable);
+ //ASSERT_EFI_ERROR (Status);
+
+ //We don't install SmmVariableProtocol in gBS, use gRT's variable
+ //service directly.
+ Status = GetSmmRtTable();
+ ASSERT_EFI_ERROR (Status);
+//<AMI_OVERRIDE> <<<
+
+ Status = InitializeMeSsdtAcpiTables(ImageHandle);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Publish TPM2 ACPI table
+ ///
+ Status = PublishFtpmAcpiTable();
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Locate Global NVS and update PTT Buffer Address
+ ///
+ Status = gBS->LocateProtocol (&gMeGlobalNvsAreaProtocolGuid, NULL, (VOID **) &MeGlobalNvsAreaProtocol);
+ ASSERT_EFI_ERROR (Status);
+
+ MeGlobalNvsArea = MeGlobalNvsAreaProtocol->Area;
+ MeGlobalNvsArea->PTTAddress = mTpm2AcpiTemplate.AddressOfControlArea;
+}
+
+ return EFI_SUCCESS;
+}
+
diff --git a/ReferenceCode/ME/Ptt/Smm/PttHciSmm.cif b/ReferenceCode/ME/Ptt/Smm/PttHciSmm.cif
new file mode 100644
index 0000000..d8a8e0d
--- /dev/null
+++ b/ReferenceCode/ME/Ptt/Smm/PttHciSmm.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "PttHciSmm"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\Ptt\Smm\"
+ RefName = "PttHciSmm"
+[files]
+"PttHciSmm.sdl"
+"PttHciSmm.mak"
+"PttHciSmm.c"
+"PttHciSmm.h"
+"PttHciSmm.dxs"
+"PttHciSmm.inf"
+<endComponent>
diff --git a/ReferenceCode/ME/Ptt/Smm/PttHciSmm.dxs b/ReferenceCode/ME/Ptt/Smm/PttHciSmm.dxs
new file mode 100644
index 0000000..01b31c8
--- /dev/null
+++ b/ReferenceCode/ME/Ptt/Smm/PttHciSmm.dxs
@@ -0,0 +1,48 @@
+/** @file
+ Dependency expression source file.
+
+@copyright
+ Copyright (c) 2012 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "DxeDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+#endif
+
+#include EFI_PROTOCOL_DEFINITION (AcpiTable)
+#include EFI_PROTOCOL_DEFINITION (SmmSwDispatch)
+//#include EFI_PROTOCOL_DEFINITION (SmmVariable) //<AMI_OVERRIDE>
+
+//<AMI_OVERRIDE> >>>
+DEPENDENCY_START
+ EFI_ACPI_TABLE_PROTOCOL_GUID AND
+ EFI_SMM_SW_DISPATCH_PROTOCOL_GUID
+DEPENDENCY_END
+//<AMI_OVERRIDE> <<< \ No newline at end of file
diff --git a/ReferenceCode/ME/Ptt/Smm/PttHciSmm.h b/ReferenceCode/ME/Ptt/Smm/PttHciSmm.h
new file mode 100644
index 0000000..3771d00
--- /dev/null
+++ b/ReferenceCode/ME/Ptt/Smm/PttHciSmm.h
@@ -0,0 +1,158 @@
+/** @file
+ The header file for Ftpm SMM driver.
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+#ifndef __FTPM_SMM_H__
+#define __FTPM_SMM_H__
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+
+#include EFI_PROTOCOL_DEPENDENCY (SmmBase)
+#include EFI_PROTOCOL_DEPENDENCY (SmmSwDispatch)
+#include EFI_PROTOCOL_DEPENDENCY (AcpiTable)
+#include EFI_PROTOCOL_DEPENDENCY (FirmwareVolume)
+#include EFI_PROTOCOL_DEPENDENCY (MeGlobalNvsArea)
+#include EFI_GUID_DEFINITION (MeSsdtTableStorage)
+
+#include "Acpi.h"
+
+//
+// Below definition is generic, but NOT in GreenH
+//
+#include EFI_PROTOCOL_DEPENDENCY (SmmVariable)
+
+#include "IndustryStandard\AcpiAml.h"
+#ifndef EFI_ACPI_5_0_TRUSTED_COMPUTING_PLATFORM_2_TABLE_SIGNATURE
+#define EFI_ACPI_5_0_TRUSTED_COMPUTING_PLATFORM_2_TABLE_SIGNATURE EFI_SIGNATURE_32('T', 'P', 'M', '2')
+#endif
+
+#include "IndustryStandard\Tpm2Acpi.h"
+#include EFI_GUID_DEFINITION (TrEEPhysicalPresenceData)
+#include EFI_GUID_DEFINITION (MemoryOverwriteControl)
+
+//
+// Below definition is chipset specific
+//
+#include EFI_GUID_DEFINITION (MeDataHob)
+#include "CpuRegs.h"
+#include "CpuPlatformLib.h"
+#include "PttHciRegs.h"
+#endif
+
+//
+// Below definition is driver specific
+//
+#include "Tpm2AcpiTableStorage.h"
+
+#pragma pack(1)
+typedef struct {
+ UINT8 SoftwareSmi;
+ UINT32 Parameter;
+ UINT32 Response;
+ UINT32 Request;
+ UINT32 LastRequest;
+ UINT32 ReturnCode;
+} PHYSICAL_PRESENCE_NVS;
+
+typedef struct {
+ UINT8 SoftwareSmi;
+ UINT32 Parameter;
+ UINT32 Request;
+ UINT32 ReturnCode;
+} MEMORY_CLEAR_NVS;
+
+typedef struct {
+ UINT8 SoftwareSmi;
+ UINT32 ReturnCode;
+} START_METHOD_NVS;
+
+typedef struct {
+ PHYSICAL_PRESENCE_NVS PhysicalPresence;
+ MEMORY_CLEAR_NVS MemoryClear;
+ START_METHOD_NVS StartMethod;
+} TCG_NVS;
+
+typedef struct {
+ UINT8 OpRegionOp;
+ UINT32 NameString;
+ UINT8 RegionSpace;
+ UINT8 DWordPrefix;
+ UINT32 RegionOffset;
+ UINT8 BytePrefix;
+ UINT8 RegionLen;
+} AML_OP_REGION_32_8;
+#pragma pack()
+
+//
+// The definition for TCG physical presence ACPI function
+//
+#define ACPI_FUNCTION_GET_PHYSICAL_PRESENCE_INTERFACE_VERSION 1
+#define ACPI_FUNCTION_SUBMIT_REQUEST_TO_BIOS 2
+#define ACPI_FUNCTION_GET_PENDING_REQUEST_BY_OS 3
+#define ACPI_FUNCTION_GET_PLATFORM_ACTION_TO_TRANSITION_TO_BIOS 4
+#define ACPI_FUNCTION_RETURN_REQUEST_RESPONSE_TO_OS 5
+#define ACPI_FUNCTION_SUBMIT_PREFERRED_USER_LANGUAGE 6
+#define ACPI_FUNCTION_SUBMIT_REQUEST_TO_BIOS_2 7
+#define ACPI_FUNCTION_GET_USER_CONFIRMATION_STATUS_FOR_REQUEST 8
+
+//
+// The return code for Get User Confirmation Status for Operation
+//
+#define PP_REQUEST_NOT_IMPLEMENTED 0
+#define PP_REQUEST_BIOS_ONLY 1
+#define PP_REQUEST_BLOCKED 2
+#define PP_REQUEST_ALLOWED_AND_PPUSER_REQUIRED 3
+#define PP_REQUEST_ALLOWED_AND_PPUSER_NOT_REQUIRED 4
+
+//
+// The return code for Sumbit TPM Request to Pre-OS Environment
+// and Sumbit TPM Request to Pre-OS Environment 2
+//
+#define PP_SUBMIT_REQUEST_SUCCESS 0
+#define PP_SUBMIT_REQUEST_NOT_IMPLEMENTED 1
+#define PP_SUBMIT_REQUEST_GENERAL_FAILURE 2
+#define PP_SUBMIT_REQUEST_BLOCKED_BY_BIOS_SETTINGS 3
+
+//
+// The definition for TCG MOR
+//
+#define ACPI_FUNCTION_DSM_MEMORY_CLEAR_INTERFACE 1
+#define ACPI_FUNCTION_PTS_CLEAR_MOR_BIT 2
+
+//
+// The return code for Memory Clear Interface Functions
+//
+#define MOR_REQUEST_SUCCESS 0
+#define MOR_REQUEST_GENERAL_FAILURE 1
+
+//
+// Below definition should be in platorm scope
+//
+// TBD: Use policy to input these data...
+#ifndef EFI_TPM2_PP_SW_SMI
+#define EFI_TPM2_PP_SW_SMI 0x9E
+#endif
+#ifndef EFI_TPM2_MOR_SW_SMI
+#define EFI_TPM2_MOR_SW_SMI 0x9F
+#endif
+
+#endif // __FTPM_SMM_H__
diff --git a/ReferenceCode/ME/Ptt/Smm/PttHciSmm.inf b/ReferenceCode/ME/Ptt/Smm/PttHciSmm.inf
new file mode 100644
index 0000000..87e30f1
--- /dev/null
+++ b/ReferenceCode/ME/Ptt/Smm/PttHciSmm.inf
@@ -0,0 +1,106 @@
+## @file
+# This driver implements TPM2 definition block in ACPI table and
+#
+#@copyright
+# Copyright (c) 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains an 'Intel Peripheral Driver' and uniquely
+# identified as "Intel Reference Module" and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+
+[defines]
+ BASE_NAME = PttHciSmm
+ FILE_GUID = 8029a5b5-4088-48d2-96e0-f7052bc0a842
+ COMPONENT_TYPE = RT_DRIVER
+
+[sources.common]
+ PttHciSmm.c
+ PttHciSmm.h
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueSmmDriverEntryPoint.c
+
+[includes.common]
+ #
+ # Edk II Glue Library, some hearder are included by R9 header so have to include
+ #
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Framework
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include/Library
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include/Common
+
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Guid
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include/Library
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/Include
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Heci/Include
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/Ptt/Include
+
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/SampleCode
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/SampleCode/Include
+
+[libraries.common]
+ EdkIIGlueBaseLib
+ EdkIIGlueBaseMemoryLib
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueSmmRuntimeDxeReportStatusCodeLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueDxeHobLib
+ CpuPlatformLib
+ EdkFrameworkProtocolLib
+ EdkProtocolLib
+ EdkIIGlueSmmFirmwarePerformanceLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = PttHciSmm.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) /D__EDKII_GLUE_MODULE_ENTRY_POINT__=InitializeFtpmSmm
+ C_FLAGS = $(C_FLAGS) /D __EDKII_GLUE_BASE_LIB__ \
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_SMM_RUNTIME_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_DXE_HOB_LIB__ \
+ /D PTT_FLAG
diff --git a/ReferenceCode/ME/Ptt/Smm/PttHciSmm.mak b/ReferenceCode/ME/Ptt/Smm/PttHciSmm.mak
new file mode 100644
index 0000000..1c6485a
--- /dev/null
+++ b/ReferenceCode/ME/Ptt/Smm/PttHciSmm.mak
@@ -0,0 +1,69 @@
+# MAK file for the ModulePart:PTTHciSmm
+all : PttHciSmm
+
+PttHciSmm : $(BUILD_DIR)\PttHciSmm.mak PttHciSmmBin
+
+$(BUILD_DIR)\PttHciSmm.mak : $(PttHciSmm_DIR)\PttHciSmm.cif $(PttHciSmm_DIR)\PttHciSmm.mak $(CP_BUILD_RULES)
+ $(CIF2MAK) $(PttHciSmm_DIR)\PttHciSmm.cif $(CIF2MAK_DEFAULTS)
+
+PTTHciSmm_INCLUDES= \
+ $(ACPI_PLATFORM_INCLUDES)\
+ $(EDK_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(ME_INCLUDES)\
+ /I$(INTEL_COUGAR_POINT_INCLUDE_DIR)\
+ /IReferenceCode\ME\SampleCode\
+ $(PROJECT_CPU_INCLUDES)
+
+PTTHciSmm_LIBS=\
+ $(EDKPROTOCOLLIB)\
+ $(MeProtocolLib_LIB)\
+ $(MeLibDxe_LIB)\
+ $(MeChipsetDxeLib_LIB)\
+ $(MeGuidLib_LIB)\
+ $(EFISCRIPTLIB)\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(EFIGUIDLIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueUefiLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(EdkIIGlueDxeServicesTableLib_LIB)\
+ $(EFIDRIVERLIB)\
+ $(RcFviDxeLib_LIB)\
+ $(PchPlatformDxeLib_LIB)\
+ $(CpuPlatformLib_LIB)\
+ $(EdkIIGlueDxeHobLib_LIB)\
+ $(EdkIIGlueSmmRuntimeDxeReportStatusCodeLib_LIB)\
+
+PTTHciSmm_DEFINES=$(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=InitializeFtpmSmm"\
+ /D __EDKII_GLUE_BASE_LIB__ \
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_SMM_RUNTIME_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_DXE_HOB_LIB__ \
+ /D PTT_FLAG
+
+PTTHciSmmBin : $(PTTHciSmm_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\PttHciSmm.mak all\
+ MAKEFILE=$(BUILD_DIR)\PttHciSmm.mak\
+ "MY_INCLUDES=$(PTTHciSmm_INCLUDES)"\
+ "MY_DEFINES=$(PTTHciSmm_DEFINES)"\
+ GUID=8029a5b5-4088-48d2-96e0-f7052bc0a842\
+ DEPEX1=$(PttHciSmm_DIR)\PTTHciSmm.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=RT_DRIVER\
+ EDKIIModule=SMMDRIVER\
+ COMPRESS=1 \ No newline at end of file
diff --git a/ReferenceCode/ME/Ptt/Smm/PttHciSmm.sdl b/ReferenceCode/ME/Ptt/Smm/PttHciSmm.sdl
new file mode 100644
index 0000000..1853239
--- /dev/null
+++ b/ReferenceCode/ME/Ptt/Smm/PttHciSmm.sdl
@@ -0,0 +1,32 @@
+TOKEN
+ Name = "PTTHciSmm_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable PTTHciSmm Suppport in Project"
+ Token = "IntelPTT_SUPPORT" "=" "1"
+End
+
+MODULE
+ Help = "Includes HeciSmm.mak to Project"
+ File = "PttHciSmm.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PttHciSmm.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+
+PATH
+ Name = "PttHciSmm_DIR"
+ Help = "PTT Hci SMM Driver files source directory"
+End
+
+ELINK
+ Name = "/D PTT_FLAG"
+ Parent = "GLOBAL_DEFINES"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/ME/Ptt/Smm/PttSmm.cif b/ReferenceCode/ME/Ptt/Smm/PttSmm.cif
new file mode 100644
index 0000000..d2c5c29
--- /dev/null
+++ b/ReferenceCode/ME/Ptt/Smm/PttSmm.cif
@@ -0,0 +1,9 @@
+<component>
+ name = "PttSmm"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\Ptt\Smm\"
+ RefName = "PttSmm"
+[parts]
+"PttHciSmm"
+"PttSmmAcpi"
+<endComponent>
diff --git a/ReferenceCode/ME/Ptt/Smm/PttSmmAcpi.cif b/ReferenceCode/ME/Ptt/Smm/PttSmmAcpi.cif
new file mode 100644
index 0000000..50eb85c
--- /dev/null
+++ b/ReferenceCode/ME/Ptt/Smm/PttSmmAcpi.cif
@@ -0,0 +1,12 @@
+<component>
+ name = "PttSmmAcpi"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\Ptt\Smm\"
+ RefName = "PttSmmAcpi"
+[files]
+"Ftpm.asl"
+"Tpm2AcpiTables.inf"
+"Tpm2AcpiTableStorage.h"
+"PttSmmAcpi.mak"
+"PttSmmAcpi.sdl"
+<endComponent>
diff --git a/ReferenceCode/ME/Ptt/Smm/PttSmmAcpi.mak b/ReferenceCode/ME/Ptt/Smm/PttSmmAcpi.mak
new file mode 100644
index 0000000..24e7414
--- /dev/null
+++ b/ReferenceCode/ME/Ptt/Smm/PttSmmAcpi.mak
@@ -0,0 +1,44 @@
+#-----------------------------------------------------------------------
+# ASL compiler definition
+#-----------------------------------------------------------------------
+MASL = $(SILENT)asl.exe # Microsoft ASL compiler
+!IF "$(ACPIPLATFORM_ASL_COMPILER)"==""
+!ERROR It is an invalid path, please check your ASL compiler path.
+!ENDIF
+
+IASL = $(ACPIPLATFORM_ASL_COMPILER)
+#-----------------------------------------------------------------------
+ASL_COMPILER = IASL # Default ASL compiler. Can be 'IASL' for Intel ASL and 'MASL' for Microsoft ASL compiler.
+# Note. Msft. ASL compiler of version 1.0.14NT correctly process ACPI 2.0 extended ASL objects.
+#-----------------------------------------------------------------------
+EDK : PTTASL
+
+PTTASL: $(BUILD_DIR)\PTTACPI.ffs
+
+$(BUILD_DIR)\TPM.aml: $(INTEL_PTT_ASL_FILE)
+!if "$(ASL_COMPILER)" == "MASL"
+ $(MASL) /Fo=$@ $**
+!elseif "$(ASL_COMPILER)" == "IASL"
+ $(IASL) -p $(BUILD_DIR)\TPM.aml $(INTEL_PTT_ASL_FILE)
+!endif
+
+$(BUILD_DIR)\TPM.sec: $(BUILD_DIR)\TPM.aml
+ $(GENSECTION) -I $** -O $@ -S EFI_SECTION_RAW
+
+$(BUILD_DIR)\PTTACPI.ffs: $(BUILD_DIR)\TPM.sec $(PttHciSmm_DIR)\PttSmmAcpi.mak
+ $(GENFFSFILE) -B $(BUILD_DIR) -V -o $@ -P1 <<$(BUILD_DIR)\PTTACPI.pkg
+PACKAGE.INF
+[.]
+BASE_NAME = PTTACPI
+FFS_FILEGUID = 7D279373-EECC-4d4f-AE2F-CEC4B706B06A
+FFS_FILETYPE = EFI_FV_FILETYPE_FREEFORM
+FFS_ATTRIB_CHECKSUM = TRUE
+
+IMAGE_SCRIPT =
+{
+ Compress (dummy) {
+ $(PROJECT_DIR)\$(BUILD_DIR)\TPM.sec
+ }
+}
+<<KEEP
+#----------------------------------------------------------------------- \ No newline at end of file
diff --git a/ReferenceCode/ME/Ptt/Smm/PttSmmAcpi.sdl b/ReferenceCode/ME/Ptt/Smm/PttSmmAcpi.sdl
new file mode 100644
index 0000000..b039d27
--- /dev/null
+++ b/ReferenceCode/ME/Ptt/Smm/PttSmmAcpi.sdl
@@ -0,0 +1,33 @@
+TOKEN
+ Name = "PTTSmmAcpi_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable PTTHciSmm Suppport in Project"
+ Token = "IntelPTT_SUPPORT" "=" "1"
+End
+
+MODULE
+ Help = "Includes HeciSmm.mak to Project"
+ File = "PttSmmAcpi.mak"
+End
+
+PATH
+ Name = "PttHciSmm_DIR"
+ Help = "PTT Hci SMM Driver files source directory"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PTTACPI.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+
+TOKEN
+ Name = "INTEL_PTT_ASL_FILE"
+ Value = "$(PttHciSmm_DIR)\Ftpm.asl"
+ TokenType = Expression
+ TargetMAK = Yes
+End
diff --git a/ReferenceCode/ME/Ptt/Smm/Tpm2AcpiTableStorage.h b/ReferenceCode/ME/Ptt/Smm/Tpm2AcpiTableStorage.h
new file mode 100644
index 0000000..42a7e18
--- /dev/null
+++ b/ReferenceCode/ME/Ptt/Smm/Tpm2AcpiTableStorage.h
@@ -0,0 +1,31 @@
+/** @file
+ GUID definition for the TPM2 ACPI table storage file name
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _TPM2_ACPI_TABLE_STORAGE_H_
+#define _TPM2_ACPI_TABLE_STORAGE_H_
+
+#define TPM2_ACPI_TABLE_STORAGE_GUID \
+ { \
+ 0x7d279373, 0xeecc, 0x4d4f, 0xae, 0x2f, 0xce, 0xc4, 0xb7, 0x6, 0xb0, 0x6a \
+ }
+
+extern EFI_GUID gTpm2AcpiTableStorageGuid;
+
+#endif
diff --git a/ReferenceCode/ME/Ptt/Smm/Tpm2AcpiTables.inf b/ReferenceCode/ME/Ptt/Smm/Tpm2AcpiTables.inf
new file mode 100644
index 0000000..e6e03a4
--- /dev/null
+++ b/ReferenceCode/ME/Ptt/Smm/Tpm2AcpiTables.inf
@@ -0,0 +1,38 @@
+## @file
+# Component description file for the ACPI tables
+#
+#@copyright
+# Copyright (c) 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains an 'Intel Peripheral Driver' and uniquely
+# identified as "Intel Reference Module" and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+
+[defines]
+BASE_NAME = Tpm2AcpiTables
+FILE_GUID = 7D279373-EECC-4d4f-AE2F-CEC4B706B06A
+COMPONENT_TYPE = ACPITABLE
+FFS_EXT = .ffs
+
+[sources.common]
+ Ftpm.ASL
+
+[libraries.common]
+
+[includes.common]
+ .
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)\Include
+
+[nmake.common]
diff --git a/ReferenceCode/ME/SampleCode/AsfSupport/AsfSupport.c b/ReferenceCode/ME/SampleCode/AsfSupport/AsfSupport.c
new file mode 100644
index 0000000..c5324aa
--- /dev/null
+++ b/ReferenceCode/ME/SampleCode/AsfSupport/AsfSupport.c
@@ -0,0 +1,1517 @@
+/** @file
+ Support routines for ASF boot options in the BDS
+
+@copyright
+ Copyright (c) 2005-2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+#include "AsfSupport.h"
+
+#pragma pack(push,1)
+
+typedef struct {
+ UINT32 Attributes;
+ UINT16 FilePathListLength;
+} EFI_LOAD_OPTION;
+
+#pragma pack(pop)
+
+//
+// Global variables
+//
+EFI_ASF_BOOT_OPTIONS *mAsfBootOptions;
+EFI_GUID gAsfRestoreBootSettingsGuid = RESTORE_SECURE_BOOT_GUID;
+
+/**
+ Retrieve the ASF boot options previously recorded by the ASF driver.
+
+ @param[in] None.
+
+ @retval EFI_SUCCESS Initialized Boot Options global variable and AMT protocol
+**/
+EFI_STATUS
+BdsAsfInitialization (
+ IN VOID
+ )
+{
+ EFI_STATUS Status;
+ EFI_ALERT_STANDARD_FORMAT_PROTOCOL *Asf;
+
+ mAsfBootOptions = NULL;
+
+ //
+ // Amt Library Init
+ //
+ Status = AmtLibInit ();
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "Info : Error init AmtLibInit -> %r\n", Status));
+ return Status;
+ }
+ //
+ // Get Protocol for ASF
+ //
+ Status = gBS->LocateProtocol (
+ &gEfiAlertStandardFormatProtocolGuid,
+ NULL,
+ &Asf
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "Info : Error getting ASF protocol -> %r\n", Status));
+ return Status;
+ }
+
+ Status = Asf->GetBootOptions (Asf, &mAsfBootOptions);
+ if (EFI_ERROR(Status)) {
+ DEBUG ((EFI_D_ERROR, "Info : Error getting ASF BootOptions -> %r\n", Status));
+ return Status;
+ }
+
+ Status = ManageSecureBootState();
+
+ return Status;
+}
+
+/**
+ Get current Secure Boot state (enabled/disabled)
+
+ @param[in] None.
+
+ @retval UINT8 Secure Boot State
+**/
+UINT8
+GetSecureBootState(
+ IN VOID
+ )
+{
+ //
+ // This function is BIOS implementation specific
+ // and should be implemented in platform code
+ //
+
+ return SECURE_BOOT_DISABLED;
+}
+
+/**
+ Set current Secure Boot state (enabled/disabled)
+
+ @param[in] SecureBootState Secure Boot State
+
+ @retval EFI_SUCCESS Secure Boot State successfully changed
+**/
+EFI_STATUS
+SetSecureBootState(
+ IN UINT8 SecureBootState
+ )
+{
+ //
+ // This function is BIOS implementation specific
+ // and should be implemented in platform code
+ //
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This routine makes necessary Secure Boot & CSM state changes for IDEr boot
+
+ @param[in] None.
+
+ @retval EFI_SUCCESS Changes applied succesfully
+**/
+EFI_STATUS
+ManageSecureBootState(
+ IN VOID
+ )
+{
+ EFI_STATUS Status;
+ BOOLEAN EnforceSecureBoot;
+ UINT8 SecureBootState;
+ UINT8 RestoreBootSettings;
+ UINT8 IderBoot;
+ UINTN VarSize;
+
+ VarSize = sizeof(UINT8);
+
+ //
+ // Get boot parameters (IDER boot?, EnforceSecureBoot flag set?, secure boot enabled?)
+ //
+ EnforceSecureBoot = ActiveManagementEnforceSecureBoot();
+ IderBoot = ActiveManagementEnableIdeR();
+ SecureBootState = GetSecureBootState();
+
+ //
+ // Check whether we need to restore SecureBootEnable value changed in previous IDER boot
+ //
+ Status = gRT->GetVariable(
+ L"RestoreBootSettings",
+ &gAsfRestoreBootSettingsGuid,
+ NULL,
+ &VarSize,
+ &RestoreBootSettings
+ );
+
+ if (Status == EFI_SUCCESS && RestoreBootSettings != RESTORE_SECURE_BOOT_NONE) {
+ if (RestoreBootSettings == RESTORE_SECURE_BOOT_ENABLED && SecureBootState == SECURE_BOOT_DISABLED &&
+ !(IderBoot && !EnforceSecureBoot)) {
+
+ SecureBootState = SECURE_BOOT_ENABLED;
+
+ Status = SetSecureBootState(SecureBootState);
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Delete RestoreBootSettings variable
+ //
+ Status = gRT->SetVariable(
+ L"RestoreBootSettings",
+ &gAsfRestoreBootSettingsGuid,
+ 0,
+ 0,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ DEBUG ((EFI_D_INFO, "Secure Boot settings restored after IDER boot - Cold Reset!\n"));
+ gRT->ResetSystem(EfiResetCold, EFI_SUCCESS, 0, NULL);
+ EFI_DEADLOOP();
+ }
+ }
+
+ Status = EFI_SUCCESS;
+
+ if (IderBoot) {
+ if (SecureBootState == SECURE_BOOT_ENABLED && !EnforceSecureBoot) {
+ //
+ // Secure boot needs to be disabled if we're doing IDER and EnforceSecureBoot not set
+ //
+ SecureBootState = SECURE_BOOT_DISABLED;
+ RestoreBootSettings = RESTORE_SECURE_BOOT_ENABLED;
+
+ Status = SetSecureBootState(SecureBootState);
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Set variable to restore previous secure boot state
+ //
+ Status = gRT->SetVariable(
+ L"RestoreBootSettings",
+ &gAsfRestoreBootSettingsGuid,
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
+ sizeof(UINT8),
+ &RestoreBootSettings
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ DEBUG ((EFI_D_INFO, "Secure Boot disabled for IDER boot - Cold Reset!\n"));
+ gRT->ResetSystem(EfiResetCold, EFI_SUCCESS, 0, NULL);
+ EFI_DEADLOOP();
+ }
+ }
+
+ return Status;
+}
+
+/**
+ This function will create a BootOption from the give device path and
+ description string.
+
+ @param[in] DevicePath The device path which the option represent
+ @param[in] Description The description of the boot option
+
+ @retval BDS_COMMON_OPTION - Pointer to created boot option
+**/
+BDS_COMMON_OPTION *
+BdsCreateBootOption (
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
+ IN CHAR16 *Description
+ )
+{
+ BDS_COMMON_OPTION *Option;
+
+ Option = AllocateZeroPool (sizeof (BDS_COMMON_OPTION));
+ if (Option == NULL) {
+ return NULL;
+ }
+
+ Option->Signature = BDS_LOAD_OPTION_SIGNATURE;
+ Option->DevicePath = AllocateZeroPool (GetDevicePathSize (DevicePath));
+ CopyMem (Option->DevicePath, DevicePath, GetDevicePathSize (DevicePath));
+
+ Option->Attribute = LOAD_OPTION_ACTIVE;
+ Option->Description = AllocateZeroPool (EfiStrSize (Description));
+ CopyMem (Option->Description, Description, EfiStrSize (Description));
+
+ return Option;
+}
+
+/**
+ This function will create a SHELL BootOption to boot.
+
+ @param[in] None.
+
+ @retval EFI_DEVICE_PATH_PROTOCOL Shell Device path for booting.
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+BdsCreateShellDevicePath (
+ VOID
+ )
+{
+ UINTN FvHandleCount;
+ EFI_HANDLE *FvHandleBuffer;
+ UINTN Index;
+ EFI_STATUS Status;
+ EFI_FIRMWARE_VOLUME_PROTOCOL *Fv;
+ EFI_FV_FILETYPE Type;
+ UINTN Size;
+ EFI_FV_FILE_ATTRIBUTES Attributes;
+ UINT32 AuthenticationStatus;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ MEDIA_FW_VOL_FILEPATH_DEVICE_PATH ShellNode;
+
+ DevicePath = NULL;
+ Status = EFI_SUCCESS;
+
+ gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiFirmwareVolumeProtocolGuid,
+ NULL,
+ &FvHandleCount,
+ &FvHandleBuffer
+ );
+
+ for (Index = 0; Index < FvHandleCount; Index++) {
+ gBS->HandleProtocol (
+ FvHandleBuffer[Index],
+ &gEfiFirmwareVolumeProtocolGuid,
+ (VOID **) &Fv
+ );
+
+ Status = Fv->ReadFile (
+ Fv,
+ &gEfiShellFileGuid,
+ NULL,
+ &Size,
+ &Type,
+ &Attributes,
+ &AuthenticationStatus
+ );
+ if (EFI_ERROR (Status)) {
+ //
+ // Skip if no shell file in the FV
+ //
+ continue;
+ } else {
+ //
+ // Found the shell
+ //
+ break;
+ }
+ }
+
+ if (EFI_ERROR (Status)) {
+ //
+ // No shell present
+ //
+ if (FvHandleCount) {
+ FreePool (FvHandleBuffer);
+ }
+ return NULL;
+ }
+ //
+ // Build the shell boot option
+ //
+ DevicePath = DevicePathFromHandle (FvHandleBuffer[Index]);
+
+ //
+ // Build the shell device path
+ //
+ ShellNode.Header.Type = MEDIA_DEVICE_PATH;
+ ShellNode.Header.SubType = MEDIA_FV_FILEPATH_DP;
+ SetDevicePathNodeLength (&ShellNode.Header, sizeof (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH));
+ CopyMem (&ShellNode.NameGuid, &gEfiShellFileGuid, sizeof (EFI_GUID));
+ DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *) &ShellNode);
+
+ if (FvHandleCount) {
+ FreePool (FvHandleBuffer);
+ }
+
+ return DevicePath;
+}
+
+/**
+ This function will create a PXE BootOption to boot.
+
+ @param[in] DeviceIndex PXE handle index
+
+ @retval EFI_DEVICE_PATH_PROTOCOL PXE Device path for booting.
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+BdsCreatePxeDevicePath (
+ IN UINT16 DeviceIndex
+ )
+{
+ UINTN Index;
+ EFI_STATUS Status;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ UINTN NumberLoadFileHandles;
+ EFI_HANDLE *LoadFileHandles;
+ VOID *ProtocolInstance;
+
+ DevicePath = NULL;
+ Status = EFI_SUCCESS;
+
+ //
+ // We want everything connected up for PXE
+ //
+ BdsLibConnectAllDriversToAllControllers ();
+
+ //
+ // Parse Network Boot Device
+ //
+ gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiSimpleNetworkProtocolGuid,
+ NULL,
+ &NumberLoadFileHandles,
+ &LoadFileHandles
+ );
+ for (Index = 0; Index < NumberLoadFileHandles; Index++) {
+ Status = gBS->HandleProtocol (
+ LoadFileHandles[Index],
+ &gEfiLoadFileProtocolGuid,
+ (VOID **) &ProtocolInstance
+ );
+ if (EFI_ERROR (Status)) {
+ //
+ // try next handle
+ //
+ continue;
+ } else {
+ if (Index == DeviceIndex) {
+ //
+ // Found a PXE handle
+ //
+ break;
+ } else {
+ Status = EFI_UNSUPPORTED;
+ }
+ }
+ }
+
+ if (EFI_ERROR (Status)) {
+ //
+ // No PXE present
+ //
+ if (NumberLoadFileHandles) {
+ FreePool (LoadFileHandles);
+ }
+ return NULL;
+ }
+ //
+ // Build the PXE device path
+ //
+ DevicePath = DevicePathFromHandle (LoadFileHandles[Index]);
+
+ if (NumberLoadFileHandles) {
+ FreePool (LoadFileHandles);
+ }
+
+ return DevicePath;
+}
+
+BOOLEAN
+ComparePathNode(
+ IN EFI_DEVICE_PATH_PROTOCOL *PathNode1,
+ IN EFI_DEVICE_PATH_PROTOCOL *PathNode2
+)
+{
+ BOOLEAN st = FALSE;
+ UINTN Size1, Size2;
+ UINT8 *p1, *p2;
+
+ if ((PathNode1 == NULL) || (PathNode2 == NULL)) {
+ return FALSE;
+ }
+
+ if (PathNode1 == PathNode2) {
+ st = TRUE;
+ } else {
+ Size1 = DevicePathNodeLength(PathNode1);
+ Size2 = DevicePathNodeLength(PathNode2);
+ p1 = (UINT8 *)PathNode1;
+ p2 = (UINT8 *)PathNode2;
+ if ((Size1 == Size2)
+ && (DevicePathType(PathNode1) == DevicePathType(PathNode2))
+ && (CompareMem(p1+1, p2+1, Size1-1) == 0)) {
+ st = TRUE;
+ }
+ }
+
+ return st;
+}
+
+/**
+ Compare two device paths node by node up to MEDIA_DEVICE_PATH node
+
+ @param[in] BootOptionDP Device path acquired from BootXXXX EFI variable
+ @param[in] FileSysDP Device path acquired through EFI_SIMPLE_FILE_SYSTEM_PROTOCOL Handles buffer
+
+ @retval TRUE Both device paths point to the same device
+ @retval FALSE Device paths point to different devices
+**/
+BOOLEAN
+CompareDevicePaths(
+ IN EFI_DEVICE_PATH_PROTOCOL *BootOptionDP,
+ IN EFI_DEVICE_PATH_PROTOCOL *FileSysDP
+)
+{
+ EFI_DEVICE_PATH_PROTOCOL *DevPathNodeA;
+ EFI_DEVICE_PATH_PROTOCOL *DevPathNodeB;
+
+ if (BootOptionDP == NULL || FileSysDP == NULL) {
+ return FALSE;
+ }
+
+ DevPathNodeA = BdsLibUnpackDevicePath(BootOptionDP);
+ if (DevPathNodeA == NULL) {
+ return FALSE;
+ }
+
+ DevPathNodeB = BdsLibUnpackDevicePath(FileSysDP);
+ if (DevPathNodeB == NULL) {
+ return FALSE;
+ }
+
+ while (!IsDevicePathEnd(DevPathNodeB)) {
+ if (DevicePathType(DevPathNodeB) == MEDIA_DEVICE_PATH) {
+ //
+ // If we have reached MEDIA_DEVICE_PATH node and all previous
+ // nodes matched - we can be sure path points to the same device
+ //
+ return TRUE;
+ }
+
+ if (!ComparePathNode(DevPathNodeA, DevPathNodeB)) {
+ break;
+ }
+
+ DevPathNodeA = NextDevicePathNode(DevPathNodeA);
+ DevPathNodeB = NextDevicePathNode(DevPathNodeB);
+ }
+
+ return FALSE;
+}
+
+/**
+ Get EFI device path through EFI_SIMPLE_FILE_SYSTEM_PROTOCOL Handles buffer. Acquired path must
+ point to the same device as argument DevicePath passed to the function.
+
+ @param[in] DevicePath Device path acquired from BootXXXX EFI variable
+
+ @retval EFI_DEVICE_PATH_PROTOCOL Device path for booting
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+GetFullBootDevicePath(
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
+)
+{
+ EFI_STATUS Status;
+ EFI_DEVICE_PATH_PROTOCOL *DPath;
+ EFI_DEVICE_PATH_PROTOCOL *DevPath;
+ UINTN HandleNum;
+ EFI_HANDLE *HandleBuf;
+ UINTN Index;
+
+ DevPath = NULL;
+
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiSimpleFileSystemProtocolGuid,
+ NULL,
+ &HandleNum,
+ &HandleBuf
+ );
+ if ((EFI_ERROR (Status)) || (HandleBuf == NULL)) {
+ return NULL;
+ }
+
+ for (Index = 0; Index < HandleNum; Index++) {
+ Status = gBS->HandleProtocol (
+ HandleBuf[Index],
+ &gEfiDevicePathProtocolGuid,
+ &DPath
+ );
+
+ if (CompareDevicePaths(DevicePath, DPath)) {
+ DevPath = DuplicateDevicePath(DPath);
+ break;
+ }
+ }
+
+ return DevPath;
+}
+
+/*++
+ Translate ASF request type to BBS or EFI device path type
+
+ @param[in] DeviceType - ASF request type
+ @param[in] Efi - Set to TRUE if DeviceType is to be translated
+ to EFI device path type; FALSE if BBS type
+ @retval UINTN Translated device type
+--*/
+UINTN
+GetBootDeviceType (
+ IN UINTN DeviceType,
+ IN BOOLEAN Efi
+ )
+{
+ UINTN Type = 0;
+
+ switch (DeviceType) {
+ case FORCE_PXE:
+ if (Efi) {
+ Type = MEDIA_FILEPATH_DP;
+ } else {
+ Type = BBS_EMBED_NETWORK;
+ }
+ break;
+ case FORCE_HARDDRIVE:
+ case FORCE_SAFEMODE:
+ if (Efi) {
+ Type = MEDIA_HARDDRIVE_DP;
+ } else {
+ Type = BBS_TYPE_HARDDRIVE;
+ }
+ break;
+ case FORCE_DIAGNOSTICS:
+ if (Efi) {
+ Type = MEDIA_FILEPATH_DP;
+ }
+ break;
+ case FORCE_CDDVD:
+ if (Efi) {
+ Type = MEDIA_CDROM_DP;
+ } else {
+ Type = BBS_TYPE_CDROM;
+ }
+ break;
+ default:
+ break;
+ }
+
+ return Type;
+}
+
+/**
+ Update the BBS table with our required boot device
+
+ @param[in] DeviceIndex Boot device whose device index
+ @param[in] DevType Boot device whose device type
+ @param[in] BbsCount Number of BBS_TABLE structures
+ @param[in] BbsTable BBS entry
+ @param[in] IderBoot set to TRUE if this is IDER boot
+
+ @retval EFI_SUCCESS BBS table successfully updated
+**/
+EFI_STATUS
+RefreshBbsTableForBoot (
+ IN UINT16 DeviceIndex,
+ IN UINT16 DevType,
+ IN BOOLEAN IderBoot
+ )
+{
+ EFI_STATUS Status;
+ UINTN Index;
+ UINT16 TempIndex;
+ BOOLEAN IderBootDevice;
+ BOOLEAN RegularBootDevice;
+ HDD_INFO *LocalHddInfo;
+ EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
+ BBS_TABLE *BbsTable;
+ UINT16 HddCount;
+ UINT16 BbsCount;
+
+ TempIndex = (IderBoot) ? 0 : ((DeviceIndex <= 1) ? DeviceIndex : 1);
+
+ //
+ // Make sure the Legacy Boot Protocol is available
+ //
+ Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL, &LegacyBios);
+ if (LegacyBios == NULL) {
+ return EFI_ABORTED;
+ }
+
+ //
+ // Get BBS table instance
+ //
+ Status = LegacyBios->GetBbsInfo (
+ LegacyBios,
+ &HddCount,
+ &LocalHddInfo,
+ &BbsCount,
+ &BbsTable
+ );
+ if (EFI_ERROR (Status)) {
+ return EFI_ABORTED;
+ }
+
+ Status = EFI_NOT_FOUND;
+
+ //
+ // For debug
+ //
+ PrintBbsTable (BbsTable);
+
+ //
+ // Find the first present boot device whose device type
+ // matches the DevType, we use it to boot first. This is different
+ // from the other Bbs table refresh since we are looking for the device type
+ // index instead of the first device to match the device type.
+ //
+ // And set other present boot devices' priority to BBS_UNPRIORITIZED_ENTRY
+ // their priority will be set by LegacyBiosPlatform protocol by default
+ //
+ for (Index = 0; Index < BbsCount; Index++) {
+ if (BbsTable[Index].BootPriority == BBS_IGNORE_ENTRY) {
+ continue;
+ }
+
+ BbsTable[Index].BootPriority = BBS_DO_NOT_BOOT_FROM;
+ IderBootDevice = IderBoot && IS_IDER(BbsTable[Index].Bus, BbsTable[Index].Device, BbsTable[Index].Function) &&
+ BbsTable[Index].DeviceType == DevType;
+ RegularBootDevice = !IderBoot && (BbsTable[Index].DeviceType == DevType ||
+ (DevType == BBS_EMBED_NETWORK && IS_PXE(BbsTable[Index].DeviceType, BbsTable[Index].Class)) ||
+ (DevType == BBS_TYPE_CDROM && IS_CDROM(BbsTable[Index].DeviceType, BbsTable[Index].Class)));
+
+ if ((IderBootDevice || RegularBootDevice) && Status != EFI_SUCCESS) {
+ if (IderBoot || (TempIndex++ == DeviceIndex)) {
+ BbsTable[Index].BootPriority = 0;
+ Status = EFI_SUCCESS;
+ continue;
+ }
+ }
+ }
+
+ //
+ // For debug
+ //
+ PrintBbsTable (BbsTable);
+
+ return Status;
+}
+
+EFI_DEVICE_PATH_PROTOCOL *
+BdsCreateBootDevicePath (
+ IN UINT16 DeviceType,
+ IN UINT16 DeviceIndex,
+ IN BOOLEAN IdeRBoot,
+ IN BOOLEAN EfiBoot
+ )
+{
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
+ EFI_DEVICE_PATH_PROTOCOL *FullDevicePath;
+ UINTN OptionOrderSize;
+ UINT16 *OptionOrder;
+ EFI_LOAD_OPTION *Option;
+ CHAR16 OptionName[sizeof ("Driver####")];
+ UINT16 OptionNumber;
+ UINTN OptionIndex;
+ UINTN OptionCount;
+ UINTN Index;
+ UINTN OptionSize;
+ UINTN TempIndex;
+ EFI_DEVICE_PATH_PROTOCOL *DevPathNode;
+ EFI_DEVICE_PATH_PROTOCOL *DevPathNodeBackup;
+ ATAPI_DEVICE_PATH *AtaPath;
+ BOOLEAN AtaDeviceMatch;
+ PCI_DEVICE_PATH *PciPath;
+ BOOLEAN PciDeviceMatch;
+ UINT8 PrimarySecondary;
+ UINT8 SlaveMaster;
+ UINTN EfiDeviceType;
+ UINTN LegacyDeviceType;
+ BOOLEAN TypeMatched;
+
+ PrimarySecondary = ((mAsfBootOptions->SpecialCommandParam >> IDER_BOOT_DEVICE_SHIFT) & IDER_PRIMARY_SECONDARY_MASK)
+ >> IDER_PRIMARY_SECONDARY_SHIFT;
+ SlaveMaster = (mAsfBootOptions->SpecialCommandParam >> IDER_BOOT_DEVICE_SHIFT) & IDER_MASTER_SLAVE_MASK;
+ DevicePath = NULL;
+ FullDevicePath = NULL;
+ TempIndex = 1;
+ AtaDeviceMatch = FALSE;
+ PciDeviceMatch = FALSE;
+ EfiDeviceType = GetBootDeviceType(DeviceType, TRUE);
+ LegacyDeviceType = GetBootDeviceType(DeviceType, FALSE);
+ TypeMatched = FALSE;
+
+ if (IdeRBoot && !EfiBoot) {
+ LegacyDeviceType = (SlaveMaster == 1) ? BBS_CDROM : BBS_HARDDISK;
+ }
+
+ //
+ // Read the BootOrder variable.
+ //
+ OptionOrder = BdsLibGetVariableAndSize (L"BootOrder", &gEfiGlobalVariableGuid, &OptionOrderSize);
+ if (OptionOrder == NULL) {
+ return NULL;
+ }
+
+ OptionCount = OptionOrderSize/sizeof(UINT16);
+ OptionIndex = 0;
+
+ for (Index = 0; Index < OptionCount; Index++) {
+
+ OptionNumber = OptionOrder[Index];
+ UnicodeSPrint (OptionName, sizeof (OptionName), L"Boot%04x", OptionNumber);
+ Option = BdsLibGetVariableAndSize (OptionName, &gEfiGlobalVariableGuid, &OptionSize);
+ if (Option == NULL) {
+ continue;
+ }
+
+ //
+ // Extract device path from the boot order entry
+ //
+ TempDevicePath = (EFI_DEVICE_PATH_PROTOCOL*)
+ ( //skip the header
+ (UINT8*)(Option+1)
+ //skip the string
+ +(EfiStrLen((CHAR16*)(Option+1))+1)*sizeof(CHAR16)
+ );
+
+ if (DevicePathType(TempDevicePath) == BBS_DEVICE_PATH && DevicePathSubType(TempDevicePath) == BBS_BBS_DP) {
+ FullDevicePath = DuplicateDevicePath(TempDevicePath);
+ } else {
+ //
+ // If this is EFI boot option, we need to get full device path from EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
+ // to determine type of device and provide LoadImage with proper path to bootloader image later on
+ //
+ FullDevicePath = GetFullBootDevicePath(TempDevicePath);
+ if (FullDevicePath == NULL) {
+ continue;
+ }
+ }
+
+ TempDevicePath = FullDevicePath;
+ DevPathNode = BdsLibUnpackDevicePath(TempDevicePath);
+ if (DevPathNode == NULL) {
+ continue;
+ }
+
+ DevPathNodeBackup = DevPathNode;
+
+ //
+ // Check if this is our requested boot device
+ //
+ while (!IsDevicePathEnd(DevPathNode)) {
+ if (IdeRBoot && EfiBoot) {
+ //
+ // IDER EFI boot, check for PCI/ATA device match
+ //
+ if ((DevicePathType(DevPathNode) == HARDWARE_DEVICE_PATH) &&
+ (DevicePathSubType(DevPathNode) == HW_PCI_DP)) {
+ PciPath = (PCI_DEVICE_PATH*) DevPathNode;
+
+ if ((PciPath->Device == IDER_DEVICE_NUMBER)
+ && (PciPath->Function == IDER_FUNCTION_NUMBER)) {
+ PciDeviceMatch = TRUE;
+ }
+ } else if ((DevicePathType(DevPathNode) == MESSAGING_DEVICE_PATH) &&
+ (DevicePathSubType(DevPathNode) == MSG_ATAPI_DP)) {
+ AtaPath = (ATAPI_DEVICE_PATH*) DevPathNode;
+
+ if ((AtaPath->PrimarySecondary == PrimarySecondary)
+ && (AtaPath->SlaveMaster == SlaveMaster)) {
+ AtaDeviceMatch = TRUE;
+ }
+ }
+
+ if (PciDeviceMatch && AtaDeviceMatch) {
+ TypeMatched = TRUE;
+ }
+ } else {
+ if (DevicePathType(DevPathNode) == BBS_DEVICE_PATH && DevicePathSubType(DevPathNode) == BBS_BBS_DP) {
+ //
+ // Legacy boot option
+ //
+ if (((BBS_BBS_DEVICE_PATH *)DevPathNode)->DeviceType == LegacyDeviceType) {
+ TypeMatched = TRUE;
+ }
+ } else {
+ //
+ // EFI boot option
+ //
+ if (DevicePathType(DevPathNode) == MEDIA_DEVICE_PATH && DevicePathSubType(DevPathNode) == EfiDeviceType) {
+ TypeMatched = TRUE;
+ }
+ }
+ }
+
+ if (TypeMatched) {
+ //
+ // Type matched, check for device index
+ //
+ if (!IdeRBoot && TempIndex < DeviceIndex) {
+ TempIndex++;
+ TypeMatched = FALSE;
+ break;
+ }
+
+ DevicePath = DuplicateDevicePath(TempDevicePath);
+ //
+ // Refresh BBS table if legacy option
+ //
+ if (DevicePathType(DevicePath) == BBS_DEVICE_PATH && DevicePathSubType(DevicePath) == BBS_BBS_DP) {
+ RefreshBbsTableForBoot(DeviceIndex, (UINT16)LegacyDeviceType, IdeRBoot);
+ }
+ break;
+ }
+
+ DevPathNode = NextDevicePathNode(DevPathNode);
+ }
+
+ if (FullDevicePath != NULL) {
+ FreePool(FullDevicePath);
+ FullDevicePath = NULL;
+ }
+
+ FreePool(DevPathNodeBackup);
+ FreePool(Option);
+
+ if (DevicePath != NULL) {
+ //
+ // Set Boot Current and leave
+ //
+ gRT->SetVariable (
+ L"BootCurrent",
+ &gEfiGlobalVariableGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
+ sizeof (UINT16),
+ &OptionNumber
+ );
+ break;
+ }
+ }
+
+ FreePool(OptionOrder);
+
+ return DevicePath;
+}
+
+/**
+ Boot the legacy system with the boot option
+
+ @param[in] Option The legacy boot option which have BBS device path
+
+ @retval EFI_UNSUPPORTED - There is no legacybios protocol, do not support legacy boot.
+ @retval EFI_STATUS - Return the status of LegacyBios->LegacyBoot ().
+**/
+EFI_STATUS
+AsfDoLegacyBoot (
+ IN BDS_COMMON_OPTION *Option
+ )
+{
+ EFI_STATUS Status;
+ EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
+
+ Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL, &LegacyBios);
+ if (EFI_ERROR (Status)) {
+ //
+ // If no LegacyBios protocol we do not support legacy boot
+ //
+ return EFI_UNSUPPORTED;
+ }
+ //
+ // Write boot to OS performance data to a file
+ //
+ WRITE_BOOT_TO_OS_PERFORMANCE_DATA;
+
+ DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Legacy Boot: %S\n", Option->Description));
+ return LegacyBios->LegacyBoot (
+ LegacyBios,
+ (BBS_BBS_DEVICE_PATH *) Option->DevicePath,
+ Option->LoadOptionsSize,
+ Option->LoadOptions
+ );
+}
+
+/**
+ Process the boot option follow the EFI 1.1 specification and
+ special treat the legacy boot option with BBS_DEVICE_PATH.
+
+ @param[in] Option The boot option need to be processed
+ @param[in] DevicePath The device path which describe where to load
+ the boot image or the legcy BBS device path
+ to boot the legacy OS
+ @param[in] ExitDataSize Returned directly from gBS->StartImage ()
+ @param[in] ExitData Returned directly from gBS->StartImage ()
+
+ @retval EFI_SUCCESS - Status from gBS->StartImage (),
+ or BdsBootByDiskSignatureAndPartition ()
+ @retval EFI_NOT_FOUND - If the Device Path is not found in the system
+**/
+EFI_STATUS
+AsfBootViaBootOption (
+ IN BDS_COMMON_OPTION * Option,
+ IN EFI_DEVICE_PATH_PROTOCOL * DevicePath,
+ OUT UINTN *ExitDataSize,
+ OUT CHAR16 **ExitData OPTIONAL
+ )
+{
+ EFI_STATUS Status;
+ EFI_HANDLE Handle;
+ EFI_HANDLE ImageHandle;
+ EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
+ EFI_DEVICE_PATH_PROTOCOL *FilePath;
+ EFI_LOADED_IMAGE_PROTOCOL *ImageInfo;
+ EFI_EVENT ReadyToBootEvent;
+ EFI_ACPI_S3_SAVE_PROTOCOL *AcpiS3Save;
+ UINTN DataSize;
+ EFI_INPUT_KEY Key;
+ UINTN EventIndex;
+#ifdef EFI_DEBUG
+ UINT8 SecureBootState;
+#endif
+
+ *ExitDataSize = 0;
+ *ExitData = NULL;
+ DataSize = sizeof(UINT16);
+
+ //
+ // Notes: put EFI64 ROM Shadow Solution
+ //
+ EFI64_SHADOW_ALL_LEGACY_ROM ();
+
+ //
+ // Notes: this code can be remove after the s3 script table
+ // hook on the event EFI_EVENT_SIGNAL_READY_TO_BOOT or
+ // EFI_EVENT_SIGNAL_LEGACY_BOOT
+ //
+ Status = gBS->LocateProtocol (&gEfiAcpiS3SaveGuid, NULL, &AcpiS3Save);
+ if (!EFI_ERROR (Status)) {
+ AcpiS3Save->S3Save (AcpiS3Save, NULL);
+ }
+ //
+ // If it's Device Path that starts with a hard drive path,
+ // this routine will do the booting.
+ //
+ Status = BdsBootByDiskSignatureAndPartition (
+ Option,
+ (HARDDRIVE_DEVICE_PATH *) DevicePath,
+ Option->LoadOptionsSize,
+ Option->LoadOptions,
+ ExitDataSize,
+ ExitData
+ );
+ if (!EFI_ERROR (Status)) {
+ //
+ // If we found a disk signature and partition device path return success
+ //
+ return EFI_SUCCESS;
+ }
+
+ //
+ // Set Option's BootCurrent field
+ //
+ gRT->GetVariable (
+ L"BootCurrent",
+ &gEfiGlobalVariableGuid,
+ 0,
+ &DataSize,
+ &Option->BootCurrent
+ );
+
+ DEBUG ((EFI_D_INFO, "AsfBootViaBootOption: BootCurrent = %d, DevicePath = %s\n", Option->BootCurrent, DevicePathToStr(DevicePath)));
+
+ //
+ // Signal the EFI_EVENT_SIGNAL_READY_TO_BOOT event
+ //
+ Status = EfiCreateEventReadyToBoot (&ReadyToBootEvent);
+ if (!EFI_ERROR (Status)) {
+ gBS->SignalEvent (ReadyToBootEvent);
+ gBS->CloseEvent (ReadyToBootEvent);
+ }
+
+ if ((DevicePathType (Option->DevicePath) == BBS_DEVICE_PATH) &&
+ (DevicePathSubType (Option->DevicePath) == BBS_BBS_DP)
+ ) {
+ //
+ // Check to see if we should legacy BOOT. If yes then do the legacy boot
+ //
+ return AsfDoLegacyBoot (Option);
+ }
+
+ DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Booting EFI 1.1 way %S\n", Option->Description));
+
+ //
+ // If this is RCO/IDER EFI Boot, don't allow returning to regular boot
+ // and booting other devices
+ //
+ while (1) {
+ Status = gBS->LoadImage (
+ TRUE,
+ mBdsImageHandle,
+ DevicePath,
+ NULL,
+ 0,
+ &ImageHandle
+ );
+
+ //
+ // If we didn't find an image, we may need to load the default
+ // boot behavior for the device.
+ //
+ if (EFI_ERROR (Status)) {
+ //
+ // Find a Simple File System protocol on the device path. If the remaining
+ // device path is set to end then no Files are being specified, so try
+ // the removable media file name.
+ //
+ TempDevicePath = DevicePath;
+ Status = gBS->LocateDevicePath (
+ &gEfiSimpleFileSystemProtocolGuid,
+ &TempDevicePath,
+ &Handle
+ );
+ if (!EFI_ERROR (Status) && IsDevicePathEnd (TempDevicePath)) {
+ FilePath = FileDevicePath (Handle, DEFAULT_REMOVABLE_FILE_NAME);
+ if (FilePath) {
+ Status = gBS->LoadImage (
+ TRUE,
+ mBdsImageHandle,
+ FilePath,
+ NULL,
+ 0,
+ &ImageHandle
+ );
+ } else {
+ Status = EFI_NOT_FOUND;
+ }
+ } else {
+ Status = EFI_NOT_FOUND;
+ }
+ }
+
+ if (!EFI_ERROR (Status)) {
+ //
+ // Provide the image with it's load options
+ //
+ Status = gBS->HandleProtocol (ImageHandle, &gEfiLoadedImageProtocolGuid, &ImageInfo);
+ ASSERT_EFI_ERROR (Status);
+
+ if (Option->LoadOptionsSize != 0) {
+ ImageInfo->LoadOptionsSize = Option->LoadOptionsSize;
+ ImageInfo->LoadOptions = Option->LoadOptions;
+ }
+
+#ifdef EFI_DEBUG
+ //
+ // Get SecureBoot state
+ //
+ SecureBootState = GetSecureBootState();
+ DEBUG ((EFI_D_INFO | EFI_D_LOAD, "SecureBootEnable value prior to image execution %d\n", SecureBootState));
+#endif
+ //
+ // Before calling the image, enable the Watchdog Timer for
+ // the 5 Minute period
+ //
+ gBS->SetWatchdogTimer (5 * 60, 0x0000, 0x00, NULL);
+
+ Status = gBS->StartImage (ImageHandle, ExitDataSize, ExitData);
+ DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Image Return Status = %r\n", Status));
+
+ //
+ // Clear the Watchdog Timer after the image returns
+ //
+ gBS->SetWatchdogTimer (0x0000, 0x0000, 0x0000, NULL);
+ }
+
+ //
+ // Display message to user before attempting another RCO/IDER boot
+ //
+ gST->ConOut->ClearScreen (gST->ConOut);
+ gST->ConOut->OutputString (
+ gST->ConOut,
+ L"EFI RCO/IDER boot failed. Press ENTER to try again\r\n"
+ );
+ Key.ScanCode = 0;
+ Key.UnicodeChar = 0;
+ while (!(Key.ScanCode == 0 && Key.UnicodeChar == L'\r')) {
+ gBS->WaitForEvent (1, &(gST->ConIn->WaitForKey), &EventIndex);
+ gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
+ }
+ }
+
+ //
+ // Clear Boot Current
+ //
+ gRT->SetVariable (
+ L"BootCurrent",
+ &gEfiGlobalVariableGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
+ 0,
+ &Option->BootCurrent
+ );
+
+ return Status;
+}
+
+/**
+ Found out ASF boot options.
+
+ @param[in] EfiBoot Set to TRUE if this is EFI boot
+
+ @retval EFI_DEVICE_PATH_PROTOCOL Device path for booting.
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+BdsAsfBoot (
+ IN BOOLEAN EfiBoot
+ )
+{
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+
+ DevicePath = NULL;
+
+ //
+ // First we check ASF boot options Special Command
+ //
+ switch (mAsfBootOptions->SpecialCommand) {
+ //
+ // No additional special command is included; the Special Command Parameter has no
+ // meaning.
+ //
+ case NOP:
+ break;
+
+ //
+ // The Special Command Parameter can be used to specify a PXE
+ // parameter. When the parameter value is 0, the system default PXE device is booted. All
+ // other values for the PXE parameter are reserved for future definition by this specification.
+ //
+ case FORCE_PXE:
+ if (mAsfBootOptions->SpecialCommandParam != 0) {
+ //
+ // ASF spec says 0 currently only option
+ //
+ break;
+ }
+
+ if (EfiBoot == TRUE) {
+ DevicePath = BdsCreatePxeDevicePath (mAsfBootOptions->SpecialCommandParam);
+ } else {
+ DevicePath = BdsCreateBootDevicePath (FORCE_PXE, mAsfBootOptions->SpecialCommandParam, FALSE, EfiBoot);
+ }
+ break;
+
+ //
+ // The Special Command Parameter identifies the boot-media index for
+ // the managed client. When the parameter value is 0, the default hard-drive is booted, when the
+ // parameter value is 1, the primary hard-drive is booted; when the value is 2, the secondary
+ // hard-drive is booted and so on.
+ //
+ case FORCE_HARDDRIVE:
+ //
+ // The Special Command Parameter identifies the boot-media
+ // index for the managed client. When the parameter value is 0, the default hard-drive is
+ // booted, when the parameter value is 1, the primary hard-drive is booted; when the value is 2,
+ // the secondary hard-drive is booted and so on.
+ //
+ case FORCE_SAFEMODE:
+ DevicePath = BdsCreateBootDevicePath(FORCE_HARDDRIVE, mAsfBootOptions->SpecialCommandParam, FALSE, EfiBoot);
+ break;
+
+ //
+ // The Special Command Parameter can be used to specify a
+ // diagnostic parameter. When the parameter value is 0, the default diagnostic media is booted.
+ // All other values for the diagnostic parameter are reserved for future definition by this
+ // specification.
+ //
+ case FORCE_DIAGNOSTICS:
+ if (mAsfBootOptions->SpecialCommandParam != 0) {
+ //
+ // ASF spec says 0 currently only option
+ //
+ break;
+ }
+
+ DevicePath = BdsCreateShellDevicePath ();
+
+ //
+ // We want everything connected up for shell
+ //
+ BdsLibConnectAllDriversToAllControllers ();
+ break;
+
+ //
+ // The Special Command Parameter identifies the boot-media index for
+ // the managed client. When the parameter value is 0, the default CD/DVD is booted, when the
+ // parameter value is 1, the primary CD/DVD is booted; when the value is 2, the secondary
+ // CD/DVD is booted and so on.
+ //
+ case FORCE_CDDVD:
+ DevicePath = BdsCreateBootDevicePath (FORCE_CDDVD, mAsfBootOptions->SpecialCommandParam, FALSE, EfiBoot);
+ break;
+
+ default:
+ break;;
+ }
+
+ return DevicePath;
+}
+
+/**
+ Check IdeR boot device and Asf boot device
+
+ @param[in] EfiBoot Set to TRUE if this is EFI boot
+
+ @retval EFI_DEVICE_PATH_PROTOCOL Device path for booting.
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+BdsForcedBoot (
+ IN BOOLEAN EfiBoot
+ )
+{
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+
+ DevicePath = NULL;
+
+ //
+ // OEM command values; the interpretation of the Special Command and associated Special
+ // Command Parameters is defined by the entity associated with the Enterprise ID.
+ //
+ if (ActiveManagementEnableIdeR ()) {
+ //
+ // Check if any media exist in Ider device
+ //
+ if (BdsCheckIderMedia ()) {
+ DevicePath = BdsCreateBootDevicePath (
+ FORCE_CDDVD,
+ 0,
+ TRUE,
+ EfiBoot
+ );
+ }
+ } else if (mAsfBootOptions->IanaId != ASF_INDUSTRY_CONVERTED_IANA) {
+ DevicePath = BdsAsfBoot (EfiBoot);
+ }
+
+ return DevicePath;
+}
+
+/**
+ Process ASF boot options and if available, attempt the boot
+
+ @param[in] None.
+
+ @retval EFI_SUCCESS The command completed successfully
+**/
+EFI_STATUS
+BdsBootViaAsf (
+ IN VOID
+ )
+{
+ EFI_STATUS Status;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ BDS_COMMON_OPTION *BootOption;
+ UINTN ExitDataSize;
+ CHAR16 *ExitData;
+ BOOLEAN EfiBoot;
+ EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
+
+ Status = EFI_SUCCESS;
+ DevicePath = NULL;
+ EfiBoot = FALSE;
+
+ //
+ // Check if this is legacy or efi boot
+ //
+ Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL, &LegacyBios);
+ if (LegacyBios == NULL) {
+ EfiBoot = TRUE;
+ }
+
+ //
+ // Check if ASF Boot Options is present.
+ //
+ if (mAsfBootOptions->SubCommand != ASF_BOOT_OPTIONS_PRESENT) {
+ return EFI_NOT_FOUND;
+ }
+
+ DevicePath = BdsForcedBoot (EfiBoot);
+ //
+ // If device path was set, the we have a boot option to use
+ //
+ if (DevicePath == NULL) {
+ return EFI_UNSUPPORTED;
+ }
+
+ BootOption = BdsCreateBootOption (DevicePath, L"ASF Boot");
+ if (BootOption == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Status = AsfBootViaBootOption (BootOption, BootOption->DevicePath, &ExitDataSize, &ExitData);
+
+ FreePool (BootOption);
+ FreePool (DevicePath);
+
+ return Status;
+}
+
+/**
+ This will return if Media in IDE-R is present.
+
+ @param[in] None.
+
+ @retval TRUE Media is present.
+ @retval FALSE Media is not present.
+**/
+BOOLEAN
+BdsCheckIderMedia (
+ IN VOID
+ )
+{
+ UINTN HandleNum;
+ EFI_HANDLE *HandleBuf;
+ EFI_HANDLE Handle;
+ EFI_STATUS Status;
+ EFI_DEVICE_PATH_PROTOCOL *DPath;
+ UINTN Index;
+ UINTN EventIndex;
+ EFI_INPUT_KEY Key;
+ EFI_BLOCK_IO_PROTOCOL *BlkIo;
+ EFI_DISK_INFO_PROTOCOL *DiskInfo;
+ EFI_BLOCK_IO_MEDIA *BlkMedia;
+ VOID *Buffer;
+ UINT8 IdeBootDevice;
+ UINT32 IdeChannel;
+ UINT32 IdeDevice;
+
+ IdeBootDevice = ActiveManagementIderBootDeviceGet ();
+
+ DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Ide Channel Device Index = %d\n", IdeBootDevice));
+
+ //
+ // Make sure the Legacy Boot Protocol is available
+ //
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiBlockIoProtocolGuid,
+ NULL,
+ &HandleNum,
+ &HandleBuf
+ );
+ if ((EFI_ERROR (Status)) || (HandleBuf == NULL)) {
+ goto Exit;
+ }
+
+ for (Index = 0; Index < HandleNum; Index++) {
+ Status = gBS->HandleProtocol (
+ HandleBuf[Index],
+ &gEfiDevicePathProtocolGuid,
+ &DPath
+ );
+ if (EFI_ERROR (Status)) {
+ continue;
+ }
+
+ Status = gBS->LocateDevicePath (
+ &gEfiIderControllerDriverProtocolGuid,
+ &DPath,
+ &Handle
+ );
+ if (EFI_ERROR (Status)) {
+ continue;
+ }
+
+ Status = gBS->HandleProtocol (
+ HandleBuf[Index],
+ &gEfiBlockIoProtocolGuid,
+ &BlkIo
+ );
+
+ if (EFI_ERROR(Status)) {
+ continue;
+ }
+
+ Status = gBS->HandleProtocol (
+ HandleBuf[Index],
+ &gEfiDiskInfoProtocolGuid,
+ &DiskInfo
+ );
+
+ if (EFI_ERROR(Status)) {
+ continue;
+ }
+
+ DiskInfo->WhichIde (DiskInfo, &IdeChannel, &IdeDevice);
+
+ if (IdeBootDevice != (UINT8) (IdeChannel * 2 + IdeDevice)) {
+ continue;
+ }
+
+ if (BlkIo->Media->MediaPresent) {
+ if (HandleBuf != NULL) {
+ FreePool (HandleBuf);
+ }
+ return TRUE;
+ }
+
+ while (TRUE) {
+ BlkMedia = BlkIo->Media;
+ Buffer = AllocatePool (BlkMedia->BlockSize);
+ if (Buffer) {
+ BlkIo->ReadBlocks (
+ BlkIo,
+ BlkMedia->MediaId,
+ 0,
+ BlkMedia->BlockSize,
+ Buffer
+ );
+ FreePool (Buffer);
+ }
+
+ if (BlkMedia->MediaPresent) {
+ if (HandleBuf != NULL) {
+ FreePool (HandleBuf);
+ }
+ return TRUE;
+ }
+
+ gST->ConOut->OutputString (
+ gST->ConOut,
+ L"Boot disk missing, please insert boot disk and press ENTER\r\n"
+ );
+ Key.ScanCode = 0;
+ Key.UnicodeChar = 0;
+ gBS->RestoreTPL (EFI_TPL_APPLICATION);
+ while (!(Key.ScanCode == 0 && Key.UnicodeChar == L'\r')) {
+ Status = gBS->WaitForEvent (1, &(gST->ConIn->WaitForKey), &EventIndex);
+ gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
+ }
+
+ gBS->RaiseTPL (EFI_TPL_DRIVER);
+ }
+
+ break;
+ }
+
+Exit:
+ if (HandleBuf != NULL) {
+ FreePool (HandleBuf);
+ }
+ return FALSE;
+}
diff --git a/ReferenceCode/ME/SampleCode/AsfSupport/AsfSupport.h b/ReferenceCode/ME/SampleCode/AsfSupport/AsfSupport.h
new file mode 100644
index 0000000..dad873d
--- /dev/null
+++ b/ReferenceCode/ME/SampleCode/AsfSupport/AsfSupport.h
@@ -0,0 +1,162 @@
+/** @file
+ ASF BDS Support include file
+
+@copyright
+ Copyright (c) 2005-2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _ASF_SUPPORT_H_
+#define _ASF_SUPPORT_H_
+
+#include "EdkIIGlueDxe.h"
+#include "BdsLib.h"
+#include "Pci22.h"
+#include "Amt.h"
+#include "AmtLib.h"
+#include "MeAccess.h"
+
+#include EFI_PROTOCOL_DEFINITION (LegacyBios)
+#include EFI_PROTOCOL_DEFINITION (SimpleNetwork)
+#include EFI_PROTOCOL_DEFINITION (FirmwareVolume)
+#include EFI_PROTOCOL_DEFINITION (PciRootBridgeIo)
+
+#include EFI_PROTOCOL_CONSUMER (AlertStandardformat)
+#include EFI_PROTOCOL_CONSUMER (DiskInfo)
+
+#include EFI_PROTOCOL_DEFINITION (IderControllerDriver)
+
+#define IDER_PRIMARY_SECONDARY_MASK 0x02
+#define IDER_MASTER_SLAVE_MASK 0x01
+#define IDER_PRIMARY_SECONDARY_SHIFT 1
+
+#define IS_IDER(BUS, DEVICE,FUNCTION) \
+ (BUS == ME_BUS && DEVICE == ME_DEVICE_NUMBER && FUNCTION == IDER_FUNCTION_NUMBER)
+#define IS_PXE(TYPE, CLASS) \
+ (TYPE == BBS_TYPE_BEV && CLASS == PCI_CLASS_NETWORK)
+#define IS_CDROM(TYPE, CLASS) \
+ (TYPE == BBS_TYPE_BEV && CLASS == PCI_CLASS_MASS_STORAGE)
+
+#define SECURE_BOOT_ENABLED 1
+#define SECURE_BOOT_DISABLED 0
+
+#define RESTORE_SECURE_BOOT_NONE 0
+#define RESTORE_SECURE_BOOT_ENABLED 1
+
+#define RESTORE_SECURE_BOOT_GUID \
+ { \
+ 0x118b3c6f, 0x98d6, 0x4d05, 0x96, 0xb2, 0x90, 0xe4, 0xcb, 0xb7, 0x40, 0x34 \
+ }
+
+typedef union {
+ UINT32 Data32;
+ UINT16 Data16[2];
+} DATA32_UNION;
+
+/**
+ Retrieve the ASF boot options previously recorded by the ASF driver.
+
+ @param[in] None.
+
+ @retval EFI_SUCCESS Initialized Boot Options global variable and AMT protocol
+**/
+EFI_STATUS
+BdsAsfInitialization (
+ IN VOID
+ )
+;
+
+/**
+ This routine makes necessary Secure Boot & CSM state changes for IDEr boot
+
+ @param[in] None.
+
+ @retval EFI_SUCCESS Changes applied succesfully
+**/
+EFI_STATUS
+ManageSecureBootState(
+ IN VOID
+ )
+;
+
+/**
+ This function will create a BootOption from the give device path and
+ description string.
+
+ @param[in] DevicePath The device path which the option represent
+ @param[in] Description The description of the boot option
+
+ @retval BDS_COMMON_OPTION - Pointer to created boot option
+**/
+BDS_COMMON_OPTION *
+BdsCreateBootOption (
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
+ IN CHAR16 *Description
+ )
+;
+
+/**
+ Dump all devices of BBS.
+
+ @param[in] LocalBbsTable BBS table entry.
+**/
+VOID
+PrintBbsTable (
+ IN BBS_TABLE *LocalBbsTable
+ )
+;
+
+/**
+ This will return if Media in IDE-R is present.
+
+ @param[in] None.
+
+ @retval TRUE Media is present.
+ @retval FALSE Media is not present.
+**/
+BOOLEAN
+BdsCheckIderMedia (
+ IN VOID
+ )
+;
+
+/**
+ This function will create a SHELL BootOption to boot.
+
+ @param[in] None.
+
+ @retval EFI_DEVICE_PATH_PROTOCOL Shell Device path for booting.
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+BdsCreateShellDevicePath (
+ VOID
+ )
+;
+
+/**
+ This function will create a BootOption from the give device path and
+ description string.
+
+ @param[in] DevicePath The device path which the option represent
+ @param[in] Description The description of the boot option
+
+ @retval BDS_COMMON_OPTION - Pointer to created boot option
+**/
+BDS_COMMON_OPTION *
+BdsCreateBootOption (
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
+ IN CHAR16 *Description
+ )
+;
+
+#endif
diff --git a/ReferenceCode/ME/SampleCode/Include/Acpi1_0.h b/ReferenceCode/ME/SampleCode/Include/Acpi1_0.h
new file mode 100644
index 0000000..71c6624
--- /dev/null
+++ b/ReferenceCode/ME/SampleCode/Include/Acpi1_0.h
@@ -0,0 +1,297 @@
+/** @file
+ ACPI 1.0b definitions from the ACPI Specification, revision 1.0b
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains 'Framework Code' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may not be modified, except as allowed by
+ additional terms of your license agreement.
+**/
+#ifndef _ACPI_1_0_H_
+#define _ACPI_1_0_H_
+
+//
+// Statements that include other files
+//
+#include "Tiano.h"
+#include "Acpi.h"
+
+//
+// Ensure proper structure formats
+//
+#pragma pack(1)
+///
+/// ACPI 1.0b table structures
+///
+///
+/// Root System Description Pointer Structure
+///
+typedef struct {
+ UINT64 Signature;
+ UINT8 Checksum;
+ UINT8 OemId[6];
+ UINT8 Reserved;
+ UINT32 RsdtAddress;
+} EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER;
+
+///
+/// Root System Description Table
+/// No definition needed as it is a common description table header followed by a
+/// variable number of UINT32 table pointers.
+///
+///
+/// RSDT Revision (as defined in ACPI 1.0b spec.)
+///
+#define EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_TABLE_REVISION 0x01
+
+///
+/// Fixed ACPI Description Table Structure (FADT)
+///
+typedef struct {
+ EFI_ACPI_DESCRIPTION_HEADER Header;
+ UINT32 FirmwareCtrl;
+ UINT32 Dsdt;
+ UINT8 IntModel;
+ UINT8 Reserved1;
+ UINT16 SciInt;
+ UINT32 SmiCmd;
+ UINT8 AcpiEnable;
+ UINT8 AcpiDisable;
+ UINT8 S4BiosReq;
+ UINT8 Reserved2;
+ UINT32 Pm1aEvtBlk;
+ UINT32 Pm1bEvtBlk;
+ UINT32 Pm1aCntBlk;
+ UINT32 Pm1bCntBlk;
+ UINT32 Pm2CntBlk;
+ UINT32 PmTmrBlk;
+ UINT32 Gpe0Blk;
+ UINT32 Gpe1Blk;
+ UINT8 Pm1EvtLen;
+ UINT8 Pm1CntLen;
+ UINT8 Pm2CntLen;
+ UINT8 PmTmLen;
+ UINT8 Gpe0BlkLen;
+ UINT8 Gpe1BlkLen;
+ UINT8 Gpe1Base;
+ UINT8 Reserved3;
+ UINT16 PLvl2Lat;
+ UINT16 PLvl3Lat;
+ UINT16 FlushSize;
+ UINT16 FlushStride;
+ UINT8 DutyOffset;
+ UINT8 DutyWidth;
+ UINT8 DayAlrm;
+ UINT8 MonAlrm;
+ UINT8 Century;
+ UINT8 Reserved4;
+ UINT8 Reserved5;
+ UINT8 Reserved6;
+ UINT32 Flags;
+} EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE;
+
+///
+/// FADT Version (as defined in ACPI 1.0b spec.)
+///
+#define EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION 0x01
+
+//
+// Fixed ACPI Description Table Fixed Feature Flags
+// All other bits are reserved and must be set to 0.
+//
+#define EFI_ACPI_1_0_WBINVD (1 << 0)
+#define EFI_ACPI_1_0_WBINVD_FLUSH (1 << 1)
+#define EFI_ACPI_1_0_PROC_C1 (1 << 2)
+#define EFI_ACPI_1_0_P_LVL2_UP (1 << 3)
+#define EFI_ACPI_1_0_PWR_BUTTON (1 << 4)
+#define EFI_ACPI_1_0_SLP_BUTTON (1 << 5)
+#define EFI_ACPI_1_0_FIX_RTC (1 << 6)
+#define EFI_ACPI_1_0_RTC_S4 (1 << 7)
+#define EFI_ACPI_1_0_TMR_VAL_EXT (1 << 8)
+#define EFI_ACPI_1_0_DCK_CAP (1 << 9)
+
+///
+/// Firmware ACPI Control Structure
+///
+typedef struct {
+ UINT32 Signature;
+ UINT32 Length;
+ UINT32 HardwareSignature;
+ UINT32 FirmwareWakingVector;
+ UINT32 GlobalLock;
+ UINT32 Flags;
+ UINT8 Reserved[40];
+} EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE;
+
+///
+/// Firmware Control Structure Feature Flags
+/// All other bits are reserved and must be set to 0.
+///
+#define EFI_ACPI_1_0_S4BIOS_F (1 << 0)
+
+///
+/// Multiple APIC Description Table header definition. The rest of the table
+/// must be defined in a platform specific manner.
+///
+typedef struct {
+ EFI_ACPI_DESCRIPTION_HEADER Header;
+ UINT32 LocalApicAddress;
+ UINT32 Flags;
+} EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER;
+
+///
+/// MADT Revision (as defined in ACPI 1.0b spec.)
+///
+#define EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION 0x01
+
+///
+/// Multiple APIC Flags
+/// All other bits are reserved and must be set to 0.
+///
+#define EFI_ACPI_1_0_PCAT_COMPAT (1 << 0)
+
+//
+// Multiple APIC Description Table APIC structure types
+// All other values between 0x09 an 0xFF are reserved and
+// will be ignored by OSPM.
+//
+#define EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC 0x00
+#define EFI_ACPI_1_0_IO_APIC 0x01
+#define EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE 0x02
+#define EFI_ACPI_1_0_NON_MASKABLE_INTERRUPT_SOURCE 0x03
+#define EFI_ACPI_1_0_LOCAL_APIC_NMI 0x04
+
+///
+/// APIC Structure Definitions
+///
+///
+/// Processor Local APIC Structure Definition
+///
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 AcpiProcessorId;
+ UINT8 ApicId;
+ UINT32 Flags;
+} EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC_STRUCTURE;
+
+///
+/// Local APIC Flags. All other bits are reserved and must be 0.
+///
+#define EFI_ACPI_1_0_LOCAL_APIC_ENABLED (1 << 0)
+
+///
+/// IO APIC Structure
+///
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 IoApicId;
+ UINT8 Reserved;
+ UINT32 IoApicAddress;
+ UINT32 SystemVectorBase;
+} EFI_ACPI_1_0_IO_APIC_STRUCTURE;
+
+///
+/// Interrupt Source Override Structure
+///
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 Bus;
+ UINT8 Source;
+ UINT32 GlobalSystemInterruptVector;
+ UINT16 Flags;
+} EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE;
+
+///
+/// Non-Maskable Interrupt Source Structure
+///
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT16 Flags;
+ UINT32 GlobalSystemInterruptVector;
+} EFI_ACPI_1_0_NON_MASKABLE_INTERRUPT_SOURCE_STRUCTURE;
+
+///
+/// Local APIC NMI Structure
+///
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 AcpiProcessorId;
+ UINT16 Flags;
+ UINT8 LocalApicInti;
+} EFI_ACPI_1_0_LOCAL_APIC_NMI_STRUCTURE;
+
+///
+/// Smart Battery Description Table (SBST)
+///
+typedef struct {
+ EFI_ACPI_DESCRIPTION_HEADER Header;
+ UINT32 WarningEnergyLevel;
+ UINT32 LowEnergyLevel;
+ UINT32 CriticalEnergyLevel;
+} EFI_ACPI_1_0_SMART_BATTERY_DESCRIPTION_TABLE;
+
+///
+/// Known table signatures
+///
+///
+/// "RSD PTR " Root System Description Pointer
+///
+#define EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER_SIGNATURE 0x2052545020445352
+
+///
+/// "APIC" Multiple APIC Description Table
+///
+#define EFI_ACPI_1_0_APIC_SIGNATURE 0x43495041
+
+///
+/// "DSDT" Differentiated System Description Table
+///
+#define EFI_ACPI_1_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE 0x54445344
+
+///
+/// "FACS" Firmware ACPI Control Structure
+///
+#define EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE 0x53434146
+
+///
+/// "FACP" Fixed ACPI Description Table
+///
+#define EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE 0x50434146
+
+///
+/// "PSDT" Persistent System Description Table
+///
+#define EFI_ACPI_1_0_PERSISTENT_SYSTEM_DESCRIPTION_TABLE_SIGNATURE 0x54445350
+
+///
+/// "RSDT" Root System Description Table
+///
+#define EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_TABLE_SIGNATURE 0x54445352
+
+///
+/// "SBST" Smart Battery Specification Table
+///
+#define EFI_ACPI_1_0_SMART_BATTERY_SPECIFICATION_TABLE_SIGNATURE 0x54534253
+
+///
+/// "SSDT" Secondary System Description Table
+///
+#define EFI_ACPI_1_0_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE 0x54445353
+
+#pragma pack()
+
+#endif
diff --git a/ReferenceCode/ME/SampleCode/Include/Acpi2_0.h b/ReferenceCode/ME/SampleCode/Include/Acpi2_0.h
new file mode 100644
index 0000000..38ffbac
--- /dev/null
+++ b/ReferenceCode/ME/SampleCode/Include/Acpi2_0.h
@@ -0,0 +1,533 @@
+/** @file
+ ACPI 2.0 definitions from the ACPI Specification, revision 2.0
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains 'Framework Code' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may not be modified, except as allowed by
+ additional terms of your license agreement.
+**/
+#ifndef _ACPI_2_0_H_
+#define _ACPI_2_0_H_
+
+//
+// Statements that include other files
+//
+#include "Tiano.h"
+#include "Acpi.h"
+
+//
+// Ensure proper structure formats
+//
+#pragma pack(1)
+///
+/// ACPI Specification Revision
+///
+#define EFI_ACPI_2_0_REVISION 0x02
+
+//
+// BUGBUG: OEM values need to be moved somewhere else, probably read from data hub
+// and produced by a platform specific driver.
+//
+///
+/// ACPI OEM ID
+///
+#define EFI_ACPI_2_0_OEM_ID "INTEL "
+#define EFI_ACPI_2_0_OEM_TABLE_ID 0x5034303738543245 /// "E2T8704P"
+///
+/// ACPI OEM Revision
+///
+#define EFI_ACPI_2_0_OEM_REVISION 0x00000002
+
+///
+/// ACPI table creator ID
+///
+#define EFI_ACPI_2_0_CREATOR_ID 0x5446534D /// TBD "MSFT"
+///
+/// ACPI table creator revision
+///
+#define EFI_ACPI_2_0_CREATOR_REVISION 0x01000013 /// TBD
+///
+/// ACPI 2.0 Generic Address Space definition
+///
+typedef struct {
+ UINT8 AddressSpaceId;
+ UINT8 RegisterBitWidth;
+ UINT8 RegisterBitOffset;
+ UINT8 Reserved;
+ UINT64 Address;
+} EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE;
+
+///
+/// Generic Address Space Address IDs
+///
+#define EFI_ACPI_2_0_SYSTEM_MEMORY 0
+#define EFI_ACPI_2_0_SYSTEM_IO 1
+#define EFI_ACPI_2_0_PCI_CONFIGURATION_SPACE 2
+#define EFI_ACPI_2_0_EMBEDDED_CONTROLLER 3
+#define EFI_ACPI_2_0_SMBUS 4
+#define EFI_ACPI_2_0_FUNCTIONAL_FIXED_HARDWARE 0x7F
+
+///
+/// ACPI 2.0 table structures
+///
+///
+/// Root System Description Pointer Structure
+///
+typedef struct {
+ UINT64 Signature;
+ UINT8 Checksum;
+ UINT8 OemId[6];
+ UINT8 Revision;
+ UINT32 RsdtAddress;
+ UINT32 Length;
+ UINT64 XsdtAddress;
+ UINT8 ExtendedChecksum;
+ UINT8 Reserved[3];
+} EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER;
+
+///
+/// RSD_PTR Revision (as defined in ACPI 2.0 spec.)
+///
+#define EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER_REVISION 0x02
+
+///
+/// Common table header, this prefaces all ACPI tables, including FACS, but
+/// excluding the RSD PTR structure
+///
+typedef struct {
+ UINT32 Signature;
+ UINT32 Length;
+} EFI_ACPI_2_0_COMMON_HEADER;
+
+///
+/// Root System Description Table
+/// No definition needed as it is a common description table header followed by a
+/// variable number of UINT32 table pointers.
+///
+///
+/// RSDT Revision (as defined in ACPI 2.0 spec.)
+///
+#define EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_TABLE_REVISION 0x01
+
+///
+/// Extended System Description Table
+/// No definition needed as it is a common description table header followed by a
+/// variable number of UINT64 table pointers.
+///
+///
+/// XSDT Revision (as defined in ACPI 2.0 spec.)
+///
+#define EFI_ACPI_2_0_EXTENDED_SYSTEM_DESCRIPTION_TABLE_REVISION 0x01
+
+///
+/// Fixed ACPI Description Table Structure (FADT)
+///
+typedef struct {
+ EFI_ACPI_DESCRIPTION_HEADER Header;
+ UINT32 FirmwareCtrl;
+ UINT32 Dsdt;
+ UINT8 Reserved0;
+ UINT8 PreferredPmProfile;
+ UINT16 SciInt;
+ UINT32 SmiCmd;
+ UINT8 AcpiEnable;
+ UINT8 AcpiDisable;
+ UINT8 S4BiosReq;
+ UINT8 PstateCnt;
+ UINT32 Pm1aEvtBlk;
+ UINT32 Pm1bEvtBlk;
+ UINT32 Pm1aCntBlk;
+ UINT32 Pm1bCntBlk;
+ UINT32 Pm2CntBlk;
+ UINT32 PmTmrBlk;
+ UINT32 Gpe0Blk;
+ UINT32 Gpe1Blk;
+ UINT8 Pm1EvtLen;
+ UINT8 Pm1CntLen;
+ UINT8 Pm2CntLen;
+ UINT8 PmTmrLen;
+ UINT8 Gpe0BlkLen;
+ UINT8 Gpe1BlkLen;
+ UINT8 Gpe1Base;
+ UINT8 CstCnt;
+ UINT16 PLvl2Lat;
+ UINT16 PLvl3Lat;
+ UINT16 FlushSize;
+ UINT16 FlushStride;
+ UINT8 DutyOffset;
+ UINT8 DutyWidth;
+ UINT8 DayAlrm;
+ UINT8 MonAlrm;
+ UINT8 Century;
+ UINT16 IaPcBootArch;
+ UINT8 Reserved1;
+ UINT32 Flags;
+ EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE ResetReg;
+ UINT8 ResetValue;
+ UINT8 Reserved2[3];
+ UINT64 XFirmwareCtrl;
+ UINT64 XDsdt;
+ EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE XPm1aEvtBlk;
+ EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE XPm1bEvtBlk;
+ EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE XPm1aCntBlk;
+ EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE XPm1bCntBlk;
+ EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE XPm2CntBlk;
+ EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE XPmTmrBlk;
+ EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE XGpe0Blk;
+ EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE XGpe1Blk;
+} EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE;
+
+///
+/// FADT Version (as defined in ACPI 2.0 spec.)
+///
+#define EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION 0x03
+
+///
+/// Fixed ACPI Description Table Boot Architecture Flags
+/// All other bits are reserved and must be set to 0.
+///
+#define EFI_ACPI_2_0_LEGACY_DEVICES (1 << 0)
+#define EFI_ACPI_2_0_8042 (1 << 1)
+
+///
+/// Fixed ACPI Description Table Fixed Feature Flags
+/// All other bits are reserved and must be set to 0.
+///
+#define EFI_ACPI_2_0_WBINVD (1 << 0)
+#define EFI_ACPI_2_0_WBINVD_FLUSH (1 << 1)
+#define EFI_ACPI_2_0_PROC_C1 (1 << 2)
+#define EFI_ACPI_2_0_P_LVL2_UP (1 << 3)
+#define EFI_ACPI_2_0_PWR_BUTTON (1 << 4)
+#define EFI_ACPI_2_0_SLP_BUTTON (1 << 5)
+#define EFI_ACPI_2_0_FIX_RTC (1 << 6)
+#define EFI_ACPI_2_0_RTC_S4 (1 << 7)
+#define EFI_ACPI_2_0_TMR_VAL_EXT (1 << 8)
+#define EFI_ACPI_2_0_DCK_CAP (1 << 9)
+#define EFI_ACPI_2_0_RESET_REG_SUP (1 << 10)
+#define EFI_ACPI_2_0_SEALED_CASE (1 << 11)
+#define EFI_ACPI_2_0_HEADLESS (1 << 12)
+#define EFI_ACPI_2_0_CPU_SW_SLP (1 << 13)
+
+///
+/// Firmware ACPI Control Structure
+///
+typedef struct {
+ UINT32 Signature;
+ UINT32 Length;
+ UINT32 HardwareSignature;
+ UINT32 FirmwareWakingVector;
+ UINT32 GlobalLock;
+ UINT32 Flags;
+ UINT64 XFirmwareWakingVector;
+ UINT8 Version;
+ UINT8 Reserved[31];
+} EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE;
+
+///
+/// FACS Version (as defined in ACPI 2.0 spec.)
+///
+#define EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION 0x01
+
+///
+/// Firmware Control Structure Feature Flags
+/// All other bits are reserved and must be set to 0.
+///
+#define EFI_ACPI_2_0_S4BIOS_F (1 << 0)
+
+///
+/// Multiple APIC Description Table header definition. The rest of the table
+/// must be defined in a platform specific manner.
+///
+typedef struct {
+ EFI_ACPI_DESCRIPTION_HEADER Header;
+ UINT32 LocalApicAddress;
+ UINT32 Flags;
+} EFI_ACPI_2_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER;
+
+///
+/// MADT Revision (as defined in ACPI 2.0 spec.)
+///
+#define EFI_ACPI_2_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION 0x01
+
+///
+/// Multiple APIC Flags
+/// All other bits are reserved and must be set to 0.
+///
+#define EFI_ACPI_2_0_PCAT_COMPAT (1 << 0)
+
+//
+// Multiple APIC Description Table APIC structure types
+// All other values between 0x09 an 0xFF are reserved and
+// will be ignored by OSPM.
+//
+#define EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC 0x00
+#define EFI_ACPI_2_0_IO_APIC 0x01
+#define EFI_ACPI_2_0_INTERRUPT_SOURCE_OVERRIDE 0x02
+#define EFI_ACPI_2_0_NON_MASKABLE_INTERRUPT_SOURCE 0x03
+#define EFI_ACPI_2_0_LOCAL_APIC_NMI 0x04
+#define EFI_ACPI_2_0_LOCAL_APIC_ADDRESS_OVERRIDE 0x05
+#define EFI_ACPI_2_0_IO_SAPIC 0x06
+#define EFI_ACPI_2_0_PROCESSOR_LOCAL_SAPIC 0x07
+#define EFI_ACPI_2_0_PLATFORM_INTERRUPT_SOURCES 0x08
+
+///
+/// APIC Structure Definitions
+///
+///
+/// Processor Local APIC Structure Definition
+///
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 AcpiProcessorId;
+ UINT8 ApicId;
+ UINT32 Flags;
+} EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC_STRUCTURE;
+
+///
+/// Local APIC Flags. All other bits are reserved and must be 0.
+///
+#define EFI_ACPI_2_0_LOCAL_APIC_ENABLED (1 << 0)
+
+///
+/// IO APIC Structure
+///
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 IoApicId;
+ UINT8 Reserved;
+ UINT32 IoApicAddress;
+ UINT32 GlobalSystemInterruptBase;
+} EFI_ACPI_2_0_IO_APIC_STRUCTURE;
+
+///
+/// Interrupt Source Override Structure
+///
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 Bus;
+ UINT8 Source;
+ UINT32 GlobalSystemInterrupt;
+ UINT16 Flags;
+} EFI_ACPI_2_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE;
+
+///
+/// Non-Maskable Interrupt Source Structure
+///
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT16 Flags;
+ UINT32 GlobalSystemInterrupt;
+} EFI_ACPI_2_0_NON_MASKABLE_INTERRUPT_SOURCE_STRUCTURE;
+
+///
+/// Local APIC NMI Structure
+///
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 AcpiProcessorId;
+ UINT16 Flags;
+ UINT8 LocalApicLint;
+} EFI_ACPI_2_0_LOCAL_APIC_NMI_STRUCTURE;
+
+///
+/// Local APIC Address Override Structure
+///
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT16 Reserved;
+ UINT64 LocalApicAddress;
+} EFI_ACPI_2_0_LOCAL_APIC_ADDRESS_OVERRIDE_STRUCTURE;
+
+///
+/// IO SAPIC Structure
+///
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 IoApicId;
+ UINT8 Reserved;
+ UINT32 GlobalSystemInterruptBase;
+ UINT64 IoSapicAddress;
+} EFI_ACPI_2_0_IO_SAPIC_STRUCTURE;
+
+///
+/// Local SAPIC Structure
+///
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 AcpiProcessorId;
+ UINT8 LocalSapicId;
+ UINT8 LocalSapicEid;
+ UINT8 Reserved[3];
+ UINT32 Flags;
+} EFI_ACPI_2_0_PROCESSOR_LOCAL_SAPIC_STRUCTURE;
+
+///
+/// Platform Interrupt Sources Structure
+///
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT16 Flags;
+ UINT8 InterruptType;
+ UINT8 ProcessorId;
+ UINT8 ProcessorEid;
+ UINT8 IoSapicVector;
+ UINT32 GlobalSystemInterrupt;
+ UINT32 Reserved;
+} EFI_ACPI_2_0_PLATFORM_INTERRUPT_SOURCES_STRUCTURE;
+
+///
+/// Smart Battery Description Table (SBST)
+///
+typedef struct {
+ EFI_ACPI_DESCRIPTION_HEADER Header;
+ UINT32 WarningEnergyLevel;
+ UINT32 LowEnergyLevel;
+ UINT32 CriticalEnergyLevel;
+} EFI_ACPI_2_0_SMART_BATTERY_DESCRIPTION_TABLE;
+
+///
+/// SBST Version (as defined in ACPI 2.0 spec.)
+///
+#define EFI_ACPI_2_0_SMART_BATTERY_DESCRIPTION_TABLE_REVISION 0x01
+
+///
+/// Embedded Controller Boot Resources Table (ECDT)
+/// The table is followed by a null terminated ASCII string that contains
+/// a fully qualified reference to the name space object.
+///
+typedef struct {
+ EFI_ACPI_DESCRIPTION_HEADER Header;
+ EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE EcControl;
+ EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE EcData;
+ UINT32 Uid;
+ UINT8 GpeBit;
+} EFI_ACPI_2_0_EMBEDDED_CONTROLLER_BOOT_RESOURCES_TABLE;
+
+///
+/// ECDT Version (as defined in ACPI 2.0 spec.)
+///
+#define EFI_ACPI_2_0_EMBEDDED_CONTROLLER_BOOT_RESOURCES_TABLE_REVISION 0x01
+
+///
+/// Known table signatures
+///
+///
+/// "RSD PTR " Root System Description Pointer
+///
+#define EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER_SIGNATURE 0x2052545020445352
+
+///
+/// "SPIC" Multiple SAPIC Description Table
+///
+/// BUGBUG: Don't know where this came from except SR870BN4 uses it.
+/// #define EFI_ACPI_2_0_MULTIPLE_SAPIC_DESCRIPTION_TABLE_SIGNATURE 0x43495053
+///
+#define EFI_ACPI_2_0_MULTIPLE_SAPIC_DESCRIPTION_TABLE_SIGNATURE 0x43495041
+
+///
+/// "BOOT" MS Simple Boot Spec
+///
+#define EFI_ACPI_2_0_SIMPLE_BOOT_FLAG_TABLE_SIGNATURE 0x544F4F42
+
+///
+/// "DBGP" MS Bebug Port Spec
+///
+#define EFI_ACPI_2_0_DEBUG_PORT_TABLE_SIGNATURE 0x50474244
+
+///
+/// "DSDT" Differentiated System Description Table
+///
+#define EFI_ACPI_2_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE 0x54445344
+
+///
+/// "ECDT" Embedded Controller Boot Resources Table
+///
+#define EFI_ACPI_2_0_EMBEDDED_CONTROLLER_BOOT_RESOURCES_TABLE_SIGNATURE 0x54444345
+
+///
+/// "ETDT" Event Timer Description Table
+///
+#define EFI_ACPI_2_0_EVENT_TIMER_DESCRIPTION_TABLE_SIGNATURE 0x54445445
+
+///
+/// "FACS" Firmware ACPI Control Structure
+///
+#define EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE 0x53434146
+
+///
+/// "FACP" Fixed ACPI Description Table
+///
+#define EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE 0x50434146
+
+///
+/// "APIC" Multiple APIC Description Table
+///
+#define EFI_ACPI_2_0_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE 0x43495041
+
+///
+/// "PSDT" Persistent System Description Table
+///
+#define EFI_ACPI_2_0_PERSISTENT_SYSTEM_DESCRIPTION_TABLE_SIGNATURE 0x54445350
+
+///
+/// "RSDT" Root System Description Table
+///
+#define EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_TABLE_SIGNATURE 0x54445352
+
+///
+/// "SBST" Smart Battery Specification Table
+///
+#define EFI_ACPI_2_0_SMART_BATTERY_SPECIFICATION_TABLE_SIGNATURE 0x54534253
+
+///
+/// "SLIT" System Locality Information Table
+///
+#define EFI_ACPI_2_0_SYSTEM_LOCALITY_INFORMATION_TABLE_SIGNATURE 0x54494C53
+
+///
+/// "SPCR" Serial Port Concole Redirection Table
+///
+#define EFI_ACPI_2_0_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE 0x52435053
+
+///
+/// "SRAT" Static Resource Affinity Table
+///
+#define EFI_ACPI_2_0_STATIC_RESOURCE_AFFINITY_TABLE_SIGNATURE 0x54415253
+
+///
+/// "SSDT" Secondary System Description Table
+///
+#define EFI_ACPI_2_0_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE 0x54445353
+
+///
+/// "SPMI" Server Platform Management Interface Table
+///
+#define EFI_ACPI_2_0_SERVER_PLATFORM_MANAGEMENT_INTERFACE_SIGNATURE 0x494D5053
+
+///
+/// "XSDT" Extended System Description Table
+///
+#define EFI_ACPI_2_0_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE 0x54445358
+
+#pragma pack()
+
+#endif
diff --git a/ReferenceCode/ME/SampleCode/Include/Acpi3_0.h b/ReferenceCode/ME/SampleCode/Include/Acpi3_0.h
new file mode 100644
index 0000000..3fc3cb6
--- /dev/null
+++ b/ReferenceCode/ME/SampleCode/Include/Acpi3_0.h
@@ -0,0 +1,682 @@
+/** @file
+ ACPI 3.0 definitions from the ACPI Specification Revision 3.0 September 2, 2004
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains 'Framework Code' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may not be modified, except as allowed by
+ additional terms of your license agreement.
+**/
+#ifndef _ACPI_3_0_H_
+#define _ACPI_3_0_H_
+
+//
+// Statements that include other files
+//
+#include "Tiano.h"
+#include "Acpi.h"
+
+//
+// Ensure proper structure formats
+//
+#pragma pack(1)
+///
+/// ACPI Specification Revision
+///
+#define EFI_ACPI_3_0_REVISION 0x03 /// BUGBUG: Not in spec yet.
+//
+// BUGBUG: OEM values need to be moved somewhere else, probably read from data hub
+// and produced by a platform specific driver.
+//
+
+///
+/// ACPI 3.0 Generic Address Space definition
+///
+typedef struct {
+ UINT8 AddressSpaceId;
+ UINT8 RegisterBitWidth;
+ UINT8 RegisterBitOffset;
+ UINT8 AccessSize;
+ UINT64 Address;
+} EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE;
+
+///
+/// Generic Address Space Address IDs
+///
+#define EFI_ACPI_3_0_SYSTEM_MEMORY 0
+#define EFI_ACPI_3_0_SYSTEM_IO 1
+#define EFI_ACPI_3_0_PCI_CONFIGURATION_SPACE 2
+#define EFI_ACPI_3_0_EMBEDDED_CONTROLLER 3
+#define EFI_ACPI_3_0_SMBUS 4
+#define EFI_ACPI_3_0_FUNCTIONAL_FIXED_HARDWARE 0x7F
+
+///
+/// Generic Address Space Access Sizes
+///
+#define EFI_ACPI_3_0_UNDEFINED 0
+#define EFI_ACPI_3_0_BYTE 1
+#define EFI_ACPI_3_0_WORD 2
+#define EFI_ACPI_3_0_DWORD 3
+#define EFI_ACPI_3_0_QWORD 4
+
+///
+/// ACPI 3.0 table structures
+///
+///
+/// Root System Description Pointer Structure
+///
+typedef struct {
+ UINT64 Signature;
+ UINT8 Checksum;
+ UINT8 OemId[6];
+ UINT8 Revision;
+ UINT32 RsdtAddress;
+ UINT32 Length;
+ UINT64 XsdtAddress;
+ UINT8 ExtendedChecksum;
+ UINT8 Reserved[3];
+} EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER;
+
+///
+/// RSD_PTR Revision (as defined in ACPI 3.0 spec.)
+///
+#define EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER_REVISION 0x02 /// ACPISpec30 (Revision 3.0 September 2, 2004) says current value is 2
+///
+/// Common table header, this prefaces all ACPI tables, including FACS, but
+/// excluding the RSD PTR structure
+///
+typedef struct {
+ UINT32 Signature;
+ UINT32 Length;
+} EFI_ACPI_3_0_COMMON_HEADER;
+
+///
+/// Root System Description Table
+/// No definition needed as it is a common description table header followed by a
+/// variable number of UINT32 table pointers.
+///
+///
+/// RSDT Revision (as defined in ACPI 3.0 spec.)
+///
+#define EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_TABLE_REVISION 0x01
+
+///
+/// Extended System Description Table
+/// No definition needed as it is a common description table header followed by a
+/// variable number of UINT64 table pointers.
+///
+///
+/// XSDT Revision (as defined in ACPI 3.0 spec.)
+///
+#define EFI_ACPI_3_0_EXTENDED_SYSTEM_DESCRIPTION_TABLE_REVISION 0x01
+
+///
+/// Fixed ACPI Description Table Structure (FADT)
+///
+typedef struct {
+ EFI_ACPI_DESCRIPTION_HEADER Header;
+ UINT32 FirmwareCtrl;
+ UINT32 Dsdt;
+ UINT8 Reserved0;
+ UINT8 PreferredPmProfile;
+ UINT16 SciInt;
+ UINT32 SmiCmd;
+ UINT8 AcpiEnable;
+ UINT8 AcpiDisable;
+ UINT8 S4BiosReq;
+ UINT8 PstateCnt;
+ UINT32 Pm1aEvtBlk;
+ UINT32 Pm1bEvtBlk;
+ UINT32 Pm1aCntBlk;
+ UINT32 Pm1bCntBlk;
+ UINT32 Pm2CntBlk;
+ UINT32 PmTmrBlk;
+ UINT32 Gpe0Blk;
+ UINT32 Gpe1Blk;
+ UINT8 Pm1EvtLen;
+ UINT8 Pm1CntLen;
+ UINT8 Pm2CntLen;
+ UINT8 PmTmrLen;
+ UINT8 Gpe0BlkLen;
+ UINT8 Gpe1BlkLen;
+ UINT8 Gpe1Base;
+ UINT8 CstCnt;
+ UINT16 PLvl2Lat;
+ UINT16 PLvl3Lat;
+ UINT16 FlushSize;
+ UINT16 FlushStride;
+ UINT8 DutyOffset;
+ UINT8 DutyWidth;
+ UINT8 DayAlrm;
+ UINT8 MonAlrm;
+ UINT8 Century;
+ UINT16 IaPcBootArch;
+ UINT8 Reserved1;
+ UINT32 Flags;
+ EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE ResetReg;
+ UINT8 ResetValue;
+ UINT8 Reserved2[3];
+ UINT64 XFirmwareCtrl;
+ UINT64 XDsdt;
+ EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE XPm1aEvtBlk;
+ EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE XPm1bEvtBlk;
+ EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE XPm1aCntBlk;
+ EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE XPm1bCntBlk;
+ EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE XPm2CntBlk;
+ EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE XPmTmrBlk;
+ EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE XGpe0Blk;
+ EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE XGpe1Blk;
+} EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE;
+
+///
+/// FADT Version (as defined in ACPI 3.0 spec.)
+///
+#define EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION 0x04
+
+//
+// Fixed ACPI Description Table Preferred Power Management Profile
+//
+#define EFI_ACPI_3_0_PM_PROFILE_UNSPECIFIED 0
+#define EFI_ACPI_3_0_PM_PROFILE_DESKTOP 1
+#define EFI_ACPI_3_0_PM_PROFILE_MOBILE 2
+#define EFI_ACPI_3_0_PM_PROFILE_WORKSTATION 3
+#define EFI_ACPI_3_0_PM_PROFILE_ENTERPRISE_SERVER 4
+#define EFI_ACPI_3_0_PM_PROFILE_SOHO_SERVER 5
+#define EFI_ACPI_3_0_PM_PROFILE_APPLIANCE_PC 6
+#define EFI_ACPI_3_0_PM_PROFILE_PERFORMANCE_SERVER 7
+
+//
+// Fixed ACPI Description Table Boot Architecture Flags
+// All other bits are reserved and must be set to 0.
+//
+#define EFI_ACPI_3_0_LEGACY_DEVICES (1 << 0)
+#define EFI_ACPI_3_0_8042 (1 << 1)
+#define EFI_ACPI_3_0_VGA_NOT_PRESENT (1 << 2)
+
+//
+// Fixed ACPI Description Table Fixed Feature Flags
+// All other bits are reserved and must be set to 0.
+//
+#define EFI_ACPI_3_0_WBINVD (1 << 0)
+#define EFI_ACPI_3_0_WBINVD_FLUSH (1 << 1)
+#define EFI_ACPI_3_0_PROC_C1 (1 << 2)
+#define EFI_ACPI_3_0_P_LVL2_UP (1 << 3)
+#define EFI_ACPI_3_0_PWR_BUTTON (1 << 4)
+#define EFI_ACPI_3_0_SLP_BUTTON (1 << 5)
+#define EFI_ACPI_3_0_FIX_RTC (1 << 6)
+#define EFI_ACPI_3_0_RTC_S4 (1 << 7)
+#define EFI_ACPI_3_0_TMR_VAL_EXT (1 << 8)
+#define EFI_ACPI_3_0_DCK_CAP (1 << 9)
+#define EFI_ACPI_3_0_RESET_REG_SUP (1 << 10)
+#define EFI_ACPI_3_0_SEALED_CASE (1 << 11)
+#define EFI_ACPI_3_0_HEADLESS (1 << 12)
+#define EFI_ACPI_3_0_CPU_SW_SLP (1 << 13)
+#define EFI_ACPI_3_0_PCI_EXP_WAK (1 << 14)
+#define EFI_ACPI_3_0_USE_PLATFORM_CLOCK (1 << 15)
+#define EFI_ACPI_3_0_S4_RTC_STS_VALID (1 << 16)
+#define EFI_ACPI_3_0_REMOTE_POWER_ON_CAPABLE (1 << 17)
+#define EFI_ACPI_3_0_FORCE_APIC_CLUSTER_MODEL (1 << 18)
+#define EFI_ACPI_3_0_FORCE_APIC_PHYSICAL_DESTINATION_MODE (1 << 19)
+
+///
+/// Firmware ACPI Control Structure
+///
+typedef struct {
+ UINT32 Signature;
+ UINT32 Length;
+ UINT32 HardwareSignature;
+ UINT32 FirmwareWakingVector;
+ UINT32 GlobalLock;
+ UINT32 Flags;
+ UINT64 XFirmwareWakingVector;
+ UINT8 Version;
+ UINT8 Reserved[31];
+} EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE;
+
+///
+/// FACS Version (as defined in ACPI 3.0 spec.)
+///
+#define EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION 0x01
+
+///
+/// Firmware Control Structure Feature Flags
+/// All other bits are reserved and must be set to 0.
+///
+#define EFI_ACPI_3_0_S4BIOS_F (1 << 0)
+
+//
+// Differentiated System Description Table,
+// Secondary System Description Table
+// and Persistent System Description Table,
+// no definition needed as they are common description table header followed by a
+// definition block.
+//
+#define EFI_ACPI_3_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_REVISION 0x02
+#define EFI_ACPI_3_0_SECONDARY_SYSTEM_DESCRIPTION_TABLE_REVISION 0x02
+
+///
+/// Multiple APIC Description Table header definition. The rest of the table
+/// must be defined in a platform specific manner.
+///
+typedef struct {
+ EFI_ACPI_DESCRIPTION_HEADER Header;
+ UINT32 LocalApicAddress;
+ UINT32 Flags;
+} EFI_ACPI_3_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER;
+
+///
+/// MADT Revision (as defined in ACPI 3.0 spec.)
+///
+#define EFI_ACPI_3_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION 0x02
+
+///
+/// Multiple APIC Flags
+/// All other bits are reserved and must be set to 0.
+///
+#define EFI_ACPI_3_0_PCAT_COMPAT (1 << 0)
+
+//
+// Multiple APIC Description Table APIC structure types
+// All other values between 0x09 an 0xFF are reserved and
+// will be ignored by OSPM.
+//
+#define EFI_ACPI_3_0_PROCESSOR_LOCAL_APIC 0x00
+#define EFI_ACPI_3_0_IO_APIC 0x01
+#define EFI_ACPI_3_0_INTERRUPT_SOURCE_OVERRIDE 0x02
+#define EFI_ACPI_3_0_NON_MASKABLE_INTERRUPT_SOURCE 0x03
+#define EFI_ACPI_3_0_LOCAL_APIC_NMI 0x04
+#define EFI_ACPI_3_0_LOCAL_APIC_ADDRESS_OVERRIDE 0x05
+#define EFI_ACPI_3_0_IO_SAPIC 0x06
+#define EFI_ACPI_3_0_LOCAL_SAPIC 0x07
+#define EFI_ACPI_3_0_PLATFORM_INTERRUPT_SOURCES 0x08
+
+///
+/// APIC Structure Definitions
+///
+///
+/// Processor Local APIC Structure Definition
+///
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 AcpiProcessorId;
+ UINT8 ApicId;
+ UINT32 Flags;
+} EFI_ACPI_3_0_PROCESSOR_LOCAL_APIC_STRUCTURE;
+
+///
+/// Local APIC Flags. All other bits are reserved and must be 0.
+///
+#define EFI_ACPI_3_0_LOCAL_APIC_ENABLED (1 << 0)
+
+///
+/// IO APIC Structure
+///
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 IoApicId;
+ UINT8 Reserved;
+ UINT32 IoApicAddress;
+ UINT32 GlobalSystemInterruptBase;
+} EFI_ACPI_3_0_IO_APIC_STRUCTURE;
+
+///
+/// Interrupt Source Override Structure
+///
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 Bus;
+ UINT8 Source;
+ UINT32 GlobalSystemInterrupt;
+ UINT16 Flags;
+} EFI_ACPI_3_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE;
+
+///
+/// Platform Interrupt Sources Structure Definition
+///
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT16 Flags;
+ UINT8 InterruptType;
+ UINT8 ProcessorId;
+ UINT8 ProcessorEid;
+ UINT8 IoSapicVector;
+ UINT32 GlobalSystemInterrupt;
+ UINT32 PlatformInterruptSourceFlags;
+ UINT8 CpeiProcessorOverride;
+ UINT8 Reserved[31];
+} EFI_ACPI_3_0_PLATFORM_INTERRUPT_APIC_STRUCTURE;
+
+///
+/// MPS INTI flags.
+/// All other bits are reserved and must be set to 0.
+///
+#define EFI_ACPI_3_0_POLARITY (3 << 0)
+#define EFI_ACPI_3_0_TRIGGER_MODE (3 << 2)
+
+///
+/// Non-Maskable Interrupt Source Structure
+///
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT16 Flags;
+ UINT32 GlobalSystemInterrupt;
+} EFI_ACPI_3_0_NON_MASKABLE_INTERRUPT_SOURCE_STRUCTURE;
+
+///
+/// Local APIC NMI Structure
+///
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 AcpiProcessorId;
+ UINT16 Flags;
+ UINT8 LocalApicLint;
+} EFI_ACPI_3_0_LOCAL_APIC_NMI_STRUCTURE;
+
+///
+/// Local APIC Address Override Structure
+///
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT16 Reserved;
+ UINT64 LocalApicAddress;
+} EFI_ACPI_3_0_LOCAL_APIC_ADDRESS_OVERRIDE_STRUCTURE;
+
+///
+/// IO SAPIC Structure
+///
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 IoApicId;
+ UINT8 Reserved;
+ UINT32 GlobalSystemInterruptBase;
+ UINT64 IoSapicAddress;
+} EFI_ACPI_3_0_IO_SAPIC_STRUCTURE;
+
+///
+/// Local SAPIC Structure
+/// This struct followed by a null-terminated ASCII string - ACPI Processor UID String
+///
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 AcpiProcessorId;
+ UINT8 LocalSapicId;
+ UINT8 LocalSapicEid;
+ UINT8 Reserved[3];
+ UINT32 Flags;
+ UINT32 ACPIProcessorUIDValue;
+} EFI_ACPI_3_0_PROCESSOR_LOCAL_SAPIC_STRUCTURE;
+
+///
+/// Platform Interrupt Sources Structure
+///
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT16 Flags;
+ UINT8 InterruptType;
+ UINT8 ProcessorId;
+ UINT8 ProcessorEid;
+ UINT8 IoSapicVector;
+ UINT32 GlobalSystemInterrupt;
+ UINT32 PlatformInterruptSourceFlags;
+} EFI_ACPI_3_0_PLATFORM_INTERRUPT_SOURCES_STRUCTURE;
+
+///
+/// Platform Interrupt Source Flags.
+/// All other bits are reserved and must be set to 0.
+///
+#define EFI_ACPI_3_0_CPEI_PROCESSOR_OVERRIDE (1 << 0)
+
+///
+/// Smart Battery Description Table (SBST)
+///
+typedef struct {
+ EFI_ACPI_DESCRIPTION_HEADER Header;
+ UINT32 WarningEnergyLevel;
+ UINT32 LowEnergyLevel;
+ UINT32 CriticalEnergyLevel;
+} EFI_ACPI_3_0_SMART_BATTERY_DESCRIPTION_TABLE;
+
+///
+/// SBST Version (as defined in ACPI 3.0 spec.)
+///
+#define EFI_ACPI_3_0_SMART_BATTERY_DESCRIPTION_TABLE_REVISION 0x01
+
+///
+/// Embedded Controller Boot Resources Table (ECDT)
+/// The table is followed by a null terminated ASCII string that contains
+/// a fully qualified reference to the name space object.
+///
+typedef struct {
+ EFI_ACPI_DESCRIPTION_HEADER Header;
+ EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE EcControl;
+ EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE EcData;
+ UINT32 Uid;
+ UINT8 GpeBit;
+} EFI_ACPI_3_0_EMBEDDED_CONTROLLER_BOOT_RESOURCES_TABLE;
+
+///
+/// ECDT Version (as defined in ACPI 3.0 spec.)
+///
+#define EFI_ACPI_3_0_EMBEDDED_CONTROLLER_BOOT_RESOURCES_TABLE_REVISION 0x01
+
+///
+/// System Resource Affinity Table (SRAT. The rest of the table
+/// must be defined in a platform specific manner.
+///
+typedef struct {
+ EFI_ACPI_DESCRIPTION_HEADER Header;
+ UINT32 Reserved1; /// Must be set to 1
+ UINT64 Reserved2;
+} EFI_ACPI_3_0_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER;
+
+///
+/// SRAT Version (as defined in ACPI 3.0 spec.)
+///
+#define EFI_ACPI_3_0_SYSTEM_RESOURCE_AFFINITY_TABLE_REVISION 0x02
+
+///
+/// SRAT structure types.
+/// All other values between 0x02 an 0xFF are reserved and
+/// will be ignored by OSPM.
+///
+#define EFI_ACPI_3_0_PROCESSOR_LOCAL_APIC_SAPIC_AFFINITY 0x00
+#define EFI_ACPI_3_0_MEMORY_AFFINITY 0x01
+
+///
+/// Processor Local APIC/SAPIC Affinity Structure Definition
+///
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 ProximityDomain7To0;
+ UINT8 ApicId;
+ UINT32 Flags;
+ UINT8 LocalSapicEid;
+ UINT8 ProximityDomain31To8[3];
+ UINT8 Reserved[4];
+} EFI_ACPI_3_0_PROCESSOR_LOCAL_APIC_SAPIC_AFFINITY_STRUCTURE;
+
+///
+/// Local APIC/SAPIC Flags. All other bits are reserved and must be 0.
+///
+#define EFI_ACPI_3_0_PROCESSOR_LOCAL_APIC_SAPIC_ENABLED (1 << 0)
+
+///
+/// Memory Affinity Structure Definition
+///
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+ UINT32 ProximityDomain;
+ UINT16 Reserved1;
+ UINT32 AddressBaseLow;
+ UINT32 AddressBaseHigh;
+ UINT32 LengthLow;
+ UINT32 LengthHigh;
+ UINT32 Reserved2;
+ UINT32 Flags;
+ UINT64 Reserved3;
+} EFI_ACPI_3_0_MEMORY_AFFINITY_STRUCTURE;
+
+///
+/// Memory Flags. All other bits are reserved and must be 0.
+///
+#define EFI_ACPI_3_0_MEMORY_ENABLED (1 << 0)
+#define EFI_ACPI_3_0_MEMORY_HOT_PLUGGABLE (1 << 1)
+#define EFI_ACPI_3_0_MEMORY_NONVOLATILE (1 << 2)
+
+///
+/// System Locality Distance Information Table (SLIT).
+/// The rest of the table is a matrix.
+///
+typedef struct {
+ EFI_ACPI_DESCRIPTION_HEADER Header;
+ UINT64 NumberOfSystemLocalities;
+} EFI_ACPI_3_0_SYSTEM_LOCALITY_DISTANCE_INFORMATION_TABLE_HEADER;
+
+///
+/// SLIT Version (as defined in ACPI 3.0 spec.)
+///
+#define EFI_ACPI_3_0_SYSTEM_LOCALITY_DISTANCE_INFORMATION_TABLE_REVISION 0x01
+
+///
+/// Known table signatures
+///
+///
+/// "RSD PTR " Root System Description Pointer
+///
+#define EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER_SIGNATURE 0x2052545020445352
+
+///
+/// "APIC" Multiple APIC Description Table
+///
+#define EFI_ACPI_3_0_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE 0x43495041
+
+///
+/// "DSDT" Differentiated System Description Table
+///
+#define EFI_ACPI_3_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE 0x54445344
+
+///
+/// "ECDT" Embedded Controller Boot Resources Table
+///
+#define EFI_ACPI_3_0_EMBEDDED_CONTROLLER_BOOT_RESOURCES_TABLE_SIGNATURE 0x54444345
+
+///
+/// "FACP" Fixed ACPI Description Table
+///
+#define EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE 0x50434146
+
+///
+/// "FACS" Firmware ACPI Control Structure
+///
+#define EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE 0x53434146
+
+///
+/// "PSDT" Persistent System Description Table
+///
+#define EFI_ACPI_3_0_PERSISTENT_SYSTEM_DESCRIPTION_TABLE_SIGNATURE 0x54445350
+
+///
+/// "RSDT" Root System Description Table
+///
+#define EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_TABLE_SIGNATURE 0x54445352
+
+///
+/// "SBST" Smart Battery Specification Table
+///
+#define EFI_ACPI_3_0_SMART_BATTERY_SPECIFICATION_TABLE_SIGNATURE 0x54534253
+
+///
+/// "SLIT" System Locality Information Table
+///
+#define EFI_ACPI_3_0_SYSTEM_LOCALITY_INFORMATION_TABLE_SIGNATURE 0x54494C53
+
+///
+/// "SRAT" System Resource Affinity Table
+///
+#define EFI_ACPI_3_0_SYSTEM_RESOURCE_AFFINITY_TABLE_SIGNATURE 0x54415253
+
+///
+/// "SSDT" Secondary System Description Table
+///
+#define EFI_ACPI_3_0_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE 0x54445353
+
+///
+/// "XSDT" Extended System Description Table
+///
+#define EFI_ACPI_3_0_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE 0x54445358
+
+///
+/// "BOOT" MS Simple Boot Spec
+///
+#define EFI_ACPI_3_0_SIMPLE_BOOT_FLAG_TABLE_SIGNATURE 0x544F4F42
+
+///
+/// "CPEP" Corrected Platform Error Polling Table
+/// See
+///
+#define EFI_ACPI_3_0_CORRECTED_PLATFORM_ERROR_POLLING_TABLE_SIGNATURE 0x50455043
+
+///
+/// "DBGP" MS Debug Port Spec
+///
+#define EFI_ACPI_3_0_DEBUG_PORT_TABLE_SIGNATURE 0x50474244
+
+///
+/// "ETDT" Event Timer Description Table
+///
+#define EFI_ACPI_3_0_EVENT_TIMER_DESCRIPTION_TABLE_SIGNATURE 0x54445445
+
+///
+/// "HPET" IA-PC High Precision Event Timer Table
+///
+#define EFI_ACPI_3_0_HIGH_PRECISION_EVENT_TIMER_TABLE_SIGNATURE 0x54455048
+
+///
+/// "MCFG" PCI Express Memory Mapped Configuration Space Base Address Description Table
+///
+#define EFI_ACPI_3_0_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE 0x4746434D
+
+///
+/// "SPCR" Serial Port Concole Redirection Table
+///
+#define EFI_ACPI_3_0_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE 0x52435053
+
+///
+/// "SPMI" Server Platform Management Interface Table
+///
+#define EFI_ACPI_3_0_SERVER_PLATFORM_MANAGEMENT_INTERFACE_TABLE_SIGNATURE 0x494D5053
+
+///
+/// "TCPA" Trusted Computing Platform Alliance Capabilities Table
+///
+#define EFI_ACPI_3_0_TRUSTED_COMPUTING_PLATFORM_ALLIANCE_CAPABILITIES_TABLE_SIGNATURE 0x41504354
+
+///
+/// "WDRT" Watchdog Resource Table
+///
+#define EFI_ACPI_3_0_WATCHDOG_RESOURCE_TABLE_SIGNATURE 0x41504354 0x54524457
+
+#pragma pack()
+
+#endif
diff --git a/ReferenceCode/ME/SampleCode/Include/AlertStandardFormatTable.h b/ReferenceCode/ME/SampleCode/Include/AlertStandardFormatTable.h
new file mode 100644
index 0000000..672a764
--- /dev/null
+++ b/ReferenceCode/ME/SampleCode/Include/AlertStandardFormatTable.h
@@ -0,0 +1,119 @@
+/** @file
+ ACPI Alert Standard Format Description Table ASF! as described
+ in the ASF2.0 Specification
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _ALERT_STANDARD_FORMAT_TABLE_H
+#define _ALERT_STANDARD_FORMAT_TABLE_H
+
+#include "Acpi2_0.h"
+
+//
+// Ensure proper structure formats
+//
+#pragma pack(1)
+///
+/// Information Record header that appears at the beginning of each record
+///
+typedef struct {
+ UINT8 Type;
+ UINT8 Reserved;
+ UINT16 RecordLength;
+} EFI_ACPI_ASF_RECORD_HEADER;
+
+///
+/// This structure contains information that identifies the system's type
+/// and configuration
+///
+typedef struct {
+ EFI_ACPI_ASF_RECORD_HEADER RecordHeader;
+ UINT8 MinWatchDogResetValue;
+ UINT8 MinPollingInterval;
+ UINT16 SystemID;
+ UINT32 IANAManufactureID;
+ UINT8 FeatureFlags;
+ UINT8 Reserved[3];
+} EFI_ACPI_ASF_INFO;
+
+///
+/// Alert sensors definition
+///
+#define ASF_ALRT_SENSOR_ARRAY_LENGTH 36
+
+typedef struct {
+ EFI_ACPI_ASF_RECORD_HEADER RecordHeader;
+ UINT8 AssertionEventBitMask;
+ UINT8 DeassertionEventBitMask;
+ UINT8 NumberOfAlerts;
+ UINT8 ArrayElementLength;
+ UINT8 DeviceArray[ASF_ALRT_SENSOR_ARRAY_LENGTH];
+} EFI_ACPI_ASF_ALRT;
+
+///
+/// Alert Remote Control System Actions
+///
+#define ASF_RCTL_DEVICES_ARRAY_LENGTH 16
+typedef struct {
+ EFI_ACPI_ASF_RECORD_HEADER RecordHeader;
+ UINT8 NumberOfControls;
+ UINT8 ArrayElementLength;
+ UINT16 RctlReserved;
+ UINT8 ControlArray[ASF_RCTL_DEVICES_ARRAY_LENGTH];
+} EFI_ACPI_ASF_RCTL;
+
+///
+/// Remote Control Capabilities
+///
+typedef struct {
+ EFI_ACPI_ASF_RECORD_HEADER RecordHeader;
+ UINT8 RemoteControlCapabilities[7];
+ UINT8 RMCPCompletionCode;
+ UINT32 RMCPIANA;
+ UINT8 RMCPSpecialCommand;
+ UINT8 RMCPSpecialCommandParameter[2];
+ UINT8 RMCPBootOptions[2];
+ UINT8 RMCPOEMParameters[2];
+} EFI_ACPI_ASF_RMCP;
+
+///
+/// SMBus Devices with fixed addresses
+///
+#define ASF_ADDR_DEVICE_ARRAY_LENGTH 11
+typedef struct {
+ EFI_ACPI_ASF_RECORD_HEADER RecordHeader;
+ UINT8 SEEPROMAddress;
+ UINT8 NumberOfDevices;
+ UINT8 FixedSmbusAddresses[ASF_ADDR_DEVICE_ARRAY_LENGTH];
+} EFI_ACPI_ASF_ADDR;
+
+typedef struct {
+ EFI_ACPI_DESCRIPTION_HEADER Header;
+ EFI_ACPI_ASF_INFO AsfInfo;
+ EFI_ACPI_ASF_ALRT AsfAlert;
+ EFI_ACPI_ASF_RCTL AsfRctl;
+ EFI_ACPI_ASF_RMCP AsfRmcp;
+ EFI_ACPI_ASF_ADDR AsfAddr;
+} EFI_ACPI_1_0_ASF_DESCRIPTION_TABLE;
+
+///
+/// "ASF!" ASF Description Table Signature
+///
+#define EFI_ACPI_1_0_ASF_DESCRIPTION_TABLE_SIGNATURE 0x21465341
+
+#pragma pack()
+
+#endif // _ALERT_STANDARD_FORMAT_TABLE_H
diff --git a/ReferenceCode/ME/SampleCode/Include/AslUpdateLib.h b/ReferenceCode/ME/SampleCode/Include/AslUpdateLib.h
new file mode 100644
index 0000000..dcee41d
--- /dev/null
+++ b/ReferenceCode/ME/SampleCode/Include/AslUpdateLib.h
@@ -0,0 +1,167 @@
+/** @file
+ ASL dynamic update library definitions.
+ This library provides dymanic update to various ASL structures.
+ There may be different libraries for different environments (PEI, BS, RT, SMM).
+ Make sure you meet the requirements for the library (protocol dependencies, use
+ restrictions, etc).
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _ASL_UPDATE_LIB_H_
+#define _ASL_UPDATE_LIB_H_
+
+//
+// Include files
+//
+#include "Acpi.h"
+#include "Acpi3_0.h"
+
+#include EFI_PROTOCOL_DEPENDENCY (AcpiSupport)
+#include EFI_PROTOCOL_DEPENDENCY (AcpiTable)
+
+//
+// AML parsing definitions
+//
+#define AML_NAME_OP 0x08
+#define AML_SCOPE_OP 0x10
+#define AML_PACKAGE_OP 0x12
+#define AML_METHOD_OP 0x14
+#define AML_OPREGION_OP 0x80
+#define AML_DEVICE_OP 0x82
+#define AML_PROCESSOR_OP 0x83
+
+//
+// Magic number definition for values to be updated
+//
+#define UINT16_BIT_MAGIC_NUMBER 0xFFFF
+#define UINT32_BIT_MAGIC_NUMBER 0xFFFFFFFF
+
+///
+/// ASL PSS package structure layout
+///
+#pragma pack(1)
+typedef struct {
+ UINT8 NameOp; ///< 12h ;First opcode is a NameOp.
+ UINT8 PackageLead; ///< 20h ;First opcode is a NameOp.
+ UINT8 NumEntries; ///< 06h ;First opcode is a NameOp.
+ UINT8 DwordPrefix1; ///< 0Ch
+ UINT32 CoreFrequency; ///< 00h
+ UINT8 DwordPrefix2; ///< 0Ch
+ UINT32 Power; ///< 00h
+ UINT8 DwordPrefix3; ///< 0Ch
+ UINT32 TransLatency; ///< 00h
+ UINT8 DwordPrefix4; ///< 0Ch
+ UINT32 BMLatency; ///< 00h
+ UINT8 DwordPrefix5; ///< 0Ch
+ UINT32 Control; ///< 00h
+ UINT8 DwordPrefix6; ///< 0Ch
+ UINT32 Status; ///< 00h
+} PSS_PACKAGE_LAYOUT;
+#pragma pack()
+
+/**
+ Initialize the ASL update library state.
+ This must be called prior to invoking other library functions.
+
+ @param[in] None
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+InitializeAslUpdateLib (
+ VOID
+ )
+;
+
+/**
+ This procedure will update two kinds of asl code.
+ 1: Operating Region base address and length.
+ 2: Resource Consumption structures in device LDRC.
+
+ @param[in] AslSignature The signature of Operation Region that we want to update.
+ @param[in] BaseAddress Base address of IO trap.
+ @param[in] Length Length of IO address.
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+UpdateAslCode (
+ IN UINT32 AslSignature,
+ IN UINT16 BaseAddress,
+ IN UINT8 Length
+ )
+;
+
+/**
+ This function uses the ACPI support protocol to locate an ACPI table.
+ It is really only useful for finding tables that only have a single instance,
+ e.g. FADT, FACS, MADT, etc. It is not good for locating SSDT, etc.
+
+ @param[in] Signature Pointer to an ASCII string containing the OEM Table ID from the ACPI table header
+ @param[in] Table Updated with a pointer to the table
+ @param[in] Handle AcpiSupport protocol table handle for the table found
+ @param[in] Version The version of the table desired
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+LocateAcpiTableBySignature (
+ IN UINT32 Signature,
+ IN OUT EFI_ACPI_DESCRIPTION_HEADER **Table,
+ IN OUT UINTN *Handle,
+ IN OUT EFI_ACPI_TABLE_VERSION *Version
+ )
+;
+
+/**
+ This function uses the ACPI support protocol to locate an ACPI SSDT table.
+
+ @param[in] TableId Pointer to an ASCII string containing the OEM Table ID from the ACPI table header
+ @param[in] TableIdSize Length of the TableId to match. Table ID are 8 bytes long, this function
+ will consider it a match if the first TableIdSize bytes match
+ @param[in] Table Updated with a pointer to the table
+ @param[in] Handle AcpiSupport protocol table handle for the table found
+ @param[in] Version See AcpiSupport protocol, GetAcpiTable function for use
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+LocateAcpiTableByOemTableId (
+ IN UINT8 *TableId,
+ IN UINT8 TableIdSize,
+ IN OUT EFI_ACPI_DESCRIPTION_HEADER **Table,
+ IN OUT UINTN *Handle,
+ IN OUT EFI_ACPI_TABLE_VERSION *Version
+ )
+;
+
+/**
+ This function calculates and updates an UINT8 checksum.
+
+ @param[in] Buffer Pointer to buffer to checksum
+ @param[in] Size Number of bytes to checksum
+ @param[in] ChecksumOffset Offset to place the checksum result in
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+AcpiChecksum (
+ IN VOID *Buffer,
+ IN UINTN Size,
+ IN UINTN ChecksumOffset
+ )
+;
+#endif
diff --git a/ReferenceCode/ME/SampleCode/Include/Guid/MemoryOverwriteControl/MemoryOverwriteControl.h b/ReferenceCode/ME/SampleCode/Include/Guid/MemoryOverwriteControl/MemoryOverwriteControl.h
new file mode 100644
index 0000000..a792842
--- /dev/null
+++ b/ReferenceCode/ME/SampleCode/Include/Guid/MemoryOverwriteControl/MemoryOverwriteControl.h
@@ -0,0 +1,81 @@
+/** @file
+ GUID used for MemoryOverwriteRequestControl UEFI variable defined in
+ TCG Platform Reset Attack Mitigation Specification 1.00.
+ See http://trustedcomputinggroup.org for the latest specification
+
+ The purpose of the MemoryOverwriteRequestControl UEFI variable is to give users (e.g., OS, loader) the ability to
+ indicate to the platform that secrets are present in memory and that the platform firmware must clear memory upon
+ a restart. The OS loader should not create the variable. Rather, the firmware is required to create it.
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+#ifndef _MEMORY_OVERWRITE_CONTROL_DATA_GUID_H_
+#define _MEMORY_OVERWRITE_CONTROL_DATA_GUID_H_
+
+#define MEMORY_ONLY_RESET_CONTROL_GUID \
+ { \
+ 0xe20939be, 0x32d4, 0x41be, {0xa1, 0x50, 0x89, 0x7f, 0x85, 0xd4, 0x98, 0x29} \
+ }
+
+///
+/// Variable name is "MemoryOverwriteRequestControl" and it is a 1 byte unsigned value.
+/// The attributes should be:
+/// EFI_VARIABLE_NON_VOLATILE |
+/// EFI_VARIABLE_BOOTSERVICE_ACCESS |
+/// EFI_VARIABLE_RUNTIME_ACCESS
+///
+#define MEMORY_OVERWRITE_REQUEST_VARIABLE_NAME L"MemoryOverwriteRequestControl"
+
+///
+/// 0 = Firmware MUST clear the MOR bi
+/// 1 = Firmware MUST set the MOR bit
+///
+#define MOR_CLEAR_MEMORY_BIT_MASK 0x01
+
+///
+/// 0 = Firmware MAY autodetect a clean shutdown of the Static RTM OS.
+/// 1 = Firmware MUST NOT autodetect a clean shutdown of the Static RTM OS.
+///
+#define MOR_DISABLEAUTODETECT_BIT_MASK 0x10
+
+///
+/// MOR field bit offset
+///
+#define MOR_CLEAR_MEMORY_BIT_OFFSET 0
+#define MOR_DISABLEAUTODETECT_BIT_OFFSET 4
+
+/**
+ Return the ClearMemory bit value 0 or 1.
+
+ @param mor 1 byte value that contains ClearMemory and DisableAutoDetect bit.
+
+ @return ClearMemory bit value
+**/
+#define MOR_CLEAR_MEMORY_VALUE(mor) (((UINT8)(mor) & MOR_CLEAR_MEMORY_BIT_MASK) >> MOR_CLEAR_MEMORY_BIT_OFFSET)
+
+/**
+ Return the DisableAutoDetect bit value 0 or 1.
+
+ @param mor 1 byte value that contains ClearMemory and DisableAutoDetect bit.
+
+ @return DisableAutoDetect bit value
+**/
+#define MOR_DISABLE_AUTO_DETECT_VALUE(mor) (((UINT8)(mor) & MOR_DISABLEAUTODETECT_BIT_MASK) >> MOR_DISABLEAUTODETECT_BIT_OFFSET)
+
+extern EFI_GUID gEfiMemoryOverwriteControlDataGuid;
+
+#endif
diff --git a/ReferenceCode/ME/SampleCode/Include/Guid/TrEEPhysicalPresenceData/TrEEPhysicalPresenceData.h b/ReferenceCode/ME/SampleCode/Include/Guid/TrEEPhysicalPresenceData/TrEEPhysicalPresenceData.h
new file mode 100644
index 0000000..215e8f9
--- /dev/null
+++ b/ReferenceCode/ME/SampleCode/Include/Guid/TrEEPhysicalPresenceData/TrEEPhysicalPresenceData.h
@@ -0,0 +1,62 @@
+/** @file
+ Define the variable data structures used for TrEE physical presence.
+ The TPM2 request from firmware or OS is saved to variable. And it is
+ cleared after it is processed in the next boot cycle. The TPM2 response
+ is saved to variable.
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+#ifndef __TREE_PHYSICAL_PRESENCE_DATA_GUID_H__
+#define __TREE_PHYSICAL_PRESENCE_DATA_GUID_H__
+
+#define EFI_TREE_PHYSICAL_PRESENCE_DATA_GUID \
+ { \
+ 0xf24643c2, 0xc622, 0x494e, { 0x8a, 0xd, 0x46, 0x32, 0x57, 0x9c, 0x2d, 0x5b }\
+ }
+
+#define TREE_PHYSICAL_PRESENCE_VARIABLE L"TrEEPhysicalPresence"
+
+typedef struct {
+ UINT8 PPRequest; ///< Physical Presence request command.
+ UINT8 LastPPRequest;
+ UINT32 PPResponse;
+ UINT8 Flags;
+} EFI_TREE_PHYSICAL_PRESENCE;
+
+//
+// The definition bit of the flags
+//
+#define TREE_FLAG_NO_PPI_CLEAR 0x2
+#define TREE_FLAG_RESET_TRACK 0x8
+
+//
+// The definition of physical presence operation actions
+//
+#define TREE_PHYSICAL_PRESENCE_NO_ACTION 0
+#define TREE_PHYSICAL_PRESENCE_CLEAR_CONTROL_CLEAR 5
+#define TREE_PHYSICAL_PRESENCE_CLEAR_CONTROL_CLEAR_2 14
+#define TREE_PHYSICAL_PRESENCE_SET_NO_PPI_CLEAR_FALSE 17
+#define TREE_PHYSICAL_PRESENCE_SET_NO_PPI_CLEAR_TRUE 18
+#define TREE_PHYSICAL_PRESENCE_CLEAR_CONTROL_CLEAR_3 21
+#define TREE_PHYSICAL_PRESENCE_CLEAR_CONTROL_CLEAR_4 22
+
+#define TREE_PHYSICAL_PRESENCE_NO_ACTION_MAX 20
+
+extern EFI_GUID gEfiTrEEPhysicalPresenceGuid;
+
+#endif
+
diff --git a/ReferenceCode/ME/SampleCode/Include/IndustryStandard/AcpiAml.h b/ReferenceCode/ME/SampleCode/Include/IndustryStandard/AcpiAml.h
new file mode 100644
index 0000000..192a869
--- /dev/null
+++ b/ReferenceCode/ME/SampleCode/Include/IndustryStandard/AcpiAml.h
@@ -0,0 +1,180 @@
+/** @file
+ This file contains AML code definition in the latest ACPI spec.
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+#ifndef _ACPI_AML_H_
+#define _ACPI_AML_H_
+
+//
+// ACPI AML definition
+//
+
+//
+// Primary OpCode
+//
+#define AML_ZERO_OP 0x00
+#define AML_ONE_OP 0x01
+#define AML_ALIAS_OP 0x06
+#define AML_NAME_OP 0x08
+#define AML_BYTE_PREFIX 0x0a
+#define AML_WORD_PREFIX 0x0b
+#define AML_DWORD_PREFIX 0x0c
+#define AML_STRING_PREFIX 0x0d
+#define AML_QWORD_PREFIX 0x0e
+#define AML_SCOPE_OP 0x10
+#define AML_BUFFER_OP 0x11
+#define AML_PACKAGE_OP 0x12
+#define AML_VAR_PACKAGE_OP 0x13
+#define AML_METHOD_OP 0x14
+#define AML_DUAL_NAME_PREFIX 0x2e
+#define AML_MULTI_NAME_PREFIX 0x2f
+#define AML_NAME_CHAR_A 0x41
+#define AML_NAME_CHAR_B 0x42
+#define AML_NAME_CHAR_C 0x43
+#define AML_NAME_CHAR_D 0x44
+#define AML_NAME_CHAR_E 0x45
+#define AML_NAME_CHAR_F 0x46
+#define AML_NAME_CHAR_G 0x47
+#define AML_NAME_CHAR_H 0x48
+#define AML_NAME_CHAR_I 0x49
+#define AML_NAME_CHAR_J 0x4a
+#define AML_NAME_CHAR_K 0x4b
+#define AML_NAME_CHAR_L 0x4c
+#define AML_NAME_CHAR_M 0x4d
+#define AML_NAME_CHAR_N 0x4e
+#define AML_NAME_CHAR_O 0x4f
+#define AML_NAME_CHAR_P 0x50
+#define AML_NAME_CHAR_Q 0x51
+#define AML_NAME_CHAR_R 0x52
+#define AML_NAME_CHAR_S 0x53
+#define AML_NAME_CHAR_T 0x54
+#define AML_NAME_CHAR_U 0x55
+#define AML_NAME_CHAR_V 0x56
+#define AML_NAME_CHAR_W 0x57
+#define AML_NAME_CHAR_X 0x58
+#define AML_NAME_CHAR_Y 0x59
+#define AML_NAME_CHAR_Z 0x5a
+#define AML_ROOT_CHAR 0x5c
+#define AML_PARENT_PREFIX_CHAR 0x5e
+#define AML_NAME_CHAR__ 0x5f
+#define AML_LOCAL0 0x60
+#define AML_LOCAL1 0x61
+#define AML_LOCAL2 0x62
+#define AML_LOCAL3 0x63
+#define AML_LOCAL4 0x64
+#define AML_LOCAL5 0x65
+#define AML_LOCAL6 0x66
+#define AML_LOCAL7 0x67
+#define AML_ARG0 0x68
+#define AML_ARG1 0x69
+#define AML_ARG2 0x6a
+#define AML_ARG3 0x6b
+#define AML_ARG4 0x6c
+#define AML_ARG5 0x6d
+#define AML_ARG6 0x6e
+#define AML_STORE_OP 0x70
+#define AML_REF_OF_OP 0x71
+#define AML_ADD_OP 0x72
+#define AML_CONCAT_OP 0x73
+#define AML_SUBTRACT_OP 0x74
+#define AML_INCREMENT_OP 0x75
+#define AML_DECREMENT_OP 0x76
+#define AML_MULTIPLY_OP 0x77
+#define AML_DIVIDE_OP 0x78
+#define AML_SHIFT_LEFT_OP 0x79
+#define AML_SHIFT_RIGHT_OP 0x7a
+#define AML_AND_OP 0x7b
+#define AML_NAND_OP 0x7c
+#define AML_OR_OP 0x7d
+#define AML_NOR_OP 0x7e
+#define AML_XOR_OP 0x7f
+#define AML_NOT_OP 0x80
+#define AML_FIND_SET_LEFT_BIT_OP 0x81
+#define AML_FIND_SET_RIGHT_BIT_OP 0x82
+#define AML_DEREF_OF_OP 0x83
+#define AML_CONCAT_RES_OP 0x84
+#define AML_MOD_OP 0x85
+#define AML_NOTIFY_OP 0x86
+#define AML_SIZE_OF_OP 0x87
+#define AML_INDEX_OP 0x88
+#define AML_MATCH_OP 0x89
+#define AML_CREATE_DWORD_FIELD_OP 0x8a
+#define AML_CREATE_WORD_FIELD_OP 0x8b
+#define AML_CREATE_BYTE_FIELD_OP 0x8c
+#define AML_CREATE_BIT_FIELD_OP 0x8d
+#define AML_OBJECT_TYPE_OP 0x8e
+#define AML_CREATE_QWORD_FIELD_OP 0x8f
+#define AML_LAND_OP 0x90
+#define AML_LOR_OP 0x91
+#define AML_LNOT_OP 0x92
+#define AML_LEQUAL_OP 0x93
+#define AML_LGREATER_OP 0x94
+#define AML_LLESS_OP 0x95
+#define AML_TO_BUFFER_OP 0x96
+#define AML_TO_DEC_STRING_OP 0x97
+#define AML_TO_HEX_STRING_OP 0x98
+#define AML_TO_INTEGER_OP 0x99
+#define AML_TO_STRING_OP 0x9c
+#define AML_COPY_OBJECT_OP 0x9d
+#define AML_MID_OP 0x9e
+#define AML_CONTINUE_OP 0x9f
+#define AML_IF_OP 0xa0
+#define AML_ELSE_OP 0xa1
+#define AML_WHILE_OP 0xa2
+#define AML_NOOP_OP 0xa3
+#define AML_RETURN_OP 0xa4
+#define AML_BREAK_OP 0xa5
+#define AML_BREAK_POINT_OP 0xcc
+#define AML_ONES_OP 0xff
+
+//
+// Extended OpCode
+//
+#define AML_EXT_OP 0x5b
+
+#define AML_EXT_MUTEX_OP 0x01
+#define AML_EXT_EVENT_OP 0x02
+#define AML_EXT_COND_REF_OF_OP 0x12
+#define AML_EXT_CREATE_FIELD_OP 0x13
+#define AML_EXT_LOAD_TABLE_OP 0x1f
+#define AML_EXT_LOAD_OP 0x20
+#define AML_EXT_STALL_OP 0x21
+#define AML_EXT_SLEEP_OP 0x22
+#define AML_EXT_ACQUIRE_OP 0x23
+#define AML_EXT_SIGNAL_OP 0x24
+#define AML_EXT_WAIT_OP 0x25
+#define AML_EXT_RESET_OP 0x26
+#define AML_EXT_RELEASE_OP 0x27
+#define AML_EXT_FROM_BCD_OP 0x28
+#define AML_EXT_TO_BCD_OP 0x29
+#define AML_EXT_UNLOAD_OP 0x2a
+#define AML_EXT_REVISION_OP 0x30
+#define AML_EXT_DEBUG_OP 0x31
+#define AML_EXT_FATAL_OP 0x32
+#define AML_EXT_TIMER_OP 0x33
+#define AML_EXT_REGION_OP 0x80
+#define AML_EXT_FIELD_OP 0x81
+#define AML_EXT_DEVICE_OP 0x82
+#define AML_EXT_PROCESSOR_OP 0x83
+#define AML_EXT_POWER_RES_OP 0x84
+#define AML_EXT_THERMAL_ZONE_OP 0x85
+#define AML_EXT_INDEX_FIELD_OP 0x86
+#define AML_EXT_BANK_FIELD_OP 0x87
+#define AML_EXT_DATA_REGION_OP 0x88
+
+#endif
diff --git a/ReferenceCode/ME/SampleCode/Include/IndustryStandard/Tpm20.h b/ReferenceCode/ME/SampleCode/Include/IndustryStandard/Tpm20.h
new file mode 100644
index 0000000..95cd283
--- /dev/null
+++ b/ReferenceCode/ME/SampleCode/Include/IndustryStandard/Tpm20.h
@@ -0,0 +1,1872 @@
+/** @file
+
+ Definitions for Tpm 2.0
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+#ifndef _TPM20_H
+#define _TPM20_H
+
+///
+/// The start of TPM return codes
+///
+#define TPM_BASE 0
+#include <IndustryStandard/Tpm12.h>
+
+#pragma pack (push, 1)
+
+typedef UINT8 BYTE;
+typedef UINT8 BOOL;
+
+typedef struct {
+ UINT16 size;
+ BYTE buffer[1];
+} TPM2B;
+
+#include <IndustryStandard/Tpm20Implementation.h>
+
+#define MAX_CAP_DATA (MAX_CAP_BUFFER-sizeof(TPM_CAP)-sizeof(UINT32))
+#define MAX_CAP_ALGS (MAX_CAP_DATA/sizeof(TPMS_ALG_PROPERTY))
+#define MAX_CAP_HANDLES (MAX_CAP_DATA/sizeof(TPM_HANDLE))
+#define MAX_CAP_CC (MAX_CAP_DATA/sizeof(TPM_CC))
+#define MAX_TPM_PROPERTIES (MAX_CAP_DATA/sizeof(TPMS_TAGGED_PROPERTY))
+#define MAX_PCR_PROPERTIES (MAX_CAP_DATA/sizeof(TPMS_TAGGED_PCR_SELECT))
+#define MAX_ECC_CURVES (MAX_CAP_DATA/sizeof(TPM_ECC_CURVE))
+
+// Table 2 -- BaseTypes BaseTypes <I/O>
+
+// Table 3 -- DocumentationClarity Types <I/O>
+typedef UINT32 TPM_ALGORITHM_ID;
+typedef UINT32 TPM_MODIFIER_INDICATOR;
+typedef UINT32 TPM_SESSION_OFFSET;
+typedef UINT16 TPM_KEY_SIZE;
+typedef UINT16 TPM_KEY_BITS;
+typedef UINT64 TPM_SYSTEM_ADDRESS;
+typedef UINT32 TPM_SPEC;
+
+#define TPM_SPEC_FAMILY (TPM_SPEC)(0x322E3000)
+#define TPM_SPEC_LEVEL (TPM_SPEC)(00)
+#define TPM_SPEC_VERSION (TPM_SPEC)(88)
+#define TPM_SPEC_YEAR (TPM_SPEC)(2012)
+#define TPM_SPEC_DAY_OF_YEAR (TPM_SPEC)(65)
+
+// Table 5 -- TPM_GENERATED Constants <O,S>
+typedef UINT32 TPM_GENERATED;
+
+#define TPM_GENERATED_VALUE (TPM_GENERATED)(0xff544347)
+
+// Table 10 -- TPM_CC Constants <I/O,S>
+typedef UINT32 TPM_CC;
+
+#define TPM_CC_FIRST (TPM_CC)(0x0000011F)
+#define TPM_CC_PP_FIRST (TPM_CC)(0x0000011F)
+#define TPM_CC_NV_UndefineSpaceSpecial (TPM_CC)(0x0000011F)
+#define CC_NV_UndefineSpaceSpecial YES
+#define TPM_CC_EvictControl (TPM_CC)(0x00000120)
+#define CC_EvictControl YES
+#define TPM_CC_HierarchyControl (TPM_CC)(0x00000121)
+#define CC_HierarchyControl YES
+#define TPM_CC_NV_UndefineSpace (TPM_CC)(0x00000122)
+#define CC_NV_UndefineSpace YES
+#define TPM_CC_ChangeEPS (TPM_CC)(0x00000124)
+#define CC_ChangeEPS YES
+#define TPM_CC_ChangePPS (TPM_CC)(0x00000125)
+#define CC_ChangePPS YES
+#define TPM_CC_Clear (TPM_CC)(0x00000126)
+#define CC_Clear YES
+#define TPM_CC_ClearControl (TPM_CC)(0x00000127)
+#define CC_ClearControl YES
+#define TPM_CC_ClockSet (TPM_CC)(0x00000128)
+#define CC_ClockSet YES
+#define TPM_CC_HierarchyChangeAuth (TPM_CC)(0x00000129)
+#define CC_HierarchyChangeAuth YES
+#define TPM_CC_NV_DefineSpace (TPM_CC)(0x0000012A)
+#define CC_NV_DefineSpace YES
+#define TPM_CC_PCR_Allocate (TPM_CC)(0x0000012B)
+#define CC_PCR_Allocate YES
+#define TPM_CC_PCR_SetAuthPolicy (TPM_CC)(0x0000012C)
+#define CC_PCR_SetAuthPolicy YES
+#define TPM_CC_PP_Commands (TPM_CC)(0x0000012D)
+#define CC_PP_Commands YES
+#define TPM_CC_SetPrimaryPolicy (TPM_CC)(0x0000012E)
+#define CC_SetPrimaryPolicy YES
+#define TPM_CC_FieldUpgradeStart (TPM_CC)(0x0000012F)
+#define CC_FieldUpgradeStart NO
+#define TPM_CC_ClockRateAdjust (TPM_CC)(0x00000130)
+#define CC_ClockRateAdjust YES
+#define TPM_CC_CreatePrimary (TPM_CC)(0x00000131)
+#define CC_CreatePrimary YES
+#define TPM_CC_NV_GlobalWriteLock (TPM_CC)(0x00000132)
+#define CC_NV_GlobalWriteLock YES
+#define TPM_CC_PP_LAST (TPM_CC)(0x00000132)
+#define TPM_CC_GetCommandAuditDigest (TPM_CC)(0x00000133)
+#define CC_GetCommandAuditDigest YES
+#define TPM_CC_NV_Increment (TPM_CC)(0x00000134)
+#define CC_NV_Increment YES
+#define TPM_CC_NV_SetBits (TPM_CC)(0x00000135)
+#define CC_NV_SetBits YES
+#define TPM_CC_NV_Extend (TPM_CC)(0x00000136)
+#define CC_NV_Extend YES
+#define TPM_CC_NV_Write (TPM_CC)(0x00000137)
+#define CC_NV_Write YES
+#define TPM_CC_NV_WriteLock (TPM_CC)(0x00000138)
+#define CC_NV_WriteLock YES
+#define TPM_CC_DictionaryAttackLockReset (TPM_CC)(0x00000139)
+#define CC_DictionaryAttackLockReset YES
+#define TPM_CC_DictionaryAttackParameters (TPM_CC)(0x0000013A)
+#define CC_DictionaryAttackParameters YES
+#define TPM_CC_NV_ChangeAuth (TPM_CC)(0x0000013B)
+#define CC_NV_ChangeAuth YES
+#define TPM_CC_PCR_Event (TPM_CC)(0x0000013C)
+#define CC_PCR_Event YES
+#define TPM_CC_PCR_Reset (TPM_CC)(0x0000013D)
+#define CC_PCR_Reset YES
+#define TPM_CC_SequenceComplete (TPM_CC)(0x0000013E)
+#define CC_SequenceComplete YES
+#define TPM_CC_SetAlgorithmSet (TPM_CC)(0x0000013F)
+#define CC_SetAlgorithmSet YES
+#define TPM_CC_SetCommandCodeAuditStatus (TPM_CC)(0x00000140)
+#define CC_SetCommandCodeAuditStatus YES
+#define TPM_CC_FieldUpgradeData (TPM_CC)(0x00000141)
+#define CC_FieldUpgradeData NO
+#define TPM_CC_IncrementalSelfTest (TPM_CC)(0x00000142)
+#define CC_IncrementalSelfTest YES
+#define TPM_CC_SelfTest (TPM_CC)(0x00000143)
+#define CC_SelfTest YES
+#define TPM_CC_Startup (TPM_CC)(0x00000144)
+#define CC_Startup YES
+#define TPM_CC_Shutdown (TPM_CC)(0x00000145)
+#define CC_Shutdown YES
+#define TPM_CC_StirRandom (TPM_CC)(0x00000146)
+#define CC_StirRandom YES
+#define TPM_CC_ActivateCredential (TPM_CC)(0x00000147)
+#define CC_ActivateCredential YES
+#define TPM_CC_Certify (TPM_CC)(0x00000148)
+#define CC_Certify YES
+#define TPM_CC_PolicyNV (TPM_CC)(0x00000149)
+#define CC_PolicyNV YES
+#define TPM_CC_CertifyCreation (TPM_CC)(0x0000014A)
+#define CC_CertifyCreation YES
+#define TPM_CC_Duplicate (TPM_CC)(0x0000014B)
+#define CC_Duplicate YES
+#define TPM_CC_GetTime (TPM_CC)(0x0000014C)
+#define CC_GetTime YES
+#define TPM_CC_GetSessionAuditDigest (TPM_CC)(0x0000014D)
+#define CC_GetSessionAuditDigest YES
+#define TPM_CC_NV_Read (TPM_CC)(0x0000014E)
+#define CC_NV_Read YES
+#define TPM_CC_NV_ReadLock (TPM_CC)(0x0000014F)
+#define CC_NV_ReadLock YES
+#define TPM_CC_ObjectChangeAuth (TPM_CC)(0x00000150)
+#define CC_ObjectChangeAuth YES
+#define TPM_CC_PolicySecret (TPM_CC)(0x00000151)
+#define CC_PolicySecret YES
+#define TPM_CC_Rewrap (TPM_CC)(0x00000152)
+#define CC_Rewrap YES
+#define TPM_CC_Create (TPM_CC)(0x00000153)
+#define CC_Create YES
+#define TPM_CC_ECDH_ZGen (TPM_CC)(0x00000154)
+#define CC_ECDH_ZGen YES
+#define TPM_CC_HMAC (TPM_CC)(0x00000155)
+#define CC_HMAC YES
+#define TPM_CC_Import (TPM_CC)(0x00000156)
+#define CC_Import YES
+#define TPM_CC_Load (TPM_CC)(0x00000157)
+#define CC_Load YES
+#define TPM_CC_Quote (TPM_CC)(0x00000158)
+#define CC_Quote YES
+#define TPM_CC_RSA_Decrypt (TPM_CC)(0x00000159)
+#define CC_RSA_Decrypt YES
+#define TPM_CC_HMAC_Start (TPM_CC)(0x0000015B)
+#define CC_HMAC_Start YES
+#define TPM_CC_SequenceUpdate (TPM_CC)(0x0000015C)
+#define CC_SequenceUpdate YES
+#define TPM_CC_Sign (TPM_CC)(0x0000015D)
+#define CC_Sign YES
+#define TPM_CC_Unseal (TPM_CC)(0x0000015E)
+#define CC_Unseal YES
+#define TPM_CC_PolicySigned (TPM_CC)(0x00000160)
+#define CC_PolicySigned YES
+#define TPM_CC_ContextLoad (TPM_CC)(0x00000161)
+#define CC_ContextLoad YES
+#define TPM_CC_ContextSave (TPM_CC)(0x00000162)
+#define CC_ContextSave YES
+#define TPM_CC_ECDH_KeyGen (TPM_CC)(0x00000163)
+#define CC_ECDH_KeyGen YES
+#define TPM_CC_EncryptDecrypt (TPM_CC)(0x00000164)
+#define CC_EncryptDecrypt YES
+#define TPM_CC_FlushContext (TPM_CC)(0x00000165)
+#define CC_FlushContext YES
+#define TPM_CC_LoadExternal (TPM_CC)(0x00000167)
+#define CC_LoadExternal YES
+#define TPM_CC_MakeCredential (TPM_CC)(0x00000168)
+#define CC_MakeCredential YES
+#define TPM_CC_NV_ReadPublic (TPM_CC)(0x00000169)
+#define CC_NV_ReadPublic YES
+#define TPM_CC_PolicyAuthorize (TPM_CC)(0x0000016A)
+#define CC_PolicyAuthorize YES
+#define TPM_CC_PolicyAuthValue (TPM_CC)(0x0000016B)
+#define CC_PolicyAuthValue YES
+#define TPM_CC_PolicyCommandCode (TPM_CC)(0x0000016C)
+#define CC_PolicyCommandCode YES
+#define TPM_CC_PolicyCounterTimer (TPM_CC)(0x0000016D)
+#define CC_PolicyCounterTimer YES
+#define TPM_CC_PolicyCpHash (TPM_CC)(0x0000016E)
+#define CC_PolicyCpHash YES
+#define TPM_CC_PolicyLocality (TPM_CC)(0x0000016F)
+#define CC_PolicyLocality YES
+#define TPM_CC_PolicyNameHash (TPM_CC)(0x00000170)
+#define CC_PolicyNameHash YES
+#define TPM_CC_PolicyOR (TPM_CC)(0x00000171)
+#define CC_PolicyOR YES
+#define TPM_CC_PolicyTicket (TPM_CC)(0x00000172)
+#define CC_PolicyTicket YES
+#define TPM_CC_ReadPublic (TPM_CC)(0x00000173)
+#define CC_ReadPublic YES
+#define TPM_CC_RSA_Encrypt (TPM_CC)(0x00000174)
+#define CC_RSA_Encrypt YES
+#define TPM_CC_StartAuthSession (TPM_CC)(0x00000176)
+#define CC_StartAuthSession YES
+#define TPM_CC_VerifySignature (TPM_CC)(0x00000177)
+#define CC_VerifySignature YES
+#define TPM_CC_ECC_Parameters (TPM_CC)(0x00000178)
+#define CC_ECC_Parameters YES
+#define TPM_CC_FirmwareRead (TPM_CC)(0x00000179)
+#define CC_FirmwareRead NO
+#define TPM_CC_GetCapability (TPM_CC)(0x0000017A)
+#define CC_GetCapability YES
+#define TPM_CC_GetRandom (TPM_CC)(0x0000017B)
+#define CC_GetRandom YES
+#define TPM_CC_GetTestResult (TPM_CC)(0x0000017C)
+#define CC_GetTestResult YES
+#define TPM_CC_Hash (TPM_CC)(0x0000017D)
+#define CC_Hash YES
+#define TPM_CC_PCR_Read (TPM_CC)(0x0000017E)
+#define CC_PCR_Read YES
+#define TPM_CC_PolicyPCR (TPM_CC)(0x0000017F)
+#define CC_PolicyPCR YES
+#define TPM_CC_PolicyRestart (TPM_CC)(0x00000180)
+#define CC_PolicyRestart YES
+#define TPM_CC_ReadClock (TPM_CC)(0x00000181)
+#define CC_ReadClock YES
+#define TPM_CC_PCR_Extend (TPM_CC)(0x00000182)
+#define CC_PCR_Extend YES
+#define TPM_CC_PCR_SetAuthValue (TPM_CC)(0x00000183)
+#define CC_PCR_SetAuthValue YES
+#define TPM_CC_NV_Certify (TPM_CC)(0x00000184)
+#define CC_NV_Certify YES
+#define TPM_CC_EventSequenceComplete (TPM_CC)(0x00000185)
+#define CC_EventSequenceComplete YES
+#define TPM_CC_HashSequenceStart (TPM_CC)(0x00000186)
+#define CC_HashSequenceStart YES
+#define TPM_CC_PolicyPhysicalPresence (TPM_CC)(0x00000187)
+#define CC_PolicyPhysicalPresence YES
+#define TPM_CC_PolicyDuplicationSelect (TPM_CC)(0x00000188)
+#define CC_PolicyDuplicationSelect YES
+#define TPM_CC_PolicyGetDigest (TPM_CC)(0x00000189)
+#define CC_PolicyGetDigest YES
+#define TPM_CC_TestParms (TPM_CC)(0x0000018A)
+#define CC_TestParms YES
+#define TPM_CC_Commit (TPM_CC)(0x0000018B)
+#define CC_Commit YES
+#define TPM_CC_PolicyPassword (TPM_CC)(0x0000018C)
+#define CC_PolicyPassword YES
+#define TPM_CC_LAST (TPM_CC)(0x0000018C)
+
+// Table 14 -- TPM_RC Constants <O,S>
+typedef UINT32 TPM_RC;
+
+#define TPM_RC_SUCCESS (TPM_RC)(0x000)
+#define TPM_RC_BAD_TAG (TPM_RC)(0x030)
+#define RC_VER1 (TPM_RC)(0x100)
+#define TPM_RC_INITIALIZE (TPM_RC)(RC_VER1 + 0x000)
+#define TPM_RC_FAILURE (TPM_RC)(RC_VER1 + 0x001)
+#define TPM_RC_SEQUENCE (TPM_RC)(RC_VER1 + 0x003)
+#define TPM_RC_PRIVATE (TPM_RC)(RC_VER1 + 0x00B)
+#define TPM_RC_HMAC (TPM_RC)(RC_VER1 + 0x019)
+#define TPM_RC_DISABLED (TPM_RC)(RC_VER1 + 0x020)
+#define TPM_RC_EXCLUSIVE (TPM_RC)(RC_VER1 + 0x021)
+#define TPM_RC_ECC_CURVE (TPM_RC)(RC_VER1 + 0x023)
+#define TPM_RC_AUTH_TYPE (TPM_RC)(RC_VER1 + 0x024)
+#define TPM_RC_AUTH_MISSING (TPM_RC)(RC_VER1 + 0x025)
+#define TPM_RC_POLICY (TPM_RC)(RC_VER1 + 0x026)
+#define TPM_RC_PCR (TPM_RC)(RC_VER1 + 0x027)
+#define TPM_RC_PCR_CHANGED (TPM_RC)(RC_VER1 + 0x028)
+#define TPM_RC_ECC_POINT (TPM_RC)(RC_VER1 + 0x02C)
+#define TPM_RC_UPGRADE (TPM_RC)(RC_VER1 + 0x02D)
+#define TPM_RC_TOO_MANY_CONTEXTS (TPM_RC)(RC_VER1 + 0x02E)
+#define TPM_RC_AUTH_UNAVAILABLE (TPM_RC)(RC_VER1 + 0x02F)
+#define TPM_RC_REBOOT (TPM_RC)(RC_VER1 + 0x030)
+#define TPM_RC_UNBALANCED (TPM_RC)(RC_VER1 + 0x031)
+#define TPM_RC_COMMAND_SIZE (TPM_RC)(RC_VER1 + 0x042)
+#define TPM_RC_COMMAND_CODE (TPM_RC)(RC_VER1 + 0x043)
+#define TPM_RC_AUTHSIZE (TPM_RC)(RC_VER1 + 0x044)
+#define TPM_RC_AUTH_CONTEXT (TPM_RC)(RC_VER1 + 0x045)
+#define TPM_RC_NV_RANGE (TPM_RC)(RC_VER1 + 0x046)
+#define TPM_RC_NV_SIZE (TPM_RC)(RC_VER1 + 0x047)
+#define TPM_RC_NV_LOCKED (TPM_RC)(RC_VER1 + 0x048)
+#define TPM_RC_NV_AUTHORIZATION (TPM_RC)(RC_VER1 + 0x049)
+#define TPM_RC_NV_UNINITIALIZED (TPM_RC)(RC_VER1 + 0x04A)
+#define TPM_RC_NV_SPACE (TPM_RC)(RC_VER1 + 0x04B)
+#define TPM_RC_NV_DEFINED (TPM_RC)(RC_VER1 + 0x04C)
+#define TPM_RC_BAD_CONTEXT (TPM_RC)(RC_VER1 + 0x050)
+#define TPM_RC_CPHASH (TPM_RC)(RC_VER1 + 0x051)
+#define TPM_RC_PARENT (TPM_RC)(RC_VER1 + 0x052)
+#define TPM_RC_NEEDS_TEST (TPM_RC)(RC_VER1 + 0x053)
+#define TPM_RC_NO_RESULT (TPM_RC)(RC_VER1 + 0x054)
+#define TPM_RC_SENSITIVE (TPM_RC)(RC_VER1 + 0x055)
+#define RC_MAX_FM0 (TPM_RC)(RC_VER1 + 0x07F)
+#define RC_FMT1 (TPM_RC)(0x080)
+#define TPM_RC_ASYMMETRIC (TPM_RC)(RC_FMT1 + 0x001)
+#define TPM_RC_ATTRIBUTES (TPM_RC)(RC_FMT1 + 0x002)
+#define TPM_RC_HASH (TPM_RC)(RC_FMT1 + 0x003)
+#define TPM_RC_VALUE (TPM_RC)(RC_FMT1 + 0x004)
+#define TPM_RC_HIERARCHY (TPM_RC)(RC_FMT1 + 0x005)
+#define TPM_RC_KEY_SIZE (TPM_RC)(RC_FMT1 + 0x007)
+#define TPM_RC_MGF (TPM_RC)(RC_FMT1 + 0x008)
+#define TPM_RC_MODE (TPM_RC)(RC_FMT1 + 0x009)
+#define TPM_RC_TYPE (TPM_RC)(RC_FMT1 + 0x00A)
+#define TPM_RC_HANDLE (TPM_RC)(RC_FMT1 + 0x00B)
+#define TPM_RC_KDF (TPM_RC)(RC_FMT1 + 0x00C)
+#define TPM_RC_RANGE (TPM_RC)(RC_FMT1 + 0x00D)
+#define TPM_RC_AUTH_FAIL (TPM_RC)(RC_FMT1 + 0x00E)
+#define TPM_RC_NONCE (TPM_RC)(RC_FMT1 + 0x00F)
+#define TPM_RC_PP (TPM_RC)(RC_FMT1 + 0x010)
+#define TPM_RC_SCHEME (TPM_RC)(RC_FMT1 + 0x012)
+#define TPM_RC_SIZE (TPM_RC)(RC_FMT1 + 0x015)
+#define TPM_RC_SYMMETRIC (TPM_RC)(RC_FMT1 + 0x016)
+#define TPM_RC_TAG (TPM_RC)(RC_FMT1 + 0x017)
+#define TPM_RC_SELECTOR (TPM_RC)(RC_FMT1 + 0x018)
+#define TPM_RC_INSUFFICIENT (TPM_RC)(RC_FMT1 + 0x01A)
+#define TPM_RC_SIGNATURE (TPM_RC)(RC_FMT1 + 0x01B)
+#define TPM_RC_KEY (TPM_RC)(RC_FMT1 + 0x01C)
+#define TPM_RC_POLICY_FAIL (TPM_RC)(RC_FMT1 + 0x01D)
+#define TPM_RC_INTEGRITY (TPM_RC)(RC_FMT1 + 0x01F)
+#define TPM_RC_TICKET (TPM_RC)(RC_FMT1 + 0x020)
+#define TPM_RC_RESERVED_BITS (TPM_RC)(RC_FMT1 + 0x021)
+#define TPM_RC_BAD_AUTH (TPM_RC)(RC_FMT1 + 0x022)
+#define TPM_RC_EXPIRED (TPM_RC)(RC_FMT1 + 0x023)
+#define TPM_RC_POLICY_CC (TPM_RC)(RC_FMT1 + 0x024 )
+#define TPM_RC_BINDING (TPM_RC)(RC_FMT1 + 0x025)
+#define TPM_RC_CURVE (TPM_RC)(RC_FMT1 + 0x026)
+#define RC_WARN (TPM_RC)(0x900)
+#define TPM_RC_CONTEXT_GAP (TPM_RC)(RC_WARN + 0x001)
+#define TPM_RC_OBJECT_MEMORY (TPM_RC)(RC_WARN + 0x002)
+#define TPM_RC_SESSION_MEMORY (TPM_RC)(RC_WARN + 0x003)
+#define TPM_RC_MEMORY (TPM_RC)(RC_WARN + 0x004)
+#define TPM_RC_SESSION_HANDLES (TPM_RC)(RC_WARN + 0x005)
+#define TPM_RC_OBJECT_HANDLES (TPM_RC)(RC_WARN + 0x006)
+#define TPM_RC_LOCALITY (TPM_RC)(RC_WARN + 0x007)
+#define TPM_RC_YIELDED (TPM_RC)(RC_WARN + 0x008)
+#define TPM_RC_CANCELLED (TPM_RC)(RC_WARN + 0x009)
+#define TPM_RC_TESTING (TPM_RC)(RC_WARN + 0x00A)
+#define TPM_RC_REFERENCE_H0 (TPM_RC)(RC_WARN + 0x010)
+#define TPM_RC_REFERENCE_H1 (TPM_RC)(RC_WARN + 0x011)
+#define TPM_RC_REFERENCE_H2 (TPM_RC)(RC_WARN + 0x012)
+#define TPM_RC_REFERENCE_H3 (TPM_RC)(RC_WARN + 0x013)
+#define TPM_RC_REFERENCE_H4 (TPM_RC)(RC_WARN + 0x014)
+#define TPM_RC_REFERENCE_H5 (TPM_RC)(RC_WARN + 0x015)
+#define TPM_RC_REFERENCE_H6 (TPM_RC)(RC_WARN + 0x016)
+#define TPM_RC_REFERENCE_S0 (TPM_RC)(RC_WARN + 0x018)
+#define TPM_RC_REFERENCE_S1 (TPM_RC)(RC_WARN + 0x019)
+#define TPM_RC_REFERENCE_S2 (TPM_RC)(RC_WARN + 0x01A)
+#define TPM_RC_REFERENCE_S3 (TPM_RC)(RC_WARN + 0x01B)
+#define TPM_RC_REFERENCE_S4 (TPM_RC)(RC_WARN + 0x01C)
+#define TPM_RC_REFERENCE_S5 (TPM_RC)(RC_WARN + 0x01D)
+#define TPM_RC_REFERENCE_S6 (TPM_RC)(RC_WARN + 0x01E)
+#define TPM_RC_NV_RATE (TPM_RC)(RC_WARN + 0x020)
+#define TPM_RC_LOCKOUT (TPM_RC)(RC_WARN + 0x021)
+#define TPM_RC_RETRY (TPM_RC)(RC_WARN + 0x022)
+#define TPM_RC_NV_UNAVAILABLE (TPM_RC)(RC_WARN + 0x023)
+#define TPM_RC_NOT_USED (TPM_RC)(RC_WARN + 0x7F)
+#define TPM_RC_H (TPM_RC)(0x000)
+#define TPM_RC_P (TPM_RC)(0x040)
+#define TPM_RC_S (TPM_RC)(0x800)
+#define TPM_RC_1 (TPM_RC)(0x100)
+#define TPM_RC_2 (TPM_RC)(0x200)
+#define TPM_RC_3 (TPM_RC)(0x300)
+#define TPM_RC_4 (TPM_RC)(0x400)
+#define TPM_RC_5 (TPM_RC)(0x500)
+#define TPM_RC_6 (TPM_RC)(0x600)
+#define TPM_RC_7 (TPM_RC)(0x700)
+#define TPM_RC_8 (TPM_RC)(0x800)
+#define TPM_RC_9 (TPM_RC)(0x900)
+#define TPM_RC_A (TPM_RC)(0xA00)
+#define TPM_RC_B (TPM_RC)(0xB00)
+#define TPM_RC_C (TPM_RC)(0xC00)
+#define TPM_RC_D (TPM_RC)(0xD00)
+#define TPM_RC_E (TPM_RC)(0xE00)
+#define TPM_RC_F (TPM_RC)(0xF00)
+#define TPM_RC_N_MASK (TPM_RC)(0xF00)
+
+// Table 15 -- TPM_CLOCK_ADJUST Constants <I>
+typedef INT8 TPM_CLOCK_ADJUST;
+
+#define TPM_CLOCK_COARSE_SLOWER (TPM_CLOCK_ADJUST)(-3)
+#define TPM_CLOCK_MEDIUM_SLOWER (TPM_CLOCK_ADJUST)(-2)
+#define TPM_CLOCK_FINE_SLOWER (TPM_CLOCK_ADJUST)(-1)
+#define TPM_CLOCK_NO_CHANGE (TPM_CLOCK_ADJUST)(0)
+#define TPM_CLOCK_FINE_FASTER (TPM_CLOCK_ADJUST)(1)
+#define TPM_CLOCK_MEDIUM_FASTER (TPM_CLOCK_ADJUST)(2)
+#define TPM_CLOCK_COARSE_FASTER (TPM_CLOCK_ADJUST)(3)
+
+// Table 16 -- TPM_EO Constants <I/O>
+typedef UINT16 TPM_EO;
+
+#define TPM_EO_EQ (TPM_EO)(0x0000)
+#define TPM_EO_NEQ (TPM_EO)(0x0001)
+#define TPM_EO_SIGNED_GT (TPM_EO)(0x0002)
+#define TPM_EO_UNSIGNED_GT (TPM_EO)(0x0003)
+#define TPM_EO_SIGNED_LT (TPM_EO)(0x0004)
+#define TPM_EO_UNSIGNED_LT (TPM_EO)(0x0005)
+#define TPM_EO_SIGNED_GE (TPM_EO)(0x0006)
+#define TPM_EO_UNSIGNED_GE (TPM_EO)(0x0007)
+#define TPM_EO_SIGNED_LE (TPM_EO)(0x0008)
+#define TPM_EO_UNSIGNED_LE (TPM_EO)(0x0009)
+#define TPM_EO_BITSET (TPM_EO)(0x000A)
+#define TPM_EO_BITCLEAR (TPM_EO)(0x000B)
+
+// Table 17 -- TPM_ST Constants <I/O,S>
+typedef UINT16 TPM_ST;
+
+#define TPM_ST_RSP_COMMAND (TPM_ST)(0x00C4)
+#define TPM_ST_NULL (TPM_ST)(0X8000)
+#define TPM_ST_NO_SESSIONS (TPM_ST)(0x8001)
+#define TPM_ST_SESSIONS (TPM_ST)(0x8002)
+#define TPM_ST_ATTEST_COMMAND_AUDIT (TPM_ST)(0x8015)
+#define TPM_ST_ATTEST_SESSION_AUDIT (TPM_ST)(0x8016)
+#define TPM_ST_ATTEST_CERTIFY (TPM_ST)(0x8017)
+#define TPM_ST_ATTEST_QUOTE (TPM_ST)(0x8018)
+#define TPM_ST_ATTEST_TIME (TPM_ST)(0x8019)
+#define TPM_ST_ATTEST_CREATION (TPM_ST)(0x801A)
+#define TPM_ST_ATTEST_NV (TPM_ST)(0x801B)
+#define TPM_ST_CREATION (TPM_ST)(0x8021)
+#define TPM_ST_VERIFIED (TPM_ST)(0x8022)
+#define TPM_ST_AUTH_SECRET (TPM_ST)(0x8023)
+#define TPM_ST_HASHCHECK (TPM_ST)(0x8024)
+#define TPM_ST_AUTH_SIGNED (TPM_ST)(0x8025)
+#define TPM_ST_FU_MANIFEST (TPM_ST)(0x8029)
+
+// Table 18 -- TPM_SU Constants <I>
+typedef UINT16 TPM_SU;
+
+#define TPM_SU_CLEAR (TPM_SU)(0x0000)
+#define TPM_SU_STATE (TPM_SU)(0x0001)
+
+// Table 19 -- TPM_SE Constants <I>
+typedef UINT8 TPM_SE;
+
+#define TPM_SE_HMAC (TPM_SE)(0x00)
+#define TPM_SE_POLICY (TPM_SE)(0x01)
+#define TPM_SE_TRIAL (TPM_SE)(0x03)
+
+// Table 20 -- TPM_CAP Constants <I/O,S>
+typedef UINT32 TPM_CAP;
+
+#define TPM_CAP_FIRST (TPM_CAP)(0x00000000)
+#define TPM_CAP_ALGS (TPM_CAP)(0x00000000)
+#define TPM_CAP_HANDLES (TPM_CAP)(0x00000001)
+#define TPM_CAP_COMMANDS (TPM_CAP)(0x00000002)
+#define TPM_CAP_PP_COMMANDS (TPM_CAP)(0x00000003)
+#define TPM_CAP_AUDIT_COMMANDS (TPM_CAP)(0x00000004)
+#define TPM_CAP_PCRS (TPM_CAP)(0x00000005)
+#define TPM_CAP_TPM_PROPERTIES (TPM_CAP)(0x00000006)
+#define TPM_CAP_PCR_PROPERTIES (TPM_CAP)(0x00000007)
+#define TPM_CAP_ECC_CURVES (TPM_CAP)(0x00000008)
+#define TPM_CAP_LAST (TPM_CAP)(0x00000008)
+#define TPM_CAP_VENDOR_PROPERTY (TPM_CAP)(0x00000100)
+
+// Table 21 -- TPM_PT Constants <I/O,S>
+typedef UINT32 TPM_PT;
+
+#define TPM_PT_NONE (TPM_PT)(0x00000000)
+#define PT_GROUP (TPM_PT)(0x00000100)
+#define PT_FIXED (TPM_PT)(PT_GROUP * 1)
+#define TPM_PT_FAMILY_INDICATOR (TPM_PT)(PT_FIXED + 0)
+#define TPM_PT_LEVEL (TPM_PT)(PT_FIXED + 1)
+#define TPM_PT_REVISION (TPM_PT)(PT_FIXED + 2)
+#define TPM_PT_DAY_OF_YEAR (TPM_PT)(PT_FIXED + 3)
+#define TPM_PT_YEAR (TPM_PT)(PT_FIXED + 4)
+#define TPM_PT_MANUFACTURER (TPM_PT)(PT_FIXED + 5)
+#define TPM_PT_VENDOR_STRING_1 (TPM_PT)(PT_FIXED + 6)
+#define TPM_PT_VENDOR_STRING_2 (TPM_PT)(PT_FIXED + 7)
+#define TPM_PT_VENDOR_STRING_3 (TPM_PT)(PT_FIXED + 8)
+#define TPM_PT_VENDOR_STRING_4 (TPM_PT)(PT_FIXED + 9)
+#define TPM_PT_VENDOR_TPM_TYPE (TPM_PT)(PT_FIXED + 10)
+#define TPM_PT_FIRMWARE_VERSION_1 (TPM_PT)(PT_FIXED + 11)
+#define TPM_PT_FIRMWARE_VERSION_2 (TPM_PT)(PT_FIXED + 12)
+#define TPM_PT_INPUT_BUFFER (TPM_PT)(PT_FIXED + 13)
+#define TPM_PT_HR_TRANSIENT_MIN (TPM_PT)(PT_FIXED + 14)
+#define TPM_PT_HR_PERSISTENT_MIN (TPM_PT)(PT_FIXED + 15)
+#define TPM_PT_HR_LOADED_MIN (TPM_PT)(PT_FIXED + 16)
+#define TPM_PT_ACTIVE_SESSIONS_MAX (TPM_PT)(PT_FIXED + 17)
+#define TPM_PT_PCR_COUNT (TPM_PT)(PT_FIXED + 18)
+#define TPM_PT_PCR_SELECT_MIN (TPM_PT)(PT_FIXED + 19)
+#define TPM_PT_CONTEXT_GAP_MAX (TPM_PT)(PT_FIXED + 20)
+#define TPM_PT_NV_COUNTERS_MAX (TPM_PT)(PT_FIXED + 22)
+#define TPM_PT_NV_INDEX_MAX (TPM_PT)(PT_FIXED + 23)
+#define TPM_PT_MEMORY (TPM_PT)(PT_FIXED + 24)
+#define TPM_PT_CLOCK_UPDATE (TPM_PT)(PT_FIXED + 25)
+#define TPM_PT_CONTEXT_HASH (TPM_PT)(PT_FIXED + 26)
+#define TPM_PT_CONTEXT_SYM (TPM_PT)(PT_FIXED + 27)
+#define TPM_PT_CONTEXT_SYM_SIZE (TPM_PT)(PT_FIXED + 28)
+#define TPM_PT_ORDERLY_COUNT (TPM_PT)(PT_FIXED + 29)
+#define TPM_PT_MAX_COMMAND_SIZE (TPM_PT)(PT_FIXED + 30)
+#define TPM_PT_MAX_RESPONSE_SIZE (TPM_PT)(PT_FIXED + 31)
+#define TPM_PT_MAX_DIGEST (TPM_PT)(PT_FIXED + 32)
+#define TPM_PT_MAX_OBJECT_CONTEXT (TPM_PT)(PT_FIXED + 33)
+#define TPM_PT_MAX_SESSION_CONTEXT (TPM_PT)(PT_FIXED + 34)
+#define TPM_PT_PS_FAMILY_INDICATOR (TPM_PT)(PT_FIXED + 35)
+#define TPM_PT_PS_LEVEL (TPM_PT)(PT_FIXED + 36)
+#define TPM_PT_PS_REVISION (TPM_PT)(PT_FIXED + 37)
+#define TPM_PT_PS_DAY_OF_YEAR (TPM_PT)(PT_FIXED + 38)
+#define TPM_PT_PS_YEAR (TPM_PT)(PT_FIXED + 39)
+#define TPM_PT_SPLIT_MAX (TPM_PT)(PT_FIXED + 40)
+#define TPM_PT_TOTAL_COMMANDS (TPM_PT)(PT_FIXED + 41)
+#define TPM_PT_LIBRARY_COMMANDS (TPM_PT)(PT_FIXED + 42)
+#define TPM_PT_VENDOR_COMMANDS (TPM_PT)(PT_FIXED + 43)
+#define PT_VAR (TPM_PT)(PT_GROUP * 2)
+#define TPM_PT_PERMANENT (TPM_PT)(PT_VAR + 0)
+#define TPM_PT_STARTUP_CLEAR (TPM_PT)(PT_VAR + 1)
+#define TPM_PT_HR_NV_INDEX (TPM_PT)(PT_VAR + 2)
+#define TPM_PT_HR_LOADED (TPM_PT)(PT_VAR + 3)
+#define TPM_PT_HR_LOADED_AVAIL (TPM_PT)(PT_VAR + 4)
+#define TPM_PT_HR_ACTIVE (TPM_PT)(PT_VAR + 5)
+#define TPM_PT_HR_ACTIVE_AVAIL (TPM_PT)(PT_VAR + 6)
+#define TPM_PT_HR_TRANSIENT_AVAIL (TPM_PT)(PT_VAR + 7)
+#define TPM_PT_HR_PERSISTENT (TPM_PT)(PT_VAR + 8)
+#define TPM_PT_HR_PERSISTENT_AVAIL (TPM_PT)(PT_VAR + 9)
+#define TPM_PT_NV_COUNTERS (TPM_PT)(PT_VAR + 10)
+#define TPM_PT_NV_COUNTERS_AVAIL (TPM_PT)(PT_VAR + 11)
+#define TPM_PT_ALGORITHM_SET (TPM_PT)(PT_VAR + 12)
+#define TPM_PT_LOADED_CURVES (TPM_PT)(PT_VAR + 13)
+#define TPM_PT_LOCKOUT_COUNTER (TPM_PT)(PT_VAR + 14)
+#define TPM_PT_MAX_AUTH_FAIL (TPM_PT)(PT_VAR + 15)
+#define TPM_PT_LOCKOUT_INTERVAL (TPM_PT)(PT_VAR + 16)
+#define TPM_PT_LOCKOUT_RECOVERY (TPM_PT)(PT_VAR + 17)
+#define TPM_PT_NV_WRITE_RECOVERY (TPM_PT)(PT_VAR + 18)
+#define TPM_PT_AUDIT_COUNTER_0 (TPM_PT)(PT_VAR + 19)
+#define TPM_PT_AUDIT_COUNTER_1 (TPM_PT)(PT_VAR + 20)
+
+// Table 22 -- TPM_PT_PCR Constants <I/O,S>
+typedef UINT32 TPM_PT_PCR;
+
+#define TPM_PT_PCR_FIRST (TPM_PT_PCR)(0x00000000)
+#define TPM_PT_PCR_SAVE (TPM_PT_PCR)(0x00000000)
+#define TPM_PT_PCR_EXTEND_L0 (TPM_PT_PCR)(0x00000001)
+#define TPM_PT_PCR_RESET_L0 (TPM_PT_PCR)(0x00000002)
+#define TPM_PT_PCR_EXTEND_L1 (TPM_PT_PCR)(0x00000003)
+#define TPM_PT_PCR_RESET_L1 (TPM_PT_PCR)(0x00000004)
+#define TPM_PT_PCR_EXTEND_L2 (TPM_PT_PCR)(0x00000005)
+#define TPM_PT_PCR_RESET_L2 (TPM_PT_PCR)(0x00000006)
+#define TPM_PT_PCR_EXTEND_L3 (TPM_PT_PCR)(0x00000007)
+#define TPM_PT_PCR_RESET_L3 (TPM_PT_PCR)(0x00000008)
+#define TPM_PT_PCR_EXTEND_L4 (TPM_PT_PCR)(0x00000009)
+#define TPM_PT_PCR_RESET_L4 (TPM_PT_PCR)(0x0000000A)
+#define TPM_PT_PCR_DRTM_RESET (TPM_PT_PCR)(0x0000000B)
+#define TPM_PT_PCR_POLICY (TPM_PT_PCR)(0x0000000C)
+#define TPM_PT_PCR_AUTH (TPM_PT_PCR)(0x0000000D)
+#define TPM_PT_PCR_LAST (TPM_PT_PCR)(0x0000000D)
+
+// Table 23 -- TPM_PS Constants <O,S>
+typedef UINT32 TPM_PS;
+
+#define TPM_PS_MAIN (TPM_PS)(0x00000000)
+#define TPM_PS_PC (TPM_PS)(0x00000001)
+#define TPM_PS_PDA (TPM_PS)(0x00000002)
+#define TPM_PS_CELL_PHONE (TPM_PS)(0x00000003)
+#define TPM_PS_SERVER (TPM_PS)(0x00000004)
+#define TPM_PS_PERIPHERAL (TPM_PS)(0x00000005)
+#define TPM_PS_TSS (TPM_PS)(0x00000006)
+#define TPM_PS_STORAGE (TPM_PS)(0x00000007)
+#define TPM_PS_AUTHENTICATION (TPM_PS)(0x00000008)
+#define TPM_PS_EMBEDDED (TPM_PS)(0x00000009)
+#define TPM_PS_HARDCOPY (TPM_PS)(0x0000000A)
+#define TPM_PS_INFRASTRUCTURE (TPM_PS)(0x0000000B)
+#define TPM_PS_VIRTUALIZATION (TPM_PS)(0x0000000C)
+#define TPM_PS_TNC (TPM_PS)(0x0000000D)
+#define TPM_PS_MULTI_TENANT (TPM_PS)(0x0000000E)
+#define TPM_PS_TC (TPM_PS)(0x0000000F)
+
+// Table 24 -- Handles Types <I/O>
+typedef UINT32 TPM_HANDLE;
+typedef UINT8 TPM_HT;
+
+#define TPM_HT_PCR (TPM_HT)(0x00)
+#define TPM_HT_NV_INDEX (TPM_HT)(0x01)
+#define TPM_HT_HMAC_SESSION (TPM_HT)(0x02)
+#define TPM_HT_LOADED_SESSION (TPM_HT)(0x02)
+#define TPM_HT_POLICY_SESSION (TPM_HT)(0x03)
+#define TPM_HT_ACTIVE_SESSION (TPM_HT)(0x03)
+#define TPM_HT_PERMANENT (TPM_HT)(0x40)
+#define TPM_HT_TRANSIENT (TPM_HT)(0x80)
+#define TPM_HT_PERSISTENT (TPM_HT)(0x81)
+
+// Table 26 -- TPM_RH Constants <I,S>
+typedef UINT32 TPM_RH;
+
+#define TPM_RH_FIRST (TPM_RH)(0x40000000)
+#define TPM_RH_SRK (TPM_RH)(0x40000000)
+#define TPM_RH_OWNER (TPM_RH)(0x40000001)
+#define TPM_RH_REVOKE (TPM_RH)(0x40000002)
+#define TPM_RH_TRANSPORT (TPM_RH)(0x40000003)
+#define TPM_RH_OPERATOR (TPM_RH)(0x40000004)
+#define TPM_RH_ADMIN (TPM_RH)(0x40000005)
+#define TPM_RH_EK (TPM_RH)(0x40000006)
+#define TPM_RH_NULL (TPM_RH)(0x40000007)
+#define TPM_RH_UNASSIGNED (TPM_RH)(0x40000008)
+#define TPM_RH_PW (TPM_RH)(0x40000009)
+#define TPM_RS_PW (TPM_RH)(0x40000009)
+#define TPM_RH_LOCKOUT (TPM_RH)(0x4000000A)
+#define TPM_RH_ENDORSEMENT (TPM_RH)(0x4000000B)
+#define TPM_RH_PLATFORM (TPM_RH)(0x4000000C)
+#define TPM_RH_LAST (TPM_RH)(0x4000000C)
+#define TPM_RH_PCR0 (TPM_RH)(0x00000000)
+
+// Table 27 -- TPM_HC Constants <I,S>
+typedef TPM_HANDLE TPM_HC;
+
+#define HR_HANDLE_MASK (TPM_HC)(0x00FFFFFF)
+#define HR_RANGE_MASK (TPM_HC)(0xFF000000)
+#define HR_SHIFT (TPM_HC)(24)
+#define HR_PCR (TPM_HC)((TPM_HC)TPM_HT_PCR << HR_SHIFT)
+#define HR_HMAC_SESSION (TPM_HC)((TPM_HC)TPM_HT_HMAC_SESSION << HR_SHIFT)
+#define HR_POLICY_SESSION (TPM_HC)((TPM_HC)TPM_HT_POLICY_SESSION << HR_SHIFT)
+#define HR_TRANSIENT (TPM_HC)((TPM_HC)TPM_HT_TRANSIENT << HR_SHIFT)
+#define HR_PERSISTENT (TPM_HC)((TPM_HC)TPM_HT_PERSISTENT << HR_SHIFT)
+#define HR_NV_INDEX (TPM_HC)((TPM_HC)TPM_HT_NV_INDEX << HR_SHIFT)
+#define HR_PERMANENT (TPM_HC)((TPM_HC)TPM_HT_PERMANENT << HR_SHIFT)
+#define PCR_FIRST (TPM_HC)(TPM_RH_PCR0)
+#define PCR_LAST (TPM_HC)(PCR_FIRST + IMPLEMENTATION_PCR-1)
+#define HMAC_SESSION_FIRST (TPM_HC)(HR_HMAC_SESSION + 0)
+#define HMAC_SESSION_LAST (TPM_HC)(HMAC_SESSION_FIRST+MAX_ACTIVE_SESSIONS-1)
+#define LOADED_SESSION_FIRST (TPM_HC)(HMAC_SESSION_FIRST)
+#define LOADED_SESSION_LAST (TPM_HC)(HMAC_SESSION_LAST)
+#define POLICY_SESSION_FIRST (TPM_HC)(HR_POLICY_SESSION + 0)
+#define POLICY_SESSION_LAST (TPM_HC)(POLICY_SESSION_FIRST + MAX_ACTIVE_SESSIONS-1)
+#define TRANSIENT_FIRST (TPM_HC)(HR_TRANSIENT + 0)
+#define ACTIVE_SESSION_FIRST (TPM_HC)(POLICY_SESSION_FIRST)
+#define ACTIVE_SESSION_LAST (TPM_HC)(POLICY_SESSION_LAST)
+#define TRANSIENT_LAST (TPM_HC)(TRANSIENT_FIRST+MAX_LOADED_OBJECTS-1)
+#define PERSISTENT_FIRST (TPM_HC)(HR_PERSISTENT + 0)
+#define PERSISTENT_LAST (TPM_HC)(PERSISTENT_FIRST + 0x00FFFFFF)
+#define PLATFORM_PERSISTENT (TPM_HC)(PERSISTENT_FIRST + 0x00800000)
+#define NV_INDEX_FIRST (TPM_HC)(HR_NV_INDEX + 0)
+#define NV_INDEX_LAST (TPM_HC)(NV_INDEX_FIRST + 0x00FFFFFF)
+#define PERMANENT_FIRST (TPM_HC)(TPM_RH_FIRST)
+#define PERMANENT_LAST (TPM_HC)(TPM_RH_LAST)
+
+// Table 28 -- TPMA_ALGORITHM Bits <I/O>
+typedef struct {
+ unsigned int asymmetric : 1;
+ unsigned int symmetric : 1;
+ unsigned int hash : 1;
+ unsigned int object : 1;
+ unsigned int reserved5 : 4;
+ unsigned int signing : 1;
+ unsigned int encrypting : 1;
+ unsigned int method : 1;
+ unsigned int reserved9 : 21;
+} TPMA_ALGORITHM ;
+
+// Table 29 -- TPMA_OBJECT Bits <I/O>
+typedef struct {
+ unsigned int reserved1 : 1;
+ unsigned int fixedTPM : 1;
+ unsigned int stClear : 1;
+ unsigned int reserved4 : 1;
+ unsigned int fixedParent : 1;
+ unsigned int sensitiveDataOrigin : 1;
+ unsigned int userWithAuth : 1;
+ unsigned int adminWithPolicy : 1;
+ unsigned int Pad9 : 1; //Inserted extra pad
+ unsigned int reserved9 : 1;
+ unsigned int noDA : 1;
+ unsigned int reserved11 : 5;
+ unsigned int restricted : 1;
+ unsigned int decrypt : 1;
+ unsigned int sign : 1;
+ unsigned int Pad15 : 9; //Inserted extra pad
+ unsigned int softwareUse : 4;
+} TPMA_OBJECT ;
+
+// Table 30 -- TPMA_SESSION Bits <I/O>
+typedef struct {
+ unsigned int continueSession : 1;
+ unsigned int auditExclusive : 1;
+ unsigned int auditReset : 1;
+ unsigned int reserved4 : 2;
+ unsigned int decrypt : 1;
+ unsigned int encrypt : 1;
+ unsigned int audit : 1;
+} TPMA_SESSION ;
+
+// Table 31 -- TPMA_LOCALITY Bits <I/O>
+//
+// BUGBUG: Use low case here to resolve conflict
+//
+typedef struct {
+ unsigned int locZero : 1;
+ unsigned int locOne : 1;
+ unsigned int locTwo : 1;
+ unsigned int locThree : 1;
+ unsigned int locFour : 1;
+ unsigned int reserved6 : 3;
+} TPMA_LOCALITY ;
+
+// Table 32 -- TPMA_PERMANENT Bits <O,S>
+typedef struct {
+ unsigned int ownerAuthSet : 1;
+ unsigned int endorsementAuthSet : 1;
+ unsigned int lockoutAuthSet : 1;
+ unsigned int reserved4 : 5;
+ unsigned int disableClear : 1;
+ unsigned int inLockout : 1;
+ unsigned int tpmGeneratedEPS : 1;
+ unsigned int reserved8 : 21;
+} TPMA_PERMANENT ;
+
+// Table 33 -- TPMA_STARTUP_CLEAR Bits <O,S>
+typedef struct {
+ unsigned int phEnable : 1;
+ unsigned int shEnable : 1;
+ unsigned int ehEnable : 1;
+ unsigned int reserved4 : 28;
+ unsigned int orderly : 1;
+} TPMA_STARTUP_CLEAR ;
+
+// Table 34 -- TPMA_MEMORY Bits <O,S>
+typedef struct {
+ unsigned int sharedRAM : 1;
+ unsigned int sharedNV : 1;
+ unsigned int objectCopiedToRam : 1;
+ unsigned int reserved4 : 29;
+} TPMA_MEMORY ;
+
+// Table 35 -- TPMA_CC Bits <O,S>
+typedef struct {
+ unsigned int commandIndex : 16;
+ unsigned int reserved2 : 6;
+ unsigned int nv : 1;
+ unsigned int extensive : 1;
+ unsigned int flushed : 1;
+ unsigned int cHandles : 3;
+ unsigned int rHandle : 1;
+ unsigned int V : 1;
+ unsigned int reserved9 : 2;
+} TPMA_CC ;
+
+// Table 36 -- TPMI_YES_NO Type <I/O>
+typedef BYTE TPMI_YES_NO;
+
+// Table 37 -- TPMI_DH_OBJECT Type <I/O>
+typedef TPM_HANDLE TPMI_DH_OBJECT;
+
+// Table 38 -- TPMI_DH_PERSISTENT Type <I/O>
+typedef TPM_HANDLE TPMI_DH_PERSISTENT;
+
+// Table 39 -- TPMI_DH_ENTITY Type <I>
+typedef TPM_HANDLE TPMI_DH_ENTITY;
+
+// Table 40 -- TPMI_DH_PCR Type <I>
+typedef TPM_HANDLE TPMI_DH_PCR;
+
+// Table 41 -- TPMI_SH_AUTH_SESSION Type <I/O>
+typedef TPM_HANDLE TPMI_SH_AUTH_SESSION;
+
+// Table 42 -- TPMI_SH_HMAC Type <I/O>
+typedef TPM_HANDLE TPMI_SH_HMAC;
+
+// Table 43 -- TPMI_SH_POLICY Type <I/O>
+typedef TPM_HANDLE TPMI_SH_POLICY;
+
+// Table 44 -- TPMI_DH_CONTEXT Type <I/O>
+typedef TPM_HANDLE TPMI_DH_CONTEXT;
+
+// Table 45 -- TPMI_RH_HIERARCHY Type <I/O>
+typedef TPM_HANDLE TPMI_RH_HIERARCHY;
+
+// Table 46 -- TPMI_RH_HIERARCHY_AUTH Type <I>
+typedef TPM_HANDLE TPMI_RH_HIERARCHY_AUTH;
+
+// Table 47 -- TPMI_RH_PLATFORM Type <I>
+typedef TPM_HANDLE TPMI_RH_PLATFORM;
+
+// Table 48 -- TPMI_RH_OWNER Type <I>
+typedef TPM_HANDLE TPMI_RH_OWNER;
+
+// Table 49 -- TPMI_RH_ENDORSEMENT Type <I>
+typedef TPM_HANDLE TPMI_RH_ENDORSEMENT;
+
+// Table 50 -- TPMI_RH_PROVISION Type <I>
+typedef TPM_HANDLE TPMI_RH_PROVISION;
+
+// Table 51 -- TPMI_RH_CLEAR Type <I>
+typedef TPM_HANDLE TPMI_RH_CLEAR;
+
+// Table 52 -- TPMI_RH_NV_AUTH Type <I>
+typedef TPM_HANDLE TPMI_RH_NV_AUTH;
+
+// Table 53 -- TPMI_RH_LOCKOUT Type <I>
+typedef TPM_HANDLE TPMI_RH_LOCKOUT;
+
+// Table 54 -- TPMI_RH_NV_INDEX Type <I/O>
+typedef TPM_HANDLE TPMI_RH_NV_INDEX;
+
+// Table 55 -- TPMI_ALG_HASH Type <I/O>
+typedef TPM_ALG_ID TPMI_ALG_HASH;
+
+// Table 56 -- TPMI_ALG_ASYM Type <I/O>
+typedef TPM_ALG_ID TPMI_ALG_ASYM;
+
+// Table 57 -- TPMI_ALG_SYM Type <I/O>
+typedef TPM_ALG_ID TPMI_ALG_SYM;
+
+// Table 58 -- TPMI_ALG_SYM_OBJECT Type <I/O>
+typedef TPM_ALG_ID TPMI_ALG_SYM_OBJECT;
+
+// Table 59 -- TPMI_ALG_SYM_MODE Type <I/O>
+typedef TPM_ALG_ID TPMI_ALG_SYM_MODE;
+
+// Table 60 -- TPMI_ALG_KDF Type <I/O>
+typedef TPM_ALG_ID TPMI_ALG_KDF;
+
+// Table 61 -- TPMI_ALG_SIG_SCHEME Type <I/O>
+typedef TPM_ALG_ID TPMI_ALG_SIG_SCHEME;
+
+// Table 62 -- TPMI_ST_COMMAND_TAG Type <I/O>
+typedef TPM_ST TPMI_ST_COMMAND_TAG;
+
+// Table 63 -- TPMS_ALGORITHM_DESCRIPTION Structure <O,S>
+typedef struct {
+ TPM_ALG_ID alg;
+ TPMA_ALGORITHM attributes;
+} TPMS_ALGORITHM_DESCRIPTION;
+
+// Table 64 -- TPMU_HA Union <I/O,S>
+typedef union {
+ BYTE sha1[SHA1_DIGEST_SIZE];
+ BYTE sha256[SHA256_DIGEST_SIZE];
+ BYTE sm3_256[SM3_256_DIGEST_SIZE];
+ BYTE sha384[SHA384_DIGEST_SIZE];
+ BYTE sha512[SHA512_DIGEST_SIZE];
+ BYTE whirlpool[WHIRLPOOL512_DIGEST_SIZE];
+} TPMU_HA ;
+
+// Table 65 -- TPMT_HA Structure <I/O>
+typedef struct {
+ TPMI_ALG_HASH hashAlg;
+ TPMU_HA digest;
+} TPMT_HA;
+
+// Table 66 -- TPM2B_DIGEST Structure <I/O>
+typedef struct {
+ UINT16 size;
+ BYTE buffer[sizeof(TPMU_HA)];
+} DIGEST_2B;
+
+typedef union {
+ DIGEST_2B t;
+ TPM2B b;
+} TPM2B_DIGEST;
+
+// Table 67 -- TPM2B_DATA Structure <I/O>
+typedef struct {
+ UINT16 size;
+ BYTE buffer[sizeof(TPMT_HA)];
+} DATA_2B;
+
+typedef union {
+ DATA_2B t;
+ TPM2B b;
+} TPM2B_DATA;
+
+// Table 68 -- TPM2B_NONCE Types <I/O>
+typedef TPM2B_DIGEST TPM2B_NONCE;
+
+// Table 69 -- TPM2B_AUTH Types <I/O>
+typedef TPM2B_DIGEST TPM2B_AUTH;
+
+// Table 70 -- TPM2B_OPERAND Types <I/O>
+typedef TPM2B_DIGEST TPM2B_OPERAND;
+
+// Table 71 -- TPM2B_EVENT Structure <I/O>
+typedef struct {
+ UINT16 size;
+ BYTE buffer[1024];
+} EVENT_2B;
+
+typedef union {
+ EVENT_2B t;
+ TPM2B b;
+} TPM2B_EVENT;
+
+// Table 72 -- TPM2B_MAX_BUFFER Structure <I/O>
+typedef struct {
+ UINT16 size;
+ BYTE buffer[MAX_DIGEST_BUFFER];
+} MAX_BUFFER_2B;
+
+typedef union {
+ MAX_BUFFER_2B t;
+ TPM2B b;
+} TPM2B_MAX_BUFFER;
+
+// Table 73 -- TPM2B_TIMEOUT Structure <I/O>
+typedef struct {
+ UINT16 size;
+ BYTE buffer[sizeof(UINT64)];
+} TIMEOUT_2B;
+
+typedef union {
+ TIMEOUT_2B t;
+ TPM2B b;
+} TPM2B_TIMEOUT;
+
+// Table 74 -- TPM2B_IV Structure <I/O>
+typedef struct {
+ UINT16 size;
+ BYTE buffer[MAX_SYM_BLOCK_SIZE];
+} IV_2B;
+
+typedef union {
+ IV_2B t;
+ TPM2B b;
+} TPM2B_IV;
+typedef union {
+ TPMT_HA digest;
+ TPM_HANDLE handle;
+
+} TPMU_NAME ;
+
+// Table 76 -- TPM2B_NAME Structure <I/O>
+typedef struct {
+ UINT16 size;
+ BYTE name[sizeof(TPMU_NAME)];
+} NAME_2B;
+
+typedef union {
+ NAME_2B t;
+ TPM2B b;
+} TPM2B_NAME;
+
+// Table 77 -- TPMS_PCR_SELECT Structure <I/O>
+typedef struct {
+ UINT8 sizeofSelect;
+ BYTE pcrSelect[PCR_SELECT_MAX];
+} TPMS_PCR_SELECT;
+
+// Table 78 -- TPMS_PCR_SELECTION Structure <I/O>
+typedef struct {
+ TPMI_ALG_HASH hash;
+ UINT8 sizeofSelect;
+ BYTE pcrSelect[PCR_SELECT_MAX];
+} TPMS_PCR_SELECTION;
+
+// Table 82 -- TPMT_TK_CREATION Structure <I/O>
+typedef struct {
+ TPM_ST tag;
+ TPMI_RH_HIERARCHY hierarchy;
+ TPM2B_DIGEST digest;
+} TPMT_TK_CREATION;
+
+// Table 83 -- TPMT_TK_VERIFIED Structure <I/O>
+typedef struct {
+ TPM_ST tag;
+ TPMI_RH_HIERARCHY hierarchy;
+ TPM2B_DIGEST digest;
+} TPMT_TK_VERIFIED;
+
+// Table 84 -- TPMT_TK_AUTH Structure <I/O>
+typedef struct {
+ TPM_ST tag;
+ TPMI_RH_HIERARCHY hierarchy;
+ TPM2B_DIGEST digest;
+} TPMT_TK_AUTH;
+
+// Table 85 -- TPMT_TK_HASHCHECK Structure <I/O>
+typedef struct {
+ TPM_ST tag;
+ TPMI_RH_HIERARCHY hierarchy;
+ TPM2B_DIGEST digest;
+} TPMT_TK_HASHCHECK;
+
+// Table 86 -- TPMS_ALG_PROPERTY Structure <O,S>
+typedef struct {
+ TPM_ALG_ID alg;
+ TPMA_ALGORITHM algProperties;
+} TPMS_ALG_PROPERTY;
+
+// Table 87 -- TPMS_TAGGED_PROPERTY Structure <O,S>
+typedef struct {
+ TPM_PT property;
+ UINT32 value;
+} TPMS_TAGGED_PROPERTY;
+
+// Table 88 -- TPMS_TAGGED_PCR_SELECT Structure <O,S>
+typedef struct {
+ TPM_PT tag;
+ UINT8 sizeofSelect;
+ BYTE pcrSelect[PCR_SELECT_MAX];
+} TPMS_TAGGED_PCR_SELECT;
+
+// Table 89 -- TPML_CC Structure <I/O>
+typedef struct {
+ UINT32 count;
+ TPM_CC commandCodes[MAX_CAP_CC];
+} TPML_CC;
+
+// Table 90 -- TPML_CCA Structure <O,S>
+typedef struct {
+ UINT32 count;
+ TPMA_CC commandAttributes[MAX_CAP_CC];
+} TPML_CCA;
+
+// Table 91 -- TPML_ALG Structure <I/O>
+typedef struct {
+ UINT32 count;
+ TPM_ALG_ID algorithms[MAX_ALG_LIST_SIZE];
+} TPML_ALG;
+
+// Table 92 -- TPML_HANDLE Structure <O,S>
+typedef struct {
+ UINT32 count;
+ TPM_HANDLE handle[MAX_CAP_HANDLES];
+} TPML_HANDLE;
+
+// Table 93 -- TPML_DIGEST Structure <I/O>
+typedef struct {
+ UINT32 count;
+ TPM2B_DIGEST digests[8];
+} TPML_DIGEST;
+
+// Table 94 -- TPML_DIGEST_VALUES Structure <I/O>
+typedef struct {
+ UINT32 count;
+ TPMT_HA digests[HASH_COUNT];
+} TPML_DIGEST_VALUES;
+
+// Table 95 -- TPM2B_DIGEST_VALUES Structure <I/O>
+typedef struct {
+ UINT16 size;
+ BYTE buffer[sizeof(TPML_DIGEST_VALUES)];
+} DIGEST_VALUES_2B;
+
+typedef union {
+ DIGEST_VALUES_2B t;
+ TPM2B b;
+} TPM2B_DIGEST_VALUES;
+
+// Table 96 -- TPML_PCR_SELECTION Structure <I/O>
+typedef struct {
+ UINT32 count;
+ TPMS_PCR_SELECTION pcrSelections[HASH_COUNT];
+} TPML_PCR_SELECTION;
+
+// Table 97 -- TPML_ALG_PROPERTY Structure <O,S>
+typedef struct {
+ UINT32 count;
+ TPMS_ALG_PROPERTY algProperties[MAX_CAP_ALGS];
+} TPML_ALG_PROPERTY;
+
+// Table 98 -- TPML_TAGGED_TPM_PROPERTY Structure <O,S>
+typedef struct {
+ UINT32 count;
+ TPMS_TAGGED_PROPERTY tpmProperty[MAX_TPM_PROPERTIES];
+} TPML_TAGGED_TPM_PROPERTY;
+
+// Table 99 -- TPML_TAGGED_PCR_PROPERTY Structure <O,S>
+typedef struct {
+ UINT32 count;
+ TPMS_TAGGED_PCR_SELECT pcrProperty[MAX_PCR_PROPERTIES];
+} TPML_TAGGED_PCR_PROPERTY;
+
+// Table 100 -- TPML_ECC_CURVE Structure <O,S>
+typedef struct {
+ UINT32 count;
+ TPM_ECC_CURVE eccCurves[MAX_ECC_CURVES];
+} TPML_ECC_CURVE;
+
+// Table 101 -- TPMU_CAPABILITIES Union <O,S>
+typedef union {
+ TPML_ALG_PROPERTY algorithms;
+ TPML_HANDLE handles;
+ TPML_CCA command;
+ TPML_CC ppCommands;
+ TPML_CC auditCommands;
+ TPML_PCR_SELECTION assignedPCR;
+ TPML_TAGGED_TPM_PROPERTY tpmProperties;
+ TPML_TAGGED_PCR_PROPERTY pcrProperties;
+ TPML_ECC_CURVE eccCurves;
+
+} TPMU_CAPABILITIES ;
+
+// Table 102 -- TPMS_CAPABILITY_DATA Structure <O,S>
+typedef struct {
+ TPM_CAP capability;
+ TPMU_CAPABILITIES data;
+} TPMS_CAPABILITY_DATA;
+
+// Table 103 -- TPMS_CLOCK_INFO Structure <I/O>
+typedef struct {
+ UINT64 clock;
+ UINT32 resetCount;
+ UINT32 restartCount;
+ TPMI_YES_NO safe;
+} TPMS_CLOCK_INFO;
+
+// Table 104 -- TPMS_TIME_INFO Structure <I/O>
+typedef struct {
+ UINT64 time;
+ TPMS_CLOCK_INFO clockInfo;
+} TPMS_TIME_INFO;
+
+// Table 105 -- TPMS_TIME_ATTEST_INFO Structure <O,S>
+typedef struct {
+ TPMS_TIME_INFO time;
+ UINT64 firmwareVersion;
+} TPMS_TIME_ATTEST_INFO;
+
+// Table 106 -- TPMS_CERTIFY_INFO Structure <O,S>
+typedef struct {
+ TPM2B_NAME name;
+ TPM2B_NAME qualifiedName;
+} TPMS_CERTIFY_INFO;
+
+// Table 107 -- TPMS_QUOTE_INFO Structure <O,S>
+typedef struct {
+ TPML_PCR_SELECTION pcrSelect;
+ TPM2B_DIGEST pcrDigest;
+} TPMS_QUOTE_INFO;
+
+// Table 108 -- TPMS_COMMAND_AUDIT_INFO Structure <O,S>
+typedef struct {
+ UINT64 auditCounter;
+ TPM_ALG_ID digestAlg;
+ TPM2B_DIGEST auditDigest;
+ TPM2B_DIGEST commandDigest;
+} TPMS_COMMAND_AUDIT_INFO;
+
+// Table 109 -- TPMS_SESSION_AUDIT_INFO Structure <O,S>
+typedef struct {
+ TPMI_YES_NO exclusiveSession;
+ TPM2B_DIGEST sessionDigest;
+} TPMS_SESSION_AUDIT_INFO;
+
+// Table 110 -- TPMS_CREATION_INFO Structure <O,S>
+typedef struct {
+ TPM2B_NAME objectName;
+ TPM2B_DIGEST creationHash;
+} TPMS_CREATION_INFO;
+
+// Table 111 -- TPMS_NV_CERTIFY_INFO Structure <O,S>
+typedef struct {
+ TPM2B_MAX_BUFFER nvContents;
+} TPMS_NV_CERTIFY_INFO;
+
+// Table 112 -- TPMI_ST_ATTEST Type <O,S>
+typedef TPM_ST TPMI_ST_ATTEST;
+
+// Table 113 -- TPMU_ATTEST Union <O,S>
+typedef union {
+ TPMS_CERTIFY_INFO certify;
+ TPMS_CREATION_INFO creation;
+ TPMS_QUOTE_INFO quote;
+ TPMS_COMMAND_AUDIT_INFO commandAudit;
+ TPMS_SESSION_AUDIT_INFO sessionAudit;
+ TPMS_TIME_ATTEST_INFO time;
+ TPMS_NV_CERTIFY_INFO nv;
+
+} TPMU_ATTEST ;
+
+// Table 114 -- TPMS_ATTEST Structure <O,S>
+typedef struct {
+ TPM_GENERATED magic;
+ TPMI_ST_ATTEST type;
+ TPM2B_NAME qualifiedSigner;
+ TPM2B_DATA extraData;
+ TPMS_CLOCK_INFO clockInfo;
+ UINT64 firmwareVersion;
+ TPMU_ATTEST attested;
+} TPMS_ATTEST;
+
+// Table 115 -- TPM2B_ATTEST Structure <O,S>
+typedef struct {
+ UINT16 size;
+ BYTE attestationData[sizeof(TPMS_ATTEST)];
+} ATTEST_2B;
+
+typedef union {
+ ATTEST_2B t;
+ TPM2B b;
+} TPM2B_ATTEST;
+
+// Table 116 -- TPMS_AUTH_SESSION_COMMAND Structure <I>
+typedef struct {
+ TPMI_SH_AUTH_SESSION sessionHandle;
+ TPM2B_NONCE nonce;
+ TPMA_SESSION sessionAttributes;
+ TPM2B_AUTH auth;
+} TPMS_AUTH_SESSION_COMMAND;
+
+// Table 117 -- TPMS_AUTH_SESSION_RESPONSE Structure <O,S>
+typedef struct {
+ TPM2B_NONCE nonce;
+ TPMA_SESSION sessionAttributes;
+ TPM2B_AUTH auth;
+} TPMS_AUTH_SESSION_RESPONSE;
+typedef struct {
+ TPM2B_AUTH sessionKey;
+ TPM2B_AUTH authValue;
+ TPM2B_DIGEST pHash;
+ TPM2B_NONCE nonceNewer;
+ TPM2B_NONCE nonceOlder;
+ TPMA_SESSION sessionFlags;
+} TPMS_AUTH_COMPUTE_NOT_BOUND;
+typedef struct {
+ TPM2B_DIGEST sessionKey;
+ TPM2B_DIGEST pHash;
+ TPM2B_NONCE nonceNewer;
+ TPM2B_NONCE nonceOlder;
+ TPMA_SESSION sessionFlags;
+} TPMS_AUTH_COMPUTE_BOUND;
+
+// Table 120 -- TPMI_AES_KEY_BITS Type <I/O>
+typedef TPM_KEY_BITS TPMI_AES_KEY_BITS;
+
+// Table 121 -- TPMI_SMS4_KEY_BITS Type <I/O>
+typedef TPM_KEY_BITS TPMI_SMS4_KEY_BITS;
+
+// Table 122 -- TPMU_SYM_KEY_BITS Union <I/O>
+typedef union {
+ TPMI_AES_KEY_BITS aes;
+ TPMI_SMS4_KEY_BITS sms4;
+ TPM_KEY_BITS sym;
+ TPMI_ALG_HASH xor;
+
+} TPMU_SYM_KEY_BITS ;
+
+// Table 123 -- TPMU_SYM_MODE Union <I/O>
+typedef union {
+ TPMI_ALG_SYM_MODE aes;
+ TPMI_ALG_SYM_MODE sms4;
+ TPMI_ALG_SYM_MODE sym;
+
+} TPMU_SYM_MODE ;
+
+// Table 125 -- TPMT_SYM_DEF Structure <I/O>
+typedef struct {
+ TPMI_ALG_SYM algorithm;
+ TPMU_SYM_KEY_BITS keyBits;
+ TPMU_SYM_MODE mode;
+} TPMT_SYM_DEF;
+
+// Table 126 -- TPMT_SYM_DEF_OBJECT Structure <I/O>
+typedef struct {
+ TPMI_ALG_SYM_OBJECT algorithm;
+ TPMU_SYM_KEY_BITS keyBits;
+ TPMU_SYM_MODE mode;
+} TPMT_SYM_DEF_OBJECT;
+
+// Table 127 -- TPM2B_SYM_KEY Structure <I/O>
+typedef struct {
+ UINT16 size;
+ BYTE buffer[MAX_SYM_KEY_BYTES];
+} SYM_KEY_2B;
+
+typedef union {
+ SYM_KEY_2B t;
+ TPM2B b;
+} TPM2B_SYM_KEY;
+
+// Table 128 -- TPMS_SYMCIPHER_PARMS Structure <I/O>
+typedef struct {
+ TPMT_SYM_DEF_OBJECT sym;
+} TPMS_SYMCIPHER_PARMS;
+
+// Table 129 -- TPM2B_SENSITIVE_DATA Structure <I/O>
+typedef struct {
+ UINT16 size;
+ BYTE buffer[MAX_SYM_DATA];
+} SENSITIVE_DATA_2B;
+
+typedef union {
+ SENSITIVE_DATA_2B t;
+ TPM2B b;
+} TPM2B_SENSITIVE_DATA;
+
+// Table 130 -- TPMS_SENSITIVE_CREATE Structure <I>
+typedef struct {
+ TPM2B_AUTH userAuth;
+ TPM2B_SENSITIVE_DATA data;
+} TPMS_SENSITIVE_CREATE;
+
+// Table 131 -- TPM2B_SENSITIVE_CREATE Structure <I,S>
+typedef struct {
+ UINT16 size;
+ TPMS_SENSITIVE_CREATE sensitive;
+} SENSITIVE_CREATE_2B;
+
+typedef union {
+ SENSITIVE_CREATE_2B t;
+ TPM2B b;
+} TPM2B_SENSITIVE_CREATE;
+
+// Table 132 -- TPMS_SCHEME_SIGHASH Structure <I/O>
+typedef struct {
+ TPMI_ALG_HASH hashAlg;
+} TPMS_SCHEME_SIGHASH;
+
+// Table 133 -- TPMI_ALG_KEYEDHASH_SCHEME Type <I/O>
+typedef TPM_ALG_ID TPMI_ALG_KEYEDHASH_SCHEME;
+
+// Table 134 -- HMAC_SIG_SCHEME Types <I/O>
+typedef TPMS_SCHEME_SIGHASH TPMS_SCHEME_HMAC;
+
+// Table 135 -- TPMS_SCHEME_XOR Structure <I/O>
+typedef struct {
+ TPMI_ALG_HASH hashAlg;
+ TPMI_ALG_KDF kdf;
+} TPMS_SCHEME_XOR;
+
+// Table 136 -- TPMU_SCHEME_KEYEDHASH Union <I/O,S>
+typedef union {
+ TPMS_SCHEME_HMAC hmac;
+ TPMS_SCHEME_XOR xor;
+
+} TPMU_SCHEME_KEYEDHASH ;
+
+// Table 137 -- TPMT_KEYEDHASH_SCHEME Structure <I/O>
+typedef struct {
+ TPMI_ALG_KEYEDHASH_SCHEME scheme;
+ TPMU_SCHEME_KEYEDHASH details;
+} TPMT_KEYEDHASH_SCHEME;
+
+// Table 138 -- RSA_SIG_SCHEMES Types <I/O>
+typedef TPMS_SCHEME_SIGHASH TPMS_SCHEME_RSASSA;
+typedef TPMS_SCHEME_SIGHASH TPMS_SCHEME_RSAPSS;
+
+// Table 139 -- ECC_SIG_SCHEMES Types <I/O>
+typedef TPMS_SCHEME_SIGHASH TPMS_SCHEME_ECDSA;
+
+// Table 140 -- TPMS_SCHEME_ECDAA Structure <I/O>
+typedef struct {
+ TPMI_ALG_HASH hashAlg;
+} TPMS_SCHEME_ECDAA;
+
+// Table 141 -- TPMS_SCHEME_ECSCHNORR Structure <I/O>
+typedef struct {
+ TPMI_ALG_HASH hashAlg;
+ UINT16 count;
+} TPMS_SCHEME_ECSCHNORR;
+
+// Table 142 -- TPMU_SIG_SCHEME Union <I/O,S>
+typedef union {
+ TPMS_SCHEME_RSASSA rsassa;
+ TPMS_SCHEME_RSAPSS rsapss;
+ TPMS_SCHEME_ECDSA ecdsa;
+ TPMS_SCHEME_ECDAA ecdaa;
+ TPMS_SCHEME_ECSCHNORR ecSchnorr;
+ TPMS_SCHEME_HMAC hmac;
+ TPMS_SCHEME_SIGHASH any;
+
+} TPMU_SIG_SCHEME ;
+
+// Table 143 -- TPMT_SIG_SCHEME Structure <I/O>
+typedef struct {
+ TPMI_ALG_SIG_SCHEME scheme;
+ TPMU_SIG_SCHEME details;
+} TPMT_SIG_SCHEME;
+
+// Table 144 -- TPMS_SCHEME_OAEP Structure <I/O>
+typedef struct {
+ TPMI_ALG_HASH hashAlg;
+} TPMS_SCHEME_OAEP;
+
+// Table 145 -- TPMS_SCHEME_ECDH Structure <I/O>
+typedef struct {
+ TPMI_ALG_HASH hashAlg;
+} TPMS_SCHEME_ECDH;
+
+// Table 146 -- TPMS_SCHEME_MGF1 Structure <I/O>
+typedef struct {
+ TPMI_ALG_HASH hashAlg;
+} TPMS_SCHEME_MGF1;
+
+// Table 147 -- TPMS_SCHEME_KDF1_SP800_56a Structure <I/O>
+typedef struct {
+ TPMI_ALG_HASH hashAlg;
+} TPMS_SCHEME_KDF1_SP800_56a;
+
+// Table 148 -- TPMS_SCHEME_KDF2 Structure <I/O>
+typedef struct {
+ TPMI_ALG_HASH hashAlg;
+} TPMS_SCHEME_KDF2;
+
+// Table 149 -- TPMS_SCHEME_KDF1_SP800_108 Structure <I/O>
+typedef struct {
+ TPMI_ALG_HASH hashAlg;
+} TPMS_SCHEME_KDF1_SP800_108;
+
+// Table 150 -- TPMU_KDF_SCHEME Union <I/O,S>
+typedef union {
+ TPMS_SCHEME_MGF1 mgf1;
+ TPMS_SCHEME_KDF1_SP800_56a kdf1_SP800_56a;
+ TPMS_SCHEME_KDF2 kdf2;
+ TPMS_SCHEME_KDF1_SP800_108 kdf1_sp800_108;
+} TPMU_KDF_SCHEME ;
+
+// Table 151 -- TPMT_KDF_SCHEME Structure <I/O>
+typedef struct {
+ TPMI_ALG_KDF scheme;
+ TPMU_KDF_SCHEME details;
+} TPMT_KDF_SCHEME;
+typedef TPM_ALG_ID TPMI_ALG_ASYM_SCHEME;
+
+// Table 153 -- TPMU_ASYM_SCHEME Union <I/O>
+typedef union {
+ TPMS_SCHEME_RSASSA rsassa;
+ TPMS_SCHEME_RSAPSS rsapss;
+ TPMS_SCHEME_OAEP oaep;
+ TPMS_SCHEME_ECDSA ecdsa;
+ TPMS_SCHEME_ECDAA ecdaa;
+ TPMS_SCHEME_ECSCHNORR ecSchnorr;
+ TPMS_SCHEME_SIGHASH anySig;
+
+} TPMU_ASYM_SCHEME ;
+
+typedef struct {
+ TPMI_ALG_ASYM_SCHEME scheme;
+ TPMU_ASYM_SCHEME details;
+} TPMT_ASYM_SCHEME;
+
+// Table 155 -- TPMI_ALG_RSA_SCHEME Type <I/O>
+typedef TPM_ALG_ID TPMI_ALG_RSA_SCHEME;
+
+// Table 156 -- TPMT_RSA_SCHEME Structure <I/O>
+typedef struct {
+ TPMI_ALG_RSA_SCHEME scheme;
+ TPMU_ASYM_SCHEME details;
+} TPMT_RSA_SCHEME;
+
+// Table 157 -- TPMI_ALG_RSA_DECRYPT Type <I/O>
+typedef TPM_ALG_ID TPMI_ALG_RSA_DECRYPT;
+
+// Table 158 -- TPMT_RSA_DECRYPT Structure <I/O>
+typedef struct {
+ TPMI_ALG_RSA_DECRYPT scheme;
+ TPMU_ASYM_SCHEME details;
+} TPMT_RSA_DECRYPT;
+
+// Table 159 -- TPM2B_PUBLIC_KEY_RSA Structure <I/O>
+typedef struct {
+ UINT16 size;
+ BYTE buffer[MAX_RSA_KEY_BYTES];
+} PUBLIC_KEY_RSA_2B;
+
+typedef union {
+ PUBLIC_KEY_RSA_2B t;
+ TPM2B b;
+} TPM2B_PUBLIC_KEY_RSA;
+
+// Table 160 -- TPMI_RSA_KEY_BITS Type <I/O>
+typedef TPM_KEY_BITS TPMI_RSA_KEY_BITS;
+
+// Table 161 -- TPM2B_PRIVATE_KEY_RSA Structure <I/O>
+typedef struct {
+ UINT16 size;
+ BYTE buffer[MAX_RSA_KEY_BYTES/2];
+} PRIVATE_KEY_RSA_2B;
+
+typedef union {
+ PRIVATE_KEY_RSA_2B t;
+ TPM2B b;
+} TPM2B_PRIVATE_KEY_RSA;
+
+// Table 162 -- TPM2B_ECC_PARAMETER Structure <I/O>
+typedef struct {
+ UINT16 size;
+ BYTE value[MAX_ECC_KEY_BYTES];
+} ECC_PARAMETER_2B;
+
+typedef union {
+ ECC_PARAMETER_2B t;
+ TPM2B b;
+} TPM2B_ECC_PARAMETER;
+
+// Table 163 -- TPMS_ECC_POINT Structure <I/O>
+typedef struct {
+ TPM2B_ECC_PARAMETER pointX;
+ TPM2B_ECC_PARAMETER pointY;
+} TPMS_ECC_POINT;
+
+// Table 164 -- TPM2B_ECC_POINT Structure <I/O>
+typedef struct {
+ UINT16 size;
+ TPMS_ECC_POINT point;
+} ECC_POINT_2B;
+
+typedef union {
+ ECC_POINT_2B t;
+ TPM2B b;
+} TPM2B_ECC_POINT;
+
+// Table 165 -- TPMI_ALG_ECC_SCHEME Type <I/O>
+typedef TPM_ALG_ID TPMI_ALG_ECC_SCHEME;
+
+// Table 166 -- TPMI_ECC_CURVE Type <I/O>
+typedef TPM_ECC_CURVE TPMI_ECC_CURVE;
+
+// Table 167 -- TPMT_ECC_SCHEME Structure <I/O>
+typedef struct {
+ TPMI_ALG_ECC_SCHEME scheme;
+ TPMU_SIG_SCHEME details;
+} TPMT_ECC_SCHEME;
+
+// Table 168 -- TPMS_ALGORITHM_DETAIL_ECC Structure <O,S>
+typedef struct {
+ TPM_ECC_CURVE curveID;
+ UINT16 keySize;
+ TPMT_KDF_SCHEME kdf;
+ TPMT_ECC_SCHEME sign;
+ TPM2B_ECC_PARAMETER p;
+ TPM2B_ECC_PARAMETER a;
+ TPM2B_ECC_PARAMETER b;
+ TPM2B_ECC_PARAMETER gX;
+ TPM2B_ECC_PARAMETER gY;
+ TPM2B_ECC_PARAMETER n;
+ TPM2B_ECC_PARAMETER h;
+} TPMS_ALGORITHM_DETAIL_ECC;
+
+// Table 169 -- TPMS_SIGNATURE_RSASSA Structure <I/O>
+typedef struct {
+ TPMI_ALG_HASH hash;
+ TPM2B_PUBLIC_KEY_RSA sig;
+} TPMS_SIGNATURE_RSASSA;
+
+// Table 170 -- TPMS_SIGNATURE_RSAPSS Structure <I/O>
+typedef struct {
+ TPMI_ALG_HASH hash;
+ TPM2B_PUBLIC_KEY_RSA sig;
+} TPMS_SIGNATURE_RSAPSS;
+
+// Table 171 -- TPMS_SIGNATURE_ECDSA Structure <I/O>
+typedef struct {
+ TPMI_ALG_HASH hash;
+ TPM2B_ECC_PARAMETER signatureR;
+ TPM2B_ECC_PARAMETER signatureS;
+} TPMS_SIGNATURE_ECDSA;
+
+// Table 172 -- TPMU_SIGNATURE Union <I/O,S>
+typedef union {
+ TPMS_SIGNATURE_RSASSA rsassa;
+ TPMS_SIGNATURE_RSAPSS rsapss;
+ TPMS_SIGNATURE_ECDSA ecdsa;
+ TPMT_HA hmac;
+} TPMU_SIGNATURE ;
+
+// Table 173 -- TPMT_SIGNATURE Structure <I/O>
+typedef struct {
+ TPMI_ALG_SIG_SCHEME sigAlg;
+ TPMU_SIGNATURE signature;
+} TPMT_SIGNATURE;
+typedef union {
+ BYTE ecc[sizeof(TPMS_ECC_POINT)];
+ BYTE rsa[MAX_RSA_KEY_BYTES];
+ BYTE symmetric[sizeof(TPM2B_DIGEST)];
+ BYTE keyedHash[sizeof(TPM2B_DIGEST)];
+} TPMU_ENCRYPTED_SECRET ;
+
+// Table 175 -- TPM2B_ENCRYPTED_SECRET Structure <I/O>
+typedef struct {
+ UINT16 size;
+ BYTE secret[sizeof(TPMU_ENCRYPTED_SECRET)];
+} ENCRYPTED_SECRET_2B;
+
+typedef union {
+ ENCRYPTED_SECRET_2B t;
+ TPM2B b;
+} TPM2B_ENCRYPTED_SECRET;
+
+// Table 176 -- TPMI_ALG_PUBLIC Type <I/O>
+typedef TPM_ALG_ID TPMI_ALG_PUBLIC;
+
+// Table 177 -- TPMU_PUBLIC_ID Union <I/O,S>
+typedef union {
+ TPM2B_DIGEST keyedHash;
+ TPM2B_DIGEST sym;
+ TPM2B_PUBLIC_KEY_RSA rsa;
+ TPMS_ECC_POINT ecc;
+
+} TPMU_PUBLIC_ID ;
+
+// Table 178 -- TPMS_KEYEDHASH_PARMS Structure <I/O>
+typedef struct {
+ TPMT_KEYEDHASH_SCHEME scheme;
+} TPMS_KEYEDHASH_PARMS;
+typedef struct {
+ TPMT_SYM_DEF_OBJECT symmetric;
+ TPMT_ASYM_SCHEME scheme;
+} TPMS_ASYM_PARMS;
+
+// Table 180 -- TPMS_RSA_PARMS Structure <I/O>
+typedef struct {
+ TPMT_SYM_DEF_OBJECT symmetric;
+ TPMT_RSA_SCHEME scheme;
+ TPMI_RSA_KEY_BITS keyBits;
+ UINT32 exponent;
+} TPMS_RSA_PARMS;
+
+// Table 181 -- TPMS_ECC_PARMS Structure <I/O>
+typedef struct {
+ TPMT_SYM_DEF_OBJECT symmetric;
+ TPMT_ECC_SCHEME scheme;
+ TPMI_ECC_CURVE curveID;
+ TPMT_KDF_SCHEME kdf;
+} TPMS_ECC_PARMS;
+
+// Table 182 -- TPMU_PUBLIC_PARMS Union <I/O,S>
+typedef union {
+ TPMS_KEYEDHASH_PARMS keyedHashDetail;
+ TPMT_SYM_DEF_OBJECT symDetail;
+ TPMS_RSA_PARMS rsaDetail;
+ TPMS_ECC_PARMS eccDetail;
+ TPMS_ASYM_PARMS asymDetail;
+
+} TPMU_PUBLIC_PARMS ;
+
+// Table 183 -- TPMT_PUBLIC_PARMS Structure <I/O>
+typedef struct {
+ TPMI_ALG_PUBLIC type;
+ TPMU_PUBLIC_PARMS parameters;
+} TPMT_PUBLIC_PARMS;
+
+// Table 184 -- TPMT_PUBLIC Structure <I/O>
+typedef struct {
+ TPMI_ALG_PUBLIC type;
+ TPMI_ALG_HASH nameAlg;
+ TPMA_OBJECT objectAttributes;
+ TPM2B_DIGEST authPolicy;
+ TPMU_PUBLIC_PARMS parameters;
+ TPMU_PUBLIC_ID unique;
+} TPMT_PUBLIC;
+
+// Table 185 -- TPM2B_PUBLIC Structure <I/O>
+typedef struct {
+ UINT16 size;
+ TPMT_PUBLIC publicArea;
+} PUBLIC_2B;
+
+typedef union {
+ PUBLIC_2B t;
+ TPM2B b;
+} TPM2B_PUBLIC;
+
+// Table 186 -- TPMU_SENSITIVE_COMPOSITE Union <I/O,S>
+typedef union {
+ TPM2B_PRIVATE_KEY_RSA rsa;
+ TPM2B_ECC_PARAMETER ecc;
+ TPM2B_SENSITIVE_DATA bits;
+ TPM2B_SYM_KEY sym;
+ TPM2B_SENSITIVE_DATA any;
+
+} TPMU_SENSITIVE_COMPOSITE ;
+
+// Table 187 -- TPMT_SENSITIVE Structure <I/O>
+typedef struct {
+ TPMI_ALG_PUBLIC sensitiveType;
+ TPM2B_AUTH authValue;
+ TPM2B_DIGEST seedValue;
+ TPMU_SENSITIVE_COMPOSITE sensitive;
+} TPMT_SENSITIVE;
+
+// Table 188 -- TPM2B_SENSITIVE Structure <I/O>
+typedef struct {
+ UINT16 size;
+ TPMT_SENSITIVE sensitiveArea;
+} SENSITIVE_2B;
+
+typedef union {
+ SENSITIVE_2B t;
+ TPM2B b;
+} TPM2B_SENSITIVE;
+typedef struct {
+ TPM2B_DIGEST integrityOuter;
+ TPM2B_DIGEST integrityInner;
+ TPMT_SENSITIVE sensitive;
+} _PRIVATE;
+
+// Table 190 -- TPM2B_PRIVATE Structure <I/O,S>
+typedef struct {
+ UINT16 size;
+ BYTE buffer[sizeof(_PRIVATE)];
+} PRIVATE_2B;
+
+typedef union {
+ PRIVATE_2B t;
+ TPM2B b;
+} TPM2B_PRIVATE;
+typedef struct {
+ TPM2B_DIGEST integrityHMAC;
+ TPM2B_DIGEST encIdentity;
+} _ID_OBJECT;
+
+// Table 192 -- TPM2B_ID_OBJECT Structure <I/O>
+typedef struct {
+ UINT16 size;
+ BYTE credential[sizeof(_ID_OBJECT)];
+} ID_OBJECT_2B;
+
+typedef union {
+ ID_OBJECT_2B t;
+ TPM2B b;
+} TPM2B_ID_OBJECT;
+//
+// BUGBUG: Comment here to resolve conflict
+//
+//typedef struct {
+// unsigned int index : 22;
+// unsigned int space : 2;
+// unsigned int RH_NV : 8;
+//} TPM_NV_INDEX ;
+
+// Table 195 -- TPMA_NV Bits <I/O>
+typedef struct {
+ unsigned int TPMA_NV_PPWRITE : 1;
+ unsigned int TPMA_NV_OWNERWRITE : 1;
+ unsigned int TPMA_NV_AUTHWRITE : 1;
+ unsigned int TPMA_NV_POLICYWRITE : 1;
+ unsigned int TPMA_NV_COUNTER : 1;
+ unsigned int TPMA_NV_BITS : 1;
+ unsigned int TPMA_NV_EXTEND : 1;
+ unsigned int reserved8 : 3;
+ unsigned int TPMA_NV_POLICY_DELETE : 1;
+ unsigned int TPMA_NV_WRITELOCKED : 1;
+ unsigned int TPMA_NV_WRITEALL : 1;
+ unsigned int TPMA_NV_WRITEDEFINE : 1;
+ unsigned int TPMA_NV_WRITE_STCLEAR : 1;
+ unsigned int TPMA_NV_GLOBALLOCK : 1;
+ unsigned int TPMA_NV_PPREAD : 1;
+ unsigned int TPMA_NV_OWNERREAD : 1;
+ unsigned int TPMA_NV_AUTHREAD : 1;
+ unsigned int TPMA_NV_POLICYREAD : 1;
+ unsigned int reserved19 : 5;
+ unsigned int TPMA_NV_NO_DA : 1;
+ unsigned int TPMA_NV_ORDERLY : 1;
+ unsigned int TPMA_NV_CLEAR_STCLEAR : 1;
+ unsigned int TPMA_NV_READLOCKED : 1;
+ unsigned int TPMA_NV_WRITTEN : 1;
+ unsigned int TPMA_NV_PLATFORMCREATE : 1;
+ unsigned int TPMA_NV_READ_STCLEAR : 1;
+} TPMA_NV ;
+
+// Table 196 -- TPMS_NV_PUBLIC Structure <I/O>
+typedef struct {
+ TPMI_RH_NV_INDEX nvIndex;
+ TPMI_ALG_HASH nameAlg;
+ TPMA_NV attributes;
+ TPM2B_DIGEST authPolicy;
+ UINT16 dataSize;
+} TPMS_NV_PUBLIC;
+
+// Table 197 -- TPM2B_NV_PUBLIC Structure <I/O>
+typedef struct {
+ UINT16 size;
+ TPMS_NV_PUBLIC nvPublic;
+} NV_PUBLIC_2B;
+
+typedef union {
+ NV_PUBLIC_2B t;
+ TPM2B b;
+} TPM2B_NV_PUBLIC;
+
+// Table 198 -- TPM2B_CONTEXT_SENSITIVE Structure <I/O>
+typedef struct {
+ UINT16 size;
+ BYTE buffer[MAX_CONTEXT_SIZE];
+} CONTEXT_SENSITIVE_2B;
+
+typedef union {
+ CONTEXT_SENSITIVE_2B t;
+ TPM2B b;
+} TPM2B_CONTEXT_SENSITIVE;
+
+// Table 199 -- TPMS_CONTEXT_DATA Structure <I/O,S>
+typedef struct {
+ TPM2B_DIGEST integrity;
+ TPM2B_CONTEXT_SENSITIVE encrypted;
+} TPMS_CONTEXT_DATA;
+
+// Table 200 -- TPM2B_CONTEXT_DATA Structure <I/O>
+typedef struct {
+ UINT16 size;
+ BYTE buffer[sizeof(TPMS_CONTEXT_DATA)];
+} CONTEXT_DATA_2B;
+
+typedef union {
+ CONTEXT_DATA_2B t;
+ TPM2B b;
+} TPM2B_CONTEXT_DATA;
+
+// Table 201 -- TPMS_CONTEXT Structure <I/O>
+typedef struct {
+ UINT64 sequence;
+ TPMI_DH_CONTEXT savedHandle;
+ TPMI_RH_HIERARCHY hierarchy;
+ TPM2B_CONTEXT_DATA contextBlob;
+} TPMS_CONTEXT;
+
+// Table 203 -- TPMS_CREATION_DATA Structure <O,S>
+typedef struct {
+ TPML_PCR_SELECTION pcrSelect;
+ TPM2B_DIGEST pcrDigest;
+ TPMA_LOCALITY locality;
+ TPM_ALG_ID parentNameAlg;
+ TPM2B_NAME parentName;
+ TPM2B_NAME parentQualifiedName;
+ TPM2B_DATA outsideInfo;
+} TPMS_CREATION_DATA;
+
+// Table 204 -- TPM2B_CREATION_DATA Structure <O,S>
+typedef struct {
+ UINT16 size;
+ TPMS_CREATION_DATA creationData;
+} CREATION_DATA_2B;
+
+typedef union {
+ CREATION_DATA_2B t;
+ TPM2B b;
+} TPM2B_CREATION_DATA;
+
+//
+// Command Header
+//
+typedef struct {
+ TPM_ST tag;
+ UINT32 paramSize;
+ TPM_CC commandCode;
+} TPM2_COMMAND_HEADER;
+
+typedef struct {
+ TPM_ST tag;
+ UINT32 paramSize;
+ TPM_RC responseCode;
+} TPM2_RESPONSE_HEADER;
+
+#pragma pack (pop)
+
+#endif
diff --git a/ReferenceCode/ME/SampleCode/Include/IndustryStandard/Tpm20Implementation.h b/ReferenceCode/ME/SampleCode/Include/IndustryStandard/Tpm20Implementation.h
new file mode 100644
index 0000000..d21eb53
--- /dev/null
+++ b/ReferenceCode/ME/SampleCode/Include/IndustryStandard/Tpm20Implementation.h
@@ -0,0 +1,259 @@
+/** @file
+
+ Definitions for Tpm 2.0 implementation
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+#ifndef _IMPLEMENTATION_H
+#define _IMPLEMENTATION_H
+
+// Table 205 -- Hash Algorithm Digest and Block Size Values
+#define SHA1_DIGEST_SIZE 20
+#define SHA1_BLOCK_SIZE 64
+#define SHA256_DIGEST_SIZE 32
+#define SHA256_BLOCK_SIZE 64
+#define SM3_256_DIGEST_SIZE 32
+#define SM3_256_BLOCK_SIZE 64
+#define SHA384_DIGEST_SIZE 48
+#define SHA384_BLOCK_SIZE 128
+#define SHA512_DIGEST_SIZE 64
+#define SHA512_BLOCK_SIZE 128
+#define WHIRLPOOL512_DIGEST_SIZE 64
+#define WHIRLPOOL512_BLOCK_SIZE 64
+
+// Table 206 -- DER Values
+#define SHA1_DER_SIZE 15
+#define SHA1_DER {0x30,0x21,0x30,0x09,0x06,0x05,0x2B,0x0E,0x03,0x02,0x1A,0x05,0x00,0x04,0x14}
+#define SHA256_DER_SIZE 19
+#define SHA256_DER {0x30,0x31,0x30,0x0d,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x01,0x05,0x00,0x04,0x20}
+#define SHA384_DER_SIZE 19
+#define SHA384_DER {0x30,0x41,0x30,0x0d,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x02,0x05,0x00,0x04,0x30}
+#define SHA512_DER_SIZE 19
+#define SHA512_DER {0x30,0x51,0x30,0x0d,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x03,0x05,0x00,0x04,0x40}
+
+// Table 207 -- Architectural Limits Values
+#define MAX_SESSION_NUMBER 3
+
+// Table 208 -- Minimum and Maximum Values
+#ifndef UINT8_MAX
+#define UINT8_MAX 255
+#endif
+#define BYTE_MAX 255
+#define INT8_MIN -128
+#define INT8_MAX 127
+#define UINT16_MAX 65535
+#define INT16_MIN -32768
+#define INT16_MAX 32767
+#define UINT32_MAX 4294967295
+#define INT32_MIN -2147483648
+#define INT32_MAX 2147483647
+#define UINT64_MAX 18446744073709551615 // 1.84467440737096e+019
+#define INT64_MIN -9223372036854775808 // 1
+#define INT64_MAX 9223372036854775807 // 9.22337203685478e+018
+
+// Table 209 -- Logic Values
+#define YES 1
+#define NO 0
+//
+// BUGBUG: Comment to to resolve duplicated definition
+//
+//#define TRUE 1
+//#define FALSE 0
+#define SET 1
+#define CLEAR 0
+
+// Table 210 -- Processor Values
+#define BIG_ENDIAN NO // 0
+#define LITTLE_ENDIAN YES // 1
+#define NO_AUTO_ALIGN NO // 0
+
+/* Table 211 -- Implemented Algorithms
+#define RSA YES // 1
+#define DES YES // 1
+#define _3DES YES // 1
+#define SHA1 YES // 1
+#define HMAC YES // 1
+#define AES YES // 1
+#define MGF1 YES // 1
+#define XOR YES // 1
+#define KEYEDHASH YES // 1
+#define SHA256 YES // 1
+#define SHA384 YES // 1
+#define SHA512 YES // 1
+#define WHIRLPOOL512 YES // 1
+#define SM3_256 YES // 1
+#define SMS4 YES // 1
+#define RSASSA RSA // 1
+#define RSAES RSA // 1
+#define RSAPSS RSA // 1
+#define OAEP RSA // 1
+#define ECC YES // 1
+#define ECDH YES // 1
+#define ECDSA ECC // 1
+#define ECDAA ECC // 1
+#define ECSCHNORR ECC // 1
+#define SYMCIPHER YES // 1
+#define KDF1_SP800_56a ECC // 1
+#define KDF2 YES // 1
+#define KDF1_SP800_108 YES // 1
+#define SP800_56a_C1_1 ECC // 1
+#define CTR YES // 1
+#define OFB YES // 1
+#define CBC YES // 1
+#define CFB YES // 1
+#define ECB YES // 1
+
+*/
+
+// Table 212 -- Implemented Algorithm Constants
+#define RSA_KEY_SIZES_BITS {1024,2048}
+#define MAX_RSA_KEY_BITS 2048
+#define MAX_RSA_KEY_BYTES ((MAX_RSA_KEY_BITS+7)/8) // 256
+#define ECC_CURVES {TPM_ECC_NIST_P256,TPM_ECC_BN_P256}
+#define ECC_KEY_SIZES_BITS {256}
+#define MAX_ECC_KEY_BITS 256
+#define MAX_ECC_KEY_BYTES ((MAX_ECC_KEY_BITS+7)/8) // 32
+#define AES_KEY_SIZES_BITS {128}
+#define MAX_AES_KEY_BITS 128
+#define MAX_AES_KEY_BYTES ((MAX_AES_KEY_BITS+7)/8) // 16
+#define MAX_SYM_KEY_BITS 128
+#define MAX_SYM_KEY_BYTES ((MAX_SYM_KEY_BITS+7)/8) // 16
+#define MAX_SYM_BLOCK_SIZE 16
+
+// Table 213 -- Implementation Values
+#define FIELD_UPGRADE_IMPLEMENTED NO // 0
+typedef UINT16 BSIZE;
+#define IMPLEMENTATION_PCR 24
+#define PLATFORM_PCR 24
+#define DRTM_PCR 17
+#define NUM_LOCALITIES 5
+#define MAX_HANDLE_NUM 3
+#define MAX_ACTIVE_SESSIONS 64
+typedef UINT16 CONTEXT_SLOT;
+typedef UINT64 CONTEXT_COUNTER;
+#define MAX_LOADED_SESSIONS 3
+#define MAX_SESSION_NUM 3
+#define MAX_LOADED_OBJECTS 3
+#define MIN_EVICT_OBJECTS 2
+#define PCR_SELECT_MIN ((PLATFORM_PCR+7)/8) // 3
+#define PCR_SELECT_MAX ((IMPLEMENTATION_PCR+7)/8) // 3
+#define NUM_POLICY_PCR_GROUP 1
+#define NUM_AUTHVALUE_PCR_GROUP 1
+#define MAX_CONTEXT_SIZE 4000
+#define MAX_DIGEST_BUFFER 1024
+#define MAX_NV_INDEX_SIZE 1024
+#define MAX_CAP_BUFFER 1024
+#define NV_MEMORY_SIZE 16384
+#define NUM_STATIC_PCR 16
+#define MAX_ALG_LIST_SIZE 64
+#define TIMER_PRESCALE 100000
+#define PRIMARY_SEED_SIZE 32
+#define CONTEXT_ENCRYPT_ALG TPM_ALG_AES
+#define CONTEXT_ENCRYPT_KEY_BITS MAX_SYM_KEY_BITS // 128
+#define CONTEXT_ENCRYPT_KEY_BYTES ((CONTEXT_ENCRYPT_KEY_BITS+7)/8) // 16
+#define CONTEXT_INTEGRITY_HASH_ALG TPM_ALG_SHA256
+#define CONTEXT_INTEGRITY_HASH_SIZE SHA256_DIGEST_SIZE // 32
+#define PROOF_SIZE CONTEXT_INTEGRITY_HASH_SIZE // 32
+#define NV_CLOCK_UPDATE_INTERVAL 12
+#define NUM_POLICY_PCR 1
+#define MAX_COMMAND_SIZE 4096
+#define MAX_RESPONSE_SIZE 4096
+#define ORDERLY_BITS 8
+#define MAX_ORDERLY_COUNT ((1<<ORDERLY_BITS)-1) // 255
+#define ALG_ID_FIRST TPM_ALG_FIRST
+#define ALG_ID_LAST TPM_ALG_LAST
+#define MAX_SYM_DATA 128
+#define MAX_HASH_STATE_SIZE 512
+#define MAX_RNG_ENTROPY_SIZE 64
+#define RAM_INDEX_SPACE 512
+#define RSA_DEFAULT_PUBLIC_EXPONENT 0x00010001
+
+///
+
+/*(auto)
+
+ Automatically Generated by DoImplemented.pl
+
+ Date: Mar 5, 2012
+ Time: 11:14:55 PM
+
+*/
+
+// Table 6 -- TPM_ALG_ID Constants <I/O,S>
+typedef UINT16 TPM_ALG_ID;
+//
+// BUGBUG: Comment some algo which has same name as TPM1.2 (value is same, so not runtime issue)
+//
+#define TPM_ALG_ERROR (TPM_ALG_ID)(0x0000) // a: ; D:
+#define TPM_ALG_FIRST (TPM_ALG_ID)(0x0001) // a: ; D:
+//#define TPM_ALG_RSA (TPM_ALG_ID)(0x0001) // a: A O; D:
+//#define TPM_ALG_DES (TPM_ALG_ID)(0x0002) // a: S; D:
+#define TPM_ALG__3DES (TPM_ALG_ID)(0x0003) // a: S; D:
+//#define TPM_ALG_SHA (TPM_ALG_ID)(0x0004) // a: H; D:
+#define TPM_ALG_SHA1 (TPM_ALG_ID)(0x0004) // a: H; D:
+//#define TPM_ALG_HMAC (TPM_ALG_ID)(0x0005) // a: H X; D:
+#define TPM_ALG_AES (TPM_ALG_ID)(0x0006) // a: S; D:
+//#define TPM_ALG_MGF1 (TPM_ALG_ID)(0x0007) // a: H M; D:
+#define TPM_ALG_KEYEDHASH (TPM_ALG_ID)(0x0008) // a: H E X O; D:
+//#define TPM_ALG_XOR (TPM_ALG_ID)(0x000A) // a: H S; D:
+#define TPM_ALG_SHA256 (TPM_ALG_ID)(0x000B) // a: H; D:
+#define TPM_ALG_SHA384 (TPM_ALG_ID)(0x000C) // a: H; D:
+#define TPM_ALG_SHA512 (TPM_ALG_ID)(0x000D) // a: H; D:
+#define TPM_ALG_WHIRLPOOL512 (TPM_ALG_ID)(0x000E) // a: H; D:
+#define TPM_ALG_NULL (TPM_ALG_ID)(0x0010) // a: ; D:
+#define TPM_ALG_SM3_256 (TPM_ALG_ID)(0x0012) // a: H; D:
+#define TPM_ALG_SMS4 (TPM_ALG_ID)(0x0013) // a: S; D:
+#define TPM_ALG_RSASSA (TPM_ALG_ID)(0x0014) // a: X; D: RSA
+#define TPM_ALG_RSAES (TPM_ALG_ID)(0x0015) // a: E; D: RSA
+#define TPM_ALG_RSAPSS (TPM_ALG_ID)(0x0016) // a: X; D: RSA
+#define TPM_ALG_OAEP (TPM_ALG_ID)(0x0017) // a: E; D: RSA
+#define TPM_ALG_ECDSA (TPM_ALG_ID)(0x0018) // a: X; D: ECC
+#define TPM_ALG_ECDH (TPM_ALG_ID)(0x0019) // a: M; D: ECC
+#define TPM_ALG_ECDAA (TPM_ALG_ID)(0x001A) // a: A X; D: ECC
+#define TPM_ALG_ECSCHNORR (TPM_ALG_ID)(0x001C) // a: A X; D: ECC
+#define TPM_ALG_KDF1_SP800_56a (TPM_ALG_ID)(0x0020) // a: H M; D: ECC
+#define TPM_ALG_KDF2 (TPM_ALG_ID)(0x0021) // a: H M; D:
+#define TPM_ALG_KDF1_SP800_108 (TPM_ALG_ID)(0x0022) // a: H M; D:
+#define TPM_ALG_ECC (TPM_ALG_ID)(0x0023) // a: A O; D:
+#define TPM_ALG_SYMCIPHER (TPM_ALG_ID)(0x0025) // a: O; D:
+#define TPM_ALG_CTR (TPM_ALG_ID)(0x0040) // a: S E; D:
+#define TPM_ALG_OFB (TPM_ALG_ID)(0x0041) // a: S E; D:
+#define TPM_ALG_CBC (TPM_ALG_ID)(0x0042) // a: S E; D:
+#define TPM_ALG_CFB (TPM_ALG_ID)(0x0043) // a: S E; D:
+#define TPM_ALG_ECB (TPM_ALG_ID)(0x0044) // a: S E; D:
+#define TPM_ALG_LAST (TPM_ALG_ID)(0x0044) // a: ; D:
+
+// Table 7 -- TPM_ECC_CURVE Constants <I/O,S>
+typedef UINT16 TPM_ECC_CURVE;
+
+#define TPM_ECC_NONE (TPM_ECC_CURVE)(0x0000)
+#define TPM_ECC_NIST_P192 (TPM_ECC_CURVE)(0x0001)
+#define TPM_ECC_NIST_P224 (TPM_ECC_CURVE)(0x0002)
+#define TPM_ECC_NIST_P256 (TPM_ECC_CURVE)(0x0003)
+#define TPM_ECC_NIST_P384 (TPM_ECC_CURVE)(0x0004)
+#define TPM_ECC_NIST_P521 (TPM_ECC_CURVE)(0x0005)
+#define TPM_ECC_BN_P256 (TPM_ECC_CURVE)(0x0010)
+#define TPM_ECC_BN_P638 (TPM_ECC_CURVE)(0x0011)
+
+//#define MAX_DIGEST_SIZE 32
+//#define MAX_HASH_BLOCK_SIZE 64
+//
+// BUGBUG: Always set 6 here, because we want to support all hash algo in BIOS.
+//
+#define HASH_COUNT 6
+
+#endif
diff --git a/ReferenceCode/ME/SampleCode/Include/IndustryStandard/Tpm2Acpi.h b/ReferenceCode/ME/SampleCode/Include/IndustryStandard/Tpm2Acpi.h
new file mode 100644
index 0000000..3c86567
--- /dev/null
+++ b/ReferenceCode/ME/SampleCode/Include/IndustryStandard/Tpm2Acpi.h
@@ -0,0 +1,53 @@
+/** @file
+ TPM2 ACPI table definition.
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+#ifndef _TPM2_ACPI_H_
+#define _TPM2_ACPI_H_
+
+#include <IndustryStandard/Acpi.h>
+
+#pragma pack (1)
+
+#define EFI_TPM2_ACPI_TABLE_REVISION 3
+
+typedef struct {
+ EFI_ACPI_DESCRIPTION_HEADER Header;
+ UINT32 Flags;
+ UINT64 AddressOfControlArea;
+ UINT32 StartMethod;
+//UINT8 PlatformSpecificParameters[];
+} EFI_TPM2_ACPI_TABLE;
+
+#define EFI_TPM2_ACPI_TABLE_START_METHOD_ACPI 2
+
+typedef struct {
+ UINT32 Reserved;
+ UINT32 Error;
+ UINT32 Cancel;
+ UINT32 Start;
+ UINT64 InterruptControl;
+ UINT32 CommandSize;
+ UINT64 Command;
+ UINT32 ResponseSize;
+ UINT64 Response;
+} EFI_TPM2_ACPI_CONTROL_AREA;
+
+#pragma pack ()
+
+#endif
diff --git a/ReferenceCode/ME/SampleCode/Include/IndustryStandard/Tpm2DeviceLib.h b/ReferenceCode/ME/SampleCode/Include/IndustryStandard/Tpm2DeviceLib.h
new file mode 100644
index 0000000..803fb6c
--- /dev/null
+++ b/ReferenceCode/ME/SampleCode/Include/IndustryStandard/Tpm2DeviceLib.h
@@ -0,0 +1,112 @@
+/** @file
+ This library abstract how to access TPM2 hardware device.
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+#ifndef _TPM2_DEVICE_LIB_H_
+#define _TPM2_DEVICE_LIB_H_
+
+/**
+ This service enables the sending of commands to the TPM2.
+
+ @param[in] InputParameterBlockSize Size of the TPM2 input parameter block.
+ @param[in] InputParameterBlock Pointer to the TPM2 input parameter block.
+ @param[in] OutputParameterBlockSize Size of the TPM2 output parameter block.
+ @param[in] OutputParameterBlock Pointer to the TPM2 output parameter block.
+
+ @retval EFI_SUCCESS The command byte stream was successfully sent to the device and a response was successfully received.
+ @retval EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device.
+ @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small.
+**/
+EFI_STATUS
+EFIAPI
+Tpm2SubmitCommand (
+ IN UINT32 InputParameterBlockSize,
+ IN UINT8 *InputParameterBlock,
+ IN OUT UINT32 *OutputParameterBlockSize,
+ IN UINT8 *OutputParameterBlock
+ );
+
+/**
+ This service requests use TPM2.
+
+ @retval EFI_SUCCESS Get the control of TPM2 chip.
+ @retval EFI_NOT_FOUND TPM2 not found.
+ @retval EFI_DEVICE_ERROR Unexpected device behavior.
+**/
+EFI_STATUS
+EFIAPI
+Tpm2RequestUseTpm (
+ VOID
+ );
+
+/**
+ This service enables the sending of commands to the TPM2.
+
+ @param[in] InputParameterBlockSize Size of the TPM2 input parameter block.
+ @param[in] InputParameterBlock Pointer to the TPM2 input parameter block.
+ @param[in] OutputParameterBlockSize Size of the TPM2 output parameter block.
+ @param[in] OutputParameterBlock Pointer to the TPM2 output parameter block.
+
+ @retval EFI_SUCCESS The command byte stream was successfully sent to the device and a response was successfully received.
+ @retval EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device.
+ @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *TPM2_SUBMIT_COMMAND) (
+ IN UINT32 InputParameterBlockSize,
+ IN UINT8 *InputParameterBlock,
+ IN OUT UINT32 *OutputParameterBlockSize,
+ IN UINT8 *OutputParameterBlock
+ );
+
+/**
+ This service requests use TPM2.
+
+ @retval EFI_SUCCESS Get the control of TPM2 chip.
+ @retval EFI_NOT_FOUND TPM2 not found.
+ @retval EFI_DEVICE_ERROR Unexpected device behavior.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *TPM2_REQUEST_USE_TPM) (
+ VOID
+ );
+
+typedef struct {
+ EFI_GUID ProviderGuid;
+ TPM2_SUBMIT_COMMAND Tpm2SubmitCommand;
+ TPM2_REQUEST_USE_TPM Tpm2RequestUseTpm;
+} TPM2_DEVICE_INTERFACE;
+
+/**
+ This service register TPM2 device.
+
+ @Param Tpm2Device TPM2 device
+
+ @retval EFI_SUCCESS This TPM2 device is registered successfully.
+ @retval EFI_UNSUPPORTED System does not support register this TPM2 device.
+ @retval EFI_ALREADY_STARTED System already register this TPM2 device.
+**/
+EFI_STATUS
+EFIAPI
+Tpm2RegisterTpm2DeviceLib (
+ IN TPM2_DEVICE_INTERFACE *Tpm2Device
+ );
+
+#endif
diff --git a/ReferenceCode/ME/SampleCode/Include/MeDxeLibSampleCode.dsc b/ReferenceCode/ME/SampleCode/Include/MeDxeLibSampleCode.dsc
new file mode 100644
index 0000000..334e205
--- /dev/null
+++ b/ReferenceCode/ME/SampleCode/Include/MeDxeLibSampleCode.dsc
@@ -0,0 +1,26 @@
+## @file
+# Build description file Sample Code for building the Me
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains an 'Intel Peripheral Driver' and uniquely
+# identified as "Intel Reference Module" and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+
+#
+# ME Sample Code Libraries
+#
+$(PROJECT_ME_ROOT)\SampleCode\Library\AslUpdate\Dxe\AslUpdateLib.inf
+$(PROJECT_ME_ROOT)\SampleCode\Protocol\MeSampleCodeProtocolLib.inf \ No newline at end of file
diff --git a/ReferenceCode/ME/SampleCode/Library/AslUpdate/Dxe/AslUpdateLib.inf b/ReferenceCode/ME/SampleCode/Library/AslUpdate/Dxe/AslUpdateLib.inf
new file mode 100644
index 0000000..8b5396f
--- /dev/null
+++ b/ReferenceCode/ME/SampleCode/Library/AslUpdate/Dxe/AslUpdateLib.inf
@@ -0,0 +1,66 @@
+## @file
+# Provides services to update ASL tables.
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = AslUpdateLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ DxeAslUpdateLib.c
+
+[includes.common]
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/SampleCode/Include
+
+#
+# Edk II Glue Library, some hearder are included by R9 header so have to include
+#
+
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Framework
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[libraries.common]
+ EdkIIGlueBaseMemoryLib
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+
+[nmake.common]
+
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__
diff --git a/ReferenceCode/ME/SampleCode/Library/AslUpdate/Dxe/DxeAslUpdateLib.c b/ReferenceCode/ME/SampleCode/Library/AslUpdate/Dxe/DxeAslUpdateLib.c
new file mode 100644
index 0000000..79a7c86
--- /dev/null
+++ b/ReferenceCode/ME/SampleCode/Library/AslUpdate/Dxe/DxeAslUpdateLib.c
@@ -0,0 +1,333 @@
+/** @file
+ Boot service DXE ASL update library implementation.
+ These functions in this file can be called during DXE and cannot be called during runtime
+ or in SMM which should use a RT or SMM library.
+ This library uses the ACPI Support protocol.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "AslUpdateLib.h"
+#endif
+static EFI_ACPI_SUPPORT_PROTOCOL *mAcpiSupport = NULL;
+static EFI_ACPI_TABLE_PROTOCOL *mAcpiTable = NULL;
+
+//
+// Function implemenations
+//
+
+/**
+ Initialize the ASL update library state.
+ This must be called prior to invoking other library functions.
+
+ @param[in] None
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+InitializeAslUpdateLib (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+
+ ///
+ /// Locate ACPI tables
+ ///
+ Status = gBS->LocateProtocol (&gEfiAcpiSupportProtocolGuid, NULL, (VOID **) &mAcpiSupport);
+ ASSERT_EFI_ERROR (Status);
+ Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **) &mAcpiTable);
+ return EFI_SUCCESS;
+}
+
+/**
+ This procedure will update two kinds of asl code.
+ 1: Operating Region base address and length.
+ 2: Resource Consumption structures in device LDRC.
+
+ @param[in] AslSignature The signature of Operation Region that we want to update.
+ @param[in] BaseAddress Base address of IO trap.
+ @param[in] Length Length of IO address.
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+UpdateAslCode (
+ IN UINT32 AslSignature,
+ IN UINT16 BaseAddress,
+ IN UINT8 Length
+ )
+{
+ EFI_STATUS Status;
+ EFI_ACPI_DESCRIPTION_HEADER *Table;
+ EFI_ACPI_TABLE_VERSION Version;
+ UINT8 *CurrPtr;
+ UINT8 *Operation;
+ UINT32 *Signature;
+ UINT8 *DsdtPointer;
+ INTN Index;
+ UINTN Handle;
+ UINT16 AslLength;
+
+ ///
+ /// Locate table with matching ID
+ ///
+ Index = 0;
+ AslLength = 0;
+ do {
+ Status = mAcpiSupport->GetAcpiTable (mAcpiSupport, Index, (VOID **) &Table, &Version, &Handle);
+ if (Status == EFI_NOT_FOUND) {
+ break;
+ }
+
+ ASSERT_EFI_ERROR (Status);
+ Index++;
+ } while (Table->Signature != EFI_ACPI_3_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE);
+
+ ///
+ /// Fix up the following ASL Code in DSDT:
+ /// (1) OperationRegion's IO Base Address and Length.
+ /// (2) Resource Consumption in LPC Device.
+ ///
+ CurrPtr = (UINT8 *) Table;
+
+ ///
+ /// Loop through the ASL looking for values that we must fix up.
+ ///
+ for (DsdtPointer = CurrPtr; DsdtPointer <= (CurrPtr + ((EFI_ACPI_COMMON_HEADER *) CurrPtr)->Length); DsdtPointer++) {
+ ///
+ /// Get a pointer to compare for signature
+ ///
+ Signature = (UINT32 *) DsdtPointer;
+
+ ///
+ /// Check if this is the signature we are looking for
+ ///
+ if ((*Signature) == AslSignature) {
+ ///
+ /// Conditional match. For Region Objects, the Operator will always be the
+ /// byte immediately before the specific name. Therefore, subtract 1 to check
+ /// the Operator.
+ ///
+ Operation = DsdtPointer - 1;
+
+ ///
+ /// If we have an operation region, update the base address and length
+ ///
+ if (*Operation == AML_OPREGION_OP) {
+ ///
+ /// Fixup the Base Address in OperationRegion.
+ ///
+ *(UINT16 *) (DsdtPointer + 6) = BaseAddress;
+
+ ///
+ /// Fixup the Length in OperationRegion.
+ ///
+ *(DsdtPointer + 9) = Length;
+ }
+
+ } else if ((*Signature) == EFI_SIGNATURE_32 ('L', 'D', 'R', 'C')) {
+ ///
+ /// Make sure it's device of LDRC and read the length
+ ///
+ if (*(DsdtPointer - 2) == AML_DEVICE_OP) {
+ AslLength = *(DsdtPointer - 1);
+ } else if (*(DsdtPointer - 3) == AML_DEVICE_OP) {
+ AslLength = *(UINT16 *) (DsdtPointer - 2);
+ AslLength = (AslLength & 0x0F) + ((AslLength & 0x0FF00) >> 4);
+ }
+ ///
+ /// Conditional match. Search _CSR in Device (LDRC).
+ ///
+ for (Operation = DsdtPointer; Operation <= DsdtPointer + AslLength; Operation++) {
+ ///
+ /// Get a pointer to compare for signature
+ ///
+ Signature = (UINT32 *) Operation;
+
+ ///
+ /// Check if this is the signature we are looking for
+ ///
+ if ((*Signature) == EFI_SIGNATURE_32 ('_', 'C', 'R', 'S')) {
+ ///
+ /// Now look for an empty resource entry, fix the base address and length fields
+ ///
+ for (Index = 0; *(UINT16 *) (Operation + 9 + 8 * Index) != 0x0079; Index++) {
+ if (*(UINT16 *) (Operation + 11 + 8 * Index) == UINT16_BIT_MAGIC_NUMBER) {
+ ///
+ /// Fixup the Base Address and Length.
+ ///
+ *(UINT16 *) (Operation + 11 + 8 * Index) = BaseAddress;
+ *(UINT16 *) (Operation + 13 + 8 * Index) = BaseAddress;
+ *(Operation + 16 + 8 * Index) = Length;
+ break;
+ }
+ }
+ }
+ }
+
+ DsdtPointer = DsdtPointer + AslLength;
+ }
+ }
+ ///
+ /// Update the modified ACPI table
+ ///
+ Status = mAcpiTable->InstallAcpiTable (
+ mAcpiTable,
+ Table,
+ Table->Length,
+ &Handle
+ );
+ FreePool (Table);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This function uses the ACPI support protocol to locate an ACPI table.
+ It is really only useful for finding tables that only have a single instance,
+ e.g. FADT, FACS, MADT, etc. It is not good for locating SSDT, etc.
+
+ @param[in] Signature Pointer to an ASCII string containing the OEM Table ID from the ACPI table header
+ @param[in] Table Updated with a pointer to the table
+ @param[in] Handle AcpiSupport protocol table handle for the table found
+ @param[in] Version The version of the table desired
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+LocateAcpiTableBySignature (
+ IN UINT32 Signature,
+ IN OUT EFI_ACPI_DESCRIPTION_HEADER **Table,
+ IN OUT UINTN *Handle,
+ IN OUT EFI_ACPI_TABLE_VERSION *Version
+ )
+{
+ EFI_STATUS Status;
+ INTN Index;
+ EFI_ACPI_TABLE_VERSION DesiredVersion;
+
+ DesiredVersion = *Version;
+ ///
+ /// Locate table with matching ID
+ ///
+ Index = 0;
+ do {
+ Status = mAcpiSupport->GetAcpiTable (mAcpiSupport, Index, (VOID **) Table, Version, Handle);
+ if (Status == EFI_NOT_FOUND) {
+ break;
+ }
+
+ ASSERT_EFI_ERROR (Status);
+ Index++;
+ } while ((*Table)->Signature != Signature || !(*Version & DesiredVersion));
+
+ ///
+ /// If we found the table, there will be no error.
+ ///
+ return Status;
+}
+
+/**
+ This function uses the ACPI support protocol to locate an ACPI SSDT table.
+
+ @param[in] TableId Pointer to an ASCII string containing the OEM Table ID from the ACPI table header
+ @param[in] TableIdSize Length of the TableId to match. Table ID are 8 bytes long, this function
+ will consider it a match if the first TableIdSize bytes match
+ @param[in] Table Updated with a pointer to the table
+ @param[in] Handle AcpiSupport protocol table handle for the table found
+ @param[in] Version See AcpiSupport protocol, GetAcpiTable function for use
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+LocateAcpiTableByOemTableId (
+ IN UINT8 *TableId,
+ IN UINT8 TableIdSize,
+ IN OUT EFI_ACPI_DESCRIPTION_HEADER **Table,
+ IN OUT UINTN *Handle,
+ IN OUT EFI_ACPI_TABLE_VERSION *Version
+ )
+{
+ EFI_STATUS Status;
+ INTN Index;
+
+ ///
+ /// Locate table with matching ID
+ ///
+ Index = 0;
+ do {
+ Status = mAcpiSupport->GetAcpiTable (mAcpiSupport, Index, (VOID **) Table, Version, Handle);
+ if (Status == EFI_NOT_FOUND) {
+ break;
+ }
+
+ ASSERT_EFI_ERROR (Status);
+ Index++;
+ } while (CompareMem (&(*Table)->OemTableId, TableId, TableIdSize));
+
+ ///
+ /// If we found the table, there will be no error.
+ ///
+ return Status;
+}
+
+/**
+ This function calculates and updates an UINT8 checksum.
+
+ @param[in] Buffer Pointer to buffer to checksum
+ @param[in] Size Number of bytes to checksum
+ @param[in] ChecksumOffset Offset to place the checksum result in
+
+ @retval EFI_SUCCESS The function completed successfully.
+**/
+EFI_STATUS
+AcpiChecksum (
+ IN VOID *Buffer,
+ IN UINTN Size,
+ IN UINTN ChecksumOffset
+ )
+{
+ UINT8 Sum;
+ UINT8 *Ptr;
+
+ Sum = 0;
+ //
+ // Initialize pointer
+ //
+ Ptr = Buffer;
+
+ //
+ // Set checksum to 0 first
+ //
+ Ptr[ChecksumOffset] = 0;
+
+ //
+ // Add all content of buffer
+ //
+ while (Size--) {
+ Sum = (UINT8) (Sum + (*Ptr++));
+ }
+ //
+ // Set checksum
+ //
+ Ptr = Buffer;
+ Ptr[ChecksumOffset] = (UINT8) (0xff - Sum + 1);
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/ME/SampleCode/Library/AslUpdate/Dxe/MeAslUpdateLib.cif b/ReferenceCode/ME/SampleCode/Library/AslUpdate/Dxe/MeAslUpdateLib.cif
new file mode 100644
index 0000000..81b5bf0
--- /dev/null
+++ b/ReferenceCode/ME/SampleCode/Library/AslUpdate/Dxe/MeAslUpdateLib.cif
@@ -0,0 +1,11 @@
+<component>
+ name = "MeAslUpdateLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\SampleCode\Library\AslUpdate\Dxe"
+ RefName = "MeAslUpdateLib"
+[files]
+"MeAslUpdateLib.sdl"
+"MeAslUpdateLib.mak"
+"DxeAslUpdateLib.c"
+"AslUpdateLib.inf"
+<endComponent>
diff --git a/ReferenceCode/ME/SampleCode/Library/AslUpdate/Dxe/MeAslUpdateLib.mak b/ReferenceCode/ME/SampleCode/Library/AslUpdate/Dxe/MeAslUpdateLib.mak
new file mode 100644
index 0000000..7417a00
--- /dev/null
+++ b/ReferenceCode/ME/SampleCode/Library/AslUpdate/Dxe/MeAslUpdateLib.mak
@@ -0,0 +1,32 @@
+# MAK file for the ModulePart:AslUpdateLib
+all : MeAslUpdateLib
+
+$(BUILD_DIR)\MeAslUpdateLib.lib : MeAslUpdateLib
+
+MeAslUpdateLib : $(BUILD_DIR)\MeAslUpdateLib.mak MeAslUpdateLibBin
+
+$(BUILD_DIR)\MeAslUpdateLib.mak : $(MeAslUpdateLib_DIR)\$(@B).cif $(MeAslUpdateLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(MeAslUpdateLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+MeAslUpdateLib_INCLUDES=\
+ $(EDK_INCLUDES)\
+ $(ME_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(iAMT_INCLUDES)\
+ $(IndustryStandard_INCLUDES)
+
+MeAslUpdateLib_DEFINES=\
+ $(MY_DEFINES)\
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__\
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__\
+
+MeAslUpdateLib_LIBS=\
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+
+MeAslUpdateLibBin : $(MeAslUpdateLib_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\MeAslUpdateLib.mak all \
+ "MY_INCLUDES=$(MeAslUpdateLib_INCLUDES)"\
+ "MY_DEFINES=$(MeAslUpdateLib_DEFINES)"\
+ TYPE=LIBRARY\ \ No newline at end of file
diff --git a/ReferenceCode/ME/SampleCode/Library/AslUpdate/Dxe/MeAslUpdateLib.sdl b/ReferenceCode/ME/SampleCode/Library/AslUpdate/Dxe/MeAslUpdateLib.sdl
new file mode 100644
index 0000000..aae94fb
--- /dev/null
+++ b/ReferenceCode/ME/SampleCode/Library/AslUpdate/Dxe/MeAslUpdateLib.sdl
@@ -0,0 +1,29 @@
+TOKEN
+ Name = MeAslUpdateLib_SUPPORT
+ Value = 1
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable AslUpdateLib support in Project"
+End
+
+MODULE
+ Help = "Includes MeAslUpdateLib.mak to Project"
+ File = "MeAslUpdateLib.mak"
+End
+
+PATH
+ Name = "MeAslUpdateLib_DIR"
+End
+
+ELINK
+ Name = "MeAslUpdateLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\MeAslUpdateLib.lib"
+ Parent = "MeAslUpdateLib_LIB"
+ InvokeOrder = AfterParent
+End \ No newline at end of file
diff --git a/ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.c b/ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.c
new file mode 100644
index 0000000..3b78726
--- /dev/null
+++ b/ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.c
@@ -0,0 +1,122 @@
+/** @file
+ Provides an interface to call function to send HECI message.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#endif
+#include "MdesStatusCodeDxe.h"
+#include "MeLib.h"
+#include "MePlatformPolicy\MePlatformPolicy.h"
+
+
+EFI_GUID gMdesStatusCodeProtocolGuid = MDES_STATUS_CODE_PROTOCOL_GUID;
+
+/**
+ This function is called in case of status code appears.
+ Provides an interface to call function to send HECI message.
+
+ @param[in] Type Indicates the type of status code being reported.
+ @param[in] Value Describes the current status of a hardware or software entity.
+ This included information about the class and subclass that is
+ used to classify the entity as well as an operation.
+ @param[in] Instance The enumeration of a hardware or software entity within
+ the system. Valid instance numbers start with 1.
+ @param[in] CallerId This optional parameter may be used to identify the caller.
+ This parameter allows the status code driver to apply different
+ rules to different callers.
+ @param[in] Data This optional parameter may be used to pass additional data.
+
+ @retval EFI_STATUS HECI sent with success.
+**/
+EFI_STATUS
+EFIAPI
+MdesReportStatusCodeHandler (
+ IN EFI_STATUS_CODE_TYPE Type,
+ IN EFI_STATUS_CODE_VALUE Value,
+ IN UINT32 Instance,
+ IN EFI_GUID *CallerId OPTIONAL,
+ IN EFI_STATUS_CODE_DATA *Data OPTIONAL
+ )
+{
+ EFI_STATUS Status;
+
+ Status = HeciSendMdesStatusCode (Type, Value, Instance, CallerId, Data);
+
+ return Status;
+}
+
+MDES_STATUS_CODE_PROTOCOL MdesStatusCodeProtocolInstance = {MdesReportStatusCodeHandler};
+
+
+/**
+ Installs MdesStatusCodeProtocolInstance protocol.
+
+ @param[in] ImageHandle Image handle of this driver.
+ @param[in] SystemTable Global system service table.
+
+ @retval EFI_STATUS Driver instaled with siccess.
+**/
+EFI_STATUS
+EFIAPI
+MdesStatusCodeDrvEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ MDES_BIOS_FLAGS Flags;
+ UINT32 BiosEventFilters;
+ DXE_ME_POLICY_PROTOCOL *MePlatformPolicy;
+
+ ///
+ /// Get the ME platform policy.
+ ///
+ Status = gBS->LocateProtocol (&gDxePlatformMePolicyGuid, NULL, (VOID **) &MePlatformPolicy);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ if(MePlatformPolicy->MeConfig.MdesForBiosState == TRUE) {
+ ///
+ /// Check if Mdes is enabled in FW
+ ///
+ Status = HeciGetMdesConfig(&Flags, &BiosEventFilters);
+ if (EFI_ERROR (Status)) {
+ return EFI_SUCCESS;
+ }
+ if (1) {
+ ///
+ /// Install Mdes protocol to be consumed by platform library for ReportStatusCode core driver.
+ ///
+ Status = gBS->InstallProtocolInterface (
+ &ImageHandle,
+ &gMdesStatusCodeProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ &MdesStatusCodeProtocolInstance
+ );
+ }
+ {
+ PLATFORM_DEBUG_CAP Data;
+ UINT8 Result;
+
+ Data.Data = 3;
+ Status = HeciPlatformDebugCapabilityMsg(Data, &Result);
+ }
+ }
+ return Status;
+}
diff --git a/ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.cif b/ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.cif
new file mode 100644
index 0000000..2647905
--- /dev/null
+++ b/ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "MdesStatusCodeDxe"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\SampleCode\MdesStatusCode\Dxe"
+ RefName = "MdesStatusCodeDxe"
+[files]
+"MdesStatusCodeDxe.sdl"
+"MdesStatusCodeDxe.mak"
+"MdesStatusCodeDxe.c"
+"MdesStatusCodeDxe.dxs"
+"MdesStatusCodeDxe.h"
+"MdesStatusCodeDxe.inf"
+<endComponent>
diff --git a/ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.dxs b/ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.dxs
new file mode 100644
index 0000000..ab85bb6
--- /dev/null
+++ b/ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.dxs
@@ -0,0 +1,39 @@
+/**
+
+Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+
+Abstract:
+
+
+**/
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "DxeDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+#include EFI_PROTOCOL_DEFINITION (Heci)
+#include EFI_PROTOCOL_DEFINITION (MePlatformPolicy)
+#endif
+
+DEPENDENCY_START
+ EFI_HECI_PROTOCOL_GUID AND
+ DXE_PLATFORM_ME_POLICY_GUID
+DEPENDENCY_END
diff --git a/ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.h b/ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.h
new file mode 100644
index 0000000..74bfc0a
--- /dev/null
+++ b/ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.h
@@ -0,0 +1,59 @@
+/** @file
+ Header file to provides an interface to call function to send HECI message.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+--*/
+#ifndef _MDES_STATUS_CODE_DXE_H_
+#define _MDES_STATUS_CODE_DXE_H_
+
+#define MDES_STATUS_CODE_PROTOCOL_GUID \
+ { \
+ 0xe5d0875a, 0xf647, 0x4e16, 0xbe, 0x4d, 0x95, 0x02, 0x40, 0x29, 0xcc, 0x44 \
+ }
+
+/**
+ This function is called in case of status code appears.
+ Provides an interface to call function to send HECI message.
+
+ @param[in] Type Indicates the type of status code being reported.
+ @param[in] Value Describes the current status of a hardware or software entity.
+ This included information about the class and subclass that is
+ used to classify the entity as well as an operation.
+ @param[in] Instance The enumeration of a hardware or software entity within
+ the system. Valid instance numbers start with 1.
+ @param[in] CallerId This optional parameter may be used to identify the caller.
+ This parameter allows the status code driver to apply different
+ rules to different callers.
+ @param[in] Data This optional parameter may be used to pass additional data.
+
+ @retval EFI_STATUS HECI sent with success.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *SEND_STATUS_CODE) (
+ IN EFI_STATUS_CODE_TYPE Type,
+ IN EFI_STATUS_CODE_VALUE Value,
+ IN UINT32 Instance,
+ IN EFI_GUID *CallerId OPTIONAL,
+ IN EFI_STATUS_CODE_DATA *Data OPTIONAL
+ );
+
+typedef struct _MDES_STATUS_CODE_PROTOCOL {
+ SEND_STATUS_CODE SendMdesStatusCode;
+} MDES_STATUS_CODE_PROTOCOL;
+
+#endif
diff --git a/ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.inf b/ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.inf
new file mode 100644
index 0000000..1a77fa5
--- /dev/null
+++ b/ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.inf
@@ -0,0 +1,82 @@
+## @file
+# Component description file for the MdesStatusCodeDrv DXE driver.
+#
+#@copyright
+# Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+
+[defines]
+BASE_NAME = MdesStatusCodeDxe
+FILE_GUID = df5cd25a-8e55-46ba-8cda-bc7db7bf9c64
+COMPONENT_TYPE = BS_DRIVER
+
+[sources.common]
+ MdesStatusCodeDxe.c
+ MdesStatusCodeDxe.h
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueDxeDriverEntryPoint.c
+
+[includes.common]
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Heci/Include
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/Dxe
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/Include
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Protocol/MePlatformPolicy
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[libraries.common]
+ MeProtocolLib
+ MeLib
+ MeGuidLib
+ MeChipsetLib
+ EdkProtocolLib
+ EdkFrameworkProtocolLib
+ EdkIIGlueBaseLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueDxeReportStatusCodeLib
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueDxeServicesTableLib
+ EdkIIGlueEdkDxeRuntimeDriverLib
+ EdkIIGlueBasePciLibPciExpress
+
+[nmake.common]
+ IMAGE_ENTRY_POINT= _ModuleEntryPoint
+ DPX_SOURCE=MdesStatusCodeDxe.dxs
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=MdesStatusCodeDrvEntryPoint \
+ -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__\
+ -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__
diff --git a/ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.mak b/ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.mak
new file mode 100644
index 0000000..6e49bcc
--- /dev/null
+++ b/ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.mak
@@ -0,0 +1,142 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2010, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+#**********************************************************************
+#
+# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeSampleCode/MdesStatusCodeDxe/MdesStatusCodeDxe.mak 1 4/06/12 8:57a Klzhan $
+#
+# $Revision: 1 $
+#
+# $Date: 4/06/12 8:57a $
+#
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeSampleCode/MdesStatusCodeDxe/MdesStatusCodeDxe.mak $
+#
+# 1 4/06/12 8:57a Klzhan
+#
+# 4 3/27/12 5:17a Klzhan
+# Correct TYPE of this modulepart.
+#
+# 3 10/19/11 9:19a Calvinchen
+# [TAG] EIP65695
+# [Category] Bug Fix
+# [Severity] Normal
+# [Symptom] Support HECI protocol in SMM for ME 8.0
+# [Solution] Removed "EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB" from Make
+# file.
+#
+# 2 9/27/11 5:03a Klzhan
+# Fix build error
+#
+# 1 9/27/11 4:46a Klzhan
+#
+#
+#
+#**********************************************************************
+#
+#<AMI_FHDR_START>
+#----------------------------------------------------------------------------
+#
+# Name: MdesStatusCodeDrv.mak
+#
+# Description: Mdes Status Code driver
+#
+#----------------------------------------------------------------------------
+#<AMI_FHDR_END>
+all : MdesStatusCodeDrv
+
+MdesStatusCodeDrv : $(BUILD_DIR)\MdesStatusCodeDxe.mak MdesStatusCodeDrvBin
+
+$(BUILD_DIR)\MdesStatusCodeDxe.mak : $(MdesStatusCodeDrv_DIR)\$(@B).cif $(MdesStatusCodeDrv_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(MdesStatusCodeDrv_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+
+MdesStatusCodeDrv_INCLUDES=\
+ $(EDK_INCLUDES)\
+ $(ME_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(EdkIIGlueInclude)\
+ $(IndustryStandard_INCLUDES)\
+ -I$(MeProtocolLib_DIR)\
+ -I$(INTEL_COUGAR_POINT_INCLUDE_DIR)
+
+MdesStatusCodeDrv_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=MdesStatusCodeDrvEntryPoint"\
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__\
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__
+
+
+MdesStatusCodeDrv_LIB_LINKS =\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(INTEL_PCH_PROTOCOL_LIB)\
+ $(EdkIIGlueBasePrintLib_LIB) \
+ $(EdkIIGlueUefiLib_LIB)\
+ $(TdtProtocolLib_LIB)\
+ $(ProtocolLib_LIB)\
+ $(EFISCRIPTLIB)\
+ $(AmtLibDxe_LIB)\
+ $(MeLibDxe_LIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+ $(AmtGuidLib_LIB)\
+ $(EFIGUIDLIB)\
+ $(EDKPROTOCOLLIB)\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueEdkDxeRuntimeDriverLib_LIB)\
+ $(EdkIIGluePeiDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueDxeMemoryAllocationLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(EFIDRIVERLIB)\
+ $(EdkIIGlueDxeServicesTableLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(MeProtocolLib_LIB)
+# MAK file for the eModule:TdtDxe
+
+MdesStatusCodeDrvBin : $(MdesStatusCodeDrv_LIB_LINKS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\MdesStatusCodeDxe.mak all\
+ "MY_INCLUDES=$(MdesStatusCodeDrv_INCLUDES)"\
+ "MY_DEFINES=$(MdesStatusCodeDrv_DEFINES)"\
+ GUID=df5cd25a-8e55-46ba-8cda-bc7db7bf9c64 \
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=BS_DRIVER \
+ EDKIIModule=DXEDRIVER\
+ DEPEX1=$(MdesStatusCodeDrv_DIR)\MdesStatusCodeDxe.dxs \
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \
+ COMPRESS=1\
+
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2010, 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/ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.sdl b/ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.sdl
new file mode 100644
index 0000000..f61edd3
--- /dev/null
+++ b/ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.sdl
@@ -0,0 +1,25 @@
+TOKEN
+ Name = "MDES_STATUSCODE_DRV_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+ Help = "Main switch to enable IccOverClocking support in Project"
+End
+
+MODULE
+ Help = "Includes MebxSetupBrowser.mak to Project"
+ File = "MdesStatusCodeDxe.mak"
+End
+
+PATH
+ Name = "MdesStatusCodeDrv_DIR"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\MdesStatusCodeDxe.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End \ No newline at end of file
diff --git a/ReferenceCode/ME/SampleCode/MeSampleCode.cif b/ReferenceCode/ME/SampleCode/MeSampleCode.cif
new file mode 100644
index 0000000..3b8484e
--- /dev/null
+++ b/ReferenceCode/ME/SampleCode/MeSampleCode.cif
@@ -0,0 +1,28 @@
+<component>
+ name = "MeSampleCode"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\SampleCode\"
+ RefName = "MeSampleCode"
+[files]
+"Include\MeDxeLibSampleCode.dsc"
+"Include\Acpi1_0.h"
+"Include\Acpi2_0.h"
+"Include\Acpi3_0.h"
+"Include\AlertStandardFormatTable.h"
+"Include\AslUpdateLib.h"
+"AsfSupport\AsfSupport.h"
+"AsfSupport\AsfSupport.c"
+"Protocol\SmmVariable\SmmVariable.h"
+"Include\Guid\MemoryOverwriteControl\MemoryOverwriteControl.h"
+"Include\Guid\TrEEPhysicalPresenceData\TrEEPhysicalPresenceData.h"
+"Include\IndustryStandard\AcpiAml.h"
+"Include\IndustryStandard\Tpm20.h"
+"Include\IndustryStandard\Tpm20Implementation.h"
+"Include\IndustryStandard\Tpm2Acpi.h"
+"Include\IndustryStandard\Tpm2DeviceLib.h"
+[parts]
+"MeAslUpdateLib"
+"PlatformReset"
+"MePlatformGetResetTypeProtocolLib"
+"MdesStatusCodeDxe"
+<endComponent>
diff --git a/ReferenceCode/ME/SampleCode/PlatformReset/RuntimeDxe/PlatformReset.c b/ReferenceCode/ME/SampleCode/PlatformReset/RuntimeDxe/PlatformReset.c
new file mode 100644
index 0000000..55cdf11
--- /dev/null
+++ b/ReferenceCode/ME/SampleCode/PlatformReset/RuntimeDxe/PlatformReset.c
@@ -0,0 +1,168 @@
+/** @file
+ Provide the ResetSystem AP
+
+@copyright
+ Copyright (c) 2011 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "PlatformReset.h"
+#include "MeLib.h"
+PCH_RESET_PROTOCOL *mPchReset;
+
+/**
+ Reset the system
+
+ @param[in] ResetType Warm or cold
+ @param[in] ResetStatus Possible cause of reset
+ @param[in] DataSize Size of ResetData in bytes
+ @param[in] ResetData Optional Unicode string
+
+ @retval Does not return if the reset takes place.
+**/
+VOID
+EFIAPI
+PlatformResetSystem (
+ IN EFI_RESET_TYPE ResetType,
+ IN EFI_STATUS ResetStatus,
+ IN UINTN DataSize,
+ IN CHAR16 *ResetData OPTIONAL
+ )
+{
+ EFI_STATUS Status;
+ ME_PLATFORM_GET_RESET_TYPE_PROTOCOL *MePlatformGetResetType;
+ PCH_RESET_TYPE OverridePchResetType;
+ PCH_RESET_TYPE PchResetType;
+ UINTN NumberMePlatformGetResetHandles;
+ EFI_HANDLE *MePlatformGetResetHandles;
+ UINTN Index;
+
+ PchResetType = ResetType;
+ OverridePchResetType = ResetType;
+
+ if (!EfiAtRuntime ()) {
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gMePlatformGetResetTypeGuid,
+ NULL,
+ &NumberMePlatformGetResetHandles,
+ &MePlatformGetResetHandles
+ );
+ if (!EFI_ERROR (Status)) {
+ for (Index = 0; Index < NumberMePlatformGetResetHandles; Index++) {
+ Status = gBS->HandleProtocol (
+ MePlatformGetResetHandles[Index],
+ &gMePlatformGetResetTypeGuid,
+ (VOID **) &MePlatformGetResetType
+ );
+ if (!EFI_ERROR (Status)) {
+ PchResetType = MePlatformGetResetType->GetResetType (ResetType);
+ DEBUG ((EFI_D_INFO, "Returned Pch ResetType is: %x\n", PchResetType));
+ if (PchResetType >= MaxRestReq) {
+ DEBUG ((EFI_D_ERROR, "Platform Reset failed, invalid parameter\n"));
+ ASSERT (FALSE);
+ }
+ if (OverridePchResetType < PchResetType) {
+ DEBUG ((EFI_D_INFO, "Previous Pch ResetType is: %x\n", OverridePchResetType));
+ OverridePchResetType = PchResetType;
+ }
+ DEBUG ((EFI_D_INFO, "Current Pch ResetType is: %x\n", OverridePchResetType));
+ }
+ }
+ }
+ PchResetType = OverridePchResetType;
+ if ((PchResetType == GlobalReset) || (PchResetType == GlobalResetWithEc)) {
+ ///
+ /// Let ME do global reset if Me Fw is available
+ ///
+ Status = HeciSendCbmResetRequest (CBM_RR_REQ_ORIGIN_BIOS_POST, CBM_HRR_GLOBAL_RESET);
+ if (!EFI_ERROR (Status)) {
+ ///
+ /// ME Global Reset should fail after EOP is sent.
+ /// Go to use PCH Reset
+ ///
+ gBS->Stall (1000000);
+ }
+ }
+ }
+
+ mPchReset->Reset (mPchReset, PchResetType);
+
+ ASSERT (FALSE);
+}
+
+/**
+ Entry point of Platform Reset driver.
+
+ @param[in] ImageHandle Standard entry point parameter
+ @param[in] SystemTable Standard entry point parameter
+
+ @retval EFI_SUCCESS Reset RT protocol installed
+ @retval All other error conditions encountered result in an ASSERT
+**/
+EFI_STATUS
+InitializePlatformReset (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_HANDLE Handle;
+ EFI_STATUS Status;
+
+ Status = gBS->LocateProtocol (&gPchResetProtocolGuid, NULL, (VOID **) &mPchReset);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Make sure the Reset Architectural Protocol is not already installed in the system
+ ///
+ ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiResetArchProtocolGuid);
+
+ ///
+ /// Hook the runtime service table
+ ///
+ SystemTable->RuntimeServices->ResetSystem = PlatformResetSystem;
+
+ ///
+ /// Now install the Reset RT AP on a new handle
+ ///
+ Handle = NULL;
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &Handle,
+ &gEfiResetArchProtocolGuid,
+ NULL,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ return Status;
+}
+
+/**
+ Fixup internal data pointers so that the services can be called in virtual mode.
+
+ @param[in] Event The event registered.
+ @param[in] Context Event context. Not used in this event handler.
+
+ @retval None
+**/
+EFI_RUNTIMESERVICE
+VOID
+PchResetVirtualddressChangeEvent (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ gRT->ConvertPointer (EFI_INTERNAL_POINTER, (VOID *) &mPchReset);
+}
diff --git a/ReferenceCode/ME/SampleCode/PlatformReset/RuntimeDxe/PlatformReset.cif b/ReferenceCode/ME/SampleCode/PlatformReset/RuntimeDxe/PlatformReset.cif
new file mode 100644
index 0000000..6403a09
--- /dev/null
+++ b/ReferenceCode/ME/SampleCode/PlatformReset/RuntimeDxe/PlatformReset.cif
@@ -0,0 +1,12 @@
+<component>
+ name = "PlatformReset"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\SampleCode\PlatformReset\RuntimeDxe"
+ RefName = "PlatformReset"
+[files]
+"PlatformReset.sdl"
+"PlatformReset.mak"
+"PlatformReset.h"
+"PlatformReset.c"
+"PlatformReset.dxs"
+<endComponent>
diff --git a/ReferenceCode/ME/SampleCode/PlatformReset/RuntimeDxe/PlatformReset.dxs b/ReferenceCode/ME/SampleCode/PlatformReset/RuntimeDxe/PlatformReset.dxs
new file mode 100644
index 0000000..62919fa
--- /dev/null
+++ b/ReferenceCode/ME/SampleCode/PlatformReset/RuntimeDxe/PlatformReset.dxs
@@ -0,0 +1,41 @@
+/** @file
+ Dependency expression source file.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "DxeDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+#include EFI_PROTOCOL_DEFINITION (PchReset)
+#endif
+
+DEPENDENCY_START
+ PCH_RESET_PROTOCOL_GUID
+DEPENDENCY_END
+
diff --git a/ReferenceCode/ME/SampleCode/PlatformReset/RuntimeDxe/PlatformReset.h b/ReferenceCode/ME/SampleCode/PlatformReset/RuntimeDxe/PlatformReset.h
new file mode 100644
index 0000000..9847b5e
--- /dev/null
+++ b/ReferenceCode/ME/SampleCode/PlatformReset/RuntimeDxe/PlatformReset.h
@@ -0,0 +1,29 @@
+/** @file
+ Definitions for PlatformReset driver
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PLATFORM_RESET_H_
+#define _PLATFORM_RESET_H_
+
+#include "EdkIIGlueDxe.h"
+#include EFI_PROTOCOL_CONSUMER (PchReset)
+#include EFI_PROTOCOL_CONSUMER (MePlatformGetResetType)
+#include EFI_ARCH_PROTOCOL_DEFINITION (Reset)
+
+#endif // _PLATFORM_RESET_H_
diff --git a/ReferenceCode/ME/SampleCode/PlatformReset/RuntimeDxe/PlatformReset.mak b/ReferenceCode/ME/SampleCode/PlatformReset/RuntimeDxe/PlatformReset.mak
new file mode 100644
index 0000000..7ad1b51
--- /dev/null
+++ b/ReferenceCode/ME/SampleCode/PlatformReset/RuntimeDxe/PlatformReset.mak
@@ -0,0 +1,67 @@
+#---------------------------------------------------------------------------
+# Create PlatformReset Driver
+#---------------------------------------------------------------------------
+
+All : PlatformReset
+
+PlatformReset : $(BUILD_DIR)\PlatformReset.mak PlatformResetBin
+
+$(BUILD_DIR)\PlatformReset.mak : $(PlatformReset_DIR)\$(@B).cif $(PlatformReset_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(PlatformReset_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+PlatformReset_INCLUDES=\
+ $(ME_INCLUDES) \
+ /I$(ME_DIR)\SampleCode \
+ $(INTEL_PCH_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+
+PlatformReset_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=InitializePlatformReset"\
+ /D"__EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT_HANDLER__=PchResetVirtualddressChangeEvent"\
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_BASE_LIB__ \
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__\
+
+PlatformReset_LIBS=\
+ $(MeLibDxe_LIB)\
+ $(MeSampleCodeProtocolLib_LIB)\
+ $(INTEL_PCH_PROTOCOL_LIB)\
+ $(EDKPROTOCOLLIB)\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(IntelMpgProtocolLib_LIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueDxeServicesTableLib_LIB)\
+ $(EdkIIGlueEdkDxeRuntimeDriverLib_LIB)\
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(MePlatformGetResetTypeProtocolLib_LIB)
+# $(EFIDRIVERLIB)\
+# $(EdkIIGlueUefiRuntimeServicesTableLib_LIB)\
+# $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+
+
+PlatformResetBin : $(PlatformReset_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\PlatformReset.mak all \
+ GUID=9A9A912B-5F53-4586-8820-704485A29D21\
+ "MY_INCLUDES=$(PlatformReset_INCLUDES)"\
+ "MY_DEFINES=$(PlatformReset_DEFINES)"\
+ ENTRY_POINT=_ModuleEntryPoint\
+ TYPE=RT_DRIVER\
+ EDKIIModule=DXEDRIVER\
+ DEPEX1=$(PlatformReset_DIR)\PlatformReset.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX\
+ COMPRESS=1
+
+
diff --git a/ReferenceCode/ME/SampleCode/PlatformReset/RuntimeDxe/PlatformReset.sdl b/ReferenceCode/ME/SampleCode/PlatformReset/RuntimeDxe/PlatformReset.sdl
new file mode 100644
index 0000000..97fc45e
--- /dev/null
+++ b/ReferenceCode/ME/SampleCode/PlatformReset/RuntimeDxe/PlatformReset.sdl
@@ -0,0 +1,26 @@
+TOKEN
+ Name = "PlatformReset_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable PlatformReset support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "PlatformReset_DIR"
+End
+
+MODULE
+ Help = "Includes PlatformReset.mak to Project"
+ File = "PlatformReset.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PlatformReset.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+
diff --git a/ReferenceCode/ME/SampleCode/Protocol/MePlatformGetResetType/MePlatformGetResetType.c b/ReferenceCode/ME/SampleCode/Protocol/MePlatformGetResetType/MePlatformGetResetType.c
new file mode 100644
index 0000000..43b748a
--- /dev/null
+++ b/ReferenceCode/ME/SampleCode/Protocol/MePlatformGetResetType/MePlatformGetResetType.c
@@ -0,0 +1,42 @@
+/** @file
+ This file defines the EFI ME Platform Get Reset Type Protocol
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+//
+// Statements that include other files
+//
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+//
+// Include the protocol header file
+//
+#include EFI_PROTOCOL_DEFINITION (MePlatformGetResetType)
+#endif
+//
+// Protocol GUID definition
+//
+EFI_GUID gMePlatformGetResetTypeGuid = ME_PLATFORM_GET_RESET_TYPE_GUID;
+
+//
+// Protocol description
+//
+EFI_GUID_STRING(&gMePlatformGetResetTypeGuid, "MePlatformGetResetType Protocol", "Intel(R) ME Platform Reset Protocol");
diff --git a/ReferenceCode/ME/SampleCode/Protocol/MePlatformGetResetType/MePlatformGetResetType.h b/ReferenceCode/ME/SampleCode/Protocol/MePlatformGetResetType/MePlatformGetResetType.h
new file mode 100644
index 0000000..5134b55
--- /dev/null
+++ b/ReferenceCode/ME/SampleCode/Protocol/MePlatformGetResetType/MePlatformGetResetType.h
@@ -0,0 +1,57 @@
+/** @file
+ Interface definition Me Platform Get Reset Type.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _ME_PLATFORM_GET_RESET_TYPE_H_
+#define _ME_PLATFORM_GET_RESET_TYPE_H_
+
+#define ME_PLATFORM_GET_RESET_TYPE_GUID \
+ { \
+ 0xb8cdced7, 0xbdc4, 0x4464, 0x9a, 0x1a, 0xff, 0x3f, 0xbd, 0xf7, 0x48, 0x69 \
+ }
+
+#define ME_PLATFORM_GET_RESET_TYPE_PROTOCOL_REVISION 1
+extern EFI_GUID gMePlatformGetResetTypeGuid;
+
+///
+/// ME_SPEICAL_RESET_TYPES must be aligned with PCH_EXTENDED_RESET_TYPES
+///
+typedef enum {
+ PowerCycleResetReq = 3,
+ GlobalResetReq,
+ GlobalResetWithEcReq,
+ MaxRestReq
+} ME_SPEICAL_RESET_TYPES;
+
+/**
+ Get Platform requested reset type
+
+ @param[in] Type UEFI defined reset type
+
+ @retval ME_SPEICAL_RESET_TYPES ME reset type aligned with PCH_EXTENDED_RESET_TYPES
+**/
+typedef
+ME_SPEICAL_RESET_TYPES
+(EFIAPI *GET_RESET_TYPE) (
+ IN EFI_RESET_TYPE Type
+ );
+
+typedef struct _ME_PLATFORM_GET_RESET_TYPE_PROTOCOL {
+ GET_RESET_TYPE GetResetType;
+} ME_PLATFORM_GET_RESET_TYPE_PROTOCOL;
+
+#endif
diff --git a/ReferenceCode/ME/SampleCode/Protocol/MePlatformGetResetType/MePlatformGetResetTypeProtocolLib.cif b/ReferenceCode/ME/SampleCode/Protocol/MePlatformGetResetType/MePlatformGetResetTypeProtocolLib.cif
new file mode 100644
index 0000000..2e4412e
--- /dev/null
+++ b/ReferenceCode/ME/SampleCode/Protocol/MePlatformGetResetType/MePlatformGetResetTypeProtocolLib.cif
@@ -0,0 +1,11 @@
+<component>
+ name = "MePlatformGetResetTypeProtocolLib"
+ category = ModulePart
+ LocalRoot = "\ReferenceCode\ME\SampleCode\Protocol\MePlatformGetResetType\"
+ RefName = "MePlatformGetResetTypeProtocolLib"
+[files]
+"MePlatformGetResetTypeProtocolLib.sdl"
+"MePlatformGetResetTypeProtocolLib.mak"
+"MePlatformGetResetType.h"
+"MePlatformGetResetType.c"
+<endComponent>
diff --git a/ReferenceCode/ME/SampleCode/Protocol/MePlatformGetResetType/MePlatformGetResetTypeProtocolLib.mak b/ReferenceCode/ME/SampleCode/Protocol/MePlatformGetResetType/MePlatformGetResetTypeProtocolLib.mak
new file mode 100644
index 0000000..504290e
--- /dev/null
+++ b/ReferenceCode/ME/SampleCode/Protocol/MePlatformGetResetType/MePlatformGetResetTypeProtocolLib.mak
@@ -0,0 +1,67 @@
+#**********************************************************************
+#**********************************************************************
+#** **
+#** (C)Copyright 1985-2010, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 6145-F Northbelt Pkwy, Norcross, GA 30071 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#**********************************************************************
+#**********************************************************************
+#**********************************************************************
+# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeSampleCode/MePlatformGetResetTypeProtocolLib/MePlatformGetResetTypeProtocolLib.mak 1 2/08/12 12:55a Klzhan $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 12:55a $
+#**********************************************************************
+# Revision History
+# ----------------
+#
+#**********************************************************************
+#<AMI_FHDR_START>
+#
+# Name: AmtWrapperProtocolLib.mak
+#
+# Description:
+#
+#<AMI_FHDR_END>
+#**********************************************************************
+all : MePlatformGetResetTypeProtocolLib
+
+$(BUILD_DIR)\MePlatformGetResetTypeProtocolLib.lib : MePlatformGetResetTypeProtocolLib
+
+MePlatformGetResetTypeProtocolLib : $(BUILD_DIR)\MePlatformGetResetTypeProtocolLib.mak MePlatformGetResetTypeProtocolLibBin
+
+$(BUILD_DIR)\MePlatformGetResetTypeProtocolLib.mak : $(MePlatformGetResetTypeProtocolLib_DIR)\$(@B).cif $(MePlatformGetResetTypeProtocolLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(MePlatformGetResetTypeProtocolLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+MePlatformGetResetTypeProtocolLib_INCLUDES=\
+ $(EDK_INCLUDES) \
+ $(EdkIIGlueLib_INCLUDES)\
+ $(ME_INCLUDES) \
+ $(MISCFRAMEWORK_INCLUDES) \
+ -I ReferenceCode\ME\SampleCode
+
+MePlatformGetResetTypeProtocolLibBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDK_DEFAULTS)\
+ /f $(BUILD_DIR)\MePlatformGetResetTypeProtocolLib.mak all\
+ "MY_INCLUDES=$(MePlatformGetResetTypeProtocolLib_INCLUDES)" \
+ TYPE=LIBRARY \
+
+#**********************************************************************
+#**********************************************************************
+#** **
+#** (C)Copyright 1985-2010, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 6145-F Northbelt Pkwy, Norcross, GA 30071 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#**********************************************************************
+#********************************************************************** \ No newline at end of file
diff --git a/ReferenceCode/ME/SampleCode/Protocol/MePlatformGetResetType/MePlatformGetResetTypeProtocolLib.sdl b/ReferenceCode/ME/SampleCode/Protocol/MePlatformGetResetType/MePlatformGetResetTypeProtocolLib.sdl
new file mode 100644
index 0000000..1c0cc7d
--- /dev/null
+++ b/ReferenceCode/ME/SampleCode/Protocol/MePlatformGetResetType/MePlatformGetResetTypeProtocolLib.sdl
@@ -0,0 +1,34 @@
+TOKEN
+ Name = "MePlatformGetResetTypeProtocolLib_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable AmtWrapperProtocolLib support in Project"
+ TokenType = Boolean
+ TargetMAK = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "MePlatformGetResetTypeProtocolLib_DIR"
+End
+
+ELINK
+ Name = "/I$(MePlatformGetResetTypeProtocolLib_DIR)"
+ Parent = "ME_INCLUDES"
+ InvokeOrder = AfterParent
+End
+
+MODULE
+ Help = "Includes AmtWrapperProtocolLib.mak to Project"
+ File = "MePlatformGetResetTypeProtocolLib.mak"
+End
+
+ELINK
+ Name = "MePlatformGetResetTypeProtocolLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\MePlatformGetResetTypeProtocolLib.lib"
+ Parent = "MePlatformGetResetTypeProtocolLib_LIB"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/ME/SampleCode/Protocol/SmmVariable/SmmVariable.h b/ReferenceCode/ME/SampleCode/Protocol/SmmVariable/SmmVariable.h
new file mode 100644
index 0000000..06c7762
--- /dev/null
+++ b/ReferenceCode/ME/SampleCode/Protocol/SmmVariable/SmmVariable.h
@@ -0,0 +1,52 @@
+/*++ @file
+ SMM Variable Protocol
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains 'Framework Code' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may not be modified, except as allowed by
+ additional terms of your license agreement.
+--*/
+
+#ifndef _SMM_VARIABLE_H_
+#define _SMM_VARIABLE_H_
+
+//
+// SmmVariable Protocol GUID value
+//
+// Note: The GUID value is the same as the protocol produced in EDKII.
+#define EFI_SMM_VARIABLE_PROTOCOL_GUID \
+ { \
+ 0xed32d533, 0x99e6, 0x4209, 0x9c, 0xc0, 0x2d, 0x72, 0xcd, 0xd9, 0x98, 0xa7 \
+ }
+
+EFI_FORWARD_DECLARATION (EFI_SMM_VARIABLE_PROTOCOL);
+
+typedef struct _EFI_SMM_VARIABLE_PROTOCOL EFI_SMM_VARIABLE_PROTOCOL;
+
+///
+/// EFI SMM Variable Protocol is intended for use as a means
+/// to store data in the EFI SMM environment.
+///
+struct _EFI_SMM_VARIABLE_PROTOCOL {
+ EFI_GET_VARIABLE SmmGetVariable;
+ EFI_GET_NEXT_VARIABLE_NAME SmmGetNextVariableName;
+ EFI_SET_VARIABLE SmmSetVariable;
+ EFI_QUERY_VARIABLE_INFO SmmQueryVariableInfo;
+};
+
+///
+/// SmmVariable Protocol GUID variable.
+///
+extern EFI_GUID gEfiSmmVariableProtocolGuid;
+
+#endif
diff --git a/ReferenceCode/Pfat/PfatBinary/PfatBinary.bin b/ReferenceCode/Pfat/PfatBinary/PfatBinary.bin
new file mode 100644
index 0000000..4070dc1
--- /dev/null
+++ b/ReferenceCode/Pfat/PfatBinary/PfatBinary.bin
Binary files differ
diff --git a/ReferenceCode/Pfat/PfatBinary/PfatBinary.cif b/ReferenceCode/Pfat/PfatBinary/PfatBinary.cif
new file mode 100644
index 0000000..49e59af
--- /dev/null
+++ b/ReferenceCode/Pfat/PfatBinary/PfatBinary.cif
@@ -0,0 +1,10 @@
+<component>
+ name = "PfatBinary"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Pfat\PfatBinary"
+ RefName = "PfatBinary"
+[files]
+"PfatBinary.sdl"
+"PfatBinary.mak"
+"PfatBinary.bin"
+<endComponent>
diff --git a/ReferenceCode/Pfat/PfatBinary/PfatBinary.mak b/ReferenceCode/Pfat/PfatBinary/PfatBinary.mak
new file mode 100644
index 0000000..62bc8c3
--- /dev/null
+++ b/ReferenceCode/Pfat/PfatBinary/PfatBinary.mak
@@ -0,0 +1,76 @@
+#**********************************************************************
+#**********************************************************************
+#** **
+#** (C)Copyright 1985-2012, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Pkwy, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#**********************************************************************
+#*************************************************************************
+# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/IntelPfat/PfatBinary/PfatBinary.mak 4 10/29/12 3:45p Fredericko $
+#
+# $Revision: 4 $
+#
+# $Date: 10/29/12 3:45p $
+#
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/IntelPfat/PfatBinary/PfatBinary.mak $
+#
+# 4 10/29/12 3:45p Fredericko
+# [TAG] EIP84115
+# [Category] Improvement
+# [Description] Implementing PFAT function for Shark Bay
+# define and use Pfat Binary macro
+# [Files] pfatBinary.mak
+# PfatBinary.sdl
+#
+# 3 9/25/12 6:15p Fredericko
+#
+# 2 9/17/12 4:25p Fredericko
+# Removed UnNeeded make definitions
+#
+#**********************************************************************
+#<AMI_FHDR_START>
+#
+# Name: PfatBinary.mak
+#
+# Description: Make file PfatBinary
+#
+#<AMI_FHDR_END>
+#**********************************************************************
+all: $(BUILD_DIR)\PfatBinary.ffs $(PfatBinary_DIR)\PfatBinary.mak
+
+$(BUILD_DIR)\PfatBinary.bin :
+ copy $(PfatBinary) $(BUILD_DIR)\PfatBinary.bin $(SILENT_OUT)
+
+$(BUILD_DIR)\PfatBinary.ffs : $(BUILD_DIR)\PfatBinary.bin
+ $(GENFFSFILE) -B $(BUILD_DIR) -V -o $@ -P1 <<$(BUILD_DIR)\PfatBinary.pkg
+PACKAGE.INF
+[.]
+BASE_NAME = DummyName
+FFS_FILEGUID = 7934156D-CFCE-460E-92F5-A07909A59ECA
+FFS_FILETYPE = EFI_FV_FILETYPE_RAW
+FFS_ATTRIB_CHECKSUM = FALSE
+FFS_ALIGNMENT = 5
+
+IMAGE_SCRIPT =
+{
+ $(PROJECT_DIR)\$(BUILD_DIR)\PfatBinary.bin
+}
+<<KEEP
+#-----------------------------------------------------------------------
+#**********************************************************************
+#** **
+#** (C)Copyright 1985-2010, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Pkwy, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#**********************************************************************
+#**********************************************************************
diff --git a/ReferenceCode/Pfat/PfatBinary/PfatBinary.sdl b/ReferenceCode/Pfat/PfatBinary/PfatBinary.sdl
new file mode 100644
index 0000000..046588d
--- /dev/null
+++ b/ReferenceCode/Pfat/PfatBinary/PfatBinary.sdl
@@ -0,0 +1,32 @@
+TOKEN
+ Name = "PfatBinary_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable PfatBinary support in Project"
+End
+
+PATH
+ Name = "PfatBinary_DIR"
+ Help = "PfatServices Driver files source directory"
+End
+
+MODULE
+ Help = "Includes PfatBinary.mak to Project"
+ File = "PfatBinary.mak"
+End
+
+TOKEN
+ Name = "PfatBinary"
+ Value = "$(PfatBinary_DIR)\PfatBinary.bin"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PfatBinary.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/Pfat/PfatFlashLib/PfatFlashLib.c b/ReferenceCode/Pfat/PfatFlashLib/PfatFlashLib.c
new file mode 100644
index 0000000..2d144d1
--- /dev/null
+++ b/ReferenceCode/Pfat/PfatFlashLib/PfatFlashLib.c
@@ -0,0 +1,710 @@
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2009, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//*************************************************************************
+//*************************************************************************
+
+//**********************************************************************
+// $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/IntelPfat/Pfatflashlib/PfatFlashLib.c 9 4/24/13 7:39p Fredericko $
+//
+// $Revision: 9 $
+//
+// $Date: 4/24/13 7:39p $
+//
+// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/IntelPfat/Pfatflashlib/PfatFlashLib.c $
+//
+// 9 4/24/13 7:39p Fredericko
+// [TAG] EIP120447
+// [Category] Improvement
+// [Description] SHB ULT: PFAT : Update with AFU Tools Fails SUT Locks
+// [Files] PfatFlashLib.c
+// PfatFlashLib.sdl
+//
+// 8 12/19/12 7:23p Fredericko
+// [TAG] EIP109350
+// [Category] Bug Fix
+// [Severity] Minor
+// [Solution] Building error when the token of BUILD_PEI_FLASH_LIB = 1
+// for PFAT module
+// [Files] PfatFlashLib.c
+// PfatFlashLib.mak
+//
+// 7 12/03/12 6:19p Fredericko
+// [TAG] EIP107344
+// [Category] Bug Fix
+// [Severity] Minor
+// [Symptom] Afulnx fails
+// [Solution] AFULNX2(Test BIOS to Test BIOS)_1AQPM016_Pretest
+// [Files] PfatFlashLib.c
+//
+// 6 11/08/12 3:23a Fredericko
+// Changes for flash write. Requires Pi 1.1 and above support
+//
+// 5 11/02/12 8:26p Fredericko
+// [TAG] EIP105153
+// [Description] Possible system hang if NVRAM is access during legacy
+// O.S.
+//
+// 4 10/16/12 6:45p Fredericko
+// [TAG] EIP103945
+// [Category] Bug Fix
+// [Severity] Normal
+// [Symptom] System hang
+// [RootCause] PfatInitialize check failure
+// [Solution] The system can't enter UEFI WIN8 OS when PFAT is Disabled
+// on seutp menu
+// [Files] PfatFlashLib.c
+//
+// 3 9/26/12 11:45a Fredericko
+// [TAG] EIP102376
+// [Description] Pfat CHM
+//
+// 2 9/17/12 4:27p Fredericko
+//
+// Initial Checkin
+//
+//
+//**********************************************************************
+//<AMI_FHDR_START>
+//
+// Name: PfatFlashLib.c
+//
+// Description: Code listing file for Pfat flashlib
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+
+//----------------------------------------------------------------------
+// Includes
+#include <efi.h>
+#include <FlashPart.h>
+#include "token.h"
+#if defined _DXE_FLASH_LIB_
+#include <AmiDxeLib.h>
+#include "Pfat\Pfat.h"
+#include <Protocol\SmmBase2.h>
+#include <Protocol\SmiFlash.h>
+#include <AmiCspLib.h>
+#include "ReferenceCode\Haswell\Include\CpuRegs.h"
+#ifndef BIT35
+#define BIT35 0x0000000800000000ULL
+#endif
+
+
+typedef BOOLEAN (IDENTIFY)(
+ volatile UINT8* pBlockAddress,
+ FLASH_PART **Struct
+ );
+
+extern UINT16 gFlashId;
+FLASH_PART *FlashInitialized = NULL;
+PFAT_PROTOCOL *PfatInstance = NULL;
+extern IDENTIFY* FlashList[];
+EFI_SMM_SYSTEM_TABLE2 *mSmst = NULL;
+EFI_SMM_BASE2_PROTOCOL *gSmmBase2 = NULL;
+BOOLEAN InSmm;
+EFI_EVENT SmmPfatAvailableEvent;
+EFI_EVENT SmmAvailableEvent;
+EFI_GUID gSmmPfatProtocolGuid = SMM_PFAT_PROTOCOL_GUID;
+
+VOID
+PfatFlashEraseCommand (
+ volatile UINT8 *pBlockAddress
+);
+
+
+VOID
+PfatProgramCommand (
+ volatile UINT8 *pByteAddress,
+ UINT8 *Byte,
+ UINT32 *Length
+);
+
+
+VOID
+PfatReadCommand (
+ volatile UINT8 *pByteAddress,
+ UINT8 *Byte,
+ UINT32 *Length
+);
+
+
+BOOLEAN
+PfatIsEraseCompleted (
+ IN volatile UINT8 *pBlockAddress,
+ OUT BOOLEAN *pError,
+ OUT UINTN *pStatus
+);
+
+
+BOOLEAN
+PfatProgramCompleted (
+ volatile UINT8 *pByteAddress,
+ UINT8 *Byte,
+ UINT32 Length,
+ BOOLEAN *pError,
+ UINTN *pStatus
+);
+
+
+VOID
+PfatBlockWriteEnable(
+ UINT8 *pBlockAddress
+);
+
+
+VOID
+PfatBlockWriteDisable (
+ UINT8 *pBlockAddress
+);
+
+
+VOID
+PfatDeviceWriteEnable (
+ VOID
+);
+
+
+VOID
+PfatDeviceWriteDisable (
+ VOID
+);
+
+
+VOID
+PfatDeviceVirtualFixup (
+ EFI_RUNTIME_SERVICES *pRS
+);
+
+
+#define SECTOR_SIZE_4KB 0x1000 // Common 4kBytes sector size
+
+FLASH_PART mPfatFlash =
+ {
+ PfatReadCommand,
+ PfatFlashEraseCommand,
+ PfatProgramCommand,
+ PfatIsEraseCompleted,
+ PfatProgramCompleted,
+ PfatBlockWriteEnable,
+ PfatBlockWriteDisable,
+ PfatDeviceWriteEnable,
+ PfatDeviceWriteDisable,
+ PfatDeviceVirtualFixup,
+ 1,
+ SECTOR_SIZE_4KB
+ };
+
+
+
+
+
+EFI_STATUS
+OnSmmPfatProtocolAvailable (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ EFI_STATUS Status;
+
+ if(gSmmBase2 == NULL){
+ Status = pBS->LocateProtocol( &gEfiSmmBase2ProtocolGuid, NULL, &gSmmBase2 );
+ }
+
+ if(gSmmBase2!= NULL){
+ if(mSmst == NULL){
+ Status = gSmmBase2->GetSmstLocation (gSmmBase2, &mSmst);
+ }
+ }
+
+ Status = gSmmBase2->InSmm(gSmmBase2, &InSmm);
+
+ Status = pBS->LocateProtocol (&gSmmPfatProtocolGuid,
+ NULL,
+ &PfatInstance);
+
+ pBS->CloseEvent (SmmPfatAvailableEvent);
+ return EFI_SUCCESS;
+}
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------
+// Procedure: IdentifyPfatFlash
+//
+// Description: Identifies whether PfatFlash library should control access to
+// SPI flash part
+//
+// Input: volatile UINT8 *pBlockAddress
+//
+// Output: FLASH_PART **FlashStruc
+//
+// Returns: BOOLEAN
+//
+//----------------------------------------------------------------------
+//<AMI_PHDR_END>
+BOOLEAN
+IdentifyPfatFlash (
+ IN volatile UINT8 *pBlockAddress,
+ OUT FLASH_PART **FlashStruc
+)
+{
+ UINTN i;
+ BOOLEAN found = FALSE;
+ EFI_STATUS Status;
+ VOID *Reg;
+
+ if ( !((ReadMsr (MSR_PLATFORM_INFO) & B_MSR_PLATFORM_INFO_PFAT_AVAIL) &&
+ (ReadMsr (MSR_PLAT_FRMW_PROT_CTRL) & B_MSR_PLAT_FRMW_PROT_CTRL_EN)) ) {
+ //
+ // Pfat disabled or not support
+ //
+ return FALSE;
+ }
+
+ if(FlashInitialized == NULL)
+ {
+ for(i=1; !found && FlashList[i]; i++)
+ {
+ found=FlashList[i](pBlockAddress, &FlashInitialized);
+ }
+ }
+
+ if(FlashInitialized == NULL)return FALSE;
+
+ if(found)
+ {
+ *FlashStruc = &mPfatFlash;
+
+ Status = pBS->CreateEvent (EFI_EVENT_NOTIFY_SIGNAL,
+ TPL_CALLBACK,
+ OnSmmPfatProtocolAvailable,
+ NULL,
+ &SmmPfatAvailableEvent);
+
+ if(!EFI_ERROR(Status)){
+ Status = pBS->RegisterProtocolNotify (
+ &gSmmPfatProtocolGuid,
+ SmmPfatAvailableEvent,
+ &Reg);
+ }
+ }
+
+
+ return found;
+}
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------
+// Procedure: IsPfatFlashInitialized
+//
+// Description: Verifies whether Pfat library has been initialized or not
+//
+// Input: VOID
+//
+// Output: VOID
+//
+// Returns: BOOLEAN
+//
+//----------------------------------------------------------------------
+//<AMI_PHDR_END>
+BOOLEAN
+IsPfatFlashInitialized()
+{
+ EFI_STATUS Status;
+
+ if((PfatInstance == NULL) && (pST->BootServices != NULL)){
+ if(InSmm == FALSE)
+ {
+ if(gSmmBase2 == NULL){
+ Status = pBS->LocateProtocol( &gEfiSmmBase2ProtocolGuid, NULL, &gSmmBase2 );
+ }
+
+ if(gSmmBase2!= NULL){
+ if(mSmst == NULL){
+ Status = gSmmBase2->GetSmstLocation (gSmmBase2, &mSmst);
+ }
+ Status = gSmmBase2->InSmm(gSmmBase2, &InSmm);
+ }
+
+ Status = pBS->LocateProtocol (&gSmmPfatProtocolGuid,
+ NULL,
+ &PfatInstance);
+
+ }
+
+ }
+
+ if( PfatInstance != NULL ){ return TRUE; }
+ PfatInstance = NULL;
+ return FALSE;
+}
+
+
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------
+// Procedure: PfatFlashEraseCommand
+//
+// Description: Erases SPI via PFAT library
+//
+// Input: IN volatile UINT8* pBlockAddress
+//
+// Output: VOID
+//
+// Returns: VOID
+//
+//----------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID
+PfatFlashEraseCommand (
+ IN volatile UINT8* pBlockAddress
+)
+{
+ if(IsPfatFlashInitialized()){
+ PfatInstance->Erase(PfatInstance,
+ (UINTN)(EFI_PHYSICAL_ADDRESS)pBlockAddress);
+ }else{
+ if ( FlashInitialized == NULL)return;
+ FlashInitialized->FlashEraseCommand(pBlockAddress);
+ }
+}
+
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------
+// Procedure: PfatIsEraseCompleted
+//
+// Description: Checks whether PFAT erase command was completed
+//
+// Input: volatile UINT8 *pBlockAddress
+//
+// Output: BOOLEAN *pError
+// UINTN *pStatus
+//
+// Returns: BOOLEAN
+//
+//----------------------------------------------------------------------
+//<AMI_PHDR_END>
+BOOLEAN
+PfatIsEraseCompleted (
+ IN volatile UINT8 *pBlockAddress,
+ OUT BOOLEAN *pError,
+ OUT UINTN *pStatus
+)
+{
+ if(IsPfatFlashInitialized()){
+ *pError = FALSE;
+ *pStatus = EFI_SUCCESS;
+ }else{
+ if ( FlashInitialized == NULL)return FALSE;
+ return (FlashInitialized->FlashIsEraseCompleted(pBlockAddress,\
+ pError, pStatus));
+ }
+
+ return TRUE;
+}
+
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------
+// Procedure: PfatFlashProgramCommand
+//
+// Description: Programs SPI part via PFAT library
+//
+// Input: volatile UINT8* pByteAddress
+// UINT8 *Byte
+// UINT32 *Length
+//
+// Output: VOID
+//
+// Return: VOID
+//----------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID
+PfatProgramCommand (
+ IN volatile UINT8* pByteAddress,
+ IN UINT8 *Byte,
+ IN UINT32 *Length
+)
+{
+ if(IsPfatFlashInitialized()){
+ PfatInstance->Write(PfatInstance,
+ (UINTN)pByteAddress,
+ *Length, Byte);
+ if(((*(UINT8 *)(UINTN)0xFED1F890) & BIT4))
+ {
+ (*(UINT16 *)(UINTN)0xFED1F804)|= BIT2;
+ }
+ PfatInstance->Execute(PfatInstance, FALSE);
+ *Length = 0;
+
+ }else{
+ if ( FlashInitialized == NULL)return;
+ FlashInitialized->FlashProgramCommand(pByteAddress, Byte, Length);
+ }
+}
+
+
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------
+// Procedure: PfatReadCommand
+//
+// Description: Reads the SPI flash part via PFAT library
+//
+//
+// Input: *pBlockAddress - Address to access flash part
+// *Byte - pointer to data to write to the flash part
+// Length - The total amount of data that Byte points to
+//
+// Output: VOID
+//
+// Return: VOID
+//----------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID
+PfatReadCommand (
+ volatile UINT8 *pByteAddress,
+ UINT8 *Byte,
+ UINT32 *Length
+)
+{
+ if ( FlashInitialized == NULL)return;
+ FlashInitialized->FlashReadCommand(pByteAddress, Byte, Length);
+}
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------
+// Procedure: PfatProgramCompleted
+//
+// Description: Checks whether Pfat Flash program was completed
+//
+//
+// Input: *pBlockAddress - Address to access flash part
+// *Byte - values previously written to the Flash Device
+// Length - The amount of data that needs to be checked
+// *pError - Boolean that tells if fatal error occured
+// *pStatus - Status of the erase command
+//
+// Output: *pError - Boolean that tells if fatal error occured
+// *pStatus - Status of the erase command
+//
+// Return: TRUE - Program completed, check pError for fatal error
+// FALSE - programming in progress
+//
+//----------------------------------------------------------------------
+//<AMI_PHDR_END>
+BOOLEAN
+PfatProgramCompleted (
+ IN volatile UINT8* pByteAddress,
+ IN UINT8 *Byte,
+ IN UINT32 Length,
+ OUT BOOLEAN *pError,
+ OUT UINTN *pStatus
+)
+{
+ if (pError) *pError = FALSE;
+ return TRUE;
+}
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------
+// Procedure: PfatBlockWriteEnable
+//
+// Description: This function chooses the correct flash part to call and
+// then enables write operations(erase/programming) for a specific block
+//
+// Input: *pBlockAddress - Address to access flash part
+//
+// Output: VOID
+//
+// Return: VOID
+//
+//----------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID
+PfatBlockWriteEnable(
+ UINT8 *pBlockAddress
+)
+{
+ if (IsPfatFlashInitialized())return;
+ if ( FlashInitialized == NULL)return;
+ FlashInitialized->FlashBlockWriteEnable(pBlockAddress);
+}
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------
+// Procedure: PfatBlockWriteDisable
+//
+// Description: This function chooses the correct flash part to call and
+// then disables write operations(erase/programming) for a specific
+// block
+//
+// Input: *pBlockAddress - Address to access flash part
+//
+// Output: VOID
+//
+// Return: VOID
+//
+//----------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID
+PfatBlockWriteDisable (
+ IN UINT8 *pBlockAddress
+)
+{
+ if (IsPfatFlashInitialized())return;
+ if ( FlashInitialized == NULL)return;
+ FlashInitialized->FlashBlockWriteDisable(pBlockAddress);
+}
+
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------
+// Procedure: PfatDeviceWriteEnable
+//
+// Description: This function chooses the correct flash part to call and
+// then enables write operation for a flash device
+//
+// Input: VOID
+//
+// Output: VOID
+//
+// Return: VOID
+//
+//----------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID
+PfatDeviceWriteEnable (VOID)
+{
+ if (IsPfatFlashInitialized())return;
+ if ( FlashInitialized == NULL)return;
+ FlashInitialized->FlashDeviceWriteEnable();
+}
+
+
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------
+// Procedure: PfatDeviceWriteDisable
+//
+// Description: This function chooses the correct flash part to call and
+// then disables write operation for a flash device
+//
+// Input: VOID
+//
+// Output: VOID
+//
+// Return: VOID
+//
+//----------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID
+PfatDeviceWriteDisable(VOID)
+{
+ if (IsPfatFlashInitialized())return;
+ if ( FlashInitialized == NULL)return;
+ FlashInitialized->FlashDeviceWriteDisable();
+}
+
+
+
+//<AMI_PHDR_START>
+//----------------------------------------------------------------------
+// Procedure: PfatDeviceVirtualFixup
+//
+// Description: Fixup global data for for a virtual address space.
+// This routine must be called by the library consumer in the
+// EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event handler
+//
+// Input: EFI_RUNTIME_SERVICES *pRS - pointer to the Runtime Services Table
+//
+// Output: VOID
+//
+// Return: VOID
+//
+//----------------------------------------------------------------------
+//<AMI_PHDR_END>
+VOID
+PfatDeviceVirtualFixup (
+ IN EFI_RUNTIME_SERVICES *pRS
+)
+{
+ VOID **p;
+
+ if (IsPfatFlashInitialized()){
+ return;
+ }
+
+ if ( FlashInitialized == NULL)return;
+
+ FlashInitialized->FlashVirtualFixup(pRS);
+
+ for(p = (VOID**)FlashInitialized; p < (VOID**)(FlashInitialized + 1); p++)
+ pRS->ConvertPointer(0, p);
+
+ //Fixup FlashAPI pointer
+ pRS->ConvertPointer(0, &FlashInitialized);
+}
+
+#else
+
+BOOLEAN
+IdentifyPfatFlash (
+ IN volatile UINT8 *pBlockAddress,
+ OUT FLASH_PART **FlashStruc
+)
+{
+ return FALSE;
+}
+
+#endif
+
+VOID
+PreventAFUWhenPfatEnable (
+ IN UINT8 SwSmiNum,
+ IN OUT UINT64 Buffer
+)
+{
+ if (SwSmiNum != 0x25) return;
+ if ( ((ReadMsr (MSR_PLATFORM_INFO) & B_MSR_PLATFORM_INFO_PFAT_AVAIL) &&
+ (ReadMsr (MSR_PLAT_FRMW_PROT_CTRL) & B_MSR_PLAT_FRMW_PROT_CTRL_EN)) ) {
+ //
+ // Update Implemented to TRUE, AFU will assume the SMIFlash is no support.
+ //
+ ((INFO_BLOCK*)Buffer)->Implemented = TRUE;
+ }
+}
+
+//*************************************************************************
+//*************************************************************************
+//** **
+//** (C)Copyright 1985-2012, 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/ReferenceCode/Pfat/PfatFlashLib/PfatFlashLib.cif b/ReferenceCode/Pfat/PfatFlashLib/PfatFlashLib.cif
new file mode 100644
index 0000000..bf680e6
--- /dev/null
+++ b/ReferenceCode/Pfat/PfatFlashLib/PfatFlashLib.cif
@@ -0,0 +1,12 @@
+<component>
+ name = "PfatFlashLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Pfat\PfatFlashLib"
+ RefName = "PfatFlashLib"
+[files]
+"PfatFlashLib.sdl"
+"PfatFlashLib.mak"
+"PfatFlashLib.c"
+[parts]
+"HandlePfatLegacy"
+<endComponent>
diff --git a/ReferenceCode/Pfat/PfatFlashLib/PfatFlashLib.mak b/ReferenceCode/Pfat/PfatFlashLib/PfatFlashLib.mak
new file mode 100644
index 0000000..43154fd
--- /dev/null
+++ b/ReferenceCode/Pfat/PfatFlashLib/PfatFlashLib.mak
@@ -0,0 +1,86 @@
+#**********************************************************************
+#**********************************************************************
+#** **
+#** (C)Copyright 1985-2012, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Pkwy, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#**********************************************************************
+#**********************************************************************
+# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/IntelPfat/Pfatflashlib/PfatFlashLib.mak 3 12/19/12 7:22p Fredericko $
+#
+# $Revision: 3 $
+#
+# $Date: 12/19/12 7:22p $
+#
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/IntelPfat/Pfatflashlib/PfatFlashLib.mak $
+#
+# 3 12/19/12 7:22p Fredericko
+# [TAG] EIP109350
+# [Category] Bug Fix
+# [Solution] Building error when the token of BUILD_PEI_FLASH_LIB = 1
+# for PFAT module
+# [Files] PfatFlashLib.c
+# PfatFlashLib.mak
+#
+# 2 9/17/12 4:27p Fredericko
+#
+#**********************************************************************
+#<AMI_FHDR_START>
+#
+# Name: PfatFlashLib.mak
+#
+# Description: Make file for PfatFlashLib
+#
+#<AMI_FHDR_END>
+#**********************************************************************
+all : PfatFlashLib
+
+PfatFlashLib : $(BUILD_DIR)\PfatFlashLib.mak PfatFlashLibBin
+
+#---------------------------------------------------------------------------
+#
+#---------------------------------------------------------------------------
+$(BUILD_DIR)\PfatFlashLib.mak : $(PfatFlashLib_DIR)\$(@B).cif $(PfatFlashLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(PfatFlashLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+#---------------------------------------------------------------------------
+#
+#---------------------------------------------------------------------------
+PFAT_CFLAGS = $(CFLAGS:/W4=/W3) \
+ /I$(CpuProtocolLib_DIR) \
+
+PfatFlashLibBin :
+ @set INCLUDE=%%INCLUDE%%
+ $(MAKE) /$(MAKEFLAGS) $(BUILD_DEFAULTS)\
+ /f $(BUILD_DIR)\PfatFlashLib.mak all\
+ "CFLAGS=$(PFAT_CFLAGS) /D_DXE_FLASH_LIB_" \
+ NAME=PfatFlashLib \
+ TYPE=LIBRARY LIBRARY_NAME=$(PFATFLASHLIB)
+!IF "$(x64_BUILD)"=="1" && "$(BUILD_PEI_FLASH_LIB)"=="1"
+ $(MAKE) /$(MAKEFLAGS) BUILD_ROOT=$(BUILD_DIR)\
+ "EXT_OBJS=$(**:Build\=Build\IA32\)" PROJECT_DIR=$(PROJECT_DIR)\
+ /f $(BUILD_DIR)\PfatFlashLib.mak all\
+ "CFLAGS=$(PFAT_CFLAGS)"\
+ BUILD_DIR=$(BUILD_DIR)\IA32\
+ TYPE=PEI_LIBRARY NAME=PfatFlashLib
+!ENDIF
+
+$(PFATFLASHLIB) : PfatFlashLib
+#-----------------------------------------------------------------------
+#**********************************************************************
+#** **
+#** (C)Copyright 1985-2012, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Pkwy, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#**********************************************************************
+#**********************************************************************
diff --git a/ReferenceCode/Pfat/PfatFlashLib/PfatFlashLib.sdl b/ReferenceCode/Pfat/PfatFlashLib/PfatFlashLib.sdl
new file mode 100644
index 0000000..546f37d
--- /dev/null
+++ b/ReferenceCode/Pfat/PfatFlashLib/PfatFlashLib.sdl
@@ -0,0 +1,95 @@
+#**********************************************************************
+#**********************************************************************
+#** **
+#** (C)Copyright 1985-2012, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Pkwy, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#**********************************************************************
+#**********************************************************************
+# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/IntelPfat/Pfatflashlib/PfatFlashLib.sdl 3 4/24/13 7:41p Fredericko $
+#
+# $Revision: 3 $
+#
+# $Date: 4/24/13 7:41p $
+#
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/IntelPfat/Pfatflashlib/PfatFlashLib.sdl $
+#
+# 3 4/24/13 7:41p Fredericko
+# [TAG] EIP120447
+# [Category] Improvement
+# [Description] SHB ULT: PFAT : Update with AFU Tools Fails SUT Locks
+# [Files] PfatFlashLib.c
+# PfatFlashLib.sdl
+#
+# 2 9/17/12 4:26p Fredericko
+#
+#**********************************************************************
+#<AMI_FHDR_START>
+#
+# Name: PfatFlashLib.sdl
+#
+# Description: SDL file for PfatFlashLib
+#
+#<AMI_FHDR_END>
+#**********************************************************************
+
+PATH
+ Name = "PfatFlashLib_DIR"
+ Help = "PfatFlashLib files source directory"
+End
+
+TOKEN
+ Name = "PFATFLASHLIB"
+ Value = "$(BUILD_DIR)\PfatFlashLib.lib"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+ELINK
+ Name = "IdentifyPfatFlash ,"
+ Parent = "FlashList"
+ Token = "PfatServices_SUPPORT" "=" "1"
+ Priority = 60
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "PreventAFUWhenPfatEnable,"
+ Parent = "SMIFlashEndHandlerList"
+ InvokeOrder = AfterParent
+End
+
+MODULE
+ Help = "Includes PfatFlashLib.mak to Project"
+ File = "PfatFlashLib.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PfatFlashLib.lib"
+ Parent = "$(PfatFlashLib_DIR)\PfatFlashLib.lib"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(PfatFlashLib_DIR)\PfatFlashLib.lib"
+ Parent = "FLASHLISTLIB"
+ InvokeOrder = AfterParent
+End
+
+#**********************************************************************
+#**********************************************************************
+#** **
+#** (C)Copyright 1985-2012, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Pkwy, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#********************************************************************** \ No newline at end of file
diff --git a/ReferenceCode/Pfat/Smm/Pfat.chm b/ReferenceCode/Pfat/Smm/Pfat.chm
new file mode 100644
index 0000000..856ed5a
--- /dev/null
+++ b/ReferenceCode/Pfat/Smm/Pfat.chm
Binary files differ
diff --git a/ReferenceCode/Pfat/Smm/PfatServices.c b/ReferenceCode/Pfat/Smm/PfatServices.c
new file mode 100644
index 0000000..bbd1979
--- /dev/null
+++ b/ReferenceCode/Pfat/Smm/PfatServices.c
@@ -0,0 +1,759 @@
+/**
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+/**
+
+Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+@file:
+
+ PfatServices.c
+
+@brief:
+
+ PFAT Driver implements the PFAT Host Controller Compatibility Interface.
+
+**/
+
+///
+/// External include files do NOT need to be explicitly specified in real EDKII
+/// environment
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "CpuAccess.h"
+#include "PfatServices.h"
+#include "SmmIoLib.h"
+#endif
+
+#include <Token.h>
+///
+/// Global variables
+///
+EFI_SMM_SYSTEM_TABLE *mSmst;
+PFAT_PROTOCOL *mPfatProtocol;
+PFAT_HOB *mPfatHobPtr;
+EFI_SMM_IO_TRAP_DISPATCH_PROTOCOL *mPchIoTrap;
+
+VOID
+PfatUpdateBios (
+ IN EFI_HANDLE DispatchHandle,
+ IN EFI_SMM_IO_TRAP_DISPATCH_CALLBACK_CONTEXT *CallbackContext
+ )
+/**
+
+@brief
+
+ This function is triggered by the BIOS update tool with an IO trap. It executres
+ Pfat protocol execute with the true flag indicating that there is an update package
+ in the DPR region of memory.
+
+ @param[in] DispatchHandle Not used
+ @param[in] CallbackContext Not used
+
+**/
+{
+ ///
+ /// Invoke PFAT Services for updating BIOS
+ ///
+ mPfatProtocol->Execute(mPfatProtocol, TRUE);
+ CopyMem (mPfatUpdatePackagePtr, &mPfatFullStatus, sizeof (UINT64));
+
+ return;
+}
+
+VOID
+PfatToolsInterfaceInit (
+ IN EFI_HANDLE DispatchHandle,
+ IN EFI_SMM_IO_TRAP_DISPATCH_CALLBACK_CONTEXT *CallbackContext
+ )
+/**
+
+@brief
+
+ This method registers and sets up the IOTRAP and NVS area for the PFAT tools interface
+
+ @param[in] DispatchHandle Not used
+ @param[in] CallbackContext Not used
+
+
+**/
+{
+ EFI_STATUS Status;
+ EFI_GUID EfiGlobalNvsAreaProtocolGuid = EFI_GLOBAL_NVS_AREA_PROTOCOL_GUID;
+ EFI_GLOBAL_NVS_AREA_PROTOCOL *GlobalNvsAreaProtocol;
+ EFI_GLOBAL_NVS_AREA *GlobalNvsArea;
+ EFI_HANDLE PchIoTrapHandle;
+ EFI_SMM_IO_TRAP_DISPATCH_REGISTER_CONTEXT PchIoTrapContext;
+
+ ///
+ /// Locate Global NVS and update PFAT DPR size & Memory address for ACPI tables
+ ///
+ Status = gBS->LocateProtocol (&EfiGlobalNvsAreaProtocolGuid, NULL, &GlobalNvsAreaProtocol);
+ ASSERT_EFI_ERROR (Status);
+ GlobalNvsArea = GlobalNvsAreaProtocol->Area;
+ GlobalNvsArea->PfatMemAddress = 0;
+ GlobalNvsArea->PfatMemSize = 0;
+ GlobalNvsArea->PfatIoTrapAddress = 0;
+ ///
+ /// Locate PFAT SMM Protocol
+ ///
+ Status = gBS->LocateProtocol (&gSmmPfatProtocolGuid, NULL, &mPfatProtocol);
+ ASSERT_EFI_ERROR (Status);
+ if(mPfatProtocol != NULL)
+ {
+ ///
+ /// Register PFAT IO TRAP handler
+ ///
+ PchIoTrapContext.Type = WriteTrap;
+ PchIoTrapContext.Length = 4;
+ PchIoTrapContext.Address = 0;
+ PchIoTrapContext.Context = NULL;
+ PchIoTrapContext.MergeDisable = FALSE;
+ Status = mPchIoTrap->Register (
+ mPchIoTrap,
+ PfatUpdateBios,
+ &PchIoTrapContext,
+ &PchIoTrapHandle
+ );
+ ASSERT_EFI_ERROR (Status);
+ ///
+ /// Initialize ASL manipulation library
+ ///
+ InitializeAslUpdateLib ();
+ Status = UpdateAslCode (
+ (EFI_SIGNATURE_32 ('I', 'O', '_', 'P')),
+ PchIoTrapContext.Address,
+ (UINT8) PchIoTrapContext.Length
+ );
+ ASSERT_EFI_ERROR (Status);
+ GlobalNvsArea->PfatMemAddress = mPfatMemAddress;
+ GlobalNvsArea->PfatMemSize = (UINT8) RShiftU64(mPfatMemSize, 20);
+ GlobalNvsArea->PfatIoTrapAddress = PchIoTrapContext.Address;
+ }
+}
+
+
+
+
+EFI_STATUS
+EFIAPI
+InstallPfatProtocol (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+/**
+
+@brief
+
+ Entry point for the PFAT protocol driver.
+
+ @param[in] ImageHandle Image handle of this driver.
+ @param[in] SystemTable Global system service table.
+
+ @retval EFI_SUCCESS Initialization complete.
+ @retval EFI_OUT_OF_RESOURCES Do not have enough resources to initialize the driver.
+ @retval EFI_ERROR Driver exits abnormally.
+
+**/
+{
+ EFI_STATUS Status;
+ EFI_SMM_BASE_PROTOCOL *SmmBase;
+ PFAT_INSTANCE *PfatInstance;
+ VOID *PfatProtocolAddr;
+ EFI_HANDLE PchIoTrapHandle;
+ EFI_SMM_IO_TRAP_DISPATCH_REGISTER_CONTEXT PchIoTrapContext;
+ EFI_GUID EfiSmmIoTrapDispatchProtocolGuid = EFI_SMM_IO_TRAP_DISPATCH_PROTOCOL_GUID;
+#if defined (Pfat_Enable_Pei) && (Pfat_Enable_Pei==0)
+ EFI_GUID PfatHobGuid = PFAT_HOB_GUID;
+ PFAT_HOB *PfatModuleCheck;
+ UINT8 Data8And = 0;
+ UINT8 Data8Or = 0;
+#endif
+
+ ///
+ /// Locate SMM Base Protocol
+ ///
+ Status = gBS->LocateProtocol (&gEfiSmmBaseProtocolGuid, NULL, &SmmBase);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Initialize our module variables
+ ///
+ Status = SmmBase->GetSmstLocation (SmmBase, &mSmst);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Allocate pool for PFAT protocol instance
+ ///
+ Status = mSmst->SmmAllocatePool (
+ EfiRuntimeServicesData,
+ sizeof (PFAT_INSTANCE),
+ &PfatInstance
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_INFO, "PFAT SmmAllocatePool failed\n"));
+ return Status;
+ }
+
+ if (PfatInstance == NULL) {
+ DEBUG ((EFI_D_INFO, "PfatInstance = NULL returning\n"));
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+#if defined (Pfat_Enable_Pei) && (Pfat_Enable_Pei==0)
+ //pfat hob is created when pfat is enabled (pfatinit.c)
+ //verify presence of pfat hob
+
+ PfatModuleCheck = GetFirstGuidHob (&PfatHobGuid);
+
+ if (PfatModuleCheck != NULL) {
+ Data8And = 0xFF;
+ Data8Or = (UINT8) (B_PCH_LPC_BIOS_CNTL_SMM_BWP + B_PCH_LPC_BIOS_CNTL_BLE);
+
+ MmioAndThenOr8 (
+ MmPciAddress (0,
+ 0,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_BIOS_CNTL),
+ Data8And,
+ Data8Or);
+ }
+
+#endif
+
+ ZeroMem ((VOID *) PfatInstance, sizeof (PFAT_INSTANCE));
+ PfatInstance->Handle = NULL;
+ PfatProtocolAddr = NULL;
+
+ if ((AsmReadMsr64 (MSR_PLATFORM_INFO)) & B_MSR_PLATFORM_INFO_PFAT_AVAIL) {
+ if ((AsmReadMsr64 (MSR_PLAT_FRMW_PROT_CTRL)) & B_MSR_PLAT_FRMW_PROT_CTRL_EN) {
+ ///
+ /// Initialize the PFAT protocol instance
+ ///
+ Status = PfatProtocolConstructor (PfatInstance);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "Error from Pfat Protocol Constructor\n"));
+ return Status;
+ }
+ PfatProtocolAddr = &(PfatInstance->PfatProtocol);
+ Status = gBS->LocateProtocol (&EfiSmmIoTrapDispatchProtocolGuid, NULL, &mPchIoTrap);
+ ASSERT_EFI_ERROR (Status);
+
+ PchIoTrapContext.Type = ReadTrap;
+ PchIoTrapContext.Length = 4;
+ PchIoTrapContext.Address = 0;
+ PchIoTrapContext.Context = NULL;
+ PchIoTrapContext.MergeDisable = FALSE;
+ Status = mPchIoTrap->Register (
+ mPchIoTrap,
+ PfatToolsInterfaceInit,
+ &PchIoTrapContext,
+ &PchIoTrapHandle
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ mPfatHobPtr->PfatToolsIntIoTrapAdd = PchIoTrapContext.Address;
+ } else {
+ DEBUG ((EFI_D_INFO, "PFAT Feature supported but disabled\n"));
+ }
+ } else {
+ DEBUG ((EFI_D_WARN, "PFAT Feature is not supported\n"));
+ }
+
+ ///
+ /// Install the SMM PFAT_PROTOCOL interface
+ ///
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &(PfatInstance->Handle),
+ &gSmmPfatProtocolGuid,
+ PfatProtocolAddr,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ mSmst->SmmFreePool (PfatInstance);
+ DEBUG ((EFI_D_ERROR, "Failure Installing PFAT protocol\n"));
+ }
+
+ DEBUG ((EFI_D_ERROR, "PFAT protocol Installed\n"));
+ return Status;
+}
+
+
+
+
+EFI_STATUS
+PfatProtocolConstructor (
+ PFAT_INSTANCE *PfatInstance
+ )
+/**
+
+@brief
+
+ Initialize PFAT protocol instance.
+
+ @param[in] PfatInstance Pointer to PfatInstance to initialize
+
+ @retval EFI_SUCCESS The protocol instance was properly initialized
+ @retval EFI_NOT_FOUND PFAT Binary module was not found.
+
+**/
+{
+ EFI_STATUS Status;
+ PPDT *Ppdt;
+ UINTN i;
+ UINTN NumHandles;
+ EFI_HANDLE *Buffer;
+ UINTN Size;
+ UINT32 FvStatus;
+ EFI_FV_FILETYPE FileType;
+ EFI_FIRMWARE_VOLUME_PROTOCOL *FwVol;
+ EFI_FV_FILE_ATTRIBUTES Attributes;
+ UINTN NumPages;
+ EFI_PHYSICAL_ADDRESS Addr;
+ EFI_PHYSICAL_ADDRESS PfatModule;
+ SA_DATA_HOB *SaDataHobPtr;
+ EFI_GUID PfatModuleGuid = PFAT_MODULE_GUID;
+ EFI_GUID PfatHobGuid = PFAT_HOB_GUID;
+ EFI_GUID SaDataHobGuid = SA_DATA_HOB_GUID;
+
+ FwVol = NULL;
+ Size = 0;
+ FvStatus = 0;
+ NumPages = 0;
+ Addr = 0;
+
+ IoWrite8(0x80, 0xAA);
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiFirmwareVolumeProtocolGuid,
+ NULL,
+ &NumHandles,
+ &Buffer
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ for (i = 0; i < NumHandles; i++) {
+ Status = gBS->HandleProtocol (
+ Buffer[i],
+ &gEfiFirmwareVolumeProtocolGuid,
+ &FwVol
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Locate PFAT Binary.
+ ///
+ Status = FwVol->ReadFile (
+ FwVol,
+ &PfatModuleGuid,
+ NULL,
+ &Size,
+ &FileType,
+ &Attributes,
+ &FvStatus
+ );
+ if (Status == EFI_SUCCESS) {
+ break;
+ }
+ }
+
+ FreePool (Buffer);
+ ASSERT (Size);
+ if ((FwVol == NULL) || (Size == 0)) {
+ return EFI_NOT_FOUND;
+ }
+ NumPages = PFAT_MEMORY_PAGES + ALIGNMENT_IN_PAGES;
+
+ ///
+ /// Allocate memory buffer for PFAT Module
+ ///
+ Status = (mSmst->SmmAllocatePages) (AllocateAnyPages, EfiRuntimeServicesData, NumPages, &Addr);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Align address to 256K.
+ ///
+ PfatModule = Addr &~(ALIGN_256KB - 1);
+ PfatModule = PfatModule < Addr ? (PfatModule + ALIGN_256KB) : PfatModule;
+
+ ///
+ /// Read PFAT Module into prepared buffer.
+ ///
+ Status = FwVol->ReadFile (
+ FwVol,
+ &PfatModuleGuid,
+ &((VOID *) PfatModule),
+ &Size,
+ &FileType,
+ &Attributes,
+ &FvStatus
+ );
+ ASSERT (Size);
+ if ((FwVol == NULL) || (Size == 0)) {
+ return EFI_NOT_FOUND;
+ }
+
+ mPfatHobPtr = GetFirstGuidHob (&PfatHobGuid);
+ if (mPfatHobPtr == NULL) {
+ DEBUG ((EFI_D_ERROR, "PFAT HOB not available\n"));
+ return EFI_NOT_FOUND;
+ }
+
+ SaDataHobPtr = GetFirstGuidHob (&SaDataHobGuid);
+ if (SaDataHobPtr == NULL) {
+ DEBUG ((EFI_D_ERROR, "SA Data HOB not available\n"));
+ return EFI_NOT_FOUND;
+ }
+
+ ///
+ /// Allocate pool for PPDT Data
+ ///
+ Status = mSmst->SmmAllocatePool (
+ EfiRuntimeServicesData,
+ mPfatHobPtr->Ppdt.PpdtSize,
+ &Ppdt
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ CopyMem (Ppdt, &mPfatHobPtr->Ppdt, mPfatHobPtr->Ppdt.PpdtSize);
+
+ mPfatMemAddress = SaDataHobPtr->DprDirectory[EnumDprDirectoryPfat].PhysBase;
+ mPfatMemSize = (UINT32) LShiftU64(SaDataHobPtr->DprDirectory[EnumDprDirectoryPfat].Size, 20);
+ mPfatUpdatePackagePtr = (PUP *) mPfatMemAddress;
+ mPupCertificate = (EFI_PHYSICAL_ADDRESS) (mPfatMemAddress + mPfatMemSize - PUPC_MEMORY_OFFSET);
+ mPfatLogPtr = (PFAT_LOG *) (mPfatMemAddress + mPfatMemSize - PFAT_LOG_MEMORY_OFFSET);
+
+ CopyMem (&mPfatLogTemp, &mPfatHobPtr->PfatLog, sizeof (PFAT_LOG));
+ CopyMem (&mPfatUpdatePackagePtr->PupHeader, &mPfatHobPtr->PupHeader, sizeof (PUP_HEADER));
+ ZeroMem (mPfatUpdatePackagePtr->PupBuffer, PUP_BUFFER_SIZE);
+ mPfatUpdatePackagePtr->PupHeader.ScriptSectionSize = 0;
+ mPfatUpdatePackagePtr->PupHeader.DataSectionSize = 0;
+ mPfatUpdateCounter = 0;
+
+ ///
+ /// Set Begin command
+ ///
+ mPfatUpdatePackagePtr->PupBuffer[mPfatUpdateCounter++] = PFAT_COMMAND_BEGIN;
+
+ ///
+ /// Initialize the PFAT protocol instance
+ ///
+ PfatInstance->Signature = PFAT_SIGNATURE;
+ PfatInstance->PfatProtocol.Write = PfatProtocolWrite;
+ PfatInstance->PfatProtocol.Erase = PfatProtocolBlockErase;
+ PfatInstance->PfatProtocol.Execute = PfatProtocolExecute;
+ PfatInstance->AddrMask = 0;
+ for (i = 0; i < mPfatHobPtr->NumSpiComponents; i++) {
+ PfatInstance->AddrMask += (SPI_SIZE_BASE_512KB << mPfatHobPtr->ComponentSize[i]);
+ }
+ PfatInstance->AddrMask -= 1;
+
+ PfatInstance->PfatDirectory[EnumPfatModule] = PfatModule;
+ PfatInstance->PfatDirectory[EnumPfatModule] |= LShiftU64 (PFAT_DIRECTORY_PFAT_MODULE_ENTRY, 56);
+ PfatInstance->PfatDirectory[EnumPpdt] = (EFI_PHYSICAL_ADDRESS) Ppdt;
+ PfatInstance->PfatDirectory[EnumPpdt] |= LShiftU64 (PFAT_DIRECTORY_PPDT_ENTRY, 56);
+ PfatInstance->PfatDirectory[EnumPup] = (EFI_PHYSICAL_ADDRESS) mPfatUpdatePackagePtr;
+ PfatInstance->PfatDirectory[EnumPup] |= LShiftU64(PFAT_DIRECTORY_PUP_ENTRY, 56);
+ PfatInstance->PfatDirectory[EnumPupCertificate] = 0;
+ PfatInstance->PfatDirectory[EnumPupCertificate] |= LShiftU64(PFAT_DIRECTORY_UNDEFINED_ENTRY, 56);
+ PfatInstance->PfatDirectory[EnumPfatLog] = 0;
+ PfatInstance->PfatDirectory[EnumPfatLog] |= LShiftU64(PFAT_DIRECTORY_UNDEFINED_ENTRY, 56);
+ PfatInstance->PfatDirectory[EnumPfatDirectoryEnd] = 0;
+ PfatInstance->PfatDirectory[EnumPfatDirectoryEnd] |= LShiftU64 (PFAT_DIRECTORY_END_MARKER, 56);
+
+ return EFI_SUCCESS;
+}
+
+VOID
+PfatModuleExecute (
+ IN PFAT_INSTANCE *PfatInstance
+ )
+/**
+
+@brief
+
+ Set MSR 0x115 with PFAT DIRECTORY Address.
+ Trigger MSR 0x116 to invoke PFAT Binary.
+ Read MSR 0x115 to get PFAT Binary Status.
+
+ @param[in] PfatInstance Pointer to PfatInstance to initialize
+
+**/
+{
+ AsmWriteMsr64 (MSR_PLAT_FRMW_PROT_TRIG_PARAM, (UINT64) PfatInstance->PfatDirectory);
+ AsmWriteMsr64 (MSR_PLAT_FRMW_PROT_TRIGGER, 0);
+ ///
+ /// Read MSR_PLAT_FRMW_PROT_TRIG_PARAM to get PFAT Binary status
+ ///
+ PfatInstance->MsrValue = AsmReadMsr64 (MSR_PLAT_FRMW_PROT_TRIG_PARAM);
+ return ;
+}
+
+EFI_STATUS
+EFIAPI
+PfatProtocolExecute (
+ IN PFAT_PROTOCOL *This,
+ IN BOOLEAN BiosUpdate
+ )
+/**
+
+@brief
+
+ Set PFAT DIRECTORY Address and triggers MSR to pass control to PFAT Binary module to execute command script.
+ This function would be called by runtime driver, please do not use any MMIO macro here
+
+ @param[in] This Pointer to the PFAT_PROTOCOL instance.
+ @param[in] BiosUpdate Flag to indicate flash update is requested by the Tool
+
+ @retval EFI_SUCCESS Command succeed.
+ @retval EFI_INVALID_PARAMETER The parameters specified are not valid.
+ @retval EFI_UNSUPPORTED The CPU or SPI memory is not supported.
+ @retval EFI_DEVICE_ERROR Device error, command aborts abnormally.
+
+**/
+{
+ EFI_STATUS Status;
+ PFAT_INSTANCE *PfatInstance;
+ UINT16 PfatStatus;
+ UINT16 PfatAdditionalData;
+ UINT16 PfatTerminalLine;
+ UINT8 PfatSE;
+ UINTN Index;
+ UINT8 RetryIteration;
+ UINTN i=0;
+
+ PfatInstance = PFAT_INSTANCE_FROM_PFATPROTOCOL (This);
+
+ ///
+ /// If Update Package has been created during runtime then complete the script
+ /// and create update Pkg
+ ///
+ if (BiosUpdate == FALSE) {
+ ///
+ /// End command
+ ///
+ mPfatUpdatePackagePtr->PupBuffer[mPfatUpdateCounter++] = PFAT_COMMAND_END;
+ mPfatUpdatePackagePtr->PupHeader.ScriptSectionSize = (mPfatUpdateCounter * 8);
+ CopyMem (
+ &mPfatUpdatePackagePtr->PupBuffer[mPfatUpdateCounter],
+ &mPfatUpdateData,
+ (mPfatUpdatePackagePtr->PupHeader.DataSectionSize)
+ );
+ PfatInstance->PfatDirectory[EnumPfatLog] = (EFI_PHYSICAL_ADDRESS) mPfatLogPtr;
+ PfatInstance->PfatDirectory[EnumPfatLog] |= LShiftU64(PFAT_DIRECTORY_PFAT_LOG_ENTRY, 56);
+
+ } else {
+ CopyMem (mPfatLogPtr, &mPfatLogTemp, sizeof (PFAT_LOG));
+ if (mPfatUpdatePackagePtr->PupHeader.PkgAttributes) {
+ PfatInstance->PfatDirectory[EnumPupCertificate] = mPupCertificate;
+ PfatInstance->PfatDirectory[EnumPupCertificate] |= LShiftU64(PFAT_DIRECTORY_PUP_CERTIFICATE_ENTRY, 56);
+ PfatInstance->PfatDirectory[EnumPfatLog] = (EFI_PHYSICAL_ADDRESS) mPfatLogPtr;
+ PfatInstance->PfatDirectory[EnumPfatLog] |= LShiftU64(PFAT_DIRECTORY_PFAT_LOG_ENTRY, 56);
+ } else {
+ PfatInstance->PfatDirectory[EnumPupCertificate] = 0;
+ PfatInstance->PfatDirectory[EnumPupCertificate] |= LShiftU64(PFAT_DIRECTORY_UNDEFINED_ENTRY, 56);
+ PfatInstance->PfatDirectory[EnumPfatLog] = (EFI_PHYSICAL_ADDRESS) mPfatLogPtr;
+ PfatInstance->PfatDirectory[EnumPfatLog] |= LShiftU64(PFAT_DIRECTORY_PFAT_LOG_ENTRY, 56);
+ }
+ }
+
+ PfatInstance->MsrValue = ERR_LAUNCH_FAIL;
+
+ for (Index = 1; Index < mSmst->NumberOfCpus; Index++) {
+ Status = EFI_NOT_READY;
+ for (RetryIteration = 0; (RetryIteration < PFAT_AP_SAFE_RETRY_LIMIT) && (Status != EFI_SUCCESS); RetryIteration++) {
+
+ Status = mSmst->SmmStartupThisAp (PfatModuleExecute, Index, PfatInstance);
+
+ if (Status != EFI_SUCCESS) {
+ ///
+ /// SmmStartupThisAp might return failure if AP is busy executing some other code. Let's wait for sometime and try again.
+ ///
+ PchPmTimerStall (PFAT_WAIT_PERIOD);
+ }
+ }
+ }
+
+ PfatModuleExecute (PfatInstance);
+
+ if (BiosUpdate == FALSE) {
+ PfatStatus = (UINT16) RShiftU64 (
+ (PfatInstance->MsrValue & LShiftU64 (V_MSR_PLAT_FRMW_PROT_TRIG_PARAM_STATUS_MASK,
+ N_MSR_PLAT_FRMW_PROT_TRIG_PARAM_STATUS_OFFSET)),
+ N_MSR_PLAT_FRMW_PROT_TRIG_PARAM_STATUS_OFFSET
+ );
+ switch (PfatStatus) {
+ case ERR_OK:
+ Status = EFI_SUCCESS;
+ break;
+
+ case ERR_RANGE_VIOLATION:
+ case ERR_SFAM_VIOLATION:
+ case ERR_EXEC_LIMIT:
+ case ERR_INTERNAL_ERROR:
+ Status = EFI_DEVICE_ERROR;
+ break;
+
+ case ERR_UNSUPPORTED_CPU:
+ case ERR_UNDEFINED_FLASH_OBJECT:
+ case ERR_LAUNCH_FAIL:
+ Status = EFI_UNSUPPORTED;
+ break;
+
+ default:
+
+ case ERR_BAD_DIRECTORY:
+ case ERR_BAD_PPDT:
+ case ERR_BAD_PUP:
+ case ERR_SCRIPT_SYNTAX:
+ case ERR_INVALID_LINE:
+ case ERR_BAD_PUPC:
+ case ERR_BAD_SVN:
+ case ERR_UNEXPECTED_OPCODE:
+ case ERR_OVERFLOW:
+ Status = EFI_INVALID_PARAMETER;
+ break;
+ }
+
+ if (EFI_ERROR (Status)) {
+ PfatAdditionalData = (UINT16) RShiftU64 (
+ (PfatInstance->MsrValue & LShiftU64 (V_MSR_PLAT_FRMW_PROT_TRIG_PARAM_DATA_MASK,
+ N_MSR_PLAT_FRMW_PROT_TRIG_PARAM_DATA_OFFSET)),
+ N_MSR_PLAT_FRMW_PROT_TRIG_PARAM_DATA_OFFSET
+ );
+ PfatTerminalLine = (UINT16) RShiftU64 (
+ (PfatInstance->MsrValue & LShiftU64 (V_MSR_PLAT_FRMW_PROT_TRIG_PARAM_TERMINAL_MASK,
+ N_MSR_PLAT_FRMW_PROT_TRIG_PARAM_TERMINAL_OFFSET)),
+ N_MSR_PLAT_FRMW_PROT_TRIG_PARAM_TERMINAL_OFFSET
+ );
+ PfatSE = (UINT8) RShiftU64 (
+ (PfatInstance->MsrValue & B_MSR_PLAT_FRMW_PROT_TRIG_PARAM_SE),
+ N_MSR_PLAT_FRMW_PROT_TRIG_PARAM_SE_OFFSET
+ );
+ DEBUG ((EFI_D_ERROR, "PFAT Status = 0x%X\n", PfatStatus));
+ DEBUG ((EFI_D_ERROR, "PFAT Additional Data = 0x%X\n", PfatAdditionalData));
+ DEBUG ((EFI_D_ERROR, "PFAT Terminal Line = 0x%X\n", PfatTerminalLine));
+ DEBUG ((EFI_D_ERROR, "PFAT SE = 0x%X\n", PfatSE));
+ }
+
+ ZeroMem (mPfatUpdatePackagePtr->PupBuffer, PUP_BUFFER_SIZE);
+ mPfatUpdatePackagePtr->PupHeader.ScriptSectionSize = 0;
+ mPfatUpdatePackagePtr->PupHeader.DataSectionSize = 0;
+ mPfatUpdateCounter = 0;
+
+ ///
+ /// Begin command
+ ///
+ mPfatUpdatePackagePtr->PupBuffer[mPfatUpdateCounter++] = PFAT_COMMAND_BEGIN;
+ } else {
+ IoWrite16(0x80, (UINT16)(PfatInstance->MsrValue >> 16));
+ mPfatFullStatus = PfatInstance->MsrValue;
+ Status = EFI_SUCCESS;
+ }
+
+ return Status;
+}
+
+
+VOID
+EFIAPI
+PfatProtocolWrite (
+ IN PFAT_PROTOCOL *This,
+ IN UINTN Address,
+ IN UINT32 DataByteCount,
+ IN OUT UINT8 *Buffer
+ )
+/**
+
+@brief
+
+ Fill up Write script data into the PFAT Script buffer.
+ This function would be called by runtime driver, please do not use any MMIO macro here
+
+ @param[in] This Pointer to the PFAT_PROTOCOL instance.
+ @param[in] Address This value specifies the offset from the start of the SPI Flash component where
+ BIOS Image is located.
+ @param[in] DataByteCount Number of bytes in the data portion.
+ @param[in] Buffer Pointer to caller-allocated buffer containing the data to be sent.
+
+
+**/
+{
+ PFAT_INSTANCE *PfatInstance;
+
+ PfatInstance = PFAT_INSTANCE_FROM_PFATPROTOCOL (This);
+
+ ///
+ /// Set Buffer Offset Index immediate command
+ ///
+ mPfatUpdatePackagePtr->PupBuffer[mPfatUpdateCounter++] =
+ (LShiftU64 ((UINTN) mPfatUpdatePackagePtr->PupHeader.DataSectionSize, 32)) |
+ (LShiftU64 (PFAT_B0_INDEX, 16)) |
+ PFAT_COMMAND_SET_BUFFER_INDEX;
+ ///
+ /// Set Flash Index immediate command
+ ///
+ mPfatUpdatePackagePtr->PupBuffer[mPfatUpdateCounter++] = (LShiftU64 ((Address & PfatInstance->AddrMask), 32)) | (LShiftU64 (PFAT_F0_INDEX, 16)) | PFAT_COMMAND_SET_FLASH_INDEX;
+ ///
+ /// Write to Flash Index from Buffer Offset Index with specific Size command
+ ///
+ mPfatUpdatePackagePtr->PupBuffer[mPfatUpdateCounter++] = (LShiftU64 (DataByteCount, 32)) | (LShiftU64 (PFAT_B0_INDEX, 24)) | (LShiftU64 (PFAT_F0_INDEX, 16)) | PFAT_COMMAND_WRITE_IMM;
+
+ CopyMem (&mPfatUpdateData[mPfatUpdatePackagePtr->PupHeader.DataSectionSize], Buffer, DataByteCount);
+
+ mPfatUpdatePackagePtr->PupHeader.DataSectionSize += DataByteCount;
+
+ return ;
+}
+
+VOID
+EFIAPI
+PfatProtocolBlockErase (
+ IN PFAT_PROTOCOL *This,
+ IN UINTN Address
+ )
+/**
+
+@brief
+
+ Fill up Erase script data into the PFAT Script buffer.
+ This function would be called by runtime driver, please do not use any MMIO macro here
+
+ @param[in] This Pointer to the PFAT_PROTOCOL instance.
+ @param[in] Address This value specifies the offset from the start of the SPI Flash component where
+ BIOS Image is located.
+
+**/
+{
+ PFAT_INSTANCE *PfatInstance;
+
+ PfatInstance = PFAT_INSTANCE_FROM_PFATPROTOCOL (This);
+
+ ///
+ /// Set Flash Index immediate command
+ ///
+ mPfatUpdatePackagePtr->PupBuffer[mPfatUpdateCounter++] = (LShiftU64 ((Address & PfatInstance->AddrMask), 32)) | (LShiftU64 (PFAT_F0_INDEX, 16)) | PFAT_COMMAND_SET_FLASH_INDEX;
+ ///
+ /// Erase Flash Index command
+ ///
+ mPfatUpdatePackagePtr->PupBuffer[mPfatUpdateCounter++] = (LShiftU64 (PFAT_F0_INDEX, 16)) | PFAT_COMMAND_ERASE_BLK;
+
+ mPfatUpdatePackagePtr->PupHeader.DataSectionSize += 0;
+
+ return ;
+}
diff --git a/ReferenceCode/Pfat/Smm/PfatServices.cif b/ReferenceCode/Pfat/Smm/PfatServices.cif
new file mode 100644
index 0000000..eb0b6b8
--- /dev/null
+++ b/ReferenceCode/Pfat/Smm/PfatServices.cif
@@ -0,0 +1,22 @@
+<component>
+ name = "Intel PFAT Technology"
+ category = eModule
+ LocalRoot = "ReferenceCode\Pfat\Smm"
+ RefName = "PfatServices"
+ Rank = 40
+[files]
+"PfatServices.sdl"
+"PfatServices.mak"
+"PfatServices.h"
+"PfatServices.dxs"
+"PfatServices.c"
+"PfatServices.inf"
+"Pfat.chm"
+[parts]
+"PfatBinary"
+"PfatFlashLib"
+"PfatPubKeysAndBuildPSL"
+"PfatCpuPolicyOverride"
+"PfatSetup"
+"PfatRecovery"
+<endComponent>
diff --git a/ReferenceCode/Pfat/Smm/PfatServices.dxs b/ReferenceCode/Pfat/Smm/PfatServices.dxs
new file mode 100644
index 0000000..940f140
--- /dev/null
+++ b/ReferenceCode/Pfat/Smm/PfatServices.dxs
@@ -0,0 +1,60 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+/*++
+
+Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ PfatServices.dxs
+
+Abstract:
+
+ Dependency expression source file.
+
+--*/
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "DxeDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+#endif
+#if (PI_SPECIFICATION_VERSION < 0x00010000)
+#include EFI_PROTOCOL_DEFINITION (FirmwareVolume)
+#else
+#include EFI_PROTOCOL_DEFINITION (FirmwareVolume2)
+#endif
+
+#include EFI_PROTOCOL_DEFINITION (SmmBase)
+#include EFI_PROTOCOL_DEPENDENCY (SmmIoTrapDispatch)
+
+DEPENDENCY_START
+ EFI_SMM_BASE_PROTOCOL_GUID AND
+#if (PI_SPECIFICATION_VERSION < 0x00010000)
+ EFI_FIRMWARE_VOLUME_PROTOCOL_GUID AND
+#else
+ EFI_FIRMWARE_VOLUME2_PROTOCOL_GUID AND
+#endif
+ EFI_SMM_IO_TRAP_DISPATCH_PROTOCOL_GUID
+DEPENDENCY_END
diff --git a/ReferenceCode/Pfat/Smm/PfatServices.h b/ReferenceCode/Pfat/Smm/PfatServices.h
new file mode 100644
index 0000000..3812201
--- /dev/null
+++ b/ReferenceCode/Pfat/Smm/PfatServices.h
@@ -0,0 +1,207 @@
+/**
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+/**
+
+Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+@file:
+
+ PfatServices.h
+
+@brief:
+
+ Header file for the PCH PFAT Driver.
+
+**/
+#ifndef _PFAT_SERVICES_H_
+#define _PFAT_SERVICES_H_
+
+#include "PfatDefinitions.h"
+#include "PchAccess.h"
+#include "PchPlatformLib.h"
+#include "AslUpdateLib.h"
+
+///
+/// Driver Dependency Protocols
+///
+#include EFI_PROTOCOL_PRODUCER (Pfat)
+#include EFI_PROTOCOL_DEPENDENCY (SmmBase)
+#include EFI_PROTOCOL_DEPENDENCY (FirmwareVolume)
+#include EFI_PROTOCOL_DEPENDENCY (SmmIoTrapDispatch)
+#include EFI_GUID_DEFINITION (SaDataHob)
+#include EFI_PROTOCOL_DEPENDENCY (GlobalNvsArea)
+
+UINT8 mPfatUpdateData[PUP_BUFFER_SIZE];
+static UINT16 mPfatUpdateCounter;
+PUP *mPfatUpdatePackagePtr;
+EFI_PHYSICAL_ADDRESS mPupCertificate;
+PFAT_LOG *mPfatLogPtr;
+PFAT_LOG mPfatLogTemp;
+EFI_PHYSICAL_ADDRESS mPfatMemAddress;
+UINT32 mPfatMemSize;
+UINT64 mPfatFullStatus;
+
+///
+/// Private data structure definitions for the driver
+///
+#define PFAT_SIGNATURE EFI_SIGNATURE_32 ('P', 'F', 'A', 'T')
+
+#define PFAT_DIRECTORY_MAX_SIZE 6
+#define PFAT_DIRECTORY_PFAT_MODULE_ENTRY 0x00
+#define PFAT_DIRECTORY_PPDT_ENTRY 0x01
+#define PFAT_DIRECTORY_PUP_ENTRY 0x02
+#define PFAT_DIRECTORY_PUP_CERTIFICATE_ENTRY 0x03
+#define PFAT_DIRECTORY_PFAT_LOG_ENTRY 0x04
+#define PFAT_DIRECTORY_UNDEFINED_ENTRY 0xFE
+#define PFAT_DIRECTORY_END_MARKER 0xFF
+
+typedef enum {
+ EnumPfatModule = 0,
+ EnumPpdt,
+ EnumPup,
+ EnumPupCertificate,
+ EnumPfatLog,
+ EnumPfatDirectoryEnd
+} PFAT_DIRECTORY;
+
+typedef struct {
+ UINTN Signature;
+ EFI_HANDLE Handle;
+ PFAT_PROTOCOL PfatProtocol;
+ EFI_PHYSICAL_ADDRESS PfatDirectory[PFAT_DIRECTORY_MAX_SIZE];
+ UINT32 AddrMask;
+ UINT64 MsrValue;
+} PFAT_INSTANCE;
+
+#define PFAT_INSTANCE_FROM_PFATPROTOCOL(a) CR (a, PFAT_INSTANCE, PfatProtocol, PFAT_SIGNATURE)
+
+///
+/// Stall period in microseconds
+///
+#define PFAT_WAIT_PERIOD 0
+#define PFAT_AP_SAFE_RETRY_LIMIT 1
+
+///
+/// Function prototypes used by the PFAT protocol.
+///
+EFI_STATUS
+PfatProtocolConstructor (
+ PFAT_INSTANCE *PfatInstance
+ )
+/**
+
+@brief
+
+ Initialize PFAT protocol instance.
+
+ @param[in] PfatInstance Pointer to PfatInstance to initialize
+
+ @retval EFI_SUCCESS The protocol instance was properly initialized
+
+**/
+;
+
+VOID
+EFIAPI
+PfatModuleExecute (
+ IN PFAT_INSTANCE *PfatInstance
+ )
+/**
+
+@brief
+
+ Set MSR 0x115 with PFAT DIRECTORY Address.
+ Trigger MSR 0x116 to invoke PFAT Binary.
+ Read MSR 0x115 to get PFAT Binary Status.
+
+ @param[in] PfatInstance Pointer to PfatInstance to initialize
+
+
+**/
+;
+
+EFI_STATUS
+EFIAPI
+PfatProtocolExecute (
+ IN PFAT_PROTOCOL *This,
+ IN BOOLEAN BiosUpdate
+ )
+/**
+
+@brief
+
+ Set PFAT DIRECTORY Address and triggers MSR to pass control to PFAT Binary module to execute command script.
+ This function would be called by runtime driver, please do not use any MMIO macro here
+
+ @param[in] This Pointer to the PFAT_PROTOCOL instance.
+ @param[in] BiosUpdate Flag to indicate flash update is requested by the Tool
+
+ @retval EFI_SUCCESS Command succeed.
+ @retval EFI_INVALID_PARAMETER The parameters specified are not valid.
+ @retval EFI_UNSUPPORTED The CPU or SPI memory is not supported.
+ @retval EFI_DEVICE_ERROR Device error, command aborts abnormally.
+
+**/
+;
+
+VOID
+EFIAPI
+PfatProtocolWrite (
+ IN PFAT_PROTOCOL *This,
+ IN UINTN Address,
+ IN UINT32 DataByteCount,
+ IN OUT UINT8 *Buffer
+ )
+/**
+
+@brief
+
+ Fill up Write script data into the PFAT Script buffer.
+ This function would be called by runtime driver, please do not use any MMIO macro here
+
+ @param[in] This Pointer to the PFAT_PROTOCOL instance.
+ @param[in] Address This value specifies the offset from the start of the SPI Flash component where
+ BIOS Image is located.
+ @param[in] DataByteCount Number of bytes in the data portion.
+ @param[in] Buffer Pointer to caller-allocated buffer containing the data to be sent.
+
+
+**/
+;
+
+VOID
+EFIAPI
+PfatProtocolBlockErase (
+ IN PFAT_PROTOCOL *This,
+ IN UINTN Address
+ )
+/**
+
+@brief
+
+ Fill up Erase script data into the PFAT Script buffer.
+ This function would be called by runtime driver, please do not use any MMIO macro here
+
+ @param[in] This Pointer to the PFAT_PROTOCOL instance.
+ @param[in] Address This value specifies the offset from the start of the SPI Flash component where
+ BIOS Image is located.
+ @param[in] DataByteCount Number of bytes in the data portion.
+
+
+**/
+;
+
+#endif
diff --git a/ReferenceCode/Pfat/Smm/PfatServices.inf b/ReferenceCode/Pfat/Smm/PfatServices.inf
new file mode 100644
index 0000000..8df4bd0
--- /dev/null
+++ b/ReferenceCode/Pfat/Smm/PfatServices.inf
@@ -0,0 +1,115 @@
+#
+# This file contains an 'Intel Peripheral Driver' and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+#/*++
+#
+# Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# Module Name:
+#
+# PfatServices.inf
+#
+# Abstract:
+#
+# Component description file for PFAT module
+#
+#--*/
+
+[defines]
+BASE_NAME = PfatServices
+FILE_GUID = 6D4BAA0B-F431-4370-AF19-99D6209239F6
+COMPONENT_TYPE = BS_DRIVER
+
+[sources.common]
+ PfatServices.c
+ PfatServices.h
+
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueSmmDriverEntryPoint.c
+
+[includes.common]
+ $(EDK_SOURCE)\Foundation\Efi
+ $(EDK_SOURCE)\Foundation
+ $(EDK_SOURCE)\Foundation\Framework
+ $(EDK_SOURCE)\Foundation\Include
+ $(EDK_SOURCE)\Foundation\Efi\Include
+ $(EDK_SOURCE)\Foundation\Framework\Include
+ $(EDK_SOURCE)\Foundation\Include\IndustryStandard
+ $(EDK_SOURCE)\Foundation\Core\Dxe
+ $(EDK_SOURCE)\Foundation\Core\Dxe\Include
+ $(EDK_SOURCE)\Foundation\Library\Dxe\Include
+ $(EDK_SOURCE)\Foundation\Include\Pei
+ $(EDK_SOURCE)\Foundation\Library\Pei\Include
+ $(EDK_SOURCE)\Foundation\Cpu\Pentium\Include
+ $(EFI_SOURCE)\$(PROJECT_CPU_ROOT)
+ $(EFI_SOURCE)\$(PROJECT_CPU_ROOT)\Include
+ $(EFI_SOURCE)\$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)\$(PROJECT_PCH_ROOT)\Include
+ $(EFI_SOURCE)\$(PROJECT_PCH_ROOT)\Include\Library
+ $(EFI_SOURCE)\$(PROJECT_SA_ROOT)
+
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)\Framework
+ $(EDK_SOURCE)\Foundation
+ $(EDK_SOURCE)\Foundation\Framework
+ $(EDK_SOURCE)\Foundation\Include\IndustryStandard
+ $(EDK_SOURCE)\Foundation\Core\Dxe
+ $(EDK_SOURCE)\Foundation\Include\Pei
+ $(EDK_SOURCE)\Foundation\Library\Dxe\Include
+ $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\Include
+ $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\Include\Library
+ $(EFI_SOURCE)\$(PROJECT_CPU_ROOT)\Samplecode
+ $(EFI_SOURCE)\$(PROJECT_CPU_ROOT)\Samplecode\Include
+
+[libraries.common]
+ EdkProtocolLib
+ EdkFrameworkProtocolLib
+ EdkIIGlueBaseLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueBaseMemoryLib
+ EdkIIGlueSmmRuntimeDxeReportStatusCodeLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueDxeMemoryAllocationLib
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueUefiDevicePathLib
+ EdkIIGlueBasePciLibPciExpress
+ EdkIIGlueDxeHobLib
+ CpuProtocolLib
+ PchPlatformLib
+ DxeAslUpdateLib
+ SmmIoLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = PfatServices.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) /D __EDKII_GLUE_MODULE_ENTRY_POINT__=InstallPfatProtocol
+ C_FLAGS = $(C_FLAGS) /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ /D __EDKII_GLUE_SMM_RUNTIME_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_UEFI_DEVICE_PATH_LIB__ \
+ /D __EDKII_GLUE_DXE_HOB_LIB__ \
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__
diff --git a/ReferenceCode/Pfat/Smm/PfatServices.mak b/ReferenceCode/Pfat/Smm/PfatServices.mak
new file mode 100644
index 0000000..2bf9576
--- /dev/null
+++ b/ReferenceCode/Pfat/Smm/PfatServices.mak
@@ -0,0 +1,127 @@
+#**********************************************************************
+#**********************************************************************
+#** **
+#** (C)Copyright 1985-2012, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Pkwy, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#**********************************************************************
+#*************************************************************************
+# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/IntelPfat/PfatServices.mak 3 9/25/12 6:14p Fredericko $
+#
+# $Revision: 3 $
+#
+# $Date: 9/25/12 6:14p $
+#
+# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/IntelPfat/PfatServices.mak $
+#
+# 3 9/25/12 6:14p Fredericko
+#
+# 2 9/17/12 4:19p Fredericko
+#
+#**********************************************************************
+#<AMI_FHDR_START>
+#
+# Name: PfatService.mak
+#
+# Description: Make file for PfatServices component
+#
+#<AMI_FHDR_END>
+#**********************************************************************
+# MAK file for the eModule:PowerManagement
+
+EDK : PfatServices
+
+BUILD_PfatServices_DIR = $(BUILD_DIR)\$(PfatServices_DIR)
+
+$(BUILD_DIR)\PfatServices.mak : $(PfatServices_DIR)\PfatServices.cif $(BUILD_RULES)
+ $(CIF2MAK) $(PfatServices_DIR)\PfatServices.cif $(CIF2MAK_DEFAULTS)
+
+PfatServices : $(BUILD_DIR)\PfatServices.MAK PfatServicesBin
+
+PfatServices_OBJECTS = \
+ $(BUILD_PfatServices_DIR)\PfatServices.obj \
+
+PfatServices_MY_INCLUDES= \
+ $(EDK_INCLUDES)\
+ $(PROJECT_CPU_INCLUDES)\
+ $(INTEL_MCH_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+ $(INTEL_PLATFORM_PROTOCOL_INCLUDES)
+
+PfatServices_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=InstallPfatProtocol"\
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ /D __EDKII_GLUE_SMM_RUNTIME_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_UEFI_DEVICE_PATH_LIB__ \
+ /D __EDKII_GLUE_DXE_HOB_LIB__ \
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__
+
+PfatServices_LIBS =\
+ $(EDKPROTOCOLLIB)\
+ $(EFISCRIPTLIB)\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(EFIGUIDLIB)\
+ $(PpmAslUpdateLib_LIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(IntelPlatformProtocolLib_LIB)\
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EFIDRIVERLIB)\
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGlueSmmRuntimeDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueDxeMemoryAllocationLib_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueUefiRuntimeServicesTableLib_LIB)\
+ $(EdkIIGlueUefiDevicePathLib_LIB) \
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(EdkIIGlueUefiRuntimeServicesTableLib_LIB) \
+ $(EdkIIGlueDxeHobLib_LIB)\
+ $(CpuProtocolLib_LIB)\
+ $(PchPlatformDxeLib_LIB)
+
+
+
+PfatServicesBin : $(PfatServices_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\PfatServices.mak all\
+ NAME=PfatServices\
+ MAKEFILE=$(BUILD_DIR)\PfatServices.mak \
+ "MY_INCLUDES=$(PfatServices_MY_INCLUDES)" \
+ "MY_DEFINES=$(PfatServices_DEFINES)"\
+ OBJECTS="$(PfatServices_OBJECTS)" \
+ GUID=6D4BAA0B-F431-4370-AF19-99D6209239F6\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=RT_DRIVER \
+ EDKIIModule=SMMDRIVER\
+ DEPEX1=$(PfatServices_DIR)\PfatServices.DXS \
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \
+ COMPRESS=1
+#-----------------------------------------------------------------------
+#**********************************************************************
+#** **
+#** (C)Copyright 1985-2012, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Pkwy, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#**********************************************************************
+#**********************************************************************
diff --git a/ReferenceCode/Pfat/Smm/PfatServices.sdl b/ReferenceCode/Pfat/Smm/PfatServices.sdl
new file mode 100644
index 0000000..23b6abb
--- /dev/null
+++ b/ReferenceCode/Pfat/Smm/PfatServices.sdl
@@ -0,0 +1,37 @@
+TOKEN
+ Name = "PfatServices_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+ Help = "Main switch to enable Pfat support in Project, needs NvramSmiSupport Enabled"
+ Token = "NvramSmiSupport" "=" "1"
+End
+
+TOKEN
+ Name = "Pfat_Enable_Pei"
+ Value = "0
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Help = "DON'T MODIFY THIS TOKEN"
+End
+
+PATH
+ Name = "PfatServices_DIR"
+ Help = "PfatServices Driver files source directory"
+End
+
+MODULE
+ Help = "Includes PfatServices.mak to Project"
+ File = "PfatServices.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PfatServices.ffs"
+ Parent = "$(BUILD_DIR)\SmmBase.ffs"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/RapidStart/AcpiTables/RapidStartAcpiTables.cif b/ReferenceCode/RapidStart/AcpiTables/RapidStartAcpiTables.cif
new file mode 100644
index 0000000..9e95414
--- /dev/null
+++ b/ReferenceCode/RapidStart/AcpiTables/RapidStartAcpiTables.cif
@@ -0,0 +1,11 @@
+<component>
+ name = "RapidStartAcpiTables"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\RapidStart\AcpiTables"
+ RefName = "RapidStartAcpiTables"
+[files]
+"RapidStartAcpiTables.sdl"
+"RapidStartAcpiTables.mak"
+"RapidStartAcpiTables.inf"
+"Ssdt\RapidStart.asl"
+<endComponent>
diff --git a/ReferenceCode/RapidStart/AcpiTables/RapidStartAcpiTables.inf b/ReferenceCode/RapidStart/AcpiTables/RapidStartAcpiTables.inf
new file mode 100644
index 0000000..6b98d1f
--- /dev/null
+++ b/ReferenceCode/RapidStart/AcpiTables/RapidStartAcpiTables.inf
@@ -0,0 +1,66 @@
+## @file
+# Component description file for the ACPI tables
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains an 'Intel Peripheral Driver' and uniquely
+# identified as "Intel Reference Module" and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+
+[defines]
+BASE_NAME = RapidStartAcpiTables
+FILE_GUID = 60AC3A8F-4D66-4CD4-895A-C3F06E6665EE
+COMPONENT_TYPE = ACPITABLE #ECP Override RAPID_START_ACPI_TABLES
+FFS_EXT = .ffs
+
+[sources.common]
+ Ssdt/RapidStart.asl
+
+[libraries.common]
+
+[includes.common]
+ .
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Include
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+#
+# Typically the sample code referenced will be available in the code base already
+# So keep this include at the end to defer to the source base definition
+# and only use the sample code definition if source base does not include these files.
+#
+
+#
+# Edk II Glue Library, some hearder are included by R9 header so have to include
+#
+
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Framework
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[nmake.common]
diff --git a/ReferenceCode/RapidStart/AcpiTables/RapidStartAcpiTables.mak b/ReferenceCode/RapidStart/AcpiTables/RapidStartAcpiTables.mak
new file mode 100644
index 0000000..998ef06
--- /dev/null
+++ b/ReferenceCode/RapidStart/AcpiTables/RapidStartAcpiTables.mak
@@ -0,0 +1,105 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+# $Header: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/RapidStartAcpiTables/RapidStartAcpiTables.mak 3 6/02/13 8:23a Joshchou $
+#
+# $Revision: 3 $
+#
+# $Date: 6/02/13 8:23a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/RapidStartAcpiTables/RapidStartAcpiTables.mak $
+#
+# 3 6/02/13 8:23a Joshchou
+# [TAG] None
+# [Category] Improvement
+# [Description] Change IASL compiler path to
+# $(ACPIPLATFORM_ASL_COMPILER) in SharkBay project.
+#
+# 2 11/20/12 2:22a Bensonlai
+# [TAG] EIP107013
+# [Category] Improvement
+# [Description] Update Shark Bay Rapid Start Reference Code Version
+# 0.8.0.0
+# [Files] RapidStartAcpiTables.sdl
+# RapidStartAcpiTables.mak
+# RapidStartAcpiTables.inf
+# Ssdt\RapidStart.asl
+# RapidStartAcpiTables.cif
+#
+# 1 4/19/12 7:50a Yurenlai
+# Initial check in.
+#
+#*************************************************************************
+#-----------------------------------------------------------------------
+# ASL compiler definition
+#-----------------------------------------------------------------------
+MASL = $(SILENT)asl.exe # Microsoft ASL compiler
+!IF "$(ACPIPLATFORM_ASL_COMPILER)"==""
+!ERROR It is an invalid path, please check your ASL compiler path.
+!ENDIF
+
+IASL = $(ACPIPLATFORM_ASL_COMPILER)
+#-----------------------------------------------------------------------
+ASL_COMPILER = IASL # Default ASL compiler. Can be 'IASL' for Intel ASL and 'MASL' for Microsoft ASL compiler.
+# Note. Msft. ASL compiler of version 1.0.14NT correctly process ACPI 2.0 extended ASL objects.
+#-----------------------------------------------------------------------
+EDK : RapidStartASL
+
+ALLRapidStartSEC = $(BUILD_DIR)\RapidStart.sec\
+
+RapidStartASL: $(BUILD_DIR)\RapidStartAcpiTables.ffs
+
+$(BUILD_DIR)\RapidStart.aml: $(INTEL_RAPIDSTART_ASL_FILE)
+!if "$(ASL_COMPILER)" == "MASL"
+ @$(MASL) /Fo=$@ $**
+!elseif "$(ASL_COMPILER)" == "IASL"
+ @cl /C /EP $(INTEL_RAPIDSTART_ASL_FILE) > $(BUILD_DIR)\RapidStart.asl
+ $(IASL) -p $(BUILD_DIR)\RapidStart.aml $(BUILD_DIR)\RapidStart.asl
+!endif
+
+$(BUILD_DIR)\RapidStart.sec: $(BUILD_DIR)\RapidStart.aml
+ $(GENSECTION) -I $** -O $@ -S EFI_SECTION_RAW
+
+$(BUILD_DIR)\RapidStartAcpiTables.ffs: $(ALLRapidStartSEC) $(RapidStartAcpiTables_DIR)\RapidStartAcpiTables.mak
+ $(GENFFSFILE) -B $(BUILD_DIR) -V -o $@ -P1 <<$(BUILD_DIR)\RapidStartAcpiTables.pkg
+PACKAGE.INF
+[.]
+BASE_NAME = RapidStartAcpiTables
+FFS_FILEGUID = 60AC3A8F-4D66-4CD4-895A-C3F06E6665EE
+FFS_FILETYPE = EFI_FV_FILETYPE_FREEFORM
+FFS_ATTRIB_CHECKSUM = TRUE
+
+IMAGE_SCRIPT =
+{
+ Compress (dummy) {
+ $(PROJECT_DIR)\$(BUILD_DIR)\RapidStart.sec
+ }
+}
+<<KEEP
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/RapidStart/AcpiTables/RapidStartAcpiTables.sdl b/ReferenceCode/RapidStart/AcpiTables/RapidStartAcpiTables.sdl
new file mode 100644
index 0000000..be7a5f2
--- /dev/null
+++ b/ReferenceCode/RapidStart/AcpiTables/RapidStartAcpiTables.sdl
@@ -0,0 +1,91 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2012, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+# $Header: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/RapidStartAcpiTables/RapidStartAcpiTables.sdl 3 11/20/12 2:22a Bensonlai $
+#
+# $Revision: 3 $
+#
+# $Date: 11/20/12 2:22a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/RapidStartAcpiTables/RapidStartAcpiTables.sdl $
+#
+# 3 11/20/12 2:22a Bensonlai
+# [TAG] EIP107013
+# [Category] Improvement
+# [Description] Update Shark Bay Rapid Start Reference Code Version
+# 0.8.0.0
+# [Files] RapidStartAcpiTables.sdl
+# RapidStartAcpiTables.mak
+# RapidStartAcpiTables.inf
+# Ssdt\RapidStart.asl
+# RapidStartAcpiTables.cif
+#
+# 2 10/15/12 5:46a Bensonlai
+# [Category] Improvement
+# [Severity] Important
+# [Description] Rename all IFFS sting to Rapid Start.
+# [Files] Board\EM\RapidStartWrapper\*.*, ReferenceCode\RapidStart\*.*
+#
+# 1 4/19/12 7:50a Yurenlai
+# Initial check in.
+#
+#*************************************************************************
+TOKEN
+ Name = "RapidStartAcpiTables_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+ Help = "Main switch to enable RapidStart ACPI tables in Project"
+End
+
+MODULE
+ Help = "Includes RapidStartAcpiTables.mak to Project"
+ File = "RapidStartAcpiTables.mak"
+End
+
+PATH
+ Name = "RapidStartAcpiTables_DIR"
+End
+
+TOKEN
+ Name = "INTEL_RAPIDSTART_ASL_FILE"
+ Value = "$(RapidStartAcpiTables_DIR)\Ssdt\RapidStart.asl"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\RapidStartAcpiTables.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2012, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/RapidStart/AcpiTables/Ssdt/RapidStart.asl b/ReferenceCode/RapidStart/AcpiTables/Ssdt/RapidStart.asl
new file mode 100644
index 0000000..0004f89
--- /dev/null
+++ b/ReferenceCode/RapidStart/AcpiTables/Ssdt/RapidStart.asl
@@ -0,0 +1,80 @@
+/*++
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+--*/
+
+/*++
+
+Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ RapidStart.asl
+
+Abstract:
+
+ RapidStart ACPI ASL code to support OS control
+
+--*/
+
+
+DefinitionBlock (
+ "RapidStart.aml",
+ "SSDT",
+ 0x01,
+ "Iffs",
+ "IffsAsl",
+ 0x3000
+ )
+{
+
+ Scope (\_SB) {
+ Device(IFFS) {
+ OperationRegion(FFSN,SystemMemory,0xFFFF0000,0xAA55)
+ Field(FFSN,AnyAcc,Lock,Preserve)
+ {
+ FFSA, 8, // (0) iFFS available events
+ FFSS, 8, // (1) iFFS enabled events
+ FFST, 16, // (2) iFFS wake timer in minutes
+ FFSP, 32 // (4) iFFS performance monitoring data
+ }
+
+ Name(_HID,EISAID("INT3392"))
+ Name(_CID,EISAID("PNP0C02"))
+
+ Method(GFFS,0,Serialized) {
+ Return(FFSS)
+ }
+ Method(SFFS,1,Serialized) {
+ And(Arg0, FFSA, FFSS)
+ Return(FFSS)
+ }
+ Method(GFTV,0,Serialized) {
+ Return(FFST)
+ }
+ Method(SFTV,1,Serialized) {
+ //
+ // 24*60=1440 minutes (24 Hours)
+ //
+ If (LLessEqual(Arg0,1440)) {
+ Store(Arg0,FFST)
+ } Else {
+ And(FFSS,0xFFFE,FFSS)
+ Store(10,FFST)
+ }
+ Return(FFST)
+ }
+ }
+ }
+}
diff --git a/ReferenceCode/RapidStart/Dxe/RapidStartDxe.c b/ReferenceCode/RapidStart/Dxe/RapidStartDxe.c
new file mode 100644
index 0000000..8e7cf92
--- /dev/null
+++ b/ReferenceCode/RapidStart/Dxe/RapidStartDxe.c
@@ -0,0 +1,935 @@
+/** @file
+ This Dxe driver will initialize RapidStart Persistent Data Variable and also verify RapidStart Store valid or not
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "RapidStartConfig.h"
+#include EFI_PROTOCOL_PRODUCER (RapidStartInfo)
+#include EFI_PROTOCOL_CONSUMER (RapidStartPlatformPolicy)
+#include EFI_GUID_DEFINITION (RapidStartAcpiTableStorage)
+#include EFI_PROTOCOL_PRODUCER (RapidStartGlobalNvsArea)
+#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
+#include EFI_PROTOCOL_DEPENDENCY (AcpiTable)
+#else
+#include EFI_PROTOCOL_DEPENDENCY (AcpiSupport)
+#endif
+#include EFI_PROTOCOL_CONSUMER (FirmwareVolume)
+
+#include <PchAccess.h>
+#include <SaAccess.h>
+#include EFI_GUID_DEFINITION (AcpiVariable)
+#include <RapidStartData.h>
+#include <RapidStartCommonLib.h>
+#include <RapidStartAhciReg.h>
+#include "Acpi3_0.h"
+#include <RapidStartDxeLib.h>
+#include <RcFviDxeLib.h>
+#endif
+
+#include "GfxDisplayLibDxe.h"
+#include EFI_PROTOCOL_PRODUCER (DxeGfxProtocol)
+
+EFI_GUID gEfiAcpiVariableGuid = EFI_ACPI_VARIABLE_GUID;
+
+RAPID_START_GLOBAL_NVS_AREA_PROTOCOL mRapidStartGlobalNvsAreaProtocol;
+RAPID_START_PERSISTENT_DATA *mRapidStartData;
+RAPID_START_PLATFORM_POLICY_PROTOCOL *mRapidStartPolicy;
+BOOLEAN mForceNewStoreUid = FALSE;
+BOOLEAN SecondTimeSearchRSTPartition;
+
+/**
+ Search for RapidStart Store and verify if valid. Install ACPI table only when RapidStart can be performed.
+
+ @param[in] Event - The event that triggered this notification function
+ @param[in] Context - Pointer to the notification functions context
+**/
+
+VOID
+EFIAPI
+SearchRapidStartPartition (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+;
+
+FVI_ELEMENT_AND_FUNCTION mRapidStartFviElementsData[] = {
+ {
+ DEFAULT_FVI_ELEMENT_DATA(RAPID_START),
+ NULL
+ }
+};
+
+FVI_DATA_HUB_CALLBACK_CONTEXT mRapidStartFviVersionData = {
+ MISC_SUBCLASS_FVI_HEADER_ENTRY(RAPID_START),
+ mRapidStartFviElementsData,
+};
+
+UINTN mRapidStartFviElements = sizeof (mRapidStartFviElementsData) / sizeof (FVI_ELEMENT_AND_FUNCTION);
+
+/**
+ Installs RapidStart info protocols.
+
+ @param[in] ImageHandle - Image handle for this driver image
+
+ @retval EFI_OUT_OF_RESOURCES - Not enough resource to install RapidStart Info Protocol
+ @retval EFI_SUCCESS - RapidStart Info Protocol installed successfully
+**/
+STATIC
+EFI_STATUS
+RapidStartInstallInfoProtocol (
+ IN EFI_HANDLE ImageHandle
+ )
+{
+ RAPID_START_INFO_PROTOCOL *pRapidStartInfoProtocol;
+ EFI_STATUS Status;
+
+ ///
+ /// Install RAPID_START_INFO_PROTOCOL
+ ///
+ pRapidStartInfoProtocol = AllocateZeroPool (sizeof (RAPID_START_INFO_PROTOCOL));
+ if (pRapidStartInfoProtocol == NULL) {
+ ASSERT (FALSE);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ pRapidStartInfoProtocol->Revision = RAPID_START_INFO_PROTOCOL_REVISION_1;
+ ///
+ /// RCVersion[32:0] is the release number.
+ /// For example:
+ /// RapidStart Framework 0.5.0 should be 00 05 00 00 (0x00050000)
+ ///
+ pRapidStartInfoProtocol->RCVersion = RAPID_START_RC_VERSION;
+ DEBUG ((EFI_D_INFO, "RapidStart Reference Code Revision = %X\n", pRapidStartInfoProtocol->RCVersion));
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &ImageHandle,
+ &gRapidStartInfoProtocolGuid,
+ pRapidStartInfoProtocol,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ return Status;
+}
+
+/**
+ Allocates RapidStart memory ranges.
+
+ @param[in] ImageHandle - Image handle for this driver image
+ @param[in,out] RapidStartData - Pointer to RapidStart persistent data
+**/
+STATIC
+VOID
+RapidStartAllocateMemory (
+ IN EFI_HANDLE ImageHandle,
+ IN OUT RAPID_START_PERSISTENT_DATA *RapidStartData
+ )
+{
+ EFI_PHYSICAL_ADDRESS Addr;
+ EFI_STATUS Status;
+ UINT64 MemMax;
+ RAPID_START_MEM_DATA *RapidStartMemData;
+ EFI_STATUS GfxStatus;
+ DXE_GFX_PROTOCOL *DxeGfxProtocol;
+ UINT64 *DssAddress;
+ UINT64 DssSize;
+
+ DssAddress = NULL;
+ DssSize = 0;
+
+ if (RapidStartData->Tohm > MEM_EQU_4GB) {
+ MemMax = RapidStartData->Tohm;
+ } else {
+ MemMax = RapidStartData->Tolm;
+ }
+
+ RapidStartData->ZeroBitmapSize = ALIGN ((UINT32) (RShiftU64 (NUMBER_OF_PAGES (MemMax), 3) + 8), EFI_PAGE_SIZE);
+ RapidStartData->RapidStartMemSize = ALIGN (
+ sizeof (RAPID_START_MEM_DATA) + AHCI_MEM_MAX_SIZE + RapidStartData->ZeroBitmapSize,
+ EFI_PAGE_SIZE
+ );
+#ifdef RAPID_START_WHOLE_MEMORY_CHECK
+ RapidStartData->Crc32RecordSize = ALIGN ((UINT32) DivU64x32 (MemMax, (MEMORY_CRC32_GRANULARITY / 4)), EFI_PAGE_SIZE);
+ RapidStartData->RapidStartMemSize += RapidStartData->Crc32RecordSize;
+#else
+ RapidStartData->Crc32RecordSize = 0;
+#endif
+
+ if (mRapidStartPolicy->DisplaySaveRestore == 1) {
+ GfxStatus = gBS->LocateProtocol (&gDxeGfxProtocolGuid, NULL, &DxeGfxProtocol);
+ if (!EFI_ERROR (GfxStatus)) {
+ Status = DxeGfxProtocol->AllocateDssBuffer ((UINT8)mRapidStartPolicy->DisplayType + 1);
+ Status = DxeGfxProtocol->GetDssAddress (&DssAddress, &DssSize);
+ }
+ }
+
+ RapidStartData->DssAddress = (UINT64)(DssAddress);
+ RapidStartData->DssSize = DssSize;
+ RapidStartData->DisplayType = (UINT8)(mRapidStartPolicy->DisplayType);
+ DEBUG ((EFI_D_INFO, "RapidStart Display DssAddress = %x, DssSize = %x\n", DssAddress, DssSize));
+
+ RapidStartData->HybridHardDisk = (UINT8)(mRapidStartPolicy->HybridHardDisk);
+ ///
+ /// Allocate RapidStart reserved memory
+ ///
+ Addr = (UINT64) AllocateReservedPages (EFI_SIZE_TO_PAGES (RapidStartData->RapidStartMemSize));
+ ASSERT (Addr != 0);
+ ASSERT (RShiftU64 (Addr, 32) == 0);
+
+ RapidStartData->RapidStartMem = (UINT32) Addr;
+ DEBUG ((EFI_D_ERROR, "RapidStartMem = %X\n", RapidStartData->RapidStartMem));
+ DEBUG ((EFI_D_ERROR, "RapidStartMemSize = %X\n", RapidStartData->RapidStartMemSize));
+ DEBUG ((EFI_D_ERROR, "ZeroBitmapSize = %X\n", RapidStartData->ZeroBitmapSize));
+ DEBUG ((EFI_D_ERROR, "Crc32RecordSize = %X\n", RapidStartData->Crc32RecordSize));
+ ///
+ /// Initialize private memory data
+ ///
+ RapidStartMemData = RAPID_START_MEM_DATA_PTR (RapidStartData);
+ RapidStartMemData->EntryCanceled = 0;
+ ///
+ /// Allocate RapidStart AHCI MMIO
+ ///
+ Addr = 0xFFFFFFFF;
+ Status = gDS->AllocateMemorySpace (
+//AMI_OVERRIDE_FOR_RAPID_START
+// EfiGcdAllocateMaxAddressSearchBottomUp,
+ EfiGcdAllocateMaxAddressSearchTopDown,
+//AMI_OVERRIDE_FOR_RAPID_START
+ EfiGcdMemoryTypeMemoryMappedIo,
+ N_PCH_SATA_AHCI_BAR_ALIGNMENT, // 2^11: 2K Alignment
+ V_PCH_SATA_AHCI_BAR_LENGTH, // 2K Length
+ &Addr,
+ ImageHandle,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ RapidStartData->MmioSpace = (UINT32) Addr;
+ ///
+ /// Allocate Wlan MMIO
+ ///
+ Addr = 0xFFFFFFFF;
+ Status = gDS->AllocateMemorySpace (
+//AMI_OVERRIDE_FOR_RAPID_START
+// EfiGcdAllocateMaxAddressSearchBottomUp,
+ EfiGcdAllocateMaxAddressSearchTopDown,
+//AMI_OVERRIDE_FOR_RAPID_START
+ EfiGcdMemoryTypeMemoryMappedIo,
+ 15, // 2^15: 32K Alignment
+ 0x8000, // 32K Length
+ &Addr,
+ ImageHandle,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ RapidStartData->WlanMmioSpace = (UINT32) Addr;
+
+}
+
+/**
+ Initialize RapidStart ACPI tables
+
+ @retval EFI_SUCCESS RapidStart ACPI tables are initialized successfully
+ @retval EFI_NOT_FOUND RapidStart ACPI tables not found
+**/
+STATIC
+EFI_STATUS
+InitializeRapidStartAcpiTables (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ EFI_HANDLE *HandleBuffer;
+ UINTN NumberOfHandles;
+ EFI_FV_FILETYPE FileType;
+ UINT32 FvStatus;
+ EFI_FV_FILE_ATTRIBUTES Attributes;
+ UINTN Size;
+ UINTN i;
+ EFI_FIRMWARE_VOLUME_PROTOCOL *FwVol;
+ INTN Instance;
+ EFI_ACPI_COMMON_HEADER *CurrentTable;
+ UINTN AcpiTableKey;
+ UINT8 *CurrPtr;
+ UINT8 *EndPtr;
+ UINT32 *Signature;
+ EFI_ACPI_DESCRIPTION_HEADER *RapidStartAcpiTable;
+#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
+ EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
+#else
+ EFI_ACPI_SUPPORT_PROTOCOL *AcpiSupport;
+#endif
+
+ FwVol = NULL;
+ RapidStartAcpiTable = NULL;
+
+ ///
+ /// Locate ACPI support protocol
+ ///
+#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
+ Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, &AcpiTable);
+#else
+ Status = gBS->LocateProtocol (&gEfiAcpiSupportProtocolGuid, NULL, (VOID **) &AcpiSupport);
+#endif
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Locate protocol.
+ /// There is little chance we can't find an FV protocol
+ ///
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiFirmwareVolumeProtocolGuid,
+ NULL,
+ &NumberOfHandles,
+ &HandleBuffer
+ );
+ ASSERT_EFI_ERROR (Status);
+ ///
+ /// Looking for FV with ACPI storage file
+ ///
+ for (i = 0; i < NumberOfHandles; i++) {
+ ///
+ /// Get the protocol on this handle
+ /// This should not fail because of LocateHandleBuffer
+ ///
+ Status = gBS->HandleProtocol (
+ HandleBuffer[i],
+ &gEfiFirmwareVolumeProtocolGuid,
+ (VOID **) &FwVol
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// See if it has the ACPI storage file
+ ///
+ Size = 0;
+ FvStatus = 0;
+ Status = FwVol->ReadFile (
+ FwVol,
+ &gRapidStartAcpiTableStorageGuid,
+ NULL,
+ &Size,
+ &FileType,
+ &Attributes,
+ &FvStatus
+ );
+
+ ///
+ /// If we found it, then we are done
+ ///
+ if (Status == EFI_SUCCESS) {
+ break;
+ }
+ }
+ ///
+ /// Free any allocated buffers
+ ///
+ FreePool (HandleBuffer);
+
+ ///
+ /// Sanity check that we found our data file
+ ///
+ ASSERT (FwVol != NULL);
+ if (FwVol == NULL) {
+ return EFI_NOT_FOUND;
+ }
+ ///
+ /// Our exit status is determined by the success of the previous operations
+ /// If the protocol was found, Instance already points to it.
+ /// Read tables from the storage file.
+ ///
+ Instance = 0;
+ CurrentTable = NULL;
+ while (Status == EFI_SUCCESS) {
+ Status = FwVol->ReadSection (
+ FwVol,
+ &gRapidStartAcpiTableStorageGuid,
+ EFI_SECTION_RAW,
+ Instance,
+ (VOID **) &CurrentTable,
+ &Size,
+ &FvStatus
+ );
+
+ if (!EFI_ERROR (Status)) {
+ ///
+ /// Check the table ID to modify the table
+ ///
+ if (((EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable)->OemTableId == EFI_SIGNATURE_64 ('I', 'f', 'f', 's', 'A', 's', 'l', 0)) {
+ RapidStartAcpiTable = (EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable;
+ ///
+ /// Locate the SSDT package
+ ///
+ CurrPtr = (UINT8 *) RapidStartAcpiTable;
+ EndPtr = CurrPtr + RapidStartAcpiTable->Length;
+
+ for (; CurrPtr <= EndPtr; CurrPtr++) {
+ Signature = (UINT32 *) (CurrPtr + 3);
+ if (*Signature == EFI_SIGNATURE_32 ('F', 'F', 'S', 'N')) {
+ ASSERT_EFI_ERROR (*(UINT32 *) (CurrPtr + 3 + sizeof (*Signature) + 2) == 0xFFFF0000);
+ ASSERT_EFI_ERROR (*(UINT16 *) (CurrPtr + 3 + sizeof (*Signature) + 2 + sizeof (UINT32) + 1) == 0xAA55);
+ ///
+ /// RapidStart Global NVS Area address
+ ///
+ *(UINT32 *) (CurrPtr + 3 + sizeof (*Signature) + 2) = (UINT32) (UINTN) mRapidStartGlobalNvsAreaProtocol.Area;
+ ///
+ /// RapidStart Global NVS Area size
+ ///
+ *(UINT16 *) (CurrPtr + 3 + sizeof (*Signature) + 2 + sizeof (UINT32) + 1) =
+ sizeof (RAPID_START_GLOBAL_NVS_AREA);
+
+ AcpiTableKey = 0;
+#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
+ Status = AcpiTable->InstallAcpiTable (
+ AcpiTable,
+ RapidStartAcpiTable,
+ RapidStartAcpiTable->Length,
+ &AcpiTableKey
+ );
+#else
+ Status = AcpiSupport->SetAcpiTable (
+ AcpiSupport,
+ RapidStartAcpiTable,
+ TRUE,
+ EFI_ACPI_TABLE_VERSION_1_0B | EFI_ACPI_TABLE_VERSION_2_0 | EFI_ACPI_TABLE_VERSION_3_0,
+ &AcpiTableKey
+ );
+ Status = AcpiSupport->PublishTables (
+ AcpiSupport,
+ EFI_ACPI_TABLE_VERSION_1_0B | EFI_ACPI_TABLE_VERSION_2_0 | EFI_ACPI_TABLE_VERSION_3_0
+ );
+#endif
+ ASSERT_EFI_ERROR (Status);
+ return EFI_SUCCESS;
+ }
+ }
+ }
+ ///
+ /// Increment the instance
+ ///
+ Instance++;
+ CurrentTable = NULL;
+ }
+ }
+
+ return Status;
+
+}
+
+/**
+ Update RapidStart Persistent Data if necessary.
+
+ @param[in] RapidStartData - Pointer to RapidStart persistent data
+
+ @retval EFI_SUCCESS - RapidStart Persistent Data updated successfully
+**/
+STATIC
+EFI_STATUS
+RapidStartUpdatePersistentData (
+ IN RAPID_START_PERSISTENT_DATA *RapidStartData
+ )
+{
+ RAPID_START_PERSISTENT_DATA RapidStartDataOrg;
+ UINTN RapidStartDataSize;
+ EFI_STATUS Status;
+
+ RapidStartDataSize = sizeof (RAPID_START_PERSISTENT_DATA);
+ Status = gRT->GetVariable (
+ gRapidStartPersistentDataName,
+ &gRapidStartPersistentDataGuid,
+ NULL,
+ &RapidStartDataSize,
+ &RapidStartDataOrg
+ );
+ ///
+ /// RapidStartData variable not present or RapidStart Store change detected in previous RapidStart Resume.
+ /// Generate new RapidStart Store UID
+ ///
+ if (EFI_ERROR (Status) ||
+ mForceNewStoreUid ||
+ (RapidStartData->StoreSectors != RapidStartDataOrg.StoreSectors) ||
+ (RapidStartData->StoreLbaAddr != RapidStartDataOrg.StoreLbaAddr) ||
+ (RapidStartData->StoreSataPort != RapidStartDataOrg.StoreSataPort)
+ ) {
+ DEBUG ((EFI_D_ERROR, "Generate RapidStart Store UID.\n"));
+ RapidStartData->RapidStartStoreUid = GenerateRapidStartStoreUid ();
+ } else {
+ RapidStartData->RapidStartStoreUid = RapidStartDataOrg.RapidStartStoreUid;
+ }
+ ///
+ /// Check for changes in RapidStartData
+ ///
+ if ((Status == EFI_SUCCESS) &&
+ (CompareMem (&RapidStartDataOrg, RapidStartData, sizeof (RAPID_START_PERSISTENT_DATA)) == 0)
+ ) {
+ return EFI_SUCCESS;
+ }
+
+ Status = gRT->SetVariable (
+ gRapidStartPersistentDataName,
+ &gRapidStartPersistentDataGuid,
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
+ sizeof (RAPID_START_PERSISTENT_DATA),
+ RapidStartData
+ );
+ ASSERT_EFI_ERROR (Status);
+ return Status;
+}
+
+/**
+ Installs Search RapidStart Partition handler by DiskIoProtocol.
+**/
+VOID
+RegisterForSearchRapidStartPartitionAgain (
+ VOID
+ )
+{
+ EFI_EVENT Event;
+ EFI_STATUS Status;
+ VOID *Registration;
+
+ //
+ // Set this flag to TRUE and we will not search RapidStart partition again.
+ //
+ SecondTimeSearchRSTPartition = TRUE;
+ //
+ // Create a callback event to detect RapidStart Partition
+ //
+ Status = gBS->CreateEvent (
+ EFI_EVENT_NOTIFY_SIGNAL,
+ EFI_TPL_CALLBACK,
+ SearchRapidStartPartition,
+ NULL,
+ &Event
+ );
+ ASSERT_EFI_ERROR (Status);
+ //
+ // Register DISK_IO_PROTOCOL notify function
+ //
+ Status = gBS->RegisterProtocolNotify (
+ &gEfiDiskIoProtocolGuid,
+ Event,
+ &Registration
+ );
+ ASSERT_EFI_ERROR (Status);
+//AMI_OVERRIDE_FOR_RAPID_START
+//EIP123061
+ gBS->SignalEvent(Event);
+//AMI_OVERRIDE_FOR_RAPID_END
+}
+
+/**
+ Search for RapidStart Store and verify if valid. Install ACPI table only when RapidStart can be performed.
+
+ @param[in] Event - The event that triggered this notification function
+ @param[in] Context - Pointer to the notification functions context
+**/
+
+VOID
+EFIAPI
+SearchRapidStartPartition (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ EFI_STATUS Status;
+ BOOLEAN DisableRapidStart;
+ BOOLEAN CheckSize;
+ UINT32 ThresholdSize;
+
+ DEBUG ((EFI_D_INFO, "SearchRapidStartPartition Start()\n"));
+
+ DisableRapidStart = FALSE;
+ CheckSize = FALSE;
+ ThresholdSize = MEM_TO_SECT (mRapidStartData->TotalMem);
+
+ ///
+ /// RapidStart has been enabled, check if RapidStart store valid.
+ ///
+ Status = SearchRapidStartStore (
+ mRapidStartPolicy,
+ &(mRapidStartData->StoreSectors),
+ &(mRapidStartData->StoreLbaAddr),
+ &(mRapidStartData->StoreSataPort)
+ );
+ mRapidStartData->ActivePageThresholdSizeInSector = 0;
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "RapidStart parition not found\n"));
+
+ if (SecondTimeSearchRSTPartition == FALSE) {
+ RegisterForSearchRapidStartPartitionAgain ();
+ DEBUG ((EFI_D_ERROR, " - Will search RapidStart parition again\n"));
+ gBS->CloseEvent (Event);
+ return;
+ }
+
+ DisableRapidStart = TRUE;
+ } else if (mRapidStartPolicy->ActivePageThresholdSupport == 0) {
+ CheckSize = TRUE;
+ } else {
+ DEBUG ((EFI_D_ERROR, "RapidStart Partition size less than memory size is supported\n"));
+ if (mRapidStartPolicy->ActivePageThresholdSize == 0) {
+ DEBUG ((EFI_D_ERROR, "RapidStart Partition size check in Auto Mode\n"));
+ } else {
+ ///
+ /// ActivePageThreshold size in MB
+ ///
+ ThresholdSize = (UINT32)MultU64x32 (mRapidStartPolicy->ActivePageThresholdSize, MEM_TO_SECT (MEM_EQU_1MB));
+ mRapidStartData->ActivePageThresholdSizeInSector = ThresholdSize;
+ CheckSize = TRUE;
+ }
+ }
+
+ if (CheckSize) {
+ if (ThresholdSize > mRapidStartData->StoreSectors) {
+ DEBUG ((EFI_D_ERROR, "RapidStart partition too small\n"));
+ DisableRapidStart = TRUE;
+ }
+ }
+
+ if (DisableRapidStart) {
+ DEBUG ((EFI_D_ERROR, "Disabling RapidStart!\n"));
+ ///
+ /// Disable RapidStart
+ ///
+ mRapidStartPolicy->EnableRapidStart = 0;
+ ///
+ /// Delete RapidStart variable
+ ///
+ Status = gRT->SetVariable (
+ gRapidStartPersistentDataName,
+ &gRapidStartPersistentDataGuid,
+ 0,
+ 0,
+ NULL
+ );
+ ///
+ /// Disable FFS relevant SMI handlers.
+ ///
+ mRapidStartGlobalNvsAreaProtocol.Area->EventsAvailable = 0;
+ mRapidStartGlobalNvsAreaProtocol.Area->EventsEnabled = 0;
+ } else {
+ ///
+ /// Enabling RapidStart
+ /// install RapidStart ACPI Table.
+ ///
+ DEBUG ((EFI_D_INFO, "Enabling RapidStart\n"));
+ DEBUG ((EFI_D_ERROR, "RapidStart Store:\n"));
+ DEBUG ((EFI_D_ERROR, " Port : %X\n", mRapidStartData->StoreSataPort));
+ DEBUG ((EFI_D_ERROR, " LbaAddr : %X\n", mRapidStartData->StoreLbaAddr));
+ DEBUG ((EFI_D_ERROR, " Size : %X Sectors\n", mRapidStartData->StoreSectors));
+ DEBUG ((EFI_D_ERROR, "Threshold Size : %X Sectors\n", mRapidStartData->ActivePageThresholdSizeInSector));
+
+ Status = InitializeRapidStartAcpiTables ();
+ ASSERT_EFI_ERROR (Status);
+#ifndef RAPID_START_ON_MEMORY_INSTALLED
+ RapidStartUpdatePersistentData (mRapidStartData);
+#endif
+ }
+
+ gBS->CloseEvent (Event);
+}
+
+/**
+ Installs Search RapidStart Partition handler.
+**/
+VOID
+RegisterForSearchRapidStartPartition (
+ VOID
+ )
+{
+ EFI_EVENT Event;
+ EFI_STATUS Status;
+
+ SecondTimeSearchRSTPartition = FALSE;
+
+ Status = EfiCreateEventReadyToBootEx (
+ EFI_TPL_CALLBACK,
+ SearchRapidStartPartition,
+ NULL,
+ &Event
+ );
+ ASSERT_EFI_ERROR (Status);
+}
+
+#ifdef RAPID_START_ON_MEMORY_INSTALLED
+/**
+ Updates pointers necessary for S3 resume to RapidStart Flash variable.
+ This has to be postponed till ReadyToBoot as framework may update
+ this pointers late in a boot flow.
+
+ @param[in] Event - The event that triggered this notification function
+ @param[in] Context - Pointer to the notification functions context
+**/
+
+VOID
+EFIAPI
+RapidStartOnExitBootServices (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ UINT64 AcpiVariableSet64;
+ ACPI_VARIABLE_SET *AcpiVariableSet;
+ UINTN VarSize;
+ EFI_STATUS Status;
+
+ DEBUG ((EFI_D_INFO, "RapidStartOnExitBootServices()\n"));
+
+ if (mRapidStartPolicy->EnableRapidStart) {
+ VarSize = sizeof (AcpiVariableSet64);
+ Status = gRT->GetVariable (
+ ACPI_GLOBAL_VARIABLE,
+ &gEfiAcpiVariableGuid,
+ NULL,
+ &VarSize,
+ &AcpiVariableSet64
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ AcpiVariableSet = (ACPI_VARIABLE_SET *) (UINTN) AcpiVariableSet64;
+
+ mRapidStartData->AcpiReservedMemoryBase = AcpiVariableSet->AcpiReservedMemoryBase;
+ mRapidStartData->AcpiReservedMemorySize = AcpiVariableSet->AcpiReservedMemorySize;
+#ifdef RAPID_START_USE_OLD_ACPI_VARIABLE_SET
+ mRapidStartData->SystemMemoryLengthBelow4GB = AcpiVariableSet->SystemMemoryLength;
+ mRapidStartData->SystemMemoryLengthAbove4GB = 0;
+#else
+ mRapidStartData->SystemMemoryLengthBelow4GB = AcpiVariableSet->SystemMemoryLengthBelow4GB;
+ mRapidStartData->SystemMemoryLengthAbove4GB = AcpiVariableSet->SystemMemoryLengthAbove4GB;
+#endif
+ DEBUG ((EFI_D_INFO, "AcpiReservedMemoryBase = %0lx\n", mRapidStartData->AcpiReservedMemoryBase));
+ DEBUG ((EFI_D_INFO, "AcpiReservedMemorySize = %0x\n", mRapidStartData->AcpiReservedMemorySize));
+ DEBUG ((EFI_D_INFO, "SystemMemoryLengthBelow4GB = %0lx\n", mRapidStartData->SystemMemoryLengthBelow4GB));
+ DEBUG ((EFI_D_INFO, "SystemMemoryLengthAbove4GB = %0lx\n", mRapidStartData->SystemMemoryLengthAbove4GB));
+ RapidStartUpdatePersistentData (mRapidStartData);
+ }
+
+ gBS->CloseEvent (Event);
+}
+
+/**
+ Installs ExitBootService handler.
+**/
+VOID
+RegisterForExitBootService (
+ VOID
+ )
+{
+ EFI_EVENT Event;
+ EFI_STATUS Status;
+
+ Status = gBS->CreateEvent (
+ EVENT_SIGNAL_EXIT_BOOT_SERVICES,
+ EFI_TPL_CALLBACK,
+ RapidStartOnExitBootServices,
+ NULL,
+ &Event
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ Status = EfiCreateEventLegacyBootEx (
+ EFI_TPL_CALLBACK,
+ RapidStartOnExitBootServices,
+ NULL,
+ &Event
+ );
+ ASSERT_EFI_ERROR (Status);
+}
+#endif /* RAPID_START_ON_MEMORY_INSTALLED */
+
+/**
+ Initial RC Firmware Version Info
+**/
+VOID
+InitRcFvi (
+ VOID
+ )
+{
+ InitFviDataHubCbContext (
+ mRapidStartPolicy->FviSmbiosType,
+ (UINT8) mRapidStartFviElements,
+ &mRapidStartFviVersionData
+ );
+
+ CreateRcFviDatahub (&mRapidStartFviVersionData);
+}
+
+/**
+ RapidStart DXE driver entry point function
+
+ @param[in] ImageHandle - Image handle for this driver image
+ @param[in] SystemTable - Pointer to the EFI System Table
+
+ @retval EFI_OUT_OF_RESOURCES - no enough memory resource when installing reference code information protocol
+ @retval EFI_SUCCESS - function completed successfully
+**/
+EFI_STATUS
+RapidStartDxeEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ RAPID_START_GLOBAL_NVS_AREA *RapidStartGlobalNvs;
+ UINT16 SaDeviceId;
+ EFI_STATUS Status;
+ UINTN MchBase;
+ UINT8 RapidStartFlag;
+
+ DEBUG ((EFI_D_INFO, "RapidStartDxeEntryPoint()\n"));
+
+ Status = RapidStartInstallInfoProtocol (ImageHandle);
+ if (EFI_ERROR (Status)) {
+ ASSERT_EFI_ERROR (Status);
+ return Status;
+ }
+ ///
+ /// Locate RapidStart platform policy.
+ ///
+ Status = gBS->LocateProtocol (
+ &gRapidStartPlatformPolicyProtocolGuid,
+ NULL,
+ (VOID **) &mRapidStartPolicy
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "No RapidStart Platform Policy Protocol available"));
+ ASSERT_EFI_ERROR (Status);
+ }
+ ///
+ /// Initial RC Firmware Version Info
+ ///
+ InitRcFvi ();
+
+ if ((!EFI_ERROR (Status)) && (mRapidStartPolicy->EnableRapidStart)) {
+
+ Status = RapidStartGetFlag (&RapidStartFlag);
+ if (!EFI_ERROR (Status) && (RapidStartFlag & RAPID_START_FLAG_STORE_CHANGE)) {
+ mForceNewStoreUid = TRUE;
+ }
+
+ RapidStartSetFlag (0);
+
+ Status = (gBS->AllocatePool) (EfiACPIMemoryNVS, sizeof (RAPID_START_GLOBAL_NVS_AREA), (VOID **) &mRapidStartGlobalNvsAreaProtocol.Area);
+ ASSERT_EFI_ERROR (Status);
+ ZeroMem ((VOID *) mRapidStartGlobalNvsAreaProtocol.Area, sizeof (RAPID_START_GLOBAL_NVS_AREA));
+
+ Status = (gBS->AllocatePool) (EfiACPIMemoryNVS, sizeof (RAPID_START_PERSISTENT_DATA), &mRapidStartGlobalNvsAreaProtocol.RapidStartData);
+ ASSERT_EFI_ERROR (Status);
+ ZeroMem ((VOID *) mRapidStartGlobalNvsAreaProtocol.RapidStartData, sizeof (RAPID_START_PERSISTENT_DATA));
+
+ mRapidStartData = mRapidStartGlobalNvsAreaProtocol.RapidStartData;
+
+ ///
+ /// Get Tolm and Tohm
+ ///
+ MchBase = MmPciAddress (0, SA_MC_BUS, SA_MC_DEV, SA_MC_FUN, 0);
+ mRapidStartData->Tolm = MmioRead32 (MchBase + R_SA_BDSM) & B_SA_BDSM_BDSM_MASK;
+ mRapidStartData->Tohm = MmioRead64 (MchBase + R_SA_TOUUD) & B_SA_TOUUD_TOUUD_MASK;
+ ///
+ /// Calculate total size of memory to be stored
+ ///
+ mRapidStartData->TotalMem = mRapidStartData->Tolm;
+ if (mRapidStartData->Tohm > MEM_EQU_4GB) {
+ mRapidStartData->TotalMem += mRapidStartData->Tohm - MEM_EQU_4GB;
+ }
+
+ if (mRapidStartPolicy->EntryOnS3RtcWake == 0 && mRapidStartPolicy->EntryOnS3CritBattWake == 0) {
+ DEBUG ((EFI_D_WARN, "RapidStart both S3 wakeup timer and critical battery wake event are disabled\n"));
+ }
+
+ RapidStartGlobalNvs = mRapidStartGlobalNvsAreaProtocol.Area;
+ RapidStartGlobalNvs->EventsAvailable = RAPID_START_ACPI_RTC_WAKE;
+
+ if (mRapidStartPolicy->S3WakeTimerMin <= RAPID_START_WAKE_TIMER_MAX) {
+ RapidStartGlobalNvs->WakeTimerMin = mRapidStartPolicy->S3WakeTimerMin;
+ } else {
+ DEBUG ((EFI_D_WARN, "RapidStart S3 wakeup timer out of range - resetting to default\n"));
+ RapidStartGlobalNvs->WakeTimerMin = RAPID_START_WAKE_TIMER_DEFAULT;
+ }
+
+ if (mRapidStartPolicy->EntryOnS3RtcWake) {
+ RapidStartGlobalNvs->EventsEnabled |= RAPID_START_ACPI_RTC_WAKE;
+ }
+
+ SaDeviceId = MmioRead16 (
+ MmPciAddress (
+ 0,
+ SA_MC_BUS,
+ SA_MC_DEV,
+ SA_MC_FUN,
+ R_SA_MC_DEVICE_ID)
+ );
+
+ if (IS_SA_DEVICE_ID_MOBILE (SaDeviceId)) {
+ RapidStartGlobalNvs->EventsAvailable |= RAPID_START_ACPI_BATT_WAKE;
+ if ((mRapidStartPolicy->EntryOnS3CritBattWake)) {
+ RapidStartGlobalNvs->EventsEnabled |= RAPID_START_ACPI_BATT_WAKE;
+ }
+ }
+
+ mRapidStartData->RapidStartGlobalNvsPtr = (UINT32) (UINTN) RapidStartGlobalNvs;
+
+ mRapidStartData->SataPortConfiguration = MmioRead8 (
+ MmPciAddress (
+ 0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_SATA,
+ PCI_FUNCTION_NUMBER_PCH_SATA,
+ R_PCH_SATA_PCS)
+ );
+
+ RapidStartAllocateMemory (ImageHandle, mRapidStartData);
+
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &ImageHandle,
+ &gRapidStartGlobalNvsAreaProtocolGuid,
+ &mRapidStartGlobalNvsAreaProtocol,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ RegisterForSearchRapidStartPartition ();
+#ifdef RAPID_START_ON_MEMORY_INSTALLED
+ RegisterForExitBootService ();
+#endif
+ RegisterForRapidStartDisplayScreenCallback();
+ return EFI_SUCCESS;
+ }
+ ///
+ /// Delete RapidStart variable
+ ///
+ Status = gRT->SetVariable (
+ gRapidStartPersistentDataName,
+ &gRapidStartPersistentDataGuid,
+ 0,
+ 0,
+ NULL
+ );
+ if (Status == EFI_NOT_FOUND) {
+ return EFI_SUCCESS;
+ }
+
+ ASSERT_EFI_ERROR (Status);
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/RapidStart/Dxe/RapidStartDxe.cif b/ReferenceCode/RapidStart/Dxe/RapidStartDxe.cif
new file mode 100644
index 0000000..c313b10
--- /dev/null
+++ b/ReferenceCode/RapidStart/Dxe/RapidStartDxe.cif
@@ -0,0 +1,12 @@
+<component>
+ name = "RapidStartDxe"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\RapidStart\Dxe"
+ RefName = "RapidStartDxe"
+[files]
+"RapidStartDxe.sdl"
+"RapidStartDxe.dxs"
+"RapidStartDxe.mak"
+"RapidStartDxe.inf"
+"RapidStartDxe.c"
+<endComponent>
diff --git a/ReferenceCode/RapidStart/Dxe/RapidStartDxe.dxs b/ReferenceCode/RapidStart/Dxe/RapidStartDxe.dxs
new file mode 100644
index 0000000..76d7ccf
--- /dev/null
+++ b/ReferenceCode/RapidStart/Dxe/RapidStartDxe.dxs
@@ -0,0 +1,56 @@
+/** @file
+ Dependency expression source file.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+
+#include "AutoGen.h"
+#include "DxeDepex.h"
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+
+#include EFI_PROTOCOL_DEFINITION (PchPlatformPolicy)
+#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
+#include EFI_PROTOCOL_DEPENDENCY (AcpiTable)
+#else
+#include EFI_PROTOCOL_DEPENDENCY (AcpiSupport)
+#endif
+#include EFI_PROTOCOL_DEFINITION (PchS3Support)
+#include EFI_PROTOCOL_DEFINITION (SmmControl)
+#include EFI_PROTOCOL_DEPENDENCY (RapidStartPlatformPolicy)
+#include EFI_PROTOCOL_DEPENDENCY (FirmwareVolume)
+//AMI_OVERRIDE_FOR_RAPID_START
+#include EFI_PROTOCOL_DEPENDENCY (DxeGfxProtocol)
+//AMI_OVERRIDE_FOR_RAPID_START
+#endif
+
+DEPENDENCY_START
+ DXE_PCH_PLATFORM_POLICY_PROTOCOL_GUID AND
+ EFI_PCH_S3_SUPPORT_PROTOCOL_GUID AND
+ EFI_SMM_CONTROL_PROTOCOL_GUID AND
+ RAPID_START_PLATFORM_POLICY_PROTOCOL_GUID AND
+#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
+ EFI_ACPI_TABLE_PROTOCOL_GUID AND
+#else
+ EFI_ACPI_SUPPORT_GUID AND
+#endif
+//AMI_OVERRIDE_FOR_RAPID_START
+ DXE_GFX_PROTOCOL_GUID AND
+//AMI_OVERRIDE_FOR_RAPID_START
+ EFI_FIRMWARE_VOLUME_PROTOCOL_GUID
+DEPENDENCY_END
diff --git a/ReferenceCode/RapidStart/Dxe/RapidStartDxe.inf b/ReferenceCode/RapidStart/Dxe/RapidStartDxe.inf
new file mode 100644
index 0000000..756b8f6
--- /dev/null
+++ b/ReferenceCode/RapidStart/Dxe/RapidStartDxe.inf
@@ -0,0 +1,102 @@
+## @file
+# Component description file for the RapidStartDxe DXE driver.
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = RapidStartDxe
+FILE_GUID = B6B9295F-CABF-4CEC-BB14-FE4246F2173A
+COMPONENT_TYPE = BS_DRIVER
+
+[sources.common]
+ RapidStartDxe.c
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueDxeDriverEntryPoint.c
+
+[includes.common]
+ .
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include/Pcd
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Cpu/Pentium/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Protocol
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_RAPID_START_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_RAPID_START_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_RAPID_START_ROOT)/Samplecode
+ $(EFI_SOURCE)/$(PROJECT_RAPID_START_ROOT)/Samplecode/Include
+ $(EFI_SOURCE)/$(PROJECT_RAPID_START_ROOT)/Samplecode/Library/RapidStartCommonLib
+ $(EFI_SOURCE)/$(PROJECT_RAPID_START_ROOT)/Samplecode/Library/RapidStartPlatformLib/Dxe
+ $(EFI_SOURCE)\$(PROJECT_RAPID_START_ROOT)\GfxDisplay
+ $(EFI_SOURCE)\$(PROJECT_RAPID_START_ROOT)\GfxDisplay\Library\Dxe
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)
+
+[libraries.common]
+ EdkGuidLib
+ EdkFrameworkGuidLib
+ EdkFrameworkProtocolLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueBaseLib
+ EdkIIGlueBaseMemoryLib
+ EdkIIGlueDxeReportStatusCodeLib
+ EdkIIGlueDxeServicesTableLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiDevicePathLib
+ EdkIIGlueBasePciLibPciExpress
+ EdkProtocolLib
+ RapidStartProtocolLib
+ RapidStartGuidLib
+ RapidStartDxeLib
+ PchPlatformLib
+ RapidStartCommonLib
+ RapidStartGuidLib
+ RcFviDxeLib
+ GfxDisplayLibDxe
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = RapidStartDxe.dxs
+
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=RapidStartDxeEntryPoint
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_BASE_LIB__ \
+ -D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ -D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+ -DRAPID_START_USE_OLD_ACPI_VARIABLE_SET
+
diff --git a/ReferenceCode/RapidStart/Dxe/RapidStartDxe.mak b/ReferenceCode/RapidStart/Dxe/RapidStartDxe.mak
new file mode 100644
index 0000000..f35b941
--- /dev/null
+++ b/ReferenceCode/RapidStart/Dxe/RapidStartDxe.mak
@@ -0,0 +1,130 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2012, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+# $Header: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/RapidStartDxe/RapidStartDxe.mak 3 10/15/12 5:41a Bensonlai $
+#
+# $Revision: 3 $
+#
+# $Date: 10/15/12 5:41a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/RapidStartDxe/RapidStartDxe.mak $
+#
+# 3 10/15/12 5:41a Bensonlai
+# [Category] Improvement
+# [Severity] Important
+# [Description] Rename all IFFS sting to Rapid Start.
+# [Files] Board\EM\RapidStartWrapper\*.*, ReferenceCode\RapidStart\*.*
+#
+# 2 9/26/12 3:28a Yurenlai
+# [TAG] None
+# [Category] Improvement
+# [Severity] Important
+# [Description] Update Intel Rapid Start Technology Framework Reference
+# Code Beta Version 0.7.0.
+# [Description] ReferenceCode\RapidStart\*.*, RapidStartPeiLib.h
+#
+# 1 4/19/12 8:03a Yurenlai
+# Initial check in.
+#
+#*************************************************************************
+
+all : RapidStartDxe
+
+RapidStartDxe : $(BUILD_DIR)\RapidStartDxe.mak RapidStartDxe_Bin
+
+$(BUILD_DIR)\RapidStartDxe.mak : $(RapidStartDxe_DIR)\$(@B).cif $(RapidStartDxe_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(RapidStartDxe_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+RapidStartDxe_INCLUDES=\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(EDK_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+ $(PROJECT_INCLUDES)\
+ $(MISCFRAMEWORK_INCLUDES)\
+ $(PLATFORM_INFO_PROTOCOL_INCLUDES)\
+ $(INTEL_MCH_INCLUDES)\
+ $(NB_INCLUDES)\
+ $(ME_INCLUDES)\
+ /I$(GfxDisplayLibDxe_DIR)\
+ $(RAPIDSTART_INCLUDES)\
+ /I$(IntelPlatformProtocolLib_DIR)\
+
+RapidStartDxe_LIBS=\
+ $(EDKPROTOCOLLIB)\
+ $(INTEL_PCH_PROTOCOL_LIB)\
+ $(EFIGUIDLIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(EDKFRAMEWORKGUIDLIB)\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGlueDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueDxeServicesTableLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueUefiDevicePathLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(EdkIIGlueEdkDxeRuntimeDriverLib_LIB)\
+ $(RapidStartProtocolLib_LIB)\
+ $(RapidStartGuidLib_LIB)\
+ $(RapidStartDxeLib_LIB)\
+ $(PchPlatformDxeLib_LIB)\
+ $(RapidStartCommonSmmLib_LIB)\
+ $(RcFviDxeLib_LIB)\
+ $(GfxDisplayLibDxe_LIB)\
+
+RapidStartDxe_DEFINES=\
+ $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=RapidStartDxeEntryPoint"\
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__\
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+
+RapidStartDxe_Bin : $(RapidStartDxe_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\RapidStartDxe.mak all\
+ "MY_INCLUDES=$(RapidStartDxe_INCLUDES)"\
+ "MY_DEFINES=$(RapidStartDxe_DEFINES)"\
+ GUID=b6b9295f-cabf-4cec-bb14-fe4246f2173a\
+ ENTRY_POINT=_ModuleEntryPoint \
+ EDKIIModule=DXEDRIVER\
+ TYPE=BS_DRIVER \
+ DEPEX1=$(RapidStartDxe_DIR)\RapidStartDxe.dxs \
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \
+ COMPRESS=1\
+
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2012, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/RapidStart/Dxe/RapidStartDxe.sdl b/ReferenceCode/RapidStart/Dxe/RapidStartDxe.sdl
new file mode 100644
index 0000000..e3c4657
--- /dev/null
+++ b/ReferenceCode/RapidStart/Dxe/RapidStartDxe.sdl
@@ -0,0 +1,68 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+# $Header: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/RapidStartDxe/RapidStartDxe.sdl 1 4/19/12 8:03a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 4/19/12 8:03a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/RapidStartDxe/RapidStartDxe.sdl $
+#
+# 1 4/19/12 8:03a Yurenlai
+# Initial check in.
+#
+#*************************************************************************
+TOKEN
+ Name = "RapidStartDxe_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+ Help = "Main switch to enable FFS support in Project in DXE Phase"
+End
+
+MODULE
+ File = "RapidStartDxe.mak"
+ Help = "Includes RapidStartDxe.mak to Project"
+End
+
+PATH
+ Name = "RapidStartDxe_DIR"
+ Help = "RapidStartDxe Dir"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\RapidStartDxe.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Dxe/DxeFfsGfxDriver.cif b/ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Dxe/DxeFfsGfxDriver.cif
new file mode 100644
index 0000000..5659101
--- /dev/null
+++ b/ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Dxe/DxeFfsGfxDriver.cif
@@ -0,0 +1,11 @@
+<component>
+ name = "DxeFfsGfxDriver"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\RapidStart\GfxDisplay\FfsGfxDriver\Dxe\"
+ RefName = "DxeFfsGfxDriver"
+[files]
+"DxeFfsGfxDriver.efi"
+"DxeFfsGfxDriver.inf"
+"DxeFfsGfxDriver.mak"
+"DxeFfsGfxDriver.sdl"
+<endComponent>
diff --git a/ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Dxe/DxeFfsGfxDriver.efi b/ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Dxe/DxeFfsGfxDriver.efi
new file mode 100644
index 0000000..85a94b1
--- /dev/null
+++ b/ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Dxe/DxeFfsGfxDriver.efi
Binary files differ
diff --git a/ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Dxe/DxeFfsGfxDriver.inf b/ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Dxe/DxeFfsGfxDriver.inf
new file mode 100644
index 0000000..3e7d772
--- /dev/null
+++ b/ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Dxe/DxeFfsGfxDriver.inf
@@ -0,0 +1,36 @@
+## @file
+# Component description file for DxeFfsGfxDriver.
+#
+#@copyright
+# Copyright (c) 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains an 'Intel Peripheral Driver' and uniquely
+# identified as "Intel Reference Module" and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+
+[defines]
+BASE_NAME = DxeFfsGfxDriver
+FILE_GUID = 6FD1DCC5-B5B9-4a82-8728-8D854428A4A3
+COMPONENT_TYPE = BS_DRIVER
+BUILD_TYPE = BS_DRIVER_EFI
+
+[sources.common]
+
+[includes.common]
+ $(EDK_SOURCE)\Foundation\Efi
+ $(EDK_SOURCE)\Foundation\Include
+ $(EDK_SOURCE)\Foundation\Efi\Include
+ $(EDK_SOURCE)\Foundation\Framework\Include
+
+[nmake.common]
diff --git a/ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Dxe/DxeFfsGfxDriver.mak b/ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Dxe/DxeFfsGfxDriver.mak
new file mode 100644
index 0000000..96ec790
--- /dev/null
+++ b/ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Dxe/DxeFfsGfxDriver.mak
@@ -0,0 +1,72 @@
+#**********************************************************************
+#**********************************************************************
+#** **
+#** (C)Copyright 1985-2012, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#**********************************************************************
+#**********************************************************************
+
+#**********************************************************************
+# $Header: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/DxeFfsGfxDriver/DxeFfsGfxDriver.mak 1 10/15/12 5:02a Bensonlai $
+#
+# $Revision: 1 $
+#
+# $Date: 10/15/12 5:02a $
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/DxeFfsGfxDriver/DxeFfsGfxDriver.mak $
+#
+# 1 10/15/12 5:02a Bensonlai
+# [TAG] None
+# [Category] Improvement
+# [Description] [Category] Improvement
+# [Severity] Important
+# [Description] Update Intel Rapid Start Graphics Driver for Shark Bay
+# Platform 5.0.1.1001, please increase your FV_BB_BLOCKS size if you
+# compile fail that caused by FV_BB size too small.
+# [Files] ReferenceCode\RapidStart\GfxDisplay\FfsGfxDriver\Pei\*.*,
+# ReferenceCode\RapidStart\GfxDisplay\FfsGfxDriver\Dxe\*.*
+#
+#**********************************************************************
+#<AMI_FHDR_START>
+#
+# Name: DxeFfsGfxDriver.mak
+#
+# Description: Component description file for DxeFfsGfxDriver.
+#
+#<AMI_FHDR_END>
+#**********************************************************************
+
+all : DxeFfsGfxDriver
+
+DxeFfsGfxDriver : $(BUILD_DIR)\DxeFfsGfxDriver.ffs
+
+$(BUILD_DIR)\DxeFfsGfxDriver.ffs : $(DxeFfsGfxDriver_PATH)\DxeFfsGfxDriver.efi
+ $(MAKE) /f Core\FFS.mak \
+ NAME=DxeFfsGfxDriver \
+ BUILD_DIR=$(BUILD_DIR) \
+ SOURCE_DIR=$(DxeFfsGfxDriver_PATH) \
+ GUID=6FD1DCC5-B5B9-4a82-8728-8D854428A4A3 \
+ TYPE=EFI_FV_FILETYPE_DRIVER \
+ PEFILE=$** FFSFILE=$@ COMPRESS=1 NAME=$(**B)
+
+#**********************************************************************
+#**********************************************************************
+#** **
+#** (C)Copyright 1985-2012, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#**********************************************************************
+#**********************************************************************
diff --git a/ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Dxe/DxeFfsGfxDriver.sdl b/ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Dxe/DxeFfsGfxDriver.sdl
new file mode 100644
index 0000000..21295e4
--- /dev/null
+++ b/ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Dxe/DxeFfsGfxDriver.sdl
@@ -0,0 +1,85 @@
+#**********************************************************************
+#**********************************************************************
+#** **
+#** (C)Copyright 1985-2012, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#**********************************************************************
+#**********************************************************************
+
+#**********************************************************************
+# $Header: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/DxeFfsGfxDriver/DxeFfsGfxDriver.sdl 1 10/15/12 5:02a Bensonlai $
+#
+# $Revision: 1 $
+#
+# $Date: 10/15/12 5:02a $
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/DxeFfsGfxDriver/DxeFfsGfxDriver.sdl $
+#
+# 1 10/15/12 5:02a Bensonlai
+# [TAG] None
+# [Category] Improvement
+# [Description] [Category] Improvement
+# [Severity] Important
+# [Description] Update Intel Rapid Start Graphics Driver for Shark Bay
+# Platform 5.0.1.1001, please increase your FV_BB_BLOCKS size if you
+# compile fail that caused by FV_BB size too small.
+# [Files] ReferenceCode\RapidStart\GfxDisplay\FfsGfxDriver\Pei\*.*,
+# ReferenceCode\RapidStart\GfxDisplay\FfsGfxDriver\Dxe\*.*
+#
+#**********************************************************************
+#<AMI_FHDR_START>
+#
+# Name: DxeFfsGfxDriver.sdl
+#
+# Description: SDL file for DxeFfsGfxDriver.
+#
+#<AMI_FHDR_END>
+#**********************************************************************
+
+TOKEN
+ Name = "DxeFfsGfxDriver_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+ Help = "Main switch to enable FFS support in Project in DXE Phase"
+End
+
+MODULE
+ Help = "Includes DxeFfsGfxDriver.mak to Project"
+ File = "DxeFfsGfxDriver.mak"
+End
+
+PATH
+ Name = "DxeFfsGfxDriver_PATH"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\DxeFfsGfxDriver.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+
+#**********************************************************************
+#**********************************************************************
+#** **
+#** (C)Copyright 1985-2012, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#**********************************************************************
+#**********************************************************************
diff --git a/ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Pei/PeiGfxDriver.cif b/ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Pei/PeiGfxDriver.cif
new file mode 100644
index 0000000..5237f31
--- /dev/null
+++ b/ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Pei/PeiGfxDriver.cif
@@ -0,0 +1,12 @@
+<component>
+ name = "PeiGfxDriver"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\RapidStart\GfxDisplay\FfsGfxDriver\Pei\"
+ RefName = "PeiGfxDriver"
+[files]
+"PeiGfxDriver.efi"
+"PeiGfxDriver.dxs"
+"PeiGfxDriver.mak"
+"PeiGfxDriver.sdl"
+"PeiGfxDriver.inf"
+<endComponent>
diff --git a/ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Pei/PeiGfxDriver.dxs b/ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Pei/PeiGfxDriver.dxs
new file mode 100644
index 0000000..ec5b4d5
--- /dev/null
+++ b/ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Pei/PeiGfxDriver.dxs
@@ -0,0 +1,32 @@
+/** @file
+ Dependency expression source file.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+
+#include "EfiDepex.h"
+//AMI_OVERRIDE_FOR_RAPID_START
+//#include EFI_PPI_CONSUMER (MemoryDiscovered)
+//AMI_OVERRIDE_FOR_RAPID_START
+
+DEPENDENCY_START
+//AMI_OVERRIDE_FOR_RAPID_START
+// PEI_PERMANENT_MEMORY_INSTALLED_PPI_GUID
+//AMI_OVERRIDE_FOR_RAPID_START
+ TRUE
+DEPENDENCY_END
diff --git a/ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Pei/PeiGfxDriver.efi b/ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Pei/PeiGfxDriver.efi
new file mode 100644
index 0000000..e7f6ff1
--- /dev/null
+++ b/ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Pei/PeiGfxDriver.efi
Binary files differ
diff --git a/ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Pei/PeiGfxDriver.inf b/ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Pei/PeiGfxDriver.inf
new file mode 100644
index 0000000..5ba2eba
--- /dev/null
+++ b/ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Pei/PeiGfxDriver.inf
@@ -0,0 +1,40 @@
+## @file
+# Component description file for PeiGfxDriver.
+#
+#@copyright
+# Copyright (c) 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains an 'Intel Peripheral Driver' and uniquely
+# identified as "Intel Reference Module" and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+
+[defines]
+BASE_NAME = PeiGfxDriver
+FILE_GUID = B9846521-FF99-4953-8FA2-85C9ADCCE5AF
+COMPONENT_TYPE = PE32_PEIM
+BUILD_TYPE = BS_DRIVER_EFI
+
+[sources.common]
+
+[includes.common]
+ $(EDK_SOURCE)\Foundation\Efi
+ $(EDK_SOURCE)\Foundation\Include
+ $(EDK_SOURCE)\Foundation\Efi\Include
+ $(EDK_SOURCE)\Foundation\Framework
+ $(EDK_SOURCE)\Foundation\Framework\Include
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = PeiGfxDriverEntry
+ DPX_SOURCE=PeiGfxDriver.dxs
+
diff --git a/ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Pei/PeiGfxDriver.mak b/ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Pei/PeiGfxDriver.mak
new file mode 100644
index 0000000..d811ffc
--- /dev/null
+++ b/ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Pei/PeiGfxDriver.mak
@@ -0,0 +1,79 @@
+#**********************************************************************
+#**********************************************************************
+#** **
+#** (C)Copyright 1985-2012, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#**********************************************************************
+#**********************************************************************
+
+#**********************************************************************
+# $Header: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/PeiGfxDriver/PeiGfxDriver.mak 1 10/15/12 4:46a Bensonlai $
+#
+# $Revision: 1 $
+#
+# $Date: 10/15/12 4:46a $
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/PeiGfxDriver/PeiGfxDriver.mak $
+#
+# 1 10/15/12 4:46a Bensonlai
+# [TAG] None
+# [Category] Improvement
+# [Description] [Category] Improvement
+# [Severity] Important
+# [Description] Update Intel Rapid Start Graphics Driver for Shark Bay
+# Platform 5.0.1.1001, please increase your FV_BB_BLOCKS size if you
+# compile fail that caused by FV_BB size too small.
+# [Files] ReferenceCode\RapidStart\GfxDisplay\FfsGfxDriver\Pei\*.*,
+# ReferenceCode\RapidStart\GfxDisplay\FfsGfxDriver\Dxe\*.*
+#
+#**********************************************************************
+#<AMI_FHDR_START>
+#
+# Name: PeiGfxDriver.mak
+#
+# Description: Component description file for PeiGfxDriver.
+#
+#<AMI_FHDR_END>
+#**********************************************************************
+
+all : PeiGfxDriver
+
+PeiGfxDriver : $(BUILD_DIR)\PeiGfxDriver.ffs
+
+PeiGfxDriver_INCLUDES=\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(EDK_INCLUDES)
+
+$(BUILD_DIR)\PeiGfxDriver.ffs : $(PeiGfxDriver_PATH)\PeiGfxDriver.efi
+ $(MAKE) $(EDKIIGLUE_DEFAULTS) /f Core\FFS.mak \
+ CPFLAGS="$(GLOBAL_DEFINES) /D TIANO_RELEASE_VERSION=0x00080006 $(EXTRA_DEFINES) $(PeiGfxDriver_INCLUDES)" \
+ NAME=PeiGfxDriver \
+ BUILD_DIR=$(BUILD_DIR) \
+ SOURCE_DIR=$(PeiGfxDriver_PATH) \
+ GUID=B9846521-FF99-4953-8FA2-85C9ADCCE5AF \
+ TYPE=EFI_FV_FILETYPE_PEIM \
+ EDKIIModule=EFI_FV_FILETYPE_PEIM\
+ DEPEX1=$(PeiGfxDriver_PATH)\PeiGfxDriver.dxs DEPEX1_TYPE=EFI_SECTION_PEI_DEPEX \
+ PEFILE=$** FFSFILE=$@ COMPRESS=0 NAME=$(**B)
+
+#**********************************************************************
+#**********************************************************************
+#** **
+#** (C)Copyright 1985-2012, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#**********************************************************************
+#**********************************************************************
diff --git a/ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Pei/PeiGfxDriver.sdl b/ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Pei/PeiGfxDriver.sdl
new file mode 100644
index 0000000..a40e3d2
--- /dev/null
+++ b/ReferenceCode/RapidStart/GfxDisplay/FfsGfxDriver/Pei/PeiGfxDriver.sdl
@@ -0,0 +1,84 @@
+#**********************************************************************
+#**********************************************************************
+#** **
+#** (C)Copyright 1985-2012, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#**********************************************************************
+#**********************************************************************
+
+#**********************************************************************
+# $Header: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/PeiGfxDriver/PeiGfxDriver.sdl 1 10/15/12 4:56a Bensonlai $
+#
+# $Revision: 1 $
+#
+# $Date: 10/15/12 4:56a $
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/PeiGfxDriver/PeiGfxDriver.sdl $
+#
+# 1 10/15/12 4:56a Bensonlai
+# [TAG] None
+# [Category] Improvement
+# [Description] [Category] Improvement
+# [Severity] Important
+# [Description] Update Intel Rapid Start Graphics Driver for Shark Bay
+# Platform 5.0.1.1001, please increase your FV_BB_BLOCKS size if you
+# compile fail that caused by FV_BB size too small.
+# [Files] ReferenceCode\RapidStart\GfxDisplay\FfsGfxDriver\Pei\*.*,
+# ReferenceCode\RapidStart\GfxDisplay\FfsGfxDriver\Dxe\*.*
+#
+#**********************************************************************
+#<AMI_FHDR_START>
+#
+# Name: PeiGfxDriver.sdl
+#
+# Description: SDL file for PeiGfxDriver.
+#
+#<AMI_FHDR_END>
+#**********************************************************************
+
+TOKEN
+ Name = "PeiGfxDriver_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable PeiGfxDriver support in Project"
+ TokenType = Boolean
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+End
+
+MODULE
+ Help = "Includes PeiGfxDriver.mak to Project"
+ File = "PeiGfxDriver.mak"
+End
+
+PATH
+ Name = "PeiGfxDriver_PATH"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\PeiGfxDriver.ffs"
+ Parent = "FV_BB"
+ InvokeOrder = AfterParent
+End
+
+#**********************************************************************
+#**********************************************************************
+#** **
+#** (C)Copyright 1985-2012, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#**********************************************************************
+#**********************************************************************
diff --git a/ReferenceCode/RapidStart/GfxDisplay/Library/Dxe/GfxDisplayLibDxe.c b/ReferenceCode/RapidStart/GfxDisplay/Library/Dxe/GfxDisplayLibDxe.c
new file mode 100644
index 0000000..8a1c156
--- /dev/null
+++ b/ReferenceCode/RapidStart/GfxDisplay/Library/Dxe/GfxDisplayLibDxe.c
@@ -0,0 +1,141 @@
+/** @file
+ Implementation file for GfxDisplay Dxe functionality
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "RapidStartData.h"
+#include EFI_PROTOCOL_PRODUCER (DxeGfxProtocol)
+#include EFI_PROTOCOL_DEPENDENCY (RapidStartGlobalNvsArea)
+#include EFI_PROTOCOL_CONSUMER (RapidStartPlatformPolicy)
+#include EFI_PROTOCOL_DEPENDENCY (IgdOpRegion)
+
+#define BDS_ALL_DRIVERS_CONNECTED_PROTOCOL_GUID \
+ {0xdbc9fd21, 0xfad8, 0x45b0, 0x9e, 0x78, 0x27, 0x15, 0x88, 0x67, 0xcc, 0x93}
+
+#define EFI_CONSOLE_CONTROL_PROTOCOL_GUID \
+ {0xf42f7782, 0x12e, 0x4c12, 0x99, 0x56, 0x49, 0xf9, 0x43, 0x4, 0xf7, 0x21}
+
+EFI_GUID gEfiConsoleControlProtocolGuid = BDS_ALL_DRIVERS_CONNECTED_PROTOCOL_GUID;
+
+#endif
+
+//
+// Internal function for GfxDisplayLib used only
+//
+/**
+ Event callback to get screen shot for RapidStart exit
+
+ @param[in] Event - The event that triggered this notification function
+ @param[in] Context - Pointer to the notification functions context
+**/
+STATIC
+VOID
+RapidStartDisplayScreenCallback (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ EFI_STATUS Status, IgdOpRegionStatus;
+ VOID *ProtocolPointer;
+ DXE_GFX_PROTOCOL *DxeGfxProtocol;
+ RAPID_START_PLATFORM_POLICY_PROTOCOL *RapidStartPolicy;
+ RAPID_START_GLOBAL_NVS_AREA_PROTOCOL *RapidStartGlobalNvsAreaProtocol;
+ RAPID_START_PERSISTENT_DATA *RapidStartData;
+ IGD_OPREGION_PROTOCOL *IgdOpRegion;
+
+ //
+ // Check whether this is real protocal callback notification, or just a SignalEvent
+ //
+ Status = gBS->LocateProtocol (&gEfiConsoleControlProtocolGuid, NULL, &ProtocolPointer);
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+
+ //
+ // Locate RapidStart platform policy.
+ //
+ Status = gBS->LocateProtocol (&gRapidStartPlatformPolicyProtocolGuid, NULL, &RapidStartPolicy);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "No RapidStart Platform Policy Protocol available\n"));
+ return;
+ }
+
+ Status = gBS->LocateProtocol (&gRapidStartGlobalNvsAreaProtocolGuid, NULL, &RapidStartGlobalNvsAreaProtocol);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_INFO, "No RapidStart info protocol available\n"));
+ return;
+ }
+
+ RapidStartData = RapidStartGlobalNvsAreaProtocol->RapidStartData;
+
+ IgdOpRegionStatus = gBS->LocateProtocol (&gIgdOpRegionProtocolGuid, NULL, &IgdOpRegion);
+ if (!EFI_ERROR (IgdOpRegionStatus)) {
+ IgdOpRegion->OpRegion->MBox3.FDSP = RapidStartData->DssAddress;
+ IgdOpRegion->OpRegion->MBox3.FDSS = (UINT32)(RapidStartData->DssSize);
+ }
+
+ if (RapidStartPolicy->DisplaySaveRestore == 1) {
+ Status = gBS->LocateProtocol (&gDxeGfxProtocolGuid, NULL, &DxeGfxProtocol);
+ DEBUG ((EFI_D_INFO, "RapidStartDisplayScreenCallback():Locating DxeGfxProtocol - Status = %r\n", Status));
+ if (!EFI_ERROR(Status)) {
+ if (RapidStartPolicy->DisplayType == BIOS_RESTORE) {
+ Status = DxeGfxProtocol->SaveDisplay(NULL);
+ } else {
+ Status = DxeGfxProtocol->SaveDisplay((UINT8*)(UINTN)((RapidStartData)->DssAddress));
+ }
+ }
+ }
+
+ gBS->CloseEvent (Event);
+}
+
+//
+// Interface functions of GfxDisplayLib
+//
+/**
+ Install EFI_CONSOLE_CONTROL_PROTOCOL_GUID callback handler.
+**/
+VOID
+RegisterForRapidStartDisplayScreenCallback (
+ VOID
+ )
+{
+ EFI_EVENT Event;
+
+ //
+ // Create an EFI_CONSOLE_CONTROL_PROTOCOL_GUID protocol call back event, to capture splash screen.
+ //
+ EfiCreateProtocolNotifyEvent (
+ &gEfiConsoleControlProtocolGuid,
+ EFI_TPL_CALLBACK,
+ RapidStartDisplayScreenCallback,
+ NULL,
+ &Event
+ );
+}
diff --git a/ReferenceCode/RapidStart/GfxDisplay/Library/Dxe/GfxDisplayLibDxe.cif b/ReferenceCode/RapidStart/GfxDisplay/Library/Dxe/GfxDisplayLibDxe.cif
new file mode 100644
index 0000000..f97cd70
--- /dev/null
+++ b/ReferenceCode/RapidStart/GfxDisplay/Library/Dxe/GfxDisplayLibDxe.cif
@@ -0,0 +1,12 @@
+<component>
+ name = "GfxDisplayLibDxe"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\RapidStart\GfxDisplay\Library\Dxe\"
+ RefName = "GfxDisplayLibDxe"
+[files]
+"GfxDisplayLibDxe.sdl"
+"GfxDisplayLibDxe.mak"
+"GfxDisplayLibDxe.c"
+"GfxDisplayLibDxe.h"
+"GfxDisplayLibDxe.inf"
+<endComponent>
diff --git a/ReferenceCode/RapidStart/GfxDisplay/Library/Dxe/GfxDisplayLibDxe.h b/ReferenceCode/RapidStart/GfxDisplay/Library/Dxe/GfxDisplayLibDxe.h
new file mode 100644
index 0000000..59fd7a5
--- /dev/null
+++ b/ReferenceCode/RapidStart/GfxDisplay/Library/Dxe/GfxDisplayLibDxe.h
@@ -0,0 +1,29 @@
+/** @file
+ Header file for GfxDisplay functionality
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _DXE_GFX_DISPLAY_LIB_H_
+#define _DXE_GFX_DISPLAY_LIB_H_
+
+VOID
+RegisterForRapidStartDisplayScreenCallback (
+ VOID
+ );
+
+#endif
diff --git a/ReferenceCode/RapidStart/GfxDisplay/Library/Dxe/GfxDisplayLibDxe.inf b/ReferenceCode/RapidStart/GfxDisplay/Library/Dxe/GfxDisplayLibDxe.inf
new file mode 100644
index 0000000..c9cc81b
--- /dev/null
+++ b/ReferenceCode/RapidStart/GfxDisplay/Library/Dxe/GfxDisplayLibDxe.inf
@@ -0,0 +1,58 @@
+## @file
+# Component description file for GfxDisplay Library functions for Dxe
+#
+#@copyright
+# Copyright (c) 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = GfxDisplayLibDxe
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ GfxDisplayLibDxe.c
+ GfxDisplayLibDxe.h
+
+[includes.common]
+ $(EFI_SOURCE)\$(PROJECT_RAPID_START_ROOT)
+ $(EFI_SOURCE)\$(PROJECT_RAPID_START_ROOT)\Include
+ $(EFI_SOURCE)\$(PROJECT_SA_ROOT)
+
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EDK_SOURCE)\Foundation
+ $(EDK_SOURCE)\Foundation\Core\Dxe
+ $(EDK_SOURCE)\Foundation\Efi
+ $(EDK_SOURCE)\Foundation\Efi\Include
+ $(EDK_SOURCE)\Foundation\Framework
+ $(EDK_SOURCE)\Foundation\Framework\Include
+ $(EDK_SOURCE)\Foundation\Include
+ $(EDK_SOURCE)\Foundation\Include\IndustryStandard
+ $(EDK_SOURCE)\Foundation\Include\Pei
+ $(EDK_SOURCE)\Foundation\Library\Dxe\Include
+ $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\Include
+
+[libraries.common]
+ EdkFrameworkProtocolLib
+ EdkIIGlueBaseMemoryLib
+ EdkIIGlueDxeFirmwarePerformanceLib
+ RapidStartProtocolLib
+ IntelSaProtocolLib
+
+[nmake.common]
+ C_FLAGS = $(C_FLAGS) /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__
diff --git a/ReferenceCode/RapidStart/GfxDisplay/Library/Dxe/GfxDisplayLibDxe.mak b/ReferenceCode/RapidStart/GfxDisplay/Library/Dxe/GfxDisplayLibDxe.mak
new file mode 100644
index 0000000..02f32f7
--- /dev/null
+++ b/ReferenceCode/RapidStart/GfxDisplay/Library/Dxe/GfxDisplayLibDxe.mak
@@ -0,0 +1,76 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2012, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+# $Header: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/GfxDisplayLibDxe/GfxDisplayLibDxe.mak 2 10/15/12 5:11a Bensonlai $
+#
+# $Revision: 2 $
+#
+# $Date: 10/15/12 5:11a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/GfxDisplayLibDxe/GfxDisplayLibDxe.mak $
+#
+# 2 10/15/12 5:11a Bensonlai
+# [Category] Improvement
+# [Severity] Important
+# [Description] Update Intel Rapid Start Graphics Driver for Shark Bay
+# Platform 5.0.1.1001, please increase your FV_BB_BLOCKS size if you
+# compile fail that caused by FV_BB size too small.
+# [Files] ReferenceCode\RapidStart\GfxDisplay\FfsGfxDriver\Pei\*.*,
+# ReferenceCode\RapidStart\GfxDisplay\FfsGfxDriver\Dxe\*.*
+#
+# 1 9/26/12 3:51a Yurenlai
+# [TAG] None
+# [Category] Improvement
+# [Severity] Important
+# [Description] Update Intel Rapid Start Technology Framework Reference
+# Code Beta Version 0.7.0.
+# [Description] ReferenceCode\RapidStart\*.*, RapidStartPeiLib.h
+#
+#*************************************************************************
+
+all : GfxDisplayLibDxe
+
+$(GfxDisplayLibDxe_LIB) : GfxDisplayLibDxe
+
+GfxDisplayLibDxe : $(BUILD_DIR)\GfxDisplayLibDxe.mak GfxDisplayLibDxeBin
+
+$(BUILD_DIR)\GfxDisplayLibDxe.mak : $(GfxDisplayLibDxe_DIR)\$(@B).cif $(GfxDisplayLibDxe_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(GfxDisplayLibDxe_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+GfxDisplayLibDxe_INCLUDES =\
+ $(EDK_INCLUDES)\
+ $(RAPIDSTART_INCLUDES)\
+ $(INTEL_MCH_INCLUDES)\
+
+GfxDisplayLibDxeBin : $(INTEL_SA_PROTOCOL_LIB)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\GfxDisplayLibDxe.mak all\
+ "MY_INCLUDES=$(GfxDisplayLibDxe_INCLUDES)" \
+ TYPE=LIBRARY
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2012, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/RapidStart/GfxDisplay/Library/Dxe/GfxDisplayLibDxe.sdl b/ReferenceCode/RapidStart/GfxDisplay/Library/Dxe/GfxDisplayLibDxe.sdl
new file mode 100644
index 0000000..7c590da
--- /dev/null
+++ b/ReferenceCode/RapidStart/GfxDisplay/Library/Dxe/GfxDisplayLibDxe.sdl
@@ -0,0 +1,77 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+# $Header: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/GfxDisplayLibDxe/GfxDisplayLibDxe.sdl 1 9/26/12 3:51a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 9/26/12 3:51a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/GfxDisplayLibDxe/GfxDisplayLibDxe.sdl $
+#
+# 1 9/26/12 3:51a Yurenlai
+# [TAG] None
+# [Category] Improvement
+# [Severity] Important
+# [Description] Update Intel Rapid Start Technology Framework Reference
+# Code Beta Version 0.7.0.
+# [Description] ReferenceCode\RapidStart\*.*, RapidStartPeiLib.h
+#
+#*************************************************************************
+TOKEN
+ Name = "GfxDisplayLibDxe_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable GfxDisplayLibDxe support in Project"
+End
+
+PATH
+ Name = "GfxDisplayLibDxe_DIR"
+ Help = "GfxDisplayLibDxe file source directory"
+End
+
+MODULE
+ File = "GfxDisplayLibDxe.mak"
+ Help = "Includes GfxDisplayLibDxe.mak to Project"
+End
+
+ELINK
+ Name = "GfxDisplayLibDxe_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\GfxDisplayLibDxe.lib"
+ Parent = "GfxDisplayLibDxe_LIB"
+ InvokeOrder = AfterParent
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/RapidStart/GfxDisplay/Library/Pei/GfxDisplayLibPei.c b/ReferenceCode/RapidStart/GfxDisplay/Library/Pei/GfxDisplayLibPei.c
new file mode 100644
index 0000000..a7c05b2
--- /dev/null
+++ b/ReferenceCode/RapidStart/GfxDisplay/Library/Pei/GfxDisplayLibPei.c
@@ -0,0 +1,55 @@
+/** @file
+ Implementation file for GfxDisplay Pei functionality
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#include "GfxDisplayLibPei.h"
+#include EFI_PPI_DEFINITION (PeiGfxPpi)
+#endif
+
+/**
+ This function allows the platform to restore the display to the Display Save State.
+
+ @retval EFI_SUCCESS - RapidStartGfxDisplayScreen succeeded
+ @retval EFI_INVALID_PARAMETER - Invalid Parameter
+ @retval EFI_NOT_FOUND - Display Save State Header Signature failed
+**/
+EFI_STATUS
+RapidStartGfxDisplayScreen (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ PEI_GFX_PPI *PeiGfxPpi;
+
+ DEBUG ((EFI_D_INFO, "RapidStartGfxDisplayScreen Start\n"));
+ Status = PeiServicesLocatePpi (&gPeiGfxPpiGuid, 0, NULL, &PeiGfxPpi);
+ ASSERT_EFI_ERROR (Status);
+
+ Status = PeiGfxPpi->RestoreDisplay (GetPeiServicesTablePointer ());
+ DEBUG ((EFI_D_INFO, "Call PeiGfxPpi->RestoreDisplay, Status = %r\n", Status));
+
+ return Status;
+}
diff --git a/ReferenceCode/RapidStart/GfxDisplay/Library/Pei/GfxDisplayLibPei.cif b/ReferenceCode/RapidStart/GfxDisplay/Library/Pei/GfxDisplayLibPei.cif
new file mode 100644
index 0000000..3e8c5f3
--- /dev/null
+++ b/ReferenceCode/RapidStart/GfxDisplay/Library/Pei/GfxDisplayLibPei.cif
@@ -0,0 +1,12 @@
+<component>
+ name = "GfxDisplayLibPei"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\RapidStart\GfxDisplay\Library\Pei\"
+ RefName = "GfxDisplayLibPei"
+[files]
+"GfxDisplayLibPei.sdl"
+"GfxDisplayLibPei.mak"
+"GfxDisplayLibPei.c"
+"GfxDisplayLibPei.h"
+"GfxDisplayLibPei.inf"
+<endComponent>
diff --git a/ReferenceCode/RapidStart/GfxDisplay/Library/Pei/GfxDisplayLibPei.h b/ReferenceCode/RapidStart/GfxDisplay/Library/Pei/GfxDisplayLibPei.h
new file mode 100644
index 0000000..198bfb3
--- /dev/null
+++ b/ReferenceCode/RapidStart/GfxDisplay/Library/Pei/GfxDisplayLibPei.h
@@ -0,0 +1,35 @@
+/** @file
+ Header file for GfxDisplay functionality
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PEI_GFX_DISPLAY_LIB_H_
+#define _PEI_GFX_DISPLAY_LIB_H_
+
+/**
+ This function allows the platform to restore the display to the Display Save State.
+
+ @retval EFI_SUCCESS - RapidStartGfxDisplayScreen succeeded
+ @retval EFI_INVALID_PARAMETER - Invalid Parameter
+ @retval EFI_NOT_FOUND - Display Save State Header Signature failed
+**/
+EFI_STATUS
+RapidStartGfxDisplayScreen (
+ VOID
+ );
+#endif
diff --git a/ReferenceCode/RapidStart/GfxDisplay/Library/Pei/GfxDisplayLibPei.inf b/ReferenceCode/RapidStart/GfxDisplay/Library/Pei/GfxDisplayLibPei.inf
new file mode 100644
index 0000000..44ca9fd
--- /dev/null
+++ b/ReferenceCode/RapidStart/GfxDisplay/Library/Pei/GfxDisplayLibPei.inf
@@ -0,0 +1,51 @@
+## @file
+# Component description file for GfxDisplay Library functions for PEIMs
+#
+#@copyright
+# Copyright (c) 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = GfxDisplayLibPei
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ GfxDisplayLibPei.c
+ GfxDisplayLibPei.h
+
+[includes.common]
+ $(EFI_SOURCE)\$(PROJECT_RAPID_START_ROOT)
+
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EDK_SOURCE)\Foundation
+ $(EDK_SOURCE)\Foundation\Core\Dxe
+ $(EDK_SOURCE)\Foundation\Efi
+ $(EDK_SOURCE)\Foundation\Efi\Include
+ $(EDK_SOURCE)\Foundation\Framework
+ $(EDK_SOURCE)\Foundation\Framework\Include
+ $(EDK_SOURCE)\Foundation\Include
+ $(EDK_SOURCE)\Foundation\Include\IndustryStandard
+ $(EDK_SOURCE)\Foundation\Include\Pei
+ $(EDK_SOURCE)\Foundation\Library\Dxe\Include
+ $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\Include
+
+[libraries.common]
+ EdkIIGluePeiServicesLib
+ RapidStartPpiLib
+
+[nmake.common]
+ C_FLAGS = $(C_FLAGS) /D __EDKII_GLUE_PEI_SERVICES_LIB__
diff --git a/ReferenceCode/RapidStart/GfxDisplay/Library/Pei/GfxDisplayLibPei.mak b/ReferenceCode/RapidStart/GfxDisplay/Library/Pei/GfxDisplayLibPei.mak
new file mode 100644
index 0000000..48f1893
--- /dev/null
+++ b/ReferenceCode/RapidStart/GfxDisplay/Library/Pei/GfxDisplayLibPei.mak
@@ -0,0 +1,75 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2012, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+# $Header: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/GfxDisplayLibPei/GfxDisplayLibPei.mak 2 10/15/12 5:07a Bensonlai $
+#
+# $Revision: 2 $
+#
+# $Date: 10/15/12 5:07a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/GfxDisplayLibPei/GfxDisplayLibPei.mak $
+#
+# 2 10/15/12 5:07a Bensonlai
+# [Category] Improvement
+# [Severity] Important
+# [Description] Update Intel Rapid Start Graphics Driver for Shark Bay
+# Platform 5.0.1.1001, please increase your FV_BB_BLOCKS size if you
+# compile fail that caused by FV_BB size too small.
+# [Files] ReferenceCode\RapidStart\GfxDisplay\FfsGfxDriver\Pei\*.*,
+# ReferenceCode\RapidStart\GfxDisplay\FfsGfxDriver\Dxe\*.*
+#
+# 1 9/26/12 3:53a Yurenlai
+# [TAG] None
+# [Category] Improvement
+# [Severity] Important
+# [Description] Update Intel Rapid Start Technology Framework Reference
+# Code Beta Version 0.7.0.
+# [Description] ReferenceCode\RapidStart\*.*, RapidStartPeiLib.h
+#
+#*************************************************************************
+
+all : GfxDisplayLibPei
+
+$(GfxDisplayLibPei_LIB) : GfxDisplayLibPei
+
+GfxDisplayLibPei : $(BUILD_DIR)\GfxDisplayLibPei.mak GfxDisplayLibPeiBin
+
+$(BUILD_DIR)\GfxDisplayLibPei.mak : $(GfxDisplayLibPei_DIR)\$(@B).cif $(GfxDisplayLibPei_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(GfxDisplayLibPei_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+GfxDisplayLibPei_INCLUDES =\
+ $(EDK_INCLUDES)\
+ $(RAPIDSTART_INCLUDES)\
+
+GfxDisplayLibPeiBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\GfxDisplayLibPei.mak all\
+ "MY_INCLUDES=$(GfxDisplayLibPei_INCLUDES)" \
+ TYPE=PEI_LIBRARY
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2012, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/RapidStart/GfxDisplay/Library/Pei/GfxDisplayLibPei.sdl b/ReferenceCode/RapidStart/GfxDisplay/Library/Pei/GfxDisplayLibPei.sdl
new file mode 100644
index 0000000..8b78b83
--- /dev/null
+++ b/ReferenceCode/RapidStart/GfxDisplay/Library/Pei/GfxDisplayLibPei.sdl
@@ -0,0 +1,77 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+# $Header: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/GfxDisplayLibPei/GfxDisplayLibPei.sdl 1 9/26/12 3:53a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 9/26/12 3:53a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/GfxDisplayLibPei/GfxDisplayLibPei.sdl $
+#
+# 1 9/26/12 3:53a Yurenlai
+# [TAG] None
+# [Category] Improvement
+# [Severity] Important
+# [Description] Update Intel Rapid Start Technology Framework Reference
+# Code Beta Version 0.7.0.
+# [Description] ReferenceCode\RapidStart\*.*, RapidStartPeiLib.h
+#
+#*************************************************************************
+TOKEN
+ Name = "GfxDisplayLibPei_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable GfxDisplayLibPei support in Project"
+End
+
+PATH
+ Name = "GfxDisplayLibPei_DIR"
+ Help = "GfxDisplayLibPei file source directory"
+End
+
+MODULE
+ File = "GfxDisplayLibPei.mak"
+ Help = "Includes GfxDisplayLibPei.mak to Project"
+End
+
+ELINK
+ Name = "GfxDisplayLibPei_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\GfxDisplayLibPei.lib"
+ Parent = "GfxDisplayLibPei_LIB"
+ InvokeOrder = AfterParent
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/RapidStart/Guid/RapidStartAcpiTableStorage/RapidStartAcpiTableStorage.c b/ReferenceCode/RapidStart/Guid/RapidStartAcpiTableStorage/RapidStartAcpiTableStorage.c
new file mode 100644
index 0000000..bd875b5
--- /dev/null
+++ b/ReferenceCode/RapidStart/Guid/RapidStartAcpiTableStorage/RapidStartAcpiTableStorage.c
@@ -0,0 +1,40 @@
+/** @file
+ The GUID definition for RapidStart ACPI table storage file name
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+//
+// Statements that include other files
+//
+#include "EdkIIGlueDxe.h"
+#include "RapidStartAcpiTableStorage.h"
+
+///
+/// Protocol GUID definition
+///
+EFI_GUID gRapidStartAcpiTableStorageGuid = RAPID_START_ACPI_TABLE_STORAGE_GUID;
+
+///
+/// Protocol description
+///
+EFI_GUID_STRING
+ (
+ &gRapidStartAcpiTableStorageGuid, "RapidStart ACPI Table Storage File Name",
+ "RapidStart ACPI Table Storage file name GUID"
+ );
diff --git a/ReferenceCode/RapidStart/Guid/RapidStartAcpiTableStorage/RapidStartAcpiTableStorage.h b/ReferenceCode/RapidStart/Guid/RapidStartAcpiTableStorage/RapidStartAcpiTableStorage.h
new file mode 100644
index 0000000..fe590e4
--- /dev/null
+++ b/ReferenceCode/RapidStart/Guid/RapidStartAcpiTableStorage/RapidStartAcpiTableStorage.h
@@ -0,0 +1,31 @@
+/** @file
+ GUID definition for the RapidStart ACPI table storage file name
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _RAPID_START_ACPI_TABLE_STORAGE_H_
+#define _RAPID_START_ACPI_TABLE_STORAGE_H_
+
+#define RAPID_START_ACPI_TABLE_STORAGE_GUID \
+ { \
+ 0x60ac3a8f, 0x4d66, 0x4cd4, 0x89, 0x5a, 0xc3, 0xf0, 0x6e, 0x66, 0x65, 0xee \
+ }
+
+extern EFI_GUID gRapidStartAcpiTableStorageGuid;
+
+#endif
diff --git a/ReferenceCode/RapidStart/Guid/RapidStartGuidLib.cif b/ReferenceCode/RapidStart/Guid/RapidStartGuidLib.cif
new file mode 100644
index 0000000..66d2889
--- /dev/null
+++ b/ReferenceCode/RapidStart/Guid/RapidStartGuidLib.cif
@@ -0,0 +1,16 @@
+<component>
+ name = "RapidStartGuidLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\RapidStart\Guid"
+ RefName = "RapidStartGuidLib"
+[files]
+"RapidStartGuidLib.sdl"
+"RapidStartGuidLib.mak"
+"RapidStartGuidLib.inf"
+"RapidStartAcpiTableStorage\RapidStartAcpiTableStorage.c"
+"RapidStartAcpiTableStorage\RapidStartAcpiTableStorage.h"
+"RapidStartPersistentData\RapidStartPersistentData.c"
+"RapidStartPersistentData\RapidStartPersistentData.h"
+"RapidStartTransition\RapidStartTransition.c"
+"RapidStartTransition\RapidStartTransition.h"
+<endComponent>
diff --git a/ReferenceCode/RapidStart/Guid/RapidStartGuidLib.inf b/ReferenceCode/RapidStart/Guid/RapidStartGuidLib.inf
new file mode 100644
index 0000000..d38d2ba
--- /dev/null
+++ b/ReferenceCode/RapidStart/Guid/RapidStartGuidLib.inf
@@ -0,0 +1,60 @@
+## @file
+# Component description file for the GUID library
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains an 'Intel Peripheral Driver' and uniquely
+# identified as "Intel Reference Module" and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+
+[defines]
+BASE_NAME = RapidStartGuidLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ RapidStartAcpiTableStorage/RapidStartAcpiTableStorage.h
+ RapidStartAcpiTableStorage/RapidStartAcpiTableStorage.c
+ RapidStartPersistentData/RapidStartPersistentData.c
+ RapidStartPersistentData/RapidStartPersistentData.h
+ RapidStartTransition/RapidStartTransition.c
+ RapidStartTransition/RapidStartTransition.h
+
+[includes.common]
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EFI_SOURCE)/Include
+ $(EFI_SOURCE)/$(PROJECT_RAPID_START_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_RAPID_START_ROOT)/Include
+
+#
+# Edk II Glue Library, some hearder are included by R9 header so have to include
+#
+
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Framework
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[nmake.common]
+C_STD_INCLUDE=
diff --git a/ReferenceCode/RapidStart/Guid/RapidStartGuidLib.mak b/ReferenceCode/RapidStart/Guid/RapidStartGuidLib.mak
new file mode 100644
index 0000000..398a29a
--- /dev/null
+++ b/ReferenceCode/RapidStart/Guid/RapidStartGuidLib.mak
@@ -0,0 +1,82 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2012, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+# $Header: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/RapidStartGuidLib/RapidStartGuidLib.mak 3 10/15/12 5:40a Bensonlai $
+#
+# $Revision: 3 $
+#
+# $Date: 10/15/12 5:40a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/RapidStartGuidLib/RapidStartGuidLib.mak $
+#
+# 3 10/15/12 5:40a Bensonlai
+# [Category] Improvement
+# [Severity] Important
+# [Description] Rename all IFFS sting to Rapid Start.
+# [Files] Board\EM\RapidStartWrapper\*.*, ReferenceCode\RapidStart\*.*
+#
+# 2 9/26/12 3:31a Yurenlai
+# [TAG] None
+# [Category] Improvement
+# [Severity] Important
+# [Description] Update Intel Rapid Start Technology Framework Reference
+# Code Beta Version 0.7.0.
+# [Description] ReferenceCode\RapidStart\*.*, RapidStartPeiLib.h
+#
+# 1 4/19/12 8:04a Yurenlai
+# Initial check in.
+#
+#*************************************************************************
+all : RapidStartGuidLib
+
+$(RapidStartGuidLib_LIB) : RapidStartGuidLib
+
+RapidStartGuidLib : $(BUILD_DIR)\RapidStartGuidLib.mak RapidStartGuidLibBin
+
+$(BUILD_DIR)\RapidStartGuidLib.mak : $(RapidStartGuidLib_DIR)\$(@B).cif $(RapidStartGuidLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(RapidStartGuidLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+RapidStartGuidLib_INCLUDES =\
+ $(EDK_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(RAPIDSTART_INCLUDES)\
+
+RapidStartGuidLibBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\RapidStartGuidLib.mak all\
+ "MY_INCLUDES=$(RapidStartGuidLib_INCLUDES)" \
+ TYPE=LIBRARY
+!IF "$(x64_BUILD)"=="1"
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS) BUILD_DIR=$(BUILD_DIR)\IA32\
+ /f $(BUILD_DIR)\RapidStartGuidLib.mak all\
+ "MY_INCLUDES=$(RapidStartGuidLib_INCLUDES)" \
+ TYPE=PEI_LIBRARY
+!ENDIF
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2012, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/RapidStart/Guid/RapidStartGuidLib.sdl b/ReferenceCode/RapidStart/Guid/RapidStartGuidLib.sdl
new file mode 100644
index 0000000..8e60134
--- /dev/null
+++ b/ReferenceCode/RapidStart/Guid/RapidStartGuidLib.sdl
@@ -0,0 +1,68 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+# $Header: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/RapidStartGuidLib/RapidStartGuidLib.sdl 1 4/19/12 8:04a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 4/19/12 8:04a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/RapidStartGuidLib/RapidStartGuidLib.sdl $
+#
+# 1 4/19/12 8:04a Yurenlai
+# Initial check in.
+#
+#*************************************************************************
+TOKEN
+ Name = "RapidStartGuidLib_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+ Help = "Main switch to enable iFFS GUID LIB support in Project"
+End
+
+MODULE
+ File = "RapidStartGuidLib.mak"
+ Help = "Includes RapidStartGuidLib.mak to Project"
+End
+
+PATH
+ Name = "RapidStartGuidLib_DIR"
+End
+
+TOKEN
+ Name = "RapidStartGuidLib_LIB"
+ Value = "$$(LIB_BUILD_DIR)\RapidStartGuidLib.lib"
+ TokenType = Expression
+ TargetMAK = Yes
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/RapidStart/Guid/RapidStartPersistentData/RapidStartPersistentData.c b/ReferenceCode/RapidStart/Guid/RapidStartPersistentData/RapidStartPersistentData.c
new file mode 100644
index 0000000..ff51884
--- /dev/null
+++ b/ReferenceCode/RapidStart/Guid/RapidStartPersistentData/RapidStartPersistentData.c
@@ -0,0 +1,27 @@
+/** @file
+ The GUID definition for RapidStart Persistent Data
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "EdkIIGlueDxe.h"
+#include "RapidStartPersistentData.h"
+
+EFI_GUID gRapidStartPersistentDataGuid = RAPID_START_PERSISTENT_DATA_GUID;
+CHAR16 gRapidStartPersistentDataName[] = RAPID_START_PERSISTENT_DATA_NAME;
+
+EFI_GUID_STRING(&gRapidStartPersistentDataGuid, "RapidStart Persistent Data", "RapidStart Persistent Data GUID");
diff --git a/ReferenceCode/RapidStart/Guid/RapidStartPersistentData/RapidStartPersistentData.h b/ReferenceCode/RapidStart/Guid/RapidStartPersistentData/RapidStartPersistentData.h
new file mode 100644
index 0000000..0436e98
--- /dev/null
+++ b/ReferenceCode/RapidStart/Guid/RapidStartPersistentData/RapidStartPersistentData.h
@@ -0,0 +1,41 @@
+/** @file
+ GUID definition for the RapidStart Persistent Data
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _RAPID_START_PERSISTENT_DATA_H_
+#define _RAPID_START_PERSISTENT_DATA_H_
+
+///
+/// Publish GUID/Name definition for platform code to identify if Rapid Start
+/// function is enabled or not. Platform code is able to provide related setup
+/// options for further control and configuration by detecting
+/// RAPID_START_PERSISTENT_DATA_GUID/ RAPID_START_PERSISTENT_DATA_NAME exists or not
+/// in BIOS setup.
+///
+#define RAPID_START_PERSISTENT_DATA_GUID \
+ { \
+ 0xf9f0b131, 0xf346, 0x4f16, 0x80, 0xdd, 0xf9, 0x41, 0x07, 0x2b, 0x3a, 0x7d \
+ }
+
+#define RAPID_START_PERSISTENT_DATA_NAME L"RapidStartData"
+
+extern EFI_GUID gRapidStartPersistentDataGuid;
+extern CHAR16 gRapidStartPersistentDataName[];
+
+#endif
diff --git a/ReferenceCode/RapidStart/Guid/RapidStartTransition/RapidStartTransition.c b/ReferenceCode/RapidStart/Guid/RapidStartTransition/RapidStartTransition.c
new file mode 100644
index 0000000..63ac569
--- /dev/null
+++ b/ReferenceCode/RapidStart/Guid/RapidStartTransition/RapidStartTransition.c
@@ -0,0 +1,40 @@
+/** @file
+ GUIDs used for RapidStart Transition.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+//
+// Statements that include other files
+//
+#include "EdkIIGluePeim.h"
+#include "RapidStartConfig.h"
+#include "RapidStartTransition.h"
+#include EFI_PPI_DEFINITION (PeiGfxPpi)
+
+///
+/// The purpose of this PPI GUID is to trigger the RapidStartTransition
+/// for IBVs can decide the best point to trigger our Rapid Start module.
+///
+#ifdef RAPID_START_ON_START_PPI_INSTALLED
+EFI_GUID gRapidStartTransitionPpiGuid = PEI_RAPID_START_TRANSITION_PPI_GUID;
+#else
+EFI_GUID gRapidStartTransitionPpiGuid = PEI_GFX_PPI_GUID;
+#endif
+
+EFI_GUID_STRING(&gRapidStartTransitionPpiGuid, "RapidStart Transition", "RapidStart Transition GUID");
diff --git a/ReferenceCode/RapidStart/Guid/RapidStartTransition/RapidStartTransition.h b/ReferenceCode/RapidStart/Guid/RapidStartTransition/RapidStartTransition.h
new file mode 100644
index 0000000..ce13472
--- /dev/null
+++ b/ReferenceCode/RapidStart/Guid/RapidStartTransition/RapidStartTransition.h
@@ -0,0 +1,31 @@
+/** @file
+ GUID definition for the RapidStart Transition
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _RAPID_START_TRANSITION_H_
+#define _RAPID_START_TRANSITION_H_
+
+#define PEI_RAPID_START_TRANSITION_PPI_GUID \
+ { \
+ 0xde8f2878, 0x36d5, 0x498e, 0xba, 0x59, 0x16, 0x8c, 0x26, 0x47, 0xb3, 0x35 \
+ }
+
+extern EFI_GUID gRapidStartTransitionPpiGuid;
+
+#endif
diff --git a/ReferenceCode/RapidStart/Include/RapidStartAcpi.dsc b/ReferenceCode/RapidStart/Include/RapidStartAcpi.dsc
new file mode 100644
index 0000000..d4376fa
--- /dev/null
+++ b/ReferenceCode/RapidStart/Include/RapidStartAcpi.dsc
@@ -0,0 +1,69 @@
+## @file
+# Build description file for building the RapidStart ACPI tables
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains an 'Intel Peripheral Driver' and uniquely
+# identified as "Intel Reference Module" and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+
+[=============================================================================]
+#
+# Instructions for building the RapidStart ACPI table storage file
+#
+[=============================================================================]
+[Build.Ia32.RAPID_START_ACPI_TABLES,Build.x64.RAPID_START_ACPI_TABLES]
+#
+# Check if we have any source to work with.
+#
+!IFNDEF SECTIONS
+!IFNDEF ASL_FILES
+!ERROR No ASL source files to build were defined in the INF file
+!ENDIF
+!ENDIF
+
+#
+# Define some macros to simplify changes
+#
+TARGET_FFS_FILE = $(BIN_DIR)\$(FILE_GUID)-$(BASE_NAME).ffs
+
+$(DEST_DIR)\RapidStart.sec : $(ASL_SOURCE_FILES) $(ASL_FILES)
+ $(ASL) $(ASL_FLAGS) $(DEST_DIR)\Ssdt\RapidStart.asl
+ -copy $(DEST_DIR)\Ssdt\RapidStart.aml $(DEST_DIR)\RapidStart.acpi
+ $(GENSECTION) -I $(DEST_DIR)\RapidStart.acpi -O $(DEST_DIR)\RapidStart.sec -S EFI_SECTION_RAW
+
+#
+# Build FFS file
+#
+$(TARGET_FFS_FILE) : $(SECTIONS) $(DEST_DIR)\RapidStart.sec
+ $(GENFFSFILE) -B $(DEST_DIR) -P1 $(DEST_DIR)\$(BASE_NAME).pkg -V
+
+all : $(TARGET_FFS_FILE)
+
+[=============================================================================]
+[Package.RAPID_START_ACPI_TABLES.Default]
+PACKAGE.INF
+\[.]
+BASE_NAME = $(BASE_NAME)
+FFS_FILEGUID = $(FILE_GUID)
+FFS_FILETYPE = EFI_FV_FILETYPE_FREEFORM
+FFS_ATTRIB_CHECKSUM = TRUE
+
+IMAGE_SCRIPT =
+{
+ Compress (Dummy) {
+ $(DEST_DIR)\RapidStart.sec
+ }
+}
diff --git a/ReferenceCode/RapidStart/Include/RapidStartAhciReg.h b/ReferenceCode/RapidStart/Include/RapidStartAhciReg.h
new file mode 100644
index 0000000..8e85370
--- /dev/null
+++ b/ReferenceCode/RapidStart/Include/RapidStartAhciReg.h
@@ -0,0 +1,163 @@
+/** @file
+ Header file for Registers and Structure definitions
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef RAPID_START_AHCIREG_H_
+#define RAPID_START_AHCIREG_H_
+
+#define SECTOR_SIZE 0x200
+#define SECTOR_SHIFT 9
+
+#define MEM_TO_SECT(mem) ((UINT32) RShiftU64 ((mem), SECTOR_SHIFT))
+
+//
+// Known issues with 3rd party SSDs : some 3rd party SSD was not compliant with the ATA spec (transfer size of 0 sector issue)
+// We have seen it on more than one vendor's drive so far,
+// The w/a does not cause performance issue to our code or any special checks
+// #define AHCI_MAX_SECTORS 0x10000
+//
+#define AHCI_MAX_SECTORS 0xFF80
+#define AHCI_MAX_TRANSFER (SECTOR_SIZE * AHCI_MAX_SECTORS)
+
+#define AHCI_NO_DATA 0
+#define AHCI_DIR_HOST2DEV 1
+#define AHCI_DIR_DEV2HOST 0
+
+#define ATA_CMD_IDENTIFY_DEVICE 0xEC
+#define ATA_CMD_READ_DMA_EXT 0x25
+#define ATA_CMD_WRITE_DMA_EXT 0x35
+#define ATA_CMD_WRITE_DMA_FUA_EXT 0x3D
+#define ATA_CMD_STANDBY_IMMEDIATE 0xE0
+#define ATA_CMD_DATA_SET_MANAGEMENT 0x06
+#define V_ATA_TRIM_FEATURE 0x01
+
+#define ATA_CMD_SECURITY_UNLOCK 0xF2
+#define ATA_CMD_SECURITY_FREEZE_LOCK 0xF5
+#define ATA_CMD_SECURITY_SET_PASSWORD 0xF1
+#define ATA_CMD_FLUSH_CACHE 0xE7
+
+#define ATA_CMD_SET_FEATURES 0xEF
+#define V_ATA_FEATURE_ENABLE 0x10
+#define V_ATA_FEATURE_DISABLE 0x90
+#define ATA_CMD_READ_LOG_EXT 0x2F
+
+#define ATA_ID_DEV_HYBRID_FEATURE_SUPPORT 78
+#define B_ATA_ID_DEV_HYBRID_FEATURE_SUPPORT BIT9
+#define ATA_ID_DEV_HYBRID_FEATURE_ENABLE 79
+#define B_ATA_ID_DEV_HYBRID_FEATURE_ENABLE BIT9
+
+#define ATA_ID_DEV_DATA_SET_MGMNT_BLOCKS 105
+#define ATA_ID_DEV_DATA_SET_MGMNT_SUPPORT 169
+#define B_ATA_ID_DEV_DATA_SET_TRIM 0x01
+
+#define ATA_ID_DEV_SECURITY_STATUS 128
+#define B_ATA_ID_DEV_SEC_SUPPORTED 0x01
+#define B_ATA_ID_DEV_SEC_ENABLED 0x02
+#define B_ATA_ID_DEV_SEC_LOCKED 0x04
+#define B_ATA_ID_DEV_SEC_FROZEN 0x08
+#define B_ATA_ID_DEV_SEC_COUNT_EXP 0x10
+
+#define ALIGN(v, a) ((((v) - 1) | ((a) - 1)) + 1)
+
+#define AHCI_HBA_SIZE 0x100
+#define AHCI_PORT_SIZE 0x80
+#define AHCI_PORT_BASE_X(Ahci, port) (Ahci->Abar + AHCI_HBA_SIZE + AHCI_PORT_SIZE * port)
+#define AHCI_PORT_BASE(Ahci) AHCI_PORT_BASE_X (Ahci, Ahci->Port)
+#define AHCI_MAX_CMD 16
+#define AHCI_CMD_HEADER_SIZE 0x20
+#define AHCI_CMD_LIST_BASE(Ahci) (Ahci->PortBase)
+#define AHCI_CMD_LIST_SIZE (AHCI_MAX_CMD * AHCI_CMD_HEADER_SIZE)
+
+#define AHCI_RXFIS_BASE(Ahci) ALIGN ((AHCI_CMD_LIST_BASE (Ahci) + AHCI_CMD_LIST_SIZE), 0x100) ///< align 256
+#define AHCI_RXFIS_SIZE 0x100
+#define AHCI_CMD_TABLE_BASE(Ahci) ALIGN ((AHCI_RXFIS_BASE (Ahci) + AHCI_RXFIS_SIZE), 0x80) ///< align 128
+#define AHCI_CMD_TABLE_HEADER_SIZE 0x80
+#define AHCI_MAX_PRDT 8192 ///< We need 8192 PRT entries of 4KB transfer size for single 32MB command
+#define AHCI_PRD_SIZE 0x10
+#define AHCI_CMD_TABLE_SIZE (AHCI_CMD_TABLE_HEADER_SIZE + AHCI_PRD_SIZE * AHCI_MAX_PRDT)
+
+#define AHCI_CMD_HEADER(Ahci, cmd) (AHCI_CMD_LIST_BASE (Ahci) + (cmd) * AHCI_CMD_HEADER_SIZE)
+#define AHCI_CMD_TABLE(Ahci, cmd) (AHCI_CMD_TABLE_BASE (Ahci) + (cmd) * AHCI_CMD_TABLE_SIZE) ///< align 128
+
+#define AHCI_ID_BLOCK_SIZE SECTOR_SIZE
+#define AHCI_ID_BLOCK(Ahci) (AHCI_CMD_TABLE (Ahci, AHCI_MAX_CMD))
+
+#define AHCI_TMP_BLOCK_SIZE SECTOR_SIZE
+#define AHCI_TMP_BLOCK(Ahci) (AHCI_ID_BLOCK (Ahci) + AHCI_ID_BLOCK_SIZE)
+
+#define AHCI_MEM_MAX(Ahci) (AHCI_TMP_BLOCK (Ahci) + AHCI_TMP_BLOCK_SIZE)
+#define AHCI_MEM_MAX_SIZE (AHCI_TMP_BLOCK_SIZE + \
+ AHCI_ID_BLOCK_SIZE + \
+ AHCI_MAX_CMD * \
+ AHCI_CMD_TABLE_SIZE + \
+ AHCI_RXFIS_SIZE + \
+ AHCI_CMD_LIST_SIZE \
+ )
+
+#define AHCI_INIT_WAIT 10000 ///< us
+#define AHCI_INIT_TIMEOUT 10000000 ///< us
+#define AHCI_INIT_RETRY_COUNT 3
+#define AHCI_CMD_WAIT 100 ///< us
+#define AHCI_CMD_TIMEOUT 20000000 ///< us
+
+#define AHCI_CMD_PRDTL(prdtl) ((prdtl) << 16)
+#define AHCI_CMD_CFL(cfl) ((cfl) & 0x0F)
+#define AHCI_CMD_WRITE BIT6
+#define AHCI_CMD_PREFETCHABLE BIT7
+
+#define AHCI_REGION_MAX 0x400000 ///< 4MB
+#define R_PCH_SATA_AHCI_PXCLB 0x000
+#define R_PCH_SATA_AHCI_PXCLBU 0x004
+#define R_PCH_SATA_AHCI_PXFB 0x008
+#define R_PCH_SATA_AHCI_PXFBU 0x00C
+#define R_PCH_SATA_AHCI_PXIS 0x010
+#define R_PCH_SATA_AHCI_PXIE 0x014
+#define R_PCH_SATA_AHCI_PXCMD 0x018
+#define R_PCH_SATA_AHCI_PXTFD 0x020
+#define B_PCH_SATA_AHCI_PXTFD_STS_ERR BIT0
+#define B_PCH_SATA_AHCI_PXTFD_STS_DRQ BIT3
+#define B_PCH_SATA_AHCI_PXTFD_STS_BSY BIT7
+#define R_PCH_SATA_AHCI_PXSIG 0x024
+#define R_PCH_SATA_AHCI_PXSSTS 0x028
+#define B_PCH_SATA_AHCI_PXSSTS_DET 0x0000000F
+#define R_PCH_SATA_AHCI_PXSCTL 0x02C
+#define R_PCH_SATA_AHCI_PXSERR 0x030
+#define R_PCH_SATA_AHCI_PXSACT 0x034
+#define R_PCH_SATA_AHCI_PXCI 0x038
+
+#define B_PCH_SATA_AHCI_PXIS_FATAL (B_PCH_SATA_AHCI_PXIS_HBFS | \
+ B_PCH_SATA_AHCI_PXIS_HBDS | \
+ B_PCH_SATA_AHCI_PXIS_IFS | \
+ B_PCH_SATA_AHCI_PXIS_TFES | \
+ B_PCH_SATA_AHCI_PXIS_PCS \
+ )
+
+#define AHCI_ERROR(PxBase) ((MmioRead32 ((PxBase) + R_PCH_SATA_AHCI_PXIS) & B_PCH_SATA_AHCI_PXIS_FATAL) != 0)
+
+#define SATA_FIS_HOST2DEVICE 0x27
+#define SATA_FIS_C 0x8000
+#define SATA_FIS_CMD(cmd) (((cmd) & 0xFF) << 16)
+#define SATA_FIS_DEV_LBA 0x40000000
+#define SATA_FIS_LBA(lba) ((UINT32) ((lba) & 0x00FFFFFF))
+#define SATA_FIS_LBA_EXP(lba) ((UINT32) RShiftU64 ((lba), 24) & 0x00FFFFFF)
+#define SATA_FIS_SECT_COUNT(count) ((UINT16) (count))
+#define SATA_FIS_FEAT(feat) ((((UINT16) (feat)) & 0xFF) << 24)
+#define SATA_FIS_FEAT_EXP(feat) ((((UINT16) (feat)) & 0xFF00) << 16)
+
+#endif
diff --git a/ReferenceCode/RapidStart/Include/RapidStartConfig.h b/ReferenceCode/RapidStart/Include/RapidStartConfig.h
new file mode 100644
index 0000000..a290606
--- /dev/null
+++ b/ReferenceCode/RapidStart/Include/RapidStartConfig.h
@@ -0,0 +1,70 @@
+/** @file
+ Header file to define the default build options
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef RAPID_START_CONFIG_H_
+#define RAPID_START_CONFIG_H_
+
+///
+/// uncomment #define to enable the setting.
+/// Don't just change the value to 0 to disable setting.
+///
+#ifndef RAPID_START_TRIM_ON_RESUME
+#define RAPID_START_TRIM_ON_RESUME 1
+#endif
+
+#ifndef RAPID_START_NO_SMRAM_INTEGRITY_CHECK
+#define RAPID_START_NO_SMRAM_INTEGRITY_CHECK
+#endif
+
+#ifndef RAPID_START_USE_OLD_ACPI_VARIABLE_SET
+#define RAPID_START_USE_OLD_ACPI_VARIABLE_SET
+#endif
+
+#ifndef RAPID_START_WHOLE_MEMORY_CHECK
+// #define RAPID_START_WHOLE_MEMORY_CHECK
+#endif
+
+#ifndef RAPID_START_ON_MEMORY_INSTALLED
+#define RAPID_START_ON_MEMORY_INSTALLED
+#endif
+
+#ifndef RAPID_START_ON_START_PPI_INSTALLED
+// #define RAPID_START_ON_START_PPI_INSTALLED
+#endif
+
+#ifndef RAPID_START_SCAN_ZERO_PAGE
+#define RAPID_START_SCAN_ZERO_PAGE
+#endif
+
+#ifdef RAPID_START_WHOLE_MEMORY_CHECK
+///
+/// SW SMI callback function to check memory
+///
+#ifndef SW_SMI_WHOLE_MEMORY_CHECK
+#define SW_SMI_WHOLE_MEMORY_CHECK 0x51
+#endif
+///
+/// Default granularity 1MB
+///
+#ifndef MEMORY_CRC32_GRANULARITY
+#define MEMORY_CRC32_GRANULARITY 0x100000
+#endif
+#endif // RAPID_START_WHOLE_MEMORY_CHECK
+#endif
diff --git a/ReferenceCode/RapidStart/Include/RapidStartData.h b/ReferenceCode/RapidStart/Include/RapidStartData.h
new file mode 100644
index 0000000..132d6c6
--- /dev/null
+++ b/ReferenceCode/RapidStart/Include/RapidStartData.h
@@ -0,0 +1,144 @@
+/** @file
+ Header file to define structure and GUID of RapidStart Persistent Data
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef RAPID_START_DATA_H_
+#define RAPID_START_DATA_H_
+
+#include EFI_GUID_DEFINITION (RapidStartPersistentData)
+
+#define MEM_EQU_4GB 0x100000000ULL
+#define MEM_EQU_1MB 0x100000
+#define LEGACY_SMRAM_BASE 0xA0000
+#define LEGACY_SMRAM_SIZE 0x20000
+#define LEGACY_SMRAM_BUFFER MEM_EQU_1MB
+
+//
+// RapidStart Flag definitions
+//
+#define RAPID_START_FLAG_ENTRY_DONE BIT0
+#define RAPID_START_FLAG_STORE_CHANGE BIT1
+
+#define V_PCH_LAN_IO_LEN 32
+#define R_PCH_LAN_IOADDR 0
+#define R_PCH_LAN_IODATA 4
+#define R_PCH_LAN_MDIC 0x20
+#define B_PCH_LAN_MDIC_READY BIT28
+#define B_PCH_LAN_MDIC_ERROR BIT30
+#define V_PCH_LAN_MDIC_SET_PAGE 0x043F0000
+#define V_PCH_LAN_MDIC_SET_ADDR 0x04310000
+#define V_PCH_LAN_MDIC_WRITE 0x04320000
+#define V_PCH_LAN_MDIC_READ 0x08320000
+#define R_PCH_LAN_EXTCNF_CTRL 0x0F00
+#define B_PCH_LAN_EXTCNF_CTRL_SWFLAG BIT5
+#define R_PCH_LAN_FWSM_S 0x5B54
+#define B_PCH_LAN_FWSM_S_FW_VAL BIT15
+#define R_PCH_LAN_FFVT 0x9800
+
+#define V_PHY_VALID_SIG 0x8086
+#define V_PHY_PAGE_WAKEUP 800
+#define R_LAN_PHY_RCTL 0x00
+#define R_LAN_PHY_IPAV 0x40
+#define R_LAN_PHY_PRXC 0x46
+
+#pragma pack(1)
+typedef struct {
+ UINT16 Year;
+ UINT8 Month;
+ UINT8 Date;
+ UINT8 Hour;
+ UINT8 Minute;
+ UINT8 Second;
+} RTC_TIME;
+
+typedef struct {
+ UINT32 RapidStartMem;
+ UINT32 MmioSpace;
+ UINT32 RapidStartGlobalNvsPtr;
+ UINT32 StoreSectors;
+ UINT64 StoreLbaAddr;
+ UINT8 StoreSataPort;
+ UINT8 SataPortConfiguration;
+ UINT32 Tolm;
+ UINT64 Tohm;
+ UINT64 TotalMem;
+ UINT32 RapidStartMemSize;
+ UINT32 ZeroBitmapSize;
+ UINT32 WlanMmioSpace;
+ UINT64 SystemMemoryLengthBelow4GB;
+ UINT64 SystemMemoryLengthAbove4GB;
+ UINT64 AcpiReservedMemoryBase;
+ UINT32 AcpiReservedMemorySize;
+ UINT32 Crc32RecordSize;
+ UINT64 RapidStartStoreUid;
+ UINT32 ActivePageThresholdSizeInSector;
+ UINT8 HybridHardDisk;
+ UINT8 DisplayType;
+ UINT64 DssAddress;
+ UINT64 DssSize;
+} RAPID_START_PERSISTENT_DATA;
+
+#define FFVT_SIZE 5
+
+typedef struct {
+ UINT32 GPE0;
+ UINT32 GPE0a;
+ UINT32 GPE0b;
+ UINT32 Ffvt[FFVT_SIZE];
+ RTC_TIME OsWakeTime;
+ UINT8 OsWakeTimeEnabled;
+ UINT8 EntryCanceled;
+} RAPID_START_MEM_DATA;
+
+#pragma pack()
+
+#define RAPID_START_ACPI_RTC_WAKE 0x01
+#define RAPID_START_ACPI_BATT_WAKE 0x02
+
+#define RAPID_START_MEM_DATA_PTR(RapidStartData) \
+ ( \
+ (RAPID_START_MEM_DATA *) (VOID *) \
+ ( \
+ ((RapidStartData)->RapidStartMem) + ((RapidStartData)->RapidStartMemSize) - sizeof (RAPID_START_MEM_DATA) - \
+ ((RapidStartData)->ZeroBitmapSize) - ((RapidStartData)->Crc32RecordSize) \
+ ) \
+ )
+
+#define RAPID_START_ZERO_PAGE_BITMAP_PTR(RapidStartData) \
+ ( \
+ (UINT32 *) (UINTN) \
+ ( \
+ ((RapidStartData)->RapidStartMem) + \
+ ((RapidStartData)->RapidStartMemSize) - \
+ ((RapidStartData)->ZeroBitmapSize) - \
+ ((RapidStartData)->Crc32RecordSize) \
+ ) \
+ )
+
+#define RAPID_START_CRC32_RECORD_PTR(RapidStartData) \
+ ( \
+ (UINT32 *) (UINTN) ( \
+ ((RapidStartData)->RapidStartMem) + ((RapidStartData)->RapidStartMemSize) - ((RapidStartData)->Crc32RecordSize) \
+ ) \
+ )
+
+#define NUMBER_OF_PAGES(MemAddr) RShiftU64 (MemAddr, 12)
+#define NUMBER_OF_PAGES_IN_DWORD(MemAddr) RShiftU64 (MemAddr, 17)
+#define ZERO_BITMAP_UNIT 32 /* (sizeof (UINT32) * 8bits) */
+#endif
diff --git a/ReferenceCode/RapidStart/Include/RapidStartDxe.dsc b/ReferenceCode/RapidStart/Include/RapidStartDxe.dsc
new file mode 100644
index 0000000..36b1d76
--- /dev/null
+++ b/ReferenceCode/RapidStart/Include/RapidStartDxe.dsc
@@ -0,0 +1,26 @@
+## @file
+# Build description file for building the RapidStart DXE drivers
+#
+#@copyright
+# Copyright (c) 2008 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+$(PROJECT_RAPID_START_ROOT)\Dxe\RapidStartDxe.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_RAPID_START_ROOT)\Smm\RapidStartSmm.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+$(PROJECT_RAPID_START_ROOT)\AcpiTables\RapidStartAcpiTables.inf
+#
+# Please uncomment following line after download binary modules PeiGfxDriver.efi and DxeGfxDriver.efi from IRS UEFI Graphics Drivers Release 5.0.1.1001 and later.
+#
+# $(PROJECT_RAPID_START_ROOT)\GfxDisplay\FfsGfxDriver\Dxe\DxeFfsGfxDriver.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
diff --git a/ReferenceCode/RapidStart/Include/RapidStartDxeLib.dsc b/ReferenceCode/RapidStart/Include/RapidStartDxeLib.dsc
new file mode 100644
index 0000000..15d15b9
--- /dev/null
+++ b/ReferenceCode/RapidStart/Include/RapidStartDxeLib.dsc
@@ -0,0 +1,24 @@
+## @file
+# Build description file for building the RapidStart DXE Library
+#
+#@copyright
+# Copyright (c) 2008 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+$(PROJECT_RAPID_START_ROOT)\Protocol\RapidStartProtocolLib.inf
+$(PROJECT_RAPID_START_ROOT)\SampleCode\Library\RapidStartCommonLib\RapidStartCommonLib.inf
+$(PROJECT_RAPID_START_ROOT)\Guid\RapidStartGuidLib.inf
+$(PROJECT_RAPID_START_ROOT)\SampleCode\Library\RapidStartPlatformLib\Dxe\RapidStartDxeLib.inf
+$(PROJECT_RAPID_START_ROOT)\GfxDisplay\Library\Dxe\GfxDisplayLibDxe.inf
diff --git a/ReferenceCode/RapidStart/Include/RapidStartInclude.cif b/ReferenceCode/RapidStart/Include/RapidStartInclude.cif
new file mode 100644
index 0000000..8ea12e1
--- /dev/null
+++ b/ReferenceCode/RapidStart/Include/RapidStartInclude.cif
@@ -0,0 +1,16 @@
+<component>
+ name = "RapidStartInclude"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\RapidStart\Include"
+ RefName = "RapidStartInclude"
+[files]
+"RapidStartInclude.sdl"
+"RapidStartAhciReg.h"
+"RapidStartConfig.h"
+"RapidStartData.h"
+"RapidStartAcpi.dsc"
+"RapidStartDxe.dsc"
+"RapidStartDxeLib.dsc"
+"RapidStartPei.dsc"
+"RapidStartPeiLib.dsc"
+<endComponent>
diff --git a/ReferenceCode/RapidStart/Include/RapidStartInclude.sdl b/ReferenceCode/RapidStart/Include/RapidStartInclude.sdl
new file mode 100644
index 0000000..97b32fc
--- /dev/null
+++ b/ReferenceCode/RapidStart/Include/RapidStartInclude.sdl
@@ -0,0 +1,68 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2012, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+# $Header: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/RapidStartInclude/RapidStartInclude.sdl 2 10/15/12 5:35a Bensonlai $
+#
+# $Revision: 2 $
+#
+# $Date: 10/15/12 5:35a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/RapidStartInclude/RapidStartInclude.sdl $
+#
+# 2 10/15/12 5:35a Bensonlai
+# [Category] Improvement
+# [Severity] Important
+# [Description] Update Shark Bay Rapid Start Reference Code Version
+# 0.7.1.0.
+# [Files] ReferenceCode\RapidStart\*.*
+#
+# 1 4/19/12 8:09a Yurenlai
+# Initial check in.
+#
+#*************************************************************************
+TOKEN
+ Name = "RapidStartInclude_SUPPORT"
+ Value = 1
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable RapidStartInclude support in Project"
+End
+
+PATH
+ Name = "RapidStartInclude_DIR"
+End
+
+ELINK
+ Name = "/I$(RapidStartInclude_DIR)"
+ Parent = "RAPIDSTART_INCLUDES"
+ InvokeOrder = AfterParent
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2012, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/RapidStart/Include/RapidStartPei.dsc b/ReferenceCode/RapidStart/Include/RapidStartPei.dsc
new file mode 100644
index 0000000..15f7dfd
--- /dev/null
+++ b/ReferenceCode/RapidStart/Include/RapidStartPei.dsc
@@ -0,0 +1,25 @@
+## @file
+# Build description file for building the RapidStart PEI modules
+#
+#@copyright
+# Copyright (c) 2008 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+$(PROJECT_RAPID_START_ROOT)\Pei\RapidStartPei.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
+
+#
+# Please uncomment following line after download binary modules PeiGfxDriver.efi and DxeGfxDriver.efi from IRS UEFI Graphics Drivers Release 5.0.1.1001 and later.
+#
+# $(PROJECT_RAPID_START_ROOT)\GfxDisplay\FfsGfxDriver\Pei\PeiGfxDriver.inf SOURCE_OVERRIDE_PATH = $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\EntryPoints
diff --git a/ReferenceCode/RapidStart/Include/RapidStartPeiLib.dsc b/ReferenceCode/RapidStart/Include/RapidStartPeiLib.dsc
new file mode 100644
index 0000000..d84bcb2
--- /dev/null
+++ b/ReferenceCode/RapidStart/Include/RapidStartPeiLib.dsc
@@ -0,0 +1,24 @@
+## @file
+# Build description file for building the RapidStart PEI library
+#
+#@copyright
+# Copyright (c) 2008 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+$(PROJECT_RAPID_START_ROOT)\Ppi\RapidStartPpiLib.inf
+$(PROJECT_RAPID_START_ROOT)\Guid\RapidStartGuidLib.inf
+$(PROJECT_RAPID_START_ROOT)\SampleCode\Library\RapidStartCommonLib\RapidStartCommonLib.inf
+$(PROJECT_RAPID_START_ROOT)\SampleCode\Library\RapidStartPlatformLib\Pei\RapidStartPeiLib.inf
+$(PROJECT_RAPID_START_ROOT)\GfxDisplay\Library\Pei\GfxDisplayLibPei.inf
diff --git a/ReferenceCode/RapidStart/Pei/RapidStartAhci.c b/ReferenceCode/RapidStart/Pei/RapidStartAhci.c
new file mode 100644
index 0000000..7a37eb6
--- /dev/null
+++ b/ReferenceCode/RapidStart/Pei/RapidStartAhci.c
@@ -0,0 +1,1211 @@
+/** @file
+ Provide functions to initialize SATA controller and perform ACHI commands
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#include "RapidStartConfig.h"
+#include <SaAccess.h>
+#include <PchAccess.h>
+#include <PchPlatformLib.h>
+#include "RapidStartPeiLib.h"
+#include "RapidStartData.h"
+#include "RapidStartAhci.h"
+#endif
+
+typedef struct {
+ UINT64 DataByteAddr;
+ UINT32 Reserved;
+ UINT32 ByteCountI;
+} AHCI_PRDT;
+
+#ifndef EFI_DEBUG
+#define DumpPortStatus(a)
+#else
+/**
+ Send serial out debug message for AHCI port status
+
+ @param[in] Ahci - AHCI controller information structure
+**/
+STATIC
+VOID
+DumpPortStatus (
+ IN AHCI_CONTEXT *Ahci
+ )
+{
+ UINTN PxBase;
+ ASSERT (Ahci->Port <= 31);
+ PxBase = AHCI_PORT_BASE (Ahci);
+
+ DEBUG (
+ (EFI_D_ERROR,
+ " CLB:%08x FB:%08x\n CMD:%08x TFD:%08x IS:%08x\nSSTS:%08x SERR:%08x\n CI:%08x SACT:%08x SIG:%08x\n",
+ MmioRead32 (PxBase + R_PCH_SATA_AHCI_PXCLB),
+ MmioRead32 (PxBase + R_PCH_SATA_AHCI_PXFB),
+ MmioRead32 (PxBase + R_PCH_SATA_AHCI_PXCMD),
+ MmioRead32 (PxBase + R_PCH_SATA_AHCI_PXTFD),
+ MmioRead32 (PxBase + R_PCH_SATA_AHCI_PXIS),
+ MmioRead32 (PxBase + R_PCH_SATA_AHCI_PXSSTS),
+ MmioRead32 (PxBase + R_PCH_SATA_AHCI_PXSERR),
+ MmioRead32 (PxBase + R_PCH_SATA_AHCI_PXCI),
+ MmioRead32 (PxBase + R_PCH_SATA_AHCI_PXSACT),
+ MmioRead32 (PxBase + R_PCH_SATA_AHCI_PXSIG))
+ );
+}
+#endif
+
+/**
+ Returns SATA Port Control and Status register value.
+
+ @retval PCS value
+**/
+STATIC
+UINT16
+AhciGetPortControlStatus (
+ VOID
+ )
+{
+ UINTN PciD31F2RegBase;
+ PciD31F2RegBase = MmPciAddress (
+ 0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_SATA,
+ PCI_FUNCTION_NUMBER_PCH_SATA,
+ 0
+ );
+ return MmioRead16 (PciD31F2RegBase + R_PCH_SATA_PCS);
+}
+
+/**
+ Returns SATA enabled port bitmap basing on PCS value.
+
+ @retval Enabled ports map.
+**/
+UINT32
+AhciGetEnabledPorts (
+ VOID
+ )
+{
+ return AhciGetPortControlStatus () & 0x7F;
+}
+
+/**
+ Returns SATA present port bitmap basing on PCS value.
+
+ @retval Present ports map.
+**/
+UINT32
+AhciGetPresentPorts (
+ VOID
+ )
+{
+ return (AhciGetPortControlStatus () >> 8) & 0x7F;
+}
+
+/**
+ This is a work-around to make sure Port Implemented bits (RWO) are set.
+ PI is set according to PCS value restored from previous boot
+
+ @param[in] Ahci - SATA controller information structure
+**/
+STATIC
+VOID
+AhciConfigurePortsImplemented (
+ IN AHCI_CONTEXT *Ahci
+ )
+{
+ ASSERT (Ahci->Port <= 31);
+ if ((MmioRead32 (Ahci->Abar + R_PCH_SATA_AHCI_PI) & (1 << Ahci->Port)) == 0) {
+ MmioWrite32 (Ahci->Abar + R_PCH_SATA_AHCI_PI, AhciGetEnabledPorts ());
+ //
+ // Two reads required (C-spec ch. 25 - 1.9.14.1)
+ //
+ MmioRead32 (Ahci->Abar + R_PCH_SATA_AHCI_PI);
+ MmioRead32 (Ahci->Abar + R_PCH_SATA_AHCI_PI);
+ ASSERT (MmioRead32 (Ahci->Abar + R_PCH_SATA_AHCI_PI) & (1 << Ahci->Port));
+ }
+}
+
+/**
+ Initialize SATA controller and enable decode
+
+ @param[in] Ahci - SATA controller information structure
+
+ @retval EFI_SUCCESS - SATA controller has been initialized successfully
+**/
+EFI_STATUS
+AhciInit (
+ IN AHCI_CONTEXT *Ahci
+ )
+{
+ UINTN PciD31F2RegBase;
+
+ DEBUG ((EFI_D_INFO, "AhciInit()\n"));
+
+ Ahci->State = AHCI_STATE_INIT;
+ Ahci->Identify = NULL;
+
+ ASSERT ((Ahci->Abar &~(~0 << N_PCH_SATA_AHCI_BAR_ALIGNMENT)) == 0);
+
+ PciD31F2RegBase = MmPciAddress (
+ 0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_SATA,
+ PCI_FUNCTION_NUMBER_PCH_SATA,
+ 0
+ );
+
+ MmioWrite32 (PciD31F2RegBase + R_PCH_SATA_AHCI_BAR, Ahci->Abar);
+ ///
+ /// Enable decode
+ ///
+ MmioWrite8 (PciD31F2RegBase + R_PCH_SATA_COMMAND, 0x6);
+
+ DEBUG ((EFI_D_INFO, "FFS SATA BAR: %x\n", MmioRead32 (PciD31F2RegBase + R_PCH_SATA_AHCI_BAR)));
+ DEBUG ((EFI_D_INFO, "FFS SATA ID: %x\n", MmioRead32 (PciD31F2RegBase + 0)));
+ DEBUG ((EFI_D_INFO, "FFS SATA CMD: %x\n", MmioRead16 (PciD31F2RegBase + R_PCH_SATA_COMMAND)));
+ DEBUG ((EFI_D_INFO, "FFS SATA STS: %x\n", MmioRead16 (PciD31F2RegBase + R_PCH_SATA_PCISTS)));
+ DEBUG ((EFI_D_INFO, "FFS SATA PI: %x\n", MmioRead8 (PciD31F2RegBase + R_PCH_SATA_PI_REGISTER)));
+ DEBUG ((EFI_D_INFO, "FFS SATA CC: %x\n", MmioRead8 (PciD31F2RegBase + R_PCH_SATA_SUB_CLASS_CODE)));
+
+ ///
+ /// Enable SATA ports if not enabled already.
+ ///
+ AhciConfigurePortsImplemented (Ahci);
+
+ ///
+ /// Enable AHCI by setting AE bit
+ ///
+ MmioWrite32 (Ahci->Abar + R_PCH_SATA_AHCI_GHC, B_PCH_SATA_AHCI_GHC_AE);
+
+ DEBUG ((EFI_D_INFO, "FFS AHCI VS: %x\n", MmioRead32 (Ahci->Abar + R_PCH_SATA_AHCI_VS)));
+ DEBUG ((EFI_D_INFO, "FFS AHCI GHC: %x\n", MmioRead32 (Ahci->Abar + R_PCH_SATA_AHCI_GHC)));
+ DEBUG ((EFI_D_INFO, "FFS AHCI CAP: %x\n", MmioRead32 (Ahci->Abar + R_PCH_SATA_AHCI_CAP)));
+ DEBUG ((EFI_D_INFO, "FFS AHCI PI: %x\n", MmioRead32 (Ahci->Abar + R_PCH_SATA_AHCI_PI)));
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Disable SATA controller after all AHCI commands have completed
+
+ @param[in] Ahci - SATA controller information structure
+**/
+VOID
+AhciDone (
+ IN AHCI_CONTEXT *Ahci
+ )
+{
+ UINTN PciD31F2RegBase;
+
+ DEBUG ((EFI_D_INFO, "AhciDone()\n"));
+ ASSERT (Ahci->State == AHCI_STATE_INIT);
+ Ahci->State = AHCI_STATE_UNKNOWN;
+
+ PciD31F2RegBase = MmPciAddress (
+ 0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_SATA,
+ PCI_FUNCTION_NUMBER_PCH_SATA,
+ 0
+ );
+
+ ///
+ /// Disable AHCI
+ ///
+ MmioWrite32 (Ahci->Abar + R_PCH_SATA_AHCI_GHC, 0);
+
+ ///
+ /// Unconfigure SATA
+ ///
+ MmioWrite32 (PciD31F2RegBase + R_PCH_SATA_AHCI_BAR, 0);
+ MmioWrite8 (PciD31F2RegBase + R_PCH_SATA_COMMAND, 0);
+}
+
+/**
+ Spin up Ahci port
+
+ @param[in] Ahci - SATA controller information structure
+ @param[in] Port - SATA port number
+
+ @retval EFI_SUCCESS - AHCI Port has been spun up successfully
+**/
+EFI_STATUS
+AhciSpinUpPort (
+ IN AHCI_CONTEXT *Ahci,
+ IN UINTN Port
+ )
+{
+ UINTN PxBase;
+
+ DEBUG ((EFI_D_INFO, "AhciPortSpinUpPort(%d)\n", Port));
+ ASSERT (Ahci->State == AHCI_STATE_INIT);
+ ASSERT (Port <= 31);
+ ASSERT (MmioRead32 (Ahci->Abar + R_PCH_SATA_AHCI_GHC) & B_PCH_SATA_AHCI_GHC_AE);
+
+ PxBase = AHCI_PORT_BASE_X (Ahci, Port);
+
+ ASSERT ((MmioRead32 (PxBase + R_PCH_SATA_AHCI_PXCMD) & B_PCH_SATA_AHCI_PxCMD_ST) == 0);
+
+ ///
+ /// Clear errors
+ ///
+ MmioWrite32 (PxBase + R_PCH_SATA_AHCI_PXSERR, (UINT32)~0u);
+
+ ///
+ /// Spin Up
+ ///
+ MmioOr32 (PxBase + R_PCH_SATA_AHCI_PXCMD, B_PCH_SATA_AHCI_PxCMD_SUD);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Initialize AHCI port for reading/writing RapidStart Store
+
+ @param[in] Ahci - SATA controller information structure
+
+ @retval EFI_DEVICE_ERROR - AHCI port initialization failed
+ @retval EFI_SUCCESS - AHCI port initialized successfully and RapidStart Store is ready for reading/writing
+ @retval EFI_SECURITY_VIOLATION - Drive is already in SECURITY FREEZE state and will not accept UNLOCK command
+ @retval EFI_ACCESS_DENIED - Drive is in LOCKED state and need to execute UNLOCK command before accessing
+**/
+EFI_STATUS
+AhciPortInit (
+ IN AHCI_CONTEXT *Ahci
+ )
+{
+ UINTN PxBase;
+ UINT32 Timer;
+ UINT32 Count;
+
+ DEBUG ((EFI_D_INFO, "AhciPortInit()\n"));
+ ASSERT (Ahci->State == AHCI_STATE_INIT);
+ ASSERT (Ahci->Port <= 31);
+ ASSERT (MmioRead32 (Ahci->Abar + R_PCH_SATA_AHCI_GHC) & B_PCH_SATA_AHCI_GHC_AE);
+ DEBUG ((EFI_D_INFO, "Mem used: %d\n", AHCI_MEM_MAX (Ahci) - Ahci->PortBase));
+ DEBUG ((EFI_D_INFO, "AHCI_MEM_MAX_SIZE: %d\n", AHCI_MEM_MAX_SIZE));
+
+ ASSERT (AHCI_MEM_MAX (Ahci) <= (Ahci->PortBase + Ahci->PortSize));
+ ASSERT ((AHCI_MEM_MAX (Ahci) - Ahci->PortBase) == AHCI_MEM_MAX_SIZE);
+
+ PxBase = AHCI_PORT_BASE (Ahci);
+
+ ASSERT ((MmioRead32 (PxBase + R_PCH_SATA_AHCI_PXCMD) & B_PCH_SATA_AHCI_PxCMD_ST) == 0);
+
+ ZeroMem ((VOID *) Ahci->PortBase, Ahci->PortSize);
+
+ DEBUG ((EFI_D_INFO, "AHCI_CMD_LIST_BASE: %08lx\n", (UINT64) AHCI_CMD_LIST_BASE (Ahci)));
+ DEBUG ((EFI_D_INFO, "AHCI_RXFIS_BASE: %08lx\n", (UINT64) AHCI_RXFIS_BASE (Ahci)));
+ DEBUG ((EFI_D_INFO, "AHCI_CMD_TABLE_BASE: %08lx\n", (UINT64) AHCI_CMD_TABLE_BASE (Ahci)));
+ DEBUG ((EFI_D_INFO, "AHCI_MEM_MAX: %08lx\n", (UINT64) AHCI_MEM_MAX (Ahci)));
+
+ ASSERT ((AHCI_CMD_LIST_BASE (Ahci) & 0x3FF) == 0);
+ ASSERT ((AHCI_RXFIS_BASE (Ahci) & 0xFF) == 0);
+
+ MmioWrite32 (PxBase + R_PCH_SATA_AHCI_PXCLB, (UINT32) AHCI_CMD_LIST_BASE (Ahci));
+ MmioWrite32 (PxBase + R_PCH_SATA_AHCI_PXCLBU, (UINT32) RShiftU64 (AHCI_CMD_LIST_BASE (Ahci), 32));
+
+ MmioWrite32 (PxBase + R_PCH_SATA_AHCI_PXFB, (UINT32) AHCI_RXFIS_BASE (Ahci));
+ MmioWrite32 (PxBase + R_PCH_SATA_AHCI_PXFBU, (UINT32) RShiftU64 (AHCI_RXFIS_BASE (Ahci), 32));
+
+ MmioOr32 (PxBase + R_PCH_SATA_AHCI_PXCMD, B_PCH_SATA_AHCI_PxCMD_FRE);
+
+ ASSERT (MmioRead32 (PxBase + R_PCH_SATA_AHCI_PXCMD) & B_PCH_SATA_AHCI_PxCMD_SUD);
+
+ ///
+ /// Clear errors
+ ///
+ MmioWrite32 (PxBase + R_PCH_SATA_AHCI_PXSERR, (UINT32)~0u);
+
+ for (Count = 0; Count < AHCI_INIT_RETRY_COUNT; ++Count) {
+ ///
+ /// Reset port if in error state
+ ///
+ if (Count > 0 || MmioRead32 (PxBase + R_PCH_SATA_AHCI_PXSERR) != 0) {
+ DEBUG ((EFI_D_INFO, "Resetting AHCI port.\n"));
+ MmioWrite32 (PxBase + R_PCH_SATA_AHCI_PXSCTL, V_PCH_SATA_AHCI_PXSCTL_DET_1);
+ PchPmTimerStall (1000);
+ MmioWrite32 (PxBase + R_PCH_SATA_AHCI_PXSCTL, 0);
+ }
+
+ Timer = 0;
+
+ ///
+ /// Wait till device detected
+ ///
+ while
+ (
+ Timer < AHCI_INIT_TIMEOUT &&
+ ((MmioRead32 (PxBase + R_PCH_SATA_AHCI_PXSSTS) & B_PCH_SATA_AHCI_PXSSTS_DET) != B_PCH_SATA_AHCI_PXSSTS_DET_3)
+ ) {
+ PchPmTimerStall (AHCI_INIT_WAIT);
+ Timer += AHCI_INIT_WAIT;
+ }
+ ///
+ /// Clear errors
+ ///
+ MmioWrite32 (PxBase + R_PCH_SATA_AHCI_PXSERR, (UINT32)~0u);
+ MmioWrite32 (PxBase + R_PCH_SATA_AHCI_PXIS, (UINT32)~0u);
+
+ ///
+ /// Wait for device ready
+ ///
+ while (Timer < AHCI_INIT_TIMEOUT) {
+ if ((
+ MmioRead32 (PxBase + R_PCH_SATA_AHCI_PXTFD) & (B_PCH_SATA_AHCI_PXTFD_STS_DRQ | B_PCH_SATA_AHCI_PXTFD_STS_BSY)
+ ) == 0
+ ) {
+ goto complete;
+ }
+
+ PchPmTimerStall (AHCI_INIT_WAIT);
+ Timer += AHCI_INIT_WAIT;
+ }
+ }
+
+complete:
+
+ if (Count == AHCI_INIT_RETRY_COUNT) {
+
+ DEBUG ((EFI_D_ERROR, "AHCI port initialization timeout.\n"));
+ DumpPortStatus (Ahci);
+
+ ///
+ /// Clear FRE
+ ///
+ MmioAnd32 (PxBase + R_PCH_SATA_AHCI_PXCMD, (UINT32)~B_PCH_SATA_AHCI_PxCMD_FRE);
+
+ ///
+ /// Wait for FR to be cleared
+ ///
+ while (MmioRead32 (PxBase + R_PCH_SATA_AHCI_PXCMD) & B_PCH_SATA_AHCI_PxCMD_FR) {
+ }
+
+ return EFI_DEVICE_ERROR;
+ }
+
+ ASSERT ((MmioRead32 (PxBase + R_PCH_SATA_AHCI_PXCMD) & (B_PCH_SATA_AHCI_PxCMD_CLO | B_PCH_SATA_AHCI_PxCMD_CR)) == 0);
+
+ ///
+ /// Set Start bit
+ ///
+ MmioOr32 (PxBase + R_PCH_SATA_AHCI_PXCMD, B_PCH_SATA_AHCI_PxCMD_ST);
+
+ Ahci->State = AHCI_STATE_INUSE;
+ return EFI_SUCCESS;
+}
+
+/**
+ Check whether device is password locked.
+
+ @param[in] Ahci - SATA controller information structure
+
+ @retval EFI_SUCCESS - Device not locked
+ @retval EFI_ACCESS_DENIED - Drive is in LOCKED state and need to execute UNLOCK command before accessing
+ @retval EFI_SECURITY_VIOLATION - Drive is already in SECURITY FREEZE state and will not accept UNLOCK command
+ @retval EFI_TIMEOUT - Timeout occured
+ @retval EFI_DEVICE_ERROR - Error occurred on device side.
+**/
+EFI_STATUS
+AhciGetLockStatus (
+ IN AHCI_CONTEXT *Ahci
+)
+{
+ UINT16 SecurityStatus;
+ EFI_STATUS Status;
+ VOID *Buffer;
+
+ DEBUG ((EFI_D_INFO, "AhciGetLockStatus()\n"));
+ ASSERT (Ahci->State == AHCI_STATE_INUSE);
+
+ if (Ahci->Identify == 0) {
+ Buffer = (VOID*) AHCI_ID_BLOCK (Ahci);
+ Status = AhciIdentifyDevice (Ahci, Buffer);
+ if (Status == EFI_SUCCESS) {
+ Ahci->Identify = (UINT16 *) Buffer;
+ } else {
+ DEBUG ((EFI_D_ERROR, "Error: Identifying device failed!\n"));
+ return Status;
+ }
+ }
+ SecurityStatus = Ahci->Identify[ATA_ID_DEV_SECURITY_STATUS];
+ if ((SecurityStatus & (B_ATA_ID_DEV_SEC_SUPPORTED | B_ATA_ID_DEV_SEC_ENABLED | B_ATA_ID_DEV_SEC_LOCKED)
+ ) == (B_ATA_ID_DEV_SEC_SUPPORTED | B_ATA_ID_DEV_SEC_ENABLED | B_ATA_ID_DEV_SEC_LOCKED)
+ ) {
+ if (SecurityStatus & (B_ATA_ID_DEV_SEC_FROZEN | B_ATA_ID_DEV_SEC_COUNT_EXP)) {
+ DEBUG ((EFI_D_ERROR, "AHCI device lock freeze!\n"));
+ return EFI_SECURITY_VIOLATION;
+ }
+ DEBUG ((EFI_D_WARN, "AHCI device locked!\n"));
+ return EFI_ACCESS_DENIED;
+ }
+ return EFI_SUCCESS;
+}
+
+/**
+ Stops AHCI port.
+
+ @param[in] Ahci - SATA controller information structure
+**/
+VOID
+AhciPortDone (
+ IN AHCI_CONTEXT *Ahci
+ )
+{
+ UINTN PxBase;
+
+ DEBUG ((EFI_D_INFO, "AhciPortDone()\n"));
+ Ahci->State = AHCI_STATE_INIT;
+
+ PxBase = AHCI_PORT_BASE (Ahci);
+ ASSERT (MmioRead32 (PxBase + R_PCH_SATA_AHCI_PXCI) == 0);
+
+ MmioAnd32 (PxBase + R_PCH_SATA_AHCI_PXCMD, (UINT32)~B_PCH_SATA_AHCI_PxCMD_ST);
+
+ ///
+ /// Wait for CR to be cleared
+ ///
+ while (MmioRead32 (PxBase + R_PCH_SATA_AHCI_PXCMD) & B_PCH_SATA_AHCI_PxCMD_CR) {
+ }
+
+ MmioAnd32 (PxBase + R_PCH_SATA_AHCI_PXCMD, (UINT32)~B_PCH_SATA_AHCI_PxCMD_FRE);
+
+ ///
+ /// Wait for FR to be cleared
+ ///
+ while (MmioRead32 (PxBase + R_PCH_SATA_AHCI_PXCMD) & B_PCH_SATA_AHCI_PxCMD_FR) {
+ }
+}
+
+/**
+ Check whether there are available command slots.
+
+ @param[in] Ahci - SATA controller information structure
+
+ @retval TRUE if there is an available slot, FALSE otherwise.
+**/
+BOOLEAN
+AhciHasFreeCmdSlot (
+ IN AHCI_CONTEXT *Ahci
+ )
+{
+ UINTN PxBase;
+ UINT32 ci;
+
+ ASSERT (AHCI_MAX_CMD <= 32);
+
+ PxBase = AHCI_PORT_BASE (Ahci);
+ ci = MmioRead32 (PxBase + R_PCH_SATA_AHCI_PXCI);
+
+ return ci != ((UINT32)~0u >> (32 - AHCI_MAX_CMD));
+}
+
+/**
+ Finds or waits for available command slot
+
+ @param[in] Ahci - SATA controller information structure
+ @param[out] CmdIndex - Available command slot index
+
+ @retval EFI_SUCCESS - Available command slot index found
+ @retval EFI_TIMEOUT - Timeout occured
+ @retval EFI_DEVICE_ERROR - Error occurred on device side.
+ @retval EFI_NOT_STARTED - The RapidStart Entry flow should be canceled and do S3 resume back to OS
+**/
+STATIC
+EFI_STATUS
+AhciFindCmdSlot (
+ IN AHCI_CONTEXT *Ahci,
+ OUT UINTN *CmdIndex
+ )
+{
+ UINTN PxBase;
+ UINT32 ci;
+ UINT32 Timer;
+ UINT32 Index;
+
+ PxBase = AHCI_PORT_BASE (Ahci);
+
+ Timer = 0;
+ while (Timer < AHCI_CMD_TIMEOUT) {
+ ci = MmioRead32 (PxBase + R_PCH_SATA_AHCI_PXCI);
+
+ for (Index = 0; Index < AHCI_MAX_CMD; ++Index) {
+ if ((ci & (1u << Index)) == 0) {
+ *CmdIndex = Index;
+ return EFI_SUCCESS;
+ }
+ }
+
+ if (Ahci->PollCancellation && RapidStartShouldCancelEntry ()) {
+ return EFI_NOT_STARTED;
+ }
+
+ if (AHCI_ERROR (PxBase)) {
+ DEBUG ((EFI_D_ERROR, "AHCI error!\n"));
+ DumpPortStatus (Ahci);
+ return EFI_DEVICE_ERROR;
+ }
+
+ PchPmTimerStall (AHCI_CMD_WAIT);
+ Timer += AHCI_CMD_WAIT;
+ }
+
+ DEBUG ((EFI_D_ERROR, "AHCI command timeout!\n"));
+ DumpPortStatus (Ahci);
+ return EFI_TIMEOUT;
+}
+
+/**
+ Waits until given command(s) complete.
+
+ @param[in] Ahci - SATA controller information structure
+ @param[in] CmdMask - Command(s) mask
+
+ @retval EFI_SUCCESS - Command complete
+ @retval EFI_TIMEOUT - Timeout occured
+ @retval EFI_DEVICE_ERROR - Error occurred on device side.
+ @retval EFI_NOT_STARTED - The RapidStart Entry flow should be canceled and do S3 resume back to OS
+**/
+EFI_STATUS
+AhciWaitComplete (
+ IN AHCI_CONTEXT *Ahci,
+ IN UINT32 CmdMask
+ )
+{
+ UINTN PxBase;
+ UINT32 ci;
+ UINT32 Timer;
+
+ DEBUG ((EFI_D_INFO, "AhciWaitComplete(%d)\n", CmdMask));
+ ASSERT (Ahci->State == AHCI_STATE_INUSE);
+
+ PxBase = AHCI_PORT_BASE (Ahci);
+
+ Timer = 0;
+ while (Timer < AHCI_CMD_TIMEOUT) {
+ ci = MmioRead32 (PxBase + R_PCH_SATA_AHCI_PXCI);
+
+ if ((ci & CmdMask) == 0) {
+ return EFI_SUCCESS;
+ }
+
+ if (Ahci->PollCancellation && RapidStartShouldCancelEntry ()) {
+ return EFI_NOT_STARTED;
+ }
+
+ if (AHCI_ERROR (PxBase)) {
+ DEBUG ((EFI_D_ERROR, "AHCI error!\n"));
+ DumpPortStatus (Ahci);
+ return EFI_DEVICE_ERROR;
+ }
+
+ PchPmTimerStall (AHCI_CMD_WAIT);
+ Timer += AHCI_CMD_WAIT;
+ }
+
+ DEBUG ((EFI_D_ERROR, "AHCI command timeout!\n"));
+ DumpPortStatus (Ahci);
+ return EFI_TIMEOUT;
+}
+
+/**
+ Waits until all AHCI commands completed.
+
+ @param[in] Ahci - SATA controller information structure
+
+ @retval EFI_SUCCESS - All AHCI commands have completed
+ @retval EFI_TIMEOUT - Timeout occured
+ @retval EFI_DEVICE_ERROR - Error occurred on device side.
+ @retval EFI_NOT_STARTED - The RapidStart Entry flow should be canceled and do S3 resume back to OS
+**/
+EFI_STATUS
+AhciWaitAllComplete (
+ IN AHCI_CONTEXT *Ahci
+ )
+{
+ UINTN PxBase;
+ UINT32 Ci;
+ UINT32 PrevCi;
+ EFI_STATUS Status;
+ UINT32 Timer;
+
+ DEBUG ((EFI_D_INFO, "AhciWaitAllComplete() "));
+ ASSERT (Ahci->State == AHCI_STATE_INUSE);
+
+ PxBase = AHCI_PORT_BASE (Ahci);
+ Timer = 0;
+ Status = EFI_TIMEOUT;
+
+ Ci = MmioRead32 (PxBase + R_PCH_SATA_AHCI_PXCI);
+ PrevCi = Ci;
+
+ while (Timer < AHCI_CMD_TIMEOUT) {
+ if (Ci == 0) {
+ Status = EFI_SUCCESS;
+ break;
+ }
+
+ if (Ahci->PollCancellation && RapidStartShouldCancelEntry ()) {
+ return EFI_NOT_STARTED;
+ }
+
+ if (AHCI_ERROR (PxBase)) {
+ Status = EFI_DEVICE_ERROR;
+ break;
+ }
+
+ if (Ci != PrevCi) {
+ DEBUG ((EFI_D_INFO, "."));
+ Timer = 0;
+ }
+
+ PchPmTimerStall (AHCI_CMD_WAIT);
+ Timer += AHCI_CMD_WAIT;
+ PrevCi = Ci;
+ Ci = MmioRead32 (PxBase + R_PCH_SATA_AHCI_PXCI);
+ }
+
+ DEBUG ((EFI_D_INFO, "\n"));
+ if (Status == EFI_TIMEOUT) {
+ DEBUG ((EFI_D_ERROR, "AHCI command timeout!\n"));
+ } else if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "AHCI error!\n"));
+ DumpPortStatus (Ahci);
+ }
+
+ return Status;
+}
+
+/**
+ Enqueues ahci command for read/write and optionally with Zero filter
+
+ @param[in] Ahci - SATA controller information structure
+ @param[in,out] AtaCmd - ATA command structure
+ @param[out] CmdMask - If given a bit corresponding to allocated command slot is set
+ @param[in] ZeroPageBitMap - A pointer for ZeroPageTable
+ @param[out] SmRamBufferLba - If given the drive LBA storing original SMRAM buffer content will be passed by it.
+
+ @retval EFI_SUCCESS - AHCI command successfully posted
+ @retval EFI_TIMEOUT - Timeout occured
+ @retval EFI_DEVICE_ERROR - Command failed
+**/
+EFI_STATUS
+AhciPostCommandWithZeroFilter (
+ IN AHCI_CONTEXT *Ahci,
+ IN OUT ATA_COMMAND *AtaCmd,
+ OUT OPTIONAL UINT32 *CmdMask,
+ IN OPTIONAL UINT32 *ZeroPageBitMap,
+ OUT OPTIONAL UINT64 *SmRamBufferLba
+ )
+{
+ UINTN PxBase;
+ UINTN CmdIndex;
+ UINTN CmdTableAddr;
+ UINT32 *CmdHeader;
+ UINT32 *CmdFis;
+ AHCI_PRDT *Prdt;
+ UINT16 PrdCount;
+ UINT16 Index;
+ UINT32 MemLeft;
+ UINT32 MemChunk;
+ UINT64 MemAddr;
+ EFI_STATUS Status;
+ UINT32 TempBitMap;
+ UINT32 *ZeroPagePointer;
+ UINT8 count;
+ UINT32 AhciMaxRegion;
+ UINT32 NumberOfPages;
+ UINT32 SectorCount;
+
+ count = 0;
+ ZeroPagePointer = 0;
+ TempBitMap = 0;
+ CmdIndex = 0;
+
+ DEBUG (
+ (EFI_D_INFO,
+ "AhciPostCommand port=%d cmd=%02x lba=%08x mem=%08lx ",
+ Ahci->Port,
+ AtaCmd->Command,
+ (UINT32) AtaCmd->Lba,
+ (UINT64) AtaCmd->MemAddr)
+ );
+ ASSERT (Ahci->State == AHCI_STATE_INUSE);
+
+ MemAddr = AtaCmd->MemAddr;
+ MemLeft = AtaCmd->SectorCount << SECTOR_SHIFT;
+ PxBase = AHCI_PORT_BASE (Ahci);
+
+ ASSERT ((MemAddr & (ZeroPageBitMap ? 0xFFF : 1)) == 0);
+ ASSERT (AtaCmd->SectorCount <= AHCI_MAX_SECTORS);
+
+ Status = AhciFindCmdSlot (Ahci, &CmdIndex);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ ASSERT (CmdIndex < AHCI_MAX_CMD);
+
+ CmdHeader = (UINT32 *) AHCI_CMD_HEADER (Ahci, CmdIndex);
+ CmdTableAddr = AHCI_CMD_TABLE (Ahci, CmdIndex);
+ CmdFis = (UINT32 *) (UINTN) CmdTableAddr;
+ Prdt = (AHCI_PRDT *) (UINTN) (CmdTableAddr + AHCI_CMD_TABLE_HEADER_SIZE);
+
+ ASSERT ((UINT32) CmdHeader >= AHCI_CMD_LIST_BASE (Ahci));
+ ASSERT ((UINT32) CmdHeader + AHCI_CMD_HEADER_SIZE <= AHCI_CMD_LIST_BASE (Ahci) + AHCI_CMD_LIST_SIZE);
+ ASSERT (CmdTableAddr >= Ahci->PortBase);
+ ASSERT (CmdTableAddr + AHCI_CMD_TABLE_SIZE <= Ahci->PortBase + Ahci->PortSize);
+ ASSERT (RShiftU64 (AtaCmd->Lba, 48) == 0);
+
+ ///
+ /// Create PRD table
+ ///
+ PrdCount = 0;
+ AhciMaxRegion = AHCI_REGION_MAX;
+ SectorCount = 0;
+ ///
+ /// Initialize ZeroPage Filter Parameters
+ ///
+ if (ZeroPageBitMap != NULL) {
+ NumberOfPages = (UINT32) NUMBER_OF_PAGES_IN_DWORD (MemAddr);
+ ZeroPagePointer = ZeroPageBitMap + NumberOfPages;
+ count = (UINT8) (NUMBER_OF_PAGES (MemAddr) - (NumberOfPages * ZERO_BITMAP_UNIT));
+ TempBitMap = (UINT32) *ZeroPagePointer;
+ AhciMaxRegion = EFI_PAGE_SIZE;
+ }
+
+ while (MemLeft > 0) {
+ ASSERT (PrdCount < AHCI_MAX_PRDT);
+ ASSERT ((MemAddr & 1) == 0);
+
+ if (MemLeft >= AhciMaxRegion) {
+ MemChunk = AhciMaxRegion;
+ } else {
+ MemChunk = MemLeft;
+ }
+
+ ASSERT (((MemChunk - 1) &~(AhciMaxRegion - 1)) == 0);
+ ASSERT ((MemChunk & 0x1FF) == 0);
+
+ if (ZeroPageBitMap != NULL) {
+ ///
+ /// Get LBA which storing SMRAM buffer and later restore this buffer after SMRAM handled.
+ ///
+ if (SmRamBufferLba != NULL) {
+ if (MemAddr == LEGACY_SMRAM_BUFFER) {
+ *SmRamBufferLba = AtaCmd->Lba + SectorCount;
+ }
+ }
+
+ if (((UINT32) (TempBitMap >> count) & 1) == 0) {
+ Prdt[PrdCount].DataByteAddr = MemAddr;
+ Prdt[PrdCount].Reserved = 0;
+ Prdt[PrdCount].ByteCountI = MemChunk - 1;
+ PrdCount++;
+ SectorCount += 8;
+ }
+ ///
+ /// Shift ZeroPage filter bitmap to next bit, if it is end of current DWORD, will shift to next DWORD
+ ///
+ if (count < (ZERO_BITMAP_UNIT - 1)) {
+ count++;
+ } else {
+ count = 0;
+ ZeroPagePointer++;
+ TempBitMap = (UINT32) *ZeroPagePointer;
+ }
+ } else {
+ Prdt[PrdCount].DataByteAddr = MemAddr;
+ Prdt[PrdCount].Reserved = 0;
+ Prdt[PrdCount].ByteCountI = MemChunk - 1;
+ PrdCount++;
+ SectorCount += MemChunk >> SECTOR_SHIFT;
+ }
+
+ MemAddr += MemChunk;
+ MemLeft -= MemChunk;
+ }
+
+ AtaCmd->MemAddr += AtaCmd->SectorCount << SECTOR_SHIFT;
+ AtaCmd->SectorCount = SectorCount;
+
+ if (ZeroPageBitMap != NULL && PrdCount == 0) {
+ DEBUG ((EFI_D_INFO, "skipped\n"));
+ return EFI_SUCCESS;
+ }
+ ///
+ /// Fill command header
+ ///
+ ASSERT ((CmdTableAddr & 0x7F) == 0);
+ CmdHeader[0] = AHCI_CMD_PRDTL (PrdCount) | AHCI_CMD_CFL (5);
+ if (AtaCmd->Direction == AHCI_DIR_HOST2DEV) {
+ CmdHeader[0] |= AHCI_CMD_WRITE | AHCI_CMD_PREFETCHABLE;
+ }
+
+ CmdHeader[1] = 0;
+ CmdHeader[2] = (UINT32) CmdTableAddr;
+ CmdHeader[3] = (UINT32) RShiftU64 (CmdTableAddr, 32);
+ for (Index = 4; Index < 8; ++Index) {
+ CmdHeader[Index] = 0;
+ }
+ ///
+ /// Create FIS
+ ///
+ CmdFis[0] = SATA_FIS_FEAT (AtaCmd->Feature) | SATA_FIS_CMD (AtaCmd->Command) | SATA_FIS_C | SATA_FIS_HOST2DEVICE;
+ CmdFis[1] = SATA_FIS_DEV_LBA | SATA_FIS_LBA (AtaCmd->Lba);
+ CmdFis[2] = SATA_FIS_FEAT_EXP (AtaCmd->Feature) | SATA_FIS_LBA_EXP (AtaCmd->Lba);
+ CmdFis[3] = SATA_FIS_SECT_COUNT (SectorCount);
+ CmdFis[4] = AtaCmd->Auxiliary.Data;
+ DEBUG ((EFI_D_INFO, "FIS[4] = %x\n", AtaCmd->Auxiliary.Data));
+
+ DEBUG ((EFI_D_INFO, "actualcount=%d ", SectorCount));
+
+ ///
+ /// Issue the command to the controller
+ ///
+ MmioWrite32 (PxBase + R_PCH_SATA_AHCI_PXCI, (1u << CmdIndex));
+
+ if (CmdMask != NULL) {
+ *CmdMask |= (1u << CmdIndex);
+ }
+
+ AtaCmd->Lba += SectorCount;
+ DEBUG ((EFI_D_INFO, "idx=%d\n", CmdIndex));
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Executes AHCI command and waits until command completes.
+
+ @param[in] Ahci - SATA controller information structure
+ @param[in,out] AtaCmd - ATA command structure
+
+ @retval EFI_SUCCESS - AHCI command successfully posted
+ @retval EFI_TIMEOUT - Timeout occured
+ @retval EFI_DEVICE_ERROR - Command failed
+**/
+EFI_STATUS
+AhciExecCommand (
+ IN AHCI_CONTEXT *Ahci,
+ IN OUT ATA_COMMAND *AtaCmd
+ )
+{
+ EFI_STATUS Status;
+ UINTN CmdMask;
+
+ CmdMask = 0;
+ Status = AhciPostCommand (Ahci, AtaCmd, &CmdMask);
+ if (Status == EFI_SUCCESS) {
+ Status = AhciWaitComplete (Ahci, CmdMask);
+ }
+
+ return Status;
+}
+
+/**
+ Issues ATA command with no data transfer.
+
+ @param[in] Ahci - SATA controller information structure
+ @param[in] Command - Command to be issued
+
+ @retval EFI_SUCCESS - fucntion executed successfully
+ @retval EFI_TIMEOUT - Timeout occured
+ @retval EFI_DEVICE_ERROR - Command failed
+**/
+EFI_STATUS
+AhciSimpleCommand (
+ IN AHCI_CONTEXT *Ahci,
+ IN UINT8 Command
+ )
+{
+ ATA_COMMAND AtaCmd;
+
+ ZeroMem (&AtaCmd, sizeof (AtaCmd));
+ AtaCmd.Command = Command;
+
+ return AhciExecCommand (Ahci, &AtaCmd);
+}
+
+/**
+ Sends Identify Device ATA command to port
+
+ @param[in] Ahci - SATA controller information structure
+ @param[out] Buffer - Buffer to store device information
+
+ @retval EFI_SUCCESS - function executed successfully
+ @retval EFI_TIMEOUT - Timeout occured
+ @retval EFI_DEVICE_ERROR - Command failed
+**/
+EFI_STATUS
+AhciIdentifyDevice (
+ IN AHCI_CONTEXT *Ahci,
+ OUT VOID *Buffer
+ )
+{
+ ATA_COMMAND AtaCmd;
+
+ DEBUG ((EFI_D_INFO, "AhciIdentifyDevice()\n"));
+ ASSERT (Buffer != NULL);
+
+ AtaCmd.Command = ATA_CMD_IDENTIFY_DEVICE;
+ AtaCmd.Direction = AHCI_DIR_DEV2HOST;
+ AtaCmd.Lba = 0;
+ AtaCmd.SectorCount = 1;
+ AtaCmd.MemAddr = (UINTN) Buffer;
+ AtaCmd.Feature = 0;
+
+ return AhciExecCommand (Ahci, &AtaCmd);
+}
+
+/**
+ Performs TRIM command on given LBA range.
+
+ @param[in] Ahci - SATA controller information structure
+ @param[in] Lba - First block to be trimmed
+ @param[in] Count - Number of blocks to trim
+
+ @retval EFI_SUCCESS - fucntion executed successfully
+ @retval EFI_TIMEOUT - Timeout occured
+ @exception EFI_UNSUPPORTED - TRIM is not supported by the device
+ @retval EFI_DEVICE_ERROR - Command failed
+**/
+EFI_STATUS
+AhciTrimRange (
+ IN AHCI_CONTEXT *Ahci,
+ IN UINT64 Lba,
+ IN UINT32 Count
+ )
+{
+ UINT64 *RangeEntries;
+ UINTN Index;
+ UINT16 Blocks;
+ ATA_COMMAND AtaCmd;
+ EFI_STATUS Status;
+
+ DEBUG ((EFI_D_INFO, "AhciTrimRange(lba=%lx count=%x)\n", Lba, Count));
+ ASSERT (Ahci->Identify != NULL);
+
+ if (!((Ahci->Identify[ATA_ID_DEV_DATA_SET_MGMNT_SUPPORT] & B_ATA_ID_DEV_DATA_SET_TRIM) &&
+ (Ahci->Identify[ATA_ID_DEV_DATA_SET_MGMNT_BLOCKS] > 0))
+ ) {
+ DEBUG ((EFI_D_WARN, "TRIM is not supported!\n"));
+ return EFI_UNSUPPORTED;
+ }
+
+ RangeEntries = (UINT64 *) AHCI_TMP_BLOCK (Ahci);
+
+ AtaCmd.Command = ATA_CMD_DATA_SET_MANAGEMENT;
+ AtaCmd.Direction = AHCI_DIR_HOST2DEV;
+ AtaCmd.Feature = V_ATA_TRIM_FEATURE;
+ AtaCmd.SectorCount = 1;
+
+ while (Count > 0) {
+ for (Index = 0; Index < (AHCI_TMP_BLOCK_SIZE / sizeof (UINT64)); ++Index) {
+ if (Count <= 0xFFFF) {
+ Blocks = (UINT16) Count;
+ } else {
+ Blocks = 0xFFFF;
+ }
+
+ if (Blocks != 0) {
+ RangeEntries[Index] = LShiftU64 (Blocks, 48) | Lba;
+ } else {
+ RangeEntries[Index] = 0;
+ }
+
+ Count -= Blocks;
+ Lba += Blocks;
+ }
+
+ AtaCmd.Lba = 0;
+ AtaCmd.MemAddr = (UINTN) RangeEntries;
+
+ Status = AhciExecCommand (Ahci, &AtaCmd);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Unlocks ATA device.
+
+ @param[in] Ahci - SATA controller information structure
+ @param[in] Password - security credential
+
+ @retval EFI_SUCCESS - Command executed successfully
+ @retval EFI_SECURITY_VIOLATION - Device security lock freeze
+ @exception EFI_UNSUPPORTED - Security is not supported by the device
+ @retval EFI_TIMEOUT - Timeout occured
+ @retval EFI_DEVICE_ERROR - Command failed
+**/
+EFI_STATUS
+AhciSecurityUnlock (
+ IN AHCI_CONTEXT *Ahci,
+ IN CHAR8 *Password
+ )
+{
+ UINT16 *Block;
+ ATA_COMMAND AtaCmd;
+ EFI_STATUS Status;
+
+ DEBUG ((EFI_D_INFO, "AhciSecurityUnlock()\n"));
+ ASSERT (Ahci->Identify != NULL);
+
+ if ((Ahci->Identify[ATA_ID_DEV_SECURITY_STATUS] & B_ATA_ID_DEV_SEC_SUPPORTED) == 0) {
+ DEBUG ((EFI_D_ERROR, "AHCI security not supported!\n"));
+ return EFI_UNSUPPORTED;
+ }
+
+ if ((Ahci->Identify[ATA_ID_DEV_SECURITY_STATUS] & (B_ATA_ID_DEV_SEC_ENABLED | B_ATA_ID_DEV_SEC_LOCKED)) !=
+ (B_ATA_ID_DEV_SEC_ENABLED | B_ATA_ID_DEV_SEC_LOCKED)
+ ) {
+ DEBUG ((EFI_D_WARN, "AHCI device already unlocked!\n"));
+ return EFI_SUCCESS;
+ }
+
+ if (Ahci->Identify[ATA_ID_DEV_SECURITY_STATUS] & (B_ATA_ID_DEV_SEC_FROZEN | B_ATA_ID_DEV_SEC_COUNT_EXP)) {
+ DEBUG ((EFI_D_ERROR, "AHCI device lock freeze!\n"));
+ return EFI_SECURITY_VIOLATION;
+ }
+
+ Block = (UINT16 *) AHCI_TMP_BLOCK (Ahci);
+ Block[0] = 0;
+ CopyMem (&Block[1], Password, ATA_PASSWORD_LEN);
+
+ AtaCmd.Command = ATA_CMD_SECURITY_UNLOCK;
+ AtaCmd.Direction = AHCI_DIR_HOST2DEV;
+ AtaCmd.Feature = 0;
+ AtaCmd.Lba = 0;
+ AtaCmd.MemAddr = (UINTN) Block;
+ AtaCmd.SectorCount = 1;
+
+ Status = AhciExecCommand (Ahci, &AtaCmd);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "AHCI unlock failed!\n"));
+ }
+
+ return Status;
+}
+
+/**
+ Hybrid Hard Disk Support.
+
+ @param[in] Ahci - SATA controller information structure
+
+ @retval EFI_SUCCESS - fucntion executed successfully
+ @retval EFI_TIMEOUT - Timeout occured
+ @exception EFI_UNSUPPORTED - HHD is not supported by the device
+ @retval EFI_DEVICE_ERROR - Command failed
+**/
+EFI_STATUS
+AhciHybridHardDiskSupport (
+ IN AHCI_CONTEXT *Ahci
+ )
+{
+ EFI_STATUS Status;
+ ATA_COMMAND AtaCmd;
+ UINT8 *HybridLogRangeEntries;
+ UINT8 *HybridInfoHeader;
+ UINT8 *HybridInfoDescriptor;
+ UINT16 Index, HybridInfoDescriptorNumber;
+ UINT64 X, Y;
+ UINT64 NvmSize;
+
+ DEBUG ((EFI_D_INFO, "Ahci Hybrid Hard Device Support Start\n"));
+ ASSERT (Ahci->Identify != NULL);
+
+ if (!((Ahci->Identify[ATA_ID_DEV_HYBRID_FEATURE_SUPPORT] & B_ATA_ID_DEV_HYBRID_FEATURE_SUPPORT) &
+ (Ahci->Identify[ATA_ID_DEV_HYBRID_FEATURE_ENABLE] & B_ATA_ID_DEV_HYBRID_FEATURE_ENABLE))
+ ) {
+ DEBUG ((EFI_D_ERROR, "Hybrid is not supported!\n"));
+ DEBUG ((EFI_D_ERROR, "Hybrid Feature support = %x\n", Ahci->Identify[ATA_ID_DEV_HYBRID_FEATURE_SUPPORT]));
+ DEBUG ((EFI_D_ERROR, "Hybrid Feature Enable = %x\n", Ahci->Identify[ATA_ID_DEV_HYBRID_FEATURE_ENABLE]));
+
+ return EFI_UNSUPPORTED;
+ }
+
+ HybridLogRangeEntries = (UINT8 *) AHCI_TMP_BLOCK (Ahci);
+
+ AtaCmd.Command = ATA_CMD_READ_LOG_EXT;
+ AtaCmd.Direction = AHCI_DIR_DEV2HOST;
+ AtaCmd.Lba = 0x14;
+ AtaCmd.SectorCount = 1;
+ AtaCmd.MemAddr = (UINTN) HybridLogRangeEntries;
+ AtaCmd.Feature = 0;
+
+ Status = AhciExecCommand (Ahci, &AtaCmd);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "Hybrid can't be supported, READ_LOG_EXT fail and Status is %r\n", Status));
+ return Status;
+ }
+
+ HybridInfoHeader = HybridLogRangeEntries;
+
+ if (HybridInfoHeader[2] != 0xFF) {
+ DEBUG ((EFI_D_ERROR, "Hybrid Information is Disabled\n"));
+ return EFI_DEVICE_ERROR;
+ }
+
+ DEBUG ((EFI_D_INFO, "Maximum Hybrid Priority is %x\n", HybridInfoHeader[7]));
+ if (HybridInfoHeader[7] == 0 || HybridInfoHeader[7] > 16) {
+ DEBUG ((EFI_D_ERROR, "Maximum Hybrid Priority Level is invalid !!\n"));
+ return EFI_DEVICE_ERROR;
+ }
+
+ Ahci->HybridInfo.HybridInfoValid = HybridInfoHeader[2];
+ Ahci->HybridInfo.HybridPriority = HybridInfoHeader[7] - 1;
+ DEBUG ((EFI_D_INFO, "RapidStart Hybrid Priority is %x\n", Ahci->HybridInfo.HybridPriority));
+
+ X = 0;
+ Y = 0;
+ HybridInfoDescriptorNumber = *(UINT16 *)HybridInfoHeader;
+ DEBUG ((EFI_D_INFO, "HybridInfoDescriptorNumber is %x\n", HybridInfoDescriptorNumber));
+ for (Index = 0; Index < HybridInfoDescriptorNumber; Index++) {
+ HybridInfoDescriptor = HybridLogRangeEntries + 64;
+ HybridInfoDescriptor += (16 * Index);
+ DEBUG ((EFI_D_INFO, "%x - Hybrid Priority is %x\n", Index, HybridInfoDescriptor[0]));
+ DEBUG ((EFI_D_INFO, " - Consumed NVM Size Fraction is %x\n", HybridInfoDescriptor[1]));
+ DEBUG ((EFI_D_INFO, " - Consumed Mapping Resources Fraction is %x\n", HybridInfoDescriptor[2]));
+ DEBUG ((EFI_D_INFO, " - Consumed NVM Size for Dirty Data Fraction is %x\n", HybridInfoDescriptor[3]));
+ DEBUG ((EFI_D_INFO, " - Consumed Mapping Resources for Dirty Data Fraction is %x\n", HybridInfoDescriptor[4]));
+
+ X+= HybridInfoDescriptor[3];
+ Y+= HybridInfoDescriptor[4];
+ }
+
+ DEBUG ((EFI_D_INFO, "Total Consumed Capacity For Dirty Data Fraction is %x\n", X));
+
+ NvmSize = *(UINT64 *)(HybridInfoHeader + 16);
+ DEBUG ((EFI_D_INFO, "NVM Size is %lx\n", NvmSize));
+ X = MultU64x64 (X, NvmSize);
+ X = DivU64x32 (X, 0xFF);
+
+ Ahci->TotalRemainingCacheCapacityInSector = (UINT32)(NvmSize - X);
+ DEBUG ((EFI_D_INFO, "TotalRemainingCacheCapacityInSector = %x\n", Ahci->TotalRemainingCacheCapacityInSector));
+
+ DEBUG ((EFI_D_INFO, "Ahci Hybrid Hard Device Support Successfully\n"));
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/RapidStart/Pei/RapidStartAhci.h b/ReferenceCode/RapidStart/Pei/RapidStartAhci.h
new file mode 100644
index 0000000..652cf96
--- /dev/null
+++ b/ReferenceCode/RapidStart/Pei/RapidStartAhci.h
@@ -0,0 +1,344 @@
+/** @file
+ Header file for function definitions
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#ifndef RAPID_START_AHCI_H_
+#define RAPID_START_AHCI_H_
+
+#include <RapidStartAhciReg.h>
+
+#pragma pack(1)
+
+typedef struct {
+ UINT32 Abar;
+ UINT32 PortBase;
+ UINT32 PortSize;
+ UINTN Port;
+ BOOLEAN PollCancellation;
+
+ // Internal fields
+ UINT16 *Identify;
+ enum {
+ AHCI_STATE_UNKNOWN,
+ AHCI_STATE_INIT,
+ AHCI_STATE_INUSE,
+ AHCI_STATE_MAX,
+ } State;
+ struct {
+ UINT8 HybridPriority : 4;
+ UINT8 Reserved : 3;
+ UINT8 HybridInfoValid : 1;
+ } HybridInfo;
+ UINT32 TotalRemainingCacheCapacityInSector;
+} AHCI_CONTEXT;
+
+typedef union {
+ UINT32 Data;
+ struct {
+ UINT32 ByteReserved1 : 8;
+ UINT32 ByteReserved2 : 8;
+ UINT32 HybridPriority : 4;
+ UINT32 Reserved : 1;
+ UINT32 HybridInfoValid : 1;
+ UINT32 Reserved1 : 2;
+ UINT32 ByteReserved4 : 8;
+ } r;
+} ATA_AUX;
+
+typedef struct {
+ UINT64 MemAddr;
+ UINT64 Lba;
+ UINT32 SectorCount;
+ UINT16 Feature;
+ UINT8 Command;
+ UINT8 Direction;
+ ATA_AUX Auxiliary;
+} ATA_COMMAND;
+
+#pragma pack()
+
+#define AhciSpinUp(Ahci) \
+ AhciSpinUpPort (Ahci, Ahci->Port)
+
+#define AhciPostCommand(Ahci, AtaCmd, CmdIdx) \
+ AhciPostCommandWithZeroFilter (Ahci, AtaCmd, CmdIdx, NULL, NULL)
+
+/**
+ Initialize SATA controller and enable decode
+
+ @param[in] Ahci - SATA controller information structure
+
+ @retval EFI_SUCCESS - SATA controller has been initialized successfully
+**/
+EFI_STATUS
+AhciInit (
+ IN AHCI_CONTEXT *Ahci
+ );
+
+/**
+ Returns SATA enabled port bitmap basing on PCS value.
+
+ @retval Enabled ports map.
+**/
+UINT32
+AhciGetEnabledPorts (
+ VOID
+ );
+
+/**
+ Returns SATA present port bitmap basing on PCS value.
+
+ @retval Present ports map.
+**/
+UINT32
+AhciGetPresentPorts (
+ VOID
+ );
+
+/**
+ Check whether device is password locked.
+
+ @param[in] Ahci - SATA controller information structure
+
+ @retval EFI_SUCCESS - Device not locked
+ @retval EFI_ACCESS_DENIED - Drive is in LOCKED state and need to execute UNLOCK command before accessing
+ @retval EFI_SECURITY_VIOLATION - Drive is already in SECURITY FREEZE state and will not accept UNLOCK command
+ @retval EFI_TIMEOUT - Timeout occured
+ @retval EFI_DEVICE_ERROR - Error occurred on device side.
+**/
+EFI_STATUS
+AhciGetLockStatus (
+ IN AHCI_CONTEXT *Ahci
+ );
+
+/**
+ Disable SATA controller after all AHCI commands have completed
+
+ @param[in] Ahci - SATA controller information structure
+**/
+VOID
+AhciDone (
+ IN AHCI_CONTEXT *Ahci
+ );
+
+/**
+ Spin up Ahci port
+
+ @param[in] Ahci - SATA controller information structure
+ @param[in] Port - SATA port number
+
+ @retval EFI_SUCCESS - AHCI Port has been spun up successfully
+**/
+EFI_STATUS
+AhciSpinUpPort (
+ IN AHCI_CONTEXT *Ahci,
+ IN UINTN Port
+ );
+
+/**
+ Initialize AHCI port for reading/writing RapidStart Store
+
+ @param[in] Ahci - SATA controller information structure
+
+ @retval EFI_DEVICE_ERROR - AHCI port initialization failed
+ @retval EFI_SUCCESS - AHCI port initialized successfully and RapidStart Store is ready for reading/writing
+**/
+EFI_STATUS
+AhciPortInit (
+ IN AHCI_CONTEXT *Ahci
+ );
+
+/**
+ Stops AHCI port.
+
+ @param[in] Ahci - SATA controller information structure
+**/
+VOID
+AhciPortDone (
+ IN AHCI_CONTEXT *Ahci
+ );
+
+/**
+ Executes AHCI command.
+
+ @param[in] Ahci - SATA controller information structure
+ @param[in,out] AtaCmd - ATA command structure
+
+ @retval EFI_SUCCESS - Command successfull
+ @retval EFI_TIMEOUT - Timeout occured
+ @retval EFI_DEVICE_ERROR - Command failed
+**/
+EFI_STATUS
+AhciExecCommand (
+ IN AHCI_CONTEXT *Ahci,
+ IN OUT ATA_COMMAND *AtaCmd
+ );
+
+/**
+ Enqueues ahci command and for read/write it is optionally with Zero filter.
+
+ @param[in] Ahci - SATA controller information structure
+ @param[in,out] AtaCmd - ATA command structure
+ @param[out] CmdMask - If given a bit corresponding to allocated command slot is set
+ @param[in] ZeroPageBitMap - A pointer for ZeroPageTable
+ @param[out] SmRamBufferLba - If given the drive LBA storing original SMRAM buffer content will be passed by it.
+
+ @retval EFI_SUCCESS - AHCI command successfully posted
+ @retval EFI_TIMEOUT - Timeout occured
+ @retval EFI_DEVICE_ERROR - Command failed
+**/
+EFI_STATUS
+AhciPostCommandWithZeroFilter (
+ IN AHCI_CONTEXT *Ahci,
+ IN OUT ATA_COMMAND *AtaCmd,
+ OUT OPTIONAL UINT32 *CmdMask,
+ IN OPTIONAL UINT32 *ZeroPageBitMap,
+ OUT OPTIONAL UINT64 *SmRamBufferLba
+ );
+
+/**
+ Issues ATA command with no data transfer.
+
+ @param[in] Ahci - SATA controller information structure
+ @param[in] Command - Command to be issued
+
+ @retval EFI_SUCCESS - fucntion executed successfully
+ @retval EFI_TIMEOUT - Timeout occured
+ @retval EFI_DEVICE_ERROR - Command failed
+**/
+EFI_STATUS
+AhciSimpleCommand (
+ IN AHCI_CONTEXT *Ahci,
+ IN UINT8 Command
+ );
+
+/**
+ Check whether there are available command slots.
+
+ @param[in] Ahci - SATA controller information structure
+
+ @retval TRUE if there is an available slot, FALSE otherwise.
+**/
+BOOLEAN
+AhciHasFreeCmdSlot (
+ IN AHCI_CONTEXT *Ahci
+ );
+
+/**
+ Waits untill given command(s) complete.
+
+ @param[in] Ahci - SATA controller information structure
+ @param[in] CmdMask - Command(s) mask
+
+ @retval EFI_SUCCESS - Command complete
+ @retval EFI_TIMEOUT - Timeout occured
+ @retval EFI_DEVICE_ERROR - Error occurred on device side.
+ @retval EFI_NOT_STARTED - The RapidStart Entry flow should be canceled and do S3 resume back to OS
+**/
+EFI_STATUS
+AhciWaitComplete (
+ IN AHCI_CONTEXT *Ahci,
+ IN UINT32 CmdMask
+ );
+
+/**
+ Waits for all AHCI commands completed.
+
+ @param[in] Ahci - SATA controller information structure
+
+ @retval EFI_SUCCESS - All AHCI commands have completed
+ @retval EFI_TIMEOUT - Timeout occured
+ @retval EFI_DEVICE_ERROR - Error occurred on device side.
+ @retval EFI_NOT_STARTED - The RapidStart Entry flow should be canceled and do S3 resume back to OS
+**/
+EFI_STATUS
+AhciWaitAllComplete (
+ IN AHCI_CONTEXT *Ahci
+ );
+
+/**
+ Sends Identify Device ATA command to port
+
+ @param[in] Ahci - SATA controller information structure
+ @param[out] Buffer - Buffer to store device information
+
+ @retval EFI_SUCCESS - function executed successfully
+ @retval EFI_TIMEOUT - Timeout occured
+ @retval EFI_DEVICE_ERROR - Command failed
+**/
+EFI_STATUS
+AhciIdentifyDevice (
+ IN AHCI_CONTEXT *Ahci,
+ OUT VOID *Buffer
+ );
+
+/**
+ Performs TRIM command on given LBA range
+
+ @param[in] Ahci - SATA controller information structure
+ @param[in] Lba - First block to be trimmed
+ @param[in] Count - Number of blocks to trim
+
+ @retval EFI_SUCCESS - fucntion executed successfully
+ @retval EFI_TIMEOUT - Timeout occured
+ @exception EFI_UNSUPPORTED - TRIM is not supported by the device
+ @retval EFI_DEVICE_ERROR - Command failed
+**/
+EFI_STATUS
+AhciTrimRange (
+ IN AHCI_CONTEXT *Ahci,
+ IN UINT64 Lba,
+ IN UINT32 Count
+ );
+
+/**
+ Unlocks ATA device.
+
+ @param[in] Ahci - SATA controller information structure
+ @param[in] Password - security credential
+
+ @retval EFI_SUCCESS - Command executed successfully
+ @retval EFI_SECURITY_VIOLATION - Device security lock freeze
+ @exception EFI_UNSUPPORTED - Security is not supported by the device
+ @retval EFI_TIMEOUT - Timeout occured
+ @retval EFI_DEVICE_ERROR - Command failed
+**/
+EFI_STATUS
+AhciSecurityUnlock (
+ IN AHCI_CONTEXT *Ahci,
+ IN CHAR8 *Password
+ );
+
+/**
+ Hybrid Hard Disk Support.
+
+ @param[in] Ahci - SATA controller information structure
+
+ @retval EFI_SUCCESS - fucntion executed successfully
+ @retval EFI_TIMEOUT - Timeout occured
+ @exception EFI_UNSUPPORTED - TRIM is not supported by the device
+ @retval EFI_DEVICE_ERROR - Command failed
+**/
+EFI_STATUS
+AhciHybridHardDiskSupport (
+ IN AHCI_CONTEXT *Ahci
+ );
+
+#endif
diff --git a/ReferenceCode/RapidStart/Pei/RapidStartPei.c b/ReferenceCode/RapidStart/Pei/RapidStartPei.c
new file mode 100644
index 0000000..08d05e8
--- /dev/null
+++ b/ReferenceCode/RapidStart/Pei/RapidStartPei.c
@@ -0,0 +1,2379 @@
+/** @file
+ This Peim driver will do RapidStart Entry or RapidStart Exit transition
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#include "RapidStartConfig.h"
+#include EFI_PPI_DEFINITION (RapidStart)
+#include EFI_PROTOCOL_DEFINITION (RapidStartGlobalNvsArea)
+#include EFI_PPI_DEFINITION (Heci)
+#include <MeChipset.h>
+
+#include <PchAccess.h>
+#include <SaAccess.h>
+#include <PchPlatformLib.h>
+
+#include "GfxDisplayLibPei.h"
+#include EFI_PPI_DEFINITION (PeiGfxPpi)
+#ifdef RAPID_START_ON_MEMORY_INSTALLED
+#include EFI_GUID_DEFINITION (AcpiVariable)
+#endif
+#include EFI_PPI_DEFINITION (EndOfPeiSignal)
+#include EFI_GUID_DEFINITION (RapidStartTransition)
+#include "RapidStartPeiLib.h"
+#include "RapidStartData.h"
+#include "RapidStartAhci.h"
+#include "RapidStartCommonLib.h"
+
+#endif
+#include EFI_PPI_DEPENDENCY (SaPlatformPolicy)
+
+
+#define PAM_COUNT 7
+
+#define ME_FID_TIMEOUT 10000
+
+#define MAX_MEMORY_RANGES (MAX_GFX_MEMORY_RANGES + 0x08)
+#define MAX_SMRAM_RANGES 2
+#define DPR_RANGES 1
+
+#ifndef MAX
+#define MAX(a, b) (((a) > (b)) ? (a) : (b))
+#endif
+#ifndef MIN
+#define MIN(a, b) (((a) <= (b)) ? (a) : (b))
+#endif
+#define ARRAY_SIZE(a) (sizeof (a) / sizeof (*(a)))
+#define POOL_SIZE(a) (((((EFI_HOB_GENERIC_HEADER*)a - 1)->HobLength) - sizeof(EFI_HOB_GENERIC_HEADER)) / sizeof (*(a)))
+#define VARIABLE_SIZE(a) (ARRAY_SIZE(a) > 0) ? ARRAY_SIZE(a) : POOL_SIZE(a)
+
+#define END_RANGES ((UINT64) (INT64) (-1))
+#define RANGE_LENGTH(r) ((r)->End - (r)->Start)
+
+EFI_GUID gEfiAcpiVariableGuid = EFI_ACPI_VARIABLE_GUID;
+
+typedef struct {
+ UINT64 Start;
+ UINT64 End;
+} MEMORY_RANGE;
+
+#define RAPID_START_INSTANCE_SIGNATURE EFI_SIGNATURE_32 ('i', 'R', 'S', 'T')
+
+typedef struct _RAPID_START_INSTANCE {
+ RAPID_START_PPI Ppi;
+ EFI_PEI_PPI_DESCRIPTOR PpiDesc;
+ UINT32 Signature;
+ BOOLEAN Enabled;
+ RAPID_START_PERSISTENT_DATA Data;
+ RAPID_START_TRANSITION Transition;
+ RAPID_START_GLOBAL_NVS_AREA *RapidStartGlobalNvs;
+ AHCI_CONTEXT Ahci;
+ CHAR8 HddPassword[ATA_PASSWORD_LEN];
+ EFI_STATUS PwdStatus;
+ BOOLEAN FreezeLock;
+#ifndef RAPID_START_NO_SMRAM_INTEGRITY_CHECK
+ UINT8 SmRamHash[RAPID_START_SECURE_HASH_LENGTH];
+#endif
+ UINT64 NotUsedLba;
+ UINT32 IedSize;
+} RAPID_START_INSTANCE;
+
+#define RAPID_START_INSTANCE_FROM_THIS(a) CR (a, RAPID_START_INSTANCE, Ppi, RAPID_START_INSTANCE_SIGNATURE)
+
+EFI_STATUS
+RapidStartClearAndEnablePmeEvent (
+ IN BOOLEAN EnablePme
+ );
+
+STATIC
+EFI_STATUS
+RapidStartExitAtEndOfPei (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
+ IN VOID *Ppi
+ );
+
+STATIC
+EFI_STATUS
+RapidStartRecoveryAtEndOfPei (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
+ IN VOID *Ppi
+ );
+
+STATIC
+EFI_STATUS
+RapidStartS4AtEndOfPei (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
+ IN VOID *Ppi
+ );
+
+STATIC
+EFI_STATUS
+RapidStartMemoryInstalled (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
+ IN VOID *Ppi
+ );
+
+STATIC
+EFI_STATUS
+InstallRapidStartPpi (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
+ IN VOID *Ppi
+ );
+
+STATIC EFI_PEI_NOTIFY_DESCRIPTOR mRapidStartExitNotifyDesc = {
+ (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+ &gEndOfPeiSignalPpiGuid,
+ RapidStartExitAtEndOfPei
+};
+
+STATIC EFI_PEI_NOTIFY_DESCRIPTOR mRapidStartRecoveryNotifyDesc = {
+ (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+ &gEndOfPeiSignalPpiGuid,
+ RapidStartRecoveryAtEndOfPei
+};
+
+STATIC EFI_PEI_NOTIFY_DESCRIPTOR mRapidStartS4NotifyDesc = {
+ (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+ &gEndOfPeiSignalPpiGuid,
+ RapidStartS4AtEndOfPei
+};
+
+STATIC EFI_PEI_NOTIFY_DESCRIPTOR mRapidStartTransitionPpiNotifyDesc = {
+ (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+ &gRapidStartTransitionPpiGuid,
+ RapidStartMemoryInstalled
+};
+
+STATIC EFI_PEI_NOTIFY_DESCRIPTOR mInstallRapidStartPpiNotifyDesc = {
+ (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+ &gPeiHeciPpiGuid,
+ InstallRapidStartPpi
+};
+
+STATIC
+EFI_STATUS
+RapidStartDoTransition (
+ IN RAPID_START_PPI *This
+ );
+
+#if !defined(RAPID_START_NO_SMRAM_INTEGRITY_CHECK) && defined(BUILD_WITH_GLUELIB)
+#undef SetMem
+/**
+ SetMem alternative in case GlueLib defines SetMem as a macro.
+ Required by CryptoLib.
+
+ @param[out] Buffer - Pointer to the memory buffer
+ @param[in] Length - The length for setting memory
+ @param[in] Value - The value that will be set to memory buffer
+**/
+VOID *
+SetMem (
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT8 Value
+ )
+{
+ return GlueSetMem (Buffer, Length, Value);
+}
+
+#undef CopyMem
+/**
+ Copy Length bytes from Source to Destination.
+
+ @param[out] DestinationBuffer - Target of copy
+ @param[in] SourceBuffer - Place to copy from
+ @param[in] Length - Number of bytes to copy
+
+ @retval Status code
+**/
+VOID *
+EFIAPI
+CopyMem (
+ OUT VOID *DestinationBuffer,
+ IN CONST VOID *SourceBuffer,
+ IN UINTN Length
+ )
+{
+ return GlueCopyMem (DestinationBuffer, SourceBuffer, Length);
+}
+#endif
+
+#ifndef EFI_DEBUG
+#define PrintRanges(r)
+#else
+/**
+ Show memory range information by debug macro
+
+ @param[in] ranges - Memory range information structure
+**/
+VOID
+PrintRanges (
+ IN MEMORY_RANGE *ranges
+ )
+{
+ while (ranges->Start != END_RANGES) {
+ DEBUG ((EFI_D_INFO, "%08lx - %08lx\n", ranges->Start, ranges->End));
+ ++ranges;
+ }
+}
+#endif
+
+/**
+ Sort memory ranges.
+
+ @param[in][out] MemoryRanges - Memory Ranges
+ @param[in] MemoryRangesSize - Number of entries in Memory Ranges
+
+ @retval Status code
+
+--*/
+EFI_STATUS
+SortRanges (
+ IN OUT MEMORY_RANGE *MemoryRanges,
+ IN UINTN MemoryRangesSize
+ )
+{
+ UINT32 Count, Index;
+ MEMORY_RANGE TempRange;
+ MEMORY_RANGE *Range;
+
+ Range = MemoryRanges;
+
+ if (MemoryRangesSize == 0) {
+ while (Range->Start != END_RANGES) {
+ MemoryRangesSize++;
+ Range++;
+ }
+ }
+
+ for (Count = 1; Count < MemoryRangesSize; Count++) {
+ for (Index = 0; Index < MemoryRangesSize - Count; Index++) {
+ if (MemoryRanges[Index].Start > MemoryRanges[Index + 1].Start) {
+ TempRange.Start = MemoryRanges[Index].Start;
+ TempRange.End = MemoryRanges[Index].End;
+ MemoryRanges[Index].Start = MemoryRanges[Index + 1].Start;
+ MemoryRanges[Index].End = MemoryRanges[Index + 1].End;
+ MemoryRanges[Index + 1].Start = TempRange.Start;
+ MemoryRanges[Index + 1].End = TempRange.End;
+ }
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+
+/**
+ Subtracts set of memory ranges from other set of memory ranges.
+ Resulting set will contain ranges covering InputRanges with SubRanges excluded.
+
+ Both InputRanges and SubRanges must be provided in ascending order
+ by Start address. Output set is also sorted.
+
+ All sets end with a range which Start address is END_RANGES.
+
+ @param[out] OutputRanges - Output buffer
+ @param[in] OutputRangesSize - Number of entries in output buffer
+ @param[in] InputRanges - Input ranges to substract from
+ @param[in] SubRanges - Ranges to be excluded from InputRanges
+
+ @retval EFI_SUCCESS - Success
+ @retval EFI_BUFFER_TOO_SMALL - Not enough space in output buffer
+**/
+STATIC
+EFI_STATUS
+SubtractRanges (
+ OUT MEMORY_RANGE *OutputRanges,
+ IN UINTN OutputRangesSize,
+ IN MEMORY_RANGE *InputRanges,
+ IN MEMORY_RANGE *SubRanges
+ )
+{
+ MEMORY_RANGE *SubRange;
+ MEMORY_RANGE Current;
+ UINTN OutIndex;
+
+ ASSERT (OutputRanges != InputRanges);
+ ASSERT (OutputRanges != SubRanges);
+
+ DEBUG ((EFI_D_INFO, "Sub ranges Before Sorting:\n"));
+ PrintRanges (SubRanges);
+ SortRanges (SubRanges, 0);
+ DEBUG ((EFI_D_INFO, "Sub ranges After Sorting:\n"));
+ PrintRanges (SubRanges);
+
+ OutIndex = 0;
+ while (InputRanges->Start != END_RANGES) {
+ Current.Start = InputRanges->Start;
+ Current.End = InputRanges->End;
+ SubRange = SubRanges;
+ while (SubRange->Start != END_RANGES) {
+ if ((Current.Start < SubRange->End) && (Current.End > SubRange->Start)) {
+ if (Current.Start < SubRange->Start) {
+ if (OutIndex + 1 >= OutputRangesSize) {
+ return EFI_BUFFER_TOO_SMALL;
+ }
+
+ OutputRanges[OutIndex].Start = Current.Start;
+ OutputRanges[OutIndex].End = MIN (Current.End, SubRange->Start);
+ ++OutIndex;
+ }
+
+ if (Current.End > SubRange->End) {
+ Current.Start = SubRange->End;
+ } else {
+ Current.Start = END_RANGES;
+ }
+ }
+
+ ++SubRange;
+ }
+
+ if (Current.Start != END_RANGES) {
+ if (OutIndex + 1 >= OutputRangesSize) {
+ return EFI_BUFFER_TOO_SMALL;
+ }
+
+ OutputRanges[OutIndex].Start = Current.Start;
+ OutputRanges[OutIndex].End = Current.End;
+ ++OutIndex;
+ }
+
+ ++InputRanges;
+ }
+
+ ASSERT (OutIndex < OutputRangesSize);
+ OutputRanges[OutIndex].Start = END_RANGES;
+ return EFI_SUCCESS;
+}
+
+/**
+ Returns total length of ranges in the set Ranges.
+
+ @param[in] Ranges - Array of memory ranges.
+
+ @retval The size of memory range
+**/
+STATIC
+UINT64
+SumRanges (
+ IN MEMORY_RANGE *Ranges
+ )
+{
+ UINT64 Size;
+ Size = 0;
+ while (Ranges->Start != END_RANGES) {
+ Size += RANGE_LENGTH (Ranges);
+ ++Ranges;
+ }
+
+ return Size;
+}
+
+
+/**
+ This routing is executed to clear all pending wake events and then enable wake events.
+
+ @param[in] EnablePme - set to TRUE to enable PME event
+
+ @retval EFI_SUCCESS - Operation successfully performed
+**/
+EFI_STATUS
+RapidStartClearAndEnablePmeEvent (
+ IN BOOLEAN EnablePme
+ )
+{
+ RAPID_START_PPI *This;
+ EFI_STATUS Status;
+ RAPID_START_INSTANCE *Instance;
+ RAPID_START_PERSISTENT_DATA *RapidStartData;
+ RAPID_START_MEM_DATA *RapidStartMemData;
+ PCH_SERIES PchSeries;
+ UINT32 PmBase;
+
+ PchSeries = GetPchSeries();
+ PmBase = MmioRead32 (
+ MmPciAddress (
+ 0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_ACPI_BASE)
+ ) & B_PCH_LPC_ACPI_BASE_BAR;
+
+ Status = PeiServicesLocatePpi (&gRapidStartPpiGuid, 0, NULL, (VOID **) &This);
+ ASSERT_EFI_ERROR (Status);
+ Instance = RAPID_START_INSTANCE_FROM_THIS (This);
+ RapidStartData = &Instance->Data;
+ RapidStartMemData = RAPID_START_MEM_DATA_PTR (RapidStartData);
+ DEBUG ((EFI_D_ERROR, "RapidStart: RapidStartMemData @ %X\n", RapidStartMemData));
+
+ ///
+ /// Clear all pending wake events
+ ///
+ RapidStartClearOemPmeEvent ();
+ if (PchSeries == PchLp) {
+ IoWrite32 (PmBase + R_PCH_ACPI_GPE0_STS_127_96, ~0u);
+ } else if (PchSeries == PchH) {
+ IoWrite32 (PmBase + R_PCH_ACPI_GPE0a_STS, ~0u);
+ IoWrite32 (PmBase + R_PCH_ACPI_GPE0b_STS, ~0u);
+ }
+ IoWrite16 (
+ PmBase + R_PCH_ACPI_PM1_STS,
+ B_PCH_ACPI_PM1_STS_WAK | B_PCH_ACPI_PM1_STS_RTC | B_PCH_ACPI_PM1_STS_PWRBTN
+ );
+
+ ///
+ /// Enable wake events
+ ///
+ if (EnablePme == TRUE) {
+ if (PchSeries == PchLp) {
+ IoOr32 (PmBase + R_PCH_ACPI_GPE0_EN_127_96, RapidStartMemData->GPE0);
+ } else if (PchSeries == PchH) {
+ IoOr32 (PmBase + R_PCH_ACPI_GPE0a_EN, RapidStartMemData->GPE0a);
+ IoOr32 (PmBase + R_PCH_ACPI_GPE0b_EN, RapidStartMemData->GPE0b);
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ RapidStart End of PEI handler.
+
+ @param[in] PeiServices - Pointer to PEI Services Table.
+ @param[in] NotifyDesc - Pointer to the descriptor for the Notification event that caused this function to execute.
+ @param[in] Ppi - Pointer to the PPI data associated with this function.
+
+ @retval EFI_SUCCESS - Ppi callback function executed successfully
+**/
+STATIC
+EFI_STATUS
+RapidStartS4AtEndOfPei (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
+ IN VOID *Ppi
+ )
+{
+ UINT32 PmBase;
+ EFI_STATUS Status;
+ RAPID_START_PPI *This;
+ RAPID_START_INSTANCE *Instance;
+ RAPID_START_PERSISTENT_DATA *RapidStartData;
+
+ DEBUG ((EFI_D_INFO, "RapidStartS4AtEndOfPei ()\n"));
+
+ PmBase = MmioRead32 (
+ MmPciAddress (
+ 0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_ACPI_BASE)
+ ) & B_PCH_LPC_ACPI_BASE_BAR;
+
+ Status = PeiServicesLocatePpi (&gRapidStartPpiGuid, 0, NULL, (VOID **) &This);
+ ASSERT_EFI_ERROR (Status);
+ Instance = RAPID_START_INSTANCE_FROM_THIS (This);
+ RapidStartData = &Instance->Data;
+
+ RapidStartWANetDetect (PeiServices, RapidStartData->WlanMmioSpace);
+ RapidStartClearAndEnablePmeEvent (TRUE);
+
+ DEBUG ((EFI_D_ERROR, "RapidStart: Switching to S4\n"));
+ IoAndThenOr32 (
+ PmBase + R_PCH_ACPI_PM1_CNT,
+ (UINT32)~B_PCH_ACPI_PM1_CNT_SLP_TYP,
+ (UINT32) (V_PCH_ACPI_PM1_CNT_S4 | B_PCH_ACPI_PM1_CNT_SLP_EN)
+ );
+
+ EFI_DEADLOOP ();
+ return EFI_SUCCESS;
+}
+
+/**
+ RapidStart End of PEI handler.
+
+ @param[in] PeiServices - Pointer to PEI Services Table.
+ @param[in] NotifyDesc - Pointer to the descriptor for the Notification event that caused this function to execute.
+ @param[in] Ppi - Pointer to the PPI data associated with this function.
+
+ @retval EFI_SUCCESS - Ppi callback function executed successfully
+**/
+STATIC
+EFI_STATUS
+RapidStartRecoveryAtEndOfPei (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
+ IN VOID *Ppi
+ )
+{
+ UINT32 PmBase;
+
+ DEBUG ((EFI_D_INFO, "RapidStartRecoveryAtEndOfPei ()\n"));
+
+ RapidStartClearAndEnablePmeEvent (TRUE);
+
+ PmBase = MmioRead32 (
+ MmPciAddress (
+ 0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_ACPI_BASE)
+ ) & B_PCH_LPC_ACPI_BASE_BAR;
+
+ DEBUG ((EFI_D_ERROR, "RapidStart: Switching state back to S3\n"));
+ IoAndThenOr32 (
+ PmBase + R_PCH_ACPI_PM1_CNT,
+ (UINT32)~B_PCH_ACPI_PM1_CNT_SLP_TYP,
+ (UINT32) (V_PCH_ACPI_PM1_CNT_S3 | B_PCH_ACPI_PM1_CNT_SLP_EN)
+ );
+
+ EFI_DEADLOOP ();
+ return EFI_SUCCESS;
+}
+
+/**
+ Executes necessary RapidStart late initialization after Boot Script done.
+
+ @param[in] PeiServices - Pointer to PEI Services Table.
+ @param[in] NotifyDesc - Pointer to the descriptor for the Notification event that caused this function to execute.
+ @param[in] Ppi - Pointer to the PPI data associated with this function.
+
+ @retval EFI_SUCCESS - RapidStart initialization successful
+**/
+STATIC
+EFI_STATUS
+RapidStartExitAtEndOfPei (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
+ IN VOID *Ppi
+ )
+{
+ DEBUG ((EFI_D_INFO, "RapidStartExitAtEndOfPei ()\n"));
+ return RapidStartEnableAcpi (PeiServices);
+}
+
+/**
+ PEI_PERMANENT_MEMORY_INSTALLED_PPI handler.
+ RapidStart transition is triggered here in case RapidStart is postoponed untill memory available in PEI.
+
+ @param[in] PeiServices - Pointer to PEI Services Table.
+ @param[in] NotifyDesc - Pointer to the descriptor for the Notification event that caused this function to execute.
+ @param[in] Ppi - Pointer to the PPI data associated with this function.
+
+ @retval EFI_SUCCESS
+**/
+STATIC
+EFI_STATUS
+RapidStartMemoryInstalled (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
+ IN VOID *Ppi
+ )
+{
+ RAPID_START_PPI *RapidStartPpi;
+ EFI_STATUS Status;
+
+ DEBUG ((EFI_D_INFO, "RapidStartMemoryInstalled ()\n"));
+ Status = (*PeiServices)->LocatePpi (PeiServices, &gRapidStartPpiGuid, 0, NULL, (VOID **) &RapidStartPpi);
+ ASSERT_EFI_ERROR (Status);
+
+ RapidStartDoTransition (RapidStartPpi);
+
+ return EFI_SUCCESS;
+}
+
+#ifdef EFI_DEBUG
+/**
+ Dump MCH relevant registers
+**/
+STATIC
+VOID
+DumpMcRegisters (
+ VOID
+ )
+{
+ UINTN MchBase;
+ MchBase = MmPciAddress (0, SA_MC_BUS, SA_MC_DEV, SA_MC_FUN, 0);
+
+ DEBUG ((EFI_D_INFO, "TOM : %lx\n", MmioRead64 (MchBase + R_SA_TOM)));
+ DEBUG ((EFI_D_INFO, "TSEGMB : %x\n", MmioRead32 (MchBase + R_SA_TSEGMB)));
+ DEBUG ((EFI_D_INFO, "TOLUD : %x\n", MmioRead32 (MchBase + R_SA_TOLUD)));
+ DEBUG ((EFI_D_INFO, "TOUUD : %lx\n", MmioRead64 (MchBase + R_SA_TOUUD)));
+ DEBUG ((EFI_D_INFO, "BDSM : %x\n", MmioRead32 (MchBase + R_SA_BDSM)));
+ DEBUG ((EFI_D_INFO, "BGSM : %x\n", MmioRead32 (MchBase + R_SA_BGSM)));
+ DEBUG ((EFI_D_INFO, "DPR : %x\n", MmioRead32 (MchBase + R_SA_DPR)));
+ DEBUG ((EFI_D_INFO, "MESEG_B : %lx\n", MmioRead64 (MchBase + R_SA_MESEG_BASE)));
+ DEBUG ((EFI_D_INFO, "MESEG_M : %lx\n", MmioRead64 (MchBase + R_SA_MESEG_MASK)));
+ DEBUG ((EFI_D_INFO, "REMAPBASE: %lx\n", MmioRead64 (MchBase + R_SA_REMAPBASE)));
+ DEBUG ((EFI_D_INFO, "REMAPLIM : %lx\n", MmioRead64 (MchBase + R_SA_REMAPLIMIT)));
+ DEBUG ((EFI_D_INFO, "SMRAMC : %02x\n", MmioRead8 (MchBase + R_SA_SMRAMC)));
+ DEBUG ((EFI_D_INFO, "GGC : %04x\n", MmioRead16 (MchBase + R_SA_GGC)));
+}
+
+/**
+ Show Hexadecimal number by debug macro
+
+ @param[in] Ptr - Pointer to buffer of number that will be showed
+ @param[in] Length - The length of the number buffer
+**/
+VOID
+PrintHex (
+ IN UINT8 *Ptr,
+ IN UINTN Length
+ )
+{
+ while (Length--) {
+ DEBUG ((EFI_D_INFO, "%02x", *Ptr++));
+ }
+
+ DEBUG ((EFI_D_INFO, "\n"));
+}
+#endif
+
+/**
+ Retrieves SMRAM areas ffrom SMRAM HOB, and places the ranges found in
+ SmRamRanges array.
+
+ @param[out] SmRamRanges - Output buffer
+ @param[in] SmRamRangesSize - Number of entries in output buffer
+
+ @retval EFI_SUCCESS
+ @retval EFI_NOT_FOUND
+ @retval EFI_BUFFER_TOO_SMALL
+**/
+STATIC
+EFI_STATUS
+GetSmRamRanges (
+ OUT MEMORY_RANGE *SmRamRanges,
+ IN UINTN SmRamRangesSize,
+ IN UINT32 IedSize
+ )
+{
+ EFI_SMRAM_HOB_DESCRIPTOR_BLOCK *SmmDescBlock;
+ UINTN Index;
+ VOID *Hob;
+
+ Hob = GetFirstGuidHob (&gEfiSmmPeiSmramMemoryReserve);
+ if (Hob == NULL) {
+ DEBUG ((EFI_D_ERROR, "SMRAM HOB not found!\n"));
+ ASSERT (0);
+ return EFI_NOT_FOUND;
+ }
+
+ SmmDescBlock = (VOID *) ((UINT8 *) Hob + sizeof (EFI_HOB_GUID_TYPE));
+
+ DEBUG ((EFI_D_INFO, "Found %d SMM ranges\n", SmmDescBlock->NumberOfSmmReservedRegions));
+
+ ASSERT (SmRamRangesSize > SmmDescBlock->NumberOfSmmReservedRegions);
+ if (SmRamRangesSize <= SmmDescBlock->NumberOfSmmReservedRegions) {
+ return EFI_BUFFER_TOO_SMALL;
+ }
+
+ for (Index = 0; Index < SmmDescBlock->NumberOfSmmReservedRegions; ++Index) {
+ SmRamRanges[Index].Start = SmmDescBlock->Descriptor[Index].PhysicalStart;
+ if (SmRamRanges[Index].Start > 0x100000) {
+ //
+ // This is TSEG SMRAM range.
+ // IED region is also part of SMRAM but not reported in SMRAM Hob so here include IED for Rapid Start saving/restoring.
+ //
+ DEBUG ((EFI_D_INFO, "Ied size %X\n", IedSize));
+ SmRamRanges[Index].End = SmRamRanges[Index].Start + SmmDescBlock->Descriptor[Index].PhysicalSize + IedSize;
+ }
+ }
+
+ SmRamRanges[Index].Start = END_RANGES;
+ return EFI_SUCCESS;
+}
+
+/**
+ Retrieves DPR areas from SA register, and places the ranges found in
+ DprRanges array.
+
+ @param[out] DprRanges - Output buffer
+
+ @retval EFI_SUCCESS
+ @retval EFI_NOT_FOUND
+**/
+STATIC
+EFI_STATUS
+GetDprRanges (
+ OUT MEMORY_RANGE *DprRanges
+ )
+{
+ EFI_STATUS Status;
+ UINTN Index;
+ UINTN MchBase;
+ UINT32 DprData;
+ UINT32 DprSize;
+
+ Status = EFI_NOT_FOUND;
+ Index = 0;
+
+ MchBase = MmPciAddress (0, SA_MC_BUS, SA_MC_DEV, SA_MC_FUN, 0);
+ DprData = MmioRead32 (MchBase + R_SA_DPR);
+ DprSize = (DprData & V_DPR_DPRSIZE_MASK) << (N_SA_DPR_TOPOFDPR_OFFSET - N_DPR_DPRSIZE_OFFSET);
+
+ ///
+ /// Check whether DPR protection and DPR is enabled or not.
+ ///
+ if ((DprData & (B_SA_DPR_PRS_MASK + B_SA_DPR_EPM_MASK)) == (B_SA_DPR_PRS_MASK + B_SA_DPR_EPM_MASK)) {
+ DprRanges[Index].Start = (DprData & B_SA_DPR_TOPOFDPR_MASK) - DprSize;
+ DprRanges[Index].End = DprData & B_SA_DPR_TOPOFDPR_MASK;
+ DEBUG ((EFI_D_INFO, "DPR Start = %08lx, End = %08lx\n", DprRanges[Index].Start, DprRanges[Index].End));
+
+ Index ++;
+ Status = EFI_SUCCESS;
+ }
+
+ DprRanges[Index].Start = END_RANGES;
+ return Status;
+}
+
+/**
+ Constructs memory ranges to be saved/restored by RapidStart.
+ Reserved areas are excluded.
+
+ @param[out] OutMemoryRanges - Output buffer
+ @param[in] OutMemoryRangesSize - Number of entries in output buffer
+ @param[in] RapidStartData - A data buffer stored RapidStart internal non-volatile information.
+
+ @retval EFI_SUCCESS
+**/
+STATIC
+EFI_STATUS
+BuildMemoryRanges (
+ OUT MEMORY_RANGE *OutMemoryRanges,
+ IN UINTN OutMemoryRangesSize,
+ IN RAPID_START_PERSISTENT_DATA *RapidStartData
+ )
+{
+ MEMORY_RANGE MainRanges[4];
+ MEMORY_RANGE ResvRanges[3];
+ EFI_STATUS Status;
+ UINTN Index;
+
+ ///
+ /// Always exclude Legacy SMRAM ranges (A0000~BFFFF) since this range can not perform DMA.
+ /// If Legacy SMRAM is used it will be handled separately.
+ ///
+ Index = 0;
+ MainRanges[Index].Start = 0;
+ MainRanges[Index].End = LEGACY_SMRAM_BASE;
+ ++Index;
+ MainRanges[Index].Start = LEGACY_SMRAM_BASE + LEGACY_SMRAM_SIZE;
+ MainRanges[Index].End = RapidStartData->Tolm;
+ ++Index;
+ if (RapidStartData->Tohm > MEM_EQU_4GB) {
+ MainRanges[Index].Start = MEM_EQU_4GB;
+ MainRanges[Index].End = RapidStartData->Tohm;
+ ++Index;
+ }
+
+ ASSERT (Index < VARIABLE_SIZE (MainRanges));
+ MainRanges[Index].Start = END_RANGES;
+
+ Index = 0;
+ ResvRanges[Index].Start = RapidStartData->RapidStartMem;
+ ResvRanges[Index].End = RapidStartData->RapidStartMem + RapidStartData->RapidStartMemSize;
+ ++Index;
+#ifdef RAPID_START_ON_MEMORY_INSTALLED
+ ResvRanges[Index].Start = RapidStartData->AcpiReservedMemoryBase;
+ ResvRanges[Index].End = RapidStartData->AcpiReservedMemoryBase + RapidStartData->AcpiReservedMemorySize;
+ ++Index;
+#endif
+ ASSERT (Index < VARIABLE_SIZE (ResvRanges));
+ ResvRanges[Index].Start = END_RANGES;
+
+ ///
+ /// Exclude reserved ranges
+ ///
+ Status = SubtractRanges (
+ OutMemoryRanges,
+ OutMemoryRangesSize,
+ MainRanges,
+ ResvRanges
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ return EFI_SUCCESS;
+}
+
+#ifdef RAPID_START_NO_SMRAM_INTEGRITY_CHECK
+#define HASHING_CONTEXT typedef enum { EMPTY }
+#define HashingInit(c, r) EFI_SUCCESS
+#define HashingProcessChunk(c) TRUE
+#define HashingCompleteAndVerify(c, t) EFI_SUCCESS
+#else
+
+typedef struct {
+ MEMORY_RANGE *Range;
+ UINT8 *Ptr;
+ VOID *HashState;
+} HASHING_CONTEXT;
+
+#define HASHING_CHUNK (4 * EFI_PAGE_SIZE)
+
+/**
+ Initializes secure hash algorithm.
+
+ @param[in] Context - Hashing context
+ @param[in] Ranges - Memory ranges to be included in resulting hash
+
+ @retval EFI_SUCCESS Hashing process completed
+ @retval ERROR Return the error code if PeiServicesAllocatePool () failed
+**/
+STATIC
+EFI_STATUS
+HashingInit (
+ HASHING_CONTEXT *Context,
+ MEMORY_RANGE *Ranges
+ )
+{
+ UINTN HashStatetSize;
+ EFI_STATUS Status;
+
+ Context->Range = Ranges;
+ Context->Ptr = (VOID *) (UINTN) Ranges->Start;
+
+ HashStatetSize = IfsSecureHashGetContextSize ();
+ ASSERT (HashStatetSize != 0);
+
+ Status = PeiServicesAllocatePool (HashStatetSize, &Context->HashState);
+ if (EFI_ERROR (Status)) {
+ ASSERT_EFI_ERROR (Status);
+ return Status;
+ }
+
+ RapidStartSecureHashInit (Context->HashState);
+ return EFI_SUCCESS;
+}
+
+/**
+ Processes next chunk of memory.
+
+ @param[in] Context - Hashing context
+
+ @retval TRUE if hashing complete, FALSE othervise.
+**/
+STATIC
+BOOLEAN
+HashingProcessChunk (
+ HASHING_CONTEXT *Context
+ )
+{
+ UINTN Size;
+ if (Context->Range->Start == END_RANGES) {
+ return TRUE;
+ }
+
+ DEBUG ((EFI_D_INFO, "#"));
+ Size = (UINTN) Context->Range->End - (UINTN) Context->Ptr;
+ if (Size > HASHING_CHUNK) {
+ Size = HASHING_CHUNK;
+ }
+
+ RapidStartSecureHashUpdate (Context->HashState, (VOID *) Context->Ptr, Size);
+ Context->Ptr += Size;
+ if ((UINTN) Context->Ptr == (UINTN) Context->Range->End) {
+ ++Context->Range;
+ Context->Ptr = (VOID *) (UINTN) Context->Range->Start;
+ }
+
+ return FALSE;
+}
+
+/**
+ Finishes hashing and saves/verifies resulting value depending on RapidStart transition.
+
+ @param[in] Context - Hashing context
+ @param[in] Instance - RapidStart instance
+
+ @retval EFI_SECURITY_VIOLATION - SMRAM content has changed.
+ @retval EFI_SUCCESS - SMRAM content no change.
+**/
+STATIC
+EFI_STATUS
+HashingCompleteAndVerify (
+ HASHING_CONTEXT *Context,
+ RAPID_START_INSTANCE *Instance
+ )
+{
+ UINT8 Hash[RAPID_START_SECURE_HASH_LENGTH];
+ EFI_STATUS Status;
+
+ DEBUG ((EFI_D_INFO, "HashingCompleteAndVerify...\n"));
+
+ Status = EFI_SUCCESS;
+ while (!HashingProcessChunk (Context)) {
+ }
+
+ RapidStartSecureHashFinal (Context->HashState, Hash);
+
+#ifdef EFI_DEBUG
+ PrintHex (Hash, RAPID_START_SECURE_HASH_LENGTH);
+#endif
+
+ if (Instance->Transition == RapidStartExit) {
+ if (CompareMem (Hash, Instance->SmRamHash, RAPID_START_SECURE_HASH_LENGTH) != 0) {
+ DEBUG ((EFI_D_ERROR, "Error: SMRAM content has changed!\n"));
+ Status = EFI_SECURITY_VIOLATION;
+ }
+
+ ZeroMem (Instance->SmRamHash, RAPID_START_SECURE_HASH_LENGTH);
+ } else {
+ Status = RapidStartSaveSecureHash (Hash);
+ ASSERT_EFI_ERROR (Status);
+ }
+
+ ZeroMem (Hash, RAPID_START_SECURE_HASH_LENGTH);
+ ZeroMem (Context->HashState, IfsSecureHashGetContextSize ());
+
+ return Status;
+}
+
+#endif
+
+/**
+ Check ME status and wait for ME init done
+
+ @retval EFI_SUCCESS - ME Init done
+ @retval EFI_TIMEOUT - ME is not ready after timeout occurred
+ @retval EFI_DEVICE_ERROR - Error reported by ME F/W
+**/
+STATIC
+EFI_STATUS
+WaitMeInitDone (
+ VOID
+ )
+{
+ EFI_PEI_SERVICES **PeiServices;
+ PEI_HECI_PPI *HeciPpi;
+ EFI_STATUS Status;
+ UINT32 MeStatus;
+ UINT32 MeMode;
+ UINTN Timeout;
+
+ DEBUG ((EFI_D_INFO, "WaitMeInitDone()\n"));
+
+ PeiServices = GetPeiServicesTablePointer ();
+
+ Status = (*PeiServices)->LocatePpi (
+ PeiServices,
+ &gPeiHeciPpiGuid,
+ 0,
+ NULL,
+ (VOID **) &HeciPpi
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ Status = HeciPpi->GetMeMode (PeiServices, &MeMode);
+ ASSERT_EFI_ERROR (Status);
+ ///
+ /// If ME is in ME_DEBUG mode, return success.
+ ///
+ if (MeMode == ME_MODE_DEBUG) {
+ return EFI_SUCCESS;
+ }
+
+ if (MeMode != ME_MODE_NORMAL) {
+ return EFI_DEVICE_ERROR;
+ }
+
+ Timeout = 0;
+ while (Timeout < ME_FID_TIMEOUT) {
+ Status = HeciPpi->GetMeStatus (PeiServices, &MeStatus);
+ ASSERT_EFI_ERROR (Status);
+
+ if (ME_STATUS_IS_ME_FW_INIT_COMPLETE (MeStatus)) {
+ return EFI_SUCCESS;;
+ }
+
+ PchPmTimerStall (1000);
+ Timeout++;
+ }
+
+ DEBUG ((EFI_D_ERROR, "ME init timeout!\n"));
+ return EFI_TIMEOUT;
+}
+
+/**
+ Calls Func for each port in PortMap.
+
+ @param[in] Ahci - SATA controller information structure
+ @param[in] Func - Pointer to function to be called with Ahci and port number passed as arguments
+ @param[in] PortMap - Bitmap of ports for wich Func is to be called
+**/
+STATIC
+VOID
+ForEachAhciPort (
+ IN AHCI_CONTEXT *Ahci,
+ IN EFI_STATUS (*Func) (AHCI_CONTEXT*, UINTN),
+ IN UINT32 PortMap
+ )
+{
+ UINTN Port;
+
+ for (Port = 0; Port <= 31; ++Port) {
+ if (PortMap & (1u << Port)) {
+ Func (Ahci, Port);
+ }
+ }
+ return;
+}
+
+/**
+ Issues STANDBY_IMMEDIATE command to given SATA port.
+ Port is initialized first and disabled afterwards.
+
+ @param Ahci - SATA controller information structure
+ @param Port - Port number to issue command to
+
+ @retval EFI_SUCCESS - fucntion executed successfully
+ @retval EFI_TIMEOUT - Timeout occured
+ @retval EFI_DEVICE_ERROR - AHCI port initialization failed or Command failed
+**/
+STATIC
+EFI_STATUS
+StandbyAhciPort (
+ IN AHCI_CONTEXT *Ahci,
+ IN UINTN Port
+ )
+{
+ AHCI_CONTEXT AhciTmp;
+ EFI_STATUS Status;
+ DEBUG ((EFI_D_INFO, "StandbyAhciPort(%d)\n", Port));
+
+ AhciTmp = *Ahci;
+ AhciTmp.Port = Port;
+ Status = AhciPortInit (&AhciTmp);
+ if (Status == EFI_SUCCESS) {
+ Status = AhciSimpleCommand (&AhciTmp, ATA_CMD_STANDBY_IMMEDIATE);
+ }
+ AhciPortDone (&AhciTmp);
+ return Status;
+}
+
+/**
+ Initialize Ahci port for RapidStart accessing SSD in early stage.
+
+ @param[in] Instance - Instance contains required data and function for RapidStart
+**/
+STATIC
+VOID
+RapidStartInitAhci (
+ IN RAPID_START_INSTANCE *Instance
+ )
+{
+ AHCI_CONTEXT *Ahci;
+ RAPID_START_PERSISTENT_DATA *RapidStartData;
+
+ DEBUG ((EFI_D_INFO, "InitAhci\n"));
+
+ Ahci = &Instance->Ahci;
+ RapidStartData = &Instance->Data;
+
+ Ahci->Abar = (UINT32) RapidStartData->MmioSpace;
+ Ahci->PortBase = (UINT32) RapidStartData->RapidStartMem;
+ Ahci->PortSize = RapidStartData->RapidStartMemSize -
+ sizeof (RAPID_START_MEM_DATA) -
+ RapidStartData->ZeroBitmapSize -
+ RapidStartData->Crc32RecordSize;
+ Ahci->Port = RapidStartData->StoreSataPort;
+
+ DEBUG ((EFI_D_INFO, "Ahci.Abar = %08x\n", Ahci->Abar));
+ DEBUG ((EFI_D_INFO, "Ahci.Port = %d\n", Ahci->Port));
+ DEBUG ((EFI_D_INFO, "Ahci.PortBase = %08x\n", Ahci->PortBase));
+ DEBUG ((EFI_D_INFO, "Ahci.PortSize = %08x\n", Ahci->PortSize));
+
+ ///
+ /// Restore SATA ports configuration
+ ///
+ MmioWrite8 (
+ MmPciAddress (
+ 0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_SATA,
+ PCI_FUNCTION_NUMBER_PCH_SATA,
+ R_PCH_SATA_PCS),
+ RapidStartData->SataPortConfiguration
+ );
+
+ AhciInit (Ahci);
+ AhciSpinUp (Ahci);
+}
+
+#define RETURN_ON_ERROR(expr) \
+ do { \
+ EFI_STATUS _status; \
+ _status = (expr); \
+ if (EFI_ERROR (_status)) { \
+ return _status; \
+ } \
+ } while (0)
+
+/**
+ Transfer SMRAM ranges to/from RapidStart partition.
+
+ Legacy SMRAM 0xA0000-0xC0000 is handled indirectly.
+
+ @param[in] Ahci - AHCI context
+ @param[in,out] AtaCmd - ATA command structure
+ @param[in] Transition - RapidStart transition
+ @param[in] SmRamRanges - Array of SMRAM ranges
+
+ @retval EFI_STATUS - the error code returned by AhciPostCommand () if failed.
+ @retval EFI_SUCCESS - Hasing SMRAM process completed.
+**/
+STATIC
+EFI_STATUS
+RapidStartHandleSmRam (
+ IN AHCI_CONTEXT *Ahci,
+ IN OUT ATA_COMMAND *AtaCmd,
+ IN RAPID_START_TRANSITION Transition,
+ IN MEMORY_RANGE *SmRamRanges
+ )
+{
+ MEMORY_RANGE *Range;
+ UINTN CmdMask;
+
+ DEBUG ((EFI_D_INFO, "SMRAM handling...\n"));
+ PrintRanges (SmRamRanges);
+
+ if (Transition == RapidStartEntry) {
+ ///
+ /// Ensure original LEGACY_SMRAM_BUFFER data has been stored into RapidStart Store before we modifying it.
+ ///
+ RETURN_ON_ERROR (AhciWaitAllComplete (Ahci));
+ CopyMem ((VOID *) LEGACY_SMRAM_BUFFER, (VOID *) LEGACY_SMRAM_BASE, (UINTN) LEGACY_SMRAM_SIZE);
+ }
+
+ CmdMask = 0;
+ Range = SmRamRanges;
+ while (Range->Start != END_RANGES) {
+ AtaCmd->SectorCount = MEM_TO_SECT (RANGE_LENGTH (Range));
+ if (Range->Start == LEGACY_SMRAM_BASE) {
+ ASSERT (Range->End == LEGACY_SMRAM_BASE + LEGACY_SMRAM_SIZE);
+ AtaCmd->MemAddr = LEGACY_SMRAM_BUFFER;
+ RETURN_ON_ERROR (AhciPostCommand (Ahci, AtaCmd, &CmdMask));
+ } else {
+ AtaCmd->MemAddr = Range->Start;
+ CmdMask = ~CmdMask;
+ RETURN_ON_ERROR (AhciPostCommand (Ahci, AtaCmd, &CmdMask));
+ CmdMask = ~CmdMask;
+ }
+
+ ++Range;
+ }
+
+ AhciWaitComplete (Ahci, CmdMask);
+ if (Transition == RapidStartExit) {
+ CopyMem ((VOID *) LEGACY_SMRAM_BASE, (VOID *) LEGACY_SMRAM_BUFFER, (UINTN) LEGACY_SMRAM_SIZE);
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Performs AHCI commands required to save or restore memory content.
+
+ @param[in] Instance - RapidStart instance
+ @param[in] MainRanges - Ranges of memory to be transferred
+ @param[in] SmRamRanges - SMRAM ranges, to by handled by RapidStartHandleSmRam
+
+ @retval EFI_SUCCESS - RapidStart transition succeeded
+ @retval EFI_TIMEOUT - AHCI timeout occured
+ @retval EFI_DEVICE_ERROR - AHCI device not ready
+ @retval EFI_NOT_STARTED - Transition cancellation happened, abort the transition.
+ @retval EFI_NO_MEDIA - No RapidStart Store available or RapidStart store has been changed. Abort RapidStart transition.
+ @retval EFI_BAD_BUFFER_SIZE - Memory configuration changed. Abort RapidStart transition.
+**/
+STATIC
+EFI_STATUS
+RapidStartMemoryDiskTransfer (
+ IN RAPID_START_INSTANCE *Instance,
+ IN MEMORY_RANGE *MainRanges,
+ IN MEMORY_RANGE *SmRamRanges
+ )
+{
+ RAPID_START_PERSISTENT_DATA *RapidStartData;
+ AHCI_CONTEXT *Ahci;
+ RAPID_START_TRANSITION Transition;
+ ATA_COMMAND AtaCmd;
+ MEMORY_RANGE *MemRanges;
+ MEMORY_RANGE *Range;
+ EFI_STATUS Status;
+ UINT32 *ZeroPageBitMap;
+ UINT32 SectorsLeft;
+ HASHING_CONTEXT Hashing;
+ BOOLEAN HashingDone;
+ UINT64 DataCount;
+ UINT32 *SmramBuffer;
+ UINT32 ZeroBitmapForSmramBuffer;
+ UINT64 LbaForData;
+ UINT64 SmRamBufferLba;
+ EFI_STATUS GfxDisplayStatus;
+ PEI_GFX_PPI *PeiGfxPpi;
+ GFX_RESTORE_MEM_TABLE *GfxRestoreMemTable;
+ GFX_RESTORE_MEM_TABLE *FbRestoreMemTable;
+ UINT32 Index, GfxIndex, MemIndex;
+ MEMORY_RANGE *GfxResvRanges;
+ MEMORY_RANGE *TempMemRanges;
+ UINT64 PageAlignedDssAddr;
+ UINT64 PageAlignedDssSize;
+
+ MemRanges = (MEMORY_RANGE *) AllocatePool (sizeof(MEMORY_RANGE) * (MAX_MEMORY_RANGES + 1));
+ if (MemRanges == NULL) {
+ DEBUG ((EFI_D_ERROR, "Failed to allocate memory for MemRanges! \n"));
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ GfxResvRanges = (MEMORY_RANGE *) AllocatePool (sizeof(MEMORY_RANGE) * (MAX_GFX_MEMORY_RANGES + 1));
+ if (GfxResvRanges == NULL) {
+ DEBUG ((EFI_D_ERROR, "Failed to allocate memory for GfxResvRanges! \n"));
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ TempMemRanges = (MEMORY_RANGE *) AllocatePool (sizeof(MEMORY_RANGE) * (MAX_MEMORY_RANGES + 1));
+ if (GfxResvRanges == NULL) {
+ DEBUG ((EFI_D_ERROR, "Failed to allocate memory for TempMemRanges! \n"));
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ RapidStartData = &Instance->Data;
+ Ahci = &Instance->Ahci;
+ Transition = Instance->Transition;
+
+ ///
+ /// Exclude SMRAM ranges as they are handled separetely
+ ///
+ Status = SubtractRanges (
+ MemRanges,
+ VARIABLE_SIZE (MemRanges),
+ MainRanges,
+ SmRamRanges
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ AtaCmd.Auxiliary.Data = 0;
+ if (Transition == RapidStartEntry) {
+ if (RapidStartData->HybridHardDisk == 1) {
+ Status = AhciHybridHardDiskSupport (Ahci);
+ if (Status == EFI_SUCCESS) {
+ if (Ahci->TotalRemainingCacheCapacityInSector < RapidStartData->StoreSectors) {
+ return EFI_BAD_BUFFER_SIZE;
+ }
+ AtaCmd.Auxiliary.r.HybridPriority = Ahci->HybridInfo.HybridPriority;
+ AtaCmd.Auxiliary.r.HybridInfoValid = 1;
+ } else if (Status != EFI_UNSUPPORTED) {
+ return Status;
+ }
+ }
+
+ Ahci->PollCancellation = TRUE;
+ AtaCmd.Command = ATA_CMD_WRITE_DMA_EXT;
+ AtaCmd.Direction = AHCI_DIR_HOST2DEV;
+ } else {
+ Ahci->PollCancellation = FALSE;
+ AtaCmd.Command = ATA_CMD_READ_DMA_EXT;
+ AtaCmd.Direction = AHCI_DIR_DEV2HOST;
+ if (RapidStartData->HybridHardDisk == 1) {
+ if (((Ahci->Identify[ATA_ID_DEV_HYBRID_FEATURE_SUPPORT] & B_ATA_ID_DEV_HYBRID_FEATURE_SUPPORT) &
+ (Ahci->Identify[ATA_ID_DEV_HYBRID_FEATURE_ENABLE] & B_ATA_ID_DEV_HYBRID_FEATURE_ENABLE))
+ ) {
+ AtaCmd.Auxiliary.r.HybridPriority = 0;
+ AtaCmd.Auxiliary.r.HybridInfoValid = 1;
+ }
+ }
+ }
+
+ AtaCmd.Feature = 0;
+
+#ifdef RAPID_START_WHOLE_MEMORY_CHECK
+ ///
+ /// Save CRC32 for memory below 4GB
+ ///
+ if (Transition == RapidStartEntry) {
+ SaveOrCompareCrc32 (FALSE, 0, RapidStartData->Tolm, RapidStartData);
+ }
+#endif
+ ///
+ /// Head sector store the Zero Page Bitmap, so save/restore it first
+ ///
+ ZeroPageBitMap = RAPID_START_ZERO_PAGE_BITMAP_PTR (RapidStartData);
+ ///
+ /// For Entry, store RapidStart Store UID in the head of Zero Page Bitmap.
+ ///
+ if (Transition == RapidStartEntry) {
+ *(UINT64 *) (ZeroPageBitMap) = RapidStartData->RapidStartStoreUid;
+ }
+
+ AtaCmd.MemAddr = (UINTN) ZeroPageBitMap;
+ AtaCmd.Lba = RapidStartData->StoreLbaAddr;
+ AtaCmd.SectorCount = MEM_TO_SECT (RapidStartData->ZeroBitmapSize + RapidStartData->Crc32RecordSize);
+ RETURN_ON_ERROR (AhciPostCommand (Ahci, &AtaCmd, NULL));
+
+ LbaForData = RapidStartData->StoreLbaAddr + MEM_TO_SECT (RapidStartData->ZeroBitmapSize + RapidStartData->Crc32RecordSize);
+ GfxDisplayStatus = EFI_UNSUPPORTED;
+ if (RapidStartData->DssAddress != (UINT64)NULL) {
+ PageAlignedDssAddr = RapidStartData->DssAddress & ~EFI_PAGE_MASK;
+ PageAlignedDssSize = (EFI_SIZE_TO_PAGES(PageAlignedDssAddr) < EFI_SIZE_TO_PAGES(RapidStartData->DssAddress) ) ? EFI_PAGE_SIZE : 0;
+ PageAlignedDssSize += RapidStartData->DssSize;
+ AtaCmd.MemAddr = (UINTN) PageAlignedDssAddr;
+ AtaCmd.Lba = LbaForData;
+ AtaCmd.SectorCount = MEM_TO_SECT (PageAlignedDssSize);
+ RETURN_ON_ERROR (AhciPostCommand (Ahci, &AtaCmd, NULL));
+ LbaForData += MEM_TO_SECT (PageAlignedDssSize);
+
+ GfxIndex = 0;
+ GfxResvRanges[GfxIndex].Start = PageAlignedDssAddr;
+ GfxResvRanges[GfxIndex].End = PageAlignedDssAddr + PageAlignedDssSize;
+ ++GfxIndex;
+
+ //
+ // save/restore GTT, GMM... ets Gfx memory related Range
+ //
+ GfxDisplayStatus = PeiServicesLocatePpi (&gPeiGfxPpiGuid, 0, NULL, &PeiGfxPpi);
+ ASSERT_EFI_ERROR (GfxDisplayStatus);
+ if (!EFI_ERROR (GfxDisplayStatus)) {
+ if (Transition == RapidStartExit) {
+ RETURN_ON_ERROR (AhciWaitAllComplete (Ahci));
+ }
+ GfxDisplayStatus = PeiGfxPpi->GetRestoreMemTable (GetPeiServicesTablePointer (), &GfxRestoreMemTable);
+ DEBUG ((EFI_D_ERROR, "Gfx GetRestoreMemTable Status = %r, NumberofEntry = %x\n", GfxDisplayStatus, GfxRestoreMemTable->NumOfEntry));
+ if (!EFI_ERROR (GfxDisplayStatus) && (GfxRestoreMemTable->NumOfEntry <= GFX_RESTORE_RANGE)) {
+ for (Index = 0; Index < GfxRestoreMemTable->NumOfEntry; Index++) {
+ DEBUG ((EFI_D_ERROR, "Gfx related memory Ranges [%x] - BaseAddress is %lx, Size is %lx\n", Index, GfxRestoreMemTable->MemRangeEntry[Index].BaseAddress, GfxRestoreMemTable->MemRangeEntry[Index].Size));
+
+ GfxResvRanges[GfxIndex].Start = GfxRestoreMemTable->MemRangeEntry[Index].BaseAddress;
+ GfxResvRanges[GfxIndex].End = GfxRestoreMemTable->MemRangeEntry[Index].BaseAddress + GfxRestoreMemTable->MemRangeEntry[Index].Size;
+
+ MemIndex = 0;
+ while (MemRanges[MemIndex].Start != END_RANGES) {
+ if (GfxResvRanges[GfxIndex].Start >= MemRanges[MemIndex].Start && GfxResvRanges[GfxIndex].End <= MemRanges[MemIndex].End) {
+ DEBUG ((EFI_D_ERROR, "Gfx related memory Ranges [%x] - BaseAddress is %lx, Size is %lx has been save(restore).\n", Index, GfxRestoreMemTable->MemRangeEntry[Index].BaseAddress, GfxRestoreMemTable->MemRangeEntry[Index].Size));
+
+ AtaCmd.MemAddr = (UINTN) GfxRestoreMemTable->MemRangeEntry[Index].BaseAddress;
+ AtaCmd.Lba = LbaForData;
+ AtaCmd.SectorCount = MEM_TO_SECT (GfxRestoreMemTable->MemRangeEntry[Index].Size);
+ RETURN_ON_ERROR (AhciPostCommand (Ahci, &AtaCmd, NULL));
+ LbaForData += MEM_TO_SECT (GfxRestoreMemTable->MemRangeEntry[Index].Size);
+ ++GfxIndex;
+ break;
+ }
+ ++MemIndex;
+ }
+ }
+ }
+ //
+ // save/restore Gfx Frame Buffer Ranges
+ //
+ if (RapidStartData->DisplayType == 1 && !EFI_ERROR (GfxDisplayStatus)) {
+ if (Transition == RapidStartExit) {
+ RETURN_ON_ERROR (AhciWaitAllComplete (Ahci));
+ }
+ GfxDisplayStatus = PeiGfxPpi->GetRestoreFbRange (GetPeiServicesTablePointer (), &FbRestoreMemTable);
+ DEBUG ((EFI_D_ERROR, "Gfx GetRestoreFbRange Status = %r, NumberofEntry = %x\n", GfxDisplayStatus, FbRestoreMemTable->NumOfEntry));
+ if (!EFI_ERROR (GfxDisplayStatus) && (FbRestoreMemTable->NumOfEntry <= FB_RESTORE_RANGE)) {
+ for (Index = 0; Index < FbRestoreMemTable->NumOfEntry; Index++) {
+ DEBUG ((EFI_D_ERROR, "Gfx FB memory Ranges [%x] - BaseAddress is %lx, Size is %lx\n", Index, FbRestoreMemTable->MemRangeEntry[Index].BaseAddress, FbRestoreMemTable->MemRangeEntry[Index].Size));
+
+ GfxResvRanges[GfxIndex].Start = FbRestoreMemTable->MemRangeEntry[Index].BaseAddress;
+ GfxResvRanges[GfxIndex].End = FbRestoreMemTable->MemRangeEntry[Index].BaseAddress + FbRestoreMemTable->MemRangeEntry[Index].Size;
+
+ MemIndex = 0;
+ while (MemRanges[MemIndex].Start != END_RANGES) {
+ if (GfxResvRanges[GfxIndex].Start >= MemRanges[MemIndex].Start && GfxResvRanges[GfxIndex].End <= MemRanges[MemIndex].End) {
+ DEBUG ((EFI_D_ERROR, "Gfx FB memory Ranges [%x] - BaseAddress is %lx, Size is %lx has been save(restore).\n", Index, FbRestoreMemTable->MemRangeEntry[Index].BaseAddress, FbRestoreMemTable->MemRangeEntry[Index].Size));
+
+ AtaCmd.MemAddr = (UINTN) FbRestoreMemTable->MemRangeEntry[Index].BaseAddress;
+ AtaCmd.Lba = LbaForData;
+ AtaCmd.SectorCount = MEM_TO_SECT (FbRestoreMemTable->MemRangeEntry[Index].Size);
+ RETURN_ON_ERROR (AhciPostCommand (Ahci, &AtaCmd, NULL));
+ LbaForData += MEM_TO_SECT (FbRestoreMemTable->MemRangeEntry[Index].Size);
+ ++GfxIndex;
+ break;
+ }
+ ++MemIndex;
+ }
+ }
+ }
+ }
+ ASSERT (GfxIndex < VARIABLE_SIZE (GfxResvRanges));
+ GfxResvRanges[GfxIndex].Start = END_RANGES;
+
+ //
+ // Copy MemRanges to TempMemRanges
+ //
+ GfxDisplayStatus = SubtractRanges (
+ TempMemRanges,
+ VARIABLE_SIZE (TempMemRanges),
+ MainRanges,
+ SmRamRanges
+ );
+ ASSERT_EFI_ERROR (GfxDisplayStatus);
+
+ //
+ // Exclude Gfx related memory ranges as they are handled separetely
+ //
+ GfxDisplayStatus = SubtractRanges (
+ MemRanges,
+ VARIABLE_SIZE (MemRanges),
+ TempMemRanges,
+ GfxResvRanges
+ );
+ ASSERT_EFI_ERROR (GfxDisplayStatus);
+
+ }
+ }
+
+ if (RapidStartData->DssAddress != (UINT64)NULL) {
+ if (!EFI_ERROR (GfxDisplayStatus)) {
+ switch(Transition) {
+ case RapidStartEntry:
+ DEBUG ((EFI_D_INFO, "Calling GfxDisplay in RapidStart entry flow...\n"));
+// GfxDisplayStatus = RapidStartGfxDisplayScreen();
+ break;
+ case RapidStartExit:
+ DEBUG ((EFI_D_INFO, "Calling GfxDisplay in RapidStart exit flow...\n"));
+ if (RapidStartUnattendedWake() == FALSE) {
+ GfxDisplayStatus = RapidStartGfxDisplayScreen();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ if (Transition == RapidStartExit) {
+ AtaCmd.Lba = LbaForData;
+ if ((RapidStartHandleSmRam (Ahci, &AtaCmd, Transition, SmRamRanges) == EFI_DEVICE_ERROR) ||
+ (AhciWaitAllComplete (Ahci) == EFI_DEVICE_ERROR)
+ ) {
+ DEBUG (
+ (
+ EFI_D_ERROR,
+ "\nEFI_DEVICE_ERROR in first DMA command, probably RapidStart Store changed. Aborted RapidStart resume.\n"
+ )
+ );
+ RapidStartSetFlag (RAPID_START_FLAG_STORE_CHANGE);
+ return EFI_NO_MEDIA;
+ }
+
+ if (*(UINT64 *) (ZeroPageBitMap) != RapidStartData->RapidStartStoreUid) {
+ DEBUG ((EFI_D_ERROR, "\nRapidStart Store UID Mismatched! Aborted RapidStart resume.\n"));
+ RapidStartSetFlag (RAPID_START_FLAG_STORE_CHANGE);
+ return EFI_NO_MEDIA;
+ }
+ }
+
+ ZeroPageBitMap += 2;
+ DEBUG ((EFI_D_INFO, "Transfer ranges:\n"));
+ PrintRanges (MemRanges);
+
+ RETURN_ON_ERROR (HashingInit (&Hashing, SmRamRanges));
+
+ DataCount = 0;
+
+ HashingDone = FALSE;
+ AtaCmd.Lba = LbaForData + MEM_TO_SECT (SumRanges (SmRamRanges));
+ Range = MemRanges;
+ SmRamBufferLba = AtaCmd.Lba;
+ ///
+ /// Log the last Lba which not in used.
+ ///
+ Instance->NotUsedLba = AtaCmd.Lba;
+ PERF_START_EX (NULL, L"EventRec", NULL, AsmReadTsc (), 0x2510);
+ while (Range->Start != END_RANGES) {
+ AtaCmd.MemAddr = Range->Start;
+ SectorsLeft = MEM_TO_SECT (RANGE_LENGTH (Range));
+ while (SectorsLeft > 0) {
+ if (HashingDone || AhciHasFreeCmdSlot (Ahci)) {
+ if (SectorsLeft > AHCI_MAX_SECTORS) {
+ AtaCmd.SectorCount = AHCI_MAX_SECTORS;
+ } else {
+ AtaCmd.SectorCount = SectorsLeft;
+ }
+
+ SectorsLeft -= AtaCmd.SectorCount;
+ RETURN_ON_ERROR (AhciPostCommandWithZeroFilter (Ahci, &AtaCmd, NULL, ZeroPageBitMap, &SmRamBufferLba));
+ DataCount += AtaCmd.SectorCount << SECTOR_SHIFT;
+ } else {
+ if (Ahci->PollCancellation && RapidStartShouldCancelEntry ()) {
+ return EFI_NOT_STARTED;
+ }
+
+ HashingDone = HashingProcessChunk (&Hashing);
+ }
+ ///
+ /// Log the last Lba which not in used.
+ ///
+ Instance->NotUsedLba = AtaCmd.Lba;
+ }
+
+ ++Range;
+ }
+
+ RETURN_ON_ERROR (HashingCompleteAndVerify (&Hashing, Instance));
+ PERF_END_EX (NULL, L"EventRec", NULL, AsmReadTsc (), 0x2511);
+
+ if (Transition == RapidStartEntry) {
+ Ahci->PollCancellation = FALSE;
+ AtaCmd.Lba = LbaForData;
+ RETURN_ON_ERROR (RapidStartHandleSmRam (Ahci, &AtaCmd, Transition, SmRamRanges));
+ ///
+ /// Restore LEGACY_SMRAM_BUFFER
+ ///
+ AtaCmd.Command = ATA_CMD_READ_DMA_EXT;
+ AtaCmd.Direction = AHCI_DIR_DEV2HOST;
+ AtaCmd.MemAddr = LEGACY_SMRAM_BUFFER;
+ AtaCmd.SectorCount = MEM_TO_SECT (LEGACY_SMRAM_SIZE);
+ AtaCmd.Lba = SmRamBufferLba;
+ RETURN_ON_ERROR (AhciPostCommandWithZeroFilter (Ahci, &AtaCmd, NULL, ZeroPageBitMap, NULL));
+ }
+ ///
+ /// If LEGACY_SMRAM_BUFFER contained zero pages, they have to be zero-ed
+ ///
+ ZeroBitmapForSmramBuffer = *(ZeroPageBitMap + (LEGACY_SMRAM_BUFFER / EFI_PAGE_SIZE / 8 / 4));
+ SmramBuffer = (UINT32 *) LEGACY_SMRAM_BUFFER;
+ if (ZeroBitmapForSmramBuffer != 0) {
+ while (SmramBuffer < (UINT32 *) (LEGACY_SMRAM_BUFFER + LEGACY_SMRAM_SIZE)) {
+ if (ZeroBitmapForSmramBuffer & 1) {
+ ZeroMem (SmramBuffer, EFI_PAGE_SIZE);
+ }
+
+ ZeroBitmapForSmramBuffer >>= 1;
+ SmramBuffer += (EFI_PAGE_SIZE / 4);
+ }
+ }
+
+ PERF_START_EX (NULL, L"EventRec", NULL, AsmReadTsc (), 0x2520);
+ Status = AhciWaitAllComplete (Ahci);
+ PERF_END_EX (NULL, L"EventRec", NULL, AsmReadTsc (), 0x2521);
+
+#ifdef RAPID_START_WHOLE_MEMORY_CHECK
+ ///
+ /// Verify CRC32 for memory below 4GB
+ ///
+ if (Transition == RapidStartExit) {
+ SaveOrCompareCrc32 (TRUE, 0, RapidStartData->Tolm, RapidStartData);
+ }
+#endif
+
+ return Status;
+}
+
+/**
+ Save/Restore memory content to/from RapidStart Store
+
+ @param[in] Instance - RapidStart instance
+
+ @retval EFI_SUCCESS - RapidStart transition succeeded
+ @retval EFI_BAD_BUFFER_SIZE - Memory configuration changed. Abort RapidStart transition.
+ @retval EFI_BUFFER_TOO_SMALL - RapidStart Store size is too small to store memory content
+ @retval EFI_TIMEOUT - AHCI timeout occured
+ @retval EFI_DEVICE_ERROR - AHCI device not ready
+**/
+STATIC
+EFI_STATUS
+RapidStartTransitionInternal (
+ IN RAPID_START_INSTANCE *Instance
+ )
+{
+ RAPID_START_PERSISTENT_DATA *RapidStartData;
+ AHCI_CONTEXT *Ahci;
+ UINTN MchBase;
+ UINT8 OldSmramControl;
+ UINT32 OldTseg;
+ UINT8 OldPam[PAM_COUNT];
+ MEMORY_RANGE *MemRanges;
+ MEMORY_RANGE SmRamRanges[MAX_SMRAM_RANGES + 1];
+ UINTN Index;
+ EFI_STATUS Status;
+ UINT32 OldDpr;
+
+ MemRanges = (MEMORY_RANGE *) AllocatePool (sizeof(MEMORY_RANGE) * (MAX_MEMORY_RANGES + 1));
+ if (MemRanges == NULL) {
+ DEBUG ((EFI_D_ERROR, "Failed to allocate memory for MemRanges! \n"));
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ RapidStartData = &Instance->Data;
+ Ahci = &Instance->Ahci;
+
+#ifdef EFI_DEBUG
+ DumpMcRegisters ();
+#endif
+ DEBUG ((EFI_D_INFO, "Mem : %x\n", (UINT32) RapidStartData->RapidStartMem));
+ DEBUG ((EFI_D_INFO, "Io : %x\n", (UINT32) RapidStartData->MmioSpace));
+ DEBUG (
+ (EFI_D_INFO,
+ "Store: port=%d start=%lx size=%x\n",
+ RapidStartData->StoreSataPort,
+ RapidStartData->StoreLbaAddr,
+ RapidStartData->StoreSectors)
+ );
+
+ MchBase = MmPciAddress (0, SA_MC_BUS, SA_MC_DEV, SA_MC_FUN, 0);
+ if (RapidStartData->Tolm != (MmioRead32 (MchBase + R_SA_BDSM) & B_SA_BDSM_BDSM_MASK)) {
+ DEBUG ((EFI_D_ERROR, "Memory Tolm changed\n"));
+ return EFI_BAD_BUFFER_SIZE;
+ }
+
+ if (RapidStartData->Tohm != (MmioRead64 (MchBase + R_SA_TOUUD) & B_SA_TOUUD_TOUUD_MASK)) {
+ DEBUG ((EFI_D_ERROR, "Memory Tohm changed\n"));
+ return EFI_BAD_BUFFER_SIZE;
+ }
+
+ DEBUG ((EFI_D_INFO, "Total Memory: %lx\n", RapidStartData->TotalMem));
+
+ Status = GetSmRamRanges (SmRamRanges, VARIABLE_SIZE (SmRamRanges), Instance->IedSize);
+ ASSERT_EFI_ERROR (Status);
+ DEBUG ((EFI_D_INFO, "SMRAM ranges:\n"));
+ PrintRanges (SmRamRanges);
+
+ Status = BuildMemoryRanges (
+ MemRanges,
+ VARIABLE_SIZE (MemRanges),
+ RapidStartData
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ DEBUG ((EFI_D_INFO, "Memory ranges:\n"));
+ PrintRanges (MemRanges);
+
+ ///
+ /// Save and open SMRAM
+ ///
+ OldSmramControl = MmioRead8 (MchBase + R_SA_SMRAMC);
+ MmioWrite8 (MchBase + R_SA_SMRAMC, B_SA_SMRAMC_D_OPEN_MASK | B_SA_SMRAMC_G_SMRAME_MASK);
+
+ ///
+ /// Open PAM regions
+ ///
+ for (Index = 0; Index < PAM_COUNT; ++Index) {
+ OldPam[Index] = MmioRead8 (MchBase + R_SA_PAM0 + Index);
+ MmioWrite8 (MchBase + R_SA_PAM0 + Index, B_SA_PAM1_HIENABLE_MASK | B_SA_PAM1_LOENABLE_MASK);
+ }
+ ///
+ /// Disable TSEG and DPR
+ ///
+ OldTseg = MmioRead32 (MchBase + R_SA_TSEGMB);
+ MmioWrite32 (MchBase + R_SA_TSEGMB, RapidStartData->Tolm);
+ OldDpr = MmioRead32 (MchBase + R_SA_DPR);
+ MmioAnd32 (MchBase + R_SA_DPR, (UINT32) ~B_SA_DPR_EPM_MASK);
+
+ PERF_START_EX (NULL, L"EventRec", NULL, AsmReadTsc (), 0x2500);
+ Status = AhciPortInit (Ahci);
+ PERF_END_EX (NULL, L"EventRec", NULL, AsmReadTsc (), 0x2501);
+
+ //
+ // Unlock device if password locked
+ //
+ PERF_START_EX (NULL, L"EventRec", NULL, AsmReadTsc (), 0x2530);
+ if (Status == EFI_SUCCESS) {
+ Status = AhciGetLockStatus (Ahci);
+ if (Status == EFI_ACCESS_DENIED) {
+ if (Instance->Transition == RapidStartEntry) {
+ Instance->PwdStatus = RapidStartGetDriveUnlockPassword (
+ GetPeiServicesTablePointer (),
+ Instance->Transition,
+ Instance->Data.StoreSataPort,
+ (UINT8 *) Instance->HddPassword,
+ &Instance->FreezeLock
+ );
+ }
+
+ if (Instance->PwdStatus == EFI_SUCCESS) {
+ Status = AhciSecurityUnlock (Ahci, Instance->HddPassword);
+ if (Instance->FreezeLock) {
+ AhciSimpleCommand (Ahci, ATA_CMD_SECURITY_FREEZE_LOCK);
+ }
+ } else {
+ DEBUG ((EFI_D_ERROR, "RapidStart: No drive password provided!"));
+ }
+ }
+ }
+ ZeroMem (Instance->HddPassword, ATA_PASSWORD_LEN);
+ PERF_END_EX (NULL, L"EventRec", NULL, AsmReadTsc (), 0x2531);
+
+ if (Status == EFI_SUCCESS) {
+ //
+ // DPR will be disable temporary, so we won't exculde this region.
+ // To save/restore DPR region as normal memory does.
+ //
+
+ Instance->NotUsedLba = RapidStartData->StoreLbaAddr;
+
+ PERF_START_EX (NULL, L"EventRec", NULL, AsmReadTsc (), 0x2540);
+ Status = RapidStartMemoryDiskTransfer (Instance, MemRanges, SmRamRanges);
+ PERF_END_EX (NULL, L"EventRec", NULL, AsmReadTsc (), 0x2541);
+
+ if ((Instance->Transition == RapidStartEntry) && (Status == EFI_SUCCESS)) {
+ AhciSimpleCommand (Ahci, ATA_CMD_FLUSH_CACHE);
+ AhciSimpleCommand (Ahci, ATA_CMD_STANDBY_IMMEDIATE);
+ AhciPortDone (Ahci);
+ ForEachAhciPort (Ahci, StandbyAhciPort, AhciGetPresentPorts () & ~(1u << Ahci->Port));
+ } else {
+ ///
+ /// 1. In RapidStart Entry, if user has canceled RapidStart Entry flow, TRIM RapidStart Store.
+ /// 2. In RapidStart Resume, only TRIM when Resume successfully, SMRAM content changed.
+ ///
+#ifdef RAPID_START_TRIM_ON_RESUME
+ if (((Instance->Transition == RapidStartEntry) && (Status == EFI_NOT_STARTED)) ||
+ ((Instance->Transition == RapidStartExit) && ((Status == EFI_SUCCESS) || (Status == EFI_SECURITY_VIOLATION)))
+ ) {
+ DEBUG ((EFI_D_INFO, "\nNot used LBA in RapidStart store = %lX\n", Instance->NotUsedLba));
+ ASSERT (Instance->NotUsedLba > RapidStartData->StoreLbaAddr);
+ Ahci->PollCancellation = FALSE;
+
+ PERF_START_EX (NULL, L"EventRec", NULL, AsmReadTsc (), 0x2550);
+ AhciTrimRange (
+ Ahci,
+ RapidStartData->StoreLbaAddr,
+ (UINT32) (Instance->NotUsedLba - RapidStartData->StoreLbaAddr)
+ );
+ PERF_END_EX (NULL, L"EventRec", NULL, AsmReadTsc (), 0x2551);
+ }
+#endif
+ }
+ AhciPortDone (Ahci);
+ }
+
+ AhciDone (Ahci);
+
+ //
+ // Restore TSEG
+ //
+ MmioWrite32 (MchBase + R_SA_TSEGMB, OldTseg);
+ MmioWrite32 (MchBase + R_SA_DPR, OldDpr);
+
+ //
+ // Restore PAM regions
+ //
+ for (Index = 0; Index < PAM_COUNT; ++Index) {
+ MmioWrite8 (MchBase + R_SA_PAM0 + Index, OldPam[Index]);
+ }
+ //
+ // Restore SMRAMC
+ //
+ MmioWrite8 (MchBase + R_SA_SMRAMC, OldSmramControl);
+
+ return Status;
+}
+
+/**
+ Restores Memory pointers required by MemoryInit to install S3 reserved area on S3 resume.
+
+ @param[in] This - RapidStart PPI
+**/
+STATIC
+VOID
+RapidStartRestoreS3Pointers (
+ IN RAPID_START_PPI *This
+ )
+{
+ RAPID_START_INSTANCE *Instance;
+ RAPID_START_PERSISTENT_DATA *RapidStartData;
+ UINT64 AcpiVariableSet64;
+ ACPI_VARIABLE_SET *AcpiVariableSet;
+ EFI_PEI_READ_ONLY_VARIABLE_PPI *ReadOnlyVariable;
+ UINTN VarSize;
+ EFI_STATUS Status;
+
+ DEBUG ((EFI_D_INFO, "RapidStartRestoreS3Pointers\n"));
+
+ Instance = RAPID_START_INSTANCE_FROM_THIS (This);
+ RapidStartData = &Instance->Data;
+
+ Status = PeiServicesLocatePpi (&gEfiPeiReadOnlyVariablePpiGuid, 0, NULL, (VOID **) &ReadOnlyVariable);
+ ASSERT_EFI_ERROR (Status);
+
+ VarSize = sizeof (AcpiVariableSet64);
+ Status = ReadOnlyVariable->PeiGetVariable (
+ GetPeiServicesTablePointer (),
+ ACPI_GLOBAL_VARIABLE,
+ &gEfiAcpiVariableGuid,
+ NULL,
+ &VarSize,
+ &AcpiVariableSet64
+ );
+
+ AcpiVariableSet = (ACPI_VARIABLE_SET *) (UINTN) AcpiVariableSet64;
+
+ ASSERT (!EFI_ERROR (Status) && AcpiVariableSet != NULL);
+ if (EFI_ERROR (Status) || AcpiVariableSet == NULL) {
+ return;
+ }
+
+#ifdef RAPID_START_USE_OLD_ACPI_VARIABLE_SET
+ AcpiVariableSet->SystemMemoryLength = RapidStartData->SystemMemoryLengthBelow4GB;
+#else
+ AcpiVariableSet->SystemMemoryLengthBelow4GB = RapidStartData->SystemMemoryLengthBelow4GB;
+ AcpiVariableSet->SystemMemoryLengthAbove4GB = RapidStartData->SystemMemoryLengthAbove4GB;
+#endif
+ AcpiVariableSet->AcpiReservedMemoryBase = RapidStartData->AcpiReservedMemoryBase;
+ AcpiVariableSet->AcpiReservedMemorySize = RapidStartData->AcpiReservedMemorySize;
+
+ DEBUG ((EFI_D_INFO, "SystemMemoryLengthBelow4GB %lx\n", RapidStartData->SystemMemoryLengthBelow4GB));
+ DEBUG ((EFI_D_INFO, "SystemMemoryLengthAbove4GB %lx\n", RapidStartData->SystemMemoryLengthAbove4GB));
+ DEBUG ((EFI_D_INFO, "AcpiReservedMemoryBase %lx\n", RapidStartData->AcpiReservedMemoryBase));
+ DEBUG ((EFI_D_INFO, "AcpiReservedMemorySize %x\n", RapidStartData->AcpiReservedMemorySize));
+
+}
+
+/**
+ Check if RapidStart support is enabled.
+
+ @param[in] This - Pointer to RapidStart PPI
+
+ @retval TRUE if RapidStart support is enabled FALSE otherwise
+**/
+BOOLEAN
+RapidStartIsEnabled (
+ IN RAPID_START_PPI *This
+ )
+{
+ RAPID_START_INSTANCE *Instance;
+ Instance = RAPID_START_INSTANCE_FROM_THIS (This);
+ return Instance->Enabled;
+}
+
+/**
+ Detremines RapidStart transition.
+
+ @param[in] This - Pointer to RapidStart PPI
+
+ @retval RapidStart_TRANSITION - The RapidStart transition being performed
+**/
+RAPID_START_TRANSITION
+RapidStartGetMode (
+ IN RAPID_START_PPI *This
+ )
+{
+ RAPID_START_INSTANCE *Instance;
+ DEBUG ((EFI_D_INFO, "RapidStartGetMode()\n"));
+ Instance = RAPID_START_INSTANCE_FROM_THIS (This);
+ ASSERT (Instance->Transition != RapidStartTransitionMax);
+ return Instance->Transition;
+}
+
+/**
+ Performs actual RapidStart transition.
+
+ @param[in] This - RapidStart PPI
+
+ @retval EFI_ABORTED - RapidStart Entry or Resume failed
+ @retval EFI_SUCCESS - RapidStart Entry/Resume successfully
+**/
+STATIC
+EFI_STATUS
+RapidStartDoTransition (
+ IN RAPID_START_PPI *This
+ )
+{
+ RAPID_START_INSTANCE *Instance;
+ RAPID_START_PERSISTENT_DATA *RapidStartData;
+ RAPID_START_MEM_DATA *RapidStartMemData;
+ EFI_PEI_SERVICES **PeiServices;
+ EFI_STATUS Status;
+ EFI_STATUS MeStatus;
+ UINT32 PmBase;
+
+ ///
+ /// 1857 = Intel Rapid Start Technology
+ ///
+ IoWrite16 (0x80, 0x1857);
+
+ DEBUG ((EFI_D_INFO, "RapidStartDoTransition()\n"));
+
+ PmBase = MmioRead32 (
+ MmPciAddress (
+ 0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_ACPI_BASE)
+ ) & B_PCH_LPC_ACPI_BASE_BAR;
+
+ PeiServices = GetPeiServicesTablePointer ();
+ Instance = RAPID_START_INSTANCE_FROM_THIS (This);
+ RapidStartData = &Instance->Data;
+
+ RapidStartMemData = RAPID_START_MEM_DATA_PTR (RapidStartData);
+
+ Status = RapidStartBeforeTransition (
+ GetPeiServicesTablePointer (),
+ Instance->Transition,
+ Instance->Data.StoreSataPort
+ );
+ if (EFI_ERROR (Status)) {
+ Instance->Transition = RapidStartNone;
+ }
+
+ switch (Instance->Transition) {
+
+ case RapidStartEntry:
+ DEBUG ((EFI_D_ERROR, "RapidStart ENTRY\n"));
+
+ ///
+ /// Clear all GPE events before SIM enabling
+ ///
+ RapidStartClearAndEnablePmeEvent (FALSE);
+
+ RapidStartMemData->EntryCanceled = 0;
+
+ Status = RapidStartTransitionInternal (Instance);
+
+ MeStatus = EFI_SUCCESS;
+ MeStatus = WaitMeInitDone ();
+ if (RapidStartMemData->OsWakeTimeEnabled && (Status != EFI_NOT_STARTED)) {
+ DEBUG (
+ (EFI_D_INFO,
+ "Setting RTC alarm to OS provided value %02d-%02d:%02d:%02d\n",
+ RapidStartMemData->OsWakeTime.Date,
+ RapidStartMemData->OsWakeTime.Hour,
+ RapidStartMemData->OsWakeTime.Minute,
+ RapidStartMemData->OsWakeTime.Second)
+ );
+
+ RtcSetAlarm (&RapidStartMemData->OsWakeTime);
+
+ //
+ // set RTC_EN bit in PM1_EN to wake up from the alarm
+ //
+ IoWrite16 (
+ PmBase + R_PCH_ACPI_PM1_EN,
+ (IoRead16 (PmBase + R_PCH_ACPI_PM1_EN) | B_PCH_ACPI_PM1_EN_RTC)
+ );
+ }
+ if (EFI_ERROR (Status) || EFI_ERROR (MeStatus)) {
+ if (Status == EFI_NOT_STARTED) {
+ ///
+ /// RapidStart Entry flow has been canceled, do S3 resume.
+ ///
+ DEBUG ((EFI_D_ERROR, "User canceled RapidStart!\n"));
+ RapidStartMemData->EntryCanceled = 1;
+ } else {
+ DEBUG ((EFI_D_ERROR, "RapidStart entry failed!\n"));
+ Instance->RapidStartGlobalNvs->EventsEnabled = 0;
+ Instance->RapidStartGlobalNvs->EventsAvailable = 0;
+ }
+
+ Status = PeiServicesNotifyPpi (&mRapidStartRecoveryNotifyDesc);
+ ASSERT_EFI_ERROR (Status);
+ RapidStartAfterTransition (PeiServices, RapidStartEntry, Status, RapidStartData->StoreSataPort);
+ break;
+ }
+
+ RapidStartSetFlag (RAPID_START_FLAG_ENTRY_DONE);
+
+ RapidStartAfterTransition (PeiServices, RapidStartEntry, Status, RapidStartData->StoreSataPort);
+
+ Status = PeiServicesNotifyPpi (&mRapidStartS4NotifyDesc);
+ ASSERT_EFI_ERROR (Status);
+ break;
+
+ case RapidStartExit:
+ DEBUG ((EFI_D_ERROR, "RapidStart EXIT\n"));
+
+ Status = PeiServicesNotifyPpi (&mRapidStartExitNotifyDesc);
+ ASSERT_EFI_ERROR (Status);
+
+ Status = RapidStartTransitionInternal (Instance);
+
+ MeStatus = EFI_SUCCESS;
+
+ if (EFI_ERROR (Status) || EFI_ERROR (MeStatus)) {
+ DEBUG ((EFI_D_ERROR, "RapidStart exit failed!\n"));
+ if (EFI_ERROR (Status)) {
+ RapidStartAfterTransition (PeiServices, RapidStartExit, Status, RapidStartData->StoreSataPort);
+ }
+
+ if (EFI_ERROR (MeStatus)) {
+ RapidStartAfterTransition (PeiServices, RapidStartExit, MeStatus, RapidStartData->StoreSataPort);
+ }
+
+ PeiServicesResetSystem ();
+ EFI_DEADLOOP ();
+ }
+ ///
+ /// Set DISB
+ ///
+ MmioOr16 (
+ MmPciAddress (
+ 0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_GEN_PMCON_2),
+ B_PCH_LPC_GEN_PMCON_DRAM_INIT
+ );
+
+ RapidStartAfterTransition (PeiServices, RapidStartExit, EFI_SUCCESS, RapidStartData->StoreSataPort);
+ break;
+
+ case RapidStartNone:
+ ///
+ /// Cancelled
+ ///
+ Status = EFI_ABORTED;
+ break;
+
+ default:
+ ASSERT (0);
+ }
+
+ IoWrite16 (0x80, 0);
+
+ return Status;
+}
+
+/**
+ Executes or schedules RapidStart transition if appropriate.
+
+ @param[in] This - Pointer to RapidStart PPI
+ @param[out] BootMode - Boot mode that may be overridden
+
+ @retval EFI_SUCCESS - RapidStart transition performed/scheduled successfully
+ @retval EFI_ABORTED - RapidStart transition aborted
+**/
+STATIC
+EFI_STATUS
+RapidStartTransitionEntryPoint (
+ IN RAPID_START_PPI *This,
+ OUT EFI_BOOT_MODE *BootMode
+ )
+{
+ EFI_STATUS Status;
+ RAPID_START_TRANSITION Transition;
+
+ DEBUG ((EFI_D_INFO, "RapidStartTransitionEntryPoint\n"));
+
+ Transition = RapidStartGetMode (This);
+ Status = EFI_SUCCESS;
+
+ if (Transition != RapidStartNone) {
+#ifdef RAPID_START_ON_MEMORY_INSTALLED
+ RapidStartRestoreS3Pointers (This);
+ Status = PeiServicesNotifyPpi (&mRapidStartTransitionPpiNotifyDesc);
+ ASSERT_EFI_ERROR (Status);
+#else
+ Status = RapidStartDoTransition (This);
+#endif
+ if (Transition == RapidStartExit && BootMode != NULL) {
+ *BootMode = BOOT_ON_S3_RESUME;
+ ///
+ /// Update Boot Mode
+ ///
+ Status = PeiServicesSetBootMode (BOOT_ON_S3_RESUME);
+ ASSERT_EFI_ERROR (Status);
+ }
+ }
+
+ return Status;
+}
+
+/**
+ Checks power button override status.
+
+ @retval TRUE if power button override has taken place, FALSE otherwise.
+**/
+STATIC
+BOOLEAN
+IsPowerButtonOverride (
+ VOID
+ )
+{
+ UINT32 PmBase;
+ PmBase = MmioRead32 (
+ MmPciAddress (
+ 0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_ACPI_BASE)
+ ) & B_PCH_LPC_ACPI_BASE_BAR;
+
+ return (IoRead16 (PmBase + R_PCH_ACPI_PM1_STS) & B_PCH_ACPI_PM1_STS_PRBTNOR) != 0;
+}
+
+/**
+ Retrieves RapidStart non-volatile flag and data,
+ initializes RapidStart instance,
+ handles RapidStart entry conditions and prerequisites.
+
+ @param[in,out] Instance - RapidStart instance
+**/
+STATIC
+VOID
+RapidStartInitInstance (
+ IN OUT RAPID_START_INSTANCE *Instance
+ )
+{
+ EFI_PEI_READ_ONLY_VARIABLE_PPI *ReadOnlyVariable;
+ UINTN Size;
+ EFI_STATUS Status;
+ BOOLEAN RapidStartFlag;
+ UINT8 EventsEnabled;
+ UINT32 PmBase;
+ EFI_BOOT_MODE BootMode;
+ SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi;
+
+ Instance->Signature = RAPID_START_INSTANCE_SIGNATURE;
+ Instance->Transition = RapidStartNone;
+ Instance->Enabled = FALSE;
+ Instance->FreezeLock = TRUE;
+ Instance->PwdStatus = EFI_NOT_FOUND;
+
+ Status = PeiServicesLocatePpi (&gEfiPeiReadOnlyVariablePpiGuid, 0, NULL, (VOID **) &ReadOnlyVariable);
+ ASSERT_EFI_ERROR (Status);
+
+ Size = sizeof (RAPID_START_PERSISTENT_DATA);
+ Status = ReadOnlyVariable->PeiGetVariable (
+ GetPeiServicesTablePointer (),
+ gRapidStartPersistentDataName,
+ &gRapidStartPersistentDataGuid,
+ NULL,
+ &Size,
+ &Instance->Data
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_INFO, "RapidStart disabled (No RapidStart variable found)\n"));
+ return ;
+ }
+
+ Instance->Enabled = TRUE;
+ Instance->RapidStartGlobalNvs = (RAPID_START_GLOBAL_NVS_AREA *) Instance->Data.RapidStartGlobalNvsPtr;
+ DEBUG ((EFI_D_INFO, "RapidStartGlobalNVS: %x\n", Instance->RapidStartGlobalNvs));
+
+ Status = PeiServicesGetBootMode (&BootMode);
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Get IED size through the SaPlatformPolicy PPI
+ //
+ SaPlatformPolicyPpi = NULL;
+ Status = PeiServicesLocatePpi (
+ &gSaPlatformPolicyPpiGuid,
+ 0,
+ NULL,
+ (VOID **) &SaPlatformPolicyPpi
+ );
+ ASSERT_EFI_ERROR (Status);
+ if ((SaPlatformPolicyPpi != NULL) && (SaPlatformPolicyPpi->Revision >= SA_PLATFORM_POLICY_PPI_REVISION_9)) {
+ Instance->IedSize = SaPlatformPolicyPpi->PlatformData->IedSize;
+ } else {
+ Instance->IedSize = 0x400000;
+ }
+
+ if (BootMode == BOOT_ON_S3_RESUME) {
+ DEBUG ((EFI_D_INFO, "S3 resume\n"));
+
+ PmBase = MmioRead32 (
+ MmPciAddress (
+ 0,
+ DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_ACPI_BASE)
+ ) & B_PCH_LPC_ACPI_BASE_BAR;
+
+ Status = RapidStartGetConfig (&EventsEnabled);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Check RTC alarm wake event
+ ///
+ if (IoRead16 (PmBase + R_PCH_ACPI_PM1_STS) & B_PCH_ACPI_PM1_STS_RTC) {
+ ///
+ /// Clear RTC Alarm Flag
+ ///
+ RtcRead (R_PCH_RTC_REGC);
+ if (EventsEnabled & RAPID_START_ACPI_RTC_WAKE) {
+ DEBUG ((EFI_D_INFO, "RapidStart on RTC wake\n"));
+ Instance->Transition = RapidStartEntry;
+ } else {
+ DEBUG ((EFI_D_INFO, "Boot from RapidStart cancellation or this is waking by OS timer\n"));
+ }
+ }
+ ///
+ /// Check for critical battery wake event
+ ///
+ else if ((EventsEnabled & RAPID_START_ACPI_BATT_WAKE) && RapidStartCheckCriticalBatteryWakeupEvent ()) {
+ DEBUG ((EFI_D_INFO, "RapidStart on critical battery wake from EC.\n"));
+ RapidStartInitializeCriticalBatteryWakeupEvent (FALSE);
+ RapidStartClearAllKscWakeStatus ();
+ Instance->Transition = RapidStartEntry;
+ }
+
+ return ;
+ }
+ ///
+ /// Check RapidStart non-volatile flag
+ ///
+ Status = RapidStartGetFlag (&RapidStartFlag);
+ if (EFI_ERROR (Status) || ((RapidStartFlag & RAPID_START_FLAG_ENTRY_DONE) == 0)) {
+ DEBUG ((EFI_D_INFO, "No RapidStart flag set\n"));
+ return ;
+ }
+ ///
+ /// RapidStart exit path (Cold boot assumed)
+ /// For security reasones need to clear SMRAM hash and drive password from non-volatile
+ /// memory first.
+ ///
+#ifndef RAPID_START_NO_SMRAM_INTEGRITY_CHECK
+ Status = RapidStartRestoreAndClearSecureHash (Instance->SmRamHash);
+#endif
+
+ Instance->PwdStatus = RapidStartGetDriveUnlockPassword (
+ GetPeiServicesTablePointer (),
+ RapidStartExit,
+ Instance->Data.StoreSataPort,
+ (UINT8 *) Instance->HddPassword,
+ &Instance->FreezeLock
+ );
+
+ ///
+ /// This is either RapidStart Resume flow or non-RapidStart transition
+ /// Clear RapidStart flag in the start point.
+ ///
+ RapidStartSetFlag (0);
+
+ if (EFI_ERROR (Status)) {
+ return ;
+ }
+
+ if (IsPowerButtonOverride ()) {
+ DEBUG ((EFI_D_INFO, "PWRBTN override\n"));
+ return ;
+ }
+
+ DEBUG ((EFI_D_INFO, "RapidStart exit\n"));
+ Instance->Transition = RapidStartExit;
+}
+
+/**
+ Install RapiStartPpi.
+
+ @param[in] PeiServices - Pointer to PEI Services Table.
+ @param[in] NotifyDesc - Pointer to the descriptor for the Notification event that caused this function to execute.
+ @param[in] Ppi - Pointer to the PPI data associated with this function.
+
+ @retval EFI_SUCCESS
+**/
+STATIC
+EFI_STATUS
+InstallRapidStartPpi (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
+ IN VOID *Ppi
+ )
+{
+ RAPID_START_INSTANCE *Instance;
+ EFI_STATUS Status;
+
+ Instance = AllocateZeroPool (sizeof (RAPID_START_INSTANCE));
+ ASSERT (Instance != NULL);
+ if (Instance == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ Instance->Ppi.Revision = RAPID_START_PPI_REVISION_1;
+ Instance->Ppi.GetMode = RapidStartGetMode;
+ Instance->Ppi.TransitionEntryPoint = RapidStartTransitionEntryPoint;
+ Instance->Ppi.IsEnabled = RapidStartIsEnabled;
+
+ Instance->PpiDesc.Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;
+ Instance->PpiDesc.Guid = &gRapidStartPpiGuid;
+ Instance->PpiDesc.Ppi = &Instance->Ppi;
+
+ RapidStartInitInstance (Instance);
+
+ if (Instance->Transition != RapidStartNone) {
+ RapidStartInitAhci (Instance);
+ }
+ if (Instance->Transition == RapidStartEntry) {
+ ForEachAhciPort (
+ &Instance->Ahci,
+ AhciSpinUpPort,
+ AhciGetEnabledPorts () & ~(1u << Instance->Ahci.Port)
+ );
+ }
+
+ Status = PeiServicesInstallPpi (&Instance->PpiDesc);
+ ASSERT_EFI_ERROR (Status);
+
+ return EFI_SUCCESS;
+
+}
+
+/**
+ RapidStart PEIM entry point driver
+
+ @param[in] FfsHeader - FFS file header pointer of this driver
+ @param[in] PeiServices - Pointer to PEI service table
+
+ @retval EFI_SUCCESS - RapidStart PPI installed successfully
+ @retval EFI_OUT_OF_RESOURCES - Error in allocate required resource.
+**/
+EFI_STATUS
+RapidStartPeiEntryPoint (
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ PEI_HECI_PPI *HeciPpi;
+ EFI_STATUS Status;
+
+ DEBUG ((EFI_D_INFO, "RapidStart: RapidStartPeiEntryPoint\n"));
+
+ ///
+ /// Install RapiStart Ppi when Heci Ppi is ready.
+ ///
+
+ Status = (*PeiServices)->LocatePpi (
+ PeiServices,
+ &gPeiHeciPpiGuid,
+ 0,
+ NULL,
+ (VOID **) &HeciPpi
+ );
+ if (EFI_ERROR(Status)) {
+ Status = PeiServicesNotifyPpi (&mInstallRapidStartPpiNotifyDesc);
+ ASSERT_EFI_ERROR (Status);
+ return EFI_SUCCESS;
+ }
+
+ return InstallRapidStartPpi (PeiServices, NULL, NULL);
+} \ No newline at end of file
diff --git a/ReferenceCode/RapidStart/Pei/RapidStartPei.cif b/ReferenceCode/RapidStart/Pei/RapidStartPei.cif
new file mode 100644
index 0000000..e2f18c8
--- /dev/null
+++ b/ReferenceCode/RapidStart/Pei/RapidStartPei.cif
@@ -0,0 +1,14 @@
+<component>
+ name = "RapidStartPei"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\RapidStart\Pei"
+ RefName = "RapidStartPei"
+[files]
+"RapidStartPei.sdl"
+"RapidStartPei.mak"
+"RapidStartPei.dxs"
+"RapidStartPei.c"
+"RapidStartAhci.c"
+"RapidStartAhci.h"
+"RapidStartPei.inf"
+<endComponent>
diff --git a/ReferenceCode/RapidStart/Pei/RapidStartPei.dxs b/ReferenceCode/RapidStart/Pei/RapidStartPei.dxs
new file mode 100644
index 0000000..9c903ca
--- /dev/null
+++ b/ReferenceCode/RapidStart/Pei/RapidStartPei.dxs
@@ -0,0 +1,41 @@
+/** @file
+ Dependency expression source file.
+
+@copyright
+ Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+
+#include "AutoGen.h"
+#include "PeimDepex.h"
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+#include "RapidStartConfig.h"
+#include EFI_PPI_DEPENDENCY (BootMode)
+#include EFI_PPI_DEPENDENCY (Variable)
+#include EFI_PPI_DEPENDENCY (Stall)
+
+#include EFI_PPI_DEPENDENCY (PchPeiInitDone)
+#include EFI_PPI_DEPENDENCY (SaPlatformPolicy)
+#endif
+
+DEPENDENCY_START
+ PEI_MASTER_BOOT_MODE_PEIM_PPI AND
+ PEI_STALL_PPI_GUID AND
+ PEI_READ_ONLY_VARIABLE_ACCESS_PPI_GUID AND
+ SA_PLATFORM_POLICY_PPI_GUID AND
+ PCH_PEI_INIT_DONE_PPI_GUID
+DEPENDENCY_END
diff --git a/ReferenceCode/RapidStart/Pei/RapidStartPei.inf b/ReferenceCode/RapidStart/Pei/RapidStartPei.inf
new file mode 100644
index 0000000..752c1ea
--- /dev/null
+++ b/ReferenceCode/RapidStart/Pei/RapidStartPei.inf
@@ -0,0 +1,119 @@
+## @file
+# Component description file for the RapidStart PEIM.
+#
+#@copyright
+# Copyright (c) 2004 - 2013 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = RapidStartPei
+FILE_GUID = 53f019e9-bb0c-424b-870a-1faf10b1cb4c
+COMPONENT_TYPE = PE32_PEIM
+
+[sources.common]
+ RapidStartAhci.h
+ RapidStartAhci.c
+ RapidStartPei.c
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGluePeimEntryPoint.c
+
+[includes.common]
+ .
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_RAPID_START_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_RAPID_START_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_RAPID_START_ROOT)/Samplecode
+ $(EFI_SOURCE)/$(PROJECT_RAPID_START_ROOT)/Samplecode/Include
+ $(EFI_SOURCE)/$(PROJECT_RAPID_START_ROOT)/Samplecode/Library/RapidStartCommonLib
+ $(EFI_SOURCE)/$(PROJECT_RAPID_START_ROOT)/Samplecode/Library/RapidStartPlatformLib/Pei
+ $(EFI_SOURCE)/$(PROJECT_RAPID_START_ROOT)/GfxDisplay/Library/Pei
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/$(PROJECT_SA_MRC)/Pei/Source/Api
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/$(PROJECT_SA_MRC)/Pei/Source/Include
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EFI_SOURCE)/Include
+
+[libraries.common]
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueBaseMemoryLib
+ EdkIIGluePeiDebugLibReportStatusCode
+ EdkIIGlueBaseLib
+ EdkIIGluePeiDxePostCodeLibReportStatusCode
+ EdkIIGluePeiReportStatusCodeLib
+ EdkIIGluePeiServicesLib
+ EdkIIGluePeiMemoryAllocationLib
+ EdkIIGlueBasePciLibPciExpress
+ EdkIIGlueBasePrintLib
+ RapidStartPpiLib
+#
+# Uncomment this only when ME is implemented
+#
+ MeLibPpi
+
+ EdkFrameworkPpiLib
+ IntelPchPpiLib
+ RapidStartCommonLib
+ RapidStartGuidLib
+ RapidStartPeiLib
+ GfxDisplayLibPei
+ PchPlatformLib
+ EdkIIGluePeiHobLib
+#
+# CryptoLib is required for SMRAM integrity check
+#
+ PeiCryptLib
+ OpensslLib
+ EdkIIGluePeiFirmwarePerformanceLib
+ IntelSaPpiLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = RapidStartPei.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=RapidStartPeiEntryPoint
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_PEI_SERVICES_LIB__ \
+ -D __EDKII_GLUE_PEI_MEMORY_ALLOCATION_LIB__ \
+ -D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+ -D __EDKII_GLUE_BASE_PRINT_LIB__ \
+ -D __EDKII_GLUE_PEI_HOB_LIB__ \
+ -DRAPID_START_USE_OLD_ACPI_VARIABLE_SET
+
diff --git a/ReferenceCode/RapidStart/Pei/RapidStartPei.mak b/ReferenceCode/RapidStart/Pei/RapidStartPei.mak
new file mode 100644
index 0000000..52015a3
--- /dev/null
+++ b/ReferenceCode/RapidStart/Pei/RapidStartPei.mak
@@ -0,0 +1,151 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2012, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+# $Header: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/RapidStartPei/RapidStartPei.mak 7 11/07/13 2:47a Joshchou $
+#
+# $Revision: 7 $
+#
+# $Date: 11/07/13 2:47a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/RapidStartPei/RapidStartPei.mak $
+#
+# 7 11/07/13 2:47a Joshchou
+# [TAG] EIP142523
+# [Category] Spec Update
+# [Severity] Important
+# [Description] Update to RC 1.7.0
+#
+# 6 1/13/13 7:38a Bensonlai
+# [TAG] EIP112060
+# [Category] Spec Update
+# [Severity] Normal
+# [Description] [SBY]Intel Rapid Start Technology Framework Reference
+# Code Production Candidate 0.9.0
+# [Files] RapidStartDxe.c, RapidStartConfig.h, RapidStartDxe.dsc,
+# RapidStartPei.dsc, RapidStartPei.c, RapidStartPei.inf,
+# RapidStartPei.mak, RapidStartInfo.h
+#
+# 5 10/15/12 5:45a Bensonlai
+# [Category] Improvement
+# [Severity] Important
+# [Description] Rename all IFFS sting to Rapid Start.
+# [Files] Board\EM\RapidStartWrapper\*.*, ReferenceCode\RapidStart\*.*
+#
+# 4 9/26/12 3:26a Yurenlai
+# [TAG] None
+# [Category] Improvement
+# [Severity] Important
+# [Description] Update Intel Rapid Start Technology Framework Reference
+# Code Beta Version 0.7.0.
+# [Description] ReferenceCode\RapidStart\*.*, RapidStartPeiLib.h
+#
+# 2 5/14/12 11:26p Yurenlai
+# [TAG] EIP90075
+# [Category] Improvement
+# [Severity] Important
+# [Description] Update Intel Rapid Start Technology Framework Reference
+# Code Alpha 2 Version 0.5.6.
+# [Description] ReferenceCode\RapidStart\*.*,
+# Board\EM\iFfsWrapper\Library\*.*
+#
+# 1 4/19/12 7:50a Yurenlai
+# Initial check in.
+#
+#*************************************************************************
+
+all : RapidStartPei
+RapidStartPei : $(BUILD_DIR)\RapidStartPei.mak RapidStartPeiBin
+
+$(BUILD_DIR)\RapidStartPei.mak : $(RapidStartPei_DIR)\$(@B).cif $(RapidStartPei_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(RapidStartPei_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+RapidStartPei_INCLUDES=\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+ $(INTEL_MCH_INCLUDES)\
+ $(ME_INCLUDES)\
+ /I$(GfxDisplayLibPei_DIR)\
+ $(RAPIDSTART_INCLUDES)\
+ /I$(IntelPlatformProtocolLib_DIR)\
+
+RapidStartPei_DEFINES=\
+ $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=RapidStartPeiEntryPoint"\
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__\
+ /D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_PEI_SERVICES_LIB__ \
+ /D __EDKII_GLUE_PEI_MEMORY_ALLOCATION_LIB__ \
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+ /D __EDKII_GLUE_PEI_HOB_LIB__ \
+!IF "$(iME_SUPPORT)"=="1"
+ /D ME_SUPPORT_FLAG\
+!ENDIF
+
+RapidStartPei_LIBS =\
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EdkIIGlueBaseLibIA32_LIB)\
+ $(EdkIIGlueBasePrintLib_LIB)\
+ $(EdkIIGluePeiMemoryAllocationLib_LIB)\
+ $(EdkIIGluePeiDebugLibReportStatusCode_LIB)\
+ $(EdkIIGluePeiReportStatusCodeLib_LIB)\
+ $(EdkIIGluePeiServicesLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(EdkIIGlueBasePostCodeLibPort80_LIB)\
+ $(EDKFRAMEWORKPPILIB)\
+ $(PchPlatformPeiLib_LIB)\
+ $(IntelPchPpiLib_LIB)\
+ $(MeGuidLib_LIB)\
+ $(MeLibPpi_LIB)\
+ $(RapidStartPpiLib_LIB)\
+ $(RapidStartPeiLib_LIB)\
+ $(RapidStartCommonPeiLib_LIB)\
+ $(RapidStartGuidLib_LIB)\
+ $(EdkIIGluePeiHobLib_LIB)\
+ $(GfxDisplayLibPei_LIB)\
+ $(EdkIIGluePeiFirmwarePerformanceLib_LIB)\
+ $(INTEL_SA_PPI_LIB)\
+
+RapidStartPeiBin : $(RapidStartPei_LIBS) $(PEILIB)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS) \
+ /f $(BUILD_DIR)\RapidStartPei.mak all \
+ NAME=RapidStartPei \
+ MAKEFILE=$(BUILD_DIR)\RapidStartPei.mak \
+ GUID=53f019e9-bb0c-424b-870a-1faf10b1cb4c \
+ ENTRY_POINT=_ModuleEntryPoint \
+ "MY_INCLUDES = $(RapidStartPei_INCLUDES)" \
+ "MY_DEFINES = $(RapidStartPei_DEFINES)" \
+ TYPE=PEIM \
+ EDKIIModule=PEIM \
+ DEPEX1=$(RapidStartPei_DIR)\RapidStartPei.dxs \
+ DEPEX1_TYPE=EFI_SECTION_PEI_DEPEX \
+ COMPRESS=0
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2012, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/RapidStart/Pei/RapidStartPei.sdl b/ReferenceCode/RapidStart/Pei/RapidStartPei.sdl
new file mode 100644
index 0000000..008fedb
--- /dev/null
+++ b/ReferenceCode/RapidStart/Pei/RapidStartPei.sdl
@@ -0,0 +1,68 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+# $Header: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/RapidStartPei/RapidStartPei.sdl 1 4/19/12 7:50a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 4/19/12 7:50a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/RapidStartPei/RapidStartPei.sdl $
+#
+# 1 4/19/12 7:50a Yurenlai
+# Initial check in.
+#
+#*************************************************************************
+TOKEN
+ Name = "RapidStartPei_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+ Help = "Main switch to enable iFFS support in PEI Phase"
+End
+
+MODULE
+ Help = "Includes RapidStartPei.mak to Project"
+ File = "RapidStartPei.mak"
+End
+
+PATH
+ Name = "RapidStartPei_DIR"
+ Help = "RapidStartPei dir"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\RapidStartPei.ffs"
+ Parent = "FV_BB"
+ InvokeOrder = AfterParent
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/RapidStart/Ppi/PeiGfxPpi/PeiGfxPpi.c b/ReferenceCode/RapidStart/Ppi/PeiGfxPpi/PeiGfxPpi.c
new file mode 100644
index 0000000..185f36c
--- /dev/null
+++ b/ReferenceCode/RapidStart/Ppi/PeiGfxPpi/PeiGfxPpi.c
@@ -0,0 +1,33 @@
+/** @file
+ This file defines iFFS Gfx PPI
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Mobile Silicon Support Module" and is
+ licensed for Intel Mobile CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#include "PeiGfxPpi.h"
+#endif
+//
+// Protocol GUID definition
+//
+EFI_GUID gPeiGfxPpiGuid = PEI_GFX_PPI_GUID;
+
+//
+// Protocol description
+//
+EFI_GUID_STRING(&gPeiGfxPpiGuid, "PeiGfxPpi", "RST Gfx PPI");
diff --git a/ReferenceCode/RapidStart/Ppi/PeiGfxPpi/PeiGfxPpi.h b/ReferenceCode/RapidStart/Ppi/PeiGfxPpi/PeiGfxPpi.h
new file mode 100644
index 0000000..6636e8e
--- /dev/null
+++ b/ReferenceCode/RapidStart/Ppi/PeiGfxPpi/PeiGfxPpi.h
@@ -0,0 +1,89 @@
+/** @file
+ Header file for RapidStart Gfx PPI
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Mobile Silicon Support Module" and is
+ licensed for Intel Mobile CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PEI_GFX_PPI_H_
+#define _PEI_GFX_PPI_H_
+
+#define PEI_GFX_PPI_GUID \
+ { \
+ 0xc4d6994a, 0xaa3d, 0x47c0, 0xae, 0xa, 0xb0, 0xbf, 0xad, 0xba, 0xa6, 0x13 \
+ }
+
+extern EFI_GUID gPeiGfxPpiGuid;
+
+#define DSS_RANGE 0x01 //< Dss Range is 1
+#define GFX_RESTORE_RANGE 0x02 ///< Gfx Memory restore Range is 2
+#define FB_RESTORE_RANGE 250 ///< The Max FB Range is 16
+#define MAX_GFX_MEMORY_RANGES (DSS_RANGE + GFX_RESTORE_RANGE + FB_RESTORE_RANGE)
+
+#pragma pack(1)
+
+typedef struct {
+ UINT64 BaseAddress;
+ UINT64 Size;
+} GFX_MEM_RANGE_ENTRY;
+
+typedef struct {
+ UINT16 NumOfEntry;
+ UINT8 Reserved[2];
+ GFX_MEM_RANGE_ENTRY MemRangeEntry[MAX_GFX_MEMORY_RANGES];
+} GFX_RESTORE_MEM_TABLE;
+
+#pragma pack()
+
+typedef
+EFI_STATUS
+(EFIAPI * PEI_GFX_PPI_GET_DSS_ADDRESS_RANGE) (
+ IN CONST EFI_PEI_SERVICES **PeiServices,
+ OUT GFX_RESTORE_MEM_TABLE **DssAddressRange
+);
+
+typedef
+EFI_STATUS
+(EFIAPI * PEI_GFX_PPI_GET_RESTORE_MEM_TABLE) (
+ IN CONST EFI_PEI_SERVICES **PeiServices,
+ OUT GFX_RESTORE_MEM_TABLE **GfxRestoreMemTable
+);
+
+typedef
+EFI_STATUS
+(EFIAPI * PEI_GFX_PPI_GET_RESTORE_FB_RANGE) (
+ IN CONST EFI_PEI_SERVICES **PeiServices,
+ OUT GFX_RESTORE_MEM_TABLE **FbRestoreMemTable
+);
+
+typedef
+EFI_STATUS
+(EFIAPI * PEI_GFX_PPI_RESTORE_DISPLAY) (
+ IN CONST EFI_PEI_SERVICES **PeiServices
+);
+
+#pragma pack(1)
+
+typedef struct _PEI_GFX_PPI {
+ PEI_GFX_PPI_RESTORE_DISPLAY RestoreDisplay;
+ PEI_GFX_PPI_GET_DSS_ADDRESS_RANGE GetDssAddressRange;
+ PEI_GFX_PPI_GET_RESTORE_MEM_TABLE GetRestoreMemTable;
+ PEI_GFX_PPI_GET_RESTORE_FB_RANGE GetRestoreFbRange;
+} PEI_GFX_PPI;
+
+#pragma pack()
+
+#endif
diff --git a/ReferenceCode/RapidStart/Ppi/RapidStart/RapidStart.c b/ReferenceCode/RapidStart/Ppi/RapidStart/RapidStart.c
new file mode 100644
index 0000000..d27cbf3
--- /dev/null
+++ b/ReferenceCode/RapidStart/Ppi/RapidStart/RapidStart.c
@@ -0,0 +1,35 @@
+/** @file
+ This file defines RapidStart PPI
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Mobile Silicon Support Module" and is
+ licensed for Intel Mobile CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#include "RapidStart.h"
+#endif
+
+///
+/// Protocol GUID definition
+///
+EFI_GUID gRapidStartPpiGuid = RAPID_START_PPI_GUID;
+
+///
+/// Protocol description
+///
+EFI_GUID_STRING(&gRapidStartPpiGuid, "RapidStartPpi", "Rapid Start PPI");
diff --git a/ReferenceCode/RapidStart/Ppi/RapidStart/RapidStart.h b/ReferenceCode/RapidStart/Ppi/RapidStart/RapidStart.h
new file mode 100644
index 0000000..48d4bfc
--- /dev/null
+++ b/ReferenceCode/RapidStart/Ppi/RapidStart/RapidStart.h
@@ -0,0 +1,190 @@
+/** @file
+ Header file for RapidStart PPI
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Mobile Silicon Support Module" and is
+ licensed for Intel Mobile CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+#ifndef PPI_RAPID_START_H_
+#define PPI_RAPID_START_H_
+
+#define RAPID_START_PPI_GUID \
+ { \
+ 0x3d0e663a, 0xdc72, 0x4489, 0x87, 0xc5, 0xe4, 0x9e, 0xe7, 0x73, 0xa4, 0x52 \
+ }
+
+#define ATA_PASSWORD_LEN 32
+
+extern EFI_GUID gRapidStartPpiGuid;
+
+typedef struct _RAPID_START_PPI RAPID_START_PPI;
+
+///
+/// PPI revision number
+/// Any backwards compatible changes to this PPI will result in an update in the revision number
+/// Major changes will require publication of a new PPI
+///
+/// Revision 1: Original version
+///
+#define RAPID_START_PPI_REVISION_1 1
+
+typedef enum {
+ RapidStartNone,
+ RapidStartEntry,
+ RapidStartExit,
+ RapidStartTransitionMax
+} RAPID_START_TRANSITION;
+
+/**
+ Detremines RapidStart transition.
+
+ This PPI function will determine which Rapid Start transition state should be
+ performed. It will check current Rapid Start enable/disable by calling
+ RapidStartIsEnabled(), current boot mode, wakeup source and Rapid Start Entry
+ Flag. If Rapid Start enabled, current boot mode is S3 Resume and wakeup source
+ is one of the supported sources, the Rapid Start Entry will be performed. Once
+ Rapid Start Entry completed successfully the Rapid Start Entry Flag will be set
+ and next boot GetMode() will check this flag and perform Rapid Start Resume as
+ requested.
+
+ GetMode () function will do the following check:
+ - Rapid Start function is enabled or not
+ - Current boot mode is S3 resume or not
+ - If it is S3 resume, check wakeup source is one of enabled Rapid Start Entry
+ conditions to perform Rapid Start Entry.
+ - If it is not S3 resume, the Rapid Start transition mode should already be
+ determined in the RapidStartPeiEntryPoint ().
+
+ After Rapid Start Transition state determined TransitionEntryPoint () PPI
+ function will do the necessary Rapid Start transition.
+
+ @param[in] This - A pointer to RAPID_START_PPI itself.
+
+ @retval RAPID_START_TRANSITION - The RapidStart transition being performed
+**/
+typedef
+RAPID_START_TRANSITION
+(EFIAPI *RAPID_START_GET_MODE) (
+ IN RAPID_START_PPI *This
+ );
+
+/**
+ Executes or schedules RapidStart transition if appropriate.
+
+ This PPI function will perform or schedule an Rapid Start transition (by
+ registering either EFI_PEI_PERMANENT_MEMORY_INSTALLED_PPI_GUID or
+ PEI_RAPID_START_TRANSITION_START_PPI_GUID callback function). It includes Rapid
+ Start Entry or Rapid Start Exit transition basing on Transition mode. If
+ Transition mode is RapidStartTransitionMax which means unknown transition mode,
+ GetMode() will be called again to determine current Rapid Start transition mode.
+ In Rapid Start Entry transition, the memory content will be saved in "Rapid
+ Start Store" and Rapid Start Entry Flag will be set then system will be
+ switched to Rapid Start state. If error occurred during Rapid Start Entry
+ transition, it will switch system back to S3 state. In Rapid Start Exit
+ transition, Rapid Start Entry Flag will be cleared and the memory content will
+ be restored from "Rapid Start Store". If no error occurred, it will boot
+ from S3 resume path back to OS, otherwise it will reset system.
+
+ TransitionEntryPoint () function will do the following check:
+ - Rapid Start function is enabled or not
+ - If current Rapid Start transition mode is not determined yet, call
+ GetMode () PPI function.
+ - If current Transition state is "RapidStartNone", do nothing and
+ return to caller.
+ - If transition state is "Rapid Start Entry", save memory content to
+ Rapid Start Store. If no error occurring, set Rapid Start Entry Flag and
+ put system to Rapid Start state, otherwise it will re-enter S3 state as
+ Rapid Start Entry failed.
+ - If transition state is "RapidStartExit", restore memory content from
+ Rapid Start Store and override boot mode to "S3 Resume" so that
+ system will perform S3 resume back to OS. If error occurred during Rapid
+ Start Exit transition it will reset system.
+ - When "RapidStartDoTransition ()" is executed in
+ EFI_PEI_PERMANENT_MEMORY_INSTALLED_PPI_GUID or
+ PEI_RAPID_START_TRANSITION_START_PPI_GUID callback function, platform
+ code should ensure the NEM mode has been disabled and cache
+ configuration basing on memory map has been completed prior to execute
+ RapidStartDoTransition ().
+ - SMRAM hashing algorithm in reference code uses SHA256 algorithm in
+ "Crypto library" from UDK2010 source code. Those SMRAM hashing
+ relevant functions are not included in this document since they are no
+ porting required. Refer to Crypto library and BaseCryptLib.h for detail
+ information regarding those functions. See section Porting
+ Recommendation" for more information.
+
+ @param[in] This - Pointer to RapidStart PPI
+ @param[out] BootMode - Boot mode that may be overridden
+
+ @retval EFI_SUCCESS - RapidStart transition performed/scheduled successfully
+ @retval EFI_ABORTED - RapidStart transition aborted
+**/
+typedef
+EFI_STATUS
+(EFIAPI *RAPID_START_TRANSITION_ENTRY_POINT) (
+ IN RAPID_START_PPI * This,
+ OUT EFI_BOOT_MODE * BootMode
+ );
+
+/**
+ Check if RapidStart support is enabled.
+
+ This PPI function will return current Rapid Start enable/disable state.
+
+ IsEnabled () function will return current Rapid Start enable/disable state.
+
+ @param[in] This - Pointer to RapidStart PPI
+
+ @retval TRUE if RapidStart support is enabled FALSE otherwise
+**/
+typedef
+BOOLEAN
+(EFIAPI *RAPID_START_IS_ENABLED) (
+ IN RAPID_START_PPI * This
+ );
+
+/**
+ This PPI provides main functions required for Rapid Start Entry and Exit flow.
+
+ This PPI provides major functions required for Rapid Start transition. Both
+ GetMode() and TransitionEntryPoint() should be executed after memory is ready
+ for accessing since they will save, restore or check memory content. Besides,
+ SATA controller must be initialized to AHCI mode before executing
+ TransitionEntryPoint() PPI so Rapid Start Store can be accessed.
+**/
+struct _RAPID_START_PPI {
+ ///
+ /// Indicate PPI structure revision.
+ ///
+ UINT8 Revision;
+ ///
+ /// GetMode function will base on current Rapid Start configurations and boot mode
+ /// to determine which Rapid Start transition flow should be performed.
+ ///
+ RAPID_START_GET_MODE GetMode;
+ ///
+ /// This function will perform or schedule Rapid Start transition if appropriate.
+ /// This includes Rapid Start Entry, Rapid Start Exit or does nothing basing on the
+ /// Rapid Start transition mode.
+ ///
+ RAPID_START_TRANSITION_ENTRY_POINT TransitionEntryPoint;
+ ///
+ /// This function returns Rapid Start feature current enable/disable state.
+ ///
+ RAPID_START_IS_ENABLED IsEnabled;
+};
+
+#endif
diff --git a/ReferenceCode/RapidStart/Ppi/RapidStartPpiLib.cif b/ReferenceCode/RapidStart/Ppi/RapidStartPpiLib.cif
new file mode 100644
index 0000000..e5f533c
--- /dev/null
+++ b/ReferenceCode/RapidStart/Ppi/RapidStartPpiLib.cif
@@ -0,0 +1,14 @@
+<component>
+ name = "RapidStartPpiLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\RapidStart\Ppi\"
+ RefName = "RapidStartPpiLib"
+[files]
+"RapidStartPpiLib.inf"
+"RapidStartPpiLib.sdl"
+"RapidStartPpiLib.mak"
+"PeiGfxPpi\PeiGfxPpi.c"
+"PeiGfxPpi\PeiGfxPpi.h"
+"RapidStart\RapidStart.h"
+"RapidStart\RapidStart.c"
+<endComponent>
diff --git a/ReferenceCode/RapidStart/Ppi/RapidStartPpiLib.inf b/ReferenceCode/RapidStart/Ppi/RapidStartPpiLib.inf
new file mode 100644
index 0000000..51111e8
--- /dev/null
+++ b/ReferenceCode/RapidStart/Ppi/RapidStartPpiLib.inf
@@ -0,0 +1,51 @@
+## @file
+# Component description file for the RapidStart Ppi library
+#
+#@copyright
+# Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = RapidStartPpiLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ RapidStart/RapidStart.h
+ RapidStart/RapidStart.c
+ PeiGfxPpi/PeiGfxPpi.h
+ PeiGfxPpi/PeiGfxPpi.c
+
+[includes.common]
+ .
+ $(EDK_SOURCE)/Foundation/Library/Pei/Include
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[nmake.common]
+C_STD_INCLUDE=
+
diff --git a/ReferenceCode/RapidStart/Ppi/RapidStartPpiLib.mak b/ReferenceCode/RapidStart/Ppi/RapidStartPpiLib.mak
new file mode 100644
index 0000000..24cf02d
--- /dev/null
+++ b/ReferenceCode/RapidStart/Ppi/RapidStartPpiLib.mak
@@ -0,0 +1,60 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+# $Header: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/RapidStartPpiLib/RapidStartPpiLib.mak 1 4/19/12 8:10a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 4/19/12 8:10a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/RapidStartPpiLib/RapidStartPpiLib.mak $
+#
+# 1 4/19/12 8:10a Yurenlai
+# Initial check in.
+#
+#*************************************************************************
+
+all : RapidStartPpiLib
+
+$(RapidStartPpiLib_LIB) : RapidStartPpiLib
+
+RapidStartPpiLib : $(BUILD_DIR)\RapidStartPpiLib.mak RapidStartPpiLibBin
+
+$(BUILD_DIR)\RapidStartPpiLib.mak : $(RapidStartPpiLib_DIR)\$(@B).cif $(RapidStartPpiLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(RapidStartPpiLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+RapidStartPpiLib_INCLUDES =\
+ $(EDK_INCLUDES)\
+
+RapidStartPpiLibBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\RapidStartPpiLib.mak all\
+ "MY_INCLUDES=$(RapidStartPpiLib_INCLUDES)" \
+ TYPE=PEI_LIBRARY
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/ReferenceCode/RapidStart/Ppi/RapidStartPpiLib.sdl b/ReferenceCode/RapidStart/Ppi/RapidStartPpiLib.sdl
new file mode 100644
index 0000000..f39c912
--- /dev/null
+++ b/ReferenceCode/RapidStart/Ppi/RapidStartPpiLib.sdl
@@ -0,0 +1,72 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+# $Header: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/RapidStartPpiLib/RapidStartPpiLib.sdl 1 4/19/12 8:10a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 4/19/12 8:10a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/RapidStartPpiLib/RapidStartPpiLib.sdl $
+#
+# 1 4/19/12 8:10a Yurenlai
+# Initial check in.
+#
+#*************************************************************************
+TOKEN
+ Name = "RapidStartPpiLib_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable RapidStartPpiLib support in Project"
+End
+
+PATH
+ Name = "RapidStartPpiLib_DIR"
+ Help = "RapidStartPpiLib file source directory"
+End
+
+MODULE
+ File = "RapidStartPpiLib.mak"
+ Help = "Includes RapidStartPpiLib.mak to Project"
+End
+
+ELINK
+ Name = "RapidStartPpiLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\RapidStartPpiLib.lib"
+ Parent = "RapidStartPpiLib_LIB"
+ InvokeOrder = AfterParent
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/RapidStart/Protocol/DxeGfxProtocol/DxeGfxProtocol.c b/ReferenceCode/RapidStart/Protocol/DxeGfxProtocol/DxeGfxProtocol.c
new file mode 100644
index 0000000..326da6b
--- /dev/null
+++ b/ReferenceCode/RapidStart/Protocol/DxeGfxProtocol/DxeGfxProtocol.c
@@ -0,0 +1,30 @@
+/** @file
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Mobile Silicon Support Module" and is
+ licensed for Intel Mobile CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "EdkIIGlueDxe.h"
+
+#include "DxeGfxProtocol.h"
+
+EFI_GUID gDxeGfxProtocolGuid = DXE_GFX_PROTOCOL_GUID;
+
+EFI_GUID_STRING
+ (
+ &gDxeGfxProtocolGuid, "RST Gfx Protocol",
+ "Protocol describing RST Gfx Protocol."
+ );
diff --git a/ReferenceCode/RapidStart/Protocol/DxeGfxProtocol/DxeGfxProtocol.h b/ReferenceCode/RapidStart/Protocol/DxeGfxProtocol/DxeGfxProtocol.h
new file mode 100644
index 0000000..70e1c1d
--- /dev/null
+++ b/ReferenceCode/RapidStart/Protocol/DxeGfxProtocol/DxeGfxProtocol.h
@@ -0,0 +1,63 @@
+/** @file
+
+@copyright
+ Copyright (c) 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef DXE_GFX_PROTOCOL_H_
+#define DXE_GFX_PROTOCOL_H_
+
+#define DXE_GFX_PROTOCOL_GUID \
+ { \
+ 0xc4d6994a, 0xaa3d, 0x47c0, 0xae, 0xa, 0xb0, 0xbf, 0xad, 0xba, 0xa6, 0x13 \
+ }
+
+//
+// Extern the GUID for protocol users.
+//
+extern EFI_GUID gDxeGfxProtocolGuid;
+
+#define BIOS_RESTORE 0 // 12 Mbytes space
+#define DESKTOP_RESTORE 1 // 512 Kb Space
+
+typedef
+EFI_STATUS
+(EFIAPI * GFX_ALLOCATE_DSS_BUFFER) (
+ IN UINT8 DisplayType
+);
+
+typedef
+EFI_STATUS
+(EFIAPI * GFX_GET_DSS_ADDRESS) (
+ OUT UINT64 **DssAddress,
+ OUT UINT64 *SizeOfDss
+);
+
+typedef
+EFI_STATUS
+(EFIAPI * GFX_SAVE_DISPLAY) (
+ IN UINT8 *RestoreImage
+);
+
+#pragma pack(1)
+
+typedef struct _DXE_GFX_PROTOCOL {
+ GFX_ALLOCATE_DSS_BUFFER AllocateDssBuffer;
+ GFX_GET_DSS_ADDRESS GetDssAddress;
+ GFX_SAVE_DISPLAY SaveDisplay;
+} DXE_GFX_PROTOCOL;
+
+#pragma pack()
+
+#endif
diff --git a/ReferenceCode/RapidStart/Protocol/RapidStartGlobalNvsArea/RapidStartGlobalNvsArea.c b/ReferenceCode/RapidStart/Protocol/RapidStartGlobalNvsArea/RapidStartGlobalNvsArea.c
new file mode 100644
index 0000000..b0230a2
--- /dev/null
+++ b/ReferenceCode/RapidStart/Protocol/RapidStartGlobalNvsArea/RapidStartGlobalNvsArea.c
@@ -0,0 +1,31 @@
+/** @file
+ RapidStart Global NVS Area description protocol implementation.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Mobile Silicon Support Module" and is
+ licensed for Intel Mobile CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#include "EdkIIGlueDxe.h"
+
+#include "RapidStartGlobalNvsArea.h"
+
+EFI_GUID gRapidStartGlobalNvsAreaProtocolGuid = RAPID_START_GLOBAL_NVS_AREA_PROTOCOL_GUID;
+
+EFI_GUID_STRING
+ (
+ &gRapidStartGlobalNvsAreaProtocolGuid, "RapidStart Global NVS Area Protocol",
+ "Protocol describing RapidStart ACPI NVS memory region used by ACPI subsystem."
+ );
diff --git a/ReferenceCode/RapidStart/Protocol/RapidStartGlobalNvsArea/RapidStartGlobalNvsArea.h b/ReferenceCode/RapidStart/Protocol/RapidStartGlobalNvsArea/RapidStartGlobalNvsArea.h
new file mode 100644
index 0000000..25fa453
--- /dev/null
+++ b/ReferenceCode/RapidStart/Protocol/RapidStartGlobalNvsArea/RapidStartGlobalNvsArea.h
@@ -0,0 +1,100 @@
+/** @file
+ Definition of the RapidStart global NVS area protocol. This protocol
+ publishes the address and format of a global ACPI NVS buffer used as a communications
+ buffer between SMM/DXE/PEI code and ASL code.
+ @todo The format is derived from the ACPI reference code, version 0.95.
+
+ Note: Data structures defined in this protocol are not naturally aligned.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _RAPID_START_GLOBAL_NVS_AREA_H_
+#define _RAPID_START_GLOBAL_NVS_AREA_H_
+
+//
+// Includes
+//
+//
+// Forward reference for pure ANSI compatability
+//
+EFI_FORWARD_DECLARATION (RAPID_START_GLOBAL_NVS_AREA_PROTOCOL);
+
+///
+/// RapidStart Global NVS Area Protocol GUID
+///
+#define RAPID_START_GLOBAL_NVS_AREA_PROTOCOL_GUID \
+ { \
+ 0xa5559f06, 0x6415, 0x4759, 0x88, 0x69, 0xde, 0x15, 0xf9, 0xcd, 0x9c, 0x9b \
+ }
+
+///
+/// Extern the GUID for protocol users.
+///
+extern EFI_GUID gRapidStartGlobalNvsAreaProtocolGuid;
+
+/**
+ Global NVS Area definition
+
+ To provide OS base utility controlling capability, these ACPI Global NVS fields
+ provides the interface for OS base utility to control Rapid Start behavior and
+ Rapid Start reference code will work accordingly.
+**/
+#pragma pack(1)
+typedef struct {
+ ///
+ /// It shows what wake up event sources available for Rapid Start Entry.
+ ///
+ /// Used by RapidStart.asl as "RSTA"
+ ///
+ UINT8 EventsAvailable;
+ ///
+ /// This controls which wake up source can be used to trigger Rapid Start Entry tasks.
+ ///
+ /// Used by RapidStart.asl as "RSTS"
+ ///
+ UINT8 EventsEnabled;
+ ///
+ /// This defines how many minutes the wake up event will happen for performing Rapid
+ /// Start Entry transition. Available options are "Immediately" (wake system up
+ /// once system entering S3 mode), 1 Min, 2 Min, 5 Min and 10 Min etc. Default
+ /// Platform Policy will set this to 10 minutes.
+ ///
+ /// Used by RapidStart.asl as "RSTT"
+ ///
+ UINT16 WakeTimerMin;
+ ///
+ /// This is the pointer for performance data structure.
+ ///
+ /// Used by RapidStart.asl as "RSTP"
+ ///
+ UINT32 PerfDataPtr;
+} RAPID_START_GLOBAL_NVS_AREA;
+#pragma pack()
+
+/**
+ RapidStart Global NVS Area Protocol
+
+ To provide OS base utility controlling mechanism there are some items
+ created in Rapid Start private ACPI Global NVS area. Note: This will be
+ published by reference code as one SSDT table so no Platform code change
+ required.
+**/
+struct _RAPID_START_GLOBAL_NVS_AREA_PROTOCOL {
+ RAPID_START_GLOBAL_NVS_AREA *Area;
+ VOID *RapidStartData;
+};
+
+#endif
diff --git a/ReferenceCode/RapidStart/Protocol/RapidStartInfo/RapidStartInfo.c b/ReferenceCode/RapidStart/Protocol/RapidStartInfo/RapidStartInfo.c
new file mode 100644
index 0000000..7269ff9
--- /dev/null
+++ b/ReferenceCode/RapidStart/Protocol/RapidStartInfo/RapidStartInfo.c
@@ -0,0 +1,40 @@
+/** @file
+ This file defines the RapidStart Info Protocol.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+
+//
+// Statements that include other files
+//
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "RapidStartInfo.h"
+#endif
+
+///
+/// Protocol GUID definition
+///
+EFI_GUID gRapidStartInfoProtocolGuid = RAPID_START_INFO_PROTOCOL_GUID;
+
+///
+/// Protocol description
+///
+EFI_GUID_STRING(&gRapidStartInfoProtocolGuid, "RapidStart Info Protocol", "RapidStart Information Protocol");
diff --git a/ReferenceCode/RapidStart/Protocol/RapidStartInfo/RapidStartInfo.h b/ReferenceCode/RapidStart/Protocol/RapidStartInfo/RapidStartInfo.h
new file mode 100644
index 0000000..3997eda
--- /dev/null
+++ b/ReferenceCode/RapidStart/Protocol/RapidStartInfo/RapidStartInfo.h
@@ -0,0 +1,93 @@
+/** @file
+ This file defines the RapidStart Info Protocol.
+
+@copyright
+ Copyright (c) 2011 - 2014 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+**/
+#ifndef _RAPID_START_INFO_H_
+#define _RAPID_START_INFO_H_
+
+///
+/// GUID to locate Rapid Start Info Protocol
+///
+/// EDK and EDKII have different GUID formats
+///
+/// @see _RAPID_START_INFO_PROTOCOL
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#define RAPID_START_INFO_PROTOCOL_GUID \
+ { \
+ 0xd231db5b, 0x4a9c, 0x4092, 0xa8, 0xc5, 0x9c, 0xa0, 0xbc, 0x7d, 0x6a, 0xa6 \
+ }
+
+#else
+#define RAPID_START_INFO_PROTOCOL_GUID \
+ { \
+ 0xd231db5b, 0x4a9c, 0x4092, \
+ { \
+ 0xa8, 0xc5, 0x9c, 0xa0, 0xbc, 0x7d, 0x6a, 0xa6 \
+ } \
+ }
+#endif
+
+///
+/// Extern the GUID for protocol users.
+///
+/// @see _RAPID_START_INFO_PROTOCOL
+///
+extern EFI_GUID gRapidStartInfoProtocolGuid;
+
+//
+// Forward reference for ANSI C compatibility
+//
+EFI_FORWARD_DECLARATION (RAPID_START_INFO_PROTOCOL);
+
+///
+/// Protocol revision number
+/// Any backwards compatible changes to this protocol will result in an update in the revision number
+/// Major changes will require publication of a new protocol
+///
+/// Revision 1: Original version
+///
+#define RAPID_START_INFO_PROTOCOL_REVISION_1 1
+
+///
+/// RapidStart Reference Code formats 0xAABBCCDD
+/// DD - Build Number
+/// CC - Reference Code Revision
+/// BB - Reference Code Minor Version
+/// AA - Reference Code Major Version
+/// Example: RapidStart Reference Code 0.7.1 should be 00 07 01 00 (0x00070100)
+///
+#define RAPID_START_RC_VERSION 0x01090000
+#define RAPID_START_FVI_STRING "Reference Code - Intel Rapid Start"
+#define RAPID_START_FVI_SMBIOS_TYPE 0xDD
+#define RAPID_START_FVI_SMBIOS_INSTANCE 0x05
+/**
+ A protocol to indicate Rapid Start reference code revision.
+
+ This protocol will be initialized by Rapid Start reference code to indicate the reference code revision.
+ It will be installed by reference code even Rapid Start is disabled.
+
+ @see RAPID_START_INFO_PROTOCOL_GUID
+ @see gRapidStartInfoProtocolGuid
+ @see RapidStartInstallInfoProtocol()
+**/
+struct _RAPID_START_INFO_PROTOCOL {
+ UINT8 Revision; ///< Revision of this protocol
+ UINT32 RCVersion; ///< Rapid Start reference code revision
+};
+
+#endif
diff --git a/ReferenceCode/RapidStart/Protocol/RapidStartPlatformPolicy/RapidStartPlatformPolicy.c b/ReferenceCode/RapidStart/Protocol/RapidStartPlatformPolicy/RapidStartPlatformPolicy.c
new file mode 100644
index 0000000..eb7d873
--- /dev/null
+++ b/ReferenceCode/RapidStart/Protocol/RapidStartPlatformPolicy/RapidStartPlatformPolicy.c
@@ -0,0 +1,46 @@
+/** @file
+ This file defines the RapidStart Policy Protocol.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+//
+// Statements that include other files
+//
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "RapidStartPlatformPolicy.h"
+#endif
+
+///
+/// Protocol GUID definition
+///
+EFI_GUID gRapidStartPlatformPolicyProtocolGuid = RAPID_START_PLATFORM_POLICY_PROTOCOL_GUID;
+
+///
+/// Protocol description
+///
+EFI_GUID_STRING
+ (
+ &gRapidStartPlatformPolicyProtocolGuid, "RapidStartPlatformPolicy Protocol",
+ "Intel(R) DXE Phase RapidStart Platform Policy Protocol"
+ );
diff --git a/ReferenceCode/RapidStart/Protocol/RapidStartPlatformPolicy/RapidStartPlatformPolicy.h b/ReferenceCode/RapidStart/Protocol/RapidStartPlatformPolicy/RapidStartPlatformPolicy.h
new file mode 100644
index 0000000..32bc704
--- /dev/null
+++ b/ReferenceCode/RapidStart/Protocol/RapidStartPlatformPolicy/RapidStartPlatformPolicy.h
@@ -0,0 +1,162 @@
+/** @file
+ This file defines the RapidStart Policy Protocol.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _RAPID_START_PLATFORM_POLICY_H_
+#define _RAPID_START_PLATFORM_POLICY_H_
+
+///
+/// GUID to locate Rapid Start Platform Policy Protocol
+///
+/// @see _RAPID_START_PLATFORM_POLICY_PROTOCOL
+///
+#define RAPID_START_PLATFORM_POLICY_PROTOCOL_GUID \
+ { \
+ 0x42bbaca3, 0x7161, 0x4891, 0xac, 0x10, 0xc7, 0x5e, 0x2e, 0x4d, 0xf6, 0x14 \
+ }
+
+#define RAPID_START_WAKE_TIMER_MAX (24 * 60)
+#define RAPID_START_WAKE_TIMER_DEFAULT 10
+
+///
+/// Extern the GUID for protocol users.
+///
+/// @see _RAPID_START_PLATFORM_POLICY_PROTOCOL
+///
+extern EFI_GUID gRapidStartPlatformPolicyProtocolGuid;
+
+//
+// Forward reference for ANSI C compatibility
+//
+EFI_FORWARD_DECLARATION (RAPID_START_PLATFORM_POLICY_PROTOCOL);
+
+///
+/// Revision 1: Original version
+///
+///
+/// Revision 2: Added DisplaySaveRestore
+/// Added DisplayType
+#define DXE_RAPID_START_PLATFORM_POLICY_PROTOCOL_REVISION 1
+#define DXE_RAPID_START_PLATFORM_POLICY_PROTOCOL_REVISION_2 2
+
+/**
+ RapidStart DXE Platform Platform Policy Protocol
+
+ This protocol provides an interface for platform code to configure Rapid Start
+ behavior and usable resource without modifying reference code.
+
+ This protocol provides interface to configure Rapid Start policy. Platform code
+ should initialize this protocol before RapidStartDxe driver executing basing on
+ the platform implementation. RapidStartDxePolicyInit sample code provided to
+ initialize default settings which has been validated by CRB BIOS. Platform code
+ can include this sample code with some porting to make it setup menu
+ controllable.
+
+ @see RAPID_START_PLATFORM_POLICY_PROTOCOL_GUID
+ @see gRapidStartPlatformPolicyProtocolGuid
+ @see RapidStartDxePolicyInitEntryPoint()
+**/
+struct _RAPID_START_PLATFORM_POLICY_PROTOCOL {
+ ///
+ /// Revision for the protocol structure
+ ///
+ UINT8 Revision;
+ ///
+ /// Enable or disable Rapid Start function. 0=Disable (Default) and 1=Enable
+ ///
+ UINT16 EnableRapidStart : 1;
+ ///
+ /// Enable reference code to do Rapid Start Entry flow when system waking up from S3
+ /// state by RTC timer event. 0=Disable, 1=Enable (Default)
+ ///
+ /// @see S3WakeTimerMin
+ ///
+ UINT16 EntryOnS3RtcWake : 1;
+ ///
+ /// Enable reference code to perform Rapid Start Entry flow when system waking up
+ /// from Critical low battery event (from S3 state). 0=Disable, 1=Enable (Default)
+ ///
+ UINT16 EntryOnS3CritBattWake : 1;
+ ///
+ /// Enable Active Page Threshold support in Rapid Start reference code. Once enabled
+ /// with proper ActivePageThresholdSize value, Rapid Start functions are able to
+ /// work on systems with Rapid Start partition size smaller than the amount of the
+ /// whole system memory.
+ ///
+ /// @see ActivePageThresholdSize
+ ///
+ UINT16 ActivePageThresholdSupport : 1;
+ ///
+ /// Enable Hybrid Hard Disk support in Rapid Start reference code.
+ ///
+ /// @see AhciHybridHardDiskSupport
+ ///
+
+ UINT16 HybridHardDisk : 1;
+ UINT16 DisplaySaveRestore : 1;
+ UINT16 DisplayType : 1;
+ ///
+ /// These bits are reserved for future use
+ ///
+ UINT16 Reserved : 9; ///< Reserved
+ ///
+ /// Specific the minutes used for RTC timeout wakeup event. This setting only works
+ /// when EntryOnS3RtcWake = 1. Default is 10 minutes which will set 10 minutes RTC
+ /// Alarm to wake system up after system entering S3 state. Available settings:
+ /// "Immediately=0min", 1min, 2mins, 5mins, 10mins, 15mins, 30mins, 60mins and
+ /// 120mins etc.
+ ///
+ /// @see EntryOnS3RtcWake
+ /// @see RAPID_START_WAKE_TIMER_MAX
+ /// @see RAPID_START_WAKE_TIMER_DEFAULT
+ ///
+ UINT16 S3WakeTimerMin;
+ ///
+ /// This is reserved and not used by FRC. It may be used by sample code for RST
+ /// Caching mode support.
+ ///
+ UINT8 RaidModeSataPortNumber;
+ ///
+ /// When ActivePageThresholdSupport is enabled, ActivePageThresholdSize will be
+ /// adopted as the criteria for the Rapid Start partition size. For example, on a
+ /// system with 2GB system memory and 1GB Rapid Start partition, when
+ /// ActivePageThresholdSupport is disabled, partition provisioning will fail because
+ /// system memory size is greater than Rapid Start partition size. When
+ /// ActivePageThresholdSupport is enabled and ActivePageThresholdSize set to 1G or
+ /// smaller, it passes the provisioning. When ActivePageThresholdSize is set to
+ /// zero, size checking will be skipped. Any size of partition reserved for Rapid
+ /// Start will pass the provisioning. If Rapid Start functions are still enabled
+ /// during S3 entry, Rapid Start reference code calculates the size of Active Memory
+ /// Pages, which is the amount of memory that is to be transferred to the Rapid
+ /// Start partition after the Zero page filtering. If it is smaller than or equal to
+ /// the provisioned Rapid Start partition size, then Rapid Start transitions will be
+ /// activated normally after system entering S3. Otherwise, system will remain in S3
+ /// state.
+ ///
+ /// @see ActivePageThresholdSupport
+ ///
+ UINT32 ActivePageThresholdSize;
+ ///
+ /// Specifies the type value of the Firmware Version Info(FVI) Structure used to report
+ /// version information about Rapid Start through the FVI Interface.
+ ///
+ UINT8 FviSmbiosType;
+};
+
+#endif
diff --git a/ReferenceCode/RapidStart/Protocol/RapidStartProtocolLib.cif b/ReferenceCode/RapidStart/Protocol/RapidStartProtocolLib.cif
new file mode 100644
index 0000000..81b954a
--- /dev/null
+++ b/ReferenceCode/RapidStart/Protocol/RapidStartProtocolLib.cif
@@ -0,0 +1,18 @@
+<component>
+ name = "RapidStartProtocolLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\RapidStart\Protocol\"
+ RefName = "RapidStartProtocolLib"
+[files]
+"RapidStartProtocolLib.inf"
+"RapidStartProtocolLib.mak"
+"RapidStartProtocolLib.sdl"
+"DxeGfxProtocol\DxeGfxProtocol.c"
+"DxeGfxProtocol\DxeGfxProtocol.h"
+"RapidStartPlatformPolicy\RapidStartPlatformPolicy.c"
+"RapidStartPlatformPolicy\RapidStartPlatformPolicy.h"
+"RapidStartInfo\RapidStartInfo.c"
+"RapidStartInfo\RapidStartInfo.h"
+"RapidStartGlobalNvsArea\RapidStartGlobalNvsArea.c"
+"RapidStartGlobalNvsArea\RapidStartGlobalNvsArea.h"
+<endComponent>
diff --git a/ReferenceCode/RapidStart/Protocol/RapidStartProtocolLib.inf b/ReferenceCode/RapidStart/Protocol/RapidStartProtocolLib.inf
new file mode 100644
index 0000000..3bfb5da
--- /dev/null
+++ b/ReferenceCode/RapidStart/Protocol/RapidStartProtocolLib.inf
@@ -0,0 +1,61 @@
+## @file
+# Component description file for RapidStart module
+#
+#@copyright
+# Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains an 'Intel Peripheral Driver' and uniquely
+# identified as "Intel Reference Module" and is
+# licensed for Intel CPUs and chipsets under the terms of your
+# license agreement with Intel or your vendor. This file may
+# be modified by the user, subject to additional terms of the
+# license agreement
+#
+
+[defines]
+BASE_NAME = RapidStartProtocolLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ RapidStartPlatformPolicy/RapidStartPlatformPolicy.h
+ RapidStartPlatformPolicy/RapidStartPlatformPolicy.c
+ RapidStartInfo/RapidStartInfo.h
+ RapidStartInfo/RapidStartInfo.c
+ RapidStartGlobalNvsArea/RapidStartGlobalNvsArea.c
+ RapidStartGlobalNvsArea/RapidStartGlobalNvsArea.h
+ DxeGfxProtocol/DxeGfxProtocol.c
+ DxeGfxProtocol/DxeGfxProtocol.h
+
+[includes.common]
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EFI_SOURCE)/Include
+ $(EFI_SOURCE)/Platform/$(PROJECT_FAMILY)/Common
+ $(EFI_SOURCE)/Platform/$(PROJECT_FAMILY)/Common/Include
+#
+# Edk II Glue Library, some hearder are included by R9 header so have to include
+#
+
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/Framework
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[nmake.common]
+C_STD_INCLUDE=
diff --git a/ReferenceCode/RapidStart/Protocol/RapidStartProtocolLib.mak b/ReferenceCode/RapidStart/Protocol/RapidStartProtocolLib.mak
new file mode 100644
index 0000000..4672d99
--- /dev/null
+++ b/ReferenceCode/RapidStart/Protocol/RapidStartProtocolLib.mak
@@ -0,0 +1,58 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+# $Header: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/RapidStartProtocolLib/RapidStartProtocolLib.mak 1 4/19/12 8:12a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 4/19/12 8:12a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/RapidStartProtocolLib/RapidStartProtocolLib.mak $
+#
+# 1 4/19/12 8:12a Yurenlai
+# Initial check in.
+#
+#*************************************************************************
+
+all : RapidStartProtocolLib
+
+$(BUILD_DIR)\RapidStartProtocolLib.lib : RapidStartProtocolLib
+
+RapidStartProtocolLib : $(BUILD_DIR)\RapidStartProtocolLib.mak RapidStartProtocolLibBin
+
+$(BUILD_DIR)\RapidStartProtocolLib.mak : $(RapidStartProtocolLib_DIR)\$(@B).cif $(RapidStartProtocolLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(RapidStartProtocolLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+RapidStartProtocolLibBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDK_DEFAULTS)\
+ /f $(BUILD_DIR)\RapidStartProtocolLib.mak all\
+ "MY_INCLUDES=$(EDK_INCLUDES) $(MISCFRAMEWORK_INCLUDES) $(EdkIIGlueLib_INCLUDES)" \
+ TYPE=LIBRARY
+
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/RapidStart/Protocol/RapidStartProtocolLib.sdl b/ReferenceCode/RapidStart/Protocol/RapidStartProtocolLib.sdl
new file mode 100644
index 0000000..75cd95a
--- /dev/null
+++ b/ReferenceCode/RapidStart/Protocol/RapidStartProtocolLib.sdl
@@ -0,0 +1,71 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+# $Header: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/RapidStartProtocolLib/RapidStartProtocolLib.sdl 1 4/19/12 8:12a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 4/19/12 8:12a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/RapidStartProtocolLib/RapidStartProtocolLib.sdl $
+#
+# 1 4/19/12 8:12a Yurenlai
+# Initial check in.
+#
+#*************************************************************************
+TOKEN
+ Name = RapidStartProtocolLib_SUPPORT
+ Value = 1
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable RapidStartProtocolLib support in Project"
+End
+
+MODULE
+ Help = "Includes RapidStartProtocolLib.mak to Project"
+ File = "RapidStartProtocolLib.mak"
+End
+
+PATH
+ Name = "RapidStartProtocolLib_DIR"
+End
+
+ELINK
+ Name = "RapidStartProtocolLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\RapidStartProtocolLib.lib"
+ Parent = "RapidStartProtocolLib_LIB"
+ InvokeOrder = AfterParent
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/RapidStart/RapidStart.cif b/ReferenceCode/RapidStart/RapidStart.cif
new file mode 100644
index 0000000..9564fd1
--- /dev/null
+++ b/ReferenceCode/RapidStart/RapidStart.cif
@@ -0,0 +1,23 @@
+<component>
+ name = "Intel Rapid Start Technology"
+ category = eModule
+ LocalRoot = "ReferenceCode\RapidStart"
+ RefName = "RapidStart"
+[files]
+"RapidStart.sdl"
+"ReleaseNotes.chm"
+[parts]
+"RapidStartAcpiTables"
+"RapidStartPei"
+"RapidStartDxe"
+"RapidStartGuidLib"
+"RapidStartSmm"
+"RapidStartInclude"
+"RapidStartPpiLib"
+"RapidStartProtocolLib"
+"DxeFfsGfxDriver"
+"PeiGfxDriver"
+"GfxDisplayLibDxe"
+"GfxDisplayLibPei"
+"RapidStartWrapper"
+<endComponent>
diff --git a/ReferenceCode/RapidStart/RapidStart.sdl b/ReferenceCode/RapidStart/RapidStart.sdl
new file mode 100644
index 0000000..66557d2
--- /dev/null
+++ b/ReferenceCode/RapidStart/RapidStart.sdl
@@ -0,0 +1,237 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2012, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+# $Header: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/RapidStart.sdl 5 4/18/13 1:14a Bensonlai $
+#
+# $Revision: 5 $
+#
+# $Date: 4/18/13 1:14a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/RapidStart.sdl $
+#
+# 5 4/18/13 1:14a Bensonlai
+# [TAG] None
+# [Category] Improvement
+# [Description] Removing the debug mode for the ELINK of
+# RAPID_START_ON_MEMORY_INSTALLED.
+#
+# 4 10/15/12 5:47a Bensonlai
+# [Category] Improvement
+# [Severity] Important
+# [Description] Rename all IFFS sting to Rapid Start.
+# [Files] Board\EM\RapidStartWrapper\*.*, ReferenceCode\RapidStart\*.*
+#
+# 3 9/26/12 3:45a Yurenlai
+# [TAG] None
+# [Category] Improvement
+# [Severity] Important
+# [Description] Enable iFFS Zero Page function.
+# [Description] RapidStart.sdl
+#
+# 2 8/14/12 7:50a Yurenlai
+# [TAG] None
+# [Category] Improvement
+# [Severity] Important
+# [Description] Support ASLPREPROCESS_FLAG to include Iintel RC flags.
+# [Description] RapidStart.sdl, RapidStartSmm.sdl
+#
+# 1 4/19/12 7:50a Yurenlai
+# Initial check in.
+#
+#*************************************************************************
+TOKEN
+ Name = "RapidStart_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ TargetH = Yes
+ Master = Yes
+ Help = "Main switch to enable RapidStart support in Project"
+End
+
+TOKEN
+ Name = "TRIM_ON_RESUME"
+ Value = "0"
+ TargetMAK = Yes
+ TokenType = Boolean
+End
+
+TOKEN
+ Name = "ON_MEMORY_INSTALLED"
+ Value = "1"
+ TargetMAK = Yes
+ TokenType = Boolean
+End
+
+TOKEN
+ Name = "ON_START_PPI_INSTALLED"
+ Value = "1"
+ TargetMAK = Yes
+ TokenType = Boolean
+ Token = "ON_MEMORY_INSTALLED" "=" "1"
+End
+
+TOKEN
+ Name = "NO_SMRAM_INTEGRITY_CHECK"
+ Value = "0"
+ TargetMAK = Yes
+ TokenType = Boolean
+ Help = "RapidStart reference code uses SHA256 algorithm in Crypto library from UDK2010 source code for SMRAM integrity check."
+End
+
+TOKEN
+ Name = "WHOLE_MEMORY_CHECK"
+ Value = "0"
+ TargetMAK = Yes
+ TokenType = Boolean
+ Help = "This function is only for debug. It will increase RapidStart Entry and Resume time significantly because it calculates whole memory CRC32 value by dividing to several memory chunks. By default each memory chunk is 1MB size."
+End
+
+TOKEN
+ Name = "FFS_ME7_SUPPORT"
+ Value = "0"
+ TargetMAK = Yes
+ TokenType = Boolean
+ Help = "This function is only for debug. It will increase RapidStart Entry and Resume time significantly because it calculates whole memory CRC32 value by dividing to several memory chunks. By default each memory chunk is 1MB size."
+End
+
+TOKEN
+ Name = "FFS_PERF_MON"
+ Value = "0"
+ TargetMAK = Yes
+ TokenType = Boolean
+ Help = "RapidStart performance data logging support"
+End
+
+TOKEN
+ Name = "FFS_USE_OLD_ACPI_VARIABLE_SET"
+ Value = "1"
+ TargetMAK = Yes
+ TokenType = Boolean
+ Help = "From RC 0.8.0.0, build switch RapidStart_USE_OLD_ACPI_VARIABLE_SET is added into the reference code for backward compatibility with platform code base comes with old ACPI_VARIABLE_SET structure."
+End
+
+TOKEN
+ Name = "FFS_SCAN_ZERO_PAGE"
+ Value = "1"
+ TargetMAK = Yes
+ TokenType = Boolean
+ Help = "Enable/Disable Rapid Start scen zero page."
+End
+
+ELINK
+ Name = "INTEL_IRST_RC_FLAGS"
+ Help = "iRST Reference Code command line options of the compiler"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(INTEL_IRST_RC_FLAGS)"
+ Parent = "GLOBAL_DEFINES"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/D RAPID_START_FLAG"
+ Parent = "INTEL_IRST_RC_FLAGS"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/D RAPID_START_TRIM_ON_RESUME"
+ Parent = "INTEL_IRST_RC_FLAGS"
+ InvokeOrder = AfterParent
+ Token = "TRIM_ON_RESUME" "=" "1"
+End
+
+ELINK
+ Name = "/D RAPID_START_ON_MEMORY_INSTALLED"
+ Parent = "INTEL_IRST_RC_FLAGS"
+ InvokeOrder = AfterParent
+ Token = "ON_MEMORY_INSTALLED" "=" "1"
+End
+
+ELINK
+ Name = "/D RAPID_START_ON_START_PPI_INSTALLED"
+ Parent = "INTEL_IRST_RC_FLAGS"
+ InvokeOrder = AfterParent
+ Token = "ON_START_PPI_INSTALLED" "=" "1"
+End
+
+ELINK
+ Name = "/D RAPID_START_NO_SMRAM_INTEGRITY_CHECK"
+ Parent = "INTEL_IRST_RC_FLAGS"
+ InvokeOrder = AfterParent
+ Token = "NO_SMRAM_INTEGRITY_CHECK" "=" "1"
+End
+
+ELINK
+ Name = "/D RAPID_START_WHOLE_MEMORY_CHECK"
+ Parent = "INTEL_IRST_RC_FLAGS"
+ InvokeOrder = AfterParent
+ Token = "WHOLE_MEMORY_CHECK" "=" "1"
+End
+
+ELINK
+ Name = "/D RAPID_START_PERF_MON"
+ Parent = "INTEL_IRST_RC_FLAGS"
+ InvokeOrder = AfterParent
+ Token = "FFS_PERF_MON" "=" "1"
+End
+
+ELINK
+ Name = "/D RAPID_START_USE_OLD_ACPI_VARIABLE_SET"
+ Parent = "INTEL_IRST_RC_FLAGS"
+ InvokeOrder = AfterParent
+ Token = "FFS_USE_OLD_ACPI_VARIABLE_SET" "=" "1"
+End
+
+ELINK
+ Name = "/D RAPID_START_SCAN_ZERO_PAGE"
+ Parent = "INTEL_IRST_RC_FLAGS"
+ InvokeOrder = AfterParent
+ Token = "FFS_SCAN_ZERO_PAGE" "=" "1"
+End
+
+PATH
+ Name = "RapidStart_DIR"
+End
+
+ELINK
+ Name = "RAPIDSTART_INCLUDES"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "/I$(RapidStart_DIR)"
+ Parent = "RAPIDSTART_INCLUDES"
+ InvokeOrder = AfterParent
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2012, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/RapidStart/ReleaseNotes.chm b/ReferenceCode/RapidStart/ReleaseNotes.chm
new file mode 100644
index 0000000..5ae44c6
--- /dev/null
+++ b/ReferenceCode/RapidStart/ReleaseNotes.chm
Binary files differ
diff --git a/ReferenceCode/RapidStart/Smm/RapidStartSmm.c b/ReferenceCode/RapidStart/Smm/RapidStartSmm.c
new file mode 100644
index 0000000..1e4316c
--- /dev/null
+++ b/ReferenceCode/RapidStart/Smm/RapidStartSmm.c
@@ -0,0 +1,836 @@
+/** @file
+ This SMM driver will install a S3 Entry callback SMI handler for RTC wakeup policy.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Mobile Silicon Support Module" and is
+ licensed for Intel Mobile CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+
+**/
+
+///
+/// External include files do NOT need to be explicitly specified in real EDKII
+/// environment
+///
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "RapidStartConfig.h"
+#include EFI_PROTOCOL_CONSUMER (RapidStartPlatformPolicy)
+#include EFI_PROTOCOL_DEPENDENCY (RapidStartGlobalNvsArea)
+
+#ifdef ISCT_FLAG
+#include EFI_PROTOCOL_PRODUCER (IsctNvsArea)
+#endif //ISCT_FLAG
+
+#include <SaAccess.h>
+#include <PchAccess.h>
+#include <PchPlatformLib.h>
+#include "RapidStartSmm.h"
+#include "RapidStartData.h"
+#include "RapidStartCommonLib.h"
+#include "RapidStartAhciReg.h"
+#endif
+
+#define DAY_IN_SEC (24 * 60 * 60)
+#define RAPID_START_DELTA_SEC 45
+
+EFI_GUID gRapidStartPersistantDataGuid = RAPID_START_PERSISTENT_DATA_GUID;
+CHAR16 gRapidStartPersistantDataName[] = RAPID_START_PERSISTENT_DATA_NAME;
+
+RAPID_START_PERSISTENT_DATA *mRapidStartData;
+RAPID_START_MEM_DATA *mRapidStartMemData;
+RAPID_START_GLOBAL_NVS_AREA *mRapidStartGlobalNvs;
+UINT32 *mRapidStartZeroPageBitMap;
+UINT32 *mCrc32Record;
+
+#ifdef ISCT_FLAG
+ISCT_NVS_AREA *mIsctNvs;
+#endif //ISCT_FLAG
+/**
+ Convert RTC_TIME structure data to seconds
+
+ @param[in] tm A time data structure including second, minute and hour fields.
+
+ @retval A number of seconds converted from given RTC_TIME structure data.
+**/
+STATIC
+UINT32
+TimeToSeconds (
+ IN RTC_TIME *tm
+ )
+{
+ ASSERT (tm->Hour < 24);
+ ASSERT (tm->Minute < 60);
+ ASSERT (tm->Second < 60);
+ return ((tm->Hour * 60) + tm->Minute) * 60 + tm->Second;
+}
+
+/**
+ Check if it is leap year
+
+ @param[in] Year year to be check
+
+ @retval True year is leap year
+ @retval FALSE year is not a leap year
+**/
+BOOLEAN
+IsLeapYear (
+ IN UINT16 Year
+ )
+{
+ return (Year % 4 == 0) && ((Year % 100 != 0) || (Year % 400 == 0));
+}
+
+STATIC UINT8 mDaysOfMonthInfo[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+
+/**
+ Check if it is leap year
+
+ @param[in] Year Year number
+ @param[in] Month Month number, January is 1, Feburary is 2, ... December is 12.
+
+ @retval Days Number of day of the Month of the Year
+**/
+UINT8
+DaysOfMonth (
+ IN UINT16 Year,
+ IN UINT8 Month
+ )
+{
+ UINT8 Days;
+ if (Month < 1 || Month > 12) {
+ return 0;
+ }
+
+ Days = mDaysOfMonthInfo[Month - 1];
+ if (Month == 2) {
+ Days += IsLeapYear (Year);
+ }
+
+ return Days;
+}
+
+/**
+ Convert seconds to RTC_TIME structure data
+
+ @param[out] tm A time data structure which will be updated with converted value.
+ @param[in] Seconds Total seconds that will be converted into RTC_TIME
+**/
+STATIC
+VOID
+SecondsToTime (
+ OUT RTC_TIME *tm,
+ IN UINT32 Seconds
+ )
+{
+ tm->Second = Seconds % 60;
+ Seconds /= 60;
+ tm->Minute = Seconds % 60;
+ Seconds /= 60;
+ tm->Hour = Seconds % 24;
+ tm->Date = 0;
+}
+
+/**
+ Check if tm2 is after 2 days of tm1
+
+ @param tm1 First time to compare
+ @param tm2 Second time to compare
+
+ @retval TRUE tm2 is 2 days after tm1
+ @retval FALSE tm2 is not 2 days after tm1
+**/
+BOOLEAN
+IsOver2Days (
+ IN RTC_TIME *tm1,
+ IN RTC_TIME *tm2
+)
+{
+ BOOLEAN RetVal;
+ RetVal = TRUE;
+ if (tm2->Date > tm1->Date) {
+ if (tm2->Date - tm1->Date == 1) {
+ RetVal = FALSE;;
+ }
+ } else if ((DaysOfMonth (tm1->Year, tm1->Month) == tm1->Date) && (tm2->Date == 1)) {
+ RetVal = FALSE;;
+ }
+ return RetVal;
+}
+
+/**
+ Adjusts RTC Alarm setting according to RapidStart platform policy.
+
+ @param[in] WakeAfter Time offset in seconds to wake from S3
+
+ @retval EFI_SUCCESS Timer started successfully
+ @retval EFI_ALREADY_STARTED Timer already set sooner than desired
+**/
+STATIC
+EFI_STATUS
+RapidStartAdjustRtcAlarm (
+ IN UINT32 WakeAfter
+ )
+{
+ UINT32 CurrentTime;
+ UINT32 AlarmTime;
+ UINT32 WakeTime;
+ RTC_TIME tm;
+ RTC_TIME wake_tm;
+ EFI_STATUS Status, RtcStatus;
+ UINT16 PmBase;
+#ifdef ISCT_FLAG
+ UINT32 IsctWakeAfter;
+ RTC_TIME Isct_wake_tm;
+#endif // ISCT_FLAG
+
+ Status = EFI_SUCCESS;
+
+ ///
+ /// For an instant wake 2 seconds is a safe value
+ ///
+ if (WakeAfter < 2) {
+ WakeAfter = 2;
+ }
+ ///
+ /// Make sure RTC is in BCD and 24h format
+ ///
+ RtcInit ();
+
+ RtcStatus = RtcGetTime (&tm);
+ ASSERT_EFI_ERROR (RtcStatus);
+
+ CurrentTime = TimeToSeconds (&tm);
+
+#ifdef ISCT_FLAG
+ IsctWakeAfter = 0;
+ Isct_wake_tm.Second = 0;
+ Isct_wake_tm.Minute = 0;
+ Isct_wake_tm.Hour = 0;
+ Isct_wake_tm.Date = 0;
+ Isct_wake_tm.Month = 0;
+ Isct_wake_tm.Year = 0;
+
+ //
+ // Get Isct wake up time
+ //
+ if (mIsctNvs != NULL) {
+ mIsctNvs->IsctOverWrite = 0;
+
+ IsctWakeAfter = mIsctNvs->RtcDurationTime;
+ if ((IsctWakeAfter != 0) && (IsctWakeAfter < 2)) {
+ IsctWakeAfter = 2;
+ }
+ }
+
+ SecondsToTime (&Isct_wake_tm, IsctWakeAfter + CurrentTime);
+#endif //ISCT_FLAG
+ RtcStatus = RtcGetAlarm (&wake_tm);
+ if (RtcStatus == EFI_SUCCESS && (!(mRapidStartMemData->EntryCanceled))) {
+ AlarmTime = TimeToSeconds (&wake_tm);
+ ///
+ /// When OS set alarm date to zero,
+ /// that would mean the alarm date is today or next day depending alarm time,
+ /// and the alarm will happen in 24 hour.
+ ///
+ if (wake_tm.Date != 0 && wake_tm.Date != tm.Date) {
+ ///
+ /// OS Wake-up time is over 1 day
+ ///
+ AlarmTime += DAY_IN_SEC;
+ if (IsOver2Days (&tm, &wake_tm)) {
+ ///
+ /// OS Wake-up time is over 2 day
+ ///
+ AlarmTime += DAY_IN_SEC;
+ }
+ } else if (AlarmTime < CurrentTime && wake_tm.Date == 0) {
+ ///
+ /// When alarm time behind current time and alarm date is zero,
+ /// OS set the alarm for next day
+ //
+ AlarmTime += DAY_IN_SEC;
+ }
+ ///
+ /// OS RTC alarm set sooner than RapidStart entry after
+ /// Add some seconds so RapidStart wake time won't overcome the OS timer
+ ///
+ if ((WakeAfter + RAPID_START_DELTA_SEC >= AlarmTime - CurrentTime)
+#ifdef ISCT_FLAG
+ ///
+ /// OS RTC alarm set sooner than Isct alarm
+ ///
+ && ((IsctWakeAfter >= AlarmTime - CurrentTime) || (IsctWakeAfter == 0))
+#endif // ISCT_FLAG
+ ) {
+ return EFI_ALREADY_STARTED;
+ }
+ ///
+ /// Store OS wake-up time, so it can be restored upon entering RapidStart
+ ///
+ mRapidStartMemData->OsWakeTime = wake_tm;
+ mRapidStartMemData->OsWakeTimeEnabled = 1;
+#ifdef ISCT_FLAG
+ ///
+ /// ISCT time is smaller than OS's, so store ISCT wake-up time, so it can be restored upon entering RapidStart
+ ///
+ if ((IsctWakeAfter <= AlarmTime - CurrentTime) && (IsctWakeAfter != 0)) {
+ mRapidStartMemData->OsWakeTime = Isct_wake_tm;
+ mIsctNvs->IsctOverWrite = 1;
+ }
+#endif // ISCT_FLAG
+ }
+
+ WakeTime = CurrentTime + WakeAfter;
+#ifdef ISCT_FLAG
+ ///
+ /// ISCT alarm set sooner than RapidStart entry after
+ /// Add some seconds so RapidStart wake time won't overcome the ISCT timer
+ ///
+ if ((IsctWakeAfter <= WakeAfter + RAPID_START_DELTA_SEC) && (IsctWakeAfter != 0)) {
+ WakeTime = CurrentTime + IsctWakeAfter;
+ mIsctNvs->IsctOverWrite = 1;
+ Status = EFI_NOT_STARTED;
+ }
+
+ ///
+ /// OS hasn't set up the wake-up time, so store ISCT wake-up time then it can be restored upon entering RapidStart
+ ///
+ if (mRapidStartMemData->OsWakeTimeEnabled == 0 && IsctWakeAfter != 0) {
+ mRapidStartMemData->OsWakeTime = Isct_wake_tm;
+ mRapidStartMemData->OsWakeTimeEnabled = 1;
+ mIsctNvs->IsctOverWrite = 1;
+ }
+#endif // ISCT_FLAG
+
+ SecondsToTime (&tm, WakeTime);
+
+ RtcStatus = RtcSetAlarm (&tm);
+ ASSERT_EFI_ERROR (RtcStatus);
+
+ PmBase = (UINT16) (PciRead32 (
+ PCI_LIB_ADDRESS (DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_ACPI_BASE)
+ ) & B_PCH_LPC_ACPI_BASE_BAR);
+
+ ///
+ /// Clear RTC PM1 status
+ ///
+ IoWrite16 (PmBase + R_PCH_ACPI_PM1_STS, B_PCH_ACPI_PM1_STS_RTC);
+
+ ///
+ /// set RTC_EN bit in PM1_EN to wake up from the alarm
+ ///
+ IoWrite16 (
+ PmBase + R_PCH_ACPI_PM1_EN,
+ (IoRead16 (PmBase + R_PCH_ACPI_PM1_EN) | B_PCH_ACPI_PM1_EN_RTC)
+ );
+ return Status;
+}
+
+#ifdef ISCT_FLAG
+/**
+ Adjusts RTC Alarm setting according to Isct.
+
+ @retval EFI_SUCCESS Timer started successfully
+ @retval EFI_ALREADY_STARTED Timer already set sooner than desired
+**/
+STATIC
+EFI_STATUS
+IsctAdjustRtcAlarm (
+ )
+{
+ UINT32 CurrentTime;
+ UINT32 AlarmTime;
+ UINT32 WakeTime;
+ RTC_TIME tm;
+ RTC_TIME wake_tm;
+ EFI_STATUS Status, RtcStatus;
+ UINT16 PmBase;
+ UINT32 IsctWakeAfter;
+ RTC_TIME Isct_wake_tm;
+
+ Status = EFI_SUCCESS;
+
+ DEBUG((EFI_D_INFO, "IsctAdjustRtcAlarm() Begin.\n"));
+
+ ///
+ /// Make sure RTC is in BCD and 24h format
+ ///
+ RtcInit ();
+
+ RtcStatus = RtcGetTime (&tm);
+ ASSERT_EFI_ERROR (RtcStatus);
+
+ CurrentTime = TimeToSeconds (&tm);
+
+ IsctWakeAfter = 0;
+ Isct_wake_tm.Second = 0;
+ Isct_wake_tm.Minute = 0;
+ Isct_wake_tm.Hour = 0;
+ Isct_wake_tm.Date = 0;
+ Isct_wake_tm.Month = 0;
+ Isct_wake_tm.Year = 0;
+
+ if (mIsctNvs == NULL) {
+ return EFI_ABORTED;
+ }
+
+ mIsctNvs->IsctOverWrite = 0;
+
+ //
+ // Get Isct wake up time
+ //
+ IsctWakeAfter = mIsctNvs->RtcDurationTime;
+ if ((IsctWakeAfter != 0) && (IsctWakeAfter < 2)) {
+ IsctWakeAfter = 2;
+ }
+
+ SecondsToTime (&Isct_wake_tm, IsctWakeAfter + CurrentTime);
+
+ RtcStatus = RtcGetAlarm (&wake_tm);
+ if (RtcStatus == EFI_SUCCESS) {
+ AlarmTime = TimeToSeconds (&wake_tm);
+ ///
+ /// When OS set alarm date to zero,
+ /// that would mean the alarm date is today or next day depending alarm time,
+ /// and the alarm will happen in 24 hour.
+ ///
+ if (wake_tm.Date != 0 && wake_tm.Date != tm.Date) {
+ ///
+ /// OS Wake-up time is over 1 day
+ ///
+ AlarmTime += DAY_IN_SEC;
+ if (IsOver2Days (&tm, &wake_tm)) {
+ ///
+ /// OS Wake-up time is over 2 day
+ ///
+ AlarmTime += DAY_IN_SEC;
+ }
+ } else if (AlarmTime < CurrentTime && wake_tm.Date == 0) {
+ ///
+ /// When alarm time behind current time and alarm date is zero,
+ /// OS set the alarm for next day
+ //
+ AlarmTime += DAY_IN_SEC;
+ }
+ ///
+ /// OS RTC alarm set sooner than Isct alarm
+ ///
+ if ((IsctWakeAfter >= AlarmTime - CurrentTime) || (IsctWakeAfter == 0)) {
+ return EFI_ALREADY_STARTED;
+ }
+ }
+
+ mIsctNvs->IsctOverWrite = 1;
+
+ WakeTime = CurrentTime + IsctWakeAfter;
+ Status = EFI_NOT_STARTED;
+
+ SecondsToTime (&tm, WakeTime);
+
+ RtcStatus = RtcSetAlarm (&tm);
+ ASSERT_EFI_ERROR (RtcStatus);
+
+ PmBase = (UINT16) (PciRead32 (
+ PCI_LIB_ADDRESS (DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_ACPI_BASE)
+ ) & B_PCH_LPC_ACPI_BASE_BAR);
+
+ ///
+ /// Clear RTC PM1 status
+ ///
+ IoWrite16 (PmBase + R_PCH_ACPI_PM1_STS, B_PCH_ACPI_PM1_STS_RTC);
+
+ ///
+ /// set RTC_EN bit in PM1_EN to wake up from the alarm
+ ///
+ IoWrite16 (
+ PmBase + R_PCH_ACPI_PM1_EN,
+ (IoRead16 (PmBase + R_PCH_ACPI_PM1_EN) | B_PCH_ACPI_PM1_EN_RTC)
+ );
+
+ DEBUG((EFI_D_INFO, "IsctAdjustRtcAlarm() End.\n"));
+
+ return Status;
+}
+#endif // ISCT_FLAG
+
+/**
+ Scan Zero page within specific memory range.
+
+ @param[in] BaseAddress Start address of memory
+ @param[in] EndAddress End address of memory
+
+ @retval SaveSize Save Size requirement
+**/
+STATIC
+UINTN
+ScanZeroPageByRange (
+ IN UINT64 BaseAddress,
+ IN UINT64 EndAddress
+ )
+{
+ UINT64 NonZeroPointer;
+ UINT32 TempBitMap;
+ UINTN count;
+ UINT32 *ZeroPagePointer;
+ UINTN SaveSize;
+
+ count = 0;
+ TempBitMap = 0;
+ ZeroPagePointer = mRapidStartZeroPageBitMap + 2 + (UINT32) NUMBER_OF_PAGES_IN_DWORD (BaseAddress);
+ SaveSize = 0;
+ while (BaseAddress < EndAddress) {
+ NonZeroPointer = (UINT64)ScanValueMem64 ((VOID*)BaseAddress, EFI_PAGE_SIZE/ sizeof (UINT64), 0);
+ BaseAddress += EFI_PAGE_SIZE;
+ NonZeroPointer++;
+ if (NonZeroPointer == 0) {
+ //
+ // This is Zero Page so we set the corresponding bit in BitMap.
+ //
+ TempBitMap |= 1;
+ } else {
+ SaveSize += EFI_PAGE_SIZE;
+ }
+
+ TempBitMap = RRotU32 (TempBitMap, 1);
+ count++;
+ if (count == (sizeof (*mRapidStartZeroPageBitMap) * 8)) {
+ *ZeroPagePointer = TempBitMap;
+ count = 0;
+ TempBitMap = 0;
+ ZeroPagePointer += 1;
+ if ((UINTN) ((UINTN) ZeroPagePointer - (UINTN) (mRapidStartZeroPageBitMap + 2)) >= mRapidStartData->ZeroBitmapSize) {
+ //
+ // Zero page filter table is full, skip other checking.
+ //
+ SaveSize += (UINTN)(EndAddress - BaseAddress);
+ break;
+ }
+ }
+
+ }
+ return SaveSize;
+}
+
+/**
+ Create a bitmap for zero page filter.
+
+ @retval Save Size requirement
+**/
+STATIC
+UINTN
+BuildZeroPageBitMap (
+ VOID
+ )
+{
+ UINT32 GfxGTTBase;
+ UINTN SaveSize;
+
+ SaveSize = 0;
+ GfxGTTBase = (PciRead32 (
+ PCI_LIB_ADDRESS (SA_MC_BUS,
+ SA_MC_DEV,
+ SA_MC_FUN,
+ R_SA_BGSM)
+ ) & B_SA_BGSM_BGSM_MASK);
+
+ ///
+ /// Ensure all ZeroPageBitMap were zero-ed
+ ///
+ ZeroMem (mRapidStartZeroPageBitMap, mRapidStartData->ZeroBitmapSize);
+
+#ifdef RAPID_START_SCAN_ZERO_PAGE
+ ///
+ /// Handle Below 4GB memory
+ /// Skip GTT region
+ ///
+ SaveSize = ScanZeroPageByRange (0x0, GfxGTTBase);
+
+#if defined(EFIX64)
+ ///
+ /// Handle Above 4GB memory
+ ///
+ if (mRapidStartData->Tohm > MEM_EQU_4GB) {
+ SaveSize += ScanZeroPageByRange (MEM_EQU_4GB, mRapidStartData->Tohm);
+ }
+#endif
+#endif
+ return SaveSize;
+}
+
+#ifdef RAPID_START_WHOLE_MEMORY_CHECK
+/**
+ Log or compare CRC32 value for above 4GB memory.
+
+ @param[in] IsComparingCrc32 - FALSE to save CRC32 value into buffer. TRUE to compare CRC32 value with pre-saved value in buffer.
+**/
+VOID
+SaveOrCompareCrc32ForAbove4GB (
+ IN BOOLEAN IsComparingCrc32
+ )
+{
+#if defined(EFIX64)
+ if (mRapidStartData->Tohm > MEM_EQU_4GB) {
+ SaveOrCompareCrc32 (IsComparingCrc32, MEM_EQU_4GB, mRapidStartData->Tohm, mRapidStartData);
+ }
+#endif
+}
+
+/**
+ A SW SMI callback to check whole memory CRC32
+
+ @param[in] DispatchHandle - The handle of this callback, obtained when registering
+ @param[in] DispatchContext - Pointer to the EFI_SMM_SW_DISPATCH_CONTEXT
+**/
+VOID
+RapidStartSwSmiCallback (
+ IN EFI_HANDLE DispatchHandle,
+ IN EFI_SMM_SW_DISPATCH_CONTEXT *DispatchContext
+ )
+{
+ if (mRapidStartGlobalNvs->EventsEnabled) {
+ SaveOrCompareCrc32ForAbove4GB (TRUE);
+ }
+}
+#endif
+
+/**
+ RapidStart S3 entry callback SMI handler
+
+ @param[in] DispatchHandle - The handle of this callback, obtained when registering
+ @param[in] DispatchContext - Pointer to the EFI_SMM_SW_DISPATCH_CONTEXT
+**/
+VOID
+EFIAPI
+RapidStartS3EntryCallback (
+ IN EFI_HANDLE DispatchHandle,
+ IN EFI_SMM_SX_DISPATCH_CONTEXT *DispatchContext
+ )
+{
+ UINT16 PmBase;
+ EFI_STATUS Status;
+ UINTN SaveSize;
+ UINT32 CheckingSizeInSector;
+ UINT8 EventsEnabledFlag;
+ PCH_SERIES PchSeries;
+
+ mRapidStartMemData->OsWakeTimeEnabled = 0;
+ EventsEnabledFlag = 0;
+ PchSeries = GetPchSeries();
+
+ Status = EFI_SUCCESS;
+ if (mRapidStartMemData->EntryCanceled) {
+ ///
+ /// Immediate wake system up regardless of original setting.
+ ///
+ RapidStartAdjustRtcAlarm (0);
+ Status = EFI_NOT_STARTED;
+ mRapidStartMemData->EntryCanceled = 0;
+ } else {
+ /* mRapidStartMemData->EntryCanceled */
+ if (mRapidStartGlobalNvs->EventsEnabled) {
+ SaveSize = BuildZeroPageBitMap ();
+ if (mRapidStartData->ActivePageThresholdSizeInSector == 0) {
+ ///
+ /// In AUTO mode, RapidStart will check the partition size automatically with active memory size
+ ///
+ CheckingSizeInSector = mRapidStartData->StoreSectors;
+ } else {
+ ///
+ /// If Active Page Threshold Size is set manually, RapidStart compare this with active memory size
+ ///
+ CheckingSizeInSector = mRapidStartData->ActivePageThresholdSizeInSector;
+ }
+ if (MEM_TO_SECT (SaveSize + mRapidStartData->ZeroBitmapSize + mRapidStartData->Crc32RecordSize) > CheckingSizeInSector) {
+ Status = EFI_BUFFER_TOO_SMALL;
+ }
+#ifdef RAPID_START_WHOLE_MEMORY_CHECK
+ if (!EFI_ERROR (Status)) {
+ SaveOrCompareCrc32ForAbove4GB (FALSE);
+ }
+#endif
+ }
+ //
+ // Enable and override KSC critical battery wake up event threshold
+ // to ensure enough battery capacity for RapidStart Entry transition
+ //
+ if (!EFI_ERROR (Status)) {
+ if (mRapidStartGlobalNvs->EventsEnabled & RAPID_START_ACPI_BATT_WAKE) {
+ RapidStartInitializeCriticalBatteryWakeupEvent (TRUE);
+ EventsEnabledFlag |= RAPID_START_ACPI_BATT_WAKE;
+ }
+
+ if (mRapidStartGlobalNvs->EventsEnabled & RAPID_START_ACPI_RTC_WAKE) {
+ Status = RapidStartAdjustRtcAlarm (mRapidStartGlobalNvs->WakeTimerMin * 60);
+ if (!EFI_ERROR (Status)) {
+ EventsEnabledFlag |= RAPID_START_ACPI_RTC_WAKE;
+ }
+ }
+#ifdef ISCT_FLAG
+ else {
+ IsctAdjustRtcAlarm();
+ }
+#endif
+ }
+#ifdef ISCT_FLAG
+ else {
+ IsctAdjustRtcAlarm();
+ }
+#endif
+ } /* end else: mRapidStartMemData->EntryCanceled */
+
+ RapidStartSetConfig (EventsEnabledFlag);
+
+ if (!EFI_ERROR (Status)) {
+ PmBase = (UINT16) (PciRead32 (
+ PCI_LIB_ADDRESS (DEFAULT_PCI_BUS_NUMBER_PCH,
+ PCI_DEVICE_NUMBER_PCH_LPC,
+ PCI_FUNCTION_NUMBER_PCH_LPC,
+ R_PCH_LPC_ACPI_BASE)
+ ) & B_PCH_LPC_ACPI_BASE_BAR);
+
+ ///
+ /// Save wake events
+ ///
+ if (PchSeries == PchLp) {
+ mRapidStartMemData->GPE0 = IoRead32 (PmBase + R_PCH_ACPI_GPE0_EN_127_96);
+ } else if (PchSeries == PchH) {
+ mRapidStartMemData->GPE0a = IoRead32 (PmBase + R_PCH_ACPI_GPE0a_EN);
+ mRapidStartMemData->GPE0b = IoRead32 (PmBase + R_PCH_ACPI_GPE0b_EN);
+ }
+ }
+
+ AfterInitializingEntryEvent (Status);
+ return;
+}
+
+/**
+ Initializes the SMM S3 Handler.
+
+ @param[in] ImageHandle - The image handle of Wake On Lan driver
+ @param[in] SystemTable - The standard EFI system table
+
+ @retval EFI_SUCCESS - RapidStart S3 entry callback SMI handle has been registered when RapidStart wake up policy enabled
+**/
+EFI_STATUS
+RapidStartSmmEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ RAPID_START_GLOBAL_NVS_AREA_PROTOCOL *RapidStartGlobalNvsAreaProtocol;
+ EFI_SMM_SX_DISPATCH_PROTOCOL *SxDispatchProtocol;
+ EFI_SMM_SX_DISPATCH_CONTEXT EntryDispatchContext;
+#ifdef RAPID_START_WHOLE_MEMORY_CHECK
+ EFI_SMM_SW_DISPATCH_PROTOCOL *SwDispatch;
+ EFI_SMM_SW_DISPATCH_CONTEXT SwContext;
+#endif
+ EFI_HANDLE DispatchHandle;
+ EFI_STATUS Status;
+#ifdef ISCT_FLAG
+ ISCT_NVS_AREA_PROTOCOL *IsctNvsAreaProtocol;
+#endif //ISCT_FLAG
+
+ DEBUG ((EFI_D_INFO, "RapidStartSmmEntryPoint()\n"));
+
+ Status = gBS->LocateProtocol (
+ &gRapidStartGlobalNvsAreaProtocolGuid,
+ NULL,
+ (VOID **) &RapidStartGlobalNvsAreaProtocol
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_INFO, "No RapidStart info protocol available\n"));
+ ASSERT (0);
+ return Status;
+ }
+
+#ifdef ISCT_FLAG
+ mIsctNvs = NULL;
+ ///
+ /// Locate ISCT Global NVS protocol.
+ ///
+ Status = gBS->LocateProtocol (
+ &gIsctNvsAreaProtocolGuid,
+ NULL,
+ &IsctNvsAreaProtocol
+ );
+ if (!EFI_ERROR (Status)) {
+ mIsctNvs = IsctNvsAreaProtocol->Area;
+ mIsctNvs->IsctOverWrite = 0;
+ }
+#endif //ISCT_FLAG
+ mRapidStartData = RapidStartGlobalNvsAreaProtocol->RapidStartData;
+ mRapidStartGlobalNvs = RapidStartGlobalNvsAreaProtocol->Area;
+ mRapidStartMemData = RAPID_START_MEM_DATA_PTR (mRapidStartData);
+ mRapidStartZeroPageBitMap = RAPID_START_ZERO_PAGE_BITMAP_PTR (mRapidStartData);
+ mCrc32Record = RAPID_START_CRC32_RECORD_PTR (mRapidStartData);
+
+ DEBUG ((EFI_D_INFO, "RapidStartGlobalNvs: %x\n", mRapidStartGlobalNvs));
+ DEBUG ((EFI_D_INFO, "RapidStartMemData: %x\n", mRapidStartMemData));
+ DEBUG ((EFI_D_INFO, "RapidStartZeroPageBitMap: %x\n", mRapidStartZeroPageBitMap));
+ DEBUG ((EFI_D_INFO, "CRC32 record: %x\n", mCrc32Record));
+
+ mRapidStartMemData->OsWakeTimeEnabled = 0;
+
+ Status = gBS->LocateProtocol (
+ &gEfiSmmSxDispatchProtocolGuid,
+ NULL,
+ (VOID **) &SxDispatchProtocol
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Register S3 entry phase call back function
+ ///
+ EntryDispatchContext.Type = SxS3;
+ EntryDispatchContext.Phase = SxEntry;
+ Status = SxDispatchProtocol->Register (
+ SxDispatchProtocol,
+ RapidStartS3EntryCallback,
+ &EntryDispatchContext,
+ &DispatchHandle
+ );
+ ASSERT_EFI_ERROR (Status);
+
+#ifdef RAPID_START_WHOLE_MEMORY_CHECK
+ ///
+ /// Locate the SMM SW dispatch protocol
+ ///
+ Status = gBS->LocateProtocol (&gEfiSmmSwDispatchProtocolGuid, NULL, &SwDispatch);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// Register SWSMI handler
+ ///
+ DEBUG ((EFI_D_INFO, "Register RapidStart SwSmi: %x\n", SW_SMI_WHOLE_MEMORY_CHECK));
+ SwContext.SwSmiInputValue = SW_SMI_WHOLE_MEMORY_CHECK;
+ Status = SwDispatch->Register (
+ SwDispatch,
+ RapidStartSwSmiCallback,
+ &SwContext,
+ &DispatchHandle
+ );
+ ASSERT_EFI_ERROR (Status);
+#endif
+
+ return EFI_SUCCESS;
+}
diff --git a/ReferenceCode/RapidStart/Smm/RapidStartSmm.cif b/ReferenceCode/RapidStart/Smm/RapidStartSmm.cif
new file mode 100644
index 0000000..d165c6b
--- /dev/null
+++ b/ReferenceCode/RapidStart/Smm/RapidStartSmm.cif
@@ -0,0 +1,14 @@
+<component>
+ name = "RapidStartSmm"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\RapidStart\Smm"
+ RefName = "RapidStartSmm"
+[files]
+"RapidStartSmm.sdl"
+"RapidStartSmm.h"
+"RapidStartSmm.mak"
+"RapidStartSmm.c"
+"RapidStartSmm.dxs"
+"RapidStartSmm.inf"
+"x64\RapidStartAsm.asm"
+<endComponent>
diff --git a/ReferenceCode/RapidStart/Smm/RapidStartSmm.dxs b/ReferenceCode/RapidStart/Smm/RapidStartSmm.dxs
new file mode 100644
index 0000000..af3643c
--- /dev/null
+++ b/ReferenceCode/RapidStart/Smm/RapidStartSmm.dxs
@@ -0,0 +1,47 @@
+/** @file
+ Dependency expression source file.
+
+@copyright
+ Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+**/
+
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "DxeDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+
+#include EFI_PROTOCOL_DEPENDENCY (SmmBase)
+#include EFI_PROTOCOL_DEPENDENCY (SmmSxDispatch)
+#include EFI_PROTOCOL_DEPENDENCY (RapidStartGlobalNvsArea)
+#include EFI_ARCH_PROTOCOL_DEFINITION (Variable)
+#endif
+
+DEPENDENCY_START
+ EFI_SMM_BASE_PROTOCOL_GUID AND
+ EFI_SMM_SX_DISPATCH_PROTOCOL_GUID AND
+ EFI_VARIABLE_ARCH_PROTOCOL_GUID AND
+ RAPID_START_GLOBAL_NVS_AREA_PROTOCOL_GUID
+DEPENDENCY_END
diff --git a/ReferenceCode/RapidStart/Smm/RapidStartSmm.h b/ReferenceCode/RapidStart/Smm/RapidStartSmm.h
new file mode 100644
index 0000000..c5fb174
--- /dev/null
+++ b/ReferenceCode/RapidStart/Smm/RapidStartSmm.h
@@ -0,0 +1,47 @@
+/** @file
+ Header file for RapidStart SMM S3 Handler.
+
+@copyright
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Mobile Silicon Support Module" and is
+ licensed for Intel Mobile CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _RAPID_START_SMM_H_
+#define _RAPID_START_SMM_H_
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+//
+// Driver Consumed Protocol Prototypes
+//
+#include EFI_PROTOCOL_CONSUMER (LoadedImage)
+#include EFI_PROTOCOL_DEPENDENCY (SmmBase)
+#include EFI_PROTOCOL_DEPENDENCY (SmmSxDispatch)
+#include EFI_PROTOCOL_DEPENDENCY (DevicePath)
+#include EFI_ARCH_PROTOCOL_DEFINITION (Variable)
+
+UINT64
+ScanValueMem64 (
+ VOID* BaseAddress,
+ UINT64 PageSize,
+ UINT64 Index
+);
+
+#endif
+#endif
diff --git a/ReferenceCode/RapidStart/Smm/RapidStartSmm.inf b/ReferenceCode/RapidStart/Smm/RapidStartSmm.inf
new file mode 100644
index 0000000..e9017a5
--- /dev/null
+++ b/ReferenceCode/RapidStart/Smm/RapidStartSmm.inf
@@ -0,0 +1,104 @@
+## @file
+# Component description file for the RapidStart SMM module.
+#
+#@copyright
+# Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = RapidStartSmm
+FILE_GUID = 43172851-cf7e-4345-9fe0-d7012bb17b88
+COMPONENT_TYPE = RT_DRIVER
+
+[sources.common]
+ RapidStartSmm.c
+ RapidStartSmm.h
+ x64/RapidStartAsm.asm
+
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueSmmDriverEntryPoint.c
+
+[includes.common]
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Framework
+ .
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Core/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include/Pcd
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include/Library
+ $(EDK_SOURCE)/Foundation/Cpu/Pentium/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include/Library
+ $(EFI_SOURCE)/$(PROJECT_RAPID_START_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_RAPID_START_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_RAPID_START_ROOT)/Samplecode
+ $(EFI_SOURCE)/$(PROJECT_RAPID_START_ROOT)/Samplecode/Include
+ $(EFI_SOURCE)/$(PROJECT_RAPID_START_ROOT)/Samplecode/Library/RapidStartCommonLib
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Include
+#
+# Uncomment the following ISCT include directories if ISCT is supported
+#
+ $(EFI_SOURCE)/Platform/Isct
+
+[libraries.common]
+ EdkProtocolLib
+ ArchProtocolLib
+ EdkFrameworkProtocolLib
+ EdkIIGlueBaseLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueBaseMemoryLib
+ EdkIIGlueDxeMemoryAllocationLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueSmmRuntimeDxeReportStatusCodeLib
+ EdkIIGlueBasePciLibPciExpress
+ EdkIIGlueUefiLib
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiDevicePathLib
+ EfiProtocolLib
+ RapidStartCommonLib
+ RapidStartProtocolLib
+ RapidStartGuidLib
+ PchPlatformLib
+#
+# Uncomment the following ISCT include directories if ISCT is supported
+#
+ IsctProtocolLib
+ IsctGuidLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT=_ModuleEntryPoint
+ DPX_SOURCE=RapidStartSmm.dxs
+
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=RapidStartSmmEntryPoint
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_LIB__ \
+ -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_SMM_RUNTIME_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_UEFI_LIB__\
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_DEVICE_PATH_LIB__ \
+ -D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__
diff --git a/ReferenceCode/RapidStart/Smm/RapidStartSmm.mak b/ReferenceCode/RapidStart/Smm/RapidStartSmm.mak
new file mode 100644
index 0000000..efa04b7
--- /dev/null
+++ b/ReferenceCode/RapidStart/Smm/RapidStartSmm.mak
@@ -0,0 +1,130 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2012, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+# $Header: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/RapidStartSmm/RapidStartSmm.mak 3 10/15/12 5:38a Bensonlai $
+#
+# $Revision: 3 $
+#
+# $Date: 10/15/12 5:38a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/RapidStartSmm/RapidStartSmm.mak $
+#
+# 3 10/15/12 5:38a Bensonlai
+# [Category] Improvement
+# [Severity] Important
+# [Description] Rename all IFFS sting to Rapid Start.
+# [Files] Board\EM\RapidStartWrapper\*.*, ReferenceCode\RapidStart\*.*
+#
+# 2 9/26/12 3:33a Yurenlai
+# [TAG] None
+# [Category] Improvement
+# [Severity] Important
+# [Description] Update Intel Rapid Start Technology Framework Reference
+# Code Beta Version 0.7.0.
+# [Description] ReferenceCode\RapidStart\*.*, RapidStartPeiLib.h
+#
+# 1 4/19/12 8:07a Yurenlai
+# Initial check in.
+#
+#*************************************************************************
+
+EDK : RapidStartSmm
+
+RapidStartSmm : $(BUILD_DIR)\RapidStartSmm.mak RapidStartSmmBin
+
+$(BUILD_DIR)\RapidStartSmm.mak : $(RapidStartSmm_DIR)\$(@B).cif $(RapidStartSmm_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(RapidStartSmm_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+RapidStartSmm_INCLUDES=\
+ $(RAPIDSTART_INCLUDES)\
+ $(INTEL_PCH_INCLUDES)\
+ $(INTEL_MCH_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ /I$(IntelPlatformProtocolLib_DIR)\
+!IF "$(ISCT_PLATFORM_SUPPORT)"=="1"
+ /I$(ISCT_PLATFORM_DIR)\
+!ENDIF
+
+RapidStartSmm_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=RapidStartSmmEntryPoint"\
+ /D __EDKII_GLUE_BASE_LIB__ \
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \
+ /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_SMM_RUNTIME_DXE_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_UEFI_LIB__ \
+ /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \
+ /D __EDKII_GLUE_UEFI_DEVICE_PATH_LIB__ \
+ /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \
+
+RapidStartSmm_LIB_LINKS =\
+ $(EFIPROTOCOLLIB)\
+ $(EDKPROTOCOLLIB)\
+ $(EDKFRAMEWORKPROTOCOLLIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+!IF "$(x64_BUILD)"=="1"
+ $(EdkIIGlueBaseLibX64_LIB)\
+!ELSE
+ $(EdkIIGlueBaseLibIA32_LIB)\
+!ENDIF
+ $(ArchProtocolLib)\
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGlueDxeMemoryAllocationLib_LIB)\
+ $(EdkIIGlueDxeServicesTableLib_LIB)\
+ $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\
+ $(EdkIIGlueSmmRuntimeDxeReportStatusCodeLib_LIB)\
+ $(EdkIIGlueBasePciLibPciExpress_LIB)\
+ $(EdkIIGlueUefiLib_LIB)\
+ $(EdkIIGlueUefiBootServicesTableLib_LIB)\
+ $(EdkIIGlueUefiDevicePathLib_LIB)\
+ $(RapidStartCommonSmmLib_LIB)\
+ $(RapidStartProtocolLib_LIB)\
+ $(PchPlatformSmmLib_LIB)\
+ $(RapidStartGuidLib_LIB)\
+ $(INTEL_PCH_PROTOCOL_LIB)\
+!IF "$(ISCT_PLATFORM_SUPPORT)"=="1"
+ $(IsctGuidLib_LIB)\
+ $(IsctProtocolLib_LIB)\
+!ENDIF
+
+RapidStartSmmBin: $(RapidStartSmm_LIB_LINKS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\RapidStartSmm.mak all \
+ "MY_INCLUDES=$(RapidStartSmm_INCLUDES)" \
+ "MY_DEFINES=$(RapidStartSmm_DEFINES)" \
+ GUID=43172851-cf7e-4345-9fe0-d7012bb17b88\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=BS_DRIVER\
+ EDKIIModule=SMMDRIVER\
+ DEPEX1=$(RapidStartSmm_DIR)\RapidStartSmm.dxs\
+ DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \
+ COMPRESS=1
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2012, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
diff --git a/ReferenceCode/RapidStart/Smm/RapidStartSmm.sdl b/ReferenceCode/RapidStart/Smm/RapidStartSmm.sdl
new file mode 100644
index 0000000..4660102
--- /dev/null
+++ b/ReferenceCode/RapidStart/Smm/RapidStartSmm.sdl
@@ -0,0 +1,97 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+# $Header: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/RapidStartSmm/RapidStartSmm.sdl 3 12/27/12 1:19a Bensonlai $
+#
+# $Revision: 3 $
+#
+# $Date: 12/27/12 1:19a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/RapidStartSmm/RapidStartSmm.sdl $
+#
+# 3 12/27/12 1:19a Bensonlai
+# [TAG] None
+# [Category] Improvement
+# [Description] Change the SMI port to 0xB5 for
+# AMI_SW_SMI_WHOLE_MEMORY_CHECK.
+# [Files] RapidStartSmm.sdl
+#
+# 2 8/14/12 7:52a Yurenlai
+# [TAG] None
+# [Category] Improvement
+# [Severity] Important
+# [Description] Support ASLPREPROCESS_FLAG to include Iintel RC flags.
+# [Description] RapidStart.sdl, RapidStartSmm.sdl
+#
+# 1 4/19/12 8:07a Yurenlai
+# Initial check in.
+#
+#*************************************************************************
+TOKEN
+ Name = "RapidStartSmm_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable RapidStartSmm support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+End
+
+TOKEN
+ Name = "AMI_SW_SMI_WHOLE_MEMORY_CHECK"
+ Value = "0xB5"
+ Help = "SWSMI# for whole memory check."
+ TokenType = Integer
+ TargetH = Yes
+ TargetMAK = Yes
+ Token = "WHOLE_MEMORY_CHECK" "=" "1"
+End
+
+PATH
+ Name = "RapidStartSmm_DIR"
+End
+
+MODULE
+ Help = "Includes RapidStartSmm.mak to Project"
+ File = "RapidStartSmm.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\RapidStartSmm.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/D SW_SMI_WHOLE_MEMORY_CHECK=$(AMI_SW_SMI_WHOLE_MEMORY_CHECK)"
+ Parent = "INTEL_IRST_RC_FLAGS"
+ Token = "WHOLE_MEMORY_CHECK" "=" "1"
+ InvokeOrder = AfterParent
+End
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (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/ReferenceCode/RapidStart/Smm/x64/RapidStartAsm.asm b/ReferenceCode/RapidStart/Smm/x64/RapidStartAsm.asm
new file mode 100644
index 0000000..84c501f
--- /dev/null
+++ b/ReferenceCode/RapidStart/Smm/x64/RapidStartAsm.asm
@@ -0,0 +1,56 @@
+;
+; This file contains an 'Intel Peripheral Driver' and is
+; licensed for Intel CPUs and chipsets under the terms of your
+; license agreement with Intel or your vendor. This file may
+; be modified by the user, subject to additional terms of the
+; license agreement
+;
+ page ,132
+ title RapidStart ARCHITECTURAL SMM ASSEMBLY HOOKS
+;------------------------------------------------------------------------------
+;
+; Copyright (c) 2005 -2012 Intel Corporation. All rights reserved
+; This software and associated documentation (if any) is furnished
+; under a license and may only be used or copied in accordance
+; with the terms of the license. Except as permitted by such
+; license, no part of this software or documentation may be
+; reproduced, stored in a retrieval system, or transmitted in any
+; form or by any means without the express written consent of
+; Intel Corporation.
+;
+; Module Name:
+;
+; RapidStartAsm.asm
+;
+; Abstract:
+;
+; Assembly code of the implementation of X64 RapidStart
+;
+;------------------------------------------------------------------------------
+
+text SEGMENT
+
+;------------------------------------------------------------------------------
+; UINT64
+; ScanValueMem64 (
+; VOID* BaseAddress,
+; UINT64 PageSize,
+; UINT64 Index
+; )
+;------------------------------------------------------------------------------
+ScanValueMem64 PROC USES rbx rsi rdi
+ xor rsi, rsi
+ dec rsi
+ mov rdi, rcx
+ mov rax, r8
+ mov rcx, rdx
+ repe scasq
+ mov rax, rsi
+ lea rbx, [rdi - 8]
+ cmovne rax, rbx
+ ret
+ScanValueMem64 ENDP
+
+text ENDS
+END
+